blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 4 201 | content_id stringlengths 40 40 | detected_licenses listlengths 0 85 | license_type stringclasses 2
values | repo_name stringlengths 7 100 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringclasses 260
values | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 11.4k 681M ⌀ | star_events_count int64 0 209k | fork_events_count int64 0 110k | gha_license_id stringclasses 17
values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 80
values | src_encoding stringclasses 28
values | language stringclasses 1
value | is_vendor bool 1
class | is_generated bool 2
classes | length_bytes int64 8 9.86M | extension stringclasses 52
values | content stringlengths 8 9.86M | authors listlengths 1 1 | author stringlengths 0 119 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
f7c8f5e3bd4b1e78c5184da99ba2678a9aa23e26 | 967b162f453758268829b7d4dd7de8ee635ff3c1 | /kar.h | 3041fe8561942a98f0a67ddcfef4bafe2149e514 | [] | no_license | DreamFeather/King-Shines-1.3 | cdf0a8ead235ca99e2ff4f383062521f44ed2ad9 | f222e1dbbf00cf8bb5454710ec63002cf459e18f | refs/heads/master | 2020-03-21T20:46:13.904548 | 2018-06-28T14:25:15 | 2018-06-28T14:25:15 | 139,027,062 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,122 | h | #ifndef kar_H
#define kar_H
#include<iostream>
#include"bullet.h"
using namespace std;
class kar
{
public:
string name;
int grade,speed,EXP,dir,pos,attack;
int time,last;
double blood,buff,Maxblood,Basicblood;
bullet *p[30];
int attacted(int value);
void move(char);
void upgrade();
void run();
void ifkilled();
void recover();
void relive();
};
int kar::attacted(int value)
{
if(blood<0)return 0;
blood-=value;
if(blood<0)return grade+attack*buff;
return grade;
}
void kar::upgrade()
{
grade=EXP/1000+1;if(grade>15)grade=15;
buff=(grade+Maxblood/500+EXP/2000)/100.0+1;
Maxblood=Basicblood+grade*10+EXP/100;
}
void kar::ifkilled()
{
if(blood==-Maxblood)return ;
last=time;
if(blood<=0)
{
pos=-1,blood=-Maxblood;
}
}
void kar::relive()
{
if(time-last>10)
{
pos=0;blood=Maxblood;
}
}
void kar::run()
{
++time;
upgrade();
ifkilled();
relive();
}
void kar::move(char c)
{
if(blood>0)
switch (c)
{
case 'a':dir=-1;pos+=speed*dir;if(pos<0)pos=0;break;
case 'd':dir=1;pos+=speed*dir;if(pos>49)pos=49;break;
case 'q':dir=-1;break;
case 'e':dir=1;break;
}
}
#endif
| [
"1659271617@qq.com"
] | 1659271617@qq.com |
ecc28b69351429f61f76d585ffc81545d0d5eb7a | 12a7301bc60856331b6e6681a8a4d7cc7bf0d488 | /vectorian/core/cpp/match/matcher_impl.h | b8ce08d60a53154c039f92be1126f49e743112bb | [
"MIT"
] | permissive | poke1024/vectorian | 04855c4c99747ce009521ca4b819bb7c69f9face | 72292735d2993eb22137993d2368a777572bb34a | refs/heads/master | 2022-12-03T00:01:57.463204 | 2022-11-30T12:10:02 | 2022-11-30T12:10:02 | 237,608,828 | 9 | 1 | null | 2021-03-25T23:29:07 | 2020-02-01T12:04:52 | JavaScript | UTF-8 | C++ | false | false | 6,129 | h | #ifndef __VECTORIAN_MATCHER_IMPL__
#define __VECTORIAN_MATCHER_IMPL__
#include "common.h"
#include "match/matcher.h"
#include "match/match.h"
#include "query.h"
#include "document.h"
#include "result_set.h"
#include "metric/alignment.h"
#include "pyalign/algorithm/factory.h"
#include <fstream>
template<typename Aligner>
class MatcherBase : public Matcher {
protected:
Aligner m_aligner;
MatchRef m_no_match;
public:
MatcherBase(
const QueryRef &p_query,
const DocumentRef &p_document,
const BoosterRef &p_booster,
const MetricRef &p_metric,
Aligner &&p_aligner) :
Matcher(p_query, p_document, p_booster, p_metric),
m_aligner(std::move(p_aligner)) {
const auto &slice_strategy = p_query->slice_strategy();
m_aligner.init(
p_document->spans(slice_strategy.level)->max_len(slice_strategy.window_size),
m_query->n_tokens());
}
virtual void initialize() {
m_no_match = std::make_shared<Match>(
this->shared_from_this(),
MatchDigest(m_document, -1, FlowRef<int16_t>()),
Score(m_query->min_score(), 1)
);
}
virtual float gap_cost_s(size_t len) const {
return m_aligner.gap_cost_s(len);
}
virtual float gap_cost_t(size_t len) const {
return m_aligner.gap_cost_t(len);
}
};
inline void reverse_alignment(std::vector<int16_t> &match, int len_s) {
for (size_t i = 0; i < match.size(); i++) {
int16_t u = match[i];
if (u >= 0) {
match[i] = len_s - 1 - u;
}
}
std::reverse(match.begin(), match.end());
}
template<typename SliceFactory, typename Aligner, typename Finalizer>
class MatcherImpl : public MatcherBase<Aligner> {
const Finalizer m_finalizer;
const SliceFactory m_slice_factory;
template<bool Hook, typename RunMatch>
void run_matches(
const ResultSetRef &p_matches,
const RunMatch &p_run_match) {
const auto &slice_strategy = this->m_query->slice_strategy();
const Token *s_tokens = this->m_document->tokens_vector()->data();
const Token *t_tokens = this->m_query->tokens_vector()->data();
const auto len_t = this->m_query->n_tokens();
if (len_t < 1) {
return; // no matches
}
const MatcherRef matcher = this->shared_from_this();
const auto spans = this->m_document->spans(slice_strategy.level);
const auto &booster = this->m_booster;
const auto match_span = [&, s_tokens, t_tokens, len_t, booster] (
const size_t slice_id, const size_t token_at, const size_t len_s) {
p_run_match([&, s_tokens, t_tokens, slice_id, token_at, len_s, len_t] () {
const auto slice = m_slice_factory.create_slice(
slice_id,
TokenSpan{s_tokens, static_cast<int32_t>(token_at), static_cast<int32_t>(len_s)},
TokenSpan{t_tokens, 0, static_cast<int32_t>(len_t)});
const float boost = booster.get() ? booster->get_boost(slice_id) : 1.0f;
return this->m_aligner.template make_match<Hook>(
matcher, slice, boost, p_matches);
});
return !this->m_query->aborted();
};
spans->iterate(slice_strategy, match_span);
}
public:
MatcherImpl(
const QueryRef &p_query,
const DocumentRef &p_document,
const BoosterRef &p_booster,
const MetricRef &p_metric,
Aligner &&p_aligner,
const Finalizer &p_finalizer,
const SliceFactory &p_slice_factory) :
MatcherBase<Aligner>(
p_query,
p_document,
p_booster,
p_metric,
std::move(p_aligner)),
m_finalizer(p_finalizer),
m_slice_factory(p_slice_factory) {
}
virtual void match(const ResultSetRef &p_matches) {
PPK_ASSERT(p_matches->size() == 0);
if (this->m_query->debug_hook().has_value()) {
run_matches<true>(p_matches, [this] (const auto &f) -> MatchRef {
const std::chrono::steady_clock::time_point time_begin =
std::chrono::steady_clock::now();
const auto m = f();
{
py::gil_scoped_acquire acquire;
const std::chrono::steady_clock::time_point time_end =
std::chrono::steady_clock::now();
const auto delta_time = std::chrono::duration_cast<std::chrono::microseconds>(
time_end - time_begin).count();
const auto callback = *this->m_query->debug_hook();
callback("document/match_time", delta_time);
}
return m;
});
} else {
run_matches<false>(p_matches, [] (const auto &f) -> MatchRef {
return f();
});
}
if (this->m_query->debug_hook().has_value()) {
py::gil_scoped_acquire acquire;
py::dict data;
data["doc_id"] = this->m_document->id();
data["num_results"] = p_matches->size();
const auto callback = *this->m_query->debug_hook();
callback("document/done", data);
}
p_matches->modify([this] (const auto &match) {
this->m_finalizer(match);
});
}
};
template<typename MakeSlice, typename MakeMatcher>
class FilteredMatcherFactory {
const MakeSlice m_make_slice;
const MakeMatcher m_make_matcher;
public:
typedef typename std::invoke_result<
MakeSlice,
const size_t,
const TokenSpan&,
const TokenSpan&>::type Slice;
FilteredMatcherFactory(
const MakeSlice &make_slice,
const MakeMatcher &make_matcher) :
m_make_slice(make_slice),
m_make_matcher(make_matcher) {
}
MatcherRef create(
const QueryRef &p_query,
const DocumentRef &p_document,
const BoosterRef &p_booster) const {
const auto token_filter = p_query->token_filter();
if (token_filter.get()) {
return m_make_matcher(FilteredSliceFactory(
p_query,
SliceFactory(m_make_slice),
p_document, token_filter));
} else {
return m_make_matcher(SliceFactory(m_make_slice));
}
}
};
template<typename GenSlice>
MatcherRef MinimalMatcherFactory::make_matcher(
const QueryRef &p_query,
const MetricRef &p_metric,
const DocumentRef &p_document,
const BoosterRef &p_booster,
const MatcherOptions &p_matcher_options,
const GenSlice &p_gen_slice) const {
const auto gen_matcher = [p_query, p_document, p_booster, p_metric, p_matcher_options] (auto slice_factory) {
return create_alignment_matcher<Index>(
p_query, p_document, p_booster, p_metric, p_matcher_options, slice_factory);
};
FilteredMatcherFactory factory(
p_gen_slice,
gen_matcher);
return factory.create(p_query, p_document, p_booster);
}
#endif // __VECTORIAN_MATCHER_IMPL__
| [
"poke1024@gmx.de"
] | poke1024@gmx.de |
afc76b6af4fd0eea263f0cfecac52ef492d04a5c | fb6251837c15a0ee0b28b15d214599165e11de83 | /URI/1145-Logical Sequence 2.cpp | a13b3c9ab780ac5af9b2a7a7ed699407b2254abe | [] | no_license | CDPS/Competitive-Programming | de72288b8dc02ca2a45ed40491ce1839e983b765 | 24c046cbde7fea04a6c0f22518a688faf7521e2e | refs/heads/master | 2023-08-09T09:57:15.368959 | 2023-08-05T00:44:41 | 2023-08-05T00:44:41 | 104,966,014 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 295 | cpp | #include <bits/stdc++.h>
using namespace std;
int main(){
int x,y;
scanf("%d %d",&x,&y);
for(int i=1;i<=y;i++){
printf("%d",i);
for(int j=0;j< x-1 && i<y;j++){
i++;
printf(" %d",i);
}
printf("\n");
}
return 0;
}
| [
"crispale07@gmail.com"
] | crispale07@gmail.com |
7966c35c1874309bfaf41f5ce90636c67ba79d6f | 69e28ed54d9755b8cb673c9b910a3cb5a254ef36 | /arduino-code/cheese_cave/cheese_cave.ino | 6a66883ffc8c637795e76da2b8f6cbf52381f3da | [] | no_license | CounterCultureLabs/online-cheese-cave | 4872e1fca79219433050ab62aad1e80d3a6f162b | c37289c4fb99edaa62ce73c1223548720ee33b58 | refs/heads/master | 2016-08-04T07:22:20.858509 | 2014-04-07T12:49:20 | 2014-04-07T12:49:20 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 831 | ino | #include <SHT1x.h>
#define dataPin (12)
#define clockPin (13)
#define relayPin (8)
SHT1x sht1x(dataPin, clockPin);
void setup() {
Serial.begin(9600);
pinMode(relayPin, OUTPUT);
}
float temp;
float humidity;
int last_state = LOW;
int inp;
void humidifier_on() {
digitalWrite(relayPin, HIGH);
}
void humidifier_off() {
digitalWrite(relayPin, LOW);
}
void loop() {
temp = sht1x.readTemperatureC();
humidity = sht1x.readHumidity();
if(humidity < 80.0) {
humidifier_on();
}
if(humidity > 85.0) {
humidifier_off();
}
if(Serial.available() > 0) {
inp = Serial.read();
Serial.print("<");
Serial.print(humidity);
Serial.print("|");
Serial.print(temp);
Serial.print(">");
Serial.print("\r");
Serial.print("\n");
Serial.flush();
}
delay(1000);
}
| [
"juul@labitat.dk"
] | juul@labitat.dk |
21dcce34d9c1ced514ea0d7b9ae9c8b492c3719f | 711bafd4272699312251d1ea07a7d69ee72998a1 | /寻找峰值.cpp | 5afc1db3eea994ddf49b99b5471bbc56c71dc5e2 | [] | no_license | songjunyu/LeetCode | dbe18740f659cd7d8d4e227fded3603efe73637f | e17a1d14878271a5db13084ba38a98c7b6ba5bd5 | refs/heads/master | 2022-04-07T06:59:45.835123 | 2019-12-29T08:23:59 | 2019-12-29T08:23:59 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 623 | cpp | #include <iostream>
#include <string>
#include <map>
#include <vector>
#include <set>
#include <algorithm>
#include <queue>
#include <unordered_set>
#include <time.h>
#include "linearlist.cpp"
using namespace std;
class Solution {
public:
int findPeakElement(vector<int>& nums)
{
int left = 0, right = nums.size() - 1;
while (left < right)
{
unsigned int mid = (left + right) >> 1;
if (nums[mid] > nums[mid + 1])
right = mid;
else
left = mid + 1;
}
return left;
}
};
int main()
{
Solution a;
vector<int> nums = { 1 };
cout << a.findPeakElement(nums) << endl;
system("pause");
}
| [
"noreply@github.com"
] | noreply@github.com |
e735f684b104fbeb0226ef2199c922df3dfefaca | 785df77400157c058a934069298568e47950e40b | /Common/Foam/include/base/globalIndexI.hxx | d1a43aafde32c8fc263d4435c6cae6f369f6d957 | [] | 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 | 2,203 | hxx | #pragma once
#include <ListOps.hxx>
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
tnbLib::globalIndex::globalIndex()
{}
tnbLib::globalIndex::globalIndex(labelList&& offsets)
:
offsets_(move(offsets))
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
inline tnbLib::labelList& tnbLib::globalIndex::offsets()
{
return offsets_;
}
inline tnbLib::label tnbLib::globalIndex::offset(const label proci) const
{
return offsets_[proci];
}
inline tnbLib::label tnbLib::globalIndex::localSize(const label proci) const
{
return offsets_[proci + 1] - offsets_[proci];
}
inline tnbLib::label tnbLib::globalIndex::localSize() const
{
return localSize(Pstream::myProcNo());
}
inline tnbLib::label tnbLib::globalIndex::size() const
{
return offsets_.last();
}
inline tnbLib::label tnbLib::globalIndex::toGlobal
(
const label proci,
const label i
) const
{
return i + offsets_[proci];
}
inline tnbLib::label tnbLib::globalIndex::toGlobal(const label i) const
{
return toGlobal(Pstream::myProcNo(), i);
}
//- Is on local processor
inline bool tnbLib::globalIndex::isLocal(const label proci, const label i) const
{
return i >= offsets_[proci] && i < offsets_[proci + 1];
}
inline bool tnbLib::globalIndex::isLocal(const label i) const
{
return isLocal(Pstream::myProcNo(), i);
}
inline tnbLib::label tnbLib::globalIndex::toLocal(const label proci, const label i)
const
{
label localI = i - offsets_[proci];
if (localI < 0 || i >= offsets_[proci + 1])
{
FatalErrorInFunction
<< "Global " << i << " does not belong on processor "
<< proci << endl << "Offsets:" << offsets_
<< abort(FatalError);
}
return localI;
}
inline tnbLib::label tnbLib::globalIndex::toLocal(const label i) const
{
return toLocal(Pstream::myProcNo(), i);
}
inline tnbLib::label tnbLib::globalIndex::whichProcID(const label i) const
{
if (i < 0 || i >= size())
{
FatalErrorInFunction
<< "Global " << i << " does not belong on any processor."
<< " Offsets:" << offsets_
<< abort(FatalError);
}
return findLower(offsets_, i + 1);
}
// ************************************************************************* // | [
"aasoleimani86@gmail.com"
] | aasoleimani86@gmail.com |
9f8538ee9c70bc4a0a4040acb717cd8382fe16b1 | 9ae8ee554aedda6e6de696b0522201f4a467b135 | /LeetCode/Palindrome Partitioning II.cpp | b17ada326a528fc30239b6149ac3341181763173 | [
"MIT"
] | permissive | zombiecry/AlgorithmPractice | 29865a78c145a2af438b874cf0fb9481b4be796f | f42933883bd62a86aeef9740356f5010c6c9bebf | refs/heads/master | 2020-05-20T15:49:04.659543 | 2015-10-11T12:21:00 | 2015-10-11T12:21:00 | 17,374,313 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,890 | cpp | #include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include<queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstring>
#include <fstream>
using namespace std;
class Solution {
public:
int n,m;
string s;
vector <int> dp;
vector <vector<int>> pm;
bool CheckPal(string &a){
if (a.length()<=1){return true;}
int l=0;
int r=a.length()-1;
while (l<r){
if (a[l]!=a[r]){
return false;
}
l++;
r--;
}
return true;
}
int Solve(int p){
if (p==0){return 0;}
if (dp[p]!=-1){return dp[p];}
int res=numeric_limits<int>::max();
for (int i=0;i<p;i++){
if (pm[i][p]){
res=min(res,1+Solve(i)) ;
}
}
dp[p]=res;
return res;
}
int minCut(string s) {
n=s.length();
this->s=s;
if (CheckPal(s)){return 0;}
dp.resize(n+1,-1);
pm.resize(n,vector<int>(n+1,false));
for (int i=0;i<n;i++){
for (int j=n;j>i;j--){
if (pm[i][j]){continue;}
string cur=s.substr(i,j-i);
if (CheckPal(cur)){
pm[i][j]=true;
int l=i;
int r=j;
while(l<r){
pm[l][r]=true;
l++;
r--;
}
}
}
}
return Solve(n);
}
};
int main (){
Solution *sol=new Solution;
string s="aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";
cout<<sol->minCut(s)<<endl;
} | [
"yangsc2013@live.com"
] | yangsc2013@live.com |
3a9cb026e2f84e3a2f04e5963dd9f41e7aab41f9 | a3b10481b78aab50ea7a1cc5e3c202afc75ca0cb | /asciidrawer_video/src/png.cpp | d2bd518a3c7a286070fe35e9f015f1437a2a40b9 | [
"MIT"
] | permissive | AnttiVainio/ASCII-drawer | 34d7b35d929d5bdebed3ea112381097dc0a67f23 | 5eae4c0d8b6fd1c53c6d9dadfb7684dbb5521b3c | refs/heads/master | 2022-11-10T22:10:32.192977 | 2020-07-04T11:44:42 | 2020-07-04T11:44:42 | 277,093,956 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,903 | cpp | #include <png.h>
#include <iostream>
#include <fstream>
#define PNGSIGSIZE 8
#define PNG_COMPRESSION 1
void userReadData(png_structp pngPtr, png_bytep data, png_size_t length) {
png_voidp a = png_get_io_ptr(pngPtr);
((std::istream*)a)->read((char*)data, length);
}
unsigned char *loadPNG(const char *filename, unsigned int &width, unsigned int &height, unsigned int &_channels) {
std::ifstream file(filename, std::ifstream::in | std::ifstream::binary);
if (file.bad() || !file.is_open()) {
std::cout << "Couldn't load texture from " << filename << std::endl;
file.close();
return 0;
}
png_byte pngsig[PNGSIGSIZE];
file.read((char*)pngsig, PNGSIGSIZE);
if (png_sig_cmp(pngsig, 0, PNGSIGSIZE) != 0) {
std::cout << "Not a valid PNG!" << std::endl;
file.close();
return 0;
}
png_structp pngPtr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
if (!pngPtr) {
std::cout << "Couldn't initialize png read struct" << std::endl;
file.close();
return 0;
}
png_infop infoPtr = png_create_info_struct(pngPtr);
if (!infoPtr) {
std::cout << "Couldn't initialize png info struct" << std::endl;
png_destroy_read_struct(&pngPtr, (png_infopp)0, (png_infopp)0);
file.close();
return 0;
}
if (setjmp(png_jmpbuf(pngPtr))) {
png_destroy_read_struct(&pngPtr, &infoPtr,(png_infopp)0);
std::cout << "An error occured while reading the PNG file" << std::endl;
file.close();
return 0;
}
png_set_read_fn(pngPtr,(png_voidp)&file, userReadData);
png_set_sig_bytes(pngPtr, PNGSIGSIZE);
png_read_info(pngPtr, infoPtr);
png_uint_32 imgWidth = png_get_image_width(pngPtr, infoPtr);
png_uint_32 imgHeight = png_get_image_height(pngPtr, infoPtr);
png_uint_32 bitdepth = png_get_bit_depth(pngPtr, infoPtr);
png_uint_32 channels = png_get_channels(pngPtr, infoPtr);
png_uint_32 color_type = png_get_color_type(pngPtr, infoPtr);
switch (color_type) {
case PNG_COLOR_TYPE_PALETTE:
png_set_palette_to_rgb(pngPtr);
channels = 3;
break;
case PNG_COLOR_TYPE_GRAY:
if (bitdepth < 8)
png_set_expand_gray_1_2_4_to_8(pngPtr);
bitdepth = 8;
break;
}
if (png_get_valid(pngPtr, infoPtr, PNG_INFO_tRNS)) {
png_set_tRNS_to_alpha(pngPtr);
channels += 1;
}
png_bytep* rowPtrs = new png_bytep[imgHeight];
char unsigned* data = new unsigned char[imgWidth * imgHeight * bitdepth * channels / 8];
const unsigned int stride = imgWidth * bitdepth * channels / 8;
for (size_t i = 0; i < imgHeight; i++) {
png_uint_32 q = (imgHeight - i - 1) * stride;
rowPtrs[i] = (png_bytep)data + q;
}
png_read_image(pngPtr, rowPtrs);
delete[] (png_bytep)rowPtrs;
png_destroy_read_struct(&pngPtr, &infoPtr,(png_infopp)0);
width = imgWidth;
height = imgHeight;
_channels = channels;
return data;
}
bool savePNG(const unsigned char *data, const char* filename, const unsigned int width, const unsigned int height) {
if (!data) return false;
FILE* file = fopen(filename, "wb");
if (!file) return false;
png_structp png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
if (!png_ptr) {
fclose(file);
return false;
}
png_infop info_ptr = png_create_info_struct(png_ptr);
if (!info_ptr) {
fclose(file);
return false;
}
if (setjmp(png_jmpbuf(png_ptr))) {
fclose(file);
png_destroy_write_struct(&png_ptr, &info_ptr);
return false;
}
png_init_io(png_ptr, file);
png_set_compression_level(png_ptr, PNG_COMPRESSION);
png_set_IHDR(
png_ptr,
info_ptr,
width,
height,
8,
PNG_COLOR_TYPE_RGB,
PNG_INTERLACE_NONE,
PNG_COMPRESSION_TYPE_DEFAULT,
PNG_FILTER_TYPE_DEFAULT
);
png_write_info(png_ptr, info_ptr);
for (unsigned int y = 0; y < height; y++) {
unsigned char* pRow = (unsigned char*)&data[(height - y - 1) * width * 3];
png_write_row(png_ptr, pRow);
}
png_write_end(png_ptr, info_ptr);
png_destroy_write_struct(&png_ptr, &info_ptr);
fclose(file);
return true;
}
| [
"antti.e.vainio@gmail.com"
] | antti.e.vainio@gmail.com |
7a482d94e4a1ee21b8f1b46afc5e84cc1092a05a | a3f81fa9283744cb622d15f729eebadb98394c8b | /inference-engine/src/mkldnn_plugin/nodes/mkldnn_shapeof.cpp | 28097fcaf58b614424a14d11084d6d967d42d913 | [
"Apache-2.0"
] | permissive | MonsterDove/openvino | 5a6faa88f20319a6ba66e549da7749158735d36d | c2ddfdc940ef74e0d1089d6633101604227f5640 | refs/heads/master | 2023-09-05T18:51:46.178187 | 2021-11-23T02:26:46 | 2021-11-23T02:26:46 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,918 | cpp | // Copyright (C) 2021 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
#include "mkldnn_shapeof.h"
#include <ngraph/opsets/opset1.hpp>
using namespace MKLDNNPlugin;
using namespace InferenceEngine;
bool MKLDNNShapeOfNode::isSupportedOperation(const std::shared_ptr<const ngraph::Node>& op, std::string& errorMessage) noexcept {
try {
if (!one_of(op->get_type_info(),
ngraph::op::v0::ShapeOf::get_type_info_static(),
ngraph::op::v3::ShapeOf::get_type_info_static())) {
errorMessage = "Node is not an instance of ShapeOf form the operation set v1 or v3.";
return false;
}
} catch (...) {
return false;
}
return true;
}
MKLDNNShapeOfNode::MKLDNNShapeOfNode(const std::shared_ptr<ngraph::Node>& op, const mkldnn::engine& eng,
MKLDNNWeightsSharing::Ptr &cache) : MKLDNNNode(op, eng, cache) {
std::string errorMessage;
if (isSupportedOperation(op, errorMessage)) {
errorPrefix = "ShapeOf layer with name '" + getName() + "' ";
if (op->get_input_partial_shape(0).size() == 0)
IE_THROW() << errorPrefix << "gets unsupported input 0D tensor (scalar)";
} else {
IE_THROW(NotImplemented) << errorMessage;
}
}
void MKLDNNShapeOfNode::getSupportedDescriptors() {
if (!descs.empty())
return;
if (getParentEdges().size() != 1)
IE_THROW() << errorPrefix << "has incorrect number of input edges: " << getParentEdges().size();
if (getChildEdges().empty())
IE_THROW() << errorPrefix << "has incorrect number of output edges: " << getChildEdges().size();
}
void MKLDNNShapeOfNode::initSupportedPrimitiveDescriptors() {
if (!supportedPrimitiveDescriptors.empty())
return;
Precision precision = getOriginalInputPrecisionAtPort(0);
const LayoutType dataFormats[4] = { LayoutType::ncsp, LayoutType::nspc, LayoutType::nCsp16c, LayoutType::nCsp8c };
for (const auto &df : dataFormats) {
addSupportedPrimDesc({{df, precision}},
{{LayoutType::ncsp, Precision::I32}},
impl_desc_type::ref);
}
}
void MKLDNNShapeOfNode::execute(mkldnn::stream strm) {
auto inPtr = getParentEdgeAt(0)->getMemoryPtr();
auto outPtr = getChildEdgeAt(0)->getMemoryPtr();
auto inDims = inPtr->getStaticDims();
size_t dimsCount = inDims.size();
if (outPtr->getStaticDims().size() != 1 || dimsCount != outPtr->getStaticDims()[0])
IE_THROW() << errorPrefix << "has inconsistent input shape and output size";
auto *dst = reinterpret_cast<int *>(getChildEdgeAt(0)->getMemoryPtr()->GetPtr());
for (size_t i = 0; i < dimsCount; i++) {
dst[i] = inDims[i];
}
}
bool MKLDNNShapeOfNode::created() const {
return getType() == ShapeOf;
}
REG_MKLDNN_PRIM_FOR(MKLDNNShapeOfNode, ShapeOf)
| [
"noreply@github.com"
] | noreply@github.com |
0a862ce7250430fbde30aa1c80a3b66093cacfaa | 2cc1cc9d7dbe0f6bf8a397114ade2110cb2195fb | /13711.cpp | 0d659f31ccd0c16e3cfd22207aa52112c257c611 | [] | no_license | jaejunha/Baekjoon | 35a338a0e6524286189a9f99a4be5abf7f1fb591 | a4653a7a08d9852d8705fac7d7e1c3e8f3026861 | refs/heads/master | 2021-05-13T14:58:57.665236 | 2019-04-11T10:40:21 | 2019-04-11T10:40:21 | 116,755,004 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 447 | cpp | /* reference: http://codersbrunch.blogspot.com/2016/12/13711-lcs-4.html */
#include <iostream>
#include <algorithm>
using namespace std;
int n;
int a[100001];
int dp[100000];
int main() {
scanf("%d", &n);
for (int i = 0, x; i < n; i++) {
scanf("%d", &x);
a[x] = i;
}
for (int i = 0, x; i < n; i++) {
scanf("%d", &x);
dp[i] = n;
*lower_bound(dp, dp + i, a[x]) = a[x];
}
printf("%d", lower_bound(dp, dp + n, n) - dp);
return 0;
} | [
"dreamline91@naver.com"
] | dreamline91@naver.com |
ec45258242c8ebe79354e0331f653640c4f8bd67 | 5a7253b0336814401a157f3b12b86ef8010afcaf | /Source/Student/Project_1/Leaf/L_ChangeEnemySize.h | 451f30ed6e0ab7d2e69df0442af354b21f355c47 | [] | no_license | wnsrl7659/AI-HideSeek | 9d1f73ae357a5c7b34633fc400e308e471195d00 | 15b971e03107a49b504bce4688e0746ee4c42414 | refs/heads/master | 2023-07-14T06:49:33.906996 | 2021-09-05T07:29:46 | 2021-09-05T07:29:46 | 403,243,555 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 247 | h | #pragma once
#include "BehaviorNode.h"
class L_ChangeEnemySize : public BaseNode<L_ChangeEnemySize>
{
protected:
virtual void on_enter() override;
virtual void on_update(float dt) override;
private:
Agent* enemy;
float c1, c2, c3;
}; | [
"wnsrl7659@naver.com"
] | wnsrl7659@naver.com |
7efb5d5e64dc2685b6504a5cbb83ac31a6f750d7 | 6cfc4487f2c016f6ebcfb501aa4e3e7349394ce1 | /sample_inputs/elbow-test/1/U | 9a9686a1ea2f2a16cbf54a7e74d9e40e99ad696b | [
"MIT"
] | permissive | parallelworks/MetricExtraction | d9519dfbc04706f91e7b35c156226740ce0034d1 | 0303aeaeb3d9f0ea61c3a46fc40eed976efba10f | refs/heads/master | 2021-08-07T00:05:10.508133 | 2018-07-18T20:21:57 | 2018-07-18T20:21:57 | 93,444,958 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 27,168 | /*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v1612+ |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volVectorField;
location "1";
object U;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 1 -1 0 0 0 0];
internalField nonuniform List<vector>
918
(
(0.82153 -0.191723 0)
(0.0219159 2.97228 0)
(-0.21668 1.78693 0)
(0.688637 0.196231 0)
(0.0440386 1.72492 -1.05271e-19)
(-0.0860061 2.87389 -1.41617e-18)
(1.13659 1.76188 2.75256e-19)
(0.476426 0.284507 -2.81366e-20)
(0.887192 -0.00195959 0)
(0.0417864 1.7773 0)
(0.0168702 1.74172 0)
(0.941137 0.0123521 0)
(-0.0631186 3.05874 0)
(0.0292338 2.92697 0)
(-0.0882818 2.71486 1.67429e-19)
(-0.0235278 1.71761 -9.85416e-20)
(0.689439 0.161369 2.28857e-18)
(0.236941 2.05279 2.59419e-19)
(0.980634 0.0334056 0)
(0.0398869 1.72913 0)
(0.742868 0.128913 8.40842e-20)
(0.682216 -0.0571847 0)
(0.856271 0.000852234 0)
(1.05482 0.0540475 0)
(0.850345 0.0589119 0)
(0.0378468 2.98682 0)
(-0.0362417 2.86183 4.47531e-19)
(-0.195422 1.74731 0)
(-0.0489199 1.66463 0)
(-0.240146 1.73419 0)
(0.0483291 1.73923 0)
(-0.0669389 1.68816 8.28307e-20)
(-0.0329752 1.71764 0)
(-0.0539537 3.02651 -4.08509e-23)
(-0.00750942 2.97918 1.19658e-18)
(0.0221346 3.01158 0)
(0.9821 -0.00519569 0)
(0.81807 1.27469 5.76375e-19)
(1.16796 1.67602 2.28934e-20)
(1.26463 1.55354 8.39462e-20)
(0.972374 1.87203 -6.67944e-20)
(0.932295 1.94029 4.59362e-19)
(0.526155 0.302453 2.69104e-20)
(0.535991 0.281407 0)
(1.37084 0.785906 0)
(0.462641 0.31692 1.13878e-19)
(0.417395 0.286128 -1.18195e-19)
(0.982345 -0.0164081 0)
(1.00719 -0.000316028 0)
(0.891365 -0.0027779 0)
(0.939252 -0.0846623 0)
(0.970539 -0.00302592 0)
(0.929807 0.0176296 0)
(-0.00259567 1.60401 -1.05578e-18)
(0.0344273 1.83071 0)
(0.0271612 1.83051 0)
(-0.0202382 1.79798 0)
(-0.0139952 1.80153 0)
(-0.0148786 1.71974 0)
(0.0285205 1.76183 0)
(0.0112194 1.74591 0)
(-0.00131069 1.74225 0)
(-0.00890258 1.70579 0)
(1.00895 -0.00254756 0)
(0.965272 0.0266367 0)
(0.958432 0.00344587 0)
(0.94944 -0.00751067 0)
(0.942746 -0.00219085 0)
(-0.00510625 2.9729 4.58237e-19)
(0.0284701 2.92085 0)
(-0.035773 2.94967 0)
(-0.0707143 3.08703 2.46144e-24)
(-0.0930678 2.94416 -7.54475e-19)
(-0.0149339 3.06783 0)
(0.028853 2.97804 0)
(0.0202962 2.9852 6.0325e-25)
(0.0249987 2.92025 0)
(0.078689 2.98414 0)
(0.0919603 2.90026 0)
(0.139037 2.85302 0)
(-0.117301 2.88664 0)
(-0.00535837 2.76593 -1.55573e-19)
(-0.123968 2.65603 0)
(-0.00272957 1.73014 0)
(-0.0237179 1.74184 9.72202e-20)
(0.0069838 1.71532 -1.16758e-19)
(0.7235 0.165394 -7.83786e-19)
(0.729056 0.148446 -7.60687e-19)
(0.69158 0.221231 -2.36094e-18)
(0.660206 0.203835 -1.506e-18)
(0.201129 1.39474 0)
(0.355876 2.11292 -2.97921e-19)
(0.465871 2.10045 5.30077e-19)
(0.987602 -0.00431772 0)
(0.970097 -0.00174841 0)
(0.895186 -0.0157967 0)
(1.01695 0.0303349 0)
(0.951011 0.0739807 -8.10279e-18)
(1.02277 0.114957 6.02498e-18)
(0.0288296 1.76661 0)
(0.00799586 1.73579 0)
(0.0228439 1.7088 0)
(-0.024131 1.74339 0)
(-0.0234589 1.75198 0)
(0.815466 0.155759 5.42717e-20)
(0.379494 0.354099 0)
(1.03653 0.0220193 0)
(0.996074 -0.0051861 0)
(0.94053 0.0285741 0)
(0.888644 0.095818 0)
(0.892963 0.0200271 0)
(1.1383 -0.0164466 0)
(0.837995 0.0351127 0)
(0.817285 0.0281081 3.59719e-18)
(-0.058397 2.85531 2.57153e-19)
(-0.026433 2.96882 0)
(-0.0493972 3.06313 0)
(-0.00635039 2.91946 0)
(-0.00750366 2.94261 3.79527e-19)
(0.0405968 2.87639 0)
(-0.0257636 2.95021 -1.26392e-18)
(-0.113933 2.88567 4.43283e-19)
(0.0419881 1.73579 0)
(-0.00825701 1.74861 0)
(-0.0084772 1.7262 -3.83791e-21)
(-0.0500949 1.74067 0)
(0.0249728 1.70065 0)
(1.00116 0.00225242 0)
(0.986788 -0.0161209 0)
(0.974602 -0.00468874 0)
(0.996223 -0.00266675 0)
(0.975148 0.0175142 0)
(0.908317 1.32904 -7.19479e-19)
(0.883322 1.23058 0)
(0.820157 1.33335 9.1668e-20)
(0.781838 1.24777 0)
(1.2136 1.43664 9.83612e-21)
(1.36414 1.26128 -1.27286e-19)
(0.570916 2.11102 0)
(0.791121 2.01609 0)
(0.712745 2.05185 0)
(0.533749 1.26429 -5.5551e-19)
(0.563 0.305624 0)
(0.56869 0.250353 4.02296e-19)
(1.2338 1.21012 0)
(1.26921 0.952535 0)
(1.37697 1.01437 3.17551e-19)
(1.32425 0.753921 0)
(1.38183 0.611807 8.07156e-20)
(0.990044 0.0252475 0)
(0.996009 -0.0134923 0)
(0.989349 -0.00947108 0)
(0.995921 0.00373383 0)
(0.992523 -0.0267116 0)
(0.965702 0.00981076 0)
(0.984783 0.0035416 0)
(0.950201 -0.00190515 0)
(0.897643 0.00860957 0)
(-0.00822148 1.62524 5.46987e-19)
(0.00481874 1.56327 0)
(0.0255288 1.65851 1.05101e-18)
(0.0321298 1.66285 -9.27072e-19)
(0.113943 2.01858 -2.11607e-19)
(0.00901679 1.91434 0)
(0.0315982 1.95235 0)
(-0.00924621 1.80046 0)
(-0.00131571 1.74548 0)
(-0.0294685 1.73474 -3.81085e-21)
(-0.0119648 1.71345 0)
(0.00891215 1.74374 -2.7594e-19)
(0.0191532 1.72838 5.13247e-19)
(0.0288973 1.74991 0)
(0.0248643 1.75565 0)
(0.00585887 1.72168 0)
(0.00132503 1.75133 0)
(-0.00467542 1.75893 0)
(1.03082 0.0172283 0)
(1.01884 0.00617733 0)
(1.01203 0.00131439 0)
(0.982683 -0.00692818 0)
(0.969479 -0.00788728 0)
(0.973992 0.00427642 0)
(0.963181 0.0184668 0)
(0.935798 -0.00142672 0)
(0.0411632 3.07292 -4.05566e-21)
(0.0584226 3.04334 0)
(0.0529056 3.01009 0)
(0.0264736 2.93327 0)
(0.643621 3.05994 0)
(0.914534 2.49143 4.23588e-19)
(-0.0394069 2.80947 0)
(-0.0674585 2.73828 0)
(-0.00816531 1.79845 0)
(-0.0164621 1.68328 0)
(-0.00309857 1.73916 0)
(0.0691131 1.76409 -4.29315e-20)
(0.00402349 1.79492 0)
(0.0508614 1.77347 0)
(0.0318162 1.72615 4.25761e-20)
(0.0200295 1.74857 1.73433e-19)
(-0.00234311 1.72404 1.19537e-19)
(0.0140904 1.6856 0)
(0.752889 0.153352 1.24523e-18)
(0.74642 0.0853128 -1.23002e-18)
(0.212372 1.41643 0)
(0.233962 1.34667 -3.29966e-19)
(0.144384 1.49798 -1.00942e-18)
(0.102177 1.47824 1.00958e-18)
(0.987783 -0.0104318 0)
(0.986504 -0.0242377 0)
(0.985907 0.00187478 0)
(0.967648 0.00996149 0)
(0.00509959 1.76792 0)
(0.027163 1.74782 0)
(0.00754921 1.73013 0)
(0.424982 0.293685 9.57955e-19)
(0.459838 0.263752 -9.08228e-19)
(0.379597 0.289576 0)
(1.18862 0.102918 1.21733e-19)
(1.24288 0.0400895 0)
(1.12443 0.0437905 0)
(1.06927 0.00193625 0)
(0.777268 0.1011 0)
(0.815776 0.0581755 -5.74341e-18)
(0.762364 0.0500346 2.19593e-18)
(-0.030328 2.97351 2.16936e-19)
(0.0505167 2.91294 -1.38932e-20)
(0.0881596 3.01289 -8.60944e-21)
(0.116491 3.02515 1.7994e-19)
(-0.092829 2.96376 1.8677e-20)
(-0.151117 2.91964 -6.04259e-23)
(-0.104994 3.05338 -2.29766e-19)
(0.110887 3.01411 1.64137e-19)
(0.12184 3.06938 -2.08577e-19)
(1.00699 -0.000704985 0)
(0.990873 0.0414816 0)
(0.981976 0.0285017 0)
(0.98676 -0.0111564 0)
(0.978364 -0.00381931 0)
(0.954893 -0.00295304 0)
(0.979441 -0.0136726 0)
(0.993026 0.0139911 0)
(0.971864 0.00842462 0)
(0.966733 1.29099 -6.00958e-19)
(0.889188 1.2731 0)
(0.670682 1.24662 1.65349e-19)
(0.69543 1.33441 1.28223e-18)
(0.776526 1.32902 -7.81107e-19)
(0.728462 1.26369 1.49874e-18)
(0.508337 1.31845 2.7288e-18)
(0.507702 1.27326 5.01433e-19)
(0.661788 0.238425 1.57644e-18)
(0.613859 0.272888 3.96389e-19)
(0.627105 0.23743 7.50697e-19)
(1.28325 0.553503 -6.28678e-19)
(1.33623 0.372963 -7.41979e-19)
(0.000616499 1.69599 4.097e-19)
(0.00324155 1.66767 0)
(1.0741 0.0289641 0)
(1.04951 0.0075627 0)
(1.03503 -0.00476922 0)
(0.0241636 3.08154 0)
(-0.00617838 2.98638 4.18834e-19)
(-4.91027e-05 2.9898 0)
(-0.0120767 2.89971 -4.521e-19)
(-0.00262135 3.07682 9.16821e-20)
(0.0221 3.08137 0)
(0.856881 1.36896 4.71507e-20)
(0.919643 1.82477 -2.70594e-19)
(0.713178 1.47739 -2.20487e-19)
(-0.0486433 2.91555 -2.34628e-19)
(-0.0373496 2.84665 0)
(-0.0675027 2.79716 0)
(-0.0300449 1.7587 -1.59696e-20)
(0.031148 1.72049 -4.3945e-19)
(-0.0469397 1.69669 1.33664e-20)
(0.249369 1.38013 1.05208e-18)
(0.27897 1.31733 -7.11078e-19)
(0.0207392 1.60396 7.7293e-19)
(0.0800133 1.5481 -8.64878e-19)
(0.0594188 1.53305 6.87744e-20)
(-0.0815342 3.09319 -2.30505e-19)
(-0.07617 3.10347 2.93523e-19)
(0.00746082 2.95376 2.37485e-19)
(0.0730699 2.97607 -1.8578e-19)
(0.102467 2.90992 -2.4167e-19)
(0.00405291 3.06612 -6.99e-19)
(-0.0631451 3.05958 7.83806e-19)
(0.534452 1.30756 0)
(0.595627 1.32733 -2.74062e-18)
(0.567974 1.22828 1.21984e-18)
(0.42634 1.35933 1.43731e-18)
(0.42162 1.288 -2.24759e-18)
(1.25511 0.185012 4.45678e-19)
(1.2987 0.366349 0)
(1.32244 0.245329 -3.99953e-19)
(-0.00069573 1.73034 -4.92329e-21)
(-0.0123009 1.70345 0)
(0.0121532 1.6926 0)
(0.299067 1.38295 -3.72812e-19)
(0.359343 1.35526 -8.37144e-19)
(0.380095 1.33242 1.5625e-18)
(0.983522 -0.0490373 0)
(1.05311 -0.0853113 1.49593e-18)
(0.0420671 1.74484 0)
(-0.0235791 1.74188 0)
(1.05673 -0.0171396 5.13448e-20)
(0.911681 -0.0180214 3.18963e-18)
(0.0180447 1.8019 5.66055e-20)
(0.0847278 1.80374 0)
(-0.0711336 2.94451 2.08609e-19)
(-0.0193766 2.57326 0)
(1.1803 0.634834 -4.19896e-19)
(1.03599 -0.0128186 -2.11739e-20)
(1.00631 0.0423773 0)
(0.998504 0.00135213 -4.03475e-21)
(0.0414829 1.90057 0)
(0.133244 1.73589 0)
(-0.0374542 1.78238 0)
(0.0921644 1.79884 2.57831e-19)
(0.00572612 1.79364 1.66383e-19)
(0.997691 -0.00806827 1.39098e-20)
(1.05466 0.075181 0)
(1.08018 0.0447252 0)
(-0.015183 1.71331 0)
(0.0406874 1.76902 0)
(-0.0408117 1.78101 0)
(0.227255 1.9664 6.98379e-20)
(0.981586 -0.0850464 0)
(0.984885 -0.0619852 0)
(0.966971 0.0500175 1.912e-18)
(1.00237 0.0289643 -2.25242e-18)
(1.10891 -0.0542603 0)
(0.004088 1.72636 0)
(0.0153825 1.73332 0)
(-0.00407229 1.75694 0)
(-0.0162352 1.81124 0)
(-0.0531025 1.76592 0)
(0.00192161 1.7142 0)
(1.01524 0.00670229 0)
(1.02838 -0.0153489 -2.71288e-21)
(0.867713 1.69747 -1.126e-20)
(0.971764 -0.0738811 -1.90807e-18)
(1.04722 0.0388847 2.27925e-18)
(1.11083 0.0285682 0)
(0.978457 0.000415289 1.85723e-18)
(1.02031 0.0623115 -2.30111e-18)
(0.995274 0.0292843 0)
(0.0212127 1.78924 0)
(0.0575997 1.76399 1.36079e-19)
(-0.0154117 1.7362 -9.44669e-20)
(1.15904 0.292968 2.50886e-18)
(1.11329 0.0815441 0)
(-0.298415 3.00092 -3.27419e-19)
(-0.0554373 3.1346 -8.02389e-21)
(-0.151246 2.97383 8.46662e-19)
(-0.030066 2.93201 -7.75317e-20)
(-0.0225088 2.89146 0)
(-0.0516249 2.96997 1.14927e-19)
(-0.0899552 3.09415 2.9956e-19)
(-0.0701583 3.01408 -2.08856e-19)
(-0.10472 3.08554 0)
(0.64587 0.281149 0)
(0.494643 0.348234 0)
(1.0819 0.81523 1.22941e-18)
(1.14619 0.935216 -1.54348e-18)
(1.12099 0.580978 0)
(1.12854 0.616599 0)
(1.03073 0.0201862 -3.4709e-18)
(0.98114 0.00157877 4.49164e-18)
(1.03824 -0.0620115 0)
(1.00248 -0.055664 0)
(0.926338 0.0604785 0)
(1.03085 -0.0278397 0)
(1.00592 0.0206626 0)
(0.996429 -0.0473567 0)
(1.01773 -0.096274 0)
(0.960053 0.000945593 0)
(0.0341145 1.88525 0)
(0.00415077 1.81055 0)
(0.118576 1.85092 0)
(0.178702 1.89296 0)
(0.109184 1.6534 0)
(0.0300612 1.66849 -5.47864e-19)
(0.133142 1.72532 0)
(0.058085 1.68391 3.54633e-19)
(0.0898012 1.76458 -3.68203e-19)
(-0.0119782 1.80671 0)
(0.0604745 1.74344 0)
(-0.0445264 1.76405 0)
(-0.0629735 1.75913 0)
(-0.0292331 1.76167 -1.53771e-19)
(-0.0514192 1.74642 3.35733e-19)
(0.067253 1.80503 2.62568e-19)
(0.00663721 1.76528 0)
(0.00911173 1.77882 -4.51272e-19)
(0.00883038 1.73601 -3.37836e-19)
(0.0250592 1.79763 9.40227e-20)
(-0.124939 1.62719 -4.17027e-19)
(0.0795989 1.72994 -3.31055e-19)
(0.988313 -0.0254766 3.13978e-18)
(0.9887 -0.0595699 -4.034e-18)
(0.991504 0.0274793 -3.28035e-18)
(0.915953 0.00556656 4.26929e-18)
(1.04911 0.0501964 0)
(1.03631 0.00068348 0)
(1.03543 0.026857 0)
(1.06374 0.00586297 0)
(1.02186 -0.00843219 0)
(1.08009 0.0657889 0)
(1.07862 0.0316408 0)
(1.04994 0.0261326 0)
(-0.171055 1.70801 -1.05549e-20)
(0.0490546 1.76572 0)
(-0.0519811 1.7322 0)
(0.0395587 1.74427 6.86041e-20)
(0.052141 1.78184 -3.48117e-21)
(0.00991571 1.81741 5.10615e-20)
(-0.0728658 1.7218 -4.99338e-20)
(-0.0539258 1.75908 0)
(-0.0272304 1.77625 0)
(0.0804648 1.73563 0)
(-0.0507601 1.76197 0)
(-0.0693625 1.7912 0)
(0.391045 1.90058 -2.71721e-19)
(0.44326 1.99867 1.90263e-21)
(0.315473 1.47343 -2.49498e-19)
(0.2352 1.5974 6.65296e-19)
(0.317538 1.74215 1.58696e-19)
(1.02867 0.0209646 0)
(0.993656 0.0257522 0)
(1.02441 0.0618907 0)
(0.967196 -0.0446506 0)
(1.00025 -0.013436 0)
(0.928703 0.0451531 0)
(0.982206 0.117371 0)
(1.00341 0.0826487 0)
(0.991316 -0.0312817 3.39263e-18)
(1.00545 -0.0369449 -4.36271e-18)
(1.01815 0.0111366 -3.31136e-18)
(0.978154 0.0221797 4.33159e-18)
(0.859654 1.69997 0)
(0.806365 1.71978 -2.2466e-19)
(0.874038 1.56839 -3.05288e-19)
(0.9748 1.50998 4.09007e-19)
(0.876073 1.5489 2.50543e-18)
(0.85892 0.105204 1.37065e-18)
(1.11992 0.0933779 0)
(1.1513 0.227018 -2.05395e-18)
(1.11842 0.102259 -8.46425e-20)
(0.969682 0.139695 0)
(-0.649908 2.76301 6.48378e-19)
(-0.398805 2.77004 -5.97427e-19)
(-0.368737 3.1338 1.01303e-19)
(-0.373607 1.40924 1.7338e-19)
(-0.10008 2.71778 9.78407e-20)
(0.0208431 2.86855 0)
(0.0738805 2.76228 -1.28961e-19)
(-0.518769 2.75797 -1.6656e-18)
(-0.515316 2.62759 0)
(-0.0566293 3.02563 1.21651e-20)
(-0.080758 3.07847 -2.00403e-19)
(-0.0512385 3.07066 3.3093e-19)
(-0.0471678 3.09625 0)
(-0.0689862 3.01067 0)
(1.0555 1.79174 0)
(0.202709 1.08436 -1.1494e-18)
(1.08955 1.17239 4.76211e-19)
(0.927143 1.41354 0)
(0.797251 1.14891 -4.93082e-19)
(1.02322 1.12083 5.91599e-20)
(0.246516 -0.153922 -7.13815e-19)
(0.642394 0.274975 -1.1347e-20)
(0.628107 0.309809 8.41618e-19)
(0.462532 0.394684 4.85472e-20)
(0.399978 0.326477 -1.8947e-18)
(0.589127 0.391808 0)
(0.60006 0.454575 1.33555e-18)
(0.59197 0.361156 0)
(0.478299 0.371531 0)
(0.514336 0.35212 0)
(0.602338 0.731777 1.1077e-18)
(1.19573 0.250523 -1.99742e-18)
(1.15255 0.440589 0)
(1.20555 0.278691 0)
(0.767304 0.213257 1.31018e-18)
(0.623595 0.661443 -8.63112e-19)
(0.56124 0.528596 1.62318e-18)
(0.833995 0.39983 -1.84991e-18)
(0.992027 -0.00291478 2.35723e-18)
(1.00677 0.106206 -2.40645e-18)
(0.995412 0.0671578 0)
(1.0186 -0.0266427 0)
(1.0064 -0.0423025 -2.21779e-18)
(1.01014 0.0182555 2.19617e-18)
(0.978249 0.0496553 0)
(0.958902 -0.00128201 0)
(1.02665 -0.0151946 0)
(0.982181 -0.0160806 0)
(1.02503 -0.0207201 0)
(0.9805 -0.0453046 0)
(0.0816931 1.80933 0)
(0.112388 1.79459 0)
(0.0781483 1.82862 -3.25942e-19)
(0.235105 1.96145 -8.03603e-20)
(0.232845 1.92023 -2.58298e-19)
(0.159553 1.93815 3.74751e-19)
(0.0115958 1.78939 0)
(0.236594 1.72878 -4.50162e-19)
(0.0705401 1.81815 0)
(0.301264 1.7222 -2.20963e-19)
(0.221988 1.6048 9.01657e-19)
(0.252387 1.73447 3.9721e-19)
(0.186078 1.83641 -1.56619e-19)
(0.123919 1.74082 1.26807e-19)
(0.208204 1.82944 -4.91764e-19)
(0.215185 1.73777 0)
(0.238769 1.71001 3.52364e-19)
(0.0317783 1.69396 -1.70186e-19)
(0.0475077 1.7097 0)
(-0.00343173 1.72337 4.2918e-19)
(-0.034211 1.71183 0)
(0.0194751 1.7106 -3.98913e-19)
(0.00364566 1.68614 0)
(0.0378655 1.7447 -2.14166e-19)
(0.0876787 1.75186 0)
(0.0613941 1.73794 0)
(0.0381024 1.78227 2.56003e-19)
(0.0396359 1.71714 6.19519e-20)
(0.0632432 1.77157 4.46356e-19)
(0.0165763 1.70685 4.18449e-21)
(0.114955 1.67141 9.14842e-20)
(0.0664637 1.63879 8.20801e-20)
(-0.00912263 1.73415 0)
(-0.0979917 1.76912 0)
(-0.0179379 1.7448 3.45007e-19)
(-0.0723158 1.76423 4.42894e-19)
(0.0166578 1.7924 -5.22902e-19)
(-0.000930489 1.76459 0)
(0.0437009 1.72534 -3.57597e-19)
(-0.0690967 1.68788 6.54905e-20)
(-0.0319713 1.80945 -9.50508e-21)
(0.121981 1.83191 -1.06e-19)
(0.0772745 1.63869 -9.79328e-20)
(-0.031267 1.70453 3.83736e-19)
(0.991069 0.0468795 -2.34838e-18)
(0.992473 -0.0673534 2.17386e-18)
(0.986379 0.051025 0)
(0.966391 -0.0545217 3.06126e-18)
(0.910883 0.127235 -3.38685e-18)
(0.943001 0.0539845 3.65655e-18)
(0.964321 -0.0245834 -3.86079e-19)
(1.05292 -0.0724766 0)
(1.02392 -0.0173421 2.16661e-18)
(1.00637 -0.0519475 -2.15573e-18)
(0.967774 0.00388901 -1.21451e-19)
(0.985532 0.066616 1.01884e-18)
(0.962125 0.077953 0)
(0.972744 0.0800735 -3.67796e-19)
(0.983022 0.0425415 0)
(0.967882 0.0577538 0)
(1.02066 0.0816893 0)
(0.969502 0.00847778 0)
(1.02292 0.0683189 7.64781e-19)
(1.03307 0.0253148 -1.73635e-18)
(0.980297 -0.0146541 -8.05111e-19)
(1.00653 -0.000946621 -8.92419e-19)
(1.05493 0.0568778 1.72394e-18)
(1.00494 0.059821 0)
(0.979077 0.0201897 0)
(0.0331436 1.83042 -1.83104e-20)
(0.139091 1.70958 -1.67706e-20)
(0.038667 1.69708 0)
(0.0407398 1.7935 1.90346e-20)
(-0.114688 1.73355 2.73656e-20)
(-0.00527275 1.71435 -3.65222e-20)
(-0.0808309 1.77825 3.11274e-19)
(0.0384144 1.76566 -1.51591e-20)
(0.142928 1.71967 8.24493e-20)
(-0.0436658 1.76823 -1.42334e-19)
(-0.0852397 1.778 1.74162e-19)
(0.0224768 1.71181 -2.07456e-20)
(-0.0173428 1.76209 2.25078e-19)
(0.474461 1.78568 1.87552e-19)
(0.379834 1.7592 5.70009e-19)
(0.758816 1.785 2.17237e-19)
(0.59202 1.9241 -1.82944e-21)
(0.649454 1.93005 0)
(0.279387 1.45644 2.89669e-19)
(0.270508 1.42162 3.60217e-19)
(0.227956 1.49869 5.41592e-20)
(0.354897 1.52963 -1.03845e-18)
(0.363657 1.48629 9.36088e-19)
(0.288838 1.50043 0)
(0.181412 1.47049 -6.04345e-19)
(0.0723457 1.62345 1.39462e-18)
(0.157156 1.637 1.83931e-20)
(0.0334017 1.56904 -1.80934e-18)
(0.636013 1.40914 1.5987e-18)
(0.466558 1.45185 0)
(1.01356 0.0947454 7.33016e-20)
(1.00161 -0.0935472 -6.4307e-20)
(0.966355 -0.110221 -1.15004e-18)
(1.01651 0.00860616 1.12945e-18)
(0.992361 0.0579912 0)
(0.797194 1.5964 0)
(0.785798 1.59251 0)
(0.911192 1.32541 0)
(0.638447 1.40626 0)
(0.865564 1.54425 -3.03338e-21)
(0.830942 1.52445 0)
(0.580952 1.48967 1.33955e-20)
(0.463332 1.49455 0)
(0.568952 1.50041 -1.12907e-18)
(0.560487 1.47527 7.57797e-19)
(0.826515 0.118937 0)
(0.786763 0.11965 3.69996e-19)
(0.888198 0.0982709 2.25286e-18)
(0.844022 0.0912685 -8.03043e-19)
(0.841559 0.116497 -2.55312e-18)
(1.05 0.169481 -2.65152e-18)
(0.806224 0.347166 -6.18254e-20)
(0.877885 0.229517 1.98248e-18)
(0.924936 0.12542 2.00514e-18)
(0.858569 0.179349 -3.09504e-18)
(0.872505 0.260549 3.69208e-19)
(0.744171 0.297872 -9.2339e-19)
(0.826401 0.259085 0)
(0.949042 0.124752 1.48491e-18)
(0.983164 0.187638 0)
(0.968818 0.166091 0)
(1.01467 0.178957 8.62382e-19)
(0.963013 0.274184 -1.49944e-20)
(0.907388 0.144784 -4.88255e-19)
(0.983605 0.130013 0)
(0.9878 0.0581011 1.69203e-18)
(0.968316 -0.0364833 2.08862e-18)
(1.04225 0.0588412 -1.59776e-18)
(0.996302 0.0980141 -1.40971e-18)
(0.941688 -0.0187364 -2.1908e-18)
(0.911 0.187901 0)
(0.95878 0.00858586 0)
(0.907737 0.0913731 -1.30055e-18)
(0.8948 -0.0159079 4.87096e-19)
(1.01155 0.119141 1.91112e-18)
(1.0366 0.111959 -2.44781e-18)
(0.954537 0.117331 2.13644e-18)
(0.922036 0.167237 0)
(0.99618 0.126295 0)
(0.941455 0.0755238 -9.74813e-19)
(0.975983 0.0756051 -1.56466e-18)
(0.643016 1.51973 5.55743e-19)
(0.611349 1.56053 -6.03415e-19)
(0.759051 1.57713 -8.62403e-19)
(0.737192 1.76457 2.18419e-19)
(0.907646 1.60821 -2.13004e-18)
(1.0717 1.76211 5.55029e-19)
(1.07098 1.64261 -5.10811e-20)
(0.872633 1.70632 -9.01887e-19)
(0.814522 1.67115 1.34049e-18)
(0.867829 2.05952 2.54149e-19)
(1.01428 1.98932 -2.46494e-19)
(1.03256 2.00562 0)
(0.387199 1.32643 -1.24371e-19)
(-0.812563 1.74164 4.40202e-19)
(-0.292518 0.253715 5.83348e-19)
(-0.409657 0.602354 -9.20026e-20)
(0.351718 0.372893 1.07165e-18)
(0.298958 0.34765 -1.94004e-18)
(0.263152 0.370242 1.53903e-18)
(0.241533 0.283652 -3.90925e-19)
(0.346701 0.227614 9.82227e-19)
(0.742667 0.281482 -7.73617e-19)
(0.649698 0.324974 0)
(0.664402 0.262897 6.63471e-21)
(0.521853 0.481334 7.2639e-19)
(0.395222 0.530548 -2.62105e-18)
(0.360105 0.422205 -4.96836e-20)
(0.424565 0.394594 0)
(0.461147 1.00151 1.02818e-18)
(0.71784 0.939959 1.15186e-18)
(0.617913 1.08356 -1.34691e-18)
(0.703512 0.950797 -5.11657e-19)
(0.912706 0.92016 -1.67446e-19)
(0.907428 1.05045 1.72068e-19)
(0.722846 0.67299 -1.84116e-18)
(0.76327 0.929433 4.8158e-19)
(0.96229 0.833618 0)
(0.869486 0.769705 -6.74577e-19)
(0.850996 0.323292 6.21992e-19)
(1.00463 0.376635 1.0969e-18)
(1.05601 0.25619 1.06057e-18)
(0.881437 0.424599 -1.22905e-18)
(1.04474 0.362153 0)
(1.01456 0.369354 0)
(0.736779 0.424434 -1.5995e-20)
(0.767921 0.258186 0)
(0.686112 0.291403 9.29478e-19)
(0.883025 0.255508 -2.79041e-20)
(0.865643 0.494154 4.99487e-18)
(0.740655 0.536185 1.39977e-18)
(0.761132 0.501973 -1.32815e-18)
(0.712624 0.408104 1.40471e-18)
(0.661992 0.521661 8.07456e-19)
(0.613207 0.411558 -7.7758e-19)
(0.995172 0.0934084 1.83934e-18)
(0.96214 -0.0798695 0)
(0.988631 -0.0119544 1.2398e-18)
(0.904718 0.0990384 -2.77152e-18)
(1.02838 -0.0244556 1.31617e-18)
(0.970562 0.050943 -2.78889e-18)
(1.03231 -0.00744227 0)
(0.975389 -0.0373537 -5.89092e-19)
(1.00287 0.0662497 1.50203e-18)
(0.964961 0.00733229 -7.87301e-19)
(0.946521 -0.087719 5.61134e-19)
(-0.0603787 1.79058 0)
(0.190896 1.7122 0)
(0.0297611 1.78185 0)
(-0.00316059 1.82644 0)
(0.057482 1.79575 6.13703e-19)
(0.0674711 1.78175 -1.72192e-19)
(0.0722008 1.69231 -1.91877e-19)
(0.140304 1.70203 1.90788e-19)
(-0.0530215 1.74325 -5.45628e-19)
(0.0547145 1.71471 4.02026e-19)
(0.0176523 1.80337 1.8084e-20)
(0.0282261 1.76089 -4.12396e-19)
(0.00184829 1.74974 -6.71407e-20)
(0.141245 1.77752 -6.02047e-20)
(0.012017 1.68833 -4.63857e-19)
(0.0980264 1.68186 0)
(0.116486 1.71361 2.5798e-19)
(0.0139529 1.77948 1.63837e-19)
(0.142068 1.63981 -2.35717e-19)
(0.140965 1.62153 0)
(0.156285 1.58343 -9.83195e-19)
(0.150034 1.60552 7.32136e-19)
(0.176184 1.64298 -6.09669e-19)
(0.189835 1.67021 4.10172e-19)
(0.0129932 1.52167 0)
(0.0461811 1.67238 -3.7963e-19)
(-0.0103462 1.65988 -5.88369e-19)
(-0.0333888 1.64934 0)
(0.0479791 1.80321 1.0151e-20)
(0.0322618 1.76806 1.93907e-19)
(-0.00278527 1.80122 3.54631e-20)
(0.0437852 1.72908 -5.71169e-19)
(-0.00983329 1.74917 1.55284e-19)
(-0.0472433 1.66 2.11732e-19)
(0.0466482 1.79957 0)
(-0.0283681 1.84681 0)
(0.00249056 1.76416 1.89722e-19)
(0.0526349 1.7481 -6.25185e-20)
(-0.0381217 1.80548 0)
(-0.0317761 1.7855 1.30497e-19)
(0.0609398 1.74439 -2.68066e-19)
(0.952451 0.165501 0)
(1.0601 0.120716 -1.99402e-19)
(0.971925 0.0502898 -1.36853e-18)
(0.913114 0.0115207 0)
(0.950454 -0.0819236 0)
(1.05336 -0.0865308 -5.06541e-20)
(0.966886 -0.103527 2.30536e-18)
(0.971419 -0.0117521 2.73411e-18)
(0.986086 0.0015543 0)
(1.00881 -0.00852985 0)
(0.971094 -0.0296491 1.37465e-18)
(0.975056 0.0350281 0)
(0.959565 0.0783548 0)
(-0.0988865 1.8167 0)
(-0.0228071 1.65784 6.02035e-20)
(-0.0353838 1.67737 5.4883e-20)
(0.00471017 1.78268 0)
(0.142689 1.75274 1.36312e-19)
(0.0854554 1.76945 -3.07813e-20)
(0.0238898 1.75011 0)
(0.428485 1.63023 0)
(0.354813 1.56844 -1.04831e-18)
(0.371428 1.55562 0)
(0.45028 1.77361 1.18615e-18)
(0.539875 1.76436 0)
(0.523082 1.78489 -4.61653e-19)
(0.570829 1.51064 -3.52073e-20)
(0.575135 1.42397 -1.94881e-18)
(0.590238 1.42244 2.44716e-18)
(0.469529 1.42097 4.33016e-19)
(0.489835 1.45902 0)
(0.566783 1.48207 0)
(0.63012 1.43006 0)
(0.495957 1.39115 -1.64386e-18)
(0.397889 1.51941 -1.02721e-18)
(0.354793 1.47063 -2.30998e-19)
(0.456478 1.51805 1.80626e-19)
(0.367498 1.46378 0)
(0.469111 1.44916 0)
(0.435608 1.42693 -4.27031e-19)
(0.392984 1.42671 0)
(0.472495 1.49929 0)
(0.535555 1.40852 -1.28502e-18)
(0.446792 1.27118 -8.87057e-20)
(0.718309 1.51159 0)
(0.641666 1.57547 2.06058e-18)
(0.685858 1.28639 -4.29077e-19)
(0.912736 1.1847 0)
(0.760803 1.097 7.34379e-19)
(0.406283 1.48737 0)
(0.44667 1.25857 0)
(0.741083 1.50511 -8.66692e-19)
(0.711023 1.54984 -5.97895e-19)
(0.701628 1.53176 9.94087e-19)
(0.708241 1.54245 -3.18361e-19)
(0.725045 1.46695 0)
(0.690119 1.49072 4.46047e-19)
(0.769607 1.50198 -7.07408e-19)
(0.765903 1.45588 -1.88153e-20)
(0.579402 1.52468 0)
(0.578579 1.57611 -4.87515e-19)
(0.636066 1.53843 0)
(0.808255 0.171801 0)
(0.804178 0.182531 0)
(0.729603 0.20639 0)
(0.789223 0.255125 -1.4538e-18)
(0.753501 0.207403 8.01208e-19)
(0.958838 -0.0258308 -9.96555e-19)
(0.899605 0.0460267 0)
(0.880062 0.0273532 4.30283e-19)
(0.839891 0.122377 1.71355e-18)
(0.82949 0.0252668 -1.10862e-18)
(0.834228 2.31115 1.05559e-19)
(0.852348 2.13669 0)
(0.790358 2.39021 2.03017e-19)
(0.151581 2.50261 -1.75541e-19)
(0.32809 2.08551 -7.01905e-19)
(0.16277 1.50725 1.4797e-18)
(0.243966 1.55 0)
(-0.146053 0.829999 -2.43294e-19)
(-0.0279476 1.01901 1.83696e-18)
(-0.233974 0.496793 -3.20894e-19)
(0.12526 0.48497 3.75847e-19)
(0.392159 0.533128 9.42205e-19)
(0.550699 0.535403 0)
(0.242457 0.775381 0)
(0.152682 0.720674 0)
(0.842687 0.729746 5.37721e-19)
(0.780799 0.555979 -1.34138e-18)
(0.868747 0.63368 1.13052e-18)
(0.820481 0.49239 -1.04476e-18)
(1.01783 0.614156 0)
(0.958752 0.65019 -3.44394e-19)
(0.756401 0.342793 -1.86907e-18)
(0.729727 0.306564 -2.32199e-18)
(0.616818 0.446556 1.47838e-18)
(0.653909 0.384628 -1.41509e-18)
(0.750029 0.333599 -1.10222e-18)
(0.715077 0.328963 1.39615e-18)
(1.03051 -0.00457734 -1.39699e-18)
(1.05508 0.0207754 2.90745e-18)
(1.04609 0.0694427 1.76891e-18)
(1.05491 -0.0581589 -2.11848e-18)
(0.852142 0.00425515 0)
(0.833288 -0.0130614 -3.64048e-18)
(0.100318 1.68963 1.18964e-19)
(-0.00959802 1.73445 0)
(0.118369 1.77028 7.27454e-19)
(0.0408227 1.73055 -6.50383e-19)
(0.0552873 1.71934 3.58606e-19)
(0.0780365 1.79198 0)
(0.0815258 1.8267 0)
(0.0406197 1.71379 -6.9203e-20)
(-0.000941761 1.58997 6.18939e-20)
(0.0756591 1.61113 1.15013e-20)
(-0.168803 1.78895 -1.27671e-19)
(0.0245966 1.71685 7.90751e-20)
(0.531209 1.59744 -1.41049e-18)
(0.573427 1.61337 1.50697e-18)
(0.46769 1.6983 -6.87231e-19)
(0.607181 1.62007 6.81004e-20)
(0.621141 1.69126 0)
(0.592927 1.76882 -4.30403e-19)
(0.546298 1.75772 4.3457e-19)
(0.556456 1.70273 6.49828e-19)
(0.612 1.72313 0)
(0.650169 1.62281 0)
(0.547762 1.45057 1.53774e-18)
(0.253802 1.5214 2.19096e-18)
(0.264725 1.49086 -1.46725e-18)
(0.222149 1.52858 -2.47461e-19)
(0.360572 1.46819 5.25346e-19)
(0.250752 1.42902 -1.23112e-18)
(0.613096 1.44823 -1.36389e-18)
(0.726799 1.46323 0)
(0.627147 1.42289 -1.5361e-18)
(0.682111 1.46846 0)
(0.687535 1.50188 0)
(0.490375 1.84886 -8.80305e-19)
(0.50733 2.00525 -6.74553e-19)
(0.406878 2.05015 8.28959e-19)
(-0.568355 1.52636 0)
(-0.365617 1.45716 -7.28436e-19)
(0.00578438 1.56964 -9.63208e-19)
(0.348085 1.77037 0)
(0.0448416 2.16299 4.94552e-19)
(-0.302396 2.19425 0)
(0.469577 0.901664 -2.15812e-18)
(0.619509 0.93193 2.87654e-18)
(0.66482 0.737938 -2.74212e-18)
(0.331813 0.738308 -2.5663e-19)
(0.439705 0.710382 -1.01733e-18)
(0.565986 1.80825 4.9605e-19)
(0.635092 1.70812 -1.17261e-18)
(0.523818 1.83806 1.4812e-18)
(0.522298 1.73429 -9.97132e-19)
(0.603463 1.58982 -1.40883e-18)
(0.635771 1.70588 -1.1441e-19)
(0.666338 1.66141 1.18208e-18)
(0.534158 1.68779 8.83076e-20)
(0.536802 1.57217 6.32662e-19)
)
;
boundaryField
{
wall-4
{
type noSlip;
}
velocity-inlet-5
{
type fixedValue;
value uniform (1 0 0);
}
velocity-inlet-6
{
type fixedValue;
value uniform (0 3 0);
}
pressure-outlet-7
{
type zeroGradient;
}
wall-8
{
type noSlip;
}
frontAndBackPlanes
{
type empty;
}
}
// ************************************************************************* //
| [
"marmar.m@gmail.com"
] | marmar.m@gmail.com | |
28b9b1083a59884a8c4ba8ef2b7e9c250427a884 | 2667a2344ad0e01f6daa396ad282aa7519a13eea | /Codificacao.cpp | c65c751ddadf26de3da872964808cfe2147b0af7 | [] | no_license | Italoko/Codificacao-Huffman | c7dbf294410ac78d758d7cc839c46c90ce60a8fa | fe0f8d0eb0ffdbcef639faca9bf41070642aa0ab | refs/heads/main | 2023-06-02T06:34:00.411862 | 2021-06-17T23:48:32 | 2021-06-17T23:48:32 | 377,983,642 | 0 | 0 | null | null | null | null | ISO-8859-1 | C++ | false | false | 5,194 | cpp | #include<stdio.h>
#include<stdlib.h>
#include<string.h>
#define TAM_PALA 10
#define TAM_CODIGO 10
#define TAM_CODIFICACAO 256
#define ARQ_TAB "TabFreq.dat"
#define ARQ_CODIGO "Codigo Huffman.txt"
/*
ALUNO: ITALO CESAR PIOVAN ROCHA
*/
///ESTRUTURAS
struct Tabela
{
char palavra[TAM_PALA],huffman[TAM_CODIGO];
int frequencia,simbolo;
};typedef struct Tabela tab;
struct Tree
{
int simbolo;
int freq;
Tree *esq,*dir;
};typedef struct Tree tree;
struct ListaFreq
{
Tree *no;
ListaFreq *prox;
};
typedef ListaFreq listafreq;
/// FIM ESTRUTURAS
void init(listafreq **lf,Tree **t)
{
*t = NULL;
*lf = NULL;
}
char isEmpty(listafreq *lf)
{
return lf == NULL;
}
Tree *CriaNO(int simbolo,int freq,Tree *esq,Tree *dir)
{
Tree *no = (Tree*)malloc(sizeof(Tree));
no->esq = esq;
no->dir = dir;
no->freq = freq;
no->simbolo = simbolo;
return no;
}
void Insere(listafreq **lf,Tree *no)
{
listafreq *aux;
listafreq *nova = (listafreq*)malloc(sizeof(listafreq));
nova->no = no;
nova->prox = NULL;
if(isEmpty(*lf))
*lf = nova;
else
{
if(no->freq < (*lf)->no->freq)
{
nova->prox = *lf;
(*lf) = nova;
}
else
{
aux = *lf;
while(aux->prox != NULL && aux->prox->no->freq < no->freq)
aux = aux->prox;
nova->prox = aux->prox;
aux->prox = nova;
}
}
}
void Remove(listafreq **lf,Tree **no)
{
listafreq *aux = *lf;
if(!isEmpty(*lf))
{
*no = (*lf)->no;
*lf =(*lf)->prox;
free(aux);
}
}
int BuscaPalavra(Tabela t[],char pala[],int tam,int simbolo)
{
int i=0;
if(simbolo == -1)// procura pelo simbolo
while(i < tam && strcmp(t[i].palavra,pala) != 0)
i++;
else // procura pela palavra
while(i < tam && t[i].simbolo != simbolo)
i++;
if(!strcmp(t[i].palavra,pala) || simbolo == t[i].simbolo)
return i;
else
return -1;
}
int getEspaco(char texto[]) // retorna quantidade de espaços, consequentemente a quantidade de palavras.
{ // usado para inicializar a tabela de frequencia, e aproveitando a frequência de espaço
int espaco=0;
for(int i=0;i <= strlen(texto);i++)
if(texto[i] == ' ')
espaco++;
return espaco;
}
void SeparaPalavras(char texto[],Tabela *t,int *TL)
{
int i=0,letra=0,pos=-1,j=0;
char palavra[TAM_PALA]="";
while(i <= strlen(texto)) // percorre texto inteiro
{
while(texto[i] != ' ' && i < strlen(texto))
palavra[letra++] = texto[i++]; // gera palavras
palavra[letra] = '\0';
pos = BuscaPalavra(t,palavra,j,-1); // busca palavra se ja existe
if(pos > -1)
t[pos].frequencia++; // se existir, incrementa frequencia
else // se não existir, add com frequencia 1
{
t[j].frequencia=1;
t[j].simbolo = j;
strcpy(t[j].palavra,palavra);
strcpy(t[j].huffman,"");
j++;
}
i++;
letra = 0; strcpy(palavra,""); // "zera" var palavra
}
// add o espaço na tabela de palavras e sua frequência...
t[j].frequencia=getEspaco(texto);
t[j].simbolo = j;
strcpy(t[j].palavra," ");
strcpy(t[j].huffman,"");
j++;
*TL = j;
}
void GeraTree(Tree **raiz,listafreq **lf)
{
Tree *esq,*dir,*no;
*raiz = esq = dir = NULL;
while((*lf)->prox != NULL)
{
Remove(&*lf,&dir);
Remove(&*lf,&esq);
no = CriaNO(-1,esq->freq + dir->freq,esq,dir);
Insere(&*lf,no);
}
*raiz = no;
}
void GeraHuffman(Tree *raiz, int tl,char *cod,tab *t,int tam)
{
if(raiz->esq != NULL && raiz->dir != NULL)
{
cod[tl] = '0';cod[tl+1] = '\0';
GeraHuffman(raiz->esq,tl+1,&*cod,&*t,tam);
cod[tl] = '1';cod[tl+1] = '\0';
GeraHuffman(raiz->dir,tl+1,&*cod,&*t,tam);
}
else
strcpy(t[BuscaPalavra(t,"",tam,raiz->simbolo)].huffman,cod);
}
void GravaArquivoTab(Tabela t[],int TL)
{
FILE *ptr = fopen(ARQ_TAB,"wb");
for(int i=0;i< TL ;i++)
fwrite(&t[i],sizeof(Tabela),1,ptr);
fclose(ptr);
}
void GravaArquivoCod(Tabela t[],int TL,char texto[])
{
int i =0,letra =0;
char palavra[TAM_PALA]="",codigo[TAM_CODIFICACAO]="";
FILE *ptr = fopen(ARQ_CODIGO,"w");
while(i <= strlen(texto))
{
while(texto[i] != ' ' && i < strlen(texto))
palavra[letra++] = texto[i++];
palavra[letra] = '\0';
strcat(codigo,t[BuscaPalavra(t,palavra,TL,-1)].huffman);
if(texto[i] == ' ')
strcat(codigo,t[BuscaPalavra(t," ",TL,-1)].huffman);
i++; letra = 0; strcpy(palavra,"");
}
fputs(codigo,ptr);
fclose(ptr);
}
void Codifica(Tabela *t,int TL,char texto[])
{
listafreq *lf;
Tree *raiz;
char codigo[TAM_CODIGO];
init(&lf,&raiz);
char pala[TAM_PALA];
int freq;
for(int i=0;i< TL ;i++)
Insere(&lf,CriaNO(t[i].simbolo,t[i].frequencia,NULL,NULL));
GeraTree(&raiz,&lf);
GeraHuffman(raiz,0,codigo,t,TL);
GravaArquivoTab(t,TL);
GravaArquivoCod(t,TL,texto);
}
int main()
{
int TL=0;
char texto[] = "eu quero amor eu quero alegria eu quero calor eu quero fantasia";
//"amo como ama o amor nao conheco nenhuma outra razao para amar senao amar que queres que te diga alem de que te amo se o que quero dizer te e que te amo";
//"vi uma estrela tao alta vi uma estrela tao fria vi uma estrela luzindo na minha vida vazia era uma estrela tao alta era uma estrela tao fria era uma estrela sozinha luzindo no fim do dia";
Tabela t[getEspaco(texto)];
SeparaPalavras(texto,t,&TL);
Codifica(t,TL,texto);
}
| [
"italo_piovan@hotmail.com"
] | italo_piovan@hotmail.com |
5f1d535038f4c56c7c8e28449d759c6776c9ca3d | 5c702e1221254bfe9f6328a47bff3978f178442d | /homeworkI/service.h | 61e2d4ea5a0951e052ecc3056a80a78ac0d6a535 | [] | no_license | alexclapou/oop | 841abb27d3b15f47cdcc38089e4f44aefb8cdf26 | 15e2cc1b93347d69fa4ba5d92ce551f48d758131 | refs/heads/master | 2022-11-06T12:26:45.880307 | 2020-06-20T21:21:26 | 2020-06-20T21:21:26 | 244,117,352 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 204 | h | #pragma once
#include "repository.h"
class Service{
private:
Repository repository;
public:
void add(Aircraft aircraft);
std::vector<Aircraft> get_list_of_aircrafts();
};
| [
"alex.clapou@yahoo.com"
] | alex.clapou@yahoo.com |
49c19d58fea9d2168dd2c25f8615b4aeb6ff2b25 | 68a3ae109be40d9eac9db27384139539264ba26f | /SuperArray.h | 1392aa15bcf9708435ef856eaa4371282f086610 | [] | no_license | TheRealChozoElder/superArray | 30907ed30bf56a34d0e65629fe05c8f773addc45 | 842526cc2d103549801687768572625fdac61d46 | refs/heads/master | 2021-04-03T05:16:31.587458 | 2018-03-15T18:58:51 | 2018-03-15T18:58:51 | 125,094,715 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 696 | h | // File: SuperArray
// Created by Hugo Valle on 10/31/2017.
// Copyright (c) 2017 WSU
//
#ifndef HW6_SUPERARRAY_H
#define HW6_SUPERARRAY_H
#include <iostream>
#include <string>
#include <sstream>
using namespace std;
class SuperArray
{
private:
int *arr; // int pointer for you array
int lowIndex; // low index (user's view)
int highIndex; // high index (user's view)
int capacity; // array capacity
public:
//class OptIndexEx{}; // Exception class for operator
SuperArray(const int begIndex, const unsigned int capacity);
virtual ~SuperArray(); /* destructor */
int &operator[](const int index);
friend string arrayToString(const SuperArray& s);
};
#endif //HW6_SUPERARRAY_H
| [
"nathanbeach@mail.weber.edu"
] | nathanbeach@mail.weber.edu |
d900bf7af9617ee7f23b3a9c72369b6dc6ca6a82 | 3cf9e141cc8fee9d490224741297d3eca3f5feff | /C++ Benchmark Programs/Benchmark Files 1/classtester/autogen-sources/source-10985.cpp | 622e332d97fabc39d6351b17d5bcec1b070f2639 | [] | no_license | TeamVault/tauCFI | e0ac60b8106fc1bb9874adc515fc01672b775123 | e677d8cc7acd0b1dd0ac0212ff8362fcd4178c10 | refs/heads/master | 2023-05-30T20:57:13.450360 | 2021-06-14T09:10:24 | 2021-06-14T09:10:24 | 154,563,655 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 2,599 | cpp | struct c0;
void __attribute__ ((noinline)) tester0(c0* p);
struct c0
{
bool active0;
c0() : active0(true) {}
virtual ~c0()
{
tester0(this);
active0 = false;
}
virtual void f0(){}
};
void __attribute__ ((noinline)) tester0(c0* p)
{
p->f0();
}
struct c1;
void __attribute__ ((noinline)) tester1(c1* p);
struct c1
{
bool active1;
c1() : active1(true) {}
virtual ~c1()
{
tester1(this);
active1 = false;
}
virtual void f1(){}
};
void __attribute__ ((noinline)) tester1(c1* p)
{
p->f1();
}
struct c2;
void __attribute__ ((noinline)) tester2(c2* p);
struct c2 : virtual c1
{
bool active2;
c2() : active2(true) {}
virtual ~c2()
{
tester2(this);
c1 *p1_0 = (c1*)(c2*)(this);
tester1(p1_0);
active2 = false;
}
virtual void f2(){}
};
void __attribute__ ((noinline)) tester2(c2* p)
{
p->f2();
if (p->active1)
p->f1();
}
struct c3;
void __attribute__ ((noinline)) tester3(c3* p);
struct c3 : c1, c0
{
bool active3;
c3() : active3(true) {}
virtual ~c3()
{
tester3(this);
c0 *p0_0 = (c0*)(c3*)(this);
tester0(p0_0);
c1 *p1_0 = (c1*)(c3*)(this);
tester1(p1_0);
active3 = false;
}
virtual void f3(){}
};
void __attribute__ ((noinline)) tester3(c3* p)
{
p->f3();
if (p->active0)
p->f0();
if (p->active1)
p->f1();
}
struct c4;
void __attribute__ ((noinline)) tester4(c4* p);
struct c4 : virtual c0, virtual c2, virtual c1
{
bool active4;
c4() : active4(true) {}
virtual ~c4()
{
tester4(this);
c0 *p0_0 = (c0*)(c4*)(this);
tester0(p0_0);
c1 *p1_0 = (c1*)(c2*)(c4*)(this);
tester1(p1_0);
c1 *p1_1 = (c1*)(c4*)(this);
tester1(p1_1);
c2 *p2_0 = (c2*)(c4*)(this);
tester2(p2_0);
active4 = false;
}
virtual void f4(){}
};
void __attribute__ ((noinline)) tester4(c4* p)
{
p->f4();
if (p->active0)
p->f0();
if (p->active1)
p->f1();
if (p->active2)
p->f2();
}
int __attribute__ ((noinline)) inc(int v) {return ++v;}
int main()
{
c0* ptrs0[25];
ptrs0[0] = (c0*)(new c0());
ptrs0[1] = (c0*)(c3*)(new c3());
ptrs0[2] = (c0*)(c4*)(new c4());
for (int i=0;i<3;i=inc(i))
{
tester0(ptrs0[i]);
delete ptrs0[i];
}
c1* ptrs1[25];
ptrs1[0] = (c1*)(new c1());
ptrs1[1] = (c1*)(c2*)(new c2());
ptrs1[2] = (c1*)(c3*)(new c3());
ptrs1[3] = (c1*)(c2*)(c4*)(new c4());
ptrs1[4] = (c1*)(c4*)(new c4());
for (int i=0;i<5;i=inc(i))
{
tester1(ptrs1[i]);
delete ptrs1[i];
}
c2* ptrs2[25];
ptrs2[0] = (c2*)(new c2());
ptrs2[1] = (c2*)(c4*)(new c4());
for (int i=0;i<2;i=inc(i))
{
tester2(ptrs2[i]);
delete ptrs2[i];
}
c3* ptrs3[25];
ptrs3[0] = (c3*)(new c3());
for (int i=0;i<1;i=inc(i))
{
tester3(ptrs3[i]);
delete ptrs3[i];
}
c4* ptrs4[25];
ptrs4[0] = (c4*)(new c4());
for (int i=0;i<1;i=inc(i))
{
tester4(ptrs4[i]);
delete ptrs4[i];
}
return 0;
}
| [
"ga72foq@mytum.de"
] | ga72foq@mytum.de |
27a5d3dbba77e2b58981824643aceccc57bfe3ec | 6f6e56aaa50e3db9194e4dc135f47c7e183e2f30 | /pp3/ast_stmt.h | b88a6eb3eb105a88fabf726467fd5d3c9745ba0c | [] | no_license | NonlinearTime/DecafCompiler | 2b026ba6fae1cf0302f5ec952f797a0dfa73ddfc | fe4f83f8ee4f099f8e6833523bbb4f667d43d364 | refs/heads/master | 2020-03-19T05:48:17.650521 | 2018-06-08T13:44:23 | 2018-06-08T13:44:23 | 135,963,265 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,438 | h | /* File: ast_stmt.h
* ----------------
* The Stmt class and its subclasses are used to represent
* statements in the parse tree. For each statment in the
* language (for, if, return, etc.) there is a corresponding
* node class for that construct.
*
* pp3: You will need to extend the Stmt classes to implement
* semantic analysis for rules pertaining to statements.
*/
#ifndef _H_ast_stmt
#define _H_ast_stmt
#include "list.h"
#include "ast.h"
#include "ast_signaltable.h"
class Decl;
class VarDecl;
class Expr;
class Program : public Node
{
protected:
List<Decl*> *decls;
public:
Program(List<Decl*> *declList);
static SignalTable *gStable;
void Check();
};
class Stmt : public Node
{
public:
Stmt() : Node() {sTable = new SignalTable;}
Stmt(yyltype loc) : Node(loc) {sTable = new SignalTable;}
SignalTable *sTable;
virtual void creatStable() = 0;
virtual bool check() = 0;
};
class StmtBlock : public Stmt
{
protected:
List<VarDecl*> *decls;
List<Stmt*> *stmts;
public:
StmtBlock(List<VarDecl*> *variableDeclarations, List<Stmt*> *statements);
void creatStable();
bool check();
};
class ConditionalStmt : public Stmt
{
protected:
Expr *test;
Stmt *body;
public:
ConditionalStmt(Expr *testExpr, Stmt *body);
virtual void creatStable() = 0;
virtual bool check() = 0;
};
class LoopStmt : public ConditionalStmt
{
public:
LoopStmt(Expr *testExpr, Stmt *body)
: ConditionalStmt(testExpr, body) {}
virtual void creatStable() = 0;
virtual bool check() = 0;
};
class ForStmt : public LoopStmt
{
protected:
Expr *init, *step;
public:
ForStmt(Expr *init, Expr *test, Expr *step, Stmt *body);
void creatStable() ;
bool check();
};
class WhileStmt : public LoopStmt
{
public:
WhileStmt(Expr *test, Stmt *body) : LoopStmt(test, body) {}
void creatStable();
bool check();
};
class IfStmt : public ConditionalStmt
{
protected:
Stmt *elseBody;
public:
IfStmt(Expr *test, Stmt *thenBody, Stmt *elseBody);
void creatStable();
bool check();
};
class CaseStmt : public Stmt
{
protected:
Expr *label;
List<Stmt*> *stmtList;
public:
CaseStmt(Expr *l, List<Stmt*> *stmtL);
void creatStable();
bool check() {return true;}
};
class DefaultStmt : public Stmt
{
protected:
List<Stmt*> *stmtList;
public:
DefaultStmt(List<Stmt*> *stmtL);
void creatStable();
bool check();
};
class SwitchStmt : public Stmt
{
protected:
Expr *expr;
List<CaseStmt*> *caseList;
DefaultStmt *defaultStmt;
public:
SwitchStmt(Expr *e, List<CaseStmt*> *caseL, DefaultStmt *Ds);
void creatStable();
bool check();
};
class BreakStmt : public Stmt
{
public:
BreakStmt(yyltype loc) : Stmt(loc) {}
void creatStable();
bool check() {return true;}
};
class ReturnStmt : public Stmt
{
protected:
Expr *expr;
public:
ReturnStmt(yyltype loc, Expr *expr);
void creatStable();
bool check();
};
class PrintStmt : public Stmt
{
protected:
List<Expr*> *args;
public:
PrintStmt(List<Expr*> *arguments);
void creatStable();
bool check();
};
#endif
| [
"hainesluo@gmail.com"
] | hainesluo@gmail.com |
8c13b0b0b636cef0f69f0679bbb5bd37cd77f82f | 0a8f7a182843e621e05e256dca66fb38eb92cd63 | /2145Z Center Goal/include/robot-config.h | e2b70da22f8865b9ad8ca80271f4d5004fc1965a | [] | no_license | dchoi2145/2145Z_Code | aa4c961838f652a70a8e2cf41051eb052ec4b09a | 9ce2ca5a5f26fd3bf00fadd0cb606c983eefb730 | refs/heads/main | 2023-05-04T03:11:03.536217 | 2021-03-15T02:16:51 | 2021-03-15T02:16:51 | 309,507,521 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 631 | h | using namespace vex;
extern brain Brain;
extern motor FR;
extern motor FL;
extern motor BL;
extern motor BR;
extern motor RightRoller;
extern motor LeftRoller;
extern motor Conveyor1;
extern motor Conveyor2;
extern controller Controller1;
extern inertial inertial_gyro;
extern encoder tracker;
extern line ballDetector1;
extern line ballDetector2;
extern line ballDetector3;
extern optical optical1;
extern limit limit1;
/**
* Used to initialize code/tasks/devices added using tools in VEXcode Pro.
*
* This should be called at the start of your int main function.
*/
void vexcodeInit(void);
| [
"noreply@github.com"
] | noreply@github.com |
e26de08bde1057f0f3fda3d8bbc3c4f0fafb56ff | 99eba6b9d3ce45d73d41502c55df0be282b4f4a3 | /OnlineJudge/Euler/old/mazemake.cpp | c996746fc6933ed40c62cac6753bc9c3ba59310b | [] | no_license | hajindvlp/Algorithm | ad7268b468c162bb9244d09b7c7f269c61bcacf9 | f9b4b530a177013f386d4f7f1f038c006ccbd9f0 | refs/heads/master | 2021-06-28T21:13:25.849062 | 2020-11-06T10:14:02 | 2020-11-06T10:14:02 | 172,189,561 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,341 | cpp | #include <stdio.h>
#include <queue>
#define INF 100000000
using namespace std;
queue<int> Q;
int n, a[51][51];
int d[51][51], h[51][51], visit[51][51];
int dy[4] = {0, 1, 0, -1}, dx[4] = {1, 0, -1, 0};
int main()
{
char tmp[51];
int i, j;
int yy, xx, ty, tx, cnt;
scanf("%d", &n);
for(i=1 ; i<=n ; i++)
{
scanf("%s", &tmp[1]);
for(j=1 ; j<=n ; j++)
a[i][j] = 1-(tmp[j]-'0'), d[i][j] = h[i][j] = INF;
}
d[1][1] = 0;
h[1][1] = 0;
Q.push(1);
Q.push(1);
Q.push(0);
while(!Q.empty())
{
yy = Q.front();
Q.pop();
xx = Q.front();
Q.pop();
cnt = Q.front();
Q.pop();
for(i=0 ; i<=3 ; i++)
{
ty = yy+dy[i];
tx = xx+dx[i];
if(ty>0 && ty<=n && tx>0 && tx<=n)
{
if(a[yy][xx] == 0)
{
if(visit[ty][tx] == 0 || h[ty][tx]>cnt)
{
d[ty][tx] = d[yy][xx]+1;
h[ty][tx] = cnt;
visit[ty][tx] = 1;
Q.push(ty);
Q.push(tx);
Q.push(cnt);
}
else if(visit[ty][tx] == 1 && h[ty][tx] == cnt && d[ty][tx]>d[yy][xx]+1)
{
d[ty][tx] = d[yy][xx]+1;
Q.push(ty);
Q.push(tx);
Q.push(cnt);
}
}
else
{
if(visit[ty][tx] == 0 || h[ty][tx]>cnt+1)
{
d[ty][tx] = d[yy][xx]+1;
h[ty][tx] = cnt+1;
visit[ty][tx] = 1;
Q.push(ty);
Q.push(tx);
Q.push(cnt+1);
}
else if(visit[ty][tx] == 1 && h[ty][tx] == cnt+1 && d[ty][tx]>d[yy][xx]+1)
{
d[ty][tx] = d[yy][xx]+1;
Q.push(ty);
Q.push(tx);
Q.push(cnt+1);
}
}
}
}
}
printf("%d", h[n][n]);
return 0;
}
| [
"harryhajinchung@gmail.com"
] | harryhajinchung@gmail.com |
dfdb3f1b9acd2c038e5e2beeee30f8b6daa38e1f | eef2a60bb909f9f077e6bf72af54666d10ffd686 | /DX11_Base/src/dx/dx11/ViewPort.h | d663a8a990acec3f6a37dd6a52b9055eaebcba6d | [
"MIT"
] | permissive | futamase/DX11_lib | 94df35a7e05c8644fde6bd0fdb52ca9da362a572 | b7f979565b6fb94a4eeca45aa390620e951b8595 | refs/heads/master | 2020-04-26T18:17:41.477333 | 2019-03-04T12:42:57 | 2019-03-04T12:42:57 | 173,740,539 | 0 | 0 | null | null | null | null | SHIFT_JIS | C++ | false | false | 641 | h | #pragma once
#include <vector>
#include <d3d11.h>
namespace tama
{
/**@ビューポートの分割モード*/
enum class DevideMode
{
Horizontally, //!水平に分割
Vertically //!垂直に分割
};
/**@brief ビューポート作成クラス
*@atention 分割数とカメラの数は一致していなければならない
*/
class Viewport
{
std::vector<D3D11_VIEWPORT> m_vps;
public:
/**@brief コンストラクタ
*@attention 1~4しか認めない*/
Viewport(unsigned int width, unsigned int height, unsigned int num, DevideMode mode);
unsigned int size() const;
const D3D11_VIEWPORT* data() const;
};
} | [
"misoni.s.8989@gmail.com"
] | misoni.s.8989@gmail.com |
b763c8c340a4f29beb99abf836e1778f2d48a246 | 78e241cb1232ec46909ff3d350e80f25026d2ad8 | /Source/Headers/InputManager.hpp | 14e2ede4df2a8b5e9f1886a0884dbae90575e64a | [] | no_license | DennisVinke/LED_Matrix | f16eb7262998933340a3be38256212e0c2cab510 | 592d2abc7cf14e37e8447ac4c618902e87db80a8 | refs/heads/master | 2022-03-31T21:00:33.168470 | 2020-02-04T18:56:35 | 2020-02-04T18:56:35 | 221,912,432 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 633 | hpp | #pragma once
#include "wiringPi.h"
constexpr unsigned UP = 0;
constexpr unsigned DOWN = 1;
constexpr unsigned LEFT = 2;
constexpr unsigned RIGHT = 3;
constexpr unsigned FIRE1 = 4;
constexpr unsigned FIRE2 = 5;
constexpr unsigned AMOUNT_OF_BUTTONS = 6;
class InputManager {
public:
InputManager();
~InputManager();
void updateButtonStates();
bool getState(unsigned index);
private:
void setupButtons();
bool buttonStates[6] = { false, false, false, false, false, false };
const int buttons_piloc[6] = { 35, 36, 37, 38, 31, 32 }; //Pi pin locations
const int buttons[6] = { 24, 27, 25, 28, 22, 26 }; //WiPi pin locations
}; | [
"d.vinke@student.utwente.nl"
] | d.vinke@student.utwente.nl |
747eeaee98bffbb7267379141102b5decc2e5f87 | fbdbfe4dc5aa86ba008452e5043ee7e1e3c04a7a | /find-anagram-mappings.cpp | e0da8ecb57f115a2ca76a45b87ab1232267ba689 | [] | no_license | mirabl/j | 0a7c01122eef06dc9517dd3832f682eb480e1de7 | c6b0b9f39b0a866931731816dccc5dfb476aac8d | refs/heads/master | 2021-01-12T06:35:54.500937 | 2019-12-02T06:08:22 | 2019-12-02T06:08:22 | 77,385,377 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 773 | cpp | class Solution {
public:
vector<int> anagramMappings(vector<int>& A, vector<int>& B) {
vector<int> res;
for (int x: A) {
for (int i = 0; i < B.size(); i++) {
if (B[i] == x) {
res.push_back(i);
B[i] = -1;
break;
}
}
}
return res;
}
};
class Solution {
public:
vector<int> anagramMappings(vector<int>& A, vector<int>& B) {
vector<int> res;
unordered_map<int, vector<int>> M;
for (int i = 0; i < B.size(); i++) {
M[B[i]].push_back(i);
}
for (int x: A) {
res.push_back(M[x].back());
M[x].pop_back();
}
return res;
}
};
| [
"a@a.com"
] | a@a.com |
b858b342513d291c226219732929d5167a8b2242 | 77ff0d5fe2ec8057f465a3dd874d36c31e20b889 | /problems/yukicoder/No0090.cpp | c4b3710ea29cd6a96cf540745819bbe96dec49b2 | [] | no_license | kei1107/algorithm | cc4ff5fe6bc52ccb037966fae5af00c789b217cc | ddf5911d6678d8b110d42957f15852bcd8fef30c | refs/heads/master | 2021-11-23T08:34:48.672024 | 2021-11-06T13:33:29 | 2021-11-06T13:33:29 | 105,986,370 | 2 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 2,429 | cpp | #include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;
template<class S,class T> ostream& operator << (ostream& out,const pair<S,T>& o){ out << "(" << o.first << "," << o.second << ")"; return out; }
template<class T> ostream& operator << (ostream& out,const vector<T> V){ for(int i = 0; i < V.size(); i++){ out << V[i]; if(i!=V.size()-1) out << " ";} return out; }
template<class T> ostream& operator << (ostream& out,const vector<vector<T> > Mat){ for(int i = 0; i < Mat.size(); i++) { if(i != 0) out << endl; out << Mat[i];} return out; }
template<class S,class T> ostream& operator << (ostream& out,const map<S,T> mp){ out << "{ "; for(auto it = mp.begin(); it != mp.end(); it++){ out << it->first << ":" << it->second; if(mp.size()-1 != distance(mp.begin(),it)) out << ", "; } out << " }"; return out; }
/*
<url:https://yukicoder.me/problems/no/90>
問題文============================================================
ここに0番〜(N-1)番の品物がある。
また、
item1 item2 score
という形式で書かれた得点表がある。
品物を並べた時、item1がitem2よりも前であればscore点を獲得できるという意味である。
得点表が与えられるので、品物を適切に並び替えた時、獲得できる得点を最大化したい。そのときの得点を出力せよ。
=================================================================
解説=============================================================
Nの制約が小さいのでパターンを全列挙できる
O(N!*N)
十分間に合う
================================================================
*/
ll solve(){
ll res = 0;
ll N,M; cin >> N >> M;
vector<ll> item1(M),item2(M),score(M);
for(int i = 0; i < M;i++) cin >> item1[i] >> item2[i] >> score[i];
vector<ll> per(N,0);
vector<ll> rank(N,0);
iota(per.begin(),per.end(),0);
do{
ll score_sum = 0;
for(int i = 0; i < N;i++) rank[per[i]] = i;
for(int i = 0; i < M;i++){
if(rank[item1[i]] < rank[item2[i]]) score_sum += score[i];
}
res = max(res,score_sum);
}while(next_permutation(per.begin(),per.end()));
return res;
}
int main(void) {
cin.tie(0); ios_base::sync_with_stdio(false);
cout << solve() << endl;
return 0;
}
| [
"clavis1107@gmail.com"
] | clavis1107@gmail.com |
412185efcbb61579debbf5582e3118e1267118c7 | e2081c2c2ac4d0c2b48abde3b58f1f177f5f7379 | /SEM 7/Principles of Programming Languages/U17CO110_11_11/Q5.cpp | f53409150dc4e455fb063cab6e709127cb5ca27d | [] | no_license | Himified/College-Material-And-Assignments | 6af9826e4d49e759e89c6c8bd68f621eb8b3602f | 763627d77ba9b10daa241d454b7e238d9f50c68f | refs/heads/main | 2023-04-21T17:39:11.618679 | 2021-05-09T13:35:41 | 2021-05-09T13:35:41 | 365,735,167 | 1 | 0 | null | 2021-05-09T11:22:53 | 2021-05-09T11:22:52 | null | UTF-8 | C++ | false | false | 3,216 | cpp | #include <bits/stdc++.h>
using namespace std;
class License
{
string LNo, Name, Address;
public:
License() = default;
License(string lNo, string name, string address)
{
this->LNo = move(lNo);
this->Name = name;
this->Address = move(address);
}
};
int main()
{
int n;
string lno, name, address;
ofstream outputFileName;
outputFileName.open("License.txt");
cout << ".....INITIAL CREATING FILE.....\n";
cout << "Enter total number of license: " << endl;
cin >> n;
// CREATING THE FILE
vector<License> licenseList;
for (int i = 0; i < n; i++)
{
cout << "Enter License No: " << endl;
cin >> lno;
cout << "Enter Name: " << endl;
cin.ignore();
getline(cin, name);
cout << "Enter Address: " << endl;
getline(cin, address);
outputFileName << lno << "\n";
outputFileName << name << "\n";
outputFileName << address << "\n";
licenseList.emplace_back(License(lno, name, address));
}
outputFileName.close();
// SEARCH FOR NAME BASED ON LICENSE NUMBER
cout << ".....SEARCH FOR NAME BASED ON LICENSE NUMBER.....\n";
string targetLicNo;
bool isFound = false;
cout << "Enter License No: ";
cin >> targetLicNo;
ifstream inputFileName;
inputFileName.open("License.txt");
while (getline(inputFileName, lno) && getline(inputFileName, name) && getline(inputFileName, address))
{
if (lno == targetLicNo)
{
cout << "MATCH FOUND!! NAME OF LICENSE HOLDER: " << name << endl;
isFound = true;
break;
}
}
if (!isFound)
cout << "Sorry no match found\n";
inputFileName.close();
// SEARCING BASED ON NAME OF PERSON
cout << ".....SEARCH FOR LICENSE NUMBER BASED ON NAME.....\n";
inputFileName.open("License.txt");
isFound = false;
string targetName;
cout << "Enter Name of License Holder: ";
cin.ignore();
getline(cin, targetName);
while (getline(inputFileName, lno) && getline(inputFileName, name) && getline(inputFileName, address))
{
if (name == targetName)
{
cout << "MATCH FOUND!!! LICENSE NUMBER : " << lno << "\n";
isFound = true;
}
}
if (!isFound)
cout << "Sorry no match found\n";
inputFileName.close();
// UPDATING NAME BASED ON LICENSE NUMBER
cout << ".....UPDATING NAME BASED ON LICENSE NUMBER.....\n";
string NewName, Lno;
outputFileName.open("temp.txt");
inputFileName.open("License.txt");
cout << "Enter License no: ";
getline(cin, Lno);
cout << "Enter New Name: ";
getline(cin, NewName);
while (getline(inputFileName, lno) && getline(inputFileName, name) && getline(inputFileName, address))
{
outputFileName << lno << "\n";
outputFileName << (lno == Lno ? NewName : name) << "\n";
outputFileName << address << "\n";
}
outputFileName.close();
inputFileName.close();
if (remove(R"(License.txt)") != 0)
{
cout << "Error deleting file\n";
};
rename(R"(temp.txt)", R"(License.txt)");
return 0;
}
| [
"34346812+subhamagrawal7@users.noreply.github.com"
] | 34346812+subhamagrawal7@users.noreply.github.com |
e267f00ad8ea92f557026082bbcb11e59a384ef1 | bd8e4882da2cafcd40d989b13dcb956a855b3218 | /Source/TestingGrounds/Private/Characters/ThirdPersonCharacter.cpp | f0677dc03b0d960771003348bf43b3ea89a69c09 | [] | no_license | NWGade/TestingGrounds | 9f10cb9be8b1c0dbc1b1d0a058e608d27cf45baf | ad44bc97ab716fdc92c953e1aca443fe9eb53676 | refs/heads/master | 2021-04-27T00:21:40.332153 | 2018-10-15T08:33:18 | 2018-10-15T08:33:18 | 121,672,159 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 592 | cpp | // Fill out your copyright notice in the Description page of Project Settings.
#include "ThirdPersonCharacter.h"
#include "Weapons/Gun.h"
AThirdPersonCharacter::AThirdPersonCharacter()
{
PersonCharacterType = EPersonCharacterType::ThirdPerson;
PersonCharacterMesh->RelativeLocation = FVector(0.f, 0.f, -100.f);
PersonCharacterMesh->RelativeRotation = FRotator(0.f, -90.f, 0.f);
}
void AThirdPersonCharacter::PlaceLeftHandOnSecondGripPoint()
{
if (Weapon != nullptr) {
Weapon->SetSecondGripPointLocAndRot(this->GetActorForwardVector(), SecondGripPointLoc, SecondGripPointRot);
}
}
| [
"roman.mouchel@telecom-sudparis.eu"
] | roman.mouchel@telecom-sudparis.eu |
3e989bf19a360dabf6afcd7e667b6353a8ed5112 | bcdad145f40b13a5f23f1bd6e191caf20db4df7c | /integration-sample/gui.hxx | a1e8b25ae65fed279fbb3e82467e2d2151b2788a | [] | no_license | usagi/virtual-keyboard-prototype-1 | d7c9f65019897f7949f2f59ebc15aa1782e4e69e | b6156b1bf30fa1dbf6e2ca3792772e121c24547c | refs/heads/master | 2016-09-06T09:20:56.639399 | 2014-01-29T21:45:02 | 2014-01-29T21:45:02 | 14,557,877 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,521 | hxx | #pragma once
#include <opencv2/core/core.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/highgui/highgui.hpp>
#include "configuration.hxx"
//#include "commandline_helper.hxx"
#include "finger-detector.hxx"
namespace arisin
{
namespace etupirka
{
class gui_t final
{
enum class window
{ in_top, in_front
, out_top, out_front
, controller_1
, controller_2
};
enum class trackbar
{ top_front_switch
, save, load
, diameter, sigma_color, sigma_space
, morphology_repeat
, h_min, h_max, s_min, s_max, v_min, v_max
, nail_morphology, nail_median_blur
, nail_circles_dp, nail_circles_min_dist
, nail_circles_param_1, nail_circles_param_2
, nail_circles_min_radius, nail_circles_max_radius
};
configuration_t& conf_;
configuration_t::finger_detector_configuration_t current_finger_detector_conf_;
int prev_top_front_switch;
void save_conf(bool is_top = true);
void load_conf(bool is_top = true);
public:
struct input_t
{
cv::Mat in_top , in_front ;
cv::Mat out_top, out_front;
finger_detector_t::circles_t circles_top, circles_front;
};
explicit gui_t(configuration_t& conf);
void operator()(const input_t& input);
const configuration_t::finger_detector_configuration_t& current_finger_detector_conf() const;
const bool current_is_top() const;
};
}
} | [
"usagi@WonderRabbitProject.net"
] | usagi@WonderRabbitProject.net |
ceec9862847cba5a4a2dc7965d2f0397ca8e1cbe | 656243ae84ca3a2280cc9cc3aad95afca8e10565 | /Code/CryEngine/CryAction/AIHandler.h | be832bd7fd974c7ca30a4dd9b522f7c7c197bbcd | [] | no_license | NightOwlsEntertainment/PetBox_A_Journey_to_Conquer_Elementary_Algebra | 914ff61bb210862401acb4d3a2eb19d323b00548 | 8383c5c1162d02310f460a1359f04891e5e85bff | refs/heads/master | 2021-01-22T09:48:55.961703 | 2015-11-11T11:26:27 | 2015-11-11T11:26:27 | 45,846,131 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 11,359 | h | /********************************************************************
CryGame Source File.
Copyright (C), Crytek Studios, 2001-2004.
-------------------------------------------------------------------------
File name: AIHandler.h
Version: v1.00
Description:
-------------------------------------------------------------------------
History:
- 8:10:2004 12:04 : Created by Kirill Bulatsev
*********************************************************************/
#ifndef __AIHandler_H__
#define __AIHandler_H__
#pragma once
#include "AIFaceManager.h"
#include "ICryMannequin.h"
#include "Mannequin/AnimActionTriState.h"
#include "IMovementController.h" // for the exactpositioning types
struct IScriptSystem;
struct IScriptTable;
struct ISystem;
struct IAISignalExtraData;
class CAIProxy;
class CMovementRequest;
//
//------------------------------------------------------------------------------
class CAnimActionAIAction : public CAnimActionTriState
{
public:
typedef CAnimActionTriState TBase;
enum EAIActionType
{
EAT_Looping,
EAT_OneShot,
};
// TODO: Move mannequin priorities into CryAction or get this from a central location
enum
{
NORMAL_ACTION_PRIORITY = 3, // currently equal to PP_Action, just above movement, but underneath urgent actions, hit death, etc.
URGENT_ACTION_PRIORITY = 4 // currently equal to PP_Urgent_Action, just above normal actions, but underneath hit death, etc.
};
DEFINE_ACTION("AIAction");
CAnimActionAIAction(bool isUrgent, FragmentID fragmentID, IAnimatedCharacter& animChar, EAIActionType type, const string& value, IAnimActionTriStateListener& listener, bool skipIntro = false)
: TBase((isUrgent ? URGENT_ACTION_PRIORITY : NORMAL_ACTION_PRIORITY), fragmentID, animChar, (type == EAT_OneShot), -1, skipIntro, &listener)
, m_type(type)
, m_value(value)
, m_isUrgent(isUrgent)
{
InitMovementControlMethods(eMCM_AnimationHCollision, eMCM_Entity);
}
// overrides ----------------------------------------------------------------
EPriorityComparison ComparePriority( const IAction &actionCurrent ) const override
{
if (m_isUrgent)
{
return (IAction::Installed == actionCurrent.GetStatus() && IAction::Installing & ~actionCurrent.GetFlags()) ? Higher : TBase::ComparePriority(actionCurrent);
}
else
{
return TBase::ComparePriority( actionCurrent );
}
}
// ~overrides ---------------------------------------------------------------
EAIActionType GetType() const { return m_type; }
const string& GetValue() const { return m_value; }
private:
EAIActionType m_type;
string m_value;
bool m_isUrgent;
};
// ----------------------------------------------------------------------------
class CAIHandler
: public IAnimationGraphStateListener
, IExactPositioningListener
, IAnimActionTriStateListener
{
friend class CAIProxy;
// implementation of IAnimationGraphStateListener
virtual void SetOutput( const char * output, const char * value ) {}
virtual void QueryComplete( TAnimationGraphQueryID queryID, bool succeeded );
virtual void DestroyedState(IAnimationGraphState* );
//------------------ IExactPositioningListener
virtual void ExactPositioningQueryComplete( TExactPositioningQueryID queryID, bool succeeded );
virtual void ExactPositioningNotifyFinishPoint( const Vec3& pt );
//------------------ ~IExactPositioningListener
//------------------ IAnimActionTriStateListener
virtual void OnAnimActionTriStateEnter(CAnimActionTriState* pActionTriState);
virtual void OnAnimActionTriStateMiddle( CAnimActionTriState* pActionTriState );
virtual void OnAnimActionTriStateExit(CAnimActionTriState* pActionTriState);
//------------------ ~IAnimActionTriStateListener
public:
CAIHandler(IGameObject *pGameObject);
~CAIHandler(void);
void Init();
void Reset(EObjectResetType type);
void OnReused(IGameObject *pGameObject);
void HandleCoverRequest(SOBJECTSTATE& state, CMovementRequest& mr);
void HandleMannequinRequest(SOBJECTSTATE& state, CMovementRequest& mr);
void HandleExactPositioning(SOBJECTSTATE& state, CMovementRequest& mr);
void Update();
void AIMind(SOBJECTSTATE &state);
void AISignal(int signalID, const char* signalText, uint32 crc, IEntity* pSender, const IAISignalExtraData* pData);
void Release();
/// Plays a readability set (Group + Response)
/// Note: A response delay of 0 means a random delay is chosen
bool HasReadibilitySoundFinished() const { return m_bSoundFinished; }
bool SetAGInput(EAIAGInput input, const char* value, const bool isUrgent = false);
bool SetMannequinAGInput( IActionController* pActionController, EAIAGInput input, const char* value, const bool isUrgent = false );
void FinishRunningAGActions();
/// Returns an estimate of how long the triggered animation would play when triggered now.
/// (with the current stance, vehicle state, ...)
CTimeValue GetEstimatedAGAnimationLength(EAIAGInput input, const char* value);
bool ResetAGInput( EAIAGInput input );
bool ResetMannequinAGInput( EAIAGInput input );
IAnimationGraphState* GetAGState();
bool IsSignalAnimationPlayed( const char* value );
bool IsActionAnimationStarted( const char* value );
bool IsAnimationBlockingMovement() const;
EActorTargetPhase GetActorTargetPhase() const { return m_eActorTargetPhase; }
IActionController* GetActionController();
void OnDialogLoaded(struct ILipSync *pLipSync);
void OnDialogFailed(struct ILipSync *pLipSync);
enum ESetFlags
{
SET_IMMEDIATE,
SET_DELAYED,
SET_ON_SERILIAZE,
};
#ifdef USE_DEPRECATED_AI_CHARACTER_SYSTEM
bool SetCharacter(const char* character, ESetFlags setFlags = SET_IMMEDIATE);
#endif
void SetBehavior(const char* szBehavior, const IAISignalExtraData* pData = 0, ESetFlags setFlags = SET_IMMEDIATE);
#ifdef USE_DEPRECATED_AI_CHARACTER_SYSTEM
const char* GetCharacter();
void CallCharacterConstructor();
#endif
void CallBehaviorConstructor(const IAISignalExtraData* pData);
void ResendTargetSignalsNextFrame();
// For temporary debug info retrieving in AIProxy.
bool DEBUG_IsPlayingSignalAnimation() const { return m_playingSignalAnimation; }
bool DEBUG_IsPlayingActionAnimation() const { return m_playingActionAnimation; }
const char* DEBUG_GetCurrentSignaAnimationName() const { return m_currentSignalAnimName.c_str(); }
const char* DEBUG_GetCurrentActionAnimationName() const { return m_currentActionAnimName.c_str(); }
protected:
class CAnimActionExactPositioning* CreateExactPositioningAction(bool isOneShot, float loopDuration, const char* szFragmentID, bool isNavigationalSO, const QuatT& exactStartLocation);
#ifdef USE_DEPRECATED_AI_CHARACTER_SYSTEM
const char* GetInitialCharacterName();
#endif
const char* GetInitialBehaviorName();
const char* GetBehaviorFileName(const char* szBehaviorName);
IActor* GetActor() const;
#ifdef USE_DEPRECATED_AI_CHARACTER_SYSTEM
void ResetCharacter();
#endif
void ResetBehavior();
void ResetAnimationData();
void SetInitialBehaviorAndCharacter();
#ifdef USE_DEPRECATED_AI_CHARACTER_SYSTEM
const char* CheckAndGetBehaviorTransition(const char* szSignalText) const;
#endif
bool CallScript(IScriptTable* scriptTable, const char* funcName, float* pValue = NULL, IEntity* pSender = NULL, const IAISignalExtraData* pData = NULL);
bool GetMostLikelyTable(IScriptTable* table, SmartScriptTable& dest);
bool FindOrLoadTable(IScriptTable* pGlobalTable, const char* szTableName, SmartScriptTable& tableOut);
void FindOrLoadBehavior(const char* szBehaviorName, SmartScriptTable& pBehaviorTable);
void Serialize( TSerialize ser );
void SerializeScriptAI(TSerialize& ser);
void SetAlertness( int value, bool triggerEvent = false );
/// Iterates to the next valid readability sound while testing readability sounds.
void NextReadabilityTest();
void ResetCommonTables();
bool SetCommonTables();
static const char* GetAGInputName(EAIAGInput input);
void MakeFace(CAIFaceManager::e_ExpressionEvent expression);
IScriptTable* m_pScriptObject;
IEntity* m_pEntity;
IGameObject* m_pGameObject;
bool m_bSoundFinished;
#ifdef USE_DEPRECATED_AI_CHARACTER_SYSTEM
SmartScriptTable m_pCharacter;
#endif
SmartScriptTable m_pBehavior;
SmartScriptTable m_pPreviousBehavior;
#ifdef USE_DEPRECATED_AI_CHARACTER_SYSTEM
SmartScriptTable m_pDefaultBehavior;
SmartScriptTable m_pDefaultCharacter;
#endif
SmartScriptTable m_pDEFAULTDefaultBehavior;
SmartScriptTable m_pBehaviorTable;
SmartScriptTable m_pBehaviorTableAVAILABLE;
SmartScriptTable m_pBehaviorTableINTERNAL;
int m_CurrentAlertness;
bool m_CurrentExclusive;
#ifdef USE_DEPRECATED_AI_CHARACTER_SYSTEM
bool m_bDelayedCharacterConstructor;
#endif
bool m_bDelayedBehaviorConstructor;
string m_sBehaviorName;
#ifdef USE_DEPRECATED_AI_CHARACTER_SYSTEM
string m_sDefaultBehaviorName;
string m_sCharacterName;
string m_sPrevCharacterName;
string m_sFirstCharacterName;
#endif
string m_sFirstBehaviorName;
IAnimationGraphState* m_pAGState;
TAnimationGraphQueryID m_ActionQueryID;
TAnimationGraphQueryID m_SignalQueryID;
string m_sQueriedActionAnimation;
string m_sQueriedSignalAnimation;
bool m_bSignaledAnimationStarted;
typedef std::set< string > SetStrings;
SetStrings m_setPlayedSignalAnimations;
SetStrings m_setStartedActionAnimations;
TAnimationGraphQueryID m_actorTargetStartedQueryID;
TAnimationGraphQueryID m_actorTargetEndQueryID;
TExactPositioningQueryID* m_curActorTargetStartedQueryID;
TExactPositioningQueryID* m_curActorTargetEndQueryID;
bool m_bAnimationStarted;
EActorTargetPhase m_eActorTargetPhase;
int m_actorTargetId;
TAnimationGraphQueryID m_changeActionInputQueryId;
TAnimationGraphQueryID m_changeSignalInputQueryId;
string m_sAGActionSOAutoState;
bool m_playingSignalAnimation;
bool m_playingActionAnimation;
string m_currentSignalAnimName;
string m_currentActionAnimName;
Vec3 m_vAnimationTargetPosition;
Quat m_qAnimationTargetOrientation;
CAIFaceManager m_FaceManager;
EAITargetType m_lastTargetType;
EAITargetThreat m_lastTargetThreat;
tAIObjectID m_lastTargetID;
Vec3 m_lastTargetPos;
struct SAnimActionTracker
{
SAnimActionTracker() { m_animActions.reserve(4); }
void ReleaseAll(); // cancel all animactions and deregister listeners
void ForceFinishAll(); // forcefinish all animactions (keep listening for events)
void StopAll(); // stop all animactions (keep listening for events)
void StopAllActionsOfType( bool isOneShot ); // stop all animactions of specified type (keep listening for events)
void Add( CAnimActionTriState* pAction );
void Remove( CAnimActionTriState* pAction );
bool IsNotEmpty() const { return !m_animActions.empty(); }
private:
typedef _smart_ptr<CAnimActionTriState> AnimActionPtr;
typedef std::vector<AnimActionPtr > TAnimActionVector;
TAnimActionVector m_animActions;
};
SAnimActionTracker m_animActionTracker;
private:
void DoReadibilityPackForAIObjectsOfType(unsigned short int nType, const char* szText, float fResponseDelay);
float m_timeSinceEvent;
};
#endif // __AIHandler_H__
| [
"jonathan.v.mendoza@gmail.com"
] | jonathan.v.mendoza@gmail.com |
4a4d024c35cb4040c5ae5e99f88e3d63d451420d | 80727f8d00e9d9bc32233abb46f78db551074cb0 | /Collider.h | 193cdddbdad1aed93615544dfc41470eaa46e850 | [] | no_license | Svetlichnov-V/My_Engine | 8ad34bb80be60f0a961f86c3ac4a44444eff4e8b | 994f5d0ab508146cc6cb22a14e7f7b3453791f28 | refs/heads/master | 2023-04-29T16:39:12.152654 | 2021-05-21T07:58:04 | 2021-05-21T07:58:04 | 342,665,405 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,340 | h | #pragma once
#include <cassert>
#include <string>
#include <iostream>
#include <vector>
#include "Vector2f.h"
#include "Buns.h"
#include "Game_Object.h"
class Collider : public Component
{
std::vector<Vector2f> vertexs;
Vector2f size;
Vector2f centerMass;
GameObject* master;
public:
Collider(std::vector<Vector2f> vertexs)
{
//std::cout << "Collider" << '\n';
this->vertexs = vertexs;
}
Collider() {};
void printVert()
{
for (int i = 0; i < vertexs.size(); i++)
{
std::cout << vertexs[i] << '\n';
}
std::cout << '\n';
}
void setMaster(GameObject* master)
{
this->master = master;
}
void setSize(Vector2f s)
{
size = s;
}
Vector2f getSize()
{
return size;
}
Vector2f getPositionVertex(int number)
{
assert(number < vertexs.size());
return master->getPosition() + vertexs[number];
}
int getNumberOfVertex()
{
return vertexs.size();
}
Vector2f getVertex(int number)
{
assert(number < vertexs.size());
return vertexs[number];
}
Vector2f getCenterMass()
{
return centerMass;
}
void setCenterMass(Vector2f cm)
{
centerMass = cm;
}
Vector2f getInwardNormal(int numberVertex)
{
Vector2f v(0, 0);
if (numberVertex == 0)
v = this->getVertex(vertexs.size() - 1) - this->getVertex(1);
if (numberVertex == (vertexs.size() - 1))
v = this->getVertex(0) - this->getVertex(numberVertex - 1);
if ((numberVertex != 0) && (numberVertex != (vertexs.size() - 1)))
v = this->getVertex(numberVertex - 1) - this->getVertex(numberVertex + 1);
Vector2f d(v.y, -v.x);
Vector2f a = this->getVertex(numberVertex) - centerMass;
return ((a * d) * d * (-1)).norm();
}
Vector2f isCollide(Collider* coll)
{
/*
for (int i = 0; i < vertexs.size() - 1; i++)
{
Vector2f firstVertex = this->getPositionVertex(i);
Vector2f secondVertex = this->getPositionVertex(i + 1);
Vector2f vector = secondVertex - firstVertex;
Vector2f guidingVector = Vector2f(vector.y, (-1) * vector.x);
Vector2f startStraight = firstVertex;
float
};
*/
Vector2f position = this->master->getPosition();
Vector2f gObjPosition = coll->master->getPosition();
if ((position - gObjPosition).mod() > (size + coll->getSize()).mod())
return Vector2f(0, 0);
int gObjNumberOfVertexs = coll->getNumberOfVertex();
if (gObjNumberOfVertexs < 2)
return Vector2f(0, 0);
Vector2f vectorCollision(0, 0);
int numberOfVertexs = vertexs.size();
for (int numberVertex = 0; numberVertex < numberOfVertexs; numberVertex++)
{
bool flag = true;
for (int numberGObjvertex = 1; numberGObjvertex < gObjNumberOfVertexs; numberGObjvertex++)
{
//std::cout << gObj.name << '\n';
Vector2f v1 = coll->getPositionVertex(numberGObjvertex) - coll->getPositionVertex(numberGObjvertex - 1);
Vector2f v2 = this->getPositionVertex(numberVertex) - coll->getPositionVertex(numberGObjvertex - 1);
//std::cout << numberVertex << ' ' << numberGObjvertex << " : " << v1 << " ; " << v2 << '\n';
if (v1.vectComp(v2) > 0)
{
flag = false;
break;
}
}
Vector2f v1 = coll->getPositionVertex(0) - coll->getPositionVertex(gObjNumberOfVertexs - 1);
Vector2f v2 = this->getPositionVertex(numberVertex) - coll->getPositionVertex(gObjNumberOfVertexs - 1);
if (v1.vectComp(v2) > 0)
{
continue;
}
if (flag)
{
//std::cout << (this->getVertex(numberVertex) - centerMass) << '\n';
vectorCollision += this->getInwardNormal(numberVertex);
}
}
if (vectorCollision.mod() == 0)
return vectorCollision;
return vectorCollision.norm();
}
};
| [
"svetlichnov.vv@phystech.edu"
] | svetlichnov.vv@phystech.edu |
69555d6b56e864471773681dbd08ca55d7c9743a | 950161afb4cbe035579af74aa69a206e543697da | /test_type.cpp | 14c6612fba23d1fb2b0ea64572b8646eb53f82c9 | [] | no_license | mugisaku/pglang | 31120a683cce8c9bca2c9271aa659a1a96269c1a | afdbd2c6e7f10bc2e16302d04fe9a26d33496b8e | refs/heads/master | 2021-01-12T07:49:04.379042 | 2017-02-01T03:49:08 | 2017-02-01T03:49:08 | 77,029,725 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,195 | cpp | #include"pglang_type.hpp"
#include"pglang_type__function.hpp"
#include"pglang_expr.hpp"
#include"pglang_block.hpp"
#include"pglang_parser__block.hpp"
#include"pglang_parser__stream.hpp"
#include"pglang_parser__token.hpp"
using namespace pglang;
int
main(int argc, char** argv)
{
/*
auto sig = Signature(Type(Int()));
sig.append_parameter(Type( Int8()),std::string("a"));
sig.append_parameter(Type(Int16()),std::string("b"));
sig.append_parameter(Type(UInt8()),std::string("c"));
Function fn(std::move(sig));
std::vector<Element> src({Element(Literal(6LL)),Element(BinaryOperator('+')),Element(Literal(4LL))});
auto ls = Expr::to_rpn(std::move(src));
auto res = Expr::create_tree(std::move(ls));
res->print();
res->to_value(nullptr).print();
*/
parser::Stream s(";{a; b} -5+67.0788:{;c ;}");
parser::Block blk(s);
blk.print();
printf("\n");
/*
LiteralList args(0,1.0,2,3.6,LiteralList(2,6,4));
for(auto& l:args)
{
l.print();
printf("\n");
}
*/
/*
fn.declare(Type(UInt32()),std::string("x"));
fn.declare(std::string("y"),Literal(1234));
fn.declare(std::string("z"),Literal(std::u32string(U"aeiou")));
fn.execute(args);
*/
return 0;
}
| [
"lentilspring@gmail.com"
] | lentilspring@gmail.com |
7f1ce7c4b89d56f90e639f06e5baa62dfebed77c | 710c51bb5a1c23b0d78cbb62dc8b98340233e518 | /testServer.cpp | b7cd539ebbfd7792f3aa17bc0775f891c1c518a6 | [] | no_license | Sagr-gupta/Multiple-Client-Server-Communication-Using-TCP-IP-Protocol | 6488ca158cc12a48f0ef6ff1f8109457ba2f53c8 | bba3ff1e38b7c398d164b5994e7d0803189cc079 | refs/heads/main | 2023-03-20T09:41:50.276994 | 2021-03-14T11:51:58 | 2021-03-14T11:51:58 | 347,418,389 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,748 | cpp | #include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <unistd.h>
#include <netdb.h>
#include <sys/time.h>
#include <sys/wait.h>
#include <bits/stdc++.h>
using namespace std;
int main(int argc, char *argv[])
{
if(argc != 2)
{
cerr<<"Missing port number.\n";
exit(0);
}
int port = atoi(argv[1]);
char message[1500];
// Define a socketaddr_in struct for server socket (for socket listening)
sockaddr_in serverSocket;
bzero((char *)&serverSocket, sizeof(serverSocket));
serverSocket.sin_family = AF_INET;
serverSocket.sin_port = htons(port);
serverSocket.sin_addr.s_addr = htonl(INADDR_ANY);
// socket() for server socket
// int socketID = socket(Family,Type,Protocol)
int serverSocketID = socket(AF_INET, SOCK_STREAM,0);
if(serverSocketID < 0 )
{
cerr<<"Not Successful\n";
exit(0);
}
// bind() the socket to a port
// int status = bind(socketID, &addressPort, sizeOfPort)
int bindStatus = bind(serverSocketID, (struct sockaddr *)&serverSocket, sizeof(serverSocket));
if(bindStatus < 0)
{
cerr<<"Not successful bind\n";
exit(0);
}
cout<<"Waiting for client to connect....\n";
//listen() for any incoming communication
//int status = listen(socketID, queueLimit)
listen(serverSocketID, 1);
//define a sockaddr_in struct for the connection socket
sockaddr_in newSocket;
socklen_t newSocketLen = sizeof(newSocket);
//accept() the connection
//int newID = accept(socketID, &clientAddress,&addressLen)
int newSocketID = accept(serverSocketID,(sockaddr *) &newSocket,&newSocketLen);
if(newSocketID < 0)
{
cerr<<"Not successful accept.\n";
exit(0);
}
cout<<"Client connected successfully.\n";
//send() and recv() bytes
//int data = send(socketID, MSG, MSGLen,flags)
//int data = recv(socketID, recvBuf, bufLen, flags)
while(1)
{
cout<<"Waiting for a message from client\n";
recv(newSocketID, (char *)&message, sizeof(message),0);
if(!strcmp(message, "exit"))
{
cout<<"Session terminated\n";
break;
}
cout<<message<<endl;
string data;
getline(cin,data);
strcpy(message, data.c_str());
if(data == "exit")
{
cout<<"Session terminated\n";
break;
}
send(newSocketID, (char *)&message,sizeof(message),0);
}
//close() the socket
//int status = close(socketID);
close(newSocketID);
close(serverSocketID);
}
| [
"noreply@github.com"
] | noreply@github.com |
b62bc125f032d88636078d71ea55b858228a0cdd | 8d18e63a1970132982b7a18fd7eb327139ea3513 | /src/main1b.cpp | ff02042055e56998523a455612e8c5371a340dbf | [] | no_license | eglrp/NetEaseIntern | 36081854885740442703924234a88995c0d9bd09 | 87ca400f3a7a51fd9839eff841b08505c5c22988 | refs/heads/master | 2020-03-23T01:26:47.498581 | 2017-03-25T08:07:45 | 2017-03-25T08:07:45 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 786 | cpp | #include <iostream>
#include <stack>
#include <cstdio>
#include "Configs.h"
using namespace std;
int main() {
if ( !freopen( CMAKE_SOURCE_DIR "/file1b.txt", "r", stdin ) ) {
perror( "freopen() failed" );
return EXIT_FAILURE;
}
int M, N;
while (2 == scanf("%d %d", &M, &N)) {
if( N < 2 || N > 16 ) { continue; }
stack<int> s;
int sign = 1;
if( M < 0 ) { sign = -1; M = -M; }
while (M) {
s.push(M%N);
M /= N;
}
if( s.empty() ) { printf("0"); }
if( sign < 0 ) { printf("-"); }
while (!s.empty()) {
char c = s.top() > 9 ? 'A' + s.top() - 10 : '0' + s.top();
printf("%c", c);
s.pop();
}
printf("\n");
}
} | [
"dvorak4tzx@qq.com"
] | dvorak4tzx@qq.com |
dd69cf5e98545d457df904da979abb7381bee3f4 | e6f8c63578c8617cf13794c921aff29ff6c56230 | /tests/priority_queue_test.cpp | e953a83700f036d546c6c651bdf4867b4044dc2f | [] | no_license | simonask/grace-base | 8b76c60c9b3d1eae0b32d9dd3432d6d2ccb669ea | ab5a0fd4fc7583c3f3b59f2c18770f5fe0a9abc5 | refs/heads/master | 2021-03-13T00:01:01.765633 | 2013-10-03T14:46:40 | 2013-10-03T14:46:40 | 12,755,495 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 954 | cpp | //
// priority_queue_test.cpp
// grace
//
// Created by Simon Ask Ulsnes on 17/12/12.
// Copyright (c) 2012 Simon Ask Consulting. All rights reserved.
//
#include "tests/test.hpp"
#include "base/priority_queue.hpp"
using namespace grace;
SUITE(PriorityQueue) {
it("should insert elements without throwing exceptions", []() {
PriorityQueue<int> q;
for (int i: {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}) {
q.insert(i);
}
TEST(q).should == Array<int>({1, 2, 3, 4, 5, 6, 7, 8, 9, 10});
});
it("should order inserted elements, reversely sorted", []() {
PriorityQueue<int> q;
for (int i: {10, 9, 8, 7, 6, 5, 4, 3, 2, 1}) {
q.insert(i);
}
TEST(q).should == Array<int>({1, 2, 3, 4, 5, 6, 7, 8, 9, 10});
});
it("should order inserted elements, randomly sorted", []() {
PriorityQueue<int> q;
for (int i: {1, 10, 2, 9, 3, 8, 4, 7, 5, 6}) {
q.insert(i);
}
TEST(q).should == Array<int>({1, 2, 3, 4, 5, 6, 7, 8, 9, 10});
});
}
| [
"simon@ulsnes.dk"
] | simon@ulsnes.dk |
ea289bbb2719ee59db1efd1119a3b19f15c11a4d | 66841ad35e785a8ea4a27533a31862507631ddd6 | /src/Vecteur.cpp | 7b3927596907a381d8d91c6ceb67d8cecb2ca9ba | [] | no_license | damiencot/Asteroides | 0ed2b619fe26ccea010118fdc2460e8486790d35 | d5da989034103447fe15ebc6c976b140ea0a47b7 | refs/heads/main | 2021-12-01T20:52:57.113580 | 2021-06-09T15:56:06 | 2021-06-09T15:56:06 | 185,949,464 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 502 | cpp | #define _USE_MATH_DEFINES
#include "Vecteur.h"
#include <cmath>
void Vecteur::operator+=(Vecteur const& autre){
x += autre.x;
y+= autre.y;
}
void Vecteur::operator-=(Vecteur const& autre){
x -= autre.x;
y -= autre.y;
}
Vecteur Vecteur::operator*(float coefficient) const{
return Vecteur{x*coefficient, y*coefficient};
}
Vecteur Vecteur::creerDepuisAngle(float taille, float angleEnDegre){
return {taille*cos(angleEnDegre/180.f*M_PI), taille*sin(angleEnDegre/180.f*M_PI)};
}
| [
"damien.cot@gmail.com"
] | damien.cot@gmail.com |
76083c332e465f4826cc62f78ba42a2aa0127e35 | ba96f82be62153e1a17c9949af778ea5b52af8d6 | /examples/sycl/sycl_allreduce_inplace_usm_test.cpp | 4c0605ba28a45f7d58ca2c660c8c5d4c1ec10231 | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | xwu99/oneCCL | 6015ecb3eb4fcf5db5237b03e36378b83e7ac415 | 6a98d9d1883c134fd03e825f41db508cc38bf251 | refs/heads/master | 2023-04-08T21:25:52.041188 | 2021-04-01T16:05:55 | 2021-04-01T16:05:55 | 290,646,738 | 0 | 0 | null | 2020-08-27T01:45:30 | 2020-08-27T01:45:30 | null | UTF-8 | C++ | false | false | 3,217 | cpp | /*
Copyright 2016-2020 Intel Corporation
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 "sycl_base.hpp"
using namespace std;
using namespace sycl;
int main(int argc, char *argv[]) {
const size_t count = 10 * 1024 * 1024;
int i = 0;
int size = 0;
int rank = 0;
ccl::init();
MPI_Init(NULL, NULL);
MPI_Comm_size(MPI_COMM_WORLD, &size);
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
atexit(mpi_finalize);
queue q;
if (!create_sycl_queue(argc, argv, rank, q)) {
return -1;
}
buf_allocator<int> allocator(q);
auto usm_alloc_type = usm::alloc::shared;
if (argc > 2) {
usm_alloc_type = usm_alloc_type_from_string(argv[2]);
}
if (!check_sycl_usm(q, usm_alloc_type)) {
return -1;
}
/* create kvs */
ccl::shared_ptr_class<ccl::kvs> kvs;
ccl::kvs::address_type main_addr;
if (rank == 0) {
kvs = ccl::create_main_kvs();
main_addr = kvs->get_address();
MPI_Bcast((void *)main_addr.data(), main_addr.size(), MPI_BYTE, 0, MPI_COMM_WORLD);
}
else {
MPI_Bcast((void *)main_addr.data(), main_addr.size(), MPI_BYTE, 0, MPI_COMM_WORLD);
kvs = ccl::create_kvs(main_addr);
}
/* create communicator */
auto dev = ccl::create_device(q.get_device());
auto ctx = ccl::create_context(q.get_context());
auto comm = ccl::create_communicator(size, rank, dev, ctx, kvs);
/* create stream */
auto stream = ccl::create_stream(q);
/* create buffers */
auto buf = allocator.allocate(count, usm_alloc_type);
/* open buffers and modify them on the device side */
auto e = q.submit([&](auto &h) {
h.parallel_for(count, [=](auto id) {
buf[id] = rank + 1;
});
});
if (!handle_exception(q))
return -1;
/* invoke allreduce */
ccl::allreduce(buf, buf, count, ccl::reduction::sum, comm, stream).wait();
/* open recv_buf and check its correctness on the device side */
buffer<int> check_buf(count);
q.submit([&](auto &h) {
accessor check_buf_acc(check_buf, h, write_only);
h.parallel_for(count, [=](auto id) {
if (buf[id] != size * (size + 1) / 2) {
check_buf_acc[id] = -1;
}
});
});
if (!handle_exception(q))
return -1;
/* print out the result of the test on the host side */
{
host_accessor check_buf_acc(check_buf, read_only);
for (i = 0; i < count; i++) {
if (check_buf_acc[i] == -1) {
cout << "FAILED\n";
break;
}
}
if (i == count) {
cout << "PASSED\n";
}
}
return 0;
}
| [
"dmitriy.sazanov@intel.com"
] | dmitriy.sazanov@intel.com |
b1dc7418de0069fc80dfb760fadee33ea37bab18 | 0ef4f71c8ff2f233945ee4effdba893fed3b8fad | /misc_microsoft_gamedev_source_code/misc_microsoft_gamedev_source_code/extlib/havok/Source/Physics/Utilities/VisualDebugger/Viewer/Dynamics/hkpConstraintViewer.cpp | a0f7f89c8ed252a6c4dc4f473b8f5cdc7d97288b | [] | no_license | sgzwiz/misc_microsoft_gamedev_source_code | 1f482b2259f413241392832effcbc64c4c3d79ca | 39c200a1642102b484736b51892033cc575b341a | refs/heads/master | 2022-12-22T11:03:53.930024 | 2020-09-28T20:39:56 | 2020-09-28T20:39:56 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 9,554 | cpp | /*
*
* Confidential Information of Telekinesys Research Limited (t/a Havok). Not for disclosure or distribution without Havok's
* prior written consent.This software contains code, techniques and know-how which is confidential and proprietary to Havok.
* Level 2 and Level 3 source code contains trade secrets of Havok. Havok Software (C) Copyright 1999-2007 Telekinesys Research Limited t/a Havok. All Rights Reserved. Use of this software is subject to the terms of an end user license agreement.
*
*/
#include <Common/Base/hkBase.h>
#include <Common/Base/Monitor/hkMonitorStream.h>
#include <Common/Base/hkBase.h>
#include <Physics/Utilities/VisualDebugger/Viewer/Dynamics/hkpConstraintViewer.h>
#include <Common/Visualize/hkDebugDisplayHandler.h>
#include <Common/Visualize/hkProcessFactory.h>
#include <Physics/Dynamics/World/hkpSimulationIsland.h>
#include <Physics/Dynamics/World/hkpWorld.h>
#include <Physics/Dynamics/Entity/hkpRigidBody.h>
#include <Common/Visualize/hkDebugDisplay.h>
#include <Common/Visualize/Type/hkColor.h>
#include <Physics/Dynamics/Constraint/hkpConstraintInstance.h>
#include <Physics/Dynamics/Constraint/Breakable/hkpBreakableConstraintData.h>
#include <Physics/Dynamics/Constraint/Malleable/hkpMalleableConstraintData.h>
#include <Physics/Utilities/VisualDebugger/Viewer/Dynamics/Constraint/Drawer/hkpHingeDrawer.h>
#include <Physics/Utilities/VisualDebugger/Viewer/Dynamics/Constraint/Drawer/hkpLimitedHingeDrawer.h>
#include <Physics/Utilities/VisualDebugger/Viewer/Dynamics/Constraint/Drawer/hkpRagdollDrawer.h>
#include <Physics/Utilities/VisualDebugger/Viewer/Dynamics/Constraint/Drawer/hkpPrismaticDrawer.h>
#include <Physics/Utilities/VisualDebugger/Viewer/Dynamics/Constraint/Drawer/hkpWheelDrawer.h>
#include <Physics/Utilities/VisualDebugger/Viewer/Dynamics/Constraint/Drawer/hkpStiffSpringDrawer.h>
#include <Physics/Utilities/VisualDebugger/Viewer/Dynamics/Constraint/Drawer/hkpBallSocketDrawer.h>
#include <Physics/Utilities/VisualDebugger/Viewer/Dynamics/Constraint/Drawer/hkpPointToPathDrawer.h>
#include <Physics/Utilities/VisualDebugger/Viewer/Dynamics/Constraint/Drawer/hkpPointToPlaneDrawer.h>
#include <Physics/Utilities/VisualDebugger/Viewer/Dynamics/Constraint/Drawer/hkpPulleyDrawer.h>
#include <Physics/Utilities/VisualDebugger/Viewer/Dynamics/Constraint/Drawer/hkpConstraintChainDrawer.h>
#include <Physics/Utilities/VisualDebugger/Viewer/Dynamics/Constraint/Drawer/hkpHingeLimitsDrawer.h>
#include <Physics/Utilities/VisualDebugger/Viewer/Dynamics/Constraint/Drawer/hkpRagdollLimitsDrawer.h>
int hkpConstraintViewer::m_tag = 0;
void HK_CALL hkpConstraintViewer::registerViewer()
{
m_tag = hkProcessFactory::getInstance().registerProcess( getName(), create );
}
hkProcess* HK_CALL hkpConstraintViewer::create(const hkArray<hkProcessContext*>& contexts)
{
return new hkpConstraintViewer(contexts);
}
hkpConstraintViewer::hkpConstraintViewer(const hkArray<hkProcessContext*>& contexts)
: hkpWorldViewerBase( contexts )
{
if (m_context)
{
for (int i=0; i < m_context->getNumWorlds(); ++i)
{
hkpWorld* world = m_context->getWorld(i);
// world->addConstraintListener( this );
world->markForWrite();
world->addWorldPostSimulationListener( this );
world->unmarkForWrite();
}
}
}
hkpConstraintViewer::~hkpConstraintViewer()
{
if (m_context)
{
for (int i=0; i < m_context->getNumWorlds(); ++i)
{
hkpWorld* world = m_context->getWorld(i);
// world->removeConstraintListener( this );
world->markForWrite();
world->removeWorldPostSimulationListener( this );
world->unmarkForWrite();
}
}
}
void hkpConstraintViewer::worldAddedCallback( hkpWorld* world)
{
// world->addConstraintListener( this );
world->markForWrite();
world->addWorldPostSimulationListener( this );
world->unmarkForWrite();
}
void hkpConstraintViewer::worldRemovedCallback( hkpWorld* world)
{
// world->removeConstraintListener( this );
world->markForWrite();
world->removeWorldPostSimulationListener( this );
world->unmarkForWrite();
}
void hkpConstraintViewer::postSimulationCallback( hkpWorld* world )
{
HK_TIMER_BEGIN("hkpConstraintViewer", this);
{
const hkArray<hkpSimulationIsland*>& islands = world->getActiveSimulationIslands();
for ( int i = 0; i < islands.getSize(); ++i )
{
for ( int e = 0; e < islands[i]->getEntities().getSize(); e++)
{
hkpEntity* entity = islands[i]->getEntities()[e];
const hkSmallArray<struct hkConstraintInternal>& constraintMasters = entity->getConstraintMasters();
for ( int c = 0; c < constraintMasters.getSize(); c++)
{
draw ( constraintMasters[c].m_constraint, m_displayHandler );
}
}
}
}
{
const hkArray<hkpSimulationIsland*>& islands = world->getInactiveSimulationIslands();
for ( int i = 0; i < islands.getSize(); ++i )
{
for ( int e = 0; e < islands[i]->getEntities().getSize(); e++)
{
hkpEntity* entity = islands[i]->getEntities()[e];
const hkSmallArray<struct hkConstraintInternal>& constraintMasters = entity->getConstraintMasters();
for ( int c = 0; c < constraintMasters.getSize(); c++)
{
draw ( constraintMasters[c].m_constraint, m_displayHandler );
}
}
}
}
HK_TIMER_END();
}
void hkpConstraintViewer::draw(hkpConstraintInstance* constraint, hkDebugDisplayHandler* displayHandler)
{
HK_TIMER_BEGIN("draw", this);
int type = constraint->getData()->getType();
HK_ASSERT2(0x21d74fd9, displayHandler,"displayHandler is NULL");
switch(type)
{
case hkpConstraintData::CONSTRAINT_TYPE_BALLANDSOCKET:
{
hkpBallSocketDrawer ballSocketDrawer;
ballSocketDrawer.drawConstraint(constraint, displayHandler, m_tag);
}
break;
case hkpConstraintData::CONSTRAINT_TYPE_HINGE:
{
hkpHingeDrawer hingeDrawer;
hingeDrawer.drawConstraint(constraint, displayHandler, m_tag);
}
break;
case hkpConstraintData::CONSTRAINT_TYPE_LIMITEDHINGE:
{
hkpLimitedHingeDrawer limitedHingeDrawer;
limitedHingeDrawer.drawConstraint(constraint, displayHandler, m_tag);
}
break;
case hkpConstraintData::CONSTRAINT_TYPE_PRISMATIC:
{
hkpPrismaticDrawer prismaticDrawer;
prismaticDrawer.drawConstraint(constraint, displayHandler, m_tag);
}
break;
case hkpConstraintData::CONSTRAINT_TYPE_STIFFSPRING:
{
hkpStiffSpringDrawer stiffSpringDrawer;
stiffSpringDrawer.drawConstraint(constraint, displayHandler, m_tag);
}
break;
case hkpConstraintData::CONSTRAINT_TYPE_WHEEL:
{
hkpWheelDrawer wheelDrawer;
wheelDrawer.drawConstraint(constraint, displayHandler, m_tag);
}
break;
case hkpConstraintData::CONSTRAINT_TYPE_POINTTOPATH:
{
hkpPointToPathDrawer pToPDrawer;
pToPDrawer.drawConstraint(constraint, displayHandler, m_tag);
}
break;
case hkpConstraintData::CONSTRAINT_TYPE_POINTTOPLANE:
{
hkpPointToPlaneDrawer pToPlaneDrawer;
pToPlaneDrawer.drawConstraint(constraint, displayHandler, m_tag);
}
break;
case hkpConstraintData::CONSTRAINT_TYPE_RAGDOLL:
{
hkpRagdollDrawer ragdollDrawer;
ragdollDrawer.drawConstraint(constraint, displayHandler, m_tag);
}
break;
case hkpConstraintData::CONSTRAINT_TYPE_BREAKABLE:
{
hkpBreakableConstraintData* breakableConstraint = static_cast<hkpBreakableConstraintData*>(constraint->getData());
hkpConstraintInstance fakeConstraint(constraint->getEntityA(), constraint->getEntityB(), breakableConstraint->getWrappedConstraintData() );
draw(&fakeConstraint, displayHandler);
}
break;
case hkpConstraintData::CONSTRAINT_TYPE_MALLEABLE:
{
hkpMalleableConstraintData* malleableConstraint = static_cast<hkpMalleableConstraintData*>(constraint->getData());
hkpConstraintInstance fakeConstraint(constraint->getEntityA(), constraint->getEntityB(), malleableConstraint->getWrappedConstraintData() );
draw(&fakeConstraint, displayHandler);
}
break;
case hkpConstraintData::CONSTRAINT_TYPE_PULLEY:
{
hkpPulleyDrawer drawer;
drawer.drawConstraint(constraint, displayHandler, m_tag);
}
break;
case hkpConstraintData::CONSTRAINT_TYPE_STIFF_SPRING_CHAIN:
case hkpConstraintData::CONSTRAINT_TYPE_BALL_SOCKET_CHAIN:
case hkpConstraintData::CONSTRAINT_TYPE_POWERED_CHAIN:
{
hkpConstraintChainDrawer drawer;
drawer.drawConstraint(constraint, displayHandler, m_tag);
}
break;
case hkpConstraintData::CONSTRAINT_TYPE_HINGE_LIMITS:
{
hkpHingeLimitsDrawer drawer;
drawer.drawConstraint(constraint, displayHandler, m_tag);
}
break;
case hkpConstraintData::CONSTRAINT_TYPE_RAGDOLL_LIMITS:
{
hkpRagdollLimitsDrawer drawer;
drawer.drawConstraint(constraint, displayHandler, m_tag);
}
break;
}
HK_TIMER_END();
}
/*
* Havok SDK - PUBLIC RELEASE, BUILD(#20070919)
*
* Confidential Information of Havok. (C) Copyright 1999-2007
* Telekinesys Research Limited t/a Havok. All Rights Reserved. The Havok
* Logo, and the Havok buzzsaw logo are trademarks of Havok. Title, ownership
* rights, and intellectual property rights in the Havok software remain in
* Havok and/or its suppliers.
*
* Use of this software for evaluation purposes is subject to and indicates
* acceptance of the End User licence Agreement for this product. A copy of
* the license is included with this software and is also available from salesteam@havok.com.
*
*/
| [
"benjamin.barratt@icloud.com"
] | benjamin.barratt@icloud.com |
4b9e0547da09f5d782d3e4edd8810105949597f7 | 6d447ef106f3dd64eecbb9a6112d014b93e4d826 | /src/qt/bitcoinunits.cpp | 123adcbde426148adc502951e242bab90ea4ba6e | [
"MIT"
] | permissive | dtbcoinlab/dtbcoin | af853157ec69f466af0f8dd9d98466505251593f | 087d0b0feb1846c6de7eaaae6bc5eb7f4c7a3ab9 | refs/heads/master | 2021-01-21T02:30:36.798940 | 2015-04-21T08:45:26 | 2015-04-21T08:45:26 | 30,407,733 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,273 | cpp | #include "bitcoinunits.h"
#include <QStringList>
BitcoinUnits::BitcoinUnits(QObject *parent):
QAbstractListModel(parent),
unitlist(availableUnits())
{
}
QList<BitcoinUnits::Unit> BitcoinUnits::availableUnits()
{
QList<BitcoinUnits::Unit> unitlist;
unitlist.append(BTC);
unitlist.append(mBTC);
unitlist.append(uBTC);
return unitlist;
}
bool BitcoinUnits::valid(int unit)
{
switch(unit)
{
case BTC:
case mBTC:
case uBTC:
return true;
default:
return false;
}
}
QString BitcoinUnits::name(int unit)
{
switch(unit)
{
case BTC: return QString("DTC");
case mBTC: return QString("mDTC");
case uBTC: return QString::fromUtf8("μDTC");
default: return QString("???");
}
}
QString BitcoinUnits::description(int unit)
{
switch(unit)
{
case BTC: return QString("DtbCoins");
case mBTC: return QString("Milli-DtbCoins (1 / 1,000)");
case uBTC: return QString("Micro-DtbCoins (1 / 1,000,000)");
default: return QString("???");
}
}
qint64 BitcoinUnits::factor(int unit)
{
switch(unit)
{
case BTC: return 1000000;
case mBTC: return 1000;
case uBTC: return 1;
default: return 1000000;
}
}
int BitcoinUnits::amountDigits(int unit)
{
switch(unit)
{
case BTC: return 8; // 21,000,000 (# digits, without commas)
case mBTC: return 11; // 21,000,000,000
case uBTC: return 14; // 21,000,000,000,000
default: return 0;
}
}
int BitcoinUnits::decimals(int unit)
{
switch(unit)
{
case BTC: return 6;
case mBTC: return 3;
case uBTC: return 0;
default: return 0;
}
}
QString BitcoinUnits::format(int unit, qint64 n, bool fPlus)
{
// Note: not using straight sprintf here because we do NOT want
// localized number formatting.
if(!valid(unit))
return QString(); // Refuse to format invalid unit
qint64 coin = factor(unit);
int num_decimals = decimals(unit);
qint64 n_abs = (n > 0 ? n : -n);
qint64 quotient = n_abs / coin;
qint64 remainder = n_abs % coin;
QString quotient_str = QString::number(quotient);
QString remainder_str = QString::number(remainder).rightJustified(num_decimals, '0');
// Right-trim excess zeros after the decimal point
int nTrim = 0;
for (int i = remainder_str.size()-1; i>=2 && (remainder_str.at(i) == '0'); --i)
++nTrim;
remainder_str.chop(nTrim);
if (n < 0)
quotient_str.insert(0, '-');
else if (fPlus && n > 0)
quotient_str.insert(0, '+');
return quotient_str + QString(".") + remainder_str;
}
QString BitcoinUnits::formatWithUnit(int unit, qint64 amount, bool plussign)
{
return format(unit, amount, plussign) + QString(" ") + name(unit);
}
bool BitcoinUnits::parse(int unit, const QString &value, qint64 *val_out)
{
if(!valid(unit) || value.isEmpty())
return false; // Refuse to parse invalid unit or empty string
int num_decimals = decimals(unit);
QStringList parts = value.split(".");
if(parts.size() > 2)
{
return false; // More than one dot
}
QString whole = parts[0];
QString decimals;
if(parts.size() > 1)
{
decimals = parts[1];
}
if(decimals.size() > num_decimals)
{
return false; // Exceeds max precision
}
bool ok = false;
QString str = whole + decimals.leftJustified(num_decimals, '0');
if(str.size() > 18)
{
return false; // Longer numbers will exceed 63 bits
}
qint64 retvalue = str.toLongLong(&ok);
if(val_out)
{
*val_out = retvalue;
}
return ok;
}
int BitcoinUnits::rowCount(const QModelIndex &parent) const
{
Q_UNUSED(parent);
return unitlist.size();
}
QVariant BitcoinUnits::data(const QModelIndex &index, int role) const
{
int row = index.row();
if(row >= 0 && row < unitlist.size())
{
Unit unit = unitlist.at(row);
switch(role)
{
case Qt::EditRole:
case Qt::DisplayRole:
return QVariant(name(unit));
case Qt::ToolTipRole:
return QVariant(description(unit));
case UnitRole:
return QVariant(static_cast<int>(unit));
}
}
return QVariant();
}
| [
"support@CryptoCoinLab.com"
] | support@CryptoCoinLab.com |
898553fdf57ee2b38cdc5b52a08b6f7c0dcb786a | e5dc90655caa598fae65f95a14bc2a93084cf854 | /src/cpu/ref_resampling.cpp | ec7f0f90135bdbace22b241c0205b394dc33f1ac | [
"Apache-2.0",
"BSD-3-Clause",
"BSL-1.0",
"BSD-2-Clause"
] | permissive | dongxiao92/ZenDNN | d4bedf41c2166f63f55eea4b08e1801be04a8404 | 99e79349fe4bd512711ebc4d63deba69a732a18e | refs/heads/main | 2023-07-10T01:30:57.527781 | 2021-08-11T13:30:35 | 2021-08-11T13:30:35 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 8,692 | cpp | /*******************************************************************************
* Modifications Copyright (c) 2021 Advanced Micro Devices, Inc. All rights reserved.
* Notified per clause 4(b) of the license.
*******************************************************************************/
/*******************************************************************************
* Copyright 2019-2020 Intel Corporation
*
* 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 <assert.h>
#include <float.h>
#include <math.h>
#include "common/c_types_map.hpp"
#include "common/zendnn_thread.hpp"
#include "common/math_utils.hpp"
#include "common/type_helpers.hpp"
#include "cpu/resampling_utils.hpp"
#include "cpu/ref_resampling.hpp"
namespace zendnn {
namespace impl {
namespace cpu {
static inline dim_t get_offset(
const memory_desc_wrapper &data_d, int n, int c, int d, int h, int w) {
if (data_d.ndims() == 5)
return data_d.off(n, c, d, h, w);
else if (data_d.ndims() == 4)
return data_d.off(n, c, h, w);
else
return data_d.off(n, c, w);
}
using namespace resampling_utils;
template <impl::data_type_t data_type>
void ref_resampling_fwd_t<data_type>::execute_forward(
const exec_ctx_t &ctx) const {
if (this->pd()->has_zero_dim_memory()) return;
const auto src = CTX_IN_MEM(const data_t *, ZENDNN_ARG_SRC);
auto dst = CTX_OUT_MEM(data_t *, ZENDNN_ARG_DST);
const memory_desc_wrapper src_d(pd()->src_md());
const memory_desc_wrapper dst_d(pd()->dst_md());
const auto alg = pd()->desc()->alg_kind;
const int MB = pd()->MB();
const int C = pd()->C();
const int ID = pd()->ID();
const int IH = pd()->IH();
const int IW = pd()->IW();
const int OD = pd()->OD();
const int OH = pd()->OH();
const int OW = pd()->OW();
auto lin_interp = [&](float c0, float c1, float w) {
return c0 * w + c1 * (1 - w);
};
auto bilin_interp = [&](float c00, float c01, float c10, float c11,
float w0, float w1) {
return lin_interp(
lin_interp(c00, c10, w0), lin_interp(c01, c11, w0), w1);
};
auto trilin_interp = [&](float c000, float c001, float c010, float c011,
float c100, float c101, float c110, float c111,
float w0, float w1, float w2) {
return lin_interp(bilin_interp(c000, c010, c100, c110, w0, w1),
bilin_interp(c001, c011, c101, c111, w0, w1), w2);
};
parallel_nd(MB, C, OD, OH, OW,
[&](dim_t mb, dim_t ch, dim_t od, dim_t oh, dim_t ow) {
if (alg == alg_kind::resampling_nearest) {
const dim_t id = nearest_idx(od, OD, ID);
const dim_t ih = nearest_idx(oh, OH, IH);
const dim_t iw = nearest_idx(ow, OW, IW);
dst[get_offset(dst_d, mb, ch, od, oh, ow)]
= src[get_offset(src_d, mb, ch, id, ih, iw)];
} else if (alg == alg_kind::resampling_linear) {
// Trilinear interpolation (linear interpolation on a 3D spatial
// tensor) can be expressed as linear interpolation along
// dimension x followed by interpolation along dimension y and z
// C011--C11--C111
// - - |
// - - |
//C001--C01--C111 |
// - .C - C110
// - - -
// - - -
//C000--C00--C100
auto id = linear_coeffs_t(od, OD, ID);
auto iw = linear_coeffs_t(ow, OW, IW);
auto ih = linear_coeffs_t(oh, OH, IH);
data_t src_l[8] = {0};
for_(int i = 0; i < 2; i++)
for_(int j = 0; j < 2; j++)
for (int k = 0; k < 2; k++) {
src_l[4 * i + 2 * j + k] = src[get_offset(src_d, mb, ch,
id.idx[i], ih.idx[j], iw.idx[k])];
}
dst[get_offset(dst_d, mb, ch, od, oh, ow)]
= trilin_interp(src_l[0], src_l[1], src_l[2],
src_l[3], src_l[4], src_l[5], src_l[6],
src_l[7], id.wei[0], ih.wei[0], iw.wei[0]);
}
});
}
template struct ref_resampling_fwd_t<data_type::f32>;
template struct ref_resampling_fwd_t<data_type::bf16>;
template <impl::data_type_t data_type>
void ref_resampling_bwd_t<data_type>::execute_backward(
const exec_ctx_t &ctx) const {
if (this->pd()->has_zero_dim_memory()) return;
const auto diff_dst = CTX_IN_MEM(const data_t *, ZENDNN_ARG_DIFF_DST);
auto diff_src = CTX_OUT_MEM(data_t *, ZENDNN_ARG_DIFF_SRC);
const memory_desc_wrapper diff_src_d(pd()->diff_src_md());
const memory_desc_wrapper diff_dst_d(pd()->diff_dst_md());
const auto alg = pd()->desc()->alg_kind;
const int MB = pd()->MB();
const int C = pd()->C();
const int ID = pd()->ID();
const int IH = pd()->IH();
const int IW = pd()->IW();
const int OD = pd()->OD();
const int OH = pd()->OH();
const int OW = pd()->OW();
if (alg == alg_kind::resampling_nearest) {
parallel_nd(MB, C, ID, IH, IW,
[&](dim_t mb, dim_t ch, dim_t id, dim_t ih, dim_t iw) {
const dim_t od_start
= ceil_idx(((float)id * OD / ID) - 0.5f);
const dim_t oh_start
= ceil_idx(((float)ih * OH / IH) - 0.5f);
const dim_t ow_start
= ceil_idx(((float)iw * OW / IW) - 0.5f);
const dim_t od_end
= ceil_idx(((id + 1.f) * OD / ID) - 0.5f);
const dim_t oh_end
= ceil_idx(((ih + 1.f) * OH / IH) - 0.5f);
const dim_t ow_end
= ceil_idx(((iw + 1.f) * OW / IW) - 0.5f);
float ds = 0;
for_(dim_t od = od_start; od < od_end; od++)
for_(dim_t oh = oh_start; oh < oh_end; oh++)
for (dim_t ow = ow_start; ow < ow_end; ow++)
ds += diff_dst[get_offset(
diff_dst_d, mb, ch, od, oh, ow)];
diff_src[get_offset(diff_src_d, mb, ch, id, ih, iw)] = ds;
});
return;
} else {
parallel_nd(MB, C, ID, IH, IW,
[&](dim_t mb, dim_t ch, dim_t id, dim_t ih, dim_t iw) {
bwd_linear_coeffs_t d(id, OD, ID);
bwd_linear_coeffs_t h(ih, OH, IH);
bwd_linear_coeffs_t w(iw, OW, IW);
float ds = 0;
for_(int i = 0; i < 2; i++)
for_(int j = 0; j < 2; j++)
for_(int k = 0; k < 2; k++)
for_(dim_t od = d.start[i]; od < d.end[i]; od++)
for_(dim_t oh = h.start[j]; oh < h.end[j]; oh++)
for (dim_t ow = w.start[k]; ow < w.end[k]; ow++) {
const float weight_d = linear_weight(i, od, OD, ID);
const float weight_h = linear_weight(j, oh, OH, IH);
const float weight_w = linear_weight(k, ow, OW, IW);
float dd = diff_dst[get_offset(
diff_dst_d, mb, ch, od, oh, ow)];
ds += dd * weight_d * weight_h * weight_w;
}
diff_src[get_offset(diff_src_d, mb, ch, id, ih, iw)] = ds;
});
}
}
template struct ref_resampling_bwd_t<data_type::f32>;
template struct ref_resampling_bwd_t<data_type::bf16>;
} // namespace cpu
} // namespace impl
} // namespace zendnn
// vim: et ts=4 sw=4 cindent cino+=l0,\:4,N-s
| [
"ratan.prasad2@amd.com"
] | ratan.prasad2@amd.com |
d5568621be9a02c6a90cecd37f9d5a79a78108b0 | 6cdab106d362a55dfe5e47a82d7e9d17602242ae | /leveldb/include/leveldb/db.h | c34ca589638ed046d7838996528e14cc785c823a | [
"BSD-3-Clause"
] | permissive | datalogistics/ibp_server | a76706f07f968b1bafd491f9acb3ac36d8f290d6 | 7ca8962e9f4a05be559942aa32b14729f46cb2c9 | refs/heads/master | 2020-04-06T07:05:18.127134 | 2017-04-19T11:04:57 | 2017-04-19T11:04:57 | 12,297,761 | 1 | 1 | null | 2016-03-04T17:45:28 | 2013-08-22T13:34:30 | C | UTF-8 | C++ | false | false | 7,264 | h | // Copyright (c) 2011 The LevelDB Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. See the AUTHORS file for names of contributors.
#ifndef STORAGE_LEVELDB_INCLUDE_DB_H_
#define STORAGE_LEVELDB_INCLUDE_DB_H_
#include <stdint.h>
#include <stdio.h>
#include "leveldb/iterator.h"
#include "leveldb/options.h"
namespace leveldb {
// Update Makefile if you change these
static const int kMajorVersion = 1;
static const int kMinorVersion = 9;
struct Options;
struct ReadOptions;
struct WriteOptions;
class WriteBatch;
// Abstract handle to particular state of a DB.
// A Snapshot is an immutable object and can therefore be safely
// accessed from multiple threads without any external synchronization.
class Snapshot {
protected:
virtual ~Snapshot();
};
// A range of keys
struct Range {
Slice start; // Included in the range
Slice limit; // Not included in the range
Range() { }
Range(const Slice& s, const Slice& l) : start(s), limit(l) { }
};
// Abstract holder for a DB value.
// This allows callers to manage their own value buffers and have
// DB values copied directly into those buffers.
class Value {
public:
virtual Value& assign(const char* data, size_t size) = 0;
protected:
virtual ~Value();
};
// A DB is a persistent ordered map from keys to values.
// A DB is safe for concurrent access from multiple threads without
// any external synchronization.
class DB {
public:
// Open the database with the specified "name".
// Stores a pointer to a heap-allocated database in *dbptr and returns
// OK on success.
// Stores NULL in *dbptr and returns a non-OK status on error.
// Caller should delete *dbptr when it is no longer needed.
static Status Open(const Options& options,
const std::string& name,
DB** dbptr);
DB() { }
virtual ~DB();
// Set the database entry for "key" to "value". Returns OK on success,
// and a non-OK status on error.
// Note: consider setting options.sync = true.
virtual Status Put(const WriteOptions& options,
const Slice& key,
const Slice& value) = 0;
// Remove the database entry (if any) for "key". Returns OK on
// success, and a non-OK status on error. It is not an error if "key"
// did not exist in the database.
// Note: consider setting options.sync = true.
virtual Status Delete(const WriteOptions& options, const Slice& key) = 0;
// Apply the specified updates to the database.
// Returns OK on success, non-OK on failure.
// Note: consider setting options.sync = true.
virtual Status Write(const WriteOptions& options, WriteBatch* updates) = 0;
// If the database contains an entry for "key" store the
// corresponding value in *value and return OK.
//
// If there is no entry for "key" leave *value unchanged and return
// a status for which Status::IsNotFound() returns true.
//
// May return some other Status on an error.
virtual Status Get(const ReadOptions& options,
const Slice& key, std::string* value) = 0;
virtual Status Get(const ReadOptions& options,
const Slice& key, Value* value) = 0;
// Return a heap-allocated iterator over the contents of the database.
// The result of NewIterator() is initially invalid (caller must
// call one of the Seek methods on the iterator before using it).
//
// Caller should delete the iterator when it is no longer needed.
// The returned iterator should be deleted before this db is deleted.
virtual Iterator* NewIterator(const ReadOptions& options) = 0;
// Return a handle to the current DB state. Iterators created with
// this handle will all observe a stable snapshot of the current DB
// state. The caller must call ReleaseSnapshot(result) when the
// snapshot is no longer needed.
virtual const Snapshot* GetSnapshot() = 0;
// Release a previously acquired snapshot. The caller must not
// use "snapshot" after this call.
virtual void ReleaseSnapshot(const Snapshot* snapshot) = 0;
// DB implementations can export properties about their state
// via this method. If "property" is a valid property understood by this
// DB implementation, fills "*value" with its current value and returns
// true. Otherwise returns false.
//
//
// Valid property names include:
//
// "leveldb.num-files-at-level<N>" - return the number of files at level <N>,
// where <N> is an ASCII representation of a level number (e.g. "0").
// "leveldb.stats" - returns a multi-line string that describes statistics
// about the internal operation of the DB.
// "leveldb.sstables" - returns a multi-line string that describes all
// of the sstables that make up the db contents.
virtual bool GetProperty(const Slice& property, std::string* value) = 0;
// For each i in [0,n-1], store in "sizes[i]", the approximate
// file system space used by keys in "[range[i].start .. range[i].limit)".
//
// Note that the returned sizes measure file system space usage, so
// if the user data compresses by a factor of ten, the returned
// sizes will be one-tenth the size of the corresponding user data size.
//
// The results may not include the sizes of recently written data.
virtual void GetApproximateSizes(const Range* range, int n,
uint64_t* sizes) = 0;
// Compact the underlying storage for the key range [*begin,*end].
// In particular, deleted and overwritten versions are discarded,
// and the data is rearranged to reduce the cost of operations
// needed to access the data. This operation should typically only
// be invoked by users who understand the underlying implementation.
//
// begin==NULL is treated as a key before all keys in the database.
// end==NULL is treated as a key after all keys in the database.
// Therefore the following call will compact the entire database:
// db->CompactRange(NULL, NULL);
virtual void CompactRange(const Slice* begin, const Slice* end) = 0;
// Riak specific function: Verify that no .sst files overlap
// within the levels that expect non-overlapping files. Run
// compactions as necessary to correct. Assumes DB opened
// with Options.is_repair=true
virtual Status VerifyLevels();
// Riak specific function: Request database check for
// available compactions. This is to stimulate retry of
// grooming that might have been offered and rejected previously
virtual void CheckAvailableCompactions();
private:
// No copying allowed
DB(const DB&);
void operator=(const DB&);
};
// Destroy the contents of the specified database.
// Be very careful using this method.
Status DestroyDB(const std::string& name, const Options& options);
// If a DB cannot be opened, you may attempt to call this method to
// resurrect as much of the contents of the database as possible.
// Some data may be lost, so be careful when calling this function
// on a database that contains important information.
Status RepairDB(const std::string& dbname, const Options& options);
} // namespace leveldb
#endif // STORAGE_LEVELDB_INCLUDE_DB_H_
| [
"andrew.m.melo@vanderbilt.edu"
] | andrew.m.melo@vanderbilt.edu |
362e46d2acd02a29546e538e4e8e00590a7afddf | 52a3c93c38bef127eaee4420f36a89d929a321c5 | /SDK/SoT_Animation_functions.cpp | e00afb95adf6d02c178845ee25902f4edd00812b | [] | no_license | RDTCREW/SoT-SDK_2_0_7_reserv | 8e921275508d09e5f81b10f9a43e47597223cb35 | db6a5fc4cdb9348ddfda88121ebe809047aa404a | refs/heads/master | 2020-07-24T17:18:40.537329 | 2019-09-11T18:53:58 | 2019-09-11T18:53:58 | 207,991,316 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 43,967 | cpp | // Sea of Thieves (2.0) SDK
#ifdef _MSC_VER
#pragma pack(push, 0x8)
#endif
#include "SoT_Animation_classes.hpp"
namespace SDK
{
//---------------------------------------------------------------------------
//Functions
//---------------------------------------------------------------------------
// Function Animation.AnimationDataFunctionLib.UnwrapAnimDataEntryStruct
// (Final, Native, Static, Public, HasOutParms, BlueprintCallable, BlueprintPure)
// Parameters:
// struct FAnimDataEntryStructWrapper Wrapper (ConstParm, Parm, OutParm, ReferenceParm)
// class UScriptStruct* DestinationStruct (Parm, ZeroConstructor, IsPlainOldData)
// struct FGenericStruct Value (Parm, OutParm, ZeroConstructor, IsPlainOldData)
// bool ReturnValue (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData)
bool UAnimationDataFunctionLib::UnwrapAnimDataEntryStruct(const struct FAnimDataEntryStructWrapper& Wrapper, class UScriptStruct* DestinationStruct, struct FGenericStruct* Value)
{
static auto fn = UObject::FindObject<UFunction>(_xor_("Function Animation.AnimationDataFunctionLib.UnwrapAnimDataEntryStruct"));
struct
{
struct FAnimDataEntryStructWrapper Wrapper;
class UScriptStruct* DestinationStruct;
struct FGenericStruct Value;
bool ReturnValue;
} params;
params.Wrapper = Wrapper;
params.DestinationStruct = DestinationStruct;
static auto defaultObj = StaticClass()->CreateDefaultObject();
defaultObj->ProcessEvent(fn, ¶ms);
if (Value != nullptr)
*Value = params.Value;
return params.ReturnValue;
}
// Function Animation.AnimationDataFunctionLib.MakeAnimationData
// (Final, Native, Static, Public, BlueprintCallable, BlueprintPure)
// Parameters:
// class UClass* Class (Parm, ZeroConstructor, IsPlainOldData)
// class UAnimationData* ReturnValue (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData)
class UAnimationData* UAnimationDataFunctionLib::MakeAnimationData(class UClass* Class)
{
static auto fn = UObject::FindObject<UFunction>(_xor_("Function Animation.AnimationDataFunctionLib.MakeAnimationData"));
struct
{
class UClass* Class;
class UAnimationData* ReturnValue;
} params;
params.Class = Class;
static auto defaultObj = StaticClass()->CreateDefaultObject();
defaultObj->ProcessEvent(fn, ¶ms);
return params.ReturnValue;
}
// Function Animation.AnimationDataFunctionLib.GetAnimDataEntryStructAsStructWrapper
// (Final, Native, Static, Public, BlueprintCallable, BlueprintPure)
// Parameters:
// class UAnimationData* AnimationDataObject (Parm, ZeroConstructor, IsPlainOldData)
// class UScriptStruct* TheClass (Parm, ZeroConstructor, IsPlainOldData)
// struct FAnimDataEntryStructWrapper ReturnValue (Parm, OutParm, ReturnParm)
struct FAnimDataEntryStructWrapper UAnimationDataFunctionLib::GetAnimDataEntryStructAsStructWrapper(class UAnimationData* AnimationDataObject, class UScriptStruct* TheClass)
{
static auto fn = UObject::FindObject<UFunction>(_xor_("Function Animation.AnimationDataFunctionLib.GetAnimDataEntryStructAsStructWrapper"));
struct
{
class UAnimationData* AnimationDataObject;
class UScriptStruct* TheClass;
struct FAnimDataEntryStructWrapper ReturnValue;
} params;
params.AnimationDataObject = AnimationDataObject;
params.TheClass = TheClass;
static auto defaultObj = StaticClass()->CreateDefaultObject();
defaultObj->ProcessEvent(fn, ¶ms);
return params.ReturnValue;
}
// Function Animation.AnimationDataFunctionLib.CheckAnimDataClassTypeForDuplicateAnimDataEntryStructs
// (Final, Native, Static, Public)
// Parameters:
// class UClass* InClass (Parm, ZeroConstructor, IsPlainOldData)
void UAnimationDataFunctionLib::CheckAnimDataClassTypeForDuplicateAnimDataEntryStructs(class UClass* InClass)
{
static auto fn = UObject::FindObject<UFunction>(_xor_("Function Animation.AnimationDataFunctionLib.CheckAnimDataClassTypeForDuplicateAnimDataEntryStructs"));
struct
{
class UClass* InClass;
} params;
params.InClass = InClass;
static auto defaultObj = StaticClass()->CreateDefaultObject();
defaultObj->ProcessEvent(fn, ¶ms);
}
// Function Animation.AnimationDataStoreAsset.LookupAnimationData
// (Final, Native, Public, BlueprintCallable)
// Parameters:
// class UClass* AnimDataId (Parm, ZeroConstructor, IsPlainOldData)
// class UAnimationData* ReturnValue (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData)
class UAnimationData* UAnimationDataStoreAsset::LookupAnimationData(class UClass* AnimDataId)
{
static auto fn = UObject::FindObject<UFunction>(_xor_("Function Animation.AnimationDataStoreAsset.LookupAnimationData"));
struct
{
class UClass* AnimDataId;
class UAnimationData* ReturnValue;
} params;
params.AnimDataId = AnimDataId;
UObject::ProcessEvent(fn, ¶ms);
return params.ReturnValue;
}
// Function Animation.AnimationDataStoreAsset.GetAnimationDataClass
// (Final, Native, Static, Public, HasOutParms, BlueprintCallable)
// Parameters:
// struct FAnimationDataStoreAssetEntry Entry (Parm, OutParm, ReferenceParm)
// class UClass* ReturnValue (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData)
class UClass* UAnimationDataStoreAsset::GetAnimationDataClass(struct FAnimationDataStoreAssetEntry* Entry)
{
static auto fn = UObject::FindObject<UFunction>(_xor_("Function Animation.AnimationDataStoreAsset.GetAnimationDataClass"));
struct
{
struct FAnimationDataStoreAssetEntry Entry;
class UClass* ReturnValue;
} params;
static auto defaultObj = StaticClass()->CreateDefaultObject();
defaultObj->ProcessEvent(fn, ¶ms);
if (Entry != nullptr)
*Entry = params.Entry;
return params.ReturnValue;
}
// Function Animation.AnimationDataStoreInterface.GetAnimationDataForId
// (Native, Public, BlueprintCallable, BlueprintPure, Const)
// Parameters:
// class UClass* AnimDataId (Parm, ZeroConstructor, IsPlainOldData)
// class UAnimationData* ReturnValue (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData)
class UAnimationData* UAnimationDataStoreInterface::GetAnimationDataForId(class UClass* AnimDataId)
{
static auto fn = UObject::FindObject<UFunction>(_xor_("Function Animation.AnimationDataStoreInterface.GetAnimationDataForId"));
struct
{
class UClass* AnimDataId;
class UAnimationData* ReturnValue;
} params;
params.AnimDataId = AnimDataId;
UObject::ProcessEvent(fn, ¶ms);
return params.ReturnValue;
}
// Function Animation.DockableInterface.HandleDestroy
// (Native, Public)
void UDockableInterface::HandleDestroy()
{
static auto fn = UObject::FindObject<UFunction>(_xor_("Function Animation.DockableInterface.HandleDestroy"));
struct
{
} params;
UObject::ProcessEvent(fn, ¶ms);
}
// Function Animation.DockableInterface.GetDockableInfo
// (Native, Event, Public, BlueprintCallable, BlueprintEvent)
// Parameters:
// struct FDockableInfo ReturnValue (Parm, OutParm, ReturnParm)
struct FDockableInfo UDockableInterface::GetDockableInfo()
{
static auto fn = UObject::FindObject<UFunction>(_xor_("Function Animation.DockableInterface.GetDockableInfo"));
struct
{
struct FDockableInfo ReturnValue;
} params;
UObject::ProcessEvent(fn, ¶ms);
return params.ReturnValue;
}
// Function Animation.DockerBlueprintFunctions.UpdateDock
// (Final, Native, Static, Public, HasOutParms, BlueprintCallable)
// Parameters:
// struct FDocker Docker (Parm, OutParm, ReferenceParm)
// float DeltaTime (ConstParm, Parm, ZeroConstructor, IsPlainOldData)
void UDockerBlueprintFunctions::UpdateDock(float DeltaTime, struct FDocker* Docker)
{
static auto fn = UObject::FindObject<UFunction>(_xor_("Function Animation.DockerBlueprintFunctions.UpdateDock"));
struct
{
struct FDocker Docker;
float DeltaTime;
} params;
params.DeltaTime = DeltaTime;
static auto defaultObj = StaticClass()->CreateDefaultObject();
defaultObj->ProcessEvent(fn, ¶ms);
if (Docker != nullptr)
*Docker = params.Docker;
}
// Function Animation.DockerBlueprintFunctions.StartDockingWithActor
// (Final, Native, Static, Public, HasOutParms, BlueprintCallable)
// Parameters:
// struct FDocker Docker (Parm, OutParm, ReferenceParm)
// class AActor* Owner (Parm, ZeroConstructor, IsPlainOldData)
// class AActor* Target (Parm, ZeroConstructor, IsPlainOldData)
// float DockDuration (ConstParm, Parm, ZeroConstructor, IsPlainOldData)
// float DelayAfterDocking (ConstParm, Parm, ZeroConstructor, IsPlainOldData)
void UDockerBlueprintFunctions::StartDockingWithActor(class AActor* Owner, class AActor* Target, float DockDuration, float DelayAfterDocking, struct FDocker* Docker)
{
static auto fn = UObject::FindObject<UFunction>(_xor_("Function Animation.DockerBlueprintFunctions.StartDockingWithActor"));
struct
{
struct FDocker Docker;
class AActor* Owner;
class AActor* Target;
float DockDuration;
float DelayAfterDocking;
} params;
params.Owner = Owner;
params.Target = Target;
params.DockDuration = DockDuration;
params.DelayAfterDocking = DelayAfterDocking;
static auto defaultObj = StaticClass()->CreateDefaultObject();
defaultObj->ProcessEvent(fn, ¶ms);
if (Docker != nullptr)
*Docker = params.Docker;
}
// Function Animation.DockerBlueprintFunctions.IsFullyDocked
// (Final, Native, Static, Public, HasOutParms, BlueprintCallable, BlueprintPure)
// Parameters:
// struct FDocker Docker (Parm, OutParm, ReferenceParm)
// bool ReturnValue (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData)
bool UDockerBlueprintFunctions::IsFullyDocked(struct FDocker* Docker)
{
static auto fn = UObject::FindObject<UFunction>(_xor_("Function Animation.DockerBlueprintFunctions.IsFullyDocked"));
struct
{
struct FDocker Docker;
bool ReturnValue;
} params;
static auto defaultObj = StaticClass()->CreateDefaultObject();
defaultObj->ProcessEvent(fn, ¶ms);
if (Docker != nullptr)
*Docker = params.Docker;
return params.ReturnValue;
}
// Function Animation.DockerBlueprintFunctions.IsDocking
// (Final, Native, Static, Public, HasOutParms, BlueprintCallable, BlueprintPure)
// Parameters:
// struct FDocker Docker (Parm, OutParm, ReferenceParm)
// bool ReturnValue (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData)
bool UDockerBlueprintFunctions::IsDocking(struct FDocker* Docker)
{
static auto fn = UObject::FindObject<UFunction>(_xor_("Function Animation.DockerBlueprintFunctions.IsDocking"));
struct
{
struct FDocker Docker;
bool ReturnValue;
} params;
static auto defaultObj = StaticClass()->CreateDefaultObject();
defaultObj->ProcessEvent(fn, ¶ms);
if (Docker != nullptr)
*Docker = params.Docker;
return params.ReturnValue;
}
// Function Animation.DockerBlueprintFunctions.GetTargetLocalOffset
// (Final, Native, Static, Public, HasOutParms, HasDefaults, BlueprintCallable, BlueprintPure)
// Parameters:
// struct FDocker Docker (ConstParm, Parm, OutParm, ReferenceParm)
// struct FVector ReturnValue (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData)
struct FVector UDockerBlueprintFunctions::GetTargetLocalOffset(const struct FDocker& Docker)
{
static auto fn = UObject::FindObject<UFunction>(_xor_("Function Animation.DockerBlueprintFunctions.GetTargetLocalOffset"));
struct
{
struct FDocker Docker;
struct FVector ReturnValue;
} params;
params.Docker = Docker;
static auto defaultObj = StaticClass()->CreateDefaultObject();
defaultObj->ProcessEvent(fn, ¶ms);
return params.ReturnValue;
}
// Function Animation.DockerBlueprintFunctions.EndDock
// (Final, Native, Static, Public, HasOutParms, BlueprintCallable)
// Parameters:
// struct FDocker Docker (Parm, OutParm, ReferenceParm)
void UDockerBlueprintFunctions::EndDock(struct FDocker* Docker)
{
static auto fn = UObject::FindObject<UFunction>(_xor_("Function Animation.DockerBlueprintFunctions.EndDock"));
struct
{
struct FDocker Docker;
} params;
static auto defaultObj = StaticClass()->CreateDefaultObject();
defaultObj->ProcessEvent(fn, ¶ms);
if (Docker != nullptr)
*Docker = params.Docker;
}
// Function Animation.LimbIKFunctionLibrary.SetTranslationStrength
// (Final, Native, Static, Public, HasOutParms, BlueprintCallable)
// Parameters:
// struct FLimbIK LimbIK (Parm, OutParm, ReferenceParm)
// float InRotationStrength (ConstParm, Parm, ZeroConstructor, IsPlainOldData)
void ULimbIKFunctionLibrary::SetTranslationStrength(float InRotationStrength, struct FLimbIK* LimbIK)
{
static auto fn = UObject::FindObject<UFunction>(_xor_("Function Animation.LimbIKFunctionLibrary.SetTranslationStrength"));
struct
{
struct FLimbIK LimbIK;
float InRotationStrength;
} params;
params.InRotationStrength = InRotationStrength;
static auto defaultObj = StaticClass()->CreateDefaultObject();
defaultObj->ProcessEvent(fn, ¶ms);
if (LimbIK != nullptr)
*LimbIK = params.LimbIK;
}
// Function Animation.LimbIKFunctionLibrary.SetTransform
// (Final, Native, Static, Public, HasOutParms, HasDefaults, BlueprintCallable)
// Parameters:
// struct FLimbIK LimbIK (Parm, OutParm, ReferenceParm)
// struct FTransform InTransform (ConstParm, Parm, IsPlainOldData)
void ULimbIKFunctionLibrary::SetTransform(const struct FTransform& InTransform, struct FLimbIK* LimbIK)
{
static auto fn = UObject::FindObject<UFunction>(_xor_("Function Animation.LimbIKFunctionLibrary.SetTransform"));
struct
{
struct FLimbIK LimbIK;
struct FTransform InTransform;
} params;
params.InTransform = InTransform;
static auto defaultObj = StaticClass()->CreateDefaultObject();
defaultObj->ProcessEvent(fn, ¶ms);
if (LimbIK != nullptr)
*LimbIK = params.LimbIK;
}
// Function Animation.LimbIKFunctionLibrary.SetRotationStrength
// (Final, Native, Static, Public, HasOutParms, BlueprintCallable)
// Parameters:
// struct FLimbIK LimbIK (Parm, OutParm, ReferenceParm)
// float InRotationStrength (ConstParm, Parm, ZeroConstructor, IsPlainOldData)
void ULimbIKFunctionLibrary::SetRotationStrength(float InRotationStrength, struct FLimbIK* LimbIK)
{
static auto fn = UObject::FindObject<UFunction>(_xor_("Function Animation.LimbIKFunctionLibrary.SetRotationStrength"));
struct
{
struct FLimbIK LimbIK;
float InRotationStrength;
} params;
params.InRotationStrength = InRotationStrength;
static auto defaultObj = StaticClass()->CreateDefaultObject();
defaultObj->ProcessEvent(fn, ¶ms);
if (LimbIK != nullptr)
*LimbIK = params.LimbIK;
}
// Function Animation.LimbIKFunctionLibrary.SetParentBone
// (Final, Native, Static, Public, HasOutParms, BlueprintCallable)
// Parameters:
// struct FLimbIK LimbIK (Parm, OutParm, ReferenceParm)
// struct FName Bone (ConstParm, Parm, OutParm, ZeroConstructor, ReferenceParm, IsPlainOldData)
void ULimbIKFunctionLibrary::SetParentBone(const struct FName& Bone, struct FLimbIK* LimbIK)
{
static auto fn = UObject::FindObject<UFunction>(_xor_("Function Animation.LimbIKFunctionLibrary.SetParentBone"));
struct
{
struct FLimbIK LimbIK;
struct FName Bone;
} params;
params.Bone = Bone;
static auto defaultObj = StaticClass()->CreateDefaultObject();
defaultObj->ProcessEvent(fn, ¶ms);
if (LimbIK != nullptr)
*LimbIK = params.LimbIK;
}
// Function Animation.LimbIKFunctionLibrary.SetIKSpace
// (Final, Native, Static, Public, HasOutParms, BlueprintCallable)
// Parameters:
// struct FLimbIK LimbIK (Parm, OutParm, ReferenceParm)
// TEnumAsByte<ELimbIKSpace> IKSpace (ConstParm, Parm, ZeroConstructor, IsPlainOldData)
void ULimbIKFunctionLibrary::SetIKSpace(TEnumAsByte<ELimbIKSpace> IKSpace, struct FLimbIK* LimbIK)
{
static auto fn = UObject::FindObject<UFunction>(_xor_("Function Animation.LimbIKFunctionLibrary.SetIKSpace"));
struct
{
struct FLimbIK LimbIK;
TEnumAsByte<ELimbIKSpace> IKSpace;
} params;
params.IKSpace = IKSpace;
static auto defaultObj = StaticClass()->CreateDefaultObject();
defaultObj->ProcessEvent(fn, ¶ms);
if (LimbIK != nullptr)
*LimbIK = params.LimbIK;
}
// Function Animation.LimbIKFunctionLibrary.SetEnabled
// (Final, Native, Static, Public, HasOutParms, BlueprintCallable)
// Parameters:
// struct FLimbIK LimbIK (Parm, OutParm, ReferenceParm)
// bool Enabled (ConstParm, Parm, ZeroConstructor, IsPlainOldData)
// TEnumAsByte<ELimbIKSpace> IKSpace (ConstParm, Parm, ZeroConstructor, IsPlainOldData)
// struct FName ParentBone (ConstParm, Parm, ZeroConstructor, IsPlainOldData)
void ULimbIKFunctionLibrary::SetEnabled(bool Enabled, TEnumAsByte<ELimbIKSpace> IKSpace, const struct FName& ParentBone, struct FLimbIK* LimbIK)
{
static auto fn = UObject::FindObject<UFunction>(_xor_("Function Animation.LimbIKFunctionLibrary.SetEnabled"));
struct
{
struct FLimbIK LimbIK;
bool Enabled;
TEnumAsByte<ELimbIKSpace> IKSpace;
struct FName ParentBone;
} params;
params.Enabled = Enabled;
params.IKSpace = IKSpace;
params.ParentBone = ParentBone;
static auto defaultObj = StaticClass()->CreateDefaultObject();
defaultObj->ProcessEvent(fn, ¶ms);
if (LimbIK != nullptr)
*LimbIK = params.LimbIK;
}
// Function Animation.LimbIKFunctionLibrary.SetBlendOutSpeed
// (Final, Native, Static, Public, HasOutParms, BlueprintCallable)
// Parameters:
// struct FLimbIK LimbIK (Parm, OutParm, ReferenceParm)
// float BlendOutSpeed (ConstParm, Parm, ZeroConstructor, IsPlainOldData)
void ULimbIKFunctionLibrary::SetBlendOutSpeed(float BlendOutSpeed, struct FLimbIK* LimbIK)
{
static auto fn = UObject::FindObject<UFunction>(_xor_("Function Animation.LimbIKFunctionLibrary.SetBlendOutSpeed"));
struct
{
struct FLimbIK LimbIK;
float BlendOutSpeed;
} params;
params.BlendOutSpeed = BlendOutSpeed;
static auto defaultObj = StaticClass()->CreateDefaultObject();
defaultObj->ProcessEvent(fn, ¶ms);
if (LimbIK != nullptr)
*LimbIK = params.LimbIK;
}
// Function Animation.LimbIKFunctionLibrary.SetBlendInSpeed
// (Final, Native, Static, Public, HasOutParms, BlueprintCallable)
// Parameters:
// struct FLimbIK LimbIK (Parm, OutParm, ReferenceParm)
// float BlendInSpeed (ConstParm, Parm, ZeroConstructor, IsPlainOldData)
void ULimbIKFunctionLibrary::SetBlendInSpeed(float BlendInSpeed, struct FLimbIK* LimbIK)
{
static auto fn = UObject::FindObject<UFunction>(_xor_("Function Animation.LimbIKFunctionLibrary.SetBlendInSpeed"));
struct
{
struct FLimbIK LimbIK;
float BlendInSpeed;
} params;
params.BlendInSpeed = BlendInSpeed;
static auto defaultObj = StaticClass()->CreateDefaultObject();
defaultObj->ProcessEvent(fn, ¶ms);
if (LimbIK != nullptr)
*LimbIK = params.LimbIK;
}
// Function Animation.LimbIKFunctionLibrary.SetAnimationOverride
// (Final, Native, Static, Public, HasOutParms, BlueprintCallable)
// Parameters:
// struct FLimbIK LimbIK (Parm, OutParm, ReferenceParm)
// bool AnimationOverride (ConstParm, Parm, ZeroConstructor, IsPlainOldData)
void ULimbIKFunctionLibrary::SetAnimationOverride(bool AnimationOverride, struct FLimbIK* LimbIK)
{
static auto fn = UObject::FindObject<UFunction>(_xor_("Function Animation.LimbIKFunctionLibrary.SetAnimationOverride"));
struct
{
struct FLimbIK LimbIK;
bool AnimationOverride;
} params;
params.AnimationOverride = AnimationOverride;
static auto defaultObj = StaticClass()->CreateDefaultObject();
defaultObj->ProcessEvent(fn, ¶ms);
if (LimbIK != nullptr)
*LimbIK = params.LimbIK;
}
// Function Animation.LimbIKFunctionLibrary.SetAlphaTarget
// (Final, Native, Static, Public, HasOutParms, BlueprintCallable)
// Parameters:
// struct FLimbIK LimbIK (Parm, OutParm, ReferenceParm)
// float AlphaTarget (ConstParm, Parm, ZeroConstructor, IsPlainOldData)
void ULimbIKFunctionLibrary::SetAlphaTarget(float AlphaTarget, struct FLimbIK* LimbIK)
{
static auto fn = UObject::FindObject<UFunction>(_xor_("Function Animation.LimbIKFunctionLibrary.SetAlphaTarget"));
struct
{
struct FLimbIK LimbIK;
float AlphaTarget;
} params;
params.AlphaTarget = AlphaTarget;
static auto defaultObj = StaticClass()->CreateDefaultObject();
defaultObj->ProcessEvent(fn, ¶ms);
if (LimbIK != nullptr)
*LimbIK = params.LimbIK;
}
// Function Animation.LimbIKFunctionLibrary.IsEnabled
// (Final, Native, Static, Public, HasOutParms, BlueprintCallable, BlueprintPure)
// Parameters:
// struct FLimbIK LimbIK (Parm, OutParm, ReferenceParm)
// bool ReturnValue (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData)
bool ULimbIKFunctionLibrary::IsEnabled(struct FLimbIK* LimbIK)
{
static auto fn = UObject::FindObject<UFunction>(_xor_("Function Animation.LimbIKFunctionLibrary.IsEnabled"));
struct
{
struct FLimbIK LimbIK;
bool ReturnValue;
} params;
static auto defaultObj = StaticClass()->CreateDefaultObject();
defaultObj->ProcessEvent(fn, ¶ms);
if (LimbIK != nullptr)
*LimbIK = params.LimbIK;
return params.ReturnValue;
}
// Function Animation.LimbIKFunctionLibrary.GetTranslationStrength
// (Final, Native, Static, Public, HasOutParms, BlueprintCallable, BlueprintPure)
// Parameters:
// struct FLimbIK LimbIK (Parm, OutParm, ReferenceParm)
// float ReturnValue (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData)
float ULimbIKFunctionLibrary::GetTranslationStrength(struct FLimbIK* LimbIK)
{
static auto fn = UObject::FindObject<UFunction>(_xor_("Function Animation.LimbIKFunctionLibrary.GetTranslationStrength"));
struct
{
struct FLimbIK LimbIK;
float ReturnValue;
} params;
static auto defaultObj = StaticClass()->CreateDefaultObject();
defaultObj->ProcessEvent(fn, ¶ms);
if (LimbIK != nullptr)
*LimbIK = params.LimbIK;
return params.ReturnValue;
}
// Function Animation.LimbIKFunctionLibrary.GetTransform
// (Final, Native, Static, Public, HasOutParms, HasDefaults, BlueprintCallable, BlueprintPure)
// Parameters:
// struct FLimbIK LimbIK (Parm, OutParm, ReferenceParm)
// struct FTransform ReturnValue (Parm, OutParm, ReturnParm, IsPlainOldData)
struct FTransform ULimbIKFunctionLibrary::GetTransform(struct FLimbIK* LimbIK)
{
static auto fn = UObject::FindObject<UFunction>(_xor_("Function Animation.LimbIKFunctionLibrary.GetTransform"));
struct
{
struct FLimbIK LimbIK;
struct FTransform ReturnValue;
} params;
static auto defaultObj = StaticClass()->CreateDefaultObject();
defaultObj->ProcessEvent(fn, ¶ms);
if (LimbIK != nullptr)
*LimbIK = params.LimbIK;
return params.ReturnValue;
}
// Function Animation.LimbIKFunctionLibrary.GetRotationStrength
// (Final, Native, Static, Public, HasOutParms, BlueprintCallable, BlueprintPure)
// Parameters:
// struct FLimbIK LimbIK (Parm, OutParm, ReferenceParm)
// float ReturnValue (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData)
float ULimbIKFunctionLibrary::GetRotationStrength(struct FLimbIK* LimbIK)
{
static auto fn = UObject::FindObject<UFunction>(_xor_("Function Animation.LimbIKFunctionLibrary.GetRotationStrength"));
struct
{
struct FLimbIK LimbIK;
float ReturnValue;
} params;
static auto defaultObj = StaticClass()->CreateDefaultObject();
defaultObj->ProcessEvent(fn, ¶ms);
if (LimbIK != nullptr)
*LimbIK = params.LimbIK;
return params.ReturnValue;
}
// Function Animation.LimbIKFunctionLibrary.GetParentBone
// (Final, Native, Static, Public, HasOutParms, BlueprintCallable, BlueprintPure)
// Parameters:
// struct FLimbIK LimbIK (Parm, OutParm, ReferenceParm)
// struct FName ReturnValue (ConstParm, Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData)
struct FName ULimbIKFunctionLibrary::GetParentBone(struct FLimbIK* LimbIK)
{
static auto fn = UObject::FindObject<UFunction>(_xor_("Function Animation.LimbIKFunctionLibrary.GetParentBone"));
struct
{
struct FLimbIK LimbIK;
struct FName ReturnValue;
} params;
static auto defaultObj = StaticClass()->CreateDefaultObject();
defaultObj->ProcessEvent(fn, ¶ms);
if (LimbIK != nullptr)
*LimbIK = params.LimbIK;
return params.ReturnValue;
}
// Function Animation.LimbIKFunctionLibrary.GetIKSpace
// (Final, Native, Static, Public, HasOutParms, BlueprintCallable, BlueprintPure)
// Parameters:
// struct FLimbIK LimbIK (Parm, OutParm, ReferenceParm)
// TEnumAsByte<ELimbIKSpace> ReturnValue (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData)
TEnumAsByte<ELimbIKSpace> ULimbIKFunctionLibrary::GetIKSpace(struct FLimbIK* LimbIK)
{
static auto fn = UObject::FindObject<UFunction>(_xor_("Function Animation.LimbIKFunctionLibrary.GetIKSpace"));
struct
{
struct FLimbIK LimbIK;
TEnumAsByte<ELimbIKSpace> ReturnValue;
} params;
static auto defaultObj = StaticClass()->CreateDefaultObject();
defaultObj->ProcessEvent(fn, ¶ms);
if (LimbIK != nullptr)
*LimbIK = params.LimbIK;
return params.ReturnValue;
}
// Function Animation.LimbIKFunctionLibrary.GetCurrentAlpha
// (Final, Native, Static, Public, HasOutParms, BlueprintCallable, BlueprintPure)
// Parameters:
// struct FLimbIK LimbIK (Parm, OutParm, ReferenceParm)
// float ReturnValue (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData)
float ULimbIKFunctionLibrary::GetCurrentAlpha(struct FLimbIK* LimbIK)
{
static auto fn = UObject::FindObject<UFunction>(_xor_("Function Animation.LimbIKFunctionLibrary.GetCurrentAlpha"));
struct
{
struct FLimbIK LimbIK;
float ReturnValue;
} params;
static auto defaultObj = StaticClass()->CreateDefaultObject();
defaultObj->ProcessEvent(fn, ¶ms);
if (LimbIK != nullptr)
*LimbIK = params.LimbIK;
return params.ReturnValue;
}
// Function Animation.LimbIKFunctionLibrary.GetAnimationOverride
// (Final, Native, Static, Public, HasOutParms, BlueprintCallable, BlueprintPure)
// Parameters:
// struct FLimbIK LimbIK (Parm, OutParm, ReferenceParm)
// bool ReturnValue (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData)
bool ULimbIKFunctionLibrary::GetAnimationOverride(struct FLimbIK* LimbIK)
{
static auto fn = UObject::FindObject<UFunction>(_xor_("Function Animation.LimbIKFunctionLibrary.GetAnimationOverride"));
struct
{
struct FLimbIK LimbIK;
bool ReturnValue;
} params;
static auto defaultObj = StaticClass()->CreateDefaultObject();
defaultObj->ProcessEvent(fn, ¶ms);
if (LimbIK != nullptr)
*LimbIK = params.LimbIK;
return params.ReturnValue;
}
// Function Animation.LimbIKFunctionLibrary.GetAlphaTarget
// (Final, Native, Static, Public, HasOutParms, BlueprintCallable, BlueprintPure)
// Parameters:
// struct FLimbIK LimbIK (Parm, OutParm, ReferenceParm)
// float ReturnValue (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData)
float ULimbIKFunctionLibrary::GetAlphaTarget(struct FLimbIK* LimbIK)
{
static auto fn = UObject::FindObject<UFunction>(_xor_("Function Animation.LimbIKFunctionLibrary.GetAlphaTarget"));
struct
{
struct FLimbIK LimbIK;
float ReturnValue;
} params;
static auto defaultObj = StaticClass()->CreateDefaultObject();
defaultObj->ProcessEvent(fn, ¶ms);
if (LimbIK != nullptr)
*LimbIK = params.LimbIK;
return params.ReturnValue;
}
// Function Animation.LimbIKFunctionLibrary.ConvertBoolToAlpha
// (Final, Native, Static, Public, BlueprintCallable, BlueprintPure)
// Parameters:
// bool InBool (ConstParm, Parm, ZeroConstructor, IsPlainOldData)
// float ReturnValue (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData)
float ULimbIKFunctionLibrary::ConvertBoolToAlpha(bool InBool)
{
static auto fn = UObject::FindObject<UFunction>(_xor_("Function Animation.LimbIKFunctionLibrary.ConvertBoolToAlpha"));
struct
{
bool InBool;
float ReturnValue;
} params;
params.InBool = InBool;
static auto defaultObj = StaticClass()->CreateDefaultObject();
defaultObj->ProcessEvent(fn, ¶ms);
return params.ReturnValue;
}
// Function Animation.LocomotionFunctionLib.UpdateControllerSpineRotation
// (Final, Native, Static, Public, HasOutParms, HasDefaults, BlueprintCallable, BlueprintPure)
// Parameters:
// struct FRotator CharacterRotation (ConstParm, Parm, OutParm, ZeroConstructor, ReferenceParm, IsPlainOldData)
// float AngleSpeedMax (Parm, ZeroConstructor, IsPlainOldData)
// float AngleSpeedMin (Parm, ZeroConstructor, IsPlainOldData)
// float ReturnValue (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData)
float ULocomotionFunctionLib::UpdateControllerSpineRotation(const struct FRotator& CharacterRotation, float AngleSpeedMax, float AngleSpeedMin)
{
static auto fn = UObject::FindObject<UFunction>(_xor_("Function Animation.LocomotionFunctionLib.UpdateControllerSpineRotation"));
struct
{
struct FRotator CharacterRotation;
float AngleSpeedMax;
float AngleSpeedMin;
float ReturnValue;
} params;
params.CharacterRotation = CharacterRotation;
params.AngleSpeedMax = AngleSpeedMax;
params.AngleSpeedMin = AngleSpeedMin;
static auto defaultObj = StaticClass()->CreateDefaultObject();
defaultObj->ProcessEvent(fn, ¶ms);
return params.ReturnValue;
}
// Function Animation.LocomotionFunctionLib.UpdateCharacterSpeed
// (Final, Native, Static, Public, HasOutParms, HasDefaults, BlueprintCallable, BlueprintPure)
// Parameters:
// struct FVector Velocity (ConstParm, Parm, OutParm, ZeroConstructor, ReferenceParm, IsPlainOldData)
// float CurrentMaxWalkSpeed (ConstParm, Parm, ZeroConstructor, IsPlainOldData)
// float WantedMovementSpeed (Parm, ZeroConstructor, IsPlainOldData)
// float BaseMaxWalkSpeed (ConstParm, Parm, ZeroConstructor, IsPlainOldData)
// float SpeedBlendValue (ConstParm, Parm, ZeroConstructor, IsPlainOldData)
// bool IsSwimming (ConstParm, Parm, ZeroConstructor, IsPlainOldData)
// struct FActorVelocityData ReturnValue (Parm, OutParm, ReturnParm)
struct FActorVelocityData ULocomotionFunctionLib::UpdateCharacterSpeed(const struct FVector& Velocity, float CurrentMaxWalkSpeed, float WantedMovementSpeed, float BaseMaxWalkSpeed, float SpeedBlendValue, bool IsSwimming)
{
static auto fn = UObject::FindObject<UFunction>(_xor_("Function Animation.LocomotionFunctionLib.UpdateCharacterSpeed"));
struct
{
struct FVector Velocity;
float CurrentMaxWalkSpeed;
float WantedMovementSpeed;
float BaseMaxWalkSpeed;
float SpeedBlendValue;
bool IsSwimming;
struct FActorVelocityData ReturnValue;
} params;
params.Velocity = Velocity;
params.CurrentMaxWalkSpeed = CurrentMaxWalkSpeed;
params.WantedMovementSpeed = WantedMovementSpeed;
params.BaseMaxWalkSpeed = BaseMaxWalkSpeed;
params.SpeedBlendValue = SpeedBlendValue;
params.IsSwimming = IsSwimming;
static auto defaultObj = StaticClass()->CreateDefaultObject();
defaultObj->ProcessEvent(fn, ¶ms);
return params.ReturnValue;
}
// Function Animation.LocomotionFunctionLib.UpdateCalculateRateAndCurrentYaw
// (Final, Native, Static, Public, HasOutParms, HasDefaults, BlueprintCallable, BlueprintPure)
// Parameters:
// struct FRotator CharacterRotation (ConstParm, Parm, OutParm, ZeroConstructor, ReferenceParm, IsPlainOldData)
// float LargeRate (ConstParm, Parm, ZeroConstructor, IsPlainOldData)
// float CurrentCharacterYaw (Parm, OutParm, ZeroConstructor, ReferenceParm, IsPlainOldData)
// float DeltaSeconds (ConstParm, Parm, ZeroConstructor, IsPlainOldData)
// float ReturnValue (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData)
float ULocomotionFunctionLib::UpdateCalculateRateAndCurrentYaw(const struct FRotator& CharacterRotation, float LargeRate, float DeltaSeconds, float* CurrentCharacterYaw)
{
static auto fn = UObject::FindObject<UFunction>(_xor_("Function Animation.LocomotionFunctionLib.UpdateCalculateRateAndCurrentYaw"));
struct
{
struct FRotator CharacterRotation;
float LargeRate;
float CurrentCharacterYaw;
float DeltaSeconds;
float ReturnValue;
} params;
params.CharacterRotation = CharacterRotation;
params.LargeRate = LargeRate;
params.DeltaSeconds = DeltaSeconds;
static auto defaultObj = StaticClass()->CreateDefaultObject();
defaultObj->ProcessEvent(fn, ¶ms);
if (CurrentCharacterYaw != nullptr)
*CurrentCharacterYaw = params.CurrentCharacterYaw;
return params.ReturnValue;
}
// Function Animation.NetworkSyncedAnimationComponent.OnRep_PlayingAnimationIndex
// (Final, Native, Protected)
void UNetworkSyncedAnimationComponent::OnRep_PlayingAnimationIndex()
{
static auto fn = UObject::FindObject<UFunction>(_xor_("Function Animation.NetworkSyncedAnimationComponent.OnRep_PlayingAnimationIndex"));
struct
{
} params;
UObject::ProcessEvent(fn, ¶ms);
}
// Function Animation.NetworkSyncedAnimationComponent.OnRep_AnimationProgression
// (Final, Native, Protected)
void UNetworkSyncedAnimationComponent::OnRep_AnimationProgression()
{
static auto fn = UObject::FindObject<UFunction>(_xor_("Function Animation.NetworkSyncedAnimationComponent.OnRep_AnimationProgression"));
struct
{
} params;
UObject::ProcessEvent(fn, ¶ms);
}
// Function Animation.TurningFunctionLib.TurningUpdate
// (Final, Native, Static, Public, HasOutParms, BlueprintCallable, BlueprintPure)
// Parameters:
// float DeltaSeconds (Parm, ZeroConstructor, IsPlainOldData)
// bool CharacterMoving (ConstParm, Parm, ZeroConstructor, IsPlainOldData)
// bool DeadZone (Parm, OutParm, ZeroConstructor, ReferenceParm, IsPlainOldData)
// float TurnRate (ConstParm, Parm, ZeroConstructor, IsPlainOldData)
// float DelayedCounter (Parm, OutParm, ZeroConstructor, ReferenceParm, IsPlainOldData)
// float CounterMax (ConstParm, Parm, ZeroConstructor, IsPlainOldData)
// bool TurningLeft (Parm, OutParm, ZeroConstructor, IsPlainOldData)
// bool ReturnValue (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData)
bool UTurningFunctionLib::TurningUpdate(float DeltaSeconds, bool CharacterMoving, float TurnRate, float CounterMax, bool* DeadZone, float* DelayedCounter, bool* TurningLeft)
{
static auto fn = UObject::FindObject<UFunction>(_xor_("Function Animation.TurningFunctionLib.TurningUpdate"));
struct
{
float DeltaSeconds;
bool CharacterMoving;
bool DeadZone;
float TurnRate;
float DelayedCounter;
float CounterMax;
bool TurningLeft;
bool ReturnValue;
} params;
params.DeltaSeconds = DeltaSeconds;
params.CharacterMoving = CharacterMoving;
params.TurnRate = TurnRate;
params.CounterMax = CounterMax;
static auto defaultObj = StaticClass()->CreateDefaultObject();
defaultObj->ProcessEvent(fn, ¶ms);
if (DeadZone != nullptr)
*DeadZone = params.DeadZone;
if (DelayedCounter != nullptr)
*DelayedCounter = params.DelayedCounter;
if (TurningLeft != nullptr)
*TurningLeft = params.TurningLeft;
return params.ReturnValue;
}
// Function Animation.WaitForAnimationStateEntryProxy.OnEnteredState
// (Final, Native, Public)
// Parameters:
// struct FName path (Parm, ZeroConstructor, IsPlainOldData)
void UWaitForAnimationStateEntryProxy::OnEnteredState(const struct FName& path)
{
static auto fn = UObject::FindObject<UFunction>(_xor_("Function Animation.WaitForAnimationStateEntryProxy.OnEnteredState"));
struct
{
struct FName path;
} params;
params.path = path;
UObject::ProcessEvent(fn, ¶ms);
}
// Function Animation.WaitForAnimationStateEntryProxy.OnAnimationUpdated
// (Final, Native, Public)
void UWaitForAnimationStateEntryProxy::OnAnimationUpdated()
{
static auto fn = UObject::FindObject<UFunction>(_xor_("Function Animation.WaitForAnimationStateEntryProxy.OnAnimationUpdated"));
struct
{
} params;
UObject::ProcessEvent(fn, ¶ms);
}
// Function Animation.WaitForAnimationStateEntryProxy.CreateProxy
// (Final, Native, Static, Public, HasOutParms, BlueprintCallable)
// Parameters:
// class UAnimInstance* AnimInstance (Parm, ZeroConstructor, IsPlainOldData)
// struct FName TargetPath (ConstParm, Parm, OutParm, ZeroConstructor, ReferenceParm, IsPlainOldData)
// class UWaitForAnimationStateEntryProxy* ReturnValue (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData)
class UWaitForAnimationStateEntryProxy* UWaitForAnimationStateEntryProxy::CreateProxy(class UAnimInstance* AnimInstance, const struct FName& TargetPath)
{
static auto fn = UObject::FindObject<UFunction>(_xor_("Function Animation.WaitForAnimationStateEntryProxy.CreateProxy"));
struct
{
class UAnimInstance* AnimInstance;
struct FName TargetPath;
class UWaitForAnimationStateEntryProxy* ReturnValue;
} params;
params.AnimInstance = AnimInstance;
params.TargetPath = TargetPath;
static auto defaultObj = StaticClass()->CreateDefaultObject();
defaultObj->ProcessEvent(fn, ¶ms);
return params.ReturnValue;
}
// Function Animation.WaitForAnimationStateExitProxy.OnExitState
// (Final, Native, Public)
// Parameters:
// struct FName path (Parm, ZeroConstructor, IsPlainOldData)
void UWaitForAnimationStateExitProxy::OnExitState(const struct FName& path)
{
static auto fn = UObject::FindObject<UFunction>(_xor_("Function Animation.WaitForAnimationStateExitProxy.OnExitState"));
struct
{
struct FName path;
} params;
params.path = path;
UObject::ProcessEvent(fn, ¶ms);
}
// Function Animation.WaitForAnimationStateExitProxy.OnAnimationUpdated
// (Final, Native, Public)
void UWaitForAnimationStateExitProxy::OnAnimationUpdated()
{
static auto fn = UObject::FindObject<UFunction>(_xor_("Function Animation.WaitForAnimationStateExitProxy.OnAnimationUpdated"));
struct
{
} params;
UObject::ProcessEvent(fn, ¶ms);
}
// Function Animation.WaitForAnimationStateExitProxy.CreateProxy
// (Final, Native, Static, Public, HasOutParms, BlueprintCallable)
// Parameters:
// class UAnimInstance* AnimInstance (Parm, ZeroConstructor, IsPlainOldData)
// struct FName TargetPath (ConstParm, Parm, OutParm, ZeroConstructor, ReferenceParm, IsPlainOldData)
// class UWaitForAnimationStateExitProxy* ReturnValue (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData)
class UWaitForAnimationStateExitProxy* UWaitForAnimationStateExitProxy::CreateProxy(class UAnimInstance* AnimInstance, const struct FName& TargetPath)
{
static auto fn = UObject::FindObject<UFunction>(_xor_("Function Animation.WaitForAnimationStateExitProxy.CreateProxy"));
struct
{
class UAnimInstance* AnimInstance;
struct FName TargetPath;
class UWaitForAnimationStateExitProxy* ReturnValue;
} params;
params.AnimInstance = AnimInstance;
params.TargetPath = TargetPath;
static auto defaultObj = StaticClass()->CreateDefaultObject();
defaultObj->ProcessEvent(fn, ¶ms);
return params.ReturnValue;
}
}
#ifdef _MSC_VER
#pragma pack(pop)
#endif
| [
"igromanru@yahoo.de"
] | igromanru@yahoo.de |
6318a1931434614c49ed0e045de4a52246e4b7ed | eba5ec4ee324edfa5a0f377c6f948cffb9dee1d8 | /content/browser/gpu/browser_gpu_memory_buffer_manager.h | 9cb9c43b1d42ec9ecbd648573b6bc1ee7cbdabd1 | [
"BSD-3-Clause",
"LicenseRef-scancode-unknown-license-reference",
"BSD-2-Clause-Views"
] | permissive | bopopescu/Monarch | 2c1e636da3995d1f20df48561db97fd0d8f9317b | 4f8ee8e6dda3669f734866e4999db173c5ec5aef | refs/heads/master | 2021-06-16T11:42:58.246734 | 2017-03-25T04:02:04 | 2017-03-25T04:02:04 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 7,136 | h | // Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CONTENT_BROWSER_GPU_BROWSER_GPU_MEMORY_BUFFER_MANAGER_H_
#define CONTENT_BROWSER_GPU_BROWSER_GPU_MEMORY_BUFFER_MANAGER_H_
#include <utility>
#include "base/callback.h"
#include "base/containers/hash_tables.h"
#include "base/trace_event/memory_dump_provider.h"
#include "content/common/content_export.h"
#include "gpu/command_buffer/client/gpu_memory_buffer_manager.h"
namespace content {
using GpuMemoryBufferConfigurationKey =
std::pair<gfx::BufferFormat, gfx::BufferUsage>;
using GpuMemoryBufferConfigurationSet =
base::hash_set<GpuMemoryBufferConfigurationKey>;
} // content
namespace BASE_HASH_NAMESPACE {
template <>
struct hash<content::GpuMemoryBufferConfigurationKey> {
size_t operator()(const content::GpuMemoryBufferConfigurationKey& key) const {
return base::HashPair(static_cast<int>(key.first),
static_cast<int>(key.second));
}
};
} // namespace BASE_HASH_NAMESPACE
namespace content {
class GpuProcessHost;
class CONTENT_EXPORT BrowserGpuMemoryBufferManager
: public gpu::GpuMemoryBufferManager,
public base::trace_event::MemoryDumpProvider {
public:
using CreateCallback =
base::Callback<void(const gfx::GpuMemoryBufferHandle& handle)>;
using AllocationCallback = CreateCallback;
BrowserGpuMemoryBufferManager(int gpu_client_id,
uint64_t gpu_client_tracing_id);
~BrowserGpuMemoryBufferManager() override;
static BrowserGpuMemoryBufferManager* current();
static uint32 GetImageTextureTarget(gfx::BufferFormat format,
gfx::BufferUsage usage);
// Overridden from gpu::GpuMemoryBufferManager:
scoped_ptr<gfx::GpuMemoryBuffer> AllocateGpuMemoryBuffer(
const gfx::Size& size,
gfx::BufferFormat format,
gfx::BufferUsage usage) override;
scoped_ptr<gfx::GpuMemoryBuffer> CreateGpuMemoryBufferFromHandle(
const gfx::GpuMemoryBufferHandle& handle,
const gfx::Size& size,
gfx::BufferFormat format) override;
gfx::GpuMemoryBuffer* GpuMemoryBufferFromClientBuffer(
ClientBuffer buffer) override;
void SetDestructionSyncPoint(gfx::GpuMemoryBuffer* buffer,
uint32 sync_point) override;
// Overridden from base::trace_event::MemoryDumpProvider:
bool OnMemoryDump(const base::trace_event::MemoryDumpArgs& args,
base::trace_event::ProcessMemoryDump* pmd) override;
// Virtual for testing.
virtual scoped_ptr<gfx::GpuMemoryBuffer> AllocateGpuMemoryBufferForScanout(
const gfx::Size& size,
gfx::BufferFormat format,
int32 surface_id);
void AllocateGpuMemoryBufferForChildProcess(
gfx::GpuMemoryBufferId id,
const gfx::Size& size,
gfx::BufferFormat format,
gfx::BufferUsage usage,
base::ProcessHandle child_process_handle,
int child_client_id,
const AllocationCallback& callback);
void ChildProcessDeletedGpuMemoryBuffer(
gfx::GpuMemoryBufferId id,
base::ProcessHandle child_process_handle,
int child_client_id,
uint32 sync_point);
void ProcessRemoved(base::ProcessHandle process_handle, int client_id);
bool IsNativeGpuMemoryBufferConfiguration(gfx::BufferFormat format,
gfx::BufferUsage usage) const;
private:
struct BufferInfo {
BufferInfo()
: type(gfx::EMPTY_BUFFER),
format(gfx::BufferFormat::RGBA_8888),
usage(gfx::BufferUsage::GPU_READ),
gpu_host_id(0) {}
BufferInfo(const gfx::Size& size,
gfx::GpuMemoryBufferType type,
gfx::BufferFormat format,
gfx::BufferUsage usage,
int gpu_host_id)
: size(size),
type(type),
format(format),
usage(usage),
gpu_host_id(gpu_host_id) {}
gfx::Size size;
gfx::GpuMemoryBufferType type;
gfx::BufferFormat format;
gfx::BufferUsage usage;
int gpu_host_id;
};
struct CreateGpuMemoryBufferRequest;
struct CreateGpuMemoryBufferFromHandleRequest;
using CreateDelegate = base::Callback<void(GpuProcessHost* host,
gfx::GpuMemoryBufferId id,
const gfx::Size& size,
gfx::BufferFormat format,
gfx::BufferUsage usage,
int client_id,
const CreateCallback& callback)>;
scoped_ptr<gfx::GpuMemoryBuffer> AllocateGpuMemoryBufferForSurface(
const gfx::Size& size,
gfx::BufferFormat format,
gfx::BufferUsage usage,
int32 surface_id);
// Functions that handle synchronous buffer creation requests.
void HandleCreateGpuMemoryBufferOnIO(CreateGpuMemoryBufferRequest* request);
void HandleCreateGpuMemoryBufferFromHandleOnIO(
CreateGpuMemoryBufferFromHandleRequest* request);
void HandleGpuMemoryBufferCreatedOnIO(
CreateGpuMemoryBufferRequest* request,
const gfx::GpuMemoryBufferHandle& handle);
// Functions that implement asynchronous buffer creation.
void CreateGpuMemoryBufferOnIO(const CreateDelegate& create_delegate,
gfx::GpuMemoryBufferId id,
const gfx::Size& size,
gfx::BufferFormat format,
gfx::BufferUsage usage,
int client_id,
bool reused_gpu_process,
const CreateCallback& callback);
void GpuMemoryBufferCreatedOnIO(const CreateDelegate& create_delegate,
gfx::GpuMemoryBufferId id,
int client_id,
int gpu_host_id,
bool reused_gpu_process,
const CreateCallback& callback,
const gfx::GpuMemoryBufferHandle& handle);
void DestroyGpuMemoryBufferOnIO(gfx::GpuMemoryBufferId id,
int client_id,
uint32 sync_point);
uint64_t ClientIdToTracingProcessId(int client_id) const;
const GpuMemoryBufferConfigurationSet native_configurations_;
const int gpu_client_id_;
const uint64_t gpu_client_tracing_id_;
// The GPU process host ID. This should only be accessed on the IO thread.
int gpu_host_id_;
// Stores info about buffers for all clients. This should only be accessed
// on the IO thread.
using BufferMap = base::hash_map<gfx::GpuMemoryBufferId, BufferInfo>;
using ClientMap = base::hash_map<int, BufferMap>;
ClientMap clients_;
DISALLOW_COPY_AND_ASSIGN(BrowserGpuMemoryBufferManager);
};
} // namespace content
#endif // CONTENT_BROWSER_GPU_BROWSER_GPU_MEMORY_BUFFER_MANAGER_H_
| [
"danrwhitcomb@gmail.com"
] | danrwhitcomb@gmail.com |
174b381d8aebb7a67aa2ee9a25060e304ab28893 | a4dd8c4b406a8486c9cd82ff3e050d8de7de8d30 | /C++ Programs/c++ string functions and stuff.cpp | a2601b949c24b324cf46a535eb2fd377fbd0461b | [] | no_license | NabinAdhikari674/Files | 0241f2f6bd730108586f748de7b7df51389d2cc0 | 8a0eb66e6b3fac121b841aadc0294c808e00c712 | refs/heads/master | 2020-05-09T16:18:35.289626 | 2019-04-14T06:46:52 | 2019-04-14T06:46:52 | 181,265,751 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,472 | cpp | #include<iostream>
#include<string.h>
using namespace std;
int main()
{
string s1("Hello man");
string s2,s3,s4,s5,s6,s7;
s2="How are u";
/*
s2="How are u";
s3="whats up";
s4="are you fine";
s5="lets go";
cout<<s1<<endl;
cout<<s2<<endl;
cout<<s3<<endl;
cout<<s4<<endl;
cout<<s5<<endl;
*/
//getline(cin,s6);
//cout<<endl<<s6<<endl;
/*
//length or size of a string
cout<<s1.length()<<endl;
cout<<s1.size()<<endl;
*/
/*
//concatenation of a string
cout<<endl<<s1+s2<<endl;
s3=s1+s2;
cout<<endl<<s3<<endl;
*/
/*
//append of a string
cout<<"s1 = "<<s1<<"\t\ts2= "<<s2;
s1.append(s2);
cout<<endl<<s1<<endl;
s1.append(s2,2,5);
cout<<endl<<"append with limit : "<<s1<<endl;
*/
/*
//erasing from a string
s1.erase(3,2);
cout<<"\n\n Erasing with limits (two arguments) : "<<s1<<"\n\n";
s2.erase(3);
cout<<"\n\n Erasing with limits (only one argument): "<<s2<<"\n\n";
*/
/*
//checking if the string is empty or not.........1=empty(true)....0=not empty(false)
cout<<"Checking if s3 is empty : "<<s3.empty()<<endl;
cout<<"\n\nBefore Erasing : "<<s1.empty()<<endl;
cout<<s1.erase();
cout<<"\n\nAfter Erasing : "<<s1.empty()<<endl;
*/
/*
//replacing from a string
//a whole string cannot be replaced
cout<<"\n\n Without Replacing : "<<s2<<"\n\n";
s2.replace(2,3,s1);
cout<<"\n\n After Replacing : "<<s2<<"\n\n";
s2.replace(2,3,s1,2,2);
cout<<"\n\n After Replacing (limit for both strings) : "<<s2<<"\n\n";
*/
/*
//assigning value to a string
cout<<"\n\n Before Assigning : "<<s2<<"\n\n";
s2.assign(s1); //value of s1 is asigned to s2....both are equal now
if (s1==s2) //checking if both are equal
{
cout<<"\n\nequal\n\n";
}
cout<<(s1==s2); // "1" means equal..
cout<<"\n\n After Assigning : "<<s2<<"\n\n";
s2.assign(s1,2,2);
cout<<"\n\n After Assigning (with limits) : "<<s2<<"\n\n";
//giving value
string s8(8,'*'); //8 times * ........the assigned value must be a character
cout<<s8;
*/
/*
//using substring functions
cout<<"\n\nBefore Substring function : (s2) "<<s2<<endl;
s3=s2.substr(2,3);
cout<<"\n\nAfter using Substring function to s3 : "<<s3<<endl;
*/
/*
//finding something in a string
cout<<s2.find("help");
*/
}
| [
"noreply@github.com"
] | noreply@github.com |
f35fda1b1f8b30ee8e9956e16a4c6094ac32f2a1 | d875df6d3ab5161475156661777aabfa01cef560 | /uva/11777.cpp | 6f46b47f4f9e4bfb88064afa3421d85262986798 | [
"BSD-2-Clause"
] | permissive | partho222/programming | 385de1c86e203d305e89543d7590012367dec41c | 98a87b6a04f39c343125cf5f0dd85e0f1c37d56c | refs/heads/master | 2021-01-10T05:23:46.470483 | 2015-11-24T15:35:36 | 2015-11-24T15:35:36 | 46,603,152 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,241 | cpp | #include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <string>
#include <cctype>
#include <stack>
#include <queue>
#include <list>
#include <vector>
#include <map>
#include <sstream>
#include <cmath>
#include <bitset>
#include <utility>
#include <set>
using namespace std;
int main()
{
int loop,kase=0;
cin >> loop;
while(loop--)
{
int ary[7],i,sum=0,avg=0;
for(i=0;i<7;i++)
{
cin >> ary[i];
}
for(i=0;i<4;i++)
{
sum=sum+ary[i];
}
sort(ary+4 , ary+7);
for(i=5;i<7;i++)
{
avg=avg+ary[i];
}
avg=avg/2;
sum=sum+avg;
cout << "Case " << ++kase;
if(sum>=90)
{
cout << ": A";
}
else if(sum>=80 && sum<90)
{
cout << ": B";
}
else if(sum>=70 && sum<80)
{
cout << ": C";
}
else if(sum>=60 && sum<70)
{
cout << ": D";
}
else if(sum<60)
{
cout << ": F";
}
cout << "\n";
}
return 0;
}
| [
"partho222@gmail.com"
] | partho222@gmail.com |
4a0307d70d44129875666f786b50bd0cc44209e5 | b5d7e814aac471eeabc6a0d23c74e5154e793f93 | /C++/C++视频课程练习/this指针/this指针/demo.cpp | de5ed5d6a3853d77b63554414b5ff21ce08ffd73 | [] | no_license | SelmerZhang/Code | b4064758c141c0c9db112b97a55986f52fac998a | 84fb3245f12177e7294523dfea2938933ae9e813 | refs/heads/master | 2022-11-17T00:04:55.380889 | 2018-06-09T12:07:47 | 2018-06-09T12:07:47 | 138,289,233 | 0 | 1 | null | 2022-11-04T14:54:45 | 2018-06-22T10:23:03 | Python | UTF-8 | C++ | false | false | 186 | cpp | #include<iostream>
#include"Array.h"
using namespace std;
int main()
{
Array arr1(10);
arr1.printinfo().setLen(5);
cout << "len=" << arr1.getLen() << endl;
getchar();
return 0;
} | [
"33535338+BobbyLiukeling@users.noreply.github.com"
] | 33535338+BobbyLiukeling@users.noreply.github.com |
42df3e321567bbd7f2ad30285dd83ae01ae306cf | bf9b2003b2afd67080993815b56483390badf2ba | /system/pixelBuffer/Apple/PixelBuffer.cpp | 0e83746ec2bf4d02e7ed1f16f7caf99715ea61f2 | [
"MIT",
"LGPL-2.1-only"
] | permissive | edgesite/VideoCore | d0aab549d87934eecb9de8a6e02aa6203785de05 | 3cba368ec6fd14bfd322a615bf84f19c1ba7a26c | refs/heads/master | 2023-04-06T16:47:44.817666 | 2016-10-18T18:47:48 | 2016-10-18T18:47:48 | 70,419,128 | 0 | 0 | MIT | 2023-04-03T23:13:30 | 2016-10-09T17:28:57 | C++ | UTF-8 | C++ | false | false | 2,010 | cpp |
/*
Video Core
Copyright (c) 2014 James G. Hurley
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
#include <videocore/system/pixelBuffer/Apple/PixelBuffer.h>
namespace videocore { namespace Apple {
PixelBuffer::PixelBuffer(CVPixelBufferRef pb, bool temporary)
: m_state(kVCPixelBufferStateAvailable),
m_locked(false),
m_pixelBuffer(CVPixelBufferRetain(pb)),
m_temporary(temporary)
{
m_pixelFormat = (PixelBufferFormatType)CVPixelBufferGetPixelFormatType(pb);
}
PixelBuffer::~PixelBuffer()
{
CVPixelBufferRelease(m_pixelBuffer);
}
void
PixelBuffer::lock(bool readonly)
{
m_locked = true;
//CVPixelBufferLockBaseAddress( (CVPixelBufferRef)cvBuffer(), readonly ? kCVPixelBufferLock_ReadOnly : 0 );
}
void
PixelBuffer::unlock(bool readonly)
{
m_locked = false;
//CVPixelBufferUnlockBaseAddress( (CVPixelBufferRef)cvBuffer(), readonly ? kCVPixelBufferLock_ReadOnly : 0 );
}
}
} | [
"jamesghurley@gmail.com"
] | jamesghurley@gmail.com |
e0fdbe23cbcc2b34e70f9529b070bd60602d9632 | 48944a1e3f8af343c7d06793246ccb9e81b0bf9c | /ju-seatch/unise/retri/and_iterator.h | d9fb949c3ed0f9283a825ec78221bea5835e719c | [] | no_license | H6yV7Um/c-plus | 8838dd992f54038d255963e519dfe00209cbd3cc | 7b65534b2997f56a810f4dd8cc77167109b2791d | refs/heads/master | 2020-03-19T05:48:13.643404 | 2018-06-04T02:52:51 | 2018-06-04T02:52:51 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,052 | h | // Copyright 2013 Baidu.com All Rights Reserved.
// Author: wangguangyuan@baidu.com (Guangyuan Wang)
#ifndef RETRI_AND_ITERATOR_H_
#define RETRI_AND_ITERATOR_H_
#include <vector>
#include "unise/base.h"
#include "retri/forward_iterator.h"
namespace unise
{
class AndIterator : public ForwardIterator
{
public:
explicit AndIterator(const std::vector<ForwardIterator *> & it_list);
virtual ~AndIterator() {}
virtual void next();
virtual bool done() const;
virtual void jump_to(DocId docid, int32_t score);
virtual const doc_hit_t & get_cur_doc_hit() const;
virtual bool post_retrieval_check_internal();
virtual void get_hit_list(std::stack<TokenId> * hits) const;
virtual float get_progress() const;
virtual uint64_t get_estimated_num() const;
private:
void get_match();
private:
std::vector<ForwardIterator *> _it_list;
doc_hit_t _cur_doc_hit;
private:
GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(AndIterator);
};
}
#endif // RETRI_AND_ITERATOR_H_
/* vim: set expandtab ts=4 sw=4 sts=4 tw=100: */
| [
"qinhan@baidu.com"
] | qinhan@baidu.com |
059530b72c12581c9dc060dce79272ae2908384f | 8bae0a5871f081f88f6bae1448f0a61653f1cad3 | /TopCoder/Single-Round-Match-654/250/driver.cc | b61e2681d4d1ce91e75363caf9a14035e1397d0c | [] | no_license | IamUttamKumarRoy/contest-programming | a3a58df6b6ffaae1947d725e070d1e32d45c7642 | 50f2b86bcb59bc417f0c9a2f3f195eb45ad54eb4 | refs/heads/master | 2021-01-16T00:28:53.384205 | 2016-10-01T02:57:44 | 2016-10-01T02:57:44 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,758 | cc |
#include "SquareScores.cc"
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <fstream>
#include <iostream>
#include <sstream>
#include <string>
#include <sys/time.h>
#include <vector>
const static double __EPSILON = 1e-9;
static double __time = 0.0;
static void __timer_start()
{
struct timeval tv;
if (gettimeofday(&tv, NULL) == 0)
{
__time = double(tv.tv_sec) * 1000.0 + double(tv.tv_usec) * 0.001;
}
}
static double __timer_stop()
{
double start = __time;
__timer_start();
return __time - start;
}
static void __eat_whitespace(std::istream& in)
{
while (in.good() && std::isspace(in.peek())) in.get();
}
std::ostream& operator << (std::ostream& out, const std::string& str)
{
out << '"' << str.c_str() << '"';
return out;
}
template <class T>
std::ostream& operator << (std::ostream& out, const std::vector<T>& vec)
{
out << '{';
if (0 < vec.size())
{
out << vec[0];
for (size_t i = 1; i < vec.size(); ++i) out << ", " << vec[i];
}
out << '}';
return out;
}
std::istream& operator >> (std::istream& in, std::string& str)
{
__eat_whitespace(in);
int c;
if (in.good() && (c = in.get()) == '"')
{
std::ostringstream s;
while (in.good() && (c = in.get()) != '"')
{
s.put(char(c));
}
str = s.str();
}
return in;
}
template <class T>
std::istream& operator >> (std::istream& in, std::vector<T>& vec)
{
__eat_whitespace(in);
int c;
if (in.good() && (c = in.get()) == '{')
{
__eat_whitespace(in);
vec.clear();
while (in.good() && (c = in.get()) != '}')
{
if (c != ',') in.putback(c);
T t;
in >> t;
__eat_whitespace(in);
vec.push_back(t);
}
}
return in;
}
template <class T>
bool __equals(const T& actual, const T& expected)
{
return actual == expected;
}
bool __equals(double actual, double expected)
{
if (std::abs(actual - expected) < __EPSILON)
{
return true;
}
else
{
double minimum = std::min(expected * (1.0 - __EPSILON), expected * (1.0 + __EPSILON));
double maximum = std::max(expected * (1.0 - __EPSILON), expected * (1.0 + __EPSILON));
return actual > minimum && actual < maximum;
}
}
bool __equals(const std::vector<double>& actual, const std::vector<double>& expected)
{
if (actual.size() != expected.size())
{
return false;
}
for (size_t i = 0; i < actual.size(); ++i)
{
if (!__equals(actual[i], expected[i]))
{
return false;
}
}
return true;
}
int main(int argc, char* argv[])
{
bool __abort_on_fail = false;
int __pass = 0;
int __fail = 0;
if (1 < argc) __abort_on_fail = true;
std::cout << "TAP version 13" << std::endl;
std::cout.flush();
std::ifstream __in("testcases.txt");
for(;;)
{
int __testnum = __pass + __fail + 1;
double __expected;
vector <int> p;
string s;
__in >> __expected >> p >> s;
if (!__in.good()) break;
std::cout << "# input for test " << __testnum << ": " << p << ", " << s << std::endl;
std::cout.flush();
__timer_start();
SquareScores __object;
double __actual = __object.calcexpectation(p, s);
double __t = __timer_stop();
std::cout << "# test completed in " << __t << "ms" << std::endl;
std::cout.flush();
if (__equals(__actual, __expected))
{
std::cout << "ok";
++__pass;
}
else
{
std::cout << "not ok";
++__fail;
}
std::cout << " " << __testnum << " - " << __actual << " must equal " << __expected << std::endl;
std::cout.flush();
if (__abort_on_fail && 0 < __fail) std::abort();
}
std::cout << "1.." << (__pass + __fail) << std::endl
<< "# passed: " << __pass << std::endl
<< "# failed: " << __fail << std::endl;
if (__fail == 0)
{
std::cout << std::endl
<< "# Nice! Don't forget to compile remotely before submitting." << std::endl;
}
return __fail;
}
// vim:ft=cpp
| [
"he.andrew.mail@gmail.com"
] | he.andrew.mail@gmail.com |
1d070559863da1b9bc0a9a24340540969ac0847b | 24f26275ffcd9324998d7570ea9fda82578eeb9e | /content/browser/frame_host/interstitial_page_impl_browsertest.cc | 6fb9bfe899d815b38959d6afe4cdf2287516e953 | [
"BSD-3-Clause"
] | permissive | Vizionnation/chromenohistory | 70a51193c8538d7b995000a1b2a654e70603040f | 146feeb85985a6835f4b8826ad67be9195455402 | refs/heads/master | 2022-12-15T07:02:54.461083 | 2019-10-25T15:07:06 | 2019-10-25T15:07:06 | 217,557,501 | 2 | 1 | BSD-3-Clause | 2022-11-19T06:53:07 | 2019-10-25T14:58:54 | null | UTF-8 | C++ | false | false | 12,672 | cc | // Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "content/browser/frame_host/interstitial_page_impl.h"
#include <tuple>
#include "base/macros.h"
#include "base/run_loop.h"
#include "base/strings/utf_string_conversions.h"
#include "content/browser/web_contents/web_contents_impl.h"
#include "content/common/frame_messages.h"
#include "content/public/browser/browser_message_filter.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/interstitial_page_delegate.h"
#include "content/public/common/navigation_policy.h"
#include "content/public/test/browser_test_utils.h"
#include "content/public/test/content_browser_test.h"
#include "content/public/test/content_browser_test_utils.h"
#include "content/public/test/test_utils.h"
#include "content/shell/browser/shell.h"
#include "ipc/message_filter.h"
#include "third_party/blink/public/mojom/clipboard/clipboard.mojom.h"
#include "ui/base/clipboard/clipboard_monitor.h"
#include "ui/base/clipboard/clipboard_observer.h"
namespace content {
namespace {
class TestInterstitialPageDelegate : public InterstitialPageDelegate {
private:
// InterstitialPageDelegate:
std::string GetHTMLContents() override {
return "<html>"
"<head>"
"<script>"
"function create_input_and_set_text(text) {"
" var input = document.createElement('input');"
" input.id = 'input';"
" document.body.appendChild(input);"
" document.getElementById('input').value = text;"
" input.addEventListener('input',"
" function() { document.title='TEXT_CHANGED'; });"
"}"
"function focus_select_input() {"
" document.getElementById('input').select();"
"}"
"function get_input_text() {"
" window.domAutomationController.send("
" document.getElementById('input').value);"
"}"
"function get_selection() {"
" window.domAutomationController.send("
" window.getSelection().toString());"
"}"
"function set_selection_change_listener() {"
" document.addEventListener('selectionchange',"
" function() { document.title='SELECTION_CHANGED'; })"
"}"
"</script>"
"</head>"
"<body>original body text</body>"
"</html>";
}
};
class ClipboardChangedObserver : ui::ClipboardObserver {
public:
ClipboardChangedObserver() {
ui::ClipboardMonitor::GetInstance()->AddObserver(this);
}
~ClipboardChangedObserver() override {
ui::ClipboardMonitor::GetInstance()->RemoveObserver(this);
}
void OnClipboardDataChanged() override {
DCHECK(!quit_closure_.is_null());
std::move(quit_closure_).Run();
}
void WaitForWriteCommit() {
base::RunLoop run_loop;
quit_closure_ = run_loop.QuitClosure();
run_loop.Run();
}
private:
base::OnceClosure quit_closure_;
};
} // namespace
class InterstitialPageImplTest : public ContentBrowserTest {
public:
InterstitialPageImplTest() {}
~InterstitialPageImplTest() override {}
protected:
void SetUpInterstitialPage() {
WebContentsImpl* web_contents =
static_cast<WebContentsImpl*>(shell()->web_contents());
// Create the interstitial page.
TestInterstitialPageDelegate* interstitial_delegate =
new TestInterstitialPageDelegate;
GURL url("http://interstitial");
interstitial_.reset(new InterstitialPageImpl(
web_contents, static_cast<RenderWidgetHostDelegate*>(web_contents),
true, url, interstitial_delegate));
interstitial_->Show();
WaitForInterstitialAttach(web_contents);
// Focus the interstitial frame
FrameTree* frame_tree =
static_cast<RenderViewHostDelegate*>(interstitial_.get())
->GetFrameTree();
static_cast<RenderFrameHostDelegate*>(interstitial_.get())
->SetFocusedFrame(frame_tree->root(),
frame_tree->GetMainFrame()->GetSiteInstance());
// Wait until page loads completely.
ASSERT_TRUE(WaitForRenderFrameReady(interstitial_->GetMainFrame()));
}
void TearDownInterstitialPage() {
// Close the interstitial.
interstitial_->DontProceed();
WaitForInterstitialDetach(shell()->web_contents());
interstitial_.reset();
}
InterstitialPageImpl* interstitial() { return interstitial_.get(); }
bool FocusInputAndSelectText() {
return ExecuteScript(interstitial_->GetMainFrame(), "focus_select_input()");
}
bool GetInputText(std::string* input_text) {
return ExecuteScriptAndExtractString(interstitial_->GetMainFrame(),
"get_input_text()", input_text);
}
bool GetSelection(std::string* input_text) {
return ExecuteScriptAndExtractString(interstitial_->GetMainFrame(),
"get_selection()", input_text);
}
bool CreateInputAndSetText(const std::string& text) {
return ExecuteScript(interstitial_->GetMainFrame(),
"create_input_and_set_text('" + text + "')");
}
bool SetSelectionChangeListener() {
return ExecuteScript(interstitial_->GetMainFrame(),
"set_selection_change_listener()");
}
void PerformCut() {
ClipboardChangedObserver clipboard_observer;
const base::string16 expected_title = base::UTF8ToUTF16("TEXT_CHANGED");
content::TitleWatcher title_watcher(shell()->web_contents(),
expected_title);
RenderFrameHostImpl* rfh =
static_cast<RenderFrameHostImpl*>(interstitial_->GetMainFrame());
rfh->GetRenderWidgetHost()->delegate()->Cut();
clipboard_observer.WaitForWriteCommit();
EXPECT_EQ(expected_title, title_watcher.WaitAndGetTitle());
}
void PerformCopy() {
ClipboardChangedObserver clipboard_observer;
RenderFrameHostImpl* rfh =
static_cast<RenderFrameHostImpl*>(interstitial_->GetMainFrame());
rfh->GetRenderWidgetHost()->delegate()->Copy();
clipboard_observer.WaitForWriteCommit();
}
void PerformPaste() {
const base::string16 expected_title = base::UTF8ToUTF16("TEXT_CHANGED");
content::TitleWatcher title_watcher(shell()->web_contents(),
expected_title);
RenderFrameHostImpl* rfh =
static_cast<RenderFrameHostImpl*>(interstitial_->GetMainFrame());
rfh->GetRenderWidgetHost()->delegate()->Paste();
EXPECT_EQ(expected_title, title_watcher.WaitAndGetTitle());
}
void PerformSelectAll() {
const base::string16 expected_title =
base::UTF8ToUTF16("SELECTION_CHANGED");
content::TitleWatcher title_watcher(shell()->web_contents(),
expected_title);
RenderFrameHostImpl* rfh =
static_cast<RenderFrameHostImpl*>(interstitial_->GetMainFrame());
rfh->GetRenderWidgetHost()->delegate()->SelectAll();
EXPECT_EQ(expected_title, title_watcher.WaitAndGetTitle());
}
void PerformBack() {
RenderFrameHostImpl* rfh =
static_cast<RenderFrameHostImpl*>(interstitial_->GetMainFrame());
rfh->GetRenderWidgetHost()->ForwardMouseEvent(blink::WebMouseEvent(
blink::WebInputEvent::Type::kMouseUp, blink::WebFloatPoint(),
blink::WebFloatPoint(), blink::WebPointerProperties::Button::kBack, 0,
0, base::TimeTicks::Now()));
}
private:
std::unique_ptr<InterstitialPageImpl> interstitial_;
DISALLOW_COPY_AND_ASSIGN(InterstitialPageImplTest);
};
IN_PROC_BROWSER_TEST_F(InterstitialPageImplTest, Cut) {
BrowserTestClipboardScope clipboard;
SetUpInterstitialPage();
ASSERT_TRUE(CreateInputAndSetText("text-to-cut"));
ASSERT_TRUE(FocusInputAndSelectText());
PerformCut();
std::string clipboard_text;
clipboard.GetText(&clipboard_text);
EXPECT_EQ("text-to-cut", clipboard_text);
std::string input_text;
ASSERT_TRUE(GetInputText(&input_text));
EXPECT_EQ(std::string(), input_text);
TearDownInterstitialPage();
}
IN_PROC_BROWSER_TEST_F(InterstitialPageImplTest, Copy) {
BrowserTestClipboardScope clipboard;
SetUpInterstitialPage();
ASSERT_TRUE(CreateInputAndSetText("text-to-copy"));
ASSERT_TRUE(FocusInputAndSelectText());
PerformCopy();
std::string clipboard_text;
clipboard.GetText(&clipboard_text);
EXPECT_EQ("text-to-copy", clipboard_text);
std::string input_text;
ASSERT_TRUE(GetInputText(&input_text));
EXPECT_EQ("text-to-copy", input_text);
TearDownInterstitialPage();
}
IN_PROC_BROWSER_TEST_F(InterstitialPageImplTest, Paste) {
BrowserTestClipboardScope clipboard;
SetUpInterstitialPage();
clipboard.SetText("text-to-paste");
ASSERT_TRUE(CreateInputAndSetText(std::string()));
ASSERT_TRUE(FocusInputAndSelectText());
PerformPaste();
std::string input_text;
ASSERT_TRUE(GetInputText(&input_text));
EXPECT_EQ("text-to-paste", input_text);
TearDownInterstitialPage();
}
IN_PROC_BROWSER_TEST_F(InterstitialPageImplTest, SelectAll) {
SetUpInterstitialPage();
ASSERT_TRUE(SetSelectionChangeListener());
std::string input_text;
ASSERT_TRUE(GetSelection(&input_text));
EXPECT_EQ(std::string(), input_text);
PerformSelectAll();
ASSERT_TRUE(GetSelection(&input_text));
EXPECT_EQ("original body text", input_text);
TearDownInterstitialPage();
}
IN_PROC_BROWSER_TEST_F(InterstitialPageImplTest, FocusAfterDetaching) {
WebContentsImpl* web_contents =
static_cast<WebContentsImpl*>(shell()->web_contents());
// Load something into the WebContents.
EXPECT_TRUE(NavigateToURL(shell(), GURL("about:blank")));
// Blur the main frame.
web_contents->GetMainFrame()->GetRenderWidgetHost()->Blur();
EXPECT_FALSE(
web_contents->GetMainFrame()->GetRenderWidgetHost()->is_focused());
// Setup the interstitial and focus it.
SetUpInterstitialPage();
interstitial()->GetView()->GetRenderWidgetHost()->Focus();
EXPECT_TRUE(web_contents->ShowingInterstitialPage());
EXPECT_TRUE(static_cast<RenderWidgetHostImpl*>(
interstitial()->GetView()->GetRenderWidgetHost())
->is_focused());
// Tear down interstitial.
TearDownInterstitialPage();
// Since the interstitial was focused, the main frame should be now focused
// after the interstitial teardown.
EXPECT_TRUE(web_contents->GetRenderViewHost()->GetWidget()->is_focused());
}
// Ensure that we don't show the underlying RenderWidgetHostView if a subframe
// commits in the original page while an interstitial is showing.
// See https://crbug.com/729105.
IN_PROC_BROWSER_TEST_F(InterstitialPageImplTest, UnderlyingSubframeCommit) {
ASSERT_TRUE(embedded_test_server()->Start());
// Load an initial page and inject an iframe that won't commit yet.
WebContentsImpl* web_contents =
static_cast<WebContentsImpl*>(shell()->web_contents());
GURL main_url(embedded_test_server()->GetURL("/title1.html"));
GURL slow_url(embedded_test_server()->GetURL("/title2.html"));
EXPECT_TRUE(NavigateToURL(shell(), main_url));
TestNavigationManager subframe_delayer(web_contents, slow_url);
{
std::string script =
"var iframe = document.createElement('iframe');"
"iframe.src = '" +
slow_url.spec() +
"';"
"document.body.appendChild(iframe);";
EXPECT_TRUE(ExecuteScript(web_contents->GetMainFrame(), script));
}
EXPECT_TRUE(subframe_delayer.WaitForRequestStart());
// Show an interstitial. The underlying RenderWidgetHostView should not be
// showing.
SetUpInterstitialPage();
EXPECT_FALSE(web_contents->GetMainFrame()->GetView()->IsShowing());
EXPECT_TRUE(web_contents->GetMainFrame()->GetRenderWidgetHost()->is_hidden());
// Allow the subframe to commit.
subframe_delayer.WaitForNavigationFinished();
// The underlying RenderWidgetHostView should still not be showing.
EXPECT_FALSE(web_contents->GetMainFrame()->GetView()->IsShowing());
EXPECT_TRUE(web_contents->GetMainFrame()->GetRenderWidgetHost()->is_hidden());
TearDownInterstitialPage();
}
IN_PROC_BROWSER_TEST_F(InterstitialPageImplTest, BackMouseButton) {
ASSERT_TRUE(embedded_test_server()->Start());
// Load something into the WebContents.
EXPECT_TRUE(NavigateToURL(
shell(), GURL(embedded_test_server()->GetURL("/title1.html"))));
SetUpInterstitialPage();
EXPECT_TRUE(shell()->web_contents()->ShowingInterstitialPage());
PerformBack();
EXPECT_FALSE(shell()->web_contents()->ShowingInterstitialPage());
TearDownInterstitialPage();
}
} // namespace content
| [
"rjkroege@chromium.org"
] | rjkroege@chromium.org |
7a307cef0ee02b9a59b0e8750a4ae9af39cea11d | 43088b4ebd6c3f8011c63322cbea12e7d0e16bfd | /tensorflow/core/tpu/kernels/tpu_util.h | 90eef621b95129f97b5a4537ae0e9541395fbc20 | [
"Apache-2.0"
] | permissive | clockzhong/tensorflow | 67b9205feb9e2c7b25125d458c84fc829ad4cdc6 | a127c460cfc339d265c28e7228bccb6c2a3d386f | refs/heads/master | 2021-01-11T20:40:42.007207 | 2020-07-22T04:59:41 | 2020-07-22T04:59:41 | 237,733,939 | 0 | 0 | Apache-2.0 | 2020-02-02T07:19:01 | 2020-02-02T07:19:00 | null | UTF-8 | C++ | false | false | 2,462 | h | /* Copyright 2020 The TensorFlow Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/
#ifndef TENSORFLOW_CORE_TPU_KERNELS_TPU_UTIL_H_
#define TENSORFLOW_CORE_TPU_KERNELS_TPU_UTIL_H_
#include <string>
#include <vector>
#include "absl/strings/str_cat.h"
#include "tensorflow/cc/framework/ops.h"
#include "tensorflow/compiler/tf2xla/xla_compiler.h"
#include "tensorflow/compiler/xla/client/compile_only_client.h"
#include "tensorflow/compiler/xla/statusor.h"
#include "tensorflow/core/protobuf/config.pb.h"
#include "tensorflow/core/tpu/kernels/tpu_compilation_cache_key.h"
namespace tensorflow {
namespace tpu {
// Utility to get session_name from `SessionMetadata`. `SessionMetadata` may
// be null.
std::string SessionNameFromMetadata(const SessionMetadata* session_metadata);
// Generates cache proto key for a given computation on a TPU core.
std::string ProtoKeyForComputation(const std::string& key, int core);
// Returns a TpuCompilationCacheKey parsed from given key or an error.
xla::StatusOr<TpuCompilationCacheKey> ParseCompilationCacheKey(
const std::string& key);
xla::CompileOnlyClient::AotXlaComputationInstance
BuildAotXlaComputationInstance(
const XlaCompiler::CompilationResult& compilation_result);
// Returns true if TPU compilation is enabled.
bool IsTpuCompilationEnabled();
// Converts an int64 host memory `tensor` to a `shape`.
Status ShapeTensorToTensorShape(const Tensor& tensor, TensorShape* shape);
Status DynamicShapesToTensorShapes(const OpInputList& dynamic_shapes,
std::vector<TensorShape>* shapes);
Status DynamicShapesToTensorShapes(const InputList& dynamic_shapes,
std::vector<TensorShape>* shapes);
// A callback called on exit.
void LogAndExit(int code);
} // namespace tpu
} // namespace tensorflow
#endif // TENSORFLOW_CORE_TPU_KERNELS_TPU_UTIL_H_
| [
"gardener@tensorflow.org"
] | gardener@tensorflow.org |
e938b5ebd7d1b67ce67e4be08e502cc238ffbffa | aa724c497cde712c028cfa5da379b928fcf7c476 | /modules/dom/node/container/NodeList.h | 1d7d9aa57a4d17bc0b84976f2099540c7e92da98 | [] | no_license | Softnius/Newtoo | 9368cfe197cbc26b75bd3b6b33b145c1f4c83695 | e1562adbb5e59af088163c336292821686b11ef0 | refs/heads/master | 2020-03-30T07:50:07.324762 | 2018-09-29T14:29:37 | 2018-09-29T14:29:37 | 150,969,651 | 8 | 1 | null | 2018-09-30T13:28:14 | 2018-09-30T13:28:13 | null | UTF-8 | C++ | false | false | 273 | h | #pragma once
#include <vector>
namespace Newtoo
{
class Node;
class NodeList
{
public:
unsigned long length() const;
Node* item(unsigned long index);
bool empty();
protected:
std::vector<Node*> mControl;
};
}
| [
"flightblaze@gmail.com"
] | flightblaze@gmail.com |
a2f9b18c53b785afa74b5011006ee88b1e7aa14f | 789f79f0643671cb1108d1e75ed7e9b28262dd98 | /data_gloves/src/hand_controller.ino | 2adc6496fa12e0703f81a4b6f352241f7e02e1ad | [] | no_license | th-nuernberg/build-and-touch | beafb8f2abe5210d3797834bbfccbd2715d21322 | 6b8972c5a0ca1aa12f40ed204c915a1fde257ee8 | refs/heads/main | 2023-04-07T02:44:13.487187 | 2021-04-17T20:27:20 | 2021-04-17T20:27:20 | 347,369,420 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 2,573 | ino | /**
* Map String value to analog ping
* esp32 has no analogWrite, use ledcWrite
*/
#include "BluetoothSerial.h"
#include "Arduino.h"
uint8_t THUMB = 0;
uint8_t INDEX = 1;
uint8_t MIDDLE = 2;
uint8_t RING = 3;
uint8_t PINKY = 4;
uint8_t PALM = 5;
int fingerPins[] = { 12, 13, 14, 25, 26, 27 };
BluetoothSerial SerialBT;
String line;
void setup()
{
SerialBT.begin("controller-right");
// binding fingers (channel) to GPIO pins
mapChannelToGPIO(THUMB, fingerPins[THUMB]);
mapChannelToGPIO(INDEX, fingerPins[INDEX]);
mapChannelToGPIO(MIDDLE, fingerPins[MIDDLE]);
mapChannelToGPIO(RING, fingerPins[RING]);
mapChannelToGPIO(PINKY, fingerPins[PINKY]);
mapChannelToGPIO(PALM, fingerPins[PALM]);
// set pinmode
for (int i=0; i<sizeof(fingerPins); i++)
{
pinMode(fingerPins[i], OUTPUT);
}
}
/**
* channel = channel for ledcWrite esp32 - pin = GPIO with vibrator
*/
void mapChannelToGPIO(int channel, int pin)
{
ledcSetup(channel, 5000, 8);
ledcAttachPin(pin, channel);
}
void loop()
{
if(SerialBT.available())
{
char input = SerialBT.read();
if(input != ';' && input != '\n')
{
line += input;
}
else
{
controlVib(line); line = "";
}
}
}
void btPrint(String text)
{
for(int i=0; i<text.length(); i++){
SerialBT.write(text[i]);
}
}
void btPrintln(String text)
{
btPrint(text);
SerialBT.write('\n');
}
/**
* valuePair = CHANNEL, INTENSITY - e.g. 0,255 - only one at a time!
*/
void controlVib(String valuePair)
{
String s_channel = getValue(valuePair, ',', 0);
String s_intensity = getValue(valuePair, ',', 1);
int channel = s_channel.toInt();
int intensity = s_intensity.toInt();
btPrintln(s_channel + "," + s_intensity);
if (channel >= 0
&& channel < sizeof(fingerPins)
&& intensity >= 0
&& intensity <= 255)
{
ledcWrite(channel, intensity);
}
}
// https://stackoverflow.com/questions/9072320/split-string-into-string-array/14824108#14824108
String getValue(String data, char separator, int index)
{
int found = 0;
int strIndex[] = {0, -1};
int maxIndex = data.length()-1;
for (int i=0; i<=maxIndex && found<=index; i++)
{
if (data.charAt(i)==separator || i==maxIndex)
{
found++;
strIndex[0] = strIndex[1]+1;
strIndex[1] = (i == maxIndex) ? i+1 : i;
}
}
return found>index ? data.substring(strIndex[0], strIndex[1]) : "";
} | [
"dev@pascalkarg.de"
] | dev@pascalkarg.de |
5b294ac94940adf1fd2a222b34c0d3211e44bd22 | 0103ce0fa860abd9f76cfda4979d304d450aba25 | /Source/WebKit/NetworkProcess/NetworkSocketStream.h | 51f62868d012816b824f1f53d2f1d6fa78017468 | [] | no_license | 1C-Company-third-party/webkit | 2dedcae3b5424dd5de1fee6151cd33b35d08567f | f7eec5c68105bea4d4a1dca91734170bdfd537b6 | refs/heads/master | 2022-11-08T12:23:55.380720 | 2019-04-18T12:13:32 | 2019-04-18T12:13:32 | 182,072,953 | 5 | 2 | null | 2022-10-18T10:56:03 | 2019-04-18T11:10:56 | C++ | UTF-8 | C++ | false | false | 3,154 | h | /*
* Copyright (C) 2017 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. 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.
*
* THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS 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 APPLE INC. OR ITS 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.
*/
#pragma once
#include "MessageReceiver.h"
#include "MessageSender.h"
#include <WebCore/SocketStreamHandleClient.h>
#include <WebCore/SocketStreamHandleImpl.h>
#include <pal/SessionID.h>
namespace IPC {
class Connection;
class Decoder;
class DataReference;
}
namespace WebCore {
class SocketStreamHandleImpl;
class URL;
}
namespace WebKit {
class NetworkSocketStream : public RefCounted<NetworkSocketStream>, public IPC::MessageSender, public IPC::MessageReceiver, public WebCore::SocketStreamHandleClient {
public:
static Ref<NetworkSocketStream> create(WebCore::URL&&, PAL::SessionID, const String& credentialPartition, uint64_t, IPC::Connection&, WebCore::SourceApplicationAuditToken&&);
~NetworkSocketStream();
void didReceiveMessage(IPC::Connection&, IPC::Decoder&);
void sendData(const IPC::DataReference&, uint64_t);
void close();
// SocketStreamHandleClient
void didOpenSocketStream(WebCore::SocketStreamHandle&) final;
void didCloseSocketStream(WebCore::SocketStreamHandle&) final;
void didReceiveSocketStreamData(WebCore::SocketStreamHandle&, const char*, size_t) final;
void didFailToReceiveSocketStreamData(WebCore::SocketStreamHandle&) final;
void didUpdateBufferedAmount(WebCore::SocketStreamHandle&, size_t) final;
void didFailSocketStream(WebCore::SocketStreamHandle&, const WebCore::SocketStreamError&) final;
private:
IPC::Connection* messageSenderConnection() final;
uint64_t messageSenderDestinationID() final;
NetworkSocketStream(WebCore::URL&&, PAL::SessionID, const String& credentialPartition, uint64_t, IPC::Connection&, WebCore::SourceApplicationAuditToken&&);
uint64_t m_identifier;
IPC::Connection& m_connection;
Ref<WebCore::SocketStreamHandleImpl> m_impl;
};
} // namespace WebKit
| [
"ruka@1c.ru"
] | ruka@1c.ru |
4ded82a294b13eed2e28dbfa49e5ccf16e9b3512 | 239e46e5c3e86dfba02e559b47b6559ff9b7fa88 | /AngularMomentum.h | 3d98c1060da2c895c1c6d6fafea418f51b0c1adc | [] | no_license | novarios/Shell-Model | 6278d8be86d1014badad30c4ed62a2eb266cf14d | 7018a291ca78226e0a8425b72a7324ca5885ec26 | refs/heads/master | 2021-01-10T20:36:39.196517 | 2015-01-08T07:18:34 | 2015-01-08T07:18:34 | 28,849,749 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,248 | h | #include <iostream>
#include <math.h>
#include <vector>
#include <bitset>
using namespace std;
double StateJ(int count, vector<double> state, vector<int> configs, vector<int> indvec, vector<double> angularmom, vector<double> projections, vector<vector<int> > shellprojections)
{
double temp;
int comp, bcount;
int bra, ket;
int m, n, l, k;
int mbit, nbit, lbit, kbit;
int tempket; //temporary ket to act on
double phase; //phase from applying operators
double Jsquared = 0.0; //isospin squared
double J; //return isospin
vector<int> indicies1, indicies2; //vectors of relevant shells
for (int i = 0; i < int(state.size()); ++i)
{
indicies1.clear();
bra = configs[i];
for (int a = 0; a < int(shellprojections.size()); ++a)
{
for (int b = 0; b < int(shellprojections[a].size()); ++b)
{
if (((1 << (shellprojections[a][b] - 1)) & bra) != 0){ indicies1.push_back(a); break; };
};
};
for (int j = 0; j < int(state.size()); ++j)
{
indicies2.clear();
ket = configs[j];
for (int a = 0; a < int(shellprojections.size()); ++a)
{
for (int b = 0; b < int(shellprojections[a].size()); ++b)
{
if (((1 << (shellprojections[a][b] - 1)) & ket) != 0)
{
for (int c = 0; c < int(indicies1.size()); ++c)
{
if (indicies1[c] == a){ indicies2.push_back(a); break; };
}; break;
};
};
};
//J_z, J_z^2 part
if (bra == ket)
{
temp = 0;
for (int a = 0; a < int(angularmom.size()); ++a)
{
if ((1 << a & ket) != 0){ temp = temp + projections[a]; };
};
Jsquared = Jsquared + state[i] * state[j] * (temp*temp + temp);
};
//J_-J_+ part
temp = 0;
for (int a = 0; a < int(indicies2.size()); ++a)
{
for (int a1 = 0; a1 < int(shellprojections[indicies2[a]].size()) - 1; ++a1) //don't include highest projection
{
for (int a2 = a1 + 1; a2 < int(shellprojections[indicies2[a]].size()); ++a2) //don't include lower (or equal) projections
{
m = shellprojections[indicies2[a]][a1] - 1, n = shellprojections[indicies2[a]][a2] - 1;
if (projections[m] != projections[n] - 1.0){ continue; }
else{
for (int b = 0; b < int(indicies2.size()); ++b)
{
for (int b1 = 1; b1 < int(shellprojections[indicies2[b]].size()); ++b1) //don't include lowest projection
{
for (int b2 = 0; b2 < b1; ++b2) //don't include higher (or equal) projections
{
l = shellprojections[indicies2[b]][b1] - 1, k = shellprojections[indicies2[b]][b2] - 1;
if (projections[l] != projections[k] + 1.0){ continue; }
else{
mbit = 1 << m; nbit = 1 << n; lbit = 1 << l; kbit = 1 << k;
tempket = ket;
phase = 1.0;
if ((tempket & kbit) != 0)
{
comp = tempket & ~(~0 << k);
for (bcount = 0; comp; ++bcount){ comp ^= comp & -comp; };
phase = phase*pow(-1.0, bcount); tempket = tempket^kbit;
if ((tempket & lbit) == 0)
{
comp = tempket & ~(~0 << l);
for (bcount = 0; comp; ++bcount){ comp ^= comp & -comp; };
phase = phase*pow(-1.0, bcount); tempket = tempket^lbit;
if ((tempket & nbit) != 0)
{
comp = tempket & ~(~0 << n);
for (bcount = 0; comp; ++bcount){ comp ^= comp & -comp; };
phase = phase*pow(-1.0, bcount); tempket = tempket^nbit;
if ((tempket & mbit) == 0)
{
comp = tempket & ~(~0 << m);
for (bcount = 0; comp; ++bcount){ comp ^= comp & -comp; };
phase = phase*pow(-1.0, bcount); tempket = tempket^mbit;
if (bra == tempket)
{
temp += phase*sqrt(angularmom[n]*(angularmom[n]+1.0)-projections[n]*(projections[n]-1.0))*sqrt(angularmom[k]*(angularmom[k]+1.0)-projections[k]*(projections[k]+1.0));
};
};
};
};
};
};
};
};
};
};
};
};
};
Jsquared = Jsquared + state[i] * state[j] * temp;
};
};
J = 0.5 * (sqrt(1.0 + 4.0 * Jsquared) - 1.0);
return J;
}
| [
"novarios@nscl.msu.edu"
] | novarios@nscl.msu.edu |
1515f27f6d864dfa4d1560cc57b5920bd358d09b | 6712863f4ba992d6b02e603b8c18c5a098c681eb | /sharif practise/72 template class build in datatypes as constants .cpp | 060cc28c15fc0eb5eb85544bb743de69b5f3d3f5 | [] | no_license | Hasanul-Bari/oop | b141c95492d73c84baa0a3217d11beca5353f3c4 | aa4efdebf83e5e9f1907effc081191aa6fee25e8 | refs/heads/master | 2021-05-17T02:51:48.875156 | 2020-12-31T14:00:44 | 2020-12-31T14:00:44 | 250,583,528 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 224 | cpp | #include<iostream>
using namespace std;
template <class T, int size>
class abc
{
T x[size];
public:
void print()
{
cout<<sizeof(x)<<endl ;
}
};
int main()
{
abc <char,4> obj;
obj.print();
}
| [
"hasanul.bari.hasan96@gmail.com"
] | hasanul.bari.hasan96@gmail.com |
9ee0a112e875d27d296ef105ef405b1b45bcacb6 | c8b39acfd4a857dc15ed3375e0d93e75fa3f1f64 | /Engine/Source/Runtime/Engine/Private/Components/WaveWorksComponent.cpp | 360c934059695bf21ec76b47d2d5a2161908cdf1 | [
"MIT",
"LicenseRef-scancode-proprietary-license"
] | permissive | windystrife/UnrealEngine_NVIDIAGameWorks | c3c7863083653caf1bc67d3ef104fb4b9f302e2a | b50e6338a7c5b26374d66306ebc7807541ff815e | refs/heads/4.18-GameWorks | 2023-03-11T02:50:08.471040 | 2022-01-13T20:50:29 | 2022-01-13T20:50:29 | 124,100,479 | 262 | 179 | MIT | 2022-12-16T05:36:38 | 2018-03-06T15:44:09 | C++ | UTF-8 | C++ | false | false | 5,066 | cpp | /*
* This code contains NVIDIA Confidential Information and is disclosed
* under the Mutual Non-Disclosure Agreement.
*
* Notice
* ALL NVIDIA DESIGN SPECIFICATIONS AND CODE ("MATERIALS") ARE PROVIDED "AS IS" NVIDIA MAKES
* NO REPRESENTATIONS, WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
* THE MATERIALS, AND EXPRESSLY DISCLAIMS ANY IMPLIED WARRANTIES OF NONINFRINGEMENT,
* MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
*
* NVIDIA Corporation assumes no responsibility for the consequences of use of such
* information or for any infringement of patents or other rights of third parties that may
* result from its use. No license is granted by implication or otherwise under any patent
* or patent rights of NVIDIA Corporation. No third party distribution is allowed unless
* expressly authorized by NVIDIA. Details are subject to change without notice.
* This code supersedes and replaces all information previously supplied.
* NVIDIA Corporation products are not authorized for use as critical
* components in life support devices or systems without express written approval of
* NVIDIA Corporation.
*
* Copyright ?2008- 2016 NVIDIA Corporation. All rights reserved.
*
* NVIDIA Corporation and its licensors retain all intellectual property and proprietary
* rights in and to this software and related documentation and any modifications thereto.
* Any use, reproduction, disclosure or distribution of this software and related
* documentation without an express license agreement from NVIDIA Corporation is
* strictly prohibited.
*/
/*=============================================================================
WaveWorksComponent.cpp: UWaveWorksComponent implementation.
=============================================================================*/
#include "Components/WaveWorksComponent.h"
#include "GFSDK_WaveWorks.h"
#include "Engine/WaveWorks.h"
#include "WaveWorksRender.h"
#include "WaveWorksResource.h"
#include "Engine/WaveWorksShorelineCapture.h"
/*-----------------------------------------------------------------------------
UWaveWorksComponent
-----------------------------------------------------------------------------*/
UWaveWorksComponent::UWaveWorksComponent(const class FObjectInitializer& PCIP)
: Super(PCIP)
, MeshDim(128)
, MinPatchLength(128.0f)
, AutoRootLOD(20)
, UpperGridCoverage(64.0f)
, SeaLevel(0.0f)
, TessellationLOD(100.0f)
, bUsesGlobalDistanceField(false)
, WaveWorksAsset(nullptr)
{
PrimaryComponentTick.bCanEverTick = true;
}
FPrimitiveSceneProxy* UWaveWorksComponent::CreateSceneProxy()
{
FWaveWorksSceneProxy* WaveWorksSceneProxy = nullptr;
if (WaveWorksMaterial != nullptr && WaveWorksAsset != nullptr)
{
WaveWorksSceneProxy = new FWaveWorksSceneProxy(this, WaveWorksAsset);
if (nullptr == WaveWorksSceneProxy->GetQuadTreeHandle())
{
WaveWorksSceneProxy->AttemptCreateQuadTree();
}
}
return WaveWorksSceneProxy;
}
void UWaveWorksComponent::BeginPlay()
{
Super::BeginPlay();
}
void UWaveWorksComponent::BeginDestroy()
{
Super::BeginDestroy();
}
FBoxSphereBounds UWaveWorksComponent::CalcBounds(const FTransform& LocalToWorld) const
{
FWaveWorksResource* waveWorksResource = (WaveWorksAsset != nullptr) ? WaveWorksAsset->GetWaveWorksResource() : nullptr;
float zExtent = (waveWorksResource) ? waveWorksResource->GetGerstnerAmplitude() : 100.0f;
FBoxSphereBounds NewBounds;
NewBounds.Origin = FVector::ZeroVector;
NewBounds.BoxExtent = FVector(HALF_WORLD_MAX, HALF_WORLD_MAX, zExtent);
NewBounds.SphereRadius = FMath::Sqrt(3.0f * FMath::Square(HALF_WORLD_MAX));
return NewBounds;
}
void UWaveWorksComponent::SetWindVector( const FVector2D& windVector )
{
if( !WaveWorksAsset )
return;
WaveWorksAsset->WindDirection = windVector;
}
void UWaveWorksComponent::SetWindSpeed( const float& windSpeed )
{
if( !WaveWorksAsset )
return;
WaveWorksAsset->WindSpeed = windSpeed;
}
void UWaveWorksComponent::SampleDisplacements(TArray<FVector> InSamplePoints, FWaveWorksSampleDisplacementsDelegate VectorArrayDelegate)
{
if ( !SceneProxy )
return;
FWaveWorksSceneProxy* WaveWorksSceneProxy = static_cast<FWaveWorksSceneProxy*>(SceneProxy);
WaveWorksSceneProxy->SampleDisplacements_GameThread(InSamplePoints, VectorArrayDelegate);
}
void UWaveWorksComponent::GetIntersectPointWithRay(
FVector InOriginPoint,
FVector InDirection,
FWaveWorksRaycastResultDelegate OnRecieveIntersectPointDelegate)
{
if ( !SceneProxy )
return;
FWaveWorksSceneProxy* WaveWorksSceneProxy = static_cast<FWaveWorksSceneProxy*>(SceneProxy);
WaveWorksSceneProxy->GetIntersectPointWithRay_GameThread(InOriginPoint, InDirection, SeaLevel, OnRecieveIntersectPointDelegate);
}
void UWaveWorksComponent::TickComponent(float DeltaTime, enum ELevelTick TickType, FActorComponentTickFunction *ThisTickFunction)
{
if ( SceneProxy )
{
FWaveWorksSceneProxy* WaveWorksSceneProxy = static_cast<FWaveWorksSceneProxy*>(SceneProxy);
if (nullptr == WaveWorksSceneProxy->GetQuadTreeHandle())
{
WaveWorksSceneProxy->AttemptCreateQuadTree();
}
}
} | [
"tungnt.rec@gmail.com"
] | tungnt.rec@gmail.com |
3448ec42867998779837a6a57da26bb5f34b1314 | bda8f1eb9b8ea92387c38be585e4f34f963ed769 | /2963.cpp | 2f4812e6ef0c4b6bc513b46daf17454f168a9da7 | [] | no_license | rafabm90/URI-Exercise | d267789a6251a50c373e7fb8349da1b165f60e33 | d3e69071bce7b4b9161a45ededa8ffeb27c00d32 | refs/heads/master | 2023-03-26T01:37:53.883149 | 2021-03-25T12:37:42 | 2021-03-25T12:37:42 | 348,078,974 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 386 | cpp | /*
by: Rafael Borges Morais
*/
#include <iostream>
using namespace std;
int main()
{
int N, i, cand[100000], maior = 0;
cin >> N;
for(i = 0;i < N; i++)
{
cin >> cand[i];
if(cand[i] > maior)
maior = cand[i];
}
if(cand[0] >= maior)
cout << "S" << endl;
else
cout << "N" << endl;
return 0;
}
| [
"rafabm90@gmail.com"
] | rafabm90@gmail.com |
98f7816b8b6f66ca96ea2eb4f156e07ae85d063c | 8dc2feaefb117de207151d135ad949ab4b213bcb | /comp1117/palindrome.cpp | 71f4458da99b8979f4a94c64ec527f368c786f54 | [] | no_license | Hyunjulie/HKU_classes | 08f93686d3fa24a9dbfb995e415910bd765a9e5f | 58c1ebceeb67305dc5ae1c40ef55d9dd53230712 | refs/heads/master | 2020-04-02T00:19:17.108876 | 2018-12-06T15:19:28 | 2018-12-06T15:19:28 | 153,798,896 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 576 | cpp | //Exercise: Checking Palindrome
#include <iostream>
#include <string>
using namespace std;
int main()
{
string input;
int length = 0;
bool palindrome = true;
cout << "Please input a word: ";
cin >> input;
length = input.length();
for (int i = 0; i < length / 2; i++)
{
if (input[i] != input[length - i - 1])
{
palindrome = false;
break;
}
}
if (palindrome)
cout << input << " is a palindrome!\n";
else
cout << input << " is not a palindrome!\n";
return 0;
}
| [
"sg04088@gmail.com"
] | sg04088@gmail.com |
4075a77a891e8716eed3a0da34fb6946c60aaf66 | 2f10f807d3307b83293a521da600c02623cdda82 | /deps/boost/win/debug/include/boost/thread/csbl/deque.hpp | e2d934b17f3a6ec718cd33ff43b61b4f81cbd50a | [] | no_license | xpierrohk/dpt-rp1-cpp | 2ca4e377628363c3e9d41f88c8cbccc0fc2f1a1e | 643d053983fce3e6b099e2d3c9ab8387d0ea5a75 | refs/heads/master | 2021-05-23T08:19:48.823198 | 2019-07-26T17:35:28 | 2019-07-26T17:35:28 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 129 | hpp | version https://git-lfs.github.com/spec/v1
oid sha256:0d8fc6a2ea3a31d4c869c79ffff8344b51a711545046564611e980b7c9dce076
size 1593
| [
"YLiLarry@gmail.com"
] | YLiLarry@gmail.com |
09405330e79d6e5fd67b2a8781c5f599b7be7a0f | bd05e07c24f4025d120138536f212e2af23eee67 | /ShaderPractice/ShaderPractice/SourceFile/RigidObject.cpp | a9b949283aa693bdd4ea67485a138be07d5bcc98 | [] | no_license | sarashin/MyDxProgram | 068c02886e1a1cb067c4133f1e5881cc03afb483 | 6b19116cc826abb868c893d2dc0535680dd61316 | refs/heads/master | 2020-05-16T09:52:49.327934 | 2019-04-23T08:27:03 | 2019-04-23T08:27:03 | 182,964,354 | 0 | 0 | null | null | null | null | SHIFT_JIS | C++ | false | false | 1,796 | cpp | #include "stdafx.h"
#include "RigidObject.h"
#include "PhysicsWorld.h"
using namespace physx;
//コンストラクタ
RigidObject::RigidObject()
{
m_pActor.reset(new RigidBody);
}
//コンストラクタ
//pActor : アクタのポインタ
RigidObject::RigidObject(RigidBody* pActor)
{
m_pActor.reset(pActor);
m_InitMat = pActor->GetPxTrans();
}
//コンストラクタ
//ObjectShape: 形状
//ShapeSize : 形状の大きさ
//Trans : 初期座標
//Weight : 質量
RigidObject::RigidObject(int ObjectShape, XMVECTOR ShapeSize, Transform Trans, float Weight = 1.0)
{
CreateActor(ObjectShape,ShapeSize,Trans,Weight);
m_InitMat = Trans;
}
//デストラクタ
RigidObject::~RigidObject()
{
Release();
}
//形状作成
//ObjectShape: 形状
//ShapeSize : 形状の大きさ
//Trans : 初期座標
//Weight : 質量
void RigidObject::CreateActor(int ObjectShape, XMVECTOR ShapeSize,Transform Trans, float Weight = 1.0)
{
m_pActor.reset();
m_pActor = make_shared<RigidBody>();
PhysicsWorld::GetInstance().CreateRigid(m_pActor, ObjectShape, ShapeSize, Trans,Weight);
m_InitMat = Trans;
}
//初期化
void RigidObject::Init()
{
m_pActor->SetPxMat(m_InitMat);
}
//更新
void RigidObject::Update()
{
}
//オブジェクトに力を加える
//speed : ベクトルの大きさ
//Vec : 方向ベクトル
void RigidObject::AddForce(float speed, XMFLOAT3 Vec)
{
m_pActor->AddForce(speed, Vec);
}
//オブジェクトに回転する力を加える
//speed : ベクトルの大きさ
//Vec : 方向ベクトル
void RigidObject::AddTorque(float speed, XMFLOAT3 Vec)
{
m_pActor->AddTorque(speed, Vec);
}
//PhysXでの座標取得
Transform RigidObject::GetPxTrans()
{
return m_pActor->GetPxTrans();
}
//解放
void RigidObject::Release()
{
m_pActor.reset();
} | [
"sarashin"
] | sarashin |
0cc033341932f729f07d1081958706035f19fe51 | 3a3ed2c22e418467b9a54863e810116d8f3e5f0a | /src/SGIEngine/NetworkEngine.h | 04a6c66b4eaa36c2e6b8e4026ca9e884e744b356 | [] | no_license | ArnauBigas/SGI-Engine | dbb96d99075fb481e12a64eef4efd7e7752fc808 | 882ed9647d9be104b5706fdeeed44946f9d16587 | refs/heads/master | 2021-05-31T13:04:32.336605 | 2016-05-06T20:22:19 | 2016-05-06T20:22:19 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 688 | h | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/*
* File: NetworkEngine.h
* Author: arnaubigas
*
* Created on March 19, 2016, 7:17 PM
*/
#ifndef NETWORKENGINE_H
#define NETWORKENGINE_H
#define MAXPACKETLENGTH 1024
namespace NetworkEngine {
bool init(bool client);
bool startServer();
bool connectToServer(const char* ip, int port);
bool checkInboundConnections();
void sendPacket();
void acceptIncomingConnections(bool accept);
void kill();
}
#endif /* NETWORKENGINE_H */
| [
"arnau.bigas@gmail.com"
] | arnau.bigas@gmail.com |
754015f9c1e1755c4734c675c27fdc67f0b260a5 | 20008313aefde06071d3cfce9f8fc1cd358c0c01 | /motors_ultrasonic.ino | 6efc2e1689cbd6a768bd5cda796262045f00acf4 | [] | no_license | GarmitPant/The-Leviathan | fd02b60f757f7fbb635250d1508cb9eb46bd2b23 | 4da8c732538d9df5c30ea6169753e9f5197fdc03 | refs/heads/master | 2020-09-22T08:28:42.090836 | 2019-12-01T07:19:29 | 2019-12-01T07:19:29 | 225,121,703 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,830 | ino | const int trigpin = 8;
const int echopin= 7;
long duration;
int distance;
const int leftForward=2;
const int leftBackward=3;
const int rightForward=4;
const int rightBackward=5;
void setup() {
// put your setup code here, to run once:
pinMode(trigpin,OUTPUT);
pinMode(echopin,INPUT);
Serial.begin(9600);
pinMode(leftForward, OUTPUT);
pinMode(leftBackward, OUTPUT);
pinMode(rightForward, OUTPUT);
pinMode(rightBackward, OUTPUT);
}
void loop() {
// put your main code here, to run repeatedly:
digitalWrite(trigpin,HIGH);
delayMicroseconds(1);
digitalWrite(trigpin,LOW);
duration=pulseIn(echopin,HIGH);
distance = duration*0.034/2;
while (distance < 2){
performTask(random(4));
}
if (Serial.available()){
performTask(0);
}
else{
performTask(random(3));
}
}
void moveForward(){
digitalWrite(leftForward, HIGH);
digitalWrite(leftBackward, LOW);
digitalWrite(rightForward, HIGH);
digitalWrite(rightBackward, LOW);
delay(10000);
}
void moveRight(){
digitalWrite(leftForward, HIGH);
digitalWrite(leftBackward, LOW);
digitalWrite(rightForward, LOW);
digitalWrite(rightBackward, LOW);
delay(5000);
}
void moveLeft(){
digitalWrite(leftForward, LOW);
digitalWrite(leftBackward, LOW);
digitalWrite(rightForward, HIGH);
digitalWrite(rightBackward, LOW);
delay(5000);
}
void moveReverse(){
digitalWrite(leftForward, LOW);
digitalWrite(leftBackward, HIGH);
digitalWrite(rightForward, LOW);
digitalWrite(rightBackward, HIGH);
delay(5000);
}
void performTask(int a){
switch (a) {
case 0:
moveForward();
break;
case 1:
moveRight();
break;
case 2:
moveLeft();
break;
case 3:
moveReverse();
break;
}
}
| [
"noreply@github.com"
] | noreply@github.com |
af20d85307fa0feba6c26d3922b71c04e546ab30 | 18f84b8031ab8ccf54cd4a4e2693fa16dc49ce13 | /tcp-server-application.h | 3c67449b5d0ac97a6073af9fc1319bbcc4a4f95e | [] | no_license | ashiqopu/tcpgrid | dbf4799c7777f0168600687cbb675d0d28204fc0 | 62f57a5653e0dccec8e25c39190d668f2cad402a | refs/heads/master | 2021-09-02T06:11:21.746044 | 2017-12-30T23:19:39 | 2017-12-30T23:19:39 | 115,830,570 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 6,148 | h | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright 2007 University of Washington
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Author: Tom Henderson (tomhend@u.washington.edu)
*/
#ifndef TCP_SERVER_APPLICATION_H
#define TCP_SERVER_APPLICATION_H
#include "ns3/application.h"
#include "ns3/event-id.h"
#include "ns3/ptr.h"
#include "ns3/traced-callback.h"
#include "ns3/address.h"
#include <map>
#include "ns3/object-factory.h"
#include "ns3/ipv4-address.h"
#include "ns3/node-container.h"
#include "ns3/application-container.h"
namespace ns3 {
class Address;
class Socket;
class Packet;
class TcpServerApplication : public Application
{
public:
/**
* \brief Get the type ID.
* \return the object TypeId
*/
static TypeId GetTypeId (void);
TcpServerApplication ();
virtual ~TcpServerApplication ();
/**
* \return the total bytes received in this sink app
*/
uint32_t GetTotalRx () const;
void SetMaxBytes (uint32_t maxBytes);
/**
* \return pointer to listening socket
*/
Ptr<Socket> GetListeningSocket (void) const;
/**
* \return list of pointers to accepted sockets
*/
std::list<Ptr<Socket> > GetAcceptedSockets (void) const;
protected:
virtual void DoDispose (void);
private:
// inherited from Application base class.
virtual void StartApplication (void); // Called at time specified by Start
virtual void StopApplication (void); // Called at time specified by Stop
/**
* \brief Handle a packet received by the application
* \param socket the receiving socket
*/
void HandleRead (Ptr<Socket> socket);
void SendData (Ptr<Socket> socket, Address from); // for socket's SetSendCallback
/**
* \brief Handle an incoming connection
* \param socket the incoming connection socket
* \param from the address the connection is from
*/
void HandleAccept (Ptr<Socket> socket, const Address& from);
/**
* \brief Handle an connection close
* \param socket the connected socket
*/
void HandlePeerClose (Ptr<Socket> socket);
/**
* \brief Handle an connection error
* \param socket the connected socket
*/
void HandlePeerError (Ptr<Socket> socket);
// In the case of TCP, each socket accept returns a new socket, so the
// listening socket is stored separately from the accepted sockets
Ptr<Socket> m_socket; //!< Listening socket
std::list<Ptr<Socket> > m_socketList; //!< the accepted sockets
std::map<Address,bool> sv_connected; // list of connected clients
Address m_local; //!< Local address to bind to
uint32_t m_totalRx; //!< Total bytes received
uint32_t m_sendSize; //!< Size of data to send each time
uint32_t m_maxBytes; //!< Limit total number of bytes sent
uint32_t m_totBytes; //!< Total bytes sent so far
TypeId m_tid; //!< Protocol TypeId
/// Traced Callback: received packets, source address.
TracedCallback<Ptr<const Packet> > m_txTrace;
TracedCallback<Ptr<const Packet>, const Address &> m_rxTrace;
};
/**
* \ingroup tcpserver
* \brief A helper to make it easier to instantiate an ns3::TcpServerApplication
* on a set of nodes.
*/
class TcpServerApplicationHelper
{
public:
/**
* Create a TcpServerApplicationHelper to make it easier to work with TcpServerApplications
*
* \param protocol the name of the protocol to use to receive traffic
* This string identifies the socket factory type used to create
* sockets for the applications. A typical value would be
* ns3::TcpSocketFactory.
* \param address the address of the sink,
*
*/
TcpServerApplicationHelper (Address address);
/**
* Helper function used to set the underlying application attributes.
*
* \param name the name of the application attribute to set
* \param value the value of the application attribute to set
*/
void SetAttribute (std::string name, const AttributeValue &value);
/**
* Install an ns3::TcpServerApplication on each node of the input container
* configured with all the attributes set with SetAttribute.
*
* \param c NodeContainer of the set of nodes on which a TcpServerApplication
* will be installed.
* \returns Container of Ptr to the applications installed.
*/
ApplicationContainer Install (NodeContainer c) const;
/**
* Install an ns3::TcpServerApplication on each node of the input container
* configured with all the attributes set with SetAttribute.
*
* \param node The node on which a TcpServerApplication will be installed.
* \returns Container of Ptr to the applications installed.
*/
ApplicationContainer Install (Ptr<Node> node) const;
/**
* Install an ns3::TcpServerApplication on each node of the input container
* configured with all the attributes set with SetAttribute.
*
* \param nodeName The name of the node on which a TcpServerApplication will be installed.
* \returns Container of Ptr to the applications installed.
*/
ApplicationContainer Install (std::string nodeName) const;
private:
/**
* Install an ns3::TcpServer on the node configured with all the
* attributes set with SetAttribute.
*
* \param node The node on which an TcpServer will be installed.
* \returns Ptr to the application installed.
*/
Ptr<Application> InstallPriv (Ptr<Node> node) const;
ObjectFactory m_factory; //!< Object factory.
};
} // namespace ns3
#endif /* TCP_SERVER_APPLICATION_H */
| [
"marahman@Mds-MacBook-Pro.local"
] | marahman@Mds-MacBook-Pro.local |
6778f6fbceceb5710d53dfe551e002cf1d4532bb | 4f758b1a0fdf98713219fbf8439d76adcf6f9613 | /code/gui/gui.cpp | a1214851f40ae81b56ff2960216389d36383fdc9 | [] | no_license | uhacz/BitBox_v2 | 265e4621dbeea6f1ce586ceb6424ec504aacdce5 | 00a2dd792abe0effdff2c016bf36de031846ff11 | refs/heads/master | 2021-06-13T20:30:11.475539 | 2019-09-05T21:36:37 | 2019-09-05T21:36:37 | 101,383,205 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,341 | cpp | #include "gui.h"
#include <rdi_backend\rdi_backend_dx11.h>
#include <window\window_interface.h>
#include <window\window.h>
#include <3rd_party\imgui\imgui.h>
#include <3rd_party\imgui\dx11\imgui_impl_dx11.h>
extern LRESULT ImGui_ImplWin32_WndProcHandler( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam );
static int GuiWindowCallback(uintptr_t hwnd, uint32_t msg, uintptr_t wparam, uintptr_t lparam, void* userdata)
{
return (int)ImGui_ImplWin32_WndProcHandler( (HWND)hwnd, msg, wparam, lparam );
}
void GUI::StartUp( BXIWindow* window_plugin, RDIDevice* rdidev )
{
IMGUI_CHECKVERSION();
ImGui::CreateContext();
ImGui::StyleColorsDark();
{
const BXWindow* window = window_plugin->GetWindow();
void* hwnd = (void*)window->GetSystemHandle( window );
ID3D11Device* apiDev = nullptr;
ID3D11DeviceContext* apiCtx = nullptr;
GetAPIDevice( rdidev, &apiDev, &apiCtx );
bool bres = ImGui_ImplDX11_Init( hwnd, apiDev, apiCtx );
SYS_ASSERT( bres );
}
window_plugin->AddCallback( GuiWindowCallback, nullptr );
}
void GUI::ShutDown()
{
ImGui_ImplDX11_Shutdown();
ImGui::DestroyContext();
}
void GUI::NewFrame()
{
ImGui_ImplDX11_NewFrame();
}
void GUI::Draw()
{
ImGui::Render();
ImGui_ImplDX11_RenderDrawData( ImGui::GetDrawData() );
}
| [
"uhacz33@gmail.com"
] | uhacz33@gmail.com |
f3fe7e0dc41f341b2a0bcea51e32521d32078a34 | 0af9965de7527f4ca341833a5831dacd3fb8373f | /LeetCode/longest-palindromic-substring.cpp | 1ea5290f64263b5ec9c9a0825bb4160e05e26b6f | [] | no_license | pcw109550/problem-solving | e69c6b1896cedf40ec50d24c061541035ba30dfc | 333d850a5261b49f32350b6a723c731156b24b8a | refs/heads/master | 2022-09-18T08:25:16.940647 | 2022-09-12T10:29:55 | 2022-09-12T10:29:55 | 237,185,788 | 11 | 1 | null | 2022-09-12T10:18:49 | 2020-01-30T10:05:42 | C++ | UTF-8 | C++ | false | false | 1,002 | cpp | #include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
class Solution {
public:
string longestPalindrome(string s) {
// O(N ** 2)
int N = s.size();
int result_idx = 0, result_max = 0;
vector<vector<bool> > D(N, vector<bool> (N, false));
for (int x = N - 1; x >= 0; x--) {
for (int y = 0; y <= x; y++) {
int i = y;
int j = y + N - 1 - x;
bool is_palin = false;
if (s[i] == s[j]) {
if (i == j || i + 1 == j || D[i + 1][j - 1]) {
D[i][j] = true;
int delta = j - i + 1;
if (result_max < delta) {
result_max = delta;
result_idx = i;
}
}
}
}
}
string result = s.substr(result_idx, result_max);
return result;
}
}; | [
"pcw109550@gmail.com"
] | pcw109550@gmail.com |
665f318e2ac927956cdf8b5ecbb70840e916ceae | 6d914c3d28432cf5856befa2a2d1601c0d32fd6c | /linux/my_application.cc | d3d36d3a9a0ef83e9f2e1848642240f3df68b2dc | [] | no_license | zeeshux7860/firexcode_tutorial | f57d908948cdff403ab20d54db148dbec27f6b29 | b92483b0d6c6fb66d42101d9501eaf6f85bd7a37 | refs/heads/master | 2023-03-17T04:22:40.810060 | 2021-03-14T22:09:17 | 2021-03-14T22:09:17 | 347,766,249 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,668 | cc | #include "my_application.h"
#include <flutter_linux/flutter_linux.h>
#ifdef GDK_WINDOWING_X11
#include <gdk/gdkx.h>
#endif
#include "flutter/generated_plugin_registrant.h"
struct _MyApplication {
GtkApplication parent_instance;
char** dart_entrypoint_arguments;
};
G_DEFINE_TYPE(MyApplication, my_application, GTK_TYPE_APPLICATION)
// Implements GApplication::activate.
static void my_application_activate(GApplication* application) {
MyApplication* self = MY_APPLICATION(application);
GtkWindow* window =
GTK_WINDOW(gtk_application_window_new(GTK_APPLICATION(application)));
// Use a header bar when running in GNOME as this is the common style used
// by applications and is the setup most users will be using (e.g. Ubuntu
// desktop).
// If running on X and not using GNOME then just use a traditional title bar
// in case the window manager does more exotic layout, e.g. tiling.
// If running on Wayland assume the header bar will work (may need changing
// if future cases occur).
gboolean use_header_bar = TRUE;
#ifdef GDK_WINDOWING_X11
GdkScreen *screen = gtk_window_get_screen(window);
if (GDK_IS_X11_SCREEN(screen)) {
const gchar* wm_name = gdk_x11_screen_get_window_manager_name(screen);
if (g_strcmp0(wm_name, "GNOME Shell") != 0) {
use_header_bar = FALSE;
}
}
#endif
if (use_header_bar) {
GtkHeaderBar *header_bar = GTK_HEADER_BAR(gtk_header_bar_new());
gtk_widget_show(GTK_WIDGET(header_bar));
gtk_header_bar_set_title(header_bar, "firexcode_tutorial");
gtk_header_bar_set_show_close_button(header_bar, TRUE);
gtk_window_set_titlebar(window, GTK_WIDGET(header_bar));
}
else {
gtk_window_set_title(window, "firexcode_tutorial");
}
gtk_window_set_default_size(window, 1280, 720);
gtk_widget_show(GTK_WIDGET(window));
g_autoptr(FlDartProject) project = fl_dart_project_new();
fl_dart_project_set_dart_entrypoint_arguments(project, self->dart_entrypoint_arguments);
FlView* view = fl_view_new(project);
gtk_widget_show(GTK_WIDGET(view));
gtk_container_add(GTK_CONTAINER(window), GTK_WIDGET(view));
fl_register_plugins(FL_PLUGIN_REGISTRY(view));
gtk_widget_grab_focus(GTK_WIDGET(view));
}
// Implements GApplication::local_command_line.
static gboolean my_application_local_command_line(GApplication* application, gchar ***arguments, int *exit_status) {
MyApplication* self = MY_APPLICATION(application);
// Strip out the first argument as it is the binary name.
self->dart_entrypoint_arguments = g_strdupv(*arguments + 1);
g_autoptr(GError) error = nullptr;
if (!g_application_register(application, nullptr, &error)) {
g_warning("Failed to register: %s", error->message);
*exit_status = 1;
return TRUE;
}
g_application_activate(application);
*exit_status = 0;
return TRUE;
}
// Implements GObject::dispose.
static void my_application_dispose(GObject *object) {
MyApplication* self = MY_APPLICATION(object);
g_clear_pointer(&self->dart_entrypoint_arguments, g_strfreev);
G_OBJECT_CLASS(my_application_parent_class)->dispose(object);
}
static void my_application_class_init(MyApplicationClass* klass) {
G_APPLICATION_CLASS(klass)->activate = my_application_activate;
G_APPLICATION_CLASS(klass)->local_command_line = my_application_local_command_line;
G_OBJECT_CLASS(klass)->dispose = my_application_dispose;
}
static void my_application_init(MyApplication* self) {}
MyApplication* my_application_new() {
return MY_APPLICATION(g_object_new(my_application_get_type(),
"application-id", APPLICATION_ID,
nullptr));
}
| [
"zeeshux7860.zx@gmail.com"
] | zeeshux7860.zx@gmail.com |
84ec9184c6e0331df825e9ca94ad6b97743678be | ce90498e9c35592a62b4e4ecffe97f4ac5064fb8 | /src/Objects/SchemePair.hpp | 4d250e3d1f1477b4ce6227537c72351485d7f42c | [] | no_license | Vazzi/Schemepp | 5d394fd54e59285fe8a7271c55cf879249c8a049 | 8531a3c37e2a396246d1404789b5655b49b1af10 | refs/heads/master | 2016-08-12T10:15:34.605039 | 2016-01-24T20:29:30 | 2016-01-24T20:29:30 | 50,294,063 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 633 | hpp | #ifndef __SCHEME_PAIR_HPP__
#define __SCHEME_PAIR_HPP__
#include "SchemeObject.hpp"
#include <string>
using std::string;
class SchemePair : public SchemeObject{
public:
SchemePair(SchemeObject *first, SchemeObject *second);
~SchemePair();
SchemeObject* getFirst();
SchemeObject* getSecond();
void setFirst(SchemeObject *f);
void setSecond(SchemeObject *s);
string print() const;
bool equalsTo(const SchemeObject& basicObject) const;
virtual void gc_markPointed();
private:
SchemeObject *m_first;
SchemeObject *m_second;
};
#endif
| [
"vlasakjakub@gmail.com"
] | vlasakjakub@gmail.com |
23f66072c3545ed4497a4bba699bb57854975f75 | a2e04e4eac1cf93bb4c1d429e266197152536a87 | /Cpp/SDK/sailslivery_edna_01_CustomizationDesc_classes.h | 15ac67097dce81226120a1c2b8183ad6ff40bb9d | [] | no_license | zH4x-SDK/zSoT-SDK | 83a4b9fcdf628637613197cf644b7f4d101bb0cb | 61af221bee23701a5df5f60091f96f2cf929846e | refs/heads/main | 2023-07-16T18:23:41.914014 | 2021-08-27T15:44:23 | 2021-08-27T15:44:23 | 400,555,804 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 838 | h | #pragma once
// Name: SoT, Version: 2.2.1.1
/*!!DEFINE!!*/
/*!!HELPER_DEF!!*/
/*!!HELPER_INC!!*/
#ifdef _MSC_VER
#pragma pack(push, 0x01)
#endif
namespace CG
{
//---------------------------------------------------------------------------
// Classes
//---------------------------------------------------------------------------
// BlueprintGeneratedClass sailslivery_edna_01_CustomizationDesc.sailslivery_edna_01_CustomizationDesc_C
// 0x0000 (FullSize[0x0108] - InheritedSize[0x0108])
class Usailslivery_edna_01_CustomizationDesc_C : public UShipCustomizationDesc
{
public:
static UClass* StaticClass()
{
static UClass* ptr = UObject::FindClass("BlueprintGeneratedClass sailslivery_edna_01_CustomizationDesc.sailslivery_edna_01_CustomizationDesc_C");
return ptr;
}
};
}
#ifdef _MSC_VER
#pragma pack(pop)
#endif
| [
"zp2kshield@gmail.com"
] | zp2kshield@gmail.com |
08200db463ec28fe780a223afe19f0a865e3df08 | 92a5f08522a216bb46b2533ab9ff980c38f5eb51 | /MathHistory.h | 34fb2a12c394a0f5ea621619423d3c11ed0d87c9 | [
"MIT"
] | permissive | aneova/ConsoleCalculator | 2ed18f3b000ff07f547a79f40f6a87dce5d3a0c5 | 17c5add2effe1f4e93172bae60913c0b7e1a2744 | refs/heads/master | 2022-12-12T13:55:55.399474 | 2020-08-25T08:16:55 | 2020-08-25T08:16:55 | 290,156,383 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 285 | h | #pragma once
#include <vector>
#include <string>
#include <fstream>
#include <iostream>
class MathHistory
{
public:
static std::vector<std::string> vecHistory;
MathHistory();
MathHistory(const MathHistory & mathHist);
void doAction(int userInput);
void saveResult();
};
| [
"50141369+aneova@users.noreply.github.com"
] | 50141369+aneova@users.noreply.github.com |
2edaa021fc2c67ed6783bb3964705be11c2e3945 | da90f620400168b2085e5b4c93e950fc86d236a9 | /datamodel/src/IntTagCollection.cc | 4f0450f1e37cad830e95b162963b51f55e936777 | [] | no_license | broach1/fcc-edm | 6bb74652d0aad8f94aad92e3f56921fe9d3d9422 | 2d1f7d9d67a1cc889d2b33645ae229018e2a9438 | refs/heads/master | 2020-04-05T23:40:49.396173 | 2016-03-03T13:04:02 | 2016-03-03T13:04:02 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,396 | cc | // standard includes
#include <stdexcept>
#include "IntTagCollection.h"
namespace fcc {
IntTagCollection::IntTagCollection() : m_collectionID(0), m_entries() ,m_refCollections(nullptr), m_data(new IntTagDataContainer() ) {
}
const IntTag IntTagCollection::operator[](unsigned int index) const {
return IntTag(m_entries[index]);
}
const IntTag IntTagCollection::at(unsigned int index) const {
return IntTag(m_entries.at(index));
}
int IntTagCollection::size() const {
return m_entries.size();
}
IntTag IntTagCollection::create(){
auto obj = new IntTagObj();
m_entries.emplace_back(obj);
obj->id = {int(m_entries.size()-1),m_collectionID};
return IntTag(obj);
}
void IntTagCollection::clear(){
m_data->clear();
for (auto& obj : m_entries) { delete obj; }
m_entries.clear();
}
void IntTagCollection::prepareForWrite(){
int index = 0;
auto size = m_entries.size();
m_data->reserve(size);
for (auto& obj : m_entries) {m_data->push_back(obj->data); }
if (m_refCollections != nullptr) {
for (auto& pointer : (*m_refCollections)) {pointer->clear(); }
}
for(int i=0, size = m_data->size(); i != size; ++i){
}
}
void IntTagCollection::prepareAfterRead(){
int index = 0;
for (auto& data : *m_data){
auto obj = new IntTagObj({index,m_collectionID}, data);
m_entries.emplace_back(obj);
++index;
}
}
bool IntTagCollection::setReferences(const podio::ICollectionProvider* collectionProvider){
return true; //TODO: check success
}
void IntTagCollection::push_back(ConstIntTag object){
int size = m_entries.size();
auto obj = object.m_obj;
if (obj->id.index == podio::ObjectID::untracked) {
obj->id = {size,m_collectionID};
m_entries.push_back(obj);
} else {
throw std::invalid_argument( "Object already in a collection. Cannot add it to a second collection " );
}
}
void IntTagCollection::setBuffer(void* address){
m_data = static_cast<IntTagDataContainer*>(address);
}
const IntTag IntTagCollectionIterator::operator* () const {
m_object.m_obj = (*m_collection)[m_index];
return m_object;
}
const IntTag* IntTagCollectionIterator::operator-> () const {
m_object.m_obj = (*m_collection)[m_index];
return &m_object;
}
const IntTagCollectionIterator& IntTagCollectionIterator::operator++() const {
++m_index;
return *this;
}
} // namespace fcc
| [
"clement.helsens@cern.ch"
] | clement.helsens@cern.ch |
c68d3fd9ecf3c0377978d1f6dcda5903b04f6322 | 17cf5c78f1790098a86341f2e890203cee2b4595 | /A1101.cpp | 40f2de64eea7b703dcacff27be7a0881bba96113 | [] | no_license | AppleAndOrange/PAT_Advance | c8a2b11c076997d37b06d57df14b0d11564e0a3d | 9635dcb74d05ffaa279410251ace00402d18390b | refs/heads/master | 2020-04-16T09:24:57.279797 | 2019-02-03T07:36:42 | 2019-02-03T07:36:42 | 165,463,470 | 0 | 0 | null | null | null | null | GB18030 | C++ | false | false | 1,141 | cpp | #include <iostream>
#include <set>
#include <stdio.h>
using namespace std;
int main()
{
#ifndef ONLINE_JUDGE
freopen("G:\\C++\\PATAgain\\test.txt","r",stdin);
#endif // ONLINE_JUDGE
int n;
int inf=999999999;
scanf("%d",&n);
int arr[n],leftMax[n],rightMin[n];
leftMax[0]=0;
rightMin[n-1]=inf;
int mmin=inf,mmax=0;
set<int> s;
for(int i=0;i<n;i++){
int temp;
scanf("%d",&temp);
arr[i]=temp;
}
for(int i=1;i<n;i++){
if(arr[i-1]>mmax){
mmax=arr[i-1];
}
leftMax[i]=mmax;
}
for(int i=n-2;i>=0;i--){
if(arr[i+1]<mmin){
mmin=arr[i+1];
}
rightMin[i]=mmin;
}
for(int i=0;i<n;i++){
if(arr[i]>leftMax[i]&&arr[i]<rightMin[i]){
s.insert(arr[i]);
}
}
printf("%d\n",s.size());
for(set<int>::iterator it=s.begin();it!=s.end();it++){
if(it!=s.begin()){
printf(" ");
}
printf("%d",*it);
}
/*在没有数据满足的情况下也要输出换行*/
if(s.size()==0){
cout<<endl;
}
return 0;
}
| [
"1301550100@qq.com"
] | 1301550100@qq.com |
c376de24dc11d66065a1f2a18cf5014b62271204 | 4fd512ca271222db6a230d1b8a42db9f21e53e0a | /CodeGenerator/Game/CodeMySQL.h | 06491b5e8daf1bc160866f5802aa276fe082fe11 | [] | no_license | li5414/GameEditor | 2ca2305c2e56842af8389ca2e1923719cf272f7d | c8d2f463c334560f698016ddd985689278615f97 | refs/heads/master | 2022-07-05T09:29:36.389703 | 2022-05-26T15:21:39 | 2022-05-26T15:21:39 | 230,262,151 | 1 | 0 | null | 2019-12-26T12:40:52 | 2019-12-26T12:40:51 | null | UTF-8 | C++ | false | false | 840 | h | #ifndef _CODE_MYSQL_H_
#define _CODE_MYSQL_H_
#include "CodeUtility.h"
class CodeMySQL : public CodeUtility
{
public:
static void generate();
protected:
//c++
static void generateCppMySQLDataFile(const MySQLInfo& mysqlInfo, string filePath);
static void generateCppMySQLTableFile(const MySQLInfo& mysqlInfo, string filePath);
static void generateCppMySQLTotalHeaderFile(const myVector<MySQLInfo>& mysqlList, string filePath);
static void generateCppMySQLRegisteFile(const myVector<MySQLInfo>& mysqlList, string filePath);
static void generateStringDefineMySQL(const myVector<MySQLInfo>& mysqlList, string filePath);
static void generateMySQLInstanceDeclare(const myVector<MySQLInfo>& mysqlList, string filePath);
static void generateMySQLInstanceClear(const myVector<MySQLInfo>& mysqlList, string filePath);
protected:
};
#endif | [
"785130190@qq.com"
] | 785130190@qq.com |
9a27fc364043639f9be98074e7b39ffa60f85a01 | 6872c6390949e36035672a97964a0bf9b135a65a | /PacMClone/main.cpp | aa55cc247217c50ed8c880cb70baaf90b7b1f4d6 | [] | no_license | alexisjauregui/PacClone | 37e15d4c5c7e4a053816752486c3afa9f9880f83 | 82197a2b907a6de348ed4b7aee2371f53a3ae56a | refs/heads/master | 2020-05-20T12:32:45.794484 | 2015-09-21T08:20:22 | 2015-09-21T08:20:22 | 42,478,900 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,176 | cpp | #include <iostream>
#include <SFML/Graphics.hpp>
#include "game_state.h"
#include "main_state.h"
using namespace std;
game_state coreState;
bool quit_game = false;
int main() {
cout << "Hello, World!" << endl;
//Applications variables
sf::RenderWindow window(sf::VideoMode(448, 567), "PacMan");
window.setKeyRepeatEnabled(false);
window.setVerticalSyncEnabled(1); // Setting max framerate to 60 (Facultative)
window.setFramerateLimit(60);
coreState.set_window(&window);
coreState.set_state(new main_state());
// run the program as long as the window is open
while (window.isOpen())
{
// check all the window's events that were triggered since the last iteration of the loop
sf::Event event;
while (window.pollEvent(event))
{
// "close requested" event: we close the window
if (event.type == sf::Event::Closed)
window.close();
}
window.clear(sf::Color::Black);
coreState.Update();
coreState.Render();
window.display();
if(quit_game)
{
window.close();
}
}
return 0;
} | [
"alexisjauregui@Alexiss-MacBook-Pro.local"
] | alexisjauregui@Alexiss-MacBook-Pro.local |
9f0e88de92f6b2f9f7f9bce9102df4b267bf7758 | bbc0b5a306dedd1f323199454ed4409e2d5ab941 | /Sem_4/Opp_lab/cpp/a1q10/.vscode/record/pg10.cpp.record/03-26-2019 04-17-41pm.1972.cpp | edea36cc2746d2256b4d96c1fe595b29692b85fc | [] | no_license | SATABDA0207/College | 15a28c0f0516e14ec61b0e9f899408517f0b6282 | bf949f72e226388995f8decf52c6fbc3feb897e2 | refs/heads/master | 2023-02-20T23:06:09.859161 | 2021-01-29T21:51:23 | 2021-01-29T21:51:23 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 6,721 | cpp | #include <iostream>
#include <cstring>
#include <fstream>
#include<string.h>
using namespace std;
class Blance
{
protected:
char acnt_num[21];
int blance;
int month, year, day;
int type;
public:
void get(void)
{
//acnt_num = new char[12];
cout << "Enter the Acount Number: ";
cin >> acnt_num;
cin.ignore();
cout << "Enter the Amount: ";
cin >> blance;
cin.ignore();
time_t t = time(NULL);
tm *timePtr = localtime(&t);
day = (int)timePtr->tm_mday;
month = (int)(timePtr->tm_mon) + 1;
year = (int)(timePtr->tm_year) + 1900;
}
void display(void)
{
cout << "\n===================================================\n";
cout << "\nAccount Number: " << acnt_num << endl;
cout << "Blance: " << blance << endl;
cout << "Last Update: " << day << ":" << month << ":" << year << endl;
}
char *returnactno(void) { return acnt_num; }
};
class saving : public Blance
{
public:
void timeupdate(void)
{
time_t t = time(NULL);
tm *timePtr = localtime(&t);
day = (int)timePtr->tm_mday;
month = (int)(timePtr->tm_mon) + 1;
year = (int)(timePtr->tm_year) + 1900;
}
void transation(void)
{
int type, amount;
cout << "Enter the Transaction Type:(1.withdrawal/2.deposit)\n=>";
cin >> type;
cin.ignore();
cout << "Enter the Amount: ";
cin >> amount;
cin.ignore();
time_t tt = time(NULL);
tm *ttimePtr = localtime(&tt);
day = (int)ttimePtr->tm_mday;
month = (int)(ttimePtr->tm_mon) + 1;
year = (int)(ttimePtr->tm_year) + 1900;
if (amount + 500 > blance && type == 1)
{
cout << "Transaction Faild";
}
else
{
fstream f;
f.open("transaction",ios::app|ios::in|ios::out);
if (type == 1)
{
f<<"Account no: "<<acnt_num<<"\t";
f<<"Type: withdrawl\t"<<amount<<"\t";
f<<"Date: "<<day<<":"<<month<<":"<<year<<endl;
blance -= amount;
}
else
{
f<<"Account no: "<<acnt_num<<"\t";
f<<"Type: deposit\t"<<amount<<"\t";
f<<"Date: "<<day<<":"<<month<<":"<<year<<endl;
blance += amount;
}
timeupdate();
}
}
void display(void)
{
Blance::display();
cout << "Account Type: Saving Account" << endl;
cout << "\n====================================================\n";
}
int returnblance(void) { return blance; }
};
class current : public Blance
{
public:
/*int check_validity(int amount)
{
if(amount>(blance+2000) && type==1){return 0;}
else return 1;
}*/
void timeupdate(void)
{
time_t t = time(NULL);
tm *timePtr = localtime(&t);
day = (int)timePtr->tm_mday;
month = (int)(timePtr->tm_mon) + 1;
year = (int)(timePtr->tm_year) + 1900;
}
void transation(void)
{
int type, amount;
cout << "Enter the Transaction Type:(1.withdrawal/2.deposit)\n=>";
cin >> type;
cin.ignore();
cout << "Enter the Amount: ";
cin >> amount;
cin.ignore();
if (amount > (blance + 20000) && type == 1)
{
cout << "Transaction Faild";
}
else
{
if (type == 1)
{
blance -= amount;
}
else
{
blance += amount;
}
timeupdate();
}
}
void display(void)
{
Blance::display();
cout << "Account Type: Current Account";
cout << "\n====================================================\n";
}
};
class blancelist
{
public:
current clist[10];
saving slist[10];
int count1, count2;
blancelist()
{
count1 = 0;
count2 = 0;
fstream ff;
ff.open("current", ios::binary | ios::in);
current cdum;
while (ff.read((char *)&cdum, sizeof(cdum)))
{
clist[count1] = cdum;
count1++;
}
ff.close();
ff.open("saving", ios::binary | ios::in);
saving sdum;
while (ff.read((char *)&sdum, sizeof(sdum)))
{
slist[count2] = sdum;
count2++;
}
ff.close();
}
void updateFile()
{
remove("saving");
fstream ff;
ff.open("saving", ios::binary|ios::out);
for(int i=0;i<count2;i++)
{
saving dum = slist[i];
ff.write((char*)&dum,sizeof(dum));
}
//slist[0].display();
ff.close();
ff.open("current", ios::binary|ios::out);
for(int i=0;i<count1;i++)
{
current dum = clist[i];
ff.write((char*)&dum,sizeof(dum));
}
//slist[0].display();
}
int check_id(char *c)
{
int i;
for (i = 0; i <= count1; i++)
{
if (strcmp(c, clist[i].returnactno()) == 0)
{
return i;
}
}
for (i = 0; i <= count2; i++)
{
if (strcmp(c, slist[i].returnactno()) == 0)
{
return i;
}
}
return -1;
}
int check(int n, char *c)
{
if (strcmp(c, clist[n].returnactno()) == 0)
{
return 1;
}
else
{
return 0;
}
}
void cprepaird(void)
{
current t;
t.get();
if (check_id(t.returnactno()) >= 0)
{
cout << "The Account No can't be same.";
}
else
{
clist[count1] = t;
count1++;
}
}
void sprepaird(void)
{
saving t;
t.get();
if (check_id(t.returnactno()) >= 0)
{
cout << "The Account No can't be same.";
}
else if (t.returnblance() > 500)
{
slist[count2] = t;
ofstream ff;
count2++;
}
else
{
cout << "Amount cant be less then 500" << endl;
}
}
void update(void)
{
char *acc;
acc = new char[11];
cout << "Enter The Account No\n=>";
cin >> acc;
cin.ignore();
if (check_id(acc) >= 0)
{
int n = check_id(acc);
if (check(n, acc) == 0)
{
slist[n].transation();
}
else
{
clist[n].transation();
}
}
else
{
cout << "Plase Enter A valid Account No.";
}
}
void print(void)
{
char *acc;
acc = new char[11];
cout << "Enter The Account No\n=>";
cin >> acc;
cin.ignore();
if (check_id(acc) >= 0)
{
int n = check_id(acc);
if (check(n, acc) == 0)
{
slist[n].display();
}
else
{
clist[n].display();
}
}
else
{
cout << "Plase Enter A valid Account No.";
}
}
void showTrans()
{
fstream f;
f.open("transaction",ios::in);
while(f.eof())
{
string s;
f>>s;
cout<<s;
cout<<endl;
}
}
};
int main(void)
{
blancelist b;
int opt;
while (1)
{
system("clear");
cout << b.count1 << " " << b.count2 << endl;
cout << "\n--------------------------------------------------------\n";
cout << "Chose An Option";
cout << "\n---------------------------------------------------------\n";
cout << "1.Enter New saving Account\n2.Enter New Current Account\n3.Make a Transaction\n4.Display Details of an Account\n5.EXIT\n=>";
cin >> opt;
cin.ignore();
switch (opt)
{
case 1:
b.sprepaird();
getchar();
break;
case 2:
b.cprepaird();
getchar();
break;
case 3:
b.update();
getchar();
break;
case 4:
b.print();
getchar();
break;
case 6:
b.showTrans();
getchar();
case 5:
b.updateFile();
return 0;
default:
//cout << "Enter A Valid Option";
b.clist[0].display();
getchar();
break;
}
}
b.updateFile();
} | [
"287mdsahil@gmail.com"
] | 287mdsahil@gmail.com |
3b83f3b0fd304c4fb27c79b5b2e7958f6fb72035 | 75e000511fb000001b20b88c427be24adfb330ff | /thirdparty/fbx/inc/fbxfilesdk/kfbxplugins/kfbxanimlayer.h | 44e1399617a4a111d5162c57ce5f03d96c6118f0 | [
"LicenseRef-scancode-warranty-disclaimer",
"Apache-2.0"
] | permissive | gguedesaz/thunder | 8a847129525afa284d189dc8b3ef4bf421f7fc7d | 41fbd8393dc6974ae26e1d77d5f2f8f252e14b5c | refs/heads/master | 2020-08-22T08:42:46.796382 | 2019-10-29T12:28:54 | 2019-10-29T12:28:54 | 216,358,463 | 0 | 0 | Apache-2.0 | 2019-10-20T12:29:23 | 2019-10-20T12:29:23 | null | UTF-8 | C++ | false | false | 8,675 | h | /****************************************************************************************
Copyright (C) 2010 Autodesk, Inc.
All rights reserved.
Use of this software is subject to the terms of the Autodesk license agreement
provided at the time of installation or download, or which otherwise accompanies
this software in either electronic or hard copy form.
****************************************************************************************/
/*! \file kfbxanimlayer.h
*/
#ifndef FBXFILESDK_KFBXPLUGINS_KFBXANIMLAYER_H
#define FBXFILESDK_KFBXPLUGINS_KFBXANIMLAYER_H
#include <fbxfilesdk/fbxfilesdk_def.h>
#include <fbxfilesdk/fbxcore/fbxcollection/kfbxcollection.h>
#include <fbxfilesdk/fbxfilesdk_nsbegin.h>
class KFbxAnimCurveNode;
/** The animation layer is a collection of animation curve nodes. Its purpose is to store
* a variable number of KFbxAnimCurveNodes. The class provides different states flags (bool properties),
* an animatable weight, and the blending mode flag to indicate how the data on this layer is interacting
* with the data of the other layers during the evaluation.
* \nosubgrouping
*/
class KFBX_DLL KFbxAnimLayer : public KFbxCollection
{
KFBXOBJECT_DECLARE(KFbxAnimLayer, KFbxCollection);
public:
//////////////////////////////////////////////////////////////////////////
//
// Properties
//
//////////////////////////////////////////////////////////////////////////
/** This property stores the weight factor.
* The weight factor is the percentage of influence this layer has during
* the evaluation.
*
* Default value is \c 100.0
*/
KFbxTypedProperty<fbxDouble1> Weight;
/** This property stores the mute state.
* The mute state indicates that this layer should be excluded from the evaluation.
*
* Default value is \c false
*/
KFbxTypedProperty<fbxBool1> Mute;
/** This property stores the solo state.
* The solo state indicates that this layer is the only one that should be
* processed during the evaluation.
*
* Default value is \c false
*/
KFbxTypedProperty<fbxBool1> Solo;
/** This property stores the lock state.
* The lock state indicates that this layer has been "locked" from editing operations
* and should no longer receive keyframes.
*
* Default value is \c false
*/
KFbxTypedProperty<fbxBool1> Lock;
/** This property stores the display color.
* This color can be used by applications if they display a graphical representation
* of the layer. The FBX SDK does not use it but guarantees that the value is saved to the FBX
* file and retrieved from it.
*
* Default value is \c (0.8, 0.8, 0.8)
*/
KFbxTypedProperty<fbxDouble3> Color;
/** This property stores the blend mode.
* The blend mode is used to specify how this layer influences the animation evaluation. See the
* EBlendMode enumeration for the description of the modes.
*
* Default value is \c eModeAdditive
*/
KFbxTypedProperty<fbxEnum> BlendMode;
/** This property stores the rotation accumulation mode.
* This option indicates how the rotation curves on this layer combine with any preceding layers
* that share the same attributes. See the ERotationAccumulationMode enumeration for the description
* of the modes.
*
* Default value is \c eRotAccuModeByLayer
*/
KFbxTypedProperty<fbxEnum> RotationAccumulationMode;
/** This property stores the scale accumulation mode.
* This option indicates how the scale curves on this layer combine with any preceding layers
* that share the same attributes. See the EScaleAccumulationMode enumeration for the description
* of the modes.
*
* Default value is \c eScaleAccuModeMultiply
*/
KFbxTypedProperty<fbxEnum> ScaleAccumulationMode;
//! Reset this object properties to their default value.
void Reset();
/**
* \name BlendMode bypass functions.
* This section provides methods to bypass the current layer blend mode by data type.
* When the state is \c true, the evaluators that are processing the layer will
* need to consider that, for the given data type, the blend mode is forced to be Overwrite.
* If the state is left to its default \c false value, then the layer blend mode applies.
* \remarks This section only supports the basic types defined in the kfbxtypes.h header file.
*/
//@{
/** Set the bypass flag for the given data type.
* \param pType The fbxType identifier.
* \param pState The new state of the bypass flag.
* \remarks If pType is eMAX_TYPES, then pState is applied to all the data types.
*/
void SetBlendModeBypass(EFbxType pType, bool pState);
/** Get the current state of the bypass flag for the given data type.
* \param pType The fbxType identifier.
* \return The current state of the flag for a valid pType value and \c false in any other case.
*/
bool GetBlendModeBypass(EFbxType pType);
//@}
/** \enum EBlendMode Blend mode between animation layers.
*/
typedef enum
{
eBlendModeAdditive, /*!<The layer "adds" its animation to layers that precede it in the
stack and affect the same attributes. */
eBlendModeOverride, /*!<The layer "overrides" the animation of any layer that shares
the same attributes and precedes it in the stack. */
eBlendModeOverridePassthrough /*!<This mode is like the eBlendModeOverride but the Weight value
influence how much animation from the preceding layers is
allowed to pass-through. When using this mode with a Weight of
100.0, this layer is completely opaque and it masks any animation
from the preceding layers for the same attribute. If the Weight
is 50.0, half of this layer animation is mixed with half of the
animation of the preceding layers for the same attribute. */
} EBlendMode;
/** \enum ERotationAccumulationMode Rotation accumulation mode of animation layer.
*/
typedef enum
{
eRotAccuModeByLayer, /*!< Rotation values are weighted per layer and the result
rotation curves are calculated using concatenated quaternion values. */
eRotAccuModeByChannel /*!< Rotation values are weighted per component and the result
rotation curves are calculated by adding each independent Euler XYZ value. */
} ERotationAccumulationMode;
/** \enum EScaleAccumulationMode Scale accumulation mode of animation layer.
*/
typedef enum
{
eScaleAccuModeMultiply, /*!< Independent XYZ scale values per layer are calculated using
the layer weight value as an exponent, and result scale curves
are calculated by multiplying each independent XYZ scale value. */
eScaleAccuModeAdditive /*!< Result scale curves are calculated by adding each independent XYZ value. */
} EScaleAccumulationMode;
/**
* \name CurveNode Management
*/
//@{
/** Create a KFbxAnimCurveNode based on the property data type.
* \param pProperty The property that the created KFbxAnimCurveNode will be connected to.
* \return Pointer to the created KFbxAnimCurveNode, or NULL if an error occurred.
* \remarks This function will fail if the property eANIMATABLE flag is not set.
* \remarks This function sets the ePUBLISHED flag of the property.
* \remarks The newly created KFbxAnimCurveNode is automatically connected to both
* this object and the property.
*/
KFbxAnimCurveNode* CreateCurveNode(KFbxProperty& pProperty);
//@}
#ifndef DOXYGEN_SHOULD_SKIP_THIS
///////////////////////////////////////////////////////////////////////////////
// WARNING!
// Anything beyond these lines may not be documented accurately and is
// subject to change without notice.
///////////////////////////////////////////////////////////////////////////////
protected:
KFbxAnimLayer(KFbxSdkManager& pManager, char const* pName, KError* pError=0);
virtual KFbxAnimLayer* GetAnimLayer();
private:
bool ConstructProperties(bool pForceSet);
KFbxTypedProperty<fbxULongLong1> mBlendModeBypass;
mutable KError* mError;
friend class KFbxObject;
#endif // #ifndef DOXYGEN_SHOULD_SKIP_THIS
};
typedef KFbxAnimLayer* HKKFbxAnimLayer;
#include <fbxfilesdk/fbxfilesdk_nsend.h>
#endif // FBXFILESDK_KFBXPLUGINS_KFBXANIMLAYER_H
| [
"eprikazchikov@mail.ru"
] | eprikazchikov@mail.ru |
eb4d5884d7d972e2eab8a4d2c506e34106a47bdb | ad273708d98b1f73b3855cc4317bca2e56456d15 | /aws-cpp-sdk-securityhub/source/model/ListEnabledProductsForImportResult.cpp | 00b57a2e8f5d188be5b51a9de6ae229026fadcc9 | [
"MIT",
"Apache-2.0",
"JSON"
] | permissive | novaquark/aws-sdk-cpp | b390f2e29f86f629f9efcf41c4990169b91f4f47 | a0969508545bec9ae2864c9e1e2bb9aff109f90c | refs/heads/master | 2022-08-28T18:28:12.742810 | 2020-05-27T15:46:18 | 2020-05-27T15:46:18 | 267,351,721 | 1 | 0 | Apache-2.0 | 2020-05-27T15:08:16 | 2020-05-27T15:08:15 | null | UTF-8 | C++ | false | false | 1,933 | cpp | /*
* Copyright 2010-2017 Amazon.com, Inc. or its affiliates. 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.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file 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 <aws/securityhub/model/ListEnabledProductsForImportResult.h>
#include <aws/core/utils/json/JsonSerializer.h>
#include <aws/core/AmazonWebServiceResult.h>
#include <aws/core/utils/StringUtils.h>
#include <aws/core/utils/UnreferencedParam.h>
#include <utility>
using namespace Aws::SecurityHub::Model;
using namespace Aws::Utils::Json;
using namespace Aws::Utils;
using namespace Aws;
ListEnabledProductsForImportResult::ListEnabledProductsForImportResult()
{
}
ListEnabledProductsForImportResult::ListEnabledProductsForImportResult(const Aws::AmazonWebServiceResult<JsonValue>& result)
{
*this = result;
}
ListEnabledProductsForImportResult& ListEnabledProductsForImportResult::operator =(const Aws::AmazonWebServiceResult<JsonValue>& result)
{
JsonView jsonValue = result.GetPayload().View();
if(jsonValue.ValueExists("ProductSubscriptions"))
{
Array<JsonView> productSubscriptionsJsonList = jsonValue.GetArray("ProductSubscriptions");
for(unsigned productSubscriptionsIndex = 0; productSubscriptionsIndex < productSubscriptionsJsonList.GetLength(); ++productSubscriptionsIndex)
{
m_productSubscriptions.push_back(productSubscriptionsJsonList[productSubscriptionsIndex].AsString());
}
}
if(jsonValue.ValueExists("NextToken"))
{
m_nextToken = jsonValue.GetString("NextToken");
}
return *this;
}
| [
"aws-sdk-cpp-automation@github.com"
] | aws-sdk-cpp-automation@github.com |
48ecb9e53ad3cd7252933fa832eaec0c4c64c66a | 612325535126eaddebc230d8c27af095c8e5cc2f | /src/net/cert/nss_profile_filter_chromeos.h | e8d1c920054360cee6fd6cdd7c053979dff4ffa6 | [
"BSD-3-Clause"
] | permissive | TrellixVulnTeam/proto-quic_1V94 | 1a3a03ac7a08a494b3d4e9857b24bb8f2c2cd673 | feee14d96ee95313f236e0f0e3ff7719246c84f7 | refs/heads/master | 2023-04-01T14:36:53.888576 | 2019-10-17T02:23:04 | 2019-10-17T02:23:04 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,573 | h | // Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef NET_CERT_NSS_PROFILE_FILTER_CHROMEOS_H_
#define NET_CERT_NSS_PROFILE_FILTER_CHROMEOS_H_
#include <memory>
#include "base/memory/ref_counted.h"
#include "crypto/scoped_nss_types.h"
#include "net/base/net_export.h"
namespace net {
class X509Certificate;
// On ChromeOS each user has separate NSS databases, which are loaded
// simultaneously when multiple users are logged in at the same time. NSS
// doesn't have built-in support to partition databases into separate groups, so
// NSSProfileFilterChromeOS can be used to check if a given slot or certificate
// should be used for a given user.
//
// Objects of this class are thread-safe except for the Init function, which if
// called must not be called while other threads could access the object.
class NET_EXPORT NSSProfileFilterChromeOS {
public:
// Create a filter. Until Init is called (or if Init is called with NULL
// slot handles), the filter will allow only certs/slots from the read-only
// slots and the root CA module.
NSSProfileFilterChromeOS();
NSSProfileFilterChromeOS(const NSSProfileFilterChromeOS& other);
~NSSProfileFilterChromeOS();
NSSProfileFilterChromeOS& operator=(const NSSProfileFilterChromeOS& other);
// Initialize the filter with the slot handles to allow. This method is not
// thread-safe.
void Init(crypto::ScopedPK11Slot public_slot,
crypto::ScopedPK11Slot private_slot,
crypto::ScopedPK11Slot system_slot);
bool IsModuleAllowed(PK11SlotInfo* slot) const;
bool IsCertAllowed(CERTCertificate* cert) const;
class CertNotAllowedForProfilePredicate {
public:
explicit CertNotAllowedForProfilePredicate(
const NSSProfileFilterChromeOS& filter);
bool operator()(const scoped_refptr<X509Certificate>& cert) const;
private:
const NSSProfileFilterChromeOS& filter_;
};
class ModuleNotAllowedForProfilePredicate {
public:
explicit ModuleNotAllowedForProfilePredicate(
const NSSProfileFilterChromeOS& filter);
bool operator()(const crypto::ScopedPK11Slot& module) const;
private:
const NSSProfileFilterChromeOS& filter_;
};
private:
crypto::ScopedPK11Slot public_slot_;
crypto::ScopedPK11Slot private_slot_;
crypto::ScopedPK11Slot system_slot_;
};
} // namespace net
#endif // NET_CERT_NSS_PROFILE_FILTER_CHROMEOS_H_
| [
"2100639007@qq.com"
] | 2100639007@qq.com |
a31ab051f865be68fdc232f4a095f9143d51bdd5 | 4612e46be4ccd2c05c67baa6359b7d0281fd5f1a | /base/data_type_terminated.h | 3b82eeeb38c55c0a6bd4f2db09d0adbe56b87fc1 | [
"Apache-2.0"
] | permissive | RedBeard0531/mongo_utils | eed1e06c18cf6ff0e6f076fdfc8a71d5791bb95c | 402c2023df7d67609ce9da8e405bf13cdd270e20 | refs/heads/master | 2021-03-31T01:03:41.719260 | 2018-06-03T11:27:47 | 2018-06-03T11:27:47 | 124,802,061 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,296 | h | /* Copyright 2014 MongoDB Inc.
*
* 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.
*/
#pragma once
#include <cstring>
#include "mongo/base/data_type.h"
namespace mongo {
template <char C, typename T>
struct Terminated {
Terminated() : value(DataType::defaultConstruct<T>()) {}
Terminated(T value) : value(std::move(value)) {}
T value;
operator T() const {
return value;
}
};
struct TerminatedHelper {
static Status makeLoadNoTerminalStatus(char c, size_t length, std::ptrdiff_t debug_offset);
static Status makeLoadShortReadStatus(char c,
size_t read,
size_t length,
std::ptrdiff_t debug_offset);
static Status makeStoreStatus(char c, size_t length, std::ptrdiff_t debug_offset);
};
template <char C, typename T>
struct DataType::Handler<Terminated<C, T>> {
using TerminatedType = Terminated<C, T>;
static Status load(TerminatedType* tt,
const char* ptr,
size_t length,
size_t* advanced,
std::ptrdiff_t debug_offset) {
size_t local_advanced = 0;
const char* end = static_cast<const char*>(std::memchr(ptr, C, length));
if (!end) {
return TerminatedHelper::makeLoadNoTerminalStatus(C, length, debug_offset);
}
auto status = DataType::load(
tt ? &tt->value : nullptr, ptr, end - ptr, &local_advanced, debug_offset);
if (!status.isOK()) {
return status;
}
if (local_advanced != static_cast<size_t>(end - ptr)) {
return TerminatedHelper::makeLoadShortReadStatus(
C, local_advanced, end - ptr, debug_offset);
}
if (advanced) {
*advanced = local_advanced + 1;
}
return Status::OK();
}
static Status store(const TerminatedType& tt,
char* ptr,
size_t length,
size_t* advanced,
std::ptrdiff_t debug_offset) {
size_t local_advanced = 0;
auto status = DataType::store(tt.value, ptr, length, &local_advanced, debug_offset);
if (!status.isOK()) {
return status;
}
if (length - local_advanced < 1) {
return TerminatedHelper::makeStoreStatus(C, length, debug_offset + local_advanced);
}
ptr[local_advanced] = C;
if (advanced) {
*advanced = local_advanced + 1;
}
return Status::OK();
}
static TerminatedType defaultConstruct() {
return TerminatedType();
}
};
} // namespace mongo
| [
"redbeard0531@gmail.com"
] | redbeard0531@gmail.com |
dc88d44503504d33ba7f1decb1664ae5f87876e0 | 94d390fa0140640dcbad4f00b76b777ff59e121c | /smart_garden/smart_garden.ino | 8df69d4c7e18c62b7acd137f367a03da8fad953e | [] | no_license | eunbiline98/project-arduino | 6d5e0a919dcd76d8a90e97d16c5bb2d0b1ed0a89 | 35cd0db0837a0759f6791456cd772beb7389500f | refs/heads/master | 2023-01-13T11:48:08.445067 | 2020-10-23T10:07:24 | 2020-10-23T10:07:24 | 185,494,765 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,289 | ino | // firebase
#include "FirebaseESP8266.h"
#include <ESP8266WiFi.h>
// Set these to run example.
#define FIREBASE_HOST "pkm-asia.firebaseio.com"
#define FIREBASE_AUTH "hdF4mLVdCbVvcvmetSfUYaLT140fTiOkUPLaxvvX"
#define WIFI_SSID "Cv brilliant solution reseach"
#define WIFI_PASSWORD "Akucantik123"
FirebaseData firebaseData;
// pompa
#define pompa_air D0
// sensor DHT
#include "DHT.h"
#define dht_pin D5
#define DHTTYPE DHT11
DHT dht (dht_pin, DHTTYPE);
// sensor soil moisture
int sensor_lembab = A0;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
dht.begin();
pinMode(pompa_air,OUTPUT);
Serial.print("Connecting to Wi-Fi");
WiFi.begin(WIFI_SSID, WIFI_PASSWORD);
while (WiFi.status() != WL_CONNECTED) {
Serial.println("Menunggu");
delay(200);
}
//ip address status
Serial.println();
Serial.print("Connected with IP: ");
Serial.println(WiFi.localIP());
Serial.println();
delay(2000);
Firebase.begin(FIREBASE_HOST, FIREBASE_AUTH);
Firebase.reconnectWiFi(true);
}
void loop() {
// put your main code here, to run repeatedly:
String mode;
Firebase.getString(firebaseData,"mode");
mode=firebaseData.stringData();
if(mode=="1"){
sensor_dht();
sensor_soil();
Serial.println("mode auto");
}
if(mode=="0"){
control_pompa();
sensor_dht();
sensor_soil();
Serial.println("mode manual");
}
delay(1000);
}
void control_pompa(){
// pompa control
String pompa;
Firebase.getString(firebaseData,"pompa");
pompa=firebaseData.stringData();
if(pompa=="1"){
digitalWrite(pompa_air,LOW);
Serial.println("pompa aktif");
}
if(pompa=="0"){
digitalWrite(pompa_air,HIGH);
Serial.println("pompa non aktif");
}
}
void sensor_dht(){
float kelembaban_udara = dht.readHumidity();
float t = dht.readTemperature();
// set value
Firebase.setFloat(firebaseData,"suhu",t);
Firebase.setFloat(firebaseData,"rh_udara",kelembaban_udara);
Serial.println(t);
Serial.println(kelembaban_udara);
}
void sensor_soil(){
int lembab = analogRead(sensor_lembab);
float kelembaban_tanah = ( 100 - ( (lembab/1023) * 100 ) );
Serial.print("Sensor 1 Kelembaban tanah = ");
Serial.print(kelembaban_tanah);
Serial.print("%\n\n");
Firebase.setFloat(firebaseData,"rh_tanah",kelembaban_tanah);
}
| [
"50385294+eunbiline98@users.noreply.github.com"
] | 50385294+eunbiline98@users.noreply.github.com |
26fc1335fc1786f4b6be69a8172b9b59c580e8fd | 37192a7437c942dc021a1a8fcf472e4e763c20b0 | /server/include/server.h | 83c5ff50704030e761d5acfe422286151a0b4347 | [] | no_license | bomkvilt/messenger2017 | ddc19210e0d8d8a5c291f13ea1e9b0124913b889 | d3a097c48b2f57cd9487c349485c0fd5f18dfa86 | refs/heads/master | 2021-01-02T09:00:16.137312 | 2017-08-04T16:28:33 | 2017-08-04T16:28:33 | 99,119,843 | 1 | 0 | null | 2017-08-03T18:32:23 | 2017-08-02T13:33:00 | C++ | UTF-8 | C++ | false | false | 469 | h | #pragma once
#include <boost/asio.hpp>
#include "session.h"
namespace m2 {
namespace server {
class Server
{
public:
Server(const Server &) = delete;
Server &operator=(const Server &) = delete;
Server();
void start(uint16_t port);
private:
void handleNewConnection( sessionPtr session, const boost::system::error_code &error);
private:
boost::asio::io_service io_service_;
boost::asio::ip::tcp::acceptor acceptor_;
};
}} // m2::server
| [
"m.sergeev@corp.mail.ru"
] | m.sergeev@corp.mail.ru |
1dcda3cbd17a77fd61e3a9c0e0e2be04cbcc16ed | efd80acbef5552e2c01417457bba0c0a5aacb607 | /AtCoder_PastProblems/ABC_043/D.cpp | 946c16040011a727d27b0c47a714c35126b1842f | [] | no_license | skyto0927/Programming-Contest | 4e590a1f17ba61f58af91932f52bedeeff8039e8 | 5966bd843d9dec032e5b6ff20206d54c9cbf8b14 | refs/heads/master | 2021-06-04T05:02:58.491853 | 2020-10-06T21:55:14 | 2020-10-06T21:55:14 | 135,557,393 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 740 | cpp | #include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF 1e9
#define LINF 1e18
typedef long long ll;
int main() {
string s; cin >> s;
if(s.size()==2){
if(s[0] == s[1]) cout << "1 2" << endl;
else cout << "-1 -1" << endl;
return 0;
}
REP(i,s.size()-2){
if(s[i] == s[i+1]){
cout << i+1 << " " << i+2 << endl;
return 0;
}else if(s[i] == s[i+2]){
cout << i+1 << " " << i+3 << endl;
return 0;
}
}
cout << "-1 -1" << endl;
return 0;
} | [
"skyto0927@gmail.com"
] | skyto0927@gmail.com |
9f6246dc4546967b79afd3f6f8a74ae72f8528c5 | 39277dfa23b897aa7a3ae1c38ad9e7ce4dc02cc8 | /pc/EHOME/worldtimeclock.h | b38158ed016e4bcd2a27df17d6f7604f88ab36c5 | [] | no_license | li995868145/s5pv210_ehome_linux_qt_v0.0.0.1 | 49ccb6505239f65a5bbe90529f2321c0093bc2d2 | c2ffc0ca239d618a4b2ea57eaedf686ee20af4ee | refs/heads/master | 2021-01-10T08:43:42.224078 | 2015-12-09T13:32:50 | 2015-12-09T13:32:50 | 47,693,375 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,582 | h | /****************************************************************************
**
** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the examples of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:BSD$
** You may use this file under the terms of the BSD license as follows:
**
** "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 Nokia Corporation and its Subsidiary(-ies) nor
** the names of its contributors may be used to endorse or promote
** products derived from this software without specific prior written
** permission.
**
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef WORLDTIMECLOCK_H
#define WORLDTIMECLOCK_H
#include <QTime>
#include <QWidget>
// #include <QtDesigner/QDesignerExportWidget>
class WorldTimeClock : public QWidget
{
Q_OBJECT
public:
WorldTimeClock(QWidget *parent = 0);
void setTime (QTime time);
public slots:
void setTimeZone(int hourOffset);
signals:
void updated(QTime currentTime);
protected:
void paintEvent(QPaintEvent *event);
private:
int timeZoneOffset;
QTime time;
};
#endif
| [
"li li"
] | li li |
d633456173aebd65ac7eab8c86a29e5a25d90a47 | 34003d7edf799fe112695e16c4018bf817e7c143 | /src/lang/statement/caseStatement.cpp | 1ee61bd496481aeafeeaa25e4bef6a13b6b3c951 | [
"MIT"
] | permissive | noelchalmers/occa | 9b5186ae8c6cd07554bff62dd277a4d4b5e34bab | 7b9b2a97879c1f2a384c4fed234aece4d331e00d | refs/heads/master | 2023-05-15T06:31:10.451159 | 2020-06-18T03:00:19 | 2020-06-18T03:00:19 | 140,303,059 | 2 | 0 | MIT | 2018-07-09T15:10:46 | 2018-07-09T15:10:45 | null | UTF-8 | C++ | false | false | 1,148 | cpp | #include <occa/lang/statement/caseStatement.hpp>
#include <occa/lang/expr.hpp>
namespace occa {
namespace lang {
caseStatement::caseStatement(blockStatement *up_,
token_t *source_,
exprNode &value_) :
statement_t(up_, source_),
value(&value_) {}
caseStatement::caseStatement(blockStatement *up_,
const caseStatement &other) :
statement_t(up_, other),
value(other.value->clone()) {}
caseStatement::~caseStatement() {
delete value;
}
statement_t& caseStatement::clone_(blockStatement *up_) const {
return *(new caseStatement(up_, *this));
}
int caseStatement::type() const {
return statementType::case_;
}
std::string caseStatement::statementName() const {
return "case";
}
void caseStatement::print(printer &pout) const {
pout.removeIndentation();
pout.printIndentation();
pout << "case ";
pout.pushInlined(true);
pout << *value;
pout.popInlined();
pout << ":\n";
pout.addIndentation();
}
}
}
| [
"dmed256@gmail.com"
] | dmed256@gmail.com |
8744bce05659f050f04da01ea5b477b6cdbb0563 | 68cf8767e067611fed434e176ac932bcdbf8ecb4 | /bicoloring.cpp | cb1aa68bcd284fee21cae4f279015afd7080663e | [] | no_license | zhsenl/online-judge | b72d45aa894a566b6377cb16fe83ed61c6475a9a | e560eec265aa894b0b4ffe6310e312450f656625 | refs/heads/master | 2020-05-18T16:29:34.043515 | 2014-03-13T06:59:51 | 2014-03-13T06:59:51 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 743 | cpp | //#include <iostream>
//#include <vector>
//#include <queue>
//#include <cstring>
//
//using namespace std;
//
//#define N 1010
//int n, m;
//vector<int> g[N];
//int c[N];
//
//bool bfs(int s){
// memset(c, 0, sizeof(c));
// queue<int> q;
// c[s] = 1;
// q.push(s);
// while(!q.empty()){
// int u = q.front(); q.pop();
// for(int i = 0; i < g[u].size(); i++){
// int v = g[u][i];
// if(c[v] == 0){
// c[v] = c[u] == 1 ? 2 : 1;
// q.push(v);
// }else{
// if(c[v] == c[u]) return false;
// }
// }
// }
// return true;
//}
//
//int main(){
//
// cin >> n >> m;
// for(int i= 0; i < m; i++){
// int x, y;
// cin >> x >> y;
// g[x].push_back(y);
// g[y].push_back(x);
// }
// cout << (bfs(1) ? "yes" : "no") << endl;
//
//} | [
"zhsenl@qq.com"
] | zhsenl@qq.com |
6b725ebda6ff2be1f1a740604ccdc8bb936e4c4c | 37a1da8a69b692264b83722ed365369329e53171 | /tensorflow/compiler/mlir/tensorflow/transforms/tpu_space_to_depth_pass.cc | ccc31d2b53047bb26bde727e29e8b1bf47a27115 | [
"Apache-2.0"
] | permissive | Harsh188/tensorflow | 8e26a5ddfc2cdbdc00bd28195ae563cda7ef6c01 | fec612b5243f9093aec4437a5f3fcb8d3a92c06d | refs/heads/master | 2023-02-20T08:01:04.252450 | 2021-01-21T18:08:03 | 2021-01-21T18:08:03 | 287,893,121 | 2 | 0 | Apache-2.0 | 2020-08-16T07:11:10 | 2020-08-16T07:11:09 | null | UTF-8 | C++ | false | false | 31,918 | cc | /* Copyright 2020 The TensorFlow Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/
#include <cstdint>
#include <iostream>
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/Debug.h"
#include "mlir/IR/Attributes.h" // from @llvm-project
#include "mlir/IR/Builders.h" // from @llvm-project
#include "mlir/IR/BuiltinOps.h" // from @llvm-project
#include "mlir/IR/BuiltinTypes.h" // from @llvm-project
#include "mlir/IR/Location.h" // from @llvm-project
#include "mlir/IR/MLIRContext.h" // from @llvm-project
#include "mlir/IR/Operation.h" // from @llvm-project
#include "mlir/IR/OperationSupport.h" // from @llvm-project
#include "mlir/IR/PatternMatch.h" // from @llvm-project
#include "mlir/IR/TypeUtilities.h" // from @llvm-project
#include "mlir/IR/Types.h" // from @llvm-project
#include "mlir/IR/Value.h" // from @llvm-project
#include "mlir/Pass/Pass.h" // from @llvm-project
#include "mlir/Pass/PassRegistry.h" // from @llvm-project
#include "mlir/Support/LLVM.h" // from @llvm-project
#include "mlir/Support/LogicalResult.h" // from @llvm-project
#include "tensorflow/compiler/mlir/tensorflow/ir/tf_device.h"
#include "tensorflow/compiler/mlir/tensorflow/ir/tf_ops.h"
#include "tensorflow/compiler/mlir/tensorflow/ir/tf_types.h"
#include "tensorflow/compiler/mlir/tensorflow/utils/convert_tensor.h"
#include "tensorflow/compiler/mlir/tensorflow/utils/tpu_rewrite_device_util.h"
#include "tensorflow/core/framework/tensor_shape.pb.h"
#include "tensorflow/core/util/device_name_utils.h"
namespace mlir {
namespace TFTPU {
namespace {
constexpr char kDeviceAttr[] = "device";
typedef std::pair<TF::Conv2DOp, int64_t> Conv2DWithBlockSize;
struct BlockArgumentInfo {
unsigned arg_num;
unsigned num_users;
};
// A pass that applies automatic space to depth transform for the first or
// frontier convolutions consume host inputs on TPU.
// This is done by adding space to depth transform op after host input and
// applying space to depth transform for the first convolution and its backprop
// filter on TPU.
//
// Example: original program:
//
// module {
// func @while_body {
// %input = "tf.IteratorGetNext"(...) {device = "/CPU:0"}:
// -> tensor<2x224x224x3xf32>
// %device_launch = "tf_device.cluster_func"(%input,...) {func = @_func,...)
// return ...
// }
// func @_func(%input: tensor<2x224x224x3xf32>,
// %filter: tensor<7x7x3x64xf32>) {
// %6 = "tf.Conv2D"(%input, %filter) {strides = [1, 2, 2, 1]}:
// (tensor<2x230x230x3xf32>, tensor<7x7x3x64xf32>) ->
// tensor<2x112x112x64xf32>
// }
// }
//
// With this pass, the program will be transformed into:
// module {
// func @while_body {
// %input = "tf.IteratorGetNext"(...) {device = "/CPU:0"}
// -> tensor<2x224x224x3xf32>
// %space_to_depth = "tf.SpaceToDepth"(%input) {block_size = 2, ...}:
// (tensor<2x224x224x3xf32>) -> tensor<2x112x112x12xf32>
// %device_launch = "tf_device.cluster_func"(%space_to_depth,...)
// {func = @_func,...)
// return ...
// }
// func @_func(%input: tensor<2x112x112x12xf32>,
// %filter: tensor<7x7x3x64xf32>) {
// %filter_transform = "tf.Pad/tf.Transpose/tf.Reshape"(%filter):
// tensor<7x7x3x64xf32>) -> tensor<4x4x12x64xf32>
// %conv = "tf.Conv2D"(%input, %filter_transfrom) {strides = [1, 1, 1, 1]}:
// (tensor<2x112x112x12xf32>, tensor<4x4x12x64xf32>) ->
// tensor<2x112x112x64xf32>
// }
// }
//
// This way, the first convolution with 3 feature dimension will be transformed
// to 12 feature dimension, which has better performance on TPU.
//
// TODO(wangtao): add a pass to check if it is profitable to space to depth
// transform and invoke the transform if it is needed.
struct TPUSpaceToDepthPass
: public PassWrapper<TPUSpaceToDepthPass, OperationPass<ModuleOp>> {
void runOnOperation() override;
};
// Updates func argument type to have the updated input shape.
void UpdateFuncType(FuncOp func) {
auto arg_types = func.front().getArgumentTypes();
auto result_types = func.front().getTerminator()->getOperandTypes();
func.setType(FunctionType::get(func.getContext(), arg_types, result_types));
}
void HandleFuncOp(Operation* op) {
auto func = llvm::cast<FuncOp>(op);
UpdateFuncType(func);
}
// Handles cast op between the first convolution and the block argument.
LogicalResult HandleCast(TF::CastOp cast_op, ArrayRef<int64_t> new_shape) {
auto cast_input = cast_op.x();
// Update input type.
auto transform_result_type =
RankedTensorType::get(new_shape, getElementTypeOrSelf(cast_input));
cast_input.setType(transform_result_type);
auto block_arg = cast_input.dyn_cast<mlir::BlockArgument>();
auto cast_op_input = dyn_cast_or_null<TF::CastOp>(cast_input.getDefiningOp());
while (block_arg || cast_op_input) {
if (block_arg) {
// Change on device function type/shape.
HandleFuncOp(block_arg.getOwner()->getParentOp());
block_arg = nullptr;
cast_op_input = nullptr;
} else {
auto cast_input = cast_op_input.x();
// Update input type.
auto transform_result_type =
RankedTensorType::get(new_shape, getElementTypeOrSelf(cast_input));
cast_input.setType(transform_result_type);
// Update block arg and cast_op_input.
block_arg = cast_input.dyn_cast<mlir::BlockArgument>();
cast_op_input = dyn_cast_or_null<TF::CastOp>(cast_input.getDefiningOp());
}
}
return success();
}
// Handles padding before convolution for space to depth transform.
LogicalResult HandlePad(TF::PadOp op, int32_t kernel_size, int32_t block_size) {
auto ranked_type = op.input().getType().dyn_cast<RankedTensorType>();
if (!ranked_type) return failure();
auto pad_input_shape = ranked_type.getShape();
Location loc = op.getLoc();
OpBuilder builder(op);
builder.setInsertionPoint(op);
auto padding_type = RankedTensorType::get({4, 2}, builder.getIntegerType(32));
// Calculate paddings.
int32_t pad_total = kernel_size - 1;
int32_t pad_beg = (pad_total / 2 + 1) / block_size;
int32_t pad_end = (pad_total / 2) / block_size;
SmallVector<int32_t, 8> values = {0, 0, pad_beg, pad_end,
pad_beg, pad_end, 0, 0};
auto paddings = DenseIntElementsAttr::get(padding_type, values);
// Update pad_op paddings.
op.setOperand(1, builder.create<TF::ConstOp>(loc, paddings));
// Set input type.
auto input = op.getOperand(0);
SmallVector<int64_t, 4> transform_shape = {
pad_input_shape[0], pad_input_shape[1] / block_size,
pad_input_shape[2] / block_size,
pad_input_shape[3] * block_size * block_size};
// Input of the pad op could be a cast op.
if (auto cast_op = dyn_cast_or_null<TF::CastOp>(input.getDefiningOp()))
if (failed(HandleCast(cast_op, transform_shape))) return failure();
auto transform_result_type =
RankedTensorType::get(transform_shape, getElementTypeOrSelf(input));
input.setType(transform_result_type);
op.setOperand(0, input);
return success();
}
// Handles stride for the first convolution for the transform.
void HandleConv2DStride(TF::Conv2DOp conv2d) {
MLIRContext* context = conv2d.getContext();
SmallVector<int64_t, 4> values = {1, 1, 1, 1};
auto attrs = llvm::map_range(values, [context](int64_t v) -> Attribute {
return IntegerAttr::get(IntegerType::get(context, 64), v);
});
// TODO(b/157276506): change type of strides to DenseElementsAttr
auto strides = ArrayAttr::get(llvm::to_vector<4>(attrs), context);
conv2d->setAttr("strides", strides);
}
// Transforms input shape for the first convolution.
void HandleConv2DInput(TF::Conv2DOp conv2d, int64_t block_size) {
auto input = conv2d.input();
auto input_shape = input.getType().cast<RankedTensorType>().getShape();
SmallVector<int64_t, 4> transform_shape = {
input_shape[0], input_shape[1] / block_size, input_shape[2] / block_size,
input_shape[3] * block_size * block_size};
auto transform_result_type =
RankedTensorType::get(transform_shape, getElementTypeOrSelf(input));
input.setType(transform_result_type);
}
// Adds padding for convolution filter for space to depth transform.
TF::PadOp GetPadOpForConv2DFilter(ArrayRef<int64_t> filter_shape, Value filter,
OpBuilder* builder, int32_t pad_h,
int32_t pad_w) {
SmallVector<int32_t, 8> values = {pad_h, 0, pad_w, 0, 0, 0, 0, 0};
auto padding_type =
RankedTensorType::get({4, 2}, builder->getIntegerType(32));
auto paddings = DenseIntElementsAttr::get(padding_type, values);
auto paddings_value = builder->create<TF::ConstOp>(filter.getLoc(), paddings);
std::vector<int64_t> pad_shape = {filter_shape[0] + pad_h,
filter_shape[1] + pad_w, filter_shape[2],
filter_shape[3]};
SmallVector<int64_t, 4> expand_shape(pad_shape.begin(), pad_shape.end());
auto expand_result_type =
RankedTensorType::get(expand_shape, getElementTypeOrSelf(filter));
return builder->create<TF::PadOp>(filter.getLoc(), expand_result_type, filter,
paddings_value);
}
// Creates reshape op for space to depth transform.
TF::ReshapeOp GetReshapeOpForConv2DFilter(ArrayRef<int64_t> new_shape,
Value input, OpBuilder* builder) {
auto reshape_result_type =
RankedTensorType::get(new_shape, getElementTypeOrSelf(input));
auto reshape_type = RankedTensorType::get(
{static_cast<int64_t>(new_shape.size())}, builder->getIntegerType(64));
auto reshape_sizes = DenseIntElementsAttr::get(reshape_type, new_shape);
auto reshape_value =
builder->create<TF::ConstOp>(input.getLoc(), reshape_sizes);
return builder->create<TF::ReshapeOp>(input.getLoc(), reshape_result_type,
input, reshape_value);
}
// Creates transpose op for shape to depth transform.
TF::TransposeOp GetTransposeOpForConv2DFilter(OpBuilder* builder, Value input) {
SmallVector<int32_t, 6> permutation = {0, 2, 1, 3, 4, 5};
auto permute_type = RankedTensorType::get({6}, builder->getIntegerType(32));
auto permute_attr = DenseIntElementsAttr::get(permute_type, permutation);
auto permute_value =
builder->create<TF::ConstOp>(input.getLoc(), permute_attr);
return builder->create<TF::TransposeOp>(input.getLoc(), input, permute_value);
}
void HandleConv2DFilter(TF::Conv2DOp conv2d, int64_t block_size) {
// For example, if filter shape is [7, 7, 3, 64] with block_size 2,
// will apply below transforms to the filter:
// 1. Pad the filter to [8, 8, 3, 64]
// 2. Reshape to [4, 2, 4, 2, 3, 64]
// 3. Transpose to [4, 4, 2, 2, 3, 64]
// 4. Reshape to [4, 4, 12, 64]
auto filter = conv2d.filter();
OpBuilder builder(conv2d);
builder.setInsertionPoint(conv2d);
// Book keeping filter information.
auto filter_shape = filter.getType().cast<RankedTensorType>().getShape();
int64_t height = filter_shape[0];
int64_t width = filter_shape[1];
int64_t channel = filter_shape[2];
int64_t out_channel = filter_shape[3];
// Value/Op before reshape op.
Value before_reshape_value = filter;
if (height % block_size != 0 || width % block_size != 0) {
// Calculate paddings for height and width.
int32_t pad_h = block_size - height % block_size;
int32_t pad_w = block_size - width % block_size;
auto pad_op =
GetPadOpForConv2DFilter(filter_shape, filter, &builder, pad_h, pad_w);
// Update op, height and width before reshape.
before_reshape_value = pad_op;
height = height + pad_h;
width = width + pad_w;
}
// Reshape.
SmallVector<int64_t, 6> new_shape = {
height / block_size, block_size, width / block_size,
block_size, channel, out_channel};
auto reshape_op =
GetReshapeOpForConv2DFilter(new_shape, before_reshape_value, &builder);
// Transpose.
auto transpose_op = GetTransposeOpForConv2DFilter(&builder, reshape_op);
// Reshape Back.
SmallVector<int64_t, 4> final_shape = {
height / block_size, width / block_size,
channel * block_size * block_size, out_channel};
auto final_reshape_op =
GetReshapeOpForConv2DFilter(final_shape, transpose_op, &builder);
// Update filter of Conv2D.
conv2d.setOperand(1, final_reshape_op);
}
// Creates slice op for filter in back prop pass.
TF::SliceOp GetSliceOpForConv2DBackPropFilter(
ArrayRef<int32_t> old_filter_shape, Value input, OpBuilder* builder) {
SmallVector<int64_t, 4> slice_size(old_filter_shape.begin(),
old_filter_shape.end());
auto slice_result_type =
RankedTensorType::get(slice_size, getElementTypeOrSelf(input));
auto slice_size_op = builder->create<TF::ConstOp>(
input.getLoc(),
DenseIntElementsAttr::get(
RankedTensorType::get({4}, builder->getIntegerType(32)),
old_filter_shape));
SmallVector<int64_t, 4> slice_start_position = {0, 0, 0, 0};
auto start_position_type =
RankedTensorType::get({4}, builder->getIntegerType(64));
auto start_position = builder->create<TF::ConstOp>(
input.getLoc(),
DenseIntElementsAttr::get(start_position_type, slice_start_position));
return builder->create<TF::SliceOp>(input.getLoc(), slice_result_type, input,
start_position, slice_size_op);
}
// Transforms Conv2DBackPropFilter for space to depth.
void HandleConv2DBackPropFilter(TF::Conv2DBackpropFilterOp backprop,
ArrayRef<int32_t> old_filter_shape,
ArrayRef<int32_t> new_filter_shape,
int64_t block_size) {
OpBuilder builder(backprop);
builder.setInsertionPoint(backprop);
auto input = backprop.input();
// Get new filter size from new_filter_shape.
auto new_filter_sizes = builder.create<TF::ConstOp>(
backprop.getLoc(),
DenseIntElementsAttr::get(
RankedTensorType::get({4}, builder.getIntegerType(32)),
new_filter_shape));
// Set stride to [1, 1, 1, 1].
MLIRContext* context = backprop.getContext();
SmallVector<int64_t, 4> values = {1, 1, 1, 1};
auto attrs = llvm::map_range(values, [context](int64_t v) -> Attribute {
return IntegerAttr::get(IntegerType::get(context, 64), APInt(64, v));
});
auto strides = ArrayAttr::get(llvm::to_vector<4>(attrs), context);
// new result type.
SmallVector<int64_t, 4> new_shape(new_filter_shape.begin(),
new_filter_shape.end());
auto new_result_type =
RankedTensorType::get(new_shape, getElementTypeOrSelf(input));
// Build new BackPropFilterOp.
auto loc = backprop.getLoc();
auto new_backprop = builder.create<TF::Conv2DBackpropFilterOp>(
loc, new_result_type, input, new_filter_sizes, backprop.out_backprop(),
strides, backprop.use_cudnn_on_gpu(), backprop.padding(),
backprop.explicit_paddings(), backprop.data_format(),
backprop.dilations());
// For example, if new filter shape is [4, 4, 12, 64], old filter shape
// is [7, 7, 3, 64] with block_size 2.
// Below transforms will be applied to the filter:
// 1. Reshape to [4, 4, 2, 2, 3, 64];
// 2. Transpose to [4, 2, 4, 2, 3, 64];
// 3. Reshape to [8, 8, 3, 64];
// 4. Slice to [7, 7, 3, 64].
SmallVector<int64_t, 6> first_reshape_shape = {
new_filter_shape[0],
new_filter_shape[1],
block_size,
block_size,
new_filter_shape[2] / (block_size * block_size),
new_filter_shape[3]};
auto first_reshape_op =
GetReshapeOpForConv2DFilter(first_reshape_shape, new_backprop, &builder);
// Transpose.
auto transpose_op = GetTransposeOpForConv2DFilter(&builder, first_reshape_op);
// Last Reshape op.
SmallVector<int64_t, 4> last_reshape_shape = {
new_filter_shape[0] * block_size, new_filter_shape[1] * block_size,
new_filter_shape[2] / (block_size * block_size), new_filter_shape[3]};
auto final_reshape_op =
GetReshapeOpForConv2DFilter(last_reshape_shape, transpose_op, &builder);
// create slice op.
auto slice_op = GetSliceOpForConv2DBackPropFilter(old_filter_shape,
final_reshape_op, &builder);
// Update backprop's user with the slice op.
backprop.replaceAllUsesWith(slice_op.getResult());
}
// Checks if the input producer op is supported in this transform. Right now, we
// only check if it is a host tf.IteratorGetNext.
bool IsSupportedHostInputOp(Operation* op) {
TF::IteratorGetNextOp iter = llvm::dyn_cast<TF::IteratorGetNextOp>(op);
if (!iter) return false;
auto device = op->getAttrOfType<StringAttr>(kDeviceAttr);
if (!device) return false;
tensorflow::DeviceNameUtils::ParsedName parsed_device;
if (!tensorflow::DeviceNameUtils::ParseFullName(device.getValue().str(),
&parsed_device)) {
return false;
}
return parsed_device.type == "CPU";
}
// Builds a SpaceToDepthOp with the given get_layout op and input.
TF::SpaceToDepthOp BuildSpaceToDepth(tf_device::ClusterFuncOp cluster_func,
Value input, int32_t block_size,
ArrayRef<int64_t> input_shape) {
auto input_op = input.getDefiningOp();
OpBuilder builder(input_op);
builder.setInsertionPointAfter(input_op);
SmallVector<int64_t, 4> transform_shape = {
input_shape[0], input_shape[1] / block_size, input_shape[2] / block_size,
input_shape[3] * block_size * block_size};
auto transform_result_type =
RankedTensorType::get(transform_shape, getElementTypeOrSelf(input));
return builder.create<TF::SpaceToDepthOp>(
cluster_func.getLoc(), transform_result_type, input, block_size);
}
// Performs transformation for a non-replicated input.
TF::SpaceToDepthOp HandleHostInput(Value input, int64_t index,
tf_device::ClusterFuncOp cluster_func,
int32_t block_size,
ArrayRef<int64_t> input_shape) {
auto space_to_depth =
BuildSpaceToDepth(cluster_func, input, block_size, input_shape);
cluster_func.setOperand(index, space_to_depth);
return space_to_depth;
}
// Performs transformation for replicated inputs. Returns true if this is a
// supported case (thus transform happened).
bool HandleHostReplicatedInputs(int64_t index,
tf_device::ClusterFuncOp cluster_func,
BlockArgument block_arg,
tf_device::ReplicateOp replicate,
int32_t block_size) {
int64_t replicate_arg_index = block_arg.getArgNumber();
// We need to know the devices to copy to.
if (!replicate.devices()) return false;
int64_t num_replicas = replicate.n();
// Gets inputs at replicate_arg_index for each replica.
auto inputs = replicate.getOperands()
.drop_front(replicate_arg_index * num_replicas)
.take_front(num_replicas);
for (auto input : inputs) {
auto input_op = input.getDefiningOp();
if (!input_op || !IsSupportedHostInputOp(input_op)) return false;
}
for (auto entry : llvm::enumerate(inputs)) {
auto ranked_type = entry.value().getType().dyn_cast<RankedTensorType>();
if (!ranked_type) return false;
auto input_shape = ranked_type.getShape();
auto space_to_depth =
BuildSpaceToDepth(cluster_func, entry.value(), block_size, input_shape);
replicate.setOperand(num_replicas * replicate_arg_index + entry.index(),
space_to_depth);
block_arg.setType(space_to_depth.getType());
}
return true;
}
// Performs transformation on a pair of execute and compile ops. The compile
// should not have other uses.
void HandleCluster(tf_device::ClusterFuncOp cluster_func, int32_t block_size,
unsigned arg_num) {
auto maybe_replicate =
llvm::dyn_cast<tf_device::ReplicateOp>(cluster_func->getParentOp());
llvm::SmallVector<int64_t, 8> transform_input_indices;
for (auto input : llvm::enumerate(cluster_func.operands())) {
if (auto block_arg = input.value().dyn_cast<BlockArgument>()) {
if (block_arg.getArgNumber() != arg_num) continue;
// For a block argument, consider transforms only when it is a replicated
// input (defining ops will be outside the replicate node).
if (maybe_replicate == block_arg.getParentRegion()->getParentOp()) {
HandleHostReplicatedInputs(input.index(), cluster_func, block_arg,
maybe_replicate, block_size);
}
} else {
// For an op output, consider transforms only when 1) there is no
// replicateion or 2) it is outside the replicate node that encloses the
// execute node. (Because if the op is inside replicate, it is probably
// not on the host.)
if (input.index() != arg_num) continue;
auto input_op = input.value().getDefiningOp();
if (maybe_replicate &&
maybe_replicate.body().isAncestor(input_op->getParentRegion())) {
continue;
}
if (!IsSupportedHostInputOp(input_op)) continue;
auto ranked_type = input.value().getType().dyn_cast<RankedTensorType>();
if (!ranked_type) continue;
auto input_shape = ranked_type.getShape();
HandleHostInput(input.value(), input.index(), cluster_func, block_size,
input_shape);
}
}
}
// Checks if input shape of convolution is good for space to depth transform.
bool Conv2DInputShapeCanTransform(Value input) {
auto ranked_type = input.getType().dyn_cast<RankedTensorType>();
if (!ranked_type) return false;
auto input_shape = ranked_type.getShape();
int32_t batch_size = input_shape[0];
int32_t channel = input_shape[3];
if (batch_size > 8 || channel > 8) {
return false;
}
return true;
}
// Get block argument id and number of users for the input arg.
Optional<BlockArgumentInfo> GetBlockArgNum(Value arg) {
if (auto block_arg = arg.dyn_cast<mlir::BlockArgument>()) {
if (!Conv2DInputShapeCanTransform(arg)) return None;
unsigned num_users =
std::distance(block_arg.getUsers().begin(), block_arg.getUsers().end());
BlockArgumentInfo block_arg_info = {block_arg.getArgNumber(), num_users};
return block_arg_info;
}
return None;
}
// Gets input block argument id and number of users for the input recursively.
// Current supported ops between convolution input and the block arguments are
// PadOp and CastOp.
Optional<BlockArgumentInfo> GetInputBlockArgNum(Value input) {
auto block_arg_num = GetBlockArgNum(input);
if (block_arg_num.hasValue()) return block_arg_num;
Value next_input = input;
auto pad_op = dyn_cast_or_null<TF::PadOp>(next_input.getDefiningOp());
auto cast_op = dyn_cast_or_null<TF::CastOp>(next_input.getDefiningOp());
while (pad_op || cast_op) {
if (pad_op) {
auto block_arg_num = GetBlockArgNum(pad_op.input());
if (block_arg_num.hasValue()) return block_arg_num;
next_input = pad_op.input();
} else {
auto block_arg_num = GetBlockArgNum(cast_op.x());
if (block_arg_num.hasValue()) return block_arg_num;
next_input = cast_op.x();
}
pad_op = dyn_cast_or_null<TF::PadOp>(next_input.getDefiningOp());
cast_op = dyn_cast_or_null<TF::CastOp>(next_input.getDefiningOp());
}
return None;
}
// Checks if a convoluton can apply SpaceToDepth transform.
// Only the first convolution in the graph whose batch size smaller than 8
// and its input feature size smaller than 8 can be transformed.
Optional<BlockArgumentInfo> GetConv2DInputArgNum(TF::Conv2DOp conv2d) {
if (conv2d.data_format() != "NHWC" || conv2d.strides().size() != 4) {
return None;
}
// Current supported ops between convolution input and the block arguments are
// PadOp and CastOp.
return GetInputBlockArgNum(conv2d.input());
}
// Applies space to depth transform for the first convolution on TPU device.
void HandleFirstConvolution(TF::Conv2DOp conv2d, int64_t block_size) {
// Check if input and filter type are RankedTensorType.
auto input_tensor_type =
conv2d.input().getType().dyn_cast<RankedTensorType>();
auto filter_tensor_type =
conv2d.filter().getType().dyn_cast<RankedTensorType>();
if (!input_tensor_type || !filter_tensor_type) return;
// Book keeping filter shape for padding and backprop filter rewrite.
auto filter_shape = filter_tensor_type.getShape();
SmallVector<int32_t, 4> old_filter_shape(filter_shape.begin(),
filter_shape.end());
// Handles input.
auto conv2d_input = conv2d.input();
if (auto block_arg = conv2d_input.dyn_cast<mlir::BlockArgument>()) {
// Change on device function type/shape.
HandleFuncOp(block_arg.getOwner()->getParentOp());
}
if (auto pad_op = dyn_cast_or_null<TF::PadOp>(conv2d_input.getDefiningOp())) {
// Rewrite pad_op before Convolutioin.
if (failed(HandlePad(pad_op, filter_shape[0], block_size))) return;
auto pad_input = pad_op.input();
if (auto block_arg = pad_input.dyn_cast<mlir::BlockArgument>()) {
// Change on device function type/shape.
HandleFuncOp(block_arg.getOwner()->getParentOp());
}
}
// Handle Conv2D input, stride and filter.
HandleConv2DInput(conv2d, block_size);
HandleConv2DStride(conv2d);
HandleConv2DFilter(conv2d, block_size);
// Book keeping new filter shape for backprop filter rewrite.
// Filter shape is defined in HandleConv2DFilter, thus it is RankedTensorType.
filter_shape = conv2d.filter().getType().cast<RankedTensorType>().getShape();
SmallVector<int32_t, 4> new_filter_shape(filter_shape.begin(),
filter_shape.end());
// Rewrite Conv2DBackPropFilter that is the user of first convolution's input.
if (!conv2d_input.getDefiningOp()) return;
for (Operation* user : conv2d_input.getDefiningOp()->getUsers()) {
if (auto backprop = dyn_cast<TF::Conv2DBackpropFilterOp>(user)) {
HandleConv2DBackPropFilter(backprop, old_filter_shape, new_filter_shape,
block_size);
}
}
}
// Gets block size that is equal to stride from spatial dimension
// from convolution.
// Space to depth transform won't be triggered if block size <= 1.
int32_t GetConv2DBlockSize(TF::Conv2DOp conv2d) {
SmallVector<int32_t, 4> strides(4, 1);
for (int i = 0; i < 3; ++i) {
strides[i] = conv2d.strides()[i].cast<mlir::IntegerAttr>().getInt();
}
// Space to depth only supports striding at spatial dimension.
if (strides[0] != 1 || strides[3] != 1) return 1;
// Space to depth only supports height_stride == width_stride case.
if (strides[1] != strides[2]) return 1;
return strides[1];
}
void TPUSpaceToDepthPass::runOnOperation() {
Optional<tf_device::ClusterFuncOp> cluster_func;
// Space to depth only supports training loop.
auto func_result = getOperation().walk([&](tf_device::ClusterFuncOp cluster) {
cluster_func = cluster;
return WalkResult::interrupt();
});
// Return if there is no tf_device::ClusterFuncOp in training loop.
if (!func_result.wasInterrupted() || !cluster_func.hasValue()) {
return;
}
// Get the function on device.
auto device_func = cluster_func->getFunc();
if (!device_func) return;
TF::Conv2DOp first_conv;
// A map maps block argument id to the convolutions consumes them.
llvm::SmallDenseMap<unsigned, std::vector<Conv2DWithBlockSize>>
argnum_and_convolutions;
// A map maps block argument id to the number of users.
llvm::SmallDenseMap<unsigned, int> argnum_num_users;
// Find out the qualified convolutions and its block argument ids.
auto conv2d_result = device_func.walk([&](TF::Conv2DOp conv2d) {
Optional<BlockArgumentInfo> arg_num_and_num_users =
GetConv2DInputArgNum(conv2d);
if (arg_num_and_num_users.hasValue()) {
// Get block size for the first convolution.
int64_t block_size = GetConv2DBlockSize(conv2d);
auto arg_num = arg_num_and_num_users.getValue().arg_num;
auto num_users = arg_num_and_num_users.getValue().num_users;
argnum_and_convolutions[arg_num].emplace_back(conv2d, block_size);
argnum_num_users[arg_num] = num_users;
return WalkResult::interrupt();
}
return WalkResult::advance();
});
if (!conv2d_result.wasInterrupted()) {
return;
}
// Iterate through block argument and its convolution users. Space to depth
// transform will be applied only if all the below conditions are satisfied:
// 1. All the users of the block argument will lead to convolutions;
// 2. block_size of for the space to depth transform for these convolutions
// are the same;
// 3. block_size of for the space to depth transform for these convolutions
// are larger than 1.
for (auto argnum_and_convolution : argnum_and_convolutions) {
auto arg_num = argnum_and_convolution.getFirst();
auto conv2d_and_block_sizes = argnum_and_convolution.getSecond();
// Continue if number of users of the block argment doesn't equal to number
// of transformable convolutions and there is no qualified convolution
// for transform or block size is smaller than 2.
if (argnum_num_users[arg_num] != conv2d_and_block_sizes.size() ||
conv2d_and_block_sizes.empty()) {
argnum_and_convolutions.erase(arg_num);
continue;
}
int64_t block_size = conv2d_and_block_sizes[0].second;
if (block_size < 2) {
argnum_and_convolutions.erase(arg_num);
continue;
}
// Continue if not all the block sizes for space to depth transform are the
// same.
for (auto conv2d_and_block_size : conv2d_and_block_sizes) {
if (conv2d_and_block_size.second != block_size) {
argnum_and_convolutions.erase(arg_num);
break;
}
}
}
// If there is no qualified space to depth transform.
if (argnum_and_convolutions.empty()) {
return;
}
// Apply space to depth transform.
for (auto argnum_and_convolution : argnum_and_convolutions) {
auto conv2d_and_block_sizes = argnum_and_convolution.getSecond();
int64_t block_size = conv2d_and_block_sizes[0].second;
// Apply space to depth transform to the input on the host.
HandleCluster(cluster_func.getValue(), block_size,
argnum_and_convolution.getFirst());
// Transform the convolution.
for (auto conv2d_and_block_size : conv2d_and_block_sizes) {
HandleFirstConvolution(conv2d_and_block_size.first,
conv2d_and_block_size.second);
}
}
}
} // namespace
std::unique_ptr<OperationPass<ModuleOp>> CreateTPUSpaceToDepthPass() {
return std::make_unique<TPUSpaceToDepthPass>();
}
static PassRegistration<TPUSpaceToDepthPass> pass(
"tf-tpu-space-to-depth-pass",
"Adds ops that allow TPU program enable automaic space to depth for the"
"convolution determined at JIT compile time.");
} // namespace TFTPU
} // namespace mlir
| [
"gardener@tensorflow.org"
] | gardener@tensorflow.org |
0b935df3e5feaae2062f8b1883927f18f6e7d428 | 8f002910368343f3e8e38df58156ba89a0fceaf7 | /gko-tracker-src/minihttpd/src/current_thread.cpp | 5f7c22c3a40fc85e9514c8e89439969d7328a608 | [
"BSD-2-Clause"
] | permissive | jaewon713/gingko | c8c9d353da867b798f25c058bc26d7cdc8ee8965 | 33f289b36d6d8176fa7be67275dda93d40efbfd7 | refs/heads/master | 2021-01-22T01:38:19.272175 | 2015-02-03T11:22:44 | 2015-02-03T11:22:44 | 36,642,022 | 15 | 10 | null | 2015-06-01T06:25:58 | 2015-06-01T06:25:58 | null | UTF-8 | C++ | false | false | 682 | cpp | #include "minihttpd/current_thread.h"
#include <sys/types.h>
#include <sys/syscall.h>
#include <assert.h>
#include <stdio.h>
#include <unistd.h>
namespace argus {
namespace CurrentThread {
__thread int t_cachedTid = 0;
__thread char t_tidString[32];
__thread const char* t_threadName = "unknown";
namespace internal {
pid_t gettid() {
return static_cast<pid_t>(::syscall(SYS_gettid));
}
} // namespace internal
void cacheTid() {
if (t_cachedTid == 0) {
t_cachedTid = internal::gettid();
snprintf(t_tidString, sizeof t_tidString, "%5d ", t_cachedTid);
}
}
bool isMainThread() {
return tid() == ::getpid();
}
} // namespace CurrentThread
} // namespace argus
| [
"csuliuming@sina.com"
] | csuliuming@sina.com |
cd7c292cece325552867fa8f58a4f5f71ef8c8b4 | 47bc067058e4d45f8729670b1bfa19aceaadc156 | /binary_search.cpp | 10ed1a7fec9ae2dacb5f103643a36dfecc4eed37 | [] | no_license | return19/All-C-Codes | 0bd0df357cd4bbc6552e1d943df792a1b4d806bb | b1c2269d2436a0cd65a5ef022595300c4827520f | refs/heads/master | 2021-09-09T16:13:53.464406 | 2018-03-17T17:02:55 | 2018-03-17T17:02:55 | 125,650,568 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 344 | cpp | #include<bits/stdc++.h>
using namespace std;
int arr[10100];
int main()
{
int n;
int i,j,k;
cin>>n;
for(i=0;i<n;i++)
scanf("%d",&arr[i]);
for(i=0;i<100;i++)
{
scanf("%d",&j);
cout<<lower_bound(arr,arr+n,j)-arr<<endl;
cout<<upper_bound(arr,arr+n,j)-arr<<endl;
}
return 0;
}
| [
"abhinandan1941996@gmail.com"
] | abhinandan1941996@gmail.com |
6fbaace4a0be3bbcecf33ea8f90235927f5de7e2 | e957c10ef29f4af5d5388ab2eb92c037b2367cae | /Usuario.h | 8bd9b4e236952fef3664fcc7f2ebe9ac3b46cb3d | [] | no_license | brunorodriguesti/aulaSisRec | 0bc15d102fef872de2903e8c7c70e705374971d4 | ec7b23fd6fa6f8dc49c0c7631b1714ca6d4e718c | refs/heads/master | 2021-01-11T05:53:29.027276 | 2016-10-19T16:17:35 | 2016-10-19T16:17:35 | 69,291,402 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 522 | h | #ifndef USUARIO_H
#define USUARIO_H
#include<string>
using namespace std;
class Usuario
{
int hashUsuario;
int qtdItensAvaliados;
public:
Usuario();
void setHashUsuario(int hashUsuario){
this->hashUsuario=hashUsuario;
}
int getHashUsuario(){
return this->hashUsuario;
}
void setqtdItensAvaliados(int qtdItensAvaliados){
this->qtdItensAvaliados=qtdItensAvaliados;
}
int getQtdItensAvaliados(){
return this->getQtdItensAvaliados();
}
};
#endif
| [
"noreply@github.com"
] | noreply@github.com |
c5a6917db8d0128a809dd863c143dd4748842a71 | 6a6193dc6dc8a49cf92846d8011c1f37c7c1fb48 | /test/error/metal_vector_too_large.cpp | 1c93b6c5d20eaf1570e249a0f0dd2f07bed9ed7c | [
"MIT"
] | permissive | StanfordAHA/Halide-to-Hardware | ac10c68fea5a295a8556284bec67dbd1ab8feffc | 135c5da2587e6f6b17b2e9352a456a645367ad4e | refs/heads/master | 2023-08-31T07:00:40.869746 | 2021-10-20T19:16:51 | 2021-10-20T19:17:08 | 167,240,813 | 76 | 14 | NOASSERTION | 2023-09-06T00:09:25 | 2019-01-23T19:25:20 | C++ | UTF-8 | C++ | false | false | 525 | cpp | #include "Halide.h"
#include "test/common/halide_test_dirs.h"
#include <stdio.h>
using namespace Halide;
int main(int argc, char **argv) {
ImageParam input(UInt(16), 2, "input");
Func f("f");
Var x("x"), y("y");
f(x, y) = input(x, y) + 42;
f.vectorize(x ,16).gpu_blocks(y, DeviceAPI::Metal);
std::string test_object = Internal::get_test_tmp_dir() + "metal_vector_too_large.o";
Target mac_target("osx-metal");
f.compile_to_object(test_object, { input }, "f", mac_target);
return 0;
}
| [
"zalman@zalman2.sfo.corp.google.com"
] | zalman@zalman2.sfo.corp.google.com |
1adb01cc2649d6ea043c9f2322a4f9b248dc2d91 | 8224e8ee18adfd05662f20f2a396e2eac7ab21c4 | /h/ksem.h | 686b40a180ac004f2d8663eadf87e0593358baeb | [] | no_license | n1kol4n1k/OS1-Project | c5867a6496406245697823e8237d4c8f0630ff28 | b5b32dec521fc4d671e933a788cd4d221efe7700 | refs/heads/master | 2022-12-11T01:45:47.769265 | 2020-08-01T13:18:45 | 2020-08-01T13:18:45 | 284,263,415 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 824 | h | /*
* kernelsem.h
*
* Created on: May 10, 2020
* Author: OS1
*/
#ifndef KSEM_H_
#define KSEM_H_
#include "semaphor.h"
#include "pcblist.h"
class KernelSem {
public:
KernelSem (int init=1);
~KernelSem ();
int wait (Time maxTimeToWait);
int signal(int n=0);
int stdsignal();
int val () const; // Returns the current value of the semaphore
friend class PCBList;
friend class KSEMList;
private:
int value;
PCBList* blocked;
};
struct ksemNode {
KernelSem* ksem;
ksemNode* next;
};
class KSEMList {
ksemNode* head;
public:
static KSEMList* allSems;
KSEMList();
KSEMList(KernelSem* k);
~KSEMList();
void addKSEMToList(KernelSem *k);
void removeKSEMFromList(KernelSem *k);
void updateWholeList();
};
#endif /* KSEM_H_ */
| [
"n1kol4n1k@gmail.com"
] | n1kol4n1k@gmail.com |
a558e71e1cd2a1bda41cc6b41775cfa90f6147c1 | 20ae4729e04db70c879b2dba631dc5ceb0703147 | /r2dengine/r2dengine.cpp | c3742c9a94c5e244e631dcc8878dc6c08f383cd2 | [] | no_license | damir00/burningskids | dbaa4dff37780b01deb4846cf1e9ef2c8acc5d7b | fb9b98dcc004634b9d54b2e045ca7a154716b481 | refs/heads/master | 2020-06-06T07:14:51.269458 | 2014-10-20T09:28:39 | 2014-10-20T09:28:39 | 25,458,862 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,545 | cpp |
#include "r2dengine.h"
#include "r2dutils.h"
#include <iostream>
using namespace std;
R2DEngine::R2DEngine() {
max_gear=5;
gear=1;
gas=0;
power=1;
ratios[0]=-0.5;
ratios[1]=1;
ratios[2]=2;
ratios[3]=3;
ratios[4]=4;
ratios[5]=5;
engine=cpBodyNew(1,1);
beam=cpBodyNew(0.01,0.01);
gear_joint=cpGearJointNew(engine, beam, 0, -get_ratio());
}
R2DEngine::~R2DEngine() {
}
void R2DEngine::set_gear(int g) {
float prev_ratio=-get_ratio();
gear=g;
if(gear>max_gear) gear=max_gear;
else if(gear<-1) gear=-1;
float ratio=-get_ratio();
float phase;
if(ratio<0) phase=cpBodyGetAngle(engine)*1/ratio - cpBodyGetAngle(beam);
else phase=0; //-cpBodyGetAngle(engine)*1/ratio + cpBodyGetAngle(beam);
cpGearJointSetPhase(gear_joint,phase);
cpGearJointSetRatio(gear_joint,ratio);
}
void R2DEngine::gear_down() {
set_gear(gear-1);
}
void R2DEngine::gear_up() {
set_gear(gear+1);
}
int R2DEngine::get_gear() {
return gear;
}
float R2DEngine::get_ratio() {
return ratios[gear];
}
float R2DEngine::get_gas() {
return gas;
}
void R2DEngine::set_input(float v) { //gas, 0-1
gas=R2DUtils::capf(v,0.0,1.0);
}
void R2DEngine::update(long delta) {
return;
cpBodyResetForces(engine);
//torque
cpBodyApplyForce(engine,cpv(0,1*gas),cpv(0.01,0));
cpBodyApplyForce(engine,cpv(0,-1*gas),cpv(-0.01,0));
//float r=engine->a/beam->a;
//cout<<"ratio "<<r<<endl;
}
void R2DEngine::set_power(float p) {
power=p;
}
float R2DEngine::get_power() {
return power;
}
float R2DEngine::get_output_power() {
return power*gas*ratios[gear];
}
| [
"damir.srpcic@gmail.com"
] | damir.srpcic@gmail.com |
448de2f72543542a059727e4844d650283ab31c8 | 03d0ce8a4bd34de35f654a568b6004aa321d3ab8 | /DemoDirectX/Ground.cpp | 13e68c05fc5e7866b480ed7a2dcbffd21b73ed02 | [] | no_license | minhnhatkool123/CASTLENEW | 7a202a3a4e3eb14dd9d7e6c2e347f8f69535b165 | c7de8dc774678f3a3b3503b43fb2113463ab472b | refs/heads/master | 2022-11-24T12:40:28.200321 | 2020-07-28T11:59:30 | 2020-07-28T11:59:30 | 257,939,088 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 299 | cpp | #include "Ground.h"
Ground::Ground()
{
}
void Ground::Render()
{
animation_set->at(0)->Render(-1, x, y);
RenderBoundingBox();
}
void Ground::GetBoundingBox(float &l, float &t, float &r, float &b)
{
l = x;
t = y;
r = l + ground_box_width;
b = t + ground_box_height;
}
Ground::~Ground()
{
}
| [
"62514136+minhnhatkool123@users.noreply.github.com"
] | 62514136+minhnhatkool123@users.noreply.github.com |
1e7894c0afa71ac8e636c83ec96c0e9ed5a7c095 | 3d8dc4118900ad9d790d3f7833cf98f443ddc597 | /1071:Speech Patterns/speech_patterns.cpp | a3ae0014b3b7f662c5e6f7c25ab50226e202a460 | [] | no_license | miaohang123/PAT-code | f1789c50fe987b5aa1287891ec7587f7bb1ce818 | ffbda979247a9841854f9911bab2eb9a8bdcba63 | refs/heads/master | 2020-05-20T22:39:18.946034 | 2017-03-10T08:58:38 | 2017-03-10T08:58:38 | 84,537,854 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,022 | cpp | #include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;
const int MAXN = 1001;
bool judge(char c){
if(c >= '0' && c <= '9') return true;
else if(c >= 'a' && c <= 'z') return true;
else if(c >= 'A' && c <= 'Z') return true;
else return flase;
}
int main(){
string str;
getline(cin, str);
int i = 0;
map<string, int> mp;
while(i < str.length()){
string word;
while(judge[str[i]] && i < str.length()){
if(str[i] >= 'A' && str[i] <= 'Z'){
str[i] += 32;
}
word += str[i];
i++;
}
if(word != ""){
if(mp.find(word) == mp.end()) mp[word] = 1;
else{
mp[word]++;
}
}
while((!judge[str[i]]) && i < str.length()) i++;
}
int res = -1;
string word;
for(map<string, int>::iterator it = mp.begin(); it != mp.end(); it++){
if(it->second > max){
res = it->second;
word = it->first;
}
}
cout <<word <<" " <<res <<endl;
return 0;
} | [
"noreply@github.com"
] | noreply@github.com |
400d7b012a77646bebf292e94695cda1b7737cd4 | bd9739abf849efecd3ed0ffa7c2238f56d927e9e | /dialog/common.hpp | f73d04d2a475d7a9c8390ebef9065f60729c6edd | [] | no_license | kubalife/kuba_life | a105cf71bf1788d03e7cefa777a4fc7615a4aecd | bd17f36babc4150083ba28237acac832d3c82f70 | refs/heads/master | 2021-01-12T15:13:26.689526 | 2016-11-09T21:13:05 | 2016-11-09T21:13:17 | 69,878,844 | 7 | 7 | null | 2019-06-15T13:26:50 | 2016-10-03T14:30:16 | SQF | UTF-8 | C++ | false | false | 34,561 | hpp | #define ST_LEFT 0x00
#define ST_MULTI 0x10
#define GUI_GRID_CENTER_WAbs ((safezoneW / safezoneH) min 1.2)
#define GUI_GRID_CENTER_HAbs (GUI_GRID_CENTER_WAbs / 1.2)
#define GUI_GRID_CENTER_W (GUI_GRID_CENTER_WAbs / 40)
#define GUI_GRID_CENTER_H (GUI_GRID_CENTER_HAbs / 25)
#define GUI_GRID_CENTER_X (safezoneX + (safezoneW - GUI_GRID_CENTER_WAbs)/2)
#define GUI_GRID_CENTER_Y (safezoneY + (safezoneH - GUI_GRID_CENTER_HAbs)/2)
#define true 1
#define false 0
class Life_Checkbox
{
access = 0; // Control access (0 - ReadAndWrite, 1 - ReadAndCreate, 2 - ReadOnly, 3 - ReadOnlyVerified)
idc = -1; // Control identification (without it, the control won't be displayed)
type = 77; // Type
style = ST_LEFT + ST_MULTI; // Style
default = 0; // Control selected by default (only one within a display can be used)
blinkingPeriod = 0; // Time in which control will fade out and back in. Use 0 to disable the effect.
x = 0;
y = 0;
w = 1 * GUI_GRID_CENTER_W; // Width
h = 1 * GUI_GRID_CENTER_H; // Height
//Colors
color[] = { 1, 1, 1, 0.7 }; // Texture color
colorFocused[] = { 1, 1, 1, 1 }; // Focused texture color
colorHover[] = { 1, 1, 1, 1 }; // Mouse over texture color
colorPressed[] = { 1, 1, 1, 1 }; // Mouse pressed texture color
colorDisabled[] = { 1, 1, 1, 0.2 }; // Disabled texture color
//Background colors
colorBackground[] = { 0, 0, 0, 0 }; // Fill color
colorBackgroundFocused[] = { 0, 0, 0, 0 }; // Focused fill color
colorBackgroundHover[] = { 0, 0, 0, 0 }; // Mouse hover fill color
colorBackgroundPressed[] = { 0, 0, 0, 0 }; // Mouse pressed fill color
colorBackgroundDisabled[] = { 0, 0, 0, 0 }; // Disabled fill color
//Textures
textureChecked = "\A3\Ui_f\data\GUI\RscCommon\RscCheckBox\CheckBox_checked_ca.paa"; //Texture of checked CheckBox.
textureUnchecked = "\A3\Ui_f\data\GUI\RscCommon\RscCheckBox\CheckBox_unchecked_ca.paa"; //Texture of unchecked CheckBox.
textureFocusedChecked = "\A3\Ui_f\data\GUI\RscCommon\RscCheckBox\CheckBox_checked_ca.paa"; //Texture of checked focused CheckBox (Could be used for showing different texture when focused).
textureFocusedUnchecked = "\A3\Ui_f\data\GUI\RscCommon\RscCheckBox\CheckBox_unchecked_ca.paa"; //Texture of unchecked focused CheckBox.
textureHoverChecked = "\A3\Ui_f\data\GUI\RscCommon\RscCheckBox\CheckBox_checked_ca.paa";
textureHoverUnchecked = "\A3\Ui_f\data\GUI\RscCommon\RscCheckBox\CheckBox_unchecked_ca.paa";
texturePressedChecked = "\A3\Ui_f\data\GUI\RscCommon\RscCheckBox\CheckBox_checked_ca.paa";
texturePressedUnchecked = "\A3\Ui_f\data\GUI\RscCommon\RscCheckBox\CheckBox_unchecked_ca.paa";
textureDisabledChecked = "\A3\Ui_f\data\GUI\RscCommon\RscCheckBox\CheckBox_checked_ca.paa";
textureDisabledUnchecked = "\A3\Ui_f\data\GUI\RscCommon\RscCheckBox\CheckBox_unchecked_ca.paa";
tooltip = ""; // Tooltip text
tooltipColorShade[] = { 0, 0, 0, 1 }; // Tooltip background color
tooltipColorText[] = { 1, 1, 1, 1 }; // Tooltip text color
tooltipColorBox[] = { 1, 1, 1, 1 }; // Tooltip frame color
//Sounds
soundClick[] = { "\A3\ui_f\data\sound\RscButton\soundClick", 0.09, 1 }; // Sound played after control is activated in format {file, volume, pitch}
soundEnter[] = { "\A3\ui_f\data\sound\RscButton\soundEnter", 0.09, 1 }; // Sound played when mouse cursor enters the control
soundPush[] = { "\A3\ui_f\data\sound\RscButton\soundPush", 0.09, 1 }; // Sound played when the control is pushed down
soundEscape[] = { "\A3\ui_f\data\sound\RscButton\soundEscape", 0.09, 1 }; // Sound played when the control is released after pushing down
};
class Life_RscScrollBar
{
color[] = {1,1,1,0.6};
colorActive[] = {1,1,1,1};
colorDisabled[] = {1,1,1,0.3};
thumb = "\A3\ui_f\data\gui\cfg\scrollbar\thumb_ca.paa";
arrowEmpty = "\A3\ui_f\data\gui\cfg\scrollbar\arrowEmpty_ca.paa";
arrowFull = "\A3\ui_f\data\gui\cfg\scrollbar\arrowFull_ca.paa";
border = "\A3\ui_f\data\gui\cfg\scrollbar\border_ca.paa";
shadow = 0;
scrollSpeed = 0.06;
width = 0;
height = 0;
autoScrollEnabled = 1;
autoScrollSpeed = -1;
autoScrollDelay = 5;
autoScrollRewind = 0;
};
class Life_RscControlsGroup {
type = 15;
idc = -1;
x = 0;
y = 0;
w = 1;
h = 1;
shadow = 0;
style = 16;
class VScrollBar : Life_RscScrollBar
{
width = 0.021;
autoScrollEnabled = 1;
};
class HScrollBar : Life_RscScrollBar
{
height = 0.028;
};
class Controls {};
};
class Life_RscControlsGroupNoScrollbars : Life_RscControlsGroup {
class VScrollbar : VScrollbar {
width = 0;
};
class HScrollbar : HScrollbar {
height = 0;
};
};
class Life_RscHud
{
idc = -1;
type = 0;
style = 0x00;
colorBackground[] = { 1 , 1 , 1 , 0 };
colorText[] = { 1 , 1 , 1 , 1 };
font = "PuristaSemibold";
sizeEx = 0.025;
h = 0.25;
text = "";
};
class Life_RscListNBox
{
style = 16;
type = 102;
shadow = 0;
font = "PuristaMedium";
sizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)";
color[] = {0.95,0.95,0.95,1};
colorText[] = {1,1,1,1.0};
colorDisabled[] = {1,1,1,0.25};
colorScrollbar[] = {0.95,0.95,0.95,1};
colorSelect[] = {0,0,0,1};
colorSelect2[] = {0,0,0,1};
colorSelectBackground[] = {0.8,0.8,0.8,1};
colorSelectBackground2[] = {1,1,1,0.5};
colorPicture[] = {1,1,1,1};
colorPictureSelected[] = {1,1,1,1};
colorPictureDisabled[] = {1,1,1,1};
soundSelect[] = {"",0.1,1};
soundExpand[] = {"",0.1,1};
soundCollapse[] = {"",0.1,1};
period = 1.2;
maxHistoryDelay = 0.5;
autoScrollSpeed = -1;
autoScrollDelay = 5;
autoScrollRewind = 0;
class ListScrollBar: Life_RscScrollBar{};
class ScrollBar: Life_RscScrollBar{};
};
class Life_RscText {
x = 0;
y = 0;
h = 0.037;
w = 0.3;
type = 0;
style = 0;
shadow = 1;
colorShadow[] = {0, 0, 0, 0.5};
font = "PuristaMedium";
SizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)";
text = "";
colorText[] = {1, 1, 1, 1.0};
colorBackground[] = {0, 0, 0, 0};
linespacing = 1;
tooltipColorText[] = {1,1,1,1};
tooltipColorBox[] = {1,1,1,1};
tooltipColorShade[] = {0,0,0,0.65};
};
class Life_RscLine: Life_RscText {
idc = -1;
style = 176;
x = 0.17;
y = 0.48;
w = 0.66;
h = 0;
text = "";
colorBackground[] = {0, 0, 0, 0};
colorText[] = {1, 1, 1, 1.0};
};
class Life_RscTree {
style = 2;
font = "PuristaMedium";
sizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 0.8)";
expandedTexture = "A3\ui_f\data\gui\Rsccommon\Rsctree\expandedTexture_ca.paa";
hiddenTexture = "A3\ui_f\data\gui\Rsccommon\Rsctree\hiddenTexture_ca.paa";
rowHeight = 0.0439091;
color[] = {1, 1, 1, 1};
colorSelect[] = {0.7, 0.7, 0.7, 1};
colorBackground[] = {0, 0, 0, 0};
colorSelectBackground[] = {0, 0, 0, 0.5};
colorBorder[] = {0, 0, 0, 0};
borderSize = 0;
};
class Life_RscTitle: Life_RscText {
style = 0;
sizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)";
colorText[] = {0.95, 0.95, 0.95, 1};
};
class life_RscPicture {
shadow = 0;
type = 0;
style = 48;
sizeEx = 0.023;
font = "PuristaMedium";
colorBackground[] = {};
colorText[] = {};
x = 0;
y = 0;
w = 0.2;
h = 0.15;
tooltipColorText[] = {1,1,1,1};
tooltipColorBox[] = {1,1,1,1};
tooltipColorShade[] = {0,0,0,0.65};
};
class Life_RscTextMulti: Life_RscText
{
linespacing = 1;
style = 0 + 16 + 0x200;
};
class Life_RscPictureKeepAspect : Life_RscPicture
{
style = 0x30 + 0x800;
};
class Life_RscStructuredText {
type = 13;
style = 0;
x = 0;
y = 0;
h = 0.035;
w = 0.1;
text = "";
size = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)";
colorText[] = {1, 1, 1, 1.0};
shadow = 1;
class Attributes {
font = "PuristaMedium";
color = "#ffffff";
align = "left";
shadow = 1;
};
};
class Life_RscActiveText {
idc = -1;
type = 11;
style = 0;
x = 0;
y = 0;
h = 0.037;
w = 0.3;
sizeEx = 0.040;
font = "PuristaLight";
color[] = {1, 1, 1, 1};
colorActive[] = {1, 0.2, 0.2, 1};
soundEnter[] = {"\A3\ui_f\data\sound\onover", 0.09, 1};
soundPush[] = {"\A3\ui_f\data\sound\new1", 0.0, 0};
soundClick[] = {"\A3\ui_f\data\sound\onclick", 0.07, 1};
soundEscape[] = {"\A3\ui_f\data\sound\onescape", 0.09, 1};
action = "";
text = "";
tooltipColorText[] = {1,1,1,1};
tooltipColorBox[] = {1,1,1,1};
tooltipColorShade[] = {0,0,0,0.65};
};
class Life_RscButton
{
style = 2;
x = 0;
y = 0;
w = 0.095589;
h = 0.039216;
shadow = 2;
font = "PuristaMedium";
sizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)";
colorText[] = {1,1,1,1.0};
colorDisabled[] = {0.4,0.4,0.4,1};
colorBackground[] = {"(profilenamespace getvariable ['GUI_BCG_RGB_R',0.69])","(profilenamespace getvariable ['GUI_BCG_RGB_G',0.75])","(profilenamespace getvariable ['GUI_BCG_RGB_B',0.5])",0.7};
colorBackgroundActive[] = {"(profilenamespace getvariable ['GUI_BCG_RGB_R',0.69])","(profilenamespace getvariable ['GUI_BCG_RGB_G',0.75])","(profilenamespace getvariable ['GUI_BCG_RGB_B',0.5])",1};
colorBackgroundDisabled[] = {0.95,0.95,0.95,1};
offsetX = 0.003;
offsetY = 0.003;
offsetPressedX = 0.002;
offsetPressedY = 0.002;
colorFocused[] = {"(profilenamespace getvariable ['GUI_BCG_RGB_R',0.69])","(profilenamespace getvariable ['GUI_BCG_RGB_G',0.75])","(profilenamespace getvariable ['GUI_BCG_RGB_B',0.5])",1};
colorShadow[] = {0,0,0,1};
colorBorder[] = {0,0,0,1};
borderSize = 0.0;
soundEnter[] = {"\A3\ui_f\data\sound\RscButton\soundEnter",0.09,1};
soundPush[] = {"\A3\ui_f\data\sound\RscButton\soundPush",0.09,1};
soundClick[] = {"\A3\ui_f\data\sound\RscButton\soundClick",0.09,1};
soundEscape[] = {"\A3\ui_f\data\sound\RscButton\soundEscape",0.09,1};
};
class Life_RscButtonTextOnly : Life_RscButton {
SizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 0.8)";
colorBackground[] = {1, 1, 1, 0};
colorBackgroundActive[] = {1, 1, 1, 0};
colorBackgroundDisabled[] = {1, 1, 1, 0};
colorFocused[] = {1, 1, 1, 0};
colorShadow[] = {1, 1, 1, 0};
borderSize = 0.0;
};
class Life_RscShortcutButton {
idc = -1;
style = 0;
default = 0;
shadow = 1;
w = 0.183825;
h = "((((safezoneW / safezoneH) min 1.2) / 1.2) / 20)";
color[] = {1,1,1,1.0};
colorFocused[] = {1,1,1,1.0};
color2[] = {0.95,0.95,0.95,1};
colorDisabled[] = {1,1,1,0.25};
colorBackground[] = {"(profilenamespace getvariable ['GUI_BCG_RGB_R',0.69])","(profilenamespace getvariable ['GUI_BCG_RGB_G',0.75])","(profilenamespace getvariable ['GUI_BCG_RGB_B',0.5])",1};
colorBackgroundFocused[] = {"(profilenamespace getvariable ['GUI_BCG_RGB_R',0.69])","(profilenamespace getvariable ['GUI_BCG_RGB_G',0.75])","(profilenamespace getvariable ['GUI_BCG_RGB_B',0.5])",1};
colorBackground2[] = {1,1,1,1};
animTextureDefault = "\A3\ui_f\data\GUI\RscCommon\RscShortcutButton\normal_ca.paa";
animTextureNormal = "\A3\ui_f\data\GUI\RscCommon\RscShortcutButton\normal_ca.paa";
animTextureDisabled = "\A3\ui_f\data\GUI\RscCommon\RscShortcutButton\normal_ca.paa";
animTextureOver = "\A3\ui_f\data\GUI\RscCommon\RscShortcutButton\over_ca.paa";
animTextureFocused = "\A3\ui_f\data\GUI\RscCommon\RscShortcutButton\focus_ca.paa";
animTexturePressed = "\A3\ui_f\data\GUI\RscCommon\RscShortcutButton\down_ca.paa";
periodFocus = 1.2;
periodOver = 0.8;
class HitZone
{
left = 0.0;
top = 0.0;
right = 0.0;
bottom = 0.0;
};
class ShortcutPos
{
left = 0;
top = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 20) - (((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)) / 2";
w = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1) * (3/4)";
h = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)";
};
class TextPos
{
left = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1) * (3/4)";
top = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 20) - (((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)) / 2";
right = 0.005;
bottom = 0.0;
};
period = 0.4;
font = "PuristaMedium";
size = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)";
sizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)";
text = "";
soundEnter[] = {"\A3\ui_f\data\sound\RscButton\soundEnter",0.09,1};
soundPush[] = {"\A3\ui_f\data\sound\RscButton\soundPush",0.09,1};
soundClick[] = {"\A3\ui_f\data\sound\RscButton\soundClick",0.09,1};
soundEscape[] = {"\A3\ui_f\data\sound\RscButton\soundEscape",0.09,1};
action = "";
class Attributes
{
font = "PuristaMedium";
color = "#E5E5E5";
align = "left";
shadow = "true";
};
class AttributesImage
{
font = "PuristaMedium";
color = "#E5E5E5";
align = "left";
};
};
class Life_RscButtonMenu : Life_RscShortcutButton {
idc = -1;
type = 16;
style = "0x02 + 0xC0";
default = 0;
shadow = 0;
x = 0;
y = 0;
w = 0.095589;
h = 0.039216;
animTextureNormal = "#(argb,8,8,3)color(1,1,1,1)";
animTextureDisabled = "#(argb,8,8,3)color(1,1,1,1)";
animTextureOver = "#(argb,8,8,3)color(1,1,1,1)";
animTextureFocused = "#(argb,8,8,3)color(1,1,1,1)";
animTexturePressed = "#(argb,8,8,3)color(1,1,1,1)";
animTextureDefault = "#(argb,8,8,3)color(1,1,1,1)";
colorBackground[] = {0,0,0,0.8};
colorBackgroundFocused[] = {1,1,1,1};
colorBackground2[] = {0.75,0.75,0.75,1};
color[] = {1,1,1,1};
colorFocused[] = {0,0,0,1};
color2[] = {0,0,0,1};
colorText[] = {1,1,1,1};
colorDisabled[] = {1,1,1,0.25};
period = 1.2;
periodFocus = 1.2;
periodOver = 1.2;
size = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)";
sizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)";
tooltipColorText[] = {1,1,1,1};
tooltipColorBox[] = {1,1,1,1};
tooltipColorShade[] = {0,0,0,0.65};
class TextPos
{
left = "0.25 * (((safezoneW / safezoneH) min 1.2) / 40)";
top = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) - (((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)) / 2";
right = 0.005;
bottom = 0.0;
};
class Attributes
{
font = "PuristaLight";
color = "#E5E5E5";
align = "left";
shadow = "false";
};
class ShortcutPos
{
left = "(6.25 * (((safezoneW / safezoneH) min 1.2) / 40)) - 0.0225 - 0.005";
top = 0.005;
w = 0.0225;
h = 0.03;
};
soundEnter[] = {"\A3\ui_f\data\sound\RscButtonMenu\soundEnter",0.09,1};
soundPush[] = {"\A3\ui_f\data\sound\RscButtonMenu\soundPush",0.09,1};
soundClick[] = {"\A3\ui_f\data\sound\RscButtonMenu\soundClick",0.09,1};
soundEscape[] = {"\A3\ui_f\data\sound\RscButtonMenu\soundEscape",0.09,1};
textureNoShortcut = "";
};
class Life_RscShortcutButtonMain : Life_RscShortcutButton {
idc = -1;
style = 0;
default = 0;
w = 0.313726;
h = 0.104575;
color[] = {1, 1, 1, 1.0};
colorDisabled[] = {1, 1, 1, 0.25};
class HitZone {
left = 0.0;
top = 0.0;
right = 0.0;
bottom = 0.0;
};
class ShortcutPos {
left = 0.0145;
top = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 20) - (((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1.2)) / 2";
w = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1.2) * (3/4)";
h = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1.2)";
};
class TextPos {
left = "( ((safezoneW / safezoneH) min 1.2) / 32) * 1.5";
top = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 20)*2 - (((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1.2)) / 2";
right = 0.005;
bottom = 0.0;
};
animTextureNormal = "\A3\ui_f\data\GUI\RscCommon\RscShortcutButtonMain\normal_ca.paa";
animTextureDisabled = "\A3\ui_f\data\GUI\RscCommon\RscShortcutButtonMain\disabled_ca.paa";
animTextureOver = "\A3\ui_f\data\GUI\RscCommon\RscShortcutButtonMain\over_ca.paa";
animTextureFocused = "\A3\ui_f\data\GUI\RscCommon\RscShortcutButtonMain\focus_ca.paa";
animTexturePressed = "\A3\ui_f\data\GUI\RscCommon\RscShortcutButtonMain\down_ca.paa";
animTextureDefault = "\A3\ui_f\data\GUI\RscCommon\RscShortcutButtonMain\normal_ca.paa";
period = 0.5;
font = "PuristaMedium";
size = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1.2)";
sizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1.2)";
text = "";
soundEnter[] = {"\A3\ui_f\data\sound\onover", 0.09, 1};
soundPush[] = {"\A3\ui_f\data\sound\new1", 0.0, 0};
soundClick[] = {"\A3\ui_f\data\sound\onclick", 0.07, 1};
soundEscape[] = {"\A3\ui_f\data\sound\onescape", 0.09, 1};
action = "";
class Attributes {
font = "PuristaMedium";
color = "#E5E5E5";
align = "left";
shadow = "false";
};
class AttributesImage {
font = "PuristaMedium";
color = "#E5E5E5";
align = "false";
};
};
class Life_RscCheckbox {
idc = -1;
type = 7;
style = 0;
x = "LINE_X(XVAL)";
y = LINE_Y;
w = "LINE_W(WVAL)";
h = 0.029412;
colorText[] = {1, 0, 0, 1};
color[] = {0, 0, 0, 0};
colorBackground[] = {0, 0, 1, 1};
colorTextSelect[] = {0, 0.8, 0, 1};
colorSelectedBg[] = {"(profilenamespace getvariable ['GUI_BCG_RGB_R',0.3843])", "(profilenamespace getvariable ['GUI_BCG_RGB_G',0.7019])", "(profilenamespace getvariable ['GUI_BCG_RGB_B',0.8862])", 1};
colorSelect[] = {0, 0, 0, 1};
colorTextDisable[] = {0.4, 0.4, 0.4, 1};
colorDisable[] = {0.4, 0.4, 0.4, 1};
font = "PuristaMedium";
sizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 0.8)";
rows = 1;
5ns = 1;
strings[] = {UNCHECKED};
checked_strings[] = {CHECKED};
};
class Life_RscProgress
{
type = 8;
style = 0;
x = 0.344;
y = 0.619;
w = 0.313726;
h = 0.0261438;
texture = "";
shadow = 2;
colorFrame[] = {0, 0, 0, 1};
colorBackground[] = {0,0,0,0.7};
colorBar[] = {"(profilenamespace getvariable ['GUI_BCG_RGB_R',0.3843])", "(profilenamespace getvariable ['GUI_BCG_RGB_G',0.7019])", "(profilenamespace getvariable ['GUI_BCG_RGB_B',0.8862])", "(profilenamespace getvariable ['GUI_BCG_RGB_A',0.7])"};
};
class Life_RscListBox
{
style = 16;
idc = -1;
type = 5;
w = 0.275;
h = 0.04;
font = "PuristaMedium";
colorSelect[] = {1, 1, 1, 1};
colorText[] = {1, 1, 1, 1};
colorBackground[] = {0.28,0.28,0.28,0.28};
colorSelect2[] = {1, 1, 1, 1};
colorSelectBackground[] = {0.95, 0.95, 0.95, 0.5};
colorSelectBackground2[] = {1, 1, 1, 0.5};
colorScrollbar[] = {0.2, 0.2, 0.2, 1};
colorPicture[] = {1,1,1,1};
colorPictureSelected[] = {1,1,1,1};
colorPictureDisabled[] = {1,1,1,1};
arrowFull = "\A3\ui_f\data\gui\cfg\scrollbar\arrowFull_ca.paa";
arrowEmpty = "\A3\ui_f\data\gui\cfg\scrollbar\arrowEmpty_ca.paa";
wholeHeight = 0.45;
rowHeight = 0.04;
color[] = {0.7, 0.7, 0.7, 1};
colorActive[] = {0,0,0,1};
colorDisabled[] = {0,0,0,0.3};
sizeEx = 0.023;
soundSelect[] = {"",0.1,1};
soundExpand[] = {"",0.1,1};
soundCollapse[] = {"",0.1,1};
maxHistoryDelay = 1;
autoScrollSpeed = -1;
autoScrollDelay = 5;
autoScrollRewind = 0;
tooltipColorText[] = {1,1,1,1};
tooltipColorBox[] = {1,1,1,1};
tooltipColorShade[] = {0,0,0,0.65};
class ListScrollBar: Life_RscScrollBar
{
color[] = {1,1,1,1};
autoScrollEnabled = 1;
};
};
class Life_RscEdit {
type = 2;
style = 0x00 + 0x40;
font = "PuristaMedium";
shadow = 2;
sizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)";
colorBackground[] = {0, 0, 0, 1};
soundSelect[] = {"",0.1,1};
soundExpand[] = {"",0.1,1};
colorText[] = {0.95, 0.95, 0.95, 1};
colorDisabled[] = {1, 1, 1, 0.25};
autocomplete = false;
colorSelection[] = {"(profilenamespace getvariable ['GUI_BCG_RGB_R',0.3843])", "(profilenamespace getvariable ['GUI_BCG_RGB_G',0.7019])", "(profilenamespace getvariable ['GUI_BCG_RGB_B',0.8862])", 1};
canModify = 1;
};
class Life_RscSlider {
h = 0.025;
color[] = {1, 1, 1, 0.8};
colorActive[] = {1, 1, 1, 1};
};
class life_RscXSliderH
{
style = 1024;
type = 43;
shadow = 2;
x = 0;
y = 0;
h = 0.029412;
w = 0.400000;
color[] = {
1, 1, 1, 0.7
};
colorActive[] = {
1, 1, 1, 1
};
colorDisabled[] = {
1, 1, 1, 0.500000
};
arrowEmpty = "\A3\ui_f\data\gui\cfg\slider\arrowEmpty_ca.paa";
arrowFull = "\A3\ui_f\data\gui\cfg\slider\arrowFull_ca.paa";
border = "\A3\ui_f\data\gui\cfg\slider\border_ca.paa";
thumb = "\A3\ui_f\data\gui\cfg\slider\thumb_ca.paa";
};
class Life_RscFrame {
type = 0;
idc = -1;
style = 64;
shadow = 2;
colorBackground[] = {0, 0, 0, 0};
colorText[] = {1, 1, 1, 1};
font = "PuristaMedium";
sizeEx = 0.02;
text = "";
};
class Life_RscBackground: Life_RscText {
type = 0;
IDC = -1;
style = 512;
shadow = 0;
x = 0.0;
y = 0.0;
w = 1.0;
h = 1.0;
text = "";
ColorBackground[] = {0.48, 0.5, 0.35, 1};
ColorText[] = {0.1, 0.1, 0.1, 1};
font = "PuristaMedium";
SizeEx = 1;
};
class Life_RscHTML {
colorText[] = {1, 1, 1, 1.0};
colorBold[] = {1, 1, 1, 1.0};
colorLink[] = {1, 1, 1, 0.75};
colorLinkActive[] = {1, 1, 1, 1.0};
sizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)";
prevPage = "\A3\ui_f\data\gui\Rsccommon\Rschtml\arrow_left_ca.paa";
nextPage = "\A3\ui_f\data\gui\Rsccommon\Rschtml\arrow_right_ca.paa";
shadow = 2;
class H1 {
font = "PuristaMedium";
fontBold = "PuristaSemibold";
sizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1.2)";
align = "left";
};
class H2 {
font = "PuristaMedium";
fontBold = "PuristaSemibold";
sizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)";
align = "right";
};
class H3 {
font = "PuristaMedium";
fontBold = "PuristaSemibold";
sizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)";
align = "left";
};
class H4 {
font = "PuristaMedium";
fontBold = "PuristaSemibold";
sizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)";
align = "left";
};
class H5 {
font = "PuristaMedium";
fontBold = "PuristaSemibold";
sizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)";
align = "left";
};
class H6 {
font = "PuristaMedium";
fontBold = "PuristaSemibold";
sizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)";
align = "left";
};
class P {
font = "PuristaMedium";
fontBold = "PuristaSemibold";
sizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)";
align = "left";
};
};
class Life_RscHitZones {
x = 0;
y = 0;
w = 0.1;
h = 0.1;
xCount = 1;
yCount = 1;
xSpace = 0;
ySpace = 0;
};
class Life_RscMapControl
{
access = 0;
type = 101;
idc = 51;
style = 48;
colorBackground[] = {0.969,0.957,0.949,1};
colorOutside[] = {0,0,0,1};
colorText[] = {0,0,0,1};
font = "TahomaB";
sizeEx = 0.04;
colorSea[] = {0.467,0.631,0.851,0.5};
colorForest[] = {0.624,0.78,0.388,0.5};
colorRocks[] = {0,0,0,0.3};
colorCountlines[] = {0.572,0.354,0.188,0.25};
colorMainCountlines[] = {0.572,0.354,0.188,0.5};
colorCountlinesWater[] = {0.491,0.577,0.702,0.3};
colorMainCountlinesWater[] = {0.491,0.577,0.702,0.6};
colorForestBorder[] = {0,0,0,0};
colorRocksBorder[] = {0,0,0,0};
colorPowerLines[] = {0.1,0.1,0.1,1};
colorRailWay[] = {0.8,0.2,0,1};
colorNames[] = {0.1,0.1,0.1,0.9};
colorInactive[] = {1,1,1,0.5};
colorLevels[] = {0.286,0.177,0.094,0.5};
colorTracks[] = {0.84,0.76,0.65,0.15};
colorRoads[] = {0.7,0.7,0.7,1};
colorMainRoads[] = {0.9,0.5,0.3,1};
colorTracksFill[] = {0.84,0.76,0.65,1};
colorRoadsFill[] = {1,1,1,1};
colorMainRoadsFill[] = {1,0.6,0.4,1};
colorGrid[] = {0.1,0.1,0.1,0.6};
colorGridMap[] = {0.1,0.1,0.1,0.6};
stickX[] = {0.2,{"Gamma",1,1.5}};
stickY[] = {0.2,{"Gamma",1,1.5}};
class Legend
{
colorBackground[] = {1,1,1,0.5};
color[] = {0,0,0,1};
x = "SafeZoneX + (((safezoneW / safezoneH) min 1.2) / 40)";
y = "SafeZoneY + safezoneH - 4.5 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)";
w = "10 * (((safezoneW / safezoneH) min 1.2) / 40)";
h = "3.5 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)";
font = "PuristaMedium";
sizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 0.8)";
};
class ActiveMarker
{
color[] = {0.3,0.1,0.9,1};
size = 50;
};
class Command
{
color[] = {1,1,1,1};
icon = "\A3\ui_f\data\map\mapcontrol\waypoint_ca.paa";
size = 18;
importance = 1;
coefMin = 1;
coefMax = 1;
};
class Task
{
colorCreated[] = {1,1,1,1};
colorCanceled[] = {0.7,0.7,0.7,1};
colorDone[] = {0.7,1,0.3,1};
colorFailed[] = {1,0.3,0.2,1};
color[] = {"(profilenamespace getvariable ['IGUI_TEXT_RGB_R',0])","(profilenamespace getvariable ['IGUI_TEXT_RGB_G',1])","(profilenamespace getvariable ['IGUI_TEXT_RGB_B',1])","(profilenamespace getvariable ['IGUI_TEXT_RGB_A',0.8])"};
icon = "\A3\ui_f\data\map\mapcontrol\taskIcon_CA.paa";
iconCreated = "\A3\ui_f\data\map\mapcontrol\taskIconCreated_CA.paa";
iconCanceled = "\A3\ui_f\data\map\mapcontrol\taskIconCanceled_CA.paa";
iconDone = "\A3\ui_f\data\map\mapcontrol\taskIconDone_CA.paa";
iconFailed = "\A3\ui_f\data\map\mapcontrol\taskIconFailed_CA.paa";
size = 27;
importance = 1;
coefMin = 1;
coefMax = 1;
};
class CustomMark
{
color[] = {0,0,0,1};
icon = "\A3\ui_f\data\map\mapcontrol\custommark_ca.paa";
size = 24;
importance = 1;
coefMin = 1;
coefMax = 1;
};
class Tree
{
color[] = {0.45,0.64,0.33,0.4};
icon = "\A3\ui_f\data\map\mapcontrol\bush_ca.paa";
size = 12;
importance = "0.9 * 16 * 0.05";
coefMin = 0.25;
coefMax = 4;
};
class SmallTree
{
color[] = {0.45,0.64,0.33,0.4};
icon = "\A3\ui_f\data\map\mapcontrol\bush_ca.paa";
size = 12;
importance = "0.6 * 12 * 0.05";
coefMin = 0.25;
coefMax = 4;
};
class Bush
{
color[] = {0.45,0.64,0.33,0.4};
icon = "\A3\ui_f\data\map\mapcontrol\bush_ca.paa";
size = "14/2";
importance = "0.2 * 14 * 0.05 * 0.05";
coefMin = 0.25;
coefMax = 4;
};
class Church
{
color[] = {1,1,1,1};
icon = "\A3\ui_f\data\map\mapcontrol\church_CA.paa";
size = 24;
importance = 1;
coefMin = 0.85;
coefMax = 1;
};
class Chapel
{
color[] = {0,0,0,1};
icon = "\A3\ui_f\data\map\mapcontrol\Chapel_CA.paa";
size = 24;
importance = 1;
coefMin = 0.85;
coefMax = 1;
};
class Cross
{
color[] = {0,0,0,1};
icon = "\A3\ui_f\data\map\mapcontrol\Cross_CA.paa";
size = 24;
importance = 1;
coefMin = 0.85;
coefMax = 1;
};
class Rock
{
color[] = {0.1,0.1,0.1,0.8};
icon = "\A3\ui_f\data\map\mapcontrol\rock_ca.paa";
size = 12;
importance = "0.5 * 12 * 0.05";
coefMin = 0.25;
coefMax = 4;
};
class Bunker
{
color[] = {0,0,0,1};
icon = "\A3\ui_f\data\map\mapcontrol\bunker_ca.paa";
size = 14;
importance = "1.5 * 14 * 0.05";
coefMin = 0.25;
coefMax = 4;
};
class Fortress
{
color[] = {0,0,0,1};
icon = "\A3\ui_f\data\map\mapcontrol\bunker_ca.paa";
size = 16;
importance = "2 * 16 * 0.05";
coefMin = 0.25;
coefMax = 4;
};
class Fountain
{
color[] = {0,0,0,1};
icon = "\A3\ui_f\data\map\mapcontrol\fountain_ca.paa";
size = 11;
importance = "1 * 12 * 0.05";
coefMin = 0.25;
coefMax = 4;
};
class ViewTower
{
color[] = {0,0,0,1};
icon = "\A3\ui_f\data\map\mapcontrol\viewtower_ca.paa";
size = 16;
importance = "2.5 * 16 * 0.05";
coefMin = 0.5;
coefMax = 4;
};
class Lighthouse
{
color[] = {1,1,1,1};
icon = "\A3\ui_f\data\map\mapcontrol\lighthouse_CA.paa";
size = 24;
importance = 1;
coefMin = 0.85;
coefMax = 1;
};
class Quay
{
color[] = {1,1,1,1};
icon = "\A3\ui_f\data\map\mapcontrol\quay_CA.paa";
size = 24;
importance = 1;
coefMin = 0.85;
coefMax = 1;
};
class Fuelstation
{
color[] = {1,1,1,1};
icon = "\A3\ui_f\data\map\mapcontrol\fuelstation_CA.paa";
size = 24;
importance = 1;
coefMin = 0.85;
coefMax = 1;
};
class Hospital
{
color[] = {1,1,1,1};
icon = "\A3\ui_f\data\map\mapcontrol\hospital_CA.paa";
size = 24;
importance = 1;
coefMin = 0.85;
coefMax = 1;
};
class BusStop
{
color[] = {1,1,1,1};
icon = "\A3\ui_f\data\map\mapcontrol\busstop_CA.paa";
size = 24;
importance = 1;
coefMin = 0.85;
coefMax = 1;
};
class Transmitter
{
color[] = {1,1,1,1};
icon = "\A3\ui_f\data\map\mapcontrol\transmitter_CA.paa";
size = 24;
importance = 1;
coefMin = 0.85;
coefMax = 1;
};
class Stack
{
color[] = {0,0,0,1};
icon = "\A3\ui_f\data\map\mapcontrol\stack_ca.paa";
size = 20;
importance = "2 * 16 * 0.05";
coefMin = 0.9;
coefMax = 4;
};
class Ruin
{
color[] = {0,0,0,1};
icon = "\A3\ui_f\data\map\mapcontrol\ruin_ca.paa";
size = 16;
importance = "1.2 * 16 * 0.05";
coefMin = 1;
coefMax = 4;
};
class Tourism
{
color[] = {0,0,0,1};
icon = "\A3\ui_f\data\map\mapcontrol\tourism_ca.paa";
size = 16;
importance = "1 * 16 * 0.05";
coefMin = 0.7;
coefMax = 4;
};
class Watertower
{
color[] = {1,1,1,1};
icon = "\A3\ui_f\data\map\mapcontrol\watertower_CA.paa";
size = 24;
importance = 1;
coefMin = 0.85;
coefMax = 1;
};
class Waypoint
{
color[] = {0,0,0,1};
size = 24;
importance = 1;
coefMin = 1;
coefMax = 1;
icon = "\A3\ui_f\data\map\mapcontrol\waypoint_ca.paa";
};
class WaypointCompleted
{
color[] = {0,0,0,1};
size = 24;
importance = 1;
coefMin = 1;
coefMax = 1;
icon = "\A3\ui_f\data\map\mapcontrol\waypointCompleted_ca.paa";
};
moveOnEdges = 0;//1;
x = "SafeZoneXAbs";
y = "SafeZoneY + 1.5 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)";
w = "SafeZoneWAbs";
h = "SafeZoneH - 1.5 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)";
shadow = 0;
ptsPerSquareSea = 5;
ptsPerSquareTxt = 3;
ptsPerSquareCLn = 10;
ptsPerSquareExp = 10;
ptsPerSquareCost = 10;
ptsPerSquareFor = 9;
ptsPerSquareForEdge = 9;
ptsPerSquareRoad = 6;
ptsPerSquareObj = 9;
showCountourInterval = 0;
scaleMin = 0.001;
scaleMax = 1;
scaleDefault = 0.16;
maxSatelliteAlpha = 0.85;
alphaFadeStartScale = 0.35;
alphaFadeEndScale = 0.4;
fontLabel = "PuristaMedium";
sizeExLabel = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 0.8)";
fontGrid = "TahomaB";
sizeExGrid = 0.02;
fontUnits = "TahomaB";
sizeExUnits = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 0.8)";
fontNames = "PuristaMedium";
sizeExNames = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 0.8) * 2";
fontInfo = "PuristaMedium";
sizeExInfo = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 0.8)";
fontLevel = "TahomaB";
sizeExLevel = 0.02;
text = "#(argb,8,8,3)color(1,1,1,1)";
//text = "\a3\ui_f\data\map_background2_co.paa";
class power
{
icon = "\A3\ui_f\data\map\mapcontrol\power_CA.paa";
size = 24;
importance = 1;
coefMin = 0.85;
coefMax = 1;
color[] = {1,1,1,1};
};
class powersolar
{
icon = "\A3\ui_f\data\map\mapcontrol\powersolar_CA.paa";
size = 24;
importance = 1;
coefMin = 0.85;
coefMax = 1;
color[] = {1,1,1,1};
};
class powerwave
{
icon = "\A3\ui_f\data\map\mapcontrol\powerwave_CA.paa";
size = 24;
importance = 1;
coefMin = 0.85;
coefMax = 1;
color[] = {1,1,1,1};
};
class powerwind
{
icon = "\A3\ui_f\data\map\mapcontrol\powerwind_CA.paa";
size = 24;
importance = 1;
coefMin = 0.85;
coefMax = 1;
color[] = {1,1,1,1};
};
class shipwreck
{
icon = "\A3\ui_f\data\map\mapcontrol\shipwreck_CA.paa";
size = 24;
importance = 1;
coefMin = 0.85;
coefMax = 1;
color[] = {1,1,1,1};
};
class LineMarker
{
lineDistanceMin = 3e-005;
lineLengthMin = 5;
lineWidthThick = 0.014;
lineWidthThin = 0.008;
textureComboBoxColor = "#(argb,8,8,3)color(1,1,1,1)";
};
};
class Life_RscCombo {
style = 16;
type = 4;
x = 0;
y = 0;
w = 0.12;
h = 0.035;
shadow = 0;
colorSelect[] = {0, 0, 0, 1};
soundExpand[] = {"",0.1,1};
colorText[] = {0.95, 0.95, 0.95, 1};
soundCollapse[] = {"",0.1,1};
maxHistoryDelay = 1;
colorBackground[] = {0.4,0.4,0.4,0.4};
colorSelectBackground[] = {1, 1, 1, 0.7};
colow_Rscrollbar[] = {1, 0, 0, 1};
soundSelect[] = {
"", 0.000000, 1
};
arrowFull = "\A3\ui_f\data\gui\cfg\scrollbar\arrowFull_ca.paa";
arrowEmpty = "\A3\ui_f\data\gui\cfg\scrollbar\arrowEmpty_ca.paa";
wholeHeight = 0.45;
color[] = {1, 1, 1, 1};
colorActive[] = {1, 0, 0, 1};
colorDisabled[] = {1, 1, 1, 0.25};
font = "PuristaMedium";
sizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)";
class ComboScrollBar : Life_RscScrollBar {};
};
class Life_RscToolbox {
colorText[] = {0.95, 0.95, 0.95, 1};
color[] = {0.95, 0.95, 0.95, 1};
colorTextSelect[] = {0.95, 0.95, 0.95, 1};
colorSelect[] = {0.95, 0.95, 0.95, 1};
colorTextDisable[] = {0.4, 0.4, 0.4, 1};
colorDisable[] = {0.4, 0.4, 0.4, 1};
colorSelectedBg[] = {"(profilenamespace getvariable ['GUI_BCG_RGB_R',0.3843])", "(profilenamespace getvariable ['GUI_BCG_RGB_G',0.7019])", "(profilenamespace getvariable ['GUI_BCG_RGB_B',0.8862])", 0.5};
font = "PuristaMedium";
sizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 0.8)";
};
class Life_RscButtonInvisible : Life_RscButtonMenu {
animTextureNormal = "#(argb,8,8,3)color(1,1,1,0)";
animTextureDisabled = "#(argb,8,8,3)color(1,1,1,0)";
animTextureOver = "#(argb,8,8,3)color(1,1,1,0)";
animTextureFocused = "#(argb,8,8,3)color(1,1,1,0)";
animTexturePressed = "#(argb,8,8,3)color(1,1,1,0)";
animTextureDefault = "#(argb,8,8,3)color(1,1,1,0)";
colorBackground[] = {0, 0, 0, 0};
colorBackground2[] = {1, 1, 1, 0};
color[] = {1, 1, 1, 0};
color2[] = {1, 1, 1, 0};
colorText[] = {1, 1, 1, 0};
colorDisabled[] = {1, 1, 1, 0};
};
class Life_RscListBox2
{
style = 16;
idc = -1;
type = 5;
w = 0.275;
h = 0.04;
font = "PuristaMedium";
colorSelect[] = {1, 1, 1, 1};
colorText[] = {0, 0, 0, 1};
colorBackground[] = {0.28,0.28,0.28,0.28};
colorSelect2[] = {1, 1, 1, 1};
colorSelectBackground[] = {0.95, 0.95, 0.95, 0.5};
colorSelectBackground2[] = {1, 1, 1, 0.5};
colorScrollbar[] = {0.2, 0.2, 0.2, 1};
colorPicture[] = {1,1,1,1};
colorPictureSelected[] = {1,1,1,1};
colorPictureDisabled[] = {1,1,1,1};
arrowFull = "\A3\ui_f\data\gui\cfg\scrollbar\arrowFull_ca.paa";
arrowEmpty = "\A3\ui_f\data\gui\cfg\scrollbar\arrowEmpty_ca.paa";
wholeHeight = 0.45;
rowHeight = 0.04;
color[] = {0.7, 0.7, 0.7, 1};
colorActive[] = {0,0,0,1};
colorDisabled[] = {0,0,0,0.3};
sizeEx = 0.023;
soundSelect[] = {"",0.1,1};
soundExpand[] = {"",0.1,1};
soundCollapse[] = {"",0.1,1};
maxHistoryDelay = 1;
autoScrollSpeed = -1;
autoScrollDelay = 5;
autoScrollRewind = 0;
tooltipColorText[] = {1,1,1,1};
tooltipColorBox[] = {1,1,1,1};
tooltipColorShade[] = {0,0,0,0.65};
class ListScrollBar: Life_RscScrollBar
{
color[] = {1,1,1,1};
autoScrollEnabled = 1;
};
};
class Life_PictureButtonMenu : Life_RscButtonMenu
{
colorBackground[] = {1,1,1,0.08};
colorBackgroundFocused[] = {1,1,1,0.12};
colorBackground2[] = {0.75,0.75,0.75,0.2};
color[] = {1,1,1,1};
colorFocused[] = {0,0,0,1};
color2[] = {0,0,0,1};
colorText[] = {1,1,1,1};
colorDisabled[] = {0,0,0,0.4};
};
| [
"michagend@googlemail.com"
] | michagend@googlemail.com |
1e72826afa8ad0efd54342c17160167965ecefaa | bfd6dbc8763ee1a5c6e49df2d665aaccc26e8783 | /date.cpp | 6dc32bced30a573da031cdbf7ebb34b1692da742 | [] | no_license | paulom174/FEUP-PROG1819 | faacdaf056eecf68256dde829e6c65abf565c4aa | 4196500b30df0ee5f2415208a5b7b93ffb349168 | refs/heads/master | 2020-06-17T10:14:50.140565 | 2019-07-08T22:33:26 | 2019-07-08T22:33:26 | 195,893,983 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,693 | cpp | #include "date.h"
Date::Date(){
}
Date::Date(string date){
size_t sz;
int pos = 0, i = 0;
int slash = date.find("/", pos);
this->year = stoi(date.substr(pos, slash-pos), &sz, 10);
pos = slash +1;
slash = date.find("/", pos);
this->month = stoi(date.substr(pos, slash-pos), &sz, 10);
pos = slash +1;
slash = date.find("/", pos);
this->day = stoi(date.substr(pos, slash-pos), &sz, 10);
}
Date::Date(unsigned short day, unsigned short month, unsigned year){
this->day = day;
this->month = month;
this->year = year;
}
/*********************************
* GET Methods
********************************/
unsigned short Date::getDay() const{
return day;
}
unsigned short Date::getMonth() const{
return month;
}
unsigned Date::getYear() const{
return year;
}
/*********************************
* SET Methods
********************************/
void Date::setDay(unsigned short day){
this->day = day;
}
void Date::setMonth(unsigned short month){
this->month = month;
}
void Date::setYear(unsigned year){
this->year = year;
}
void Date::setDate(string date) {
size_t sz;
int pos = 0, i = 0;
int slash = date.find("/", pos);
this->year = stoi(date.substr(pos, slash-pos), &sz, 10);
pos = slash +1;
slash = date.find("/", pos);
this->month = stoi(date.substr(pos, slash-pos), &sz, 10);
pos = slash +1;
slash = date.find("/", pos);
this->day = stoi(date.substr(pos, slash-pos), &sz, 10);
}
/*********************************
* Show Date
********************************/
// disply a Date in a nice format
ostream& operator<<(ostream& out, const Date & date){
out << date.year << "/" << date.month << "/" << date.day;
return out;
}
bool operator>(const Date date1, const Date date2) {
unsigned d1 = date1.year*10000 + date1.month*100 + date1.day;
unsigned d2 = date2.year*10000 + date2.month*100 + date2.day;
if(d1>d2) return true;
else return false;
}
bool operator<(const Date date1, const Date date2) {
unsigned d1 = date1.year*10000 + date1.month*100 + date1.day;
unsigned d2 = date2.year*10000 + date2.month*100 + date2.day;
if(d1>d2) return false;
else return true;
}
bool operator>=(const Date date1, const Date date2) {
unsigned d1 = date1.year*10000 + date1.month*100 + date1.day;
unsigned d2 = date2.year*10000 + date2.month*100 + date2.day;
if(d1>=d2) return true;
else return false;
}
bool operator<=(const Date date1, const Date date2) {
unsigned d1 = date1.year*10000 + date1.month*100 + date1.day;
unsigned d2 = date2.year*10000 + date2.month*100 + date2.day;
if(d1>=d2) return false;
else return true;
}
| [
"paulomoutinho174@gmail.com"
] | paulomoutinho174@gmail.com |
3404de66c878ee620ae410ba486fca0a9edd9efe | 49711b65741883b52e75b374fd5c31893ecfb226 | /ManagedBridge/dllmain.cpp | 4f32b979c9e703be106c94f4ebfe8ab87a411aec | [
"MIT"
] | permissive | iCodeIN/LauncherBridge | e0ba0dcaff0483633a09ab71fc64f9c8df3f222a | 4192615b05848a1e21597afce28340da341f7527 | refs/heads/master | 2022-12-09T01:27:20.098083 | 2020-08-29T22:57:38 | 2020-08-29T22:57:38 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,839 | cpp | #define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <mscoree.h>
#include <metahost.h>
#include <string>
#include <Shlwapi.h>
#include <synchapi.h>
#pragma comment(lib, "shlwapi.lib")
#pragma comment(lib, "mscoree.lib")
std::wstring GetExecutableDir(HMODULE lpParam)
{
WCHAR buf[MAX_PATH];
GetModuleFileName(lpParam, buf, MAX_PATH);
PathRemoveFileSpec(buf);
return buf;
}
DWORD WINAPI LocalThread(LPVOID lpParam)
{
ICLRMetaHost* pMetaHost = NULL;
CLRCreateInstance(CLSID_CLRMetaHost, IID_ICLRMetaHost, (LPVOID*)&pMetaHost);
ICLRRuntimeInfo* pRuntimeInfo = NULL;
pMetaHost->GetRuntime(L"v4.0.30319", IID_ICLRRuntimeInfo, (LPVOID*)&pRuntimeInfo);
ICLRRuntimeHost* pClrRuntimeHost = NULL;
pRuntimeInfo->GetInterface(CLSID_CLRRuntimeHost, IID_ICLRRuntimeHost, (LPVOID*)&pClrRuntimeHost);
pClrRuntimeHost->Start();
DWORD dwRet = 0;
std::wstring path = GetExecutableDir((HMODULE)lpParam);
//File name of the .NET program to execute
path += L"\\ManagedProgram.dll";
//ManagedProgram <- Your .NET namespace for entrypoint | Program <- class name for entry point | AltMain <- entry point | Parameter <- the argument you pass to the .NET program
auto res = pClrRuntimeHost->ExecuteInDefaultAppDomain(path.c_str(), L"ManagedProgram.Program", L"AltMain", L"Parameter", &dwRet);
if (res != 0)
MessageBox(NULL, std::to_wstring(res).c_str(), L"Error code", 0);
pClrRuntimeHost->Release();
pRuntimeInfo->Release();
pMetaHost->Release();
exit(0);
//actually useless.
return 0;
}
BOOL APIENTRY DllMain( HMODULE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved )
{
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
CreateThread(nullptr, 0, LocalThread, hModule, NULL, NULL);
break;
default:
break;
}
return TRUE;
}
| [
"info@adeltax.com"
] | info@adeltax.com |
8b22c5f27f9a167ed686702b1403ddcca83769dc | 7a81be09ee6f278b7061eeb83f408d822a617dde | /cpp/performance/simd/vectorMultU8/vectorMultU8.cpp | 5b3f85bf45eebca2628e357961052ca8b8d788c5 | [] | no_license | amithjkamath/codesamples | dba2ef77abc3b2604b8202ed67ef516bbc971a76 | d3147d743ba9431d42423d0fa78b0e1048922458 | refs/heads/master | 2022-03-23T23:25:35.171973 | 2022-02-28T21:22:23 | 2022-02-28T21:22:23 | 67,352,584 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,752 | cpp | #include <iostream>
#include <iomanip>
#include <ctime>
#include <cstdlib>
#include <smmintrin.h> // Contain the SSE compiler intrinsics
#if defined __linux__
#include <malloc.h>
#endif
typedef int T;
void* malloc_simd(const size_t size)
{
//#if defined WIN32 // WIN32
// return _aligned_malloc(size, 16);
#if defined __linux__ // Linux
return memalign(16, size);
#elif defined __MACH__ // Mac OS X
return malloc(size);
#else // other (use valloc for page-aligned memory)
return valloc(size);
#endif
}
void free_simd(void* dataPtr)
{
//#if defined WIN32 // WIN32
// _aligned_free(dataPtr);
#if defined __linux__ // Linux
free(dataPtr);
#elif defined __MACH__ // Mac OS X
free(dataPtr);
#else // other
free(size);
#endif
}
void myssefunction(
T* pArray1, // [in] first source array
T* pArray2, // [in] second source array
T* pResult, // [out] result array
int nSize, // [in] size of all arrays
int width) // [in] width of datatype.
{
int nLoop = 0;
if(nSize%width == 0)
{
nLoop = nSize/width;
}
else
{
nLoop = nSize/width + 1;
}
__m128i m1, m2, m3;
__m128i* pSrc1 = (__m128i*) pArray1;
__m128i* pSrc2 = (__m128i*) pArray2;
__m128i* pDest = (__m128i*) pResult;
for ( int i = 0; i < nLoop; i++ )
{
m1 = _mm_mullo_epi32(*pSrc1, *pSrc1); // m1 = *pSrc1 * *pSrc1
m2 = _mm_mullo_epi32(*pSrc2, *pSrc2); // m2 = *pSrc2 * *pSrc2
//m3 = _mm_add_epi32(m1, m2); // m3 = m1 + m2
*pDest = m1;
pSrc1++;
pSrc2++;
pDest++;
}
}
int main(int argc, char *argv[])
{
int arraySize = atoi(argv[1]);
if((arraySize < 0) || (arraySize > 9999))
{
std::cout << "Error: invalid array size, try again" << std::endl;
return 0;
}
std::cout << sizeof(float) << std::endl;
T* m_fArray1 = (T*) malloc_simd(arraySize * sizeof(T));
T* m_fArray2 = (T*) malloc_simd(arraySize * sizeof(T));
T* m_fArray3 = (T*) malloc_simd(arraySize * sizeof(T));
for (int i = 0; i < arraySize; ++i)
{
m_fArray1[i] = ((T)i);
std::cout << "array1:[" << i << "]" << " = " << m_fArray1[i] << std::endl;
m_fArray2[i] = ((T)(i));
std::cout << "array2:[" << i << "]" << " = " << m_fArray2[i] << std::endl;
}
myssefunction(m_fArray1 , m_fArray2 , m_fArray3, arraySize, 4);
for (int j = 0; j < arraySize; ++j)
{
std::cout << "array3:[" << j << "]" << " = " << m_fArray3[j] << std::endl;
}
free_simd(m_fArray1);
free_simd(m_fArray2);
free_simd(m_fArray3);
return 0;
}
| [
"amith.kamath@mathworks.com"
] | amith.kamath@mathworks.com |
b1c7cfee9862bdc9a1c6a607411c80d7ec83b73f | 2ff386c8b9c30f791aac2f914f4664c6c0cd3b3c | /internship/snda/server/stateserver/trunk/src/msganalyser/sessionAnalyser.h | 13a0a8fbd708afdfd6bcc0a0f24369f613555439 | [] | no_license | SPriyal/work | 87fa894e4b42a4ab56297338bb0afb3585c95e4e | 72110b6eec5be596c26bcac13a99141f59796e34 | refs/heads/master | 2020-04-02T07:21:59.315520 | 2017-02-15T06:52:25 | 2017-02-15T06:52:25 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,081 | h | #ifndef _SESSION_ANALYSER_H_
#define _SESSION_ANALYSER_H_
#include <string>
#include <libconfig/libconfig.h++>
#include "../msg/stateServerMsg.h"
#include <sys/time.h>
#include <assert.h>
#include "msgAnalyserUtil.h"
#include "define.h"
#include "../list_map.h"
#include "memcachedUtil.h"
#include "mongoUtil.h"
#include <ext/hash_fun.h>
using namespace std;
namespace ac_lib
{
class Message;
}
namespace StateServer{
class SesssionAnalyser
{
public:
static void Open();
static void SessionClean(time_t curtime);
static int updateSessionMap(string & sessionId, string & sessionData);
static void changeDbName(string & curDbName);
static int getSession( StateServerRequest* reqMessage ,StateServerResponse* respMessage );
static int setSession( StateServerRequest* reqMessage ,StateServerResponse* respMessage );
static int OnKeepAlive( StateServerRequest* reqMessage ,StateServerResponse* respMessage );
private:
static ListMap<SessionValue>sessionMap;
static pthread_mutex_t mutex;
static string m_curDbName;
static string m_lastDbName;
};
}
#endif
| [
"fatshaw@gmail.com"
] | fatshaw@gmail.com |
2e5cb94fa07d6ea06407d5b4746775f1d8d28436 | 902153ad9e8c28c07c005c5c49aebcc9a56de707 | /src/Virtualization/VirtualMachines/Containers/DockerEngine.cc | bbcfe42fc0c6301d4ad18339ddb70e649e5a9085 | [] | no_license | craiggunther/DockerSim | 4abef9b110cece7713652f852cb01c8157a1e6bc | d36be29ccff2008759cc2285a396b813948d0437 | refs/heads/master | 2020-03-13T01:56:10.827161 | 2017-11-03T20:15:57 | 2017-11-03T20:15:57 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 12,334 | cc | //
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see http://www.gnu.org/licenses/.
//
#include <DockerEngine.h>
Define_Module(DockerEngine);
DockerEngine::DockerEngine()
{
// TODO Auto-generated constructor stub
icancloud_Base::initialize();
std::ostringstream osStream;
migrateActive = false;
pendingMessages.clear();
pendingCPUMsg = 0;
pendingNetMsg = 0;
pendingMemoryMsg = 0;
pendingIOMsg = 0;
uId = -1;
pId = -1;
// Init state to idle!
fromVmMsgController= new cGateManager(this);
toVmMsgController= new cGateManager(this);
fromContainers = new cGateManager(this);
toContainers = new cGateManager(this);
}
void DockerEngine::initialize(){
icancloud_Base::initialize();
std::ostringstream osStream;
migrateActive = false;
pendingMessages.clear();
pendingCPUMsg = 0;
pendingNetMsg = 0;
pendingMemoryMsg = 0;
pendingIOMsg = 0;
uId = -1;
pId = -1;
msgCount=0;
// Init state to idle!
fromVmMsgController= new cGateManager(this);
toVmMsgController= new cGateManager(this);
fromContainers = new cGateManager(this);
toContainers = new cGateManager(this);
}
DockerEngine::~DockerEngine()
{
// TODO Auto-generated destructor stub
}
void DockerEngine::processSelfMessage (cMessage *msg){
delete (msg);
std::ostringstream msgLine;
msgLine << "Unknown self message [" << msg->getName() << "]";
throw cRuntimeError(msgLine.str().c_str());
}
void DockerEngine::processRequestMessage (icancloud_Message *msg){
icancloud_App_NET_Message *sm_net;
sm_net = dynamic_cast<icancloud_App_NET_Message *>(msg);
int operation = msg->getOperation();
// Set the id of the message (the vm id)
msg->setPid(pId);
msg->setUid(uId);
// Set as application id the arrival gate id (unique per job).
if ((sm_net != NULL) && (sm_net->getCommId() != -1))
insertCommId (uId, pId, msg->getCommId(), msg->getId());
// If msg arrive from VmMsgController
if (msg->arrivedOn("VmMsgController")){
sendRequestMessage(msg, toContainers->getGate(msg->getArrivalGate()->getIndex()));
}
else if (msg->arrivedOn("fromContainers")){
updateCounters(msg,1);
msg->setCommId(msg->getArrivalGate()->getIndex());
if (sm_net != NULL){
// If the message is a net message and the destination user is null
if (sm_net->getVirtual_user() == -1){
// Filter the name of the user
sm_net->setVirtual_user(msg->getUid());
}
sm_net->setVirtual_destinationIP(sm_net->getDestinationIP());
sm_net->setVirtual_destinationPort(sm_net->getDestinationPort());
sm_net->setVirtual_localIP(sm_net->getLocalIP());
sm_net->setVirtual_localPort(sm_net->getLocalPort());
}
sendRequestMessage(msg, toVmMsgController->getGate(msg->getCommId()));
}
}
void DockerEngine::processResponseMessage (icancloud_Message *sm){
// If msg arrive from OS
updateCounters(sm,-1);
++msgCount;
icancloud_App_NET_Message *sm_net;
sm_net = dynamic_cast<icancloud_App_NET_Message *>(sm);
if (sm_net != NULL){
updateCommId(sm_net);
}
sendResponseMessage(sm);
}
cGate* DockerEngine::getOutGate (cMessage *msg){
// Define ..
cGate* return_gate;
int i;
bool found;
// Initialize ..
i = 0;
found = false;
// If msg arrive from OS
if (msg->arrivedOn("fromVmMsgController")){
while ((i < gateCount()) && (!found)){
if (msg->arrivedOn ("fromVmMsgController", i)){
return_gate = (gate("toVmMsgController", i));
found = true;
}
i++;
}
}
else if (msg->arrivedOn("fromContainers")){
while ((i < gateCount()) && (!found)){
if (msg->arrivedOn ("fromContainers", i)){
return_gate = (gate("toContainers", i));
found = true;
}
i++;
}
}
return return_gate;
}
void DockerEngine::notifyVMPreparedToMigrate(){
sendResponseMessage(migration_msg);
}
void DockerEngine::finishMigration (){
migrateActive = false;
flushPendingMessages();
}
void DockerEngine::pushMessage(icancloud_Message* sm){
pendingMessages.insert(pendingMessages.end(),sm);
}
icancloud_Message* DockerEngine::popMessage(){
vector<icancloud_Message*>::iterator msgIt;
msgIt = pendingMessages.begin();
pendingMessages.erase(msgIt);
return (*msgIt);
}
void DockerEngine::sendPendingMessage (icancloud_Message* msg){
int smIndex;
// The message is a Response message
if (msg->getIsResponse()) {
sendResponseMessage(msg);
}
// The message is a request message
else {
smIndex = msg->getArrivalGate()->getIndex();
if (msg->arrivedOn("fromVmMsgController")){
sendRequestMessage(msg, toContainers->getGate(smIndex));
}
else if (msg->arrivedOn("fromContainers")){
updateCounters(msg,1);
sendRequestMessage(msg, toVmMsgController->getGate(smIndex));
}
}
}
void DockerEngine::flushPendingMessages(){
// Define ..
vector<icancloud_Message*>::iterator msgIt;
// Extract all the messages and send to the destinations
while (!pendingMessages.empty()){
msgIt = pendingMessages.begin();
sendPendingMessage((*msgIt));
pendingMessages.erase(pendingMessages.begin());
}
}
int DockerEngine::pendingMessagesSize(){
return pendingMessages.size();
}
void DockerEngine::updateCounters (icancloud_Message* msg, int quantity){
icancloud_App_CPU_Message* cpuMsg;
icancloud_App_IO_Message* ioMsg;
icancloud_App_MEM_Message* memMsg;
icancloud_App_NET_Message* netMsg;
cpuMsg = dynamic_cast<icancloud_App_CPU_Message*>(msg);
ioMsg = dynamic_cast<icancloud_App_IO_Message*>(msg);
memMsg = dynamic_cast<icancloud_App_MEM_Message*>(msg);
netMsg = dynamic_cast<icancloud_App_NET_Message*>(msg);
if (cpuMsg != NULL){
pendingCPUMsg += quantity;
}
else if (ioMsg != NULL){
pendingIOMsg += quantity;
}
else if (memMsg != NULL){
pendingMemoryMsg += quantity;
}
else if (netMsg != NULL){
pendingNetMsg += quantity;
}
}
void DockerEngine::linkNewContainer(cModule* jobAppModule, cGate* scToContainer, cGate* scFromContainer){
// Connections to Container
cout<<"Connections to Container"<<endl;
int idxToContainer = toContainers->newGate("toContainers");
toContainers->connectOut(jobAppModule->gate("fromOS"), idxToContainer); //fromOS is for container
// cout<<"idxToContainer"<<idxToContainer<<endl;
int idxFromContainers = fromContainers->newGate("fromContainers");
fromContainers->connectIn(jobAppModule->gate("toOS"), idxFromContainers);
// cout<<"idxFromContainers"<<idxFromContainers<<endl;
// Connections to VmMsgController
int idxToVmMsg = toVmMsgController->newGate("toVmMsgController");
toVmMsgController->connectOut(scFromContainer, idxToVmMsg);
int idxFromVmMsg = fromVmMsgController->newGate("fromVmMsgController");
fromVmMsgController->connectIn(scToContainer, idxFromVmMsg);
}
int DockerEngine::unlinkContainer(cModule* jobAppModule){
cout<<"DockerEngine::unlinkContainer"<<endl;
int gateIdx = jobAppModule->gate("fromOS")->getPreviousGate()->getId();
// int gateIdx = jobAppModule->gate("fromDockerEngine")->getPreviousGate()->getId();
int position = toContainers->searchGate(gateIdx);
// cout<<"position-->"<<position<<endl;
toVmMsgController->freeGate(position);
fromVmMsgController->freeGate(position);
toContainers->freeGate(position);
fromContainers->freeGate(position);
jobAppModule->gate("toOS")->disconnect();
return position;
}
void DockerEngine::setId(int userId, int vmId){
uId = userId;
pId = vmId;
}
void DockerEngine::insertCommId(int uId, int pId, int commId, int msgId){
// Define ..
bool found;
commIdVector* comm;
commIdVectorInternals* internals;
// Initialize ..
found = false;
// Search at structure if there is an entry for the same VM
for (int i = 0; (i < (int)commVector.size()) && (!found); i++){
// The VM exists
if ( ((*(commVector.begin() + i))->uId == uId) && ((*(commVector.begin() + i))->pId == pId) ){
// Create the new entry
internals = new commIdVectorInternals();
internals -> msgId = msgId;
internals -> commId = commId;
// Add the new entry to the structure
(*(commVector.begin() + i))->internals.push_back(internals);
found = true; // break the loop
}
}
// There is no entry for the vector..-
if (!found){
// Create the general entry
comm = new commIdVector();
comm->uId = uId;
comm->pId = pId;
comm->internals.clear();
// Create the concrete entry for the message
internals = new commIdVectorInternals();
internals -> msgId = msgId;
internals -> commId = commId;
comm->internals.push_back(internals);
commVector.push_back(comm);
}
}
void DockerEngine::updateCommId (icancloud_App_NET_Message* sm){
// Define ..
bool found;
commIdVector* comm;
commIdVectorInternals* internals;
// Initialize ..
found = false;
for (int i = 0; i < (int)commVector.size(); i++){
comm = (*(commVector.begin() + i));
for (int j = 0; (j < (int)comm->internals.size()) && (!found); j++){
internals = (*(comm->internals.begin() + j));
}
}
for (int i = 0; (i< (int)commVector.size()) && (!found); i++){
comm = (*(commVector.begin() + i));
if ( ( sm->getUid() == comm->uId ) && ( sm->getPid() == comm->pId )
){
for (int j = 0; (j < (int)comm->internals.size()) && (!found); j++){
internals = (*(comm->internals.begin() + j));
if ( internals->msgId == sm->getId() ){
sm->setCommId(internals->commId);
comm->internals.erase(comm->internals.begin() + j);
found = true;
}
}
if ((found) && ((int)comm->internals.size() == 0)){
commVector.erase (commVector.begin() + i);
}
}
}
}
void DockerEngine::finish()
{
// cout<<"DockerEngine::finish--->msgCount--->"<<msgCount <<endl;
}
bool DockerEngine::migrationPrepared()
{
return ( ( pendingCPUMsg == 0 ) &&
( pendingIOMsg == 0 ) &&
( pendingNetMsg == 0 ) &&
( pendingMemoryMsg == 0 )
);
}
| [
"nikdel@gmail.com"
] | nikdel@gmail.com |
926be4619c85d8b0237382352796932c441e4b03 | 5bc18419f8fe8c1adcdc86194d26cf1c8d5a0c09 | /assignment6/pqueue/pqueue/pqvector.cpp | cc545b1f29a7ea766181fe4fcc244189b2189b87 | [] | no_license | lost-corgi/cs106b | cb72d69b83ab6c293ede25627ca4cbcdbec15074 | 9cb7e7448a63ee6966071f6214537639a09f1e83 | refs/heads/master | 2021-06-04T19:28:49.339321 | 2016-07-30T19:43:57 | 2016-07-30T19:43:57 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,906 | cpp | #include "pqueue.h"
#include "genlib.h"
#include <iostream>
/* Implementation notes: PQueue class
* ----------------------------------
* The private section for the pqvector looks like this:
*
* Vector<int> entries;
*/
PQueue::PQueue()
{
}
PQueue::~PQueue()
{
}
bool PQueue::isEmpty()
{
return (entries.isEmpty());
}
int PQueue::size()
{
return (entries.size());
}
/* Implementation notes: enqueue
* -----------------------------
* Since we're keeping the vector in no particular order, we just append this
* new element to the end. It's the easiest/fastest thing to do.
*/
void PQueue::enqueue(int newValue)
{
entries.add(newValue);
}
/* Implementation notes: dequeueMax
* --------------------------------
* Since we're keeping the vector in no particular order, we have to search to
* find the largest element. Once found, we remove it from the vector and
* return that value.
*/
int PQueue::dequeueMax()
{
if (isEmpty())
Error("Tried to dequeue max from an empty pqueue!");
int maxIndex = 0; // assume first element is largest until proven otherwise
int maxValue = entries[0];
for (int i = 1; i < entries.size(); i++) {
if (entries[i] > maxValue) {
maxValue = entries[i];
maxIndex = i;
}
}
entries.removeAt(maxIndex); // remove entry from vector
return maxValue;
}
int PQueue::bytesUsed()
{
return sizeof(*this) + entries.bytesUsed();
}
string PQueue::implementationName()
{
return "unsorted vector";
}
void PQueue::printDebuggingInfo()
{
cout << "------------------ START DEBUG INFO ------------------" << endl;
cout << "Pqueue contains " << entries.size() << " entries" << endl;
for (int i = 0; i < entries.size(); i++)
cout << entries[i] << " ";
cout << endl;
cout << "------------------ END DEBUG INFO ------------------" << endl;
}
| [
"yxu@willamette.edu"
] | yxu@willamette.edu |
e6b36627bc57cb9c0dca67f6f58af0fdc82b3add | 913192ed28fdd4a4dd84d9858882769eaaf7ae31 | /C++_Level_2/Programs/projectPug/Text.h | f5fb3b1dc95644c30f5a2e70ffb40eee6c9b19a9 | [] | no_license | WinstonPhillips/Code | bde1294da1b4198f8b0d542628fd1166545a8d22 | 1b935a2f2da324ecbfcb697281733bf2af9be8d1 | refs/heads/master | 2020-07-17T04:30:56.588438 | 2020-04-12T01:02:20 | 2020-04-12T01:02:20 | 205,785,042 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 315 | h | #ifndef TEXT_H
#define TEXT_H
#include <iostream>
using namespace std;
class Text // text class so that we display our own text and destroy when needed
{
private:
const char* textArray; // pointer so we can delete for cleanup
public:
Text(const char* sentText);
~Text();
void displayText();
};
#endif | [
"winphillips@rocketmail.com"
] | winphillips@rocketmail.com |
981b78217445f8b0a81d43e7b0704a26bae3e075 | 2fc7811df83a53b176ff76f3141287d5ed2ddf4c | /TAREAS/EJERCICIOS 1/5to_ejercicio/main.cpp | 97d6fd25b67ae0c01ae787a06987b1ca707fea02 | [] | no_license | Gu5tavoNcz/Ciencia_de_la_computacion_1 | b381644c7dbb616214f6653ca3e735e27873b901 | cdd8701e4d141d819cb25c7d186fe002209e0470 | refs/heads/master | 2021-01-22T20:29:29.961399 | 2017-07-06T21:58:50 | 2017-07-06T21:58:50 | 85,326,347 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,519 | cpp | #include <iostream>
#include <cstdlib>
using namespace std;
/*
Escriba un programa que retorne el número ingresado en palabras. Por ejemplo si el usuario
ingresa el número 1 el programa debe retornar “uno”, si el usuario ingresa el número 0 el
programa retorna “cero”... el programa solo permite números del 0 al 9, caso contrario debe
imprimir el mensaje “Número no permitido” y debe terminar cuando el usuario ingresa el
número -1.
*/
int main()
{
int n;
while(n!=-1)
{
cout<<"Ingrese un numero: ";
cin>>n;
switch(n)
{
case'1':
cout<<"UNO"<<endl;
break;
case'2':
cout<<"DOS"<<endl;
break;
case'3':
cout<<"TRES"<<endl;
break;
case'4':
cout<<"CUATRO"<<endl;
break;
case'5':
cout<<"CINCO"<<endl;
break;
case'6':
cout<<"SEIS"<<endl;
break;
case'7':
cout<<"SIETE"<<endl;
break;
case'8':
cout<<"OCHO"<<endl;
break;
case'9':
cout<<"NUEVE"<<endl;
break;
case'0':
cout<<"CERO"<<endl;
break;
default:
cout<<"NUMERO NO PERMITIDO"<<endl;
}
}
cout<<"PROGRAMA FINALIZADO"<<endl;
}
| [
"gustavonaupacanaza@MacBook-Pro-de-Gustavo.local"
] | gustavonaupacanaza@MacBook-Pro-de-Gustavo.local |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.