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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
3a51b22eea5a74d05e199908ed6bbfc4c1137c85 | 90047daeb462598a924d76ddf4288e832e86417c | /cc/test/ordered_simple_task_runner.h | 8051415f029fffec72bd03fa104f2c90be36e376 | [
"BSD-3-Clause"
] | permissive | massbrowser/android | 99b8c21fa4552a13c06bbedd0f9c88dd4a4ad080 | a9c4371682c9443d6e1d66005d4db61a24a9617c | refs/heads/master | 2022-11-04T21:15:50.656802 | 2017-06-08T12:31:39 | 2017-06-08T12:31:39 | 93,747,579 | 2 | 2 | BSD-3-Clause | 2022-10-31T10:34:25 | 2017-06-08T12:36:07 | null | UTF-8 | C++ | false | false | 6,268 | h | // Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CC_TEST_ORDERED_SIMPLE_TASK_RUNNER_H_
#define CC_TEST_ORDERED_SIMPLE_TASK_RUNNER_H_
#include <stddef.h>
#include <limits>
#include <memory>
#include <set>
#include <vector>
#include "base/callback.h"
#include "base/compiler_specific.h"
#include "base/logging.h"
#include "base/macros.h"
#include "base/test/simple_test_tick_clock.h"
#include "base/test/test_simple_task_runner.h"
#include "base/threading/thread_checker.h"
#include "base/trace_event/trace_event.h"
namespace cc {
// Subclass of TestPendingTask which has a unique ID for every task, supports
// being used inside a std::set and has debug tracing support.
class TestOrderablePendingTask : public base::TestPendingTask {
public:
TestOrderablePendingTask();
TestOrderablePendingTask(const tracked_objects::Location& location,
base::OnceClosure task,
base::TimeTicks post_time,
base::TimeDelta delay,
TestNestability nestability);
TestOrderablePendingTask(TestOrderablePendingTask&&);
~TestOrderablePendingTask();
TestOrderablePendingTask& operator=(TestOrderablePendingTask&&);
// operators needed by std::set and comparison
bool operator==(const TestOrderablePendingTask& other) const;
bool operator<(const TestOrderablePendingTask& other) const;
// base::trace_event tracing functionality
std::unique_ptr<base::trace_event::ConvertableToTraceFormat> AsValue() const;
void AsValueInto(base::trace_event::TracedValue* state) const;
size_t task_id() const { return task_id_; }
private:
static size_t task_id_counter;
size_t task_id_;
DISALLOW_COPY_AND_ASSIGN(TestOrderablePendingTask);
};
// This runs pending tasks based on task's post_time + delay.
// We should not execute a delayed task sooner than some of the queued tasks
// which don't have a delay even though it is queued early.
class OrderedSimpleTaskRunner : public base::SingleThreadTaskRunner {
public:
OrderedSimpleTaskRunner(base::SimpleTestTickClock* now_src, bool advance_now);
// base::TestSimpleTaskRunner implementation:
bool PostDelayedTask(const tracked_objects::Location& from_here,
base::OnceClosure task,
base::TimeDelta delay) override;
bool PostNonNestableDelayedTask(const tracked_objects::Location& from_here,
base::OnceClosure task,
base::TimeDelta delay) override;
bool RunsTasksOnCurrentThread() const override;
static base::TimeTicks AbsoluteMaxNow();
// Set a maximum number of tasks to run at once. Useful as a timeout to
// prevent infinite task loops.
static const size_t kAbsoluteMaxTasks;
void SetRunTaskLimit(size_t max_tasks) { max_tasks_ = max_tasks; }
void ClearRunTaskLimit() { max_tasks_ = kAbsoluteMaxTasks; }
// Allow task runner to advance now when running tasks.
void SetAutoAdvanceNowToPendingTasks(bool advance_now) {
advance_now_ = advance_now;
}
size_t NumPendingTasks() const;
bool HasPendingTasks() const;
base::TimeTicks NextTaskTime();
base::TimeDelta DelayToNextTaskTime();
// Run tasks while the callback returns true or too many tasks have been run.
// Returns true if there are still pending tasks left.
bool RunTasksWhile(base::Callback<bool(void)> condition);
// Run tasks while *all* of the callbacks return true or too many tasks have
// been run. Exits on the *first* condition which returns false, skipping
// calling all remaining conditions. Conditions can have side effects,
// including modifying the task queue.
// Returns true if there are still pending tasks left.
bool RunTasksWhile(const std::vector<base::Callback<bool(void)>>& conditions);
// Convenience functions to run tasks with common conditions.
// Run tasks which existed at the start of this call.
// Return code indicates tasks still exist to run.
bool RunPendingTasks();
// Keep running tasks until no tasks are left.
// Return code indicates tasks still exist to run which also indicates if
// runner reached idle.
bool RunUntilIdle();
// Keep running tasks until given time period.
// Return code indicates tasks still exist to run.
bool RunUntilTime(base::TimeTicks time);
bool RunForPeriod(base::TimeDelta period);
// base::trace_event tracing functionality
std::unique_ptr<base::trace_event::ConvertableToTraceFormat> AsValue() const;
virtual void AsValueInto(base::trace_event::TracedValue* state) const;
// Common conditions to run for, exposed publicly to allow external users to
// use their own combinations.
// -------------------------------------------------------------------------
// Keep running until the given number of tasks have run.
// You generally shouldn't use this check as it will cause your tests to fail
// when code is changed adding a new task. It is useful as a "timeout" type
// solution.
base::Callback<bool(void)> TaskRunCountBelow(size_t max_tasks);
// Keep running until a task which didn't exist initially would run.
base::Callback<bool(void)> TaskExistedInitially();
// Stop running tasks when NextTaskTime() >= stop_at
base::Callback<bool(void)> NowBefore(base::TimeTicks stop_at);
// Advance Now() to the next task to run.
base::Callback<bool(void)> AdvanceNow();
// Removes all tasks whose weak pointer has been revoked.
void RemoveCancelledTasks();
protected:
static bool TaskRunCountBelowCallback(size_t max_tasks, size_t* task_run);
bool TaskExistedInitiallyCallback(const std::set<size_t>& existing_tasks);
bool NowBeforeCallback(base::TimeTicks stop_at);
bool AdvanceNowCallback();
~OrderedSimpleTaskRunner() override;
base::ThreadChecker thread_checker_;
bool advance_now_;
// Not owned.
base::SimpleTestTickClock* now_src_;
size_t max_tasks_;
bool inside_run_tasks_until_;
std::set<TestOrderablePendingTask> pending_tasks_;
private:
DISALLOW_COPY_AND_ASSIGN(OrderedSimpleTaskRunner);
};
} // namespace cc
#endif // CC_TEST_ORDERED_SIMPLE_TASK_RUNNER_H_
| [
"xElvis89x@gmail.com"
] | xElvis89x@gmail.com |
69d9bf0d4e46695b106d5a7db98ae63746fbeae1 | c8a3f2f6f7eda6369a5c13f637a333be865a838c | /Purple/VuPurple/Games/.svn/text-base/VuEliminationGame.h.svn-base | 7ecc29317949249b1811ca700dc813411fadfc70 | [] | no_license | PenpenLi/tools_script | e3a73775bb2b19fb13b7d15dce5d47c38566c6ca | 8f0fce77799e4598ff00d408083597a306f8e22e | refs/heads/master | 2021-06-07T22:38:17.214344 | 2016-11-21T02:10:50 | 2016-11-21T02:10:50 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,357 | //*****************************************************************************
//
// Copyright (c) 2013-2013 Vector Unit Inc
// Confidential Trade Secrets
//
// EliminationGame class
//
//*****************************************************************************
#pragma once
#include "VuGame.h"
class VuEliminationGame : public VuGame
{
DECLARE_RTTI
public:
VuEliminationGame(VuProject *pProject);
~VuEliminationGame();
private:
// VuKeyboard::Callback
virtual void onKeyDown(VUUINT32 key);
virtual void onLoad(const VuJsonContainer &data);
virtual void onPreBegin();
virtual void onPostBegin();
virtual void onEnd();
virtual void onCarFinished(VuCarEntity *pCar);
void onIntroEnter();
void onIntroExit();
void onIntroTick(float fdt);
void onPreGameEnter();
void onPreGameExit();
void onPreGameTick(float fdt);
void onGameEnter();
void onGameTick(float fdt);
void onPostGameEnter();
void onPostGameExit();
void onPostGameTick(float fdt);
void updatePlacing();
int mEliminationTime;
float mEliminationTimer;
// placing
class VuPlacingComp
{
public:
VuPlacingComp(const Cars &cars) : mCars(cars) {}
bool operator()(int i0, int i1);
const Cars &mCars;
};
typedef std::vector<int> Placing;
Placing mPlacing;
}; | [
"chris@lis-Mac-mini.local"
] | chris@lis-Mac-mini.local | |
eb3de2a17914ba38140ac9bb87537332acc0c87b | 8d06926a13cf074b52b9300fab848facebe14f37 | /CodeForces/CF 669 Div 2/C/main.cpp | fa0ba6849446734e11f7f1cabc5c7d25062ce49b | [
"MIT"
] | permissive | MuhamedAbdalla/MyProblemSolving-Contest-Solutions | 60273075ead4a24f6ecfd4cb29abec55f35523b8 | ad66158da86d00f32a58974c8bed29a7407c08e9 | refs/heads/main | 2023-01-01T02:07:12.100459 | 2020-10-18T17:00:40 | 2020-10-18T17:00:40 | 300,402,768 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 704 | cpp | #include <bits/stdc++.h>
using namespace std;
int get(int l, int r) {
cout << "? " << l << " " << r << endl;
int ret;
cin >> ret;
return ret;
}
int main() {
cout.flush();
int n;
cin >> n;
vector<int> v;
for (int i = 0; i <= n; i++) {
v.push_back(-1);
}
int l = 1, r = 2;
while (r <= n) {
int lr = get(l, r);
int rl = get(r, l);
if (lr > rl) {
v[l] = lr;
l = r;
r++;
}
else {
v[r] = rl;
r++;
}
}
v[l] = n;
cout << "! ";
for (int i = 1; i <= n; i++) {
cout << v[i] << " ";
}
cout << endl;
return 0;
}
| [
"72211774+MuhamedAbdalla@users.noreply.github.com"
] | 72211774+MuhamedAbdalla@users.noreply.github.com |
a36ea32346a0de24e862f5eeeafb0068dcadab67 | 265bee2362afc8ae0138792efda7e065540d1a2a | /Mul_light/Kernel/WM/WM.cpp | 336a72e8a68ef150c1497017039830fcd03408cc | [] | no_license | k1lowM/Mul-light | 1a1cde6cabbd341b8ad1b7a274fb504160bf9c8a | 738a72094627b2e7e85b2fc69fe0a4be3a3ddaaa | refs/heads/master | 2021-01-17T19:57:43.631909 | 2016-08-05T13:49:19 | 2016-08-05T13:49:19 | 65,015,369 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 12,992 | cpp | /*■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
ファイル名 : /Mul_light/Kernel/WM/WM.cpp
概要 : ウィンドウ管理
詳細 :
責任者 : 佐合 秀昭
■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■*/
/*■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
インクルード
■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■*/
#include "Common.h"
#include "WM.h"
#include "GMQ.h"
#include "DM.h"
#include "VFS.h"
#include "APM.h"
#include "Define/WM_Window.h"
//画像ライブラリ
#include "Image.h"
#include "Bmp.h"
#include <string.h>
/*■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
定数・マクロ定義
■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■*/
namespace
{
//マウスのボタン情報
enum
{
MOUSE_LEFT_BUTTON = 0x01, //左ボタン
MOUSE_RIGHT_BUTTON = 0x02, //右ボタン
MOUSE_CENTER_BUTTON = 0x04, //中央ボタン
MOUSE_BUTTON_MASK = 0x07, //ボタンマスク
};
//スクリーン・ピクセル・マップ
//スクリーンのどのピクセルにどのウィンドウ(デスクトップやタスクバー含む)が
// 配置されているかを格納するビットマップのようなもの。)
enum
{
SPM_BASE = 0x400000,
SPM_SIZE = 0x300000,
};
}
/*■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
グローバル
■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■*/
Task* GP_WMTask; //ウィンドウ管理タスク
GMQ G_GMQ; //グローバル・メッセージ・キュー
extern WM G_WM;
extern TM G_TM;
extern DM G_DM;
extern VFS G_VFS;
extern APM G_APM;
/*■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
ウィンドウ管理クラス:静的パブリックメソッド
■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■*/
/*******************************************************************************
概要 : ウィンドウ管理タスク
説明 :
Include : WM.h
引数 : void
戻り値 : void
*******************************************************************************/
void WM::Task( void )
{
G_WM.Init();
G_WM.Main();
while( true )
G_TM.SleepTask();
}
/*■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
ウィンドウ管理クラス:パブリックメソッド
■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■*/
/*******************************************************************************
概要 : ウィンドウ管理クラスの初期化
説明 :
Include : WM.h
引数 : void
戻り値 : void
*******************************************************************************/
void WM::Init( void )
{
u1 Au1_BmpHeadBuf[256]; //bmpヘッダバッファ
u1 u1_DeviceID; //デバイスID
DevInfo DevInfo; //デバイス情報
char Ac_FilePath[256]; //ファイルパス
//メンバ初期化
{
//リスト管理初期化
M_WinLM.Init();
MPPA_SPM = (WinList*(*)[WINBUF_MAX_WIDTH])SPM_BASE;
Mui_WinRsrcGMID = 0; //ウィンドウリソースGMID
Mui_BtnRsrcGMID = 0; //ボタンリソースGMID
MP_Focus = NULL; //フォーカスウィンドウリスト
MP_FocusObj = NULL; //フォーカスオブジェクト
M_Flags.Init( WINDOW_RESIZE_DISABLE | WINDOW_MOVE_DISABLE );
//マウス情報
Mui_MouseX = G_GUI.GetResX() >> 1; //マウス座標X
Mui_MouseY = G_GUI.GetResY() >> 1; //マウス座標Y
Mu4_MouseButton = 0; //マウスボタンフラグ
MP_MOW = NULL; //マウスが重なったウィンドウリスト
MP_MOO = NULL; //マウスが重なったオブジェクトのポインタ
M_MOOArea.Init(); //MOOの有効領域
Mu1_WinBtnNo = NUM_BUTTON_TYPE; //ウィンドウボタン番号
}
G_GMQ.Init(); //グローバル・メッセージ・キュー初期化
G_TM.DisableTS(); //タスクスイッチ禁止
//CDデバイスを検索
for( u1_DeviceID = 0; ; u1_DeviceID++ )
{
DevInfo = G_DM.GetDevInfo( u1_DeviceID ); //デバイス情報取得
//CDデバイスなら画像を読み取る
if( DevInfo.P_Driver->GetDeviceType() == DT::CDD )
{
//ファイルヘッダ、情報ヘッダ読み込み
sprintf( Ac_FilePath, "/%d%s", u1_DeviceID, IMG_WINDOW_FP );
if( G_VFS.Read( Ac_FilePath, 0, Au1_BmpHeadBuf,sizeof Au1_BmpHeadBuf ) > 0 )
break; //見つかれば検索終了。画像の読み取りに入る。
}
if( u1_DeviceID == 0xff )
{
G_TM.EnableTS(); //タスクスイッチ許可
DP( "WM::Init()\t\t\t\t\t\t\t\t\t[Failed]" );
return; //システムのディスクが見つからない。
}
}
//以下、システムディスクが見つかった場合の処理
G_TM.EnableTS(); //タスクスイッチ許可
//各種初期化
InitWindow( u1_DeviceID ); //ウィンドウ関連初期化
InitButton( u1_DeviceID ); //ボタン関連初期化
DP( "WM::Init()\t\t\t\t\t\t\t\t\t[ OK ]" );
return;
}
/*******************************************************************************
概要 : ウィンドウ管理のメイン
説明 : GMQ(グローバル・メッセージ・キュー)からデータを取り出し、
各ウィンドウなどにメッセージを送ります。
Include : WM.h
引数 : void
戻り値 : void
*******************************************************************************/
void WM::Main( void )
{
Msg Message; //メッセージ格納バッファ
//休止
_Sleep:
G_TM.SleepTask();
while( true )
{
//メッセージを取得。エラーがあれば休止。
if( G_GMQ.Dequeue( &Message ) < 0 )
goto _Sleep;
//メッセージ送信処理
SendMessage( Message );
continue; //もう一度実行。
}
}
/*******************************************************************************
概要 : ウィンドウ登録
説明 : LDTを使ったアプリケーションがシステムコールを通して使う関数です。
カーネルは使用禁止!
Include : WM.h
引数 : ui ui_AppliID アプリケーションID
Window* P_Window ウィンドウポインタ(ローカルポインタ)
戻り値 : s4 エラー情報
*******************************************************************************/
s4 WM::RegiWindow( ui ui_AppliID, Window* P_Window )
{
WinList* P_WinList; //ウィンドウリストポインタ
ui ui_WinListTempKMID; //ウィンドウリストクラスの一時的なメモリID
Appli* P_Appli = G_APM.GetAppli( ui_AppliID ); //アプリケーションクラスポインタ
void* Pv_LocalBase = P_Appli->GetLocalBase(); //ローカルのベースアドレス
//エラー処理
if( P_Appli == NULL ) //NULLポインタエラー
return ERROR_NULLPOINTER;
P_Window = (Window*)KStdLib::ConvL2K( P_Window, Pv_LocalBase );
//ウィンドウリストのメモリ領域確保
if( !( ui_WinListTempKMID = G_KMA.Create( sizeof (WinList) ) ) )
return ERROR_MEMORYALLOC;
//ウィンドウリスト構造体の設定
P_WinList = (WinList*)G_KMA.GetBase( ui_WinListTempKMID ); //ウィンドウリスト本体のアドレス設定
P_WinList->ui_WinListKMID = ui_WinListTempKMID; //ウィンドウリストのメモリ領域IDを格納
P_WinList->P_Window = P_Window; //ウィンドウポインタを設定
P_WinList->ui_WinBufGMID = 0; //ウィンドウバッファメモリID
P_WinList->ui_AppliID = ui_AppliID; //アプリケーションID
P_WinList->Pv_LocalBase = Pv_LocalBase; //ローカルのベースアドレス
//ウィンドウバッファ確保
if( !( P_WinList->ui_WinBufGMID = G_GMA.Create( WINBUF_SIZE ) ) )
{
G_KMA.Delete( ui_WinListTempKMID ); //ウィンドウリストのメモリ領域削除
return ERROR_MEMORYALLOC;
}
//ウィンドウリストのアドレスを設定
P_Window->SetKWinList( P_WinList );
//ウィンドウリストに結合(先頭:一番手前に)
M_WinLM.JoinHead( P_WinList );
//フォーカス変更
MP_Focus = P_WinList;
MP_FocusObj = (Object*)KStdLib::ConvL2K( P_WinList->P_Window, Pv_LocalBase );
//Msg::INITIALIZE送信
{
Msg Message;
Message.Init( Msg::INITIALIZE );
P_Window->SendMessage( Message );
}
DP( "WM::RegiWindow():SUCCESS" );
return SUCCESS;
}
/*******************************************************************************
概要 : ウィンドウ削除
説明 :
Include : WM.h
引数 : ui ui_AppliID 削除するウィンドウのアプリケーションID
戻り値 : void
*******************************************************************************/
void WM::DeleteWindow( ui ui_AppliID )
{
//ウィンドウバッファの開放
for( WinList* P_WinList = (WinList*)M_WinLM.GetHeadList(); M_WinLM.GetHeadList() != NULL; P_WinList = (WinList*)P_WinList->P_Next )
{
//同じアプリケーションIDのウィンドウリストがあれば、ウィンドウリストごと削除
if( P_WinList->ui_AppliID == ui_AppliID )
{
M_WinLM.Split( P_WinList ); //ウィンドウリストを切り離す。
G_GMA.Delete( P_WinList->ui_WinBufGMID ); //ウィンドウバッファ削除
G_KMA.Delete( P_WinList->ui_WinListKMID ); //ウィンドウリスト自身を削除
}
//削除するウィンドウがマウス座標のウィンドウなら、NULLに設定。
if( MP_MOW == P_WinList )
MP_MOW = NULL;
//最後まで検索したら終了
if( P_WinList == M_WinLM.GetTailList() )
break;
}
G_GUI.FullDrawUpdate();
}
/*******************************************************************************
概要 : 各種ゲッター
説明 : メンバを返すだけなので、説明省略。
Include : WM.h
*******************************************************************************/
ui WM::GetMouseX( void ) { return Mui_MouseX; } //マウスX座標
ui WM::GetMouseY( void ) { return Mui_MouseY; } //マウスY座標
/*■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
デスクトップクラス:プライベートメソッド
■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■*/
/*******************************************************************************
概要 : ローカルのベースアドレス取得
説明 : ウィンドウクラスのポインタから、ローカルのベースアドレスを取得します。
Include : WM.h
引数 : Window* P_Window ウィンドウクラスのポインタ(カーネルアドレス)
戻り値 : void* ローカルのベースアドレス
*******************************************************************************/
void* WM::GetLocalBase( Window* P_Window )
{
return G_APM.GetAppli( P_Window->GetAppliID() )->GetLocalBase();
}
/*******************************************************************************
概要 : Bmp画像読み取り
説明 :
Include : WM.h
引数 : const char* CPc_ImageFP ファイルパス
Color4* P_Dest 格納先バッファ
const ui Cui_BufSize バッファサイズ(byte)
戻り値 : s4 エラー情報
*******************************************************************************/
s4 WM::ReadBmp( const char* CPc_ImageFP, Color4* P_Dest, const ui Cui_BufSize )
{
Bmp::FileHead FileHead; //BMPファイルヘッダ
Bmp::WinBmpInfoHead InfoHead; //BMP情報ヘッダ
const ui Cui_BufNum = Cui_BufSize >> 2;
//画像読み取り
if( Bmp::Read( CPc_ImageFP, P_Dest, Cui_BufSize, &FileHead, &InfoHead ) < 0 )
return ERROR_READFAILED;
//色数変換
switch( InfoHead.u2_BitCount )
{
case 24:
Image::Color3to4( P_Dest, (Color3*)P_Dest, Cui_BufNum );
break;
case 32:
break;
default:
return ERROR_INVALIDBITCOUNT;
}
//上下反転
if( InfoHead.s4_Height > 0 )
Image::VFlip( P_Dest, InfoHead.s4_Width, InfoHead.s4_Height );
//透明色処理
Image::TransparentColorProcessing( P_Dest, Cui_BufNum );
return SUCCESS;
}
/*■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
End of file
■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■*/
| [
"makiuchi.k1low@gmail.com"
] | makiuchi.k1low@gmail.com |
c1a0d733f150b71ab190d1b8394a57db723110a6 | e7f7c431f63354dcc5c8e17a21f824b7352a52cb | /mac-subset-sum-no-adjacent/solution.cpp | 43989825866d2d76c457b12a5fff5a6323cf8d10 | [] | no_license | zhiwei1988/algo-expert | 8fc38cc48ec8dcad73da0365b0e65843284d337a | 015a25c1991b375b96cfd14dbbf71a2b7d82408a | refs/heads/master | 2023-04-19T04:37:17.533285 | 2021-05-08T05:33:06 | 2021-05-08T05:33:06 | 354,025,692 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 465 | cpp | #include <vector>
using namespace std;
// dp[i] 表示从下标 0 到下标 i 之前不相邻元素的最大和
int maxSubsetSumNoAdjacent(vector<int> array) {
if (array.size() == 0) {
return 0;
}
if (array.size() < 2) {
return array[0];
}
vector<int> dp(array.size(), 0);
dp[0] = array[0];
dp[1] = max(array[0], array[1]);
for (int i = 2; i < array.size(); i++) {
dp[i] = max(dp[i-1], dp[i-2] + array[i]);
}
return dp[array.size()-1];
}
| [
"zhiweix1988@gmail.com"
] | zhiweix1988@gmail.com |
146988c3d86a7ba54f03c34ad2f7b0a8a7154a5b | 171b27ba265922de7836df0ac14db9ac1377153a | /include/eve/detail/function/reduce.hpp | fef3fd1e10e4f7a6d386bdf000325d2f0c54604f | [
"MIT"
] | permissive | JPenuchot/eve | 30bb84af4bfb4763910fab96f117931343beb12b | aeb09001cd6b7d288914635cb7bae66a98687972 | refs/heads/main | 2023-08-21T21:03:07.469433 | 2021-10-16T19:36:50 | 2021-10-16T19:36:50 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,150 | hpp | //==================================================================================================
/*
EVE - Expressive Vector Engine
Copyright : EVE Contributors & Maintainers
SPDX-License-Identifier: MIT
*/
//==================================================================================================
#pragma once
#include <eve/concept/vectorized.hpp>
#include <eve/detail/abi.hpp>
#include <eve/function/swap_adjacent_groups.hpp>
#include <bit>
namespace eve::detail
{
//================================================================================================
// reduce toward wide using a generic butterfly algorithm
template<simd_value Wide, typename Callable>
EVE_FORCEINLINE auto butterfly_reduction(Wide v, Callable f) noexcept
{
if constexpr( Wide::size() == 1 )
{
return v;
}
else
{
constexpr auto depth = std::bit_width(std::size_t{Wide::size()}) - 1;
return [&]<std::size_t... I>(std::index_sequence<I...>) mutable
{
((v = f(v,swap_adjacent_groups(v, fixed<(1<<I)>{} ))),...);
return v;
}(std::make_index_sequence<depth>{});
}
}
}
| [
"noreply@github.com"
] | noreply@github.com |
922e23c652a5736efff2d8c00b1401e4e503cc2e | 85556d2252328c785bb57528878b7ad621a4af76 | /LuaCppFSM/src/main.cpp | 285c877a92495c5aff93ba8e163d2ef658850322 | [] | no_license | turdann/luacppfsm | 86ace1cf742e767597e452ef58ef1495422f1441 | 0bc5334c88e4eeae6caa926ee6a3546ea0f34cd4 | refs/heads/master | 2021-01-10T02:01:14.662585 | 2008-08-08T09:45:15 | 2008-08-08T09:45:15 | 52,820,764 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,481 | cpp | /*!
* main.cpp
*
* Created on: 19-jul-2008
* Author: Administrador
*/
#ifdef WIN32
#include <windows.h>
#define SLEEP(n) Sleep(n)
#else
#include <unistd.h>
#define SLEEP(n) usleep(n * 1000)
#endif
#include <vector>
using namespace std;
#include <lua.hpp>
#include <luabind/luabind.hpp>
#include <luabind/adopt_policy.hpp>
using namespace luabind;
#include "LuaHelpFunctions.h"
#include "EntityManager.h"
#include "Actor.h"
#include "Actor_wrapper.h"
#include "MessageDispatcher.h"
#include "CrudeTimer.h"
#include "RegisterToLua.h"
/*!
*
* @param argc
* @param argv
* @return
*/
int main(int argc, char *argv[]) {
vector<Actor*> Actores;
srand(time(NULL));
lua_State *Lua = lua_open();
luaL_openlibs(Lua);
open(Lua);// Connect LuaBind to this lua state
RegisterToLuaTelegram(Lua);
RegisterToLuaMessageDispacher(Lua);
RegisterToLuaCrudeTimer(Lua);
RegisterToLuaBaseGameEntity(Lua);
RegisterToLuaActor(Lua);
RegisterToLuaScriptedStateMachine(Lua);
globals(Lua)["ent_Miner_Bob"] = (int)ent_Miner_Bob;
globals(Lua)["ent_Elsa"] = (int)ent_Elsa;
set_pcall_callback(&add_file_and_line);
try {
RunLuaDoFile(Lua,"./scripts/Init.lua");
RunLuaDoFile(Lua,"./scripts/Miner.lua");
RunLuaDoFile(Lua,"./scripts/Wife.lua");
Actor* elMiner;
elMiner = call_function<Actor*>(Lua, "Miner", (int)ent_Miner_Bob)[adopt(result)];
EntityMgr->RegisterEntity(elMiner);
Actores.push_back(elMiner);
Actor* laWife;
laWife = call_function<Actor*>(Lua, "Wife", (int)ent_Elsa)[adopt(result)];
EntityMgr->RegisterEntity(laWife);
Actores.push_back(laWife);
for (int i = 0; i < 30; i++) {
for (vector<Actor*>::iterator j = Actores.begin(); j < Actores.end(); j++) {
(*j)->Update();
Dispatch->DispatchDelayedMessages();
SLEEP(800);
}
}
for (vector<Actor*>::iterator j = Actores.begin(); j < Actores.end(); j++) {
delete (*j);
}
Actores.erase(Actores.begin(), Actores.end());
cout << "Dimensiones vector =" << Actores.size() << endl;
lua_close(Lua);
}
catch (error e) {
object error_msg(from_stack(e.state(),-1));
cout << error_msg << " " << e.what() << endl;
return 1;
}
catch (cast_failed e){
object error_msg(from_stack(e.state(),-1));
cout << error_msg << " " << e.what() << endl;
return 1;
}
catch (exception e){
cout << "Throw error: " << e.what() << endl;
return 1;
}
return 0;
}
| [
"uberiain@hotmail.com"
] | uberiain@hotmail.com |
19df941ddd9511b752787221959f7faf35f2a65d | e65ac1e33216df384f9f0c7020f9227f959af1b1 | /_learnopengl/Classes/main.cpp | a61c7d74bd46d3bf37c2a05ae4170092c3983dfe | [] | no_license | Nuos/_mLearnOpengl | b86d159a906935bcbcfd5db09beb56f40d5549c5 | 911c0126509e31786b575823244b2b168d67ec19 | refs/heads/master | 2021-01-16T21:52:00.355049 | 2016-01-10T13:44:19 | 2016-01-10T13:44:19 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 454 | cpp | #include <main.h>
int testPart();
int main()
{
testPart();
return 0;
}
int testPart()
{
// start
//ModelLoad::enter();
//Color::enter();
//Coord::enter();
//Transform::enter();
//Texture::enter();
//HelloTriangle::enter();
// advanced
//DepthTest::enter();
//StencilTest::enter();
//DiscardFrag::enter();
//BlendTest::enter();
//FrameBuffer::enter();
Cubemaps::enter();
return 0;
} | [
"gaohuancai@gmail.com"
] | gaohuancai@gmail.com |
88834518d243ff88271a85b053206c6160100d3f | 32d00deba84b6e6c03ce6e69c21d4d6aab9b7c71 | /cpp/vmethods.cpp | 8e28917a8f45659fb1a3bad446e4d35c8d6d5044 | [
"BSD-3-Clause"
] | permissive | dterei/Scraps | c2b6b55df6554861bc0670be2aae659755748086 | 047b5b72888eb3dd29f1d6bab1aae63d1280e05e | refs/heads/master | 2022-07-30T05:08:30.106194 | 2022-06-21T23:20:46 | 2022-06-21T23:20:46 | 271,346 | 40 | 22 | BSD-3-Clause | 2022-06-21T23:20:47 | 2009-08-07T05:06:16 | C++ | UTF-8 | C++ | false | false | 755 | cpp | #include <iostream>
class Foo
{
public:
void f()
{
std::cout << "Foo::f()" << std::endl;
}
virtual void g()
{
std::cout << "Foo::g()" << std::endl;
}
}
class Bar : public Foo
{
public:
void f()
{
std::cout << "Bar::f()" << std::endl;
}
virtual void g()
{
std::cout << "Bar::g()" << std::endl;
}
}
int main()
{
Foo foo;
Bar bar;
Foo *baz = &bar;
Bar *quux = &bar;
foo.f(); // "Foo::f()"
foo.g(); // "Foo::g()"
bar.f(); // "Bar::f()"
bar.g(); // "Bar::g()"
// So far everything we would expect...
baz->f(); // "Foo::f()"
baz->g(); // "Bar::g()"
quux->f(); // "Bar::f()"
quux->g(); // "Bar::g()"
return 0;
}
| [
"davidterei@gmail.com"
] | davidterei@gmail.com |
3722111736779256a1f088231e914b41863eb3fc | 4fa7f7a4fcc2cf88390a9c244770dcebbfb918f5 | /Space_Fortress_12/Files.hpp | b4a66c746d700c4ca1c78ad565b39a5580a23e52 | [] | no_license | mileswhiticker/sp12 | f99037ec1794151e5d22c86b61055d93bfe9622a | 700008f0c31e96040cec8b0438f07c5a2f81f8fb | refs/heads/master | 2021-01-10T20:01:22.697234 | 2018-03-11T04:07:46 | 2018-03-11T04:07:46 | 8,881,610 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 388 | hpp | #ifndef FILES_HPP
#define FILES_HPP
#ifdef _DEBUG
#define RESOURCES_CFG Ogre::String("resources_d.cfg")
#define PLUGINS_CFG Ogre::String("plugins_d.cfg")
#else
#define RESOURCES_CFG Ogre::String("resources.cfg")
#define PLUGINS_CFG Ogre::String("plugins.cfg")
#endif
#define MEDIA_DIR std::string("../../media/")
#define MAP_DIR (MEDIA_DIR + std::string("maps/"))
#endif FILES_HPP | [
"miles.whiticker@gmail.com"
] | miles.whiticker@gmail.com |
aff81f3b090d3d4c92bb85743992b50d290ec439 | 914770c26da5af7c27431bd8ee63d64afb68dc48 | /vector/vector_sort.h | 80bb35aba14bf901e2a342dab19b7a74eb805833 | [
"MIT"
] | permissive | longqun/sf | c7cf0e7d9af77930e662523ea9ca406365c04941 | 4d07f313326db6cb62f32ad2665fc14f994794b0 | refs/heads/master | 2021-09-10T19:14:53.634457 | 2018-03-31T13:45:18 | 2018-03-31T13:45:18 | 108,559,370 | 0 | 0 | null | 2018-03-16T06:14:21 | 2017-10-27T14:56:10 | C++ | UTF-8 | C++ | false | false | 2,307 | h |
#pragma once
#include "../PQ_ComplHeap/PQ_CompHeap.h"
#include "vector.h"
template<typename T>
inline void Vector<T>::sort(int method)
{
switch (method)
{
case 0:
bubbleSort(0, size_);
break;
case 1:
selectionSort(0, size_);
break;
case 2:
mergeSort(0, size_);
break;
case 3:
heapSort(0, size_);
break;
case 4:
quickSort(0, size_);
default:
break;
}
}
template<typename T>
inline void Vector<T>::sort(Rank lo, Rank hi)
{
}
template<typename T>
inline void Vector<T>::selectionSort(Rank lo, Rank hi)
{
while (lo < --hi)
{
swap(elem_[max(lo, hi)], elem_[hi]);
}
}
template<typename T>
inline void Vector<T>::bubbleSort(Rank lo, Rank hi)
{
while (!bubble(lo, hi--));
}
template<typename T>
inline bool Vector<T>::bubble(Rank lo, Rank hi)
{
bool sorted = true;
for (int i = lo; i < hi - 1; i++)
{
if (elem_[i] > elem_[i + 1])
{
sorted = false;
swap(elem_[i], elem_[i + 1]);
}
}
return sorted;
}
template<typename T>
inline void Vector<T>::mergeSort(Rank lo, Rank hi)
{
if (hi - lo < 2)
return;
int mid = (lo + hi) >> 1;
mergeSort(lo, mid);
mergeSort(mid, hi);
merge(lo, mid, hi);
}
template<typename T>
inline void Vector<T>::merge(Rank lo, Rank mid, Rank hi)
{
int preSize = mid - lo;
T * preData = new T[preSize];
T* lb = elem_ + lo;
T* lm = elem_ + mid;
for (int i = 0; i < preSize; i++)
{
preData[i] = lb[i];
}
for (int i = 0; i < preSize; )
{
if (mid >= hi)
{
elem_[lo++] = preData[i++];
}
else if (preData[i] < elem_[mid])
{
elem_[lo++] = preData[i++];
}
else if (preData[i] >= elem_[mid])
{
elem_[lo++] = elem_[mid++];
}
}
}
template<typename T>
inline void Vector<T>::heapSort(Rank lo, Rank hi)
{
PQ_ComplHeap<T> h(elem_ + lo, hi - lo);
while (!h.empty())
{
elem_[--hi] = h.delMax();
}
}
template<typename T>
inline void Vector<T>::quickSort(Rank lo, Rank hi)
{
if (hi - lo < 2)
return;
int m = partition(lo, hi - 1);
quickSort(lo, m);
quickSort(m + 1, hi);
}
template<typename T>
inline int Vector<T>::partition(Rank lo, Rank hi)
{
int value = elem_[lo];
while (lo < hi)
{
while (lo < hi&& elem_[hi] >= value)
{
hi--;
}
elem_[lo] = elem_[hi];
while (lo < hi && elem_[lo] <= value)
{
lo++;
}
elem_[hi] = elem_[lo];
}
elem_[lo] = value;
return lo;
}
| [
"642954659@qq.com"
] | 642954659@qq.com |
fdaba865c7e0ce7c97e001a1d045d7446c21a766 | c73351b3df67ed7d72dd98bf80f142a1acfef14b | /src/graph.h | 733149d6b4bab4607038fb5cffeeda35ba811d61 | [
"MIT"
] | permissive | tsbertalan/CarND-Path-Planning-Project | 6eb26f4ae6979a5cf355e6e7c5744b4037ce7022 | e475974ef2c440baf7d27670cb9a43a7fe431a8a | refs/heads/master | 2020-03-22T01:52:49.783228 | 2018-08-08T15:31:20 | 2018-08-08T15:31:20 | 139,336,044 | 0 | 0 | null | 2018-07-01T14:31:04 | 2018-07-01T14:31:04 | null | UTF-8 | C++ | false | false | 4,108 | h | #ifndef GRAPH1010
#define GRAPH1010
#include <stdio.h>
#include <stdlib.h>
#include <vector>
#include <iostream>
#include <string.h>
#include <algorithm>
#include "utils.h"
#include <sstream>
using namespace std;
#define GRAPH_ENABLED true
class plot {
public:
FILE *gp;
bool enabled, persist;
plot(bool _persist = false, bool _enabled = GRAPH_ENABLED) {
enabled = _enabled;
persist = _persist;
if (enabled) {
if (persist)
gp = popen("gnuplot -persist", "w");
else
gp = popen("gnuplot", "w");
}
}
void plot_data(vector<double> x, const char *style = "points", const char *title = "Data") {
if (!enabled)
return;
fprintf(gp, "set title '%s' \n", title);
fprintf(gp, "plot '-' w %s \n", style);
for (int k = 0; k < x.size(); k++) {
fprintf(gp, "%f\n", x[k]);
}
fprintf(gp, "e\n");
fflush(gp);
}
void plot_data(vector<double> x, vector<double> y, const char *style = "points", const char *title = "Data") {
if (!enabled)
return;
fprintf(gp, "set title '%s' \n", title);
fprintf(gp, "plot '-' w %s \n", style);
for (int k = 0; k < x.size(); k++) {
fprintf(gp, "%f %f \n", x[k], y[k]);
}
fprintf(gp, "e\n");
fflush(gp);
}
void plot_data(vector<vector<double>> X, vector<vector<double>> Y,
const char *xlabel, const char *ylabel,
vector<string> styles = {"points"},
const char *title = "Data", const char *cblabel = "", vector<vector<double>> C = {{}},
vector<double> ylims = {12, 0}, vector<double> xlims = {0, 72}
) {
if (!enabled)
return;
fprintf(gp, "set title '%s' \n", title);
const vector<string> colors = {"black", "blue", "red", "green", "magenta", "cyan", "yellow"};
// Use a smoothly sliding box.
vector<double> lows_x, lows_y, highs_x, highs_y;
for (int i = 0; i < X.size(); i++) {
auto x = X[i];
auto y = Y[i];
lows_x.push_back(min(x));
lows_y.push_back(min(y));
highs_x.push_back(max(x));
highs_y.push_back(max(y));
}
if (xlims.size()==2)
fprintf(gp, "set xrange [%f:%f] \n", xlims[0], xlims[1]);
else
fprintf(gp, "set xrange [%f:%f] \n", min(lows_x), max(highs_x));
if (ylims.size()==2)
fprintf(gp, "set yrange [%f:%f] \n", ylims[0], ylims[1]);
else
fprintf(gp, "set yrange [%f:%f] \n", min(lows_y), max(highs_y));
// Try to make the figure size roughly proprotional to the limits.
if (xlims.size()==2 && ylims.size()==2) {
double dx = abs(xlims[1] - xlims[0]);
double dy = abs(ylims[1] - ylims[0]);
cout << "dx=" << dx << ", dy=" << dy << endl;
double width, height;
height = 300;
width = min(1900., dx/dy*height);
ostringstream oss;
oss << "set terminal x11 size " << (int) width << "," << (int) height << " \n";
fprintf(gp, "%s", oss.str().c_str());
}
fprintf(gp, "set palette rgb 33,13,10 \n");
fprintf(gp, "set key off \n");
fprintf(gp, "set xlabel '%s' \n", xlabel);
fprintf(gp, "set ylabel '%s' \n", ylabel);
if (strlen(cblabel) > 0)
fprintf(gp, "set cblabel '%s' \n", cblabel);
fprintf(gp, "plot");
for (int i = 0; i < X.size(); i++) {
string color = colors[i%colors.size()];
string style = styles[i%styles.size()];
fprintf(gp, " '-' with %s linecolor palette linewidth 1,", style.c_str());
}
fprintf(gp, "\n");
for (int i = 0; i < X.size(); i++) {
vector<double> x = X[i];
vector<double> y = Y[i];
vector<double> c = C[i%C.size()];
for (int k = 0; k < y.size(); k++) {
double cv = c[min(k, (int) c.size() - 1)];
fprintf(gp, "%f %f %f \n", x[k], y[k], cv);
}
fprintf(gp, "e\n");
}
fflush(gp);
}
~plot() {
if (enabled)
pclose(gp);
}
};
/*
int main(int argc,char **argv) {
plot p;
for(int a=0;a<100;a++) {
vector<double> x,y;
for(int k=a;k<a+200;k++) {
x.push_back(k);
y.push_back(k*k);
}
p.plot_data(x,y);
}
return 0;
}
*/
#endif
| [
"tom@tombertalan.com"
] | tom@tombertalan.com |
964c6eff61d13e9f14a052c1011cf66d6b95c4fb | 107bfcaeca83f7b577f7b00d2b7c15171e6a0470 | /include/agpack/v2/create_object_visitor.hpp | c2cc1480d12998151466e2431c039aaf0a1000ac | [] | no_license | tobygz/confuse_msgpack | 0a54998a46aab5a8ee94bae90383fded9abe3578 | 5888441f7e5e7482a52f11448c61ad63b619dbdb | refs/heads/master | 2023-04-24T17:14:09.062222 | 2021-05-12T07:29:32 | 2021-05-12T07:29:32 | 366,411,467 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 8,385 | hpp | //
// MessagePack for C++ deserializing routine
//
// Copyright (C) 2017 KONDO Takatoshi
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
#ifndef AGPACK_V2_CREATE_OBJECT_VISITOR_HPP
#define AGPACK_V2_CREATE_OBJECT_VISITOR_HPP
#include "agpack/unpack_decl.hpp"
#include "agpack/unpack_exception.hpp"
#include "agpack/v2/create_object_visitor_decl.hpp"
#include "agpack/v2/null_visitor.hpp"
namespace agpack {
/// @cond
AGPACK_API_VERSION_NAMESPACE(v2) {
/// @endcond
namespace detail {
class create_object_visitor : public agpack::v2::null_visitor {
public:
create_object_visitor(unpack_reference_func f, void* user_data, unpack_limit const& limit)
:m_func(f), m_user_data(user_data), m_limit(limit) {
m_stack.reserve(AGPACK_EMBED_STACK_SIZE);
m_stack.push_back(&m_obj);
}
#if !defined(AGPACK_USE_CPP03)
create_object_visitor(create_object_visitor&& other)
:m_func(other.m_func),
m_user_data(other.m_user_data),
m_limit(std::move(other.m_limit)),
m_stack(std::move(other.m_stack)),
m_zone(other.m_zone),
m_referenced(other.m_referenced) {
other.m_zone = AGPACK_NULLPTR;
m_stack[0] = &m_obj;
}
create_object_visitor& operator=(create_object_visitor&& other) {
this->~create_object_visitor();
new (this) create_object_visitor(std::move(other));
return *this;
}
#endif // !defined(AGPACK_USE_CPP03)
void init() {
m_stack.resize(1);
m_obj = agpack::object();
m_stack[0] = &m_obj;
}
agpack::object const& data() const
{
return m_obj;
}
agpack::zone const& zone() const { return *m_zone; }
agpack::zone& zone() { return *m_zone; }
void set_zone(agpack::zone& zone) { m_zone = &zone; }
bool referenced() const { return m_referenced; }
void set_referenced(bool referenced) { m_referenced = referenced; }
// visit functions
bool visit_nil() {
agpack::object* obj = m_stack.back();
obj->type = agpack::type::NIL;
return true;
}
bool visit_boolean(bool v) {
agpack::object* obj = m_stack.back();
obj->type = agpack::type::BOOLEAN;
obj->via.boolean = v;
return true;
}
bool visit_positive_integer(uint64_t v) {
agpack::object* obj = m_stack.back();
obj->type = agpack::type::POSITIVE_INTEGER;
obj->via.u64 = v;
return true;
}
bool visit_negative_integer(int64_t v) {
agpack::object* obj = m_stack.back();
if(v >= 0) {
obj->type = agpack::type::POSITIVE_INTEGER;
obj->via.u64 = static_cast<uint64_t>(v);
}
else {
obj->type = agpack::type::NEGATIVE_INTEGER;
obj->via.i64 = v;
}
return true;
}
bool visit_float32(float v) {
agpack::object* obj = m_stack.back();
obj->type = agpack::type::FLOAT32;
obj->via.f64 = v;
return true;
}
bool visit_float64(double v) {
agpack::object* obj = m_stack.back();
obj->type = agpack::type::FLOAT64;
obj->via.f64 = v;
return true;
}
bool visit_str(const char* v, uint32_t size) {
if (size > m_limit.str()) throw agpack::str_size_overflow("str size overflow");
agpack::object* obj = m_stack.back();
obj->type = agpack::type::STR;
if (m_func && m_func(obj->type, size, m_user_data)) {
obj->via.str.ptr = v;
set_referenced(true);
}
else {
char* tmp = static_cast<char*>(zone().allocate_align(size, AGPACK_ZONE_ALIGNOF(char)));
std::memcpy(tmp, v, size);
obj->via.str.ptr = tmp;
}
obj->via.str.size = size;
return true;
}
bool visit_bin(const char* v, uint32_t size) {
if (size > m_limit.bin()) throw agpack::bin_size_overflow("bin size overflow");
agpack::object* obj = m_stack.back();
obj->type = agpack::type::BIN;
if (m_func && m_func(obj->type, size, m_user_data)) {
obj->via.bin.ptr = v;
set_referenced(true);
}
else {
char* tmp = static_cast<char*>(zone().allocate_align(size, AGPACK_ZONE_ALIGNOF(char)));
std::memcpy(tmp, v, size);
obj->via.bin.ptr = tmp;
}
obj->via.bin.size = size;
return true;
}
bool visit_ext(const char* v, uint32_t size) {
if (size > m_limit.ext()) throw agpack::ext_size_overflow("ext size overflow");
agpack::object* obj = m_stack.back();
obj->type = agpack::type::EXT;
if (m_func && m_func(obj->type, size, m_user_data)) {
obj->via.ext.ptr = v;
set_referenced(true);
}
else {
char* tmp = static_cast<char*>(zone().allocate_align(size, AGPACK_ZONE_ALIGNOF(char)));
std::memcpy(tmp, v, size);
obj->via.ext.ptr = tmp;
}
obj->via.ext.size = static_cast<uint32_t>(size - 1);
return true;
}
bool start_array(uint32_t num_elements) {
if (num_elements > m_limit.array()) throw agpack::array_size_overflow("array size overflow");
if (m_stack.size() > m_limit.depth()) throw agpack::depth_size_overflow("depth size overflow");
agpack::object* obj = m_stack.back();
obj->type = agpack::type::ARRAY;
obj->via.array.size = num_elements;
if (num_elements == 0) {
obj->via.array.ptr = AGPACK_NULLPTR;
}
else {
#if SIZE_MAX == UINT_MAX
if (num_elements > SIZE_MAX/sizeof(agpack::object))
throw agpack::array_size_overflow("array size overflow");
#endif // SIZE_MAX == UINT_MAX
size_t size = num_elements*sizeof(agpack::object);
obj->via.array.ptr =
static_cast<agpack::object*>(m_zone->allocate_align(size, AGPACK_ZONE_ALIGNOF(agpack::object)));
}
m_stack.push_back(obj->via.array.ptr);
return true;
}
bool start_array_item() {
return true;
}
bool end_array_item() {
++m_stack.back();
return true;
}
bool end_array() {
m_stack.pop_back();
return true;
}
bool start_map(uint32_t num_kv_pairs) {
if (num_kv_pairs > m_limit.map()) throw agpack::map_size_overflow("map size overflow");
if (m_stack.size() > m_limit.depth()) throw agpack::depth_size_overflow("depth size overflow");
agpack::object* obj = m_stack.back();
obj->type = agpack::type::MAP;
obj->via.map.size = num_kv_pairs;
if (num_kv_pairs == 0) {
obj->via.map.ptr = AGPACK_NULLPTR;
}
else {
#if SIZE_MAX == UINT_MAX
if (num_kv_pairs > SIZE_MAX/sizeof(agpack::object_kv))
throw agpack::map_size_overflow("map size overflow");
#endif // SIZE_MAX == UINT_MAX
size_t size = num_kv_pairs*sizeof(agpack::object_kv);
obj->via.map.ptr =
static_cast<agpack::object_kv*>(m_zone->allocate_align(size, AGPACK_ZONE_ALIGNOF(agpack::object_kv)));
}
m_stack.push_back(reinterpret_cast<agpack::object*>(obj->via.map.ptr));
return true;
}
bool start_map_key() {
return true;
}
bool end_map_key() {
++m_stack.back();
return true;
}
bool start_map_value() {
return true;
}
bool end_map_value() {
++m_stack.back();
return true;
}
bool end_map() {
m_stack.pop_back();
return true;
}
void parse_error(size_t /*parsed_offset*/, size_t /*error_offset*/) {
throw agpack::parse_error("parse error");
}
void insufficient_bytes(size_t /*parsed_offset*/, size_t /*error_offset*/) {
throw agpack::insufficient_bytes("insufficient bytes");
}
private:
public:
unpack_reference_func m_func;
void* m_user_data;
unpack_limit m_limit;
agpack::object m_obj;
std::vector<agpack::object*> m_stack;
agpack::zone* m_zone;
bool m_referenced;
};
} // detail
/// @cond
} // AGPACK_API_VERSION_NAMESPACE(v2)
/// @endcond
} // namespace agpack
#endif // AGPACK_V2_CREATE_OBJECT_VISITOR_HPP
| [
"2503417117@qq.com"
] | 2503417117@qq.com |
ace5cc8bd44db76d4135fb8003b5f32e549b4957 | 5ec06dab1409d790496ce082dacb321392b32fe9 | /clients/cpp-qt5-qhttpengine-server/generated/server/src/models/OAIComDayCqWcmDesignimporterParserTaghandlersFactoryTitleComponenInfo.h | cdbbcb1b724bed8991a8682b17efaff9ae3205b2 | [
"Apache-2.0",
"MIT"
] | permissive | shinesolutions/swagger-aem-osgi | e9d2385f44bee70e5bbdc0d577e99a9f2525266f | c2f6e076971d2592c1cbd3f70695c679e807396b | refs/heads/master | 2022-10-29T13:07:40.422092 | 2021-04-09T07:46:03 | 2021-04-09T07:46:03 | 190,217,155 | 3 | 3 | Apache-2.0 | 2022-10-05T03:26:20 | 2019-06-04T14:23:28 | null | UTF-8 | C++ | false | false | 2,257 | h | /**
* Adobe Experience Manager OSGI config (AEM) API
* Swagger AEM OSGI is an OpenAPI specification for Adobe Experience Manager (AEM) OSGI Configurations API
*
* OpenAPI spec version: 1.0.0-pre.0
* Contact: opensource@shinesolutions.com
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
/*
* OAIComDayCqWcmDesignimporterParserTaghandlersFactoryTitleComponenInfo.h
*
*
*/
#ifndef OAIComDayCqWcmDesignimporterParserTaghandlersFactoryTitleComponenInfo_H
#define OAIComDayCqWcmDesignimporterParserTaghandlersFactoryTitleComponenInfo_H
#include <QJsonObject>
#include "OAIComDayCqWcmDesignimporterParserTaghandlersFactoryTitleComponenProperties.h"
#include <QString>
#include "OAIObject.h"
namespace OpenAPI {
class OAIComDayCqWcmDesignimporterParserTaghandlersFactoryTitleComponenInfo: public OAIObject {
public:
OAIComDayCqWcmDesignimporterParserTaghandlersFactoryTitleComponenInfo();
OAIComDayCqWcmDesignimporterParserTaghandlersFactoryTitleComponenInfo(QString json);
~OAIComDayCqWcmDesignimporterParserTaghandlersFactoryTitleComponenInfo() override;
void init();
QString asJson () const override;
QJsonObject asJsonObject() const override;
void fromJsonObject(QJsonObject json) override;
void fromJson(QString jsonString) override;
QString getPid() const;
void setPid(const QString &pid);
QString getTitle() const;
void setTitle(const QString &title);
QString getDescription() const;
void setDescription(const QString &description);
OAIComDayCqWcmDesignimporterParserTaghandlersFactoryTitleComponenProperties getProperties() const;
void setProperties(const OAIComDayCqWcmDesignimporterParserTaghandlersFactoryTitleComponenProperties &properties);
virtual bool isSet() const override;
private:
QString pid;
bool m_pid_isSet;
QString title;
bool m_title_isSet;
QString description;
bool m_description_isSet;
OAIComDayCqWcmDesignimporterParserTaghandlersFactoryTitleComponenProperties properties;
bool m_properties_isSet;
};
}
#endif // OAIComDayCqWcmDesignimporterParserTaghandlersFactoryTitleComponenInfo_H
| [
"cliffano@gmail.com"
] | cliffano@gmail.com |
aabcb4013ac1d3260b9699e3dbe876bee60b4e10 | 2e7c154d775b3cb99dd671f1b1e3c173d4eaa326 | /Prims/main.cpp | 6ffd819bdfab1c1f763f7e44b8dd69ca921030a2 | [] | no_license | nahin333/Basic-algorithm-implementations | 50002f48f11e6cc1b850fd6c35b0f9c9f86e64c7 | 6af23055346be3db287c296344cee3f38344da6d | refs/heads/main | 2023-01-14T07:08:41.118061 | 2020-11-15T03:49:19 | 2020-11-15T03:49:19 | 311,886,858 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,660 | cpp | #include <bits/stdc++.h>
using namespace std;
int totalnode,node1,node2,weight;
vector<vector<pair<int,int> > >Adjlist(1000);
vector<int> visited;
priority_queue<pair<int,pair<int,int> > >pq;
int process(int vtx)
{
visited[vtx] = 1;
for(int j=0;j<Adjlist[vtx].size();j++)
{
pair<int,int> v = Adjlist[vtx][j];
if(!visited[v.first])
{
pq.push(make_pair(-v.second,make_pair(-v.first,-vtx)));
}
}
return 0;
}
int main()
{
ifstream input ("input.txt");
if(!input.is_open())
{
cout<<"File not open\n";
}
input>>totalnode;
while(input>>node1>>node2>>weight)
{
Adjlist[node1].push_back(make_pair(node2,weight));
Adjlist[node2].push_back(make_pair(node1,weight));
}
// for(int i=0;i<totalnode;i++)
// {
// for(int j=0;j<Adjlist[i].size();j++)
// {
// pair<int,int> v = Adjlist[i][j];
// cout<<v.first<<"("<<v.second<<")->";
// }
// cout<<endl;
// }
visited.assign(totalnode,0);
int source;
cout<<"Enter Source Node: ";
cin>>source;
process(source);
int mst_cost = 0;
while(!pq.empty())
{
pair<int,pair<int,int> > frnt = pq.top();
pq.pop();
int v,w,u;
u=-frnt.second.second;
v=-frnt.second.first;
w=-frnt.first;
if(!visited[v])
{
mst_cost+=w;
cout<<u<<"->"<<v<<"("<<w<<")";
process(v);
}
cout<<endl;
}
cout<<"Mst cost"<<mst_cost;
}
| [
"nahin333@gmail.com"
] | nahin333@gmail.com |
d38a300ca237107fda4a4409347c4879a021d8cb | c7f811db6b8aee8e6a54c8a8e2b05564b122e58d | /test/nbdl/core/apply_action.cpp | 713c254847916bcc54a9ed643f16b9df6bef7004 | [
"BSL-1.0"
] | permissive | ricejasonf/nbdl | aa4592001e4b3875175dc5b6274013d6d5fc7e69 | ae63717c96ab2c36107bc17b2b00115f96e9d649 | refs/heads/master | 2023-06-07T20:33:54.496716 | 2020-07-14T03:11:44 | 2020-07-16T08:29:33 | 41,518,328 | 47 | 6 | BSL-1.0 | 2018-05-04T05:31:27 | 2015-08-28T00:39:52 | C++ | UTF-8 | C++ | false | false | 580 | cpp | //
// Copyright Jason Rice 2017
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
#include <nbdl/apply_action.hpp>
#include <nbdl/variant.hpp>
#include <boost/hana/equal.hpp>
#include <boost/hana/tuple.hpp>
#include <catch.hpp>
namespace hana = boost::hana;
TEST_CASE("Apply action to hana::Searchable.", "[apply_action]")
{
auto store = hana::make_tuple(5);
nbdl::apply_action(store, hana::make_tuple(42));
CHECK(hana::equal(hana::make_tuple(42), store));
}
| [
"ricejasonf@gmail.com"
] | ricejasonf@gmail.com |
9b86341d4a49aa05f359c74af00532ee51d54d46 | e787750616e98344438acd0460e18f5335bfd30e | /Arduino/Projetos/alarmelaser/alarmelaser_funcional/alarmelaser_funcional.ino | 6bc51a8e65663c7b521fa81ddd5e59d28c14dc06 | [] | no_license | AndreMichelli/Projetos-e-aulas | 78bf700f26915436add50b9126c574d099156866 | 0c877956d506cecbe6f2dfaadc261e324f0204d4 | refs/heads/master | 2021-10-22T10:10:05.366566 | 2021-10-08T23:09:21 | 2021-10-08T23:09:21 | 244,995,137 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 527 | ino |
int var;
void setup() {
pinMode(A0,INPUT); // ldr
pinMode(7,OUTPUT); // buzzer
Serial.begin(9600); // inicia o monitor serial
}
void loop() {
var = analogRead(A0); // Da o valor da intensidade do laser para a variavel var
if(var < 500){ // verifica, pela intensidade do laser se deve apitar ou não
Serial.println("Estavel");
Serial.println(var);
digitalWrite(7,LOW);
delay(500);
} else{
Serial.println("ALARME!");
Serial.println(var);
digitalWrite(7,HIGH);
delay(500);
}
}
| [
"andremichelli0108@gmail.com"
] | andremichelli0108@gmail.com |
64694b877ac43906a28e1152c22cfcb92e87c902 | 092d638d7e00daeac2b08a448c78dabb3030c5a9 | /gcj/dataset/zuko3d/5631989306621952/0/extracted/Source.cpp | 2c3cb6e619c4c0833c4ee930a474886b3e7c734c | [] | no_license | Yash-YC/Source-Code-Plagiarism-Detection | 23d2034696cda13462d1f7596718a908ddb3d34e | 97cfdd458e851899b6ec6802a10343db68824b8b | refs/heads/main | 2023-08-03T01:43:59.185877 | 2021-10-04T15:00:25 | 2021-10-04T15:00:25 | 399,349,460 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 949 | cpp | #include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <fstream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
using namespace std;
#define FOR(i, a, b) for (int i(a), _b(b); i <= _b; ++i)
#define REP(i, n) for (int i(0), _n(n); i < _n; ++i)
int main(void) {
int T;
ifstream fin("A-small-attempt0 (1).in");
ofstream fout("out.txt");
fin >> T;
REP(t, T) {
string ret, S;
fin >> S;
ret = S[0];
FOR(i, 1, S.size() - 1) {
if (S[i] >= ret[0]) {
ret = S[i] + ret;
} else {
ret += S[i];
}
}
fout << "Case #" << t + 1 << ": " << ret << endl;
}
return 0;
}
| [
"54931238+yash-YC@users.noreply.github.com"
] | 54931238+yash-YC@users.noreply.github.com |
fbf6b200b917039ee728198015465ba7a1b41879 | 3190a9606fdb6a32b68b4012869c1074a5933ca4 | /c++/20140710/vector.cpp | 4fdce73466f410df971287f171a72c51a40e405f | [] | no_license | lvchao0428/ultrapp | caa5971eddc98226bb62d8269b7be2537c442ca3 | 614c85e88dce932663389a434297f516ea3c979b | refs/heads/master | 2021-01-23T17:31:10.722025 | 2015-09-22T03:30:57 | 2015-09-22T03:30:57 | 21,064,395 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 882 | cpp | /*************************************************************************
> File Name: vector.cpp
> Author: lvchao
> Mail:lvchao0428@163.com
> Created Time: Thu 10 Jul 2014 02:59:52 PM CST
************************************************************************/
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int main(int argc, const char *argv[])
{
vector<int> vec;
vec.push_back(23);
vec.push_back(10);
vec.push_back(22);
vec.push_back(99);
for(vector<int>::size_type ix = 0;
ix != vec.size(); ++ix)
{
cout<<vec[ix]<<' ';
}
cout<<endl;
string s;
vector<string> vecs;
while(cin >> s)
{
vecs.push_back(s);
}
for(vector<string>::iterator it = vecs.begin();
it != vecs.end(); ++it)
{
cout<<*it<<endl;
}
return 0;
}
| [
"lvchao0428@163.com"
] | lvchao0428@163.com |
114523dec6cbb4641e55177dc608fc23df43e37d | b786a6536f85c56c9b1c6d9a7cf3a573ed73f6df | /lathe_src/pidAutoTune.cpp | e211ac2d94731ebd8dd6fe8d566740433cfb123e | [] | no_license | e76nystrom/LatheCPP | b0a0e2cf897beae6db895b8c995171447a192a70 | 67a42f24556a3bb18eadad73e7297afcfb8a67f7 | refs/heads/master | 2023-05-25T13:48:44.254327 | 2023-05-09T08:49:32 | 2023-05-09T08:49:32 | 163,032,482 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,647 | cpp | //#if ARDUINO >= 100
//#include "Arduino.h"
//#else
//#include "WProgram.h"
//#endif
#include <math.h>
#include "pidAutoTune.h"
unsigned int millis(void);
PID_ATune::PID_ATune(double* Input, double* Output)
{
input = Input;
output = Output;
controlType = 0 ; //default to PI
noiseBand = 0.5;
running = false;
oStep = 30;
SetLookbackSec(10);
lastTime = millis();
}
void PID_ATune::Cancel()
{
running = false;
}
int PID_ATune::Runtime()
{
// justevaled = false;
if ((peakCount > 9) &&
running)
{
running = false;
FinishUp();
return 1;
}
unsigned long now = millis();
if ((now - lastTime) < sampleTime)
return false;
lastTime = now;
double refVal = *input;
// justevaled = true;
if (!running) // initialize working variables the first time around
{
peakType = 0;
peakCount = 0;
justchanged = false;
absMax = refVal;
absMin = refVal;
setpoint = refVal;
running = true;
outputStart = *output;
*output = outputStart + oStep;
}
else
{
if (refVal > absMax)
absMax = refVal;
if (refVal < absMin)
absMin = refVal;
}
// oscillate the output base on the input's relation to the setpoint
if (refVal > (setpoint + noiseBand))
*output = outputStart - oStep;
else if (refVal < (setpoint - noiseBand))
*output = outputStart+oStep;
//bool isMax=true, isMin=true;
isMax = true;
isMin = true;
//id peaks
for (int i = nLookBack - 1; i >= 0; i--)
{
double val = lastInputs[i];
if (isMax)
isMax = refVal > val;
if (isMin)
isMin = refVal < val;
lastInputs[i + 1] = lastInputs[i];
}
lastInputs[0] = refVal;
if (nLookBack < 9)
{ //we don't want to trust the maxes or mins until the inputs array has been filled
return 0;
}
if (isMax)
{
if (peakType == 0)
peakType=1;
if (peakType == -1)
{
peakType = 1;
justchanged = true;
peak2 = peak1;
}
peak1 = now;
peaks[peakCount] = refVal;
}
else if (isMin)
{
if (peakType == 0)
peakType = -1;
if (peakType == 1)
{
peakType = -1;
peakCount++;
justchanged = true;
}
if (peakCount < 10)
peaks[peakCount] = refVal;
}
if (justchanged &&
(peakCount > 2))
{ // we've transitioned. check if we can autotune based on the last peaks
double avgSeparation = (abs(peaks[peakCount - 1] - peaks[peakCount - 2]) +
abs(peaks[peakCount - 2] - peaks[peakCount - 3])) / 2;
if (avgSeparation < (0.05 * (absMax - absMin)))
{
FinishUp();
running = false;
return 1;
}
}
justchanged = false;
return 0;
}
void PID_ATune::FinishUp()
{
*output = outputStart;
// we can generate tuning parameters!
Ku = 4 * (2 * oStep) / ((absMax - absMin) * 3.14159);
Pu = (double) (peak1 - peak2) / 1000;
}
double PID_ATune::GetKp()
{
return controlType == 1 ? 0.6 * Ku : 0.4 * Ku;
}
double PID_ATune::GetKi()
{
return controlType == 1? 1.2 * Ku / Pu : 0.48 * Ku / Pu; // Ki = Kc/Ti
}
double PID_ATune::GetKd()
{
return controlType == 1? 0.075 * Ku * Pu : 0; //Kd = Kc * Td
}
void PID_ATune::SetOutputStep(double Step)
{
oStep = Step;
}
double PID_ATune::GetOutputStep()
{
return oStep;
}
void PID_ATune::SetControlType(int Type) //0=PI, 1=PID
{
controlType = Type;
}
int PID_ATune::GetControlType()
{
return controlType;
}
void PID_ATune::SetNoiseBand(double Band)
{
noiseBand = Band;
}
double PID_ATune::GetNoiseBand()
{
return noiseBand;
}
void PID_ATune::SetLookbackSec(int value)
{
if (value < 1)
value = 1;
if (value < 25)
{
nLookBack = value * 4;
sampleTime = 250;
}
else
{
nLookBack = 100;
sampleTime = value * 10;
}
}
int PID_ATune::GetLookbackSec()
{
return (nLookBack * sampleTime) / 1000;
}
| [
"eric.nystrom@yahoo.com"
] | eric.nystrom@yahoo.com |
a74252cb128ef15131e9d5a80147749cdec25843 | 68e8f6bf9ea4f5c2b1e5c99b61911b69c546db60 | /src/RE/NiControllerManager.cpp | d233244fa00d8289a261a406287bfdd4ba9f24d9 | [
"MIT"
] | permissive | FruitsBerriesMelons123/CommonLibSSE | aaa2d4cd66d39f7cb4d25f076735ef4b0187353e | 7ae21d11b9e9c86b0596fc1cfa58b6993a568125 | refs/heads/master | 2021-01-16T12:36:20.612433 | 2020-02-25T09:58:05 | 2020-02-25T09:58:05 | 243,124,317 | 0 | 0 | MIT | 2020-02-25T23:24:47 | 2020-02-25T23:24:47 | null | UTF-8 | C++ | false | false | 275 | cpp | #include "RE/NiControllerManager.h"
#include "RE/NiControllerSequence.h"
namespace RE
{
NiControllerSequence* NiControllerManager::GetSequenceByName(std::string_view a_name)
{
auto it = sequenceMap.find(a_name);
return it != sequenceMap.end() ? it->second : 0;
}
}
| [
"ryan__mckenzie@hotmail.com"
] | ryan__mckenzie@hotmail.com |
e331006369e91b7daa848f2c7457c8f788d00258 | d9855cb31e634e81587ba0c1207940e6f9bd8c38 | /jenkins-slaves/jenkins-slave-miniapp/wxdt/package.nw/node_modules/nodegit/src/rebase_options.cc | e2ba0b93f95f7310aacc39770a8eb7b39940d3e7 | [
"Apache-2.0",
"MIT"
] | permissive | robints/containers-quickstarts | 839c5dcdc6297dde65280f1d4dedcf1f3cdc3de0 | 9745274fa272a228da8661f63d17d853537df030 | refs/heads/master | 2020-04-22T20:41:49.861941 | 2019-04-08T04:52:23 | 2019-04-08T04:52:23 | 170,649,405 | 0 | 0 | Apache-2.0 | 2019-02-14T07:46:33 | 2019-02-14T07:46:32 | null | UTF-8 | C++ | false | false | 6,017 | cc | // This is a generated file, modify: generate/templates/templates/struct_content.cc
#include <nan.h>
#include <string.h>
#ifdef WIN32
#include <windows.h>
#else
#include <unistd.h>
#endif // win32
extern "C" {
#include <git2.h>
}
#include <iostream>
#include "../include/nodegit.h"
#include "../include/lock_master.h"
#include "../include/functions/copy.h"
#include "../include/rebase_options.h"
#include "nodegit_wrapper.cc"
#include "../include/checkout_options.h"
#include "../include/merge_options.h"
using namespace v8;
using namespace node;
using namespace std;
// generated from struct_content.cc
GitRebaseOptions::GitRebaseOptions() : NodeGitWrapper<GitRebaseOptionsTraits>(NULL, true, v8::Local<v8::Object>())
{
git_rebase_options wrappedValue = GIT_REBASE_OPTIONS_INIT;
this->raw = (git_rebase_options*) malloc(sizeof(git_rebase_options));
memcpy(this->raw, &wrappedValue, sizeof(git_rebase_options));
this->ConstructFields();
}
GitRebaseOptions::GitRebaseOptions(git_rebase_options* raw, bool selfFreeing, v8::Local<v8::Object> owner)
: NodeGitWrapper<GitRebaseOptionsTraits>(raw, selfFreeing, owner)
{
this->ConstructFields();
}
GitRebaseOptions::~GitRebaseOptions() {
}
void GitRebaseOptions::ConstructFields() {
v8::Local<Object> checkout_optionsTemp = GitCheckoutOptions::New(
&this->raw->checkout_options,
false
)->ToObject();
this->checkout_options.Reset(checkout_optionsTemp);
v8::Local<Object> merge_optionsTemp = GitMergeOptions::New(
&this->raw->merge_options,
false
)->ToObject();
this->merge_options.Reset(merge_optionsTemp);
}
void GitRebaseOptions::InitializeComponent(v8::Local<v8::Object> target) {
Nan::HandleScope scope;
v8::Local<FunctionTemplate> tpl = Nan::New<FunctionTemplate>(JSNewFunction);
tpl->InstanceTemplate()->SetInternalFieldCount(1);
tpl->SetClassName(Nan::New("RebaseOptions").ToLocalChecked());
Nan::SetAccessor(tpl->InstanceTemplate(), Nan::New("version").ToLocalChecked(), GetVersion, SetVersion);
Nan::SetAccessor(tpl->InstanceTemplate(), Nan::New("quiet").ToLocalChecked(), GetQuiet, SetQuiet);
Nan::SetAccessor(tpl->InstanceTemplate(), Nan::New("rewriteNotesRef").ToLocalChecked(), GetRewriteNotesRef, SetRewriteNotesRef);
Nan::SetAccessor(tpl->InstanceTemplate(), Nan::New("checkoutOptions").ToLocalChecked(), GetCheckoutOptions, SetCheckoutOptions);
Nan::SetAccessor(tpl->InstanceTemplate(), Nan::New("mergeOptions").ToLocalChecked(), GetMergeOptions, SetMergeOptions);
InitializeTemplate(tpl);
v8::Local<Function> _constructor_template = Nan::GetFunction(tpl).ToLocalChecked();
constructor_template.Reset(_constructor_template);
Nan::Set(target, Nan::New("RebaseOptions").ToLocalChecked(), _constructor_template);
}
NAN_GETTER(GitRebaseOptions::GetVersion) {
GitRebaseOptions *wrapper = Nan::ObjectWrap::Unwrap<GitRebaseOptions>(info.This());
info.GetReturnValue().Set(Nan::New<Number>(wrapper->GetValue()->version));
}
NAN_SETTER(GitRebaseOptions::SetVersion) {
GitRebaseOptions *wrapper = Nan::ObjectWrap::Unwrap<GitRebaseOptions>(info.This());
if (value->IsNumber()) {
wrapper->GetValue()->version = (unsigned int) Nan::To<int32_t>(value).FromJust();
}
}
NAN_GETTER(GitRebaseOptions::GetQuiet) {
GitRebaseOptions *wrapper = Nan::ObjectWrap::Unwrap<GitRebaseOptions>(info.This());
info.GetReturnValue().Set(Nan::New<Number>(wrapper->GetValue()->quiet));
}
NAN_SETTER(GitRebaseOptions::SetQuiet) {
GitRebaseOptions *wrapper = Nan::ObjectWrap::Unwrap<GitRebaseOptions>(info.This());
if (value->IsNumber()) {
wrapper->GetValue()->quiet = (int) Nan::To<int32_t>(value).FromJust();
}
}
NAN_GETTER(GitRebaseOptions::GetRewriteNotesRef) {
GitRebaseOptions *wrapper = Nan::ObjectWrap::Unwrap<GitRebaseOptions>(info.This());
if (wrapper->GetValue()->rewrite_notes_ref) {
info.GetReturnValue().Set(Nan::New<String>(wrapper->GetValue()->rewrite_notes_ref).ToLocalChecked());
}
else {
return;
}
}
NAN_SETTER(GitRebaseOptions::SetRewriteNotesRef) {
GitRebaseOptions *wrapper = Nan::ObjectWrap::Unwrap<GitRebaseOptions>(info.This());
if (wrapper->GetValue()->rewrite_notes_ref) {
}
String::Utf8Value str(value);
wrapper->GetValue()->rewrite_notes_ref = strdup(*str);
}
NAN_GETTER(GitRebaseOptions::GetCheckoutOptions) {
GitRebaseOptions *wrapper = Nan::ObjectWrap::Unwrap<GitRebaseOptions>(info.This());
info.GetReturnValue().Set(Nan::New(wrapper->checkout_options));
}
NAN_SETTER(GitRebaseOptions::SetCheckoutOptions) {
GitRebaseOptions *wrapper = Nan::ObjectWrap::Unwrap<GitRebaseOptions>(info.This());
v8::Local<Object> checkout_options(value->ToObject());
wrapper->checkout_options.Reset(checkout_options);
wrapper->raw->checkout_options = * Nan::ObjectWrap::Unwrap<GitCheckoutOptions>(checkout_options->ToObject())->GetValue() ;
}
NAN_GETTER(GitRebaseOptions::GetMergeOptions) {
GitRebaseOptions *wrapper = Nan::ObjectWrap::Unwrap<GitRebaseOptions>(info.This());
info.GetReturnValue().Set(Nan::New(wrapper->merge_options));
}
NAN_SETTER(GitRebaseOptions::SetMergeOptions) {
GitRebaseOptions *wrapper = Nan::ObjectWrap::Unwrap<GitRebaseOptions>(info.This());
v8::Local<Object> merge_options(value->ToObject());
wrapper->merge_options.Reset(merge_options);
wrapper->raw->merge_options = * Nan::ObjectWrap::Unwrap<GitMergeOptions>(merge_options->ToObject())->GetValue() ;
}
// force base class template instantiation, to make sure we get all the
// methods, statics, etc.
template class NodeGitWrapper<GitRebaseOptionsTraits>;
| [
"tianlong@yaomaitong.cn"
] | tianlong@yaomaitong.cn |
b89cab54845801263c10e100e6867c1b1717e8c3 | 6e239fbb4ede20c26b31a6248c41e52ef7818da7 | /19-object-oriented-programming/11_02.cpp | 3a748c06bbe66390dbbc0f7de8e5ad8ffaf57a25 | [] | no_license | mostafa-saad/ArabicCompetitiveProgramming | c5e659a0b8bb131280a77497e766fd94713774b3 | 935c36cccdc6428af2ddd8e1fc62b48be82ed957 | refs/heads/master | 2023-04-05T05:27:51.312982 | 2022-08-27T03:40:35 | 2022-08-27T03:40:35 | 23,489,070 | 1,490 | 641 | null | 2023-09-05T01:09:54 | 2014-08-30T09:56:18 | C++ | UTF-8 | C++ | false | false | 403 | cpp | #include <bits/stdc++.h>
using namespace std;
class A {
public:
int GetValue() {
return 10;
}
string GetStr() {
return "Hello";
}
};
class B: public A {
public:
int GetValue() {
return 20;
}
};
int main() {
B b1;
cout << b1.GetValue() << " " << b1.GetStr() << "\n";
B* b2 = new B();
cout << b2->GetValue() << " " << b2->GetStr() << "\n";
return 0;
}
| [
"mostafa.saad.fci@gmail.com"
] | mostafa.saad.fci@gmail.com |
d701f0f074db1699fe39f93f480098474fd27ef7 | 9974547632ec1cd01cf117c64ec6f7140fb9e078 | /atcoder/regular-106-s(0)/a.cpp | 29c55ef2d68aef76366fbaea34d943a404b3db69 | [] | no_license | suaebahmed/programming-contest | 423260e9fc6c564afa3cd4d83c2493cec38042c2 | 49494fda331c1df6474f3d64817de2b9abda9083 | refs/heads/master | 2023-04-02T23:20:03.041405 | 2021-04-11T17:08:05 | 2021-04-11T17:08:05 | 284,662,703 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 836 | cpp | #include<bits/stdc++.h>
using namespace std;
#define optimize() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define FOR(i,a,b) for(ll i=a; i<= b; ++i)
#define all(v) (v).begin(), (v).end()
#define ff first
#define ss second
#define ld long double
#define pii pair<int, int>
#define pll pair<ll, ll>
#define mp make_pair
#define vi vector<int>
#define pb push_back
#define MOD 1000000007
typedef long long ll;
string alph("abcdefghijklmnopqrstuvwxyz"),s,t;
ll n, cnt, ans, a, b, c, tmp, m, x, y, sum, k;
void solve()
{
int a,b,x,y;
cin>>a>>b>>x>>y;
ans=x;
if(a>b)
{
for(int i=b; i<a-1; i++) ans+=min(2*x,y);
}
else
{
for(int i=a; i<b; i++) ans+=min(2*x,y);
}
cout<<ans<<endl;
}
int main(){
optimize();
int t=1;// cin>>t;
while(t--) solve();
return 0;
}
| [
"suaebahmed12@gmail.com"
] | suaebahmed12@gmail.com |
93617d31d90823dba3b0f7df5f3fa9c3f6705ad4 | 5456502f97627278cbd6e16d002d50f1de3da7bb | /ios/chrome/browser/net/net_types.h | 5bfcc37a1fd2b804a5b9a252db81c14601b1cec9 | [
"BSD-3-Clause"
] | permissive | TrellixVulnTeam/Chromium_7C66 | 72d108a413909eb3bd36c73a6c2f98de1573b6e5 | c8649ab2a0f5a747369ed50351209a42f59672ee | refs/heads/master | 2023-03-16T12:51:40.231959 | 2017-12-20T10:38:26 | 2017-12-20T10:38:26 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 892 | h | // Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef IOS_CHROME_BROWSER_NET_NET_TYPES_H_
#define IOS_CHROME_BROWSER_NET_NET_TYPES_H_
#include <map>
#include <string>
#include "base/memory/linked_ptr.h"
#include "base/memory/scoped_vector.h"
#include "net/url_request/url_request_job_factory.h"
namespace net {
class URLRequestInterceptor;
}
// A mapping from the scheme name to the protocol handler that services its
// content.
typedef std::map<std::string,
linked_ptr<net::URLRequestJobFactory::ProtocolHandler>>
ProtocolHandlerMap;
// A scoped vector of protocol interceptors.
typedef ScopedVector<net::URLRequestInterceptor>
URLRequestInterceptorScopedVector;
#endif // IOS_CHROME_BROWSER_NET_NET_TYPES_H_
| [
"lixiaodonglove7@aliyun.com"
] | lixiaodonglove7@aliyun.com |
0d6a689b27bfb30bf14992e123c60e33925e6895 | 518bf342bc4138982af3e2724e75f1d9ca3ba56c | /solutions/2122. Recover the Original Array/2122.cpp | 002521202ce3333d6f78caacdfeae31de3b3e68d | [
"MIT"
] | permissive | walkccc/LeetCode | dae85af7cc689882a84ee5011f0a13a19ad97f18 | a27be41c174565d365cbfe785f0633f634a01b2a | refs/heads/main | 2023-08-28T01:32:43.384999 | 2023-08-20T19:00:45 | 2023-08-20T19:00:45 | 172,231,974 | 692 | 302 | MIT | 2023-08-13T14:48:42 | 2019-02-23T15:46:23 | C++ | UTF-8 | C++ | false | false | 970 | cpp | class Solution {
public:
vector<int> recoverArray(vector<int>& nums) {
const int n = nums.size();
unordered_map<int, int> count;
for (const int num : nums)
++count[num];
sort(nums.begin(), nums.end());
for (int i = 1; i < n; ++i) {
const int x = nums[i] - nums[0]; // 2 * k
if (x <= 0 || x & 1)
continue;
vector<int> A = getArray(nums, x, count);
if (!A.empty())
return A;
}
throw;
}
private:
vector<int> getArray(const vector<int>& nums, int x,
unordered_map<int, int> count) {
vector<int> A;
for (const int num : nums) {
if (const auto it = count.find(num);
it == count.cend() || it->second == 0)
continue;
if (const auto it = count.find(num + x);
it == count.cend() || it->second == 0)
return {};
--count[num];
--count[num + x];
A.push_back(num + x / 2);
}
return A;
}
};
| [
"me@pengyuc.com"
] | me@pengyuc.com |
d66ce37802d65262ab615baed65540719b0b8b57 | 74376122afb3d7e1b91aece066b6323041e6733d | /main.cpp | ce2a3db9a567e516ffe0bd7f05e595d24fb4506b | [] | no_license | CryptArc/AirHockeyGameKinect | 1758d2fe7e6af53682d4c935941c4cb990a6dd6e | 6e48ab68deceb64a97fae3d9e4d7e8f53a79ec2e | refs/heads/master | 2020-12-25T08:42:31.333262 | 2012-12-05T22:47:51 | 2012-12-05T22:47:51 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,084 | cpp | #include "AirHockeyGame.h"
#include <GL/glut.h>
#include "Kinect.h"
#include "Camera.h"
static AirHockeyGame* game;
static Kinect* kinect;
static Camera* cam;
/* GLUT callback Handlers */
static void
resize(int width, int height)
{
cam->ajustPerspective(width, height, -1.0f, 1.0f, 2.0f, 100.0f);
}
static void
display(void)
{
static double t;
static double timePrec;
t = (glutGet(GLUT_ELAPSED_TIME));
if (t>0.01)
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
kinect->Update();
game->update(t-timePrec);
game->draw();
glutSwapBuffers();
}
timePrec = t;
}
static void
key(unsigned char key, int x, int y)
{
switch (key)
{
case 27 :
case 'q':
exit(0);
break;
case 'p':
game->pause();
break;
case ' ':
game->unpause();
break;
}
glutPostRedisplay();
}
static void
idle(void)
{
glutPostRedisplay();
}
/* Program entry point */
int
main(int argc, char *argv[])
{
const int width = 800;
const int height = 600;
const GLfloat light_ambient[] = { 0.0f, 0.0f, 0.0f, 1.0f };
const GLfloat light_diffuse[] = { 1.0f, 1.0f, 1.0f, 1.0f };
const GLfloat light_specular[] = { 1.0f, 1.0f, 1.0f, 1.0f };
const GLfloat light_position[] = { 2.0f, 5.0f, 5.0f, 0.0f };
const GLfloat mat_ambient[] = { 0.7f, 0.7f, 0.7f, 1.0f };
const GLfloat mat_diffuse[] = { 0.8f, 0.8f, 0.8f, 1.0f };
const GLfloat mat_specular[] = { 1.0f, 1.0f, 1.0f, 1.0f };
const GLfloat high_shininess[] = { 100.0f };
const Vec2 center(0.0f, 0.0f);
float camEye[] = {-9.0f , 0.0f, -3.0f};
float camCenter[] = {0.0f, 0.0f, -6.0f};
float camUp[] = {0.0f,0.0f,1.0f};
float camPerspective[] = {width, height, -1.0f, 1.0f, 2.0f, 100.0f};
game = new AirHockeyGame(center);
cam = new Camera(camEye, camCenter, camUp, camPerspective);
kinect = new Kinect(game, cam);
glutInit(&argc, argv);
glutInitWindowSize(width,height);
glutInitWindowPosition(10,10);
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
glutCreateWindow("Air Hockey Game");
glutReshapeFunc(resize);
glutDisplayFunc(display);
glutKeyboardFunc(key);
glutIdleFunc(idle);
glClearColor(1.0f,1.0f,1.0f,1.0f);
glEnable(GL_CULL_FACE);
glCullFace(GL_BACK);
glEnable(GL_DEPTH_TEST);
glDepthFunc(GL_LESS);
glEnable(GL_LIGHT0);
glEnable(GL_NORMALIZE);
glEnable(GL_COLOR_MATERIAL);
glEnable(GL_LIGHTING);
glLightfv(GL_LIGHT0, GL_AMBIENT, light_ambient);
glLightfv(GL_LIGHT0, GL_DIFFUSE, light_diffuse);
glLightfv(GL_LIGHT0, GL_SPECULAR, light_specular);
glLightfv(GL_LIGHT0, GL_POSITION, light_position);
glMaterialfv(GL_FRONT, GL_AMBIENT, mat_ambient);
glMaterialfv(GL_FRONT, GL_DIFFUSE, mat_diffuse);
glMaterialfv(GL_FRONT, GL_SPECULAR, mat_specular);
glMaterialfv(GL_FRONT, GL_SHININESS, high_shininess);
kinect->Start();
glutMainLoop();
return 0;
}
| [
"tales.martins@gmail.com"
] | tales.martins@gmail.com |
4a6103fccf6a23c3dfee98cae5b8b326a0c2dbc9 | 3e804af6c775a446f8e7560a00d7394c28c1f266 | /src/ethread.cpp | 2e4f6a94bde0f5a51e84e57c037aabb63ba8c7b9 | [
"MIT"
] | permissive | nihirash/Xpeccy | 1c64cb791a309ee801c4f9249f8ed1f9a2369374 | a739428d82205a9e22cf0c0a8d982817bb441e44 | refs/heads/master | 2022-11-12T12:58:34.769923 | 2020-06-21T17:09:53 | 2020-06-21T17:09:53 | 269,768,412 | 1 | 1 | NOASSERTION | 2020-06-07T12:23:45 | 2020-06-05T20:29:56 | C | UTF-8 | C++ | false | false | 3,780 | cpp | // emulation thread (non-GUI)
#include <QWaitCondition>
#include "ethread.h"
#include "xcore/xcore.h"
#include "xgui/xgui.h"
#include "xcore/sound.h"
#include "xcore/vfilters.h"
#if USEMUTEX
QMutex emutex;
QWaitCondition qwc;
#else
int sleepy = 1;
#endif
unsigned char* blkData = NULL;
xThread::xThread() {
sndNs = 0;
conf.emu.fast = 0;
finish = 0;
}
void xThread::stop() {
finish = 1;
#if USEMUTEX
qwc.wakeAll();
#else
sleepy = 0;
#endif
}
void xThread::tap_catch_load(Computer* comp) {
int blk = comp->tape->block;
if (blk >= comp->tape->blkCount) return;
if (conf.tape.fast && comp->tape->blkData[blk].hasBytes) {
unsigned short de = comp->cpu->de;
unsigned short ix = comp->cpu->ix;
TapeBlockInfo inf = tapGetBlockInfo(comp->tape,blk,TFRM_ZX);
blkData = (unsigned char*)realloc(blkData,inf.size + 2);
tapGetBlockData(comp->tape,blk,blkData, inf.size + 2);
if (inf.size == de) {
for (int i = 0; i < de; i++) {
memWr(comp->mem,ix,blkData[i + 1]);
ix++;
}
comp->cpu->ix = ix;
comp->cpu->de = 0;
comp->cpu->hl = 0;
} else {
comp->cpu->hl = 0xff00;
}
tapNextBlock(comp->tape);
comp->cpu->pc = 0x5df;
} else if (conf.tape.autostart) {
emit tapeSignal(TW_STATE,TWS_PLAY);
}
}
void xThread::tap_catch_save(Computer* comp) {
if (conf.tape.fast) {
unsigned short de = comp->cpu->de; // len
unsigned short ix = comp->cpu->ix; // adr
unsigned char crc = comp->cpu->a; // block type
unsigned char* buf = (unsigned char*)malloc(de + 2);
buf[0] = crc;
for(int i = 0; i < de; i++) {
buf[i + 1] = memRd(comp->mem, (ix + i) & 0xffff);
crc ^= buf[i + 1];
}
buf[de + 1] = crc;
TapeBlock blk = tapDataToBlock((char*)buf, de + 2, NULL);
tapAddBlock(comp->tape, blk);
blkClear(&blk);
free(buf);
comp->cpu->pc = 0x053e;
comp->cpu->bc = 0x000e;
comp->cpu->de = 0xffff;
comp->cpu->hl = 0x0000;
comp->cpu->af = 0x0051;
} else if (conf.tape.autostart) {
emit tapeSignal(TW_STATE, TWS_REC);
}
}
void xThread::emuCycle(Computer* comp) {
sndNs = 0;
conf.snd.fill = 1;
do {
// exec 1 opcode (or handle INT, NMI)
if (conf.emu.pause) {
sndNs += 1000;
} else {
sndNs += compExec(comp);
// tape trap
if ((comp->hw->grp == HWG_ZX) && (comp->mem->map[0].type == MEM_ROM) && comp->rom && !comp->dos && !comp->ext) {
if (comp->cpu->pc == 0x559) { // load: ix:addr, de:len (0x580 ?)
tap_catch_load(comp);
} else if (comp->cpu->pc == 0x4d0) { // save: ix:addr, de:len, a:block type(b7), hl:pilot len (1f80/0c98)?
tap_catch_save(comp);
}
if (conf.tape.autostart && !conf.tape.fast && ((comp->cpu->pc == 0x5df) || (comp->cpu->pc == 0x53a))) {
comp->tape->sigLen += 1e6;
tapNextBlock(comp->tape);
tapStop(comp->tape);
emit tapeSignal(TW_STATE,TWS_STOP);
}
}
}
// sound buffer update
while (sndNs > nsPerSample) {
sndSync(comp);
sndNs -= nsPerSample;
}
if (comp->frmStrobe) {
comp->frmStrobe = 0;
conf.vid.fcount++;
emit s_frame();
}
} while (!comp->brk && conf.snd.fill && !finish && !conf.emu.pause);
comp->nmiRequest = 0;
}
void xThread::run() {
Computer* comp;
do {
#if !USEMUTEX
sleepy = 1;
#endif
comp = conf.prof.cur->zx;
#ifdef HAVEZLIB
if (comp->rzx.start) {
comp->rzx.start = 0;
comp->rzx.play = 1;
comp->rzx.fCount = 0;
comp->rzx.fCurrent = 0;
rewind(comp->rzx.file);
rzxGetFrame(comp);
}
#endif
if (!conf.emu.pause) {
emuCycle(comp);
if (comp->brk) {
conf.emu.pause |= PR_DEBUG;
comp->brk = 0;
emit dbgRequest();
}
}
#if USEMUTEX
if (!conf.emu.fast && !finish) {
emutex.lock();
qwc.wait(&emutex);
emutex.unlock();
}
#else
while (!conf.emu.fast && sleepy && !finish)
usleep(10);
#endif
} while (!finish);
exit(0);
}
| [
"samstyle@list.ru"
] | samstyle@list.ru |
8557a5a47f6e8b7f62bc2e972dff61f6bf19239f | 38a99a26d47cf46d04a0d7158810255bf27e73e6 | /Fundamentals of programming/Projects 2 sem/Курсовая/CppCLR_WinformsProjekt1/Form1.h | febd07c40285775a61ac82fa7868ef70c9f5d0fd | [] | no_license | KlickerTM/University | c64e99710ff2b0f49349d60a46bd283e29b0dde2 | bc9b048f548959fbdfbb2a00d46e88c9873b1d01 | refs/heads/main | 2023-03-18T18:21:37.699371 | 2021-03-11T22:54:12 | 2021-03-11T22:54:12 | 342,335,327 | 0 | 0 | null | null | null | null | WINDOWS-1251 | C++ | false | false | 13,277 | h | #pragma once
#include <string>
#include <ctime>
namespace CppCLRWinformsProjekt
{
using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;
/// <summary>
/// Zusammenfassung fьr Form1
/// </summary>
public ref class Form1 : public System::Windows::Forms::Form
{
public:
Form1(void)
{
InitializeComponent();
//
//TODO: Konstruktorcode hier hinzufьgen.
//
}
private: System::Windows::Forms::Label^ label2;
private: System::Windows::Forms::Label^ label3;
private: System::Windows::Forms::Label^ label4;
private: System::Windows::Forms::Label^ label5;
private: System::Windows::Forms::Label^ label6;
private: System::Windows::Forms::Button^ button2;
private: System::Windows::Forms::Label^ label7;
public:
public:
int score = 0;
int counter = 0;
protected:
/// <summary>
/// Verwendete Ressourcen bereinigen.
/// </summary>
~Form1()
{
if (components)
{
delete components;
}
}
private: System::Windows::Forms::Button^ button1;
private: System::Windows::Forms::PictureBox^ pictureBox1;
private: System::Windows::Forms::PictureBox^ pictureBox2;
private: System::Windows::Forms::PictureBox^ pictureBox3;
private: System::Windows::Forms::Label^ label1;
protected:
private:
/// <summary>
/// Erforderliche Designervariable.
/// </summary>
System::ComponentModel::Container ^components;
#pragma region Windows Form Designer generated code
/// <summary>
/// Erforderliche Methode fьr die Designerunterstьtzung.
/// Der Inhalt der Methode darf nicht mit dem Code-Editor geдndert werden.
/// </summary>
void InitializeComponent(void)
{
this->button1 = (gcnew System::Windows::Forms::Button());
this->pictureBox1 = (gcnew System::Windows::Forms::PictureBox());
this->pictureBox2 = (gcnew System::Windows::Forms::PictureBox());
this->pictureBox3 = (gcnew System::Windows::Forms::PictureBox());
this->label1 = (gcnew System::Windows::Forms::Label());
this->label2 = (gcnew System::Windows::Forms::Label());
this->label3 = (gcnew System::Windows::Forms::Label());
this->label4 = (gcnew System::Windows::Forms::Label());
this->label5 = (gcnew System::Windows::Forms::Label());
this->label6 = (gcnew System::Windows::Forms::Label());
this->button2 = (gcnew System::Windows::Forms::Button());
this->label7 = (gcnew System::Windows::Forms::Label());
(cli::safe_cast<System::ComponentModel::ISupportInitialize^>(this->pictureBox1))->BeginInit();
(cli::safe_cast<System::ComponentModel::ISupportInitialize^>(this->pictureBox2))->BeginInit();
(cli::safe_cast<System::ComponentModel::ISupportInitialize^>(this->pictureBox3))->BeginInit();
this->SuspendLayout();
//
// button1
//
this->button1->BackColor = System::Drawing::Color::LightSkyBlue;
this->button1->FlatStyle = System::Windows::Forms::FlatStyle::Popup;
this->button1->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 14));
this->button1->ForeColor = System::Drawing::Color::DarkCyan;
this->button1->Location = System::Drawing::Point(237, 283);
this->button1->Name = L"button1";
this->button1->Size = System::Drawing::Size(304, 75);
this->button1->TabIndex = 0;
this->button1->Text = L"Крутить!";
this->button1->UseVisualStyleBackColor = false;
this->button1->Click += gcnew System::EventHandler(this, &Form1::button1_Click);
//
// pictureBox1
//
this->pictureBox1->Location = System::Drawing::Point(120, 95);
this->pictureBox1->Name = L"pictureBox1";
this->pictureBox1->Size = System::Drawing::Size(125, 125);
this->pictureBox1->TabIndex = 1;
this->pictureBox1->TabStop = false;
//
// pictureBox2
//
this->pictureBox2->Location = System::Drawing::Point(326, 95);
this->pictureBox2->Name = L"pictureBox2";
this->pictureBox2->Size = System::Drawing::Size(125, 125);
this->pictureBox2->TabIndex = 2;
this->pictureBox2->TabStop = false;
//
// pictureBox3
//
this->pictureBox3->Location = System::Drawing::Point(520, 95);
this->pictureBox3->Name = L"pictureBox3";
this->pictureBox3->Size = System::Drawing::Size(125, 125);
this->pictureBox3->TabIndex = 3;
this->pictureBox3->TabStop = false;
//
// label1
//
this->label1->AutoSize = true;
this->label1->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 13));
this->label1->ForeColor = System::Drawing::Color::Red;
this->label1->Location = System::Drawing::Point(322, 415);
this->label1->Name = L"label1";
this->label1->Size = System::Drawing::Size(0, 22);
this->label1->TabIndex = 4;
//
// label2
//
this->label2->AutoSize = true;
this->label2->ForeColor = System::Drawing::Color::Red;
this->label2->Location = System::Drawing::Point(338, 377);
this->label2->Name = L"label2";
this->label2->Size = System::Drawing::Size(0, 13);
this->label2->TabIndex = 7;
//
// label3
//
this->label3->AutoSize = true;
this->label3->ForeColor = System::Drawing::Color::Yellow;
this->label3->Location = System::Drawing::Point(12, 9);
this->label3->Name = L"label3";
this->label3->Size = System::Drawing::Size(35, 13);
this->label3->TabIndex = 8;
this->label3->Text = L"label3";
this->label3->Visible = false;
//
// label4
//
this->label4->AutoSize = true;
this->label4->ForeColor = System::Drawing::Color::Yellow;
this->label4->Location = System::Drawing::Point(53, 9);
this->label4->Name = L"label4";
this->label4->Size = System::Drawing::Size(35, 13);
this->label4->TabIndex = 9;
this->label4->Text = L"label4";
this->label4->Visible = false;
//
// label5
//
this->label5->AutoSize = true;
this->label5->ForeColor = System::Drawing::Color::Yellow;
this->label5->Location = System::Drawing::Point(94, 9);
this->label5->Name = L"label5";
this->label5->Size = System::Drawing::Size(35, 13);
this->label5->TabIndex = 10;
this->label5->Text = L"lable5";
this->label5->Visible = false;
//
// label6
//
this->label6->AutoSize = true;
this->label6->ForeColor = System::Drawing::Color::Yellow;
this->label6->Location = System::Drawing::Point(136, 9);
this->label6->Name = L"label6";
this->label6->Size = System::Drawing::Size(236, 13);
this->label6->TabIndex = 11;
this->label6->Text = L"1 - 15 | 16 - 27 | 28 -36 | 37 - 43 | 44 - 48 | 49 - 50";
this->label6->Visible = false;
//
// button2
//
this->button2->BackColor = System::Drawing::Color::LightSkyBlue;
this->button2->FlatStyle = System::Windows::Forms::FlatStyle::Popup;
this->button2->ForeColor = System::Drawing::Color::DarkCyan;
this->button2->Location = System::Drawing::Point(12, 444);
this->button2->Name = L"button2";
this->button2->Size = System::Drawing::Size(85, 31);
this->button2->TabIndex = 12;
this->button2->Text = L"Отладка";
this->button2->UseVisualStyleBackColor = false;
this->button2->Click += gcnew System::EventHandler(this, &Form1::button2_Click);
//
// label7
//
this->label7->AutoSize = true;
this->label7->ForeColor = System::Drawing::Color::Yellow;
this->label7->Location = System::Drawing::Point(12, 33);
this->label7->Name = L"label7";
this->label7->Size = System::Drawing::Size(132, 13);
this->label7->TabIndex = 13;
this->label7->Text = L"Количество вращений: 0";
this->label7->Visible = false;
//
// Form1
//
this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
this->BackColor = System::Drawing::Color::FromArgb(static_cast<System::Int32>(static_cast<System::Byte>(4)), static_cast<System::Int32>(static_cast<System::Byte>(2)),
static_cast<System::Int32>(static_cast<System::Byte>(38)));
this->ClientSize = System::Drawing::Size(786, 487);
this->Controls->Add(this->label7);
this->Controls->Add(this->button2);
this->Controls->Add(this->label6);
this->Controls->Add(this->label5);
this->Controls->Add(this->label4);
this->Controls->Add(this->label3);
this->Controls->Add(this->label2);
this->Controls->Add(this->label1);
this->Controls->Add(this->pictureBox3);
this->Controls->Add(this->pictureBox2);
this->Controls->Add(this->pictureBox1);
this->Controls->Add(this->button1);
this->Name = L"Form1";
this->Text = L"Form1";
this->Load += gcnew System::EventHandler(this, &Form1::Form1_Load);
(cli::safe_cast<System::ComponentModel::ISupportInitialize^>(this->pictureBox1))->EndInit();
(cli::safe_cast<System::ComponentModel::ISupportInitialize^>(this->pictureBox2))->EndInit();
(cli::safe_cast<System::ComponentModel::ISupportInitialize^>(this->pictureBox3))->EndInit();
this->ResumeLayout(false);
this->PerformLayout();
}
#pragma endregion
private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e)
{
srand(time(NULL));
short n1 = rand() % 50 + 1; //Рандом числа первой картинки
short n2 = rand() % 50 + 1; //Рандом числа второй картинки
short n3 = rand() % 50 + 1; //Рандом числа третий картинки
label3->Text = n1.ToString();
label4->Text = n2.ToString();
label5->Text = n3.ToString();
if (n1 >= 1 && n1 <= 15) //Рандом первой картинки
{
pictureBox1->Image = System::Drawing::Bitmap::FromFile("фрукт.png");
n1 = 1;
}
else if (n1 >= 16 && n1 <= 27)
{
pictureBox1->Image = System::Drawing::Bitmap::FromFile("фрукт2.png");
n1 = 2;
}
else if (n1 >= 28 && n1 <= 36)
{
pictureBox1->Image = System::Drawing::Bitmap::FromFile("фрукт3.png");
n1 = 3;
}
else if (n1 >= 37 && n1 <= 43)
{
pictureBox1->Image = System::Drawing::Bitmap::FromFile("фрукт4.png");
n1 = 4;
}
else if (n1 >= 44 && n1 <= 48)
{
pictureBox1->Image = System::Drawing::Bitmap::FromFile("фрукт5.png");
n1 = 5;
}
else if (n1 >= 49 && n1 <= 50)
{
pictureBox1->Image = System::Drawing::Bitmap::FromFile("777.png");
n1 = 7;
}
if (n2 >= 1 && n2 <= 15) //Рандом второй картинки
{
pictureBox2->Image = System::Drawing::Bitmap::FromFile("фрукт.png");
n2 = 1;
}
else if (n2 >= 16 && n2 <= 27)
{
pictureBox2->Image = System::Drawing::Bitmap::FromFile("фрукт2.png");
n2 = 2;
}
else if (n2 >= 28 && n2 <= 36)
{
pictureBox2->Image = System::Drawing::Bitmap::FromFile("фрукт3.png");
n2 = 3;
}
else if (n2 >= 37 && n2 <= 43)
{
pictureBox2->Image = System::Drawing::Bitmap::FromFile("фрукт4.png");
n2 = 4;
}
else if (n2 >= 44 && n2 <= 48)
{
pictureBox2->Image = System::Drawing::Bitmap::FromFile("фрукт5.png");
n2 = 5;
}
else if (n2 >= 49 && n2 <= 50)
{
pictureBox2->Image = System::Drawing::Bitmap::FromFile("777.png");
n2 = 7;
}
if (n3 >= 1 && n3 <= 15) //Рандом третий картинки
{
pictureBox3->Image = System::Drawing::Bitmap::FromFile("фрукт.png");
n3 = 1;
}
else if (n3 >= 16 && n3 <= 27)
{
pictureBox3->Image = System::Drawing::Bitmap::FromFile("фрукт2.png");
n3 = 2;
}
else if (n3 >= 28 && n3 <= 36)
{
pictureBox3->Image = System::Drawing::Bitmap::FromFile("фрукт3.png");
n3 = 3;
}
else if (n3 >= 37 && n3 <= 43)
{
pictureBox3->Image = System::Drawing::Bitmap::FromFile("фрукт4.png");
n3 = 4;
}
else if (n3 >= 44 && n3 <= 48)
{
pictureBox3->Image = System::Drawing::Bitmap::FromFile("фрукт5.png");
n3 = 5;
}
else if (n3 >= 49 && n3 <= 50)
{
pictureBox3->Image = System::Drawing::Bitmap::FromFile("777.png");
n3 = 7;
}
if (n1 == n2 && n2 == n3)
{
if (n1 == 1)
{
score += 100;
label2->Text = "Выйгрышь 100 очков!!!";
}
else if (n1 == 2)
{
score += 200;
label2->Text = "Выйгрышь 200 очков!!!";
}
else if (n1 == 3)
{
score += 300;
label2->Text = "Выйгрышь 300 очков!!!";
}
else if (n1 == 4)
{
score += 400;
label2->Text = "Выйгрышь 400 очков!!!";
}
else if (n1 == 5)
{
score += 500;
label2->Text = "Выйгрышь 500 очков!!!";
}
else if (n1 == 7)
{
score += 7777;
label2->Text = "Выйгрышь 7777 очков!!!";
}
}
else
label2->Text = " ";
label1->Text = "У вас: "+score.ToString()+" очков";
counter++;
label7->Text = "Количество вращений: " + counter.ToString();
}
private: System::Void button2_Click(System::Object^ sender, System::EventArgs^ e)
{
if (label3->Visible == false)
{
label3->Visible = true;
label4->Visible = true;
label5->Visible = true;
label6->Visible = true;
label7->Visible = true;
}
else
{
label3->Visible = false;
label4->Visible = false;
label5->Visible = false;
label6->Visible = false;
label7->Visible = false;
}
}
private: System::Void Form1_Load(System::Object^ sender, System::EventArgs^ e) {
}
};
}
| [
"79660699+KlickerTM@users.noreply.github.com"
] | 79660699+KlickerTM@users.noreply.github.com |
22c65ed58635f9e56a0da15791b84770194f28e8 | e6d4a87dcf98e93bab92faa03f1b16253b728ac9 | /algorithms/cpp/makeTwoArraysEqualbyReversingSub-arrays/makeTwoArraysEqualbyReversingSub-arrays.cpp | bb8d81f5cd27d8c38c127d7e33abb426b3fe666c | [] | no_license | MichelleZ/leetcode | b5a58e1822e3f6ef8021b29d9bc9aca3fd3d416f | a390adeeb71e997b3c1a56c479825d4adda07ef9 | refs/heads/main | 2023-03-06T08:16:54.891699 | 2023-02-26T07:17:47 | 2023-02-26T07:17:47 | 326,904,500 | 3 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 422 | cpp | // Source: https://leetcode.com/problems/make-two-arrays-equal-by-reversing-sub-arrays/
// Author: Miao Zhang
// Date: 2021-05-08
class Solution {
public:
bool canBeEqual(vector<int>& target, vector<int>& arr) {
vector<int> t(1001);
vector<int> a(1001);
for (int i = 0; i < target.size(); i++) {
t[target[i]]++;
a[arr[i]]++;
}
return t == a;
}
};
| [
"zhangdaxiaomiao@163.com"
] | zhangdaxiaomiao@163.com |
a73c168f99dff903adec9cf8822d72140bd91125 | 3a042e09c13e9fd384df269e128836c74c5484c4 | /SuwakoHat/SuwakoEyes.ino | 325a6167f2d943dfff5c06a9f6a998ee97b75dcc | [
"BSD-3-Clause"
] | permissive | galaxyAbstractor/Suwako-Moriya-Hat | e645213572db4713b1b83b8e3a9e8737f24521b6 | ef1d06397465c7df51293f11142cfea91aa3c5a4 | refs/heads/master | 2020-05-17T15:20:32.362959 | 2015-07-22T23:03:55 | 2015-07-22T23:03:55 | 26,689,013 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 6,082 | ino | const uint8_t _eyes[4][6] PROGMEM = {
{
B00000000, // Regular eye
B00001100,
B00011110,
B00011110,
B00001100,
B00000000
},
{
B00000011, // < eye (arrow)
B00001100,
B00110000,
B00110000,
B00001100,
B00000011
},
{
B00000000, // shut eye
B00000000,
B11111111,
B11111111,
B00000000,
B00000000
},
{
B00000000, // Ring eye
B00001100,
B00010010,
B00010010,
B00001100,
B00000000
}
};
Adafruit_NeoMatrix* _leftEye;
Adafruit_NeoMatrix* _rightEye;
int8_t _offsetX = 0;
int8_t _offsetY = 0;
uint8_t _leftEyeIndex;
uint8_t _rightEyeIndex;
uint8_t _colorMode;
uint32_t _color;
boolean _randomEyes = false;
boolean _moveAround = false;
boolean _initial = false;
void SuwakoEyes(uint8_t leftEyePin, uint8_t rightEyePin) {
_leftEye = new Adafruit_NeoMatrix(6, 6, leftEyePin,
NEO_MATRIX_TOP + NEO_MATRIX_LEFT +
NEO_MATRIX_ROWS + NEO_MATRIX_PROGRESSIVE,
NEO_GRB + NEO_KHZ800);
_rightEye = new Adafruit_NeoMatrix(6, 6, rightEyePin,
NEO_MATRIX_BOTTOM + NEO_MATRIX_RIGHT +
NEO_MATRIX_ROWS + NEO_MATRIX_PROGRESSIVE,
NEO_GRB + NEO_KHZ800);
_leftEye->begin();
_leftEye->setBrightness(255); // pls no hurt my eyes while testing ;_;
_leftEye->show();
_rightEye->begin();
_rightEye->setBrightness(255); // pls no hurt my eyes while testing ;_;
_rightEye->show();
}
void clearEyes() {
_leftEye->clear();
_rightEye->clear();
}
void drawEye(Adafruit_NeoMatrix* ledMatrix, bool inverted, uint8_t eye) {
ledMatrix->clear();
for (uint8_t y = 0; y < 6; y++) {
byte buffer = pgm_read_byte(&(_eyes[eye][y]));
for (uint8_t x = 0; x < 6; x++) {
if (inverted) {
if ((buffer >> 5-x)&1) {
ledMatrix->drawPixel(y + _offsetY, x + _offsetX, _color);
}
} else {
if ((buffer >> x)&1) {
ledMatrix->drawPixel((y + _offsetY), (x + _offsetX), _color);
}
}
}
}
ledMatrix->show();
}
void animateLookAround() {
int8_t offsetX = -1 + (rand() % 3);
int8_t offsetY = -1 + (rand() % 3);
while (_offsetX != offsetX && _offsetY != offsetY) {
int8_t x = offsetX == _offsetX ? 0 : offsetX < _offsetX ? -1 : 1;
int8_t y = offsetY == _offsetY ? 0 : offsetY < _offsetY ? -1 : 1;
drawEye(_leftEye, true, _leftEyeIndex);
drawEye(_rightEye, false, _rightEyeIndex);
_offsetX += x;
_offsetY += y;
delay(150);
}
}
void setEyes(uint8_t eye) {
setOffsetX(0);
setOffsetY(0);
_leftEyeIndex = eye;
_rightEyeIndex = eye;
}
void setLeftEyeIndex(uint8_t leftEyeIndex) {
setOffsetX(0);
setOffsetY(0);
_leftEyeIndex = leftEyeIndex;
}
void setRightEyeIndex(uint8_t rightEyeIndex) {
setOffsetX(0);
setOffsetY(0);
_rightEyeIndex = rightEyeIndex;
}
void setOffsetX(int8_t offsetX) {
_offsetX = offsetX;
}
void setOffsetY(int8_t offsetY) {
_offsetY = offsetY;
}
/*
* 0 = static
* 1 = fade
*/
void setColorMode(uint8_t mode) {
_colorMode = mode;
}
void setRandomEyes(boolean randomEyes) {
_randomEyes = randomEyes;
}
void setMoveAround(boolean moveAround) {
setOffsetX(0);
setOffsetY(0);
_moveAround = moveAround;
}
unsigned long nextTime = 0L;
unsigned long nextLookaroundTime = 0L;
void doRandom() {
if ((rand() % 100) >= 95 && millis() > nextTime) {
uint8_t eye = rand() % 4;
setEyes(eye);
setOffsetX(0);
setOffsetY(0);
nextTime = millis() + 60000;
} else {
if ((_leftEyeIndex == 0 || _leftEyeIndex == 3) && (_rightEyeIndex == 0 || _rightEyeIndex == 3) && _moveAround) {
if ((rand() % 100) >= 25 && millis() > nextLookaroundTime) {
animateLookAround();
nextLookaroundTime = millis() + 5000;
}
}
}
}
void setColor(uint8_t r, uint8_t g, uint8_t b) {
_color = _leftEye->Color(r, g, b);
}
void setBrightness(uint8_t brightness) {
_leftEye->setBrightness(brightness);
_rightEye->setBrightness(brightness);
}
void Wheel(uint8_t WheelPos) {
WheelPos = 255 - WheelPos;
if(WheelPos < 85) {
setColor(255 - WheelPos * 3, 0, WheelPos * 3);
} else if(WheelPos < 170) {
WheelPos -= 85;
setColor(0, WheelPos * 3, 255 - WheelPos * 3);
} else {
WheelPos -= 170;
setColor(WheelPos * 3, 255 - WheelPos * 3, 0);
}
}
uint8_t _step = 0;
void doFadeColor() {
Wheel(_step);
_step += 3;
if (_step > 256) _step = 0;
}
// I'm boring with colors
uint8_t colors[7][3] = {
{255, 0, 0},
{0, 255, 0},
{0, 0, 255},
{255, 255, 0},
{0, 255, 255},
{255, 0, 255},
{255, 255, 255},
};
void selectRandomColor() {
int index = rand() % 7;
setColor(colors[index][0], colors[index][1], colors[index][2]);
}
unsigned long nextColorTime = 0L;
void tick() {
if (_randomEyes) {
doRandom();
}
if (_colorMode == 1) {
doFadeColor();
} else if (_colorMode == 2) {
if((rand() % 100) >= 95 && millis() > nextColorTime) {
selectRandomColor();
nextColorTime = millis() + 60000;
}
}
if (!_randomEyes && (_leftEyeIndex == 0 || _leftEyeIndex == 3) && (_rightEyeIndex == 0 || _rightEyeIndex == 3) && _moveAround) {
if ((rand() % 100) >= 25 && millis() > nextLookaroundTime) {
animateLookAround();
nextLookaroundTime = millis() + 10000;
}
}
drawEye(_leftEye, true, _leftEyeIndex);
drawEye(_rightEye, false, _rightEyeIndex);
}
| [
"galaxyAbstractor@gmail.com"
] | galaxyAbstractor@gmail.com |
e07d19daea5d5c0bd4a57cf3db351706fc5b3f0b | 4b133c1fdd689958836a3ee181d7cddf984725f3 | /ubung/cg2_u04/cg2application.h | d1c9b34e3a4c89d1a92f8b6f0bd1a90066d2ec4b | [] | no_license | jimpu001/CG2 | c59d81154dc25d046f010491519d3496914dcba4 | 572f32472c01274869d4aa4bbac3dca609b89af8 | refs/heads/master | 2020-05-22T15:27:03.810594 | 2019-07-07T11:24:34 | 2019-07-07T11:24:34 | 186,406,107 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,193 | h | #ifndef CG2APPLICATION_H
#define CG2APPLICATION_H
#include <glad/glad.h>
#include <glm/glm.hpp>
#include <GLFW/glfw3.h>
#include <cstring>
#include <sstream>
#include "gl_utils.h"
#include "geometry.h"
#include "util.h"
#include "event_data.h"
#include "scene.h"
#include "shader_compositor.h"
/* CG2App: We encapsulate all of our application state in this class.
* We use a single instance of this object (in main). glfw will call the
* ..._event methods when corresponding events occure.
*/
class CG2App
{
protected:
/* GFLW backend */
GLFWwindow *m_glfw_win;
bool init_glfw_backend();
void destroy_glfw_backend();
public:
CG2EventData event_data;
/* Application States */
CG2Scene scene;
CG2App()
{
init_glfw_backend();
init_gl_state();
}
~CG2App()
{
clean_up_gl_state();
destroy_glfw_backend();
}
/**
* @brief resize_event Will be called every time the framebuffer is
* resized!
* @param w new width in pixels
* @param h new height in pixels
*/
void resize_event(int w, int h);
/**
* @brief keyboard_event will be called every time a key on the key
* board is pressed or released.
* @param key The key (GLFW_KEY_*)
* @param action The action that was performed.
* One of GLFW_RELEASE,GLFW_PRESS, GLFW_REPEAT
* @param mods The modifyer keys, that were pressed.
* A bitmask composed of these bits:
* GLFW_MOD_SHIFT, GLFW_MOD_CONTROL, GLFW_MOD_ALT, GLFW_MOD_SUPER
*/
void keyboard_event(int key, int action, int mods);
/**
* @brief mouse_button_event will be called every time a mouse button
* was pressed or released
* @param button The button (GLFW_MOUSE_BUTTON_*)
* @param action The action that was performed.
* One of GLFW_RELEASE,GLFW_PRESS, GLFW_REPEAT
* @param mods The modifyer keys, that were pressed.
* A bitmask composed of these bits:
* GLFW_MOD_SHIFT, GLFW_MOD_CONTROL, GLFW_MOD_ALT, GLFW_MOD_SUPER
*/
void mouse_button_event(int button, int action, int mods);
/**
* @brief mouse_wheel_event will be called, whenever the mouse wheele is
* turned/shifted.
* @param x The offset in the x direction
* @param y The offset in the y direction
*/
void mouse_wheel_event(float x, float y);
/**
* @brief render_one_frame called once per frame
*/
void render_one_frame();
void init_shader();
/**
* @brief CG2App::init_lights inits all light sources.
*/
void init_lights();
/**
* @brief CG2App::init_lights inits all light sources.
*/
void init_sponza_scene();
/**
* @brief init_gl_state will be called once when the renderloop is
* entered.
*/
void init_gl_state();
/**
* @brief clean_up_gl_state will be called after the renderloop is left
*/
void clean_up_gl_state();
/**
* @brief stop_rendering can be called to exit the rendering loop
*/
void stop_rendering();
/**
* @brief enter_render_loop call this to enter the renderloop
*/
void enter_render_loop();
void update_title();
void catchCursor( bool c);
protected:
// Data needed for the time measurements
CG2GLWatch<>* m_watch[2];
double m_gpu_time;
double m_cpu_time;
unsigned int m_num_timestamps;
double m_time_passed;
};
#endif // CG2APPLICATION_H
| [
"jimpu001@gmail.com"
] | jimpu001@gmail.com |
dd5e174494698b37f146f768325b392041ec66bc | f81b774e5306ac01d2c6c1289d9e01b5264aae70 | /components/query_tiles/switches.h | cb585f65f7f43cb350ba534f74f7a2228e0b7539 | [
"BSD-3-Clause"
] | permissive | waaberi/chromium | a4015160d8460233b33fe1304e8fd9960a3650a9 | 6549065bd785179608f7b8828da403f3ca5f7aab | refs/heads/master | 2022-12-13T03:09:16.887475 | 2020-09-05T20:29:36 | 2020-09-05T20:29:36 | 293,153,821 | 1 | 1 | BSD-3-Clause | 2020-09-05T21:02:50 | 2020-09-05T21:02:49 | null | UTF-8 | C++ | false | false | 1,937 | h | // Copyright 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.
#ifndef COMPONENTS_QUERY_TILES_SWITCHES_H_
#define COMPONENTS_QUERY_TILES_SWITCHES_H_
#include "base/feature_list.h"
namespace query_tiles {
namespace features {
// Main feature flag for the query tiles feature that allows or blocks the
// feature in the user's country. Must be checked in addition to any other flag.
extern const base::Feature kQueryTilesGeoFilter;
// Main feature flag for the query tiles feature.
extern const base::Feature kQueryTiles;
// Feature flag to determine whether query tiles should be shown on omnibox.
extern const base::Feature kQueryTilesInOmnibox;
// Feature flag to determine whether the user will have a chance to edit the
// query before in the omnibox sumbitting the search. In this mode only one
// level of tiles will be displayed.
extern const base::Feature kQueryTilesEnableQueryEditing;
// Feature flag to determine whether query tiles should be displayed in an order
// based on local user interactions.
extern const base::Feature kQueryTilesLocalOrdering;
// Helper function to determine whether query tiles should be shown on omnibox.
bool IsEnabledQueryTilesInOmnibox();
} // namespace features
namespace switches {
// If set, only one level of query tiles will be shown.
extern const char kQueryTilesSingleTier[];
// If set, this value overrides the default country code to be sent to the
// server when fetching tiles.
extern const char kQueryTilesCountryCode[];
// If set, the background task will be started after a short period.
extern const char kQueryTilesInstantBackgroundTask[];
// If set, server will return trending tiles along with curated tiles.
extern const char kQueryTilesEnableTrending[];
} // namespace switches
} // namespace query_tiles
#endif // COMPONENTS_QUERY_TILES_SWITCHES_H_
| [
"commit-bot@chromium.org"
] | commit-bot@chromium.org |
3df68f52fe0517e47ca6f8ee3164c29b3b2ee5cf | c9d54a6a5d5380779c5cabee497f880c7c2f37bf | /enums_data.h | 8a91dd4a3ad15b0cc78fc261d780da4ef9daa59f | [
"MIT"
] | permissive | M1keZulu/CS217-CL217-ChessOOP | 88b619dd67573e10ce7c89b142d1e01a3f1a0ba6 | 4e18b1754695da28f8172bf7d323a1bbf4f6ce13 | refs/heads/main | 2023-06-24T22:17:21.875108 | 2021-07-10T15:14:24 | 2021-07-10T15:14:24 | 354,959,779 | 5 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 406 | h | #ifndef ENUMS_DATA_H
#define ENUMS_DATA_H
using namespace std;
enum PieceType{
king, queen, bishop, knight, rook, pawn
};
enum Color{
black, white
};
enum Status{
alive, dead
};
enum ConnectionType{
host, client
};
enum Direction{
up, down
};
struct Point{
int x;
int y;
};
struct Detail{
int x;
int y;
Color color;
PieceType name;
};
struct Moves{
Point p;
string cell;
};
#endif
| [
"68997634+M1keZulu@users.noreply.github.com"
] | 68997634+M1keZulu@users.noreply.github.com |
41f4ca1a694085a10a888163a4b482d6cc6b4adb | b61ecc9a28f17a0398b7653a85794430641437a8 | /leetcode/源.cpp | e45ba0e723a5be751642e6bf0a9baaec7a8e4bfb | [] | no_license | wumingde110/cjiajia | 6a3f5f881182fd6e0776f6a7cbd14190291d661b | cd97aba362da8709931b6296392ec3add8e0e41e | refs/heads/master | 2020-04-08T04:05:14.891523 | 2018-11-25T05:56:18 | 2018-11-25T05:56:18 | 159,002,542 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 189 | cpp | //#include <iostream>
//#include <vector>
//#include <string>
//class Solution {
//public:
// std::vector<int> findAnagrams(std::string s, std::string p) {
//
// }
//};
//int main()
//{
//} | [
"2207298807@qq.com"
] | 2207298807@qq.com |
23a3bbbeac7c1941c45f4dbc282b4252ad5ce132 | 202b1b82a2b7a70250415ba5d9bd1f6b277a6e84 | /src/test/bswap_tests.cpp | 6988c68a93884d3b50ebd5882ba3f8841488b1cb | [
"MIT"
] | permissive | cmkcoin/cmkcore | 92cc4dcaf63b1d282ea2c2aa15ede822c9c7b0e7 | 5c2a3222ef901d1c6d9315177ba79e3f5094f2a6 | refs/heads/master | 2020-03-15T04:26:42.979962 | 2019-10-19T03:55:45 | 2019-10-19T03:55:45 | 131,965,565 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 732 | cpp | // Copyright (c) 2016 The Bitcoin Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include "compat/byteswap.h"
#include "test/test_cmk.h"
#include <boost/test/unit_test.hpp>
BOOST_FIXTURE_TEST_SUITE(bswap_tests, BasicTestingSetup)
BOOST_AUTO_TEST_CASE(bswap_tests)
{
// Sibling in bitcoin/src/qt/test/compattests.cpp
uint16_t u1 = 0x1234;
uint32_t u2 = 0x56789abc;
uint64_t u3 = 0xdef0123456789abc;
uint16_t e1 = 0x3412;
uint32_t e2 = 0xbc9a7856;
uint64_t e3 = 0xbc9a78563412f0de;
BOOST_CHECK(bswap_16(u1) == e1);
BOOST_CHECK(bswap_32(u2) == e2);
BOOST_CHECK(bswap_64(u3) == e3);
}
BOOST_AUTO_TEST_SUITE_END()
| [
"cmkdev@vps.cmk.io"
] | cmkdev@vps.cmk.io |
d9be5191767af72cc2571c43c23a71b7b9b14d1c | 41d5479a73b630619569707ce0d1de8daee01286 | /lib/mesa/src/amd/compiler/aco_assembler.cpp | f9dc4bfcf5eb3620def31dd9bc54b23aefeda3c1 | [] | no_license | rwp0/xenocara | 79f97cecb14477542de61156548f5ca1a890515a | 6af6d1f007792b01f09583b79ed943da39ad696c | refs/heads/master | 2023-06-05T11:12:59.797442 | 2021-07-05T11:04:36 | 2021-07-05T11:04:36 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 28,153 | cpp | #include <vector>
#include <algorithm>
#include "aco_ir.h"
#include "common/sid.h"
#include "ac_shader_util.h"
#include "util/u_math.h"
namespace aco {
struct asm_context {
Program *program;
enum chip_class chip_class;
std::vector<std::pair<int, SOPP_instruction*>> branches;
std::vector<unsigned> constaddrs;
const int16_t* opcode;
// TODO: keep track of branch instructions referring blocks
// and, when emitting the block, correct the offset in instr
asm_context(Program* program) : program(program), chip_class(program->chip_class) {
if (chip_class <= GFX7)
opcode = &instr_info.opcode_gfx7[0];
else if (chip_class <= GFX9)
opcode = &instr_info.opcode_gfx9[0];
else if (chip_class == GFX10)
opcode = &instr_info.opcode_gfx10[0];
}
int subvector_begin_pos = -1;
};
void emit_instruction(asm_context& ctx, std::vector<uint32_t>& out, Instruction* instr)
{
/* lower remaining pseudo-instructions */
if (instr->opcode == aco_opcode::p_constaddr) {
unsigned dest = instr->definitions[0].physReg();
unsigned offset = instr->operands[0].constantValue();
/* s_getpc_b64 dest[0:1] */
uint32_t encoding = (0b101111101 << 23);
uint32_t opcode = ctx.opcode[(int)aco_opcode::s_getpc_b64];
if (opcode >= 55 && ctx.chip_class <= GFX9) {
assert(ctx.chip_class == GFX9 && opcode < 60);
opcode = opcode - 4;
}
encoding |= dest << 16;
encoding |= opcode << 8;
out.push_back(encoding);
/* s_add_u32 dest[0], dest[0], ... */
encoding = (0b10 << 30);
encoding |= ctx.opcode[(int)aco_opcode::s_add_u32] << 23;
encoding |= dest << 16;
encoding |= dest;
encoding |= 255 << 8;
out.push_back(encoding);
ctx.constaddrs.push_back(out.size());
out.push_back(offset);
/* s_addc_u32 dest[1], dest[1], 0 */
encoding = (0b10 << 30);
encoding |= ctx.opcode[(int)aco_opcode::s_addc_u32] << 23;
encoding |= (dest + 1) << 16;
encoding |= dest + 1;
encoding |= 128 << 8;
out.push_back(encoding);
return;
}
uint32_t opcode = ctx.opcode[(int)instr->opcode];
if (opcode == (uint32_t)-1) {
fprintf(stderr, "Unsupported opcode: ");
aco_print_instr(instr, stderr);
abort();
}
switch (instr->format) {
case Format::SOP2: {
uint32_t encoding = (0b10 << 30);
encoding |= opcode << 23;
encoding |= !instr->definitions.empty() ? instr->definitions[0].physReg() << 16 : 0;
encoding |= instr->operands.size() >= 2 ? instr->operands[1].physReg() << 8 : 0;
encoding |= !instr->operands.empty() ? instr->operands[0].physReg() : 0;
out.push_back(encoding);
break;
}
case Format::SOPK: {
SOPK_instruction *sopk = static_cast<SOPK_instruction*>(instr);
if (instr->opcode == aco_opcode::s_subvector_loop_begin) {
assert(ctx.chip_class >= GFX10);
assert(ctx.subvector_begin_pos == -1);
ctx.subvector_begin_pos = out.size();
} else if (instr->opcode == aco_opcode::s_subvector_loop_end) {
assert(ctx.chip_class >= GFX10);
assert(ctx.subvector_begin_pos != -1);
/* Adjust s_subvector_loop_begin instruction to the address after the end */
out[ctx.subvector_begin_pos] |= (out.size() - ctx.subvector_begin_pos);
/* Adjust s_subvector_loop_end instruction to the address after the beginning */
sopk->imm = (uint16_t)(ctx.subvector_begin_pos - (int)out.size());
ctx.subvector_begin_pos = -1;
}
uint32_t encoding = (0b1011 << 28);
encoding |= opcode << 23;
encoding |=
!instr->definitions.empty() && !(instr->definitions[0].physReg() == scc) ?
instr->definitions[0].physReg() << 16 :
!instr->operands.empty() && instr->operands[0].physReg() <= 127 ?
instr->operands[0].physReg() << 16 : 0;
encoding |= sopk->imm;
out.push_back(encoding);
break;
}
case Format::SOP1: {
uint32_t encoding = (0b101111101 << 23);
if (opcode >= 55 && ctx.chip_class <= GFX9) {
assert(ctx.chip_class == GFX9 && opcode < 60);
opcode = opcode - 4;
}
encoding |= !instr->definitions.empty() ? instr->definitions[0].physReg() << 16 : 0;
encoding |= opcode << 8;
encoding |= !instr->operands.empty() ? instr->operands[0].physReg() : 0;
out.push_back(encoding);
break;
}
case Format::SOPC: {
uint32_t encoding = (0b101111110 << 23);
encoding |= opcode << 16;
encoding |= instr->operands.size() == 2 ? instr->operands[1].physReg() << 8 : 0;
encoding |= !instr->operands.empty() ? instr->operands[0].physReg() : 0;
out.push_back(encoding);
break;
}
case Format::SOPP: {
SOPP_instruction* sopp = static_cast<SOPP_instruction*>(instr);
uint32_t encoding = (0b101111111 << 23);
encoding |= opcode << 16;
encoding |= (uint16_t) sopp->imm;
if (sopp->block != -1)
ctx.branches.emplace_back(out.size(), sopp);
out.push_back(encoding);
break;
}
case Format::SMEM: {
SMEM_instruction* smem = static_cast<SMEM_instruction*>(instr);
bool soe = instr->operands.size() >= (!instr->definitions.empty() ? 3 : 4);
bool is_load = !instr->definitions.empty();
uint32_t encoding = 0;
if (ctx.chip_class <= GFX7) {
encoding = (0b11000 << 27);
encoding |= opcode << 22;
encoding |= instr->definitions.size() ? instr->definitions[0].physReg() << 15 : 0;
encoding |= instr->operands.size() ? (instr->operands[0].physReg() >> 1) << 9 : 0;
if (instr->operands.size() >= 2) {
if (!instr->operands[1].isConstant() || instr->operands[1].constantValue() >= 1024) {
encoding |= instr->operands[1].physReg().reg;
} else {
encoding |= instr->operands[1].constantValue() >> 2;
encoding |= 1 << 8;
}
}
out.push_back(encoding);
/* SMRD instructions can take a literal on GFX6 & GFX7 */
if (instr->operands.size() >= 2 && instr->operands[1].isConstant() && instr->operands[1].constantValue() >= 1024)
out.push_back(instr->operands[1].constantValue() >> 2);
return;
}
if (ctx.chip_class <= GFX9) {
encoding = (0b110000 << 26);
assert(!smem->dlc); /* Device-level coherent is not supported on GFX9 and lower */
encoding |= smem->nv ? 1 << 15 : 0;
} else {
encoding = (0b111101 << 26);
assert(!smem->nv); /* Non-volatile is not supported on GFX10 */
encoding |= smem->dlc ? 1 << 14 : 0;
}
encoding |= opcode << 18;
encoding |= smem->glc ? 1 << 16 : 0;
if (ctx.chip_class <= GFX9) {
if (instr->operands.size() >= 2)
encoding |= instr->operands[1].isConstant() ? 1 << 17 : 0; /* IMM - immediate enable */
}
if (ctx.chip_class == GFX9) {
encoding |= soe ? 1 << 14 : 0;
}
if (is_load || instr->operands.size() >= 3) { /* SDATA */
encoding |= (is_load ? instr->definitions[0].physReg() : instr->operands[2].physReg()) << 6;
}
if (instr->operands.size() >= 1) { /* SBASE */
encoding |= instr->operands[0].physReg() >> 1;
}
out.push_back(encoding);
encoding = 0;
int32_t offset = 0;
uint32_t soffset = ctx.chip_class >= GFX10
? sgpr_null /* On GFX10 this is disabled by specifying SGPR_NULL */
: 0; /* On GFX9, it is disabled by the SOE bit (and it's not present on GFX8 and below) */
if (instr->operands.size() >= 2) {
const Operand &op_off1 = instr->operands[1];
if (ctx.chip_class <= GFX9) {
offset = op_off1.isConstant() ? op_off1.constantValue() : op_off1.physReg();
} else {
/* GFX10 only supports constants in OFFSET, so put the operand in SOFFSET if it's an SGPR */
if (op_off1.isConstant()) {
offset = op_off1.constantValue();
} else {
soffset = op_off1.physReg();
assert(!soe); /* There is no place to put the other SGPR offset, if any */
}
}
if (soe) {
const Operand &op_off2 = instr->operands.back();
assert(ctx.chip_class >= GFX9); /* GFX8 and below don't support specifying a constant and an SGPR at the same time */
assert(!op_off2.isConstant());
soffset = op_off2.physReg();
}
}
encoding |= offset;
encoding |= soffset << 25;
out.push_back(encoding);
return;
}
case Format::VOP2: {
uint32_t encoding = 0;
encoding |= opcode << 25;
encoding |= (0xFF & instr->definitions[0].physReg()) << 17;
encoding |= (0xFF & instr->operands[1].physReg()) << 9;
encoding |= instr->operands[0].physReg();
out.push_back(encoding);
break;
}
case Format::VOP1: {
uint32_t encoding = (0b0111111 << 25);
if (!instr->definitions.empty())
encoding |= (0xFF & instr->definitions[0].physReg()) << 17;
encoding |= opcode << 9;
if (!instr->operands.empty())
encoding |= instr->operands[0].physReg();
out.push_back(encoding);
break;
}
case Format::VOPC: {
uint32_t encoding = (0b0111110 << 25);
encoding |= opcode << 17;
encoding |= (0xFF & instr->operands[1].physReg()) << 9;
encoding |= instr->operands[0].physReg();
out.push_back(encoding);
break;
}
case Format::VINTRP: {
Interp_instruction* interp = static_cast<Interp_instruction*>(instr);
uint32_t encoding = 0;
if (ctx.chip_class == GFX8 || ctx.chip_class == GFX9) {
encoding = (0b110101 << 26); /* Vega ISA doc says 110010 but it's wrong */
} else {
encoding = (0b110010 << 26);
}
assert(encoding);
encoding |= (0xFF & instr->definitions[0].physReg()) << 18;
encoding |= opcode << 16;
encoding |= interp->attribute << 10;
encoding |= interp->component << 8;
if (instr->opcode == aco_opcode::v_interp_mov_f32)
encoding |= (0x3 & instr->operands[0].constantValue());
else
encoding |= (0xFF & instr->operands[0].physReg());
out.push_back(encoding);
break;
}
case Format::DS: {
DS_instruction* ds = static_cast<DS_instruction*>(instr);
uint32_t encoding = (0b110110 << 26);
if (ctx.chip_class == GFX8 || ctx.chip_class == GFX9) {
encoding |= opcode << 17;
encoding |= (ds->gds ? 1 : 0) << 16;
} else {
encoding |= opcode << 18;
encoding |= (ds->gds ? 1 : 0) << 17;
}
encoding |= ((0xFF & ds->offset1) << 8);
encoding |= (0xFFFF & ds->offset0);
out.push_back(encoding);
encoding = 0;
unsigned reg = !instr->definitions.empty() ? instr->definitions[0].physReg() : 0;
encoding |= (0xFF & reg) << 24;
reg = instr->operands.size() >= 3 && !(instr->operands[2].physReg() == m0) ? instr->operands[2].physReg() : 0;
encoding |= (0xFF & reg) << 16;
reg = instr->operands.size() >= 2 && !(instr->operands[1].physReg() == m0) ? instr->operands[1].physReg() : 0;
encoding |= (0xFF & reg) << 8;
encoding |= (0xFF & instr->operands[0].physReg());
out.push_back(encoding);
break;
}
case Format::MUBUF: {
MUBUF_instruction* mubuf = static_cast<MUBUF_instruction*>(instr);
uint32_t encoding = (0b111000 << 26);
encoding |= opcode << 18;
encoding |= (mubuf->lds ? 1 : 0) << 16;
encoding |= (mubuf->glc ? 1 : 0) << 14;
encoding |= (mubuf->idxen ? 1 : 0) << 13;
assert(!mubuf->addr64 || ctx.chip_class <= GFX7);
if (ctx.chip_class == GFX6 || ctx.chip_class == GFX7)
encoding |= (mubuf->addr64 ? 1 : 0) << 15;
encoding |= (mubuf->offen ? 1 : 0) << 12;
if (ctx.chip_class == GFX8 || ctx.chip_class == GFX9) {
assert(!mubuf->dlc); /* Device-level coherent is not supported on GFX9 and lower */
encoding |= (mubuf->slc ? 1 : 0) << 17;
} else if (ctx.chip_class >= GFX10) {
encoding |= (mubuf->dlc ? 1 : 0) << 15;
}
encoding |= 0x0FFF & mubuf->offset;
out.push_back(encoding);
encoding = 0;
if (ctx.chip_class <= GFX7 || ctx.chip_class >= GFX10) {
encoding |= (mubuf->slc ? 1 : 0) << 22;
}
encoding |= instr->operands[2].physReg() << 24;
encoding |= (mubuf->tfe ? 1 : 0) << 23;
encoding |= (instr->operands[0].physReg() >> 2) << 16;
unsigned reg = instr->operands.size() > 3 ? instr->operands[3].physReg() : instr->definitions[0].physReg();
encoding |= (0xFF & reg) << 8;
encoding |= (0xFF & instr->operands[1].physReg());
out.push_back(encoding);
break;
}
case Format::MTBUF: {
MTBUF_instruction* mtbuf = static_cast<MTBUF_instruction*>(instr);
uint32_t img_format = ac_get_tbuffer_format(ctx.chip_class, mtbuf->dfmt, mtbuf->nfmt);
uint32_t encoding = (0b111010 << 26);
assert(img_format <= 0x7F);
assert(!mtbuf->dlc || ctx.chip_class >= GFX10);
encoding |= (mtbuf->dlc ? 1 : 0) << 15; /* DLC bit replaces one bit of the OPCODE on GFX10 */
encoding |= (mtbuf->glc ? 1 : 0) << 14;
encoding |= (mtbuf->idxen ? 1 : 0) << 13;
encoding |= (mtbuf->offen ? 1 : 0) << 12;
encoding |= 0x0FFF & mtbuf->offset;
encoding |= (img_format << 19); /* Handles both the GFX10 FORMAT and the old NFMT+DFMT */
if (ctx.chip_class == GFX8 || ctx.chip_class == GFX9) {
encoding |= opcode << 15;
} else {
encoding |= (opcode & 0x07) << 16; /* 3 LSBs of 4-bit OPCODE */
}
out.push_back(encoding);
encoding = 0;
encoding |= instr->operands[2].physReg() << 24;
encoding |= (mtbuf->tfe ? 1 : 0) << 23;
encoding |= (mtbuf->slc ? 1 : 0) << 22;
encoding |= (instr->operands[0].physReg() >> 2) << 16;
unsigned reg = instr->operands.size() > 3 ? instr->operands[3].physReg() : instr->definitions[0].physReg();
encoding |= (0xFF & reg) << 8;
encoding |= (0xFF & instr->operands[1].physReg());
if (ctx.chip_class >= GFX10) {
encoding |= (((opcode & 0x08) >> 4) << 21); /* MSB of 4-bit OPCODE */
}
out.push_back(encoding);
break;
}
case Format::MIMG: {
MIMG_instruction* mimg = static_cast<MIMG_instruction*>(instr);
uint32_t encoding = (0b111100 << 26);
encoding |= mimg->slc ? 1 << 25 : 0;
encoding |= opcode << 18;
encoding |= mimg->lwe ? 1 << 17 : 0;
encoding |= mimg->tfe ? 1 << 16 : 0;
encoding |= mimg->glc ? 1 << 13 : 0;
encoding |= mimg->unrm ? 1 << 12 : 0;
if (ctx.chip_class <= GFX9) {
assert(!mimg->dlc); /* Device-level coherent is not supported on GFX9 and lower */
assert(!mimg->r128);
encoding |= mimg->a16 ? 1 << 15 : 0;
encoding |= mimg->da ? 1 << 14 : 0;
} else {
encoding |= mimg->r128 ? 1 << 15 : 0; /* GFX10: A16 moved to 2nd word, R128 replaces it in 1st word */
encoding |= mimg->dim << 3; /* GFX10: dimensionality instead of declare array */
encoding |= mimg->dlc ? 1 << 7 : 0;
}
encoding |= (0xF & mimg->dmask) << 8;
out.push_back(encoding);
encoding = (0xFF & instr->operands[2].physReg()); /* VADDR */
if (!instr->definitions.empty()) {
encoding |= (0xFF & instr->definitions[0].physReg()) << 8; /* VDATA */
} else if (instr->operands[1].regClass().type() == RegType::vgpr) {
encoding |= (0xFF & instr->operands[1].physReg()) << 8; /* VDATA */
}
encoding |= (0x1F & (instr->operands[0].physReg() >> 2)) << 16; /* T# (resource) */
if (instr->operands[1].regClass().type() == RegType::sgpr)
encoding |= (0x1F & (instr->operands[1].physReg() >> 2)) << 21; /* sampler */
assert(!mimg->d16 || ctx.chip_class >= GFX9);
encoding |= mimg->d16 ? 1 << 15 : 0;
if (ctx.chip_class >= GFX10) {
encoding |= mimg->a16 ? 1 << 14 : 0; /* GFX10: A16 still exists, but is in a different place */
}
out.push_back(encoding);
break;
}
case Format::FLAT:
case Format::SCRATCH:
case Format::GLOBAL: {
FLAT_instruction *flat = static_cast<FLAT_instruction*>(instr);
uint32_t encoding = (0b110111 << 26);
encoding |= opcode << 18;
if (ctx.chip_class <= GFX9) {
assert(flat->offset <= 0x1fff);
encoding |= flat->offset & 0x1fff;
} else if (instr->format == Format::FLAT) {
/* GFX10 has a 12-bit immediate OFFSET field,
* but it has a hw bug: it ignores the offset, called FlatSegmentOffsetBug
*/
assert(flat->offset == 0);
} else {
assert(flat->offset <= 0xfff);
encoding |= flat->offset & 0xfff;
}
if (instr->format == Format::SCRATCH)
encoding |= 1 << 14;
else if (instr->format == Format::GLOBAL)
encoding |= 2 << 14;
encoding |= flat->lds ? 1 << 13 : 0;
encoding |= flat->glc ? 1 << 16 : 0;
encoding |= flat->slc ? 1 << 17 : 0;
if (ctx.chip_class >= GFX10) {
assert(!flat->nv);
encoding |= flat->dlc ? 1 << 12 : 0;
} else {
assert(!flat->dlc);
}
out.push_back(encoding);
encoding = (0xFF & instr->operands[0].physReg());
if (!instr->definitions.empty())
encoding |= (0xFF & instr->definitions[0].physReg()) << 24;
if (instr->operands.size() >= 3)
encoding |= (0xFF & instr->operands[2].physReg()) << 8;
if (!instr->operands[1].isUndefined()) {
assert(ctx.chip_class >= GFX10 || instr->operands[1].physReg() != 0x7F);
assert(instr->format != Format::FLAT);
encoding |= instr->operands[1].physReg() << 16;
} else if (instr->format != Format::FLAT || ctx.chip_class >= GFX10) { /* SADDR is actually used with FLAT on GFX10 */
if (ctx.chip_class <= GFX9)
encoding |= 0x7F << 16;
else
encoding |= sgpr_null << 16;
}
encoding |= flat->nv ? 1 << 23 : 0;
out.push_back(encoding);
break;
}
case Format::EXP: {
Export_instruction* exp = static_cast<Export_instruction*>(instr);
uint32_t encoding;
if (ctx.chip_class == GFX8 || ctx.chip_class == GFX9) {
encoding = (0b110001 << 26);
} else {
encoding = (0b111110 << 26);
}
encoding |= exp->valid_mask ? 0b1 << 12 : 0;
encoding |= exp->done ? 0b1 << 11 : 0;
encoding |= exp->compressed ? 0b1 << 10 : 0;
encoding |= exp->dest << 4;
encoding |= exp->enabled_mask;
out.push_back(encoding);
encoding = 0xFF & exp->operands[0].physReg();
encoding |= (0xFF & exp->operands[1].physReg()) << 8;
encoding |= (0xFF & exp->operands[2].physReg()) << 16;
encoding |= (0xFF & exp->operands[3].physReg()) << 24;
out.push_back(encoding);
break;
}
case Format::PSEUDO:
case Format::PSEUDO_BARRIER:
unreachable("Pseudo instructions should be lowered before assembly.");
default:
if ((uint16_t) instr->format & (uint16_t) Format::VOP3A) {
VOP3A_instruction* vop3 = static_cast<VOP3A_instruction*>(instr);
if ((uint16_t) instr->format & (uint16_t) Format::VOP2) {
opcode = opcode + 0x100;
} else if ((uint16_t) instr->format & (uint16_t) Format::VOP1) {
if (ctx.chip_class == GFX8 || ctx.chip_class == GFX9)
opcode = opcode + 0x140;
else
opcode = opcode + 0x180;
} else if ((uint16_t) instr->format & (uint16_t) Format::VOPC) {
opcode = opcode + 0x0;
} else if ((uint16_t) instr->format & (uint16_t) Format::VINTRP) {
opcode = opcode + 0x270;
}
uint32_t encoding;
if (ctx.chip_class <= GFX9) {
encoding = (0b110100 << 26);
} else if (ctx.chip_class == GFX10) {
encoding = (0b110101 << 26);
} else {
unreachable("Unknown chip_class.");
}
if (ctx.chip_class <= GFX7) {
encoding |= opcode << 17;
encoding |= (vop3->clamp ? 1 : 0) << 11;
} else {
encoding |= opcode << 16;
encoding |= (vop3->clamp ? 1 : 0) << 15;
}
encoding |= vop3->opsel << 11;
for (unsigned i = 0; i < 3; i++)
encoding |= vop3->abs[i] << (8+i);
if (instr->definitions.size() == 2)
encoding |= instr->definitions[1].physReg() << 8;
encoding |= (0xFF & instr->definitions[0].physReg());
out.push_back(encoding);
encoding = 0;
if (instr->opcode == aco_opcode::v_interp_mov_f32) {
encoding = 0x3 & instr->operands[0].constantValue();
} else {
for (unsigned i = 0; i < instr->operands.size(); i++)
encoding |= instr->operands[i].physReg() << (i * 9);
}
encoding |= vop3->omod << 27;
for (unsigned i = 0; i < 3; i++)
encoding |= vop3->neg[i] << (29+i);
out.push_back(encoding);
} else if (instr->isDPP()){
assert(ctx.chip_class >= GFX8);
/* first emit the instruction without the DPP operand */
Operand dpp_op = instr->operands[0];
instr->operands[0] = Operand(PhysReg{250}, v1);
instr->format = (Format) ((uint32_t) instr->format & ~(1 << 14));
emit_instruction(ctx, out, instr);
DPP_instruction* dpp = static_cast<DPP_instruction*>(instr);
uint32_t encoding = (0xF & dpp->row_mask) << 28;
encoding |= (0xF & dpp->bank_mask) << 24;
encoding |= dpp->abs[1] << 23;
encoding |= dpp->neg[1] << 22;
encoding |= dpp->abs[0] << 21;
encoding |= dpp->neg[0] << 20;
encoding |= dpp->bound_ctrl << 19;
encoding |= dpp->dpp_ctrl << 8;
encoding |= (0xFF) & dpp_op.physReg();
out.push_back(encoding);
return;
} else {
unreachable("unimplemented instruction format");
}
break;
}
/* append literal dword */
for (const Operand& op : instr->operands) {
if (op.isLiteral()) {
out.push_back(op.constantValue());
break;
}
}
}
void emit_block(asm_context& ctx, std::vector<uint32_t>& out, Block& block)
{
for (aco_ptr<Instruction>& instr : block.instructions) {
#if 0
int start_idx = out.size();
std::cerr << "Encoding:\t" << std::endl;
aco_print_instr(&*instr, stderr);
std::cerr << std::endl;
#endif
emit_instruction(ctx, out, instr.get());
#if 0
for (int i = start_idx; i < out.size(); i++)
std::cerr << "encoding: " << "0x" << std::setfill('0') << std::setw(8) << std::hex << out[i] << std::endl;
#endif
}
}
void fix_exports(asm_context& ctx, std::vector<uint32_t>& out, Program* program)
{
for (Block& block : program->blocks) {
if (!(block.kind & block_kind_export_end))
continue;
std::vector<aco_ptr<Instruction>>::reverse_iterator it = block.instructions.rbegin();
bool exported = false;
while ( it != block.instructions.rend())
{
if ((*it)->format == Format::EXP) {
Export_instruction* exp = static_cast<Export_instruction*>((*it).get());
if (program->stage & hw_vs) {
if (exp->dest >= V_008DFC_SQ_EXP_POS && exp->dest <= (V_008DFC_SQ_EXP_POS + 3)) {
exp->done = true;
exported = true;
break;
}
} else {
exp->done = true;
exp->valid_mask = true;
exported = true;
break;
}
} else if ((*it)->definitions.size() && (*it)->definitions[0].physReg() == exec)
break;
++it;
}
if (exported)
continue;
/* we didn't find an Export instruction and have to insert a null export */
aco_ptr<Export_instruction> exp{create_instruction<Export_instruction>(aco_opcode::exp, Format::EXP, 4, 0)};
for (unsigned i = 0; i < 4; i++)
exp->operands[i] = Operand(v1);
exp->enabled_mask = 0;
exp->compressed = false;
exp->done = true;
exp->valid_mask = (program->stage & hw_fs) || program->chip_class >= GFX10;
if (program->stage & hw_fs)
exp->dest = 9; /* NULL */
else
exp->dest = V_008DFC_SQ_EXP_POS;
/* insert the null export 1 instruction before branch/endpgm */
block.instructions.insert(block.instructions.end() - 1, std::move(exp));
}
}
static void fix_branches_gfx10(asm_context& ctx, std::vector<uint32_t>& out)
{
/* Branches with an offset of 0x3f are buggy on GFX10, we workaround by inserting NOPs if needed. */
bool gfx10_3f_bug = false;
do {
auto buggy_branch_it = std::find_if(ctx.branches.begin(), ctx.branches.end(), [&ctx](const auto &branch) -> bool {
return ((int)ctx.program->blocks[branch.second->block].offset - branch.first - 1) == 0x3f;
});
gfx10_3f_bug = buggy_branch_it != ctx.branches.end();
if (gfx10_3f_bug) {
/* Insert an s_nop after the branch */
constexpr uint32_t s_nop_0 = 0xbf800000u;
int s_nop_pos = buggy_branch_it->first + 1;
auto out_pos = std::next(out.begin(), s_nop_pos);
out.insert(out_pos, s_nop_0);
/* Update the offset of each affected block */
for (Block& block : ctx.program->blocks) {
if (block.offset > (unsigned)buggy_branch_it->first)
block.offset++;
}
/* Update the branches following the current one */
for (auto branch_it = std::next(buggy_branch_it); branch_it != ctx.branches.end(); ++branch_it)
branch_it->first++;
/* Find first constant address after the inserted instruction */
auto caddr_it = std::find_if(ctx.constaddrs.begin(), ctx.constaddrs.end(), [s_nop_pos](const int &caddr_pos) -> bool {
return caddr_pos >= s_nop_pos;
});
/* Update the locations of constant addresses */
for (; caddr_it != ctx.constaddrs.end(); ++caddr_it)
(*caddr_it)++;
}
} while (gfx10_3f_bug);
}
void fix_branches(asm_context& ctx, std::vector<uint32_t>& out)
{
if (ctx.chip_class >= GFX10)
fix_branches_gfx10(ctx, out);
for (std::pair<int, SOPP_instruction*> &branch : ctx.branches) {
int offset = (int)ctx.program->blocks[branch.second->block].offset - branch.first - 1;
out[branch.first] |= (uint16_t) offset;
}
}
void fix_constaddrs(asm_context& ctx, std::vector<uint32_t>& out)
{
for (unsigned addr : ctx.constaddrs)
out[addr] += (out.size() - addr + 1u) * 4u;
}
unsigned emit_program(Program* program,
std::vector<uint32_t>& code)
{
asm_context ctx(program);
if (program->stage & (hw_vs | hw_fs))
fix_exports(ctx, code, program);
for (Block& block : program->blocks) {
block.offset = code.size();
emit_block(ctx, code, block);
}
fix_branches(ctx, code);
unsigned exec_size = code.size() * sizeof(uint32_t);
if (program->chip_class >= GFX10) {
/* Pad output with s_code_end so instruction prefetching doesn't cause
* page faults */
unsigned final_size = align(code.size() + 3 * 16, 16);
while (code.size() < final_size)
code.push_back(0xbf9f0000u);
}
fix_constaddrs(ctx, code);
while (program->constant_data.size() % 4u)
program->constant_data.push_back(0);
/* Copy constant data */
code.insert(code.end(), (uint32_t*)program->constant_data.data(),
(uint32_t*)(program->constant_data.data() + program->constant_data.size()));
return exec_size;
}
}
| [
"jsg@openbsd.org"
] | jsg@openbsd.org |
bea2fc725b9d7a5f31b4a9ba56b86ba1e9cc56ce | 733986c05f779dcbc1874ef15500550d23cf719f | /git/grafos/main.cpp | 1175bf9dca7ac47840f8ca3d2e8f72a886bc81f1 | [] | no_license | eduardodsaraujo/grafos | a66af478abed603ce7b9332b7c3a3ac621a70528 | 8f5a2b721a2adb4ddee15404c7ddc51898b36ef9 | refs/heads/master | 2020-07-14T09:36:44.453048 | 2019-11-24T02:13:12 | 2019-11-24T02:13:12 | 205,293,282 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 10,995 | cpp | #include "Matriz.h"
#include "Matriz.cpp"
#include "Lista.h"
#include "Lista.cpp"
#include <omp.h>
#include <stdio.h>
#include <time.h>
#include <iostream>
#include <string>
#include <sstream>
using namespace std;
//true = entrada manual. false = pega pelas const abaixo
const bool inOverride = false;
const bool log = false;
const bool runBFS = true;
const bool runDFS = false;
//nome do arquivo padrão
const string arquivoDefault = "as_graph";
// const string arquivoDefault = "dblp";
// const string arquivoDefault = "live_journal";
//1 = matriz, 2 = lista, qualquer outra coisa = pula direto para as calcular as componentes
const string estruturaDefault = "2";
//1 para paralelizar o carregamento de matriz em memória, 2 para rodar uma bfs em cada thread, qualquer outra coisa para rodar single
// OBSERVAÇÕES: PARA UM LOG PRECISO, UTILIZAR 1 (Paralelizar apenas o carregamento de matriz)
// CAUTION: CADA BFS IRÁ ALOCAR SEU PRÓPRIO ESPAÇO EM MEMÓRIA!
const string ompDefault = "2";
//1 para calcular as componentes conexas, qualquer outra coisa para fechar direto
const string componentesDefault = "2";
//1 para calcular o diâmetro, qualquer outra coisa para fechar direto
const string diametroDefault = "2";
//Vértice mínimo para iniciar as BFS/DFS
const int vMin = 1;
//Vértice máximo para iniciar as BFS/DFS
const int vMax = 32;
int main()
{
//Define o arquivo de entrada
string inputFile;
if (inOverride == true)
{
cout << "Insira o nome do arquivo: ";
cin >> inputFile;
}
else
{
inputFile = arquivoDefault;
}
//Define o tipo de estrutura a ser utilizado
string estrutura;
if (inOverride == true)
{
cout << "Digite o tipo de estrutura a ser utilizado - 1 para matriz, 2 para lista, e qualquer outra tecla para pular: ";
cin >> estrutura;
}
else
{
estrutura = estruturaDefault;
}
//Define as opções de paralelização
string ompSettings;
if (inOverride == true)
{
if (estrutura == "1")
{
cout << "Digite a parte a ser paralelizada - 1 para o carregamento da matriz e 2 para as BFS/DFS: ";
cin >> ompSettings;
}
else
{
cout << "Digite 1 para rodar em single-thread e 2 para rodar em paralelo: ";
cin >> ompSettings;
}
}
else
{
ompSettings = ompDefault;
}
ofstream openTime;
openTime.open("run_log.txt");
clock_t tOpen = clock();
if ((runBFS == true) or (runDFS == true))
{
//Caso o usuário escolha MATRIZ:
if (estrutura == "1")
{
clock_t tInicio = clock();
//Carrega a matriz em memória
Matriz matriz;
if (ompSettings == "1")
{
matriz.carregar(inputFile, ompSettings);
}
//Inicia o timer
ofstream executionTime;
executionTime.open((inputFile+"_log_matrizAdj.txt").c_str());
executionTime << "Tempo para iniciar o vetor: " << (clock() - tInicio)/(CLOCKS_PER_SEC/1000) << " ms" << endl;
//BFS e DFS para cada ponto. Roda em paralelo caso seja escolhida a opção 2
#pragma omp parallel for if (ompSettings == "2")
for (int i = vMin; i <= vMax; i++)
{
if (ompSettings == "1")
{
std::ostringstream nomeSaida;
nomeSaida << i; //Dá cast para string
//BFS
if (runBFS == true)
{
tInicio = clock();
// cout << "Iniciando a BFS em matriz com inicio no vertice " << i << endl;
matriz.BFS(i, (inputFile+"_DFS_MatrizAdj_"+nomeSaida.str()).c_str(), log);
executionTime << "Tempo para rodar a BFS a partir do vértice " << i << ": " << (clock() - tInicio)/(CLOCKS_PER_SEC/1000) << " ms" << endl;
if (log == true)
{
matriz.geraEstatisticas((inputFile+"_BFS_"+nomeSaida.str()).c_str());
}
}
//DFS
if (runDFS == true)
{
tInicio = clock();
// cout << "Iniciando a DFS em matriz com inicio no vertice " << i << endl;
matriz.DFS(i, (inputFile+"_DFS_MatrizAdj_"+nomeSaida.str()).c_str(), log);
executionTime << "Tempo para rodar a DFS a partir do vértice " << i << ": " << (clock() - tInicio)/(CLOCKS_PER_SEC/1000) << " ms" << endl;
if (log == true)
{
matriz.geraEstatisticas((inputFile+"_DFS_"+nomeSaida.str()).c_str());
}
}
}
else
{
std::ostringstream nomeSaida;
nomeSaida << i; //Dá cast para string
//Inicializa uma matriz interno
//TODO: Criar uma classe SÓ PARA A MATRIZ, para poder compartilhar
Matriz matrizInt;
matrizInt.carregar(inputFile, ompSettings);
//BFS
if (runBFS == true)
{
tInicio = clock();
// cout << "Iniciando a BFS em matriz com inicio no vertice " << i << endl;
matrizInt.BFS(i, (inputFile+"_BFS_MatrizAdj_"+nomeSaida.str()).c_str(), log);
executionTime << "Tempo para rodar a BFS a partir do vértice " << i << ": " << (clock() - tInicio)/(CLOCKS_PER_SEC/1000) << " ms" << endl;
if (log == true)
{
matrizInt.geraEstatisticas((inputFile+"_BFS_"+nomeSaida.str()).c_str());
}
}
//DFS
if (runDFS == true)
{
tInicio = clock();
// cout << "Iniciando a DFS em matriz com inicio no vertice " << i << endl;
matrizInt.DFS(i, (inputFile+"_DFS_MatrizAdj_"+nomeSaida.str()).c_str(), log);
executionTime << "Tempo para rodar a BFS a partir do vértice " << i << ": " << (clock() - tInicio)/(CLOCKS_PER_SEC/1000) << " ms" << endl;
if (log == true)
{
matrizInt.geraEstatisticas((inputFile+"_DFS_"+nomeSaida.str()).c_str());
}
}
}
}
executionTime.close(); //Finaliza o timer
}
//Caso o usuário escolha LISTA
else if (estrutura == "2")
{
clock_t tInicio = clock();
//Carrega a matriz em memória
Lista lista;
if (ompSettings == "1")
{
lista.carregar(inputFile);
}
//Inicia o timer
ofstream executionTime;
executionTime.open((inputFile+"_log_listaAdj.txt").c_str());
executionTime << "Tempo para iniciar o vetor: " << (clock() - tInicio)/(CLOCKS_PER_SEC/1000) << " ms" << endl;
tInicio = clock();
//BFS e DFS para cada ponto. Roda em paralelo caso seja escolhida a opção 2
#pragma omp parallel for if (ompSettings == "2")
for (int i = vMin; i <= vMax; i++)
{
if (ompSettings == "1")
{
std::ostringstream nomeSaida;
nomeSaida << i; //Dá cast para string
//BFS
if (runBFS == true)
{
tInicio = clock();
// cout << "Iniciando a BFS em lista com inicio no vertice " << i << endl;
lista.BFS(i, (inputFile+"_BFS_ListaAdj_"+nomeSaida.str()).c_str(), log);
executionTime << "Tempo para rodar a BFS a partir do vértice " << i << ": " << (clock() - tInicio)/(CLOCKS_PER_SEC/1000) << " ms" << endl;
if (log == true)
{
lista.geraEstatisticas((inputFile+"_BFS_"+nomeSaida.str()).c_str());
}
}
//DFS
if (runDFS == true)
{
tInicio = clock();
// cout << "Iniciando a DFS em lista com inicio no vertice " << i << endl;
lista.DFS(i, (inputFile+"_DFS_ListaAdj_"+nomeSaida.str()).c_str(), log);
executionTime << "Tempo para rodar a DFS a partir do vértice " << i << ": " << (clock() - tInicio)/(CLOCKS_PER_SEC/1000) << " ms" << endl;
if (log == true)
{
lista.geraEstatisticas((inputFile+"_DFS_"+nomeSaida.str()).c_str());
}
}
}
else
{
std::ostringstream nomeSaida;
nomeSaida << i; //Dá cast para string
//Inicializa uma matriz interno
//TODO: Criar uma classe SÓ PARA A MATRIZ, para poder compartilhar
Lista listaInt;
listaInt.carregar(inputFile);
//BFS
if (runBFS == true)
{
tInicio = clock();
// cout << "Iniciando a BFS em lista com inicio no vertice " << i << endl;
listaInt.BFS(i, (inputFile+"_BFS_ListaAdj_"+nomeSaida.str()).c_str(), log);
executionTime << "Tempo para rodar a BFS a partir do vértice " << i << ": " << (clock() - tInicio)/(CLOCKS_PER_SEC/1000) << " ms" << endl;
if (log == true)
{
listaInt.geraEstatisticas((inputFile+"_BFS_"+nomeSaida.str()).c_str());
}
}
//DFS
if (runDFS == true)
{
tInicio = clock();
// cout << "Iniciando a DFS em lista com inicio no vertice " << i << endl;
listaInt.DFS(i, (inputFile+"_DFS_ListaAdj_"+nomeSaida.str()).c_str(), log);
executionTime << "Tempo para rodar a DFS a partir do vértice " << i << ": " << (clock() - tInicio)/(CLOCKS_PER_SEC/1000) << " ms" << endl;
if (log == true)
{
listaInt.geraEstatisticas((inputFile+"_DFS_"+nomeSaida.str()).c_str());
}
}
}
}
executionTime << "Tempo de execução: " << (clock() - tInicio)/(CLOCKS_PER_SEC/1000) << " ms" << endl;
executionTime.close(); //Finaliza o timer
}
}
openTime << "Tempo de execução: " << (clock() - tOpen)/(CLOCKS_PER_SEC/1000) << " ms" << endl;
//Define se irá ser feito cálculo de componentes
string calcularComponentes;
if (inOverride == true)
{
cout << "Deseja calcular a quantidade de componentes? Digite 1 para sim, e qualquer outra tecla para sair: ";
cin >> calcularComponentes;
}
else
{
calcularComponentes = componentesDefault;
}
//Caso inicie, inicia uma lista para calcular as componentes conexas
if(calcularComponentes == "1")
{
Lista lista;
lista.carregar(inputFile);
lista.componentes(inputFile);
}
//Define se irá ser feito cálculo de diâmetro
string calcularDiametro;
if (inOverride == true)
{
cout << "Deseja calcular o diâmetro? Digite 1 para sim, e qualquer outra tecla para sair: ";
cin >> calcularDiametro;
}
else
{
calcularDiametro = diametroDefault;
}
//Caso inicie, inicia uma lista para calcular as componentes conexas
if(calcularDiametro == "1")
{
Lista lista;
lista.carregar(inputFile);
lista.diametro(inputFile);
}
}
| [
"noreply@github.com"
] | noreply@github.com |
6547385828e7723c43d91735b0105c09bc1ec97a | f65b1f2af4c592fb64664c26418db82e934dbf6c | /Peripheral/Arduino/MEGA_W5500_FullInsp/include/UTIL.h | d41e2fe9d415e6a6be0a6582db703512bbe23b6d | [] | no_license | MDMTseng/visSele | b4b76c96e04635df18644202d883c544ea78f663 | e9f06b221698782ae32912f3c40b363a939f84f8 | refs/heads/master | 2023-07-19T20:43:40.841332 | 2021-06-18T09:43:48 | 2021-06-18T09:43:48 | 96,328,453 | 2 | 1 | null | 2022-12-12T02:21:02 | 2017-07-05T14:29:55 | C | UTF-8 | C++ | false | false | 3,913 | h | template <class T>
class mArray
{
protected:
int cur_size;
int max_size;
public:
T* arr;
mArray(int max_size=0)
{
RESET( max_size);
}
void RESET(int max_size)
{
cur_size=0;
if(arr)
delete(arr);
if(max_size<=0)
{
arr=NULL;
this->max_size=0;
return;
}
arr=new T[max_size];
this->max_size=max_size;
}
~mArray()
{
RESET(0);
}
bool push_back(T d)
{
if(!resize(size()+1))
{
return false;
}
arr[size()-1]=d;
return true;
}
bool resize(int _size)
{
if(_size<0)return false;
if(_size>max_size)return false;
cur_size=_size;
return true;
}
int size()
{
return cur_size;
}
int maxSize()
{
return max_size;
}
};
int16_t tempSamp(int idx, uint16_t targetLen , int16_t* temp, uint16_t tempL)
{
if (idx < 0)return 0;
int eq_idx = idx * tempL / targetLen;
if (eq_idx >= tempL)return 0;
return temp[eq_idx];
}
uint32_t tempSAD(int16_t* temp1, uint16_t temp1L, int16_t* temp2, uint16_t temp2L, int16_t NA_Thres = 3000, int *ret_NA_Count = NULL)
{
uint32_t diffSum = 0;
int NA_Count = 0;
for (int i = 0; i < temp1L; i++)
{
if (temp1[i] > NA_Thres)
{
NA_Count++;
continue;
}
int16_t tempV = tempSamp(i, temp1L, temp2, temp2L);
int16_t diff = temp1[i] - tempV;
if (diff < 0)diff = -diff;
diffSum += diff;
}
if (ret_NA_Count)*ret_NA_Count = NA_Count;
int divCount = (temp1L - NA_Count);
if (divCount == 0)
{
return NA_Thres;
}
return diffSum / divCount;
}
uint32_t tempSAD2(int16_t* temp1, uint16_t temp1L, int16_t* temp2, uint16_t temp2L, int16_t NA_Thres = 3000, int *ret_NA_Count = NULL)
{
if ( (temp1L < (temp2L * 2 / 3)) ||
(temp1L > (temp2L * 3 / 2)))
{
return -1;
}
uint32_t diffSum = 0;
const int tCacheSize = 3;
const int tCacheLen = tCacheSize * 2 + 1;
int16_t tCache[tCacheLen];
for (int i = 0; i < tCacheLen - 1; i++)
{
tCache[i] = tempSamp(i, temp1L, temp2, temp2L);
}
int tCacheHead = tCacheLen - 1;
int NA_Count = 0;
for (int i = tCacheSize; i < temp1L - tCacheSize; i++)
{
if (temp1[i] > NA_Thres)
{
NA_Count++;
continue;
}
int16_t tempV = tempSamp(i + tCacheSize, temp1L, temp2, temp2L);
tCache[tCacheHead] = tempV;
tCacheHead++;
if (tCacheHead >= tCacheLen)tCacheHead = 0;
int16_t minDiff = NA_Thres;
for (int j = 0; j < tCacheLen; j++)
{
int16_t diff = temp1[i] - tCache[j];
if (diff < 0)diff = -diff;
if (minDiff > diff)
{
minDiff = diff;
}
}
diffSum += minDiff;
}
if (ret_NA_Count)*ret_NA_Count = NA_Count;
int divCount = (temp1L - 2 * tCacheSize - NA_Count);
if (divCount == 0)
{
return NA_Thres;
}
return diffSum / divCount;
}
class buffered_print
{
char* buf;
int _capacity;
int _size;
public:
buffered_print(int len)
{
buf=new char[len];
_capacity=len;
_size=0;
resize(0);
}
int size()
{
return _size;
}
int capacity()
{
return _capacity;
}
int rest_capacity()
{
return _capacity-_size;
}
int resize(int size)
{
if(size>_capacity)
{
return -1;
}
_size=size;
buf[_size+1]='\0';
return 0;
}
char* buffer()
{
return buf;
}
char charAt(int idx)
{
if(idx>=0)
{
if(idx>=_size)
return '\0';
return buf[idx];
}
idx+=_size;
if(idx>=0)
{
if(idx>=_size)
return '\0';
return buf[idx];
}
return '\0';
}
int print(char *fmt, ...)
{
va_list argptr;
va_start(argptr,fmt);
// _size=snprintf(buf+_size,_capacity-_size,fmt,argptr);
_size=vsnprintf(buf+_size,_capacity-_size,fmt,argptr);
va_end(argptr);
return (_size==_capacity)?-1:0;
}
};
| [
"chiapintseng@gmail.com"
] | chiapintseng@gmail.com |
4ba5b8e001e845f70ce195c2c108ffb6f333d3be | 81da731d7d3cbe3cda9be86da9b1798285d1aefd | /Log/Log/log.h | 9d8c4994e2848384b1b28dd68815a31c75993ec7 | [] | no_license | Gavinee/algorithm | 9c2ad0ec73cb2b169aab1ea6ca9a6d460ca45854 | 395e124d10c83e6095a6eaba6af2297548d5ced6 | refs/heads/master | 2020-03-26T23:24:40.745956 | 2019-06-13T08:13:56 | 2019-06-13T08:13:56 | 145,540,172 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 977 | h | #ifndef LOG_H
#define LOG_H
#include <QFile>
#include <QMutex>
#include <QDateTime>
#include <QTextStream>
#include <stdio.h>
#include "log_global.h"
#define LOG_IDENTIFIER "_Log.html"
#define LOG_INFO 0
#define LOG_WARNING 1
#define LOG_ERROR 2
#define DETAIL_INFO QString::fromLocal8Bit("<.%1>@%2=>%3: ").arg(__FILE__).arg(__FUNCTION__);
#define LOGERROR(_log) Log::getInstance()->writeLog(_log,DETAIL_INFO,LOG_ERROR)
#define LOGINFO(_log) Log::getInstance()->writeLog(_log,DETAIL_INFO,LOG_INFO)
#define LOGWARNING(_log) Log::getInstance()->writeLog(_log,DETAIL_INFO,LOG_WARNING)
class LOGSHARED_EXPORT Log
{
private:
Log();
static Log* m_instance;
public:
~Log();
static Log* getInstance();
void writeLog(QString _log,QString _details = "",int _flag = LOG_INFO);
private:
void openNewLog();
void endLog();
private:
QFile m_log;
QMutex m_mutex;
QTextStream m_stream;
int m_index;
};
#endif // LOG_H
| [
"noreply@github.com"
] | noreply@github.com |
ba9b41ee9173ce383b753e41029694753047fc72 | f57a39f2f7557272784860b24cb2f05533afc847 | /src/ScriptFunctions.cpp | 88e93aed54a885fb61a64b99dace301caf30eb02 | [] | no_license | stephenlombardi/slib | 903af62989c26f73d66bc16e57343ae6d77faf1c | dbf75082cbf5ce16e6899056aa138acfeb2e1ab6 | refs/heads/master | 2021-01-19T12:39:42.387665 | 2010-05-06T22:48:04 | 2010-05-06T22:48:04 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 5,492 | cpp | #include <slib/ScriptFunctions.h>
namespace slib {
std::ostream & printAny( std::ostream & out, const boost::any & any ) {
if( boost::any_cast< bool >( &any ) ) {
return out << boost::any_cast< bool >( any );
} else if( boost::any_cast< int >( &any ) ) {
return out << boost::any_cast< int >( any );
} else if( boost::any_cast< float >( &any ) ) {
return out << boost::any_cast< float >( any );
} else if( boost::any_cast< std::string >( &any ) ) {
return out << boost::any_cast< std::string >( any );
} else {
//return out << any.type( ).name( );
throw ScriptError( "printAny: unknown type" );
}
}
boost::any addAny( const boost::any & x, const boost::any & y ) {
if( boost::any_cast< bool >( &x ) ) {
return boost::any_cast< bool >( x ) || boost::any_cast< bool >( y ) ;
} else if( boost::any_cast< int >( &x ) ) {
return boost::any_cast< int >( x ) + boost::any_cast< int >( y );
} else if( boost::any_cast< float >( &x ) ) {
return boost::any_cast< float >( x ) + boost::any_cast< float >( y );
} else if( boost::any_cast< std::string >( &x ) ) {
return boost::any_cast< std::string >( x ) + boost::any_cast< std::string >( y );
} else {
throw boost::bad_any_cast( );
}
}
boost::any multAny( const boost::any & x, const boost::any & y ) {
if( boost::any_cast< bool >( &x ) ) {
return boost::any_cast< bool >( x ) && boost::any_cast< bool >( y ) ;
} else if( boost::any_cast< int >( &x ) ) {
return boost::any_cast< int >( x ) * boost::any_cast< int >( y );
} else if( boost::any_cast< float >( &x ) ) {
return boost::any_cast< float >( x ) * boost::any_cast< float >( y );
} else {
throw boost::bad_any_cast( );
}
}
boost::any equalAny( const boost::any & x, const boost::any & y ) {
if( boost::any_cast< bool >( &x ) ) {
return boost::any_cast< bool >( x ) == boost::any_cast< bool >( y ) ;
} else if( boost::any_cast< int >( &x ) ) {
return boost::any_cast< int >( x ) == boost::any_cast< int >( y );
} else if( boost::any_cast< float >( &x ) ) {
return boost::any_cast< float >( x ) == boost::any_cast< float >( y );
} else if( boost::any_cast< std::string >( &x ) ) {
return boost::any_cast< std::string >( x ) == boost::any_cast< std::string >( y );
} else {
throw boost::bad_any_cast( );
}
}
boost::any addInverseAny( const boost::any & any ) {
if( boost::any_cast< bool >( &any ) ) {
return !boost::any_cast< bool >( any );
} else if( boost::any_cast< int >( &any ) ) {
return -boost::any_cast< int >( any );
} else if( boost::any_cast< float >( &any ) ) {
return -boost::any_cast< float >( any );
} else {
throw boost::bad_any_cast( );
}
}
boost::any multInverseAny( const boost::any & any ) {
if( boost::any_cast< float >( &any ) ) {
return 1.0f / boost::any_cast< float >( any );
} else {
throw boost::bad_any_cast( );
}
}
boost::any ScriptPrint( EnvT & env, const std::list< boost::any > & paramlist ) {
std::for_each( paramlist.begin( ), paramlist.end( ), boost::bind( printAny, boost::ref( std::cout ), _1 ) );
std::cout << std::endl;
return boost::any( );
}
boost::any ScriptAdd( EnvT & env, const std::list< boost::any > & paramlist ) {
if( paramlist.empty( ) ) {
throw ScriptError( "ScriptAdd: incorrect parameter count" );
} else {
try {
std::list< boost::any >::const_iterator second = paramlist.begin( ); ++second;
return std::accumulate( second, paramlist.end( ), paramlist.front( ), boost::bind( addAny, _1, _2 ) );
} catch( const boost::bad_any_cast & ) {
throw ScriptError( "ScriptAdd: inconsistent argument types" );
}
}
}
boost::any ScriptMult( EnvT & env, const std::list< boost::any > & paramlist ) {
if( paramlist.empty( ) ) {
throw ScriptError( "ScriptMult: incorrect parameter count" );
} else {
try {
std::list< boost::any >::const_iterator second = paramlist.begin( ); ++second;
return std::accumulate( second, paramlist.end( ), paramlist.front( ), boost::bind( multAny, _1, _2 ) );
} catch( const boost::bad_any_cast & ) {
throw ScriptError( "ScriptMult: inconsistent argument types" );
}
}
}
boost::any ScriptEqual( EnvT & env, const std::list< boost::any > & paramlist ) {
if( paramlist.empty( ) ) {
throw ScriptError( "ScriptEqual: incorrect parameter count" );
} else {
try {
std::list< boost::any >::const_iterator second = paramlist.begin( ); ++second;
return std::inner_product( second, paramlist.end( ), paramlist.begin( ), boost::any( true ), multAny, equalAny );
} catch( const boost::bad_any_cast & ) {
throw ScriptError( "ScriptEqual: inconsistent argument types" );
}
}
}
boost::any ScriptAddInverse( EnvT & env, const std::list< boost::any > & paramlist ) {
if( paramlist.size( ) != 1 ) {
throw ScriptError( "ScriptAddInverse: incorrect argument count (should be 1)" );
} else {
try {
return addInverseAny( paramlist.front( ) );
} catch( const boost::bad_any_cast & ) {
throw ScriptError( "ScriptAddInverse: invalid argument type" );
}
}
}
boost::any ScriptMultInverse( EnvT & env, const std::list< boost::any > & paramlist ) {
if( paramlist.size( ) != 1 ) {
throw ScriptError( "ScriptMultInverse: incorrect argument count (should be 1)" );
} else {
try {
return multInverseAny( paramlist.front( ) );
} catch( const boost::bad_any_cast & ) {
throw ScriptError( "ScriptMultInverse: invalid argument type" );
}
}
}
}
| [
"stephen.a.lombardi@gmail.com"
] | stephen.a.lombardi@gmail.com |
84612aa4fa33d9ed25635dc1837a777b42612c2a | e32ef985754b8d348c25396967589177d3ae0d53 | /vkintali/include/server.h | 3dd0a10b31a2f4f0330fef166516e91bfd4216a5 | [] | no_license | rohitkvn/Text-Chat-Application | 91ab71b60a246ae16944cc18f8f4eb2821d40783 | 63df552a90d3ffbe5bc6dec7735564ee14f30bb3 | refs/heads/main | 2023-03-02T03:04:15.290974 | 2021-01-30T01:28:17 | 2021-01-30T01:28:17 | 334,302,451 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,060 | h | #ifndef SERVER_H_
#define SERVER_H_
char * getipaddress(char * str);
int accept_connection(int server_socket, std::vector<struct ClientList> * clientlist);
void create_connection(int * sockfd,char* port);
//void refresh_list_server(int *fdaccept, std::vector<struct ClientList> * clientlist);
void refresh_list_server(int fdaccept, std::vector<struct ClientList> * clientlist, char * list);
void server_send(int sock_index,char * cmd,std::vector<struct ClientList> * clientlist);
void server_broadcast(int sock_index,char * cmd, std::vector<struct ClientList> * clientlist);
void delete_fd(int sock_index, std::vector<struct ClientList>*clientlist);
int validatenumber(char * portno);
void validateport(char * str, char * port);
int unblockip(int sock_index, char * buffer, std::vector<struct ClientList>*clientlist);
void displayblocked(std::vector<struct ClientList>*clientlist,char * buffer);
bool validateip(char * ipaddress);
void blockip(int sock_index, char * buffer, std::vector<struct ClientList> *clientlist);
int sendall(int s, char *buf);
#endif
| [
"vkintali@buffalo.edu"
] | vkintali@buffalo.edu |
f8707607c66e7fd1ed00b3dc1f4f0c18a42320bd | c08a26d662bd1df1b2beaa36a36d0e9fecc1ebac | /uifw/AvKon/src/AknIndicatorContainer.cpp | 87fba854ee62a824cdb1e4c27909bbb639072c69 | [] | no_license | SymbianSource/oss.FCL.sf.mw.classicui | 9c2e2c31023256126bb2e502e49225d5c58017fe | dcea899751dfa099dcca7a5508cf32eab64afa7a | refs/heads/master | 2021-01-11T02:38:59.198728 | 2010-10-08T14:24:02 | 2010-10-08T14:24:02 | 70,943,916 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 151,820 | cpp | /*
* Copyright (c) 2002-2008 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
* which accompanies this distribution, and is available
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
* Initial Contributors:
* Nokia Corporation - initial contribution.
*
* Contributors:
*
* Description: Implementation for default status indicator control.
*
*/
// INCLUDE FILES
#include <AknsDrawUtils.h>
#include <AknPictographInterface.h>
#include <AknPictographDrawerInterface.h>
#include <aknlayoutscalable_avkon.cdl.h>
#include <aknlayoutscalable_apps.cdl.h>
#include <AknSmallIndicator.h>
#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
#include <uikon/eikenvinterface.h>
#endif
#include <AknTasHook.h>
#include <touchfeedback.h>
#include "AknIndicatorObserver.h"
#include "aknindicatordataobserver.h"
#include "AknSgcc.h"
#include "AknIncallStatusBubble.h"
#include "AknUtils.h"
#include "aknconsts.h"
#include "AknIndicator.h"
#include "AknIndicatorContainer.h"
#include "aknenv.h"
#include "AknStatuspaneUtils.h"
#include "AknIndicatorFader.h"
#include "aknappui.h"
#include "AknDef.h"
#include "layoutmetadata.cdl.h"
// CONSTANTS
const TInt KAknIndicatorQueueGranularity = 4;
const TInt KAknIndicatorAnimationInterval = 500000; // micro seconds
const TInt KAknIndicatorAnimationShortDelay = 400000; // micro seconds
// Indicator pane control flags.
enum TIndicatorPaneControlFlags
{
EAknIndicatorsButton1DownInIndicatorPaneRect = 0x00000001
};
// ================= PRIVATE CLASS =======================
NONSHARABLE_CLASS( CAknIndicatorContainerExtension ) :
public CBase,
public MAknPictographAnimatorCallBack,
public MCoeMessageMonitorObserver
{
public:
/**
* Constructor.
*/
static CAknIndicatorContainerExtension* NewL(
CAknIndicatorContainer* aIndicatorContainer );
/**
* Destructor.
*/
~CAknIndicatorContainerExtension();
TBool SmallStatusPaneLayout();
void SetSmallStatusPaneLayout( TBool aIsActive );
// From base class @c MCoeMessageMonitorObserver.
/**
* Used to receive event from window server
* when the visibility of the window changes.
*
* @param aEvent The window server event.
*/
void MonitorWsMessage( const TWsEvent &aEvent );
private:
CAknIndicatorContainerExtension(
CAknIndicatorContainer* aIndicatorContainer );
void ConstructL();
// From MAknPictographAnimatorCallBack
void DrawPictographArea();
public:
CAknIndicatorContainer* iIndicatorContainer;
CAknPictographInterface* iPictoInterface;
TBool iSmallStatusPaneLayout;
TBool iSwitchLayoutInProgress;
TBool iIncallBubbleAllowedInIdle;
TBool iIncallBubbleAllowedInUsual;
TPoint iPositionRelativeToScreen;
CAknIndicatorDataObserver* iDataObserver;
TInt iFlags;
TBool iIncallBubbleDisabled;
TBool iIsForeground;
TBool iIsActiveIdle;
};
CAknIndicatorContainerExtension* CAknIndicatorContainerExtension::NewL(
CAknIndicatorContainer* aIndicatorContainer )
{
CAknIndicatorContainerExtension* self = new( ELeave )
CAknIndicatorContainerExtension( aIndicatorContainer );
CleanupStack::PushL( self );
self->ConstructL();
CleanupStack::Pop( self );
return self;
}
void CAknIndicatorContainerExtension::ConstructL()
{
iPictoInterface = CAknPictographInterface::NewL( *iIndicatorContainer, *this );
if ( iIndicatorContainer->IndicatorContext() ==
CAknIndicatorContainer::EUniversalIndicators )
{
iDataObserver =
new (ELeave) CAknIndicatorDataObserver( iIndicatorContainer );
}
TRAP_IGNORE( CCoeEnv::Static()->AddMessageMonitorObserverL( *this ) );
}
CAknIndicatorContainerExtension::CAknIndicatorContainerExtension(
CAknIndicatorContainer* aIndicatorContainer )
: iIndicatorContainer( aIndicatorContainer )
{
iSmallStatusPaneLayout = AknStatuspaneUtils::SmallLayoutActive();
iIncallBubbleAllowedInUsual = ETrue;
iIsForeground = static_cast<CAknAppUi*>( CEikonEnv::Static()->EikAppUi() )->IsForeground();
iIsActiveIdle = AknStatuspaneUtils::IsActiveIdle();
}
CAknIndicatorContainerExtension::~CAknIndicatorContainerExtension()
{
delete iPictoInterface;
delete iDataObserver;
CCoeEnv::Static()->RemoveMessageMonitorObserver( *this );
}
void CAknIndicatorContainerExtension::DrawPictographArea()
{
iIndicatorContainer->DrawPictographArea();
}
TBool CAknIndicatorContainerExtension::SmallStatusPaneLayout()
{
return iSmallStatusPaneLayout;
}
void CAknIndicatorContainerExtension::SetSmallStatusPaneLayout(
TBool aIsActive )
{
iSmallStatusPaneLayout = aIsActive;
}
void CAknIndicatorContainerExtension::MonitorWsMessage( const TWsEvent& aEvent )
{
switch ( aEvent.Type() )
{
case KAknFullOrPartialForegroundGained:
iIndicatorContainer->ResetAnimTicker( ETrue );
break;
case KAknFullOrPartialForegroundLost:
iIndicatorContainer->ResetAnimTicker( EFalse );
break;
default:
break;
}
}
// ================= MEMBER FUNCTIONS =======================
// ---------------------------------------------------------------------------
// CAknIndicatorContainer::CAknIndicatorContainer
// Default constructor.
// ---------------------------------------------------------------------------
//
EXPORT_C CAknIndicatorContainer::CAknIndicatorContainer() :
iLayoutOrientation( EVertical ),
iPreviousLayoutOrientation( EVertical ),
iAlignment( ERight ),
iIndicatorContext( EUniversalIndicators ),
iSynchronizingValue( 0 )
{
AKNTASHOOK_ADD( this, "CAknIndicatorContainer" );
}
// ---------------------------------------------------------------------------
// CAknIndicatorContainer::CAknIndicatorContainer
// Constructor with context type parameter.
// ---------------------------------------------------------------------------
//
EXPORT_C CAknIndicatorContainer::CAknIndicatorContainer(
TBool aIndicatorContext )
: iLayoutOrientation( EVertical ),
iPreviousLayoutOrientation( EVertical ),
iAlignment( ERight ),
iIndicatorContext( aIndicatorContext ),
iSynchronizingValue( 0 )
{
AKNTASHOOK_ADD( this, "CAknIndicatorContainer" );
}
// ---------------------------------------------------------------------------
// CAknIndicatorContainer::~CAknIndicatorContainer
// Destructor.
// ---------------------------------------------------------------------------
//
EXPORT_C CAknIndicatorContainer::~CAknIndicatorContainer()
{
AKNTASHOOK_REMOVE();
AknsUtils::DeregisterControlPosition( this );
if ( iIndicators )
{
TInt count = iIndicators->Count();
for ( TInt ii = 0; ii < count; ii++)
{
delete iIndicators->At( ii );
}
delete iIndicators;
}
if ( iTicker )
{
iTicker->Cancel();
delete iTicker;
}
delete iIncallBubble;
delete iExtension;
}
// ---------------------------------------------------------------------------
// CAknIndicatorContainer::ConstructL
// Second-phase constructor.
// ---------------------------------------------------------------------------
//
EXPORT_C void CAknIndicatorContainer::ConstructL()
{
iExtension = CAknIndicatorContainerExtension::NewL( this );
if ( !iIndicators )
{
iIndicators =
new (ELeave) CAknIndicatorQueue( KAknIndicatorQueueGranularity );
}
iTicker = CPeriodic::NewL( CActive::EPriorityLow );
}
// ---------------------------------------------------------------------------
// CAknIndicatorContainer::ConstructFromResourceL
// Resource constructor.
// ---------------------------------------------------------------------------
//
EXPORT_C void CAknIndicatorContainer::ConstructFromResourceL(
TResourceReader& aReader )
{
ConstructL();
if ( iIndicatorContext != EUniversalIndicators &&
iIndicatorContext != ENaviPaneEditorIndicators &&
iIndicatorContext != EQueryEditorIndicators )
{
TInt count = aReader.ReadInt16();
for ( TInt ii = 0; ii < count; ii++ )
{
CAknIndicator* indicator =
new (ELeave) CAknIndicator ( iIndicatorContext );
CleanupStack::PushL( indicator );
indicator->SetContainerWindowL( *this );
indicator->ConstructFromResourceL( aReader, this );
iIndicators->AppendL( indicator );
CleanupStack::Pop( indicator );
indicator = NULL;
}
PrioritizeIndicatorsL();
}
}
// ---------------------------------------------------------------------------
// CAknIndicatorContainer::IndicatorContext
// Returns the indicator context of this container.
// ---------------------------------------------------------------------------
//
EXPORT_C TInt CAknIndicatorContainer::IndicatorContext() const
{
return iIndicatorContext;
}
// ---------------------------------------------------------------------------
// CAknIndicatorContainer::SetIndicatorState
// Sets the state of an indicator in this container.
// ---------------------------------------------------------------------------
//
EXPORT_C void CAknIndicatorContainer::SetIndicatorState( TUid aIndicatorId,
TInt aState,
TBool aDrawNow )
{
if ( !IndicatorExists( aIndicatorId ) )
{
if ( iIndicatorContext == EUniversalIndicators )
{
TRAP_IGNORE( CreateIndicatorFromPaneResourceL(
aIndicatorId, R_AVKON_STATUS_PANE_INDICATOR_DEFAULT, 0 ) );
}
else if ( iIndicatorContext == ENaviPaneEditorIndicators ||
iIndicatorContext == EQueryEditorIndicators )
{
TRAP_IGNORE( CreateIndicatorFromPaneResourceL(
aIndicatorId, R_AVKON_NAVI_PANE_EDITOR_INDICATORS, 0 ) );
}
}
TBool changed = EFalse;
TInt count = iIndicators->Count();
CAknIndicator* indicator = NULL;
for ( TInt ii = 0; ii < count; ii++ )
{
indicator = iIndicators->At( ii );
if ( indicator->Uid() == aIndicatorId )
{
if ( indicator->IndicatorState() != aState )
{
changed = ETrue;
}
indicator->SetIndicatorState( aState );
if ( aState == MAknIndicator::EIndicatorAnimate )
{
// Synchronizes new animated indicator with previous ones
indicator->SetAnimateState( iSynchronizingValue );
}
// In case of GPRS indicator in small status pane it is necessary
// to check whether a correct status pane layout is used.
if ( aIndicatorId == TUid::Uid( EAknNaviPaneEditorIndicatorGprs ) )
{
TBool layoutUpdated( EFalse );
TRAPD( err, layoutUpdated = UpdateSmallLayoutL() );
if ( layoutUpdated && err == KErrNone )
{
// Needed because this method is not called again.
iExtension->iSwitchLayoutInProgress = EFalse;
}
}
break;
}
}
if ( changed )
{
TRAP_IGNORE( PrioritizeIndicatorsL() );
SizeChanged(); // starts/stops also animation timers if needed
}
// Do not draw in case the indicator state has not changed and
// the indicator is not visible, even if aDrawNow is defined,
// otherwise flicker will occur.
if ( aDrawNow && ( changed || aState ) )
{
DrawNow();
}
}
// ---------------------------------------------------------------------------
// CAknIndicatorContainer::IndicatorState
// Returns current state of a status indicator in this container.
// ---------------------------------------------------------------------------
//
EXPORT_C TInt CAknIndicatorContainer::IndicatorState( TUid aIndicatorId )
{
TInt indicatorState( MAknIndicator::EIndicatorOff );
TInt count = iIndicators->Count();
CAknIndicator* indicator = NULL;
for ( TInt ii = 0; ii < count; ii++ )
{
indicator = iIndicators->At( ii );
if ( indicator->Uid() == aIndicatorId )
{
indicatorState = indicator->IndicatorState();
break;
}
}
return indicatorState;
}
EXPORT_C void CAknIndicatorContainer::SetIndicatorValueL( TUid aIndicatorId,
const TDesC& aString )
{
if ( ( iIndicatorContext == ENaviPaneEditorIndicators ||
iIndicatorContext == EQueryEditorIndicators ) &&
!IndicatorExists( aIndicatorId ) )
{
CreateIndicatorFromPaneResourceL( aIndicatorId, R_AVKON_NAVI_PANE_EDITOR_INDICATORS, 0);
}
TInt count = iIndicators->Count();
for(TInt ii = 0; ii < count; ii++)
{
CAknIndicator* indicator = iIndicators->At(ii);
if ( indicator->Uid() == aIndicatorId )
{
TInt indicatorWidthBefore = indicator->IconSize().iWidth;
indicator->SetIndicatorValueL(aString);
TInt indicatorWidthAfter = indicator->IconSize().iWidth;
// Draw the message length indicator if it is visible.
if ( indicator->IndicatorState() != EAknIndicatorStateOff )
{
if ( indicatorWidthBefore != indicatorWidthAfter )
{
// If indicator width was changed, reposition all indicators.
PrioritizeIndicatorsL();
SizeChanged();
}
DrawNow();
}
break;
}
}
}
void CAknIndicatorContainer::DrawPictographArea()
{
TInt count = iIndicators->Count();
for ( TInt i = 0; i < count; i++ )
{
CAknIndicator* indicator = iIndicators->At( i );
// Draw the indicator if it is visible and contains pictographs.
if ( indicator->TextIndicator() &&
indicator->IndicatorState() != EAknIndicatorStateOff &&
indicator->IsVisible() &&
iExtension->iPictoInterface->Interface()->ContainsPictographs(
*( indicator->iIndicatorText ) ) )
{
indicator->DrawDeferred();
}
}
}
CAknPictographInterface* CAknIndicatorContainer::PictographInterface() const
{
return iExtension->iPictoInterface;
}
EXPORT_C void CAknIndicatorContainer::SetIncallBubbleFlags( const TInt& aFlags )
{
if ( aFlags & CIncallStatusBubble::ESBVisible )
{
if ( !iIncallBubble )
{
TRAP_IGNORE( CreateIncallBubbleL() );
}
if ( iIncallBubble )
{
iIncallBubble->SetFlags( aFlags );
}
}
else
{
// RAM optimization, delete if not shown.
delete iIncallBubble;
iIncallBubble = NULL;
}
HandleStatusPaneSizeChange();
}
EXPORT_C void CAknIndicatorContainer::HandleStatusPaneSizeChange()
{
CEikStatusPaneBase* statusPane = CEikStatusPaneBase::Current();
if ( statusPane && iIncallBubble )
{
// In CDMA, the Phone app is on foreground during incall lock state
// In GSM/WCDMA the Autolock application is on foreground
// Nowdays Autolock itself takes care of the visibility
const TBool showIncallIndicatorInLockState = EFalse;
TBool showIncallIndicatorInIdle =
iExtension->iIncallBubbleAllowedInIdle &&
!iExtension->iIncallBubbleDisabled;
TBool showIncallIndicatorInUsual =
iExtension->iIncallBubbleAllowedInUsual &&
!iExtension->iIncallBubbleDisabled;
TBool visible = EFalse;
TBool usualStatuspane = AknStatuspaneUtils::UsualLayoutActive();
TBool idleStatuspane = AknStatuspaneUtils::IdleLayoutActive();
// Call bubble is never displayed if video telephony is
// on the foreground.
TInt currentLayoutResId = statusPane->CurrentLayoutResId();
TBool vtStatuspane =
( currentLayoutResId == R_AVKON_STATUS_PANE_LAYOUT_VT ||
currentLayoutResId == R_AVKON_STATUS_PANE_LAYOUT_VT_MIRRORED );
if ( statusPane->IsVisible() && iExtension->iIsForeground &&
( ( usualStatuspane && showIncallIndicatorInUsual ) ||
( idleStatuspane && showIncallIndicatorInIdle && !vtStatuspane ) ) )
{
// Incall bubble window is shown only in the usual layout when status
// pane is shown. Exception for this rule: The bubble is shown also
// when autolock application is in the front even if the idle
// layout is visible.
visible = ( iIncallBubble->Flags() & CIncallStatusBubble::ESBVisible );
}
IncallBubbleSizeChanged( showIncallIndicatorInLockState );
iIncallBubble->MakeVisible( visible );
}
}
//-----------------------------------------------------------------------------
// CAknIndicatorContainer::HandleResourceChange
//-----------------------------------------------------------------------------
//
EXPORT_C void CAknIndicatorContainer::HandleResourceChange( TInt aType )
{
CCoeControl::HandleResourceChange( aType );
if ( aType == KEikMessageFadeAllWindows && iIncallBubble )
{
CEikStatusPaneBase* statusPane = CEikStatusPaneBase::Current();
iIncallBubble->SetFaded( statusPane->IsFaded() );
}
if ( aType == KEikColorResourceChange || aType == KAknsMessageSkinChange )
{
DrawDeferred();
}
else if ( aType == KEikDynamicLayoutVariantSwitch )
{
SizeChanged();
DrawDeferred();
}
if ( iIncallBubble )
{
iIncallBubble->HandleResourceChange( aType );
}
}
//-----------------------------------------------------------------------------
// CAknIndicatorContainer::SizeChanged
//-----------------------------------------------------------------------------
//
EXPORT_C void CAknIndicatorContainer::SizeChanged()
{
// No fading if staconpane is active and in few other cases too...
if ( iIndicatorContext == EUniversalIndicators )
{
SetContainerWindowNonFading(
AknStatuspaneUtils::ExtendedStaconPaneActive() ||
( AknStatuspaneUtils::StaconPaneActive() &&
!AknStatuspaneUtils::IdleLayoutActive() ) );
}
AknsUtils::RegisterControlPosition( this );
if ( iExtension && DrawableWindow() )
{
iExtension->iPositionRelativeToScreen = PositionRelativeToScreen();
}
// Select right layout modes for indicators.
// This is now done always to ensure right layout mode.
SetupIndicatorLayoutModes();
// HandleStatusPaneSizeChange() is called here always to check
// incall bubble visibility because status pane size change is
// not only case when it changes.
HandleStatusPaneSizeChange();
// Check if layout is mirrored and the context
// of the indicators is mirrorable.
if ( AknLayoutUtils::LayoutMirrored() &&
( iIndicatorContext == EUniversalIndicators ||
iIndicatorContext == ENaviPaneEditorIndicators ||
iIndicatorContext == EQueryEditorIndicators ) )
{
iAlignment = TIndicatorAlignment( ELeft );
}
else
{
iAlignment = TIndicatorAlignment( ERight );
}
TRect containerRect( Rect() );
if ( containerRect.IsEmpty() )
{
return;
}
// Set faders off by default (only used in stacon)
if ( iIndicatorContext == EUniversalIndicators )
{
TInt count = iIndicators->Count();
for ( TInt ii = 0; ii < count; ii++ )
{
CAknIndicator* indicator = iIndicators->At( ii );
if ( indicator )
{
indicator->SetIndicatorFader( NULL );
}
}
}
TBool idleLayout = AknStatuspaneUtils::IdleLayoutActive();
TBool smallLayout = EFalse;
TBool flatLayout = EFalse;
TBool extendedFlatLayout = EFalse;
TBool staconLayout = EFalse;
TBool extendedStaconLayout = EFalse;
TBool hdLayout = EFalse;
TBool extendedLayout = EFalse;
if ( AknStatuspaneUtils::SmallLayoutActive() )
{
smallLayout = ETrue;
}
else if ( AknStatuspaneUtils::FlatLayoutActive() )
{
flatLayout = ETrue;
extendedFlatLayout = !AknLayoutUtils::PenEnabled() &&
AknStatuspaneUtils::ExtendedFlatLayoutActive();
hdLayout = AknStatuspaneUtils::HDLayoutActive();
}
else if ( AknStatuspaneUtils::StaconPaneActive() )
{
staconLayout = ETrue;
extendedStaconLayout = AknStatuspaneUtils::ExtendedStaconPaneActive();
}
else
{
hdLayout = AknStatuspaneUtils::HDLayoutActive();
extendedLayout = AknStatuspaneUtils::ExtendedLayoutActive();
}
switch ( iIndicatorContext )
{
case ENaviPaneEditorIndicators:
{
if ( smallLayout )
{
SizeChangedInSmallStatusPane();
}
else if ( staconLayout &&
!idleLayout )
{
SizeChangedInStaconPane();
}
else if ( hdLayout )
{
SizeChangedInExtendedStatusPane();
}
else
{
SizeChangedInNormalStatusPane();
}
break;
}
case EUniversalIndicators:
{
if ( extendedLayout )
{
if ( idleLayout && !hdLayout )
{
SizeChangedInIdleExtendedStatusPane();
}
else
{
SizeChangedInExtendedStatusPane();
}
}
else if ( flatLayout )
{
if ( extendedFlatLayout )
{
// Extended flat status pane layout.
SizeChangedInExtendedStatusPane();
}
else
{
// Old flat status pane layout.
SizeChangedInFlatStatusPane();
}
}
else if ( staconLayout )
{
if ( extendedStaconLayout )
{
// Extended stacon layout.
SizeChangedInExtendedStatusPane();
}
else if ( !idleLayout )
{
// Old stacon layout.
SizeChangedInStaconPane();
}
else
{
SizeChangedInNormalStatusPane();
}
}
else if ( idleLayout &&
Layout_Meta_Data::IsLandscapeOrientation() &&
Size().iWidth < Size().iHeight )
{
// Universal indicator container in idle landscape
// using vertical indicators.
SizeChangedInIdleVertical();
}
else
{
// Normal status pane by default.
SizeChangedInNormalStatusPane();
}
break;
}
default:
{
if ( hdLayout )
{
SizeChangedInExtendedStatusPane();
}
else
{
// Normal status pane by default.
SizeChangedInNormalStatusPane();
}
break;
}
}
}
EXPORT_C void CAknIndicatorContainer::PositionChanged()
{
AknsUtils::RegisterControlPosition( this );
}
EXPORT_C TInt CAknIndicatorContainer::CountComponentControls() const
{
return (iIndicatorsShown);
}
EXPORT_C CCoeControl* CAknIndicatorContainer::ComponentControl(TInt aIndex) const
{
TInt count = iIndicators->Count();
TInt ii = 0;
for (ii = 0; (ii < count) && (aIndex >= 0); ii++)
{
if ( iIndicators->At(ii)->IndicatorState() && (iIndicators->At(ii)->Priority() != KIndicatorNotShown))
{
aIndex--;
}
}
if ( ii > 0 )
{
return iIndicators->At(--ii);
}
else
{
return NULL;
}
}
EXPORT_C void CAknIndicatorContainer::Draw( const TRect& /*aRect*/ ) const
{
if ( iExtension->iIsActiveIdle )
{
return;
}
// Don't allow normal background drawing if
// background is already drawn with a background drawer.
const MCoeControlBackground* backgroundDrawer = FindBackground();
if ( backgroundDrawer )
{
return;
}
CWindowGc& gc = SystemGc();
MAknsSkinInstance* skin = AknsUtils::SkinInstance();
MAknsControlContext* cc = AknsDrawUtils::ControlContext( this );
TRect rect( Rect() );
gc.SetPenStyle( CGraphicsContext::ENullPen );
gc.SetBrushStyle( CGraphicsContext::ESolidBrush );
//
// S60 flat statuspane
//
if ( AknStatuspaneUtils::FlatLayoutActive() )
{
if ( iIndicatorContext == EUniversalIndicators )
{
if( !AknsDrawUtils::Background( skin, cc, this, gc, rect ) )
{
gc.SetPenStyle( CGraphicsContext::ENullPen );
gc.SetBrushStyle( CGraphicsContext::ESolidBrush );
gc.SetBrushColor(
AKN_LAF_COLOR( KStatusPaneBackgroundGraphicsColorUsual ) );
gc.DrawRect( rect );
}
if( iIndicatorsShown &&
iExtension &&
AknStatuspaneUtils::IdleLayoutActive() &&
!AknStatuspaneUtils::ExtendedFlatLayoutActive() &&
!AknStatuspaneUtils::HDLayoutActive() )
{
TRect fadeRect( rect );
// Draw fade if there are indicators
if ( iLayoutOrientation == EVertical &&
Layout_Meta_Data::IsLandscapeOrientation() )
{
AknsDrawUtils::DrawCachedImage(
skin,
gc,
fadeRect,
KAknsIIDQgnGrafIdleFadeLsc );
}
else if ( iLayoutOrientation == EHorizontal )
{
AknsDrawUtils::DrawCachedImage(
skin,
gc,
fadeRect,
KAknsIIDQgnGrafIdleFade );
}
}
}
else if ( iIndicatorContext == ENaviPaneEditorIndicators )
{
if( !AknsDrawUtils::Background( skin, cc, this, gc, rect ) )
{
gc.SetPenStyle( CGraphicsContext::ENullPen );
gc.SetBrushStyle( CGraphicsContext::ESolidBrush );
gc.SetBrushColor(
AKN_LAF_COLOR( KStatusPaneBackgroundGraphicsColorUsual ) );
gc.DrawRect( rect );
}
}
else
{
gc.SetBrushColor( AKN_LAF_COLOR( 0 ) );
AknsDrawUtils::Background( skin, cc, this, gc, rect );
}
return;
}
//
// S60 staconpane
//
if (AknStatuspaneUtils::StaconPaneActive() &&
(iIndicatorContext == EUniversalIndicators || iIndicatorContext == ENaviPaneEditorIndicators))
{
if (iIndicatorContext == ENaviPaneEditorIndicators)
{
if( !AknsDrawUtils::Background( skin, cc, this, gc, rect ) )
{
gc.SetPenStyle(CGraphicsContext::ENullPen);
gc.SetBrushStyle(CGraphicsContext::ESolidBrush);
gc.SetBrushColor(AKN_LAF_COLOR(KStatusPaneBackgroundGraphicsColorUsual) );
gc.DrawRect(rect);
}
}
else if ( iIndicatorContext == EUniversalIndicators )
{
if( !AknsDrawUtils::Background( skin, cc, this, gc, rect ) )
{
gc.SetPenStyle(CGraphicsContext::ENullPen);
gc.SetBrushStyle(CGraphicsContext::ESolidBrush);
gc.SetBrushColor(AKN_LAF_COLOR(KStatusPaneBackgroundGraphicsColorUsual) );
gc.DrawRect(rect);
}
if( iIndicatorsShown &&
iExtension &&
AknStatuspaneUtils::IdleLayoutActive() &&
!AknStatuspaneUtils::ExtendedStaconPaneActive())
{
TRect fadeRect( rect );
if (iLayoutOrientation == EHorizontal)
{
// Always this fade
AknsDrawUtils::DrawCachedImage( skin, gc, fadeRect,
KAknsIIDQgnGrafIdleFade );
}
else
{
AknsDrawUtils::DrawCachedImage( skin, gc, fadeRect,
KAknsIIDQgnGrafIdleFadeLsc );
}
}
}
else
{
// Draw background for query editor indicators
gc.SetBrushColor(AKN_LAF_COLOR(0));
AknsDrawUtils::Background( skin, cc, this, gc, rect );
}
return;
}
//
// Extended S60 statuspane
//
if (AknStatuspaneUtils::ExtendedLayoutActive())
{
if( CAknEnv::Static()->TransparencyEnabled() )
{
AknsDrawUtils::Background( skin, cc, this, gc, rect, KAknsDrawParamNoClearUnderImage );
}
else
{
AknsDrawUtils::Background( skin, cc, this, gc, rect );
}
return;
}
//
// Default S60 statuspane
//
if ( iIndicatorContext == EUniversalIndicators )
{
// Draw background for universal indicator pane
gc.SetBrushColor(AKN_LAF_COLOR(0)); // Universal indicator background color
AknsDrawUtils::Background( skin, cc, this, gc, rect );
if( (iLayoutOrientation == EHorizontal) && iIndicatorsShown && iExtension && !AknStatuspaneUtils::StaconPaneActive())
{
if (AknStatuspaneUtils::IdleLayoutActive())
{
TRect fadeRect( rect );
// Draw fade if there are indicators
AknsDrawUtils::DrawCachedImage( skin, gc, fadeRect,
KAknsIIDQgnGrafIdleFade );
}
}
}
if ( iIndicatorContext != EUniversalIndicators )
{
if ( iIndicatorContext == ENaviPaneEditorIndicators )
{
AknsDrawUtils::Background( skin, cc, this, gc, rect );
}
else
{
// Draw background for query editor indicators
gc.SetBrushColor(AKN_LAF_COLOR(0));
if( CAknEnv::Static()->TransparencyEnabled() )
{
AknsDrawUtils::Background( skin, cc, this, gc, rect, KAknsDrawParamNoClearUnderImage );
}
else
{
AknsDrawUtils::Background( skin, cc, this, gc, rect );
}
}
}
}
EXPORT_C void CAknIndicatorContainer::HandlePointerEventL(
const TPointerEvent& aPointerEvent )
{
CAknControl::HandlePointerEventL( aPointerEvent );
if ( AknLayoutUtils::PenEnabled() && iExtension )
{
TRect rect( Rect() );
// The indicator popup is launched if both the down and up
// pointer events happen in the indicator pane area.
switch ( aPointerEvent.iType )
{
case TPointerEvent::EButton1Down:
{
// if indicator's rect contains pointer down position
if ( rect.Contains( aPointerEvent.iPosition ) )
{
// set flag that down was inside indicator
iExtension->iFlags |=
EAknIndicatorsButton1DownInIndicatorPaneRect;
if ( iIndicatorContext == EUniversalIndicators &&
iExtension->iFlags & EAknIndicatorsButton1DownInIndicatorPaneRect
)
{
MTouchFeedback* feedback = MTouchFeedback::Instance();
if ( feedback )
{
feedback->InstantFeedback( this, ETouchFeedbackSensitiveButton );
}
}
}
break;
}
case TPointerEvent::EButton1Up:
{
// Currently the small digital clock pane and universal
// indicator pane are regarded as one touch responsive area from
// which the universal indicator popup should open on tap,
// so upon pointer up event it must be checked here if
// the down event happened inside this control, but the up event
// inside digital clock pane area.
CEikStatusPaneBase* sp = CEikStatusPaneBase::Current();
TRect clockRect( 0, 0, 0, 0 );
if ( sp )
{
CCoeControl* clockPane = sp->ContainerControlL(
TUid::Uid( EEikStatusPaneUidDigitalClock ) );
if ( clockPane )
{
clockRect = TRect( clockPane->PositionRelativeToScreen(),
clockPane->Size() );
}
}
// if indicator's rect contains pointer up position
if ( iIndicatorContext == EUniversalIndicators &&
( ( iExtension->iFlags & EAknIndicatorsButton1DownInIndicatorPaneRect &&
rect.Contains( aPointerEvent.iPosition ) ) ||
clockRect.Contains( aPointerEvent.iParentPosition ) ) )
{
MTouchFeedback* feedback = MTouchFeedback::Instance();
if ( feedback )
{
feedback->InstantFeedback( this,
ETouchFeedbackSensitiveButton,
ETouchFeedbackVibra,
aPointerEvent );
}
CAknSmallIndicator* indicatorNotifier = CAknSmallIndicator::NewLC( TUid::Uid( 0 ) );
indicatorNotifier->HandleIndicatorTapL();
CleanupStack::PopAndDestroy( indicatorNotifier );
}
// Up happened, reset button down flag
iExtension->iFlags &=
( ~EAknIndicatorsButton1DownInIndicatorPaneRect );
break;
}
default:
{
break;
}
}
}
}
EXPORT_C void* CAknIndicatorContainer::ExtensionInterface( TUid /*aInterface*/ )
{
return NULL;
}
void CAknIndicatorContainer::Reserved_1()
{}
void CAknIndicatorContainer::PrioritizeIndicatorsL()
{
iPreviousLayoutOrientation = iLayoutOrientation;
TInt count = iIndicators->Count();
if (count < 2)
{
return;
}
CAknIndicator* temp;
for(TInt ii = 1; ii < count; ii++)
{
temp = iIndicators->At(ii);
TInt tempPriority = temp->Priority();
if (tempPriority >= 0)
{
for(TInt jj = 0; jj <= ii; jj++)
{
if (tempPriority < iIndicators->At(jj)->Priority())
{
iIndicators->Delete( ii );
CleanupStack::PushL( temp );
iIndicators->InsertL( jj, temp );
CleanupStack::Pop( temp );
break;
}
else if ( jj == (ii-1) )
{
break;
}
}
}
}
}
TInt CAknIndicatorContainer::TickerCallback(TAny* aThis)
{
return static_cast<CAknIndicatorContainer*>(aThis)->DoTick();
}
TInt CAknIndicatorContainer::DoTick()
{
if (iAnimatedIndicatorsShown > 0)
{
TInt count = iIndicators->Count();
TInt ii = 0;
for (ii = 0; ii < count; ii++)
{
if ( iIndicators->At(ii)->IndicatorState() == MAknIndicator::EIndicatorAnimate && (iIndicators->At(ii)->Priority() != KIndicatorNotShown))
{
iIndicators->At(ii)->Animate();
}
}
iSynchronizingValue += 1;
if (iSynchronizingValue >= 185794560) // This number can be divided with 2,4,6,8,10,12,14,16 and 18
{
iSynchronizingValue = 0;
}
DrawDeferred(); // Must be DrawDeferred (not DrawNow) so that we don't block application thread in high load situations
}
return ETrue;
}
void CAknIndicatorContainer::IncallBubbleSizeChanged(
TBool /*aAllowIdleStateBubble*/ )
{
if ( iIncallBubble &&
iIncallBubble->Flags() & CIncallStatusBubble::ESBVisible )
{
TAknWindowLineLayout layout;
if ( iIndicatorsShown > 0 )
{
// Position of incall bubble if universal small indicator(s) present.
// This position is also used when the bubble is shown with idle layout
// when autolock application is activated and it is front application.
layout = AknLayoutScalable_Apps::popup_call_status_window( 0 ).LayoutLine();
}
else
{
// Position of incall bubble if universal small indicator pane is empty.
layout = AknLayoutScalable_Apps::popup_call_status_window( 1 ).LayoutLine();
}
// screen
TRect screenRect( iAvkonAppUi->ApplicationRect() );
TAknLayoutRect layoutRect;
if ( Layout_Meta_Data::IsLandscapeOrientation() )
{
TInt topVariety = 8; // default to flat landscape statuspane variety
if ( AknStatuspaneUtils::StaconPaneActive() )
{
topVariety = 2;
}
TInt skvariety = 6;
if ( AknStatuspaneUtils::StaconPaneActive() )
{
if ( AknStatuspaneUtils::StaconSoftKeysRight() )
{
skvariety = 6;
}
else
{
skvariety = 8;
}
}
else if ( AknStatuspaneUtils::FlatLayoutActive() ||
AknStatuspaneUtils::HDLayoutActive() )
{
skvariety = 10;
}
if ( iIndicatorsShown > 0 )
{
// If indicators are shown we use one bigger variety index. But for "10" there is not such.
if ( skvariety != 10 )
{
skvariety++;
}
}
layout = AknLayoutScalable_Apps::popup_call_status_window( skvariety ).LayoutLine();
// To keep the call bubble in indicator pane area,
// otherwise it'll get on top of the title pane in A&H layouts.
if ( AknLayoutUtils::LayoutMirrored() )
{
TInt tmp = layout.il;
layout.il = layout.ir;
layout.ir = tmp;
}
TAknWindowComponentLayout topLayout = AknLayoutScalable_Avkon::area_top_pane( topVariety );
layoutRect.LayoutRect( screenRect, topLayout );
TRect topLayoutRect( layoutRect.Rect() );
layoutRect.LayoutRect( topLayoutRect, layout );
}
else
{
// Incall bubble
layoutRect.LayoutRect( screenRect, layout );
}
TRect rect( layoutRect.Rect() );
// SizeChanged of incall indicator is heavyweight, so set size only if
// necessary.
if ( rect != TRect( iIncallBubble->Position(), iIncallBubble->Size() ) )
{
iIncallBubble->SetRect( rect );
}
}
}
EXPORT_C void CAknIndicatorContainer::SetIndicatorValue(TUid aIndicatorId, TInt aValue, TInt aMaxValue)
{
TInt count = iIndicators->Count();
for(TInt ii = 0; ii < count; ii++)
{
CAknIndicator* indicator = iIndicators->At(ii);
if ( indicator->Uid() == aIndicatorId )
{
indicator->SetIndicatorValue(aValue, aMaxValue);
// Draw the indicator if it is visible.
if ( indicator->IndicatorState() != EAknIndicatorStateOff )
{
DrawNow();
}
break;
}
}
}
void CAknIndicatorContainer::SizeChangedInSmallStatusPane()
{
iLayoutOrientation = EHorizontal; // always horizontal
// only editor indicators are supported in small statuspane
if (iIndicatorContext != ENaviPaneEditorIndicators)
{
return;
}
// Gprs indicator is a special case. It is drawn
// to other spane by the system. Check here that correct
// statuspane layout is enabled and switch if needed
//
CEikStatusPaneBase* statusPane = CEikStatusPaneBase::Current();
TInt statusPaneCurrentLayoutResourceId = 0;
if ( statusPane )
{
statusPaneCurrentLayoutResourceId = statusPane->CurrentLayoutResId();
}
TInt last = iIndicators->Count() - 1;
// Update the status pane layout if needed to correspond the
// visibility of the GPRS indicator. If status pane layout is changed
// this function will be called again.
TBool layoutChanged = EFalse;
TRAP_IGNORE( layoutChanged = UpdateSmallLayoutL() );
if ( layoutChanged )
{
return; // this method will be called again
}
TBool layoutMirrored( AknLayoutUtils::LayoutMirrored() );
TRect containerRect( Rect() );
// screen
TRect screenRect = iAvkonAppUi->ApplicationRect();
// small statuspane
TRect smallStatusPaneRect;
AknLayoutUtils::LayoutMetricsRect(
AknLayoutUtils::EStatusPane, smallStatusPaneRect );
// small statuspane, wait pane
TAknLayoutRect smallStatusWaitPaneLayoutRect;
smallStatusWaitPaneLayoutRect.LayoutRect(
smallStatusPaneRect, AknLayoutScalable_Avkon::status_small_wait_pane( 0 ) );
TRect smallStatusWaitPaneRect( smallStatusWaitPaneLayoutRect.Rect() );
// small statuspane, globe
TAknLayoutRect smallStatusWmlGlobeLayoutRect;
smallStatusWmlGlobeLayoutRect.LayoutRect(
smallStatusPaneRect, AknLayoutScalable_Avkon::status_small_pane_g4( 0 ) );
TRect smallStatusWmlGlobeRect( smallStatusWmlGlobeLayoutRect.Rect() );
// small statuspane, gprs indicator
TAknLayoutRect smallStatusGprsLayoutRect;
smallStatusGprsLayoutRect.LayoutRect(
smallStatusPaneRect, AknLayoutScalable_Avkon::status_small_pane_g2( 0 ) );
TRect smallStatusGprsRect( smallStatusGprsLayoutRect.Rect() );
// small statuspane, secure state indicator
TAknLayoutRect smallStatusSecureStateLayoutRect;
smallStatusSecureStateLayoutRect.LayoutRect(
smallStatusPaneRect, AknLayoutScalable_Avkon::status_small_pane_g3( 0 ) );
TRect smallStatusSecureStateRect( smallStatusSecureStateLayoutRect.Rect() );
// small statuspane, texts
TAknTextComponentLayout smallStatusTextLayout;
if ( statusPaneCurrentLayoutResourceId ==
AVKONENV->StatusPaneResIdForCurrentLayout( R_AVKON_STATUS_PANE_LAYOUT_SMALL ) )
{
smallStatusTextLayout = AknLayoutScalable_Avkon::status_small_pane_t1( 0 );
}
else // gprs indicator visible
{
smallStatusTextLayout = AknLayoutScalable_Avkon::status_small_pane_t1( 1 );
}
TAknLayoutText textLayout;
textLayout.LayoutText( smallStatusPaneRect, smallStatusTextLayout );
TRect smallStatusTextRect( textLayout.TextRect() );
TInt textIndicatorLeftOffset = smallStatusTextRect.iTl.iX;
// Take possible touch pane into account.
TInt textIndicatorVerticalOffset =
( containerRect.Height() - smallStatusTextRect.Height() ) / 2;
TInt waitBarIndicatorLeftOffset = smallStatusWaitPaneRect.iTl.iX;
TInt progressBarIndicatorLeftOffset = smallStatusWaitPaneRect.iTl.iX;
TInt wmlWaitGlobeLeftOffset = smallStatusWmlGlobeRect.iTl.iX;
if ( layoutMirrored )
{
waitBarIndicatorLeftOffset =
smallStatusPaneRect.iBr.iX - smallStatusWaitPaneRect.iBr.iX;
progressBarIndicatorLeftOffset =
smallStatusPaneRect.iBr.iX - smallStatusWaitPaneRect.iBr.iX;
wmlWaitGlobeLeftOffset =
smallStatusPaneRect.iBr.iX - smallStatusWmlGlobeRect.iBr.iX;
}
if ( statusPaneCurrentLayoutResourceId ==
AVKONENV->StatusPaneResIdForCurrentLayout(
R_AVKON_STATUS_PANE_LAYOUT_SMALL_WITH_SIGNAL_PANE ) )
{
// If GPRS indicator is visible then a larger offset is needed
// for text indicator because there are no pixels empty in
// the right side of the GPRS status icon as the layout spec
// requires in this case.
if ( textIndicatorLeftOffset < KMinSpaceBetweenIconsInPixels )
{
textIndicatorLeftOffset = KMinSpaceBetweenIconsInPixels;
}
// This makes the globe indicator position adjusted to
// middle if GPRS indicator is in either side
if( !layoutMirrored )
{
wmlWaitGlobeLeftOffset -= smallStatusGprsRect.Width();
}
}
// Modify containerRect if alignment is Right.
// For Left aligned no need to modify containerRect.
if ( iAlignment == TIndicatorAlignment( ERight ) )
{
containerRect.iBr.iX -= 3; // Right margin of editor indicators
containerRect.iTl.iX += 0; // Left margin of editor indicators
}
iIndicatorsShown = 0;
iAnimatedIndicatorsShown = 0;
TBool textIndicatorOffsetNeeded = ETrue;
TRect rectForRightSideIndicators( containerRect.iBr.iX,
containerRect.iTl.iY,
containerRect.iBr.iX,
containerRect.iBr.iY );
TRect rectForLeftSideIndicators( containerRect.iTl.iX,
containerRect.iTl.iY,
containerRect.iTl.iX,
containerRect.iBr.iY );
TRect rectForMiddleIndicators( wmlWaitGlobeLeftOffset,
containerRect.iTl.iY,
wmlWaitGlobeLeftOffset,
containerRect.iBr.iY );
for ( TInt ii = 0; ii <= last; ii++ )
{
CAknIndicator* indicator = iIndicators->At( ii );
TInt uid = indicator->Uid().iUid;
TInt indicatorPosition = 0;
// Decide here how indicators are positioned.
// Default is right side.
indicatorPosition = indicator->IndicatorPosition();
// Check if indicator is not shown on current layout even it is set ON.
if ( !indicator->IndicatorState() ||
indicator->Priority() == KIndicatorNotShown )
{
continue;
}
// Check if this is GPRS indicator, it is never shown here
// but is drawn to the signal pane by the system
if ( uid == EAknNaviPaneEditorIndicatorGprs )
{
indicator->SetExtent( TPoint( 0, 0 ), TSize( 0, 0 ) );
iIndicatorsShown++;
continue;
}
// Handle offsets.
TAknLayoutRect statusPaneIconSmallRect;
statusPaneIconSmallRect.LayoutRect(
smallStatusPaneRect, AknLayoutScalable_Avkon::status_small_icon_pane() );
// Take possible touch pane into account
TInt verticalOffset =
( containerRect.Height() - statusPaneIconSmallRect.Rect().Height() ) / 2;
TInt leftOffset = 0; // default offset
TInt rightOffset = 0; // default offset
TInt indicatorWidth = indicator->IconSize().iWidth; // default width
TInt indicatorHeight = indicator->IconSize().iHeight; // default height
if ( uid == EAknNaviPaneEditorIndicatorMessageInfo ||
uid == EAknNaviPaneEditorIndicatorWmlWindowsText ||
uid == EAknNaviPaneEditorIndicatorMessageLength )
{
indicatorHeight = smallStatusTextRect.Height();
verticalOffset = textIndicatorVerticalOffset;
// First text indicator needs horizontal offset.
if ( textIndicatorOffsetNeeded )
{
leftOffset += textIndicatorLeftOffset;
}
textIndicatorOffsetNeeded = EFalse;
}
else if ( uid == EAknNaviPaneEditorIndicatorFileSize )
{
verticalOffset = textIndicatorVerticalOffset;
// Need left offset in western, right offset in A&H layout.
if ( layoutMirrored )
{
rightOffset = textIndicatorLeftOffset;
}
else
{
leftOffset = KMinSpaceBetweenIconsInPixels;
}
}
else if ( uid == EAknNaviPaneEditorIndicatorSecuredConnection )
{
verticalOffset =
( containerRect.Height() - smallStatusSecureStateRect.Height() ) / 2;
// Because icon bitmap does not contain enough space,
// increase offset as the layout spec states.
if ( layoutMirrored )
{
leftOffset = KMinSpaceBetweenIconsInPixels;
}
else
{
rightOffset = KMinSpaceBetweenIconsInPixels;
}
textIndicatorOffsetNeeded = EFalse;
waitBarIndicatorLeftOffset = 0;
progressBarIndicatorLeftOffset = 0;
}
else if ( uid == EAknNaviPaneEditorIndicatorWmlWaitGlobe )
{
verticalOffset =
( containerRect.Height() - indicator->IconSize().iHeight ) / 2;
indicatorWidth = smallStatusWmlGlobeRect.Width();
}
else if ( uid == EAknNaviPaneEditorIndicatorProgressBar )
{
indicatorWidth = smallStatusWaitPaneRect.Width();
indicatorHeight = smallStatusWaitPaneRect.Height();
verticalOffset = ( containerRect.Height() - indicatorHeight ) / 2;
leftOffset = progressBarIndicatorLeftOffset;
textIndicatorOffsetNeeded = ETrue;
}
else if ( uid == EAknNaviPaneEditorIndicatorWaitBar )
{
indicatorWidth = smallStatusWaitPaneRect.Width();
indicatorHeight = smallStatusWaitPaneRect.Height();
verticalOffset = ( containerRect.Height() - indicatorHeight ) / 2;
leftOffset = waitBarIndicatorLeftOffset;
textIndicatorOffsetNeeded = ETrue;
}
if ( layoutMirrored )
{
TInt temp = leftOffset;
leftOffset = rightOffset;
rightOffset = temp;
}
// Place indicators to the left side.
if ( ( indicatorPosition == ELeftSide &&
iAlignment == TIndicatorAlignment( ERight ) ) ||
( indicatorPosition == ERightSide &&
iAlignment == TIndicatorAlignment( ELeft ) ) )
{
TRect requiredRect(
rectForLeftSideIndicators.iBr.iX,
rectForLeftSideIndicators.iTl.iY,
rectForLeftSideIndicators.iBr.iX + leftOffset + indicatorWidth + rightOffset,
rectForLeftSideIndicators.iBr.iY );
// check if indicator fits
TBool indicatorDoesNotFit =
( requiredRect.Intersects( rectForRightSideIndicators ) ||
requiredRect.Intersects( rectForMiddleIndicators ) ||
containerRect.iTl.iX > requiredRect.iTl.iX ||
containerRect.iBr.iX < requiredRect.iBr.iX );
if ( indicatorDoesNotFit &&
!indicator->DynamicTextIndicator() )
{
indicator->SetExtent( TPoint( 0, 0 ), TSize( 0, 0 ) );
iIndicatorsShown++;
continue;
}
else
{
if ( indicator->DynamicTextIndicator() && indicatorDoesNotFit )
{
// Dynamic text indicators (not normal text indicators)
// can adjust to any size.
TInt maxWidthForDynamicTextIndicator =
containerRect.iBr.iX - requiredRect.iTl.iX;
if ( requiredRect.Intersects( rectForRightSideIndicators ) )
{
maxWidthForDynamicTextIndicator =
rectForRightSideIndicators.iTl.iX - requiredRect.iTl.iX;
}
if ( requiredRect.Intersects( rectForMiddleIndicators ) )
{
maxWidthForDynamicTextIndicator =
rectForMiddleIndicators.iTl.iX - requiredRect.iTl.iX;
}
indicator->SetExtent( TPoint( requiredRect.iTl.iX + leftOffset,
verticalOffset ),
TSize( maxWidthForDynamicTextIndicator,
indicatorHeight ) );
rectForLeftSideIndicators.iBr.iX =
indicator->Position().iX + indicator->Size().iWidth;
}
else
{
indicator->SetExtent( TPoint( requiredRect.iTl.iX + leftOffset,
verticalOffset ),
TSize( indicatorWidth, indicatorHeight ) );
rectForLeftSideIndicators.iBr.iX = requiredRect.iBr.iX;
}
}
}
// Place indicators to the right side.
if ( ( indicatorPosition == ERightSide &&
iAlignment == TIndicatorAlignment( ERight ) ) ||
( indicatorPosition == ELeftSide &&
iAlignment == TIndicatorAlignment( ELeft ) ) )
{
TRect requiredRect(
rectForRightSideIndicators.iTl.iX - leftOffset - indicatorWidth - rightOffset,
rectForRightSideIndicators.iTl.iY,
rectForRightSideIndicators.iTl.iX,
rectForRightSideIndicators.iBr.iY );
// Check if indicator fits.
TBool indicatorDoesNotFit =
( requiredRect.Intersects( rectForLeftSideIndicators ) ||
requiredRect.Intersects( rectForMiddleIndicators ) ||
containerRect.iTl.iX > requiredRect.iTl.iX ||
containerRect.iBr.iX < requiredRect.iBr.iX );
if ( indicatorDoesNotFit &&
!indicator->DynamicTextIndicator() )
{
indicator->SetExtent( TPoint( 0, 0 ), TSize( 0, 0 ) );
iIndicatorsShown++;
continue;
}
else
{
if ( indicator->DynamicTextIndicator() && indicatorDoesNotFit )
{
// Dynamic text indicators (not normal text indicators)
// can adjust to any size.
TInt maxWidthForDynamicTextIndicator =
requiredRect.iBr.iX - containerRect.iTl.iX - leftOffset;
if ( requiredRect.Intersects( rectForLeftSideIndicators ) )
{
maxWidthForDynamicTextIndicator =
requiredRect.iBr.iX - rectForLeftSideIndicators.iBr.iX;
}
if ( requiredRect.Intersects( rectForMiddleIndicators ) )
{
maxWidthForDynamicTextIndicator =
requiredRect.iBr.iX - rectForMiddleIndicators.iBr.iX;
}
indicator->SetExtent(
TPoint( requiredRect.iBr.iX - maxWidthForDynamicTextIndicator - leftOffset,
verticalOffset ),
TSize( maxWidthForDynamicTextIndicator,
indicatorHeight ) );
rectForRightSideIndicators.iTl.iX = indicator->Position().iX;
}
else
{
indicator->SetExtent( TPoint( requiredRect.iTl.iX + leftOffset,
verticalOffset),
TSize( indicatorWidth, indicatorHeight ) );
rectForRightSideIndicators.iTl.iX = requiredRect.iTl.iX;
}
}
}
// Place indicators to the middle, only indicator is wml wait globe.
if ( indicatorPosition == EMiddle )
{
TRect requiredRect(
rectForMiddleIndicators.iTl.iX,
rectForMiddleIndicators.iTl.iY,
rectForMiddleIndicators.iTl.iX + leftOffset + indicatorWidth + rightOffset,
rectForMiddleIndicators.iBr.iY);
// Check if indicator fits.
if ( ( requiredRect.Intersects( rectForRightSideIndicators ) ||
requiredRect.Intersects( rectForLeftSideIndicators ) ) ||
( rectForMiddleIndicators.Width() != 0 ) )
{
indicator->SetExtent( TPoint( 0, 0 ), TSize( 0, 0 ) );
iIndicatorsShown++;
continue;
}
else
{
indicator->SetExtent( TPoint( rectForMiddleIndicators.iTl.iX + leftOffset,
verticalOffset),
TSize( indicatorWidth, indicatorHeight) );
rectForMiddleIndicators.iTl.iX += rightOffset;
rectForMiddleIndicators.iTl.iX += indicatorWidth;
}
}
iIndicatorsShown++;
if ( indicator->IndicatorState() == MAknIndicator::EIndicatorAnimate )
{
iAnimatedIndicatorsShown++;
}
} // for
ResetAnimTicker( iExtension->iIsForeground );
}
// ---------------------------------------------------------------------------
// CAknIndicatorContainer::SizeChangedInNormalStatusPane
// Handles size change events in normal status pane layouts.
// ---------------------------------------------------------------------------
//
void CAknIndicatorContainer::SizeChangedInNormalStatusPane()
{
TRect containerRect( Rect() );
TInt height = containerRect.Height();
TInt width = containerRect.Width();
// Find out if pane layout is horizontal or vertical
// Following pane uses vertical layout:
// - System owned universal small indicator pane
// when status pane is in usual layout
// Following panes use horizontal layout:
// - System owned universal small indicator pane
// when status pane is in idle layout
// - Navigation pane editor indicator pane
// - Query editor indicators
iLayoutOrientation = ( height > width ) ? EVertical : EHorizontal;
TBool isLandscape( Layout_Meta_Data::IsLandscapeOrientation() );
TAknWindowComponentLayout indicatorIconLayout(
AknLayoutScalable_Avkon::indicator_pane_g1( isLandscape ) );
if ( iIndicatorContext != EUniversalIndicators )
{
// Editor indicators
if ( iAlignment == TIndicatorAlignment( ERight ) )
{
containerRect.iBr.iX -= 4; // Right margin of editor indicators
containerRect.iTl.iX += 6; // Left margin of editor indicators
}
else
{
containerRect.iBr.iX -= 6; // Right margin of editor indicators
containerRect.iTl.iX += 1; // Left margin of editor indicators
}
}
else if ( iLayoutOrientation == EHorizontal )
{
TAknWindowLineLayout indicatorLayout = AknLayout::Indicator_pane_elements_Line_1();
TAknLayoutRect indicatorLayoutRect;
indicatorLayoutRect.LayoutRect(containerRect, indicatorLayout);
TRect indicatorRect( indicatorLayoutRect.Rect() );
// Layout adaptation layer does not work correctly. Access the layout data directly in
// scalable UI...and calculate...
TAknWindowLineLayout layout1( AknLayoutScalable_Avkon::indicator_pane_g1(0).LayoutLine() );
indicatorLayoutRect.LayoutRect(containerRect, layout1);
indicatorRect = indicatorLayoutRect.Rect();
// variety 1 is only valid in landscape layouts
if(Layout_Meta_Data::IsLandscapeOrientation())
{
TAknWindowLineLayout layout2 = AknLayoutScalable_Avkon::indicator_pane_g1(1).LayoutLine();
indicatorLayoutRect.LayoutRect(containerRect, layout2);
TRect rect2( indicatorLayoutRect.Rect() );
indicatorRect.BoundingRect(rect2);
}
containerRect.iBr.iX = indicatorRect.iBr.iX;
containerRect.iTl.iX = indicatorRect.iTl.iX;
}
// Available space for indicators
TRect rect( containerRect );
height = rect.Height();
width = rect.Width();
TInt verticalIndicatorOffset = rect.iTl.iY;
TInt verticalOffsetForTextIndicator = verticalIndicatorOffset;
TAknLayoutText layoutText;
layoutText.LayoutText(
Rect(),
TAknWindowComponentLayout::ComposeText(
AknLayoutScalable_Avkon::navi_text_pane( 0 ),
AknLayoutScalable_Avkon::navi_text_pane_t1() ) );
TAknLayoutRect editingIconLayoutRect;
editingIconLayoutRect.LayoutRect(
Rect(),
TAknWindowComponentLayout::Compose(
AknLayoutScalable_Avkon::navi_icon_pane( 0 ),
AknLayoutScalable_Avkon::navi_icon_pane_g1() ) );
if ( iIndicatorContext != EUniversalIndicators )
{
if ( iIndicatorContext == ENaviPaneEditorIndicators )
{
verticalIndicatorOffset += editingIconLayoutRect.Rect().iTl.iY;
verticalOffsetForTextIndicator = layoutText.TextRect().iTl.iY;
}
// In query editor indicators have offset 0
}
else if ( iLayoutOrientation == EHorizontal )
{
TAknLayoutRect indicatorLayoutRect;
indicatorLayoutRect.LayoutRect( containerRect, indicatorIconLayout );
TRect indicatorRect( indicatorLayoutRect.Rect() );
verticalIndicatorOffset += indicatorRect.iTl.iY;
}
TInt verticalOffset = verticalIndicatorOffset;
// If layout orientation has been changed since last call,
// prioritize indicators again.
if ( iLayoutOrientation != iPreviousLayoutOrientation )
{
// Following leave is ignored.
// In case of leave indicators are not maybe shown correctly.
TRAP_IGNORE ( PrioritizeIndicatorsL() );
}
iIndicatorsShown = 0;
iAnimatedIndicatorsShown = 0;
TInt last = iIndicators->Count() - 1;
TRect rectForRightSideIndicators( containerRect.iBr.iX,
containerRect.iTl.iY,
containerRect.iBr.iX,
containerRect.iBr.iY );
TRect rectForLeftSideIndicators( containerRect.iTl.iX,
containerRect.iTl.iY,
containerRect.iTl.iX,
containerRect.iBr.iY );
// Not really supported in this layout.
TRect rectForMiddleIndicators( TRect( 0, 0, 0, 0 ) );
for ( TInt ii = 0; ii <= last; ii++ )
{
CAknIndicator* indicator = iIndicators->At( ii );
if ( !indicator->IndicatorState() ||
indicator->Priority() == KIndicatorNotShown )
{
// Indicator is not shown on current layout even it is set ON.
continue;
}
TInt uid = indicator->Uid().iUid;
if ( uid == EAknNaviPaneEditorIndicatorSecuredConnection ||
uid == EAknNaviPaneEditorIndicatorProgressBar ||
uid == EAknNaviPaneEditorIndicatorWmlWaitGlobe ||
uid == EAknNaviPaneEditorIndicatorGprs ||
uid == EAknNaviPaneEditorIndicatorFileSize ||
uid == EAknNaviPaneEditorIndicatorWaitBar ||
uid == EAknNaviPaneEditorIndicatorWlanAvailable ||
uid == EAknNaviPaneEditorIndicatorWlanActive ||
uid == EAknNaviPaneEditorIndicatorWlanActiveSecure )
{
// These indicators are not shown in this statuspane layout.
indicator->SetExtent( TPoint( 0, 0 ), TSize( 0, 0 ) );
iIndicatorsShown++;
continue;
}
if ( iLayoutOrientation == EVertical )
{
// Highest priority indicator is put topmost.
if ( height < indicator->IconSize().iHeight )
{
// Space for indicators is full.
// Rest of low priority indicators are not shown.
break;
}
// Position indicators side by side.
if ( iAlignment == TIndicatorAlignment( ERight ) )
{
indicator->SetExtent( rect.iTl, indicator->IconSize() );
}
// If layout is left aligned, must leave one pixel to the left empty.
else
{
indicator->SetExtent( TPoint( rect.iTl.iX + 1, rect.iTl.iY ),
indicator->IconSize() );
}
rect.iTl.iY += indicator->IconSize().iHeight;
height = rect.Height();
}
else
{
// Code to set indicator positions starts,
// supports dynamic text indicators.
verticalOffset = verticalIndicatorOffset;
// Decide here how indicators are positioned.
// Default is right side.
TInt indicatorPosition = indicator->IndicatorPosition();
TInt leftOffset = 0; // default offset
TInt rightOffset = 0; // default offset
TInt indicatorWidth = indicator->IconSize().iWidth; // default width
TInt indicatorHeight = indicator->IconSize().iHeight; // default height
TBool textIndicatorOffsetNeeded = ETrue;
TInt textIndicatorLeftOffset = KMinSpaceBetweenIconsInPixels;
if ( uid == EAknNaviPaneEditorIndicatorMessageInfo ||
uid == EAknNaviPaneEditorIndicatorWmlWindowsText ||
uid == EAknNaviPaneEditorIndicatorMessageLength )
{
verticalOffset = verticalOffsetForTextIndicator;
// First text indicator need horizontal offset.
if ( textIndicatorOffsetNeeded )
{
leftOffset += textIndicatorLeftOffset;
}
textIndicatorOffsetNeeded = EFalse;
}
if ( uid == EAknNaviPaneEditorIndicatorFileSize )
{
verticalOffset = verticalOffsetForTextIndicator;
// Need left offset in western, right offset in A&H layout.
if( AknLayoutUtils::LayoutMirrored() )
{
rightOffset = textIndicatorLeftOffset;
}
else
{
leftOffset = KMinSpaceBetweenIconsInPixels;
}
}
if( AknLayoutUtils::LayoutMirrored() )
{
TInt temp = leftOffset;
leftOffset = rightOffset;
rightOffset = temp;
}
// Place indicators to the leftside.
if ( ( indicatorPosition == ELeftSide &&
iAlignment == TIndicatorAlignment( ERight ) ) ||
( indicatorPosition == ERightSide &&
iAlignment == TIndicatorAlignment( ELeft ) ) )
{
TRect requiredRect(
rectForLeftSideIndicators.iBr.iX,
rectForLeftSideIndicators.iTl.iY,
rectForLeftSideIndicators.iBr.iX + leftOffset + indicatorWidth + rightOffset,
rectForLeftSideIndicators.iBr.iY );
// Check if indicator fits.
TBool indicatorDoesNotFit =
( requiredRect.Intersects( rectForRightSideIndicators ) ||
requiredRect.Intersects( rectForMiddleIndicators ) ||
containerRect.iTl.iX > requiredRect.iTl.iX ||
containerRect.iBr.iX < requiredRect.iBr.iX );
if ( indicatorDoesNotFit &&
!indicator->DynamicTextIndicator() )
{
indicator->SetExtent( TPoint( 0, 0 ), TSize( 0, 0 ) );
iIndicatorsShown++;
continue;
}
else
{
if ( indicator->DynamicTextIndicator() && indicatorDoesNotFit )
{
// Dynamic text indicators (not normal text indicators)
// can adjust to any size.
TInt maxWidthForDynamicTextIndicator =
containerRect.iBr.iX - requiredRect.iTl.iX;
if ( requiredRect.Intersects( rectForRightSideIndicators ) )
{
maxWidthForDynamicTextIndicator =
rectForRightSideIndicators.iTl.iX - requiredRect.iTl.iX;
}
if ( requiredRect.Intersects( rectForMiddleIndicators ) )
{
maxWidthForDynamicTextIndicator =
rectForMiddleIndicators.iTl.iX - requiredRect.iTl.iX;
}
indicator->SetExtent(
TPoint( requiredRect.iTl.iX + leftOffset, verticalOffset ),
TSize( maxWidthForDynamicTextIndicator, indicatorHeight ) );
rectForLeftSideIndicators.iBr.iX =
indicator->Position().iX + indicator->Size().iWidth;
}
else
{
indicator->SetExtent(
TPoint( requiredRect.iTl.iX + leftOffset, verticalOffset ),
TSize( indicatorWidth, indicatorHeight ) );
rectForLeftSideIndicators.iBr.iX = requiredRect.iBr.iX;
}
}
}
// Place indicators on the right side.
if ( ( indicatorPosition == ERightSide &&
iAlignment == TIndicatorAlignment( ERight ) ) ||
( indicatorPosition == ELeftSide &&
iAlignment == TIndicatorAlignment( ELeft ) ) )
{
TRect requiredRect(
rectForRightSideIndicators.iTl.iX - leftOffset - indicatorWidth - rightOffset,
rectForRightSideIndicators.iTl.iY,
rectForRightSideIndicators.iTl.iX,
rectForRightSideIndicators.iBr.iY );
// Check if indicator fits.
TBool indicatorDoesNotFit =
( requiredRect.Intersects( rectForLeftSideIndicators ) ||
requiredRect.Intersects( rectForMiddleIndicators ) ||
containerRect.iTl.iX > requiredRect.iTl.iX ||
containerRect.iBr.iX < requiredRect.iBr.iX );
if ( indicatorDoesNotFit &&
!indicator->DynamicTextIndicator() )
{
indicator->SetExtent( TPoint( 0, 0 ), TSize( 0, 0 ) );
iIndicatorsShown++;
continue;
}
else
{
if ( indicator->DynamicTextIndicator() && indicatorDoesNotFit )
{
// Dynamic text indicators (not normal text indicators)
// can adjust to any size.
TInt maxWidthForDynamicTextIndicator =
requiredRect.iBr.iX - containerRect.iTl.iX - leftOffset;
if ( requiredRect.Intersects( rectForLeftSideIndicators ) )
{
maxWidthForDynamicTextIndicator =
requiredRect.iBr.iX - rectForLeftSideIndicators.iBr.iX;
}
if ( requiredRect.Intersects( rectForMiddleIndicators ) )
{
maxWidthForDynamicTextIndicator =
requiredRect.iBr.iX - rectForMiddleIndicators.iBr.iX;
}
indicator->SetExtent(
TPoint( requiredRect.iBr.iX - maxWidthForDynamicTextIndicator + leftOffset,
verticalOffset ),
TSize( maxWidthForDynamicTextIndicator, indicatorHeight ) );
rectForRightSideIndicators.iTl.iX = indicator->Position().iX;
}
else
{
indicator->SetExtent(
TPoint( requiredRect.iTl.iX + leftOffset, verticalOffset ),
TSize( indicatorWidth, indicatorHeight ) );
rectForRightSideIndicators.iTl.iX = requiredRect.iTl.iX;
}
}
}
// Place indicators to the middle if any.
if ( indicatorPosition == EMiddle )
{
// Not supported for now, always set size to zero.
indicator->SetExtent( TPoint( 0, 0 ), TSize( 0, 0 ) );
iIndicatorsShown++;
}
}
iIndicatorsShown++;
if ( indicator->IndicatorState() == MAknIndicator::EIndicatorAnimate )
{
iAnimatedIndicatorsShown++;
}
}
// Code for setting indicator positions ends.
ResetAnimTicker( iExtension->iIsForeground );
}
// ---------------------------------------------------------------------------
// CAknIndicatorContainer::SizeChangedInExtendedStatusPane
// Handles size change events in extended status pane layouts.
// ---------------------------------------------------------------------------
//
void CAknIndicatorContainer::SizeChangedInExtendedStatusPane()
{
TRect containerRect( Rect() );
TBool hdLayout( AknStatuspaneUtils::HDLayoutActive() );
// In landscape layoutdata there is not yet data
// so we approximate a bit here...
if ( AknStatuspaneUtils::ExtendedStaconPaneActive() )
{
containerRect.iTl.iY += Rect().Size().iHeight / 9;
containerRect.iBr.iY -= Rect().Size().iHeight / 9;
}
if ( iIndicatorContext == EUniversalIndicators )
{
iLayoutOrientation = EHorizontal;
if ( hdLayout )
{
if ( !AknLayoutUtils::LayoutMirrored() )
{
iAlignment = TIndicatorAlignment( ELeft );
}
else
{
iAlignment = TIndicatorAlignment( ERight );
}
}
}
// Available space for indicators
TRect rect( containerRect );
// If layout orientation has been changed since last call, prioritize indicators again.
if ( iLayoutOrientation != iPreviousLayoutOrientation )
{
TRAP_IGNORE ( PrioritizeIndicatorsL() );
}
iIndicatorsShown = 0;
iAnimatedIndicatorsShown = 0;
TInt last = iIndicators->Count() - 1;
if ( iIndicatorContext == EUniversalIndicators )
{
TRect parent( rect );
// Read the maximum amount of indicators in one row
// from the layout data.
TAknLayoutScalableParameterLimits limit(
AknLayoutScalable_Avkon::cell_indicator_nsta_pane_ParamLimits() );
TInt maxIndicatorsShown = limit.LastColumn() + 1;
TInt indicatorNumberVariety = 0;
if ( maxIndicatorsShown == 4 )
{
indicatorNumberVariety = 1;
}
TAknLayoutRect layoutRect;
TAknWindowLineLayout cellLayout;
TAknWindowComponentLayout indicatorLayout(
AknLayoutScalable_Avkon::cell_indicator_nsta_pane_g2( hdLayout ) );
TInt totalIndicatorsOn( 0 );
// Need to go through the indicator array two times
// to be able to place the indicators in correct order.
for ( TInt i = 0; i <= last; i++ )
{
CAknIndicator* indicator = iIndicators->At( i );
if ( indicator->IndicatorState() &&
indicator->Priority() != KIndicatorNotShown )
{
totalIndicatorsOn++;
}
}
for ( TInt ii = 0; ii <= last; ii++ )
{
CAknIndicator* indicator = iIndicators->At( ii );
if ( !indicator->IndicatorState() ||
indicator->Priority() == KIndicatorNotShown )
{
// Indicator is not shown on current layout even it is set ON.
continue;
}
iIndicatorsShown++;
if ( iIndicatorsShown > maxIndicatorsShown )
{
// Maximum number of indicators is already shown.
indicator->SetExtent( TPoint( 0, 0 ), TSize( 0, 0 ) );
break;
}
else
{
TInt columnVariety( iIndicatorsShown - 1 );
if ( !hdLayout && totalIndicatorsOn < maxIndicatorsShown )
{
if ( totalIndicatorsOn == 1 )
{
columnVariety = maxIndicatorsShown - 1;
}
else
{
columnVariety = iIndicatorsShown;
}
}
// set indicator sizes here, leftmost cell first if we are in
// HD status pane layout, otherwise rightmost cell first.
cellLayout = AknLayoutScalable_Avkon::cell_indicator_nsta_pane(
columnVariety,
indicatorNumberVariety ).LayoutLine();
layoutRect.LayoutRect( parent, cellLayout );
TRect cell( layoutRect.Rect() );
layoutRect.LayoutRect( cell, indicatorLayout );
TRect indicatorRect( layoutRect.Rect() );
// FIXME: Layout is broken, we fix it here.
// Remove this when layout is fixed.
if ( indicatorRect.iBr.iX > cell.iBr.iX )
{
indicatorRect.iBr.iX = cell.iBr.iX;
}
if ( indicatorRect.iTl.iX < cell.iTl.iX )
{
indicatorRect.iTl.iX = cell.iTl.iX;
}
// End of FIXME
// TBD: When touch is supported, the size may have
// to be reconsidered.
indicator->SetRect( indicatorRect );
}
if ( indicator->IndicatorState() == MAknIndicator::EIndicatorAnimate )
{
iAnimatedIndicatorsShown++;
}
} // for
ResetAnimTicker( iExtension->iIsForeground );
} // if universal indicators.
else // Editor indicators.
{
// Navi and query editor indicators are always horizontally
// arranged in extended status pane layouts.
iLayoutOrientation = EHorizontal;
TInt verticalIndicatorOffset = rect.iTl.iY;
TInt verticalOffsetForTextIndicator = verticalIndicatorOffset;
// Text layout.
TAknLayoutText layoutText;
layoutText.LayoutText(
rect, AknLayoutScalable_Avkon::navi_text_pane_t1() );
// Offsets calculated from layout data.
TAknLayoutRect editingIconLayoutRect;
editingIconLayoutRect.LayoutRect(
rect, AknLayoutScalable_Avkon::navi_icon_pane_g1( 1 ) );
if ( iIndicatorContext == ENaviPaneEditorIndicators )
{
verticalIndicatorOffset += editingIconLayoutRect.Rect().iTl.iY;
verticalOffsetForTextIndicator = layoutText.TextRect().iTl.iY;
}
// In query editor indicators have offset 0
TInt verticalOffset = verticalIndicatorOffset;
// If layout orientation has been changed since last call, prioritize indicators again.
if ( iLayoutOrientation != iPreviousLayoutOrientation )
{
// Following leave is ignored.
// In case of leave indicators are not maybe shown correctly.
TRAP_IGNORE ( PrioritizeIndicatorsL() );
}
iIndicatorsShown = 0;
iAnimatedIndicatorsShown = 0;
TInt last = iIndicators->Count() - 1;
// Check if the secured connection indicator is on before
// reading the layouts because of different positioning
// of wait and progress bars with that indicator on.
TBool secureConnectionIndicOn( EFalse );
for ( TInt i = 0; i <= last; i++ )
{
CAknIndicator* indicator = iIndicators->At( i );
if ( indicator->Uid().iUid == EAknNaviPaneEditorIndicatorSecuredConnection &&
indicator->IndicatorState() &&
indicator->Priority() != KIndicatorNotShown )
{
secureConnectionIndicOn = ETrue;
}
}
// Wait bar layout.
TAknWindowComponentLayout smallStatusWaitPaneLayout(
AknLayoutScalable_Avkon::status_small_wait_pane(
secureConnectionIndicOn ? 2 : 1 ) );
TAknLayoutRect smallStatusWaitPaneLayoutRect;
smallStatusWaitPaneLayoutRect.LayoutRect(
rect, smallStatusWaitPaneLayout );
TRect smallStatusWaitPaneRect( smallStatusWaitPaneLayoutRect.Rect() );
// Globe layout.
TAknLayoutRect smallStatusWmlGlobeLayoutRect;
smallStatusWmlGlobeLayoutRect.LayoutRect(
rect, AknLayoutScalable_Avkon::status_small_pane_g4( 0 ) );
TRect smallStatusWmlGlobeRect( smallStatusWmlGlobeLayoutRect.Rect() );
TInt wmlWaitGlobeLeftOffset =
rect.Width() / 2 - smallStatusWmlGlobeRect.Width() / 2;
TRect rectForRightSideIndicators( rect.iBr.iX,
rect.iTl.iY,
rect.iBr.iX,
rect.iBr.iY );
TRect rectForLeftSideIndicators( rect.iTl.iX,
rect.iTl.iY,
rect.iTl.iX,
rect.iBr.iY );
TRect rectForMiddleIndicators( 0, 0, 0, 0 ); // Not used in portrait.
if ( hdLayout )
{
rectForMiddleIndicators = TRect( wmlWaitGlobeLeftOffset,
rect.iTl.iY,
wmlWaitGlobeLeftOffset,
rect.iBr.iY );
}
for ( TInt ii = 0; ii <= last; ii++ )
{
CAknIndicator* indicator = iIndicators->At( ii );
// Check if indicator is not shown on current layout even it is set ON.
if ( !indicator->IndicatorState() ||
indicator->Priority() == KIndicatorNotShown )
{
continue;
}
TInt uid = indicator->Uid().iUid;
TInt indicatorPosition = indicator->IndicatorPosition();
// Handle indicators that are not shown in this layout here.
// Check if this is gprs indicator, it is never shown here but is drawn
// to the signal pane by the system
if ( uid == EAknNaviPaneEditorIndicatorGprs )
{
indicator->SetExtent( TPoint( 0, 0 ), TSize( 0, 0 ) );
iIndicatorsShown++;
continue;
}
else if ( ( !hdLayout &&
( uid == EAknNaviPaneEditorIndicatorSecuredConnection ||
uid == EAknNaviPaneEditorIndicatorProgressBar ||
uid == EAknNaviPaneEditorIndicatorWmlWaitGlobe ||
uid == EAknNaviPaneEditorIndicatorGprs ||
uid == EAknNaviPaneEditorIndicatorFileSize ||
uid == EAknNaviPaneEditorIndicatorWaitBar ) ) ||
( hdLayout &&
( uid == EAknNaviPaneEditorIndicatorWlanAvailable ||
uid == EAknNaviPaneEditorIndicatorWlanActive ||
uid == EAknNaviPaneEditorIndicatorWlanActiveSecure ) ) )
{
// These indicators are not shown in this statuspane layout
indicator->SetExtent( TPoint( 0, 0 ), TSize( 0, 0 ) );
iIndicatorsShown++;
continue;
}
// End of layout exceptions
// Calculate offsets.
TInt leftOffset = 0; // default offset
TInt rightOffset = 0; // default offset
TSize indicatorSize = indicator->IconSize();
TInt indicatorWidth = indicatorSize.iWidth; // default width
TInt indicatorHeight = indicatorSize.iHeight; // default height
switch ( uid )
{
case EAknNaviPaneEditorIndicatorMessageInfo:
case EAknNaviPaneEditorIndicatorWmlWindowsText:
case EAknNaviPaneEditorIndicatorMessageLength:
{
verticalOffset = verticalOffsetForTextIndicator;
break;
}
case EAknNaviPaneEditorIndicatorFileSize:
{
verticalOffset = verticalOffsetForTextIndicator;
leftOffset = KMinSpaceBetweenIconsInPixels;
break;
}
case EAknNaviPaneEditorIndicatorSecuredConnection:
case EAknNaviPaneEditorIndicatorWlanAvailable:
case EAknNaviPaneEditorIndicatorWlanActive:
case EAknNaviPaneEditorIndicatorWlanActiveSecure:
{
// Because icon bitmap does not contain enough space,
// increase offset as the layout spec states.
if ( AknLayoutUtils::LayoutMirrored() )
{
leftOffset = KMinSpaceBetweenIconsInPixels;
}
else
{
rightOffset = KMinSpaceBetweenIconsInPixels;
}
break;
}
case EAknNaviPaneEditorIndicatorWmlWaitGlobe:
{
verticalOffset = ( rect.Height() - indicator->IconSize().iHeight ) / 2;
indicatorWidth = smallStatusWmlGlobeRect.Width();
break;
}
case EAknNaviPaneEditorIndicatorProgressBar:
{
indicatorWidth = smallStatusWaitPaneRect.Width();
indicatorHeight = smallStatusWaitPaneRect.Height();
leftOffset = KMinSpaceBetweenIconsInPixels;
break;
}
case EAknNaviPaneEditorIndicatorWaitBar:
{
indicatorWidth = smallStatusWaitPaneRect.Width();
indicatorHeight = smallStatusWaitPaneRect.Height();
leftOffset = KMinSpaceBetweenIconsInPixels;
break;
}
default:
{
// Default offsets.
break;
}
}
// End of offset calculations.
// Place indicators to the left side.
if ( ( indicatorPosition == ELeftSide &&
iAlignment == TIndicatorAlignment( ERight ) ) ||
( indicatorPosition == ERightSide &&
iAlignment == TIndicatorAlignment( ELeft ) ) )
{
TRect requiredRect(
rectForLeftSideIndicators.iBr.iX,
rectForLeftSideIndicators.iTl.iY,
rectForLeftSideIndicators.iBr.iX + leftOffset + indicatorWidth + rightOffset,
rectForLeftSideIndicators.iBr.iY );
// Check if indicator fits
TBool indicatorDoesNotFit =
requiredRect.Intersects( rectForRightSideIndicators ) ||
requiredRect.Intersects( rectForMiddleIndicators ) ||
rect.iTl.iX > requiredRect.iTl.iX ||
rect.iBr.iX < requiredRect.iBr.iX;
if ( indicatorDoesNotFit &&
!indicator->DynamicTextIndicator() )
{
indicator->SetExtent( TPoint( 0, 0 ), TSize( 0, 0 ) );
iIndicatorsShown++;
continue;
}
else
{
if ( indicator->DynamicTextIndicator() && indicatorDoesNotFit )
{
// Dynamic text indicators (not normal text indicators) can adjust to any size.
TInt maxWidthForDynamicTextIndicator =
rect.iBr.iX - requiredRect.iTl.iX;
if ( requiredRect.Intersects( rectForRightSideIndicators ) )
{
maxWidthForDynamicTextIndicator =
rectForRightSideIndicators.iTl.iX - requiredRect.iTl.iX;
}
if ( requiredRect.Intersects( rectForMiddleIndicators ) )
{
maxWidthForDynamicTextIndicator =
rectForMiddleIndicators.iTl.iX - requiredRect.iTl.iX;
}
indicator->SetExtent(
TPoint( requiredRect.iTl.iX + leftOffset,
verticalOffset ),
TSize( maxWidthForDynamicTextIndicator,
indicatorHeight ) );
// Adjust remaining space.
rectForLeftSideIndicators.iBr.iX =
indicator->Position().iX + indicator->Size().iWidth;
}
else
{
indicator->SetExtent(
TPoint( requiredRect.iTl.iX + leftOffset,
verticalOffset ),
TSize( indicatorWidth,
indicatorHeight ) );
// Adjust remaining space.
rectForLeftSideIndicators.iBr.iX = requiredRect.iBr.iX;
}
}
}
// Place indicators on the right side.
if ( ( indicatorPosition == ERightSide &&
iAlignment == TIndicatorAlignment( ERight ) ) ||
( indicatorPosition == ELeftSide &&
iAlignment == TIndicatorAlignment( ELeft ) ) )
{
TRect requiredRect(
rectForRightSideIndicators.iTl.iX - leftOffset - indicatorWidth - rightOffset,
rectForRightSideIndicators.iTl.iY,
rectForRightSideIndicators.iTl.iX,
rectForRightSideIndicators.iBr.iY );
// Check if indicator fits.
TBool indicatorDoesNotFit =
( requiredRect.Intersects( rectForLeftSideIndicators ) ||
requiredRect.Intersects( rectForMiddleIndicators ) ||
rect.iTl.iX > requiredRect.iTl.iX ||
rect.iBr.iX < requiredRect.iBr.iX );
if ( indicatorDoesNotFit &&
!indicator->DynamicTextIndicator() )
{
indicator->SetExtent( TPoint( 0, 0 ), TSize( 0, 0 ) );
iIndicatorsShown++;
continue;
}
else
{
if ( indicator->DynamicTextIndicator() && indicatorDoesNotFit )
{
// Dynamic text indicators (not normal text indicators)
// can adjust to any size.
TInt maxWidthForDynamicTextIndicator =
requiredRect.iBr.iX - rect.iTl.iX - leftOffset;
if ( requiredRect.Intersects( rectForLeftSideIndicators ) )
{
maxWidthForDynamicTextIndicator =
requiredRect.iBr.iX - rectForLeftSideIndicators.iBr.iX;
}
if ( requiredRect.Intersects( rectForMiddleIndicators ) )
{
maxWidthForDynamicTextIndicator =
requiredRect.iBr.iX - rectForMiddleIndicators.iBr.iX;
}
indicator->SetExtent(
TPoint( requiredRect.iBr.iX - maxWidthForDynamicTextIndicator - leftOffset,
verticalOffset),
TSize( maxWidthForDynamicTextIndicator, indicatorHeight ) );
// Adjust remaining space.
rectForRightSideIndicators.iTl.iX = indicator->Position().iX;
}
else
{
indicator->SetExtent(
TPoint( requiredRect.iTl.iX + leftOffset,
verticalOffset),
indicatorSize );
// Adjust remaining space.
rectForRightSideIndicators.iTl.iX = requiredRect.iTl.iX;
}
}
}
// Place indicators to the middle, only indicator
// at the moment is the wml wait globe.
if ( indicatorPosition == EMiddle )
{
TRect requiredRect(
rectForMiddleIndicators.iTl.iX,
rectForMiddleIndicators.iTl.iY,
rectForMiddleIndicators.iTl.iX + leftOffset + indicatorWidth + rightOffset,
rectForMiddleIndicators.iBr.iY );
// Check if indicator fits.
if ( ( requiredRect.Intersects( rectForRightSideIndicators ) ||
requiredRect.Intersects( rectForLeftSideIndicators ) ) ||
rectForMiddleIndicators.Width() != 0 )
{
// No space available in the middle.
indicator->SetExtent( TPoint( 0, 0 ), TSize( 0, 0 ) );
iIndicatorsShown++;
continue;
}
else
{
indicator->SetExtent(
TPoint( rectForMiddleIndicators.iTl.iX + leftOffset,
verticalOffset ),
indicatorSize );
// Adjust remaining space.
rectForMiddleIndicators.iTl.iX += rightOffset + indicatorWidth;
}
}
iIndicatorsShown++;
if ( indicator->IndicatorState() == MAknIndicator::EIndicatorAnimate )
{
iAnimatedIndicatorsShown++;
}
} // for
// Code for setting indicator positions ends.
ResetAnimTicker( iExtension->iIsForeground );
}
}
void CAknIndicatorContainer::SizeChangedInIdleExtendedStatusPane()
{
TRect containerRect( Rect() );
if (iIndicatorContext == EUniversalIndicators)
{
iLayoutOrientation = EHorizontal;
}
// Available space for indicators
TRect rect(containerRect);
// If layout orientation has been changed since last call, prioritize indicators again.
if ( iLayoutOrientation != iPreviousLayoutOrientation )
{
TRAP_IGNORE ( PrioritizeIndicatorsL() );
}
iIndicatorsShown = 0;
iAnimatedIndicatorsShown = 0;
TInt last = iIndicators->Count() - 1;
if (iIndicatorContext == EUniversalIndicators)
{
TRect parent( rect );
TAknLayoutScalableParameterLimits limit =
AknLayoutScalable_Avkon::cell_indicator_nsta_pane_ParamLimits();
TInt maxIndicatorsShownInOneLine = 3; // magic
TAknLayoutRect layoutRect;
TAknWindowLineLayout cellLayout;
TAknWindowLineLayout indicatorLayout;
TInt totalIndicatorsOn = 0;
// Need to go through the indicator array two times
// to be able to place the indicators in correct order.
for ( TInt i = 0; i <= last; i++ )
{
CAknIndicator* indicator = iIndicators->At( i );
if ( indicator->IndicatorState() &&
indicator->Priority() != KIndicatorNotShown )
{
totalIndicatorsOn++;
}
}
for ( TInt ii = 0; ii <= last; ii++ )
{
CAknIndicator* indicator = iIndicators->At(ii);
if ( !indicator->IndicatorState() || (indicator->Priority() == KIndicatorNotShown))
{
// Indicator is not shown on current layout even it is set ON.
continue;
}
iIndicatorsShown++;
if (iIndicatorsShown > maxIndicatorsShownInOneLine * 2)
{
indicator->SetExtent(TPoint(0,0), TSize(0,0));
break;
}
else
{
TInt indicatorRow = ( iIndicatorsShown - 1 ) / maxIndicatorsShownInOneLine;
TInt columnVariety =
iIndicatorsShown - maxIndicatorsShownInOneLine * indicatorRow - 1;
if ( ( totalIndicatorsOn < maxIndicatorsShownInOneLine &&
indicatorRow == 0 ) ||
( totalIndicatorsOn > maxIndicatorsShownInOneLine &&
totalIndicatorsOn < maxIndicatorsShownInOneLine * 2 &&
indicatorRow == 1 ) )
{
if ( totalIndicatorsOn == 1 ||
totalIndicatorsOn == maxIndicatorsShownInOneLine + 1 )
{
columnVariety = maxIndicatorsShownInOneLine - 1;
}
else
{
columnVariety =
iIndicatorsShown - maxIndicatorsShownInOneLine * indicatorRow;
}
}
// set indicator sizes here...rightmost cell first
cellLayout = AknLayoutScalable_Avkon::cell_indicator_nsta_pane(
columnVariety,
2,
indicatorRow ).LayoutLine();
layoutRect.LayoutRect( parent, cellLayout );
TRect cell( layoutRect.Rect() );
indicatorLayout =
AknLayoutScalable_Avkon::cell_indicator_nsta_pane_g2().LayoutLine();
layoutRect.LayoutRect(cell,indicatorLayout);
TRect indicatorRect( layoutRect.Rect() );
// FIXME: Layout is broken, we fix it here. Remove this when layout is fixed.
if (indicatorRect.iBr.iX > cell.iBr.iX)
indicatorRect.iBr.iX = cell.iBr.iX;
if (indicatorRect.iTl.iX < cell.iTl.iX)
indicatorRect.iTl.iX = cell.iTl.iX;
// End of FIXME
// TBD: When touch is supported, the size may have to be reconsidered.
indicator->SetRect(indicatorRect);
}
if (indicator->IndicatorState() == MAknIndicator::EIndicatorAnimate)
{
iAnimatedIndicatorsShown++;
}
} // for
ResetAnimTicker( iExtension->iIsForeground );
} // if universal indicators
}
void CAknIndicatorContainer::SizeChangedInFlatStatusPane()
{
TRect containerRect(Rect());
if (iIndicatorContext == EUniversalIndicators)
{
iLayoutOrientation = EVertical;
}
// Available space for indicators
TRect rect(containerRect);
// If layout orientation has been changed since last call, prioritize indicators again.
if ( iLayoutOrientation != iPreviousLayoutOrientation )
{
TRAP_IGNORE ( PrioritizeIndicatorsL() );
}
iIndicatorsShown = 0;
iAnimatedIndicatorsShown = 0;
TInt last = iIndicators->Count() - 1;
if (iIndicatorContext == EUniversalIndicators)
{
TAknLayoutRect layoutRect;
TAknWindowComponentLayout indicatorLayout;
TBool extendedFlatLayout(
AknStatuspaneUtils::ExtendedFlatLayoutActive() );
for (TInt ii = 0; ii <= last; ii++)
{
CAknIndicator* indicator = iIndicators->At(ii);
if ( !indicator->IndicatorState() || (indicator->Priority() == KIndicatorNotShown))
{
// Indicator is not shown on current layout even it is set ON.
continue;
}
iIndicatorsShown++;
TBool showIndicator( ETrue );
switch ( iIndicatorsShown )
{
case 1:
{
indicatorLayout =
AknLayoutScalable_Avkon::uni_indicator_pane_g1( 1 );
break;
}
case 2:
{
indicatorLayout =
AknLayoutScalable_Avkon::uni_indicator_pane_g2( 1 );
break;
}
case 3:
{
indicatorLayout =
AknLayoutScalable_Avkon::uni_indicator_pane_g3( 1 );
break;
}
// TODO: Add support (remove the extendedFlatLayout checks
// below) for six indicators also in the extended flat layout
// once the layout data is fixed.
case 4:
{
if ( !extendedFlatLayout )
{
indicatorLayout =
AknLayoutScalable_Avkon::uni_indicator_pane_g4( 1 );
}
else
{
showIndicator = EFalse;
}
break;
}
case 5:
{
if ( !extendedFlatLayout )
{
indicatorLayout =
AknLayoutScalable_Avkon::uni_indicator_pane_g5( 1 );
}
else
{
showIndicator = EFalse;
}
break;
}
case 6:
{
if ( !extendedFlatLayout )
{
indicatorLayout =
AknLayoutScalable_Avkon::uni_indicator_pane_g6( 1 );
}
else
{
showIndicator = EFalse;
}
break;
}
default:
{
showIndicator = EFalse;
break;
}
}
if ( showIndicator )
{
layoutRect.LayoutRect( containerRect, indicatorLayout );
indicator->SetRect( layoutRect.Rect() );
}
else // Maximum indicator are shown, others are invisible.
{
indicator->SetExtent( TPoint( 0, 0 ), TSize( 0, 0 ) );
}
if (indicator->IndicatorState() == MAknIndicator::EIndicatorAnimate)
{
iAnimatedIndicatorsShown++;
}
} // for
ResetAnimTicker( iExtension->iIsForeground );
} // if universal indicators
}
// ---------------------------------------------------------------------------
// CAknIndicatorContainer::SizeChangedInStaconPane
// Handles size change events in stacon pane layouts.
// ---------------------------------------------------------------------------
//
void CAknIndicatorContainer::SizeChangedInStaconPane()
{
TRect containerRect( Rect() );
if ( iIndicatorContext == EUniversalIndicators )
{
if ( AknStatuspaneUtils::IdleLayoutActive() )
{
iLayoutOrientation = EHorizontal;
}
else
{
iLayoutOrientation = EVertical;
}
}
// Available space for indicators.
TRect rect( containerRect );
// If layout orientation has been changed since last call,
// prioritize indicators again.
if ( iLayoutOrientation != iPreviousLayoutOrientation )
{
// Following leave is ignored.
// In case of leave indicators are not maybe shown correctly.
TRAP_IGNORE ( PrioritizeIndicatorsL() );
}
iIndicatorsShown = 0;
iAnimatedIndicatorsShown = 0;
TInt last = iIndicators->Count() - 1;
if ( iIndicatorContext == EUniversalIndicators )
{
TRect parent( rect );
// Layout data for four indicators in stacon pane layout exists,
// but for only two indicators are shown.
for ( TInt ii = 0; ii <= last; ii++ )
{
CAknIndicator* indicator = iIndicators->At( ii );
if ( !indicator->IndicatorState() ||
indicator->Priority() == KIndicatorNotShown )
{
// Indicator is not shown on current layout even it is set ON.
continue;
}
iIndicatorsShown++;
// No fading is done to indicators until transparent
// windows are available, faders always set to NULL for now.
CAknIndicatorFader* topFader = NULL;
CAknIndicatorFader* bottomFader = NULL;
if ( AknStatuspaneUtils::StaconSoftKeysRight() )
{
if ( iIndicatorsShown == 1 )
{
indicator->SetIndicatorFader( topFader );
AknLayoutUtils::LayoutControl(
indicator,
parent,
AknLayoutScalable_Avkon::uni_indicator_pane_stacon_g1() );
}
else if ( iIndicatorsShown == 2 )
{
indicator->SetIndicatorFader( bottomFader );
AknLayoutUtils::LayoutControl(
indicator,
parent,
AknLayoutScalable_Avkon::uni_indicator_pane_stacon_g2() );
}
}
else if ( AknStatuspaneUtils::StaconSoftKeysLeft() )
{
// LAF does not contain mirrored lines. We mirror positions here.
if ( iIndicatorsShown == 1 )
{
indicator->SetIndicatorFader( topFader );
AknLayoutUtils::LayoutControl(
indicator,
parent,
AknLayoutScalable_Avkon::uni_indicator_pane_stacon_g3() );
}
else if ( iIndicatorsShown == 2 )
{
indicator->SetIndicatorFader( bottomFader );
AknLayoutUtils::LayoutControl(
indicator,
parent,
AknLayoutScalable_Avkon::uni_indicator_pane_stacon_g4() );
}
}
if ( iIndicatorsShown > 2 )
{
indicator->SetIndicatorFader( NULL );
indicator->SetExtent( TPoint( 0, 0 ), TSize( 0, 0 ) );
break;
}
if ( indicator->IndicatorState() == MAknIndicator::EIndicatorAnimate )
{
iAnimatedIndicatorsShown++;
}
} // for
ResetAnimTicker( iExtension->iIsForeground );
} // if universal indicators
// Currently uses small statuspane layouts in navipane indicators because not all exist for stacon yet.
else if ( iIndicatorContext == ENaviPaneEditorIndicators )
{
TBool isMirrored( AknLayoutUtils::LayoutMirrored() );
iLayoutOrientation = EHorizontal; // always horizontal
TRect containerRect( Rect() );
// Check if the secured connection indicator is on before
// reading the layouts because of different positioning
// of wait and progress bars with that indicator on.
TBool secureConnectionIndicOn( EFalse );
for ( TInt i = 0; i <= last; i++ )
{
CAknIndicator* indicator = iIndicators->At( i );
if ( indicator->Uid().iUid == EAknNaviPaneEditorIndicatorSecuredConnection &&
indicator->IndicatorState() &&
indicator->Priority() != KIndicatorNotShown )
{
secureConnectionIndicOn = ETrue;
}
}
// screen
TRect screenRect;
AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EScreen, screenRect );
// app window
TRect applicationWindowRect;
AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EApplicationWindow,
applicationWindowRect );
// small statuspane
TAknLayoutRect smallStatusPaneLayoutRect;
smallStatusPaneLayoutRect.LayoutRect(
applicationWindowRect,
TAknWindowComponentLayout::Compose(
AknLayoutScalable_Avkon::area_top_pane( 1 ),
AknLayoutScalable_Avkon::status_small_pane() ) );
TRect smallStatusPaneRect( smallStatusPaneLayoutRect.Rect() );
// small statuspane, wait pane
TAknLayoutRect smallStatusWaitPaneLayoutRect;
smallStatusWaitPaneLayoutRect.LayoutRect(
smallStatusPaneRect,
AknLayoutScalable_Avkon::status_small_wait_pane(
secureConnectionIndicOn ? 2 : 1 ) );
TRect smallStatusWaitPaneRect( smallStatusWaitPaneLayoutRect.Rect() );
// small statuspane, globe
TAknLayoutRect smallStatusWmlGlobeLayoutRect;
smallStatusWmlGlobeLayoutRect.LayoutRect(
smallStatusPaneRect,
AknLayoutScalable_Avkon::status_small_pane_g4( 0 ) );
TRect smallStatusWmlGlobeRect( smallStatusWmlGlobeLayoutRect.Rect() );
// small statuspane, GPRS indicator
TAknLayoutRect smallStatusGprsLayoutRect;
smallStatusGprsLayoutRect.LayoutRect(
smallStatusPaneRect,
AknLayoutScalable_Avkon::status_small_pane_g2( 0 ) );
TRect smallStatusGprsRect( smallStatusGprsLayoutRect.Rect() );
// small statuspane, secure state indicator
TAknLayoutRect smallStatusSecureStateLayoutRect;
smallStatusSecureStateLayoutRect.LayoutRect(
smallStatusPaneRect,
AknLayoutScalable_Avkon::status_small_pane_g3( 0 ) );
TRect smallStatusSecureStateRect( smallStatusSecureStateLayoutRect.Rect() );
// small statuspane, texts
TAknLayoutText textLayout;
textLayout.LayoutText(
containerRect,
AknLayoutScalable_Avkon::status_small_pane_t1( 0 ) );
TRect smallStatusTextRect( textLayout.TextRect() );
TInt textIndicatorLeftOffset = smallStatusTextRect.iTl.iX;
TInt textIndicatorVerticalOffset = smallStatusTextRect.iTl.iY;
TInt wmlWaitGlobeLeftOffset =
containerRect.Width() / 2 - smallStatusWmlGlobeRect.Width() / 2;
// Modify containerRect if alignment is Right.
// For Left aligned no need to modify containerRect.
if ( iAlignment == TIndicatorAlignment( ERight ) )
{
containerRect.iBr.iX -= 3; // Right margin of editor indicators
containerRect.iTl.iX += 0; // Left margin of editor indicators
}
iIndicatorsShown = 0;
iAnimatedIndicatorsShown = 0;
TBool textIndicatorOffsetNeeded = ETrue;
TRect rectForRightSideIndicators( containerRect.iBr.iX,
containerRect.iTl.iY,
containerRect.iBr.iX,
containerRect.iBr.iY );
TRect rectForLeftSideIndicators( containerRect.iTl.iX,
containerRect.iTl.iY,
containerRect.iTl.iX,
containerRect.iBr.iY );
TRect rectForMiddleIndicators( wmlWaitGlobeLeftOffset,
containerRect.iTl.iY,
wmlWaitGlobeLeftOffset,
containerRect.iBr.iY );
for ( TInt ii = 0; ii <= last; ii++ )
{
CAknIndicator* indicator = iIndicators->At( ii );
TInt uid = indicator->Uid().iUid;
TInt indicatorPosition = 0;
// decide here how indicators are positioned. Default is rigth side.
indicatorPosition = indicator->IndicatorPosition();
// Check if indicator is not shown on current layout even it is set ON.
if ( !indicator->IndicatorState() ||
indicator->Priority() == KIndicatorNotShown )
{
continue;
}
// Check if this is gprs indicator, it is never shown here but is drawn
// to the signal pane by the system
if ( uid == EAknNaviPaneEditorIndicatorGprs )
{
indicator->SetExtent( TPoint( 0, 0 ), TSize( 0, 0 ) );
iIndicatorsShown++;
continue;
}
else if ( uid == EAknNaviPaneEditorIndicatorWlanAvailable ||
uid == EAknNaviPaneEditorIndicatorWlanActive ||
uid == EAknNaviPaneEditorIndicatorWlanActiveSecure )
{
// These are not shown in stacon layout navi pane, as
// the same indicators are shown on the universal
// indicator pane.
indicator->SetExtent( TPoint( 0, 0 ), TSize( 0, 0 ) );
iIndicatorsShown++;
continue;
}
// handle offsets
TAknWindowLineLayout areaTopPaneLayout = AknLayoutScalable_Avkon::area_top_pane( 0 );
TAknLayoutRect areaTopPaneLayoutRect;
areaTopPaneLayoutRect.LayoutRect( screenRect, areaTopPaneLayout );
TAknWindowLineLayout statusPaneIconSmallLayout(
TAknWindowComponentLayout::Compose(
AknLayoutScalable_Avkon::area_top_pane( 1 ),
TAknWindowComponentLayout::Compose(
AknLayoutScalable_Avkon::status_small_pane(),
AknLayoutScalable_Avkon::status_small_icon_pane() ) ).LayoutLine() );
// If top pane area's vertical position doesn't start at 0,
// the statusPaneIconSmallRect's values will be incorrect and
// must be adjusted.
TInt offsetFromTop = areaTopPaneLayoutRect.Rect().iTl.iY;
TRect normSmallStatusPaneRect( smallStatusPaneRect );
normSmallStatusPaneRect.iTl.iY -= offsetFromTop;
statusPaneIconSmallLayout.it -= offsetFromTop;
TAknLayoutRect statusPaneIconSmallLayoutRect;
statusPaneIconSmallLayoutRect.LayoutRect(
normSmallStatusPaneRect, statusPaneIconSmallLayout );
TInt verticalOffset = statusPaneIconSmallLayoutRect.Rect().iTl.iY;
TInt leftOffset = 0; // default offset
TInt rightOffset = 0; // default offset
TInt indicatorWidth = indicator->IconSize().iWidth; // default width
TInt indicatorHeight = indicator->IconSize().iHeight; // default height
if ( uid == EAknNaviPaneEditorIndicatorMessageInfo ||
uid == EAknNaviPaneEditorIndicatorWmlWindowsText ||
uid == EAknNaviPaneEditorIndicatorMessageLength )
{
verticalOffset = textIndicatorVerticalOffset;
// first text idicator need horizontal offset
if ( textIndicatorOffsetNeeded )
{
leftOffset += textIndicatorLeftOffset;
}
textIndicatorOffsetNeeded = EFalse;
}
else if ( uid == EAknNaviPaneEditorIndicatorFileSize )
{
verticalOffset = textIndicatorVerticalOffset;
// Need left offset in western, right offset in A&H layout.
if ( isMirrored )
{
rightOffset = textIndicatorLeftOffset;
}
else
{
leftOffset = KMinSpaceBetweenIconsInPixels;
}
}
else if ( uid == EAknNaviPaneEditorIndicatorSecuredConnection )
{
verticalOffset = smallStatusSecureStateRect.iTl.iY;
// Because icon bitmap does not contain enough space,
// increase offset as the layout spec states.
if ( isMirrored )
{
leftOffset = KMinSpaceBetweenIconsInPixels;
}
else
{
rightOffset = KMinSpaceBetweenIconsInPixels;
}
textIndicatorOffsetNeeded = EFalse;
}
else if ( uid == EAknNaviPaneEditorIndicatorWmlWaitGlobe )
{
verticalOffset = (containerRect.Height() - indicator->IconSize().iHeight)/2;
indicatorWidth = smallStatusWmlGlobeRect.Width();
}
else if ( uid == EAknNaviPaneEditorIndicatorProgressBar )
{
verticalOffset = smallStatusWaitPaneRect.iTl.iY;
indicatorWidth = smallStatusWaitPaneRect.Width();
indicatorHeight = smallStatusWaitPaneRect.Height();
leftOffset = 0;
textIndicatorOffsetNeeded = ETrue;
}
else if ( uid == EAknNaviPaneEditorIndicatorWaitBar )
{
verticalOffset = smallStatusWaitPaneRect.iTl.iY;
indicatorWidth = smallStatusWaitPaneRect.Width();
indicatorHeight = smallStatusWaitPaneRect.Height();
leftOffset = 0;
textIndicatorOffsetNeeded = ETrue;
}
if ( isMirrored )
{
TInt temp = leftOffset;
leftOffset = rightOffset;
rightOffset = temp;
}
// Place indicators to the left side.
if ( ( indicatorPosition == ELeftSide &&
iAlignment == TIndicatorAlignment( ERight ) ) ||
( indicatorPosition == ERightSide &&
iAlignment == TIndicatorAlignment( ELeft ) ) )
{
TRect requiredRect(
rectForLeftSideIndicators.iBr.iX,
rectForLeftSideIndicators.iTl.iY,
rectForLeftSideIndicators.iBr.iX + leftOffset + indicatorWidth + rightOffset,
rectForLeftSideIndicators.iBr.iY );
// Check if indicator fits.
TBool indicatorDoesNotFit =
( requiredRect.Intersects( rectForRightSideIndicators ) ||
requiredRect.Intersects( rectForMiddleIndicators ) ||
containerRect.iTl.iX > requiredRect.iTl.iX ||
containerRect.iBr.iX < requiredRect.iBr.iX );
if ( indicatorDoesNotFit &&
!indicator->DynamicTextIndicator() )
{
indicator->SetExtent( TPoint( 0, 0 ), TSize( 0, 0 ) );
iIndicatorsShown++;
continue;
}
else
{
if ( indicator->DynamicTextIndicator() && indicatorDoesNotFit )
{
// Dynamic text indicators (not normal text indicators)
// can adjust to any size.
TInt maxWidthForDynamicTextIndicator =
containerRect.iBr.iX - requiredRect.iTl.iX;
if ( requiredRect.Intersects( rectForRightSideIndicators ) )
{
maxWidthForDynamicTextIndicator =
rectForRightSideIndicators.iTl.iX - requiredRect.iTl.iX;
}
if ( requiredRect.Intersects( rectForMiddleIndicators ) )
{
maxWidthForDynamicTextIndicator =
rectForMiddleIndicators.iTl.iX - requiredRect.iTl.iX;
}
indicator->SetExtent(
TPoint( requiredRect.iTl.iX + leftOffset, verticalOffset ),
TSize( maxWidthForDynamicTextIndicator, indicatorHeight ) );
rectForLeftSideIndicators.iBr.iX =
indicator->Position().iX + indicator->Size().iWidth;
}
else
{
indicator->SetExtent(
TPoint( requiredRect.iTl.iX + leftOffset, verticalOffset ),
TSize( indicatorWidth, indicatorHeight ) );
rectForLeftSideIndicators.iBr.iX = requiredRect.iBr.iX;
}
}
}
// Place indicators to the right side.
if ( ( indicatorPosition == ERightSide &&
iAlignment == TIndicatorAlignment( ERight ) ) ||
( indicatorPosition == ELeftSide &&
iAlignment == TIndicatorAlignment( ELeft ) ) )
{
TRect requiredRect(
rectForRightSideIndicators.iTl.iX - leftOffset - indicatorWidth - rightOffset,
rectForRightSideIndicators.iTl.iY,
rectForRightSideIndicators.iTl.iX,
rectForRightSideIndicators.iBr.iY );
// Check if indicator fits.
TBool indicatorDoesNotFit =
( requiredRect.Intersects( rectForLeftSideIndicators ) ||
requiredRect.Intersects( rectForMiddleIndicators ) ||
containerRect.iTl.iX > requiredRect.iTl.iX ||
containerRect.iBr.iX < requiredRect.iBr.iX );
if ( indicatorDoesNotFit &&
!indicator->DynamicTextIndicator() )
{
indicator->SetExtent( TPoint( 0, 0 ), TSize( 0, 0 ) );
iIndicatorsShown++;
continue;
}
else
{
if ( indicator->DynamicTextIndicator() &&
indicatorDoesNotFit )
{
// Dynamic text indicators (not normal text indicators)
// can adjust to any size.
TInt maxWidthForDynamicTextIndicator =
requiredRect.iBr.iX - containerRect.iTl.iX - leftOffset;
if ( requiredRect.Intersects( rectForLeftSideIndicators ) )
{
maxWidthForDynamicTextIndicator =
requiredRect.iBr.iX - rectForLeftSideIndicators.iBr.iX;
}
if ( requiredRect.Intersects( rectForMiddleIndicators ) )
{
maxWidthForDynamicTextIndicator =
requiredRect.iBr.iX - rectForMiddleIndicators.iBr.iX;
}
indicator->SetExtent(
TPoint( requiredRect.iBr.iX - maxWidthForDynamicTextIndicator + leftOffset,
verticalOffset),
TSize( maxWidthForDynamicTextIndicator, indicatorHeight ) );
rectForRightSideIndicators.iTl.iX = indicator->Position().iX;
}
else
{
indicator->SetExtent(
TPoint( requiredRect.iTl.iX + leftOffset, verticalOffset ),
TSize( indicatorWidth, indicatorHeight ) );
rectForRightSideIndicators.iTl.iX = requiredRect.iTl.iX;
}
}
}
// place indicators to the middle, only indicator is wml wait globe
if ( indicatorPosition == EMiddle )
{
TRect requiredRect(
rectForMiddleIndicators.iTl.iX,
rectForMiddleIndicators.iTl.iY,
rectForMiddleIndicators.iTl.iX + leftOffset + indicatorWidth + rightOffset,
rectForMiddleIndicators.iBr.iY );
// check if indicator fits
if ( requiredRect.Intersects( rectForRightSideIndicators ) ||
requiredRect.Intersects( rectForLeftSideIndicators ) ||
rectForMiddleIndicators.Width() != 0 )
{
indicator->SetExtent( TPoint( 0, 0 ), TSize( 0, 0 ) );
iIndicatorsShown++;
continue;
}
else
{
indicator->SetExtent( TPoint( rectForMiddleIndicators.iTl.iX + leftOffset,
verticalOffset ),
TSize( indicatorWidth, indicatorHeight ) );
rectForMiddleIndicators.iTl.iX += ( rightOffset + indicatorWidth );
}
}
iIndicatorsShown++;
if ( indicator->IndicatorState() == MAknIndicator::EIndicatorAnimate )
{
iAnimatedIndicatorsShown++;
}
} // for
}
ResetAnimTicker( iExtension->iIsForeground );
}
// ---------------------------------------------------------------------------
// CAknIndicatorContainer::SetIncallBubbleAllowedInIdle
// Allows/disallows showing the small incall status bubble of this container
// in idle status pane layouts.
// ---------------------------------------------------------------------------
//
EXPORT_C void CAknIndicatorContainer::SetIncallBubbleAllowedInIdle(
TBool aAllowed )
{
if ( iExtension )
{
iExtension->iIncallBubbleAllowedInIdle = aAllowed;
}
}
// ---------------------------------------------------------------------------
// CAknIndicatorContainer::SetIncallBubbleAllowedInUsual
// Allows/disallows showing the small incall status bubble of this container
// in usual status pane layouts.
// ---------------------------------------------------------------------------
//
EXPORT_C void CAknIndicatorContainer::SetIncallBubbleAllowedInUsual(
TBool aAllowed )
{
if ( iExtension )
{
iExtension->iIncallBubbleAllowedInUsual = aAllowed;
}
}
// ---------------------------------------------------------------------------
// CAknIndicatorContainer::SetIndicatorObserver
// Sets aIndicatorObserver to observe indicator with aIndicatorUid
// by looping through indicators to find indicator with aIndicaotrUid
// and calling SetIndicatorObserver to it with given pointer to observer
// ---------------------------------------------------------------------------
//
EXPORT_C void CAknIndicatorContainer::SetIndicatorObserver(
MAknIndicatorObserver* aIndicatorObserver,
TUid aIndicatorUid )
{
if ( AknLayoutUtils::PenEnabled() )
{
TInt count = iIndicators->Count();
// Loop through indicators and find indicator with given UID.
for ( TInt ii = 0; ii < count; ii++ )
{
CAknIndicator* indicator = iIndicators->At( ii );
// If indicator found, set aIndicatorObserver to observe it.
if ( indicator->Uid() == aIndicatorUid )
{
indicator->SetIndicatorObserver( aIndicatorObserver );
break;
}
}
}
}
// ---------------------------------------------------------------------------
// CAknIndicatorContainer::SetContainerWindowNonFading
// Allows/disallows fading of this pane.
// ---------------------------------------------------------------------------
//
void CAknIndicatorContainer::SetContainerWindowNonFading( TBool aNonFading )
{
CEikStatusPaneBase* statusPane = CEikStatusPaneBase::Current();
if ( statusPane )
{
CCoeControl* control = NULL;
TRAP_IGNORE(
control = statusPane->ContainerControlL(
TUid::Uid( EEikStatusPaneUidIndic ) ) );
if ( control )
{
control->DrawableWindow()->SetNonFading( aNonFading );
}
}
}
// ---------------------------------------------------------------------------
// CAknIndicatorContainer::SetupIndicatorLayoutModes
// Sets the appropriate layout mode to all the indicators inside
// this container.
// ---------------------------------------------------------------------------
//
void CAknIndicatorContainer::SetupIndicatorLayoutModes()
{
TInt mode = SelectIndicatorLayoutMode();
TInt count = iIndicators->Count();
for ( TInt ii = 0; ii < count; ii++ )
{
iIndicators->At( ii )->SetLayoutMode(
(CAknIndicator::TLayoutMode) mode );
}
}
// ---------------------------------------------------------------------------
// CAknIndicatorContainer::SelectIndicatorLayoutMode
// Decides the layout mode to be used for indicators inside this container.
// ---------------------------------------------------------------------------
//
TInt CAknIndicatorContainer::SelectIndicatorLayoutMode()
{
// Usually this can be used to decide mode...
TInt mode = ( Rect().Height() > Rect().Width() ) ?
CAknIndicator::ELayoutModeUsual :
CAknIndicator::ELayoutModeWide;
// But one exception is idle where we can have vertical indicators using "wide" mode.
if ( iIndicatorContext == EUniversalIndicators &&
AknStatuspaneUtils::IdleLayoutActive() )
{
mode = CAknIndicator::ELayoutModeWide;
// But exception to exception is portraitmode video telephony layout
CEikStatusPaneBase* statusPane = CEikStatusPaneBase::Current();
if ( statusPane )
{
TInt currentStatusPaneLayoutResId = statusPane->CurrentLayoutResId();
if ( currentStatusPaneLayoutResId == R_AVKON_STATUS_PANE_LAYOUT_VT ||
currentStatusPaneLayoutResId == R_AVKON_STATUS_PANE_LAYOUT_VT_MIRRORED )
{
mode = CAknIndicator::ELayoutModeUsual;
}
}
}
// Another thing is if universal indicators but not idle
else if ( iIndicatorContext == EUniversalIndicators &&
!AknStatuspaneUtils::IdleLayoutActive() )
{
mode = CAknIndicator::ELayoutModeUsual;
}
else if ( iIndicatorContext == EQueryEditorIndicators )
{
mode = CAknIndicator::ELayoutModeUsual;
}
return mode;
}
// ---------------------------------------------------------------------------
// CAknIndicatorContainer::SizeChangedInIdleVertical
// Handles size change events of vertically arranged universal indicator
// pane in idle status pane layout.
// ---------------------------------------------------------------------------
//
void CAknIndicatorContainer::SizeChangedInIdleVertical()
{
TRect containerRect( Rect() );
if ( iIndicatorContext == EUniversalIndicators )
{
iLayoutOrientation = EVertical;
}
// Available space for indicators
TRect rect( containerRect );
// If layout orientation has been changed since last call,
// prioritize indicators again.
if ( iLayoutOrientation != iPreviousLayoutOrientation )
{
TRAP_IGNORE ( PrioritizeIndicatorsL() );
}
iIndicatorsShown = 0;
iAnimatedIndicatorsShown = 0;
TInt last = iIndicators->Count() - 1;
if ( iIndicatorContext == EUniversalIndicators )
{
TRect parent( rect );
TAknLayoutRect layoutRect;
layoutRect.LayoutRect(
parent, AknLayoutScalable_Avkon::grid_indicator_pane() );
parent = layoutRect.Rect();
TRect indicatorRect( 0,0,0,0 );
TInt maxNumberOfIndicatorsShown =
AknLayoutScalable_Avkon::cell_indicator_pane_ParamLimits().LastRow();
for ( TInt ii = 0; ii <= last; ii++ )
{
CAknIndicator* indicator = iIndicators->At( ii );
if ( !indicator->IndicatorState() ||
indicator->Priority() == KIndicatorNotShown )
{
// Indicator is not shown on current layout even it is set ON.
continue;
}
layoutRect.LayoutRect(
parent,
AknLayoutScalable_Avkon::cell_indicator_pane( iIndicatorsShown ) );
indicatorRect = layoutRect.Rect();
indicator->SetRect( indicatorRect );
iIndicatorsShown++;
if ( iIndicatorsShown > maxNumberOfIndicatorsShown )
{
indicator->SetExtent( TPoint( 0, 0 ), TSize( 0, 0 ) );
break;
}
if ( indicator->IndicatorState() == MAknIndicator::EIndicatorAnimate )
{
iAnimatedIndicatorsShown++;
}
} // for
ResetAnimTicker( iExtension->iIsForeground );
} // if universal indicators
}
// ---------------------------------------------------------------------------
// CAknIndicatorContainer::CreateIndicatorFromResourceL
// Constructs a status indicator from an indicator resource.
// ---------------------------------------------------------------------------
//
EXPORT_C TUid CAknIndicatorContainer::CreateIndicatorFromResourceL(
TInt aIndicatorResourceId,
TInt aCustomIndicatorFlags )
{
CAknIndicator* newIndicator =
new (ELeave) CAknIndicator ( iIndicatorContext );
CleanupStack::PushL( newIndicator );
newIndicator->SetContainerWindowL( *this );
TResourceReader reader;
iCoeEnv->CreateResourceReaderLC( reader, aIndicatorResourceId );
newIndicator->ConstructFromResourceL( reader, this );
CleanupStack::PopAndDestroy(); // resource reader
// Always assign a dynamic UID to avoid clash with pre-defined indicators
TInt dynamicUid = EAknNaviPaneEditorIndicatorDynamicUidRangeFirst;
TInt count = iIndicators->Count();
// Loop through indicators and try to find a free dynamic UID.
while ( dynamicUid <= EAknNaviPaneEditorIndicatorDynamicUidRangeLast )
{
for ( TInt ii = 0; ii < count; ii++ )
{
CAknIndicator* indicator = iIndicators->At( ii );
if ( indicator->iUid == dynamicUid )
{
dynamicUid++;
break;
}
}
break;
}
if ( dynamicUid <= EAknNaviPaneEditorIndicatorDynamicUidRangeLast )
{
newIndicator->iUid = dynamicUid;
}
else
{
User::Leave( KErrGeneral ); // All dynamic UIDs already in use.
}
// Handle flags here
if ( aCustomIndicatorFlags & EMultiColorIndicator )
{
newIndicator->SetMultiColorMode( ETrue );
}
if ( aCustomIndicatorFlags & EIndicatorPositionInverted )
{
newIndicator->SetIndicatorPosition( ELeftSide );
}
else
{
newIndicator->SetIndicatorPosition( ERightSide );
}
// Finally add the new indicator and prioritize all.
TUid uid = TUid::Uid( newIndicator->iUid );
iIndicators->AppendL( newIndicator );
CleanupStack::Pop( newIndicator );
newIndicator = NULL;
PrioritizeIndicatorsL();
return uid;
}
// ---------------------------------------------------------------------------
// CAknIndicatorContainer::ReplaceIndicatorIconL
// Replaces the icon of an existing indicator.
// ---------------------------------------------------------------------------
//
EXPORT_C void CAknIndicatorContainer::ReplaceIndicatorIconL(
TUid aIndicator,
TInt /*aState*/,
TInt aLayoutMode,
CFbsBitmap* aIconBitmap,
CFbsBitmap* aIconMask,
TInt aIconIndex )
{
TInt count = iIndicators->Count();
CAknIndicator* indicator = NULL;
for ( TInt ii = 0; ii < count; ii++ )
{
indicator = iIndicators->At( ii );
if ( indicator && indicator->iUid == aIndicator.iUid )
{
// This ensures all default bitmaps are created.
indicator->CreateLoadedIndicatorBitmapsL();
if ( aIconBitmap &&
indicator->iIndicatorBitmaps[aLayoutMode]->At( aIconIndex ) )
{
delete indicator->iIndicatorBitmaps[aLayoutMode]->At( aIconIndex );
indicator->iIndicatorBitmaps[aLayoutMode]->At( aIconIndex ) = aIconBitmap;
}
if ( aIconMask &&
indicator->iIndicatorBitmaps[aLayoutMode]->At( aIconIndex + 1 ) )
{
delete indicator->iIndicatorBitmaps[aLayoutMode]->At( aIconIndex + 1 );
indicator->iIndicatorBitmaps[aLayoutMode]->At( aIconIndex + 1 ) = aIconMask;
}
break;
}
}
if ( indicator &&
( indicator->IndicatorState() || indicator->Priority() != KIndicatorNotShown ) )
{
SizeChanged();
DrawDeferred();
}
}
// ---------------------------------------------------------------------------
// CAknIndicatorContainer::CreateIndicatorFromPaneResourceL
// Creates a status indicator from an indicator pane resource.
// ---------------------------------------------------------------------------
//
void CAknIndicatorContainer::CreateIndicatorFromPaneResourceL(
TUid aUid,
TInt aIndicatorPaneResourceId,
TInt aCustomIndicatorFlags )
{
TResourceReader res;
iEikonEnv->CreateResourceReaderLC( res, aIndicatorPaneResourceId );
TInt indicatorCount = res.ReadInt16();
for ( TInt ii = 0; ii < indicatorCount; ii++ )
{
TInt foundUid = res.ReadInt16();
if ( foundUid == aUid.iUid )
{
res.Rewind( sizeof( TInt16 ) );
CAknIndicator* indicator =
new (ELeave) CAknIndicator ( iIndicatorContext );
CleanupStack::PushL( indicator );
indicator->SetContainerWindowL( *this );
indicator->ConstructFromResourceL( res, this );
iIndicators->AppendL( indicator );
if ( aCustomIndicatorFlags & EMultiColorIndicator )
{
indicator->SetMultiColorMode( ETrue );
}
// Editor indicator positions are set separately.
if ( iIndicatorContext == EUniversalIndicators )
{
if ( aCustomIndicatorFlags & EIndicatorPositionInverted )
{
indicator->SetIndicatorPosition( ELeftSide );
}
else
{
indicator->SetIndicatorPosition( ERightSide );
}
}
indicator->SetLayoutMode(
(CAknIndicator::TLayoutMode) SelectIndicatorLayoutMode() );
CleanupStack::Pop( indicator );
indicator = NULL;
break;
}
else
{
res.ReadInt16();
res.ReadInt16();
HBufC* bitmapFile = res.ReadHBufCL(); // bmp filename
delete bitmapFile;
bitmapFile = NULL;
TInt numberOfStates = res.ReadInt16(); // Number of states
for ( TInt i = 0; i < numberOfStates; i++ )
{
res.ReadInt16(); // State id
TInt numberOfIcons = res.ReadInt16();
for ( TInt j = 0; j < numberOfIcons; j++ )
{
for ( TInt jj = ELayoutModeUsual; jj <= ELayoutModeWide; jj++ )
{
res.ReadInt16(); // bitmaps
res.ReadInt16(); // mask
}
}
}
}
}
CleanupStack::PopAndDestroy(); // res
}
// ---------------------------------------------------------------------------
// CAknIndicatorContainer::IndicatorExists
// Checks if an indicator already exists in the indicator array.
// ---------------------------------------------------------------------------
//
TBool CAknIndicatorContainer::IndicatorExists( TUid aUid ) const
{
TBool exists( EFalse );
TInt count = iIndicators->Count();
for ( TInt ii = 0; ii < count; ii++ )
{
if ( iIndicators->At( ii )->Uid() == aUid )
{
exists = ETrue;
break;
}
}
return exists;
}
// ---------------------------------------------------------------------------
// CAknIndicatorContainer::CreateIncallBubbleL
// Creates the small incall status bubble.
// ---------------------------------------------------------------------------
//
void CAknIndicatorContainer::CreateIncallBubbleL()
{
// Create incall indicator, use empty rect.
// Correct size is set in IncallBubbleSizeChanged.
iIncallBubble = CIncallStatusBubble::NewL( TRect() );
iIncallBubble->SetFlags( 0 );
iIncallBubble->MakeVisible( EFalse );
iIncallBubble->SetFaded( CAknSgcClient::IsSystemFaded() );
}
TBool CAknIndicatorContainer::UpdateSmallLayoutL()
{
// Needed only if small status pane is in use.
if ( AknStatuspaneUtils::SmallLayoutActive() )
{
CEikStatusPaneBase* statusPane = CEikStatusPaneBase::Current();
if ( statusPane )
{
TInt statusPaneCurrentLayoutResourceId = statusPane->CurrentLayoutResId();
TInt statusPaneRequiredLayoutResourceId =
AVKONENV->StatusPaneResIdForCurrentLayout(R_AVKON_STATUS_PANE_LAYOUT_SMALL);
TInt last = iIndicators->Count() - 1;
for (TInt j = 0; j <= last; j++)
{
CAknIndicator* indicator = iIndicators->At(j);
TUid uid = indicator->Uid();
if ( uid == TUid::Uid(EAknNaviPaneEditorIndicatorGprs) )
{
if ( indicator->IndicatorState() )
{
if ( AknLayoutUtils::LayoutMirrored() )
{
statusPaneRequiredLayoutResourceId =
AVKONENV->StatusPaneResIdForCurrentLayout(
R_AVKON_STATUS_PANE_LAYOUT_SMALL_WITH_SIGNAL_PANE_MIRRORED);
}
else
{
statusPaneRequiredLayoutResourceId =
AVKONENV->StatusPaneResIdForCurrentLayout(
R_AVKON_STATUS_PANE_LAYOUT_SMALL_WITH_SIGNAL_PANE);
}
break;
}
}
}
// switch layout if needed
if ( statusPaneCurrentLayoutResourceId != statusPaneRequiredLayoutResourceId )
{
if (iExtension && !iExtension->iSwitchLayoutInProgress)
{
iExtension->iSwitchLayoutInProgress = ETrue;
statusPane->SwitchLayoutL( statusPaneRequiredLayoutResourceId );
return ETrue;
}
}
else
{
if (iExtension)
{
iExtension->iSwitchLayoutInProgress = EFalse;
}
}
}
}
// layout not changed
return EFalse;
}
void CAknIndicatorContainer::SetIncallBubbleDisabled( TBool aDisabled )
{
if ( iExtension )
{
iExtension->iIncallBubbleDisabled = aDisabled;
}
}
void CAknIndicatorContainer::ResetAnimTicker( TBool bForeground )
{
iExtension->iIsForeground = bForeground;
CEikStatusPaneBase* statusPane = CEikStatusPaneBase::Current();
TInt curId = R_AVKON_STATUS_PANE_LAYOUT_USUAL;
if ( statusPane )
{
curId = statusPane->CurrentLayoutResId();
}
// if not foreground, cancel the timer
if ( !iExtension->iIsForeground ||
R_AVKON_STATUS_PANE_LAYOUT_EMPTY == curId )
{
if ( iTicker->IsActive() )
{
iTicker->Cancel();
}
return;
}
if ( !iTicker->IsActive() && iAnimatedIndicatorsShown > 0 )
{
iTicker->Start( KAknIndicatorAnimationShortDelay,
KAknIndicatorAnimationInterval,
TCallBack( TickerCallback, this ) );
}
else if ( iTicker->IsActive() && iAnimatedIndicatorsShown == 0 )
{
// Cancel animation timer if animated indicators
// are not visible anymore.
iTicker->Cancel();
iSynchronizingValue = 0;
}
}
// End of File
| [
"kirill.dremov@nokia.com"
] | kirill.dremov@nokia.com |
41587f550e5f0c2853c93c0401b7e4a41e313512 | fe765f287b685e9136a88f3012293a9ba22a055e | /applications/pwm.cpp | 98df2de838513b0f105f014ad58faac5c1c1a8b3 | [] | no_license | 269785814zcl/Smartkiller | fbfe257c79c37bafca2499a4e7fbc8fa18477687 | ca94333da8df813fd7f2973605a61760406da56f | refs/heads/main | 2023-01-14T15:51:35.531353 | 2020-11-15T13:30:09 | 2020-11-15T13:30:09 | 313,037,128 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 936 | cpp | #ifdef __cplusplus
extern "C" {
#endif
#include <rtthread.h>
#include <rthw.h>
#include <ls1c.h>
#include <stdlib.h>
#include "../libraries/ls1c_public.h"
#include "../libraries/ls1c_gpio.h"
#include "../libraries/ls1c_delay.h"
#include "../libraries/ls1c_pwm.h"
#ifdef __cplusplus
}
#endif
#include "pwm.h"
pwm_info_t pwm2_info;
void pwm2_init(float duty,unsigned long period)
{
pwm2_info.gpio = LS1C_PWM2_GPIO46; // pwm引脚位gpio46
pwm2_info.mode = PWM_MODE_NORMAL; // 正常模式--连续输出pwm波形
pwm2_info.duty = duty; // pwm占空比
pwm2_info.period_ns = period; // pwm周期5ms
// pwm初始化,初始化后立即产生pwm波形
pwm_init(&pwm2_info);
return ;
}
void pwm2_enable(void)
{
// 使能pwm
pwm_enable(&pwm2_info);
}
void pwm2_disable(void)
{
// 禁止pwm
pwm_disable(&pwm2_info);
}
| [
"269785814@qq.com"
] | 269785814@qq.com |
8c920e7093864405405901697f2191271930905a | ee0f0c7a35a07788d5242165f6274d701e7a92be | /plugins/WinVST/Beam/BeamProc.cpp | 5871eb5c12a3b445439291ceeff0c71d2f1b744f | [
"MIT"
] | permissive | alessandrostone/airwindows | 64ea3b64ac7f51c7d91f9fddb49fbd6428af4698 | c653c8b38fdc79f61ee191052901ac2012d476b4 | refs/heads/master | 2022-11-11T17:43:41.889091 | 2020-07-06T02:01:06 | 2020-07-06T02:01:06 | 277,970,486 | 1 | 0 | null | 2020-07-08T02:31:54 | 2020-07-08T02:31:53 | null | UTF-8 | C++ | false | false | 9,377 | cpp | /* ========================================
* Beam - Beam.h
* Copyright (c) 2016 airwindows, All rights reserved
* ======================================== */
#ifndef __Beam_H
#include "Beam.h"
#endif
void Beam::processReplacing(float **inputs, float **outputs, VstInt32 sampleFrames)
{
float* in1 = inputs[0];
float* in2 = inputs[1];
float* out1 = outputs[0];
float* out2 = outputs[1];
int processing = (VstInt32)( A * 1.999 );
float sonority = B * 1.618033988749894848204586;
double overallscale = 1.0;
overallscale /= 44100.0;
overallscale *= getSampleRate();
int depth = (int)(17.0*overallscale);
if (depth < 3) depth = 3;
if (depth > 98) depth = 98;
bool highres = false;
if (processing == 1) highres = true;
float scaleFactor;
if (highres) scaleFactor = 8388608.0;
else scaleFactor = 32768.0;
float derez = C;
if (derez > 0.0) scaleFactor *= pow(1.0-derez,6);
if (scaleFactor < 0.0001) scaleFactor = 0.0001;
float outScale = scaleFactor;
if (outScale < 8.0) outScale = 8.0;
while (--sampleFrames >= 0)
{
long double inputSampleL = *in1;
long double inputSampleR = *in2;
if (fabs(inputSampleL)<1.18e-37) inputSampleL = fpd * 1.18e-37;
fpd ^= fpd << 13; fpd ^= fpd >> 17; fpd ^= fpd << 5;
if (fabs(inputSampleR)<1.18e-37) inputSampleR = fpd * 1.18e-37;
fpd ^= fpd << 13; fpd ^= fpd >> 17; fpd ^= fpd << 5;
inputSampleL *= scaleFactor;
inputSampleR *= scaleFactor;
//0-1 is now one bit, now we dither
//We are doing it first Left, then Right, because the loops may run faster if
//they aren't too jammed full of variables. This means re-running code.
//begin left
int quantA = floor(inputSampleL);
int quantB = floor(inputSampleL+1.0);
//to do this style of dither, we quantize in either direction and then
//do a reconstruction of what the result will be for each choice.
//We then evaluate which one we like, and keep a history of what we previously had
float expectedSlewA = 0;
for(int x = 0; x < depth; x++) {
expectedSlewA += (lastSampleL[x+1] - lastSampleL[x]);
}
float expectedSlewB = expectedSlewA;
expectedSlewA += (lastSampleL[0] - quantA);
expectedSlewB += (lastSampleL[0] - quantB);
//now we have a collection of all slews, averaged and left at total scale
float clamp = sonority;
if (fabs(inputSampleL) < sonority) clamp = fabs(inputSampleL);
float testA = fabs(fabs(expectedSlewA)-clamp);
float testB = fabs(fabs(expectedSlewB)-clamp);
//doing this means the result will be lowest when it's reaching the target slope across
//the desired time range, either positively or negatively. Should produce the same target
//at whatever sample rate, as high rate stuff produces smaller increments.
if (testA < testB) inputSampleL = quantA;
else inputSampleL = quantB;
//select whichever one departs LEAST from the vector of averaged
//reconstructed previous final samples. This will force a kind of dithering
//as it'll make the output end up as smooth as possible
for(int x = depth; x >=0; x--) {
lastSampleL[x+1] = lastSampleL[x];
}
lastSampleL[0] = inputSampleL;
//end left
//begin right
quantA = floor(inputSampleR);
quantB = floor(inputSampleR+1.0);
//to do this style of dither, we quantize in either direction and then
//do a reconstruction of what the result will be for each choice.
//We then evaluate which one we like, and keep a history of what we previously had
expectedSlewA = 0;
for(int x = 0; x < depth; x++) {
expectedSlewA += (lastSampleR[x+1] - lastSampleR[x]);
}
expectedSlewB = expectedSlewA;
expectedSlewA += (lastSampleR[0] - quantA);
expectedSlewB += (lastSampleR[0] - quantB);
//now we have a collection of all slews, averaged and left at total scale
clamp = sonority;
if (fabs(inputSampleR) < sonority) clamp = fabs(inputSampleR);
testA = fabs(fabs(expectedSlewA)-clamp);
testB = fabs(fabs(expectedSlewB)-clamp);
//doing this means the result will be lowest when it's reaching the target slope across
//the desired time range, either positively or negatively. Should produce the same target
//at whatever sample rate, as high rate stuff produces smaller increments.
if (testA < testB) inputSampleR = quantA;
else inputSampleR = quantB;
//select whichever one departs LEAST from the vector of averaged
//reconstructed previous final samples. This will force a kind of dithering
//as it'll make the output end up as smooth as possible
for(int x = depth; x >=0; x--) {
lastSampleR[x+1] = lastSampleR[x];
}
lastSampleR[0] = inputSampleR;
//end right
inputSampleL /= outScale;
inputSampleR /= outScale;
*out1 = inputSampleL;
*out2 = inputSampleR;
*in1++;
*in2++;
*out1++;
*out2++;
}
}
void Beam::processDoubleReplacing(double **inputs, double **outputs, VstInt32 sampleFrames)
{
double* in1 = inputs[0];
double* in2 = inputs[1];
double* out1 = outputs[0];
double* out2 = outputs[1];
int processing = (VstInt32)( A * 1.999 );
float sonority = B * 1.618033988749894848204586;
double overallscale = 1.0;
overallscale /= 44100.0;
overallscale *= getSampleRate();
int depth = (int)(17.0*overallscale);
if (depth < 3) depth = 3;
if (depth > 98) depth = 98;
bool highres = false;
if (processing == 1) highres = true;
float scaleFactor;
if (highres) scaleFactor = 8388608.0;
else scaleFactor = 32768.0;
float derez = C;
if (derez > 0.0) scaleFactor *= pow(1.0-derez,6);
if (scaleFactor < 0.0001) scaleFactor = 0.0001;
float outScale = scaleFactor;
if (outScale < 8.0) outScale = 8.0;
while (--sampleFrames >= 0)
{
long double inputSampleL = *in1;
long double inputSampleR = *in2;
if (fabs(inputSampleL)<1.18e-43) inputSampleL = fpd * 1.18e-43;
fpd ^= fpd << 13; fpd ^= fpd >> 17; fpd ^= fpd << 5;
if (fabs(inputSampleR)<1.18e-43) inputSampleR = fpd * 1.18e-43;
fpd ^= fpd << 13; fpd ^= fpd >> 17; fpd ^= fpd << 5;
inputSampleL *= scaleFactor;
inputSampleR *= scaleFactor;
//0-1 is now one bit, now we dither
//We are doing it first Left, then Right, because the loops may run faster if
//they aren't too jammed full of variables. This means re-running code.
//begin left
int quantA = floor(inputSampleL);
int quantB = floor(inputSampleL+1.0);
//to do this style of dither, we quantize in either direction and then
//do a reconstruction of what the result will be for each choice.
//We then evaluate which one we like, and keep a history of what we previously had
float expectedSlewA = 0;
for(int x = 0; x < depth; x++) {
expectedSlewA += (lastSampleL[x+1] - lastSampleL[x]);
}
float expectedSlewB = expectedSlewA;
expectedSlewA += (lastSampleL[0] - quantA);
expectedSlewB += (lastSampleL[0] - quantB);
//now we have a collection of all slews, averaged and left at total scale
float clamp = sonority;
if (fabs(inputSampleL) < sonority) clamp = fabs(inputSampleL);
float testA = fabs(fabs(expectedSlewA)-clamp);
float testB = fabs(fabs(expectedSlewB)-clamp);
//doing this means the result will be lowest when it's reaching the target slope across
//the desired time range, either positively or negatively. Should produce the same target
//at whatever sample rate, as high rate stuff produces smaller increments.
if (testA < testB) inputSampleL = quantA;
else inputSampleL = quantB;
//select whichever one departs LEAST from the vector of averaged
//reconstructed previous final samples. This will force a kind of dithering
//as it'll make the output end up as smooth as possible
for(int x = depth; x >=0; x--) {
lastSampleL[x+1] = lastSampleL[x];
}
lastSampleL[0] = inputSampleL;
//end left
//begin right
quantA = floor(inputSampleR);
quantB = floor(inputSampleR+1.0);
//to do this style of dither, we quantize in either direction and then
//do a reconstruction of what the result will be for each choice.
//We then evaluate which one we like, and keep a history of what we previously had
expectedSlewA = 0;
for(int x = 0; x < depth; x++) {
expectedSlewA += (lastSampleR[x+1] - lastSampleR[x]);
}
expectedSlewB = expectedSlewA;
expectedSlewA += (lastSampleR[0] - quantA);
expectedSlewB += (lastSampleR[0] - quantB);
//now we have a collection of all slews, averaged and left at total scale
clamp = sonority;
if (fabs(inputSampleR) < sonority) clamp = fabs(inputSampleR);
testA = fabs(fabs(expectedSlewA)-clamp);
testB = fabs(fabs(expectedSlewB)-clamp);
//doing this means the result will be lowest when it's reaching the target slope across
//the desired time range, either positively or negatively. Should produce the same target
//at whatever sample rate, as high rate stuff produces smaller increments.
if (testA < testB) inputSampleR = quantA;
else inputSampleR = quantB;
//select whichever one departs LEAST from the vector of averaged
//reconstructed previous final samples. This will force a kind of dithering
//as it'll make the output end up as smooth as possible
for(int x = depth; x >=0; x--) {
lastSampleR[x+1] = lastSampleR[x];
}
lastSampleR[0] = inputSampleR;
//end right
inputSampleL /= outScale;
inputSampleR /= outScale;
*out1 = inputSampleL;
*out2 = inputSampleR;
*in1++;
*in2++;
*out1++;
*out2++;
}
}
| [
"jinx6568@sover.net"
] | jinx6568@sover.net |
9886bfc4880c1587c68699c6c15b20cb4238dba1 | 545d1aa7075c423ac22d5057684d444c72d9a8c2 | /codes/1624-Largest-Substring-Between-Two-Equal-Characters/cpp/main1.cpp | b92ac0e5c7e6ce2a57fd020e6e3ab1080a7fc6ba | [] | no_license | Stackingrule/LeetCode-Solutions | da9420953b0e56bb76f026f5c1a4a48cd404641d | 3f7d22dd94eef4e47f3c19c436b00c40891dc03b | refs/heads/main | 2023-08-28T00:43:37.871877 | 2021-10-14T02:55:42 | 2021-10-14T02:55:42 | 207,331,384 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 329 | cpp | class Solution {
public:
int maxLengthBetweenEqualCharacters(string s) {
vector<int> first(26, -1);
int ans = -1;
for (int i = 0; i < s.length(); ++i) {
int& p = first[s[i] - 'a'];
if (p != -1) {
ans = max(ans, i - p - 1);
} else {
p = i;
}
}
return ans;
}
}; | [
"38368554+Stackingrule@users.noreply.github.com"
] | 38368554+Stackingrule@users.noreply.github.com |
dd4f430aa8ecf6b16b520397fc084bbddf9d77e4 | f9acdd09e1f826fafaf0bbaed93a4f2c078978a1 | /jsk_recognition/jsk_pcl_ros/include/jsk_pcl_ros/euclidean_cluster_extraction_nodelet.h | 3554d635d7b19f07cfaaad214a723223c6f7b633 | [] | no_license | tom-fido/ffit | 10a9d5ec2d23e07d99c76c391cc88b9248cf08b3 | dcd03b2665311994df721820be068cd96d7ae893 | refs/heads/master | 2020-05-18T22:00:05.744251 | 2019-05-03T01:09:27 | 2019-05-03T01:09:27 | 184,678,695 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,926 | h | // -*- mode: C++ -*-
/*********************************************************************
* Software License Agreement (BSD License)
*
* Copyright (c) 2013, Ryohei Ueda and JSK Lab
* 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/o2r other materials provided
* with the distribution.
* * Neither the name of the JSK Lab 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.
*********************************************************************/
#ifndef JSK_PCL_ROS_EUCLIDEAN_CLUSTER_EXTRACTION_NODELET_H_
#define JSK_PCL_ROS_EUCLIDEAN_CLUSTER_EXTRACTION_NODELET_H_
#include <ros/ros.h>
#include <ros/names.h>
#include <std_msgs/ColorRGBA.h>
#include <dynamic_reconfigure/server.h>
#include <pcl_ros/pcl_nodelet.h>
#include <pcl/point_types.h>
#include <pcl/impl/point_types.hpp>
#include <pcl/kdtree/kdtree_flann.h>
#include <pcl/segmentation/sac_segmentation.h>
#include <pcl/segmentation/extract_clusters.h>
#include <pcl/filters/extract_indices.h>
#include <pcl/common/centroid.h>
#include "jsk_recognition_msgs/ClusterPointIndices.h"
#include "jsk_recognition_msgs/EuclideanSegment.h"
#include "jsk_recognition_msgs/Int32Stamped.h"
#include "jsk_pcl_ros/EuclideanClusteringConfig.h"
#include <Eigen/StdVector>
#include "jsk_recognition_utils/pcl_util.h"
#include "jsk_recognition_utils/pcl_conversion_util.h"
#include <jsk_topic_tools/time_accumulator.h>
#include <jsk_topic_tools/diagnostic_nodelet.h>
namespace jsk_pcl_ros
{
class EuclideanClustering : public jsk_topic_tools::DiagnosticNodelet
{
public:
typedef jsk_pcl_ros::EuclideanClusteringConfig Config;
typedef std::vector<Eigen::Vector4f,
Eigen::aligned_allocator<Eigen::Vector4f> >
Vector4fVector;
EuclideanClustering() : DiagnosticNodelet("EuclideanClustering") {}
protected:
boost::shared_ptr <dynamic_reconfigure::Server<Config> > srv_;
boost::mutex mutex_;
void configCallback (Config &config, uint32_t level);
ros::Publisher result_pub_;
ros::Subscriber sub_input_;
ros::Publisher cluster_num_pub_;
ros::ServiceServer service_;
double tolerance;
double label_tracking_tolerance;
int minsize_;
int maxsize_;
jsk_topic_tools::TimeAccumulator segmentation_acc_;
jsk_topic_tools::TimeAccumulator kdtree_acc_;
jsk_recognition_utils::Counter cluster_counter_;
// the list of COGs of each cluster
Vector4fVector cogs_;
virtual void onInit();
virtual void extract(const sensor_msgs::PointCloud2ConstPtr &input);
bool serviceCallback(jsk_recognition_msgs::EuclideanSegment::Request &req,
jsk_recognition_msgs::EuclideanSegment::Response &res);
virtual void updateDiagnostic(diagnostic_updater::DiagnosticStatusWrapper &stat);
virtual std::vector<pcl::PointIndices> pivotClusterIndices(
std::vector<int>& pivot_table,
std::vector<pcl::PointIndices>& cluster_indices);
virtual std::vector<int> buildLabelTrackingPivotTable(
double* D,
Vector4fVector cogs,
Vector4fVector new_cogs,
double label_tracking_tolerance);
virtual void computeDistanceMatrix(
double* D,
Vector4fVector& old_cogs,
Vector4fVector& new_cogs);
virtual void
computeCentroidsOfClusters(Vector4fVector& ret,
pcl::PointCloud<pcl::PointXYZ>::Ptr cloud,
std::vector<pcl::PointIndices> cluster_indices);
virtual void subscribe();
virtual void unsubscribe();
};
}
#endif
| [
"thomas.butterworth0@gmail.com"
] | thomas.butterworth0@gmail.com |
e8a055cad6aabc0379c7ab3ca6250618f6f0b7a4 | bf09b499edc5bf2e47a43c7c2dd4cd4bcc53255b | /App/SmartReporter/CustomDataReportDlg.h | f8701b0de1e61654ce7580ff64147d393cd17948 | [] | no_license | 15831944/SmartISO | 95ab3319f1005daf9aa3fc1e38a3f010118a8d20 | 5040e76891190b2146f171e03445343dc005d3be | refs/heads/main | 2023-04-12T19:06:21.472281 | 2021-05-03T04:12:59 | 2021-05-03T04:12:59 | null | 0 | 0 | null | null | null | null | UHC | C++ | false | false | 3,350 | h | #if !defined(AFX_CUSTOMDATAREPORTDLG_H__A8E692D6_40E8_47A2_84FA_B0E1A69C1747__INCLUDED_)
#define AFX_CUSTOMDATAREPORTDLG_H__A8E692D6_40E8_47A2_84FA_B0E1A69C1747__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// LineListReportDlg.h : header file
//
#include <BtnST.h>
#include <ListCtrlEx.h>
#include <ado\AdoRemoteDB.h>
#include <LabelStatic.h>
#include "CheckTreeCtrl.h"
#include "PDSArea.h"
#include "LineListToOraDocData.h"
#include <vector>
using namespace std;
/////////////////////////////////////////////////////////////////////////////
// CCustomReportData dialog
class CCustomReportData
{
public:
enum
{
AREA_NAME = 0,
MODEL_NO = 1,
NOMINAL_DIA = 3,
FLUID_CODE = 6,
INSULATION_PURPOSE = 9,
INSULATION_THICK = 10
};
void InsertAt(const STRING_T &sFieldName , const STRING_T &sValue, CPDSOracle &PDSOracle);
static CString GetQueryString(const CString& sProjectUnit , const CString& rProjectName , const CString& rTableName ,
CCustomReportTable* pCustomReportTable);
int GetColCount() const;
CCustomReportData(){}
CCustomReportData(const CCustomReportData& rhs);
CCustomReportData& operator=(const CCustomReportData& rhs);
virtual ~CCustomReportData(){}
vector<STRING_T> m_vecData;
};
class CCustomDataReportDlg : public CDialog
{
// Construction
public:
void UpdateReportData();
CCustomDataReportDlg(CCustomReportTable* pCustomReportTable , CWnd* pParent = NULL); // standard constructor
// Dialog Data
//{{AFX_DATA(CLineListReportDlg)
enum { IDD = IDD_CUSTOM_DATA_REPORT };
// NOTE: the ClassWizard will add data members here
CLabelStatic m_wndLabelStatic;
CButtonST m_wndQueryButton;
CButtonST m_wndExcelExportButton;
CButtonST m_wndSelectAllAreaNoButton;
CCheckTreeCtrl m_wndCheckAreaTreeCtrl;
CButtonST m_wndRefreshButton;
CListCtrlEx m_wndReportCtrl;
//}}AFX_DATA
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CLineListReportDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
CCustomReportTable* m_pCustomReportTable; //! 2011.05.04 - added by humkyung
CBitmap m_bitmap; ///< 16 color이상의 bitmap을 읽기 위해
CImageList m_imgTree , m_imgList , m_imgState;
vector<CCustomReportData> m_CustomReportDataEntry;
// Generated message map functions
//{{AFX_MSG(CLineListReportDlg)
afx_msg void OnSize(UINT nType, int cx, int cy);
virtual BOOL OnInitDialog();
afx_msg void OnSelectAllArea();
afx_msg void OnButtonExcelExport();
afx_msg void OnButtonQuery();
afx_msg void OnButtonRefresh();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
private:
UINT StatusQueryThread();
UINT StatusExportThread();
static UINT StatusQueryThreadEntry(LPVOID pVoid);
static UINT StatusExportThreadEntry(LPVOID pVoid);
void CheckAllArea(HTREEITEM hItem);
void SyncAreaDataWith(HTREEITEM hItem);
BOOL IsSelected(const CString& rArea , const CString& rModel);
list<STRING_T> m_lstHeaderString;
vector<CPDSArea> m_AreaNameEntry;
void SaveDataForReport();
public:
afx_msg BOOL OnHelpInfo(HELPINFO* pHelpInfo);
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_CUSTOMDATAREPORTDLG_H__A8E692D6_40E8_47A2_84FA_B0E1A69C1747__INCLUDED_)
| [
"humkyung@atools.co.kr"
] | humkyung@atools.co.kr |
4d67bf96446640c17c4273ea4500ca8f71b7adb2 | 1c7beb88b5640cdee23e6dcda5538b0b4ba5a6ba | /implement/kun/ui/popmenu.h | 9a62afc7e104570e665fecf94990a2d3332eee48 | [] | no_license | jhubrt/cpp_kun | 56ee62b846ff3e808f416c8603621396301e8545 | fd752ff141bf0d8ff0c3954b27f07aa2fe702a0e | refs/heads/master | 2022-10-08T05:43:03.180093 | 2017-05-26T07:26:48 | 2017-05-26T07:26:48 | 91,508,719 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,197 | h | // The MIT License (MIT)
//
// Copyright(c) 2016-2017 Jerome Hubert
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software
// and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation the rights to use,
// copy, modify, merge, publish, distribute, sublicense, and / or sell copies of the Software,
// and to permit persons to whom the Software is furnished to do so, subject to the following conditions :
//
// The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#pragma once
#include "implement\kun\ui\events.h"
#include "implement\kun\ui\widget.h"
#include "implement\kun\ui\button.h"
namespace kun
{
class Palette;
class Surface;
namespace ui
{
class WidgetManager;
struct ButtonConfig;
class Button;
class GraphicInstance;
struct PopMenuFrameConfig : public FrameConfig
{
virtual Widget* Create(Widget* _parent, const Skin& _skin) const;
};
struct PopMenuConfig : public WidgetConfig
{
bool m_horizontal;
float m_padding;
//grafx::Font* _font,
std::vector<ButtonConfig> m_buttons;
std::vector<PopMenuConfig> m_popmenus;
Widget* Create(Widget* _parent, const Skin& _skin) const;
};
class PopMenuFrame : public Widget
{
WidgetManager* m_widgetManager;
virtual bool processInput(const InputEvent& _inputEvent, const InputDevice& _inputDevice);
//virtual void update (DeltaTime _time);
Button* m_popButton;
virtual void update(float _dt);
typedef PopMenuFrame ThisClass;
public:
PopMenuFrame(NameCRC _name, WidgetManager* _manager, Widget* _parent);
void assignPopButton(Button* _popButton);
bool closeAll(const Message& _message);
KREF_POLYMORPH_METHOD_WRAPPER1(closeAll, const Message&)
};
class PopMenu : public Widget
{
enum State
{
State_CLOSED,
State_OPENING,
State_OPENED,
State_CLOSING
};
State m_state;
bool m_horizontal;
unsigned char m_alpha;
float m_padding;
DeltaTime m_elapsedTime;
WidgetManager* m_widgetManager;
PopMenu* m_parentMenu;
protected:
struct ButtonData
{
// Animation
MoveAnim m_moveAnim;
PopMenu* m_subPopMenu;
Button* m_button;
ButtonData()
: m_subPopMenu(nullptr)
{}
};
std::vector<ButtonData> m_buttonsData;
void DrawNormal();
void DrawPushed();
void updatePoping(DeltaTime _elapsedTime);
void closeOtherPopMenus(PopMenu* _subPopMenu);
virtual void update(float _dt);
virtual bool processInput(const InputEvent& _inputEvent, const InputDevice& _inputDevice) { return false; }
bool pop(const Message& _message);
typedef PopMenu ThisClass;
public:
struct ButtonInfo
{
float m_width;
float m_height;
const char* m_text;
bool m_checkButton;
ButtonInfo()
: m_width(-1.0f)
, m_height(-1.0f)
, m_text(nullptr)
, m_checkButton(false)
{ } // Default values
};
PopMenu(
NameCRC _name,
WidgetManager* _manager,
Widget* _parent,
bool _horizontal,
float _padding,
grafx::Font* _font,
const std::vector<ButtonConfig>& _buttonconfigs);
virtual ~PopMenu();
void assignSubPopMenu(unsigned int _index, PopMenu* _popMenu);
void close();
KREF_POLYMORPH_METHOD_WRAPPER1(pop, const Message&)
unsigned int getNbButtons () const { return (unsigned) m_buttonsData.size(); }
Button* getButton (unsigned int _index) const { return m_buttonsData[_index].m_button; }
};
}
}
| [
"gibs75@hotmail.com"
] | gibs75@hotmail.com |
657148565291c6df3a2d821d138fca9a84c4f1e5 | 3078ae0b843641976a4b624e9b98204c86037e76 | /Machine_Learning/Project_3_MachineLearning/Project_3_MachineLearning/Evaluator.cpp | 8a7b7ec5cefce292413f9f67945abf2be88d76ff | [] | no_license | grwim/Portfolio | 0888d63cfb432ae112ed878a1b8b766b91f7b989 | 862942118f6701e40fb1c4b3e659d565058a5729 | refs/heads/master | 2020-03-28T04:30:57.113423 | 2019-01-17T23:57:12 | 2019-01-17T23:57:12 | 147,719,480 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 9,957 | cpp | //
// Evaluator.cpp
// Project_3_MachineLearning
//
// Created by Konrad Rauscher on 3/16/16.
// Copyright © 2016 Konrad Rauscher. All rights reserved.
//
#include "Evaluator.hpp"
Evaluator::Evaluator()
{
kFold_asCurrDefault = true;
}
Evaluator::Evaluator(int num_folds)
{
kFold_asCurrDefault = true;
if (num_folds == -1) {
folds = 10;
}
else
{
folds = num_folds;
}
}
Evaluator::Evaluator(vector<string> evalOptions)
{
setOptions(evalOptions);
}
void Evaluator::setOptions(vector<string> evalOptions)
{
if (evalOptions[0] == "x")
{
folds = atoi(evalOptions[1].c_str());
}
else if (evalOptions[0] == "p")
{
kFold_asCurrDefault = false;
proportion = stod(evalOptions[1].c_str());
}
else
{
cout << "ERROR in Evaluator::setOptions" << endl;
}
}
void Evaluator::setFolds(int num_folds)
{
folds = num_folds;
}
double Evaluator::standardDev(vector<double> probabilities ) // of probabilities
{
double stdDev;
/*
Work out the Mean (the simple average of the numbers)
Then for each number: subtract the Mean and square the result.
Then work out the mean of those squared differences.
Take the square root of that and we are done
*/
double mean;
double sum;
for (int i = 0; i < probabilities.size(); i++) {
// cout << probabilities[i] << " ";
sum += probabilities[i];
}
// cout << endl;
mean = sum / probabilities.size();
// cout << "mean " << mean << endl;
vector<double> differences;
for (int i = 0; i < probabilities.size(); i++) {
differences.push_back((probabilities[i] - mean)*(probabilities[i] - mean));
}
double meanSq;
for ( int i = 0; i < differences.size(); i++) {
meanSq += differences[i];
}
meanSq /= differences.size();
stdDev = sqrt(meanSq);
return stdDev;
}
Performance Evaluator::evaluate(Classifier & classifier, DataSet trainSet)
{
// cout << "here: " << kFold_asCurrDefault << endl;
if (kFold_asCurrDefault) {
return _evaluate_kFold(classifier, trainSet);
}
// (implicit) else:
return _evaluate_holdOut(classifier, trainSet);
}
Performance Evaluator::evaluate(Classifier & classifier, DataSet train, DataSet test) // NEW for project 3
{
Performance performance;
Classifier * classifierPtr = &classifier;
vector<int> predictions;
vector<double> accuracies;
// proportion specifies proportion used as training set, train at index 0
// now. train with train, and test with test, return performance
classifierPtr->train(train); // train with train
// predict on test
for (int i = 0; i < test.getExamples().size(); i++) {
predictions.push_back(classifierPtr->classify(test.getExamples()[i]));
// cout << "prediction: " << classifierPtr->classify(test.getExamples()[i]) << endl;
}
int countCorrect = 0;
// cout << "size of test is " << test.getExamples().size() << endl;
// cout << "size of train is " << train.getExamples().size() << endl;
for (int i = 0; i < test.getExamples().size(); i++) { // get count of # correct
// cout << "prediction is " << predictions[i] << " and actual is " << test.getExamples()[i][test.getAttributes().getClassIndex()] << endl;
if (predictions[i] == test.getExamples()[i][test.getAttributes().getClassIndex()]) {
countCorrect++;
// cout << " correct " << endl;
}
}
// cout << "countCorrect: " << countCorrect << endl;
// cout << "Accuracy: " << countCorrect / static_cast<double>(test.getExamples().size()) << endl;
accuracies.push_back(countCorrect / static_cast<double>(test.getExamples().size())); // push back accuracy
performance.setAccuracyList(accuracies);
// cout << "Evaluation " << i << " with size " << train.getExamples().size() << " " << test.getExamples().size() << endl;
return performance;
}
Performance Evaluator::_evaluate_holdOut(Classifier & classifier, DataSet dSet) // NEW for project 3
{
// cout << "got here " << endl;
Performance performance;
Classifier * classifierPtr = &classifier;
vector<int> predictions;
vector<double> accuracies;
// proportion specifies proportion used as training set, train at index 0
vector<DataSet> trainAndTest = dSet.splitByProportion(proportion);
// now. train with train, and test with test, return performance
classifierPtr->train(trainAndTest[0]); // train with train
// predict on test
for (int i = 0; i < trainAndTest[1].getExamples().size(); i++) {
predictions.push_back(classifierPtr->classify(trainAndTest[1].getExamples()[i]));
// cout << "prediction: " << classifierPtr->classify(test.getExamples()[i]) << endl;
}
int countCorrect = 0;
// cout << "size of test is " << test.getExamples().size() << endl;
// cout << "size of train is " << train.getExamples().size() << endl;
for (int i = 0; i < trainAndTest[1].getExamples().size(); i++) { // get count of # correct
// cout << "prediction is " << predictions[i] << " and actual is " << test.getExamples()[i][test.getAttributes().getClassIndex()] << endl;
if (predictions[i] == trainAndTest[1].getExamples()[i][trainAndTest[1].getAttributes().getClassIndex()]) {
countCorrect++;
// cout << " correct " << endl;
}
}
// cout << "countCorrect: " << countCorrect << endl;
// cout << "Accuracy: " << countCorrect / static_cast<double>(trainAndTest[1].getExamples().size()) << endl;
accuracies.push_back(countCorrect / static_cast<double>(trainAndTest[1].getExamples().size())); // push back accuracy
performance.setAccuracyList(accuracies);
// cout << "Evaluation " << i << " with size " << train.getExamples().size() << " " << test.getExamples().size() << endl;
return performance;
}
Performance Evaluator::_evaluate_kFold(Classifier & classifier, DataSet dSet)
{
vector<double> accuracies;
Performance performance;
Classifier * classifierPtr = &classifier;
vector<DataSet> partitions = dSet.partition(folds);
// for (int i = 0; i < partitions.size(); i++) {
//
// cout << "example " << i << " ";
// for (int j = 0; j < partitions[i].getExamples()[i].size(); j++) {
// cout << partitions[i].getExamples()[i][j] << " ";
// }
// cout << endl;
//
// }
// cout << "size: " << dSet.getExamples().size() << endl;
DataSet train(dSet.getAttributes());
DataSet test(dSet.getAttributes());
// FOR I < folds, I++
// get list of predictions, compare against actual, calculate accuracy
// have to partition first.
vector<int> predictions;
int countCorrect = 0;
for (int i = 0; i < folds; i++) { // do for k- number of folds
for (int j = 0; j < folds; j++) { // insert partitions into appropriate DataSets
if (i != j) {
train.add(partitions[j]);
}
else {
test.add(partitions[j]);
}
}
// for (int i = 0; i < train.getExamples().size(); i++) {
//
// cout << "example " << i << " ";
// for (int j = 0; j < train.getExamples()[i].size(); j++) {
// cout << train.getExamples()[i][j] << " ";
// }
// cout << endl;
//
// }
// do calculation here for accuracy
classifierPtr->train(train);
// cout << "cool shit: " << endl;
for (int i = 0; i < test.getExamples().size(); i++) {
predictions.push_back(classifierPtr->classify(test.getExamples()[i]));
// cout << "prediction: " << classifierPtr->classify(test.getExamples()[i]) << endl;
}
countCorrect = 0;
// cout << "size of test is " << test.getExamples().size() << endl;
// cout << "size of train is " << train.getExamples().size() << endl;
for (int i = 0; i < test.getExamples().size(); i++) { // get count of # correct
// cout << "prediction is " << predictions[i] << " and actual is " << test.getExamples()[i][test.getAttributes().getClassIndex()] << endl;
if (predictions[i] == test.getExamples()[i][test.getAttributes().getClassIndex()]) {
countCorrect++;
// cout << " correct " << endl;
}
}
// cout << "countCorrect: " << countCorrect << endl;
// cout << "Accuracy: " << countCorrect / static_cast<double>(test.getExamples().size()) << endl;
accuracies.push_back(countCorrect / static_cast<double>(test.getExamples().size())); // push back accuracy
// cout << "Evaluation " << i << " with size " << train.getExamples().size() << " " << test.getExamples().size() << endl;
train.clearExamples();
test.clearExamples();
}
performance.setAccuracyList(accuracies);
// cout << "Stand Dev: " << standardDev(accuracies) << endl;
performance.set_stdDev(standardDev(accuracies)); // NEED TO CALC STAND DEV
return performance;
} | [
"konmanr@gmail.com"
] | konmanr@gmail.com |
afa7cc19c12bef8e0917172c1f40db7d124a4014 | d6b4bdf418ae6ab89b721a79f198de812311c783 | /rum/include/tencentcloud/rum/v20210622/model/ResumeProjectRequest.h | 6c88f1801e3363553eede73976ae0a7d76a40d61 | [
"Apache-2.0"
] | permissive | TencentCloud/tencentcloud-sdk-cpp-intl-en | d0781d461e84eb81775c2145bacae13084561c15 | d403a6b1cf3456322bbdfb462b63e77b1e71f3dc | refs/heads/master | 2023-08-21T12:29:54.125071 | 2023-08-21T01:12:39 | 2023-08-21T01:12:39 | 277,769,407 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,370 | h | /*
* Copyright (c) 2017-2019 THL A29 Limited, a Tencent company. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef TENCENTCLOUD_RUM_V20210622_MODEL_RESUMEPROJECTREQUEST_H_
#define TENCENTCLOUD_RUM_V20210622_MODEL_RESUMEPROJECTREQUEST_H_
#include <string>
#include <vector>
#include <map>
#include <tencentcloud/core/AbstractModel.h>
namespace TencentCloud
{
namespace Rum
{
namespace V20210622
{
namespace Model
{
/**
* ResumeProject request structure.
*/
class ResumeProjectRequest : public AbstractModel
{
public:
ResumeProjectRequest();
~ResumeProjectRequest() = default;
std::string ToJsonString() const;
/**
* 获取Project ID
* @return ProjectId Project ID
*
*/
int64_t GetProjectId() const;
/**
* 设置Project ID
* @param _projectId Project ID
*
*/
void SetProjectId(const int64_t& _projectId);
/**
* 判断参数 ProjectId 是否已赋值
* @return ProjectId 是否已赋值
*
*/
bool ProjectIdHasBeenSet() const;
private:
/**
* Project ID
*/
int64_t m_projectId;
bool m_projectIdHasBeenSet;
};
}
}
}
}
#endif // !TENCENTCLOUD_RUM_V20210622_MODEL_RESUMEPROJECTREQUEST_H_
| [
"tencentcloudapi@tencent.com"
] | tencentcloudapi@tencent.com |
8ae3055bd0da6c26c203f2e1cac348715f243981 | d07f826d1fa91d1882bc56060eca279b2374dea4 | /src/tools/nxx_decompress.cpp | 1a498b4f5bc37ed8460a5669f711a1e7782304d1 | [
"MIT"
] | permissive | rschlaikjer/mangetsu | 9da0f58bb4e3407181dd6e23406c95b20f1bf495 | c499f784626e552a100364eb0edb7443bba49bc9 | refs/heads/master | 2023-08-29T18:34:16.598176 | 2021-11-01T02:42:30 | 2021-11-01T02:42:35 | 408,019,601 | 8 | 2 | null | null | null | null | UTF-8 | C++ | false | false | 695 | cpp | #include <mg/data/nxx.hpp>
#include <mg/util/fs.hpp>
#include <mg/util/string.hpp>
#include <filesystem>
int main(int argc, char **argv) {
if (argc != 3) {
fprintf(stderr, "%s input output\n", argv[0]);
return -1;
}
// Name args
const char *input_file = argv[1];
const char *output_file = argv[2];
// Read raw input data
std::string raw;
if (!mg::fs::read_file(input_file, raw)) {
return -1;
}
// Decompress
std::string decompressed;
if (!mg::data::nxx_decompress(raw, decompressed)) {
fprintf(stderr, "Failed to decompress\n");
return -1;
}
// Write
if (!mg::fs::write_file(output_file, decompressed)) {
return -1;
}
return 0;
}
| [
"ross@schlaikjer.net"
] | ross@schlaikjer.net |
e2fedb395eca94203caa953e9b3db136844e6761 | d0e2aa848f35efe2aae72e649ea9267d2443472c | /Backjoon_Onlie_Judge/16000/16987.cpp | 4d475c8bfb85faa086cb0ac0fc0bed40983a065f | [] | no_license | ddjddd/Algorithm-Study | 376f72849506841be0351dfdfe9b1ca95d197956 | 6ec72ae4de9d52592b76af6e4e8246c9fdeb946f | refs/heads/master | 2023-04-14T10:05:09.303548 | 2023-04-06T14:16:50 | 2023-04-06T14:16:50 | 121,474,738 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,040 | cpp | #include <iostream>
using namespace std;
int n, hp[8], wt[8];
bool is_broken(int cur) {
return hp[cur] > 0 ? false : true;
}
bool is_exist(int cur) {
for (int i = 0; i < n; i++) {
if (i != cur && hp[i] > 0)
return true;
}
return false;
}
int count_broken() {
int ret = 0;
for (int i = 0; i < n; i++) {
if (hp[i] <= 0)
ret++;
}
return ret;
}
int m = 0;
void dfs(int cur) {
if (cur == n || !is_exist(cur)) {
m = max(m, count_broken());
return;
}
if (is_broken(cur)) {
dfs(cur + 1);
} else {
for (int i = 0; i < n; i++) {
if (i != cur && !is_broken(i)) {
hp[cur] -= wt[i];
hp[i] -= wt[cur];
dfs(cur + 1);
hp[cur] += wt[i];
hp[i] += wt[cur];
}
}
}
}
int main() {
cin >> n;
for (int i = 0; i < n; i++) {
cin >> hp[i] >> wt[i];
}
dfs(0);
cout << m << endl;
return 0;
}
| [
"ddjddd@naver.com"
] | ddjddd@naver.com |
e011f12130b50600a38d68c47361c5f83e60a446 | 3f20c4596c5a1dd23707f668f978625be33dd6a7 | /pavan507/bitwise.cpp | 88542197762ccf28c75cc22059e64ca7dc118772 | [] | no_license | beingzeroin/cps-8 | 412fb9c5ea0f3f46048ce987d27ff943b8770c4b | 4e8b2258f0425cf04dd37448ae90b23c76532c46 | refs/heads/master | 2020-04-06T03:33:12.285835 | 2016-05-18T06:02:41 | 2016-05-18T06:02:41 | 47,662,410 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 236 | cpp | #include<iostream>
#include<stdio.h>
using namespace std;
int main()
{
long long int t,n;
cin>>t;
while(t--)
{
cin>>n;
while(n>0)
{
if(!(n&(n-1)))
{
printf("%d\n",n);
break;
}
n--;
}
}
return 0;
}
| [
"ypk507@gmail.com"
] | ypk507@gmail.com |
fdc9dc62e16558ef310751e33f51f68fabe526b3 | 1a4ce6b9fbec90830ed60796f7cd6fc901e91a05 | /算法练习/PAT乙级-Elevator/1008. Elevator.cpp | d3a2382462a38c861d78a36f1c707c388213c105 | [] | no_license | wszhhx/Algorithm-Practice | 35271cd8cb564f3c19098bfe5e8e573cab4052d9 | 5fd3bb0d80bb82c8935ede2bed73670aa912e4c4 | refs/heads/master | 2020-04-30T01:40:53.214661 | 2019-03-31T10:14:28 | 2019-03-31T10:14:28 | 176,535,592 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,392 | cpp | #include<iostream>
//#include<stdlib.h>
using namespace std;
class Elevator{
public:
Elevator():TotalTime(0),Floor(0){};
void Up(){
TotalTime+=6;
Floor++;
}
void Down(){
TotalTime+=4;
Floor--;
}
void To(int floor){
if(Floor==floor)
return;
while(Floor!=floor){
if(floor>Floor)
Up();
else
Down();
}
TotalTime+=5;
}
void Show_Time(){
cout<<TotalTime;
}
private:
int TotalTime;
int Floor;
};
/*typedef struct Node{
int order;
struct Node *next;
}LinkQueueNode;
typedef struct{
LinkQueueNode *front;
LinkQueueNode *rear;
}LinkQueue;
bool InitQueue(LinkQueue *Q){
Q->front=(LinkQueueNode *)malloc(sizeof(LinkQueueNode));
if(Q->front!=NULL){
Q->rear=Q->front;
Q->front->next=NULL;
return true;
}
else
return false;
}
bool EnterQueue(LinkQueue *Q,int order){
LinkQueueNode *NewNode;
NewNode=(LinkQueueNode *)malloc(sizeof(LinkQueueNode));
NewNode->order=order;
NewNode->next=NULL;
Q->rear->next=NewNode;
Q->rear=NewNode;
return true;
}
bool DeleteQueue(LinkQueue *Q,int &order){
LinkQueueNode *p;
if(Q->front==Q->rear)
return false;
p=Q->front->next;
Q->front->next=p->next;
if(Q->rear==p)
Q->rear=Q->front;
order=p->order;
free(p);
return true;
}
*/
int main(){
Elevator Ele;
int n,temp;
cin>>n;
for(int i=0;i<n;i++){
cin>>temp;
Ele.To(temp);
}
Ele.Show_Time();
return 0;
}
| [
"wszhhx@163.com"
] | wszhhx@163.com |
7be2a8150a64de1ce1fa86d656edd8c4faaf4ae4 | 8e1db9077fef14f1a10de5099786880ec0072a0f | /Graphs/Roads and Libraries.cpp | e862bcddf02fb7186444f1d9a6b3f82467415007 | [] | no_license | ShubhamMutreja/Hackerrank-Solutions | 68b0997f6410b0c6efb39bb9800694121434f4a9 | 55f06b790cdfbf77e6bac82502a91f8bd7f63f23 | refs/heads/master | 2022-12-09T00:42:40.934838 | 2020-09-08T15:24:43 | 2020-09-08T15:24:43 | 293,853,470 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,801 | cpp | #include <bits/stdc++.h>
using namespace std;
vector<string> split_string(string);
vector<long> par;
vector<long> size;
long find(long u)
{
if(u == par[u])
{
return u;
}
return par[u] = find(par[u]);
}
void merge(long p1,long p2)
{
if(size[p1] < size[p2])
{
par[p1] = p2;
size[p2]+=size[p1];
}
else
{
par[p2] = p1;
size[p1]+=size[p2];
}
}
long roadsAndLibraries(int n, int c_lib, int c_road, vector<vector<int>> cities) {
par.clear();
size.clear();
for(int i=0;i<=n;i++)
{
par.push_back(i);
size.push_back(1);
}
for(auto &s : cities)
{
int u = s[0]; int v = s[1];
int p = find(u); int q = find(v);
if(p != q)
{
merge(p,q);
}
}
long roads=0,libs=0;
for(int i=1;i<=n;i++)
{
if(par[i] == i)
{
libs++;
roads+=size[i]-1;
}
}
cout<<roads-1<<libs<<endl;
long cost1 = (roads)*c_road + libs*c_lib;
long cost2 = c_lib*n;
return min(cost1,cost2);
}
int main()
{
ofstream fout(getenv("OUTPUT_PATH"));
int q;
cin >> q;
cin.ignore(numeric_limits<streamsize>::max(), '\n');
for (int q_itr = 0; q_itr < q; q_itr++) {
string nmC_libC_road_temp;
getline(cin, nmC_libC_road_temp);
vector<string> nmC_libC_road = split_string(nmC_libC_road_temp);
int n = stoi(nmC_libC_road[0]);
int m = stoi(nmC_libC_road[1]);
int c_lib = stoi(nmC_libC_road[2]);
int c_road = stoi(nmC_libC_road[3]);
vector<vector<int>> cities(m);
for (int i = 0; i < m; i++) {
cities[i].resize(2);
for (int j = 0; j < 2; j++) {
cin >> cities[i][j];
}
cin.ignore(numeric_limits<streamsize>::max(), '\n');
}
long result = roadsAndLibraries(n, c_lib, c_road, cities);
fout << result << "\n";
}
fout.close();
return 0;
}
vector<string> split_string(string input_string) {
string::iterator new_end = unique(input_string.begin(), input_string.end(), [] (const char &x, const char &y) {
return x == y and x == ' ';
});
input_string.erase(new_end, input_string.end());
while (input_string[input_string.length() - 1] == ' ') {
input_string.pop_back();
}
vector<string> splits;
char delimiter = ' ';
size_t i = 0;
size_t pos = input_string.find(delimiter);
while (pos != string::npos) {
splits.push_back(input_string.substr(i, pos - i));
i = pos + 1;
pos = input_string.find(delimiter, i);
}
splits.push_back(input_string.substr(i, min(pos, input_string.length()) - i + 1));
return splits;
}
| [
"shubhumail.box@gmail.com"
] | shubhumail.box@gmail.com |
f81119aa1c3ad6325086b7d8419151f4c00b225c | 2ac9b566337649550caac7ddbdf1607edc599871 | /linefollow.ino | fcc60b58fa02b98419ca7bf9a1c7b5ac3aeb5b52 | [] | no_license | bootnecklad/miscellaneous | 2ef80b250bb2c58a47c2bb469e3402a20ab649e8 | 0cec980d5cc8f02be4620a2000c0d6db5427fc8d | refs/heads/master | 2020-06-13T08:42:51.538653 | 2017-05-09T15:20:57 | 2017-05-09T15:20:57 | 75,432,297 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 9,702 | ino | // This program is part of a group project at UoN.
// penryu contributed to clean up and reformatting!
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// Global Constants
const int BUFFER_VALUE = 2000; // Used to constrain the error value
const int MAX_MOTOR_SPEED = 40;
const int MIN_MOTOR_SPEED = -40;
const int leftMotorBaseSpeed = 15;
const int rightMotorBaseSpeed = 15;
const int LCD_ROW = 2;
const int LCD_COLUMN = 16;
const int LOOP_DELAY = 0; // Not in use, used for debugging
const int TOO_FAST = 7; // defines various error codes
// Global Variables
// Could be improve by creating a structure that represents the system as a whole?
// Values used to calculate sensor of position on car
float sensorPosition; // Current position of sensor
float sensorPositionInitial; // Initial position of sensor when calibration after button press
float positionDeviationSum; // Continuous sum of how far the sensor has deviated over time
float positionDeviationOld; // Previous value of how far the sensor has deviated over time
float errorInPosition; // Total error of sensor compared to the ideal/initial position
float straightMotorSpeed; //Used to smoothly accelerate the car when going straight
float calibrationConstantP = 2; // The 3 constants to be changed in PID control
float calibrationConstantI = 0.005; // These will likely be different for every course and every vehicle
float calibrationConstantD = 1;
// Sets up serial port for car controller board
#include <SoftwareSerial.h>
SoftwareSerial carController(9, 10);
// LINE SENSOR SETUP
#include <Wire.h>
#define uchar unsigned char
uchar t;
//void send_data(short a1,short b1,short c1,short d1,short e1,short f1);
uchar data[16];
void setup()
{
Serial.begin(9600);
carController.begin(57600);
while (!Serial);
while (!carController);
Wire.begin();
t = 0;
// Sets initial state of button on car
int goButton = 0;
pinMode(2, INPUT);
// Pauses car until button is pressed
while (!goButton)
{
goButton = digitalRead(2);
}
initialisePIDcontrol(); // Initialises values for PID control
}
void loop()
// INTERNAL FUNCTION: loop()
// ARGUMENTS:
// ARGUMENT TYPES:
// DESCRIPTION: Arduino loop that runs and sends commands to the firmware board
{
int goButton;
goButton = digitalRead(2);
if (goButton)
{
carController.write("#Hb");
initialisePIDcontrol();
}
fetchSensorValues();
sensorPosition = calculatePosition(); // Fetches current position of sensor
errorInPosition = calculateError(sensorPosition); // Calculates the error in the position
errorInPosition = bufferError(errorInPosition); // Buffers error as to not cause rapid movement
moveMotors(errorInPosition); // Moves motors based on the error from initial position and the speed of the motor
//displayStatus(errorInPosition, sensorArray); // Continuously displays information on LCD on top of vehicle platform
//delay(LOOP_DELAY); // Causes a delay inbetween each loop
}
unsigned int sensorData[8];
void fetchSensorValues()
{
Wire.requestFrom(9, 16); // request 16 bytes from slave device #9
while (Wire.available()) // slave may send less than requested
{
data[t] = Wire.read(); // receive a byte as character
if (t < 15)
t++;
else
t = 0;
}
int n;
for (n = 0; n < 8; n++)
{
sensorData[n] = data[n * 2] << 2; // Shift the 8 MSBs up two places and store in array
sensorData[n] += data[(n * 2) + 1]; // Add the remaining bottom 2 LSBs
}
}
void initialisePIDcontrol()
{
// Initial values for deviation from line at calibration is zero
// Car is on the line so no deviation
positionDeviationSum = 0;
positionDeviationOld = 0;
fetchSensorValues();
sensorPositionInitial = calculatePosition(); // Fetches position to calibrate car on line.
}
void moveMotors(float errorInPosition)
// INTERNAL FUNCTION: moveMotors()
// ARGUMENTS: errorInPosition motorSpeed
// ARGUMENT TYPES: floating point integer
// DESCRIPTION: Moves motors at speed in arguements based on the error given
/* ORIGINAL ATTEMPT AT CONTORLLING MOTORS
Serial.print(lowByte(motorSpeed)); // Serial.print throws bytes out
Serial.write(",0");
Serial.print(lowByte((int)moveAmount)); // Serial.print throws bytes out */
{
double moveAmount; //difference; // Move amount is a % of the total motor speed, 100% being fastest and 0% being nothing
int leftMotorSpeed, rightMotorSpeed;
moveAmount = (errorInPosition / BUFFER_VALUE) * MAX_MOTOR_SPEED; // Move amount of motor is based on the error value
leftMotorSpeed = leftMotorBaseSpeed - moveAmount; // Calculate the modified motor speed
rightMotorSpeed = rightMotorBaseSpeed + moveAmount;
if (errorInPosition < 300 && errorInPosition > -300) //An attempt to make the car speed up when going straight
{
straightMotorSpeed = straightMotorSpeed + 0.2;
leftMotorSpeed = leftMotorBaseSpeed + straightMotorSpeed;
rightMotorSpeed = rightMotorBaseSpeed + straightMotorSpeed;
}
else
{
straightMotorSpeed = 0; // Causes the acceleration to reset if error is not small
}
// Apply new speed and direction to each motor
if (leftMotorSpeed > 0)
{
leftMotorSpeed = constrain(leftMotorSpeed, 0, MAX_MOTOR_SPEED);
carController.write("#D1f");
carController.write("#S1");
carController.print((int)leftMotorSpeed);
}
else
{
leftMotorSpeed = leftMotorSpeed * 4; //Makes the car accelerate in reverse 4 times faster than going forwards
leftMotorSpeed = constrain(leftMotorSpeed, MIN_MOTOR_SPEED, 0);
carController.write("#D1r");
carController.write("#S1");
carController.print(-(int)leftMotorSpeed);
}
if (rightMotorSpeed > 0)
{
rightMotorSpeed = constrain(rightMotorSpeed, 0, MAX_MOTOR_SPEED);
carController.write("#D2f");
carController.write("#S2");
carController.print((int)rightMotorSpeed);
}
else
{
rightMotorSpeed = rightMotorSpeed * 4; //Makes the car accelerate in reverse 4 times faster than going forwards
rightMotorSpeed = constrain(rightMotorSpeed, MIN_MOTOR_SPEED, 0);
carController.write("#D2r");
carController.write("#S2");
carController.print(-(int)rightMotorSpeed);
}
}
float bufferError(float errorInPosition)
// INTERNAL FUNCTION: bufferError()
// ARGUMENTS: errorInPosition
// ARGUMENT TYPES: floating point
// DESCRIPTION: Limits the created error between certain values, prevents error becoming too large or too small
{
if (errorInPosition > BUFFER_VALUE)
{
errorInPosition = BUFFER_VALUE;
}
if (errorInPosition < -BUFFER_VALUE)
{
errorInPosition = -BUFFER_VALUE;
}
return errorInPosition;
}
float calculateError(float sensorPosition)
// INTERNAL FUNCTION: displayStatus()
// ARGUMENTS: errorInPosition sensorArray
// ARGUMENT TYPES: floating point pointer to array
// DESCRIPTION: Displays error in position and the values of each sensor
{
float positionDeviation, positionDeviationToIdeal, errorInPosition;
float P, I, D;
positionDeviation = sensorPositionInitial - sensorPosition; // The proportional term, calculated by finding the difference betweeen current position and the ideal found when initialising PID control
positionDeviationSum = positionDeviationSum + positionDeviation; // The integral term, a sum keeping track of how far away from the line the car is over time
positionDeviationToIdeal = positionDeviation - positionDeviationOld; // The derivative term, this determines how fast the car is moving back towards or away from the line
positionDeviationOld = positionDeviation;
P = calibrationConstantP * positionDeviation;
I = calibrationConstantI * positionDeviationSum;
D = calibrationConstantD * positionDeviationToIdeal;
errorInPosition = P + constrain(I, -500, 500) + D;
return errorInPosition;
}
float calculatePosition()
// INTERNAL FUNCTION: fetchPosition()
// ARGUMENTS: errorInPosition sensorArray
// ARGUMENT TYPES: floating point pointer to array
// DESCRIPTION: Displays error in position and the values of each sensor
{
int sensorSum;
float sensorAverage, sensorPosition;
sensorSum = sensorData[0] + sensorData[1] + sensorData[2] + sensorData[3] + sensorData[4] + sensorData[5] + sensorData[6] + sensorData[7]; // Each of these is a value outputted by a photodiode
sensorAverage = (float)((sensorData[0] * 1) + (sensorData[1] * 2) + (sensorData[2] * 3) + (sensorData[3] * 4) + (sensorData[4] * 5) + (sensorData[5] * 6) + (sensorData[6] * 7) + (sensorData[7] * 8));
sensorPosition = (float)sensorAverage / (float)sensorSum; // This makes a weighted average of the data the sensors are receiving, giving the position of the line
sensorPosition = sensorPosition * 2000; // Used the make the numbers work nicely, probably unnecessary but would require a rework of a bunch of values
return sensorPosition;
}
| [
"noreply@github.com"
] | noreply@github.com |
fdc2381e3f2751397840199c950da022926a65b7 | 5b0b588b52656d017c4dceb7a053ef2d7d221876 | /utils_storage/cpp/UtilsStorageWriter.hpp | 094bab5cc4173174ea7d24deb6984a97442c17cf | [] | no_license | rticommunity/rtirecordingservice-storage-plugins | 33b778c6afcaa7a1341a151d75dfe227ca8ff80a | 7d5ab6c9bd54ce2eb0ecca4eaf4731c3d18959a6 | refs/heads/master | 2020-05-31T10:16:13.286839 | 2020-05-22T23:38:18 | 2020-05-22T23:38:18 | 190,235,941 | 0 | 5 | null | 2020-05-22T23:38:19 | 2019-06-04T16:00:29 | C++ | UTF-8 | C++ | false | false | 10,055 | hpp | /**
* (c) 2019 Copyright, Real-Time Innovations, Inc. All rights reserved.
*
* RTI grants Licensee a license to use, modify, compile, and create derivative
* works of the Software. Licensee has the right to distribute object form
* only for use with RTI products. The Software is provided "as is", with no
* warranty of any type, including any warranty for fitness for any purpose.
* RTI is under no obligation to maintain or support the Software. RTI shall
* not be liable for any incidental or consequential damages arising out of the
* use or inability to use the software.
*/
#ifndef RTI_RECORDER_UTILS_STORAGE_WRITER_HPP_
#define RTI_RECORDER_UTILS_STORAGE_WRITER_HPP_
#include <fstream>
#include "rti/recording/storage/StorageWriter.hpp"
#include "rti/recording/storage/StorageStreamWriter.hpp"
#include "rti/recording/storage/StorageDiscoveryStreamWriter.hpp"
#include "PrintFormatCsv.hpp"
namespace rti { namespace recorder { namespace utils {
#ifdef RTI_WIN32
#define RTI_RECORDER_UTILS_PATH_SEPARATOR "\\"
#else
#define RTI_RECORDER_UTILS_PATH_SEPARATOR "/"
#endif
/***
* @brief Convenience macro to forward-declare the C-style function that will be
* called by RTI Recording Service to create your class.
*/
RTI_RECORDING_STORAGE_WRITER_CREATE_DECL(UtilsStorageWriter);
/**
* @brief Definition of the support output formats.
*/
enum class OutputFormatKind {
CSV_FORMAT
};
/**
* @brief Configuration elements of the Utils storage plug-in.
*
*/
class UtilsStorageProperty {
public:
UtilsStorageProperty();
/**
* @brief Selects the format in which samples are stored in an output
* text file.
*
* Default: CSV_FORMAT
*/
UtilsStorageProperty& output_format_kind(const OutputFormatKind&);
/**
* @brief Gets the OutputFormatKind
*/
OutputFormatKind output_format_kind() const;
/**
* @brief Selects the directory where the output files are placed.
*
* Default: .
*/
std::string output_dir_path() const;
/**
* @brief Gets the output_dir_path
*/
UtilsStorageProperty& output_dir_path(const std::string&);
/**
* @brief Specifies a prefix for the output files.
*
* Default: [empty]
*/
std::string output_file_basename() const;
/**
* @brief Gets the output_file_basename
*/
UtilsStorageProperty& output_file_basename(const std::string&);
/**
* @brief Indicates whether the conversion of samples is placed into a
* single file.
*
* Default: true
*/
bool merge_output_files() const;
/**
* @brief Gets the merge_output_files
*/
UtilsStorageProperty& merge_output_files(bool);
private:
OutputFormatKind output_format_kind_;
std::string output_dir_path_;
std::string output_file_basename_;
bool merge_output_files_;
};
/***
* @brief String representation of UtilsStorageProperty
*/
std::ostream& operator<<(
std::ostream& os,
const UtilsStorageProperty& property);
/**
* @brief String representation of PrintFormatCsvProperty
*/
std::ostream& operator<<(
std::ostream& os,
const PrintFormatCsvProperty& property);
/**
* @brief Implementation of a StorageWriter plug-in that allows storing
* DynamicData samples represented in a text-compatible format, such as CSV.
*
* In this implementation, each StreamWriter is responsible for converting
* and storing the samples of the associated Stream/Topic into a dedicated
* output text file, with attributes specified in UtilsStorageProperty.
* All the output files the StreamWriters generate can be merged into a single
* output file while deleting all the intermediate separate output files.
*
* @override rti::recording::storage::StorageWriter
*/
class UtilsStorageWriter : public rti::recording::storage::StorageWriter {
public:
typedef std::map<std::string, std::ofstream> OutputFileSet;
typedef OutputFileSet::value_type FileSetEntry;
explicit UtilsStorageWriter(const rti::routing::PropertySet& properties);
virtual ~UtilsStorageWriter();
/**
* @brief Returns a UtilsStorageProperty reference with the default values
* of the plug-in.
*/
static const UtilsStorageProperty& PROPERTY_DEFAULT();
/**
* @brief Returns the property namespace shared across all the different
* plug-in configuration properties.
*
* Value: rti.recording.utils_storage
*/
static const std::string& PROPERTY_NAMESPACE();
/**
* @brief Returns the name of the property that configures
* UtilsStorageProperty::output_dir_path.
*
* Value: [namespace].output_dir_name
*/
static const std::string& OUTPUT_DIR_PROPERTY_NAME();
/**
* @brief Returns the name of the property that configures
* UtilsStorageProperty::output_file_base_name
*
* Value: [namespace].output_file_basename
*/
static const std::string& OUTPUT_FILE_BASENAME_PROPERTY_NAME();
static const std::string& OUTPUT_FORMAT_PROPERTY_NAME();
/**
* @brief Returns the name of the property that configures
* UtilsStorageProperty::merge_output_files
*
* Value: [namespace].merge_output_files
*/
static const std::string& OUTPUT_MERGE_PROPERTY_NAME();
/**
* @brief Returns the name of the property that configures
* the verbosity level for the logging messages.
*
* Value: [namespace].verbosity
*/
static const std::string& LOGGING_VERBOSITY_PROPERTY_NAME();
/**
* @brief Returns the name of the property that configures
* PrintFormatCsvProperty::empty_member_value_representation
*
* Value: [namespace].csv.empty_member_value
*/
static const std::string& CSV_EMPTY_MEMBER_VALUE_REP_PROPERTY_NAME();
/**
* @brief Returns the name of the property that configures
* PrintFormatCsvProperty::enum_as_string
*
* Value: [namespace].csv.enum_as_string
*/
static const std::string& CSV_ENUM_AS_STRING_PROPERTY_NAME();
/**
* @brief Returns the file extension for the files that contain the data
* in CSV format.
*
* Value: .csv
*/
static const std::string& CSV_FILE_EXTENSION();
/**
* @brief Returns the default value of the prefix used for the output file
* names.
*
* Value: csv_converted
*/
static const std::string& OUTPUT_FILE_BASENAME_DEFAULT();
/**
* @brief Returns the character user to replace each reserved file name
* character that's present in the generation of the output file name.
*/
static char FILE_NAME_REPLACEMENT_CHAR();
/* --- StorateWriter implementation ------------------------------------ */
/**
* @brief Creates a UtilsStreamWriter for each stream/topic.
*
* @see UtilsStreamWriter
*/
rti::recording::storage::StorageStreamWriter * create_stream_writer(
const rti::routing::StreamInfo& stream_info,
const rti::routing::PropertySet&) override;
/**
* @brief Deletes the UtilsStreamWriter.
*/
void delete_stream_writer(
rti::recording::storage::StorageStreamWriter *writer) override;
private:
void merge_output_file(FileSetEntry& file_entry);
UtilsStorageProperty property_;
// Collection of output files, one for each stream
OutputFileSet output_files_;
// The final file if merging is enabled
std::ofstream output_merged_file_;
// Property per output kind
PrintFormatCsvProperty csv_property_;
};
/**
* @brief Base abstract class for all the StreamWriter implementations part
* of the UtilsStorageWriter.
*
* This interface extends the behavior of DynamicDataStorageStreamWriter to
* also retrieve the UtilsStorageWriter::FileSetEntry that the StreamWriter
* is using to store the data.
*
* Implementations of this class also implement DynamicDataStorageStreamWriter
* in order to write samples into an output text file with a specified format.
* Each implementation is responsible to handle a specific format.
*
* Known implementations:
* - CsvStreamWriter
*
*/
class UtilsStreamWriter :
public rti::recording::storage::DynamicDataStorageStreamWriter {
public:
virtual UtilsStorageWriter::FileSetEntry& file_entry() = 0;
};
/**
* @brief Implementation of a UtilsStreamWriterr that writes samples
* into an output text file with an specified format.
*
* Currently, the implementation only supports CSV format.
*/
class CsvStreamWriter : public UtilsStreamWriter {
public:
/**
* @brief Creates an UtilsStreamWriter responsible for storing the
* data in a file in CSV format.
*
* @param[in] property CSV output configuration elements.
* @param[in] stream_info Information associated to the stream/topic
* @param[in] output_file_entry The output file where data is pushed.
*/
CsvStreamWriter(
const PrintFormatCsvProperty& property,
const rti::routing::StreamInfo& stream_info,
UtilsStorageWriter::FileSetEntry& output_file_entry);
virtual ~CsvStreamWriter() override;
/**
* @brief Writes the input samples into a CSV file. Each sample is placed
* in a separate row.
*
* @override Implementation of DynamicDataStorageStreamWriter::store
*/
void store(
const std::vector<dds::core::xtypes::DynamicData *>& sample_seq,
const std::vector<dds::sub::SampleInfo *>& info_seq) override;
/**
* @brief Returns the file entry used by this UtilsStorageWriter to write
* samples.
*
* @override UtilsStreamWriter::file_entry
*/
UtilsStorageWriter::FileSetEntry& file_entry() override;
private:
// PrintFormat implementation used to convert data samples
PrintFormatCsv print_format_csv_;
UtilsStorageWriter::FileSetEntry& output_file_entry_;
// a buffer to represent a single CSV sample
std::string data_as_csv_;
};
} } }
#endif
| [
"asanchez@rti.com"
] | asanchez@rti.com |
db51204ad7144de1d6e99fa9ba67f161423c9de1 | 037e25818ffabad34b9888f1e32a2264e8dabd98 | /src/Intrusion/Infrastructure/EntityFactory.cpp | 6886503eed1399898f07b0677f26022c85bcaa63 | [] | no_license | MarkRDavison/Games | b5e8e06f61e0b0c0a8c885d8d998531f50ffb32a | 004d8021b50e49748a846484599050560e31594a | refs/heads/master | 2018-11-15T04:28:55.001571 | 2018-11-09T05:30:35 | 2018-11-09T05:30:35 | 141,380,765 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 5,490 | cpp | #include <Intrusion/Infrastructure/EntityFactory.hpp>
#include <Intrusion/Infrastructure/IntrusionEntityGroups.hpp>
#include <Intrusion/Components/SpriteComponent.hpp>
#include <Intrusion/Components/PathFollowComponent.hpp>
#include <Intrusion/Components/CircleComponent.hpp>
#include <Intrusion/Components/TowerTargetComponent.hpp>
#include <Intrusion/Components/TowerTargetingComponent.hpp>
#include <Intrusion/Components/ProjectileComponent.hpp>
#include <Intrusion/Components/TowerFiringComponent.hpp>
#include <Intrusion/Components/LifeComponent.hpp>
namespace itr {
EntityFactory::EntityFactory(inf::TextureManager& _textureManager, ecs::EntityManager& _entityManager, IntrusionConfigurationManager& _configurationManager, LuaEntityParser& _luaEntityParser, LuaTowerParser& _luaTowerParser) :
m_TextureManager(_textureManager),
m_EntityManager(_entityManager),
m_ConfigurationManager(_configurationManager),
m_LuaEntityParser(_luaEntityParser),
m_LuaTowerParser(_luaTowerParser) {
}
EntityFactory::~EntityFactory(void) {
}
// TODO: Should only was the prototype name to this and return the entity reference to set the position and the path points
ecs::Entity& EntityFactory::spawnWaveEntityFromPrototype(const sf::Vector2u& _tilePosition, const std::string& _prototype, inf::Path& _path) {
if (!m_LuaEntityParser.entityHasBeenParsed(_prototype)) {
std::cout << "Cannot create entity '" << _prototype << "', it hasn't been parsed." << std::endl;
throw std::runtime_error("Cannot create unparsed entity");
}
const ParsedEntity& parsedEntity = m_LuaEntityParser.getEntity(_prototype);
const float scale = m_ConfigurationManager.getGameViewScale();
sf::Texture& texture = m_TextureManager.getTexture(parsedEntity.animationName);
const float offset = texture.getSize().y / 2.0f;
ecs::Entity& e = m_EntityManager.addEntity();
e.addGroup(EntityGroup::GRenderable);
e.addGroup(EntityGroup::GPathFollower);
e.addGroup(EntityGroup::GTowerTarget);
e.addGroup(EntityGroup::GLife);
e.addComponent<PositionComponent>(sf::Vector2f(static_cast<float>(_tilePosition.x) + 0.5f, static_cast<float>(_tilePosition.y) + 0.5f) * Definitions::TileSize);
e.addComponent<TowerTargetComponent>();
SpriteComponent& sc = e.addComponent<SpriteComponent>(texture, sf::IntRect(0, 0, texture.getSize().x, texture.getSize().y), scale);
sc.flipHorizontal = false;
sc.flipVertical = false;
sc.visualOffset.y = offset;
PathFollowComponent& pfc = e.addComponent<PathFollowComponent>();
pfc.speed = parsedEntity.speed;
LifeComponent& lc = e.addComponent<LifeComponent>();
lc.health = parsedEntity.health;
lc.onDeathResources = parsedEntity.drops;
for (const inf::PathNode& node : _path.nodes) {
pfc.pathPoints.push(sf::Vector2f(static_cast<float>(node.x) + 0.5f, static_cast<float>(node.y) + 0.5f) * Definitions::TileSize);
}
return e;
}
ecs::Entity& EntityFactory::spawnProjectileFromPrototype(const ParsedProjectile& _prototype, ecs::Entity* _source, ecs::Entity* _target) {
const float scale = m_ConfigurationManager.getGameViewScale();
ecs::Entity& e = m_EntityManager.addEntity();
e.addGroup(EntityGroup::GRenderable);
e.addGroup(EntityGroup::GPathFollower);
e.addGroup(EntityGroup::GProjectile);
e.addComponent<PositionComponent>(_source->getComponent<PositionComponent>().position);
ProjectileComponent& pc = e.addComponent<ProjectileComponent>();
pc.source = m_EntityManager.getWeakEntityRef(_source);
pc.target = m_EntityManager.getWeakEntityRef(_target);
pc.damage.health = -_prototype.baseDamage;
CircleComponent& cc = e.addComponent<CircleComponent>(0.05f, scale);
PathFollowComponent& pfc = e.addComponent<PathFollowComponent>();
pfc.speed = _prototype.speed;
pfc.pathPoints.push(_target->getComponent<PositionComponent>().position);
pfc.pathCompleted = [](ecs::Entity *_entity) {
std::cout << "Projectile has reached " << _entity->name << std::endl;
ProjectileComponent& projC = _entity->getComponent<ProjectileComponent>();
if (std::shared_ptr<ecs::Entity> t = projC.target.lock()) {
LifeComponent& lc = t->getComponent<LifeComponent>();
lc.lifeAdjustments.push(projC.damage);
}
};
std::cout << "Spawning projectile" << std::endl;
return e;
}
// TODO: ParsedTower or just the prototype name. . . . .
void EntityFactory::spawnTowerEntityFromPrototype(const sf::Vector2u& _tilePosition, const ParsedTower& _prototype) {
const float scale = m_ConfigurationManager.getGameViewScale();
sf::Texture& texture = m_TextureManager.getTexture(_prototype.animationName);
const float offset = texture.getSize().y / 2.0f;
ecs::Entity& e = m_EntityManager.addEntity(_prototype.prototypeName);
e.addGroup(EntityGroup::GRenderable);
e.addGroup(EntityGroup::GTower);
e.addComponent<PositionComponent>(sf::Vector2f(static_cast<float>(_tilePosition.x) + 0.5f, static_cast<float>(_tilePosition.y) + 0.5f) * Definitions::TileSize);
TowerTargetingComponent& ttc = e.addComponent<TowerTargetingComponent>();
ttc.range = _prototype.range;
TowerFiringComponent& tfc = e.addComponent<TowerFiringComponent>();
tfc.firingCooldown = _prototype.cooldown;
tfc.projectilePrototype.speed = 15.0f;
SpriteComponent& sc = e.addComponent<SpriteComponent>(texture, sf::IntRect(0, 0, texture.getSize().x, texture.getSize().y), scale);
sc.flipHorizontal = false;
sc.flipVertical = false;
sc.visualOffset.y = offset;
sc.sprite.setColor(_prototype.color);
}
}
| [
"markdavison0+github@gmail.com"
] | markdavison0+github@gmail.com |
670a17f6b9affc55d6251546088e5b2c08bd15af | 94db0bd95a58fabfd47517ed7d7d819a542693cd | /client/ClientRes/IOSAPI/Classes/Native/AssemblyU2DCSharp_UIGridSubItem3788884335.h | 7c39800bd245a2818f5317945336a040a4f5c305 | [] | no_license | Avatarchik/card | 9fc6efa058085bd25f2b8831267816aa12b24350 | d18dbc9c7da5cf32c963458ac13731ecfbf252fa | refs/heads/master | 2020-06-07T07:01:00.444233 | 2017-12-11T10:52:17 | 2017-12-11T10:52:17 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,681 | h | #pragma once
#include "il2cpp-config.h"
#ifndef _MSC_VER
# include <alloca.h>
#else
# include <malloc.h>
#endif
#include <stdint.h>
// UIGridItem
struct UIGridItem_t3654720203;
// UIGrid
struct UIGrid_t2420180906;
#include "UnityEngine_UnityEngine_MonoBehaviour1158329972.h"
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UIGridSubItem
struct UIGridSubItem_t3788884335 : public MonoBehaviour_t1158329972
{
public:
// UIGridItem UIGridSubItem::oEventReciever
UIGridItem_t3654720203 * ___oEventReciever_2;
// UIGrid UIGridSubItem::mGrid
UIGrid_t2420180906 * ___mGrid_3;
public:
inline static int32_t get_offset_of_oEventReciever_2() { return static_cast<int32_t>(offsetof(UIGridSubItem_t3788884335, ___oEventReciever_2)); }
inline UIGridItem_t3654720203 * get_oEventReciever_2() const { return ___oEventReciever_2; }
inline UIGridItem_t3654720203 ** get_address_of_oEventReciever_2() { return &___oEventReciever_2; }
inline void set_oEventReciever_2(UIGridItem_t3654720203 * value)
{
___oEventReciever_2 = value;
Il2CppCodeGenWriteBarrier(&___oEventReciever_2, value);
}
inline static int32_t get_offset_of_mGrid_3() { return static_cast<int32_t>(offsetof(UIGridSubItem_t3788884335, ___mGrid_3)); }
inline UIGrid_t2420180906 * get_mGrid_3() const { return ___mGrid_3; }
inline UIGrid_t2420180906 ** get_address_of_mGrid_3() { return &___mGrid_3; }
inline void set_mGrid_3(UIGrid_t2420180906 * value)
{
___mGrid_3 = value;
Il2CppCodeGenWriteBarrier(&___mGrid_3, value);
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
| [
"1"
] | 1 |
946f3f39ef05451cbf66627d964789a3abedc714 | 75fd789fc7a738758b1e6e008d9891acdf6f7b6c | /main.cpp | 12d6add286940da982e38af25cb06b7dc13d4811 | [] | no_license | Yukin1218/cv.lrgb | 6aad15fb61981b7dfac75ab449ab905ae1bab86b | 439dd0a9aa67828a9ef114639c571f9fc0a639f9 | refs/heads/master | 2020-12-24T17:08:28.746964 | 2014-04-29T10:13:09 | 2014-04-29T10:13:09 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,805 | cpp | /*
* Show the best 5 spaces for given image and foreground mask.
*/
#include <iostream>
#include <fstream>
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include "linear_rgb.h"
using namespace cv;
using namespace std;
int main(int argc, char *argv[])
{
// read in weights
int num_weights = 3;
int num_weights_cands = 49;
double *lrgb_weights = new double[num_weights * num_weights_cands];
fstream l49;
l49.open("l49.txt", fstream::in);
int cl49 = 0;
for(int i = 0; i < num_weights_cands; ++i) {
l49>>*(lrgb_weights + cl49)>>*(lrgb_weights + cl49 + 1)>>*(lrgb_weights + cl49 + 2);
cl49 += 3;
}
//for(int i = 0; i < num_weights * num_weights_cands; ++i) {
// cout<<*(lrgb_weights + i)<<" ";
//}
//cout<<endl;
l49.close();
// configurations
int num_bins = 64;
Mat image = imread(argv[1]);
Mat fg_mask = imread(argv[2], CV_LOAD_IMAGE_GRAYSCALE);
threshold(fg_mask, fg_mask, 10, 255, THRESH_BINARY);
Mat bg_mask;
bitwise_not(fg_mask, bg_mask);
// for each weights configuration, calc lrgb, hist and var.
vector<Lrgb_vr> ls;
int n_obj = countNonZero(fg_mask);
int n_bg = countNonZero(bg_mask);
double delta = 0.001;
for(int index = 0; index < num_weights_cands; ++index) {
Lrgb_vr g = calc_lrgb_vr(image, fg_mask, bg_mask, num_bins,
lrgb_weights + index * num_weights, num_weights);
ls.push_back(g);
}
// sort and show
Mat lrgb;
sort(ls.begin(), ls.end(), compare_lrgb_vr);
for(int i = 0; i < 5; ++i) {
Mat bp = calc_backproject_lrgb_vr(image, ls[i]);
cout<<"VR: "<<ls[i].vr<<endl;
namedWindow("Back projection");
imshow("Back projection", bp);
waitKey(0);
bp.release();
}
lrgb.release();
bg_mask.release();
fg_mask.release();
image.release();
delete lrgb_weights;
return 0;
} | [
"hzzhzzf@gmail.com"
] | hzzhzzf@gmail.com |
2af1bb9774d2d4da68d16d9e40868ce6838c0200 | 880f2ebae9268b1d4893b11dff0ee33342c99764 | /include/bitcoin_provider.hpp | 9c2c465851656e0c9b59a1ba1a883690864c1b43 | [] | no_license | UOSnetwork/singularity.modeling | a6b82628a9bbd7261bd5215867b2c1f8f6ec3c21 | c1ce4a68549dac3919bce59a46a2ce0debaf63d4 | refs/heads/master | 2020-05-16T03:43:46.352916 | 2019-05-07T13:06:50 | 2019-05-07T13:06:50 | 182,742,466 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 580 | hpp | #ifndef BITCOIN_PROVIDER_HPP
#define BITCOIN_PROVIDER_HPP
#ifdef USE_BITCOIN
#include "providers.hpp"
class bitcoin_provider_t: public provider_t
{
public:
bitcoin_provider_t(std::string bitcoin_data_dir, uint64_t start_block, uint64_t end_block, uint64_t height)
:bitcoin_data_dir(bitcoin_data_dir) {}
virtual std::vector<std::shared_ptr<singularity::relation_t> > get_block();
private:
std::string bitcoin_data_dir;
uint64_t start_block;
uint64_t end_block;
uint64_t height;
};
#endif /* USE_BITCOIN */
#endif /* BITCOIN_PROVIDER_HPP */
| [
"prokopov.alexey@gmail.com"
] | prokopov.alexey@gmail.com |
6c88da0ab9203ca5081e905497e01c73745cc82f | 016a76f34eec39377e1f40ff339b5e9238862d6a | /ListADT.h | b6dad654264e46adeabb28fbfab33fdc2447908a | [] | no_license | JoshLikesToCode/VectorAndListADT | d89a3b0b4cc6a1ef673e895ec7df1523310aaa65 | 01761b8a5bc17c89357daabd4c33010763d2a81c | refs/heads/master | 2020-09-12T18:39:25.806713 | 2019-11-18T18:14:39 | 2019-11-18T18:14:39 | 222,513,513 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 892 | h | #ifndef _LISTADT_H_
#define _LISTADT_H_
#include <iostream>
class ListADT
{
public:
class Node {
public:
Node () { value = 0; next = nullptr; };
Node (int val) { value = val; next = nullptr; };
int value;
Node *next;
};
Node *head;
int size;
ListADT();
~ListADT();
ListADT(int s, Node* head); // size = 0, head = nullptr
ListADT(const ListADT& c); // copy ctor
ListADT& operator=(ListADT& rhs);
int operator[](int index);
friend std::ostream &operator<<(std::ostream &os, ListADT& list);
void push_back(int val);
void push_front(int val);
void pop_back();
void pop_front();
int length() const;
// helper functions
void recursive_display(Node *p);
int count_nodes(Node *p);
int del(Node *p, int index);
};
#endif // _LISTADT_H_
| [
"noreply@github.com"
] | noreply@github.com |
201236797836dd29e00223f5021ea1171d862ef8 | e34e6f6b843184545f7a3146e066c34cbc6a52fa | /_opencv_app/FacePCA/FacePCA/CvGabor.cpp | 1e60fc9e29a81d2e28c11d8db199b7329087b1f2 | [] | no_license | HVisionSensing/CreativeCoding | 8440dbce75bb72150b1b904ecb903c66f41373a7 | d3a18a1fcf9ef72b48947f3e98be50354297ec7e | refs/heads/master | 2021-01-20T15:50:12.062976 | 2012-08-31T08:42:34 | 2012-08-31T08:42:34 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 18,894 | cpp | /***************************************************************************
* Copyright (C) 2006 by Mian Zhou *
* M.Zhou@reading.ac.uk *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include "cvgabor.h"
CvGabor::CvGabor()
{
}
CvGabor::~CvGabor()
{
cvReleaseMat( &Real );
cvReleaseMat( &Imag );
}
/*!
\fn CvGabor::CvGabor(int iMu, int iNu, double dSigma)
Construct a gabor
Parameters:
iMu The orientation iMu*PI/8,
iNu The scale,
dSigma The sigma value of Gabor,
Returns:
None
Create a gabor with a orientation iMu*PI/8, a scale iNu, and a sigma value dSigma. The spatial frequence (F) is set to sqrt(2) defaultly. It calls Init() to generate parameters and kernels.
*/
CvGabor::CvGabor(int iMu, int iNu, double dSigma)
{
F = sqrt(2.0);
Init(iMu, iNu, dSigma, F);
}
/*!
\fn CvGabor::CvGabor(int iMu, int iNu, double dSigma, double dF)
Construct a gabor
Parameters:
iMu The orientation iMu*PI/8
iNu The scale
dSigma The sigma value of Gabor
dF The spatial frequency
Returns:
None
Create a gabor with a orientation iMu*PI/8, a scale iNu, a sigma value dSigma, and a spatial frequence dF. It calls Init() to generate parameters and kernels.
*/
CvGabor::CvGabor(int iMu, int iNu, double dSigma, double dF)
{
Init(iMu, iNu, dSigma, dF);
}
/*!
\fn CvGabor::CvGabor(double dPhi, int iNu)
Construct a gabor
Parameters:
dPhi The orientation in arc
iNu The scale
Returns:
None
Create a gabor with a orientation dPhi, and with a scale iNu. The sigma (Sigma) and the spatial frequence (F) are set to 2*PI and sqrt(2) defaultly. It calls Init() to generate parameters and kernels.
*/
CvGabor::CvGabor(double dPhi, int iNu)
{
Sigma = 2*PI;
F = sqrt(2.0);
Init(dPhi, iNu, Sigma, F);
}
/*!
\fn CvGabor::CvGabor(double dPhi, int iNu, double dSigma)
Construct a gabor
Parameters:
dPhi The orientation in arc
iNu The scale
dSigma The sigma value of Gabor
Returns:
None
Create a gabor with a orientation dPhi, a scale iNu, and a sigma value dSigma. The spatial frequence (F) is set to sqrt(2) defaultly. It calls Init() to generate parameters and kernels.
*/
CvGabor::CvGabor(double dPhi, int iNu, double dSigma)
{
F = sqrt(2.0);
Init(dPhi, iNu, dSigma, F);
}
/*!
\fn CvGabor::CvGabor(double dPhi, int iNu, double dSigma, double dF)
Construct a gabor
Parameters:
dPhi The orientation in arc
iNu The scale
dSigma The sigma value of Gabor
dF The spatial frequency
Returns:
None
Create a gabor with a orientation dPhi, a scale iNu, a sigma value dSigma, and a spatial frequence dF. It calls Init() to generate parameters and kernels.
*/
CvGabor::CvGabor(double dPhi, int iNu, double dSigma, double dF)
{
Init(dPhi, iNu, dSigma,dF);
}
/*!
\fn CvGabor::IsInit()
Determine the gabor is initilised or not
Parameters:
None
Returns:
a boolean value, TRUE is initilised or FALSE is non-initilised.
Determine whether the gabor has been initlized - variables F, K, Kmax, Phi, Sigma are filled.
*/
bool CvGabor::IsInit()
{
return bInitialised;
}
/*!
\fn CvGabor::mask_width()
Give out the width of the mask
Parameters:
None
Returns:
The long type show the width.
Return the width of mask (should be NxN) by the value of Sigma and iNu.
*/
long CvGabor::mask_width()
{
long lWidth;
if (IsInit() == false) {
perror ("Error: The Object has not been initilised in mask_width()!\n");
return 0;
}
else {
//determine the width of Mask
double dModSigma = Sigma/K;
double dWidth = cvRound(dModSigma*6 + 1);
//test whether dWidth is an odd.
if (fmod(dWidth, 2.0)==0.0) dWidth++;
lWidth = (long)dWidth;
return lWidth;
}
}
/*!
\fn CvGabor::creat_kernel()
Create gabor kernel
Parameters:
None
Returns:
None
Create 2 gabor kernels - REAL and IMAG, with an orientation and a scale
*/
void CvGabor::creat_kernel()
{
if (IsInit() == false) {perror("Error: The Object has not been initilised in creat_kernel()!\n");}
else {
CvMat *mReal, *mImag;
mReal = cvCreateMat( Width, Width, CV_32FC1);
mImag = cvCreateMat( Width, Width, CV_32FC1);
/**************************** Gabor Function ****************************/
int x, y;
double dReal;
double dImag;
double dTemp1, dTemp2, dTemp3;
for (int i = 0; i < Width; i++)
{
for (int j = 0; j < Width; j++)
{
x = i-(Width-1)/2;
y = j-(Width-1)/2;
dTemp1 = (pow(K,2)/pow(Sigma,2))*exp(-(pow((double)x,2)+pow((double)y,2))*pow(K,2)/(2*pow(Sigma,2)));
dTemp2 = cos(K*cos(Phi)*x + K*sin(Phi)*y) - exp(-(pow(Sigma,2)/2));
dTemp3 = sin(K*cos(Phi)*x + K*sin(Phi)*y);
dReal = dTemp1*dTemp2;
dImag = dTemp1*dTemp3;
//gan_mat_set_el(pmReal, i, j, dReal);
//cvmSet( (CvMat*)mReal, i, j, dReal );
cvSetReal2D((CvMat*)mReal, i, j, dReal );
//gan_mat_set_el(pmImag, i, j, dImag);
//cvmSet( (CvMat*)mImag, i, j, dImag );
cvSetReal2D((CvMat*)mImag, i, j, dImag );
}
}
/**************************** Gabor Function ****************************/
bKernel = true;
cvCopy(mReal, Real, NULL);
cvCopy(mImag, Imag, NULL);
//printf("A %d x %d Gabor kernel with %f PI in arc is created.\n", Width, Width, Phi/PI);
cvReleaseMat( &mReal );
cvReleaseMat( &mImag );
}
}
/*!
\fn CvGabor::get_image(int Type)
Get the speific type of image of Gabor
Parameters:
Type The Type of gabor kernel, e.g. REAL, IMAG, MAG, PHASE
Returns:
Pointer to image structure, or NULL on failure
Return an Image (gandalf image class) with a specific Type "REAL" "IMAG" "MAG" "PHASE"
*/
IplImage* CvGabor::get_image(int Type)
{
if(IsKernelCreate() == false)
{
perror("Error: the Gabor kernel has not been created in get_image()!\n");
return NULL;
}
else
{
IplImage* pImage;
IplImage *newimage;
newimage = cvCreateImage(cvSize(Width,Width), IPL_DEPTH_8U, 1 );
//printf("Width is %d.\n",(int)Width);
//printf("Sigma is %f.\n", Sigma);
//printf("F is %f.\n", F);
//printf("Phi is %f.\n", Phi);
//pImage = gan_image_alloc_gl_d(Width, Width);
pImage = cvCreateImage( cvSize(Width,Width), IPL_DEPTH_32F, 1 );
CvMat* kernel = cvCreateMat(Width, Width, CV_32FC1);
CvMat* re = cvCreateMat(Width, Width, CV_32FC1);
CvMat* im = cvCreateMat(Width, Width, CV_32FC1);
double ve, ve1,ve2;
CvSize size = cvGetSize( kernel );
int rows = size.height;
int cols = size.width;
switch(Type)
{
case 1: //Real
cvCopy( (CvMat*)Real, (CvMat*)kernel, NULL );
//pImage = cvGetImage( (CvMat*)kernel, pImageGL );
for (int i = 0; i < rows; i++)
{
for (int j = 0; j < cols; j++)
{
ve = cvGetReal2D((CvMat*)kernel, i, j);
cvSetReal2D( (IplImage*)pImage, j, i, ve );
}
}
break;
case 2: //Imag
cvCopy( (CvMat*)Imag, (CvMat*)kernel, NULL );
//pImage = cvGetImage( (CvMat*)kernel, pImageGL );
for (int i = 0; i < rows; i++)
{
for (int j = 0; j < cols; j++)
{
ve = cvGetReal2D((CvMat*)kernel, i, j);
cvSetReal2D( (IplImage*)pImage, j, i, ve );
}
}
break;
case 3: //Magnitude //add by yao
cvCopy( (CvMat*)Real, (CvMat*)re, NULL );
cvCopy( (CvMat*)Imag, (CvMat*)im, NULL );
for (int i = 0; i < rows; i++)
{
for (int j = 0; j < cols; j++)
{
ve1 = cvGetReal2D((CvMat*)re, i, j);
ve2 = cvGetReal2D((CvMat*)im, i, j);
ve = cvSqrt(ve1*ve1+ve2*ve2);
cvSetReal2D( (IplImage*)pImage, j, i, ve );
}
}
break;
case 4: //Phase
///@todo
break;
}
cvNormalize((IplImage*)pImage, (IplImage*)pImage, 0, 255, CV_MINMAX, NULL );
cvConvertScaleAbs( (IplImage*)pImage, (IplImage*)newimage, 1, 0 );
cvReleaseMat(&kernel);
cvReleaseImage(&pImage);
return newimage;
}
}
/*!
\fn CvGabor::IsKernelCreate()
Determine the gabor kernel is created or not
Parameters:
None
Returns:
a boolean value, TRUE is created or FALSE is non-created.
Determine whether a gabor kernel is created.
*/
bool CvGabor::IsKernelCreate()
{
return bKernel;
}
/*!
\fn CvGabor::get_mask_width()
Reads the width of Mask
Parameters:
None
Returns:
Pointer to long type width of mask.
*/
long CvGabor::get_mask_width()
{
return Width;
}
/*!
\fn CvGabor::Init(int iMu, int iNu, double dSigma, double dF)
Initilize the.gabor
Parameters:
iMu The orientations is iMu*PI/8
iNu The scale can be from -5 to infinit
dSigma The Sigma value of gabor, Normally set to 2*PI
dF The spatial frequence , normally is sqrt(2)
Returns:
Initilize the.gabor with the orientation iMu, the scale iNu, the sigma dSigma, the frequency dF, it will call the function creat_kernel(); So a gabor is created.
*/
void CvGabor::Init(int iMu, int iNu, double dSigma, double dF)
{
//Initilise the parameters
bInitialised = false;
bKernel = false;
Sigma = dSigma;
F = dF;
Kmax = PI/2;
// Absolute value of K
K = Kmax / pow(F, (double)iNu);
Phi = PI*iMu/8;
bInitialised = true;
Width = mask_width();
Real = cvCreateMat( Width, Width, CV_32FC1);
Imag = cvCreateMat( Width, Width, CV_32FC1);
creat_kernel();
}
/*!
\fn CvGabor::Init(double dPhi, int iNu, double dSigma, double dF)
Initilize the.gabor
Parameters:
dPhi The orientations
iNu The scale can be from -5 to infinit
dSigma The Sigma value of gabor, Normally set to 2*PI
dF The spatial frequence , normally is sqrt(2)
Returns:
None
Initilize the.gabor with the orientation dPhi, the scale iNu, the sigma dSigma, the frequency dF, it will call the function creat_kernel(); So a gabor is created.filename The name of the image file
file_format The format of the file, e.g. GAN_PNG_FORMAT
image The image structure to be written to the file
octrlstr Format-dependent control structure
*/
void CvGabor::Init(double dPhi, int iNu, double dSigma, double dF)
{
bInitialised = false;
bKernel = false;
Sigma = dSigma;
F = dF;
Kmax = PI/2;
// Absolute value of K
K = Kmax / pow(F, (double)iNu);
Phi = dPhi;
bInitialised = true;
Width = mask_width();
Real = cvCreateMat( Width, Width, CV_32FC1);
Imag = cvCreateMat( Width, Width, CV_32FC1);
creat_kernel();
}
/*!
\fn CvGabor::get_matrix(int Type)
Get a matrix by the type of kernel
Parameters:
Type The type of kernel, e.g. REAL, IMAG, MAG, PHASE
Returns:
Pointer to matrix structure, or NULL on failure.
Return the gabor kernel.
*/
CvMat* CvGabor::get_matrix(int Type)
{
if (!IsKernelCreate()) {perror("Error: the gabor kernel has not been created!\n"); return NULL;}
switch (Type)
{
case CV_GABOR_REAL:
return Real;
case CV_GABOR_IMAG:
return Imag;
case CV_GABOR_MAG:
return NULL;
case CV_GABOR_PHASE:
return NULL;
default:
return NULL;
}
}
/*!
\fn CvGabor::output_file(const char *filename, Gan_ImageFileFormat file_format, int Type)
Writes a gabor kernel as an image file.
Parameters:
filename The name of the image file
file_format The format of the file, e.g. GAN_PNG_FORMAT
Type The Type of gabor kernel, e.g. REAL, IMAG, MAG, PHASE
Returns:
None
Writes an image from the provided image structure into the given file and the type of gabor kernel.
*/
void CvGabor::output_file(const char *filename, int Type)
{
IplImage *pImage;
pImage = get_image(Type);
if(pImage != NULL)
{
if( cvSaveImage(filename, pImage )) printf("%s has been written successfully!\n", filename);
else printf("Error: writting %s has failed!\n", filename);
}
else
perror("Error: the image is empty in output_file()!\n");
cvReleaseImage(&pImage);
}
/*!
\fn CvGabor::show(int Type)
*/
void CvGabor::show(int Type)
{
if(!IsInit()) {
perror("Error: the gabor kernel has not been created!\n");
}
else {
IplImage *pImage;
pImage = get_image(Type);
cvNamedWindow("Testing",1);
cvShowImage("Testing",pImage);
cvWaitKey(0);
cvDestroyWindow("Testing");
cvReleaseImage(&pImage);
}
}
/*!
\fn CvGabor::conv_img_a(IplImage *src, IplImage *dst, int Type)
*/
void CvGabor::conv_img_a(IplImage *src, IplImage *dst, int Type)
{
double ve, re,im;
int width = src->width;
int height = src->height;
CvMat *mat = cvCreateMat(src->width, src->height, CV_32FC1);
for (int i = 0; i < width; i++)
{
for (int j = 0; j < height; j++)
{
ve = cvGetReal2D((IplImage*)src, j, i);
cvSetReal2D( (CvMat*)mat, i, j, ve );
}
}
CvMat *rmat = cvCreateMat(width, height, CV_32FC1);
CvMat *imat = cvCreateMat(width, height, CV_32FC1);
CvMat *kernel = cvCreateMat( Width, Width, CV_32FC1 );
switch (Type)
{
case CV_GABOR_REAL:
cvCopy( (CvMat*)Real, (CvMat*)kernel, NULL );
cvFilter2D( (CvMat*)mat, (CvMat*)mat, (CvMat*)kernel, cvPoint( (Width-1)/2, (Width-1)/2));
break;
case CV_GABOR_IMAG:
cvCopy( (CvMat*)Imag, (CvMat*)kernel, NULL );
cvFilter2D( (CvMat*)mat, (CvMat*)mat, (CvMat*)kernel, cvPoint( (Width-1)/2, (Width-1)/2));
break;
case CV_GABOR_MAG:
/* Real Response */
cvCopy( (CvMat*)Real, (CvMat*)kernel, NULL );
cvFilter2D( (CvMat*)mat, (CvMat*)rmat, (CvMat*)kernel, cvPoint( (Width-1)/2, (Width-1)/2));
/* Imag Response */
cvCopy( (CvMat*)Imag, (CvMat*)kernel, NULL );
cvFilter2D( (CvMat*)mat, (CvMat*)imat, (CvMat*)kernel, cvPoint( (Width-1)/2, (Width-1)/2));
/* Magnitude response is the square root of the sum of the square of real response and imaginary response */
for (int i = 0; i < width; i++)
{
for (int j = 0; j < height; j++)
{
re = cvGetReal2D((CvMat*)rmat, i, j);
im = cvGetReal2D((CvMat*)imat, i, j);
ve = sqrt(re*re + im*im);
cvSetReal2D( (CvMat*)mat, i, j, ve );
}
}
break;
case CV_GABOR_PHASE:
break;
}
if (dst->depth == IPL_DEPTH_8U)
{
cvNormalize((CvMat*)mat, (CvMat*)mat, 0, 255, CV_MINMAX, NULL);
for (int i = 0; i < width; i++)
{
for (int j = 0; j < height; j++)
{
ve = cvGetReal2D((CvMat*)mat, i, j);
ve = cvRound(ve);
cvSetReal2D( (IplImage*)dst, j, i, ve );
}
}
}
if (dst->depth == IPL_DEPTH_32F)
{
for (int i = 0; i < width; i++)
{
for (int j = 0; j < height; j++)
{
ve = cvGetReal2D((CvMat*)mat, i, j);
cvSetReal2D( (IplImage*)dst, j, i, ve );
}
}
}
cvReleaseMat(&kernel);
cvReleaseMat(&imat);
cvReleaseMat(&rmat);
cvReleaseMat(&mat);
}
/*!
\fn CvGabor::CvGabor(int iMu, int iNu)
*/
CvGabor::CvGabor(int iMu, int iNu)
{
double dSigma = 2*PI;
F = sqrt(2.0);
Init(iMu, iNu, dSigma, F);
}
/*!
\fn CvGabor::normalize( const CvArr* src, CvArr* dst, double a, double b, int norm_type, const CvArr* mask )
*/
void CvGabor::normalize( const CvArr* src, CvArr* dst, double a, double b, int norm_type, const CvArr* mask )
{
CvMat* tmp = 0;
__CV_BEGIN__;
double scale, shift;
if( norm_type == CV_MINMAX )
{
double smin = 0, smax = 0;
double dmin = MIN( a, b ), dmax = MAX( a, b );
cvMinMaxLoc( src, &smin, &smax, 0, 0, mask );
scale = (dmax - dmin)*(smax - smin > DBL_EPSILON ? 1./(smax - smin) : 0);
shift = dmin - smin*scale;
}
else if( norm_type == CV_L2 || norm_type == CV_L1 || norm_type == CV_C )
{
CvMat *s = (CvMat*)src, *d = (CvMat*)dst;
scale = cvNorm( src, 0, norm_type, mask );
scale = scale > DBL_EPSILON ? 1./scale : 0.;
shift = 0;
}
else {}
if( !mask )
cvConvertScale( src, dst, scale, shift );
else
{
cvConvertScale( src, tmp, scale, shift );
cvCopy( tmp, dst, mask );
}
__CV_END__;
if( tmp )
cvReleaseMat( &tmp );
}
/*!
\fn CvGabor::conv_img(IplImage *src, IplImage *dst, int Type)
*/
void CvGabor::conv_img(IplImage *src, IplImage *dst, int Type)
{
double ve;
CvMat *mat = cvCreateMat(src->width, src->height, CV_32FC1);
for (int i = 0; i < src->width; i++)
{
for (int j = 0; j < src->height; j++)
{
ve = CV_IMAGE_ELEM(src, uchar, j, i);
CV_MAT_ELEM(*mat, float, i, j) = (float)ve;
}
}
CvMat *rmat = cvCreateMat(src->width, src->height, CV_32FC1);
CvMat *imat = cvCreateMat(src->width, src->height, CV_32FC1);
switch (Type)
{
case CV_GABOR_REAL:
cvFilter2D( (CvMat*)mat, (CvMat*)mat, (CvMat*)Real, cvPoint( (Width-1)/2, (Width-1)/2));
break;
case CV_GABOR_IMAG:
cvFilter2D( (CvMat*)mat, (CvMat*)mat, (CvMat*)Imag, cvPoint( (Width-1)/2, (Width-1)/2));
break;
case CV_GABOR_MAG:
cvFilter2D( (CvMat*)mat, (CvMat*)rmat, (CvMat*)Real, cvPoint( (Width-1)/2, (Width-1)/2));
cvFilter2D( (CvMat*)mat, (CvMat*)imat, (CvMat*)Imag, cvPoint( (Width-1)/2, (Width-1)/2));
cvPow(rmat,rmat,2);
cvPow(imat,imat,2);
cvAdd(imat,rmat,mat);
cvPow(mat,mat,0.5);
break;
case CV_GABOR_PHASE:
break;
}
if (dst->depth == IPL_DEPTH_8U)
{
cvNormalize((CvMat*)mat, (CvMat*)mat, 0, 255, CV_MINMAX);
for (int i = 0; i < mat->rows; i++)
{
for (int j = 0; j < mat->cols; j++)
{
ve = CV_MAT_ELEM(*mat, float, i, j);
CV_IMAGE_ELEM(dst, uchar, j, i) = (uchar)cvRound(ve);
}
}
}
if (dst->depth == IPL_DEPTH_32F)
{
for (int i = 0; i < mat->rows; i++)
{
for (int j = 0; j < mat->cols; j++)
{
ve = cvGetReal2D((CvMat*)mat, i, j);
cvSetReal2D( (IplImage*)dst, j, i, ve );
}
}
}
cvReleaseMat(&imat);
cvReleaseMat(&rmat);
cvReleaseMat(&mat);
} | [
"vinjn.z@gmail.com"
] | vinjn.z@gmail.com |
9785f3a3920444118739a36d6430306fd47dd01e | 59da550b1c9f09aff3cc0e33f5ba18c53eee9389 | /src/fvPatchFields/wavePressure/wavePressureFvPatchScalarField.H | a41ba884e1e3f4f66db7ea64bfda0e2b62a651b9 | [] | no_license | Elsafti/waves2Foam | 6b81c37d4202cde5540e194706178290bfc98577 | b604631a65cdb7ba3e7a61972620e5c535f8b54b | refs/heads/master | 2021-01-18T07:40:52.499383 | 2012-12-06T17:06:30 | 2012-12-06T17:06:30 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 5,560 | h | /*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright held by original author
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM 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.
OpenFOAM 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 OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
Foam::wavePressureFvPatchScalarField
Description
Boundary condition for the pressure gradient in a multiphase solver.
To be used for wave boundary conditions. For more details see:
@article { jacobsenFuhrmanFredsoe2011,
Author = {Jacobsen, N G and Fuhrman, D R and Freds\o{}e, J},
title = {{A Wave Generation Toolbox for the Open-Source CFD Library: OpenFoam\textregistered{}}},
Journal = {{Int. J. for Numer. Meth. Fluids}},
Year = {2012},
Volume = {70},
Number = {9},
Pages = {1073-1088},
DOI = {{10.1002/fld.2726}},
}
The boundary condition is derived from mixedFvPatchField and it is generic
in the sense, that it loads the abstract class waveTheory.
SourceFiles
wavePressureFvPatchScalarField.C
Author
Niels Gjøl Jacobsen, Technical University of Denmark. All rights reserved.
\*---------------------------------------------------------------------------*/
#ifndef wavePressureFvPatchScalarField_H
#define wavePressureFvPatchScalarField_H
#include "mixedFvPatchField.H"
#include "convexPolyhedral.H"
#include "waveTheory.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class wavePressureFvPatchScalarField Declaration
\*---------------------------------------------------------------------------*/
class wavePressureFvPatchScalarField
:
public mixedFvPatchField<scalar>,
public convexPolyhedral
{
private:
// Private member functions
autoPtr<waveTheories::waveTheory> waveProps_;
// Private member functions
//- Returns a scalarField of the signed distance to an arbitrary surface
virtual void signedPointToSurfaceDistance
(
const pointField &,
scalarField &
);
//- Returns a scalar of the signed distance to an arbitrary surface
virtual scalar signedPointToSurfaceDistance
(
const point &
) const;
public:
//- Runtime type information
TypeName("wavePressure");
// Constructors
//- Construct from patch and internal field
wavePressureFvPatchScalarField
(
const fvPatch&,
const DimensionedField<scalar, volMesh>&
);
//- Construct from patch, internal field and dictionary
wavePressureFvPatchScalarField
(
const fvPatch&,
const DimensionedField<scalar, volMesh>&,
const dictionary&
);
//- Construct by mapping given surfaceWaveVelocityFvPatchVectorField onto a new patch
wavePressureFvPatchScalarField
(
const wavePressureFvPatchScalarField&,
const fvPatch&,
const DimensionedField<scalar, volMesh>&,
const fvPatchFieldMapper&
);
//- Construct and return a clone
virtual tmp<fvPatchField<scalar> > clone() const
{
return tmp<fvPatchField<scalar> >
(
new wavePressureFvPatchScalarField(*this)
);
}
//- Construct as copy setting internal field reference
wavePressureFvPatchScalarField
(
const wavePressureFvPatchScalarField&,
const DimensionedField<scalar, volMesh>&
);
//- Construct and return a clone setting internal field reference
virtual tmp<fvPatchField<scalar> > clone(const DimensionedField<scalar, volMesh>& iF) const
{
return tmp<fvPatchField<scalar> >
(
new wavePressureFvPatchScalarField(*this, iF)
);
}
// Member functions
//- Update the coefficients associated with the patch field
virtual void updateCoeffs();
//- Evaluate the patch field
virtual void evaluate();
//- Write
virtual void write(Ostream&) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
//#ifdef NoRepository
//# include "surfaceWaveVelocityFvPatchVectorField.C"
//#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //
| [
"ngjacobsen@e4e07f05-0c2f-0410-a05a-b8ba57e0c909"
] | ngjacobsen@e4e07f05-0c2f-0410-a05a-b8ba57e0c909 |
2eaeb819dc21f69a3797f9ae0a737b4cd0b126f0 | f5788ce2deadbbe930a5396a8debd19d4b46e1a1 | /src/71_SimplifyPath/SimplifyPath.cc | a0f585dc34cefa1cd1b55d2ceea99e753907488a | [] | no_license | feixia586/leetcode | 3d8c0c8a6d826fa0ba6931f26c15e4c38471d14e | d29da59412a1ce2f164434d9d4b16489e26e1852 | refs/heads/master | 2021-01-17T13:11:01.075096 | 2017-06-05T01:16:24 | 2017-06-05T01:16:24 | 15,178,743 | 8 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 869 | cc | #include <string>
#include <vector>
#include <assert.h>
using namespace std;
class Solution {
public:
string simplifyPath(string path) {
assert(path[0] == '/');
vector<string> stk;
int len = path.length();
int i = 0;
while (i < len) {
while(i < len && path[i] == '/') { i++; }
if (i == len) { break; }
int begin = i;
while(i < len && path[i] != '/') { i++; }
int end = i;
string element = path.substr(begin, end - begin);
if (element == ".") {
continue;
} else if (element == "..") {
if (stk.size() > 0) {
stk.pop_back();
}
} else {
stk.push_back(element);
}
}
if (stk.size() == 0) {
return "/";
}
string res;
for (int i = 0; i < (int)stk.size(); i++) {
res += ("/" + stk[i]);
}
return res;
}
};
| [
"feixia@cs.cmu.edu"
] | feixia@cs.cmu.edu |
92c68ce328d9ead79196f444a862489dbb48e8d6 | f61b048bdca010f16057630a918915ae062bc779 | /edge/hanger/N2_MgSW.ino | 62dce71ba91959d7c8fcbe85413d1f62409d6bb2 | [] | no_license | M-yuhki/kdghack2018 | 8dfe4b5961e00d977567d1b5e2eb159db16c588a | 1c1709b27b1120eb6946277fb34ccc3a83025116 | refs/heads/master | 2020-04-09T06:36:28.705766 | 2019-02-04T07:27:24 | 2019-02-04T07:27:24 | 160,120,012 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 6,382 | ino | /**
* N2日本語音声合成Box制御サンプルコード(シンプル版)
* Author: Crowd Machines Projecct / KDDI Research, Inc.
* created by 2018/11/13
*/
#include <WioCellLibforArduino.h>
#define INTERVAL 100
// 接続したMagnetic SWの位置に合わせて、下記のコメントを付けたり、外したりしてください。
// #define MAG WIO_D38
#define MAG WIO_D20
static int flag;
static int flag_result;
/**
* N2TTS: 日本語音声合成Box制御用ラッパクラス
*/
class N2TTS
{
static const uint8_t I2C_ADDRESS = 0x4f;
/**
* N2音声合成Boxへのコマンド定義
*/
static const uint8_t CMD_SETVOLUME = 0x40;
static const uint8_t CMD_GETVOLUME = 0x40;
static const uint8_t CMD_SETSPEECHRATE = 0x41;
static const uint8_t CMD_GETSPEECHRATE = 0x41;
static const uint8_t CMD_SETPITCH = 0x42;
static const uint8_t CMD_GETPITCH = 0x42;
static const uint8_t CMD_SETTEXT = 0x67;
static const uint8_t TEXTTYPE_PLAIN = 1;
static const uint8_t CMD_START = 0x68;
static const uint8_t CMD_GETLENGTH = 0x69;
private:
// helper private method
/**
* N2音声合成Boxへのコマンド開始指示
*/
const N2TTS * begin_cmd(uint8_t cmd) const
{
WireI2C.beginTransmission(N2TTS::I2C_ADDRESS);
WireI2C.write(cmd);
return this;
}
/**
* N2音声合成boxへのコマンド終了指示
*/
const N2TTS * end_cmd() const {
WireI2C.endTransmission();
return this;
}
public:
/**
* 音声合成Boxから設定されているパラメータを取得する
* Parameter cmd: 取得するパラメータの識別用コマンド
* Return: 取得したパラメータ、整数
*/
int GetParam(uint8_t cmd) const
{
this->begin_cmd(cmd)->end_cmd();
if (WireI2C.requestFrom(N2TTS::I2C_ADDRESS,4) != 4) {
return -1;
}
int32_t val=0;
((uint8_t*)&val)[0] = WireI2C.read();
((uint8_t*)&val)[1] = WireI2C.read();
((uint8_t*)&val)[2] = WireI2C.read();
((uint8_t*)&val)[3] = WireI2C.read();
return val;
}
/**
* 音声合成Boxへ所定のパラメータを設定する
* Parameter cmd: 設定するパラメータを示す識別用コマンド
* Parameter val: 設定する値
* Return: None
*/
void SetParam(uint8_t cmd, int val)
{
this->begin_cmd(cmd);
WireI2C.write(((uint8_t*)&val)[0]);
WireI2C.write(((uint8_t*)&val)[1]);
WireI2C.write(((uint8_t*)&val)[2]);
WireI2C.write(((uint8_t*)&val)[3]);
this->end_cmd();
}
// 以下パラメータ設定・取得用コマンドのラッパメソッド
void setVolume(int vol) {
this->SetParam(N2TTS::CMD_SETVOLUME,vol);
}
int getVolume() const {
return this->GetParam(N2TTS::CMD_GETVOLUME);
}
void setSpeechRate(int srate) {
this->SetParam(N2TTS::CMD_SETSPEECHRATE,srate);
}
int getSpeechRate() const {
return this->GetParam(N2TTS::CMD_GETSPEECHRATE);
}
void setPitch(int pitch) {
this->SetParam(N2TTS::CMD_SETPITCH, pitch);
}
int getPitch() const {
return this->GetParam(N2TTS::CMD_GETPITCH);
}
/**
* 指定されたテキストを音声合成Boxへ送信し、喋らせる
* Parameter text: テキストデータ、Nullターミネートしている場合、lengthパラメータは不要
* Parameter length: テキストデータの長さ
* Return: サンプル数 (音声合成Boxは、32Kサンプル固定で音声再生を行なっている)
*/
int Speak(const char *text, int length=-1)
{
int slen = length;
if (slen<0) {
slen = strlen(text);
}
this->begin_cmd(N2TTS::CMD_SETTEXT);
WireI2C.write(N2TTS::TEXTTYPE_PLAIN);
SerialUSB.print("speak text is: ");
for (int i=0;i<slen && *text!='\0';i++) {
SerialUSB.print(*text);
WireI2C.write(*text);
++text;
}
if (*text!='\0') {
WireI2C.write('\0');
}
SerialUSB.println("");
this->end_cmd();
delay(slen * 20);
int len = this->GetParam(N2TTS::CMD_GETLENGTH);
this->begin_cmd(N2TTS::CMD_START)->end_cmd();
int play_time = int(len*1000/32000);
delay(play_time);
return len;
}
};
WioCellular Wio;
void setup() {
delay(200);
SerialUSB.begin(115200);
SerialUSB.println("");
SerialUSB.println("--- START ---------------------------------------------------");
SerialUSB.println("### I/O Initialize.");
Wio.Init();
SerialUSB.println("### Power supply ON.");
Wio.PowerSupplyGrove(true);
delay(500);
SerialUSB.println("### TTS Initialize.");
WireI2C.begin();
SerialUSB.println("### Setup completed.");
N2TTS n2;
int v = n2.getVolume();
SerialUSB.print("default volume is ");
SerialUSB.println(v);
v = n2.getSpeechRate();
SerialUSB.print("default speech rate is ");
SerialUSB.println(v);
v = n2.getPitch();
SerialUSB.print("default pitch rate is ");
SerialUSB.println(v);
// GROVE端子へ電源供給を行う(D38以外向け)
Wio.PowerSupplyGrove(true);
// ポートをDIGITAL INPUTモードにする
pinMode(MAG, INPUT);
flag = 0;
flag_result = 0;
}
void loop() {
N2TTS n2;
delay(INTERVAL);
// ボタンの状態を読み取る
int btn = digitalRead(MAG);
// n2.setVolume(256); // default volume
//扉が開くと
if(btn == 0 and flag_result == 0){
n2.Speak("おはよう!よく眠れた?今日のおすすめコーデを紹介するね!");
setup();
flag = 0;
n2.setPitch(0);
n2.Speak("ドドドドドドドドドドドド");
int v = n2.getPitch();
SerialUSB.print("default pitch rate is ");
SerialUSB.println(v);
// if(結果が出た){
n2.Speak("ドン!!");
//結果が出たらこれ以上話さなくする
flag_result = 1;
// }
}
//扉を閉めると
if(btn == 1 and flag == 0){
n2.setPitch(0);
int v = n2.getPitch();
SerialUSB.print("default pitch rate is ");
SerialUSB.println(v);
n2.Speak("今日も張り切って行ってらっしゃい");
// n2.setPitch(0);
v = n2.getPitch();
SerialUSB.print("default pitch rate is ");
SerialUSB.println(v);
// n2.Speak("またね〜");
flag = 1;
}
// SerialUSB.println("### SetVolume begin.");
// n2.setVolume(128); // 半分の音量にする
// SerialUSB.println("### SetVolume completed.");
}
| [
"yuhki@yuki.local"
] | yuhki@yuki.local |
9cd8650878cdbf7a5b0ec89ef5a414e4362be74f | 32d373bdd62a23a8d1db79accde683d835bf1aa8 | /C程序/chapter5/e5-4.cpp | 52c6c5d1f0da4890d2a761c40db1b76f337d06a8 | [] | no_license | sqsgalaxys/workspace | 77f585574111369e1ea892838e7b4737e9e943f8 | 0777c68f530aaabffa9a5a294b14c449774b6ac3 | refs/heads/master | 2021-01-01T17:27:06.512834 | 2016-09-20T12:19:55 | 2016-09-20T12:19:55 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 123 | cpp | #include <stdafx.h>
void main()
{
char c;
scanf("%c",&c);
int d = c >= 'A' && c <= 'Z' ? c+32 : c;
printf("%c\n",d);
} | [
"samlv@tencent.com"
] | samlv@tencent.com |
3a1bcbd54f663e7304f54fcaccbd9c7bc0fc1110 | 82815230eeaf24d53f38f2a3f144dd8e8d4bc6b5 | /Airfoil/wingMotion/wingMotion2D_pimpleFoam/1.52/nut | 9b33abe466d0abe0712c816c1a937dbbcde7b99b | [
"MIT"
] | permissive | ishantja/KUHPC | 6355c61bf348974a7b81b4c6bf8ce56ac49ce111 | 74967d1b7e6c84fdadffafd1f7333bf533e7f387 | refs/heads/main | 2023-01-21T21:57:02.402186 | 2020-11-19T13:10:42 | 2020-11-19T13:10:42 | 312,429,902 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 174,876 | /*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v1912 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
location "1.52";
object nut;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 2 -1 0 0 0 0];
internalField nonuniform List<scalar>
12556
(
1.155885497
1.155855669
1.155824592
1.155800797
1.156029267
1.156028486
1.156049295
1.156096786
1.156187608
1.156338655
1.156519297
1.093350685
1.018262197
1.04461998
1.156666037
1.156439624
1.156276475
1.156165991
1.156082521
1.156052859
1.155830614
1.155840325
1.155862306
1.155887961
1.155131114
1.155042714
1.154959973
1.154903521
1.155124437
1.155163399
1.155290539
1.155591354
1.156027785
1.156750825
1.15781206
1.014867356
0.9366565935
0.9464759361
1.041581594
1.157515796
1.156614787
1.15597365
1.155485361
1.155273206
1.154961455
1.15499831
1.155069163
1.155149445
1.154341173
1.154194372
1.15406244
1.153997439
1.154250676
1.154387637
1.154703463
1.155333911
1.15641719
1.130935524
0.9072442697
0.7820291895
0.7294358565
0.7464172956
0.827877544
0.982579831
1.157704294
1.156213579
1.155136118
1.154627479
1.154187216
1.154174638
1.15426806
1.154397572
1.15353675
1.153338745
1.153181576
1.15313348
1.153439459
1.153763516
1.154510325
1.155701858
1.108756866
0.8205728976
0.6408671439
0.5392209954
0.4967732814
0.5144664783
0.587198291
0.7178510351
0.9262203747
1.157344457
1.155258873
1.15423496
1.153442013
1.153386232
1.153481802
1.153651735
1.152698947
1.152459967
1.152290653
1.152310702
1.152742626
1.15337453
1.154786748
1.156967834
0.8386991065
0.5941331283
0.4355219876
0.3372364577
0.297265022
0.3165002373
0.3885784579
0.5080441071
0.688790242
0.9672071523
1.156086388
1.154196104
1.152911447
1.152641852
1.152693197
1.152882861
1.151872051
1.151603776
1.151453197
1.151561024
1.152213358
1.153312238
1.155741382
0.988573686
0.6623752468
0.4469774571
0.292384993
0.1895259963
0.1485447249
0.1743475263
0.2476791764
0.3598367398
0.5228035346
0.7651578995
1.132696625
1.154589665
1.152521275
1.151949341
1.151913688
1.152103886
1.151020595
1.150739784
1.150641896
1.150957731
1.151868704
1.153638646
1.15735942
0.8418144017
0.5578412653
0.3585739984
0.2078406929
0.09582502228
0.05457690609
0.08669103898
0.1612909674
0.2658217228
0.4141544805
0.6254375455
0.9714820644
1.155491954
1.152302575
1.151318815
1.151129884
1.151290212
1.150238848
1.149959186
1.14994781
1.150522401
1.151676285
1.154375297
1.062721446
0.7620097271
0.5116710122
0.3302839782
0.189589243
0.0782884873
0.05007852424
0.1228249821
0.2167020689
0.3514730522
0.5448057846
0.8602231718
1.156752028
1.152299387
1.150785028
1.15037704
1.150486379
1.149503426
1.149246838
1.149363536
1.15025114
1.151797925
1.155502158
0.9955938716
0.7234823442
0.5098490544
0.3550022006
0.2425255432
0.1712528038
0.06211592905
0.1209721477
0.2027687834
0.3247354048
0.5016487959
0.7938968537
1.158306969
1.152523097
1.150382215
1.149700856
1.149728185
1.148925389
1.148703456
1.148971633
1.150220174
1.152232294
1.156942799
0.9617115945
0.7224810373
0.5344873623
0.4042604652
0.3253502217
0.3202650145
0.08794404448
0.1383770385
0.2130609022
0.3276607164
0.495088775
0.7622533585
1.097971674
1.152997072
1.150186174
1.149189036
1.149123041
1.148476198
1.148310876
1.148775938
1.150456398
1.15295719
1.15848031
0.9501748186
0.7360803771
0.5704406506
0.4575029676
0.3990686141
0.4457351106
0.1199434688
0.1682125866
0.2408395683
0.3494440358
0.5054684102
0.7590179572
1.059700708
1.153709862
1.150218821
1.148897852
1.148716615
1.148235027
1.14813298
1.148789937
1.150889276
1.153907764
1.160091271
0.9544119846
0.7622264191
0.6108265632
0.5033816285
0.4383498042
0.4407404524
0.1571298241
0.2104301923
0.2857786277
0.3946595742
0.5428810895
0.7812947873
1.05275058
1.154675914
1.150520802
1.148876547
1.148590821
1.148138648
1.14811571
1.149035507
1.151607931
1.154991581
1.161559252
0.9708044135
0.8052420135
0.6587893908
0.5491937847
0.4638120271
0.3999897758
0.04760087012
0.2061908484
0.2736765297
0.3554847059
0.4615795714
0.6081202376
0.8247439599
1.06502364
1.155765792
1.151059561
1.149117982
1.148722646
1.148245674
1.148300144
1.149448359
1.152401672
1.156347396
1.163384774
1.029485038
0.8575388824
0.7261212607
0.6142435499
0.5152992677
0.2780377139
0.0969096803
0.3067040497
0.3847436605
0.4608607371
0.5592755924
0.692493019
0.8859734136
1.100558887
1.156932582
1.151787686
1.14959152
1.149123657
1.148426689
1.148549438
1.149909085
1.15323761
1.157585548
1.164748359
1.098901637
0.9450807506
0.8233214381
0.7197044945
0.6246189734
0.102362144
0.139503558
0.3930202766
0.5839503686
0.6189209988
0.69142644
0.8098816731
0.9810982871
1.167332844
1.158098203
1.152612887
1.150207004
1.149663135
1.1487374
1.148924431
1.150465292
1.154110084
1.158766899
1.165864914
1.165605799
1.074394246
0.9684835545
0.8932778816
0.7719861844
0.04975897105
0.1638207386
0.4306524024
0.7296519489
0.838242659
0.8677984193
0.9599332058
1.111821616
1.168863425
1.159190201
1.153464263
1.150932998
1.150359265
1.149016022
1.14924914
1.150941319
1.154885603
1.15980699
1.166674561
1.165502229
1.147922167
1.097323311
0.9736342616
0.5362627751
0.02753333254
0.2264820083
0.4966885799
0.7862873601
0.9985093345
1.09868784
1.146950819
1.171856639
1.170130035
1.160149386
1.154274533
1.151636578
1.151028543
1.149351874
1.149624837
1.151435636
1.155604312
1.160679623
1.167216545
1.164948323
1.145388662
1.080201591
0.8747534882
0.2164333514
0.04115172942
0.3012804268
0.575406913
0.8379383702
1.017205167
1.113926933
1.15796477
1.173604048
1.171076834
1.160934835
1.155000812
1.152336322
1.151710444
1.149581049
1.149876883
1.151778236
1.156154489
1.161372773
1.167476349
1.164002178
1.142490938
1.068509049
0.7625504979
0.0927586356
0.09505763282
0.3617080704
0.6289941916
0.8631512067
1.026841594
1.119309191
1.160866598
1.17484738
1.171724545
1.161514102
1.155578649
1.152917763
1.152281618
1.149843276
1.150164274
1.152134764
1.156643472
1.161887215
1.167535669
1.163076623
1.139321246
1.054983117
0.6773608145
0.07479285699
0.1276773457
0.3845748485
0.6440557229
0.8764843808
1.035273721
1.123723437
1.163017601
1.175649098
1.172102749
1.161964406
1.156092586
1.153452474
1.152804518
1.149967726
1.150307758
1.152335179
1.156973475
1.162257292
1.167464279
1.161897366
1.135899116
1.038460178
0.5984676131
0.06493897228
0.1506059984
0.4006228229
0.6576150852
0.888139408
1.042539136
1.127222326
1.164498221
1.176063381
1.172251452
1.162233346
1.156448031
1.15383728
1.153179139
1.150141565
1.150514832
1.152599572
1.157310123
1.162524562
1.167322618
1.160745466
1.132065931
1.016809531
0.5362460996
0.05908322531
0.1697347601
0.4156958286
0.6706934868
0.8979546897
1.048479979
1.1297976
1.165369862
1.176140755
1.172210964
1.162426055
1.1567662
1.154186028
1.15351236
1.150170561
1.150579109
1.152726837
1.157535461
1.162738083
1.167157041
1.15950965
1.127460174
0.9873526243
0.4864181281
0.05607133167
0.1863705971
0.4302975534
0.6833224675
0.9061384105
1.052969691
1.131442442
1.165688532
1.17593075
1.172016001
1.162466076
1.15692606
1.154375373
1.153687597
1.150285952
1.150748225
1.152972719
1.157841412
1.162931929
1.166998433
1.15814576
1.121534772
0.9501747351
0.4438236608
0.05447650337
0.2019364559
0.4449360681
0.6955493765
0.9130117841
1.056037242
1.132192566
1.165515888
1.175482051
1.171694835
1.162476761
1.157083068
1.154559288
1.153852272
1.15025388
1.150771307
1.153081716
1.158053417
1.16313444
1.166867723
1.156651788
1.11369028
0.9085192024
0.4044971356
0.05380061688
0.2171053605
0.4596770482
0.7070799307
0.9185929029
1.057759133
1.132128644
1.164927695
1.174842392
1.171271893
1.162345327
1.157077081
1.154577458
1.153853111
1.150350956
1.150940377
1.153352142
1.158392693
1.163353903
1.166775665
1.155037242
1.103685003
0.8665630845
0.3689268874
0.05396462571
0.2316926791
0.4736189373
0.7169138977
0.9224236878
1.058140844
1.131359107
1.164005665
1.174054959
1.170767407
1.162225354
1.157106467
1.154627804
1.153881134
1.150292338
1.150949997
1.153465157
1.158618989
1.163601127
1.166721215
1.153284091
1.092178897
0.8296355093
0.3416623947
0.05471630078
0.2443050669
0.4849806857
0.7237423311
0.9240230402
1.057256746
1.130017995
1.162826227
1.173155916
1.17019832
1.161961617
1.156964007
1.154504451
1.153738556
1.150401769
1.151143081
1.153777214
1.159009697
1.163868693
1.16669222
1.151352366
1.08041642
0.801110135
0.3248832519
0.05584886028
0.2533397117
0.4924832874
0.7270824952
0.9234875661
1.055355391
1.128246377
1.161452979
1.172173646
1.169578118
1.16175006
1.156896625
1.154452739
1.153663294
1.15034181
1.151156517
1.153900306
1.159247306
1.164161593
1.166670041
1.149204275
1.069253552
0.780516276
0.3164522558
0.05736878228
0.2588490534
0.4964394473
0.727624262
0.921403236
1.05274725
1.126162336
1.159934238
1.171129554
1.168917506
1.16138653
1.156649256
1.154221936
1.153413791
1.150475506
1.15138088
1.154254888
1.159689749
1.164465719
1.1666353
1.146829651
1.05897091
0.7656479257
0.3132930018
0.05921323241
0.2619693976
0.4980148601
0.7264187218
0.9183738058
1.049677741
1.12384941
1.158304432
1.170039125
1.168225484
1.161111201
1.156507577
1.15409294
1.153262098
1.150432182
1.15140991
1.154390352
1.159928111
1.164787193
1.166569531
1.144245567
1.04955908
0.7545552266
0.3132672569
0.06132379763
0.2637212801
0.498183574
0.7242224693
0.9147925854
1.046302978
1.121363919
1.156588102
1.16891338
1.167507479
1.160682204
1.156194329
1.153796283
1.152949253
1.150580434
1.151654265
1.154773454
1.160412436
1.165107012
1.1664573
1.141489235
1.040945858
0.7460172983
0.3150515296
0.06367778868
0.264693503
0.4975158415
0.7214458496
0.9108744117
1.042718237
1.118745524
1.154802735
1.167760161
1.166770872
1.160349982
1.155981302
1.153595889
1.152728102
1.15057476
1.151714715
1.15493019
1.160647133
1.16543376
1.166286656
1.138609795
1.033063805
0.7393053093
0.3179847626
0.06625331608
0.2651994744
0.4963135525
0.7183085982
0.9067413319
1.038985826
1.116023812
1.152961483
1.166585393
1.166014973
1.15990995
1.155660374
1.153291195
1.152411006
1.150707017
1.151949459
1.155312864
1.161148522
1.165745685
1.166052683
1.135658912
1.025864607
0.7340139341
0.3217407873
0.06902417074
0.2654211615
0.4947667103
0.7149507605
0.902477193
1.03515231
1.113222848
1.151076229
1.165396102
1.16525222
1.159478257
1.155341958
1.152989399
1.152090028
1.150764001
1.152061909
1.155505555
1.161395014
1.166056735
1.16575703
1.132702992
1.019285678
0.7298333181
0.3261085138
0.07198563945
0.265478593
0.4930159101
0.7114778955
0.8981476606
1.031254616
1.110361923
1.149155089
1.164210301
1.164484344
1.159141971
1.155099818
1.152760206
1.151852296
1.150953274
1.152379361
1.156007577
1.162039404
1.166359105
1.165422151
1.129870139
1.013268918
0.7265324302
0.3308188268
0.07513343258
0.2654764053
0.4911987679
0.7079983228
0.8938189871
1.027328978
1.107457729
1.147202678
1.163100736
1.163785212
1.158519638
1.154632549
1.152320178
1.15139238
0.1529013238
0.05552433893
0.04310474927
0.3042430173
0.08090578755
0.0585795154
0.4325697702
0.1135880632
0.08475566791
0.4469140355
0.1440950032
0.1183958951
0.4040169552
0.03601035062
0.04477448254
0.1816125073
0.1480688902
0.3201402431
0.06980566031
0.03696369893
0.09182536196
0.2486549859
0.1848746276
0.07614758808
0.05494922066
0.04446386597
0.08240227963
0.02807525257
0.0186652687
0.05952239343
0.1024475066
0.103773618
0.3042630743
0.2964949523
0.1763556147
0.02646715342
0.03956427748
0.08450179704
0.1187413159
0.1050402406
0.3832160728
0.4140074336
0.3116483328
0.3668231185
0.1985738402
0.2232791916
0.04672891167
0.03297483137
0.1158368866
0.1468692048
0.1248298408
0.4325799771
0.4559896949
0.4264770684
0.4692205137
0.1302594971
0.168217482
0.08887497701
0.06445689164
0.4545165388
0.4140548519
0.4532893486
0.4309075239
0.0777632888
0.102013186
0.01561429217
0.1352621377
0.1212713479
0.4995476869
0.3899345282
0.4080692136
0.371144695
0.03084854123
0.0505005083
0.2800496605
0.09741514628
0.07145688226
0.06298767787
0.1437024308
0.03008619709
0.05712475368
0.04063173775
0.02937297586
0.04708790083
0.03110932838
0.04914277391
0.2266165069
0.2505994796
0.2507306079
0.1959606889
0.182452175
0.1618507622
0.1986667917
0.03263845592
0.02632069963
0.07018646047
0.03929936704
0.0446693213
0.05030183982
0.03950875063
0.06862771467
0.170870667
0.1948895312
0.3831357813
0.1525013534
0.1291174972
0.1807754636
0.1544413735
0.0612453457
0.04791047043
0.1011969316
0.0667617332
0.08629414013
0.04513210744
0.06416758724
0.09688660773
0.1033753423
0.1286676407
0.4692282585
0.1036767227
0.07915848347
0.1277644488
0.1049816599
0.1175220304
0.09270809302
0.05146243513
0.07604150195
0.4282588774
0.01273071662
0.05363969808
0.03243429561
0.07813132407
0.05517974852
0.01210889251
0.1424086467
0.13728709
0.01734174034
0.004750789974
0.03055520491
0.3668501187
0.05650516456
0.01917410474
0.01145721569
0.03208612429
0.0194994536
0.0541835866
0.2245272507
0.1598742181
0.09115568244
0.0972524057
0.06188341053
0.03531864253
0.01465846804
0.008220496002
0.2313605703
0.2537208178
0.1573094714
0.009982510521
0.1501873401
0.1841187806
0.1552903829
0.01210024531
0.05010680737
0.0433392284
0.06801520909
0.1596214979
0.1464704478
0.142876196
0.0689066458
0.1085204399
0.04124713344
0.01261542456
0.0221341627
0.0213889927
0.02940534143
0.04544465479
0.04199612672
0.03048781184
0.1327834337
0.1146007554
0.1317254623
0.08946472861
0.1113926825
0.1296472036
0.02475594156
0.01375506464
0.04297238886
0.02174222573
0.0369175856
0.0293349562
0.0188187896
0.02874942243
0.02077700788
0.01417065252
0.02229545498
0.01818324376
0.009769239572
0.01572147438
0.02115100796
0.03392595529
0.03450767649
0.03985431017
0.03889066911
0.01592550351
0.01031267693
0.07789558645
0.01344877473
0.02412994632
0.009815905093
0.01195701939
0.07430038837
0.09156301048
0.2507890859
0.2388861289
0.06429531486
0.05373511074
0.01173604144
0.04566693938
0.1866371242
0.1748365435
0.2029099533
0.1914195371
0.04600309937
0.04939216117
0.04160438944
0.09132911175
0.06469279395
0.05551380669
0.03988442904
0.0642465062
0.1028398878
0.0364552156
0.0228968106
0.0144064476
0.05126319117
0.02547034875
0.04024384201
0.02462341822
0.05658493854
0.04022758521
0.03932859182
0.193497636
0.031303143
0.1929039908
0.2127842647
0.03488459681
0.03889140057
0.03170389804
0.034403845
0.2091610555
0.03124791811
0.0310016063
0.04238864861
0.06824644035
0.06358138368
0.07466607997
0.0699300277
0.04264668823
0.04740472963
0.05564466275
0.05043392828
0.06191919175
0.05710593197
0.04652060635
0.1410951463
0.1395812821
0.168795184
0.1671547841
0.05773137005
0.009681518618
0.05653783273
0.09464445222
0.09288898734
0.1158648312
0.1143287742
0.02560741935
0.03700825658
0.1037322449
0.02857837165
0.01708971645
0.06729197166
0.2190145572
0.2070905071
0.2348560518
0.2229597167
0.06857016477
0.02232701715
0.04924154776
0.04824669336
0.07128602842
0.07045785956
0.008000032146
0.03012989765
0.07929155596
0.06809133688
0.1702220432
0.1617736438
0.02460467243
0.01231629797
0.01747576461
0.01394001481
0.03067408377
0.01293619938
0.01389381945
0.01349759861
0.03071093907
0.04595126219
0.01402796162
0.01501546913
0.003709473039
0.01644974786
0.01310174472
0.5872783539
0.3755054758
0.3808860072
0.2548009143
0.008975757891
0.005356414002
0.1343900716
0.3225825653
0.2795948088
0.005856270875
0.01205831643
0.01108713126
0.09437983571
0.08340548236
0.03220818803
0.1923540175
0.1661310387
0.07091134681
0.009078536144
0.01536803861
0.0122653306
0.008324791287
0.01212268942
0.008609491193
0.02866132912
0.01209776362
0.01140255166
0.03701145293
0.0433713361
0.0123044685
0.01699696222
0.008639849261
0.008785986811
0.0345173958
0.1438001152
0.3111842296
0.3000185984
0.3259031767
0.3148834544
0.1469143411
0.2661604922
0.2545339469
0.09280723429
0.0339063215
0.09652910865
0.09150451868
0.01244404666
0.01795132193
0.07695688447
0.04611176398
0.01371641108
0.0122023351
0.03803750008
0.04199405799
0.03752787423
0.048757159
0.04359296877
0.03993658737
0.03192552061
0.008687659859
0.00863093637
0.02750264693
0.1811784209
0.3402632131
0.329497432
0.05977970567
0.06166006029
0.1335942185
0.01804346827
0.0196708163
0.05128440325
0.07452581349
0.1014835549
0.09392500259
0.05092744022
0.08215864535
0.07655893762
0.09118029875
0.08435365559
0.05200067119
0.1161982429
0.2813258731
0.2699313256
0.2962958363
0.2851008225
0.1179238152
0.09989336312
0.03721396283
0.03793130587
0.02159550673
0.02242184179
0.08338413652
0.1228861602
0.05571446457
0.0593832747
0.03822889391
0.03889987765
0.1088910934
0.1074742928
0.03900399454
0.05369614681
0.008700484988
0.01552172021
0.05135773201
0.03951781122
0.07516864776
0.02098852446
0.02145543477
0.0205968201
0.06425653091
0.01210224902
0.004391481666
0.1252989757
0.1093755448
0.0897996609
0.08574793897
0.03023340132
0.01569523402
0.02516522998
0.06390248794
0.01894435374
0.01211308139
0.01751214955
0.01973513883
0.002820964213
0.03163200926
0.02055461171
0.01199838885
0.006387923787
0.01155026574
0.009977546965
0.0097780947
0.02412978372
0.01843941864
0.007824051874
0.03839569761
0.03997384251
0.01470106355
0.0109172483
0.007008134149
0.01144626769
0.01596274781
0.01084988597
0.01229195223
0.03540348094
0.01097182029
0.01093715766
0.01261958114
0.01287250262
0.02966601899
0.0128772186
0.01270361924
0.01317451418
0.01275153352
0.01304762473
0.01594682286
0.01368182675
0.02077610857
0.01727938564
0.01317310757
0.01367911033
0.0216004461
0.01790087558
0.02510029563
0.02249754161
0.01739557609
0.01550023868
0.01234094958
0.01047324973
0.008181810597
0.03035322542
0.03639663586
0.01118426449
0.01057844772
0.01156866145
0.01203430275
0.04226140723
0.008936460421
0.008838716716
0.0103464312
0.009042986051
0.008789277609
0.03554819875
0.008639581586
0.01141152579
0.01178647462
0.01094382142
0.01759676773
0.0447788892
0.04023805247
0.01037574292
0.03252430123
0.02784233547
0.03861682242
0.03433023368
0.01053897644
0.01174140192
0.03136033655
0.02631897578
0.1046077031
0.09830658566
0.03776561945
0.04813297488
0.1115092608
0.1063179297
0.04465791694
0.04383462811
0.06659233461
0.07569593188
0.09145690861
0.05665230606
0.07098938209
0.06742414578
0.05942139108
0.1341942185
0.1237813193
0.09890774432
0.1291352138
0.05934230436
0.03798738688
0.04170802474
0.05205847821
0.03288394047
0.03674643369
0.01934426391
0.01832717918
0.04507897523
0.0132736876
0.01326697955
0.01031934031
0.0193208503
0.02296265714
0.01371221646
0.01950100631
0.03454020756
0.02673488489
0.02028498858
0.02951789459
0.09339022565
0.08214316385
0.09942067698
0.09571870688
0.03062526791
0.07413726797
0.0720321267
0.07893202716
0.07489482813
0.03634118017
0.1146735485
0.1105643162
0.1212821857
0.1161247591
0.03691378236
0.03279021248
0.104218433
0.1006866051
0.1092429285
0.1054414343
0.03312365676
0.008904257583
0.008752595448
0.03172471874
0.02869442891
0.008687884912
0.008956960022
0.04348561582
0.04273455571
0.04561466833
0.0437440562
0.04134534872
0.04031702224
0.04248437799
0.04161312659
0.06882274885
0.06694918353
0.07137723168
0.06947275802
0.06168234808
0.04827037788
0.06616909564
0.06415574365
0.02064874915
0.01759689629
0.02648810465
0.02228458976
0.006579577694
0.01139607104
0.01073544404
0.0164413238
0.01165358152
0.03626874541
0.03686431814
0.09859956079
0.02163336943
0.02141603004
0.02229083387
0.02181730852
0.02074848687
0.08564826904
0.02309634159
0.03412315707
0.04101959682
0.05388793966
0.1211826415
0.03756841383
0.0244341115
0.04018022895
0.0372556943
0.02306409827
0.02252482727
0.02399326876
0.02328466711
0.1102136457
0.0391260418
0.0400028111
0.007262156941
0.02385949111
0.01084277375
0.01076312535
0.01058466733
0.0222476058
0.009071185359
0.01704455155
0.01239624788
0.01279615571
0.05072145531
0.04436837289
0.02039871591
0.02088054812
0.07425491918
0.06638634552
0.01952250322
0.02033738136
0.01219227115
0.02914670708
0.08325198359
0.07515922006
0.01384023725
0.01310447054
0.01817351693
0.01252265554
0.01425900155
0.01487129054
0.03152350647
0.009442665906
0.01405067874
0.01239467454
0.01422806976
0.02139255131
0.05132292023
0.1086041259
0.1400034919
0.01167724253
0.01121567711
0.1881989995
0.2381492133
0.195469784
0.007704213223
0.03140699991
0.01337268811
0.01571232566
0.1361283481
0.1420239053
0.1597355362
0.004693537387
0.007098240593
0.005265420534
0.00486520838
0.005604821533
0.004384660998
0.05459827552
0.03408526976
0.02166946547
0.02481676122
0.0230363823
0.02668807248
0.2094578834
0.360221233
0.357554467
0.3384325651
0.3514707576
0.2129511833
0.03771080562
0.03302728069
0.01213110407
0.05726149968
0.06802008766
0.1301095013
0.1183966291
0.1131577134
0.04861179278
0.02724921818
0.02770860314
0.03282806893
0.3541604096
0.3437884686
0.1844771408
0.1473749125
0.06709932217
0.07074403275
0.07368650479
0.0839817109
0.1602551353
0.05901769413
0.1262362144
0.120219533
0.01206261492
0.0119967784
0.01342138113
0.02027257062
0.02056899117
0.03328167738
0.01184710903
0.01242826084
0.01219497402
0.02298566087
0.04519554694
0.03904468736
0.01912009671
0.0318826125
0.0198242503
0.02000460123
0.01953095598
0.01413706938
0.01014956273
0.01149289776
0.01134821891
0.01202064949
0.0202709503
0.02517570116
0.05002201412
0.04018800596
0.03612952451
0.03295016174
0.02429289219
0.03708027652
0.01364167044
0.01837089085
0.01297387676
0.009395247717
0.00944980636
0.01320889318
0.01298687527
0.02222467619
0.01411215327
0.009824925993
0.01647328106
0.01877760001
0.01748930313
0.0127571089
0.01602326739
0.01462769471
0.01049319447
0.01084390346
0.006807897001
0.01019274921
0.01038156994
0.05101830823
0.04622833929
0.01914007862
0.009749788292
0.01203268018
0.0111607274
0.01170279844
0.0130292478
0.01206438666
0.04740567853
0.03688782063
0.04231660408
0.06537731847
0.09135200778
0.09010996261
0.0414064847
0.06625401043
0.06277805176
0.08911579243
0.08753330129
0.06299520401
0.03147675836
0.03801344496
0.03440301698
0.02647707586
0.0272437909
0.02251744812
0.04621885365
0.04494728185
0.048426912
0.02381695094
0.03409377646
0.03247810558
0.05203972597
0.05167618657
0.03104961946
0.02886464757
0.02846130798
0.03144382544
0.03074934481
0.03539608911
0.05782056258
0.05723910711
0.06123835528
0.06051639006
0.03815658477
0.03202724212
0.05321194874
0.0527153157
0.05664029778
0.05604870799
0.03396195043
0.06459412978
0.06642533764
0.1457610841
0.1350261512
0.06222567342
0.06401139209
0.09049702217
0.09348027118
0.1739417993
0.02689063063
0.02674516307
0.02822854604
0.02801249698
0.0205713756
0.0264823849
0.02637519374
0.1620063316
0.08609934913
0.08938360776
0.009433717052
0.009400436187
0.01092023112
0.01056369701
0.009647525246
0.009243405318
0.006530811672
0.0524374801
0.02046794392
0.02501177088
0.1339964414
0.1282423105
0.06218461713
0.07143445426
0.1408437611
0.1357073316
0.03259206363
0.03264835943
0.04958956259
0.04793503911
0.0321990737
0.03214181494
0.01176279037
0.02327554733
0.03706942041
0.03638388759
0.00908317485
0.0148314023
0.01584881037
0.01442916746
0.01409916751
0.01889825196
0.01913951716
0.03112267401
0.01314450224
0.009563030854
0.01296725277
0.01354791097
0.0291323977
0.01839209206
0.01898384077
0.01367698758
0.02776339361
0.02292658415
0.01182514086
0.01178610431
0.01116178591
0.01125939736
0.01404597095
0.006346520065
0.004104006877
0.007383877166
0.01140097603
0.01140407535
0.0113241741
0.01107586669
0.0114408295
0.01099763791
0.009882088266
0.006493161911
0.005207020008
0.01041081259
0.01071866326
0.01003370821
0.01015257247
0.01180265542
0.01807169286
0.01830249892
0.0177134115
0.01789901613
0.01168038716
0.008639194673
0.01350702061
0.01349901417
0.0139541781
0.01360920461
0.008581480199
0.01300136382
0.02036317386
0.02264322391
0.01857608607
0.01916387536
0.01259218814
0.008683235734
0.01353161541
0.01354785471
0.01347218874
0.01351782187
0.008659392106
0.009709726061
0.009879557192
0.00939508523
0.009823092
0.03737549653
0.05628934733
0.05583365269
0.02182929443
0.03626080582
0.03600651634
0.03757929653
0.0366269002
0.02203843773
0.012598988
0.01212959629
0.01244549039
0.0126803505
0.02049903247
0.02030429209
0.02093933365
0.02071299955
0.01600753114
0.03537741175
0.02116924282
0.02209259961
0.02116056775
0.0355067176
0.03528569976
0.03584510872
0.03565992451
0.02128765468
0.02186109642
0.02125000736
0.03186162232
0.02285338806
0.0164322722
0.008474135456
0.01210271902
0.0118518042
0.008387567548
0.04335841864
0.03025388924
0.002974005714
0.03023535433
0.04612559093
0.04579227923
0.01891056153
0.01203498647
0.008860963393
0.003383700393
0.0138666208
0.01430933092
0.01958166389
0.01975080713
0.03181629839
0.01995115021
0.01064899192
0.01127921454
0.01453312486
0.004855821094
0.009134068379
0.006912439345
0.00729946936
0.007720334818
0.01003108243
0.006652098366
0.01153618826
0.01139718599
0.0114958319
0.03993461056
0.03108124816
0.008165951386
0.01022902555
0.01128947176
0.01846248037
0.02069626676
0.01208118723
0.01494335481
0.01441567216
0.01126471802
0.007405575625
0.01119954464
0.01283083716
0.009017896024
0.01270328554
0.01286872197
0.01285734995
0.013189831
0.01302639173
0.01300830777
0.01290131228
0.01287594162
0.01344315284
0.01338831926
0.01302951143
0.01342783864
0.01375448058
0.01368276863
0.01701370058
0.01879881971
0.01659866708
0.02537885893
0.02097952409
0.01620158096
0.01520678575
0.01649592634
0.01001737446
0.01595008546
0.01687861101
0.01146624066
0.01588308157
0.01067525286
0.01099560129
0.01736144264
0.01752382535
0.01696234767
0.01720112011
0.01083819801
0.011756047
0.02028835954
0.01992495209
0.008935035271
0.008885876005
0.009488894418
0.006694961868
0.008983958221
0.008912212015
0.008667322537
0.007345851307
0.009637701535
0.01676680627
0.01496091482
0.01938663459
0.01838188076
0.01075557271
0.01025212946
0.01051463787
0.01303035004
0.00695379896
0.01054872038
0.01039274709
0.01083775147
0.01024725766
0.01039233013
0.01525570853
0.01360592357
0.00994075761
0.04577445164
0.04288948229
0.0809119205
0.07280473084
0.04331003348
0.06274122506
0.08674684163
0.08349704087
0.03468662455
0.03203332888
0.02979645577
0.022674507
0.02948069358
0.04216940782
0.04287982922
0.03769390725
0.01927378096
0.0278078474
0.02823197377
0.02525765272
0.02612397213
0.01817612187
0.01248649002
0.01340574722
0.02064746724
0.01450647929
0.01380760349
0.01554585346
0.01474851896
0.02094107254
0.01413448876
0.0147340222
0.01157208054
0.01508419814
0.0477678103
0.04794956383
0.03090958385
0.03060722295
0.05074499592
0.05073430502
0.02953957935
0.02915649278
0.03029724694
0.02988271007
0.0588847106
0.05833018042
0.03578699149
0.03751806334
0.05996463831
0.05943059131
0.05435794886
0.05383153591
0.0324495466
0.03350165153
0.05544718504
0.05489760986
0.00881842776
0.01363605907
0.01367549102
0.01358823149
0.01362823061
0.008796008195
0.008983717723
0.0127399186
0.01110921246
0.01362297947
0.01340805717
0.008997086927
0.04322367008
0.02562070627
0.02588618068
0.0252006667
0.02540459639
0.04298445074
0.04451990316
0.02681847927
0.02730161961
0.02614954437
0.02645611541
0.04405455151
0.04097349193
0.02399293606
0.02422867929
0.0236288111
0.02385604315
0.04074424596
0.0422125756
0.02481000793
0.02499843956
0.0243927526
0.02462286652
0.04194420218
0.02732110623
0.02713806115
0.06820693389
0.04616606446
0.04647604145
0.04549271397
0.04576436714
0.06752398322
0.02775840259
0.02755529532
0.02524448731
0.02648588247
0.05967765755
0.04185831004
0.04156444029
0.02819740458
0.02959545261
0.05344830571
0.06570392016
0.04481700603
0.04501115777
0.04412424311
0.04407747729
0.06452747634
0.02605489368
0.02609737011
0.00946271835
0.009559106007
0.00946056748
0.01029838338
0.009763436776
0.01109864587
0.009250262241
0.009284277764
0.009091580292
0.009171114479
0.01103207083
0.01472438421
0.009597922862
0.01030766695
0.009359505765
0.009233390384
0.01277170014
0.03619072101
0.05380609885
0.05350893268
0.0551668033
0.0548156762
0.03676770205
0.02158745421
0.02134789347
0.02216570998
0.02189372039
0.02182492669
0.01707175211
0.02431547112
0.04438028394
0.03986645817
0.0513827612
0.04963172631
0.03440901817
0.02651289176
0.01846510333
0.02371618764
0.02521307405
0.03951864774
0.02327641518
0.02356286748
0.02258901062
0.02332827983
0.03958319438
0.02289770883
0.02267400523
0.02372395619
0.02347897298
0.01095994966
0.01105363864
0.01089974297
0.0128037843
0.01161254497
0.01099278639
0.01057300005
0.01068164252
0.01066579866
0.01069744393
0.007130186583
0.01277632032
0.0122486256
0.01240864512
0.01239480176
0.01233440206
0.01274347643
0.01984582467
0.01980199022
0.02009948235
0.02003417813
0.03050496747
0.03047361043
0.04595491247
0.01903641146
0.02008054761
0.01956689799
0.01963555074
0.020610782
0.034700244
0.03434090308
0.0351249647
0.03484650123
0.02069064012
0.02006994916
0.03365420453
0.03179772484
0.03421990653
0.0336331354
0.02005435254
0.01223139972
0.04421414124
0.04367180443
0.02892974954
0.01406098508
0.01142228572
0.01112049707
0.008471783328
0.01161014277
0.0133142666
0.01873337476
0.01326540046
0.01456876206
0.01426213284
0.03123960482
0.01925516493
0.01945742563
0.01291701444
0.01268279307
0.01277112445
0.01369869542
0.01341142423
0.009048741529
0.009341562754
0.01402850174
0.0128691895
0.01348542759
0.01563389217
0.01926972013
0.02914138703
1.155349056
1.155969296
1.155898992
1.156233267
1.157252572
1.156548164
1.15768429
1.021844445
1.157504158
0.9805085016
0.8655073392
1.031845673
0.8444340081
0.7946852554
0.9390321768
0.7910795653
0.7957118951
0.9409999025
0.8026780833
0.8627245134
1.024595225
0.8868457155
1.007320954
1.157809067
1.048790046
1.15771056
1.156807614
1.157300453
1.156329012
1.156107285
1.155533672
1.156858079
1.156088645
1.157434747
0.9553617274
1.157678896
0.8911155434
0.7398718137
0.9501231892
0.7022287716
0.6170647644
0.8036336612
0.5973821687
0.5595148204
0.7367344613
0.5518968262
0.5617363314
0.7380874992
0.5710536824
0.6213183617
0.8023672835
0.6451234858
0.7402915737
0.9387622811
0.7803270183
0.9354204651
1.158132934
1.000731084
1.157476571
1.156512557
1.156539296
0.9818030072
1.157287936
0.8979997804
0.6963046818
0.881527432
0.6429616764
0.5147007064
0.6771045932
0.4809217739
0.4019931213
0.5585472447
0.3827734854
0.3482420242
0.5036112367
0.3433706432
0.351344335
0.5050795715
0.3610888849
0.4097525276
0.5638992841
0.4320948813
0.5188078587
0.6792014033
0.5536469565
0.6891875162
0.8664445345
0.7421685252
0.9336795194
1.144810999
1.037137782
0.7715062587
0.9196321512
0.7010892251
0.525046022
0.6458922269
0.4765101178
0.3560387277
0.4689058993
0.3227632878
0.2419939454
0.3566706514
0.2215276402
0.1844142268
0.3009848684
0.1807023188
0.1932416561
0.3063323214
0.2045034078
0.2556189934
0.3662760263
0.277201434
0.3591366732
0.4720428578
0.3911965555
0.5106687671
0.6378665204
0.5581144019
0.7324004342
0.8752980386
0.8724163636
0.6408037815
0.7310323401
0.5780229996
0.4193665952
0.4924794665
0.3747938754
0.2577830755
0.3264097979
0.2237664434
0.1364837475
0.2105023439
0.1147096477
0.06558727359
0.1525501847
0.06548214631
0.09183289681
0.1622547475
0.1035448402
0.1568898671
0.2258676898
0.1783162194
0.2545861902
0.3277244472
0.2847898823
0.3934825967
0.4761000091
0.4364715998
0.593306603
0.6932570328
0.7776535599
0.574629248
0.6189876608
0.5186163818
0.3739217397
0.4026179983
0.33183834
0.2197855198
0.2426521866
0.1870328142
0.08950215545
0.1196666706
0.0841865685
0.05153306485
0.08145542765
0.02683384301
0.03503089454
0.05889946881
0.06716226904
0.08895894394
0.1039150787
0.1282807807
0.1977665937
0.236228708
0.2252861043
0.3241426102
0.3719190029
0.3634884571
0.5052201631
0.5660404156
0.7259886249
0.5541079493
0.5660936724
0.5062013642
0.3814492349
0.3710452644
0.3447910343
0.2513738507
0.2214251486
0.1965340536
0.1706314902
0.161126737
0.08194421437
0.07131452289
0.06483659534
0.05120097952
0.07290440572
0.07518431706
0.119124804
0.1791225938
0.1899522106
0.203522053
0.2927023955
0.3130489573
0.3285168181
0.4585873536
0.4898287092
0.721508215
0.5692017503
0.5563922193
0.5269004589
0.4200003787
0.3902602982
0.3905403871
0.3197137669
0.2659714072
0.2621955608
0.2447513171
0.2216372043
0.1907731193
0.189998389
0.1675557779
0.07167326544
0.08713159692
0.0805727825
0.1326345189
0.1851882493
0.1790652829
0.2074253068
0.2910224302
0.2897626898
0.3248246339
0.4497165486
0.4518364669
0.7304799541
0.5977617365
0.5751330345
0.5610024431
0.4693197303
0.4323223486
0.4447312444
0.3911413165
0.3385135192
0.345883405
0.3404878581
0.3172827648
0.335361173
0.3472517602
0.3324755229
0.09947183786
0.1138577735
0.1031497982
0.1597245223
0.2109226477
0.1911214623
0.2320103479
0.3101550169
0.2936846539
0.3414354452
0.4547730371
0.4511590906
0.7532147097
0.6336877091
0.6061792485
0.6001007942
0.5155188731
0.4813516935
0.492495286
0.4412302723
0.4061464324
0.4128256085
0.4123983486
0.3989916417
0.4563495208
0.3657652805
0.376521395
0.1324668615
0.1486390973
0.1350444506
0.1985264521
0.2514276398
0.2196689176
0.2730350322
0.350399419
0.3183733484
0.381217694
0.4888251935
0.4623945363
0.7903362643
0.6790352387
0.6439273386
0.6457459913
0.5608615729
0.5266252455
0.5362258039
0.4713169236
0.450049016
0.4353662238
0.4504478581
0.4317857993
0.4306879942
0.3053291696
0.3171038378
0.1656792856
0.1825551488
0.1709031634
0.2548513203
0.3123793548
0.2640995695
0.3349525151
0.4130146486
0.3638066515
0.4431142818
0.5457966077
0.5022120689
0.8385279389
0.7369668629
0.6921240686
0.7054302857
0.6192804759
0.5739421569
0.5929930079
0.5158725915
0.4788588977
0.4732621462
0.4437203337
0.4456176514
0.3874759251
0.2409810196
0.2531662665
0.05671822982
0.1084575957
0.09853493403
0.273033706
0.3332009054
0.2561474647
0.3511919479
0.4094791526
0.3332281931
0.4310188709
0.5028756102
0.4319529341
0.5298738322
0.6217644664
0.563641682
0.9180300983
0.8221854049
0.7569038277
0.7936531485
0.7106875171
0.6406886882
0.6861095496
0.6133489676
0.5362040655
0.5331478748
0.5040303386
0.4855903645
0.2737332622
0.139594186
0.1559858479
0.1084736998
0.2146774053
0.1965815386
0.3867902421
0.5151686359
0.368558166
0.5236589772
0.5582117711
0.4406721716
0.5735916382
0.6325432441
0.5321101524
0.6561259941
0.7328250297
0.6467100755
1.035715561
0.9504953836
0.8517427356
0.9256113289
0.8614227956
0.7427735411
0.8423573287
0.8023130392
0.6503984348
0.7929727877
0.2518276517
0.3470739423
0.06454276543
0.08774933057
0.0749053491
0.1542890487
0.3485631047
0.3273938996
0.4186967014
0.640974067
0.5824154039
0.7170681884
0.7769507461
0.6063803579
0.7779829522
0.8042811366
0.6688014403
0.8196314539
0.8853125771
0.768901028
1.148612302
1.117005094
0.9913285056
1.101623515
1.030555289
0.9092513247
0.9930117663
0.7757240074
0.8689709004
0.6316504611
0.07674223302
0.1972426699
0.02827227232
0.140650432
0.09619804772
0.2081071828
0.4025179218
0.3590398671
0.4778277618
0.7001118624
0.6541715657
0.7717095652
0.9473997037
0.8450255945
0.9919759016
1.028234774
0.855276254
1.032560678
1.074701543
0.93073238
1.146058815
1.1056596
1.114050858
1.084106285
0.9713387997
1.017738152
0.9036576624
0.4744665809
0.7077583739
0.2821552258
0.03370675958
0.05196443378
0.03476189241
0.2271738619
0.1607589342
0.2832274419
0.4804397168
0.4206223088
0.5564991618
0.7642467388
0.7166683803
0.8267428543
0.9766244582
0.9557867229
1.013976489
1.093926666
1.087979055
1.112409472
1.149487466
1.132933471
1.143242587
1.097876501
1.103544056
1.071522044
0.9039195778
0.9534422242
0.7835629722
0.2319107099
0.3944077569
0.1089919482
0.04280048092
0.03421016183
0.08037584227
0.2970866249
0.2482195174
0.3496567189
0.5490135523
0.5002814888
0.6197589914
0.8063284081
0.77792723
0.8595553165
0.9904296285
0.9815251039
1.024556944
1.100482934
1.095679178
1.118059315
1.153100888
1.150475832
1.140135331
1.089295746
1.095866505
1.058603126
0.8500928543
0.8915815189
0.698812908
0.1750347803
0.2044720576
0.07790400715
0.05684477118
0.04697072438
0.1214620179
0.3246867858
0.3079176408
0.380350307
0.5742748626
0.5601403977
0.6405800735
0.8213105229
0.8104812839
0.8732949422
1.000403455
0.9930344496
1.033271302
1.105974135
1.10195064
1.12270618
1.155887931
1.15387122
1.136783152
1.079223993
1.086932479
1.042974997
0.7830397484
0.8345105731
0.616741839
0.1488867104
0.1675498192
0.06708725109
0.06948936896
0.05974488277
0.1452491325
0.3394977692
0.3284349274
0.3967221149
0.5891636656
0.5781067233
0.6542724406
0.8340961355
0.8246898866
0.8853992571
1.009175949
1.002716564
1.040840108
1.110484645
1.107194788
1.126433675
1.157927126
1.156466199
1.133078113
1.06679983
1.076385222
1.02285217
0.7129792526
0.7650056232
0.5503581055
0.1298403523
0.143705501
0.06022198142
0.08477122376
0.0730867235
0.1652428579
0.3538102674
0.3431249094
0.4119934438
0.6032412735
0.5927448877
0.6674685692
0.8450707513
0.8370011164
0.8956672215
1.016548073
1.011161632
1.047128468
1.113993151
1.111458519
1.129241359
1.159268298
1.158326732
1.128710565
1.050348052
1.063157988
0.9955294088
0.6525117815
0.6968669327
0.4980356448
0.1138976499
0.1255100372
0.0566623941
0.1018349036
0.08891351448
0.1823649331
0.3677763399
0.3573235668
0.4266619986
0.6168435267
0.6066799595
0.6802037703
0.8545830487
0.847573285
0.9042262805
1.022341392
1.018148887
1.051984417
1.116460264
1.114709412
1.131117529
1.159960169
1.159500713
1.123173092
1.02756214
1.045312184
0.9600274213
0.6008714777
0.6389117622
0.4540506756
0.1012119167
0.1104246921
0.0547884955
0.1199334879
0.1062803633
0.198083446
0.3818168945
0.3712637804
0.4412561741
0.6301857392
0.620201271
0.6925360922
0.8629750727
0.8567793931
0.911406943
1.026586796
1.023543975
1.055398447
1.117891672
1.116914167
1.132085111
1.160061579
1.160038781
1.115855624
0.9979750283
1.020752783
0.9191465565
0.5538300286
0.588827764
0.4140997199
0.09070556751
0.09840714305
0.0538871977
0.1386980394
0.1245799534
0.2133493838
0.3962233714
0.3853892323
0.4560144468
0.6431715299
0.6334871211
0.7043055471
0.8702835294
0.8649165002
0.9173379429
1.029399327
1.027423685
1.057454086
1.118352152
1.118095074
1.132215498
1.159649907
1.160003862
1.106369166
0.9642093899
0.989753092
0.8767880889
0.5100700146
0.5424840985
0.3771953621
0.08206248357
0.08839749884
0.053881958
0.1571380078
0.1434086566
0.2281547522
0.4104483333
0.3998484447
0.4703003741
0.6549523529
0.6462851962
0.7146915946
0.8759981895
0.8718949345
0.9216636511
1.030747875
1.029879032
1.058170198
1.11793552
1.118326321
1.131610705
1.158815699
1.159477757
1.095125837
0.9312834199
0.9556866543
0.8381453093
0.4738883435
0.5000915843
0.347524317
0.07661672203
0.08051415356
0.05450435457
0.1732531255
0.1614874863
0.2414469246
0.4228652459
0.4138034637
0.4824780735
0.6640516935
0.6575397526
0.7223669139
0.8793632846
0.8770845648
0.9238391328
1.030582547
1.030846773
1.057585301
1.116772772
1.117708798
1.130398954
1.157649979
1.158552291
1.083321466
0.9034496305
0.9237491556
0.8074263974
0.4490025469
0.466546651
0.3281748391
0.07397320679
0.07571972845
0.05554054016
0.1851583185
0.1766599327
0.2514447669
0.4317886339
0.4254660165
0.4909776155
0.6694745086
0.6657632385
0.7265509117
0.8801615321
0.8797938028
0.9237933031
1.029090405
1.030321299
1.055908696
1.115032124
1.116385055
1.128722629
1.15623317
1.157316793
1.071964109
0.8817623424
0.897472017
0.7850366475
0.4344482956
0.4445131922
0.3181168558
0.07317978341
0.07361086624
0.05697361591
0.1928781684
0.1874370112
0.2577450716
0.4369861358
0.4334102059
0.4957210995
0.6715747661
0.6702728129
0.7276912088
0.8789231554
0.880012953
0.9220334056
1.026638463
1.028552419
1.053450473
1.112874565
1.11452625
1.1267075
1.15462827
1.155847693
1.061456133
0.8651521245
0.87719515
0.7689472995
0.4266857853
0.4320358096
0.3136990905
0.07377335612
0.07319790101
0.05875125628
0.1977087797
0.1942976295
0.2613507609
0.4394675045
0.437812902
0.4977835538
0.6714554779
0.671709366
0.72683555
0.8763974637
0.8783862684
0.9191944715
1.023568165
1.025917899
1.050478494
1.110420685
1.112285059
1.124445633
1.152880732
1.154203479
1.051833185
0.8521741198
0.861621402
0.7570480638
0.4231781183
0.4255111397
0.3130760845
0.07530867831
0.0740561337
0.06080959508
0.2008698342
0.1986143496
0.2633751342
0.4403161223
0.4397990459
0.4982360709
0.6700562566
0.6711981809
0.7248374649
0.873130423
0.8756346763
0.9157256391
1.020106551
1.02273278
1.047169282
1.107750722
1.109770862
1.121999045
1.151022427
1.152425639
1.043027333
0.8417232348
0.8493585728
0.7479602672
0.4220638196
0.4227167459
0.314485735
0.07754072154
0.07576862255
0.06312045505
0.2030769702
0.2014857703
0.2645077132
0.440201778
0.4403589649
0.4977417668
0.6679168531
0.6695761681
0.7221803975
0.8694258884
0.8722368931
0.9118778783
1.016387591
1.019196843
1.043630288
1.104918845
1.107056039
1.119410807
1.149076137
1.150543421
1.034968234
0.8331275258
0.8394217566
0.7408562651
0.422485876
0.4220500939
0.3171825686
0.0803416734
0.07813385505
0.0656655681
0.2046994241
0.2035156333
0.2651133816
0.4394925394
0.440068228
0.496653288
0.6653212793
0.6673021709
0.7191182057
0.8654480797
0.8684518422
0.9077896836
1.01249307
1.015427562
1.039929958
1.101963766
1.104190128
1.116712467
1.147058823
1.148577914
1.027602722
0.8259718483
0.8312151801
0.7352221075
0.4239790271
0.4227644316
0.3207702455
0.08363520756
0.08103350875
0.06841980835
0.2059510865
0.2050224099
0.2653999057
0.4384055113
0.4392471324
0.4951796039
0.6624389563
0.6646214632
0.715804899
0.8613019941
0.8644233379
0.903551633
1.008480741
1.011498721
1.03611796
1.098915847
1.101209215
1.113929353
1.144985344
1.146545275
1.020875794
0.8199960094
0.824395115
0.730793128
0.4263085964
0.4244738292
0.3250579168
0.08738128778
0.08439635527
0.07138065031
0.2069656706
0.2061934839
0.2654962448
0.4370868018
0.438087245
0.4934696853
0.6593904623
0.6616866261
0.7123519699
0.8570669961
0.8602481642
0.8992329506
1.004395665
1.0074643
1.032233243
1.095799384
1.098142044
1.111081866
1.142866836
1.144459591
1.014700531
0.8149442067
0.8186595433
0.7272696943
0.4292342795
0.4269362503
0.3298298709
0.09153217606
0.088175185
0.07454803318
0.2078436257
0.20715024
0.2654999843
0.4356464293
0.4367279365
0.4916348706
0.6562655418
0.6586135997
0.7088383952
0.852801156
0.8560015184
0.8948850638
1.000273002
1.003367046
1.028306778
1.092635153
1.095011614
1.108187988
1.140714324
1.142331209
1.008658278
0.8103752015
0.8138488647
0.7243070421
0.4328275743
0.4298759618
0.3352740254
0.09638134203
0.09231021097
0.07818495906
0.2087271195
0.2079908163
0.2654944592
0.4340712541
0.435301629
0.4896360608
0.6529217583
0.6555224555
0.7050910344
0.8482733414
0.8517589246
0.8902723891
0.9958981559
0.9992495542
1.024138724
1.089276622
1.091838747
1.105119134
1.138448392
1.140166815
0.1469257623
0.1282122502
0.1361713673
0.05232838573
0.04633714178
0.0510696877
0.03631237072
0.03646438498
0.0430731692
0.3217438583
0.3103525677
0.2858005723
0.0775021288
0.07267883599
0.07740432157
0.05269155498
0.05831964267
0.06106483296
0.3800152031
0.3903003021
0.4170507073
0.1095803364
0.1070313027
0.1113137965
0.07964423034
0.08445702363
0.08862543148
0.3209346569
0.3323945092
0.455008317
0.1410361239
0.1374740001
0.1398027348
0.1153702457
0.1194424514
0.1225386939
0.257410258
0.2697204994
0.415572156
0.03424563473
0.02788196733
0.02947430133
0.05903301983
0.0558175059
0.04164827903
0.1645673227
0.1444494684
0.154234794
0.1423949813
0.1453365468
0.1512156752
0.1603807069
0.1735645873
0.3254196493
0.0652263039
0.02515133704
0.02643373834
0.01693902177
0.02165346663
0.03767286364
0.1270203647
0.1217820266
0.08039606738
0.2153504078
0.1821957516
0.2190626931
0.1585425859
0.1745800509
0.2084403205
0.03447193482
0.04629857349
0.08000674058
0.002972458081
0.003723065232
0.003808632121
0.0696500484
0.04361723637
0.02856269723
0.003070513346
0.002742183319
0.0465588207
0.03944456644
0.03693076531
0.06359257282
0.03972858883
0.05989402366
0.02720421574
0.02659692215
0.02778240865
0.01611857652
0.01644401799
0.01903179882
0.07776418929
0.07426627645
0.05261458612
0.1011617292
0.08601968047
0.08819818384
0.08727275738
0.08560412632
0.1014968075
0.2932627039
0.2688823223
0.2830089923
0.2476225711
0.2512462504
0.293267094
0.1978230025
0.2371695082
0.2298068199
0.02679937949
0.01657749395
0.01639007367
0.02760617525
0.02702074491
0.03854662562
0.0991066096
0.09054620021
0.07394728692
0.1132656445
0.1014224449
0.1073273818
0.09172021883
0.09619570444
0.1087103712
0.3823537191
0.3623350433
0.3653543017
0.3714230875
0.3546072902
0.3927055159
0.3049995066
0.3464806322
0.3563606502
0.3810581646
0.3594522393
0.3508057517
0.202337807
0.2563749816
0.25269907
0.277400932
0.2739918682
0.219856328
0.045552562
0.03518721295
0.03650793965
0.02273728937
0.02288844081
0.03332561987
0.1304686232
0.118197698
0.1035231128
0.1389099332
0.1287207401
0.1368086758
0.1138466965
0.1211112923
0.1315726061
0.4292449297
0.422258108
0.4238562483
0.4560203258
0.4204440471
0.4394765375
0.395859039
0.4247140869
0.4521954415
0.3511046757
0.3621536058
0.464245272
0.1352828108
0.1990474221
0.1957734734
0.2206254415
0.2165125158
0.163768224
0.08524218727
0.06155785348
0.06511217894
0.03813737226
0.04240513459
0.06755453833
0.4379987453
0.4544403498
0.4448217587
0.4311743146
0.4410646695
0.4328299805
0.4299521561
0.4410062231
0.4337053795
0.2896716961
0.3014800272
0.4273524599
0.08488957296
0.1444049813
0.1465070741
0.1646304595
0.1610423665
0.09802990382
0.02353341309
0.0216215186
0.01421062843
0.1331888641
0.07193772668
0.08362684325
0.09984812524
0.1036568851
0.1239010302
0.4676733099
0.4568001058
0.4851312206
0.3994743154
0.44046301
0.4575866774
0.433628634
0.4363040866
0.3981213376
0.2246071311
0.2364800051
0.3834010774
0.0310626188
0.04901811525
0.04819230484
0.07216805292
0.07091492456
0.04977288093
0.01017612212
0.009818980291
0.2411877059
0.08076888517
0.01909822892
0.01873774452
0.02928567923
0.03631900324
0.06937785255
0.07137673968
0.07085242789
0.06053463194
0.1541873009
0.1326124422
0.1287740702
0.03151318595
0.02622777024
0.02491291874
0.05224675731
0.04635255811
0.0508353588
0.04219858295
0.02933749236
0.02823783715
0.02910207367
0.03025212209
0.03023523258
0.04043594293
0.04470920224
0.04965823903
0.0330912791
0.03436696121
0.03255555557
0.04665387839
0.04459629116
0.0459371855
0.2363712961
0.3195988742
0.3330847242
0.2686315493
0.3104575041
0.2398202824
0.2656261688
0.298722274
0.2589729388
0.1913249157
0.1207870622
0.1253042934
0.09866471381
0.101968684
0.1875318753
0.1828326911
0.1459206554
0.1517577847
0.1267695004
0.1311951797
0.2024142442
0.03238734468
0.0225223228
0.02258555877
0.01632504958
0.01628275188
0.02635789772
0.06574264618
0.0697815456
0.07775476971
0.03994907835
0.06905438609
0.0636606242
0.07692452513
0.0753782661
0.0436001613
0.05136091513
0.05111915858
0.04883906695
0.06245760532
0.0591229003
0.0416932321
0.06161141109
0.0591587519
0.0638738026
0.1745715328
0.2276225669
0.2238077879
0.2490424476
0.2454040167
0.1913447388
0.4000828006
0.3937204695
0.3974293124
0.150724736
0.1234755882
0.1252988481
0.1046475908
0.1059443196
0.1306706743
0.175627834
0.09451599949
0.09760387284
0.1274032681
0.1296377104
0.1564020435
0.05833509615
0.03214336527
0.03667364911
0.03769178707
0.03869465496
0.04902934404
0.09687647659
0.1028449618
0.1055456401
0.06913112783
0.09361071908
0.09139880334
0.1094242709
0.104176441
0.07761641384
0.04696228662
0.07905683304
0.07781653708
0.08926933418
0.08720278279
0.05620306705
0.09265838079
0.08736660692
0.09314662634
0.1080875258
0.1715127937
0.1679559035
0.1924535174
0.1891064338
0.1240482935
0.4618682248
0.3361859189
0.3474022069
0.1024151743
0.07871978076
0.07960436783
0.05608755728
0.05680176378
0.08030702446
0.1262300781
0.1020960976
0.1034655832
0.08056401608
0.08147818374
0.1062704876
0.1145429331
0.09179669347
0.09571539184
0.0684758459
0.07211413172
0.09637753765
0.05300979914
0.0753934197
0.07356730553
0.145977662
0.1423721372
0.07252535364
0.419861532
0.2737700139
0.2857689997
0.05269281674
0.03359200469
0.03393249126
0.07712069739
0.05494234259
0.05550660731
0.03481250049
0.0369823025
0.05768921251
0.1390648374
0.1038140945
0.1140259686
0.08786456821
0.09959646872
0.1372989047
0.01901790447
0.0272115187
0.02571298244
0.003255134252
0.02836832962
0.01597205776
0.04737480963
0.04692816147
0.03049262637
0.3550615133
0.2078998877
0.2194219683
0.04351424603
0.04589641593
0.05929548752
0.01665247181
0.01499173728
0.004840456017
0.05140442377
0.03849704136
0.04105384895
0.2005782461
0.1827596219
0.2086942206
0.1196803764
0.1562174006
0.1845156078
0.1276753335
0.148121606
0.109240879
0.08582331148
0.07707157186
0.08804943947
0.04509141158
0.06492771739
0.07692821371
0.0504896092
0.05891704325
0.04113333849
0.007156374011
0.00891572231
0.008806519968
0.2373178813
0.2135013587
0.2108030374
0.230613371
0.2143565383
0.2542254914
0.1612206579
0.1984831423
0.2105199907
0.1598436731
0.1562126171
0.1364594947
0.1736777843
0.1633944904
0.1732172166
0.1452647169
0.1538242102
0.1643413822
0.04686930484
0.02695676674
0.0319909228
0.03601796351
0.03711087197
0.0452959758
0.1236458507
0.1112559154
0.05988832795
0.1547409439
0.1389904169
0.1435486199
0.1192020091
0.1335049044
0.1505651166
0.1046889676
0.1168789163
0.1471405355
0.08409539131
0.1061025585
0.09431707295
0.1214239904
0.1117452857
0.09758470339
0.01280973496
0.01076245803
0.01042174835
0.02052699932
0.01827888869
0.01959339488
0.02318817061
0.03165975956
0.03135747335
0.03084935472
0.02936328435
0.02763812075
0.04388711669
0.03674691306
0.03878733209
0.04024637194
0.03263036114
0.03410942791
0.02222617967
0.02396507168
0.03196306854
0.1313384799
0.1349507412
0.1365847093
0.1234863587
0.1295489944
0.1305832071
0.13697796
0.1335899208
0.1265793153
0.09888445117
0.1178252902
0.1132139017
0.1265090805
0.1202005235
0.1021729401
0.1261666444
0.1234428129
0.1271357448
0.0167775088
0.01840400622
0.02628797915
0.01385318282
0.01399595638
0.01350105984
0.04079711864
0.02336344327
0.02818839815
0.02726281813
0.0175644516
0.01179120442
0.03301940803
0.02098189835
0.03060270982
0.01513019295
0.01887253577
0.03170157445
0.01948812139
0.01662295746
0.0160321176
0.025997062
0.01623171701
0.0247869142
0.0113835268
0.01431339885
0.02312977293
0.01920512361
0.02204056765
0.0237927268
0.01104432009
0.01489587635
0.01338325511
0.01629300611
0.01482196244
0.01511526852
0.01972117995
0.01761028898
0.01857133501
0.02443621875
0.0234950759
0.03305295529
0.03516735243
0.02515698279
0.02463944326
0.02988523744
0.03050146797
0.04058328603
0.03791173649
0.02797501066
0.02908966633
0.05506753136
0.05832246672
0.08145712714
0.01512836953
0.02319017041
0.02146437234
0.0326459918
0.03129558455
0.02266041171
0.01969560614
0.01830102589
0.01106696983
0.071105026
0.04413595827
0.04666083048
0.1512170885
0.1466541226
0.08697835032
0.2467012378
0.1959628388
0.2003136479
0.1881797517
0.1928230045
0.2429168765
0.06069160181
0.04445802072
0.04768325953
0.03385554798
0.03727001021
0.05704237379
0.06325153662
0.06145141448
0.04380106309
0.1835626773
0.13642717
0.1389055913
0.1169911975
0.1266626265
0.1783269825
0.1992199503
0.1510115046
0.1544344647
0.1437829507
0.1468434153
0.1948590807
0.04700687943
0.06564936556
0.06434651571
0.09116939795
0.07688144369
0.08087362587
0.05489784624
0.06052701173
0.06277631267
0.1153697037
0.120111679
0.09912278265
0.03269274461
0.02910036593
0.0335387159
0.01769685612
0.02378197154
0.02871961037
0.02031962917
0.02186296
0.01642149671
0.04626069967
0.04660823715
0.05043388494
0.02827094194
0.03077621949
0.02830132256
0.04513389433
0.04079430179
0.03606545824
0.03889889507
0.03933337663
0.04198866394
0.03831865399
0.03700345363
0.03760261512
0.1105209563
0.1187944188
0.1899058922
0.1891040905
0.1031382163
0.1079266145
0.139059806
0.1441416496
0.2057715282
0.2055733947
0.1327096183
0.1374325475
0.02223591035
0.02227088375
0.03139994888
0.03058717457
0.0216996544
0.02208221946
0.07023938579
0.068593182
0.0407096393
0.06679975851
0.06720173941
0.06904928599
0.06306994336
0.06395296707
0.06516816539
0.07308555634
0.0739377648
0.07559888684
0.07065492401
0.07228975767
0.07147205034
0.0433119463
0.07374723669
0.07208655068
0.05580535912
0.05344737275
0.05028329516
0.05392702466
0.05282837243
0.05471376044
0.04905611084
0.05093404614
0.05219182657
0.06042581976
0.06094433307
0.06180249552
0.05642663414
0.05897138606
0.05873722425
0.0429941723
0.05957273608
0.05813517091
0.1148874609
0.1162194168
0.1426425001
0.1380496802
0.1122642321
0.1135739181
0.1420389533
0.1436109716
0.1705314681
0.1654197377
0.1389115873
0.1404700668
0.02651211123
0.03046014182
0.06478520925
0.05502922554
0.04437015217
0.0455088922
0.07295758681
0.07392159533
0.09602369187
0.09076300908
0.06886246789
0.07107760059
0.08944460527
0.09169938812
0.1174629243
0.1129028807
0.08642848171
0.08773469513
0.03054078877
0.0518243319
0.05213975957
0.05850398022
0.05521749494
0.03220608145
0.100177712
0.07591935462
0.07976486365
0.0269658241
0.01838195923
0.02027087471
0.01095422043
0.01165892894
0.01862383849
0.08854394046
0.08701122632
0.06625666994
0.2150570862
0.1661995073
0.1699261397
0.1584183867
0.1622029364
0.2109864755
0.2308563859
0.1807004856
0.1843061367
0.1735796123
0.1771464964
0.2268967016
0.06942230405
0.09142407081
0.09006158725
0.0205347309
0.01420213877
0.01524867275
0.05157334706
0.05227818689
0.07236541118
0.06921651734
0.05016958853
0.0511922231
0.04600348134
0.04273383573
0.02493740291
0.07571934421
0.05803084043
0.06144580042
0.05121043919
0.05442006656
0.07171532289
0.1680237329
0.1087257397
0.1144639018
0.09730119873
0.1058570584
0.1612671479
0.017476757
0.01452552217
0.01456163469
0.01416619112
0.01400969824
0.01408527126
0.01376517428
0.01445266
0.01426363539
0.03359293454
0.03660365991
0.04865982652
0.01399411872
0.01435825553
0.01388563686
0.02879367243
0.02894689457
0.01381266177
0.01506518964
0.01129269071
0.0115850139
0.5628696403
0.5292285389
0.5572582163
0.3498497294
0.500128109
0.5320345113
0.460693164
0.4901741859
0.3569700033
0.1338679791
0.1554511945
0.2650818782
0.008631811107
0.04017193471
0.03322777517
0.1031816529
0.1189359
0.006993946376
0.2004113675
0.1952511053
0.1136612328
0.3177539727
0.2607209856
0.2656878696
0.2329397629
0.2548814276
0.3121292322
0.09104877775
0.07229618885
0.0757120238
0.06512331314
0.06858169852
0.08686628585
0.03868623223
0.05237918891
0.04912422571
0.1847966891
0.1572906158
0.1601405512
0.149033791
0.1529378568
0.1740252564
0.07715795981
0.119865349
0.1138711137
0.01050374419
0.008080508948
0.005519551111
0.01312732956
0.008962305413
0.0124367506
0.006994622012
0.008274903425
0.01301345816
0.008518755118
0.00731019943
0.007052226122
0.01043251489
0.007483190824
0.01030515465
0.005391553254
0.006494243832
0.009247134031
0.01810940193
0.01703268236
0.02746338212
0.03781718922
0.0266263239
0.02615154747
0.03266837402
0.03384620228
0.04438398015
0.0134548841
0.02286681195
0.02170626914
0.0260622452
0.02445898662
0.01536132407
0.03384493176
0.02321842074
0.02378521386
0.2056171388
0.2023101951
0.1371129435
0.3074617163
0.255055563
0.2587489206
0.2477901613
0.2514063142
0.3037418938
0.3222179588
0.2697868786
0.2735874677
0.2624901746
0.2662441688
0.3185751288
0.1618110688
0.2135412869
0.2092014095
0.2622695399
0.2111411551
0.2149594301
0.2036383731
0.2076392865
0.2585135377
0.09675261622
0.1578655335
0.1540277124
0.05295974424
0.05059720871
0.03195093556
0.09477628478
0.07191525854
0.07406836553
0.0688313948
0.07005039304
0.09295217234
0.01474304381
0.02600360104
0.01965328483
0.02617264881
0.02363125859
0.0182530043
0.07371249723
0.0455046735
0.04804733156
0.03334297377
0.03093549507
0.04406320301
0.03910227814
0.03646252582
0.03509405028
0.04045088054
0.03798614396
0.03972198917
0.0345770809
0.03621431211
0.03902355578
0.04705849792
0.04537314284
0.04721890358
0.04143301419
0.04341322275
0.04536715327
0.04448560114
0.04258679334
0.04074518973
0.02238405723
0.02243392023
0.03213020369
0.02666974925
0.01655624061
0.01739571851
0.2347003511
0.2310242728
0.1776742951
0.3366887437
0.2844228711
0.2881013598
0.2771152862
0.2808459301
0.3331264088
0.06050205554
0.0823953567
0.08135103346
0.08426307488
0.08326239201
0.06101549372
0.1320773112
0.1071481138
0.1084376282
0.01865632768
0.02834747169
0.02737654228
0.03011856164
0.02926510865
0.01916910264
0.05012740148
0.03969912278
0.04064930514
0.09829088958
0.09591500991
0.07191276012
0.09915149236
0.09861986644
0.101156171
0.09351362954
0.09605959984
0.09633987526
0.08204710349
0.08037659823
0.04792830148
0.08032435228
0.08080827859
0.08257384235
0.07732101501
0.07906617859
0.07832344504
0.08889378033
0.08868373575
0.09105542152
0.08445600086
0.08656220693
0.08642119975
0.05456150525
0.08545052641
0.08359693731
0.1788060927
0.1751049373
0.1100725475
0.2775403338
0.2259721897
0.2297084149
0.2185446476
0.2222951526
0.2737673552
0.2925681519
0.2405858457
0.244183623
0.2333619793
0.2369774591
0.2888349019
0.1225355332
0.1857334159
0.1823191049
0.0769123857
0.07774112714
0.10111803
0.05742143262
0.05690233364
0.0377239297
0.08164758906
0.05775984863
0.05932362472
0.09896909172
0.1007522909
0.1247528854
0.05798527187
0.07833398182
0.07638692467
0.08054725758
0.07931383042
0.05830223691
0.03844124889
0.05854465836
0.05800470021
0.05966669116
0.05911401982
0.03869799068
0.1075847826
0.08243064573
0.08336658103
0.08373692658
0.0876902922
0.1107968126
0.04242862482
0.06557350297
0.06213934369
0.07311134809
0.06925769664
0.05038900938
0.01433012236
0.01200289961
0.01220777025
0.0331853313
0.03334797164
0.0519429281
0.05385118765
0.05441760132
0.07616891235
0.06115214671
0.04126561098
0.04621897959
0.01011552806
0.006993889708
0.002798367652
0.119117145
0.06411046979
0.07014875109
0.05665350587
0.06207316064
0.1137054842
0.08857506272
0.06661231789
0.06745865672
0.06451511861
0.06524923072
0.08675663305
0.01806321857
0.03352060477
0.03185222021
0.03791177882
0.03646279028
0.02325245044
0.06107939252
0.04836743444
0.05023443606
0.01552108758
0.01442205146
0.01564031043
0.01452474013
0.01390810372
0.01527397518
0.00631706296
0.008286962264
0.01004690549
0.009947780071
0.01264770322
0.02241826552
0.01463185307
0.01603656353
0.01233122116
0.01339045949
0.02040473833
0.01288919605
0.01144216686
0.0134433336
0.008444666924
0.009450269399
0.007099795537
0.01764676973
0.01647302218
0.01481862905
0.01089133238
0.01582997606
0.01430959841
0.01937549295
0.01748586357
0.01137493666
0.03404097302
0.02573269218
0.02756597051
0.01255945128
0.01364025873
0.01294793915
0.01558739117
0.01458010355
0.01262814982
0.02836888428
0.02031474622
0.02234362498
0.01518497992
0.01341721791
0.01362598493
0.01316156483
0.01317717878
0.01426545564
0.01985833672
0.0152814798
0.01591364989
0.01414349951
0.01459779313
0.01811962274
0.02025847156
0.01999217203
0.02135261833
0.01717741235
0.01870067925
0.0190769122
0.0217398882
0.02100959565
0.02377942645
0.01646655311
0.0150416535
0.01626829369
0.01412872973
0.01441353154
0.0157897133
0.0136509942
0.01341658791
0.01275301551
0.03187196559
0.02257987215
0.02029897746
0.02583795998
0.0254032324
0.03568984239
0.02104402997
0.02061165637
0.01176358858
0.04149582021
0.03110926754
0.03179381418
0.02493827459
0.02647063981
0.03667594465
0.02612230045
0.02477185488
0.01646711579
0.04329044862
0.0339210138
0.03542552817
0.03047736427
0.03217320835
0.04171975887
0.03100865249
0.02169471421
0.02328644419
0.01870572866
0.01998715316
0.02921272461
0.03733980168
0.02724690465
0.02873422563
0.02471857496
0.02590694598
0.03555486041
0.010906926
0.01732789701
0.01641536659
0.01544403906
0.01409737421
0.01154069495
0.02997309558
0.02181255063
0.02373539408
0.01805237638
0.01992688355
0.02783640402
0.1025834295
0.08133538972
0.08314291752
0.07670024167
0.07908307128
0.1006384156
0.04225872062
0.05926400482
0.05631431011
0.06775874762
0.06658738207
0.0474044043
0.1097109902
0.08767323912
0.0891669719
0.08471472086
0.08624794896
0.1080994943
0.07985526508
0.08729836303
0.06586384273
0.0802651031
0.08164018887
0.07532320302
0.09601835168
0.08845018462
0.08572325438
0.06220741898
0.05935055082
0.05493831697
0.06958613616
0.0642993827
0.06697483773
0.06900486034
0.06664990442
0.0730553694
0.1305377427
0.1016481934
0.1064654761
0.09250988768
0.09637273216
0.1269634699
0.1073927212
0.1140428608
0.1052680505
0.1094148031
0.1122598289
0.117797064
0.03918362238
0.04259436957
0.0419855834
0.04450322639
0.0429560347
0.04015039085
0.05113716626
0.04789959103
0.04910997485
0.04370355174
0.03744740147
0.03547848171
0.03468054056
0.03632128247
0.03580671138
0.02415449501
0.0344546237
0.03424710593
0.03013887496
0.03146225371
0.02134472795
0.09075801375
0.06736147598
0.06964910325
0.05465766474
0.06038867386
0.08662107112
0.09838374526
0.07430625696
0.07493006792
0.07244603796
0.07291895738
0.09690863399
0.07341812699
0.04883440743
0.0491886785
0.04811219049
0.04849652727
0.07272280928
0.07699299643
0.05045810644
0.05172564281
0.04952028929
0.04990594076
0.0757896738
0.1132699704
0.08465998189
0.0855830501
0.08285318873
0.08376431816
0.1119070558
0.1193178109
0.08865411634
0.09015636075
0.08653158104
0.08752240386
0.1176480491
0.1030366976
0.07758666847
0.07841964293
0.07590392506
0.07669435978
0.1018116559
0.1079479193
0.08103431285
0.08193783246
0.07927464703
0.08013735115
0.1066767403
0.03157012752
0.02231667234
0.02233557942
0.0191571669
0.02079579767
0.0298130466
0.07074252488
0.04748820086
0.04779237273
0.04683441422
0.04714878931
0.0701004485
0.01934854014
0.01130023344
0.01224634894
0.0106418357
0.01102354478
0.0184485762
0.02531166203
0.01687045082
0.01772755349
0.01398199872
0.01568971245
0.02388721417
0.09739387679
0.07512252845
0.07589704411
0.06193127734
0.06556135296
0.0882789454
0.04345487937
0.06690160438
0.06418635666
0.07412523521
0.07067660593
0.04822758176
0.1188718343
0.09433406734
0.09686174778
0.08433336718
0.0853292603
0.1115401231
0.03933230344
0.06084997814
0.06024535202
0.06256547879
0.06157516544
0.0395974068
0.01561751638
0.01680723769
0.02527921285
0.02047478838
0.01284839566
0.01430633312
0.01275372714
0.01332747548
0.01853139423
0.05027259979
0.03289561243
0.03296864205
0.07323157505
0.05273919638
0.05334713565
0.04783554683
0.04983016928
0.06821346707
0.08244396076
0.06161135685
0.06252396662
0.05384930466
0.05498387493
0.07489652546
0.01444590236
0.01439788978
0.013651975
0.01416926153
0.01404344663
0.01412957475
0.01369728169
0.01418095037
0.0139771251
0.07687694269
0.08063288045
0.06292311868
0.1160060252
0.09821888814
0.09018026136
0.1209408025
0.1079380859
0.1265310134
0.2076604331
0.194171957
0.1748491787
0.2221101548
0.2065360565
0.2211324726
0.1830855999
0.193855977
0.2081481219
0.02422820716
0.02606568239
0.03284459496
0.01386889909
0.01812622436
0.01685232439
0.02153704946
0.02000836575
0.01474117389
0.1325488606
0.1429764877
0.1397057885
0.1480639006
0.1454789975
0.1389555766
0.005322711513
0.003830234588
0.003583058186
0.006327405013
0.005436440606
0.005998567966
0.004389704442
0.004177829102
0.006094169779
0.004092693876
0.003774968974
0.003197805667
0.004807430999
0.003739989443
0.004827396117
0.003532799568
0.003597153316
0.004349669671
0.02928114039
0.03592906175
0.04015967982
0.03165339962
0.03187062551
0.02690724121
0.02483700429
0.02554078151
0.02568751492
0.02412760481
0.02537312042
0.02458157615
0.02753310931
0.02613611726
0.02568050305
0.2635349285
0.2599766523
0.2059425204
0.364573863
0.3130724092
0.31647048
0.3060686902
0.3096030122
0.3610824918
0.3413997905
0.3267858865
0.3302688286
0.3198824192
0.3233520501
0.3469956415
0.2164191167
0.2705506496
0.2670584039
0.03605767571
0.02943171435
0.03108399796
0.02570855593
0.02762746921
0.03448519566
0.01297549378
0.01942865709
0.01728725756
0.06063765129
0.08096883491
0.07702161971
0.08907942946
0.08508381081
0.06432331762
0.1165877629
0.09355758414
0.09514555565
0.09059245911
0.09208934655
0.1149127635
0.04923771848
0.06986562435
0.06873620827
0.02826305526
0.02997163271
0.02880167188
0.03285987882
0.03121341928
0.0297836122
0.03176632208
0.03155826213
0.033101453
0.3507651358
0.2989144807
0.302501091
0.2916976329
0.2953296636
0.3473012003
0.1879330109
0.2418362878
0.2382114999
0.1203665629
0.1218438575
0.1489900038
0.067903392
0.09453900402
0.09331271941
0.09788269094
0.09599910209
0.06899130185
0.07778237168
0.1032374132
0.1003629277
0.1082237309
0.1059510698
0.08155609572
0.1583549259
0.1318402014
0.1338573698
0.08038806658
0.07770269622
0.05553312242
0.1241456379
0.1008559114
0.1031314062
0.09683309725
0.09872665205
0.122139002
0.03069477356
0.02928689689
0.0209325452
0.04197180475
0.03622859046
0.03621968894
0.03285083364
0.03403250997
0.04090192945
0.02184836386
0.02973280409
0.02842309865
0.03289448702
0.03164063702
0.02344437153
0.04640776595
0.03957698327
0.03923749709
0.03479918789
0.03166651777
0.03303929428
0.02550073728
0.02789842601
0.02682315336
0.02931097351
0.03092526563
0.03870870166
0.01489018329
0.02304865113
0.02136086416
0.02648649009
0.02491348272
0.01657432773
0.01931747254
0.01759187349
0.02079248604
0.01260963637
0.01502362647
0.01655855389
0.01338238961
0.01407526938
0.01128943521
0.04918850148
0.04062974697
0.04173223193
0.03721713598
0.03865165925
0.04783242388
0.02084035355
0.02931710913
0.02778623827
0.03299458289
0.03160603566
0.02978266054
0.03639292326
0.03429989593
0.03578504816
0.03117761657
0.03339896084
0.03609882065
0.06518798462
0.09011329235
0.08910505231
0.09219817745
0.09113818992
0.06579091022
0.1442015091
0.1175725398
0.1189431389
0.1096844934
0.1109838892
0.1365687147
0.06284133081
0.08617652789
0.08518682627
0.08812138629
0.08713322677
0.06342119051
0.09143920688
0.1170364206
0.1157243224
0.1197479933
0.1184035711
0.09249257732
0.1721961816
0.1451954091
0.1467911596
0.1356705899
0.1373144805
0.1637721959
0.08716691344
0.1115912049
0.1101268041
0.1143490333
0.1130546295
0.08849642916
0.04180067168
0.04292388784
0.05377923421
0.02164785353
0.03256131538
0.0312616819
0.03568964544
0.03426999895
0.02336310128
0.1321059245
0.10940566
0.1112238067
0.1053556168
0.1074849838
0.1302776866
0.06436991034
0.08514935818
0.08290965833
0.09423457616
0.09287460448
0.07053391219
0.1391533225
0.1165919927
0.1184556387
0.1130005977
0.114774509
0.1375110265
0.01418850391
0.01414178154
0.01645597325
0.01448921159
0.01440744789
0.01433178341
0.0147930853
0.0143870803
0.01486938695
0.01541257253
0.01484890026
0.01385182867
0.02622159677
0.01927224636
0.02044616774
0.01681643786
0.01791323972
0.02415971114
0.009108429765
0.008021117754
0.009479900748
0.005810989861
0.00675841428
0.007528333992
0.006045612982
0.006235425384
0.005103453408
0.03266555209
0.01587841729
0.02267508186
0.01487278785
0.01559525285
0.03104319745
0.002024142955
0.0069109423
0.006699151095
0.01096734734
0.008560224448
0.003072954832
0.01287307065
0.01001436734
0.01086369876
0.0112599803
0.01078400972
0.01274981987
1.15558884
1.155616608
1.156035739
1.155661218
1.155720081
1.156074554
1.155811587
1.155934127
1.156135045
1.156099269
1.156312654
1.156255635
1.156575764
1.15690786
1.156426457
1.15728916
1.124664905
1.156668013
1.050773737
1.003825666
1.042039805
0.9841585907
0.9854299057
1.019324343
1.008049211
1.055896776
1.095679022
1.12877459
1.157305649
1.156524154
1.156936367
1.15662121
1.156356694
1.156369972
1.156163899
1.156210687
1.15599221
1.155879209
1.156111966
1.155773784
1.155699508
1.156063434
1.15467937
1.154706354
1.15513334
1.154760793
1.154848049
1.15521579
1.154963244
1.155210369
1.155517218
1.155478697
1.155598757
1.155680917
1.156042307
1.156252828
1.156185382
1.156966404
1.1572766
1.156991737
1.137982758
1.055241099
1.115738432
0.9668417282
0.9237095278
0.973033075
0.8994421687
0.8909817292
0.9348098818
0.9016573518
0.9291282622
0.9705238058
0.9919996097
1.054442379
1.103141841
1.157942753
1.157606585
1.157267797
1.156786412
1.156532249
1.156424266
1.156088214
1.155555743
1.155633797
1.155274692
1.155073831
1.15536045
1.154931759
1.154858746
1.155224685
1.153847978
1.153920443
1.154298632
1.154053867
1.154258197
1.15452127
1.154568072
1.155205183
1.155161114
1.155354842
1.15561349
1.155547142
1.156668987
1.157121094
1.156788761
1.049056659
0.9831717649
1.062127088
0.8362341199
0.7985222701
0.8658207825
0.7197832967
0.7018054818
0.761105542
0.6690174587
0.6697492618
0.7270745255
0.6880532548
0.7020612983
0.7612689578
0.7668852065
0.7973881819
0.8610186993
0.9141059155
0.9656320948
1.038262289
1.148869403
1.157667511
1.157239095
1.156916747
1.155746367
1.155557038
1.155143605
1.154711203
1.154841072
1.154405118
1.154230788
1.154489201
1.153106258
1.153260525
1.153564412
1.153533581
1.153955204
1.154061635
1.154581699
1.155895391
1.155302047
1.1559323
1.156473938
1.156155003
1.034199367
0.9526590125
1.027157955
0.7558813953
0.704336198
0.7663654895
0.5835394033
0.5526658587
0.6091016648
0.4838705755
0.4681354037
0.5234680259
0.4440089419
0.4412321087
0.4961437453
0.4603688843
0.4732138567
0.5274618595
0.5321228401
0.5584351455
0.6141371589
0.6591743487
0.7018253831
0.7617956037
0.859711491
0.9260362055
0.994089736
1.01060739
1.156762825
1.156092041
1.155629465
1.154774463
1.154666649
1.154179641
1.15380794
1.153939159
1.152493728
1.152788671
1.152992109
1.153293825
1.154060737
1.15394373
1.155223287
1.123017204
1.156213419
1.144451946
1.048528707
1.105688898
0.787590975
0.71774166
0.7677460744
0.5503741818
0.5049778624
0.5478176635
0.3940527343
0.3643018334
0.4057667445
0.2952643184
0.2791734866
0.3215657881
0.2548109461
0.2551570605
0.2968745358
0.2759228728
0.2895027834
0.3300897025
0.3475080638
0.3725865984
0.4140292093
0.4670979314
0.5037706261
0.5480500448
0.6405712864
0.6954705956
0.7450553053
0.7958240401
1.035493799
1.147225315
1.156937969
1.155410288
1.154989854
1.15435155
1.15361407
1.153671845
1.152024287
1.152558221
1.152643337
1.15341372
1.154686461
1.154305942
1.156536694
0.9620440835
1.088240645
0.9446793795
0.8527003282
0.8927872004
0.6300381145
0.5696808717
0.6008490859
0.4194390921
0.3752155324
0.4023062907
0.2658995992
0.2356419335
0.2624479486
0.1611908927
0.1432733082
0.1727494423
0.1203436403
0.1207619464
0.148863925
0.1476035705
0.1626070817
0.1894674332
0.2216221024
0.2453879045
0.272401075
0.3316043767
0.3653545096
0.3947339786
0.4909557519
0.5406384765
0.5740538655
0.6459485844
0.8604630224
0.93891763
1.048855694
1.156685893
1.155935567
1.154990263
1.153760872
1.153599314
1.151726721
1.152617476
1.152562166
1.153940022
1.155823281
1.155229138
1.112193711
0.8585703211
0.9356107454
0.817213406
0.7373311307
0.7596972204
0.5415368936
0.4866317408
0.5019628476
0.3458512698
0.3050751787
0.3172846205
0.1962246893
0.1638439996
0.175999273
0.04422979128
0.04462185069
0.05484497064
0.1471817311
0.1698394545
0.1843445174
0.2497640667
0.2812276287
0.298080267
0.3945584521
0.439582313
0.4602987434
0.5576547207
0.7440986436
0.7974948954
0.9086243104
1.101540738
1.157511475
1.156091788
1.154270669
1.153921159
1.151701481
1.152999555
1.152788851
1.154868831
1.157383849
1.156606736
1.024236487
0.7977895704
0.8418385489
0.7508353056
0.6804683818
0.6904816527
0.5067370433
0.4581225777
0.46130552
0.3319753204
0.2950835342
0.2920059806
0.0501049963
0.05755287667
0.05780104434
0.1197880103
0.1392587724
0.1431852051
0.2103171228
0.2387839969
0.2459552369
0.3416780344
0.3828070286
0.3936222046
0.5085575622
0.6688391837
0.7004992177
0.8227103098
1.005701179
1.049473947
1.157493024
1.155098125
1.154601677
1.151974873
1.153714129
1.153353077
1.156120814
1.148495715
1.158199492
0.9755679995
0.7825259447
0.7922673273
0.7243410371
0.6645539039
0.6622637682
0.5146275695
0.4725092183
0.4669922817
0.3652775137
0.3351282405
0.3224638916
0.06554641653
0.07031930374
0.06756074306
0.1237423692
0.1404685787
0.1383761578
0.2035177586
0.2287662334
0.2289231808
0.3229814143
0.3611533174
0.3632082794
0.4974373313
0.6351357195
0.6473984456
0.7741887638
0.9413531408
0.969317614
1.126374812
1.156212023
1.15559501
1.152533925
1.154739349
1.154242522
1.157662393
1.105040327
1.124119573
0.9535787679
0.7825652496
0.7827535339
0.7238027822
0.6721733581
0.668377546
0.5428462743
0.5070201802
0.4973251713
0.4179284978
0.3941751257
0.3791168275
0.09161024627
0.09507747808
0.0916638266
0.1447663196
0.1604101706
0.1542096098
0.21859644
0.2423476493
0.2368326075
0.3318025057
0.3675025634
0.3655113277
0.4975311801
0.6294477894
0.6297792342
0.7571755227
0.9070822513
0.9210723902
1.070759409
1.157516998
1.156831624
1.153368221
1.155974913
1.155418691
1.159268101
1.081996301
1.090996151
0.9510049575
0.7976812268
0.7906231598
0.7403056558
0.6950073808
0.6883060311
0.5801803858
0.5483353052
0.5378177376
0.4697672976
0.449371488
0.4366818136
0.1241549833
0.1283556729
0.1241046493
0.1774976208
0.192993324
0.1837072211
0.2500206322
0.2737067685
0.2641646605
0.3592341488
0.3933880661
0.3838909625
0.5267700562
0.6493902498
0.6364525691
0.7673268341
0.9000293629
0.9009596979
1.042230688
1.158965896
1.158222005
1.154421079
1.157361425
1.156814766
1.161004096
1.078064195
1.077716768
0.9611199164
0.8308976223
0.814106473
0.769287255
0.7295394734
0.7189376901
0.6219543984
0.5916000641
0.580317006
0.5142288191
0.4928773099
0.4826362386
0.1571450799
0.165143129
0.1594096027
0.2236441145
0.2404376694
0.2267556342
0.3004590775
0.324357486
0.3098147906
0.4087985285
0.4418680946
0.4279023639
0.58083835
0.6894753037
0.6673040157
0.8014019563
0.9158104301
0.9067694405
1.04094218
1.160474475
1.159691711
1.155726991
1.159055032
1.158282174
1.162611638
1.087335045
1.081826941
0.9976718817
0.8819184738
0.8603628287
0.8121128764
0.7749396147
0.7632403093
0.6732075619
0.6436053025
0.6293615365
0.5623452824
0.5373247534
0.525080873
0.3957281772
0.3492422383
0.3535013077
0.05068501189
0.06566878717
0.06246676491
0.2236626845
0.2432917637
0.2236661618
0.295491023
0.3146040294
0.2928768834
0.3780271031
0.4025679068
0.3792621419
0.482847867
0.5141989658
0.4935903534
0.658180591
0.7586100873
0.7185126206
0.8517564246
0.9556483763
0.9343289232
1.06100826
1.161944875
1.161202735
1.156973661
1.16051288
1.1598431
1.164082045
1.131516155
1.106894523
1.06022445
0.9455912844
0.9105500691
0.8714657778
0.8390353006
0.8230536692
0.7429200961
0.7138102029
0.6966024424
0.6323030581
0.6056597396
0.5874479874
0.1009140469
0.1364473741
0.1318481749
0.3502873555
0.368985757
0.3260357861
0.4254482828
0.4420770502
0.4028289082
0.4945467054
0.515846898
0.4829618611
0.5872348551
0.615784707
0.5872934368
0.7619835333
0.8530313944
0.8041714336
0.9294129504
1.023391582
0.9870474372
1.107839148
1.163345147
1.162674093
1.158191187
1.161860928
1.161258913
1.165342863
1.16702847
1.166566285
1.147820517
1.053355865
0.9895644004
0.97108176
0.9397917459
0.9103761406
0.8520844734
0.8253095899
0.7940227204
0.7562316367
0.7346106051
0.696438719
0.6707785393
0.6591336444
0.6077073148
0.08831231238
0.01629021636
0.01575016904
0.1431072835
0.2079524115
0.2047108309
0.4001519489
0.4716091288
0.4634956824
0.6541678146
0.6504937158
0.5889117769
0.6678780865
0.6797529467
0.6335196839
0.7314301036
0.7530923717
0.7159040019
0.9010041027
0.9714544608
0.9084979701
1.041049544
1.119796903
1.068735947
1.168024766
1.164683234
1.164062516
1.159310743
1.162960145
1.1625258
1.166322288
1.167646348
1.167366784
1.165606856
1.155373206
1.1122361
1.112808651
1.083381824
1.041741087
1.015693123
0.9969582026
0.9473989618
0.9572171439
0.9559134149
0.8806188169
0.732769167
0.5660408743
0.6310137624
0.04025244158
0.01950769886
0.01809328244
0.176064703
0.2398220611
0.22843053
0.4445506024
0.5187188921
0.5044537492
0.7430960692
0.8115225448
0.7994363795
0.9053385956
0.8999235517
0.8398202137
0.9190079739
0.9333547427
0.8831650447
1.071447505
1.126390646
1.042671325
1.170747918
1.171453526
1.170539894
1.169542592
1.165871407
1.165320092
1.160279864
1.163934744
1.163557591
1.166947158
1.167864806
1.167787992
1.165238814
1.153733983
1.155013202
1.147310264
1.137776924
1.138894847
1.092864744
1.070146124
1.076715987
0.9541187436
0.8865692355
0.9131714771
0.4634140957
0.2613121142
0.3312169935
0.02853426619
0.03859937223
0.02966056916
0.2454104076
0.3038424928
0.2855602572
0.5164941558
0.5887704058
0.569959506
0.8005751059
0.8611829445
0.8491145086
1.004456861
1.03876481
1.03438113
1.10913023
1.124703596
1.103908697
1.157110665
1.169210392
1.167901979
1.172797839
1.172937039
1.172246609
1.170658762
1.166834413
1.166407662
1.161064656
1.164664423
1.164335791
1.167380794
1.16778805
1.167851347
1.164481196
1.151672542
1.153248899
1.144694225
1.134059944
1.135007338
1.077129839
1.043929369
1.049785749
0.8430401378
0.7062318405
0.7583706669
0.1646256302
0.0698753604
0.09309815282
0.0514419917
0.1232883721
0.09570623535
0.3186481818
0.3825389607
0.363184114
0.5926522627
0.6592201491
0.6433702648
0.8472667722
0.8989767318
0.8916186226
1.01976091
1.04989226
1.047676848
1.115372162
1.130111821
1.128866706
1.16021764
1.171307029
1.170340744
1.174284913
1.173996957
1.173513816
1.171450837
1.16754633
1.167241291
1.161660861
1.165126809
1.164905474
1.167529761
1.167474379
1.16764917
1.16358855
1.149357351
1.151098349
1.141702394
1.130004224
1.131071963
1.06536192
1.025405287
1.030303058
0.7417392979
0.5524873438
0.5768253449
0.085653562
0.04478689889
0.04593490079
0.1082136352
0.1972067209
0.1851298195
0.3711521796
0.4367221589
0.428130487
0.6334657884
0.6956309412
0.6913193821
0.8666238884
0.9142717034
0.9110749537
1.029055924
1.057989151
1.056071608
1.120500207
1.134485069
1.133477627
1.162546626
1.172794008
1.17212135
1.175300276
1.174678109
1.174378626
1.171957078
1.168026565
1.167837176
1.162094136
1.165413954
1.165276098
1.16751531
1.167036217
1.167270446
1.162486091
1.146898704
1.148758057
1.138491839
1.125566777
1.126719576
1.051195665
1.002909949
1.008969405
0.6563580567
0.4705649494
0.488617117
0.07190370158
0.04394210044
0.04400674057
0.1336779542
0.2151466387
0.2110367796
0.3887077297
0.452376015
0.4485850994
0.6474961541
0.7105228376
0.706997159
0.8795701963
0.9262023539
0.923355385
1.037205509
1.064981286
1.063335171
1.124684554
1.13797401
1.137181707
1.164187658
1.173749679
1.173334012
1.175901655
1.17503394
1.174890689
1.172213486
1.168303996
1.1682128
1.162401774
1.165578685
1.165496884
1.167401353
1.166519967
1.16678275
1.161328962
1.144257512
1.14626387
1.134988864
1.120596837
1.121904173
1.033627505
0.9739878097
0.9820671073
0.5813333501
0.4111873118
0.4243853682
0.06310607045
0.04422488916
0.04409282605
0.1556998988
0.2308877065
0.2270665199
0.4044660966
0.4672410796
0.4635639615
0.6609312351
0.7237079625
0.7205255575
0.8907648776
0.9365438807
0.9341236149
1.044156751
1.070848055
1.069492599
1.127954053
1.140615722
1.140034104
1.165205492
1.174239515
1.17404906
1.17614121
1.175118443
1.175104895
1.172261367
1.168408291
1.16840105
1.162633534
1.165674015
1.16562174
1.167242661
1.16597352
1.166249377
1.160141265
1.141254933
1.143555934
1.131004779
1.11473941
1.116318536
1.010259813
0.9352606797
0.9458844075
0.5228688826
0.366366905
0.3766403675
0.05814312656
0.04491751838
0.04470521765
0.1740756756
0.2451288487
0.2416893903
0.4193713556
0.4817545388
0.47814714
0.6738924684
0.7358595771
0.7328982723
0.9001415647
0.9450839906
0.9431168428
1.049741045
1.075473931
1.074439717
1.130296056
1.142419324
1.142046283
1.165656602
1.174321298
1.174328034
1.176068748
1.174977913
1.175072151
1.172138292
1.168374587
1.168432124
1.162829673
1.165745273
1.165701126
1.167077043
1.165407804
1.165692297
1.158844905
1.137605428
1.140421182
1.126125667
1.107282372
1.109351995
0.9786723102
0.8886111088
0.9006771864
0.4752346448
0.3297736597
0.3383699701
0.05557329762
0.04611768953
0.04575462051
0.1903084557
0.2584569604
0.2551615298
0.4339405649
0.4961667893
0.4925556155
0.6864203874
0.747280983
0.7444838016
0.907972132
0.9519360665
0.9503654767
1.053866824
1.078783297
1.078078888
1.131711652
1.143406902
1.143234006
1.165599922
1.174050344
1.174226317
1.175733262
1.174649873
1.174833801
1.171875692
1.168224624
1.168338216
1.163024569
1.165823362
1.165773813
1.166930104
1.164837871
1.165121843
1.157413795
1.133012203
1.136561694
1.119772756
1.09714528
1.099993551
0.940036285
0.8397180552
0.8519643333
0.4337319459
0.298074918
0.3058063992
0.05422809307
0.04801754197
0.04746642133
0.2057676142
0.2717066098
0.2683643016
0.4486310148
0.5107093013
0.5070638667
0.6985257918
0.7580596074
0.7554353972
0.9145404344
0.9573580817
0.9561296883
1.056593379
1.080812555
1.08042107
1.132249349
1.143637032
1.143645909
1.16510788
1.173486
1.173801046
1.175183284
1.174168693
1.174425311
1.171499444
1.167983468
1.168138668
1.163232113
1.165926546
1.165863906
1.166817867
1.164283076
1.164557693
1.155860151
1.127272098
1.131695315
1.111382605
1.083428217
1.087201171
0.8978545846
0.7912982949
0.8032344457
0.3950584028
0.2688309767
0.2759717082
0.0537812914
0.05090677284
0.05008461478
0.2208388781
0.285274334
0.2818682495
0.4633001837
0.5250468076
0.521536494
0.709753059
0.7677907993
0.7655047421
0.9197402535
0.9613379783
0.9604949287
1.057980653
1.081626964
1.081534871
1.131997747
1.143201783
1.143367133
1.164261776
1.172688175
1.173112711
1.174464734
1.173566225
1.173879976
1.171032414
1.167662024
1.167856076
1.163465965
1.166061976
1.165983936
1.166745412
1.163748015
1.164013512
1.154180224
1.120430588
1.125662981
1.100900685
1.066626788
1.071012734
0.8566616284
0.7465753853
0.7571347508
0.3611825361
0.243863929
0.24951433
0.05411675432
0.05503292181
0.05386588906
0.2351127347
0.2984317629
0.2952719554
0.4767763884
0.5378849421
0.5349149659
0.7189457308
0.7754414562
0.7737901254
0.9230419653
0.9635282305
0.9631672672
1.058031767
1.081284639
1.081472698
1.131071851
1.142213036
1.142505513
1.163140181
1.171711041
1.172218965
1.173617489
1.172869862
1.17322766
1.170492595
1.167279852
1.16750022
1.163721775
1.166229505
1.166136753
1.166705776
1.163213852
1.163482696
1.152343582
1.112908437
1.118602596
1.089216006
1.048947082
1.053311296
0.8216729845
0.7103122608
0.7183973054
0.3364906884
0.2261205317
0.2297504826
0.05497187595
0.06021685913
0.05884269201
0.2469312211
0.309345482
0.306927892
0.4872344305
0.5475086332
0.5454719488
0.7248943754
0.7800155832
0.7791815866
0.924071582
0.9637333902
0.9638596617
1.056864557
1.079936083
1.080354818
1.129610297
1.140791523
1.141181083
1.161810336
1.170599379
1.171169605
1.17267379
1.17210181
1.172493076
1.169895919
1.166841719
1.167089515
1.16400442
1.166422466
1.166318659
1.166682951
1.162643163
1.162935241
1.150307046
1.105191412
1.110992441
1.077549738
1.032524041
1.03644667
0.7952985122
0.6844251901
0.6899805301
0.3221494811
0.216790707
0.2185254993
0.05620975173
0.06587147912
0.06444341947
0.2550105564
0.316702851
0.3152004612
0.4937638005
0.5532052444
0.552125701
0.7274382867
0.781500561
0.781379505
0.9230855076
0.9622479555
0.9627484383
1.054758425
1.07782707
1.07841156
1.127750802
1.139047454
1.139508582
1.16032427
1.169387678
1.17000416
1.171658507
1.171279468
1.171696036
1.16925354
1.166363839
1.166627329
1.164302344
1.166633594
1.166521791
1.166657566
1.161997295
1.162330915
1.148045365
1.097584117
1.103281868
1.066597441
1.018150586
1.021550224
0.7763546939
0.6670632776
0.6707590758
0.3151477893
0.2129069303
0.2133442168
0.05782386084
0.0714314971
0.07005394142
0.2598065127
0.3208797736
0.3200721173
0.4970108903
0.5557224489
0.5553232854
0.727450127
0.7807428218
0.7810880768
0.9207152013
0.9596148124
0.96035266
1.052015593
1.075196217
1.07589228
1.125602928
1.137065642
1.137579797
1.158719637
1.168101153
1.168752257
1.170590026
1.170416084
1.170851449
1.168576634
1.16584838
1.166130741
1.164618997
1.166852917
1.166737682
1.166611051
1.161247268
1.16163511
1.145562702
1.090230691
1.0957287
1.056538562
1.005710566
1.008659003
0.7625836765
0.6553583356
0.657882394
0.3130731681
0.2130318715
0.2127606214
0.05974828762
0.07665788488
0.07536897989
0.2625071331
0.3229994085
0.3226062059
0.4981601124
0.5562540991
0.5562518967
0.7259415101
0.778649776
0.7792608119
0.9175192796
0.9562885269
0.9571673637
1.048857977
1.072213874
1.07298573
1.123242315
1.134904823
1.135459389
1.157023116
1.166757293
1.167434888
1.169481748
1.169521798
1.169970952
1.167871045
1.165305803
1.165597233
1.164942661
1.167072827
1.166955885
1.166526666
1.160376245
1.160824665
1.14288706
1.083197026
1.088449808
1.047333905
0.9948598152
0.9974415053
0.7522251653
0.6472305492
0.6489969025
0.3135822501
0.2152351466
0.2145244266
0.06193457305
0.08148538039
0.08028969592
0.2640246535
0.323939887
0.3237824026
0.4980797025
0.5556511223
0.5558794899
0.7235717129
0.7758000369
0.7765635695
0.9138386214
0.9525451667
0.9535103654
1.045423508
1.068987977
1.069813039
1.120720403
1.132605778
1.133191745
1.155253654
1.165369611
1.166066739
1.168343595
1.168604469
1.16906248
1.167146131
1.164743366
1.165044181
1.1652731
1.167282669
1.167167522
1.166391327
1.159379299
1.159888954
1.140061239
1.076522037
1.081502136
1.038909546
0.9853025812
0.9875831484
0.7441863796
0.6413918879
0.6426647965
0.3157080168
0.2187805061
0.2177788291
0.06436471814
0.08590308361
0.08479045081
0.2648604655
0.3241903143
0.3241727602
0.4972566896
0.5543565174
0.5547294962
0.7206886659
0.7724984455
0.7733555945
0.9098573542
0.9485371076
0.9495582531
1.041796811
1.065587597
1.066451137
1.118073668
1.130197898
1.130808732
1.153425075
1.16394953
1.164659688
1.167183219
1.167670458
1.168132833
1.166403385
1.164155843
1.164463151
1.165607463
1.167477927
1.167360755
1.166195516
1.158260244
1.158830188
1.137129211
1.070232329
1.074920794
1.031202371
0.976823598
0.9788507879
0.7378662292
0.6372413403
0.6381496151
0.3188790475
0.2232167198
0.2220007668
0.06701669032
0.0899342567
0.08889250262
0.2652868585
0.3240202844
0.3240865803
0.49595378
0.5526162627
0.553082955
0.7174849516
0.7689153662
0.7698306092
0.90568448
0.9443571334
0.9454142257
1.038035155
1.062061228
1.062952384
1.115330058
1.127704123
1.128334476
1.151549878
1.162503407
1.163222452
1.166006125
1.166723888
1.167185337
1.165653167
1.163575111
1.163872688
1.165933258
1.167647613
1.167531902
1.165930484
1.157021463
1.157661669
1.134120192
1.064332023
1.068728548
1.024165612
0.9692821381
0.9710859941
0.7328800263
0.6343445884
0.634961486
0.3228411282
0.2283444026
0.2269313061
0.06987460347
0.09364651661
0.09266176004
0.2654648388
0.3235938323
0.3237072577
0.4943457686
0.5505868269
0.5511126659
0.7140895232
0.7651669457
0.7661141416
0.9013983751
0.9400731001
0.9411506791
1.034182428
1.058446624
1.059356759
1.112512455
1.125143556
1.12578905
1.149636508
1.161032632
1.161760751
1.164811225
1.165763837
1.166227248
1.164887139
1.162948948
1.163260553
1.166256025
1.167779209
1.167673962
1.165579392
1.155647023
1.156409464
1.131007265
1.058788867
1.062922401
1.01772772
0.9625464988
0.9641640728
0.7289369872
0.6324239036
0.6328150017
0.3273966756
0.2339913958
0.2323855087
0.07293827097
0.09709261213
0.09611933892
0.2655040169
0.3230277205
0.3231624792
0.4925626116
0.5483940453
0.5489500236
0.7106002749
0.7613420195
0.7623018424
0.8970607478
0.935738766
0.9368246386
1.030273764
1.054774125
1.055696031
1.109639566
1.122531812
1.123188461
1.147692818
1.159513286
1.160290255
1.163568231
1.164762988
1.165272083
1.164091561
1.162352227
1.162653031
1.166629257
1.167906966
1.167802632
1.165126548
1.154047155
1.155125437
1.12760101
1.053263543
1.057487885
1.011753652
0.9564240526
0.9579807752
0.7257455776
0.6311996776
0.631449186
0.332356779
0.2399845717
0.2381153362
0.07621116107
0.1003554307
0.09934115301
0.2654883226
0.3224033731
0.3225691033
0.4906768907
0.5460933341
0.5467277819
0.7070392798
0.7574594567
0.7584902135
0.8926834827
0.9313645062
0.9324937135
1.026318803
1.051053747
1.052000741
1.106722448
1.119880166
1.1205457
1.145656483
1.157842693
1.158886806
1.162226563
1.163695112
1.164385391
1.163243513
1.161650305
1.1620908
0.3577965961
0.3621071031
0.4081863278
0.1736617257
0.1658664033
0.1708852854
0.2551564881
0.2660072928
0.3149292331
0.06719148985
0.05334683025
0.05494145947
0.03147160134
0.03216273126
0.03978156997
0.1812983368
0.1830300713
0.1922051019
0.06159852914
0.06175005246
0.07574057583
0.05858119971
0.04839473896
0.04540800877
0.06524582236
0.06302408268
0.05691533345
0.2808520903
0.2757043947
0.2901965313
0.1822279476
0.1970922082
0.1937342495
0.08840545801
0.08533680872
0.08086705357
0.4005588693
0.3914913359
0.4031290482
0.3055553711
0.3196244685
0.3265245912
0.1195842812
0.115465254
0.111828122
0.4575192227
0.4462767772
0.4449921338
0.4156564303
0.4243327443
0.4372881954
0.1318794206
0.1566849639
0.1550559761
0.4201759052
0.4232240323
0.4190278572
0.4452587692
0.4420317053
0.4495277303
0.07994583291
0.1033447848
0.1016641108
0.1262723209
0.1247150464
0.1006722913
0.1348756588
0.1221358567
0.1251168556
0.3955921581
0.4219204357
0.4286542033
0.4152068786
0.4119131792
0.4028891672
0.3241207271
0.3279502445
0.3751339514
0.04750158607
0.04660843596
0.04811384013
0.2299045135
0.284066715
0.280751574
0.2889949446
0.3014003341
0.2467567981
0.1549939644
0.1567176268
0.18419117
0.03923544283
0.05383339892
0.05393474003
0.05735947792
0.05689347998
0.04428058676
0.0514927519
0.05016965713
0.04921904099
0.05423518149
0.05466715496
0.03995003691
0.1790307986
0.1516529447
0.1533129926
0.1083169268
0.1058196651
0.08324186256
0.04562177427
0.05838089273
0.0578088326
0.1048045744
0.1294372006
0.1278378142
0.1534770271
0.1518104377
0.1271074955
0.1000412719
0.09854468207
0.07472628521
0.4267592868
0.3849660282
0.3904167523
0.1288689737
0.1310747344
0.1377655439
0.3630901272
0.3163130862
0.3193562802
0.1447683346
0.1545233326
0.1676894921
0.1078873423
0.1102054701
0.09414318803
0.0557008207
0.06199523815
0.06766331545
0.0414005782
0.04246404394
0.03690639437
0.2575507962
0.2548119421
0.2711182261
0.1580176891
0.1719211433
0.1732986473
0.1556347741
0.1516112017
0.1496822244
0.08396109408
0.08149182683
0.06566741132
0.1290926206
0.1316245785
0.1441058387
0.07428096909
0.08150305208
0.07652962778
0.02168974622
0.02475270432
0.02475814323
0.1175452085
0.1263799635
0.1248444214
0.1360982785
0.1347653732
0.132487228
0.09257066656
0.1136109636
0.11106699
0.1231614764
0.1224142201
0.1084612833
0.02319774437
0.01989475378
0.01791625548
0.02412323973
0.02419905137
0.02946059956
0.01773719274
0.01774534622
0.02074615951
0.009744153097
0.01114810939
0.01121262059
0.1140267272
0.112401793
0.0901416596
0.02087265141
0.02325666212
0.02582567101
0.01557338482
0.01642695526
0.01454939673
0.1728159579
0.1771929856
0.1932732345
0.1919681537
0.1666470673
0.1693946407
0.05508817176
0.05495495988
0.04203490379
0.04284250702
0.05542580392
0.05529821528
0.05761255514
0.05691966973
0.0483087407
0.04551581013
0.05942209619
0.05937953075
0.04708179836
0.04796168366
0.05939207037
0.02718477909
0.03595552688
0.03465133825
0.04569314462
0.04394744573
0.03550707292
0.03680932551
0.03502638093
0.02856921502
0.02006819101
0.01909830015
0.01444183236
0.429703096
0.4328970974
0.3727206508
0.01279293897
0.01177158847
0.005784465798
0.03266926628
0.04070685118
0.0378217507
0.0729266266
0.08913856125
0.08661517863
0.01022882109
0.01023136338
0.01223274113
0.1644853518
0.1637181755
0.1412667683
0.1508757974
0.1646683186
0.1649971108
0.09416496457
0.1170843263
0.1154528064
0.0131946975
0.01861258252
0.01737264251
0.03701847703
0.0356585439
0.03590847428
0.04147558662
0.0404772988
0.03949636855
0.06313299921
0.06219036165
0.05002646433
0.05274151265
0.06494704342
0.06395382667
0.1403273067
0.138481282
0.1142680639
0.1195051697
0.1437267723
0.1420167721
0.04018268717
0.04901324736
0.04705561301
0.01648025112
0.0229457159
0.02146757985
0.01500411788
0.01357654923
0.01641979653
0.05921161419
0.06049732344
0.0533474958
0.1339244549
0.1394195171
0.1377193249
0.1556590518
0.1491888972
0.1535531513
0.04661560921
0.04257204112
0.05027285599
0.02494128057
0.02535096475
0.02246209925
0.1276559326
0.1076605731
0.1113466258
0.02968994428
0.03055807848
0.03405839429
0.0113944099
0.01162092198
0.01058231941
1.155526395
1.155545409
1.155398004
1.1559034
1.15570299
1.155727419
1.155778328
1.15572065
1.155882704
1.156544362
1.156368778
1.156110003
1.156951023
1.156630488
1.156873639
1.156350366
1.156455367
1.156719271
1.137881843
1.157672458
1.157260536
1.091131926
1.158011835
1.086100085
1.157231039
1.157586959
1.157920756
0.9322307071
0.9950799446
1.058947125
0.92431094
0.9723435949
0.9015021412
1.093692694
1.040098149
0.9788440125
0.8185080037
0.8727591598
0.9074442607
0.8461276917
0.8615903735
0.8048472106
0.9613095326
0.9161463876
0.8931941904
0.784898304
0.8420662895
0.8517409378
0.8497786602
0.8392751647
0.7882287401
0.9361293181
0.8892357067
0.8991360935
0.8194177409
0.8764861373
0.8545548368
0.9238491572
0.8875697848
0.8350662122
0.9820881349
0.9359803984
0.9808958485
0.9253563611
0.9918399458
0.9421031746
1.080227425
1.01502694
0.9575395584
1.124671302
1.070408634
1.152153598
1.112314936
1.158040827
1.111718171
1.157307228
1.157693196
1.158116171
1.157037486
1.157320811
1.157023096
1.156939027
1.156701781
1.157011089
1.156201522
1.156449521
1.156621122
1.15626341
1.156333869
1.156126642
1.155911899
1.155732406
1.155419962
1.156524258
1.156101222
1.156354351
1.15579686
1.155918494
1.156269923
1.105022152
1.157547258
1.15700991
1.034684891
1.10902441
1.028121367
1.157202453
1.157627484
1.115904279
0.8336600928
0.9062031996
0.9676215813
0.8069017953
0.8537812505
0.7839044015
1.005568525
0.9280607248
0.8775658068
0.6691305429
0.7324866498
0.7675280416
0.6780813347
0.703470625
0.6411810284
0.8340271266
0.7680931252
0.7406994864
0.5813503114
0.6412909276
0.6578822349
0.6169680476
0.6305452519
0.5715386714
0.7482199614
0.6897437321
0.6759601915
0.5529678517
0.6111023374
0.6096520844
0.6199197044
0.6139593313
0.5556348113
0.731711879
0.6730431477
0.679024677
0.5841219464
0.6426524802
0.629185676
0.6809601197
0.6594113382
0.6006605119
0.7782357521
0.7190023196
0.7417086446
0.6729399534
0.7343298694
0.7053801854
0.8044545364
0.7667493129
0.7043524962
0.8951330515
0.8308419856
0.8709744179
0.8262485222
0.8944881843
0.845993482
1.008741494
0.9475989805
0.8772106547
1.094398192
1.020656401
1.08596271
1.071312312
1.143890669
1.07415968
1.157060747
1.157590064
1.139556362
1.156858009
1.157166132
1.156758232
1.157269487
1.156857346
1.156225426
1.048964433
1.136426336
1.071653958
1.156678805
1.157105523
1.118718662
0.8229103303
0.8844151208
0.962742948
0.7522283497
0.8145434896
0.7559415722
0.9506060125
0.8793242909
0.8138515171
0.5952888451
0.6473886624
0.6967778152
0.5645884481
0.6035325257
0.5527109227
0.7189662075
0.6589011146
0.6186921424
0.4509822737
0.4999427125
0.5302377091
0.4507667897
0.4735730578
0.4247539796
0.5819153364
0.5260000519
0.5030296327
0.3671955705
0.4160387819
0.4315962438
0.3981986483
0.4039127353
0.3550580262
0.5129381499
0.4563386449
0.4498235508
0.3410207705
0.3888666147
0.3925286236
0.3993827249
0.3928320136
0.3447755825
0.4988317957
0.4444650808
0.4509399315
0.3740750462
0.4220671433
0.4089989928
0.4577833166
0.4383201187
0.3903175916
0.5438530306
0.4894672171
0.5091945754
0.457550152
0.5061756802
0.4803618992
0.5685150692
0.5353830651
0.4866028706
0.6446514656
0.5881725304
0.6216592755
0.5937158131
0.6471529728
0.606530556
0.7416049081
0.6908912398
0.6380196604
0.8110329731
0.7495176014
0.8005938774
0.79986468
0.8604911352
0.7998137113
1.003316804
0.9272855785
0.8642018788
1.067247558
0.9956882687
1.071954026
0.9388953008
0.9909882388
1.090570887
0.816573881
0.9000738662
0.8496248607
1.009244394
0.9538401719
0.8661988707
0.636042436
0.6755133175
0.7431494244
0.5595283313
0.6147865658
0.5789880879
0.7035944823
0.6555770185
0.6005592888
0.4322477235
0.4668981025
0.5102182814
0.390042959
0.4266579249
0.3916562569
0.5062298837
0.4640332641
0.4271933914
0.2926328254
0.3268042247
0.356774699
0.2765698073
0.3000423114
0.2657584244
0.3795257741
0.3379428866
0.3148862957
0.2047696598
0.2403829939
0.2565505396
0.219742769
0.2281802903
0.1923781825
0.3093643782
0.2669095312
0.258348502
0.1809136768
0.2160748922
0.2158685999
0.2273071961
0.2197559481
0.1850111286
0.2998864375
0.2582831795
0.2653471704
0.2186006586
0.2524365845
0.2384080528
0.2886620403
0.269157491
0.2359228846
0.3467675186
0.3058984824
0.3252155395
0.3017869673
0.3349913723
0.3106192848
0.3934828098
0.3624030102
0.3293306608
0.4420790143
0.3998005512
0.4306905638
0.4267532581
0.462964119
0.4279957644
0.5490301767
0.5030376648
0.4665106372
0.5891433419
0.5444659328
0.5914834882
0.6106276252
0.651091127
0.5975811078
0.7746195985
0.7100469336
0.6692219536
0.8073361819
0.7562830735
0.8218079879
0.7866867277
0.816877136
0.9045942227
0.6666704785
0.7373925646
0.7094805329
0.8068466072
0.7699863289
0.6966023652
0.5210533457
0.5435454172
0.6021953395
0.4397567875
0.4897468099
0.4684752773
0.5450475848
0.5146484055
0.4642387339
0.3332117159
0.3524759245
0.3945441363
0.2768490174
0.3137482986
0.2938816933
0.3621015061
0.3360595949
0.2998731512
0.1923333359
0.2121209362
0.2431723878
0.1582424557
0.1837115282
0.1636746763
0.2349289514
0.2078341522
0.1828515343
0.09580768722
0.1185149737
0.1348664828
0.09808941284
0.1058933809
0.08204185648
0.1603838782
0.1302559391
0.1223933758
0.07051395283
0.09575581894
0.09336280688
0.1107980978
0.102366267
0.0809833619
0.1536546165
0.1255523279
0.1352973294
0.1188901934
0.1396997594
0.1234684383
0.1766480885
0.1571474232
0.1373022343
0.2067122292
0.1800056748
0.1996247201
0.2015615812
0.2217805093
0.1984191439
0.2756754599
0.2475880791
0.2269508959
0.298288992
0.2712088236
0.3002076398
0.3176004477
0.3400748825
0.3069470402
0.4181446374
0.3775054487
0.353883452
0.4331315177
0.4041477508
0.4459188413
0.4839807118
0.5107161149
0.462078797
0.6236091303
0.5637636851
0.5359709946
0.6309306112
0.5955614653
0.6565873957
0.7030162803
0.7182880925
0.7948216234
0.5860013034
0.6489627097
0.6357493958
0.6858475969
0.6655531988
0.6006409404
0.4666897904
0.474968068
0.5283989184
0.3800796419
0.4259835291
0.4187467852
0.4507749483
0.4366409285
0.3894583682
0.2924039915
0.2967010925
0.336968018
0.223027964
0.258581835
0.2548562456
0.2782162996
0.2665046214
0.2308654882
0.1537156992
0.1561483274
0.1888843158
0.09685416724
0.1258278069
0.1235813748
0.1470680451
0.1351275931
0.1051739035
0.05861414156
0.06882332918
0.06341706282
0.02844402163
0.03599726629
0.03535397269
0.04158807004
0.03778136791
0.03110572814
0.05610517269
0.04626098424
0.05008277289
0.1494664321
0.1583356895
0.136231793
0.208038404
0.1821884238
0.172583483
0.2090791433
0.1942305131
0.2207959118
0.2553294711
0.2670843354
0.2363384789
0.3375236317
0.3007753476
0.2882128383
0.3334177526
0.3158345148
0.3534043694
0.4065227537
0.4216792417
0.3777496936
0.5219626149
0.4695860669
0.45340922
0.5105941053
0.4887660721
0.5428221259
0.6629192366
0.6706229594
0.7375988511
0.5551815123
0.6101206764
0.6060379584
0.6254433742
0.6170642995
0.5594601545
0.4618159153
0.4581317964
0.5047793017
0.3740764791
0.4145679441
0.4203951515
0.4145915275
0.4130261662
0.3711045002
0.3111722172
0.3016728785
0.3365924728
0.238246702
0.2687962468
0.2801717965
0.2555996681
0.2601391742
0.2277157416
0.05842434581
0.05760999368
0.05030178549
0.07347507149
0.06551707046
0.06538593844
0.1370607621
0.1373222579
0.1186493585
0.1808966244
0.1579835794
0.1569747475
0.1654768722
0.1606907527
0.1843738735
0.2304309836
0.2337301671
0.206060622
0.297482755
0.2641274896
0.2600874038
0.2779904013
0.2700079227
0.304205697
0.367847883
0.3742302252
0.3340671671
0.466640761
0.4185893773
0.4112407166
0.4393689113
0.4278104035
0.4775905521
0.6659735962
0.665226157
0.7232869981
0.5643870716
0.6125161358
0.6153779277
0.6069562908
0.6100864504
0.5603260837
0.4881156903
0.479594805
0.5202284013
0.408069664
0.4421694254
0.4525113984
0.427405931
0.4336470847
0.3980068109
0.3639780273
0.3491222361
0.3772057711
0.3008926445
0.3236775876
0.3404385608
0.2927746105
0.3074829907
0.282662243
0.07541222007
0.07285310794
0.06947333125
0.08525882045
0.07858775555
0.0813786292
0.07375663058
0.07613764822
0.08203982886
0.1485733733
0.1436714116
0.1275032582
0.1820916143
0.1619382735
0.1660622745
0.1576087816
0.1593092647
0.1804585165
0.2329881502
0.2305812208
0.2047351438
0.2897684819
0.2590438621
0.2606018313
0.2578850048
0.257120253
0.2884444354
0.3625571207
0.3609721383
0.3236011347
0.4463389109
0.4019983557
0.4043671545
0.4055529611
0.4029299031
0.4480135009
0.6822846821
0.6769180545
0.727605344
0.5896881631
0.6312370953
0.6380394952
0.6195753652
0.6250181072
0.5820739818
0.527444422
0.517113911
0.5517520505
0.4569981587
0.4855603556
0.4969108306
0.4633289239
0.4743290772
0.4446370825
0.423185548
0.4089318207
0.4314593399
0.3746124497
0.3899158864
0.4051888356
0.3572584647
0.3738460541
0.3569416752
0.3454609054
0.336683002
0.3478829414
0.322769063
0.3333995395
0.3344173596
0.1028089324
0.09892158401
0.09547522551
0.1103962697
0.104538922
0.1078254316
0.09715322374
0.1003413792
0.1061683935
0.1751571297
0.167338877
0.1518254721
0.2033997947
0.1843485906
0.1919779176
0.1716734769
0.1776666797
0.1969665035
0.2555340961
0.2484809299
0.2246767247
0.3040312092
0.2750253483
0.281692435
0.2631969787
0.2689638778
0.2989971704
0.375695327
0.3700260977
0.3356161447
0.4494599361
0.4078555657
0.4135542616
0.4069651356
0.4062645923
0.4479490963
0.7102912155
0.7023453136
0.7477535468
0.6242015532
0.6615085985
0.6703300212
0.6453187323
0.6531849766
0.6150373425
0.5693051238
0.5587800518
0.5900403871
0.5044295152
0.5302636529
0.5411333255
0.5081462232
0.5193369287
0.4931245329
0.4721685591
0.4611058178
0.4813376731
0.43113846
0.4441219418
0.4548220648
0.419374624
0.4323927886
0.4195545651
0.3693928713
0.4178177647
0.4142106919
0.424731204
0.4211571931
0.3729453644
0.1370228249
0.1329461228
0.1282229071
0.2144544736
0.2032826123
0.1874940479
0.2396701194
0.2204847107
0.2319258189
0.2006195423
0.2098857715
0.228859292
0.2965699418
0.2841502858
0.2607273723
0.3381816005
0.3097529516
0.3222509884
0.2900471591
0.2996347834
0.3283766776
0.4144508242
0.4032476317
0.3694266754
0.4794206222
0.4400444324
0.4507397851
0.4215561338
0.4305705625
0.4700824976
0.7494784941
0.7398114828
0.7826715935
0.6659959961
0.70041391
0.7121381074
0.6797709995
0.6900767107
0.6547966251
0.6157108359
0.603021996
0.6331575188
0.5489812815
0.5749949509
0.5873976055
0.5522748533
0.5635947923
0.5378219739
0.513396184
0.5028617532
0.5249192434
0.4644174442
0.4831825043
0.4929124293
0.4645504199
0.4740873797
0.4581624303
0.3093533281
0.3589704134
0.3546794013
0.3667130516
0.3628082189
0.3131910965
0.2729944736
0.2556557845
0.2381034454
0.2948592863
0.2746547979
0.2922108204
0.2446352318
0.2589044403
0.2787720094
0.3591858954
0.3409530049
0.3172488494
0.39446915
0.3664123567
0.3849811881
0.335513216
0.3500412996
0.378229992
0.4756066336
0.4574679223
0.4247266831
0.5297100639
0.4922803252
0.5101581148
0.4638789052
0.477355196
0.5148474795
0.8050587804
0.788990154
0.8280118703
0.719250714
0.7535944386
0.770520448
0.7271216988
0.739513097
0.7049518549
0.6754040667
0.6576973697
0.6875120786
0.6022820616
0.6291466756
0.646621623
0.6006388565
0.6151824342
0.5884076492
0.5667808686
0.5513671003
0.5762651348
0.5003691176
0.5277077049
0.5413907416
0.503328428
0.5149017126
0.4888195773
0.3407529255
0.3449667223
0.3917126585
0.2448559936
0.2954370654
0.2913168833
0.3039324721
0.2997564194
0.2491851089
0.07208494572
0.06905478996
0.05380131697
0.1051245123
0.08638592145
0.08945613246
0.07941851205
0.08275417916
0.1017422509
0.2921680835
0.2656009776
0.2459817532
0.3031985117
0.2816786164
0.3110821417
0.2377718701
0.2575690024
0.2777305764
0.3696253927
0.3408079119
0.321454971
0.3804171167
0.3603979966
0.3889994931
0.3125438076
0.3343489622
0.3554104826
0.4529871776
0.4253796504
0.4015457082
0.4782015889
0.4507697589
0.4772534151
0.4045046898
0.4271661917
0.4543611729
0.5602329853
0.5377386714
0.5063962684
0.6014902536
0.569303868
0.5927241484
0.527475012
0.5474285433
0.580561276
0.8855856554
0.8607067999
0.8957591959
0.7961189033
0.8276844587
0.8529007
0.7893731066
0.8052136282
0.7732568941
0.7664376997
0.7375943515
0.765865013
0.6833218518
0.7104549622
0.7379923111
0.6681685626
0.6855793612
0.6589960357
0.6620772066
0.6309536707
0.6562386735
0.5810641028
0.606204835
0.6382680376
0.5609953337
0.5794433434
0.5551684419
0.2062982205
0.2022444266
0.151049209
0.1443184393
0.1401950338
0.1059170344
0.165619773
0.1683260466
0.2011927028
0.4563037638
0.4229276112
0.3809619946
0.4587801551
0.4423178494
0.504241872
0.3471851415
0.3904970059
0.4101712723
0.5344077977
0.4851924909
0.4711388361
0.5160645364
0.5000595938
0.5460821907
0.4217330703
0.4585451
0.4753331864
0.5911910643
0.5519041575
0.5336699594
0.5945443591
0.5721399187
0.6106402274
0.5069834577
0.5383708558
0.561791412
0.6798117944
0.6461221936
0.619028564
0.7024506049
0.6738565362
0.7053456889
0.6172398503
0.6452775366
0.6727163385
1.005206617
0.9707836394
1.004284361
0.9132721866
0.9417750448
0.9768488799
0.8797773888
0.9106266322
0.8815233095
0.9030378145
0.862693579
0.8867900039
0.8178346956
0.8397621396
0.8816192357
0.766715515
0.8016620399
0.7786647445
0.824155101
0.7773158372
0.7970957292
0.7398888924
0.7578956543
0.8086285275
0.6740925195
0.7140185687
0.6919292549
0.6561643945
0.6920729058
0.7287711711
0.2863326296
0.5176235274
0.4746952365
0.5518007163
0.5354086432
0.3266170059
0.01726389942
0.0166350374
0.07679367955
0.081781481
0.0301439236
0.03250233303
0.0275109984
0.02885711619
0.07843220267
0.2193710828
0.2125969183
0.1474436789
0.3399742781
0.2792078779
0.2865377334
0.269549655
0.2736816583
0.3330313678
0.4918869893
0.4809894264
0.4085945088
0.629033279
0.5542656795
0.565730944
0.5353318446
0.5441932232
0.6183159641
0.7879258039
0.7207249118
0.7054556326
0.715796306
0.7144660115
0.7837358996
0.5967842033
0.6528815561
0.6587943897
0.7829954964
0.729566837
0.7210359633
0.7563112645
0.7413845899
0.7918369447
0.6501940722
0.6942110841
0.7113516829
0.8367831899
0.7935117082
0.7741779057
0.8449117151
0.8162517483
0.8593858843
0.7402604594
0.7766907359
0.8040522863
1.140118838
1.130260543
1.149337036
1.086596801
1.106509287
1.129682701
1.015472075
1.058212434
1.036130491
1.08285641
1.054856281
1.069360864
1.038476673
1.044524383
1.059679694
0.9275411183
0.9798864364
0.9656440971
0.9430892951
0.958700464
1.005419055
0.8065374756
0.8947831976
0.8743331977
0.8764122983
0.9255903004
0.8475946508
0.4276287454
0.514689622
0.6824856385
0.1123249382
0.2979825962
0.2105300159
0.437153787
0.3528827343
0.1517935547
0.02455184502
0.0215185757
0.03122645748
0.1230277449
0.05243209893
0.06732434051
0.03656494585
0.04277695333
0.108210073
0.26858134
0.2532816742
0.191067943
0.3860739634
0.3213725954
0.3372431732
0.2959603322
0.3075665823
0.371537839
0.5517600133
0.5345597332
0.4603269944
0.6839604935
0.6089029458
0.6257969063
0.5786871378
0.5931144356
0.6685543748
0.8366221567
0.82399596
0.7572018965
0.9386294481
0.8848361739
0.8955361808
0.8623700858
0.8740879429
0.9220191535
1.029446736
0.9671777323
0.9815980143
0.966237424
0.9632688339
1.031860324
0.845646194
0.9025324685
0.9093844239
1.042252639
0.9859041684
0.9733382005
1.025312652
1.002696623
1.05713829
0.9040179251
0.9525609473
0.9751781256
1.13592374
1.136811681
1.146698769
1.108244314
1.124116452
1.122673173
1.127731105
1.125832874
1.111088044
1.056415304
1.063317868
1.088397846
0.9884976285
1.031038172
1.020133711
1.050909967
1.041319392
1.003885633
0.807009326
0.8500595068
0.930851726
0.5610144278
0.7313282122
0.6641113291
0.8287331613
0.791949151
0.6525544365
0.1374711154
0.1779884505
0.354786315
0.03445172813
0.07276577668
0.05055092419
0.159871695
0.1059655904
0.03842755697
0.07100502321
0.05198802707
0.03089732134
0.2048985619
0.1342016667
0.1586809014
0.0872499896
0.1099455275
0.1825139821
0.3430608334
0.3231811465
0.2645063348
0.4601649102
0.3936937275
0.413870697
0.3548250414
0.3737813573
0.4399956023
0.6260692165
0.6076175282
0.5366274768
0.7492174052
0.6792924573
0.6964653927
0.6434578637
0.6614556602
0.7331729471
0.8827604889
0.8724849367
0.8141981475
0.9705984207
0.9249152493
0.9329438133
0.9059536945
0.9158253994
0.9635829472
1.045342645
1.042448785
1.009658492
1.092090488
1.069579735
1.071703702
1.063976619
1.067053287
1.090151778
1.127553986
1.126168255
1.110812708
1.14843635
1.138566993
1.139772342
1.114903617
1.137290369
1.14732181
1.132087082
1.133087024
1.143977587
1.099818903
1.118764479
1.117388666
1.12140247
1.12010113
1.101700082
1.034918354
1.039348483
1.074372497
0.9178733312
0.9895755872
0.9823782384
1.00916967
0.9988341298
0.9354725819
0.6084466735
0.6547208463
0.8123164422
0.2676234479
0.4550838063
0.4070393908
0.5920825132
0.5206723661
0.3221082038
0.04858342154
0.05515222923
0.1332013049
0.03895143545
0.03835870919
0.03868954784
0.04151460876
0.03909631177
0.03621014295
0.1692470685
0.1480591822
0.06487280081
0.283145642
0.2253492384
0.2424023225
0.1826423585
0.2054063236
0.2669792028
0.4158131244
0.4004163267
0.3349183548
0.5354300602
0.4693436126
0.4834264
0.4337704241
0.4523610738
0.5186880779
0.6837355998
0.6726821253
0.6077649404
0.7993206341
0.7381690286
0.7476082668
0.7123196752
0.7265317736
0.7896712818
0.9077920854
0.9042639376
0.854830486
0.987750948
0.9485029784
0.9515293839
0.93972445
0.9449912054
0.9849637637
1.054084732
1.05202647
1.022198035
1.098951614
1.077502108
1.079284226
1.073717967
1.075648191
1.097351371
1.13241424
1.131293273
1.11674788
1.152279327
1.142999936
1.143959594
1.140909887
1.141984444
1.151405909
1.127844922
1.128930415
1.140927281
1.091554289
1.112992381
1.11145318
1.115982636
1.114503981
1.093736808
1.014719293
1.020198792
1.062071758
0.8647695526
0.9585733599
0.9496626125
0.9749389771
0.9669966122
0.8785994133
0.5082936416
0.5296046547
0.7203879138
0.1832753505
0.3378811766
0.3232876346
0.372746162
0.3540614517
0.1923793169
0.0441586302
0.04439084449
0.08157951716
0.05415266575
0.04054199149
0.04105793528
0.03924731902
0.0400566874
0.05147864794
0.2068288341
0.2025167985
0.1151217714
0.3209054159
0.2696119228
0.2730588559
0.2553657059
0.2653171339
0.3165697522
0.4447597773
0.4408929422
0.3760109721
0.5703512652
0.5058837893
0.5096218106
0.4948885941
0.5019916611
0.5662406042
0.7033522005
0.6995706659
0.6370600234
0.8178166047
0.7607894049
0.7644307996
0.7530633101
0.7570162542
0.8142067501
0.920414791
0.9173858137
0.8700055424
0.9980192256
0.9601048908
0.9628141956
0.9544632614
0.9573206835
0.9955621029
1.061620714
1.059838815
1.031198263
1.1046942
1.08422378
1.085741053
1.080997096
1.082642601
1.10335289
1.136336405
1.135437808
1.121631829
1.15526331
1.146517773
1.147268581
1.144864631
1.145716748
1.154591687
1.123164181
1.124383316
1.137647149
1.081914887
1.106490944
1.104712496
1.109853777
1.108201497
1.084477889
0.9895406963
0.9964636791
1.047207549
0.8008245114
0.9195047171
0.9078972115
0.9402576779
0.930254243
0.8180552761
0.4386217279
0.4539691814
0.6360898444
0.1546165628
0.2867482475
0.2764211289
0.3099836717
0.2978809443
0.1608097113
0.04400462516
0.04395771427
0.06928832294
0.06607957244
0.04308021776
0.04393194404
0.04166890714
0.04235048632
0.06283798433
0.2231596227
0.2191978221
0.1395735116
0.3358415629
0.2830130992
0.286249563
0.276426962
0.279740527
0.3321515816
0.4598627426
0.4561344647
0.3927521079
0.5855378743
0.5206837732
0.5243239308
0.5133342184
0.5170204917
0.5818542439
0.7172741553
0.7139440503
0.6508993816
0.8310799716
0.7746016977
0.7777676135
0.7679423866
0.7713292401
0.8279440646
0.9315911982
0.9289495605
0.8825418463
1.00710505
0.9704503775
0.972818445
0.9654441568
0.9679904417
1.004949949
1.068061778
1.066557541
1.039061106
1.109449612
1.089901868
1.091157604
1.087193266
1.088580014
1.108352472
1.13940005
1.138713517
1.125587622
1.157484718
1.149221818
1.149775675
1.147969013
1.148619668
1.156997926
1.117813342
1.11923619
1.13405135
1.070196006
1.098869334
1.096714434
1.10285608
1.100911995
1.07338279
0.9558985864
0.9652649331
1.028440283
0.7297577348
0.8682225223
0.8538745433
0.8954180608
0.8821304951
0.747153677
0.3874622257
0.3989299727
0.5653398843
0.1343200899
0.2499007841
0.2422346686
0.2668748835
0.2580699458
0.1389248036
0.04452779658
0.04436956356
0.06157286748
0.08074398137
0.04698225627
0.04819280767
0.04483712668
0.04586051781
0.07684001719
0.238180898
0.2345863089
0.1605681893
0.3502776695
0.2958195576
0.298980758
0.2894588186
0.2926469283
0.3467152858
0.4745287924
0.4708949237
0.4082518132
0.599777309
0.5351063987
0.5386619023
0.527940058
0.5315330279
0.5962787726
0.7298888124
0.7268272102
0.6642141605
0.8424804876
0.7867010815
0.7895188605
0.7808336632
0.783808214
0.8397918624
0.9410395753
0.9388493104
0.8932718572
1.014849554
0.9793168397
0.9812721421
0.975087936
0.9772546897
1.013052655
1.073323244
1.072125651
1.045686628
1.113212715
1.094509712
1.09548585
1.092344771
1.093462279
1.112367382
1.141621568
1.141144905
1.128626766
1.158996197
1.151149372
1.151513424
1.150281222
1.150738715
1.158682326
1.111272549
1.11306278
1.129890319
1.054975304
1.089375443
1.086552391
1.094429117
1.09199168
1.059231954
0.9125441569
0.9241088214
1.003170386
0.66666268
0.8100498967
0.7956892752
0.8392798379
0.8246201149
0.6814378396
0.3472968993
0.3565991882
0.5101588394
0.1175373776
0.2214739432
0.2152229366
0.234964089
0.2280488553
0.1214074087
0.04543781751
0.0451548037
0.05734011309
0.09745651432
0.05255117007
0.05423718869
0.04955692558
0.05100173701
0.09314573597
0.2518509547
0.2485120682
0.1782780483
0.3642979611
0.308444264
0.3116124949
0.3021349985
0.3052867747
0.3608143263
0.4889532152
0.4853548799
0.4230218441
0.6134751693
0.5492387062
0.5527492934
0.5422000234
0.5457233896
0.6100873134
0.7416492802
0.7387757502
0.6770606636
0.852321534
0.7975645028
0.8001297877
0.7922648222
0.7949441611
0.8499860571
0.9487033065
0.9469447425
0.9022291452
1.021043456
0.9864853032
0.9880136053
0.9831177383
0.9848542443
1.019645961
1.077293202
1.076425215
1.050908521
1.115942193
1.097971697
1.098652958
1.09638842
1.097216844
1.115358461
1.143012431
1.142741247
1.130735615
1.159845466
1.152330353
1.152513852
1.151831133
1.152102936
1.159692223
1.102621526
1.105045216
1.124701366
1.033928016
1.076542769
1.072600366
1.083492279
1.080165781
1.039845355
0.8642116084
0.8764371339
0.969543584
0.613161054
0.7544913972
0.7413817316
0.7816198499
0.7678922787
0.6258168391
0.3136174852
0.3215445884
0.4644771377
0.1040914298
0.1979513396
0.19272091
0.2092170568
0.2034378171
0.1071553851
0.04696822853
0.04651503749
0.05514853078
0.115331995
0.06006047893
0.0622791326
0.05604936549
0.0579860516
0.1107749743
0.2650468787
0.2617479869
0.1941944414
0.3782764085
0.3212457155
0.3245240056
0.3147975369
0.3180052101
0.3747582286
0.5034217497
0.4997890216
0.4375904254
0.6268706874
0.5632738162
0.5667864834
0.5562565732
0.5597630738
0.6235405498
0.7527600477
0.750040887
0.6894913582
0.8609722528
0.8075108887
0.8098721819
0.8026406808
0.8050997401
0.8589063327
0.9548163755
0.9534191398
0.9097270625
1.0256631
0.9920088297
0.9931574435
0.9894407236
0.9907707008
1.024649206
1.079953131
1.079407771
1.054675488
1.11762819
1.100256483
1.100648876
1.099260001
1.099793878
1.117302608
1.143611499
1.143532394
1.131925284
1.16008803
1.152810236
1.152828655
1.152654248
1.152752404
1.160080413
1.090750668
1.094066236
1.117883154
1.005918917
1.058711137
1.053395407
1.068319468
1.06369031
1.013528398
0.8153241322
0.8274959851
0.9296747181
0.5653238931
0.7032666279
0.6908800584
0.728500362
0.7158045791
0.576987996
0.2832214367
0.2905482309
0.4238326384
0.09308574636
0.1774798323
0.1727891414
0.1875459339
0.182402618
0.09567560543
0.04931895457
0.04864005312
0.0540302496
0.1339854596
0.06984348724
0.07268153636
0.06464218833
0.06716126646
0.1292599886
0.2784640416
0.2750742151
0.2095676375
0.3925983629
0.3346040502
0.3380358817
0.3278434892
0.3312036408
0.3889816162
0.5179617671
0.5143469221
0.4523257878
0.6399907602
0.5772668594
0.5807070946
0.5702947755
0.5737908778
0.6367565412
0.7631090256
0.7606222764
0.7014481566
0.8685770875
0.8165953902
0.8186901282
0.8121773538
0.8144205164
0.8667844131
0.959546181
0.9584987474
0.9159842353
1.028829643
0.9960664328
0.9968549811
0.9942163371
0.9951859675
1.028170511
1.081368914
1.081128432
1.057065417
1.118323433
1.101413011
1.101534854
1.100971438
1.101225573
1.118238158
1.143495963
1.143586573
1.132256326
1.159796416
1.152661772
1.152537362
1.152809088
1.152752747
1.159914446
1.075301253
1.079452214
1.108941122
0.9727864736
1.03575939
1.02948526
1.047770044
1.041875131
0.9813325902
0.7681663182
0.7795827358
0.8872506804
0.5205175774
0.6548889726
0.6435023712
0.678655168
0.6666353319
0.5313553784
0.2555493874
0.2619858878
0.3859292985
0.08389533077
0.1591327374
0.1551691616
0.168118359
0.1634778208
0.08608369029
0.05280940865
0.05180463619
0.05380879917
0.1526597014
0.08210562307
0.08549729115
0.07567766726
0.07882711135
0.1480849768
0.2920039822
0.2886613499
0.2245258711
0.406984865
0.3483483582
0.3517149207
0.3414844089
0.344928867
0.4034405331
0.5317656236
0.5284662674
0.4668492738
0.6521981708
0.5905873962
0.5936527432
0.5840892216
0.5873902668
0.6492997734
0.7719533622
0.7699474027
0.7122968952
0.874763847
0.8243285632
0.8259410195
0.8206874332
0.8225718053
0.8733914303
0.9626798193
0.9620686041
0.9207665151
1.03055376
0.9986222844
0.9990011341
0.997546136
0.9981361986
1.030263721
1.081594146
1.081646336
1.058117285
1.118115659
1.101516547
1.101388812
1.101591578
1.101584792
1.118246601
1.142769067
1.143001863
1.131824339
1.159059117
1.151980217
1.151738695
1.152381257
1.152194829
1.159279855
1.057735389
1.062186954
1.098042173
0.9391545088
1.010407677
1.004178849
1.023123603
1.016742778
0.9473111586
0.7271558315
0.7365630476
0.8471693052
0.4819506644
0.6124479044
0.6033715209
0.6325738362
0.6221983314
0.4906983415
0.2339214431
0.2386401001
0.3540411974
0.07772345062
0.1444262559
0.1413211952
0.1514288869
0.1478407577
0.07906013007
0.05752402278
0.05625443352
0.05429496104
0.1695734615
0.09599529349
0.09947416463
0.08897033868
0.09248201321
0.1656435225
0.3042889316
0.3014482033
0.2383725663
0.4200397506
0.3611513863
0.3639690286
0.3549932864
0.3581493295
0.4170087249
0.543182388
0.5406484489
0.4797364815
0.6621047158
0.6017616111
0.6040289265
0.5965535393
0.599263614
0.6599286536
0.7781423771
0.7768951333
0.7207662694
0.8787693861
0.8297584519
0.8306651979
0.8273904786
0.8286653905
0.8780090707
0.9638714285
0.9637625062
0.9235132896
1.03076036
0.9994749802
0.9994180944
0.9992691013
0.9994263721
1.030849656
1.080721924
1.081033235
1.057845156
1.11712451
1.100671915
1.100332196
1.101203461
1.100963425
1.117437433
1.141548997
1.141893611
1.130750987
1.157968107
1.150869979
1.150537465
1.151472162
1.151181946
1.158268908
1.040497963
1.044669522
1.086260478
0.9098203293
0.9865912686
0.9811860696
0.9981096346
0.9922382858
0.916589851
0.6961247353
0.7028935429
0.8142739476
0.4541524063
0.580557236
0.5743849555
0.5950206443
0.5874233843
0.4599788979
0.2205218993
0.2230323246
0.3320190899
0.07442494665
0.1348309174
0.1332771104
0.1386777193
0.1365581092
0.07501226478
0.06303103136
0.06161186299
0.05523238785
0.1826087336
0.1092681708
0.1122344202
0.1028620779
0.1061345559
0.1797777306
0.3134801915
0.3115305248
0.2493102153
0.4299288241
0.3710876685
0.3729868427
0.3665743408
0.3689499253
0.4278212272
0.5508265073
0.5492917496
0.4892312634
0.6684659741
0.609345825
0.6106318784
0.6060502136
0.6078213853
0.6672320057
0.7811019532
0.7806522002
0.7258263849
0.8801824688
0.8322793226
0.8324774334
0.8313833867
0.8319183998
0.880063408
0.9631690196
0.9635004374
0.9239915283
1.029568713
0.9986632311
0.9982404878
0.9992593914
0.9990053643
1.02998111
1.078960467
1.079469957
1.056413406
1.115512082
1.099056459
1.098557064
1.099947357
1.099520974
1.115963893
1.139953858
1.140381966
1.129177837
1.156607393
1.149431595
1.14903092
1.150186088
1.149816953
1.156968565
1.025076504
1.0287341
1.074732438
0.8866499024
0.9664808851
0.9620640889
0.9760339517
0.9711341483
0.8918785803
0.6748525146
0.6793991624
0.7899535049
0.4373506663
0.5597168259
0.5558851555
0.5688896627
0.5640307823
0.4406718972
0.2140449788
0.2152423109
0.3199722072
0.07322056601
0.1300977845
0.1296506004
0.1318791662
0.1307806027
0.07338422949
0.06868157516
0.06727675305
0.05656436908
0.1912752436
0.1200607344
0.1223081058
0.1150123207
0.117629363
0.189469917
0.3191199412
0.3180032231
0.25647184
0.4359898869
0.3773332152
0.3783867839
0.3746516449
0.3760949054
0.4348039944
0.5547837835
0.5540847235
0.49483602
0.6713030459
0.6132015202
0.6136930608
0.6116909762
0.6125408628
0.6708754714
0.781339126
0.7814818514
0.7276349782
0.8793808984
0.8322266235
0.8319105861
0.8325246674
0.8324360789
0.8797482452
0.9610421534
0.9616764877
0.9225972949
1.027320911
0.9965620073
0.995889898
0.9977442062
0.997182329
1.027960647
1.076564488
1.077210351
1.054122067
1.113445641
1.096878578
1.09626769
1.098025685
1.09746536
1.113996793
1.138082056
1.138571601
1.12723738
1.155044589
1.147748462
1.147296999
1.148616243
1.148188404
1.155450962
1.011711323
1.014873428
1.063999832
0.8689109203
0.9501066458
0.9465027792
0.9578719861
0.953890381
0.8729193866
0.6606422596
0.6636926642
0.7725061132
0.4282557116
0.5469633711
0.5446409279
0.5525439966
0.5496145214
0.430058822
0.2126436846
0.2126779039
0.3143051249
0.07350000198
0.1292959143
0.1294704297
0.1293712882
0.1292710169
0.07333316995
0.07409112911
0.07276149606
0.05825545533
0.1966947233
0.1281567037
0.1298170387
0.1244002472
0.1263708508
0.1955672357
0.3221314504
0.3215603545
0.2606337952
0.4390356507
0.3806251605
0.381124663
0.3792736356
0.3800138997
0.4384900236
0.5561708565
0.5559994966
0.4974535751
0.6716345886
0.6143413611
0.614338916
0.6140344016
0.6142448064
0.6717239881
0.779818944
0.7803161447
0.7271829872
0.8771148767
0.8304490281
0.8298270772
0.8315008986
0.8310101317
0.8777804894
0.9580173176
0.9588346296
0.9199767707
1.024379319
0.993619731
0.9927942307
0.9951719471
0.9944136868
1.02516366
1.073741084
1.074478479
1.05125849
1.111056964
1.09431072
1.093622481
1.095634867
1.094982018
1.111678809
1.136004741
1.136540378
1.125030389
1.15332927
1.145881931
1.145391843
1.146835072
1.146363128
1.153770043
1.000107451
1.002862592
1.054160978
0.8551494878
0.9366461267
0.9336434573
0.9430660677
0.9397833237
0.8582919031
0.6508997499
0.6530413553
0.759724848
0.423788718
0.5392284983
0.5378352452
0.5426857309
0.5408771943
0.4245630378
0.2139273846
0.2134152006
0.3130005227
0.07482182994
0.1305966568
0.1311831932
0.1297362841
0.1301334566
0.0744436299
0.07912331834
0.07788472328
0.06023815026
0.200183763
0.1342249687
0.1355085423
0.1313792073
0.1328681138
0.1994416352
0.3235794192
0.32331973
0.2629706238
0.4402132854
0.3820854978
0.3822637895
0.3815259825
0.3818431616
0.4400446095
0.5560603044
0.5561874794
0.4982308998
0.6704906085
0.6138588641
0.6135740202
0.614250172
0.6140870211
0.6708738712
0.7772959009
0.7779928951
0.7254123232
0.8739967556
0.8276718777
0.8268765064
0.8291524533
0.8284321597
0.87483292
0.9544574436
0.955384277
0.9166354718
1.021000069
0.9901625543
0.9892423487
0.9919409168
0.9910628176
1.021876087
1.070626388
1.07142701
1.048021356
1.108435132
1.091469523
1.090725925
1.092918801
1.092200784
1.109108749
1.133770527
1.134341702
1.12262534
1.151496181
1.143874552
1.143354347
1.144893708
1.144387734
1.151963754
0.9899342028
0.9923590917
1.045157898
0.8441420332
0.9253549331
0.9228104197
0.930765292
0.9280043032
0.8466844366
0.644044902
0.6455621067
0.7500245164
0.4221706184
0.5346203452
0.5338043847
0.5366234646
0.5355580972
0.4223850501
0.2168745927
0.2160042328
0.3139823422
0.07687836637
0.1333328874
0.1342237164
0.1318132573
0.1325627478
0.07634669856
0.08374285532
0.08259813635
0.0624731725
0.2025823995
0.1388651949
0.1398722388
0.1366916439
0.1378248003
0.2020644513
0.3241313399
0.3240523112
0.264281054
0.440296583
0.3824812799
0.3824688215
0.3823841919
0.3824558574
0.4403515919
0.5550720732
0.5553804201
0.4979309381
0.6685026241
0.612444196
0.6119920072
0.6132395546
0.6128615289
0.6690572339
0.7741932002
0.7750088512
0.7228900107
0.8703824995
0.824320127
0.8234209818
0.8260505214
0.8251975395
0.8713203287
0.9505675428
0.9515636245
0.9128664661
1.017336353
0.9863822136
0.9854004254
0.9883044853
0.9873507002
1.018273179
1.067306195
1.068152033
1.044532298
1.105639653
1.088430636
1.087646257
1.089971097
1.089205817
1.106352244
1.131413875
1.132012998
1.120069212
1.149570097
1.141756544
1.141212368
1.142827799
1.142295084
1.150059054
0.9809381597
0.9830885423
1.036917831
0.8351284265
0.9157407064
0.913563232
0.9203628305
0.9180054793
0.8372214936
0.6391438126
0.6402216691
0.7424927891
0.4222643789
0.5319651167
0.5315328625
0.5330952441
0.5324854334
0.4221214677
0.2209032162
0.2197911981
0.316402478
0.079522217
0.1370990901
0.1382213891
0.1351086989
0.1361202707
0.07887573101
0.08796495261
0.08690183403
0.06494098896
0.2043209514
0.1425114024
0.1433323162
0.1407899701
0.14169471
0.2039451855
0.3241460797
0.3241755922
0.2649911477
0.4397104978
0.3822312879
0.3821007785
0.3824189955
0.3823410038
0.4399052357
0.5535308512
0.5539556842
0.496967883
0.6660022297
0.6104627248
0.6099046423
0.6115089373
0.6109985779
0.6666636802
0.7707340224
0.7716237883
0.719912151
0.8664616852
0.8206174582
0.8196533186
0.8225029049
0.8215679959
0.867463605
0.9464639017
0.9475051254
0.9088286665
1.01347964
0.9823888491
0.9813659872
0.9844069649
0.9834029208
1.014458182
1.063837521
1.064716054
1.040867092
1.102712252
1.085245294
1.084430639
1.086853592
1.086053189
1.103454582
1.128960392
1.129581595
1.117395808
1.147569071
1.139550057
1.138986702
1.14066314
1.140108962
1.148075319
0.9729428374
0.9748553622
1.029382884
0.8276383992
0.9074943849
0.9056179193
0.9114644226
0.9094424313
0.8293873363
0.6356526579
0.6364082278
0.7365039818
0.4235069575
0.5306692659
0.530526898
0.5311721083
0.5308893521
0.4231150917
0.2257025305
0.2243877185
0.3197719924
0.08265942562
0.141627059
0.1429576293
0.1392784448
0.1405047486
0.08192967812
0.09182902987
0.09081740256
0.06761440638
0.2056418131
0.1454685655
0.1461694885
0.1440609248
0.1448145671
0.2053619203
0.323831399
0.3239247977
0.2653374985
0.4387008504
0.3815758271
0.3813733763
0.3819429336
0.3817723063
0.4389861419
0.5516297981
0.5521302114
0.4955735737
0.6631790886
0.6081208189
0.6074986672
0.6093266958
0.6087318001
0.6639076867
0.7670557293
0.7679897404
0.7166498996
0.8623494972
0.816697003
0.8156943026
0.8186776429
0.8176919638
0.8633904535
0.9422244435
0.9432934792
0.9046209737
1.009492163
0.9782550339
0.9772060878
0.9803355972
0.9792984771
1.010498407
1.060262882
1.06116449
1.037079031
1.099685072
1.08195189
1.081115172
1.083609949
1.082783631
1.100449652
1.126431132
1.12706955
1.11463181
1.145508497
1.137273384
1.136694915
1.138419413
1.137848243
1.146028304
0.9658230183
0.9675288338
1.022503493
0.821391797
0.9003745542
0.898747018
0.9038098424
0.9020624931
0.8228604405
0.6332800874
0.6337770988
0.731802733
0.4256263078
0.5304165797
0.5305085997
0.5304300676
0.5304091352
0.4250546002
0.2311157887
0.2296088059
0.323865286
0.08623707226
0.1467650977
0.1482997726
0.1441303301
0.1455621539
0.08545433746
0.09539688768
0.09442402329
0.07048139783
0.2066927946
0.1479509482
0.1485841863
0.1467585737
0.1474201106
0.2064813226
0.3233220448
0.3234480275
0.265463637
0.4374250842
0.3806710759
0.3804302717
0.38114608
0.3809214593
0.4377671485
0.5495041022
0.5500470334
0.4939085283
0.6601611997
0.6055729596
0.6049179683
0.6068648123
0.6062242081
0.6609283039
0.7632594655
0.764214601
0.7132225149
0.858130188
0.8126546978
0.8116341027
0.8146856036
0.8136724038
0.8591910677
0.9379092477
0.9389922762
0.9003167458
1.005421564
0.9740358167
0.9729727711
0.9761528803
0.9750960732
1.006444648
1.05661581
1.05753276
1.03320928
1.096583724
1.07858068
1.077728522
1.080274224
1.079429375
1.097364721
1.123843074
1.124494773
1.111798708
1.143400447
1.134941348
1.134350971
1.136113383
1.135528835
1.143931177
0.9594331926
0.9609826593
1.016208172
0.816145059
0.894187779
0.8927301859
0.8971697159
0.895647101
0.8173723444
0.6317421729
0.632045563
0.7280813697
0.4283590882
0.5309300716
0.5312125672
0.5305965122
0.5307839407
0.4277107961
0.2369498996
0.2352305724
0.3284364568
0.09020136079
0.1523273917
0.1540856253
0.1495070689
0.1511459812
0.08940905848
0.09874243475
0.09775600906
0.07353635164
0.2075799244
0.1501074685
0.1507220776
0.149061844
0.1496796995
0.2074158837
0.3227206583
0.3228644422
0.2654786356
0.4360146185
0.3796452517
0.3793797831
0.3801650549
0.379913962
0.4363771271
0.5472611204
0.5478364053
0.4921052265
0.6570604369
0.602929105
0.6022467014
0.6042558854
0.6035916552
0.6578348963
0.7594169196
0.7603866247
0.7097284933
0.8538729164
0.8085690433
0.80753766
0.810612127
0.8095889346
0.8549358805
0.9335636516
0.9346539859
0.8959764025
1.001307052
0.9697766014
0.9687059555
0.971908212
0.9708424186
1.002337446
1.052923535
1.053849838
1.029291616
1.093429044
1.075156348
1.074294541
1.076873566
1.076016465
1.094221967
1.121211683
1.121871585
1.10891389
1.141254365
1.132565589
1.131968069
1.13375812
1.133163598
1.141794445
0.9533202365
0.9552674303
1.010559931
0.8118354091
0.8888983874
0.8871008369
0.8913903393
0.8899395666
0.8126543288
0.6308197141
0.6310468063
0.7252417062
0.4314586605
0.5319931792
0.5325653748
0.5313991809
0.5317668659
0.4308708357
0.2434611701
0.2410190432
0.3332334455
0.094493654
0.158127297
0.1605945889
0.1552079403
0.1571043538
0.09374749107
0.1021455396
0.1008801055
0.0767773042
0.2083934965
0.1520518956
0.1528277397
0.1511004507
0.151726735
0.2082577753
0.3220709568
0.322291327
0.2654823464
0.4346207144
0.3786332404
0.3782355573
0.3791268699
0.3788291906
0.434891111
0.5448244403
0.5456709744
0.4903323261
0.6540726216
0.6003663187
0.5993722324
0.6016130024
0.6008670227
0.6546582765
0.7553284246
0.7566904293
0.7063644565
0.849738919
0.804611429
0.8031859485
0.8065426828
0.8054585701
0.850639126
0.9289540788
0.9304159923
0.8917499283
0.9972588796
0.9656013222
0.9641795092
0.9676512965
0.9665471453
0.998186245
1.049003135
1.050198985
1.025422602
1.090279605
1.071749425
1.070648406
1.073433403
1.072555324
1.091032164
1.118425525
1.119237169
1.106024774
1.139090084
1.130174036
1.129450989
1.131363297
1.130764064
1.139630356
0.04787787481
0.04970475949
0.04860657637
0.05294766587
0.05180258093
0.04947066245
0.07444919352
0.07609427567
0.07497640335
0.07949014831
0.07815863395
0.07624306134
0.05445745029
0.05632551465
0.05507756332
0.0600047253
0.05826397032
0.05620304315
0.3835136159
0.4316169258
0.4280502798
0.4249970922
0.4349520352
0.3869232561
0.1077464656
0.1095852543
0.1073596114
0.08082060671
0.08316114454
0.08188705712
0.08686584101
0.08540374537
0.08331246784
0.3248088778
0.3743736517
0.3703810401
0.3819276279
0.3780858381
0.3286019735
0.2614753916
0.312450061
0.3082279895
0.3209360388
0.3166954177
0.2656043074
0.4121047635
0.3664399628
0.3708447519
0.1576739053
0.1619729447
0.1690250955
0.1474117521
0.1545765946
0.1511064302
0.1623895402
0.1582261996
0.1504504217
0.1646362331
0.2150430562
0.2107087184
0.2236243572
0.2187749256
0.168939797
0.3194530309
0.2694900324
0.2748206057
0.05334908371
0.05261358576
0.06852288588
0.02230702819
0.03745432516
0.0415672705
0.04182673359
0.03980739392
0.02335297187
0.01829201972
0.02547234221
0.02382992684
0.0288172702
0.02755876723
0.01985981953
0.07967906428
0.1008484656
0.09527120462
0.1906981026
0.2114212772
0.1986871427
0.2314267364
0.2193627672
0.2063594432
0.1628043742
0.174742503
0.1686726229
0.1896322274
0.1822011555
0.1678671114
0.03805265553
0.04975669894
0.04979152954
0.05767031378
0.05287696107
0.0411976777
0.07781655529
0.06341384636
0.06738051807
0.06041613944
0.05281276034
0.06182458255
0.03702095639
0.0446495735
0.05143921795
0.03606492471
0.03951879617
0.03209670689
0.0545834349
0.060447153
0.06756608231
0.04583101783
0.05280289148
0.04677680827
0.06528036351
0.05809266378
0.05194086042
0.0767849267
0.0697029129
0.07155834323
0.06681876158
0.06782803072
0.07455498353
0.05466725222
0.06122419033
0.05953909977
0.2447327198
0.2599133587
0.2647455155
0.2878639518
0.2761699686
0.2784925856
0.2116569443
0.212987302
0.2285171306
0.09641884679
0.09033484502
0.09335081392
0.08426360842
0.08721041421
0.09273476871
0.07615346834
0.08188600678
0.07852410801
0.3639084346
0.3770622064
0.3862872813
0.3710577569
0.3691083313
0.3607251183
0.3921079175
0.3861714951
0.3764709649
0.3203921158
0.3159262807
0.3052462859
0.3431496841
0.3335215737
0.3304671604
0.3413765343
0.3349318945
0.3487472295
0.3766557038
0.3678425668
0.3817536384
0.3513816759
0.3635463206
0.3626775286
0.1264267476
0.1213911096
0.1242006587
0.1127651334
0.1158528393
0.12192371
0.107666275
0.1110697597
0.10700307
0.4427713186
0.4440810032
0.4577017155
0.4340794653
0.4338880138
0.4365250243
0.4371781028
0.4424887741
0.4269510292
0.4113216582
0.412374066
0.4081252784
0.4256148915
0.425310078
0.4099107106
0.4459220814
0.4329772679
0.4376838765
0.3548158
0.4037994165
0.4001275569
0.4108422508
0.4072130487
0.3584791874
0.159778314
0.1582293073
0.1335523578
0.03948762698
0.04902518935
0.04766121328
0.05186897123
0.05034787217
0.04112594379
0.4315168023
0.4276014858
0.4260199525
0.4367054329
0.4308193105
0.4305431506
0.4282706397
0.4296568904
0.4356306557
0.4444484667
0.4368928636
0.4444413683
0.4289796498
0.4302588729
0.4361152307
0.4438257412
0.4381824296
0.435251982
0.2935394079
0.344441196
0.3411589255
0.3512441039
0.3468035641
0.2973877501
0.1071958066
0.1049026953
0.08248671278
0.1305253893
0.1343915438
0.1464716792
0.09936201798
0.1231896506
0.12160636
0.1150997333
0.1185453213
0.1328243844
0.0757108504
0.09723358561
0.09328357267
0.1051708451
0.1014758848
0.07982440106
0.4114034517
0.4159910876
0.4085273052
0.4433143235
0.4320941817
0.4295149929
0.4424817197
0.4351538554
0.4490758388
0.4328212594
0.4265032457
0.4271131001
0.4275599064
0.4265666249
0.4351717726
0.3995294997
0.4098696359
0.4093747176
0.2281198211
0.2784039341
0.2747712261
0.2869180017
0.2829523537
0.2327777749
0.3791649547
0.3323504854
0.3364458293
0.02847802865
0.02620166263
0.009916239531
0.231033528
0.1033812015
0.1196274157
0.05119397341
0.05294797725
0.08360320068
0.01851838865
0.03047706493
0.02777688941
0.03269977182
0.04638847592
0.04440031027
0.06809516762
0.06803771767
0.07113683191
0.05967831917
0.06310390824
0.06281888844
0.1571351294
0.1472558609
0.157152608
0.1279474299
0.1349246146
0.1418267383
0.04168496936
0.04371403872
0.04278822571
0.0465954629
0.04559356252
0.04330703432
0.04716853322
0.04511154426
0.04421151231
0.2907379618
0.2873524562
0.2331334714
0.3237209622
0.329821636
0.3219207026
0.3337173867
0.3357145088
0.3294572345
0.2810090319
0.2883874525
0.2795322643
0.3109461407
0.2989333809
0.2947161097
0.2439783149
0.2978501882
0.2942319171
0.1223686127
0.1488867666
0.1469957492
0.1521060737
0.1504668653
0.1238985079
0.09974683693
0.1281689634
0.1267231709
0.1311161735
0.1296317499
0.1008454973
0.1858468732
0.1584775188
0.1603068764
0.1477632876
0.1765421645
0.1744247697
0.1708792142
0.1786072356
0.1496845184
0.128218319
0.1553403606
0.1536206132
0.1586297259
0.1569300014
0.1296986653
0.0672625831
0.07162826319
0.07009778674
0.0721085117
0.07284422361
0.06855112721
0.05411591083
0.05385944147
0.03944995257
0.06715555524
0.06907856377
0.06890339249
0.067170982
0.06781063209
0.06436632796
0.04391686567
0.05653382388
0.05617719229
0.0527174951
0.05188694691
0.05261894657
0.06172001625
0.06568666327
0.06633757103
0.06125744016
0.0636674011
0.05963748122
0.0406341271
0.0553229425
0.05618953414
0.06003721895
0.06528489145
0.063229276
0.06829797775
0.066485578
0.06176775556
0.3971267402
0.4059632433
0.4223083472
0.3864370769
0.4020119367
0.4006657816
0.1483959241
0.1500158154
0.1773454747
0.09553001432
0.1224980774
0.1211243887
0.1252975179
0.1238940348
0.09656819676
0.033767901
0.04371312505
0.04243087054
0.04633961802
0.04509703295
0.03532036478
0.09796904703
0.1000696816
0.09814206888
0.1047816783
0.102782917
0.1019613698
0.1084979281
0.1076567175
0.1096580971
0.1035155217
0.1057596975
0.1062395854
0.08022005863
0.1032062604
0.1007530719
0.05967959967
0.05895386606
0.04625278276
0.05510567898
0.07153028698
0.06761724993
0.08858033433
0.09096770453
0.08928154405
0.09541847081
0.09358004686
0.09192892708
0.1328428911
0.1311144139
0.1063530513
0.1255664821
0.1502348826
0.1485596066
0.3399441963
0.3893735265
0.3855510791
0.3966567358
0.3929423794
0.3436692075
0.1450875873
0.1248068093
0.1274141054
0.1204231038
0.1225123763
0.1438436959
0.07353802745
0.09707722663
0.09568033077
0.375336493
0.3800000498
0.4209193006
0.2778077051
0.3293198701
0.3251425259
0.3374224878
0.3334347031
0.2818101129
0.107144489
0.1265379384
0.1232554721
0.1307765018
0.1292748163
0.1114961357
0.09164752651
0.112762443
0.1094414464
0.1200094672
0.1168991436
0.09590801025
0.1395903817
0.135670089
0.1320354924
0.006046571359
0.006465202604
0.003729999601
0.03655399361
0.01218793166
0.0143738704
0.3071733972
0.3103266613
0.3585888424
0.2100905455
0.2604503673
0.257603514
0.2696696444
0.2670887454
0.2170415981
0.01240514365
0.01390312732
0.01531769643
0.008918819285
0.01387535695
0.0121214309
0.1320141807
0.1425129449
0.1313681591
0.1002997939
0.1142661424
0.1223767136
0.05194051989
0.05671390745
0.05010242808
0.06772195103
0.0619985319
0.05780313597
0.07145165579
0.06660526908
0.07259201611
0.05333087735
0.05010875746
0.05403101703
0.03861631904
0.04535952754
0.04829560009
0.2195932879
0.2363731372
0.2508918189
0.2264737156
0.2290677937
0.2181284449
0.2592575213
0.2482481125
0.2418816284
0.1717257796
0.1706579212
0.1597347022
0.1994788507
0.1881649165
0.1870164034
0.191192804
0.1871688579
0.2022378551
0.1409713058
0.1458068469
0.1414037583
0.02874689414
0.03605029226
0.03452953395
0.03931897639
0.03758756627
0.03045197128
0.1167330515
0.1002021963
0.09968856962
0.09324162079
0.09554975594
0.1146930076
0.06256037708
0.0781484696
0.07541499283
0.1188530685
0.131658632
0.1330418241
0.1088417258
0.1195548397
0.1163066023
0.1251713168
0.1208868948
0.1120865628
0.1441394397
0.1341699765
0.137662303
0.09001119674
0.08462089333
0.07822523426
0.1010586886
0.0934670455
0.09898194
0.08500693505
0.08978521359
0.09867808314
0.0258901217
0.02522327373
0.02234079929
0.03153292131
0.02854928533
0.02890741186
0.02850778852
0.02765356226
0.0310228374
0.03689998773
0.03843949091
0.03851524178
0.04110555182
0.04027038008
0.03802235433
0.1287075016
0.1286288572
0.1206535754
0.127676611
0.1239362865
0.1303342062
0.1292926077
0.1324010725
0.1307727924
0.117386207
0.1160201311
0.09581235159
0.1161203961
0.1178638947
0.1169460702
0.1144723906
0.1139949417
0.1142882527
0.1242456581
0.125018245
0.1239429718
0.121374753
0.1204548997
0.1220895646
0.1052000012
0.1205916874
0.1194261127
0.02510167211
0.03227952749
0.03066419967
0.03612260653
0.03330704435
0.02710331055
0.02381793343
0.0212824997
0.02564225113
0.01512374609
0.01791357
0.02047543341
0.01486549042
0.01636660138
0.01318282714
0.02317550553
0.02758811017
0.02527089035
0.01573554069
0.01990802284
0.01924618523
0.02295401738
0.02108884638
0.01701796292
0.03055605591
0.02515242376
0.02655564538
0.0220835055
0.02514193287
0.02710151997
0.01866679547
0.02115058208
0.0188388219
0.02647141587
0.02493026859
0.02144718999
0.01171940446
0.01466939457
0.01442254961
0.01697203052
0.01548421021
0.01269741416
0.02190667307
0.0184638446
0.01984123792
0.01983968718
0.02092852326
0.02025229244
0.02272122927
0.02202120202
0.0208592202
0.01191884124
0.01147407328
0.01018690525
0.01466200184
0.01387991263
0.01362765104
0.01908901681
0.01881651305
0.0180905165
0.04509269901
0.05487226856
0.05311786436
0.05999005901
0.05594899708
0.04731056218
0.08873904643
0.1108622219
0.1089454818
0.0350100451
0.04264436683
0.04067070562
0.04716852906
0.04375253589
0.03744411738
0.1195659436
0.1372796546
0.1363502435
0.1379676358
0.1378270849
0.1228104317
0.08727776795
0.08846563207
0.09305697343
0.07734875551
0.08175653297
0.08031623563
0.1134918962
0.1136688149
0.1186468934
0.1005639763
0.1054415908
0.1037470247
0.01987774871
0.02121361962
0.01920955917
0.02717616135
0.02533266555
0.02617386152
0.01529634307
0.01778658511
0.01858509706
0.1135329355
0.1416338263
0.1397203581
0.1453939608
0.1430270029
0.1163653067
0.1622291058
0.1643099884
0.1906277565
0.1044211333
0.134200199
0.1326291208
0.1377244943
0.1358787148
0.1059450701
0.1407195524
0.168979842
0.1671824136
0.1726036635
0.1707230788
0.1424072308
0.1342594869
0.1620001451
0.1602411858
0.1654619918
0.1636810659
0.1358280367
0.04143858311
0.05464135591
0.05437764052
0.05588720191
0.05565402561
0.04307432198
0.04922390645
0.05522254744
0.05441925965
0.05721941245
0.05836172425
0.0443223399
0.02769797931
0.03836088333
0.03730206695
0.04098669751
0.03990283495
0.02902708075
0.06045655882
0.05001001548
0.04916944011
0.03922903652
0.03766353255
0.02887333536
0.04421092243
0.04376570559
0.05596716995
0.03374276375
0.04245532844
0.04084544797
0.02680834798
0.0336777986
0.03226170887
0.1101334163
0.1317464896
0.1305013584
0.134935946
0.1335121246
0.1125206945
0.09707620579
0.1197527062
0.1196831622
0.1279419521
0.1267806701
0.1048046992
0.02235465473
0.02306491523
0.03209196943
0.01412776519
0.01739088694
0.01611466362
0.4729690222
0.4509921641
0.4426537764
0.3652621666
0.4419475379
0.4531160533
0.0986992954
0.04360249422
0.05077075203
0.03085462712
0.0397954107
0.09033506864
0.006495091823
0.01024645473
0.0106544489
0.09388635017
0.09129716753
0.07570734068
0.00685812358
0.00821154466
0.008957338031
0.006768033791
0.007329612513
0.006305457524
0.01038173868
0.01125808525
0.01082736006
0.007170858639
0.008727740345
0.008476423414
0.009974116677
0.009261242802
0.007757354365
0.01248540981
0.0106573725
0.01187360449
0.00881262847
0.009401379906
0.008776618429
0.005322671933
0.006425495511
0.006445504817
0.007453724071
0.00701038757
0.005719878296
0.1390764254
0.1625640869
0.1612145157
0.1201285485
0.1185469062
0.09541321011
0.02013621661
0.01893559753
0.01459836023
0.02381375914
0.01953837285
0.01915618034
0.01819417079
0.01852741982
0.02222404264
0.04273493761
0.04181510813
0.04293830093
0.04889270694
0.06132222412
0.06045255413
0.06686820977
0.06572259619
0.05389276975
0.1121894021
0.1366118687
0.1347082476
0.1469866792
0.145315578
0.1210410754
0.05395231988
0.05017822784
0.04279350794
0.09332732078
0.09195622617
0.0532020094
0.02525361949
0.02387656068
0.01766027536
0.01330222241
0.01382007962
0.01308340644
0.01337891154
0.01519109098
0.0141161105
0.05717595534
0.06503311226
0.0700567129
0.1396853771
0.1415588956
0.1381935011
0.02408627915
0.02718889191
0.02896341765
1.155566616
1.155573387
1.156026419
1.155650818
1.155630128
1.156048782
1.155971255
1.15584698
1.155863136
1.156387461
1.156039058
1.155925562
1.143849852
1.157083273
1.156753636
0.8935886811
0.9610779336
1.064190534
0.7142133232
0.7733939185
0.8410378239
0.5938874996
0.654576302
0.69502933
0.5289610119
0.5816411838
0.6047954917
0.4963461514
0.5454591156
0.5539397489
0.4905407487
0.5388793796
0.5382515393
0.5100850509
0.5572218795
0.5452203177
0.5503344326
0.5987173085
0.5777950004
0.6171457087
0.6674204579
0.636301232
0.706308268
0.7675940388
0.7221411291
0.8274816924
0.8823840334
0.8282339691
0.9819577737
1.025715356
0.9564152839
1.155219989
1.161327511
1.119891597
1.158769945
1.164389049
1.163710758
1.161473108
1.166660096
1.16616384
1.163449121
1.168267273
1.167929229
1.164771213
1.169289667
1.16909331
1.165498645
1.169790286
1.169721818
1.165687705
1.169825322
1.169870332
1.165403399
1.169455853
1.169596599
1.164724056
1.16875277
1.168969944
1.163730901
1.167786958
1.168062733
1.162497663
1.166621024
1.16694062
1.161084128
1.165305054
1.165657198
1.15953487
1.163876408
1.164253024
1.157881462
1.162361507
1.162757022
1.156146465
1.160779307
1.161189674
1.154345826
1.159144055
1.159566344
1.152492695
1.15746644
1.157898409
1.150597959
1.155754727
1.156194572
1.148670743
1.154019113
1.15446296
1.146726146
1.152285583
1.152712588
0.07808257905
0.06666623072
0.07546764468
0.3967430029
0.4046897304
0.4314872883
0.07732745895
0.09566168684
0.2126441694
0.0857876623
0.05663247573
0.05576456761
0.05850670523
0.05770591195
0.07768190451
0.07062418045
0.07222791643
0.07128776747
0.06758554255
0.06761912508
0.06930575965
0.1988456857
0.1933780982
0.1891150722
0.07742397786
0.08195489489
0.07017771241
0.06502972664
0.07462471948
0.07460569181
0.08922277032
0.1035144603
0.1035138177
0.07389850022
0.08527093954
0.09222908711
0.08618915565
0.07677269431
0.06705052998
0.07591058356
0.08302179058
0.07714203585
0.0669024541
0.06479159992
0.07329378745
0.1438746319
0.1395709122
0.1417203152
0.1303333406
0.1328489402
0.1393475561
0.4661740187
0.4317424968
0.4490794024
0.1762745893
0.1698489368
0.1650364059
0.4490559724
0.4506670887
0.4687657137
0.4449761219
0.462235296
0.4392818969
0.4821386767
0.504977759
0.4638662128
0.1469757089
0.1970806472
0.2084390664
0.2033678009
0.1743887489
0.171469781
0.3211226718
0.307033233
0.3175670513
0.2912319897
0.3003795467
0.3113034354
0.1156853991
0.1149090035
0.1113464463
0.2154236947
0.2216995102
0.2289306424
0.198778951
0.1938734967
0.1971594724
0.03468621128
0.04063540948
0.04045817953
0.2653803389
0.2590045934
0.2463141277
0.2096705743
0.2005068749
0.1875237076
0.2295252511
0.2162270998
0.2239192349
0.446480884
0.4388926338
0.4554319787
0.4375291629
0.4494015417
0.442296156
0.4630233645
0.4712365815
0.5012850024
0.4580854623
0.477465254
0.4517664471
0.01102013344
0.02357450009
0.02733517355
0.03830512192
0.03168096477
0.02055645623
0.05286325671
0.04774527465
0.03566347837
0.29651227
0.2755709163
0.2837165999
0.0749617296
0.07443361705
0.07711317606
0.06179830997
0.06487763788
0.0640071306
0.1632133969
0.1509439348
0.1416825193
0.1737284755
0.162036649
0.1746456062
0.1334183187
0.120655153
0.1193744364
0.1335443285
0.1260290318
0.1436371133
0.148033861
0.1483740863
0.1579335573
0.02865123127
0.03302947485
0.03530327398
0.03279080847
0.03025598929
0.02571509114
0.4435378614
0.4571297912
0.3245389848
0.4585875374
0.4768404161
0.469053223
0.1112531655
0.1577221735
0.1460984825
0.2307413467
0.2724293057
0.2492809436
0.08192439732
0.07444923825
0.06837194705
0.1762223013
0.1882039912
0.1807828259
0.03296764097
0.03056348726
0.02841249963
1.15528703
1.155193572
1.155113797
1.155457382
1.155328219
1.155390986
1.155853004
1.155853478
1.156013828
1.155155356
1.154933052
1.154894434
1.155024759
1.154956
1.155138719
1.156443769
1.156200326
1.156618725
1.155646707
1.155134738
1.155326838
1.154936703
1.155016233
1.155451671
1.069844857
1.157613346
1.098817345
1.157027277
1.156201273
1.156568088
1.155551444
1.15585015
1.156589714
0.8593173774
0.9454361641
0.8571498894
1.001966382
1.106640004
1.049689075
1.157023557
1.119579534
1.032206924
0.706938223
0.7588554831
0.6886963188
0.8813390372
0.9737292021
0.9418550167
1.034092042
0.9898896432
0.9034245408
0.6136697243
0.6444081772
0.5785368114
0.8114878673
0.8908165164
0.8762383367
0.9274835329
0.9054498608
0.8269196484
0.558932716
0.5744152192
0.5185849788
0.7869331423
0.8519132149
0.8518462163
0.8657562513
0.8609859248
0.789690033
0.542580713
0.544450713
0.4948248139
0.7846509672
0.8390538199
0.8486197423
0.8425540235
0.8476878193
0.7802723896
0.544756345
0.5375519653
0.4935561885
0.800404847
0.8454538438
0.8622554471
0.8402262
0.8535745455
0.7883981999
0.5750038546
0.5585580791
0.5214783073
0.833737785
0.8684725497
0.8936705721
0.8544662821
0.8745402651
0.8107543449
0.6303441197
0.6028506995
0.5715021488
0.8853495727
0.9165624848
0.9490518331
0.8857429815
0.9162507403
0.8537437293
0.7135156651
0.6751428279
0.6473013775
0.9448826294
0.9770880588
1.018906826
0.9438013699
0.982781411
0.9051212591
0.8226961136
0.7746884409
0.7468007692
1.044667499
1.057966613
1.113519949
1.011395614
1.060139969
0.9923962211
0.9500084211
0.8893886368
0.8812035428
1.155749558
1.16065712
1.160451113
1.111971055
1.160788677
1.125439816
1.112328441
1.031687583
1.046464479
1.15419225
1.159701084
1.159360939
1.160247927
1.159972504
1.154619995
1.162968992
1.162183036
1.156191585
1.152213335
1.158288685
1.157873392
1.159039159
1.158659559
1.152742133
1.16561315
1.165030107
1.159516354
1.149951764
1.156599252
1.156157741
1.157433145
1.157027816
1.150514818
1.167541266
1.16712662
1.162030397
1.147530298
1.154822599
1.154332921
1.155732868
1.155260518
1.148145881
1.168847244
1.16858188
1.163837707
1.144946433
1.15293478
1.152404495
1.15388766
1.153378362
1.145607288
1.169601514
1.169470947
1.165006757
1.142059397
1.150880253
1.150291563
1.151937228
1.151380977
1.142818149
1.169862482
1.1698528
1.16559489
1.13860156
1.148529406
1.147827709
1.149754868
1.149113242
1.139530379
1.169686847
1.169782162
1.165659248
1.134268291
1.145705138
1.144875259
1.14718048
1.146421294
1.135443487
1.169141461
1.169322818
1.165268658
1.128826562
1.1423499
1.141356164
1.144098935
1.143189171
1.130291436
1.168298517
1.168547093
1.164503435
1.1222354
1.138403605
1.137257809
1.140451415
1.139376781
1.123969891
1.167225564
1.167524882
1.163443791
1.114833518
1.133924306
1.132666699
1.136221902
1.135014301
1.116720839
1.165979197
1.166316255
1.162160452
1.107128822
1.1290615
1.127734156
1.131531281
1.130233181
1.109050693
1.164602966
1.164968156
1.160709333
1.099475101
1.123965116
1.122604379
1.126534265
1.125185282
1.101362284
1.163128487
1.163515046
1.159131447
1.092049642
1.118760095
1.11739349
1.121370158
1.120002248
1.093870749
1.161577975
1.161981169
1.15745579
1.084930937
1.113542431
1.11219128
1.116148174
1.114785612
1.086671322
1.159967892
1.160384167
1.155703065
1.078162568
1.108389963
1.107071157
1.110954411
1.109616258
1.079813068
1.158310663
1.158737185
1.153888024
1.071774362
1.103365427
1.1020911
1.105859457
1.104561312
1.073328528
1.15661518
1.157049904
1.152023555
1.065777728
1.098510176
1.097285591
1.100916969
1.099670368
1.067235705
1.154887384
1.155329289
1.150119342
1.060159845
1.093842732
1.092645021
1.096157941
1.094982255
1.061525194
1.153127375
1.153579086
1.148183014
1.055005553
1.089440869
1.087932016
1.091597152
1.090454392
1.056117258
1.15128916
1.151801534
1.146227506
0.07302773127
0.08828761515
0.09161479318
0.07845133087
0.07740953014
0.06726136793
0.1070831851
0.1023864684
0.09094582334
0.04129576575
0.04009759842
0.03548475854
0.00957880089
0.00419941244
0.0003746005169
0.009507884989
0.004166387204
0.0003746895187
0.021028484
0.008054589622
0.000421837165
0.009222517239
0.00306186456
0.000562836845
0.01126000775
0.007500496692
0.0005948469951
0.02114162969
0.008028929231
0.000425508336
0.01081372116
0.007266477634
0.0005621585999
0.01041862176
0.005829889576
0.0005940497383
0.007020688336
0.001544159082
0.000301497043
0.009195321533
0.003161014429
0.0005479529747
0.003722782927
0.005642621879
0.000493064235
0.01016224007
0.004407836826
0.0003717386447
0.01024997046
0.004416542706
0.0003722419054
0.01016021328
0.004399970109
0.0003715691031
0.01012554945
0.004473019153
0.0003707488022
0.009918314056
0.004287314031
0.0003719552781
0.01076773342
0.006859379607
0.0005546770785
0.009681340542
0.004420641432
0.0003723465908
0.001092508276
0.0002107702263
0.009549180259
0.004072094316
0.0003742699878
0.008994290125
0.005468418841
0.0009842158666
0.005100882608
0.007142965776
0.0006658818676
0.005091188197
0.007278727319
0.0006734979937
0.005208957105
0.007692790799
0.0006830155897
0.008252506725
0.008012918116
0.0006722362368
0.007823703467
0.008183806964
0.0006801137941
0.008344377874
0.008094002222
0.0006709881718
0.00878168481
0.007767830833
0.0006612716336
0.01965929956
0.007338365744
0.0004114933322
0.01973629027
0.007408121512
0.0004144691735
0.01110248964
0.00648222935
0.0005553210493
0.01069082368
0.006060275773
0.0005721905613
0.01104646525
0.007412687808
0.0006001690476
0.01121153537
0.007499063555
0.0005974260429
0.01142898364
0.007480995118
0.0005779270159
0.02257744376
0.008673484923
0.0004445747826
0.02224232308
0.008534065319
0.0004400591975
0.01101086956
0.00485016316
0.0003737518165
0.01069940251
0.004667421035
0.000374468673
0.01081896064
0.004761415192
0.0003740311494
0.01096863994
0.00483541712
0.0003737572188
0.01086816007
0.004780855836
0.0003739303285
0.01026646199
0.004425881707
0.0003724044158
0.0103549145
0.004520950064
0.0003719978494
0.01063848871
0.00461961583
0.0003746261088
0.01049056444
0.004409238311
0.0003746221428
0.01040607805
0.004529181453
0.0003720974503
0.01047299707
0.004451754145
0.000373615683
0.01003277648
0.004460537896
0.0003715954468
0.01009981357
0.004475198551
0.0003708747643
0.01141338838
0.007096004775
0.0005611636462
0.009989267971
0.004425242599
0.0003720949068
0.00988752073
0.004226532381
0.0003727680163
0.0112302752
0.006738138768
0.0005541580002
0.0107042629
0.006585674196
0.0005552018811
0.009261051351
0.003807343117
0.0003729470138
0.005085576878
0.006557754503
0.0006363289972
0.005216123704
0.005877085154
0.000579319741
0.005116761225
0.006360927835
0.0006196500773
0.005292614881
0.005652760147
0.0005642366583
0.005421903697
0.008081934972
0.0006983079361
0.005298727495
0.0077334525
0.0006869901051
0.005585296921
0.008114446906
0.0006956156316
0.007225477069
0.008492146429
0.0006923161701
0.007662852971
0.008342855398
0.000685677153
0.007097096119
0.00848333087
0.0006921847329
0.008873475741
0.007784463543
0.0006582967876
0.009208749553
0.007955757797
0.0006451222169
0.009749868584
0.007386611767
0.0006363959071
0.009367418388
0.007810417954
0.000645616719
0.009640711476
0.007470145227
0.0006377517851
0.01075696838
0.007506947514
0.000580999152
0.01134142387
0.00687716063
0.0005586043819
0.009690801645
0.00433203274
0.000373146351
0.009706581814
0.004371220597
0.0003724670434
0.009633020393
0.004214415784
0.0003737445854
0.009641718078
0.004184832713
0.0003735901825
0.009535173386
0.004188710149
0.0003742319906
0.009509413324
0.004122873724
0.0003745758786
0.02036982926
0.007602418988
0.0004192667384
0.01029094696
0.006149858006
0.0005659216317
0.009317427276
0.003049641929
0.0005716779371
0.01124455572
0.007498704466
0.0005954663785
0.02455475997
0.00958683187
0.000477504435
0.02479931736
0.009852283056
0.0004884647587
0.0240869888
0.009333128363
0.0004669950823
0.02338752498
0.009058601364
0.0004569251314
0.02148388034
0.008178232373
0.0004305720735
0.01147180068
0.007176981687
0.0005615584655
0.009573704259
0.00420784058
0.0003743275838
0.009599074857
0.004253932372
0.000374069751
0.01031606356
0.00574213275
0.0005881073986
0.009593716047
0.004239305413
0.0003741013772
0.009589303186
0.004290229658
0.0003738851628
0.009738605568
0.005555039624
0.0006180447297
0.007184852325
0.002653671294
0.0003448502362
0.0099908815
0.00730561452
0.0006070994338
0.01054604847
0.007543733684
0.0005912099358
0.01129848361
0.00771349894
0.0005929881303
0.005798360737
0.006056994054
0.001948200515
0.01020735129
0.00444235064
0.0003717360424
0.01022859378
0.004436245773
0.0003719203924
0.01015383977
0.004433022998
0.0003711774885
0.01013723381
0.004462627121
0.000370850177
0.01089104845
0.007033446398
0.0005604728219
0.01138059839
0.006925261982
0.0005592562525
0.009923531458
0.004347017754
0.0003711369591
0.00973225263
0.004379615113
0.0003721190592
0.009753927134
0.004376174115
0.0003714803432
0.009702459314
0.004405708542
0.0003717428344
0.009701085457
0.004294122876
0.0003725889012
0.009565248963
0.004346859908
0.0003732815733
0.009546739615
0.004200360948
0.0003741317719
0.008516466959
0.005561593106
0.0008465652244
0.008556007006
0.005463628889
0.0009157890107
0.005094746004
0.007014825367
0.0006596018805
0.005075028307
0.006833688192
0.0006564077953
0.005139569094
0.007425706013
0.0006775906155
0.005117918257
0.007581907529
0.0006864415894
0.008093872076
0.008187065199
0.0006779280826
0.007923793107
0.008275425191
0.0006788328534
0.008521149148
0.008019410854
0.0006678535353
0.008643626145
0.007824917754
0.0006660607167
0.02007832433
0.007490735079
0.0004171700885
0.01104326423
0.006407366763
0.0005555910647
0.01059248889
0.006056181747
0.0005677376703
0.004767564685
0.00542063811
0.0005343499611
0.006505249472
0.003804356229
0.0005618509012
0.007129939091
0.003597183044
0.0005628571898
0.01123082297
0.007540649846
0.0005967654452
0.01156450568
0.007581595774
0.0005772208909
0.01079768268
0.007495441368
0.0005766934816
0.01154011966
0.007549036571
0.0005768543692
0.02582108653
0.01053405288
0.0005162359266
0.02528973097
0.01013899592
0.0004997730122
0.02763786835
0.01151358176
0.0005875686481
0.02629723464
0.01080450748
0.0005328505264
0.02667332611
0.01099243731
0.0005515489546
0.0230039428
0.008893555491
0.0004512354891
0.02172362568
0.008253862546
0.0004345733306
0.01104534052
0.004856705673
0.0003737489946
0.01073432616
0.004707892256
0.0003742636445
0.01079076822
0.004740413023
0.0003741553176
0.01094126095
0.004818531037
0.0003738163398
0.01089630914
0.004799654218
0.0003739118014
0.01035573768
0.004502392204
0.0003720459833
0.01059934067
0.004563327171
0.0003748288803
0.01050233769
0.004447202407
0.0003750145133
0.01041878345
0.004520555727
0.0003722344979
0.01045633859
0.004503138598
0.0003728255375
0.0100518389
0.004470114144
0.0003712601019
0.01007939115
0.004469463322
0.0003710933036
0.01145519333
0.007095841762
0.0005611025931
0.00995990105
0.004368354711
0.0003725431571
0.009881917283
0.004254300043
0.0003730861658
0.01115286021
0.006621286022
0.0005557046074
0.01122626149
0.006694817385
0.0005553385671
0.009667921948
0.004405684312
0.0003720677192
0.009654918323
0.004349384165
0.0003730518299
0.0101662249
0.005761291404
0.0005865295242
0.00953756243
0.004211969605
0.0003738248374
0.01009418147
0.005545801515
0.0006281239106
0.01005600337
0.003340546217
0.0003661028703
0.005158147679
0.006135360907
0.0006117946084
0.005166901358
0.006265020668
0.000611191563
0.005369123552
0.005510130934
0.0005512661021
0.005423750319
0.007949172467
0.0006924190144
0.005294234227
0.007861071056
0.0006929500572
0.005610685765
0.00818567361
0.0007001691844
0.005727976647
0.008225828358
0.0006991059761
0.007396265663
0.008357500582
0.0006859656715
0.007488811231
0.008425145537
0.000686243853
0.007000867825
0.008414586447
0.0006914212609
0.006848636267
0.008436415001
0.0006983933507
0.009149589881
0.007747147379
0.0006487819716
0.009791670776
0.007291533607
0.000632472009
0.009459174706
0.007544209601
0.000644151631
0.009577933316
0.007485365743
0.0006423052533
0.01138005156
0.007477066811
0.0005949323442
0.01138664429
0.007642646227
0.0005942312423
0.01138639099
0.007783828419
0.000592253799
0.0002331070366
0.01084974855
0.00743137527
0.0005727292468
0.0114044841
0.007398441484
0.0005715315753
0.002989889046
0.003068613862
0.0009698496905
0.002777969945
0.002311225526
0.000665853475
0.00288249407
0.002229532077
0.000555196242
0.01857659554
0.006970344386
0.0004057309156
0.01833785478
0.006903526239
0.0004040536843
0.01677628864
0.006393261844
0.000393756312
0.01146823916
0.007195330815
0.0005637947384
0.01076589314
0.006169875234
0.0005610770633
0.01080076325
0.006146124676
0.0005613910903
0.01100836667
0.00763722396
0.0005999637649
0.01105848121
0.007770159902
0.0005993825294
0.01521588803
0.005944318824
0.0003865820154
0.01653549555
0.006314290757
0.0003930150522
0.01316422532
0.005456935693
0.0003782896233
0.01400077558
0.005678419587
0.0003806601358
0.01504563742
0.005915398063
0.0003859397529
0.01411045235
0.005690201223
0.0003811419941
0.01311041108
0.005459204202
0.0003774508453
0.01264789132
0.005484673932
0.0003734181993
0.01257472072
0.005479743879
0.0003732312865
0.008432875099
0.004523343634
0.0008059152981
0.006576253506
0.003950813848
0.0004879564948
0.01062488074
0.007330656433
0.0006043349773
0.01056219082
0.007371881251
0.0006061701404
0.0100497313
0.0102805383
0.001098131049
0.008256094286
0.00805853936
0.001567113303
0.01151180294
0.007282473175
0.0005700613806
0.01070890475
0.006857436372
0.0005566360765
0.009877840221
0.004370478937
0.0003709505322
0.01129066456
0.006844192579
0.0005543974986
0.009873300384
0.004370829598
0.0003711624875
0.009766694642
0.00424695643
0.0003722534071
0.008889199699
0.005433543672
0.0007520506308
0.004937972919
0.0005244429564
0.009345074507
0.005483828618
0.000782369766
0.006180424229
0.008451541364
0.000704737673
0.005737912897
0.008394366385
0.0007074031054
0.005922740723
0.008407287288
0.0007034101505
0.006222055089
0.008642830577
0.0007065936116
0.006783737091
0.008415968866
0.0006975708559
0.006620608485
0.00848159599
0.0007041697568
0.0113165738
0.007462498119
0.0005813037899
0.01214828876
0.01228720487
0.0009408375507
0.02450848131
0.0123198523
0.0006667177183
0.01767927897
0.006718419484
0.000398706564
0.01739851242
0.00658574196
0.0003977784683
0.01081186438
0.00726767228
0.0005689460317
0.01028598584
0.0075056156
0.0006002211996
0.02729199877
0.01188655761
0.000624772287
0.01576529928
0.006119371425
0.0003887101856
0.01590192469
0.006121203294
0.000390447528
0.0135683872
0.005599851897
0.0003787487896
0.0136720329
0.005624849995
0.0003790496815
0.01468757599
0.005849106524
0.0003826388952
0.01451030167
0.00584037273
0.0003817145696
0.01291153277
0.005497529208
0.0003746447521
0.012839538
0.005498176149
0.0003742066188
0.01233036534
0.005451493975
0.000372993007
0.01241022547
0.005457849307
0.0003730679048
0.01032202251
0.004463468596
0.0003722236827
0.00976655393
0.004364995413
0.0003704797777
0.009758092772
0.004373359383
0.0003711545565
0.00978048568
0.004353928504
0.0003705007495
0.009762794242
0.004207544176
0.0003722761527
0.01001330881
0.005921809598
0.0005794650827
0.009307256517
0.005471603786
0.0006654438076
0.009204641224
0.005529159026
0.0006445519795
0.00789908941
0.003346598036
0.0005181432813
0.007326386287
0.0034357684
0.0005024446978
0.009025687487
0.007760716986
0.0006515643192
0.01076913606
0.007496396073
0.0006022367124
0.01145894024
0.007550105841
0.0005871448934
0.01151747582
0.007583966991
0.0005797036455
0.0114574104
0.007512541592
0.0005873542931
0.004452183457
0.004769831116
0.00204838237
0.01155785036
0.00756211526
0.0005734775129
0.01158164705
0.007445915975
0.0005696782705
0.0189208817
0.007114534081
0.0004069211416
0.01933719237
0.007216821457
0.0004085636881
0.0181208239
0.006842701
0.0004020938034
0.01705198471
0.006541776717
0.0003948650299
0.01150657867
0.007210436072
0.0005652568652
0.01044900728
0.006245482298
0.0005578589059
0.008842484971
0.003297796568
0.0005694920857
0.01095008692
0.007511681309
0.0005980219444
0.01106824891
0.007637178301
0.0006006607593
0.01044987635
0.00747808038
0.0006014645378
0.01539395316
0.006000616452
0.0003870737913
0.0163312313
0.0062499841
0.0003924968863
0.01334150165
0.005540569604
0.0003783658883
0.0138775166
0.005654066525
0.0003799893245
0.01488696565
0.005857694931
0.0003851062517
0.0142784928
0.005700429168
0.0003815096181
0.01305502596
0.005497448393
0.0003762033303
0.0126999777
0.00548700431
0.0003735945729
0.01228196025
0.005436258519
0.000372958082
0.01221493333
0.005429161057
0.0003729593798
0.01252174287
0.005467942329
0.0003731711877
0.01130678044
0.004884902912
0.0003748269536
0.01135434285
0.004899988103
0.0003750683653
0.0117071908
0.005166321248
0.0003740669621
0.01167886766
0.005183456933
0.0003739361575
0.01216121095
0.005423110331
0.0003728970699
0.01213407661
0.005431003779
0.0003729754358
0.01176191059
0.005157149164
0.0003743294076
0.01180360458
0.005142532875
0.0003745752819
0.01127722287
0.004899142947
0.0003744491923
0.01122043388
0.004904165249
0.0003742069929
0.009697221788
0.005708893703
0.0006065750365
0.008631127263
0.005874549701
0.001081201942
0.008528656394
0.003145068707
0.0005407489458
0.006751850029
0.00366981619
0.0004844592388
0.006281717543
0.00420727821
0.0004878411476
0.00614157077
0.004382679109
0.0004874138848
0.01002076813
0.007350350335
0.0006244360208
0.00974810075
0.007396652834
0.0006279645861
0.01068032592
0.00732038622
0.0006051151973
0.01009141134
0.007246248171
0.0006239135741
0.01017634398
0.007165655991
0.0006212108582
0.003835793401
0.00346358494
0.0004791194354
0.01145433227
0.007467973098
0.000574080633
0.01159094405
0.00759907078
0.0005725386132
0.0115608745
0.007397477095
0.0005710088339
0.009905313511
0.004373301871
0.0003709584319
0.01132980608
0.006916194907
0.0005522373433
0.01129040764
0.006992481342
0.0005527075493
0.009847868484
0.0043654991
0.0003712764559
0.009828493288
0.00433575068
0.0003717726654
0.009605717102
0.004218557976
0.000373384633
0.008764980044
0.005417333819
0.0007147030832
0.006086866935
0.008406767918
0.0007030040497
0.005983275472
0.008358964327
0.000705197674
0.006424362395
0.008548533793
0.0007020459052
0.006486960532
0.008564746058
0.0007030197196
0.01985861163
0.01293356841
0.0007217949192
0.01532717688
0.01358997138
0.0008033171811
0.01789316402
0.006774275645
0.0004001717095
0.0171725344
0.006527264077
0.0003965274194
0.01149110354
0.007216944172
0.0005656060502
0.01098563921
0.006358581834
0.0005532701429
0.01091821287
0.006352719281
0.0005563272861
0.01089580159
0.006305055387
0.0005543285317
0.01047307451
0.006349779813
0.0005555251467
0.005325334764
0.004381361547
0.00055244088
0.01086970198
0.007461946582
0.0006007212425
0.01560525029
0.006075478538
0.0003875982533
0.01607100049
0.006148423657
0.0003916619241
0.01344957626
0.005574850446
0.0003784594775
0.01378029868
0.005640628728
0.0003795087014
0.01473754827
0.005850907819
0.0003839492139
0.0144534292
0.005789357568
0.000381479263
0.01297052567
0.005495570649
0.0003752549452
0.01277874205
0.005491938006
0.0003738868011
0.01233687142
0.005440679906
0.000372993286
0.01244559792
0.005464724328
0.0003730964328
0.01148510821
0.00502581205
0.00037475809
0.0114181424
0.004958379953
0.0003749860081
0.01154416488
0.005093323956
0.0003744191404
0.01161480098
0.005161057218
0.0003741496034
0.01198480081
0.005332539742
0.0003739443614
0.0120606198
0.0053888532
0.0003733785017
0.01192658703
0.005245151747
0.0003744422139
0.01184553226
0.005167323006
0.0003746864895
0.01113197996
0.004877673194
0.0003740016566
0.01119022419
0.004891797283
0.0003740894063
0.0111390701
0.004864135053
0.0003738557969
0.01110129423
0.004858859345
0.000373779478
0.00976592393
0.004368835228
0.0003706958304
0.009744749741
0.004378232952
0.0003708435087
0.009783618903
0.004316872419
0.0003708918141
0.009779951147
0.004245620876
0.0003717005042
0.009729287832
0.005437881162
0.0006855625594
0.00821125747
0.005631238615
0.001098819135
0.008326422321
0.005675274592
0.001144963003
0.008298195509
0.003230788358
0.0005259745935
0.007081391188
0.003517438345
0.0005017086731
0.005769550464
0.004740851272
0.0005018352363
0.005921934879
0.004542285088
0.000488735274
0.005633489576
0.004992679065
0.0005256845823
0.005516477978
0.005260272915
0.0005413389421
0.01071344894
0.007348843423
0.0006010095162
0.01029620629
0.007249993979
0.000614586393
0.01024251849
0.007237297791
0.0006179031415
0.01036244265
0.00721392217
0.0006132140054
0.01039502025
0.007197574574
0.0006107905454
0.01129953352
0.007435510253
0.000589381095
0.01065374784
0.007417395242
0.0005932870482
0.01150897156
0.007591670969
0.0005803307425
0.01153127712
0.007685487162
0.0005801807663
0.01144408684
0.007440681482
0.0005868329132
0.0106781621
0.007412875597
0.0005851809374
0.003094381693
0.002465337609
0.0004989529324
0.0008574472699
)
;
boundaryField
{
topAndBottom
{
type calculated;
value nonuniform List<scalar>
72
(
1.155885497
1.155887961
1.155131114
1.155149445
1.154341173
1.154397572
1.15353675
1.153651735
1.152698947
1.152882861
1.151872051
1.152103886
1.151020595
1.151290212
1.150238848
1.150486379
1.149503426
1.149728185
1.148925389
1.149123041
1.148476198
1.148716615
1.148235027
1.148590821
1.148138648
1.148722646
1.148245674
1.149123657
1.148426689
1.149663135
1.1487374
1.150359265
1.149016022
1.151028543
1.149351874
1.151710444
1.149581049
1.152281618
1.149843276
1.152804518
1.149967726
1.153179139
1.150141565
1.15351236
1.150170561
1.153687597
1.150285952
1.153852272
1.15025388
1.153853111
1.150350956
1.153881134
1.150292338
1.153738556
1.150401769
1.153663294
1.15034181
1.153413791
1.150475506
1.153262098
1.150432182
1.152949253
1.150580434
1.152728102
1.15057476
1.152411006
1.150707017
1.152090028
1.150764001
1.151852296
1.150953274
1.15139238
)
;
}
inlet
{
type calculated;
value nonuniform List<scalar>
40
(
1.15625
1.15625
1.15625
1.15625
1.15625
1.15625
1.15625
1.15625
1.15625
1.15625
1.15625
1.0969502
1.020361686
1.046700696
1.15625
1.15625
1.15625
1.15625
1.15625
1.15625
1.15625
1.15625
1.15625
1.15625
1.15625
1.15625
1.15625
1.15625
1.15625
1.15625
1.044414318
1.021319531
1.098693548
1.15625
1.15625
1.15625
1.15625
1.15625
1.15625
1.15625
)
;
}
outlet
{
type calculated;
value nonuniform List<scalar>
62
(
1.150953274
1.152379361
1.156007577
1.162039404
1.158519638
1.154632549
1.152320178
1.15139238
1.008658278
0.8103752015
0.7243070421
0.4328275743
0.3352740254
0.09638134203
0.07818495906
0.2087271195
0.2654944592
0.4340712541
0.4896360608
0.6529217583
0.7050910344
0.8482733414
0.8902723891
0.9958981559
1.024138724
1.089276622
1.105119134
1.138448392
1.166629257
1.167906966
1.165126548
1.154047155
1.12760101
1.053263543
1.145656483
1.157842693
1.162226563
1.163695112
1.163243513
1.161650305
0.9533202365
0.8871008369
0.6308197141
0.5325653748
0.2434611701
0.1605945889
0.1021455396
0.1528277397
0.3220709568
0.3782355573
0.5448244403
0.5993722324
0.7553284246
0.8031859485
0.9289540788
0.9641795092
1.049003135
1.070648406
1.118425525
1.129450989
1.087932016
1.15128916
)
;
}
wing
{
type nutkWallFunction;
Cmu 0.09;
kappa 0.41;
E 9.8;
value nonuniform List<scalar>
378
(
0.0006976344104
0.0001857837666
0.0001858306327
0.0001911179374
0.000286248435
0.0002390035913
0.0001912461012
0.0002118618192
0.0001671516974
0.0001397708215
0.0002799349978
0.0002975036721
0.0001827147709
0.0001827661645
0.0001827032335
0.0001828112836
0.0001828696075
0.0001996453656
0.0001854436122
8.473340526e-05
0.0001859591856
0.0001405786682
0.0002901757404
0.0002917097373
0.0002935960754
0.0002812778895
0.0002847415528
0.0002806255449
0.0002760183067
0.000189836324
0.0001900749727
0.0001924785029
0.0001753525868
0.0002420955854
0.000241205328
0.0002259624847
0.0001929347027
0.0001926376246
0.0001836648324
0.0001836045201
0.0001836769732
0.000183677051
0.0001836808864
0.0001828114982
0.0001828939135
0.0001835344721
0.0001831337856
0.0001829135372
0.0001830050104
0.0001830504813
0.0001828775923
0.0002089200141
0.0001830885837
0.0001828814439
0.0001980845885
0.0001941106833
0.0001849575504
0.0002826426181
0.0002704173536
0.000279046178
0.0002670464859
0.0002958124804
0.0002939538635
0.0002948999891
0.000289534721
0.0002866619058
0.000289849966
0.000274928809
0.0002712363965
0.0002642624424
0.0002703561534
0.000265513427
0.0002271494884
0.0002051458061
0.0001842354682
0.0001841233476
0.0001841940015
0.0001841968442
0.0001856394853
0.0001858652738
0.0001908159724
0.0001785922156
0.0002907325821
0.0002396828082
0.0001954645476
0.0001963907999
0.0001947684528
0.0001939288701
0.0001916665567
0.0002108766089
0.000184839557
0.000184848518
0.0001683723505
0.0001849146872
0.0001850459019
0.000162056532
0.0001683307995
0.0002507150165
0.0002379675614
0.0002383733622
0.0002207069345
0.0001827455143
0.0001827473301
0.0001827215252
0.0001827582335
0.0002076432553
0.0002062378172
0.0001828969572
0.000184053807
0.0001838919511
0.0001844868514
0.0001843256179
0.0001856325387
0.0001860377242
0.0001459264785
0.0001427961452
0.0002888979867
0.0002877518978
0.0002925028024
0.0002944930456
0.0002833230932
0.0002842065827
0.0002792695916
0.0002778043441
0.0001904345674
0.0001910907422
0.0001765143477
0.0003027187685
0.0003019944276
0.0002997495338
0.0002405754832
0.0002255117146
0.0002239346898
0.0002248120151
0.000198304356
0.0001971644476
0.0002020566286
0.0001989124248
0.0001997437529
0.000193566681
0.0001919882273
0.0001836590518
0.0001836392614
0.0001836710032
0.0001836913299
0.0001836976897
0.0001828920373
0.0001834567002
0.0001832931197
0.0001829101336
0.0001829611572
0.0001829887056
0.0001829396247
0.0002098556737
0.0001830634267
0.0001829653972
0.0001957391206
0.000197062774
0.0001846564289
0.0001847957593
0.0001706249006
0.000185001665
0.0001600672237
0.0001809871379
0.000278389461
0.0002779369616
0.0002642487566
0.0002947049303
0.0002949753894
0.0002955120675
0.0002950139928
0.0002876249888
0.0002874149709
0.0002898160453
0.0002916320984
0.0002719389822
0.0002625125681
0.0002686088418
0.0002671828238
0.0002363690767
0.000237361979
0.0002379791631
6.908229427e-05
0.0002206798335
0.0002196940534
0.0002528468532
0.0002663812998
0.0002746246644
0.0001890686203
0.0001887732465
0.0001872843267
0.0002128241655
0.000181629486
0.0001800725475
0.0002451234821
0.0002448718455
0.0001855409558
0.0001870735266
0.000183178429
0.0001841269381
0.000185339366
0.00018424515
0.0001829774076
0.0001828267138
0.0001828645888
9.666948107e-05
0.0002508037317
0.0002490258587
0.0002500857305
0.0002107620735
0.0002132785835
0.0002171012364
0.0002036548007
0.0001829831941
0.0002023204063
0.0001830661392
0.0001831067139
0.0001484961752
6.370064536e-05
0.0001469689338
0.0002952861291
0.0002968771378
0.0002957870272
0.0002959115869
0.0002919637992
0.0002938750488
0.0002293088512
0.0002103753266
0.000205449901
0.0001881120258
0.0001879028452
0.000216011911
0.0002464049318
0.0002034167206
0.0001860716848
0.0001863081018
0.0001836243037
0.0001837332896
0.0001847664868
0.0001846897555
0.0001827642568
0.0001827566385
0.0001831149777
0.0001830503179
0.0001828671659
0.0001833735446
0.0001837673076
0.0001832670913
0.0001830628715
0.0001731733784
0.0001551974832
0.0001576189993
0.0002645650222
0.0002578110572
0.0002729901178
0.0002472739511
0.0002331178235
0.0002288889828
0.00023243237
0.0002350944839
0.0002218416497
0.0002188743761
0.0001893367983
0.0001895682686
0.0001885318942
0.0001874408672
0.0002138758165
0.0001832362544
0.0002966213034
0.000244853948
0.0002443526839
0.000243292209
0.0001857621204
0.0001868485406
0.0001833710209
0.0001839782501
0.0001851230447
0.0001844391368
0.0001828569713
0.0001827875354
0.0001832715308
0.00018337771
0.0001829210061
0.000183720316
0.0001837759826
0.0001837643605
0.000183805787
0.0001834542499
0.0001835698965
0.0001837518284
0.0001837355755
0.0001836828369
0.0001836692299
0.0001649910213
0.0001276887321
0.000274331807
0.0002501094528
0.0002507020717
0.0002502298368
0.0002595432263
0.0002611219592
0.00024838085
0.0002582957735
0.0002566194201
0.0002895613302
0.0002228572821
0.000222337661
0.0002182486791
0.0001829593383
0.0002013667296
0.0002007555734
0.0001831037529
0.0001831609432
0.0001851584188
0.0001505217201
0.0002949725245
0.0002957312722
0.0002945450396
0.0002943036991
0.0002078085695
0.0002083959945
0.0001883183746
0.0001876472459
0.0002146519988
0.0001860809402
0.0001851490536
0.0001873450441
0.0001892137082
0.0003032433409
0.0002458178877
0.0001859336338
0.0001865678798
0.0001834935327
0.0001838585991
0.0001849167048
0.000184608424
0.0001828029269
0.0001827723547
0.0001831854594
0.0001829751285
0.0001838550868
0.0001838261405
0.0001838626046
0.000183861299
0.0001837232494
0.0001836649267
0.0001837543634
0.000183747272
0.0001836461199
0.0001836564277
0.0001836397889
0.0001836513491
0.0001835130086
0.000183627358
0.0001831610211
0.0001830906405
0.0001532652167
0.0001388861799
0.0001347437507
0.0002690152376
0.000255536727
0.0002523160545
0.0002496666053
0.0002582567105
0.0002622202663
0.0002471103951
0.0002541042252
0.0002553793043
0.0002530289578
0.0002518106038
0.0002338284782
0.0002350998532
0.0002279386394
0.0002286336082
0.0002314959604
0.0002304456385
0.0002836581702
0.0001025535399
)
;
}
front
{
type empty;
}
back
{
type empty;
}
}
// ************************************************************************* //
| [
"ishantamrakat24@gmail.com"
] | ishantamrakat24@gmail.com | |
dfc5df8138c7aaac5bb8ceb50a6727393d9beaaf | acbdcc4cf40949f5701f65828761a06b9e86c7a0 | /Single Number II.cpp | 23005f540098e06840c0e238d251b53bdc4bb40f | [] | no_license | JaySinghTalreja/Leetcode-Daily | 2b0bdeb103344bd698e850e87a9de575f71d60c6 | 2a2370272563caa553845909eae6bb1a7cee49ae | refs/heads/master | 2023-03-30T21:10:14.126505 | 2020-12-14T12:00:40 | 2020-12-14T12:00:40 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 455 | cpp | class Solution {
public:
int singleNumber(vector<int>& nums) {
unsigned int finalCount = 0;
for(int i=0;i<32;i++) {
int count = 0;
for(auto var : nums) {
if(var & (1<<i)) {
count++;
}
}
finalCount<<1;
if(count%3 != 0) {
finalCount |= (1<<i);
}
}
return finalCount;
}
};
| [
"noreply@github.com"
] | noreply@github.com |
fec587aec478019835159cf326c069f939d39379 | 0d05c22e94372d2c9f32763aeeca82347eb3cb0f | /CS32/project3/StudentWorld.cpp | a1d98576e86169f33bb1a5a130c5ff85e7afe1ee | [] | no_license | rlchung/UCLA-Undergraduate-Coursework | cc4c1f1a25f3d6bdf5fc84a9cd77a76db697f137 | 7f366ae96d921b8cf045efc3fcbdd2fff99636c9 | refs/heads/master | 2021-01-23T07:15:38.308311 | 2017-01-31T08:14:46 | 2017-01-31T08:14:46 | 80,494,057 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,540 | cpp | #include "StudentWorld.h"
#include "GameConstants.h"
#include "Level.h"
#include "Actor.h"
#include <vector>
#include <iostream>
#include <sstream>
#include <iomanip>
#include <string>
using namespace std;
GameWorld* createStudentWorld()
{
return new StudentWorld();
}
StudentWorld::StudentWorld()//INITIALIZES DATA MEMBERS NEEDED THROUGHOUT THE GAME
{
num_level = 0;
}
StudentWorld::~StudentWorld()//FREES ANY REMAINING DYNAMICALLY ALLOCATED DATA
{
delete p1;
while (!v1.empty())
{
delete v1.back();
v1.pop_back();
}
}
int StudentWorld::init()
{
//INITIALIZE DATA AND LOAD LEVEL 00
ostringstream oss;
oss.fill('0');
oss << setw(2) << num_level;
string str_num_level = oss.str();
string curLevel = "level" + str_num_level + ".dat";
Level::LoadResult result = lev.loadLevel(curLevel);//Load current Level
if (result == Level::load_fail_file_not_found)
{
cout << "NO FIRST LEVEL FOUND\n";
return GWSTATUS_NO_FIRST_LEVEL;
}
else if (result == Level::load_fail_bad_format)
{
cout << "Your level was improperly formatted\n";
return GWSTATUS_LEVEL_ERROR;
}
else if (result == Level::load_success)
{
cout << "Successfully loaded level\n";
num_bonus = lev.getOptionValue(optionLevelBonus);
//DEPLOYED NUMBER OF SPRAYS ON SCREEN IS 0
num_deployed = 0;
//Set Number of Zumis to 0
num_zumi = 0;
//Set levelFinished to False
levelFinished = false;
for (int x = 0; x < 15; x++)
{
for (int y = 0; y < 15; y++)
{
Level::MazeEntry item = lev.getContentsOf(x, y);
if (item == Level::player) //ALLOCATE AND INSERT A PLAYER INTO THE GAME WORLD
{
p1 = new Player(this, x, y);
}
else if (item == Level::complex_zumi)
{
//Initiate complex zumi object
ComplexZumi * cz1 = new ComplexZumi(this, x, y);
num_zumi++;
v1.push_back(cz1);
}
else if (item == Level::simple_zumi)
{
//Initiate simple zumi object
SimpleZumi * sz1 = new SimpleZumi(this, x, y);
num_zumi++;
v1.push_back(sz1);
}
else if (item == Level::exit)
{
Exit * e1 = new Exit(this, x, y);
v1.push_back(e1);
}
else if (item == Level::perma_brick) //ALLOCATE AND INSERT PERMA_BRICKS
{
Brick * b1 = new Brick(this, IID_PERMA_BRICK, x, y);
v1.push_back(b1);
}
else if (item == Level::destroyable_brick) //ALLOCATE AND INSERT DESTROYABLE_BRICKS
{
Brick * b2 = new Brick(this, IID_DESTROYABLE_BRICK, x, y);
v1.push_back(b2);
}
}
}
}
return GWSTATUS_CONTINUE_GAME;
}
int StudentWorld::move()
{
//Updates the Game Status Line
setDisplayText();
p1->doSomething();//will handle if dead or alive
for (unsigned int i = 0; i < v1.size(); i++)
{
v1[i]->doSomething();
}
removeDeadActors();
//Decrement Bonus per tick
reduceLevelBonusByOne();
if (!p1->isAlive())
{
decLives();
return GWSTATUS_PLAYER_DIED;
}
if (getLevelFinished())
{
num_level++;
return GWSTATUS_FINISHED_LEVEL;
}
return GWSTATUS_CONTINUE_GAME;
}
void StudentWorld::cleanUp()
{
delete p1;
while (!v1.empty())
{
delete v1.back();
v1.pop_back();
}
}
void StudentWorld::setDisplayText()
{
int score = getScore();
int level = num_level;
int livesLeft = getLives();
ostringstream oss_score;
oss_score.fill('0');
oss_score << setw(8) << score;
string s_score = oss_score.str();
ostringstream oss_level;
oss_level.fill('0');
oss_level << setw(2) << num_level;
string s_level = oss_level.str();
ostringstream oss_bonus;
oss_bonus.fill(' ');
oss_bonus << setw(6) << num_bonus;
string s_bonus = oss_bonus.str();
ostringstream oss_lives;
oss_lives.fill('0');
oss_lives << setw(3) << livesLeft;
string s_lives = oss_lives.str();
string s = "Score: " + s_score + " Level: " + s_level + " Lives: " + s_lives + " Bonus: " + s_bonus;
setGameStatText(s);
}
void StudentWorld::removeDeadActors()
{
vector<Actor*>::iterator it;
it = v1.begin();
while (it != v1.end())
{
if (!(*it)->isAlive())
{
delete (*it);
it = v1.erase(it);
}
else {
++it;
}
}
}
void StudentWorld::reduceLevelBonusByOne()
{
if (num_bonus > 0)
num_bonus--;
}
Actor* StudentWorld::getActor(int x, int y) const
{
for (unsigned int i = 0; i < v1.size() ; i++)
{
if (v1[i]->getX() == x && v1[i]->getY() == y)
return v1[i];
}
return nullptr;
}
void StudentWorld::addActor(Actor *a)
{
v1.push_back(a);
}
void StudentWorld::getPlayerLocation(int& x, int& y) const
{
x = p1->getX();
y = p1->getY();
}
void StudentWorld::killPlayer()
{
p1->setDead();
} | [
"Richardchung93@gmail.com"
] | Richardchung93@gmail.com |
6dd3ef5818d23409df6200f973e6ec2ff3a274fb | a1273223cc5823d0198e6dc21a1a6247eb631182 | /datos_0.35-0.42.h.ino | 2da9d30ea384ef9436c63f6f7e59bc2701cfdfda | [] | no_license | Alexanderssf/Optativa-II | 3c32e018943445a5df679915dfaec234ba8c7504 | 48996116260ff799169462f5b16164ca6133aa0b | refs/heads/master | 2020-04-05T12:19:43.443995 | 2019-02-25T18:30:14 | 2019-02-25T18:30:14 | 156,865,428 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 402 | ino | float matriz[17][5]={
{4.8,3.4,1.6,0.2,1},
{4.8,3.4,1.9,0.2,1},
{5.0,3.0,1.6,0.2,1},
{5.5,3.5,1.3,0.2,1},
{4.8,3.0,1.4,0.3,1},
{4.6,3.2,1.4,0.2,1},
{6.1,2.9,4.7,1.4,2},
{5.6,2.5,3.9,1.1,2},
{6.1,2.8,4.7,1.2,2},
{6.4,2.9,4.3,1.3,2},
{6.3,2.3,4.4,1.3,2},
{5.5,2.5,4.0,1.3,2},
{6.3,2.7,4.9,1.8,3},
{6.3,2.7,4.9,1.8,3},
{6.3,3.4,5.6,2.4,3},
{6.3,2.5,5.0,1.9,3},
{6.2,3.4,5.4,2.3,3}};
| [
"noreply@github.com"
] | noreply@github.com |
49fb46bbec120c2baef7620385ebf178693e3eb1 | e20d6ac36bfc1233b5f3774237ed7b2369e03467 | /cpp_04/ex03/AMateria.hpp | 49a2618eb5165bcb986144108fbd97d9f4d58abe | [] | no_license | Medhrs101/CPP_42 | a9f9a746ebbf82892e79fbf80f89168f7f342b94 | eec0561cdfc693313c3a2e8ad4450f37c49687e0 | refs/heads/main | 2023-08-06T05:24:47.219525 | 2021-09-27T10:11:02 | 2021-09-27T10:11:02 | 403,364,503 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,305 | hpp | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* AMateria.hpp :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: moharras <moharras@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/08/30 16:15:29 by moharras #+# #+# */
/* Updated: 2021/09/01 16:32:31 by moharras ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef AMATERIA_HPP
#define AMATERIA_HPP
#include <iostream>
#include <string>
#include "ICharacter.hpp"
class ICharacter;
class AMateria
{
protected:
std::string _type;
public:
AMateria();
virtual ~AMateria();
AMateria(AMateria const& type);
AMateria& operator=(AMateria const&);
std::string const& getType() const;
virtual AMateria* clone() const = 0;
virtual void use(ICharacter& target);
};
#endif | [
"moharras@e1r2p14.1337.ma"
] | moharras@e1r2p14.1337.ma |
2ee901a4bab52931721469dfce93153b1b0a0fa0 | 01d7b500e0fc25c19c12312ab5b27f0fa8a959c5 | /InterFaceToService/ParamCommon.h | d0c863d7c46fc6e4e4e8fb2332a2ba7d298275ec | [] | no_license | zhangjianscc/ZMClient | 5c3e97387cafbdd2b97a6bc7f5123b366bb986de | 6efedd322ad350c68e50dd557ec17a8b70f0eecc | refs/heads/master | 2021-01-23T16:25:33.365432 | 2017-07-01T12:55:09 | 2017-07-01T12:55:09 | 93,285,205 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 602 | h | #ifndef PARAMCOMMON_H
#define PARAMCOMMON_H
#include <QObject>
#include <QJsonObject>
#include <QString>
class ParamCommon :public QObject
{
Q_OBJECT
Q_PROPERTY(QString account READ account WRITE setaccount)
Q_PROPERTY(QString password READ password WRITE setpassword)
public:
Q_INVOKABLE void setaccount(QString& account){m_account=account;}
Q_INVOKABLE void setpassword(QString& password){m_password=password;}
QString account(){return m_account;}
QString password(){return m_password;}
private:
QString m_account;
QString m_password;
};
#endif // PARAMCOMMON_H
| [
"yongge332@126.com"
] | yongge332@126.com |
6f5328784f23543880eab7eb1537562aa9eaf369 | 1185b0288f5e13236e8285fe24db45d3462754ea | /Activity.cpp | 8bbf89889433fd3346172e235ac4d02980ea2831 | [
"MIT"
] | permissive | PatrickLeonard/OregonActivities | ac31b0188f612c9af19f2d8e2d0121afd14b94e7 | eff0c02adf9f7eb2fc32639a7c3c8a193d20d62d | refs/heads/master | 2021-01-12T08:58:04.424258 | 2016-12-17T17:58:23 | 2016-12-17T17:58:23 | 76,738,650 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,578 | cpp | /****************************************************************************
* *
* Name: Patrick Leonard *
* Class: CS202 Professor Fant *
* Assignment: Program 2 *
* Date: 10-30-12 *
* Filename: Activity.cpp *
* *
* This file implements the Activity class. This class holds data on *
* activites that match the interests that the user selects in the main *
* application. This class is entirely about holding and displaying the *
* data. It has no getter fucnctions, but does have set and display *
* functions. It is in a 'has-a' relationship with the Link class and *
* is held by an array in the Link object. *
* *
* *
* *
* *
****************************************************************************/
#include "Activity.h"
//Default constructor, initialize char* pointers to null, and set them to default values since
//data needs to be provided for testing
Activity::Activity(): name(0), location(0),
price(0), equipment(0),
description(0)
{
name = arrayCopy("Random Activity");
location = arrayCopy("Somewhere in Oregon");
price = 99.95;
equipment = arrayCopy("Either none or expensive");
description = arrayCopy("Probably a pretty good time to be had if it suits your interests");
}
//Overlaoded constructor sets the member data to the input char* and float arguments
Activity::Activity(char inputName[], char inputLoc[], float cost, char inputEquip[], char inputDescr[])
{
name = arrayCopy(inputName);
location = arrayCopy(inputLoc);
price = cost;
equipment = arrayCopy(inputEquip);
description = arrayCopy(inputDescr);
}
//Frees all the dynamically allocated character arrays
Activity::~Activity()
{
delete [] name;
delete [] location;
delete [] equipment;
delete [] description;
}
//Copy constructor, makes deep copies of the member data using the arrayCopy member function
Activity::Activity(const Activity &source)
{
price = source.price;
name = arrayCopy(source.name);
location = arrayCopy(source.location);
equipment = arrayCopy(source.equipment);
description = arrayCopy(source.description);
}
//Displays the member data of the Activity object in a nicely formatted manner
void Activity::displayActivity()
{
std::cout << "\nActivity Name: " << name << " Location: " << location << std::endl;
std::cout << "Required Equipment: " << equipment << " Price: $";
std::cout << std::fixed << std::setprecision(2) << price << std::endl;
std::cout << "Description: " << description << "\n" << std::endl;
}
//Sets the name member data, accepts a char array as argument
void Activity::setName(char input[])
{
name = arrayCopy(input);
}
//Sets the location member data, accepts a char array as argument
void Activity::setLocation(char input[])
{
location = arrayCopy(input);
}
//Sets the price member data, accepts a float as argument
void Activity::setPrice(float cost)
{
price = cost;
}
//Sets the equipment member data, accepts a char array as argument
void Activity::setEquipment(char input[])
{
equipment = arrayCopy(input);
}
//Sets the description member data, accepts a char array as argument
void Activity::setDescription(char input[])
{
description = arrayCopy(input);
}
//Creates a new char array and copies the input array into the char array
//returns a pointer to the char array of the proper size
char* Activity::arrayCopy(const char input[])
{
int length = 0; //Declare int variable to hold the length of the input array
length = strlen(input); //Get length and set to int variable
char* newString = new char[length + 1]; //Create new char array of size length
strcpy(newString, input); //Copy input string into new char array
return newString; //Return poiner to newly made array
}
| [
"patrickleonard789@gmail.com"
] | patrickleonard789@gmail.com |
b10dde37898425457d8641254cf6049fb8ba6278 | b15b1d8a9fea8a7d4c9e5d069bc483725d3e5efb | /src/janela2.cpp | ea4087557518e75aa02855952e2e6855ffdc35e9 | [] | no_license | lucasrm148/audiodescricao | 5849c5e4e10701400b29bf3a125d644dfea3552a | 43b3941e16e51ace7cdea45d307e983cf105dbeb | refs/heads/master | 2022-10-16T05:26:24.361238 | 2020-06-13T00:27:06 | 2020-06-13T00:27:06 | 265,967,230 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,380 | cpp | #include "header/janela2.h"
#include "ui_janela2.h"
#include "header/alert.h"
#include <QtMultimediaWidgets>
#include <QVideoWidget>
#include <QAudioRecorder>
#include <QFileDialog>
#include <QProcess>
#include <iostream>
using namespace std;
janela2::janela2(QWidget *parent,QString njanela ,QString filename, QString filelocal):
QDialog(parent),
ui(new Ui::janela2)
{
ui->setupUi(this);
form= new alert(this);
AudioRecorder = new QAudioRecorder(this);
QAudioEncoderSettings AudioSettings;
AudioSettings.setCodec("audio/wav");
AudioSettings.setQuality(QMultimedia :: HighQuality);
AudioRecorder->setOutputLocation(QUrl :: fromLocalFile(local));
AudioRecorder->setAudioSettings(AudioSettings);
filediretorio=filelocal;
filename="";
mMediaPlayer=new QMediaPlayer(this);
mVideoWidget = new QVideoWidget(this);
mMediaPlayer->setVideoOutput(mVideoWidget);
mVideoWidget->setGeometry(130,10,841,441);
mVideoWidget->setStyleSheet("* { background-color: rgb(50, 50, 50); }");
ui->teste->setText(njanela);
layout();
connect(mMediaPlayer,&QMediaPlayer::positionChanged,[&](qint64 pos ){
//ui->slide->setValue(pos);
ui->slide->setValue(pos);
});
connect(mMediaPlayer,&QMediaPlayer::durationChanged,[&](qint64 duracao){
ui->slide->setMaximum(duracao);
});
connect(ui->slide,&QSlider::sliderMoved,mMediaPlayer,&QMediaPlayer::setPosition);
mMediaPlayer->setMedia(QUrl::fromLocalFile(filename));
mMediaPlayer->setVolume(50);
}
janela2::~janela2()
{
delete ui;
}
int clicks=0;
void janela2::on_gravar_clicked()
{
if(clicks==0){
AudioRecorder->record();
clicks=1;
}else{
AudioRecorder->stop();
ListAudioLocal.insert(i,local);
ListAudioName+=name;
//ListAudioName.insert(i++,name);
listAudioDuration.insert(i++,AudioRecorder->duration());
AudioRecorder->setOutputLocation(QUrl :: fromLocalFile(local));
AudioRecorder->stop();
clicks=0;
}
}
void janela2::on_play_clicked()
{
mMediaPlayer->play();
}
void janela2::on_pause_clicked()
{
mMediaPlayer->stop();
}
void janela2::on_pushButton_clicked()
{
}
void janela2::on_espaso_clicked()
{
timer= new time1(this);
timer->show();
timer->exec();
QString space=timer->returnTime();
}
| [
"lucasrm148@gmail.com"
] | lucasrm148@gmail.com |
507d0cc7f2160add2c20642a0ddc6a1e8e994605 | 4be41ae28bd7d5cbff5ca173a88f113219d9ec75 | /python/google/protobuf/pyext/repeated_composite_container.cc | 16919066b225689d9dcef1d416cc62b3dc8dfb01 | [
"LicenseRef-scancode-protobuf"
] | permissive | YixuanBan/protobuf-310 | ef76fc3aaf88f690fe6e91dd5b1f658beb53814f | cf0110b5b8d476df7a9014b68bc9b1c9b53d9d49 | refs/heads/master | 2023-03-30T18:30:28.179733 | 2020-06-08T03:49:37 | 2020-06-08T03:49:37 | 270,517,595 | 0 | 0 | NOASSERTION | 2021-03-31T22:09:52 | 2020-06-08T03:43:15 | C++ | UTF-8 | C++ | false | false | 20,315 | cc | // Protocol Buffers - Google's data interchange format
// Copyright 2008 Google Inc. All rights reserved.
// https://developers.google.com/protocol-buffers/
//
// 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: anuraag@google.com (Anuraag Agrawal)
// Author: tibell@google.com (Johan Tibell)
#include <google/protobuf/pyext/repeated_composite_container.h>
#include <memory>
#include <google/protobuf/stubs/logging.h>
#include <google/protobuf/stubs/common.h>
#include <google/protobuf/descriptor.h>
#include <google/protobuf/dynamic_message.h>
#include <google/protobuf/message.h>
#include <google/protobuf/pyext/descriptor.h>
#include <google/protobuf/pyext/descriptor_pool.h>
#include <google/protobuf/pyext/message.h>
#include <google/protobuf/pyext/message_factory.h>
#include <google/protobuf/pyext/scoped_pyobject_ptr.h>
#include <google/protobuf/reflection.h>
#include <google/protobuf/stubs/map_util.h>
#if PY_MAJOR_VERSION >= 3
#define PyInt_Check PyLong_Check
#define PyInt_AsLong PyLong_AsLong
#define PyInt_FromLong PyLong_FromLong
#endif
namespace google2 {
namespace protobuf {
namespace python {
namespace repeated_composite_container {
// ---------------------------------------------------------------------
// len()
static Py_ssize_t Length(PyObject* pself) {
RepeatedCompositeContainer* self =
reinterpret_cast<RepeatedCompositeContainer*>(pself);
Message* message = self->parent->message;
return message->GetReflection()->FieldSize(*message,
self->parent_field_descriptor);
}
// ---------------------------------------------------------------------
// add()
PyObject* Add(RepeatedCompositeContainer* self, PyObject* args,
PyObject* kwargs) {
if (cmessage::AssureWritable(self->parent) == -1)
return NULL;
Message* message = self->parent->message;
Message* sub_message =
message->GetReflection()->AddMessage(
message,
self->parent_field_descriptor,
self->child_message_class->py_message_factory->message_factory);
CMessage* cmsg = self->parent->BuildSubMessageFromPointer(
self->parent_field_descriptor, sub_message, self->child_message_class);
if (cmessage::InitAttributes(cmsg, args, kwargs) < 0) {
message->GetReflection()->RemoveLast(
message, self->parent_field_descriptor);
Py_DECREF(cmsg);
return NULL;
}
return cmsg->AsPyObject();
}
static PyObject* AddMethod(PyObject* self, PyObject* args, PyObject* kwargs) {
return Add(reinterpret_cast<RepeatedCompositeContainer*>(self), args, kwargs);
}
// ---------------------------------------------------------------------
// append()
static PyObject* AddMessage(RepeatedCompositeContainer* self, PyObject* value) {
cmessage::AssureWritable(self->parent);
PyObject* py_cmsg;
Message* message = self->parent->message;
const Reflection* reflection = message->GetReflection();
py_cmsg = Add(self, nullptr, nullptr);
if (py_cmsg == nullptr) return nullptr;
CMessage* cmsg = reinterpret_cast<CMessage*>(py_cmsg);
if (ScopedPyObjectPtr(cmessage::MergeFrom(cmsg, value)) == nullptr) {
reflection->RemoveLast(
message, self->parent_field_descriptor);
Py_DECREF(cmsg);
return nullptr;
}
return py_cmsg;
}
static PyObject* AppendMethod(PyObject* pself, PyObject* value) {
RepeatedCompositeContainer* self =
reinterpret_cast<RepeatedCompositeContainer*>(pself);
ScopedPyObjectPtr py_cmsg(AddMessage(self, value));
if (py_cmsg == nullptr) {
return nullptr;
}
Py_RETURN_NONE;
}
// ---------------------------------------------------------------------
// insert()
static PyObject* Insert(PyObject* pself, PyObject* args) {
RepeatedCompositeContainer* self =
reinterpret_cast<RepeatedCompositeContainer*>(pself);
Py_ssize_t index;
PyObject* value;
if (!PyArg_ParseTuple(args, "nO", &index, &value)) {
return nullptr;
}
ScopedPyObjectPtr py_cmsg(AddMessage(self, value));
if (py_cmsg == nullptr) {
return nullptr;
}
// Swap the element to right position.
Message* message = self->parent->message;
const Reflection* reflection = message->GetReflection();
const FieldDescriptor* field_descriptor = self->parent_field_descriptor;
Py_ssize_t length = reflection->FieldSize(*message, field_descriptor) - 1;
Py_ssize_t end_index = index;
if (end_index < 0) end_index += length;
if (end_index < 0) end_index = 0;
for (Py_ssize_t i = length; i > end_index; i --) {
reflection->SwapElements(message, field_descriptor, i, i - 1);
}
Py_RETURN_NONE;
}
// ---------------------------------------------------------------------
// extend()
PyObject* Extend(RepeatedCompositeContainer* self, PyObject* value) {
cmessage::AssureWritable(self->parent);
ScopedPyObjectPtr iter(PyObject_GetIter(value));
if (iter == NULL) {
PyErr_SetString(PyExc_TypeError, "Value must be iterable");
return NULL;
}
ScopedPyObjectPtr next;
while ((next.reset(PyIter_Next(iter.get()))) != NULL) {
if (!PyObject_TypeCheck(next.get(), CMessage_Type)) {
PyErr_SetString(PyExc_TypeError, "Not a cmessage");
return NULL;
}
ScopedPyObjectPtr new_message(Add(self, NULL, NULL));
if (new_message == NULL) {
return NULL;
}
CMessage* new_cmessage = reinterpret_cast<CMessage*>(new_message.get());
if (ScopedPyObjectPtr(cmessage::MergeFrom(new_cmessage, next.get())) ==
NULL) {
return NULL;
}
}
if (PyErr_Occurred()) {
return NULL;
}
Py_RETURN_NONE;
}
static PyObject* ExtendMethod(PyObject* self, PyObject* value) {
return Extend(reinterpret_cast<RepeatedCompositeContainer*>(self), value);
}
PyObject* MergeFrom(RepeatedCompositeContainer* self, PyObject* other) {
return Extend(self, other);
}
static PyObject* MergeFromMethod(PyObject* self, PyObject* other) {
return MergeFrom(reinterpret_cast<RepeatedCompositeContainer*>(self), other);
}
// This function does not check the bounds.
static PyObject* GetItem(RepeatedCompositeContainer* self, Py_ssize_t index,
Py_ssize_t length = -1) {
if (length == -1) {
Message* message = self->parent->message;
const Reflection* reflection = message->GetReflection();
length = reflection->FieldSize(*message, self->parent_field_descriptor);
}
if (index < 0 || index >= length) {
PyErr_Format(PyExc_IndexError, "list index (%zd) out of range", index);
return NULL;
}
Message* message = self->parent->message;
Message* sub_message = message->GetReflection()->MutableRepeatedMessage(
message, self->parent_field_descriptor, index);
return self->parent
->BuildSubMessageFromPointer(self->parent_field_descriptor, sub_message,
self->child_message_class)
->AsPyObject();
}
PyObject* Subscript(RepeatedCompositeContainer* self, PyObject* item) {
Message* message = self->parent->message;
const Reflection* reflection = message->GetReflection();
Py_ssize_t length =
reflection->FieldSize(*message, self->parent_field_descriptor);
if (PyIndex_Check(item)) {
Py_ssize_t index;
index = PyNumber_AsSsize_t(item, PyExc_IndexError);
if (index == -1 && PyErr_Occurred()) return NULL;
if (index < 0) index += length;
return GetItem(self, index, length);
} else if (PySlice_Check(item)) {
Py_ssize_t from, to, step, slicelength, cur, i;
PyObject* result;
#if PY_MAJOR_VERSION >= 3
if (PySlice_GetIndicesEx(item,
length, &from, &to, &step, &slicelength) == -1) {
#else
if (PySlice_GetIndicesEx(reinterpret_cast<PySliceObject*>(item),
length, &from, &to, &step, &slicelength) == -1) {
#endif
return NULL;
}
if (slicelength <= 0) {
return PyList_New(0);
} else {
result = PyList_New(slicelength);
if (!result) return NULL;
for (cur = from, i = 0; i < slicelength; cur += step, i++) {
PyList_SET_ITEM(result, i, GetItem(self, cur, length));
}
return result;
}
} else {
PyErr_Format(PyExc_TypeError, "indices must be integers, not %.200s",
item->ob_type->tp_name);
return NULL;
}
}
static PyObject* SubscriptMethod(PyObject* self, PyObject* slice) {
return Subscript(reinterpret_cast<RepeatedCompositeContainer*>(self), slice);
}
int AssignSubscript(RepeatedCompositeContainer* self,
PyObject* slice,
PyObject* value) {
if (value != NULL) {
PyErr_SetString(PyExc_TypeError, "does not support assignment");
return -1;
}
return cmessage::DeleteRepeatedField(self->parent,
self->parent_field_descriptor, slice);
}
static int AssignSubscriptMethod(PyObject* self, PyObject* slice,
PyObject* value) {
return AssignSubscript(reinterpret_cast<RepeatedCompositeContainer*>(self),
slice, value);
}
static PyObject* Remove(PyObject* pself, PyObject* value) {
RepeatedCompositeContainer* self =
reinterpret_cast<RepeatedCompositeContainer*>(pself);
Py_ssize_t len = Length(reinterpret_cast<PyObject*>(self));
for (Py_ssize_t i = 0; i < len; i++) {
ScopedPyObjectPtr item(GetItem(self, i, len));
if (item == NULL) {
return NULL;
}
int result = PyObject_RichCompareBool(item.get(), value, Py_EQ);
if (result < 0) {
return NULL;
}
if (result) {
ScopedPyObjectPtr py_index(PyLong_FromSsize_t(i));
if (AssignSubscript(self, py_index.get(), NULL) < 0) {
return NULL;
}
Py_RETURN_NONE;
}
}
PyErr_SetString(PyExc_ValueError, "Item to delete not in list");
return NULL;
}
static PyObject* RichCompare(PyObject* pself, PyObject* other, int opid) {
RepeatedCompositeContainer* self =
reinterpret_cast<RepeatedCompositeContainer*>(pself);
if (!PyObject_TypeCheck(other, &RepeatedCompositeContainer_Type)) {
PyErr_SetString(PyExc_TypeError,
"Can only compare repeated composite fields "
"against other repeated composite fields.");
return NULL;
}
if (opid == Py_EQ || opid == Py_NE) {
// TODO(anuraag): Don't make new lists just for this...
ScopedPyObjectPtr full_slice(PySlice_New(NULL, NULL, NULL));
if (full_slice == NULL) {
return NULL;
}
ScopedPyObjectPtr list(Subscript(self, full_slice.get()));
if (list == NULL) {
return NULL;
}
ScopedPyObjectPtr other_list(
Subscript(reinterpret_cast<RepeatedCompositeContainer*>(other),
full_slice.get()));
if (other_list == NULL) {
return NULL;
}
return PyObject_RichCompare(list.get(), other_list.get(), opid);
} else {
Py_INCREF(Py_NotImplemented);
return Py_NotImplemented;
}
}
static PyObject* ToStr(PyObject* pself) {
ScopedPyObjectPtr full_slice(PySlice_New(NULL, NULL, NULL));
if (full_slice == NULL) {
return NULL;
}
ScopedPyObjectPtr list(Subscript(
reinterpret_cast<RepeatedCompositeContainer*>(pself), full_slice.get()));
if (list == NULL) {
return NULL;
}
return PyObject_Repr(list.get());
}
// ---------------------------------------------------------------------
// sort()
static void ReorderAttached(RepeatedCompositeContainer* self,
PyObject* child_list) {
Message* message = self->parent->message;
const Reflection* reflection = message->GetReflection();
const FieldDescriptor* descriptor = self->parent_field_descriptor;
const Py_ssize_t length = Length(reinterpret_cast<PyObject*>(self));
// Since Python protobuf objects are never arena-allocated, adding and
// removing message pointers to the underlying array is just updating
// pointers.
for (Py_ssize_t i = 0; i < length; ++i)
reflection->ReleaseLast(message, descriptor);
for (Py_ssize_t i = 0; i < length; ++i) {
CMessage* py_cmsg = reinterpret_cast<CMessage*>(
PyList_GET_ITEM(child_list, i));
reflection->AddAllocatedMessage(message, descriptor, py_cmsg->message);
}
}
// Returns 0 if successful; returns -1 and sets an exception if
// unsuccessful.
static int SortPythonMessages(RepeatedCompositeContainer* self,
PyObject* args,
PyObject* kwds) {
ScopedPyObjectPtr child_list(
PySequence_List(reinterpret_cast<PyObject*>(self)));
if (child_list == NULL) {
return -1;
}
ScopedPyObjectPtr m(PyObject_GetAttrString(child_list.get(), "sort"));
if (m == NULL)
return -1;
if (ScopedPyObjectPtr(PyObject_Call(m.get(), args, kwds)) == NULL)
return -1;
ReorderAttached(self, child_list.get());
return 0;
}
static PyObject* Sort(PyObject* pself, PyObject* args, PyObject* kwds) {
RepeatedCompositeContainer* self =
reinterpret_cast<RepeatedCompositeContainer*>(pself);
// Support the old sort_function argument for backwards
// compatibility.
if (kwds != NULL) {
PyObject* sort_func = PyDict_GetItemString(kwds, "sort_function");
if (sort_func != NULL) {
// Must set before deleting as sort_func is a borrowed reference
// and kwds might be the only thing keeping it alive.
PyDict_SetItemString(kwds, "cmp", sort_func);
PyDict_DelItemString(kwds, "sort_function");
}
}
if (SortPythonMessages(self, args, kwds) < 0) {
return NULL;
}
Py_RETURN_NONE;
}
// ---------------------------------------------------------------------
static PyObject* Item(PyObject* pself, Py_ssize_t index) {
RepeatedCompositeContainer* self =
reinterpret_cast<RepeatedCompositeContainer*>(pself);
return GetItem(self, index);
}
static PyObject* Pop(PyObject* pself, PyObject* args) {
RepeatedCompositeContainer* self =
reinterpret_cast<RepeatedCompositeContainer*>(pself);
Py_ssize_t index = -1;
if (!PyArg_ParseTuple(args, "|n", &index)) {
return NULL;
}
Py_ssize_t length = Length(pself);
if (index < 0) index += length;
PyObject* item = GetItem(self, index, length);
if (item == NULL) {
return NULL;
}
ScopedPyObjectPtr py_index(PyLong_FromSsize_t(index));
if (AssignSubscript(self, py_index.get(), NULL) < 0) {
return NULL;
}
return item;
}
PyObject* DeepCopy(PyObject* pself, PyObject* arg) {
return reinterpret_cast<RepeatedCompositeContainer*>(pself)->DeepCopy();
}
// The private constructor of RepeatedCompositeContainer objects.
RepeatedCompositeContainer *NewContainer(
CMessage* parent,
const FieldDescriptor* parent_field_descriptor,
CMessageClass* child_message_class) {
if (!CheckFieldBelongsToMessage(parent_field_descriptor, parent->message)) {
return NULL;
}
RepeatedCompositeContainer* self =
reinterpret_cast<RepeatedCompositeContainer*>(
PyType_GenericAlloc(&RepeatedCompositeContainer_Type, 0));
if (self == NULL) {
return NULL;
}
Py_INCREF(parent);
self->parent = parent;
self->parent_field_descriptor = parent_field_descriptor;
Py_INCREF(child_message_class);
self->child_message_class = child_message_class;
return self;
}
static void Dealloc(PyObject* pself) {
RepeatedCompositeContainer* self =
reinterpret_cast<RepeatedCompositeContainer*>(pself);
self->RemoveFromParentCache();
Py_CLEAR(self->child_message_class);
Py_TYPE(self)->tp_free(pself);
}
static PySequenceMethods SqMethods = {
Length, /* sq_length */
0, /* sq_concat */
0, /* sq_repeat */
Item /* sq_item */
};
static PyMappingMethods MpMethods = {
Length, /* mp_length */
SubscriptMethod, /* mp_subscript */
AssignSubscriptMethod, /* mp_ass_subscript */
};
static PyMethodDef Methods[] = {
{ "__deepcopy__", DeepCopy, METH_VARARGS,
"Makes a deep copy of the class." },
{ "add", (PyCFunction)AddMethod, METH_VARARGS | METH_KEYWORDS,
"Adds an object to the repeated container." },
{ "append", AppendMethod, METH_O,
"Appends a message to the end of the repeated container."},
{ "insert", Insert, METH_VARARGS,
"Inserts a message before the specified index." },
{ "extend", ExtendMethod, METH_O,
"Adds objects to the repeated container." },
{ "pop", Pop, METH_VARARGS,
"Removes an object from the repeated container and returns it." },
{ "remove", Remove, METH_O,
"Removes an object from the repeated container." },
{ "sort", (PyCFunction)Sort, METH_VARARGS | METH_KEYWORDS,
"Sorts the repeated container." },
{ "MergeFrom", MergeFromMethod, METH_O,
"Adds objects to the repeated container." },
{ NULL, NULL }
};
} // namespace repeated_composite_container
PyTypeObject RepeatedCompositeContainer_Type = {
PyVarObject_HEAD_INIT(&PyType_Type, 0)
FULL_MODULE_NAME ".RepeatedCompositeContainer", // tp_name
sizeof(RepeatedCompositeContainer), // tp_basicsize
0, // tp_itemsize
repeated_composite_container::Dealloc, // tp_dealloc
0, // tp_print
0, // tp_getattr
0, // tp_setattr
0, // tp_compare
repeated_composite_container::ToStr, // tp_repr
0, // tp_as_number
&repeated_composite_container::SqMethods, // tp_as_sequence
&repeated_composite_container::MpMethods, // tp_as_mapping
PyObject_HashNotImplemented, // tp_hash
0, // tp_call
0, // tp_str
0, // tp_getattro
0, // tp_setattro
0, // tp_as_buffer
Py_TPFLAGS_DEFAULT, // tp_flags
"A Repeated scalar container", // tp_doc
0, // tp_traverse
0, // tp_clear
repeated_composite_container::RichCompare, // tp_richcompare
0, // tp_weaklistoffset
0, // tp_iter
0, // tp_iternext
repeated_composite_container::Methods, // tp_methods
0, // tp_members
0, // tp_getset
0, // tp_base
0, // tp_dict
0, // tp_descr_get
0, // tp_descr_set
0, // tp_dictoffset
0, // tp_init
};
} // namespace python
} // namespace protobuf
} // namespace google
| [
"banyixuan@pku.edu.cn"
] | banyixuan@pku.edu.cn |
2df39cea68aa2b0be4e5425cb0b601fc02a4e487 | fa61f00d207dc33c3e3d542b1fdbd6fafb88fb96 | /src/modules/fpn/fpn_utils.cpp | d0cc96b9d335baae0d5c737d2108e2fd0d45cc76 | [
"LicenseRef-scancode-generic-cla",
"BSD-2-Clause",
"LicenseRef-scancode-public-domain"
] | permissive | challenzhou/frcnn | 131af81672af11c761353feb39b5665d3540ac60 | 28490790ad123199f88d44f2c1737c7aa94afd6d | refs/heads/master | 2020-03-13T00:01:39.942489 | 2018-02-06T11:14:51 | 2018-02-06T11:14:51 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,638 | cpp | // ------------------------------------------------------------------
// FPN
// Written by github.com/makefile
// ------------------------------------------------------------------
#include "fpn_utils.hpp"
#include <cmath>
#include "caffe/blob.hpp"
#include "caffe/FRCNN/util/frcnn_utils.hpp"
using namespace std;
using namespace caffe;
using namespace caffe::Frcnn;
// single scale version forked from generate_anchors.py
//vector<int> generate_anchors(int base_size=16, vector<float> ratios={0.5, 1, 2}, int scale=8) {
vector<vector<int> > generate_anchors(int base_size, const vector<float> &ratios, const vector<int> &scales) {
vector<vector<int> > anchors (scales.size() * ratios.size(), vector<int>(4,0));
int w = base_size;
int h = base_size;
float x_ctr = 0.5 * (w - 1);
float y_ctr = 0.5 * (h - 1);
for (int j=0; j<scales.size(); j++) {
const int scale = scales[j];
w *= scale;
h *= scale;
int size = w * h;
for (int i=0;i<ratios.size();i++){
float r = ratios[i];
float size_ratio = size / r ;
w = (int)(sqrt(size_ratio));
h = (int)(w * r);
vector<int> &a = anchors[j * ratios.size() + i];//make sure this is reference instead of copy
a[0] = x_ctr - 0.5 * (w - 1);
a[1] = y_ctr - 0.5 * (h - 1);
a[2] = x_ctr + 0.5 * (w - 1);
a[3] = y_ctr + 0.5 * (h - 1);
}
}
return anchors;
}
// get feature pyramid level,range (2~max_level),for RPN,max_level=6;for RCNN,max_level=5
template <typename Dtype>
int calc_level(Point4f<Dtype> &box, int max_level) {
// assign rois to level Pk (P2 ~ P_max_level)
int w = box[2] - box[0];
int h = box[3] - box[1];
//224 is base size of ImageNet
return min(max_level, max(2, (int)(4 + log2(sqrt(w * h) / 224))));
}
template int calc_level(Point4f<float> &box, int max_level);
template int calc_level(Point4f<double> &box, int max_level);
template <typename Dtype>
void split_top_rois_by_level(const vector<Blob<Dtype> *> &top,vector<Point4f<Dtype> > &rois, int n_level) {
vector<vector<Point4f<Dtype> > > level_boxes (5,vector<Point4f<Dtype> >());
//int max_idx = 0;
//int max_roi_num = 0;
for (size_t i = 0; i < rois.size(); i++) {
int level_idx = calc_level(rois[i], n_level + 1) - 2;
level_boxes[level_idx].push_back(rois[i]);
//if(level_boxes[level_idx].size() > max_roi_num){
// max_roi_num = level_boxes[level_idx].size();
// max_idx = level_idx;
//}
}
//random move 1 roi to empty level_boxes for that blob with num=0 will cause CUDA check error.
//this method is a little dirty,and if the rois num is less than pyramid levels num,then it is not enough to divide.
//so I modify CAFFE_GET_BLOCKS in include/caffe/util/device_alternate.hpp instead to support blob count=0.
/*for (size_t level_idx = 0; level_idx < 5; level_idx++) {
int num = level_boxes[level_idx].size();
if(0==num){
level_boxes[level_idx].push_back(level_boxes[max_idx].back());
level_boxes[max_idx].pop_back();
}
} */
for (size_t level_idx = 0; level_idx < 5; level_idx++) {
top[level_idx]->Reshape(level_boxes[level_idx].size(), 5, 1, 1);
Dtype *top_data = top[level_idx]->mutable_cpu_data();
for (size_t i = 0; i < level_boxes[level_idx].size(); i++) {
Point4f<Dtype> &box = level_boxes[level_idx][i];
top_data[i * 5] = 0;// fyk: image idx
for (int j = 1; j < 5; j++) {
top_data[i * 5 + j] = box[j - 1];
}
}
}
}
template void split_top_rois_by_level(const vector<Blob<float> *> &top,vector<Point4f<float> > &rois, int n_level);
template void split_top_rois_by_level(const vector<Blob<double> *> &top,vector<Point4f<double> > &rois, int n_level);
| [
"fuyongming431@126.com"
] | fuyongming431@126.com |
41566d553bdf5faf24c0f38fc118fb8db842ffb3 | 26dc861ff5f203a7a16d0dd989c5de44789ff6bd | /Bachelor_thesis_code/dialogpcd.h | e8e8b4dda6fd98338b94cbcbd68e7306797e0062 | [] | no_license | sunlex0717/Bachelor_project_code | ede27683427141b9b280693d78ccad4876ea89f8 | 47c5e98e3227e2312e7b53c282e0702017135b4e | refs/heads/master | 2020-04-03T05:31:46.779981 | 2018-10-28T08:10:58 | 2018-10-28T08:10:58 | 155,048,827 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 863 | h | #ifndef DIALOGPCD_H
#define DIALOGPCD_H
#include <QDialog>
#include <QStringList>
#include <QString>
namespace Ui {
class DialogPCD;
}
class DialogPCD : public QDialog
{
Q_OBJECT
static const int BL=2;
public:
explicit DialogPCD(QWidget *parent = 0);
~DialogPCD();
void rebuildHistory();
bool ReCharge();
bool Consume();
bool setbalance();
void amt_bal_to_balance();
void balance_to_amt_bal();
//void setmode(int mode) {C_mode=mode;}
//void setRegP(int para) {C_RegPara=para;}
private slots:
void on_Confirm_RC_clicked();
void on_Confirm_CM_clicked();
private:
Ui::DialogPCD *ui;
QStringList PCD_history;
double amt_recharge;
double amt_consume;
char balance[7];
double amt_bal;
//int C_mode; //0:PCD 1:PICC
//int C_RegPara; //0:default 1:user
};
#endif // DIALOGPCD_H
| [
"noreply@github.com"
] | noreply@github.com |
66c4edd3493f645d1a6b9e87b6d598a984e7f736 | 538f3fd529d525d90283230c4e52a48aa4bf722d | /LearningOpenCV/LearningOpenCV/DisplayAPicture.cpp | 8dc70e2a0da161fdbbc6ef8e1232a2702dc22831 | [] | no_license | vohoaiviet/recognition | 4547f6c0de8138e8a2ef54867ad9834497445e16 | e7b3443361694f33750b79023b34d59a17b34c25 | refs/heads/master | 2021-01-10T01:29:25.936221 | 2013-05-12T04:18:52 | 2013-05-12T04:18:52 | 50,643,016 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 242 | cpp | #include "highgui.h"
int main() {
IplImage* img = cvLoadImage("pic\\acmicpc.bmp");
cvNamedWindow("Example1", CV_WINDOW_AUTOSIZE);
cvShowImage("Example1", img);
cvWaitKey(0);
cvReleaseImage(&img);
cvDestroyWindow("Example1");
} | [
"cisjiong@gmail.com"
] | cisjiong@gmail.com |
229806a395f0f8bfa5249eaa93323f9b8175763a | 1d7dd2b19707c05534f9131a369c1957358adfb4 | /vslib/CorePortIndexMapFileParser.cpp | 8a9e6a99221fed48d13ce4947bb558aa5a9e650d | [
"Apache-2.0",
"LicenseRef-scancode-generic-cla"
] | permissive | cisco-aarhodes/sonic-sairedis | 4a0de1608bc615e56d98f6dd5141ae0c60e53476 | 20737ae1acb0f115f8d3ce29a4a0438336a2c257 | refs/heads/master | 2023-05-30T08:55:29.916940 | 2023-05-17T07:58:40 | 2023-05-17T07:58:40 | 178,021,697 | 1 | 0 | NOASSERTION | 2019-03-27T15:21:19 | 2019-03-27T15:21:19 | null | UTF-8 | C++ | false | false | 5,459 | cpp | #include "CorePortIndexMapFileParser.h"
#include "swss/logger.h"
#include "swss/tokenize.h"
#include <net/if.h>
#include <fstream>
#include <cctype>
using namespace saivs;
// must be the same or less as SAI_VS_SWITCH_INDEX_MAX
#define MAX_SWITCH_INDEX (255)
bool CorePortIndexMapFileParser::isInterfaceNameValid(
_In_ const std::string& name)
{
SWSS_LOG_ENTER();
size_t size = name.size();
if (size == 0 || size > IFNAMSIZ)
{
SWSS_LOG_ERROR("invalid interface name %s or length: %zu", name.c_str(), size);
return false;
}
for (size_t i = 0; i < size; i++)
{
char c = name[i];
if (std::isalnum(c))
continue;
SWSS_LOG_ERROR("invalid character '%c' in interface name %s", c, name.c_str());
return false;
}
// interface name is valid
return true;
}
void CorePortIndexMapFileParser::parse(
_In_ std::shared_ptr<CorePortIndexMapContainer> container,
_In_ uint32_t switchIndex,
_In_ const std::string& ifname,
_In_ const std::string& scpidx)
{
SWSS_LOG_ENTER();
if (!isInterfaceNameValid(ifname))
{
SWSS_LOG_ERROR("interface name '%s' is invalid", ifname.c_str());
return;
}
auto tokens = swss::tokenize(scpidx, ',');
size_t n = tokens.size();
if (n != 2)
{
SWSS_LOG_ERROR("Invalid core port index map %s assigned to interface %s", scpidx.c_str(), ifname.c_str());
return;
}
std::vector<uint32_t> cpidx;
for (auto c: tokens)
{
uint32_t c_or_pidx;
if (sscanf(c.c_str(), "%u", &c_or_pidx) != 1)
{
SWSS_LOG_ERROR("failed to parse core or port index: %s", c.c_str());
continue;
}
cpidx.push_back(c_or_pidx);
}
auto corePortIndexMap = container->getCorePortIndexMap(switchIndex);
if (!corePortIndexMap)
{
corePortIndexMap = std::make_shared<CorePortIndexMap>(switchIndex);
container->insert(corePortIndexMap);
}
corePortIndexMap->add(ifname, cpidx);
}
void CorePortIndexMapFileParser::parseLineWithNoIndex(
_In_ std::shared_ptr<CorePortIndexMapContainer> container,
_In_ const std::vector<std::string>& tokens)
{
SWSS_LOG_ENTER();
auto ifname = tokens.at(0);
auto scpidx = tokens.at(1);
parse(container, CorePortIndexMap::DEFAULT_SWITCH_INDEX, ifname, scpidx);
}
void CorePortIndexMapFileParser::parseLineWithIndex(
_In_ std::shared_ptr<CorePortIndexMapContainer> container,
_In_ const std::vector<std::string>& tokens)
{
SWSS_LOG_ENTER();
auto swidx = tokens.at(0);
auto ifname = tokens.at(1);
auto scpidx = tokens.at(2);
uint32_t switchIndex;
if (sscanf(swidx.c_str(), "%u", & switchIndex) != 1)
{
SWSS_LOG_ERROR("failed to parse switchIndex: %s", swidx.c_str());
return;
}
parse(container, switchIndex, ifname, scpidx);
}
std::shared_ptr<CorePortIndexMapContainer> CorePortIndexMapFileParser::parseCorePortIndexMapFile(
_In_ const std::string& file)
{
SWSS_LOG_ENTER();
auto container = std::make_shared<CorePortIndexMapContainer>();
std::ifstream ifs(file);
if (!ifs.is_open())
{
SWSS_LOG_WARN("failed to open core port index map file: %s, using default", file.c_str());
auto def = CorePortIndexMap::getDefaultCorePortIndexMap();
container->insert(def);
return container;
}
SWSS_LOG_NOTICE("loading core port index map from: %s", file.c_str());
std::string line;
while (getline(ifs, line))
{
/*
* line can be in 2 forms:
* ethX:core, core port index
* N:ethX:core, core port index
*
* where N is switchIndex (0..255) - SAI_VS_SWITCH_INDEX_MAX
* if N is not specified then zero (0) is assumed
*/
if (line.size() > 0 && (line[0] == '#' || line[0] == ';'))
{
continue;
}
SWSS_LOG_INFO("core port index line: %s", line.c_str());
auto tokens = swss::tokenize(line, ':');
if (tokens.size() == 3)
{
parseLineWithIndex(container, tokens);
}
else if (tokens.size() == 2)
{
parseLineWithNoIndex(container, tokens);
}
else
{
SWSS_LOG_ERROR("expected 2 or 3 tokens in line %s, got %zu", line.c_str(), tokens.size());
}
}
container->removeEmptyCorePortIndexMaps();
if (container->size() == 0)
{
SWSS_LOG_WARN("no core port index map loaded, returning default core port index map");
auto def = CorePortIndexMap::getDefaultCorePortIndexMap();
container->insert(def);
return container;
}
SWSS_LOG_NOTICE("loaded %zu core port index maps to container", container->size());
return container;
}
std::shared_ptr<CorePortIndexMapContainer> CorePortIndexMapFileParser::parseCorePortIndexMapFile(
_In_ const char* file)
{
SWSS_LOG_ENTER();
if (file == nullptr)
{
auto container = std::make_shared<CorePortIndexMapContainer>();
SWSS_LOG_NOTICE("no file map file specified, loading default");
auto def = CorePortIndexMap::getDefaultCorePortIndexMap();
container->insert(def);
return container;
}
std::string name(file);
return parseCorePortIndexMapFile(name);
}
| [
"noreply@github.com"
] | noreply@github.com |
6072b56a0afac57366cab9a01cf9b5c98e333c53 | 796508857f6ff722e57b140e3073fb167eb25d4b | /codechef/jan15_longTest/sizeof.cpp | dc9f037c1bf6835a52aa2fc8b6fd3046f75ae89a | [] | no_license | olympian94/programs | b61d2ae754f1630128731aee81cd407d0aad7b92 | 28a2cc64eb2a6af7db7a647dc2871cb2e7b32a72 | refs/heads/master | 2016-09-03T06:50:08.933331 | 2015-10-09T10:18:22 | 2015-10-09T10:18:22 | 41,950,459 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 312 | cpp | #include<iostream>
using namespace std;
int main()
{
cout<<endl<<"int "<<sizeof(int)*8;
cout<<endl<<"long "<<sizeof(long)*8;
cout<<endl<<"float "<<sizeof(float)*8;
cout<<endl<<"long int "<<sizeof(long int)*8;
cout<<endl<<"long long "<<sizeof(long long)*8;
cout<<endl<<int(36/10);
cout<<endl;
return 0;
}
| [
"abtiwari94@gmail.com"
] | abtiwari94@gmail.com |
67d062cd07868aac797994b1765855a3ed98660f | d89e63f5d58014ac6b98445fbf624d3bce299dde | /Engine_modular/EntitySprite.cpp | f2139ac040bc900e46c31d9ff5693cdc2f820c3f | [] | no_license | Raspy-Py/MyGameEngine | f74317c07935dfa9392564cd28048cd27b8196ee | f168d323cf90d95408cd485e891d006f0a25d92b | refs/heads/master | 2023-05-25T10:34:38.461607 | 2023-05-17T18:08:48 | 2023-05-17T18:08:48 | 349,682,620 | 0 | 0 | null | null | null | null | WINDOWS-1251 | C++ | false | false | 4,693 | cpp | #include "EntitySprite.h"
EntitySprite::EntitySprite()
{
spriteLeftFirstCol = 0;
shouldBeDisplayed = false;
}
EntitySprite::~EntitySprite()
{
}
void EntitySprite::draw(RenderWindow& window, RayCasting& rc)
{
if (shouldBeDisplayed)
for (int i = 0; i < actualSprite.size(); i++)
{
if (distToPlayer < rc.getRaysLength()[i + leftSideColOnDisplay])
{
window.draw(actualSprite[i]);
}
}
}
void EntitySprite::loadSprite(std::string path, int spriteSize)
{
////////////////////////////////////////////////
// Завантажуємо текстури //
////////////////////////////////////////////////
const int n = 3; // К-ть каналів кольорів
int bias; // Зміщення таблиці кольорів відносно початку файлу
char buff[n]; // Буфер
std::vector<Color> textureColorMap;
std::ifstream file(path, std::ios::binary | std::ios::in);
file.seekg(0x0A);
file.read(&buff[0], 3);
bias = hexToDec(buff[0]);
int R, G, B, A;
file.seekg(bias);
for (int i = 0; i < spriteSize * spriteSize; i++)
{
file.read(&buff[0], n);
R = hexToDec(buff[2]);
G = hexToDec(buff[1]);
B = hexToDec(buff[0]);
if (R + G + B == 255 * 3) A = 0;
else A = 255;
textureColorMap.push_back(Color(R, G, B, A));
}
file.close();
std::reverse(textureColorMap.begin(), textureColorMap.end());
spriteTex = new Color*[MONSTER_SPRITE_RES];
for (int i = 0; i < MONSTER_SPRITE_RES; i++)
spriteTex[i] = new Color[MONSTER_SPRITE_RES];
//---Ініціалізуємо колонки пікселів зображення---//
for (int x = 0; x < spriteSize; x++)
for (int y = 0; y < spriteSize; y++) {
spriteTex[x][y] = textureColorMap[y * spriteSize + x];
}
}
unsigned EntitySprite::hexToDec(char hex)
{
unsigned dec = 0;
for (int i = 7; i > -1; i--)
{
if (hex & 1 << i) { dec += 1 << i; };
}
return dec;
}
void EntitySprite::calculateSprite(Player& player, Vector2f entityPos)
{
Vector2f dirToEntity = {
entityPos - player.getPosition()
};
shouldBeDisplayed = isInFieldOfView(player.getDirection(), dirToEntity);
float distToEntity;
float distToEntityProj;
float enemyCentreAngle;
float enemySize = MONSTER_SPRITE_RES;
float enemyProjSize;
float texPixelHeight;
float spriteTopPos;
int currentCol;
int rightSideColOnDisplay;
int centreColOnDisplay;
int numberOfCols;
int start;
int stop;
if (shouldBeDisplayed) {
distToEntity = sqrt(
dirToEntity.x * dirToEntity.x +
dirToEntity.y * dirToEntity.y
);
distToPlayer = distToEntity;
if (distToEntity < 15) {
shouldBeDisplayed = false;
return;
}
enemyCentreAngle = vectorToAngle(dirToEntity);
float a = player.getDirection() - enemyCentreAngle;
if (a < -ANGLE_180)
a += ANGLE_360;
if (a > ANGLE_180)
a -= ANGLE_360;
centreColOnDisplay = WIN_HALF_WIDTH- (a) / ABR;
a = enemyCentreAngle - player.getDirection();
if (a < -ANGLE_180)
a += ANGLE_360;
if (a > ANGLE_180)
a -= ANGLE_360;
distToEntityProj = abs(distToEntity * cos(a));
enemyProjSize = float(MONSTER_SPRITE_RES) * WTP / distToEntityProj/2;
leftSideColOnDisplay = centreColOnDisplay - enemyProjSize;
rightSideColOnDisplay = centreColOnDisplay + enemyProjSize;
spriteLeftFirstCol = leftSideColOnDisplay;
numberOfCols = rightSideColOnDisplay - leftSideColOnDisplay;
texPixelHeight = enemyProjSize / MONSTER_SPRITE_RES * 2;
spriteTopPos = WIN_HALF_HEIGHT - enemyProjSize;
actualSprite.clear();
for (int i = 0; i < numberOfCols; i++)
{
currentCol = float(i) / numberOfCols * MONSTER_SPRITE_RES;
actualSprite.push_back(
VertexArray(Lines, MONSTER_SPRITE_RES * 2)
);
for (int j = 0; j < MONSTER_SPRITE_RES; j++)
{
actualSprite[i][j * 2 + 0].color = spriteTex[currentCol][j];
actualSprite[i][j * 2 + 1].color = spriteTex[currentCol][j];
actualSprite[i][j * 2 + 0].position = Vector2f(leftSideColOnDisplay + i, spriteTopPos + j * texPixelHeight);
actualSprite[i][j * 2 + 1].position = Vector2f(leftSideColOnDisplay + i, spriteTopPos + (j + 1) * texPixelHeight);
}
}
}
}
double EntitySprite::vectorToAngle(Vector2f vect)
{
double cosA;
double len = 0.000000001;
double angle;
len += sqrt(vect.x * vect.x + vect.y * vect.y);
cosA = vect.x / len;
angle = acos(cosA);
if (vect.y < 0)
{
angle = ANGLE_360 - angle;
}
return angle;
}
bool EntitySprite::isInFieldOfView(float dir, Vector2f dirToEntity)
{
float a = vectorToAngle(dirToEntity);
a -= dir;
if (a < -ANGLE_180)
a += ANGLE_360;
if (a > ANGLE_180)
a -= ANGLE_360;
bool res = (a <= ANGLE_90/3 && a >= -ANGLE_90/3);
return res;
}
| [
"naumenko.roman2003@gmail.com"
] | naumenko.roman2003@gmail.com |
5aa5f67c9314c8cab39342bddc4b578cbdee94c7 | b3eb37edb864153452e1cbf0a63bc3fdad3ab129 | /Chapter 1. C언어 기반의 C++ 1/C++_Ch1_(3)_1.cpp | c4c13fb4b36c6a6243cb97dd6c9378809023a7d4 | [] | no_license | Gaon-Choi/cpp_study | 3a1effc896a5ab3ca072f1610b666fe7d62468f0 | d5bd78e5f230feb8e178f22bb9843932bf57451f | refs/heads/master | 2020-06-08T18:45:51.266951 | 2019-10-08T02:49:24 | 2019-10-08T02:49:24 | 193,284,835 | 0 | 1 | null | null | null | null | UHC | C++ | false | false | 805 | cpp | /*
[Ch1-23 매개변수의 디폴트 값(Default Value)
문제 1.
예제 DefaultValue3.cpp에 정의된 함수 BoxVolume를 '매개변수의 디폴트 값 지정' 형태가 아닌,
'함수 오버로딩'의 형태로 재구현해보자. 물론 main 함수는 변경하지 않아야 하며,
실행결과도 동일해야 한다.
*/
#include <iostream>
int BoxVolume(int a, int b, int c);
int BoxVolume(int a, int b);
int BoxVolume(int a);
int main(void) {
std::cout << "[3, 3, 3] : " << BoxVolume(3, 3, 3) << std::endl;
std::cout << "[5, 5, D] : " << BoxVolume(5, 5) << std::endl;
std::cout << "[7, D, D] : " << BoxVolume(7) << std::endl;
return 0;
}
int BoxVolume(int a, int b, int c) {
return a * b * c;
}
int BoxVolume(int a, int b) {
return a * b * 1;
}
int BoxVolume(int a) {
return a * 1 * 1;
} | [
"choigaon1028@gmail.com"
] | choigaon1028@gmail.com |
bacf946a1760ec5257ab5f9db85549398adcdebb | 527739ed800e3234136b3284838c81334b751b44 | /include/RED4ext/Types/generated/game/ui/ContraGameState.hpp | fb0f65a09e6ff85d1afa20d29b0f0307cd13c6d7 | [
"MIT"
] | permissive | 0xSombra/RED4ext.SDK | 79ed912e5b628ef28efbf92d5bb257b195bfc821 | 218b411991ed0b7cb7acd5efdddd784f31c66f20 | refs/heads/master | 2023-07-02T11:03:45.732337 | 2021-04-15T16:38:19 | 2021-04-15T16:38:19 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 619 | hpp | #pragma once
// This file is generated from the Game's Reflection data
#include <cstdint>
#include <RED4ext/Common.hpp>
#include <RED4ext/REDhash.hpp>
#include <RED4ext/Types/generated/game/ui/SideScrollerMiniGameStateAdvanced.hpp>
namespace RED4ext
{
namespace game::ui {
struct ContraGameState : game::ui::SideScrollerMiniGameStateAdvanced
{
static constexpr const char* NAME = "gameuiContraGameState";
static constexpr const char* ALIAS = "ContraGameState";
};
RED4EXT_ASSERT_SIZE(ContraGameState, 0xA0);
} // namespace game::ui
using ContraGameState = game::ui::ContraGameState;
} // namespace RED4ext
| [
"expired6978@gmail.com"
] | expired6978@gmail.com |
2da85ea6a31a8c4332f7e6a39dc1d5ee91ddb40d | b7f3edb5b7c62174bed808079c3b21fb9ea51d52 | /third_party/abseil-cpp/absl/debugging/internal/elf_mem_image.h | 46bfade3503ebcfd4c109c25613011671f6905f2 | [
"LGPL-2.0-or-later",
"GPL-1.0-or-later",
"MIT",
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference",
"BSD-3-Clause"
] | permissive | otcshare/chromium-src | 26a7372773b53b236784c51677c566dc0ad839e4 | 64bee65c921db7e78e25d08f1e98da2668b57be5 | refs/heads/webml | 2023-03-21T03:20:15.377034 | 2020-11-16T01:40:14 | 2020-11-16T01:40:14 | 209,262,645 | 18 | 21 | BSD-3-Clause | 2023-03-23T06:20:07 | 2019-09-18T08:52:07 | null | UTF-8 | C++ | false | false | 4,671 | h | /*
* Copyright 2017 The Abseil Authors.
*
* 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
*
* 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.
*/
// Allow dynamic symbol lookup for in-memory Elf images.
#ifndef ABSL_DEBUGGING_INTERNAL_ELF_MEM_IMAGE_H_
#define ABSL_DEBUGGING_INTERNAL_ELF_MEM_IMAGE_H_
// Including this will define the __GLIBC__ macro if glibc is being
// used.
#include <climits>
#include "absl/base/config.h"
// Maybe one day we can rewrite this file not to require the elf
// symbol extensions in glibc, but for right now we need them.
#ifdef ABSL_HAVE_ELF_MEM_IMAGE
#error ABSL_HAVE_ELF_MEM_IMAGE cannot be directly set
#endif
#if defined(__ELF__) && defined(__GLIBC__) && !defined(__native_client__) && \
!defined(__asmjs__) && !defined(__wasm__)
#define ABSL_HAVE_ELF_MEM_IMAGE 1
#endif
#ifdef ABSL_HAVE_ELF_MEM_IMAGE
#include <link.h> // for ElfW
namespace absl {
ABSL_NAMESPACE_BEGIN
namespace debugging_internal {
// An in-memory ELF image (may not exist on disk).
class ElfMemImage {
private:
// Sentinel: there could never be an elf image at &kInvalidBaseSentinel.
static const int kInvalidBaseSentinel;
public:
// Sentinel: there could never be an elf image at this address.
static constexpr const void *const kInvalidBase =
static_cast<const void*>(&kInvalidBaseSentinel);
// Information about a single vdso symbol.
// All pointers are into .dynsym, .dynstr, or .text of the VDSO.
// Do not free() them or modify through them.
struct SymbolInfo {
const char *name; // E.g. "__vdso_getcpu"
const char *version; // E.g. "LINUX_2.6", could be ""
// for unversioned symbol.
const void *address; // Relocated symbol address.
const ElfW(Sym) *symbol; // Symbol in the dynamic symbol table.
};
// Supports iteration over all dynamic symbols.
class SymbolIterator {
public:
friend class ElfMemImage;
const SymbolInfo *operator->() const;
const SymbolInfo &operator*() const;
SymbolIterator& operator++();
bool operator!=(const SymbolIterator &rhs) const;
bool operator==(const SymbolIterator &rhs) const;
private:
SymbolIterator(const void *const image, int index);
void Update(int incr);
SymbolInfo info_;
int index_;
const void *const image_;
};
explicit ElfMemImage(const void *base);
void Init(const void *base);
bool IsPresent() const { return ehdr_ != nullptr; }
const ElfW(Phdr)* GetPhdr(int index) const;
const ElfW(Sym)* GetDynsym(int index) const;
const ElfW(Versym)* GetVersym(int index) const;
const ElfW(Verdef)* GetVerdef(int index) const;
const ElfW(Verdaux)* GetVerdefAux(const ElfW(Verdef) *verdef) const;
const char* GetDynstr(ElfW(Word) offset) const;
const void* GetSymAddr(const ElfW(Sym) *sym) const;
const char* GetVerstr(ElfW(Word) offset) const;
int GetNumSymbols() const;
SymbolIterator begin() const;
SymbolIterator end() const;
// Look up versioned dynamic symbol in the image.
// Returns false if image is not present, or doesn't contain given
// symbol/version/type combination.
// If info_out is non-null, additional details are filled in.
bool LookupSymbol(const char *name, const char *version,
int symbol_type, SymbolInfo *info_out) const;
// Find info about symbol (if any) which overlaps given address.
// Returns true if symbol was found; false if image isn't present
// or doesn't have a symbol overlapping given address.
// If info_out is non-null, additional details are filled in.
bool LookupSymbolByAddress(const void *address, SymbolInfo *info_out) const;
private:
const ElfW(Ehdr) *ehdr_;
const ElfW(Sym) *dynsym_;
const ElfW(Versym) *versym_;
const ElfW(Verdef) *verdef_;
const ElfW(Word) *hash_;
const char *dynstr_;
size_t strsize_;
size_t verdefnum_;
ElfW(Addr) link_base_; // Link-time base (p_vaddr of first PT_LOAD).
};
} // namespace debugging_internal
ABSL_NAMESPACE_END
} // namespace absl
#endif // ABSL_HAVE_ELF_MEM_IMAGE
#endif // ABSL_DEBUGGING_INTERNAL_ELF_MEM_IMAGE_H_
| [
"commit-bot@chromium.org"
] | commit-bot@chromium.org |
b85cfdc566fd520bf26f98f13a58929c1f16cce7 | ddd64761ee9b75f269abb91353a9b2b65b433336 | /src/qt/walletmodel.cpp | 394f84f20b536049668feb4248ab4d699cda7a78 | [
"MIT"
] | permissive | faridsany/deuscoin-core | 1ec6c7dbe4c41427f8cf3253b3d6e08c6e1014db | 907e444d2b3bb5424665efabd692f02c4bccd8de | refs/heads/master | 2020-04-09T17:30:27.626145 | 2017-11-15T16:23:10 | 2017-11-15T16:23:10 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 22,184 | cpp | // Copyright (c) 2011-2015 The Deuscoin Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include "walletmodel.h"
#include "addresstablemodel.h"
#include "guiconstants.h"
#include "guiutil.h"
#include "paymentserver.h"
#include "recentrequeststablemodel.h"
#include "transactiontablemodel.h"
#include "base58.h"
#include "keystore.h"
#include "main.h"
#include "sync.h"
#include "ui_interface.h"
#include "wallet/wallet.h"
#include "wallet/walletdb.h" // for BackupWallet
#include <stdint.h>
#include <QDebug>
#include <QSet>
#include <QTimer>
#include <boost/foreach.hpp>
WalletModel::WalletModel(const PlatformStyle *platformStyle, CWallet *wallet, OptionsModel *optionsModel, QObject *parent) :
QObject(parent), wallet(wallet), optionsModel(optionsModel), addressTableModel(0),
transactionTableModel(0),
recentRequestsTableModel(0),
cachedBalance(0), cachedUnconfirmedBalance(0), cachedImmatureBalance(0),
cachedEncryptionStatus(Unencrypted),
cachedNumBlocks(0)
{
fHaveWatchOnly = wallet->HaveWatchOnly();
fForceCheckBalanceChanged = false;
addressTableModel = new AddressTableModel(wallet, this);
transactionTableModel = new TransactionTableModel(platformStyle, wallet, this);
recentRequestsTableModel = new RecentRequestsTableModel(wallet, this);
// This timer will be fired repeatedly to update the balance
pollTimer = new QTimer(this);
connect(pollTimer, SIGNAL(timeout()), this, SLOT(pollBalanceChanged()));
pollTimer->start(MODEL_UPDATE_DELAY);
subscribeToCoreSignals();
}
WalletModel::~WalletModel()
{
unsubscribeFromCoreSignals();
}
CAmount WalletModel::getBalance(const CCoinControl *coinControl) const
{
if (coinControl)
{
CAmount nBalance = 0;
std::vector<COutput> vCoins;
wallet->AvailableCoins(vCoins, true, coinControl);
BOOST_FOREACH(const COutput& out, vCoins)
if(out.fSpendable)
nBalance += out.tx->vout[out.i].nValue;
return nBalance;
}
return wallet->GetBalance();
}
CAmount WalletModel::getUnconfirmedBalance() const
{
return wallet->GetUnconfirmedBalance();
}
CAmount WalletModel::getImmatureBalance() const
{
return wallet->GetImmatureBalance();
}
bool WalletModel::haveWatchOnly() const
{
return fHaveWatchOnly;
}
CAmount WalletModel::getWatchBalance() const
{
return wallet->GetWatchOnlyBalance();
}
CAmount WalletModel::getWatchUnconfirmedBalance() const
{
return wallet->GetUnconfirmedWatchOnlyBalance();
}
CAmount WalletModel::getWatchImmatureBalance() const
{
return wallet->GetImmatureWatchOnlyBalance();
}
void WalletModel::updateStatus()
{
EncryptionStatus newEncryptionStatus = getEncryptionStatus();
if(cachedEncryptionStatus != newEncryptionStatus)
Q_EMIT encryptionStatusChanged(newEncryptionStatus);
}
void WalletModel::pollBalanceChanged()
{
// Get required locks upfront. This avoids the GUI from getting stuck on
// periodical polls if the core is holding the locks for a longer time -
// for example, during a wallet rescan.
TRY_LOCK(cs_main, lockMain);
if(!lockMain)
return;
TRY_LOCK(wallet->cs_wallet, lockWallet);
if(!lockWallet)
return;
if(fForceCheckBalanceChanged || chainActive.Height() != cachedNumBlocks)
{
fForceCheckBalanceChanged = false;
// Balance and number of transactions might have changed
cachedNumBlocks = chainActive.Height();
checkBalanceChanged();
if(transactionTableModel)
transactionTableModel->updateConfirmations();
}
}
void WalletModel::checkBalanceChanged()
{
CAmount newBalance = getBalance();
CAmount newUnconfirmedBalance = getUnconfirmedBalance();
CAmount newImmatureBalance = getImmatureBalance();
CAmount newWatchOnlyBalance = 0;
CAmount newWatchUnconfBalance = 0;
CAmount newWatchImmatureBalance = 0;
if (haveWatchOnly())
{
newWatchOnlyBalance = getWatchBalance();
newWatchUnconfBalance = getWatchUnconfirmedBalance();
newWatchImmatureBalance = getWatchImmatureBalance();
}
if(cachedBalance != newBalance || cachedUnconfirmedBalance != newUnconfirmedBalance || cachedImmatureBalance != newImmatureBalance ||
cachedWatchOnlyBalance != newWatchOnlyBalance || cachedWatchUnconfBalance != newWatchUnconfBalance || cachedWatchImmatureBalance != newWatchImmatureBalance)
{
cachedBalance = newBalance;
cachedUnconfirmedBalance = newUnconfirmedBalance;
cachedImmatureBalance = newImmatureBalance;
cachedWatchOnlyBalance = newWatchOnlyBalance;
cachedWatchUnconfBalance = newWatchUnconfBalance;
cachedWatchImmatureBalance = newWatchImmatureBalance;
Q_EMIT balanceChanged(newBalance, newUnconfirmedBalance, newImmatureBalance,
newWatchOnlyBalance, newWatchUnconfBalance, newWatchImmatureBalance);
}
}
void WalletModel::updateTransaction()
{
// Balance and number of transactions might have changed
fForceCheckBalanceChanged = true;
}
void WalletModel::updateAddressBook(const QString &address, const QString &label,
bool isMine, const QString &purpose, int status)
{
if(addressTableModel)
addressTableModel->updateEntry(address, label, isMine, purpose, status);
}
void WalletModel::updateWatchOnlyFlag(bool fHaveWatchonly)
{
fHaveWatchOnly = fHaveWatchonly;
Q_EMIT notifyWatchonlyChanged(fHaveWatchonly);
}
bool WalletModel::validateAddress(const QString &address)
{
CDeuscoinAddress addressParsed(address.toStdString());
return addressParsed.IsValid();
}
WalletModel::SendCoinsReturn WalletModel::prepareTransaction(WalletModelTransaction &transaction, const CCoinControl *coinControl)
{
CAmount total = 0;
bool fSubtractFeeFromAmount = false;
QList<SendCoinsRecipient> recipients = transaction.getRecipients();
std::vector<CRecipient> vecSend;
if(recipients.empty())
{
return OK;
}
QSet<QString> setAddress; // Used to detect duplicates
int nAddresses = 0;
// Pre-check input data for validity
Q_FOREACH(const SendCoinsRecipient &rcp, recipients)
{
if (rcp.fSubtractFeeFromAmount)
fSubtractFeeFromAmount = true;
if (rcp.paymentRequest.IsInitialized())
{ // PaymentRequest...
CAmount subtotal = 0;
const payments::PaymentDetails& details = rcp.paymentRequest.getDetails();
for (int i = 0; i < details.outputs_size(); i++)
{
const payments::Output& out = details.outputs(i);
if (out.amount() <= 0) continue;
subtotal += out.amount();
const unsigned char* scriptStr = (const unsigned char*)out.script().data();
CScript scriptPubKey(scriptStr, scriptStr+out.script().size());
CAmount nAmount = out.amount();
CRecipient recipient = {scriptPubKey, nAmount, rcp.fSubtractFeeFromAmount};
vecSend.push_back(recipient);
}
if (subtotal <= 0)
{
return InvalidAmount;
}
total += subtotal;
}
else
{ // User-entered deuscoin address / amount:
if(!validateAddress(rcp.address))
{
return InvalidAddress;
}
if(rcp.amount <= 0)
{
return InvalidAmount;
}
setAddress.insert(rcp.address);
++nAddresses;
CScript scriptPubKey = GetScriptForDestination(CDeuscoinAddress(rcp.address.toStdString()).Get());
CRecipient recipient = {scriptPubKey, rcp.amount, rcp.fSubtractFeeFromAmount};
vecSend.push_back(recipient);
total += rcp.amount;
}
}
if(setAddress.size() != nAddresses)
{
return DuplicateAddress;
}
CAmount nBalance = getBalance(coinControl);
if(total > nBalance)
{
return AmountExceedsBalance;
}
{
LOCK2(cs_main, wallet->cs_wallet);
transaction.newPossibleKeyChange(wallet);
CAmount nFeeRequired = 0;
int nChangePosRet = -1;
std::string strFailReason;
CWalletTx *newTx = transaction.getTransaction();
CReserveKey *keyChange = transaction.getPossibleKeyChange();
bool fCreated = wallet->CreateTransaction(vecSend, *newTx, *keyChange, nFeeRequired, nChangePosRet, strFailReason, coinControl);
transaction.setTransactionFee(nFeeRequired);
if (fSubtractFeeFromAmount && fCreated)
transaction.reassignAmounts(nChangePosRet);
if(!fCreated)
{
if(!fSubtractFeeFromAmount && (total + nFeeRequired) > nBalance)
{
return SendCoinsReturn(AmountWithFeeExceedsBalance);
}
Q_EMIT message(tr("Send Coins"), QString::fromStdString(strFailReason),
CClientUIInterface::MSG_ERROR);
return TransactionCreationFailed;
}
// reject absurdly high fee. (This can never happen because the
// wallet caps the fee at maxTxFee. This merely serves as a
// belt-and-suspenders check)
if (nFeeRequired > maxTxFee)
return AbsurdFee;
}
return SendCoinsReturn(OK);
}
WalletModel::SendCoinsReturn WalletModel::sendCoins(WalletModelTransaction &transaction)
{
QByteArray transaction_array; /* store serialized transaction */
{
LOCK2(cs_main, wallet->cs_wallet);
CWalletTx *newTx = transaction.getTransaction();
Q_FOREACH(const SendCoinsRecipient &rcp, transaction.getRecipients())
{
if (rcp.paymentRequest.IsInitialized())
{
// Make sure any payment requests involved are still valid.
if (PaymentServer::verifyExpired(rcp.paymentRequest.getDetails())) {
return PaymentRequestExpired;
}
// Store PaymentRequests in wtx.vOrderForm in wallet.
std::string key("PaymentRequest");
std::string value;
rcp.paymentRequest.SerializeToString(&value);
newTx->vOrderForm.push_back(make_pair(key, value));
}
else if (!rcp.message.isEmpty()) // Message from normal deuscoin:URI (deuscoin:123...?message=example)
newTx->vOrderForm.push_back(make_pair("Message", rcp.message.toStdString()));
}
CReserveKey *keyChange = transaction.getPossibleKeyChange();
if(!wallet->CommitTransaction(*newTx, *keyChange))
return TransactionCommitFailed;
CTransaction* t = (CTransaction*)newTx;
CDataStream ssTx(SER_NETWORK, PROTOCOL_VERSION);
ssTx << *t;
transaction_array.append(&(ssTx[0]), ssTx.size());
}
// Add addresses / update labels that we've sent to to the address book,
// and emit coinsSent signal for each recipient
Q_FOREACH(const SendCoinsRecipient &rcp, transaction.getRecipients())
{
// Don't touch the address book when we have a payment request
if (!rcp.paymentRequest.IsInitialized())
{
std::string strAddress = rcp.address.toStdString();
CTxDestination dest = CDeuscoinAddress(strAddress).Get();
std::string strLabel = rcp.label.toStdString();
{
LOCK(wallet->cs_wallet);
std::map<CTxDestination, CAddressBookData>::iterator mi = wallet->mapAddressBook.find(dest);
// Check if we have a new address or an updated label
if (mi == wallet->mapAddressBook.end())
{
wallet->SetAddressBook(dest, strLabel, "send");
}
else if (mi->second.name != strLabel)
{
wallet->SetAddressBook(dest, strLabel, ""); // "" means don't change purpose
}
}
}
Q_EMIT coinsSent(wallet, rcp, transaction_array);
}
checkBalanceChanged(); // update balance immediately, otherwise there could be a short noticeable delay until pollBalanceChanged hits
return SendCoinsReturn(OK);
}
OptionsModel *WalletModel::getOptionsModel()
{
return optionsModel;
}
AddressTableModel *WalletModel::getAddressTableModel()
{
return addressTableModel;
}
TransactionTableModel *WalletModel::getTransactionTableModel()
{
return transactionTableModel;
}
RecentRequestsTableModel *WalletModel::getRecentRequestsTableModel()
{
return recentRequestsTableModel;
}
WalletModel::EncryptionStatus WalletModel::getEncryptionStatus() const
{
if(!wallet->IsCrypted())
{
return Unencrypted;
}
else if(wallet->IsLocked())
{
return Locked;
}
else
{
return Unlocked;
}
}
bool WalletModel::setWalletEncrypted(bool encrypted, const SecureString &passphrase)
{
if(encrypted)
{
// Encrypt
return wallet->EncryptWallet(passphrase);
}
else
{
// Decrypt -- TODO; not supported yet
return false;
}
}
bool WalletModel::setWalletLocked(bool locked, const SecureString &passPhrase)
{
if(locked)
{
// Lock
return wallet->Lock();
}
else
{
// Unlock
return wallet->Unlock(passPhrase);
}
}
bool WalletModel::changePassphrase(const SecureString &oldPass, const SecureString &newPass)
{
bool retval;
{
LOCK(wallet->cs_wallet);
wallet->Lock(); // Make sure wallet is locked before attempting pass change
retval = wallet->ChangeWalletPassphrase(oldPass, newPass);
}
return retval;
}
bool WalletModel::backupWallet(const QString &filename)
{
return BackupWallet(*wallet, filename.toLocal8Bit().data());
}
// Handlers for core signals
static void NotifyKeyStoreStatusChanged(WalletModel *walletmodel, CCryptoKeyStore *wallet)
{
qDebug() << "NotifyKeyStoreStatusChanged";
QMetaObject::invokeMethod(walletmodel, "updateStatus", Qt::QueuedConnection);
}
static void NotifyAddressBookChanged(WalletModel *walletmodel, CWallet *wallet,
const CTxDestination &address, const std::string &label, bool isMine,
const std::string &purpose, ChangeType status)
{
QString strAddress = QString::fromStdString(CDeuscoinAddress(address).ToString());
QString strLabel = QString::fromStdString(label);
QString strPurpose = QString::fromStdString(purpose);
qDebug() << "NotifyAddressBookChanged: " + strAddress + " " + strLabel + " isMine=" + QString::number(isMine) + " purpose=" + strPurpose + " status=" + QString::number(status);
QMetaObject::invokeMethod(walletmodel, "updateAddressBook", Qt::QueuedConnection,
Q_ARG(QString, strAddress),
Q_ARG(QString, strLabel),
Q_ARG(bool, isMine),
Q_ARG(QString, strPurpose),
Q_ARG(int, status));
}
static void NotifyTransactionChanged(WalletModel *walletmodel, CWallet *wallet, const uint256 &hash, ChangeType status)
{
Q_UNUSED(wallet);
Q_UNUSED(hash);
Q_UNUSED(status);
QMetaObject::invokeMethod(walletmodel, "updateTransaction", Qt::QueuedConnection);
}
static void ShowProgress(WalletModel *walletmodel, const std::string &title, int nProgress)
{
// emits signal "showProgress"
QMetaObject::invokeMethod(walletmodel, "showProgress", Qt::QueuedConnection,
Q_ARG(QString, QString::fromStdString(title)),
Q_ARG(int, nProgress));
}
static void NotifyWatchonlyChanged(WalletModel *walletmodel, bool fHaveWatchonly)
{
QMetaObject::invokeMethod(walletmodel, "updateWatchOnlyFlag", Qt::QueuedConnection,
Q_ARG(bool, fHaveWatchonly));
}
void WalletModel::subscribeToCoreSignals()
{
// Connect signals to wallet
wallet->NotifyStatusChanged.connect(boost::bind(&NotifyKeyStoreStatusChanged, this, _1));
wallet->NotifyAddressBookChanged.connect(boost::bind(NotifyAddressBookChanged, this, _1, _2, _3, _4, _5, _6));
wallet->NotifyTransactionChanged.connect(boost::bind(NotifyTransactionChanged, this, _1, _2, _3));
wallet->ShowProgress.connect(boost::bind(ShowProgress, this, _1, _2));
wallet->NotifyWatchonlyChanged.connect(boost::bind(NotifyWatchonlyChanged, this, _1));
}
void WalletModel::unsubscribeFromCoreSignals()
{
// Disconnect signals from wallet
wallet->NotifyStatusChanged.disconnect(boost::bind(&NotifyKeyStoreStatusChanged, this, _1));
wallet->NotifyAddressBookChanged.disconnect(boost::bind(NotifyAddressBookChanged, this, _1, _2, _3, _4, _5, _6));
wallet->NotifyTransactionChanged.disconnect(boost::bind(NotifyTransactionChanged, this, _1, _2, _3));
wallet->ShowProgress.disconnect(boost::bind(ShowProgress, this, _1, _2));
wallet->NotifyWatchonlyChanged.disconnect(boost::bind(NotifyWatchonlyChanged, this, _1));
}
// WalletModel::UnlockContext implementation
WalletModel::UnlockContext WalletModel::requestUnlock()
{
bool was_locked = getEncryptionStatus() == Locked;
if(was_locked)
{
// Request UI to unlock wallet
Q_EMIT requireUnlock();
}
// If wallet is still locked, unlock was failed or cancelled, mark context as invalid
bool valid = getEncryptionStatus() != Locked;
return UnlockContext(this, valid, was_locked);
}
WalletModel::UnlockContext::UnlockContext(WalletModel *wallet, bool valid, bool relock):
wallet(wallet),
valid(valid),
relock(relock)
{
}
WalletModel::UnlockContext::~UnlockContext()
{
if(valid && relock)
{
wallet->setWalletLocked(true);
}
}
void WalletModel::UnlockContext::CopyFrom(const UnlockContext& rhs)
{
// Transfer context; old object no longer relocks wallet
*this = rhs;
rhs.relock = false;
}
bool WalletModel::getPubKey(const CKeyID &address, CPubKey& vchPubKeyOut) const
{
return wallet->GetPubKey(address, vchPubKeyOut);
}
bool WalletModel::havePrivKey(const CKeyID &address) const
{
return wallet->HaveKey(address);
}
// returns a list of COutputs from COutPoints
void WalletModel::getOutputs(const std::vector<COutPoint>& vOutpoints, std::vector<COutput>& vOutputs)
{
LOCK2(cs_main, wallet->cs_wallet);
BOOST_FOREACH(const COutPoint& outpoint, vOutpoints)
{
if (!wallet->mapWallet.count(outpoint.hash)) continue;
int nDepth = wallet->mapWallet[outpoint.hash].GetDepthInMainChain();
if (nDepth < 0) continue;
COutput out(&wallet->mapWallet[outpoint.hash], outpoint.n, nDepth, true);
vOutputs.push_back(out);
}
}
bool WalletModel::isSpent(const COutPoint& outpoint) const
{
LOCK2(cs_main, wallet->cs_wallet);
return wallet->IsSpent(outpoint.hash, outpoint.n);
}
// AvailableCoins + LockedCoins grouped by wallet address (put change in one group with wallet address)
void WalletModel::listCoins(std::map<QString, std::vector<COutput> >& mapCoins) const
{
std::vector<COutput> vCoins;
wallet->AvailableCoins(vCoins);
LOCK2(cs_main, wallet->cs_wallet); // ListLockedCoins, mapWallet
std::vector<COutPoint> vLockedCoins;
wallet->ListLockedCoins(vLockedCoins);
// add locked coins
BOOST_FOREACH(const COutPoint& outpoint, vLockedCoins)
{
if (!wallet->mapWallet.count(outpoint.hash)) continue;
int nDepth = wallet->mapWallet[outpoint.hash].GetDepthInMainChain();
if (nDepth < 0) continue;
COutput out(&wallet->mapWallet[outpoint.hash], outpoint.n, nDepth, true);
if (outpoint.n < out.tx->vout.size() && wallet->IsMine(out.tx->vout[outpoint.n]) == ISMINE_SPENDABLE)
vCoins.push_back(out);
}
BOOST_FOREACH(const COutput& out, vCoins)
{
COutput cout = out;
while (wallet->IsChange(cout.tx->vout[cout.i]) && cout.tx->vin.size() > 0 && wallet->IsMine(cout.tx->vin[0]))
{
if (!wallet->mapWallet.count(cout.tx->vin[0].prevout.hash)) break;
cout = COutput(&wallet->mapWallet[cout.tx->vin[0].prevout.hash], cout.tx->vin[0].prevout.n, 0, true);
}
CTxDestination address;
if(!out.fSpendable || !ExtractDestination(cout.tx->vout[cout.i].scriptPubKey, address))
continue;
mapCoins[QString::fromStdString(CDeuscoinAddress(address).ToString())].push_back(out);
}
}
bool WalletModel::isLockedCoin(uint256 hash, unsigned int n) const
{
LOCK2(cs_main, wallet->cs_wallet);
return wallet->IsLockedCoin(hash, n);
}
void WalletModel::lockCoin(COutPoint& output)
{
LOCK2(cs_main, wallet->cs_wallet);
wallet->LockCoin(output);
}
void WalletModel::unlockCoin(COutPoint& output)
{
LOCK2(cs_main, wallet->cs_wallet);
wallet->UnlockCoin(output);
}
void WalletModel::listLockedCoins(std::vector<COutPoint>& vOutpts)
{
LOCK2(cs_main, wallet->cs_wallet);
wallet->ListLockedCoins(vOutpts);
}
void WalletModel::loadReceiveRequests(std::vector<std::string>& vReceiveRequests)
{
LOCK(wallet->cs_wallet);
BOOST_FOREACH(const PAIRTYPE(CTxDestination, CAddressBookData)& item, wallet->mapAddressBook)
BOOST_FOREACH(const PAIRTYPE(std::string, std::string)& item2, item.second.destdata)
if (item2.first.size() > 2 && item2.first.substr(0,2) == "rr") // receive request
vReceiveRequests.push_back(item2.second);
}
bool WalletModel::saveReceiveRequest(const std::string &sAddress, const int64_t nId, const std::string &sRequest)
{
CTxDestination dest = CDeuscoinAddress(sAddress).Get();
std::stringstream ss;
ss << nId;
std::string key = "rr" + ss.str(); // "rr" prefix = "receive request" in destdata
LOCK(wallet->cs_wallet);
if (sRequest.empty())
return wallet->EraseDestData(dest, key);
else
return wallet->AddDestData(dest, key, sRequest);
}
| [
"a987@mac.com"
] | a987@mac.com |
4d0465ca25e489cefd46265c4c636afcda3da296 | 9d2bafb07baf657c447d09a6bc5a6e551ba1806d | /ros2_ws/build/test_communication/rosidl_typesupport_introspection_cpp/test_communication/msg/dynamic_array_primitives__type_support.cpp | 85f7008f637cdd70c0ab52f1e9268f85a86fd80b | [] | no_license | weidafan/ros2_dds | f65c4352899a72e1ade662b4106e822d80a99403 | c0d9e6ff97cb7cc822fe25a62c0b1d56f7d12c59 | refs/heads/master | 2021-09-05T20:47:49.088161 | 2018-01-30T21:03:59 | 2018-01-30T21:03:59 | 119,592,597 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 11,177 | cpp | // generated from rosidl_typesupport_introspection_cpp/resource/msg__type_support.cpp.em
// generated code does not contain a copyright notice
// providing offsetof()
#include <cstddef>
#include <vector>
#include "rosidl_generator_c/message_type_support_struct.h"
#include "rosidl_typesupport_cpp/message_type_support.hpp"
#include "rosidl_typesupport_interface/macros.h"
#include "test_communication/msg/dynamic_array_primitives__struct.hpp"
#include "rosidl_typesupport_introspection_cpp/field_types.hpp"
#include "rosidl_typesupport_introspection_cpp/identifier.hpp"
#include "rosidl_typesupport_introspection_cpp/message_introspection.hpp"
#include "rosidl_typesupport_introspection_cpp/message_type_support_decl.hpp"
#include "rosidl_typesupport_introspection_cpp/visibility_control.h"
namespace test_communication
{
namespace msg
{
namespace rosidl_typesupport_introspection_cpp
{
static const ::rosidl_typesupport_introspection_cpp::MessageMember DynamicArrayPrimitives_message_member_array[15] = {
{
"bool_values", // name
::rosidl_typesupport_introspection_cpp::ROS_TYPE_BOOL, // type
0, // upper bound of string
nullptr, // members of sub message
true, // is array
0, // array size
false, // is upper bound
offsetof(test_communication::msg::DynamicArrayPrimitives, bool_values), // bytes offset in struct
nullptr, // default value
nullptr, // size() function pointer
nullptr, // get_const(index) function pointer
nullptr, // get(index) function pointer
nullptr // resize(index) function pointer
},
{
"byte_values", // name
::rosidl_typesupport_introspection_cpp::ROS_TYPE_BYTE, // type
0, // upper bound of string
nullptr, // members of sub message
true, // is array
0, // array size
false, // is upper bound
offsetof(test_communication::msg::DynamicArrayPrimitives, byte_values), // bytes offset in struct
nullptr, // default value
nullptr, // size() function pointer
nullptr, // get_const(index) function pointer
nullptr, // get(index) function pointer
nullptr // resize(index) function pointer
},
{
"char_values", // name
::rosidl_typesupport_introspection_cpp::ROS_TYPE_CHAR, // type
0, // upper bound of string
nullptr, // members of sub message
true, // is array
0, // array size
false, // is upper bound
offsetof(test_communication::msg::DynamicArrayPrimitives, char_values), // bytes offset in struct
nullptr, // default value
nullptr, // size() function pointer
nullptr, // get_const(index) function pointer
nullptr, // get(index) function pointer
nullptr // resize(index) function pointer
},
{
"float32_values", // name
::rosidl_typesupport_introspection_cpp::ROS_TYPE_FLOAT32, // type
0, // upper bound of string
nullptr, // members of sub message
true, // is array
0, // array size
false, // is upper bound
offsetof(test_communication::msg::DynamicArrayPrimitives, float32_values), // bytes offset in struct
nullptr, // default value
nullptr, // size() function pointer
nullptr, // get_const(index) function pointer
nullptr, // get(index) function pointer
nullptr // resize(index) function pointer
},
{
"float64_values", // name
::rosidl_typesupport_introspection_cpp::ROS_TYPE_FLOAT64, // type
0, // upper bound of string
nullptr, // members of sub message
true, // is array
0, // array size
false, // is upper bound
offsetof(test_communication::msg::DynamicArrayPrimitives, float64_values), // bytes offset in struct
nullptr, // default value
nullptr, // size() function pointer
nullptr, // get_const(index) function pointer
nullptr, // get(index) function pointer
nullptr // resize(index) function pointer
},
{
"int8_values", // name
::rosidl_typesupport_introspection_cpp::ROS_TYPE_INT8, // type
0, // upper bound of string
nullptr, // members of sub message
true, // is array
0, // array size
false, // is upper bound
offsetof(test_communication::msg::DynamicArrayPrimitives, int8_values), // bytes offset in struct
nullptr, // default value
nullptr, // size() function pointer
nullptr, // get_const(index) function pointer
nullptr, // get(index) function pointer
nullptr // resize(index) function pointer
},
{
"uint8_values", // name
::rosidl_typesupport_introspection_cpp::ROS_TYPE_UINT8, // type
0, // upper bound of string
nullptr, // members of sub message
true, // is array
0, // array size
false, // is upper bound
offsetof(test_communication::msg::DynamicArrayPrimitives, uint8_values), // bytes offset in struct
nullptr, // default value
nullptr, // size() function pointer
nullptr, // get_const(index) function pointer
nullptr, // get(index) function pointer
nullptr // resize(index) function pointer
},
{
"int16_values", // name
::rosidl_typesupport_introspection_cpp::ROS_TYPE_INT16, // type
0, // upper bound of string
nullptr, // members of sub message
true, // is array
0, // array size
false, // is upper bound
offsetof(test_communication::msg::DynamicArrayPrimitives, int16_values), // bytes offset in struct
nullptr, // default value
nullptr, // size() function pointer
nullptr, // get_const(index) function pointer
nullptr, // get(index) function pointer
nullptr // resize(index) function pointer
},
{
"uint16_values", // name
::rosidl_typesupport_introspection_cpp::ROS_TYPE_UINT16, // type
0, // upper bound of string
nullptr, // members of sub message
true, // is array
0, // array size
false, // is upper bound
offsetof(test_communication::msg::DynamicArrayPrimitives, uint16_values), // bytes offset in struct
nullptr, // default value
nullptr, // size() function pointer
nullptr, // get_const(index) function pointer
nullptr, // get(index) function pointer
nullptr // resize(index) function pointer
},
{
"int32_values", // name
::rosidl_typesupport_introspection_cpp::ROS_TYPE_INT32, // type
0, // upper bound of string
nullptr, // members of sub message
true, // is array
0, // array size
false, // is upper bound
offsetof(test_communication::msg::DynamicArrayPrimitives, int32_values), // bytes offset in struct
nullptr, // default value
nullptr, // size() function pointer
nullptr, // get_const(index) function pointer
nullptr, // get(index) function pointer
nullptr // resize(index) function pointer
},
{
"uint32_values", // name
::rosidl_typesupport_introspection_cpp::ROS_TYPE_UINT32, // type
0, // upper bound of string
nullptr, // members of sub message
true, // is array
0, // array size
false, // is upper bound
offsetof(test_communication::msg::DynamicArrayPrimitives, uint32_values), // bytes offset in struct
nullptr, // default value
nullptr, // size() function pointer
nullptr, // get_const(index) function pointer
nullptr, // get(index) function pointer
nullptr // resize(index) function pointer
},
{
"int64_values", // name
::rosidl_typesupport_introspection_cpp::ROS_TYPE_INT64, // type
0, // upper bound of string
nullptr, // members of sub message
true, // is array
0, // array size
false, // is upper bound
offsetof(test_communication::msg::DynamicArrayPrimitives, int64_values), // bytes offset in struct
nullptr, // default value
nullptr, // size() function pointer
nullptr, // get_const(index) function pointer
nullptr, // get(index) function pointer
nullptr // resize(index) function pointer
},
{
"uint64_values", // name
::rosidl_typesupport_introspection_cpp::ROS_TYPE_UINT64, // type
0, // upper bound of string
nullptr, // members of sub message
true, // is array
0, // array size
false, // is upper bound
offsetof(test_communication::msg::DynamicArrayPrimitives, uint64_values), // bytes offset in struct
nullptr, // default value
nullptr, // size() function pointer
nullptr, // get_const(index) function pointer
nullptr, // get(index) function pointer
nullptr // resize(index) function pointer
},
{
"string_values", // name
::rosidl_typesupport_introspection_cpp::ROS_TYPE_STRING, // type
0, // upper bound of string
nullptr, // members of sub message
true, // is array
0, // array size
false, // is upper bound
offsetof(test_communication::msg::DynamicArrayPrimitives, string_values), // bytes offset in struct
nullptr, // default value
nullptr, // size() function pointer
nullptr, // get_const(index) function pointer
nullptr, // get(index) function pointer
nullptr // resize(index) function pointer
},
{
"check", // name
::rosidl_typesupport_introspection_cpp::ROS_TYPE_INT32, // type
0, // upper bound of string
nullptr, // members of sub message
false, // is array
0, // array size
false, // is upper bound
offsetof(test_communication::msg::DynamicArrayPrimitives, check), // bytes offset in struct
nullptr, // default value
nullptr, // size() function pointer
nullptr, // get_const(index) function pointer
nullptr, // get(index) function pointer
nullptr // resize(index) function pointer
}
};
static const ::rosidl_typesupport_introspection_cpp::MessageMembers DynamicArrayPrimitives_message_members = {
"test_communication", // package name
"DynamicArrayPrimitives", // message name
15, // number of fields
sizeof(test_communication::msg::DynamicArrayPrimitives),
DynamicArrayPrimitives_message_member_array // message members
};
static const rosidl_message_type_support_t DynamicArrayPrimitives_message_type_support_handle = {
::rosidl_typesupport_introspection_cpp::typesupport_identifier,
&DynamicArrayPrimitives_message_members,
get_message_typesupport_handle_function,
};
} // namespace rosidl_typesupport_introspection_cpp
} // namespace msg
} // namespace test_communication
namespace rosidl_typesupport_introspection_cpp
{
template<>
ROSIDL_TYPESUPPORT_INTROSPECTION_CPP_PUBLIC
const rosidl_message_type_support_t *
get_message_type_support_handle<test_communication::msg::DynamicArrayPrimitives>()
{
return &::test_communication::msg::rosidl_typesupport_introspection_cpp::DynamicArrayPrimitives_message_type_support_handle;
}
} // namespace rosidl_typesupport_introspection_cpp
#ifdef __cplusplus
extern "C"
{
#endif
ROSIDL_TYPESUPPORT_INTROSPECTION_CPP_PUBLIC
const rosidl_message_type_support_t *
ROSIDL_TYPESUPPORT_INTERFACE__MESSAGE_SYMBOL_NAME(rosidl_typesupport_introspection_cpp, test_communication, msg, DynamicArrayPrimitives)() {
return &::test_communication::msg::rosidl_typesupport_introspection_cpp::DynamicArrayPrimitives_message_type_support_handle;
}
#ifdef __cplusplus
}
#endif
| [
"austin.tisdale.15@cnu.edu"
] | austin.tisdale.15@cnu.edu |
5d8291f8630fda6950e325e79cac0c09a7cba74c | 3b6bea9eedc2f173519a1697c751a045151ad2f1 | /VulkanWrapper/VulkanCore.cpp | cc1baf514c3dc8e66c3f3b0741d5d632dc94d721 | [] | no_license | Caerind/VulkanTest | 93af9b38e06435739327e7c1753d12028a5d6aa5 | 566c1fb30c9a12c8218fb1fc0cfaad4b1b81b321 | refs/heads/master | 2021-10-28T00:48:35.424822 | 2019-04-20T22:22:38 | 2019-04-20T22:22:38 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,767 | cpp | #include "VulkanCore.hpp"
#if (defined VULKAN_OPTION_LOG)
#include <cstdarg>
#include <cstdio>
#endif
VULKAN_NAMESPACE_BEGIN
namespace VulkanPriv
{
const VulkanU32 gLogBufferSize = 1024;
char gLogFormatBuffer[gLogBufferSize];
char gLogFinalBuffer[gLogBufferSize];
void printLog(const char* logType, const char* str, ...)
{
#if (defined VULKAN_OPTION_LOG || defined VULKAN_OPTION_ASSERT)
va_list args;
va_start(args, str);
vsprintf_s(gLogFormatBuffer, str, args); // TODO : vsrpintf without _s for not VS
va_end(args);
sprintf_s(gLogFinalBuffer, "[%s] %s\n", logType, gLogFormatBuffer);
printf(gLogFinalBuffer);
#if (defined VULKAN_PLATFORM_WINDOWS && defined(_MSC_VER)) // VisualStudio
OutputDebugStringA(gLogFinalBuffer);
#endif
#endif
}
}
const char* objectTypeToCString(VulkanObjectType type)
{
switch (type)
{
case VulkanObjectType_Unknown: return "Unknown";
case VulkanObjectType_Buffer: return "Buffer";
case VulkanObjectType_BufferView: return "BufferView";
case VulkanObjectType_CommandBuffer: return "CommandBuffer";
case VulkanObjectType_CommandPool: return "CommandPool";
case VulkanObjectType_ComputePipeline: return "ComputePipeline";
case VulkanObjectType_DescriptorPool: return "DescriptorPool";
case VulkanObjectType_DescriptorSet: return "DescriptorSet";
case VulkanObjectType_DescriptorSetLayout: return "DescriptorSetLayout";
case VulkanObjectType_Device: return "Device";
case VulkanObjectType_Fence: return "Fence";
case VulkanObjectType_Framebuffer: return "Framebuffer";
case VulkanObjectType_GraphicsPipeline: return "GraphicsPipeline";
case VulkanObjectType_Image: return "Image";
case VulkanObjectType_ImageView: return "ImageView";
case VulkanObjectType_Instance: return "Instance";
case VulkanObjectType_MemoryBlock: return "MemoryBlock";
case VulkanObjectType_PipelineCache: return "PipelineCache";
case VulkanObjectType_PipelineLayout: return "PipelineLayout";
case VulkanObjectType_Queue: return "Queue";
case VulkanObjectType_RenderPass: return "RenderPass";
case VulkanObjectType_Sampler: return "Sampler";
case VulkanObjectType_Semaphore: return "Semaphore";
case VulkanObjectType_ShaderModule: return "ShaderModule";
case VulkanObjectType_Surface: return "Surface";
case VulkanObjectType_Swapchain: return "Swapchain";
default: return "<unknown>"; // TODO : Find how to identify easily "Unknown" types
}
}
VULKAN_NAMESPACE_END
#if (defined VULKAN_OPTION_OBJECTTRACKER)
VULKAN_NAMESPACE_BEGIN
void VulkanObjectTracker::printCurrentState()
{
/*
// TODO : Log with VA_ARGS
for (auto typeItr = sObjects.begin(); typeItr != sObjects.end(); typeItr++)
{
std::vector<VulkanObject*>& objectsOfType = typeItr->second;
//VULKAN_LOG_INFO("Type: %s [%d]", objectTypeToCString(typeItr->first), objectsOfType.size());
#if (defined VULKAN_OPTION_OBJECTNAMES)
for (VulkanObject* object : objectsOfType)
{
VULKAN_LOG_INFO(" - %s", object->getName());
}
#endif // (defined VULKAN_OPTION_OBJECTNAMES)
}
*/
}
VulkanU32 VulkanObjectTracker::getLeaksCount()
{
VulkanU32 count = 0;
/*
for (auto typeItr = sObjects.begin(); typeItr != sObjects.end(); typeItr++)
{
count += typeItr->second.size();
}
*/
return count;
}
bool VulkanObjectTracker::hasLeaks()
{
return sObjects.size() > 0;
}
VulkanU64 VulkanObjectTracker::getTotalObjectsCreatedForType(VulkanObjectType type)
{
return sObjectsCreatedTotal[type];
}
VulkanU64 VulkanObjectTracker::getTotalObjectsCreated()
{
VulkanU64 count = 0;
/*
for (VulkanU32 i = 0; i < VulkanObjectType_Max; i++)
{
count += sObjectsCreatedTotal[(VulkanObjectType)i];
}
*/
return count;
}
void VulkanObjectTracker::registerObject(VulkanObjectBase* object)
{
/*
VULKAN_ASSERT(object != nullptr);
sObjects[object->getType()].push_back(object);
sObjectsCreatedTotal[object->getType()]++;
*/
}
void VulkanObjectTracker::unregisterObject(VulkanObjectBase* object)
{
/*
VULKAN_ASSERT(object != nullptr);
auto typeItr = sObjects.find(object->getType());
if (typeItr != sObjects.end())
{
std::vector<VulkanObject*>& objectsOfType = typeItr->second;
for (auto objItr = objectsOfType.rbegin(); objItr != objectsOfType.rend();)
{
if (*objItr == object)
{
objItr = objectsOfType.erase(objItr);
break;
}
else
{
objItr++;
}
}
if (objectsOfType.size() == 0)
{
sObjects.erase(typeItr);
}
}
*/
}
std::unordered_multimap<VulkanObjectType, VulkanObjectBase*> VulkanObjectTracker::sObjects;
VulkanU64 VulkanObjectTracker::sObjectsCreatedTotal[VulkanObjectType_Max];
VULKAN_NAMESPACE_END
#endif // (defined VULKAN_OPTION_OBJECTTRACKER) | [
"charles.mailly@free.fr"
] | charles.mailly@free.fr |
858bc7a2647bed74d4cd37ade54f394a562a8530 | 268108c8d18f0087551af09b78211584efb9ae17 | /open-MPI codes/Poisson_Jacobi.cpp | 50c99fcdedf3cd4b479313a5074028bc81b89fca | [] | no_license | rudranshj/Parallel-Computing | 3988758b56a62ba9604d1db3fcd0f902a2248ab3 | 9ba2f7c70e63546a5c53bfadd924a63c7a1d9bd0 | refs/heads/main | 2023-05-11T01:36:47.911051 | 2021-06-04T17:56:25 | 2021-06-04T17:56:25 | 362,931,083 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,741 | cpp | // Jacobi Iteration using MPI
// Author: Rudransh Jaiswal ME17B063
#include <iostream>
#include <mpi.h>
#include <math.h>
using namespace std;
double fq(double x, double y){
return 2*(2 - x*x - y*y);
}
double phi_calc(double x, double y){
return (pow(x,2)-1)*(pow(y,2)-1);
}
int main(int argc, char** argv){
int myid,size,n,n_iters;
double *Phi_local,*Phi,*Phi_exact,*qvals,d, *Phi_final,eps,tol,tot_tol,start_t,end_t;
MPI_Status status;
MPI_Init(&argc, &argv);
MPI_Comm_size(MPI_COMM_WORLD, &size);
MPI_Comm_rank(MPI_COMM_WORLD, &myid);
n=22; // n should be of the form size*k+2; size=no of processes
d=2.0/(n-1);
n_iters=0;
eps=0.01; //epsilon: allowed tolerance
tot_tol=0.0;
if(size==1 || (n-2)%size > 0){
if(myid==0){
cout<<"Value Error: Ensure that (n-2)%n_procs = 0 and n_procs>1, here n="<<n<<", n_procs="<<size<<endl;
cout<<" Please set n and n_procs accordingly"<<endl;
if(size==1){cout<<" for n_procs=1 run jacobi_serial.cpp"<<endl; }
cout<<" Quitting..."<<endl;
}
MPI_Finalize();
return 0;
}
if(myid==0){
start_t=MPI_Wtime();
}
qvals=(double*)malloc((n*(n-2)/size)*n*sizeof(double)); //only local
Phi_exact=(double*)malloc((n*(n-2)/size)*n*sizeof(double));
for(int i=0; i<(n-2)/size; i++){
int i1=i+1+myid*(n-2)/size;
for(int j=0; j<n; j++){
qvals[i*n+j] = fq(-1+i1*d,-1+j*d);
Phi_exact[i*n + j] = phi_calc(-1+i1*d,-1+j*d);
}
}
Phi=(double*)malloc(n*(2 + ((n-2)/size) )*sizeof(double));
for(int i=0; i<(2 + (n-2)/size); i++){
for(int j=0; j<n; j++){
Phi[i*n+j]=0.0;
}
}
Phi_local=(double*)malloc((n*(n-2)/size)*sizeof(double)); //only local, temp. stores the new values
for(int i=0; i<n*(n-2)/size; i++){
Phi_local[i]=0.0;
}
// MAIN ALGORITHM
while(n_iters==0 or tot_tol>eps){
tol=0.0;
if(n_iters>0){
MPI_Recv(Phi+n,n*(n-2)/size,MPI_DOUBLE,myid,0,MPI_COMM_WORLD,MPI_STATUS_IGNORE); //from Phi_local of self
if(myid==0){
MPI_Recv(Phi+n*(1+(n-2)/size),n,MPI_DOUBLE,myid+1,2,MPI_COMM_WORLD,MPI_STATUS_IGNORE);
}
else if(myid==size-1){
MPI_Recv(Phi,n,MPI_DOUBLE,myid-1,1,MPI_COMM_WORLD,MPI_STATUS_IGNORE);
}
else{
MPI_Recv(Phi,n,MPI_DOUBLE,myid-1,1,MPI_COMM_WORLD,MPI_STATUS_IGNORE); //from Phi_local of self-1
MPI_Recv(Phi+n*(1+(n-2)/size),n,MPI_DOUBLE,myid+1,2,MPI_COMM_WORLD,MPI_STATUS_IGNORE); //from Phi_local of self
}
}
for(int i=0; i<(n-2)/size; i++){
for(int j=1; j<n-1; j++){ //0 for j=0 or j=n-1
Phi_local[i*n+j]= 0.25*(Phi[(i+2)*n+j] + Phi[i*n+j] + Phi[(i+1)*n+j+1] + Phi[(i+1)*n+j-1] + d*d*qvals[i*n+j]);
tol += pow(Phi_local[i*n+j]-Phi_exact[i*n + j],2);
// cout<<"tol: "<<tol<<endl;
}
}
MPI_Allreduce(&tol, &tot_tol, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD);
MPI_Send(Phi_local,n*(n-2)/size,MPI_DOUBLE,myid,0,MPI_COMM_WORLD); //to same process
if(myid>0){MPI_Send(Phi_local,n,MPI_DOUBLE,myid-1,2,MPI_COMM_WORLD);} //to previous process
if(myid<size-1){MPI_Send(Phi_local+n*(-1 + (n-2)/size),n,MPI_DOUBLE,myid+1,1,MPI_COMM_WORLD);} //to next process
n_iters+=1;
}
MPI_Barrier(MPI_COMM_WORLD);
if(myid==0){
Phi_final=(double*)malloc((n*n)*sizeof(double));
for(int i=0; i<n; i++){
Phi_final[i]=0.0;
Phi_final[n*n-i-1]=0.0;
}
}
MPI_Gather(Phi+n,n*(n-2)/size,MPI_DOUBLE,Phi_final+n,n*(n-2)/size,MPI_DOUBLE,0,MPI_COMM_WORLD);
if(myid==0){
end_t=MPI_Wtime();
cout<<"For n = "<<n<<", delta = "<<d<<", n_procs = "<<size<<endl;
cout<<" n_iters: "<<n_iters<<endl;
cout<<" Time of Execution: "<<end_t-start_t<<"s"<<endl;
// cout<<" Time of execution: "<<toe<<endl;
// cout<<"Value of Phi(x,0.52381): "
// for(int j=0; j<n; j++){
// cout<<Phi_final[16*n +j]<<", ";
// }
// cout<<endl;
}
MPI_Finalize();
return 1;
}
| [
"noreply@github.com"
] | noreply@github.com |
363afb7eb4c1ed0a29111aca762a14e94f1503c1 | a5f35d0dfaddb561d3595c534b6b47f304dbb63d | /Source/BansheeCore/RTTI/BsPixelDataRTTI.h | a8f98376e33f01aa254a2869099cc5c73a03bf52 | [] | no_license | danielkrupinski/BansheeEngine | 3ff835e59c909853684d4985bd21bcfa2ac86f75 | ae820eb3c37b75f2998ddeaf7b35837ceb1bbc5e | refs/heads/master | 2021-05-12T08:30:30.564763 | 2018-01-27T12:55:25 | 2018-01-27T12:55:25 | 117,285,819 | 1 | 0 | null | 2018-01-12T20:38:41 | 2018-01-12T20:38:41 | null | UTF-8 | C++ | false | false | 3,451 | h | //********************************** Banshee Engine (www.banshee3d.com) **************************************************//
//**************** Copyright (c) 2016 Marko Pintera (marko.pintera@gmail.com). All rights reserved. **********************//
#pragma once
#include "BsCorePrerequisites.h"
#include "Image/BsPixelData.h"
#include "Reflection/BsRTTIType.h"
#include "FileSystem/BsDataStream.h"
namespace bs
{
/** @cond RTTI */
/** @addtogroup RTTI-Impl-Core
* @{
*/
class BS_CORE_EXPORT PixelDataRTTI : public RTTIType<PixelData, GpuResourceData, PixelDataRTTI>
{
UINT32& getLeft(PixelData* obj) { return obj->mExtents.left; }
void setLeft(PixelData* obj, UINT32& val) { obj->mExtents.left = val; }
UINT32& getTop(PixelData* obj) { return obj->mExtents.top; }
void setTop(PixelData* obj, UINT32& val) { obj->mExtents.top = val; }
UINT32& getRight(PixelData* obj) { return obj->mExtents.right; }
void setRight(PixelData* obj, UINT32& val) { obj->mExtents.right = val; }
UINT32& getBottom(PixelData* obj) { return obj->mExtents.bottom; }
void setBottom(PixelData* obj, UINT32& val) { obj->mExtents.bottom = val; }
UINT32& getFront(PixelData* obj) { return obj->mExtents.front; }
void setFront(PixelData* obj, UINT32& val) { obj->mExtents.front = val; }
UINT32& getBack(PixelData* obj) { return obj->mExtents.back; }
void setBack(PixelData* obj, UINT32& val) { obj->mExtents.back = val; }
UINT32& getRowPitch(PixelData* obj) { return obj->mRowPitch; }
void setRowPitch(PixelData* obj, UINT32& val) { obj->mRowPitch = val; }
UINT32& getSlicePitch(PixelData* obj) { return obj->mSlicePitch; }
void setSlicePitch(PixelData* obj, UINT32& val) { obj->mSlicePitch = val; }
PixelFormat& getFormat(PixelData* obj) { return obj->mFormat; }
void setFormat(PixelData* obj, PixelFormat& val) { obj->mFormat = val; }
SPtr<DataStream> getData(PixelData* obj, UINT32& size)
{
size = obj->getConsecutiveSize();
return bs_shared_ptr_new<MemoryDataStream>(obj->getData(), size, false);
}
void setData(PixelData* obj, const SPtr<DataStream>& value, UINT32 size)
{
obj->allocateInternalBuffer(size);
value->read(obj->getData(), size);
}
public:
PixelDataRTTI()
{
addPlainField("left", 0, &PixelDataRTTI::getLeft, &PixelDataRTTI::setLeft);
addPlainField("top", 1, &PixelDataRTTI::getTop, &PixelDataRTTI::setTop);
addPlainField("right", 2, &PixelDataRTTI::getRight, &PixelDataRTTI::setRight);
addPlainField("bottom", 3, &PixelDataRTTI::getBottom, &PixelDataRTTI::setBottom);
addPlainField("front", 4, &PixelDataRTTI::getFront, &PixelDataRTTI::setFront);
addPlainField("back", 5, &PixelDataRTTI::getBack, &PixelDataRTTI::setBack);
addPlainField("rowPitch", 6, &PixelDataRTTI::getRowPitch, &PixelDataRTTI::setRowPitch);
addPlainField("slicePitch", 7, &PixelDataRTTI::getSlicePitch, &PixelDataRTTI::setSlicePitch);
addPlainField("format", 8, &PixelDataRTTI::getFormat, &PixelDataRTTI::setFormat);
addDataBlockField("data", 9, &PixelDataRTTI::getData, &PixelDataRTTI::setData, 0);
}
virtual const String& getRTTIName() override
{
static String name = "PixelData";
return name;
}
virtual UINT32 getRTTIId() override
{
return TID_PixelData;
}
virtual SPtr<IReflectable> newRTTIObject() override
{
SPtr<PixelData> newPixelData = bs_shared_ptr_new<PixelData>();
return newPixelData;
}
};
/** @} */
/** @endcond */
} | [
"bearishsun@gmail.com"
] | bearishsun@gmail.com |
0fa8c17d7d26f2e033af4c6420ff949799e1d10e | 8530cd75cb603954bf76cc53244701a2024d9693 | /GocatorCamera/ReceiveDataAsync.cpp | d7fa87ff7ab5e8f6b982ddb85ff6b4e3dd529420 | [] | no_license | qihangwang/GoCatCam3D | c34d574c8c409e7b514050a0d7de1cb08ea8de1c | 301c2baecf4774d34d38c73955ecdcf53674a97b | refs/heads/master | 2023-03-16T03:48:11.917475 | 2019-08-21T11:27:22 | 2019-08-21T11:27:22 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 14,993 | cpp | // ReceiveDataAsync.cpp: 实现文件
//
// ReceiveDataAsync 消息处理程序
/*
* ReceiveASync.c
*
* Gocator 2000 Sample
* Copyright (C) 2011-2018 by LMI Technologies Inc.
*
* Licensed under The MIT License.
* Redistributions of files must retain the above copyright notice.
*
* Purpose: Connect to Gocator system and receive data using a callback function.
* Ethernet output for the desired data must be enabled.
*
*/
#include "stdafx.h"
#include "GocatorCamera.h"
#include <Windows.h>
#include "ReceiveDataAsync.h"
#include "afxdialogex.h"
#include "CCLogWnd.h"
#define SENSOR_IP "192.168.1.10"
#define NUM_PROFILES 5
//#define INFO 1 将各个量定义为
//#define WARN 2
//#define ERR 3
#pragma warning(disable:4002)
#pragma warning(disable:4244)
#pragma warning(disable:6011)
#pragma warning(disable:4018)
#pragma warning(disable:6387)
#pragma warning(disable:6386)
#pragma warning(disable:6328)
#pragma warning(disable:26495)
kStatus kCall onReceiveAsyncData(void* ctx, void* sys, void* dataset);
CLogWnd *m_AsyncLogDlg;
CStatic m_asyncTxt;
CString AsyncStrOut = NULL;
CString AsyncStrTemp = NULL;
CEdit m_asyEditTxt;
#define NM_TO_MM(VALUE) (((k64f)(VALUE))/1000000.0)
#define UM_TO_MM(VALUE) (((k64f)(VALUE))/1000.0)
#define INVALID_RANGE_16BIT ((signed short)0x8000) // gocator transmits range data as 16-bit signed integers. 0x8000 signifies invalid range data.
#define INVALID_RANGE_DOUBLE ((k64f)-DOUBLE_MAX) // floating point value to represent invalid range data.
typedef struct
{
double x; // x-coordinate in engineering units (mm) - position along laser line
double y; // y-coordinate in engineering units (mm) - position along the direction of travel
double z; // z-coordinate in engineering units (mm) - height (at the given x position)
unsigned char intensity;
}ProfilePoint;
short int* Asy_height_map_memory = NULL;
unsigned char* Asy_intensity_image_memory = NULL;
ProfilePoint** Ast_surfaceBuffer = NULL;
//unsigned int rowIdx, colIdx;
unsigned int AsyLength, AsyWidth;
k32u Asy_surfaceBufferHeight = 0;
typedef struct
{
k32u count;
}DataContext;
// ReceiveDataAsync 对话框
IMPLEMENT_DYNAMIC(ReceiveDataAsync, CDialogEx)
//定义一个全局指针
ReceiveDataAsync* Asyn_dlg = NULL;
ReceiveDataAsync::ReceiveDataAsync(CWnd* pParent /*=nullptr*/)
: CDialogEx(IDD_RECEIVEASYNC, pParent)
{
//Rev_dlg = this;
#ifndef _WIN32_WCE
EnableActiveAccessibility();
#endif
}
ReceiveDataAsync::~ReceiveDataAsync()
{
}
void ReceiveDataAsync::DoDataExchange(CDataExchange* pDX)
{
CDialogEx::DoDataExchange(pDX);
DDX_Control(pDX, IDC_ASYNCSTATIC, m_asyEditTxt);
}
BEGIN_MESSAGE_MAP(ReceiveDataAsync, CDialogEx)
ON_BN_CLICKED(IDOK, &ReceiveDataAsync::OnBnClickedOk)
ON_BN_CLICKED(IDC_ASYN_REFLESH, &ReceiveDataAsync::OnBnClickedAsynReflesh)
END_MESSAGE_MAP()
BOOL ReceiveDataAsync::OnInitDialog()
{
CDialogEx::OnInitDialog();
Asyn_dlg = this;
return TRUE;
}
//data callback function
kStatus kCall onReceiveAsyncData(void* ctx, void* sys, void* dataset)
{
unsigned int i, j;
DataContext *context = (DataContext *)ctx;
//引用 https://www.cnblogs.com/ike_li/p/4431961.html
//TODO 问题在于初始化的时候没用重载OnInit函数,定义全局变量应该没用成功
//下一步问题在于重载函数,链接相机测试运行
//ReceiveDataAsync m_useLogDlg = Rev_dlg; //直接使用就可以了
AsyncStrTemp.Format(_T("程序进入异步回调事件中-----\r\n"));
AsyncStrOut += AsyncStrTemp;
AsyncStrTemp.Format(_T("Callback:\r\n"));
AsyncStrOut += AsyncStrTemp;
AsyncStrTemp.Format(_T("Data message received:\r\n"));
AsyncStrOut += AsyncStrTemp;
AsyncStrTemp.Format(_T("Dataset count: %u\r\n"), GoDataSet_Count(dataset));
//AsyncStrTemp.Format(_T("Dataset count: %u\r\n", GoDataSet_Count(dataset))); //原测试方法
AsyncStrOut += AsyncStrTemp;
//m_asyEditTxt.SetWindowText(AsyncStrOut);
Asyn_dlg->m_asyEditTxt.SetWindowText(AsyncStrOut);
/*m_asyEditTxt.SetSel(-1, 0, FALSE);
m_asyEditTxt.SetFocus();*/
Asyn_dlg->m_asyEditTxt.SetSel(-1, 0, FALSE);
Asyn_dlg->m_asyEditTxt.SetFocus();
Asyn_dlg->m_asyEditTxt.PostMessage(WM_VSCROLL, SB_BOTTOM, 0);
for (i = 0; i < GoDataSet_Count(dataset); ++i)
{
GoDataMsg dataObj = GoDataSet_At(dataset, i);
// retrieve GoStamp message
switch (GoDataMsg_Type(dataObj))
{
case GO_DATA_MESSAGE_TYPE_STAMP:
{
GoStampMsg stampMsg = dataObj;
for (j = 0; j < GoStampMsg_Count(stampMsg); ++j)
{
GoStamp *stamp = GoStampMsg_At(stampMsg, j);
AsyncStrTemp.Format(_T(" Timestamp: %11u\r\n"), stamp->timestamp);
AsyncStrOut += AsyncStrTemp;
AsyncStrTemp.Format(_T(" Encoder: %11d\r\n"), stamp->encoder);
AsyncStrOut += AsyncStrTemp;;
AsyncStrTemp.Format(_T(" Frame index: %11u\r\n"), stamp->frameIndex);
AsyncStrOut += AsyncStrTemp;
//SetDlgItemText((HWND)IDC_ASYNCSTATIC, 1020, AsyncStrOut);
Asyn_dlg->m_asyEditTxt.SetWindowText(AsyncStrOut);
context->count++;
}
}
break;
case GO_DATA_MESSAGE_TYPE_UNIFORM_SURFACE:
{
GoSurfaceMsg surfaceMsg = dataObj;
unsigned int rowIdx, colIdx;
double XResolution = NM_TO_MM(GoSurfaceMsg_XResolution(surfaceMsg));
double YResolution = NM_TO_MM(GoSurfaceMsg_YResolution(surfaceMsg));
double ZResolution = NM_TO_MM(GoSurfaceMsg_ZResolution(surfaceMsg));
double XOffset = UM_TO_MM(GoSurfaceMsg_XOffset(surfaceMsg));
double YOffset = UM_TO_MM(GoSurfaceMsg_YOffset(surfaceMsg));
double ZOffset = UM_TO_MM(GoSurfaceMsg_ZOffset(surfaceMsg));
AsyncStrTemp.Format(_T(" Surface data width: %ld\r\n"), GoSurfaceMsg_Width(surfaceMsg));
AsyncStrOut += AsyncStrTemp;
AsyncStrTemp.Format(_T(" Surface data length: %ld\r\n\r\n"), GoSurfaceMsg_Length(surfaceMsg));
AsyncStrOut += AsyncStrTemp;;
Asyn_dlg->m_asyEditTxt.SetWindowText(AsyncStrOut);
//allocate memory if needed
if (Ast_surfaceBuffer == NULL)
{
Ast_surfaceBuffer = (ProfilePoint * *)malloc(GoSurfaceMsg_Length(surfaceMsg) * sizeof(ProfilePoint*));
for (j = 0; j < GoSurfaceMsg_Length(surfaceMsg); j++)
{
Ast_surfaceBuffer[j] = (ProfilePoint*)malloc(GoSurfaceMsg_Width(surfaceMsg) * sizeof(ProfilePoint));
}
Asy_surfaceBufferHeight = GoSurfaceMsg_Length(surfaceMsg);
}
for (rowIdx = 0; rowIdx < GoSurfaceMsg_Length(surfaceMsg); rowIdx++)
{
k16s* data = GoSurfaceMsg_RowAt(surfaceMsg, rowIdx);
for (colIdx = 0; colIdx < GoSurfaceMsg_Width(surfaceMsg); colIdx++)
{
// gocator transmits range data as 16-bit signed integers
// to translate 16-bit range data to engineering units, the calculation for each point is:
// X: XOffset + columnIndex * XResolution
// Y: YOffset + rowIndex * YResolution
// Z: ZOffset + height_map[rowIndex][columnIndex] * ZResolution
Ast_surfaceBuffer[rowIdx][colIdx].x = XOffset + XResolution * colIdx;
Ast_surfaceBuffer[rowIdx][colIdx].y = YOffset + YResolution * rowIdx;
if (data[colIdx] != INVALID_RANGE_16BIT)
{
Ast_surfaceBuffer[rowIdx][colIdx].z = ZOffset + ZResolution * data[colIdx];
}
else
{
Ast_surfaceBuffer[rowIdx][colIdx].z = -9999;
}
}
AsyLength = GoSurfaceMsg_Length(surfaceMsg);
AsyWidth = GoSurfaceMsg_Width(surfaceMsg);
}
}
break;
// Refer to example ReceiveRange, ReceiveProfile, ReceiveMeasurement and ReceiveWholePart on how to receive data
}
}
Asyn_dlg->m_asyEditTxt.SetSel(-1, 0, FALSE);
Asyn_dlg->m_asyEditTxt.SetFocus();
Asyn_dlg->m_asyEditTxt.PostMessage(WM_VSCROLL, SB_BOTTOM, 0);
GoDestroy(dataset);
return kOK;
}
void ReceiveDataAsync::SetUseReceiveAsync() //int argc, char **argv
{
DataContext contextPointer;
//TODO为了解决回调中输出的问题
//ReceiveDataAsync m_useLogDlg = Rev_dlg; //直接使用就可以了
//m_useLogDlg.GetDlgItem(IDC_SYSINFOSHOW)->SetWindowText(_T("开始运行异步接收信号程序"));
//Enablelogdlg(4, _T("程序进入回调事件中----"));
//GetDlgItem(IDC_ASYNCSTATIC)->SetWindowText(_T("程序进入回调事件中----"));
//AsyncStrTemp = AsyncStrOut = "0";
AsyncStrTemp.Format(_T("初始化进入异步拍摄功能:\r\n"));
AsyncStrOut += AsyncStrTemp;
//SetDlgItemText(IDC_ASYNCSTATIC, AsyncStrOut);
Asyn_dlg->m_asyEditTxt.SetWindowText(AsyncStrOut);
Asyn_dlg->m_asyEditTxt.SetSel(-1, 0, FALSE);
Asyn_dlg->m_asyEditTxt.SetFocus();
Asyn_dlg->m_asyEditTxt.PostMessage(WM_VSCROLL, SB_BOTTOM, 0);
// construct Gocator API Library
if ((status = GoSdk_Construct(&api)) != kOK)
{
//m_useLogDlg.GetDlgItem(IDC_ASYNCSTATIC)->SetWindowText((_T("Error: GoSdk_Construct:%d\n", status)));
//SetDlgItemText(IDC_ASYNCSTATIC, (_T("Error: GoSdk_Construct:%d\n", status)));
Asyn_dlg->m_asyEditTxt.SetWindowText(_T("Error: GoSdk_Construct:%d\n", status));
return ;
}
// construct GoSystem object
if ((status = GoSystem_Construct(&Gosystem, kNULL)) != kOK)
{
//SetDlgItemText(IDC_ASYNCSTATIC, (_T("Error: GoSystem_Construct:%d\n", status)));
Asyn_dlg->m_asyEditTxt.SetWindowText(_T("Error: GoSystem_Construct:%d\n", status));
return ;
}
// Parse IP address into address data structure
kIpAddress_Parse(&ipAddress, SENSOR_IP);
// obtain GoSensor object by sensor IP address
if ((status = GoSystem_FindSensorByIpAddress(Gosystem, &ipAddress, &sensor)) != kOK)
{
//SetDlgItemText(IDC_ASYNCSTATIC, (_T("Error: GoSystem_FindSensor:%d\n", status)));
Asyn_dlg->m_asyEditTxt.SetWindowText(_T("Error: GoSystem_FindSensor:%d\n", status));
return;
}
// create connection to GoSystem object
if ((status = GoSystem_Connect(Gosystem)) != kOK)
{
//SetDlgItemText(IDC_ASYNCSTATIC, (_T("Error: GoSystem_Connect:%d\n", status)));
Asyn_dlg->m_asyEditTxt.SetWindowText(_T("Error: GoSystem_Connect:%d\n", status));
return;
}
// enable sensor data channel
if ((status = GoSystem_EnableData(Gosystem, kTRUE)) != kOK)
{
//SetDlgItemText(IDC_ASYNCSTATIC, (_T("Error: GoSensor_EnableData:%d\n", status)));
Asyn_dlg->m_asyEditTxt.SetWindowText(_T("Error: GoSensor_EnableData:%d\n", status));
return;
}
//set data handler to receive data asynchronously
if ((status = GoSystem_SetDataHandler(Gosystem, onReceiveAsyncData, &contextPointer)) != kOK)
{
//SetDlgItemText(IDC_ASYNCSTATIC, (_T("Error: GoSystem_SetDataHandler:%d\n", status)));
Asyn_dlg->m_asyEditTxt.SetWindowText(_T("Error: GoSystem_SetDataHandler:%d\n", status));
return;
}
// start Gocator sensor
if ((status = GoSystem_Start(Gosystem)) != kOK)
{
//SetDlgItemText(IDC_ASYNCSTATIC, (_T("Error: GoSystem_Start:%d\n", status)));
Asyn_dlg->m_asyEditTxt.SetWindowText(_T("Error: GoSystem_Start:%d\n", status));
return;
}
//m_AsyncLogDlg->WARN(_T("Press any key to stop sensor...\n"));
//getchar();
//// stop Gocator sensor
//if ((status = GoSystem_Stop(system)) != kOK)
//{
// m_AsyncLogDlg->WARN(_T("Error: GoSystem_Stop:%d\n", status));
// return;
//}
//// destroy handles
//GoDestroy(system);
//GoDestroy(api);
//m_AsyncLogDlg->WARN(_T("Press any key to continue...\n"));
//getchar();
Asyn_dlg->m_asyEditTxt.SetSel(-1, 0, FALSE);
Asyn_dlg->m_asyEditTxt.SetFocus();
Asyn_dlg->m_asyEditTxt.PostMessage(WM_VSCROLL, SB_BOTTOM, 0);
return;
}
void ReceiveDataAsync::SetStopCamera()
{
// stop Gocator sensor
if ((status = GoSystem_Stop(Gosystem)) != kOK)
{
MessageBox("结束相机失败");
}
Asyn_dlg->m_asyEditTxt.SetSel(-1, 0, FALSE);
Asyn_dlg->m_asyEditTxt.SetFocus();
Asyn_dlg->m_asyEditTxt.PostMessage(WM_VSCROLL, SB_BOTTOM, 0);
// destroy handles
GoDestroy(Gosystem);
GoDestroy(api);
}
void ReceiveDataAsync::Enablelogdlg(int strType, CString strInfo)
{
//TODO 函数废弃
switch (strType)
{
case 1:
//m_AsyncLogDlg->INFO(_T(strInfo));
break;
case 2:
//m_AsyncLogDlg->WARN(_T(strInfo));
break;
case 3:
//m_AsyncLogDlg->ERR(_T(strInfo));
break;
case 4:
//SetDlgItemText(IDC_ASYNCSTATIC, AsyncStrOut);
break;
default:
break;
}
}
void ReceiveDataAsync::OnBnClickedOk()
{
// TODO: 在此添加控件通知处理程序代码
//CDialogEx::OnOK();
MessageBox(_T("无效确认操作!\r\n"), _T("GoCator相机操作"), MB_OK | MB_ICONEXCLAMATION);
}
void ReceiveDataAsync::OnBnClickedAsynReflesh()
{
// TODO: 在此添加控件通知处理程序代码
MessageBox(_T("刷新相机需要重新创建配置\r\n期间请不要移动界面\r\n等待相机完成操作\r\n等待2到3秒"), _T("GoCator相机提示"), MB_OK);
AsyncStrTemp.Format(_T("等待相机进行重连操作....\r\n"));
AsyncStrOut += AsyncStrTemp;
//SetDlgItemText(IDC_ASYNCSTATIC, AsyncStrOut);
Asyn_dlg->m_asyEditTxt.SetWindowText(AsyncStrOut);
Asyn_dlg->m_asyEditTxt.PostMessage(WM_VSCROLL, SB_BOTTOM, 0);
SetUseReceiveAsync();
SetStopCamera();
}
void ReceiveDataAsync::ToSavaPointCloudData()
{
if (Ast_surfaceBuffer != NULL)
{
Asyn_dlg->m_asyEditTxt.PostMessage(WM_VSCROLL, SB_BOTTOM, 0);
errno_t err;
FILE* fpWrite;
TCHAR szFilter[] = _T("文本文件(*.txt)|*.txt | 所有文件(*.*)|*.*||");
// 设置按时间保存文件名
CTime m_Time;
m_Time = CTime::GetCurrentTime();//获取当前系统时间
CString str = (CString)m_Time.Format(_T("%Y-%m-%d_%H-%M-%S"));
// 构造保存文件对话框
CFileDialog fileDlg(FALSE, _T("txt"), str, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, szFilter, this);
// 显示保存文件对话框
if (IDOK == fileDlg.DoModal())
{
// 如果点击了文件对话框上的“保存”按钮,则将选择的文件路径显示到编辑框里
strFilePath = fileDlg.GetPathName();
setFileName = fileDlg.GetFileName();
//SetDlgItemText(IDC_FILENAMEINFOSHOW, setFileName);
//TODO 默认先将已有文件名删除一遍
remove(strFilePath);
//fpWrite = fopen(setFileName, "w+");
err = fopen_s(&fpWrite, strFilePath, "w");
if (err == 0)
{
for (int row = 0; row < AsyLength; row++)
{
for (int col = 0; col < AsyWidth; col++)
{
fprintf(fpWrite, "|%-4.3f||%-4.3f||%-4.3f|\n",
Ast_surfaceBuffer[row][col].x, Ast_surfaceBuffer[row][col].y, Ast_surfaceBuffer[row][col].z);
}
}
}
else
{
SetDlgItemText(IDC_SYSINFOSHOW, "错误文件名\n");
}
fclose(fpWrite);
SetDlgItemText(IDC_SYSINFOSHOW, "输出数据已完成\n");
AsyncStrTemp.Format(_T("---保存到文件成功,文件路径为: " + strFilePath + "---\r\n\r\n"));
AsyncStrOut += AsyncStrTemp;
SetDlgItemText(IDC_ASYNCSTATIC, AsyncStrOut);
//m_logdlg->INFO(_T("保存到文件成功,文件路径为: " + strFilePath + "--INFO消息"));
}
else
{
//m_logdlg->WARN(_T("无效的目录,请重新选择---WARN消息"));
MessageBox(_T("无效的目录,请重新选择---WARN消息"), _T("3D相机管理系统-GUI"), MB_OK);
}
}
else
{
MessageBox(_T("无效的保存文件\r\n数据还未生成"), _T("3D相机管理系统-GUI"), MB_OK | MB_ICONEXCLAMATION);
}
} | [
"zxuandyx@163.com"
] | zxuandyx@163.com |
0c8b869e875d42e5f8f6b6bd70c64392e281cf98 | 935c947bc9f0d596d5cb01e752c247d400a398ca | /dev/MRTCore/mrt/mrm/mrmmin/MrmFile.cpp | ccd59dec3820db748b133e23d82b0c87a811aefa | [
"MIT",
"LicenseRef-scancode-generic-cla",
"CC-BY-4.0"
] | permissive | DefaultRyan/ProjectReunion | 3866f3f5f4db57ceac58be1261cbea8acbf4e6af | f6040be604231714e4892e0a230eb0597fc35e67 | refs/heads/master | 2023-01-04T10:49:13.526080 | 2020-09-22T17:39:13 | 2020-09-22T17:39:13 | 295,985,035 | 0 | 0 | NOASSERTION | 2020-09-16T09:24:36 | 2020-09-16T09:24:36 | null | UTF-8 | C++ | false | false | 35,780 | cpp | // Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
#include "stdafx.h"
namespace Microsoft::Resources
{
class MrmFileSection : public BaseFileSectionResult
{
public:
MrmFileSection() : BaseFileSectionResult(), m_sectionType(SectionTypeUnknown), isInitialized(false) { u.pFileList = nullptr; }
virtual ~MrmFileSection() { ResetSection(); }
bool IsInitialized() { return isInitialized; }
HRESULT Init(_In_ const BaseFile* pParent, _In_ BaseFile::SectionIndex index)
{
ResetSection();
RETURN_IF_FAILED(pParent->GetFileSection(index, this));
isInitialized = true;
return S_OK;
}
HRESULT GetAtomPoolSection(_Out_ FileAtomPool** result)
{
*result = nullptr;
if (m_sectionType == SectionTypeUnknown)
{
RETURN_IF_FAILED(FileAtomPool::CreateInstance(this, &u.pAtomPool));
m_sectionType = SectionTypeAtomPool;
}
else if (m_sectionType != SectionTypeAtomPool)
{
u.pAtomPool = nullptr;
return HRESULT_FROM_WIN32(ERROR_MRM_INVALID_PRI_FILE);
}
*result = u.pAtomPool;
return S_OK;
}
HRESULT GetDecisionInfoSection(_In_ const IFileSectionResolver* pResolver, _Out_ DecisionInfoFileSection** result)
{
*result = nullptr;
if (m_sectionType == SectionTypeUnknown)
{
// get default qualifier mapping for the file which contains the decision info
const RemapAtomPool* pMapping;
(void)pResolver->GetDefaultQualifierMapping(0, &pMapping);
RETURN_IF_FAILED(DecisionInfoFileSection::CreateInstance(this, pMapping, &u.pDecisionInfo));
m_sectionType = SectionTypeDecisionInfo;
}
else if (m_sectionType != SectionTypeDecisionInfo)
{
u.pDecisionInfo = nullptr;
return HRESULT_FROM_WIN32(ERROR_MRM_INVALID_PRI_FILE);
}
*result = u.pDecisionInfo;
return S_OK;
}
HRESULT GetSchemaSection(_Out_ HierarchicalSchema** result)
{
*result = nullptr;
if (m_sectionType == SectionTypeUnknown)
{
RETURN_IF_FAILED(HierarchicalSchema::CreateFromSection(this, &u.pSchema));
m_sectionType = SectionTypeSchema;
}
else if (m_sectionType != SectionTypeSchema)
{
u.pSchema = nullptr;
return HRESULT_FROM_WIN32(ERROR_MRM_INVALID_PRI_FILE);
}
*result = u.pSchema;
return S_OK;
}
HRESULT GetResourceMapSection(
_In_ const IFileSectionResolver* pResolver,
_In_ const ISchemaCollection* pSchemaCollection,
_Out_ ResourceMapBase** result)
{
*result = nullptr;
if (m_sectionType == SectionTypeUnknown)
{
RETURN_IF_FAILED(ResourceMapBase::CreateInstance(pResolver, pSchemaCollection, this, &u.pResourceMap));
m_sectionType = SectionTypeResourceMap;
}
else if (m_sectionType != SectionTypeResourceMap)
{
u.pResourceMap = nullptr;
return HRESULT_FROM_WIN32(ERROR_MRM_INVALID_PRI_FILE);
}
*result = u.pResourceMap;
return S_OK;
}
HRESULT GetPriDescriptorSection(
_In_ const IFileSectionResolver* pResolver,
_In_ const ISchemaCollection* pSchemaCollection,
_Out_ PriDescriptor** result)
{
*result = nullptr;
if (m_sectionType == SectionTypeUnknown)
{
RETURN_IF_FAILED(PriDescriptor::CreateInstance(pResolver, pSchemaCollection, this, &u.pPriDescriptor));
m_sectionType = SectionTypePriDescriptor;
}
else if (m_sectionType != SectionTypePriDescriptor)
{
u.pPriDescriptor = nullptr;
return HRESULT_FROM_WIN32(ERROR_MRM_INVALID_PRI_FILE);
}
*result = u.pPriDescriptor;
return S_OK;
}
HRESULT GetFileListSection(_Out_ FileFileList** result)
{
*result = nullptr;
if (m_sectionType == SectionTypeUnknown)
{
RETURN_IF_FAILED(FileFileList::CreateInstance(this, &u.pFileList));
m_sectionType = SectionTypeFileList;
}
else if (m_sectionType != SectionTypeFileList)
{
u.pFileList = nullptr;
return HRESULT_FROM_WIN32(ERROR_MRM_INVALID_PRI_FILE);
}
*result = u.pFileList;
return S_OK;
}
HRESULT GetDataSection(_Out_ FileDataSection** result)
{
*result = nullptr;
if (m_sectionType == SectionTypeUnknown)
{
RETURN_IF_FAILED(FileDataSection::CreateInstance(this, &u.pData));
m_sectionType = SectionTypeData;
}
else if (m_sectionType != SectionTypeData)
{
u.pData = nullptr;
return HRESULT_FROM_WIN32(ERROR_MRM_INVALID_PRI_FILE);
}
*result = u.pData;
return S_OK;
}
HRESULT GetDataItemsSection(_Out_ FileDataItemsSection** result)
{
*result = nullptr;
if (m_sectionType == SectionTypeUnknown)
{
RETURN_IF_FAILED(FileDataItemsSection::CreateInstance(this, &u.pDataItems));
m_sectionType = SectionTypeDataItems;
}
else if (m_sectionType != SectionTypeDataItems)
{
u.pDataItems = nullptr;
return HRESULT_FROM_WIN32(ERROR_MRM_INVALID_PRI_FILE);
}
*result = u.pDataItems;
return S_OK;
}
HRESULT GetReverseFileMapSection(_Out_ ReverseFileMap** result)
{
*result = nullptr;
if (m_sectionType == SectionTypeUnknown)
{
RETURN_IF_FAILED(ReverseFileMap::CreateInstance(this, &u.pReverseMap));
m_sectionType = SectionTypeReverseMap;
}
else if (m_sectionType != SectionTypeReverseMap)
{
u.pReverseMap = nullptr;
return HRESULT_FROM_WIN32(ERROR_MRM_INVALID_PRI_FILE);
}
*result = u.pReverseMap;
return S_OK;
}
HRESULT
GetEnvironmentMappingSection(
_In_ const CoreProfile* profile,
_In_ const IEnvironmentCollection* environments,
_Out_ const EnvironmentMapping** result)
{
bool typeMatch = BaseFile::SectionTypesEqual(GetSectionType(), gEnvironmentMappingSectionType);
if ((m_sectionType == SectionTypeUnknown) && typeMatch)
{
RETURN_IF_FAILED(EnvironmentMapping::CreateInstance(profile, environments, GetData(), GetDataSize(), &u.pEnvironmentMap));
m_sectionType = SectionTypeEnvironmentMapping;
}
else if ((m_sectionType != SectionTypeEnvironmentMapping) || (!typeMatch))
{
u.pEnvironmentMap = nullptr;
return HRESULT_FROM_WIN32(ERROR_MRM_INVALID_PRI_FILE);
}
*result = u.pEnvironmentMap;
return S_OK;
}
HRESULT
GetResourceLinkSection(
_In_opt_ const IFileSectionResolver* sections,
_In_opt_ const ISchemaCollection* schemas,
_Out_ const ResourceLinkSection** result)
{
bool typeMatch = BaseFile::SectionTypesEqual(GetSectionType(), ResourceLinkSection::GetSectionTypeId());
if ((m_sectionType == SectionTypeUnknown) && typeMatch)
{
RETURN_IF_FAILED(ResourceLinkSection::CreateFromSection(sections, schemas, this, &u.pResourceLink));
m_sectionType = SectionTypeResourceLink;
}
else if ((m_sectionType != SectionTypeResourceLink) || (!typeMatch))
{
u.pEnvironmentMap = nullptr;
return HRESULT_FROM_WIN32(ERROR_MRM_INVALID_PRI_FILE);
}
*result = u.pResourceLink;
return S_OK;
}
protected:
bool isInitialized;
enum SectionType
{
SectionTypeUnknown = 0,
SectionTypeAtomPool = 1,
SectionTypeDecisionInfo = 2,
SectionTypeSchema = 3,
SectionTypeResourceMap = 4,
SectionTypePriDescriptor = 5,
SectionTypeFileList = 6,
SectionTypeDataItems = 7,
SectionTypeData = 8,
SectionTypeReverseMap = 9,
SectionTypeEnvironmentMapping = 10,
SectionTypeResourceLink = 11
};
SectionType m_sectionType;
union
{
IFileSection* pOther;
FileAtomPool* pAtomPool;
DecisionInfoFileSection* pDecisionInfo;
HierarchicalSchema* pSchema;
ResourceMapBase* pResourceMap;
PriDescriptor* pPriDescriptor;
FileFileList* pFileList;
FileDataItemsSection* pDataItems;
FileDataSection* pData;
ReverseFileMap* pReverseMap;
EnvironmentMapping* pEnvironmentMap;
ResourceLinkSection* pResourceLink;
} u;
void ResetSection()
{
if (u.pFileList != nullptr)
{
switch (m_sectionType)
{
default:
delete u.pOther;
break;
case SectionTypeAtomPool:
delete u.pAtomPool;
break;
case SectionTypeDecisionInfo:
delete u.pDecisionInfo;
break;
case SectionTypeSchema:
delete u.pSchema;
break;
case SectionTypeResourceMap:
delete u.pResourceMap;
break;
case SectionTypePriDescriptor:
delete u.pPriDescriptor;
break;
case SectionTypeFileList:
delete u.pFileList;
break;
case SectionTypeDataItems:
delete u.pDataItems;
break;
case SectionTypeReverseMap:
delete u.pReverseMap;
break;
case SectionTypeEnvironmentMapping:
delete u.pEnvironmentMap;
break;
case SectionTypeData:
delete u.pData;
break;
}
u.pOther = nullptr;
}
m_sectionType = SectionTypeUnknown;
}
};
class MrmFileResolver : DefObject
{
// MrmFileResolver provides mapping index of FileList to global index of PriFileManager, and support add all files in the FileListSection
// to the PriFileManager
public:
using DefObject::operator delete;
static HRESULT CreateInstance(_In_ PriFileManager* pPriFileManager, _Outptr_ MrmFileResolver** result)
{
*result = nullptr;
MrmFileResolver* pRtrn = new MrmFileResolver(pPriFileManager);
RETURN_IF_NULL_ALLOC(pRtrn);
*result = pRtrn;
return S_OK;
}
MrmFileResolver(_In_opt_ PriFileManager* pPriFileManager) : m_pPriFileManager(pPriFileManager), m_pFileInfoToGlobalIndex(nullptr) {}
~MrmFileResolver()
{
delete m_pFileInfoToGlobalIndex;
m_pFileInfoToGlobalIndex = nullptr;
}
HRESULT AddReferencedFileInFileList(_In_ const FileFileList* pFileFileList)
{
RETURN_HR_IF_NULL(E_DEF_NOT_READY, m_pPriFileManager);
if (!m_pFileInfoToGlobalIndex)
{
RETURN_IF_FAILED(RemapUInt16::CreateInstance(pFileFileList->GetTotalNumFiles(), &m_pFileInfoToGlobalIndex));
}
StringResult strFilePath;
int numFiles = pFileFileList->GetTotalNumFiles() + 1;
for (int fileInfoIndex = 1; fileInfoIndex < numFiles; fileInfoIndex++)
{
UINT16 flags = 0;
RETURN_IF_FAILED(pFileFileList->GetFilePath(fileInfoIndex, &strFilePath, &flags));
StringResult strPackageRoot;
bool preLoad = ((flags & INPLACE_MERGE_PRELOAD) != 0);
ManagedFile* pManagedFile;
RETURN_IF_FAILED(m_pPriFileManager->GetOrAddFile(
strFilePath.GetRef(), strPackageRoot.GetRef(), preLoad ? LoadPriFlags::Preload : LoadPriFlags::Default, &pManagedFile));
RETURN_IF_FAILED(m_pFileInfoToGlobalIndex->SetOrChangeMapping(
static_cast<UINT16>(fileInfoIndex), static_cast<UINT16>(pManagedFile->GetGlobalIndex())));
}
return S_OK;
}
HRESULT GetGlobalIndex(_In_ int fileIndex, _Out_ int* pGlobalIndex)
{
*pGlobalIndex = -1;
RETURN_HR_IF(E_INVALIDARG, fileIndex == 0);
RETURN_HR_IF_NULL(E_DEF_NOT_READY, m_pFileInfoToGlobalIndex);
UINT16 globalIndex = -1;
if (!m_pFileInfoToGlobalIndex->TryGetMapping(static_cast<UINT16>(fileIndex), &globalIndex))
{
RETURN_HR(E_INVALIDARG);
}
*pGlobalIndex = globalIndex;
return S_OK;
}
private:
PriFileManager* m_pPriFileManager;
RemapUInt16* m_pFileInfoToGlobalIndex;
};
HRESULT MrmFile::CreateInstance(_In_ UnifiedEnvironment* pEnvironment, _In_ UINT32 flags, _In_ PCWSTR pFileName, _Outptr_ MrmFile** result)
{
*result = nullptr;
AutoDeletePtr<MrmFile> pRtrn = new MrmFile();
RETURN_IF_NULL_ALLOC(pRtrn);
RETURN_IF_FAILED(pRtrn->Init(pEnvironment, flags, pFileName));
*result = pRtrn.Detach();
return S_OK;
}
HRESULT MrmFile::CreateInstance(_In_ PriFileManager* pManager, _In_ PCWSTR pFileName, _Outptr_ MrmFile** result)
{
*result = nullptr;
AutoDeletePtr<MrmFile> pRtrn = new MrmFile();
RETURN_IF_NULL_ALLOC(pRtrn);
RETURN_IF_FAILED(pRtrn->Init(pManager, pFileName));
*result = pRtrn.Detach();
return S_OK;
}
HRESULT MrmFile::CreateInstance(
_In_ UnifiedEnvironment* pEnvironment,
_In_ UINT32 flags,
_In_reads_bytes_(cbData) const BYTE* pData,
_In_ size_t cbData,
_Outptr_ MrmFile** result)
{
*result = nullptr;
AutoDeletePtr<MrmFile> pRtrn = new MrmFile();
RETURN_IF_NULL_ALLOC(pRtrn);
RETURN_IF_FAILED(pRtrn->Init(pEnvironment, flags, pData, cbData));
*result = pRtrn.Detach();
return S_OK;
}
HRESULT MrmFile::CreateInstance(_In_ UnifiedEnvironment* pEnvironment, _In_ const BaseFile* pBaseFile, _Outptr_ MrmFile** result)
{
*result = nullptr;
AutoDeletePtr<MrmFile> pRtrn = new MrmFile();
RETURN_IF_NULL_ALLOC(pRtrn);
RETURN_IF_FAILED(pRtrn->Init(pEnvironment, pBaseFile));
*result = pRtrn.Detach();
return S_OK;
}
HRESULT MrmFile::Init(_In_ UnifiedEnvironment* pEnvironment, _In_ const BaseFile* pBaseFile)
{
m_pBaseFile = pBaseFile;
m_pEnvironment = pEnvironment;
RETURN_IF_FAILED(InitSections());
return S_OK;
}
HRESULT MrmFile::Init(_In_ UnifiedEnvironment* pEnvironment, _In_ UINT32 flags, _In_ PCWSTR pPath)
{
RETURN_IF_FAILED(BaseFile::CreateInstance(flags, pPath, (BaseFile**)&m_pBaseFile));
m_pMyBaseFile = m_pBaseFile;
m_pEnvironment = pEnvironment;
RETURN_IF_FAILED(InitSections());
return S_OK;
}
HRESULT MrmFile::Init(_In_ PriFileManager* pManager, _In_ PCWSTR pPath)
{
m_pPriFileManager = pManager;
m_pEnvironment = pManager->GetUnifiedEnvironment();
RETURN_IF_FAILED(BaseFile::CreateInstance(m_pPriFileManager->GetDefaultFileFlags(), pPath, (BaseFile**)&m_pBaseFile));
m_pMyBaseFile = m_pBaseFile;
RETURN_IF_FAILED(InitSections());
RETURN_IF_FAILED(MrmFileResolver::CreateInstance(m_pPriFileManager, &m_pFileResolver));
PCWSTR pFileName = wcsrchr(pPath, L'\\');
if (pFileName != nullptr)
{
wchar_t wszFolder[MAX_PATH] = {};
errno_t err = wcsncpy_s(wszFolder, _countof(wszFolder), pPath, pFileName - pPath);
RETURN_IF_FAILED(ErrnoToHResult(err));
RETURN_IF_FAILED(m_strRootFolder.SetCopy(wszFolder));
}
RETURN_IF_FAILED(m_strFilePath.SetCopy(pPath)); // copy the path
return S_OK;
}
HRESULT
MrmFile::Init(_In_ UnifiedEnvironment* pEnvironment, _In_ UINT32 flags, _In_reads_bytes_(cbData) const BYTE* pData, _In_ size_t cbData)
{
m_pEnvironment = pEnvironment;
RETURN_IF_FAILED(BaseFile::CreateInstance(flags, pData, cbData, (BaseFile**)&m_pBaseFile));
m_pMyBaseFile = m_pBaseFile;
(void)InitSections();
return S_OK;
}
MrmFile::~MrmFile()
{
(void)ReleaseSections();
delete m_pFileResolver;
}
CoreProfile* MrmFile::GetProfile() const { return m_pEnvironment->GetProfile(); }
HRESULT MrmFile::InitSections()
{
if (m_pSections != nullptr)
{
return S_OK;
}
m_pSections = new MrmFileSection[m_pBaseFile->GetNumSections()];
if (m_pSections == nullptr)
{
ReleaseSections();
return E_OUTOFMEMORY;
}
// We do not initialize the various sections here. Rather, we initialize them on demand
// when they are actually used to avoid excessive I/O on initialization.
return S_OK;
}
void MrmFile::ReleaseSections()
{
delete[] m_pSections;
m_pSections = nullptr;
delete m_pMyBaseFile;
m_pMyBaseFile = nullptr;
m_pBaseFile = nullptr;
}
HRESULT MrmFile::InitializeAndGetSection(_In_ BaseFile::SectionIndex sectionIndex, _Out_ MrmFileSection** result) const
{
*result = nullptr;
if ((sectionIndex < 0) || (sectionIndex >= m_pBaseFile->GetNumSections()))
{
return HRESULT_FROM_WIN32(ERROR_MRM_INVALID_PRI_FILE);
}
if (!m_pSections[sectionIndex].IsInitialized())
{
RETURN_IF_FAILED(m_pSections[sectionIndex].Init(m_pBaseFile, sectionIndex));
}
*result = &m_pSections[sectionIndex];
return S_OK;
}
HRESULT MrmFile::GetSection(
_In_ const ISchemaCollection* /* pSchemaCollection */,
_In_ int fileIndex,
_In_ BaseFile::SectionIndex sectionIndex,
_Out_ const IFileSection** result) const
{
*result = nullptr;
RETURN_HR_IF(E_DEF_NOT_READY, fileIndex != 0);
if ((sectionIndex < 0) || (sectionIndex >= m_pBaseFile->GetNumSections()))
{
return HRESULT_FROM_WIN32(ERROR_MRM_INVALID_PRI_FILE);
}
RETURN_IF_FAILED(InitializeAndGetSection(sectionIndex, (MrmFileSection**)result));
return S_OK;
}
const bool MrmFile::TryGetSectionIndexByType(
_In_ const DEFFILE_SECTION_TYPEID& sectionType,
_In_ int fileIndex,
_In_ int startAtSectionIndex,
_Out_ int* nextSectionIndex) const
{
if (fileIndex == 0)
{
if ((startAtSectionIndex < 0) || (startAtSectionIndex >= m_pBaseFile->GetNumSections()))
{
return false;
}
for (int i = startAtSectionIndex; i < m_pBaseFile->GetNumSections(); i++)
{
const DEFFILE_TOC_ENTRY* toc;
m_pBaseFile->GetTocEntry(i, &toc);
if ((toc != nullptr) && BaseFile::SectionTypesEqual(sectionType, toc->type))
{
*nextSectionIndex = i;
return true;
}
}
*nextSectionIndex = -1;
return false;
}
if (m_pPriFileManager != nullptr)
{
int globalFileIndex;
if (FAILED(m_pFileResolver->GetGlobalIndex(fileIndex, &globalFileIndex)))
{
return false;
}
return m_pPriFileManager->TryGetSectionIndexByType(sectionType, globalFileIndex, startAtSectionIndex, nextSectionIndex);
}
return false;
}
HRESULT MrmFile::GetAtomPoolSection(_In_ int fileIndex, _In_ BaseFile::SectionIndex sectionIndex, _Out_ FileAtomPool** result) const
{
*result = nullptr;
if (fileIndex == 0)
{
if ((sectionIndex < 0) || (sectionIndex >= m_pBaseFile->GetNumSections()))
{
return HRESULT_FROM_WIN32(ERROR_MRM_INVALID_PRI_FILE);
}
MrmFileSection* pSection;
RETURN_IF_FAILED(InitializeAndGetSection(sectionIndex, &pSection));
RETURN_IF_FAILED(pSection->GetAtomPoolSection(result));
return S_OK;
}
if (m_pPriFileManager)
{
int globalFileIndex;
RETURN_IF_FAILED(m_pFileResolver->GetGlobalIndex(fileIndex, &globalFileIndex));
RETURN_IF_FAILED(m_pPriFileManager->GetAtomPoolSection(globalFileIndex, sectionIndex, result));
}
else
{
return E_INVALIDARG;
}
return S_OK;
}
HRESULT
MrmFile::GetDecisionInfoSection(_In_ int fileIndex, _In_ BaseFile::SectionIndex sectionIndex, _Out_ DecisionInfoFileSection** result) const
{
*result = nullptr;
if (fileIndex == 0)
{
if ((sectionIndex < 0) || (sectionIndex >= m_pBaseFile->GetNumSections()))
{
return HRESULT_FROM_WIN32(ERROR_MRM_INVALID_PRI_FILE);
}
MrmFileSection* pSection;
RETURN_IF_FAILED(InitializeAndGetSection(sectionIndex, &pSection));
RETURN_IF_FAILED(pSection->GetDecisionInfoSection(this, result));
return S_OK;
}
if (m_pPriFileManager != nullptr)
{
int globalFileIndex;
RETURN_IF_FAILED(m_pFileResolver->GetGlobalIndex(fileIndex, &globalFileIndex));
RETURN_IF_FAILED(m_pPriFileManager->GetDecisionInfoSection(globalFileIndex, sectionIndex, result));
}
else
{
return E_INVALIDARG;
}
return S_OK;
}
HRESULT MrmFile::GetSchemaSection(_In_ int fileIndex, _In_ BaseFile::SectionIndex sectionIndex, _Out_ HierarchicalSchema** result) const
{
*result = nullptr;
if (fileIndex == 0)
{
if ((sectionIndex < 0) || (sectionIndex >= m_pBaseFile->GetNumSections()))
{
return HRESULT_FROM_WIN32(ERROR_MRM_INVALID_PRI_FILE);
}
MrmFileSection* pSection;
RETURN_IF_FAILED(InitializeAndGetSection(sectionIndex, &pSection));
if (FAILED(pSection->GetSchemaSection(result)))
{
// The most common way to get here is to try and load a schema-free resource pack without supplying the schema.
// Set a distinct error code so that we can handle this case gracefully higher up the stream where appropriate.
return HRESULT_FROM_WIN32(ERROR_MRM_UNSUPPORTED_FILE_TYPE_FOR_LOAD_UNLOAD_PRI_FILE);
}
return S_OK;
}
if (m_pPriFileManager)
{
int globalFileIndex;
RETURN_IF_FAILED(m_pFileResolver->GetGlobalIndex(fileIndex, &globalFileIndex));
RETURN_IF_FAILED(m_pPriFileManager->GetSchemaSection(globalFileIndex, sectionIndex, result));
}
else
{
return E_INVALIDARG;
}
return S_OK;
}
HRESULT MrmFile::GetResourceMapSection(
_In_ const ISchemaCollection* pSchemaCollection,
_In_ int fileIndex,
_In_ BaseFile::SectionIndex sectionIndex,
_Out_ ResourceMapBase** result) const
{
*result = nullptr;
if (fileIndex == 0)
{
if ((sectionIndex < 0) || (sectionIndex >= m_pBaseFile->GetNumSections()))
{
return HRESULT_FROM_WIN32(ERROR_MRM_INVALID_PRI_FILE);
}
MrmFileSection* pSection;
RETURN_IF_FAILED(InitializeAndGetSection(sectionIndex, &pSection));
RETURN_IF_FAILED(pSection->GetResourceMapSection(this, pSchemaCollection, result));
return S_OK;
}
if (m_pPriFileManager)
{
int globalFileIndex;
RETURN_IF_FAILED(m_pFileResolver->GetGlobalIndex(fileIndex, &globalFileIndex));
RETURN_IF_FAILED(m_pPriFileManager->GetResourceMapSection(pSchemaCollection, globalFileIndex, sectionIndex, result));
}
else
{
return E_INVALIDARG;
}
return S_OK;
}
HRESULT MrmFile::GetPriDescriptorSection(
_In_ const ISchemaCollection* pSchemaCollection,
_In_ int fileIndex,
_In_ BaseFile::SectionIndex sectionIndex,
_Out_ PriDescriptor** result) const
{
*result = nullptr;
if (fileIndex == 0)
{
if ((sectionIndex < 0) || (sectionIndex >= m_pBaseFile->GetNumSections()))
{
return HRESULT_FROM_WIN32(ERROR_MRM_INVALID_PRI_FILE);
}
MrmFileSection* pSection;
RETURN_IF_FAILED(InitializeAndGetSection(sectionIndex, &pSection));
RETURN_IF_FAILED(pSection->GetPriDescriptorSection(this, pSchemaCollection, result));
return S_OK;
}
if (m_pPriFileManager)
{
int globalFileIndex;
RETURN_IF_FAILED(m_pFileResolver->GetGlobalIndex(fileIndex, &globalFileIndex));
RETURN_IF_FAILED(m_pPriFileManager->GetPriDescriptorSection(pSchemaCollection, globalFileIndex, sectionIndex, result));
}
else
{
return E_INVALIDARG;
}
return S_OK;
}
HRESULT MrmFile::GetFileListSection(_In_ int fileIndex, _In_ BaseFile::SectionIndex sectionIndex, _Out_ FileFileList** result) const
{
*result = nullptr;
if (fileIndex == 0)
{
if ((sectionIndex < 0) || (sectionIndex >= m_pBaseFile->GetNumSections()))
{
return HRESULT_FROM_WIN32(ERROR_MRM_INVALID_PRI_FILE);
}
MrmFileSection* pSection;
RETURN_IF_FAILED(InitializeAndGetSection(sectionIndex, &pSection));
RETURN_IF_FAILED(pSection->GetFileListSection(result));
return S_OK;
}
if (m_pPriFileManager)
{
int globalFileIndex;
RETURN_IF_FAILED(m_pFileResolver->GetGlobalIndex(fileIndex, &globalFileIndex));
RETURN_IF_FAILED(m_pPriFileManager->GetFileListSection(globalFileIndex, sectionIndex, result));
}
else
{
return E_INVALIDARG;
}
return S_OK;
}
HRESULT
MrmFile::GetDataItemsSection(_In_ int fileIndex, _In_ BaseFile::SectionIndex sectionIndex, _Out_ FileDataItemsSection** result) const
{
*result = nullptr;
if (fileIndex == 0)
{
if ((sectionIndex < 0) || (sectionIndex >= m_pBaseFile->GetNumSections()))
{
return HRESULT_FROM_WIN32(ERROR_MRM_INVALID_PRI_FILE);
}
MrmFileSection* pSection;
RETURN_IF_FAILED(InitializeAndGetSection(sectionIndex, &pSection));
RETURN_IF_FAILED(pSection->GetDataItemsSection(result));
return S_OK;
}
if (m_pPriFileManager)
{
int globalFileIndex;
RETURN_IF_FAILED(m_pFileResolver->GetGlobalIndex(fileIndex, &globalFileIndex));
RETURN_IF_FAILED(m_pPriFileManager->GetDataItemsSection(globalFileIndex, sectionIndex, result));
}
else
{
return E_INVALIDARG;
}
return S_OK;
}
HRESULT MrmFile::GetDataSection(_In_ int fileIndex, _In_ BaseFile::SectionIndex sectionIndex, _Out_ FileDataSection** result) const
{
*result = nullptr;
if (fileIndex == 0)
{
if ((sectionIndex < 0) || (sectionIndex >= m_pBaseFile->GetNumSections()))
{
return HRESULT_FROM_WIN32(ERROR_MRM_INVALID_PRI_FILE);
}
MrmFileSection* pSection;
RETURN_IF_FAILED(InitializeAndGetSection(sectionIndex, &pSection));
RETURN_IF_FAILED(pSection->GetDataSection(result));
return S_OK;
}
if (m_pPriFileManager)
{
int globalFileIndex;
RETURN_IF_FAILED(m_pFileResolver->GetGlobalIndex(fileIndex, &globalFileIndex));
RETURN_IF_FAILED(m_pPriFileManager->GetDataSection(globalFileIndex, sectionIndex, result));
}
else
{
return E_INVALIDARG;
}
return S_OK;
}
HRESULT MrmFile::GetReverseFileMapSection(_In_ int fileIndex, _In_ BaseFile::SectionIndex sectionIndex, _Out_ ReverseFileMap** result) const
{
*result = nullptr;
if (fileIndex == 0)
{
if ((sectionIndex < 0) || (sectionIndex >= m_pBaseFile->GetNumSections()))
{
return HRESULT_FROM_WIN32(ERROR_MRM_INVALID_PRI_FILE);
}
MrmFileSection* pSection;
RETURN_IF_FAILED(InitializeAndGetSection(sectionIndex, &pSection));
RETURN_IF_FAILED(pSection->GetReverseFileMapSection(result));
return S_OK;
}
if (m_pPriFileManager)
{
int globalFileIndex;
RETURN_IF_FAILED(m_pFileResolver->GetGlobalIndex(fileIndex, &globalFileIndex));
RETURN_IF_FAILED(m_pPriFileManager->GetReverseFileMapSection(globalFileIndex, sectionIndex, result));
}
else
{
return E_INVALIDARG;
}
return S_OK;
}
HRESULT MrmFile::GetEnvironmentMappingSection(
_In_ int fileIndex,
_In_ BaseFile::SectionIndex sectionIndex,
_Out_ const EnvironmentMapping** result) const
{
*result = nullptr;
if (fileIndex == 0)
{
if ((sectionIndex < 0) || (sectionIndex >= m_pBaseFile->GetNumSections()))
{
return HRESULT_FROM_WIN32(ERROR_MRM_INVALID_PRI_FILE);
}
MrmFileSection* pSection;
RETURN_IF_FAILED(InitializeAndGetSection(sectionIndex, &pSection));
RETURN_IF_FAILED(pSection->GetEnvironmentMappingSection(GetProfile(), GetUnifiedEnvironment(), result));
return S_OK;
}
if (m_pPriFileManager != nullptr)
{
int globalFileIndex;
RETURN_IF_FAILED(m_pFileResolver->GetGlobalIndex(fileIndex, &globalFileIndex));
RETURN_IF_FAILED(m_pPriFileManager->GetEnvironmentMappingSection(globalFileIndex, sectionIndex, result));
}
else
{
return E_INVALIDARG;
}
return S_OK;
}
HRESULT MrmFile::GetResourceLinkSection(
_In_opt_ const ISchemaCollection* schemas,
_In_ int fileIndex,
_In_ BaseFile::SectionIndex sectionIndex,
_Out_ const ResourceLinkSection** result) const
{
*result = nullptr;
if (fileIndex == 0)
{
if ((sectionIndex < 0) || (sectionIndex >= m_pBaseFile->GetNumSections()))
{
return HRESULT_FROM_WIN32(ERROR_MRM_INVALID_PRI_FILE);
}
MrmFileSection* pSection;
RETURN_IF_FAILED(InitializeAndGetSection(sectionIndex, &pSection));
RETURN_IF_FAILED(pSection->GetResourceLinkSection(this, schemas, result));
return S_OK;
}
if (m_pPriFileManager != nullptr)
{
int globalFileIndex;
RETURN_IF_FAILED(m_pFileResolver->GetGlobalIndex(fileIndex, &globalFileIndex));
RETURN_IF_FAILED(m_pPriFileManager->GetResourceLinkSection(schemas, globalFileIndex, sectionIndex, result));
}
else
{
return E_INVALIDARG;
}
return S_OK;
}
HRESULT MrmFile::GetFileDefaultEnvironment(
_In_ int fileIndex,
_Inout_opt_ StringResult* fileEnvironmentName,
_Inout_opt_ EnvironmentVersionInfo* fileEnvironmentVersion) const
{
if (fileIndex == 0)
{
const BaseFile* basefile;
RETURN_IF_FAILED(GetBaseFile(&basefile));
BaseFile::SectionIndex environmentSectionIndex = basefile->GetFirstSectionIndex(gEnvironmentMappingSectionType);
const EnvironmentMapping* mappingSection = nullptr;
if (environmentSectionIndex != BaseFile::SectionIndexNone)
{
RETURN_IF_FAILED(GetEnvironmentMappingSection(0, environmentSectionIndex, &mappingSection));
RETURN_IF_FAILED(mappingSection->GetEnvironmentInfo(fileEnvironmentName, fileEnvironmentVersion));
}
else
{
RETURN_IF_FAILED(GetProfile()->GetDefaultEnvironmentForFileMagic(
m_pBaseFile->GetFileHeader()->magic, fileEnvironmentName, fileEnvironmentVersion));
}
return S_OK;
}
if (m_pPriFileManager != nullptr)
{
int globalFileIndex;
RETURN_IF_FAILED(m_pFileResolver->GetGlobalIndex(fileIndex, &globalFileIndex));
RETURN_IF_FAILED(m_pPriFileManager->GetFileDefaultEnvironment(globalFileIndex, fileEnvironmentName, fileEnvironmentVersion));
}
else
{
return E_INVALIDARG;
}
return S_OK;
}
HRESULT MrmFile::GetDefaultQualifierMapping(_In_ int fileIndex, _Out_ const RemapAtomPool** result) const
{
*result = nullptr;
if (fileIndex == 0)
{
const RemapAtomPool* existingMapping = nullptr;
StringResult name;
AutoDeletePtr<EnvironmentVersionInfo> version;
RETURN_IF_FAILED(EnvironmentVersionInfo::CreateEmpty(&version));
const BaseFile* basefile;
RETURN_IF_FAILED(GetBaseFile(&basefile));
BaseFile::SectionIndex environmentSectionIndex = basefile->GetFirstSectionIndex(gEnvironmentMappingSectionType);
const EnvironmentMapping* mappingSection = nullptr;
if (environmentSectionIndex != BaseFile::SectionIndexNone)
{
RETURN_IF_FAILED(GetEnvironmentMappingSection(0, environmentSectionIndex, &mappingSection));
RETURN_IF_FAILED(mappingSection->GetEnvironmentInfo(&name, version));
}
else
{
RETURN_IF_FAILED(GetProfile()->GetDefaultEnvironmentForFileMagic(m_pBaseFile->GetFileHeader()->magic, &name, version));
}
if (!GetUnifiedEnvironment()->EnvironmentIsCompatible(name.GetRef(), version, &existingMapping))
{
int numQualifiers;
const PCWSTR* qualifierNames;
const Atom::SmallIndex* qualifierMappings;
if (mappingSection != nullptr)
{
RETURN_IF_FAILED(mappingSection->GetQualifierInfo(&numQualifiers, &qualifierNames, &qualifierMappings));
}
else
{
RETURN_IF_FAILED(GetProfile()->GetQualifierInfoForEnvironment(
name.GetRef(),
version,
GetUnifiedEnvironment()->GetDefaultEnvironment(),
&numQualifiers,
&qualifierNames,
&qualifierMappings));
}
RETURN_IF_FAILED(GetUnifiedEnvironment()->AddCompatibleEnvironment(
name.GetRef(), version, numQualifiers, qualifierNames, qualifierMappings, &existingMapping));
}
*result = existingMapping;
return S_OK;
}
if (m_pPriFileManager != nullptr)
{
int globalFileIndex;
RETURN_IF_FAILED(m_pFileResolver->GetGlobalIndex(fileIndex, &globalFileIndex));
RETURN_IF_FAILED(m_pPriFileManager->GetDefaultQualifierMapping(globalFileIndex, result));
}
else
{
return E_INVALIDARG;
}
return S_OK;
}
HRESULT MrmFile::ResolveFileFileList(_In_ const FileFileList* pFileFileList)
{
RETURN_HR_IF_NULL(E_DEF_NOT_READY, m_pFileResolver);
RETURN_IF_FAILED(m_pFileResolver->AddReferencedFileInFileList(pFileFileList));
return S_OK;
}
HRESULT MrmFile::GetAbsoluteFolderPath(_In_ int fileIndex, _Inout_ StringResult* pStringResult) const
{
RETURN_HR_IF_NULL(E_DEF_NOT_READY, m_pFileResolver);
int globalFileIndex;
if (fileIndex == 0)
{
// Every merged file has 0 file index and if there is more than 1 merged filles,
// same 0 file index cannot be indexed to multiple files (global index). so it copied
// 0 file index's folder path and use it instead of getting from global index.
if (m_strRootFolder.GetRef() != nullptr)
{
return pStringResult->SetCopy(m_strRootFolder.GetRef());
}
else
{
globalFileIndex = 0;
}
}
else
{
RETURN_IF_FAILED(m_pFileResolver->GetGlobalIndex(fileIndex, &globalFileIndex));
}
RETURN_IF_FAILED(m_pPriFileManager->GetAbsoluteFolderPath(globalFileIndex, pStringResult));
return S_OK;
}
HRESULT MrmFile::GetFilePath(_In_ int fileIndex, _Inout_ StringResult* pStringResult) const
{
RETURN_HR_IF_NULL(E_DEF_NOT_READY, m_pFileResolver);
int globalFileIndex;
if (fileIndex == 0)
{
// The main pacakge has 0 file index, and its global index also 0.
// However, framework package has 0 fileIndex as well, but their global index isn't 0 so MrmFile
// store the filepath for framework package
if (m_strFilePath.GetRef() != nullptr)
{
return pStringResult->SetCopy(m_strFilePath.GetRef());
}
else
{
globalFileIndex = 0;
}
}
else
{
RETURN_IF_FAILED(m_pFileResolver->GetGlobalIndex(fileIndex, &globalFileIndex));
}
RETURN_IF_FAILED(m_pPriFileManager->GetFilePath(globalFileIndex, pStringResult));
return S_OK;
}
int MrmFile::GetNumFiles() const { return m_pPriFileManager->GetNumFiles(); }
} // namespace Microsoft::Resources
| [
"noreply@github.com"
] | noreply@github.com |
47cd2106db52343660dc4d518a4cfc5d111399e2 | 59722415a1185fcbdc73280617b016d28ebb9537 | /tests/test_vector.cpp | 5eff70f5ad76e7cb4c4e05378c743fa4a47934e7 | [] | no_license | Kernunn/containers | bde1d93a5c70f153c3e8641061e0685f36fe0447 | c346fca6ecebcda3eb731f527ef1a660e6ab19a1 | refs/heads/main | 2023-06-19T12:29:49.956624 | 2021-07-18T08:35:21 | 2021-07-18T08:35:21 | 386,974,491 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 26,716 | cpp | #include <vector>
#include "vector.hpp"
#include "test_runner.h"
template<typename T>
bool operator==(const std::vector<T> &lhs, const ft::vector<T> &rhs) {
if (lhs.size() != rhs.size())
return (false);
typename std::vector<T>::const_iterator left = lhs.begin();
typename ft::vector<T>::const_iterator right = rhs.begin();
while (left != lhs.end()) {
if (*left == *right) {
++left;
++right;
continue;
}
return (false);
}
return (true);
}
static void TestMemberType() {
{
std::vector<int> v(4, 100);
ft::vector<int> ft_v(4, 100);
std::vector<int>::value_type tmp1 = 8;
ft::vector<int>::value_type tmp2 = 8;
ASSERT_EQUAL(tmp1, tmp2)
std::vector<int>::reference tmp3 = tmp1;
ft::vector<int>::reference tmp4 = tmp2;
ASSERT_EQUAL(tmp3, tmp4)
std::vector<int>::const_reference tmp5 = tmp1;
ft::vector<int>::const_reference tmp6 = tmp1;
ASSERT_EQUAL(tmp5, tmp6)
tmp3 = 5;
tmp4 = 5;
ASSERT_EQUAL(tmp1, tmp2)
std::vector<int>::pointer tmp7 = &tmp1;
ft::vector<int>::pointer tmp8 = &tmp2;
ASSERT_EQUAL(*tmp7, *tmp8)
*tmp7 = 9;
*tmp8 = 9;
ASSERT_EQUAL(tmp1, tmp2)
std::vector<int>::const_pointer tmp9 = &tmp1;
ft::vector<int>::const_pointer tmp10 = &tmp2;
ASSERT_EQUAL(*tmp9, *tmp10)
std::vector<int>::iterator it;
ft::vector<int>::iterator ft_it;
it = v.begin();
ft_it = ft_v.begin();
ASSERT_EQUAL(*it, *ft_it)
it[0] = 5;
it[1] = 8;
it[2] = 9;
it[3] = 10;
ft_it[0] = 5;
ft_it[1] = 8;
ft_it[2] = 9;
ft_it[3] = 10;
std::vector<int>::iterator it1(it);
ft::vector<int>::iterator ft_it1(ft_it);
ASSERT_EQUAL(*it1, *ft_it1)
ASSERT_EQUAL((it == it1), (ft_it == ft_it1))
ASSERT_EQUAL((it != it1), (ft_it != ft_it1))
ASSERT_EQUAL(*it.operator->(), *ft_it.operator->())
*it = 6;
*ft_it = 6;
ASSERT_EQUAL(v, ft_v)
++it;
++ft_it;
ASSERT_EQUAL(*it, *ft_it)
it++;
ft_it++;
ASSERT_EQUAL(*it, *ft_it)
*it++;
*ft_it++;
ASSERT_EQUAL(*it, *ft_it)
ASSERT_EQUAL(v, ft_v)
--it;
--ft_it;
ASSERT_EQUAL(*it, *ft_it)
it--;
ft_it--;
ASSERT_EQUAL(*it, *ft_it)
*it--;
*ft_it--;
ASSERT_EQUAL(*it, *ft_it)
ASSERT_EQUAL(v, ft_v)
ASSERT_EQUAL(*(it + 2), *(ft_it + 2))
ASSERT_EQUAL(*(2 + it), *(2 + ft_it))
it += 2;
ft_it += 2;
ASSERT_EQUAL(*it, *ft_it)
it -= 1;
ft_it -= 1;
ASSERT_EQUAL(*it, *ft_it)
ASSERT_EQUAL(*(it - 1), *(ft_it - 1))
ASSERT_EQUAL(it - it1, ft_it - ft_it1)
it[2] = 2;
ft_it[2] = 2;
ASSERT_EQUAL(v, ft_v)
ASSERT_EQUAL((it < it1), (ft_it < ft_it1))
ASSERT_EQUAL((it > it1), (ft_it > ft_it1))
ASSERT_EQUAL((it <= it1), (ft_it <= ft_it1))
ASSERT_EQUAL((it >= it1), (ft_it >= ft_it1))
}
{
std::vector<int> v(4, 100);
ft::vector<int> ft_v(4, 100);
std::vector<int>::const_iterator it;
ft::vector<int>::const_iterator ft_it;
it = v.begin();
ft_it = ft_v.begin();
ASSERT_EQUAL(*it, *ft_it)
std::vector<int>::const_iterator it1(it);
ft::vector<int>::const_iterator ft_it1(ft_it);
ASSERT_EQUAL(*it1, *ft_it1)
ASSERT_EQUAL((it == it1), (ft_it == ft_it1))
ASSERT_EQUAL((it != it1), (ft_it != ft_it1))
ASSERT_EQUAL(*it.operator->(), *ft_it.operator->())
// *it = 6;
// *ft_it = 6;
ASSERT_EQUAL(v, ft_v)
++it;
++ft_it;
ASSERT_EQUAL(*it, *ft_it)
it++;
ft_it++;
ASSERT_EQUAL(*it, *ft_it)
*it++;
*ft_it++;
ASSERT_EQUAL(*it, *ft_it)
ASSERT_EQUAL(v, ft_v)
--it;
--ft_it;
ASSERT_EQUAL(*it, *ft_it)
it--;
ft_it--;
ASSERT_EQUAL(*it, *ft_it)
*it--;
*ft_it--;
ASSERT_EQUAL(*it, *ft_it)
ASSERT_EQUAL(v, ft_v)
ASSERT_EQUAL(*(it + 2), *(ft_it + 2))
ASSERT_EQUAL(*(2 + it), *(2 + ft_it))
it += 2;
ft_it += 2;
ASSERT_EQUAL(*it, *ft_it)
it -= 1;
ft_it -= 1;
ASSERT_EQUAL(*it, *ft_it)
ASSERT_EQUAL(*(it - 1), *(ft_it - 1))
ASSERT_EQUAL(it - it1, ft_it - ft_it1)
// it[2] = 2;
// ft_it[2] = 2;
ASSERT_EQUAL(v, ft_v)
ASSERT_EQUAL((it < it1), (ft_it < ft_it1))
ASSERT_EQUAL((it > it1), (ft_it > ft_it1))
ASSERT_EQUAL((it <= it1), (ft_it <= ft_it1))
ASSERT_EQUAL((it >= it1), (ft_it >= ft_it1))
}
{
std::vector<int> v(4, 100);
ft::vector<int> ft_v(4, 100);
std::vector<int>::reverse_iterator it;
ft::vector<int>::reverse_iterator ft_it;
it = v.rbegin();
ft_it = ft_v.rbegin();
ASSERT_EQUAL(*it, *ft_it)
it[0] = 5;
it[1] = 8;
it[2] = 9;
it[3] = 10;
ft_it[0] = 5;
ft_it[1] = 8;
ft_it[2] = 9;
ft_it[3] = 10;
std::vector<int>::reverse_iterator it1(it);
ft::vector<int>::reverse_iterator ft_it1(ft_it);
ASSERT_EQUAL(*it1, *ft_it1)
ASSERT_EQUAL((it == it1), (ft_it == ft_it1))
ASSERT_EQUAL((it != it1), (ft_it != ft_it1))
ASSERT_EQUAL(*it.operator->(), *ft_it.operator->())
*it = 6;
*ft_it = 6;
ASSERT_EQUAL(v, ft_v)
++it;
++ft_it;
ASSERT_EQUAL(*it, *ft_it)
it++;
ft_it++;
ASSERT_EQUAL(*it, *ft_it)
*it++;
*ft_it++;
ASSERT_EQUAL(*it, *ft_it)
ASSERT_EQUAL(v, ft_v)
--it;
--ft_it;
ASSERT_EQUAL(*it, *ft_it)
it--;
ft_it--;
ASSERT_EQUAL(*it, *ft_it)
*it--;
*ft_it--;
ASSERT_EQUAL(*it, *ft_it)
ASSERT_EQUAL(v, ft_v)
ASSERT_EQUAL(*(it + 2), *(ft_it + 2))
ASSERT_EQUAL(*(2 + it), *(2 + ft_it))
it += 2;
ft_it += 2;
ASSERT_EQUAL(*it, *ft_it)
it -= 1;
ft_it -= 1;
ASSERT_EQUAL(*it, *ft_it)
ASSERT_EQUAL(*(it - 1), *(ft_it - 1))
ASSERT_EQUAL(it - it1, ft_it - ft_it1)
it[2] = 2;
ft_it[2] = 2;
ASSERT_EQUAL(v, ft_v)
ASSERT_EQUAL((it < it1), (ft_it < ft_it1))
ASSERT_EQUAL((it > it1), (ft_it > ft_it1))
ASSERT_EQUAL((it <= it1), (ft_it <= ft_it1))
ASSERT_EQUAL((it >= it1), (ft_it >= ft_it1))
}
{
std::vector<int> v(4, 100);
ft::vector<int> ft_v(4, 100);
std::vector<int>::const_reverse_iterator it;
ft::vector<int>::const_reverse_iterator ft_it;
it = v.rbegin();
ft_it = ft_v.rbegin();
ASSERT_EQUAL(*it, *ft_it)
std::vector<int>::const_reverse_iterator it1(it);
ft::vector<int>::const_reverse_iterator ft_it1(ft_it);
ASSERT_EQUAL(*it1, *ft_it1)
ASSERT_EQUAL((it == it1), (ft_it == ft_it1))
ASSERT_EQUAL((it != it1), (ft_it != ft_it1))
ASSERT_EQUAL(*it.operator->(), *ft_it.operator->())
// *it = 6;
// *ft_it = 6;
ASSERT_EQUAL(v, ft_v)
++it;
++ft_it;
ASSERT_EQUAL(*it, *ft_it)
it++;
ft_it++;
ASSERT_EQUAL(*it, *ft_it)
*it++;
*ft_it++;
ASSERT_EQUAL(*it, *ft_it)
ASSERT_EQUAL(v, ft_v)
--it;
--ft_it;
ASSERT_EQUAL(*it, *ft_it)
it--;
ft_it--;
ASSERT_EQUAL(*it, *ft_it)
*it--;
*ft_it--;
ASSERT_EQUAL(*it, *ft_it)
ASSERT_EQUAL(v, ft_v)
ASSERT_EQUAL(*(it + 2), *(ft_it + 2))
ASSERT_EQUAL(*(2 + it), *(2 + ft_it))
it += 2;
ft_it += 2;
ASSERT_EQUAL(*it, *ft_it)
it -= 1;
ft_it -= 1;
ASSERT_EQUAL(*it, *ft_it)
ASSERT_EQUAL(*(it - 1), *(ft_it - 1))
ASSERT_EQUAL(it - it1, ft_it - ft_it1)
// it[2] = 2;
// ft_it[2] = 2;
ASSERT_EQUAL(v, ft_v)
ASSERT_EQUAL((it < it1), (ft_it < ft_it1))
ASSERT_EQUAL((it > it1), (ft_it > ft_it1))
ASSERT_EQUAL((it <= it1), (ft_it <= ft_it1))
ASSERT_EQUAL((it >= it1), (ft_it >= ft_it1))
}
}
static void TestConstructor() {
std::vector<int> first; // empty vector of ints
ft::vector<int> ft_first;
std::vector<int> second((size_t) 4, 100); // four ints with value 100
ft::vector<int> ft_second((size_t) 4, 100);
std::vector<int> third(second.begin(), second.end()); // iterating through second
ft::vector<int> ft_third(ft_second.begin(), ft_second.end());
std::vector<int> fourth(third); // a copy of third
ft::vector<int> ft_fourth(ft_third);
ASSERT_EQUAL(first, ft_first);
ASSERT_EQUAL(second, ft_second);
ASSERT_EQUAL(third, ft_third);
ASSERT_EQUAL(fourth, ft_fourth);
// the const_iterator constructor can also be used to construct from arrays:
int myints[] = {16, 2, 77, 20};
std::vector<int> fifth(myints, myints + sizeof(myints) / sizeof(int));
ft::vector<int> ft_fifth(myints, myints + sizeof(myints) / sizeof(int));
ASSERT_EQUAL(fifth, ft_fifth);
#ifdef PRINT
std::cout << "\033[1;35m";
std::cout << "\n--------TestConstructor--------\n";
std::cout << "\033[0m";
std::cout << "The contents of fifth are:";
std::cout << fifth << '\n';
std::cout << "The contents of ft_fifth are:";
std::cout << ft_fifth << '\n';
#endif
}
static void TestOperatorEqual() {
std::vector<int> foo(3, 0);
std::vector<int> bar(5, 0);
ft::vector<int> ft_foo(3, 0);
ft::vector<int> ft_bar(5, 0);
bar = foo;
foo = std::vector<int>();
ft_bar = ft_foo;
ft_foo = ft::vector<int>();
ASSERT_EQUAL(foo, ft_foo);
ASSERT_EQUAL(bar, ft_bar);
ASSERT_EQUAL(foo.size(), ft_foo.size());
ASSERT_EQUAL(bar.size(), ft_bar.size());
#ifdef PRINT
std::cout << "\033[1;35m";
std::cout << "\n--------TestOperatorEqual--------\n";
std::cout << "\033[0m";
std::cout << "Size of foo: " << int(foo.size()) << '\n';
std::cout << "Size of ft_foo: " << int(ft_foo.size()) << '\n';
std::cout << "Size of bar: " << int(bar.size()) << '\n';
std::cout << "Size of ft_bar: " << int(ft_bar.size()) << '\n';
#endif
}
static void TestIterators() {
{
std::vector<int> myvector;
ft::vector<int> ft_myvector;
for (int i = 1; i <= 5; i++) myvector.push_back(i);
for (int i = 1; i <= 5; i++) ft_myvector.push_back(i);
#ifdef PRINT
std::cout << "\033[1;35m";
std::cout << "\n--------TestIterators--------\n";
std::cout << "\033[0m";
std::cout << "myvector contains: ";
#endif
for (std::vector<int>::iterator it = myvector.begin();
it != myvector.end(); ++it) {
#ifdef PRINT
std::cout << ' ' << *it;
#endif
}
#ifdef PRINT
std::cout << "\n";
std::cout << "ft_myvector contains: ";
#endif
for (ft::vector<int>::iterator it = ft_myvector.begin();
it != ft_myvector.end(); ++it) {
#ifdef PRINT
std::cout << ' ' << *it;
#endif
}
}
{
std::vector<int> myvector(5); // 5 default-constructed ints
ft::vector<int> ft_myvector(5); // 5 default-constructed ints
int i = 0;
std::vector<int>::reverse_iterator rit = myvector.rbegin();
ft::vector<int>::reverse_iterator ft_rit = ft_myvector.rbegin();
for (; rit != myvector.rend(); ++rit)
*rit = ++i;
i = 0;
for (; ft_rit != ft_myvector.rend(); ++ft_rit)
*ft_rit = ++i;
ASSERT_EQUAL(myvector, ft_myvector)
#ifdef PRINT
std::cout << "\n";
std::cout << "myvector contains:";
#endif
for (std::vector<int>::iterator it = myvector.begin();
it != myvector.end(); ++it) {
#ifdef PRINT
std::cout << ' ' << *it;
#endif
}
#ifdef PRINT
std::cout << "\n";
std::cout << "ft_myvector contains:";
#endif
for (ft::vector<int>::iterator it = ft_myvector.begin();
it != ft_myvector.end(); ++it) {
#ifdef PRINT
std::cout << ' ' << *it;
#endif
}
#ifdef PRINT
std::cout << '\n';
#endif
}
}
static void TestCapacity() {
{
std::vector<int> myints;
ft::vector<int> ft_myints;
ASSERT_EQUAL(myints.size(), ft_myints.size())
#ifdef PRINT
std::cout << "\033[1;35m";
std::cout << "\n--------TestCapacity--------\n";
std::cout << "\033[0m";
std::cout << "0a. size: " << myints.size() << '\n';
std::cout << "0b. size: " << ft_myints.size() << '\n';
#endif
for (int i = 0; i < 10; i++) myints.push_back(i);
for (int i = 0; i < 10; i++) ft_myints.push_back(i);
#ifdef PRINT
std::cout << "1a. size: " << myints.size() << '\n';
std::cout << "1b. size: " << ft_myints.size() << '\n';
#endif
ASSERT_EQUAL(myints.size(), ft_myints.size())
myints.insert(myints.end(), 10, 100);
ft_myints.insert(ft_myints.end(), 10, 100);
ASSERT_EQUAL(myints.size(), ft_myints.size())
#ifdef PRINT
std::cout << "2a. size: " << myints.size() << '\n';
std::cout << "2b. size: " << ft_myints.size() << '\n';
#endif
myints.pop_back();
ft_myints.pop_back();
ASSERT_EQUAL(myints.size(), ft_myints.size())
#ifdef PRINT
std::cout << "3a. size: " << myints.size() << '\n';
std::cout << "3b. size: " << ft_myints.size() << '\n';
#endif
}
{
std::vector<int> myvector;
ft::vector<int> ft_myvector;
// set some initial content:
for (int i = 1; i < 10; i++) myvector.push_back(i);
for (int i = 1; i < 10; i++) ft_myvector.push_back(i);
ASSERT_EQUAL(myvector, ft_myvector)
myvector.resize(5);
ft_myvector.resize(5);
ASSERT_EQUAL(myvector, ft_myvector)
myvector.resize(8, 100);
ft_myvector.resize(8, 100);
ASSERT_EQUAL(myvector, ft_myvector)
myvector.resize(12);
ft_myvector.resize(12);
ASSERT_EQUAL(myvector, ft_myvector)
#ifdef PRINT
std::cout << "myvector contains:";
std::cout << myvector << '\n';
std::cout << "myvector contains:";
std::cout << ft_myvector << '\n';
#endif
}
{
std::vector<int> myvector;
ft::vector<int> ft_myvector;
// set some content in the vector:
for (int i = 0; i < 100; i++) myvector.push_back(i);
for (int i = 0; i < 100; i++) ft_myvector.push_back(i);
ASSERT_EQUAL(myvector.size(), ft_myvector.size())
ASSERT_EQUAL(myvector.capacity(), ft_myvector.capacity())
#ifdef PRINT
std::cout << "size: " << (int) myvector.size() << '\n';
std::cout << "ft_size: " << (int) ft_myvector.size() << '\n';
std::cout << "capacity: " << (int) myvector.capacity() << '\n';
std::cout << "ft_capacity: " << (int) ft_myvector.capacity() << '\n';
#endif
}
{
std::vector<int> myvector;
ft::vector<int> ft_myvector;
int sum(0);
int ft_sum(0);
for (int i = 1; i <= 10; i++) myvector.push_back(i);
for (int i = 1; i <= 10; i++) ft_myvector.push_back(i);
while (!myvector.empty()) {
sum += myvector.back();
myvector.pop_back();
}
while (!ft_myvector.empty()) {
ft_sum += ft_myvector.back();
ft_myvector.pop_back();
}
ASSERT_EQUAL(sum, ft_sum)
#ifdef PRINT
std::cout << "total: " << sum << '\n';
std::cout << "ft_total: " << ft_sum << '\n';
#endif
}
{
std::vector<int>::size_type sz;
ft::vector<int>::size_type ft_sz;
std::vector<int> foo;
ft::vector<int> ft_foo;
sz = foo.capacity();
ft_sz = ft_foo.capacity();
ASSERT_EQUAL(sz, ft_sz)
#ifdef PRINT
std::cout << "making foo grow:\n";
#endif
for (int i = 0; i < 100; ++i) {
foo.push_back(i);
ft_foo.push_back(i);
if (sz != foo.capacity()) {
sz = foo.capacity();
#ifdef PRINT
std::cout << "capacity changed: " << sz << '\n';
#endif
}
if (ft_sz != ft_foo.capacity()) {
ft_sz = ft_foo.capacity();
#ifdef PRINT
std::cout << "ft_capacity changed: " << ft_sz << '\n';
#endif
}
ASSERT_EQUAL(sz, ft_sz)
}
std::vector<int> bar;
ft::vector<int> ft_bar;
sz = bar.capacity();
ft_sz = ft_bar.capacity();
bar.reserve(100); // this is the only difference with foo above
ft_bar.reserve(100); // this is the only difference with foo above
#ifdef PRINT
std::cout << "making bar grow:\n";
#endif
for (int i = 0; i < 100; ++i) {
bar.push_back(i);
ft_bar.push_back(i);
if (sz != bar.capacity()) {
sz = bar.capacity();
#ifdef PRINT
std::cout << "capacity changed: " << sz << '\n';
#endif
}
if (ft_sz != ft_bar.capacity()) {
ft_sz = ft_bar.capacity();
#ifdef PRINT
std::cout << "ft_capacity changed: " << ft_sz << '\n';
#endif
}
ASSERT_EQUAL(sz, ft_sz)
}
}
}
static void TestElementAccess() {
{
std::vector<int> myvector(10); // 10 zero-initialized elements
ft::vector<int> ft_myvector(10); // 10 zero-initialized elements
std::vector<int>::size_type sz = myvector.size();
ft::vector<int>::size_type ft_sz = ft_myvector.size();
ASSERT_EQUAL(sz, ft_sz)
// assign some values:
for (unsigned i = 0; i < sz; i++) myvector[i] = i;
for (unsigned i = 0; i < ft_sz; i++) ft_myvector[i] = i;
// reverse vector using operator[]:
for (unsigned i = 0; i < sz / 2; i++) {
int temp;
temp = myvector[sz - 1 - i];
myvector[sz - 1 - i] = myvector[i];
myvector[i] = temp;
}
for (unsigned i = 0; i < ft_sz / 2; i++) {
int temp;
temp = ft_myvector[ft_sz - 1 - i];
ft_myvector[ft_sz - 1 - i] = ft_myvector[i];
ft_myvector[i] = temp;
}
ASSERT_EQUAL(myvector, ft_myvector)
#ifdef PRINT
std::cout << "\033[1;35m";
std::cout << "\n--------TestElementAccess--------\n";
std::cout << "\033[0m";
std::cout << "myvector contains:";
for (unsigned i=0; i<sz; i++)
std::cout << ' ' << myvector[i];
std::cout << '\n';
std::cout << "ft_myvector contains:";
for (unsigned i=0; i<ft_sz; i++)
std::cout << ' ' << ft_myvector[i];
std::cout << '\n';
#endif
}
{
std::vector<int> myvector(10);
ft::vector<int> ft_myvector(10);
int i = 0;
try {
myvector.at(20) = 100; // vector::at throws an out-of-range
}
catch (const std::out_of_range &oor) {
#ifdef PRINT
std::cerr << "Out of Range error: " << oor.what() << '\n';
#endif
i++;
}
try {
ft_myvector.at(20) = 100; // vector::at throws an out-of-range
}
catch (const std::out_of_range &oor) {
#ifdef PRINT
std::cerr << "Out of Range error: " << oor.what() << '\n';
#endif
i++;
}
ASSERT_EQUAL(i, 2)
}
{
std::vector<int> myvector;
ft::vector<int> ft_myvector;
myvector.push_back(78);
myvector.push_back(16);
ft_myvector.push_back(78);
ft_myvector.push_back(16);
// now front equals 78, and back 16
myvector.front() -= myvector.back();
ft_myvector.front() -= ft_myvector.back();
ASSERT_EQUAL(myvector.front(), ft_myvector.front())
#ifdef PRINT
std::cout << "myvector.front() is now " << myvector.front() << '\n';
std::cout << "ft_myvector.front() is now " << ft_myvector.front() <<
'\n';
#endif
}
}
static void TestAssign() {
std::vector<int> first;
std::vector<int> second;
std::vector<int> third;
ft::vector<int> ft_first;
ft::vector<int> ft_second;
ft::vector<int> ft_third;
first.assign((size_t) 7, 100); // 7 ints with a value of 100
ft_first.assign((size_t) 7, 100); // 7 ints with a value of 100
ASSERT_EQUAL(first, ft_first)
std::vector<int>::iterator it;
ft::vector<int>::iterator ft_it;
it = first.begin() + 1;
ft_it = ft_first.begin() + 1;
second.assign(it, first.end() - 1); // the 5 central values of first
ft_second.assign(ft_it, ft_first.end() - 1); // the 5 central values of first
ASSERT_EQUAL(second, ft_second)
int myints[] = {1776, 7, 4};
third.assign(myints, myints + 3); // assigning from array.
ft_third.assign(myints, myints + 3); // assigning from array.
ASSERT_EQUAL(third, ft_third)
ASSERT_EQUAL(first.size(), ft_first.size())
ASSERT_EQUAL(second.size(), ft_second.size())
ASSERT_EQUAL(third.size(), ft_third.size())
#ifdef PRINT
std::cout << "\033[1;35m";
std::cout << "\n--------TestAssign--------\n";
std::cout << "\033[0m";
std::cout << "Size of first: " << int (first.size()) << '\n';
std::cout << "Size of ft_first: " << int (ft_first.size()) << '\n';
std::cout << "Size of second: " << int (second.size()) << '\n';
std::cout << "Size of ft_second: " << int (ft_second.size()) << '\n';
std::cout << "Size of third: " << int (third.size()) << '\n';
std::cout << "Size of ft_third: " << int (ft_third.size()) << '\n';
#endif
}
static void TestPopBack() {
std::vector<int> myvector;
ft::vector<int> ft_myvector;
int sum(0);
int ft_sum(0);
myvector.push_back(100);
myvector.push_back(200);
myvector.push_back(300);
ft_myvector.push_back(100);
ft_myvector.push_back(200);
ft_myvector.push_back(300);
while (!myvector.empty()) {
sum += myvector.back();
myvector.pop_back();
}
while (!ft_myvector.empty()) {
ft_sum += ft_myvector.back();
ft_myvector.pop_back();
}
ASSERT_EQUAL(sum, ft_sum)
#ifdef PRINT
std::cout << "\033[1;35m";
std::cout << "\n--------TestPopBack--------\n";
std::cout << "\033[0m";
std::cout << "The elements of myvector add up to " << sum << '\n';
std::cout << "The elements of ft_myvector add up to " << ft_sum << '\n';
#endif
}
static void TestInsert() {
std::vector<int> myvector(3, 100);
std::vector<int>::iterator it;
ft::vector<int> ft_myvector(3, 100);
ft::vector<int>::iterator ft_it;
it = myvector.begin();
it = myvector.insert(it, 200);
ft_it = ft_myvector.begin();
ft_it = ft_myvector.insert(ft_it, 200);
ASSERT_EQUAL(myvector, ft_myvector);
ASSERT_EQUAL(*it, *ft_it)
myvector.insert(it, 2, 300);
ft_myvector.insert(ft_it, 2, 300);
ASSERT_EQUAL(myvector, ft_myvector);
// "it" no longer valid, get a new one:
it = myvector.begin();
ft_it = ft_myvector.begin();
std::vector<int> anothervector(2, 400);
myvector.insert(it + 2, anothervector.begin(), anothervector.end());
ft_myvector.insert(ft_it + 2, anothervector.begin(), anothervector.end());
ASSERT_EQUAL(myvector, ft_myvector);
int myarray[] = {501, 502, 503};
myvector.insert(myvector.begin(), myarray, myarray + 3);
ft_myvector.insert(ft_myvector.begin(), myarray, myarray + 3);
ASSERT_EQUAL(myvector, ft_myvector);
#ifdef PRINT
std::cout << "\033[1;35m";
std::cout << "\n--------TestInsert--------\n";
std::cout << "\033[0m";
std::cout << "myvector contains:";
for (it=myvector.begin(); it<myvector.end(); it++)
std::cout << ' ' << *it;
std::cout << '\n';
std::cout << "ft_myvector contains:";
for (ft_it=ft_myvector.begin(); ft_it<ft_myvector.end(); ft_it++)
std::cout << ' ' << *ft_it;
std::cout << '\n';
#endif
}
static void TestErase() {
std::vector<int> myvector;
ft::vector<int> ft_myvector;
std::vector<int>::iterator it;
ft::vector<int>::iterator ft_it;
// set some values (from 1 to 10)
for (int i = 1; i <= 10; i++) myvector.push_back(i);
for (int i = 1; i <= 10; i++) ft_myvector.push_back(i);
// erase the 6th element
it = myvector.erase(myvector.begin() + 5);
ft_it = ft_myvector.erase(ft_myvector.begin() + 5);
ASSERT_EQUAL(myvector, ft_myvector)
ASSERT_EQUAL(*it, *ft_it)
// erase the first 3 elements:
it = myvector.erase(myvector.begin(), myvector.begin() + 3);
ft_it = ft_myvector.erase(ft_myvector.begin(), ft_myvector.begin() + 3);
ASSERT_EQUAL(myvector, ft_myvector)
ASSERT_EQUAL(*it, *ft_it)
#ifdef PRINT
std::cout << "\033[1;35m";
std::cout << "\n--------TestErase--------\n";
std::cout << "\033[0m";
std::cout << "myvector contains:";
for (unsigned i=0; i<myvector.size(); ++i)
std::cout << ' ' << myvector[i];
std::cout << '\n';
std::cout << "ft_myvector contains:";
for (unsigned i=0; i<ft_myvector.size(); ++i)
std::cout << ' ' << ft_myvector[i];
std::cout << '\n';
#endif
}
static void TestClear() {
std::vector<int> myvector;
ft::vector<int> ft_myvector;
myvector.push_back(100);
myvector.push_back(200);
myvector.push_back(300);
ft_myvector.push_back(100);
ft_myvector.push_back(200);
ft_myvector.push_back(300);
ASSERT_EQUAL(myvector, ft_myvector)
#ifdef PRINT
std::cout << "\033[1;35m";
std::cout << "\n--------TestClear--------\n";
std::cout << "\033[0m";
std::cout << "myvector contains:";
for (unsigned i=0; i<myvector.size(); i++)
std::cout << ' ' << myvector[i];
std::cout << '\n';
std::cout << "ft_myvector contains:";
for (unsigned i=0; i<ft_myvector.size(); i++)
std::cout << ' ' << ft_myvector[i];
std::cout << '\n';
#endif
myvector.clear();
ft_myvector.clear();
ASSERT_EQUAL(myvector, ft_myvector)
myvector.push_back(1101);
myvector.push_back(2202);
ft_myvector.push_back(1101);
ft_myvector.push_back(2202);
ASSERT_EQUAL(myvector, ft_myvector)
#ifdef PRINT
std::cout << "myvector contains:";
for (unsigned i=0; i<myvector.size(); i++)
std::cout << ' ' << myvector[i];
std::cout << '\n';
std::cout << "ft_myvector contains:";
for (unsigned i=0; i<ft_myvector.size(); i++)
std::cout << ' ' << ft_myvector[i];
std::cout << '\n';
#endif
}
static void TestSwapMember() {
std::vector<int> foo(3, 100); // three ints with a value of 100
std::vector<int> bar(5, 200); // five ints with a value of 200
ft::vector<int> ft_foo(3, 100); // three ints with a value of 100
ft::vector<int> ft_bar(5, 200); // five ints with a value of 200
foo.swap(bar);
ft_foo.swap(ft_bar);
ASSERT_EQUAL(foo, ft_foo)
ASSERT_EQUAL(bar, ft_bar)
#ifdef PRINT
std::cout << "\033[1;35m";
std::cout << "\n--------TestSwapMember--------\n";
std::cout << "\033[0m";
std::cout << "foo contains:";
for (unsigned i=0; i<foo.size(); i++)
std::cout << ' ' << foo[i];
std::cout << '\n';
std::cout << "ft_foo contains:";
for (unsigned i=0; i<ft_foo.size(); i++)
std::cout << ' ' << ft_foo[i];
std::cout << '\n';
std::cout << "bar contains:";
for (unsigned i=0; i<bar.size(); i++)
std::cout << ' ' << bar[i];
std::cout << '\n';
std::cout << "ft_bar contains:";
for (unsigned i=0; i<ft_bar.size(); i++)
std::cout << ' ' << ft_bar[i];
std::cout << '\n';
#endif
}
static void TestCompare() {
std::vector<int> a(3, 100);
std::vector<int> b(2, 200);
ft::vector<int> ft_a(3, 100);
ft::vector<int> ft_b(2, 200);
ASSERT_EQUAL((a == b), (ft_a == ft_b))
ASSERT_EQUAL((a != b), (ft_a != ft_b))
ASSERT_EQUAL((a < b), (ft_a < ft_b))
ASSERT_EQUAL((a > b), (ft_a > ft_b))
ASSERT_EQUAL((a <= b), (ft_a <= ft_b))
ASSERT_EQUAL((a >= b), (ft_a >= ft_b))
#ifdef PRINT
std::cout << "\033[1;35m";
std::cout << "\n--------TestCompare--------\n";
std::cout << "\033[0m";
if (a==b) std::cout << "a and b are equal\n";
if (ft_a==ft_b) std::cout << "ft_a and ft_b are equal\n";
if (a!=b) std::cout << "a and b are not equal\n";
if (ft_a!=ft_b) std::cout << "ft_a and ft_b are not equal\n";
if (a<b) std::cout << "a is less than b\n";
if (ft_a<ft_b) std::cout << "ft_a is less than ft_b\n";
if (a>b) std::cout << "a is greater than b\n";
if (ft_a>ft_b) std::cout << "ft_a is greater than ft_b\n";
if (a<=b) std::cout << "a is less than or equal to b\n";
if (ft_a<=ft_b) std::cout << "ft_a is less than or equal to ft_b\n";
if (a>=b) std::cout << "a is greater than or equal to b\n";
if (ft_a>=ft_b) std::cout << "ft_a is greater than or equal to ft_b\n";
#endif
}
static void TestSwap() {
std::vector<int> foo(3, 100); // three ints with a value of 100
std::vector<int> bar(5, 200); // five ints with a value of 200
ft::vector<int> ft_foo(3, 100); // three ints with a value of 100
ft::vector<int> ft_bar(5, 200); // five ints with a value of 200
std::swap(foo, bar);
ft::swap(ft_foo, ft_bar);
ASSERT_EQUAL(foo, ft_foo)
ASSERT_EQUAL(bar, ft_bar)
#ifdef PRINT
std::cout << "\033[1;35m";
std::cout << "\n--------TestSwap--------\n";
std::cout << "\033[0m";
std::cout << "foo contains: " << foo << "\n";
std::cout << "ft_foo contains: " << ft_foo << "\n";
std::cout << "bar contains: " << bar << "\n";
std::cout << "ft_bar contains: " << ft_bar << "\n";
#endif
}
void test_vector() {
TestRunner tr;
std::cout << "\033[1;36m";
std::cout << "\n\n--------TEST VECTOR--------\n\n";
std::cout << "\033[0m";
RUN_TEST(tr, TestMemberType);
RUN_TEST(tr, TestConstructor);
RUN_TEST(tr, TestOperatorEqual);
RUN_TEST(tr, TestIterators);
RUN_TEST(tr, TestCapacity);
RUN_TEST(tr, TestElementAccess);
RUN_TEST(tr, TestAssign);
RUN_TEST(tr, TestPopBack);
RUN_TEST(tr, TestInsert);
RUN_TEST(tr, TestErase);
RUN_TEST(tr, TestClear);
RUN_TEST(tr, TestSwapMember);
RUN_TEST(tr, TestCompare);
RUN_TEST(tr, TestSwap);
}
| [
"gmorros@student.21-school.ru"
] | gmorros@student.21-school.ru |
191de8906a3d116cdb7f3d8a2c894af6d87da2cc | 52f8d136d3e8ea60f97be33819a0afb032e818ee | /Source/Oscillator.cpp | 4725c7760fede8938c62f7327161ce6c48db892e | [] | no_license | elliottbarrett/ndev-juce-demo | 5f5af5cd5b96f771bfa1622f7c957c6b7da3255c | ee0f80fdd2bab4b30d64294b5df4f7ad508ab2ac | refs/heads/master | 2021-06-10T13:36:42.251221 | 2016-12-19T23:56:33 | 2016-12-19T23:56:33 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,802 | cpp | /*
==============================================================================
Oscillator.cpp
Created: 14 Dec 2016 4:48:21pm
Author: Elliott Barrett
==============================================================================
*/
#include "Oscillator.h"
Oscillator::Oscillator()
{
}
Oscillator::~Oscillator()
{
}
void Oscillator::setOscillatorType(OscillatorType t)
{
type = t;
}
void Oscillator::setFrequency(float f)
{
frequency = f;
reset();
}
void Oscillator::setSampleRate(double hz)
{
sampleRate = hz;
reset();
}
float Oscillator::getNextValue()
{
float value;
if (angleDelta == 0)
{
return 0;
}
switch (type)
{
case OT_INVALID:
case OT_NONE:
value = 0;
break;
case OT_SINE:
value = sin(currentAngle);
break;
case OT_SQUARE:
value = (sin(currentAngle) > 0 ? 1 : -1);
break;
case OT_SAW:
value = (2 * currentAngle / TAU) - 1;
break;
case OT_TRIANGLE:
float cur = currentAngle / TAU;
if (cur <= 0.25) {
value = cur / 0.25;
} else if (cur <= 0.5) {
value = 1.0 - ((cur - 0.25) / 0.25);
} else if (cur <= 0.75) {
value = 0.0 - ((cur - 0.5) / 0.25);
} else {
value = -1.0 + ((cur - 0.75) / 0.25);
}
break;
}
currentAngle = fmod(currentAngle + angleDelta, TAU);
return value;
}
void Oscillator::reset()
{
float cyclesPerSample = frequency / sampleRate;
angleDelta = cyclesPerSample * TAU;
currentAngle = 0;
}
| [
"elliott.barrett@radient360.com"
] | elliott.barrett@radient360.com |
267f5779ee505c3dcd4072bcc7ed65e68384e976 | c00eaa165a6fa9860aab7d7b2fce9ef1273472e2 | /SPA/JSTag.h | 8bc456d5b75dc5804033347a5f42ca9863487d65 | [
"BSD-3-Clause"
] | permissive | jlandess/LandessDevCore | 40ab89443c05e04ba94f74d6fb8a51f68db34f22 | 3319c36c3232415d6bdba7da8b4896c0638badf2 | refs/heads/master | 2021-12-29T18:03:30.805114 | 2021-12-19T14:49:41 | 2021-12-19T14:49:41 | 240,625,347 | 4 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 1,608 | h | //
// Created by phoenixflower on 11/2/20.
//
#ifndef LANDESSDEVCORE_JSTAG_H
#define LANDESSDEVCORE_JSTAG_H
#include "Text.hpp"
#include "Reflection/Reflection.hpp"
namespace LD
{
namespace SPA
{
template<typename CodeStringType>
class Javascript
{
private:
LD::SPA::Text<CodeStringType> mSourceCode;
public:
Javascript() = default;
constexpr Javascript(CodeStringType && code) noexcept:mSourceCode{code}
{
}
LD::SPA::Text<CodeStringType> & Code() noexcept
{
return this->mSourceCode;
}
const LD::SPA::Text<CodeStringType> & Code() const noexcept
{
return this->mSourceCode;
}
};
template<typename Expression> Javascript(EventType &&, Expression &&) -> Javascript<Expression>;
}
}
template<typename JSTring>
struct LD::CT::TypeDescriptor<LD::SPA::Javascript<JSTring>>
{
private:
static constexpr auto AmountName = ctll::basic_fixed_string("elements");
public:
static constexpr auto ClassName = ctll::fixed_string{"script"};
using MemberList = LD::CT::TypeList<
LD::CT::EncapsulatedMemberDescriptor<AmountName,LD::CT::SelectOverload<LD::SPA::Text<JSTring> & (LD::SPA::Text<JSTring>::*)(),&LD::SPA::Text<JSTring>::Code>(),LD::CT::SelectOverload<const LD::SPA::Text<JSTring> & (LD::SPA::Text<JSTring>::*)() const,&LD::SPA::Javascript<JSTring>::Elements>()>
>;
static constexpr MemberList Members{ };
};
#endif //LANDESSDEVCORE_JSTAG_H
| [
"phoenixflower@pop-os.localdomain"
] | phoenixflower@pop-os.localdomain |
0561cccdbddd31e3366e9867d9e8c2089c0f743e | 0a2b1ad81fa76b582be797c8d4c1da3bf20aadf0 | /TestDatabaseModel/mysql.h | 934d304de11d99779064c40034fd21b74d957dde | [] | no_license | 39199934/TestDatabaseModel | e0725b24c1329fd1578c839486971f17919cab9a | 426201a88d9aab462748fe6965f66e4ce7d7fc7e | refs/heads/master | 2021-02-08T15:11:20.320198 | 2020-03-01T14:32:00 | 2020-03-01T14:32:00 | 244,164,582 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 781 | h | #ifndef MYSQL_H
#define MYSQL_H
#include <QSql>
#include <QSqlQueryModel>
#include <QSqlDatabase>
#include <QSqlQuery>
#include <QDebug>
#include <QSqlError>
#include <QSqlResult>
#include <iostream>
#include <QSqlTableModel>
#include <QBuffer>
#include <QWidget>
#include <QSqlQueryModel>
//#include "ShowImage.h"
using namespace std;
//#pragma comment(lib,"libmysql")
class MySql
{
public:
MySql();
virtual ~MySql();
void viewTable();
void insert();
QSqlQueryModel* getModel();
//QVector<QString> getDescription();
// QSqlTableModel* getModel();
private:
QString hostName;
QString dbName;
QString userName;
QString password;
int port;
QSqlDatabase dbConn;
QSqlQueryModel* model;
// ShowImage* show;
};
#endif // MYSQL_H
| [
"rolodestar@hotmail.com"
] | rolodestar@hotmail.com |
a11accac98708cdd0f3f3c5c5f43e9ffb3946218 | c91ba4e746dc5b8f2dface963b4096dd721070fd | /vpc/include/alibabacloud/vpc/model/DescribeRouterInterfacesRequest.h | 8816dc20beb6e65fbed5d8eb9ce897176bc53770 | [
"Apache-2.0"
] | permissive | IthacaDream/aliyun-openapi-cpp-sdk | fa9120604ca3af4fc48a5f9bf70ff10542103c3a | 31a064d1568f59e0731485a1b0452cfd5d767e42 | refs/heads/master | 2021-09-05T09:44:19.244166 | 2018-01-26T07:00:14 | 2018-01-26T07:00:14 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,084 | h | /*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef ALIBABACLOUD_VPC_MODEL_DESCRIBEROUTERINTERFACESREQUEST_H_
#define ALIBABACLOUD_VPC_MODEL_DESCRIBEROUTERINTERFACESREQUEST_H_
#include <string>
#include <vector>
#include <alibabacloud/vpc/VpcRequest.h>
namespace AlibabaCloud
{
namespace Vpc
{
namespace Model
{
class ALIBABACLOUD_VPC_EXPORT DescribeRouterInterfacesRequest : public VpcRequest
{
struct Filter
{
std::string key;
std::vector<std::string> value;
};
public:
DescribeRouterInterfacesRequest();
~DescribeRouterInterfacesRequest();
std::vector<Filter> getFilter()const;
void setFilter(const std::vector<Filter>& filter);
long getResourceOwnerId()const;
void setResourceOwnerId(long resourceOwnerId);
std::string getResourceOwnerAccount()const;
void setResourceOwnerAccount(const std::string& resourceOwnerAccount);
std::string getRegionId()const;
void setRegionId(const std::string& regionId);
int getPageSize()const;
void setPageSize(int pageSize);
long getOwnerId()const;
void setOwnerId(long ownerId);
int getPageNumber()const;
void setPageNumber(int pageNumber);
private:
std::vector<Filter> filter_;
long resourceOwnerId_;
std::string resourceOwnerAccount_;
std::string regionId_;
int pageSize_;
long ownerId_;
int pageNumber_;
};
}
}
}
#endif // !ALIBABACLOUD_VPC_MODEL_DESCRIBEROUTERINTERFACESREQUEST_H_ | [
"haowei.yao@alibaba-inc.com"
] | haowei.yao@alibaba-inc.com |
89d75dc5fb6946cba781e021d6b20a34496f66a5 | 32624964ac9a5ccac8a0b1828bad8e2e8d8733b4 | /图论/sgu321_图论_shuangduanduilie.cpp | a0f7a2baa111a1c74a5f4be46d9196bd697ff462 | [] | no_license | lanmaoac/acm_icpc | 6a8776765bcdae2b066c1907722ebdf01c41a007 | 092b3dbcdc538430e7ecd49bc03e639effbde836 | refs/heads/master | 2016-09-03T07:04:11.756774 | 2014-06-18T10:33:58 | 2014-06-18T10:33:58 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,418 | cpp | #include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <cmath>
#include <iostream>
#include <cstdlib>
#include <sstream>
#include <deque>
const int maxn = 200007;
typedef std::pair<bool,std::pair<int,int> >node;
node edge[maxn];
std::vector<int>adj[maxn];
int top=0;
int cnt=0;int tot=0;
int len=0;
int ans[maxn];
std::deque<int>path;
void add(int from,int to,int w)
{
edge[top++]=std::make_pair(w,std::make_pair(from,to));
edge[top++]=std::make_pair(w,std::make_pair(to,from));
adj[from].push_back(top-2);
adj[to].push_back(top-1);
}
void dfs(int now,int father)
{
if(2*cnt<len){
ans[tot++]=path.front();
edge[path.front()].first=true;
path.pop_front();
++cnt;
}
for(int i=0;i<adj[now].size();i++){
int e=adj[now][i];
int v=edge[e].second.second;
if(v==father) continue;
if(!edge[e].first) path.push_back(e);
cnt+=edge[e].first?1:0;
len+=1;
dfs(v,now);
len-=1;
if(!edge[e].first) path.pop_back();
cnt-=cnt+=edge[e].first?1:0;
}
}
int main()
{
int n;
scanf("%d",&n);
for(int i=1;i<=n-1;i++){
int a,b,w;char s[500];
scanf("%d%d%s",&a,&b,s);
if(s[0]=='a')
w=0,scanf("%s",s);
else w=1;
add(a,b,w);
}
dfs(1,-1);
printf("%d\n",tot);
if (tot>0) printf("%d",ans[0]);
for (int i=1;i<tot;++i) printf(" %d",ans[i]);
putchar('\n');
return 0;
}
| [
"acsongyu@gmail.com"
] | acsongyu@gmail.com |
43ac978fe9c523ef1b1544d8cef30ff1bf3b0616 | 6b738bd0081ad09b12965ea77be58253e783b442 | /hilti/codegen/instructions/old/caddr.cc | dad004bc134a8386d80da94f3daa67157e570d39 | [
"BSD-2-Clause"
] | permissive | FrozenCaribou/hilti | 1f9b4d94aea500dfa50b3f54a9a079cf9e067506 | 10d3653b13268d7c2d1a19e0f675f43c9598a7b5 | refs/heads/master | 2021-01-18T02:59:12.841005 | 2016-05-31T14:02:15 | 2016-05-31T14:02:15 | 40,124,420 | 1 | 0 | null | 2015-08-03T12:49:21 | 2015-08-03T12:49:20 | null | UTF-8 | C++ | false | false | 1,351 | cc |
#include <hilti.h>
#include "../stmt-builder.h"
using namespace hilti;
using namespace codegen;
void StatementBuilder::visit(statement::instruction::caddr::Function* i)
{
/*
auto op1 = cg()->llvmValue(i->op1(), X);
auto result = builder()->
cg()->llvmStore(i, result);
*/
/*
CodeGen::expr_list args;
args.push_back(i->op1());
auto result = cg()->llvmCall("hlt::X", args);
cg()->llvmStore(i, result);
*/
/*
def _codegen(self, cg):
fid = self.op1().value()
func = cg.lookupFunction(fid)
builder = cg.builder()
if func.callingConvention() == function.CallingConvention.HILTI:
(hltmain, main, hltresume, resume) = cg.llvmCStubs(func)
main = builder.bitcast(main, cg.llvmTypeGenericPointer())
resume = builder.bitcast(resume, cg.llvmTypeGenericPointer())
elif func.callingConvention() == function.CallingConvention.C_HILTI:
func = cg.llvmFunction(func)
main = builder.bitcast(func, cg.llvmTypeGenericPointer())
resume = llvm.core.Constant.null(cg.llvmTypeGenericPointer())
else:
util.internal_error("caddr.Function not supported for non-HILTI/HILTI-C functions yet")
struct = llvm.core.Constant.struct([main, resume])
cg.llvmStoreInTarget(self, struct)
*/
}
| [
"robin@icir.org"
] | robin@icir.org |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.