blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 2 247 | content_id stringlengths 40 40 | detected_licenses listlengths 0 57 | license_type stringclasses 2 values | repo_name stringlengths 4 111 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringlengths 4 58 | visit_date timestamp[ns]date 2015-07-25 18:16:41 2023-09-06 10:45:08 | revision_date timestamp[ns]date 1970-01-14 14:03:36 2023-09-06 06:22:19 | committer_date timestamp[ns]date 1970-01-14 14:03:36 2023-09-06 06:22:19 | github_id int64 3.89k 689M ⌀ | star_events_count int64 0 209k | fork_events_count int64 0 110k | gha_license_id stringclasses 25 values | gha_event_created_at timestamp[ns]date 2012-06-07 00:51:45 2023-09-14 21:58:52 ⌀ | gha_created_at timestamp[ns]date 2008-03-27 23:40:48 2023-08-24 19:49:39 ⌀ | gha_language stringclasses 159 values | src_encoding stringclasses 34 values | language stringclasses 1 value | is_vendor bool 1 class | is_generated bool 2 classes | length_bytes int64 7 10.5M | extension stringclasses 111 values | filename stringlengths 1 195 | text stringlengths 7 10.5M |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
835f6a6fee1948d729ffa440a4db60cbef4e6a0e | f388b93a7fd245ad2c1fd26990277c08e6268ab4 | /docs/ptr_func/src/app.cpp | d6aa06d0a32a1ae6fd2fb318ea5adb6930c89b41 | [] | no_license | bergony/lp_lista_2 | fe6779f02b943b21bc49e15da94ee362082bd8bc | 6d36f643ee42f04577e2da3e4ad86820e193e540 | refs/heads/master | 2020-12-29T06:55:33.398046 | 2020-02-05T16:50:35 | 2020-02-05T16:50:35 | 238,500,610 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 920 | cpp | app.cpp | /*!
* \file filter.cpp
* \author Selan
* \date August, 9th
*/
#include <iostream>
#include <sstream>
#include "../include/filter.h"
std::string print ( int * first_, int * last_ )
{
std::ostringstream oss;
oss << "[ ";
std::copy( first_, last_, std::ostream_iterator<int>( oss, " " ) );
oss << "]";
return oss.str();
}
bool predicado_even( const int & a )
{
return ( a % 2 == 0 );
}
bool predicado_greater_4( const int & a )
{
return ( a > 4 );
}
bool predicado_odd( const int & a )
{
return ( a % 2 != 0 );
}
int main()
{
int A[] { 4, 2, 1, 0, -2, 3, -5, 7, 10 };
std::cout << " >> A " << print(std::begin(A), std::end(A)) << "\n";
//auto new_last= filter_lin_even( std::begin(A), std::end(A) );
auto new_last= filter( std::begin(A), std::end(A), predicado_greater_4 );
std::cout << " >> A (after filter) " << print(std::begin(A), new_last) << "\n";
}
|
33506723d4633d6b8d035a27e267af03faabb4c7 | ba8ba211e55554c22b72a641abb84edc00b6d509 | /Source/FYP/SniperCharacter.cpp | c3e9ebf9bfb5299d974e2671943e36ce68213ee1 | [] | no_license | Taikatou/FYP | fb0b48fb50ae4867ef8fbfca5f7d9d1208f6379c | 51af7cfe454529816f25efed05435e73b47caba8 | refs/heads/master | 2021-01-25T06:56:40.524987 | 2017-04-11T12:30:24 | 2017-04-11T12:30:24 | 80,674,941 | 1 | 0 | null | 2017-03-10T20:12:53 | 2017-02-01T23:23:56 | C++ | UTF-8 | C++ | false | false | 1,058 | cpp | SniperCharacter.cpp | // Fill out your copyright notice in the Description page of Project Settings.
#include "FYP.h"
#include "SniperCharacter.h"
ASniperCharacter::ASniperCharacter()
{
Aiming = false;
CameraLocation = CreateDefaultSubobject<USceneComponent>(TEXT("CameraLocation"));
CameraLocation->SetupAttachment(FPSCameraComponent);
}
void ASniperCharacter::SetupPlayerInputComponent(UInputComponent* PlayerInputComponent)
{
Super::SetupPlayerInputComponent(PlayerInputComponent);
PlayerInputComponent->BindAction("Aim", IE_Pressed, this, &ASniperCharacter::Aim);
PlayerInputComponent->BindAction("Aim", IE_Released, this, &ASniperCharacter::StopAim);
}
void ASniperCharacter::Aim()
{
Aiming = true;
GetWeapon()->SetVisibility(false);
ShowSniperOverlay();
}
void ASniperCharacter::StopAim()
{
Aiming = false;
GetWeapon()->SetVisibility(true);
HideSniperOverlay();
}
void ASniperCharacter::EndGame()
{
if(Aiming)
{
HideSniperOverlay();
}
}
void ASniperCharacter::EndPlay(EEndPlayReason::Type EndPlayReason)
{
if(Aiming)
{
HideSniperOverlay();
}
}
|
a2817d250348fb78eb99c9798d87e46ab61419dc | 8704bb8de634f76503d8bfe0cfc88e0adfebbc7e | /src/db/ssqlses.cpp | 884a81008eb9e51819fe212fc1144fbf931393e2 | [
"BSD-3-Clause"
] | permissive | X-CASH-official/X-CASH-Web-Wallet | c230ebd3d3bdf605d24f38bef6e8a9ddcf8ffe0b | 755d623253fc9449a6db37532ce9c156ffb76575 | refs/heads/master | 2020-04-02T23:44:11.135444 | 2019-06-18T15:13:57 | 2019-06-18T15:13:57 | 154,877,560 | 3 | 4 | NOASSERTION | 2019-05-22T23:58:42 | 2018-10-26T18:25:13 | C | UTF-8 | C++ | false | false | 3,591 | cpp | ssqlses.cpp | //
// Created by mwo on 7/01/17.
//
#include "ssqlses.h"
namespace xmreg
{
ostream& operator<< (std::ostream& os, const Table& data)
{
os << data.table_name() << ": " << data.to_json().dump() << '\n';
return os;
};
json
XmrAccount::to_json() const
{
json j {{"id" , id.data},
{"address" , address},
{"viewkey" , viewkey},
{"scanned_block_height" , scanned_block_height},
{"scanned_block_timestamp", static_cast<uint64_t>(scanned_block_timestamp)},
{"start_height" , start_height}
};
return j;
}
json
XmrTransaction::to_json() const
{
json j {{"id" , id.data},
{"hash" , hash},
{"prefix_hash" , prefix_hash},
{"tx_pub_key" , tx_pub_key},
{"account_id" , account_id},
{"total_received" , total_received},
{"total_sent" , total_sent},
{"height" , height},
{"payment_id" , payment_id},
{"unlock_time" , unlock_time},
{"coinbase" , bool {coinbase}},
{"is_rct" , bool {is_rct}},
{"rct_type" , rct_type},
{"spendable" , bool {spendable}},
{"mixin" , mixin},
{"timestamp" , static_cast<uint64_t>(timestamp)}
};
return j;
}
DateTime
XmrTransaction::timestamp_to_DateTime(time_t timestamp)
{
return DateTime(timestamp);
}
ostream& operator<< (std::ostream& os, const XmrTransaction& acc)
{
os << "XmrTransactions: " << acc.to_json().dump() << '\n';
return os;
};
json
XmrOutput::to_json() const
{
json j {{"id" , id.data},
{"account_id" , account_id},
{"tx_id" , tx_id},
{"out_pub_key" , out_pub_key},
{"tx_pub_key" , tx_pub_key},
{"amount" , amount},
{"global_index" , global_index},
{"out_index" , out_index},
{"mixin" , mixin},
{"timestamp" , static_cast<uint64_t>(timestamp)}
};
return j;
}
ostream& operator<< (std::ostream& os, const XmrOutput& out) {
os << "XmrOutputs: " << out.to_json().dump() << '\n';
return os;
};
json
XmrInput::to_json() const
{
json j {{"id" , id.data},
{"account_id" , account_id},
{"tx_id" , tx_id},
{"output_id" , output_id},
{"key_image" , key_image},
{"amount" , amount},
{"timestamp" , static_cast<uint64_t>(timestamp)}
};
return j;
}
ostream& operator<< (std::ostream& os, const XmrInput& out)
{
os << "XmrInput: " << out.to_json().dump() << '\n';
return os;
};
json
XmrPayment::to_json() const
{
json j {{"id" , id.data},
{"account_id" , account_id},
{"payment_id" , payment_id},
{"tx_hash" , tx_hash},
{"request_fulfilled", bool {request_fulfilled}},
{"import_fee" , import_fee},
{"payment_address" , payment_address},
};
return j;
}
ostream& operator<< (std::ostream& os, const XmrPayment& out) {
os << "XmrPayment: " << out.to_json().dump() << '\n';
return os;
};
} |
264256649a2a36196b0f7295e9960a038f0e116c | 346e4db27ef55d7a2e3ba535f363246f9837961a | /solutions/KONDUKTOR.cpp | 4ddbc3ee747c8a252062bae86e73583a65e8d49b | [] | no_license | mateusz-lamecki/POI-solutions | 4a0386373cc415742d78beaf3ba8094de7f7b9ba | 0ce5b4cd992cd131562182c7470659fd2596bc06 | refs/heads/master | 2022-02-10T18:39:37.893930 | 2022-01-05T00:47:41 | 2022-01-05T00:47:41 | 87,966,104 | 3 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,147 | cpp | KONDUKTOR.cpp | #include <cstdio>
#include <iostream>
#include <vector>
#include <list>
#include <string>
#include <set>
#include <map>
#include <algorithm>
#include <utility>
#include <cmath>
#include <queue>
#include <stack>
#include <cassert>
#include <cstring>
#include <climits>
#define VAR(i,v) __typeof(v) i = (v)
#define SIZE(x) ((int)(x).size())
#define ALL(x) (x).begin(), (x).end()
#define REP(i,b) for(int i=0; i<(b); ++i)
#define FOR(i,a,b) for(int i=(a); i<=(b); ++i)
#define FORD(i,a,b) for(int i=(a); i>=(b); --i)
#define FOREACH(i,c) for(VAR(i,(c).begin()); i != (c).end(); ++i)
#define PB push_back
#define MP make_pair
#define ST first
#define ND second
#define NL printf("\n")
using namespace std;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef long long LL;
const int INF = 214748360;
const int MAXN = 605;
int x[MAXN][MAXN];
int dp[MAXN][MAXN];
int w[MAXN][MAXN];
int r[MAXN][MAXN];
int n, k;
VI res;
int get(int a, int b, int c, int d) {
int ret = dp[b+1][d+1] - dp[a][d+1] - dp[b+1][c] + dp[a][c];
//printf(" liczę (%d,%d) - (%d,%d) = %d\n", a, b, c, d, ret);
return ret;
}
void calc_dp() {
REP(i,n+1) REP(j,n+1) {
dp[i+1][j+1] = dp[i][j+1] + dp[i+1][j] - dp[i][j] + x[i][j];
}
}
int main() {
scanf("%d%d", &n, &k);
FOR(i,1,n-1) FOR(j,i+1,n) scanf("%d", &x[i][j]);
calc_dp();
/*REP(i,n+1) {
REP(j,n+1) printf("%d\t", x[i][j]);
NL;
}
NL;*/
FOR(i,1,k) {
//printf("Dla %d kontrol:\n", i);
FORD(j,n,1) {
//printf(" dla stacji %d..%d\n", j, n);
FOR(k,j,n-i) {
int u = w[k+1][i-1] + get(j,k,k+1,n);
if(u > w[j][i]) {
//printf(" aktualizuję %d do %d\n", w[j][i], u);
w[j][i] = u;
r[j][i] = k;
}
}
}
}
/*REP(i,n+1) {
REP(j,k+1) {
printf("%d ", w[i][j]);
}
NL;
}
NL;
REP(i,n+1) {
printf("%d: ", i);
REP(j,k+1) {
printf("%d\t", r[i][j]);
}
NL;
}*/
set<int> res;
int x = k, y = 1;
while(x>0) {
res.insert(r[y][x]);
y = r[y][x] + 1;
x--;
}
if(res.find(0) != res.end()) res.erase(res.find(0));
FOR(i,1,n) if(SIZE(res) < k && res.find(i) == res.end()) res.insert(i);
FOREACH(it,res) printf("%d ", *it);
NL;
return 0;
}
|
21d04150b2f33ba44d55e5e1e444cccd3287197c | 775acebaa6559bb12365c930330a62365afb0d98 | /source/public/interfaces/architecture/IFootnoteOptionsSuite.h | 2c99c89b644926d91335fbec3cb3270e96e127fc | [] | no_license | Al-ain-Developers/indesing_plugin | 3d22c32d3d547fa3a4b1fc469498de57643e9ee3 | 36a09796b390e28afea25456b5d61597b20de850 | refs/heads/main | 2023-08-14T13:34:47.867890 | 2021-10-05T07:57:35 | 2021-10-05T07:57:35 | 339,970,603 | 1 | 1 | null | 2021-10-05T07:57:36 | 2021-02-18T07:33:40 | C++ | UTF-8 | C++ | false | false | 7,560 | h | IFootnoteOptionsSuite.h | //========================================================================================
//
// $File: //depot/devtech/16.0.x/plugin/source/public/interfaces/architecture/IFootnoteOptionsSuite.h $
//
// Owner: rkamicar
//
// $Author: pmbuilder $
//
// $DateTime: 2020/11/06 13:08:29 $
//
// $Revision: #2 $
//
// $Change: 1088580 $
//
// Copyright 1997-2010 Adobe Systems Incorporated. All rights reserved.
//
// NOTICE: Adobe permits you to use, modify, and distribute this file in accordance
// with the terms of the Adobe license agreement accompanying it. If you have received
// this file from a source other than Adobe, then your use, modification, or
// distribution of it requires the prior written permission of Adobe.
//
//
// Note:
//
//========================================================================================
#pragma once
#ifndef _IFootnoteOptionsSuite_
#define _IFootnoteOptionsSuite_
#include "IPMUnknown.h"
#include "IFootnoteSettings.h"
#include "IFootnoteSettingsCmdData.h"
/** IFootnoteOptionsSuite
@note See IFootnoteSettings for descriptions of most of these methods as this is a mirror interface to that.
*/
class IFootnoteOptionsSuite : public IPMUnknown
{
public:
enum { kDefaultIID = IID_IFOOTNOTEOPTIONS_ISUITE };
/** Can the options be set? (i.e. does the current selection make sense for footnote options)
*/
virtual bool16 CanApplyFootnoteOptions(void) const = 0;
/** See IFootnoteSettings
*/
virtual IFootnoteSettings::MarkerPositionOptions GetMarkerPositioning() const = 0;
/** See IFootnoteSettings
*/
virtual void SetMarkerPositioning(IFootnoteSettings::MarkerPositionOptions positioning) = 0;
/** See IFootnoteSettings
*/
virtual IFootnoteSettings::RestartNumberingOptions GetRestartOption() const = 0;
/** See IFootnoteSettings
*/
virtual void SetRestartOption(IFootnoteSettings::RestartNumberingOptions option) = 0;
/** See IFootnoteSettings
*/
virtual int32 GetStartingNumber() const = 0;
/** See IFootnoteSettings
*/
virtual void SetStartingNumber(int32 n) = 0;
/** See IFootnoteSettings
*/
virtual ClassID GetNumberingMethod() const = 0;
/** See IFootnoteSettings
*/
virtual void SetNumberingMethod(ClassID whichMethod) = 0;
/** See IFootnoteSettings
*/
virtual const WideString& GetMarkerPrefix() const = 0;
/** See IFootnoteSettings
*/
virtual void SetMarkerPrefix(const WideString& pre) = 0;
/** See IFootnoteSettings
*/
virtual const WideString& GetMarkerSuffix() const = 0;
/** See IFootnoteSettings
*/
virtual void SetMarkerSuffix(const WideString& suf) = 0;
/** See IFootnoteSettings
*/
virtual IFootnoteSettings::SuffixPrefixUsageOptions GetPrefixSuffixUsage() const = 0;
/** See IFootnoteSettings
*/
virtual void SetPrefixSuffixUsage(IFootnoteSettings::SuffixPrefixUsageOptions options) = 0;
/** See IFootnoteSettings
*/
virtual UID GetFootnoteMarkerStyle() const = 0;
/** See IFootnoteSettings
*/
virtual void SetFootnoteMarkerStyle(UID s) = 0;
/** See IFootnoteSettings
*/
virtual UID GetFootnoteParagraphStyle() const = 0;
/** See IFootnoteSettings
*/
virtual void SetFootnoteParagraphStyle(UID s) = 0;
/** See IFootnoteSettings
*/
virtual const WideString& GetFootnoteSeparator() const = 0;
/** See IFootnoteSettings
*/
virtual void SetFootnoteSeparator(const WideString& sep) = 0;
/** See IFootnoteSettings
*/
virtual PMReal GetSpaceBetween() const = 0;
/** See IFootnoteSettings
*/
virtual void SetSpaceBetween(PMReal g) = 0;
/** See IFootnoteSettings
*/
virtual PMReal GetSpacerHeight() const = 0;
/** See IFootnoteSettings
*/
virtual void SetSpacerHeight(PMReal g) = 0;
/** See IFootnoteSettings
*/
virtual Text::FirstLineOffsetMetric GetFirstLineOffset() const = 0;
/** See IFootnoteSettings
*/
virtual void SetFirstLineOffset(Text::FirstLineOffsetMetric flo) = 0;
/** See IFootnoteSettings
*/
virtual PMReal GetMinFirstLineOffset() const = 0;
/** See IFootnoteSettings
*/
virtual void SetMinFirstLineOffset(PMReal g) = 0;
/** See IFootnoteSettings
*/
virtual bool16 GetEndOfStoryPlacement() const = 0;
/** See IFootnoteSettings
*/
virtual void SetEndOfStoryPlacement(bool16 b) = 0;
/** See IFootnoteSettings
*/
virtual bool16 GetNoSplitting() const = 0;
/** See IFootnoteSettings
*/
virtual void SetNoSplitting(bool16 b) = 0;
/** See IFootnoteSettings
*/
virtual bool16 GetStraddlingInfo() const = 0;
/** See IFootnoteSettings
*/
virtual void SetStraddlingInfo(bool16 b) = 0;
/** See IFootnoteSettings
*/
virtual bool16 GetSeparatorLineOn(IFootnoteSettings::FootnoteRuleKind k) const = 0;
/** See IFootnoteSettings
*/
virtual void SetSeparatorLineOn(IFootnoteSettings::FootnoteRuleKind k, bool16 b) = 0;
/** See IFootnoteSettings
*/
virtual PMReal GetWeightStroke(IFootnoteSettings::FootnoteRuleKind k) const = 0;
/** See IFootnoteSettings
*/
virtual void SetWeightStroke(IFootnoteSettings::FootnoteRuleKind k, PMReal g) = 0;
/** See IFootnoteSettings
*/
virtual ICompositionStyle::StrokeType GetStrokeType(IFootnoteSettings::FootnoteRuleKind k) const = 0;
/** See IFootnoteSettings
*/
virtual void SetStrokeType(IFootnoteSettings::FootnoteRuleKind k, ICompositionStyle::StrokeType s) = 0;
/** See IFootnoteSettings
*/
virtual PMReal GetIndentLeft(IFootnoteSettings::FootnoteRuleKind k) const = 0;
/** See IFootnoteSettings
*/
virtual void SetIndentLeft(IFootnoteSettings::FootnoteRuleKind k, PMReal g) = 0;
/** See IFootnoteSettings
*/
virtual PMReal GetWidth(IFootnoteSettings::FootnoteRuleKind k) const = 0;
/** See IFootnoteSettings
*/
virtual void SetWidth(IFootnoteSettings::FootnoteRuleKind k, PMReal g) = 0;
/** See IFootnoteSettings
*/
virtual PMReal GetOffset(IFootnoteSettings::FootnoteRuleKind k) const = 0;
/** See IFootnoteSettings
*/
virtual void SetOffset(IFootnoteSettings::FootnoteRuleKind k, PMReal g) = 0;
/** See IFootnoteSettings
*/
virtual UID GetColorStroke(IFootnoteSettings::FootnoteRuleKind k) const = 0;
/** See IFootnoteSettings
*/
virtual void SetColorStroke(IFootnoteSettings::FootnoteRuleKind k, UID s) = 0;
/** See IFootnoteSettings
*/
virtual PMReal GetTintStroke(IFootnoteSettings::FootnoteRuleKind k) const = 0;
/** See IFootnoteSettings
*/
virtual void SetTintStroke(IFootnoteSettings::FootnoteRuleKind k, PMReal g) = 0;
/** See IFootnoteSettings
*/
virtual bool16 GetOverprintStroke(IFootnoteSettings::FootnoteRuleKind k) const = 0;
/** See IFootnoteSettings
*/
virtual void SetOverprintStroke(IFootnoteSettings::FootnoteRuleKind k, bool16 b) = 0;
/** See IFootnoteSettings
*/
virtual UID GetColorGap(IFootnoteSettings::FootnoteRuleKind k) const = 0;
/** See IFootnoteSettings
*/
virtual void SetColorGap(IFootnoteSettings::FootnoteRuleKind k, UID s) = 0;
/** See IFootnoteSettings
*/
virtual PMReal GetTintGap(IFootnoteSettings::FootnoteRuleKind k) const = 0;
/** See IFootnoteSettings
*/
virtual void SetTintGap(IFootnoteSettings::FootnoteRuleKind k, PMReal g) = 0;
/** See IFootnoteSettings
*/
virtual bool16 GetOverprintGap(IFootnoteSettings::FootnoteRuleKind k) const = 0;
/** See IFootnoteSettings
*/
virtual void SetOverprintGap(IFootnoteSettings::FootnoteRuleKind k, bool16 b) = 0;
/** See IFootnoteSettings
*/
virtual void SetAllSettings(const IFootnoteSettingsCmdData::FootnotePrefs* settings,
const IFootnoteSettingsCmdData::FootnoteLinePrefs* separator,
const IFootnoteSettingsCmdData::FootnoteLinePrefs* continuing) = 0;
};
#endif // _IFootnoteOptionsSuite_
|
7edc16dd57a3ceaba338a257b13086734d169ce6 | 5aa2912f1672b6ae3d3b774b3f173b760fdd107d | /Lesson11/Sample88.cpp | 262c85a6b1805c7731a3124e2d93725c5620054f | [] | no_license | cleveland0714/cpp_study | c6f16d464b67dad8e7bbec1996db6cdca4ce1c9c | 425044a89fdb019d91e762e29feb307c81543086 | refs/heads/master | 2020-09-07T01:50:52.581956 | 2019-11-15T19:56:23 | 2019-11-15T19:56:23 | 220,620,597 | 0 | 0 | null | null | null | null | SHIFT_JIS | C++ | false | false | 501 | cpp | Sample88.cpp | #include<iostream>
using namespace std;
//共用体型yearの宣言
union year {
int ad;
int gengo;
};
int main() {
year myyear;
cout << "西暦を入力してください\n";
cin >> myyear.ad;
cout << "西暦は" << myyear.ad << "です\n";
cout << "元号も" << myyear.gengo << "です\n";
cout << "元号を入力してください\n";
cin >> myyear.gengo;
cout << "元号は" << myyear.gengo << "です\n";
cout << "西暦も" << myyear.ad << "です\n";
return 0;
} |
0fe1c59b91b7b629568835d770ed1aa1be89167c | 817c37a80bd263055d529fdcf6eb5005909b8f26 | /src/qtgoogleloginwidget.h | 60c352b490b787a3fc1fd93e3ca41fec0da06638 | [] | no_license | msorvig/QtWebServices | c153e9218949bb6e6bca4772aa88c4d386160223 | 51d848d30354e3103f76c6b0712cea843403a25e | refs/heads/master | 2020-12-25T19:03:40.524626 | 2015-04-06T19:38:24 | 2015-04-06T19:38:24 | 7,556,228 | 1 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 505 | h | qtgoogleloginwidget.h | #include <QtWidgets/QtWidgets>
#include <QtWidgets/QMacCocoaViewContainer>
#include <qtgoogleoauthlogin.h>
#include "qtwebview.h"
class QtGoogleLoginWidget : public QWidget
{
Q_OBJECT
public:
QtGoogleLoginWidget(QWidget *parentWidget = 0);
Q_SIGNALS:
void loginCompleted(const QString &result);
public Q_SLOTS:
void displayLoginPage(const QUrl &loginUrl);
private Q_SLOTS:
void pageLoadFinished(bool ok);
private:
QtWebView *webView;
QMacCocoaViewContainer *webViewContainer;
};
|
7ecc6ac20de88cfe86d3339b2f796e6059905305 | 435734be033887e4a27508271facd38dc4c162f5 | /lab2/greatestproduct/GreatestProduct.cpp | 8aac6bd3e51b331747f906b1a5491a2ba11443e3 | [] | no_license | WojciechSalapatek/JIMP2 | ba1fd8312f8bc6a9b11fb7b403b16cd4381d9b87 | f9fe351ca92a03273058d44354c03e5e8efe894a | refs/heads/master | 2021-04-26T23:13:16.545026 | 2018-06-02T19:50:28 | 2018-06-02T19:50:28 | 123,950,277 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 758 | cpp | GreatestProduct.cpp | //
// Created by wojciechsalapatek on 10.03.18.
//
#include "GreatestProduct.h"
#include <cmath>
using namespace std;
int GetMin(const vector<int> &tmp);
int GreatestProduct(const std::vector<int> &numbers, int k){
int min, result = 1;
if (k>numbers.size()) return 0;
vector<int> tmp;
for (int i=0; i<k; i++) tmp.push_back(numbers[i]);
min = GetMin(tmp);
for (int i = k; i<numbers.size();i++){
if (numbers[i]>tmp[min]) {
tmp[min] = numbers[i];
min = GetMin(tmp);
}
}
for (auto i : tmp) result *= i;
return result;
}
int GetMin(const vector<int> &tmp) {
int min = 0;
for (int i=0;i<tmp.size(); i++) {
if (tmp[i] < tmp[min]) min=i;
}
return min;
} |
97ae6f92597728c5ff0308824be6e6f3e9c8c5d1 | fd187f2f3ef1b1a79829a21e7d6958bdf86a5bf2 | /src/api/c/type_util.cpp | 39a9af60d74de785aee1e45e2c9fb1fc2083457d | [
"MIT",
"BSD-3-Clause",
"Zlib",
"BSL-1.0",
"Apache-2.0"
] | permissive | rousse101/arrayfire | 178ec34e72f7676b392459607968b151938ed6d6 | 323aa777006af22183f3d6960bddf8e795e02f52 | refs/heads/devel | 2021-01-17T22:36:31.665764 | 2015-11-30T22:39:40 | 2015-11-30T22:39:40 | 47,368,817 | 2 | 0 | null | 2015-12-04T00:02:36 | 2015-12-04T00:02:36 | null | UTF-8 | C++ | false | false | 876 | cpp | type_util.cpp | /*******************************************************
* Copyright (c) 2014, ArrayFire
* All rights reserved.
*
* This file is distributed under 3-clause BSD license.
* The complete license agreement can be obtained at:
* http://arrayfire.com/licenses/BSD-3-Clause
********************************************************/
#include <type_util.hpp>
const char *getName(af_dtype type)
{
switch(type) {
case f32: return "float";
case f64: return "double";
case c32: return "complex float";
case c64: return "complex double";
case u32: return "unsigned int";
case s32: return "int";
case u16: return "unsigned short";
case s16: return "short";
case u64: return "unsigned long long";
case s64: return "long long";
case u8 : return "unsigned char";
case b8 : return "bool";
default : return "unknown type";
}
}
|
34c0bfc8e94cc2e0ac01ef76ae9381a36bf0496b | e16af72bb1f28d6f4ce0a0fe8bb03bea465f6486 | /1.4/Tianyu Zhang_HW_1.4.7/Tianyu Zhang_HW_1.4.7/freqc_in_words.cpp | 2541ea928353c6cc1953c4ec3ffd38ee6455688d | [] | no_license | tianyu-z/CPP_Programming_for_MFE | 1c9c14fa6a6ffa25d50de27c167674b28669bf08 | 4391d288f4d03bee5284105c2b9e9f7285e6fb60 | refs/heads/master | 2020-12-04T00:54:19.221839 | 2020-01-03T09:00:55 | 2020-01-03T09:00:55 | 231,544,880 | 6 | 2 | null | null | null | null | UTF-8 | C++ | false | false | 2,585 | cpp | freqc_in_words.cpp | /*Purpose: Caculate the amount of characters, the amount of words and the amount of
newlines that have been typed, using a while loop.*/
/*Author: Tianyu Zhang*/
/*Date: 04/18/18*/
#include <stdio.h>
#include <string.h>
int main()
{
int num_0 = 0, num_1 = 0, num_2 = 0, num_3 = 0, num_4 = 0, num_others = 0, num_char = 0;/*Initializing varibles.*/
char content;
printf("Please input some characters here. You can tpye Ctrl+Z to exist anytime.\n");
while (((content = getchar()) != EOF) && (content != 26))/*Set the conditions for the program running.*/
{
num_char++;
switch (content)
{/*Set the conditions for counting a word.*/
case '0':
{
num_0++;
break;
}
case '1':
{
num_1++;
break;
}
case '2':
{
num_2++;
break;
}
case '3':
{
num_3++;
break;
}
case '4':
{
num_4++;
break;
}
default:
num_others++;
break;
}
}
switch (num_0)/*Set the print sentence.*/
{
case 0: printf("Number zero appears zero time\n"); break;
case 1: printf("Number zero appears one time\n"); break;
case 2: printf("Number zero appears two times\n"); break;
default: printf("Number zero appears more than two times\n"); break;
}
switch (num_1)
{
case 0: printf("Number one appears zero time\n"); break;
case 1: printf("Number one appears one time\n"); break;
case 2: printf("Number one appears two times\n"); break;
default: printf("Number one appears more than two times\n"); break;
}
switch (num_2)
{
case 0: printf("Number two appears zero time\n"); break;
case 1: printf("Number two appears one time\n"); break;
case 2: printf("Number two appears two times\n"); break;
default: printf("Number two appears more than two times\n"); break;
}
switch (num_3)
{
case 0: printf("Number three appears zero time\n"); break;
case 1: printf("Number three appears one time\n"); break;
case 2: printf("Number three appears two times\n"); break;
default: printf("Number three appears more than two times\n"); break;
}
switch (num_4)
{
case 0: printf("Number four appears zero time\n"); break;
case 1: printf("Number four appears one time\n"); break;
case 2: printf("Number four appears two times\n"); break;
default: printf("Number four appears more than two times\n"); break;
}
switch (num_others)
{
case 0: printf("Other characters appear zero time\n"); break;
case 1: printf("Other characters appear one time\n"); break;
case 2: printf("Other characters appear two times\n"); break;
default: printf("Other characters appear more than two times\n"); break;
}
return 0;
} |
4521374722eece759e94636dbe89e7311a138cbe | afffc76c474fa0f489bfc266ac60410383895193 | /Thuc Hanh/week 8/Project1/NhanVienKyThuat.h | 91104a200d8d8a221824453a0172599b227b9f92 | [] | no_license | dvtrunggg/OOP | 5113f895b6e8c563a34985e25eebc8a9d5fe4d0b | 3209293cce74ae60a62241db13a2e8c1b7f2f50f | refs/heads/main | 2023-02-25T17:37:40.000985 | 2021-02-02T16:08:02 | 2021-02-02T16:08:02 | 333,431,145 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,210 | h | NhanVienKyThuat.h | #pragma once
#include"NhanVien.h"
class NhanVienKyThuat : public NhanVien
{
private:
string chungChiNganh;
int slSangKien;
public:
friend ostream& operator <<(ostream& os, NhanVienKyThuat nvkt);
friend istream& operator >>(istream& is, NhanVienKyThuat& nvkt);
static const char* getFlag();
int checkXuatSac()
{
if (this->slSangKien >= 6)
return 1;
return 0;
}
virtual void Nhap(istream&);
virtual void Xuat(ostream&);
void xuat1();
};
void NhanVienKyThuat::Nhap(istream& is)
{
this->NhanVien::Nhap(is); // goi method class cha
char* buf = new char[MAX];
is.get(buf, MAX, '[');
is.ignore(1);
is.get(buf, MAX, ']');
chungChiNganh.append(buf);
is.get(buf, MAX, '<');
is.ignore(1);
is.get(buf, MAX, '>');
slSangKien = atoi(buf); // chuyen chuoi qua so
is.ignore(1);
delete[] buf;
}
void NhanVienKyThuat::Xuat(ostream& os)
{
os << "nvkt: ";
this->NhanVien::Xuat(os);
os << " [" << chungChiNganh << "] <" << slSangKien << ">" << endl;
}
ostream& operator <<(ostream& os, NhanVienKyThuat nvkt)
{
nvkt.Xuat(os);
return os;
}
istream& operator >>(istream& is, NhanVienKyThuat& nvkt)
{
nvkt.Nhap(is);
return is;
}
const char* NhanVienKyThuat::getFlag()
{
return "nvkt";
}
|
2d964d4908e80c9f1787ccdc09636d3ab1667af3 | 6550126ec9f3310fb7083edb17edb84faac71e9f | /src/M/1/M102_BinaryTreeLevelOrderTraversal.cpp | 537f13e7b2be39e321f84389fdaa7abb67b4dca0 | [] | no_license | d2macster/leetcode-cpp | d9dd988a18f3721141b4a174e44fb4cbffa47e1d | 48caf45921107f5003bf5b766242c11840e5b84c | refs/heads/master | 2021-07-16T20:50:55.500503 | 2018-08-26T22:10:05 | 2018-08-26T22:10:05 | 116,715,207 | 0 | 1 | null | 2019-10-24T17:45:49 | 2018-01-08T18:54:01 | C++ | UTF-8 | C++ | false | false | 885 | cpp | M102_BinaryTreeLevelOrderTraversal.cpp | //
// Created by Andrii Cherniak on 2/14/18.
//
#include <vector>
#include <iostream>
using std::vector;
using std::cout;
using std::endl;
struct TreeNode {
int val;
TreeNode *left;
TreeNode *right;
TreeNode(int x) : val(x), left(NULL), right(NULL) {}
};
class Solution {
public:
vector<vector<int> > levelOrder(TreeNode *root) {
vector<vector<int> > result;
if (!root)
return result;
vector<TreeNode *> l1, l2;
l1.push_back(root);
while (!l1.empty()) {
vector<int> v;
for(TreeNode * p: l1){
v.push_back(p->val);
if (p->left != NULL) l2.push_back(p->left);
if (p->right != NULL) l2.push_back(p->right);
}
result.push_back(v);
l1 = l2;
l2.clear();
}
return result;
}
}; |
6f38b3f14ff3f8f25256663f9d389cc8fe7cc514 | f66f564631e5971978572306023a7641956e3052 | /PhDmed/code/qt-opencv-multithreaded-v1.3.1/ui_MainWindow.h | 7d70d6a7a72d51815191dba83cf1aacbc44027d6 | [] | no_license | sophie-greene/c-CompVis | d777a347f27beaa940eed44ec5f82f6bf6a4bb7b | 48d2a78f5c2471dc9c7442f22bd3d84e739678aa | refs/heads/master | 2020-07-01T17:05:40.798036 | 2016-11-20T12:13:43 | 2016-11-20T12:13:43 | 74,271,732 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 5,198 | h | ui_MainWindow.h | /********************************************************************************
** Form generated from reading UI file 'MainWindow.ui'
**
** Created: Thu May 23 11:55:13 2013
** by: Qt User Interface Compiler version 4.6.2
**
** WARNING! All changes made in this file will be lost when recompiling UI file!
********************************************************************************/
#ifndef UI_MAINWINDOW_H
#define UI_MAINWINDOW_H
#include <QtCore/QVariant>
#include <QtGui/QAction>
#include <QtGui/QApplication>
#include <QtGui/QButtonGroup>
#include <QtGui/QHeaderView>
#include <QtGui/QMainWindow>
#include <QtGui/QMenu>
#include <QtGui/QMenuBar>
#include <QtGui/QStatusBar>
#include <QtGui/QTabWidget>
#include <QtGui/QWidget>
QT_BEGIN_NAMESPACE
class Ui_MainWindow
{
public:
QAction *actionAbout;
QAction *actionExit;
QAction *actionSynchronizeStreams;
QAction *actionScaleToFitFrame;
QWidget *centralWidget;
QTabWidget *tabWidget;
QMenuBar *menuBar;
QMenu *menuFile;
QMenu *menuHelp;
QMenu *menuOptions;
QStatusBar *statusBar;
void setupUi(QMainWindow *MainWindow)
{
if (MainWindow->objectName().isEmpty())
MainWindow->setObjectName(QString::fromUtf8("MainWindow"));
MainWindow->resize(680, 760);
QSizePolicy sizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
sizePolicy.setHorizontalStretch(0);
sizePolicy.setVerticalStretch(0);
sizePolicy.setHeightForWidth(MainWindow->sizePolicy().hasHeightForWidth());
MainWindow->setSizePolicy(sizePolicy);
MainWindow->setMinimumSize(QSize(680, 760));
MainWindow->setMaximumSize(QSize(680, 760));
actionAbout = new QAction(MainWindow);
actionAbout->setObjectName(QString::fromUtf8("actionAbout"));
actionExit = new QAction(MainWindow);
actionExit->setObjectName(QString::fromUtf8("actionExit"));
actionSynchronizeStreams = new QAction(MainWindow);
actionSynchronizeStreams->setObjectName(QString::fromUtf8("actionSynchronizeStreams"));
actionSynchronizeStreams->setCheckable(true);
actionScaleToFitFrame = new QAction(MainWindow);
actionScaleToFitFrame->setObjectName(QString::fromUtf8("actionScaleToFitFrame"));
actionScaleToFitFrame->setCheckable(true);
centralWidget = new QWidget(MainWindow);
centralWidget->setObjectName(QString::fromUtf8("centralWidget"));
tabWidget = new QTabWidget(centralWidget);
tabWidget->setObjectName(QString::fromUtf8("tabWidget"));
tabWidget->setGeometry(QRect(10, 10, 660, 690));
sizePolicy.setHeightForWidth(tabWidget->sizePolicy().hasHeightForWidth());
tabWidget->setSizePolicy(sizePolicy);
tabWidget->setMinimumSize(QSize(660, 690));
tabWidget->setTabsClosable(false);
MainWindow->setCentralWidget(centralWidget);
menuBar = new QMenuBar(MainWindow);
menuBar->setObjectName(QString::fromUtf8("menuBar"));
menuBar->setGeometry(QRect(0, 0, 680, 25));
menuFile = new QMenu(menuBar);
menuFile->setObjectName(QString::fromUtf8("menuFile"));
menuHelp = new QMenu(menuBar);
menuHelp->setObjectName(QString::fromUtf8("menuHelp"));
menuOptions = new QMenu(menuBar);
menuOptions->setObjectName(QString::fromUtf8("menuOptions"));
MainWindow->setMenuBar(menuBar);
statusBar = new QStatusBar(MainWindow);
statusBar->setObjectName(QString::fromUtf8("statusBar"));
MainWindow->setStatusBar(statusBar);
menuBar->addAction(menuFile->menuAction());
menuBar->addAction(menuOptions->menuAction());
menuBar->addAction(menuHelp->menuAction());
menuFile->addAction(actionExit);
menuHelp->addAction(actionAbout);
menuOptions->addAction(actionSynchronizeStreams);
retranslateUi(MainWindow);
tabWidget->setCurrentIndex(-1);
QMetaObject::connectSlotsByName(MainWindow);
} // setupUi
void retranslateUi(QMainWindow *MainWindow)
{
MainWindow->setWindowTitle(QApplication::translate("MainWindow", "qt-opencv-multithreaded", 0, QApplication::UnicodeUTF8));
actionAbout->setText(QApplication::translate("MainWindow", "About", 0, QApplication::UnicodeUTF8));
actionExit->setText(QApplication::translate("MainWindow", "Exit", 0, QApplication::UnicodeUTF8));
actionSynchronizeStreams->setText(QApplication::translate("MainWindow", "Synchronize streams", 0, QApplication::UnicodeUTF8));
actionScaleToFitFrame->setText(QApplication::translate("MainWindow", "Scale to fit frame", 0, QApplication::UnicodeUTF8));
menuFile->setTitle(QApplication::translate("MainWindow", "File", 0, QApplication::UnicodeUTF8));
menuHelp->setTitle(QApplication::translate("MainWindow", "Help", 0, QApplication::UnicodeUTF8));
menuOptions->setTitle(QApplication::translate("MainWindow", "Options", 0, QApplication::UnicodeUTF8));
} // retranslateUi
};
namespace Ui {
class MainWindow: public Ui_MainWindow {};
} // namespace Ui
QT_END_NAMESPACE
#endif // UI_MAINWINDOW_H
|
4f2198eba6d1121afce43fd82f44029f3ca18c83 | df86a9ba025b3af9e78dc09b9536151c3aa80bb2 | /AFW/AFC/04.AFS/inc/FileSystem.hpp | 848c3407a16803c8fc55eb8df34ea2aa9e013d24 | [] | no_license | nightstyles/focp | eefc2da0d2d7b249071a5bad2139cee3b6c5b2f7 | 71ba2c02278874329e4a4a1bf4611524694636de | refs/heads/master | 2021-01-18T20:20:18.531352 | 2014-07-18T05:15:25 | 2014-07-18T05:15:25 | 38,699,174 | 0 | 0 | null | null | null | null | GB18030 | C++ | false | false | 5,337 | hpp | FileSystem.hpp |
#include "AfsDef.hpp"
#ifndef _Afs_FileSystem_Hpp_
#define _Afs_FileSystem_Hpp_
FOCP_BEGIN();
//统一定义Windows和Unix两大主流操作系统中的文件系统。
// 【1】:路径分隔符采用斜线,而非反斜线【兼容反斜线】;去除Windows中的驱动器冒号。 => Unix风格
// 例如,C:\windows\system32\explore.exe => /C/windows\system32\explore.exe
// 【2】:路径名不区分大小写,但保留大小写的显示风格。 => Windows风格
// 【3】:支持路径名中携带空白【头尾空白自动清除】。=> Windows风格
// 【4】:路径名中不能包含:斜线、反斜线、冒号、星号、问号、竖线、大于号、小于号、双引号、分号
enum
{
FOCP_FILEACCESS_EXIST=0,
FOCP_FILEACCESS_READABLE=1,
FOCP_FILEACCESS_WRITABLE=2,
FOCP_FILEACCESS_EXECUTABLE=4,
};
struct AFS_API CPathDetailInfo
{
char* sFilePart;
bool bExist;
};
class CLogManager;
class AFS_API CDiskFileSystem
{
FOCP_FORBID_COPY(CDiskFileSystem);
friend class CFilePathInfo;
friend class CLogManager;
friend struct CSingleInstance<CDiskFileSystem>;
private:
CMutex m_oMutex;
char m_sCurrentDirectory[FOCP_MAX_PATH];
CDiskFileSystem();
public:
~CDiskFileSystem();
static CDiskFileSystem* GetInstance();
static bool CheckFileName(const char* sName);
char GetOsPathSeparator();
const char* GetCurrentDirectory();
bool SetCurrentDirectory(const char* sDirectory);
//获得sAfcPath的全路径,注意需要保证pBuf足够长。
// 解析成功,就返回真,否则返回假
//如果pDetailInfo为空,将会检查sAfcPath自身的词法合法性。
//如果pDetailInfo非空,会调用GetOsPathName检查路径的真实存在性。
// 如果存在:是目录的话,sFilePart返回NULL,不是目录的话,将返回最短文件名。
// 如果不存在:bExist返回false; sFilePart返回不存在的部分.
////////////////////////////////////////
//全路径格式:
// Windows:
// /c
// /c/aa
// CYGWIN_NT:
// /cygdrive/c
// /cygdrive/c/aa
// UNIX:
// /
// /aa
////////////////////////////////////////
bool GetFullPath(const char* sAfcPath, char* pBuf, CPathDetailInfo* pDetailInfo=NULL);
//返回系统设定的临时目录
void GetTmpPath(char* sAfcPath);
//换sAfcFullPath算为Os路径,返回成功与失败
//sAfcFullPath必须是格式正确的AFC路径【必须与GetFullPathName返回的一致】,否则结果不可预测
// 如果pDetailInfo非空,还会检查路径的真实存在性
// 如果存在:是目录的话,sFilePart返回NULL,不是目录的话,将返回最短文件名
// 如果不存在:bExist返回false; sFilePart返回不存在的部分
bool GetOsPathName(char* sAfcFullPath, CPathDetailInfo* pDetailInfo=NULL);
//OsPath to AFC Path
char* GetAfcPathName(char* sOsFullPath);
bool CreateDirectory(const char* sDirectory);
//删除文件或目录,当递归时将删除目录下所有子文件及目录
bool RemovePath(const char* sPathName, bool bRecursive=false);
//修改文件名或目录名。
// 如果旧路径不存在则返回失败。
// 如果新路径不存在,则直接修改。
// 如果新路径存在,新旧路径要么都是目录,要么都是文件。
// 如果路径为文件,则覆盖。
// 如果路径为目录,则必须要求新目录为空。
bool RenamePath(const char* sOldPathName, const char* sNewPathName);
//复制文件或目录。
// 如果旧路径不存在则返回失败。
bool CopyPath(const char* sOldPathName, const char* sNewPathName);
bool AccessPath(const char* sPathName, uint32 nMode, bool &bDirectory);
//搜索文件sFileName【不包含路径】,并把文件名存储在pBuf中。
//如果文件名中不包含前缀或后缀名,可以自动加上在搜索。
bool SearchFile(const char* sEnvVariable, const char* sFileName, char* pBuf, const char* sPrefixName=NULL, const char* sPostfixName=NULL);
bool SearchFileEx(const char* sSearchPathList, const char* sFileName, char* pBuf, char cSeparator, const char* sPrefixName=NULL, const char* sPostfixName=NULL);
void* OpenDirectory(const char* sDirectory);
void CloseDirectory(void* pDirectory);
const char* ReadDirectory(void* pDirectory, bool &bIsDirectory);
void RewindDirectory(void* pDirectory);
private:
bool GetPathSection(const char* &sAfcPath, const char* sEnd, CString &oName, uint32 &nType);
bool RecurseRemoveDirectory(char* sPath, char* sFile);
bool CopyFile(const char* sOldFile, const char* sNewFile);
bool CopyDirectory(char* sOldDirectory, char* sNewDirectory, char* sBuf1, char* sBuf2, bool bExist, bool bForce=false);
bool MoveDirectory(char* sOldDirectory, char* sNewDirectory, bool bExist);
bool GetOsPathNameEx(void* pDir, char* sDirectory, char* sFileName, CPathDetailInfo* pDetailInfo);
};
class AFS_API CFilePathInfo
{
private:
char m_sPath[FOCP_MAX_PATH];
char m_sName[FOCP_MAX_PATH];
char m_sHome[FOCP_MAX_PATH];
char m_sDir[FOCP_MAX_PATH];
public:
CFilePathInfo(const char* sPath=NULL);
static CFilePathInfo* GetInstance();
const char* GetPath();//file full name
const char* GetName();//file name without the suffix
const char* GetDir();//file's directory
const char* GetHome();//the file directory's parent directory, maybe same with GetDir();
};
FOCP_END();
#endif //_Afs_FileSystem_Hpp_
|
fc77d687ace6fb210b7109f07c486fb7846a062c | b491ac8d9de013c9768413c92145fc4cb3530e32 | /StringAdventure/StringAdventure/StringAdventure/Goblin.cpp | dac3496121818677b12b55fb03556b40c68df29f | [] | no_license | RoyKirk/StringAdventure | 0b1890e9e98fcde19cf671b4cf789e2982a36e2c | 5ab05b76e59823921f62f829baafa3700c78d22c | refs/heads/master | 2021-01-11T16:31:46.080280 | 2017-01-26T09:39:00 | 2017-01-26T09:39:00 | 80,101,444 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 296 | cpp | Goblin.cpp | #include "Goblin.h"
Goblin::Goblin()
{
this->CreaturesDescription = "You notice flickers of shadow moving between the trees. Then it stops and you see it is a goblin, it looks at you inqusitively and then darts towards you.";
this->Strength = 10;
this->Speed = 50;
}
Goblin::~Goblin()
{
}
|
bf915502f61b55da87f1278a8418741f3761570d | bb856e8b654413f0b85233de13ad05f2cd907d72 | /colormapScale/colorLineAdjustmentWidget.cpp | b2af6b9d73570d8be7f94f4d7e28f41af4dd3488 | [] | no_license | csania/TexRender | 1c6428b8607b84ac1ec028b28945c63eaa6ea395 | 4ff02fd26ce423ca590f5d5e39c58b020245d480 | refs/heads/master | 2020-12-25T05:53:32.829238 | 2016-07-08T15:22:28 | 2016-07-08T15:22:28 | 62,885,634 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,433 | cpp | colorLineAdjustmentWidget.cpp | #include "colorLineAdjustmentWidget.h"
Vector pointA;
Vector pointB;
Vector adjustCoefs;
ColorLineAdjustmentWidget::ColorLineAdjustmentWidget(QWidget *parent) : QWidget(parent)
{
mousePressed = false;
pointA = Vector(0.25 * width(), 0.75 * height(), 0.0);
pointB = Vector(0.75 * width(), 0.25 * height(), 0.0);
setColorAdjustCoef();
}
void ColorLineAdjustmentWidget::setColorAdjustCoef()
{
adjustCoefs.x = ((height() - pointA.y) / height()) / (pointA.x / width());
adjustCoefs.y = ((pointA.y - pointB.y) / height()) / ((pointB.x - pointA.x) / width());
adjustCoefs.z = (pointB.y / height()) / ((width() - pointB.x) / width());
Vector normalizedPointA = Vector(pointA.x / width(), pointA.y / height(), 0.0);
Vector normalizedPointB = Vector(pointB.x / width(), pointB.y / height(), 0.0);
}
void ColorLineAdjustmentWidget::resetAdjustmentWidget()
{
initialHeight = height();
initialWidth = width();
pointA = Vector(0.25 * width(), 0.75 * height(), 0.0);
pointB = Vector(0.75 * width(), 0.25 * height(), 0.0);
}
void ColorLineAdjustmentWidget::mousePressEvent(QMouseEvent * event)
{
mousePressed = true;
Vector mousePos;
mousePos.x = this->mapFromGlobal(QCursor::pos()).x();
mousePos.y = this->mapFromGlobal(QCursor::pos()).y();
double distToA = sqrt((mousePos.x - pointA.x) * (mousePos.x - pointA.x) + (mousePos.y - pointA.y) * (mousePos.y - pointA.y));
double distToB = sqrt((mousePos.x - pointB.x) * (mousePos.x - pointB.x) + (mousePos.y - pointB.y) * (mousePos.y - pointB.y));
if (distToA < distToB) {
pointA.z = 1.0;
}
else {
pointA.z = 0.0;
}
update();
}
void ColorLineAdjustmentWidget::mouseMoveEvent(QMouseEvent * event)
{
if (mousePressed) {
int mouseXCoord = this->mapFromGlobal(QCursor::pos()).x();
int mouseYCoord = this->mapFromGlobal(QCursor::pos()).y();
if (pointA.z == 1.0) {
if (mouseXCoord < pointB.x && mouseXCoord > 0 && mouseYCoord > 0 && mouseYCoord < height()) {
pointA.x = mouseXCoord;
pointA.y = mouseYCoord;
}
}
else {
if (mouseXCoord > pointA.x && mouseXCoord < width() && mouseYCoord > 0 && mouseYCoord < height()) {
pointB.x = mouseXCoord;
pointB.y = mouseYCoord;
}
}
setColorAdjustCoef();
update();
}
}
void ColorLineAdjustmentWidget::mouseReleaseEvent(QMouseEvent * event)
{
mousePressed = false;
update();
}
void ColorLineAdjustmentWidget::resizeEvent(QResizeEvent * resize)
{
double oldHeight = resize->oldSize().height();
double oldWidth = resize->oldSize().width();
if (oldHeight == -1 && oldWidth == -1) {
resetAdjustmentWidget();
oldHeight = initialHeight;
oldWidth = initialWidth;
}
double heightDif = (double)height() / oldHeight;
double widthDif = (double)width() / oldWidth;
pointA.x = pointA.x * widthDif;
pointA.y = pointA.y * heightDif;
pointB.x = pointB.x * widthDif;
pointB.y = pointB.y * heightDif;
}
void ColorLineAdjustmentWidget::paintEvent(QPaintEvent * event)
{
QPainter painter(this);
painter.setRenderHint(QPainter::RenderHint::HighQualityAntialiasing, true);
QPen pen(Qt::black);
pen.setWidth(2);
painter.setPen(pen);
painter.drawLine(0, height(), width(), 0);
painter.drawLine(0, height(), pointA.x, pointA.y);
painter.drawLine(pointA.x, pointA.y, pointB.x, pointB.y);
painter.drawLine(pointB.x, pointB.y, width(), 0);
painter.drawEllipse(QPoint(pointA.x, pointA.y), 8, 8);
painter.drawEllipse(QPoint(pointB.x, pointB.y), 8, 8);
painter.end();
} |
1fd8c5a2b9a8beed7bce15bd6254a64739bb8ed4 | 7340a56c9974c868f4f60cd0b3542a585c99849b | /examples/tables.cpp | d1efd290e67025d2da1a332686d13718190307e0 | [
"BSD-3-Clause"
] | permissive | vv3g/luwra | 1e222095e68b5ccc6c38ae9785019f9ea921161d | 75d689f2644be784f9e8e068b16810a1002a2f02 | refs/heads/master | 2020-07-21T07:52:35.698010 | 2018-06-11T18:01:22 | 2018-06-11T18:01:22 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 296 | cpp | tables.cpp | #include <luwra.hpp>
#include <string>
#include <iostream>
using namespace luwra;
int main() {
StateWrapper state;
state["t1"] = MemberMap {};
for (int i = 0; i < 10000; i++) {
state["t1"]["value"] = i;
int j = state["t1"]["value"];
if (j != i) {
return 1;
}
}
return 0;
}
|
35fa69072de2761f526e7d5a0396f4796e48fa00 | d223bb076fb0b28c79e92756eb6d42177cbbb614 | /DirectX2DFrameWork/ObjMgr.cpp | 5aed012c2e606c3b9be492750bcdfdecf3df9084 | [] | no_license | Sonolil/Zero-MegamanX4- | 7b7c8c702a97722929599786464c7a872434d3d6 | 5be3e1bb38565c1cdb50ae8f70b0c0a175cafd67 | refs/heads/master | 2020-03-11T22:37:15.736371 | 2018-10-05T00:12:58 | 2018-10-05T00:12:58 | null | 0 | 0 | null | null | null | null | UHC | C++ | false | false | 2,584 | cpp | ObjMgr.cpp | #include "stdafx.h"
#include "ObjMgr.h"
#include "ObjProto.h"
#include "Tile.h"
CObjMgr::CObjMgr()
{
}
CObjMgr::~CObjMgr()
{
this->Release();
}
const INFO* CObjMgr::GetInfo(const TCHAR* pObject, const int& iCnt)
{
map<const TCHAR*, list<CObj*>>::iterator iter = m_MapObject.find(pObject);
if (iter == m_MapObject.end())
return NULL;
list<CObj*>::iterator iteri = iter->second.begin();
for (int i = 0; i < iCnt; ++i)
++iteri;
return (*iteri)->GetInfo();
}
CObj* CObjMgr::GetObj(const TCHAR * pObject, const int & iCnt)
{
map<const TCHAR*, list<CObj*>>::iterator iter = m_MapObject.find(pObject);
if (iter == m_MapObject.end())
return NULL;
list<CObj*>::iterator iteri = iter->second.begin();
for (int i = 0; i < iCnt; ++i)
++iteri;
return (*iteri);
}
const vector<TILE*>* CObjMgr::GetTileInfo()
{
map<const TCHAR*, list<CObj*>>::iterator iter = m_MapObject.find(L"StageTile");
if (iter == m_MapObject.end())
{
ERR_MSG(g_hWnd, L"find(StageTile) Failed !");
return NULL;
}
return ((CTile*)(iter->second.front()))->GetTileInfo();
}
HRESULT CObjMgr::AddObject(CPrototype* pProto, const TCHAR* pObject)
{
map<const TCHAR*, list<CObj*>>::iterator iter = m_MapObject.find(pObject);
CObj* pProtoInst = ((CObjProto*)pProto)->GetProto(pObject);
if (pProtoInst == NULL)
return E_FAIL;
CObj* pObj = pProtoInst->Clone();
pObj->Initialize();
if (iter == m_MapObject.end()) //키값을 못찾았다면
{
list<CObj*> ObjList;
ObjList.push_back(pObj);
m_MapObject.insert(make_pair(pObject, ObjList));
}
else //키값이 이미 있었다면
{
iter->second.push_back(pObj);
}
return S_OK;
}
E_SCENE CObjMgr::Progress()
{
for (map<const TCHAR*, list<CObj*>>::iterator iter = m_MapObject.begin();
iter != m_MapObject.end(); ++iter)
{
for (list<CObj*>::iterator iteri = iter->second.begin();
iteri != iter->second.end(); ++iteri)
{
E_SCENE SceneID = (*iteri)->Progress();
if (SceneID >= 0)
return SceneID;
GET_SINGLE(CSortMgr)->AddSortObject(*iteri);
}
}
return E_SCENE_NONPASS;
}
void CObjMgr::Render()
{
GET_SINGLE(CSortMgr)->RenderObject();
}
void CObjMgr::Release()
{
for (map<const TCHAR*, list<CObj*>>::iterator iter = m_MapObject.begin();
iter != m_MapObject.end(); ++iter)
{
for (list<CObj*>::iterator iteri = iter->second.begin();
iteri != iter->second.end(); ++iteri)
{
SAFE_DELETE(*iteri);
}
iter->second.clear();
}
m_MapObject.clear();
} |
9095a0c550d178b874616056b4c4f0d77562f338 | 0dbc9413fe8dd4708bed140a802fb8b31e7921d0 | /Apps/mDNSMonitor/src/main.cpp | c7ba5477c1bf9bf5961ec38daad7ec2352284b0d | [] | no_license | vkichline/M5Sys | 4d852c1e6b612f793aadb1523fd7151feed84561 | b4375edb0b4840ddc0a2497eea9ae43bb0f6b946 | refs/heads/master | 2022-11-21T10:31:36.071172 | 2020-07-26T20:37:32 | 2020-07-26T20:37:32 | 275,669,892 | 5 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,287 | cpp | main.cpp | #include <M5Sys.h>
#include <WiFi.h>
#include <ESPmDNS.h>
#define CONNECTION_DELAY 100
#define POLLING_DELAY 1000
M5Sys m5sys;
const char* services[] = { "http", "arduino", "workstation", "smb", "afpovertcp", "ftp", "ipp", "printer" };
int num_services = sizeof(services) / sizeof(char*);
int curr_service = 0;
bool responder_started = false;
long last_poll = 0;
std::vector<String> itemVector;
void browseService(const char* service, const char* protocol){
VERBOSE("browseService(%s, %s)\n", service, protocol);
ez.header.title(String("Browsing service: ") + service);
DEBUG("Browsing for service _%s._%s.local.\n", service, protocol);
int n = MDNS.queryService(service, protocol);
if(n == 0) {
DEBUG("no %s/%s services found\n", service, protocol);
}
else {
for (int i = 0; i < n; ++i) {
INFO("%s: \"%s\" %s:%d\n", service, MDNS.hostname(i).c_str(), MDNS.IP(i).toString().c_str(), MDNS.port(i));
// Item will be int the form: full data | display data
String item(service);
item.concat(", ");
item.concat(MDNS.hostname(i));
item.concat(", ");
item.concat(MDNS.IP(i).toString());
item.concat(':');
item.concat(MDNS.port(i));
if(std::find(itemVector.begin(), itemVector.end(), item) == itemVector.end()) {
itemVector.push_back(item);
//ez.canvas.println(item);
ez.canvas.print(service);
ez.canvas.x(104);
ez.canvas.println(MDNS.hostname(i));
ez.canvas.x(104);
ez.canvas.print(MDNS.IP(i).toString());
ez.canvas.print(':');
ez.canvas.println(MDNS.port(i));
}
}
}
}
// Called every 100 mS until the network is connected.
// When connected, remove menu item #1
// If the mDNS browser fails to immediately start, add a new error menu item.
//
uint16_t connect_event() {
//VERBOSE("network_connect_event()\n"); happens too much to log
if(WiFi.status() == WL_CONNECTED) {
DEBUG("Connected to network %s, ip = %s\n", WiFi.SSID().c_str(), WiFi.localIP().toString().c_str());
ez.canvas.println("Connected\n");
if (MDNS.begin("ESP32_Browser")) {
DEBUG("Responder started\n");
responder_started = true;
}
else {
ERROR("Error setting up MDNS responder\n");
ez.canvas.println("Failed to start mDNS responder");
}
return 0; // never call back
}
return CONNECTION_DELAY; // call back in 100 mS
}
// Called once a second.
// Cycle through the services and add menu items representing unique onces.
//
uint16_t polling_event() {
if(!last_poll) {
// if the global last_poll is uninitialized, set it to 'now'
last_poll = millis();
}
else {
if(millis() < last_poll + POLLING_DELAY) {
DEBUG("why was the event called so fast?\n"); // HACKHACK
return POLLING_DELAY;
}
last_poll = millis();
}
if(responder_started) {
const char* svc = services[curr_service++];
DEBUG("selecting service #%d: %s\n", curr_service, svc);
if(curr_service >= num_services) curr_service = 0;
browseService(svc, "tcp");
}
else {
VERBOSE("Responder not yet started\n");
}
return POLLING_DELAY;
}
void setup() { m5sys.begin("mDNSMonitor", NETWORK_CONNECTION_UI); }
void loop() {
VERBOSE("loop()\n");
ez.header.show("mDNS Monitor");
ez.canvas.scroll(true);
ez.canvas.lmargin(8);
ez.canvas.font(&FreeSans9pt7b);
ez.buttons.show("up # Home # Stop ## down #");
ez.canvas.println("Connecting to network");
ez.addEvent(connect_event);
ez.addEvent(polling_event, 10);
while(true) {
String result = ez.buttons.wait();
INFO("User selected %s\n", result.c_str());
if(0 == result.compareTo("Home")) m5sys.goHome();
else if(0 == result.compareTo("Stop")) {
ez.header.title("Browsing Paused...");
ez.buttons.show("up # Home # Start ## down #");
ez.removeEvent(connect_event);
ez.removeEvent(polling_event);
}
else if(0 == result.compareTo("Start")) {
ez.buttons.show("up # Home # Stop ## down #");
ez.addEvent(connect_event);
ez.addEvent(polling_event, 10);
}
else if(0 == result.compareTo("up") || 0 == result.compareTo("down")) {
ez.canvas.loop();
}
}
}
|
8b21e14d8056e649484ec97780c511d88004950f | e2ab74d312894138c9d52b65b758d755894040b9 | /ku/268/homework/hw4/bsTree.h | 22be38f7e515e961cf1a7cc29b4914d2170b985a | [] | no_license | ccharp/School | 131ca7d1f06fbec06e6391a192545acbac0cda2a | e39178a35bc383d4558073569e47d251cc6c69dd | refs/heads/master | 2021-09-25T13:42:14.529424 | 2018-10-22T18:20:42 | 2018-10-22T18:20:42 | 8,569,065 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,311 | h | bsTree.h | #ifndef BSTREE_H //prevents recompilation error
#define BSTREE_H
#include "TNode.h"
#include <iostream>
using namespace std;
template <typename T>
class bsTree
{
private:
int size;
TNode<T> * root;
void insert(TNode<T> *node, T value); //cleates and places new node
void inOrderTraversal(TNode<T> *t, ofstream &fout); //outputs tree's values in order
void removeLink(TNode<T> *p1, TNode<T> *p2, TNode<T> *p3); //swaps values and deletes node
void getSmallest(TNode<T> *cN, TNode<T> *sN, TNode<T> *realcN); //finds smallest node
void getBiggest(TNode<T> *cN, TNode<T> *bN, TNode<T> *realcN); //finds largest node
TNode<T>* search(TNode<T> *node, T value); //finds pointer to node containing 'value'
public:
bsTree(); //constructor
void remove(const T & item); //calls remove function.
//All of the following functions correspond to an overloaded private function of the same name.
// Necessary because private variable, root, cannot be accessed from the client.
void insert(T value){insert(root, value);};
void inOrderTraversal(ofstream &fout){
inOrderTraversal(root, fout); fout << endl;
};
void search(T value, ofstream &fout){
fout << search(root, value) << endl;
};
};
#include "bsTree.cpp" //must include for template
#endif
|
e4ce2316fa197954a0f0589a0b2a86fdadca8fc2 | 85bcac5d7883f439fd040b10b8d3ce258dd7ade4 | /Core/RasterizerState.h | 315440f3ae69ba6742422bf1866388cc70cd32f1 | [
"MIT"
] | permissive | newpolaris/Mikudayo | f9effd73467065f98c20efce398ed0782901bb7f | f989697848bee0f2a45636758050620b2421e77a | refs/heads/master | 2023-02-03T10:59:39.513123 | 2020-12-23T08:36:04 | 2020-12-23T08:36:04 | 104,229,577 | 18 | 1 | MIT | 2019-02-18T16:20:26 | 2017-09-20T14:55:50 | C | UTF-8 | C++ | false | false | 460 | h | RasterizerState.h | #pragma once
class RasterizerDesc
{
public:
RasterizerDesc() : Desc(D3D11_DEFAULT)
{
}
CD3D11_RASTERIZER_DESC Desc;
};
class RasterizerState
{
public:
static std::shared_ptr<RasterizerState> Create(const RasterizerDesc& desc);
static void DestroyAll();
void Bind( ID3D11DeviceContext* pContext );
private:
RasterizerState();
void GetState( const CD3D11_RASTERIZER_DESC& desc );
UINT m_StencilRef;
ID3D11RasterizerState* m_RasterizerState;
};
|
55520d70c28f7c007c66e7ca73828adabcde6e97 | d967920b91f4046914cce950d7aaf2f3fcc672fb | /src/osdep/native/nativethread.h | dc83502c884b952d7d98925a8960d9e9e10aba3d | [
"Apache-2.0"
] | permissive | lawarner/aft | 57cc3b4ca2024c3ae445c1813c1f3dcaf7460327 | fd2b6b97bedd2be3ccb1739b890aeea6aa2f9603 | refs/heads/master | 2020-04-12T02:28:46.527298 | 2017-12-31T23:03:09 | 2017-12-31T23:03:09 | 42,785,574 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,688 | h | nativethread.h | #pragma once
/*
* Copyright 2016 Andy Warner
*
* 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 "base/thread.h"
namespace aft
{
namespace osdep
{
// Forward reference
class NativeThreadImpl;
/**
* Thread handler implemented using native threads (std::thread).
* @copydoc aft::base::ThreadHandler
*/
class NativeThreadHandler : public aft::base::ThreadHandler
{
public:
/** Construct a NativeThreadHandler.
* @param tObject object that will be run in the thread
* @param context context used to run the object
*/
NativeThreadHandler(aft::base::TObject* tObject, aft::base::Context* context = 0);
/** Destruct a NativeThreadHandler */
virtual ~NativeThreadHandler();
virtual base::Result getResult();
virtual base::TObject::State getState();
virtual base::TObject* getTObject() const;
virtual void notify(base::Callback* callback);
virtual bool unnotify(base::Callback* callback);
virtual void stop(bool force);
virtual base::Result wait();
virtual void run();
private:
NativeThreadImpl& impl_;
aft::base::Result result_;
};
} // namespace osdep
} // namespace aft
|
48e77b0e526016f414e8dfbad32dccadd7eb8714 | 942772dc9c56829b3b7417183b28fd9e66830f4c | /triangle.h | 1b695b2afbeb29313830bd0a776402fa8ded1e73 | [] | no_license | kgmostafa/1 | cddbfe171b6575cf087b31964dd787d7d79db25b | 48f012781d2cf3ed088e9e5149c689eb7567fc0f | refs/heads/master | 2020-05-01T01:08:15.258483 | 2018-03-22T02:31:43 | 2018-03-22T02:31:43 | 177,188,012 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,085 | h | triangle.h | #ifndef TRIANGLE_H
#define TRIANGLE_H
#include <glm/vec3.hpp>
#include <QString>
#include "vertex.h"
class Triangle
{
public:
Triangle();
Triangle(glm::vec3 v1, glm::vec3 v2, glm::vec3 v3);
Triangle(Vertex v1, Vertex v2, Vertex v3);
Triangle(Vertex normal, Vertex v1, Vertex v2, Vertex v3);
void scale(float x, float y, float z);
void translate(float x, float y, float z);
void rotateX(float angle);
void rotateY(float angle);
void rotateZ(float angle);
void rotate(float angle, glm::vec3 normal);
void switchNormal();
void set(Vertex v1, Vertex v2, Vertex v3);
glm::vec3 getNormal();
glm::vec3 getV1();
glm::vec3 getV2();
glm::vec3 getV3();
glm::vec3 getMin();
glm::vec3 getMax();
float getMinX();
float getMaxX();
float getMinY();
float getMaxY();
float getMinZ();
float getMaxZ();
QString toString();
private:
void calculateMinMax();
glm::vec3 _normal;
glm::vec3 _vec[3];
glm::vec3 _min;
glm::vec3 _max;
bool _normalSet;
};
#endif // TRIANGLE_H
|
7c4fadbfc704914ce4eaeecb9610a1fadc07fe53 | f204ea0615f97d6e33bed78f1317f3fb74e39278 | /AppServer/src/exception/IncorrectPasswordException.h | 425e639cf8c83d6c58db338643bc49a7bfd4dce3 | [] | no_license | sivoridaniel/serverapp | bedfc274fdb49772a3aa51e145153949528e7642 | 84be76f8b3b42dc13fd277eba50afd80f5a65861 | refs/heads/master | 2020-12-31T01:36:06.525547 | 2016-07-06T00:44:30 | 2016-07-06T00:44:30 | 53,750,209 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 420 | h | IncorrectPasswordException.h | /*
* IncorrectPasswordException.h
*
* Created on: 24 de abr. de 2016
* Author: pablo
*/
#ifndef SRC_EXCEPTION_INCORRECTPASSWORDEXCEPTION_H_
#define SRC_EXCEPTION_INCORRECTPASSWORDEXCEPTION_H_
class IncorrectPasswordException: public std::exception
{
public:
virtual const char* what() const throw ()
{
return "El password es incorrecto.";
}
};
#endif /* SRC_EXCEPTION_INCORRECTPASSWORDEXCEPTION_H_ */
|
1e28d33beedf56249080e74615194be0f071d746 | 69173e8c7b0d7ca8aee00c38ff847f658dc157d4 | /ex_parcial_1/src/read_file.cpp | 961ca3ba109eea9276d9d02650dd7c00f2df8ca0 | [] | no_license | miguel100398/A01633021_robotica_movil | 8884be9e007158049105b3e0fc9c97e4633eea6e | 59b58f3c11fca9bb04dab5c67e2f25ac9138f578 | refs/heads/master | 2023-04-08T04:47:15.267792 | 2021-04-13T05:05:56 | 2021-04-13T05:05:56 | 293,958,395 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,180 | cpp | read_file.cpp | #ifndef READ_FILE_CPP
#define READ_FILE_CPP
#include "../includes/read_file.hpp"
bool read_file(std::string file_name, double *coord, int size){
std::string tmp_data;
int idx = 0;
std::ifstream rd_file(file_name);
//check if file is open
if (!rd_file.is_open()){
std::cout << "Error, can´t open file to read array: " << file_name << "\n";
return false;
}
//read file
while ( getline (rd_file, tmp_data)){
coord[idx++] = std::stod(tmp_data);
if (idx > size){
std::cout <<"Error, File is greater than ARR_SIZE:" << std::to_string(size) << "\n";
return false;
}
}
return true;
}
bool write_file(std::string file_name, double *array_to_write, int size){
std::ofstream wr_file(file_name);
//Check if file is open
if (!wr_file.is_open()){
std::cout << "Error, can´t open file to write array: " <<file_name<< "\n";
return false;
}
//Write arrray to file
for (int idx=0; idx<size; idx++){
wr_file << std::setprecision(PRINT_PRECISION) << array_to_write[idx] << "\n";
}
return true;
}
#endif //READ_FILE_CPP |
ff3f69994f1cfeb2f94b00ae2cd5d8a39316de96 | 3c069491ee0fd844f65abff525902cb9f8b95544 | /examples/demo_computed/computedmain.cpp | a00062984f13531580e19a7621a781ee385cc14d | [] | no_license | 3dcl/osghimmel | 5a8f20dc8be8d7e609703baf9cce2ebfcc6cabfc | 4d51e954d1f94a7ea7599ce12fdca5f44d0f2bf3 | refs/heads/master | 2021-01-25T07:11:47.935307 | 2015-01-16T10:23:37 | 2015-01-16T10:23:37 | 23,115,750 | 1 | 0 | null | 2015-01-16T10:23:37 | 2014-08-19T15:40:11 | C++ | ISO-8859-3 | C++ | false | false | 8,388 | cpp | computedmain.cpp |
// Copyright (c) 2011-2012, Daniel Müller <dm@g4t3.de>
// Computer Graphics Systems Group at the Hasso-Plattner-Institute, Germany
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
// * Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of the Computer Graphics Systems Group at the
// Hasso-Plattner-Institute (HPI), Germany nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
#include "osgHimmel/abstractastronomy.h"
#include "osgHimmel/himmel.h"
#include "osgHimmel/timef.h"
#include "osgHimmel/himmelenvmap.h"
#include <osgDB/ReadFile>
#include <osgViewer/Viewer>
#include <osgViewer/ViewerEventHandlers>
#include <osgGA/TrackballManipulator>
#include <osgGA/FlightManipulator>
#include <osgGA/DriveManipulator>
#include <osgGA/KeySwitchMatrixManipulator>
#include <osgGA/StateSetManipulator>
#include <osgGA/TerrainManipulator>
#include <iostream>
#include <assert.h>
#include <osg/Matrix>
#include <osg/MatrixTransform>
#include <osg/TextureCubeMap>
#include <osg/Texture2D>
using namespace osgHimmel;
TimeF *g_timef = NULL;
osg::ref_ptr<Himmel> g_himmel = NULL;
const float g_fovBackup = 60.f;
float g_fov = g_fovBackup;
osgViewer::View *g_view = NULL;
void initializeManipulators(osgViewer::View &view)
{
osg::ref_ptr<osgGA::KeySwitchMatrixManipulator> keyswitchManipulator = new osgGA::KeySwitchMatrixManipulator;
keyswitchManipulator->addMatrixManipulator('1', "Terrain", new osgGA::TerrainManipulator());
keyswitchManipulator->addMatrixManipulator('2', "Trackball", new osgGA::TrackballManipulator());
keyswitchManipulator->addMatrixManipulator('3', "Flight", new osgGA::FlightManipulator());
keyswitchManipulator->addMatrixManipulator('4', "Drive", new osgGA::DriveManipulator());
view.setCameraManipulator(keyswitchManipulator);
}
void fovChanged()
{
const double aspectRatio(g_view->getCamera()->getViewport()->aspectRatio());
g_view->getCamera()->setProjectionMatrixAsPerspective(g_fov, aspectRatio, 0.1f, 8.0f);
}
class KeyboardEventHandler : public osgGA::GUIEventHandler
{
public:
KeyboardEventHandler()
{
}
virtual bool handle(
const osgGA::GUIEventAdapter &ea
, osgGA::GUIActionAdapter &)
{
switch(ea.getEventType())
{
case(osgGA::GUIEventAdapter::FRAME):
g_timef->update();
break;
case(osgGA::GUIEventAdapter::KEYDOWN):
{
if(ea.getKey() == 'r' || ea.getKey() == 'R')
{
g_timef->reset();
g_timef->setSecondsPerCycle(60.f);
}
else if(ea.getKey() == 'p' || ea.getKey() == 'P')
{
if(g_timef->isRunning())
g_timef->pause();
else
g_timef->start();
}
else if(ea.getKey() == '-')
{
g_timef->setSecondsPerCycle(g_timef->getSecondsPerCycle() * 1.08f);
}
else if(ea.getKey() == '+')
{
if(g_timef->getSecondsPerCycle() * 0.96 > 0.001f)
g_timef->setSecondsPerCycle(g_timef->getSecondsPerCycle() * 0.92f);
}
}
break;
case(osgGA::GUIEventAdapter::SCROLL):
{
const float f = 1.00f
+ (ea.getScrollingMotion() == osgGA::GUIEventAdapter::SCROLL_DOWN ? -0.08f : +0.08f);
if(g_fov * f >= 1.f && g_fov * f <= 179.f)
g_fov *= f;
fovChanged();
return true;
}
break;
case(osgGA::GUIEventAdapter::RELEASE):
if(ea.getButton() == osgGA::GUIEventAdapter::MIDDLE_MOUSE_BUTTON
&& (ea.getModKeyMask() & osgGA::GUIEventAdapter::MODKEY_CTRL) != 0)
{
g_fov = g_fovBackup;
fovChanged();
return true;
}
break;
default:
break;
};
return false;
}
};
osg::Group *createScene(
osg::Node *scene
, osg::Node *reflector)
{
const unsigned int unit = 0;
HimmelEnvMap *envMap = new HimmelEnvMap(512);
envMap->addChild(scene);
osg::Group *group = new osg::Group();
group->addChild(envMap);
osg::StateSet* stateset = reflector->getOrCreateStateSet();
stateset->setTextureAttributeAndModes(unit, envMap->cubeMap(), osg::StateAttribute::ON);
stateset->setTextureMode(unit, GL_TEXTURE_GEN_S, osg::StateAttribute::ON);
stateset->setTextureMode(unit, GL_TEXTURE_GEN_T, osg::StateAttribute::ON);
stateset->setTextureMode(unit, GL_TEXTURE_GEN_R, osg::StateAttribute::ON);
stateset->setTextureMode(unit, GL_TEXTURE_GEN_Q, osg::StateAttribute::ON);
return group;
}
int main(int argc, char* argv[])
{
osg::ArgumentParser arguments(&argc, argv);
arguments.getApplicationUsage()->setDescription(
arguments.getApplicationName() + " demonstrates the procedural sky of osgHimmel");
arguments.getApplicationUsage()->setCommandLineUsage(arguments.getApplicationName());
arguments.getApplicationUsage()->addCommandLineOption("-h or --help", "Display this information.");
osgViewer::Viewer viewer(arguments);
if(arguments.read("-h") || arguments.read("--help"))
{
arguments.getApplicationUsage()->write(std::cout);
return 1;
}
osg::notify(osg::NOTICE) << "Use [1] to [4] to select camera manipulator." << std::endl;
osg::notify(osg::NOTICE) << "Use [p] to pause/unpause time." << std::endl;
osg::notify(osg::NOTICE) << "Use [r] to reset the time." << std::endl;
osg::notify(osg::NOTICE) << "Use [+] and [-] to increase/decrease seconds per cycle." << std::endl;
osg::notify(osg::NOTICE) << "Use [mouse wheel] to change field of view." << std::endl;
const unsigned int resx = 1280;
const unsigned int resy = 720;
g_view = dynamic_cast<osgViewer::View*>(&viewer);
viewer.setUpViewInWindow(128, 128, resx, resy);
viewer.addEventHandler(new KeyboardEventHandler);
initializeManipulators(viewer);
fovChanged();
osg::ref_ptr<osg::Group> root = new osg::Group();
g_view->setSceneData(root.get());
g_himmel = Himmel::createWithoutClouds();
g_timef = new TimeF(time(NULL), - 3600.0L * 2.0L, 3600.0L);
g_timef->start();
g_himmel->assignTime(g_timef);
g_himmel->setCameraHint(g_view->getCamera());
g_himmel->setViewSizeHint(resx, resy);
g_himmel->setAltitude(0.043);
g_himmel->setLatitude(52.5491);
g_himmel->setLongitude(13.3611);
root->addChild(g_himmel);
return viewer.run();
} |
f8fc84b9c32e13cd7c74a91458e90f6179cc5b17 | 1da13017336f9461a34208f57686849f69c28384 | /Memento/include/memento.h | 29d81c1717f0b16aa90026881cbd4bdf320f02df | [
"Apache-2.0"
] | permissive | NEWPLAN/design_pattern | 65b1614aa61166611d999113e6df9d0ad042860b | 07e332cc80008e9f1c263b53a94359b2c5884651 | refs/heads/master | 2020-03-31T02:36:47.963813 | 2018-12-13T07:26:05 | 2018-12-13T07:26:05 | 151,832,536 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 279 | h | memento.h | #ifndef __MEMENTO_H__
#define __MEMENTO_H__
class Memento
{
public:
Memento(int vitality, int attack, int defense);
Memento &operator=(const Memento &memento);
public:
//property
int m_vitality; //vitality
int m_attack; //attack
int m_defense; //defense
};
#endif |
9e59ae4020b2201b22ee6571ae8bfc2240dfb384 | 139fea6377fab0a20b04b0313eabd4cb29b45b43 | /Patents.cpp | 0985d02c24a69840679ea3590b94e5ee529cc890 | [] | no_license | ehcrook/Letter-Tycoon | 1c4aeb21cca83568a644157f91ca00a93171b932 | 91c761333eaafe6fca9fb3570d2990f4363ddcbd | refs/heads/master | 2020-03-19T00:13:55.030942 | 2018-06-07T03:36:24 | 2018-06-07T03:36:24 | 135,464,474 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,202 | cpp | Patents.cpp | //
// Patents.cpp
// Letter Tycoon C++
//
// Created by Stuart Crook on 5/20/18.
// Copyright © 2018 Stuart Crook. All rights reserved.
//
#include <iostream>
#include <fstream>
#include <set>
#include <map>
#include <vector>
#include <string>
#include "Patent.h"
#include "Player.h"
#include "Patents.h"
using namespace std;
void Patents::load(string filename) {
ifstream file(filename);
char letter = '0';
int price = 0;
int freq = 0;
while(file >> letter >> price >> freq)
{
Card card(letter, price);
Patent patent(card);
patents[patent] = nobody;
}
}
void Patents::output(iostream out) {
map<Patent, Player*>::iterator itr = patents.begin();
for(; itr != patents.end(); itr++) {
out << (itr->first).getLetter() << " is owned by " << (itr->second)->getName() << endl;
}
}
Player Patents::getPatentHolder(char c) {
map<Patent, Player*>::iterator itr = patents.begin();
for(; itr != patents.end(); itr++) {
if(itr->first.getLetter() == c) return *itr->second;
}
Player nobody("nobody");
return nobody;
}
bool Patents::isPatentHolder(Player& p, char c) {
Player holder = getPatentHolder(c);
return p.getName()==holder.getName();
}
vector<Patent> Patents::getAvailable() {
map<Patent, Player*>::iterator itr = patents.begin();
vector<Patent> available;
for(; itr != patents.end(); itr++) {
#ifdef _DEBUG
cout << itr->first.letter << " is owned by " << (itr->second)->getName() << endl;
#endif
if(itr->second==nobody) available.push_back(itr->first);
}
return available;
}
void Patents::buyPatent(Player& player, Patent& patent) {
cout << "Player wants to buy " << patent.getLetter() << endl;
map<Patent, Player*>::iterator itr = patents.begin();
for(; itr != patents.end(); itr++) {
if((itr->first==patent)) {
if (itr->second==nobody) {
patents[itr->first] = &player;
player.remove_money(itr->first.getPrice());
player.add_patents(itr->first);
return;
}
}
}
throw patent.getLetter();
}
vector<Patent> Patents::getPatents(Player& player) {
vector<Patent> playerPatents;
map<Patent, Player*>::iterator itr = patents.begin();
for(; itr != patents.end(); itr++) {
if ((itr->second)->getName()==player.getName()) playerPatents.push_back(itr->first);
}
return playerPatents;
}
vector<Patent> Patents::getBuyable(string word, int money) {
vector<Patent> buyable;
for (int i = 0; i<word.size(); i++) {
char letter = word[i];
Player owner = getPatentHolder(letter);
Patent patent = getPatent(letter);
if(owner.getName()==nobody->getName() && money >= patent.getPrice()) buyable.push_back(patent);
}
return buyable;
}
Patent Patents::getPatent(char c) {
map<Patent, Player*>::iterator itr = patents.begin();
for(; itr != patents.end(); itr++) {
if(itr->first.getLetter() == c) return itr->first;
}
throw "No Patent exists for letter";
}
|
886c382efaf5837a48e64d7db801832bc847f0d4 | e17143acf0204d8a8b8e6e8f61893b9fc18e9d34 | /src/ThumbnailVariableCreator.cpp | 57b5abed7aa9db78e064a4d17c1a7baa017f5fb8 | [
"Zlib"
] | permissive | nullpointer2017/mod_uploader | 2b8654c847bfa87c7664828deb1c6bde02a9eecc | 31632a29138b18b7adbf533416a0ec660f1b07ac | refs/heads/master | 2022-07-26T15:25:00.829263 | 2022-06-27T00:42:39 | 2022-06-27T00:42:39 | 110,597,596 | 0 | 0 | null | 2017-11-13T20:21:31 | 2017-11-13T20:21:31 | null | UTF-8 | C++ | false | false | 7,560 | cpp | ThumbnailVariableCreator.cpp | /******************************************************************************
* Copyright (C) 2007 Tetsuya Kimata <kimata@acapulco.dyndns.org>
*
* All rights reserved.
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any
* damages arising from the use of this software.
*
* Permission is granted to anyone to use this software for any
* purpose, including commercial applications, and to alter it and
* redistribute it freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you must
* not claim that you wrote the original software. If you use this
* software in a product, an acknowledgment in the product
* documentation would be appreciated but is not required.
*
* 2. Altered source versions must be plainly marked as such, and must
* not be misrepresented as being the original software.
*
* 3. This notice may not be removed or altered from any source
* distribution.
*
* $Id: ThumbnailVariableCreator.cpp 2874 2008-04-27 14:38:46Z svn $
*****************************************************************************/
#include "Environment.h"
#include "ThumbnailVariableCreator.h"
#include "ThumbnailIterator.h"
#include "Auxiliary.h"
#include "Macro.h"
#include "SourceInfo.h"
SOURCE_INFO_ADD("$Id: ThumbnailVariableCreator.cpp 2874 2008-04-27 14:38:46Z svn $");
/******************************************************************************
* public メソッド
*****************************************************************************/
ThumbnailVariableCreator::ThumbnailVariableCreator(const char **keys)
: keys_(keys)
{
init();
}
TemplateVariable::variable_t *
ThumbnailVariableCreator::create(apr_pool_t *pool,
ThumbnailIterator *thumbnail_iter) const
{
void *memory;
variable_t *thumbnail_array_memory;
scalar_t *thumbnail_memory;
variable_t *var;
// メモリを一気に確保
APR_PALLOC(memory, void *, pool,
PAD_DIV(sizeof(variable_t) +
get_thumbnail_array_memory_size(thumbnail_iter->size()),
sizeof(variable_t)) * sizeof(variable_t) +
(get_thumbnail_memory_size() * thumbnail_iter->size()));
thumbnail_array_memory = AS_VARIABLE(memory);
thumbnail_memory
= AS_SCALAR(thumbnail_array_memory +
PAD_DIV(sizeof(variable_t) +
get_thumbnail_array_memory_size(thumbnail_iter->size()),
sizeof(variable_t)));
var = thumbnail_array_memory++;
var->type = TemplateVariable::ARRAY;
var->v = thumbnail_array_memory;
for (apr_size_t i = 0; i < thumbnail_iter->size(); i++) {
create_thumbnail(pool, thumbnail_iter->get(), thumbnail_array_memory++, thumbnail_memory);
thumbnail_memory += thumbnail_index_max_ + 1; // +1 でインデックスから個数に変換
thumbnail_iter->next();
}
thumbnail_array_memory->type = TemplateVariable::END;
return var;
}
ThumbnailVariableCreator *ThumbnailVariableCreator::get_instance(void *memory,
const char **keys)
{
new(memory) ThumbnailVariableCreator(keys);
return reinterpret_cast<ThumbnailVariableCreator *>(memory);
}
/******************************************************************************
* private メソッド
*****************************************************************************/
void ThumbnailVariableCreator::init()
{
thumbnail_index_max_ = TemplateVariableCreator::calc_index
(keys_, AS_KEY_INDEX(&thumbnail_index_),
sizeof(thumbnail_key_index_t)/sizeof(key_index_t));
}
inline TemplateVariable::variable_t *
ThumbnailVariableCreator::create_thumbnail(apr_pool_t *pool,
apr_size_t item_id,
void *var_memory,
void *sca_memory) const
{
variable_t *thumbnail_var;
scalar_t *thumbnail_sca;
scalar_t *sca;
thumbnail_var = AS_VARIABLE(var_memory);
thumbnail_sca = AS_SCALAR(sca_memory);
thumbnail_var->type = TemplateVariable::HASH;
thumbnail_var->s = thumbnail_sca;
sca = thumbnail_sca + thumbnail_index_.id.index;
sca->type = TemplateVariable::INTEGER;
sca->i = static_cast<int>(item_id);
return thumbnail_var;
}
apr_size_t ThumbnailVariableCreator::get_thumbnail_array_memory_size(apr_size_t list_size) const
{
return sizeof(variable_t) * (list_size + 1);
}
apr_size_t ThumbnailVariableCreator::get_thumbnail_memory_size() const
{
return sizeof(scalar_t) * (thumbnail_index_max_ + 1);
}
/******************************************************************************
* テスト
*****************************************************************************/
#ifdef DEBUG_ThumbnailVariableCreator
#include "TemplateParser.h"
#include "UploadItemList.h"
#include "UploadItemListReader.h"
#include "ThumbnailList.h"
#include "ThumbnailIterator.h"
#include "Message.h"
#include "TestRunner.h"
static const apr_size_t THUMBNAIL_LIST_SIZE = 10;
static const apr_size_t MAX_LIST_SIZE = 1000;
void show_usage(const char *prog_name)
{
cerr << "Usage: " << prog_name << " <DATA_DIR_PATH> <TMPL_FILE_PATH>" << endl;
}
void run_create(apr_pool_t *pool, ThumbnailList *thumbnail_list,
const char *data_dir_path, const char *tmpl_file_path)
{
const char **ids;
const char **keys;
show_test_name("create variable");
TemplateParser::parse(pool, tmpl_file_path, &ids, &keys);
ThumbnailVariableCreator var_creator(keys);
ThumbnailIterator thumbnail_iter(pool, thumbnail_list, 0, THUMBNAIL_LIST_SIZE);
var_creator.create(pool, &thumbnail_iter);
show_spacer();
}
void run_all(apr_pool_t *pool, int argc, const char * const *argv)
{
const char *data_dir_path;
const char *tmpl_file_path;
apr_shm_t *item_list_shm;
apr_shm_t *thumbnail_list_shm;
UploadItemList *item_list;
ThumbnailList *thumbnail_list;
if (argc != 3) {
THROW(MESSAGE_ARGUMENT_INVALID);
}
data_dir_path = argv[1];
tmpl_file_path = argv[2];
if (!File::is_exist(pool, data_dir_path)) {
THROW(MESSAGE_DATA_DIR_NOT_FOUND);
}
if (!File::is_exist(pool, tmpl_file_path)) {
THROW(MESSAGE_TMPL_FILE_NOT_FOUND);
}
item_list_shm = create_shm(pool,
UploadItemList::get_memory_size(MAX_LIST_SIZE));
thumbnail_list_shm = create_shm(pool,
ThumbnailList::get_memory_size(MAX_LIST_SIZE));
thumbnail_list = ThumbnailList::get_instance(thumbnail_list_shm,
MAX_LIST_SIZE);
item_list = UploadItemListReader::read(pool, data_dir_path, item_list_shm,
thumbnail_list, MAX_LIST_SIZE);
show_item("data dir", data_dir_path);
show_item("template file", tmpl_file_path);
show_line();
run_create(pool, thumbnail_list, data_dir_path, tmpl_file_path);
}
#endif
// Local Variables:
// mode: c++
// coding: utf-8-dos
// End:
|
ee81b7986623003ba30ef139d6d0005cd70b9936 | 10ef7e0bf7fdd32fdd12cd298d3f6fadb7561d42 | /mediaeditor/src/main/cpp/muxer/BaseMuxer.h | 9e23c9ce0b0acb1d2c5b42f2ddf31a4d54cd015c | [] | no_license | JiangshouTing33/JustMediaEditor | 35291b83a2d59569bfde1fc5b27826043fff74aa | 001d3c9c48cffd6b57dfea730a5f3de0ceebba46 | refs/heads/main | 2023-09-02T07:06:04.264146 | 2021-11-16T13:54:07 | 2021-11-16T13:54:07 | 428,281,362 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,123 | h | BaseMuxer.h | //
// Created by 江守亭 on 2021/9/27.
//
#ifndef JUSTMEDIAEDITOR_BASEMUXER_H
#define JUSTMEDIAEDITOR_BASEMUXER_H
#include <VideoEncoder.h>
#include <AudioEncoder.h>
enum MuxerType {
MUXER_TYPE_NONE = -1,
MUXER_TYPE_VIDEO_ONLY,
MUXER_TYPE_AUDIO_ONLY,
MUXER_TYPE_VIDEO_AUDIO
};
enum MuxerMessageType {
MUXER_MESSAGE_TIME_STAMP,
MUXER_MESSAGE_VIDEO_QUEUE_FULL,
MUXER_MESSAGE_DONE
};
typedef void (*MuxerMessageCallback) (void *, int, void *);
class BaseMuxer {
public:
BaseMuxer(const char* url, int muxerType);
~BaseMuxer();
int Init();
void UnInit();
void Start();
void Stop();
void Pause();
void SetVideoEncodeParam(VideoEncodeParam videoEncodeParam);
void SetAudioEncodeParam(AudioEncodeParam audioEncodeParam);
void OnAudioFrame2Encode(AVFrame *frame);
void OnVideoFrame2Encode(FrameImage *image);
int InitAudioFrameQueue(int sample_fmt, uint64_t channel_layout, int nb_samples, int sample_rate);
void VideoFrameInputDone();
void AudioFrameInputDone();
void SetMuxerMessageCallback(void *ctx, MuxerMessageCallback muxerMessageCallback) {
m_MessageContext = ctx;
m_MuxerMessageCallback = muxerMessageCallback;
}
void SetCoverImageDuration(double duration);
private:
void WriteTrailer();
void SetEncodeTimeStampCallback();
static void OnEncodeTimeStampCallback(void *ctx, double timeStamp);
static void OnVideoEncodeMessageCallback(void *ctx, int message, void *data);
static void OnAudioEncodeMessageCallback(void *ctx, int message, void *data);
private:
VideoEncoder *m_VideoEncoder = nullptr;
AudioEncoder *m_AudioEncoder = nullptr;
AVFormatContext *p_AVFmtCtx = nullptr;
char m_Url[4096];
volatile bool m_VideoEncodeDone = false;
volatile bool m_AudioEncodeDone = false;
bool m_VideoEncoderNeedInit = false;
bool m_AudioEncoderNeedInit = false;
int m_MuxerType = MUXER_TYPE_NONE;
void *m_MessageContext = nullptr;
MuxerMessageCallback m_MuxerMessageCallback = nullptr;
};
#endif //JUSTMEDIAEDITOR_BASEMUXER_H
|
84e1369ccea3817e8ac7b2522ecea184bd461d47 | e0ba80e61833881046361c3b31094909d7efcfcd | /bus_cx/adapter.cpp | 85793d791fe0d0f7701c4acb9fbf755b0aa0adfc | [] | no_license | FahadGhouri/System_C-Bus_Modeling | 11d2dac5b9b1e814eeb8dbfc5c37342b25edb37d | 9387a43f7cc06b1b7b2160629333df788e6e55a3 | refs/heads/master | 2020-04-21T12:44:21.341921 | 2019-02-07T13:08:50 | 2019-02-07T13:08:50 | 169,573,151 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 486 | cpp | adapter.cpp | #include "adapter.h"
void Adapter::write( unsigned addr, unsigned data )
{
if (addr==1024)
x.write(data);
else if (addr==1025)
y.write(data);
else if (addr==1026)
cout<<"Write Forbidden to 1026"<<endl;
else
cout<<"Unknown Address"<<endl;
}
void Adapter::read( unsigned addr, unsigned &data )
{
if (addr==1024)
data=x.read();
else if (addr==1025)
data=y.read();
else if (addr==1026)
data=s.read();
else
cout<<"Unknown Address"<<endl;
}
|
bffa3257e3539ff3057ee45be3ec84140527629d | 33035c05aad9bca0b0cefd67529bdd70399a9e04 | /src/boost_metaparse_v1_grammar.hpp | 0c162b7dae4d13211d5b66ff716c41780b1b1f1a | [
"LicenseRef-scancode-unknown-license-reference",
"BSL-1.0"
] | permissive | elvisbugs/BoostForArduino | 7e2427ded5fd030231918524f6a91554085a8e64 | b8c912bf671868e2182aa703ed34076c59acf474 | refs/heads/master | 2023-03-25T13:11:58.527671 | 2021-03-27T02:37:29 | 2021-03-27T02:37:29 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 42 | hpp | boost_metaparse_v1_grammar.hpp | #include <boost/metaparse/v1/grammar.hpp>
|
2a3dc10df477705cf414022acf8b061febe8ea4a | 24f794d4cc3c335abb8bc5bd9d9b73f0af4d53ed | /person.h | 516efec2e8d78df9cf9e52b85c408b058b3e046f | [] | no_license | MarcinML/DB | 44028fbf94379ab7321c8a15e9e0c29c4c9cf192 | 79af73de3cf65ea2cc5453913c0b65193ba2f27d | refs/heads/master | 2020-03-23T18:32:07.082760 | 2018-07-22T17:09:40 | 2018-07-22T17:09:40 | 141,915,231 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 566 | h | person.h | #pragma once
#include <string>
class Person
{
public:
Person();
std::string getName() const;
void getSurname() const;
void getPESEL() const;
void getSex() const;
void getAddress() const;
void checkPESEL();
void setName(std::string);
void setSurname();
void setPesel();
void setSex();
void setAddress();
virtual void setPayment() = 0;
virtual void getPayment() const = 0;
private:
std::string m_name;
std::string m_surname;
std::string m_PESEL;
char m_sex;
std::string m_address;
};
|
b19d385ff251bebfe7e92fa8c39d5a2f22b620c5 | 838f063e516b979364bdddb7a8604f9c3ff405d8 | /backend/query/index_hint_validator.cc | 1da354a4fea539a842a5364a5daa528b864cab6a | [
"Apache-2.0"
] | permissive | GoogleCloudPlatform/cloud-spanner-emulator | d205193c7c3c265a47a822e1df574271c8522759 | 53eaa404d303fb2dc03f3b444553aa9bb24c3786 | refs/heads/master | 2023-08-29T12:33:41.780107 | 2023-08-11T08:15:10 | 2023-08-11T08:15:10 | 251,420,886 | 236 | 38 | Apache-2.0 | 2023-09-07T12:35:45 | 2020-03-30T20:28:25 | C++ | UTF-8 | C++ | false | false | 7,425 | cc | index_hint_validator.cc | //
// Copyright 2020 Google LLC
//
// 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 "backend/query/index_hint_validator.h"
#include <algorithm>
#include <iterator>
#include <string>
#include <vector>
#include "zetasql/resolved_ast/resolved_ast.h"
#include "zetasql/resolved_ast/resolved_node_kind.pb.h"
#include "absl/status/status.h"
#include "absl/strings/match.h"
#include "backend/query/queryable_table.h"
#include "backend/schema/updater/global_schema_names.h"
#include "common/errors.h"
#include "re2/re2.h"
namespace google {
namespace spanner {
namespace emulator {
namespace backend {
namespace {
// Query hints using generated names of managed indexes are special-cased. The
// emulator and production name generators use different fingerprint algorithms,
// so the generated names have different suffixes. A hint using a managed
// index's name that was generated in production never matches the name of the
// emulator's index, and vice versa. In order to permit the use of production
// queries in the emulator, names generated in production are permitted in the
// emulator. However, in order to avoid the unintentional and unsupported use of
// emulator generated names in production, names generated in the emulator are
// not allowed in query hints, neither in production nor in the emulator.
// Returns true if an index name matches the signature of a generated managed
// index name. See also GlobalSchemaNames::GenerateManagedIndexName.
bool MatchesManagedIndexName(absl::string_view table_name,
absl::string_view index_name) {
return RE2::FullMatch(index_name, absl::StrCat("IDX_", table_name, "_",
"\\w+", "_", "[0-9A-F]{16}"));
}
// Returns true if an index's name matches the name of an index created in the
// emulator with GlobalSchemaNames::GenerateManagedIndexName.
bool HasGeneratedEmulatorName(const Index* index) {
if (!index->is_managed()) {
return false; // Only managed indexes have generated names.
}
auto columns = index->key_columns();
std::vector<std::string> column_names;
std::transform(
columns.begin(), columns.end(), std::back_inserter(column_names),
[](const KeyColumn* column) { return column->column()->Name(); });
return index->Name() == GlobalSchemaNames::GenerateManagedIndexName(
index->indexed_table()->Name(), column_names,
index->is_null_filtered(), index->is_unique())
.value();
}
} // namespace
absl::Status IndexHintValidator::VisitResolvedTableScan(
const zetasql::ResolvedTableScan* table_scan) {
// Visit child nodes first.
ZETASQL_RETURN_IF_ERROR(zetasql::ResolvedASTVisitor::DefaultVisit(table_scan));
std::vector<const zetasql::ResolvedNode*> child_nodes;
table_scan->GetChildNodes(&child_nodes);
for (const zetasql::ResolvedNode* child_node : child_nodes) {
if (child_node->node_kind() == zetasql::RESOLVED_OPTION) {
const zetasql::ResolvedOption* hint =
child_node->GetAs<zetasql::ResolvedOption>();
if ((absl::EqualsIgnoreCase(hint->qualifier(), "spanner") ||
hint->qualifier().empty()) &&
absl::EqualsIgnoreCase(hint->name(), "force_index")) {
// We should expect only one hint per table scan as multiple hints per
// node is not allowed and would've been rejected by the HintValidator.
ZETASQL_RET_CHECK_EQ(hint->value()->node_kind(), zetasql::RESOLVED_LITERAL);
const zetasql::Value& value =
hint->value()->GetAs<zetasql::ResolvedLiteral>()->value();
ZETASQL_RET_CHECK(value.type()->IsString());
index_hints_map_[table_scan] = value.string_value();
break;
}
}
}
return absl::OkStatus();
}
absl::Status IndexHintValidator::ValidateIndexesForTables() {
for (auto [table_scan, index_name] : index_hints_map_) {
if (absl::EqualsIgnoreCase(index_name, "_base_table")) {
continue;
}
auto table = table_scan->table();
auto query_table = table->GetAs<QueryableTable>();
auto schema_table = query_table->wrapped_table();
const auto* index = schema_table->FindIndex(index_name);
// See comments above regarding special-casing of managed indexes.
if (index == nullptr) {
if (MatchesManagedIndexName(schema_table->Name(), index_name)) {
return absl::OkStatus();
}
return error::QueryHintIndexNotFound(schema_table->Name(), index_name);
} else if (HasGeneratedEmulatorName(index)) {
return error::QueryHintManagedIndexNotSupported(index_name);
}
if (index->is_null_filtered() && !disable_null_filtered_index_check_) {
for (const auto* key_column : index->key_columns()) {
const auto* source_column = key_column->column()->source_column();
// If any of the index's columns are nullable, then it is not indexing
// the full table and therefore, without analyzing the predicates in the
// query to determine if they filter nulls, we cannot allow the index
// to be used.
if (source_column->is_nullable()) {
return error::NullFilteredIndexUnusable(index_name);
}
}
}
}
return absl::OkStatus();
}
absl::Status IndexHintValidator::VisitResolvedQueryStmt(
const zetasql::ResolvedQueryStmt* stmt) {
// Visit children first to collect all hints.
ZETASQL_RETURN_IF_ERROR(zetasql::ResolvedASTVisitor::DefaultVisit(stmt));
// Validate all index hints.
return ValidateIndexesForTables();
}
absl::Status IndexHintValidator::VisitResolvedInsertStmt(
const zetasql::ResolvedInsertStmt* stmt) {
// Visit children first to collect all hints.
ZETASQL_RETURN_IF_ERROR(zetasql::ResolvedASTVisitor::DefaultVisit(stmt));
// The target table should not have any hints (not allowed by ZetaSQL).
ZETASQL_RET_CHECK(!index_hints_map_.contains(stmt->table_scan()));
return ValidateIndexesForTables();
}
absl::Status IndexHintValidator::VisitResolvedUpdateStmt(
const zetasql::ResolvedUpdateStmt* stmt) {
// Visit children first to collect all hints.
ZETASQL_RETURN_IF_ERROR(zetasql::ResolvedASTVisitor::DefaultVisit(stmt));
// The target table should not have any hints (not allowed by ZetaSQL).
ZETASQL_RET_CHECK(!index_hints_map_.contains(stmt->table_scan()));
return ValidateIndexesForTables();
}
absl::Status IndexHintValidator::VisitResolvedDeleteStmt(
const zetasql::ResolvedDeleteStmt* stmt) {
// Visit children first to collect all hints.
ZETASQL_RETURN_IF_ERROR(zetasql::ResolvedASTVisitor::DefaultVisit(stmt));
// The target table should not have any hints (not allowed by ZetaSQL).
ZETASQL_RET_CHECK(!index_hints_map_.contains(stmt->table_scan()));
return ValidateIndexesForTables();
}
} // namespace backend
} // namespace emulator
} // namespace spanner
} // namespace google
|
d68f1179457c0703aa4734a1fc009ee4285b1b18 | 55b53529db205e921d13873f901a59518c35b14f | /helpers/commonhelper.cpp | 0e74b1233d0ed9d131cefe40b952a0ea7c3113cb | [] | no_license | andreikl/gexplorer | 00e7efd6a25231eed53e4770cb864b41e280f88a | 5e4a16432504f20fdae90ae316ddc8f782e625a1 | refs/heads/master | 2021-06-02T00:44:56.036227 | 2016-05-15T02:37:11 | 2016-05-15T02:37:11 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,701 | cpp | commonhelper.cpp | #include <QtCore/QUrl>
#include <QtCore/QDir>
#include "data/customgalleryitemdata.h"
#include "data/galleryitemdata.h"
#include "data/gallerydata.h"
#include "helpers/commonhelper.h"
QString CommonHelper::getPath(const GalleryItemData& item)
{
if(item.getReference() != NULL) {
return getPath(*item.getReference());
}
QString p;
QUrl path = QUrl::fromLocalFile(item.getGallery()->getPath() + QDir::separator());
p = path.toLocalFile();
path = QUrl::fromLocalFile(item.getPath() + QDir::separator() + item.getFileName());
return p + QDir::separator() + path.toLocalFile();
/*QString p;
QUrl path = QUrl::fromLocalFile(item.getGallery()->getPath() + QDir::separator());
path = path.resolved(QUrl::fromLocalFile(item.getPath() + QDir::separator()));
path = path.resolved(QUrl::fromLocalFile(item.getFileName()));
if(path.isRelative()) {
p = QDir::currentPath() + QDir::separator() + path.toLocalFile();
} else {
p = path.toLocalFile();
}*/
return p;
}
int CommonHelper::getAngle(const GalleryItemData& item)
{
if(item.getReference() != NULL) {
return item.getReferenceAngle() + getAngle(*item.getReference());
}
return item.getReferenceAngle();
}
void CommonHelper::getChildren(const CustomGalleryItemData& item, QList<CustomGalleryItemData*>& children)
{
foreach(CustomGalleryItemData* gi, item.getChildren()) {
children.append(gi);
getChildren(*gi, children);
}
}
QString CommonHelper::getPath(const CustomGalleryItemData& item)
{
return getPath(item.getItem());
}
int CommonHelper::getAngle(const CustomGalleryItemData& item)
{
return item.getAngle();
}
|
7d3ddca201647ff9e48145f44521db6bbd10c692 | c3184d7e5fb2eb1378506cc2acbe578d8a934721 | /rb347_midterm/rb347_midterm_code/midterm_field/src/ofApp.h | 61ac3f0eb1b4a2681aa8159f2256ca5ef216fa56 | [] | no_license | roxannebei/Rongqi-Bei-MEDIART206-homework | 843f1867eaf54ca8ecaed5ea89a29f0f75129f22 | d9dd0953f3a2f5586717394741739d7157f493a1 | refs/heads/main | 2023-02-02T05:05:31.151847 | 2020-12-12T08:25:26 | 2020-12-12T08:25:26 | 307,265,607 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,497 | h | ofApp.h | #pragma once
#include "ofMain.h"
#include "Light.hpp"
#include "Road.hpp"
#include "SideRoad.hpp"
#include "Events.hpp"
#include "Particle.hpp"
#include "ParticleSystem.hpp"
#include "Meteor.hpp"
#include "Field.hpp"
class Scheduler : public ofThread {
public:
unsigned long counter = 0;
Scheduler() {
//timer.setPeriodicEvent(1000000000); // 1 second
timer.setPeriodicEvent(700000000); // 1 second
startThread();
}
private:
ofTimer timer;
void threadedFunction() {
while (isThreadRunning()) {
timer.waitNext();
counter ++;
}
}
};
class ofApp : public ofBaseApp{
public:
void setup();
void update();
void draw();
void keyPressed(int key);
void keyReleased(int key);
void mouseMoved(int x, int y );
void mouseDragged(int x, int y, int button);
void mousePressed(int x, int y, int button);
void mouseReleased(int x, int y, int button);
void mouseEntered(int x, int y);
void mouseExited(int x, int y);
void windowResized(int w, int h);
void dragEvent(ofDragInfo dragInfo);
void gotMessage(ofMessage msg);
Scheduler mysch;
//Scheduler mysch1;
vector<ParticleSystem> particleSystems;
glm::vec2 gravity;
Field meteor_field;
vector<Meteor> meteors;
float damping;
void meteor_update();
};
|
8cb7ea2a53a20b37895523201ab8163feefdf39d | 6c996ca5146bd307a062f38819acec16d710656f | /workspace/iw8/code_source/src/script/scr_main.cpp | cc758bf6285bc7adc9e58bfe3588bfa879df3a57 | [] | no_license | Omn1z/OpenIW8 | d46f095d4d743d1d8657f7e396e6d3cf944aa562 | 6c01a9548e4d5f7e1185369a62846f2c6f8304ba | refs/heads/main | 2023-08-15T22:43:01.627895 | 2021-10-10T20:44:57 | 2021-10-10T20:44:57 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 58,919 | cpp | scr_main.cpp | /*
==============
Scr_BeginLoadScripts
==============
*/
void __fastcall Scr_BeginLoadScripts(scrContext_t *scrContext, const ScrThreadMode threadMode)
{
?Scr_BeginLoadScripts@@YAXAEAUscrContext_t@@W4ScrThreadMode@@@Z(scrContext, threadMode);
}
/*
==============
Scr_FreeScripts
==============
*/
void __fastcall Scr_FreeScripts(scrContext_t *scrContext, unsigned __int8 sys)
{
?Scr_FreeScripts@@YAXAEAUscrContext_t@@E@Z(scrContext, sys);
}
/*
==============
Scr_ScanFile
==============
*/
int __fastcall Scr_ScanFile(scrContext_t *scrContext, char *buf, int max_size)
{
return ?Scr_ScanFile@@YAHAEAUscrContext_t@@PEADH@Z(scrContext, buf, max_size);
}
/*
==============
Scr_EndLoadScripts
==============
*/
void __fastcall Scr_EndLoadScripts(scrContext_t *scrContext)
{
?Scr_EndLoadScripts@@YAXAEAUscrContext_t@@@Z(scrContext);
}
/*
==============
Scr_ShutdownStringConstants
==============
*/
void Scr_ShutdownStringConstants(void)
{
?Scr_ShutdownStringConstants@@YAXXZ();
}
/*
==============
Scr_GetFunctionHandle
==============
*/
int __fastcall Scr_GetFunctionHandle(scrContext_t *scrContext, const char *const filename, const char *const name)
{
return ?Scr_GetFunctionHandle@@YAHAEAUscrContext_t@@QEBD1@Z(scrContext, filename, name);
}
/*
==============
Scr_FreeInternalVariable
==============
*/
void __fastcall Scr_FreeInternalVariable(scrContext_t *scrContext, unsigned int *outVariable)
{
?Scr_FreeInternalVariable@@YAXAEAUscrContext_t@@AEAI@Z(scrContext, outVariable);
}
/*
==============
Scr_IsInOpcodeMemory
==============
*/
int __fastcall Scr_IsInOpcodeMemory(const scrContext_t *scrContext, const char *pos)
{
return ?Scr_IsInOpcodeMemory@@YAHAEBUscrContext_t@@PEBD@Z(scrContext, pos);
}
/*
==============
Scr_ShutdownProgramHunkUser
==============
*/
void __fastcall Scr_ShutdownProgramHunkUser(scrContext_t *scrContext)
{
?Scr_ShutdownProgramHunkUser@@YAXAEAUscrContext_t@@@Z(scrContext);
}
/*
==============
Scr_PrecacheAnimTrees
==============
*/
void __fastcall Scr_PrecacheAnimTrees(void *(__fastcall *Alloc)(unsigned __int64), int user, const ScrThreadMode threadMode)
{
?Scr_PrecacheAnimTrees@@YAXP6APEAX_K@ZHW4ScrThreadMode@@@Z(Alloc, user, threadMode);
}
/*
==============
SL_GetCanonicalString
==============
*/
unsigned int __fastcall SL_GetCanonicalString(const char *str)
{
return ?SL_GetCanonicalString@@YAIPEBD@Z(str);
}
/*
==============
Scr_AllocInternalArray
==============
*/
void __fastcall Scr_AllocInternalArray(scrContext_t *scrContext, unsigned int *outVariable)
{
?Scr_AllocInternalArray@@YAXAEAUscrContext_t@@AEAI@Z(scrContext, outVariable);
}
/*
==============
SL_GetLocalCanonicalString
==============
*/
unsigned int __fastcall SL_GetLocalCanonicalString(unsigned int name)
{
return ?SL_GetLocalCanonicalString@@YAII@Z(name);
}
/*
==============
Scr_CheckThreadForInstance
==============
*/
void __fastcall Scr_CheckThreadForInstance(ScriptInstanceType inst)
{
?Scr_CheckThreadForInstance@@YAXW4ScriptInstanceType@@@Z(inst);
}
/*
==============
Scr_StartInlineLex
==============
*/
void __fastcall Scr_StartInlineLex(const char *buf, int len)
{
?Scr_StartInlineLex@@YAXPEBDH@Z(buf, len);
}
/*
==============
SL_ResetLocalCanonicalString
==============
*/
void SL_ResetLocalCanonicalString(void)
{
?SL_ResetLocalCanonicalString@@YAXXZ();
}
/*
==============
Scr_Main_PreCommitMemory
==============
*/
void __fastcall Scr_Main_PreCommitMemory(const scrContext_t *scrContext)
{
?Scr_Main_PreCommitMemory@@YAXAEBUscrContext_t@@@Z(scrContext);
}
/*
==============
Scr_CloneXAnimSubTreeRegistry
==============
*/
void Scr_CloneXAnimSubTreeRegistry(void)
{
?Scr_CloneXAnimSubTreeRegistry@@YAXXZ();
}
/*
==============
Scr_InitProgramHunkUser
==============
*/
void __fastcall Scr_InitProgramHunkUser(scrContext_t *scrContext)
{
?Scr_InitProgramHunkUser@@YAXAEAUscrContext_t@@@Z(scrContext);
}
/*
==============
Scr_BeginLoadAnimTrees
==============
*/
void __fastcall Scr_BeginLoadAnimTrees(int user)
{
?Scr_BeginLoadAnimTrees@@YAXH@Z(user);
}
/*
==============
Scr_EndLoadAnimTrees
==============
*/
void __fastcall Scr_EndLoadAnimTrees(int animUser)
{
?Scr_EndLoadAnimTrees@@YAXH@Z(animUser);
}
/*
==============
Scr_IsIdentifier
==============
*/
bool __fastcall Scr_IsIdentifier(const char *token)
{
return ?Scr_IsIdentifier@@YA_NPEBD@Z(token);
}
/*
==============
Scr_LoadScriptInternal
==============
*/
unsigned int __fastcall Scr_LoadScriptInternal(scrContext_t *scrContext, const char *filenameExt, PrecacheEntry *entries, int entriesCount, int scopeCount)
{
return ?Scr_LoadScriptInternal@@YAIAEAUscrContext_t@@PEBDPEAUPrecacheEntry@@HH@Z(scrContext, filenameExt, entries, entriesCount, scopeCount);
}
/*
==============
Scr_Shutdown
==============
*/
void __fastcall Scr_Shutdown(scrContext_t *scrContext)
{
?Scr_Shutdown@@YAXAEAUscrContext_t@@@Z(scrContext);
}
/*
==============
Scr_AllocInternalObject
==============
*/
void __fastcall Scr_AllocInternalObject(scrContext_t *scrContext, unsigned int *outVariable)
{
?Scr_AllocInternalObject@@YAXAEAUscrContext_t@@AEAI@Z(scrContext, outVariable);
}
/*
==============
Scr_PostCompileScripts
==============
*/
void __fastcall Scr_PostCompileScripts(scrContext_t *scrContext)
{
?Scr_PostCompileScripts@@YAXAEAUscrContext_t@@@Z(scrContext);
}
/*
==============
Scr_InInline
==============
*/
bool __fastcall Scr_InInline(const scrContext_t *pScrCompileContext)
{
return ?Scr_InInline@@YA_NPEBUscrContext_t@@@Z(pScrCompileContext);
}
/*
==============
Scr_GetCurrentExtFilename
==============
*/
sval_u __fastcall Scr_GetCurrentExtFilename()
{
return ?Scr_GetCurrentExtFilename@@YA?ATsval_u@@XZ();
}
/*
==============
Scr_InitStringConstants
==============
*/
void __fastcall Scr_InitStringConstants(const bool useReducedSpGoldLimits)
{
?Scr_InitStringConstants@@YAX_N@Z(useReducedSpGoldLimits);
}
/*
==============
Scr_LoadScript
==============
*/
unsigned int __fastcall Scr_LoadScript(scrContext_t *scrContext, const char *filenameExt)
{
return ?Scr_LoadScript@@YAIAEAUscrContext_t@@PEBD@Z(scrContext, filenameExt);
}
/*
==============
Scr_CheckProgramHunkUsersClear
==============
*/
void __fastcall Scr_CheckProgramHunkUsersClear(const scrContext_t *scrContext)
{
?Scr_CheckProgramHunkUsersClear@@YAXAEBUscrContext_t@@@Z(scrContext);
}
/*
==============
Scr_EndInline
==============
*/
bool __fastcall Scr_EndInline()
{
return ?Scr_EndInline@@YA_NXZ();
}
/*
==============
Scr_Main_DecommitUnusedMemory
==============
*/
void __fastcall Scr_Main_DecommitUnusedMemory(const scrContext_t *scrContext)
{
?Scr_Main_DecommitUnusedMemory@@YAXAEBUscrContext_t@@@Z(scrContext);
}
/*
==============
SL_GetCanonicalString
==============
*/
__int64 SL_GetCanonicalString(const char *str)
{
const char *v1;
CanonicalStringData *canonicalStringData;
int v3;
unsigned int v4;
const char *v5;
int v6;
__int64 v7;
unsigned int v8;
__int64 v9;
__int64 v10;
__int64 result;
unsigned int canonicalStringBufferSize;
char *v13;
char v14;
__int64 v15;
__int64 v16;
v1 = str;
if ( !str && CoreAssert_Handler("c:\\workspace\\iw8\\code_source\\src\\script\\scr_main.cpp", 243, ASSERT_TYPE_ASSERT, "( str )", (const char *)&queryFormat, "str") )
__debugbreak();
if ( !g_scrCanonicalStringPub.canonicalStringData && CoreAssert_Handler("c:\\workspace\\iw8\\code_source\\src\\script\\scr_main.cpp", 244, ASSERT_TYPE_ASSERT, "( g_scrCanonicalStringPub.canonicalStringData != nullptr )", (const char *)&queryFormat, "g_scrCanonicalStringPub.canonicalStringData != nullptr") )
__debugbreak();
if ( !g_scrCanonicalStringPub.canonicalStringLimit && CoreAssert_Handler("c:\\workspace\\iw8\\code_source\\src\\script\\scr_main.cpp", 245, ASSERT_TYPE_ASSERT, "( g_scrCanonicalStringPub.canonicalStringLimit > 0 )", (const char *)&queryFormat, "g_scrCanonicalStringPub.canonicalStringLimit > 0") )
__debugbreak();
canonicalStringData = g_scrCanonicalStringPub.canonicalStringData;
if ( !g_scrCanonicalStringPub.canonicalStringLimit && CoreAssert_Handler("c:\\workspace\\iw8\\code_source\\src\\script\\scr_main.cpp", 190, ASSERT_TYPE_ASSERT, "( g_scrCanonicalStringPub.canonicalStringLimit > 0 )", (const char *)&queryFormat, "g_scrCanonicalStringPub.canonicalStringLimit > 0") )
__debugbreak();
v3 = *v1;
v4 = 0;
v5 = v1;
if ( *v1 )
{
do
{
++v5;
v4 = v3 + 31 * v4;
v3 = *v5;
}
while ( *v5 );
if ( v5 < v1 && CoreAssert_Handler("c:\\workspace\\iw8\\code_source\\src\\script\\scr_main.cpp", 206, ASSERT_TYPE_ASSERT, "(pos >= str)", (const char *)&queryFormat, "pos >= str") )
__debugbreak();
}
v6 = truncate_cast<int,__int64>(v5 - v1);
v7 = v4 % g_scrCanonicalStringPub.canonicalStringLimit + 1;
v8 = canonicalStringData->stringOffsets[v7];
LODWORD(v9) = v4 % g_scrCanonicalStringPub.canonicalStringLimit + 1;
if ( v8 )
{
while ( 1 )
{
v10 = v8 - 1;
if ( (unsigned int)v10 >= 0x64000 )
{
LODWORD(v16) = 409600;
LODWORD(v15) = v8 - 1;
if ( CoreAssert_Handler("c:\\workspace\\iw8\\code_source\\src\\script\\scr_main.cpp", 270, ASSERT_TYPE_ASSERT, "(unsigned)( offset - 1 ) < (unsigned)( ( sizeof( *array_counter( strData.stringBuffer ) ) + 0 ) )", "offset - 1 doesn't index ARRAY_COUNT( strData.stringBuffer )\n\t%i not in [0, %i)", v15, v16) )
__debugbreak();
}
result = (unsigned int)v9;
if ( !strcmp(v1, &canonicalStringData->stringBuffer[v10]) )
break;
v9 = (unsigned int)v9 % g_scrCanonicalStringPub.canonicalStringLimit + 1;
if ( (_DWORD)v9 == (_DWORD)v7 )
Sys_Error((const ObfuscateErrorText)&stru_14409B960, g_scrCanonicalStringPub.canonicalStringLimit);
v8 = canonicalStringData->stringOffsets[v9];
if ( !v8 )
goto LABEL_26;
}
}
else
{
LABEL_26:
canonicalStringBufferSize = g_scrCanonicalStringPub.canonicalStringBufferSize;
if ( g_scrCanonicalStringPub.canonicalStringBufferSize + v6 > 0x64000 )
{
Sys_Error((const ObfuscateErrorText)&stru_14409B930);
canonicalStringBufferSize = g_scrCanonicalStringPub.canonicalStringBufferSize;
}
canonicalStringData->stringOffsets[(unsigned int)v9] = canonicalStringBufferSize + 1;
v13 = &canonicalStringData->stringBuffer[g_scrCanonicalStringPub.canonicalStringBufferSize];
do
{
v14 = *v1++;
*v13++ = v14;
}
while ( v14 );
++g_scrCanonicalStringPub.canonicalStringCount;
result = (unsigned int)v9;
g_scrCanonicalStringPub.canonicalStringBufferSize += v6 + 1;
}
return result;
}
/*
==============
SL_GetLocalCanonicalString
==============
*/
unsigned int SL_GetLocalCanonicalString(unsigned int name)
{
const char *v1;
v1 = SL_ConvertToString((scr_string_t)name);
return SL_GetCanonicalString(v1);
}
/*
==============
SL_ResetLocalCanonicalString
==============
*/
void SL_ResetLocalCanonicalString(void)
{
;
}
/*
==============
Scr_AllocInternalArray
==============
*/
void Scr_AllocInternalArray(scrContext_t *scrContext, unsigned int *outVariable)
{
unsigned int v4;
v4 = Scr_AllocArray(scrContext);
Scr_SetupInternalVariable(scrContext, v4, outVariable);
}
/*
==============
Scr_AllocInternalObject
==============
*/
void Scr_AllocInternalObject(scrContext_t *scrContext, unsigned int *outVariable)
{
unsigned int v4;
v4 = AllocObject(scrContext);
Scr_SetupInternalVariable(scrContext, v4, outVariable);
}
/*
==============
Scr_BeginLoadAnimTrees
==============
*/
void Scr_BeginLoadAnimTrees(int user)
{
__int64 v1;
scrContext_t *v2;
const char *InstanceName;
unsigned int v4;
v1 = user;
v2 = ScriptContext_GetFromAnimUser(user);
InstanceName = ScriptContext_GetInstanceName(v2);
Com_Printf(24, "Script Anim Parsing Begin - Scr_BeginLoadAnimTrees - %s\n", InstanceName);
ScriptCodePos::SetVarUsagePos(&v2->m_varPub.varUsagePos, "<script compile variable>");
if ( v2->m_animPub.animtree_loading && CoreAssert_Handler("c:\\workspace\\iw8\\code_source\\src\\script\\scr_main.cpp", 724, ASSERT_TYPE_ASSERT, "( !pScrAnimPub->animtree_loading )", (const char *)&queryFormat, "!pScrAnimPub->animtree_loading") )
__debugbreak();
*(_WORD *)&v2->m_animPub.animtree_loading = 1;
v2->m_animPub.xanim_num[v1] = 0;
v2->m_animPub.xanim_lookup[v1][0].anims = NULL;
if ( v2->m_animPub.animtrees && CoreAssert_Handler("c:\\workspace\\iw8\\code_source\\src\\script\\scr_main.cpp", 731, ASSERT_TYPE_ASSERT, "( !pScrAnimPub->animtrees )", (const char *)&queryFormat, "!pScrAnimPub->animtrees") )
__debugbreak();
v4 = Scr_AllocArray(v2);
v2->m_animPub.animtrees = v4;
if ( v2->m_varDebugPub.m_Inited )
++v2->m_varDebugPub.extRefCount[v4];
v2->m_animPub.animtree_node = 0;
v2->m_compilePub.developer_statement = 0;
}
/*
==============
Scr_BeginLoadScripts
==============
*/
void Scr_BeginLoadScripts(scrContext_t *scrContext, const ScrThreadMode threadMode)
{
unsigned int v4;
__int64 v5;
__int64 v6;
__int64 v7;
__int64 v8;
__int64 v9;
const char *programBuffer;
unsigned int v11;
scrContext_t *v12;
const char *InstanceName;
unsigned int v14;
BuiltinType type;
ScriptCodePos::SetVarUsagePos(&scrContext->m_varPub.varUsagePos, "<script compile variable>");
MT_Reset();
if ( scrContext->m_compilePub.script_loading && CoreAssert_Handler("c:\\workspace\\iw8\\code_source\\src\\script\\scr_main.cpp", 583, ASSERT_TYPE_ASSERT, "( !pScrCompilePub->script_loading )", (const char *)&queryFormat, "!pScrCompilePub->script_loading") )
__debugbreak();
scrContext->m_compilePub.script_loading = 1;
scrContext->m_compilePub.loadThreadMode = threadMode;
Scr_InitOpcodeLookup(scrContext);
scrContext->m_parserPub.functionCount = 0;
scrContext->m_compilePub.precachedEntriesHighWatermark = 0;
scrContext->m_compilePub.scriptCompileFileListHighWatermark = 0;
Scr_InitDebuggerMain(scrContext);
v4 = Scr_AllocArray(scrContext);
Scr_SetupInternalVariable(scrContext, v4, &scrContext->m_compilePub.loadedscripts);
memset_0(scrContext->m_profileScript.profileScriptNames, 0, sizeof(scrContext->m_profileScript.profileScriptNames));
*(_QWORD *)scrContext->m_profileScript.parentIndex = -1i64;
*(_QWORD *)&scrContext->m_profileScript.parentIndex[8] = -1i64;
*(_QWORD *)&scrContext->m_profileScript.parentIndex[16] = -1i64;
*(_QWORD *)&scrContext->m_profileScript.parentIndex[24] = -1i64;
*(_QWORD *)&scrContext->m_profileScript.parentIndex[32] = -1i64;
*(_QWORD *)&scrContext->m_profileScript.parentIndex[40] = -1i64;
*(_QWORD *)&scrContext->m_profileScript.parentIndex[48] = -1i64;
*(_QWORD *)&scrContext->m_profileScript.parentIndex[56] = -1i64;
*(_QWORD *)&scrContext->m_profileScript.parentIndex[64] = -1i64;
*(_QWORD *)&scrContext->m_profileScript.parentIndex[72] = -1i64;
*(_QWORD *)&scrContext->m_profileScript.parentIndex[80] = -1i64;
*(_QWORD *)&scrContext->m_profileScript.parentIndex[88] = -1i64;
*(_QWORD *)&scrContext->m_profileScript.parentIndex[96] = -1i64;
*(_QWORD *)&scrContext->m_profileScript.parentIndex[104] = -1i64;
*(_QWORD *)&scrContext->m_profileScript.parentIndex[112] = -1i64;
*(_QWORD *)&scrContext->m_profileScript.parentIndex[120] = -1i64;
scrContext->m_vmPub.showError = scrContext->m_varPub.developer;
v5 = Scr_AllocArray(scrContext);
if ( scrContext->m_compilePub.scriptsPos && CoreAssert_Handler("c:\\workspace\\iw8\\code_source\\src\\script\\scr_main.cpp", 496, ASSERT_TYPE_ASSERT, "( outVariable == NULL_OBJECT_VARIABLE_ID )", (const char *)&queryFormat, "outVariable == NULL_OBJECT_VARIABLE_ID") )
__debugbreak();
if ( scrContext->m_varDebugPub.m_Inited )
++scrContext->m_varDebugPub.extRefCount[v5];
scrContext->m_compilePub.scriptsPos = v5;
v6 = Scr_AllocArray(scrContext);
if ( scrContext->m_compilePub.scriptsCount && CoreAssert_Handler("c:\\workspace\\iw8\\code_source\\src\\script\\scr_main.cpp", 496, ASSERT_TYPE_ASSERT, "( outVariable == NULL_OBJECT_VARIABLE_ID )", (const char *)&queryFormat, "outVariable == NULL_OBJECT_VARIABLE_ID") )
__debugbreak();
if ( scrContext->m_varDebugPub.m_Inited )
++scrContext->m_varDebugPub.extRefCount[v6];
scrContext->m_compilePub.scriptsCount = v6;
v7 = Scr_AllocArray(scrContext);
if ( scrContext->m_compilePub.scriptsDefine && CoreAssert_Handler("c:\\workspace\\iw8\\code_source\\src\\script\\scr_main.cpp", 496, ASSERT_TYPE_ASSERT, "( outVariable == NULL_OBJECT_VARIABLE_ID )", (const char *)&queryFormat, "outVariable == NULL_OBJECT_VARIABLE_ID") )
__debugbreak();
if ( scrContext->m_varDebugPub.m_Inited )
++scrContext->m_varDebugPub.extRefCount[v7];
scrContext->m_compilePub.scriptsDefine = v7;
v8 = Scr_AllocArray(scrContext);
if ( scrContext->m_compilePub.builtinFunc && CoreAssert_Handler("c:\\workspace\\iw8\\code_source\\src\\script\\scr_main.cpp", 496, ASSERT_TYPE_ASSERT, "( outVariable == NULL_OBJECT_VARIABLE_ID )", (const char *)&queryFormat, "outVariable == NULL_OBJECT_VARIABLE_ID") )
__debugbreak();
if ( scrContext->m_varDebugPub.m_Inited )
++scrContext->m_varDebugPub.extRefCount[v8];
scrContext->m_compilePub.builtinFunc = v8;
v9 = Scr_AllocArray(scrContext);
if ( scrContext->m_compilePub.builtinMeth && CoreAssert_Handler("c:\\workspace\\iw8\\code_source\\src\\script\\scr_main.cpp", 496, ASSERT_TYPE_ASSERT, "( outVariable == NULL_OBJECT_VARIABLE_ID )", (const char *)&queryFormat, "outVariable == NULL_OBJECT_VARIABLE_ID") )
__debugbreak();
if ( scrContext->m_varDebugPub.m_Inited )
++scrContext->m_varDebugPub.extRefCount[v9];
scrContext->m_compilePub.builtinMeth = v9;
if ( !scrContext->m_varPub.programHunkUser && CoreAssert_Handler("c:\\workspace\\iw8\\code_source\\src\\script\\scr_main.cpp", 646, ASSERT_TYPE_ASSERT, "(pScrVarPub->programHunkUser)", (const char *)&queryFormat, "pScrVarPub->programHunkUser") )
__debugbreak();
TempMemoryReset(scrContext->m_varPub.programHunkUser);
Scr_Mem_TempCheckClear(scrContext);
if ( !scrContext->m_varPub.readWriteTempHunkUser && CoreAssert_Handler("c:\\workspace\\iw8\\code_source\\src\\script\\scr_main.cpp", 652, ASSERT_TYPE_ASSERT, "( pScrVarPub->readWriteTempHunkUser )", (const char *)&queryFormat, "pScrVarPub->readWriteTempHunkUser") )
__debugbreak();
scrContext->m_varPub.programBuffer = TempMalloc(0i64);
scrContext->m_compilePub.programLen = 0;
programBuffer = scrContext->m_varPub.programBuffer;
scrContext->m_varPub.endScriptBuffer = NULL;
v11 = (unsigned __int8)programBuffer & 0x1F;
if ( v11 && CoreAssert_Handler("c:\\workspace\\iw8\\code_source\\src\\script\\scr_main.cpp", 668, ASSERT_TYPE_ASSERT, "( ( !((uintptr_t)pScrVarPub->programBuffer & 31) ) )", "%s\n\t( ((uintptr_t)pScrVarPub->programBuffer & 31) ) = 0x%llx", "( !((uintptr_t)pScrVarPub->programBuffer & 31) )", v11) )
__debugbreak();
SL_BeginLoadScripts(scrContext);
Scr_InitEvaluate(scrContext);
scrContext->m_varPub.fieldBuffer = NULL;
scrContext->m_compilePub.value_count = 0;
Scr_ClearErrorMessage(scrContext);
scrContext->m_animPub.animTreeNames = 0;
Scr_SetLoadedImpureScript(0);
v12 = ScriptContext_GetFromAnimUser(1);
InstanceName = ScriptContext_GetInstanceName(v12);
Com_Printf(24, "Script Anim Parsing Begin - Scr_BeginLoadAnimTrees - %s\n", InstanceName);
ScriptCodePos::SetVarUsagePos(&v12->m_varPub.varUsagePos, "<script compile variable>");
if ( v12->m_animPub.animtree_loading && CoreAssert_Handler("c:\\workspace\\iw8\\code_source\\src\\script\\scr_main.cpp", 724, ASSERT_TYPE_ASSERT, "( !pScrAnimPub->animtree_loading )", (const char *)&queryFormat, "!pScrAnimPub->animtree_loading") )
__debugbreak();
*(_WORD *)&v12->m_animPub.animtree_loading = 1;
v12->m_animPub.xanim_num[1] = 0;
v12->m_animPub.xanim_lookup[1][0].anims = NULL;
if ( v12->m_animPub.animtrees && CoreAssert_Handler("c:\\workspace\\iw8\\code_source\\src\\script\\scr_main.cpp", 731, ASSERT_TYPE_ASSERT, "( !pScrAnimPub->animtrees )", (const char *)&queryFormat, "!pScrAnimPub->animtrees") )
__debugbreak();
v14 = Scr_AllocArray(v12);
v12->m_animPub.animtrees = v14;
if ( v12->m_varDebugPub.m_Inited )
++v12->m_varDebugPub.extRefCount[v14];
v12->m_animPub.animtree_node = 0;
v12->m_compilePub.developer_statement = 0;
memset_0(scrContext->m_pFuncTable, 0, 8i64 * scrContext->m_funcCount);
memset_0(scrContext->m_pMethTable, 0, 8i64 * scrContext->m_methCount);
Scr_GetFunction(scrContext, NULL, &type);
Scr_GetMethod(scrContext, NULL, &type);
}
/*
==============
Scr_CheckProgramHunkUsersClear
==============
*/
void Scr_CheckProgramHunkUsersClear(const scrContext_t *scrContext)
{
Scr_Mem_TempCheckClear(scrContext);
Scr_Mem_DebugCheckClear(scrContext);
if ( !scrContext->m_varPub.readWriteTempHunkUser && CoreAssert_Handler("c:\\workspace\\iw8\\code_source\\src\\script\\scr_main.cpp", 456, ASSERT_TYPE_ASSERT, "( scrContext.m_varPub.readWriteTempHunkUser )", (const char *)&queryFormat, "scrContext.m_varPub.readWriteTempHunkUser") )
__debugbreak();
if ( Mem_HunkUser_GetUsedSize(scrContext->m_varPub.readWriteTempHunkUser) )
{
if ( CoreAssert_Handler("c:\\workspace\\iw8\\code_source\\src\\script\\scr_main.cpp", 457, ASSERT_TYPE_ASSERT, "( Mem_HunkUser_GetUsedSize( scrContext.m_varPub.readWriteTempHunkUser ) == 0 )", (const char *)&queryFormat, "Mem_HunkUser_GetUsedSize( scrContext.m_varPub.readWriteTempHunkUser ) == 0") )
__debugbreak();
}
}
/*
==============
Scr_CheckThreadForInstance
==============
*/
void Scr_CheckThreadForInstance(ScriptInstanceType inst)
{
;
}
/*
==============
Scr_CloneXAnimSubTreeRegistry
==============
*/
void Scr_CloneXAnimSubTreeRegistry(void)
{
XAnimSubTreeRegistry_CloneServerToClient(1u, 0x81u);
}
/*
==============
Scr_CompareFunctions
==============
*/
__int64 Scr_CompareFunctions(const void *a, const void *b)
{
unsigned __int8 *v2;
__int64 v3;
unsigned __int8 v4;
__int64 result;
unsigned __int8 *v6;
__int64 v7;
unsigned __int8 v8;
v2 = *(unsigned __int8 **)a;
v3 = *(_QWORD *)b - *(_QWORD *)a;
while ( 1 )
{
v4 = *v2;
if ( *v2 != v2[v3] )
break;
++v2;
if ( !v4 )
{
result = 0i64;
goto LABEL_6;
}
}
result = v4 < v2[v3] ? -1 : 1;
LABEL_6:
if ( !(_DWORD)result )
{
v6 = (unsigned __int8 *)*((_QWORD *)a + 1);
v7 = *((_QWORD *)b + 1) - (_QWORD)v6;
while ( 1 )
{
v8 = *v6;
if ( *v6 != v6[v7] )
break;
++v6;
if ( !v8 )
return 0i64;
}
return v8 < v6[v7] ? -1 : 1;
}
return result;
}
/*
==============
Scr_DumpScrParserPubFunctionList
==============
*/
void Scr_DumpScrParserPubFunctionList(const scrContext_t *scrContext, int numElements)
{
__int64 v3;
const char *v4;
__int64 v5;
__int64 v6;
unsigned int m_scrDebugFunctionCount;
v3 = numElements;
if ( numElements >= scrContext->m_scrDebugFunctionCount )
{
m_scrDebugFunctionCount = scrContext->m_scrDebugFunctionCount;
if ( CoreAssert_Handler("c:\\workspace\\iw8\\code_source\\src\\script\\scr_main.cpp", 1283, ASSERT_TYPE_ASSERT, "(unsigned)( numElements ) < (unsigned)( scrContext.m_scrDebugFunctionCount )", "numElements doesn't index scrContext.m_scrDebugFunctionCount\n\t%i not in [0, %i)", numElements, m_scrDebugFunctionCount) )
__debugbreak();
}
Com_Printf(24, "SCR_DEBUG_FUNCTION_BUFFER_SIZE = %d\n", scrContext->m_scrDebugFunctionBufferSize);
v4 = "client";
if ( scrContext->m_Instance == SCRIPTINSTANCE_SERVER )
v4 = "server";
Com_Printf(24, "scrParserPub[%s].functionList dump\n", v4);
Com_Printf(24, "------------------------------\n");
v5 = v3;
if ( (int)v3 > 0 )
{
v6 = 0i64;
do
{
Com_Printf(24, "%s::%s\n", scrContext->m_parserPub.functionList[v6].filenameExt, scrContext->m_parserPub.functionList[v6].name);
++v6;
--v5;
}
while ( v5 );
}
}
/*
==============
Scr_EndInline
==============
*/
bool Scr_EndInline()
{
scrContext_t *v0;
__int64 in_ptr_stack_top;
__int64 v2;
bool result;
v0 = g_pScrCompileContext;
in_ptr_stack_top = g_pScrCompileContext->m_compilePub.in_ptr_stack_top;
if ( (int)in_ptr_stack_top <= 0 )
return 0;
g_pScrCompileContext->m_compilePub.in_ptr_stack_top = in_ptr_stack_top - 1;
g_out_pos = *(&g_sourcePos + in_ptr_stack_top);
g_sourcePos = g_sourcePos_stack[v0->m_compilePub.in_ptr_stack_top];
v2 = v0->m_compilePub.in_ptr_stack_top;
v0->m_compilePub.in_ptr = v0->m_compilePub.in_ptr_stack[v2];
v0->m_parserPub.scriptExtFilename = v0->m_compilePub.scriptExtFilename_stack[v2];
result = 1;
v0->m_parserPub.sourceBuf = v0->m_compilePub.sourceBuf_stack[v0->m_compilePub.in_ptr_stack_top];
return result;
}
/*
==============
Scr_EndLoadAnimTrees
==============
*/
void Scr_EndLoadAnimTrees(int animUser)
{
scrContext_t *v1;
unsigned int animtree_node;
const char *InstanceName;
v1 = ScriptContext_GetFromAnimUser(animUser);
if ( !v1->m_animPub.animtrees && CoreAssert_Handler("c:\\workspace\\iw8\\code_source\\src\\script\\scr_main.cpp", 1510, ASSERT_TYPE_ASSERT, "( pScrAnimPub->animtrees )", (const char *)&queryFormat, "pScrAnimPub->animtrees") )
__debugbreak();
ClearObject(v1, v1->m_animPub.animtrees);
if ( v1->m_varDebugPub.m_Inited )
--v1->m_varDebugPub.extRefCount[v1->m_animPub.animtrees];
RemoveRefToObject(v1, v1->m_animPub.animtrees);
animtree_node = v1->m_animPub.animtree_node;
v1->m_animPub.animtrees = 0;
if ( animtree_node )
RemoveRefToObject(v1, animtree_node);
SL_ShutdownSystem(2u);
if ( v1->m_varPub.programBuffer && !v1->m_varPub.endScriptBuffer )
v1->m_varPub.endScriptBuffer = TempMalloc(0i64);
*(_WORD *)&v1->m_animPub.animtree_loading = 0;
ScriptCodePos::SetVarUsagePos(&v1->m_varPub.varUsagePos, NULL);
InstanceName = ScriptContext_GetInstanceName(v1);
Com_Printf(24, "Script Anim Parsing Complete - Scr_EndLoadAnimTrees - %s\n", InstanceName);
}
/*
==============
Scr_EndLoadScripts
==============
*/
void Scr_EndLoadScripts(scrContext_t *scrContext)
{
const char *filenameExt;
char *v3;
unsigned int v4;
unsigned int i;
scrDebugFunctionInfo *v6;
__int64 v7;
bool v8;
unsigned int v9;
char *v10;
char v11;
__int64 v12;
const char *name;
unsigned int v14;
char *v15;
char v16;
char *v17;
Scr_Mem_AcquireScriptLocks();
qsort(scrContext->m_parserPub.functionList, scrContext->m_parserPub.functionCount, 0x20ui64, (_CoreCrtNonSecureSearchSortCompareFunction)Scr_CompareFunctions);
filenameExt = NULL;
v3 = NULL;
v4 = 0;
for ( i = 0; i < scrContext->m_parserPub.functionCount; v6->name = v17 )
{
v6 = &scrContext->m_parserPub.functionList[i];
if ( v6->filenameExt != filenameExt )
{
v7 = -1i64;
do
v8 = v6->filenameExt[++v7] == 0;
while ( !v8 );
v9 = v7 + v4 + 1;
filenameExt = v6->filenameExt;
if ( v9 > scrContext->m_scrDebugFunctionBufferSize )
{
Scr_DumpScrParserPubFunctionList(scrContext, i);
Com_Error_impl(ERR_DROP, (const ObfuscateErrorText)&stru_14409C630, 738i64);
filenameExt = v6->filenameExt;
}
v10 = (char *)filenameExt;
v3 = &scrContext->m_parserPub.functionBuffer[v4];
do
{
v11 = *v10;
v10[v3 - filenameExt] = *v10;
++v10;
}
while ( v11 );
v4 = v9;
}
v6->filenameExt = v3;
v12 = -1i64;
name = v6->name;
do
v8 = name[++v12] == 0;
while ( !v8 );
v14 = v12 + v4 + 1;
if ( v14 > scrContext->m_scrDebugFunctionBufferSize )
{
Scr_DumpScrParserPubFunctionList(scrContext, i);
Com_Error_impl(ERR_DROP, (const ObfuscateErrorText)&stru_14409C630, 739i64);
name = v6->name;
}
v15 = &scrContext->m_parserPub.functionBuffer[v4];
do
{
v16 = *name++;
*v15++ = v16;
}
while ( v16 );
++i;
v17 = &scrContext->m_parserPub.functionBuffer[v4];
v4 = v14;
}
if ( g_scrCanonicalStringPub.canonicalStringData )
{
if ( !g_scrCanonicalStringPub.canonicalStringLimit && CoreAssert_Handler("c:\\workspace\\iw8\\code_source\\src\\script\\scr_main.cpp", 1390, ASSERT_TYPE_ASSERT, "( g_scrCanonicalStringPub.canonicalStringLimit > 0 )", (const char *)&queryFormat, "g_scrCanonicalStringPub.canonicalStringLimit > 0") )
__debugbreak();
Scr_EndLoadEvaluate(scrContext);
SL_EndLoadScripts(scrContext);
}
SL_ShutdownSystem(2u);
if ( scrContext->m_compilePub.script_loading )
Scr_InitDebugger(scrContext, (const ScrThreadMode)scrContext->m_compilePub.loadThreadMode);
*(_WORD *)&scrContext->m_compilePub.script_loading = 0;
Scr_FreeInternalVariable(scrContext, &scrContext->m_compilePub.loadedscripts);
Scr_Mem_ReleaseScriptLocks();
Scr_FreeInternalVariable(scrContext, &scrContext->m_compilePub.scriptsPos);
Scr_FreeInternalVariable(scrContext, &scrContext->m_compilePub.scriptsCount);
Scr_FreeInternalVariable(scrContext, &scrContext->m_compilePub.scriptsDefine);
Scr_FreeInternalVariable(scrContext, &scrContext->m_compilePub.builtinFunc);
Scr_FreeInternalVariable(scrContext, &scrContext->m_compilePub.builtinMeth);
MT_Reset();
}
/*
==============
Scr_FreeInternalVariable
==============
*/
void Scr_FreeInternalVariable(scrContext_t *scrContext, unsigned int *outVariable)
{
__int64 v2;
v2 = *outVariable;
if ( !(_DWORD)v2 && CoreAssert_Handler("c:\\workspace\\iw8\\code_source\\src\\script\\scr_main.cpp", 1356, ASSERT_TYPE_ASSERT, "( localVariable != NULL_OBJECT_VARIABLE_ID )", (const char *)&queryFormat, "localVariable != NULL_OBJECT_VARIABLE_ID") )
__debugbreak();
ClearObject(scrContext, v2);
if ( scrContext->m_varDebugPub.m_Inited )
--scrContext->m_varDebugPub.extRefCount[v2];
RemoveRefToEmptyObject(scrContext, v2);
*outVariable = 0;
}
/*
==============
Scr_FreeScripts
==============
*/
void Scr_FreeScripts(scrContext_t *scrContext, unsigned __int8 sys)
{
scrContext_t *v3;
unsigned int animtree_node;
const char *InstanceName;
if ( sys != 1 && CoreAssert_Handler("c:\\workspace\\iw8\\code_source\\src\\script\\scr_main.cpp", 1547, ASSERT_TYPE_ASSERT, "( sys == SCR_SYS_GAME )", (const char *)&queryFormat, "sys == SCR_SYS_GAME") )
__debugbreak();
Scr_Mem_TempCheckClear(scrContext);
if ( scrContext->m_compilePub.script_loading )
{
scrContext->m_compilePub.script_loading = 0;
Scr_EndLoadScripts(scrContext);
}
if ( scrContext->m_animPub.animtree_loading )
{
scrContext->m_animPub.animtree_loading = 0;
v3 = ScriptContext_GetFromAnimUser(1);
if ( !v3->m_animPub.animtrees && CoreAssert_Handler("c:\\workspace\\iw8\\code_source\\src\\script\\scr_main.cpp", 1510, ASSERT_TYPE_ASSERT, "( pScrAnimPub->animtrees )", (const char *)&queryFormat, "pScrAnimPub->animtrees") )
__debugbreak();
ClearObject(v3, v3->m_animPub.animtrees);
if ( v3->m_varDebugPub.m_Inited )
--v3->m_varDebugPub.extRefCount[v3->m_animPub.animtrees];
RemoveRefToObject(v3, v3->m_animPub.animtrees);
animtree_node = v3->m_animPub.animtree_node;
v3->m_animPub.animtrees = 0;
if ( animtree_node )
RemoveRefToObject(v3, animtree_node);
SL_ShutdownSystem(2u);
if ( v3->m_varPub.programBuffer && !v3->m_varPub.endScriptBuffer )
v3->m_varPub.endScriptBuffer = TempMalloc(0i64);
*(_WORD *)&v3->m_animPub.animtree_loading = 0;
ScriptCodePos::SetVarUsagePos(&v3->m_varPub.varUsagePos, NULL);
InstanceName = ScriptContext_GetInstanceName(v3);
Com_Printf(24, "Script Anim Parsing Complete - Scr_EndLoadAnimTrees - %s\n", InstanceName);
}
Scr_Mem_AcquireScriptLocks();
Scr_ShutdownDebugger(scrContext);
Scr_ShutdownDebuggerMain(scrContext);
Scr_ShutdownEvaluate(scrContext);
SL_ShutdownSystem(1u);
Scr_ShutdownOpcodeLookup(scrContext);
Scr_Mem_ReleaseScriptLocks();
if ( !scrContext->m_varPub.programHunkUser && CoreAssert_Handler("c:\\workspace\\iw8\\code_source\\src\\script\\scr_main.cpp", 466, ASSERT_TYPE_ASSERT, "(pScrVarPub->programHunkUser)", (const char *)&queryFormat, "pScrVarPub->programHunkUser") )
__debugbreak();
Mem_HunkUser_Reset(scrContext->m_varPub.programHunkUser);
g_scrCanonicalStringPub.canonicalStringData = NULL;
if ( !scrContext->m_varPub.canonicalStringHunkUser && CoreAssert_Handler("c:\\workspace\\iw8\\code_source\\src\\script\\scr_main.cpp", 477, ASSERT_TYPE_ASSERT, "(pScrVarPub->canonicalStringHunkUser)", (const char *)&queryFormat, "pScrVarPub->canonicalStringHunkUser") )
__debugbreak();
Mem_HunkUser_Reset(scrContext->m_varPub.canonicalStringHunkUser);
Scr_Mem_TempCheckClear(scrContext);
Scr_Mem_DebugReset(scrContext);
if ( !scrContext->m_varPub.readWriteTempHunkUser && CoreAssert_Handler("c:\\workspace\\iw8\\code_source\\src\\script\\scr_main.cpp", 488, ASSERT_TYPE_ASSERT, "( pScrVarPub->readWriteTempHunkUser )", (const char *)&queryFormat, "pScrVarPub->readWriteTempHunkUser") )
__debugbreak();
if ( Mem_HunkUser_GetUsedSize(scrContext->m_varPub.readWriteTempHunkUser) && CoreAssert_Handler("c:\\workspace\\iw8\\code_source\\src\\script\\scr_main.cpp", 489, ASSERT_TYPE_ASSERT, "( Mem_HunkUser_GetUsedSize( pScrVarPub->readWriteTempHunkUser ) == 0 )", (const char *)&queryFormat, "Mem_HunkUser_GetUsedSize( pScrVarPub->readWriteTempHunkUser ) == 0") )
__debugbreak();
scrContext->m_varPub.programBuffer = NULL;
scrContext->m_compilePub.programLen = 0;
scrContext->m_varPub.checksum = 0;
scrContext->m_varPub.endScriptBuffer = NULL;
}
/*
==============
Scr_GetCurrentExtFilename
==============
*/
sval_u Scr_GetCurrentExtFilename()
{
int in_ptr_stack_top;
__int64 v2;
in_ptr_stack_top = g_pScrCompileContext->m_compilePub.in_ptr_stack_top;
if ( in_ptr_stack_top <= 0 )
LODWORD(v2) = 0;
else
LODWORD(v2) = j_SL_GetString_(extFilename[(__int64)(in_ptr_stack_top - 1)], 0, 16);
return (sval_u)v2;
}
/*
==============
Scr_GetFunctionHandle
==============
*/
__int64 Scr_GetFunctionHandle(scrContext_t *scrContext, const char *const filename, const char *const name)
{
unsigned __int64 v6;
signed int CanonicalFilename;
unsigned int Variable;
unsigned int Object;
unsigned int LowercaseString;
unsigned int v11;
VariableUnion u;
const char *programBuffer;
unsigned int v14;
VariableValue out;
if ( !scrContext->m_compilePub.scriptsPos && CoreAssert_Handler("c:\\workspace\\iw8\\code_source\\src\\script\\scr_main.cpp", 111, ASSERT_TYPE_ASSERT, "( scrContext.m_compilePub.scriptsPos )", (const char *)&queryFormat, "scrContext.m_compilePub.scriptsPos") )
__debugbreak();
v6 = -1i64;
do
++v6;
while ( filename[v6] );
if ( v6 >= 0x80 && CoreAssert_Handler("c:\\workspace\\iw8\\code_source\\src\\script\\scr_main.cpp", 113, ASSERT_TYPE_ASSERT, "( ( strlen( filename ) < 128 ) )", "%s\n\t( filename ) = %s", "( strlen( filename ) < 128 )", filename) )
__debugbreak();
CanonicalFilename = Scr_CreateCanonicalFilename(scrContext, filename);
Variable = FindVariable(scrContext, scrContext->m_compilePub.scriptsPos, CanonicalFilename);
SL_RemoveRefToString((scr_string_t)CanonicalFilename);
if ( !Variable )
return 0i64;
Object = FindObject(scrContext, Variable);
if ( !Object && CoreAssert_Handler("c:\\workspace\\iw8\\code_source\\src\\script\\scr_main.cpp", 123, ASSERT_TYPE_ASSERT, "( id )", (const char *)&queryFormat, &valueOut) )
__debugbreak();
LowercaseString = SL_FindLowercaseString(name);
if ( !LowercaseString )
return 0i64;
v11 = FindVariable(scrContext, Object, LowercaseString);
if ( !v11 )
return 0i64;
Scr_EvalVariable_Out(scrContext, v11, &out);
if ( out.type != VAR_CODEPOS && out.type != VAR_DEVELOPER_CODEPOS && CoreAssert_Handler("c:\\workspace\\iw8\\code_source\\src\\script\\scr_main.cpp", 142, ASSERT_TYPE_ASSERT, "( pos.type == VAR_CODEPOS || pos.type == VAR_DEVELOPER_CODEPOS )", (const char *)&queryFormat, "pos.type == VAR_CODEPOS || pos.type == VAR_DEVELOPER_CODEPOS") )
__debugbreak();
u = out.u;
if ( !scrContext->m_varPub.programBuffer && CoreAssert_Handler("c:\\workspace\\iw8\\code_source\\src\\script\\scr_main.cpp", 73, ASSERT_TYPE_ASSERT, "( scrContext.m_varPub.programBuffer )", (const char *)&queryFormat, "scrContext.m_varPub.programBuffer") )
__debugbreak();
if ( !u.scriptCodePosValue && CoreAssert_Handler("c:\\workspace\\iw8\\code_source\\src\\script\\scr_main.cpp", 74, ASSERT_TYPE_ASSERT, "( pos )", (const char *)&queryFormat, "pos") )
__debugbreak();
programBuffer = scrContext->m_varPub.programBuffer;
if ( u.scriptCodePosValue - (unsigned __int64)programBuffer >= scrContext->m_compilePub.programLen )
return 0i64;
if ( u.scriptCodePosValue < (unsigned __int64)programBuffer && CoreAssert_Handler("c:\\workspace\\iw8\\code_source\\src\\script\\scr_main.cpp", 151, ASSERT_TYPE_ASSERT, "( codePos >= scrContext.m_varPub.programBuffer )", (const char *)&queryFormat, "codePos >= scrContext.m_varPub.programBuffer") )
__debugbreak();
v14 = truncate_cast<int,__int64>(u.scriptCodePosValue - (unsigned __int64)scrContext->m_varPub.programBuffer);
if ( !v14 && CoreAssert_Handler("c:\\workspace\\iw8\\code_source\\src\\script\\scr_main.cpp", 153, ASSERT_TYPE_ASSERT, "( result )", (const char *)&queryFormat, "result") )
__debugbreak();
return v14;
}
/*
==============
Scr_InInline
==============
*/
bool Scr_InInline(const scrContext_t *pScrCompileContext)
{
return pScrCompileContext->m_compilePub.in_ptr_stack_top > 0;
}
/*
==============
Scr_InitProgramHunkUser
==============
*/
void Scr_InitProgramHunkUser(scrContext_t *scrContext)
{
if ( scrContext->m_varPub.programHunkUser && CoreAssert_Handler("c:\\workspace\\iw8\\code_source\\src\\script\\scr_main.cpp", 344, ASSERT_TYPE_ASSERT, "(!pScrVarPub->programHunkUser)", (const char *)&queryFormat, "!pScrVarPub->programHunkUser") )
__debugbreak();
if ( scrContext->m_varPub.canonicalStringHunkUser && CoreAssert_Handler("c:\\workspace\\iw8\\code_source\\src\\script\\scr_main.cpp", 345, ASSERT_TYPE_ASSERT, "(!pScrVarPub->canonicalStringHunkUser)", (const char *)&queryFormat, "!pScrVarPub->canonicalStringHunkUser") )
__debugbreak();
if ( scrContext->m_varPub.readWriteTempHunkUser && CoreAssert_Handler("c:\\workspace\\iw8\\code_source\\src\\script\\scr_main.cpp", 347, ASSERT_TYPE_ASSERT, "(!pScrVarPub->readWriteTempHunkUser)", (const char *)&queryFormat, "!pScrVarPub->readWriteTempHunkUser") )
__debugbreak();
scrContext->m_varPub.programHunkUser = Mem_HunkUser_Create(0x400000ui64, "scrContext.m_varPub.programHunkUser", TRACK_SCRIPT, MEM_ALLOC_FLAG_MINIMAL_TRACKING);
scrContext->m_varPub.canonicalStringHunkUser = Mem_HunkUser_Create(0x80000ui64, "scrContext.m_varPub.canonicalStringHunkUser", TRACK_SCRIPT, MEM_ALLOC_FLAG_NO_MEM_CLEAR);
scrContext->m_varPub.readWriteTempHunkUser = Mem_HunkUser_Create(0x1000000ui64, "scrContext.m_varPub.readWriteTempHunkUser", TRACK_MISC, MEM_ALLOC_FLAG_NO_MEM_CLEAR);
Scr_Mem_TempInit(scrContext);
Scr_Mem_DebugInit(scrContext);
Scr_Parser_InitHunkUsers(scrContext);
}
/*
==============
Scr_InitStringConstants
==============
*/
void Scr_InitStringConstants(const bool useReducedSpGoldLimits)
{
unsigned int v2;
if ( g_scrCanonicalStringPub.opaqueStringCount && CoreAssert_Handler("c:\\workspace\\iw8\\code_source\\src\\script\\scr_main.cpp", 524, ASSERT_TYPE_ASSERT, "( g_scrCanonicalStringPub.opaqueStringCount == 0 )", "String constants initialized multiple times") )
__debugbreak();
if ( g_scrCanonicalStringPub.canonicalStringLimit && CoreAssert_Handler("c:\\workspace\\iw8\\code_source\\src\\script\\scr_main.cpp", 525, ASSERT_TYPE_ASSERT, "( g_scrCanonicalStringPub.canonicalStringLimit == 0 )", "String constants initialized multiple times") )
__debugbreak();
v2 = 72013;
if ( useReducedSpGoldLimits )
v2 = 58048;
g_scrCanonicalStringPub.opaqueStringCount = v2;
g_scrCanonicalStringPub.canonicalStringLimit = (!useReducedSpGoldLimits << 12) + 24575;
}
/*
==============
Scr_IsIdentifier
==============
*/
char Scr_IsIdentifier(const char *token)
{
char v1;
const char *v2;
v1 = *token;
v2 = token;
if ( *token )
{
while ( (unsigned __int8)(v1 - 97) <= 0x19u || (unsigned __int8)(v1 - 65) <= 0x19u || (unsigned __int8)(v1 - 48) <= 9u || v1 == 95 )
{
v1 = *++v2;
if ( !v1 )
return 1;
}
}
return 0;
}
/*
==============
Scr_IsInOpcodeMemory
==============
*/
_BOOL8 Scr_IsInOpcodeMemory(const scrContext_t *scrContext, const char *pos)
{
if ( !scrContext->m_varPub.programBuffer && CoreAssert_Handler("c:\\workspace\\iw8\\code_source\\src\\script\\scr_main.cpp", 73, ASSERT_TYPE_ASSERT, "( scrContext.m_varPub.programBuffer )", (const char *)&queryFormat, "scrContext.m_varPub.programBuffer") )
__debugbreak();
if ( !pos && CoreAssert_Handler("c:\\workspace\\iw8\\code_source\\src\\script\\scr_main.cpp", 74, ASSERT_TYPE_ASSERT, "( pos )", (const char *)&queryFormat, "pos") )
__debugbreak();
return (unsigned __int64)(pos - scrContext->m_varPub.programBuffer) < scrContext->m_compilePub.programLen;
}
/*
==============
Scr_LoadScript
==============
*/
__int64 Scr_LoadScript(scrContext_t *scrContext, const char *filenameExt)
{
Mem_LargeLocal v5;
Mem_LargeLocal::Mem_LargeLocal(&v5, 0x8CA0ui64, "PrecacheEntry_array entries");
scrContext->m_compilePub.scriptCompileFileListCount = 0;
LODWORD(filenameExt) = Scr_LoadScriptInternal(scrContext, filenameExt, (PrecacheEntry *)v5.m_ptr, 0, 0);
Mem_LargeLocal::~Mem_LargeLocal(&v5);
return (unsigned int)filenameExt;
}
/*
==============
Scr_LoadScriptInternal
==============
*/
unsigned int Scr_LoadScriptInternal(scrContext_t *scrContext, const char *filenameExt, PrecacheEntry *entries, int entriesCount, int scopeCount)
{
unsigned __int64 v7;
scr_string_t name;
unsigned int Variable;
unsigned int NewVariable;
const char *sourceBuf;
ScrThreadMode loadThreadMode;
const char *v14;
const char *v15;
unsigned int animTreeNames;
int v17;
const char *scriptExtFilename;
unsigned int scriptsPos;
unsigned int v20;
unsigned int ObjectInternal;
unsigned int v22;
char *v23;
char v24;
char *v25;
char v26;
unsigned int fileCountId;
scr_string_t scriptFilenameExt;
unsigned int v30;
sval_u parseData;
const char *v33;
char v34[1024];
if ( !scrContext->m_compilePub.script_loading && CoreAssert_Handler("c:\\workspace\\iw8\\code_source\\src\\script\\scr_main.cpp", 948, ASSERT_TYPE_ASSERT, "( pScrCompilePub->script_loading )", (const char *)&queryFormat, "pScrCompilePub->script_loading") )
__debugbreak();
if ( !Sys_IsMainThread() && (!Sys_IsServerThread() || scrContext->m_compilePub.loadThreadMode != ASYNC_SERVER) && CoreAssert_Handler("c:\\workspace\\iw8\\code_source\\src\\script\\scr_main.cpp", 952, ASSERT_TYPE_ASSERT, "( Sys_IsMainThread() || (Sys_IsServerThread() && (pScrCompilePub->loadThreadMode == ScrThreadMode::ASYNC_SERVER)) )", (const char *)&queryFormat, "Sys_IsMainThread() || (Sys_IsServerThread() && (pScrCompilePub->loadThreadMode == ScrThreadMode::ASYNC_SERVER))") )
__debugbreak();
v7 = -1i64;
do
++v7;
while ( filenameExt[v7] );
if ( v7 >= 0x80 && CoreAssert_Handler("c:\\workspace\\iw8\\code_source\\src\\script\\scr_main.cpp", 954, ASSERT_TYPE_ASSERT, "( ( strlen( filenameExt ) < 128 ) )", "%s\n\t( filenameExt ) = %s", "( strlen( filenameExt ) < 128 )", filenameExt) )
__debugbreak();
Scr_Mem_TempCheckClear(scrContext);
name = Scr_CreateCanonicalFilename(scrContext, filenameExt);
if ( FindVariable(scrContext, scrContext->m_compilePub.loadedscripts, name) )
{
SL_RemoveRefToString(name);
Variable = FindVariable(scrContext, scrContext->m_compilePub.scriptsPos, name);
if ( Variable )
return FindObject(scrContext, Variable);
else
return 0;
}
else
{
NewVariable = GetNewVariable(scrContext, scrContext->m_compilePub.loadedscripts, name);
SL_RemoveRefToString(name);
sourceBuf = scrContext->m_parserPub.sourceBuf;
ProfLoad_Begin("Scr_AddSourceBuffer");
loadThreadMode = scrContext->m_compilePub.loadThreadMode;
v14 = TempMalloc(0i64);
v15 = Scr_AddSourceBuffer(scrContext, filenameExt, v14, 1, loadThreadMode, -1);
ProfLoad_End();
if ( v15 )
{
animTreeNames = scrContext->m_animPub.animTreeNames;
v17 = 0;
scrContext->m_animPub.animTreeNames = 0;
*(_QWORD *)&scrContext->m_compilePub.far_function_count = 0i64;
g_pScrCompileContext = scrContext;
v30 = animTreeNames;
Scr_InitAllocNode(scrContext);
scriptExtFilename = scrContext->m_parserPub.scriptExtFilename;
scrContext->m_parserPub.scriptExtFilename = filenameExt;
v33 = scriptExtFilename;
scriptFilenameExt = scrContext->m_compilePub.scriptFilenameExt;
scrContext->m_compilePub.in_ptr = "+";
scrContext->m_compilePub.scriptFilenameExt = name;
scrContext->m_compilePub.parseBuf = v15;
scrContext->m_compilePub.in_ptr_valid = 0;
ScriptParse(&parseData, 0);
scriptsPos = scrContext->m_compilePub.scriptsPos;
scrContext->m_compilePub.parseBuf = NULL;
v20 = GetVariable(scrContext, scriptsPos, name);
ObjectInternal = GetObjectInternal(scrContext, v20);
v22 = GetVariable(scrContext, scrContext->m_compilePub.scriptsCount, name);
fileCountId = GetObjectInternal(scrContext, v22);
if ( com_showParseTree->current.enabled )
{
if ( scopeCount > 0 )
{
v23 = v34;
do
{
++v23;
v24 = 32;
if ( (v17 & 1) != 0 )
v24 = 43;
++v17;
*(v23 - 1) = v24;
}
while ( v17 < scopeCount );
}
v25 = &v34[v17 - (_QWORD)filenameExt];
do
{
v26 = *filenameExt;
filenameExt[(_QWORD)v25] = *filenameExt;
++filenameExt;
}
while ( v26 );
Com_Printf(16, "%s\n", v34);
}
ProfLoad_Begin("ScriptCompile");
if ( scrContext->m_varPub.error_message )
{
Scr_ShutdownAllocNode(scrContext);
Scr_Mem_TempClear(scrContext);
}
else
{
ScriptCompile(scrContext, parseData, ObjectInternal, fileCountId, NewVariable, entries, entriesCount, name, scopeCount);
}
ProfLoad_End();
if ( !scrContext->m_varPub.error_message )
RemoveVariable(scrContext, scrContext->m_compilePub.scriptsCount, name);
scrContext->m_parserPub.scriptExtFilename = v33;
scrContext->m_parserPub.sourceBuf = sourceBuf;
scrContext->m_compilePub.scriptFilenameExt = scriptFilenameExt;
scrContext->m_animPub.animTreeNames = v30;
Scr_Mem_TempCheckClear(scrContext);
return ObjectInternal;
}
else
{
return 0;
}
}
}
/*
==============
Scr_Main_DecommitUnusedMemory
==============
*/
void Scr_Main_DecommitUnusedMemory(const scrContext_t *scrContext)
{
Mem_HunkUser_DecommitUnused(scrContext->m_varPub.programHunkUser);
Mem_HunkUser_DecommitUnused(scrContext->m_varPub.canonicalStringHunkUser);
Mem_HunkUser_DecommitUnused(scrContext->m_varPub.readWriteTempHunkUser);
Scr_Mem_TempDecommitUnused(scrContext);
Scr_Mem_DebugDecommitUnused(scrContext);
Scr_Parser_DecommitUnusedHunkUsers(scrContext);
Scr_DecommitUnusedNodeUser(scrContext);
}
/*
==============
Scr_Main_PreCommitMemory
==============
*/
void Scr_Main_PreCommitMemory(const scrContext_t *scrContext)
{
Mem_HunkUser_CommitReserve(scrContext->m_varPub.programHunkUser);
Mem_HunkUser_CommitReserve(scrContext->m_varPub.canonicalStringHunkUser);
Mem_HunkUser_CommitReserve(scrContext->m_varPub.readWriteTempHunkUser);
Scr_Mem_TempPreAllocate(scrContext);
Scr_Mem_DebugPreAllocate(scrContext);
Scr_Parser_PreCommitHunkUsers(scrContext);
Scr_PreCommitNodeUser(scrContext);
}
/*
==============
Scr_PostCompileScripts
==============
*/
void Scr_PostCompileScripts(scrContext_t *scrContext)
{
char *fmt;
__int64 v3;
unsigned int opaqueStringCount;
if ( scrContext->m_compilePub.programLen != (unsigned int)TempMalloc(0i64) - LODWORD(scrContext->m_varPub.programBuffer) && CoreAssert_Handler("c:\\workspace\\iw8\\code_source\\src\\script\\scr_main.cpp", 1244, ASSERT_TYPE_ASSERT, "( scrContext.m_compilePub.programLen == static_cast<uint>( TempMalloc( 0 ) - scrContext.m_varPub.programBuffer ) )", (const char *)&queryFormat, "scrContext.m_compilePub.programLen == static_cast<uint>( TempMalloc( 0 ) - scrContext.m_varPub.programBuffer )") )
__debugbreak();
if ( scrContext->m_animPub.animTreeNames && CoreAssert_Handler("c:\\workspace\\iw8\\code_source\\src\\script\\scr_main.cpp", 1247, ASSERT_TYPE_ASSERT, "( !scrContext.m_animPub.animTreeNames )", (const char *)&queryFormat, "!scrContext.m_animPub.animTreeNames") )
__debugbreak();
Scr_PrintLookupBufferUsage(scrContext);
Scr_PrintCompileResourceUsage(scrContext);
opaqueStringCount = g_scrCanonicalStringPub.opaqueStringCount;
LODWORD(v3) = 400;
LODWORD(fmt) = g_scrCanonicalStringPub.canonicalStringBufferSize >> 10;
Com_Printf(24, "Script compile canonical strings: count %i/%i, buffer %i/%i (kb). Opaque count %i\n", g_scrCanonicalStringPub.canonicalStringCount, g_scrCanonicalStringPub.canonicalStringLimit, fmt, v3, opaqueStringCount);
}
/*
==============
Scr_PrecacheAnimTrees
==============
*/
void Scr_PrecacheAnimTrees(void *(*Alloc)(unsigned __int64), int user, const ScrThreadMode threadMode)
{
__int64 v3;
scrContext_t *v6;
bool v7;
unsigned int i;
v3 = user;
Sys_ProfBeginNamedEvent(0xFFFFFFu, "Scr_PrecacheAnimTrees");
v6 = ScriptContext_GetFromAnimUser(v3);
XAnimPushCheckFatalErrorFlag();
v7 = Com_GameMode_SupportsFeature(WEAPON_SKYDIVE_SLOW_HARD_LAND|WEAPON_LADDER_AIM|0x80);
if ( v7 )
DB_AssetQuery_Push();
XAnimAcquireMemoryLocks();
for ( i = 1; i <= v6->m_animPub.xanim_num[v3]; ++i )
Scr_LoadAnimTreeAtIndex(i, Alloc, v3, threadMode);
Scr_ClearSharedParameterTreeNames(v6);
XanimReleaseMemoryLocks();
if ( v7 )
DB_AssetQuery_Pop();
if ( XAnimPopCheckFatalErrorFlag() )
Com_Error_impl(ERR_DROP, (const ObfuscateErrorText)&stru_14409C730, 740i64);
Sys_ProfEndNamedEvent();
}
/*
==============
Scr_ScanFile
==============
*/
__int64 Scr_ScanFile(scrContext_t *scrContext, char *buf, int max_size)
{
unsigned int v3;
__int64 v5;
__int64 v7;
const char *in_ptr;
char v9;
__int64 result;
v3 = 0;
v5 = max_size;
if ( max_size > 0 )
{
v7 = 0i64;
do
{
in_ptr = scrContext->m_compilePub.in_ptr;
v9 = *in_ptr;
scrContext->m_compilePub.in_ptr = in_ptr + 1;
if ( !v9 )
break;
if ( v9 == 10 )
{
result = v3 + 1;
buf[v3] = 10;
return result;
}
buf[v7] = v9;
++v3;
++v7;
}
while ( v7 < v5 );
if ( !v9 )
{
if ( scrContext->m_compilePub.in_ptr_valid )
{
--scrContext->m_compilePub.in_ptr;
return v3;
}
if ( !scrContext->m_compilePub.parseBuf && CoreAssert_Handler("c:\\workspace\\iw8\\code_source\\src\\script\\scr_main.cpp", 771, ASSERT_TYPE_ASSERT, "(pScrCompilePub->parseBuf)", (const char *)&queryFormat, "pScrCompilePub->parseBuf") )
__debugbreak();
scrContext->m_compilePub.in_ptr = scrContext->m_compilePub.parseBuf;
scrContext->m_compilePub.in_ptr_valid = 1;
scrContext->m_compilePub.in_ptr_stack_top = 0;
}
}
return v3;
}
/*
==============
Scr_SetupInternalVariable
==============
*/
void Scr_SetupInternalVariable(scrContext_t *scrContext, unsigned int inVariable, unsigned int *outVariable)
{
__int64 v4;
v4 = inVariable;
if ( *outVariable && CoreAssert_Handler("c:\\workspace\\iw8\\code_source\\src\\script\\scr_main.cpp", 496, ASSERT_TYPE_ASSERT, "( outVariable == NULL_OBJECT_VARIABLE_ID )", (const char *)&queryFormat, "outVariable == NULL_OBJECT_VARIABLE_ID") )
__debugbreak();
if ( scrContext->m_varDebugPub.m_Inited )
++scrContext->m_varDebugPub.extRefCount[v4];
*outVariable = v4;
}
/*
==============
Scr_Shutdown
==============
*/
void Scr_Shutdown(scrContext_t *scrContext)
{
if ( scrContext->m_varPub.bInited )
{
scrContext->m_varPub.bInited = 0;
Scr_ShutdownVariables(scrContext);
Profile_EndAllScript(scrContext);
}
}
/*
==============
Scr_ShutdownProgramHunkUser
==============
*/
void Scr_ShutdownProgramHunkUser(scrContext_t *scrContext)
{
if ( !scrContext->m_varPub.programHunkUser && CoreAssert_Handler("c:\\workspace\\iw8\\code_source\\src\\script\\scr_main.cpp", 372, ASSERT_TYPE_ASSERT, "(pScrVarPub->programHunkUser)", (const char *)&queryFormat, "pScrVarPub->programHunkUser") )
__debugbreak();
if ( !scrContext->m_varPub.canonicalStringHunkUser && CoreAssert_Handler("c:\\workspace\\iw8\\code_source\\src\\script\\scr_main.cpp", 373, ASSERT_TYPE_ASSERT, "(pScrVarPub->canonicalStringHunkUser)", (const char *)&queryFormat, "pScrVarPub->canonicalStringHunkUser") )
__debugbreak();
if ( !scrContext->m_varPub.readWriteTempHunkUser && CoreAssert_Handler("c:\\workspace\\iw8\\code_source\\src\\script\\scr_main.cpp", 375, ASSERT_TYPE_ASSERT, "(pScrVarPub->readWriteTempHunkUser)", (const char *)&queryFormat, "pScrVarPub->readWriteTempHunkUser") )
__debugbreak();
Mem_HunkUser_Destroy(scrContext->m_varPub.programHunkUser);
Mem_HunkUser_Destroy(scrContext->m_varPub.canonicalStringHunkUser);
Mem_HunkUser_Destroy(scrContext->m_varPub.readWriteTempHunkUser);
scrContext->m_varPub.programHunkUser = NULL;
scrContext->m_varPub.canonicalStringHunkUser = NULL;
scrContext->m_varPub.readWriteTempHunkUser = NULL;
Scr_Mem_TempShutdown(scrContext);
Scr_Mem_DebugShutdown(scrContext);
Scr_Parser_ShutdownHunkUsers(scrContext);
}
/*
==============
Scr_ShutdownStringConstants
==============
*/
void Scr_ShutdownStringConstants(void)
{
*(_QWORD *)&g_scrCanonicalStringPub.canonicalStringLimit = 0i64;
}
/*
==============
Scr_StartInlineLex
==============
*/
void Scr_StartInlineLex(const char *buf, int len)
{
scrContext_t *v2;
__int64 v5;
__int64 v6;
char v7;
__int64 v8;
scrContext_t *v9;
const char *v10;
int prevIndex;
__int64 v12;
__int64 v13;
char *v14;
signed __int64 v15;
int v16;
__int64 v17;
int v18;
int v19;
int v20;
ScrThreadMode loadThreadMode;
const char *v22;
char *v23;
__int64 in_ptr_stack_top;
unsigned int v25;
__int64 v26;
__int64 v27;
char Destination[256];
char dest[256];
char goldname[256];
v2 = g_pScrCompileContext;
if ( g_pScrCompileContext->m_compilePub.in_ptr_stack_top >= 4 && CoreAssert_Handler("c:\\workspace\\iw8\\code_source\\src\\script\\scr_main.cpp", 844, ASSERT_TYPE_ASSERT, "(pScrCompilePub->in_ptr_stack_top < 4)", (const char *)&queryFormat, "pScrCompilePub->in_ptr_stack_top < MAX_INLINE_DEPTH") )
LABEL_3:
__debugbreak();
while ( *buf == 32 || *buf == 9 )
{
++buf;
if ( --len <= 0 && CoreAssert_Handler("c:\\workspace\\iw8\\code_source\\src\\script\\scr_main.cpp", 850, ASSERT_TYPE_ASSERT, "(len > 0)", (const char *)&queryFormat, "len > 0") )
goto LABEL_3;
}
v5 = len;
v6 = 0x800000000002400i64;
while ( 1 )
{
v7 = buf[v5 - 1];
if ( (unsigned __int8)v7 > 0x3Bu || !_bittest64(&v6, v7) )
break;
--len;
if ( --v5 <= 0 && CoreAssert_Handler("c:\\workspace\\iw8\\code_source\\src\\script\\scr_main.cpp", 855, ASSERT_TYPE_ASSERT, "(len > 0)", (const char *)&queryFormat, "len > 0") )
__debugbreak();
}
strncpy(Destination, buf, len);
if ( (unsigned __int64)len >= 0x100 )
{
j___report_rangecheckfailure(v8);
JUMPOUT(0x14153CCCEi64);
}
Destination[len] = 0;
Com_sprintf(dest, 0x100ui64, "%s.gsh", Destination);
Scr_CreateCanonicalFilenameInternal(extFilename[(__int64)v2->m_compilePub.in_ptr_stack_top], dest, 256);
ProfLoad_Begin("Scr_AddSourceBuffer");
v9 = g_pScrCompileContext;
v10 = extFilename[(__int64)v2->m_compilePub.in_ptr_stack_top];
if ( g_pScrCompileContext->m_varPub.developer )
{
prevIndex = 0;
if ( (int)g_pScrCompileContext->m_parserPub.sourceBufferLookupLen <= 0 )
{
LABEL_39:
prevIndex = -2;
}
else
{
v12 = 0i64;
LABEL_20:
v13 = 0x7FFFFFFFi64;
v14 = v9->m_parserPub.sourceBufferLookup[v12].buf;
if ( !v10 && CoreAssert_Handler("c:\\workspace\\iw8\\shared\\codware\\core\\core_string.h", 212, ASSERT_TYPE_SANITY, "( s0 )", (const char *)&queryFormat, "s0") )
__debugbreak();
if ( !v14 && CoreAssert_Handler("c:\\workspace\\iw8\\shared\\codware\\core\\core_string.h", 213, ASSERT_TYPE_SANITY, "( s1 )", (const char *)&queryFormat, "s1") )
__debugbreak();
v15 = v10 - v14;
do
{
v16 = (unsigned __int8)v14[v15];
v17 = v13;
v18 = (unsigned __int8)*v14++;
--v13;
if ( !v17 )
break;
if ( v16 != v18 )
{
v19 = v16 + 32;
if ( (unsigned int)(v16 - 65) > 0x19 )
v19 = v16;
v16 = v19;
v20 = v18 + 32;
if ( (unsigned int)(v18 - 65) > 0x19 )
v20 = v18;
if ( v16 != v20 )
{
if ( Scr_UseSPGoldScript(v10, goldname, 0x100ui64) && !I_stricmp(goldname, v9->m_parserPub.sourceBufferLookup[v12].buf) )
break;
++prevIndex;
++v12;
if ( prevIndex < (signed int)v9->m_parserPub.sourceBufferLookupLen )
goto LABEL_20;
goto LABEL_39;
}
}
}
while ( v16 );
}
}
else
{
prevIndex = -1;
}
v2->m_compilePub.sourceBuf_stack[v2->m_compilePub.in_ptr_stack_top] = v2->m_parserPub.sourceBuf;
loadThreadMode = v2->m_compilePub.loadThreadMode;
v22 = TempMalloc(0i64);
v23 = Scr_AddSourceBuffer(g_pScrCompileContext, extFilename[(__int64)v2->m_compilePub.in_ptr_stack_top], v22, 1, loadThreadMode, prevIndex);
ProfLoad_End();
in_ptr_stack_top = v2->m_compilePub.in_ptr_stack_top;
if ( v23 )
{
g_out_pos_stack[in_ptr_stack_top] = g_out_pos;
v25 = g_sourcePos;
g_out_pos = 0;
v26 = v2->m_compilePub.in_ptr_stack_top;
g_sourcePos = 0;
g_sourcePos_stack[v26] = v25;
v2->m_compilePub.in_ptr_stack[v2->m_compilePub.in_ptr_stack_top] = v2->m_compilePub.in_ptr;
v27 = v2->m_compilePub.in_ptr_stack_top;
v2->m_compilePub.parseBuf = v23;
v2->m_compilePub.in_ptr = v23;
v2->m_compilePub.scriptExtFilename_stack[v27] = v2->m_parserPub.scriptExtFilename;
v2->m_parserPub.scriptExtFilename = extFilename[(__int64)v2->m_compilePub.in_ptr_stack_top++];
}
else
{
CompileError(g_pScrCompileContext, g_sourcePos, "Failed to find #inline file %s", extFilename[in_ptr_stack_top]);
}
}
|
ac6f49aa0a1cc5aa0897a1ea88cb277729dcb37b | 15ab41ee31e531e061190a3cd976595d094daaab | /W1E1.tests.cpp | e2a3834caeb4782a7a73a17c5f0af99e99e8507a | [] | no_license | BogdanST/Exercises | 199943fd5f475cddd804dc6b2c6b29d747d9e595 | 6a797d5b4510862849bbfd8e4a9aaadebf868818 | refs/heads/master | 2021-09-03T04:43:59.322025 | 2018-01-05T17:01:17 | 2018-01-05T17:01:17 | 85,235,777 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 474 | cpp | W1E1.tests.cpp | #include "stdafx.h"
#include "CppUnitTest.h"
#include "../Week 1 exercise 1/W1E1.cpp"
using namespace Microsoft::VisualStudio::CppUnitTestFramework;
namespace Week1Exercise1UnitTesting
{
TEST_CLASS(UnitTest1)
{
public:
TEST_METHOD(Concatenate)
{
std::string output;
std::string expected = "dtaiyme";
Concatenation newString;
output = newString.Concatenate("day","time");
Assert::AreEqual(output, expected);
}
};
} |
0054bb2b308aa23c30b701475cd3d5859605287c | 8f961bc022f5ce587d854b7458909c3e0f1ef4bb | /framework/amorphous/XML/XMLNode.hpp | 5a8100607e35f20f34fcc0992a3eb9ac9b1fed0d | [] | no_license | takashikumagai/amorphous | 73f0bd8c5f5d947a71bbad696ce728f25c456aae | 8e5f5ec9368757a639ed4cf7aeb02a4b201e6b42 | refs/heads/master | 2020-05-17T10:55:59.428403 | 2018-07-05T02:48:59 | 2018-07-05T02:48:59 | 183,671,422 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 7,016 | hpp | XMLNode.hpp | #ifndef __XMLNode_HPP__
#define __XMLNode_HPP__
#include <string>
#include <vector>
#include <memory>
#include "amorphous/Support/StringAux.hpp"
#include "amorphous/3DMath/Vector3.hpp"
#include "amorphous/Graphics/FloatRGBColor.hpp"
#include "amorphous/Graphics/FloatRGBAColor.hpp"
#include "amorphous/Graphics/Rect.hpp"
#include "fwd.hpp"
namespace amorphous
{
//
// Inline Global Functions (used by CXMLNodeReader::GetAttributeValue())
//
inline void conv_to_x( const std::string& src, int& dest )
{
dest = atoi( src.c_str() );
}
inline void conv_to_x( const std::string& src, uint& dest )
{
dest = (uint)atoi( src.c_str() );
}
inline void conv_to_x( const std::string& src, short& dest )
{
dest = (short)atoi( src.c_str() );
}
inline void conv_to_x( const std::string& src, float& dest )
{
dest = (float)atof( src.c_str() );
}
inline void conv_to_x( const std::string& src, double& dest )
{
dest = atof( src.c_str() );
}
inline void conv_to_x( const std::string& src, std::string& dest )
{
dest = src;
}
inline void conv_to_x( const std::string& src, bool& dest )
{
if( src == "true" )
dest = true;
else if( src == "false" )
dest = false;
}
class XMLNodeImpl
{
public:
XMLNodeImpl(){}
virtual ~XMLNodeImpl(){}
virtual bool IsValid() const { return false; }
virtual bool GetChildElementTextContent( const std::string& child_element_path, std::string& dest ) const { return false; }
virtual bool GetChildElementTextContentLTWH( const std::string& child_element_path, SRect& dest ) const { return false; }
virtual bool GetChildElementTextContentLTRB( const std::string& child_element_path, SRect& dest ) const { return false; }
virtual bool GetChildElementTextContentRGB( const std::string& child_element_path, SFloatRGBColor& dest ) const { return false; }
virtual bool GetChildElementTextContentRGB( const std::string& child_element_path, SFloatRGBAColor& dest ) const { return false; }
virtual bool GetChildElementTextContentRGBA( const std::string& child_element_path, SFloatRGBAColor& dest ) const { return false; }
virtual bool GetChildElementTextContent( const std::string& child_element_path, Vector3& dest ) const { return false; }
virtual std::string GetName() { return ""; }
virtual XMLNode GetChild( const std::string& name ) = 0;//{ return XMLNode(); }
/**
\return true if the attribute with the name 'attrib_name' was found, false otherwise
*/
virtual bool GetAttributeText( const std::string& attrib_name, std::string& dest ) { return false; }
virtual std::string GetAttributeText( const std::string& attrib_name ) { return ""; }
// template<typename T>
// inline void GetAttributeValue( const std::string& attrib_name, T& dest );
virtual std::vector<XMLNode> GetImmediateChildren( const std::string& name ) = 0;//{ return std::vector<XMLNode>(); }
virtual std::vector<XMLNode> GetImmediateChildren() = 0;//{ return std::vector<XMLNode>(); }
};
class XMLNode
{
std::shared_ptr<XMLNodeImpl> m_pImpl;
public:
XMLNode(){}
XMLNode( std::shared_ptr<XMLNodeImpl> pImpl ) : m_pImpl(pImpl) {}
~XMLNode(){}
bool IsValid() const { return m_pImpl->IsValid(); }
/// get the text content of a child node
template<typename T>
inline bool GetChildElementTextContent( const std::string& child_element_path, T& dest ) const;
bool GetChildElementTextContent( const std::string& child_element_path, std::string& dest ) const { return m_pImpl->GetChildElementTextContent(child_element_path,dest); }
bool GetChildElementTextContentLTWH( const std::string& child_element_path, SRect& dest ) const { return m_pImpl->GetChildElementTextContentLTWH(child_element_path,dest); }
bool GetChildElementTextContentLTRB( const std::string& child_element_path, SRect& dest ) const { return m_pImpl->GetChildElementTextContentLTRB(child_element_path,dest); }
bool GetChildElementTextContentRGB( const std::string& child_element_path, SFloatRGBColor& dest ) const { return m_pImpl->GetChildElementTextContentRGB(child_element_path,dest); }
bool GetChildElementTextContentRGB( const std::string& child_element_path, SFloatRGBAColor& dest ) const { return m_pImpl->GetChildElementTextContentRGB(child_element_path,dest); }
bool GetChildElementTextContentRGBA( const std::string& child_element_path, SFloatRGBAColor& dest ) const { return m_pImpl->GetChildElementTextContentRGBA(child_element_path,dest); }
bool GetChildElementTextContent( const std::string& child_element_path, Vector3& dest ) const { return m_pImpl->GetChildElementTextContent(child_element_path,dest); }
/// get the text content of the current node
inline std::string GetTextContent() const { std::string dest; GetTextContent(dest); return dest; }
template<typename T>
inline bool GetTextContent( T& dest ) const { return GetChildElementTextContent( "", dest ); }
inline bool GetTextContentLTWH( SRect& dest ) const { return GetChildElementTextContentLTWH( "", dest ); }
inline bool GetTextContentLTRB( SRect& dest ) const { return GetChildElementTextContentLTRB( "", dest ); }
inline bool GetTextContentRGB( SFloatRGBColor& dest ) const { return GetChildElementTextContentRGB( "", dest ); }
inline bool GetTextContentRGB( SFloatRGBAColor& dest ) const { return GetChildElementTextContentRGB( "", dest ); }
inline bool GetTextContentRGBA( SFloatRGBAColor& dest ) const { return GetChildElementTextContentRGBA( "", dest ); }
inline bool GetTextContent( Vector3& dest ) const { return GetChildElementTextContent( "", dest ); }
std::string GetName() const { return m_pImpl->GetName(); }
XMLNode GetChild( const std::string& name ) const { return m_pImpl->GetChild(name); }
std::string GetAttributeText( const std::string& attrib_name ) const { return m_pImpl->GetAttributeText(attrib_name); }
template<typename T>
inline void GetAttributeValue( const std::string& attrib_name, T& dest ) const;
std::vector<XMLNode> GetImmediateChildren( const std::string& name ) const { return m_pImpl->GetImmediateChildren(name); }
std::vector<XMLNode> GetImmediateChildren() const { return m_pImpl->GetImmediateChildren(); }
};
template<typename T>
inline bool XMLNode::GetChildElementTextContent( const std::string& child_element_path, T& dest ) const
{
std::string text;
bool res = GetChildElementTextContent( child_element_path, text );
if( res )
{
conv_to_x( text, dest );
return true;
}
else
return false;
}
/// Udpates the values of dest if the attribute with the specified name is found in the node.
/// If the attribute is not found, the value of dest is not changed.
template<typename T>
inline void XMLNode::GetAttributeValue( const std::string& attrib_name, T& dest ) const
{
std::string text;
bool attribute_found = m_pImpl->GetAttributeText( attrib_name, text );
if( !attribute_found )
return;
if( 0 < text.length() )
conv_to_x( text, dest );
}
} // namespace amorphous
#endif /* __XMLNode_HPP__ */
|
200dd27f6f9875aa9b03c969e0e2f89c5e0c5392 | dd4387aff658e5c49508dc1077096e68130f31be | /bitset.hpp | a02e3ae6fd149012fee73cc26c8ff9e5652ccc82 | [] | no_license | HomuraVehicle/XCBase | 7c8a9dbc5ceefa639c7ed1d5e32a33e07b321c1d | f77761837798b923856d717d07ea48a7553d27eb | refs/heads/master | 2021-01-17T07:48:12.791306 | 2017-02-19T13:09:15 | 2017-02-19T13:09:15 | 41,242,381 | 0 | 0 | null | 2017-02-19T09:57:45 | 2015-08-23T08:41:10 | C++ | UTF-8 | C++ | false | false | 3,232 | hpp | bitset.hpp | #ifndef XCBASE_BITSET_INC
#define XCBASE_BITSET_INC 100
#
namespace xc{
template<unsigned int size_, bool overflow_ = (size_>32)>
struct bitset{
typedef bitset<size_, false> this_bitset;
private:
unsigned int Bits;
struct reference{
private:
unsigned int& Bits;
unsigned int Acs;
public:
reference(unsigned int& Bits_, unsigned int Acs_)
:Bits(Bits_)
, Acs(Acs_){
}
reference& operator=(bool val){
if(val)Bits = ((Bits&(~Acs)) | Acs);
else Bits = (Bits&(~Acs));
return *this;
}
operator bool(){ return (Bits&Acs)!=0; }
};
public:
bitset():Bits(0){}
bitset(unsigned int Bits_):Bits(Bits_){}
public:
reference operator[](unsigned int pos){
return reference(Bits, (1 << pos));
}
void set(){ Bits = 0xffffffff; }
void reset(){ Bits = 0; }
void set(unsigned int pos, bool val = true){
unsigned int Acs = (1 << pos);
if(val)Bits = (Bits&(~Acs)) | Acs;
else Bits = (Bits&(~Acs));
}
void reset(unsigned int pos){
unsigned int Acs = (1 << pos);
Bits = (Bits&(~Acs));
}
this_bitset& operator<<=(unsigned int num){
Bits <<= num;
return *this;
}
this_bitset& operator>>=(unsigned int num){
Bits <<= (32 - size_);
Bits >>= (32 - size_) + num;
return *this;
}
this_bitset& operator&=(const this_bitset& Other){
Bits &= Other.Bits;
return *this;
}
this_bitset& operator|=(const this_bitset& Other){
Bits |= Other.Bits;
return *this;
}
this_bitset& operator^=(const this_bitset& Other){
Bits ^= Other.Bits;
return *this;
}
this_bitset& operator~(){
Bits = ~Bits;
return *this;
}
void flip(){
operator~();
}
this_bitset operator<<(unsigned num){
this_bitset Other(*this);
Other <<= num;
return Other;
}
this_bitset operator >> (unsigned num){
this_bitset Other(*this);
Other >>= num;
return Other;
}
friend this_bitset operator&(const this_bitset& Bits1, const this_bitset& Bits2){
this_bitset Other(Bits1);
Other &= Bits2;
return Other;
}
friend this_bitset operator|(const this_bitset& Bits1, const this_bitset& Bits2){
this_bitset Other(Bits1);
Other |= Bits2;
return Other;
}
friend this_bitset operator^(const this_bitset& Bits1, const this_bitset& Bits2){
this_bitset Other(Bits1);
Other ^= Bits2;
return Other;
}
friend bool operator==(const this_bitset& Bits1, const this_bitset& Bits2){
return (Bits1.Bits << (32 - size_) == Bits2.Bits << (32 - size_));
}
friend bool operator!=(const this_bitset& Bits1, const this_bitset& Bits2){
return (Bits1.Bits << (32 - size_) != Bits2.Bits << (32 - size_));
}
public:
unsigned int count()const{
unsigned int Cnt = 0;
unsigned int CopyBits = Bits;
for(unsigned int i = 0; i < size_; ++i){
if(CopyBits & 1)++Cnt;
CopyBits >>= 1;
}
return Cnt;
}
unsigned int size()const{ return size_; }
bool test(unsigned int pos)const{
return (Bits >> pos) & 1;
}
bool any()const{
return static_cast<bool>(Bits << (32 - size_));
}
bool all()const{
return !static_cast<bool>((~Bits) << (32 - size_));
}
bool none()const{
return !any();
}
};
template<unsigned int size_>
struct bitset<size_, true>{};
}
#
#endif
|
fd3bbf714bdbf41752c10ca3b50af9b7bc417f4c | 71c8702211dc84b0311d52b7cfa08c85921d660b | /codeforces/96A - Football.cpp | 87112a01c919a38a02349fab05e25cedcb6ee3c4 | [] | no_license | mubasshir00/competitive-programming | b8a4301bba591e38384a8652f16b413853aa631b | 7eda0bb3dcc2dc44c516ce47046eb5da725342ce | refs/heads/master | 2023-07-19T21:01:18.273419 | 2023-07-08T19:05:44 | 2023-07-08T19:05:44 | 226,463,398 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 421 | cpp | 96A - Football.cpp | #include<bits/stdc++.h>
using namespace std ;
int main()
{
string s1,s2,s3;
cin>>s1;
s2= "0000000";
s3= "1111111";
if(s1.find(s2) != string::npos)
{
cout<<"YES"<<endl;
}
else if(s1.find(s3) != string::npos)
{
cout<<"YES"<<endl;
}
else cout<<"NO"<<endl;
return 0 ;
}
|
fa0e97b51894c50f1a8fa3d9f59ba595218cf52f | 08ef2ecbd1485236a0bf721012430dee8b0b1e47 | /LatteArtMachine/CalibrationDlg.h | 399e0b144320448d2c911d6a497b165f576248f4 | [] | no_license | kuwa2san/LatteArtMachineController | 1c4f1f40e202c504ebc1d71c3d41c2f37481bb00 | 5047402a564eba39eff226612055b0b320ee0991 | refs/heads/master | 2021-01-01T18:34:16.730139 | 2013-04-12T18:16:19 | 2013-04-12T18:16:19 | null | 0 | 0 | null | null | null | null | SHIFT_JIS | C++ | false | false | 1,019 | h | CalibrationDlg.h | ////////////////////////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "afxwin.h"
#include "LatteArtCommand.h"
////////////////////////////////////////////////////////////////////////////////////////////////////
// CCalibrationDlg ダイアログ
////////////////////////////////////////////////////////////////////////////////////////////////////
class CCalibrationDlg : public CDialog
{
DECLARE_DYNAMIC(CCalibrationDlg)
public:
CCalibrationDlg(CWnd* pParent = NULL); // 標準コンストラクタ
virtual ~CCalibrationDlg();
// ダイアログ データ
enum { IDD = IDD_CALIBDLG };
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV サポート
DECLARE_MESSAGE_MAP()
public:
afx_msg void OnBnClickedOk();
afx_msg void OnBnClickedCancel();
afx_msg void OnBnClickedSavechanges();
private:
CEdit m_EditCupDiameter;
CEdit m_EditCalibRepeat;
CEdit m_EditAccuracy;
void LoadCalibParam(void);
virtual BOOL OnInitDialog();
};
|
de4bdc26adf2c3eedc8c947ad51020b5a3db7fe9 | a363aafb61ea9b2d97340fc8c5a3807115002488 | /src/xor/xor_decryptor.hpp | 9fe42084c800568e8942ad5b448929da089e6f87 | [] | no_license | LesnyRumcajs/MatasanoCpp | e8c50a8d77353f8493ef72455252bf098a503cd3 | 43e5a160c6ca077088836a7c7438c4f08fd36f22 | refs/heads/master | 2020-03-25T22:07:32.194443 | 2018-10-16T21:41:18 | 2018-10-16T21:41:18 | 144,206,901 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,355 | hpp | xor_decryptor.hpp | #ifndef MATASANOCPP_XOR_DECRYPTOR_HPP
#define MATASANOCPP_XOR_DECRYPTOR_HPP
#include <string>
#include <vector>
class XorDecryptor {
public:
struct PlaintextResult {
std::string text;
int score;
int key;
PlaintextResult(const std::string &text, int score, int key);
};
/**
* Decrypts hex-encoded ciphertext encrypted with single byte key
* @param hex-encoded ciphertext
* @return Plaintext with score
*/
PlaintextResult decrypt_hex(const std::string &hex_ciphertext) const;
/**
* Decrypts ciphertext encrypted with single byte key
* @param encoded ciphertext
* @return Plaintext with score
*/
PlaintextResult decrypt(const std::vector<uint8_t> &ciphertext) const;
/**
* Decrypts multiple hex-encoded strings and returns plaintext with the highest score
* @param hex-encoded candidates
* @return Plaintext with score
*/
PlaintextResult decrypt_best_hex(const std::vector<std::string> &ciphertexts) const;
/**
* Decrypts multiple ciphertext candidates and returns plaintext with the highest score
* @param hex-encoded candidates
* @return Plaintext with score
*/
PlaintextResult decrypt_best(const std::vector<std::vector<uint8_t>> &ciphertexts) const;
};
#endif //MATASANOCPP_XOR_DECRYPTOR_HPP
|
8de0069f5938e252d69985a907a0c0cd96615a0d | 9471b2743486250464fe6a7e962f663033fdb265 | /POJ/2295/2021996_AC_0MS_208K.cc | 09c0b8f3151e27bad31fcf66c0e27223e93547f8 | [] | no_license | liruqi/topcoder | 25d1ce9fdb836c94d8229f11dc74e3e3a9819e53 | 17df44464c91db51a1a24a9658c41ccb1501870b | refs/heads/master | 2023-01-23T00:13:11.810623 | 2023-01-13T01:28:12 | 2023-01-13T01:28:12 | 6,572,063 | 6 | 6 | null | 2014-11-16T09:17:56 | 2012-11-07T00:31:47 | C++ | UTF-8 | C++ | false | false | 1,659 | cc | 2021996_AC_0MS_208K.cc | #include <iostream>
using namespace std;
char str[261];
int readNum(int s, int e){
int length=e-s+1;
int r=1;
if(e>=s) r=str[e]-'0';
if(e-1>=s) r+=(str[e-1]-'0')*10;
if(e-2>=s) r+=(str[e-2]-'0')*100;
return r;
}
int main()
{
int start,end;
int xcoef,ccoef;
int i,t;cin>>t;
while(t--){
cin>>str;
xcoef=0; ccoef=0;i=0;
while(str[i]!='='){
start=i;
for(i++; str[i]!='+'&&str[i]!='-'&&str[i]!='=';i++);
end=i-1;
if(str[end]=='x'){
if(str[start]=='-')
xcoef-=readNum(start+1, end-1);
else if(str[start]=='+')
xcoef+=readNum(start+1, end-1);
else
xcoef+=readNum(start, end-1);
}
else{
if(str[start]=='-')
ccoef-=readNum(start+1, end);
else if(str[start]=='+')
ccoef+=readNum(start+1, end);
else
ccoef+=readNum(start, end);
}
}
i++;
while(str[i]!='\0'){
start=i;
for(i++; str[i]!='+'&&str[i]!='-'&&str[i]!='\0';i++);
end=i-1;
if(str[end]=='x'){
if(str[start]=='-')
xcoef+=readNum(start+1, end-1);
else if(str[start]=='+')
xcoef-=readNum(start+1, end-1);
else
xcoef-=readNum(start, end-1);
}
else{
if(str[start]=='-')
ccoef+=readNum(start+1, end);
else if(str[start]=='+')
ccoef-=readNum(start+1, end);
else
ccoef-=readNum(start, end);
}
}
if(xcoef==0){
if(ccoef)
cout<<"IMPOSSIBLE"<<endl;
else
cout<<"IDENTITY"<<endl;
}
else{
ccoef*=-1;
i=ccoef/xcoef;
if(i<=0 && (ccoef%xcoef))
i--;
cout<<i<<endl;
}
}
return 0;
}
|
8a9cc7d27a8a1d1c12dd45f7b3e5a5f3c0fa67e3 | 27d802d95b1feb231ef817abfb6b3ad9b428fa23 | /c++ooc/operator_overloading.cpp | f148136b2c20c414ab4eceea62d9340eb478a604 | [] | no_license | virtualvector/DataStructures | 4f052625a0f58c2a29188d538856939e75ca2de2 | afad481823a71e14cbf2557faa483572cd4f1891 | refs/heads/master | 2021-01-23T05:10:12.585018 | 2018-05-31T10:33:38 | 2018-05-31T10:33:38 | 92,958,650 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 518 | cpp | operator_overloading.cpp | #include<iostream>
#include<cstdio>
using namespace std;
class A
{
int x;
public:
int getter();
void setter(int x);
A operator+(const A& c);
};
void A::setter(int x)
{
this->x = x;
}
int A::getter()
{
return this->x;
}
A A::operator+(const A& a)
{
int m = this->x + a.x;
A c;
c.setter(m);
return c;
}
int main()
{
A a1,a2;
a1.setter(2);
a2.setter(3);
A c;
c = a1+a2;
cout<<c.getter()<<endl;
}
|
e28f856fcb2f5ebc8bda52f7357597b88c89ca14 | bef5190175e5b24c32e0c9fc563eb01f81b76bf6 | /COM/NET/COMNet/Chapter11/NoteDemo/NoteDemo.cpp | ed6a519ccb2d56d826f68906e751ec5a2cd2163d | [
"LicenseRef-scancode-oreilly-notice"
] | permissive | 15831944/Object-Management | 61e4573a07b26469de63f4f650326cba830fa73e | 4ad2749c90b7d9c167eedcf0d614e745a7c9b63b | refs/heads/master | 2023-03-18T14:10:18.781740 | 2020-02-11T11:07:21 | 2020-02-11T11:07:21 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 13,977 | cpp | NoteDemo.cpp | //======================================================================
// NoteDemo - Demonstrates the Windows CE Notification API
//
// Written for the book Programming Windows CE
// Copyright (C) 2003 Douglas Boling
//======================================================================
#include <windows.h> // For all that Windows stuff
#include <notify.h> // For notification defines
#include "NoteDemo.h" // Program-specific stuff
//----------------------------------------------------------------------
// Global data
//
const TCHAR szAppName[] = TEXT ("NoteDemo");
HINSTANCE hInst; // Program instance handle
HWND g_hMain;
CE_USER_NOTIFICATION g_ceun; // User notification structure
TCHAR szDlgTitle[] = TEXT ("Notification Demo");
TCHAR szDlgText[] = TEXT ("Times Up!");
TCHAR szSound[MAX_PATH] = TEXT ("alarm1.wav");
// Used for timer event notification
TCHAR szEventName[] = TEXT ("Bob");
HANDLE g_hNoteEvent = 0;
BOOL g_fContinue = TRUE;
// Message dispatch table for MainWindowProc
const struct decodeUINT MainMessages[] = {
WM_INITDIALOG, DoInitDialogMain,
WM_COMMAND, DoCommandMain,
MYMSG_TELLNOTIFY, DoTellNotifyMain,
};
// Command Message dispatch for MainWindowProc
const struct decodeCMD MainCommandItems[] = {
IDOK, DoMainCommandExit,
IDCANCEL, DoMainCommandExit,
IDD_ADDUSERNOT, DoMainCommandAddUserNotification,
IDD_CFGUSERNOT, DoMainCommandConfigUserNotification,
IDD_ADDSYSNOT, DoMainCommandAddSysNotification,
IDD_ADDTIMENOT, DoMainCommandAddTimerNotification,
IDD_CLEARNOT, DoMainCommandClearNotifications,
};
//======================================================================
// Program entry point
//
int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPWSTR lpCmdLine, int nCmdShow) {
INT i;
TCHAR szText[MAX_PATH];
WCHAR *pPtr;
HANDLE hNotify;
HWND hWnd;
HANDLE hThread;
hInst = hInstance;
if (*lpCmdLine) {
pPtr = lpCmdLine;
// Parse the first word of the command line.
for (i = 0; (i < dim(szText)-1) && (*pPtr > TEXT (' ')); i++)
szText[i] = *pPtr++;
szText[i] = TEXT ('\0');
// Check to see if app started due to notification.
if (lstrcmp (szText, APP_RUN_TO_HANDLE_NOTIFICATION) == 0) {
// Acknowledge the notification.
GetModuleFileName (hInst, szText, sizeof (szText));
CeHandleAppNotifications (szText);
// Get handle of command line.
hNotify = (HANDLE)_wtol (pPtr);
// Look to see if another instance of the app is running.
hWnd = FindWindow (NULL, szAppName);
if (hWnd) {
SendMessage (hWnd, MYMSG_TELLNOTIFY, 0,
(LPARAM)hNotify);
// I should terminate this app here, but I don't so you
// can see what happens.
return 0;
}
}
}
// Do a little initialization of CE_USER_NOTIFICATION.
memset (&g_ceun, 0, sizeof (g_ceun));
g_ceun.ActionFlags = PUN_DIALOG;
g_ceun.pwszDialogTitle = szDlgTitle;
g_ceun.pwszDialogText = szDlgText;
g_ceun.pwszSound = szSound;
g_ceun.nMaxSound = sizeof (szSound);
// Create secondary thread for timer event notification.
g_hNoteEvent = CreateEvent (NULL, FALSE, FALSE, szEventName);
hThread = CreateThread (NULL, 0, MonitorThread, hWnd, 0, (DWORD *)&i);
if (hThread == 0)
return -1;
// Display dialog box as main window.
DialogBoxParam (hInstance, szAppName, NULL, MainDlgProc,
(LPARAM)lpCmdLine);
// Signal notification thread to terminate
g_fContinue = FALSE;
SetEvent (g_hNoteEvent);
WaitForSingleObject (hThread, 1000);
CloseHandle (hThread);
CloseHandle (g_hNoteEvent);
return 0;
}
//======================================================================
// Message handling procedures for main window
//----------------------------------------------------------------------
// MainDlgProc - Callback function for application window
//
BOOL CALLBACK MainDlgProc (HWND hWnd, UINT wMsg, WPARAM wParam,
LPARAM lParam) {
INT i;
//
// Search message list to see if we need to handle this
// message. If in list, call procedure.
//
for (i = 0; i < dim(MainMessages); i++) {
if (wMsg == MainMessages[i].Code)
return (*MainMessages[i].Fxn)(hWnd, wMsg, wParam, lParam);
}
return FALSE;
}
//----------------------------------------------------------------------
// DoInitDialogMain - Process WM_INITDIALOG message for window.
//
BOOL DoInitDialogMain (HWND hWnd, UINT wMsg, WPARAM wParam,
LPARAM lParam) {
g_hMain = hWnd;
if (*(LPTSTR)lParam)
Add2List (hWnd, (LPTSTR)lParam);
return FALSE;
}
//----------------------------------------------------------------------
// DoCommandMain - Process WM_COMMAND message for window.
//
BOOL DoCommandMain (HWND hWnd, UINT wMsg, WPARAM wParam, LPARAM lParam){
WORD idItem, wNotifyCode;
HWND hwndCtl;
INT i;
// Parse the parameters.
idItem = (WORD) LOWORD (wParam);
wNotifyCode = (WORD) HIWORD (wParam);
hwndCtl = (HWND) lParam;
// Call routine to handle control message.
for (i = 0; i < dim(MainCommandItems); i++) {
if (idItem == MainCommandItems[i].Code) {
(*MainCommandItems[i].Fxn)(hWnd, idItem, hwndCtl,
wNotifyCode);
return TRUE;
}
}
return FALSE;
}
//----------------------------------------------------------------------
// DoTellNotifyMain - Process MYMSG_TELLNOTIFY message for window.
//
BOOL DoTellNotifyMain (HWND hWnd, UINT wMsg, WPARAM wParam,
LPARAM lParam) {
Add2List (hWnd, TEXT ("Notification %d reported"), lParam);
SetForegroundWindow ((HWND)((DWORD)hWnd | 0x01));
return 0;
}
//======================================================================
// Command handler routines
//----------------------------------------------------------------------
// DoMainCommandExit - Process Program Exit command.
//
LPARAM DoMainCommandExit (HWND hWnd, WORD idItem, HWND hwndCtl,
WORD wNotifyCode) {
EndDialog (hWnd, 0);
return 0;
}
//----------------------------------------------------------------------
// DoMainCommandAddUserNotification - Process Add User Notify button.
//
LPARAM DoMainCommandAddUserNotification (HWND hWnd, WORD idItem,
HWND hwndCtl, WORD wNotifyCode) {
SYSTEMTIME st, ste;
TCHAR szExeName[MAX_PATH], szText[128];
TCHAR szArgs[128] = TEXT("This is my user notification string.");
CE_NOTIFICATION_TRIGGER nt;
HANDLE hNotify;
// Initialize time structure with local time.
GetLocalTime (&st);
// Do a trivial amount of error checking.
st.wMinute++;
if (st.wMinute > 59) {
st.wHour++;
st.wMinute -= 60;
}
// Set end time 10 minutes past start.
ste = st;
// Do a trivial amount of error checking.
ste.wMinute += 10;
if (ste.wMinute > 59) {
ste.wHour++;
ste.wMinute -= 60;
}
memset (&nt, 0, sizeof (CE_NOTIFICATION_TRIGGER));
nt.dwSize = sizeof (CE_NOTIFICATION_TRIGGER);
nt.dwType = CNT_PERIOD;
nt.lpszApplication = szExeName;
nt.lpszArguments = szArgs;
nt.stStartTime = st;
nt.stEndTime = ste;
GetModuleFileName (hInst, szExeName, sizeof (szExeName));
hNotify = CeSetUserNotificationEx (0, &nt, &g_ceun);
// Tell the user the notification was set.
if (hNotify)
wsprintf (szText, TEXT ("User notification set for %d:%02d:%02d"),
st.wHour, st.wMinute, st.wSecond);
else
wsprintf (szText, TEXT ("User notification failed. rc = %d"),
GetLastError());
MessageBox (hWnd, szText, szAppName, MB_OK);
return 0;
}
//----------------------------------------------------------------------
// DoMainCommandConfigUserNotification - Process Config user
// notification button.
//
LPARAM DoMainCommandConfigUserNotification (HWND hWnd, WORD idItem,
HWND hwndCtl, WORD wNotifyCode) {
// Display the system-provided configuration dialog.
CeGetUserNotificationPreferences (hWnd, &g_ceun);
return 0;
}
//----------------------------------------------------------------------
// DoMainCommandAddSysNotification - Process Add Sys notify button.
//
LPARAM DoMainCommandAddSysNotification (HWND hWnd, WORD idItem,
HWND hwndCtl, WORD wNotifyCode) {
DialogBox (hInst, TEXT ("SysNotifyConfig"), hWnd,
SetEventNotifyDlgProc);
return 0;
}
//----------------------------------------------------------------------
// DoMainCommandAddTimerNotification - Process add timer notify button.
//
LPARAM DoMainCommandAddTimerNotification (HWND hWnd, WORD idItem,
HWND hwndCtl, WORD wNotifyCode) {
SYSTEMTIME st;
HANDLE hNotify;
CE_NOTIFICATION_TRIGGER nt;
TCHAR szExeName[MAX_PATH], szText[128];
TCHAR szArgs[128] = TEXT("This is my timer notification string.");
// Initialize time structure with local time.
GetLocalTime (&st);
// Do a trivial amount of error checking.
if (st.wMinute == 59) {
st.wHour++;
st.wMinute = 0;
} else
st.wMinute++;
memset (&nt, 0, sizeof (CE_NOTIFICATION_TRIGGER));
nt.dwSize = sizeof (CE_NOTIFICATION_TRIGGER);
nt.dwType = CNT_TIME;
nt.lpszApplication = szExeName;
nt.lpszArguments = szArgs;
nt.stStartTime = st;
lstrcpy (szExeName, NAMED_EVENT_PREFIX_TEXT);
lstrcat (szExeName, szEventName);
// Set the notification.
hNotify = CeSetUserNotificationEx (0, &nt, NULL);
if (hNotify)
wsprintf (szText, TEXT ("Timer notification set for %d:%02d:%02d"),
st.wHour, st.wMinute, st.wSecond);
else
wsprintf (szText, TEXT ("Timer notification failed. rc = %d"),
GetLastError());
MessageBox (hWnd, szText, szAppName, MB_OK);
return 0;
}
//----------------------------------------------------------------------
// DoMainCommandClearNotifications - Clear all notifications pointing
// to this application. Note: this is a fairly large stack frame.
//
LPARAM DoMainCommandClearNotifications (HWND hWnd, WORD idItem,
HWND hwndCtl, WORD wNotifyCode) {
PBYTE pBuff = NULL;
PCE_NOTIFICATION_INFO_HEADER pnih;
HANDLE hNotHandles[128]; // Assume this is large enough.
int rc, nCnt = 0;
TCHAR szExeName[MAX_PATH], szText[128];
DWORD i, dwSize, nHandCnt = 0;
// Get our filename.
GetModuleFileName (hInst, szExeName, sizeof (szExeName));
pBuff = (PBYTE)LocalAlloc (LPTR, 8192);
if (!pBuff) {
MessageBox (hWnd, TEXT ("Out of memory"), szAppName, MB_OK);
return 0;
}
rc = CeGetUserNotificationHandles (hNotHandles, dim (hNotHandles),
&nHandCnt);
if (rc) {
for (i = 0; i < nHandCnt; i++) {
// Query info on a single handle.
rc = CeGetUserNotification (hNotHandles[i], 8192,
&dwSize, pBuff);
if (rc) {
pnih = (PCE_NOTIFICATION_INFO_HEADER)pBuff;
if (!lstrcmp (pnih->pcent->lpszApplication, szExeName)){
if (CeClearUserNotification (pnih->hNotification))
nCnt++;
}
}
}
wsprintf (szText, TEXT ("Cleared %d notifications"), nCnt);
MessageBox (hWnd, szText, szAppName, MB_OK);
} else
MessageBox (hWnd, TEXT ("Could not query handles"),
szAppName, MB_OK);
LocalFree (pBuff);
return 0;
}
//----------------------------------------------------------------------
// MySetEventNotification - Sets event notifications
//
int MySetEventNotification (HWND hWnd, DWORD dwEvent) {
TCHAR szArgs[] = TEXT("This is my event notification string.");
CE_NOTIFICATION_TRIGGER nt;
HANDLE hNotify;
TCHAR szExeName[MAX_PATH], szText[128];
memset (&nt, 0, sizeof (CE_NOTIFICATION_TRIGGER));
nt.dwSize = sizeof (CE_NOTIFICATION_TRIGGER);
nt.dwType = CNT_EVENT;
nt.dwEvent = dwEvent;
nt.lpszApplication = szExeName;
nt.lpszArguments = szArgs;
GetModuleFileName (hInst, szExeName, sizeof (szExeName));
// Set the notification.
hNotify = CeSetUserNotificationEx (0, &nt, NULL);
if (hNotify)
wsprintf (szText, TEXT ("Event notification set for %08x"),
dwEvent);
else
wsprintf (szText, TEXT("Set Event notification failed rc: %d"),
GetLastError());
MessageBox (hWnd, szText, szAppName, MB_OK);
return 0;
}
//----------------------------------------------------------------------
// Add2List - Add string to the report list box.
//
void Add2List (HWND hWnd, LPTSTR lpszFormat, ...) {
int i, nBuf;
TCHAR szBuffer[512];
va_list args;
va_start(args, lpszFormat);
nBuf = _vstprintf(szBuffer, lpszFormat, args);
i = SendDlgItemMessage (hWnd, IDD_OUTPUT, WM_SETTEXT, 0,
(LPARAM)(LPCTSTR)szBuffer);
va_end(args);
}
//======================================================================
// SetEventNotifyDlgProc - Callback function for Event dialog box
//
BOOL CALLBACK SetEventNotifyDlgProc (HWND hWnd, UINT wMsg,
WPARAM wParam, LPARAM lParam) {
DWORD dwEvent;
switch (wMsg) {
case WM_COMMAND:
{
WORD idItem = LOWORD (wParam);
switch (idItem) {
case IDOK:
dwEvent = 0;
// IsDlgButtonChecked isn't defined in Win CE, so
// a macro has been defined.
if (IsDlgButtonChecked (hWnd, IDC_SYNC_END) == 1)
dwEvent |= NOTIFICATION_EVENT_SYNC_END;
if (IsDlgButtonChecked (hWnd, IDC_SERIAL_DETECT) == 1)
dwEvent |= NOTIFICATION_EVENT_RS232_DETECTED;
if (IsDlgButtonChecked (hWnd, IDC_DEVICE_CHANGE) == 1)
dwEvent |= NOTIFICATION_EVENT_DEVICE_CHANGE;
if (IsDlgButtonChecked (hWnd, IDC_TIME_CHANGE) == 1)
dwEvent |= NOTIFICATION_EVENT_TIME_CHANGE;
if (IsDlgButtonChecked (hWnd, IDC_RESTORE_END) == 1)
dwEvent |= NOTIFICATION_EVENT_RESTORE_END;
if (IsDlgButtonChecked (hWnd, IDC_POWER_UP) == 1)
dwEvent |= NOTIFICATION_EVENT_WAKEUP;
if (IsDlgButtonChecked (hWnd, IDC_TZ_CHANGE) == 1)
dwEvent |= NOTIFICATION_EVENT_TZ_CHANGE;
// Call my set event notification function above.
MySetEventNotification (hWnd, dwEvent);
EndDialog (hWnd, 1);
return TRUE;
case IDCANCEL:
EndDialog (hWnd, 0);
return TRUE;
}
}
break;
}
return FALSE;
}
//======================================================================
// MonitorThread - Monitors event for timer notificaiton
//
DWORD WINAPI MonitorThread (PVOID pArg) {
int rc;
while (g_fContinue) {
rc = WaitForSingleObject (g_hNoteEvent, INFINITE);
if (!g_fContinue)
break;
if (rc == WAIT_OBJECT_0)
SendMessage (g_hMain, MYMSG_TELLNOTIFY, 0, (LPARAM)g_hNoteEvent);
else
break;
}
return 0;
}
|
d29b4c751262a1cc251e17043e04ed3fb2c50779 | d8fce9a91a3523fd72e36d0b2fbfa5604207ddb6 | /WarchaosMapper.cpp | 5a5c718b0f444897820b6055e11b0985e6addcb4 | [] | no_license | jaguraphg/WarchaosMapper256 | 67a1e3f3bd45dcaf3b47894a0fe054f6831aaad4 | 3bb1f7ca4178752f441780ba3ac3992dc4213dab | refs/heads/master | 2020-04-12T17:38:49.761342 | 2012-07-08T19:22:30 | 2012-07-08T19:22:30 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,040 | cpp | WarchaosMapper.cpp | //---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
USERES("WarchaosMapper.res");
USEFORM("MainForm.cpp", FMain);
USEUNIT("WarchaosMapperDecl.cpp");
USELIB("..\..\Lib\wininet.lib");
USEUNIT("..\..\..\regexpr\Source\RegExpr.pas");
USEUNIT("THTTPSniffer.cpp");
USEUNIT("TAdderThread.cpp");
USELIB("..\..\Lib\PSDK\iphlpapi.lib");
USELIB("..\..\..\WpdPack\Lib\wpcap.lib");
USELIB("..\..\..\WpdPack\Lib\Packet.lib");
//#pragma comment (lib, "wpcap.lib")
//#pragma comment (lib, "Packet.lib")
//---------------------------------------------------------------------------
WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
{
try
{
Application->Initialize();
Application->CreateForm(__classid(TFMain), &FMain);
Application->Run();
}
catch (Exception &exception)
{
Application->ShowException(&exception);
}
return 0;
}
//---------------------------------------------------------------------------
|
4f1f3d8b47ed5c8d447628a28c9a9995b61aba57 | 4bf3feb567b322b02a3cc37e6477f0dcd7aa847e | /SingleNumber1.cpp | 4e401043602431372e9805e65e67b6a73aa87351 | [] | no_license | SathishMuruganS/LeetCodeApril2020 | d6b09cea9ea5a0b5244d599098e8cee3f82fa406 | 756632206da23804bf1b1db2a1f8bd6dec3e09a0 | refs/heads/master | 2021-05-25T08:45:28.914500 | 2020-04-28T13:54:56 | 2020-04-28T13:54:56 | 253,747,248 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 732 | cpp | SingleNumber1.cpp | /**
Given a non-empty array of integers, every element appears twice except for one. Find that single one.
Note:
Your algorithm should have a linear runtime complexity. Could you implement it without using extra memory?
Example 1:
Input: [2,2,1]
Output: 1
Example 2:
Input: [4,1,2,1,2]
Output: 4
**/
#include <bits/stdc++.h>
using namespace std;
class Solution {
public:
int singleNumber(vector<int>& nums) {
int val = nums[0];
int n = nums.size();
for(int i = 1; i < n; i++){
val ^= nums[i];
}
return val;
}
};
int main()
{
Solution s;
vector<int> vec1{2,2,1};
vector<int> vec2{4,1,2,1,2};
cout<<s.singleNumber(vec1)<<endl;
cout<<s.singleNumber(vec2)<<endl;
return 0;
}
|
6c7c40c16bf27c7cab1b8aaabee85c6888ff18d1 | 666e05f26c8b454e3f8668030745ea0a459e59f5 | /memory.cpp | 28d8240dc8b25fe559a0827aa300b0e95f1c972f | [] | no_license | sureshvu/compilers | 6dc434d871c10d14b6a033aab8814a485a8aaf29 | 8469152bf10f6fe5e6406133fba4a1b108b82a26 | refs/heads/master | 2021-03-12T19:59:07.112772 | 2012-06-09T04:42:56 | 2012-06-09T04:42:56 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,552 | cpp | memory.cpp | /*
* memory.cpp
*
* Created on: Jun 6, 2012
* Author: vishnusuresh
*/
#include"memory.h"
// ===========================================================
void memory::setcurrentlocation(int current)
{
current_location = current;
}
// ===========================================================
void memory::setsp(int sp)
{
stack_pointer = sp;
}
// ===========================================================
void memory::sethp(int hp)
{
heap_pointer = hp;
}
// ===========================================================
void memory::setfp(int fp)
{
frame_pointer = fp;
}
// ===========================================================
void memory::setra(int ra)
{
return_address = ra;
}
// ===========================================================
// ===========================================================
// ===========================================================
// ===========================================================
int memory::getcurrentlocation()
{
return(current_location);
}
// ===========================================================
int memory::getsp()
{
return(stack_pointer);
}
// ===========================================================
int memory::getfp()
{
return(frame_pointer);
}
// ===========================================================
int memory::gethp()
{
return(heap_pointer);
}
// ===========================================================
int memory::getra()
{
return(return_address);
}
// ===========================================================
|
46b2e81bfc70a7de301b67b45d55407a9600ffdc | e3eb8e42718a198c7885fcf313c71c11a28fd434 | /FindminElementinRotatedArray2.cpp | a62ffc6d5faacb7cc78d617043e5c7bf9bdc8f43 | [] | no_license | lccl7/My-leetcode | 8beeccee4c3a9b5ae2db4c53d19becfdf2527f53 | da13f6d78cc969ccec780c9cfa7079f15e2c0f20 | refs/heads/master | 2020-05-21T11:34:39.788697 | 2015-08-26T01:08:56 | 2015-08-26T01:08:56 | 24,558,304 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 316 | cpp | FindminElementinRotatedArray2.cpp | int findMin(vector<int>& nums)
{
int lo = 0, high = nums.size()-1, mid = 0;
while(lo < high)
{
mid = lo + (high - lo)/2;
if(nums[mid] > nums[high])
lo = mid + 1;
else if(nums[mid] > nums[high])
high = mid;
else high--;
}
return nums[lo];
}
|
8760ee6c12f80f199876c34c5cd423f768865802 | 5856af8487bad60faf4556775df63528bb206aa8 | /Code/ScriptSystem/LuaScript.cpp | 24635873125490dfc36e4f7fcb026dec86e0927c | [
"MIT"
] | permissive | yorung/fastbirdEngine | 151ddb35cc4c9ee59ba90cd574df98d176e82d86 | eca26d339357a23eaee8416a3fc169a267abc764 | refs/heads/master | 2021-01-15T14:37:59.447624 | 2015-08-31T00:26:41 | 2015-08-31T00:26:41 | 29,778,951 | 0 | 0 | null | 2015-01-24T14:24:42 | 2015-01-24T14:24:41 | null | UTF-8 | C++ | false | false | 741 | cpp | LuaScript.cpp | #include "StdAfx.h"
#include "LuaScript.h"
namespace fastbird
{
void LuaScript::LuaError(int error)
{
if (error)
{
switch(error)
{
case LUA_ERRFILE:
{
std::cerr << "Could not read a file." << std::endl;
}
break;
default:
{
std::cerr << "Lua error!" << std::endl;
int a=0;
a++;
}
}
}
}
LuaScript::LuaScript(const char* filename)
{
L = luaL_newstate();
}
LuaScript::~LuaScript()
{
lua_close(L);
}
bool LuaScript::LoadScriptFile(const char* filename)
{
assert(filename);
mFilename = filename;
int error = luaL_loadfile(L, filename);
if (error)
{
LuaError(error);
return false;
}
error = lua_pcall(L, 0, 0, 0);
if (error)
{
LuaError(error);
return false;
}
return true;
}
} |
b0cab847417fc5b6cb1151d3b523887a1ff11c49 | b6030293209ef3b865d95b2a2d25ec9fee8bf8ef | /codigo_integrador_c++/empleado.cpp | 66f69d3dc45197c5b5806b48e179e05d12b355b2 | [] | no_license | germangelv/Programacion | 0af2386d1956c481fcdad81ea1be8e9690d46b4b | 04526667b13f1d9aae69475375c7bc070f068a53 | refs/heads/master | 2021-04-29T11:43:13.120817 | 2018-05-22T09:21:00 | 2018-05-22T09:21:00 | 121,827,961 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,276 | cpp | empleado.cpp | #include "empleado.h"
#define MAX_BUFFER 100
#include <iostream>
#include <string.h>
using namespace std;
///CONSTRUCTOR PARAMETRIZADO
Empleado :: Empleado ( long dni, char* nom, float sue ) : Persona ( dni, nom)
{
this->sueldo = sue;
}
///MUESTRA ALGO
void Empleado :: Hablar (void)
{
cout << "\tEmpleado dice hola"<<endl;
}
///MUESTRA EMPLEADO
ostream& operator << (ostream& salida, const Empleado& obj)
{
salida<<"\t[ "<<obj.dni<<" - "<<obj.nombre<<" - "<<obj.sueldo<<" ]";
return salida;
}
///CONSTRUCTOR DE COPIA
Empleado :: Empleado (const Empleado& obj): Persona (dni,nombre)
{
///PORQUE USO EL INICIALIZADOR DE PERSONA
//this->dni = obj.dni;
//this->nombre = new char [strlen ( obj.nombre )+1 ];
//strcpy ( this->nombre, obj.nombre );
this->sueldo = obj.sueldo;
}
///CARGA EMPLEADO
istream& operator >> (istream&entrada, Empleado&obj)
{
cout<<"\tIngrese DNI: ";
cin>>obj.dni;
char temp[MAX_BUFFER];
cout<<endl;
cout<<"\tIngrese Nombre ";
cin.ignore( );
cin.getline (temp,MAX_BUFFER);
delete [] obj.nombre;
obj.nombre = new char [strlen(temp)+1];
strcpy(obj.nombre,temp);
cout<<endl;
cout<<"\tIngresar sueldo: ";
cin>>obj.sueldo;
return entrada;
}
|
01c61ad010582cd6bfd230748d2ae814cc18ac94 | 705c08cfdc8c69e60e1ff9592b198264cd597100 | /007/main.cpp | 212cad4ccaf463224d9a67be004db819839ecb67 | [] | no_license | joshuatshaffer/project-euler | 798fc97e70871b9e9399ae5c3641461067ec2592 | faaeccca598ecd1bfca205b90d93fcd9f039fdff | refs/heads/master | 2020-03-28T22:41:33.925309 | 2017-11-28T15:26:22 | 2017-11-28T15:26:22 | 94,628,903 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 630 | cpp | main.cpp | // Problem 7
// Created by Joshua on 2/7/16.
// Copyright © 2016 joshuatshaffer. All rights reserved.
#include <array>
#include <iostream>
using namespace std;
const int num_of_primes = 10001;
int main (int argc, const char *argv[]) {
array<int, num_of_primes> primes;
int current_index = 0;
int n = 2;
while (current_index < num_of_primes) {
for (int i = 0; i < current_index; ++i) {
if (n % primes[i] == 0) {
goto next_n;
}
}
primes[current_index++] = n;
next_n:
++n;
}
cout << primes.back () << endl;
return 0;
}
|
5c577473318fab674a0d87b4a16f8b308208e7d0 | 1258ffbe081f47a6de191f1bc3c42f70108f9c24 | /audio/common/V3/speech_driver/SpeechVoiceCustomLogger.cpp | fc43d3bfc2d6a9d407ec0e0cb0b5ddbae9e969fc | [
"Apache-2.0"
] | permissive | flyforhigh/vendor_mediatek_proprietary_hardware | 4aa2496e4f67e934594baf451c774904edfdf108 | a592a52719cb43d2364e9c4d641f68ff6442d959 | refs/heads/master | 2023-03-18T01:53:10.358980 | 2018-08-12T16:32:31 | 2018-08-12T16:32:31 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 13,004 | cpp | SpeechVoiceCustomLogger.cpp | #include "SpeechVoiceCustomLogger.h"
#include <sys/prctl.h>
#include <sys/time.h>
#include <sys/resource.h>
#include <cutils/properties.h>
#include <utils/threads.h>
#include <ftw.h>
#include <hardware_legacy/power.h>
//#define FORCE_ENABLE_VCL
#define LOG_TAG "SpeechVoiceCustomLogger"
namespace android {
/*==============================================================================
* Property keys
*============================================================================*/
const char PROPERTY_KEY_VCL_ON[PROPERTY_KEY_MAX] = "persist.af.vcl_on";
const char PROPERTY_KEY_VCL_RECYCLE_ON[PROPERTY_KEY_MAX] = "persist.af.vcl_recycle_on";
/*==============================================================================
* Constant
*============================================================================*/
static const char VCL_RECORD_WAKELOCK_NAME[] = "VCL_RECORD_WAKELOCK";
static const uint32_t kCondWaitTimeoutMsec = 100; // 100 ms (modem local buf: 10k, and EPL has 2304 byte for each frame (20 ms))
static const uint32_t kReadBufferSize = 0x4000; // 16 k
/*==============================================================================
* VCL File Recycle
*============================================================================*/
static const uint32_t kMaxNumOfVCLFiles = 4096;
static const uint32_t kMinKeepNumOfVCLFiles = 16; // keep at least 16 files which will not be removed
static const uint32_t kMaxSizeOfAllVCLFiles = 209715200; // Total > 200 M
static const char kFolderOfVCLFile[] = "/sdcard/mtklog/audio_dump/";
static const char kPrefixOfVCLFileName[] = "/sdcard/mtklog/audio_dump/VCL";
static const uint32_t kSizeOfPrefixOfVCLFileName = sizeof(kPrefixOfVCLFileName) - 1;
static const uint32_t kMaxSizeOfVCLFileName = 128;
typedef struct {
char path[kMaxSizeOfVCLFileName];
uint32_t size;
} vcl_file_info_t;
static vcl_file_info_t gVCLFileList[kMaxNumOfVCLFiles];
static uint32_t gNumOfVCLFiles = 0;
static uint32_t gTotalSizeOfVCLFiles; // Total size of VCL files in SD card
static int GetVCLFileList(const char *path, const struct stat *sb, int typeflag) {
if (strncmp(path, kPrefixOfVCLFileName, kSizeOfPrefixOfVCLFileName) != 0) {
return 0;
}
if (gNumOfVCLFiles >= kMaxNumOfVCLFiles) {
return 0;
}
// path
audio_strncpy(gVCLFileList[gNumOfVCLFiles].path, path, kMaxSizeOfVCLFileName);
// size
gVCLFileList[gNumOfVCLFiles].size = sb->st_size;
gTotalSizeOfVCLFiles += sb->st_size;
// increase index
gNumOfVCLFiles++;
return 0; // To tell ftw() to continue
}
static int CompareVCLFileName(const void *a, const void *b) {
return strcmp(((vcl_file_info_t *)a)->path,
((vcl_file_info_t *)b)->path);
}
/*==============================================================================
* Implementation
*============================================================================*/
SpeechVoiceCustomLogger *SpeechVoiceCustomLogger::mSpeechVoiceCustomLogger = NULL;
SpeechVoiceCustomLogger *SpeechVoiceCustomLogger::GetInstance() {
static Mutex mGetInstanceLock;
Mutex::Autolock _l(mGetInstanceLock);
if (mSpeechVoiceCustomLogger == NULL) {
mSpeechVoiceCustomLogger = new SpeechVoiceCustomLogger();
}
ASSERT(mSpeechVoiceCustomLogger != NULL);
return mSpeechVoiceCustomLogger;
}
SpeechVoiceCustomLogger::SpeechVoiceCustomLogger() {
mStarting = false;
mEnable = false;
mVCLEnable = false;
mRecordThread = 0;
mDumpFile = NULL;
memset((void *)&mRingBuf, 0, sizeof(RingBuf));
}
SpeechVoiceCustomLogger::~SpeechVoiceCustomLogger() {
Close();
}
bool SpeechVoiceCustomLogger::UpdateVCLSwitch() {
#if defined(FORCE_ENABLE_VCL)
mVCLEnable = true;
#else
// VCL log recycle mechanism
char property_value[PROPERTY_VALUE_MAX];
property_get(PROPERTY_KEY_VCL_ON, property_value, "0"); //"0": default off
mVCLEnable = (property_value[0] == '0') ? false : true;
#endif
ALOGD("-%s(), mVCLEnable=%d", __FUNCTION__, mVCLEnable);
return mVCLEnable;
}
status_t SpeechVoiceCustomLogger::Open() {
AL_LOCK(mMutex);
ALOGD("+%s()", __FUNCTION__);
ASSERT(mEnable == false);
int ret = acquire_wake_lock(PARTIAL_WAKE_LOCK, VCL_RECORD_WAKELOCK_NAME);
ALOGD("%s(), acquire_wake_lock: %s, return %d.", __FUNCTION__, VCL_RECORD_WAKELOCK_NAME, ret);
// create another thread to avoid fwrite() block CCCI read thread
pthread_create(&mRecordThread, NULL, DumpVCLRecordDataThread, (void *)this);
AL_UNLOCK(mMutex);
mEnable = true;
ALOGD("-%s(), mEnable=%d ", __FUNCTION__, mEnable);
return NO_ERROR;
}
status_t SpeechVoiceCustomLogger::Close() {
AL_LOCK(mMutex);
ALOGD("+%s()", __FUNCTION__);
if (mEnable == false) {
ALOGW("-%s(), mEnable == false, return!!", __FUNCTION__);
AL_UNLOCK(mMutex);
return INVALID_OPERATION;
}
mStarting = false;
int ret = 0;
// VCL log recycle mechanism
char property_value[PROPERTY_VALUE_MAX];
property_get(PROPERTY_KEY_VCL_RECYCLE_ON, property_value, "1"); //"1": default on
const bool vcl_recycle_on = (property_value[0] == '0') ? false : true;
if (vcl_recycle_on == true) {
memset(gVCLFileList, 0, sizeof(gVCLFileList));
gNumOfVCLFiles = 0;
gTotalSizeOfVCLFiles = 0;
ret = ftw(kFolderOfVCLFile, GetVCLFileList, FTW_D);
ASSERT(ret == 0);
// Sort file name
qsort(gVCLFileList, gNumOfVCLFiles, sizeof(vcl_file_info_t), CompareVCLFileName);
// Remove VCL files
uint32_t index_vcl_file_list = 0;
while (gNumOfVCLFiles > kMinKeepNumOfVCLFiles && gTotalSizeOfVCLFiles > kMaxSizeOfAllVCLFiles) {
ALOGD("%s(), gNumOfVCLFiles = %lu, gTotalSizeOfVCLFiles = %lu", __FUNCTION__, gNumOfVCLFiles, gTotalSizeOfVCLFiles);
ALOGD("%s(), remove(%s), size = %lu", __FUNCTION__, gVCLFileList[index_vcl_file_list].path, gVCLFileList[index_vcl_file_list].size);
ret = remove(gVCLFileList[index_vcl_file_list].path);
ASSERT(ret == 0);
gNumOfVCLFiles--;
gTotalSizeOfVCLFiles -= gVCLFileList[index_vcl_file_list].size;
index_vcl_file_list++;
}
}
// release wake lock
ret = release_wake_lock(VCL_RECORD_WAKELOCK_NAME);
ALOGD("%s(), release_wake_lock:%s return %d.", __FUNCTION__, VCL_RECORD_WAKELOCK_NAME, ret);
mEnable = false;
AL_SIGNAL(mMutex); // wake up thread to exit
AL_UNLOCK(mMutex);
ALOGD("-%s()", __FUNCTION__);
return NO_ERROR;
}
status_t SpeechVoiceCustomLogger::OpenFile() {
char vcl_file_path[kMaxSizeOfVCLFileName];
memset((void *)vcl_file_path, 0, kMaxSizeOfVCLFileName);
time_t rawtime;
time(&rawtime);
struct tm *timeinfo = localtime(&rawtime);
audio_strncpy(vcl_file_path, kPrefixOfVCLFileName, kMaxSizeOfVCLFileName);
strftime(vcl_file_path + kSizeOfPrefixOfVCLFileName, kMaxSizeOfVCLFileName - kSizeOfPrefixOfVCLFileName - 1, "_%Y_%m_%d_%H%M%S.pcm", timeinfo);
ALOGD("%s(), vcl_file_path: \"%s\"", __FUNCTION__, vcl_file_path);
// check vcl_file_path is valid
int ret = AudiocheckAndCreateDirectory(vcl_file_path);
if (ret < 0) {
ALOGE("%s(), AudiocheckAndCreateDirectory(%s) fail!!", __FUNCTION__, vcl_file_path);
return UNKNOWN_ERROR;
}
// open VCL file
mDumpFile = fopen(vcl_file_path, "wb");
if (mDumpFile == NULL) {
ALOGE("%s(), fopen(%s) fail!!", __FUNCTION__, vcl_file_path);
return UNKNOWN_ERROR;
}
return NO_ERROR;
}
uint16_t SpeechVoiceCustomLogger::CopyBufferToVCL(RingBuf ul_ring_buf) {
AL_LOCK(mMutex);
if (mStarting == false) {
ALOGD("%s(), mStarting == false, return.", __FUNCTION__);
AL_SIGNAL(mMutex); // wake up thread to exit
AL_UNLOCK(mMutex);
return 0;
}
// get free space of internal input buffer
uint16_t free_space = RingBuf_getFreeSpace(&mRingBuf);
SLOGV("%s(), mRingBuf remain data count: %u, free_space: %u", __FUNCTION__, RingBuf_getDataCount(&mRingBuf), free_space);
// get data count in share buffer
uint16_t ul_data_count = RingBuf_getDataCount(&ul_ring_buf);
SLOGV("%s(), ul_ring_buf data count: %u", __FUNCTION__, ul_data_count);
// check free space for internal input buffer
uint16_t copy_data_count = 0;
if (ul_data_count <= free_space) {
copy_data_count = ul_data_count;
} else {
ALOGE("%s(), ul_data_count(%u) > free_space(%u)", __FUNCTION__, ul_data_count, free_space);
copy_data_count = free_space;
}
// copy data from modem share buffer to internal input buffer
if (copy_data_count > 0) {
SLOGV("%s(), copy_data_count: %u", __FUNCTION__, copy_data_count);
RingBuf_copyFromRingBuf(&mRingBuf, &ul_ring_buf, copy_data_count);
}
// signal
AL_SIGNAL(mMutex); // wake up thread to fwrite data.
AL_UNLOCK(mMutex);
return copy_data_count;
}
void *SpeechVoiceCustomLogger::DumpVCLRecordDataThread(void *arg) {
pthread_detach(pthread_self());
// Adjust thread priority
prctl(PR_SET_NAME, (unsigned long)__FUNCTION__, 0, 0, 0);
setpriority(PRIO_PROCESS, 0, ANDROID_PRIORITY_AUDIO);
ALOGD("%s(), pid: %d, tid: %d", __FUNCTION__, getpid(), gettid());
SpeechVoiceCustomLogger *pSpeechVoiceCustomLogger = (SpeechVoiceCustomLogger *)arg;
RingBuf &ring_buf = pSpeechVoiceCustomLogger->mRingBuf;
// open file
if (pSpeechVoiceCustomLogger->OpenFile() != NO_ERROR) {
pSpeechVoiceCustomLogger->mEnable = false;
pthread_exit(NULL);
return 0;
}
// Internal Input Buffer Initialization
pSpeechVoiceCustomLogger->mRingBuf.pBufBase = new char[kReadBufferSize];
pSpeechVoiceCustomLogger->mRingBuf.bufLen = kReadBufferSize;
pSpeechVoiceCustomLogger->mRingBuf.pRead = pSpeechVoiceCustomLogger->mRingBuf.pBufBase;
pSpeechVoiceCustomLogger->mRingBuf.pWrite = pSpeechVoiceCustomLogger->mRingBuf.pBufBase;
ASSERT(pSpeechVoiceCustomLogger->mRingBuf.pBufBase != NULL);
memset(pSpeechVoiceCustomLogger->mRingBuf.pBufBase, 0, pSpeechVoiceCustomLogger->mRingBuf.bufLen);
pSpeechVoiceCustomLogger->mStarting = true;
while (1) {
// lock & wait data
AL_LOCK(pSpeechVoiceCustomLogger->mMutex);
if (AL_WAIT_MS(pSpeechVoiceCustomLogger->mMutex, kCondWaitTimeoutMsec) != 0) {
ALOGW("%s(), waitRelative fail", __FUNCTION__);
}
// make sure VCL is still recording after conditional wait
if (pSpeechVoiceCustomLogger->mEnable == false) {
// close file
if (pSpeechVoiceCustomLogger->mDumpFile != NULL) {
fflush(pSpeechVoiceCustomLogger->mDumpFile);
fclose(pSpeechVoiceCustomLogger->mDumpFile);
pSpeechVoiceCustomLogger->mDumpFile = NULL;
}
// release local ring buffer
if (pSpeechVoiceCustomLogger->mRingBuf.pBufBase != NULL) {
delete []pSpeechVoiceCustomLogger->mRingBuf.pBufBase;
pSpeechVoiceCustomLogger->mRingBuf.pBufBase = NULL;
pSpeechVoiceCustomLogger->mRingBuf.pRead = NULL;
pSpeechVoiceCustomLogger->mRingBuf.pWrite = NULL;
pSpeechVoiceCustomLogger->mRingBuf.bufLen = 0;
}
ALOGD("%s(), pid: %d, tid: %d, mEnable == false, break.", __FUNCTION__, getpid(), gettid());
AL_UNLOCK(pSpeechVoiceCustomLogger->mMutex);
break;
}
// write data to sd card
const uint16_t data_count = RingBuf_getDataCount(&ring_buf);
uint16_t write_bytes = 0;
if (data_count > 0) {
const char *end = ring_buf.pBufBase + ring_buf.bufLen;
if (ring_buf.pRead <= ring_buf.pWrite) {
write_bytes += fwrite((void *)ring_buf.pRead, sizeof(char), data_count, pSpeechVoiceCustomLogger->mDumpFile);
} else {
int r2e = end - ring_buf.pRead;
write_bytes += fwrite((void *)ring_buf.pRead, sizeof(char), r2e, pSpeechVoiceCustomLogger->mDumpFile);
write_bytes += fwrite((void *)ring_buf.pBufBase, sizeof(char), data_count - r2e, pSpeechVoiceCustomLogger->mDumpFile);
}
ring_buf.pRead += write_bytes;
if (ring_buf.pRead >= end) { ring_buf.pRead -= ring_buf.bufLen; }
SLOGV("%s(), data_count: %u, write_bytes: %u", __FUNCTION__, data_count, write_bytes);
}
if (write_bytes != data_count) {
ALOGE("%s(), write_bytes(%d) != data_count(%d), SD Card might be full!!", __FUNCTION__, write_bytes, data_count);
}
// unlock
AL_UNLOCK(pSpeechVoiceCustomLogger->mMutex);
}
pthread_exit(NULL);
return 0;
}
};
|
4d7d6cb097ab95721133f658ddc7eb9e63f3cbea | d27c4ca7fd96a62363e555677d9d41e0b649f704 | /saber/funcs/impl/x86/saber_slice.cpp | 9ceb00e861b142a304d74acb1b45ee905214c997 | [
"Apache-2.0"
] | permissive | imharrywu/Anakin-1 | 26e69bb2ec38d66d279cb3b1003501cbf0f8b729 | ffabcf1bd4b19cc6c682ba8a9e68b8ef976d9da7 | refs/heads/master | 2020-09-21T12:53:29.055278 | 2019-11-29T09:37:52 | 2019-11-29T09:37:52 | 224,795,082 | 0 | 0 | Apache-2.0 | 2019-11-29T06:56:16 | 2019-11-29T06:56:16 | null | UTF-8 | C++ | false | false | 1,613 | cpp | saber_slice.cpp | #include "saber/funcs/impl/x86/saber_slice.h"
namespace anakin{
namespace saber{
template <DataType OpDtype>
SaberStatus SaberSlice<X86, OpDtype>::dispatch(\
const std::vector<Tensor<X86> *>& inputs, \
std::vector<Tensor<X86> *>& outputs, \
SliceParam<X86>& param) {
//! inputs only has one tensor
Shape shape_in = inputs[0]->valid_shape();
int output_size = outputs.size();
if (output_size == 1) {
outputs[0]->share_from(*inputs[0]);
return SaberSuccess;
}
int offset_slice_axis = 0;
const OpDataType* in_data = (const OpDataType*)inputs[0]->data();
const int in_slice_axis_size = shape_in[param.axis];
for (int i = 0; i < output_size; ++i) {
OpDataType* out_data = (OpDataType*)outputs[i]->mutable_data();
const int out_slice_axis_size = outputs[i]->valid_shape()[param.axis];
const int out_slice_size = out_slice_axis_size * _slice_size;
const int slice_count = out_slice_size * _slice_num;
#pragma omp parallel for schedule(static)
for(int j = 0; j < slice_count; ++j){
const int _num_slice = j / out_slice_size;
const int _slice_index = j % out_slice_size;
const int in_index = _slice_index + (_num_slice * in_slice_axis_size + offset_slice_axis) * _slice_size;
out_data[j] = in_data[in_index];
}
offset_slice_axis += out_slice_axis_size;
}
return SaberSuccess;
}
DEFINE_OP_TEMPLATE(SaberSlice, SliceParam, X86, AK_HALF);
DEFINE_OP_TEMPLATE(SaberSlice, SliceParam, X86, AK_INT8);
} //namespace anakin
} //namespace anakin
|
dab69fbcb1aef791ba4daf1a7b4be578a638aa22 | 425e41720e400136975cc72c0a8166028acd1382 | /IDlgPluginTest.h | 99c34899a76523dadf22f1db4f5b1cb242e4348a | [] | no_license | jasonhit/AppPluginEx | 373bf6bde5840892d283f8d4b2374169a4c95ddd | ae645b95a9950d353c629d69dc1eadacd232bab1 | refs/heads/master | 2020-06-23T09:41:44.658046 | 2016-11-10T22:13:36 | 2016-11-10T22:13:36 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 333 | h | IDlgPluginTest.h | #pragma once
#include <QObject>
class IDlgPluginTest : public QObject
{
Q_OBJECT
public:
explicit IDlgPluginTest(QObject* const parent);
virtual ~IDlgPluginTest();
};
QT_BEGIN_NAMESPACE
#define IDlgPluginTest_iid "com.ecd.AppPluginEx.IDlgPluginTest"
Q_DECLARE_INTERFACE(IDlgPluginTest, IDlgPluginTest_iid)
QT_END_NAMESPACE
|
21a418b0640ed55acddf29760edfd5c9c7876b69 | c6c9278233657fb928a398497b6ce76df952caf8 | /StringToInteger.cpp | ed6306c77d3b291ba3f95608b6c57e304615b8f5 | [] | no_license | ness-tea/my-leetcode | 010cd48991a7a50a689709e6af2c4add240583c4 | 0d5232880205017b9c760d4e54bb917a0b11c8fd | refs/heads/master | 2022-02-19T15:30:36.688616 | 2019-10-06T05:15:51 | 2019-10-06T05:15:51 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,307 | cpp | StringToInteger.cpp | class Solution {
public:
int myAtoi(string str) {
bool negative = false, digitsFinished = false;
int integer = 0, prev_integer = 0, length = 0, sign = 0;
unordered_map<string,int> intmappings;
for (int i = 0; i < 10; i++)
{
intmappings[to_string(i)] = i;
}
for (int i = 0; i < str.length(); i++)
{
if (intmappings.count(string(1,str[i])) != 0 || str[i]=='-' || str[i]=='+')
{
length += 1;
if (intmappings.count(string(1,str[i+1])) != 1)
{
break;
}
}
}
for (int i = 0; i < str.length(); i++)
{
if (str[i] == ' ')
{
continue;
}
else if (str[i]=='-')
{
if (intmappings.count(string(1,str[i+1])) != 1)
{
return 0;
}
length -= 1;
negative = true;
}
else if (str[i]=='+')
{
if (intmappings.count(string(1,str[i+1])) != 1)
{
return 0;
}
length -=1;
}
else if (intmappings.count(string(1, str[i])) > 0)
{
integer += pow(10,length-1) * (intmappings[string(1, str[i])]);
if (prev_integer != integer - (pow(10,length-1)*intmappings[string(1, str[i])]))
{
if (negative)
{
return INT_MIN;
}
else
{
return INT_MAX;
}
}
if (intmappings.count(string(1,str[i+1])) != 1)
{
break;
}
prev_integer = integer;
length -= 1;
}
else
{
return 0;
}
}
if (negative)
{
integer = integer*(-1);
}
return integer;
}
}; |
2b4bbdad04b0590bef7826bbb386ce25df8d8627 | 1dc4f4366bce8a0a84c13cd9ac231ae21c55c130 | /Problem Solving/Compare the Triplets.cpp | c485e609496f9fd15c7b5cf3098d29e34445f173 | [] | no_license | ritikkr/HackerRank-Solution | d8ade088bee20a193188019f9847363c3650b8bc | 8c76af64ecf168aab29c09956fdb77e7167e6a4a | refs/heads/master | 2021-03-18T18:18:49.790476 | 2020-05-29T18:50:13 | 2020-05-29T18:50:13 | 247,089,482 | 3 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 450 | cpp | Compare the Triplets.cpp | #include<iostream>
using namespace std;
int main(){
int a[100],b[100];
int i,alice=0,bob=0,sum;
for(i=0;i<3;i++){
cin>>a[i];
}
for (i = 0; i < 3; i++) {
cin >> b[i];
}
for(i=0;i<3;i++){
if((a[i]>=1||a[i]<=100)&&(b[i]>=1||b[i]<=100)){
//cout<<"Alice="<<alice<<ends<<"And bob ="<<bob;
for(i=0;i<3;i++){
if(a[i]>b[i]){
alice++;
}
else if(a[i]<b[i]){
bob++;
}
else{
sum++;
}
}
cout<<alice<<" "<<bob;
}
else {
exit(0);
}}
return 0;
}
|
82bd81a3a6234ed6d09c07077b2503c3eed553d7 | e836b973d7993fb589a5c9b9823d686e1cb7cc5c | /cpp/L900/LeetCode0944.cc | fffeacaed0073e04f52d51ca3a35a3aca77d9132 | [] | no_license | lsry/LeetCode | 5ec3dddca8500f2f7766002275a644a037f3d656 | a7488eb6a3bc2764f3040f34a4c4745c6321d57b | refs/heads/master | 2023-08-30T22:33:50.484281 | 2023-08-27T18:20:37 | 2023-08-27T18:20:37 | 231,709,838 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 595 | cc | LeetCode0944.cc | #include <string>
using std::string;
#include <vector>
using std::vector;
class Solution {
public:
int minDeletionSize(vector<string>& strs) {
if (strs.empty()) {
return 0;
}
int cnt = 0;
std::size_t vz{strs.size()};
std::size_t sz{strs[0].size()};
for (std::size_t col{0};col < sz;++col) {
for (std::size_t row{1};row < vz;++row) {
if (strs[row][col] < strs[row - 1][col]) {
++cnt;
break;
}
}
}
return cnt;
}
}; |
3089b46a6d3cdaff1395ae3704fae4aa08b6c5a9 | 05369a9209b5f3e0b3f7092d3e65c21b231b2474 | /LEXFuncoes/StringManager/TestarInverteString.cpp | 571f731cb50ea1101cd5f2860be5800970d055c9 | [] | no_license | RamonGiovane/LP | cf75a3e9c1ea48f2990afad0ad9817444eb9a3ae | f37b794b70275691078eabf5b041145ae70974e1 | refs/heads/master | 2020-08-04T18:13:13.409692 | 2019-10-07T15:45:07 | 2019-10-07T15:45:07 | 212,233,750 | 0 | 0 | null | null | null | null | ISO-8859-1 | C++ | false | false | 2,258 | cpp | TestarInverteString.cpp | #include "StringManager.h"
#include <iostream>
#include <conio.h>
#include "TestarInverteString.h"
#include "EntradaESaida.h"
using namespace std;
void localizacao() {
setlocale(LC_ALL, "pt-br");
}
void prompt() {
cout << "\n\n-Press any key-\n" << endl;
_getch();
}
void testeReplace(StringManager manager, char str[], char atual, char novo, int limite = 0) {
int manipulacoes =
limite == 0 ? manager.replace(str, atual, novo) : manager.replace(str, limite, atual, novo);
cout << "Manipulações: " << manipulacoes << "\tResultado: " << str;
}
void testarPesquisa(StringManager manager, char abacate[], char avocado[], char abacateInvocado[]) {
cout << "\n\n==Pesquisa String 1: Abacate em Abacate Invocado(char[])==" << endl;
cout << "R: " << manager.pesquisarString(abacateInvocado, strlen(abacateInvocado), abacate, strlen(abacate));
cout << "\n\n==Pesquisa String 2: Avocado em Abacate Invocado (char[])==" << endl;
cout << "R: " << manager.pesquisarString(abacateInvocado, strlen(abacateInvocado), avocado, strlen(avocado));
string preco("Preço"), preco2("preço"), stringInteira("Preço Curto.. Prazo Longo");
cout << "\n\n==Pesquisa String 3: Preço em " << stringInteira << " (string)==" << endl;
cout << "R: " << manager.pesquisarString(stringInteira, preco);
cout << "\n\n==Pesquisa String 4: preço em " << stringInteira << " (string)==" << endl;
cout << "R: " << manager.pesquisarString(stringInteira, preco2);
}
int main() {
localizacao();
teste();
StringManager manager;
cout << "\n\n==Inverte string JOAO==\n";
cout << manager.inverteString("JOAO") << endl;
char abacate[] = "Abacate", avocado[] = "Avocado", abacateInvocado[] = "Abacate Invocado";
testarPesquisa(manager, abacate, avocado, abacateInvocado);
cout << "\n\n==String replace==\nOriginal: Abacate\tTrocando 'a's por 'i's" << endl;
testeReplace(manager, abacate, 'a', 'i');
cout << "\n\n==String replace com limite de 7 letras ==\nOriginal: Avocado\tTrocando 'o's por 'a's" << endl;
testeReplace(manager, avocado, 'o', 'a', strlen(avocado));
cout << "\n\n==String replace com limite de 7 letras ==\nOriginal: Abacate Invocado\tTrocando 'a's por 'i's" << endl;
testeReplace(manager, abacateInvocado, 'a', 'i', 7);
prompt();
}
|
823f3383437b3456c78672abb4075e6a6f36563f | 682210499d68d22fa1ae8f7d910f8fb04ea55be5 | /hydroffice.ino | 5e9e3436c44ed98f9f1e73b534aeb2447b3af3d6 | [] | no_license | prjmaurya/Prototype-2.0 | 419ee9d2c846bda2d5b01218f9fe07ac6957864d | 804e57a3e8d8390f3e0f843624cfdd4c3dbbf531 | refs/heads/master | 2020-08-11T18:10:36.931983 | 2019-12-18T22:41:55 | 2019-12-18T22:41:55 | 214,606,160 | 0 | 0 | null | 2019-10-12T08:07:04 | 2019-10-12T08:07:04 | null | UTF-8 | C++ | false | false | 806 | ino | hydroffice.ino | // code for hydro-office
void setup() {
pinMode(A4,INPUT); // sets A4 pin as input pin
pinMode(A5,INPUT); // sets A5 pin as input pin
pinMode(11,OUTPUT); // sets 11 pin as output
Serial.begin(9600); // Sets the data rate in bits per second (baud) for serial data transmission
}
void loop() {
// initializing variables with analog values sensed by the sensor
int value1=analogRead(A4);
int value2=analogRead(A5);
Serial.println(value1); // prints value1 on Serial monitor
delay(1000); // creates a delay of 1 second
if(value2>1000) //max value
digitalWrite(11,HIGH); // pump connected to relay
if(value1<800) //min value
digitalWrite(11,LOW); // pump connected to relay
}
|
6e251d5ced99291526398bd039d786a7e4d736b4 | 97a3171176b5043149429e0fea99815b436f3a8c | /info.h | 24044d000c7ae45fae189616242b2ae9e2a45eda | [] | no_license | RyanDJSee/CC3k | ffadf96b4ca3be488faecd2bb5e6976234875c26 | 6b97ff8f98f96cd4058e1c7ca44c6e2f199b12be | refs/heads/master | 2021-03-30T17:44:30.542278 | 2017-04-03T05:05:02 | 2017-04-03T05:05:02 | 86,274,898 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 165 | h | info.h | #ifndef _INFO_H_
#define _INFO_H_
#include <string>
struct Info {
std::string name="";
int gold=0;;
int hp=0;
int atk=0;
int def=0;
};
#endif
|
e9711b64de951eb15827fd19cc02a6ca8c3b6fe5 | b719400d28d47dcafed9340efef3e8f09f7c9c9b | /algorithms/leetcode/cpp/Medium/Binary_Search/FindingFirstAndLastPosition.cpp | d025f1b15b6924291c8851fd6a6f70ce2f7d3298 | [] | no_license | avikumar15/cp-algorithm-solutions | 115582118fc47bd2fce84599d2d22520952c58ce | ffd94248d0e6152ce8495e18ae7b6e136139f3a8 | refs/heads/main | 2023-07-05T21:38:14.477677 | 2021-08-01T19:58:38 | 2021-08-01T20:00:51 | 324,221,414 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,408 | cpp | FindingFirstAndLastPosition.cpp | // https://leetcode.com/problems/find-first-and-last-position-of-element-in-sorted-array/
#include <bits/stdc++.h>
using namespace std;
class Solution {
public:
int findLeft(vector<int> nums, int l, int h, int t) {
int mid = l+(h-l)/2;
if(h<=l+1) {
if(nums[l]==t)
return l;
if(nums[h]==t)
return h;
return -1;
}
if(t>nums[mid]) {
l=mid;
} else {
h=mid;
}
return findLeft(nums,l,h,t);
}
int findRight(vector<int> nums, int l, int h, int t) {
int mid = l+(h-l)/2;
if(h<=l+1) {
if(nums[h]==t)
return h;
if(nums[l]==t)
return l;
return -1;
}
if(t>=nums[mid]) {
l=mid;
} else {
h=mid;
}
return findRight(nums,l,h,t);
}
vector<int> searchRange(vector<int>& nums, int target) {
int left=0;
int right=0;
int n = nums.size();
if(n==0)
return vector<int> (2,-1);
int l=0,h=n-1;
left = findLeft(nums,l,h,target);
right = findRight(nums,l,h,target);
vector<int> res;
res.push_back(left);
res.push_back(right);
return res;
}
};
|
d34ee2f3c5d660d6171ab7c766db9f628978c349 | 785df77400157c058a934069298568e47950e40b | /Common/Foam/include/base/UOPstream.hxx | 788787e53e811699e8b237a669d3a3f8dd7d5a91 | [] | no_license | amir5200fx/Tonb | cb108de09bf59c5c7e139435e0be008a888d99d5 | ed679923dc4b2e69b12ffe621fc5a6c8e3652465 | refs/heads/master | 2023-08-31T08:59:00.366903 | 2023-08-31T07:42:24 | 2023-08-31T07:42:24 | 230,028,961 | 9 | 3 | null | 2023-07-20T16:53:31 | 2019-12-25T02:29:32 | C++ | UTF-8 | C++ | false | false | 5,555 | hxx | UOPstream.hxx | #pragma once
#ifndef _UOPstream_Header
#define _UOPstream_Header
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
tnbLib::UOPstream
Description
Output inter-processor communications stream operating on external
buffer.
SourceFiles
UOPstream.C
\*---------------------------------------------------------------------------*/
#include <UPstream.hxx>
#include <Ostream.hxx>
//#include <DynamicList.hxx>
//#include <PstreamBuffers.hxx>
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace tnbLib
{
// Forward Declarations
class PstreamBuffers;
template<class T, unsigned SizeInc = 0, unsigned SizeMult = 2, unsigned SizeDiv = 1>
class DynamicList;
/*---------------------------------------------------------------------------*\
Class UOPstream Declaration
\*---------------------------------------------------------------------------*/
class UOPstream
:
public UPstream,
public Ostream
{
// Private Data
int toProcNo_;
DynamicList<char>& sendBuf_;
const int tag_;
const label comm_;
const bool sendAtDestruct_;
// Private Member Functions
//- Write a T to the transfer buffer
template<class T>
inline void writeToBuffer(const T&);
//- Write a char to the transfer buffer
inline void writeToBuffer(const char&);
//- Write data to the transfer buffer
inline void writeToBuffer(const void* data, size_t count, size_t align);
public:
// Constructors
//- Construct given process index to send to and optional buffer size,
// write format and IO version
FoamBase_EXPORT UOPstream
(
const commsTypes commsType,
const int toProcNo,
DynamicList<char>& sendBuf,
const int tag = UPstream::msgType(),
const label comm = UPstream::worldComm,
const bool sendAtDestruct = true,
streamFormat format = BINARY,
versionNumber version = currentVersion
);
//- Construct given buffers
FoamBase_EXPORT UOPstream(const int toProcNo, PstreamBuffers&);
//- Destructor
FoamBase_EXPORT ~UOPstream();
// Member Functions
// Inquiry
//- Return flags of output stream
ios_base::fmtflags flags() const
{
return ios_base::fmtflags(0);
}
// Write functions
//- Write given buffer to given processor
static FoamBase_EXPORT bool write
(
const commsTypes commsType,
const int toProcNo,
const char* buf,
const std::streamsize bufSize,
const int tag = UPstream::msgType(),
const label communicator = 0
);
//- Write next token to stream
FoamBase_EXPORT Ostream& write(const token&);
//- Write character
FoamBase_EXPORT Ostream& write(const char);
//- Write character string
FoamBase_EXPORT Ostream& write(const char*);
//- Write word
FoamBase_EXPORT Ostream& write(const word&);
//- Write string
FoamBase_EXPORT Ostream& write(const string&);
//- Write std::string surrounded by quotes.
// Optional write without quotes.
FoamBase_EXPORT Ostream& writeQuoted
(
const std::string&,
const bool quoted = true
);
//- Write int32_t
FoamBase_EXPORT virtual Ostream& write(const int32_t);
//- Write int64_t
FoamBase_EXPORT Ostream& write(const int64_t);
//- Write floatScalar
FoamBase_EXPORT Ostream& write(const floatScalar);
//- Write doubleScalar
FoamBase_EXPORT Ostream& write(const doubleScalar);
//- Write longDoubleScalar
FoamBase_EXPORT Ostream& write(const longDoubleScalar);
//- Write binary block
FoamBase_EXPORT Ostream& write(const char*, std::streamsize);
//- Add indentation characters
void indent()
{}
// Stream state functions
//- Flush stream
void flush()
{}
//- Add newline and flush stream
void endl()
{}
//- Get width of output field
int width() const
{
return 0;
}
//- Set width of output field (and return old width)
int width(const int)
{
return 0;
}
//- Get precision of output field
int precision() const
{
return 0;
}
//- Set precision of output field (and return old precision)
int precision(const int)
{
return 0;
}
// Edit
//- Set flags of stream
ios_base::fmtflags flags(const ios_base::fmtflags)
{
return ios_base::fmtflags(0);
}
// Print
//- Print description of IOstream to Ostream
FoamBase_EXPORT void print(Ostream&) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace tnbLib
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif // !_UOPstream_Header
|
14f2d8f2034bd1219ceb5f4a0c4256cc22f999d1 | 36a60abca3aeb7b4b71e6d6b069d82d21cc21379 | /squim/image/codecs/gif/gif_image_frame_parser.cc | f293547c0fa13902c95d4ae3eb4f89672c0449e8 | [
"Apache-2.0"
] | permissive | baranov1ch/squim | 715fcc95b655f0550f5e1fda5c682e28fa7f40fd | 5bde052735e0dac7c87e8f7939d0168e6ee05857 | refs/heads/master | 2020-04-06T06:56:41.229321 | 2016-08-19T21:23:15 | 2016-08-19T21:23:15 | 48,458,727 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,869 | cc | gif_image_frame_parser.cc | /*
* Copyright 2015 Alexey Baranov <me@kotiki.cc>. 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 "squim/image/codecs/gif/gif_image_frame_parser.h"
#include "squim/base/logging.h"
#include "squim/base/memory/make_unique.h"
#include "squim/image/codecs/gif/lzw_reader.h"
namespace image {
GifImage::Frame::Parser::Parser() {
frame_ = base::make_unique<Frame>();
}
GifImage::Frame::Parser::~Parser() {}
void GifImage::Frame::Parser::SetGlobalColorTable(
const ColorTable* global_color_table) {
frame_->global_color_table_ = global_color_table;
}
void GifImage::Frame::Parser::SetFrameGeometry(uint16_t x_offset,
uint16_t y_offset,
uint16_t width,
uint16_t height) {
frame_->x_offset_ = x_offset;
frame_->y_offset_ = y_offset;
frame_->width_ = width;
frame_->height_ = height;
}
void GifImage::Frame::Parser::SetProgressive(bool progressive) {
frame_->is_progressive_ = progressive;
}
void GifImage::Frame::Parser::SetTransparentPixel(size_t value) {
frame_->transparent_pixel_ = value;
}
void GifImage::Frame::Parser::SetDuration(size_t duration) {
frame_->duration_ = duration;
}
void GifImage::Frame::Parser::SetDisposalMethod(DisposalMethod method) {
frame_->disposal_method_ = method;
}
bool GifImage::Frame::Parser::InitDecoder(uint8_t minimum_code_size) {
lzw_reader_ = base::make_unique<LZWReader>();
auto output = [this](uint8_t* data, size_t size) -> bool {
return OutputRow(data, size);
};
return lzw_reader_->Init(minimum_code_size, frame_->width_, output);
}
Result GifImage::Frame::Parser::ProcessImageData(uint8_t* data, size_t size) {
auto result = lzw_reader_->Decode(data, size);
if (result.ok() && result.n() != size) {
LOG(WARNING) << "Bad LZW block, junk left after read. nread=" << result.n()
<< ", size=" << size;
}
if (result.eof()) {
if (current_row_ != frame_->height() - 1) {
return Result::Error(Result::Code::kDecodeError, "Image data too short");
} else {
return Result::Ok();
}
}
return Result::FromIoResult(result, false);
}
bool GifImage::Frame::Parser::OutputRow(uint8_t* data, size_t size) {
if (size < frame_->width())
return false;
if (current_row_ >= frame_->height())
return false;
if (!frame_->data_) {
frame_->data_.reset(new uint8_t[frame_->width() * frame_->height()]);
}
frame_->SetRow(current_row_, data);
if (!frame_->is_progressive()) {
current_row_++;
} else {
static const struct InterlacePass {
size_t start;
size_t step;
} kInterlace[] = {{0, 8}, {4, 8}, {2, 4}, {1, 2}};
current_row_ += kInterlace[interlace_pass_].step;
if (current_row_ >= frame_->height() && interlace_pass_ < 3) {
interlace_pass_++;
current_row_ = kInterlace[interlace_pass_].start;
}
}
return true;
}
void GifImage::Frame::Parser::CreateLocalColorTable(size_t size) {
frame_->local_color_table_.reset(new ColorTable(size));
}
GifImage::ColorTable* GifImage::Frame::Parser::GetLocalColorTable() {
return frame_->local_color_table_.get();
}
std::unique_ptr<GifImage::Frame> GifImage::Frame::Parser::ReleaseFrame() {
return std::move(frame_);
}
} // namespace image
|
a527002fab762cc0a8463dfd263b803aeb232191 | b269392cc4727b226e15b3f08e9efb41a7f4b048 | /ZOJ/ZOJ 1654.cpp | c5d42c7cee21ddc8273ab92b0eec5e234263389a | [] | no_license | ThoseBygones/ACM_Code | edbc31b95077e75d3b17277d843cc24b6223cc0c | 2e8afd599b8065ae52b925653f6ea79c51a1818f | refs/heads/master | 2022-11-12T08:23:55.232349 | 2022-10-30T14:17:23 | 2022-10-30T14:17:23 | 91,112,483 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,935 | cpp | ZOJ 1654.cpp | #include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
#define MAXN 1255
#define MAXE 1600005
//邻接表
class Hungary_DFS
{
private:
int head[MAXN];
struct Edge
{
int to,next;
Edge(int to,int next):to(to),next(next) {}
Edge() {}
} e[MAXE];
char g[55][55];
int row[55][55]; //记录每行能放机器人的区域数
int col[55][55]; //记录每列能放机器人的区域数
int mx[MAXN],my[MAXN];
int vis[MAXN];
int n,m;
int nx,ny;
int cnt;
void addEdge(int u,int v)
{
e[cnt].to = v;
e[cnt].next = head[u];
head[u] = cnt++;
}
bool dfs(int u)
{
for(int i = head[u]; ~i; i = e[i].next)
{
int v = e[i].to;
if(!vis[v])
{
vis[v] = true;
if(my[v] == -1 || dfs(my[v]))
{
my[v] = u;
mx[u] = v;
return true;
}
}
}
return false;
}
public:
void init(int a,int b)
{
cnt = 0;
n = a;
m = b;
}
int hungary()
{
int res = 0;
memset(mx, -1, sizeof(mx));
memset(my, -1, sizeof(my));
for(int i = 1; i <= nx; i++)
{
if(mx[i] == -1)
{
memset(vis, 0, sizeof(vis));
if(dfs(i))
res++;
}
}
return res;
}
void buildGraph()
{
memset(head,-1,sizeof(head));
memset(row,0,sizeof(row));
memset(col,0,sizeof(col));
for(int i=0; i<n; i++)
scanf("%s",g[i]);
nx = 1; //每行中的每个可放区域放入x集
ny = 1; //每列中的每个可放区域放入y集
for(int i=0; i<n; i++)
{
for(int j=0; j<m; j++)
{
if(g[i][j]=='o' && !row[i][j])
{
for(int k=j; k<m && g[i][k]!='#'; k++)
row[i][k]=nx;
nx++;
}
if(g[i][j]=='o' && !col[i][j])
{
for(int k=i; k<n && g[k][j]!='#'; k++)
col[k][j]=ny;
ny++;
}
}
}
for(int i=0; i<n; i++)
{
for(int j=0; j<m; j++)
{
if(g[i][j]=='o' && row[i][j] && col[i][j])
addEdge(row[i][j],col[i][j]);
}
}
}
} hungaryDFS;
int main()
{
int t;
int kase=1;
scanf("%d",&t);
while(t--)
{
int n,m;
scanf("%d%d",&n,&m);
hungaryDFS.init(n,m);
hungaryDFS.buildGraph();
int ans=hungaryDFS.hungary();
printf("Case :%d\n%d\n",kase++,ans);
}
return 0;
}
|
ab69d5776a263056a9fd733c3be4ff788ca1c26a | 6aaa543851a1d6d0965d05ff19bff90b4b70f329 | /백준 4485번 녹색 옷 입은 애가 젤다지.cpp | f5215d35bf9908679bf7fa1328f4a65e43780436 | [] | no_license | namyoungu/baekjoon | 1d7946da9a43a433bbe0fef9f2ef854c6f1d3606 | 53a84d828dcf9aa47aee2d9f5caa1aeba2a72286 | refs/heads/master | 2021-06-11T19:59:03.866596 | 2021-04-24T08:17:03 | 2021-04-24T08:17:03 | 180,161,886 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,075 | cpp | 백준 4485번 녹색 옷 입은 애가 젤다지.cpp | #include <iostream>
#include <algorithm>
#include <memory.h>
using namespace std;
int n, map[126][126], cache[126][126][4];
int dy[4] = {1, -1, 0, 0};
int dx[4] = { 0, 0, 1, -1 };
int dfs(int y, int x, int d) {
if (y == n - 1 && x == n - 1) return map[y][x];
int &res = cache[y][x][d];
if (res != -1) return res;
res = 987654321;
for (int i = 0; i < 4; i++) {
int ny = y + dy[i];
int nx = x + dx[i];
if (ny < 0 || ny >= n || nx < 0 || nx >= n) continue;
res = min(res, dfs(ny, nx, i) + map[y][x]);
}
return res;
}
int main() {
int z = 0;
while (1) {
z++;
cin >> n;
if (n == 0) break;
memset(cache, -1, sizeof(cache));
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
cin >> map[i][j];
}
}
int ans = min(dfs(0, 0, 0), dfs(0, 0, 2));
cout << "Problem "; cout << z; cout << ": ";
cout << ans << '\n';
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
cout << cache[i][j] << ' ';
}
puts("");
}
puts("");
}
return 0;
} |
ae614cf883d09f7ed35f6413bc270b3108fc89ad | 69e6c82c848156f8426797767304aa42c6849d35 | /reverseInteger.cpp | 08d88ee67d2d38067800d96f16bc937b36cb6c04 | [] | no_license | dalanlan/algo | cea8d79e914f3e973d4ac256e9bb1eaf2a12925c | 94e85d1e1a79646c44f09c58096584b2521628b9 | refs/heads/master | 2020-04-05T18:57:33.051988 | 2016-10-18T08:06:57 | 2016-10-18T08:06:57 | 38,982,619 | 0 | 3 | null | null | null | null | UTF-8 | C++ | false | false | 459 | cpp | reverseInteger.cpp |
/*
LintCode 413: Reverse an integer
Examples:
给定 x = 123,返回 321
给定 x = -123,返回 -321
*/
/**
* @param n the integer to be reversed
* @return the reversed integer
*/
int reverseInteger(int n) {
long res = 0;
int sign = (n<0)?-1:1;
n *= sign;
while(n) {
res = res*10 + n%10;
if(res > INT_MAX) {
return 0;
}
if(res*sign < INT_MIN) {
return 0;
}
n/=10;
}
return sign*res;
} |
bd502936620fe3f685887eed6424e5c42b197563 | 03dc4128478a970b32911d7bc74e2b4dd2e46e65 | /tools/diskoappctrl/inc/cmd.h | deca236202f5c99206e2e6c0637312d94bcb865e | [] | no_license | RomTok/disco-light | 4046337dfedff3a18eb7c72fe9f1ab5c2b6b14b8 | 507c0e0d78770027bd757db777e73d7d251b0237 | refs/heads/master | 2021-01-02T08:45:36.406162 | 2014-02-19T13:08:39 | 2014-02-19T13:08:39 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,110 | h | cmd.h | /***************************************************************************
* Copyright (C) 2005-2007 Stefan Schwarzer, Jens Schneider, *
* Matthias Hardt, Guido Madaus *
* *
* Copyright (C) 2007-2008 BerLinux Solutions GbR *
* Stefan Schwarzer & Guido Madaus *
* *
* Copyright (C) 2009-2013 BerLinux Solutions GmbH *
* *
* Authors: *
* Stefan Schwarzer <stefan.schwarzer@diskohq.org>, *
* Matthias Hardt <matthias.hardt@diskohq.org>, *
* Jens Schneider <jens.schneider@diskohq.org>, *
* Guido Madaus <guido.madaus@diskohq.org>, *
* Patrick Helterhoff <patrick.helterhoff@diskohq.org>, *
* René Bählkow <rene.baehlkow@diskohq.org> *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public *
* License version 2.1 as published by the Free Software Foundation. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
* Lesser General Public License for more details. *
* *
* You should have received a copy of the GNU Lesser General Public *
* License along with this library; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
**************************************************************************/
#ifndef MMSCMD_H_
#define MMSCMD_H_
#include <mms.h>
#include "console.h"
#define MMSCMD_LIST "list"
#define MMSCMD_UPDATE "update"
#define MMSCMD_ACT "act"
#define MMSCMD_DEACT "deact"
#define MMSCMD_EXEC "execute"
#define MMSCMD_EVENT "event"
#define MMSCMD_ADD "add"
#define MMSCMD_VERSION "version"
#define MMSCMD_CMD "cmd"
#define MMSCMD_PLUGIN "plugin"
#define MMSCMD_SOURCE "source"
#define MMSCMD_PARAM "param"
#define MMSCMD_IMPORT "import"
#define MMSCMD_DEBUG "debug"
#define MMSCMD_TYPE "type"
#define MMSCMD_VALUE "value"
#define MMSCMD_CONFIG "config"
#define MMSCMD_HEADING "heading"
#define MMSCMD_PORT "port"
#define MMSCMD_TYPE "type"
#define MMSCMD_MINVALUE "minvalue"
#define MMSCMD_MAXVALUE "maxvalue"
#define MMSCMD_VALUELIST "valuelist"
#define MMSCMD_SEPARATOR "separator"
typedef enum {
UNKNOWN = 0,
LIST,
UPDATE,
ACT,
DEACT,
EXEC,
EVENT,
ADD,
VERSION
} MMSCMD_COMMANDS;
typedef map<string,string> CmdLine;
class Cmd {
private:
bool debug;
string configfile;
CmdLine cmdline;
DataSource *datasource;
Console cons;
void executeExec();
void executeEvent();
void executeList();
void executeUpdate();
void executeAct();
void executeDeact();
void executeVersion();
void prepareDb();
void updateSource();
void updateParameter();
MMSCMD_COMMANDS getCommand();
void printPlugin(MMSPluginData *plugin, bool full);
void printImportproperty(MMSImportPropertyData *prop);
void printImportsource(MMSImportSourceData *src);
void printWorkingdata(MMSConfigData *config);
public:
Cmd(CmdLine &cmdline);
~Cmd();
void handleRequest();
};
#endif /*MMSCMD_H_*/
|
fa85985b34cf9596da6032daee0aef537005e8d2 | 54b0d0f04ce4aea1dbcab72ac819eca320085772 | /WorkerMgrSys/woker_mgr_sys/worker_sys_data.cpp | 6a52e87a725a85e0712bf4332bff5ecc80af6fd7 | [] | no_license | AliesYangpai/WorkerMgrSys | f40cf0d794270ecc4ad1f89e8ebba0129496d75c | e2d1f256f4a93aa179121e44798a88de29a1ec93 | refs/heads/master | 2023-03-16T16:01:49.906748 | 2021-03-08T15:38:42 | 2021-03-08T15:38:42 | 345,236,975 | 0 | 0 | null | null | null | null | GB18030 | C++ | false | false | 958 | cpp | worker_sys_data.cpp | #define _CRT_SECURE_NO_WARNINGS 1
#include "worker_sys_data.h"
WorkerSysData::~WorkerSysData() {}
WorkerSysData::WorkerSysData() {}
WorkerSysMenu* WorkerSysData::GenerateWokerManu()
{
WorkerSysMenu* p_menu = new WorkerSysMenu();
p_menu->set_m_title("欢迎使用职工管理系统");
WorkerSysMenuItemCollection* p_menu_items = new WorkerSysMenuItemCollection();
p_menu_items->add(new WorkerSysMenuItem(0, "退出系统"));
p_menu_items->add(new WorkerSysMenuItem(1, "增加职工"));
p_menu_items->add(new WorkerSysMenuItem(2, "显示职工"));
p_menu_items->add(new WorkerSysMenuItem(3, "删除离职职工"));
p_menu_items->add(new WorkerSysMenuItem(4, "修改职工信息"));
p_menu_items->add(new WorkerSysMenuItem(5, "查找职工信息"));
p_menu_items->add(new WorkerSysMenuItem(6, "按照编号排序"));
p_menu_items->add(new WorkerSysMenuItem(7, "清空所有文档"));
p_menu->set_m_wsmi_collection(p_menu_items);
return p_menu;
}
|
8e1b68fd53e5126943bef2582c9aeb9ba652dd8c | 83c1cbbf25f10fd645f3c72f22f08f41583fd2f5 | /sinks/cmwavfileaudiosink.h | 176a015c18fca15642c4436170db26eef826e87f | [] | no_license | edlcd-develop/cmlib | 36589d5ac0d903919a4790c2356a74ddceb6f194 | 6249f36d074da848eafd4bf822441c3a05c1fd51 | refs/heads/master | 2023-01-30T11:51:46.742194 | 2020-12-08T09:15:47 | 2020-12-08T09:15:47 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 447 | h | cmwavfileaudiosink.h | #ifndef CMWAVFILEAUDIOSINK_H
#define CMWAVFILEAUDIOSINK_H
#include <QObject>
#include "cmfileaudiosink.h"
class CMWavFileAudioSink : public CMFileAudioSink
{
Q_OBJECT
public:
CMWavFileAudioSink(QObject *parent = 0);
protected:
// CMFileAudioSink interface
protected:
bool afterOpen();
bool aboutToClose();
private:
int sample_rate;
int channels;
int bps;
int byte_rate;
};
#endif // CMWAVFILEAUDIOSINK_H
|
dc891c2ce4d820def4765c8cfdcc525dc12010d6 | 8d30aece94cb060dc6068b006858dfca2ac35cfa | /ABC112/D.cpp | d0bc3176e260c30483d0ecff956e77f80e097f8f | [] | no_license | h-hirai/MyRecordOfAtCoder | 573936f9fe4aed90fed7ba7105dbe8b36ec30f81 | 1d0dea81aae9f0479b13be15583fd176f455ec7f | refs/heads/master | 2020-03-22T19:59:05.573672 | 2020-02-24T03:12:31 | 2020-02-24T03:12:31 | 140,565,689 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,021 | cpp | D.cpp | #include <iostream>
#include <vector>
#include <map>
#include <cmath>
#include <algorithm>
std::vector<unsigned int>
get_primes(unsigned int MaxPrime) {
std::vector<unsigned int> primes;
std::vector<bool> is_prime(MaxPrime+1, true);
is_prime[0] = false;
is_prime[1] = false;
for (size_t i=2; i<=std::sqrt(MaxPrime); i++) {
if (is_prime[i]) {
primes.push_back(i);
for (size_t j=i*i; j<=MaxPrime; j+=i) {
is_prime[j] = false;
}
}
}
for (size_t i=std::sqrt(MaxPrime)+1; i<=MaxPrime; i++) {
if (is_prime[i]) {
primes.push_back(i);
}
}
return primes;
}
std::map<unsigned int, size_t>
get_prime_factors(unsigned int N) {
std::map<unsigned int, size_t> prime_factors;
if (N<2) {
prime_factors.insert(std::make_pair(N, 1));
return prime_factors;
}
for (auto const p : get_primes(std::sqrt(N))) {
while (N % p == 0) {
prime_factors[p]++;
N /= p;
}
}
if (N > 1) prime_factors[N]++;
return prime_factors;
}
std::vector<unsigned int>
get_factors(unsigned int N) {
std::vector<unsigned int> factors(1, 1);
for (auto const p : get_prime_factors(N)) {
unsigned int const prime = std::get<0>(p);
unsigned int const exp = std::get<1>(p);
std::vector<unsigned int> mult_space(factors.size());
std::copy(factors.begin(), factors.end(),
mult_space.begin());
for (size_t i=0; i<exp; i++) {
std::transform(mult_space.begin(), mult_space.end(),
mult_space.begin(),
[=](unsigned int a){return a * prime;});
std::copy(mult_space.begin(), mult_space.end(),
std::back_inserter(factors));
}
}
return factors;
}
int main() {
unsigned int N, M;
std::cin >> N >> M;
auto factors = get_factors(M);
std::sort(factors.begin(), factors.end());
auto f = *std::find_if(factors.begin(), factors.end(),
[=](auto f){return f >= N;});
std::cout << M / f << std::endl;
return 0;
}
|
6835d3fb6ddb68f7429213fc7428147bed3a9047 | cbc692796b2e6ce246a6473f88ba4b371576e3f1 | /geometry/proximity/mesh_half_space_intersection.h | 916fe6972e1224c61aca77bc34426c0314f5e939 | [
"BSD-3-Clause"
] | permissive | nikkkkhil/drake | 049952709e8c0fb4d1a70c2cf95ea58ba39be21f | 685afb2ac736228d9eaf7e382b91a20e30f39df6 | refs/heads/master | 2020-08-17T02:02:04.026193 | 2019-10-15T21:55:20 | 2019-10-15T21:55:20 | 215,588,691 | 1 | 0 | NOASSERTION | 2019-10-16T15:59:27 | 2019-10-16T15:59:26 | null | UTF-8 | C++ | false | false | 13,328 | h | mesh_half_space_intersection.h | #pragma once
#include <array>
#include <cmath>
#include <limits>
#include <unordered_map>
#include <utility>
#include <vector>
#include "drake/common/eigen_types.h"
#include "drake/common/sorted_pair.h"
#include "drake/geometry/proximity/mesh_intersection.h"
#include "drake/geometry/proximity/surface_mesh.h"
namespace drake {
namespace geometry {
namespace internal {
template <typename T>
int sgn(const T& x) {
if (x > 0) {
return 1;
} else {
if (x < 0) return -1;
return 0;
}
}
/* Utility routine for getting the vertex index from the
`edges_to_newly_created_vertices` hashtable. Given an edge (defined by its two
end-point vertices a and b) and the signed distances from a plane (`s_a` and
`s_b`, respectively), returns the index of the vertex that splits the edge at a
crossing plane. The method creates the vertex if the edge hasn't previously
been split.
@pre s_a and s_b must not have the same sign (positive, negative, or zero) of
the plane.
*/
template <typename T>
SurfaceVertexIndex GetVertexAddIfNeeded(
SurfaceVertexIndex a, SurfaceVertexIndex b, const T& s_a, const T& s_b,
const std::vector<SurfaceVertex<T>>& vertices_F,
std::unordered_map<SortedPair<SurfaceVertexIndex>, SurfaceVertexIndex>*
edges_to_newly_created_vertices,
std::vector<SurfaceVertex<T>>* new_vertices_F) {
DRAKE_DEMAND(sgn(s_a) != sgn(s_b));
using std::abs;
SortedPair<SurfaceVertexIndex> edge_a_b(a, b);
auto edge_a_b_intersection_iter =
edges_to_newly_created_vertices->find(edge_a_b);
if (edge_a_b_intersection_iter == edges_to_newly_created_vertices->end()) {
const T t = abs(s_a) / (abs(s_a) + abs(s_b));
// We know that the magnitude of the denominator should always be at
// least as large as the magnitude of the numerator (implying that t should
// never be greater than unity). Barring an (unlikely) machine epsilon
// remainder on division, the assertion below should hold.
DRAKE_DEMAND(t >= 0 && t <= 1);
bool inserted;
std::tie(edge_a_b_intersection_iter, inserted) =
edges_to_newly_created_vertices->insert(
{edge_a_b, SurfaceVertexIndex(new_vertices_F->size())});
DRAKE_DEMAND(inserted);
new_vertices_F->emplace_back(
vertices_F[a].r_MV() +
t * (vertices_F[b].r_MV() - vertices_F[a].r_MV()));
}
return edge_a_b_intersection_iter->second;
}
/* Utility routine for getting the vertex index from the
`vertices_to_newly_created_vertices` hashtable. Given a vertex `index` from the
input mesh, returns the corresponding vertex index in `new_vertices_F`. The
method creates the vertex in `new_vertices_F` if it hasn't already been added.
*/
template <typename T>
SurfaceVertexIndex GetVertexAddIfNeeded(
const std::vector<SurfaceVertex<T>>& vertices_F, SurfaceVertexIndex index,
std::unordered_map<SurfaceVertexIndex, SurfaceVertexIndex>*
vertices_to_newly_created_vertices,
std::vector<SurfaceVertex<T>>* new_vertices_F) {
auto v_to_new_v_iter = vertices_to_newly_created_vertices->find(index);
if (v_to_new_v_iter == vertices_to_newly_created_vertices->end()) {
bool inserted;
std::tie(v_to_new_v_iter, inserted) =
vertices_to_newly_created_vertices->insert(
{index, SurfaceVertexIndex(new_vertices_F->size())});
DRAKE_DEMAND(inserted);
new_vertices_F->emplace_back(vertices_F[index]);
}
return v_to_new_v_iter->second;
}
/*
Computes the intersection between a triangle and a half space.
The intersecting geometry (e.g. vertices and triangles) are added to the
provided collections. This method is intended to be used in contexts where
zero area triangles and triangles coplanar with the half space boundary are
unimportant (see note below).
This function is a component of the larger operation of clipping a
SurfaceMesh by a half space. When doing that, we don't want to introduce any
duplicate vertices (beyond those already in the input mesh). This function
uses bookkeeping to prevent the addition of such duplicate vertices, which can
be created when either a vertex lies inside/on the half space or when an edge
intersects the half space. The method tracks these created vertices using
`vertices_to_newly_created_vertices` and `edges_to_newly_created_vertices`,
respectively.
@param vertices_F the vertices from the input mesh as position vectors measured
and expressed in Frame F.
@param triangle a single face from the input mesh.
@param half_space_F the half space with normal to surface expressed in Frame F.
@param[in,out] new_vertices_F the accumulator for all of the vertices in the
intersecting mesh. It should be empty to start and will
gradually accumulate all of the vertices with each subsequent
call to this method.
@param[in,out] new_faces the accumulator for all of the faces in the
intersecting mesh. It should be empty to start and will
gradually accumulate all of the faces with each subsequent
call to this method.
@param[in,out] vertices_to_newly_created_vertices the accumulated mapping from
indices in `vertices_F` to indices in `new_vertices_F`. This
mapping should be empty to start and will gradually accumulate
elements with each subsequent call to this method.
@param[in,out] edges_to_newly_created_vertices the accumulated mapping from
pairs of indices in `vertices_F` to indices in `new_vertices_F`.
This mapping should be empty to start and will gradually
accumulate elements with each subsequent call to this method.
@note Unlike most geometric intersection routines, this method does not
require the user to provide (or the algorithm to compute) a reasonable
floating point tolerance for zero. This simple interface implies both
that the method may construct degenerate triangles and that it may
fail to register an intersection with a triangle that is coplanar with
the half space surface. In certain applications (e.g., hydroelastic
contact), both degenerate triangles and triangles coplanar with the
half space surface are innocuous (in hydroelastic contact, for example,
both cases contribute nothing to the contact wrench).
*/
template <typename T>
void ConstructTriangleHalfspaceIntersectionPolygon(
const std::vector<SurfaceVertex<T>>& vertices_F,
const SurfaceFace& triangle,
const mesh_intersection::HalfSpace<T>& half_space_F,
std::vector<SurfaceVertex<T>>* new_vertices_F,
std::vector<SurfaceFace>* new_faces,
std::unordered_map<SurfaceVertexIndex, SurfaceVertexIndex>*
vertices_to_newly_created_vertices,
std::unordered_map<SortedPair<SurfaceVertexIndex>, SurfaceVertexIndex>*
edges_to_newly_created_vertices) {
DRAKE_DEMAND(new_vertices_F);
DRAKE_DEMAND(new_faces);
DRAKE_DEMAND(vertices_to_newly_created_vertices);
DRAKE_DEMAND(edges_to_newly_created_vertices);
// NOLINTNEXTLINE(whitespace/line_length)
// This code was inspired from
// https://www.geometrictools.com/GTEngine/Include/Mathematics/GteIntrHalfspace3Triangle3.h
//
// Compute the signed distance of each triangle vertex from the half space.
// The table of possibilities is listed next with p = num_positive.
//
// p intersection
// ---------------------------------
// 1. 0 triangle (original)
// 2. 1 quad (2 edges clipped)
// 3. 2 triangle (2 edges clipped)
// 4. 3 none
// Compute the signed distance of each triangle vertex from the half space.
T s[3];
int num_positive = 0;
for (int i = 0; i < 3; ++i) {
s[i] =
half_space_F.CalcSignedDistance(vertices_F[triangle.vertex(i)].r_MV());
if (s[i] > 0) ++num_positive;
}
// Case 1: triangle lies completely within the half space. Preserve
// the ordering of the triangle vertices.
if (num_positive == 0) {
const SurfaceVertexIndex v0_new_index = GetVertexAddIfNeeded(
vertices_F, triangle.vertex(0), vertices_to_newly_created_vertices,
new_vertices_F);
const SurfaceVertexIndex v1_new_index = GetVertexAddIfNeeded(
vertices_F, triangle.vertex(1), vertices_to_newly_created_vertices,
new_vertices_F);
const SurfaceVertexIndex v2_new_index = GetVertexAddIfNeeded(
vertices_F, triangle.vertex(2), vertices_to_newly_created_vertices,
new_vertices_F);
new_faces->emplace_back(v0_new_index, v1_new_index, v2_new_index);
return;
}
// Case 2: The portion of the triangle in the half space is a quadrilateral.
if (num_positive == 1) {
for (SurfaceVertexIndex i0(0); i0 < 3; ++i0) {
if (s[i0] >= 0) {
const SurfaceVertexIndex i1((i0 + 1) % 3);
const SurfaceVertexIndex i2((i0 + 2) % 3);
// Get the vertices that result from intersecting edge i0/i1 and
// i0/i2.
SurfaceVertexIndex edge_i0_i1_intersection_index = GetVertexAddIfNeeded(
i0, i1, s[i0], s[i1], vertices_F, edges_to_newly_created_vertices,
new_vertices_F);
const SurfaceVertexIndex edge_i0_i2_intersection_index =
GetVertexAddIfNeeded(i0, i2, s[i0], s[i2], vertices_F,
edges_to_newly_created_vertices,
new_vertices_F);
// Get the indices of the new vertices, adding them if needed.
const SurfaceVertexIndex i1_new_index = GetVertexAddIfNeeded(
vertices_F, i1, vertices_to_newly_created_vertices, new_vertices_F);
const SurfaceVertexIndex i2_new_index = GetVertexAddIfNeeded(
vertices_F, i2, vertices_to_newly_created_vertices, new_vertices_F);
// Add faces, according to the nice ascii art below (thanks Sean
// Curtis!):
//
// i0
// ╱╲
// e01 ╱ ╲ e02
// ______╱____╲___
// ╱ ╲
// ╱________╲
// i1 i2
//
// New triangles to cover the quad and maintain the winding.
// (i1, i2, e01)
// (i2, e02, e01)
//
new_faces->emplace_back(i1_new_index, i2_new_index,
edge_i0_i1_intersection_index);
new_faces->emplace_back(i2_new_index, edge_i0_i2_intersection_index,
edge_i0_i1_intersection_index);
return;
}
}
DRAKE_UNREACHABLE();
}
// Case 3: The portion of the triangle in the half space is a triangle.
if (num_positive == 2) {
for (SurfaceVertexIndex i0(0); i0 < 3; ++i0) {
if (s[i0] <= 0) {
const SurfaceVertexIndex i1((i0 + 1) % 3);
const SurfaceVertexIndex i2((i0 + 2) % 3);
// Get the vertex that corresponds to i0.
const SurfaceVertexIndex i0_new_index = GetVertexAddIfNeeded(
vertices_F, i0, vertices_to_newly_created_vertices, new_vertices_F);
// Get the vertex that results from intersecting edge i0/i1.
const SurfaceVertexIndex edge_i0_i1_intersection_index =
GetVertexAddIfNeeded(i0, i1, s[i0], s[i1], vertices_F,
edges_to_newly_created_vertices,
new_vertices_F);
// Get the vertex that results from intersecting edge i0/i2.
const SurfaceVertexIndex edge_i0_i2_intersection_index =
GetVertexAddIfNeeded(i0, i2, s[i0], s[i2], vertices_F,
edges_to_newly_created_vertices,
new_vertices_F);
new_faces->emplace_back(i0_new_index, edge_i0_i1_intersection_index,
edge_i0_i2_intersection_index);
return;
}
}
DRAKE_UNREACHABLE();
}
// Case 4: The triangle is outside the half space.
DRAKE_DEMAND(num_positive == 3);
return;
}
} // namespace internal
/**
Constructs the SurfaceMesh that results from intersecting a triangle mesh with
a half space.
@param input_mesh_F the mesh with vertices measured and expressed in some
frame, F.
@param half_space_F the half space, expressed in Frame F.
@returns the SurfaceMesh corresponding to the intersection, the vertices of
which will be measured and expressed in Frame F.
*/
template <typename T>
SurfaceMesh<T> ConstructSurfaceMeshFromMeshHalfspaceIntersection(
const SurfaceMesh<T>& input_mesh_F,
const mesh_intersection::HalfSpace<T>& half_space_F) {
std::vector<SurfaceVertex<T>> new_vertices_F;
std::vector<SurfaceFace> new_faces;
std::unordered_map<SurfaceVertexIndex, SurfaceVertexIndex>
vertices_to_newly_created_vertices;
std::unordered_map<SortedPair<SurfaceVertexIndex>, SurfaceVertexIndex>
edges_to_newly_created_vertices;
for (const SurfaceFace& face : input_mesh_F.faces()) {
internal::ConstructTriangleHalfspaceIntersectionPolygon(
input_mesh_F.vertices(), face, half_space_F, &new_vertices_F,
&new_faces, &vertices_to_newly_created_vertices,
&edges_to_newly_created_vertices);
}
return SurfaceMesh<T>(std::move(new_faces), std::move(new_vertices_F));
}
} // namespace geometry
} // namespace drake
|
3a278352b4ccc678cc40d5dca30d3050fb5f1e0b | 2ed4ac479992aa5f7c9cafc9218d56e78327c519 | /HybridRenderer/src/Materials/Material.hpp | e5bd9767e03bbd3226f613ba9d8321ab611c1bf1 | [
"MIT"
] | permissive | DatTestBench/HybridRenderer | c8acc341ebe0a4a0e061b037c450e5676f060324 | 9deef9544f261f20ab6630fca14cf866076fd7f2 | refs/heads/main | 2023-03-09T11:37:39.686067 | 2023-02-27T18:47:17 | 2023-02-27T18:47:17 | 304,260,216 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 5,718 | hpp | Material.hpp | #ifndef MATERIAL_HPP
#define MATERIAL_HPP
//This is the "EFFECT". Holding data needed for the required DXEffect (the "SHADER")
//General includes
#include <iostream>
#include <string>
#include <sstream>
//Project includes
#include "Debugging/Logger.hpp"
#include "Helpers/Vertex.hpp"
#include "Scene/SceneGraph.hpp"
//#include "Scene/SceneGraph.hpp"
#define D3DLOAD_TECH(effect, tech, name) \
tech = (effect)->GetTechniqueByName(name); \
if (!(tech)->IsValid()) \
LOG(LEVEL_ERROR, "Technique " << (name) << " not found")
#define D3DLOAD_VAR(effect, var, name, varType) \
var = (effect)->GetVariableByName(name)->varType(); \
if (!(var)->IsValid()) \
LOG(LEVEL_ERROR, "Variable " << (name) << " not found")
class Material
{
public:
Material(ID3D11Device* pDevice, const std::wstring& effectFile, const std::string_view name, const bool hasTransparency = false)
: m_Name(name),
m_HasTransparency(hasTransparency),
m_pEffect(LoadEffect(pDevice, effectFile))
{
D3DLOAD_TECH(m_pEffect, m_pTechnique, "DefaultTechnique")
D3DLOAD_VAR(m_pEffect, m_pMatWorldViewProjVariable, "gWorldViewProj", AsMatrix)
D3DLOAD_VAR(m_pEffect, m_pSamplerVariable, "gSampleType", AsScalar)
D3DLOAD_VAR(m_pEffect, m_pRenderTypeVariable, "gRenderType", AsScalar)
}
virtual ~Material()
{
//Releasing scalar variables
SafeRelease(m_pSamplerVariable);
SafeRelease(m_pRenderTypeVariable);
//Releasing matrix variables
SafeRelease(m_pMatWorldViewProjVariable);
//Releasing technique and shader
SafeRelease(m_pTechnique);
SafeRelease(m_pEffect);
}
DEL_ROF(Material)
//Workers
/*Software*/
virtual RGBColor Shade(const VertexOutput& v, const glm::vec3& lightDirection, const glm::vec3& viewDirection, const glm::vec3& normal) const = 0;
//Setters
/*D3D*/
virtual void SetMaps() = 0;
virtual void SetMatrices(const glm::mat4& projectionMat, const glm::mat4& viewMat, const glm::mat4& worldMat) = 0;
virtual void SetScalars() = 0;
void UpdateTypeSettings(const HardwareRenderType& renderType, const HardwareFilterType& samplerType) const noexcept
{
m_pSamplerVariable->SetInt(magic_enum::enum_integer(samplerType));
m_pRenderTypeVariable->SetInt(magic_enum::enum_integer(renderType));
}
//Getters
/*General*/
[[nodiscard]] constexpr auto GetName() const noexcept -> std::string_view { return m_Name; }
[[nodiscard]] constexpr auto HasTransparency() const noexcept -> bool { return m_HasTransparency; }
/*Software*/
[[nodiscard]] virtual auto GetMappedNormal(const VertexOutput& v) const noexcept -> glm::vec3 { return v.normal; }
/*D3D*/
[[nodiscard]] constexpr auto GetEffect() const noexcept -> ID3DX11Effect* { return m_pEffect; }
[[nodiscard]] constexpr auto GetTechnique() const noexcept -> ID3DX11EffectTechnique* { return m_pTechnique; }
[[nodiscard]] constexpr auto GetWorldViewProjMat() const noexcept -> ID3DX11EffectMatrixVariable* { return m_pMatWorldViewProjVariable; }
[[nodiscard]] constexpr auto GetSamplerType() const noexcept -> ID3DX11EffectScalarVariable* { return m_pSamplerVariable; }
[[nodiscard]] constexpr auto GetRenderType() const noexcept -> ID3DX11EffectScalarVariable* { return m_pRenderTypeVariable; }
protected:
/*General*/
std::string_view m_Name;
bool m_HasTransparency;
/*D3D*/
ID3DX11Effect* m_pEffect; // "SHADER"
ID3DX11EffectTechnique* m_pTechnique;
ID3DX11EffectMatrixVariable* m_pMatWorldViewProjVariable;
ID3DX11EffectScalarVariable* m_pSamplerVariable;
ID3DX11EffectScalarVariable* m_pRenderTypeVariable;
//Handles "SHADER" compilation
static ID3DX11Effect* LoadEffect(ID3D11Device* pDevice, const std::wstring& effectFile)
{
HRESULT result = S_OK;
ID3D10Blob* pErrorBlob = nullptr;
ID3DX11Effect* pEffect;
DWORD shaderFlags = 0;
#if defined( DEBUG ) || defined ( _DEBUG )
shaderFlags |= D3DCOMPILE_DEBUG;
shaderFlags |= D3DCOMPILE_SKIP_OPTIMIZATION;
#endif
result = D3DX11CompileEffectFromFile(effectFile.c_str(),
nullptr,
nullptr,
shaderFlags,
0,
pDevice,
&pEffect,
&pErrorBlob);
if (FAILED(result))
{
if (pErrorBlob != nullptr)
{
auto* pErrors = static_cast<char*>(pErrorBlob->GetBufferPointer());
std::wstringstream ss;
for (unsigned int i = 0; i < pErrorBlob->GetBufferSize(); i++)
ss << pErrors[i];
OutputDebugStringW(ss.str().c_str());
pErrorBlob->Release();
pErrorBlob = nullptr;
// todo add compat for wstring in logger (probably just converting from string to wstring internally
// LOG(LEVEL_ERROR, ss)
std::wcout << ss.str() << std::endl;
}
else
{
//LOG(LEVEL_ERROR, "EffectLoader: Failed to CreateEventFromFile!")
std::wstringstream ss;
ss << "EffectLoader: Failed to CreateEventFromFile!\nPath: " << effectFile;
std::wcout << ss.str() << std::endl;
return nullptr;
}
}
return pEffect;
}
};
#endif // !MATERIAL_HPP
|
4a031f0907b9229a509ab1dec1d6c3cc7814e277 | c7c5511488d2be20f8fe385da44c4735a4076741 | /ch06/function_prototype.cpp | 6acd8ef06dcacce0c70dc71cac4016ce6d24ebf9 | [] | no_license | aleecan/jumping-into-cpp | 9acf5173f4fc1d017bd7e3ef7bb98b6fd673caee | 0399328b34bf98c03c524a481eac630866e90e71 | refs/heads/master | 2020-08-03T10:18:23.002428 | 2019-01-24T10:46:15 | 2019-01-24T10:46:15 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 617 | cpp | function_prototype.cpp | #include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <functional>
#include <string>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <algorithm>
#include <iostream>
#include <sstream>
using namespace std;
#define REP(i, n) for(int i = 0; i < (int)(n); ++ i)
#define FOR(i, b, e) for(auto i = b; i < e; ++ i)
#define all(x) (x).begin(), (x).end()
int add(int x, int y);
int main() {
int result = add(1, 2);
cout << "The result is: " << result << endl;
cout << "Adding 3 and 4 gives us: " << add(3, 4);
}
int add(int x, int y) {
return x + y;
}
|
0e5c63d802a6cf173f68fdd7d1522cdf74c94c98 | 5d85da56f6b68c919472cd6d4d9da39324f9004a | /libraries/CrystalStructs.h | 1cb1d1be42a8050b9f1b79f624485dd756040aed | [] | no_license | marcopizzichemi/ModuleCalibration | bd479b5c74d6bcfe07818fba8cfac00664351780 | 07f957f589c14f8ec88ab71a266622b2950a55b7 | refs/heads/master | 2023-05-01T20:50:01.917322 | 2023-04-17T08:55:07 | 2023-04-17T08:55:07 | 34,870,993 | 0 | 0 | null | 2016-04-19T10:01:50 | 2015-04-30T18:50:37 | C++ | UTF-8 | C++ | false | false | 4,045 | h | CrystalStructs.h | struct detector_t
{
int digitizerChannel;
float saturation;
float pedestal;
float gain;
};
struct slice_t
{
Float_t wmin;
Float_t wmax;
Float_t wmean;
Float_t werr;
long long int entries;
std::vector<int> tChannel;
std::vector<Float_t> averageDelay;
std::vector<Float_t> averageDeltaT;
std::vector<Float_t> varianceDeltaT;
std::vector<long long int> nVarianceDeltaT;
std::vector<long long int> nDeltaT;
Float_t **covariance;
Float_t **inverse_covariance;
long long int **entries_covariance;
Float_t **normalized_covariance;
// TGraphErrors* delay;
// TF1* delay_line;
// TH2F* deltaTscatter;
// TGraphErrors* deltaTgraph;
// TF1* deltaTline;
// std::vector<TH1F*> deltaTslice;
// std::vector<double> wmean;
// std::vector<double> werr;
//
//
// std::vector<double> dx;
// std::vector<double> dy;
// std::vector<double> dex;
// std::vector<double> dey;
};
struct graphs_t
{
int timingChannel;
TGraphErrors* graph;
};
struct correction_graphs_t
{
int timingChannel;
bool isMainChannel;
TGraphErrors* delay;
TGraphErrors* rms;
};
struct polished_correction_t
{
int timingChannel;
double mean;
double rms;
};
struct Crystal_t
{
int number;
int detectorChannel;
int timingChannel;
float length;
std::vector<int> relevantForW;
std::vector<int> delayTimingChannels;
TCut *CrystalCut;
TCut *CrystalCutWithoutCutG;
TCut *PhotopeakEnergyCut;
std::vector<TCutG*> cutg;
TGraph *calibrationGraph;
TGraph *wz;
TTreeFormula *Formula;
TTreeFormula *FormulaAnalysis;
TTreeFormula *FormulaTagAnalysis;
TTreeFormula *FormulaJustCutG;
int taggingCrystalTimingChannel;
int taggingCrystalChannel;
float taggingPosition;
TCut* taggingPhotopeakCut;
std::vector<detector_t> detectorSaturation;
float marginWZgraph;
float WrangeBinsForTiming;
float minAcceptedW;
float maxAcceptedW;
float wMinSlicing;
float wMaxSlicing;
float wStepSlicing;
std::vector<double> z;
TGraphErrors* tw_correction;
TGraphErrors* rms_tw_correction;
std::vector<TGraphErrors*> delay;
std::vector<TGraphErrors*> rms_delay;
TF1 *tw_correction_line;
TF1 *rms_tw_correction_line;
std::vector<TF1*> delay_line;
std::vector<TF1*> rms_delay_line;
const char* path;
bool accepted;
bool polishedCorrection;
std::vector<int> tChannelsForPolishedCorrectionMean;
std::vector<int> tChannelsForPolishedCorrectionFWHM;
std::vector<double> meanForPolishedCorrection;
std::vector<double> fwhmForPolishedCorrection;
std::vector<polished_correction_t> polished_correction;
std::vector<slice_t> slice;
TGraph *** inverse_covariance_element; // matrix of TGraph, one for each element of the inverse covariance element s^{-1}_i,j(w) that is a function of doi...
TF1 *** inverse_covariance_element_line;
std::vector<graphs_t> delay_graphs;
std::vector<graphs_t> rms_graphs;
std::vector<correction_graphs_t> correction_graphs;
TH1F* lightCentralHisto;
TH1F* lightAllHisto;
TH1F* basicCTRhisto;
// CTR histograms. Here because it's easier like this, but they shouldn't belong...
TH1F *simpleCTR;
TH1F *centralCTR;
TH1F *allCTR;
TH1F *poliCorrCTR;
// std::vector<TH1F*> v_simple_CTR;
// std::vector<TH1F*> v_central_CTR;
std::vector<TH1F*> v_all_CTR;
std::vector<TH1F*> v_poli_CTR;
std::vector<TH2F*> v_all_CTRvsZ;
std::vector<TH2F*> v_poli_CTRvsZ;
TH1F *likeCTR;
TH1F *hybridCTR;
TH1F *simpleCTR_norm;
TH1F *centralCTR_norm;
TH1F *allCTR_norm;
TH1F *poliCorrCTR_norm;
TH1F *hybridCTR_norm;
TH1F *likeCTR_norm;
TH2F *ctrVSw;
TH1D* aSlices;
TGraph *crtVSw_gr;
TCut* TriggerChannelCut ;
TCut* broadCut ;
TCut* CutNoise ;
TCut* PhotopeakEnergyCutnergyCut;
TH2F *singleADCvsZ;
TH2F *totADCvsZ;
TH2F *basicCTRvsZ;
TH2F *fullCTRvsZ;
TH2F *poliCTRvsZ;
TH2F *CompleteSingleADCvsZ;
TH2F *CompleteTotADCvsZ;
TF1* singleFit;
};
bool compareByNumber(const Crystal_t &a,const Crystal_t &b)
{
return a.number < b.number;
}
|
be01d7520f4d0573ed06a4e98ce876799ba0061f | b700f514dfa058a9e403d734ab391d8144884efb | /2.정렬/insertionSort.cpp | 0802697e44e42a5f18cb28cfda39e69cb7fe9df4 | [] | no_license | kyuwonii/algostudy | 24744a9153b05b7d3347f2ee492a426797c1c0d4 | 4194c2123e9ee5677b6a76157f5fff93cfc754cd | refs/heads/master | 2023-01-21T15:06:20.259617 | 2020-12-01T03:22:02 | 2020-12-01T03:22:02 | 316,994,221 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 247 | cpp | insertionSort.cpp | void insertionSort(vector<int> v){
for(int i=1 ; i<v.size(); i++){
int key = v[i], j = i-1;
while(j<=0 && key<v[j]){
v[j+1]=v[j];
j--;
}
v[j+1] = key;
}
} |
72b9f899f58ed41e4d066869446dc5636fdf8b04 | e798f3cd0d6cc6ad191702bbb387afdb0ae9eab0 | /Classes/Shopping/ShoppingDialog.cpp | 65afb4d26a2d00a21c446dbf36d854a9d3df7ea9 | [] | no_license | Morgan87/FlameDragonX | 9dbd359c939df08a1f7c7a8a769d9408bf50ca10 | 15ed056572c52df76cfea8990cc1e5f81331c8fc | refs/heads/master | 2021-05-07T04:08:19.692309 | 2016-11-29T22:41:46 | 2016-11-29T22:41:46 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,081 | cpp | ShoppingDialog.cpp | //
// ShoppingDialog.cpp
// FlameDragonX
//
// Created by SuiYi on 11/3/16.
//
//
#include "ShoppingDialog.hpp"
#include "ShoppingLayer.hpp"
#include "Constants.hpp"
ShoppingDialog::ShoppingDialog()
{
_callbackNode = nullptr;
_returnValue = -1;
}
void ShoppingDialog::showDialog(ShoppingLayer * layer)
{
_layer = layer;
_chapterRecord = _layer->getRecord();
_baseSprite = ScaledSprite::create("Others/MessageBox.png");
_baseSprite->setPosition(Vec2(240, 10));
_baseSprite->setAnchorPoint(Vec2(0.5f, 0));
_baseSprite->setScale(Constants::DEFAULT_MESSAGEBOX_SCALE);
_layer->addChild(_baseSprite);
}
void ShoppingDialog::closeDialog()
{
_layer->removeChild(_baseSprite);
_layer->setActiveDialog(nullptr);
if (_callbackNode != nullptr)
{
CallbackMethod * method = CallbackMethod::create(_callbackNode, _callbackMethod, _returnValue);
method->execute();
}
}
void ShoppingDialog::setCallback(Ref* node, SEL_CALLBACK1 method)
{
this->_callbackNode = node;
this->_callbackMethod = method;
}
|
40bf234407559e7620b4e1b47016cc3fdc65b10f | f2b924ff05b2eea8678f12ef9b90d48623e8f353 | /MergeInterval.cpp | 0c0f8c012a47f3d06842f0418597b507817f21e0 | [
"Apache-2.0"
] | permissive | tcoderwang913/algorithmic_study | 9f3048b6733889a5ea3c8fb8c5fe2fdd5163fc0c | eee1df44925d5425f64c3ccddec7acebcdb96196 | refs/heads/master | 2021-01-10T20:24:53.856817 | 2014-07-04T01:15:12 | 2014-07-04T01:15:12 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 954 | cpp | MergeInterval.cpp | /**
Given a collection of intervals, merge all overlapping intervals.
For example,
Given [1,3],[2,6],[8,10],[15,18],
return [1,6],[8,10],[15,18].
*/
class Solution {
public:
struct sorter {
bool operator() (const Interval& lhs, const Interval& rhs) {
return lhs.start < rhs.start;
}
};
vector<Interval> merge(vector<Interval> &intervals) {
vector<Interval> ret;
if (intervals.empty()) return ret;
std::sort(intervals.begin(), intervals.end(), sorter());
ret.push_back(intervals[0]);
for (int i = 1; i < intervals.size(); ++i) {
Interval currInterval = ret.back();
if (intervals[i].start > currInterval.end) {
ret.push_back(intervals[i]);
}
else {
ret.back().end = std::max(currInterval.end, intervals[i].end);
}
}
return ret;
}
}; |
a322a1bdebdcdbf5584fd385c86e6e50df7b35c8 | 472a77c7e1c24b0165602db92f6aac2fc83ec449 | /PreparationRoot/draw.cxx | d0697ece56b62f3adb1594c007599cea1acbac3c | [] | no_license | ml4ecal/Transparency | 888c6822424968de6c43eb1e7259e63f820c4c07 | 073aac446cb72a59780be5507be59150e0e1e8ad | refs/heads/master | 2022-10-26T13:52:48.591170 | 2022-09-01T08:26:58 | 2022-09-01T08:26:58 | 195,006,582 | 0 | 3 | null | 2022-09-01T08:24:39 | 2019-07-03T07:56:25 | Jupyter Notebook | UTF-8 | C++ | false | false | 1,803 | cxx | draw.cxx | //
//---- plot Laser
//
void draw(std::string nameInputFile = "Laser2017_noTP.root", int ix = 62, int iy = 50, int iz = 1) {
std::cout << " ix = " << ix << std::endl;
std::cout << " iy = " << iy << std::endl;
std::cout << " iz = " << iz << std::endl;
gStyle->SetOptStat(0);
TFile* fileIn = new TFile(nameInputFile.c_str(), "READ");
TTree* ntu = (TTree*) fileIn -> Get ("ntu");
std::cout << " entries = " << ntu->GetEntries() << std::endl;
TString laser_string = Form ("nrv");
TString time_string = Form ("time[0]");
TString toDraw = Form ("%s:%s", laser_string.Data(), time_string.Data());
TString toCut = Form ("ix==%d && iy==%d && iz==%d", ix, iy, iz);
std::cout << " toDraw = " << toDraw.Data() << std::endl;
std::cout << " toCut = " << toCut.Data() << std::endl;
ntu->Draw(toDraw.Data(), toCut.Data(), "goff");
std::cout << " ntu->GetSelectedRows() = " << ntu->GetSelectedRows() << std::endl;
TGraph *gr_laser = new TGraph(ntu->GetSelectedRows(), ntu->GetV2(), ntu->GetV1());
//---- style ----
gr_laser->SetMarkerSize (0.2);
gr_laser->SetMarkerStyle (20);
gr_laser->SetMarkerColor (kRed);
gr_laser->SetLineWidth (1);
gr_laser->SetLineColor (kRed);
//---- style (end) ----
TCanvas* cclaser = new TCanvas ("cclaser", toCut.Data(), 1600, 600);
gr_laser->SetTitle(toCut.Data());
gr_laser->Draw("AP");
gr_laser->GetYaxis()->SetTitle("transparency");
gr_laser->GetXaxis()->SetTitle("time");
gr_laser->GetXaxis()->SetTimeDisplay(1);
gr_laser->GetXaxis()->SetNdivisions(-503);
gr_laser->GetXaxis()->SetTimeFormat("%Y-%m-%d %H:%M");
gr_laser->GetXaxis()->SetTimeOffset(0,"gmt");
cclaser->SetGrid();
}
|
a98fb41c490b9bca98d253f0281b89fd5654f04f | 5b784c709200c08af0328a8c4db53194d5d324b9 | /U2/tree.cpp | 7ebb43faae8e2f1c723e5a3483ac417774cda17f | [] | no_license | Zerwas/ComputerVision | 25f1f5961fa6b0e938c5d39070bd441531d3367b | 9de3107e706f25ab7e4c9dc75e2672fad96b19f1 | refs/heads/master | 2021-01-22T11:55:09.963722 | 2015-01-30T20:47:08 | 2015-01-30T20:47:08 | 26,333,163 | 4 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 13,749 | cpp | tree.cpp | #include "opencv2/imgproc/imgproc.hpp"
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <tree.h>
#include <math.h>
using namespace cv;
using namespace std;
Tree::~Tree(){
delete[] maxTree;
delete[] minTree;
delete[] parents;
delete[] elements;
}
Tree::Tree(int width):width(width),size(width*width),pos(0)
{
//printf("%d\n",size);
//size-1 is allways devisible by 4 (4n²+4n)!!!
elements=new Vec3b[size];
parents=new int[size];
numberOfNodes=(size-1)/2-1;
numberOfFullNodes=(numberOfNodes-1)/2;
//initialize trees
maxTree=new Node[numberOfNodes];
minTree=new Node[numberOfNodes+1];
maxTree[0].leftChild=1;
maxTree[0].rightChild=2;
maxTree[0].parent=-1;
//maxTree[0].extrema=0;
maxTree[1].parent=0;
maxTree[2].parent=0;
minTree[0].leftChild=1;
minTree[0].rightChild=2;
minTree[0].parent=-1;
//minTree[0].extrema=size-1;
minTree[1].parent=0;
minTree[2].parent=0;
for(int ebene=1;ebene<size/2;ebene=ebene*2+1){
for(int i=0;i<=ebene&&i+ebene<numberOfFullNodes;i++){
//maxTree[ebene+i].extrema=((numberOfNodes+1)/(ebene+1))*i;
//printf("%d,%d,%d\n",ebene+i,((numberOfNodes+1)/(ebene+1))*i,numberOfNodes+((numberOfNodes+1)/(ebene+1))*i);
maxTree[ebene+i].leftChild=ebene*2+2*i+1;
maxTree[ebene*2+2*i+1].parent=ebene+i;
maxTree[ebene+i].rightChild=ebene*2+2*i+2;
maxTree[ebene*2+2*i+2].parent=ebene+i;
//minTree[ebene+i].extrema=numberOfNodes+((numberOfNodes+1)/(ebene+1))*i;
minTree[ebene+i].leftChild=ebene*2+2*i+1;
minTree[ebene*2+2*i+1].parent=ebene+i;
minTree[ebene+i].rightChild=ebene*2+2*i+2;
minTree[ebene*2+2*i+2].parent=ebene+i;
}
}
//minTree has odd # of leafs
//minTree[numberOfFullNodes].extrema=numberOfNodes;//nedded?
minTree[numberOfFullNodes].leftChild=numberOfNodes;
minTree[numberOfNodes].parent=numberOfFullNodes;
//fill parent references
for(int i=0;i<(size-1)/2;i++){
//printf("%d\n",i);
parents[i]=numberOfFullNodes+i/2;
if(i%2==0) maxTree[numberOfFullNodes+i/2].leftChild=i;
else maxTree[numberOfFullNodes+i/2].rightChild=i;
}
for(int i=1;i<(size+1)/2+1;i++){
//printf("%d\n",(size-1)/2+i-1);
parents[(size-1)/2+i-1]=numberOfNodes+numberOfFullNodes+i/2;
if(i%2==0) minTree[numberOfFullNodes+i/2].leftChild=(size-1)/2+i-1;
else minTree[numberOfFullNodes+i/2].rightChild=(size-1)/2+i-1;
}
//fill extrema
for(int i=numberOfFullNodes;i<numberOfNodes;i++){
//printf("%d,%d:%d\n",i,(i-numberOfFullNodes)*2,numberOfNodes+1+(i-numberOfFullNodes)*2);
maxTree[i].extrema=maxTree[i].leftChild;
Node node=maxTree[i];
//push extrema to top of tree to create a consistent state
while (node.parent!=-1) {
maxTree[node.parent].extrema=maxTree[i].extrema;
node=maxTree[node.parent];
}
minTree[i+1].extrema=minTree[i+1].rightChild;
node=minTree[i+1];
while (node.parent!=-1) {
minTree[node.parent].extrema=minTree[i+1].extrema;
node=minTree[node.parent];
}
}
}
Vec3b Tree::getMedian(){
//first element is root
//minTree has one element more then maxTree so minTree minimum is Median
return elements[minTree[0].extrema];
}
/**
* @brief Tree::compare the given vectors
* @param a
* @param b
* @return true if a>b
*/
bool Tree::compare(Vec3b a,Vec3b b){
return a[0]+a[1]+a[2]>b[0]+b[1]+b[2];
}
/**
* @brief Tree::balance
* @param position of element being balanced
* @param Tree in which the element is
* @param node parent node of the element
* @param max true if maxTree false if minTree
*/
void Tree::balance(int position, Node *Tree, int node, bool max){
// printf("balance:%d,(%d,%d:%d)\n",position,Tree[node].leftChild,Tree[node].rightChild,Tree[node].parent);
r=Tree[node].rightChild;
if(!max&&node==numberOfFullNodes){
//former minimum is at node with 1 leaf
l=Tree[Tree[node].leftChild].extrema;
}
else{
l=Tree[node].leftChild;
}
//update parent extrema
Tree[node].extrema=((max^compare(elements[r],elements[l])))?l:r;
node=Tree[node].parent;
while(node!=-1)
{
//if(Tree[node].extrema==position)
h=Tree[node].extrema;
l=Tree[Tree[node].leftChild].extrema;
if(!max&&node==numberOfFullNodes){
//check for node with 1 leaf
r=Tree[node].rightChild;
}
else{
r=Tree[Tree[node].rightChild].extrema;
}
//update extrema
Tree[node].extrema=((max^compare(elements[r],elements[l])))?l:r;
//if extrema did not change stop
if (Tree[node].extrema==h&&Tree[node].extrema!=position)
break;
//move up in tree
node=Tree[node].parent;
}
}
void Tree::printFilter(){
Vec3b a=getMedian();
printf("Filter,Median:%d\n",a[0]+a[1]+a[2]);
for (int i = width-1; i >=0; --i) {
for (int j = 0; j < width; ++j) {
printf("%d",elements[(pos+i+j*width)%size][0]);
/*a=elements[(pos+i+j*width)%size];
if (a[0]+a[1]+a[2]<10) printf("%d",0);
else if (a[0]+a[1]+a[2]<100) printf("%d",1);
if (a[0]+a[1]+a[2]>=100) printf("%d",2);//*/
}
printf(" \n");
}
}
Vec3b Tree::insertR(Vec3b newEle){
Vec3b oldEle=elements[pos];
if (compare(newEle,elements[minTree[0].extrema])){
//insert new element into minTree
//printf("1.");
if(parents[pos]>=numberOfNodes){
//printf("1\n");
//old element is in minTree too
elements[pos]=newEle;
balance(pos,minTree,parents[pos]-numberOfNodes,false);//care if elem[pos]=extrema
}
else{
//printf("2:%d,%d\n",pos,minTree[0].extrema);
//old element is in maxTree
//swap newEle->minTree.extrema->oldEle
int p=parents[pos];
h=minTree[0].extrema;
//bool maxL=!(maxTree[p].rightChild==pos);//change all of these to right child cause off odd #
//bool minL=!(minTree[parents[minTree[0].extrema]-numberOfNodes].rightChild==minTree[0].extrema);
//printf("nL:%d\n",maxL);
if (maxTree[p].rightChild==pos)
maxTree[p].rightChild=h;
else
maxTree[p].leftChild=h;
if(minTree[parents[h]-numberOfNodes].rightChild==h)
minTree[parents[h]-numberOfNodes].rightChild=pos;
else
minTree[parents[h]-numberOfNodes].leftChild=pos;
parents[pos]=parents[h];
parents[h]=p;
elements[pos]=newEle;
//balance trees again
balance(h,maxTree,parents[h],true);
balance(pos,minTree,parents[pos]-numberOfNodes,false);//all
}
}
else{
//printf("2.");
if (compare(newEle,elements[maxTree[0].extrema])){
//printf("1\n");
//if new element is between the trees insert it at position of old element
elements[pos]=newEle;
if (parents[pos]>=numberOfNodes)
balance(pos,minTree,parents[pos]-numberOfNodes,false);
else
balance(pos,maxTree,parents[pos],true);
}
else{
//printf("2.");
//insert new element into maxTree
if(parents[pos]>=numberOfNodes){
//printf("1\n");
//old element is in minTree
//swap newEle->maxTree.extrema->oldEle
int p=parents[pos]-numberOfNodes;
h=maxTree[0].extrema;
//bool maxL=!(minTree[p].rightChild==pos);
//bool minL=!(maxTree[parents[maxTree[0].extrema]].rightChild==maxTree[0].extrema);
if (minTree[p].rightChild==pos)
minTree[p].rightChild=h;
else
minTree[p].leftChild=h;
if(maxTree[parents[h]].rightChild==h)
maxTree[parents[h]].rightChild=pos;
else
maxTree[parents[h]].leftChild=pos;
parents[pos]=parents[h];
parents[h]=p+numberOfNodes;
elements[pos]=newEle;
//balance trees again
balance(h,minTree,parents[h]-numberOfNodes,false);
balance(pos,maxTree,parents[pos],true);
}
else{
//printf("2\n");
//old element is in maxTree too
elements[pos]=newEle;
balance(pos,maxTree,parents[pos],true);
}
}
}
pos=(pos+1)%size;
//printFilter();
return oldEle;
}
Vec3b Tree::insertL(Vec3b newEle){
pos=(pos+size-1)%size;//pos--
Vec3b oldEle=elements[pos];
insert(newEle);
//printFilter();
return oldEle;
}
Vec3b Tree::insertB(Vec3b newEle){//does not work properly
Vec3b oldEle=elements[pos];
insert(newEle);
pos=(pos+width)%size;
//printFilter();
return oldEle;
}
/**
* not in use
* @brief Tree::insert
* @param newEle
*/
void Tree::insert(Vec3b newEle){
//printf("%d\n",minTree[0].extrema);
if (compare(newEle,elements[minTree[0].extrema])){
//insert new element into minTree
//printf("1.");
if(parents[pos]>=numberOfNodes){
//printf("1\n");
//old element is in minTree too
elements[pos]=newEle;
balance(pos,minTree,parents[pos]-numberOfNodes,false);//care if elem[pos]=extrema
}
else{
//printf("2:%d,%d\n",pos,minTree[0].extrema);
//old element is in maxTree
//swap newEle->minTree.extrema->oldEle
int p=parents[pos];
h=minTree[0].extrema;
//bool maxL=!(maxTree[p].rightChild==pos);//change all of these to right child cause off odd #
//bool minL=!(minTree[parents[minTree[0].extrema]-numberOfNodes].rightChild==minTree[0].extrema);
//printf("nL:%d\n",maxL);
if (maxTree[p].rightChild==pos)
maxTree[p].rightChild=h;
else
maxTree[p].leftChild=h;
if(minTree[parents[h]-numberOfNodes].rightChild==h)
minTree[parents[h]-numberOfNodes].rightChild=pos;
else
minTree[parents[h]-numberOfNodes].leftChild=pos;
parents[pos]=parents[h];
parents[h]=p;
elements[pos]=newEle;
//balance trees again
balance(h,maxTree,parents[h],true);
balance(pos,minTree,parents[pos]-numberOfNodes,false);//all
}
}
else{
//printf("2.");
if (compare(newEle,elements[maxTree[0].extrema])){
//printf("1\n");
//if new element is between the trees insert it at position of old element
elements[pos]=newEle;
if (parents[pos]>=numberOfNodes)
balance(pos,minTree,parents[pos]-numberOfNodes,false);
else
balance(pos,maxTree,parents[pos],true);
}
else{
//printf("2.");
//insert new element into maxTree
if(parents[pos]>=numberOfNodes){
//printf("1\n");
//old element is in minTree
//swap newEle->maxTree.extrema->oldEle
int p=parents[pos]-numberOfNodes;
h=maxTree[0].extrema;
//bool maxL=!(minTree[p].rightChild==pos);
//bool minL=!(maxTree[parents[maxTree[0].extrema]].rightChild==maxTree[0].extrema);
if (minTree[p].rightChild==pos)
minTree[p].rightChild=h;
else
minTree[p].leftChild=h;
if(maxTree[parents[h]].rightChild==h)
maxTree[parents[h]].rightChild=pos;
else
maxTree[parents[h]].leftChild=pos;
parents[pos]=parents[h];
parents[h]=p+numberOfNodes;
elements[pos]=newEle;
//balance trees again
balance(h,minTree,parents[h]-numberOfNodes,false);
balance(pos,maxTree,parents[pos],true);
}
else{
//printf("2\n");
//old element is in maxTree too
elements[pos]=newEle;
balance(pos,maxTree,parents[pos],true);
}
}
}
/*printf("minTree: \n");
for(int ebene=0;ebene<size/2;ebene=ebene*2+1){
for(int i=0;i<=ebene&&i+ebene<numberOfNodes+1;i++){
printf("(%d,%d:%d),",minTree[ebene+i].leftChild,minTree[ebene+i].rightChild,minTree[ebene+i].parent);
printf("%d,",minTree[ebene+i].extrema);
}
printf(" \n");
}
printf("maxTree \n");
for(int ebene=0;ebene<size/2;ebene=ebene*2+1){
for(int i=0;i<=ebene&&i+ebene<numberOfNodes;i++){
printf("(%d,%d,%d),",maxTree[ebene+i].leftChild,maxTree[ebene+i].rightChild,maxTree[ebene+i].parent);
printf("%d,",maxTree[ebene+i].extrema);
}
printf(" \n");
}
for(int i=0;i<size;i++)
printf("%d,",parents[i]);
printf(" \n");
for(int i=0;i<size;i++)
printf("%d,",elements[i][0]);
printf(":%d",pos);
printf(" \n");*/
//pos=(pos+1)%size;
//return oldEle;
}
|
cdd2cddfbe27a5fbe2b50b51cae20da201af9f2b | 1e823d058aff331a2875d60ec4ace13d850c7002 | /tripeditform.cpp | b719fbde9553f254c4f54f53210a2657d40db546 | [] | no_license | VladRoven/Qt-project-railway-station | bcbcb9df8f170ab3f4c6e6af076a9b1d33e66462 | e291e2dac3299947d9331c4ded5a7a9c314faf6a | refs/heads/main | 2023-02-03T19:08:00.010668 | 2020-12-25T17:16:28 | 2020-12-25T17:16:28 | 319,073,292 | 0 | 0 | null | 2020-12-06T17:28:39 | 2020-12-06T16:05:05 | C++ | UTF-8 | C++ | false | false | 1,781 | cpp | tripeditform.cpp | #include "tripeditform.h"
#include "ui_tripeditform.h"
#include <QMessageBox>
TripEditForm::TripEditForm(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::TripEditForm)
{
ui->setupUi(this);
mapper = new QDataWidgetMapper(this);
mapper->setSubmitPolicy(QDataWidgetMapper::ManualSubmit);
}
TripEditForm::~TripEditForm()
{
delete ui;
}
void TripEditForm::setModel(QAbstractItemModel *model, QString old_trip)
{
mapper->setModel(model);
mapper->addMapping(ui->trip_name, 0);
mapper->addMapping(ui->date_from, 1);
mapper->addMapping(ui->date_to, 2);
mapper->addMapping(ui->count_wagons, 3);
mapper->addMapping(ui->count_stop, 4);
mapper->addMapping(ui->count_tickets, 5);
this->old_trip = old_trip;
}
void TripEditForm::on_btn_accept_clicked()
{
QString error = "";
QRegExp trip_name_reg("([А-Я][а-я]+)-([А-Я][а-я]+)");
if (!trip_name_reg.exactMatch(ui->trip_name->text()))
error += "Корректно введите имя!\n";
if (ui->date_from->date() >= ui->date_to->date())
error += "Дата отправления не может быть меньше/равна даты прибытия!\n";
if (error.length())
{
QMessageBox *msg = new QMessageBox();
msg->setIcon(QMessageBox::Warning);
msg->setWindowTitle("Ошибка");
msg->setInformativeText(error);
msg->addButton("Понял", QMessageBox::AcceptRole);
msg->exec();
}
else
{
emit edit_client_trip(old_trip, ui->trip_name->text() + "|" + ui->date_from->text());
mapper->submit();
close();
}
}
void TripEditForm::on_btn_cancle_clicked()
{
close();
}
|
b1dc8ecdf0beaa4fa6b5f506c573dda6f325647e | ccf425bb7e7303c94cbd3bee34610c040ec52911 | /CPSEweek2/ringtone 2.7/rtttl_player.hpp | ee47dfb165b328a15bf44b0cf798b8f6fe6fa22d | [] | no_license | AhmadSalaymeh1998/CPSEAhmad | c78091741f188942f677b64efbc85dc689827c32 | 900157e9931767fab7bab98c58e152e5a75d72e1 | refs/heads/master | 2023-06-13T05:38:34.485298 | 2021-07-03T11:14:55 | 2021-07-03T11:14:55 | 299,317,839 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 320 | hpp | rtttl_player.hpp | #include "note_player_print.hpp"
#include "note_player_gpio.hpp"
// ===========================================================================
//
// rtttl string player interface
//
// ===========================================================================
void rtttl_play( note_player_gpio & lsp, const char *s ); |
32d6c1711467cb134f039b9ad69e26b699b100e8 | 0d3d0159f79dcca91fab9d6585e8efe939010aea | /lab3/TTTBoard.h | f552348ff3895314eaf8b426fb4e08d74ad6e594 | [] | no_license | artur-cabral/Object-Oriented-Programming-Class | 372db585e21a7682394e5fd39e1338078f4b089d | f1a6b21c7d4c79219009b8d71f3d41ca2d2991cb | refs/heads/master | 2020-03-13T02:39:58.383020 | 2018-05-08T03:28:51 | 2018-05-08T03:28:51 | 130,929,015 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,025 | h | TTTBoard.h | #pragma once
#include <iostream>
/*
_____ _
/ __ \ |
| / \/ | __ _ ___ ___ ___ ___
| | | |/ _` / __/ __|/ _ \/ __|
| \__/\ | (_| \__ \__ \ __/\__ \
\____/_|\__,_|___/___/\___||___/
*/
// Create a class called TTTBoard
// This class should have two data members: N (size of the board NxN) and currentState
//Data Members - //------ currentState (an NxN matrix which contains a - 1 for an unassigned grid point, a 0 if an X is in the location,
//and a 1 if O is in that location.
//Function Members - isWinner, makeMove, displayBoard, reset, and anythingElse
class TTTBoard {
public:
//constructor: the function to run to create the board using an array NxN given by the user
TTTBoard(int passedN); // pass in N from the user to create NxN matrix
//Destructor: Clears the memory(delete currentState)
~TTTBoard();
void displayBoard();
bool isWinner(int whichPlayer);
bool makeMove(int whichPlayer, int I, int J);
void reset();
private:
int N;
int** currentState;
};
|
9169de50e547dc320a7aa58e706ef110286158cf | e5adb57a9b85cec1ae543aa4a6db3694c2a2d5ae | /VulkanEngine/VulkanCommandPoolEngine.cpp | 98fc94f9cde8b3c60afa44446165ce187f3f6f78 | [] | no_license | g4tobauer/VulkanEngine | 011eb2823760c1ae7145821992b33926d2339ab9 | 4adda1068109b89a7f6aca9660e1e43102e1b0b5 | refs/heads/master | 2023-09-02T22:05:37.758211 | 2023-08-31T03:24:03 | 2023-08-31T03:24:03 | 132,063,484 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,474 | cpp | VulkanCommandPoolEngine.cpp | #include "VulkanCommandPoolEngine.h"
#include "Core.h"
#pragma region Public
VulkanCommandPoolEngine::VulkanCommandPoolEngine(Core* core)
{
pCore = core;
}
VulkanCommandPoolEngine::~VulkanCommandPoolEngine()
{
pCore = NULL;
}
void VulkanCommandPoolEngine::createCommandPool()
{
VkCommandPoolCreateInfo poolInfo{};
poolInfo.sType = VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO;
poolInfo.flags = VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT;
poolInfo.queueFamilyIndex = pCore->pVulkanDeviceEngine->pIndices->graphicsFamily.value();
if (vkCreateCommandPool(*(pCore->pVulkanDeviceEngine->pDevice), &poolInfo, nullptr, &commandPool) != VK_SUCCESS) {
throw std::runtime_error("failed to create command pool!");
}
}
void VulkanCommandPoolEngine::destroyCommandPool()
{
vkDestroyCommandPool(*(pCore->pVulkanDeviceEngine->pDevice), commandPool, nullptr);
}
void VulkanCommandPoolEngine::createCommandBuffers()
{
commandBuffers.resize(MAX_FRAMES_IN_FLIGHT);
VkCommandBufferAllocateInfo allocInfo{};
allocInfo.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO;
allocInfo.commandPool = commandPool;
allocInfo.level = VK_COMMAND_BUFFER_LEVEL_PRIMARY;
allocInfo.commandBufferCount = (uint32_t)commandBuffers.size();
if (vkAllocateCommandBuffers(*(pCore->pVulkanDeviceEngine->pDevice), &allocInfo, commandBuffers.data()) != VK_SUCCESS) {
throw std::runtime_error("failed to allocate command buffers!");
}
pCommandBuffers = commandBuffers;
}
void VulkanCommandPoolEngine::recordCommandBuffer(VkCommandBuffer commandBuffer, uint32_t imageIndex) {
VkCommandBufferBeginInfo beginInfo{};
beginInfo.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO;
if (vkBeginCommandBuffer(commandBuffer, &beginInfo) != VK_SUCCESS) {
throw std::runtime_error("failed to begin recording command buffer!");
}
VkRenderPassBeginInfo renderPassInfo{};
renderPassInfo.sType = VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO;
renderPassInfo.renderPass = *(pCore->pVulkanSwapChainEngine->pRenderPass);
renderPassInfo.framebuffer = pCore->pVulkanSwapChainEngine->pSwapChainFramebuffers[imageIndex];
renderPassInfo.renderArea.offset = { 0, 0 };
renderPassInfo.renderArea.extent = *(pCore->pVulkanSwapChainEngine->pSwapChainExtent);
VkClearValue clearColor = { {{0.0f, 0.0f, 0.0f, 1.0f}} };
renderPassInfo.clearValueCount = 1;
renderPassInfo.pClearValues = &clearColor;
vkCmdBeginRenderPass(commandBuffer, &renderPassInfo, VK_SUBPASS_CONTENTS_INLINE);
vkCmdBindPipeline(commandBuffer, VK_PIPELINE_BIND_POINT_GRAPHICS, *(pCore->pVulkanGraphicPipelineEngine->pGraphicsPipeline));
VkViewport viewport{};
viewport.x = 0.0f;
viewport.y = 0.0f;
viewport.width = (float)(pCore->pVulkanSwapChainEngine->pSwapChainExtent)->width;
viewport.height = (float)(pCore->pVulkanSwapChainEngine->pSwapChainExtent)->height;
viewport.minDepth = 0.0f;
viewport.maxDepth = 1.0f;
vkCmdSetViewport(commandBuffer, 0, 1, &viewport);
VkRect2D scissor{};
scissor.offset = { 0, 0 };
scissor.extent = *(pCore->pVulkanSwapChainEngine->pSwapChainExtent);
vkCmdSetScissor(commandBuffer, 0, 1, &scissor);
vkCmdDraw(commandBuffer, 3, 1, 0, 0);
vkCmdEndRenderPass(commandBuffer);
if (vkEndCommandBuffer(commandBuffer) != VK_SUCCESS) {
throw std::runtime_error("failed to record command buffer!");
}
}
#pragma endregion |
fc1079829923d60ced88283092d7b3d9db048ba2 | 1876a01eda94ade519a48bee28366fbf9e9dffc5 | /InnerServer/InnerServer/AI/ai.cpp | 6f22ce4322987cb3b70b25e45a8774d7e5bfeff6 | [] | no_license | brutaldayz/IEMU | 1f8be88bfcbd41460dc6f9f38bf4231ecd9020c9 | 18f612d3e85f596f398b8da1592e67820498ad63 | refs/heads/master | 2021-07-06T15:07:27.100825 | 2019-12-17T10:54:34 | 2019-12-17T10:54:34 | 228,595,338 | 1 | 1 | null | 2019-12-17T10:49:41 | 2019-12-17T10:49:40 | null | UTF-8 | C++ | false | false | 163 | cpp | ai.cpp | ////////////////////////////////////////////////
// Authors: Tahoma
////////////////////////////////////////////////
#include "ai.h"
AI::AI()
{
}
AI::~AI()
{
} |
ded8e281a120fd475fcc336630298c24fd703bda | 5428b3895fa3c26df759c8b92a95e0be15b74c40 | /stackOps.cpp | 52a6429965855e85beb9d198ff2ddc50ff6a635a | [] | no_license | mboerwinkle/scriptArena | d73b8000c55caa69211424ed15804bfa60c0b3e0 | 965ad3a6dd9b3d34b0284eec5b6c1f2c1256497b | refs/heads/master | 2021-01-12T11:03:33.166286 | 2016-11-15T14:53:50 | 2016-11-15T14:53:50 | 72,804,688 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,945 | cpp | stackOps.cpp | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include "stack.h"
void Stack::add(){
int one = pop().read();
Obj two = pop();
two.write(two.read()+one);
push(two);
}
void Stack::subtract(){
int one = pop().read();
Obj two = pop();
two.write(two.read()-one);
push(two);
}
void Stack::multiply(){
int one = pop().read();
Obj two = pop();
two.write(two.read()*one);
push(two);
}
void Stack::divide(){
int one = pop().read();
Obj two = pop();
if(one == 0){
puts("Cancelled operation of divide by 0");
push(two);
return;
}
two.write(two.read()/one);
push(two);
}
void Stack::modulo(){
int one = pop().read();
Obj two = pop();
if(one == 0){
puts("Cancelled operation of modulo by 0");
push(two);
return;
}
two.write(two.read()%one);
push(two);
}
void Stack::power(){
int one = pop().read();
Obj two = pop();
two.write(pow(two.read(),one));
push(two);
}
void Stack::increment(){
Obj one = pop();
one.write(one.read()+1);
push(one);
}
void Stack::equals(){
Obj one = pop();
one.write(pop().read());
push(one);
}
void Stack::andOp(){
int one = pop().read();
Obj two = pop();
two.write(two.read()&one);
push(two);
}
void Stack::xorOp(){
int one = pop().read();
Obj two = pop();
two.write(two.read()^one);
push(two);
}
void Stack::orOp(){
int one = pop().read();
Obj two = pop();
two.write(two.read()|one);
push(two);
}
void Stack::stdinput(){
printf("Input: ");
int input;
scanf("%d\n", &input);
push(input);
}
int Stack::testCompare(){
int val = pop().read() - pop().read();
if(val == 0){//equal
return 0;//straight
}else if(val < 0){//greater
return 3;//right
}else{//less
return 1;//left
}
}
bool Stack::testGreater(){
return pop().read() - pop().read() < 0;
}
bool Stack::testLess(){
return pop().read() - pop().read() > 0;
}
bool Stack::testEqual(){
return pop().read() - pop().read() == 0;
}
bool Stack::testIf(){
return pop().read() != 0;
}
|
efbfddad9256917922e972942f3bb4bab4cd2687 | 0bdcbb6d0cf2d7d4092e39ab5f7bd7882f20cac7 | /vscode/codes/FILLMTR.cpp | 59491e30ec8c5002d8c035f0bcd3e2ee2590d4bd | [] | no_license | varun7882/Programs_C-CPP | 3eafd69790c44e57bd9c73621301142e43b148cc | 950d44352b120af8c1df4c03bf2e682911bafc9e | refs/heads/master | 2022-03-08T12:37:42.383120 | 2019-11-15T08:59:51 | 2019-11-15T08:59:51 | 105,902,950 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,254 | cpp | FILLMTR.cpp | #include<iostream>
using namespace std;
int main()
{
int t;
cin>>t;
while(t--)
{
int n,q;
bool f=true;
cin>>n>>q;
int a[n][n];
for(int i=0;i<n;i++)
{
for(int j=0;j<n;j++)
{
a[i][j]=-1;
}
}
while(q--)
{
int i,j,val;
cin>>i>>j>>val;
if(i==j && val!=0)
{
f=false;
}
a[i-1][j-1]=val;
}
if(!f)
{
cout<<"no\n";
continue;
}
for(int i=0;i<n;i++)
{
for(int j=0;j<n;j++)
{
if(a[i][j]==1 && (a[j][i]==1 || a[j][i]==-1))
{
continue;
}
if(a[i][j]==0 && (a[j][i]==0 || a[j][i]==-1))
{
continue;
}
if(a[i][j]==-1)
{
continue;
}
f=false;
break;
}
}
if(f)
{
cout<<"yes\n";
}
else
{
cout<<"no\n";
}
}
return 0;
}
|
5a5fe39bf8df6d7d54a51ab5cde14b8774750b79 | 8d0f764da10bc17675f82bde3d1801de4c2c9ff7 | /CodeForces/CF165-D2-B.cpp | 3b0c67c546d10f2e1cd34ec9abedd7edc853c3d0 | [] | no_license | AbdelrahmanElhawary/CompetitiveProgramming | f24f675ced34d75a383db03a9ffef59373b23c31 | 791ed4fcdefde421902f3b512414c1a49fdc21cd | refs/heads/master | 2021-05-09T05:00:41.380756 | 2020-08-19T09:57:32 | 2020-08-19T09:57:32 | 119,295,405 | 1 | 3 | null | 2020-10-01T20:12:38 | 2018-01-28T20:33:41 | C++ | UTF-8 | C++ | false | false | 1,103 | cpp | CF165-D2-B.cpp | #ifdef _MSC_VER
#define _CRT_SECURE_NO_WARNINGS
#endif
#include<iostream>
#include<map>
#include<cmath>
#include<algorithm>
#include<string>
#include<set>
#include<sstream>
#include<vector>
#include<string.h>
#include<queue>
#include<list>
#include<iterator>
#include<functional>
#include<iomanip>
#include<bitset>
#include<stack>
#define F first
#define S second
#define ll long long
#define ld long double
#define dong long
#define endl '\n'
using namespace std;
void fast_in_out() {
std::ios_base::sync_with_stdio(NULL);
cin.tie(NULL); cout.tie(NULL);
}
int n, k;
bool check(ll m)
{
ll ans = m,c=k;
while (ans < n)
{
ans += (m / c);
if ((m / c) == 0)return 0;
c *= k;
}
return 1;
}
ll binary_search()
{
ll s = 1, e = 1e9,ret=1e9;
while (s <= e)
{
ll mid = (s + e) / 2;
if (check(mid))
{
ret = mid;
e = mid - 1;
}
else s = mid + 1;
}
return ret;
}
int main() {
fast_in_out();
// cout << fixed << setprecision();
cin >> n >> k;
cout << binary_search() << endl;
//system("pause");
return 0;
}
|
b6a2786072305b9020f9e1733b6d46c0a1f140c1 | 703d887e869b7d510eec309d7bfb0acc2da59c10 | /damBreakmodified/0.2/p | f73ca85940e0899074170d8c3f14902b2c66a299 | [] | no_license | luiscascelli/OpenFoam | a063df7af02b89abdc36268aaa21f5b012963b74 | 9ff3218c8ba584fe15017c766aed9afccf5ddd00 | refs/heads/master | 2023-08-01T00:12:25.059964 | 2021-09-14T19:37:54 | 2021-09-14T19:37:54 | 406,498,391 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 47,935 | p | /*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: 8
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
location "0.2";
object p;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [1 -1 -2 0 0 0 0];
internalField nonuniform List<scalar>
1924
(
0
1.39081
2.59036
2.97598
0.940708
3.10884
3.42895
3.68552
3.94315
2.44268
4.11321
4.28733
4.71873
4.49837
4.35983
4.29962
5.50064
4.53765
19.9742
4.58465
31.7766
5.67367
5.39283
4.59085
5.64754
5.2731
5.27776
1.61745
1.20159
348.234
5.18784
5.56935
-4.80646
5.184
2.35003
5.49407
5.64251
1.69112
400.506
5.12139
5.50924
-15.1753
5.40798
5.62823
117.811
3.24574
-151.323
-0.00572158
10.2775
-96.8275
6.08343
5.2952
5.70215
6.04809
2.9764
2.65328
69.1315
-1.9477
-14.0976
4.59624
5.65278
4.38772
5.76777
641.026
6.46095
2.6913
4.38635
5.22656
3.30381
5.65425
0.566952
4.3135
552.874
190.983
85.6335
-0.444552
3.90547
17.575
8.80275
5.75641
4.60362
5.14538
441.702
10.6536
-12.4156
5.40962
9.815
4.48172
-394.73
-0.269308
4.52821
5.01944
4.75383
2.83753
-9.52506
6.61406
3.70796
4.5198
4.7255
0.445974
2.29821
-55.5384
4.77706
4.91886
3.07791
5.13661
3.63566
2.69018
4.54454
3.61934
3.7345
3.01601
1.81172
427.054
8.65704
13.236
2.49741
4.16188
5.73509
4.44511
-19.4819
1019
-15.367
-1.32584
4.30891
4.01551
-1.53297
5.47593
3.15735
1527.73
4.2367
3.46037
-1.61479
357.618
-16.1918
3.39366
1.87739
2.78998
4.59254
2.05576
3.3959
4.38778
-963.964
1.84485
2.93119
1514.99
3.24785
0.313602
4.40108
5.80393
624.274
1173.55
-4.48384
3.58922
3.37768
4.33481
1430.54
2.02829
4.17646
450.344
360.209
-1.40853
3.71914
981.013
791.455
4.06105
4.84566
1585.25
4.97269
4.18213
0.325059
3.77803
5.05458
4.80864
3.13829
2.72233
437.392
-0.151525
5.65561
4.64897
5.43951
4.08677
24.6256
5.03217
39.8251
-16.122
-4.7213
5.52681
4.7812
194.75
4.13188
4.00785
4.32721
4.80767
5.16855
1080.88
5.45436
4.41021
4.76314
3.16402
-8.77842
10.1451
4.32217
4.4088
0.868643
5.50463
5.32196
-8.68343
-0.752101
0.252445
790.688
4.2456
4.59879
5.28915
5.50142
5.42563
4.34042
4.18079
5.17168
5.1822
4.69032
364.574
4.98192
4.57211
4.491
5.40917
4.2718
4.80391
5.28149
6.14793
-3.86637
4.58854
5.10927
-0.0155132
5.30644
677.744
4.52423
5.25958
4.96533
899.749
3.95745
5.59067
4.53896
7.20144
-66.3174
0.615943
4.7183
3.35795
10.4961
4.90483
-34.5296
966.836
5.29988
4.74248
4.74235
4.4808
5.1809
5.86897
4.69554
5.12079
5.14876
5.20132
4.74845
5.49639
5.50394
70.7731
7.46916
5.15373
1.01037
-88.7169
5.47017
650.186
-2.24767
5.80545
4.51342
4.54533
4.73099
5.25548
4.67819
5.13244
-35.9029
1300.61
4.59696
5.22714
-5.61404
121.391
4.35859
1164.33
5.10725
5.73678
5.23873
315.072
5.14023
4.44625
-1.00966
838.904
4.44036
0.47471
5.20349
4.40679
1401.24
5.08154
4.48724
4.19747
4.80535
5.61621
5.82131
4.51024
5.90248
139.245
5.65476
5.90361
5.20157
5.64184
4.54394
5.91401
5.17955
4.98172
5.30849
5.34128
163.334
5.66581
5.19622
773.837
5.38811
4.6768
5.67311
5.7678
3.38526
4.38719
5.81522
4.30927
5.6251
4.7551
6.0182
5.08642
4.51093
5.26038
5.09921
5.43855
4.7404
576.613
5.56909
-4.13457
4.3269
4.16683
-0.439769
4.17582
5.97771
5.53341
5.31976
-362.18
815.388
4.38404
2.52298
4.90527
864.174
4.93356
5.82391
6.7529
4.96844
4.30253
4.42302
4.38228
5.36262
5.37572
5.56997
5.45269
5.05818
5.2348
4.47542
5.36739
5.72787
3.8963
4.95453
0.296951
4.25484
4.2772
5.43625
4.10671
4.09702
4.99361
5.64587
5.34383
5.71122
4.50474
9.02603
4.31108
5.03098
5.36147
666.434
5.61075
5.5585
4.17957
5.13002
-3.33005
5.13023
5.46066
4.43892
4.09521
1446.03
5.2567
3.27464
1.61087
1631.84
4.38577
4.52113
4.11692
5.81056
5.18533
4.91111
5.62225
4.83027
5.19888
4.94911
4.1376
4.59965
4.23909
5.52436
3.60913
4.28669
5.60336
4.52586
-2.35086
5.27876
4.37276
4.56381
392.789
5.52153
4.74077
4.31526
4.64167
4.61989
5.68639
5.06956
4.81248
4.41512
4.88965
5.15322
5.31816
5.88559
4.94196
5.33485
960.605
3.9872
193.476
4.79072
5.47609
5.4916
4.18278
4.15304
5.53817
5.2486
4.4793
4.99713
5.37313
4.46826
4.14008
5.72147
3.97385
4.71652
5.39411
5.52969
5.76185
6.497
4.11932
3.99262
4.89772
5.02789
73.3931
5.10457
5.59432
94.7816
4.50437
5.37075
4.79369
609.943
4.74746
3.92256
3.96344
4.71595
4.96406
4.32126
3.92738
5.42132
5.15133
4.74282
3.77135
4.55232
4.47087
6.1794
4.6162
5.62268
3.6832
4.23073
4.52488
3.91367
4.18967
4.80347
829.364
4.2798
4.08384
5.77216
5.23945
5.89339
3.99863
4.1281
4.91608
5.48472
4.36628
4.98363
4.57557
4.12444
5.21555
3.99734
3.9325
5.27674
5.30516
4.95651
3.90502
5.69404
4.07538
4.60552
4.41069
5.11219
5.17772
10.8464
5.84393
4.96884
4.78207
5.80623
4.66921
5.51241
5.65166
4.6221
3.804
4.90469
5.56219
5.5238
5.06852
5.35239
776.564
6.02643
5.08894
4.45889
4.54435
327.042
762.46
3.80019
4.51663
4.60582
4.1884
3.89402
5.58133
4.72395
5.67653
5.81504
6.26249
954.264
539.111
5.11351
5.738
0.22218
4.12506
5.8291
5.35307
4.66431
3.9344
180.254
5.38547
4.49653
4.41854
4.78007
3.99876
5.28531
3.80748
5.79189
5.82686
4.2262
5.73194
5.20036
3.78947
4.86666
3.93477
6.5797
6.0004
4.1223
6.09651
4.51989
635.437
4.88734
5.61726
406.131
6.52673
6.25554
4.27707
3.74316
4.75695
3.73934
5.85986
6.79357
4.06878
4.72707
823.628
5.45801
4.56318
5.10775
4.80858
5.21958
6.16607
4.93784
3.96149
5.79843
4.48892
5.23978
3.73584
5.06617
4.63263
6.758
837.98
4.35602
4.56278
4.00908
5.03499
4.7897
18.4445
6.01122
3.72849
4.98077
5.82787
3.78188
4.52938
4.70353
5.93228
5.4936
6.82995
4.58819
1010.96
4.40874
4.40147
4.12288
3.99801
5.32054
4.70122
3.93719
3.95739
5.08002
3.71106
4.34581
5.64943
5.70183
3.93465
2.09922
4.95564
5.98758
3.80866
5.82857
4.87661
4.75548
5.83004
5.58458
6.19916
5.39125
4.43142
3.74482
752.031
4.86001
3.72237
5.57354
5.35854
5.16905
4.63973
5.64191
4.4658
3.89923
4.47327
4.77994
3.77277
6.41421
5.95891
4.12021
4.06536
3.61255
3.61531
4.90958
4.72531
3.61789
1380.85
4.21957
6.17316
575.409
4.59728
4.17032
4.51202
5.74782
3.95241
5.95209
5.14916
5.21102
5.00651
4.51433
6.00526
4.39511
4.7655
6.64064
4.33484
3.99527
4.56885
4.27108
5.43974
5.61566
6.38424
3.93277
1454.12
4.6791
4.91464
3.80789
5.88287
3.8955
-34.4882
5.20881
3.60376
4.6972
6.13157
3.71418
-1.33034
0.203823
6.85628
4.81689
4.32912
3.74471
5.93064
1038.31
5.05247
3.55111
4.73215
3.55388
4.21047
3.5494
5.96589
6.60259
3.61868
4.55957
7.05307
4.26544
968.932
5.29675
6.11024
5.48076
4.37343
4.83542
3.80206
4.69825
1045.08
969.102
4.90203
403.469
6.8061
1626.67
3.54244
115.865
3.55505
3.58473
4.40079
4.88501
6.06922
4.49425
5.14414
6.31164
4.32125
3.59816
4.37994
1011.36
3.80552
4.66131
4.06128
5.33888
4.54989
6.28186
3.92875
6.11584
4.90976
4.60344
0.998031
4.65191
7.11748
3.70702
4.20185
3.89222
837.669
6.04551
5.84578
3.95004
3.74299
4.98279
4.44275
4.11663
5.67039
4.13952
5.70683
5.66531
4.91179
4.65839
613.661
4.70211
3.77611
970.748
3.53778
3.61798
5.18859
4.93623
4.20109
959.734
6.96802
5.5685
6.22619
3.42222
6.50795
4.71096
5.69151
6.0342
4.78658
3.77555
6.47213
3.42807
4.25022
5.03014
3.42611
3.55487
6.19812
3.59137
4.52526
5.42675
4.30705
4.81409
4.36459
4.98092
3.35886
4.28865
1166.31
4.34931
6.98633
4.18975
4.47714
1342.59
5.89988
4.12982
4.86423
3.41738
5.75536
4.59436
3.42871
6.39731
4.76066
3.5317
3.80144
5.99
5.27914
6.71045
4.98944
3.36185
3.71416
3.73964
187.38
6.18932
3.61592
6.6691
4.5321
6.36239
6.13942
4.33012
5.61438
6.35583
4.53416
5.12477
334.854
4.57524
6.28845
-1.39146
4.00643
827.811
5.47165
3.35647
35.7387
3.73894
4.63987
3.55335
4.45196
3.36522
3.36435
4.96373
4.37511
-52.6618
3.52505
3.8897
3.94764
4.05061
3.41307
6.14468
3.58559
6.29458
4.48779
5.3245
6.91218
4.29303
4.69249
3.77286
6.58005
4.11839
3.71311
4.17733
543.486
4.10372
5.82503
6.8631
3.4281
6.54037
4.34986
5.17156
4.88641
4.932
3.52625
4.79631
1549.16
4.16624
6.2587
4.42212
4.72954
4.51802
3.99902
5.01247
3.35207
4.46149
5.85684
3.61254
5.02752
3.23355
5.71017
3.93717
3.36501
4.73216
3.42191
4.20878
5.71272
7.02429
3.73514
4.84724
3.55053
6.46011
3.408
6.05436
4.51616
872.172
5.565
3.23703
-13.4402
6.3047
1.12027
6.42057
3.23077
1127
4.24186
5.41766
4.64514
6.7692
3.42633
3.59018
4.62406
4.10697
6.72549
4.54428
5.26639
4.90458
4.16524
3.52172
750.671
3.60669
3.98892
3.23842
1.29573
3.34745
3.92895
6.21278
5.11019
4.27995
3.23882
4.67707
1189.78
1045.13
5.76046
5.66305
3.36368
4.28404
4.94874
5.61339
4.77936
5.91084
3.17348
3.17093
6.33875
4.33643
6.63568
6.00664
3.16856
5.46528
4.96838
3.40362
4.49442
3.88422
1261.72
4.78216
6.59254
3.22664
3.6082
3.9403
4.0276
3.54673
3.80559
5.31423
4.44777
3.71068
3.40047
3.77036
93.2136
4.60183
4.36104
3.42349
5.159
3.23822
168.335
643.256
1124.92
6.1647
4.0738
3.17463
6.96256
6.91305
4.999
4.52981
1026.06
4.50261
6.37666
3.34322
4.51404
3.1754
3.16536
4.09615
4.11473
3.91961
3.97899
3.36128
4.83416
3.59095
6.50559
4.61118
4.62312
4.72517
4.15403
3.52869
3.17513
5.71237
3.79976
6.32667
5.56258
980.318
6.45928
4.42434
3.40016
4.26832
4.14887
6.81785
3.22281
6.77175
4.66483
5.4114
3.73775
3.23667
7.07299
3.04242
5.25743
4.32475
131.714
3.41982
5.0997
221.478
6.55182
5.86368
4.19887
3.54221
3.16162
3.54288
4.93775
3.04479
25.8145
332.687
4.43641
3.35805
3.33956
4.61972
3.17392
6.67825
5.61264
4.77154
6.06801
4.97312
3.91069
6.86395
6.22885
3.7916
3.04764
3.96969
6.63172
3.04843
7.04941
7.04793
4.7145
6.482
4.49164
3.70743
5.46094
4.0864
3.73138
6.49667
3.03937
3.76559
3.87226
2.1455
3.23422
5.30717
4.85991
4.25619
2.9801
3.04879
3.2194
5.15021
5.76374
4.14415
3.92317
3.98786
6.9554
4.98942
2.9774
7.05176
7.00616
6.39403
4.60134
4.83173
4.25853
4.82458
538.614
553.766
3.17184
4.02154
3.15821
2.98202
3.33697
3.58821
6.53541
3.04822
1146.36
3.41559
3.60773
7.07599
4.73344
4.31515
531.512
6.85716
3.3542
4.05403
4.65579
3.52752
5.91754
6.17806
6.80858
4.60657
2.98404
3.23107
1263.76
125.445
2.98485
2.98539
6.342
3.03629
6.01792
3.41322
5.56091
7.11666
4.42759
3.724
3.90256
4.56806
5.40728
3.78389
1185.62
812.539
2.85363
1763.75
3.9614
5.25151
6.56593
2.98509
3.2166
3.16904
5.71358
3.04683
5.0927
4.07808
1665.7
4.09763
2.85556
4.93032
3.3397
6.71036
2.97451
-2.10821
1173.02
2.85115
4.48339
3.70141
0.560875
-1.29259
3.60337
4.13592
4.76423
1187.65
3.1552
6.66032
6.51187
6.87377
4.38314
3.75599
4.25083
3.54144
3.58418
2.79103
2.79271
2.78876
5.86727
2.98399
5.61272
3.40426
2.85781
3.04469
6.9902
7.04256
3.03351
4.59451
3.22744
5.45889
1020.84
3.35001
5.3034
2.79418
5.14526
2.85857
1005.62
3.85138
1401.78
1824.88
3.16571
2.85827
4.98383
7.12236
1469.12
4.30784
6.74524
6.23885
4.81882
5.7661
3.52474
3.71724
3.89342
6.88824
6.40565
3.93414
3.89557
2.97168
3.77697
6.0763
6.83724
6.25013
2.85802
2.6659
7.15411
2.79473
4.2
3.59698
2.84864
3.04193
3.95444
2.6678
4.65022
2.7952
1763.48
2.98214
6.68778
2.66422
2.78636
3.34922
4.4214
198.878
3.53639
4.07148
1805.78
3.21441
2.66783
3.9516
2.79484
40.5
5.92097
2.66215
4.90218
4.97288
4.67551
4.12961
3.57768
35.9187
6.5777
2.60407
2.97968
6.91976
2.60135
2.66817
2.60424
4.47822
3.22356
401.977
2.60297
3.52061
6.35148
2.85677
3.15291
6.18629
3.16208
3.41286
6.67791
3.69182
6.73356
3.03117
4.9116
4.89181
1538.65
6.02493
2.47716
7.16682
3.03876
2.6048
1123.08
2.79383
4.24537
2.59944
3.40372
6.54381
4.78299
2.47683
2.65997
4.0503
552.405
551.951
7.018
1669.84
2.41286
7.07207
3.71139
2.84625
3.59121
2.6676
2.78395
2.97674
502.547
3.22106
726.854
612.382
2.96915
2.59734
1805.32
4.63608
3.53076
6.52168
3.77112
5.71683
6.75478
5.56308
2.85486
7.18529
1603.59
1481.01
5.40839
3.21462
1966.63
2.60437
3.88998
1184.1
5.25167
2.47749
5.09209
3.74087
1089.88
4.92916
4.30318
290.917
2.41434
2.41408
1704.37
4.44997
4.7627
3.34746
6.91213
2.79217
3.40921
2.47584
3.94906
2.47246
2.85241
5.54595
3.03535
5.87125
2.47427
1407.07
2.66644
3.51453
3.15835
6.85861
-1.51231
7.20579
1868.79
4.59279
3.34158
3.40026
2.97353
4.06678
2.6034
6.69683
2.47687
2.78995
4.26272
3.56821
2.65784
6.93736
2.28694
3.82842
2.41396
2.47046
2.59519
2.84957
6.02859
3.15682
3.52587
6.18936
2.6647
3.15122
3.93686
2.4126
3.39553
2.78174
4.41958
2.40969
3.34335
3.58631
6.35414
3.03193
4.12549
2.41142
2.7873
1064.47
3.21974
3.85097
3.4044
3.02922
2.97022
2.40773
1677.76
2.84421
1821.76
2.96716
6.87678
2.60187
1987.84
2.29218
2.28859
4.10081
3.70669
2019
3.02934
2.47579
1889.85
7.21051
7.23866
4.73836
2.84652
3.3367
3.33985
1611.64
3.38959
3.33259
6.52366
2.66247
7.09527
2.84344
3.15476
2.41305
2.96701
3.76657
7.0394
3.68234
4.24345
2.78441
3.21671
3.50812
3.33926
1695.17
5.76814
2.46843
1404.45
5.61426
2.65989
5.45987
2.78142
2.65598
5.30383
2.59983
2.28812
5.14519
2.84048
3.32776
6.69804
4.98337
4.81808
3.4003
5.63034
2.77849
2.59318
3.88598
2.96506
2.40567
1220.61
683.135
146.821
4.64928
3.52193
2.47418
2.65711
2.28347
3.02765
2040.37
2.28681
3.15173
2.65428
2.28554
6.87735
6.92873
1622.13
4.47713
2.28128
2.59741
7.26563
3.38468
2.83814
2.65155
3.20763
3.21326
5.9232
6.08152
2.41161
2.59474
6.24366
2.77996
4.06487
2.77579
3.94549
2061.81
2.22331
2.22522
2.28715
6.8711
3.55983
2.84248
2.58927
2.59199
3.15278
3.2049
3.33596
3.02777
2.96322
6.4101
3.02744
3.14535
3.58247
7.1237
3.21156
4.3019
2.96565
1292.91
1256.61
1618.67
3.14858
3.02539
2.64907
2.4645
2.22513
2.46713
2099.61
7.2301
3.80345
2.58674
2.84123
2.65443
3.14896
3.15146
2.46194
2.27896
3.39708
3.89005
3.83957
3.72325
6.58128
2.47211
3.32587
2.7739
3.21498
3.7033
2.59153
2.46972
2.46663
1902.47
2.96457
4.12418
6.75735
2.83646
2.21916
7.28695
2.8403
2.39968
2.40226
2.22613
2.96109
2.22431
2.28557
2.77863
3.15326
2.22285
3.14614
3.21056
2.2214
3.21636
2.45959
1476.01
2.6471
2.40368
2.58455
3.50226
3.51909
2.96507
7.0613
6.93876
2.77778
1833.75
2.40969
2.83989
3.02388
3.02636
2.39726
2.40488
2.2169
2.96346
2.6534
3.0231
2.96498
2.77237
3.02285
2047.63
2115.32
2.45755
3.02778
2.9615
7.11257
1.59995
2.27573
2.22294
2.6528
2.46517
2.27309
2.77726
3.88412
3.94413
2.39512
2.58292
2.83483
3.33359
3.38304
3.20561
3.7635
2.96436
2.27844
2.27065
2.45592
7.05397
2.64573
2.65253
3.14695
1830.55
1688.6
2.59035
2.39332
2.83875
2.27667
2.21457
2.58972
2.8397
2.4074
2.77717
3.39483
2.77625
2.77744
2.26848
3.02527
2.95939
3.67331
3.57981
2.21076
2.8389
2.21345
2.2835
2.22104
2.65248
3.55335
2.58959
2.78044
2.77104
2.40193
2.20823
2.26663
2.58198
3.51741
3.33187
3.39343
2.46427
7.30283
2.46399
2.20596
2.39202
2.58978
2.65307
2.84266
2.21019
2.27454
2.27273
2.28108
2.59393
2.21615
2.20403
2.58951
2.46432
2.65219
3.20861
2.65758
2.20251
2.26525
2.45509
2.46509
2.46599
3.02139
2.40063
2.59013
2.83332
2.46996
2.40535
2.64455
3.69364
2.27184
2.20763
2.27323
2.466
2.40131
1897.67
2037.31
2.21179
2099.99
2.275
2110.82
3.01991
2.95773
2.21873
3.14525
3.20715
3.5785
2.76945
2.83185
3.76212
3.70152
2.27078
2.20658
2.21229
2.20677
2.27093
2.20716
2.27142
2.20914
2.20102
2.26433
2.39106
2.45378
2.6431
2.58055
2.20842
2.40219
10.5517
2.40034
2.3999
2.39981
7.24418
7.3132
1428
90.9785
1274.22
7.31575
7.12279
5.65105
6.46485
7.06138
7.25195
1418.32
4.45507
1316.36
1165.03
7.25233
1243.62
5.65442
742.752
1335.51
5.61684
1080.67
4.45415
11.4713
1363.6
7.17017
6.9963
701.893
662.652
-776.467
567.241
373.202
770.435
1177.26
1242.47
1370.56
1614.76
668.167
1143.19
1245.95
8.59923
5.68587
1845.71
2.96657
2.01398
1442.23
1448.6
677.084
210.775
5.33137
535.024
1738.81
1809.85
1704.79
946.969
689.498
625.711
606.445
557.005
783.102
2119.85
1974.14
1255.53
5.47584
496.104
4.91365
99.2579
1247.99
1.30301
771.782
-22.5595
1491.78
5.04962
998.781
10.8641
5.37285
621.389
22.0593
844.173
13.6818
1578.07
4.53911
5.93992
5.01427
7.20978
822.844
4.54
1116.56
-5.31325
1670.39
4.87246
4.90232
4.57501
-146.339
74.5449
2155.93
5.18356
4.52937
106.658
4.51811
5.32645
-127.671
5.46615
4.51791
288.149
5.62104
225.929
424.041
516.111
-1344.73
5.57625
1895.02
1777.07
4.55952
)
;
boundaryField
{
patch0
{
type calculated;
value nonuniform List<scalar>
4010
(
4.44089e-16
4.44089e-16
1.39081
1.39081
2.59036
2.59036
2.97598
2.97598
0.940708
0.940708
3.10884
3.10884
3.42895
3.42895
3.68552
3.68552
3.94315
3.94315
2.44268
2.44268
4.11321
4.11321
4.28733
4.28733
4.71873
4.71873
4.49837
4.49837
4.35983
4.35983
4.29962
4.29962
5.50064
5.50064
4.53765
4.53765
19.9742
19.9742
4.58465
4.58465
31.7766
31.7766
5.67367
5.67367
5.39283
5.39283
4.59085
4.59085
5.64754
5.64754
5.2731
5.2731
5.27776
5.27776
1.61745
1.61745
1.20159
1.20159
348.234
348.234
5.18784
5.18784
5.56935
5.56935
-4.80646
-4.80646
5.184
5.184
2.35003
2.35003
5.49407
5.49407
5.64251
5.64251
1.69112
1.69112
400.506
400.506
5.12139
5.12139
5.50924
5.50924
-15.1753
-15.1753
5.40798
5.40798
5.62823
5.62823
117.811
117.811
3.24574
3.24574
-151.323
-151.323
-0.00572158
-0.00572158
10.2775
10.2775
-96.8275
-96.8275
6.08343
6.08343
5.2952
5.2952
5.70215
5.70215
6.04809
6.04809
2.9764
2.9764
2.65328
2.65328
69.1315
69.1315
-1.9477
-1.9477
-14.0976
-14.0976
4.59624
4.59624
5.65278
5.65278
4.38772
4.38772
5.76777
5.76777
641.026
641.026
6.46095
6.46095
2.6913
2.6913
4.38635
4.38635
5.22656
5.22656
3.30381
3.30381
5.65425
5.65425
0.566952
0.566952
4.3135
4.3135
552.874
552.874
190.983
190.983
85.6335
85.6335
-0.444552
-0.444552
3.90547
3.90547
17.575
17.575
8.80275
8.80275
5.75641
5.75641
4.60362
4.60362
5.14538
5.14538
441.702
441.702
10.6536
10.6536
-12.4156
-12.4156
5.40962
5.40962
9.815
9.815
4.48172
4.48172
-394.73
-394.73
-0.269308
-0.269308
4.52821
4.52821
5.01944
5.01944
4.75383
4.75383
2.83753
2.83753
-9.52506
-9.52506
6.61406
6.61406
3.70796
3.70796
4.5198
4.5198
4.7255
4.7255
0.445974
0.445974
2.29821
2.29821
-55.5384
-55.5384
4.77706
4.77706
4.91886
4.91886
3.07791
3.07791
5.13661
5.13661
3.63566
3.63566
2.69018
2.69018
4.54454
4.54454
3.61934
3.61934
3.7345
3.7345
3.01601
3.01601
1.81172
1.81172
427.054
427.054
8.65704
8.65704
13.236
13.236
2.49741
2.49741
4.16188
4.16188
5.73509
5.73509
4.44511
4.44511
-19.4819
-19.4819
1019
1019
-15.367
-15.367
-1.32584
-1.32584
4.30891
4.30891
4.01551
4.01551
-1.53297
-1.53297
5.47593
5.47593
3.15735
3.15735
1527.73
1527.73
4.2367
4.2367
3.46037
3.46037
-1.61479
-1.61479
357.618
357.618
-16.1918
-16.1918
3.39366
3.39366
1.87739
1.87739
2.78998
2.78998
4.59254
4.59254
2.05576
2.05576
3.3959
3.3959
4.38778
4.38778
-963.964
-963.964
-933.235
1.84485
1.84485
2.57422
2.93119
2.93119
1514.99
1514.99
3.24785
3.24785
0.313602
0.313602
4.40108
4.40108
5.80393
5.80393
624.274
624.274
1173.55
1173.55
1267.29
-4.48384
-4.48384
3.58922
3.58922
3.37768
3.37768
4.33481
4.33481
1430.54
1430.54
2.02829
2.02829
4.17646
4.17646
450.344
450.344
360.209
360.209
-1.40853
-1.40853
3.71914
3.71914
981.013
981.013
791.455
791.455
4.06105
4.06105
4.84566
4.84566
1585.25
1585.25
4.97269
4.97269
4.18213
4.18213
0.325059
0.325059
3.77803
3.77803
5.05458
5.05458
4.80864
4.80864
3.13829
3.13829
2.72233
2.72233
437.392
437.392
-0.151525
-0.151525
5.65561
5.65561
4.64897
4.64897
5.43951
5.43951
4.08677
4.08677
24.6256
24.6256
5.03217
5.03217
39.8251
39.8251
-16.122
-16.122
-4.7213
-4.7213
5.52681
5.52681
4.7812
4.7812
194.75
194.75
4.13188
4.13188
4.00785
4.00785
4.32721
4.32721
4.80767
4.80767
5.16855
5.16855
1080.88
1080.88
1174.62
5.45436
5.45436
4.41021
4.41021
4.76314
4.76314
3.16402
3.16402
-8.77842
-8.77842
10.1451
10.1451
4.32217
4.32217
4.4088
4.4088
0.868643
0.868643
5.50463
5.50463
5.32196
5.32196
-8.68343
-8.68343
-0.752101
-0.752101
0.252445
0.252445
0.28096
790.688
790.688
4.2456
4.2456
4.59879
4.59879
5.28915
5.28915
5.50142
5.50142
5.42563
5.42563
4.34042
4.34042
4.18079
4.18079
5.17168
5.17168
5.1822
5.1822
4.69032
4.69032
364.574
364.574
4.98192
4.98192
4.57211
4.57211
4.491
4.491
5.40917
5.40917
4.2718
4.2718
4.80391
4.80391
5.28149
5.28149
6.14793
6.14793
-3.86637
-3.86637
4.58854
4.58854
5.10927
5.10927
-0.0155132
-0.0155132
5.30644
5.30644
677.744
677.744
706.083
4.52423
4.52423
5.25958
5.25958
4.96533
4.96533
899.749
899.749
993.489
3.95745
3.95745
5.59067
5.59067
4.53896
4.53896
7.20144
7.20144
-66.3174
-66.3174
0.615943
0.615943
4.7183
4.7183
3.35795
3.35795
10.4961
10.4961
4.90483
4.90483
-34.5296
-34.5296
966.836
966.836
5.29988
5.29988
4.74248
4.74248
4.74235
4.74235
4.4808
4.4808
5.1809
5.1809
5.86897
5.86897
4.69554
4.69554
5.12079
5.12079
5.14876
5.14876
5.20132
5.20132
4.74845
4.74845
5.49639
5.49639
5.50394
5.50394
70.7731
70.7731
7.46916
7.46916
5.15373
5.15373
1.01037
1.01037
-88.7169
-88.7169
5.47017
5.47017
650.186
650.186
-2.24767
-2.24767
5.80545
5.80545
4.51342
4.51342
4.54533
4.54533
4.73099
4.73099
5.25548
5.25548
4.67819
4.67819
5.13244
5.13244
-35.9029
-35.9029
1300.61
1300.61
1367.4
4.59696
4.59696
5.22714
5.22714
-5.61404
-5.61404
121.391
121.391
4.35859
4.35859
1164.33
1164.33
5.10725
5.10725
5.73678
5.73678
5.23873
5.23873
315.072
315.072
5.14023
5.14023
4.44625
4.44625
-1.00966
-1.00966
838.904
838.904
4.44036
4.44036
0.47471
0.47471
5.20349
5.20349
4.40679
4.40679
1401.24
1401.24
1491.02
5.08154
5.08154
4.48724
4.48724
4.19747
4.19747
4.80535
4.80535
5.61621
5.61621
5.82131
5.82131
4.51024
4.51024
5.90248
5.90248
139.245
139.245
5.65476
5.65476
5.90361
5.90361
5.20157
5.20157
5.64184
5.64184
4.54394
4.54394
5.91401
5.91401
5.17955
5.17955
4.98172
4.98172
5.30849
5.30849
5.34128
5.34128
163.334
163.334
5.66581
5.66581
5.19622
5.19622
773.837
773.837
5.38811
5.38811
4.6768
4.6768
5.67311
5.67311
5.7678
5.7678
3.38526
3.38526
4.38719
4.38719
5.81522
5.81522
4.30927
4.30927
5.6251
5.6251
4.7551
4.7551
6.0182
6.0182
5.08642
5.08642
4.51093
4.51093
5.26038
5.26038
5.09921
5.09921
5.43855
5.43855
4.7404
4.7404
576.613
576.613
5.56909
5.56909
-4.13457
-4.13457
4.3269
4.3269
4.16683
4.16683
-0.439769
-0.439769
4.17582
4.17582
5.97771
5.97771
5.53341
5.53341
5.31976
5.31976
-362.18
-362.18
815.388
815.388
4.38404
4.38404
2.52298
2.52298
4.90527
4.90527
864.174
864.174
4.93356
4.93356
5.82391
5.82391
6.7529
6.7529
4.96844
4.96844
4.30253
4.30253
4.42302
4.42302
4.38228
4.38228
5.36262
5.36262
5.37572
5.37572
5.56997
5.56997
5.45269
5.45269
5.05818
5.05818
5.2348
5.2348
4.47542
4.47542
5.36739
5.36739
5.72787
5.72787
3.8963
3.8963
4.95453
4.95453
0.296951
0.296951
4.25484
4.25484
4.2772
4.2772
5.43625
5.43625
4.10671
4.10671
4.09702
4.09702
4.99361
4.99361
5.64587
5.64587
5.34383
5.34383
5.71122
5.71122
4.50474
4.50474
9.02603
9.02603
4.31108
4.31108
5.03098
5.03098
5.36147
5.36147
666.434
666.434
5.61075
5.61075
5.5585
5.5585
4.17957
4.17957
5.13002
5.13002
-3.33005
-3.33005
-3.29293
5.13023
5.13023
5.46066
5.46066
4.43892
4.43892
4.09521
4.09521
1446.03
1446.03
5.2567
5.2567
3.27464
3.27464
1.61087
1.61087
1631.84
1631.84
1680.21
4.38577
4.38577
4.52113
4.52113
4.11692
4.11692
5.81056
5.81056
5.18533
5.18533
4.91111
4.91111
5.62225
5.62225
4.83027
4.83027
5.19888
5.19888
4.94911
4.94911
4.1376
4.1376
4.59965
4.59965
4.23909
4.23909
5.52436
5.52436
3.60913
3.60913
4.28669
4.28669
5.60336
5.60336
4.52586
4.52586
-2.35086
-2.35086
5.27876
5.27876
4.37276
4.37276
4.56381
4.56381
392.789
392.789
5.52153
5.52153
4.74077
4.74077
4.31526
4.31526
4.64167
4.64167
4.61989
4.61989
5.68639
5.68639
5.06956
5.06956
4.81248
4.81248
4.41512
4.41512
4.88965
4.88965
5.15322
5.15322
5.31816
5.31816
5.88559
5.88559
4.94196
4.94196
5.33485
5.33485
960.605
960.605
3.9872
3.9872
193.476
193.476
230.399
4.79072
4.79072
5.47609
5.47609
5.4916
5.4916
4.18278
4.18278
4.15304
4.15304
5.53817
5.53817
5.2486
5.2486
4.4793
4.4793
4.99713
4.99713
5.37313
5.37313
4.46826
4.46826
4.14008
4.14008
5.72147
5.72147
3.97385
3.97385
4.71652
4.71652
5.39411
5.39411
5.52969
5.52969
5.76185
5.76185
6.497
6.497
4.11932
4.11932
3.99262
3.99262
4.89772
4.89772
5.02789
5.02789
73.3931
73.3931
5.10457
5.10457
5.59432
5.59432
94.7816
94.7816
4.50437
4.50437
5.37075
5.37075
4.79369
4.79369
609.943
609.943
4.74746
4.74746
3.92256
3.92256
3.96344
3.96344
4.71595
4.71595
4.96406
4.96406
4.32126
4.32126
3.92738
3.92738
5.42132
5.42132
5.15133
5.15133
4.74282
4.74282
3.77135
3.77135
4.55232
4.55232
4.47087
4.47087
6.1794
6.1794
4.6162
4.6162
5.62268
5.62268
3.6832
3.6832
4.23073
4.23073
4.52488
4.52488
3.91367
3.91367
4.18967
4.18967
4.80347
4.80347
829.364
829.364
4.2798
4.2798
4.08384
4.08384
5.77216
5.77216
5.23945
5.23945
5.89339
5.89339
3.99863
3.99863
4.1281
4.1281
4.91608
4.91608
5.48472
5.48472
4.36628
4.36628
4.98363
4.98363
4.57557
4.57557
4.12444
4.12444
5.21555
5.21555
3.99734
3.99734
3.9325
3.9325
5.27674
5.27674
5.30516
5.30516
4.95651
4.95651
3.90502
3.90502
5.69404
5.69404
4.07538
4.07538
4.60552
4.60552
4.41069
4.41069
5.11219
5.11219
5.17772
5.17772
10.8464
10.8464
5.84393
5.84393
4.96884
4.96884
4.78207
4.78207
5.80623
5.80623
4.66921
4.66921
5.51241
5.51241
5.65166
5.65166
4.6221
4.6221
3.804
3.804
4.90469
4.90469
5.56219
5.56219
5.5238
5.5238
5.06852
5.06852
5.35239
5.35239
776.564
776.564
6.02643
6.02643
5.08894
5.08894
4.45889
4.45889
4.54435
4.54435
327.042
327.042
762.46
762.46
3.80019
3.80019
4.51663
4.51663
4.60582
4.60582
4.1884
4.1884
3.89402
3.89402
5.58133
5.58133
4.72395
4.72395
5.67653
5.67653
5.81504
5.81504
6.26249
6.26249
954.264
954.264
539.111
539.111
5.11351
5.11351
5.738
5.738
0.22218
0.22218
4.12506
4.12506
5.8291
5.8291
5.35307
5.35307
4.66431
4.66431
3.9344
3.9344
180.254
180.254
5.38547
5.38547
4.49653
4.49653
4.41854
4.41854
4.78007
4.78007
3.99876
3.99876
5.28531
5.28531
3.80748
3.80748
5.79189
5.79189
5.82686
5.82686
4.2262
4.2262
5.73194
5.73194
5.20036
5.20036
3.78947
3.78947
4.86666
4.86666
3.93477
3.93477
6.5797
6.5797
6.0004
6.0004
4.1223
4.1223
6.09651
6.09651
4.51989
4.51989
635.437
635.437
4.88734
4.88734
5.61726
5.61726
406.131
406.131
6.52673
6.52673
6.25554
6.25554
4.27707
4.27707
3.74316
3.74316
4.75695
4.75695
3.73934
3.73934
5.85986
5.85986
6.79357
6.79357
4.06878
4.06878
4.72707
4.72707
823.628
823.628
5.45801
5.45801
4.56318
4.56318
5.10775
5.10775
4.80858
4.80858
5.21958
5.21958
6.16607
6.16607
4.93784
4.93784
3.96149
3.96149
5.79843
5.79843
4.48892
4.48892
5.23978
5.23978
3.73584
3.73584
5.06617
5.06617
4.63263
4.63263
6.758
6.758
837.98
837.98
4.35602
4.35602
4.56278
4.56278
4.00908
4.00908
5.03499
5.03499
4.7897
4.7897
18.4445
18.4445
6.01122
6.01122
3.72849
3.72849
4.98077
4.98077
5.82787
5.82787
3.78188
3.78188
4.52938
4.52938
4.70353
4.70353
5.93228
5.93228
5.4936
5.4936
6.82995
6.82995
4.58819
4.58819
1010.96
1010.96
4.40874
4.40874
4.40147
4.40147
4.12288
4.12288
3.99801
3.99801
5.32054
5.32054
4.70122
4.70122
3.93719
3.93719
3.95739
3.95739
5.08002
5.08002
3.71106
3.71106
4.34581
4.34581
5.64943
5.64943
5.70183
5.70183
3.93465
3.93465
2.09922
2.09922
4.95564
4.95564
5.98758
5.98758
3.80866
3.80866
5.82857
5.82857
4.87661
4.87661
4.75548
4.75548
5.83004
5.83004
5.58458
5.58458
6.19916
6.19916
5.39125
5.39125
4.43142
4.43142
3.74482
3.74482
752.031
752.031
4.86001
4.86001
3.72237
3.72237
5.57354
5.57354
5.35854
5.35854
5.16905
5.16905
4.63973
4.63973
5.64191
5.64191
4.4658
4.4658
3.89923
3.89923
4.47327
4.47327
4.77994
4.77994
3.77277
3.77277
6.41421
6.41421
5.95891
5.95891
4.12021
4.12021
4.06536
4.06536
3.61255
3.61255
3.61531
3.61531
4.90958
4.90958
4.72531
4.72531
3.61789
3.61789
1380.85
1380.85
4.21957
4.21957
6.17316
6.17316
575.409
575.409
4.59728
4.59728
4.17032
4.17032
4.51202
4.51202
5.74782
5.74782
3.95241
3.95241
5.95209
5.95209
5.14916
5.14916
5.21102
5.21102
5.00651
5.00651
4.51433
4.51433
6.00526
6.00526
4.39511
4.39511
4.7655
4.7655
6.64064
6.64064
4.33484
4.33484
3.99527
3.99527
4.56885
4.56885
4.27108
4.27108
5.43974
5.43974
5.61566
5.61566
6.38424
6.38424
3.93277
3.93277
1454.12
1454.12
4.6791
4.6791
4.91464
4.91464
3.80789
3.80789
5.88287
5.88287
3.8955
3.8955
-34.4882
-34.4882
5.20881
5.20881
3.60376
3.60376
4.6972
4.6972
6.13157
6.13157
3.71418
3.71418
-1.33034
-1.33034
0.203823
0.203823
0.175322
6.85628
6.85628
4.81689
4.81689
4.32912
4.32912
3.74471
3.74471
5.93064
5.93064
1038.31
1038.31
5.05247
5.05247
3.55111
3.55111
4.73215
4.73215
3.55388
3.55388
4.21047
4.21047
3.5494
3.5494
5.96589
5.96589
6.60259
6.60259
3.61868
3.61868
4.55957
4.55957
7.05307
7.05307
4.26544
4.26544
968.932
968.932
5.29675
5.29675
6.11024
6.11024
5.48076
5.48076
4.37343
4.37343
4.83542
4.83542
3.80206
3.80206
4.69825
4.69825
1045.08
1045.08
969.102
969.102
4.90203
4.90203
403.469
403.469
6.8061
6.8061
1626.67
1626.67
3.54244
3.54244
115.865
115.865
3.55505
3.55505
3.58473
3.58473
4.40079
4.40079
4.88501
4.88501
6.06922
6.06922
4.49425
4.49425
5.14414
5.14414
6.31164
6.31164
4.32125
4.32125
3.59816
3.59816
4.37994
4.37994
1011.36
1011.36
3.80552
3.80552
4.66131
4.66131
4.06128
4.06128
5.33888
5.33888
4.54989
4.54989
6.28186
6.28186
3.92875
3.92875
6.11584
6.11584
4.90976
4.90976
4.60344
4.60344
0.998031
0.998031
4.65191
4.65191
7.11748
7.11748
3.70702
3.70702
4.20185
4.20185
3.89222
3.89222
837.669
837.669
6.04551
6.04551
5.84578
5.84578
3.95004
3.95004
3.74299
3.74299
4.98279
4.98279
4.44275
4.44275
4.11663
4.11663
5.67039
5.67039
4.13952
4.13952
5.70683
5.70683
5.66531
5.66531
4.91179
4.91179
4.65839
4.65839
613.661
613.661
4.70211
4.70211
3.77611
3.77611
970.748
970.748
3.53778
3.53778
3.61798
3.61798
5.18859
5.18859
4.93623
4.93623
4.20109
4.20109
959.734
959.734
6.96802
6.96802
5.5685
5.5685
6.22619
6.22619
3.42222
3.42222
6.50795
6.50795
4.71096
4.71096
5.69151
5.69151
6.0342
6.0342
4.78658
4.78658
3.77555
3.77555
6.47213
6.47213
3.42807
3.42807
4.25022
4.25022
5.03014
5.03014
3.42611
3.42611
3.55487
3.55487
6.19812
6.19812
3.59137
3.59137
4.52526
4.52526
5.42675
5.42675
4.30705
4.30705
4.81409
4.81409
4.36459
4.36459
4.98092
4.98092
3.35886
3.35886
4.28865
4.28865
1166.31
1166.31
1190.01
4.34931
4.34931
6.98633
6.98633
4.18975
4.18975
4.47714
4.47714
1342.59
1342.59
5.89988
5.89988
4.12982
4.12982
4.86423
4.86423
3.41738
3.41738
5.75536
5.75536
4.59436
4.59436
3.42871
3.42871
6.39731
6.39731
4.76066
4.76066
3.5317
3.5317
3.80144
3.80144
5.99
5.99
5.27914
5.27914
6.71045
6.71045
4.98944
4.98944
3.36185
3.36185
3.71416
3.71416
3.73964
3.73964
187.38
187.38
6.18932
6.18932
3.61592
3.61592
6.6691
6.6691
4.5321
4.5321
6.36239
6.36239
6.13942
6.13942
4.33012
4.33012
5.61438
5.61438
6.35583
6.35583
4.53416
4.53416
5.12477
5.12477
334.854
334.854
4.57524
4.57524
6.28845
6.28845
-1.39146
-1.39146
4.00643
4.00643
827.811
827.811
5.47165
5.47165
3.35647
3.35647
35.7387
35.7387
3.73894
3.73894
4.63987
4.63987
3.55335
3.55335
4.45196
4.45196
3.36522
3.36522
3.36435
3.36435
4.96373
4.96373
4.37511
4.37511
-52.6618
-52.6618
3.52505
3.52505
3.8897
3.8897
3.94764
3.94764
4.05061
4.05061
3.41307
3.41307
6.14468
6.14468
3.58559
3.58559
6.29458
6.29458
4.48779
4.48779
5.3245
5.3245
6.91218
6.91218
4.29303
4.29303
4.69249
4.69249
3.77286
3.77286
6.58005
6.58005
4.11839
4.11839
3.71311
3.71311
4.17733
4.17733
543.486
543.486
4.10372
4.10372
5.82503
5.82503
5.85119
6.8631
6.8631
3.4281
3.4281
6.54037
6.54037
4.34986
4.34986
5.17156
5.17156
4.88641
4.88641
4.932
4.932
3.52625
3.52625
4.79631
4.79631
1549.16
1549.16
4.16624
4.16624
6.2587
6.2587
4.42212
4.42212
4.72954
4.72954
4.51802
4.51802
3.99902
3.99902
5.01247
5.01247
3.35207
3.35207
4.46149
4.46149
5.85684
5.85684
3.61254
3.61254
5.02752
5.02752
3.23355
3.23355
5.71017
5.71017
3.93717
3.93717
3.36501
3.36501
4.73216
4.73216
3.42191
3.42191
4.20878
4.20878
5.71272
5.71272
7.02429
7.02429
3.73514
3.73514
4.84724
4.84724
3.55053
3.55053
6.46011
6.46011
3.408
3.408
6.05436
6.05436
4.51616
4.51616
872.172
872.172
843.831
5.565
5.565
3.23703
3.23703
-13.4402
-13.4402
-16.3375
6.3047
6.3047
1.12027
1.12027
1.0969
6.42057
6.42057
3.23077
3.23077
1127
1127
4.24186
4.24186
5.41766
5.41766
4.64514
4.64514
6.7692
6.7692
3.42633
3.42633
3.59018
3.59018
4.62406
4.62406
4.10697
4.10697
6.72549
6.72549
4.54428
4.54428
5.26639
5.26639
4.90458
4.90458
4.16524
4.16524
3.52172
3.52172
750.671
750.671
3.60669
3.60669
3.98892
3.98892
3.23842
3.23842
1.29573
1.29573
3.34745
3.34745
3.92895
3.92895
6.21278
6.21278
5.11019
5.11019
4.27995
4.27995
3.23882
3.23882
4.67707
4.67707
1189.78
1189.78
1045.13
1045.13
5.76046
5.76046
5.66305
5.66305
3.36368
3.36368
4.28404
4.28404
4.94874
4.94874
5.61339
5.61339
4.77936
4.77936
5.91084
5.91084
3.17348
3.17348
3.17093
3.17093
6.33875
6.33875
4.33643
4.33643
6.63568
6.63568
6.00664
6.00664
3.16856
3.16856
5.46528
5.46528
4.96838
4.96838
3.40362
3.40362
4.49442
4.49442
3.88422
3.88422
1261.72
1261.72
4.78216
4.78216
6.59254
6.59254
3.22664
3.22664
3.6082
3.6082
3.9403
3.9403
4.0276
4.0276
3.54673
3.54673
3.80559
3.80559
5.31423
5.31423
4.44777
4.44777
3.71068
3.71068
3.40047
3.40047
3.77036
3.77036
93.2136
93.2136
4.60183
4.60183
4.36104
4.36104
3.42349
3.42349
5.159
5.159
3.23822
3.23822
168.335
168.335
643.256
643.256
1124.92
1124.92
6.1647
6.1647
4.0738
4.0738
3.17463
3.17463
6.96256
6.96256
6.91305
6.91305
4.999
4.999
4.52981
4.52981
1026.06
1026.06
4.50261
4.50261
6.37666
6.37666
3.34322
3.34322
4.51404
4.51404
3.1754
3.1754
3.16536
3.16536
4.09615
4.09615
4.11473
4.11473
3.91961
3.91961
3.97899
3.97899
3.36128
3.36128
4.83416
4.83416
3.59095
3.59095
6.50559
6.50559
4.61118
4.61118
4.62312
4.62312
4.72517
4.72517
4.15403
4.15403
3.52869
3.52869
3.17513
3.17513
5.71237
5.71237
3.79976
3.79976
6.32667
6.32667
5.56258
5.56258
980.318
980.318
6.45928
6.45928
4.42434
4.42434
3.40016
3.40016
4.26832
4.26832
4.14887
4.14887
6.81785
6.81785
3.22281
3.22281
6.77175
6.77175
4.66483
4.66483
5.4114
5.4114
3.73775
3.73775
3.23667
3.23667
7.07299
7.07299
3.04242
3.04242
5.25743
5.25743
4.32475
4.32475
131.714
131.714
3.41982
3.41982
5.0997
5.0997
221.478
221.478
6.55182
6.55182
5.86368
5.86368
4.19887
4.19887
3.54221
3.54221
3.16162
3.16162
3.54288
3.54288
4.93775
4.93775
3.04479
3.04479
25.8145
25.8145
332.687
332.687
4.43641
4.43641
3.35805
3.35805
3.33956
3.33956
4.61972
4.61972
3.17392
3.17392
6.67825
6.67825
5.61264
5.61264
4.77154
4.77154
6.06801
6.06801
4.97312
4.97312
3.91069
3.91069
6.86395
6.86395
6.22885
6.22885
3.7916
3.7916
3.04764
3.04764
3.96969
3.96969
6.63172
6.63172
3.04843
3.04843
7.04941
7.04941
7.10222
7.04793
7.04793
7.10073
4.7145
4.7145
6.482
6.482
4.49164
4.49164
3.70743
3.70743
5.46094
5.46094
4.0864
4.0864
3.73138
3.73138
6.49667
6.49667
3.03937
3.03937
3.76559
3.76559
3.87226
3.87226
2.1455
2.1455
3.23422
3.23422
5.30717
5.30717
4.85991
4.85991
4.25619
4.25619
2.9801
2.9801
3.04879
3.04879
3.2194
3.2194
5.15021
5.15021
5.76374
5.76374
4.14415
4.14415
3.92317
3.92317
3.98786
3.98786
6.9554
6.9554
4.98942
4.98942
2.9774
2.9774
7.05176
7.05176
7.11046
7.00616
7.00616
6.39403
6.39403
4.60134
4.60134
4.83173
4.83173
4.25853
4.25853
4.82458
4.82458
538.614
538.614
553.766
553.766
3.17184
3.17184
4.02154
4.02154
3.15821
3.15821
2.98202
2.98202
3.33697
3.33697
3.58821
3.58821
6.53541
6.53541
3.04822
3.04822
1146.36
1146.36
3.41559
3.41559
3.60773
3.60773
7.07599
7.07599
7.13859
4.73344
4.73344
4.31515
4.31515
531.512
531.512
6.85716
6.85716
3.3542
3.3542
4.05403
4.05403
4.65579
4.65579
3.52752
3.52752
5.91754
5.91754
6.17806
6.17806
6.80858
6.80858
4.60657
4.60657
2.98404
2.98404
3.23107
3.23107
1263.76
1263.76
125.445
125.445
2.98485
2.98485
2.98539
2.98539
6.342
6.342
3.03629
3.03629
6.01792
6.01792
3.41322
3.41322
5.56091
5.56091
7.11666
7.11666
4.42759
4.42759
3.724
3.724
3.90256
3.90256
4.56806
4.56806
5.40728
5.40728
3.78389
3.78389
1185.62
1185.62
812.539
812.539
2.85363
2.85363
1763.75
1763.75
3.9614
3.9614
5.25151
5.25151
6.56593
6.56593
2.98509
2.98509
3.2166
3.2166
3.16904
3.16904
5.71358
5.71358
3.04683
3.04683
5.0927
5.0927
4.07808
4.07808
1665.7
1665.7
4.09763
4.09763
2.85556
2.85556
4.93032
4.93032
3.3397
3.3397
6.71036
6.71036
2.97451
2.97451
-2.10821
-2.10821
1173.02
1173.02
2.85115
2.85115
4.48339
4.48339
3.70141
3.70141
0.560875
0.560875
0.605757
-1.29259
-1.29259
-1.31679
3.60337
3.60337
4.13592
4.13592
4.76423
4.76423
1187.65
1187.65
3.1552
3.1552
6.66032
6.66032
6.51187
6.51187
6.87377
6.87377
4.38314
4.38314
3.75599
3.75599
4.25083
4.25083
3.54144
3.54144
3.58418
3.58418
2.79103
2.79103
2.79271
2.79271
2.78876
2.78876
5.86727
5.86727
2.98399
2.98399
5.61272
5.61272
3.40426
3.40426
2.85781
2.85781
3.04469
3.04469
6.9902
6.9902
7.04256
7.04256
3.03351
3.03351
4.59451
4.59451
3.22744
3.22744
5.45889
5.45889
1020.84
1020.84
992.501
3.35001
3.35001
5.3034
5.3034
2.79418
2.79418
5.14526
5.14526
2.85857
2.85857
1005.62
1005.62
3.85138
3.85138
1401.78
1401.78
1824.88
1824.88
3.16571
3.16571
2.85827
2.85827
4.98383
4.98383
7.12236
7.12236
7.18495
1469.12
1469.12
4.30784
4.30784
6.74524
6.74524
6.23885
6.23885
4.81882
4.81882
5.7661
5.7661
3.52474
3.52474
3.71724
3.71724
3.89342
3.89342
6.88824
6.88824
6.40565
6.40565
3.93414
3.93414
3.89557
3.89557
2.97168
2.97168
3.77697
3.77697
6.0763
6.0763
6.83724
6.83724
6.25013
6.25013
2.85802
2.85802
2.6659
2.6659
7.15411
7.15411
2.79473
2.79473
4.2
4.2
3.59698
3.59698
2.84864
2.84864
3.04193
3.04193
3.95444
3.95444
2.6678
2.6678
4.65022
4.65022
2.7952
2.7952
1763.48
1763.48
2.98214
2.98214
6.68778
6.68778
2.66422
2.66422
2.78636
2.78636
3.34922
3.34922
4.4214
4.4214
198.878
198.878
167.05
3.53639
3.53639
4.07148
4.07148
1805.78
1805.78
3.21441
3.21441
2.66783
2.66783
3.9516
3.9516
2.79484
2.79484
40.5
40.5
12.7248
5.92097
5.92097
2.66215
2.66215
4.90218
4.90218
4.97288
4.97288
4.9409
4.67551
4.67551
4.12961
4.12961
3.57768
3.57768
35.9187
35.9187
6.5777
6.5777
2.60407
2.60407
2.97968
2.97968
6.91976
6.91976
2.60135
2.60135
2.66817
2.66817
2.60424
2.60424
4.47822
4.47822
3.22356
3.22356
401.977
401.977
370.148
2.60297
2.60297
3.52061
3.52061
6.35148
6.35148
2.85677
2.85677
3.15291
3.15291
6.18629
6.18629
3.16208
3.16208
3.41286
3.41286
6.67791
6.67791
3.69182
3.69182
6.73356
6.73356
3.03117
3.03117
4.9116
4.9116
4.94362
4.89181
4.89181
4.85858
1538.65
1538.65
6.02493
6.02493
2.47716
2.47716
7.16682
7.16682
7.22941
3.03876
3.03876
2.6048
2.6048
1123.08
1123.08
2.79383
2.79383
4.24537
4.24537
2.59944
2.59944
3.40372
3.40372
6.54381
6.54381
4.78299
4.78299
4.75116
2.47683
2.47683
2.65997
2.65997
4.0503
4.0503
552.405
552.405
552.439
551.951
551.951
551.919
7.018
7.018
1669.84
1669.84
2.41286
2.41286
7.07207
7.07207
3.71139
3.71139
2.84625
2.84625
3.59121
3.59121
2.6676
2.6676
2.78395
2.78395
2.97674
2.97674
502.547
502.547
471.817
3.22106
3.22106
726.854
726.854
758.682
612.382
612.382
580.555
2.96915
2.96915
2.59734
2.59734
1805.32
1805.32
4.63608
4.63608
4.60425
3.53076
3.53076
6.52168
6.52168
3.77112
3.77112
5.71683
5.71683
6.75478
6.75478
5.56308
5.56308
2.85486
2.85486
7.18529
7.18529
1603.59
1603.59
1481.01
1481.01
5.40839
5.40839
3.21462
3.21462
1966.63
1966.63
2.60437
2.60437
3.88998
3.88998
1184.1
1184.1
5.25167
5.25167
2.47749
2.47749
5.09209
5.09209
3.74087
3.74087
1089.88
1089.88
4.92916
4.92916
4.30318
4.30318
290.917
290.917
2.41434
2.41434
2.41408
2.41408
1704.37
1704.37
1787.82
4.44997
4.44997
4.41815
4.7627
4.7627
3.34746
3.34746
6.91213
6.91213
2.79217
2.79217
3.40921
3.40921
2.47584
2.47584
3.94906
3.94906
2.47246
2.47246
2.85241
2.85241
5.54595
5.54595
3.03535
3.03535
5.87125
5.87125
2.47427
2.47427
1407.07
1407.07
2.66644
2.66644
3.51453
3.51453
3.15835
3.15835
6.85861
6.85861
-1.51231
-1.51231
7.20579
7.20579
7.26838
1868.79
1868.79
4.59279
4.59279
3.34158
3.34158
3.40026
3.40026
2.97353
2.97353
4.06678
4.06678
2.6034
2.6034
6.69683
6.69683
2.47687
2.47687
2.78995
2.78995
4.26272
4.26272
4.23089
3.56821
3.56821
2.65784
2.65784
6.93736
6.93736
2.28694
2.28694
3.82842
3.82842
2.41396
2.41396
2.47046
2.47046
2.59519
2.59519
2.84957
2.84957
6.02859
6.02859
3.15682
3.15682
3.52587
3.52587
6.18936
6.18936
2.6647
2.6647
3.15122
3.15122
3.93686
3.93686
2.4126
2.4126
3.39553
3.39553
2.78174
2.78174
4.41958
4.41958
2.40969
2.40969
3.34335
3.34335
3.58631
3.58631
6.35414
6.35414
3.03193
3.03193
4.12549
4.12549
2.41142
2.41142
2.7873
2.7873
1064.47
1064.47
1032.64
3.21974
3.21974
3.85097
3.85097
3.4044
3.4044
3.02922
3.02922
2.97022
2.97022
2.40773
2.40773
1677.76
1677.76
2.84421
2.84421
1821.76
1821.76
2.96716
2.96716
6.87678
6.87678
2.60187
2.60187
1987.84
1987.84
2051.5
2.29218
2.29218
2.28859
2.28859
4.10081
4.10081
4.06898
3.70669
3.70669
2019
2019
3.02934
3.02934
2.47579
2.47579
1889.85
1889.85
7.21051
7.21051
7.23866
7.23866
7.30126
4.73836
4.73836
2.84652
2.84652
3.3367
3.3367
3.33985
3.33985
1611.64
1611.64
3.38959
3.38959
3.33259
3.33259
6.52366
6.52366
2.66247
2.66247
7.09527
7.09527
2.84344
2.84344
3.15476
3.15476
2.41305
2.41305
2.96701
2.96701
3.76657
3.76657
7.0394
7.0394
3.68234
3.68234
4.24345
4.24345
2.78441
2.78441
3.21671
3.21671
3.50812
3.50812
3.33926
3.33926
1695.17
1695.17
5.76814
5.76814
5.73631
2.46843
2.46843
1404.45
1404.45
5.61426
5.61426
5.58244
2.65989
2.65989
5.45987
5.45987
5.42805
2.78142
2.78142
2.65598
2.65598
5.30383
5.30383
5.272
2.59983
2.59983
2.28812
2.28812
5.14519
5.14519
5.11337
2.84048
2.84048
3.32776
3.32776
6.69804
6.69804
4.98337
4.98337
4.95154
4.81808
4.81808
4.78625
3.4003
3.4003
5.63034
5.63034
2.77849
2.77849
2.59318
2.59318
3.88598
3.88598
2.96506
2.96506
2.40567
2.40567
1220.61
1220.61
683.135
683.135
686.925
146.821
146.821
143.825
4.64928
4.64928
4.61745
3.52193
3.52193
2.47418
2.47418
2.65711
2.65711
2.28347
2.28347
3.02765
3.02765
2040.37
2040.37
2.28681
2.28681
3.15173
3.15173
2.65428
2.65428
2.28554
2.28554
6.87735
6.87735
6.92873
6.92873
1622.13
1622.13
4.47713
4.47713
4.4453
2.28128
2.28128
2.59741
2.59741
7.26563
7.26563
7.32823
3.38468
3.38468
2.83814
2.83814
2.65155
2.65155
3.20763
3.20763
3.21326
3.21326
5.9232
5.9232
5.89137
6.08152
6.08152
6.04969
2.41161
2.41161
2.59474
2.59474
6.24366
6.24366
6.21183
2.77996
2.77996
4.06487
4.06487
2.77579
2.77579
3.94549
3.94549
2061.81
2061.81
2125.2
2.22331
2.22331
2.15965
2.22522
2.22522
2.16157
2.28715
2.28715
6.8711
6.8711
3.55983
3.55983
2.84248
2.84248
2.58927
2.58927
2.59199
2.59199
3.15278
3.15278
3.2049
3.2049
3.33596
3.33596
3.02777
3.02777
2.96322
2.96322
6.4101
6.4101
6.37827
3.02744
3.02744
3.14535
3.14535
3.58247
3.58247
7.1237
7.1237
3.21156
3.21156
4.3019
4.3019
4.27008
2.96565
2.96565
1292.91
1292.91
1256.61
1256.61
1224.78
1618.67
1618.67
3.14858
3.14858
3.02539
3.02539
2.64907
2.64907
2.4645
2.4645
2.22513
2.22513
2.16147
2.46713
2.46713
2099.61
2099.61
2163.27
7.2301
7.2301
3.80345
3.80345
2.58674
2.58674
2.84123
2.84123
2.65443
2.65443
3.14896
3.14896
3.15146
3.15146
2.46194
2.46194
2.27896
2.27896
3.39708
3.39708
3.89005
3.89005
3.92187
3.83957
3.83957
3.80774
3.72325
3.72325
6.58128
6.58128
6.54945
2.47211
2.47211
3.32587
3.32587
2.7739
2.7739
3.21498
3.21498
3.7033
3.7033
2.59153
2.59153
2.46972
2.46972
2.46663
2.46663
1902.47
1902.47
2.96457
2.96457
4.12418
4.12418
4.09235
6.75735
6.75735
6.72552
2.83646
2.83646
2.21916
2.21916
2.1555
7.28695
7.28695
7.34955
2.8403
2.8403
2.39968
2.39968
2.40226
2.40226
2.22613
2.22613
2.16247
2.96109
2.96109
2.22431
2.22431
2.16065
2.28557
2.28557
2.77863
2.77863
3.15326
3.15326
2.22285
2.22285
2.15919
3.14614
3.14614
3.21056
3.21056
2.2214
2.2214
2.15774
3.21636
3.21636
2.45959
2.45959
1476.01
1476.01
1444.18
2.6471
2.6471
2.40368
2.40368
2.58455
2.58455
3.50226
3.50226
3.51909
3.51909
2.96507
2.96507
7.0613
7.0613
7.09313
6.93876
6.93876
6.90693
2.77778
2.77778
1833.75
1833.75
2.40969
2.40969
2.83989
2.83989
3.02388
3.02388
3.02636
3.02636
2.39726
2.39726
2.40488
2.40488
2.2169
2.2169
2.15325
2.96346
2.96346
2.6534
2.6534
3.0231
3.0231
2.96498
2.96498
2.77237
2.77237
3.02285
3.02285
2047.63
2047.63
2115.32
2115.32
2178.98
2.45755
2.45755
3.02778
3.02778
2.9615
2.9615
7.11257
7.11257
1.59995
1.59995
2.27573
2.27573
2.22294
2.22294
2.15928
2.6528
2.6528
2.46517
2.46517
2.27309
2.27309
2.77726
2.77726
3.88412
3.88412
3.94413
3.94413
3.9123
2.39512
2.39512
2.58292
2.58292
2.83483
2.83483
3.33359
3.33359
3.38304
3.38304
3.35122
3.20561
3.20561
3.17378
3.7635
3.7635
2.96436
2.96436
2.27844
2.27844
2.27065
2.27065
2.45592
2.45592
7.05397
7.05397
2.64573
2.64573
2.65253
2.65253
3.14695
3.14695
1830.55
1830.55
1688.6
1688.6
1656.77
2.59035
2.59035
2.39332
2.39332
2.83875
2.83875
2.27667
2.27667
2.21457
2.21457
2.15091
2.58972
2.58972
2.8397
2.8397
2.4074
2.4074
2.77717
2.77717
3.39483
3.39483
2.77625
2.77625
2.77744
2.77744
2.26848
2.26848
3.02527
3.02527
2.99344
2.95939
2.95939
3.67331
3.67331
3.57981
3.57981
2.21076
2.21076
2.1471
2.8389
2.8389
2.21345
2.21345
2.14979
2.2835
2.2835
2.22104
2.22104
2.15738
2.65248
2.65248
3.55335
3.55335
3.52153
2.58959
2.58959
2.78044
2.78044
2.77104
2.77104
2.40193
2.40193
2.20823
2.20823
2.14457
2.26663
2.26663
2.58198
2.58198
3.51741
3.51741
3.33187
3.33187
3.39343
3.39343
3.3616
2.46427
2.46427
7.30283
7.30283
7.36543
2.46399
2.46399
2.20596
2.20596
2.1423
2.39202
2.39202
2.58978
2.58978
2.65307
2.65307
2.84266
2.84266
2.81083
2.21019
2.21019
2.14653
2.27454
2.27454
2.27273
2.27273
2.28108
2.28108
2.59393
2.59393
2.21615
2.21615
2.1525
2.20403
2.20403
2.14038
2.58951
2.58951
2.46432
2.46432
2.65219
2.65219
3.20861
3.20861
2.65758
2.65758
2.62575
2.20251
2.20251
2.13885
2.26525
2.26525
2.45509
2.45509
2.46509
2.46509
2.46599
2.46599
3.02139
3.02139
2.40063
2.40063
2.59013
2.59013
2.83332
2.83332
2.46996
2.46996
2.43813
2.40535
2.40535
2.64455
2.64455
3.69364
3.69364
3.66181
2.27184
2.27184
2.20763
2.20763
2.14397
2.27323
2.27323
2.466
2.466
2.40131
2.40131
1897.67
1897.67
1865.84
2037.31
2037.31
2.21179
2.21179
2.14813
2.24362
2099.99
2099.99
2163.64
2068.16
2.275
2.275
2110.82
2110.82
2174.47
3.01991
3.01991
2.98808
2.95773
2.95773
2.21873
2.21873
2.15508
3.14525
3.14525
3.20715
3.20715
3.17532
3.5785
3.5785
3.54667
2.76945
2.76945
2.83185
2.83185
2.80002
3.76212
3.76212
3.73029
3.70152
3.70152
2.27078
2.27078
2.20658
2.20658
2.14292
2.21229
2.21229
2.14863
2.20677
2.20677
2.14311
2.27093
2.27093
2.20716
2.20716
2.1435
2.27142
2.27142
2.20914
2.20914
2.14548
2.20102
2.20102
2.13736
2.26433
2.26433
2.2325
2.39106
2.39106
2.45378
2.45378
2.42195
2.6431
2.6431
2.61127
2.58055
2.58055
2.20842
2.20842
2.14476
2.40219
2.40219
10.5517
10.5517
2.40034
2.40034
2.3999
2.3999
2.39981
2.39981
7.24418
7.24418
7.3132
7.3132
7.3758
1428
1428
90.9785
90.9785
1274.22
1274.22
7.31575
7.31575
7.3789
7.12279
7.12279
5.65105
5.65105
6.46485
6.46485
7.06138
7.06138
7.25195
7.25195
1418.32
1418.32
4.45507
4.45507
1316.36
1316.36
1165.03
1165.03
1136.69
7.25233
7.25233
7.28366
1243.62
1243.62
1215.28
5.65442
5.65442
742.752
742.752
1335.51
1335.51
5.61684
5.61684
1080.67
1080.67
1052.34
4.45415
4.45415
11.4713
11.4713
1363.6
1363.6
7.17017
7.17017
7.20017
6.9963
6.9963
6.97399
701.893
701.893
645.214
662.652
662.652
605.972
-776.467
-776.467
-837.108
567.241
567.241
510.561
373.202
373.202
316.523
770.435
770.435
713.755
1177.26
1177.26
1242.47
1242.47
1370.56
1370.56
1614.76
1614.76
1630.09
668.167
668.167
677.238
1143.19
1143.19
1179.04
1245.95
1245.95
8.59923
8.59923
5.68587
5.68587
1845.71
1845.71
1894.07
2.96657
2.96657
3.00581
2.01398
2.01398
2.05322
1442.23
1442.23
1448.6
1448.6
677.084
677.084
210.775
210.775
5.33137
5.33137
535.024
535.024
1738.81
1738.81
1809.85
1809.85
1704.79
1704.79
1711.3
946.969
946.969
689.498
689.498
625.711
625.711
606.445
606.445
557.005
557.005
783.102
783.102
2119.85
2119.85
2144.99
1974.14
1974.14
1951.57
1255.53
1255.53
5.47584
5.47584
496.104
496.104
4.91365
4.91365
99.2579
99.2579
1247.99
1247.99
1.30301
1.30301
771.782
771.782
-22.5595
-22.5595
1491.78
1491.78
5.04962
5.04962
998.781
998.781
10.8641
10.8641
5.37285
5.37285
621.389
621.389
621.434
22.0593
22.0593
844.173
844.173
13.6818
13.6818
1578.07
1578.07
4.53911
4.53911
5.93992
5.93992
5.01427
5.01427
7.20978
7.20978
7.26595
822.844
822.844
4.54
4.54
1116.56
1116.56
-5.31325
-5.31325
1670.39
1670.39
1673.49
4.87246
4.87246
4.90232
4.90232
4.57501
4.57501
-146.339
-146.339
74.5449
74.5449
2155.93
2155.93
2208.25
5.18356
5.18356
4.52937
4.52937
106.658
106.658
4.51811
4.51811
5.32645
5.32645
-127.671
-127.671
5.46615
5.46615
4.51791
4.51791
288.149
288.149
5.62104
5.62104
225.929
225.929
424.041
424.041
516.111
516.111
-1344.73
-1344.73
-1370.48
5.57625
5.57625
1895.02
1895.02
1777.07
1777.07
1825.44
4.55952
4.55952
)
;
}
}
// ************************************************************************* //
| |
41335b5db84f8a9c0f63b7e7686efa1ce3a4cc2e | f617408161dcb07311e00605b55d7bd9582dc389 | /Project 1/tasks.cpp | 561ad983e2fc32d51d562fca9f55ef81b2df4045 | [
"MIT"
] | permissive | EdPirro/USP-SCC0218 | d3aa3b6b43b72c9507cba31ea31660e2b52e26ff | af707e63f664951a0322a3c4d55e096f51cbeaff | refs/heads/master | 2020-11-27T15:51:23.155045 | 2020-01-09T00:12:04 | 2020-01-09T00:12:04 | 229,518,618 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,669 | cpp | tasks.cpp |
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <utility>
#define DEBUG false
using namespace std;
/*
Complexidade O(n * d), sendo n o numero de tarefas e d o maior deadline de uma tarefa.
*/
int main(){
// Cria uma fila de prioridade vazia para armazenar as "tarefas"
priority_queue<pair<int, int> > tasks;
int max = -1; // deadline sera semore um numero positivo portanto maior que -1
string deadline;
cin >> deadline; // Le a primeira string
while(deadline != "end"){ // Enquanto a tring entrada não for "end" o programa continua lendo tarefas
int dl;
try{ // Verifica se a sting entrada pode ser tranformada num inteiro
// caso consiga, a tranforma e armazena em dl
dl = stoi(deadline);
if(dl > max) max = dl;
} catch (invalid_argument e){
// caso não consiga, ignora essa string e espera outra para ser o deadline
cout << "Argumento Inválido (" << e.what() << "), a string \"" << deadline << "\" foi ignorada." <<endl;
cin >> deadline;
continue;
}
string profit;
try{ // Verifica se a sting entrada pode ser tranformada num inteiro
// caso consiga, a tranforma e adiciona o par com profit e dl em tasks
cin >> profit;
tasks.push(make_pair(stoi(profit), dl));
if(DEBUG) cout << "Tarefa adicionada com deadline: " << deadline << " e lucro: " << profit << "." << endl;
} catch (invalid_argument e){
//Caso não consiga, ignora a tarefa atual e começa o procedimento para adicionar outra
cout << "Argumento Inválido (" << e.what() << ") a inserção da tarefa foi cancelada." <<endl;
}
cin >> deadline;
}
vector<bool> freeDeadlines(max + 1, true); //cria um vetor com espaço ate o maior deadline iniciado tudo em true dizendo que o periodo esta liberado.
int sum = 0; // inicia soma com 0
while(!tasks.empty()){
const pair<int, int> i = tasks.top(); //verifica cada elemento da pq
tasks.pop();
for(int j = i.second; j > 0; j--){ //para cada um deles verifica se tem lugar disponivel(no deadline ou antes) para a tarefa
if(freeDeadlines[j]){
// se encontra ela toma esse lugar, não o deixando mais livre e incrementa a soma
freeDeadlines[j] = false;
sum += i.first;
break;
}
}
}
//apresenta a resposta
cout << sum << endl;
return 0;
}
|
7fb313082e639eda3c7da055ff224c59d1be9c13 | 07275593e3da65154496b0e704a100d37f0e490d | /Search_Algos/binarySearch.cpp | bc3ab07287d8765c8ad51dba92257a5121e5beb5 | [
"MIT"
] | permissive | Cristo12345/CS_Review | ead3a305c7f665a29a7068ffb86e3360c0b0e162 | 7a0c60074a8a6d23f973e4e5e570e3ef22eec252 | refs/heads/master | 2020-09-23T13:12:20.998516 | 2020-07-17T01:59:32 | 2020-07-17T01:59:32 | 225,508,730 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,581 | cpp | binarySearch.cpp | // Binary Search is the simplest divide-and-conquer search algorithm.
// PRE: arr is an already sorted array of unique integers.
// POST: we return the index of the desired integer in arr; otherwise, the integer is not in the array --> return -1
// TIME ANALYSIS:
// n * (1/2)^k with n = size and k = # of iterations we perform
// After k iterations, we know length of array becomes 1
// n = (n/2)^k = 1
// n = 2^k
// log(n) = log(2^k)
// log(n) = k*log(2)
// k = log2(n)
// BEST: O(1)
// WORST: O(logn)
// AVG: O(logn)
#include <iostream>
using namespace std;
int binarySearch(int arr[], int x, int min, int max) {
if (max >= 1) {
int mid = min + (max-1) / 2;
// CASE: We have found item at middle of array, return index of mid
if (arr[mid] == x) {
return mid;
}
// CASE: item is in second half of array, we perform recursive call with mid+1 and max as lower and upper bounds
else if (arr[mid] < x) {
return binarySearch(arr, x, mid + 1, max);
}
// CASE: item is in lower half, we perform recursive call with min and mid-1 as lower and upper bounds
else {
return binarySearch(arr, x, min, mid-1);
}
}
//CASE: item was not found in array
else {
return -1;
}
}
int main() {
int arr[] = {2, 4, 6, 13, 15, 22, 28};
int res = binarySearch(arr, 20, 0, 6);
(res == -1) ? cout << "Item not found"
: cout << "Item found at index " << res;
return 0;
} |
d43aa55a52a9ba36ff2ef643469ffd038b697e03 | 6c55cc16d36e571b123b044bffe751c600fd4472 | /codeforce/string_task.cpp | a05b61356cccf7a38b8edfec848376556749a61c | [] | no_license | Soumik-Dhar/competitive-programming | 0d77101b9b902e3a53accd0bdd37c0d2046d614a | 6c174a6753f56b508aa5caffaaca2cfa67067c88 | refs/heads/master | 2022-12-12T03:43:37.382973 | 2020-09-18T07:05:38 | 2020-09-18T07:05:38 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 996 | cpp | string_task.cpp | // https://codeforces.com/problemset/problem/118/A
/*
deletes all the vowels,
inserts a character "." before each consonant,
replaces all uppercase consonants with corresponding lowercase ones.
*/
#include<iostream>
#include<string>
using namespace std;
bool isVocal(char letter)
{
if(letter == 'a' || letter == 'e' || letter == 'i' || letter == 'o' || letter == 'u')
return true;
return false;
}
int main()
{
string word, result ="";
cin >> word;
char single_letter;
// Set all characters as lowercase
int len = word.size();
for(int i =0; i< len; i++)
{
single_letter = tolower(word[i]);
// Remove vowel
if(isVocal(single_letter))
continue;
// if it is not a vowel push_it
else
{ //inserts a character "." before each consonant,
result.push_back('.');
result.push_back(single_letter);
}
}
cout << result << endl;
return 0;
} |
ddaa4177b469c9a9fc631b445e689cf7eebc3f21 | db2d0f025022e28d1d8d0f1ab4ee7c467da686e3 | /day2/vec2d.cc | fd117a60067077f17b4b902999cf68d6bbdf84bf | [] | no_license | denocris/Object-Oriented-Programming | 95e45d723c3be810dc40f452745d81ed607721a0 | a2248ef239b4d2f33c4a0aa63d592a3af43f9c7f | refs/heads/master | 2021-01-21T01:02:58.980593 | 2016-11-23T17:27:50 | 2016-11-23T17:27:50 | 101,866,912 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,246 | cc | vec2d.cc | #include "vec2d.h"
#include <istream>
#include <ostream>
#include <cmath>
void Vec_2D::updateRandPhi() {
r_ = length();
phi_ = std::atan2(y_,x_);
}
Vec_2D::Vec_2D() {
x_ = 0;
y_ = 0;
updateRandPhi();
}
Vec_2D::Vec_2D(int x, int y) {
x_ = x;
y_ = y;
updateRandPhi();
}
double Vec_2D::length() const {
return std::sqrt( x_ * x_ + y_ * y_ );
}
Vec_2D & Vec_2D::operator+=(const Vec_2D & v) {
x_ += v.x();
y_ += v.y();
updateRandPhi();
return *this;
}
Vec_2D & Vec_2D::operator*=(const double a) {
x_ *= a;
y_ *= a;
updateRandPhi();
return *this;
}
double length(const Vec_2D & a) {
return a.length();
}
std::ostream & operator<<(std::ostream & os,
const Vec_2D & v) {
os << '(' << v.x() << ',' << v.y() << ')';
return os;
}
std::istream & operator>>(std::istream & is,
Vec_2D & v) {
is >> v.x_ >> v.y_;
v.updateRandPhi(); // don't forget this!
return is;
}
Vec_2D operator+(const Vec_2D & a, const Vec_2D & b) {
return {a.x() + b.x(), a.y() + b.y()};
}
Vec_2D operator-(const Vec_2D & a, const Vec_2D & b) {
return {a.x() - b.x(), a.y() - b.y()};
}
double distance(const Vec_2D & a, const Vec_2D & b) {
return length( b - a ); // or (b-a).length()
}
|
56665f827102bab06bd8d0190bea5272da83e277 | 46476e045ba5cdaf724b4a320a84f33dad7a6453 | /src/test/vgcc/tree-object-size.h.cpp | b3187ef1efd0f66fe27dfdb0d9e66316c5e4456b | [] | no_license | o11c/vomitorium-gcc-headers | 131ce02124d4f1db45df2cbd541b099861da0095 | 89467cf0d2ed167192fd7152335c7e50d5eab11c | refs/heads/master | 2021-08-19T07:57:24.507365 | 2017-11-25T10:13:44 | 2017-11-25T10:13:44 | 111,155,529 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 35 | cpp | tree-object-size.h.cpp | #include "vgcc/tree-object-size.h"
|
8715c36224f0296074b5952d5ad5271858019c89 | 10c52806589c39872e4ded7ecaa43fa3afc88999 | /sfu/bdw_work/modules/fp_mul/DPA/fp_mul_rtl.cpp | 4e3064dc6f2cce6208a50d8f2ec3d0c2236b29a0 | [] | no_license | hanji91/stratus_20210201 | 146b52279e7386fdcaa67ead8e82a9ce13eae205 | 1bfa221d6b521437c3aae25de21b3249e68b2d7f | refs/heads/master | 2023-02-24T12:51:34.568022 | 2021-02-01T11:33:58 | 2021-02-01T11:33:58 | 334,918,787 | 1 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 2,755 | cpp | fp_mul_rtl.cpp | // Generated by stratus_hls 19.10-p100 (91500.011111)
// Thu Dec 31 22:42:33 2020
// from fp_mul.cpp
#include "fp_mul_rtl.h"
struct fp_mul;
fp_mul::fp_mul(sc_module_name name) : sc_module(name)
,clk("clk")
,rstn("rstn")
,src_valid("src_valid")
,a_man("a_man")
,a_exp("a_exp")
,a_sign("a_sign")
,b_man("b_man")
,b_exp("b_exp")
,b_sign("b_sign")
,r_man("r_man")
,r_exp("r_exp")
,r_sign("r_sign")
,dst_valid("dst_valid")
,fp_mul_cynw_cm_float_mul_ieee_E8_M23_0_1_rm("fp_mul_cynw_cm_float_mul_ieee_E8_M23_0_1_rm")
,fp_mul_cynw_cm_float_mul_ieee_E8_M23_0_1_x("fp_mul_cynw_cm_float_mul_ieee_E8_M23_0_1_x")
{
fp_mul_cynw_cm_float_mul_ieee_E8_M23_0_1 = new
fp_mul_cynw_cm_float_mul_ieee_E8_M23_0(
"fp_mul_cynw_cm_float_mul_ieee_E8_M23_0_1");
fp_mul_cynw_cm_float_mul_ieee_E8_M23_0_1->a_sign(a_sign);
fp_mul_cynw_cm_float_mul_ieee_E8_M23_0_1->a_exp(a_exp);
fp_mul_cynw_cm_float_mul_ieee_E8_M23_0_1->a_man(a_man);
fp_mul_cynw_cm_float_mul_ieee_E8_M23_0_1->b_sign(b_sign);
fp_mul_cynw_cm_float_mul_ieee_E8_M23_0_1->b_exp(b_exp);
fp_mul_cynw_cm_float_mul_ieee_E8_M23_0_1->b_man(b_man);
fp_mul_cynw_cm_float_mul_ieee_E8_M23_0_1->rm(
fp_mul_cynw_cm_float_mul_ieee_E8_M23_0_1_rm);
fp_mul_cynw_cm_float_mul_ieee_E8_M23_0_1->x(
fp_mul_cynw_cm_float_mul_ieee_E8_M23_0_1_x);
SC_METHOD(drive_dst_valid);
sensitive << clk.pos();
sensitive << rstn.neg();
dont_initialize();
SC_METHOD(drive_r_sign);
sensitive << clk.pos();
sensitive << rstn.neg();
dont_initialize();
SC_METHOD(drive_r_exp);
sensitive << clk.pos();
sensitive << rstn.neg();
dont_initialize();
SC_METHOD(drive_r_man);
sensitive << clk.pos();
sensitive << rstn.neg();
dont_initialize();
SC_METHOD(drive_fp_mul_cynw_cm_float_mul_ieee_E8_M23_0_1_rm);
}
// resource: regr_ac_1
void fp_mul::drive_dst_valid(){
if ( (rstn.read() == 0ULL) ) {
dst_valid = 0ULL;
} else {
dst_valid = src_valid.read();
}
}
// resource: regr_ac_1
void fp_mul::drive_r_sign(){
if ( (rstn.read() == 0ULL) ) {
r_sign = 0ULL;
} else {
r_sign = (sc_uint<1> ) (fp_mul_cynw_cm_float_mul_ieee_E8_M23_0_1_x.read()
.range(31,31));
}
}
// resource: regr_ac_8
void fp_mul::drive_r_exp(){
if ( (rstn.read() == 0ULL) ) {
r_exp = 0ULL;
} else {
r_exp = (sc_uint<8> ) (fp_mul_cynw_cm_float_mul_ieee_E8_M23_0_1_x.read()
.range(30,23));
}
}
// resource: regr_ac_23
void fp_mul::drive_r_man(){
if ( (rstn.read() == 0ULL) ) {
r_man = 0ULL;
} else {
r_man = (sc_uint<23> )fp_mul_cynw_cm_float_mul_ieee_E8_M23_0_1_x.read();
}
}
void fp_mul::drive_fp_mul_cynw_cm_float_mul_ieee_E8_M23_0_1_rm(){
fp_mul_cynw_cm_float_mul_ieee_E8_M23_0_1_rm = 0ULL;
}
|
ad85de7d73c6f9aaa40b227de8373957c336a76e | b5e849a46d8c181e49e1c1385b59be8110536750 | /字符串/5.最长回文子串.cpp | 7a2eaa361a83e2fadea6fa8a56b8424e9d67e20e | [] | no_license | cxhscst2/LeetCode-Solutions | 12db6bcc035264335c439a89d4f5dfc70b65a8d8 | 4de42487fc2a86ed6134617b4568f82107354afd | refs/heads/master | 2022-04-01T08:44:19.989076 | 2020-02-09T08:12:13 | 2020-02-09T08:12:13 | 209,772,846 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 990 | cpp | 5.最长回文子串.cpp | /*
* @lc app=leetcode.cn id=5 lang=cpp
*
* [5] 最长回文子串
*/
// @lc code=start
class Solution {
public:
string longestPalindrome(string s) {
int n = s.size();
if (n == 0) return "";
string ret = "";
int st, ed;
int ans = 0;
for (int i = 0; i < n; ++i){
int x = i, y = i;
while (x >= 0 && y < n){
if (y - x + 1 > ans){
ans = y - x + 1;
st = x;
ed = y;
}
--x;
++y;
if (x < 0 || y >= n) break;
if (s[x] != s[y]) break;
}
}
for (int i = 0; i < n - 1; ++i){
int x = i, y = i + 1;
if (s[x] != s[y]) continue;
while (x >= 0 && y < n){
if (y - x + 1 > ans){
ans = y - x + 1;
st = x;
ed = y;
}
--x;
++y;
if (x < 0 || y >= n) break;
if (s[x] != s[y]) break;
if (y - x + 1 > ans){
ans = y - x + 1;
st = x;
ed = y;
}
}
}
return s.substr(st, ed - st + 1);
}
};
// @lc code=end
|
d7b57eb6ecb38de2cb09c9adeeb6b9578983f058 | 26939077b9131cbea8b6604bbcd93d1b69ed49d0 | /include/River/River/Primitives/MouseButton.h | 08db78eee16154e0bfae89cd7cba73e21f540279 | [] | no_license | maltebp/StarFighter | 505859c052353999b75d32c97aea07011c106b8f | 32fddb374dde9404ccfdb5c66d5e5be39ff19562 | refs/heads/master | 2023-07-14T02:41:09.697483 | 2021-08-29T08:39:06 | 2021-08-29T08:39:06 | 306,422,936 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,876 | h | MouseButton.h | #pragma once
#include <iostream>
#include <string>
#include <unordered_map>
#include <River/Error.h>
namespace River {
struct MouseButton {
public:
/**
* @brief Creates a new MouseButton, without defining a name for its code
*/
MouseButton(uint32_t code) :code(code) {}
/**
* @brief This registers a new mouse button
*/
MouseButton(const std::string& name, uint32_t code) : code(code) {
if( names.find(code) != names.end() )
throw new InvalidArgumentException("Duplicate mouse button code '" + std::to_string(code) + "'");
names.emplace(code, name);
}
const std::string& getName() const {
return names.find(code)->second;
}
const uint32_t code;
friend std::ostream& operator<<(std::ostream&, const MouseButton&);
private:
static inline std::unordered_map<uint32_t, std::string> names;
};
// Note: This remove the possibility of hashing this class. It could be implemented but it's to extensive
inline bool operator==(const MouseButton& btn1, const MouseButton& btn2) {
return btn1.code == btn2.code;
}
inline std::ostream& operator<<(std::ostream& strm, const MouseButton& btn) {
return strm << btn.getName();
}
namespace MouseButtons {
/**
* @brief An unknown mouse button (may indicate an error has occured in the framework)
*/
inline const MouseButton UNKNOWN = { "Unknown", 0 };
inline const MouseButton LEFT = { "Left", 1 };
inline const MouseButton RIGHT = { "Right", 2 };
// Mousewheel press
inline const MouseButton MIDDLE = { "Middle", 3 };
// This may depend on the mouse settings
inline const MouseButton EXTRA1 = { "Extra1", 4 };
inline const MouseButton EXTRA2 = { "Extra2", 5 };
inline const MouseButton EXTRA3 = { "Extra3", 6 };
inline const MouseButton EXTRA4 = { "Extra4", 7 };
inline const MouseButton EXTRA5 = { "Extra5", 8 };
}
} |
8603c02b57f0d44d8d86d215662bee1aa07a6ea9 | fc1e83c4e4deea541aa2ed0f57bf98927a13a4de | /Selection Sort.cxx | 3f4ddeb5c2eec80ca2da6542fe7ed5fd37654cd3 | [] | no_license | mdirfancse2023/C-Tutorial | 44eb2246360de2d41bfb16f14aa774340e4d9e45 | d7390b35012e661c9fbc86bac1e55101e0afc03e | refs/heads/master | 2023-04-16T04:58:42.728312 | 2021-05-01T07:23:24 | 2021-05-01T07:23:24 | 363,348,173 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 591 | cxx | Selection Sort.cxx | #include <iostream>
using namespace std;
void main()
{
int arr[10], n, i, j, temp, min;
cout << "No. of Elements : ";
cin >> n;
cout << "Type Elements" << endl;
for (i = 0; i < n; i++)
{
cin >> arr[i];
}
cout << "Unsorted Array" << endl;
for (i = 0; i < n; i++)
{
cout << arr[i] << " ";
}
for (i = 0; i < n; i++)
{
min = i;
for (j = i + 1; j < n; j++)
{
if (arr[j] < arr[min])
{
min = j;
}
}
temp = arr[min];
arr[min] = arr[i];
arr[i] = temp;
}
cout << endl
<< "Sorted Array" << endl;
for (i = 0; i < n; i++)
{
cout << arr[i] << " ";
}
} |
3ef1b108d6c16f0527ec6883c5fa0085693bc93f | 62b021aec0aa47bb7566aa8517d4d7d1878001df | /src/private/metaproperty_p.h | c0b2b120586bd8e158bf3be75a80c8e9b1b38881 | [
"MIT"
] | permissive | elohim-meth/rtti | 7939c4acb9cf6a8a1d0b50e779c99c0614effa37 | c208d5b69d5d6bffb658a3b4bbdbc10d6224fed2 | refs/heads/master | 2021-06-18T06:23:24.063751 | 2021-03-10T10:02:16 | 2021-03-10T10:02:16 | 39,070,468 | 13 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 572 | h | metaproperty_p.h | #ifndef METAPROPERTY_P_H
#define METAPROPERTY_P_H
#include "metaitem_p.h"
#include <rtti/variant.h>
namespace rtti {
class RTTI_PRIVATE MetaPropertyPrivate: public MetaItemPrivate
{
public:
MetaPropertyPrivate(std::string_view name, MetaContainer const &owner,
std::unique_ptr<IPropertyInvoker> invoker)
: MetaItemPrivate{name, owner},
m_invoker{std::move(invoker)}
{}
private:
std::unique_ptr<IPropertyInvoker> m_invoker;
friend class rtti::MetaProperty;
};
} // namespace rtti
#endif // METAPROPERTY_P_H
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.