blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 3 264 | content_id stringlengths 40 40 | detected_licenses listlengths 0 85 | license_type stringclasses 2
values | repo_name stringlengths 5 140 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringclasses 986
values | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 3.89k 681M ⌀ | star_events_count int64 0 209k | fork_events_count int64 0 110k | gha_license_id stringclasses 23
values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 145
values | src_encoding stringclasses 34
values | language stringclasses 1
value | is_vendor bool 1
class | is_generated bool 2
classes | length_bytes int64 3 10.4M | extension stringclasses 122
values | content stringlengths 3 10.4M | authors listlengths 1 1 | author_id stringlengths 0 158 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
b03e01a371cfd5daceae1a8ab785721bdb4c2f1e | 553eacf6292ab90a4d1a264cac5bc4118928fb8a | /asteria/test/stack_overflow.cpp | c125b20475c6c735827acc84bd4d7af517284e2b | [
"BSD-3-Clause"
] | permissive | JamesChenGithub/asteria | 71fc8e34cc19a7f0c0271774d2b4a04a89c77904 | ef954d87f90235f900ba6ec21ae4d4d5471ad2c5 | refs/heads/master | 2022-12-30T21:39:10.377391 | 2020-10-21T09:55:43 | 2020-10-21T09:55:43 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 743 | cpp | // This file is part of Asteria.
// Copyleft 2018 - 2020, LH_Mouse. All wrongs reserved.
#include "util.hpp"
#include "../src/simple_script.hpp"
#include "../src/runtime/global_context.hpp"
using namespace asteria;
int main()
{
Simple_Script code;
code.reload_string(
///////////////////////////////////////////////////////////////////////////////
::rocket::sref(__FILE__), __LINE__, ::rocket::sref(R"__(
func recur(n) {
std.debug.logf("recur($1)", n + 1);
return recur(n + 1) + 1;
}
return recur(0);
///////////////////////////////////////////////////////////////////////////////
)__"));
Global_Context global;
ASTERIA_TEST_CHECK_CATCH(code.execute(global));
}
| [
"lh_mouse@126.com"
] | lh_mouse@126.com |
623b32470be70f217e861752e32cbe6c6c7350f4 | a3d6556180e74af7b555f8d47d3fea55b94bcbda | /components/metrics/structured/reporting/structured_metrics_reporting_service.cc | ebd0adcdec1d0ac37adb1c58e2672c09b67c1700 | [
"BSD-3-Clause"
] | permissive | chromium/chromium | aaa9eda10115b50b0616d2f1aed5ef35d1d779d6 | a401d6cf4f7bf0e2d2e964c512ebb923c3d8832c | refs/heads/main | 2023-08-24T00:35:12.585945 | 2023-08-23T22:01:11 | 2023-08-23T22:01:11 | 120,360,765 | 17,408 | 7,102 | BSD-3-Clause | 2023-09-10T23:44:27 | 2018-02-05T20:55:32 | null | UTF-8 | C++ | false | false | 3,693 | cc | // Copyright 2023 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "components/metrics/structured/reporting/structured_metrics_reporting_service.h"
#include "base/metrics/histogram_functions.h"
#include "components/metrics/metrics_service_client.h"
#include "components/metrics/structured/reporting/structured_metrics_log_metrics.h"
#include "components/metrics/structured/structured_metrics_prefs.h"
#include "components/metrics/url_constants.h"
#include "components/prefs/pref_registry_simple.h"
namespace metrics::structured::reporting {
StructuredMetricsReportingService::StructuredMetricsReportingService(
MetricsServiceClient* client,
PrefService* local_state,
const UnsentLogStore::UnsentLogStoreLimits& storage_limits)
: ReportingService(client,
local_state,
storage_limits.max_log_size_bytes,
/*logs_event_manager=*/nullptr),
log_store_(std::make_unique<StructuredMetricsLogMetrics>(),
local_state,
prefs::kLogStoreName,
/* metadata_pref_name=*/nullptr,
storage_limits,
client->GetUploadSigningKey(),
/* logs_event_manager=*/nullptr) {}
void StructuredMetricsReportingService::StoreLog(
const std::string& serialized_log,
metrics::MetricsLogsEventManager::CreateReason reason) {
LogMetadata metadata;
log_store_.StoreLog(serialized_log, metadata, reason);
}
metrics::LogStore* StructuredMetricsReportingService::log_store() {
return &log_store_;
}
void StructuredMetricsReportingService::Purge() {
log_store_.Purge();
}
// Getters for MetricsLogUploader parameters.
GURL StructuredMetricsReportingService::GetUploadUrl() const {
return client()->GetMetricsServerUrl();
}
GURL StructuredMetricsReportingService::GetInsecureUploadUrl() const {
return client()->GetInsecureMetricsServerUrl();
}
base::StringPiece StructuredMetricsReportingService::upload_mime_type() const {
return kDefaultMetricsMimeType;
}
MetricsLogUploader::MetricServiceType
StructuredMetricsReportingService::service_type() const {
return MetricsLogUploader::STRUCTURED_METRICS;
}
// Methods for recording data to histograms.
void StructuredMetricsReportingService::LogActualUploadInterval(
base::TimeDelta interval) {
base::UmaHistogramCustomCounts(
"StructuredMetrics.Reporting.ActualUploadInterval", interval.InMinutes(),
1, base::Hours(12).InMinutes(), 50);
}
void StructuredMetricsReportingService::LogResponseOrErrorCode(
int response_code,
int error_code,
bool /*was_http*/) {
// TODO(crbug.com/1445155) Do we assume |was_https| is always true? UMA
// doesn't but UKM does.
if (response_code >= 0) {
base::UmaHistogramSparse("StructuredMetrics.Reporting.HTTPResponseCode",
response_code);
} else {
base::UmaHistogramSparse("StructuredMetrics.Reporting.HTTPErrorCode",
error_code);
}
}
void StructuredMetricsReportingService::LogSuccessLogSize(size_t log_size) {
base::UmaHistogramMemoryKB("StructuredMetrics.Reporting.LogSize.OnSuccess",
log_size);
}
void StructuredMetricsReportingService::LogLargeRejection(size_t log_size) {
base::UmaHistogramMemoryKB("StructuredMetrics.Reporting.LogSize.RejectedSize",
log_size);
}
// static:
void StructuredMetricsReportingService::RegisterPrefs(
PrefRegistrySimple* registry) {
registry->RegisterListPref(prefs::kLogStoreName);
}
} // namespace metrics::structured::reporting
| [
"chromium-scoped@luci-project-accounts.iam.gserviceaccount.com"
] | chromium-scoped@luci-project-accounts.iam.gserviceaccount.com |
19e936b5d745195551d707a02fbe72d93188bdfe | 6b676750c34e06efe3aa44d7596d4695afc78f76 | /Marker less position estimation/PatternDetector.h | 8446de39d45c1016ae39faa8fee50b989cdffe16 | [
"MIT"
] | permissive | isamu-isozaki/Mastering-OpenCV-with-Practical-Computer-Vision-Projects | 7860132ca2ced034de07f20a34cd6bedefeeff36 | 35d754c45a2162dfd986143f7124805a3283705e | refs/heads/master | 2020-07-31T07:45:55.962340 | 2017-04-26T06:36:41 | 2017-04-26T06:36:41 | 73,604,639 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,199 | h | #ifndef LOADED_ALL
#include <opencv2\opencv.hpp>
#define LOADED_ALL
#endif
//#ifndef PATTERN_DETECTOR
//#define PATTERN_DETECTOR
#include "Pattern.h"
#include "PatternTrackingInfo.h"
class PatternDetector{
public:
PatternDetector();
void extractFeatures(const cv::Mat&, std::vector<cv::KeyPoint>&, cv::Mat&);//obtain the keypoints and the descriptors given the image
void train(const Pattern&);//train the matcher
void getMatch(cv::Mat&, std::vector<cv::DMatch>&, const bool&);//From input image return matches depending on the type specified 0:match(), 1:knnMatch(), 2:radiusMatch
bool refineMatches(const std::vector<cv::KeyPoint>&, const std::vector<cv::KeyPoint>&, const float&, std::vector<cv::DMatch>&, cv::Mat&, const bool&);//refine the matches by using homography and only returning inliners
void prepareForFindPattern(const cv::Mat&);//Makes pattern, sets marker and trains the marker
bool findPattern(const std::string&, const std::string&, PatternTrackingInfo&, const bool&, const bool&);//finds the pattern in the query image and stores the homography matrix and the transformed 2d image points in
void estimatePosition(const Pattern&, const CameraCalibration&, cv::Mat&, const bool&);//compute the marker pose and the extrinsic matrix given the pattern and the camera calibration
Pattern m_pattern;
PatternTrackingInfo info;
cv::Mat m_markerPose;
cv::Mat m_extrinsic;
private:
cv::Mat m_grayImg;
cv::Mat m_warpedImg;
CameraCalibration calibration;
cv::Ptr<cv::FeatureDetector> m_detector;
cv::Ptr<cv::DescriptorExtractor> m_extractor;
cv::Ptr<cv::DescriptorMatcher> m_matcher;
std::vector<cv::KeyPoint> m_queryKeyPoints;
cv::Mat m_queryDescriptors;
std::vector<cv::DMatch> m_matches;
cv::Mat m_roughHomography;
cv::Mat m_refinedHomography;
cv::Mat rMat;
cv::Mat tvec;
bool enableRatioTest = true;
bool enableHomographyRefinement = true;
float homographyReprojectionThreshold = 3;
void getGray(const cv::Mat&, cv::Mat&);
void setMatcher(const int&);//0:BFMatcher with crosscheck, 1:FlannBasedMatcher
void makeTrainPattern(const cv::Mat& train, Pattern& pattern, const bool& apply);
};
| [
"noreply@github.com"
] | isamu-isozaki.noreply@github.com |
9f3791b3e90ab8967b39f68f32f31c934319c9c7 | 7161fa984e5312f6861f1a2f99ccde463b5302d7 | /Source/UnrealFastNoisePlugin/Private/UFNConstantModule.cpp | 14b84459d2d5ce2824da45322b6701f25a6babb1 | [
"MIT"
] | permissive | Kolky/UnrealFastNoise | 067d7d15d6b315bd4184d617f1b07e805a1a538c | a769ab7f0fd8fb0fb8b7efab4a6a10d4ff8550f7 | refs/heads/master | 2020-09-07T04:45:40.313390 | 2019-11-09T15:14:37 | 2019-11-09T15:14:37 | 220,659,504 | 0 | 0 | MIT | 2019-11-09T15:08:54 | 2019-11-09T15:08:53 | null | UTF-8 | C++ | false | false | 361 | cpp | #include "UFNConstantModule.h"
#include "UFNNoiseGenerator.h"
UUFNConstantModule::UUFNConstantModule(const FObjectInitializer& ObjectInitializer) : Super(ObjectInitializer)
{
}
float UUFNConstantModule::GetNoise3D(float aX, float aY, float aZ)
{
return constantValue;
}
float UUFNConstantModule::GetNoise2D(float aX, float aY)
{
return constantValue;
}
| [
"chrisashworth@appzeit.com"
] | chrisashworth@appzeit.com |
b42a363fd99bebee954c959e0e361d74c7e7994d | a8f3402afea0c2766bfa0c51c7234fcef1c113ef | /SBSystemBackup/global.cpp | 62cb86dd7584ef397d017a0ccd325b7697b02852 | [] | no_license | iceboundx/SBSystem | 2c432af5b73acc0b63aebb244ddd9c710ce798e9 | e305dd6bf761b085c29de7d0e13f99090a12cde7 | refs/heads/master | 2020-03-28T17:37:59.351135 | 2018-09-20T18:54:53 | 2018-09-20T18:54:53 | 148,809,159 | 2 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 113 | cpp | #include "global.h"
SBSmanager *man;
site empty_site;
order empty_order;
site init_site;
QDateTime lst_vis_time;
| [
"icebound1999@hotmail.com"
] | icebound1999@hotmail.com |
0ef4a57115b45355e2f8c7096f9a67f78f5e4d03 | daa634c9c80abedf2f3fcd94c1af81c1fccf5255 | /吉田学園情報ビジネス専門学校 尾崎大輔/ゲーム作品/01_個人作品/02_1年 2Dアクションゲーム(著作権アクション)/ソースプロジェクト/Gameover.cpp | 803e49532b71e65c455234f36673a6a4090e01fc | [] | no_license | ozakidaisukea/GamePerformance | 49de174c52942d1ecfae011136031208254e1c7a | 31eea2507bcc8f0f5543425c82adf2f4d869a210 | refs/heads/master | 2022-01-06T17:31:21.956265 | 2019-05-15T09:14:30 | 2019-05-15T09:14:30 | 185,955,578 | 0 | 0 | null | null | null | null | SHIFT_JIS | C++ | false | false | 4,399 | cpp | //=============================================================================
//
// 背景の処理 [Gameover.cpp]
// Author : Ozaki
//
//=============================================================================
#include "main.h"
#include "BG.h"
#include "Gameover.h"
#include "fade.h"
#include "input.h"
#include "sound.h"
//*****************************************************************************
// マクロ定義
//*****************************************************************************
#define GAMEOVER_WIDTH (SCREEN_WIDTH)
#define GAMEOVER_HEIGHT (SCREEN_HEIGHT)
//*****************************************************************************
// グローバル変数
//*****************************************************************************
//VERTEX_2D g_aVertex[4]; //頂点情報を格納する
LPDIRECT3DTEXTURE9 g_pTextureGAMEOVER = NULL; //テクスチャへのポインタ
LPDIRECT3DVERTEXBUFFER9 g_pVtxBuffGAMEOVER = NULL; //テクスチャのポインタ
int Gameovertimer;
//=============================================================================
// 初期化処理(ポリゴン)
//=============================================================================
void InitGameover(void)
{
LPDIRECT3DDEVICE9 pDevise; //デバイスのポインタ
//デバイスの取得
pDevise = GetDevice();
Gameovertimer = 0;
//テクスチャの読み込み
D3DXCreateTextureFromFile(pDevise,
"data\\TEXTURE\\gameover.jpg",
&g_pTextureGAMEOVER);
//頂点バッファの生成
pDevise->CreateVertexBuffer(sizeof(VERTEX_2D) * 4,
D3DUSAGE_WRITEONLY,
FVF_VRETEX_2D,
D3DPOOL_MANAGED,
&g_pVtxBuffGAMEOVER,
NULL);
//ローカル変数
VERTEX_2D*pVtx; //頂点情報へのポインタ
//頂点バッファをロックし、頂点データのポインタの取得
g_pVtxBuffGAMEOVER->Lock(0, 0, (void**)&pVtx, 0);
//頂点座標の設定
pVtx[0].pos = D3DXVECTOR3(0, 0, 0.0f);
pVtx[1].pos = D3DXVECTOR3(SCREEN_WIDTH, 0, 0.0f);
pVtx[2].pos = D3DXVECTOR3(0, SCREEN_HEIGHT, 0.0f);
pVtx[3].pos = D3DXVECTOR3(SCREEN_WIDTH, SCREEN_HEIGHT, 0.0f);
//テクスチャの設定
pVtx[0].tex = D3DXVECTOR2(0.0f, 0.0f);
pVtx[1].tex = D3DXVECTOR2(1.0f, 0.0f);
pVtx[2].tex = D3DXVECTOR2(0.0f, 1.0f);
pVtx[3].tex = D3DXVECTOR2(1.0f, 1.0f);
//rhwの設定
pVtx[0].rhw = 1.0f;
pVtx[1].rhw = 1.0f;
pVtx[2].rhw = 1.0f;
pVtx[3].rhw = 1.0f;
//頂点カラーの設定
pVtx[0].col = D3DCOLOR_RGBA(255, 255, 255, 255);
pVtx[1].col = D3DCOLOR_RGBA(255, 255, 255, 255);
pVtx[2].col = D3DCOLOR_RGBA(255, 255, 255, 255);
pVtx[3].col = D3DCOLOR_RGBA(255, 255, 255, 255);
//頂点バッファをアンロック
g_pVtxBuffGAMEOVER->Unlock();
}
//=============================================================================
// 終了処理(ポリゴン)
//=============================================================================
void UninitGameover(void)
{
//テクスチャの破棄
if (g_pTextureGAMEOVER != NULL)
{
g_pTextureGAMEOVER->Release();
g_pTextureGAMEOVER = NULL;
}
//頂点バッファの破棄
if (g_pVtxBuffGAMEOVER != NULL)
{
g_pVtxBuffGAMEOVER->Release();
g_pVtxBuffGAMEOVER = NULL;
}
}
//=============================================================================
// 更新処理(ポリゴン)
//=============================================================================
void UpdateGameover(void)
{
FADE Fade;
Fade = GetFade();
Gameovertimer++;
if (Fade == FADE_NONE)
{
if (GetKeyboardTrigger(DIK_RETURN) == true && Fade == FADE_NONE)
{
SetFade(MODE_RANKING);
PlaySound(SOUND_LABEL_SE_DECIDE);
}
if (Gameovertimer == 700)
{
SetFade(MODE_TITLE);
Gameovertimer = 0;
}
}
}
//=============================================================================
// 描画処理(ポリゴン)
//=============================================================================
void DrawGameover(void)
{
LPDIRECT3DDEVICE9 pDevice;
//デヴァイスを取得
pDevice = GetDevice();
//頂点バッファをデータストリームに設定
pDevice->SetStreamSource(0, g_pVtxBuffGAMEOVER, 0, sizeof(VERTEX_2D));
//頂点フォーマットの設定
pDevice->SetFVF(FVF_VRETEX_2D);
//テクスチャの設定
pDevice->SetTexture(0, g_pTextureGAMEOVER);
//ポリゴンの描画
pDevice->DrawPrimitive(D3DPT_TRIANGLESTRIP,
0,
2);
} | [
"daisuke,vip17@gmail.com"
] | daisuke,vip17@gmail.com |
fc90fd32f9df1d503404259dcc4519116e809c53 | 2418e6c107e2095f47352b461ae8a9e5d7624015 | /PuntoIsoelectrico/Molecula.h | bbd9db7a4a4de44f9c3b44a2cc658c7aa9f2a049 | [] | no_license | AdairMacias/PracticasComputacionI | 7e452824b6ec1b84071084ecbb89b31aa91d5931 | 6e01cb9bc0a1af206e3689516a1e13ca7f003d9c | refs/heads/main | 2023-01-30T15:57:01.390230 | 2020-12-10T18:03:04 | 2020-12-10T18:03:04 | 302,512,446 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 363 | h | #ifndef MOLECULAS_H
#define MOLECULAS_H
#include <string>
#include <vector>
#include "Grupo.h"
using namespace std;
class Molecula
{
public:
Molecula(string nom) { nombre = nom; };
void AgregarGrupo(Grupo grupo);
void setCargaNeta();
float CalcularPuntoIsoelectrico();
private:
string nombre;
vector<Grupo> molecula;
int cargaNeta = 0;
};
#endif
| [
"noreply@github.com"
] | AdairMacias.noreply@github.com |
62d7560271c574a2e9f7d7b7519939f9e34328ff | 251e135267b5af08e934c0e2f0b32d7fb557d7af | /test/thread/test_thread.cpp | e32104a30c8fef0f86e4cea68527d7e82eb3a706 | [] | no_license | androids7/fancystar | 221eafae3a8cef4bd6256a56eb3a74f843169b5a | 6807008f639c15cff57192adb25e36404bffe85a | refs/heads/master | 2021-05-27T08:31:01.065707 | 2014-12-19T14:18:44 | 2014-12-19T14:18:44 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,861 | cpp | #include "winpch.h"
#include "wyc/util/util.h"
#include "wyc/util/time.h"
#ifdef _DEBUG
#pragma comment(lib, "fslog_d.lib")
#pragma comment(lib, "fsutil_d.lib")
#pragma comment(lib, "fsthread_d.lib")
#else
#pragma comment(lib, "fslog.lib")
#pragma comment(lib, "fsutil.lib")
#pragma comment(lib, "fsthread.lib")
#endif
extern void test_read_write_fence(void);
extern void test_reference_counter(void);
extern void test_critical_section(void);
extern void test_peterson_lock(void);
extern void test_asyncque(void);
extern void test_mpmc_queue(void);
extern void test_async_cache(void);
extern void test_ring_queue(void);
#include <atomic>
void std_atomic_lock_free_check()
{
std::atomic_bool bval;
std::atomic_char cval;
std::atomic_int ival;
std::atomic_long lval;
std::atomic_int32_t i32val;
std::atomic_int64_t i64val;
std::atomic<float> fval;
std::atomic<double> dval;
const char *t = "true";
const char *f = "false";
printf("std::atomic_bool is lock-free: %s\n",bval.is_lock_free()?t:f);
printf("std::atomic_char is lock-free: %s\n",cval.is_lock_free()?t:f);
printf("std::atomic_int is lock-free: %s\n",ival.is_lock_free()?t:f);
printf("std::atomic_long is lock-free: %s\n",lval.is_lock_free()?t:f);
printf("std::atomic_int32_t is lock-free: %s\n",i32val.is_lock_free()?t:f);
printf("std::atomic_int64_t is lock-free: %s\n",i64val.is_lock_free()?t:f);
printf("std::atomic<float> is lock-free: %s\n",fval.is_lock_free()?t:f);
printf("std::atomic<double> is lock-free: %s\n",dval.is_lock_free()?t:f);
}
int main(int, char **)
{
// std_atomic_lock_free_check();
// test_read_write_fence();
// test_reference_counter();
// test_critical_section();
// test_peterson_lock();
// test_asyncque();
test_mpmc_queue();
// test_async_cache();
// test_ring_queue();
wyc_print("Press [Enter] to continue");
getchar();
return 0;
}
| [
"wangyongcong@gmail.com"
] | wangyongcong@gmail.com |
1e03d65262eecb200ef5398b5f48027d7cf5c459 | c9bdc65d2bbe24b75ae9f83461936605a266786b | /project1/tree_species.cpp | 2e6e618dd3f58f320b4dc6dce12c38e833ffec74 | [] | no_license | thomas-westfall/csci335 | 3c3ce25e3f3b787d2d09f02b5a44edd1c0ebff5e | 93154a3a50e0c11431d18f3d34d6394c02ee0932 | refs/heads/master | 2020-04-26T11:28:06.026785 | 2019-05-13T02:28:02 | 2019-05-13T02:28:02 | 173,517,427 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 5,024 | cpp | #include <algorithm>
#include "tree_species.h"
TreeSpecies::TreeSpecies(){
sizev = 0;
}
TreeSpecies::~TreeSpecies(){
}
void TreeSpecies::print_all_species(ostream & out) const{
//copy the vector to a temp vector, sort the temp, then print in order.
vector<string> speciestemp;
for(int i = 0; i < speciesv.size(); i++){
speciestemp.push_back(speciesv[i]);
}
sort(speciestemp.begin(),speciestemp.end());
for(int i = 0; i < speciestemp.size(); i++){
out<<speciestemp[i]<<endl;
}
}
int TreeSpecies::number_of_species() const{
return sizev;
}
int TreeSpecies::add_species( const string & species){
//check if the species is already in treespecies. if not, add it
int notfound = find(speciesv.begin(), speciesv.end(),
species) == speciesv.end();
if(notfound){
speciesv.push_back(species);
sizev++;
}
return notfound;
}
list<string> TreeSpecies::get_matching_species(const string & partial_name) const{
list<string> ans; //where the matching species names are stored
string tree_type; //current species name
string tree_to_find = ""; //= partial_name;
//remove the leading space tacked on to partial_name from the command line
if(partial_name.at(0) == ' '){
for(int k = 1; k < partial_name.length(); k++)
tree_to_find = tree_to_find + partial_name.at(k);
}
string temp = "";//where each space/dash-seperated value is stored
//
bool ispecial = false; //does the current species have spaces/hyphens
bool ispecialp = false; //does partial name have spaces/hyphens
//for possibility 3 (both partialname and speciesname have special chars)
int stillmatching = 0; //check if partialname still matches speciesname
vector<string> v1; //each element is a
vector<string> v2;
//get a lowercase version of partial_name and tree_to_find
transform(tree_to_find.begin(), tree_to_find.end(),
tree_to_find.begin(), ::tolower);
//check if partial name has spaces or dashes
size_t found = tree_to_find.find(" ");
size_t foundh = tree_to_find.find("-");
if(found != string::npos or foundh != string::npos)
ispecialp = true;
for(int i = 0; i < speciesv.size(); i++){
//make current species lowercase
tree_type = speciesv[i];
transform(tree_type.begin(), tree_type.end(), tree_type.begin(), ::tolower);
if(tree_type.compare(tree_to_find) == 0){
ans.push_back(speciesv[i]);
continue; //avoid pushing the same species again
}
//check if current species has ' ' or '-'
found = tree_type.find(" ");
foundh = tree_type.find("-");
if(found != string::npos or foundh != string::npos)
ispecial = true;
//case 2: tree_to_find has no special chars but tree_species does
if((!ispecialp) and (ispecial)){
temp = "";
//construct temp (current string separated by ' ' or '-'
for(int k = 0; k < tree_type.length(); k++){
//temp is complete (reached a specialchar or end of string)
if((tree_type.at(k) == ' ' or tree_type.at(k) == '-') or
k == tree_type.length()-1){
if(k == tree_type.length() - 1){
temp = temp + tree_type.at(k);
}
//check if the current separated value is equal to partialname
if(temp.compare(tree_to_find) == 0){
ans.push_back(speciesv[i]);
break;
}
temp = "";
}
//temp is incomplete, add current char to temp
if(tree_type.at(k) != ' ' and tree_type.at(k) != '-')
temp = temp + tree_type.at(k);
}
}
//case 3: tree_to_find and tree_species both have special chars
if((ispecialp) and (ispecial)){
v1.clear();
v2.clear();
temp = "";
//construct v1 (holds words of partial name seperated by ' ' or '-')
for(int f = 0; f < tree_to_find.length();f++){
if((tree_to_find.at(f) == ' ' or tree_to_find.at(f) == '-') or
f == tree_to_find.length() - 1){
if(f == tree_to_find.length() - 1)
temp = temp + tree_to_find.at(f);
v1.push_back(temp);
temp = "";
continue;
}
if(tree_to_find.at(f) != ' ' and tree_to_find.at(f) != '-')
temp = temp + tree_to_find.at(f);
}
temp = "";
//construct v2 (holds words of current species name)
//seperated by ' ' or '-'
for(int g = 0; g < tree_type.length(); g++){
if((tree_type.at(g) == ' ' or tree_type.at(g) == '-') or
g == tree_type.length() - 1){
if(g == tree_type.length() - 1)
temp = temp + tree_type.at(g);
v2.push_back(temp);
temp = "";
continue;
}
if(tree_type.at(g) != ' ' and tree_type.at(g) != '-')
temp = temp + tree_type.at(g);
}
//iterate through v2 (currentspecies vector)
//v2 is always at least one larger than v1 (since v1 is a partial name)
//check if all of v1 (partial name) is in v2 (in order)
stillmatching = 0;
for(int d = 0; d < v2.size(); d++){
if(v2[d] == v1[stillmatching])
stillmatching++;
else
stillmatching = 0;
if(v1[v1.size()-1] == v2[d] and stillmatching == v1.size()){
ans.push_back(speciesv[i]);
break;
}
}
}
}
return ans;
}
| [
"thomas.westfall64@myhunter.cuny.edu"
] | thomas.westfall64@myhunter.cuny.edu |
df814e7c3c166bc153cc93d47560240d0040bcde | e5c0b38c9cc0c0e6155c9d626e299c7b03affd1e | /trunk/Code/Engine/GUI/GUIManager.cpp | d14872c8bd87206a2d626289c5c4bb6470061f9d | [] | no_license | BGCX261/zombigame-svn-to-git | 4e5ec3ade52da3937e2b7d395424c40939657743 | aa9fb16789f1721557085deae123771f5aefc4dd | refs/heads/master | 2020-05-26T21:56:40.088036 | 2015-08-25T15:33:27 | 2015-08-25T15:33:27 | 41,597,035 | 0 | 0 | null | null | null | null | ISO-8859-1 | C++ | false | false | 31,672 | cpp | #include "GUIManager.h"
#include "Core.h"
#include "Base.h"
#include "InputManager.h"
#include "RenderManager.h"
#include "Logger/Logger.h"
#include "GUIWindow.h"
#include "xml/XMLTreeNode.h"
#include "Texture/TextureManager.h"
#include "ScriptManager.h"
//--Includes GuiElements---
#include "Exceptions/Exception.h"
#include "TextBox.h"
#include "PointerMouse.h"
#include "Button.h"
#include "CheckButton.h"
#include "DialogBox.h"
#include "EditableTextBox.h"
#include "Image.h"
#include "TextBox.h"
#include "ProgressBar.h"
#include "RadioBox.h"
#include "Slider.h"
#include "Statictext.h"
//-------------------------
//----------------------------------------------------------------------------
// Constructor
//----------------------------------------------------------------------------
CGUIManager::CGUIManager(const Vect2i& resolution)
: m_sCurrentWindows("Main.xml")
, m_TextBox(NULL)
, m_PointerMouse(NULL)
, m_bRenderError(false)
, m_bUpdateError(false)
, m_ScreenResolution(resolution)
, m_bIsOk(false)
, m_bLoadedGuiFiles(false)
, m_sLastLoadpathGUI_XML("")
, m_bFirstUpdate(true)
, m_bVisiblePointerMouse(true)
{
int jorls = 0;
}
//----------------------------------------------------------------------------
// Finalize data
//----------------------------------------------------------------------------
void CGUIManager::Done ()
{
if (IsOk())
{
Release();
m_bIsOk = false;
}
}
//----------------------------------------------------------------------------
// Free memory
//----------------------------------------------------------------------------
void CGUIManager::Release ()
{
LOGGER->AddNewLog(ELL_INFORMATION, "GUIManager:: shutting down GUI");
std::map<std::string, CGUIWindow*>::iterator it;
std::map<std::string, CGUIWindow*>::iterator itEnd(m_WindowsMap.end());
for( it = m_WindowsMap.begin(); it != itEnd; ++it)
{
CGUIWindow* windows = it->second;
CHECKED_DELETE(windows);
}
m_WindowsMap.clear();
CHECKED_DELETE(m_TextBox);
CHECKED_DELETE(m_PointerMouse);
LOGGER->AddNewLog(ELL_INFORMATION, "GUIManager:: offline (ok)");
}
//----------------------------------------------------------------------------
// Init
//----------------------------------------------------------------------------
bool CGUIManager::Init (const std::string& initGuiXML)
{
m_bIsOk = false;
LOGGER->AddNewLog(ELL_INFORMATION, "CGUIManager:: calling initialization");
CXMLTreeNode parser;
if (!parser.LoadFile(initGuiXML.c_str()))
{
std::string msg_error = "CGUIManager::Init-> Error al leer el archivo de configuracion GUI: " + initGuiXML;
LOGGER->AddNewLog(ELL_ERROR, msg_error.c_str());
throw CException(__FILE__, __LINE__, msg_error);
}
else
{
CTextureManager* textureM = CORE->GetTextureManager();
CXMLTreeNode m = parser["GuiFiles"];
if (m.Exists())
{
std::string path = m.GetPszProperty("path","");
if (path.compare("") != 0)
m_bIsOk = LoadGuiFiles(path);
else
{
m_bIsOk = true;
}
}
else
{
std::string msg_error = "CGUIManager::Init-> Error al intentar leer el tag <GuiFiles> del archivo de configuracion GUI: " + initGuiXML;
LOGGER->AddNewLog(ELL_ERROR, msg_error.c_str());
throw CException(__FILE__, __LINE__, msg_error);
}
if (m_bIsOk)
{
m = parser["TextBox"];
if (m.Exists())
{
float posx = m.GetFloatProperty("posx", 30.f);
float posy = m.GetFloatProperty("posy", 30.f);
float w = m.GetFloatProperty("width", 35.f);
float h = m.GetFloatProperty("height", 35.f);
float button_w = m.GetFloatProperty("button_width", 5.f);
float button_h = m.GetFloatProperty("button_height", 5.f);
std::string buttonClose_normal = m.GetPszProperty("buttonClose_normal", "./Data/GUI/Textures_Test/CloseDialegBox.jpg");
std::string buttonClose_over = m.GetPszProperty("buttonClose_over", "./Data/GUI/Textures_Test/CloseDialegBoxO.jpg");
std::string buttonClose_clicked = m.GetPszProperty("buttonClose_clicked", "./Data/GUI/Textures_Test/CloseDialegBoxC.jpg");
std::string buttonClose_deactivated = m.GetPszProperty("buttonClose_deactivated", "./Data/GUI/Textures_Test/CloseDialegBoxC.jpg" );
std::string buttonMove_normal = m.GetPszProperty("buttonMove_normal", "./Data/GUI/Textures_Test/ButtonDialegBoxN.jpg");
std::string buttonMove_over = m.GetPszProperty("buttonMove_over", "./Data/GUI/Textures_Test/ButtonDialegBoxO.jpg");
std::string buttonMove_clicked = m.GetPszProperty("buttonMove_clicked", "./Data/GUI/Textures_Test/ButtonDialegBoxC.jpg");
std::string buttonMove_deactivated = m.GetPszProperty("buttonMove_deactivated", "./Data/GUI/Textures_Test/ButtonDialegBoxC.jpg");
std::string quad = m.GetPszProperty("quad", "./Data/GUI/Textures_Test/BaseDialegBox.jpg");
CTexture* Close_normal = textureM->GetTexture(buttonClose_normal);
CTexture* Close_over = textureM->GetTexture(buttonClose_over);
CTexture* Close_clicked = textureM->GetTexture(buttonClose_clicked);
CTexture* Close_deactivated = textureM->GetTexture(buttonClose_deactivated);
CTexture* Move_normal = textureM->GetTexture(buttonMove_normal);
CTexture* Move_over = textureM->GetTexture(buttonMove_over);
CTexture* Move_clicked = textureM->GetTexture(buttonMove_clicked);
CTexture* Move_deactivated = textureM->GetTexture(buttonMove_deactivated);
CTexture* back = textureM->GetTexture(quad);
m_TextBox = new CTextBox( m_ScreenResolution.x, m_ScreenResolution.y, h, w, Vect2f(posx,posy), button_w, button_h);
assert(m_TextBox);
m_TextBox->SetName("TextBox");
m_TextBox->SetCloseButtonTextures(Close_normal, Close_over, Close_clicked, Close_deactivated);
m_TextBox->SetMoveButtonTextures(Move_normal, Move_over, Move_clicked, Move_deactivated);
m_TextBox->SetDialogTexture(back);
m_TextBox->SetVisible(false);
}
else
{
std::string msg_error = "CGUIManager::Init-> Error al intentar leer el tag <TextBox> del archivo de configuracion GUI: " + initGuiXML;
LOGGER->AddNewLog(ELL_ERROR, msg_error.c_str());
throw CException(__FILE__, __LINE__, msg_error);
}
m = parser["PointerMouse"];
if (m.Exists())
{
float posx = m.GetFloatProperty("posx", 5.f);
float posy = m.GetFloatProperty("posy", 5.f);
float w = m.GetFloatProperty("width", 5.f);
float h = m.GetFloatProperty("height", 5.f);
std::string texture = m.GetPszProperty("texture", "./Data/GUI/Textures_Test/gui_pointer_mouse.tga");
bool isQuadrant = m.GetBoolProperty("isQuadrant", true);
CTexture* texture_pointer = textureM->GetTexture(texture);
m_PointerMouse = new CPointerMouse(m_ScreenResolution.y,m_ScreenResolution.x, h,w,Vect2f(posx,posy));
assert(m_PointerMouse);
m_PointerMouse->SetTexture(texture_pointer,"default");
m_PointerMouse->SetActiveTexture("default");
m_PointerMouse->SetQuadrant(isQuadrant);
}
else
{
std::string msg_error = "CGUIManager::Init-> Error al intentar leer el tag <PointerMouse> del archivo de configuracion GUI: " + initGuiXML;
LOGGER->AddNewLog(ELL_ERROR, msg_error.c_str());
throw CException(__FILE__, __LINE__, msg_error);
}
m_bIsOk = m_TextBox && m_PointerMouse;
}//END if (m_bIsOk)
} //END if (!parser.LoadFile(initGuiXML.c_str()))
if (!m_bIsOk)
{
Release();
}
else
{
LOGGER->AddNewLog(ELL_INFORMATION, "CSoundManager:: online (ok)");
}
return m_bIsOk;
}
//----------------------------------------------------------------------------
// Render
//----------------------------------------------------------------------------
void CGUIManager::Render (CRenderManager *renderManager, CFontManager* fm)
{
if (m_bIsOk)
{
CORE->GetRenderManager()->EnableAlphaBlend();
if (m_bLoadedGuiFiles)
{
std::map<std::string, CGUIWindow*>::iterator it;
it = m_WindowsMap.find( m_sCurrentWindows );
if( it != m_WindowsMap.end() )
{
CGUIWindow * currentWindows = it->second;
currentWindows->Render(renderManager, fm);
RenderTransitionEffect(renderManager);
m_bRenderError = false;
}
else
{
if (!m_bRenderError)
{
LOGGER->AddNewLog(ELL_ERROR, "CGUIManager:: Se ha intentado pintar la windows %s no registrada ", m_sCurrentWindows.c_str());
m_bRenderError = true;
}
}
}//END if (m_bLoadedGuiFiles)
//Siempre los últimos en pintarse
assert(m_TextBox);
m_TextBox->Render(renderManager, fm);
RenderPointerMouse(renderManager, fm);
CORE->GetRenderManager()->DisableAlphaBlend();
}//END if (m_bIsOk)
}
void CGUIManager::RenderPointerMouse (CRenderManager *renderManager, CFontManager* fontManager)
{
if(m_bVisiblePointerMouse)
m_PointerMouse->Render(renderManager, fontManager);
}
//----------------------------------------------------------------------------
// Update
//----------------------------------------------------------------------------
void CGUIManager::Update (float elapsedTime)
{
if (m_bIsOk)
{
assert(m_TextBox);
assert(m_PointerMouse);
//Si es la primera vez que actualizamos la GUI debemos hacer un load de la main.xml:
if (m_bFirstUpdate)
{
std::map<std::string, CGUIWindow*>::iterator itCurrentWindows;
itCurrentWindows = m_WindowsMap.find( m_sCurrentWindows );
if( itCurrentWindows != m_WindowsMap.end() )
{
CGUIWindow * currentWindow = itCurrentWindows->second;
currentWindow->LoadWindows();
}
m_bFirstUpdate = false;
}
CInputManager* intputManager = CORE->GetInputManager();
m_PointerMouse->Update(intputManager, elapsedTime);
m_TextBox->Update(intputManager, elapsedTime);
if( !m_TextBox->IsVisible() && m_bLoadedGuiFiles)
{
std::map<std::string, CGUIWindow*>::iterator it;
it = m_WindowsMap.find( m_sCurrentWindows );
if( it != m_WindowsMap.end() )
{
CGUIWindow * currentWindow = it->second;
if (!UpdateTransitionEffect(elapsedTime))
{
currentWindow->Update(intputManager, elapsedTime);
}
m_bUpdateError = false;
}
else
{
if (!m_bUpdateError)
{
LOGGER->AddNewLog(ELL_ERROR, "CGUIManager:: Se ha intentado updatear la windows %s no registrada ", m_sCurrentWindows.c_str());
m_bUpdateError = true;
}
}
}//END if( !m_TextBox.IsVisible() )
}
}
void CGUIManager::RenderTransitionEffect(CRenderManager *renderManager)
{
if (m_sTransitionEffect.m_bDoEffect)
{
switch (m_sTransitionEffect.m_eType)
{
case TE_SHADOW:
{
//Dibujamos un quad2d en toda la pantalla:
// - Durante la primera mitad de tiempo irá de totalmente transparente a totalmente opaco negro
// - Durante la segunda mitad de tiempo irá de totalmente opaco negro a totalmente transparente
CColor color = colBLACK;
float alpha;
if (m_sTransitionEffect.m_fTimeCounter < m_sTransitionEffect.m_fTransitionTime*0.5f)
{
//Durante la primera mitad del tiempo: alpha de 0.f -> 1.f
alpha = m_sTransitionEffect.m_fTimeCounter / (m_sTransitionEffect.m_fTransitionTime*0.5f);
color.SetAlpha(alpha);
}
else
{
//Durante la segunda mitad del tiempo: alpha de 1.f -> 0.f
alpha = m_sTransitionEffect.m_fTimeCounter / (m_sTransitionEffect.m_fTransitionTime*0.5f); //esto va de 1->2
color.SetAlpha(abs(alpha-2));
}
renderManager->DrawQuad2D(Vect2i(0,0),m_ScreenResolution.x,m_ScreenResolution.y,CRenderManager::UPPER_LEFT,color);
}
break;
case TE_FADE_TO_BLACK:
{
//Dibujamos un quad2d en toda la pantalla:
// - Irá de totalmente transparente a totalmente opaco negro
CColor color = colBLACK;
if (m_sTransitionEffect.m_fTimeCounter < m_sTransitionEffect.m_fTransitionTime)
{
// alpha de 0.f -> 1.f
float alpha = m_sTransitionEffect.m_fTimeCounter / m_sTransitionEffect.m_fTransitionTime;
color.SetAlpha(alpha);
}
else
{
color.SetAlpha(0.f);
}
renderManager->DrawQuad2D(Vect2i(0,0),m_ScreenResolution.x,m_ScreenResolution.y,CRenderManager::UPPER_LEFT,color);
}
break;
case TE_SHADOW_OFF:
{
//Dibujamos un quad2d en toda la pantalla:
// - Irá de totalmente opaco negro a totalmente transparente
CColor color = colBLACK;
if (m_sTransitionEffect.m_fTimeCounter < m_sTransitionEffect.m_fTransitionTime)
{
// alpha de 1.f -> 0.f
float alpha = m_sTransitionEffect.m_fTimeCounter / m_sTransitionEffect.m_fTransitionTime;
color.SetAlpha(abs(alpha - 1));
}
renderManager->DrawQuad2D(Vect2i(0,0),m_ScreenResolution.x,m_ScreenResolution.y,CRenderManager::UPPER_LEFT,color);
}
break;
default:
{
LOGGER->AddNewLog(ELL_ERROR,"CGUIManager::RenderTransitionEffect-> No se reconoce el efecto a realizar!");
}
}
}
}
bool CGUIManager::UpdateTransitionEffect (float elapsedTime)
{
if (m_sTransitionEffect.m_bDoEffect)
{
m_sTransitionEffect.m_fTimeCounter += elapsedTime;
switch (m_sTransitionEffect.m_eType)
{
case TE_SHADOW:
{
if (!m_sTransitionEffect.m_bActiveWindows && m_sTransitionEffect.m_fTimeCounter > m_sTransitionEffect.m_fTransitionTime*0.5f)
{
ActiveWindows(m_sTransitionEffect.m_sWindowsName);
m_sTransitionEffect.m_bActiveWindows = true;
}
if (m_sTransitionEffect.m_fTimeCounter > m_sTransitionEffect.m_fTransitionTime)
{
m_sTransitionEffect.m_bDoEffect = false;
m_sTransitionEffect.m_fTimeCounter = 0.f;
m_sTransitionEffect.m_bActiveWindows = false;
}
}
break;
case TE_FADE_TO_BLACK:
{
if (m_sTransitionEffect.m_fTimeCounter >= m_sTransitionEffect.m_fTransitionTime)
{
ActiveWindows(m_sTransitionEffect.m_sWindowsName);
m_sTransitionEffect.m_bDoEffect = false;
m_sTransitionEffect.m_fTimeCounter = 0.f;
m_sTransitionEffect.m_bActiveWindows = true;
}
}
break;
case TE_SHADOW_OFF:
{
if (!m_sTransitionEffect.m_bActiveWindows)
{
ActiveWindows(m_sTransitionEffect.m_sWindowsName);
m_sTransitionEffect.m_bActiveWindows = true;
}
if (m_sTransitionEffect.m_fTimeCounter >= m_sTransitionEffect.m_fTransitionTime)
{
//ActiveWindows(m_sTransitionEffect.m_sWindowsName);
m_sTransitionEffect.m_bDoEffect = false;
m_sTransitionEffect.m_fTimeCounter = 0.f;
//m_sTransitionEffect.m_bActiveWindows = true;
}
}
break;
}
return true;
}
return false;
}
void CGUIManager::ActiveWindowsWithEffect (const std::string& inNameWindow, EtypeTransitionEffect type, float transitionTime )
{
m_sTransitionEffect.m_bActiveWindows = false;
m_sTransitionEffect.m_bDoEffect = true;
m_sTransitionEffect.m_eType = type;
m_sTransitionEffect.m_fTransitionTime = transitionTime;
m_sTransitionEffect.m_fTimeCounter = 0.f;
m_sTransitionEffect.m_sWindowsName = inNameWindow;
}
void CGUIManager::ActiveWindows( const std::string& inNameWindow )
{
std::map<std::string, CGUIWindow*>::iterator it;
it = m_WindowsMap.find( inNameWindow );
if( it != m_WindowsMap.end() )
{
//Primero finalizamos la ventana actual
std::map<std::string, CGUIWindow*>::iterator itCurrentWindows;
itCurrentWindows = m_WindowsMap.find( m_sCurrentWindows );
if( itCurrentWindows != m_WindowsMap.end() )
{
CGUIWindow * currentWindow = itCurrentWindows->second;
currentWindow->SaveWindows();
//A continuación leemos los valores de la nueva ventana
CGUIWindow* windows = it->second;
windows->LoadWindows();
m_sCurrentWindows = inNameWindow;
}
else
{
LOGGER->AddNewLog(ELL_ERROR, "CGUIManager:: Al intentar cambiar de windows, la actual-->%s no se ha encontrado registrada", m_sCurrentWindows.c_str());
}
}
else
{
LOGGER->AddNewLog(ELL_ERROR, "CGUIManager:: Al intentar cambiar a la windows-->%s esta no se ha encontrado registrada", inNameWindow.c_str());
}
}
void CGUIManager::PushWindows (const std::string& inNameWindow )
{
std::map<std::string, CGUIWindow*>::iterator it;
it = m_WindowsMap.find( inNameWindow );
if( it != m_WindowsMap.end() )
{
m_PrevWindows.push_back(m_sCurrentWindows);
ActiveWindows(inNameWindow);
}
else
{
LOGGER->AddNewLog(ELL_ERROR, "CGUIManager::PushWindows Al intentar cambiar a la windows-->%s etsa no se ha encontrado registrada", inNameWindow.c_str());
}
}
void CGUIManager::PopWindows ()
{
if (m_PrevWindows.size() == 0)
{
LOGGER->AddNewLog(ELL_ERROR, "CGUIManager::PopWindows -> El vector de PrevWindows esta vacío!");
}
else
{
std::string popWindows = m_PrevWindows[m_PrevWindows.size()-1];
m_PrevWindows.pop_back();
ActiveWindows(popWindows);
}
}
void CGUIManager::SetScreenResolution(const Vect2i& resolution)
{
std::map<std::string, CGuiElement*>::iterator it(m_ElementsMap.begin());
std::map<std::string, CGuiElement*>::iterator itEnd(m_ElementsMap.end());
while (it != itEnd)
{
CGuiElement* guiElement = it->second;
guiElement->SetWindowsWidth(resolution.x);
guiElement->SetWindowsHeight(resolution.y);
it++;
}
}
bool CGUIManager::LoadGuiFiles (const std::string& pathGUI_XML)
{
m_bLoadedGuiFiles = false;
LOGGER->AddNewLog(ELL_INFORMATION, "GUIManager:: Empezando a leer los .xml del directorio->%s",pathGUI_XML.c_str());
//Read xml files:
std::map<std::string, CGUIWindow*>::iterator it(m_WindowsMap.begin());
std::map<std::string, CGUIWindow*>::iterator itEnd(m_WindowsMap.end());
while (it != itEnd)
{
CGUIWindow* windows = it->second;
CHECKED_DELETE(windows);
++it;
}
m_WindowsMap.clear();
m_ElementsMap.clear();
m_sCurrentWindows = "Main.xml";
WIN32_FIND_DATA FindFileData;
HANDLE hFind;
// We read the XmlGui files
m_sLastLoadpathGUI_XML = pathGUI_XML;
std::string path_xmls = pathGUI_XML+"/*.xml";
hFind = FindFirstFile(path_xmls.c_str(), &FindFileData);
// we check the existence of the XmlGui directory
if ( hFind == INVALID_HANDLE_VALUE )
{
LOGGER->AddNewLog(ELL_ERROR, "CGUIManager:: Error al intentar leer los .xml del directorio %s", pathGUI_XML.c_str());
return false;
}
else
{
std::string FileName = FindFileData.cFileName;
CGUIWindow* windows = new CGUIWindow();
std::string pathFile = pathGUI_XML+"/";
pathFile += FileName;
bool isOk = false;
isOk = windows->LoadXML(pathFile,m_ScreenResolution);
if (!isOk)
{
return false;
}
windows->RegisterElements(m_ElementsMap);
windows->SetName(FileName);
m_WindowsMap.insert( std::pair<std::string,CGUIWindow*>(FileName,windows) );
while( FindNextFile(hFind, &FindFileData) != 0 )
{
std::string FileName = FindFileData.cFileName;
CGUIWindow* windows = new CGUIWindow();
std::string pathFile = pathGUI_XML+"/";
pathFile += FileName;
isOk = windows->LoadXML(pathFile,m_ScreenResolution);
if (!isOk)
{
return false;
}
windows->RegisterElements(m_ElementsMap);
windows->SetName(FileName);
m_WindowsMap.insert( std::pair<std::string,CGUIWindow*>(FileName,windows) );
}
FindClose(hFind);
}
m_bLoadedGuiFiles = true;
return true;
}
bool CGUIManager::ReloadGuiFiles ()
{
bool isOk = false;
std::string windows = m_sCurrentWindows;
isOk = LoadGuiFiles(m_sLastLoadpathGUI_XML);
std::map<std::string, CGUIWindow*>::iterator it;
it = m_WindowsMap.find( windows );
if (it != m_WindowsMap.end())
{
m_sCurrentWindows = windows;
}
return isOk;
}
void CGUIManager::SetMessageBox( const std::string& text )
{
if (m_bIsOk)
{
assert(m_TextBox);
if( !m_TextBox->IsVisible() )
{
m_TextBox->SetMessage( text );
m_TextBox->SetVisible( true );
m_TextBox->SetActive( true );
m_TextBox->SetPosition(Vect2i(30,30));
}
}
}
//-------------------------------------------------------------------------
//-------------------------------------------------------------------------
// Funciones para modificar los GuiElements
//-------------------------------------------------------------------------
//-------------------------------------------------------------------------
void CGUIManager::SetActiveGuiElement (const std::string& inNameGuiElement, bool flag)
{
std::map<std::string, CGuiElement*>::iterator it;
it = m_ElementsMap.find(inNameGuiElement);
if( it!= m_ElementsMap.end() )
{
it->second->SetActive(flag);
}
else
{
LOGGER->AddNewLog(ELL_ERROR, "CGUIManager:: No se ha encontrado el guiElement %s al ejecutar la funcion SetActiveGuiElement", inNameGuiElement.c_str());
}
}
bool CGUIManager::GetVisibleGuiElement (const std::string& inNameGuiElement)
{
std::map<std::string, CGuiElement*>::iterator it;
it = m_ElementsMap.find(inNameGuiElement);
if( it!= m_ElementsMap.end() )
{
return it->second->IsVisible();
}
else
{
LOGGER->AddNewLog(ELL_ERROR, "CGUIManager:: No se ha encontrado el guiElement %s al ejecutar la funcion SetVisibleGuiElement", inNameGuiElement.c_str());
}
return false;
}
void CGUIManager::SetVisibleGuiElement (const std::string& inNameGuiElement, bool flag)
{
std::map<std::string, CGuiElement*>::iterator it;
it = m_ElementsMap.find(inNameGuiElement);
if( it!= m_ElementsMap.end() )
{
it->second->SetVisible(flag);
}
else
{
LOGGER->AddNewLog(ELL_ERROR, "CGUIManager:: No se ha encontrado el guiElement %s al ejecutar la funcion SetVisibleGuiElement", inNameGuiElement.c_str());
}
}
bool CGUIManager::GetProgressBarValue (const std::string& inNameGuiElement, float& outValue)
{
std::map<std::string, CGuiElement*>::iterator it;
it = m_ElementsMap.find(inNameGuiElement);
if( it!= m_ElementsMap.end() )
{
CProgressBar * progress = (CProgressBar*) (it->second);
outValue = progress->GetProgress();
return true;
}
else
{
LOGGER->AddNewLog(ELL_ERROR, "CGUIManager:: No se ha encontrado el guiElement %s al ejecutar la funcion GetProgressBarValue", inNameGuiElement.c_str());
}
return false;
}
bool CGUIManager::SetProgressBarValue (const std::string& inNameGuiElement, float inValue)
{
std::map<std::string, CGuiElement*>::iterator it;
it = m_ElementsMap.find(inNameGuiElement);
if( it!= m_ElementsMap.end() )
{
CProgressBar * progress = (CProgressBar*) (it->second);
progress->SetProgress(inValue);
return true;
}
else
{
LOGGER->AddNewLog(ELL_ERROR, "CGUIManager:: No se ha encontrado el guiElement %s al ejecutar la funcion SetProgressBarValue", inNameGuiElement.c_str());
}
return false;
}
std::string CGUIManager::GetButtonCheckInRadioBox (const std::string& inNameRadioBox)
{
std::map<std::string, CGuiElement*>::iterator it;
it = m_ElementsMap.find(inNameRadioBox);
if( it!= m_ElementsMap.end() )
{
CRadioBox * rb = (CRadioBox*) (it->second);
return rb->GetDefaultCheckButton();
}
else
{
LOGGER->AddNewLog(ELL_ERROR, "CGUIManager:: No se ha encontrado el guiElement %s al ejecutar la funcion GetButtonCheckInRadioBox", inNameRadioBox.c_str());
}
return "";
}
void CGUIManager::SetButtonCheckInRadioBox( const std::string& inNameRadioBox, const std::string& button )
{
std::map<std::string, CGuiElement*>::iterator it;
it = m_ElementsMap.find(inNameRadioBox);
if( it!= m_ElementsMap.end() )
{
CRadioBox * rb = (CRadioBox*) (it->second);
rb->SetDefaultCheckButton(button);
}
else
{
LOGGER->AddNewLog(ELL_ERROR, "CGUIManager:: No se ha encontrado el guiElement %s al ejecutar la funcion GetButtonCheckInRadioBox", inNameRadioBox.c_str());
}
}
void CGUIManager::SetStateCheckButton ( const std::string& inCheckButtonName, bool state )
{
std::map<std::string, CGuiElement*>::iterator it;
it = m_ElementsMap.find(inCheckButtonName);
if( it!= m_ElementsMap.end() )
{
CCheckButton * checkButton = (CCheckButton*) (it->second);
checkButton->SetOn(state);
}
else
{
LOGGER->AddNewLog(ELL_ERROR, "CGUIManager:: No se ha encontrado el guiElement %s al ejecutar la funcion SetStateCheckButton", inCheckButtonName.c_str());
}
}
bool CGUIManager::GetStateCheckButton( const std::string& inCheckButtonName )
{
std::map<std::string, CGuiElement*>::iterator it;
it = m_ElementsMap.find(inCheckButtonName);
if( it!= m_ElementsMap.end() )
{
CCheckButton * checkButton = (CCheckButton*) (it->second);
return checkButton->GetState();
}
else
{
LOGGER->AddNewLog(ELL_ERROR, "CGUIManager:: No se ha encontrado el guiElement %s al ejecutar la funcion GetStateCheckButton", inCheckButtonName.c_str());
}
return false;
}
void CGUIManager::SetEditableTextBox( const std::string& inEditableText, const std::string& text )
{
std::map<std::string, CGuiElement*>::iterator it;
it = m_ElementsMap.find(inEditableText);
if( it!= m_ElementsMap.end() )
{
CEditableTextBox * editableTextBox = (CEditableTextBox*) (it->second);
editableTextBox->SetBuffer(text);
}
else
{
LOGGER->AddNewLog(ELL_ERROR, "CGUIManager:: No se ha encontrado el guiElement %s al ejecutar la funcion SetEditableTextBox", inEditableText.c_str());
}
}
std::string CGUIManager::GetEditableTextBox( const std::string& inEditableText )
{
std::map<std::string, CGuiElement*>::iterator it;
it = m_ElementsMap.find(inEditableText);
if( it!= m_ElementsMap.end() )
{
CEditableTextBox * editableTextBox = (CEditableTextBox*) (it->second);
return editableTextBox->GetBuffer();
}
else
{
LOGGER->AddNewLog(ELL_ERROR, "CGUIManager:: No se ha encontrado el guiElement %s al ejecutar la funcion GetEditableTextBox", inEditableText.c_str());
}
return "";
}
void CGUIManager::SetImage( const std::string& inImageName, const std::string& activeImage )
{
std::map<std::string, CGuiElement*>::iterator it;
it = m_ElementsMap.find(inImageName);
if( it!= m_ElementsMap.end() )
{
CImage * image = (CImage*) (it->second);
image->SetActiveTexture(activeImage);
}
else
{
LOGGER->AddNewLog(ELL_ERROR, "CGUIManager:: No se ha encontrado el guiElement %s al ejecutar la funcion SetImage", inImageName.c_str());
}
}
std::string CGUIManager::GetImage( const std::string& inImageName )
{
std::map<std::string, CGuiElement*>::iterator it;
it = m_ElementsMap.find(inImageName);
if( it!= m_ElementsMap.end() )
{
CImage * image = (CImage*) (it->second);
return image->GetActiveTexture();
}
else
{
LOGGER->AddNewLog(ELL_ERROR, "CGUIManager:: No se ha encontrado el guiElement %s al ejecutar la funcion GetImage", inImageName.c_str());
}
return "";
}
void CGUIManager::PlayImage (const std::string& inImageName, float timePerImage, bool loop)
{
std::map<std::string, CGuiElement*>::iterator it;
it = m_ElementsMap.find(inImageName);
if( it!= m_ElementsMap.end() )
{
CImage * image = (CImage*) (it->second);
image->PlayAnimation(timePerImage, loop);
}
else
{
LOGGER->AddNewLog(ELL_ERROR, "CGUIManager:: No se ha encontrado el guiElement %s al ejecutar la funcion GetImage", inImageName.c_str());
}
}
void CGUIManager::SetAlphaImage(const std::string& inImageName, float _Alpha)
{
std::map<std::string, CGuiElement*>::iterator it;
it = m_ElementsMap.find(inImageName);
if( it!= m_ElementsMap.end() )
{
CImage * image = (CImage*) (it->second);
image->SetAlpha(_Alpha);
}
else
{
LOGGER->AddNewLog(ELL_ERROR, "CGUIManager::GetGUIElement: No se ha encontrado el guiElement %s", inImageName.c_str());
}
}
void CGUIManager::FadeOutImage(const std::string& inImageName, float startTime, float fadePerSecond)
{
std::map<std::string, CGuiElement*>::iterator it;
it = m_ElementsMap.find(inImageName);
if( it!= m_ElementsMap.end() )
{
CImage * image = (CImage*) (it->second);
image->FadeOut(startTime, fadePerSecond);
}
else
{
LOGGER->AddNewLog(ELL_ERROR, "CGUIManager::GetGUIElement: No se ha encontrado el guiElement %s", inImageName.c_str());
}
}
void CGUIManager::SetStateSlider( const std::string& inSliderName, float amount )
{
std::map<std::string, CGuiElement*>::iterator it;
it = m_ElementsMap.find(inSliderName);
if( it!= m_ElementsMap.end() )
{
CSlider * slider= (CSlider*) (it->second);
slider->SetValue(amount);
}
else
{
LOGGER->AddNewLog(ELL_ERROR, "CGUIManager:: No se ha encontrado el guiElement %s al ejecutar la funcion GetStateSlider", inSliderName.c_str());
}
}
float CGUIManager::GetStateSlider( const std::string& inSliderName )
{
std::map<std::string, CGuiElement*>::iterator it;
it = m_ElementsMap.find(inSliderName);
if( it!= m_ElementsMap.end() )
{
CSlider * slider= (CSlider*) (it->second);
float kk=slider->GetValue();
return slider->GetValue();
}
else
{
LOGGER->AddNewLog(ELL_ERROR, "CGUIManager:: No se ha encontrado el guiElement %s al ejecutar la funcion GetStateSlider", inSliderName.c_str());
}
return 0.f;
}
void CGUIManager::SetLiteralInStaticText( const std::string& inStaticText, const std::string& lit )
{
std::map<std::string, CGuiElement*>::iterator it;
it = m_ElementsMap.find(inStaticText);
if( it!= m_ElementsMap.end() )
{
CStaticText * st = (CStaticText*) (it->second);
st->SetLiteral(lit);
}
else
{
LOGGER->AddNewLog(ELL_ERROR, "CGUIManager:: No se ha encontrado el guiElement %s al ejecutar la funcion SetVariableText", inStaticText.c_str());
}
}
bool CGUIManager::NextBlockInRadioBox( const std::string& inNameRadioBox )
{
std::map<std::string, CGuiElement*>::iterator it;
it = m_ElementsMap.find(inNameRadioBox);
if( it!= m_ElementsMap.end() )
{
CRadioBox * rb = (CRadioBox*) (it->second);
rb->NextBlock();
return true;
}
else
{
LOGGER->AddNewLog(ELL_ERROR, "CGUIManager:: No se ha encontrado el guiElement %s al ejecutar la funcion NextBlockInRadioBox", inNameRadioBox.c_str());
}
return false;
}
bool CGUIManager::PrevBlockInRadioBox( const std::string& inNameRadioBox )
{
std::map<std::string, CGuiElement*>::iterator it;
it = m_ElementsMap.find(inNameRadioBox);
if( it!= m_ElementsMap.end() )
{
CRadioBox * rb = (CRadioBox*) (it->second);
rb->PrevBlock();
return true;
}
else
{
LOGGER->AddNewLog(ELL_ERROR, "CGUIManager:: No se ha encontrado el guiElement %s al ejecutar la funcion PrevBlockInRadioBox", inNameRadioBox.c_str());
}
return false;
}
//-------------------------------------------------------------------------
//-------------------------------------------------------------------------
CGuiElement* CGUIManager::GetGUIElement(const std::string& inNameGuiElement)
{
std::map<std::string, CGuiElement*>::iterator it;
it = m_ElementsMap.find(inNameGuiElement);
if( it!= m_ElementsMap.end() )
{
return it->second;
}
else
{
LOGGER->AddNewLog(ELL_ERROR, "CGUIManager::GetGUIElement: No se ha encontrado el guiElement %s", inNameGuiElement.c_str());
}
return NULL;
}
| [
"you@example.com"
] | you@example.com |
b671b799d7b586203d7950dbd7c1865cafbf4e58 | f012504c927e57d7b94547863139427ebc0e7bc3 | /src/contact.h | c64984c35671223b0061080fa472221724baf0a0 | [] | no_license | dhanapr/AddressBookQT | 4613a9537ccca67802f487a529bb8c7dcf80436b | 8e800988ff617c39a8cb6e7dcb4db8e6512c0941 | refs/heads/master | 2020-07-29T11:59:56.234822 | 2016-11-14T05:33:13 | 2016-11-14T05:33:13 | 73,669,527 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,006 | h | #ifndef CORE_CONTACT_H
#define CORE_CONTACT_H
/************************************************************
Class: Contact
Author: Phil Grohe
Data structure to hold a single address book contact's
info.
************************************************************/
#include <string>
#include <vector>
#include <QLineEdit>
class Contact
{
public:
typedef std::vector<Contact> ContactRecordSet;
typedef unsigned int ContactId;
static const ContactId INVALID_ID = 0;
ContactId id;
std::string firstName;
std::string lastName;
std::string phoneNumber;
std::string address;
std::string email;
std::string additionalInformation;
Contact():id(0), firstName(), lastName(), phoneNumber(), email(){ }
bool isValidToAdd() const;
bool isValidToPhonenumber() const;
bool isValidToSearch() const;
bool isValidToEmail() const;
bool isEmpty() const;
};
#endif
| [
"noreply@github.com"
] | dhanapr.noreply@github.com |
f488fec4f5dec308957c7cfd1e1fd553bef972d6 | a8c2ab2fdcac66596773d737db5bc9fb84f27653 | /src/clientversion.cpp | c990b70edfac2245f2f4d61cc056c279e5bb3ae8 | [
"MIT"
] | permissive | blocksninja/das-coin | 6d3ee0fd1d52292705cf241589ac172a9b69a8b5 | c91484c5ec2f1c3001429104d28d45177a7c257b | refs/heads/master | 2021-04-09T10:14:49.048660 | 2018-03-16T09:26:42 | 2018-03-16T09:26:42 | 115,623,990 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,971 | cpp | // Copyright (c) 2012-2014 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 "clientversion.h"
#include "tinyformat.h"
#include <string>
/**
* Name of client reported in the 'version' message. Report the same name
* for both dasd and das-qt, to make it harder for attackers to
* target servers or GUI users specifically.
*/
const std::string CLIENT_NAME("Das Core");
/**
* Client version number
*/
#define CLIENT_VERSION_SUFFIX ""
/**
* The following part of the code determines the CLIENT_BUILD variable.
* Several mechanisms are used for this:
* * first, if HAVE_BUILD_INFO is defined, include build.h, a file that is
* generated by the build environment, possibly containing the output
* of git-describe in a macro called BUILD_DESC
* * secondly, if this is an exported version of the code, GIT_ARCHIVE will
* be defined (automatically using the export-subst git attribute), and
* GIT_COMMIT will contain the commit id.
* * then, three options exist for determining CLIENT_BUILD:
* * if BUILD_DESC is defined, use that literally (output of git-describe)
* * if not, but GIT_COMMIT is defined, use v[maj].[min].[rev].[build]-g[commit]
* * otherwise, use v[maj].[min].[rev].[build]-unk
* finally CLIENT_VERSION_SUFFIX is added
*/
//! First, include build.h if requested
#ifdef HAVE_BUILD_INFO
#include "build.h"
#endif
//! git will put "#define GIT_ARCHIVE 1" on the next line inside archives.
//#define GIT_ARCHIVE 1
#ifdef GIT_ARCHIVE
#define GIT_COMMIT_ID " 92d7461"
#define GIT_COMMIT_DATE "Jul 23, 2017"
#endif
#define BUILD_DESC_WITH_SUFFIX(maj, min, rev, build, suffix) \
"v" DO_STRINGIZE(maj) "." DO_STRINGIZE(min) "." DO_STRINGIZE(rev) "." DO_STRINGIZE(build) "-" DO_STRINGIZE(suffix)
#define BUILD_DESC_FROM_COMMIT(maj, min, rev, build, commit) \
"v" DO_STRINGIZE(maj) "." DO_STRINGIZE(min) "." DO_STRINGIZE(rev) "." DO_STRINGIZE(build) "-g" commit
#define BUILD_DESC_FROM_UNKNOWN(maj, min, rev, build) \
"v" DO_STRINGIZE(maj) "." DO_STRINGIZE(min) "." DO_STRINGIZE(rev) "." DO_STRINGIZE(build) "-unk"
#ifndef BUILD_DESC
#ifdef BUILD_SUFFIX
#define BUILD_DESC BUILD_DESC_WITH_SUFFIX(CLIENT_VERSION_MAJOR, CLIENT_VERSION_MINOR, CLIENT_VERSION_REVISION, CLIENT_VERSION_BUILD, BUILD_SUFFIX)
#elif defined(GIT_COMMIT_ID)
#define BUILD_DESC BUILD_DESC_FROM_COMMIT(CLIENT_VERSION_MAJOR, CLIENT_VERSION_MINOR, CLIENT_VERSION_REVISION, CLIENT_VERSION_BUILD, GIT_COMMIT_ID)
#else
#define BUILD_DESC BUILD_DESC_FROM_UNKNOWN(CLIENT_VERSION_MAJOR, CLIENT_VERSION_MINOR, CLIENT_VERSION_REVISION, CLIENT_VERSION_BUILD)
#endif
#endif
#ifndef BUILD_DATE
#ifdef GIT_COMMIT_DATE
#define BUILD_DATE GIT_COMMIT_DATE
#else
#define BUILD_DATE __DATE__ ", " __TIME__
#endif
#endif
const std::string CLIENT_BUILD(BUILD_DESC CLIENT_VERSION_SUFFIX);
const std::string CLIENT_DATE(BUILD_DATE);
static std::string FormatVersion(int nVersion)
{
if (nVersion % 100 == 0)
return strprintf("%d.%d.%d", nVersion / 1000000, (nVersion / 10000) % 100, (nVersion / 100) % 100);
else
return strprintf("%d.%d.%d.%d", nVersion / 1000000, (nVersion / 10000) % 100, (nVersion / 100) % 100, nVersion % 100);
}
std::string FormatFullVersion()
{
return CLIENT_BUILD;
}
/**
* Format the subversion field according to BIP 14 spec (https://github.com/bitcoin/bips/blob/master/bip-0014.mediawiki)
*/
std::string FormatSubVersion(const std::string& name, int nClientVersion, const std::vector<std::string>& comments)
{
std::ostringstream ss;
ss << "/";
ss << name << ":" << FormatVersion(nClientVersion);
if (!comments.empty())
{
std::vector<std::string>::const_iterator it(comments.begin());
ss << "(" << *it;
for(++it; it != comments.end(); ++it)
ss << "; " << *it;
ss << ")";
}
ss << "/";
return ss.str();
}
| [
"183516+blocksninja@users.noreply.github.com"
] | 183516+blocksninja@users.noreply.github.com |
4849c7cf3ed8efd276805164475680ea27469edd | 585a2ab4efc6783d97a9eb0b04bcceb8379cec30 | /csp-integral-test/tests/capi-2/encrypt-message.h | 93b497cce0d17597c96fe5f05b05f64c37f82b9f | [] | no_license | kirillsms/XmlSignWebService | 8fbf3f7ab3aa29d28de3321e8ae8c88b6cd10a14 | cd778449fd1cecf00f662dc5bf0ee939c14204b8 | refs/heads/master | 2021-05-27T14:04:17.833715 | 2013-07-03T11:38:58 | 2013-07-03T11:38:58 | null | 0 | 0 | null | null | null | null | WINDOWS-1251 | C++ | false | false | 1,147 | h | /// @file
/// @brief Файл содержит определение класса, тестирующего шифрование форматированного сообщения.
///
/// Copyright (c) InfoTeCS. All Rights Reserved.
#ifndef encrypt_message_h__
#define encrypt_message_h__
#include "../test-base.h"
#if defined(_WIN32)
#include "../../tools/certificate-search.h"
#endif
/// @brief Тестирует формирование и шифрование форматированного сообщения
class EncryptMessage: public TestBase
{
public:
EncryptMessage();
~EncryptMessage();
/// @brief Запуск теста.
virtual void Run();
private:
// void PrepareProviderContext();
/// @brief Шифрование сообщения.
void Encrypt();
/// @brief Расшифрование сообщения.
void Decrypt() const;
private:
// HCRYPTPROV prov_;
std::vector<BYTE> message_;
std::vector<BYTE> encryptedBlob_;
#if defined(_WIN32)
CertificateGuiSearch certificateSearch_;
#endif
};
#endif // encrypt_message_h__
| [
"yurabuy@yandex.ru"
] | yurabuy@yandex.ru |
45b46c87bc84c7ecbb07ce7db7ac1cee8bfaadcd | 30fd0f276881e9722a875f37d08b5214942b87e5 | /sword_printMatrix.cpp | 4b8319a1210f3cec16454563971cb01dd4c82285 | [] | no_license | chexiaoyu/exercise | 320d34576d55cf8dfae5a20cc1c3032e6192d7ae | 095377abe951ac3caaac5f1ab0f18b3c6e39dd18 | refs/heads/master | 2020-07-21T06:39:54.179050 | 2019-09-10T18:25:29 | 2019-09-10T18:25:29 | 206,772,214 | 0 | 0 | null | null | null | null | GB18030 | C++ | false | false | 1,476 | cpp | #include <stdio.h>
#include <windows.h>
#include <iostream>
#include <vector>
using namespace std;
class Solution
{
public:
vector<int> printMatrix(vector<vector<int>> matrix)
{
int row = matrix.size();
int col = matrix[0].size();
vector<int> res;
int left = 0, right = col - 1, top = 0, btm = row - 1;
int count;
count = ((row < col ? row : col) - 1) / 2 + 1;
for (int i = 0; i < count; i++)
{
//从左向右打印
for (int j = i; j < col - i; j++)
res.push_back(matrix[i][j]);
//从上往下的每一列数据
for (int k = i + 1; k < row - i; k++)
res.push_back(matrix[k][col - 1 - i]);
//判断是否会重复打印(从右向左的每行数据)
for (int m = col - i - 2; (m >= i) && (row - i - 1 != i); m--)
res.push_back(matrix[row - i - 1][m]);
//判断是否会重复打印(从下往上的每一列数据)
for (int n = row - i - 2; (n > i) && (col - i - 1 != i); n--)
res.push_back(matrix[n][i]);
}
return res;
}
};
int main()
{
Solution solution;
vector<vector<int>> matrix = {{1, 2, 3, 4, 5}, {6, 7, 8, 9, 10}, {11, 12, 13, 14, 15}};
// vector<vector<int>> matrix = {{1}};
vector<int> result = solution.printMatrix(matrix);
// printf();
return 0;
}
| [
"noreply@github.com"
] | chexiaoyu.noreply@github.com |
95a08b8e2989d1f7e1ccb3bcf4ed9e2f56f845eb | 1f9be2d5e42817e39ae2b9ef7ead5883b179b6bd | /GameApp/GoButton.cpp | 6d56d02ed8c35e31e2f1c9c3b1d2deb15f23f37c | [] | no_license | shreyjindal81/CSE335-Project1 | 827a960cd93e2d2d3cc17478bfd22daf1dd46c1b | 04c3bfb80419b79dadcea5e250ef5b5000edcb9f | refs/heads/master | 2023-04-03T14:48:58.296090 | 2021-04-14T10:21:26 | 2021-04-14T10:21:26 | 357,852,477 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 289 | cpp | #include "pch.h"
#include "GoButton.h"
#include "Game.h"
#include "Tile.h"
using namespace std;
using namespace Gdiplus;
/** Constructor
* \param game The game this is a member of
*/
CGoButton::CGoButton(CGame* game) : CItem(game)
{
}
/**
* Destructor
*/
CGoButton::~CGoButton()
{
} | [
"shreyjindal81@gmail.com"
] | shreyjindal81@gmail.com |
b109033c85ebd03a55c0432f54b76e6f14f1f659 | 3aa06b06c2c7007f1e3dee1f71c913ce43605e6a | /Windows API/002-InitializeDirectX/Sample/DirectXEnvironment.cpp | 3a51b405dee18c1ff0bb693e0cf6a69ee0eebc1c | [
"MIT"
] | permissive | lightyen/DirectX-Sample | 819d389b10ccc8660dc4a19acb55ec6c3fbdaa95 | 71fda4cf23a49bbe618fbb306c9a33ffcc4ce311 | refs/heads/master | 2020-03-10T11:21:37.904215 | 2018-05-28T09:31:14 | 2018-05-28T09:31:14 | 129,354,873 | 0 | 0 | null | null | null | null | BIG5 | C++ | false | false | 4,232 | cpp |
#include "stdafx.h"
#include "DirectXEnvironment.h"
#define CHECKRETURN(a,b) if (CheckFailed(a,b)) { \
return; \
}
namespace DirectX {
BOOL DirectXIsReady;
D3D_FEATURE_LEVEL FeatureLevel;
ComPtr<IDXGIFactory2> DXGIFactory;
ComPtr<IDXGIAdapter2> DXGIAdapter;
ComPtr<ID3D11Device> D3D11Device;
ComPtr<IDXGISwapChain1> SwapChain;
ComPtr<ID3D11DeviceContext> Context;
ComPtr<ID3D11Texture2D> BackBuffer;
ComPtr<ID3D11RenderTargetView> RenderTargetView;
void InitializeDirectX(HWND hWnd, D3D11_CREATE_DEVICE_FLAG flags) {
HRESULT result = E_FAIL;
if (DirectXIsReady) return;
// 獲得DXGI介面
ComPtr<IDXGIFactory> _dxgiFactory;
result = CreateDXGIFactory(IID_PPV_ARGS(&_dxgiFactory));
CHECKRETURN(result, TEXT("CreateDXGIFactory"));
result = _dxgiFactory.As(&DXGIFactory);
CHECKRETURN(result,TEXT("Get DXGIFactory2"));
// 列舉所有繪圖介面卡
vector<ComPtr<IDXGIAdapter1>> adapters = EnumerateAdapters(DXGIFactory);
// 選擇一個高效能介面卡
ComPtr<IDXGIAdapter1> adpater = FindHardwareAdapter(adapters);
result = adpater.As(&DXGIAdapter);
CHECKRETURN(result, TEXT("Get DXGIAdapter1"));
ComPtr<IDXGIAdapter> adapter0;
result = DXGIAdapter.As(&adapter0);
CHECKRETURN(result, TEXT("Get DXGIAdapter"));
// 建立Direct3D 11 Device
D3D_FEATURE_LEVEL featureLevels[] =
{
D3D_FEATURE_LEVEL_11_1,
D3D_FEATURE_LEVEL_11_0,
D3D_FEATURE_LEVEL_10_1,
};
result = D3D11CreateDevice(adapter0.Get(), D3D_DRIVER_TYPE_UNKNOWN, nullptr,
flags,
featureLevels, ARRAYSIZE(featureLevels),
D3D11_SDK_VERSION,
&D3D11Device, &FeatureLevel, &Context);
CHECKRETURN(result, TEXT("Create D3D11 Device"));
DXGI_SWAP_CHAIN_DESC1 desc;
ZeroMemory(&desc, sizeof(DXGI_SWAP_CHAIN_DESC1));
desc.BufferCount = 2;
desc.Width = 0; //auto sizing
desc.Height = 0; //auto sizing
desc.Format = DXGI_FORMAT_B8G8R8A8_UNORM;
desc.SampleDesc.Count = 1;
desc.SampleDesc.Quality = 0;
desc.SwapEffect = DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL;
desc.BufferUsage = DXGI_USAGE_BACK_BUFFER | DXGI_USAGE_RENDER_TARGET_OUTPUT;
result = DXGIFactory->CreateSwapChainForHwnd(D3D11Device.Get(), hWnd, &desc, nullptr, nullptr, &SwapChain);
CHECKRETURN(result, TEXT("Create SwapChain"));
DirectXIsReady = TRUE;
}
void CreateRenderTargetView() {
HRESULT hr;
if (!DirectXIsReady) return;
hr = SwapChain->GetBuffer(0, __uuidof(ID3D11Texture2D), (void**)&BackBuffer);
CHECKRETURN(hr, TEXT("Get BackBuffer"));
hr = D3D11Device->CreateRenderTargetView(BackBuffer.Get(), nullptr, &RenderTargetView);
CHECKRETURN(hr, TEXT("CreateRenderTargetView"));
}
vector<ComPtr<IDXGIAdapter1>> EnumerateAdapters(const ComPtr<IDXGIFactory2>& DXGIFactory) {
vector<ComPtr<IDXGIAdapter1>> adapters;
ComPtr<IDXGIAdapter1> pAdapter;
for (UINT i = 0;
DXGIFactory->EnumAdapters1(i, &pAdapter) != DXGI_ERROR_NOT_FOUND;
++i) {
adapters.push_back(pAdapter);
}
return adapters;
}
ComPtr<IDXGIAdapter1> FindHardwareAdapter(const vector<ComPtr<IDXGIAdapter1>>& vAdapters) {
DXGI_ADAPTER_DESC1 desc;
for (const auto& p : vAdapters) {
p->GetDesc1(&desc);
// NVIDIA
if (desc.VendorId == 0x10DE) {
return p;
}
}
for (const auto& p : vAdapters) {
p->GetDesc1(&desc);
// AMD
if (desc.VendorId == 0x1022) {
return p;
}
}
for (const auto& p : vAdapters) {
p->GetDesc1(&desc);
// AMD
if (desc.VendorId == 0x8086) {
return p;
}
}
if (vAdapters.size()) return *vAdapters.begin();
return ComPtr<IDXGIAdapter1>();
}
String GetFeatureLevelString() {
switch (FeatureLevel) {
case D3D_FEATURE_LEVEL_12_1:
return TEXT("Direct3D 12.1");
case D3D_FEATURE_LEVEL_12_0:
return TEXT("Direct3D 12.0");
case D3D_FEATURE_LEVEL_11_1:
return TEXT("Direct3D 11.1");
case D3D_FEATURE_LEVEL_11_0:
return TEXT("Direct3D 11.0");
case D3D_FEATURE_LEVEL_10_1:
return TEXT("Direct3D 10.1");
case D3D_FEATURE_LEVEL_10_0:
return TEXT("Direct3D 10.0");
case D3D_FEATURE_LEVEL_9_3:
return TEXT("Direct3D 9.3");
case D3D_FEATURE_LEVEL_9_2:
return TEXT("Direct3D 9.2");
case D3D_FEATURE_LEVEL_9_1:
return TEXT("Direct3D 9.1");
default:
return TEXT("Direct3D Unknown");
}
}
}
| [
"lightyen0123@gmail.com"
] | lightyen0123@gmail.com |
6b44b684572df7fdb377cdb4c5b6a3dc77ceb982 | 96206b0c1a2e831f52f3154a4e3a8874c9a0d7e8 | /src/kits/random_input.cpp | efd28afdeae3bce0c5c9989c72228afadce20859 | [] | no_license | shemmer/zapps | 6b9d3fb7457c0e0acb3415aebbe1e3b364dde38d | ec7d1b06dc4da724c46003f79fbd84b752c872ea | refs/heads/master | 2021-01-19T06:02:56.997905 | 2015-07-28T08:04:30 | 2015-07-28T08:04:30 | 40,187,071 | 1 | 0 | null | 2015-08-04T13:41:48 | 2015-08-04T13:41:48 | null | UTF-8 | C++ | false | false | 1,798 | cpp | #include "util/random_input.h"
const char CAPS_CHAR_ARRAY[] = { "ABCDEFGHIJKLMNOPQRSTUVWXYZ" };
const char NUMBERS_CHAR_ARRAY[] = { "012345789" };
int URand(const int low, const int high)
{
thread_t* self = thread_get_self();
assert (self);
randgen_t* randgenp = self->randgen();
assert (randgenp);
int d = high - low + 1;
return (low + randgenp->rand(d));
}
bool
URandBool()
{
return (URand(0,1) ? true : false);
}
short
URandShort(const short low, const short high)
{
thread_t* self = thread_get_self();
assert (self);
randgen_t* randgenp = self->randgen();
assert (randgenp);
short d = high - low + 1;
return (low + (short)randgenp->rand(d));
}
void
URandFillStrCaps(char* dest, const int sz)
{
assert (dest);
for (int i=0; i<sz; i++) {
dest[i] = CAPS_CHAR_ARRAY[URand(0,sizeof(CAPS_CHAR_ARRAY)-1)];
}
}
void
URandFillStrNumbx(char* dest, const int sz)
{
assert (dest);
for (int i=0; i<sz; i++) {
dest[i] = NUMBERS_CHAR_ARRAY[URand(0,sizeof(NUMBERS_CHAR_ARRAY)-1)];
}
}
#define USE_ZIPF 1
bool _g_enableZipf = false;
double _g_ZipfS = 0.0;
//Zipfian between low and high
int ZRand(const int low, const int high)
{
zipfian myZipf(high-low+2,_g_ZipfS);
thread_t* self = thread_get_self();
assert (self);
randgen_t* randgenp = self->randgen();
assert (randgenp);
double u = (double)randgenp->rand(10000)/double(10000);
return (myZipf.next(u)+low-1);
}
void setZipf(const bool isEnabled, const double s)
{
_g_enableZipf = isEnabled;
_g_ZipfS = s;
}
//If enableZip is set to 1 then return zipfian else returns uniform
int UZRand(const int low, const int high)
{
#ifdef USE_ZIPF
return ( _g_enableZipf? ( ZRand(low,high) ):( URand(low,high) ));
#else
return URand(low,high);
#endif
}
| [
"csauer@cs.uni-kl.de"
] | csauer@cs.uni-kl.de |
a0ad6b776e06f15c931ae4126a83dd124072f229 | 69b71cc6f8a4fd470c344ecdaff4e69dc648efe2 | /examples/deleter0.cpp | b657d7fd9f0cd16b1bca0b20940ae477b447080f | [] | no_license | chardan/Provo_2016 | a7497e06c8de4f1ec42fdaf327d113a11425991b | 80d5fea8efee1edcc782545a72357cd4ac71d3ce | refs/heads/master | 2020-07-03T11:51:39.164179 | 2016-11-18T23:53:11 | 2016-11-18T23:53:11 | 74,175,582 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 479 | cpp | /* Example showing a deleter being used to help interface with C: */
#include <cstdio>
#include <vector>
#include <memory>
using namespace std;
using file_ptr = unique_ptr<FILE, decltype(&fclose)>;
auto write_things(const vector<char>& things)
{
// Real-world programs should check for errors:
auto fp = file_ptr(fopen("data.dat", "w"), &fclose);
return fwrite(things.data(), things.size(), 1, fp.get());
}
int main()
{
write_things({ 'a', 'b', 'c', 'd', 'e' });
}
| [
"jwilliamson@suse.de"
] | jwilliamson@suse.de |
38eb9ba6a722efcc5db2cb43215b5fe8f50c4073 | 8117703ce58eddc2eef1a8d85b81a4632f9d30b9 | /src/managers/ImageManager.cpp | 0342496968e519ea74cd94b6d9aa1377eff200ff | [] | no_license | JesseTG/RAY | f7434b2b96a5c933df941020ce7b512ef1595e7b | 1cb9487852eb07fc0f702da595d77d346e4d8e8d | refs/heads/master | 2020-05-18T19:43:42.832051 | 2014-05-17T03:03:16 | 2014-05-17T03:03:16 | 16,424,298 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 607 | cpp | #include "ImageManager.hpp"
#include <boost/property_tree/ptree.hpp>
#include <boost/property_tree/json_parser.hpp>
namespace ray {
ImageManager::ImageManager()
{
//ctor
}
ImageManager::~ImageManager()
{
//dtor
}
bool ImageManager::loadConfigFile(const string& path) {
boost::property_tree::ptree config;
boost::property_tree::read_json(path, config); // TODO: Handle exception
for (const auto& i : config.get_child("files")) {
// i.first is the key, i.second is the path
this->acquire(thor::Resources::fromFile<Image>(i.second.data()));
}
return true;
}
}
| [
"jessetalavera@aol.com"
] | jessetalavera@aol.com |
9763c828e01631d5c10d344962cd0b6457c966bf | 1c0c2e8c4f586ec3b61800b42f85dcfac3fb1987 | /Lab-1.cpp | 7ec68f4aa258777f4684fe06114489627372c8cd | [] | no_license | tanzim721/ICE-2104 | a9a89009c33d1dfda2e65c4dd9c71d1379f22cd3 | e6931c57f8d053b39cbef9b4df3725eb3c90519f | refs/heads/master | 2020-08-13T03:44:17.306776 | 2020-01-11T12:25:06 | 2020-01-11T12:25:06 | 214,899,162 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 816 | cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int i,j,n,a[10],cn=0;
scanf("%d",&n);
for(i=1;i<=n;i++)
{
scanf("%d",&a[i]);
}
printf("A={");
for(i=1;i<=n;i++)
{
printf("%d,",a[i]);
}
printf("\b}");
printf("\n");
printf("R1={");
for(i=1;i<=n;i++)
{
for(j=1;j<=n;j++)
{
if(a[j]%a[i]==0)
{
printf("(%d,%d),",a[i],a[j]);
cn++;
}
}
}
printf("\b}");
printf("\n");
printf("count = %d\n",cn);
printf("R2={");
for(i=1;i<=n;i++)
{
for(j=1;j<=n;j++)
{
if(a[j]>a[i])
printf("(%d,%d),",a[i],a[j]);
}
}
printf("\b}");
printf("\n");
return 0;
}
| [
"noreply@github.com"
] | tanzim721.noreply@github.com |
763efff91438b91e98a939b6359b5200b604d4e7 | 6fbf7d4855a0639eb57d37eb4a02758fc137e77e | /ModuleAlgorithm/include/implement/composer/GateCoordinateConverterImpl.h | 0ee2ed9ac11c0f83cfb583ec36252c82d07bea26 | [] | no_license | wws2003/Research | f9abb8ea7acd98ed829f23a39cb05a80d738bb6d | 3c839b7b35ddfcc5373f96808c3dc7125200da94 | refs/heads/master | 2020-04-06T07:04:28.103498 | 2016-08-10T06:18:04 | 2016-08-10T06:18:04 | 33,717,928 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,385 | h | /*
* GateCoordinateConverterImpl.h
*
* Created on: Dec 8, 2015
* Author: pham
*/
#ifndef GATECOORDINATECONVERTERIMPL_H_
#define GATECOORDINATECONVERTERIMPL_H_
#include "Gate.h"
#include "Coordinate.hpp"
#include "IConverter.h"
#include "ICoordinateCalculator.h"
#include "IMatrixOperator.h"
class GateCoordinateConverterImpl: public IConverter<GatePtr, RealCoordinate<GatePtr> >{
public:
GateCoordinateConverterImpl(GateRealCoordinateCalculatorPtr pGateCoordinateCalculator, MatrixOperatorPtr pMatrixOperator, bool phaseIgnored = false);
//Override
void convert12(const GatePtr& t1, RealCoordinate<GatePtr>& t2);
//Override
void convert21(const RealCoordinate<GatePtr>& t2, GatePtr& t1);
private:
void getEquivalentCoordinates(const GatePtr& pGate, std::vector<RealCoordinatePtr<GatePtr> >& equivalentCoordinates);
void getEquivalentGates(const RealCoordinatePtr<GatePtr> pGateCoord, std::vector<GatePtr> & equivalentGates);
void getEquivalentPhaseFactors(std::vector<ComplexVal>& phaseFactors, int matrixSize);
void releaseEquivalentGates(std::vector<GatePtr> & equivalentGates);
void releaseEquivalentCoordinates(std::vector<RealCoordinatePtr<GatePtr> >& equivalentCoordinates);
GateRealCoordinateCalculatorPtr m_pGateCoordinateCalculator;
MatrixOperatorPtr m_pMatrixOperator;
bool m_phaseIgnored;
};
#endif /* GATECOORDINATECONVERTERIMPL_H_ */
| [
"pham@apecsa-indonesia.com"
] | pham@apecsa-indonesia.com |
d35160a3fdacc6488563f18a6525fbde718f27b9 | 2b00823785bb182898609d5565d39cba92036840 | /src/vgui2/vgui_controls/BuildGroup.cpp | ec7dba221b1e90921e004c004a9ecee129f1c23f | [] | no_license | rlabrecque/Source2007SDKTemplate | 4d401595c0381b6fb46cef5bbfc2bcd31fe2a12d | 2e3c7e4847342f575d145452c6246b296e6eee67 | refs/heads/master | 2021-01-10T20:44:46.700845 | 2012-10-18T23:47:21 | 2012-10-18T23:47:21 | 5,194,511 | 3 | 1 | null | null | null | null | WINDOWS-1252 | C++ | false | false | 38,932 | cpp | //========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
// $NoKeywords: $
//
//=============================================================================//
//========= Copyright © 1996-2003, Valve LLC, All rights reserved. ============
//
// The copyright to the contents herein is the property of Valve, L.L.C.
// The contents may be used and/or copied only with the written permission of
// Valve, L.L.C., or in accordance with the terms and conditions stipulated in
// the agreement/contract under which the contents have been supplied.
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================
#include <stdio.h>
#define PROTECTED_THINGS_DISABLE
#include "utldict.h"
#include <vgui/KeyCode.h>
#include <vgui/Cursor.h>
#include <vgui/MouseCode.h>
#include <KeyValues.h>
#include <vgui/IInput.h>
#include <vgui/ISystem.h>
#include <vgui/IVGui.h>
#include <vgui/ISurface.h>
#include <vgui_controls/BuildGroup.h>
#include <vgui_controls/Panel.h>
#include <vgui_controls/PHandle.h>
#include <vgui_controls/Label.h>
#include <vgui_controls/EditablePanel.h>
#include <vgui_controls/MessageBox.h>
#include "filesystem.h"
#if defined( _X360 )
#include "xbox/xbox_win32stubs.h"
#endif
// memdbgon must be the last include file in a .cpp file!!!
#include <tier0/memdbgon.h>
using namespace vgui;
//-----------------------------------------------------------------------------
// Handle table
//-----------------------------------------------------------------------------
IMPLEMENT_HANDLES( BuildGroup, 20 )
//-----------------------------------------------------------------------------
// Purpose: Constructor
//-----------------------------------------------------------------------------
BuildGroup::BuildGroup(Panel *parentPanel, Panel *contextPanel)
{
CONSTRUCT_HANDLE( );
_enabled=false;
_snapX=1;
_snapY=1;
_cursor_sizenwse = dc_sizenwse;
_cursor_sizenesw = dc_sizenesw;
_cursor_sizewe = dc_sizewe;
_cursor_sizens = dc_sizens;
_cursor_sizeall = dc_sizeall;
_currentPanel=null;
_dragging=false;
m_pResourceName=NULL;
m_pResourcePathID = NULL;
m_hBuildDialog=NULL;
m_pParentPanel=parentPanel;
for (int i=0; i<4; ++i)
_rulerNumber[i] = NULL;
SetContextPanel(contextPanel);
_controlGroup = NULL;
_groupDeltaX = 0;
_groupDeltaX = 0;
_showRulers = false;
}
//-----------------------------------------------------------------------------
// Purpose: Destructor
//-----------------------------------------------------------------------------
BuildGroup::~BuildGroup()
{
if (m_hBuildDialog)
delete m_hBuildDialog.Get();
m_hBuildDialog = NULL;
delete [] m_pResourceName;
delete [] m_pResourcePathID;
for (int i=0; i <4; ++i)
{
if (_rulerNumber[i])
{
delete _rulerNumber[i];
_rulerNumber[i]= NULL;
}
}
DESTRUCT_HANDLE();
}
//-----------------------------------------------------------------------------
// Purpose: Toggles build mode on/off
// Input : state - new state
//-----------------------------------------------------------------------------
void BuildGroup::SetEnabled(bool state)
{
if(_enabled != state)
{
_enabled = state;
_currentPanel = NULL;
if ( state )
{
ActivateBuildDialog();
}
else
{
// hide the build dialog
if ( m_hBuildDialog )
{
m_hBuildDialog->OnCommand("Close");
}
// request focus for our main panel
m_pParentPanel->RequestFocus();
}
}
}
//-----------------------------------------------------------------------------
// Purpose: Check if buildgroup is enabled
//-----------------------------------------------------------------------------
bool BuildGroup::IsEnabled()
{
return _enabled;
}
//-----------------------------------------------------------------------------
// Purpose: Get the list of panels that are currently selected
//-----------------------------------------------------------------------------
CUtlVector<PHandle> *BuildGroup::GetControlGroup()
{
return &_controlGroup;
}
//-----------------------------------------------------------------------------
// Purpose: Check if ruler display is activated
//-----------------------------------------------------------------------------
bool BuildGroup::HasRulersOn()
{
return _showRulers;
}
//-----------------------------------------------------------------------------
// Purpose: Toggle ruler display
//-----------------------------------------------------------------------------
void BuildGroup::ToggleRulerDisplay()
{
_showRulers = !_showRulers;
if (_rulerNumber[0] == NULL) // rulers haven't been initialized
{
_rulerNumber[0] = new Label(m_pBuildContext, NULL, "");
_rulerNumber[1] = new Label(m_pBuildContext, NULL, "");
_rulerNumber[2] = new Label(m_pBuildContext, NULL, "");
_rulerNumber[3] = new Label(m_pBuildContext, NULL, "");
}
SetRulerLabelsVisible(_showRulers);
m_pBuildContext->Repaint();
}
//-----------------------------------------------------------------------------
// Purpose: Tobble visibility of ruler number labels
//-----------------------------------------------------------------------------
void BuildGroup::SetRulerLabelsVisible(bool state)
{
_rulerNumber[0]->SetVisible(state);
_rulerNumber[1]->SetVisible(state);
_rulerNumber[2]->SetVisible(state);
_rulerNumber[3]->SetVisible(state);
}
void BuildGroup::ApplySchemeSettings( IScheme *pScheme )
{
DrawRulers();
}
//-----------------------------------------------------------------------------
// Purpose: Draw Rulers on screen if conditions are right
//-----------------------------------------------------------------------------
void BuildGroup::DrawRulers()
{
// don't draw if visibility is off
if (!_showRulers)
{
return;
}
// no drawing if we selected the context panel
if (m_pBuildContext == _currentPanel)
{
SetRulerLabelsVisible(false);
return;
}
else
SetRulerLabelsVisible(true);
int x, y, wide, tall;
// get base panel's postition
m_pBuildContext->GetBounds(x, y, wide, tall);
m_pBuildContext->ScreenToLocal(x,y);
int cx, cy, cwide, ctall;
_currentPanel->GetBounds (cx, cy, cwide, ctall);
surface()->PushMakeCurrent(m_pBuildContext->GetVPanel(), false);
// draw rulers
surface()->DrawSetColor(255, 255, 255, 255); // white color
surface()->DrawFilledRect(0, cy, cx, cy+1); //top horiz left
surface()->DrawFilledRect(cx+cwide, cy, wide, cy+1); //top horiz right
surface()->DrawFilledRect(0, cy+ctall-1, cx, cy+ctall); //bottom horiz left
surface()->DrawFilledRect(cx+cwide, cy+ctall-1, wide, cy+ctall); //bottom horiz right
surface()->DrawFilledRect(cx,0,cx+1,cy); //top vert left
surface()->DrawFilledRect(cx+cwide-1,0, cx+cwide, cy); //top vert right
surface()->DrawFilledRect(cx,cy+ctall, cx+1, tall); //bottom vert left
surface()->DrawFilledRect(cx+cwide-1, cy+ctall, cx+cwide, tall); //bottom vert right
surface()->PopMakeCurrent(m_pBuildContext->GetVPanel());
// now let's put numbers with the rulers
char textstring[20];
Q_snprintf (textstring, sizeof( textstring ), "%d", cx);
_rulerNumber[0]->SetText(textstring);
int twide, ttall;
_rulerNumber[0]->GetContentSize(twide,ttall);
_rulerNumber[0]->SetSize(twide,ttall);
_rulerNumber[0]->SetPos(cx/2-twide/2, cy-ttall+3);
Q_snprintf (textstring, sizeof( textstring ), "%d", cy);
_rulerNumber[1]->SetText(textstring);
_rulerNumber[1]->GetContentSize(twide,ttall);
_rulerNumber[1]->SetSize(twide,ttall);
_rulerNumber[1]->GetSize(twide,ttall);
_rulerNumber[1]->SetPos(cx-twide + 3, cy/2-ttall/2);
Q_snprintf (textstring, sizeof( textstring ), "%d", cy);
_rulerNumber[2]->SetText(textstring);
_rulerNumber[2]->GetContentSize(twide,ttall);
_rulerNumber[2]->SetSize(twide,ttall);
_rulerNumber[2]->SetPos(cx+cwide+(wide-cx-cwide)/2 - twide/2, cy+ctall-3);
Q_snprintf (textstring, sizeof( textstring ), "%d", cy);
_rulerNumber[3]->SetText(textstring);
_rulerNumber[3]->GetContentSize(twide,ttall);
_rulerNumber[3]->SetSize(twide,ttall);
_rulerNumber[3]->SetPos(cx+cwide, cy+ctall+(tall-cy-ctall)/2 - ttall/2);
}
//-----------------------------------------------------------------------------
// Purpose: respond to cursor movments
//-----------------------------------------------------------------------------
bool BuildGroup::CursorMoved(int x, int y, Panel *panel)
{
Assert(panel);
if ( !m_hBuildDialog.Get() )
{
if ( panel->GetParent() )
{
EditablePanel *ep = dynamic_cast< EditablePanel * >( panel->GetParent() );
if ( ep )
{
BuildGroup *bg = ep->GetBuildGroup();
if ( bg && bg != this )
{
bg->CursorMoved( x, y, panel );
}
}
}
return false;
}
// no moving uneditable panels
// commented out because this has issues with panels moving
// to front and obscuring other panels
//if (!panel->IsBuildModeEditable())
// return;
if (_dragging)
{
input()->GetCursorPos(x, y);
if (_dragMouseCode == MOUSE_RIGHT)
{
int newW = max( 1, _dragStartPanelSize[ 0 ] + x - _dragStartCursorPos[0] );
int newH = max( 1, _dragStartPanelSize[ 1 ] + y - _dragStartCursorPos[1] );
bool shift = ( input()->IsKeyDown(KEY_LSHIFT) || input()->IsKeyDown(KEY_RSHIFT) );
bool ctrl = ( input()->IsKeyDown(KEY_LCONTROL) || input()->IsKeyDown(KEY_RCONTROL) );
if ( shift )
{
newW = _dragStartPanelSize[ 0 ];
}
if ( ctrl )
{
newH = _dragStartPanelSize[ 1 ];
}
panel->SetSize( newW, newH );
ApplySnap(panel);
}
else
{
for (int i=0; i < _controlGroup.Count(); ++i)
{
// now fix offset of member panels with respect to the one we are dragging
Panel *groupMember = _controlGroup[i].Get();
groupMember->SetPos(_dragStartPanelPos[0] + _groupDeltaX[i] +(x-_dragStartCursorPos[0]), _dragStartPanelPos[1] + _groupDeltaY[i] +(y-_dragStartCursorPos[1]));
ApplySnap(groupMember);
}
}
// update the build dialog
if (m_hBuildDialog)
{
KeyValues *keyval = new KeyValues("UpdateControlData");
keyval->SetPtr("panel", GetCurrentPanel());
ivgui()->PostMessage(m_hBuildDialog->GetVPanel(), keyval, NULL);
keyval = new KeyValues("EnableSaveButton");
ivgui()->PostMessage(m_hBuildDialog->GetVPanel(), keyval, NULL);
}
panel->Repaint();
panel->CallParentFunction(new KeyValues("Repaint"));
}
return true;
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
bool BuildGroup::MousePressed(MouseCode code, Panel *panel)
{
Assert(panel);
if ( !m_hBuildDialog.Get() )
{
if ( panel->GetParent() )
{
EditablePanel *ep = dynamic_cast< EditablePanel * >( panel->GetParent() );
if ( ep )
{
BuildGroup *bg = ep->GetBuildGroup();
if ( bg && bg != this )
{
bg->MousePressed( code, panel );
}
}
}
return false;
}
// if people click on the base build dialog panel.
if (panel == m_hBuildDialog)
{
// hide the click menu if its up
ivgui()->PostMessage(m_hBuildDialog->GetVPanel(), new KeyValues("HideNewControlMenu"), NULL);
return true;
}
// don't select unnamed items
if (strlen(panel->GetName()) < 1)
return true;
bool shift = ( input()->IsKeyDown(KEY_LSHIFT) || input()->IsKeyDown(KEY_RSHIFT) );
if (!shift)
{
_controlGroup.RemoveAll();
}
// Show new ctrl menu if they click on the bg (not on a subcontrol)
if ( code == MOUSE_RIGHT && panel == GetContextPanel())
{
// trigger a drop down menu to create new controls
ivgui()->PostMessage (m_hBuildDialog->GetVPanel(), new KeyValues("ShowNewControlMenu"), NULL);
}
else
{
// don't respond if we click on ruler numbers
if (_showRulers) // rulers are visible
{
for ( int i=0; i < 4; i++)
{
if ( panel == _rulerNumber[i])
return true;
}
}
_dragging = true;
_dragMouseCode = code;
ivgui()->PostMessage(m_hBuildDialog->GetVPanel(), new KeyValues("HideNewControlMenu"), NULL);
int x, y;
input()->GetCursorPos(x, y);
_dragStartCursorPos[0] = x;
_dragStartCursorPos[1] = y;
input()->SetMouseCapture(panel->GetVPanel());
_groupDeltaX.RemoveAll();
_groupDeltaY.RemoveAll();
// basepanel is the panel that all the deltas will be calculated from.
// it is the last panel we clicked in because if we move the panels as a group
// it would be from that one
Panel *basePanel = NULL;
// find the panel we clicked in, that is the base panel
// it might already be in the group
for (int i=0; i< _controlGroup.Count(); ++i)
{
if (panel == _controlGroup[i].Get())
{
basePanel = panel;
break;
}
}
// if its not in the group we just added this panel. get it in the group
if (basePanel == NULL)
{
PHandle temp;
temp = panel;
_controlGroup.AddToTail(temp);
basePanel = panel;
}
basePanel->GetPos(x,y);
_dragStartPanelPos[0]=x;
_dragStartPanelPos[1]=y;
basePanel->GetSize( _dragStartPanelSize[ 0 ], _dragStartPanelSize[ 1 ] );
// figure out the deltas of the other panels from the base panel
for (int i=0; i<_controlGroup.Count(); ++i)
{
int cx, cy;
_controlGroup[i].Get()->GetPos(cx, cy);
_groupDeltaX.AddToTail(cx - x);
_groupDeltaY.AddToTail(cy - y);
}
// if this panel wasn't already selected update the buildmode dialog controls to show its info
if(_currentPanel != panel)
{
_currentPanel = panel;
if ( m_hBuildDialog )
{
// think this is taken care of by SetActiveControl.
//ivgui()->PostMessage(m_hBuildDialog->GetVPanel(), new KeyValues("ApplyDataToControls"), NULL);
KeyValues *keyval = new KeyValues("SetActiveControl");
keyval->SetPtr("PanelPtr", GetCurrentPanel());
ivgui()->PostMessage(m_hBuildDialog->GetVPanel(), keyval, NULL);
}
}
// store undo information upon panel selection.
ivgui()->PostMessage(m_hBuildDialog->GetVPanel(), new KeyValues("StoreUndo"), NULL);
panel->RequestFocus();
}
return true;
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
bool BuildGroup::MouseReleased(MouseCode code, Panel *panel)
{
if ( !m_hBuildDialog.Get() )
{
if ( panel->GetParent() )
{
EditablePanel *ep = dynamic_cast< EditablePanel * >( panel->GetParent() );
if ( ep )
{
BuildGroup *bg = ep->GetBuildGroup();
if ( bg && bg != this )
{
bg->MouseReleased( code, panel );
}
}
}
return false;
}
Assert(panel);
_dragging=false;
input()->SetMouseCapture(null);
return true;
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
bool BuildGroup::MouseDoublePressed(MouseCode code, Panel *panel)
{
Assert(panel);
return MousePressed( code, panel );
}
bool BuildGroup::KeyTyped( wchar_t unichar, Panel *panel )
{
if ( !m_hBuildDialog.Get() )
{
if ( panel->GetParent() )
{
EditablePanel *ep = dynamic_cast< EditablePanel * >( panel->GetParent() );
if ( ep )
{
BuildGroup *bg = ep->GetBuildGroup();
if ( bg && bg != this )
{
bg->KeyTyped( unichar, panel );
}
}
}
return false;
}
return true;
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
bool BuildGroup::KeyCodeTyped(KeyCode code, Panel *panel)
{
if ( !m_hBuildDialog.Get() )
{
if ( panel->GetParent() )
{
EditablePanel *ep = dynamic_cast< EditablePanel * >( panel->GetParent() );
if ( ep )
{
BuildGroup *bg = ep->GetBuildGroup();
if ( bg && bg != this )
{
bg->KeyCodeTyped( code, panel );
}
}
}
return false;
}
Assert(panel);
int dx=0;
int dy=0;
bool shift = ( input()->IsKeyDown(KEY_LSHIFT) || input()->IsKeyDown(KEY_RSHIFT) );
bool ctrl = ( input()->IsKeyDown(KEY_LCONTROL) || input()->IsKeyDown(KEY_RCONTROL) );
bool alt = (input()->IsKeyDown(KEY_LALT) || input()->IsKeyDown(KEY_RALT));
if ( ctrl && shift && alt && code == KEY_B)
{
// enable build mode
EditablePanel *ep = dynamic_cast< EditablePanel * >( panel );
if ( ep )
{
ep->ActivateBuildMode();
}
return true;
}
switch (code)
{
case KEY_LEFT:
{
dx-=_snapX;
break;
}
case KEY_RIGHT:
{
dx+=_snapX;
break;
}
case KEY_UP:
{
dy-=_snapY;
break;
}
case KEY_DOWN:
{
dy+=_snapY;
break;
}
case KEY_DELETE:
{
// delete the panel we have selected
ivgui()->PostMessage (m_hBuildDialog->GetVPanel(), new KeyValues ("DeletePanel"), NULL);
break;
}
}
if (ctrl)
{
switch (code)
{
case KEY_Z:
{
ivgui()->PostMessage(m_hBuildDialog->GetVPanel(), new KeyValues("Undo"), NULL);
break;
}
case KEY_C:
{
ivgui()->PostMessage(m_hBuildDialog->GetVPanel(), new KeyValues("Copy"), NULL);
break;
}
case KEY_V:
{
ivgui()->PostMessage(m_hBuildDialog->GetVPanel(), new KeyValues("Paste"), NULL);
break;
}
}
}
if(dx||dy)
{
//TODO: make this stuff actually snap
int x,y,wide,tall;
panel->GetBounds(x,y,wide,tall);
if(shift)
{
panel->SetSize(wide+dx,tall+dy);
}
else
{
panel->SetPos(x+dx,y+dy);
}
ApplySnap(panel);
panel->Repaint();
if (panel->GetVParent() != NULL)
{
panel->PostMessage(panel->GetVParent(), new KeyValues("Repaint"));
}
// update the build dialog
if (m_hBuildDialog)
{
// post that it's active
KeyValues *keyval = new KeyValues("SetActiveControl");
keyval->SetPtr("PanelPtr", GetCurrentPanel());
ivgui()->PostMessage(m_hBuildDialog->GetVPanel(), keyval, NULL);
// post that it's been changed
ivgui()->PostMessage(m_hBuildDialog->GetVPanel(), new KeyValues("PanelMoved"), NULL);
}
}
// If holding key while dragging, simulate moving cursor so shift/ctrl key changes take effect
if ( _dragging && panel != GetContextPanel() )
{
int x, y;
input()->GetCursorPos( x, y );
CursorMoved( x, y, panel );
}
return true;
}
bool BuildGroup::KeyCodeReleased(KeyCode code, Panel *panel )
{
if ( !m_hBuildDialog.Get() )
{
if ( panel->GetParent() )
{
EditablePanel *ep = dynamic_cast< EditablePanel * >( panel->GetParent() );
if ( ep )
{
BuildGroup *bg = ep->GetBuildGroup();
if ( bg && bg != this )
{
bg->KeyCodeTyped( code, panel );
}
}
}
return false;
}
// If holding key while dragging, simulate moving cursor so shift/ctrl key changes take effect
if ( _dragging && panel != GetContextPanel() )
{
int x, y;
input()->GetCursorPos( x, y );
CursorMoved( x, y, panel );
}
return true;
}
//-----------------------------------------------------------------------------
// Purpose: Searches for a BuildModeDialog in the hierarchy
//-----------------------------------------------------------------------------
Panel *BuildGroup::CreateBuildDialog( void )
{
// request the panel
Panel *buildDialog = NULL;
KeyValues *data = new KeyValues("BuildDialog");
data->SetPtr("BuildGroupPtr", this);
if (m_pBuildContext->RequestInfo(data))
{
buildDialog = (Panel *)data->GetPtr("PanelPtr");
}
// initialize the build dialog if found
if ( buildDialog )
{
input()->ReleaseAppModalSurface();
}
return buildDialog;
}
//-----------------------------------------------------------------------------
// Purpose: Activates the build mode settings dialog
//-----------------------------------------------------------------------------
void BuildGroup::ActivateBuildDialog( void )
{
// create the build mode dialog first time through
if (!m_hBuildDialog.Get())
{
m_hBuildDialog = CreateBuildDialog();
if (!m_hBuildDialog.Get())
return;
}
m_hBuildDialog->SetVisible( true );
// send a message to set the initial dialog controls info
_currentPanel = m_pParentPanel;
KeyValues *keyval = new KeyValues("SetActiveControl");
keyval->SetPtr("PanelPtr", GetCurrentPanel());
ivgui()->PostMessage(m_hBuildDialog->GetVPanel(), keyval, NULL);
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
HCursor BuildGroup::GetCursor(Panel *panel)
{
Assert(panel);
int x,y,wide,tall;
input()->GetCursorPos(x,y);
panel->ScreenToLocal(x,y);
panel->GetSize(wide,tall);
if(x < 2)
{
if(y < 4)
{
return _cursor_sizenwse;
}
else
if(y<(tall-4))
{
return _cursor_sizewe;
}
else
{
return _cursor_sizenesw;
}
}
return _cursor_sizeall;
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void BuildGroup::ApplySnap(Panel *panel)
{
Assert(panel);
int x,y,wide,tall;
panel->GetBounds(x,y,wide,tall);
x=(x/_snapX)*_snapX;
y=(y/_snapY)*_snapY;
panel->SetPos(x,y);
int xx,yy;
xx=x+wide;
yy=y+tall;
xx=(xx/_snapX)*_snapX;
yy=(yy/_snapY)*_snapY;
panel->SetSize(xx-x,yy-y);
}
//-----------------------------------------------------------------------------
// Purpose: Return the currently selected panel
//-----------------------------------------------------------------------------
Panel *BuildGroup::GetCurrentPanel()
{
return _currentPanel;
}
//-----------------------------------------------------------------------------
// Purpose: Add panel the list of panels that are in the build group
//-----------------------------------------------------------------------------
void BuildGroup::PanelAdded(Panel *panel)
{
Assert(panel);
PHandle temp;
temp = panel;
int c = _panelDar.Count();
for ( int i = 0; i < c; ++i )
{
if ( _panelDar[ i ] == temp )
{
return;
}
}
_panelDar.AddToTail(temp);
}
//-----------------------------------------------------------------------------
// Purpose: loads the control settings from file
//-----------------------------------------------------------------------------
void BuildGroup::LoadControlSettings(const char *controlResourceName, const char *pathID, KeyValues *pPreloadedKeyValues)
{
// make sure the file is registered
RegisterControlSettingsFile(controlResourceName, pathID);
// Use the keyvalues they passed in or load them.
KeyValues *rDat = pPreloadedKeyValues;
if ( !rDat )
{
// load the resource data from the file
rDat = new KeyValues(controlResourceName);
// check the skins directory first, if an explicit pathID hasn't been set
bool bSuccess = false;
if (!pathID)
{
bSuccess = rDat->LoadFromFile(g_pFullFileSystem, controlResourceName, "SKIN");
}
if (!bSuccess)
{
bSuccess = rDat->LoadFromFile(g_pFullFileSystem, controlResourceName, pathID);
}
if ( bSuccess )
{
if ( IsX360() )
{
rDat->ProcessResolutionKeys( surface()->GetResolutionKey() );
}
if ( IsPC() )
{
ConVarRef cl_hud_minmode( "cl_hud_minmode", true );
if ( cl_hud_minmode.IsValid() && cl_hud_minmode.GetBool() )
{
rDat->ProcessResolutionKeys( "_minmode" );
}
}
}
}
// save off the resource name
delete [] m_pResourceName;
m_pResourceName = new char[strlen(controlResourceName) + 1];
strcpy(m_pResourceName, controlResourceName);
if (pathID)
{
delete [] m_pResourcePathID;
m_pResourcePathID = new char[strlen(pathID) + 1];
strcpy(m_pResourcePathID, pathID);
}
// delete any controls not in both files
DeleteAllControlsCreatedByControlSettingsFile();
// loop through the resource data sticking info into controls
ApplySettings(rDat);
if (m_pParentPanel)
{
m_pParentPanel->InvalidateLayout();
m_pParentPanel->Repaint();
}
if ( rDat != pPreloadedKeyValues )
{
rDat->deleteThis();
}
}
//-----------------------------------------------------------------------------
// Purpose: registers that a control settings file may be loaded
// use when the dialog may have multiple states and the editor will need to be able to switch between them
//-----------------------------------------------------------------------------
void BuildGroup::RegisterControlSettingsFile(const char *controlResourceName, const char *pathID)
{
// add the file into a list for build mode
CUtlSymbol sym(controlResourceName);
if (!m_RegisteredControlSettingsFiles.IsValidIndex(m_RegisteredControlSettingsFiles.Find(sym)))
{
m_RegisteredControlSettingsFiles.AddToTail(sym);
}
}
//-----------------------------------------------------------------------------
// Purpose: data accessor / iterator
//-----------------------------------------------------------------------------
int BuildGroup::GetRegisteredControlSettingsFileCount()
{
return m_RegisteredControlSettingsFiles.Count();
}
//-----------------------------------------------------------------------------
// Purpose: data accessor
//-----------------------------------------------------------------------------
const char *BuildGroup::GetRegisteredControlSettingsFileByIndex(int index)
{
return m_RegisteredControlSettingsFiles[index].String();
}
//-----------------------------------------------------------------------------
// Purpose: reloads the control settings from file
//-----------------------------------------------------------------------------
void BuildGroup::ReloadControlSettings()
{
delete m_hBuildDialog.Get();
m_hBuildDialog = NULL;
// loop though objects in the current control group and remove them all
// the 0th panel is always the contextPanel which is not deletable
for( int i = 1; i < _panelDar.Count(); i++ )
{
if (!_panelDar[i].Get()) // this can happen if we had two of the same handle in the list
{
_panelDar.Remove(i);
--i;
continue;
}
// only delete deletable panels, as the only deletable panels
// are the ones created using the resource file
if ( _panelDar[i].Get()->IsBuildModeDeletable())
{
delete _panelDar[i].Get();
_panelDar.Remove(i);
--i;
}
}
if (m_pResourceName)
{
EditablePanel *edit = dynamic_cast<EditablePanel *>(m_pParentPanel);
if (edit)
{
edit->LoadControlSettings(m_pResourceName, m_pResourcePathID);
}
else
{
LoadControlSettings(m_pResourceName, m_pResourcePathID);
}
}
_controlGroup.RemoveAll();
ActivateBuildDialog();
}
//-----------------------------------------------------------------------------
// Purpose: changes which control settings are currently loaded
//-----------------------------------------------------------------------------
void BuildGroup::ChangeControlSettingsFile(const char *controlResourceName)
{
// clear any current state
_controlGroup.RemoveAll();
_currentPanel = m_pParentPanel;
// load the new state, via the dialog if possible
EditablePanel *edit = dynamic_cast<EditablePanel *>(m_pParentPanel);
if (edit)
{
edit->LoadControlSettings(controlResourceName, m_pResourcePathID);
}
else
{
LoadControlSettings(controlResourceName, m_pResourcePathID);
}
// force it to update
KeyValues *keyval = new KeyValues("SetActiveControl");
keyval->SetPtr("PanelPtr", GetCurrentPanel());
ivgui()->PostMessage(m_hBuildDialog->GetVPanel(), keyval, NULL);
}
//-----------------------------------------------------------------------------
// Purpose: saves control settings to file
//-----------------------------------------------------------------------------
bool BuildGroup::SaveControlSettings( void )
{
bool bSuccess = false;
if ( m_pResourceName )
{
KeyValues *rDat = new KeyValues( m_pResourceName );
// get the data from our controls
GetSettings( rDat );
char fullpath[ 512 ];
g_pFullFileSystem->RelativePathToFullPath( m_pResourceName, m_pResourcePathID, fullpath, sizeof( fullpath ) );
// save the data out to a file
bSuccess = rDat->SaveToFile( g_pFullFileSystem, fullpath, NULL );
if (!bSuccess)
{
MessageBox *dlg = new MessageBox("BuildMode - Error saving file", "Error: Could not save changes. File is most likely read only.");
dlg->DoModal();
}
rDat->deleteThis();
}
return bSuccess;
}
//-----------------------------------------------------------------------------
// Purpose: Deletes all the controls not created by the code
//-----------------------------------------------------------------------------
void BuildGroup::DeleteAllControlsCreatedByControlSettingsFile()
{
// loop though objects in the current control group and remove them all
// the 0th panel is always the contextPanel which is not deletable
for ( int i = 1; i < _panelDar.Count(); i++ )
{
if (!_panelDar[i].Get()) // this can happen if we had two of the same handle in the list
{
_panelDar.Remove(i);
--i;
continue;
}
// only delete deletable panels, as the only deletable panels
// are the ones created using the resource file
if ( _panelDar[i].Get()->IsBuildModeDeletable())
{
delete _panelDar[i].Get();
_panelDar.Remove(i);
--i;
}
}
_currentPanel = m_pBuildContext;
_currentPanel->InvalidateLayout();
m_pBuildContext->Repaint();
}
//-----------------------------------------------------------------------------
// Purpose: serializes settings from a resource data container
//-----------------------------------------------------------------------------
void BuildGroup::ApplySettings( KeyValues *resourceData )
{
// loop through all the keys, applying them wherever
for (KeyValues *controlKeys = resourceData->GetFirstSubKey(); controlKeys != NULL; controlKeys = controlKeys->GetNextKey())
{
bool bFound = false;
// Skip keys that are atomic..
if (controlKeys->GetDataType() != KeyValues::TYPE_NONE)
continue;
char const *keyName = controlKeys->GetName();
// check to see if any buildgroup panels have this name
for ( int i = 0; i < _panelDar.Count(); i++ )
{
Panel *panel = _panelDar[i].Get();
if (!panel) // this can happen if we had two of the same handle in the list
{
_panelDar.Remove(i);
--i;
continue;
}
Assert (panel);
// make the control name match CASE INSENSITIVE!
char const *panelName = panel->GetName();
if (!Q_stricmp(panelName, keyName))
{
// apply the settings
panel->ApplySettings(controlKeys);
bFound = true;
break;
}
}
if ( !bFound )
{
// the key was not found in the registered list, check to see if we should create it
if ( keyName /*controlKeys->GetInt("AlwaysCreate", false)*/ )
{
// create the control even though it wasn't registered
NewControl( controlKeys );
}
}
}
}
//-----------------------------------------------------------------------------
// Purpose: Create a new control in the context panel
// Input: name: class name of control to create
// controlKeys: keyvalues of settings for the panel.
// name OR controlKeys should be set, not both.
// x,y position relative to base panel
// Output: Panel *newPanel, NULL if failed to create new control.
//-----------------------------------------------------------------------------
Panel *BuildGroup::NewControl( const char *name, int x, int y)
{
Assert (name);
Panel *newPanel = NULL;
// returns NULL on failure
newPanel = static_cast<EditablePanel *>(m_pParentPanel)->CreateControlByName(name);
if (newPanel)
{
// panel successfully created
newPanel->SetParent(m_pParentPanel);
newPanel->SetBuildGroup(this);
newPanel->SetPos(x, y);
char newFieldName[255];
GetNewFieldName(newFieldName, sizeof(newFieldName), newPanel);
newPanel->SetName(newFieldName);
newPanel->AddActionSignalTarget(m_pParentPanel);
newPanel->SetBuildModeEditable(true);
newPanel->SetBuildModeDeletable(true);
// make sure it gets freed
newPanel->SetAutoDelete(true);
}
return newPanel;
}
//-----------------------------------------------------------------------------
// Purpose: Create a new control in the context panel
// Input: controlKeys: keyvalues of settings for the panel only works when applying initial settings.
// Output: Panel *newPanel, NULL if failed to create new control.
//-----------------------------------------------------------------------------
Panel *BuildGroup::NewControl( KeyValues *controlKeys, int x, int y)
{
Assert (controlKeys);
Panel *newPanel = NULL;
if (controlKeys)
{
KeyValues *keyVal = new KeyValues("ControlFactory", "ControlName", controlKeys->GetString("ControlName"));
m_pBuildContext->RequestInfo(keyVal);
// returns NULL on failure
newPanel = (Panel *)keyVal->GetPtr("PanelPtr");
keyVal->deleteThis();
}
else
{
return NULL;
}
if (newPanel)
{
// panel successfully created
newPanel->SetParent(m_pParentPanel);
newPanel->SetBuildGroup(this);
newPanel->SetPos(x, y);
newPanel->SetName(controlKeys->GetName()); // name before applysettings :)
newPanel->ApplySettings(controlKeys);
newPanel->AddActionSignalTarget(m_pParentPanel);
newPanel->SetBuildModeEditable(true);
newPanel->SetBuildModeDeletable(true);
// make sure it gets freed
newPanel->SetAutoDelete(true);
}
return newPanel;
}
//-----------------------------------------------------------------------------
// Purpose: Get a new unique fieldname for a new control
//-----------------------------------------------------------------------------
void BuildGroup::GetNewFieldName(char *newFieldName, int newFieldNameSize, Panel *newPanel)
{
int fieldNameNumber=1;
char defaultName[25];
Q_strncpy( defaultName, newPanel->GetClassName(), sizeof( defaultName ) );
while (1)
{
Q_snprintf (newFieldName, newFieldNameSize, "%s%d", defaultName, fieldNameNumber);
if ( FieldNameTaken(newFieldName) == NULL)
break;
++fieldNameNumber;
}
}
//-----------------------------------------------------------------------------
// Purpose: check to see if any buildgroup panels have this fieldname
// Input : fieldName, name to check
// Output : ptr to a panel that has the name if it is taken
//-----------------------------------------------------------------------------
Panel *BuildGroup::FieldNameTaken(const char *fieldName)
{
for ( int i = 0; i < _panelDar.Count(); i++ )
{
Panel *panel = _panelDar[i].Get();
if ( !panel )
continue;
if (!stricmp(panel->GetName(), fieldName) )
{
return panel;
}
}
return NULL;
}
//-----------------------------------------------------------------------------
// Purpose: serializes settings to a resource data container
//-----------------------------------------------------------------------------
void BuildGroup::GetSettings( KeyValues *resourceData )
{
// loop through all the objects getting their settings
for( int i = 0; i < _panelDar.Count(); i++ )
{
Panel *panel = _panelDar[i].Get();
if (!panel)
continue;
bool isRuler = false;
// do not get setting for ruler labels.
if (_showRulers) // rulers are visible
{
for (int i = 0; i < 4; i++)
{
if (panel == _rulerNumber[i])
{
isRuler = true;
break;
}
}
if (isRuler)
{
isRuler = false;
continue;
}
}
// Don't save the setting of the buildmodedialog
if (!stricmp(panel->GetName(), "BuildDialog"))
continue;
// get the keys section from the data file
if (panel->GetName() && *panel->GetName())
{
KeyValues *datKey = resourceData->FindKey(panel->GetName(), true);
// get the settings
panel->GetSettings(datKey);
}
}
}
//-----------------------------------------------------------------------------
// Purpose: loop though objects in the current control group and remove them all
//-----------------------------------------------------------------------------
void BuildGroup::RemoveSettings()
{
// loop though objects in the current control group and remove them all
int i;
for( i = 0; i < _controlGroup.Count(); i++ )
{
// only delete delatable panels
if ( _controlGroup[i].Get()->IsBuildModeDeletable())
{
delete _controlGroup[i].Get();
_controlGroup.Remove(i);
--i;
}
}
// remove deleted panels from the handle list
for( i = 0; i < _panelDar.Count(); i++ )
{
if ( !_panelDar[i].Get() )
{
_panelDar.Remove(i);
--i;
}
}
_currentPanel = m_pBuildContext;
_currentPanel->InvalidateLayout();
m_pBuildContext->Repaint();
}
//-----------------------------------------------------------------------------
// Purpose: sets the panel from which the build group gets all it's object creation info
//-----------------------------------------------------------------------------
void BuildGroup::SetContextPanel(Panel *contextPanel)
{
m_pBuildContext = contextPanel;
}
//-----------------------------------------------------------------------------
// Purpose: gets the panel from which the build group gets all it's object creation info
//-----------------------------------------------------------------------------
Panel *BuildGroup::GetContextPanel()
{
return m_pBuildContext;
}
//-----------------------------------------------------------------------------
// Purpose: get the list of panels in the buildgroup
//-----------------------------------------------------------------------------
CUtlVector<PHandle> *BuildGroup::GetPanelList()
{
return &_panelDar;
}
//-----------------------------------------------------------------------------
// Purpose: dialog variables
//-----------------------------------------------------------------------------
KeyValues *BuildGroup::GetDialogVariables()
{
EditablePanel *edit = dynamic_cast<EditablePanel *>(m_pParentPanel);
if (edit)
{
return edit->GetDialogVariables();
}
return NULL;
}
| [
"rileylabrecque@gmail.com"
] | rileylabrecque@gmail.com |
4c39052ee365dd1938796d55e5f4e5e0f1a11ed2 | d0fb46aecc3b69983e7f6244331a81dff42d9595 | /companyreg/src/model/CreateBusinessOpportunityRequest.cc | 5c5d953b2a9d718a483bd23a2c59de373da662c1 | [
"Apache-2.0"
] | permissive | aliyun/aliyun-openapi-cpp-sdk | 3d8d051d44ad00753a429817dd03957614c0c66a | e862bd03c844bcb7ccaa90571bceaa2802c7f135 | refs/heads/master | 2023-08-29T11:54:00.525102 | 2023-08-29T03:32:48 | 2023-08-29T03:32:48 | 115,379,460 | 104 | 82 | NOASSERTION | 2023-09-14T06:13:33 | 2017-12-26T02:53:27 | C++ | UTF-8 | C++ | false | false | 2,224 | cc | /*
* 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.
*/
#include <alibabacloud/companyreg/model/CreateBusinessOpportunityRequest.h>
using AlibabaCloud::Companyreg::Model::CreateBusinessOpportunityRequest;
CreateBusinessOpportunityRequest::CreateBusinessOpportunityRequest() :
RpcServiceRequest("companyreg", "2020-03-06", "CreateBusinessOpportunity")
{
setMethod(HttpRequest::Method::Post);
}
CreateBusinessOpportunityRequest::~CreateBusinessOpportunityRequest()
{}
std::string CreateBusinessOpportunityRequest::getMobile()const
{
return mobile_;
}
void CreateBusinessOpportunityRequest::setMobile(const std::string& mobile)
{
mobile_ = mobile;
setParameter("Mobile", mobile);
}
int CreateBusinessOpportunityRequest::getSource()const
{
return source_;
}
void CreateBusinessOpportunityRequest::setSource(int source)
{
source_ = source;
setParameter("Source", std::to_string(source));
}
std::string CreateBusinessOpportunityRequest::getVCode()const
{
return vCode_;
}
void CreateBusinessOpportunityRequest::setVCode(const std::string& vCode)
{
vCode_ = vCode;
setParameter("VCode", vCode);
}
std::string CreateBusinessOpportunityRequest::getContactName()const
{
return contactName_;
}
void CreateBusinessOpportunityRequest::setContactName(const std::string& contactName)
{
contactName_ = contactName;
setParameter("ContactName", contactName);
}
std::string CreateBusinessOpportunityRequest::getBizType()const
{
return bizType_;
}
void CreateBusinessOpportunityRequest::setBizType(const std::string& bizType)
{
bizType_ = bizType;
setParameter("BizType", bizType);
}
| [
"sdk-team@alibabacloud.com"
] | sdk-team@alibabacloud.com |
f8dc5469dfbbddf5e627d033ce075eb2af8e3aac | ed470637412a01b6d29f44dbf7461c2698d19e0c | /many_bone_ik/src/math/qcp.h | 881bb5a4d1fd616097db90115874fb9577ac3a25 | [
"MIT"
] | permissive | V-Sekai/godot-modules-groups | 51df9b5feb2320856cb88ddee5bb18152b6e5aca | 7c0096edf39eb71f86ec8ddaa30e22591c515f8d | refs/heads/main | 2023-04-22T17:50:43.323793 | 2023-04-22T17:49:28 | 2023-04-22T17:49:28 | 302,478,554 | 4 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 8,193 | h | /**************************************************************************/
/* qcp.h */
/**************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/**************************************************************************/
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#ifndef QCP_H
#define QCP_H
#include "core/math/basis.h"
#include "core/math/vector3.h"
#include "core/variant/variant.h"
/**
* Implementation of the Quaternionf-Based Characteristic Polynomial algorithm
* for RMSD and Superposition calculations.
* <p>
* Usage:
* <p>
* The input consists of 2 Vector3 arrays of equal length. The input
* coordinates are not changed.
*
* <pre>
* Vector3[] x = ...
* Vector3[] y = ...
* SuperPositionQCP qcp = new SuperPositionQCP();
* qcp.set(x, y);
* </pre>
* <p>
* or with weighting factors [0 - 1]]
*
* <pre>
* double[] weights = ...
* qcp.set(x, y, weights);
* </pre>
* <p>
* For maximum efficiency, create a SuperPositionQCP object once and reuse it.
* <p>
* A. Calculate rmsd only
*
* <pre>
* double rmsd = qcp.getRmsd();
* </pre>
* <p>
* B. Calculate a 4x4 transformation (Quaternionation and translation) matrix
*
* <pre>
* Matrix4f Quaterniontrans = qcp.getTransformationMatrix();
* </pre>
* <p>
* C. Get transformated points (y superposed onto the reference x)
*
* <pre>
* Vector3[] ySuperposed = qcp.getTransformedCoordinates();
* </pre>
* <p>
* Citations:
* <p>
* Liu P, Agrafiotis DK, & Theobald DL (2011) Reply to comment on: "Fast
* determination of the optimal Quaternionation matrix for macromolecular
* superpositions." Journal of Computational Chemistry 32(1):185-186.
* [http://dx.doi.org/10.1002/jcc.21606]
* <p>
* Liu P, Agrafiotis DK, & Theobald DL (2010) "Fast determination of the optimal
* Quaternionation matrix for macromolecular superpositions." Journal of Computational
* Chemistry 31(7):1561-1563. [http://dx.doi.org/10.1002/jcc.21439]
* <p>
* Douglas L Theobald (2005) "Rapid calculation of RMSDs using a
* quaternion-based characteristic polynomial." Acta Crystallogr A
* 61(4):478-480. [http://dx.doi.org/10.1107/S0108767305015266 ]
* <p>
* This is an adoption of the original C code QCPQuaternion 1.4 (2012, October 10) to
* Java. The original C source code is available from
* http://theobald.brandeis.edu/qcp/ and was developed by
* <p>
* Douglas L. Theobald Department of Biochemistry MS 009 Brandeis University 415
* South St Waltham, MA 02453 USA
* <p>
* dtheobald@brandeis.edu
* <p>
* Pu Liu Johnson & Johnson Pharmaceutical Research and Development, L.L.C. 665
* Stockton Drive Exton, PA 19341 USA
* <p>
* pliu24@its.jnj.com
* <p>
*
* @author Douglas L. Theobald (original C code)
* @author Pu Liu (original C code)
* @author Peter Rose (adopted to Java)
* @author Aleix Lafita (adopted to Java)
* @author Eron Gjoni (adopted to EWB IK)
*/
class QCP {
double evec_prec = static_cast<double>(1E-6);
double eval_prec = static_cast<double>(1E-11);
PackedVector3Array target;
PackedVector3Array moved;
Vector<real_t> weight;
double w_sum = 0;
Vector3 target_center;
Vector3 moved_center;
double e0 = 0;
double rmsd = 0;
double Sxy = 0, Sxz = 0, Syx = 0, Syz = 0, Szx = 0, Szy = 0;
double SxxpSyy = 0, Szz = 0, mxEigenV = 0, SyzmSzy = 0, SxzmSzx = 0, SxymSyx = 0;
double SxxmSyy = 0, SxypSyx = 0, SxzpSzx = 0;
double Syy = 0, Sxx = 0, SyzpSzy = 0;
bool rmsd_calculated = false;
bool transformation_calculated = false;
bool inner_product_calculated = false;
/**
* Calculates the RMSD value for superposition of y onto x. This requires the
* coordinates to be precentered.
*
* @param x
* 3f points of reference coordinate set
* @param y
* 3f points of coordinate set for superposition
*/
void calculate_rmsd(PackedVector3Array &x, PackedVector3Array &y);
/**
* Calculates the inner product between two coordinate sets x and y (optionally
* weighted, if weights set through
* {@link #set(Vector3[], Vector3[], double[])}). It also calculates an upper
* bound of the most positive root of the key matrix.
* http://theobald.brandeis.edu/qcp/qcpQuaternion.c
*
* @param coords1
* @param coords2
* @return
*/
void inner_product(PackedVector3Array &coords1, PackedVector3Array &coords2);
void calculate_rmsd(double r_length);
void set(PackedVector3Array &r_target, PackedVector3Array &r_moved);
Quaternion calculate_rotation();
/**
* Sets the two input coordinate arrays and weight array. All input arrays must
* be of equal length. Input coordinates are not modified.
*
* @param fixed
* 3f points of reference coordinate set
* @param moved
* 3f points of coordinate set for superposition
* @param weight
* a weight in the inclusive range [0,1] for each point
*/
void set(PackedVector3Array &p_moved, PackedVector3Array &p_target, Vector<real_t> &p_weight, bool p_translate);
static void translate(Vector3 r_translate, PackedVector3Array &r_x);
double get_rmsd(PackedVector3Array &r_fixed, PackedVector3Array &r_moved);
Vector3 move_to_weighted_center(PackedVector3Array &r_to_center, Vector<real_t> &r_weight);
public:
/**
* Constructor with option to set the precision values.
*
* @param evec_prec
* required eigenvector precision
* @param eval_prec
* required eigenvalue precision
*/
QCP(double p_evec_prec, double p_eval_prec);
/**
* Return the RMSD of the superposition of input coordinate set y onto x. Note,
* this is the faster way to calculate an RMSD without actually superposing the
* two sets. The calculation is performed "lazy", meaning calculations are only
* performed if necessary.
*
* @return root mean square deviation for superposition of y onto x
*/
double get_rmsd();
/**
* Weighted superposition.
*
* @param moved
* @param target
* @param weight array of weights for each equivalent point position
* @param translate translate
* @return
*/
Quaternion weighted_superpose(PackedVector3Array &p_moved, PackedVector3Array &p_target, Vector<real_t> &p_weight, bool translate);
Quaternion get_rotation();
Vector3 get_translation();
};
#endif // QCP_H
| [
"ernest.lee@chibifire.com"
] | ernest.lee@chibifire.com |
30317711832e9acfd7aec3403267e183cd1c8c9a | 93cec5d03afc857474a4a1e5b1be18b98bbd1876 | /src/ruukku/config/packing.hpp | ed67fa1031653d69643a0a25c3820c0d3029b6bb | [] | no_license | wuffehauhau/runrun | e4b41c2b85c2c743ee6ec6274002006564fe9ab8 | 2433b9feab1d05ea2e22c30ddb86aeb4011565de | refs/heads/master | 2020-06-06T23:09:51.521599 | 2014-08-13T12:46:40 | 2014-08-13T12:51:36 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 485 | hpp | /*
* Copyright (C) Jani Salo 2013 -
* All rights reserved unless otherwise stated.
*
* Kukkaruukku framework.
*
* File: packing.hpp
* Created: 2013-01-22
* Authors: Jani Salo
*/
/*
* Definition of packing values for ensuring tight packing of several classes.
* The source for this file has static assertions to check these values.
*/
#ifndef RUUKKU_PACKING_HPP
#define RUUKKU_PACKING_HPP
#define RUUKKU_FLOATING_POINT_TYPE_PACKING 4
#endif /* RUUKKU_PACKING_HPP */
| [
"jani.salo.cpp@gmail.com"
] | jani.salo.cpp@gmail.com |
9d4f1212f909a1a3a86a774eab481839fe43d249 | f4f4130c502c937061b8a72aeb27f8d892638277 | /UUA/Player.h | e79d7493ae915b54a8b8553796d98ef99df496c9 | [] | no_license | Kundan0/UUA | 9ed7f8bdcd2c7d47765a60396339a33c8356db5f | 23cd9627890332cb70bb0a00c2b54508affbe256 | refs/heads/master | 2021-10-21T02:51:37.423877 | 2019-03-02T14:30:12 | 2019-03-02T14:30:12 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 487 | h | #pragma once
#include"pch.h"
#include "Game.h"
class Player :
public GameObject
{
float x, y, z;
int jump;
int yLevel;
Point p;
sf::Clock clock;
float width, height;
sf::Texture texture[4];
sf::Sprite sprite[4];
public:
static int playerNo;
Player();
Player(float Width, float Height);
bool isPlayer() { return true; }
void Update(float dt);
void Reset();
void Reset(int);
void Draw(sf::RenderWindow&);
sf::Vector3f position3d();
sf::Vector3f size();
~Player();
};
| [
"074bct517.kundan@pcampus.edu.np"
] | 074bct517.kundan@pcampus.edu.np |
52ff347c188d47acf8737d64ae35a6aba10c91d2 | 909d9bd33afc42ed4cb89f7525593ad1aacef96c | /Sorting and Searching/DistinctNumbers.cpp | 822d4f823f33cc8d63c906d25507c790ced37ea6 | [] | no_license | Abdus-Samee/CSES-Problemset | 2301770a84856a0527ce2d299bd31b128764f855 | baa357c2e4f9517a860393ea6f2e14e099afcade | refs/heads/master | 2022-12-14T12:50:55.936344 | 2020-09-18T16:09:14 | 2020-09-18T16:09:14 | 291,246,929 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 479 | cpp | //can also do it in O(n) with unordered_set
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
using namespace std;
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0);
ll n, count = 0;
cin >> n;
vector<ll> v(n);
for(ll i = 0; i < n; i++) cin >> v[i];
sort(v.begin(), v.end());
for(ll i = 0; i < n; i++){
while((i<n-1) && (v[i]==v[i+1])) i++;
count++;
}
cout << count;
return 0;
}
| [
"noreply@github.com"
] | Abdus-Samee.noreply@github.com |
179661a94dc8de6a2242ca532421355f58975e5e | 1963de9ddf820f1ca8e8cdc4519f5032e76b5043 | /crm4.cpp | 4bd2741b046560ce780c331ac53de403a8159f60 | [] | no_license | phildeb/qtzenit2 | 59e9371f64abd9c59992b8c4ad4ce10afc22eba1 | 9379f803d27468fab17d2acb6139f0a1e4b4e1c3 | refs/heads/master | 2020-08-04T13:12:49.226199 | 2019-10-01T16:45:56 | 2019-10-01T16:45:56 | 212,148,003 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 38,772 | cpp | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>
#include <time.h>
#include <fcntl.h>
#include <pthread.h>
#include <errno.h>
#include "debug.h"
#include "misc.h"
#include "conf.h"
#include "rude/config.h"
#define CRM4_KEYS_SECTION_NAME "keys"
QMap<int,int> CRM4::m_common_touche_select_device;
QMap<int,int> CRM4::m_common_touche_select_conf;
QMap<int,int> CRM4::m_common_keymap_number;
QMap<int,QString> CRM4::m_common_keymap_action;
QMap<QString,int> CRM4::m_common_key_number_by_action;
void CRM4::init_thread_led() // static function
{
pthread_t thread_id;
int ret = pthread_create(&(thread_id), NULL, CRM4::led_thread, NULL);
if (ret < 0) {
vega_log(INFO,"error pthread_create CRM4_led_thread - cause: %s", strerror(errno));
}
}
void* CRM4::led_thread(void *)
{
sleep(2);
while (1){
foreach(CRM4* d1, qlist_crm4){
if (d1) d1->update_all_leds(); // pdl: parcours le tableau des etats des leds voir si qq chose a change a cause de l evenement !!!
}
sleep(2);
}
}
void CRM4::update_all_leds() // si un element du tableau a change depuis la derniere fois !
{
//vega_log(INFO,"D%d:update %d leds",number,CRM4_MAX_KEYS);
for (int i=0;i<CRM4_MAX_KEYS;i++)
{
if ( tab_green_led[i] != old_tab_green_led[i] )//|| INDEFINI==tab_green_led[i])
{
//vega_log(INFO,"tab_green_led[%d]:%d <= old_tab_green_led[%d]:%d", i, tab_green_led[i] , i, old_tab_green_led[i] );
// on commence par l'eteindre !!!
/*device_set_led(i,LED_COLOR_GREEN, LED_MODE_FIX, 0);
device_set_led(i, LED_COLOR_GREEN, LED_MODE_SLOW_BLINK, 0) ;
device_set_led(i, LED_COLOR_GREEN, LED_MODE_FAST_BLINK, 0) ;*/
if ( old_tab_green_led[i]==FIXE ) device_set_led(i,LED_COLOR_GREEN, LED_MODE_FIX, 0);
if ( old_tab_green_led[i]==CLIGNOTEMENT_RAPIDE ) device_set_led(i,LED_COLOR_GREEN, LED_MODE_FAST_BLINK, 0);
if ( old_tab_green_led[i]==CLIGNOTEMENT_LENT ) device_set_led(i,LED_COLOR_GREEN, LED_MODE_SLOW_BLINK, 0);
if ( tab_green_led[i]==FIXE ) device_set_led(i,LED_COLOR_GREEN, LED_MODE_FIX, 1);
if ( tab_green_led[i]==CLIGNOTEMENT_RAPIDE ) device_set_led(i,LED_COLOR_GREEN, LED_MODE_FAST_BLINK, 1);
if ( tab_green_led[i]==CLIGNOTEMENT_LENT ) device_set_led(i,LED_COLOR_GREEN, LED_MODE_SLOW_BLINK, 1);
old_tab_green_led[i] = tab_green_led[i] ; // economise une remise a jour si la led ne change pas entre 2 update !!!
}
if ( tab_red_led[i] != old_tab_red_led[i] )//|| INDEFINI==tab_red_led[i])
{
//vega_log(INFO,"tab_red_led[%d]:%d <= old_tab_red_led[%d]:%d", i, tab_red_led[i] , i, old_tab_red_led[i] );
/*device_set_led(i,LED_COLOR_RED, LED_MODE_FIX, 0);
device_set_led(i, LED_COLOR_RED, LED_MODE_SLOW_BLINK, 0) ;
device_set_led( i, LED_COLOR_RED, LED_MODE_FAST_BLINK, 0) ;*/
if ( old_tab_red_led[i]==FIXE ) device_set_led(i,LED_COLOR_RED, LED_MODE_FIX, 0);
if ( old_tab_red_led[i]==CLIGNOTEMENT_RAPIDE ) device_set_led(i,LED_COLOR_RED, LED_MODE_FAST_BLINK, 0);
if ( old_tab_red_led[i]==CLIGNOTEMENT_LENT ) device_set_led(i,LED_COLOR_RED, LED_MODE_SLOW_BLINK, 0);
if ( tab_red_led[i]==FIXE ) device_set_led(i,LED_COLOR_RED, LED_MODE_FIX, 1);
if ( tab_red_led[i]==CLIGNOTEMENT_RAPIDE ) device_set_led(i,LED_COLOR_RED, LED_MODE_FAST_BLINK, 1);
if ( tab_red_led[i]==CLIGNOTEMENT_LENT ) device_set_led(i,LED_COLOR_RED, LED_MODE_SLOW_BLINK, 1);
old_tab_red_led[i] = tab_red_led[i];// economise une remise a jour si la led ne change pas entre 2 update !!!
}
}
}
// RED
// pdl: maintenant ,on met juste le nouvel etat de la led dans un tableau
int CRM4::device_set_blink_fast_red_color(int button) {
//device_set_led(button, LED_COLOR_RED, LED_MODE_FAST_BLINK, 1);
//vega_log(INFO, "device_set_blink_fast_red_color=%d\n",button);
if ( button< CRM4_MAX_KEYS ) tab_red_led[button] = CLIGNOTEMENT_RAPIDE;
return 0;
}
int CRM4::device_set_blink_slow_red_color(int button) {
//device_set_led(button, LED_COLOR_RED, LED_MODE_SLOW_BLINK, 1);
//vega_log(INFO, "device_set_blink_slow_red_color=%d\n",button);
if ( button< CRM4_MAX_KEYS ) tab_red_led[button] = CLIGNOTEMENT_LENT;
return 0;
}
int CRM4::device_set_color_red(int button) {
//device_set_led(button, LED_COLOR_RED, LED_MODE_FIX, 1);
//vega_log(INFO, "device_set_color_red=%d\n",button);
if ( button< CRM4_MAX_KEYS ) tab_red_led[button] = FIXE;
return 0;
}
int CRM4::device_set_no_red_color(int button)
{
//vega_log(INFO, "device_set_no_red_color=%d\n",button);
if ( button< CRM4_MAX_KEYS ) tab_red_led[button] = ETEINTE;
// todo : memoriser le dernier mode afin de n'envoyer qu'une seule commande !!!
//device_set_led(button, LED_COLOR_RED, LED_MODE_SLOW_BLINK, 0) ;
//device_set_led( button, LED_COLOR_RED, LED_MODE_FAST_BLINK, 0) ;
//device_set_led(button, LED_COLOR_RED, LED_MODE_FIX, 0);
return 0;
}
// GREEN
int CRM4::device_set_blink_fast_green_color(int button) {
//device_set_led(button, LED_COLOR_GREEN, LED_MODE_FAST_BLINK, 1);
//vega_log(INFO, "device_set_blink_fast_green_color=%d\n",button);
if ( button< CRM4_MAX_KEYS ) tab_green_led[button] = CLIGNOTEMENT_RAPIDE;
return 0;
}
int CRM4::device_set_blink_slow_green_color(int button) {
//device_set_led(button, LED_COLOR_GREEN, LED_MODE_SLOW_BLINK, 1);
//vega_log(INFO, "device_set_blink_slow_green_color=%d\n",button);
if ( button< CRM4_MAX_KEYS ) tab_green_led[button] = CLIGNOTEMENT_LENT;
return 0;
}
int CRM4::device_set_color_green(int button) {
//device_set_led( button, LED_COLOR_GREEN, LED_MODE_FIX, 1);
//vega_log(INFO, "device_set_color_green=%d\n",button);
if ( button< CRM4_MAX_KEYS ) tab_green_led[button] = FIXE;
return 0;
}
int CRM4::device_set_no_green_color(int button)
{
//vega_log(INFO, "device_set_no_green_color=%d\n",button);
if ( button< CRM4_MAX_KEYS ) tab_green_led[button] = ETEINTE;
//device_set_led(button, LED_COLOR_GREEN, LED_MODE_SLOW_BLINK, 0);
//device_set_led( button, LED_COLOR_GREEN, LED_MODE_FAST_BLINK, 0);
//device_set_led(button, LED_COLOR_GREEN, LED_MODE_FIX, 0);
return 0;
}
/*[D11]
number = 11
type = crm4
gain = 0
name = D11
[D25]
number = 25
type = radio
full_duplex = 0
contact_sec = 0
name = D25*/
void CRM4::load_crm4_device_section(const char* fname)
{
rude::Config config;
if (config.load(fname) == false) {
printf("rude cannot load %s file", fname);
return ;
}
int dnumber=0;
for ( dnumber=1;dnumber<=46;dnumber++)
{
QString strdevsection = QString("D%1").arg(dnumber);
if ( true == config.setSection(qPrintable(strdevsection),false) )
{
//int key_number = i;char *elt2 = strdup(config.getStringValue("gain")); // ce qu'il y a apres le "="
int gain = atoi(config.getStringValue("gain"));
int full_duplex = atoi(config.getStringValue("full_duplex"));
int audio_detection = atoi(config.getStringValue("contact_sec"));
if ( strlen( config.getStringValue("name") ) > 0 ) {
strdevsection = config.getStringValue("name") ;
}
CRM4 *d = NULL;//(CRM4*)device_t::by_number(dnumber);
Radio *r = NULL;
if ( dnumber >=1 && dnumber <= 24 ) {
d = CRM4::create(dnumber,qPrintable(strdevsection),gain);
}else{
r = Radio::create(dnumber,qPrintable(strdevsection),gain);
}
printf("D%d: config.getStringValue(keys)=%s\n",dnumber, config.getStringValue("keys"));
if ( d ) {
if ( strlen( config.getStringValue("keys") ) > 0 )
{
char temp[1024];
strncpy(temp,config.getStringValue("keys"),sizeof(temp));
d->init_groups_keys( temp );
// GESTION DES touches de GROUPES propre a chaque CRM4
}
}
switch(dnumber)
{
// CRM4 stations
case 1:
if (d) d->init( 1, 0, 0, 20, 0, 0);
break;
case 2:
if (d) d->init( 1, 0, 1, 20, 0, 1);
break;
case 3:
if (d) d->init( 1, 0, 2, 20, 0, 2);
break;
case 4:
if (d) d->init( 1, 0, 3, 20, 0, 3);
break;
case 5:
if (d) d->init( 1, 0, 4, 20, 0, 4);
break;
case 6:
if (d) d->init( 1, 0, 5, 20, 0, 5);
break;
case 7:
if (d) d->init( 2, 0, 0, 20, 0, 6);
break;
case 8:
if (d) d->init( 2, 0, 1, 20, 0, 7);
break;
case 9:
if (d) d->init( 2, 0, 2, 20, 1, 0);
break;
case 10:
if (d) d->init( 2, 0, 3, 20, 1, 1);
break;
case 11:
if (d) d->init( 2, 0, 4, 20, 1, 2);
break;
// RADIOS
case 25:
if (r) r->init_radio( full_duplex, 22, 0, 0, audio_detection);
break;
case 26:
if (r) r->init_radio( full_duplex, 22, 0, 2,audio_detection);
break;
case 27:
if (r) r->init_radio( full_duplex, 22, 0, 4,audio_detection);
break;
case 28:
if (r) r->init_radio( full_duplex, 22, 0, 6,audio_detection);
break;
case 29:
if (r) r->init_radio( full_duplex, 22, 1, 0,audio_detection);
break;
case 30:
if (r) r->init_radio( full_duplex, 22, 1, 2,audio_detection);
break;
case 31:
if (r) r->init_radio( full_duplex, 22, 1, 4,audio_detection);
break;
case 32:
if (r) r->init_radio( full_duplex, 22, 1, 6,audio_detection);
break;
case 33:
if (r) r->init_radio( full_duplex, 23, 0, 0,audio_detection);
break;
case 34:
if (r) r->init_radio( full_duplex, 23, 0, 2,audio_detection);
break;
case 35:
if (r) r->init_radio( full_duplex, 23, 0, 4,audio_detection);
break;
// JUPITERS
case 36:
if (r) r->init_jupiter( 23, 0, 6, audio_detection);
break;
case 41:
if (r) r->init_jupiter( 23, 1, 0, audio_detection);
break;
case 42:
if (r) r->init_jupiter( 23, 1, 2, audio_detection);
break;
case 43:
if (r) r->init_jupiter( 23, 1, 4, audio_detection);
break;
case 44:
if (r) r->init_jupiter( 23, 1, 6, audio_detection);
break;
case 45:
if (r) r->init_jupiter( 24, 0, 0, audio_detection);
break;
case 46:
if (r) r->init_jupiter( 24, 0, 2, audio_detection);
break;
}
}
}
}
void CRM4::check_modif_crm4_device_section(const char* fname)
{
printf("check_modif_crm4_device_section %s \n",fname);
rude::Config config;
if (config.load(fname) == false) {
printf("rude cannot load %s file", fname);
return ;
}
int dnumber=0;
for ( dnumber=1;dnumber<=46;dnumber++)
{
CRM4 *d = dynamic_cast<CRM4*>(device_t::by_number(dnumber));
QString strdevsection = QString("D%1").arg(dnumber);
if ( true == config.setSection(qPrintable(strdevsection),false) )
{
//int key_number = i;char *elt2 = strdup(config.getStringValue("gain")); // ce qu'il y a apres le "="
int gain = atoi(config.getStringValue("gain"));
int full_duplex = atoi(config.getStringValue("full_duplex"));
int audio_detection = atoi(config.getStringValue("contact_sec"));
if ( strlen( config.getStringValue("name") ) > 0 ) {
printf("device changed name to %s\n",config.getStringValue("name"));
//vega_log(INFO, "device changed name %s -> %s\n",d->name, config.getStringValue("name"));
if ( dnumber >=1 && dnumber <= 24 )
{
if ( d ) {
strncpy(d->name, config.getStringValue("name"),sizeof(d->name) );
//d->device_line_printf(1,"D%d:%s********",d->number,d->name);
EVENT evt;
evt.device_number = d->number;
evt.code = EVT_DEVICE_UPDATE_DISPLAY;
BroadcastEvent(&evt);
}
}
}
if ( dnumber >=1 && dnumber <= 24 && gain >=-12 && gain <=14) {
if ( d ) {
printf("device changed gain %d -> %d\n",d->gain, gain);
vega_log(INFO, "D%d changed gain %d -> %d\n",dnumber, d->gain, gain);
d->gain = gain; // todo : check gain entre -12 et 14
d->device_change_gain(d->gain);
printf("D%d: config.getStringValue(gain)=%s\n",dnumber, config.getStringValue("gain"));
}
}
}
}
}
/*[keys]
1=action_activate_conf
2=action_on_off_conf
4=action_exclude_include_conf
5=action_select_conf,1
6=action_select_conf,2
7=action_select_conf,3
8=action_select_conf,4
9=action_select_conf,5
10=action_select_conf,6
11=action_select_conf,7
12=action_select_conf,8
13=action_select_conf,9
14=action_select_conf,10
15=action_select_device,25
16=action_select_device,26
17=action_select_device,27
18=action_select_device,28
19=action_select_device,29
20=action_select_device,1
21=action_select_device,2
22=action_select_device,3
23=action_select_device,4
24=action_select_device,5
25=action_select_device,6
26=action_select_device,7
27=action_select_device,8
28=action_select_device,9
29=action_select_device,10
30=action_select_device,11
32=action_select_device,41
33=action_select_device,42
34=action_select_device,43
35=action_select_device,44
36=action_select_device,45
38=action_general_call
*/
void CRM4::load_crm4_keys_section(const char* fname)
{
rude::Config config;
if (config.load(fname) == false) {
printf("rude cannot load %s file", fname);
return ;
}
int nb_keys=0;
for (int i = 1; i <= 38; i++)
{
//config.setSection(qPrintable(config.getSectionNameAt(i));
if ( true == config.setSection(CRM4_KEYS_SECTION_NAME,false) ) {
QString str = QString("%1").arg(i);
int key_number = i;
char *elt2 = strdup(config.getStringValue(qPrintable(str))); // ce qu'il y a apres le "="
nb_keys++;
vega_log(INFO, "nb_keys:%d key_number=%d elt2=%s\n",nb_keys, key_number, elt2);
printf("nb_keys:%d key_number=%d elt2=%s\n",nb_keys, key_number, elt2);
m_common_key_number_by_action[elt2] = key_number; // m_common_key_number_by_action["action_activate_conf"]=1
if (strstr(elt2, "action_activate_conf"))
{
m_common_keymap_action[key_number]=elt2;
m_common_keymap_number[key_number]=key_number;
//device_keys_configuration->device_key_configuration[nb_keys].type = ACTION_ACTIVATE_CONFERENCE ;
//device_keys_configuration->device_key_configuration[nb_keys].key_number = key_number;
nb_keys ++;
}
else if (strstr(elt2, "action_on_off_conf")) {
m_common_keymap_action[key_number]=elt2;
m_common_keymap_number[key_number]=key_number;
//device_keys_configuration->device_key_configuration[nb_keys].type = ACTION_ON_OFF_CONF;
//device_keys_configuration->device_key_configuration[nb_keys].key_number = key_number;
nb_keys ++;
}
else if (strstr(elt2, "action_exclude_include_conf"))
{
m_common_keymap_action[key_number]=elt2;
m_common_keymap_number[key_number]=key_number;
//device_keys_configuration->device_key_configuration[nb_keys].type = ACTION_INCLUDE_EXCLUDE;
//device_keys_configuration->device_key_configuration[nb_keys].key_number = key_number;
nb_keys ++;
}
else if (strstr(elt2, "action_select_conf"))
{/*
5=action_select_conf,1
6=action_select_conf,2
7=action_select_conf,3
8=action_select_conf,4
9=action_select_conf,5
10=action_select_conf,6
11=action_select_conf,7
12=action_select_conf,8
13=action_select_conf,9
14=action_select_conf,10*/
vega_log(INFO, "action_select_conf %d %d", nb_keys, key_number );
//device_keys_configuration->device_key_configuration[nb_keys].type = ACTION_SELECT_CONF;
//device_keys_configuration->device_key_configuration[nb_keys].key_number = key_number;
char *e1;
char *e2;
e1 = strtok(elt2, ",");
e2 = strtok(NULL, ",");
//device_keys_configuration->device_key_configuration[nb_keys].action.select_conf.conference_number = atoi(e2);
m_common_keymap_action[key_number]=elt2;
m_common_keymap_number[key_number]=atoi(e2);;
m_common_touche_select_conf[atoi(e2)] = key_number;
nb_keys ++;
}
else if(strstr(elt2, "action_select_device"))
{
/*15=action_select_device,25
16=action_select_device,26
17=action_select_device,27
18=action_select_device,28
19=action_select_device,29
20=action_select_device,1
21=action_select_device,2
22=action_select_device,3
23=action_select_device,4
24=action_select_device,5
25=action_select_device,6
26=action_select_device,7
27=action_select_device,8
28=action_select_device,9
29=action_select_device,10
30=action_select_device,11
32=action_select_device,41
33=action_select_device,42
34=action_select_device,43
35=action_select_device,44
36=action_select_device,45 */
//device_keys_configuration->device_key_configuration[nb_keys].type = ACTION_SELECT_DEVICE;
//device_keys_configuration->device_key_configuration[nb_keys].key_number = key_number;
char *e1;
char *e2;
e1 = strtok(elt2, ",");
e2 = strtok(NULL, ",");
//device_keys_configuration->device_key_configuration[nb_keys].action.select_device.device_number = atoi(e2);
m_common_keymap_action[key_number]=elt2; // m_common_keymap_action[20]="action_select_device"
m_common_keymap_number[key_number]=atoi(e2); // m_common_keymap_number[20]=1
m_common_touche_select_device[atoi(e2)] = key_number;
nb_keys ++;
}
// pdl 20090927 les appels de groupe sont dynamiques et charges depuis le fichier devices.conf
/*else if(strstr(elt2, "action_group_call")) {
device_keys_configuration->device_key_configuration[nb_keys].type = ACTION_GROUP_CALL;
device_keys_configuration->device_key_configuration[nb_keys].key_number = key_number;
char *e1;
char *e2;
e1 = strtok(elt2, ",");
e2 = strtok(NULL, ",");
device_keys_configuration->device_key_configuration[nb_keys].action.group_call.group_number = atoi(e2);
nb_keys ++;
}*/
else if(strstr(elt2, "action_general_call"))
{
//device_keys_configuration->device_key_configuration[nb_keys].type = ACTION_GENERAL_CALL;
//device_keys_configuration->device_key_configuration[nb_keys].key_number = key_number;
m_common_keymap_action[key_number]=elt2;
m_common_keymap_number[key_number]=key_number;
nb_keys ++;
}
}
}
//exit(-1);
}
void CRM4::load_crm4_keys_configuration(const char* fname)
{
//device_keys_configuration_t* device_keys_configuration = &the_unic_static_device_keys_configuration;
char line[128]={0};
int i;
int nb_keys = 0;
FILE *fp = fopen(fname, "r");
if (fp == NULL) {
vega_log(ERROR, "cannot open file %s - cause : %s", fname, strerror(errno));
return;
}
/* read a line */
int f = 0;
while (1)
{
bzero(line, sizeof(line));
for (i = 0; ; i++) {
if (fread(line + i, 1, 1, fp) != 1)
{
f = 1;
break;
}
if (line[i] == '\n')
break;
}
if (line[i] == '\n')
line[i] = '\0';
if (!strcmp(line, ""))
break;
if (line[0] == ';')
continue;
char *elt1;
char *elt2;
if ((elt1 = strtok(line, "=")) == NULL) {
vega_log(ERROR, "cannot process line %s", line);
}
//vega_log(ERROR, "processing line %s", line);
int key_number = atoi(elt1);
if ((elt2 = strtok(NULL, "=")) == NULL) {
vega_log(ERROR, "cannont process line %s", line);
continue;
}
vega_log(INFO, "nb_keys:%d key_number=%d elt2=%s\n",nb_keys, key_number, elt2);
m_common_key_number_by_action[elt2] = key_number; // m_common_key_number_by_action["action_activate_conf"]=1
//38=action_general_call m_common_key_number_by_action["action_general_call"]=38
if (strstr(elt2, "action_activate_conf"))
{
m_common_keymap_action[key_number]=elt2;
m_common_keymap_number[key_number]=key_number;
//device_keys_configuration->device_key_configuration[nb_keys].type = ACTION_ACTIVATE_CONFERENCE ;
//device_keys_configuration->device_key_configuration[nb_keys].key_number = key_number;
nb_keys ++;
}
else if (strstr(elt2, "action_on_off_conf")) {
m_common_keymap_action[key_number]=elt2;
m_common_keymap_number[key_number]=key_number;
//device_keys_configuration->device_key_configuration[nb_keys].type = ACTION_ON_OFF_CONF;
//device_keys_configuration->device_key_configuration[nb_keys].key_number = key_number;
nb_keys ++;
}
else if (strstr(elt2, "action_exclude_include_conf"))
{
m_common_keymap_action[key_number]=elt2;
m_common_keymap_number[key_number]=key_number;
//device_keys_configuration->device_key_configuration[nb_keys].type = ACTION_INCLUDE_EXCLUDE;
//device_keys_configuration->device_key_configuration[nb_keys].key_number = key_number;
nb_keys ++;
}
else if (strstr(elt2, "action_select_conf"))
{/*
5=action_select_conf,1
6=action_select_conf,2
7=action_select_conf,3
8=action_select_conf,4
9=action_select_conf,5
10=action_select_conf,6
11=action_select_conf,7
12=action_select_conf,8
13=action_select_conf,9
14=action_select_conf,10*/
vega_log(INFO, "action_select_conf %d %d", nb_keys, key_number );
//device_keys_configuration->device_key_configuration[nb_keys].type = ACTION_SELECT_CONF;
//device_keys_configuration->device_key_configuration[nb_keys].key_number = key_number;
char *e1;
char *e2;
e1 = strtok(elt2, ",");
e2 = strtok(NULL, ",");
//device_keys_configuration->device_key_configuration[nb_keys].action.select_conf.conference_number = atoi(e2);
m_common_keymap_action[key_number]=elt2;
m_common_keymap_number[key_number]=atoi(e2);;
m_common_touche_select_conf[atoi(e2)] = key_number;
nb_keys ++;
}
else if(strstr(elt2, "action_select_device"))
{
/*15=action_select_device,25
16=action_select_device,26
17=action_select_device,27
18=action_select_device,28
19=action_select_device,29
20=action_select_device,1
21=action_select_device,2
22=action_select_device,3
23=action_select_device,4
24=action_select_device,5
25=action_select_device,6
26=action_select_device,7
27=action_select_device,8
28=action_select_device,9
29=action_select_device,10
30=action_select_device,11
32=action_select_device,41
33=action_select_device,42
34=action_select_device,43
35=action_select_device,44
36=action_select_device,45 */
//device_keys_configuration->device_key_configuration[nb_keys].type = ACTION_SELECT_DEVICE;
//device_keys_configuration->device_key_configuration[nb_keys].key_number = key_number;
char *e1;
char *e2;
e1 = strtok(elt2, ",");
e2 = strtok(NULL, ",");
//device_keys_configuration->device_key_configuration[nb_keys].action.select_device.device_number = atoi(e2);
m_common_keymap_action[key_number]=elt2; // m_common_keymap_action[20]="action_select_device"
m_common_keymap_number[key_number]=atoi(e2); // m_common_keymap_number[20]=1
m_common_touche_select_device[atoi(e2)] = key_number;
nb_keys ++;
}
// pdl 20090927 les appels de groupe sont dynamiques et charges depuis le fichier devices.conf
/*else if(strstr(elt2, "action_group_call")) {
device_keys_configuration->device_key_configuration[nb_keys].type = ACTION_GROUP_CALL;
device_keys_configuration->device_key_configuration[nb_keys].key_number = key_number;
char *e1;
char *e2;
e1 = strtok(elt2, ",");
e2 = strtok(NULL, ",");
device_keys_configuration->device_key_configuration[nb_keys].action.group_call.group_number = atoi(e2);
nb_keys ++;
}*/
else if(strstr(elt2, "action_general_call"))
{
//device_keys_configuration->device_key_configuration[nb_keys].type = ACTION_GENERAL_CALL;
//device_keys_configuration->device_key_configuration[nb_keys].key_number = key_number;
m_common_keymap_action[key_number]=elt2;
m_common_keymap_number[key_number]=key_number;
nb_keys ++;
}
if (f)
break;
}/*while*/
vega_log(INFO,"load_crm4_keys_configuration: nb_keys=%d\n",nb_keys);
}
int CRM4::all_devices_display_general_call_led(int busy /* if a director is doing a general call*/)
{
foreach(CRM4* d,qlist_crm4) {
if ( d) d->display_general_call_led(busy);
}
return 0;
}
int CRM4::display_general_call_led(int busy /* if a director is doing a general call*/)
{
//int key = 0;//get_key_number_by_action_type(device.crm4.keys_configuration, ACTION_GENERAL_CALL, 0 );
if ( m_common_key_number_by_action.contains( "action_general_call" ) )
{
int key=m_common_key_number_by_action["action_general_call"];
device_set_color_green( key);
if ( busy )
device_set_color_red( key);
else
device_set_no_red_color( key);
}
/*
QMap<int,QString>::const_iterator i = CRM4::m_common_keymap_action.constBegin();
while ( i != CRM4::m_common_keymap_action.constEnd() ) {
if ( i.value() == "action_general_call" ) {
int no_touche = i.key();
device_set_color_green( key);
if ( busy )
device_set_color_red( key);
else
device_set_no_red_color( key);
}
i++;
}*/
//vega_log(INFO,"set led ACTION_GENERAL_CALL key %d on D%d...\n", key , d->number);
return 0;
}
int CRM4::all_devices_display_group_key(int allume) // static
{ // STATIC
vega_log(INFO,"all_devices_display_group_key G%d <= %d..\n", doing_group_call);
//unsigned int i=0;for (i = 0; i < g_list_length(devices) ; i++)
foreach(CRM4* d,qlist_crm4)
{
QMap<int, int>::const_iterator i = d->keymap_groups.constBegin();
while (i != d->keymap_groups.constEnd())
{
//printf("D%d has_group_key G%d in KEY %d ( doing_group_call=G%d )\n", d->number, i.value() , i.key(),doing_group_call);
d->device_set_color_green( i.key());
if ( doing_group_call == i.value() )
{
if (allume)
d->device_set_blink_fast_red_color(i.key());
else
d->device_set_no_red_color( i.key());
}
++i;
}
}
return 0;
}
int CRM4::device_MAJ_groups_led(int doing_group_cal)
{
CRM4* d = this;
vega_log(INFO, "----------------------------------->DISPLAY G%d LED on D%d",doing_group_cal, number);
QMap<int, int>::const_iterator i = keymap_groups.constBegin();
while (i != keymap_groups.constEnd())
{
//cout << i.key() << ": " << i.value() << endl;
{
printf("D%d has_group_key G%d in KEY %d\n", d->number, i.value() , i.key());
d->device_set_color_green( i.key());
if ( i.value() == doing_group_cal )
//if ( working )
//d->device_set_color_red( key);
d->device_set_blink_fast_red_color(i.key());
else
d->device_set_no_red_color( i.key());
}
++i;
}
//QMap<int /*crm4key*/,int /*numero_group*/> keymap_groups; // dynamic keys different for each CRM4
/*foreach( int key, this->keymap_groups ) {
//int key = get_key_number_by_action_type(d->device.crm4.keys_configuration, ACTION_GROUP_CALL, NG );
//vega_log(INFO,"set led ACTION_GROUP_CALL keys_group[%d]=%d on D%d...\n", NG, key , number);
if ( key > 0 ) {
device_set_color_green( key);
if ( grpnum == grpnum )
device_set_color_red( key);
else
device_set_no_red_color( key);
}
}*/
/*
unsigned int NG;
for ( NG=0; NG< MAX_GROUPS; NG++)
{
//int key = device.crm4.keys_group[NG];
if ( keymap_groups.contains(NG) )
{ // Returns true if the map contains an item with key key; otherwise returns false.
int key = keymap_groups[NG] ;//= num_touche;
//int key = get_key_number_by_action_type(d->device.crm4.keys_configuration, ACTION_GROUP_CALL, NG );
//vega_log(INFO,"set led ACTION_GROUP_CALL keys_group[%d]=%d on D%d...\n", NG, key , number);
if ( key > 0 ) {
device_set_color_green( key);
if ( grpnum == NG )
device_set_color_red( key);
else
device_set_no_red_color( key);
}
}
}*/
return 0;
}
void CRM4::all_devices_set_green_led_possible_conferences()
{
foreach(CRM4* d,qlist_crm4)
{
if ( d ) d->set_green_led_possible_conferences();
}
}
void CRM4::set_green_led_possible_conferences()
{
//vega_log(INFO, "UPDATE CONFERENCE LEDS in D%d (active in %d conferences)", number, nb_active_conf_where_device_is_active() );
//printf("UPDATE CONFERENCE LEDS in D%d (active in %d conferences)", number, nb_active_conf_where_device_is_active() );
unsigned int k;
foreach(vega_conference_t *C,vega_conference_t::qlist){
if ( C ) set_led_conference(C); // pdl 20090911
}
}
int CRM4::device_MAJ_particpant_key(device_t* d1, int hide_participant, participant_st etat)
{
if ( d1 ){
int keyD = 0;//get_key_number_by_action_type(device.crm4.keys_configuration, ACTION_SELECT_DEVICE, d1->number);
/*QMap<int,QString>::const_iterator i = CRM4::m_common_keymap_action.constBegin();
while ( i != CRM4::m_common_keymap_action.constEnd() ) {
if ( i.value() == "action_select_device" ) {
keyD = i.key();
}
i++;
}*/
//m_common_touche_select_conf[NoDevice] = touche
if ( m_common_touche_select_device.contains(d1->number ) )
{
keyD = m_common_touche_select_device[d1->number] ;
//vega_log(INFO, "D%d: particpant_key of D%d (key %d)", number, d1->number, keyD);
}else{
//vega_log(INFO, "D%d: NO particpant_key for D%d (key %d)", number, d1->number, keyD);
}
if (keyD > 0)
{
// STOP blinking red led even if not speaking in conf
//device_set_no_red_color(keyD);
if ( m_is_plugged )
{
if ( hide_participant ){ // hide particpants of this conference ( used when swicthing from on conf to another )
vega_log(INFO, "HIDE participants D%d in D%d",d1->number, number );
device_set_no_red_color( keyD);
device_set_no_green_color( keyD);
}
else
{
if ( NOT_PARTICIPANT==etat)//C->get_state_in_conference(d1) )
{
device_set_no_green_color( keyD);
device_set_no_red_color( keyD);
}
else if ( PARTICIPANT_ACTIVE==etat)//C->get_state_in_conference(d1) )
{
if ( d1->b_speaking ) {
device_set_color_green( keyD);
//device_set_( keyD);
device_set_blink_fast_red_color(keyD);
}else{
device_set_color_green( keyD);
device_set_no_red_color( keyD);
}
}else{ // EXCLUDED participant
device_set_no_green_color( keyD);
device_set_color_red(keyD);
}
}
}else{
device_set_no_red_color(keyD);
device_set_no_green_color(keyD);
}
}
}
}
/* update conferences led ( and show/hide participants led ) on mydevice CRM4 */
int CRM4::device_MAJ(vega_conference_t *C, int update_conferences_led,int update_participants_led, int hide_participants)
{
if ( update_participants_led && C ){
device_MAJ_participants_led(C,hide_participants);
}
if ( update_conferences_led ) {
set_green_led_possible_conferences();
}
}
int CRM4::device_MAJ_participants_led( vega_conference_t *C, int hide_participant)
{
unsigned int j=0;
if (!C) return -1;
/*unsigned int devnum =0;
for ( devnum=15; devnum<=37; devnum++)
{
int keyD = get_key_number_by_action_type(device.crm4.keys_configuration, ACTION_SELECT_DEVICE, devnum);
//vega_log(INFO, "participants[%d] is device %d (key %d)", j, d1->number, keyD);
if (keyD > 0){
{ // hide particpants of this conference ( used when swicthing from on conf to another )
device_set_no_red_color( keyD);
device_set_no_green_color( keyD);
}
}
}*/
if ( C->active || hide_participant)
{ // mise a jour des participants : soit conference active, soit effacement complet !
if ( C->participant_director.device )
device_MAJ_particpant_key(C->participant_director.device,hide_participant,C->get_state_in_conference(C->participant_director.device));
if ( C->participant_radio1.device )
device_MAJ_particpant_key(C->participant_radio1.device,hide_participant,C->get_state_in_conference(C->participant_radio1.device));
if ( C->participant_radio2.device )
device_MAJ_particpant_key(C->participant_radio2.device,hide_participant,C->get_state_in_conference(C->participant_radio2.device));
if ( C->participant_jupiter.device )
device_MAJ_particpant_key(C->participant_jupiter.device,hide_participant,C->get_state_in_conference(C->participant_jupiter.device));
for (j = 0; j < C->nb_particpants; j++) {
if ( C->participants[j].device )
this->device_MAJ_particpant_key(C->participants[j].device,hide_participant,C->get_state_in_conference( C->participants[j].device ));
}
}else{
vega_log(INFO, "D%d: no need to device_MAJ_participants_led when C%d not active!!!",number,C->number);
}
return 0;
}
#define MAX_LEN_CRM4_LINE 18
int CRM4::device_line_printf(int line, const char* fmt, ...)
{
//if ( line == 1 ) return 0;
//if ( line == 4 ) return 0;
if ( line >= 5 ) return 0;
if ( line <= 0 ) return 0;
if ( fmt==NULL || line <= 0 || line > 4 ) return -1;
char temp[1024]={0};
//char str[128]={0};
va_list args;
va_start(args, fmt);
int nb = vsnprintf(temp, sizeof(temp) , fmt, args);
//int nb = vsprintf(temp, fmt, args);
va_end (args);
temp[MAX_LEN_CRM4_LINE]=0; // force end of line
device_display_msg( line, temp);
return 0;
}
int CRM4::device_line_print_time_now(int line)
{
struct timeval tv;
struct tm* ptm;
char str[32];
gettimeofday (&tv, NULL);
ptm = localtime (&tv.tv_sec);
strftime (str, sizeof(str)-1, "%d/%m %H:%M:%S ......", ptm);
device_line_printf(line,str);
}
int CRM4::device_display_conferences_state()
{
CRM4* d = this;
d->device_MAJ(NULL,1,0,0);
return 0;
}
int CRM4::set_green_led_of_conf(vega_conference_t *conf,int on)
{
//if ( conf->is_in(this) )
if ( m_common_touche_select_conf.contains( conf->number ) )
{
vega_log(INFO, "set in D%d the GREEN led of C%d: %d", number, conf->number,on);
int keyC = m_common_touche_select_conf[conf->number];//get_key_number_by_action_type(this->device.crm4.keys_configuration, ACTION_SELECT_CONF, conf->number);
if ( on ) this->device_set_color_green(keyC); else device_set_no_green_color(keyC);
/*QMap<int,QString>::const_iterator i = CRM4::m_common_keymap_action.constBegin();
while ( i != CRM4::m_common_keymap_action.constEnd() ) {
if ( i.value() == "action_select_conf" ) {
int no_touche = i.key();
if ( m_common_keymap_number[no_touche] == conf->number ) {
if ( on ) this->device_set_color_green(keyC);
else device_set_no_green_color(keyC);
}
}
i++;
}*/
}
return 0;
}
int CRM4::set_red_led_of_conf(vega_conference_t *conf,int on)
{
if ( m_common_touche_select_conf.contains( conf->number ) )
{
vega_log(INFO, "set in D%d the RED led of C%d: %d", number, conf->number,on);
int keyC = m_common_touche_select_conf[conf->number];//get_key_number_by_action_type(this->device.crm4.keys_configuration, ACTION_SELECT_CONF, conf->number);
if ( on ) this->device_set_color_red(keyC); else device_set_no_red_color(keyC);
/*QMap<int,QString>::const_iterator i = CRM4::m_common_keymap_action.constBegin();
while ( i != CRM4::m_common_keymap_action.constEnd() ) {
if ( i.value() == "action_select_conf" ) {
int no_touche = i.key();
if ( m_common_keymap_number[no_touche] == conf->number ) {
if ( on ) this->device_set_color_red(keyC);
else device_set_no_red_color(keyC);
}
}
i++;
}*/
}
return 0;
}
int CRM4::all_devices_display_led_of_device_speaking_in_conf(vega_conference_t *conf, device_t * d) // STATIC
{
if ( NULL==d || NULL==conf) return -1;
vega_log(INFO, "display EVERYWHERE D%d speaking in C%d(current==%d)", d->number, conf->number, d->current_conference);
/* diffuse ,pour chaque device dans la conference qui est en train de parler, l'etat de tous les postes crm4 de la conference qui sont dedans */
foreach(CRM4* d1,qlist_crm4)
{
d1->set_led_conference(conf);
if ( d1 && d1->current_conference==conf->number ) {//d1->set_led_conference(conf); // pdl20090624
d1->device_MAJ_particpant_key(d,0,conf->get_state_in_conference(d)); // probleme when MICRO released just before being excluded by director!
}
}
return 0;
}
int CRM4::all_devices_display_led_of_device_NOT_speaking_in_conf(vega_conference_t *conf, device_t * d)
{
if ( NULL==d || NULL==conf) return -1;
vega_log(INFO, "display EVERYWHERE D%d NOT speaking in C%d", d->number, conf->number);
foreach(CRM4* d1,qlist_crm4)
{
d1->set_led_conference(conf);
if (d1->current_conference==conf->number )
{
vega_log(INFO, "display on D%d led of D%d NOT speaking in C%d", d1->number, d->number, conf->number);
d1->device_MAJ_particpant_key(d,0,conf->get_state_in_conference(d)); // probleme when MICRO released just before being excluded by director!
}
}
return 0;
}
void CRM4::set_led_conference(vega_conference_t* C)
{
unsigned int k;
if(C)
{
if ( m_common_touche_select_conf.contains(C->number) )
{
int key = m_common_touche_select_conf[C->number];//0;//get_key_number_by_action_type( device.crm4.keys_configuration, ACTION_SELECT_CONF, C->number);
vega_log(INFO, "OK:UPDATE key%d C%d LED in D%d (%d speaking)", key, C->number, number, C->nb_people_speaking() );
// RAZ in case of slow blink for director reinclusion !
//device_set_no_green_color( key);
//device_set_no_red_color( key);
switch ( C->get_state_in_conference(this) )
{
case NOT_PARTICIPANT:
//vega_log(INFO, "UPDATE CONFERENCE LEDS D%d NOT_PARTICIPANT in C%d",number,C->number);
//device_set_no_green_color( key);
//device_set_no_red_color( key);
device_set_no_green_color( key);
device_set_no_red_color( key);
break;
case PARTICIPANT_ACTIVE:
vega_log(INFO, "UPDATE CONFERENCE LEDS D%d PARTICIPANT_ACTIVE in C%d",number,C->number);
if ( C->active ) {
if ( C->nb_people_speaking() > 0 ) {
//device_set_no_red_color(key);
device_set_blink_fast_red_color( key);
}else {
//device_set_no_red_color(key); // trick to stop the blink!!!
device_set_color_red( key);
}
}else{
device_set_no_red_color( key);
}
//device_set_no_green_color( key);
device_set_color_green( key);
break;
case PARTICIPANT_SELF_EXCLUDED:
vega_log(INFO, "UPDATE CONFERENCE LEDS D%d PARTICIPANT_SELF_EXCLUDED in C%d",number,C->number);
if ( C->active ) {
if ( C->nb_people_speaking() > 0 ){
//device_set_no_red_color(key);
device_set_blink_fast_red_color( key);
}else {
//device_set_no_red_color(key);// trick to stop the blink!!!
device_set_color_red( key);
}
device_set_color_green( key);
}else {
device_set_no_red_color( key);
}
device_set_no_green_color( key);
break;
case PARTICIPANT_DTOR_EXCLUDED:
vega_log(INFO, "UPDATE CONFERENCE LEDS D%d PARTICIPANT_DTOR_EXCLUDED in C%d",number,C->number);
if ( C->active ) {
if ( C->nb_people_speaking() > 0 ){
//device_set_no_red_color(key);
device_set_blink_fast_red_color( key);
}else {
//device_set_no_red_color(key);// trick to stop the blink!!!
device_set_color_red( key);
}
device_set_color_green( key);
}else {
device_set_no_red_color( key);
}
device_set_no_green_color( key);
break;
}
}else{
vega_log(INFO, "NOK:UPDATE C%d LED in D%d (%d speaking)", C->number, number, C->nb_people_speaking() );
}
}
}
| [
"phd@debreuil.fr"
] | phd@debreuil.fr |
cf40a0ea43dff0aa457e64aecf2309df31bb25a6 | 7c4cf781d58dbbba073cf94e7b057dcd1dc294fb | /codes/c/visual_c_plus/MFC/FlowSwitch/FlowSwitch/FlowSwitch.cpp | cb30be0c8ecb9bd7c68892a7069116925dd7f290 | [] | no_license | DoveMX/james_works | 8d17986878d0e9d796d660bcca57188efbd1f0da | 9635f0b23b02e93c42ab603aca0f9f1280f179bb | refs/heads/master | 2020-04-05T10:55:42.447587 | 2019-03-21T23:13:20 | 2019-03-21T23:13:20 | 156,816,208 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 5,099 | cpp | // FlowSwitch.cpp : 定义应用程序的入口点。
//
#include "stdafx.h"
#include "FlowSwitch.h"
// 引用工程文件
#include "CConfig.h"
#define MAX_LOADSTRING 100
// 全局变量:
HINSTANCE hInst; // 当前实例
WCHAR szTitle[MAX_LOADSTRING]; // 标题栏文本
WCHAR szWindowClass[MAX_LOADSTRING]; // 主窗口类名
// 此代码模块中包含的函数的前向声明:
ATOM MyRegisterClass(HINSTANCE hInstance);
BOOL InitInstance(HINSTANCE, int);
LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
INT_PTR CALLBACK About(HWND, UINT, WPARAM, LPARAM);
int APIENTRY wWinMain(_In_ HINSTANCE hInstance,
_In_opt_ HINSTANCE hPrevInstance,
_In_ LPWSTR lpCmdLine,
_In_ int nCmdShow)
{
UNREFERENCED_PARAMETER(hPrevInstance);
UNREFERENCED_PARAMETER(lpCmdLine);
// TODO: 在此处放置代码。
// 读取CConfig
CConfig *cfg = new CConfig();
// TODO: 在此处放置代码
// 初始化全局字符串
LoadStringW(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING);
LoadStringW(hInstance, IDC_FLOWSWITCH, szWindowClass, MAX_LOADSTRING);
MyRegisterClass(hInstance);
// 执行应用程序初始化:
if (!InitInstance (hInstance, nCmdShow))
{
delete cfg;
return FALSE;
}
HACCEL hAccelTable = LoadAccelerators(hInstance, MAKEINTRESOURCE(IDC_FLOWSWITCH));
MSG msg;
// 主消息循环:
while (GetMessage(&msg, nullptr, 0, 0))
{
if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
delete cfg;
return (int) msg.wParam;
}
//
// 函数: MyRegisterClass()
//
// 目标: 注册窗口类。
//
ATOM MyRegisterClass(HINSTANCE hInstance)
{
WNDCLASSEXW wcex;
wcex.cbSize = sizeof(WNDCLASSEX);
wcex.style = CS_HREDRAW | CS_VREDRAW;
wcex.lpfnWndProc = WndProc;
wcex.cbClsExtra = 0;
wcex.cbWndExtra = 0;
wcex.hInstance = hInstance;
wcex.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_FLOWSWITCH));
wcex.hCursor = LoadCursor(nullptr, IDC_ARROW);
wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
wcex.lpszMenuName = MAKEINTRESOURCEW(IDC_FLOWSWITCH);
wcex.lpszClassName = szWindowClass;
wcex.hIconSm = LoadIcon(wcex.hInstance, MAKEINTRESOURCE(IDI_SMALL));
return RegisterClassExW(&wcex);
}
//
// 函数: InitInstance(HINSTANCE, int)
//
// 目标: 保存实例句柄并创建主窗口
//
// 注释:
//
// 在此函数中,我们在全局变量中保存实例句柄并
// 创建和显示主程序窗口。
//
BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
{
hInst = hInstance; // 将实例句柄存储在全局变量中
HWND hWnd = CreateWindowW(szWindowClass, szTitle, WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, nullptr, nullptr, hInstance, nullptr);
if (!hWnd)
{
return FALSE;
}
ShowWindow(hWnd, nCmdShow);
UpdateWindow(hWnd);
return TRUE;
}
//
// 函数: WndProc(HWND, UINT, WPARAM, LPARAM)
//
// 目标: 处理主窗口的消息。
//
// WM_COMMAND - 处理应用程序菜单
// WM_PAINT - 绘制主窗口
// WM_DESTROY - 发送退出消息并返回
//
//
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message)
{
case WM_COMMAND:
{
int wmId = LOWORD(wParam);
// 分析菜单选择:
switch (wmId)
{
case IDM_ABOUT:
DialogBox(hInst, MAKEINTRESOURCE(IDD_ABOUTBOX), hWnd, About);
break;
case IDM_EXIT:
DestroyWindow(hWnd);
break;
default:
return DefWindowProc(hWnd, message, wParam, lParam);
}
}
break;
case WM_PAINT:
{
PAINTSTRUCT ps;
HDC hdc = BeginPaint(hWnd, &ps);
// TODO: 在此处添加使用 hdc 的任何绘图代码...
HBRUSH hbrush = ::CreateSolidBrush(RGB(0, 0, 255));
::SelectObject(hdc, hbrush);
::Ellipse(hdc, ps.rcPaint.left, ps.rcPaint.top, ps.rcPaint.right, ps.rcPaint.bottom);
::DeleteObject(hbrush);
EndPaint(hWnd, &ps);
}
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
default:
return DefWindowProc(hWnd, message, wParam, lParam);
}
return 0;
}
// “关于”框的消息处理程序。
INT_PTR CALLBACK About(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
UNREFERENCED_PARAMETER(lParam);
switch (message)
{
case WM_INITDIALOG:
return (INT_PTR)TRUE;
case WM_COMMAND:
if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL)
{
EndDialog(hDlg, LOWORD(wParam));
return (INT_PTR)TRUE;
}
break;
}
return (INT_PTR)FALSE;
}
| [
"Jane@gmagon.com"
] | Jane@gmagon.com |
0529f73efe3e278582cda29c969523799aa84893 | cfad0bf70426c15566d317f26a7423242325bba4 | /libco/co_hook_sys_call.cpp | dd2399e447b4bcdec176cf8c8060ce6272dbb645 | [] | no_license | bjut-hz/code-notes | 25bc6f8fe0a65f77a85f5c6c5f24399fcdafb46c | 50a8b4f58136f0771a5210ca1b7a6dff33f2f54e | refs/heads/master | 2020-05-05T13:08:40.413979 | 2019-12-24T08:49:00 | 2019-12-24T08:49:00 | 158,189,650 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 24,754 | cpp | /*
* Tencent is pleased to support the open source community by making Libco
available.
* Copyright (C) 2014 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.
*/
#include <sys/socket.h>
#include <sys/syscall.h>
#include <sys/time.h>
#include <sys/un.h>
#include <dlfcn.h>
#include <fcntl.h>
#include <poll.h>
#include <unistd.h>
#include <errno.h>
#include <netinet/in.h>
#include <time.h>
#include <pthread.h>
#include <stdarg.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <netdb.h>
#include <resolv.h>
#include <time.h>
#include <map>
#include "co_routine.h"
#include "co_routine_inner.h"
#include "co_routine_specific.h"
typedef long long ll64_t;
struct rpchook_t {
int user_flag;
struct sockaddr_in dest; // maybe sockaddr_un;
int domain; // AF_LOCAL , AF_INET
struct timeval read_timeout;
struct timeval write_timeout;
};
static inline pid_t GetPid() {
char **p = (char **)pthread_self();
return p ? *(pid_t *)(p + 18) : getpid();
}
static rpchook_t *g_rpchook_socket_fd[102400] = {0};
typedef int (*socket_pfn_t)(int domain, int type, int protocol);
typedef int (*connect_pfn_t)(int socket, const struct sockaddr *address,
socklen_t address_len);
typedef int (*close_pfn_t)(int fd);
typedef ssize_t (*read_pfn_t)(int fildes, void *buf, size_t nbyte);
typedef ssize_t (*write_pfn_t)(int fildes, const void *buf, size_t nbyte);
typedef ssize_t (*sendto_pfn_t)(int socket, const void *message, size_t length,
int flags, const struct sockaddr *dest_addr,
socklen_t dest_len);
typedef ssize_t (*recvfrom_pfn_t)(int socket, void *buffer, size_t length,
int flags, struct sockaddr *address,
socklen_t *address_len);
typedef size_t (*send_pfn_t)(int socket, const void *buffer, size_t length,
int flags);
typedef ssize_t (*recv_pfn_t)(int socket, void *buffer, size_t length,
int flags);
typedef int (*poll_pfn_t)(struct pollfd fds[], nfds_t nfds, int timeout);
typedef int (*setsockopt_pfn_t)(int socket, int level, int option_name,
const void *option_value, socklen_t option_len);
typedef int (*fcntl_pfn_t)(int fildes, int cmd, ...);
typedef struct tm *(*localtime_r_pfn_t)(const time_t *timep, struct tm *result);
typedef void *(*pthread_getspecific_pfn_t)(pthread_key_t key);
typedef int (*pthread_setspecific_pfn_t)(pthread_key_t key, const void *value);
typedef int (*setenv_pfn_t)(const char *name, const char *value, int overwrite);
typedef int (*unsetenv_pfn_t)(const char *name);
typedef char *(*getenv_pfn_t)(const char *name);
typedef hostent *(*gethostbyname_pfn_t)(const char *name);
typedef res_state (*__res_state_pfn_t)();
typedef int (*__poll_pfn_t)(struct pollfd fds[], nfds_t nfds, int timeout);
static socket_pfn_t g_sys_socket_func =
(socket_pfn_t)dlsym(RTLD_NEXT, "socket");
static connect_pfn_t g_sys_connect_func =
(connect_pfn_t)dlsym(RTLD_NEXT, "connect");
static close_pfn_t g_sys_close_func = (close_pfn_t)dlsym(RTLD_NEXT, "close");
static read_pfn_t g_sys_read_func = (read_pfn_t)dlsym(RTLD_NEXT, "read");
static write_pfn_t g_sys_write_func = (write_pfn_t)dlsym(RTLD_NEXT, "write");
static sendto_pfn_t g_sys_sendto_func =
(sendto_pfn_t)dlsym(RTLD_NEXT, "sendto");
static recvfrom_pfn_t g_sys_recvfrom_func =
(recvfrom_pfn_t)dlsym(RTLD_NEXT, "recvfrom");
static send_pfn_t g_sys_send_func = (send_pfn_t)dlsym(RTLD_NEXT, "send");
static recv_pfn_t g_sys_recv_func = (recv_pfn_t)dlsym(RTLD_NEXT, "recv");
static poll_pfn_t g_sys_poll_func = (poll_pfn_t)dlsym(RTLD_NEXT, "poll");
static setsockopt_pfn_t g_sys_setsockopt_func =
(setsockopt_pfn_t)dlsym(RTLD_NEXT, "setsockopt");
static fcntl_pfn_t g_sys_fcntl_func = (fcntl_pfn_t)dlsym(RTLD_NEXT, "fcntl");
static setenv_pfn_t g_sys_setenv_func =
(setenv_pfn_t)dlsym(RTLD_NEXT, "setenv");
static unsetenv_pfn_t g_sys_unsetenv_func =
(unsetenv_pfn_t)dlsym(RTLD_NEXT, "unsetenv");
static getenv_pfn_t g_sys_getenv_func =
(getenv_pfn_t)dlsym(RTLD_NEXT, "getenv");
static __res_state_pfn_t g_sys___res_state_func =
(__res_state_pfn_t)dlsym(RTLD_NEXT, "__res_state");
static gethostbyname_pfn_t g_sys_gethostbyname_func =
(gethostbyname_pfn_t)dlsym(RTLD_NEXT, "gethostbyname");
static __poll_pfn_t g_sys___poll_func =
(__poll_pfn_t)dlsym(RTLD_NEXT, "__poll");
/*
static pthread_getspecific_pfn_t g_sys_pthread_getspecific_func
=
(pthread_getspecific_pfn_t)dlsym(RTLD_NEXT,"pthread_getspecific");
static pthread_setspecific_pfn_t g_sys_pthread_setspecific_func
=
(pthread_setspecific_pfn_t)dlsym(RTLD_NEXT,"pthread_setspecific");
static pthread_rwlock_rdlock_pfn_t g_sys_pthread_rwlock_rdlock_func
=
(pthread_rwlock_rdlock_pfn_t)dlsym(RTLD_NEXT,"pthread_rwlock_rdlock");
static pthread_rwlock_wrlock_pfn_t g_sys_pthread_rwlock_wrlock_func
=
(pthread_rwlock_wrlock_pfn_t)dlsym(RTLD_NEXT,"pthread_rwlock_wrlock");
static pthread_rwlock_unlock_pfn_t g_sys_pthread_rwlock_unlock_func
=
(pthread_rwlock_unlock_pfn_t)dlsym(RTLD_NEXT,"pthread_rwlock_unlock");
*/
static inline unsigned long long get_tick_count() {
uint32_t lo, hi;
__asm__ __volatile__("rdtscp" : "=a"(lo), "=d"(hi));
return ((unsigned long long)lo) | (((unsigned long long)hi) << 32);
}
struct rpchook_connagent_head_t {
unsigned char bVersion;
struct in_addr iIP;
unsigned short hPort;
unsigned int iBodyLen;
unsigned int iOssAttrID;
unsigned char bIsRespNotExist;
unsigned char sReserved[6];
} __attribute__((packed));
#define HOOK_SYS_FUNC(name) \
if (!g_sys_##name##_func) { \
g_sys_##name##_func = (name##_pfn_t)dlsym(RTLD_NEXT, #name); \
}
static inline ll64_t diff_ms(struct timeval &begin, struct timeval &end) {
ll64_t u = (end.tv_sec - begin.tv_sec);
u *= 1000 * 10;
u += (end.tv_usec - begin.tv_usec) / (100);
return u;
}
static inline rpchook_t *get_by_fd(int fd) {
if (fd > -1 && fd < (int)sizeof(g_rpchook_socket_fd) /
(int)sizeof(g_rpchook_socket_fd[0])) {
return g_rpchook_socket_fd[fd];
}
return NULL;
}
static inline rpchook_t *alloc_by_fd(int fd) {
if (fd > -1 && fd < (int)sizeof(g_rpchook_socket_fd) /
(int)sizeof(g_rpchook_socket_fd[0])) {
rpchook_t *lp = (rpchook_t *)calloc(1, sizeof(rpchook_t));
lp->read_timeout.tv_sec = 1;
lp->write_timeout.tv_sec = 1;
g_rpchook_socket_fd[fd] = lp;
return lp;
}
return NULL;
}
static inline void free_by_fd(int fd) {
if (fd > -1 && fd < (int)sizeof(g_rpchook_socket_fd) /
(int)sizeof(g_rpchook_socket_fd[0])) {
rpchook_t *lp = g_rpchook_socket_fd[fd];
if (lp) {
g_rpchook_socket_fd[fd] = NULL;
free(lp);
}
}
return;
}
int socket(int domain, int type, int protocol) {
HOOK_SYS_FUNC(socket);
if (!co_is_enable_sys_hook()) {
return g_sys_socket_func(domain, type, protocol);
}
int fd = g_sys_socket_func(domain, type, protocol);
if (fd < 0) {
return fd;
}
rpchook_t *lp = alloc_by_fd(fd);
lp->domain = domain;
fcntl(fd, F_SETFL, g_sys_fcntl_func(fd, F_GETFL, 0));
return fd;
}
int co_accept(int fd, struct sockaddr *addr, socklen_t *len) {
int cli = accept(fd, addr, len);
if (cli < 0) {
return cli;
}
alloc_by_fd(cli);
return cli;
}
int connect(int fd, const struct sockaddr *address, socklen_t address_len) {
HOOK_SYS_FUNC(connect);
if (!co_is_enable_sys_hook()) {
return g_sys_connect_func(fd, address, address_len);
}
// 1.sys call
int ret = g_sys_connect_func(fd, address, address_len);
rpchook_t *lp = get_by_fd(fd);
if (!lp) return ret;
if (sizeof(lp->dest) >= address_len) {
memcpy(&(lp->dest), address, (int)address_len);
}
if (O_NONBLOCK & lp->user_flag) {
return ret;
}
if (!(ret < 0 && errno == EINPROGRESS)) {
return ret;
}
// 2.wait
int pollret = 0;
struct pollfd pf = {0};
for (int i = 0; i < 3; i++) // 25s * 3 = 75s
{
memset(&pf, 0, sizeof(pf));
pf.fd = fd;
pf.events = (POLLOUT | POLLERR | POLLHUP);
pollret = poll(&pf, 1, 25000);
if (1 == pollret) {
break;
}
}
if (pf.revents & POLLOUT) // connect succ
{
// 3.check getsockopt ret
int err = 0;
socklen_t errlen = sizeof(err);
ret = getsockopt(fd, SOL_SOCKET, SO_ERROR, &err, &errlen);
if (ret < 0) {
return ret;
} else if (err != 0) {
errno = err;
return -1;
}
errno = 0;
return 0;
}
errno = ETIMEDOUT;
return ret;
}
int close(int fd) {
HOOK_SYS_FUNC(close);
if (!co_is_enable_sys_hook()) {
return g_sys_close_func(fd);
}
free_by_fd(fd);
int ret = g_sys_close_func(fd);
return ret;
}
ssize_t read(int fd, void *buf, size_t nbyte) {
HOOK_SYS_FUNC(read);
if (!co_is_enable_sys_hook()) {
return g_sys_read_func(fd, buf, nbyte);
}
rpchook_t *lp = get_by_fd(fd);
if (!lp || (O_NONBLOCK & lp->user_flag)) {
ssize_t ret = g_sys_read_func(fd, buf, nbyte);
return ret;
}
int timeout =
(lp->read_timeout.tv_sec * 1000) + (lp->read_timeout.tv_usec / 1000);
struct pollfd pf = {0};
pf.fd = fd;
pf.events = (POLLIN | POLLERR | POLLHUP);
int pollret = poll(&pf, 1, timeout);
ssize_t readret = g_sys_read_func(fd, (char *)buf, nbyte);
if (readret < 0) {
co_log_err("CO_ERR: read fd %d ret %ld errno %d poll ret %d timeout %d", fd,
readret, errno, pollret, timeout);
}
return readret;
}
ssize_t write(int fd, const void *buf, size_t nbyte) {
HOOK_SYS_FUNC(write);
if (!co_is_enable_sys_hook()) {
return g_sys_write_func(fd, buf, nbyte);
}
rpchook_t *lp = get_by_fd(fd);
if (!lp || (O_NONBLOCK & lp->user_flag)) {
ssize_t ret = g_sys_write_func(fd, buf, nbyte);
return ret;
}
size_t wrotelen = 0;
int timeout =
(lp->write_timeout.tv_sec * 1000) + (lp->write_timeout.tv_usec / 1000);
ssize_t writeret =
g_sys_write_func(fd, (const char *)buf + wrotelen, nbyte - wrotelen);
if (writeret == 0) {
return writeret;
}
if (writeret > 0) {
wrotelen += writeret;
}
while (wrotelen < nbyte) {
struct pollfd pf = {0};
pf.fd = fd;
pf.events = (POLLOUT | POLLERR | POLLHUP);
poll(&pf, 1, timeout);
writeret =
g_sys_write_func(fd, (const char *)buf + wrotelen, nbyte - wrotelen);
if (writeret <= 0) {
break;
}
wrotelen += writeret;
}
if (writeret <= 0 && wrotelen == 0) {
return writeret;
}
return wrotelen;
}
ssize_t sendto(int socket, const void *message, size_t length, int flags,
const struct sockaddr *dest_addr, socklen_t dest_len) {
/*
1.no enable sys call ? sys
2.( !lp || lp is non block ) ? sys
3.try
4.wait
5.try
*/
HOOK_SYS_FUNC(sendto);
if (!co_is_enable_sys_hook()) {
return g_sys_sendto_func(socket, message, length, flags, dest_addr,
dest_len);
}
rpchook_t *lp = get_by_fd(socket);
if (!lp || (O_NONBLOCK & lp->user_flag)) {
return g_sys_sendto_func(socket, message, length, flags, dest_addr,
dest_len);
}
ssize_t ret =
g_sys_sendto_func(socket, message, length, flags, dest_addr, dest_len);
if (ret < 0 && EAGAIN == errno) {
int timeout =
(lp->write_timeout.tv_sec * 1000) + (lp->write_timeout.tv_usec / 1000);
struct pollfd pf = {0};
pf.fd = socket;
pf.events = (POLLOUT | POLLERR | POLLHUP);
poll(&pf, 1, timeout);
ret =
g_sys_sendto_func(socket, message, length, flags, dest_addr, dest_len);
}
return ret;
}
ssize_t recvfrom(int socket, void *buffer, size_t length, int flags,
struct sockaddr *address, socklen_t *address_len) {
HOOK_SYS_FUNC(recvfrom);
if (!co_is_enable_sys_hook()) {
return g_sys_recvfrom_func(socket, buffer, length, flags, address,
address_len);
}
rpchook_t *lp = get_by_fd(socket);
if (!lp || (O_NONBLOCK & lp->user_flag)) {
return g_sys_recvfrom_func(socket, buffer, length, flags, address,
address_len);
}
int timeout =
(lp->read_timeout.tv_sec * 1000) + (lp->read_timeout.tv_usec / 1000);
struct pollfd pf = {0};
pf.fd = socket;
pf.events = (POLLIN | POLLERR | POLLHUP);
poll(&pf, 1, timeout);
ssize_t ret =
g_sys_recvfrom_func(socket, buffer, length, flags, address, address_len);
return ret;
}
ssize_t send(int socket, const void *buffer, size_t length, int flags) {
HOOK_SYS_FUNC(send);
if (!co_is_enable_sys_hook()) {
return g_sys_send_func(socket, buffer, length, flags);
}
rpchook_t *lp = get_by_fd(socket);
if (!lp || (O_NONBLOCK & lp->user_flag)) {
return g_sys_send_func(socket, buffer, length, flags);
}
size_t wrotelen = 0;
int timeout =
(lp->write_timeout.tv_sec * 1000) + (lp->write_timeout.tv_usec / 1000);
ssize_t writeret = g_sys_send_func(socket, buffer, length, flags);
if (writeret == 0) {
return writeret;
}
if (writeret > 0) {
wrotelen += writeret;
}
while (wrotelen < length) {
struct pollfd pf = {0};
pf.fd = socket;
pf.events = (POLLOUT | POLLERR | POLLHUP);
poll(&pf, 1, timeout);
writeret = g_sys_send_func(socket, (const char *)buffer + wrotelen,
length - wrotelen, flags);
if (writeret <= 0) {
break;
}
wrotelen += writeret;
}
if (writeret <= 0 && wrotelen == 0) {
return writeret;
}
return wrotelen;
}
ssize_t recv(int socket, void *buffer, size_t length, int flags) {
HOOK_SYS_FUNC(recv);
if (!co_is_enable_sys_hook()) {
return g_sys_recv_func(socket, buffer, length, flags);
}
rpchook_t *lp = get_by_fd(socket);
if (!lp || (O_NONBLOCK & lp->user_flag)) {
return g_sys_recv_func(socket, buffer, length, flags);
}
int timeout =
(lp->read_timeout.tv_sec * 1000) + (lp->read_timeout.tv_usec / 1000);
struct pollfd pf = {0};
pf.fd = socket;
pf.events = (POLLIN | POLLERR | POLLHUP);
int pollret = poll(&pf, 1, timeout);
ssize_t readret = g_sys_recv_func(socket, buffer, length, flags);
if (readret < 0) {
co_log_err("CO_ERR: read fd %d ret %ld errno %d poll ret %d timeout %d",
socket, readret, errno, pollret, timeout);
}
return readret;
}
extern int co_poll_inner(stCoEpoll_t *ctx, struct pollfd fds[], nfds_t nfds,
int timeout, poll_pfn_t pollfunc);
int poll(struct pollfd fds[], nfds_t nfds, int timeout) {
HOOK_SYS_FUNC(poll);
if (!co_is_enable_sys_hook() || timeout == 0) {
return g_sys_poll_func(fds, nfds, timeout);
}
pollfd *fds_merge = NULL;
nfds_t nfds_merge = 0;
std::map<int, int> m; // fd --> idx
std::map<int, int>::iterator it;
if (nfds > 1) {
fds_merge = (pollfd *)malloc(sizeof(pollfd) * nfds);
for (size_t i = 0; i < nfds; i++) {
if ((it = m.find(fds[i].fd)) == m.end()) {
fds_merge[nfds_merge] = fds[i];
m[fds[i].fd] = nfds_merge;
nfds_merge++;
} else {
int j = it->second;
fds_merge[j].events |= fds[i].events; // merge in j slot
}
}
}
int ret = 0;
if (nfds_merge == nfds || nfds == 1) {
ret = co_poll_inner(co_get_epoll_ct(), fds, nfds, timeout, g_sys_poll_func);
} else {
ret = co_poll_inner(co_get_epoll_ct(), fds_merge, nfds_merge, timeout,
g_sys_poll_func);
if (ret > 0) {
for (size_t i = 0; i < nfds; i++) {
it = m.find(fds[i].fd);
if (it != m.end()) {
int j = it->second;
fds[i].revents = fds_merge[j].revents & fds[i].events;
}
}
}
}
free(fds_merge);
return ret;
}
int setsockopt(int fd, int level, int option_name, const void *option_value,
socklen_t option_len) {
HOOK_SYS_FUNC(setsockopt);
if (!co_is_enable_sys_hook()) {
return g_sys_setsockopt_func(fd, level, option_name, option_value,
option_len);
}
rpchook_t *lp = get_by_fd(fd);
if (lp && SOL_SOCKET == level) {
struct timeval *val = (struct timeval *)option_value;
if (SO_RCVTIMEO == option_name) {
memcpy(&lp->read_timeout, val, sizeof(*val));
} else if (SO_SNDTIMEO == option_name) {
memcpy(&lp->write_timeout, val, sizeof(*val));
}
}
return g_sys_setsockopt_func(fd, level, option_name, option_value,
option_len);
}
int fcntl(int fildes, int cmd, ...) {
HOOK_SYS_FUNC(fcntl);
if (fildes < 0) {
return __LINE__;
}
va_list arg_list;
va_start(arg_list, cmd);
int ret = -1;
rpchook_t *lp = get_by_fd(fildes);
switch (cmd) {
case F_DUPFD: {
int param = va_arg(arg_list, int);
ret = g_sys_fcntl_func(fildes, cmd, param);
break;
}
case F_GETFD: {
ret = g_sys_fcntl_func(fildes, cmd);
if (lp && !(lp->user_flag & O_NONBLOCK)) {
ret = ret & (~O_NONBLOCK);
}
break;
}
case F_SETFD: {
int param = va_arg(arg_list, int);
ret = g_sys_fcntl_func(fildes, cmd, param);
break;
}
case F_GETFL: {
ret = g_sys_fcntl_func(fildes, cmd);
break;
}
case F_SETFL: {
int param = va_arg(arg_list, int);
int flag = param;
if (co_is_enable_sys_hook() && lp) {
flag |= O_NONBLOCK;
}
ret = g_sys_fcntl_func(fildes, cmd, flag);
if (0 == ret && lp) {
lp->user_flag = param;
}
break;
}
case F_GETOWN: {
ret = g_sys_fcntl_func(fildes, cmd);
break;
}
case F_SETOWN: {
int param = va_arg(arg_list, int);
ret = g_sys_fcntl_func(fildes, cmd, param);
break;
}
case F_GETLK: {
struct flock *param = va_arg(arg_list, struct flock *);
ret = g_sys_fcntl_func(fildes, cmd, param);
break;
}
case F_SETLK: {
struct flock *param = va_arg(arg_list, struct flock *);
ret = g_sys_fcntl_func(fildes, cmd, param);
break;
}
case F_SETLKW: {
struct flock *param = va_arg(arg_list, struct flock *);
ret = g_sys_fcntl_func(fildes, cmd, param);
break;
}
}
va_end(arg_list);
return ret;
}
struct stCoSysEnv_t {
char *name;
char *value;
};
struct stCoSysEnvArr_t {
stCoSysEnv_t *data;
size_t cnt;
};
static stCoSysEnvArr_t *dup_co_sysenv_arr(stCoSysEnvArr_t *arr) {
stCoSysEnvArr_t *lp = (stCoSysEnvArr_t *)calloc(sizeof(stCoSysEnvArr_t), 1);
if (arr->cnt) {
lp->data = (stCoSysEnv_t *)calloc(sizeof(stCoSysEnv_t) * arr->cnt, 1);
lp->cnt = arr->cnt;
memcpy(lp->data, arr->data, sizeof(stCoSysEnv_t) * arr->cnt);
}
return lp;
}
static int co_sysenv_comp(const void *a, const void *b) {
return strcmp(((stCoSysEnv_t *)a)->name, ((stCoSysEnv_t *)b)->name);
}
static stCoSysEnvArr_t g_co_sysenv = {0};
void co_set_env_list(const char *name[], size_t cnt) {
if (g_co_sysenv.data) {
return;
}
g_co_sysenv.data = (stCoSysEnv_t *)calloc(1, sizeof(stCoSysEnv_t) * cnt);
for (size_t i = 0; i < cnt; i++) {
if (name[i] && name[i][0]) {
g_co_sysenv.data[g_co_sysenv.cnt++].name = strdup(name[i]);
}
}
if (g_co_sysenv.cnt > 1) {
qsort(g_co_sysenv.data, g_co_sysenv.cnt, sizeof(stCoSysEnv_t),
co_sysenv_comp);
stCoSysEnv_t *lp = g_co_sysenv.data;
stCoSysEnv_t *lq = g_co_sysenv.data + 1;
for (size_t i = 1; i < g_co_sysenv.cnt; i++) {
if (strcmp(lp->name, lq->name)) {
++lp;
if (lq != lp) {
*lp = *lq;
}
}
++lq;
}
g_co_sysenv.cnt = lp - g_co_sysenv.data + 1;
}
}
int setenv(const char *n, const char *value, int overwrite) {
HOOK_SYS_FUNC(setenv)
if (co_is_enable_sys_hook() && g_co_sysenv.data) {
stCoRoutine_t *self = co_self();
if (self) {
if (!self->pvEnv) {
self->pvEnv = dup_co_sysenv_arr(&g_co_sysenv);
}
stCoSysEnvArr_t *arr = (stCoSysEnvArr_t *)(self->pvEnv);
stCoSysEnv_t name = {(char *)n, 0};
stCoSysEnv_t *e = (stCoSysEnv_t *)bsearch(&name, arr->data, arr->cnt,
sizeof(name), co_sysenv_comp);
if (e) {
if (overwrite || !e->value) {
if (e->value) free(e->value);
e->value = (value ? strdup(value) : 0);
}
return 0;
}
}
}
return g_sys_setenv_func(n, value, overwrite);
}
int unsetenv(const char *n) {
HOOK_SYS_FUNC(unsetenv)
if (co_is_enable_sys_hook() && g_co_sysenv.data) {
stCoRoutine_t *self = co_self();
if (self) {
if (!self->pvEnv) {
self->pvEnv = dup_co_sysenv_arr(&g_co_sysenv);
}
stCoSysEnvArr_t *arr = (stCoSysEnvArr_t *)(self->pvEnv);
stCoSysEnv_t name = {(char *)n, 0};
stCoSysEnv_t *e = (stCoSysEnv_t *)bsearch(&name, arr->data, arr->cnt,
sizeof(name), co_sysenv_comp);
if (e) {
if (e->value) {
free(e->value);
e->value = 0;
}
return 0;
}
}
}
return g_sys_unsetenv_func(n);
}
char *getenv(const char *n) {
HOOK_SYS_FUNC(getenv)
if (co_is_enable_sys_hook() && g_co_sysenv.data) {
stCoRoutine_t *self = co_self();
stCoSysEnv_t name = {(char *)n, 0};
if (!self->pvEnv) {
self->pvEnv = dup_co_sysenv_arr(&g_co_sysenv);
}
stCoSysEnvArr_t *arr = (stCoSysEnvArr_t *)(self->pvEnv);
stCoSysEnv_t *e = (stCoSysEnv_t *)bsearch(&name, arr->data, arr->cnt,
sizeof(name), co_sysenv_comp);
if (e) {
return e->value;
}
}
return g_sys_getenv_func(n);
}
struct hostent *co_gethostbyname(const char *name);
struct hostent *gethostbyname(const char *name) {
HOOK_SYS_FUNC(gethostbyname);
#if defined(__APPLE__) || defined(__FreeBSD__)
return g_sys_gethostbyname_func(name);
#else
if (!co_is_enable_sys_hook()) {
return g_sys_gethostbyname_func(name);
}
return co_gethostbyname(name);
#endif
}
struct res_state_wrap {
struct __res_state state;
};
CO_ROUTINE_SPECIFIC(res_state_wrap, __co_state_wrap);
extern "C" {
res_state __res_state() {
HOOK_SYS_FUNC(__res_state);
if (!co_is_enable_sys_hook()) {
return g_sys___res_state_func();
}
return &(__co_state_wrap->state);
}
int __poll(struct pollfd fds[], nfds_t nfds, int timeout) {
return poll(fds, nfds, timeout);
}
}
struct hostbuf_wrap {
struct hostent host;
char *buffer;
size_t iBufferSize;
int host_errno;
};
CO_ROUTINE_SPECIFIC(hostbuf_wrap, __co_hostbuf_wrap);
#if !defined(__APPLE__) && !defined(__FreeBSD__)
struct hostent *co_gethostbyname(const char *name) {
if (!name) {
return NULL;
}
if (__co_hostbuf_wrap->buffer && __co_hostbuf_wrap->iBufferSize > 1024) {
free(__co_hostbuf_wrap->buffer);
__co_hostbuf_wrap->buffer = NULL;
}
if (!__co_hostbuf_wrap->buffer) {
__co_hostbuf_wrap->buffer = (char *)malloc(1024);
__co_hostbuf_wrap->iBufferSize = 1024;
}
struct hostent *host = &__co_hostbuf_wrap->host;
struct hostent *result = NULL;
int *h_errnop = &(__co_hostbuf_wrap->host_errno);
int ret = -1;
while (ret = gethostbyname_r(name, host, __co_hostbuf_wrap->buffer,
__co_hostbuf_wrap->iBufferSize, &result,
h_errnop) == ERANGE &&
*h_errnop == NETDB_INTERNAL) {
free(__co_hostbuf_wrap->buffer);
__co_hostbuf_wrap->iBufferSize = __co_hostbuf_wrap->iBufferSize * 2;
__co_hostbuf_wrap->buffer = (char *)malloc(__co_hostbuf_wrap->iBufferSize);
}
if (ret == 0 && (host == result)) {
return host;
}
return NULL;
}
#endif
void co_enable_hook_sys() //这函数必须在这里,否则本文件会被忽略!!!
{
stCoRoutine_t *co = GetCurrThreadCo();
if (co) {
co->cEnableSysHook = 1;
}
}
| [
"936432896@qq.com"
] | 936432896@qq.com |
66a3f5cfbdfb6b168eee4be4dfdca8d4c2aacda0 | 9b104545333c86ff6bde962a6f47d691dcdd38ca | /LiczbyPierwsze.cpp | 48057275e2b3f3c5398e655bdb452b0a13736fbb | [] | no_license | KrzysztofTab/Cpp | 5413c832a0d2db96ba9275e31f4a2af132609381 | 52636c1071ff164ea164cf9d8a72f073a41e9476 | refs/heads/master | 2023-01-01T13:36:08.553538 | 2020-10-10T16:58:23 | 2020-10-10T16:58:23 | 297,703,765 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 580 | cpp | #include <iostream>
using namespace std;
int a,x=0;
float m[10000];
int main()
{
cin>>a;
for (int i=2; i<a; i++)
{
m[i-2]=a%i; //pakuje do szufladek reszty z dzielenia
}
for (int i=0; i<a-2;i++)
{
if (m[i]==0) //sprawdzam czy ktores dzielenie odbylo sie bez reszty
x=x+1; //jesli tak to zwiekszam "x" o 1
}
if (x>0) //jesli x>0 to znaczy ze dla liczby "a" istnial jakis dzielnik rozny od niej samej
cout<<"NIE";
else
cout<<"TAK";
return 0;
}
| [
"61905322+KrzysztofTab@users.noreply.github.com"
] | 61905322+KrzysztofTab@users.noreply.github.com |
23eb12c268f65b72118eeab0b03ff6e621b94c71 | 31865a003fa6401beec870ba7a5abb8adf3f83ff | /Libs/SurgeryNavigation/stkIGTLToMRMLPosition.cpp | 0ad0b522a49f8bd2c0e8b9909058bcbba2153f2a | [
"BSD-3-Clause"
] | permissive | zpphigh/STK | fafe7060c0f046ccd0a1ff4fd45112fa69fde03d | 97b94fbd761f82a68a5b709f0fdfb01f56f7b479 | refs/heads/master | 2021-01-18T16:17:21.008691 | 2013-11-05T17:37:41 | 2013-11-05T17:37:41 | null | 0 | 0 | null | null | null | null | GB18030 | C++ | false | false | 10,191 | cpp | // OpenIGTLinkIF MRML includes
#include "stkIGTLToMRMLPosition.h"
// OpenIGTLink includes
#include <igtlPositionMessage.h>
#include <igtlWin32Header.h>
#include <igtlMath.h>
// MRML includes
#include <vtkMRMLLinearTransformNode.h>
#include <vtkMRMLModelNode.h>
#include <vtkMRMLDisplayNode.h>
#include <vtkMRMLModelDisplayNode.h>
//#include "vtkMRMLProbeNode.h"
// VTK includes
#include <vtkIntArray.h>
#include <vtkMatrix4x4.h>
#include <vtkObjectFactory.h>
#include <vtkAppendPolyData.h>
#include <vtkCylinderSource.h>
#include <vtkSphereSource.h>
#include <vtkTransform.h>
#include <vtkTransformPolyDataFilter.h>
#include <vtkSTLReader.h>
// VTKSYS includes
#include <vtksys/SystemTools.hxx>
//---------------------------------------------------------------------------
vtkStandardNewMacro(stkIGTLToMRMLPosition);
vtkCxxRevisionMacro(stkIGTLToMRMLPosition, "$Revision: 15552 $");
//---------------------------------------------------------------------------
stkIGTLToMRMLPosition::stkIGTLToMRMLPosition()
{
}
//---------------------------------------------------------------------------
stkIGTLToMRMLPosition::~stkIGTLToMRMLPosition()
{
}
//---------------------------------------------------------------------------
void stkIGTLToMRMLPosition::PrintSelf(ostream& os, vtkIndent indent)
{
this->vtkObject::PrintSelf(os, indent);
}
//---------------------------------------------------------------------------
vtkMRMLNode* stkIGTLToMRMLPosition::CreateNewNode(vtkMRMLScene* scene, const char* name)
{
vtkMRMLLinearTransformNode* transformNode;
transformNode = vtkMRMLLinearTransformNode::New();
transformNode->SetName(name);
transformNode->SetDescription("Received by OpenIGTLink");
vtkMatrix4x4* transform = vtkMatrix4x4::New();
transform->Identity();
//transformNode->SetAndObserveImageData(transform);
transformNode->ApplyTransformMatrix(transform);
transform->Delete();
vtkMRMLNode* n = scene->AddNode(transformNode);
this->SetVisibility(1,scene,transformNode);
transformNode->Delete();
return n;
}
//---------------------------------------------------------------------------
vtkIntArray* stkIGTLToMRMLPosition::GetNodeEvents()
{
vtkIntArray* events;
events = vtkIntArray::New();
events->InsertNextValue(vtkMRMLTransformableNode::TransformModifiedEvent);
return events;
}
//---------------------------------------------------------------------------
int stkIGTLToMRMLPosition::IGTLToMRML(igtl::MessageBase::Pointer buffer, vtkMRMLNode* node)
{
stkIGTLToMRMLBase::IGTLToMRML(buffer, node);
// Create a message buffer to receive transform data
igtl::PositionMessage::Pointer positionMsg;
positionMsg = igtl::PositionMessage::New();
positionMsg->Copy(buffer); // !! TODO: copy makes performance issue.
// Deserialize the transform data
// If CheckCRC==0, CRC check is skipped.
int c = positionMsg->Unpack(this->CheckCRC);
if (!(c & igtl::MessageHeader::UNPACK_BODY)) // if CRC check fails
{
// TODO: error handling
return 0;
}
if (node == NULL)
{
return 0;
}
vtkMRMLLinearTransformNode* transformNode =
vtkMRMLLinearTransformNode::SafeDownCast(node);
float position[3];
float quaternion[4];
igtl::Matrix4x4 matrix;
positionMsg->GetPosition(position);
positionMsg->GetQuaternion(quaternion);
igtl::QuaternionToMatrix(quaternion, matrix);
vtkMatrix4x4* transformToParent = transformNode->GetMatrixTransformToParent();
int row, column;
for (row = 0; row < 3; row++)
{
for (column = 0; column < 3; column++)
{
transformToParent->Element[row][column] = matrix[row][column];
}
transformToParent->Element[row][3] = position[row];
}
transformToParent->Element[3][0] = 0.0;
transformToParent->Element[3][1] = 0.0;
transformToParent->Element[3][2] = 0.0;
transformToParent->Element[3][3] = 1.0;
transformToParent->Modified();
return 1;
}
//---------------------------------------------------------------------------
int stkIGTLToMRMLPosition::MRMLToIGTL(unsigned long event, vtkMRMLNode* mrmlNode, int* size, void** igtlMsg)
{
if (mrmlNode && event == vtkMRMLTransformableNode::TransformModifiedEvent)
{
vtkMRMLLinearTransformNode* transformNode =
vtkMRMLLinearTransformNode::SafeDownCast(mrmlNode);
vtkMatrix4x4* matrix = transformNode->GetMatrixTransformToParent();
//igtl::PositionMessage::Pointer OutPositionMsg;
if (this->OutPositionMsg.IsNull())
{
this->OutPositionMsg = igtl::PositionMessage::New();
}
this->OutPositionMsg->SetDeviceName(mrmlNode->GetName());
igtl::Matrix4x4 igtlmatrix;
igtlmatrix[0][0] = matrix->Element[0][0];
igtlmatrix[1][0] = matrix->Element[1][0];
igtlmatrix[2][0] = matrix->Element[2][0];
igtlmatrix[3][0] = matrix->Element[3][0];
igtlmatrix[0][1] = matrix->Element[0][1];
igtlmatrix[1][1] = matrix->Element[1][1];
igtlmatrix[2][1] = matrix->Element[2][1];
igtlmatrix[3][1] = matrix->Element[3][1];
igtlmatrix[0][2] = matrix->Element[0][2];
igtlmatrix[1][2] = matrix->Element[1][2];
igtlmatrix[2][2] = matrix->Element[2][2];
igtlmatrix[3][2] = matrix->Element[3][2];
igtlmatrix[0][3] = matrix->Element[0][3];
igtlmatrix[1][3] = matrix->Element[1][3];
igtlmatrix[2][3] = matrix->Element[2][3];
igtlmatrix[3][3] = matrix->Element[3][3];
float position[3];
float quaternion[4];
position[0] = igtlmatrix[0][3];
position[1] = igtlmatrix[1][3];
position[2] = igtlmatrix[2][3];
igtl::MatrixToQuaternion(igtlmatrix, quaternion);
//this->OutPositionMsg->SetMatrix(igtlmatrix);
this->OutPositionMsg->SetPosition(position);
this->OutPositionMsg->SetQuaternion(quaternion);
this->OutPositionMsg->Pack();
*size = this->OutPositionMsg->GetPackSize();
*igtlMsg = (void*)this->OutPositionMsg->GetPackPointer();
return 1;
}
return 0;
}
//---------------------------------------------------------------------------
void stkIGTLToMRMLPosition::SetVisibility(int sw, vtkMRMLScene * scene, vtkMRMLNode * node)
{
vtkMRMLLinearTransformNode * tnode = vtkMRMLLinearTransformNode::SafeDownCast(node);
if (!tnode || !scene)
{
// If the node is not a linear transform node, do nothing.
return;
}
vtkMRMLModelNode* locatorModel = NULL;
vtkMRMLDisplayNode* locatorDisp = NULL;
const char * attr = tnode->GetAttribute("IGTLModelID");
if (!attr || !scene->GetNodeByID(attr)) // no locator has been created
{
if (sw)
{
std::stringstream ss;
ss << "Locator_" << tnode->GetName();
locatorModel = AddLocatorModel(scene, ss.str().c_str(), 0.0, 1.0, 1.0);
if (locatorModel)
{
tnode->SetAttribute("IGTLModelID", locatorModel->GetID());
scene->Modified();
locatorModel->SetAndObserveTransformNodeID(tnode->GetID());
locatorModel->InvokeEvent(vtkMRMLTransformableNode::TransformModifiedEvent);
}
}
else
{
locatorModel = NULL;
}
}
else
{
locatorModel = vtkMRMLModelNode::SafeDownCast(scene->GetNodeByID(attr));
}
if (locatorModel)
{
locatorDisp = locatorModel->GetDisplayNode();
locatorDisp->SetVisibility(sw);
locatorModel->Modified();
}
}
vtkMRMLModelNode* stkIGTLToMRMLPosition::AddLocatorModel(vtkMRMLScene * scene, const char* nodeName, double r, double g, double b)
{
vtkMRMLModelNode *locatorModel;
vtkMRMLModelDisplayNode *locatorDisp;
locatorModel = vtkMRMLModelNode::New();
locatorDisp = vtkMRMLModelDisplayNode::New();
// Cylinder represents the locator stick
vtkCylinderSource *cylinder = vtkCylinderSource::New();
cylinder->SetRadius(1.5);
cylinder->SetHeight(100);
cylinder->SetCenter(0, 0, 0);
cylinder->Update();
// Rotate cylinder
char* str1 = "CalibrationTool";
char* str2 = "UltrasoundTool";
char* str3 = "SurgeryTool";
vtkTransformPolyDataFilter *tfilter = vtkTransformPolyDataFilter::New();
vtkTransform* trans = vtkTransform::New();
if(strstr(nodeName,str1) != NULL) //CalibrationTool
{
//trans->RotateZ(-90.0); //polaris,acession的坐标系
trans->RotateX(90.0); //aurora的坐标系
}else if(strstr(nodeName,str2) != NULL) //UltrasoundTool
{
trans->RotateZ(90.0); //aurora的坐标系
}else if(strstr(nodeName,str3) != NULL) //SurgeryTool
{
trans->RotateX(90.0); //aurora的坐标系
}
trans->Translate(0.0, -50.0, 0.0);
trans->Update();
tfilter->SetInput(cylinder->GetOutput());
tfilter->SetTransform(trans);
tfilter->Update();
// Sphere represents the locator tip
vtkSphereSource *sphere = vtkSphereSource::New();
sphere->SetRadius(3.0);
sphere->SetCenter(0, 0, 0);
sphere->Update();
vtkAppendPolyData *apd = vtkAppendPolyData::New();
apd->AddInput(sphere->GetOutput());
//apd->AddInput(cylinder->GetOutput());
apd->AddInput(tfilter->GetOutput());
//if( std::string(nodeName) == "Locator_CalibrationTool")
//{
// vtkSTLReader* reader = vtkSTLReader::New();
// reader->SetFileName("C:/config/MicrowaveTool.stl");
// reader->Update();
// apd->AddInput(reader->GetOutput());
// reader->Delete();
//}
//else if ( std::string(nodeName) == "Locator_MicrowaveTool")
//{
// vtkSTLReader* reader = vtkSTLReader::New();
// reader->SetFileName("C:/config/MicrowaveTool.stl");
// reader->Update();
// apd->AddInput(reader->GetOutput());
// reader->Delete();
//}
apd->Update();
locatorModel->SetAndObservePolyData(apd->GetOutput());
double color[3];
color[0] = r;
color[1] = g;
color[2] = b;
// locatorDisp->SetPolyData(locatorModel->GetPolyData());
locatorDisp->SetColor(color);
trans->Delete();
tfilter->Delete();
cylinder->Delete();
sphere->Delete();
apd->Delete();
scene->SaveStateForUndo();
scene->AddNode(locatorDisp);
vtkMRMLNode* lm = scene->AddNode(locatorModel);
locatorDisp->SetScene(scene);
locatorModel->SetName(nodeName);
locatorModel->SetScene(scene);
locatorModel->SetAndObserveDisplayNodeID(locatorDisp->GetID());
locatorModel->SetHideFromEditors(0);
locatorModel->Delete();
locatorDisp->Delete();
return vtkMRMLModelNode::SafeDownCast(lm);
}
| [
"wmzhai@gmail.com"
] | wmzhai@gmail.com |
843f87d78196725d6dd3de96a522bc5821117317 | 134261434927aecde7f78035afd1e2cfd27e4772 | /Board.cpp | d38bff3d7a98401ab99f38ff54139deef074e834 | [] | no_license | GalTurgeman/CPPEx6_Board | 905d9d1dcb47e2aeb67a246b091629441e396911 | 3a2b4f112c819fc878a146e7728a5ae0b4aa6e59 | refs/heads/master | 2020-03-16T03:12:26.273790 | 2018-05-09T17:59:19 | 2018-05-09T17:59:19 | 132,482,576 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,216 | cpp | //
// Created by Gal on 07/05/2018.
//
#include "Board.h"
#include "MyException.h"
/**
* Default Constructor init all board to '.'
*/
Board::Board() {
for (int i = 0; i <this->size ; i++) {
board[i] = new MyChar[size];
}
}
/**
* Constructor init by int;
* @param s
*/
Board::Board(int s) {
this->size = s;
this->board = new MyChar *[size];
for (int i = 0; i < this->size; i++) {
this->board[i] = new MyChar[size];
}
for (int i = 0; i < this->size; i++) {
for (int j = 0; j < this->size; j++) {
this->board[i][j].setChar('.');
}
}
}
/**
* Copy Constructor perform deep copy.
* @param Board
*/
Board::Board(const Board& b) {
this->size = b.size;
board = new MyChar*[size];
for (int i = 0; i <this->size ; i++) {
board[i] = new MyChar[size];
}
for (int i = 0; i <this->size ; i++) {
for (int j = 0; j <this->size ; j++) {
board[i][j] = b.board[i][j];
}
}
}
/**
* All board will fill with c.
* @param char c
* @return &Board
*/
Board &Board::operator=(char c) {
if( c != 'X' && c != 'O' && c!= '.') {
IllegalCharException ex(c);
throw ex;
}
else{
for (int i = 0; i <this->size ; i++) {
for (int j = 0; j <this->size ; j++) {
this->board[i][j]=c;
}
}
return *this;
}
}
/**
* All board will fill with other.c .
* check if is the same board
* check if need to create new board , than delete old one.
* @param Board b
* @return &Board
*/
Board &Board::operator=(const Board& other) {
if(this == &other) return *this;//Same Board!
if(size != other.size) {
clean(*this);
size = other.size;
board = new MyChar*[size];
for (int i = 0; i <size ; i++) {
board[i] = new MyChar[size];
}
for (int i = 0; i < this->size; i++) {
for (int j = 0; j < this->size; j++) {
this->board[i][j] = MyChar{other.board[i][j].getChar()};
}
}
}
return *this;
}
/**
* Delete Board.
* @param Board b
*/
void Board::clean(const Board& b){
for (int i = 0; i <b.size ; i++) {
delete[] b.board[i];
}
delete[]b.board;
}
/**
* override '[]'
* @param list l
* @return &MyChar
*/
MyChar& Board::operator[](list<int> l) {
if(l.front() >= this->size || l.back() >= this->size || l.back() < 0 || l.front() < 0){
IllegalCoordinateException ex(l.front(),l.back());
throw ex;
}
return board[l.front()][l.back()];
}
/**
* Check if all board equal to other board.
* @param Board
* @return boolean
*/
bool Board::operator==(const Board &l) const{
if(size != l.size) return false;
else{
for (int i = 0; i <size; i++) {
for (int j = 0; j <size ; j++) {
if(board[i][j] != l.board[i][j]) return false;
}
}
}
return true;
}
/**
* destructor
* @param
*
*/
Board::~Board() {
// cout<<"destructor"<<endl;
for (int i = 0; i < size; i++) {
delete[] board[i];
}
delete[](board);
}
| [
"user154@gmail.com"
] | user154@gmail.com |
6dc46a01f4efc119dccf10f43ade042fb9f10b77 | 934b88d9a7c06b1e389c98adfa6e4b491f073604 | /Problem/Problem/1759.cpp | 552f9503a77c539a13a0637635fca91ccfa92f05 | [] | no_license | flash1117/Algorithm | cf7ac89588bd3c9fb03b7964559b6b16130e83d7 | 1331972e573aa6e6661cb37ff291c258a8ed456a | refs/heads/master | 2023-02-10T21:32:47.088851 | 2021-01-05T14:02:31 | 2021-01-05T14:02:31 | 152,283,309 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,032 | cpp | #include <iostream>
#include <algorithm>
using namespace std;
int L, C;
char arr[16];
char pick[16];
bool isCollection(char ch) {
if (ch == 'a' || ch == 'e' || ch == 'i' || ch == 'o' || ch == 'u') return true;
return false;
}
void makePassword(int depth, int cnt, int collectionCnt, int consonantCnt)
{
if (cnt == L && collectionCnt > 0 && consonantCnt > 1) {
for (int i = 0; i < L; i++)
cout << pick[i];
cout << "\n";
return;
}
else if (cnt == L) return;
if (depth >= C) return;
if (isCollection(arr[depth]))
{
pick[cnt] = arr[depth];
makePassword(depth + 1, cnt + 1, collectionCnt + 1, consonantCnt);
makePassword(depth + 1, cnt, collectionCnt, consonantCnt);
}
else {
pick[cnt] = arr[depth];
makePassword(depth + 1, cnt + 1, collectionCnt, consonantCnt + 1);
makePassword(depth + 1, cnt, collectionCnt, consonantCnt);
}
return;
}
int main() {
cin >> L >> C;
for (int i = 0; i < C; i++) {
cin >> arr[i];
}
sort(arr, arr + C);
makePassword(0, 0, 0, 0);
return 0;
} | [
"flash1117@naver.com"
] | flash1117@naver.com |
55f935dca4033b8f155eae016a9080ef43ae7c47 | a1b4702c9b2a48300b8b4c5f44b3e77467471c0f | /jni/tcp_transmittion/ISocketListener.h | 4fb18b03b65079d31d0ada808a169d200fec3c52 | [] | no_license | studyNowHa/ball | 38a12395b8c324390974e1bcc8db2edbd71fd600 | 14f2f9a5cb44d8c592d2062a6bda2f57c213d87c | refs/heads/master | 2020-03-26T12:59:55.473703 | 2018-08-16T00:52:47 | 2018-08-16T00:54:00 | 144,917,942 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 267 | h | #ifndef ISCK_LISTENER
#define ISCK_LISTENER
class ISocketListener
{
public:
virtual ~ISocketListener() { };
virtual void notify(std::string msg) = 0;
};
class iiSocketListener : public ISocketListener
{
public:
virtual void notify(std::string msg);
};
#endif
| [
"903058621@qq.com"
] | 903058621@qq.com |
ac25538e9ca2e4e0874a9193e2a8b1ff4b43ed90 | 381d605da20ca3342687e26c5bd00936fe7a46e7 | /Codechef/REARRAN-Rearrangement.cpp | 5edea6316110e94b8f99cb998d81f7933f7999d5 | [] | no_license | z0CoolCS/CompetitiveProgramming | 4a4c278533001a0a4e8440ecfba9c7a4bb8132db | 0894645c918f316c2ce6ddc5fd5fb20af6c8b071 | refs/heads/master | 2023-04-28T08:15:29.245592 | 2021-04-20T01:02:28 | 2021-04-20T01:02:28 | 228,505,384 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 152 | cpp | #include<bits/stdc++.h>
using namespace std;
#define REP(i,a,b) for(int i=a;i<b;i++)
int main(){
int t;
cin>>t;
while(t--){
}
return 0;
}
| [
"giordano.alvitez@utec.edu.pe"
] | giordano.alvitez@utec.edu.pe |
7716f40249792531adcacbc3094e7ddb55058e7f | 846f4dc2f720f88080df1e1082e0c854f188450b | /main.cpp | 326d5134554f58903385877a94a54f97829d9081 | [] | no_license | Ali-1999/link-list-in-c- | bebd94ebb595932b1bb047eb8cc77a726c0ad983 | 736f08051bea130205abb9411f58c8b03d60a445 | refs/heads/master | 2022-04-17T12:10:27.726526 | 2020-04-19T19:16:48 | 2020-04-19T19:16:48 | 257,081,527 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,603 | cpp | #include"student.h"
#include<conio.h>
#include"course.h"
#include<iostream>
#include<string>
using namespace std;
void main() {
string cour, stud;
int c, csd, cms,tr;
cout << "\nenter course name : ";
getline(cin, cour);
cout << "\ncourse id : ";
cin >> csd;
course cr(csd,cour);
do {
cout << "\n|1|\t<---------------ADD at top------> ";
cout << "\n|2|\t<---------------ADD at last----->";
cout << "\n|3|\t<---------------ADD at anywhere->";
cout << "\n|4|\t<---------------Delete student--->";
cout << "\n|5|\t<---------------Print the list----> ";
cin >> c;
switch (c)
{
case 1:
cin.ignore();
cout << "\n Student name : ";
getline(cin, stud);
cout << "\nenter cms : ";
cin >> cms;
cr.add_head(cms, stud);
cout << "\n<-----------added successfullu---------->\n";
break;
case 2:
cin.ignore();
cout << "\n Student name : ";
getline(cin, stud);
cout << "\nenter cms : ";
cin >> cms;
cr.add_tail(cms, stud);
cout << "\n<-----------added successfullu---------->\n";
break;
case 3:
cout << "\n enter previous cms : ";
cin >> tr;
cin.ignore();
cout << "\n Student name : ";
getline(cin, stud);
cout << "\nenter cms : ";
cin >> cms;
cr.add_target(tr,cms, stud);
cout << "\n<-----------added successfullu---------->\n";
break;
case 4:
cout << "\n enter student cms : ";
cin >> tr;
cr.delete_node(tr);
cout << "\n<-----------deleted successfullu---------->\n";
break;
case 5:
cr.print();
break;
}
} while (c < 6);
} | [
"63450457+Ali-1999@users.noreply.github.com"
] | 63450457+Ali-1999@users.noreply.github.com |
216eead3d1ebcdddb108a675547e59aa78bff472 | 82d483e0a15b3d39adbc945e7a78d3632c9b7d15 | /Competition/CodeChef/start2c/server.cpp | 49b305208e259529db0fde33c321ddb7daed9a55 | [] | no_license | PandeyAditya14/APS2020 | 18dfb3f1ef48f27a0b50c1184c3749eab25e2a1a | d0f69b56de5656732aff547a88a7c79a77bcf6b1 | refs/heads/master | 2022-08-10T13:40:13.119026 | 2022-08-01T03:22:37 | 2022-08-01T03:22:37 | 236,135,975 | 1 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 443 | cpp | #include<bits/stdc++.h>
#define ll long long int
using namespace std;
#define fast_cin() ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
int main(){
fast_cin();
int t;
cin>>t;
while(t--){
double nodes , servers;
cin>>nodes>>servers;
double max_distance = floor(nodes/servers);
double max_pair = ceil(nodes/servers);
cout<<(int) max_distance<<" "<<(int) max_pair;
}
} | [
"noreply@github.com"
] | PandeyAditya14.noreply@github.com |
9843c4d092a6d78674d2c75474c0ab699f4a7c56 | c5713333ac8cc514eb0484ee6bd5426678156940 | /Sem 2, Lab 3/main.cpp | d3756ba96d981e4d68a9d496f9cb4cb0e970626d | [] | no_license | danyaffff/ITMO-Programming | 1d3c34e468f47bcb2fad2fbb9c73ce85d6ca733c | 4d567393289de5afc5bf4ef4d2697b9410ae195c | refs/heads/master | 2021-01-01T08:58:45.122363 | 2020-11-25T00:42:52 | 2020-11-25T00:42:52 | 239,208,030 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 8,363 | cpp | /* Лабораторная работа №3. Перегрузка операторов.
Согласно варианту описать указанные типы данных и поместить их в отдельный заголовочный файл, в нем же описать операторы,
указанные в варианте. Реализацию функций поместить с отдельный cpp файл. Написать программу, проверяющую правильность работы —
для наглядности и лучшего усвоения материала использовать как явный, так и не явный метод вызова функций операторов.
1. Тип данных: Квадрат на плоскости.
Задается координатой левого верхнего угла, стороной квадрата и углом, на который квадрат повернут относительно оси OX.
Операторы: равенство площадей квадратов (перегрузите операции ==, !=, <, >),
умножение квадрата на вещественное число (увеличивает сторону квадрата),
прибавление к квадрату вектора (смещение квадрата на указанный вектор).
2. Тип данных: Массив целых чисел (длина не более 100).
Операторы: объединение двух массивов в один (operator+), сравнение длин массивов
(==, >, < !=). */
#include <iostream>
#include "Square.hpp"
int main() {
point p;
double rib;
double angle;
std::cout << "Введите координату верхней левой точки первого квадрата" << std::endl;
std::cout << "x: ";
std::cin >> p.x;
std::cout << "y: ";
std::cin >> p.y;
std::cout << "Введите длину ребра первого квадрата: ";
std::cin >> rib;
std::cout << "Введите угол поворота первого квадрата: ";
std::cin >> angle;
square s1(p, rib, angle);
std::cout << "Введите координату верхней левой точки второго квадрата" << std::endl;
std::cout << "x: ";
std::cin >> p.x;
std::cout << "y: ";
std::cin >> p.y;
std::cout << "Введите длину ребра второго квадрата: ";
std::cin >> rib;
std::cout << "Введите угол поворота второго квадрата: ";
std::cin >> angle;
square s2(p, rib, angle);
std::cout << "Площади равны (явный вызов): ";
if (s1.operator==(s2)) {
std::cout << "true" << std::endl;
} else {
std::cout << "false" << std::endl;
}
std::cout << "Площади равны (неявный вызов): ";
if (s1 == s2) {
std::cout << "true" << std::endl;
} else {
std::cout << "false" << std::endl;
}
std::cout << "Площади не равны (явный вызов): ";
if (s1.operator!=(s2)) {
std::cout << "true" << std::endl;
} else {
std::cout << "false" << std::endl;
}
std::cout << "Площади не равны (неявный вызов): ";
if (s1 != s2) {
std::cout << "true" << std::endl;
} else {
std::cout << "false" << std::endl;
}
std::cout << "Площадь первого больше площади второго (явный вызов): ";
if (s1.operator>(s2)) {
std::cout << "true" << std::endl;
} else {
std::cout << "false" << std::endl;
}
std::cout << "Площадь первого больше площади второго (неявный вызов): ";
if (s1 > s2) {
std::cout << "true" << std::endl;
} else {
std::cout << "false" << std::endl;
}
std::cout << "Площадь второго больше площади первого (явный вызов): ";
if (s1.operator<(s2)) {
std::cout << "true" << std::endl;
} else {
std::cout << "false" << std::endl;
}
std::cout << "Площадь второго больше площади первого (неявный вызов): ";
if (s1 < s2) {
std::cout << "true" << std::endl;
} else {
std::cout << "false" << std::endl;
}
std::cout << "Увеличение стороны квадрата в n раз" << std::endl;
double n;
std::cout << "Введите вещественное число: ";
std::cin >> n;
std::cout << "Теперь сторона квадрата равна (явный вызов): " << s1.operator*(n) << std::endl;
std::cout << "Теперь сторона квадрата равна (неявный вызов): " << s1 * n << std::endl;
std::cout << "Смещение квадрата на вектор" << std::endl;
vector v;
std::cout << "Введите начальную координату вектора" << std::endl;
std::cout << "x: ";
std::cin >> v.start.x;
std::cout << "y: ";
std::cin >> v.start.y;
std::cout << "Введите конечную координату вектора" << std::endl;
std::cout << "x: ";
std::cin >> v.end.x;
std::cout << "y: ";
std::cin >> v.end.y;
std::cout << "Точка после смещения (явный вызов)" << std::endl;
s1.operator+(v);
std::cout << "x: " << s1.getX() << std::endl;
std::cout << "y: " << s1.getY() << std::endl;
std::cout << "Точка после смещения (неявный вызов)" << std::endl;
s1 + v;
std::cout << "x: " << s1.getX() << std::endl;
std::cout << "y: " << s1.getY() << std::endl;
std::cout << "Введите размер первого массива: ";
int size;
std::cin >> size;
array a1(size);
std::cout << "Заполните массив" << std::endl;
a1.set();
std::cout << "Введите размер второго массива: ";
std::cin >> size;
array a2(size);
std::cout << "Заполните массив" << std::endl;
a2.set();
std::cout << "Результат" << std::endl;
array result = a1 + a2;
result.showArr();
std::cout << "Сравнение перовго и второго массивов" << std::endl;
std::cout << "Длины равны (явный вызов): ";
if (a1.operator==(a2)) {
std::cout << "true" << std::endl;
} else {
std::cout << "false" << std::endl;
}
std::cout << "Длины равны (неявный вызов): ";
if (a1 == a2) {
std::cout << "true" << std::endl;
} else {
std::cout << "false" << std::endl;
}
std::cout << "Длины неравны (явный вызов): ";
if (a1.operator!=(a2)) {
std::cout << "true" << std::endl;
} else {
std::cout << "false" << std::endl;
}
std::cout << "Длины неравны (неявный вызов): ";
if (a1 != a2) {
std::cout << "true" << std::endl;
} else {
std::cout << "false" << std::endl;
}
std::cout << "Длина первого массива больше (явный вызов): ";
if (a1.operator>(a2)) {
std::cout << "true" << std::endl;
} else {
std::cout << "false" << std::endl;
}
std::cout << "Длина первого массива больше (неявный вызов): ";
if (a1 > a2) {
std::cout << "true" << std::endl;
} else {
std::cout << "false" << std::endl;
}
std::cout << "Длина второго массива больше (явный вызов): ";
if (a1.operator<(a2)) {
std::cout << "true" << std::endl;
} else {
std::cout << "false" << std::endl;
}
std::cout << "Длина второго массива больше (неявный вызов): ";
if (a1 < a2) {
std::cout << "true" << std::endl;
} else {
std::cout << "false" << std::endl;
}
}
| [
"noreply@github.com"
] | danyaffff.noreply@github.com |
f54977d2433c871d456e73a7c5d6743175d2f44f | 6b40e9cba1dd06cd31a289adff90e9ea622387ac | /Develop/Server/GameServer/unittest/MockDBTask.h | 7f3d90cf77eb09d54bb028d3cc2682c0b17246c0 | [] | no_license | AmesianX/SHZPublicDev | c70a84f9170438256bc9b2a4d397d22c9c0e1fb9 | 0f53e3b94a34cef1bc32a06c80730b0d8afaef7d | refs/heads/master | 2022-02-09T07:34:44.339038 | 2014-06-09T09:20:04 | 2014-06-09T09:20:04 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 405 | h | #pragma once
#include "GDBAsyncTask.h"
class MockDBTask : public GDBAsyncTask
{
public :
MockDBTask(const MUID& uidReqPlayer) : GDBAsyncTask(uidReqPlayer, SDBT_DBTYPE_NONE, SDBTID_NONE) {}
void OnExecute(mdb::MDatabase& rfDB) {}
mdb::MDB_THRTASK_RESULT _OnCompleted() { return mdb::MDBTR_SUCESS; }
using GDBAsyncTask::IncreaseRefCount;
using GDBAsyncTask::DecreaseRefCount;
};
| [
"shzdev@8fd9ef21-cdc5-48af-8625-ea2f38c673c4"
] | shzdev@8fd9ef21-cdc5-48af-8625-ea2f38c673c4 |
714d04f4538b0bf7f83b3ff4748caf8284aa3204 | d043caf3425cf6e4de3d589aaa40d2fd8735cfd4 | /include/viperfish_stats_window.hpp | eecea54379c003f8fa11b8a98ea2b3581617ca66 | [
"MIT"
] | permissive | microwerx/viperfish | b3aa4ebeda42e4345d375502017870351d7f38af | 3592242c31c59fef9c6e02584738147d8e999ec9 | refs/heads/master | 2021-07-05T21:03:13.877475 | 2020-11-29T06:49:08 | 2020-11-29T06:49:08 | 128,976,568 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,029 | hpp | #ifndef VIPERFISH_STATS_WINDOW_HPP
#define VIPERFISH_STATS_WINDOW_HPP
#include <viperfish_window.hpp>
namespace Vf {
class FloatStat {
public:
FloatStat(int max_samples = 100, float metric_low = FLT_MIN, float metric_high = FLT_MAX);
void push(float value);
inline void push(double value) { push((float)value); }
void push_difference(float value);
inline void push_difference(double value) { push_difference((float)value); }
void push_difference_inverse(float value);
inline void push_difference_inverse(double value) { push_difference_inverse((float)value); }
void plotLines(const char* label);
inline void plotLines(const std::string& label) { plotLines(label.c_str()); }
float get(int idx) const;
void set(int idx, float x);
bool visible = true;
float height = 0.0f;
private:
std::vector<float> metric{ 0.0f };
int metric_pl_start = 0;
int metric_pl_size = 0;
int metric_idx = 0;
int metric_len = 100;
int metric_max_len = 1000;
float metric_init_value = 0.0f;
float metric_last_value = 0.0f;
float metric_min_value = 0.0f;// FLT_MIN;
float metric_max_value = 1.0f;// FLT_MAX;
};
class StatsWindow : public Window {
public:
StatsWindow(const std::string& name);
virtual ~StatsWindow() override;
void OnUpdate(double timeStamp) override;
void OnRenderDearImGui() override;
std::string msg;
private:
std::string popupId;
static constexpr int MAX_SAMPLES = 256;
std::map<std::string, FloatStat> float_stats{
{ "et", { MAX_SAMPLES, 0.0f, 0.5f } },
{ "dt", { MAX_SAMPLES, 0.0f, 0.5f } },
{ "fps", { MAX_SAMPLES, 0.0f, 100.0f } },
{ "sin", { MAX_SAMPLES, -1.0f, 1.0f } },
{ "1noise", { MAX_SAMPLES, 0.0f, 1.0f } },
{ "2snoise", { MAX_SAMPLES, -1.0f, 1.0f } },
{ "3frac", { MAX_SAMPLES, -1.0f, 1.0f } },
{ "4turb", { MAX_SAMPLES, -1.0f, 1.0f } },
};
float min_freq = 1.0f;
float max_freq = 8.0f;
bool pause = false;
};
using StatsWindowPtr = std::shared_ptr<StatsWindow>;
}
#endif | [
"jmetzgar@outlook.com"
] | jmetzgar@outlook.com |
cd7baaa1836267a823a55eea33578ae5a992c1f7 | b1e6d8c20facf0c265febf93cfc405b7a157dc0d | /cSceneManager.h | 912d35e6bea5f26e32746b2d157e816f1dc92a06 | [] | no_license | donghoyu/Ready | f30251da3c6b068cb0e18c2a367d1f30269df52f | 1b07c3a5766a25a39a1cf04ef73b8c2f6cc3088b | refs/heads/master | 2021-01-25T14:03:24.635629 | 2018-03-29T14:30:09 | 2018-03-29T14:30:09 | 123,641,123 | 0 | 0 | null | null | null | null | UHC | C++ | false | false | 1,188 | h | #pragma once
#define SCENEMANAGER cSceneManager::GetInstance()
#include <map>
#include <string>
class SceneList;
class cSceneManager
{
private:
SINGLETONE(cSceneManager);
typedef map<string, SceneList*> mapSceneList;
typedef map<string, SceneList*>::iterator mapSceneIter;
public:
static SceneList* _currentScene; //현재 씬
static SceneList* _loadingScene; //로딩 씬(안쓰일듯)
static SceneList* _readyScene; //대기 씬
mapSceneList _mSceneList;
mapSceneList _mLoadingSceneList;
DWORD _loadingThreadID; //혹시 몰라 넣어놓는 쓰레드용 ID
public:
HRESULT init(void);
void release(void);
void update(void);
void render(void);
//씬 추가 함수
SceneList* addScene(string sceneName, SceneList* scene);
SceneList* addLoadingScene(string loadingSceneName, SceneList* scene);
//씬 변경
HRESULT changeScene(string sceneName);
HRESULT changeScene(string sceneName, string loadingSceneName);
//friend란 선언하면 클래스의 private까지 그냥 접근 가능케 한다
//남발하면 안되는데, 구조상 왠지 1~2개정도는 해두면 좋을 것 같으면 해도됨
friend DWORD CALLBACK loadingThread(LPVOID prc);
};
| [
"dbehdgh_@naver.com"
] | dbehdgh_@naver.com |
971a1c1fd84c5f11449833c0ac8846250142868e | 69dd66ade564a4e011d5769870e195f584462c7a | /debugger/src/libdbg64g/services/exec/cmd/cmd_exit.cpp | 50aceb59773d67ae1e49dabb0f2443f3e11a6c36 | [
"Apache-2.0"
] | permissive | sergeykhbr/riscv_vhdl | 649c2414eb02ea7e6f69e67e7bfc3fde662299d9 | 462e8aac451265734f19d10fba700e58b304029f | refs/heads/master | 2023-08-26T05:48:11.325719 | 2023-08-25T11:02:27 | 2023-08-25T11:02:27 | 45,797,714 | 553 | 122 | Apache-2.0 | 2022-11-01T20:57:33 | 2015-11-08T20:30:57 | C++ | UTF-8 | C++ | false | false | 1,271 | cpp | /*
* Copyright 2023 Sergey Khabarov, sergeykhbr@gmail.com
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "cmd_exit.h"
namespace debugger {
CmdExit::CmdExit(IService *parent, IJtag *ijtag)
: ICommandRiscv(parent, "exit", ijtag) {
briefDescr_.make_string("Exit and close application");
detailedDescr_.make_string(
"Description:\n"
" Immediate close the application and exit.\n"
"Example:\n"
" exit\n");
}
int CmdExit::isValid(AttributeType *args) {
if (!cmdName_.is_equal((*args)[0u].to_string())) {
return CMD_INVALID;
}
return CMD_VALID;
}
void CmdExit::exec(AttributeType *args, AttributeType *res) {
RISCV_break_simulation();
}
} // namespace debugger
| [
"sergeykhbr@gmail.com"
] | sergeykhbr@gmail.com |
36f7e40401dc69ab12ed7d54512e5c084f5aba27 | df7183168307670df562970687ec0f98d3424862 | /Graphs/BFS.cpp | a8a4b7cd4818128083cce18904cd5ca80100a35e | [] | no_license | iSumitYadav/DS-Algo | cf816669c1468c1b6bc1e37f36114b944c6e71c2 | 453b5723269690b0e765ae510e392d667df45e3f | refs/heads/master | 2021-09-03T17:36:22.384809 | 2018-01-10T18:55:02 | 2018-01-10T18:55:02 | 113,206,635 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,184 | cpp | #include<bits/stdc++.h>
using namespace std;
class Graph{
int nodes;
list<int> *adj_list;
public:
Graph(int nodes){
this->nodes = nodes;
adj_list = new list<int>[nodes];
}
void addEdge(int a, int b){
adj_list[a].push_back(b);
}
void breadthFirstSearch(int src);
};
void Graph::breadthFirstSearch(int src){
bool *visited = new bool[nodes];
memset(visited, false, sizeof(visited));
list<int> q;
list<int>::iterator it;
q.push_back(src);
visited[src] = true;
while(!q.empty()){
src = q.front();
printf("%d ", src);
q.pop_front();
for(it=adj_list[src].begin(); it!=adj_list[src].end(); it++){
if(!visited[*it]){
q.push_back(*it);
visited[*it] = true;
}
}
}
}
int main(){
/* GRAPH
0---------1
|| /
|| /
|| / __
|| / | |
2---------3
\ /
\ /
\ /
\ /
4
|_|
*/
Graph g(5);
g.addEdge(0, 1);
g.addEdge(0, 2);
g.addEdge(1, 2);
g.addEdge(2, 0);
g.addEdge(2, 4);
g.addEdge(2, 3);
g.addEdge(3, 3);
g.addEdge(3, 4);
g.addEdge(4, 4);
printf("Breadth First Traversal: \n");
g.breadthFirstSearch(2);
return 0;
} | [
"sumityadavcools@gmail.com"
] | sumityadavcools@gmail.com |
7c399f0c15c536c4ba1543cc0f1d6e58994a0c58 | 3567ccb566cc447302fae872048dbf4d887fdc05 | /1170.3.cpp | 4bded59f46fac25861f36739d82eb4e46012e6b8 | [] | no_license | jiezuowhu/WOJ-learn | 20fd2cb4aa92f19c2ed244114a20595d05a2e3e9 | 2f54defbe589b68c5ca5ae50edd1450ecc27a29f | refs/heads/master | 2021-01-15T22:04:29.721968 | 2013-03-18T14:33:42 | 2013-03-18T14:33:42 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 422 | cpp | #include<iostream>
#include<algorithm>
#include<list>
using namespace std;
int main()
{
list<unsigned int> data;
while(1)
{
unsigned int a;
scanf("%d",&a);
if(a==0) break;
data.push_back(a);
}
data.sort();
list<unsigned int>::iterator end=unique(data.begin(),data.end());
list<unsigned int>::itrator pointer=data.begin();
for(;pointer!=end;pointer++) printf("%u ",*pointer);
printf("\n");
return 0;
} | [
"1069700995@qq.com"
] | 1069700995@qq.com |
c26b2bbc67c79d15b24c142a5abb0ea8ba57fbdb | 0767c3aa243d2f5525c30431babee96c2afe8fa0 | /src/main.cpp | 4e0991c5d661a3ae26dc092a2f27a8dc9b2de49a | [] | no_license | agdang/modu | 240f7df20fbb242b9aeea58bd3a04a1957e90a1e | a28ecc67d07cee56b50fa549dd41f69892b473c0 | refs/heads/master | 2021-01-21T17:37:17.196748 | 2017-07-18T21:18:37 | 2017-07-18T21:18:37 | 91,260,091 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,655 | cpp | #include <cmath>
#include "app.h"
#include "tile.h"
#include "map.h"
#include "draw.h"
#include "gameworld.h"
#include "gamewindow.h"
int main(int argc, char* argv[])
{
App::Init();
App::Cycle();
App::Close();
/*int WINDOW_WIDTH = (32 * TILE_SIZE) + TILE_SIZE; int WINDOW_HEIGHT = WINDOW_WIDTH;
GameWindow* gameWindow = new GameWindow(WINDOW_WIDTH, WINDOW_HEIGHT);
GameWorld* gameWorld = new GameWorld;
map* m = new map(20, 20);
gameWorld->AddMap(m);
map& currentMap = gameWorld->LoadMap(m);
unsigned short int viewRadius = 15;
unsigned short int viewH;
bool running = true;
while (running)
{
int worldOffsetX = (gameWindow->width / 2) - (TILE_SIZE / 2);
int worldOffsetY = (gameWindow->height / 2) - (TILE_SIZE / 2);
int playerUpTileY = currentMap.offsetY - 1; int playerUpTileX = currentMap.offsetX;
int playerDownTileY = currentMap.offsetY + 1; int playerDownTileX = currentMap.offsetX;
int playerLeftTileY = currentMap.offsetY; int playerLeftTileX = currentMap.offsetX - 1;
int playerRightTileY= currentMap.offsetY; int playerRightTileX= currentMap.offsetX + 1;
SDL_Event event;
if (SDL_WaitEvent(&event))
{
switch (event.type)
{
case SDL_QUIT: running = false; break;
case SDL_KEYDOWN:
switch (event.key.keysym.sym)
{
case SDLK_UP: case SDLK_KP_8:
if (playerUpTileY >= 0
&& currentMap.GetTile(playerUpTileX, playerUpTileY)->solid != true)
{
currentMap.offsetY--;
}
break;
case SDLK_DOWN: case SDLK_KP_2:
if (playerDownTileY < currentMap.height
&& currentMap.GetTile(playerDownTileX, playerDownTileY)->solid != true)
{
currentMap.offsetY++;
}
break;
case SDLK_LEFT: case SDLK_KP_4:
if (playerLeftTileX >= 0
&& currentMap.GetTile(playerLeftTileX, playerLeftTileY)->solid != true)
{
currentMap.offsetX--;
}
break;
case SDLK_RIGHT: case SDLK_KP_6:
if (playerRightTileX < currentMap.width
&& currentMap.GetTile(playerRightTileX, playerRightTileY)->solid != true)
{
currentMap.offsetX++;
}
break;
case SDLK_KP_7:
if (playerUpTileY >= 0
&& playerLeftTileX >= 0
&& currentMap.GetTile(playerUpTileX - 1, playerUpTileY)->solid != true)
{
currentMap.offsetY--;
currentMap.offsetX--;
}
break;
case SDLK_KP_9:
if (playerUpTileY >= 0
&& playerRightTileX < currentMap.width
&& currentMap.GetTile(playerUpTileX + 1, playerUpTileY)->solid != true)
{
currentMap.offsetY--;
currentMap.offsetX++;
}
break;
case SDLK_KP_1:
if (playerDownTileY < currentMap.height
&& playerLeftTileX >= 0
&& currentMap.GetTile(playerDownTileX - 1, playerDownTileY)->solid != true)
{
currentMap.offsetY++;
currentMap.offsetX--;
}
break;
case SDLK_KP_3:
if (playerDownTileY < currentMap.height
&& playerRightTileX < currentMap.width
&& currentMap.GetTile(playerDownTileX + 1, playerDownTileY)->solid != true)
{
currentMap.offsetY++;
currentMap.offsetX++;
}
break;
case SDLK_q: running = false; break;
case SDLK_EQUALS: viewRadius += 1; break;
case SDLK_MINUS: if (viewRadius > 0) viewRadius -= 1; break;
case SDLK_1: currentMap = gameWorld->LoadMap(m); break;
}
break;
}
}
SDL_SetRenderDrawColor(gameWindow->renderer, 0, 0, 0, 255);
gameWindow->Clear();
for (int i = -viewRadius; i < viewRadius + 1; i++)
{
viewH = static_cast<unsigned int> (sqrt(viewRadius * viewRadius - i * i));
for (int j = -viewH; j < viewH + 1; j++)
{
int tileMapIndexX = i + currentMap.offsetX;
int tileMapIndexY = j + currentMap.offsetY;
int tileScreenPosX = worldOffsetX + i*TILE_SIZE;
int tileScreenPosY = worldOffsetY + j*TILE_SIZE;
if (tileScreenPosX >= 0
&& tileScreenPosX < WINDOW_WIDTH
&& tileScreenPosY >= 0
&& tileScreenPosY < WINDOW_HEIGHT)
{
if (tileMapIndexY >= 0
&& tileMapIndexY < currentMap.height
&& tileMapIndexX >= 0 && tileMapIndexX < currentMap.width)
Draw(gameWindow->renderer,
*currentMap.GetTile(tileMapIndexX, tileMapIndexY),
currentMap.offsetX,
currentMap.offsetY,
worldOffsetX, worldOffsetY);
}
}
}
SDL_SetRenderDrawColor(gameWindow->renderer, 40, 40, 255, 255);
static SDL_Rect player = { worldOffsetX, worldOffsetY, TILE_SIZE, TILE_SIZE };
SDL_RenderFillRect(gameWindow->renderer, &player);
gameWindow->Update();
}
delete gameWorld;
delete gameWindow;
SDL_Quit();
*/
return 0;
}
| [
"magicalsm@protonmail.com"
] | magicalsm@protonmail.com |
6136ef1b0f588b6f342ddb189ed25ac8a5f5f083 | 31287dccda1fa0be67d87c61175fc7e9206134e8 | /QtBook/Paint/Base/ArcChordPieWidget.cpp | 2924e9e4a181e7e1851c5d6daa6e55f8a51ae5f1 | [] | no_license | xtuer/Qt | 83c9407f92cef8f0d1b702083bb51ea29d69f18a | 01d3862353f88a64e3c4ea76d4ecdd1d98ab1806 | refs/heads/master | 2022-06-02T02:32:56.694458 | 2022-05-29T13:06:48 | 2022-05-29T13:06:48 | 55,279,709 | 15 | 13 | null | null | null | null | UTF-8 | C++ | false | false | 1,297 | cpp | #include "ArcChordPieWidget.h"
#include "ui_ArcChordPieWidget.h"
#include <QPainter>
ArcChordPieWidget::ArcChordPieWidget(QWidget *parent) : QWidget(parent), ui(new Ui::ArcChordPieWidget) {
ui->setupUi(this);
}
ArcChordPieWidget::~ArcChordPieWidget() {
delete ui;
}
void ArcChordPieWidget::paintEvent(QPaintEvent *) {
QPainter painter(this);
painter.setRenderHint(QPainter::Antialiasing);
static int startAngle = 45 * 16; // 开始角度是 45 度
static int spanAngle = 130 * 16; // 覆盖角度为 130 度
static QRectF boundingRect(0, 0, 150, 150); // 包围矩形
painter.translate(30, 30);
painter.setBrush(Qt::NoBrush);
painter.drawRect(boundingRect); // 绘制包围矩形
painter.setBrush(Qt::lightGray);
painter.drawArc(boundingRect, startAngle, spanAngle); // 画弧
painter.translate(180, 0);
painter.setBrush(Qt::NoBrush);
painter.drawRect(boundingRect); // 绘制包围矩形
painter.setBrush(Qt::lightGray);
painter.drawChord(boundingRect, startAngle, spanAngle); // 画弦
painter.translate(180, 0);
painter.setBrush(Qt::NoBrush);
painter.drawRect(boundingRect); // 绘制包围矩形
painter.setBrush(Qt::lightGray);
painter.drawPie(boundingRect, startAngle, spanAngle); // 画饼图
}
| [
"biao.mac@icloud.com"
] | biao.mac@icloud.com |
9ed35c42330197e6bdc96587d3543dc3ecec5232 | dd71975e17363cd4fff13a8979ebd81f360058a4 | /Source/ToolCore/Assets/SceneImporter.h | 947743ae30bbf3903c4456e611ebf82c33cf8a6c | [
"LicenseRef-scancode-unknown-license-reference",
"MIT"
] | permissive | honigbeutler123/AtomicGameEngine | 95403fa3db60553270716d7fe9811ba9b4403070 | 2393fd70315120a3879d2db5f1e955dba75a898c | refs/heads/master | 2023-05-07T11:53:58.631217 | 2023-04-14T09:20:38 | 2023-04-14T09:20:38 | 53,612,655 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,282 | h | //
// Copyright (c) 2014-2015, THUNDERBEAST GAMES LLC All rights reserved
// LICENSE: Atomic Game Engine Editor and Tools EULA
// Please see LICENSE_ATOMIC_EDITOR_AND_TOOLS.md in repository root for
// license information: https://github.com/AtomicGameEngine/AtomicGameEngine
//
#pragma once
#include "AssetImporter.h"
namespace ToolCore
{
class SceneImporter : public AssetImporter
{
OBJECT(SceneImporter);
public:
/// Construct.
SceneImporter(Context* context, Asset *asset);
virtual ~SceneImporter();
virtual void SetDefaults();
/// Set the scene camera's rotation
void SetSceneCamRotation(const Quaternion& rotation) { sceneCamRotation_ = rotation; }
/// Set the scene camera's position
void SetSceneCamPosition(const Vector3& position) { sceneCamPosition_ = position; }
/// Get the scene camera's rotation
const Quaternion& GetSceneCamRotation() const { return sceneCamRotation_; }
/// Get the scene camera's position
const Vector3& GetSceneCamPosition() const { return sceneCamPosition_; }
protected:
bool Import();
virtual bool LoadSettingsInternal(JSONValue& jsonRoot);
virtual bool SaveSettingsInternal(JSONValue& jsonRoot);
Quaternion sceneCamRotation_;
Vector3 sceneCamPosition_;
};
}
| [
"josh@galaxyfarfaraway.com"
] | josh@galaxyfarfaraway.com |
7954fcacdd95b086f17bd355fe1cbc2fdf2591f1 | f3c8d78b4f8af9a5a0d047fbae32a5c2fca0edab | /Qt/mega_git_tests/Test_QGraphicsScene/other/graphicsscene/scene.cpp | ef9f957f2e1c788655cde98451d668ff5605d552 | [] | no_license | RinatB2017/mega_GIT | 7ddaa3ff258afee1a89503e42b6719fb57a3cc32 | f322e460a1a5029385843646ead7d6874479861e | refs/heads/master | 2023-09-02T03:44:33.869767 | 2023-08-21T08:20:14 | 2023-08-21T08:20:14 | 97,226,298 | 5 | 2 | null | 2022-12-09T10:31:43 | 2017-07-14T11:17:39 | C++ | UTF-8 | C++ | false | false | 590 | cpp | #include "scene.h"
#include "figures/rectfigure.h"
#include "figures/rhombfigure.h"
#include <QGraphicsSceneMouseEvent>
Scene::Scene(QObject *parent) : QGraphicsScene(parent), m_figureType(None) { }
void Scene::mousePressEvent(QGraphicsSceneMouseEvent *event) {
if (None == m_figureType) return;
QGraphicsItem *item;
switch (m_figureType) {
case Rect:
item = new RectFigure();
break;
case Rhomb:
item = new RhombFigure();
break;
}
item->setPos(event->scenePos());
addItem(item);
}
void Scene::on_tool_changed(FigureType type) { m_figureType = type; }
| [
"tux4096@gmail.com"
] | tux4096@gmail.com |
8d5f26299ab0d8d13ad664f38b8072447122dafd | 69c22e17117c2233064e15f234e20c769e2b3c1a | /qmdzmodfiy/Classes/SelfClub.cpp | e3993baec1658ab77a4d43f49b01a44169df9176 | [] | no_license | windtrack/onlinedezhou | 85d8c83464c3d54f80db89fdee74810e5555e509 | 33faae8436cda80479f69edea51b24b4a9fabaa7 | refs/heads/master | 2021-01-17T11:37:50.672166 | 2016-06-13T05:16:13 | 2016-06-13T05:16:13 | 61,009,396 | 2 | 3 | null | null | null | null | UTF-8 | C++ | false | false | 15,369 | cpp | #include "SelfClub.h"
#include "Tools.h"
#include "Util.h"
#include "GlobalUserData.h"
#include "HttpSprite.h"
#include "external/ConvertUTF/ConvertUTF.h"
#include "GameHall.h"
#include "GameFrame.h"
#include "FrameSpriteButton.h"
#include "FrameSprite.h"
#include "GrabTouch.h"
#include "EditFamilyRole.h"
#include "FrameScale9SpriteButton.h"
#include "AllotFund.h"
USING_NS_CC ;
enum
{
RankScrollW = 816,
RankScrollH = 461
};
enum BgItem
{
ListBgItemW = 806,
ListBgItemH = 112
};
bool SelfClub::init()
{
if(!GameDialog::init("dialog/bg.png",true))
{
return false;
}
Size sz = this->getContentSize() ;
s_uiroot = CSLoader::createNode("res/ui/club_myclub.csb");
s_uiroot->ignoreAnchorPointForPosition(false);
s_uiroot->setAnchorPoint(Point(0.5,0.5));
s_uiroot->setPosition(sz.width/2,sz.height/2) ;
this->addChild(s_uiroot,1);
s_dataLoading = nullptr;
m_img_edit = static_cast<ImageView*>(Tools::getWidgetByName(s_uiroot,"Image_6")) ;
m_text_clubNotice = static_cast<Text*>(Tools::getWidgetByName(s_uiroot,"Text_1")) ;
ImageView* m_img_noticeBg= static_cast<ImageView*>(Tools::getWidgetByName(s_uiroot,"Image_5")) ;
Size szCount = m_img_noticeBg->getContentSize();
m_editBox_Notice = CreateNode2AndPosAddTo<ui::EditBox>(Size(szCount.width, szCount.height), ui::Scale9Sprite::create("res/ui/bgedit.png") , szCount.width/2, szCount.height/2, m_img_noticeBg, 0);
m_editBox_Notice->setFont("fzlt.ttf", 24);
m_editBox_Notice->setFontColor(Color3B::BLACK);
m_editBox_Notice->setInputMode(ui::EditBox::InputMode::SINGLE_LINE);
m_editBox_Notice->setReturnType(ui::EditBox::KeyboardReturnType::DONE);
m_editBox_Notice->setDelegate(this);
// 头像
m_bt_editIcon = static_cast<Button*>(Tools::getWidgetByName(s_uiroot,"Button_editIcon")) ;
m_bt_editIcon->addTouchEventListener(CC_CALLBACK_2(SelfClub::OnMenuItemSelect, this));
auto pClipMask = Sprite::create("family/club_iconmask.png");
pClipMask->setPosition(m_bt_editIcon->getContentSize().width/2,m_bt_editIcon->getContentSize().height/2);
pClipMask->retain();
cocos2d::ClippingNode *m_pClipTouXiang = CreateNodeAndPosAddTo<ClippingNode>(0,0, m_bt_editIcon, 0);
m_pClipTouXiang->setContentSize(Size(195, 195));
m_httpSprite_clubIcon = CreateNode2AndPosAddTo<HttpSprite>("family/defaulticon.png", Size(188, 188), 0, 0, m_pClipTouXiang, 0);
m_httpSprite_clubIcon->ignoreAnchorPointForPosition(false);
m_httpSprite_clubIcon->setAnchorPoint(Point(0.5,0.5));
m_httpSprite_clubIcon->setPosition(m_bt_editIcon->getContentSize().width/2,m_bt_editIcon->getContentSize().height/2);
m_pClipTouXiang->setStencil(pClipMask);
m_pClipTouXiang->setAlphaThreshold(0.5);
g_globalMyFamilyInfo.WaitChange( std::bind(&SelfClub::updateIcon, this));
m_text_clubName = static_cast<Text*>(Tools::getWidgetByName(s_uiroot,"Text_clubname")) ;
m_text_clubFund = static_cast<Text*>(Tools::getWidgetByName(s_uiroot,"Text_money")) ;
m_bt_FundInfo = static_cast<Button*>(Tools::getWidgetByName(s_uiroot,"Button_fundinfo")) ;
m_bt_FundInfo->addTouchEventListener(CC_CALLBACK_2(SelfClub::OnMenuItemSelect, this));
m_bt_QuitClub = static_cast<Button*>(Tools::getWidgetByName(s_uiroot,"Button_quite")) ;
m_bt_QuitClub->addTouchEventListener(CC_CALLBACK_2(SelfClub::OnMenuItemSelect, this));
m_bt_invateRole = static_cast<Button*>(Tools::getWidgetByName(s_uiroot,"Button_invate")) ;
m_bt_invateRole->addTouchEventListener(CC_CALLBACK_2(SelfClub::OnMenuItemSelect, this));
m_imgNoRoleTips = static_cast<ImageView*>(Tools::getWidgetByName(s_uiroot,"Image_noplayer")) ;
m_text_curRole = static_cast<Text*>(Tools::getWidgetByName(s_uiroot,"Text_playernum")) ;
m_text_maxRole = static_cast<Text*>(Tools::getWidgetByName(s_uiroot,"Text_playernum")) ;
m_img_editIcon = static_cast<ImageView*>(Tools::getWidgetByName(s_uiroot,"Image_8")) ;
Layout* m_allRole = static_cast<Layout*>(Tools::getWidgetByName(s_uiroot,"Panel_playershow")) ;
sizeListView.width = m_allRole->getContentSize().width;
sizeListView.height = m_allRole->getContentSize().height;
m_pScrollView = CreateNode1AndPosAddTo<extension::ScrollView>(sizeListView,-10,4,m_allRole,0);
m_pScrollView->setContentSize(sizeListView);
m_pScrollView->setBounceable(true);
m_pScrollView->setSwallowsTouches(false) ;
m_pScrollView->setDirection(extension::ScrollView::Direction::VERTICAL);
m_pScrollView->setVisible(true);
return true ;
}
void SelfClub::setVisible(bool bVisible)
{
if (bVisible)
{
callShowAction() ;
}
else
{
callHideAction() ;
}
}
void SelfClub::updateSelfClubInfo()
{
//g_globaSelfJoinClub
//g_globalMyFamilyInfo.get
if (g_globalMyFamilyInfo.m_isOwner)
{
m_imgNoRoleTips->setVisible(g_globalMyFamilyInfo.m_allTopRank.size()<=0) ;
}
else
{
m_imgNoRoleTips->setVisible(false) ;
}
updateIcon();
char buff[64];
setUITextString(m_text_clubName,g_globalMyFamilyInfo.m_familyName.c_str());
setUITextString(m_text_clubFund,FormatCash(g_globalMyFamilyInfo.m_fund).c_str());
m_str_notice = g_globalMyFamilyInfo.m_familyNotice.c_str();
setUITextString(m_text_clubNotice,g_globalMyFamilyInfo.m_familyNotice.c_str());
sprintf(buff,"(%d/%d)",g_globalMyFamilyInfo.m_curRoleCount,g_globalMyFamilyInfo.m_maxRoleCount) ;
setUITextString(m_text_curRole,buff);
m_img_editIcon->setVisible(g_globalMyFamilyInfo.m_isOwner);
m_img_edit->setVisible(g_globalMyFamilyInfo.m_isOwner);
m_bt_editIcon->setEnabled(g_globalMyFamilyInfo.m_isOwner) ;
m_bt_invateRole->setVisible(g_globalMyFamilyInfo.m_isOwner) ;
m_editBox_Notice->setEnabled(g_globalMyFamilyInfo.m_isOwner);
updateAllRoleView() ;
}
void SelfClub::OnMenuItemSelect(cocos2d::Ref *pSend, cocos2d::ui::Button::TouchEventType type)
{
if (type == Button::TouchEventType::ENDED)
{
if (pSend == m_bt_FundInfo)
{
g_pGameFrame->showSelfFundLayer(true,1) ;
}
else if (pSend == m_bt_invateRole)
{
auto pHall = dynamic_cast<GameHall*>(getParent());
pHall->showInviteFriends(true) ;
}
else if (pSend == m_bt_QuitClub)
{
if (g_globalMyFamilyInfo.m_isOwner)
{
PopTipWithBt1("您需要转让俱乐部后才能退出!", "确定", nullptr);
}
else
{
PopTipWithBt2("是否确定退出俱乐部!","退出","取消",[](unsigned ubt)
{
if(ubt == 0)
{
Json::Value param;
param["user_id"] = g_globalMyData.m_iUserId;
param["group_id"] = g_globalMyFamilyInfo.m_familyID;
SendClientRequest(ClientRequest::kPushOutFamily, param);
}
});
}
}
else if (pSend == m_bt_editIcon)
{
if (!g_globalMyFamilyInfo.m_isOwner)
{
return ;
}
auto pHall = dynamic_cast<GameHall*>(getParent());
pHall->showChooseFamilyIcon(true);
}
}
}
void SelfClub::editBoxEditingDidBegin(EditBox* editBox)
{
if (editBox == m_editBox_Notice)
{
editBox->setText(m_str_notice.c_str()) ;
}
}
void SelfClub::editBoxReturn(cocos2d::ui::EditBox* editBox)
{
if (editBox == m_editBox_Notice)
{
m_editBox_Notice->setVisible(true) ;
std::string s_gonggao = editBox->getText();
auto pStr = s_gonggao.c_str();
const UTF8*pUtf8Str = (const UTF8*)pStr;
const UTF8*pUtf8End = (const UTF8*)(pStr + strlen(pStr));
unsigned uL = getUTF8StringLength(pUtf8Str);
if (uL>30)
{
setUITextString(m_text_clubNotice,m_str_notice.c_str());
editBox->setText("") ;
PopTipWithBt1("公告字数过度,请输入小于30个字","确定",nullptr);
return ;
}
setUITextString(m_text_clubNotice,s_gonggao);
m_str_notice = s_gonggao ;
editBox->setText("") ;
//修改俱乐部公告EditFamliyNotice
Json::Value msg;
msg["fnotice"] = s_gonggao;
msg["ufamilyid"] = g_globalMyFamilyInfo.m_familyID;
SendClientRequest(ClientRequest::kEditFamliyNotice,msg);
}
}
void SelfClub::updateIcon()
{
if (g_globalMyData.GetFamilySkin(g_globalMyFamilyInfo.getFamilyIconID()).m_strIconUrl!="")
{
SetFamilyIconUrl(m_httpSprite_clubIcon, g_globalMyData.GetFamilySkin(g_globalMyFamilyInfo.getFamilyIconID()).m_strIconUrl);
}
else
{
m_httpSprite_clubIcon->ResetToLocalSprite("family/defaulticon.png");
}
}
void SelfClub::updateAllRoleView()
{
//log("update view %d", uType);
for(auto item:m_vecFollowListInfoNew)
{
item->m_pSpriteBgItem->setVisible(false);
m_vecFollowListInfoOld.push_back(item);
}
m_vecFollowListInfoNew.clear();
unsigned uCount = g_globalMyFamilyInfo.m_allTopRank.size();
unsigned ListBgItemH = 686;
unsigned uItemH = 112;
unsigned fRealH = uCount * uItemH;
if(fRealH < sizeListView.height)
{
fRealH = sizeListView.height;
}
float fX = sizeListView.width / 2+10;
float fY = fRealH - uItemH / 2 ;
for(auto& followList:g_globalMyFamilyInfo.m_allTopRank)
{
auto item = GetFamilyListItem(followList);
UpdateItem(item, followList);
item->m_pSpriteBgItem->setPosition(fX, fY);
item->m_pSpriteBgItem->setVisible(true);
m_vecFollowListInfoNew.push_back(item);
fY -= uItemH;
}
float temp = fRealH - sizeListView.height;
//每次都显示滚动框的最上面
m_pScrollView->setContentOffset(Vec2(0,-temp), false);
m_pScrollView->setContentSize(Size(sizeListView.width,fRealH));
m_pScrollView->setViewSize(sizeListView);
setShowDataLoading(false) ;
}
SelfClub::RankRoleItem *SelfClub::GetFamilyListItem(FamilyRoleBaseInfo baseInfo)
{
RankRoleItem *item = nullptr;
Scale9Sprite *bgItem = Scale9Sprite::create("family/club_itembg.png",Rect(0,0,164,110),Rect(46,25,160-46*2,110-67));
bgItem->setPreferredSize(Size(584,110)) ;
m_pScrollView->addChild(bgItem) ;
unsigned m_uid = baseInfo.m_uid ;
auto btDetail = LayerButton::create(false, true);
bgItem->addChild(btDetail);
auto pClipMask = Sprite::create("family/iconclipmask.png");
auto sz = pClipMask->getContentSize();
pClipMask->setPosition(sz.width / 2, sz.height / 2);
pClipMask->retain();
auto pClip = CreateNodeAndPosAddTo<ClippingNode>(18,10, bgItem, 0);
pClip->setContentSize(sz);
auto m_pHettpSpriteIcon = CreateNode2AndPosAddTo<HttpSprite>("defaulticon.png", sz, 0, 0, pClip, 0);
auto m_pSpriteNormalIcon = CreateNode1AndPosAddTo<Sprite>("family/gf_family_icon.png", 18 + sz.width / 2,10 + sz.height / 2, bgItem, 0);
auto m_pSpriteOwnerIcon = CreateNode1AndPosAddTo<Sprite>("family/club_ownericon.png", 18 + sz.width / 2,10 + sz.height / 2, bgItem, 0);
pClip->setStencil(pClipMask);
pClip->setAlphaThreshold(0.5);
//人物名称
auto labelName = CreateLabelMSYHAndAnchorPosClrAddTo(26,"",Vec2(0,0.5),123,78,Color4B(0xff,0xd2,0x00,0xff),bgItem,0);
//已分配
auto hasFengpei = CreateLabelMSYHAndAnchorPosClrAddTo(22,"已分配",Vec2(0,0.5),123,17,Color4B(0x79,0xdc,0x98,0xff),bgItem,0);
auto label_owner = CreateLabelMSYHAndAnchorPosClrAddTo(20,"俱乐部所有者",Vec2(0,0.5),123,47,Color4B(0x50,0xbd,0x2e,0xff),bgItem,0);
//加入按钮
auto JiaRuBg = FrameScale9SpriteButton::createWithScale9Sprite(1, Size(132, 54),false,true);
auto labeljiaru = CreateLabelMSYHBDAndAnchorPosClrAddTo(30,"分配",Vec2(0.5,0.5),0,0,Color4B::WHITE,JiaRuBg,0);
JiaRuBg->setPosition(477+15,110/2);
bgItem->addChild(JiaRuBg);
auto pItem = new RankRoleItem;
pItem->m_pSpriteBgItem = bgItem;
pItem->m_pBtDetail = btDetail;
pItem->m_pHttpSpriteIcon = m_pHettpSpriteIcon;
pItem->m_pSpriteNormalIcon = m_pSpriteNormalIcon ;
pItem->m_pSpriteOwnerIcon = m_pSpriteOwnerIcon ;
pItem->m_familyName = labelName;
pItem->m_uid = m_uid ;
pItem->m_pBtCon = JiaRuBg ;
pItem->m_hasCash = hasFengpei ;
pItem->m_Owner = label_owner ;
item = pItem;
//背景回调
item->m_pBtDetail->setContentSize(Size(RankScrollW,106));
return item;
}
void SelfClub::UpdateItem(SelfClub::RankRoleItem *item, const FamilyRoleBaseInfo& followInfo)
{
item->m_uid = followInfo.m_uid ;
char s_buf[64] ;
//头像
SetIconUrl(item->m_pHttpSpriteIcon, followInfo.m_iconUrl);
item->m_pSpriteOwnerIcon->setVisible(followInfo.m_isOwnner) ;
item->m_pSpriteNormalIcon->setVisible(!followInfo.m_isOwnner) ;
//名称
SetLabelString(item->m_familyName,followInfo.m_uname.c_str());
sprintf(s_buf,"已分配:%s",FormatCash(followInfo.m_hasCash).c_str()) ;
//排名
SetLabelString(item->m_hasCash,s_buf);
item->m_pBtDetail->setContentSize(Size(415,95));
item->m_pBtDetail->SetHitCB(std::bind(&SelfClub::menuClickBgItem, this,followInfo));
item->m_pBtCon->SetHitCB(std::bind(&SelfClub::doAllotFund, this,followInfo));
item->m_pBtCon->setVisible(g_globalMyFamilyInfo.m_isOwner) ;
item->m_hasCash->setVisible(g_globalMyFamilyInfo.m_isOwner);
item->m_Owner->setVisible(followInfo.m_isOwnner) ;
}
void SelfClub::doAllotFund(FamilyRoleBaseInfo baseInfo)
{
auto pHall = dynamic_cast<GameHall*>(getParent());
pHall->showAllotFund(true,g_globalMyFamilyInfo.m_familyID,baseInfo.m_uid,g_globalMyData.m_iUserId,baseInfo.m_uname) ;
}
void SelfClub::menuClickBgItem(FamilyRoleBaseInfo baseInfo)
{
auto pHall = dynamic_cast<GameHall*>(getParent());
if (!g_globalMyFamilyInfo.m_isOwner)
{
Json::Value param;
param["tid"] = baseInfo.m_uid;
SendClientRequest(ClientRequest::kPopUserDetailInfo, param);
return ;
}
//点的自己
if (g_globalMyData.m_iUserId==baseInfo.m_uid)
{
Json::Value param;
param["tid"] = baseInfo.m_uid;
SendClientRequest(ClientRequest::kPopUserDetailInfo, param);
return ;
}
if (g_globalMyFamilyInfo.m_isOwner)
{
pHall->showEditFamilyRole(true,baseInfo.m_uid,baseInfo.m_uname,(Edit_LookInf0|Edit_To_EditFund|Edit_ChangeShaikh|Edit_Push));
}
}
void SelfClub::setShowDataLoading(bool flag)
{
if (s_dataLoading == nullptr)
{
s_dataLoading = Tools::creatDataLoading(this,587, 266,99) ;
}
s_dataLoading->setVisible(flag) ;
}
void SelfClub::updateRoleFund(double clubFund,unsigned uid,double uFund)
{
g_globalMyFamilyInfo.m_fund = clubFund ;
setUITextString(m_text_clubFund,FormatCash(clubFund).c_str());
for (auto &role:g_globalMyFamilyInfo.m_allTopRank)
{
if (role.m_uid == uid)
{
role.m_hasCash = uFund ;
for(auto item:m_vecFollowListInfoNew)
{
if (item->m_uid == uid)
{
UpdateItem(item,role);
}
}
}
}
}
void SelfClub::updateNotice(std::string notice)
{
m_str_notice = notice;
g_globalMyFamilyInfo.m_familyNotice = notice ;
setUITextString(m_text_clubNotice,m_str_notice.c_str());
}
void SelfClub::updateRoleItem(const FamilyRoleBaseInfo& baseInfo)
{
for(auto item:m_vecFollowListInfoNew)
{
if (item->m_uid == baseInfo.m_uid)
{
UpdateItem(item,baseInfo);
}
}
}
void SelfClub::removeRole(unsigned uid)
{
for(int i=0; i<m_vecFollowListInfoNew.size(); i++)
{
if(m_vecFollowListInfoNew[i]->m_uid == uid)
{
unsigned uItemH = ListBgItemH;
m_vecFollowListInfoNew[i]->m_pSpriteBgItem->setVisible(false);
m_vecFollowListInfoNew.erase(m_vecFollowListInfoNew.begin() + i);
unsigned uCount = m_vecFollowListInfoNew.size();
unsigned fRealH = uCount * uItemH;
if(fRealH < sizeListView.height)
{
fRealH = sizeListView.height;
}
float fX = sizeListView.width / 2+10;
float fY = fRealH - uItemH / 2 ;
for(auto& followList:m_vecFollowListInfoNew)
{
followList->m_pSpriteBgItem->setPosition(fX, fY);
followList->m_pSpriteBgItem->setVisible(true);
fY -= uItemH;
}
float temp = fRealH - sizeListView.height;
//每次都显示滚动框的最上面
m_pScrollView->setContentOffset(Vec2(0,-temp), false);
m_pScrollView->setContentSize(Size(sizeListView.width,fRealH));
}
}
} | [
"vergilsun@sina.com"
] | vergilsun@sina.com |
d9c70e6d3bfcabbd63f51c4cff98af71146d03cb | ceb404855b515145ac929d148679b1cbcec68025 | /Offer/41_ContinuesSquenceWithSum.cpp | a77db84747768231b94d4d64ff3261966a39b469 | [] | no_license | yananfan/CodeTest | a9e777ccb55c9725a398059a899a0da0b6a329a7 | 2c24348c7fd1854cfab7f364b9620aadba81e143 | refs/heads/master | 2020-04-24T22:10:57.272246 | 2019-12-15T10:00:53 | 2019-12-15T10:00:53 | null | 0 | 0 | null | null | null | null | GB18030 | C++ | false | false | 913 | cpp | //#define _ContinuesSquenceWithSum_
#ifdef _ContinuesSquenceWithSum_
#include<iostream>
using namespace std;
void PrintContinuousSequence(int small, int big);
void FindContinuousSequence(int sum);
int main()
{
int sum = 1;
while (sum) {
cout << "输入一个正数:" << endl;
cin >> sum;
FindContinuousSequence(sum);
}
return 0;
}
void PrintContinuousSequence(int small, int big) {
for (int i = small;i <= big;i++)
cout << i << " ";
cout << endl;
}
void FindContinuousSequence(int sum) {
if (sum < 3) {
cout << sum << " < 3." << endl;
return;
}
int p1 = 1, p2 = 2;
int mid = (1 + sum) / 2;
int tempSum = p1 + p2;
while (p1 < mid) {
if (tempSum == sum)
PrintContinuousSequence(p1, p2);
while (tempSum > sum && p1 < mid) {
tempSum -= p1;
p1++;
if (tempSum == sum)
PrintContinuousSequence(p1, p2);
}
p2++;
tempSum += p2;
}
}
#endif // _ContinuesSquenceWithSum_ | [
"ynfanstudy@sina.com"
] | ynfanstudy@sina.com |
6a4c0c02653063e928f11a612261c679565a9008 | 8dc84558f0058d90dfc4955e905dab1b22d12c08 | /components/offline_pages/core/background/pending_state_updater.cc | bf2e70acc0960085da5cd8197169bfd9e929d387 | [
"LicenseRef-scancode-unknown-license-reference",
"BSD-3-Clause"
] | permissive | meniossin/src | 42a95cc6c4a9c71d43d62bc4311224ca1fd61e03 | 44f73f7e76119e5ab415d4593ac66485e65d700a | refs/heads/master | 2022-12-16T20:17:03.747113 | 2020-09-03T10:43:12 | 2020-09-03T10:43:12 | 263,710,168 | 1 | 0 | BSD-3-Clause | 2020-05-13T18:20:09 | 2020-05-13T18:20:08 | null | UTF-8 | C++ | false | false | 2,327 | cc | // Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "components/offline_pages/core/background/pending_state_updater.h"
#include "components/offline_items_collection/core/pending_state.h"
#include "components/offline_pages/core/background/request_coordinator.h"
namespace offline_pages {
PendingStateUpdater::PendingStateUpdater(
RequestCoordinator* request_coordinator)
: request_coordinator_(request_coordinator),
requests_pending_another_download_(false),
weak_ptr_factory_(this) {}
PendingStateUpdater::~PendingStateUpdater() {}
void PendingStateUpdater::UpdateRequestsOnLossOfNetwork() {
requests_pending_another_download_ = false;
request_coordinator_->GetAllRequests(
base::BindOnce(&PendingStateUpdater::NotifyChangedPendingStates,
weak_ptr_factory_.GetWeakPtr()));
}
void PendingStateUpdater::UpdateRequestsOnRequestPicked(
const int64_t picked_request_id,
std::unique_ptr<std::vector<SavePageRequest>> available_requests) {
// Requests do not need to be updated.
if (requests_pending_another_download_)
return;
// All available requests expect for the picked request changed to waiting
// for another download to complete.
for (auto& request : *available_requests) {
if (request.request_id() != picked_request_id) {
request.set_pending_state(PendingState::PENDING_ANOTHER_DOWNLOAD);
request_coordinator_->NotifyChanged(request);
}
}
requests_pending_another_download_ = true;
}
void PendingStateUpdater::SetPendingState(SavePageRequest& request) {
if (request.request_state() == SavePageRequest::RequestState::AVAILABLE) {
if (request_coordinator_->state() ==
RequestCoordinator::RequestCoordinatorState::OFFLINING) {
request.set_pending_state(PendingState::PENDING_ANOTHER_DOWNLOAD);
} else {
requests_pending_another_download_ = false;
request.set_pending_state(PendingState::PENDING_NETWORK);
}
}
}
void PendingStateUpdater::NotifyChangedPendingStates(
std::vector<std::unique_ptr<SavePageRequest>> requests) {
for (const auto& request : requests) {
request_coordinator_->NotifyChanged(*request);
}
}
} // namespace offline_pages
| [
"arnaud@geometry.ee"
] | arnaud@geometry.ee |
ffefb7ad5bae7ad89576874080103b2e78b35f5c | c75a6d975a721c18222fdf2f53ca854a137eb557 | /lib/lib.cpp | f3573fc43c11badf881ceed5338f81e73b1d19af | [] | no_license | JackShieh529/TOMGRO.TokairinLab_2019 | 4c857125bbb76b9edf50f9765cbd1fded6d643b2 | 9ed574f9c903240f9ed5f467d53ffecb6c778ef1 | refs/heads/master | 2021-01-02T15:44:33.120589 | 2019-06-21T09:20:24 | 2019-06-21T09:20:24 | 239,688,524 | 1 | 0 | null | 2020-02-11T06:02:56 | 2020-02-11T06:02:55 | null | UTF-8 | C++ | false | false | 1,194 | cpp | #include "lib.hpp"
#include <iostream>
#include <vector>
#include <boost/property_tree/ptree.hpp>
#include <boost/property_tree/json_parser.hpp>
#include <boost/foreach.hpp>
#include <boost/optional.hpp>
namespace tomgro{
//PRIVATE FUNCTION
private std::vector<std::string> split(std::string& input, char delimiter){
std::istringstream stream(input);
std::string field;
std::vector<std::string> result;
while (getline(stream, field, delimiter)) {
result.push_back(field);
}
return result;
}
private fixIndex(std::string &replacedStr){
}
void FileIO::test(){
std::cout << "Hello World!" << std::endl;
}
std::unordered_map<std::string, double> FileIO::inputData(std::string fileName){
std::ifstream ifs(fileName);
if(!ifs.is_open()){
std::unordered_map<std::string, double> fault{{"Error", -1}};
return fault;
}
while (!ifs.eof()){
std::string buffer;
ifs >> buffer;
std::cout << buffer << std::endl;
}
}
//std::unordered_map<std::string, double> FileIO::initialCondition(std::string fileName);
//std::unordered_map<std::string, double> FileIO::inputWeather(std::string fileName);
} | [
"shota.y2011@gmail.com"
] | shota.y2011@gmail.com |
9aa62ebafc106f50b84b10ef6d9a84afbd65a1e4 | c7d4d31e26e4ee4a13f21050fc8a96005b1a2a24 | /ABC090/C.cpp | 1a46d1701dac7c8aa35d1042593c573433933843 | [] | no_license | motacapla/ProgrammingContest-Atcoder-etc- | c26840bf435159ed46c44b3ec37f0ad6e4a722e5 | a647b9656b1656ce7da73f8e66a54d353765717b | refs/heads/master | 2021-10-28T06:25:40.276550 | 2021-10-23T11:29:37 | 2021-10-23T11:29:37 | 141,571,371 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 376 | cpp | #include <iostream>
#include <algorithm>
using namespace std;
const int e = 1e9;
int
main(void){
int n, m;
cin>>n>>m;
long long count = 0L;
int one = 1;
if(n == 1 && m == 1){cout << one << endl;}
else if(n == 1 && m > 1){cout << m-2 << endl;}
else if(m == 1 && n > 1){cout << n-2 << endl;}
else{
cout << (m-2)*(n-2) << endl;
}
return 0;
}
| [
"tikeda@IN6-MAC-tikeda.local"
] | tikeda@IN6-MAC-tikeda.local |
e326c79d4c1b17627cdbe46b5982b74db5114922 | 757f737bc70aed0293b61a8d4e6c397a077de025 | /ocr_2/predict.h | ebd63e60e04a490094c58021de1e1382389118a1 | [] | no_license | zgsxwsdxg/ocr3 | f4085f1460703ae7f37185641dae52b0ae257127 | fb3a994b0703daebcd71cd6b24b0297eebf2b29f | refs/heads/master | 2021-01-20T12:21:28.974680 | 2016-01-07T01:22:37 | 2016-01-07T01:22:37 | null | 0 | 0 | null | null | null | null | GB18030 | C++ | false | false | 779 | h |
#ifndef _PREDICT_H_
#define _PREDICT_H_
#include<vector>
#include<opencv2\opencv.hpp>
//实现特征提取并预测的函数
/*
*输入 resultpath 结果路径
*输入 vvM 二维字块数组
*返回值 0,代表正常
*/
int predict(const char* resultpath, const std::vector<std::vector<cv::Mat>>& vvM);
/*
*输入 vvM 二维字块数组
*输出 vvi 根据vvM字块预测的结果(汉字在字典的标号,用int 类型表示),二维数组
*返回值 0,代表正常 ,负值代表异常
*/
int predict(const std::vector<cv::Mat>& vM, std::vector<int>& vi);
//备用接口,暂时不用管
/*
*输入 charMat 分割好的字符
*
*返回值 汉字在字典的标号,用int 类型表示, 负值代表异常
*/
int predict(const cv::Mat& charMat);
#endif | [
"1099905725@qq.com"
] | 1099905725@qq.com |
8b7f5e596d50409267eac55fd0bdeb06e5994bbe | ba55358fd3311f51921b1f306d49ac703e8d5245 | /app/linAdvEuler/0/rho_Ref | ef8ba7c407ca9cd31b1ec3f827a5e25bbcd143b0 | [
"BSD-3-Clause",
"MPL-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | vachan-potluri/MEANDG | c90548fbf69032ab0c81dcbb599714f7e9c18ff9 | a4a22653b5d71b186e179519b0d26a21d3faf1b5 | refs/heads/master | 2020-06-05T16:11:51.118808 | 2019-06-25T06:52:31 | 2019-06-25T06:52:31 | 192,481,019 | 0 | 0 | BSD-3-Clause | 2019-06-18T06:40:10 | 2019-06-18T06:40:09 | null | UTF-8 | C++ | false | false | 3,404 | /*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 2.4.0 |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
location "0";
object rho;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 0 0 1 0 0 0];
internalField nonuniform List<scalar>
270
(
0.58072
0.58072
0.58072
0.58072
0.58072
0.58072
0.58072
0.58072
0.58072
0.58072
0.58072
0.58072
0.58072
0.58072
0.58072
0.116144
0.116144
0.116144
0.116144
0.116144
0.116144
0.116144
0.116144
0.116144
0.116144
0.116144
0.116144
0.116144
0.116144
0.116144
0.58072
0.58072
0.58072
0.58072
0.58072
0.58072
0.58072
0.58072
0.58072
0.58072
0.58072
0.58072
0.58072
0.58072
0.58072
0.116144
0.116144
0.116144
0.116144
0.116144
0.116144
0.116144
0.116144
0.116144
0.116144
0.116144
0.116144
0.116144
0.116144
0.116144
0.58072
0.58072
0.58072
0.58072
0.58072
0.58072
0.58072
0.58072
0.58072
0.58072
0.58072
0.58072
0.58072
0.58072
0.58072
0.116144
0.116144
0.116144
0.116144
0.116144
0.116144
0.116144
0.116144
0.116144
0.116144
0.116144
0.116144
0.116144
0.116144
0.116144
0.58072
0.58072
0.58072
0.58072
0.58072
0.58072
0.58072
0.58072
0.58072
0.58072
0.58072
0.58072
0.58072
0.58072
0.58072
0.116144
0.116144
0.116144
0.116144
0.116144
0.116144
0.116144
0.116144
0.116144
0.116144
0.116144
0.116144
0.116144
0.116144
0.116144
0.58072
0.58072
0.58072
0.58072
0.58072
0.58072
0.58072
0.58072
0.58072
0.58072
0.58072
0.58072
0.58072
0.58072
0.58072
0.116144
0.116144
0.116144
0.116144
0.116144
0.116144
0.116144
0.116144
0.116144
0.116144
0.116144
0.116144
0.116144
0.116144
0.116144
0.58072
0.58072
0.58072
0.58072
0.58072
0.58072
0.58072
0.58072
0.58072
0.58072
0.58072
0.58072
0.58072
0.58072
0.58072
0.116144
0.116144
0.116144
0.116144
0.116144
0.116144
0.116144
0.116144
0.116144
0.116144
0.116144
0.116144
0.116144
0.116144
0.116144
0.58072
0.58072
0.58072
0.58072
0.58072
0.58072
0.58072
0.58072
0.58072
0.58072
0.58072
0.58072
0.58072
0.58072
0.58072
0.116144
0.116144
0.116144
0.116144
0.116144
0.116144
0.116144
0.116144
0.116144
0.116144
0.116144
0.116144
0.116144
0.116144
0.116144
0.58072
0.58072
0.58072
0.58072
0.58072
0.58072
0.58072
0.58072
0.58072
0.58072
0.58072
0.58072
0.58072
0.58072
0.58072
0.116144
0.116144
0.116144
0.116144
0.116144
0.116144
0.116144
0.116144
0.116144
0.116144
0.116144
0.116144
0.116144
0.116144
0.116144
0.58072
0.58072
0.58072
0.58072
0.58072
0.58072
0.58072
0.58072
0.58072
0.58072
0.58072
0.58072
0.58072
0.58072
0.58072
0.116144
0.116144
0.116144
0.116144
0.116144
0.116144
0.116144
0.116144
0.116144
0.116144
0.116144
0.116144
0.116144
0.116144
0.116144
)
;
boundaryField
{
inlet
{
type zeroGradient;
}
outlet
{
type zeroGradient;
}
sides
{
type zeroGradient;
}
}
// ************************************************************************* //
| [
"smjoshi07@gmail.com"
] | smjoshi07@gmail.com | |
be447e7adb945e4c684d38a085ea925ac66b3655 | 4e8d0a92f6058f0635610fa8bf390f29bbe7c9a4 | /Game/Game/PauseScreen.h | 86ca5e0b7223bbd20e29b3286f9e2b9629783b05 | [] | no_license | anasawad/The_Invaders | 5e69f3854a67eaa2c25665e955778088a95abd55 | ed9ec9439a8952aa578a532d3f6febbc4296093a | refs/heads/master | 2021-01-02T08:19:30.126292 | 2012-07-17T03:48:30 | 2012-07-17T03:48:30 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,158 | h | #ifndef PAUSESCREEN_H_
#define PAUSESCREEN_H_
#include "AllIncludes.h"
class PauseScreen:public Screen, public IDrawable
{
private:
struct MenuItems
{
Screen* _ptrScreen;
char* title;
};
static const bool is2D = true;
static const int SIZE = 4;
int select_index ;
SaveAndLoad *s;
MenuItems menuItemsArray[SIZE];
void DrawCanvase()
{
glBegin(GL_QUADS);
glTexCoord2d(0.0,0.0);
glVertex2f(-10.f, -10.f);
glTexCoord2d(1.0,0.0);
glVertex2f(10.f, -10.f);
glTexCoord2d(1.0,1.0);
glVertex2f(10.f, 10.f);
glTexCoord2d(0.0,1.0);
glVertex2f(-10.f, 10.f);
glEnd();
}
public:
PauseScreen(int texture,SaveAndLoad &sa)
{
this->texture = texture;
s = &sa;
}
PauseScreen(int texture)
{
this->texture = texture;
}
bool Is2D(){return this->is2D;}
void Initialize()
{
select_index = 0;
menuItemsArray[0]._ptrScreen = NULL;
menuItemsArray[0].title = "Continue";
menuItemsArray[1]._ptrScreen = new LoadScreen();
menuItemsArray[1].title = "Load";
menuItemsArray[2]._ptrScreen = new SaveScreen(*s);
menuItemsArray[2].title = "Save";
menuItemsArray[3]._ptrScreen= new ExitScreen();
menuItemsArray[3].title = "Exit";
}
void Draw()
{
glEnable(GL_TEXTURE_1D);
glDisable(GL_LIGHTING);
glBindTexture(GL_TEXTURE_2D,texture);
glClearColor(1,1,1,1);
glScalef(10, 10, 10);
DrawCanvase();
int yPos = 2;
for ( int i = 0 ; i < SIZE ; i ++ )
{
if ( select_index == i )
glColor3f(0,.5,1);
else
glColor3f(1,1,1);
TextHelper::DrawString(-2,yPos-3-i, GLUT_BITMAP_TIMES_ROMAN_24, menuItemsArray[i].title);
}
glColor3f(1,1,1);
glEnable(GL_LIGHTING);
}
void Update()
{
}
void GetSpecialDownPress(int key)
{
if ( key == GLUT_KEY_DOWN )
select_index = min(SIZE-1, select_index+1);
else if ( key == GLUT_KEY_UP )
select_index = max(0, select_index-1);
}
void GetKeyboardDownPress(int key)
{
if(key == 27)
ScreenManager::RemoveScreen();
if ( key == '\r' )
{
if(menuItemsArray[select_index].title == "Continue")
ScreenManager::RemoveScreen();
else
{
ScreenManager::AddScreen(menuItemsArray[select_index]._ptrScreen);
}
}
}
};
#endif | [
"eng.anas.awad@gmail.com"
] | eng.anas.awad@gmail.com |
14d44edb1edc904a95e7fe64e71bf5535eae2d8a | b2109a078a2fc321f98b7a96c9f06927b60a2a7c | /ftnoir_filter_ewma2/ftnoir_filter_ewma2.h | f3422a71325cb15410240e5efb146b803c7d7fbe | [] | no_license | dbaarda/facetracknoir-posix | bfdf33198d251d7594fff0ae8ab224828260afdb | 4609f66b337d064462208c304461f00d7525f092 | refs/heads/master | 2016-09-05T15:16:48.133356 | 2013-02-25T04:23:35 | 2013-02-25T04:23:35 | 8,289,382 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,441 | h | /********************************************************************************
* FaceTrackNoIR This program is a private project of some enthusiastic *
* gamers from Holland, who don't like to pay much for *
* head-tracking. *
* *
* Copyright (C) 2012 Wim Vriend (Developing) *
* Ron Hendriks (Researching and Testing) *
* *
* Homepage *
* *
* This program is free software; you can redistribute it and/or modify it *
* under the terms of the GNU General Public License as published by the *
* Free Software Foundation; either version 3 of the License, or (at your *
* option) any later version. *
* *
* This program is distributed in the hope that it will be useful, but *
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for *
* more details. *
* *
* You should have received a copy of the GNU General Public License along *
* with this program; if not, see <http://www.gnu.org/licenses/>. *
* *
********************************************************************************/
#pragma once
#ifndef INCLUDED_FTN_FILTER_H
#define INCLUDED_FTN_FILTER_H
#include "ftnoir_filter_base/ftnoir_filter_base.h"
#include "facetracknoir/global-settings.h"
#include "ui_ftnoir_ewma_filtercontrols.h"
#include <QWidget>
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
// EWMA Filter: Exponentially Weighted Moving Average filter with dynamic smoothing parameter
//
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
class FTNoIR_Filter : public IFilter
{
public:
FTNoIR_Filter();
~FTNoIR_Filter();
void Initialize();
void FilterHeadPoseData(THeadPoseData *current_camera_position, THeadPoseData *target_camera_position, THeadPoseData *new_camera_position, bool newTarget);
private:
void loadSettings(); // Load the settings from the INI-file
THeadPoseData newHeadPose; // Structure with new headpose
bool first_run;
float smoothing_frames_range;
float alpha_smoothing;
float prev_alpha[6];
float alpha[6];
float smoothed_alpha[6];
float kMinSmoothing;
float kMaxSmoothing;
float kSmoothingScaleCurve;
};
//*******************************************************************************************************
// FaceTrackNoIR Filter Settings-dialog.
//*******************************************************************************************************
// Widget that has controls for FTNoIR protocol filter-settings.
class FilterControls: public QWidget, Ui::UICFilterControls, public IFilterDialog
{
Q_OBJECT
public:
explicit FilterControls();
virtual ~FilterControls();
void showEvent ( QShowEvent * event );
void Release(); // Member functions which are accessible from outside the DLL
void Initialize(QWidget *parent, IFilter* ptr);
private:
Ui::UICFilterControls ui;
void loadSettings();
void save();
/** helper **/
bool settingsDirty;
IFilter* pFilter; // If the filter was active when the dialog was opened, this will hold a pointer to the Filter instance
private slots:
void doOK();
void doCancel();
void settingChanged() { settingsDirty = true; };
void settingChanged( int ) { settingsDirty = true; };
};
//*******************************************************************************************************
// FaceTrackNoIR Filter DLL. Functions used to get general info on the Filter
//*******************************************************************************************************
class FTNoIR_FilterDll : public Metadata
{
public:
FTNoIR_FilterDll();
~FTNoIR_FilterDll();
void Release();
void Initialize();
void getFullName(QString *strToBeFilled) { *strToBeFilled = QString("EWMA Filter Mk2"); };
void getShortName(QString *strToBeFilled) { *strToBeFilled = QString("EWMA"); };
void getDescription(QString *strToBeFilled) { *strToBeFilled = QString("Exponentially Weighted Moving Average filter with dynamic smoothing parameter"); };
void getIcon(QIcon *icon){ *icon = QIcon(":/images/filter-16.png"); };
};
#endif //INCLUDED_FTN_FILTER_H
//END
| [
"sthalik@misaki.pl"
] | sthalik@misaki.pl |
dde0d1b19398202ad76e48a83e6898b75b573190 | b1b734ab75a6fe114733d3c0b8ca5046d54b407d | /third_party/ComputeLibrary/src/core/NEON/kernels/NEDirectConvolutionLayerOutputStageKernel.cpp | 52880a378f3b071133422c522286790f6ba1b58e | [
"BSD-3-Clause",
"LicenseRef-scancode-generic-cla",
"BSD-2-Clause",
"Apache-2.0",
"MIT"
] | permissive | waybarrios/video_nonlocal_net_caffe2 | 754fea2b96318d677144f16faadf59cb6b00189b | b19c2ac3ddc1836d90d7d0fccb60d710c017253e | refs/heads/master | 2020-04-20T03:15:12.286080 | 2019-01-31T20:44:01 | 2019-01-31T20:44:01 | 168,593,110 | 0 | 0 | Apache-2.0 | 2019-01-31T20:40:40 | 2019-01-31T20:40:39 | null | UTF-8 | C++ | false | false | 18,274 | cpp | /*
* Copyright (c) 2017-2018 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
* deal in the Software without restriction, including without limitation the
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
* sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
#include "arm_compute/core/NEON/kernels/NEDirectConvolutionLayerOutputStageKernel.h"
#include "arm_compute/core/AccessWindowStatic.h"
#include "arm_compute/core/Error.h"
#include "arm_compute/core/Helpers.h"
#include "arm_compute/core/ITensor.h"
#include "arm_compute/core/NEON/NEAsymm.h"
#include "arm_compute/core/NEON/NEFixedPoint.h"
#include "arm_compute/core/Types.h"
#include "arm_compute/core/Validate.h"
#include "arm_compute/core/Window.h"
#include <arm_neon.h>
#include <cstddef>
#include <cstdint>
using namespace arm_compute;
namespace
{
Status validate_arguments(const ITensorInfo *input, const ITensorInfo *bias, const ITensorInfo *output)
{
ARM_COMPUTE_RETURN_ERROR_ON_NULLPTR(input);
ARM_COMPUTE_RETURN_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(input, 1, DataType::QS8, DataType::QASYMM8,
DataType::QS16, DataType::F16,
DataType::QS32, DataType::S32, DataType::F32);
if(bias != nullptr)
{
ARM_COMPUTE_RETURN_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(bias, 1, DataType::QS8, DataType::QS16, DataType::F16, DataType::QS32, DataType::S32, DataType::F32);
if(is_data_type_fixed_point(input->data_type()))
{
ARM_COMPUTE_RETURN_ERROR_ON_MSG(input->data_type() == DataType::QS8 && bias->data_type() != DataType::QS8, "Wrong data type for bias");
ARM_COMPUTE_RETURN_ERROR_ON_MSG(input->data_type() == DataType::QS16 && bias->data_type() != DataType::QS8, "Wrong data type for bias");
ARM_COMPUTE_RETURN_ERROR_ON_MSG(input->data_type() == DataType::QS32 && bias->data_type() != DataType::QS16, "Wrong data type for bias");
ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_FIXED_POINT_POSITION(input, bias);
}
else
{
ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_DATA_TYPES(input, bias);
}
ARM_COMPUTE_RETURN_ERROR_ON(bias->num_dimensions() > 1);
}
else
{
ARM_COMPUTE_RETURN_ERROR_ON_MSG(!is_data_type_quantized(input->data_type()), "Calling output stage kernel with floating point arguments");
}
// Checks performed when output is configured
if((output != nullptr) && (output->total_size() != 0))
{
ARM_COMPUTE_RETURN_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(output, 1, DataType::QS8, DataType::QASYMM8, DataType::QS16, DataType::F32);
if(is_data_type_fixed_point(input->data_type()))
{
ARM_COMPUTE_RETURN_ERROR_ON_MSG(input->data_type() == DataType::QS8 && output->data_type() != DataType::QS8, "Wrong data type for output");
ARM_COMPUTE_RETURN_ERROR_ON_MSG(input->data_type() == DataType::QS16 && output->data_type() != DataType::QS8, "Wrong data type for output");
ARM_COMPUTE_RETURN_ERROR_ON_MSG(input->data_type() == DataType::QS32 && output->data_type() != DataType::QS16, "Wrong data type for output");
ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_FIXED_POINT_POSITION(input, output);
}
else if(is_data_type_quantized_asymmetric(output->data_type()))
{
ARM_COMPUTE_RETURN_ERROR_ON_MSG(input->data_type() == DataType::S32 && output->data_type() != DataType::QASYMM8, "Wrong data type for bias");
}
else
{
ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_DATA_TYPES(input, output);
}
}
return Status{};
}
std::pair<Status, Window> validate_and_configure_window(ITensorInfo *input, ITensorInfo *bias, ITensorInfo *output)
{
bool window_changed = false;
unsigned int num_elems_processed_per_iteration = 16 / element_size_from_data_type(input->data_type());
// Update processed elements when input is S32 (comes from quantization input)
if(input->data_type() == DataType::S32)
{
num_elems_processed_per_iteration = 16;
}
// Configure kernel window
Window win = calculate_max_window(*input, Steps(num_elems_processed_per_iteration));
AccessWindowHorizontal input_access(input, 0, num_elems_processed_per_iteration);
if(output != nullptr && (output->total_size() != 0))
{
AccessWindowHorizontal output_access(output, 0, num_elems_processed_per_iteration);
if(bias == nullptr)
{
window_changed = update_window_and_padding(win, input_access, output_access);
}
else
{
AccessWindowStatic bias_access(bias, 0, 0, bias->dimension(0), bias->dimension(1));
window_changed = update_window_and_padding(win, input_access, output_access, bias_access);
}
output_access.set_valid_region(win, ValidRegion(Coordinates(), output->tensor_shape()));
}
else
{
if(bias == nullptr)
{
window_changed = update_window_and_padding(win, input_access);
}
else
{
AccessWindowStatic bias_access(bias, 0, 0, bias->dimension(0), bias->dimension(1));
window_changed = update_window_and_padding(win, input_access, bias_access);
}
input_access.set_valid_region(win, ValidRegion(Coordinates(), input->tensor_shape()));
}
Status err = (window_changed) ? ARM_COMPUTE_CREATE_ERROR(ErrorCode::RUNTIME_ERROR, "Insufficient Padding!") : Status{};
return std::make_pair(err, win);
}
// Internal load
inline float32x4_t internal_vld1q(const float *in)
{
return vld1q_f32(in);
}
inline qint8x16_t internal_vld1q(const qint8_t *in)
{
return vld1q_qs8(in);
}
inline qint16x8_t internal_vld1q(const qint16_t *in)
{
return vld1q_qs16(in);
}
inline qint32x4_t internal_vld1q(const qint32_t *in)
{
return vld1q_s32(in);
}
// Internal store
inline void internal_vst1q(float *p, const float32x4_t &v)
{
vst1q_f32(p, v);
}
inline void internal_vst1q(qint8_t *p, const qint8x16_t &v)
{
vst1q_qs8(p, v);
}
inline void internal_vst1q(qint8_t *p, const qint16x8_t &v)
{
vst1_qs8(p, vqmovn_s16(v));
}
inline void internal_vst1q(qint16_t *p, const qint16x8_t &v)
{
vst1q_qs16(p, v);
}
inline void internal_vst1q(qint32_t *p, const qint32x4_t &v)
{
vst1q_s32(p, v);
}
inline void internal_vst1q(qint16_t *p, const qint32x4_t &v)
{
vst1_qs16(p, vqmovn_qs32(v));
}
// Internal vdup
inline float32x4_t internal_vdupq_n(float v)
{
return vdupq_n_f32(v);
}
inline qint8x16_t internal_vdupq_n(qint8_t v)
{
return vdupq_n_qs8(v);
}
inline qint16x8_t internal_vdupq_n(qint16_t v)
{
return vdupq_n_qs16(v);
}
inline qint32x4_t internal_vdupq_n(qint32_t v)
{
return vdupq_n_qs32(v);
}
// Internal vadd
inline float32x4_t internal_vqaddq(const float32x4_t &x, const float32x4_t &y)
{
return vaddq_f32(x, y);
}
inline qint8x16_t internal_vqaddq(const qint8x16_t &x, const qint8x16_t &y)
{
return vqaddq_qs8(x, y);
}
inline qint16x8_t internal_vqaddq(const qint16x8_t &x, const qint16x8_t &y)
{
return vqaddq_qs16(x, y);
}
inline qint32x4_t internal_vqaddq(const qint32x4_t &x, const qint32x4_t &y)
{
return vqaddq_qs32(x, y);
}
#ifdef __ARM_FEATURE_FP16_VECTOR_ARITHMETIC
inline float16x8_t internal_vld1q(const float16_t *in)
{
return vld1q_f16(in);
}
inline void internal_vst1q(float16_t *p, const float16x8_t &v)
{
vst1q_f16(p, v);
}
inline float16x8_t internal_vdupq_n(float16_t v)
{
return vdupq_n_f16(v);
}
inline float16x8_t internal_vqaddq(const float16x8_t &x, const float16x8_t &y)
{
return vaddq_f16(x, y);
}
#endif /* __ARM_FEATURE_FP16_VECTOR_ARITHMETIC */
template <typename T1, typename T2, bool in_place, bool has_bias>
void output_stage(ITensor *input, const ITensor *bias, const Window &window, ITensor *output,
int result_fixedpoint_multiplier, int result_shift, int result_offset_after_shift)
{
ARM_COMPUTE_UNUSED(result_fixedpoint_multiplier);
ARM_COMPUTE_UNUSED(result_shift);
ARM_COMPUTE_UNUSED(result_offset_after_shift);
Iterator in(input, window);
if(in_place) // In place accumulate
{
execute_window_loop(window, [&](const Coordinates & id)
{
// Get bias and pointer to input
const auto in_ptr = reinterpret_cast<T1 *>(in.ptr());
// Accumulate bias
if(has_bias)
{
const auto vb = internal_vdupq_n(static_cast<T1>(*reinterpret_cast<const T2 *>(bias->ptr_to_element(Coordinates(id.z())))));
internal_vst1q(in_ptr, internal_vqaddq(internal_vld1q(in_ptr), vb));
}
else
{
internal_vst1q(in_ptr, internal_vld1q(in_ptr));
}
},
in);
}
else // Out of place accumulate
{
Iterator out(output, window);
execute_window_loop(window, [&](const Coordinates & id)
{
// Get bias and pointer to input
const auto in_ptr = reinterpret_cast<const T1 *>(in.ptr());
const auto out_ptr = reinterpret_cast<T2 *>(out.ptr());
// Accumulate bias
if(has_bias)
{
const auto vb = internal_vdupq_n(static_cast<T1>(*reinterpret_cast<const T2 *>(bias->ptr_to_element(Coordinates(id.z())))));
internal_vst1q(out_ptr, internal_vqaddq(internal_vld1q(in_ptr), vb));
}
else
{
internal_vst1q(out_ptr, internal_vld1q(in_ptr));
}
},
in, out);
}
}
// QASYMM8 specializations
template <>
void output_stage<int32_t, uint8_t, false, true>(ITensor *input, const ITensor *bias, const Window &window, ITensor *output,
int result_fixedpoint_multiplier, int result_shift, int result_offset_after_shift)
{
const int32x4_t result_offset_after_shift_s32 = vdupq_n_s32(result_offset_after_shift);
uint8x16_t min = vdupq_n_u8(0);
uint8x16_t max = vdupq_n_u8(255);
Iterator in(input, window);
Iterator out(output, window);
execute_window_loop(window, [&](const Coordinates & id)
{
// Get bias and pointer to input
const auto in_ptr = reinterpret_cast<int32_t *>(in.ptr());
int32x4x4_t v_in =
{
{
vld1q_s32(in_ptr),
vld1q_s32(in_ptr + 4),
vld1q_s32(in_ptr + 8),
vld1q_s32(in_ptr + 12)
}
};
// Accumulate bias
const auto vb = vdupq_n_s32(*reinterpret_cast<const int32_t *>(bias->ptr_to_element(Coordinates(id.z()))));
v_in =
{
{
vaddq_s32(v_in.val[0], vb),
vaddq_s32(v_in.val[1], vb),
vaddq_s32(v_in.val[2], vb),
vaddq_s32(v_in.val[3], vb)
}
};
const auto out_ptr = reinterpret_cast<uint8_t *>(out.ptr());
vst1q_u8(out_ptr, finalize_quantization<false>(v_in, result_fixedpoint_multiplier, result_shift, result_offset_after_shift_s32, min, max));
},
in, out);
}
template <>
void output_stage<int32_t, uint8_t, false, false>(ITensor *input, const ITensor *bias, const Window &window, ITensor *output,
int result_fixedpoint_multiplier, int result_shift, int result_offset_after_shift)
{
ARM_COMPUTE_UNUSED(bias);
const int32x4_t result_offset_after_shift_s32 = vdupq_n_s32(result_offset_after_shift);
uint8x16_t min = vdupq_n_u8(0);
uint8x16_t max = vdupq_n_u8(255);
Iterator in(input, window);
Iterator out(output, window);
execute_window_loop(window, [&](const Coordinates & id)
{
// Get bias and pointer to input
const auto in_ptr = reinterpret_cast<int32_t *>(in.ptr());
int32x4x4_t v_in =
{
{
vld1q_s32(in_ptr),
vld1q_s32(in_ptr + 4),
vld1q_s32(in_ptr + 8),
vld1q_s32(in_ptr + 12)
}
};
const auto out_ptr = reinterpret_cast<uint8_t *>(out.ptr());
vst1q_u8(out_ptr, finalize_quantization<false>(v_in, result_fixedpoint_multiplier, result_shift, result_offset_after_shift_s32, min, max));
},
in, out);
}
} // namespace
NEDirectConvolutionLayerOutputStageKernel::NEDirectConvolutionLayerOutputStageKernel()
: _func(nullptr), _input(nullptr), _bias(nullptr), _output(nullptr), _result_fixedpoint_multiplier(0), _result_shift(0), _result_offset_after_shift(0)
{
}
void NEDirectConvolutionLayerOutputStageKernel::configure(ITensor *input, const ITensor *bias, ITensor *output,
int result_fixedpoint_multiplier, int result_shift, int result_offset_after_shift)
{
ARM_COMPUTE_ERROR_ON_NULLPTR(input);
// Auto-initialize output output if required
if(output != nullptr)
{
// Work out expected output data type
const DataType output_dt = (input->info()->data_type() == DataType::S32) ? DataType::QASYMM8 : input->info()->data_type();
// Output tensor auto initialization if not yet initialized
auto_init_if_empty(*output->info(), input->info()->clone()->set_data_type(output_dt));
}
// Perform validation step
ARM_COMPUTE_ERROR_THROW_ON(validate_arguments(input->info(), (bias == nullptr) ? nullptr : bias->info(), (output == nullptr) ? nullptr : output->info()));
_func = nullptr;
_bias = bias;
_input = input;
_output = output;
_result_fixedpoint_multiplier = result_fixedpoint_multiplier;
_result_shift = result_shift;
_result_offset_after_shift = result_offset_after_shift;
// Configure kernel window
auto win_config = validate_and_configure_window(input->info(), (bias == nullptr) ? nullptr : bias->info(), (output == nullptr) ? nullptr : output->info());
ARM_COMPUTE_ERROR_THROW_ON(win_config.first);
INEKernel::configure(win_config.second);
// Set appropriate function
switch(input->info()->data_type())
{
case DataType::QS8:
{
if(bias == nullptr)
{
_func = (output == nullptr) ? &output_stage<qint8_t, qint8_t, true, false> : &output_stage<qint8_t, qint8_t, false, false>;
}
else
{
_func = (output == nullptr) ? &output_stage<qint8_t, qint8_t, true, true> : &output_stage<qint8_t, qint8_t, false, true>;
}
break;
}
case DataType::QS16:
{
if(bias != nullptr && bias->info()->data_type() == DataType::QS8)
{
_func = (output == nullptr) ? &output_stage<qint16_t, qint8_t, true, true> : &output_stage<qint16_t, qint8_t, false, true>;
}
else if(bias == nullptr)
{
_func = (output == nullptr) ? &output_stage<qint16_t, qint8_t, true, false> : &output_stage<qint16_t, qint8_t, false, false>;
}
else
{
ARM_COMPUTE_ERROR("Not implemented");
}
break;
}
case DataType::QS32:
{
_func = (output == nullptr) ? &output_stage<qint32_t, qint16_t, true, true> : &output_stage<qint32_t, qint16_t, false, true>;
break;
}
case DataType::S32:
_func = (bias == nullptr) ? &output_stage<int32_t, uint8_t, false, false> : &output_stage<int32_t, uint8_t, false, true>;
break;
#ifdef __ARM_FEATURE_FP16_VECTOR_ARITHMETIC
case DataType::F16:
{
_func = (output == nullptr) ? &output_stage<float16_t, float16_t, true, true> : &output_stage<float16_t, float16_t, false, true>;
break;
}
#endif /* __ARM_FEATURE_FP16_VECTOR_ARITHMETIC */
case DataType::F32:
{
_func = (output == nullptr) ? &output_stage<float, float, true, true> : &output_stage<float, float, false, true>;
break;
}
default:
{
ARM_COMPUTE_ERROR("Unsupported combination of types among the inputs.");
}
}
}
Status NEDirectConvolutionLayerOutputStageKernel::validate(const ITensorInfo *input, const ITensorInfo *bias, const ITensorInfo *output)
{
ARM_COMPUTE_RETURN_ON_ERROR(validate_arguments(input, bias, output));
ARM_COMPUTE_RETURN_ON_ERROR(validate_and_configure_window(input->clone().get(), bias->clone().get(), output == nullptr ? nullptr : output->clone().get()).first);
return Status{};
}
void NEDirectConvolutionLayerOutputStageKernel::run(const Window &window, const ThreadInfo &info)
{
ARM_COMPUTE_UNUSED(info);
ARM_COMPUTE_ERROR_ON_UNCONFIGURED_KERNEL(this);
ARM_COMPUTE_ERROR_ON_INVALID_SUBWINDOW(INEKernel::window(), window);
ARM_COMPUTE_ERROR_ON(_func == nullptr);
(*_func)(_input, _bias, window, _output, _result_fixedpoint_multiplier, _result_shift, _result_offset_after_shift);
}
| [
"gemfield@civilnet.cn"
] | gemfield@civilnet.cn |
a99b61294f8b1401ae6c0da838c9ecf35822e60d | 07c43092ac87907bdaeecff136b125b4f77182c2 | /third_party/LLVM/include/llvm/ExecutionEngine/Interpreter.h | 7425cdbcfda821dfda614e83ce5d35d1515d647a | [
"NCSA",
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | ddrmax/swiftshader-ex | 9cd436f2a0e8bc9e0966de148e5a60f974c4b144 | 2d975b5090e778857143c09c21aa24255f41e598 | refs/heads/master | 2021-04-27T15:14:22.444686 | 2018-03-15T10:12:49 | 2018-03-15T10:12:49 | 122,465,205 | 7 | 0 | Apache-2.0 | 2018-03-15T10:12:50 | 2018-02-22T10:40:03 | C++ | UTF-8 | C++ | false | false | 1,221 | h | //===-- Interpreter.h - Abstract Execution Engine Interface -----*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file forces the interpreter to link in on certain operating systems.
// (Windows).
//
//===----------------------------------------------------------------------===//
#ifndef EXECUTION_ENGINE_INTERPRETER_H
#define EXECUTION_ENGINE_INTERPRETER_H
#include "llvm/ExecutionEngine/ExecutionEngine.h"
#include <cstdlib>
extern "C" void LLVMLinkInInterpreter();
namespace {
struct ForceInterpreterLinking {
ForceInterpreterLinking() {
// We must reference the passes in such a way that compilers will not
// delete it all as dead code, even with whole program optimization,
// yet is effectively a NO-OP. As the compiler isn't smart enough
// to know that getenv() never returns -1, this will do the job.
if (std::getenv("bar") != (char*) -1)
return;
LLVMLinkInInterpreter();
}
} ForceInterpreterLinking;
}
#endif
| [
"capn@google.com"
] | capn@google.com |
5bba02381de9435fbfe50a578cc072de02236109 | 9c079c10fb9f90ff15181b3bdd50ea0435fbc0cd | /Codeforces/978A.cpp | 6afdce50c01a6d5bda2b4d4d9d1e2ba91e6e8ff1 | [] | no_license | shihab122/Competitive-Programming | 73d5bd89a97f28c8358796367277c9234caaa9a4 | 37b94d267fa03edf02110fd930fb9d80fbbe6552 | refs/heads/master | 2023-04-02T20:57:50.685625 | 2023-03-25T09:47:13 | 2023-03-25T09:47:13 | 148,019,792 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 489 | cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
int n;
scanf("%d",&n);
map<int,int>mp;
int cnt=0;
vector<int>vc;
int arr[n+1];
for(int i=0;i<n;i++){
scanf("%d",&arr[i]);
mp[arr[i]]++;
}
for(int i=0;i<n;i++){
mp[arr[i]]--;
if(mp[arr[i]]==0) cnt++,vc.push_back(arr[i]);
}
printf("%d\n",cnt);
for(int i=0;i<vc.size();i++) printf("%d ",vc[i]);
printf("\n");
return 0;
}
| [
"shihabhossain611@gmail.com"
] | shihabhossain611@gmail.com |
df85248b089d46d763c33a3f47981d9189fa6fc7 | e790253b47ad12bbc12f98a933de4dd788aada34 | /2018/0525_topological_sorting/1516_GAME_MINJUN.cpp | dfa85727ba763cad7f160051fe278f4492b68292 | [] | no_license | lilykju/algostudy | 393ab42bc5f8f5ee450839c8a76d460e3ddd15cc | 82f0100b42668894b15093c74bf806aeb95ee0a1 | refs/heads/master | 2021-05-15T05:16:51.889121 | 2019-01-10T10:17:55 | 2019-01-10T10:17:55 | 116,847,208 | 0 | 2 | null | 2018-12-26T15:19:43 | 2018-01-09T17:20:38 | C++ | UTF-8 | C++ | false | false | 851 | cpp | #include<iostream>
#include<vector>
#include<algorithm>
#include<string.h>
#include<queue>
using namespace std;
int in[1002];
int main()
{
int N;
scanf("%d",&N);
vector<int> arr(N+1);
vector<int> topol[N+1];
for(int i=1;i<=N;i++){
scanf("%d",&arr[i]);
while(1){
int a;
scanf("%d",&a);
if(a==-1)
break;
topol[a].push_back(i);
in[i]++;
}
}
queue<int> qu;
vector<int> dist(N+1,0);
for(int i=1;i<=N;i++){
if(in[i]==0)
qu.push(i);
dist[i]=arr[i];
}
vector<int> ans;
for(int i=1;i<=N;i++){
int start=qu.front();
qu.pop();
ans.push_back(start);
for(int j=0;j<topol[start].size();j++){
int next=topol[start][j];
if(dist[next] < dist[start] + arr[next])
dist[next]=dist[start]+arr[next];
if(--in[next]==0)
qu.push(next);
}
}
for(int i=1;i<=N;i++){
cout<<dist[i]<<endl;
}
}
| [
"starkim06@naver.com"
] | starkim06@naver.com |
2ac591ea1e5f084a7901ed04008cc896f274f27c | 8dc84558f0058d90dfc4955e905dab1b22d12c08 | /media/gpu/v4l2/v4l2_image_processor.h | 509e564995ed4395008a75b0226d4423372ebec6 | [
"LicenseRef-scancode-unknown-license-reference",
"BSD-3-Clause"
] | permissive | meniossin/src | 42a95cc6c4a9c71d43d62bc4311224ca1fd61e03 | 44f73f7e76119e5ab415d4593ac66485e65d700a | refs/heads/master | 2022-12-16T20:17:03.747113 | 2020-09-03T10:43:12 | 2020-09-03T10:43:12 | 263,710,168 | 1 | 0 | BSD-3-Clause | 2020-05-13T18:20:09 | 2020-05-13T18:20:08 | null | UTF-8 | C++ | false | false | 9,315 | 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 MEDIA_GPU_V4L2_V4L2_IMAGE_PROCESSOR_H_
#define MEDIA_GPU_V4L2_V4L2_IMAGE_PROCESSOR_H_
#include <stddef.h>
#include <stdint.h>
#include <memory>
#include <vector>
#include "base/containers/queue.h"
#include "base/macros.h"
#include "base/memory/ref_counted.h"
#include "base/memory/weak_ptr.h"
#include "base/threading/thread.h"
#include "media/base/video_frame.h"
#include "media/gpu/media_gpu_export.h"
#include "media/gpu/v4l2/v4l2_device.h"
namespace media {
// Handles image processing accelerators that expose a V4L2 memory-to-memory
// interface. The threading model of this class is the same as for other V4L2
// hardware accelerators (see V4L2VideoDecodeAccelerator) for more details.
class MEDIA_GPU_EXPORT V4L2ImageProcessor {
public:
explicit V4L2ImageProcessor(const scoped_refptr<V4L2Device>& device);
virtual ~V4L2ImageProcessor();
// Initializes the processor to convert from |input_format| to |output_format|
// and/or scale from |input_visible_size| to |output_visible_size|.
// Request the input buffers to be of at least |input_allocated_size| and the
// output buffers to be of at least |output_allocated_size|. The number of
// input buffers and output buffers will be |num_buffers|. Provided |error_cb|
// will be called if an error occurs. Return true if the requested
// configuration is supported.
bool Initialize(VideoPixelFormat input_format,
VideoPixelFormat output_format,
v4l2_memory input_memory_type,
v4l2_memory output_memory_type,
gfx::Size input_visible_size,
gfx::Size input_allocated_size,
gfx::Size output_visible_size,
gfx::Size output_allocated_size,
int num_buffers,
const base::Closure& error_cb);
// Returns a vector of dmabuf file descriptors, exported for V4L2 output
// buffer with |index|. The size of vector will be the number of planes of the
// buffer. Return an empty vector on failure.
std::vector<base::ScopedFD> GetDmabufsForOutputBuffer(
int output_buffer_index);
// Returns true if image processing is supported on this platform.
static bool IsSupported();
// Returns a vector of supported input formats in fourcc.
static std::vector<uint32_t> GetSupportedInputFormats();
// Returns a vector of supported output formats in fourcc.
static std::vector<uint32_t> GetSupportedOutputFormats();
// Gets output allocated size and number of planes required by the device
// for conversion from |input_pixelformat| to |output_pixelformat|, for
// visible size |size|. Returns true on success. Adjusted coded size will be
// stored in |size| and the number of planes will be stored in |num_planes|.
static bool TryOutputFormat(uint32_t input_pixelformat,
uint32_t output_pixelformat,
gfx::Size* size,
size_t* num_planes);
// Returns input allocated size required by the processor to be fed with.
gfx::Size input_allocated_size() const { return input_allocated_size_; }
// Returns output allocated size required by the processor.
gfx::Size output_allocated_size() const { return output_allocated_size_; }
// Callback to be used to return the index of a processed image to the
// client. After the client is done with the frame, call Process with the
// index to return the output buffer to the image processor.
typedef base::Callback<void(int output_buffer_index)> FrameReadyCB;
// Called by client to process |frame|. The resulting processed frame will be
// stored in |output_buffer_index| output buffer and notified via |cb|. The
// processor will drop all its references to |frame| after it finishes
// accessing it. If |output_memory_type_| is V4L2_MEMORY_DMABUF, the caller
// should pass non-empty |output_dmabuf_fds| and the processed frame will be
// stored in those buffers. If the number of |output_dmabuf_fds| is not
// expected, this function will return false.
bool Process(const scoped_refptr<VideoFrame>& frame,
int output_buffer_index,
std::vector<base::ScopedFD> output_dmabuf_fds,
const FrameReadyCB& cb);
// Reset all processing frames. After this method returns, no more callbacks
// will be invoked. V4L2ImageProcessor is ready to process more frames.
bool Reset();
// Stop all processing and clean up. After this method returns no more
// callbacks will be invoked. Deletes |this| unconditionally, so make sure
// to drop all pointers to it!
void Destroy();
private:
// Record for input buffers.
struct InputRecord {
InputRecord();
InputRecord(const V4L2ImageProcessor::InputRecord&);
~InputRecord();
scoped_refptr<VideoFrame> frame;
bool at_device;
};
// Record for output buffers.
struct OutputRecord {
OutputRecord();
OutputRecord(OutputRecord&&);
~OutputRecord();
bool at_device;
// The processed frame will be stored in these buffers if
// |output_memory_type_| is V4L2_MEMORY_DMABUF
std::vector<base::ScopedFD> dmabuf_fds;
};
// Job record. Jobs are processed in a FIFO order. This is separate from
// InputRecord, because an InputRecord may be returned before we dequeue
// the corresponding output buffer. The processed frame will be stored in
// |output_buffer_index| output buffer. If |output_memory_type_| is
// V4L2_MEMORY_DMABUF, the processed frame will be stored in
// |output_dmabuf_fds|.
struct JobRecord {
JobRecord();
~JobRecord();
scoped_refptr<VideoFrame> frame;
int output_buffer_index;
std::vector<base::ScopedFD> output_dmabuf_fds;
FrameReadyCB ready_cb;
};
void EnqueueInput();
void EnqueueOutput(int index);
void Dequeue();
bool EnqueueInputRecord();
bool EnqueueOutputRecord(int index);
bool CreateInputBuffers();
bool CreateOutputBuffers();
void DestroyInputBuffers();
void DestroyOutputBuffers();
void NotifyError();
void NotifyErrorOnChildThread(const base::Closure& error_cb);
void ProcessTask(std::unique_ptr<JobRecord> job_record);
void ServiceDeviceTask();
// Attempt to start/stop device_poll_thread_.
void StartDevicePoll();
void StopDevicePoll();
// Ran on device_poll_thread_ to wait for device events.
void DevicePollTask(bool poll_device);
// A processed frame is ready.
void FrameReady(const FrameReadyCB& cb, int output_buffer_index);
// Size and format-related members remain constant after initialization.
// The visible/allocated sizes of the input frame.
gfx::Size input_visible_size_;
gfx::Size input_allocated_size_;
// The visible/allocated sizes of the destination frame.
gfx::Size output_visible_size_;
gfx::Size output_allocated_size_;
VideoPixelFormat input_format_;
VideoPixelFormat output_format_;
v4l2_memory input_memory_type_;
v4l2_memory output_memory_type_;
uint32_t input_format_fourcc_;
uint32_t output_format_fourcc_;
size_t input_planes_count_;
size_t output_planes_count_;
// Our original calling task runner for the child thread.
const scoped_refptr<base::SingleThreadTaskRunner> child_task_runner_;
// V4L2 device in use.
scoped_refptr<V4L2Device> device_;
// Thread to communicate with the device on.
base::Thread device_thread_;
// Thread used to poll the V4L2 for events only.
base::Thread device_poll_thread_;
// All the below members are to be accessed from device_thread_ only
// (if it's running).
base::queue<std::unique_ptr<JobRecord>> input_queue_;
base::queue<std::unique_ptr<JobRecord>> running_jobs_;
// Input queue state.
bool input_streamon_;
// Number of input buffers enqueued to the device.
int input_buffer_queued_count_;
// Input buffers ready to use; LIFO since we don't care about ordering.
std::vector<int> free_input_buffers_;
// Mapping of int index to an input buffer record.
std::vector<InputRecord> input_buffer_map_;
// Output queue state.
bool output_streamon_;
// Number of output buffers enqueued to the device.
int output_buffer_queued_count_;
// Mapping of int index to an output buffer record.
std::vector<OutputRecord> output_buffer_map_;
// The number of input or output buffers.
int num_buffers_;
// Error callback to the client.
base::Closure error_cb_;
// WeakPtr<> pointing to |this| for use in posting tasks from the device
// worker threads back to the child thread. Because the worker threads
// are members of this class, any task running on those threads is guaranteed
// that this object is still alive. As a result, tasks posted from the child
// thread to the device thread should use base::Unretained(this),
// and tasks posted the other way should use |weak_this_|.
base::WeakPtr<V4L2ImageProcessor> weak_this_;
// Weak factory for producing weak pointers on the child thread.
base::WeakPtrFactory<V4L2ImageProcessor> weak_this_factory_;
DISALLOW_COPY_AND_ASSIGN(V4L2ImageProcessor);
};
} // namespace media
#endif // MEDIA_GPU_V4L2_V4L2_IMAGE_PROCESSOR_H_
| [
"arnaud@geometry.ee"
] | arnaud@geometry.ee |
8dacf060124eff06083c8c01c7ffed31274d8e4a | 97d2e759c2d3ca77421e68ca18ac84c66a941214 | /Source/BuildingEscape/OpenDoor.h | 059531741e5b4e585830d28e3116b5c397c33f3f | [] | no_license | radhaashok/BuildingEscape | bdb4eecc74d3668e63e87741c947a9c3dcce35d8 | 4574d0e303ac5e39c96fedd160e9c7a29df50681 | refs/heads/master | 2021-07-14T23:04:39.236306 | 2017-10-20T13:09:44 | 2017-10-20T13:09:44 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,099 | h | // Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "Components/ActorComponent.h"
#include "Engine/TriggerVolume.h"
#include "OpenDoor.generated.h"
UCLASS( ClassGroup=(Custom), meta=(BlueprintSpawnableComponent) )
class BUILDINGESCAPE_API UOpenDoor : public UActorComponent
{
GENERATED_BODY()
public:
// Sets default values for this component's properties
UOpenDoor();
protected:
// Called when the game starts
virtual void BeginPlay() override;
void OpenDoor();
void CloseDoor();
public:
// Called every frame
virtual void TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) override;
private:
UPROPERTY(EditAnywhere)
float OpenAngle = 20.0f;
UPROPERTY(EditAnywhere)
float CloseAngle = 90.0f;
UPROPERTY(EditAnywhere)
ATriggerVolume* PressurePlate;
UPROPERTY(EditAnywhere)
float DoorCloseDelay = 0.2f;
float LastDoorOpenTime = -1.f;
//UPROPERTY(EditAnywhere)
AActor* ActorThatOpens; //Remember pawn inherits from actor
AActor* Owner; //
};
| [
"gowtham.kudupudi@tmeic.in"
] | gowtham.kudupudi@tmeic.in |
81d6a79101616dfeed69a3ca233d3afed7f32911 | 53017700ea8cf3d69f6cfec0191b64b631f59ef9 | /PRACTICA 16.cpp | 39f2b7bf7f10280af38cf1a8bb12be5bc8fc3642 | [] | no_license | OscarIdrogo13/TrabajosC | 255117cdeae4f533a44f6e878b949ee53a81d6e4 | 4d77cc195cd9cba838117faf4cf9b34789140ea8 | refs/heads/main | 2023-08-27T21:50:10.513242 | 2021-10-18T05:26:37 | 2021-10-18T05:26:37 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 140 | cpp | #include <iostream>
using namespace std;
int main(){
for(int s=2; s<=400; s+=2){
cout<<s<<",";
}
system("pause");
return 0;
}
| [
"noreply@github.com"
] | OscarIdrogo13.noreply@github.com |
7efb48fc81da3687c70a727a8c5bcbd1cc61a54a | dd76cb0ed67fa78d75ca7e70b3010bb2798e6c82 | /work/myredis/event2/behaviac/base/core/timer.h | 9c29c74161c2cfc468bf2ffe61a09bc38dda635c | [] | no_license | Riopho/vimrc | d91ecdef68deab1a24d80ce733e64be073211b74 | 1780e9ddc7d1cf1e6b422221e333cdcdb9be78b8 | refs/heads/master | 2021-06-08T20:07:42.666225 | 2019-11-19T13:50:36 | 2019-11-19T13:50:36 | 134,824,016 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,061 | h | #ifndef BEHAVIAC_BASE_TIMER_H_
#define BEHAVIAC_BASE_TIMER_H_
#include "config.h"
namespace behaviac
{
// Forward declaration
struct TimerInformation;
BEHAVIAC_API const TimerInformation& GetTimerInformation();
struct TimerInformation
{
int64_t cpuFrequency;
int64_t timerFrequency;
float tickInSecond;
float tickInMillisecond;
float tickInMicrosecond;
float tickInNanosecond;
float tickInCycle;
};
struct TimeSpan
{
TimeSpan() {}
BEHAVIAC_FORCEINLINE explicit TimeSpan(int64_t tick) : tick(tick) {}
BEHAVIAC_FORCEINLINE uint64_t GetTick() const
{
return tick;
}
BEHAVIAC_FORCEINLINE float GetSecond() const
{
return tick * GetTimerInformation().tickInSecond;
}
BEHAVIAC_FORCEINLINE float GetMillisecond() const
{
return tick * GetTimerInformation().tickInMillisecond;
}
BEHAVIAC_FORCEINLINE float GetMicrosecond() const
{
return tick * GetTimerInformation().tickInMicrosecond;
}
BEHAVIAC_FORCEINLINE float GetNanosecond() const
{
return tick * GetTimerInformation().tickInNanosecond;
}
BEHAVIAC_FORCEINLINE float GetCycle() const
{
return tick * GetTimerInformation().tickInCycle;
}
int64_t tick;
};
struct Tick
{
BEHAVIAC_FORCEINLINE explicit Tick(int64_t t) : tick(t) {}
friend BEHAVIAC_FORCEINLINE TimeSpan operator-(Tick end, Tick start)
{
return TimeSpan(end.tick - start.tick);
}
int64_t tick;
};
BEHAVIAC_API bool TimerStart();
BEHAVIAC_API bool TimerStop();
BEHAVIAC_API const TimerInformation& GetTimerInformation();
BEHAVIAC_API Tick GetTick();
BEHAVIAC_API int64_t ReadTSC();
} // namespace behaviac
#endif//BEHAVIAC_BASE_TIMER_H_
| [
"rio@TwGame.(none)"
] | rio@TwGame.(none) |
d367d051b470340b4fd975ef89f0da3523439ae0 | 50d57297975b70f9421b37dc730d8b03224323bf | /dependencies/include/OGRE/ParticleUniverse/ParticleUniverseObserverTokens.h | a21e694e9b59bf8ccc7ad5a44f965ae91b6b70c2 | [
"Apache-2.0"
] | permissive | albmarvil/The-Eternal-Sorrow | 619df0f6ea8beba1257596c3c9c8cf4626317e14 | 5b5f9d2d0c3a9c1db9393c611ae4952b7d26eedf | refs/heads/master | 2021-01-23T07:02:47.206891 | 2015-07-07T14:13:14 | 2015-07-07T14:13:14 | 38,193,036 | 1 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 2,413 | h | /*
-----------------------------------------------------------------------------------------------
Copyright (C) 2013 Henry van Merode. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-----------------------------------------------------------------------------------------------
*/
#ifndef __PU_OBSERVER_TOKENS_H__
#define __PU_OBSERVER_TOKENS_H__
#include "ParticleUniversePrerequisites.h"
#include "ParticleUniverseObserver.h"
#include "ParticleUniverseScriptDeserializer.h"
namespace ParticleUniverse
{
/** The ObserverTranslator parses 'Observer' tokens
*/
class _ParticleUniverseExport ObserverTranslator : public ScriptTranslator
{
protected:
ParticleObserver* mObserver;
public:
ObserverTranslator(void);
virtual ~ObserverTranslator(void){};
virtual void translate(ScriptCompiler* compiler, const AbstractNodePtr &node);
};
//-------------------------------------------------------------------------
//-------------------------------------------------------------------------
//-------------------------------------------------------------------------
/**
*/
class _ParticleUniverseExport ParticleObserverWriter : public ScriptWriter
{
public:
ParticleObserverWriter(void) {};
virtual ~ParticleObserverWriter(void) {};
/** @see
ScriptWriter::write
*/
virtual void write(ParticleScriptSerializer* serializer, const IElement* element);
};
}
#endif
| [
"tukaram92@gmail.com"
] | tukaram92@gmail.com |
7ea3da0376decb7f024fbaf4f0c1a4ff01422512 | 879681c994f1ca9c8d2c905a4e5064997ad25a27 | /root-2.3.0/run/tutorials/multiphase/twoPhaseEulerFoam/RAS/fluidisedBed/1.2/k.air | bace42882af31add1d01a90e6d69153440e49dbf | [] | no_license | MizuhaWatanabe/OpenFOAM-2.3.0-with-Ubuntu | 3828272d989d45fb020e83f8426b849e75560c62 | daeb870be81275e8a81f5cbac4ca1906a9bc69c0 | refs/heads/master | 2020-05-17T16:36:41.848261 | 2015-04-18T09:29:48 | 2015-04-18T09:29:48 | 34,159,882 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 54,170 | air | /*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 2.3.0 |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
location "1.2";
object k.air;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 2 -2 0 0 0 0];
internalField nonuniform List<scalar>
6000
(
0.820832
0.906884
0.931012
0.947406
0.968798
0.994505
1.01544
1.02807
1.03818
1.03853
1.02774
1.01494
1.00544
0.999945
0.994835
0.987978
0.979237
0.971966
0.965347
0.960966
0.961305
0.970367
0.979769
0.977589
0.965687
0.947944
0.934302
0.92173
0.904959
0.820093
0.569828
0.865803
0.948221
0.99239
1.04836
1.12902
1.22929
1.27869
1.27693
1.25461
1.21801
1.17153
1.13222
1.10609
1.09175
1.0795
1.05922
1.03711
1.02037
1.01351
1.01773
1.02711
1.03736
1.05316
1.04943
1.00741
0.975789
0.947342
0.868561
0.582757
0.414924
0.762409
0.904039
0.996669
1.07945
1.15027
1.23171
1.26995
1.25739
1.23009
1.1925
1.14753
1.10799
1.08187
1.067
1.05693
1.04738
1.03768
1.02862
1.01835
1.00905
1.00617
1.00695
1.01053
1.00543
0.979306
0.948108
0.894675
0.766912
0.429319
0.359893
0.693579
0.847176
0.959446
1.06339
1.16523
1.24901
1.27309
1.25483
1.2205
1.17344
1.12071
1.07837
1.05192
1.03589
1.02492
1.0184
1.01105
1.00068
0.989593
0.978541
0.973389
0.9713
0.968376
0.960424
0.934689
0.894206
0.834002
0.703735
0.371664
0.316027
0.627452
0.783688
0.913756
1.04404
1.18367
1.24868
1.26427
1.24483
1.20703
1.14771
1.09107
1.05133
1.02681
1.00944
0.99756
0.988488
0.976277
0.962713
0.950303
0.940575
0.934655
0.931889
0.924199
0.911046
0.881205
0.829955
0.768042
0.646558
0.345323
0.27222
0.558111
0.7285
0.898276
1.05089
1.20362
1.23965
1.23929
1.21439
1.17444
1.11626
1.06631
1.03557
1.0135
0.994134
0.982211
0.97435
0.964324
0.950968
0.934388
0.914549
0.899303
0.888242
0.875822
0.85754
0.817702
0.757087
0.686386
0.573409
0.313592
0.230338
0.49471
0.701847
0.909997
1.07908
1.21728
1.22192
1.20507
1.17055
1.13354
1.09159
1.05305
1.03128
1.01237
0.996699
0.994452
0.995079
0.984337
0.965444
0.943582
0.916473
0.886765
0.863822
0.845335
0.8192
0.776163
0.711806
0.62477
0.489595
0.262504
0.198841
0.469883
0.72328
0.947803
1.11663
1.22029
1.20662
1.16966
1.13451
1.10813
1.0779
1.05564
1.04108
1.02931
1.02457
1.03932
1.05007
1.03393
1.00269
0.97319
0.942654
0.907218
0.876061
0.85279
0.821293
0.767831
0.69373
0.593075
0.422681
0.214181
0.203629
0.513807
0.805024
0.983294
1.125
1.2283
1.21534
1.15471
1.12318
1.10478
1.09059
1.07851
1.07332
1.07309
1.08154
1.10416
1.12855
1.11624
1.07831
1.03675
1.00154
0.969426
0.945109
0.924478
0.88422
0.810479
0.722623
0.613942
0.424198
0.201458
0.240011
0.642546
0.953447
1.02902
1.14619
1.25679
1.2414
1.17786
1.15784
1.14302
1.13375
1.12878
1.13777
1.16037
1.19447
1.2409
1.2836
1.28424
1.23472
1.17128
1.12196
1.09242
1.07645
1.05258
0.994444
0.898181
0.792957
0.678091
0.480597
0.221471
0.322169
0.80823
1.12658
1.12967
1.21407
1.28841
1.29448
1.2634
1.25944
1.24412
1.2378
1.24359
1.26037
1.28265
1.30939
1.34206
1.37772
1.39736
1.34239
1.25523
1.19215
1.158
1.14162
1.11386
1.03912
0.924286
0.811833
0.691059
0.519473
0.254637
0.398587
0.948863
1.18185
1.25234
1.29322
1.35444
1.36658
1.3724
1.36749
1.33645
1.31947
1.31903
1.3221
1.31978
1.31853
1.3246
1.3345
1.33614
1.29156
1.22179
1.17657
1.14554
1.12001
1.07269
0.977002
0.864446
0.770677
0.663449
0.505998
0.247763
0.432044
1.00423
1.19074
1.26791
1.35255
1.35116
1.37655
1.40139
1.37524
1.34341
1.32037
1.30484
1.28922
1.27611
1.26954
1.26681
1.2644
1.25484
1.21954
1.16997
1.14295
1.10776
1.0563
0.979239
0.880543
0.779709
0.691879
0.600027
0.464299
0.231159
0.450611
1.01688
1.1667
1.22504
1.27702
1.28972
1.31649
1.33441
1.32406
1.30068
1.27817
1.25768
1.23954
1.22717
1.2213
1.21761
1.21143
1.19681
1.17193
1.12677
1.09759
1.05308
0.985017
0.902888
0.81289
0.718097
0.623026
0.525442
0.397336
0.197534
0.458707
1.02021
1.12997
1.15729
1.19066
1.21025
1.23171
1.24648
1.24794
1.24021
1.22771
1.21265
1.19674
1.1859
1.18129
1.17793
1.17088
1.15688
1.14074
1.09467
1.05505
1.00215
0.930001
0.85263
0.770714
0.679566
0.578194
0.466985
0.330885
0.158527
0.4608
1.01444
1.08306
1.09359
1.11857
1.14061
1.1614
1.1769
1.18451
1.18572
1.18193
1.17386
1.16232
1.15437
1.15161
1.1489
1.14253
1.13301
1.12077
1.06994
1.02122
0.963011
0.892589
0.821028
0.744706
0.657441
0.556297
0.439699
0.296262
0.134351
0.463193
0.984643
1.02224
1.03696
1.06033
1.08399
1.10536
1.12258
1.1347
1.14172
1.14473
1.14371
1.13701
1.13267
1.13236
1.13056
1.12632
1.12259
1.10741
1.04939
0.996354
0.93655
0.869794
0.802027
0.729066
0.646067
0.549794
0.437088
0.296845
0.131687
0.480976
0.918979
0.962705
0.989777
1.01471
1.03949
1.06219
1.08142
1.09686
1.10811
1.11626
1.12032
1.11908
1.11813
1.12081
1.12117
1.12005
1.11946
1.09166
1.03148
0.979208
0.920855
0.857546
0.792047
0.721431
0.642428
0.551843
0.445329
0.312022
0.137294
0.469733
0.854179
0.918342
0.954205
0.981458
1.00717
1.03052
1.05134
1.06888
1.08264
1.09359
1.10007
1.10522
1.10558
1.11359
1.11937
1.12006
1.11202
1.06907
1.01523
0.966698
0.911608
0.851711
0.788586
0.720591
0.645203
0.560051
0.461253
0.337263
0.152747
0.439169
0.78968
0.878776
0.927412
0.959936
0.986029
1.00891
1.02978
1.04747
1.062
1.0734
1.08108
1.09151
1.0925
1.10517
1.11833
1.11571
1.09115
1.04315
0.999262
0.955477
0.905374
0.850172
0.790666
0.725931
0.654408
0.57388
0.480208
0.361112
0.167159
0.386551
0.718866
0.836795
0.907065
0.949271
0.974862
0.996044
1.01451
1.03013
1.04388
1.05548
1.06414
1.07609
1.07828
1.09064
1.10485
1.09478
1.05743
1.01766
0.983061
0.946071
0.902755
0.853512
0.798992
0.73862
0.670876
0.593543
0.502368
0.383993
0.179707
0.343208
0.659161
0.803138
0.893203
0.946443
0.973905
0.991162
1.00408
1.01556
1.02816
1.04049
1.05098
1.0594
1.06086
1.06917
1.0764
1.0572
1.02491
0.99713
0.972164
0.942817
0.906559
0.863912
0.815089
0.759185
0.69482
0.619713
0.529166
0.408411
0.192429
0.335518
0.645396
0.805203
0.89981
0.949674
0.978483
0.99176
0.997144
1.00373
1.01531
1.03013
1.04137
1.0432
1.04088
1.04323
1.04198
1.02606
1.00556
0.989051
0.971556
0.948563
0.919106
0.883034
0.83973
0.78828
0.727054
0.653439
0.562148
0.436914
0.206761
0.334441
0.644814
0.796796
0.906627
0.956113
0.981385
0.994188
0.993919
0.995259
1.00686
1.02487
1.03312
1.02691
1.02052
1.01789
1.01658
1.01055
1.00252
0.993415
0.981615
0.964861
0.94174
0.911635
0.873789
0.826824
0.768624
0.696028
0.602945
0.471406
0.22366
0.323341
0.618468
0.745925
0.869171
0.952127
0.973797
0.993153
0.989904
0.988323
1.00342
1.02024
1.01888
1.00809
1.00218
1.00071
1.00474
1.01061
1.01142
1.00937
1.0036
0.992278
0.974768
0.950552
0.918357
0.876103
0.821066
0.74946
0.654089
0.514464
0.244365
0.291481
0.552544
0.68461
0.823075
0.933161
0.951886
0.97461
0.974353
0.979961
0.996408
1.0017
0.996089
0.99326
0.994923
0.999458
1.01278
1.02516
1.03336
1.03801
1.03735
1.03095
1.01853
0.999705
0.973575
0.936511
0.885229
0.815706
0.719157
0.570959
0.271371
0.245432
0.466356
0.650656
0.818184
0.932078
0.92926
0.933696
0.947649
0.961214
0.969697
0.976986
0.987806
0.999881
1.01219
1.02656
1.04372
1.05875
1.07152
1.08016
1.08337
1.08018
1.07194
1.05842
1.03712
1.00559
0.960749
0.897053
0.803025
0.646008
0.305252
0.206156
0.415334
0.645264
0.839752
0.943896
0.925842
0.907664
0.913018
0.932049
0.959472
0.989341
1.01854
1.04667
1.0693
1.08672
1.10109
1.11432
1.12725
1.13723
1.14112
1.13935
1.13309
1.12326
1.10819
1.08566
1.05202
1.00024
0.916551
0.758381
0.374567
0.185119
0.405203
0.649898
0.856727
0.95524
0.931075
0.897932
0.909316
0.953192
1.00339
1.05028
1.09416
1.13384
1.16077
1.17363
1.18245
1.19141
1.20141
1.20961
1.21207
1.20946
1.20539
1.2025
1.19868
1.18947
1.1703
1.13539
1.07108
0.928146
0.469619
0.174828
0.410768
0.66441
0.873246
0.966124
0.940498
0.920636
0.955357
1.02949
1.09843
1.15372
1.20201
1.24379
1.27182
1.2816
1.28474
1.288
1.29371
1.29864
1.29944
1.29745
1.29933
1.30673
1.31627
1.323
1.3224
1.3094
1.2694
1.14238
0.629701
0.174874
0.430078
0.705739
0.926243
1.01222
0.984474
0.996682
1.05715
1.14107
1.22219
1.28681
1.33726
1.37613
1.40076
1.40737
1.4049
1.40224
1.40336
1.40514
1.40578
1.40743
1.41773
1.43758
1.46312
1.48704
1.50825
1.51212
1.48139
1.35655
0.764234
0.182931
0.478518
0.799984
1.05521
1.13694
1.09702
1.12378
1.18966
1.27639
1.37318
1.45121
1.50207
1.53332
1.54875
1.54847
1.53971
1.53137
1.52832
1.52836
1.53003
1.539
1.56115
1.59518
1.63707
1.6796
1.70912
1.71598
1.67702
1.45199
0.758081
0.21055
0.555131
0.939041
1.24714
1.33838
1.26479
1.28467
1.34835
1.43881
1.55251
1.64801
1.696
1.71284
1.71275
1.70117
1.6845
1.67118
1.6651
1.66452
1.66967
1.69051
1.72948
1.78117
1.83279
1.87362
1.89803
1.88553
1.77967
1.47045
0.74014
0.263661
0.673467
1.12819
1.43689
1.47904
1.43906
1.44193
1.50525
1.60596
1.73296
1.86009
1.91255
1.90497
1.88245
1.85602
1.83189
1.81563
1.80912
1.81033
1.82284
1.85603
1.9036
1.96087
2.01747
2.01051
1.99135
1.9634
1.85247
1.53079
0.75476
0.35892
0.875283
1.29403
1.51105
1.49977
1.50737
1.55141
1.63408
1.75119
1.89478
2.04331
2.11545
2.09297
2.04093
2.00027
1.97054
1.95681
1.9554
1.95642
1.9748
2.01931
2.06748
2.07903
2.06063
2.03602
2.03776
2.02836
1.91466
1.59039
0.795255
0.459715
1.05981
1.45412
1.4957
1.51426
1.54292
1.59408
1.689
1.82104
1.97932
2.15507
2.26091
2.23898
2.16634
2.11555
2.08733
2.07765
2.07083
2.08093
2.08539
2.08669
2.09444
2.08
2.04955
2.04644
2.07167
2.05745
1.92933
1.60357
0.822738
0.531601
1.17521
1.50624
1.47807
1.49747
1.54263
1.61691
1.72565
1.8674
2.03893
2.22222
2.33181
2.30603
2.23882
2.18993
2.17059
2.14974
2.14048
2.11262
2.09507
2.0803
2.06044
2.03647
2.02467
2.04812
2.08851
2.06403
1.92211
1.59452
0.829102
0.565251
1.23084
1.51052
1.46832
1.48488
1.54357
1.63548
1.75937
1.91537
2.10394
2.30946
2.40513
2.34418
2.27382
2.22919
2.20583
2.18556
2.1391
2.08921
2.05445
2.03025
2.00951
1.99347
2.00006
2.0468
2.09963
2.06647
1.90749
1.57229
0.826218
0.575078
1.24867
1.51026
1.46142
1.48396
1.55216
1.65539
1.78957
1.95545
2.15649
2.37397
2.44031
2.35641
2.27616
2.24445
2.20216
2.16649
2.10099
2.04254
2.00322
1.97791
1.95975
1.95211
1.97454
2.04353
2.10799
2.06808
1.89279
1.54651
0.817937
0.577286
1.24859
1.49856
1.45618
1.48798
1.56469
1.67466
1.81426
1.98483
2.19103
2.41152
2.43775
2.33061
2.2402
2.19756
2.16268
2.1144
2.04656
1.98753
1.94841
1.92367
1.90835
1.909
1.94617
2.03476
2.1092
2.0659
1.87772
1.52155
0.805853
0.572019
1.23621
1.47332
1.44923
1.49303
1.57659
1.69045
1.83119
2.00124
2.20481
2.4117
2.3976
2.2699
2.17412
2.11217
2.08857
2.04322
1.97673
1.92288
1.88707
1.86458
1.85304
1.86144
1.91225
2.01675
2.10073
2.05735
1.86103
1.49751
0.794133
0.564979
1.22374
1.44122
1.43952
1.49569
1.58497
1.70071
1.83997
2.00488
2.19804
2.37831
2.33537
2.18901
2.09051
2.01859
2.00015
1.96076
1.8987
1.85037
1.8188
1.79965
1.79256
1.80826
1.87085
1.98697
2.07818
2.03852
1.84062
1.47379
0.782992
0.566163
1.21791
1.40742
1.42785
1.4949
1.58851
1.70387
1.83978
1.99797
2.17609
2.32052
2.25957
2.10747
1.99784
1.92767
1.90791
1.87378
1.81684
1.77279
1.74468
1.72898
1.72647
1.74882
1.82076
1.94393
2.04022
2.00806
1.81484
1.44901
0.771916
0.574524
1.21408
1.37687
1.41477
1.49022
1.58625
1.7
1.8308
1.97951
2.14044
2.24694
2.16895
2.0248
1.91065
1.84327
1.81646
1.78576
1.73319
1.69201
1.66624
1.65341
1.65497
1.68318
1.76191
1.88809
1.98801
1.96608
1.78264
1.4222
0.760457
0.57392
1.20063
1.34164
1.39767
1.47957
1.57671
1.68695
1.81021
1.94717
2.08593
2.15193
2.06472
1.93286
1.82753
1.75978
1.72662
1.6979
1.64859
1.60925
1.58499
1.57432
1.57919
1.61227
1.69503
1.82055
1.92267
1.91253
1.74235
1.39216
0.748314
0.5597
1.16566
1.29715
1.37501
1.46195
1.55806
1.66305
1.77767
1.90044
2.01139
2.03641
1.94835
1.83396
1.74116
1.67526
1.63795
1.60878
1.56299
1.52558
1.50254
1.49333
1.50062
1.53713
1.62108
1.74321
1.84582
1.84786
1.69323
1.35771
0.733797
0.576455
1.1249
1.25358
1.3483
1.43744
1.53093
1.62988
1.73481
1.84011
1.91564
1.90485
1.82727
1.735
1.65589
1.59417
1.55223
1.51991
1.47796
1.44252
1.42044
1.41197
1.42062
1.45892
1.54151
1.65827
1.75893
1.77212
1.63578
1.31899
0.717964
0.583124
1.08185
1.21804
1.31693
1.40585
1.49586
1.58854
1.68311
1.76733
1.8023
1.77267
1.71183
1.64245
1.57729
1.52033
1.47406
1.43619
1.39587
1.36187
1.34012
1.33153
1.34034
1.37861
1.45774
1.56742
1.66436
1.68641
1.56936
1.27415
0.698187
0.562859
1.0276
1.17601
1.27765
1.36708
1.45382
1.54019
1.62265
1.67831
1.67997
1.65016
1.60864
1.56003
1.50778
1.45564
1.40575
1.36043
1.31901
1.28526
1.26267
1.25289
1.26056
1.29715
1.37122
1.47268
1.56461
1.59286
1.49442
1.22015
0.674345
0.522041
0.962679
1.12437
1.23157
1.3221
1.40553
1.48443
1.54754
1.57195
1.56271
1.54294
1.51902
1.48778
1.44708
1.39969
1.34742
1.29516
1.2494
1.21392
1.18928
1.17697
1.18205
1.21539
1.28322
1.37591
1.46193
1.49354
1.41198
1.15729
0.647711
0.480138
0.900639
1.07017
1.1808
1.2713
1.35077
1.41761
1.45516
1.4625
1.45865
1.45191
1.44163
1.42334
1.39224
1.3497
1.29698
1.23982
1.18821
1.14835
1.11999
1.10389
1.10531
1.13394
1.19469
1.27851
1.35806
1.39041
1.32254
1.08469
0.616915
0.445289
0.846225
1.01449
1.12562
1.21511
1.28674
1.33333
1.35356
1.3634
1.3707
1.37518
1.37398
1.36376
1.33987
1.30222
1.2514
1.19256
1.13603
1.08971
1.05525
1.03395
1.03046
1.05303
1.10627
1.18136
1.25402
1.28507
1.22756
1.00429
0.581533
0.421747
0.796457
0.957063
1.06648
1.15049
1.20651
1.23755
1.25936
1.27959
1.29742
1.30957
1.31343
1.30759
1.28883
1.25535
1.20857
1.15156
1.09253
1.03978
0.997224
0.968206
0.958673
0.973914
1.01867
1.08516
1.15074
1.17924
1.12938
0.921178
0.54343
0.400715
0.744845
0.89634
0.997824
1.06829
1.1125
1.14623
1.17894
1.20996
1.2353
1.25177
1.25819
1.25461
1.23931
1.20972
1.16786
1.11522
1.05676
0.999417
0.948406
0.908842
0.890836
0.897191
0.932506
0.990345
1.04889
1.07423
1.02964
0.837145
0.503825
0.378439
0.685193
0.823568
0.907821
0.969684
1.02005
1.06707
1.11171
1.15048
1.18003
1.19889
1.2071
1.20517
1.19229
1.16662
1.12969
1.0823
1.0269
0.967957
0.910188
0.859154
0.828183
0.823955
0.848263
0.897232
0.949238
0.971551
0.930315
0.753227
0.463397
0.342546
0.608078
0.723835
0.801738
0.874385
0.940927
1.00155
1.05458
1.09762
1.12953
1.15036
1.16057
1.16053
1.14988
1.1279
1.09528
1.0526
1.00116
0.94328
0.881769
0.821336
0.773443
0.755058
0.766511
0.804848
0.85164
0.872273
0.83459
0.671296
0.422913
0.290099
0.493631
0.603707
0.704317
0.798821
0.881053
0.950476
1.0076
1.05275
1.0864
1.10909
1.12127
1.12317
1.1147
1.09572
1.06648
1.02746
0.979446
0.92365
0.861199
0.794444
0.731358
0.692286
0.687416
0.713562
0.75543
0.776075
0.744154
0.593162
0.383251
0.225827
0.352025
0.500448
0.636925
0.749788
0.840263
0.913235
0.972045
1.01845
1.05343
1.07762
1.09139
1.09494
1.08832
1.07156
1.04483
1.00847
0.963019
0.90909
0.847105
0.777535
0.704123
0.64142
0.614548
0.62378
0.659403
0.682652
0.659639
0.521081
0.344691
0.168801
0.259287
0.450459
0.605521
0.72328
0.815147
0.888779
0.948168
0.995315
1.03126
1.05656
1.07154
1.07637
1.07113
1.05594
1.03097
0.996501
0.952876
0.9004
0.839149
0.768916
0.69038
0.610256
0.55412
0.540412
0.564406
0.589799
0.581682
0.458088
0.308846
0.136565
0.251321
0.450696
0.600703
0.714013
0.803479
0.876171
0.935474
0.983048
1.01971
1.04587
1.06176
1.0675
1.06322
1.04905
1.02519
0.991901
0.94945
0.897996
0.83746
0.767428
0.687389
0.598931
0.51407
0.471207
0.472294
0.500919
0.506343
0.403993
0.276329
0.134543
0.274591
0.467619
0.608771
0.716546
0.803065
0.874431
0.933507
0.981443
1.01872
1.04555
1.06205
1.06833
1.06453
1.0508
1.02738
0.994524
0.952497
0.901434
0.841238
0.771464
0.69133
0.600407
0.501551
0.420337
0.393538
0.411338
0.431221
0.355255
0.246875
0.145078
0.329454
0.502246
0.628468
0.728229
0.811283
0.881735
0.940929
0.989395
1.02732
1.05478
1.07182
1.07847
1.07489
1.06124
1.03778
1.00484
0.962713
0.911585
0.851422
0.781812
0.701836
0.610113
0.506885
0.400096
0.332664
0.32324
0.344605
0.317261
0.221992
0.17334
0.384961
0.539192
0.654292
0.748776
0.829924
0.900095
0.959799
1.00904
1.04773
1.0758
1.09319
1.09991
1.09609
1.08195
1.05779
1.02402
0.981024
0.929134
0.868449
0.798694
0.719053
0.628059
0.523916
0.408561
0.30019
0.253303
0.255932
0.267496
0.198764
0.206048
0.435692
0.575043
0.683855
0.776542
0.858132
0.929349
0.99015
1.04038
1.07985
1.1084
1.12593
1.13237
1.1279
1.11275
1.0873
1.05206
1.00756
0.954302
0.892632
0.822536
0.743453
0.654082
0.552279
0.435334
0.306956
0.20925
0.184125
0.18971
0.170555
0.23472
0.476653
0.610029
0.71788
0.812415
0.896212
0.969398
1.03186
1.08343
1.1239
1.153
1.17057
1.17652
1.17103
1.15439
1.12709
1.08976
1.04314
0.987964
0.924849
0.854147
0.775707
0.688592
0.590672
0.47784
0.342877
0.204708
0.13901
0.131421
0.139627
0.254287
0.503257
0.643697
0.757695
0.857116
0.944513
1.02053
1.08531
1.13874
1.18054
1.21038
1.22798
1.23327
1.22643
1.20783
1.1781
1.13806
1.08868
1.03097
0.965891
0.89417
0.816098
0.731203
0.637634
0.531002
0.401281
0.230215
0.126625
0.103989
0.117684
0.258221
0.519916
0.679622
0.804669
0.910937
1.00315
1.08298
1.15095
1.20695
1.25062
1.2815
1.29924
1.30375
1.29523
1.27418
1.24139
1.19793
1.14505
1.0841
1.01639
0.94302
0.864717
0.781505
0.692178
0.592672
0.471356
0.299393
0.140942
0.0954109
0.0996629
0.260058
0.542895
0.723762
0.860326
0.974282
1.07241
1.15723
1.22946
1.28896
1.3352
1.36758
1.38564
1.38928
1.37874
1.35466
1.31808
1.27036
1.21313
1.14808
1.07689
1.00103
0.921592
0.839045
0.752798
0.659651
0.547188
0.387917
0.203262
0.103298
0.0871169
0.268388
0.579211
0.777765
0.925286
1.04762
1.15287
1.24401
1.32179
1.38589
1.43557
1.47004
1.48869
1.49139
1.47841
1.45057
1.40925
1.35625
1.29362
1.22347
1.14783
1.06845
0.986687
0.903339
0.818317
0.729294
0.622984
0.47854
0.316983
0.154746
0.089221
0.287858
0.629379
0.841747
0.999979
1.13156
1.24528
1.34424
1.42903
1.49907
1.55326
1.59056
1.61014
1.61174
1.5957
1.56312
1.51587
1.45631
1.38703
1.31059
1.22935
1.14529
1.05988
0.974096
0.888382
0.801262
0.699722
0.571177
0.431112
0.273129
0.112672
0.316481
0.689633
0.91527
1.08464
1.22664
1.35036
1.45884
1.55238
1.62995
1.69
1.73103
1.75176
1.75196
1.73206
1.69349
1.63872
1.57099
1.49355
1.40942
1.32126
1.23118
1.14073
1.05092
0.962649
0.875805
0.779259
0.661474
0.534047
0.389281
0.174536
0.348245
0.756073
0.996958
1.17896
1.33301
1.46858
1.5886
1.69299
1.78014
1.84777
1.89344
1.9153
1.91312
1.88804
1.84194
1.77771
1.69988
1.6126
1.51931
1.4228
1.32523
1.22816
1.1327
1.03987
0.950711
0.857412
0.741559
0.614824
0.479149
0.243209
0.381266
0.826479
1.08544
1.28227
1.45046
1.60011
1.73414
1.85208
1.95145
2.02893
2.07962
2.10096
2.09365
2.06088
2.00583
1.93085
1.84123
1.74256
1.63874
1.53259
1.42608
1.32065
1.21746
1.11771
1.02236
0.928533
0.811792
0.680822
0.531197
0.284826
0.414739
0.899603
1.17958
1.39366
1.57838
1.74481
1.8961
2.03116
2.14636
2.23603
2.29024
2.30734
2.28903
2.24311
2.17791
2.09278
1.99151
1.88076
1.76551
1.64873
1.53216
1.4169
1.30371
1.19356
1.08676
0.983249
0.868089
0.735653
0.568735
0.292421
0.448342
0.974665
1.27836
1.51201
1.71583
1.90227
2.07482
2.23185
2.36824
2.46934
2.5259
2.53628
2.49897
2.42937
2.34714
2.25435
2.14539
2.024
1.89727
1.76933
1.64201
1.51608
1.39163
1.2691
1.14781
1.02664
0.908734
0.773669
0.600059
0.300515
0.481925
1.0511
1.38059
1.63585
1.86131
2.07116
2.26983
2.45585
2.61564
2.72694
2.79153
2.79769
2.73583
2.63294
2.51913
2.41442
2.2993
2.16973
2.03214
1.89294
1.75459
1.61791
1.48246
1.34773
1.21264
1.07533
0.939563
0.800796
0.623428
0.31387
0.515453
1.12837
1.48488
1.76323
2.01227
2.24859
2.47921
2.69763
2.88019
3.00344
3.09387
3.1025
3.00319
2.85905
2.7119
2.58291
2.45708
2.317
2.16899
2.01877
1.86942
1.72217
1.57684
1.4314
1.28493
1.1348
0.979316
0.818342
0.6296
0.314481
0.548957
1.20573
1.58962
1.89145
2.16497
2.43009
2.69089
2.94051
3.14116
3.2821
3.40108
3.41734
3.28382
3.09364
2.91483
2.76456
2.62134
2.46658
2.30744
2.14651
1.98632
1.82875
1.6738
1.51976
1.364
1.20368
1.03393
0.847063
0.62496
0.304153
0.582307
1.28227
1.69263
2.01745
2.31573
2.60477
2.88924
3.15665
3.3731
3.52597
3.63259
3.65163
3.51847
3.31286
3.11854
2.95229
2.78768
2.61762
2.44732
2.27602
2.10534
1.93778
1.77369
1.61151
1.44838
1.28037
1.10041
0.895803
0.633348
0.296282
0.61481
1.35669
1.79173
2.13843
2.45651
2.76658
3.07204
3.34656
3.51678
3.61299
3.68492
3.71368
3.68396
3.51209
3.31951
3.13749
2.95382
2.77011
2.5889
2.40737
2.22641
2.04918
1.87639
1.70657
1.53683
1.36274
1.17644
0.962232
0.678418
0.30705
0.646152
1.42816
1.88424
2.24613
2.5812
2.91226
3.22854
3.44644
3.53062
3.6214
3.70196
3.73922
3.7567
3.71059
3.52459
3.32314
3.12287
2.92606
2.73325
2.54087
2.34927
2.16225
1.98084
1.80353
1.62741
1.448
1.25768
1.04053
0.755804
0.344242
0.678521
1.49456
1.96177
2.33312
2.67883
3.00988
3.29506
3.42001
3.51857
3.61307
3.69326
3.73948
3.76191
3.80036
3.73019
3.52528
3.30218
3.08889
2.88186
2.67677
2.4734
2.27591
2.08544
1.90037
1.71764
1.53285
1.33875
1.11982
0.834586
0.385677
0.707213
1.54918
2.02011
2.39248
2.72603
3.04562
3.24523
3.37203
3.48246
3.57952
3.65937
3.71365
3.74301
3.77407
3.81439
3.72574
3.50169
3.26164
3.03565
2.81462
2.5976
2.3886
2.18838
1.99505
1.80526
1.61449
1.41557
1.19354
0.905778
0.421212
0.730615
1.59247
2.05832
2.42038
2.72671
2.99207
3.17352
3.31388
3.42681
3.52092
3.59873
3.65619
3.69424
3.72423
3.75956
3.79372
3.69243
3.44683
3.19332
2.95264
2.71994
2.49823
2.2876
2.08562
1.88848
1.69121
1.48621
1.25874
0.966606
0.454138
0.755649
1.62692
2.08339
2.4188
2.69171
2.92078
3.1133
3.25253
3.35912
3.44676
3.519
3.57549
3.61748
3.651
3.6805
3.71291
3.7295
3.61391
3.35456
3.08868
2.83778
2.60219
2.38072
2.17014
1.96588
1.76219
1.55056
1.31544
1.0157
0.477455
0.781011
1.64735
2.08229
2.39018
2.62754
2.8505
3.04982
3.18728
3.2835
3.36183
3.42782
3.48168
3.525
3.56055
3.58967
3.61315
3.63565
3.63654
3.49529
3.2237
2.94901
2.69758
2.46508
2.24659
2.03613
1.82686
1.60927
1.36629
1.05347
0.491302
0.7826
1.62998
2.03788
2.31577
2.53714
2.74268
2.93658
3.09686
3.19759
3.26812
3.32894
3.38101
3.42496
3.46187
3.49142
3.51314
3.53109
3.54862
3.53696
3.32595
3.04346
2.77824
2.53672
2.31254
2.09753
1.88419
1.66231
1.41339
1.08931
0.503311
0.75523
1.55639
1.94527
2.21643
2.4345
2.62652
2.79989
2.95656
3.08731
3.16952
3.22702
3.27719
3.32074
3.358
3.38805
3.41039
3.42712
3.44136
3.4515
3.36474
3.08506
2.82909
2.5891
2.36485
2.14794
1.93245
1.70833
1.45629
1.12563
0.520447
0.689421
1.46278
1.85183
2.12315
2.3396
2.52431
2.68475
2.82295
2.944
3.0488
3.12054
3.17099
3.2154
3.25269
3.28186
3.30426
3.32056
3.33089
3.33445
3.29903
3.08466
2.84828
2.62221
2.40171
2.18576
1.97003
1.74528
1.49228
1.15953
0.538113
0.640635
1.39199
1.77483
2.04107
2.25291
2.43163
2.58457
2.71307
2.8184
2.90834
2.9903
3.05705
3.10812
3.14774
3.17535
3.19519
3.2097
3.21927
3.21899
3.1938
3.05199
2.84628
2.63695
2.42374
2.21097
1.99641
1.77191
1.51866
1.18417
0.55076
0.624768
1.34317
1.71046
1.96816
2.17435
2.34789
2.49558
2.61904
2.71778
2.79488
2.86151
2.92711
2.98757
3.03509
3.06597
3.08671
3.1013
3.11047
3.1134
3.10091
2.99584
2.82542
2.63358
2.43098
2.22387
2.01197
1.78831
1.53487
1.19917
0.562085
0.614503
1.30291
1.65382
1.9032
2.10474
2.27453
2.41823
2.53774
2.63349
2.70664
2.76293
2.81411
2.86769
2.91641
2.95122
2.97601
2.9973
3.01335
3.02264
3.01197
2.92676
2.78566
2.61345
2.42384
2.22512
2.01799
1.79584
1.54203
1.20599
0.56928
0.602378
1.26285
1.60232
1.8478
2.04736
2.21456
2.35452
2.46985
2.56236
2.63412
2.68888
2.73351
2.7758
2.81677
2.84991
2.87495
2.90005
2.92537
2.9415
2.9255
2.8534
2.7327
2.57745
2.40337
2.21684
2.0169
1.79769
1.54338
1.20534
0.568674
0.586492
1.22297
1.56016
1.80666
2.00577
2.17027
2.30596
2.41654
2.50505
2.57458
2.62905
2.67343
2.71206
2.74645
2.77478
2.79781
2.82195
2.84964
2.86618
2.84707
2.78065
2.67039
2.52972
2.37137
2.19908
2.00986
1.79626
1.5427
1.20155
0.561785
0.56075
1.18925
1.53285
1.78308
1.98212
2.14294
2.27335
2.37863
2.46267
2.52923
2.58238
2.62603
2.66301
2.69428
2.71996
2.7422
2.76441
2.78677
2.79709
2.77338
2.70726
2.60476
2.477
2.33275
2.17442
1.99758
1.792
1.5413
1.19819
0.55637
0.540044
1.16825
1.5229
1.7797
1.97884
2.13448
2.25785
2.35674
2.4356
2.49841
2.54915
2.59098
2.62576
2.65432
2.67775
2.69748
2.71497
2.72821
2.72778
2.69824
2.63453
2.54136
2.4252
2.29216
2.14468
1.97896
1.78368
1.54149
1.19898
0.557726
0.537742
1.16779
1.53345
1.79631
1.99468
2.14345
2.25797
2.34903
2.42193
2.48046
2.52808
2.56714
2.59903
2.62461
2.64465
2.65992
2.67035
2.67347
2.66244
2.6283
2.56807
2.48337
2.37692
2.25245
2.1124
1.95484
1.77149
1.53954
1.2086
0.561792
0.543087
1.18999
1.57072
1.82622
2.01509
2.15972
2.26628
2.34939
2.41695
2.47201
2.51672
2.55285
2.58168
2.60401
2.62027
2.63052
2.63406
2.62849
2.60928
2.57147
2.51295
2.43364
2.334
2.2156
2.08042
1.92814
1.75309
1.53451
1.21287
0.575117
0.56493
1.24648
1.61737
1.85592
2.0294
2.16618
2.26949
2.34915
2.41517
2.46902
2.5121
2.54625
2.57281
2.59252
2.60557
2.61158
2.60966
2.59772
2.5727
2.53159
2.47287
2.39588
2.3
2.18523
2.05255
1.90245
1.73059
1.52048
1.21695
0.589063
0.615153
1.30538
1.65746
1.87167
2.03172
2.16016
2.26242
2.34482
2.41331
2.46855
2.51233
2.54659
2.5727
2.59128
2.60233
2.60548
2.59976
2.58347
2.5544
2.51042
2.45033
2.37346
2.27891
2.16581
2.03403
1.8834
1.71018
1.50049
1.20876
0.588006
0.662047
1.35764
1.68095
1.87948
2.03001
2.15289
2.25451
2.34062
2.4129
2.47156
2.51842
2.55503
2.58254
2.60158
2.61209
2.61387
2.60598
2.58706
2.55535
2.50905
2.44701
2.3688
2.27365
2.16044
2.02818
1.87559
1.69803
1.48128
1.18349
0.581223
0.684928
1.39267
1.68745
1.87815
2.02652
2.14937
2.25288
2.34115
2.41733
2.48182
2.53443
2.57587
2.60694
2.62814
2.63936
2.64059
2.63108
2.60987
2.57562
2.52686
2.46248
2.38197
2.28477
2.16977
2.03553
1.87989
1.69714
1.4708
1.15605
0.561202
0.69042
1.38908
1.67811
1.87112
2.0224
2.14846
2.25281
2.34616
2.43127
2.50462
2.56519
2.61342
2.64993
2.67499
2.68843
2.69026
2.67997
2.65691
2.62013
2.56844
2.50081
2.41667
2.31567
2.19685
2.0585
1.8977
1.70806
1.47303
1.14243
0.53773
0.678432
1.36122
1.65597
1.8581
2.01466
2.14151
2.25495
2.36341
2.46093
2.54495
2.61524
2.67212
2.71581
2.74631
2.76322
2.76648
2.75569
2.73059
2.69077
2.63542
2.56361
2.47475
2.36852
2.24414
2.09984
1.93232
1.73444
1.48888
1.14716
0.535178
0.67463
1.33282
1.63198
1.83866
1.99539
2.13747
2.27412
2.39942
2.51035
2.60687
2.68906
2.7568
2.8098
2.84755
2.86931
2.87467
2.86339
2.83549
2.79125
2.73057
2.65283
2.55755
2.44435
2.31253
2.16037
1.98446
1.77759
1.52242
1.1685
0.542002
0.67302
1.29373
1.59189
1.79822
1.98343
2.15723
2.31486
2.45624
2.58246
2.69416
2.79115
2.87267
2.93775
2.98518
3.0135
3.02166
3.00942
2.97727
2.92641
2.85782
2.77162
2.66756
2.54524
2.40393
2.24194
2.05579
1.83835
1.57259
1.20854
0.559426
0.635665
1.20594
1.52247
1.779
2.00273
2.20286
2.38064
2.5395
2.68295
2.8124
2.92724
3.02604
3.10674
3.16701
3.20417
3.21594
3.20158
3.16259
3.10163
3.02136
2.92319
2.80731
2.67332
2.52028
2.34633
2.14794
1.91791
1.63921
1.2609
0.583582
0.535383
1.07434
1.48707
1.79581
2.05606
2.28213
2.47967
2.65657
2.81865
2.96786
3.10381
3.22378
3.32435
3.40183
3.45149
3.46786
3.44894
3.3984
3.32196
3.22483
3.11013
2.97875
2.83016
2.66302
2.47512
2.26253
2.01764
1.72278
1.32506
0.611741
0.456072
1.02154
1.5006
1.85686
2.15501
2.40476
2.61902
2.81322
2.99486
3.16656
3.32694
3.4719
3.59666
3.69667
3.7647
3.78872
3.76074
3.69002
3.59047
3.46982
3.3333
3.18234
3.01612
2.83268
2.62929
2.40119
2.13947
1.82541
1.40252
0.644858
0.462033
1.06574
1.57805
1.98115
2.3059
2.56809
2.79712
3.01069
3.2153
3.41268
3.60074
3.77382
3.9258
4.05236
4.14483
4.18223
4.14253
4.03936
3.90539
3.75426
3.5907
3.41642
3.22986
3.02827
2.80857
2.565
2.28553
1.94991
1.49764
0.684314
0.504124
1.19374
1.73808
2.16472
2.49077
2.76279
3.01108
3.24926
3.4812
3.70774
3.92653
4.12997
4.31106
4.46461
4.57677
4.62743
4.58296
4.43944
4.25865
4.07145
3.87736
3.67736
3.46872
3.24759
3.01113
2.75347
2.45741
2.10027
1.61679
0.734117
0.587911
1.3824
1.96201
2.3678
2.69122
2.9825
3.25932
3.52898
3.79286
4.0515
4.30315
4.53923
4.75562
4.94281
5.06423
5.09412
5.03807
4.85832
4.63636
4.41179
4.18706
3.96086
3.73035
3.48878
3.23496
2.96303
2.65558
2.28165
1.76611
0.79895
0.69826
1.61616
2.1729
2.56083
2.90556
3.23021
3.54563
3.85287
4.15327
4.44518
4.72782
5.00083
5.26909
5.51357
5.63801
5.59016
5.46897
5.26742
5.02755
4.77086
4.51638
4.2635
4.01148
3.75089
3.48063
3.19506
2.87975
2.49975
1.95994
0.905937
0.854973
1.80954
2.33307
2.74982
3.13932
3.51073
3.87479
4.22809
4.57095
4.89768
5.20923
5.5241
5.86061
6.171
6.25704
6.11411
5.911
5.70076
5.44236
5.15659
4.86891
4.58605
4.31133
4.03426
3.74595
3.45434
3.1296
2.7492
2.21314
1.02672
0.948255
1.95376
2.4903
2.95588
3.396
3.82644
4.25008
4.66206
5.05932
5.43093
5.77924
6.12726
6.51798
6.85932
6.86481
6.68728
6.42868
6.18839
5.89614
5.57906
5.25304
4.93615
4.63629
4.33742
4.01888
3.71961
3.39082
2.97698
2.44575
1.21084
1.01195
2.10457
2.67886
3.17942
3.67954
4.1788
4.67162
5.15716
5.63019
6.07348
6.46785
6.81913
7.20725
7.51467
7.47341
7.35664
7.04982
6.71806
6.38938
6.03747
5.67494
5.31922
4.98709
4.65511
4.30064
3.95176
3.60597
3.18724
2.67373
1.41554
1.06073
2.21974
2.85958
3.41701
3.99401
4.56432
5.1314
5.71011
6.29205
6.84735
7.3068
7.60373
7.89483
8.10698
8.07617
8.07829
7.71135
7.30224
6.92961
6.54273
6.14136
5.74306
5.36733
4.9966
4.6034
4.18057
3.7334
3.26285
2.69934
1.40412
1.04306
2.28586
3.03365
3.69245
4.33722
4.96834
5.6113
6.30134
7.03741
7.79201
8.33832
8.53032
8.59458
8.66856
8.63927
8.67112
8.34061
7.94761
7.54299
7.1094
6.65836
6.21265
5.78683
5.37271
4.94878
4.4627
3.91166
3.2996
2.67517
1.35693
1.03712
2.37417
3.2689
4.01437
4.71136
5.38439
6.10089
6.89771
7.81201
8.72131
9.38302
9.51495
9.29121
9.2256
9.19363
9.10677
8.93707
8.68232
8.24589
7.74483
7.2207
6.71846
6.24436
5.80073
5.33349
4.7947
4.15115
3.37893
2.51494
1.24401
1.10992
2.60126
3.57737
4.37373
5.11596
5.83678
6.62209
7.45734
8.37778
9.34909
9.99214
10.2342
9.831
9.66639
9.61172
9.47282
9.44498
9.43283
9.04463
8.44214
7.80508
7.21065
6.67591
6.21126
5.71763
5.1439
4.44665
3.47571
2.11264
1.08743
1.33183
2.93734
3.95901
4.78002
5.53392
6.26793
7.00409
7.78286
8.65992
9.53977
10.066
10.3193
10.1006
9.87949
9.83147
9.7591
9.86885
10.0968
9.83207
9.15877
8.39487
7.64398
7.04975
6.5049
5.97502
5.39619
4.69301
3.66299
1.99462
0.911989
1.52663
3.24801
4.24368
5.04346
5.78185
6.51985
7.27686
8.02011
8.81676
9.62309
10.0438
10.1618
10.1547
9.97715
9.92336
9.93558
10.0994
10.2869
10.2563
9.63259
8.82512
8.0191
7.27305
6.63367
6.02143
5.40026
4.71023
3.75921
2.24442
0.918234
1.5232
3.30212
4.2948
5.10111
5.85628
6.60133
7.3343
8.07374
8.89447
9.67038
9.98311
9.99405
10.0601
10.0899
10.0529
10.0726
10.1326
10.2012
10.2217
9.78191
9.01136
8.17611
7.4152
6.73868
6.06662
5.39503
4.68501
3.84333
2.68306
1.16579
1.47225
3.27036
4.28238
5.10305
5.86599
6.61245
7.33375
8.08795
8.91873
9.6063
9.83343
9.84549
9.92696
10.0633
10.1264
10.11
10.057
10.0674
10.1182
9.82612
9.10561
8.25692
7.49764
6.81725
6.13037
5.43804
4.72908
3.95261
2.98487
1.41905
1.4416
3.23519
4.27161
5.10895
5.88273
6.62851
7.34368
8.11669
8.92613
9.48119
9.62274
9.66252
9.75541
9.88887
9.98001
9.97439
9.92072
9.9425
10.038
9.91061
9.25204
8.36599
7.56856
6.87221
6.18841
5.49752
4.79192
4.03569
3.12301
1.4804
1.43046
3.22228
4.28466
5.14146
5.93049
6.67306
7.39245
8.18945
8.95833
9.3551
9.40895
9.44429
9.52231
9.6203
9.70106
9.73271
9.74372
9.81796
9.96743
9.97565
9.42647
8.51537
7.6557
6.91723
6.22382
5.53309
4.82397
4.05404
3.12139
1.43483
1.44218
3.24499
4.33241
5.20792
6.01674
6.75634
7.49662
8.31806
9.01096
9.23066
9.21087
9.22075
9.27112
9.33854
9.41008
9.47502
9.54837
9.67842
9.8767
9.98647
9.58844
8.68499
7.76652
6.97852
6.2511
5.53946
4.81658
4.02359
3.05321
1.3703
1.47554
3.29578
4.40725
5.30086
6.1309
6.88349
7.66265
8.49771
9.04566
9.0945
9.02524
9.00975
9.03689
9.08543
9.15205
9.23751
9.35131
9.51938
9.74986
9.93797
9.71006
8.86287
7.90373
7.07032
6.29623
5.5475
4.79581
3.97143
2.95175
1.30167
1.51649
3.36163
4.49358
5.40745
6.25786
7.04506
7.88518
8.7011
9.02809
8.94567
8.8487
8.8159
8.82814
8.86823
8.93361
9.02834
9.16072
9.34578
9.59105
9.8356
9.78141
9.0411
8.0659
7.19487
6.38216
5.59627
4.81025
3.95612
2.89951
1.25637
1.5482
3.41787
4.57818
5.51702
6.39231
7.2319
8.14633
8.87359
8.95417
8.79208
8.68135
8.63831
8.64233
8.67988
8.7465
8.84444
8.98098
9.16765
9.41463
9.69725
9.79671
9.21158
8.24743
7.35249
6.51743
5.70985
4.90514
4.03445
2.968
1.29474
1.57201
3.46577
4.65792
5.62743
6.53274
7.44329
8.42054
8.95327
8.83861
8.63914
8.52255
8.47426
8.47459
8.51251
8.58176
8.68126
8.81538
8.99497
9.23416
9.53503
9.75881
9.36905
8.44151
7.53605
6.69453
5.88737
5.08837
4.2291
3.20378
1.47159
1.60401
3.5196
4.73694
5.73523
6.67646
7.67344
8.6569
8.92067
8.69439
8.48572
8.36938
8.3201
8.32042
8.36059
8.43345
8.53476
8.66514
8.83392
9.05847
9.35661
9.66285
9.49761
8.63902
7.73261
6.89907
6.1066
5.3282
4.5022
3.47402
1.67767
1.65404
3.59224
4.82152
5.83978
6.81772
7.88703
8.77177
8.80194
8.52837
8.32842
8.21818
8.17223
8.17578
8.21974
8.2966
8.40019
8.52746
8.68507
8.89074
9.1692
9.51156
9.56526
8.8268
7.92861
7.10979
6.33533
5.56697
4.71141
3.61723
1.60241
1.7219
3.68142
4.91425
5.94431
6.95955
8.07342
8.74117
8.61173
8.34274
8.16406
8.06542
8.027
8.03653
8.08518
8.16555
8.27072
8.39542
8.54342
8.72899
8.97626
9.30913
9.53045
8.99667
8.11851
7.30973
6.54224
5.73126
4.79389
3.5759
1.57061
1.79558
3.77776
5.01671
6.05939
7.12228
8.20544
8.58164
8.37939
8.14274
7.99111
7.90795
7.88009
7.8973
7.95105
8.03377
8.13862
8.25993
8.39959
8.56666
8.77888
9.07254
9.3711
9.12276
8.31083
7.4908
6.69756
5.83265
4.79119
3.46848
1.51051
1.86608
3.87589
5.13016
6.1864
7.28499
8.20761
8.3423
8.12773
7.93237
7.80862
7.74256
7.72651
7.75202
7.81029
7.89373
7.99573
8.11165
8.24261
8.39316
8.57293
8.81429
9.10628
9.11852
8.47381
7.64315
6.81632
5.91065
4.79379
3.37229
1.41056
1.93157
3.98446
5.26714
6.33678
7.42017
8.06631
8.05456
7.86819
7.71356
7.61568
7.56636
7.56157
7.59467
7.65615
7.73806
7.8345
7.94216
8.06225
8.19737
8.35104
8.54231
8.77287
8.89802
8.54305
7.77981
6.92505
6.00165
4.8858
3.45267
1.38082
1.99273
4.11522
5.42143
6.48738
7.451
7.81086
7.74822
7.60477
7.48702
7.41234
7.37811
7.38206
7.42077
7.48318
7.5614
7.65007
7.74699
7.8541
7.97466
8.10969
8.26322
8.42342
8.5271
8.40476
7.84572
7.04542
6.13125
5.05316
3.63222
1.46768
2.01831
4.24641
5.55513
6.57034
7.33483
7.51028
7.44071
7.33795
7.25354
7.19954
7.1787
7.18786
7.22823
7.2889
7.36173
7.44149
7.52648
7.62052
7.72889
7.85081
7.97959
8.08981
8.13687
8.05835
7.74793
7.11643
6.28358
5.26491
3.89496
1.62835
1.95056
4.29662
5.62764
6.58051
7.12837
7.19461
7.13579
7.06897
7.01505
6.98014
6.96958
6.98208
7.01963
7.07581
7.14189
7.21232
7.28592
7.36932
7.46764
7.57828
7.68702
7.76301
7.77058
7.67769
7.4431
7.02583
6.35652
5.4448
4.14272
1.78241
1.86898
4.23602
5.60201
6.51178
6.86743
6.87327
6.83508
6.80109
6.77473
6.75763
6.75523
6.77099
6.80259
6.85148
6.90928
6.97052
7.035
7.11066
7.19848
7.29522
7.3813
7.42706
7.40745
7.30116
7.08421
6.74646
6.24619
5.47712
4.28761
1.88908
1.80695
4.13978
5.49414
6.3424
6.54877
6.54932
6.54142
6.53726
6.53498
6.53425
6.53961
6.55786
6.58585
6.62493
6.67347
6.7259
6.78348
6.8509
6.926
7.00413
7.06382
7.08067
7.0387
6.92169
6.71578
6.41644
5.99981
5.36831
4.2537
1.98055
1.80653
4.13121
5.32714
6.0347
6.1862
6.22646
6.25337
6.27571
6.29424
6.30882
6.32288
6.34248
6.37084
6.40284
6.44147
6.48546
6.53618
6.59105
6.65061
6.70637
6.73885
6.73072
6.67178
6.54968
6.35545
6.08556
5.71988
5.15858
4.13136
2.0033
1.83068
4.03942
5.13012
5.64271
5.81879
5.90505
5.96418
6.01024
6.04722
6.07627
6.10028
6.12335
6.14988
6.17977
6.21167
6.24773
6.28772
6.32859
6.37044
6.4028
6.41078
6.38326
6.31268
6.19046
6.00975
5.76661
5.44094
4.92056
3.94364
1.95465
1.81958
3.78948
4.80998
5.25371
5.45858
5.58177
5.66965
5.73734
5.79081
5.83302
5.86692
5.89514
5.92039
5.94548
5.9717
6.001
6.03185
6.06121
6.08553
6.09678
6.08493
6.0425
5.96359
5.84183
5.67157
5.44787
5.14943
4.65286
3.7091
1.84353
1.62714
3.51247
4.4437
4.87435
5.10739
5.26131
5.37388
5.46023
5.5279
5.58145
5.62392
5.65728
5.68343
5.70527
5.7264
5.74969
5.77302
5.79158
5.80068
5.79492
5.76767
5.71327
5.62698
5.50349
5.33772
5.12455
4.83951
4.35058
3.44798
1.7044
1.4895
3.29385
4.10695
4.52486
4.77849
4.95442
5.08531
5.1861
5.26523
5.32808
5.3777
5.41575
5.4442
5.46564
5.48376
5.50171
5.51745
5.5258
5.52252
5.50369
5.46458
5.40059
5.30738
5.18018
5.01443
4.80472
4.52061
4.0354
3.17844
1.54849
1.43097
3.09136
3.81756
4.21942
4.48044
4.66808
4.81044
4.92141
5.00929
5.07947
5.13492
5.17729
5.20853
5.23093
5.24754
5.26107
5.26975
5.26923
5.25615
5.22738
5.17934
5.10797
5.00907
4.87828
4.71141
4.50163
4.214
3.73659
2.92653
1.39067
1.35147
2.90002
3.565
3.95024
4.21093
4.40342
4.5522
4.66984
4.76392
4.83941
4.89929
4.94536
4.97934
5.00308
5.01892
5.02903
5.03191
5.02434
5.00373
4.96759
4.913
4.83636
4.73374
4.60119
4.43445
4.22433
3.93504
3.4745
2.71392
1.25722
1.26935
2.7162
3.3358
3.70695
3.96485
4.15865
4.31056
4.4321
4.53013
4.60923
4.67228
4.72116
4.75744
4.78249
4.79802
4.80573
4.80427
4.79144
4.76534
4.72397
4.66486
4.58493
4.48074
4.34873
4.18425
3.97594
3.69
3.25388
2.54756
1.16672
1.18361
2.53918
3.12471
3.4838
3.73784
3.93106
4.08399
4.20741
4.30769
4.38903
4.4542
4.50502
4.54296
4.56898
4.58447
4.59076
4.58639
4.56989
4.54
4.49519
4.43334
4.3519
4.248
4.11841
3.95797
3.75401
3.47622
3.06697
2.4157
1.11062
1.10393
2.37273
2.92938
3.27727
3.52686
3.71835
3.87086
3.99475
4.096
4.17851
4.24489
4.29692
4.33585
4.36239
4.37789
4.38356
4.37753
4.35871
4.32645
4.27962
4.21649
4.13497
4.03266
3.90655
3.75095
3.55307
3.2862
2.90238
2.30013
1.06824
1.03348
2.21864
2.74888
3.08577
3.3302
3.51898
3.6701
3.79337
3.89454
3.9773
4.04411
4.09664
4.13598
4.16257
4.17804
4.18359
4.17686
4.15683
4.12334
4.07562
4.01231
3.93172
3.83175
3.70939
3.55872
3.36759
3.11249
2.75095
2.18763
1.02202
0.970134
2.07837
2.58355
2.90875
3.14698
3.33219
3.48107
3.60281
3.70296
3.78509
3.85155
3.90392
3.94303
3.96927
3.98465
3.99038
3.98359
3.96322
3.92938
3.88166
3.81901
3.73998
3.64267
3.52393
3.3779
3.19339
2.94949
2.60682
2.07351
0.967459
0.915162
1.95332
2.43335
2.74579
2.97674
3.15746
3.30323
3.42265
3.52099
3.60168
3.66699
3.71836
3.75654
3.7821
3.79742
3.80348
3.79709
3.777
3.74352
3.69649
3.63509
3.55804
3.46346
3.3481
3.2063
3.02792
2.79426
2.46816
1.95934
0.908051
0.866846
1.84177
2.29716
2.59615
2.81888
2.99415
3.136
3.25235
3.3482
3.42678
3.49019
3.53974
3.57618
3.60069
3.61596
3.62247
3.61682
3.59751
3.56493
3.51913
3.45942
3.38463
3.2928
3.18066
3.0428
2.87005
2.64584
2.3354
1.85031
0.850538
0.824086
1.7415
2.17315
2.45845
2.6723
2.84137
2.97857
3.09124
3.184
3.25989
3.3208
3.36787
3.40193
3.42498
3.44004
3.44704
3.44241
3.4243
3.39305
3.34889
3.29121
3.21888
3.12989
3.02099
2.88705
2.7198
2.50469
2.21009
1.75096
0.800759
0.785119
1.64982
2.05915
2.33095
2.53561
2.69796
2.82997
2.93844
3.02765
3.10036
3.15831
3.20248
3.23381
3.2551
3.26966
3.27709
3.27364
3.25703
3.22746
3.18524
3.12988
3.06022
2.97424
2.86877
2.73899
2.57746
2.37131
2.09243
1.66108
0.759327
0.748562
1.56478
1.95318
2.21191
2.40733
2.56271
2.68917
2.79306
2.87831
2.94748
3.0021
3.04311
3.07167
3.09114
3.10497
3.11267
3.11043
3.09553
3.06786
3.02782
2.97499
2.9082
2.82546
2.72368
2.59836
2.4428
2.24555
1.98154
1.57697
0.721957
0.713695
1.48469
1.85352
2.09977
2.28612
2.43447
2.55524
2.65431
2.73535
2.80071
2.85175
2.88938
2.91532
2.93322
2.94625
2.95399
2.95284
2.93974
2.91411
2.8764
2.82624
2.76248
2.68314
2.58522
2.46453
2.31502
2.12647
1.8763
1.49649
0.686686
0.679954
1.4084
1.75885
1.99327
2.17087
2.31231
2.42737
2.52155
2.59825
2.65966
2.707
2.74138
2.76504
2.78168
2.79391
2.8014
2.80109
2.78973
2.7662
2.73088
2.68346
2.62276
2.54684
2.45279
2.33674
2.19323
2.01303
1.77565
1.41846
0.653312
0.647116
1.33519
1.66827
1.89151
2.06074
2.19549
2.30496
2.3943
2.46669
2.52416
2.56795
2.59941
2.62138
2.6371
2.64854
2.65548
2.65558
2.64574
2.62424
2.59127
2.5465
2.48877
2.41614
2.32588
2.21437
2.07666
1.90434
1.67868
1.34191
0.622066
0.615171
1.2647
1.58128
1.7939
1.95516
2.08348
2.18756
2.27222
2.34043
2.39417
2.43482
2.46416
2.4851
2.50022
2.51089
2.51699
2.51695
2.50813
2.48845
2.45759
2.41525
2.36025
2.29069
2.20401
2.09684
1.96461
1.79962
1.58462
1.26597
0.590222
0.584072
1.19681
1.49766
1.70014
1.85376
1.97594
2.07487
2.15507
2.21938
2.26977
2.30798
2.33621
2.35684
2.37169
2.38166
2.38672
2.38591
2.37736
2.35904
2.32994
2.28965
2.237
2.17019
2.0868
1.98365
1.85649
1.69827
1.49299
1.19071
0.556773
0.553856
1.13146
1.41728
1.61002
1.75635
1.87267
1.96669
2.04271
2.10347
2.15116
2.18791
2.21589
2.23684
2.25178
2.26118
2.26512
2.26308
2.25397
2.2362
2.20835
2.16961
2.11887
2.05439
1.97393
1.87448
1.75199
1.6
1.40373
1.11682
0.52287
0.524242
1.06852
1.33999
1.5234
1.66275
1.77349
1.86288
1.93504
1.99281
2.0386
2.07474
2.1031
2.1248
2.14013
2.14917
2.15202
2.14858
2.13828
2.12017
2.09282
2.05498
2.00562
1.9431
1.86528
1.76926
1.65117
1.50508
1.31744
1.0453
0.489557
0.495366
1.00804
1.2657
1.44015
1.57282
1.67825
1.76332
1.83209
1.88754
1.93221
1.96827
1.99727
2.01987
2.03578
2.04468
2.04668
2.04187
2.03016
2.011
1.98321
1.94563
1.89717
1.83627
1.76088
1.66817
1.55437
1.41406
1.23486
0.977107
0.457719
0.467736
0.950043
1.19432
1.36014
1.48641
1.58682
1.66799
1.73398
1.78782
1.83191
1.86811
1.89769
1.92102
1.93741
1.9464
1.94785
1.94198
1.92891
1.90837
1.87958
1.84176
1.79379
1.73419
1.66105
1.57156
1.46201
1.32743
1.15657
0.912776
0.427702
0.440959
0.894157
1.12563
1.28316
1.40333
1.49914
1.57699
1.6409
1.69373
1.73755
1.7739
1.80373
1.827
1.84327
1.85221
1.85349
1.8471
1.83318
1.81164
1.78202
1.7438
1.69604
1.63745
1.56631
1.47993
1.37454
1.24562
1.08301
0.852758
0.399884
0.415055
0.840349
1.05941
1.20897
1.32348
1.4153
1.49056
1.55304
1.60527
1.649
1.68541
1.71492
1.73741
1.75301
1.76155
1.76279
1.75643
1.74241
1.72052
1.69051
1.65203
1.60442
1.54666
1.47728
1.39381
1.2925
1.16917
1.01467
0.79734
0.373737
0.390111
0.787655
0.995399
1.13747
1.24699
1.33559
1.40896
1.4705
1.52238
1.56605
1.60228
1.63097
1.65249
1.66721
1.67521
1.67631
1.67014
1.65635
1.63466
1.6048
1.56648
1.51921
1.46225
1.39446
1.31371
1.2164
1.09857
0.952107
0.747689
0.35084
0.366029
0.736983
0.933479
1.06887
1.17429
1.26043
1.33243
1.3933
1.44492
1.48844
1.52401
1.55168
1.57212
1.58593
1.59333
1.59421
1.58821
1.57486
1.55376
1.52457
1.48692
1.44037
1.38436
1.31809
1.23994
1.14655
1.03408
0.895729
0.704085
0.332012
0.342901
0.688369
0.873817
1.00358
1.1059
1.1902
1.26109
1.32134
1.3726
1.41564
1.4502
1.47678
1.49618
1.50914
1.51601
1.5167
1.51087
1.49802
1.47771
1.44952
1.413
1.36761
1.31283
1.24813
1.17248
1.0829
0.975704
0.845431
0.666386
0.316643
0.320231
0.63958
0.816143
0.941996
1.04219
1.125
1.19483
1.25439
1.30507
1.34709
1.3805
1.406
1.42447
1.43675
1.44327
1.44392
1.43832
1.42599
1.40653
1.37951
1.34439
1.30049
1.24721
1.18425
1.11109
1.02514
0.922659
0.79963
0.633432
0.304358
0.295351
0.586378
0.760263
0.884537
0.983304
1.06471
1.13329
1.19187
1.24158
1.28234
1.31461
1.33913
1.35681
1.36863
1.37507
1.37592
1.3707
1.35895
1.34036
1.31452
1.28082
1.23846
1.18686
1.12592
1.05538
0.972701
0.873806
0.756145
0.601319
0.291622
0.268698
0.534505
0.708412
0.831957
0.929332
1.00906
1.07598
1.13307
1.18135
1.22093
1.25222
1.27592
1.29301
1.30464
1.31133
1.31262
1.30793
1.29683
1.27909
1.25436
1.22192
1.18097
1.13114
1.07259
1.00491
0.925357
0.829534
0.715567
0.568731
0.274911
0.242201
0.488828
0.66248
0.784695
0.880122
0.957655
1.02249
1.07771
1.12441
1.16274
1.19305
1.21607
1.23282
1.24454
1.25172
1.25366
1.24961
1.23919
1.22227
1.19852
1.16714
1.12743
1.0795
1.02372
0.959268
0.883047
0.790474
0.679951
0.54026
0.260984
0.219214
0.453658
0.623602
0.742866
0.83542
0.910188
0.97263
1.02587
1.07089
1.1078
1.13702
1.15938
1.17592
1.18788
1.19567
1.19835
1.19504
1.18539
1.1693
1.14642
1.1159
1.07739
1.03153
0.97873
0.917824
0.845374
0.756286
0.64827
0.51339
0.248707
0.201701
0.42954
0.591813
0.70622
0.794902
0.866423
0.926289
0.977474
1.02073
1.05611
1.08415
1.10577
1.12207
1.13422
1.14258
1.14605
1.14364
1.13493
1.11966
1.09744
1.06765
1.03046
0.986822
0.937074
0.879802
0.811437
0.72616
0.619574
0.487478
0.23683
0.189985
0.414354
0.565996
0.674029
0.758026
0.825999
0.883187
0.932226
0.973653
1.00747
1.0343
1.05513
1.07106
1.08326
1.0921
1.09644
1.09504
1.08724
1.07256
1.05081
1.02183
0.986187
0.944869
0.898019
0.844164
0.779769
0.698614
0.593386
0.46233
0.224754
0.182854
0.404808
0.544453
0.645271
0.724022
0.788253
0.842737
0.889591
0.929158
0.961479
0.987197
1.00725
1.02271
1.03492
1.04426
1.04943
1.04874
1.04144
1.02711
1.00591
0.978028
0.944151
0.905082
0.860798
0.809847
0.748914
0.672051
0.569531
0.43782
0.212255
0.177978
0.397036
0.52553
0.619114
0.692196
0.752466
0.804192
0.848859
0.886613
0.917571
0.942345
0.96172
0.976875
0.989301
0.999186
1.00476
1.00412
0.996918
0.982954
0.962559
0.936024
0.903978
0.866975
0.824861
0.77629
0.718364
0.645848
0.548045
0.415832
0.200206
0.173582
0.389444
0.509015
0.594897
0.661912
0.718189
0.767089
0.809505
0.845511
0.87528
0.899297
0.918259
0.933493
0.946412
0.956555
0.961807
0.960824
0.953699
0.940271
0.920859
0.895771
0.8655
0.830385
0.79016
0.743635
0.688442
0.620186
0.528471
0.39745
0.189358
0.169389
0.383193
0.494333
0.571065
0.63243
0.68522
0.731413
0.771562
0.805871
0.83459
0.858047
0.876943
0.892626
0.905924
0.915692
0.920206
0.918962
0.912056
0.899262
0.880893
0.85724
0.828655
0.795314
0.7569
0.712369
0.659776
0.595546
0.510538
0.38344
0.180345
0.162573
0.371972
0.475423
0.545289
0.603116
0.653518
0.697425
0.735502
0.768265
0.796026
0.819077
0.838149
0.854219
0.867271
0.876149
0.880021
0.878671
0.872045
0.859932
0.842623
0.820357
0.793374
0.761739
0.725132
0.682675
0.632737
0.572284
0.49354
0.373572
0.173334
0.151159
0.351204
0.45028
0.518099
0.57485
0.623655
0.665738
0.702054
0.733456
0.760305
0.782976
0.80205
0.817859
0.830038
0.838034
0.841445
0.840044
0.83373
0.822315
0.806043
0.785098
0.759638
0.729661
0.694867
0.654527
0.60725
0.550335
0.477047
0.366007
0.168313
0.142537
0.332976
0.43186
0.496401
0.550404
0.596927
0.637124
0.671863
0.701925
0.727787
0.749798
0.768217
0.783093
0.794291
0.801567
0.804586
0.803158
0.79716
0.786421
0.771135
0.751434
0.72742
0.699055
0.666069
0.627843
0.583146
0.529494
0.460827
0.358066
0.165438
0.144475
0.333489
0.427089
0.484442
0.532376
0.574808
0.612256
0.645065
0.673576
0.698109
0.718875
0.736078
0.749853
0.760175
0.766808
0.769478
0.768032
0.762333
0.752225
0.73786
0.719325
0.696679
0.669868
0.638651
0.602484
0.560242
0.509585
0.444914
0.349335
0.163709
0.146161
0.332247
0.423392
0.476611
0.519316
0.556957
0.590835
0.621139
0.647648
0.67039
0.689564
0.705441
0.718178
0.727681
0.733731
0.736093
0.734631
0.729205
0.719678
0.706162
0.688712
0.667354
0.642024
0.612502
0.578295
0.538353
0.490448
0.429357
0.339832
0.162048
0.140506
0.316664
0.41145
0.46548
0.506069
0.540518
0.571299
0.598978
0.623213
0.643995
0.661601
0.676257
0.688016
0.696759
0.702282
0.704367
0.702889
0.69771
0.68871
0.675972
0.659523
0.639367
0.615431
0.587508
0.555137
0.51732
0.471932
0.414081
0.329588
0.159772
0.131541
0.298342
0.394203
0.449491
0.490172
0.523498
0.55233
0.577689
0.599714
0.618705
0.634912
0.64845
0.65931
0.667362
0.672406
0.674235
0.672735
0.667773
0.659247
0.647215
0.631683
0.612637
0.59
0.56357
0.532899
0.497032
0.453951
0.399036
0.318794
0.156731
0.126098
0.285943
0.376348
0.43182
0.473032
0.505953
0.533404
0.556833
0.577026
0.594488
0.609456
0.621988
0.632035
0.639457
0.644058
0.645642
0.644109
0.639333
0.631227
0.619827
0.605126
0.587098
0.565662
0.540616
0.511518
0.477449
0.436486
0.384237
0.307731
0.153058
0.1258
0.281634
0.361764
0.415354
0.456159
0.488375
0.514537
0.536435
0.555171
0.571356
0.585242
0.596876
0.606191
0.613035
0.617219
0.618563
0.616985
0.61236
0.604618
0.593778
0.579824
0.562724
0.54239
0.518618
0.490973
0.458561
0.419549
0.369727
0.296615
0.149014
0.128032
0.277458
0.34984
0.40056
0.439945
0.471057
0.496028
0.516672
0.534235
0.54937
0.56233
0.573169
0.58182
0.58813
0.591919
0.593028
0.591388
0.586878
0.579443
0.569092
0.555805
0.539541
0.520208
0.497597
0.471279
0.440393
0.403175
0.355576
0.285595
0.144737
0.125985
0.269837
0.337867
0.386177
0.424028
0.454074
0.478084
0.497743
0.514368
0.528648
0.540835
0.550985
0.559038
0.564855
0.568273
0.569149
0.567428
0.562994
0.55581
0.545878
0.533173
0.517649
0.499207
0.477635
0.452513
0.423007
0.387422
0.341855
0.274768
0.140376
0.119821
0.258182
0.324345
0.371439
0.408226
0.437458
0.460833
0.479838
0.49578
0.509401
0.52097
0.530545
0.538077
0.543451
0.546523
0.547165
0.545342
0.540947
0.533956
0.524367
0.512152
0.497259
0.479581
0.458905
0.434819
0.406521
0.372378
0.328634
0.264207
0.135983
0.112766
0.244261
0.30957
0.356252
0.392574
0.421409
0.444535
0.46327
0.478825
0.492
0.503112
0.512236
0.519336
0.524324
0.527077
0.527491
0.52555
0.521154
0.514297
0.504968
0.493138
0.478746
0.461679
0.44172
0.418467
0.391148
0.3582
0.316026
0.254046
0.13174
0.10462
0.229441
0.294492
0.341263
0.377652
0.406579
0.429843
0.448658
0.464121
0.477067
0.487882
0.496675
0.503436
0.508101
0.510574
0.510779
0.508713
0.504284
0.497499
0.488342
0.476777
0.462736
0.446097
0.426639
0.403966
0.377332
0.345248
0.304298
0.244413
0.127564
0.0964232
0.215783
0.281012
0.328207
0.364987
0.394319
0.41796
0.437052
0.452641
0.465549
0.476211
0.48479
0.491308
0.495724
0.497974
0.498004
0.495824
0.491342
0.484577
0.475505
0.464083
0.450236
0.43383
0.414636
0.392256
0.365966
0.334345
0.294169
0.235936
0.123803
0.0905604
0.206808
0.272346
0.319857
0.356991
0.386694
0.410671
0.430042
0.445815
0.458784
0.469409
0.477888
0.484273
0.488545
0.490661
0.490582
0.488323
0.483795
0.477018
0.467964
0.456584
0.442793
0.426448
0.407309
0.384965
0.358683
0.327054
0.286929
0.22916
0.120288
)
;
boundaryField
{
inlet
{
type fixedValue;
value uniform 1;
}
outlet
{
type inletOutlet;
phi phi.air;
inletValue uniform 1;
value nonuniform List<scalar>
30
(
0.0905604
0.206808
0.272346
0.319857
0.356991
0.386694
0.410671
0.430042
0.445815
0.458784
0.469409
0.477888
0.484273
0.488545
0.490661
0.490582
0.488323
0.483795
0.477018
0.467964
0.456584
0.442793
0.426448
0.407309
0.384965
0.358683
0.327054
0.286929
0.22916
0.120288
)
;
}
walls
{
type kqRWallFunction;
value nonuniform List<scalar>
400
(
0.820832
0.569828
0.414924
0.359893
0.316027
0.27222
0.230338
0.198841
0.203629
0.240011
0.322169
0.398587
0.432044
0.450611
0.458707
0.4608
0.463193
0.480976
0.469733
0.439169
0.386551
0.343208
0.335518
0.334441
0.323341
0.291481
0.245432
0.206156
0.185119
0.174828
0.174874
0.182931
0.21055
0.263661
0.35892
0.459715
0.531601
0.565251
0.575078
0.577286
0.572019
0.564979
0.566163
0.574524
0.57392
0.5597
0.576455
0.583124
0.562859
0.522041
0.480138
0.445289
0.421747
0.400715
0.378439
0.342546
0.290099
0.225827
0.168801
0.136565
0.134543
0.145078
0.17334
0.206048
0.23472
0.254287
0.258221
0.260058
0.268388
0.287858
0.316481
0.348245
0.381266
0.414739
0.448342
0.481925
0.515453
0.548957
0.582307
0.61481
0.646152
0.678521
0.707213
0.730615
0.755649
0.781011
0.7826
0.75523
0.689421
0.640635
0.624768
0.614503
0.602378
0.586492
0.56075
0.540044
0.537742
0.543087
0.56493
0.615153
0.662047
0.684928
0.69042
0.678432
0.67463
0.67302
0.635665
0.535383
0.456072
0.462033
0.504124
0.587911
0.69826
0.854973
0.948255
1.01195
1.06073
1.04306
1.03712
1.10992
1.33183
1.52663
1.5232
1.47225
1.4416
1.43046
1.44218
1.47554
1.51649
1.5482
1.57201
1.60401
1.65404
1.7219
1.79558
1.86608
1.93157
1.99273
2.01831
1.95056
1.86898
1.80695
1.80653
1.83068
1.81958
1.62714
1.4895
1.43097
1.35147
1.26935
1.18361
1.10393
1.03348
0.970134
0.915162
0.866846
0.824086
0.785119
0.748562
0.713695
0.679954
0.647116
0.615171
0.584072
0.553856
0.524242
0.495366
0.467736
0.440959
0.415055
0.390111
0.366029
0.342901
0.320231
0.295351
0.268698
0.242201
0.219214
0.201701
0.189985
0.182854
0.177978
0.173582
0.169389
0.162573
0.151159
0.142537
0.144475
0.146161
0.140506
0.131541
0.126098
0.1258
0.128032
0.125985
0.119821
0.112766
0.10462
0.0964232
0.0905604
0.820093
0.582757
0.429319
0.371664
0.345323
0.313592
0.262504
0.214181
0.201458
0.221471
0.254637
0.247763
0.231159
0.197534
0.158527
0.134351
0.131687
0.137294
0.152747
0.167159
0.179707
0.192429
0.206761
0.22366
0.244365
0.271371
0.305252
0.374567
0.469619
0.629701
0.764234
0.758081
0.74014
0.75476
0.795255
0.822738
0.829102
0.826218
0.817937
0.805853
0.794133
0.782992
0.771916
0.760457
0.748314
0.733797
0.717964
0.698187
0.674345
0.647711
0.616915
0.581533
0.54343
0.503825
0.463397
0.422913
0.383251
0.344691
0.308846
0.276329
0.246875
0.221992
0.198764
0.170555
0.139627
0.117684
0.0996629
0.0871169
0.089221
0.112672
0.174536
0.243209
0.284826
0.292421
0.300515
0.31387
0.314481
0.304153
0.296282
0.30705
0.344242
0.385677
0.421212
0.454138
0.477455
0.491302
0.503311
0.520447
0.538113
0.55076
0.562085
0.56928
0.568674
0.561785
0.55637
0.557726
0.561792
0.575117
0.589063
0.588006
0.581223
0.561202
0.53773
0.535178
0.542002
0.559426
0.583582
0.611741
0.644858
0.684314
0.734117
0.79895
0.905937
1.02672
1.21084
1.41554
1.40412
1.35693
1.24401
1.08743
0.911989
0.918234
1.16579
1.41905
1.4804
1.43483
1.3703
1.30167
1.25637
1.29474
1.47159
1.67767
1.60241
1.57061
1.51051
1.41056
1.38082
1.46768
1.62835
1.78241
1.88908
1.98055
2.0033
1.95465
1.84353
1.7044
1.54849
1.39067
1.25722
1.16672
1.11062
1.06824
1.02202
0.967459
0.908051
0.850538
0.800759
0.759327
0.721957
0.686686
0.653312
0.622066
0.590222
0.556773
0.52287
0.489557
0.457719
0.427702
0.399884
0.373737
0.35084
0.332012
0.316643
0.304358
0.291622
0.274911
0.260984
0.248707
0.23683
0.224754
0.212255
0.200206
0.189358
0.180345
0.173334
0.168313
0.165438
0.163709
0.162048
0.159772
0.156731
0.153058
0.149014
0.144737
0.140376
0.135983
0.13174
0.127564
0.123803
0.120288
)
;
}
frontAndBackPlanes
{
type empty;
}
}
// ************************************************************************* //
| [
"mizuha.watanabe@gmail.com"
] | mizuha.watanabe@gmail.com |
d00194ed8d31dade0157e905e1334374c1a27500 | fca339684dfe174fa5fb075a4a323fd32bc673ab | /Test1_Code/Import_Code/main.cpp | bb1c1f38769778d5fb369ada9315071b3a2f8256 | [] | no_license | Jwcob/BA21_MODULE_TESTS | e2e44869f44de420d64fb0fb37885d079e8b8395 | 0d8ab1551d01a59c6475c24f2717589545de5237 | refs/heads/main | 2023-05-13T01:09:50.418445 | 2021-05-25T23:28:08 | 2021-05-25T23:28:08 | 370,734,048 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 88 | cpp | import <iostream>;
int main() {
std::cout << "Hello World!" << std::endl;
return 0;
} | [
"jacob.polanz@chello.at"
] | jacob.polanz@chello.at |
f16673bb1da55e1f406eb25a7f51957c17e2d142 | 822e3d662b4cc83ba807c39a5ed48eb244746edf | /Neural_Network-M/Initializator.cpp | 7bb50991c47bb1ab771ad97c27ae7c5ed5bf2e7c | [] | no_license | PrincePelican/Neural_Network-M | 881d612629705fdba38f2b4b1948e0800e25f726 | 767bca7684f8ff16afd91a562ee1c788d7773442 | refs/heads/master | 2023-07-08T14:41:12.250961 | 2021-08-07T11:25:40 | 2021-08-07T11:25:40 | 367,180,861 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 237 | cpp | #include "Initializator.h"
float Initializator::He_ini(unsigned numberInputs)
{
return 2.0f / numberInputs;
}
float Initializator::Xavier_ini(unsigned numberInputs, unsigned numberOutput)
{
return 1.0f/(numberInputs+numberOutput);
}
| [
"unconfigured@null.spigotmc.org"
] | unconfigured@null.spigotmc.org |
6733b0a7f6cfb941e6713de0d6727fd1e21c7f52 | f84b6f345115f63cd78562030299ccdafd1fef54 | /examples/tv-app/linux/include/audio-output/AudioOutputManager.cpp | 61018e7417424d8e4cf3c2e163afd01c6d577fb1 | [
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0"
] | permissive | JordanField/connectedhomeip | 436bde7b804ffbbaafd254e3d782cabf569a8186 | 8dcf5d70cd54209511be6b1180156a00dd8e0cf8 | refs/heads/master | 2023-09-04T02:30:33.821611 | 2021-10-30T14:14:43 | 2021-10-30T14:14:43 | 423,137,284 | 0 | 0 | Apache-2.0 | 2021-10-31T12:08:08 | 2021-10-31T12:08:08 | null | UTF-8 | C++ | false | false | 2,207 | cpp | /*
*
* Copyright (c) 2021 Project CHIP Authors
* All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "AudioOutputManager.h"
#include <app-common/zap-generated/cluster-objects.h>
#include <app/util/af.h>
#include <app/util/basic-types.h>
#include <lib/core/CHIPSafeCasts.h>
#include <lib/support/CodeUtils.h>
#include <map>
#include <string>
using namespace std;
CHIP_ERROR AudioOutputManager::Init()
{
CHIP_ERROR err = CHIP_NO_ERROR;
// TODO: Store feature map once it is supported
map<string, bool> featureMap;
featureMap["NU"] = true;
return err;
}
CHIP_ERROR AudioOutputManager::proxyGetListOfAudioOutputInfo(chip::app::AttributeValueEncoder & aEncoder)
{
return aEncoder.EncodeList([](const chip::app::TagBoundEncoder & encoder) -> CHIP_ERROR {
// TODO: Insert code here
int maximumVectorSize = 3;
char name[] = "exampleName";
for (int i = 0; i < maximumVectorSize; ++i)
{
chip::app::Clusters::AudioOutput::Structs::AudioOutputInfo::Type audioOutputInfo;
audioOutputInfo.outputType = EMBER_ZCL_AUDIO_OUTPUT_TYPE_HDMI;
audioOutputInfo.name = chip::CharSpan(name, sizeof(name) - 1);
audioOutputInfo.index = static_cast<uint8_t>(1 + i);
ReturnErrorOnFailure(encoder.Encode(audioOutputInfo));
}
return CHIP_NO_ERROR;
});
}
bool audioOutputClusterSelectOutput(uint8_t index)
{
// TODO: Insert code here
return true;
}
bool audioOutputClusterRenameOutput(uint8_t index, const chip::CharSpan & name)
{
// TODO: Insert code here
return true;
}
| [
"noreply@github.com"
] | JordanField.noreply@github.com |
95f8793266aaf3ad42648e3393bb48ea1bf49c26 | 0d0e78c6262417fb1dff53901c6087b29fe260a0 | /bmlb/src/v20180625/model/BindTrafficMirrorReceiversRequest.cpp | ef7a9e2f3d6bbb0448f09870e2e3a8126908c81d | [
"Apache-2.0"
] | permissive | li5ch/tencentcloud-sdk-cpp | ae35ffb0c36773fd28e1b1a58d11755682ade2ee | 12ebfd75a399ee2791f6ac1220a79ce8a9faf7c4 | refs/heads/master | 2022-12-04T15:33:08.729850 | 2020-07-20T00:52:24 | 2020-07-20T00:52:24 | 281,135,686 | 1 | 0 | Apache-2.0 | 2020-07-20T14:14:47 | 2020-07-20T14:14:46 | null | UTF-8 | C++ | false | false | 3,014 | cpp | /*
* 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.
*/
#include <tencentcloud/bmlb/v20180625/model/BindTrafficMirrorReceiversRequest.h>
#include <tencentcloud/core/utils/rapidjson/document.h>
#include <tencentcloud/core/utils/rapidjson/writer.h>
#include <tencentcloud/core/utils/rapidjson/stringbuffer.h>
using namespace TencentCloud::Bmlb::V20180625::Model;
using namespace rapidjson;
using namespace std;
BindTrafficMirrorReceiversRequest::BindTrafficMirrorReceiversRequest() :
m_trafficMirrorIdHasBeenSet(false),
m_receiverSetHasBeenSet(false)
{
}
string BindTrafficMirrorReceiversRequest::ToJsonString() const
{
Document d;
d.SetObject();
Document::AllocatorType& allocator = d.GetAllocator();
if (m_trafficMirrorIdHasBeenSet)
{
Value iKey(kStringType);
string key = "TrafficMirrorId";
iKey.SetString(key.c_str(), allocator);
d.AddMember(iKey, Value(m_trafficMirrorId.c_str(), allocator).Move(), allocator);
}
if (m_receiverSetHasBeenSet)
{
Value iKey(kStringType);
string key = "ReceiverSet";
iKey.SetString(key.c_str(), allocator);
d.AddMember(iKey, Value(kArrayType).Move(), allocator);
int i=0;
for (auto itr = m_receiverSet.begin(); itr != m_receiverSet.end(); ++itr, ++i)
{
d[key.c_str()].PushBack(Value(kObjectType).Move(), allocator);
(*itr).ToJsonObject(d[key.c_str()][i], allocator);
}
}
StringBuffer buffer;
Writer<StringBuffer> writer(buffer);
d.Accept(writer);
return buffer.GetString();
}
string BindTrafficMirrorReceiversRequest::GetTrafficMirrorId() const
{
return m_trafficMirrorId;
}
void BindTrafficMirrorReceiversRequest::SetTrafficMirrorId(const string& _trafficMirrorId)
{
m_trafficMirrorId = _trafficMirrorId;
m_trafficMirrorIdHasBeenSet = true;
}
bool BindTrafficMirrorReceiversRequest::TrafficMirrorIdHasBeenSet() const
{
return m_trafficMirrorIdHasBeenSet;
}
vector<BindTrafficMirrorReceiver> BindTrafficMirrorReceiversRequest::GetReceiverSet() const
{
return m_receiverSet;
}
void BindTrafficMirrorReceiversRequest::SetReceiverSet(const vector<BindTrafficMirrorReceiver>& _receiverSet)
{
m_receiverSet = _receiverSet;
m_receiverSetHasBeenSet = true;
}
bool BindTrafficMirrorReceiversRequest::ReceiverSetHasBeenSet() const
{
return m_receiverSetHasBeenSet;
}
| [
"jimmyzhuang@tencent.com"
] | jimmyzhuang@tencent.com |
d1f75fee577f435311be168377d87394adc8a654 | 13f78c34e80a52442d72e0aa609666163233e7e0 | /CSES/geometry/convexhull.cpp | bf8e228ffbf498887fe058e20fad29299dae23e9 | [] | no_license | Giantpizzahead/comp-programming | 0d16babe49064aee525d78a70641ca154927af20 | 232a19fdd06ecef7be845c92db38772240a33e41 | refs/heads/master | 2023-08-17T20:23:28.693280 | 2023-08-11T22:18:26 | 2023-08-11T22:18:26 | 252,904,746 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,628 | cpp | #include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>
using namespace std;
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#define sz(x) ((int) x.size())
#define all(x) x.begin(), x.end()
using ll = long long;
const int MAXN = 2e5+5;
int N;
struct Point {
int x, y;
double comp;
};
Point P[MAXN];
bool on[MAXN];
vector<Point> H;
int ccw(Point& a, Point& b, Point& c) {
ll res = (ll)(b.x-a.x)*(c.y-a.y) - (ll)(b.y-a.y)*(c.x-a.x);
if (res < 0) return -1;
else if (res > 0) return 1;
else return 0;
}
bool onSeg(Point& a, Point& b, Point& c) {
if (ccw(a, b, c) != 0) return false;
if (a.x == c.x && a.y == c.y) return true;
if (b.x == c.x && b.y == c.y) return true;
if (a.x == b.x) return ((a.y < c.y) == (c.y < b.y));
else return ((a.x < c.x) == (c.x < b.x));
}
void solve() {
cin >> N;
rep(i, 0, N) {
cin >> P[i].x >> P[i].y;
if (make_pair(P[i].y, P[i].x) < make_pair(P[0].y, P[0].x)) {
swap(P[i], P[0]);
}
}
rep(i, 1, N) P[i].comp = atan2(P[i].y-P[0].y, P[i].x-P[0].x);
sort(P+1, P+N, [](const Point& a, const Point& b) {
return a.comp < b.comp;
});
P[N].x = P[0].x;
P[N].y = P[0].y;
rep(i, 0, N+1) {
while (sz(H) >= 2) {
int res = ccw(H[sz(H)-2], H[sz(H)-1], P[i]);
if (res < 0) H.pop_back();
else if (res == 0) {
// Either don't add this one, or remove the other one
if (onSeg(H[sz(H)-2], H[sz(H)-1], P[i])) break;
else H.pop_back();
} else {
H.push_back(P[i]);
break;
}
}
if (sz(H) < 2) H.push_back(P[i]);
}
// Mark points on the hull
// cout << "hull:\n";
// for (Point& p : H) cout << p.x << ' ' << p.y << '\n';
int currSeg = 0, ans = 0;
rep(i, 0, N) {
// cout << "i " << i << " seg " << currSeg << endl;
if (H[currSeg+1].x == P[i].x && H[currSeg+1].y == P[i].y) {
// Next segment
on[i] = true;
ans++;
currSeg++;
// cout << "next\n";
} else if (onSeg(H[currSeg], H[currSeg+1], P[i]) ||
(currSeg != 0 && onSeg(H[currSeg-1], H[currSeg], P[i])) ||
(currSeg != sz(H)-2 && onSeg(H[currSeg+1], H[currSeg+2], P[i]))) {
on[i] = true;
ans++;
}
}
cout << ans << '\n';
rep(i, 0, N) if (on[i]) cout << P[i].x << ' ' << P[i].y << '\n';
}
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
solve();
return 0;
} | [
"43867185+Giantpizzahead@users.noreply.github.com"
] | 43867185+Giantpizzahead@users.noreply.github.com |
b4ae6568579aaab2b498bfb423f8fba4863c94ef | e04f82d5b50f396ae1351d40f5e44d0df096c0b2 | /2.Advanced_Class/코드(Code)/CPP/0919_ACOUNT/0918_db_test/wbdb.cpp | a2466686956f041b8e197dcc8a107658172a2a45 | [] | no_license | SIRAbae/-BIT-Class-Sangbae-Growth-Diary | de1013e5b5187d32dfeb370a03ed6db49031739f | 50e5315ccc5af70a420aeb90c65cf12029b034eb | refs/heads/master | 2022-04-08T18:44:34.606970 | 2020-03-19T11:49:44 | 2020-03-19T11:49:44 | 246,871,821 | 0 | 0 | null | null | null | null | UHC | C++ | false | false | 7,433 | cpp | //wbdb.cpp
#include "std.h"
#define DBNAME TEXT("member1")
#define ID TEXT("wb30")
#define PW TEXT("1234")
SQLHSTMT hStmt;
SQLHENV hEnv;
SQLHDBC hDbc;
BOOL wbdb_DBConnect()
{
// 연결 설정을 위한 변수들
SQLRETURN Ret;
// 1, 환경 핸들을 할당하고 버전 속성을 설정한다.(p1741)
if (SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, &hEnv) != SQL_SUCCESS)
return false;
if (SQLSetEnvAttr(hEnv, SQL_ATTR_ODBC_VERSION, (SQLPOINTER)SQL_OV_ODBC3, SQL_IS_INTEGER) != SQL_SUCCESS)
return false;
// 2. 연결 핸들을 할당하고 연결한다.
if (SQLAllocHandle(SQL_HANDLE_DBC, hEnv, &hDbc) != SQL_SUCCESS)
return false;
// 오라클 서버에 연결하기
Ret = SQLConnect(hDbc, (SQLTCHAR *)DBNAME, SQL_NTS, (SQLTCHAR *)ID, SQL_NTS, (SQLTCHAR *)PW, SQL_NTS);
if ((Ret != SQL_SUCCESS) && (Ret != SQL_SUCCESS_WITH_INFO))
return false;
// 명령 핸들을 할당한다.
if (SQLAllocHandle(SQL_HANDLE_STMT, hDbc, &hStmt) != SQL_SUCCESS)
return false;
return true;
}
BOOL wbdb_DBDConnect()
{
// 뒷정리
if (hStmt) SQLFreeHandle(SQL_HANDLE_STMT, hStmt);
if (hDbc) SQLDisconnect(hDbc);
if (hDbc) SQLFreeHandle(SQL_HANDLE_DBC, hDbc);
if (hEnv) SQLFreeHandle(SQL_HANDLE_ENV, hEnv);
return TRUE;
}
BOOL wbdb_CreateTeamTable()
{
TCHAR str[1024] = TEXT("CREATE TABLE Team (GroupId number,GroupName varchar2(20),CONSTRAINT Group_id_pk primary key(GroupId));");
return CommandSql(str);
}
BOOL wbdb_DropTeamTable()
{
TCHAR str[1024] = TEXT("DROP TABLE Team;");
return CommandSql(str);
}
BOOL wbdb_CreateMemberTable()
{
TCHAR str[1024] = TEXT("CREATE TABLE member( \
mem_ID NUMBER, \
mem_NAME VARCHAR2(20 BYTE) NOT NULL, \
mem_gen VARCHAR2(20 BYTE) \
check(mem_gen in('남성', '여성')), \
mem_phone VARCHAR2(20 BYTE), \
mem_GID NUMBER NOT NULL, \
mem_date date, \
CONSTRAINT member_PK PRIMARY KEY(mem_ID)); ");
TCHAR str1[1024] = TEXT("ALTER TABLE member \
ADD CONSTRAINT member_FK FOREIGN KEY(mem_ID) \
REFERENCES member(mem_ID); ");
return CommandSql(str1);
CommandSql(str);
}
BOOL wbdb_DropMemberTable()
{
TCHAR str[1024] = TEXT("DROP TABLE Member;");
return CommandSql(str);
}
BOOL wbdb_CreateSequence()
{
TCHAR str[1024] = TEXT("create sequence mem_ID_seq increment by 1 start with 1000; ");
return CommandSql(str);
}
BOOL wbdb_DropSequence()
{
TCHAR str[1024] = TEXT("drop sequence mem_ID_seq");
return CommandSql(str);
}
BOOL wbdb_InsertTeam(TCHAR*id)
{
TCHAR str[1024];
//wsprintf(str, TEXT("insert into customer_mgr values(%d, '%s',1321,'12/13/12','F');"),
//team_id, team_name);
wsprintf(str, TEXT("insert into account_table(acc_id, cus_id, acc_date) VALUES(acc_id_num.nextval,(select CUS_ID from CUSTOMER_MGR WHERE cus_name = '%s'),sysdate); "),id);
if (CommandSql(str) == TRUE)
{
TCHAR str[1024] = TEXT("commit");
return CommandSql(str);
}
return FALSE;
}
BOOL wbdb_UpdateTeam(int id, TCHAR* name, TCHAR*phone, TCHAR*date, TCHAR* gender)
{
TCHAR str[1024];
//wsprintf(str, TEXT("insert into customer_mgr values(%d, '%s',1321,'12/13/12','F');"),
//team_id, team_name);
wsprintf(str, TEXT("UPDATE CUSTOMER_MGR SET cus_name = '%s', cus_phone = '%s', cus_date = '%s', cus_gender = '%s' WHERE cus_id = %d; "), name, phone,date, gender,id);
if (CommandSql(str) == TRUE)
{
TCHAR str[1024] = TEXT("commit");
return CommandSql(str);
}
return FALSE;
}
BOOL wbdb_DeleteTeam(int id)
{
TCHAR str[1024];
wsprintf(str, TEXT("DELETE ACCOUNT_TABLE where acc_id = %d; "), id);
if (CommandSql(str) == TRUE)
{
TCHAR str[1024] = TEXT("commit");
return CommandSql(str);
}
return FALSE;
}
BOOL CommandSql(TCHAR *str)
{
if (SQLExecDirect(hStmt, (SQLTCHAR *)str, SQL_NTS) != SQL_SUCCESS)
{
return FALSE;
}
return TRUE;
}
BOOL wbdb_GetTeamSelectAll(vector<AccData>*teamlist)
{
int acc_id, acc_val, acc_count, cus_id;
SQLINTEGER lacc_id,lacc_val,lacc_count,lcus_id;
SQLTCHAR date[50];
SQLINTEGER ldate;
SQLBindCol(hStmt, 1, SQL_C_ULONG, &acc_id, 0, &lacc_id);
SQLBindCol(hStmt, 2, SQL_C_ULONG, &acc_val, 0, &lacc_val);
SQLBindCol(hStmt, 3, SQL_C_WCHAR, date, sizeof(date), &ldate);
SQLBindCol(hStmt, 4, SQL_C_ULONG, &acc_count, 0, &lacc_count);
SQLBindCol(hStmt, 5, SQL_C_ULONG, &cus_id, 0, &lcus_id);
TCHAR sql[256] = TEXT("select * from ACCOUNT_TABLE order by acc_id;");
if (SQLExecDirect(hStmt, (SQLTCHAR*)sql, SQL_NTS) != SQL_SUCCESS)
{
return FALSE;
}
for (int i = 0; SQLFetch(hStmt) != SQL_NO_DATA; i++)
{
AccData data;
data.acc_id = acc_id;
data.acc_val = acc_val;
data.acc_count = acc_count;
data.cus_id = cus_id;
_tcscpy_s(data.acc_date, date);
teamlist->push_back(data);
}
return true;
}
BOOL wbdb_GetMemberName(vector<AccName>* memberlist)
{
//int id;
//SQLINTEGER lteam_id;
SQLTCHAR name[50];
SQLINTEGER lname;
//SQLBindCol(hStmt, 1, SQL_C_ULONG, &id, 0, <eam_id);
SQLBindCol(hStmt, 1, SQL_C_WCHAR, name, sizeof(name), &lname);
TCHAR sql[256] = TEXT("select cus_name from customer_mgr;");
if (SQLExecDirect(hStmt, (SQLTCHAR*)sql, SQL_NTS) != SQL_SUCCESS)
{
return FALSE;
}
for (int i = 0; SQLFetch(hStmt) != SQL_NO_DATA; i++)
{
AccName data = {0};
_tcscpy_s(data.cus_name, name);
memberlist->push_back(data);
}
return TRUE;
}
BOOL wbdb_GetSearchSelectAll(vector<AccData>*teamlist, TCHAR* name)
{
int acc_id, acc_val, acc_count, cus_id;
SQLINTEGER lacc_id, lacc_val, lacc_count, lcus_id;
SQLTCHAR date[50];
SQLINTEGER ldate;
SQLBindCol(hStmt, 1, SQL_C_ULONG, &acc_id, 0, &lacc_id);
SQLBindCol(hStmt, 2, SQL_C_ULONG, &acc_val, 0, &lacc_val);
SQLBindCol(hStmt, 3, SQL_C_WCHAR, date, sizeof(date), &ldate);
SQLBindCol(hStmt, 4, SQL_C_ULONG, &acc_count, 0, &lacc_count);
SQLBindCol(hStmt, 5, SQL_C_ULONG, &cus_id, 0, &lcus_id);
TCHAR sql[256];
wsprintf(sql,TEXT("select * from ACCOUNT_TABLE where cus_id = (select CUS_ID from CUSTOMER_MGR where cus_name = '%s') order by acc_id;"), name);
if (SQLExecDirect(hStmt, (SQLTCHAR*)sql, SQL_NTS) != SQL_SUCCESS)
{
return FALSE;
}
for (int i = 0; SQLFetch(hStmt) != SQL_NO_DATA; i++)
{
AccData data;
data.acc_id = acc_id;
data.acc_val = acc_val;
data.acc_count = acc_count;
data.cus_id = cus_id;
_tcscpy_s(data.acc_date, date);
teamlist->push_back(data);
}
return true;
}
//BOOL mydb_SelectData()
//{
// SQLCHAR Name[256];
//
// SQLINTEGER lName, lSnum, lPhone, lEmail;
// int ssnum;
//
// SQLCHAR Phone[256];
// SQLCHAR Email[256];
//
// SQLBindCol(hStmt, 1, SQL_C_CHAR, Name, sizeof(Name), &lName);
// SQLBindCol(hStmt, 2, SQL_C_ULONG, &ssnum, 0, &lSnum);
// SQLBindCol(hStmt, 3, SQL_C_CHAR, Phone, sizeof(Phone), &lPhone);
// SQLBindCol(hStmt, 4, SQL_C_CHAR, Email, sizeof(Email), &lEmail);
//
// char sql[256] = "select * from sb";
//
// if (SQLExecDirect(hStmt, (SQLCHAR*)sql, SQL_NTS) != SQL_SUCCESS)
// {
// return FALSE;
// }
//
// char name[21], num[21], phoneNumber[21], email[41];
// int count = 0;
// for (int i = 0; SQLFetch(hStmt) != SQL_NO_DATA; i++)
// {
// wsprintf(name, "%s", Name);
// wsprintf(num, "%d", ssnum);
// wsprintf(phoneNumber, "%s", Phone);
// wsprintf(email, "%s", Email);
//
// control_GetData(count++, name, num, phoneNumber, email);
//
// }
// return TRUE;
//}
//
//BOOL mydb_DeleteData()
//{
// char sql[256];
//
// wsprintf(sql, "delete sb");
// if (SQLExecDirect(hStmt, (SQLCHAR *)sql, SQL_NTS) != SQL_SUCCESS)
// {
// return FALSE;
// }
// return TRUE;
//} | [
"56426302+SIRAbae@users.noreply.github.com"
] | 56426302+SIRAbae@users.noreply.github.com |
2993929fda3c4ecaa67e2405c99cd40c0f8c9a8e | 9515e3321c33709258e4686a7cd71e98a8c3a03e | /3p/VTK/ThirdParty/vtkm/vtk-m/vtkm/worklet/testing/UnitTestStreamingSine.cxx | 43aa59d48cad5143a5c813b03002b09e100fd5c8 | [
"BSD-3-Clause",
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | Mason-Wmx/ViewFramework | f9bc534df86f5cf640a9dbf963b9ea17a8e93562 | d8117adc646c369ad29d64477788514c7a75a797 | refs/heads/main | 2023-06-29T04:12:37.042638 | 2021-07-28T09:26:55 | 2021-07-28T09:26:55 | 374,267,631 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 5,236 | cxx | //============================================================================
// Copyright (c) Kitware, Inc.
// All rights reserved.
// See LICENSE.txt for details.
// This software is distributed WITHOUT ANY WARRANTY; without even
// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
// PURPOSE. See the above copyright notice for more information.
//
// Copyright 2014 National Technology & Engineering Solutions of Sandia, LLC (NTESS).
// Copyright 2014 UT-Battelle, LLC.
// Copyright 2014 Los Alamos National Security.
//
// Under the terms of Contract DE-NA0003525 with NTESS,
// the U.S. Government retains certain rights in this software.
//
// Under the terms of Contract DE-AC52-06NA25396 with Los Alamos National
// Laboratory (LANL), the U.S. Government retains certain rights in
// this software.
//============================================================================
#include <vtkm/cont/ArrayHandleStreaming.h>
#include <vtkm/cont/DeviceAdapterAlgorithm.h>
#include <vtkm/cont/testing/Testing.h>
#include <vtkm/worklet/DispatcherMapField.h>
#include <vtkm/worklet/DispatcherStreamingMapField.h>
#include <vector>
namespace vtkm
{
namespace worklet
{
class SineWorklet : public vtkm::worklet::WorkletMapField
{
public:
using ControlSignature = void(FieldIn<>, FieldOut<>);
using ExecutionSignature = _2(_1, WorkIndex);
template <typename T>
VTKM_EXEC T operator()(T x, vtkm::Id& index) const
{
return (static_cast<T>(index) + vtkm::Sin(x));
}
};
}
}
// Utility method to print input, output, and reference arrays
template <class T1, class T2, class T3>
void compareArrays(T1& a1, T2& a2, T3& a3, char const* text)
{
for (vtkm::Id i = 0; i < a1.GetNumberOfValues(); ++i)
{
std::cout << a1.GetPortalConstControl().Get(i) << " " << a2.GetPortalConstControl().Get(i)
<< " " << a3.GetPortalConstControl().Get(i) << std::endl;
VTKM_TEST_ASSERT(
test_equal(a2.GetPortalConstControl().Get(i), a3.GetPortalConstControl().Get(i), 0.01f),
text);
}
}
void TestStreamingSine()
{
// Test the streaming worklet
std::cout << "Testing streaming worklet:" << std::endl;
const vtkm::Id N = 25;
const vtkm::Id NBlocks = 4;
vtkm::cont::ArrayHandle<vtkm::Float32> input, output, reference, summation;
std::vector<vtkm::Float32> data(N), test(N);
vtkm::Float32 testSum = 0.0f;
for (vtkm::UInt32 i = 0; i < N; i++)
{
data[i] = static_cast<vtkm::Float32>(i);
test[i] = static_cast<vtkm::Float32>(i) + static_cast<vtkm::Float32>(vtkm::Sin(data[i]));
testSum += test[i];
}
input = vtkm::cont::make_ArrayHandle(data);
using DeviceAlgorithms = vtkm::cont::DeviceAdapterAlgorithm<VTKM_DEFAULT_DEVICE_ADAPTER_TAG>;
vtkm::worklet::SineWorklet sineWorklet;
vtkm::worklet::DispatcherStreamingMapField<vtkm::worklet::SineWorklet> dispatcher(sineWorklet);
dispatcher.SetNumberOfBlocks(NBlocks);
dispatcher.Invoke(input, output);
reference = vtkm::cont::make_ArrayHandle(test);
compareArrays(input, output, reference, "Wrong result for streaming sine worklet");
vtkm::Float32 referenceSum, streamSum;
// Test the streaming exclusive scan
std::cout << "Testing streaming exclusive scan: " << std::endl;
referenceSum = DeviceAlgorithms::ScanExclusive(input, summation);
streamSum = DeviceAlgorithms::StreamingScanExclusive(4, input, output);
VTKM_TEST_ASSERT(test_equal(streamSum, referenceSum, 0.01f),
"Wrong sum for streaming exclusive scan");
compareArrays(input, output, summation, "Wrong result for streaming exclusive scan");
// Test the streaming exclusive scan with binary operator
std::cout << "Testing streaming exnclusive scan with binary operator: " << std::endl;
vtkm::Float32 initValue = 0.0;
referenceSum = DeviceAlgorithms::ScanExclusive(input, summation, vtkm::Maximum(), initValue);
streamSum =
DeviceAlgorithms::StreamingScanExclusive(4, input, output, vtkm::Maximum(), initValue);
VTKM_TEST_ASSERT(test_equal(streamSum, referenceSum, 0.01f),
"Wrong sum for streaming exclusive scan with binary operator");
compareArrays(
input, output, summation, "Wrong result for streaming exclusive scan with binary operator");
// Test the streaming reduce
std::cout << "Testing streaming reduce: " << std::endl;
referenceSum = DeviceAlgorithms::Reduce(input, 0.0f);
streamSum = DeviceAlgorithms::StreamingReduce(4, input, 0.0f);
std::cout << "Result: " << streamSum << " " << referenceSum << std::endl;
VTKM_TEST_ASSERT(test_equal(streamSum, referenceSum, 0.01f), "Wrong sum for streaming reduce");
// Test the streaming reduce with binary operator
std::cout << "Testing streaming reduce with binary operator: " << std::endl;
referenceSum = DeviceAlgorithms::Reduce(input, 0.0f, vtkm::Maximum());
streamSum = DeviceAlgorithms::StreamingReduce(4, input, 0.0f, vtkm::Maximum());
std::cout << "Result: " << streamSum << " " << referenceSum << std::endl;
VTKM_TEST_ASSERT(test_equal(streamSum, referenceSum, 0.01f),
"Wrong sum for streaming reduce with binary operator");
}
int UnitTestStreamingSine(int, char* [])
{
return vtkm::cont::testing::Testing::Run(TestStreamingSine);
}
| [
"mingxin.wang@peraglobal.com"
] | mingxin.wang@peraglobal.com |
003144932ae0c24d4f1edef7f74d192d04168587 | ca770a8b01e1e949bb929f8b76f473e54070d9ff | /TemplateGame/GameObject.h | edfc8404f9ee02f31c84c785445a2cd95e9080c0 | [] | no_license | maslhiro/DirectXGame_0809 | 69bdacdc9a69f88c2a45cbc6266ef12dd698995e | 773ea3dc550fd3d910d85fdc657ffa30abe92d3e | refs/heads/master | 2021-07-09T01:01:20.813533 | 2020-10-30T08:22:50 | 2020-10-30T08:22:50 | 207,265,653 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,542 | h | #pragma once
#include "define.h"
#include "Texture.h"
#include "Animation.h"
#include "DeviceManager.h"
#include "AnimationManager.h"
#include "Sound.h"
class GameObject
{
protected:
int _id;
// Chia Id de phan biet cac the loai game obj :)))
int _idType;
// Static obj : land, pillar, rope, ..
bool _isStaticObj;
// Lưu lại rect của các obj như land, rope,.. bởi vì chúng nó đéo có animation
RECT _boundingWorld;
Animation _curAnimation;
// Map state voi idAnimation tuong ung
std::unordered_map<int, Animation> _listAnimation;
// Doi tuong nao dung yen thi state = NONE
int _state;
// Lat nguoc sprite
bool _isFlip;
bool _isAnimated;
bool _isTerminated;
float _speed; // vx
float _gravity; // vy
float _dx, _dy;
Vec3 _posWorld;
Vec2 _scale;
pDeviceManager _device;
pTexture _texture;
pSound _sound;
public:
int getId();
void setId(int);
void setIsStaticObj(bool);
bool getIsStaticObj();
void setRectWorld(RECT);
int getIdType();
void setIdType(int);
void setSpeed(float);
void setGravity(float);
void setDx(float);
void setDy(float);
void setState(int);
int getState();
int getCurrentFrame();
void setPositionWorld(Vec3);
void setPositionWorld(Vec2);
void setPositionWorld(int, int);
Vec3 getPosWorld();
void setScale(Vec2);
void setScale(float, float);
void setScale(float);
void setIsFlip(bool);
void setIsAnimated(bool);
bool getIsAnimated();
void setIsTerminated(bool);
bool getIsTerminated();
// Load Animation từ Animation Manager vao map Animation
virtual void loadResource() = 0;
virtual void render() = 0;
virtual void update(float) = 0;
// bắt sự kiện phím thay dổi, đặt trước hàm update để fix pos -> dưa theo speed :rainbow:
virtual void handlerInput(float) = 0;
bool checkCollision(RECT);
float checkCollision_SweptAABB(RECT, float, float, int&);
float checkCollision_SweptAABB_(RECT, float, float, int&);
// Fix pos khi chuyển animation
void fixPosAnimation(int);
// Mac dinh fix theo bottom
float fixPosHeight(int);
// Mac dinh fix theo left
float fixPosWidth(int);
// isStatic = false => Lay RECT của Sprite đầu tiên trong Animation
// isStatic = true => lay bouding world obj
// Này dùng để fix pos
RECT getBoundingBox();
// isStatic = false => Lay RECT của Ani gốc
// isStatic = true => lay bouding world obj
// Này dùng để fix pos
RECT getCurrentBoudingBox();
GameObject();
GameObject(int);
~GameObject();
};
typedef GameObject* pGameObject; | [
"nhutvinh14@gmail.com"
] | nhutvinh14@gmail.com |
de68eb590dff9ac5036863e3580df15f5c8de4f3 | 51e3a836068b7762d2078a380953f17c5fd20b85 | /Source/Logger/Logger.cpp | e1b8420451b92f7d7f301b2d2ab5a28d7c51df3a | [
"Apache-2.0"
] | permissive | igorlev91/DemoEngine | 82874d8db69ae54ffcdbf9aa74a38ffbafed9cfa | 8aaef0d3504826c9dcabe0a826a54613fca81c87 | refs/heads/master | 2022-07-17T16:22:43.151378 | 2020-05-20T21:26:57 | 2020-05-20T21:26:57 | 208,259,144 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,483 | cpp | #include "Precompiled.hpp"
#include "Logger/Logger.hpp"
#include "Logger/Output.hpp"
#include "Logger/Sink.hpp"
namespace
{
// Default logger sink.
Logger::Sink sink;
// Default logger outputs.
Logger::FileOutput fileOutput;
Logger::ConsoleOutput consoleOutput;
Logger::DebuggerOutput debuggerOutput;
// Initialization state.
bool initialized = false;
}
void Logger::Initialize()
{
// Make sure not to initialize twice.
if(initialized)
return;
// Add the file output.
if(fileOutput.Open("Log.txt"))
{
sink.AddOutput(&fileOutput);
}
// Add the console output.
sink.AddOutput(&consoleOutput);
// Add the debugger output.
sink.AddOutput(&debuggerOutput);
// Set initialization state.
initialized = true;
}
void Logger::Write(const Logger::Message& message)
{
if(!initialized)
{
std::cerr << "Default logger has not been initialized yet!";
DEBUG_BREAKPOINT();
}
sink.Write(message);
}
int Logger::AdvanceFrameReference()
{
if (!initialized)
{
std::cerr << "Default logger has not been initialized yet!";
DEBUG_BREAKPOINT();
}
return sink.AdvanceFrameReference();
}
bool Logger::IsInitialized()
{
return initialized;
}
Logger::Sink& Logger::GetGlobalSink()
{
if (!initialized)
{
std::cerr << "Default logger has not been initialized yet!";
DEBUG_BREAKPOINT();
}
return sink;
}
| [
"lev-118@gmail.com"
] | lev-118@gmail.com |
3137359a51225ba4584993c497545c86313ca61f | 2e386d3d97fe1847778fa9d2116cfa2129f9976a | /Simulator.cpp | 8a7449bca4ba22862ae2c68ca8ed3aaf36522172 | [] | no_license | RyanLai7916/Tech-test | 4db3f5527406a859ebb52a854c17a1c9d66ad81f | 7813cf23c6e85c7eb601579b7c59c60554912e9f | refs/heads/main | 2023-03-23T14:06:12.796264 | 2021-03-17T10:52:42 | 2021-03-17T10:52:42 | 348,655,283 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,913 | cpp | // Simulator.cpp : This file contains the 'main' function. Program execution begins and ends there.
//
#include <fstream>
#include <iostream>
#include <boost/property_tree/ptree.hpp>
#include <boost/property_tree/json_parser.hpp>
#include "Simulation.h"
int main(int argc, char** argv)
{
if (argc < 2)
{
std::cout << "Simulator.exe <simfile> [json]" << std::endl;
std::cout << "simulation output is in circuit.jsonp" << std::endl;
exit(0);
}
bool json = (argc >= 3 && "json" == std::string(argv[2]));
std::ifstream input(argv[1], std::ios::in);
auto simulation = Simulation::FromFile(input);
if (json)
{
simulation->LayoutFromFile(input);
// probe all gates should only be executed when
// json output is on
simulation->ProbeAllGates();
}
simulation->Run();
if (json)
{
simulation->UndoProbeAllGates();
}
if (argc >= 3 && "json" == std::string(argv[2]))
{
boost::property_tree::ptree simResult = simulation->GetJson();
std::ofstream output("circuit.jsonp", std::ios::out);
output << "onJsonp(";
boost::property_tree::write_json(output, simResult);
output << ");\n";
}
if (argc >= 3 && "csv" == std::string(argv[2]))
{
std::ofstream gatesoutput("gates.csv", std::ios::out);
gatesoutput << "id,table,type,probed,inputs,outputs\n";
gatesoutput << simulation->GetGates();
gatesoutput.close();
std::ofstream tracesoutput("traces.csv", std::ios::out);
tracesoutput << "time,gate,output\n";
tracesoutput << simulation->GetTraces();
tracesoutput.close();
std::ofstream layoutoutput("layout", std::ios::out);
layoutoutput << simulation->GetLayout();
layoutoutput.close();
}
simulation->PrintProbes(std::cout);
}
| [
"ryan.lai7916@gmail.com"
] | ryan.lai7916@gmail.com |
1f0df1c1ab70a5e92e10a8c000c9f0c41906c624 | 297bc28f8ddd7c901398a9338f405d8aeee5cd89 | /500.cpp | 45e875e3770b9f6bdd668672e3be8b95daa66680 | [] | no_license | lyswty/leetcode-solutions | 951072abc316234d32938b041221e0c17504a06f | 88aac5289228d1d62fe3e6b4926311bdf2cdfad2 | refs/heads/master | 2020-04-21T20:57:03.752636 | 2019-08-11T14:09:41 | 2019-08-11T14:09:41 | 169,862,666 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 616 | cpp | class Solution {
public:
vector<string> findWords(vector<string>& words) {
vector<string>rows(3),res;
rows[0]="qwertyuiop",rows[1]="asdfghjkl",rows[2]="zxcvbnm";
unordered_map<char,int>row;
for(int i=0;i<3;i++) for(char x:rows[i]){
row[x]=i;
row[toupper(x)]=i;
}
for(string& word:words){
bool flag=true;
for(int i=1;i<word.size();i++) if(row[word[i]]!=row[word[0]]){
flag=false;
break;
}
if(flag) res.emplace_back(word);
}
return res;
}
};
| [
"noreply@github.com"
] | lyswty.noreply@github.com |
2b037a2c1cdc16ff3ef8f78c2f9511121d15d446 | bb6ebff7a7f6140903d37905c350954ff6599091 | /chrome/browser/services/gcm/gcm_profile_service_unittest.cc | 2b1e5014642e4cb160de5395474d9526bbf58e12 | [
"BSD-3-Clause"
] | permissive | PDi-Communication-Systems-Inc/lollipop_external_chromium_org | faa6602bd6bfd9b9b6277ce3cd16df0bd26e7f2f | ccadf4e63dd34be157281f53fe213d09a8c66d2c | refs/heads/master | 2022-12-23T18:07:04.568931 | 2016-04-11T16:03:36 | 2016-04-11T16:03:36 | 53,677,925 | 0 | 1 | BSD-3-Clause | 2022-12-09T23:46:46 | 2016-03-11T15:49:07 | C++ | UTF-8 | C++ | false | false | 8,118 | cc | // 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.
#include "chrome/browser/services/gcm/gcm_profile_service.h"
#include <vector>
#include "base/bind.h"
#include "base/bind_helpers.h"
#include "base/callback.h"
#include "base/memory/scoped_ptr.h"
#include "base/run_loop.h"
#include "chrome/browser/services/gcm/fake_signin_manager.h"
#include "chrome/browser/services/gcm/gcm_profile_service_factory.h"
#include "chrome/browser/signin/signin_manager_factory.h"
#include "chrome/test/base/testing_profile.h"
#include "components/gcm_driver/fake_gcm_app_handler.h"
#include "components/gcm_driver/fake_gcm_client.h"
#include "components/gcm_driver/fake_gcm_client_factory.h"
#include "components/gcm_driver/gcm_client.h"
#include "components/gcm_driver/gcm_client_factory.h"
#include "components/gcm_driver/gcm_driver.h"
#include "components/pref_registry/pref_registry_syncable.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/test/test_browser_thread_bundle.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace gcm {
namespace {
const char kTestAccountID[] = "user@example.com";
const char kTestAppID[] = "TestApp";
const char kUserID[] = "user";
KeyedService* BuildGCMProfileService(content::BrowserContext* context) {
return new GCMProfileService(
Profile::FromBrowserContext(context),
scoped_ptr<GCMClientFactory>(new FakeGCMClientFactory(
FakeGCMClient::NO_DELAY_START,
content::BrowserThread::GetMessageLoopProxyForThread(
content::BrowserThread::UI),
content::BrowserThread::GetMessageLoopProxyForThread(
content::BrowserThread::IO))));
}
} // namespace
class GCMProfileServiceTest : public testing::Test {
protected:
GCMProfileServiceTest();
virtual ~GCMProfileServiceTest();
// testing::Test:
virtual void SetUp() OVERRIDE;
virtual void TearDown() OVERRIDE;
FakeGCMClient* GetGCMClient() const;
void CreateGCMProfileService();
void SignIn();
void RegisterAndWaitForCompletion(const std::vector<std::string>& sender_ids);
void UnregisterAndWaitForCompletion();
void SendAndWaitForCompletion(const GCMClient::OutgoingMessage& message);
void RegisterCompleted(const base::Closure& callback,
const std::string& registration_id,
GCMClient::Result result);
void UnregisterCompleted(const base::Closure& callback,
GCMClient::Result result);
void SendCompleted(const base::Closure& callback,
const std::string& message_id,
GCMClient::Result result);
GCMDriver* driver() const { return gcm_profile_service_->driver(); }
std::string registration_id() const { return registration_id_; }
GCMClient::Result registration_result() const { return registration_result_; }
GCMClient::Result unregistration_result() const {
return unregistration_result_;
}
std::string send_message_id() const { return send_message_id_; }
GCMClient::Result send_result() const { return send_result_; }
private:
content::TestBrowserThreadBundle thread_bundle_;
scoped_ptr<TestingProfile> profile_;
GCMProfileService* gcm_profile_service_;
scoped_ptr<FakeGCMAppHandler> gcm_app_handler_;
std::string registration_id_;
GCMClient::Result registration_result_;
GCMClient::Result unregistration_result_;
std::string send_message_id_;
GCMClient::Result send_result_;
DISALLOW_COPY_AND_ASSIGN(GCMProfileServiceTest);
};
GCMProfileServiceTest::GCMProfileServiceTest()
: gcm_profile_service_(NULL),
gcm_app_handler_(new FakeGCMAppHandler),
registration_result_(GCMClient::UNKNOWN_ERROR),
send_result_(GCMClient::UNKNOWN_ERROR) {
}
GCMProfileServiceTest::~GCMProfileServiceTest() {
}
FakeGCMClient* GCMProfileServiceTest::GetGCMClient() const {
return static_cast<FakeGCMClient*>(
gcm_profile_service_->driver()->GetGCMClientForTesting());
}
void GCMProfileServiceTest::SetUp() {
TestingProfile::Builder builder;
builder.AddTestingFactory(SigninManagerFactory::GetInstance(),
FakeSigninManager::Build);
profile_ = builder.Build();
}
void GCMProfileServiceTest::TearDown() {
gcm_profile_service_->driver()->RemoveAppHandler(kTestAppID);
}
void GCMProfileServiceTest::CreateGCMProfileService() {
gcm_profile_service_ = static_cast<GCMProfileService*>(
GCMProfileServiceFactory::GetInstance()->SetTestingFactoryAndUse(
profile_.get(),
&BuildGCMProfileService));
gcm_profile_service_->driver()->AddAppHandler(
kTestAppID, gcm_app_handler_.get());
}
void GCMProfileServiceTest::SignIn() {
FakeSigninManager* signin_manager = static_cast<FakeSigninManager*>(
SigninManagerFactory::GetInstance()->GetForProfile(profile_.get()));
signin_manager->SignIn(kTestAccountID);
base::RunLoop().RunUntilIdle();
}
void GCMProfileServiceTest::RegisterAndWaitForCompletion(
const std::vector<std::string>& sender_ids) {
base::RunLoop run_loop;
gcm_profile_service_->driver()->Register(
kTestAppID,
sender_ids,
base::Bind(&GCMProfileServiceTest::RegisterCompleted,
base::Unretained(this),
run_loop.QuitClosure()));
run_loop.Run();
}
void GCMProfileServiceTest::UnregisterAndWaitForCompletion() {
base::RunLoop run_loop;
gcm_profile_service_->driver()->Unregister(
kTestAppID,
base::Bind(&GCMProfileServiceTest::UnregisterCompleted,
base::Unretained(this),
run_loop.QuitClosure()));
run_loop.Run();
}
void GCMProfileServiceTest::SendAndWaitForCompletion(
const GCMClient::OutgoingMessage& message) {
base::RunLoop run_loop;
gcm_profile_service_->driver()->Send(
kTestAppID,
kUserID,
message,
base::Bind(&GCMProfileServiceTest::SendCompleted,
base::Unretained(this),
run_loop.QuitClosure()));
run_loop.Run();
}
void GCMProfileServiceTest::RegisterCompleted(
const base::Closure& callback,
const std::string& registration_id,
GCMClient::Result result) {
registration_id_ = registration_id;
registration_result_ = result;
callback.Run();
}
void GCMProfileServiceTest::UnregisterCompleted(
const base::Closure& callback,
GCMClient::Result result) {
unregistration_result_ = result;
callback.Run();
}
void GCMProfileServiceTest::SendCompleted(
const base::Closure& callback,
const std::string& message_id,
GCMClient::Result result) {
send_message_id_ = message_id;
send_result_ = result;
callback.Run();
}
TEST_F(GCMProfileServiceTest, CreateGCMProfileServiceBeforeSignIn) {
CreateGCMProfileService();
EXPECT_FALSE(driver()->IsStarted());
SignIn();
EXPECT_TRUE(driver()->IsStarted());
}
TEST_F(GCMProfileServiceTest, CreateGCMProfileServiceAfterSignIn) {
SignIn();
// Note that we can't check if GCM is started or not since the
// GCMProfileService that hosts the GCMDriver is not created yet.
CreateGCMProfileService();
EXPECT_TRUE(driver()->IsStarted());
}
TEST_F(GCMProfileServiceTest, RegisterAndUnregister) {
CreateGCMProfileService();
SignIn();
std::vector<std::string> sender_ids;
sender_ids.push_back("sender");
RegisterAndWaitForCompletion(sender_ids);
std::string expected_registration_id =
FakeGCMClient::GetRegistrationIdFromSenderIds(sender_ids);
EXPECT_EQ(expected_registration_id, registration_id());
EXPECT_EQ(GCMClient::SUCCESS, registration_result());
UnregisterAndWaitForCompletion();
EXPECT_EQ(GCMClient::SUCCESS, unregistration_result());
}
TEST_F(GCMProfileServiceTest, Send) {
CreateGCMProfileService();
SignIn();
GCMClient::OutgoingMessage message;
message.id = "1";
message.data["key1"] = "value1";
SendAndWaitForCompletion( message);
EXPECT_EQ(message.id, send_message_id());
EXPECT_EQ(GCMClient::SUCCESS, send_result());
}
} // namespace gcm
| [
"mrobbeloth@pdiarm.com"
] | mrobbeloth@pdiarm.com |
0815e61795b8bc251158c21e63561ae23b7dccc7 | 911f133ff3fbfde58ee6b8d57ea8e5393f971234 | /Ch5/Exercise 5.2.cpp | 14a97de065a9673cc91d700d248f98942942945f | [] | no_license | xche03/CPP-Primer-5th | 5e2ba71791a405390505264778784813c2776232 | 887c236c01891bda726ef3a23ec375b53885022d | refs/heads/master | 2021-01-09T21:52:04.924093 | 2016-02-29T15:28:32 | 2016-02-29T15:28:32 | 44,064,362 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 356 | cpp | /*Exercise 5.2: What is a block? When might you might use a block?*/
/*A compound statement, usually referred to as a block, is a (possibly empty)
sequence of statements and declarations surrounded by a pair of curly braces.*/
/*Compound statements are used when the language requires a single statement but
the logic of our program needs more than one.*/ | [
"xche03@gmail.com"
] | xche03@gmail.com |
d21868f567330b6be914e67bce29e25d86edd605 | 148b61252764fdd95aa17e52179d801bdd20ee15 | /mars/stn/src/simple_ipport_sort.cc | 4caaf20b100f83e61217dc0096d5b4213c553fba | [
"MIT",
"Zlib",
"BSD-3-Clause",
"LicenseRef-scancode-openssl",
"LicenseRef-scancode-ssleay-windows",
"BSL-1.0",
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference",
"OpenSSL"
] | permissive | Lynnnnnn/mars | 8c7ab4b6e193de5e83ba79668f9461fea017f9a7 | 2b87cceec445b649b5c0190c119e9cbb30e5dc85 | refs/heads/master | 2021-04-29T08:17:35.555275 | 2016-12-29T14:32:28 | 2016-12-29T14:32:28 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 14,624 | cc | // Tencent is pleased to support the open source community by making GAutomator available.
// Copyright (C) 2016 THL A29 Limited, a Tencent company. All rights reserved.
// Licensed under the MIT License (the "License"); you may not use this file except in
// compliance with the License. You may obtain a copy of the License at
// http://opensource.org/licenses/MIT
// 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.
/*
* simple_ipport_sort.cc
* network
*
* Created by liucan on 14-6-16.
* Copyright (c) 2014年 Tencent. All rights reserved.
*/
#include "simple_ipport_sort.h"
#include <unistd.h>
#include <math.h>
#include <deque>
#include <algorithm>
#include "boost/filesystem.hpp"
#include "boost/bind.hpp"
#include "boost/accumulators/numeric/functional.hpp"
#include "mars/comm/time_utils.h"
#include "mars/comm/xlogger/xlogger.h"
#include "mars/comm/platform_comm.h"
#include "mars/app/app.h"
#define IPPORT_RECORDS_FILENAME "/ipportrecords2.xml"
static const time_t kRecordTimeout = 60 * 60 * 24;
static const char* const kFolderName = "host";
// const static char* const RECORDS = "records";
static const char* const kRecord = "record";
static const char* const kItem = "item";
static const char* const kTime = "time";
static const char* const kNetInfo = "netinfo";
static const char* const kIP = "ip";
static const char* const kPort = "port";
//static const char* const kSuccess = "succ";
//static const char* const kTotal = "total";
static const char* const kHistoryResult = "historyresult";
static const unsigned int kBanTime = 6 * 60 * 1000; // 6 min
static const int kBanFailCount = 3;
static const int kSuccessUpdateInterval = 10*1000;
static const int kFailUpdateInterval = 10*1000;
#define SET_BIT(SET, RECORDS) RECORDS = (((RECORDS)<<1) | (bool(SET)))
static inline
uint32_t CAL_BIT_COUNT(uint64_t RECORDS) {
uint32_t COUNT = 0;
while(RECORDS)
{
RECORDS = RECORDS & (RECORDS-1);
COUNT++;
}
return COUNT;
}
///////////////////////////////////////////////////////////////////////////////////////////
namespace mars { namespace stn {
struct BanItem {
std::string ip;
uint16_t port;
uint8_t records;
tickcount_t last_fail_time;
tickcount_t last_suc_time;
BanItem(): port(0), records(0) {}
};
}}
using namespace mars::stn;
SimpleIPPortSort::SimpleIPPortSort()
: hostpath_(mars::app::GetAppFilePath() + "/" + kFolderName) {
if (!boost::filesystem::exists(hostpath_)){
boost::filesystem::create_directory(hostpath_);
}
ScopedLock lock(mutex_);
__LoadXml();
lock.unlock();
InitHistory2BannedList(false);
}
SimpleIPPortSort::~SimpleIPPortSort() {
ScopedLock lock(mutex_);
__SaveXml();
}
void SimpleIPPortSort::__SaveXml() {
__RemoveTimeoutXml();
recordsxml_.SaveFile((hostpath_ + IPPORT_RECORDS_FILENAME).c_str());
}
void SimpleIPPortSort::__LoadXml() {
tinyxml2::XMLError error = recordsxml_.LoadFile((hostpath_ + IPPORT_RECORDS_FILENAME).c_str());
if (tinyxml2::XML_SUCCESS != error) return;
__RemoveTimeoutXml();
}
void SimpleIPPortSort::__RemoveTimeoutXml() {
std::vector<tinyxml2::XMLElement*> remove_ele_ptr_list;
for (tinyxml2::XMLElement* record = recordsxml_.FirstChildElement(kRecord);
NULL != record; record = record->NextSiblingElement(kRecord)) {
const char* lasttime_chr = record->Attribute(kTime);
if (lasttime_chr) {
struct timeval now = {0};
gettimeofday(&now, NULL);
time_t lasttime = (time_t)strtoul(lasttime_chr, NULL, 10);
if (now.tv_sec < lasttime || now.tv_sec - lasttime >= kRecordTimeout) {
remove_ele_ptr_list.push_back(record);
}
} else {
remove_ele_ptr_list.push_back(record);
}
}
for (std::vector<tinyxml2::XMLElement*>::iterator iter = remove_ele_ptr_list.begin();
iter != remove_ele_ptr_list.end(); ++iter) {
recordsxml_.DeleteChild(*iter);
}
}
void SimpleIPPortSort::InitHistory2BannedList(bool _savexml) {
ScopedLock lock(mutex_);
if (_savexml) __SaveXml();
_ban_fail_list_.clear();
std::string curr_netinfo;
if (kNoNet == getCurrNetLabel(curr_netinfo)) return;
const tinyxml2::XMLElement* record = NULL;
for (record = recordsxml_.FirstChildElement(kRecord);
NULL != record; record = record->NextSiblingElement(kRecord)) {
const char* netinfoChr = record->Attribute(kNetInfo);
if (netinfoChr && (0 == strcmp(netinfoChr, curr_netinfo.c_str()))) {
xwarn2(TSF"netinfoChr:%_, curr_netinfo.c_str():%_", netinfoChr, curr_netinfo.c_str());
break;
}
}
if (NULL == record) { return; }
for (const tinyxml2::XMLElement* item = record->FirstChildElement(kItem); NULL != item; item = item->NextSiblingElement(kItem)) {
const char* ip = item->Attribute(kIP);
uint32_t port = item->UnsignedAttribute(kPort);
uint64_t historyresult = (uint64_t)item->Int64Attribute(kHistoryResult);
struct BanItem banitem;
banitem.ip = ip;
banitem.port = port;
banitem.records = 0;
//8 in 1
for (int i = 0; i < 8; ++i) {
SET_BIT(historyresult & 0xFF, banitem.records);
historyresult >>= 8;
}
_ban_fail_list_.push_back(banitem);
}
}
void SimpleIPPortSort::RemoveBannedList(const std::string& _ip) {
ScopedLock lock(mutex_);
for (std::vector<BanItem>::iterator iter = _ban_fail_list_.begin(); iter != _ban_fail_list_.end();) {
if (iter->ip == _ip)
iter = _ban_fail_list_.erase(iter);
else
++iter;
}
}
void SimpleIPPortSort::Update(const std::string& _ip, uint16_t _port, bool _is_success) {
std::string curr_net_info;
if (kNoNet == getCurrNetLabel(curr_net_info)) return;
ScopedLock lock(mutex_);
if (!__CanUpdate(_ip, _port, _is_success)) return;
__UpdateBanList(_is_success, _ip, _port);
tinyxml2::XMLElement* record = NULL;
for (record = recordsxml_.FirstChildElement(kRecord);
NULL != record; record = record->NextSiblingElement(kRecord)) {
const char* netinfo_chr = record->Attribute(kNetInfo);
if (netinfo_chr && (0 == strcmp(netinfo_chr, curr_net_info.c_str()))) break;
}
if (NULL == record) {
struct timeval timeval = {0};
gettimeofday(&timeval, NULL);
char timebuf[128] = {0};
snprintf(timebuf, sizeof(timebuf), "%ld", timeval.tv_sec);
record = recordsxml_.NewElement(kRecord);
record->SetAttribute(kNetInfo, curr_net_info.c_str());
record->SetAttribute(kTime, timebuf);
recordsxml_.InsertEndChild(record);
}
tinyxml2::XMLElement* item = NULL;
for (item = record->FirstChildElement(kItem);
NULL != item; item = item->NextSiblingElement(kItem)) {
const char* ip = item->Attribute(kIP);
uint32_t port = item->UnsignedAttribute(kPort);
if (ip && (0 == strcmp(ip, _ip.c_str())) && port == _port) break;
}
if (NULL == item) {
item = recordsxml_.NewElement(kItem);
item->SetAttribute(kIP, _ip.c_str());
item->SetAttribute(kPort, _port);
record->InsertEndChild(item);
}
uint64_t history_result = item->Int64Attribute(kHistoryResult);
SET_BIT(!_is_success, history_result);
item->SetAttribute(kHistoryResult, (int64_t)history_result);
}
std::vector<BanItem>::iterator SimpleIPPortSort::__FindBannedIter(const std::string& _ip, unsigned short _port) const {
std::vector<BanItem>::iterator iter;
for (iter = _ban_fail_list_.begin(); iter != _ban_fail_list_.end(); ++iter) {
if (iter->ip == _ip && iter->port == _port) {
return iter;
}
}
return iter;
}
bool SimpleIPPortSort::__IsBanned(const std::string& _ip, unsigned short _port) const {
return __IsBanned(__FindBannedIter(_ip, _port));
}
bool SimpleIPPortSort::__IsBanned(std::vector<BanItem>::iterator _iter) const {
if (_iter == _ban_fail_list_.end()) return false;
bool baned = CAL_BIT_COUNT(_iter->records) >= kBanFailCount;
if (!baned) return false;
if (_iter->last_fail_time.gettickspan() < kBanTime) {
return true;
}
return false;
}
void SimpleIPPortSort::__UpdateBanList(bool _is_success, const std::string& _ip, unsigned short _port) {
for (std::vector<BanItem>::iterator iter = _ban_fail_list_.begin(); iter != _ban_fail_list_.end(); ++iter) {
if (iter->ip == _ip && iter->port == _port) {
SET_BIT(!_is_success, iter->records);
if (_is_success)
iter->last_suc_time.gettickcount();
else
iter->last_fail_time.gettickcount();
return;
}
}
BanItem item;
item.ip = _ip;
item.port = _port;
SET_BIT(!_is_success, item.records);
if (_is_success)
item.last_suc_time.gettickcount();
else
item.last_fail_time.gettickcount();
_ban_fail_list_.push_back(item);
}
bool SimpleIPPortSort::__CanUpdate(const std::string& _ip, uint16_t _port, bool _is_success) const {
for (std::vector<BanItem>::iterator iter = _ban_fail_list_.begin(); iter != _ban_fail_list_.end(); ++iter) {
if (iter->ip == _ip && iter->port == _port) {
if (_is_success) {
return kSuccessUpdateInterval < iter->last_suc_time.gettickspan() ? true:false;
}
else {
return kFailUpdateInterval < iter->last_fail_time.gettickspan() ? true:false;
}
}
}
return true;
}
void SimpleIPPortSort::__FilterbyBanned(std::vector<IPPortItem>& _items) const {
for (std::vector<IPPortItem>::iterator it = _items.begin(); it != _items.end();) {
if (__IsBanned(it->str_ip, it->port) || __IsServerBan(it->str_ip)) {
xwarn2(TSF"ip:%0, port:%1, is ban!!", it->str_ip, it->port);
it = _items.erase(it);
} else {
++it;
}
}
}
bool SimpleIPPortSort::__IsServerBan(const std::string& _ip) const {
std::map<std::string, uint64_t>::iterator iter = _server_bans_.find(_ip);
if (iter == _server_bans_.end()) return false;
uint64_t now = ::gettickcount();
xassert2(now >= iter->second, TSF"%_:%_", now, iter->second);
if (now - iter->second < kBanTime) {
xwarn2(TSF"ip %0 is ban by server, haha!", _ip.c_str());
return true;
}
_server_bans_.erase(iter);
return false;
}
void SimpleIPPortSort::__SortbyBanned(std::vector<IPPortItem>& _items) const {
srand((unsigned int)gettickcount());
//random_shuffle new and history
std::random_shuffle(_items.begin(), _items.end());
//separate new and history
std::deque<IPPortItem> items_history(_items.size());
std::deque<IPPortItem> items_new(_items.size());
auto find_lambda = [&](const IPPortItem& _v) {
for (std::vector<BanItem>::const_iterator it_banned = _ban_fail_list_.begin(); it_banned != _ban_fail_list_.end(); ++it_banned) {
if (it_banned->ip == _v.str_ip && it_banned->port == _v.port) {
return true;
}
}
return false;
};
items_history.erase(std::remove_copy_if(_items.begin(), _items.end(), items_history.begin(), !boost::bind<bool>(find_lambda, _1)), items_history.end());
items_new.erase(std::remove_copy_if(_items.begin(), _items.end(), items_new.begin(), find_lambda), items_new.end());
xassert2(_items.size() == items_history.size()+items_new.size(), TSF"_item:%_, history:%_, new:%_", _items.size(), items_history.size(), items_new.size());
//sort history
std::sort(items_history.begin(), items_history.end(),
[&](const IPPortItem& _l, const IPPortItem& _r){
auto find_lr_lambda = [](const BanItem& _v, const IPPortItem& _find) {
return _v.ip == _find.str_ip && _v.port == _find.port;
};
std::vector<BanItem>::const_iterator l = std::find_if(_ban_fail_list_.begin(), _ban_fail_list_.end(), boost::bind<bool>(find_lr_lambda, _1, _l));
std::vector<BanItem>::const_iterator r = std::find_if(_ban_fail_list_.begin(), _ban_fail_list_.end(), boost::bind<bool>(find_lr_lambda, _1, _r));
xassert2(l != _ban_fail_list_.end());
xassert2(r != _ban_fail_list_.end());
if (CAL_BIT_COUNT(l->records) != CAL_BIT_COUNT(r->records))
return CAL_BIT_COUNT(l->records) < CAL_BIT_COUNT(r->records);
if(l->last_fail_time != r->last_fail_time)
return l->last_fail_time < r->last_fail_time;
if(l->last_suc_time != r->last_suc_time)
return l->last_suc_time > r->last_suc_time;
//random by std::random_shuffle(_items.begin(), _items.end());
return false;
});
//merge
_items.clear();
while ( !items_history.empty() || !items_new.empty()) {
int ran = rand()%(items_history.size()+items_new.size());
if (0 <= ran && ran < (int)items_history.size()) {
_items.push_back(items_history.front());
items_history.pop_front();
} else if ((int)items_history.size() <= ran && ran < (int)(items_history.size()+items_new.size())) {
_items.push_back(items_new.front());
items_new.pop_front();
} else {
xassert2(false, TSF"ran:%_, history:%_, new:%_", ran, items_history.size(), items_new.size());
}
}
}
void SimpleIPPortSort::SortandFilter(std::vector<IPPortItem>& _items, int _needcount) const {
ScopedLock lock(mutex_);
__FilterbyBanned(_items);
__SortbyBanned(_items);
if (_needcount < (int)_items.size()) _items.resize(_needcount);
}
void SimpleIPPortSort::AddServerBan(const std::string& _ip) {
if (_ip.empty()) return;
ScopedLock lock(mutex_);
_server_bans_[_ip] = ::gettickcount();
}
| [
"garryyan@tencent.com"
] | garryyan@tencent.com |
f687080747d7e5649be69e7478984e35b31a7ef9 | 5e58a55bc863322cc77167dcc84aef2d8205c441 | /imviewer/pixaccess.cpp | a365025e3c46db039289d03f648445ca1ede8096 | [] | no_license | jaredmales/VisAO | d79c50c76d9b9f801a38a3febaafc24c3438c708 | 9effbfcc2f7e1f743df346efd07fb6b7c82eedb2 | refs/heads/master | 2021-01-25T16:58:44.083880 | 2017-09-01T07:33:13 | 2017-09-01T07:33:13 | 102,152,273 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,567 | cpp | #include "pixaccess.h"
float (*getPixPointer(int imv_type))(void*, size_t)
{
switch(imv_type)
{
case IMV_CHAR:
return &getPix<char>;
case IMV_UCHAR:
return &getPix<unsigned char>;
case IMV_SHORT:
return &getPix<short>;
case IMV_USHORT:
return &getPix<unsigned short>;
case IMV_INT:
return &getPix<int>;
case IMV_UINT:
return &getPix<unsigned int>;
case IMV_LONG:
return &getPix<long>;
case IMV_ULONG:
return &getPix<unsigned long>;
case IMV_LONGLONG:
return &getPix<long long>;
case IMV_ULONGLONG:
return &getPix<unsigned long long>;
case IMV_FLOAT:
return &getPix<float>;
case IMV_DOUBLE:
return &getPix<double>;
case IMV_LONGDOUBLE:
return &getPix<long double>;
// case IMV_CMPLXFLOAT:
// return &getPix<std::complex<float> >;
// case IMV_CMPLXDOUBLE:
// return &getPix<std::complex<double> >;
// case IMV_CMPLXLONGDOUBLE:
// return &getPix<std::complex<long double> >;
default:
return 0;
}
return 0;
}
size_t sizeof_imv_type(int imv_type)
{
switch(imv_type)
{
case IMV_CHAR:
return sizeof(char);
case IMV_UCHAR:
return sizeof(unsigned char);
case IMV_SHORT:
return sizeof(short);
case IMV_USHORT:
return sizeof(unsigned short);
case IMV_INT:
return sizeof(int);
case IMV_UINT:
return sizeof(unsigned int);
case IMV_LONG:
return sizeof(long);
case IMV_ULONG:
return sizeof(unsigned long);
case IMV_LONGLONG:
return sizeof(long long);
case IMV_ULONGLONG:
return sizeof(unsigned long long);
case IMV_FLOAT:
return sizeof(float);
case IMV_DOUBLE:
return sizeof(double);
case IMV_LONGDOUBLE:
return sizeof(long double);
case IMV_CMPLXFLOAT:
return sizeof(std::complex<float> );
case IMV_CMPLXDOUBLE:
return sizeof(std::complex<double> );
case IMV_CMPLXLONGDOUBLE:
return sizeof(std::complex<long double> );
default:
return 0;
}
return 0;
}
| [
"jaredmales@gmail.com"
] | jaredmales@gmail.com |
89e162b36f49577f45fa395f053717f8ce10c99d | f4bc78d304fcebd766a7a7d161e6b72d61e10d9a | /test/data_requirements/stencil/stencil_1d/pyramid/pyramid.cpp | b8a133bb9f2203c8e4eae3c310bbbb03bc24d899 | [] | no_license | allscale/allscale_compiler | 6a02d655e1a101a9a6afa0c79df7e772fc8abcd6 | 12e5dada431e574b025c572ae5f8819047be12aa | refs/heads/master | 2021-01-12T06:53:34.553070 | 2019-03-19T12:43:15 | 2019-03-19T12:43:15 | 76,847,596 | 5 | 1 | null | 2017-12-01T11:39:58 | 2016-12-19T09:26:03 | C++ | UTF-8 | C++ | false | false | 129 | cpp | #include "../test.h"
int main() {
// just run the generic test
return run_test<implementation::parallel_recursive>();
}
| [
"herbert@dps.uibk.ac.at"
] | herbert@dps.uibk.ac.at |
d8dbdf729d909b2cf542b135c19bc852360e3eb7 | 76b823f0b4e0efc12075cf4802ffe0b2ca62fb2b | /aluno/solucoes/16_4.cpp | ea2c9a3ee69e6d62fe380003c12b1b32edcd23d0 | [] | no_license | jonasvm/piratas-futuro-rpg | e5c3c2c31bf6fa1b208fd00c09464db49b7192b2 | 770914f310c9fdce26e7a204883c7f7281771d8d | refs/heads/master | 2022-01-05T04:41:01.779284 | 2019-06-25T13:47:57 | 2019-06-25T13:47:57 | null | 0 | 0 | null | null | null | null | ISO-8859-1 | C++ | false | false | 782 | cpp | /*Em alto mar, você avista uma criatura gigante rara com tentáculos, mas devido a pouca visibilidade por causa da água, você
não consegue identificar se é um polvo ou uma lula. Para isso, você decide utilizar a câmera de raios-X do seu computador de
bordo para visualizar. Se a metade dos tentáculos for um número impar, será uma lula, caso contrário será um polvo. Tente
identificar, pois se você espalhar a notícia de que encontrou um animal raro desse, muitos caçadores poderão lhe recompensar
por tal informação.
10
lula*/
#include <iostream>
#include <cstdlib>
using namespace std;
int main() {
int tentaculos = 10;
if((tentaculos/2)%2 == 0)
cout << "polvo";
else
cout << "lula";
return 1;
}
| [
"jonas.vbm@gmail.com"
] | jonas.vbm@gmail.com |
5558924d44988e3b18c736c724124666ac67632f | c2c6d5279358779026282efb1ce750ef839ac8db | /NetCmd/ServoDriverComDll/NetCom/src/Packet.cpp | 4cc25e32422ab96b4b8d2c553706f3688cdfcf0c | [] | no_license | tiangaomingjing/MyServo | 0f4f374028bff1772c34c316a2466ed46bd3db01 | 0aee56bebeaa8213de31443c8c38fb99e2e156db | refs/heads/master | 2021-01-01T15:49:41.291053 | 2017-07-19T11:56:57 | 2017-07-19T11:56:57 | 97,711,825 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 6,914 | cpp | //////////////////////////////////////////////////////////////////////////////////////////
// summary : Communicaiton Packet Define //
// file : Packet.cpp //
// Description : use for pc and fpga communicaiton //
// lib : none //
// //
//======================================================================================//
// programmer: | date: | Corporation: | copyright(C): //
//--------------------------------------------------------------------------------------//
// wang.bin(1420) | 2016/1/20 | googoltech | 2016 - 2019 //
//--------------------------------------------------------------------------------------//
//////////////////////////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "Packet.h"
#include "BaseReturn_def.h"
CPacket::CPacket(void)
{
pTx = new PACKET_FORMAT;
pRx = new PACKET_FORMAT;
bHaveMac = false;
init_pack();
}
CPacket::~CPacket(void)
{
if (NULL != pTx)
delete pTx;
if (NULL != pRx)
delete pRx;
}
void CPacket::init_pack()
{
//0xff,0xff,0xff,0xff,0xff,0xff,//dmac 6
for (int i = 0; i < MAC_ADDR_BYTE_LENTH;i++)
{
pTx->dmac[i] = 0xff;
}
// 0x3c,0x97,0x0e,0x30,0xe6,0x1e,//smac 6 12
pTx->smac[0] = 0x28;
pTx->smac[1] = 0xd2;
pTx->smac[2] = 0x44;
pTx->smac[3] = 0xdc;
pTx->smac[4] = 0x2a;
pTx->smac[5] = 0xf6;
pTx->type0 = 0x88;
pTx->type1 = 0xa4;
pTx->lengthbit7_0 = 0x12;
pTx->lengthbit9_8 = 0x10;
m_tx_index = 0xff;
m_rx_index = m_tx_index;
tx_length = PACKET_HEADER_LENTH;
rx_length = 0;
}
Uint8 CPacket::get_tx_index()
{
return m_tx_index;
}
bool CPacket::decoder_return_flag(int16 mode)
{
if (rx_length < MIN_PACKET_LEN)
return false;
if ((pRx->type0 != pTx->type0) || (pRx->type1 != pTx->type1))
return false;
if (mode == PACKET_MODE_READ_FPGA) //FPGA读模式
{
int16 data = 0;
memcpy_s(&data, sizeof(int16), &(pRx->dataSection[0]), sizeof(int16));
return (((data & RETURN_REQUEST_MASK) != 0) ? true : false);//判断bit1位是否为1,如果为1,那么说明指令已经返回,可以读取返回值,如果为0,那么说明指令没有返回。
}
else
{
return true;
}
}
int16 CPacket::decoder_dsp_packet(Uint8 index, int16* pData, int16 &dma_num)
{
if (rx_length < MIN_PACKET_LEN)
return Net_Rt_Receive_DLenth_short;
if ((pRx->type0 != pTx->type0) || (pRx->type1 != pTx->type1))
return Net_Rt_Receive_Unknow_Data;
if (pRx->index != index)
return Net_Rt_Index_Unmatch;
//读取包长度
int16 data = 0;
memcpy_s(&data, sizeof(int16), &(pRx->lengthbit7_0), sizeof(int16));
int16 lenth = (LENTH_MASK & data);
//读取数据长度
memcpy_s(&data, sizeof(int16), &pRx->dma_numbit7_0, sizeof(int16));
dma_num = (DMA_NUMBER_MASK & data);
//查询返回信息是否正确
switch (pRx->dataSection[4])
{
case NET_COM_EXECUTE_FAIL:
return Net_Rt_Execute_Fail;
case NET_COM_EXECUTE_SUCCESS:
break;
case NET_COM_PARAMETER_INVALID:
return Net_Rt_Parameter_invalid;
case NET_COM_INSTRUCTION_INVALID:
return Net_Rt_Instruction_invalid;
default:
return Net_Rt_Other_Error;
}
memcpy_s(pData, dma_num * sizeof(int16), &(pRx->dataSection[6]), dma_num * sizeof(int16));
return Rt_Success;
}
int16 CPacket::decoder_fpga_packet(Uint8 index, int16* pData, int16 &dma_num)
{
if (rx_length < MIN_PACKET_LEN)
return Net_Rt_Receive_DLenth_short;
if (pRx->type0 != pTx->type0 || pRx->type1 != pTx->type1)
return Net_Rt_Receive_Unknow_Data;
if (pRx->index != index)
return Net_Rt_Index_Unmatch;
//读取包长度
int16 data = 0;
memcpy_s(&data, sizeof(int16), &(pRx->lengthbit7_0), sizeof(int16));
int16 lenth = (LENTH_MASK & data);
//读取数据长度
memcpy_s(&data, sizeof(int16), &pRx->dma_numbit7_0, sizeof(int16));
dma_num = (DMA_NUMBER_MASK & data);
memcpy_s(pData, dma_num * sizeof(short), &(pRx->dataSection[0]), dma_num * sizeof(short));
return Rt_Success;
}
static int32 getLocalMac(Uint8 *mac, const int8* adapterName) //获取本机MAC址
{
//PIP_ADAPTER_INFO结构体指针存储本机网卡信息
PIP_ADAPTER_INFO pIpAdapterInfo = new IP_ADAPTER_INFO();
//得到结构体大小,用于GetAdaptersInfo参数
Uint32 stSize = sizeof(IP_ADAPTER_INFO);
//调用GetAdaptersInfo函数,填充pIpAdapterInfo指针变量;其中stSize参数既是一个输入量也是一个输出量
int32 nRel = GetAdaptersInfo(pIpAdapterInfo, &stSize);
//记录网卡数量
int32 netCardNum = 0;
//记录每张网卡上的IP地址数量
int32 IPnumPerNetCard = 0;
if (ERROR_BUFFER_OVERFLOW == nRel)
{
//如果函数返回的是ERROR_BUFFER_OVERFLOW
//则说明GetAdaptersInfo参数传递的内存空间不够,同时其传出stSize,表示需要的空间大小
//这也是说明为什么stSize既是一个输入量也是一个输出量
//释放原来的内存空间
delete pIpAdapterInfo;
//重新申请内存空间用来存储所有网卡信息
pIpAdapterInfo = (PIP_ADAPTER_INFO)new BYTE[stSize];
//再次调用GetAdaptersInfo函数,填充pIpAdapterInfo指针变量
nRel = GetAdaptersInfo(pIpAdapterInfo, &stSize);
}
int32 iCount = 0;
while (pIpAdapterInfo)//遍历每一张网卡
{
// pIpAdapterInfo->Address MAC址
if (strstr(adapterName, pIpAdapterInfo->AdapterName) != NULL)
{
for (int32 i = 0; i < (int32)pIpAdapterInfo->AddressLength; i++)
{
mac[iCount++] = pIpAdapterInfo->Address[i];
}
}
pIpAdapterInfo = pIpAdapterInfo->Next;
}
return iCount;
}
void CPacket::get_local_mac(const int8* adapterName)
{
if (!bHaveMac)
{
if (getLocalMac(mac, adapterName) > 0)
{
int32 i;
for (i = 0; i < MAC_ADDR_BYTE_LENTH; ++i) //Source mac
{
pTx->smac[i] = (mac[i]);
}
bHaveMac = true;
}
}
}
void CPacket::fillPacket(int16 dma_addr, int16* pData, int16 dma_num, int16 FPGAmode)
{
int32 i,j;
tx_length = PACKET_HEADER_LENTH;
int16 length = dma_num * 2 + LENTH_INCLUDE;
int16 iAddZero = MIN_SEND_PKT_LEN - LENTH_BEFORE - length;
if (iAddZero > 0)
length = MIN_SEND_PKT_LEN - LENTH_BEFORE;
length |= LENTH_MASK_ZERO;
length &= LENTH_MASK_ONE;
pTx->lengthbit7_0 = (length & 0xff);
pTx->lengthbit9_8 = ((length>>8) & 0xff);
m_tx_index++;
pTx->index = m_tx_index;
int16 dmanum = dma_num;
if (FPGAmode == PACKET_MODE_READ_FPGA)//读模式
dmanum &= DMA_NUMBER_MASK;
else
dmanum |= DMA_NUMBER_MASK_WRITE;
pTx->dma_numbit7_0 = (dmanum & 0xff);
pTx->dma_numbit8 = ((dmanum >> 8) & 0xff);
pTx->dmaAddrbit7_0 = (dma_addr & 0xff);
pTx->dmaAddrbit15_8 = ((dma_addr >> 8) & 0xff);
for (i = 0,j=0; i < dma_num;i++)
{
pTx->dataSection[j] = ((*(pData + i)) & 0xff);
pTx->dataSection[j + 1] = (((*(pData + i)) >> 8) & 0xff);
j = j + 2;
tx_length += 2;
}
for (i = 0; i < iAddZero; ++i)
{
pTx->dataSection[i+j] = 0x0;
tx_length++;
}
}
| [
"chenchao_szu@163.com"
] | chenchao_szu@163.com |
89ce42864090c6f24a36ea92765947d3f51679a3 | 35bd87c9c6cacda05252f93b4e30400aa59a0e2f | /export/release/windows/obj/src/flixel/text/FlxTextFormat.cpp | 051b5baa5fe70b457ad883cd89c8a5425988c33f | [
"Apache-2.0"
] | permissive | RE4L-CODE/vsZero-KE | 53599f2099a17a9553adb25a7c8771db0a6bc6d4 | 44c126687ecd3caf7cc3af892164be8d520ae97a | refs/heads/main | 2023-09-01T09:58:39.012592 | 2021-11-18T10:24:21 | 2021-11-18T10:24:21 | 429,388,364 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | true | 5,241 | cpp | // Generated by Haxe 4.1.5
#include <hxcpp.h>
#ifndef INCLUDED_flixel_text_FlxTextFormat
#include <flixel/text/FlxTextFormat.h>
#endif
#ifndef INCLUDED_openfl_text_TextFormat
#include <openfl/text/TextFormat.h>
#endif
HX_DEFINE_STACK_FRAME(_hx_pos_a69907c6a733237a_1097_new,"flixel.text.FlxTextFormat","new",0x67be2279,"flixel.text.FlxTextFormat.new","flixel/text/FlxText.hx",1097,0xdf165a6e)
namespace flixel{
namespace text{
void FlxTextFormat_obj::__construct( ::Dynamic FontColor, ::Dynamic Bold, ::Dynamic Italic, ::Dynamic BorderColor){
HX_GC_STACKFRAME(&_hx_pos_a69907c6a733237a_1097_new)
HXLINE(1098) this->format = ::openfl::text::TextFormat_obj::__alloc( HX_CTX ,null(),null(),FontColor,Bold,Italic,null(),null(),null(),null(),null(),null(),null(),null());
HXLINE(1099) int _hx_tmp;
HXDLIN(1099) if (::hx::IsNull( BorderColor )) {
HXLINE(1099) _hx_tmp = 0;
}
else {
HXLINE(1099) _hx_tmp = ( (int)(BorderColor) );
}
HXDLIN(1099) this->borderColor = _hx_tmp;
}
Dynamic FlxTextFormat_obj::__CreateEmpty() { return new FlxTextFormat_obj; }
void *FlxTextFormat_obj::_hx_vtable = 0;
Dynamic FlxTextFormat_obj::__Create(::hx::DynamicArray inArgs)
{
::hx::ObjectPtr< FlxTextFormat_obj > _hx_result = new FlxTextFormat_obj();
_hx_result->__construct(inArgs[0],inArgs[1],inArgs[2],inArgs[3]);
return _hx_result;
}
bool FlxTextFormat_obj::_hx_isInstanceOf(int inClassId) {
return inClassId==(int)0x00000001 || inClassId==(int)0x184412c5;
}
::hx::ObjectPtr< FlxTextFormat_obj > FlxTextFormat_obj::__new( ::Dynamic FontColor, ::Dynamic Bold, ::Dynamic Italic, ::Dynamic BorderColor) {
::hx::ObjectPtr< FlxTextFormat_obj > __this = new FlxTextFormat_obj();
__this->__construct(FontColor,Bold,Italic,BorderColor);
return __this;
}
::hx::ObjectPtr< FlxTextFormat_obj > FlxTextFormat_obj::__alloc(::hx::Ctx *_hx_ctx, ::Dynamic FontColor, ::Dynamic Bold, ::Dynamic Italic, ::Dynamic BorderColor) {
FlxTextFormat_obj *__this = (FlxTextFormat_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(FlxTextFormat_obj), true, "flixel.text.FlxTextFormat"));
*(void **)__this = FlxTextFormat_obj::_hx_vtable;
__this->__construct(FontColor,Bold,Italic,BorderColor);
return __this;
}
FlxTextFormat_obj::FlxTextFormat_obj()
{
}
void FlxTextFormat_obj::__Mark(HX_MARK_PARAMS)
{
HX_MARK_BEGIN_CLASS(FlxTextFormat);
HX_MARK_MEMBER_NAME(borderColor,"borderColor");
HX_MARK_MEMBER_NAME(format,"format");
HX_MARK_END_CLASS();
}
void FlxTextFormat_obj::__Visit(HX_VISIT_PARAMS)
{
HX_VISIT_MEMBER_NAME(borderColor,"borderColor");
HX_VISIT_MEMBER_NAME(format,"format");
}
::hx::Val FlxTextFormat_obj::__Field(const ::String &inName,::hx::PropertyAccess inCallProp)
{
switch(inName.length) {
case 6:
if (HX_FIELD_EQ(inName,"format") ) { return ::hx::Val( format ); }
break;
case 11:
if (HX_FIELD_EQ(inName,"borderColor") ) { return ::hx::Val( borderColor ); }
}
return super::__Field(inName,inCallProp);
}
::hx::Val FlxTextFormat_obj::__SetField(const ::String &inName,const ::hx::Val &inValue,::hx::PropertyAccess inCallProp)
{
switch(inName.length) {
case 6:
if (HX_FIELD_EQ(inName,"format") ) { format=inValue.Cast< ::openfl::text::TextFormat >(); return inValue; }
break;
case 11:
if (HX_FIELD_EQ(inName,"borderColor") ) { borderColor=inValue.Cast< int >(); return inValue; }
}
return super::__SetField(inName,inValue,inCallProp);
}
void FlxTextFormat_obj::__GetFields(Array< ::String> &outFields)
{
outFields->push(HX_("borderColor",d7,3c,d5,d6));
outFields->push(HX_("format",37,8f,8e,fd));
super::__GetFields(outFields);
};
#ifdef HXCPP_SCRIPTABLE
static ::hx::StorageInfo FlxTextFormat_obj_sMemberStorageInfo[] = {
{::hx::fsInt,(int)offsetof(FlxTextFormat_obj,borderColor),HX_("borderColor",d7,3c,d5,d6)},
{::hx::fsObject /* ::openfl::text::TextFormat */ ,(int)offsetof(FlxTextFormat_obj,format),HX_("format",37,8f,8e,fd)},
{ ::hx::fsUnknown, 0, null()}
};
static ::hx::StaticInfo *FlxTextFormat_obj_sStaticStorageInfo = 0;
#endif
static ::String FlxTextFormat_obj_sMemberFields[] = {
HX_("borderColor",d7,3c,d5,d6),
HX_("format",37,8f,8e,fd),
::String(null()) };
::hx::Class FlxTextFormat_obj::__mClass;
void FlxTextFormat_obj::__register()
{
FlxTextFormat_obj _hx_dummy;
FlxTextFormat_obj::_hx_vtable = *(void **)&_hx_dummy;
::hx::Static(__mClass) = new ::hx::Class_obj();
__mClass->mName = HX_("flixel.text.FlxTextFormat",07,72,93,cd);
__mClass->mSuper = &super::__SGetClass();
__mClass->mConstructEmpty = &__CreateEmpty;
__mClass->mConstructArgs = &__Create;
__mClass->mGetStaticField = &::hx::Class_obj::GetNoStaticField;
__mClass->mSetStaticField = &::hx::Class_obj::SetNoStaticField;
__mClass->mStatics = ::hx::Class_obj::dupFunctions(0 /* sStaticFields */);
__mClass->mMembers = ::hx::Class_obj::dupFunctions(FlxTextFormat_obj_sMemberFields);
__mClass->mCanCast = ::hx::TCanCast< FlxTextFormat_obj >;
#ifdef HXCPP_SCRIPTABLE
__mClass->mMemberStorageInfo = FlxTextFormat_obj_sMemberStorageInfo;
#endif
#ifdef HXCPP_SCRIPTABLE
__mClass->mStaticStorageInfo = FlxTextFormat_obj_sStaticStorageInfo;
#endif
::hx::_hx_RegisterClass(__mClass->mName, __mClass);
}
} // end namespace flixel
} // end namespace text
| [
"61307317+RE4L-CODE@users.noreply.github.com"
] | 61307317+RE4L-CODE@users.noreply.github.com |
9ba481d8ae97d7a1e7bc2c02cffbb72b944f7130 | 483e8c3fd98536fa17f9a0a41923f60e2a79d55a | /sources/src/util/IpUtils.cpp | 3c8e8959647f455ff5dd1272bbf8312dfced1d54 | [] | no_license | Shailla/jeukitue.moteur | b9ff6f13188fb59d6b8d2ea8cde35fc7d95dd3dd | acc996f240699b5ec9c6162e56c5739f86a335a5 | refs/heads/master | 2020-05-22T04:20:33.298261 | 2014-11-20T22:20:43 | 2014-11-20T22:40:11 | 34,282,766 | 0 | 0 | null | null | null | null | ISO-8859-1 | C++ | false | false | 712 | cpp | /*
* IpUtils.cpp
*
* Created on: 16 août 2013
* Author: Erwin
*/
#include <sstream>
using namespace std;
#include "util/IpUtils.h"
namespace JktUtils {
IpUtils::IpUtils() {
}
IpUtils::~IpUtils() {
}
string IpUtils::translateIp(IPaddress address) {
stringstream str;
Uint8* add = (Uint8*)&address.host;
str << (int)(Uint8)(*(add+0)) << "." << (int)(Uint8)(*(add+1)) << "." << (int)(Uint8)(*(add+2)) << "." << (int)(Uint8)(*(add+3));
return str.str();
}
string IpUtils::translateAddress(IPaddress address) {
stringstream str;
str << translateIp(address) << ":" << SDLNet_Read16(&address.port);
return str.str();
}
} /* namespace JktUtils */
| [
"vogel.jeanclaude@gmail.com@cd6d7e76-efff-11de-b599-4d5b25800cad"
] | vogel.jeanclaude@gmail.com@cd6d7e76-efff-11de-b599-4d5b25800cad |
1a82f39c369fe445c99531e4cb451a1a2e029845 | b0dd7779c225971e71ae12c1093dc75ed9889921 | /boost/fusion/view/single_view/detail/at_impl.hpp | bf955274bc9f63854b88d5893b8f9c3dcaf03703 | [
"LicenseRef-scancode-warranty-disclaimer",
"BSL-1.0"
] | permissive | blackberry/Boost | 6e653cd91a7806855a162347a5aeebd2a8c055a2 | fc90c3fde129c62565c023f091eddc4a7ed9902b | refs/heads/1_48_0-gnu | 2021-01-15T14:31:33.706351 | 2013-06-25T16:02:41 | 2013-06-25T16:02:41 | 2,599,411 | 244 | 154 | BSL-1.0 | 2018-10-13T18:35:09 | 2011-10-18T14:25:18 | C++ | UTF-8 | C++ | false | false | 1,246 | hpp | /*=============================================================================
Copyright (c) 2011 Eric Niebler
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)
==============================================================================*/
#if !defined(BOOST_FUSION_SINGLE_VIEW_AT_IMPL_JUL_07_2011_1348PM)
#define BOOST_FUSION_SINGLE_VIEW_AT_IMPL_JUL_07_2011_1348PM
#include <boost/mpl/int.hpp>
#include <boost/mpl/assert.hpp>
#include <boost/mpl/equal_to.hpp>
namespace boost { namespace fusion
{
struct single_view_tag;
namespace extension
{
template<typename Tag>
struct at_impl;
template<>
struct at_impl<single_view_tag>
{
template<typename Sequence, typename N>
struct apply
{
BOOST_MPL_ASSERT((mpl::equal_to<N, mpl::int_<0> >));
typedef typename Sequence::value_type type;
static type
call(Sequence& seq)
{
return seq.val;
}
};
};
}
}}
#endif
| [
"tvaneerd@rim.com"
] | tvaneerd@rim.com |
50829c60f2690823848f5f12e19f9dfe3fadbb3d | d33a2c7503955d0981f903e44f9d75be4fd5b264 | /code/src/loop.cpp | f73cbb6309483e6efe15dff44defd770d9032267 | [] | no_license | mldelibero/roboCooler | c3a1906fdad82d96313fecc85a64ffca641cd1c5 | d2c06277c640983b6a970655a65ef768c77072d4 | refs/heads/master | 2020-04-03T20:13:15.764843 | 2017-06-04T20:50:22 | 2017-06-04T20:50:22 | 42,898,242 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,590 | cpp | #include "capTouch.h"
#include "ledDriver.h"
#include "halDriver.h"
//#include "limitSwitch.h"
#include "lidMotor.h"
//#include "utils.h"
#include "ledStrip.h"
#include "ledStripDriver.h"
#include "timer.h"
extern "C" {
#include "Board_LED.h" // ::Board Support:LED
}
//extern CLimSwComp Opened_Limit;
//extern CLimSwComp Closed_Limit;
extern CCapTouchComp CapTouch;
extern CLidMotorComp LidMotor;
extern CLedStripDriver LedStripDriver;
extern CLedStripComp LedStrip;
extern CHalDriver Hal1_Driver;
extern CHalDriver Hal2_Driver;
void loop(void)
{
uint32_t led_cnt = LED_GetCount();
uint32_t led_num = 0;
int32_t timer = AllocateTimer();
bool on = false;
// WHILE(1)
while(1)
{
HAL_GPIO_TogglePin(LOOP_INT_GPIOx, LOOP_GPIO_PIN_X);
if (Hal1_Driver.Is_Triggered()) SetLeds(1);
else SetLeds(0);
// Opened_Limit.Run();
// Closed_Limit.Run();
CapTouch.Run();
LidMotor.Run();
LedStrip.Run();
LedStripDriver.Run();
if (IsTimerExpired(timer) == true)
{
Set_TimerValue(timer, 500);
if (on == true)
{
LED_Off(led_num); // Turn specified LED off
led_num = ++led_num % led_cnt; // Change LED number
on = false;
}
else
{
LED_On(led_num); // Turn specified LED on
on = true;
}
}
} // end - WHILE(1)
}
| [
"delibero.michael@ensco.com"
] | delibero.michael@ensco.com |
9b7c4c4784e14a0eaf757406791ba83755d90575 | e25ab831bfea98c625eea900264fc7ace4e0fe1c | /Exercise 2.cpp | b256b3fb9998ddd438e9e5a80fe4d522f2774da6 | [] | no_license | Dhik/StrukDat--02 | 6566e6426adb48b77232ae84018ab4b5e51aebb8 | 667128781668264a7c0d4ef59aaf2d476f276d91 | refs/heads/master | 2020-04-26T22:06:15.546851 | 2019-03-05T02:58:33 | 2019-03-05T02:58:33 | 173,861,724 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 478 | cpp | /*
Nama: Mohammad Dhikri
npm: 140810180075
tanggal pembuatan: 26 Februari 2019
Deskripsi: Convert celcius to fahrenheit
Kelas: A
*/
#include <iostream>
#include <string.h>
using namespace std;
struct Theater{
int room;
char seat[3];
char movieTitle[30];
};
main(){
Theater thr;
thr.room=7;
strcpy(thr.seat,"J9");
strcpy(thr.movieTitle,"Adit & Jarwo");
cout<<"Room : "<<thr.room<<endl;
cout<<"Seat : "<<thr.seat<<endl;
cout<<"Movie Title : "<<thr.movieTitle<<endl;
}
| [
"mohammaddhikri@gmail.com"
] | mohammaddhikri@gmail.com |
fe7c8495eabe7f7cb855f68a653e988b349dc4e5 | 76c95168b5004a8b6519143f1215b3509491d9a8 | /InfernalEditor/GeneratedFiles/ui_InfernalEditor.h | 4ca3cc2aeac5c7d79d69cb7fc8bcec78fbd1fda7 | [] | no_license | mi7flat5/Infernal_Engine | 8e3a08d558813a4e191b4d3ab4bd2f426d479157 | 321b628ba3f302b2d1c14a5ab64a04da0dec0b86 | refs/heads/master | 2020-04-17T08:01:24.118810 | 2017-03-20T09:17:01 | 2017-03-20T09:17:01 | 67,696,032 | 1 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 14,739 | h | /********************************************************************************
** Form generated from reading UI file 'InfernalEditor.ui'
**
** Created by: Qt User Interface Compiler version 5.7.1
**
** WARNING! All changes made in this file will be lost when recompiling UI file!
********************************************************************************/
#ifndef UI_INFERNALEDITOR_H
#define UI_INFERNALEDITOR_H
#include <QtCore/QVariant>
#include <QtWidgets/QAction>
#include <QtWidgets/QApplication>
#include <QtWidgets/QButtonGroup>
#include <QtWidgets/QDoubleSpinBox>
#include <QtWidgets/QGridLayout>
#include <QtWidgets/QHeaderView>
#include <QtWidgets/QLabel>
#include <QtWidgets/QMainWindow>
#include <QtWidgets/QMenuBar>
#include <QtWidgets/QSpacerItem>
#include <QtWidgets/QStatusBar>
#include <QtWidgets/QTabWidget>
#include <QtWidgets/QTextBrowser>
#include <QtWidgets/QToolBar>
#include <QtWidgets/QToolBox>
#include <QtWidgets/QTreeView>
#include <QtWidgets/QWidget>
#include "EditWindow.h"
QT_BEGIN_NAMESPACE
class Ui_InfernalEditorClass
{
public:
QAction *action_Open;
QAction *actionOpen;
QAction *action_Open_2;
QWidget *centralWidget;
QGridLayout *gridLayout_6;
QGridLayout *gridLayout;
EditWindow *openGLWidget;
QTabWidget *tabWidget;
QWidget *tab;
QGridLayout *gridLayout_2;
QTreeView *treeView;
QWidget *tab_2;
QGridLayout *gridLayout_4;
QTextBrowser *textBrowser;
QWidget *tab_3;
QGridLayout *gridLayout_7;
QToolBox *toolBox;
QWidget *page;
QGridLayout *gridLayout_8;
QGridLayout *gridLayout_5;
QLabel *label_4;
QLabel *label_5;
QLabel *label_6;
QLabel *label;
QDoubleSpinBox *pX;
QDoubleSpinBox *pY;
QDoubleSpinBox *pZ;
QLabel *label_2;
QDoubleSpinBox *rX;
QDoubleSpinBox *rY;
QDoubleSpinBox *rZ;
QLabel *label_3;
QDoubleSpinBox *sX;
QDoubleSpinBox *sY;
QDoubleSpinBox *sZ;
QSpacerItem *verticalSpacer;
QSpacerItem *horizontalSpacer;
QWidget *page_2;
QMenuBar *menuBar;
QToolBar *mainToolBar;
QStatusBar *statusBar;
void setupUi(QMainWindow *InfernalEditorClass)
{
if (InfernalEditorClass->objectName().isEmpty())
InfernalEditorClass->setObjectName(QStringLiteral("InfernalEditorClass"));
InfernalEditorClass->resize(819, 711);
QSizePolicy sizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
sizePolicy.setHorizontalStretch(0);
sizePolicy.setVerticalStretch(0);
sizePolicy.setHeightForWidth(InfernalEditorClass->sizePolicy().hasHeightForWidth());
InfernalEditorClass->setSizePolicy(sizePolicy);
InfernalEditorClass->setMouseTracking(true);
InfernalEditorClass->setFocusPolicy(Qt::StrongFocus);
InfernalEditorClass->setAutoFillBackground(true);
action_Open = new QAction(InfernalEditorClass);
action_Open->setObjectName(QStringLiteral("action_Open"));
actionOpen = new QAction(InfernalEditorClass);
actionOpen->setObjectName(QStringLiteral("actionOpen"));
action_Open_2 = new QAction(InfernalEditorClass);
action_Open_2->setObjectName(QStringLiteral("action_Open_2"));
centralWidget = new QWidget(InfernalEditorClass);
centralWidget->setObjectName(QStringLiteral("centralWidget"));
sizePolicy.setHeightForWidth(centralWidget->sizePolicy().hasHeightForWidth());
centralWidget->setSizePolicy(sizePolicy);
gridLayout_6 = new QGridLayout(centralWidget);
gridLayout_6->setSpacing(6);
gridLayout_6->setContentsMargins(11, 11, 11, 11);
gridLayout_6->setObjectName(QStringLiteral("gridLayout_6"));
gridLayout = new QGridLayout();
gridLayout->setSpacing(6);
gridLayout->setObjectName(QStringLiteral("gridLayout"));
openGLWidget = new EditWindow(centralWidget);
openGLWidget->setObjectName(QStringLiteral("openGLWidget"));
sizePolicy.setHeightForWidth(openGLWidget->sizePolicy().hasHeightForWidth());
openGLWidget->setSizePolicy(sizePolicy);
openGLWidget->setMinimumSize(QSize(16, 9));
openGLWidget->setSizeIncrement(QSize(16, 10));
openGLWidget->setBaseSize(QSize(16, 10));
openGLWidget->setCursor(QCursor(Qt::CrossCursor));
openGLWidget->setMouseTracking(true);
openGLWidget->setFocusPolicy(Qt::StrongFocus);
openGLWidget->setContextMenuPolicy(Qt::PreventContextMenu);
openGLWidget->setAcceptDrops(true);
openGLWidget->setAutoFillBackground(true);
openGLWidget->setInputMethodHints(Qt::ImhHiddenText);
gridLayout->addWidget(openGLWidget, 0, 0, 1, 1);
tabWidget = new QTabWidget(centralWidget);
tabWidget->setObjectName(QStringLiteral("tabWidget"));
tabWidget->setContextMenuPolicy(Qt::NoContextMenu);
tabWidget->setTabShape(QTabWidget::Triangular);
tab = new QWidget();
tab->setObjectName(QStringLiteral("tab"));
gridLayout_2 = new QGridLayout(tab);
gridLayout_2->setSpacing(6);
gridLayout_2->setContentsMargins(11, 11, 11, 11);
gridLayout_2->setObjectName(QStringLiteral("gridLayout_2"));
treeView = new QTreeView(tab);
treeView->setObjectName(QStringLiteral("treeView"));
sizePolicy.setHeightForWidth(treeView->sizePolicy().hasHeightForWidth());
treeView->setSizePolicy(sizePolicy);
gridLayout_2->addWidget(treeView, 0, 0, 1, 1);
tabWidget->addTab(tab, QString());
tab_2 = new QWidget();
tab_2->setObjectName(QStringLiteral("tab_2"));
gridLayout_4 = new QGridLayout(tab_2);
gridLayout_4->setSpacing(6);
gridLayout_4->setContentsMargins(11, 11, 11, 11);
gridLayout_4->setObjectName(QStringLiteral("gridLayout_4"));
textBrowser = new QTextBrowser(tab_2);
textBrowser->setObjectName(QStringLiteral("textBrowser"));
sizePolicy.setHeightForWidth(textBrowser->sizePolicy().hasHeightForWidth());
textBrowser->setSizePolicy(sizePolicy);
textBrowser->setMinimumSize(QSize(0, 10));
textBrowser->setMaximumSize(QSize(16777215, 1677215));
textBrowser->setReadOnly(false);
gridLayout_4->addWidget(textBrowser, 0, 0, 1, 1);
tabWidget->addTab(tab_2, QString());
tab_3 = new QWidget();
tab_3->setObjectName(QStringLiteral("tab_3"));
gridLayout_7 = new QGridLayout(tab_3);
gridLayout_7->setSpacing(6);
gridLayout_7->setContentsMargins(11, 11, 11, 11);
gridLayout_7->setObjectName(QStringLiteral("gridLayout_7"));
toolBox = new QToolBox(tab_3);
toolBox->setObjectName(QStringLiteral("toolBox"));
toolBox->setContextMenuPolicy(Qt::NoContextMenu);
page = new QWidget();
page->setObjectName(QStringLiteral("page"));
page->setGeometry(QRect(0, 0, 286, 117));
gridLayout_8 = new QGridLayout(page);
gridLayout_8->setSpacing(6);
gridLayout_8->setContentsMargins(11, 11, 11, 11);
gridLayout_8->setObjectName(QStringLiteral("gridLayout_8"));
gridLayout_5 = new QGridLayout();
gridLayout_5->setSpacing(6);
gridLayout_5->setObjectName(QStringLiteral("gridLayout_5"));
label_4 = new QLabel(page);
label_4->setObjectName(QStringLiteral("label_4"));
QSizePolicy sizePolicy1(QSizePolicy::Minimum, QSizePolicy::Minimum);
sizePolicy1.setHorizontalStretch(0);
sizePolicy1.setVerticalStretch(0);
sizePolicy1.setHeightForWidth(label_4->sizePolicy().hasHeightForWidth());
label_4->setSizePolicy(sizePolicy1);
gridLayout_5->addWidget(label_4, 0, 1, 1, 1);
label_5 = new QLabel(page);
label_5->setObjectName(QStringLiteral("label_5"));
sizePolicy1.setHeightForWidth(label_5->sizePolicy().hasHeightForWidth());
label_5->setSizePolicy(sizePolicy1);
gridLayout_5->addWidget(label_5, 0, 2, 1, 1);
label_6 = new QLabel(page);
label_6->setObjectName(QStringLiteral("label_6"));
sizePolicy1.setHeightForWidth(label_6->sizePolicy().hasHeightForWidth());
label_6->setSizePolicy(sizePolicy1);
gridLayout_5->addWidget(label_6, 0, 3, 1, 1);
label = new QLabel(page);
label->setObjectName(QStringLiteral("label"));
label->setMaximumSize(QSize(50, 16777215));
gridLayout_5->addWidget(label, 1, 0, 1, 1);
pX = new QDoubleSpinBox(page);
pX->setObjectName(QStringLiteral("pX"));
QSizePolicy sizePolicy2(QSizePolicy::Minimum, QSizePolicy::Fixed);
sizePolicy2.setHorizontalStretch(0);
sizePolicy2.setVerticalStretch(0);
sizePolicy2.setHeightForWidth(pX->sizePolicy().hasHeightForWidth());
pX->setSizePolicy(sizePolicy2);
pX->setMinimumSize(QSize(20, 0));
pX->setMinimum(-2048);
pX->setMaximum(2048);
gridLayout_5->addWidget(pX, 1, 1, 1, 1);
pY = new QDoubleSpinBox(page);
pY->setObjectName(QStringLiteral("pY"));
pY->setMinimum(-2048);
pY->setMaximum(2048);
gridLayout_5->addWidget(pY, 1, 2, 1, 1);
pZ = new QDoubleSpinBox(page);
pZ->setObjectName(QStringLiteral("pZ"));
pZ->setMinimum(-2048);
pZ->setMaximum(2048);
gridLayout_5->addWidget(pZ, 1, 3, 1, 1);
label_2 = new QLabel(page);
label_2->setObjectName(QStringLiteral("label_2"));
gridLayout_5->addWidget(label_2, 2, 0, 1, 1);
rX = new QDoubleSpinBox(page);
rX->setObjectName(QStringLiteral("rX"));
rX->setMinimum(-180);
rX->setMaximum(180);
gridLayout_5->addWidget(rX, 2, 1, 1, 1);
rY = new QDoubleSpinBox(page);
rY->setObjectName(QStringLiteral("rY"));
rY->setMinimum(-180);
rY->setMaximum(180);
gridLayout_5->addWidget(rY, 2, 2, 1, 1);
rZ = new QDoubleSpinBox(page);
rZ->setObjectName(QStringLiteral("rZ"));
rZ->setMinimum(-180);
rZ->setMaximum(180);
gridLayout_5->addWidget(rZ, 2, 3, 1, 1);
label_3 = new QLabel(page);
label_3->setObjectName(QStringLiteral("label_3"));
gridLayout_5->addWidget(label_3, 3, 0, 1, 1);
sX = new QDoubleSpinBox(page);
sX->setObjectName(QStringLiteral("sX"));
sX->setDecimals(3);
sX->setMinimum(0.001);
sX->setMaximum(20);
sX->setSingleStep(0.01);
gridLayout_5->addWidget(sX, 3, 1, 1, 1);
sY = new QDoubleSpinBox(page);
sY->setObjectName(QStringLiteral("sY"));
sY->setDecimals(3);
sY->setMinimum(0.001);
sY->setMaximum(20);
sY->setSingleStep(0.01);
gridLayout_5->addWidget(sY, 3, 2, 1, 1);
sZ = new QDoubleSpinBox(page);
sZ->setObjectName(QStringLiteral("sZ"));
sZ->setDecimals(3);
sZ->setMinimum(0.001);
sZ->setMaximum(20);
sZ->setSingleStep(0.01);
gridLayout_5->addWidget(sZ, 3, 3, 1, 1);
gridLayout_8->addLayout(gridLayout_5, 0, 0, 1, 1);
verticalSpacer = new QSpacerItem(20, 438, QSizePolicy::Minimum, QSizePolicy::Expanding);
gridLayout_8->addItem(verticalSpacer, 1, 0, 1, 1);
horizontalSpacer = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
gridLayout_8->addItem(horizontalSpacer, 0, 1, 1, 1);
toolBox->addItem(page, QStringLiteral("Transform"));
page_2 = new QWidget();
page_2->setObjectName(QStringLiteral("page_2"));
page_2->setGeometry(QRect(0, 0, 98, 28));
toolBox->addItem(page_2, QStringLiteral("Page 2"));
gridLayout_7->addWidget(toolBox, 0, 0, 1, 1);
tabWidget->addTab(tab_3, QString());
gridLayout->addWidget(tabWidget, 0, 1, 1, 1);
gridLayout_6->addLayout(gridLayout, 0, 0, 1, 1);
InfernalEditorClass->setCentralWidget(centralWidget);
menuBar = new QMenuBar(InfernalEditorClass);
menuBar->setObjectName(QStringLiteral("menuBar"));
menuBar->setGeometry(QRect(0, 0, 819, 21));
InfernalEditorClass->setMenuBar(menuBar);
mainToolBar = new QToolBar(InfernalEditorClass);
mainToolBar->setObjectName(QStringLiteral("mainToolBar"));
mainToolBar->setContextMenuPolicy(Qt::NoContextMenu);
InfernalEditorClass->addToolBar(Qt::TopToolBarArea, mainToolBar);
statusBar = new QStatusBar(InfernalEditorClass);
statusBar->setObjectName(QStringLiteral("statusBar"));
InfernalEditorClass->setStatusBar(statusBar);
retranslateUi(InfernalEditorClass);
tabWidget->setCurrentIndex(1);
toolBox->setCurrentIndex(0);
toolBox->layout()->setSpacing(0);
QMetaObject::connectSlotsByName(InfernalEditorClass);
} // setupUi
void retranslateUi(QMainWindow *InfernalEditorClass)
{
InfernalEditorClass->setWindowTitle(QApplication::translate("InfernalEditorClass", "InfernalEditor", Q_NULLPTR));
action_Open->setText(QApplication::translate("InfernalEditorClass", "&Open", Q_NULLPTR));
actionOpen->setText(QApplication::translate("InfernalEditorClass", "Open", Q_NULLPTR));
action_Open_2->setText(QApplication::translate("InfernalEditorClass", "&Open", Q_NULLPTR));
tabWidget->setTabText(tabWidget->indexOf(tab), QApplication::translate("InfernalEditorClass", "Scene", Q_NULLPTR));
tabWidget->setTabText(tabWidget->indexOf(tab_2), QApplication::translate("InfernalEditorClass", "Log", Q_NULLPTR));
label_4->setText(QApplication::translate("InfernalEditorClass", "X", Q_NULLPTR));
label_5->setText(QApplication::translate("InfernalEditorClass", "Y", Q_NULLPTR));
label_6->setText(QApplication::translate("InfernalEditorClass", "Z", Q_NULLPTR));
label->setText(QApplication::translate("InfernalEditorClass", "Position", Q_NULLPTR));
label_2->setText(QApplication::translate("InfernalEditorClass", "Rotation", Q_NULLPTR));
label_3->setText(QApplication::translate("InfernalEditorClass", "Scale", Q_NULLPTR));
toolBox->setItemText(toolBox->indexOf(page), QApplication::translate("InfernalEditorClass", "Transform", Q_NULLPTR));
toolBox->setItemText(toolBox->indexOf(page_2), QApplication::translate("InfernalEditorClass", "Page 2", Q_NULLPTR));
tabWidget->setTabText(tabWidget->indexOf(tab_3), QApplication::translate("InfernalEditorClass", "Page", Q_NULLPTR));
} // retranslateUi
};
namespace Ui {
class InfernalEditorClass: public Ui_InfernalEditorClass {};
} // namespace Ui
QT_END_NAMESPACE
#endif // UI_INFERNALEDITOR_H
| [
"mi7flat5@gmail.com"
] | mi7flat5@gmail.com |
e6d84463a079aef692dce48249fa637ea79a8034 | 3450a1d0d8becc537a1e80fc174a831d1f0b1a9f | /Lab/Lab2/C++/idList.h | c669df108b08cff931a98551cf31c8d19f7045ca | [] | no_license | xu3z/CSE-655 | 1356303120b55422c17aeaba3c3b362c32237598 | 57f45c595c26a9e037dedf252de66f33b553e082 | refs/heads/master | 2020-12-28T22:45:57.460623 | 2014-02-09T05:42:31 | 2014-02-09T05:42:31 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 315 | h | #ifndef _IDLIST_H_
#define _IDLIST_H_
#include "ID.h"
class idList:public Tokenizer
{
public:
string strID,gnext;
idList(){ gnext=""; };
ID id;
int curToken;
string idValue;
void parseIDListForDS();
void parseIDListForSS();
void printIDList();
void readInput();
void writeOutput();
};
#endif
| [
"ananth.mm@gmail.com"
] | ananth.mm@gmail.com |
83fd248a337efbe2a6ab405805549c4af7976980 | 46122925efca9b7652505c4e444df98cd084e28c | /sycl/source/detail/device_image_impl.hpp | e6e9050d24d98b12b0c1b68109356b467f43228b | [
"NCSA",
"LLVM-exception",
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | airgproducts/llvm | a4ebc954a08ce7f5520580e318bd39ee53b3ac57 | 9b49fe96989430fc14cd2029dfea7d5449aa2927 | refs/heads/private | 2023-08-16T06:19:52.396532 | 2021-10-21T06:21:28 | 2021-10-21T06:21:28 | 249,200,859 | 0 | 0 | null | 2021-08-05T05:13:06 | 2020-03-22T14:28:48 | null | UTF-8 | C++ | false | false | 12,130 | hpp | //==------- device_image_impl.hpp - SYCL device_image_impl -----------------==//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#pragma once
#include <CL/sycl/context.hpp>
#include <CL/sycl/detail/common.hpp>
#include <CL/sycl/detail/pi.h>
#include <CL/sycl/detail/pi.hpp>
#include <CL/sycl/device.hpp>
#include <CL/sycl/kernel_bundle.hpp>
#include <detail/context_impl.hpp>
#include <detail/device_impl.hpp>
#include <detail/kernel_id_impl.hpp>
#include <detail/plugin.hpp>
#include <detail/program_manager/program_manager.hpp>
#include <algorithm>
#include <cassert>
#include <cstring>
#include <memory>
#include <mutex>
#include <vector>
__SYCL_INLINE_NAMESPACE(cl) {
namespace sycl {
namespace detail {
// The class is impl counterpart for sycl::device_image
// It can represent a program in different states, kernel_id's it has and state
// of specialization constants for it
class device_image_impl {
public:
// The struct maps specialization ID to offset in the binary blob where value
// for this spec const should be.
struct SpecConstDescT {
unsigned int ID = 0;
unsigned int CompositeOffset = 0;
unsigned int Size = 0;
unsigned int BlobOffset = 0;
bool IsSet = false;
};
using SpecConstMapT = std::map<std::string, std::vector<SpecConstDescT>>;
device_image_impl(const RTDeviceBinaryImage *BinImage, context Context,
std::vector<device> Devices, bundle_state State,
std::vector<kernel_id> KernelIDs, RT::PiProgram Program)
: MBinImage(BinImage), MContext(std::move(Context)),
MDevices(std::move(Devices)), MState(State), MProgram(Program),
MKernelIDs(std::move(KernelIDs)) {
updateSpecConstSymMap();
}
device_image_impl(const RTDeviceBinaryImage *BinImage, context Context,
std::vector<device> Devices, bundle_state State,
std::vector<kernel_id> KernelIDs, RT::PiProgram Program,
const SpecConstMapT &SpecConstMap,
const std::vector<unsigned char> &SpecConstsBlob)
: MBinImage(BinImage), MContext(std::move(Context)),
MDevices(std::move(Devices)), MState(State), MProgram(Program),
MKernelIDs(std::move(KernelIDs)), MSpecConstsBlob(SpecConstsBlob),
MSpecConstSymMap(SpecConstMap) {}
bool has_kernel(const kernel_id &KernelIDCand) const noexcept {
return std::binary_search(MKernelIDs.begin(), MKernelIDs.end(),
KernelIDCand, LessByNameComp{});
}
bool has_kernel(const kernel_id &KernelIDCand,
const device &DeviceCand) const noexcept {
for (const device &Device : MDevices)
if (Device == DeviceCand)
return has_kernel(KernelIDCand);
return false;
}
const std::vector<kernel_id> &get_kernel_ids() const noexcept {
return MKernelIDs;
}
bool has_specialization_constants() const noexcept {
// Lock the mutex to prevent when one thread in the middle of writing a
// new value while another thread is reading the value to pass it to
// JIT compiler.
const std::lock_guard<std::mutex> SpecConstLock(MSpecConstAccessMtx);
return !MSpecConstSymMap.empty();
}
bool all_specialization_constant_native() const noexcept {
assert(false && "Not implemented");
return false;
}
bool has_specialization_constant(const char *SpecName) const noexcept {
// Lock the mutex to prevent when one thread in the middle of writing a
// new value while another thread is reading the value to pass it to
// JIT compiler.
const std::lock_guard<std::mutex> SpecConstLock(MSpecConstAccessMtx);
return MSpecConstSymMap.count(SpecName) != 0;
}
void set_specialization_constant_raw_value(const char *SpecName,
const void *Value) noexcept {
// Lock the mutex to prevent when one thread in the middle of writing a
// new value while another thread is reading the value to pass it to
// JIT compiler.
const std::lock_guard<std::mutex> SpecConstLock(MSpecConstAccessMtx);
if (MSpecConstSymMap.count(std::string{SpecName}) == 0)
return;
std::vector<SpecConstDescT> &Descs =
MSpecConstSymMap[std::string{SpecName}];
for (SpecConstDescT &Desc : Descs) {
Desc.IsSet = true;
std::memcpy(MSpecConstsBlob.data() + Desc.BlobOffset,
static_cast<const char *>(Value) + Desc.CompositeOffset,
Desc.Size);
}
}
void get_specialization_constant_raw_value(const char *SpecName,
void *ValueRet) const noexcept {
assert(is_specialization_constant_set(SpecName));
// Lock the mutex to prevent when one thread in the middle of writing a
// new value while another thread is reading the value to pass it to
// JIT compiler.
const std::lock_guard<std::mutex> SpecConstLock(MSpecConstAccessMtx);
// operator[] can't be used here, since it's not marked as const
const std::vector<SpecConstDescT> &Descs =
MSpecConstSymMap.at(std::string{SpecName});
for (const SpecConstDescT &Desc : Descs) {
std::memcpy(static_cast<char *>(ValueRet) + Desc.CompositeOffset,
MSpecConstsBlob.data() + Desc.BlobOffset, Desc.Size);
}
}
bool is_specialization_constant_set(const char *SpecName) const noexcept {
// Lock the mutex to prevent when one thread in the middle of writing a
// new value while another thread is reading the value to pass it to
// JIT compiler.
const std::lock_guard<std::mutex> SpecConstLock(MSpecConstAccessMtx);
if (MSpecConstSymMap.count(std::string{SpecName}) == 0)
return false;
const std::vector<SpecConstDescT> &Descs =
MSpecConstSymMap.at(std::string{SpecName});
return Descs.front().IsSet;
}
bundle_state get_state() const noexcept { return MState; }
void set_state(bundle_state NewState) noexcept { MState = NewState; }
const std::vector<device> &get_devices() const noexcept { return MDevices; }
bool compatible_with_device(const device &Dev) const {
return std::any_of(
MDevices.begin(), MDevices.end(),
[&Dev](const device &DevCand) { return Dev == DevCand; });
}
const RT::PiProgram &get_program_ref() const noexcept { return MProgram; }
const RTDeviceBinaryImage *&get_bin_image_ref() noexcept { return MBinImage; }
const context &get_context() const noexcept { return MContext; }
std::vector<kernel_id> &get_kernel_ids_ref() noexcept { return MKernelIDs; }
std::vector<unsigned char> &get_spec_const_blob_ref() noexcept {
return MSpecConstsBlob;
}
RT::PiMem &get_spec_const_buffer_ref() noexcept {
std::lock_guard<std::mutex> Lock{MSpecConstAccessMtx};
if (nullptr == MSpecConstsBuffer) {
const detail::plugin &Plugin = getSyclObjImpl(MContext)->getPlugin();
Plugin.call<PiApiKind::piMemBufferCreate>(
detail::getSyclObjImpl(MContext)->getHandleRef(),
PI_MEM_FLAGS_ACCESS_RW | PI_MEM_FLAGS_HOST_PTR_USE,
MSpecConstsBlob.size(), MSpecConstsBlob.data(), &MSpecConstsBuffer,
nullptr);
}
return MSpecConstsBuffer;
}
const SpecConstMapT &get_spec_const_data_ref() const noexcept {
return MSpecConstSymMap;
}
std::mutex &get_spec_const_data_lock() noexcept {
return MSpecConstAccessMtx;
}
pi_native_handle getNative() const {
assert(MProgram);
const auto &ContextImplPtr = detail::getSyclObjImpl(MContext);
const plugin &Plugin = ContextImplPtr->getPlugin();
pi_native_handle NativeProgram = 0;
Plugin.call<PiApiKind::piextProgramGetNativeHandle>(MProgram,
&NativeProgram);
return NativeProgram;
}
~device_image_impl() {
if (MProgram) {
const detail::plugin &Plugin = getSyclObjImpl(MContext)->getPlugin();
Plugin.call<PiApiKind::piProgramRelease>(MProgram);
}
}
private:
void updateSpecConstSymMap() {
if (MBinImage) {
const pi::DeviceBinaryImage::PropertyRange &SCRange =
MBinImage->getSpecConstants();
using SCItTy = pi::DeviceBinaryImage::PropertyRange::ConstIterator;
// get default values for specialization constants
const pi::DeviceBinaryImage::PropertyRange &SCDefValRange =
MBinImage->getSpecConstantsDefaultValues();
// This variable is used to calculate spec constant value offset in a
// flat byte array.
unsigned BlobOffset = 0;
for (SCItTy SCIt : SCRange) {
const char *SCName = (*SCIt)->Name;
pi::ByteArray Descriptors =
pi::DeviceBinaryProperty(*SCIt).asByteArray();
assert(Descriptors.size() > 8 && "Unexpected property size");
// Expected layout is vector of 3-component tuples (flattened into a
// vector of scalars), where each tuple consists of: ID of a scalar spec
// constant, (which might be a member of the composite); offset, which
// is used to calculate location of scalar member within the composite
// or zero for scalar spec constants; size of a spec constant
constexpr size_t NumElements = 3;
assert(((Descriptors.size() - 8) / sizeof(std::uint32_t)) %
NumElements ==
0 &&
"unexpected layout of composite spec const descriptors");
auto *It = reinterpret_cast<const std::uint32_t *>(&Descriptors[8]);
auto *End = reinterpret_cast<const std::uint32_t *>(&Descriptors[0] +
Descriptors.size());
unsigned PrevOffset = 0;
while (It != End) {
// Make sure that alignment is correct in blob.
BlobOffset += /*Offset*/ It[1] - PrevOffset;
PrevOffset = It[1];
// The map is not locked here because updateSpecConstSymMap() is only
// supposed to be called from c'tor.
MSpecConstSymMap[std::string{SCName}].push_back(
SpecConstDescT{/*ID*/ It[0], /*CompositeOffset*/ It[1],
/*Size*/ It[2], BlobOffset});
BlobOffset += /*Size*/ It[2];
It += NumElements;
}
}
MSpecConstsBlob.resize(BlobOffset);
bool HasDefaultValues = SCDefValRange.begin() != SCDefValRange.end();
if (HasDefaultValues) {
pi::ByteArray DefValDescriptors =
pi::DeviceBinaryProperty(*SCDefValRange.begin()).asByteArray();
std::uninitialized_copy(&DefValDescriptors[8],
&DefValDescriptors[8] + MSpecConstsBlob.size(),
MSpecConstsBlob.data());
}
}
}
const RTDeviceBinaryImage *MBinImage = nullptr;
context MContext;
std::vector<device> MDevices;
bundle_state MState;
// Native program handler which this device image represents
RT::PiProgram MProgram = nullptr;
// List of kernel ids available in this image, elements should be sorted
// according to LessByNameComp
std::vector<kernel_id> MKernelIDs;
// A mutex for sycnhronizing access to spec constants blob. Mutable because
// needs to be locked in the const method for getting spec constant value.
mutable std::mutex MSpecConstAccessMtx;
// Binary blob which can have values of all specialization constants in the
// image
std::vector<unsigned char> MSpecConstsBlob;
// Buffer containing binary blob which can have values of all specialization
// constants in the image, it is using for storing non-native specialization
// constants
RT::PiMem MSpecConstsBuffer = nullptr;
// Contains map of spec const names to their descriptions + offsets in
// the MSpecConstsBlob
std::map<std::string, std::vector<SpecConstDescT>> MSpecConstSymMap;
};
} // namespace detail
} // namespace sycl
} // __SYCL_INLINE_NAMESPACE(cl)
| [
"noreply@github.com"
] | airgproducts.noreply@github.com |
e511a2e3d853530049d2f7a85e7eab0b4a21dd3e | b6c985bd9f493135c4de109f3ad78d38a3059c65 | /src/dct/skip_list/util/FileReader.cpp | 392ea58a9d795d7931595be7703ec468354db287 | [] | no_license | qjhart/qjhart.geostreams | 4a80d85912cb6cdfb004017c841e3902f898fad5 | 7d5ec6a056ce43d2250553b99c7559f15db1d5fb | refs/heads/master | 2021-01-10T18:46:48.653526 | 2015-03-19T00:13:33 | 2015-03-19T00:13:33 | 32,489,398 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,505 | cpp | /**
* Define a data structure to read a file, retrieving the data
* line by line and breaking the line string into words that are
* separated by spaces.
*
* @author jzhang - created on Jun 26, 2004
*/
#include "FileReader.h"
FileReader::FileReader (char* filename) {
fid = fopen (filename, "r") ;
if (!fid) {
std::cerr << "Can not open the data file " << filename << "\n" ;
exit (1) ;
}
lineBuffer = (char*)malloc (LINE_BUFFER_SIZE) ;
fgets (lineBuffer, LINE_BUFFER_SIZE, fid) ;
}
FileReader::~FileReader () {
if (fid != NULL) {
fclose (fid) ;
}
if (lineBuffer != NULL) {
delete lineBuffer ;
}
}
bool FileReader::eof () {
return (feof (fid)) ;
}
bool FileReader::getNextLine
(char* resultWords[], int numOfWords) {
if (!feof (fid)) {
int wordNo = 0 ;
char* ptr = strtok (lineBuffer, " ") ;
while (ptr != NULL && wordNo < numOfWords) {
resultWords[wordNo] = (char*)malloc (strlen(ptr)+1) ;
strcpy (resultWords[wordNo], ptr) ;
wordNo ++ ;
ptr = strtok (NULL, " ") ;
}
// read the next line.
fgets (lineBuffer, LINE_BUFFER_SIZE, fid) ;
// if there are not enough words
if (wordNo < numOfWords) {
for (int i=0; i<numOfWords; i++) {
delete resultWords[i] ;
resultWords[i] = NULL ;
}
return false ;
}
return true ;
} else {
for (int i=0; i<numOfWords; i++) {
delete resultWords[i] ;
resultWords[i] = NULL ;
}
return false ;
}
}
| [
"qjhart@ucdavis.edu"
] | qjhart@ucdavis.edu |
ccf2aa7daad65877df971155bad0acf960426cd6 | 2cc9aba35a2d3f501f4657c0af5d8ca4e7b519c4 | /include/ten/thread_guard.hh | 4edba121121ee811708fcb617035ac1c2fc5dee5 | [
"Apache-2.0"
] | permissive | toffaletti/libten | 781bfb785a0f4002d0d20c0c7dd0971be051e348 | 00c6dcc91c8d769c74ed9063277b1120c9084427 | refs/heads/master | 2021-01-25T05:27:56.294975 | 2015-04-26T05:12:59 | 2015-04-26T05:12:59 | 1,558,548 | 27 | 10 | null | 2015-04-26T05:12:59 | 2011-04-02T04:41:25 | C++ | UTF-8 | C++ | false | false | 1,066 | hh | #ifndef TEN_THREAD_GUARD_HH
#define TEN_THREAD_GUARD_HH
#include <thread>
#include <system_error>
namespace ten {
//! wrapper that calls join on joinable threads in the destructor
class thread_guard {
private:
std::thread _thread;
public:
template <class... Args>
thread_guard(Args&&... args) : _thread{std::forward<Args>(args)...} {}
thread_guard(std::thread t) : _thread{std::move(t)} {}
thread_guard() {}
thread_guard(const thread_guard &) = delete;
thread_guard &operator =(const thread_guard &) = delete;
thread_guard(thread_guard &&other) {
if (this != &other) {
std::swap(_thread, other._thread);
}
}
thread_guard &operator=(thread_guard &&other) {
if (this != &other) {
std::swap(_thread, other._thread);
}
return *this;
}
~thread_guard() {
try {
if (_thread.joinable()) {
_thread.join();
}
} catch (std::system_error &e) {
}
}
};
} // ten
#endif // TEN_THREAD_GUARD_HH
| [
"toffaleti@gmail.com"
] | toffaleti@gmail.com |
cd3929912b0b07b504b58c70ced1449354c44c8a | 89ae2633bc000b1d38e5cf2a7069f7e78c9e7bd6 | /uva_280.cpp | 63e6b390d7b0324efc22dc9ec209feb33449e3e2 | [] | no_license | yardstick17/UVA_Solutions | b6fc01a24084ce22a6fd5f637359624b19497be1 | e5ba9855abcef0b8bcbef0808b1dff904eb8e178 | refs/heads/master | 2021-01-01T05:02:02.515018 | 2016-04-23T14:34:20 | 2016-04-23T14:34:20 | 56,923,242 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,148 | cpp | /* AK_47*/
#include<iostream>
#include<stdio.h>
#include<list>
#include<vector>
#include<map>
#include<algorithm>
#include<set>
using namespace std;
#define S(x) scanf("%d",&x)
#define pb(x) push_back(x)
#define V(x) vector<x>
#define F(i,a,n) for(int i=(a);i<(n);++i)
#define REP(i,a,n) for(i=(a);i<(n);++i)
class Graph
{
int c,coun=0;
int v;
list<int> *adj;
int visit(int ,bool*);
public:
set<int>se,s1,s2;
Graph(int v);
void addedge(int u,int v);
int DFS(int s);
};
Graph::Graph(int v){
this->v= v;
adj= new list<int>[v];
}
void Graph::addedge(int v,int w)
{
adj[v].push_back(w);
}
int Graph::visit(int s,bool *visited)
{
// if(visited[s]=true)
// coun++;
//cout<<" graph traversal is: "<<endl;
// cout<<" "<<s+1<<" ";
list<int>::iterator it=adj[s].begin();
for(;it!=adj[s].end();it++)
{
if(visited[*it]==false)
{ visited[*it]=true;
se.insert(*it);
coun++;
visit(*it,visited);
}
}
return coun;
}
int Graph::DFS(int s)
{ se.clear();
// s1.clear();
s2.clear();
coun=0;
int i;
bool *visited= new bool[v];
for(i=0;i<v;i++)
visited[i]=false;
c=visit(s,visited);
return c;
}
int main()
{
int v,t,x,y,z,i,j,k,m,a[1000];
while(1){
S(v);
if(v==0)
break;
Graph g(v);
set<int>::iterator it;//= g.se.begin();
for(i=0;i<v;i++)
g.s1.insert(i);
while(1)
{
z=0;
cin>>x;
if(x==0)
break;
else
{ //g.s1.insert(x-1);
while(1)
{
cin>>y;
if(y==0)
break;
else
{
// g.s1.insert(y-1);
g.addedge(x-1,y-1);
}
}
}
}//cout<<" Graph si: ";
//for(it=g.s1.begin();it!=g.s1.end();it++)
//cout<<*it<<" ";
//cout<<endl;
S(t);
REP(i,0,t)
{ cin>>x;
a[i]=x;
}
REP(i,0,t)
{ //cout<<"\n";
m=g.DFS(a[i]-1);
for(it=g.s1.begin();it!=g.s1.end();it++)
{
if(g.se.find(*it)==g.se.end())
g.s2.insert(*it);
}
m=v-m;
cout<<m;
for(it=g.s2.begin();it!=g.s2.end();it++)
cout<<" "<<*it+1;
cout<<endl;
//cout<<" Ans is: "<<m<<endl;
}
}
return 0;
}
| [
"amit_kushwaha@outlook.com"
] | amit_kushwaha@outlook.com |
36eea3226c2e9a48094478fc881d01f4ec8a65d5 | 1d369cef3d261429773d562635e1402d86ab8958 | /协同进程/add.cpp | d276bd32522d2f0e8a5c1e7d10d283387ea9a5a4 | [] | no_license | gopep9/learnapue | 81c502b0ecfa44344efcb15439a8450373fef3fd | 774b533140d200beb22587c555512690c8010905 | refs/heads/master | 2020-03-25T08:06:40.456351 | 2018-08-07T07:30:52 | 2018-08-07T07:30:52 | 143,597,852 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,045 | cpp | //
// main.cpp
// CPlusPlusTest
//
// Created by huangzhao on 2018/4/16.
// Copyright © 2018年 huangzhao. All rights reserved.
//
#include <iostream>
#include <string>
#include <unistd.h>
#include "headset.h"
//加法器,读取输入,并且相加,输出
int my_getline(char* line, int max_size)
{
int c;
int len = 0;
while( (c = getchar()) != EOF && len < max_size ){
line[len++] = c;
if('\n' == c)
break;
}
line[len] = '\0';
return len;
}
int main(int argc,char *argv[])
{
size_t readwordnum = 0,int1 = 0,int2 = 0;
char str[1024];
while(my_getline(str, 1024)>0)
{
if(sscanf(str,"%d %d",&int1,&int2)==2)
{
sprintf(str,"%d\n",int1+int2);
readwordnum=strlen(str);
if(write(STDOUT_FILENO, str, readwordnum)!=readwordnum)
{
perror("write");
return -1;
}
}else{
puts("invalid args");
return -1;
}
}
return 0;
}
| [
"huangjian@huangjiandeMacBook-Pro.local"
] | huangjian@huangjiandeMacBook-Pro.local |
bffb1ac863b9891a507e5aeaa8b4cca6855f5886 | 45a17c4444365ee6076b43af194c9c2aefdd745e | /demboyz/netmessages/svc_setview.h | e4ba4f72bacd09e2fe1cc7f8dcfcb6495dfc16f2 | [
"MIT"
] | permissive | SizzlingStats/demboyz | 45053ba6a4e050b2bc68a0d1bc39773a04c7516c | 2b68115b9124e554f0377d8a96b196cdb9e1c57f | refs/heads/master | 2023-02-22T03:08:05.414502 | 2023-02-10T05:51:19 | 2023-02-10T05:52:08 | 25,903,045 | 47 | 13 | null | 2016-06-28T00:46:01 | 2014-10-29T03:41:34 | C++ | UTF-8 | C++ | false | false | 161 | h |
#pragma once
#include "nethandlers.h"
namespace NetMsg
{
struct SVC_SetView
{
uint16_t entIndex;
};
}
DECLARE_NET_HANDLERS(SVC_SetView);
| [
"jordan.cristi@gmail.com"
] | jordan.cristi@gmail.com |
b91f2809733daed87a0f0c0ba380e21797b97e46 | 64fda67d42a44deab0a57834fc2e04ce0e655425 | /tempest_source/Engine/TempestEngine/External/SceneManipulatorInterface.hpp | b9102b79cac2da58efd2f13d0da2f42b49eccd9c | [] | no_license | charlesboudousquie/Workbench | 6984575e2fddc7c1eaa59ab9ad6861cb51aa884c | 724021fa76a33cdb0182f53392918f4560960f9b | refs/heads/master | 2020-08-17T16:33:44.040296 | 2019-11-24T03:45:33 | 2019-11-24T03:45:33 | 215,687,374 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,918 | hpp | /*!***************************************************************************************
\file SceneManipulatorInterface.hpp
\author Aaron Damyen
\date 7/31/18
\copyright All content � 2018-2019 DigiPen (USA) Corporation, all rights reserved.
\par Project: Boomerang
\brief
*****************************************************************************************/
#pragma once
#include <Reflection.hpp>
#include <DataTypes.hpp>
#include <vector>
#include <string>
#include <memory>
class scene;
class space;
class gameObject;
class sceneManipulatorInterface
{
public:
virtual objID getParentID(objID p_object_id) = 0;
virtual objID getSpaceIDForObject(objID p_object_id) = 0;
virtual objID getSpaceIDFromName(std::string name) = 0;
virtual std::vector<objID> getSceneIDs() = 0;
virtual std::string getSceneName(objID p_scene_id) = 0;
virtual std::vector<objID> getSpaceIDsForScene(objID p_scene_id) = 0;
virtual std::string getSpaceName(objID p_space_id) = 0;
virtual std::vector<objID> getObjectIDsForSpace(objID p_space_id) = 0;
virtual std::vector<objID> getTopObjectIDsForSpace(objID p_space_id) = 0;
virtual std::vector<objID> getChildObjectIDsForObject(objID p_object_id) = 0;
virtual std::string getObjectName(objID p_object_id) = 0;
virtual typeRT getTypeRT(objID p_object_id) = 0;
virtual void applyTypeRT(objID p_id, typeRT & p_type) = 0;
virtual std::shared_ptr<scene> addEmptyScene() = 0;
virtual std::shared_ptr<space> addEmptySpace() = 0;
virtual std::shared_ptr<space> addEmptySpace(objID p_scene_id) = 0;
virtual objID addEmptySpace(const std::string& p_name) = 0;
virtual std::shared_ptr<gameObject> addEmptyGameObject() = 0;
virtual std::shared_ptr<gameObject> addEmptyGameObject(objID p_parent_id) = 0;
virtual objID addEmptyGameObject(objID p_parent_id, const std::string& p_name) = 0;
virtual void addRenderedGameObject(float p_x, float p_y, float p_z, std::string p_object_name, std::string p_texture) = 0;
virtual void addGameObjectComponent(objID p_object_id, const std::string & p_component_type) = 0;
virtual void removeGameObjectComponent(objID p_object_id, const std::string & p_component_type) = 0;
virtual void readObjectTransform(objID p_object_id, float * p_transform_matrix) = 0;
virtual void writeObjectTransform(objID p_object_id, float * p_transform_matrix) = 0;
virtual void createEditorCamera() = 0;
virtual void removeEditorCamera() = 0;
virtual void setButtonNeighbor(objID p_objectID, objID p_neighborID, int p_neighbor) = 0;
virtual objID removeButtonNeighbor(objID p_objectID, int p_neighbor) = 0;
virtual objID getObjectID(std::string p_objectName) = 0;
virtual void setCollisionLayer(objID p_object_id, unsigned int p_data, unsigned int p_type) = 0;
virtual void removeGameObject(objID p_objectID) = 0;
virtual void addParentToGameObject(objID p_parent_id, objID p_child_id) = 0;
virtual void removeParent(objID p_child_id) = 0;
virtual void setGameObjectName(objID p_object_id, const std::string & p_name) = 0;
virtual void setSceneName(objID p_scene_id, const std::string & p_name) = 0;
virtual void setSpaceName(objID p_space_id, const std::string & p_name) = 0;
virtual void deleteSpace(objID p_space_id) = 0;
virtual void deleteSpace(const std::string& p_space_name) = 0;
virtual void setButtonMaterial(objID p_button_id, const std::string & p_name) = 0;
virtual void moveObjectToSpace(objID p_object_id, const std::string & p_space) = 0;
virtual void moveObjectToSpace(objID p_object_id, objID p_space_id) = 0;
virtual void dynamicWaypointGraphCreatePath() = 0;
virtual void dynamicWaypointGraphCreateSetPaths() = 0;
virtual void dynamicWaypointGraphStitchPaths() = 0;
virtual void dynamicWaypointGraphClear() = 0;
virtual void dynamicWaypointGraphDeleteRandomNodeSet() = 0;
virtual void dynamicWaypointGraphTestFunction() = 0;
};
| [
"charlesboudousquie@gmail.com"
] | charlesboudousquie@gmail.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.