blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
3
264
content_id
stringlengths
40
40
detected_licenses
sequencelengths
0
85
license_type
stringclasses
2 values
repo_name
stringlengths
5
140
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringclasses
905 values
visit_date
timestamp[us]date
2015-08-09 11:21:18
2023-09-06 10:45:07
revision_date
timestamp[us]date
1997-09-14 05:04:47
2023-09-17 19:19:19
committer_date
timestamp[us]date
1997-09-14 05:04:47
2023-09-06 06:22:19
github_id
int64
3.89k
681M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
22 values
gha_event_created_at
timestamp[us]date
2012-06-07 00:51:45
2023-09-14 21:58:39
gha_created_at
timestamp[us]date
2008-03-27 23:40:48
2023-08-21 23:17:38
gha_language
stringclasses
141 values
src_encoding
stringclasses
34 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
3
10.4M
extension
stringclasses
115 values
content
stringlengths
3
10.4M
authors
sequencelengths
1
1
author_id
stringlengths
0
158
cafde7ffe1ac6a6510fbe7edb04d7436980a4b58
04b021cb3fd6274a80ed322775fd4bc14cf161ea
/datastructures/Dynamic Programming/edit distance/main.cpp
027191886e7e69d5eb0a819647ea12b9f6758087
[]
no_license
ashishcas/programs
f402c82fdac1aefca2db123db2391c441acf333d
fbfd90fa06b36346033b63e33619af34b9e9caf1
refs/heads/master
2020-03-17T13:53:40.676577
2019-08-20T15:54:04
2019-08-20T15:54:04
133,649,020
0
0
null
null
null
null
UTF-8
C++
false
false
805
cpp
#include <bits/stdc++.h> using namespace std; int mini(int a,int b,int c) { return min(min(a,b),c); } int edit(string s,string t) { int m = s.length(); int n = t.length(); int dp[m+1][n+1]; for(int i =0;i<=m;i++) { for(int j=0;j<=n;j++) { if(i == 0) { dp[i][j] = j; } else if( j == 0) { dp[i][j] = i; } else if (s[i-1] == t[j-1] ) { dp[i][j] = dp[i-1][j-1]; } else { dp[i][j] = 1+mini(dp[i][j-1],dp[i-1][j-1],dp[i][j-1]); } } } return dp[m][n]; } int main() { string s,t; cin>>s>>t; cout<<edit(s,t)<<endl; return 0; }
a66b00cee1a07d0db53791255a2c1590ebcb3a01
f20dc74769927484eab9f84bc152c92ea7ce0766
/src/Main.cpp
2928eb9577990c84ed12644bc11f8f34f3d0abb4
[]
no_license
AndreiRafael/HyperFire3000
db67b4c76851767e2508346a21952f7a9ce5f482
3f49c01002929ad464d698ef7eb7bd009a4a2a01
refs/heads/master
2020-08-06T03:29:04.413720
2019-11-27T16:27:34
2019-11-27T16:27:34
212,817,149
0
0
null
null
null
null
UTF-8
C++
false
false
681
cpp
#include <iostream> #include <string> #include <time.h> #include "core/GameManager.h" #include "core/InputManager.h" #include "core/AudioManager.h" #include <ExampleScene.h> int main(int argc, char* argv[]) { srand(time(NULL)); SDL_Init(SDL_INIT_EVERYTHING); auto manager = hf::GameManager::get_instance(); auto audio_manager = hf::AudioManager::get_instance(); audio_manager->init(32); int width; int height; manager->get_display_size(&width, &height); manager->init("Window", width, height); manager->set_clear_color(255, 0, 255, 255); manager->set_next_scene<ExampleScene>(); manager->begin_loop(); manager->clear_instance(); SDL_Quit(); return 0; }
577da0f627632aa20995b67900c8178a613263fc
9109cbb93e6a2981199425c809f09ba8e9d774d2
/topcoder/some-easy-problem/srm475.cpp
e011fd5a2cb45a4f1cc85106cff5dcd865f2e40f
[]
no_license
chffy/ACM-ICPC
e8ea50337931d997685c0fac1f0b424f33ab4e37
59f071b014634e923338571aaa2272c490a8a0ae
refs/heads/master
2020-05-30T05:00:10.775875
2016-03-28T14:37:08
2016-03-28T14:37:08
23,791,162
5
0
null
null
null
null
UTF-8
C++
false
false
2,269
cpp
#include <iostream> #include <cstdio> #include <cstring> #include <vector> #include <queue> #include <map> #include <algorithm> using namespace std; int num[20], cnt[20]; int sum[20], pre[20], prd[20]; class RabbitStepping { public: double getExpected(string field, int r) { int n = field.size(); int tot = 0; for (int i = 0; i < 1 << n; ++i) { if (__builtin_popcount(i) != r) continue; ++tot; for (int j = 0; j < n; ++j) if (i >> j & 1) ++sum[j]; } double ans = 0; for (int pos = 0; pos < n; ++pos) { for (int mask = 0; mask < 1 << n; ++mask) { if (__builtin_popcount(mask) != r) continue; if (!(mask >> pos & 1)) continue; for (int i = 0; i < n; ++i) if (mask >> i & 1) num[i] = 1; else num[i] = 0; memset(pre, -1, sizeof(pre)); int m = n, x = pos; while (m > 2) { int flag = 0; memset(cnt, 0, sizeof(cnt)); memset(prd, 0, sizeof(prd)); for (int i = 0; i < m; ++i) { int y; if (i == 0) y = 1; else if (i >= m - 2) y = i - 1; else if (field[i] == 'W') y = i - 1; else if (field[i] == 'B') y = i + 1; else if (field[i] == 'R') { if (pre[i] == -1) y = i - 1; else y = pre[i]; } cnt[y] += num[i]; prd[y] = i; if (i == x && !flag) { x = y; flag = 1; } } memcpy(pre, prd, sizeof(pre)); memcpy(num, cnt, sizeof(num)); for (int i = 0; i < m; ++i) if (num[i] > 1) num[i] = 0; if (num[x] == 0) break; --m; } if (num[x]) ans += 1.0 / tot; } } return ans; } };
c456473a096653e9ed73a8ce359a95f2bc65e761
3e1ac5a6f5473c93fb9d4174ced2e721a7c1ff4c
/build/iOS/Preview/include/Fuse.IActualPlacement.h
2cab6093bba0cdeb198a5ba66ccc4b7fb3ca350f
[]
no_license
dream-plus/DreamPlus_popup
49d42d313e9cf1c9bd5ffa01a42d4b7c2cf0c929
76bb86b1f2e36a513effbc4bc055efae78331746
refs/heads/master
2020-04-28T20:47:24.361319
2019-05-13T12:04:14
2019-05-13T12:04:14
175,556,703
0
1
null
null
null
null
UTF-8
C++
false
false
1,552
h
// This file was generated based on /usr/local/share/uno/Packages/Fuse.Nodes/1.9.0/Translation.uno. // WARNING: Changes might be lost if you edit this file directly. #pragma once #include <Uno.Object.h> namespace g{namespace Uno{struct Float3;}} namespace g{ namespace Fuse{ // public abstract interface IActualPlacement :54 // { uInterfaceType* IActualPlacement_typeof(); struct IActualPlacement { void(*fp_get_ActualPosition)(uObject*, ::g::Uno::Float3*); void(*fp_get_ActualSize)(uObject*, ::g::Uno::Float3*); void(*fp_add_Placed)(uObject*, uDelegate*); void(*fp_remove_Placed)(uObject*, uDelegate*); static ::g::Uno::Float3 ActualPosition(const uInterface& __this); static ::g::Uno::Float3 ActualSize(const uInterface& __this); static void add_Placed(const uInterface& __this, uDelegate* value) { __this.VTable<IActualPlacement>()->fp_add_Placed(__this, value); } static void remove_Placed(const uInterface& __this, uDelegate* value) { __this.VTable<IActualPlacement>()->fp_remove_Placed(__this, value); } }; }} // ::g::Fuse #include <Uno.Float3.h> namespace g{ namespace Fuse{ inline ::g::Uno::Float3 IActualPlacement::ActualPosition(const uInterface& __this) { ::g::Uno::Float3 __retval; return __this.VTable<IActualPlacement>()->fp_get_ActualPosition(__this, &__retval), __retval; } inline ::g::Uno::Float3 IActualPlacement::ActualSize(const uInterface& __this) { ::g::Uno::Float3 __retval; return __this.VTable<IActualPlacement>()->fp_get_ActualSize(__this, &__retval), __retval; } // } }} // ::g::Fuse
16bb523502f6c0e0acc84de717fb1b66e8c8b32f
b26a8e14cfaa1bc2e8086b99ad03ddd686ace72d
/1216 跳马问题.cpp
78eb23bf7ff572928fc05ea372f7afec67aa2281
[]
no_license
makixi/codevs
ed2013ed5a9699c3db14f8b4ad62222b139083d0
cf5893d57ea1bf19ef9e552b9091fc052e8ba214
refs/heads/master
2021-04-06T20:51:46.667991
2018-04-12T14:39:50
2018-04-12T14:39:50
125,339,266
0
0
null
null
null
null
UTF-8
C++
false
false
342
cpp
#include <cstdio> int f[301][301],n,m,sx,sy,tx,ty; int dfs(int x,int y) { if(x<1||y<1||x>n||y>m)return 0; if(f[x][y])return f[x][y]; return f[x][y]=(dfs(x-2,y-1)+dfs(x-1,y+2)+ dfs(x-1,y-2)+dfs(x-2,y+1))%123456; } int main(){ scanf("%d%d%d%d%d%d",&n,&m,&sx,&sy,&tx,&ty),f[sx][sy]=1; printf("%d\n",dfs(tx,ty)); return 0; }
3e9e283b586c3e91c8c7895f801ffe725dfe2840
7d19bd1b18359573bd2d5e39a730738df821a4d1
/libs/concurrency/include_compatibility/hpx/util/spinlock.hpp
0023efd5cd8ba57f071e814532e092701703f973
[ "BSL-1.0", "LicenseRef-scancode-free-unknown" ]
permissive
sarthakag/hpx
4f45d3b8e2fc88d7d2f0bf0abb7d231cd18360e6
a895dda5272634c5a8c9e35a45405699075a119e
refs/heads/master
2022-04-11T23:38:21.432194
2020-03-25T19:11:37
2020-03-25T19:11:37
250,194,241
1
0
BSL-1.0
2020-03-26T07:52:49
2020-03-26T07:52:48
null
UTF-8
C++
false
false
686
hpp
// Copyright (c) 2019 Mikael Simberg // // SPDX-License-Identifier: BSL-1.0 // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) #include <hpx/config.hpp> #include <hpx/concurrency/config/defines.hpp> #include <hpx/concurrency/spinlock.hpp> #if defined(HPX_CONCURRENCY_HAVE_DEPRECATION_WARNINGS) #if defined(HPX_MSVC) #pragma message("The header hpx/util/spinlock.hpp is deprecated, \ please include hpx/concurrency/spinlock.hpp instead") #else #warning "The header hpx/util/spinlock.hpp is deprecated, \ please include hpx/concurrency/spinlock.hpp instead" #endif #endif
c2039040fc1d3db9801abb3b8fa2bc12e93dc30f
4023789d76ee33d3bc4cce94553d94aac79c8dfb
/src/channel.cpp
4682b5e3ac8b9b97f8998d865e4e57153113c703
[]
no_license
mwidya/Mutation
d80f5d700c259495c40aa5f04a03f32e4c713101
3949412d139f6f743beb3462a1777b1a27f6e944
refs/heads/master
2021-01-20T06:22:51.922215
2014-08-27T20:53:05
2014-08-27T20:53:05
null
0
0
null
null
null
null
UTF-8
C++
false
false
738
cpp
// // channel.cpp // Mutation // // Created by Martin Widyanata on 01.08.14. // // #include "channel.h" channel::channel(int width, int height, int glFormat, string syphonServerName){ mWidth = width; mHeight = height; mGlFormat = glFormat; mSyphonServerName = syphonServerName; // TODO Test if new instance is created when setName is called mSyphonServer.setName(mSyphonServerName); mTexture.allocate(mWidth, mHeight, mGlFormat); mFbo.allocate(mWidth, mHeight, mGlFormat); mFbo.begin(); ofClear(255, 255, 255); mFbo.end(); } channel::~channel(){ ofLog(OF_LOG_NOTICE, "Desructor ~channel was called"); } void channel::draw(float x, float y){ mFbo.draw(x, y); }
d37a6d284a436a28b74d3535e26ca49c9866e003
9cca17134874c14f3d6924a9d1831ed21ba9de1b
/Pendulum.hpp
fbd5a206643226142f79f3daa5085adc1a02d750
[ "MIT" ]
permissive
clockworkengineer/Pendulum
0cb1c04012c1a0500b48e2da441239695bd361ba
2f54102012b664b299c36a46917e030a536be7ea
refs/heads/master
2021-01-19T19:12:16.950946
2020-08-15T16:42:33
2020-08-15T16:42:33
88,406,099
1
0
null
null
null
null
UTF-8
C++
false
false
373
hpp
#ifndef PENDULUM_HPP #define PENDULUM_HPP // ========= // NAMESPACE // ========= namespace Pendulum { // // .eml file extention // constexpr char const *kEMLFileExt{".eml"}; // // Main processing functionality (archive e-mail). // void archiveEmail(int argc, char** argv); } #endif /* PENDULUM_HPP */
e8f6eb51060fc776fdf38eb26babfe7e0fb5c63d
762f52d0e4b51509187e91e90b67b22b9a3fd1b4
/21. Dynamic Programming/19_elephantInMazeMinCost.cpp
10dc9fbbd6f134a8f8f7e2065ff3183833c85895
[]
no_license
apoorvKautilya21/Data-Structures-And-Algorithm-in-C-
f77319e5d56897586f89c377a53f5369a588f85d
c90a8953fc21f0d7a67cb28ec53a8ccf0157c58f
refs/heads/main
2023-03-03T14:20:37.141531
2021-02-06T05:08:54
2021-02-06T05:08:54
336,460,031
0
0
null
null
null
null
UTF-8
C++
false
false
592
cpp
#include<iostream> using namespace std; #define R 4 #define C 4 int countPaths() { int dp[100][100] = {0}; dp[0][0] = 1; for(int i = 0; i < R; i++) { for(int j = 0; j < i; j++) { dp[i][0] += dp[j][0]; } } for(int i = 0; i < C; i++) { for(int j = 0; j < i; j++) { dp[0][i] += dp[0][i]; } } for(int i = 1; i < R; i++) { for(int j = 1; j < C; j++) { for(int k = 0; k < i; k++) { dp[i][j] += dp[k][j]; } for(int k = 0; k < j; k++) { dp[i][j] += dp[i][k]; } } } return dp[R - 1][C - 1]; } int main() { cout << countPaths(); return 0; }
adef425781dc018852870710b54633f604b326fd
8a31c32e471630c2a490aa2a90f3a317fdbb37ba
/SymbolTable/hashtable.h
9d36894215708817392174f7f8e6b681bf80e0a9
[]
no_license
irstavr/wizAlgorithms
8c2fa13b3c53067d6c74ab5ae039460f9474806b
06e00a4dfbeda013ba8421dd20695c23ab9e0e1b
refs/heads/master
2021-01-10T10:21:26.928253
2015-10-28T19:44:30
2015-10-28T19:44:30
45,123,937
0
0
null
null
null
null
UTF-8
C++
false
false
5,685
h
/* File: hashtable.h * ----------------- * This is a simple table for storing values associated with a string * key, supporting simple operations for enter and lookup. * * keys: strings * values: any type */ #ifndef _H_hashtable #define _H_hashtable #include <map> #include <cstdlib> #include <cstring> #include <iostream> #include <string.h> // strdup #include <utility> // std::pair template <class Value> class Iterator; template<class Value> class Hashtable { private: std::multimap<std::string, Value> mmap; public: // ctor creates a new empty hashtable Hashtable() {} // Returns number of entries currently in table int getNumEntries() const; // Associates value with key. If a previous entry for // key exists, the bool parameter controls whether // new value overwrites the previous (removing it from // from the table entirely) or just shadows it (keeps previous // and adds additional entry). The lastmost entered one for an // key will be the one returned by Lookup. void enter(std::string key, Value value, bool overwriteInsteadOfShadow = true); // Removes a given key->value pair. Any other values // for that key are not affected. If this is the last // remaining value for that key, the key is removed // entirely. void remove(std::string key, Value value); // Returns value stored under key or NULL if no match. // If more than one value for key (ie shadow feature was // used during Enter), returns the lastmost entered one. Value lookup(std::string key); void printall(void); // Returns an Iterator object (see below) that can be used to // visit each value in the table in alphabetical order. Iterator<Value> getIterator(); }; /* * Iteration implementation. */ template <class Value> class Iterator { friend class Hashtable<Value>; private: typename std::multimap<std::string, Value>::iterator cur, end; Iterator(std::multimap<std::string, Value>& t) : cur(t.begin()), end(t.end()) { } public: // Returns current value and advances iterator to next. // Returns NULL when there are no more values in table // Visits every value, even those that are shadowed. Value getNextValue(); }; /* Hashtable::enter * ---------------- * Stores new value for given identifier. If the key already * has an entry and flag is to overwrite, will remove previous entry first, * otherwise it just adds another entry under same key. Copies the * key, so you don't have to worry about its allocation. */ template <class Value> void Hashtable<Value>::enter(std::string key, Value val, bool overwrite) { assert(val); Value prev; if (overwrite && (prev = lookup(key))) { remove(key, prev); } mmap.insert(std::make_pair(key, val)); } /* Hashtable::Remove * ----------------- * Removes a given key-value pair from table. If no such pair, no * changes are made. Does not affect any other entries under that key. */ template <class Value> void Hashtable<Value>::remove(std::string key, Value val) { if (mmap.count(key) == 0) { // no matches at all return; } typename std::multimap<std::string, Value>::iterator itr; itr = mmap.find(key); // start at first occurrence while (itr != mmap.upper_bound(key)) { if (itr->second == val) { // iterate to find matching pair mmap.erase(itr); break; } ++itr; } } /* Hashtable::Lookup * ----------------- * Returns the value earlier stored under key or NULL * if there is no matching entry */ template <class Value> Value Hashtable<Value>::lookup(std::string key) { Value found = NULL; if (mmap.count(key) > 0) { typename std::multimap<std::string, Value>::iterator cur, last, prev; cur = mmap.find(key); // start at first occurrence last = mmap.upper_bound(key); while (cur != last) { // iterate to find last entered prev = cur; if (++cur == mmap.upper_bound(key)) { // have to go one too far found = prev->second; // one before last was it break; } } } return found; } /* Hashtable::NumEntries * --------------------- */ template <class Value> int Hashtable<Value>::getNumEntries() const { return mmap.size(); } /* Hashtable:GetIterator * --------------------- * Returns iterator which can be used to walk through all values in table. */ template <class Value> Iterator<Value> Hashtable<Value>::getIterator() { return Iterator<Value>(mmap); } /* Iterator::GetNextValue * ---------------------- * Iterator method used to return current value and advance iterator * to next entry. Returns null if no more values exist. */ template <class Value> Value Iterator<Value>::getNextValue() { if (cur != end) { return (*cur++).second; } return NULL; } template <class Value> void Hashtable<Value>::printall(void) { typename std::multimap<std::string, Value>::const_iterator cur; for (cur = mmap.begin(); cur != mmap.end(); ++cur) { char *cstr = new char[(cur->first).length() + 1]; strcpy(cstr, (cur->first).c_str()); printf("%*s[%s] [%s: %d] [scope: %d] [addr: %p] [table addr: %p]\n", 3 * 0, "", cstr, "TType", cur->second->getTType()->getTTypeID(), cur->second->getScope(), cur->second, cur->second->getGamma()); delete [] cstr; } } #endif
7152c48ecb2d41dba203b6bad803803d57c7731e
28a13ff79c03db639545ff914b0109d971651de8
/Framework/Externals/slang/source/slang/compiler.cpp
81f107bd80dc4cb503876d330a8392d47c4ea50c
[ "MIT" ]
permissive
tangent-vector-personal/Falcor
828882a4180393f6fb5f76f7059d80b691df56ef
04571cfa4f39c27f8931dd6b2d929f995f20bc83
refs/heads/master
2022-02-14T02:50:07.983450
2017-07-24T03:50:46
2017-07-24T03:50:46
null
0
0
null
null
null
null
UTF-8
C++
false
false
23,318
cpp
// Compiler.cpp : Defines the entry point for the console application. // #include "../core/basic.h" #include "../core/slang-io.h" #include "compiler.h" #include "lexer.h" #include "parameter-binding.h" #include "parser.h" #include "preprocessor.h" #include "syntax-visitors.h" #include "slang-stdlib.h" #include "reflection.h" #include "emit.h" // Utilities for pass-through modes #include "../slang-glslang/slang-glslang.h" #ifdef _WIN32 #define WIN32_LEAN_AND_MEAN #define NOMINMAX #include <Windows.h> #undef WIN32_LEAN_AND_MEAN #undef NOMINMAX #include <d3dcompiler.h> #endif #ifdef _MSC_VER #pragma warning(disable: 4996) #endif #ifdef CreateDirectory #undef CreateDirectory #endif namespace Slang { // CompileResult void CompileResult::append(CompileResult const& result) { // Find which to append to ResultFormat appendTo = ResultFormat::None; if (format == ResultFormat::None) { format = result.format; appendTo = result.format; } else if (format == result.format) { appendTo = format; } if (appendTo == ResultFormat::Text) { outputString.append(result.outputString.Buffer()); } else if (appendTo == ResultFormat::Binary) { outputBinary.AddRange(result.outputBinary.Buffer(), result.outputBinary.Count()); } } // EntryPointRequest TranslationUnitRequest* EntryPointRequest::getTranslationUnit() { return compileRequest->translationUnits[translationUnitIndex].Ptr(); } // Profile Profile::LookUp(char const* name) { #define PROFILE(TAG, NAME, STAGE, VERSION) if(strcmp(name, #NAME) == 0) return Profile::TAG; #define PROFILE_ALIAS(TAG, DEF, NAME) if(strcmp(name, #NAME) == 0) return Profile::TAG; #include "profile-defs.h" return Profile::Unknown; } // String emitHLSLForEntryPoint( EntryPointRequest* entryPoint) { auto compileRequest = entryPoint->compileRequest; auto translationUnit = entryPoint->getTranslationUnit(); if (compileRequest->passThrough != PassThroughMode::None) { // Generate a string that includes the content of // the source file(s), along with a line directive // to ensure that we get reasonable messages // from the downstream compiler when in pass-through // mode. StringBuilder codeBuilder; for(auto sourceFile : translationUnit->sourceFiles) { codeBuilder << "#line 1 \""; for(auto c : sourceFile->path) { char buffer[] = { c, 0 }; switch(c) { default: codeBuilder << buffer; break; case '\\': codeBuilder << "\\\\"; } } codeBuilder << "\"\n"; codeBuilder << sourceFile->content << "\n"; } return codeBuilder.ProduceString(); } else { return emitEntryPoint( entryPoint, compileRequest->layout.Ptr(), CodeGenTarget::HLSL); } } String emitGLSLForEntryPoint( EntryPointRequest* entryPoint) { auto compileRequest = entryPoint->compileRequest; auto translationUnit = entryPoint->getTranslationUnit(); if (compileRequest->passThrough != PassThroughMode::None) { // Generate a string that includes the content of // the source file(s), along with a line directive // to ensure that we get reasonable messages // from the downstream compiler when in pass-through // mode. StringBuilder codeBuilder; int translationUnitCounter = 0; for(auto sourceFile : translationUnit->sourceFiles) { int translationUnitIndex = translationUnitCounter++; // We want to output `#line` directives, but we need // to skip this for the first file, since otherwise // some GLSL implementations will get tripped up by // not having the `#version` directive be the first // thing in the file. if(translationUnitIndex != 0) { codeBuilder << "#line 1 " << translationUnitIndex << "\n"; } codeBuilder << sourceFile->content << "\n"; } return codeBuilder.ProduceString(); } else { // TODO(tfoley): need to pass along the entry point // so that we properly emit it as the `main` function. return emitEntryPoint( entryPoint, compileRequest->layout.Ptr(), CodeGenTarget::GLSL); } } char const* GetHLSLProfileName(Profile profile) { switch(profile.raw) { #define PROFILE(TAG, NAME, STAGE, VERSION) case Profile::TAG: return #NAME; #include "profile-defs.h" default: // TODO: emit an error here! return "unknown"; } } #ifdef _WIN32 HMODULE loadD3DCompilerDLL(CompileRequest* request) { char const* libraryName = "d3dcompiler_47"; HMODULE d3dCompiler = LoadLibraryA(libraryName); if (!d3dCompiler) { request->mSink.diagnose(CodePosition(), Diagnostics::failedToLoadDynamicLibrary, libraryName); } return d3dCompiler; } HMODULE getD3DCompilerDLL(CompileRequest* request) { // TODO(tfoley): let user specify version of d3dcompiler DLL to use. static HMODULE d3dCompiler = loadD3DCompilerDLL(request); return d3dCompiler; } List<uint8_t> EmitDXBytecodeForEntryPoint( EntryPointRequest* entryPoint) { static pD3DCompile D3DCompile_ = nullptr; if (!D3DCompile_) { HMODULE d3dCompiler = getD3DCompilerDLL(entryPoint->compileRequest); if (!d3dCompiler) return List<uint8_t>(); D3DCompile_ = (pD3DCompile)GetProcAddress(d3dCompiler, "D3DCompile"); if (!D3DCompile_) return List<uint8_t>(); } auto hlslCode = emitHLSLForEntryPoint(entryPoint); maybeDumpIntermediate(entryPoint->compileRequest, hlslCode.Buffer(), CodeGenTarget::HLSL); ID3DBlob* codeBlob; ID3DBlob* diagnosticsBlob; HRESULT hr = D3DCompile_( hlslCode.begin(), hlslCode.Length(), "slang", nullptr, nullptr, entryPoint->name.begin(), GetHLSLProfileName(entryPoint->profile), 0, 0, &codeBlob, &diagnosticsBlob); List<uint8_t> data; if (codeBlob) { data.AddRange((uint8_t const*)codeBlob->GetBufferPointer(), (int)codeBlob->GetBufferSize()); codeBlob->Release(); } if (diagnosticsBlob) { // TODO(tfoley): need a better policy for how we translate diagnostics // back into the Slang world (although we should always try to generate // HLSL that doesn't produce any diagnostics...) entryPoint->compileRequest->mSink.diagnoseRaw( FAILED(hr) ? Severity::Error : Severity::Warning, (char const*) diagnosticsBlob->GetBufferPointer()); diagnosticsBlob->Release(); } if (FAILED(hr)) { return List<uint8_t>(); } return data; } #if 0 List<uint8_t> EmitDXBytecode( ExtraContext& context) { if(context.getTranslationUnitOptions().entryPoints.Count() != 1) { if(context.getTranslationUnitOptions().entryPoints.Count() == 0) { // TODO(tfoley): need to write diagnostics into this whole thing... fprintf(stderr, "no entry point specified\n"); } else { fprintf(stderr, "multiple entry points specified\n"); } return List<uint8_t>(); } return EmitDXBytecodeForEntryPoint(context, context.getTranslationUnitOptions().entryPoints[0]); } #endif String dissassembleDXBC( CompileRequest* compileRequest, void const* data, size_t size) { static pD3DDisassemble D3DDisassemble_ = nullptr; if (!D3DDisassemble_) { HMODULE d3dCompiler = getD3DCompilerDLL(compileRequest); if (!d3dCompiler) return String(); D3DDisassemble_ = (pD3DDisassemble)GetProcAddress(d3dCompiler, "D3DDisassemble"); if (!D3DDisassemble_) return String(); } if (!data || !size) { return String(); } ID3DBlob* codeBlob; HRESULT hr = D3DDisassemble_( data, size, 0, nullptr, &codeBlob); String result; if (codeBlob) { char const* codeBegin = (char const*)codeBlob->GetBufferPointer(); char const* codeEnd = codeBegin + codeBlob->GetBufferSize(); result.append(codeBegin, codeEnd); codeBlob->Release(); } if (FAILED(hr)) { // TODO(tfoley): need to figure out what to diagnose here... } return result; } String EmitDXBytecodeAssemblyForEntryPoint( EntryPointRequest* entryPoint) { List<uint8_t> dxbc = EmitDXBytecodeForEntryPoint(entryPoint); if (!dxbc.Count()) { return String(); } String result = dissassembleDXBC(entryPoint->compileRequest, dxbc.Buffer(), dxbc.Count()); return result; } #if 0 String EmitDXBytecodeAssembly( ExtraContext& context) { if(context.getTranslationUnitOptions().entryPoints.Count() == 0) { // TODO(tfoley): need to write diagnostics into this whole thing... fprintf(stderr, "no entry point specified\n"); return ""; } StringBuilder sb; for (auto entryPoint : context.getTranslationUnitOptions().entryPoints) { sb << EmitDXBytecodeAssemblyForEntryPoint(context, entryPoint); } return sb.ProduceString(); } #endif HMODULE loadGLSLCompilerDLL(CompileRequest* request) { char const* libraryName = "slang-glslang"; // TODO(tfoley): let user specify version of glslang DLL to use. HMODULE glslCompiler = LoadLibraryA(libraryName); if (!glslCompiler) { request->mSink.diagnose(CodePosition(), Diagnostics::failedToLoadDynamicLibrary, libraryName); } return glslCompiler; } HMODULE getGLSLCompilerDLL(CompileRequest* request) { static HMODULE glslCompiler = loadGLSLCompilerDLL(request); return glslCompiler; } int invokeGLSLCompiler( CompileRequest* slangCompileRequest, glslang_CompileRequest& request) { static glslang_CompileFunc glslang_compile = nullptr; if (!glslang_compile) { HMODULE glslCompiler = getGLSLCompilerDLL(slangCompileRequest); if (!glslCompiler) return 1; glslang_compile = (glslang_CompileFunc)GetProcAddress(glslCompiler, "glslang_compile"); if (!glslang_compile) return 1; } String diagnosticOutput; auto diagnosticOutputFunc = [](void const* data, size_t size, void* userData) { (*(String*)userData).append((char const*)data, (char const*)data + size); }; request.diagnosticFunc = diagnosticOutputFunc; request.diagnosticUserData = &diagnosticOutput; int err = glslang_compile(&request); if (err) { slangCompileRequest->mSink.diagnoseRaw( Severity::Error, diagnosticOutput.begin()); return err; } return 0; } String dissassembleSPIRV( CompileRequest* slangRequest, void const* data, size_t size) { String output; auto outputFunc = [](void const* data, size_t size, void* userData) { (*(String*)userData).append((char const*)data, (char const*)data + size); }; glslang_CompileRequest request; request.action = GLSLANG_ACTION_DISSASSEMBLE_SPIRV; request.inputBegin = data; request.inputEnd = (char*)data + size; request.outputFunc = outputFunc; request.outputUserData = &output; int err = invokeGLSLCompiler(slangRequest, request); if (err) { String(); } return output; } List<uint8_t> emitSPIRVForEntryPoint( EntryPointRequest* entryPoint) { String rawGLSL = emitGLSLForEntryPoint(entryPoint); maybeDumpIntermediate(entryPoint->compileRequest, rawGLSL.Buffer(), CodeGenTarget::GLSL); List<uint8_t> output; auto outputFunc = [](void const* data, size_t size, void* userData) { ((List<uint8_t>*)userData)->AddRange((uint8_t*)data, size); }; glslang_CompileRequest request; request.action = GLSLANG_ACTION_COMPILE_GLSL_TO_SPIRV; request.sourcePath = "slang"; request.slangStage = (SlangStage)entryPoint->profile.GetStage(); request.inputBegin = rawGLSL.begin(); request.inputEnd = rawGLSL.end(); request.outputFunc = outputFunc; request.outputUserData = &output; int err = invokeGLSLCompiler(entryPoint->compileRequest, request); if (err) { return List<uint8_t>(); } return output; } String emitSPIRVAssemblyForEntryPoint( EntryPointRequest* entryPoint) { List<uint8_t> spirv = emitSPIRVForEntryPoint(entryPoint); if (spirv.Count() == 0) return String(); String result = dissassembleSPIRV(entryPoint->compileRequest, spirv.begin(), spirv.Count()); return result; } #endif #if 0 String emitSPIRVAssembly( ExtraContext& context) { if(context.getTranslationUnitOptions().entryPoints.Count() == 0) { // TODO(tfoley): need to write diagnostics into this whole thing... fprintf(stderr, "no entry point specified\n"); return ""; } StringBuilder sb; for (auto entryPoint : context.getTranslationUnitOptions().entryPoints) { sb << emitSPIRVAssemblyForEntryPoint(context, entryPoint); } return sb.ProduceString(); } #endif // Do emit logic for a single entry point CompileResult emitEntryPoint( EntryPointRequest* entryPoint) { CompileResult result; auto compileRequest = entryPoint->compileRequest; auto target = compileRequest->Target; switch (target) { case CodeGenTarget::HLSL: { String code = emitHLSLForEntryPoint(entryPoint); maybeDumpIntermediate(compileRequest, code.Buffer(), target); result = CompileResult(code); } break; case CodeGenTarget::GLSL: { String code = emitGLSLForEntryPoint(entryPoint); maybeDumpIntermediate(compileRequest, code.Buffer(), target); result = CompileResult(code); } break; case CodeGenTarget::DXBytecode: { List<uint8_t> code = EmitDXBytecodeForEntryPoint(entryPoint); maybeDumpIntermediate(compileRequest, code.Buffer(), code.Count(), target); result = CompileResult(code); } break; case CodeGenTarget::DXBytecodeAssembly: { String code = EmitDXBytecodeAssemblyForEntryPoint(entryPoint); maybeDumpIntermediate(compileRequest, code.Buffer(), target); result = CompileResult(code); } break; case CodeGenTarget::SPIRV: { List<uint8_t> code = emitSPIRVForEntryPoint(entryPoint); maybeDumpIntermediate(compileRequest, code.Buffer(), code.Count(), target); result = CompileResult(code); } break; case CodeGenTarget::SPIRVAssembly: { String code = emitSPIRVAssemblyForEntryPoint(entryPoint); maybeDumpIntermediate(compileRequest, code.Buffer(), target); result = CompileResult(code); } break; case CodeGenTarget::None: // The user requested no output break; // Note(tfoley): We currently hit this case when compiling the stdlib case CodeGenTarget::Unknown: break; default: SLANG_UNEXPECTED("unhandled code generation target"); break; } return result; } CompileResult emitTranslationUnitEntryPoints( TranslationUnitRequest* translationUnit) { CompileResult result; for (auto& entryPoint : translationUnit->entryPoints) { CompileResult entryPointResult = emitEntryPoint(entryPoint.Ptr()); entryPoint->result = entryPointResult; } // The result for the translation unit will just be the concatenation // of the results for each entry point. This doesn't actually make // much sense, but it is good enough for now. // // TODO: Replace this with a packaged JSON and/or binary format. for (auto& entryPoint : translationUnit->entryPoints) { result.append(entryPoint->result); } return result; } // Do emit logic for an entire translation unit, which might // have zero or more entry points CompileResult emitTranslationUnit( TranslationUnitRequest* translationUnit) { return emitTranslationUnitEntryPoints(translationUnit); } #if 0 TranslationUnitResult generateOutput(ExtraContext& context) { TranslationUnitResult result = emitTranslationUnit(context); return result; } #endif void generateOutput( CompileRequest* compileRequest) { // Start of with per-translation-unit and per-entry-point lowering for( auto translationUnit : compileRequest->translationUnits ) { CompileResult translationUnitResult = emitTranslationUnit(translationUnit.Ptr()); translationUnit->result = translationUnitResult; } // Allow for an "extra" target to verride things before we finish. switch (compileRequest->extraTarget) { case CodeGenTarget::ReflectionJSON: { String reflectionJSON = emitReflectionJSON(compileRequest->layout.Ptr()); // Clobber existing output so we don't have to deal with it for( auto translationUnit : compileRequest->translationUnits ) { translationUnit->result = CompileResult(); } for( auto entryPoint : compileRequest->entryPoints ) { entryPoint->result = CompileResult(); } // HACK(tfoley): just print it out since that is what people probably expect. // TODO: need a way to control where output gets routed across all possible targets. fprintf(stdout, "%s", reflectionJSON.begin()); return; } break; default: break; } } // Debug logic for dumping intermediate outputs // void dumpIntermediate( CompileRequest*, void const* data, size_t size, char const* ext, bool isBinary) { static int counter = 0; int id = counter++; String path; path.append("slang-dump-"); path.append(id); path.append(ext); FILE* file = fopen(path.Buffer(), isBinary ? "wb" : "w"); if (!file) return; fwrite(data, size, 1, file); fclose(file); } void dumpIntermediateText( CompileRequest* compileRequest, void const* data, size_t size, char const* ext) { dumpIntermediate(compileRequest, data, size, ext, false); } void dumpIntermediateBinary( CompileRequest* compileRequest, void const* data, size_t size, char const* ext) { dumpIntermediate(compileRequest, data, size, ext, true); } void maybeDumpIntermediate( CompileRequest* compileRequest, void const* data, size_t size, CodeGenTarget target) { if (!compileRequest->shouldDumpIntermediates) return; switch (target) { default: break; case CodeGenTarget::HLSL: dumpIntermediateText(compileRequest, data, size, ".hlsl"); break; case CodeGenTarget::GLSL: dumpIntermediateText(compileRequest, data, size, ".glsl"); break; case CodeGenTarget::SPIRVAssembly: dumpIntermediateText(compileRequest, data, size, ".spv.asm"); break; case CodeGenTarget::DXBytecodeAssembly: dumpIntermediateText(compileRequest, data, size, ".dxbc.asm"); break; case CodeGenTarget::SPIRV: dumpIntermediateBinary(compileRequest, data, size, ".spv"); { String spirvAssembly = dissassembleSPIRV(compileRequest, data, size); dumpIntermediateText(compileRequest, spirvAssembly.begin(), spirvAssembly.Length(), ".spv.asm"); } break; case CodeGenTarget::DXBytecode: dumpIntermediateBinary(compileRequest, data, size, ".dxbc"); { String dxbcAssembly = dissassembleDXBC(compileRequest, data, size); dumpIntermediateText(compileRequest, dxbcAssembly.begin(), dxbcAssembly.Length(), ".dxbc.asm"); } break; } } void maybeDumpIntermediate( CompileRequest* compileRequest, char const* text, CodeGenTarget target) { if (!compileRequest->shouldDumpIntermediates) return; maybeDumpIntermediate(compileRequest, text, strlen(text), target); } }
b36b02820cee28976577749c012fb6367f65762d
1cfd0b154f05498c3bae47247e77acb598fb8cfb
/Misc/SubarraySumsII.cpp
9a4910f29df3dfc36cb4897e2a8ddf2af14e95dc
[ "MIT" ]
permissive
0xWOLAND/CompetitiveProgramming
291e9e628788a0e14fd6638f6010e589b670d136
6dd47e56693e4fb0600a30a16453978fd52d584e
refs/heads/main
2023-08-21T23:51:29.758793
2021-10-13T04:06:43
2021-10-13T04:06:43
null
0
0
null
null
null
null
UTF-8
C++
false
false
484
cpp
#include <bits/stdc++.h> using namespace std; int main(int argc, char const *argv[]) { int n, x; cin >> n >> x; std::map<int, int> map; map[0] = 1; int u; int sum = 0, ans = 0; for(int i = 0; i < n; i++) { cin >> u; sum += u; if(map[sum - x]){ ans += map[sum - x]; } map[sum] += 1; } cout << ans << "\n"; return 0; }
136f02afb1925e38390ed7d069daef83b410d950
6b40e9dccf2edc767c44df3acd9b626fcd586b4d
/NT/com/ole32/stg/h/dfdeb.hxx
d624896fdbd21378bd83340f4aed62962e7a8179
[]
no_license
jjzhang166/WinNT5_src_20201004
712894fcf94fb82c49e5cd09d719da00740e0436
b2db264153b80fbb91ef5fc9f57b387e223dbfc2
refs/heads/Win2K3
2023-08-12T01:31:59.670176
2021-10-14T15:14:37
2021-10-14T15:14:37
586,134,273
1
0
null
2023-01-07T03:47:45
2023-01-07T03:47:44
null
UTF-8
C++
false
false
1,955
hxx
//+-------------------------------------------------------------- // // Microsoft Windows // Copyright (C) Microsoft Corporation, 1992 - 1992. // // File: dfdeb.hxx // // Contents: Docfile debug header // // Functions: DfDebug // DfSetResLimit // DfGetResLimit // DfPrintAllocs // HaveResource // ModifyResLimit // // History: 13-May-92 DrewB Created // //--------------------------------------------------------------- #ifndef __DFDEB_HXX__ #define __DFDEB_HXX__ #if DBG == 1 // Resources that can be controlled #define DBR_MEMORY 0 #define DBR_XSCOMMITS 1 #define DBR_FAILCOUNT 2 #define DBR_FAILLIMIT 3 #define DBR_FAILTYPES 4 // Resources that can be queried #define DBRQ_MEMORY_ALLOCATED 5 // Internal resources #define DBRI_ALLOC_LIST 6 #define DBRI_LOGFILE_LIST 7 // Control flags #define DBRF_LOGGING 8 //Number of shared heaps allocated #define DBRQ_HEAPS 9 // Control whether sifting is enabled #define DBRF_SIFTENABLE 10 #define CDBRESOURCES 11 // Simulated failure types typedef enum { DBF_MEMORY = 1, DBF_DISKFULL = 2, DBF_DISKREAD = 4, DBF_DISKWRITE = 8 } DBFAILURE; // Logging control flags (e.g. DfSetResLimit(DBRF_LOGGING, DFLOG_MIN);) #define DFLOG_OFF 0x00000000 #define DFLOG_ON 0x02000000 #define DFLOG_PIDTID 0x04000000 STDAPI_(void) DfDebug(ULONG ulLevel, ULONG ulMSFLevel); STDAPI_(void) DfSetResLimit(UINT iRes, LONG lLimit); STDAPI_(LONG) DfGetResLimit(UINT iRes); STDAPI_(void) DfSetFailureType(LONG lTypes); BOOL SimulateFailure(DBFAILURE failure); STDAPI_(LONG) DfGetMemAlloced(void); STDAPI_(void) DfPrintAllocs(void); // Internal APIs BOOL HaveResource(UINT iRes, LONG lRequest); LONG ModifyResLimit(UINT iRes, LONG lChange); #endif // DBG == 1 #endif // #ifndef __DFDEB_HXX__
d0511db5d3937d4bc6c3c2118c379b44b6dba01b
e018d8a71360d3a05cba3742b0f21ada405de898
/Client/DebugKit.cpp
eef4d56f1c0dba02e779eb7adabc742a4a77aebf
[]
no_license
opendarkeden/client
33f2c7e74628a793087a08307e50161ade6f4a51
321b680fad81d52baf65ea7eb3beeb91176c15f4
refs/heads/master
2022-11-28T08:41:15.782324
2022-11-26T13:21:22
2022-11-26T13:21:22
42,562,963
24
18
null
2022-11-26T13:21:23
2015-09-16T03:43:01
C++
UTF-8
C++
false
false
4,019
cpp
// DebugKit.cpp: implementation of the CDebugKit class. // ////////////////////////////////////////////////////////////////////// #include "Client_PCH.h" #include "stdafx.h" #include "DebugKit.h" #include <wtypes.h> #include "fstream" extern BOOL g_bMsgOutPutFlag; extern BOOL g_bMsgDetailFlag; extern BOOL g_bMsgContentFlag; extern CMessageStringTable g_MessageStringTable; extern BYTE g_nKeyMapSelect; extern int g_nGameVersion; ////////////////////////////////////////////////////////////////////// // Construction/Destruction ////////////////////////////////////////////////////////////////////// CDebugKit::CDebugKit() { m_DebugInfo = new Properties; } CDebugKit::~CDebugKit() { if(m_DebugInfo!=NULL) delete m_DebugInfo; } BOOL CDebugKit::load() { try{ m_DebugInfo->load("DebugInfo.ini"); } catch (Error) { return FALSE; } catch (IOException) { return FALSE; } return TRUE; } std::string CDebugKit::GetMsgFileName() { try{ return m_DebugInfo->getProperty("MsgFileName"); } catch (NoSuchElementException) { return NULL; } } BOOL CDebugKit::GetMsgOutPutFlag() { try{ return ((m_DebugInfo->getPropertyInt("MsgOutPutFlag")>0)?TRUE:FALSE); } catch (NoSuchElementException) { return FALSE; } } BOOL CDebugKit::GetMsgDetailFlag() { try{ return ((m_DebugInfo->getPropertyInt("MsgDetailFlag")>0)?TRUE:FALSE); } catch (NoSuchElementException) { return FALSE; } } BOOL CDebugKit::GetMsgContentFlag() { try{ return ((m_DebugInfo->getPropertyInt("MsgContentFlag")>0)?TRUE:FALSE); } catch (NoSuchElementException) { return FALSE; } } BYTE CDebugKit::GetAuthKeyMap() { try{ return m_DebugInfo->getPropertyInt("AuthKeyMap"); } catch (NoSuchElementException) { return FALSE; } } int CDebugKit::GetGameVersion() { try{ return m_DebugInfo->getPropertyInt("GameVersion"); } catch (NoSuchElementException) { return 0; } } const char *CMessageStringTable::GetMessageName(WORD MessageID) { if(IsExistMessageName(MessageID)) return m_MessageName[MessageID].c_str(); else return "UNKNOWN_MESSAGE"; } CMessageStringTable::CMessageStringTable() { } CMessageStringTable::~CMessageStringTable() { } void CMessageStringTable::LoadFromFile(std::string strFileName) { int i=0; std::ifstream ifile( strFileName.c_str() , ios::in ); // std::ifstream ifile( "MessageDefine.ini" , ios::in ); if ( ! ifile ) return; while ( true ) { std::string line; std::getline( ifile , line ); if ( ifile.eof() ) break; uint key_begin = line.find_first_not_of( " \t" ); if ( key_begin == std::string::npos ) continue; uint key_end = line.find( "," , key_begin ); std::string key = line.substr( key_begin , key_end - key_begin ); SetMessageName(i++,key); } ifile.close(); } void CMessageStringTable::SaveToFile(std::string strFileName) { } #ifdef DEBUG_INFO BOOL InitDebugInfo() { CDebugKit *p_dKit = new CDebugKit(); if(p_dKit->load() == FALSE) return FALSE; g_bMsgOutPutFlag = p_dKit->GetMsgOutPutFlag(); g_bMsgContentFlag = p_dKit->GetMsgContentFlag(); g_bMsgDetailFlag = p_dKit->GetMsgDetailFlag(); g_nKeyMapSelect = p_dKit->GetAuthKeyMap(); g_nGameVersion = p_dKit->GetGameVersion(); std::string strFileName; strFileName = p_dKit->GetMsgFileName(); g_MessageStringTable.LoadFromFile(strFileName); const char *p_cName = g_MessageStringTable.GetMessageName(100); delete p_dKit; return TRUE; } void ClearDebugInfo() { g_MessageStringTable.ClearMessageName(); } void PrintMessageDetail(ofstream file, char *strMsg, int length) { char temp[1024]; int i,j=0; memset(temp,0,sizeof(temp)); j += sprintf(temp+j,"\t"); for(i=0; i<length; i++) { j += sprintf(temp+j,"%02x ",(BYTE)strMsg[i]); if((i+1)%16 == 0 && i+1 != length) j += sprintf(temp+j,"\n\t"); } j += sprintf(temp+j,"\0"); file << temp << endl; } #endif
c6775e133f63b5f4de6e69a1d2a70acc440b80b4
165961905f419dbf7844ce25a4f125993252cf2f
/SoftLoader/04.code/SoftLoader/ANCToolPlugin/Config.cpp
049a15a40a23f12b5cfe17e71f7436871e5732f5
[]
no_license
Tairycy/Local_git_resp
caf67aa6a5b0807b23dfb9e2c80fbe7ed3247bab
44b8cbd319327b37a2a5c2dae5b6c8fab8250549
refs/heads/master
2023-07-16T03:13:40.200394
2021-09-03T08:45:10
2021-09-03T08:45:10
null
0
0
null
null
null
null
GB18030
C++
false
false
12,016
cpp
#include "Config.h" #include <QFile> #include <QApplication> #include <QJsonDocument> #include <QJsonArray> #include <QJsonObject> #include <QDebug> #include <QMessageBox> #include "../common/customplot/Utility.h" Config* Config::m_pIns = nullptr; Config::Config() : m_wave_format_modified_flag(false) , m_wave_filter_modified_flag(false) , m_axis_modified_flag(false) , m_vec_fr_lines(ConfWaveLinesMaxValue) , m_vec_phase_lines(ConfWaveLinesMaxValue) , m_vec_fb(ConfFilesMaxValue) , m_vec_ff(ConfFilesMaxValue) , m_vec_music(ConfFilesMaxValue) , m_fr_chart_data(ConfWaveLinesMaxValue) , m_phase_chart_data(ConfFilesMaxValue) , m_sys_dB(0) , m_nPowerOfTwo(27) { for (int i = 0; i < ConfWaveLinesMaxValue; ++i) { m_vec_fr_lines[i].name = QString("Line_%1").arg(i + 1); m_vec_fr_lines[i].clr = LineColors[i]; m_vec_phase_lines[i].name = QString("Line_%1").arg(i + 1); m_vec_phase_lines[i].clr = LineColors[i]; } for (int i=0; i<ConfFilesMaxValue; ++i) { m_vec_fb[i].nSerial = i + 1; m_vec_ff[i].nSerial = i + 1; } } Config::~Config() { } Config * Config::getIns() { if (m_pIns == nullptr) { m_pIns = new Config; } return m_pIns; } int Config::initConf() { int nRet = 0; readCommonJson(); int nRetAxis = 0; bool bReadJson = readJson_axis(); if (!bReadJson) { nRetAxis = 10; } return nRet+nRetAxis; } void Config::saveOut() { writeJson_axis(); } bool Config::readCommonJson() { QString strPathFile = QApplication::applicationDirPath(); strPathFile = strPathFile + QString("/config/ANCTool/common.json"); QFile file(strPathFile); if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) { qDebug() << "打开文件失败,错误信息为:" << file.errorString(); return false; } QByteArray allData = file.readAll(); file.close(); QJsonParseError jsonError; QJsonDocument jsonDoc(QJsonDocument::fromJson(allData, &jsonError)); if (jsonError.error != QJsonParseError::NoError) { qDebug() << "json error!" << jsonError.errorString(); return false; } QJsonObject root = jsonDoc.object(); m_nPowerOfTwo = root["powerOfTwo"].toInt(); m_sys_dB = root["sys_db"].toInt(); m_sys_freqRate = root["freqrate"].toInt(); m_sys_channel = root["channel"].toInt(); return true; } bool Config::writeCommonJson() { QString strPathFile = QApplication::applicationDirPath(); strPathFile = strPathFile + QString("/config/ANCTool/common.json"); QFile file(strPathFile); if (!file.open(QIODevice::ReadWrite |QIODevice::Text)) { qDebug() << QStringLiteral("打开文件失败,错误信息为:" )<< file.errorString(); return false; } file.resize(0); //清空文件中的原有内容 QJsonDocument jsonDoc; QJsonObject jsonRoot; jsonRoot["powerOfTwo"] = m_nPowerOfTwo; jsonRoot["sys_db"] = m_sys_dB; jsonRoot["freqrate"] = m_sys_freqRate; jsonRoot["channel"] = m_sys_channel; jsonDoc.setObject(jsonRoot); file.write(jsonDoc.toJson()); file.close(); return true; } bool Config::readJson(QString strFile) { //QString strPathFile = QApplication::applicationDirPath(); //strPathFile = strPathFile + QString("/config/ANCTool/wave_filter_conf.json"); QFile file(strFile); if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) { qDebug() << "打开文件失败,错误信息为:"<<file.errorString(); return false; } QByteArray allData = file.readAll(); file.close(); QJsonParseError jsonError; QJsonDocument jsonDoc(QJsonDocument::fromJson(allData, &jsonError)); if (jsonError.error != QJsonParseError::NoError) { qDebug() << "json error!" << jsonError.errorString(); return false; } QJsonObject root = jsonDoc.object(); int nSysFreqRate = root["freqrate"].toInt(); if (m_sys_freqRate != nSysFreqRate) { QMessageBox::StandardButton button = QMessageBox::information(nullptr, QStringLiteral("提示"), QStringLiteral("当前系统设置的采样率与加载的配置不符,是否继续加载配置文件?"), QMessageBox::Yes, QMessageBox::No); if (button == QMessageBox::No) { return false; } } QJsonObject obj_wave_filter_ff = root["wave_filter_ff"].toObject(); QJsonObject obj_wave_filter_fb = root["wave_filter_fb"].toObject(); //QJsonObject obj_wave_filter_music = root["wave_filter_music"].toObject(); //FF配置读取 QJsonArray objArray_wave_filter_ff = obj_wave_filter_ff["data"].toArray(); for (int i = 0; i < objArray_wave_filter_ff.size(); i++) { QJsonObject tempObj = objArray_wave_filter_ff.at(i).toObject(); CONF_WAVE_FILTER_PARAM tempStu; tempStu.nType = tempObj["type"].toInt(); tempStu.nSerial = tempObj["serial"].toInt(); tempStu.freq = tempObj["freq"].toInt(); tempStu.boost = tempObj["boost"].toDouble(); tempStu.nQ = tempObj["bandWidth"].toDouble(); tempStu.gain = tempObj["gain"].toInt(); tempStu.slope = tempObj["slope"].toDouble(); m_vec_ff[i] =tempStu; } //FB配置读取 QJsonArray objArray_wave_filter_fb = obj_wave_filter_fb["data"].toArray(); for (int i = 0; i < objArray_wave_filter_fb.size(); i++) { QJsonObject tempObj = objArray_wave_filter_fb.at(i).toObject(); CONF_WAVE_FILTER_PARAM tempStu; tempStu.nType = tempObj["type"].toInt(); tempStu.nSerial = tempObj["serial"].toInt(); tempStu.freq = tempObj["freq"].toInt(); tempStu.boost = tempObj["boost"].toDouble(); tempStu.nQ = tempObj["bandWidth"].toDouble(); tempStu.gain = tempObj["gain"].toInt(); m_vec_fb[i] = tempStu; } /* //MUSIC配置读取 QJsonArray objArray_wave_filter_music = obj_wave_filter_music["data"].toArray(); for (int i = 0; i < objArray_wave_filter_music.size(); i++) { QJsonObject tempObj = objArray_wave_filter_music.at(i).toObject(); CONF_WAVE_FILTER_PARAM tempStu; tempStu.nType = WAVE_MUSIC; tempStu.nSerial = tempObj["serial"].toInt(); tempStu.freq = tempObj["freq"].toInt(); tempStu.boost = tempObj["boost"].toInt(); tempStu.nQ = tempObj["bandWidth"].toInt(); tempStu.gain = tempObj["gain"].toInt(); m_vec_music[i] = tempStu; } */ return true; } bool Config::writeJson(QString strFile) { //QString strPathFile = QApplication::applicationDirPath(); //strPathFile = strPathFile + QString("/config/ANCTool/wave_filter_conf.json"); QFile file(strFile); if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) { qDebug() << "打开文件失败,错误信息为:" << file.errorString(); return false; } file.resize(0); //清空文件中的原有内容 // QJsonDocument jsonDoc; QJsonObject jsonConf; QJsonObject jsonWaveFF; QJsonObject jsonWaveFB; QJsonArray jsonArrayWaveFF; QJsonArray jsonArrayWaveFB; for (int i = 0; i < ConfFilesMaxValue; i++) { QJsonObject jsonObj; CONF_WAVE_FILTER_PARAM tempParam = m_vec_ff[i]; jsonObj["serial"] = tempParam.nSerial; jsonObj["type"] = tempParam.nType; jsonObj["freq"] = tempParam.freq; jsonObj["boost"] = tempParam.boost; jsonObj["bandWidth"] = tempParam.nQ; jsonObj["gain"] = tempParam.gain; jsonObj["slope"] = tempParam.slope; jsonArrayWaveFF.append(jsonObj); } jsonWaveFF["data"] = jsonArrayWaveFF; for (int i = 0; i < ConfFilesMaxValue; i++) { QJsonObject jsonObj; CONF_WAVE_FILTER_PARAM tempParam = m_vec_fb[i]; jsonObj["serial"] = tempParam.nSerial; jsonObj["type"] = tempParam.nType; jsonObj["freq"] = tempParam.freq; jsonObj["boost"] = tempParam.boost; jsonObj["bandWidth"] = tempParam.nQ; jsonObj["gain"] = tempParam.gain; jsonObj["slope"] = tempParam.slope; jsonArrayWaveFB.append(jsonObj); } jsonWaveFB["data"] = jsonArrayWaveFB; /* for(int i = 0; i < ConfFilesMaxValue; i++) { QJsonObject jsonObj; CONF_WAVE_FILTER_PARAM tempParam = m_vec_music[i]; jsonObj["serial"] = tempParam.nSerial; jsonObj["freq"] = tempParam.freq; jsonObj["boost"] = tempParam.boost; jsonObj["bandWidth"] = tempParam.nQ; jsonObj["gain"] = tempParam.gain; jsonArrayWaveMUSIC.append(jsonObj); } jsonWaveMUSIC["data"] = jsonArrayWaveMUSIC; */ jsonConf["wave_filter_ff"] = jsonWaveFF; jsonConf["wave_filter_fb"] = jsonWaveFB; jsonConf["freqrate"] = m_sys_freqRate; //jsonConf["wave_filter_music"] = jsonWaveMUSIC; jsonDoc.setObject(jsonConf); file.write(jsonDoc.toJson()); file.close(); return true; } bool Config::readJson_axis() { QString strPathFile = QApplication::applicationDirPath(); strPathFile = strPathFile + QString("/config/ANCTool/axis_conf.json"); QFile file(strPathFile); if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) { qDebug() << "打开文件失败,错误信息为:" << file.errorString(); return false; } QByteArray allData = file.readAll(); file.close(); QJsonParseError jsonError; QJsonDocument jsonDoc(QJsonDocument::fromJson(allData, &jsonError)); if (jsonError.error != QJsonParseError::NoError) { qDebug() << "json error!" << jsonError.errorString(); return false; } QJsonObject root = jsonDoc.object(); QJsonObject obj_axis = root["axis"].toObject(); QJsonObject obj_fr = obj_axis["fr"].toObject(); m_sys_dB = obj_axis["sysdb"].toInt(); QJsonObject obj_phase = obj_axis["phase"].toObject(); //配置读取FR m_fr_chart_axis.nMin_x = obj_fr["min_x"].toInt(); m_fr_chart_axis.nMax_x = obj_fr["max_x"].toInt(); m_fr_chart_axis.nMin_y = obj_fr["min_y"].toInt(); m_fr_chart_axis.nMax_y = obj_fr["max_y"].toInt(); //配置读取FR m_phase_chart_axis.nMin_x = obj_phase["min_x"].toInt(); m_phase_chart_axis.nMax_x = obj_phase["max_x"].toInt(); m_phase_chart_axis.nMin_y = obj_phase["min_y"].toInt(); m_phase_chart_axis.nMax_y = obj_phase["max_y"].toInt(); return true; } bool Config::writeJson_axis() { QString strPathFile = QApplication::applicationDirPath(); strPathFile = strPathFile + QString("/config/ANCTool/axis_conf.json"); QFile file(strPathFile); if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) { qDebug() << "打开文件失败,错误信息为:" << file.errorString(); return false; } file.resize(0); //清空文件中的原有内容 // QJsonDocument jsonDoc; QJsonObject root; QJsonObject obj_axis; QJsonObject obj_fr; QJsonObject obj_phase; //获取配置数据fr obj_fr["min_x"] = m_fr_chart_axis.nMin_x; obj_fr["max_x"] = m_fr_chart_axis.nMax_x; obj_fr["min_y"] = m_fr_chart_axis.nMin_y; obj_fr["max_y"] = m_fr_chart_axis.nMax_y; //获取配置数据fr obj_phase["min_x"] = m_phase_chart_axis.nMin_x; obj_phase["max_x"] = m_phase_chart_axis.nMax_x; obj_phase["min_y"] = m_phase_chart_axis.nMin_y; obj_phase["max_y"] = m_phase_chart_axis.nMax_y; obj_axis["fr"] = obj_fr; obj_axis["phase"] = obj_phase; obj_axis["sysdb"] = m_sys_dB; root["axis"] = obj_axis; jsonDoc.setObject(root); file.write(jsonDoc.toJson()); file.close(); return true; } void Config::set_wave_filter_conf(WAVE_FILTER_TYPE nType, const CONF_WAVE_FILTER_PARAM & stuVal) { m_wave_filter_modified_flag = true; switch (nType) { case WAVE_FF: for (int i = 0; i < ConfFilesMaxValue; ++i) { if (m_vec_ff[i].nSerial == stuVal.nSerial) { m_vec_ff[i] = stuVal; break; } } break; case WAVE_FB: for (int i = 0; i < ConfFilesMaxValue; ++i) { if (m_vec_fb[i].nSerial == stuVal.nSerial) { m_vec_fb[i] = stuVal; break; } } break; case WAVE_MUSIC: for (int i = 0; i < ConfFilesMaxValue; ++i) { if (m_vec_music[i].nSerial == stuVal.nSerial) { m_vec_music[i] = stuVal; break; } } break; default: break; } } CONF_WAVE_FILTER_PARAM Config::get_wave_filter_conf(WAVE_FILTER_TYPE nType, int nSerial) { CONF_WAVE_FILTER_PARAM tempStu; switch (nType) { case WAVE_FF: for (int i = 0; i < ConfFilesMaxValue; ++i) { if (m_vec_ff[i].nSerial == nSerial) { tempStu = m_vec_ff[i]; break; } } break; case WAVE_FB: for (int i = 0; i < ConfFilesMaxValue; ++i) { if (m_vec_fb[i].nSerial == nSerial) { tempStu = m_vec_fb[i]; break; } } break; case WAVE_MUSIC: for (int i = 0; i < ConfFilesMaxValue; ++i) { if (m_vec_music[i].nSerial == nSerial) { tempStu = m_vec_music[i]; break; } } break; default: break; } return tempStu; }
33b2b1211c66058002fa36240675fb1142204aa2
ce05aaa05dad66310e159245b2ce4baa9f6ac25b
/viewtestdlg.cpp
cafb8450d601c9ce4334d8f07c75faa70f281473
[]
no_license
acraig5075/kbutwa-utils
617c25e6b10e17834e053283f0abbc430343a67f
3515dc1f069653dd81e3734123b53512418b87fa
refs/heads/master
2021-10-20T12:38:28.921982
2021-10-13T18:47:41
2021-10-13T18:47:41
47,452,185
0
0
null
null
null
null
UTF-8
C++
false
false
1,253
cpp
#include "viewtestdlg.h" #include "ui_viewtestdlg.h" ViewTestDlg::ViewTestDlg(QWidget *parent, const QString &number, const QString &vault, const QVector<QPair<QString, QString>> &labels, const QString &procedure) : QDialog(parent), ui(new Ui::ViewTestDlg) { ui->setupUi(this); ui->numberEdit->setReadOnly(true); ui->vaultEdit->setReadOnly(true); ui->label1Edit->setReadOnly(true); ui->label2Edit->setReadOnly(true); ui->label3Edit->setReadOnly(true); ui->procedureText->setReadOnly(true); QLabel *labelNames[] = { ui->label1Name, ui->label2Name, ui->label3Name }; QLineEdit *labelEdits[] = { ui->label1Edit, ui->label2Edit, ui->label3Edit }; std::for_each(std::begin(labelNames), std::end(labelNames), [](QLabel *label){ label->setVisible(false); }); std::for_each(std::begin(labelEdits), std::end(labelEdits), [](QLineEdit *edit){ edit->setVisible(false); }); for (int i = 0; i < qMin(labels.size(), 3); ++i) { labelNames[i]->setVisible(true); labelEdits[i]->setVisible(true); labelNames[i]->setText(labels.at(i).first); labelEdits[i]->setText(labels.at(i).second); } ui->numberEdit->setText(number); ui->vaultEdit->setText(vault); ui->procedureText->setText(procedure); } ViewTestDlg::~ViewTestDlg() { delete ui; }
52869f18a3b327d8c6bcccdb6ec7cd504292e500
315450354c6ddeda9269ffa4c96750783963d629
/CMSSW_7_0_4/tmp/slc6_amd64_gcc481/src/TotemDQMLite/GUI/src/TotemDQMLiteGUI/moc/QRootCanvas_h_moc.cc
6e2f2b72aaaf3458a6afd9ec9024851263d95872
[]
no_license
elizamelo/CMSTOTEMSim
e5928d49edb32cbfeae0aedfcf7bd3131211627e
b415e0ff0dad101be5e5de1def59c5894d7ca3e8
refs/heads/master
2021-05-01T01:31:38.139992
2017-09-12T17:07:12
2017-09-12T17:07:12
76,041,270
0
2
null
null
null
null
UTF-8
C++
false
false
2,420
cc
/**************************************************************************** ** Meta object code from reading C++ file 'QRootCanvas.h' ** ** Created: Mon Jul 11 23:33:08 2016 ** by: The Qt Meta Object Compiler version 63 (Qt 4.8.1) ** ** WARNING! All changes made in this file will be lost! *****************************************************************************/ #include "../../../../../../../../src/TotemDQMLite/GUI/interface/QRootCanvas.h" #if !defined(Q_MOC_OUTPUT_REVISION) #error "The header file 'QRootCanvas.h' doesn't include <QObject>." #elif Q_MOC_OUTPUT_REVISION != 63 #error "This file was generated using the moc from 4.8.1. It" #error "cannot be used with the include files from this version of Qt." #error "(The moc has changed too much.)" #endif QT_BEGIN_MOC_NAMESPACE static const uint qt_meta_data_QRootCanvas[] = { // content: 6, // revision 0, // classname 0, 0, // classinfo 0, 0, // methods 0, 0, // properties 0, 0, // enums/sets 0, 0, // constructors 0, // flags 0, // signalCount 0 // eod }; static const char qt_meta_stringdata_QRootCanvas[] = { "QRootCanvas\0" }; void QRootCanvas::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a) { Q_UNUSED(_o); Q_UNUSED(_id); Q_UNUSED(_c); Q_UNUSED(_a); } const QMetaObjectExtraData QRootCanvas::staticMetaObjectExtraData = { 0, qt_static_metacall }; const QMetaObject QRootCanvas::staticMetaObject = { { &QWidget::staticMetaObject, qt_meta_stringdata_QRootCanvas, qt_meta_data_QRootCanvas, &staticMetaObjectExtraData } }; #ifdef Q_NO_DATA_RELOCATION const QMetaObject &QRootCanvas::getStaticMetaObject() { return staticMetaObject; } #endif //Q_NO_DATA_RELOCATION const QMetaObject *QRootCanvas::metaObject() const { return QObject::d_ptr->metaObject ? QObject::d_ptr->metaObject : &staticMetaObject; } void *QRootCanvas::qt_metacast(const char *_clname) { if (!_clname) return 0; if (!strcmp(_clname, qt_meta_stringdata_QRootCanvas)) return static_cast<void*>(const_cast< QRootCanvas*>(this)); return QWidget::qt_metacast(_clname); } int QRootCanvas::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QWidget::qt_metacall(_c, _id, _a); if (_id < 0) return _id; return _id; } QT_END_MOC_NAMESPACE
1ddfe897fd42581c9e61b8b286865de1689aec84
019873f0c364b45d560d0008f9719d6ec62bf23d
/help.cpp
1feaf1d4da06853894ecd1fd2409552d4980e8b2
[]
no_license
asdredmitry/JordThreads
d31809db0afa735b4e04be96db0806ac2f8bc631
5f0b84180815572303dc68d08f1b2cbd57206149
refs/heads/master
2021-07-24T14:22:40.693565
2017-11-06T23:49:41
2017-11-06T23:49:41
108,880,389
0
0
null
null
null
null
UTF-8
C++
false
false
1,531
cpp
#include <sys/resource.h> #include <sys/time.h> #include <stdio.h> #include <math.h> #include "help.h" #define MAX_OUTPUT_SIZE 10 double f(int i, int j) { return fabs(i - j); } void readMatrix(int n, double *a, double *b, int mode, FILE *input) { int i, j; double tmp; if (mode == 1) { for (i = 0; i < n; i++) { for (j = 0; j < n; j++) fscanf(input, "%lf", &a[i * n + j]); fscanf(input, "%lf", &b[i]); } fclose(input); } else { for (i = 0; i < n; i++) { tmp = 0.0; for (j = 0; j < n; j++) { a[i * n + j] = f(i, j); if (!(j % 2)) tmp += a[i * n + j]; } b[i] = tmp; } } } void printMatrix(int n, double *a, double *b) { int i, j; int m = (n > MAX_OUTPUT_SIZE) ? MAX_OUTPUT_SIZE : n; for (i = 0; i < m; i++) { printf("| "); for (j = 0; j < m; j++) printf("%10.3g ", a[i * n +j]); printf(" | %10.3g\n", b[i]); } } void printVector(int n, double *x) { int i; int m = (n > MAX_OUTPUT_SIZE) ? MAX_OUTPUT_SIZE : n; for (i = 0; i < m; i++) printf("%10.3g ", x[i]); } double normNev(int n, double *a, double *b, double *x) { int i, j; double tmp; double rezult; rezult = 0.0; for (i = 0; i < n; i++) { tmp = 0.0; for (j = 0; j < n; j++) tmp += a[i * n + j] * x[j]; tmp -= b[i]; rezult += tmp * tmp; } return sqrt(rezult); } double accuracy(int n, double *x) { int i; double tmp; double rezult; rezult = 0.0; for (i = 0; i < n; i++) { tmp = x[i]; if (!(i%2)) tmp -= 1.0; rezult += tmp * tmp; } return sqrt(rezult); }
97a153e98d58cdffcae462d48f626d813c25c1db
3562757dd437244240ba9eada1a8e3d65e701fc3
/IterativePostorder.cpp
5c114ede2026332da0771fbe204ca6676edca1e3
[]
no_license
Upasana-12/Trees
ccfa93c3e78b1aab3dafe0a3439374348a7db012
eef493812d231eb7bd3cbbf0ba95b29d598a7603
refs/heads/master
2020-08-07T11:30:35.940599
2019-10-07T16:47:33
2019-10-07T16:47:33
213,432,569
0
0
null
null
null
null
UTF-8
C++
false
false
612
cpp
/** * Definition for binary tree * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : val(x), left(NULL), right(NULL) {} * }; */ vector<int> Solution::postorderTraversal(TreeNode* A) { vector<int> v; stack<TreeNode*> s1,s2; while(!s1.empty()) { TreeNode* temp=s1.top(); s1.pop(); s2.push(temp); if(temp->left) s1.push(temp->left); if(temp->right) s1.push(temp->right); } while(!s2.empty()) { v.push_back(s2.top()->val); s2.pop(); } return v; }
b8e51524ca4872944d2d317871c3788574c59f5c
7bb34b9837b6304ceac6ab45ce482b570526ed3c
/external/webkit/Tools/MiniBrowser/qt/BrowserView.cpp
7d6426eb8621e63613aba2131e1cd78708f25232
[ "Apache-2.0", "LicenseRef-scancode-warranty-disclaimer", "LGPL-2.0-or-later", "GPL-1.0-or-later", "GPL-2.0-only", "LGPL-2.1-only", "LGPL-2.0-only", "BSD-2-Clause", "LicenseRef-scancode-other-copyleft" ]
permissive
ghsecuritylab/android_platform_sony_nicki
7533bca5c13d32a8d2a42696344cc10249bd2fd8
526381be7808e5202d7865aa10303cb5d249388a
refs/heads/master
2021-02-28T20:27:31.390188
2013-10-15T07:57:51
2013-10-15T07:57:51
245,730,217
0
0
Apache-2.0
2020-03-08T00:59:27
2020-03-08T00:59:26
null
UTF-8
C++
false
false
2,308
cpp
/* * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) * Copyright (C) 2010 University of Szeged * * 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 COMPUTER, INC. ``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 COMPUTER, INC. OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "BrowserView.h" #include <QGraphicsScene> BrowserView::BrowserView(QGraphicsWKView::BackingStoreType backingStoreType, QWKContext* context, QWidget* parent) : QGraphicsView(parent) , m_item(0) { m_item = new QGraphicsWKView(context, backingStoreType, 0); setScene(new QGraphicsScene(this)); scene()->addItem(m_item); setFrameShape(QFrame::NoFrame); setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); } void BrowserView::resizeEvent(QResizeEvent* event) { QGraphicsView::resizeEvent(event); QRectF rect(QPoint(0, 0), event->size()); m_item->setGeometry(rect); scene()->setSceneRect(rect); } void BrowserView::load(const QString& url) { return m_item->load(QUrl::fromUserInput(url)); } QGraphicsWKView* BrowserView::view() const { return m_item; }
0bac0aa362a380d6a5de79b79a3b51417496434d
1d3e07aa050fd2fd0c8cc0a9a83b74b28826c8a8
/lib/src/simple_geometry.cpp
6543ef3fa10be65f1eba69f658a44a64a4b6aac7
[]
no_license
climoge/moteur_physique
bdc066b4058c2e816841246d44a6d48cb52e5b7d
5d52d3250c1142bc2c432ad6e6c1763f58425d6b
refs/heads/master
2020-05-26T01:01:43.064415
2017-03-15T22:46:55
2017-03-15T22:46:55
84,959,128
0
0
null
null
null
null
UTF-8
C++
false
false
8,401
cpp
#include <glmlv/simple_geometry.hpp> #include <glm/gtc/constants.hpp> #include <iostream> namespace glmlv { SimpleGeometry makeTriangle() { std::vector<Vertex3f3f2f> vertexBuffer = { { glm::vec3(-0.5, -0.5, 0), glm::vec3(0, 0, 1), glm::vec2(0, 0) }, { glm::vec3(0.5, -0.5, 0), glm::vec3(0, 0, 1), glm::vec2(1, 0) }, { glm::vec3(0., 0.5, 0), glm::vec3(0, 0, 1), glm::vec2(0.5, 1) } }; std::vector<uint32_t> indexBuffer = { 0, 1, 2 }; return{ vertexBuffer, indexBuffer }; } SimpleGeometry makeCube() { std::vector<Vertex3f3f2f> vertexBuffer = { // Bottom side { glm::vec3(-0.5, -0.5, -0.5), glm::vec3(0, -1, 0), glm::vec2(0, 0) }, { glm::vec3(0.5, -0.5, -0.5), glm::vec3(0, -1, 0), glm::vec2(0, 1) }, { glm::vec3(0.5, -0.5, 0.5), glm::vec3(0, -1, 0), glm::vec2(1, 1) }, { glm::vec3(-0.5, -0.5, 0.5), glm::vec3(0, -1, 0), glm::vec2(1, 0) }, // Right side { glm::vec3(0.5, -0.5, 0.5), glm::vec3(1, 0, 0), glm::vec2(0, 0) }, { glm::vec3(0.5, -0.5, -0.5), glm::vec3(1, 0, 0), glm::vec2(0, 1) }, { glm::vec3(0.5, 0.5, -0.5), glm::vec3(1, 0, 0), glm::vec2(1, 1) }, { glm::vec3(0.5, 0.5, 0.5), glm::vec3(1, 0, 0), glm::vec2(1, 0) }, // Back side { glm::vec3(0.5, -0.5, -0.5), glm::vec3(0, 0, -1), glm::vec2(0, 0) }, { glm::vec3(-0.5, -0.5, -0.5), glm::vec3(0, 0, -1), glm::vec2(0, 1) }, { glm::vec3(-0.5, 0.5, -0.5), glm::vec3(0, 0, -1), glm::vec2(1, 1) }, { glm::vec3(0.5, 0.5, -0.5), glm::vec3(0, 0, -1), glm::vec2(1, 0) }, // Left side { glm::vec3(-0.5, -0.5, -0.5), glm::vec3(-1, 0, 0), glm::vec2(0, 0) }, { glm::vec3(-0.5, -0.5, 0.5), glm::vec3(-1, 0, 0), glm::vec2(0, 1) }, { glm::vec3(-0.5, 0.5, 0.5), glm::vec3(-1, 0, 0), glm::vec2(1, 1) }, { glm::vec3(-0.5, 0.5, -0.5), glm::vec3(-1, 0, 0), glm::vec2(1, 0) }, // Front side { glm::vec3(-0.5, -0.5, 0.5), glm::vec3(0, 0, 1), glm::vec2(0, 0) }, { glm::vec3(0.5, -0.5, 0.5), glm::vec3(0, 0, 1), glm::vec2(0, 1) }, { glm::vec3(0.5, 0.5, 0.5), glm::vec3(0, 0, 1), glm::vec2(1, 1) }, { glm::vec3(-0.5, 0.5, 0.5), glm::vec3(0, 0, 1), glm::vec2(1, 0) }, // Top side { glm::vec3(-0.5, 0.5, 0.5), glm::vec3(0, 1, 0), glm::vec2(0, 0) }, { glm::vec3(0.5, 0.5, 0.5), glm::vec3(0, 1, 0), glm::vec2(0, 1) }, { glm::vec3(0.5, 0.5, -0.5), glm::vec3(0, 1, 0), glm::vec2(1, 1) }, { glm::vec3(-0.5, 0.5, -0.5), glm::vec3(0, 1, 0), glm::vec2(1, 0) } }; std::vector<uint32_t> indexBuffer = { 0, 1, 2, 0, 2, 3, 4, 5, 6, 4, 6, 7, 8, 9, 10, 8, 10, 11, 12, 13, 14, 12, 14, 15, 16, 17, 18, 16, 18, 19, 20, 21, 22, 20, 22, 23 }; return{ vertexBuffer, indexBuffer }; } /*SimpleGeometry makeFlag(std::Vector<PMat>& pMats) { std::vector<Vertex3f3f2f> vertexBuffer; std::vector<uint32_t> indexBuffer; uint32_t index = 0; for(float j = 0; j <= 1; j += 0.1){ for(float i = 0; i <= 1; i += 0.1){ vertexBuffer.push_back(Vertex3f3f2f(glm::vec3(i, j, 0), glm::vec3(0, 0, 1), glm::vec2(0, 0))); vertexBuffer.push_back(Vertex3f3f2f(glm::vec3(i + 0.1, j, 0), glm::vec3(0, 0, 1), glm::vec2(0, 0))); vertexBuffer.push_back(Vertex3f3f2f(glm::vec3(i + 0.1, j + 0.1, 0), glm::vec3(0, 0, 1), glm::vec2(0, 0))); vertexBuffer.push_back(Vertex3f3f2f(glm::vec3(i, j + 0.1, 0), glm::vec3(0, 0, 1), glm::vec2(0, 0))); indexBuffer.push_back(index); indexBuffer.push_back(index+1); indexBuffer.push_back(index+2); indexBuffer.push_back(index); indexBuffer.push_back(index+2); indexBuffer.push_back(index+3); index += 4; } } for(auto const& pMat: pMats) { vertexBuffer.push_back(Vertex3f3f2f(glm::vec3(pMat[i].getPos().x, pMat[i].getPos().y, 0), glm::vec3(0, 0, 1), glm::vec2(0, 0))); indexBuffer.push_back(index); index++; } return{ vertexBuffer, indexBuffer }; }*/ SimpleGeometry makeFlag() { std::vector<Vertex3f3f2f> vertexBuffer; std::vector<uint32_t> indexBuffer; uint32_t index = 0; unsigned int width = 50; unsigned int height = 50; float jOffset = 1/(float) height; float iOffset = 1/(float) width; assert(width%2 == 0 && height%2 == 0); for(float j = 0; j < 1; j += jOffset*2){ for(float i = 0; i < 1; i += iOffset*2){ vertexBuffer.push_back(Vertex3f3f2f(glm::vec3(i, j, 0), glm::vec3(0, 0, 1), glm::vec2(0, 0))); vertexBuffer.push_back(Vertex3f3f2f(glm::vec3(i, j + jOffset, 0), glm::vec3(0, 0, 1), glm::vec2(0, 0))); vertexBuffer.push_back(Vertex3f3f2f(glm::vec3(i + iOffset, j, 0), glm::vec3(0, 0, 1), glm::vec2(0, 0))); vertexBuffer.push_back(Vertex3f3f2f(glm::vec3(i + iOffset, j + jOffset, 0), glm::vec3(0, 0, 1), glm::vec2(0, 0))); if(index >= (2*width)){ std::cout << "index " << index << std::endl; int offset = index - (width*2-1); std::cout << "offset " << offset << std::endl; indexBuffer.push_back(offset); indexBuffer.push_back(index); indexBuffer.push_back(offset + 2); std::cout << "Vertex 1 : " << offset << " " << index << " " << offset+2 << std::endl; indexBuffer.push_back(index); indexBuffer.push_back(index+2); indexBuffer.push_back(offset + 2); std::cout << "Vertex 1 : " << index << " " << index+2 << " " << offset+2 << std::endl; if(index % (2*width) < (width*2-4)){ std::cout << "index " << index << std::endl; int offset = index - (width*2-1) + 2; std::cout << "offset " << offset << std::endl; indexBuffer.push_back(offset); indexBuffer.push_back(index+2); indexBuffer.push_back(offset + 2); std::cout << "Vertex 1 : " << offset << " " << index+2 << " " << offset+2 << std::endl; indexBuffer.push_back(index+2); indexBuffer.push_back(index+4); indexBuffer.push_back(offset + 2); std::cout << "Vertex 1 : " << index+2 << " " << index+4 << " " << offset+2 << std::endl << std::endl; } } if(index > 0 && index % (2*width)){ std::cout << "index : " << index << " modulo : " << index % (4*width) << std::endl; std::cout << "Vertex 1 : " << index-2 << " " << index-1 << " " << index << std::endl; std::cout << "Vertex 2 : " << index-1 << " " << index+1 << " " << index << std::endl << std::endl; indexBuffer.push_back(index-2); indexBuffer.push_back(index-1); indexBuffer.push_back(index); indexBuffer.push_back(index-1); indexBuffer.push_back(index+1); indexBuffer.push_back(index); } indexBuffer.push_back(index); indexBuffer.push_back(index+1); indexBuffer.push_back(index+2); indexBuffer.push_back(index+1); indexBuffer.push_back(index+3); indexBuffer.push_back(index+2); index += 4; } } return{ vertexBuffer, indexBuffer }; } SimpleGeometry makeSphere(uint32_t subdivLongitude) { const auto discLong = subdivLongitude; const auto discLat = 2 * discLong; float rcpLat = 1.f / discLat, rcpLong = 1.f / discLong; float dPhi = glm::pi<float>() * 2.f * rcpLat, dTheta = glm::pi<float>() * rcpLong; std::vector<Vertex3f3f2f> vertexBuffer; for (uint32_t j = 0; j <= discLong; ++j) { float cosTheta = cos(-glm::half_pi<float>() + j * dTheta); float sinTheta = sin(-glm::half_pi<float>() + j * dTheta); for (uint32_t i = 0; i <= discLat; ++i) { glm::vec3 coords; coords.x = sin(i * dPhi) * cosTheta; coords.y = sinTheta; coords.z = cos(i * dPhi) * cosTheta; vertexBuffer.emplace_back(coords, coords, glm::vec2(i * rcpLat, j * rcpLong)); } } std::vector<uint32_t> indexBuffer; for (uint32_t j = 0; j < discLong; ++j) { uint32_t offset = j * (discLat + 1); for (uint32_t i = 0; i < discLat; ++i) { indexBuffer.push_back(offset + i); indexBuffer.push_back(offset + (i + 1)); indexBuffer.push_back(offset + discLat + 1 + (i + 1)); indexBuffer.push_back(offset + i); indexBuffer.push_back(offset + discLat + 1 + (i + 1)); indexBuffer.push_back(offset + i + discLat + 1); } } return{ vertexBuffer, indexBuffer }; } }
d426f57c064d12613d890eb0e1cd7e1578d1b838
32644d7e482ad227a51757ff0d07dd9cc5e1897e
/old/src_old/pig.h
5969e0f14e9625c9f1917fefdb1fefc32dbd6ef5
[]
no_license
pigApp/pig
521b2f06f3020362d5e7ad3283faabc207f41f06
2593b7ca0203644a074d15b038ba4b5b2d421b7d
refs/heads/master
2016-09-06T06:51:13.186777
2016-01-31T15:47:59
2016-01-31T15:47:59
20,078,750
0
0
null
null
null
null
UTF-8
C++
false
false
1,530
h
#ifndef PIG_H #define PIG_H #include "update.h" #include "tcpSocket.h" #include "torrent.h" #include <QObject> #include <QtSql> class PIG : public QObject { Q_OBJECT public: PIG(QObject *parent = 0); ~PIG(); public slots: void quit(); void set_root_object(QObject *root); void password_handler(const bool require, const QString plain , const bool check, const bool write); void preview_handler(const int id, const QString host, const QString url , const QString target , const bool ready, const bool success, const bool error, const bool abort); void torrent_handler(const QString host, const QString url, const QString target , const int scene, const bool abort); void find(const QString userInput, const QString category , const QString pornstar, const QString quality, const QString full); signals: void sig_ret_password(const bool require = false, const bool success = false); void sig_show_update(); void sig_show_news(const QString binaryNews, const QString databaseNews); void sig_show_finder(); void sig_ret_db(int nMovies, QStringList dataMovies); void sig_ret_stream(const int id, const bool ready, const bool success , const bool error); void sig_show_db_err(); private: QObject *mRoot; Update *mUpdate; TcpSocket *mSocket[5]; Torrent *mTorrent; QSqlDatabase db; private slots: void update_handler(); void start(); void cleanup(); void db_error(); }; #endif
357b7568ee72669f4c0e4cebedbbaf495f73dbb0
0310c7b65492405afea20c57a7787fb1854289ad
/PictureCreater/PictureCreater/BMPPic.h
bce702e753312c7c092094af09ab868151065acb
[]
no_license
nie11kun/c-plus-plus-test
d1f099a98d497b54049f436e092e9ac461df6d49
a6056de82dea0274b0f82731fb1f403dea6c3dd4
refs/heads/master
2021-06-17T22:08:28.368538
2021-01-06T03:20:45
2021-01-06T03:20:45
132,863,604
0
0
null
null
null
null
UTF-8
C++
false
false
258
h
#pragma once #include<stdio.h> class BMPPic { public: BMPPic(); ~BMPPic(); bool generateBmp(char* pData, int width, int height, char * filename); void readBmp(FILE* filename); void bmpWidthHeight(FILE* fpbmp, int &width, int &height); };
7daf032ba044b0c4c2a53237a4a7f15f5ee4d6e4
7419c3edc2d0f8ecc82be918f1321d985b781a39
/sources/mesh_layout.hpp
07c65398fe6210c8858a80779adb779dd45d04eb
[]
no_license
Nojan/particle
07b1685f127610b35d222aa305a9114577e6a855
d3e700a114479c69dfcced52f828c1b253d4fde7
refs/heads/master
2021-07-30T00:03:37.947192
2018-09-16T15:27:45
2018-09-16T15:33:35
21,325,548
1
1
null
2021-07-28T09:49:41
2014-06-29T15:03:19
C++
UTF-8
C++
false
false
1,740
hpp
#pragma once #include "types.hpp" #include <array> namespace VertexSemantic { enum value { Position, Normal, TexCoord0, Color0, Weigth, Index, Count, }; static const char* str[] = { "Position", "Normal", "TexCoord0", "Color0", "Weigth", "Index", "Count", }; } namespace VertexType { enum value { Float, Float2, Float3, Float4, FloatNormalize, Float2Normalize, Float3Normalize, Float4Normalize, Count, }; static const char* str[] = { "Float", "Float2", "Float3", "Float4", "FloatNormalize", "Float2Normalize", "Float3Normalize", "Float4Normalize", "Count", }; static uint8_t ComponentCount[] = { 1, 2, 3, 4, 1, 2, 3, 4, 0, }; } size_t VertexTypeSize(VertexType::value type); class VertexBufferLayout { public: struct Component { VertexSemantic::value mSemantic; VertexType::value mType; }; VertexBufferLayout(); VertexBufferLayout(const VertexBufferLayout& ref); void Add(const Component& component); VertexBufferLayout& Add(VertexSemantic::value semantic, VertexType::value type); size_t GetComponentCount() const; const Component& GetComponent(size_t idx) const; Component& GetComponent(size_t idx); size_t GetIndex(VertexSemantic::value semantic) const; size_t GetVertexSize() const; size_t Offset(VertexSemantic::value semantic) const; private: std::array<Component, VertexSemantic::Count> mComponents; };
e2595fe39afb3384e2b67a8d31166cb1664b387e
ee41758c348e4e2e7eb45983ca7c647fdcbe754d
/ProiectSDA/src/util/vector.h
687386fa3aba4f0018db9b8ec316a3da97a5379a
[]
no_license
mariusadam/dictionary-mvc-cpp
9a180ca1dbed4871f634531ddd422325f3e2ee7d
e4bd6f73fa8a9c91a6c11999e7073c0548c6fbb6
refs/heads/master
2021-01-19T03:48:44.782482
2016-06-03T02:24:41
2016-06-03T02:24:41
60,148,579
0
0
null
null
null
null
UTF-8
C++
false
false
6,197
h
#ifndef VECTOR_H #define VECTOR_H #include <exception> #include <cmath> class VectorException : public std::exception { public: VectorException() : std::exception() {} VectorException(const char* msg) : std::exception{ msg } {} }; template<typename Type> class IteratorVector; /* Vector declaration */ template<typename Type> class Vector { private: int __size; int __capacity; Type* __elements; void __resize(); void __ensureCapacity(); public: static const int DEFAULT_CAPACITY; static const double RESIZE_FACTOR; Vector(); Vector(const int& dim); Vector(const Vector& other); ~Vector(); const int size() const; void push_back(const Type& element); bool has(const Type& element); Type& at(const int& offset) const; Type& pop(const int& offset); Type& pop(); Type& remove(const Type& element); Type& operator[](const int& offset) const; Vector<Type> operator=(const Vector<Type> &other); IteratorVector<Type> begin() const; IteratorVector<Type> end() const; }; /* IteratorVector declaration */ template<typename Type> class IteratorVector { private: const Vector<Type>& __vec; int __current; public: IteratorVector(const Vector<Type>& vec) : __vec{ vec }, __current{ 0 } {} IteratorVector(const Vector<Type>& vec, const int& poz) : __vec{ vec }, __current{ poz } {} ~IteratorVector() {} Type& element() const; void next(); bool valid() const; IteratorVector& operator++(); Type& operator*() const; bool operator==(const IteratorVector<Type>& other) const; bool operator!=(const IteratorVector<Type>& other) const; }; /* Vector implementation */ template<typename Type>const int Vector<Type>::DEFAULT_CAPACITY = 1; template<typename Type>const double Vector<Type>::RESIZE_FACTOR = 1.5; template<typename Type>inline Vector<Type>::Vector() { this->__size = 0; this->__capacity = DEFAULT_CAPACITY; this->__elements = new Type[DEFAULT_CAPACITY]; } template<typename Type>inline Vector<Type>::Vector(const int& dim) { if (dim < 0) { throw VectorException("Invalid capacity!"); } this->__size = 0; this->__capacity = dim; this->__elements = new Type[dim]; } template<typename Type>inline Vector<Type>::Vector(const Vector& other) { this->__elements = new Type[other.__size]; for (int i = 0; i < other.__size; i++) { this->__elements[i] = other.__elements[i]; } this->__size = other.__size; this->__capacity = other.__capacity; } template<typename Type>inline Vector<Type>::~Vector() { this->__size = 0; this->__capacity = 0; delete[] this->__elements; } template<typename Type>inline const int Vector<Type>::size() const { return this->__size; } template<typename Type>inline void Vector<Type>::push_back(const Type& elem) { this->__ensureCapacity(); this->__elements[this->__size++] = elem; } template<typename Type>inline bool Vector<Type>::has(const Type & element) { for (int i = 0; i < this->__size; i++) { if (this->__elements[i] == element) { return true; } } return false; } template<typename Type>inline Type& Vector<Type>::at(const int& offset) const { if (offset < 0 || offset >= this->__size) { throw VectorException("Index out of range!"); } return this->__elements[offset]; } template<typename Type>inline Type& Vector<Type>::pop(const int& offset) { if (offset < 0 || offset >= this->__size) { throw VectorException("Index out of range!"); } Type elem = this->__elements[offset]; for (int i = offset; i < this->__size - 1; i++) { this->__elements[i] = this->__elements[i + 1]; } this->__size--; return elem; } template<typename Type>inline Type& Vector<Type>::pop() { if (this->__size == 0) { throw VectorException("The vector is empty!"); } return this->pop(this->__size - 1) } template<typename Type>inline Type& Vector<Type>::remove(const Type& elem) { for (int i = 0; i < this->__size; i++) { if (this->__elements[i] == elem) { return this->pop(i); } } throw VectorException("Element not found!"); } template<typename Type>inline Type& Vector<Type>::operator[](const int& offset) const { return this->at(offset); } template<typename Type> inline Vector<Type> Vector<Type>::operator=(const Vector<Type>& other) { delete[] this->__elements; this->__elements = new Type[other.__capacity]; for (int i = 0; i < other.__size; i++) { this->__elements[i] = other.__elements[i]; } this->__size = other.__size; this->__capacity = other.__capacity; return *this; } template<typename Type>inline IteratorVector<Type> Vector<Type>::begin() const { return IteratorVector<Type> {*this}; } template<typename Type>inline IteratorVector<Type> Vector<Type>::end() const { return IteratorVector<Type> {*this, this->__size}; } template<typename Type>inline void Vector<Type>::__ensureCapacity() { if (this->__size == this->__capacity) { this->__resize(); } } template<typename Type>inline void Vector<Type>::__resize() { int newCapacity = this->__capacity + (int)std::round(this->__capacity * this->RESIZE_FACTOR) + 1; Type* newElements = new Type[newCapacity]; if (newElements == NULL) { throw VectorException("Could not resize, you ran out of memory!"); } for (int i = 0; i < this->__size; i++) { newElements[i] = this->__elements[i]; } delete[] this->__elements; this->__elements = newElements; this->__capacity = newCapacity; } /* IteratorVector implementation */ template<typename Type>inline Type& IteratorVector<Type>::element() const { return this->__vec[this->__current]; } template<typename Type>inline void IteratorVector<Type>::next() { this->__current++; } template<typename Type>inline bool IteratorVector<Type>::valid() const { return this->__current != this->__vec.size(); } template<typename Type>inline IteratorVector<Type>& IteratorVector<Type>::operator++() { this->next(); return *this; } template<typename Type>inline bool IteratorVector<Type>::operator==(const IteratorVector<Type>& other) const { return this->__current == other.__current; } template<typename Type>inline bool IteratorVector<Type>::operator!=(const IteratorVector<Type>& other) const { return !(*this == other); } template<typename Type>inline Type& IteratorVector<Type>::operator*() const { return this->element(); } #endif // !VECTOR_H
61e2569dd94656d13a293b1a1ce8e6af692bb3b7
0dd4731848ce00ece780adaaccf3a6083afeca79
/music_player_core/albummodel.h
5fb51b4b93a98cfb7638fa07ffb04e31c57eb3b3
[]
no_license
merq312/qt_music_player
1894944d98418d69e9ba70c63f5c1f44508f1898
191f3504366a9d2dca9ad5cca129f54cabc24454
refs/heads/master
2023-08-24T19:34:26.296373
2021-10-04T04:47:41
2021-10-04T04:47:41
413,277,261
0
0
null
null
null
null
UTF-8
C++
false
false
886
h
#ifndef ALBUMMODEL_H #define ALBUMMODEL_H #include "music_player_core_global.h" #include <QAbstractListModel> #include <QPair> #include <QString> #include "databasemanager.h" class QPixmap; class MUSIC_PLAYER_CORE_EXPORT AlbumModel : public QAbstractListModel { Q_OBJECT public: enum Roles { ArtistNameRole = Qt::UserRole + 1, }; AlbumModel(QObject *parent = 0); void refreshAlbumList(); int rowCount(const QModelIndex& parent = QModelIndex()) const override; bool removeRows(int row, int count, const QModelIndex& parent) override; QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override; private: bool isIndexValid(const QModelIndex& index) const; private: DatabaseManager &_db; QList<QPair<QString, QString>> _albumList; QList<QPixmap *> _coverArtList; }; #endif // ALBUMMODEL_H
9537ac8fe5fdc71c829f639a11083a69464a9b24
06bfbd7d0336a0e054bed3787363a702baa423ac
/Library/Network/BitTorrent/DHT/NodeId.cpp
e6e93a5a20335147274baef01f9d08aa3a4846e6
[]
no_license
Y2JB/Bittorrent
50a07ee3b851684e892bf2999ba9ff381625f759
825d0282ad3da577953b908fd8e13d063bb20389
refs/heads/master
2023-01-14T14:32:15.957897
2020-11-27T10:35:19
2020-11-27T10:35:19
240,065,485
0
0
null
null
null
null
UTF-8
C++
false
false
2,077
cpp
// Jon Bellamy 18/11/2009 #include "NodeId.h" #include <assert.h> #include <memory.h> #include "General/Rand.h" cDhtNodeId::cDhtNodeId() { Randomize(); }// END cDhtNodeId cDhtNodeId::cDhtNodeId(const std::string& data) { assert(data.size() == NODE_ID_SIZE); if(data.size() == NODE_ID_SIZE) { FromData(reinterpret_cast<const u8*>(data.c_str())); } }// END cDhtNodeId cDhtNodeId::cDhtNodeId(const cDhtNodeId& rhs) { *this = rhs; }// END cDhtNodeId void cDhtNodeId::Randomize() { for(u32 i=0; i < NODE_ID_SIZE; i++) { mNodeId[i] = (u8)Rand16(0xFF); } }// END Randomize void cDhtNodeId::FromData(const u8* data) { memcpy(mNodeId, data, NODE_ID_SIZE); }// END FromData const cDhtNodeId& cDhtNodeId::operator= (const cDhtNodeId& rhs) { memcpy(mNodeId, rhs.mNodeId, NODE_ID_SIZE); return *this; }// END operator= bool cDhtNodeId::operator== (const cDhtNodeId& rhs) const { return memcmp(mNodeId, rhs.mNodeId, NODE_ID_SIZE) == 0; }// END operator== bool cDhtNodeId::operator< (const cDhtNodeId& rhs) const { if (*this == rhs) { return false; } else { for(u32 i=0; i < NODE_ID_SIZE; i++) { if(mNodeId[i] != rhs.mNodeId[i]) { if(mNodeId[i] < rhs.mNodeId[i]) { return true; } else { return false; } } } } assert(0); return true; }// END operator< bool cDhtNodeId::IsValid() const { return (memcmp(mNodeId, INVALID_NODE_ID, sizeof(mNodeId)) != 0); }// END IsValid std::string cDhtNodeId::AsString() const { return std::string(reinterpret_cast<const char*>(&mNodeId[0]), NODE_ID_SIZE); }// END AsString void cDhtNodeId::DebugPrint() const { for(u32 i=0; i < NODE_ID_SIZE; i++) { Printf("%.2X ", mNodeId[i]); } }// END DebugPrint u32 DistanceBetweenDhtNodes(const cDhtNodeId& lhs, const cDhtNodeId& rhs) { u32 ret=0; for(u32 i=0; i < cDhtNodeId::NODE_ID_SIZE; i++) { ret += (lhs[i] ^ rhs[i]); } return ret; }// END DistanceBetweenDhtNodes
78558a9f8f78fb026df91819083b2fb53ac7519b
b2b9e4d616a6d1909f845e15b6eaa878faa9605a
/Genemardon/20150920北京网络赛/1007.cpp
2d864c52d403ca98595e8d058d3ee548783e3cca
[]
no_license
JinbaoWeb/ACM
db2a852816d2f4e395086b2b7f2fdebbb4b56837
021b0c8d9c96c1bc6e10374ea98d0706d7b509e1
refs/heads/master
2021-01-18T22:32:50.894840
2016-06-14T07:07:51
2016-06-14T07:07:51
55,882,694
0
0
null
null
null
null
UTF-8
C++
false
false
4,850
cpp
#include <stdio.h> #include <string.h> #include <algorithm> #include <stack> #include <queue> #include <map> using namespace std; struct node { stack<int>box[8]; int qid; long long nid; node () {} node (int qid, long long nid) : qid(qid), nid(nid) {} }; int ans[8][2000000]; long long base[100]; void init() { base[0] = 1; base[1] = 1; for (int i = 2; i <= 50; i++) base[i] = base[i - 1] * 2; } int fac[] = {1, 1, 2, 6, 24, 120, 720, 5040, 40320, 362880}; int cantor(int s[], int x) { int i, j, temp, num; num = 0; for (i = 1; i < x; i++) { temp = 0; for (int j = i + 1; j <= x; j++) { if (s[j] < s[i]) temp++; } num += fac[x - i] * temp; } return (num + 1); } void bfs(int x) { queue<node>q; map<long long, int>M; M.clear(); printf("%d\n", M[10] ); int cnt = 0; int head = 0; for (int i = 1; i <= x; i++) head = head + base[(i - 1) * x + i]; node nn = node(cnt, head); for (int i = 1; i <= x; i++) nn.box[i].push(i); q.push(nn); M[head] = 1; while (!q.empty()) { node tmp = q.front(); //printf("%d %lld\n",tmp.qid,tmp.nid ); int flag = 1; int list[10]; for (int i = 1; i <= x; i++) { if (!tmp.box[i].empty()) list[i] = tmp.box[i].top(); if (tmp.box[i].size() != 1) { flag = 0; break; } } if (flag) ans[x][cantor(list, x)] = tmp.qid; q.pop(); //printf("111\n"); for (int i = 1; i <= x; i++) if (!(tmp.box[i].empty())) { //printf("222\n"); if (i > 1) { //printf("333\n"); if (tmp.box[i - 1].empty() || tmp.box[i - 1].top() > tmp.box[i].top()) { long long id = tmp.nid - base[(i - 1) * x + tmp.box[i].top()] + base[(i - 2) * x + tmp.box[i].top()]; if (M[id] == 0) { stack<int>save[8]; M[id] = tmp.qid + 1; node nnn = node(tmp.qid + 1, id); for (int j = 1; j <= x; j++) { while (!tmp.box[j].empty()) { save[j].push(tmp.box[j].top()); tmp.box[j].pop(); } while (!save[j].empty()) { tmp.box[j].push(save[j].top()); nnn.box[j].push(save[j].top()); save[j].pop(); } } nnn.box[i - 1].push(nnn.box[i].top()); nnn.box[i].pop(); q.push(nnn); } } } if (i < x) { //printf("444\n"); if (tmp.box[i + 1].empty() || tmp.box[i + 1].top() > tmp.box[i].top()) { long long id = tmp.nid - base[(i - 1) * x + tmp.box[i].top()] + base[(i) * x + tmp.box[i].top()]; if (M[id] == 0) { stack<int>save[8]; M[id] = tmp.qid + 1; node nnn = node(tmp.qid + 1, id); for (int j = 1; j <= x; j++) { while (!tmp.box[j].empty()) { save[j].push(tmp.box[j].top()); tmp.box[j].pop(); } while (!save[j].empty()) { tmp.box[j].push(save[j].top()); nnn.box[j].push(save[j].top()); save[j].pop(); } } nnn.box[i + 1].push(nnn.box[i].top()); nnn.box[i].pop(); q.push(nnn); } } } } } } int main(int argc, char const *argv[]) { init(); memset(ans,-1,sizeof(ans)); for (int i=1;i<=7;i++) bfs(i); printf("1111\n"); int list[10]={0,3,2,1}; printf("%d\n",ans[3][cantor(list,3)] ); return 0; }
431456dcf94122ccec10eec65c3b9a5d2e3647e7
f1a2325795dcd90f940e45a3535ac3a0cb765616
/development/TL1Services/TL1Core/TL1_DaDomain.h
afa5af47727d9207d5056febbc08de6aa33948ba
[]
no_license
MoonStart/Frame
45c15d1e6febd7eb390b74b891bc5c40646db5de
e3a3574e5c243d9282778382509858514585ae03
refs/heads/master
2021-01-01T19:09:58.670794
2015-12-02T07:52:55
2015-12-02T07:52:55
31,520,344
0
0
null
null
null
null
UTF-8
C++
false
false
2,117
h
#ifndef __TL1_DADOMAIN_H__ #define __TL1_DADOMAIN_H__ /*----------------------------------------------------------------------------- Copyright(c) Tellabs Transport Group Inc. All rights reserved. SUBSYSTEM: Software Services TARGET: AUTHOR: Keith Halsall - August 7, 2012 DESCRIPTION: Header file for TL1 DA Domain declaration -----------------------------------------------------------------------------*/ #ifdef WIN32 // Microsoft bug, identifier that exceeds 255 chars gets truncated #pragma warning(disable:4786) #endif #ifndef __TL1_RESPONSE_H__ #include <Response/TL1_Response.h> #endif #ifndef __CT_TL1_CONTROLPLANEADDR_H__ #include <CommonTypes/CT_TL1_ControlPlaneAddr.h> #endif #ifndef __CT_CONTROLPLANE_DEFINITIONS_H__ #include <CommonTypes/CT_ControlPlane_Definitions.h> #endif #ifndef __CT_SM_TYPES_H__ #include <CommonTypes/CT_SM_Types.h> #endif /** CLASS TL1_DaDomain This is a protocol (pure abstract base class defining an interface) that describes the set of system related TL1 commands, that a TL1 Entities for a system is expected to implement. This class contains no data member nor any default implementation. */ class TL1_DaDomain { public: virtual void EntDa( const CT_TL1_DiscoveryAgentAddr& theAddr, CT_TL1_LinkAddr* theDcnAddr, string* theMgtDomain, CT_SM_PST* thePst, TL1_Response& theResponse ) = 0; virtual void EdDa( const CT_TL1_DiscoveryAgentAddr& theAddr, CT_SM_PST* thePst, TL1_Response& theResponse ) = 0; virtual void DltDa( const CT_TL1_DiscoveryAgentAddr& theAddr, TL1_Response& theResponse ) = 0; virtual void RtrvDa(const CT_TL1_DiscoveryAgentAddr& theAddr, TL1_Response& theResponse )const = 0; }; #endif
b2ba43b4608d26d188f0be138de8d2b0a587a0b3
c81561d479c823a61be71c62f3c20ea166811b88
/solution/Priprema3_dodatak/Zabava.h
8c8b044e820b210ed8066a103e6c45aaa5b6d102
[]
no_license
Metlina/oop
f864d89bb18d041358842f6f6977393b94f2d755
a2dd1714876871e62fe2241e0b68b3de6e26906d
refs/heads/master
2021-01-19T04:52:25.901947
2015-01-30T23:21:50
2015-01-30T23:21:50
30,095,027
3
0
null
null
null
null
UTF-8
C++
false
false
418
h
#include <vector> #include <string> #include "Prijatelj.h" using namespace std; class Zabava { private: vector<Prijatelj*> uzvanici; vector<Pice*> popisPica; double budzet; public: Zabava(double budzet); ~Zabava(void); void dodajPrijatelja(Prijatelj* prijatelj); void dodajPice(Pice* pice); double getBudzet(); Prijatelj* getPrijatelj(int id); Pice* nadjiPice(int PiceId); void ispisiPopisZaKupnju(); };
0d5b02ccc8d0cfc4f663ce0e7998da18e2fe71d2
78b28019e10962bb62a09fa1305264bbc9a113e3
/common/geometry/kdtree/info/update_node_to_root.h
6eb1b7b02f555717a5dd6f21e9ad81e3761369e2
[ "MIT" ]
permissive
Loks-/competitions
49d253c398bc926bfecc78f7d468410702f984a0
26a1b15f30bb664a308edc4868dfd315eeca0e0b
refs/heads/master
2023-06-08T06:26:36.756563
2023-05-31T03:16:41
2023-05-31T03:16:41
135,969,969
5
2
null
null
null
null
UTF-8
C++
false
false
311
h
#pragma once #include "common/binary_search_tree/info/update_node_to_root.h" namespace geometry { namespace kdtree { namespace info { template <class TNode> inline void UpdateNodeToRoot(TNode* node) { bst::info::UpdateNodeToRoot(node); } } // namespace info } // namespace kdtree } // namespace geometry
dcf92a2fad301bfaece8d5276c1dd7d3515af95c
0aea33bf1e2768895bf37a3048008489e8f7aa27
/export/windows/cpp/obj/include/flixel/FlxG.h
840f934b54c70c53c7f0a5fe2592903fc62a7c4e
[]
no_license
ninjamuffin99/ProjectMountain
5f96e3713fe77ee97e081dfd2f46bba32e526cb7
63f41b0345b789b1bd2bf05cb904e66ff9d35631
refs/heads/master
2021-01-01T16:22:44.354766
2017-07-25T21:06:40
2017-07-25T21:06:40
97,814,887
0
0
null
null
null
null
UTF-8
C++
false
true
8,295
h
// Generated by Haxe 3.4.0 #ifndef INCLUDED_flixel_FlxG #define INCLUDED_flixel_FlxG #ifndef HXCPP_H #include <hxcpp.h> #endif HX_DECLARE_CLASS1(flixel,FlxBasic) HX_DECLARE_CLASS1(flixel,FlxCamera) HX_DECLARE_CLASS1(flixel,FlxG) HX_DECLARE_CLASS1(flixel,FlxGame) HX_DECLARE_CLASS1(flixel,FlxObject) HX_DECLARE_CLASS1(flixel,FlxRenderMethod) HX_DECLARE_CLASS1(flixel,FlxSprite) HX_DECLARE_CLASS1(flixel,FlxState) HX_DECLARE_CLASS3(flixel,effects,postprocess,PostProcess) HX_DECLARE_CLASS2(flixel,group,FlxTypedGroup) HX_DECLARE_CLASS2(flixel,input,FlxKeyManager) HX_DECLARE_CLASS2(flixel,input,FlxPointer) HX_DECLARE_CLASS2(flixel,input,FlxSwipe) HX_DECLARE_CLASS2(flixel,input,IFlxInputManager) HX_DECLARE_CLASS3(flixel,input,gamepad,FlxGamepadManager) HX_DECLARE_CLASS3(flixel,input,keyboard,FlxKeyboard) HX_DECLARE_CLASS3(flixel,input,mouse,FlxMouse) HX_DECLARE_CLASS2(flixel,math,FlxRandom) HX_DECLARE_CLASS2(flixel,math,FlxRect) HX_DECLARE_CLASS2(flixel,_hx_system,FlxVersion) HX_DECLARE_CLASS3(flixel,_hx_system,frontEnds,BitmapFrontEnd) HX_DECLARE_CLASS3(flixel,_hx_system,frontEnds,BitmapLogFrontEnd) HX_DECLARE_CLASS3(flixel,_hx_system,frontEnds,CameraFrontEnd) HX_DECLARE_CLASS3(flixel,_hx_system,frontEnds,ConsoleFrontEnd) HX_DECLARE_CLASS3(flixel,_hx_system,frontEnds,DebuggerFrontEnd) HX_DECLARE_CLASS3(flixel,_hx_system,frontEnds,InputFrontEnd) HX_DECLARE_CLASS3(flixel,_hx_system,frontEnds,LogFrontEnd) HX_DECLARE_CLASS3(flixel,_hx_system,frontEnds,PluginFrontEnd) HX_DECLARE_CLASS3(flixel,_hx_system,frontEnds,SignalFrontEnd) HX_DECLARE_CLASS3(flixel,_hx_system,frontEnds,SoundFrontEnd) HX_DECLARE_CLASS3(flixel,_hx_system,frontEnds,VCRFrontEnd) HX_DECLARE_CLASS3(flixel,_hx_system,frontEnds,WatchFrontEnd) HX_DECLARE_CLASS3(flixel,_hx_system,scaleModes,BaseScaleMode) HX_DECLARE_CLASS2(flixel,util,FlxSave) HX_DECLARE_CLASS2(flixel,util,IFlxDestroyable) HX_DECLARE_CLASS2(flixel,util,IFlxPooled) HX_DECLARE_CLASS3(openfl,_legacy,display,DirectRenderer) HX_DECLARE_CLASS3(openfl,_legacy,display,DisplayObject) HX_DECLARE_CLASS3(openfl,_legacy,display,DisplayObjectContainer) HX_DECLARE_CLASS3(openfl,_legacy,display,IBitmapDrawable) HX_DECLARE_CLASS3(openfl,_legacy,display,InteractiveObject) HX_DECLARE_CLASS3(openfl,_legacy,display,OpenGLView) HX_DECLARE_CLASS3(openfl,_legacy,display,Sprite) HX_DECLARE_CLASS3(openfl,_legacy,display,Stage) HX_DECLARE_CLASS3(openfl,_legacy,events,EventDispatcher) HX_DECLARE_CLASS3(openfl,_legacy,events,IEventDispatcher) namespace flixel{ class HXCPP_CLASS_ATTRIBUTES FlxG_obj : public hx::Object { public: typedef hx::Object super; typedef FlxG_obj OBJ_; FlxG_obj(); public: enum { _hx_ClassId = 0x304c4dd1 }; void __construct(); inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="flixel.FlxG") { return hx::Object::operator new(inSize,inContainer,inName); } inline void *operator new(size_t inSize, int extra) { return hx::Object::operator new(inSize+extra,false,"flixel.FlxG"); } hx::ObjectPtr< FlxG_obj > __new() { hx::ObjectPtr< FlxG_obj > __this = new FlxG_obj(); __this->__construct(); return __this; } static hx::ObjectPtr< FlxG_obj > __alloc(hx::Ctx *_hx_ctx) { FlxG_obj *__this = (FlxG_obj*)(hx::Ctx::alloc(_hx_ctx, sizeof(FlxG_obj), false, "flixel.FlxG")); *(void **)__this = FlxG_obj::_hx_vtable; return __this; } static void * _hx_vtable; static Dynamic __CreateEmpty(); static Dynamic __Create(hx::DynamicArray inArgs); //~FlxG_obj(); HX_DO_RTTI_ALL; static bool __GetStatic(const ::String &inString, Dynamic &outValue, hx::PropertyAccess inCallProp); static bool __SetStatic(const ::String &inString, Dynamic &ioValue, hx::PropertyAccess inCallProp); static void __register(); bool _hx_isInstanceOf(int inClassId); ::String __ToString() const { return HX_HCSTRING("FlxG","\xb5","\x4b","\x97","\x2e"); } static void __boot(); static bool autoPause; static bool fixedTimestep; static Float timeScale; static int worldDivisions; static ::flixel::FlxCamera camera; static ::flixel::_hx_system::FlxVersion VERSION; static ::flixel::FlxGame game; static int updateFramerate; static int drawFramerate; static ::flixel::FlxRenderMethod renderMethod; static bool renderBlit; static bool renderTile; static Float elapsed; static Float maxElapsed; static int width; static int height; static ::flixel::_hx_system::scaleModes::BaseScaleMode scaleMode; static ::flixel::math::FlxRect worldBounds; static ::flixel::util::FlxSave save; static ::flixel::math::FlxRandom random; static ::flixel::input::mouse::FlxMouse mouse; static ::Array< ::Dynamic> swipes; static ::flixel::input::keyboard::FlxKeyboard keys; static ::flixel::input::gamepad::FlxGamepadManager gamepads; static ::flixel::_hx_system::frontEnds::InputFrontEnd inputs; static ::flixel::_hx_system::frontEnds::ConsoleFrontEnd console; static ::flixel::_hx_system::frontEnds::LogFrontEnd log; static ::flixel::_hx_system::frontEnds::BitmapLogFrontEnd bitmapLog; static ::flixel::_hx_system::frontEnds::WatchFrontEnd watch; static ::flixel::_hx_system::frontEnds::DebuggerFrontEnd debugger; static ::flixel::_hx_system::frontEnds::VCRFrontEnd vcr; static ::flixel::_hx_system::frontEnds::BitmapFrontEnd bitmap; static ::flixel::_hx_system::frontEnds::CameraFrontEnd cameras; static ::flixel::_hx_system::frontEnds::PluginFrontEnd plugins; static int initialWidth; static int initialHeight; static Float initialZoom; static ::flixel::_hx_system::frontEnds::SoundFrontEnd sound; static ::flixel::_hx_system::frontEnds::SignalFrontEnd signals; static void resizeGame(int Width,int Height); static ::Dynamic resizeGame_dyn(); static void resizeWindow(int Width,int Height); static ::Dynamic resizeWindow_dyn(); static void resetGame(); static ::Dynamic resetGame_dyn(); static void switchState( ::flixel::FlxState nextState); static ::Dynamic switchState_dyn(); static void resetState(); static ::Dynamic resetState_dyn(); static bool overlap( ::flixel::FlxBasic ObjectOrGroup1, ::flixel::FlxBasic ObjectOrGroup2, ::Dynamic NotifyCallback, ::Dynamic ProcessCallback); static ::Dynamic overlap_dyn(); static bool pixelPerfectOverlap( ::flixel::FlxSprite Sprite1, ::flixel::FlxSprite Sprite2,hx::Null< int > AlphaTolerance, ::flixel::FlxCamera Camera); static ::Dynamic pixelPerfectOverlap_dyn(); static bool collide( ::flixel::FlxBasic ObjectOrGroup1, ::flixel::FlxBasic ObjectOrGroup2, ::Dynamic NotifyCallback); static ::Dynamic collide_dyn(); static ::flixel::effects::postprocess::PostProcess addPostProcess( ::flixel::effects::postprocess::PostProcess postProcess); static ::Dynamic addPostProcess_dyn(); static void removePostProcess( ::flixel::effects::postprocess::PostProcess postProcess); static ::Dynamic removePostProcess_dyn(); static void chainPostProcesses(); static ::Dynamic chainPostProcesses_dyn(); static void openURL(::String URL,::String Target); static ::Dynamic openURL_dyn(); static void init( ::flixel::FlxGame Game,int Width,int Height,Float Zoom); static ::Dynamic init_dyn(); static void initRenderMethod(); static ::Dynamic initRenderMethod_dyn(); static void reset(); static ::Dynamic reset_dyn(); static ::flixel::_hx_system::scaleModes::BaseScaleMode set_scaleMode( ::flixel::_hx_system::scaleModes::BaseScaleMode ScaleMode); static ::Dynamic set_scaleMode_dyn(); static ::flixel::input::mouse::FlxMouse set_mouse( ::flixel::input::mouse::FlxMouse NewMouse); static ::Dynamic set_mouse_dyn(); static int set_updateFramerate(int Framerate); static ::Dynamic set_updateFramerate_dyn(); static int set_drawFramerate(int Framerate); static ::Dynamic set_drawFramerate_dyn(); static bool get_fullscreen(); static ::Dynamic get_fullscreen_dyn(); static bool set_fullscreen(bool Value); static ::Dynamic set_fullscreen_dyn(); static ::openfl::_legacy::display::Stage get_stage(); static ::Dynamic get_stage_dyn(); static ::flixel::FlxState get_state(); static ::Dynamic get_state_dyn(); static bool get_onMobile(); static ::Dynamic get_onMobile_dyn(); }; } // end namespace flixel #endif /* INCLUDED_flixel_FlxG */
2c38f8a315020e5f8efe4ff1815ab52e4c783912
ed6cc29968179d13bb30c73dbf2be2fb6469d495
/P86/BASE/Pizza.h
3a7f7f6eb7cdde3c6f6823617ac1a075b73ea2bc
[]
no_license
sindri69/pizza420
e0880eea7eb0dbdeabae3dc675dba732a1778d90
a0f78b59b5830ff67e9b5456a6e6d229869628f5
refs/heads/master
2021-08-28T14:59:32.423484
2017-12-12T14:19:05
2017-12-12T14:19:05
112,332,570
0
0
null
null
null
null
UTF-8
C++
false
false
679
h
#ifndef PIZZA_H #define PIZZA_H #include <string> #include <iostream> using namespace std; class Pizza { public: Pizza(string psize, string ptype, string ptopping, double pprice, bool ppayedfor, int pstatus); string get_psize() const; string get_ptype() const; string get_ptopping() const; double get_pprice() const; bool get_ppayedfor() const; int get_pstatus() const; friend ostream& operator << (ostream& out, const Pizza& pizza); private: string psize; string ptype; string ptopping; double pprice; bool ppayedfor; int pstatus; }; #endif // PIZZA_H
28e143bbb70b47096a6827d25f27b95d48ad2d8a
9f9dce45e477007505617aa428945e35e8db4e6e
/modules/task_1/novozhilova_e_labeling/main.cpp
abb839c11a23963560784d0e46cc73d4695ec7a4
[ "BSD-3-Clause" ]
permissive
Sergey01923/pp_2021_spring_informatics
bbce7351e391463868e8cb5bc848d6d2d46fbd47
1499ac172be6b57ba9fde633873360b51a54644f
refs/heads/master
2023-05-11T10:02:26.907924
2021-06-04T10:54:25
2021-06-04T10:54:25
352,624,861
0
0
BSD-3-Clause
2021-04-18T19:17:46
2021-03-29T11:51:20
null
UTF-8
C++
false
false
6,708
cpp
// Copyright 2021 Novozhilova Ekaterina #include <gtest/gtest.h> #include "./labeling.h" TEST(Sequential, Test_10x10) { std::vector<std::vector<int>> arr = {{1, 0, 0, 0, 0, 0, 0, 0, 0, 0}, {1, 0, 1, 1, 0, 0, 0, 0, 1, 0}, {1, 0, 0, 1, 0, 1, 1, 0, 0, 0}, {0, 0, 0, 0, 0, 1, 1, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 1, 0, 0, 0}, {0, 0, 0, 1, 0, 1, 0, 0, 0, 0}, {0, 0, 1, 1, 1, 1, 1, 0, 0, 0}, {0, 0, 0, 1, 1, 1, 0, 0, 1, 1}, {1, 0, 0, 0, 1, 0, 0, 0, 1, 1}, {0, 0, 0, 0, 0, 0, 0, 0, 1, 1}}; std::vector<std::vector<int>> expected = {{1, 0, 0, 0, 0, 0, 0, 0, 0, 0}, {1, 0, 2, 2, 0, 0, 0, 0, 3, 0}, {1, 0, 0, 2, 0, 4, 4, 0, 0, 0}, {0, 0, 0, 0, 0, 4, 4, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 4, 0, 0, 0}, {0, 0, 0, 5, 0, 5, 0, 0, 0, 0}, {0, 0, 5, 5, 5, 5, 5, 0, 0, 0}, {0, 0, 0, 5, 5, 5, 0, 0, 6, 6}, {7, 0, 0, 0, 5, 0, 0, 0, 6, 6}, {0, 0, 0, 0, 0, 0, 0, 0, 6, 6}}; std::vector<std::vector<int>> res; res = Labeling(arr, 10, 10); ASSERT_EQ(expected, res); } TEST(Sequential, Test_15x15) { std::vector<std::vector<int>> arr = {{1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1}, {0, 0, 1, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 1}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0}, {0, 0, 1, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0}, {0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 1, 0, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 1, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0}, {1, 0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0}, {1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0}, {1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0}, {1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0}, {1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}; std::vector<std::vector<int>> expected = {{1, 0, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3}, {0, 0, 2, 0, 0, 0, 4, 4, 4, 4, 4, 0, 0, 0, 3}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0}, {0, 0, 5, 0, 0, 4, 4, 4, 4, 4, 4, 0, 0, 0, 0}, {0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 5, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 5, 0, 5, 0, 6, 6, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 5, 5, 5, 0, 6, 6, 0, 0, 0, 0, 0, 0}, {7, 0, 5, 5, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0}, {7, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0}, {7, 0, 0, 0, 0, 5, 5, 5, 5, 5, 5, 0, 0, 0, 0}, {7, 0, 0, 0, 0, 0, 5, 5, 0, 0, 0, 0, 0, 0, 0}, {7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}; std::vector<std::vector<int>> res; res = Labeling(arr, 15, 15); ASSERT_EQ(expected, res); } TEST(Sequential, Test_5x5) { std::vector<std::vector<int>> arr = {{0, 0, 1, 1, 1}, {0, 0, 0, 0, 1}, {1, 1, 0, 0, 0}, {0, 0, 0, 0, 0}, {0, 0, 1, 0, 0}}; std::vector<std::vector<int>> expected = {{0, 0, 1, 1, 1}, {0, 0, 0, 0, 1}, {2, 2, 0, 0, 0}, {0, 0, 0, 0, 0}, {0, 0, 3, 0, 0}}; std::vector<std::vector<int>> res; res = Labeling(arr, 5, 5); ASSERT_EQ(expected, res); } TEST(Sequential, Test_Empty) { std::vector<std::vector<int>> arr = {{0, 0, 0, 0, 0}, {0, 0, 0, 0, 0}, {0, 0, 0, 0, 0}, {0, 0, 0, 0, 0}, {0, 0, 0, 0, 0}}; std::vector<std::vector<int>> expected = {{0, 0, 0, 0, 0}, {0, 0, 0, 0, 0}, {0, 0, 0, 0, 0}, {0, 0, 0, 0, 0}, {0, 0, 0, 0, 0}}; std::vector<std::vector<int>> res; res = Labeling(arr, 5, 5); ASSERT_EQ(expected, res); } TEST(Sequential, Test_Full) { std::vector<std::vector<int>> arr = {{1, 1, 1, 1, 1}, {1, 1, 1, 1, 1}, {1, 1, 1, 1, 1}, {1, 1, 1, 1, 1}, {1, 1, 1, 1, 1}}; std::vector<std::vector<int>> expected = {{1, 1, 1, 1, 1}, {1, 1, 1, 1, 1}, {1, 1, 1, 1, 1}, {1, 1, 1, 1, 1}, {1, 1, 1, 1, 1}}; std::vector<std::vector<int>> res; res = Labeling(arr, 5, 5); ASSERT_EQ(expected, res); }
9688c31303ddfba6c187db6d3fb72ea775e29468
285c86812338bc61a0bdbe0f470981ac6c26a317
/SEASON_1/K번째 수(백준)/JY_K번째 수.cpp
f37f47f620062e91d5568d30881c631a4789121a
[]
no_license
Dinoryong/algo-dinner
7d296c84423586d25f5aecbf840139e397d8fb2d
ed49b0ef896e9d21d9e5893ba0d93555626cbaeb
refs/heads/main
2023-06-24T14:18:12.495121
2021-07-20T14:08:49
2021-07-20T14:08:49
350,269,755
5
4
null
2021-07-01T14:19:28
2021-03-22T08:46:40
Swift
UTF-8
C++
false
false
488
cpp
#include <iostream> #include <string> #include <cstring> #include <algorithm> using namespace std; long long N, K; long long answer = 0; int main() { cin >> N >> K; long long left = 1, right = K; while (left <= right) { long long mid = (left + right) >> 1; long long cnt = 0; for (int i = 1; i <= N; i++) { cnt += min(N, mid / i); } if (cnt >= K) { right = mid - 1; answer = mid; } else left = mid + 1; } cout << answer; system("pause"); return 0; }
d55a68d0d296fdddb0c0906a7040e63bd0098c4e
96efae6f60910a17deb08346b33903c0b1fe2403
/MFC Windows应用程序设计(第3版)/31273MFC Windows应用程序设计(第3版)/教材例题代码/04章例题代码/MyPrj/MyPrj.h
d0aa640a576f913836b1f970910f210acfaf43c9
[]
no_license
truehaolix/DissectingMFC_SourceCode
bfa38219cc342eed4ddb8e34e1c4ee23bc4d4098
c9ea97c50af7c2535b04eabf0fc6ec1a46591316
refs/heads/master
2021-12-14T21:34:11.132192
2017-06-03T05:43:50
2017-06-03T05:43:50
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,345
h
// MyPrj.h : main header file for the MYPRJ application // #if !defined(AFX_MYPRJ_H__AD7D6524_5958_11D8_B98F_0000E8D3C09B__INCLUDED_) #define AFX_MYPRJ_H__AD7D6524_5958_11D8_B98F_0000E8D3C09B__INCLUDED_ #if _MSC_VER > 1000 #pragma once #endif // _MSC_VER > 1000 #ifndef __AFXWIN_H__ #error include 'stdafx.h' before including this file for PCH #endif #include "resource.h" // main symbols ///////////////////////////////////////////////////////////////////////////// // CMyPrjApp: // See MyPrj.cpp for the implementation of this class // class CMyPrjApp : public CWinApp { public: CMyPrjApp(); // Overrides // ClassWizard generated virtual function overrides //{{AFX_VIRTUAL(CMyPrjApp) public: virtual BOOL InitInstance(); //}}AFX_VIRTUAL // Implementation //{{AFX_MSG(CMyPrjApp) afx_msg void OnAppAbout(); // NOTE - the ClassWizard will add and remove member functions here. // DO NOT EDIT what you see in these blocks of generated code ! //}}AFX_MSG DECLARE_MESSAGE_MAP() }; ///////////////////////////////////////////////////////////////////////////// //{{AFX_INSERT_LOCATION}} // Microsoft Visual C++ will insert additional declarations immediately before the previous line. #endif // !defined(AFX_MYPRJ_H__AD7D6524_5958_11D8_B98F_0000E8D3C09B__INCLUDED_)
d60217c5b8e78d19c106974afc509f5cec2fcf29
2e1f21a5e1280158b46116f9156dac5ee091b290
/queue/queue.cpp
72d4fee18832036e11135670cf3caf05d6f3ba9c
[]
no_license
shenhangke/DataStructAndOS
55b3dea1e5e07fb494fd5c9b9ef17a94ed3d95bb
cc62e9ad8e9e3330b92cc9d8022c5eb3ae8ecc7d
refs/heads/master
2020-07-10T10:20:16.631121
2019-09-30T04:44:54
2019-09-30T04:44:54
204,239,923
0
0
null
null
null
null
UTF-8
C++
false
false
3,461
cpp
// // Created by 沈航可 on 2019-08-23. // /* * 队列满的条件是 * (rear+1)%queueSize==?front * 计算队列长度的公式: * (rear-front+queueSize)%queueSize * */ /* * 栈的结构,是只能在线性表的一头进行插入和删除操作 * 相对应的操作就是pop,和push * * * 队列的本质,也是线性表,我们对这个表进行操作的时候,只能在这个表的一头进行插入操作,另外一头,进行删除操作 * 0 1 2 3 4 * ------------------------ * 1 | 2| 3| 4|5| * ------------------------ * 我们暂时使用顺序结构来进行说明 * * * 1 2 3 4 5 * * 如果我们现在要删除一个数据,只能够删除5,因为5这个元素,是在这个线性表的最尾端 * 如果我们要插入一个元素,我们只能把这个元素插入到线性表的开头,也就是1的前面 * * 8这个元素插入到这个队列中 * 8 1 2 3 4 5 * * 如果我要删除一个元素从线性表中删除一个元素,我只能删除5 * * * 对应对栈的pop和push操作,队列中也有相应的操作 * 分别叫做,出队,和入队 * * **/ int arr[10]; //令这个数组就是一个队列 //所以我需要定义两个指针,一个指向队头,一个指向队尾 int front,rear; void initQueue(){ front=0; rear=0; } /* front | ------------- 5|2 | 1 | 8| 5|2|1|8 ------------- | rear 如果我们要插入一个元素,我们就保持头指针不变,在尾指针指向的地址处,填入元素,然后让尾指针加1 如果我要进行删除操作,那么我们就保持尾指针不变,让头指针+1 那么在这种情况下,队列的长度,就是rear-front 在一般队列中,队列长度的计算方法是 rear-front 判断一个队列是不是为空,只需要判断 front?=rear 还有一种队列,叫做循环队列 跟一般的队列结构不同的地方在于,如果我添加元素到了数组的末尾,想要再添加元素(在队列还可以添加元素的时候,就是说我申请的这个数组只中前面 部分还有空余)的时候,我可以将尾指针,指向这个数据的开头元素,从数据开头的元素开始重新使用 在这种操作情况下, 队列为空的时候,头尾指针是相等的,但是当队列满了的时候,头尾指针也是相等的 那么,我们就需要解决,怎么判断这个队列是空的还是满的 4/3=1。。。1 5%4=1 在循环队列中,rear这个指针,有可能在front指针的前面,也有可能在他的后面 循环d队列满的条件是 (rear+1)%queueSize==?front 计算队列的长度 * (rear-front+queueSize)%queueSize * * 队列的链结构 * * front * | node_2->node_3->new_node * | * rear * * 我要在这个队列中,插入元素 * 1。把rear指向的这个节点的后继指针指向我要创建的新节点 * 2.把尾指针,指向新节点 * * 我要在这个队列中删除元素 * 1。首先,用一个临时指针,记录下当前front指针指向的节点地址 * 2.我把front指针指向当前指向的这个节点的后继节点 * 3。把tmp指向的那个节点,删除 * * 如果我们要判断这个链式结构的长度是不是为空 * 仅仅只需要判断头尾节点的只是不是一致,就可以了 */
650480ff89f17f80793ca5e9479566a2fa7dd7e5
12210a918a469378443453efbd4e3d9b9801babb
/cpp_basic_examples/hello_area_description/src/main/jni/hello_area_description/mini_timer.h
b58e34ee71cbb6774a1a3713d485a81e17c472e5
[ "LicenseRef-scancode-generic-cla", "LicenseRef-scancode-google-cla", "LicenseRef-scancode-warranty-disclaimer", "Libpng", "MIT", "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
permissive
JzHuai0108/tango-examples-c
4f0f04e23a0cd5a4686a04c9382b111aeffcfab0
51113f2d88d61749ea396b3f5a4bebbf7912327b
refs/heads/master
2021-07-01T22:32:28.297409
2020-08-11T14:19:22
2020-08-11T14:19:22
123,386,592
4
0
null
2018-03-01T05:28:21
2018-03-01T05:28:21
null
UTF-8
C++
false
false
399
h
// // Created by jhuai on 19-8-11. // #ifndef CPP_BASIC_EXAMPLES_MINITIMER_H #define CPP_BASIC_EXAMPLES_MINITIMER_H #include <sys/time.h> namespace timing { class Timer { struct timeval start_, end_; public: // start timer Timer(); // reset timer. void tic(); // stop timer // return elapsed time double toc(); }; } // namespace timing #endif //CPP_BASIC_EXAMPLES_MINITIMER_H
c8340a4c8282dc29de3560a359bb5a0d16aac555
f6439b5ed1614fd8db05fa963b47765eae225eb5
/chrome/browser/content_settings/content_settings_utils.h
97ee89a1617524d5a58f6f45a6aeb2063bd6c5db
[ "BSD-3-Clause" ]
permissive
aranajhonny/chromium
b8a3c975211e1ea2f15b83647b4d8eb45252f1be
caf5bcb822f79b8997720e589334266551a50a13
refs/heads/master
2021-05-11T00:20:34.020261
2018-01-21T03:31:45
2018-01-21T03:31:45
118,301,142
2
0
null
null
null
null
UTF-8
C++
false
false
3,027
h
// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_UTILS_H_ #define CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_UTILS_H_ #include <string> #include <utility> #include "chrome/common/content_settings.h" #include "chrome/common/content_settings_pattern.h" #include "chrome/common/content_settings_types.h" namespace base { class Value; } class GURL; class HostContentSettingsMap; namespace content_settings { class ProviderInterface; class RuleIterator; typedef std::pair<ContentSettingsPattern, ContentSettingsPattern> PatternPair; std::string GetTypeName(ContentSettingsType type); bool GetTypeFromName(const std::string& name, ContentSettingsType* return_setting); // Converts |Value| to |ContentSetting|. ContentSetting ValueToContentSetting(const base::Value* value); // Converts a |Value| to a |ContentSetting|. Returns true if |value| encodes // a valid content setting, false otherwise. Note that |CONTENT_SETTING_DEFAULT| // is encoded as a NULL value, so it is not allowed as an integer value. bool ParseContentSettingValue(const base::Value* value, ContentSetting* setting); PatternPair ParsePatternString(const std::string& pattern_str); std::string CreatePatternString( const ContentSettingsPattern& item_pattern, const ContentSettingsPattern& top_level_frame_pattern); // Caller takes the ownership of the returned |base::Value*|. base::Value* GetContentSettingValueAndPatterns( RuleIterator* rule_iterator, const GURL& primary_url, const GURL& secondary_url, ContentSettingsPattern* primary_pattern, ContentSettingsPattern* secondary_pattern); base::Value* GetContentSettingValueAndPatterns( const ProviderInterface* provider, const GURL& primary_url, const GURL& secondary_url, ContentSettingsType content_type, const std::string& resource_identifier, bool include_incognito, ContentSettingsPattern* primary_pattern, ContentSettingsPattern* secondary_pattern); base::Value* GetContentSettingValue( const ProviderInterface* provider, const GURL& primary_url, const GURL& secondary_url, ContentSettingsType content_type, const std::string& resource_identifier, bool include_incognito); ContentSetting GetContentSetting( const ProviderInterface* provider, const GURL& primary_url, const GURL& secondary_url, ContentSettingsType content_type, const std::string& resource_identifier, bool include_incognito); // Populates |rules| with content setting rules for content types that are // handled by the renderer. void GetRendererContentSettingRules(const HostContentSettingsMap* map, RendererContentSettingRules* rules); } // namespace content_settings #endif // CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_UTILS_H_
31197b839eaa9e1e45222dc71259fc793ca049a0
3cea356ef76eb8ff75e65afa4bd6368b7c94b064
/Projects/VideoGameProject/Obstacle.h
ab6f654b806ae18db9a0868ab3d025a893331759
[]
no_license
Jacophobia/OpenGL
e6961be528d9191c2d43b6ec449e221d408ad601
26b906115d2e918b07001f8fd9cb9f3d326fd2c1
refs/heads/main
2023-08-28T22:29:50.591405
2021-11-02T05:18:57
2021-11-02T05:18:57
423,021,347
0
0
null
null
null
null
UTF-8
C++
false
false
141
h
#ifndef OBSTACLE_H #define OBSTACLE_H #include "CollidableDynamicObject.h" class Obstacle : public CollidableDynamicObject { }; #endif
53d43b9b91b24ebc48fe66734569602998501f04
d8460da4691cf71f1121565bf6a4bc8cde1bf411
/ZEngine-Core/Scripting/Script.cpp
f5386f2dc18ac3ef85a298738d9f988151105221
[]
no_license
blizmax/zengine
99cae2e35ed5c999cf903e6baa11ecbff1273844
907e5029831b0b2c79bea148de971523c1045015
refs/heads/master
2022-01-05T05:35:53.380759
2019-01-03T01:50:46
2019-01-03T01:50:46
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,610
cpp
#include "Script.h" #include "ScriptSystem.h" #include <iostream> #include <fstream> Script::Script(std::string name) : ZObject(name, ObjectType::SCRIPT) { } bool Script::CompileFromFile(std::string path) { std::ifstream in(path, std::ios::in); if (in.is_open()) { std::string code((std::istreambuf_iterator<char>(in)), (std::istreambuf_iterator<char>())); return Compile(code); } else std::cout << "SCRIPT: Failed to open file for compilation for script: " << GetName() << std::endl; return false; } bool Script::Compile(std::string& code) { auto scriptSys = ScriptSystem::GetInstance(); auto isolate = scriptSys->GetIsolate(); auto context = scriptSys->GetContext()->GetLocal(); v8::Context::Scope scope(context); auto source = v8::String::NewFromUtf8(isolate, code.c_str()); auto script = v8::Script::Compile(context, source).ToLocalChecked(); if (script.IsEmpty()) { std::cout << "SCRIPT: Failed to compile script '" << GetName() << "'" << std::endl; return false; } _scriptObj.Reset(isolate, script->GetUnboundScript()); return true; } void Script::Execute() { auto scriptSys = ScriptSystem::GetInstance(); auto context = scriptSys->GetContext()->GetLocal(); // Create an execution scope for the script v8::Context::Scope scope(context); // Bind the script to the current context auto localScript = _scriptObj.Get(scriptSys->GetIsolate())->BindToCurrentContext(); // Execute the script localScript->Run(context); } ZObject* Script::CreateInstance(std::string name, ObjectType type) { return new Script(name); } Script::~Script() { _scriptObj.Reset(); }
00ed78ec3e9a90601449ccfc56a5a7e8069a366d
3fa1397b95e38fb04dac5e009d70c292deff09a9
/BaiTap_KTLT_0081_48/BaiTap_KTLT_0081_48.h
cf885e43e2b5eb0a25df8f396fb24b30bd08c38b
[]
no_license
nguyennhattruong96/BiboTraining_BaiTap_KTLT_Thay_NTTMKhang
61b396de5dc88cdad0021036c7db332eec26b5f3
1cac487672de9d3c881a8afdc410434a5042c128
refs/heads/master
2021-01-16T18:47:05.754323
2017-10-13T11:15:01
2017-10-13T11:15:01
100,113,344
0
0
null
null
null
null
UTF-8
C++
false
false
230
h
#ifndef __BaiTap_KTLT_0081_48_H__ #define __BaiTap_KTLT_0081_48_H__ #include <iostream> #include <string> using namespace std; #pragma once int Input(string sMessage); void Tich(int n); #endif // !__BaiTap_KTLT_0081_48_H__
3a199cb6e15715514f287c454528b91f2a207e50
e2ab2b9def0176a9092c2aeb9c916164cf2e4445
/AI.cpp
8b8e89f797fb457cfc8b9f088eb1bda8620e7561
[]
no_license
Elthron/Perudo
75829cfd2247f1fd0afcfe2138814d1ccd4fcbe9
1cf96a2f353b318fc188956dcb829a1672430b93
refs/heads/master
2020-09-16T12:41:16.982823
2016-10-14T19:44:04
2016-10-14T19:44:04
66,290,233
0
0
null
2016-09-02T18:05:04
2016-08-22T16:42:58
C++
UTF-8
C++
false
false
632
cpp
#include "AI.h" AI::AI(unsigned int die_size, std::string _name): Player(die_size, name) {} void AI:notify(Message& message) { //call the appropriate function corresponding to the message id switch(message.id) { case 1: recievePlayerList(message.players_vec); break; case 2: recieveNewBid(message.dice_number_,message.number_of_dice_, message.relevant_player); break; case 3: recieveDiceRoll(message.roll_values); break; case 4: recieveDiceLoss(message.relevant_player); break; default: //bid instruction messages do not need to be handled by AIs return; } }
259fc0019e45f0ffca6627bc7503950ba6e6f866
eb2ff965bb3a2deec83a99d28a79bfd68e57f072
/mainwidget.h
20a3c0fd959bcc34fa76907df79a3432ef75d246
[]
no_license
hermixy/PM-Qt
c2f31c9ad90c5005dcb8740b2c576a1f22f45f77
e98c6f35057c854b2e703f67feefe12ebc700d72
refs/heads/master
2021-01-15T11:02:56.841382
2014-11-27T22:32:23
2014-11-27T22:32:23
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,009
h
// Author: Dmitry Kukovinets ([email protected]) #ifndef MAINWIDGET_H #define MAINWIDGET_H #include <QtWidgets> #include "passwordlistwidget.h" #include "passwordcontentwidget.h" #include "settingssaver.h" class MainWidget: public QSplitter { Q_OBJECT // Properties Q_PROPERTY(PasswordListWidget *passwordListWidget READ passwordListWidget DESIGNABLE false SCRIPTABLE false USER false); Q_PROPERTY(PasswordContentWidget *passwordContentWidget READ passwordContentWidget DESIGNABLE false SCRIPTABLE false USER false); public: MainWidget(QWidget *parent = nullptr); void readSettings(QSettings &settings, const QString &prefix = ""); void writeSettings(QSettings &settings, const QString &prefix = "") const; virtual PasswordListWidget * passwordListWidget(); virtual PasswordContentWidget * passwordContentWidget(); private: PasswordListWidget *passwordListWidget_; PasswordContentWidget *passwordContentWidget_; }; #endif // MAINWIDGET_H
842024825ac8044e6b813f934b81c43a8a5891d2
40c884145f53abed8e845766a2ad1e2e232c2e4c
/ExRootAnalysis/tmp/modules/ModulesDict.cc
9bd295c924fd9b92efd8a56a1648f1b1a12ae045
[]
no_license
BradSchoenrock/MadGraph
ac3b0f461cbbb8ae41bb276fe4edb713a7ad2ab4
59b40c977dbab60ec7d21ef42d28955434d808a9
refs/heads/master
2020-03-23T11:42:34.982767
2018-07-19T04:29:27
2018-07-19T04:29:27
141,517,331
0
0
null
null
null
null
UTF-8
C++
false
false
103,651
cc
#define private public #define protected public #include "modules/MadGraphClassFilter.h" #include "modules/MadGraphAnalysis.h" #include "modules/MadGraphKtJetFinder.h" #include "modules/MadGraphConeJetFinder.h" #ifdef __CINT__ #pragma link off all globals; #pragma link off all classes; #pragma link off all functions; #pragma link C++ class MadGraphClassFilter+; #pragma link C++ class MadGraphAnalysis+; #pragma link C++ class MadGraphKtJetFinder+; #pragma link C++ class MadGraphConeJetFinder+; #endif // // File generated by rootcint at Tue Apr 2 11:04:25 2013 // Do NOT change. Changes will be lost next time file is generated // #define R__DICTIONARY_FILENAME tmpdImodulesdIModulesDict #include "RConfig.h" //rootcint 4834 #if !defined(R__ACCESS_IN_SYMBOL) //Break the privacy of classes -- Disabled for the moment #define private public #define protected public #endif // Since CINT ignores the std namespace, we need to do so in this file. namespace std {} using namespace std; #include "ModulesDict.h" #include "TCollectionProxyInfo.h" #include "TClass.h" #include "TBuffer.h" #include "TMemberInspector.h" #include "TError.h" #ifndef G__ROOT #define G__ROOT #endif #include "RtypesImp.h" #include "TIsAProxy.h" #include "TFileMergeInfo.h" // START OF SHADOWS namespace ROOT { namespace Shadow { } // of namespace Shadow } // of namespace ROOT // END OF SHADOWS namespace ROOT { void MadGraphClassFilter_ShowMembers(void *obj, TMemberInspector &R__insp); static void *new_MadGraphClassFilter(void *p = 0); static void *newArray_MadGraphClassFilter(Long_t size, void *p); static void delete_MadGraphClassFilter(void *p); static void deleteArray_MadGraphClassFilter(void *p); static void destruct_MadGraphClassFilter(void *p); // Function generating the singleton type initializer static TGenericClassInfo *GenerateInitInstanceLocal(const ::MadGraphClassFilter*) { ::MadGraphClassFilter *ptr = 0; static ::TVirtualIsAProxy* isa_proxy = new ::TInstrumentedIsAProxy< ::MadGraphClassFilter >(0); static ::ROOT::TGenericClassInfo instance("MadGraphClassFilter", ::MadGraphClassFilter::Class_Version(), "./modules/MadGraphClassFilter.h", 14, typeid(::MadGraphClassFilter), DefineBehavior(ptr, ptr), &::MadGraphClassFilter::Dictionary, isa_proxy, 4, sizeof(::MadGraphClassFilter) ); instance.SetNew(&new_MadGraphClassFilter); instance.SetNewArray(&newArray_MadGraphClassFilter); instance.SetDelete(&delete_MadGraphClassFilter); instance.SetDeleteArray(&deleteArray_MadGraphClassFilter); instance.SetDestructor(&destruct_MadGraphClassFilter); return &instance; } TGenericClassInfo *GenerateInitInstance(const ::MadGraphClassFilter*) { return GenerateInitInstanceLocal((::MadGraphClassFilter*)0); } // Static variable to force the class initialization static ::ROOT::TGenericClassInfo *_R__UNIQUE_(Init) = GenerateInitInstanceLocal((const ::MadGraphClassFilter*)0x0); R__UseDummy(_R__UNIQUE_(Init)); } // end of namespace ROOT namespace ROOT { void MadGraphAnalysis_ShowMembers(void *obj, TMemberInspector &R__insp); static void *new_MadGraphAnalysis(void *p = 0); static void *newArray_MadGraphAnalysis(Long_t size, void *p); static void delete_MadGraphAnalysis(void *p); static void deleteArray_MadGraphAnalysis(void *p); static void destruct_MadGraphAnalysis(void *p); // Function generating the singleton type initializer static TGenericClassInfo *GenerateInitInstanceLocal(const ::MadGraphAnalysis*) { ::MadGraphAnalysis *ptr = 0; static ::TVirtualIsAProxy* isa_proxy = new ::TInstrumentedIsAProxy< ::MadGraphAnalysis >(0); static ::ROOT::TGenericClassInfo instance("MadGraphAnalysis", ::MadGraphAnalysis::Class_Version(), "./modules/MadGraphAnalysis.h", 15, typeid(::MadGraphAnalysis), DefineBehavior(ptr, ptr), &::MadGraphAnalysis::Dictionary, isa_proxy, 4, sizeof(::MadGraphAnalysis) ); instance.SetNew(&new_MadGraphAnalysis); instance.SetNewArray(&newArray_MadGraphAnalysis); instance.SetDelete(&delete_MadGraphAnalysis); instance.SetDeleteArray(&deleteArray_MadGraphAnalysis); instance.SetDestructor(&destruct_MadGraphAnalysis); return &instance; } TGenericClassInfo *GenerateInitInstance(const ::MadGraphAnalysis*) { return GenerateInitInstanceLocal((::MadGraphAnalysis*)0); } // Static variable to force the class initialization static ::ROOT::TGenericClassInfo *_R__UNIQUE_(Init) = GenerateInitInstanceLocal((const ::MadGraphAnalysis*)0x0); R__UseDummy(_R__UNIQUE_(Init)); } // end of namespace ROOT namespace ROOT { void MadGraphKtJetFinder_ShowMembers(void *obj, TMemberInspector &R__insp); static void *new_MadGraphKtJetFinder(void *p = 0); static void *newArray_MadGraphKtJetFinder(Long_t size, void *p); static void delete_MadGraphKtJetFinder(void *p); static void deleteArray_MadGraphKtJetFinder(void *p); static void destruct_MadGraphKtJetFinder(void *p); // Function generating the singleton type initializer static TGenericClassInfo *GenerateInitInstanceLocal(const ::MadGraphKtJetFinder*) { ::MadGraphKtJetFinder *ptr = 0; static ::TVirtualIsAProxy* isa_proxy = new ::TInstrumentedIsAProxy< ::MadGraphKtJetFinder >(0); static ::ROOT::TGenericClassInfo instance("MadGraphKtJetFinder", ::MadGraphKtJetFinder::Class_Version(), "./modules/MadGraphKtJetFinder.h", 15, typeid(::MadGraphKtJetFinder), DefineBehavior(ptr, ptr), &::MadGraphKtJetFinder::Dictionary, isa_proxy, 4, sizeof(::MadGraphKtJetFinder) ); instance.SetNew(&new_MadGraphKtJetFinder); instance.SetNewArray(&newArray_MadGraphKtJetFinder); instance.SetDelete(&delete_MadGraphKtJetFinder); instance.SetDeleteArray(&deleteArray_MadGraphKtJetFinder); instance.SetDestructor(&destruct_MadGraphKtJetFinder); return &instance; } TGenericClassInfo *GenerateInitInstance(const ::MadGraphKtJetFinder*) { return GenerateInitInstanceLocal((::MadGraphKtJetFinder*)0); } // Static variable to force the class initialization static ::ROOT::TGenericClassInfo *_R__UNIQUE_(Init) = GenerateInitInstanceLocal((const ::MadGraphKtJetFinder*)0x0); R__UseDummy(_R__UNIQUE_(Init)); } // end of namespace ROOT namespace ROOT { void MadGraphConeJetFinder_ShowMembers(void *obj, TMemberInspector &R__insp); static void *new_MadGraphConeJetFinder(void *p = 0); static void *newArray_MadGraphConeJetFinder(Long_t size, void *p); static void delete_MadGraphConeJetFinder(void *p); static void deleteArray_MadGraphConeJetFinder(void *p); static void destruct_MadGraphConeJetFinder(void *p); // Function generating the singleton type initializer static TGenericClassInfo *GenerateInitInstanceLocal(const ::MadGraphConeJetFinder*) { ::MadGraphConeJetFinder *ptr = 0; static ::TVirtualIsAProxy* isa_proxy = new ::TInstrumentedIsAProxy< ::MadGraphConeJetFinder >(0); static ::ROOT::TGenericClassInfo instance("MadGraphConeJetFinder", ::MadGraphConeJetFinder::Class_Version(), "./modules/MadGraphConeJetFinder.h", 18, typeid(::MadGraphConeJetFinder), DefineBehavior(ptr, ptr), &::MadGraphConeJetFinder::Dictionary, isa_proxy, 4, sizeof(::MadGraphConeJetFinder) ); instance.SetNew(&new_MadGraphConeJetFinder); instance.SetNewArray(&newArray_MadGraphConeJetFinder); instance.SetDelete(&delete_MadGraphConeJetFinder); instance.SetDeleteArray(&deleteArray_MadGraphConeJetFinder); instance.SetDestructor(&destruct_MadGraphConeJetFinder); return &instance; } TGenericClassInfo *GenerateInitInstance(const ::MadGraphConeJetFinder*) { return GenerateInitInstanceLocal((::MadGraphConeJetFinder*)0); } // Static variable to force the class initialization static ::ROOT::TGenericClassInfo *_R__UNIQUE_(Init) = GenerateInitInstanceLocal((const ::MadGraphConeJetFinder*)0x0); R__UseDummy(_R__UNIQUE_(Init)); } // end of namespace ROOT //______________________________________________________________________________ TClass *MadGraphClassFilter::fgIsA = 0; // static to hold class pointer //______________________________________________________________________________ const char *MadGraphClassFilter::Class_Name() { return "MadGraphClassFilter"; } //______________________________________________________________________________ const char *MadGraphClassFilter::ImplFileName() { return ::ROOT::GenerateInitInstanceLocal((const ::MadGraphClassFilter*)0x0)->GetImplFileName(); } //______________________________________________________________________________ int MadGraphClassFilter::ImplFileLine() { return ::ROOT::GenerateInitInstanceLocal((const ::MadGraphClassFilter*)0x0)->GetImplFileLine(); } //______________________________________________________________________________ void MadGraphClassFilter::Dictionary() { fgIsA = ::ROOT::GenerateInitInstanceLocal((const ::MadGraphClassFilter*)0x0)->GetClass(); } //______________________________________________________________________________ TClass *MadGraphClassFilter::Class() { if (!fgIsA) fgIsA = ::ROOT::GenerateInitInstanceLocal((const ::MadGraphClassFilter*)0x0)->GetClass(); return fgIsA; } //______________________________________________________________________________ TClass *MadGraphAnalysis::fgIsA = 0; // static to hold class pointer //______________________________________________________________________________ const char *MadGraphAnalysis::Class_Name() { return "MadGraphAnalysis"; } //______________________________________________________________________________ const char *MadGraphAnalysis::ImplFileName() { return ::ROOT::GenerateInitInstanceLocal((const ::MadGraphAnalysis*)0x0)->GetImplFileName(); } //______________________________________________________________________________ int MadGraphAnalysis::ImplFileLine() { return ::ROOT::GenerateInitInstanceLocal((const ::MadGraphAnalysis*)0x0)->GetImplFileLine(); } //______________________________________________________________________________ void MadGraphAnalysis::Dictionary() { fgIsA = ::ROOT::GenerateInitInstanceLocal((const ::MadGraphAnalysis*)0x0)->GetClass(); } //______________________________________________________________________________ TClass *MadGraphAnalysis::Class() { if (!fgIsA) fgIsA = ::ROOT::GenerateInitInstanceLocal((const ::MadGraphAnalysis*)0x0)->GetClass(); return fgIsA; } //______________________________________________________________________________ TClass *MadGraphKtJetFinder::fgIsA = 0; // static to hold class pointer //______________________________________________________________________________ const char *MadGraphKtJetFinder::Class_Name() { return "MadGraphKtJetFinder"; } //______________________________________________________________________________ const char *MadGraphKtJetFinder::ImplFileName() { return ::ROOT::GenerateInitInstanceLocal((const ::MadGraphKtJetFinder*)0x0)->GetImplFileName(); } //______________________________________________________________________________ int MadGraphKtJetFinder::ImplFileLine() { return ::ROOT::GenerateInitInstanceLocal((const ::MadGraphKtJetFinder*)0x0)->GetImplFileLine(); } //______________________________________________________________________________ void MadGraphKtJetFinder::Dictionary() { fgIsA = ::ROOT::GenerateInitInstanceLocal((const ::MadGraphKtJetFinder*)0x0)->GetClass(); } //______________________________________________________________________________ TClass *MadGraphKtJetFinder::Class() { if (!fgIsA) fgIsA = ::ROOT::GenerateInitInstanceLocal((const ::MadGraphKtJetFinder*)0x0)->GetClass(); return fgIsA; } //______________________________________________________________________________ TClass *MadGraphConeJetFinder::fgIsA = 0; // static to hold class pointer //______________________________________________________________________________ const char *MadGraphConeJetFinder::Class_Name() { return "MadGraphConeJetFinder"; } //______________________________________________________________________________ const char *MadGraphConeJetFinder::ImplFileName() { return ::ROOT::GenerateInitInstanceLocal((const ::MadGraphConeJetFinder*)0x0)->GetImplFileName(); } //______________________________________________________________________________ int MadGraphConeJetFinder::ImplFileLine() { return ::ROOT::GenerateInitInstanceLocal((const ::MadGraphConeJetFinder*)0x0)->GetImplFileLine(); } //______________________________________________________________________________ void MadGraphConeJetFinder::Dictionary() { fgIsA = ::ROOT::GenerateInitInstanceLocal((const ::MadGraphConeJetFinder*)0x0)->GetClass(); } //______________________________________________________________________________ TClass *MadGraphConeJetFinder::Class() { if (!fgIsA) fgIsA = ::ROOT::GenerateInitInstanceLocal((const ::MadGraphConeJetFinder*)0x0)->GetClass(); return fgIsA; } //______________________________________________________________________________ void MadGraphClassFilter::Streamer(TBuffer &R__b) { // Stream an object of class MadGraphClassFilter. if (R__b.IsReading()) { R__b.ReadClassBuffer(MadGraphClassFilter::Class(),this); } else { R__b.WriteClassBuffer(MadGraphClassFilter::Class(),this); } } //______________________________________________________________________________ void MadGraphClassFilter::ShowMembers(TMemberInspector &R__insp) { // Inspect the data members of an object of class MadGraphClassFilter. TClass *R__cl = ::MadGraphClassFilter::IsA(); if (R__cl || R__insp.IsA()) { } R__insp.Inspect(R__cl, R__insp.GetParent(), "*fFilter", &fFilter); R__insp.Inspect(R__cl, R__insp.GetParent(), "*fClassifier", &fClassifier); R__insp.Inspect(R__cl, R__insp.GetParent(), "*fItParticle", &fItParticle); R__insp.Inspect(R__cl, R__insp.GetParent(), "*fBranchParticle", &fBranchParticle); R__insp.Inspect(R__cl, R__insp.GetParent(), "*fOutputArray", &fOutputArray); ExRootModule::ShowMembers(R__insp); } namespace ROOT { // Wrappers around operator new static void *new_MadGraphClassFilter(void *p) { return p ? new(p) ::MadGraphClassFilter : new ::MadGraphClassFilter; } static void *newArray_MadGraphClassFilter(Long_t nElements, void *p) { return p ? new(p) ::MadGraphClassFilter[nElements] : new ::MadGraphClassFilter[nElements]; } // Wrapper around operator delete static void delete_MadGraphClassFilter(void *p) { delete ((::MadGraphClassFilter*)p); } static void deleteArray_MadGraphClassFilter(void *p) { delete [] ((::MadGraphClassFilter*)p); } static void destruct_MadGraphClassFilter(void *p) { typedef ::MadGraphClassFilter current_t; ((current_t*)p)->~current_t(); } } // end of namespace ROOT for class ::MadGraphClassFilter //______________________________________________________________________________ void MadGraphAnalysis::Streamer(TBuffer &R__b) { // Stream an object of class MadGraphAnalysis. if (R__b.IsReading()) { R__b.ReadClassBuffer(MadGraphAnalysis::Class(),this); } else { R__b.WriteClassBuffer(MadGraphAnalysis::Class(),this); } } //______________________________________________________________________________ void MadGraphAnalysis::ShowMembers(TMemberInspector &R__insp) { // Inspect the data members of an object of class MadGraphAnalysis. TClass *R__cl = ::MadGraphAnalysis::IsA(); if (R__cl || R__insp.IsA()) { } R__insp.Inspect(R__cl, R__insp.GetParent(), "fOutputFileName", &fOutputFileName); R__insp.InspectMember(fOutputFileName, "fOutputFileName."); R__insp.Inspect(R__cl, R__insp.GetParent(), "*fInputArray", &fInputArray); R__insp.Inspect(R__cl, R__insp.GetParent(), "*fBranchEvent", &fBranchEvent); R__insp.Inspect(R__cl, R__insp.GetParent(), "fParticleHistogramsMap", (void*)&fParticleHistogramsMap); R__insp.InspectMember("map<TString,ParticleHistograms*>", (void*)&fParticleHistogramsMap, "fParticleHistogramsMap.", true); R__insp.Inspect(R__cl, R__insp.GetParent(), "fPairHistogramsMap", (void*)&fPairHistogramsMap); R__insp.InspectMember("map<TString,PairHistograms*>", (void*)&fPairHistogramsMap, "fPairHistogramsMap.", true); ExRootModule::ShowMembers(R__insp); } namespace ROOT { // Wrappers around operator new static void *new_MadGraphAnalysis(void *p) { return p ? new(p) ::MadGraphAnalysis : new ::MadGraphAnalysis; } static void *newArray_MadGraphAnalysis(Long_t nElements, void *p) { return p ? new(p) ::MadGraphAnalysis[nElements] : new ::MadGraphAnalysis[nElements]; } // Wrapper around operator delete static void delete_MadGraphAnalysis(void *p) { delete ((::MadGraphAnalysis*)p); } static void deleteArray_MadGraphAnalysis(void *p) { delete [] ((::MadGraphAnalysis*)p); } static void destruct_MadGraphAnalysis(void *p) { typedef ::MadGraphAnalysis current_t; ((current_t*)p)->~current_t(); } } // end of namespace ROOT for class ::MadGraphAnalysis //______________________________________________________________________________ void MadGraphKtJetFinder::Streamer(TBuffer &R__b) { // Stream an object of class MadGraphKtJetFinder. if (R__b.IsReading()) { R__b.ReadClassBuffer(MadGraphKtJetFinder::Class(),this); } else { R__b.WriteClassBuffer(MadGraphKtJetFinder::Class(),this); } } //______________________________________________________________________________ void MadGraphKtJetFinder::ShowMembers(TMemberInspector &R__insp) { // Inspect the data members of an object of class MadGraphKtJetFinder. TClass *R__cl = ::MadGraphKtJetFinder::IsA(); if (R__cl || R__insp.IsA()) { } R__insp.Inspect(R__cl, R__insp.GetParent(), "fMaxParticleEta", &fMaxParticleEta); R__insp.Inspect(R__cl, R__insp.GetParent(), "fMinParticlePT", &fMinParticlePT); R__insp.Inspect(R__cl, R__insp.GetParent(), "fMinJetPT", &fMinJetPT); R__insp.Inspect(R__cl, R__insp.GetParent(), "fParameterR", &fParameterR); R__insp.Inspect(R__cl, R__insp.GetParent(), "fCollisionType", &fCollisionType); R__insp.Inspect(R__cl, R__insp.GetParent(), "fDistanceScheme", &fDistanceScheme); R__insp.Inspect(R__cl, R__insp.GetParent(), "fRecombinationScheme", &fRecombinationScheme); R__insp.Inspect(R__cl, R__insp.GetParent(), "fTowersList", (void*)&fTowersList); R__insp.InspectMember("vector<KtJet::KtLorentzVector>", (void*)&fTowersList, "fTowersList.", true); R__insp.Inspect(R__cl, R__insp.GetParent(), "fJetsList", (void*)&fJetsList); R__insp.InspectMember("vector<KtJet::KtLorentzVector>", (void*)&fJetsList, "fJetsList.", true); R__insp.Inspect(R__cl, R__insp.GetParent(), "*fItParticle", &fItParticle); R__insp.Inspect(R__cl, R__insp.GetParent(), "*fBranchParticle", &fBranchParticle); R__insp.Inspect(R__cl, R__insp.GetParent(), "*fOutputArray", &fOutputArray); ExRootModule::ShowMembers(R__insp); } namespace ROOT { // Wrappers around operator new static void *new_MadGraphKtJetFinder(void *p) { return p ? new(p) ::MadGraphKtJetFinder : new ::MadGraphKtJetFinder; } static void *newArray_MadGraphKtJetFinder(Long_t nElements, void *p) { return p ? new(p) ::MadGraphKtJetFinder[nElements] : new ::MadGraphKtJetFinder[nElements]; } // Wrapper around operator delete static void delete_MadGraphKtJetFinder(void *p) { delete ((::MadGraphKtJetFinder*)p); } static void deleteArray_MadGraphKtJetFinder(void *p) { delete [] ((::MadGraphKtJetFinder*)p); } static void destruct_MadGraphKtJetFinder(void *p) { typedef ::MadGraphKtJetFinder current_t; ((current_t*)p)->~current_t(); } } // end of namespace ROOT for class ::MadGraphKtJetFinder //______________________________________________________________________________ void MadGraphConeJetFinder::Streamer(TBuffer &R__b) { // Stream an object of class MadGraphConeJetFinder. if (R__b.IsReading()) { R__b.ReadClassBuffer(MadGraphConeJetFinder::Class(),this); } else { R__b.WriteClassBuffer(MadGraphConeJetFinder::Class(),this); } } //______________________________________________________________________________ void MadGraphConeJetFinder::ShowMembers(TMemberInspector &R__insp) { // Inspect the data members of an object of class MadGraphConeJetFinder. TClass *R__cl = ::MadGraphConeJetFinder::IsA(); if (R__cl || R__insp.IsA()) { } R__insp.Inspect(R__cl, R__insp.GetParent(), "fMinParticlePT", &fMinParticlePT); R__insp.Inspect(R__cl, R__insp.GetParent(), "fMinJetPT", &fMinJetPT); R__insp.Inspect(R__cl, R__insp.GetParent(), "fTowersList", (void*)&fTowersList); R__insp.InspectMember("vector<PhysicsTower>", (void*)&fTowersList, "fTowersList.", false); R__insp.Inspect(R__cl, R__insp.GetParent(), "fJetsList", (void*)&fJetsList); R__insp.InspectMember("vector<Cluster>", (void*)&fJetsList, "fJetsList.", false); R__insp.Inspect(R__cl, R__insp.GetParent(), "*fJetAlgo", &fJetAlgo); R__insp.Inspect(R__cl, R__insp.GetParent(), "*fItParticle", &fItParticle); R__insp.Inspect(R__cl, R__insp.GetParent(), "*fBranchParticle", &fBranchParticle); R__insp.Inspect(R__cl, R__insp.GetParent(), "*fOutputArray", &fOutputArray); ExRootModule::ShowMembers(R__insp); } namespace ROOT { // Wrappers around operator new static void *new_MadGraphConeJetFinder(void *p) { return p ? new(p) ::MadGraphConeJetFinder : new ::MadGraphConeJetFinder; } static void *newArray_MadGraphConeJetFinder(Long_t nElements, void *p) { return p ? new(p) ::MadGraphConeJetFinder[nElements] : new ::MadGraphConeJetFinder[nElements]; } // Wrapper around operator delete static void delete_MadGraphConeJetFinder(void *p) { delete ((::MadGraphConeJetFinder*)p); } static void deleteArray_MadGraphConeJetFinder(void *p) { delete [] ((::MadGraphConeJetFinder*)p); } static void destruct_MadGraphConeJetFinder(void *p) { typedef ::MadGraphConeJetFinder current_t; ((current_t*)p)->~current_t(); } } // end of namespace ROOT for class ::MadGraphConeJetFinder namespace ROOT { void vectorlEClustergR_ShowMembers(void *obj, TMemberInspector &R__insp); static void vectorlEClustergR_Dictionary(); static void *new_vectorlEClustergR(void *p = 0); static void *newArray_vectorlEClustergR(Long_t size, void *p); static void delete_vectorlEClustergR(void *p); static void deleteArray_vectorlEClustergR(void *p); static void destruct_vectorlEClustergR(void *p); // Function generating the singleton type initializer static TGenericClassInfo *GenerateInitInstanceLocal(const vector<Cluster>*) { vector<Cluster> *ptr = 0; static ::TVirtualIsAProxy* isa_proxy = new ::TIsAProxy(typeid(vector<Cluster>),0); static ::ROOT::TGenericClassInfo instance("vector<Cluster>", -2, "prec_stl/vector", 49, typeid(vector<Cluster>), DefineBehavior(ptr, ptr), 0, &vectorlEClustergR_Dictionary, isa_proxy, 0, sizeof(vector<Cluster>) ); instance.SetNew(&new_vectorlEClustergR); instance.SetNewArray(&newArray_vectorlEClustergR); instance.SetDelete(&delete_vectorlEClustergR); instance.SetDeleteArray(&deleteArray_vectorlEClustergR); instance.SetDestructor(&destruct_vectorlEClustergR); instance.AdoptCollectionProxyInfo(TCollectionProxyInfo::Generate(TCollectionProxyInfo::Pushback< vector<Cluster> >())); return &instance; } // Static variable to force the class initialization static ::ROOT::TGenericClassInfo *_R__UNIQUE_(Init) = GenerateInitInstanceLocal((const vector<Cluster>*)0x0); R__UseDummy(_R__UNIQUE_(Init)); // Dictionary for non-ClassDef classes static void vectorlEClustergR_Dictionary() { ::ROOT::GenerateInitInstanceLocal((const vector<Cluster>*)0x0)->GetClass(); } } // end of namespace ROOT namespace ROOT { // Wrappers around operator new static void *new_vectorlEClustergR(void *p) { return p ? ::new((::ROOT::TOperatorNewHelper*)p) vector<Cluster> : new vector<Cluster>; } static void *newArray_vectorlEClustergR(Long_t nElements, void *p) { return p ? ::new((::ROOT::TOperatorNewHelper*)p) vector<Cluster>[nElements] : new vector<Cluster>[nElements]; } // Wrapper around operator delete static void delete_vectorlEClustergR(void *p) { delete ((vector<Cluster>*)p); } static void deleteArray_vectorlEClustergR(void *p) { delete [] ((vector<Cluster>*)p); } static void destruct_vectorlEClustergR(void *p) { typedef vector<Cluster> current_t; ((current_t*)p)->~current_t(); } } // end of namespace ROOT for class vector<Cluster> namespace ROOT { void vectorlEPhysicsTowergR_ShowMembers(void *obj, TMemberInspector &R__insp); static void vectorlEPhysicsTowergR_Dictionary(); static void *new_vectorlEPhysicsTowergR(void *p = 0); static void *newArray_vectorlEPhysicsTowergR(Long_t size, void *p); static void delete_vectorlEPhysicsTowergR(void *p); static void deleteArray_vectorlEPhysicsTowergR(void *p); static void destruct_vectorlEPhysicsTowergR(void *p); // Function generating the singleton type initializer static TGenericClassInfo *GenerateInitInstanceLocal(const vector<PhysicsTower>*) { vector<PhysicsTower> *ptr = 0; static ::TVirtualIsAProxy* isa_proxy = new ::TIsAProxy(typeid(vector<PhysicsTower>),0); static ::ROOT::TGenericClassInfo instance("vector<PhysicsTower>", -2, "prec_stl/vector", 49, typeid(vector<PhysicsTower>), DefineBehavior(ptr, ptr), 0, &vectorlEPhysicsTowergR_Dictionary, isa_proxy, 0, sizeof(vector<PhysicsTower>) ); instance.SetNew(&new_vectorlEPhysicsTowergR); instance.SetNewArray(&newArray_vectorlEPhysicsTowergR); instance.SetDelete(&delete_vectorlEPhysicsTowergR); instance.SetDeleteArray(&deleteArray_vectorlEPhysicsTowergR); instance.SetDestructor(&destruct_vectorlEPhysicsTowergR); instance.AdoptCollectionProxyInfo(TCollectionProxyInfo::Generate(TCollectionProxyInfo::Pushback< vector<PhysicsTower> >())); return &instance; } // Static variable to force the class initialization static ::ROOT::TGenericClassInfo *_R__UNIQUE_(Init) = GenerateInitInstanceLocal((const vector<PhysicsTower>*)0x0); R__UseDummy(_R__UNIQUE_(Init)); // Dictionary for non-ClassDef classes static void vectorlEPhysicsTowergR_Dictionary() { ::ROOT::GenerateInitInstanceLocal((const vector<PhysicsTower>*)0x0)->GetClass(); } } // end of namespace ROOT namespace ROOT { // Wrappers around operator new static void *new_vectorlEPhysicsTowergR(void *p) { return p ? ::new((::ROOT::TOperatorNewHelper*)p) vector<PhysicsTower> : new vector<PhysicsTower>; } static void *newArray_vectorlEPhysicsTowergR(Long_t nElements, void *p) { return p ? ::new((::ROOT::TOperatorNewHelper*)p) vector<PhysicsTower>[nElements] : new vector<PhysicsTower>[nElements]; } // Wrapper around operator delete static void delete_vectorlEPhysicsTowergR(void *p) { delete ((vector<PhysicsTower>*)p); } static void deleteArray_vectorlEPhysicsTowergR(void *p) { delete [] ((vector<PhysicsTower>*)p); } static void destruct_vectorlEPhysicsTowergR(void *p) { typedef vector<PhysicsTower> current_t; ((current_t*)p)->~current_t(); } } // end of namespace ROOT for class vector<PhysicsTower> /******************************************************** * tmp/modules/ModulesDict.cc * CAUTION: DON'T CHANGE THIS FILE. THIS FILE IS AUTOMATICALLY GENERATED * FROM HEADER FILES LISTED IN G__setup_cpp_environmentXXX(). * CHANGE THOSE HEADER FILES AND REGENERATE THIS FILE. ********************************************************/ #ifdef G__MEMTEST #undef malloc #undef free #endif #if defined(__GNUC__) && __GNUC__ >= 4 && ((__GNUC_MINOR__ == 2 && __GNUC_PATCHLEVEL__ >= 1) || (__GNUC_MINOR__ >= 3)) #pragma GCC diagnostic ignored "-Wstrict-aliasing" #endif extern "C" void G__cpp_reset_tagtableModulesDict(); extern "C" void G__set_cpp_environmentModulesDict() { G__add_compiledheader("TObject.h"); G__add_compiledheader("TMemberInspector.h"); G__cpp_reset_tagtableModulesDict(); } #include <new> extern "C" int G__cpp_dllrevModulesDict() { return(30051515); } /********************************************************* * Member function Interface Method *********************************************************/ /* MadGraphClassFilter */ static int G__ModulesDict_451_0_1(G__value* result7, G__CONST char* funcname, struct G__param* libp, int hash) { MadGraphClassFilter* p = NULL; char* gvp = (char*) G__getgvp(); int n = G__getaryconstruct(); if (n) { if ((gvp == (char*)G__PVOID) || (gvp == 0)) { p = new MadGraphClassFilter[n]; } else { p = new((void*) gvp) MadGraphClassFilter[n]; } } else { if ((gvp == (char*)G__PVOID) || (gvp == 0)) { p = new MadGraphClassFilter; } else { p = new((void*) gvp) MadGraphClassFilter; } } result7->obj.i = (long) p; result7->ref = (long) p; G__set_tagnum(result7,G__get_linked_tagnum(&G__ModulesDictLN_MadGraphClassFilter)); return(1 || funcname || hash || result7 || libp) ; } static int G__ModulesDict_451_0_5(G__value* result7, G__CONST char* funcname, struct G__param* libp, int hash) { G__letint(result7, 85, (long) MadGraphClassFilter::Class()); return(1 || funcname || hash || result7 || libp) ; } static int G__ModulesDict_451_0_6(G__value* result7, G__CONST char* funcname, struct G__param* libp, int hash) { G__letint(result7, 67, (long) MadGraphClassFilter::Class_Name()); return(1 || funcname || hash || result7 || libp) ; } static int G__ModulesDict_451_0_7(G__value* result7, G__CONST char* funcname, struct G__param* libp, int hash) { G__letint(result7, 115, (long) MadGraphClassFilter::Class_Version()); return(1 || funcname || hash || result7 || libp) ; } static int G__ModulesDict_451_0_8(G__value* result7, G__CONST char* funcname, struct G__param* libp, int hash) { MadGraphClassFilter::Dictionary(); G__setnull(result7); return(1 || funcname || hash || result7 || libp) ; } static int G__ModulesDict_451_0_12(G__value* result7, G__CONST char* funcname, struct G__param* libp, int hash) { ((MadGraphClassFilter*) G__getstructoffset())->StreamerNVirtual(*(TBuffer*) libp->para[0].ref); G__setnull(result7); return(1 || funcname || hash || result7 || libp) ; } static int G__ModulesDict_451_0_13(G__value* result7, G__CONST char* funcname, struct G__param* libp, int hash) { G__letint(result7, 67, (long) MadGraphClassFilter::DeclFileName()); return(1 || funcname || hash || result7 || libp) ; } static int G__ModulesDict_451_0_14(G__value* result7, G__CONST char* funcname, struct G__param* libp, int hash) { G__letint(result7, 105, (long) MadGraphClassFilter::ImplFileLine()); return(1 || funcname || hash || result7 || libp) ; } static int G__ModulesDict_451_0_15(G__value* result7, G__CONST char* funcname, struct G__param* libp, int hash) { G__letint(result7, 67, (long) MadGraphClassFilter::ImplFileName()); return(1 || funcname || hash || result7 || libp) ; } static int G__ModulesDict_451_0_16(G__value* result7, G__CONST char* funcname, struct G__param* libp, int hash) { G__letint(result7, 105, (long) MadGraphClassFilter::DeclFileLine()); return(1 || funcname || hash || result7 || libp) ; } // automatic copy constructor static int G__ModulesDict_451_0_17(G__value* result7, G__CONST char* funcname, struct G__param* libp, int hash) { MadGraphClassFilter* p; void* tmp = (void*) G__int(libp->para[0]); p = new MadGraphClassFilter(*(MadGraphClassFilter*) tmp); result7->obj.i = (long) p; result7->ref = (long) p; G__set_tagnum(result7,G__get_linked_tagnum(&G__ModulesDictLN_MadGraphClassFilter)); return(1 || funcname || hash || result7 || libp) ; } // automatic destructor typedef MadGraphClassFilter G__TMadGraphClassFilter; static int G__ModulesDict_451_0_18(G__value* result7, G__CONST char* funcname, struct G__param* libp, int hash) { char* gvp = (char*) G__getgvp(); long soff = G__getstructoffset(); int n = G__getaryconstruct(); // //has_a_delete: 1 //has_own_delete1arg: 0 //has_own_delete2arg: 0 // if (!soff) { return(1); } if (n) { if (gvp == (char*)G__PVOID) { delete[] (MadGraphClassFilter*) soff; } else { G__setgvp((long) G__PVOID); for (int i = n - 1; i >= 0; --i) { ((MadGraphClassFilter*) (soff+(sizeof(MadGraphClassFilter)*i)))->~G__TMadGraphClassFilter(); } G__setgvp((long)gvp); } } else { if (gvp == (char*)G__PVOID) { delete (MadGraphClassFilter*) soff; } else { G__setgvp((long) G__PVOID); ((MadGraphClassFilter*) (soff))->~G__TMadGraphClassFilter(); G__setgvp((long)gvp); } } G__setnull(result7); return(1 || funcname || hash || result7 || libp) ; } // automatic assignment operator static int G__ModulesDict_451_0_19(G__value* result7, G__CONST char* funcname, struct G__param* libp, int hash) { MadGraphClassFilter* dest = (MadGraphClassFilter*) G__getstructoffset(); *dest = *(MadGraphClassFilter*) libp->para[0].ref; const MadGraphClassFilter& obj = *dest; result7->ref = (long) (&obj); result7->obj.i = (long) (&obj); return(1 || funcname || hash || result7 || libp) ; } /* MadGraphAnalysis */ static int G__ModulesDict_453_0_1(G__value* result7, G__CONST char* funcname, struct G__param* libp, int hash) { MadGraphAnalysis* p = NULL; char* gvp = (char*) G__getgvp(); int n = G__getaryconstruct(); if (n) { if ((gvp == (char*)G__PVOID) || (gvp == 0)) { p = new MadGraphAnalysis[n]; } else { p = new((void*) gvp) MadGraphAnalysis[n]; } } else { if ((gvp == (char*)G__PVOID) || (gvp == 0)) { p = new MadGraphAnalysis; } else { p = new((void*) gvp) MadGraphAnalysis; } } result7->obj.i = (long) p; result7->ref = (long) p; G__set_tagnum(result7,G__get_linked_tagnum(&G__ModulesDictLN_MadGraphAnalysis)); return(1 || funcname || hash || result7 || libp) ; } static int G__ModulesDict_453_0_9(G__value* result7, G__CONST char* funcname, struct G__param* libp, int hash) { G__letint(result7, 85, (long) MadGraphAnalysis::Class()); return(1 || funcname || hash || result7 || libp) ; } static int G__ModulesDict_453_0_10(G__value* result7, G__CONST char* funcname, struct G__param* libp, int hash) { G__letint(result7, 67, (long) MadGraphAnalysis::Class_Name()); return(1 || funcname || hash || result7 || libp) ; } static int G__ModulesDict_453_0_11(G__value* result7, G__CONST char* funcname, struct G__param* libp, int hash) { G__letint(result7, 115, (long) MadGraphAnalysis::Class_Version()); return(1 || funcname || hash || result7 || libp) ; } static int G__ModulesDict_453_0_12(G__value* result7, G__CONST char* funcname, struct G__param* libp, int hash) { MadGraphAnalysis::Dictionary(); G__setnull(result7); return(1 || funcname || hash || result7 || libp) ; } static int G__ModulesDict_453_0_16(G__value* result7, G__CONST char* funcname, struct G__param* libp, int hash) { ((MadGraphAnalysis*) G__getstructoffset())->StreamerNVirtual(*(TBuffer*) libp->para[0].ref); G__setnull(result7); return(1 || funcname || hash || result7 || libp) ; } static int G__ModulesDict_453_0_17(G__value* result7, G__CONST char* funcname, struct G__param* libp, int hash) { G__letint(result7, 67, (long) MadGraphAnalysis::DeclFileName()); return(1 || funcname || hash || result7 || libp) ; } static int G__ModulesDict_453_0_18(G__value* result7, G__CONST char* funcname, struct G__param* libp, int hash) { G__letint(result7, 105, (long) MadGraphAnalysis::ImplFileLine()); return(1 || funcname || hash || result7 || libp) ; } static int G__ModulesDict_453_0_19(G__value* result7, G__CONST char* funcname, struct G__param* libp, int hash) { G__letint(result7, 67, (long) MadGraphAnalysis::ImplFileName()); return(1 || funcname || hash || result7 || libp) ; } static int G__ModulesDict_453_0_20(G__value* result7, G__CONST char* funcname, struct G__param* libp, int hash) { G__letint(result7, 105, (long) MadGraphAnalysis::DeclFileLine()); return(1 || funcname || hash || result7 || libp) ; } // automatic copy constructor static int G__ModulesDict_453_0_21(G__value* result7, G__CONST char* funcname, struct G__param* libp, int hash) { MadGraphAnalysis* p; void* tmp = (void*) G__int(libp->para[0]); p = new MadGraphAnalysis(*(MadGraphAnalysis*) tmp); result7->obj.i = (long) p; result7->ref = (long) p; G__set_tagnum(result7,G__get_linked_tagnum(&G__ModulesDictLN_MadGraphAnalysis)); return(1 || funcname || hash || result7 || libp) ; } // automatic destructor typedef MadGraphAnalysis G__TMadGraphAnalysis; static int G__ModulesDict_453_0_22(G__value* result7, G__CONST char* funcname, struct G__param* libp, int hash) { char* gvp = (char*) G__getgvp(); long soff = G__getstructoffset(); int n = G__getaryconstruct(); // //has_a_delete: 1 //has_own_delete1arg: 0 //has_own_delete2arg: 0 // if (!soff) { return(1); } if (n) { if (gvp == (char*)G__PVOID) { delete[] (MadGraphAnalysis*) soff; } else { G__setgvp((long) G__PVOID); for (int i = n - 1; i >= 0; --i) { ((MadGraphAnalysis*) (soff+(sizeof(MadGraphAnalysis)*i)))->~G__TMadGraphAnalysis(); } G__setgvp((long)gvp); } } else { if (gvp == (char*)G__PVOID) { delete (MadGraphAnalysis*) soff; } else { G__setgvp((long) G__PVOID); ((MadGraphAnalysis*) (soff))->~G__TMadGraphAnalysis(); G__setgvp((long)gvp); } } G__setnull(result7); return(1 || funcname || hash || result7 || libp) ; } /* MadGraphKtJetFinder */ static int G__ModulesDict_517_0_1(G__value* result7, G__CONST char* funcname, struct G__param* libp, int hash) { MadGraphKtJetFinder* p = NULL; char* gvp = (char*) G__getgvp(); int n = G__getaryconstruct(); if (n) { if ((gvp == (char*)G__PVOID) || (gvp == 0)) { p = new MadGraphKtJetFinder[n]; } else { p = new((void*) gvp) MadGraphKtJetFinder[n]; } } else { if ((gvp == (char*)G__PVOID) || (gvp == 0)) { p = new MadGraphKtJetFinder; } else { p = new((void*) gvp) MadGraphKtJetFinder; } } result7->obj.i = (long) p; result7->ref = (long) p; G__set_tagnum(result7,G__get_linked_tagnum(&G__ModulesDictLN_MadGraphKtJetFinder)); return(1 || funcname || hash || result7 || libp) ; } static int G__ModulesDict_517_0_5(G__value* result7, G__CONST char* funcname, struct G__param* libp, int hash) { G__letint(result7, 85, (long) MadGraphKtJetFinder::Class()); return(1 || funcname || hash || result7 || libp) ; } static int G__ModulesDict_517_0_6(G__value* result7, G__CONST char* funcname, struct G__param* libp, int hash) { G__letint(result7, 67, (long) MadGraphKtJetFinder::Class_Name()); return(1 || funcname || hash || result7 || libp) ; } static int G__ModulesDict_517_0_7(G__value* result7, G__CONST char* funcname, struct G__param* libp, int hash) { G__letint(result7, 115, (long) MadGraphKtJetFinder::Class_Version()); return(1 || funcname || hash || result7 || libp) ; } static int G__ModulesDict_517_0_8(G__value* result7, G__CONST char* funcname, struct G__param* libp, int hash) { MadGraphKtJetFinder::Dictionary(); G__setnull(result7); return(1 || funcname || hash || result7 || libp) ; } static int G__ModulesDict_517_0_12(G__value* result7, G__CONST char* funcname, struct G__param* libp, int hash) { ((MadGraphKtJetFinder*) G__getstructoffset())->StreamerNVirtual(*(TBuffer*) libp->para[0].ref); G__setnull(result7); return(1 || funcname || hash || result7 || libp) ; } static int G__ModulesDict_517_0_13(G__value* result7, G__CONST char* funcname, struct G__param* libp, int hash) { G__letint(result7, 67, (long) MadGraphKtJetFinder::DeclFileName()); return(1 || funcname || hash || result7 || libp) ; } static int G__ModulesDict_517_0_14(G__value* result7, G__CONST char* funcname, struct G__param* libp, int hash) { G__letint(result7, 105, (long) MadGraphKtJetFinder::ImplFileLine()); return(1 || funcname || hash || result7 || libp) ; } static int G__ModulesDict_517_0_15(G__value* result7, G__CONST char* funcname, struct G__param* libp, int hash) { G__letint(result7, 67, (long) MadGraphKtJetFinder::ImplFileName()); return(1 || funcname || hash || result7 || libp) ; } static int G__ModulesDict_517_0_16(G__value* result7, G__CONST char* funcname, struct G__param* libp, int hash) { G__letint(result7, 105, (long) MadGraphKtJetFinder::DeclFileLine()); return(1 || funcname || hash || result7 || libp) ; } // automatic copy constructor static int G__ModulesDict_517_0_17(G__value* result7, G__CONST char* funcname, struct G__param* libp, int hash) { MadGraphKtJetFinder* p; void* tmp = (void*) G__int(libp->para[0]); p = new MadGraphKtJetFinder(*(MadGraphKtJetFinder*) tmp); result7->obj.i = (long) p; result7->ref = (long) p; G__set_tagnum(result7,G__get_linked_tagnum(&G__ModulesDictLN_MadGraphKtJetFinder)); return(1 || funcname || hash || result7 || libp) ; } // automatic destructor typedef MadGraphKtJetFinder G__TMadGraphKtJetFinder; static int G__ModulesDict_517_0_18(G__value* result7, G__CONST char* funcname, struct G__param* libp, int hash) { char* gvp = (char*) G__getgvp(); long soff = G__getstructoffset(); int n = G__getaryconstruct(); // //has_a_delete: 1 //has_own_delete1arg: 0 //has_own_delete2arg: 0 // if (!soff) { return(1); } if (n) { if (gvp == (char*)G__PVOID) { delete[] (MadGraphKtJetFinder*) soff; } else { G__setgvp((long) G__PVOID); for (int i = n - 1; i >= 0; --i) { ((MadGraphKtJetFinder*) (soff+(sizeof(MadGraphKtJetFinder)*i)))->~G__TMadGraphKtJetFinder(); } G__setgvp((long)gvp); } } else { if (gvp == (char*)G__PVOID) { delete (MadGraphKtJetFinder*) soff; } else { G__setgvp((long) G__PVOID); ((MadGraphKtJetFinder*) (soff))->~G__TMadGraphKtJetFinder(); G__setgvp((long)gvp); } } G__setnull(result7); return(1 || funcname || hash || result7 || libp) ; } // automatic assignment operator static int G__ModulesDict_517_0_19(G__value* result7, G__CONST char* funcname, struct G__param* libp, int hash) { MadGraphKtJetFinder* dest = (MadGraphKtJetFinder*) G__getstructoffset(); *dest = *(MadGraphKtJetFinder*) libp->para[0].ref; const MadGraphKtJetFinder& obj = *dest; result7->ref = (long) (&obj); result7->obj.i = (long) (&obj); return(1 || funcname || hash || result7 || libp) ; } /* MadGraphConeJetFinder */ static int G__ModulesDict_528_0_1(G__value* result7, G__CONST char* funcname, struct G__param* libp, int hash) { MadGraphConeJetFinder* p = NULL; char* gvp = (char*) G__getgvp(); int n = G__getaryconstruct(); if (n) { if ((gvp == (char*)G__PVOID) || (gvp == 0)) { p = new MadGraphConeJetFinder[n]; } else { p = new((void*) gvp) MadGraphConeJetFinder[n]; } } else { if ((gvp == (char*)G__PVOID) || (gvp == 0)) { p = new MadGraphConeJetFinder; } else { p = new((void*) gvp) MadGraphConeJetFinder; } } result7->obj.i = (long) p; result7->ref = (long) p; G__set_tagnum(result7,G__get_linked_tagnum(&G__ModulesDictLN_MadGraphConeJetFinder)); return(1 || funcname || hash || result7 || libp) ; } static int G__ModulesDict_528_0_5(G__value* result7, G__CONST char* funcname, struct G__param* libp, int hash) { G__letint(result7, 85, (long) MadGraphConeJetFinder::Class()); return(1 || funcname || hash || result7 || libp) ; } static int G__ModulesDict_528_0_6(G__value* result7, G__CONST char* funcname, struct G__param* libp, int hash) { G__letint(result7, 67, (long) MadGraphConeJetFinder::Class_Name()); return(1 || funcname || hash || result7 || libp) ; } static int G__ModulesDict_528_0_7(G__value* result7, G__CONST char* funcname, struct G__param* libp, int hash) { G__letint(result7, 115, (long) MadGraphConeJetFinder::Class_Version()); return(1 || funcname || hash || result7 || libp) ; } static int G__ModulesDict_528_0_8(G__value* result7, G__CONST char* funcname, struct G__param* libp, int hash) { MadGraphConeJetFinder::Dictionary(); G__setnull(result7); return(1 || funcname || hash || result7 || libp) ; } static int G__ModulesDict_528_0_12(G__value* result7, G__CONST char* funcname, struct G__param* libp, int hash) { ((MadGraphConeJetFinder*) G__getstructoffset())->StreamerNVirtual(*(TBuffer*) libp->para[0].ref); G__setnull(result7); return(1 || funcname || hash || result7 || libp) ; } static int G__ModulesDict_528_0_13(G__value* result7, G__CONST char* funcname, struct G__param* libp, int hash) { G__letint(result7, 67, (long) MadGraphConeJetFinder::DeclFileName()); return(1 || funcname || hash || result7 || libp) ; } static int G__ModulesDict_528_0_14(G__value* result7, G__CONST char* funcname, struct G__param* libp, int hash) { G__letint(result7, 105, (long) MadGraphConeJetFinder::ImplFileLine()); return(1 || funcname || hash || result7 || libp) ; } static int G__ModulesDict_528_0_15(G__value* result7, G__CONST char* funcname, struct G__param* libp, int hash) { G__letint(result7, 67, (long) MadGraphConeJetFinder::ImplFileName()); return(1 || funcname || hash || result7 || libp) ; } static int G__ModulesDict_528_0_16(G__value* result7, G__CONST char* funcname, struct G__param* libp, int hash) { G__letint(result7, 105, (long) MadGraphConeJetFinder::DeclFileLine()); return(1 || funcname || hash || result7 || libp) ; } // automatic copy constructor static int G__ModulesDict_528_0_17(G__value* result7, G__CONST char* funcname, struct G__param* libp, int hash) { MadGraphConeJetFinder* p; void* tmp = (void*) G__int(libp->para[0]); p = new MadGraphConeJetFinder(*(MadGraphConeJetFinder*) tmp); result7->obj.i = (long) p; result7->ref = (long) p; G__set_tagnum(result7,G__get_linked_tagnum(&G__ModulesDictLN_MadGraphConeJetFinder)); return(1 || funcname || hash || result7 || libp) ; } // automatic destructor typedef MadGraphConeJetFinder G__TMadGraphConeJetFinder; static int G__ModulesDict_528_0_18(G__value* result7, G__CONST char* funcname, struct G__param* libp, int hash) { char* gvp = (char*) G__getgvp(); long soff = G__getstructoffset(); int n = G__getaryconstruct(); // //has_a_delete: 1 //has_own_delete1arg: 0 //has_own_delete2arg: 0 // if (!soff) { return(1); } if (n) { if (gvp == (char*)G__PVOID) { delete[] (MadGraphConeJetFinder*) soff; } else { G__setgvp((long) G__PVOID); for (int i = n - 1; i >= 0; --i) { ((MadGraphConeJetFinder*) (soff+(sizeof(MadGraphConeJetFinder)*i)))->~G__TMadGraphConeJetFinder(); } G__setgvp((long)gvp); } } else { if (gvp == (char*)G__PVOID) { delete (MadGraphConeJetFinder*) soff; } else { G__setgvp((long) G__PVOID); ((MadGraphConeJetFinder*) (soff))->~G__TMadGraphConeJetFinder(); G__setgvp((long)gvp); } } G__setnull(result7); return(1 || funcname || hash || result7 || libp) ; } // automatic assignment operator static int G__ModulesDict_528_0_19(G__value* result7, G__CONST char* funcname, struct G__param* libp, int hash) { MadGraphConeJetFinder* dest = (MadGraphConeJetFinder*) G__getstructoffset(); *dest = *(MadGraphConeJetFinder*) libp->para[0].ref; const MadGraphConeJetFinder& obj = *dest; result7->ref = (long) (&obj); result7->obj.i = (long) (&obj); return(1 || funcname || hash || result7 || libp) ; } /* Setting up global function */ /********************************************************* * Member function Stub *********************************************************/ /* MadGraphClassFilter */ /* MadGraphAnalysis */ /* MadGraphKtJetFinder */ /* MadGraphConeJetFinder */ /********************************************************* * Global function Stub *********************************************************/ /********************************************************* * Get size of pointer to member function *********************************************************/ class G__Sizep2memfuncModulesDict { public: G__Sizep2memfuncModulesDict(): p(&G__Sizep2memfuncModulesDict::sizep2memfunc) {} size_t sizep2memfunc() { return(sizeof(p)); } private: size_t (G__Sizep2memfuncModulesDict::*p)(); }; size_t G__get_sizep2memfuncModulesDict() { G__Sizep2memfuncModulesDict a; G__setsizep2memfunc((int)a.sizep2memfunc()); return((size_t)a.sizep2memfunc()); } /********************************************************* * virtual base class offset calculation interface *********************************************************/ /* Setting up class inheritance */ /********************************************************* * Inheritance information setup/ *********************************************************/ extern "C" void G__cpp_setup_inheritanceModulesDict() { /* Setting up class inheritance */ if(0==G__getnumbaseclass(G__get_linked_tagnum(&G__ModulesDictLN_MadGraphClassFilter))) { MadGraphClassFilter *G__Lderived; G__Lderived=(MadGraphClassFilter*)0x1000; { ExRootModule *G__Lpbase=(ExRootModule*)G__Lderived; G__inheritance_setup(G__get_linked_tagnum(&G__ModulesDictLN_MadGraphClassFilter),G__get_linked_tagnum(&G__ModulesDictLN_ExRootModule),(long)G__Lpbase-(long)G__Lderived,1,1); } { ExRootTask *G__Lpbase=(ExRootTask*)G__Lderived; G__inheritance_setup(G__get_linked_tagnum(&G__ModulesDictLN_MadGraphClassFilter),G__get_linked_tagnum(&G__ModulesDictLN_ExRootTask),(long)G__Lpbase-(long)G__Lderived,1,0); } { TTask *G__Lpbase=(TTask*)G__Lderived; G__inheritance_setup(G__get_linked_tagnum(&G__ModulesDictLN_MadGraphClassFilter),G__get_linked_tagnum(&G__ModulesDictLN_TTask),(long)G__Lpbase-(long)G__Lderived,1,0); } { TNamed *G__Lpbase=(TNamed*)G__Lderived; G__inheritance_setup(G__get_linked_tagnum(&G__ModulesDictLN_MadGraphClassFilter),G__get_linked_tagnum(&G__ModulesDictLN_TNamed),(long)G__Lpbase-(long)G__Lderived,1,0); } { TObject *G__Lpbase=(TObject*)G__Lderived; G__inheritance_setup(G__get_linked_tagnum(&G__ModulesDictLN_MadGraphClassFilter),G__get_linked_tagnum(&G__ModulesDictLN_TObject),(long)G__Lpbase-(long)G__Lderived,1,0); } } if(0==G__getnumbaseclass(G__get_linked_tagnum(&G__ModulesDictLN_MadGraphAnalysis))) { MadGraphAnalysis *G__Lderived; G__Lderived=(MadGraphAnalysis*)0x1000; { ExRootModule *G__Lpbase=(ExRootModule*)G__Lderived; G__inheritance_setup(G__get_linked_tagnum(&G__ModulesDictLN_MadGraphAnalysis),G__get_linked_tagnum(&G__ModulesDictLN_ExRootModule),(long)G__Lpbase-(long)G__Lderived,1,1); } { ExRootTask *G__Lpbase=(ExRootTask*)G__Lderived; G__inheritance_setup(G__get_linked_tagnum(&G__ModulesDictLN_MadGraphAnalysis),G__get_linked_tagnum(&G__ModulesDictLN_ExRootTask),(long)G__Lpbase-(long)G__Lderived,1,0); } { TTask *G__Lpbase=(TTask*)G__Lderived; G__inheritance_setup(G__get_linked_tagnum(&G__ModulesDictLN_MadGraphAnalysis),G__get_linked_tagnum(&G__ModulesDictLN_TTask),(long)G__Lpbase-(long)G__Lderived,1,0); } { TNamed *G__Lpbase=(TNamed*)G__Lderived; G__inheritance_setup(G__get_linked_tagnum(&G__ModulesDictLN_MadGraphAnalysis),G__get_linked_tagnum(&G__ModulesDictLN_TNamed),(long)G__Lpbase-(long)G__Lderived,1,0); } { TObject *G__Lpbase=(TObject*)G__Lderived; G__inheritance_setup(G__get_linked_tagnum(&G__ModulesDictLN_MadGraphAnalysis),G__get_linked_tagnum(&G__ModulesDictLN_TObject),(long)G__Lpbase-(long)G__Lderived,1,0); } } if(0==G__getnumbaseclass(G__get_linked_tagnum(&G__ModulesDictLN_MadGraphKtJetFinder))) { MadGraphKtJetFinder *G__Lderived; G__Lderived=(MadGraphKtJetFinder*)0x1000; { ExRootModule *G__Lpbase=(ExRootModule*)G__Lderived; G__inheritance_setup(G__get_linked_tagnum(&G__ModulesDictLN_MadGraphKtJetFinder),G__get_linked_tagnum(&G__ModulesDictLN_ExRootModule),(long)G__Lpbase-(long)G__Lderived,1,1); } { ExRootTask *G__Lpbase=(ExRootTask*)G__Lderived; G__inheritance_setup(G__get_linked_tagnum(&G__ModulesDictLN_MadGraphKtJetFinder),G__get_linked_tagnum(&G__ModulesDictLN_ExRootTask),(long)G__Lpbase-(long)G__Lderived,1,0); } { TTask *G__Lpbase=(TTask*)G__Lderived; G__inheritance_setup(G__get_linked_tagnum(&G__ModulesDictLN_MadGraphKtJetFinder),G__get_linked_tagnum(&G__ModulesDictLN_TTask),(long)G__Lpbase-(long)G__Lderived,1,0); } { TNamed *G__Lpbase=(TNamed*)G__Lderived; G__inheritance_setup(G__get_linked_tagnum(&G__ModulesDictLN_MadGraphKtJetFinder),G__get_linked_tagnum(&G__ModulesDictLN_TNamed),(long)G__Lpbase-(long)G__Lderived,1,0); } { TObject *G__Lpbase=(TObject*)G__Lderived; G__inheritance_setup(G__get_linked_tagnum(&G__ModulesDictLN_MadGraphKtJetFinder),G__get_linked_tagnum(&G__ModulesDictLN_TObject),(long)G__Lpbase-(long)G__Lderived,1,0); } } if(0==G__getnumbaseclass(G__get_linked_tagnum(&G__ModulesDictLN_MadGraphConeJetFinder))) { MadGraphConeJetFinder *G__Lderived; G__Lderived=(MadGraphConeJetFinder*)0x1000; { ExRootModule *G__Lpbase=(ExRootModule*)G__Lderived; G__inheritance_setup(G__get_linked_tagnum(&G__ModulesDictLN_MadGraphConeJetFinder),G__get_linked_tagnum(&G__ModulesDictLN_ExRootModule),(long)G__Lpbase-(long)G__Lderived,1,1); } { ExRootTask *G__Lpbase=(ExRootTask*)G__Lderived; G__inheritance_setup(G__get_linked_tagnum(&G__ModulesDictLN_MadGraphConeJetFinder),G__get_linked_tagnum(&G__ModulesDictLN_ExRootTask),(long)G__Lpbase-(long)G__Lderived,1,0); } { TTask *G__Lpbase=(TTask*)G__Lderived; G__inheritance_setup(G__get_linked_tagnum(&G__ModulesDictLN_MadGraphConeJetFinder),G__get_linked_tagnum(&G__ModulesDictLN_TTask),(long)G__Lpbase-(long)G__Lderived,1,0); } { TNamed *G__Lpbase=(TNamed*)G__Lderived; G__inheritance_setup(G__get_linked_tagnum(&G__ModulesDictLN_MadGraphConeJetFinder),G__get_linked_tagnum(&G__ModulesDictLN_TNamed),(long)G__Lpbase-(long)G__Lderived,1,0); } { TObject *G__Lpbase=(TObject*)G__Lderived; G__inheritance_setup(G__get_linked_tagnum(&G__ModulesDictLN_MadGraphConeJetFinder),G__get_linked_tagnum(&G__ModulesDictLN_TObject),(long)G__Lpbase-(long)G__Lderived,1,0); } } } /********************************************************* * typedef information setup/ *********************************************************/ extern "C" void G__cpp_setup_typetableModulesDict() { /* Setting up typedef entry */ G__search_typename2("Version_t",115,-1,0,-1); G__setnewtype(-1,"Class version identifier (short)",0); G__search_typename2("vector<ROOT::TSchemaHelper>",117,G__get_linked_tagnum(&G__ModulesDictLN_vectorlEROOTcLcLTSchemaHelpercOallocatorlEROOTcLcLTSchemaHelpergRsPgR),0,-1); G__setnewtype(-1,NULL,0); G__search_typename2("reverse_iterator<const_iterator>",117,G__get_linked_tagnum(&G__ModulesDictLN_reverse_iteratorlEvectorlEROOTcLcLTSchemaHelpercOallocatorlEROOTcLcLTSchemaHelpergRsPgRcLcLiteratorgR),0,G__get_linked_tagnum(&G__ModulesDictLN_vectorlEROOTcLcLTSchemaHelpercOallocatorlEROOTcLcLTSchemaHelpergRsPgR)); G__setnewtype(-1,NULL,0); G__search_typename2("reverse_iterator<iterator>",117,G__get_linked_tagnum(&G__ModulesDictLN_reverse_iteratorlEvectorlEROOTcLcLTSchemaHelpercOallocatorlEROOTcLcLTSchemaHelpergRsPgRcLcLiteratorgR),0,G__get_linked_tagnum(&G__ModulesDictLN_vectorlEROOTcLcLTSchemaHelpercOallocatorlEROOTcLcLTSchemaHelpergRsPgR)); G__setnewtype(-1,NULL,0); G__search_typename2("vector<TVirtualArray*>",117,G__get_linked_tagnum(&G__ModulesDictLN_vectorlETVirtualArraymUcOallocatorlETVirtualArraymUgRsPgR),0,-1); G__setnewtype(-1,NULL,0); G__search_typename2("reverse_iterator<const_iterator>",117,G__get_linked_tagnum(&G__ModulesDictLN_reverse_iteratorlEvectorlETVirtualArraymUcOallocatorlETVirtualArraymUgRsPgRcLcLiteratorgR),0,G__get_linked_tagnum(&G__ModulesDictLN_vectorlETVirtualArraymUcOallocatorlETVirtualArraymUgRsPgR)); G__setnewtype(-1,NULL,0); G__search_typename2("reverse_iterator<iterator>",117,G__get_linked_tagnum(&G__ModulesDictLN_reverse_iteratorlEvectorlETVirtualArraymUcOallocatorlETVirtualArraymUgRsPgRcLcLiteratorgR),0,G__get_linked_tagnum(&G__ModulesDictLN_vectorlETVirtualArraymUcOallocatorlETVirtualArraymUgRsPgR)); G__setnewtype(-1,NULL,0); G__search_typename2("iterator<std::bidirectional_iterator_tag,TObject*,std::ptrdiff_t,const TObject**,const TObject*&>",117,G__get_linked_tagnum(&G__ModulesDictLN_iteratorlEbidirectional_iterator_tagcOTObjectmUcOlongcOconstsPTObjectmUmUcOconstsPTObjectmUaNgR),0,-1); G__setnewtype(-1,NULL,0); G__search_typename2("iterator<bidirectional_iterator_tag,TObject*,std::ptrdiff_t,const TObject**,const TObject*&>",117,G__get_linked_tagnum(&G__ModulesDictLN_iteratorlEbidirectional_iterator_tagcOTObjectmUcOlongcOconstsPTObjectmUmUcOconstsPTObjectmUaNgR),0,-1); G__setnewtype(-1,NULL,0); G__search_typename2("iterator<bidirectional_iterator_tag,TObject*>",117,G__get_linked_tagnum(&G__ModulesDictLN_iteratorlEbidirectional_iterator_tagcOTObjectmUcOlongcOconstsPTObjectmUmUcOconstsPTObjectmUaNgR),0,-1); G__setnewtype(-1,NULL,0); G__search_typename2("iterator<bidirectional_iterator_tag,TObject*,long>",117,G__get_linked_tagnum(&G__ModulesDictLN_iteratorlEbidirectional_iterator_tagcOTObjectmUcOlongcOconstsPTObjectmUmUcOconstsPTObjectmUaNgR),0,-1); G__setnewtype(-1,NULL,0); G__search_typename2("iterator<bidirectional_iterator_tag,TObject*,long,const TObject**>",117,G__get_linked_tagnum(&G__ModulesDictLN_iteratorlEbidirectional_iterator_tagcOTObjectmUcOlongcOconstsPTObjectmUmUcOconstsPTObjectmUaNgR),0,-1); G__setnewtype(-1,NULL,0); G__search_typename2("map<TString,TString>",117,G__get_linked_tagnum(&G__ModulesDictLN_maplETStringcOTStringcOlesslETStringgRcOallocatorlEpairlEconstsPTStringcOTStringgRsPgRsPgR),0,-1); G__setnewtype(-1,NULL,0); G__search_typename2("map<TString,TString,less<TString> >",117,G__get_linked_tagnum(&G__ModulesDictLN_maplETStringcOTStringcOlesslETStringgRcOallocatorlEpairlEconstsPTStringcOTStringgRsPgRsPgR),0,-1); G__setnewtype(-1,NULL,0); G__search_typename2("map<TString,ParticleHistograms*>",117,G__get_linked_tagnum(&G__ModulesDictLN_maplETStringcOMadGraphAnalysiscLcLParticleHistogramsmUcOlesslETStringgRcOallocatorlEpairlEconstsPTStringcOMadGraphAnalysiscLcLParticleHistogramsmUgRsPgRsPgR),0,-1); G__setnewtype(-1,NULL,0); G__search_typename2("map<TString,MadGraphAnalysis::ParticleHistograms*>",117,G__get_linked_tagnum(&G__ModulesDictLN_maplETStringcOMadGraphAnalysiscLcLParticleHistogramsmUcOlesslETStringgRcOallocatorlEpairlEconstsPTStringcOMadGraphAnalysiscLcLParticleHistogramsmUgRsPgRsPgR),0,-1); G__setnewtype(-1,NULL,0); G__search_typename2("map<TString,MadGraphAnalysis::ParticleHistograms*,less<TString> >",117,G__get_linked_tagnum(&G__ModulesDictLN_maplETStringcOMadGraphAnalysiscLcLParticleHistogramsmUcOlesslETStringgRcOallocatorlEpairlEconstsPTStringcOMadGraphAnalysiscLcLParticleHistogramsmUgRsPgRsPgR),0,-1); G__setnewtype(-1,NULL,0); G__search_typename2("map<TString,PairHistograms*>",117,G__get_linked_tagnum(&G__ModulesDictLN_maplETStringcOMadGraphAnalysiscLcLPairHistogramsmUcOlesslETStringgRcOallocatorlEpairlEconstsPTStringcOMadGraphAnalysiscLcLPairHistogramsmUgRsPgRsPgR),0,-1); G__setnewtype(-1,NULL,0); G__search_typename2("map<TString,MadGraphAnalysis::PairHistograms*>",117,G__get_linked_tagnum(&G__ModulesDictLN_maplETStringcOMadGraphAnalysiscLcLPairHistogramsmUcOlesslETStringgRcOallocatorlEpairlEconstsPTStringcOMadGraphAnalysiscLcLPairHistogramsmUgRsPgRsPgR),0,-1); G__setnewtype(-1,NULL,0); G__search_typename2("map<TString,MadGraphAnalysis::PairHistograms*,less<TString> >",117,G__get_linked_tagnum(&G__ModulesDictLN_maplETStringcOMadGraphAnalysiscLcLPairHistogramsmUcOlesslETStringgRcOallocatorlEpairlEconstsPTStringcOMadGraphAnalysiscLcLPairHistogramsmUgRsPgRsPgR),0,-1); G__setnewtype(-1,NULL,0); G__search_typename2("vector<const KtLorentzVector*>",117,G__get_linked_tagnum(&G__ModulesDictLN_vectorlEconstsPKtJetcLcLKtLorentzVectormUcOallocatorlEconstsPKtJetcLcLKtLorentzVectormUgRsPgR),0,-1); G__setnewtype(-1,NULL,0); G__search_typename2("reverse_iterator<const_iterator>",117,G__get_linked_tagnum(&G__ModulesDictLN_reverse_iteratorlEvectorlEconstsPKtJetcLcLKtLorentzVectormUcOallocatorlEconstsPKtJetcLcLKtLorentzVectormUgRsPgRcLcLiteratorgR),0,G__get_linked_tagnum(&G__ModulesDictLN_vectorlEconstsPKtJetcLcLKtLorentzVectormUcOallocatorlEconstsPKtJetcLcLKtLorentzVectormUgRsPgR)); G__setnewtype(-1,NULL,0); G__search_typename2("reverse_iterator<iterator>",117,G__get_linked_tagnum(&G__ModulesDictLN_reverse_iteratorlEvectorlEconstsPKtJetcLcLKtLorentzVectormUcOallocatorlEconstsPKtJetcLcLKtLorentzVectormUgRsPgRcLcLiteratorgR),0,G__get_linked_tagnum(&G__ModulesDictLN_vectorlEconstsPKtJetcLcLKtLorentzVectormUcOallocatorlEconstsPKtJetcLcLKtLorentzVectormUgRsPgR)); G__setnewtype(-1,NULL,0); G__search_typename2("vector<const KtJet::KtLorentzVector*>",117,G__get_linked_tagnum(&G__ModulesDictLN_vectorlEconstsPKtJetcLcLKtLorentzVectormUcOallocatorlEconstsPKtJetcLcLKtLorentzVectormUgRsPgR),0,-1); G__setnewtype(-1,NULL,0); G__search_typename2("vector<KtLorentzVector>",117,G__get_linked_tagnum(&G__ModulesDictLN_vectorlEKtJetcLcLKtLorentzVectorcOallocatorlEKtJetcLcLKtLorentzVectorgRsPgR),0,-1); G__setnewtype(-1,NULL,0); G__search_typename2("reverse_iterator<const_iterator>",117,G__get_linked_tagnum(&G__ModulesDictLN_reverse_iteratorlEvectorlEKtJetcLcLKtLorentzVectorcOallocatorlEKtJetcLcLKtLorentzVectorgRsPgRcLcLiteratorgR),0,G__get_linked_tagnum(&G__ModulesDictLN_vectorlEKtJetcLcLKtLorentzVectorcOallocatorlEKtJetcLcLKtLorentzVectorgRsPgR)); G__setnewtype(-1,NULL,0); G__search_typename2("reverse_iterator<iterator>",117,G__get_linked_tagnum(&G__ModulesDictLN_reverse_iteratorlEvectorlEKtJetcLcLKtLorentzVectorcOallocatorlEKtJetcLcLKtLorentzVectorgRsPgRcLcLiteratorgR),0,G__get_linked_tagnum(&G__ModulesDictLN_vectorlEKtJetcLcLKtLorentzVectorcOallocatorlEKtJetcLcLKtLorentzVectorgRsPgR)); G__setnewtype(-1,NULL,0); G__search_typename2("vector<KtJet::KtLorentzVector>",117,G__get_linked_tagnum(&G__ModulesDictLN_vectorlEKtJetcLcLKtLorentzVectorcOallocatorlEKtJetcLcLKtLorentzVectorgRsPgR),0,-1); G__setnewtype(-1,NULL,0); G__search_typename2("vector<PhysicsTower>",117,G__get_linked_tagnum(&G__ModulesDictLN_vectorlEPhysicsTowercOallocatorlEPhysicsTowergRsPgR),0,-1); G__setnewtype(-1,NULL,0); G__search_typename2("reverse_iterator<const_iterator>",117,G__get_linked_tagnum(&G__ModulesDictLN_reverse_iteratorlEvectorlEPhysicsTowercOallocatorlEPhysicsTowergRsPgRcLcLiteratorgR),0,G__get_linked_tagnum(&G__ModulesDictLN_vectorlEPhysicsTowercOallocatorlEPhysicsTowergRsPgR)); G__setnewtype(-1,NULL,0); G__search_typename2("reverse_iterator<iterator>",117,G__get_linked_tagnum(&G__ModulesDictLN_reverse_iteratorlEvectorlEPhysicsTowercOallocatorlEPhysicsTowergRsPgRcLcLiteratorgR),0,G__get_linked_tagnum(&G__ModulesDictLN_vectorlEPhysicsTowercOallocatorlEPhysicsTowergRsPgR)); G__setnewtype(-1,NULL,0); G__search_typename2("vector<Cluster>",117,G__get_linked_tagnum(&G__ModulesDictLN_vectorlEClustercOallocatorlEClustergRsPgR),0,-1); G__setnewtype(-1,NULL,0); G__search_typename2("reverse_iterator<const_iterator>",117,G__get_linked_tagnum(&G__ModulesDictLN_reverse_iteratorlEvectorlEClustercOallocatorlEClustergRsPgRcLcLiteratorgR),0,G__get_linked_tagnum(&G__ModulesDictLN_vectorlEClustercOallocatorlEClustergRsPgR)); G__setnewtype(-1,NULL,0); G__search_typename2("reverse_iterator<iterator>",117,G__get_linked_tagnum(&G__ModulesDictLN_reverse_iteratorlEvectorlEClustercOallocatorlEClustergRsPgRcLcLiteratorgR),0,G__get_linked_tagnum(&G__ModulesDictLN_vectorlEClustercOallocatorlEClustergRsPgR)); G__setnewtype(-1,NULL,0); } /********************************************************* * Data Member information setup/ *********************************************************/ /* Setting up class,struct,union tag member variable */ /* MadGraphClassFilter */ static void G__setup_memvarMadGraphClassFilter(void) { G__tag_memvar_setup(G__get_linked_tagnum(&G__ModulesDictLN_MadGraphClassFilter)); { MadGraphClassFilter *p; p=(MadGraphClassFilter*)0x1000; if (p) { } G__memvar_setup((void*)0,85,0,0,G__get_linked_tagnum(&G__ModulesDictLN_ExRootFilter),-1,-1,4,"fFilter=",0,"!"); G__memvar_setup((void*)0,85,0,0,G__get_linked_tagnum(&G__ModulesDictLN_MadGraphParticleClassifier),-1,-1,4,"fClassifier=",0,"!"); G__memvar_setup((void*)0,85,0,0,G__get_linked_tagnum(&G__ModulesDictLN_TIterator),-1,-1,4,"fItParticle=",0,"!"); G__memvar_setup((void*)0,85,0,0,G__get_linked_tagnum(&G__ModulesDictLN_TClonesArray),-1,-1,4,"fBranchParticle=",0,"!"); G__memvar_setup((void*)0,85,0,0,G__get_linked_tagnum(&G__ModulesDictLN_TObjArray),-1,-1,4,"fOutputArray=",0,"!"); G__memvar_setup((void*)0,85,0,0,G__get_linked_tagnum(&G__ModulesDictLN_TClass),-1,-2,4,"fgIsA=",0,(char*)NULL); } G__tag_memvar_reset(); } /* MadGraphAnalysis */ static void G__setup_memvarMadGraphAnalysis(void) { G__tag_memvar_setup(G__get_linked_tagnum(&G__ModulesDictLN_MadGraphAnalysis)); { MadGraphAnalysis *p; p=(MadGraphAnalysis*)0x1000; if (p) { } G__memvar_setup((void*)0,117,0,0,G__get_linked_tagnum(&G__ModulesDictLN_TString),-1,-1,4,"fOutputFileName=",0,"!"); G__memvar_setup((void*)0,85,0,1,G__get_linked_tagnum(&G__ModulesDictLN_TObjArray),-1,-1,4,"fInputArray=",0,"!"); G__memvar_setup((void*)0,85,0,0,G__get_linked_tagnum(&G__ModulesDictLN_TClonesArray),-1,-1,4,"fBranchEvent=",0,"!"); G__memvar_setup((void*)0,117,0,0,G__get_linked_tagnum(&G__ModulesDictLN_maplETStringcOMadGraphAnalysiscLcLParticleHistogramsmUcOlesslETStringgRcOallocatorlEpairlEconstsPTStringcOMadGraphAnalysiscLcLParticleHistogramsmUgRsPgRsPgR),G__defined_typename("map<TString,ParticleHistograms*>"),-1,4,"fParticleHistogramsMap=",0,"!"); G__memvar_setup((void*)0,117,0,0,G__get_linked_tagnum(&G__ModulesDictLN_maplETStringcOMadGraphAnalysiscLcLPairHistogramsmUcOlesslETStringgRcOallocatorlEpairlEconstsPTStringcOMadGraphAnalysiscLcLPairHistogramsmUgRsPgRsPgR),G__defined_typename("map<TString,PairHistograms*>"),-1,4,"fPairHistogramsMap=",0,"!"); G__memvar_setup((void*)0,85,0,0,G__get_linked_tagnum(&G__ModulesDictLN_TClass),-1,-2,4,"fgIsA=",0,(char*)NULL); } G__tag_memvar_reset(); } /* MadGraphKtJetFinder */ static void G__setup_memvarMadGraphKtJetFinder(void) { G__tag_memvar_setup(G__get_linked_tagnum(&G__ModulesDictLN_MadGraphKtJetFinder)); { MadGraphKtJetFinder *p; p=(MadGraphKtJetFinder*)0x1000; if (p) { } G__memvar_setup((void*)0,100,0,0,-1,G__defined_typename("Double_t"),-1,4,"fMaxParticleEta=",0,(char*)NULL); G__memvar_setup((void*)0,100,0,0,-1,G__defined_typename("Double_t"),-1,4,"fMinParticlePT=",0,(char*)NULL); G__memvar_setup((void*)0,100,0,0,-1,G__defined_typename("Double_t"),-1,4,"fMinJetPT=",0,(char*)NULL); G__memvar_setup((void*)0,100,0,0,-1,G__defined_typename("Double_t"),-1,4,"fParameterR=",0,(char*)NULL); G__memvar_setup((void*)0,105,0,0,-1,G__defined_typename("Int_t"),-1,4,"fCollisionType=",0,(char*)NULL); G__memvar_setup((void*)0,105,0,0,-1,G__defined_typename("Int_t"),-1,4,"fDistanceScheme=",0,(char*)NULL); G__memvar_setup((void*)0,105,0,0,-1,G__defined_typename("Int_t"),-1,4,"fRecombinationScheme=",0,(char*)NULL); G__memvar_setup((void*)0,117,0,0,G__get_linked_tagnum(&G__ModulesDictLN_vectorlEKtJetcLcLKtLorentzVectorcOallocatorlEKtJetcLcLKtLorentzVectorgRsPgR),G__defined_typename("vector<KtJet::KtLorentzVector>"),-1,4,"fTowersList=",0,"!"); G__memvar_setup((void*)0,117,0,0,G__get_linked_tagnum(&G__ModulesDictLN_vectorlEKtJetcLcLKtLorentzVectorcOallocatorlEKtJetcLcLKtLorentzVectorgRsPgR),G__defined_typename("vector<KtJet::KtLorentzVector>"),-1,4,"fJetsList=",0,"!"); G__memvar_setup((void*)0,85,0,0,G__get_linked_tagnum(&G__ModulesDictLN_TIterator),-1,-1,4,"fItParticle=",0,"!"); G__memvar_setup((void*)0,85,0,0,G__get_linked_tagnum(&G__ModulesDictLN_TClonesArray),-1,-1,4,"fBranchParticle=",0,"!"); G__memvar_setup((void*)0,85,0,0,G__get_linked_tagnum(&G__ModulesDictLN_TObjArray),-1,-1,4,"fOutputArray=",0,"!"); G__memvar_setup((void*)0,85,0,0,G__get_linked_tagnum(&G__ModulesDictLN_TClass),-1,-2,4,"fgIsA=",0,(char*)NULL); } G__tag_memvar_reset(); } /* MadGraphConeJetFinder */ static void G__setup_memvarMadGraphConeJetFinder(void) { G__tag_memvar_setup(G__get_linked_tagnum(&G__ModulesDictLN_MadGraphConeJetFinder)); { MadGraphConeJetFinder *p; p=(MadGraphConeJetFinder*)0x1000; if (p) { } G__memvar_setup((void*)0,100,0,0,-1,G__defined_typename("Double_t"),-1,4,"fMinParticlePT=",0,(char*)NULL); G__memvar_setup((void*)0,100,0,0,-1,G__defined_typename("Double_t"),-1,4,"fMinJetPT=",0,(char*)NULL); G__memvar_setup((void*)0,117,0,0,G__get_linked_tagnum(&G__ModulesDictLN_vectorlEPhysicsTowercOallocatorlEPhysicsTowergRsPgR),G__defined_typename("vector<PhysicsTower>"),-1,4,"fTowersList=",0,(char*)NULL); G__memvar_setup((void*)0,117,0,0,G__get_linked_tagnum(&G__ModulesDictLN_vectorlEClustercOallocatorlEClustergRsPgR),G__defined_typename("vector<Cluster>"),-1,4,"fJetsList=",0,(char*)NULL); G__memvar_setup((void*)0,85,0,0,G__get_linked_tagnum(&G__ModulesDictLN_MidPointAlgorithm),-1,-1,4,"fJetAlgo=",0,"!"); G__memvar_setup((void*)0,85,0,0,G__get_linked_tagnum(&G__ModulesDictLN_TIterator),-1,-1,4,"fItParticle=",0,"!"); G__memvar_setup((void*)0,85,0,0,G__get_linked_tagnum(&G__ModulesDictLN_TClonesArray),-1,-1,4,"fBranchParticle=",0,"!"); G__memvar_setup((void*)0,85,0,0,G__get_linked_tagnum(&G__ModulesDictLN_TObjArray),-1,-1,4,"fOutputArray=",0,"!"); G__memvar_setup((void*)0,85,0,0,G__get_linked_tagnum(&G__ModulesDictLN_TClass),-1,-2,4,"fgIsA=",0,(char*)NULL); } G__tag_memvar_reset(); } extern "C" void G__cpp_setup_memvarModulesDict() { } /*********************************************************** ************************************************************ ************************************************************ ************************************************************ ************************************************************ ************************************************************ ************************************************************ ***********************************************************/ /********************************************************* * Member function information setup for each class *********************************************************/ static void G__setup_memfuncMadGraphClassFilter(void) { /* MadGraphClassFilter */ G__tag_memfunc_setup(G__get_linked_tagnum(&G__ModulesDictLN_MadGraphClassFilter)); G__memfunc_setup("MadGraphClassFilter",1888,G__ModulesDict_451_0_1, 105, G__get_linked_tagnum(&G__ModulesDictLN_MadGraphClassFilter), -1, 0, 0, 1, 1, 0, "", (char*)NULL, (void*) NULL, 0); G__memfunc_setup("Init",404,(G__InterfaceMethod) NULL,121, -1, -1, 0, 0, 1, 1, 0, "", (char*)NULL, (void*) NULL, 1); G__memfunc_setup("Event",514,(G__InterfaceMethod) NULL,121, -1, -1, 0, 0, 1, 1, 0, "", (char*)NULL, (void*) NULL, 1); G__memfunc_setup("Finish",609,(G__InterfaceMethod) NULL,121, -1, -1, 0, 0, 1, 1, 0, "", (char*)NULL, (void*) NULL, 1); G__memfunc_setup("Class",502,G__ModulesDict_451_0_5, 85, G__get_linked_tagnum(&G__ModulesDictLN_TClass), -1, 0, 0, 3, 1, 0, "", (char*)NULL, (void*) G__func2void( (TClass* (*)())(&MadGraphClassFilter::Class) ), 0); G__memfunc_setup("Class_Name",982,G__ModulesDict_451_0_6, 67, -1, -1, 0, 0, 3, 1, 1, "", (char*)NULL, (void*) G__func2void( (const char* (*)())(&MadGraphClassFilter::Class_Name) ), 0); G__memfunc_setup("Class_Version",1339,G__ModulesDict_451_0_7, 115, -1, G__defined_typename("Version_t"), 0, 0, 3, 1, 0, "", (char*)NULL, (void*) G__func2void( (Version_t (*)())(&MadGraphClassFilter::Class_Version) ), 0); G__memfunc_setup("Dictionary",1046,G__ModulesDict_451_0_8, 121, -1, -1, 0, 0, 3, 1, 0, "", (char*)NULL, (void*) G__func2void( (void (*)())(&MadGraphClassFilter::Dictionary) ), 0); G__memfunc_setup("IsA",253,(G__InterfaceMethod) NULL,85, G__get_linked_tagnum(&G__ModulesDictLN_TClass), -1, 0, 0, 1, 1, 8, "", (char*)NULL, (void*) NULL, 1); G__memfunc_setup("ShowMembers",1132,(G__InterfaceMethod) NULL,121, -1, -1, 0, 1, 1, 1, 0, "u 'TMemberInspector' - 1 - -", (char*)NULL, (void*) NULL, 1); G__memfunc_setup("Streamer",835,(G__InterfaceMethod) NULL,121, -1, -1, 0, 1, 1, 1, 0, "u 'TBuffer' - 1 - -", (char*)NULL, (void*) NULL, 1); G__memfunc_setup("StreamerNVirtual",1656,G__ModulesDict_451_0_12, 121, -1, -1, 0, 1, 1, 1, 0, "u 'TBuffer' - 1 - ClassDef_StreamerNVirtual_b", (char*)NULL, (void*) NULL, 0); G__memfunc_setup("DeclFileName",1145,G__ModulesDict_451_0_13, 67, -1, -1, 0, 0, 3, 1, 1, "", (char*)NULL, (void*) G__func2void( (const char* (*)())(&MadGraphClassFilter::DeclFileName) ), 0); G__memfunc_setup("ImplFileLine",1178,G__ModulesDict_451_0_14, 105, -1, -1, 0, 0, 3, 1, 0, "", (char*)NULL, (void*) G__func2void( (int (*)())(&MadGraphClassFilter::ImplFileLine) ), 0); G__memfunc_setup("ImplFileName",1171,G__ModulesDict_451_0_15, 67, -1, -1, 0, 0, 3, 1, 1, "", (char*)NULL, (void*) G__func2void( (const char* (*)())(&MadGraphClassFilter::ImplFileName) ), 0); G__memfunc_setup("DeclFileLine",1152,G__ModulesDict_451_0_16, 105, -1, -1, 0, 0, 3, 1, 0, "", (char*)NULL, (void*) G__func2void( (int (*)())(&MadGraphClassFilter::DeclFileLine) ), 0); // automatic copy constructor G__memfunc_setup("MadGraphClassFilter", 1888, G__ModulesDict_451_0_17, (int) ('i'), G__get_linked_tagnum(&G__ModulesDictLN_MadGraphClassFilter), -1, 0, 1, 1, 1, 0, "u 'MadGraphClassFilter' - 11 - -", (char*) NULL, (void*) NULL, 0); // automatic destructor G__memfunc_setup("~MadGraphClassFilter", 2014, G__ModulesDict_451_0_18, (int) ('y'), -1, -1, 0, 0, 1, 1, 0, "", (char*) NULL, (void*) NULL, 1); // automatic assignment operator G__memfunc_setup("operator=", 937, G__ModulesDict_451_0_19, (int) ('u'), G__get_linked_tagnum(&G__ModulesDictLN_MadGraphClassFilter), -1, 1, 1, 1, 1, 0, "u 'MadGraphClassFilter' - 11 - -", (char*) NULL, (void*) NULL, 0); G__tag_memfunc_reset(); } static void G__setup_memfuncMadGraphAnalysis(void) { /* MadGraphAnalysis */ G__tag_memfunc_setup(G__get_linked_tagnum(&G__ModulesDictLN_MadGraphAnalysis)); G__memfunc_setup("MadGraphAnalysis",1608,G__ModulesDict_453_0_1, 105, G__get_linked_tagnum(&G__ModulesDictLN_MadGraphAnalysis), -1, 0, 0, 1, 1, 0, "", (char*)NULL, (void*) NULL, 0); G__memfunc_setup("Init",404,(G__InterfaceMethod) NULL,121, -1, -1, 0, 0, 1, 1, 0, "", (char*)NULL, (void*) NULL, 1); G__memfunc_setup("Event",514,(G__InterfaceMethod) NULL,121, -1, -1, 0, 0, 1, 1, 0, "", (char*)NULL, (void*) NULL, 1); G__memfunc_setup("Finish",609,(G__InterfaceMethod) NULL,121, -1, -1, 0, 0, 1, 1, 0, "", (char*)NULL, (void*) NULL, 1); G__memfunc_setup("BookParticleHistograms",2272,(G__InterfaceMethod) NULL, 121, -1, -1, 0, 3, 1, 4, 0, "U 'MadGraphAnalysis::ParticleHistograms' - 0 - histograms C - - 10 - name " "C - - 10 - title", (char*)NULL, (void*) NULL, 0); G__memfunc_setup("BookPairHistograms",1848,(G__InterfaceMethod) NULL, 121, -1, -1, 0, 3, 1, 4, 0, "U 'MadGraphAnalysis::PairHistograms' - 0 - histograms C - - 10 - name " "C - - 10 - title", (char*)NULL, (void*) NULL, 0); G__memfunc_setup("GetParticleHistograms",2165,(G__InterfaceMethod) NULL, 85, G__get_linked_tagnum(&G__ModulesDictLN_MadGraphAnalysiscLcLParticleHistograms), -1, 0, 2, 1, 4, 0, "C - - 10 - module i - 'Int_t' 0 - number", (char*)NULL, (void*) NULL, 0); G__memfunc_setup("GetPairHistograms",1741,(G__InterfaceMethod) NULL, 85, G__get_linked_tagnum(&G__ModulesDictLN_MadGraphAnalysiscLcLPairHistograms), -1, 0, 4, 1, 4, 0, "C - - 10 - module1 i - 'Int_t' 0 - number1 " "C - - 10 - module2 i - 'Int_t' 0 - number2", (char*)NULL, (void*) NULL, 0); G__memfunc_setup("Class",502,G__ModulesDict_453_0_9, 85, G__get_linked_tagnum(&G__ModulesDictLN_TClass), -1, 0, 0, 3, 1, 0, "", (char*)NULL, (void*) G__func2void( (TClass* (*)())(&MadGraphAnalysis::Class) ), 0); G__memfunc_setup("Class_Name",982,G__ModulesDict_453_0_10, 67, -1, -1, 0, 0, 3, 1, 1, "", (char*)NULL, (void*) G__func2void( (const char* (*)())(&MadGraphAnalysis::Class_Name) ), 0); G__memfunc_setup("Class_Version",1339,G__ModulesDict_453_0_11, 115, -1, G__defined_typename("Version_t"), 0, 0, 3, 1, 0, "", (char*)NULL, (void*) G__func2void( (Version_t (*)())(&MadGraphAnalysis::Class_Version) ), 0); G__memfunc_setup("Dictionary",1046,G__ModulesDict_453_0_12, 121, -1, -1, 0, 0, 3, 1, 0, "", (char*)NULL, (void*) G__func2void( (void (*)())(&MadGraphAnalysis::Dictionary) ), 0); G__memfunc_setup("IsA",253,(G__InterfaceMethod) NULL,85, G__get_linked_tagnum(&G__ModulesDictLN_TClass), -1, 0, 0, 1, 1, 8, "", (char*)NULL, (void*) NULL, 1); G__memfunc_setup("ShowMembers",1132,(G__InterfaceMethod) NULL,121, -1, -1, 0, 1, 1, 1, 0, "u 'TMemberInspector' - 1 - -", (char*)NULL, (void*) NULL, 1); G__memfunc_setup("Streamer",835,(G__InterfaceMethod) NULL,121, -1, -1, 0, 1, 1, 1, 0, "u 'TBuffer' - 1 - -", (char*)NULL, (void*) NULL, 1); G__memfunc_setup("StreamerNVirtual",1656,G__ModulesDict_453_0_16, 121, -1, -1, 0, 1, 1, 1, 0, "u 'TBuffer' - 1 - ClassDef_StreamerNVirtual_b", (char*)NULL, (void*) NULL, 0); G__memfunc_setup("DeclFileName",1145,G__ModulesDict_453_0_17, 67, -1, -1, 0, 0, 3, 1, 1, "", (char*)NULL, (void*) G__func2void( (const char* (*)())(&MadGraphAnalysis::DeclFileName) ), 0); G__memfunc_setup("ImplFileLine",1178,G__ModulesDict_453_0_18, 105, -1, -1, 0, 0, 3, 1, 0, "", (char*)NULL, (void*) G__func2void( (int (*)())(&MadGraphAnalysis::ImplFileLine) ), 0); G__memfunc_setup("ImplFileName",1171,G__ModulesDict_453_0_19, 67, -1, -1, 0, 0, 3, 1, 1, "", (char*)NULL, (void*) G__func2void( (const char* (*)())(&MadGraphAnalysis::ImplFileName) ), 0); G__memfunc_setup("DeclFileLine",1152,G__ModulesDict_453_0_20, 105, -1, -1, 0, 0, 3, 1, 0, "", (char*)NULL, (void*) G__func2void( (int (*)())(&MadGraphAnalysis::DeclFileLine) ), 0); // automatic copy constructor G__memfunc_setup("MadGraphAnalysis", 1608, G__ModulesDict_453_0_21, (int) ('i'), G__get_linked_tagnum(&G__ModulesDictLN_MadGraphAnalysis), -1, 0, 1, 1, 1, 0, "u 'MadGraphAnalysis' - 11 - -", (char*) NULL, (void*) NULL, 0); // automatic destructor G__memfunc_setup("~MadGraphAnalysis", 1734, G__ModulesDict_453_0_22, (int) ('y'), -1, -1, 0, 0, 1, 1, 0, "", (char*) NULL, (void*) NULL, 1); G__tag_memfunc_reset(); } static void G__setup_memfuncMadGraphKtJetFinder(void) { /* MadGraphKtJetFinder */ G__tag_memfunc_setup(G__get_linked_tagnum(&G__ModulesDictLN_MadGraphKtJetFinder)); G__memfunc_setup("MadGraphKtJetFinder",1854,G__ModulesDict_517_0_1, 105, G__get_linked_tagnum(&G__ModulesDictLN_MadGraphKtJetFinder), -1, 0, 0, 1, 1, 0, "", (char*)NULL, (void*) NULL, 0); G__memfunc_setup("Init",404,(G__InterfaceMethod) NULL,121, -1, -1, 0, 0, 1, 1, 0, "", (char*)NULL, (void*) NULL, 1); G__memfunc_setup("Event",514,(G__InterfaceMethod) NULL,121, -1, -1, 0, 0, 1, 1, 0, "", (char*)NULL, (void*) NULL, 1); G__memfunc_setup("Finish",609,(G__InterfaceMethod) NULL,121, -1, -1, 0, 0, 1, 1, 0, "", (char*)NULL, (void*) NULL, 1); G__memfunc_setup("Class",502,G__ModulesDict_517_0_5, 85, G__get_linked_tagnum(&G__ModulesDictLN_TClass), -1, 0, 0, 3, 1, 0, "", (char*)NULL, (void*) G__func2void( (TClass* (*)())(&MadGraphKtJetFinder::Class) ), 0); G__memfunc_setup("Class_Name",982,G__ModulesDict_517_0_6, 67, -1, -1, 0, 0, 3, 1, 1, "", (char*)NULL, (void*) G__func2void( (const char* (*)())(&MadGraphKtJetFinder::Class_Name) ), 0); G__memfunc_setup("Class_Version",1339,G__ModulesDict_517_0_7, 115, -1, G__defined_typename("Version_t"), 0, 0, 3, 1, 0, "", (char*)NULL, (void*) G__func2void( (Version_t (*)())(&MadGraphKtJetFinder::Class_Version) ), 0); G__memfunc_setup("Dictionary",1046,G__ModulesDict_517_0_8, 121, -1, -1, 0, 0, 3, 1, 0, "", (char*)NULL, (void*) G__func2void( (void (*)())(&MadGraphKtJetFinder::Dictionary) ), 0); G__memfunc_setup("IsA",253,(G__InterfaceMethod) NULL,85, G__get_linked_tagnum(&G__ModulesDictLN_TClass), -1, 0, 0, 1, 1, 8, "", (char*)NULL, (void*) NULL, 1); G__memfunc_setup("ShowMembers",1132,(G__InterfaceMethod) NULL,121, -1, -1, 0, 1, 1, 1, 0, "u 'TMemberInspector' - 1 - -", (char*)NULL, (void*) NULL, 1); G__memfunc_setup("Streamer",835,(G__InterfaceMethod) NULL,121, -1, -1, 0, 1, 1, 1, 0, "u 'TBuffer' - 1 - -", (char*)NULL, (void*) NULL, 1); G__memfunc_setup("StreamerNVirtual",1656,G__ModulesDict_517_0_12, 121, -1, -1, 0, 1, 1, 1, 0, "u 'TBuffer' - 1 - ClassDef_StreamerNVirtual_b", (char*)NULL, (void*) NULL, 0); G__memfunc_setup("DeclFileName",1145,G__ModulesDict_517_0_13, 67, -1, -1, 0, 0, 3, 1, 1, "", (char*)NULL, (void*) G__func2void( (const char* (*)())(&MadGraphKtJetFinder::DeclFileName) ), 0); G__memfunc_setup("ImplFileLine",1178,G__ModulesDict_517_0_14, 105, -1, -1, 0, 0, 3, 1, 0, "", (char*)NULL, (void*) G__func2void( (int (*)())(&MadGraphKtJetFinder::ImplFileLine) ), 0); G__memfunc_setup("ImplFileName",1171,G__ModulesDict_517_0_15, 67, -1, -1, 0, 0, 3, 1, 1, "", (char*)NULL, (void*) G__func2void( (const char* (*)())(&MadGraphKtJetFinder::ImplFileName) ), 0); G__memfunc_setup("DeclFileLine",1152,G__ModulesDict_517_0_16, 105, -1, -1, 0, 0, 3, 1, 0, "", (char*)NULL, (void*) G__func2void( (int (*)())(&MadGraphKtJetFinder::DeclFileLine) ), 0); // automatic copy constructor G__memfunc_setup("MadGraphKtJetFinder", 1854, G__ModulesDict_517_0_17, (int) ('i'), G__get_linked_tagnum(&G__ModulesDictLN_MadGraphKtJetFinder), -1, 0, 1, 1, 1, 0, "u 'MadGraphKtJetFinder' - 11 - -", (char*) NULL, (void*) NULL, 0); // automatic destructor G__memfunc_setup("~MadGraphKtJetFinder", 1980, G__ModulesDict_517_0_18, (int) ('y'), -1, -1, 0, 0, 1, 1, 0, "", (char*) NULL, (void*) NULL, 1); // automatic assignment operator G__memfunc_setup("operator=", 937, G__ModulesDict_517_0_19, (int) ('u'), G__get_linked_tagnum(&G__ModulesDictLN_MadGraphKtJetFinder), -1, 1, 1, 1, 1, 0, "u 'MadGraphKtJetFinder' - 11 - -", (char*) NULL, (void*) NULL, 0); G__tag_memfunc_reset(); } static void G__setup_memfuncMadGraphConeJetFinder(void) { /* MadGraphConeJetFinder */ G__tag_memfunc_setup(G__get_linked_tagnum(&G__ModulesDictLN_MadGraphConeJetFinder)); G__memfunc_setup("MadGraphConeJetFinder",2052,G__ModulesDict_528_0_1, 105, G__get_linked_tagnum(&G__ModulesDictLN_MadGraphConeJetFinder), -1, 0, 0, 1, 1, 0, "", (char*)NULL, (void*) NULL, 0); G__memfunc_setup("Init",404,(G__InterfaceMethod) NULL,121, -1, -1, 0, 0, 1, 1, 0, "", (char*)NULL, (void*) NULL, 1); G__memfunc_setup("Event",514,(G__InterfaceMethod) NULL,121, -1, -1, 0, 0, 1, 1, 0, "", (char*)NULL, (void*) NULL, 1); G__memfunc_setup("Finish",609,(G__InterfaceMethod) NULL,121, -1, -1, 0, 0, 1, 1, 0, "", (char*)NULL, (void*) NULL, 1); G__memfunc_setup("Class",502,G__ModulesDict_528_0_5, 85, G__get_linked_tagnum(&G__ModulesDictLN_TClass), -1, 0, 0, 3, 1, 0, "", (char*)NULL, (void*) G__func2void( (TClass* (*)())(&MadGraphConeJetFinder::Class) ), 0); G__memfunc_setup("Class_Name",982,G__ModulesDict_528_0_6, 67, -1, -1, 0, 0, 3, 1, 1, "", (char*)NULL, (void*) G__func2void( (const char* (*)())(&MadGraphConeJetFinder::Class_Name) ), 0); G__memfunc_setup("Class_Version",1339,G__ModulesDict_528_0_7, 115, -1, G__defined_typename("Version_t"), 0, 0, 3, 1, 0, "", (char*)NULL, (void*) G__func2void( (Version_t (*)())(&MadGraphConeJetFinder::Class_Version) ), 0); G__memfunc_setup("Dictionary",1046,G__ModulesDict_528_0_8, 121, -1, -1, 0, 0, 3, 1, 0, "", (char*)NULL, (void*) G__func2void( (void (*)())(&MadGraphConeJetFinder::Dictionary) ), 0); G__memfunc_setup("IsA",253,(G__InterfaceMethod) NULL,85, G__get_linked_tagnum(&G__ModulesDictLN_TClass), -1, 0, 0, 1, 1, 8, "", (char*)NULL, (void*) NULL, 1); G__memfunc_setup("ShowMembers",1132,(G__InterfaceMethod) NULL,121, -1, -1, 0, 1, 1, 1, 0, "u 'TMemberInspector' - 1 - -", (char*)NULL, (void*) NULL, 1); G__memfunc_setup("Streamer",835,(G__InterfaceMethod) NULL,121, -1, -1, 0, 1, 1, 1, 0, "u 'TBuffer' - 1 - -", (char*)NULL, (void*) NULL, 1); G__memfunc_setup("StreamerNVirtual",1656,G__ModulesDict_528_0_12, 121, -1, -1, 0, 1, 1, 1, 0, "u 'TBuffer' - 1 - ClassDef_StreamerNVirtual_b", (char*)NULL, (void*) NULL, 0); G__memfunc_setup("DeclFileName",1145,G__ModulesDict_528_0_13, 67, -1, -1, 0, 0, 3, 1, 1, "", (char*)NULL, (void*) G__func2void( (const char* (*)())(&MadGraphConeJetFinder::DeclFileName) ), 0); G__memfunc_setup("ImplFileLine",1178,G__ModulesDict_528_0_14, 105, -1, -1, 0, 0, 3, 1, 0, "", (char*)NULL, (void*) G__func2void( (int (*)())(&MadGraphConeJetFinder::ImplFileLine) ), 0); G__memfunc_setup("ImplFileName",1171,G__ModulesDict_528_0_15, 67, -1, -1, 0, 0, 3, 1, 1, "", (char*)NULL, (void*) G__func2void( (const char* (*)())(&MadGraphConeJetFinder::ImplFileName) ), 0); G__memfunc_setup("DeclFileLine",1152,G__ModulesDict_528_0_16, 105, -1, -1, 0, 0, 3, 1, 0, "", (char*)NULL, (void*) G__func2void( (int (*)())(&MadGraphConeJetFinder::DeclFileLine) ), 0); // automatic copy constructor G__memfunc_setup("MadGraphConeJetFinder", 2052, G__ModulesDict_528_0_17, (int) ('i'), G__get_linked_tagnum(&G__ModulesDictLN_MadGraphConeJetFinder), -1, 0, 1, 1, 1, 0, "u 'MadGraphConeJetFinder' - 11 - -", (char*) NULL, (void*) NULL, 0); // automatic destructor G__memfunc_setup("~MadGraphConeJetFinder", 2178, G__ModulesDict_528_0_18, (int) ('y'), -1, -1, 0, 0, 1, 1, 0, "", (char*) NULL, (void*) NULL, 1); // automatic assignment operator G__memfunc_setup("operator=", 937, G__ModulesDict_528_0_19, (int) ('u'), G__get_linked_tagnum(&G__ModulesDictLN_MadGraphConeJetFinder), -1, 1, 1, 1, 1, 0, "u 'MadGraphConeJetFinder' - 11 - -", (char*) NULL, (void*) NULL, 0); G__tag_memfunc_reset(); } /********************************************************* * Member function information setup *********************************************************/ extern "C" void G__cpp_setup_memfuncModulesDict() { } /********************************************************* * Global variable information setup for each class *********************************************************/ static void G__cpp_setup_global0() { /* Setting up global variables */ G__resetplocal(); } static void G__cpp_setup_global1() { } static void G__cpp_setup_global2() { G__resetglobalenv(); } extern "C" void G__cpp_setup_globalModulesDict() { G__cpp_setup_global0(); G__cpp_setup_global1(); G__cpp_setup_global2(); } /********************************************************* * Global function information setup for each class *********************************************************/ static void G__cpp_setup_func0() { G__lastifuncposition(); } static void G__cpp_setup_func1() { } static void G__cpp_setup_func2() { } static void G__cpp_setup_func3() { } static void G__cpp_setup_func4() { } static void G__cpp_setup_func5() { } static void G__cpp_setup_func6() { } static void G__cpp_setup_func7() { } static void G__cpp_setup_func8() { } static void G__cpp_setup_func9() { } static void G__cpp_setup_func10() { } static void G__cpp_setup_func11() { } static void G__cpp_setup_func12() { } static void G__cpp_setup_func13() { } static void G__cpp_setup_func14() { } static void G__cpp_setup_func15() { } static void G__cpp_setup_func16() { } static void G__cpp_setup_func17() { } static void G__cpp_setup_func18() { } static void G__cpp_setup_func19() { } static void G__cpp_setup_func20() { G__resetifuncposition(); } extern "C" void G__cpp_setup_funcModulesDict() { G__cpp_setup_func0(); G__cpp_setup_func1(); G__cpp_setup_func2(); G__cpp_setup_func3(); G__cpp_setup_func4(); G__cpp_setup_func5(); G__cpp_setup_func6(); G__cpp_setup_func7(); G__cpp_setup_func8(); G__cpp_setup_func9(); G__cpp_setup_func10(); G__cpp_setup_func11(); G__cpp_setup_func12(); G__cpp_setup_func13(); G__cpp_setup_func14(); G__cpp_setup_func15(); G__cpp_setup_func16(); G__cpp_setup_func17(); G__cpp_setup_func18(); G__cpp_setup_func19(); G__cpp_setup_func20(); } /********************************************************* * Class,struct,union,enum tag information setup *********************************************************/ /* Setup class/struct taginfo */ G__linked_taginfo G__ModulesDictLN_TClass = { "TClass" , 99 , -1 }; G__linked_taginfo G__ModulesDictLN_TBuffer = { "TBuffer" , 99 , -1 }; G__linked_taginfo G__ModulesDictLN_TMemberInspector = { "TMemberInspector" , 99 , -1 }; G__linked_taginfo G__ModulesDictLN_TObject = { "TObject" , 99 , -1 }; G__linked_taginfo G__ModulesDictLN_TNamed = { "TNamed" , 99 , -1 }; G__linked_taginfo G__ModulesDictLN_TString = { "TString" , 99 , -1 }; G__linked_taginfo G__ModulesDictLN_vectorlEROOTcLcLTSchemaHelpercOallocatorlEROOTcLcLTSchemaHelpergRsPgR = { "vector<ROOT::TSchemaHelper,allocator<ROOT::TSchemaHelper> >" , 99 , -1 }; G__linked_taginfo G__ModulesDictLN_reverse_iteratorlEvectorlEROOTcLcLTSchemaHelpercOallocatorlEROOTcLcLTSchemaHelpergRsPgRcLcLiteratorgR = { "reverse_iterator<vector<ROOT::TSchemaHelper,allocator<ROOT::TSchemaHelper> >::iterator>" , 99 , -1 }; G__linked_taginfo G__ModulesDictLN_TObjArray = { "TObjArray" , 99 , -1 }; G__linked_taginfo G__ModulesDictLN_TClonesArray = { "TClonesArray" , 99 , -1 }; G__linked_taginfo G__ModulesDictLN_vectorlETVirtualArraymUcOallocatorlETVirtualArraymUgRsPgR = { "vector<TVirtualArray*,allocator<TVirtualArray*> >" , 99 , -1 }; G__linked_taginfo G__ModulesDictLN_reverse_iteratorlEvectorlETVirtualArraymUcOallocatorlETVirtualArraymUgRsPgRcLcLiteratorgR = { "reverse_iterator<vector<TVirtualArray*,allocator<TVirtualArray*> >::iterator>" , 99 , -1 }; G__linked_taginfo G__ModulesDictLN_TIterator = { "TIterator" , 99 , -1 }; G__linked_taginfo G__ModulesDictLN_iteratorlEbidirectional_iterator_tagcOTObjectmUcOlongcOconstsPTObjectmUmUcOconstsPTObjectmUaNgR = { "iterator<bidirectional_iterator_tag,TObject*,long,const TObject**,const TObject*&>" , 115 , -1 }; G__linked_taginfo G__ModulesDictLN_TTask = { "TTask" , 99 , -1 }; G__linked_taginfo G__ModulesDictLN_maplETStringcOTStringcOlesslETStringgRcOallocatorlEpairlEconstsPTStringcOTStringgRsPgRsPgR = { "map<TString,TString,less<TString>,allocator<pair<const TString,TString> > >" , 99 , -1 }; G__linked_taginfo G__ModulesDictLN_ExRootTask = { "ExRootTask" , 99 , -1 }; G__linked_taginfo G__ModulesDictLN_ExRootModule = { "ExRootModule" , 99 , -1 }; G__linked_taginfo G__ModulesDictLN_ExRootFilter = { "ExRootFilter" , 99 , -1 }; G__linked_taginfo G__ModulesDictLN_MadGraphParticleClassifier = { "MadGraphParticleClassifier" , 99 , -1 }; G__linked_taginfo G__ModulesDictLN_MadGraphClassFilter = { "MadGraphClassFilter" , 99 , -1 }; G__linked_taginfo G__ModulesDictLN_MadGraphAnalysis = { "MadGraphAnalysis" , 99 , -1 }; G__linked_taginfo G__ModulesDictLN_MadGraphAnalysiscLcLParticleHistograms = { "MadGraphAnalysis::ParticleHistograms" , 115 , -1 }; G__linked_taginfo G__ModulesDictLN_MadGraphAnalysiscLcLPairHistograms = { "MadGraphAnalysis::PairHistograms" , 115 , -1 }; G__linked_taginfo G__ModulesDictLN_maplETStringcOMadGraphAnalysiscLcLParticleHistogramsmUcOlesslETStringgRcOallocatorlEpairlEconstsPTStringcOMadGraphAnalysiscLcLParticleHistogramsmUgRsPgRsPgR = { "map<TString,MadGraphAnalysis::ParticleHistograms*,less<TString>,allocator<pair<const TString,MadGraphAnalysis::ParticleHistograms*> > >" , 99 , -1 }; G__linked_taginfo G__ModulesDictLN_maplETStringcOMadGraphAnalysiscLcLPairHistogramsmUcOlesslETStringgRcOallocatorlEpairlEconstsPTStringcOMadGraphAnalysiscLcLPairHistogramsmUgRsPgRsPgR = { "map<TString,MadGraphAnalysis::PairHistograms*,less<TString>,allocator<pair<const TString,MadGraphAnalysis::PairHistograms*> > >" , 99 , -1 }; G__linked_taginfo G__ModulesDictLN_vectorlEconstsPKtJetcLcLKtLorentzVectormUcOallocatorlEconstsPKtJetcLcLKtLorentzVectormUgRsPgR = { "vector<const KtJet::KtLorentzVector*,allocator<const KtJet::KtLorentzVector*> >" , 99 , -1 }; G__linked_taginfo G__ModulesDictLN_reverse_iteratorlEvectorlEconstsPKtJetcLcLKtLorentzVectormUcOallocatorlEconstsPKtJetcLcLKtLorentzVectormUgRsPgRcLcLiteratorgR = { "reverse_iterator<vector<const KtJet::KtLorentzVector*,allocator<const KtJet::KtLorentzVector*> >::iterator>" , 99 , -1 }; G__linked_taginfo G__ModulesDictLN_vectorlEKtJetcLcLKtLorentzVectorcOallocatorlEKtJetcLcLKtLorentzVectorgRsPgR = { "vector<KtJet::KtLorentzVector,allocator<KtJet::KtLorentzVector> >" , 99 , -1 }; G__linked_taginfo G__ModulesDictLN_reverse_iteratorlEvectorlEKtJetcLcLKtLorentzVectorcOallocatorlEKtJetcLcLKtLorentzVectorgRsPgRcLcLiteratorgR = { "reverse_iterator<vector<KtJet::KtLorentzVector,allocator<KtJet::KtLorentzVector> >::iterator>" , 99 , -1 }; G__linked_taginfo G__ModulesDictLN_MadGraphKtJetFinder = { "MadGraphKtJetFinder" , 99 , -1 }; G__linked_taginfo G__ModulesDictLN_vectorlEPhysicsTowercOallocatorlEPhysicsTowergRsPgR = { "vector<PhysicsTower,allocator<PhysicsTower> >" , 99 , -1 }; G__linked_taginfo G__ModulesDictLN_reverse_iteratorlEvectorlEPhysicsTowercOallocatorlEPhysicsTowergRsPgRcLcLiteratorgR = { "reverse_iterator<vector<PhysicsTower,allocator<PhysicsTower> >::iterator>" , 99 , -1 }; G__linked_taginfo G__ModulesDictLN_MidPointAlgorithm = { "MidPointAlgorithm" , 99 , -1 }; G__linked_taginfo G__ModulesDictLN_MadGraphConeJetFinder = { "MadGraphConeJetFinder" , 99 , -1 }; G__linked_taginfo G__ModulesDictLN_vectorlEClustercOallocatorlEClustergRsPgR = { "vector<Cluster,allocator<Cluster> >" , 99 , -1 }; G__linked_taginfo G__ModulesDictLN_reverse_iteratorlEvectorlEClustercOallocatorlEClustergRsPgRcLcLiteratorgR = { "reverse_iterator<vector<Cluster,allocator<Cluster> >::iterator>" , 99 , -1 }; /* Reset class/struct taginfo */ extern "C" void G__cpp_reset_tagtableModulesDict() { G__ModulesDictLN_TClass.tagnum = -1 ; G__ModulesDictLN_TBuffer.tagnum = -1 ; G__ModulesDictLN_TMemberInspector.tagnum = -1 ; G__ModulesDictLN_TObject.tagnum = -1 ; G__ModulesDictLN_TNamed.tagnum = -1 ; G__ModulesDictLN_TString.tagnum = -1 ; G__ModulesDictLN_vectorlEROOTcLcLTSchemaHelpercOallocatorlEROOTcLcLTSchemaHelpergRsPgR.tagnum = -1 ; G__ModulesDictLN_reverse_iteratorlEvectorlEROOTcLcLTSchemaHelpercOallocatorlEROOTcLcLTSchemaHelpergRsPgRcLcLiteratorgR.tagnum = -1 ; G__ModulesDictLN_TObjArray.tagnum = -1 ; G__ModulesDictLN_TClonesArray.tagnum = -1 ; G__ModulesDictLN_vectorlETVirtualArraymUcOallocatorlETVirtualArraymUgRsPgR.tagnum = -1 ; G__ModulesDictLN_reverse_iteratorlEvectorlETVirtualArraymUcOallocatorlETVirtualArraymUgRsPgRcLcLiteratorgR.tagnum = -1 ; G__ModulesDictLN_TIterator.tagnum = -1 ; G__ModulesDictLN_iteratorlEbidirectional_iterator_tagcOTObjectmUcOlongcOconstsPTObjectmUmUcOconstsPTObjectmUaNgR.tagnum = -1 ; G__ModulesDictLN_TTask.tagnum = -1 ; G__ModulesDictLN_maplETStringcOTStringcOlesslETStringgRcOallocatorlEpairlEconstsPTStringcOTStringgRsPgRsPgR.tagnum = -1 ; G__ModulesDictLN_ExRootTask.tagnum = -1 ; G__ModulesDictLN_ExRootModule.tagnum = -1 ; G__ModulesDictLN_ExRootFilter.tagnum = -1 ; G__ModulesDictLN_MadGraphParticleClassifier.tagnum = -1 ; G__ModulesDictLN_MadGraphClassFilter.tagnum = -1 ; G__ModulesDictLN_MadGraphAnalysis.tagnum = -1 ; G__ModulesDictLN_MadGraphAnalysiscLcLParticleHistograms.tagnum = -1 ; G__ModulesDictLN_MadGraphAnalysiscLcLPairHistograms.tagnum = -1 ; G__ModulesDictLN_maplETStringcOMadGraphAnalysiscLcLParticleHistogramsmUcOlesslETStringgRcOallocatorlEpairlEconstsPTStringcOMadGraphAnalysiscLcLParticleHistogramsmUgRsPgRsPgR.tagnum = -1 ; G__ModulesDictLN_maplETStringcOMadGraphAnalysiscLcLPairHistogramsmUcOlesslETStringgRcOallocatorlEpairlEconstsPTStringcOMadGraphAnalysiscLcLPairHistogramsmUgRsPgRsPgR.tagnum = -1 ; G__ModulesDictLN_vectorlEconstsPKtJetcLcLKtLorentzVectormUcOallocatorlEconstsPKtJetcLcLKtLorentzVectormUgRsPgR.tagnum = -1 ; G__ModulesDictLN_reverse_iteratorlEvectorlEconstsPKtJetcLcLKtLorentzVectormUcOallocatorlEconstsPKtJetcLcLKtLorentzVectormUgRsPgRcLcLiteratorgR.tagnum = -1 ; G__ModulesDictLN_vectorlEKtJetcLcLKtLorentzVectorcOallocatorlEKtJetcLcLKtLorentzVectorgRsPgR.tagnum = -1 ; G__ModulesDictLN_reverse_iteratorlEvectorlEKtJetcLcLKtLorentzVectorcOallocatorlEKtJetcLcLKtLorentzVectorgRsPgRcLcLiteratorgR.tagnum = -1 ; G__ModulesDictLN_MadGraphKtJetFinder.tagnum = -1 ; G__ModulesDictLN_vectorlEPhysicsTowercOallocatorlEPhysicsTowergRsPgR.tagnum = -1 ; G__ModulesDictLN_reverse_iteratorlEvectorlEPhysicsTowercOallocatorlEPhysicsTowergRsPgRcLcLiteratorgR.tagnum = -1 ; G__ModulesDictLN_MidPointAlgorithm.tagnum = -1 ; G__ModulesDictLN_MadGraphConeJetFinder.tagnum = -1 ; G__ModulesDictLN_vectorlEClustercOallocatorlEClustergRsPgR.tagnum = -1 ; G__ModulesDictLN_reverse_iteratorlEvectorlEClustercOallocatorlEClustergRsPgRcLcLiteratorgR.tagnum = -1 ; } extern "C" void G__cpp_setup_tagtableModulesDict() { /* Setting up class,struct,union tag entry */ G__get_linked_tagnum_fwd(&G__ModulesDictLN_TClass); G__get_linked_tagnum_fwd(&G__ModulesDictLN_TBuffer); G__get_linked_tagnum_fwd(&G__ModulesDictLN_TMemberInspector); G__get_linked_tagnum_fwd(&G__ModulesDictLN_TObject); G__get_linked_tagnum_fwd(&G__ModulesDictLN_TNamed); G__get_linked_tagnum_fwd(&G__ModulesDictLN_TString); G__get_linked_tagnum_fwd(&G__ModulesDictLN_vectorlEROOTcLcLTSchemaHelpercOallocatorlEROOTcLcLTSchemaHelpergRsPgR); G__get_linked_tagnum_fwd(&G__ModulesDictLN_reverse_iteratorlEvectorlEROOTcLcLTSchemaHelpercOallocatorlEROOTcLcLTSchemaHelpergRsPgRcLcLiteratorgR); G__get_linked_tagnum_fwd(&G__ModulesDictLN_TObjArray); G__get_linked_tagnum_fwd(&G__ModulesDictLN_TClonesArray); G__get_linked_tagnum_fwd(&G__ModulesDictLN_vectorlETVirtualArraymUcOallocatorlETVirtualArraymUgRsPgR); G__get_linked_tagnum_fwd(&G__ModulesDictLN_reverse_iteratorlEvectorlETVirtualArraymUcOallocatorlETVirtualArraymUgRsPgRcLcLiteratorgR); G__get_linked_tagnum_fwd(&G__ModulesDictLN_TIterator); G__get_linked_tagnum_fwd(&G__ModulesDictLN_iteratorlEbidirectional_iterator_tagcOTObjectmUcOlongcOconstsPTObjectmUmUcOconstsPTObjectmUaNgR); G__get_linked_tagnum_fwd(&G__ModulesDictLN_TTask); G__get_linked_tagnum_fwd(&G__ModulesDictLN_maplETStringcOTStringcOlesslETStringgRcOallocatorlEpairlEconstsPTStringcOTStringgRsPgRsPgR); G__get_linked_tagnum_fwd(&G__ModulesDictLN_ExRootTask); G__get_linked_tagnum_fwd(&G__ModulesDictLN_ExRootModule); G__get_linked_tagnum_fwd(&G__ModulesDictLN_ExRootFilter); G__get_linked_tagnum_fwd(&G__ModulesDictLN_MadGraphParticleClassifier); G__tagtable_setup(G__get_linked_tagnum_fwd(&G__ModulesDictLN_MadGraphClassFilter),sizeof(MadGraphClassFilter),-1,324864,(char*)NULL,G__setup_memvarMadGraphClassFilter,G__setup_memfuncMadGraphClassFilter); G__tagtable_setup(G__get_linked_tagnum_fwd(&G__ModulesDictLN_MadGraphAnalysis),sizeof(MadGraphAnalysis),-1,324864,(char*)NULL,G__setup_memvarMadGraphAnalysis,G__setup_memfuncMadGraphAnalysis); G__get_linked_tagnum_fwd(&G__ModulesDictLN_MadGraphAnalysiscLcLParticleHistograms); G__get_linked_tagnum_fwd(&G__ModulesDictLN_MadGraphAnalysiscLcLPairHistograms); G__get_linked_tagnum_fwd(&G__ModulesDictLN_maplETStringcOMadGraphAnalysiscLcLParticleHistogramsmUcOlesslETStringgRcOallocatorlEpairlEconstsPTStringcOMadGraphAnalysiscLcLParticleHistogramsmUgRsPgRsPgR); G__get_linked_tagnum_fwd(&G__ModulesDictLN_maplETStringcOMadGraphAnalysiscLcLPairHistogramsmUcOlesslETStringgRcOallocatorlEpairlEconstsPTStringcOMadGraphAnalysiscLcLPairHistogramsmUgRsPgRsPgR); G__get_linked_tagnum_fwd(&G__ModulesDictLN_vectorlEconstsPKtJetcLcLKtLorentzVectormUcOallocatorlEconstsPKtJetcLcLKtLorentzVectormUgRsPgR); G__get_linked_tagnum_fwd(&G__ModulesDictLN_reverse_iteratorlEvectorlEconstsPKtJetcLcLKtLorentzVectormUcOallocatorlEconstsPKtJetcLcLKtLorentzVectormUgRsPgRcLcLiteratorgR); G__get_linked_tagnum_fwd(&G__ModulesDictLN_vectorlEKtJetcLcLKtLorentzVectorcOallocatorlEKtJetcLcLKtLorentzVectorgRsPgR); G__get_linked_tagnum_fwd(&G__ModulesDictLN_reverse_iteratorlEvectorlEKtJetcLcLKtLorentzVectorcOallocatorlEKtJetcLcLKtLorentzVectorgRsPgRcLcLiteratorgR); G__tagtable_setup(G__get_linked_tagnum_fwd(&G__ModulesDictLN_MadGraphKtJetFinder),sizeof(MadGraphKtJetFinder),-1,324864,(char*)NULL,G__setup_memvarMadGraphKtJetFinder,G__setup_memfuncMadGraphKtJetFinder); G__get_linked_tagnum_fwd(&G__ModulesDictLN_vectorlEPhysicsTowercOallocatorlEPhysicsTowergRsPgR); G__get_linked_tagnum_fwd(&G__ModulesDictLN_reverse_iteratorlEvectorlEPhysicsTowercOallocatorlEPhysicsTowergRsPgRcLcLiteratorgR); G__get_linked_tagnum_fwd(&G__ModulesDictLN_MidPointAlgorithm); G__tagtable_setup(G__get_linked_tagnum_fwd(&G__ModulesDictLN_MadGraphConeJetFinder),sizeof(MadGraphConeJetFinder),-1,324864,(char*)NULL,G__setup_memvarMadGraphConeJetFinder,G__setup_memfuncMadGraphConeJetFinder); G__get_linked_tagnum_fwd(&G__ModulesDictLN_vectorlEClustercOallocatorlEClustergRsPgR); G__get_linked_tagnum_fwd(&G__ModulesDictLN_reverse_iteratorlEvectorlEClustercOallocatorlEClustergRsPgRcLcLiteratorgR); } extern "C" void G__cpp_setupModulesDict(void) { G__check_setup_version(30051515,"G__cpp_setupModulesDict()"); G__set_cpp_environmentModulesDict(); G__cpp_setup_tagtableModulesDict(); G__cpp_setup_inheritanceModulesDict(); G__cpp_setup_typetableModulesDict(); G__cpp_setup_memvarModulesDict(); G__cpp_setup_memfuncModulesDict(); G__cpp_setup_globalModulesDict(); G__cpp_setup_funcModulesDict(); if(0==G__getsizep2memfunc()) G__get_sizep2memfuncModulesDict(); return; } class G__cpp_setup_initModulesDict { public: G__cpp_setup_initModulesDict() { G__add_setup_func("ModulesDict",(G__incsetup)(&G__cpp_setupModulesDict)); G__call_setup_funcs(); } ~G__cpp_setup_initModulesDict() { G__remove_setup_func("ModulesDict"); } }; G__cpp_setup_initModulesDict G__cpp_setup_initializerModulesDict;
26bc53606bba0d00b874807edbfa27bfb091dc43
995f187dc18e6848bf37900a1904bc3479bf8055
/ConsoleApplication27/ConsoleApplication27.cpp
f13e54cacbae498f2a49b578549852336903a779
[]
no_license
gordushha/ConsoleApplication27
d6514dc39206e8a6f2f5b5ae4cdf87c6ca189710
db5740cbfc11a8a560452529ae36704305ca926e
refs/heads/master
2022-07-17T02:36:53.035215
2020-05-13T16:30:01
2020-05-13T16:30:01
263,681,279
0
0
null
null
null
null
UTF-8
C++
false
false
4,025
cpp
#include <iostream> #pragma warning(disable:4996) size_t my_strlen(const char* str) { size_t size = 0; while (*str != '\0') { ++str; ++size; } return size; } class TString { public: TString():m_data (0) , m_size(0){} TString(const char* str) { m_size = my_strlen(str); m_data = new char[m_size + 1]; for (size_t i = 0; i < m_size + 1; ++i) { m_data[i] = str[i]; } } TString(const TString& other) : TString(other.m_data) { m_data = other.m_data; } ~TString() { delete[] m_data; } size_t size() const { return m_size; } char* data() const { return m_data; } TString operator+(const TString& other) { TString newStr; int thisLength = strlen(this->m_data); int otherLength = strlen(other.m_data); newStr.m_size = thisLength + otherLength; newStr.m_data = new char[thisLength + otherLength + 1]; int i = 0; for (; i < thisLength; i++) { newStr.m_data[i] = this->m_data[i]; } for (int j = 0; j < otherLength; j++, i++) { newStr.m_data[i] = other.m_data[j]; } newStr.m_data[thisLength + otherLength] = '\0'; return newStr; } char& operator[](size_t i) const { if (i < 0 || i >= m_size) throw "nil'zya("; else return m_data[i]; } bool operator==(const TString& other) { if (m_size != other.m_size) return false; for (size_t i = 0; i < m_size; ++i) { if (m_data[i] != other.m_data[i]) return false; } return true; } bool operator!=(const TString& other) { return !(*this == other); } size_t my_min(size_t a, size_t b) { if (a < b) return a; return b; } bool operator<(const TString& other) { for (size_t i = 0; i < my_min(m_size, other.m_size); ++i) { if (m_data[i] != other.m_data[i]) return m_data[i] < other.m_data[i]; } return m_size < other.m_size; } bool operator>(const TString& other) { if (*this < other) return false; return *this != other; } TString& operator=(const TString& other) { if (this == &other) //проверка на самокопирование return *this; m_size = other.m_size; if (m_data) delete[] m_data; m_data = new char[m_size + 1]{}; for (size_t i = 0; i < m_size + 1; ++i) { m_data[i] = other.m_data[i]; } return *this; } //Возвращает позицию int find(const char* e) { char* t = strstr(m_data, e); if (t != NULL) return t - m_data + 1; else return NULL; } TString* Tstrtok(const char* c) { int count = 0; TString tmp = m_data; char* istr = strtok(tmp.m_data, c); while (istr != NULL) { count += 1; istr = strtok(NULL, c); } tmp = m_data; TString* result = new TString[count]; count = 0; istr = strtok(tmp.m_data, c); while (istr != NULL) { result[count] = istr; count += 1; istr = strtok(NULL, c); } return result; } friend std::ostream& operator<<(std::ostream& stream, const TString& self); friend std::istream& operator>>(std::istream& stream, TString& self); private: size_t m_size; char* m_data; }; std::ostream& operator<<(std::ostream& stream, const TString& self) { stream << self.data(); return stream; } std::istream& operator>>(std::istream& stream, TString& self) { char buf[1024] = {}; stream >> buf; self = buf; return stream; } int main() { TString empty_str; std::cin >> empty_str; empty_str = empty_str; const char* str = "Hello"; char arr[6] = { 'H', 'e', 'l', 'l', 'o', '\0' }; const char* ptr = str + 4; char ch = *ptr; // ??? size_t s = my_strlen(str); // = 5 TString my_str("Hello"); TString my_copy(my_str); std::cout << my_copy << std::endl; bool is_equal = my_str == my_copy; bool is_not_equal = my_str != my_copy; return 0; }
34384a730e41f86283f53b9785247f9d585c04ab
d65c5cfaee4abf3a8403fe338d0338e068b24885
/Source/ParicialICC/MainPlayer.h
c28eb26000afd192d8e6c93906c7db63fa38f699
[]
no_license
LordWake/Unreal-2017-FPS_First_Game
7be471bbb904d267d21b289273ce70ed9509f0c4
da58dcdbc221f06b26de2da2aaee97283d360dc2
refs/heads/main
2023-05-17T14:24:45.665172
2020-12-28T02:36:01
2020-12-28T02:36:01
302,237,697
0
1
null
null
null
null
UTF-8
C++
false
false
3,299
h
// Fill out your copyright notice in the Description page of Project Settings. #pragma once #include "Engine.h" #include "Engine/World.h" #include "Runtime/Engine/Classes/Kismet/KismetMathLibrary.h" #include "PlayerBullet.h" #include "MyUI.h" #include "GameFramework/Character.h" #include "MainPlayer.generated.h" UCLASS() class PARICIALICC_API AMainPlayer : public ACharacter { GENERATED_BODY() public: AMainPlayer(); float shotTimer; float rifleShotTimer; float shieldTimer; float rifleAvailableTimer; float waitForGuns; float waitForMove; FVector gunSocketLocation; FVector rifleSocketLocation; FRotator gunSocketRotation; FRotator rifleSocketRotation; UPROPERTY(EditAnywhere, BlueprintReadWrite) float playerLife; UPROPERTY(EditAnywhere) float playerMaxLife; UPROPERTY(EditAnywhere) float myGunCoolDown; UPROPERTY(EditAnywhere) float myRifleCoolDown; UPROPERTY(EditAnywhere, BlueprintReadWrite) UParticleSystemComponent * gunMuzzle; UPROPERTY(EditAnywhere, BlueprintReadWrite) UParticleSystemComponent * rifleMuzzle; UPROPERTY(EditAnywhere) TSubclassOf<class APlayerBullet> prefabBullet; UPROPERTY(EditAnywhere) TSubclassOf<class APlayerBullet> prefabRifleBullet; UPROPERTY(EditAnywhere, BlueprintReadWrite) UStaticMeshComponent* myGun; UPROPERTY(EditAnywhere, BlueprintReadWrite) UStaticMeshComponent* myRifle; UPROPERTY(EditAnywhere, BlueprintReadWrite) UStaticMeshComponent* myShield; UPROPERTY(EditAnywhere, BlueprintReadWrite) UStaticMeshComponent* freezeShield; UPROPERTY(EditAnywhere, BlueprintReadWrite) UStaticMeshComponent* rifleLaser; UPROPERTY(EditAnywhere, BlueprintReadWrite) UStaticMeshComponent* gunLaser; UPROPERTY(EditAnywhere, BlueprintReadWrite) UAudioComponent* damageAudio; UPROPERTY(EditAnywhere, BlueprintReadWrite) UAudioComponent* gunAudio; UPROPERTY(EditAnywhere, BlueprintReadWrite) UAudioComponent* rifleAudio; UPROPERTY(EditAnywhere, BlueprintReadWrite) UAudioComponent* powerUpAudio; protected: virtual void BeginPlay() override; bool canShot; bool canShotRifle; bool playerIsDead; bool shieldActivated; bool rifleIsAvailable; bool gunLessActivated; bool freezePlayerActivated; UCameraComponent* myCamera; FVector position; FRotator viewRotation; public: virtual void Tick(float DeltaTime) override; virtual void SetupPlayerInputComponent(class UInputComponent* PlayerInputComponent) override; void ResetLevelOne(); void ResetLevelTwo(); void ResetLevelThree(); void MoveFront(float vertical); void MoveRight(float horizontal); void RotatePlayer(float rotation); void RotateCameraPlayer(float rotation); void Shoot(); void RifleShoot(); void StopRifleShoot(); void StopShoot(); void ShootCoolDown(float deltaTimer); void RifleCoolDown(float deltaTimer); void StartJump(); void EndJump(); void UpdatePlayerHUDLife(); void CheckPlayerLife(); void HealMyPlayer(float lifeToHeal); void EnableShield(); void DisableShield(float timer); void EnableRifle(); void DisableRifle(float timer); void EnableMyWeapons(float timer); void EnableMyMovement(float timer); UFUNCTION(BlueprintCallable) void TakePlayerDamage(float damage); UFUNCTION(BlueprintCallable) void GunLess(); UFUNCTION(BlueprintCallable) void FreezeMyPlayer(); };
ee9e7f30a7ff01ad2c4150a2d50ffe44865f4f5e
91b19ebb15c3f07785929b7f7a4972ca8f89c847
/Classes/Jack.cpp
dc3265eea93b68a404ff3e00f17485c21d6a14a0
[]
no_license
droidsde/DrawGirlsDiary
85519ac806bca033c09d8b60fd36624f14d93c2e
738e3cee24698937c8b21bd85517c9e10989141e
refs/heads/master
2020-04-08T18:55:14.160915
2015-01-07T05:33:16
2015-01-07T05:33:16
null
0
0
null
null
null
null
UTF-8
C++
false
false
103,675
cpp
// // Jack.cpp // DrawingJack // // Created by 사원3 on 12. 11. 29.. // // #include "Jack.h" #include "ASPopupView.h" #include "StarGoldData.h" #include "CCMenuLambda.h" #include "MaingameScene.h" #include "TutorialFlowStep.h" #include "MyLocalization.h" #include "AchieveNoti.h" #include "CommonAnimation.h" void Jack::searchAndMoveOldline(IntMoveState searchFirstMoveState) { queue<IntMoveState> bfsArray; bfsArray.push(searchFirstMoveState); bool isFinded = false; IntPoint findedPoint; bool is_not_outline_found = false; IntPoint not_outline_found_point; while(!bfsArray.empty() && !is_not_outline_found)//!isFinded) { IntMoveState t_ms = bfsArray.front(); bfsArray.pop(); if(myGD->mapState[t_ms.origin.x][t_ms.origin.y] == mapOldline) { if(!isFinded) { isFinded = true; findedPoint = t_ms.origin; } if((t_ms.origin.x != mapWidthInnerBegin && t_ms.origin.x != mapWidthInnerEnd-1) && (t_ms.origin.y != mapHeightInnerBegin || t_ms.origin.y != mapHeightInnerEnd-1)) { is_not_outline_found = true; not_outline_found_point = t_ms.origin; } else { if(t_ms.direction == directionStop) { for(int i = directionLeftUp;i <= directionUp; i++) { IntVector t_v = IntVector::directionVector((IntDirection)i); IntMoveState n_ms = IntMoveState(t_ms.origin.x+t_v.dx, t_ms.origin.y+t_v.dy, (IntDirection)i); if(n_ms.origin.isInnerMap()) bfsArray.push(n_ms); } } else if(t_ms.direction == directionLeftUp) { for(int i = directionLeftUp;i <= directionLeft; i++) { IntVector t_v = IntVector::directionVector((IntDirection)i); IntMoveState n_ms = IntMoveState(t_ms.origin.x+t_v.dx, t_ms.origin.y+t_v.dy, (IntDirection)i); if(n_ms.origin.isInnerMap()) bfsArray.push(n_ms); } { IntMoveState n_ms = IntMoveState(t_ms.origin.x, t_ms.origin.y+1, directionUp); if(n_ms.origin.isInnerMap()) bfsArray.push(n_ms);} } else if(t_ms.direction == directionLeft) { { IntMoveState n_ms = IntMoveState(t_ms.origin.x-1, t_ms.origin.y, directionLeft); if(n_ms.origin.isInnerMap()) bfsArray.push(n_ms);} } else if(t_ms.direction == directionLeftDown) { for(int i = directionLeft;i <= directionDown; i++) { IntVector t_v = IntVector::directionVector((IntDirection)i); IntMoveState n_ms = IntMoveState(t_ms.origin.x+t_v.dx, t_ms.origin.y+t_v.dy, (IntDirection)i); if(n_ms.origin.isInnerMap()) bfsArray.push(n_ms); } } else if(t_ms.direction == directionDown) { { IntMoveState n_ms = IntMoveState(t_ms.origin.x, t_ms.origin.y-1, directionDown); if(n_ms.origin.isInnerMap()) bfsArray.push(n_ms);} } else if(t_ms.direction == directionRightDown) { for(int i = directionDown;i <= directionRight; i++) { IntVector t_v = IntVector::directionVector((IntDirection)i); IntMoveState n_ms = IntMoveState(t_ms.origin.x+t_v.dx, t_ms.origin.y+t_v.dy, (IntDirection)i); if(n_ms.origin.isInnerMap()) bfsArray.push(n_ms); } } else if(t_ms.direction == directionRight) { { IntMoveState n_ms = IntMoveState(t_ms.origin.x+1, t_ms.origin.y, directionRight); if(n_ms.origin.isInnerMap()) bfsArray.push(n_ms);} } else if(t_ms.direction == directionRightUp) { for(int i = directionRight;i <= directionUp; i++) { IntVector t_v = IntVector::directionVector((IntDirection)i); IntMoveState n_ms = IntMoveState(t_ms.origin.x+t_v.dx, t_ms.origin.y+t_v.dy, (IntDirection)i); if(n_ms.origin.isInnerMap()) bfsArray.push(n_ms); } } else if(t_ms.direction == directionUp) { { IntMoveState n_ms = IntMoveState(t_ms.origin.x, t_ms.origin.y+1, directionUp); if(n_ms.origin.isInnerMap()) bfsArray.push(n_ms);} } } } else { if(t_ms.direction == directionStop) { for(int i = directionLeftUp;i <= directionUp; i++) { IntVector t_v = IntVector::directionVector((IntDirection)i); IntMoveState n_ms = IntMoveState(t_ms.origin.x+t_v.dx, t_ms.origin.y+t_v.dy, (IntDirection)i); if(n_ms.origin.isInnerMap()) bfsArray.push(n_ms); } } else if(t_ms.direction == directionLeftUp) { for(int i = directionLeftUp;i <= directionLeft; i++) { IntVector t_v = IntVector::directionVector((IntDirection)i); IntMoveState n_ms = IntMoveState(t_ms.origin.x+t_v.dx, t_ms.origin.y+t_v.dy, (IntDirection)i); if(n_ms.origin.isInnerMap()) bfsArray.push(n_ms); } { IntMoveState n_ms = IntMoveState(t_ms.origin.x, t_ms.origin.y+1, directionUp); if(n_ms.origin.isInnerMap()) bfsArray.push(n_ms);} } else if(t_ms.direction == directionLeft) { { IntMoveState n_ms = IntMoveState(t_ms.origin.x-1, t_ms.origin.y, directionLeft); if(n_ms.origin.isInnerMap()) bfsArray.push(n_ms);} } else if(t_ms.direction == directionLeftDown) { for(int i = directionLeft;i <= directionDown; i++) { IntVector t_v = IntVector::directionVector((IntDirection)i); IntMoveState n_ms = IntMoveState(t_ms.origin.x+t_v.dx, t_ms.origin.y+t_v.dy, (IntDirection)i); if(n_ms.origin.isInnerMap()) bfsArray.push(n_ms); } } else if(t_ms.direction == directionDown) { { IntMoveState n_ms = IntMoveState(t_ms.origin.x, t_ms.origin.y-1, directionDown); if(n_ms.origin.isInnerMap()) bfsArray.push(n_ms);} } else if(t_ms.direction == directionRightDown) { for(int i = directionDown;i <= directionRight; i++) { IntVector t_v = IntVector::directionVector((IntDirection)i); IntMoveState n_ms = IntMoveState(t_ms.origin.x+t_v.dx, t_ms.origin.y+t_v.dy, (IntDirection)i); if(n_ms.origin.isInnerMap()) bfsArray.push(n_ms); } } else if(t_ms.direction == directionRight) { { IntMoveState n_ms = IntMoveState(t_ms.origin.x+1, t_ms.origin.y, directionRight); if(n_ms.origin.isInnerMap()) bfsArray.push(n_ms);} } else if(t_ms.direction == directionRightUp) { for(int i = directionRight;i <= directionUp; i++) { IntVector t_v = IntVector::directionVector((IntDirection)i); IntMoveState n_ms = IntMoveState(t_ms.origin.x+t_v.dx, t_ms.origin.y+t_v.dy, (IntDirection)i); if(n_ms.origin.isInnerMap()) bfsArray.push(n_ms); } } else if(t_ms.direction == directionUp) { { IntMoveState n_ms = IntMoveState(t_ms.origin.x, t_ms.origin.y+1, directionUp); if(n_ms.origin.isInnerMap()) bfsArray.push(n_ms);} } } } if(is_not_outline_found && !not_outline_found_point.isNull()) { myGD->setJackPoint(not_outline_found_point); setPosition(not_outline_found_point.convertToCCP()); } else if(isFinded && !findedPoint.isNull()) { myGD->setJackPoint(findedPoint); setPosition(findedPoint.convertToCCP()); } else // escape point not found { CCLOG("escape point not found!"); int i = kAchievementCode_hidden_dieEasy; if(!myAchieve->isCompleted(AchievementCode(i)) && !myAchieve->isAchieve(AchievementCode(i))) { if(!myAchieve->isNoti(AchievementCode(i)) && !myAchieve->isCompleted(AchievementCode(i)) && myGD->getCommunication("UI_getUseTime") <= myAchieve->getCondition(AchievementCode(i))) { myAchieve->changeIngCount(AchievementCode(i), myAchieve->getCondition(AchievementCode(i))); AchieveNoti* t_noti = AchieveNoti::create(AchievementCode(i)); CCDirector::sharedDirector()->getRunningScene()->addChild(t_noti); } } mySGD->fail_code = kFC_gameover; myGD->setIsGameover(true); myGD->communication("Main_gameover"); } } //////////////////////////////////////////////////////////////////////////////// move test ///////////////////////////////////////////////////////// void Jack::moveTest() { IntPoint jp = myGD->getJackPoint(); CCPoint beforePosition = ccp((jp.x-1)*pixelSize+1, (jp.y-1)*pixelSize+1); IntVector dv = IntVector::directionVector(direction); IntVector s_dv = IntVector::directionVector(secondDirection); IntVector c_dv = IntVector::directionVector(no_draw_direction); IntVector c_s_dv = IntVector::directionVector(no_draw_secondDirection); if(jp.isNull()) return; if(test_speed >= 4.f) { if(is_double_moving == false) is_double_moving = true; else is_double_moving = false; } else is_double_moving = false; IntPoint checkPoint; IntPoint s_checkPoint; IntVector s_dv_reverse; IntPoint s_checkPoint_reverse; if(direction == directionLeftDown) { if(before_x_direction != directionLeft && before_x_direction != directionDown) { dv = IntVector::directionVector(secondDirection); before_x_direction = secondDirection; } else dv = IntVector::directionVector(before_x_direction); if(before_x_direction == secondDirection) { if(before_x_direction == directionLeft) { s_dv = IntVector::directionVector(directionDown); s_dv_reverse = IntVector::directionVector(directionUp); } else { s_dv = IntVector::directionVector(directionLeft); s_dv_reverse = IntVector::directionVector(directionRight); } } else s_dv_reverse = IntVector::reverseDirectionVector(secondDirection); } else if(direction == directionRightDown) { if(before_x_direction != directionRight && before_x_direction != directionDown) { dv = IntVector::directionVector(secondDirection); before_x_direction = secondDirection; } else dv = IntVector::directionVector(before_x_direction); if(before_x_direction == secondDirection) { if(before_x_direction == directionRight) { s_dv = IntVector::directionVector(directionDown); s_dv_reverse = IntVector::directionVector(directionUp); } else { s_dv = IntVector::directionVector(directionRight); s_dv_reverse = IntVector::directionVector(directionLeft); } } else s_dv_reverse = IntVector::reverseDirectionVector(secondDirection); } else if(direction == directionRightUp) { if(before_x_direction != directionRight && before_x_direction != directionUp) { dv = IntVector::directionVector(secondDirection); before_x_direction = secondDirection; } else dv = IntVector::directionVector(before_x_direction); if(before_x_direction == secondDirection) { if(before_x_direction == directionRight) { s_dv = IntVector::directionVector(directionUp); s_dv_reverse = IntVector::directionVector(directionDown); } else { s_dv = IntVector::directionVector(directionRight); s_dv_reverse = IntVector::directionVector(directionLeft); } } else s_dv_reverse = IntVector::reverseDirectionVector(secondDirection); } else if(direction == directionLeftUp) { if(before_x_direction != directionLeft && before_x_direction != directionUp) { dv = IntVector::directionVector(secondDirection); before_x_direction = secondDirection; } else dv = IntVector::directionVector(before_x_direction); if(before_x_direction == secondDirection) { if(before_x_direction == directionLeft) { s_dv = IntVector::directionVector(directionUp); s_dv_reverse = IntVector::directionVector(directionDown); } else { s_dv = IntVector::directionVector(directionLeft); s_dv_reverse = IntVector::directionVector(directionRight); } } else s_dv_reverse = IntVector::reverseDirectionVector(secondDirection); } else s_dv_reverse = IntVector::reverseDirectionVector(secondDirection); checkPoint = IntPoint(jp.x+dv.dx, jp.y+dv.dy); s_checkPoint = IntPoint(jp.x+s_dv.dx, jp.y+s_dv.dy); s_checkPoint_reverse = IntPoint(jp.x+s_dv_reverse.dx, jp.y+s_dv_reverse.dy); IntPoint c_checkPoint = IntPoint(jp.x+c_dv.dx, jp.y+c_dv.dy); IntPoint c_s_checkPoint = IntPoint(jp.x+c_s_dv.dx, jp.y+c_s_dv.dy); float t_speed = test_speed > 2.f ? 2.f : test_speed; if(myState == jackStateNormal) { // main direction moving if(c_dv.dx == 0 && c_dv.dy == 0) stopMove(); else if(c_checkPoint.isInnerMap() && myGD->mapState[c_checkPoint.x][c_checkPoint.y] == mapOldline) // moving { afterPoint = IntPoint(c_checkPoint.x, c_checkPoint.y); CCPoint t_ap = ccp((afterPoint.x-1)*pixelSize+1, (afterPoint.y-1)*pixelSize+1); if(sqrtf(powf(t_ap.x-getPositionX(), 2.f)+powf(t_ap.y-getPositionY(), 2.f)) > 5.f) { CCLOG("line %d, gPx %.1f, gPy %.1f, aPx %.1f, aPy %.1f", __LINE__, getPositionX(), getPositionY(), t_ap.x, t_ap.y); } CCPoint turnPosition = ccpAdd(getPosition(), ccp(t_speed*c_dv.dx,t_speed*c_dv.dy)); turnPosition = checkOutlineTurnPosition(turnPosition); setPosition(turnPosition); // if(mySGD->getSelectedCharacterHistory().characterNo.getV() == 2) // { IntDirection t_direction = c_dv.getDirection(); if(t_direction == directionLeft) { if(jack_ccb_manager->getRunningSequenceName() == NULL || jack_ccb_manager->getRunningSequenceName() != string("move_left")) jack_ccb_manager->runAnimationsForSequenceNamed("move_left"); } else if(t_direction == directionRight) { if(jack_ccb_manager->getRunningSequenceName() == NULL || jack_ccb_manager->getRunningSequenceName() != string("move_right")) jack_ccb_manager->runAnimationsForSequenceNamed("move_right"); } else if(t_direction == directionUp) { if(jack_ccb_manager->getRunningSequenceName() == NULL || jack_ccb_manager->getRunningSequenceName() != string("move_up")) jack_ccb_manager->runAnimationsForSequenceNamed("move_up"); } else if(t_direction == directionDown) { if(jack_ccb_manager->getRunningSequenceName() == NULL || jack_ccb_manager->getRunningSequenceName() != string("move_down")) jack_ccb_manager->runAnimationsForSequenceNamed("move_down"); } jack_img_direction = t_direction; // } // else // { // if(jack_ccb_manager->getRunningSequenceName() == NULL || jack_ccb_manager->getRunningSequenceName() != string("move")) // jack_ccb_manager->runAnimationsForSequenceNamed("move"); // // if(c_dv.dx == -1 && jack_img_direction == directionRight) // { // jackImg->setScaleX(-1.f); // jack_img_direction = directionLeft; // } // else if(c_dv.dx == 1 && jack_img_direction == directionLeft) // { // jackImg->setScaleX(1.f); // jack_img_direction = directionRight; // } // } } // main direction drawing else if(c_checkPoint.isInnerMap() && myGD->mapState[c_checkPoint.x][c_checkPoint.y] == mapEmpty && isDrawingOn) // main drawing start { myGD->communication("CP_onJackDrawLine"); // path add if(is_end_turn) { is_end_turn = false; IntPointVector t_pv = IntPointVector(jp.x, jp.y, c_dv.dx, c_dv.dy); myGD->communication("PM_addPath", t_pv); } // jack drawing setJackState(jackStateDrawing); afterPoint = IntPoint(c_checkPoint.x, c_checkPoint.y); CCPoint t_ap = ccp((afterPoint.x-1)*pixelSize+1, (afterPoint.y-1)*pixelSize+1); if(sqrtf(powf(t_ap.x-getPositionX(), 2.f)+powf(t_ap.y-getPositionY(), 2.f)) > 5.f) { CCLOG("line %d, gPx %.1f, gPy %.1f, aPx %.1f, aPy %.1f", __LINE__, getPositionX(), getPositionY(), t_ap.x, t_ap.y); } CCPoint turnPosition = ccpAdd(getPosition(), ccp(t_speed*c_dv.dx,t_speed*c_dv.dy)); turnPosition = checkOutlineTurnPosition(turnPosition); setPosition(turnPosition); // if(mySGD->getSelectedCharacterHistory().characterNo.getV() == 2) // { IntDirection t_direction = c_dv.getDirection(); if(t_direction == directionLeft) { if(jack_ccb_manager->getRunningSequenceName() == NULL || jack_ccb_manager->getRunningSequenceName() != string("draw_left")) jack_ccb_manager->runAnimationsForSequenceNamed("draw_left"); } else if(t_direction == directionRight) { if(jack_ccb_manager->getRunningSequenceName() == NULL || jack_ccb_manager->getRunningSequenceName() != string("draw_right")) jack_ccb_manager->runAnimationsForSequenceNamed("draw_right"); } else if(t_direction == directionUp) { if(jack_ccb_manager->getRunningSequenceName() == NULL || jack_ccb_manager->getRunningSequenceName() != string("draw_up")) jack_ccb_manager->runAnimationsForSequenceNamed("draw_up"); } else if(t_direction == directionDown) { if(jack_ccb_manager->getRunningSequenceName() == NULL || jack_ccb_manager->getRunningSequenceName() != string("draw_down")) jack_ccb_manager->runAnimationsForSequenceNamed("draw_down"); } jack_img_direction = t_direction; // } // else // { // if(jack_ccb_manager->getRunningSequenceName() == NULL || jack_ccb_manager->getRunningSequenceName() != string("draw")) // jack_ccb_manager->runAnimationsForSequenceNamed("draw"); // // if(c_dv.dx == -1 && jack_img_direction == directionRight) // { // jackImg->setScaleX(-1.f); // jack_img_direction = directionLeft; // } // else if(c_dv.dx == 1 && jack_img_direction == directionLeft) // { // jackImg->setScaleX(1.f); // jack_img_direction = directionRight; // } // } } else if(c_s_dv.dx == 0 && c_s_dv.dy == 0) stopMove(); else if(c_checkPoint.isInnerMap() && (myGD->mapState[c_checkPoint.x][c_checkPoint.y] == mapEmpty || myGD->mapState[c_checkPoint.x][c_checkPoint.y] == mapOldget) && c_s_checkPoint.isInnerMap() && myGD->mapState[c_s_checkPoint.x][c_s_checkPoint.y] == mapOldline) { afterPoint = IntPoint(c_s_checkPoint.x, c_s_checkPoint.y); CCPoint t_ap = ccp((afterPoint.x-1)*pixelSize+1, (afterPoint.y-1)*pixelSize+1); if(sqrtf(powf(t_ap.x-getPositionX(), 2.f)+powf(t_ap.y-getPositionY(), 2.f)) > 5.f) { CCLOG("line %d, gPx %.1f, gPy %.1f, aPx %.1f, aPy %.1f", __LINE__, getPositionX(), getPositionY(), t_ap.x, t_ap.y); } CCPoint turnPosition = ccpAdd(getPosition(), ccp(t_speed*c_s_dv.dx,t_speed*c_s_dv.dy)); turnPosition = checkOutlineTurnPosition(turnPosition); setPosition(turnPosition); // if(mySGD->getSelectedCharacterHistory().characterNo.getV() == 2) // { IntDirection t_direction = c_s_dv.getDirection(); if(t_direction == directionLeft) { if(jack_ccb_manager->getRunningSequenceName() == NULL || jack_ccb_manager->getRunningSequenceName() != string("move_left")) jack_ccb_manager->runAnimationsForSequenceNamed("move_left"); } else if(t_direction == directionRight) { if(jack_ccb_manager->getRunningSequenceName() == NULL || jack_ccb_manager->getRunningSequenceName() != string("move_right")) jack_ccb_manager->runAnimationsForSequenceNamed("move_right"); } else if(t_direction == directionUp) { if(jack_ccb_manager->getRunningSequenceName() == NULL || jack_ccb_manager->getRunningSequenceName() != string("move_up")) jack_ccb_manager->runAnimationsForSequenceNamed("move_up"); } else if(t_direction == directionDown) { if(jack_ccb_manager->getRunningSequenceName() == NULL || jack_ccb_manager->getRunningSequenceName() != string("move_down")) jack_ccb_manager->runAnimationsForSequenceNamed("move_down"); } jack_img_direction = t_direction; // } // else // { // if(jack_ccb_manager->getRunningSequenceName() == NULL || jack_ccb_manager->getRunningSequenceName() != string("move")) // jack_ccb_manager->runAnimationsForSequenceNamed("move"); // // if(c_s_dv.dx == -1 && jack_img_direction == directionRight) // { // jackImg->setScaleX(-1.f); // jack_img_direction = directionLeft; // } // else if(c_s_dv.dx == 1 && jack_img_direction == directionLeft) // { // jackImg->setScaleX(1.f); // jack_img_direction = directionRight; // } // } } else // don't move { stopMove(); } } else // myState == jackStateDrawing { // main direction drawing if(dv.dx == 0 && dv.dy == 0) stopMove(); else if(checkPoint.isInnerMap() && (myGD->mapState[checkPoint.x][checkPoint.y] == mapOldline || myGD->mapState[checkPoint.x][checkPoint.y] == mapEmpty) && isDrawingOn) // { // path add if(is_end_turn) { is_end_turn = false; IntPointVector t_pv = IntPointVector(jp.x, jp.y, dv.dx, dv.dy); myGD->communication("PM_addPath", t_pv); } // jack drawing afterPoint = IntPoint(checkPoint.x, checkPoint.y); CCPoint t_ap = ccp((afterPoint.x-1)*pixelSize+1, (afterPoint.y-1)*pixelSize+1); if(sqrtf(powf(t_ap.x-getPositionX(), 2.f)+powf(t_ap.y-getPositionY(), 2.f)) > 5.f) { CCLOG("line %d, gPx %.1f, gPy %.1f, aPx %.1f, aPy %.1f", __LINE__, getPositionX(), getPositionY(), t_ap.x, t_ap.y); } CCPoint turnPosition = ccpAdd(getPosition(), ccp(t_speed*dv.dx,t_speed*dv.dy)); turnPosition = checkOutlineTurnPosition(turnPosition); setPosition(turnPosition); // if(mySGD->getSelectedCharacterHistory().characterNo.getV() == 2) // { IntDirection t_direction = dv.getDirection(); if(t_direction == directionLeft) { if(jack_ccb_manager->getRunningSequenceName() == NULL || jack_ccb_manager->getRunningSequenceName() != string("draw_left")) jack_ccb_manager->runAnimationsForSequenceNamed("draw_left"); } else if(t_direction == directionRight) { if(jack_ccb_manager->getRunningSequenceName() == NULL || jack_ccb_manager->getRunningSequenceName() != string("draw_right")) jack_ccb_manager->runAnimationsForSequenceNamed("draw_right"); } else if(t_direction == directionUp) { if(jack_ccb_manager->getRunningSequenceName() == NULL || jack_ccb_manager->getRunningSequenceName() != string("draw_up")) jack_ccb_manager->runAnimationsForSequenceNamed("draw_up"); } else if(t_direction == directionDown) { if(jack_ccb_manager->getRunningSequenceName() == NULL || jack_ccb_manager->getRunningSequenceName() != string("draw_down")) jack_ccb_manager->runAnimationsForSequenceNamed("draw_down"); } jack_img_direction = t_direction; // } // else // { // if(jack_ccb_manager->getRunningSequenceName() == NULL || jack_ccb_manager->getRunningSequenceName() != string("draw")) // jack_ccb_manager->runAnimationsForSequenceNamed("draw"); // // if(dv.dx == -1 && jack_img_direction == directionRight) // { // jackImg->setScaleX(-1.f); // jack_img_direction = directionLeft; // } // else if(dv.dx == 1 && jack_img_direction == directionLeft) // { // jackImg->setScaleX(1.f); // jack_img_direction = directionRight; // } // } } else if(!myDSH->getBoolForKey(kDSH_Key_isDisableLineOver)) { if(s_dv.dx == 0 && s_dv.dy == 0) stopMove(); else if(checkPoint.isInnerMap() && myGD->mapState[checkPoint.x][checkPoint.y] == mapNewline && isDrawingOn) { // path add if(is_end_turn) { is_end_turn = false; IntPointVector t_pv = IntPointVector(jp.x, jp.y, dv.dx, dv.dy); myGD->communication("PM_addPath", t_pv); } // jack drawing afterPoint = IntPoint(checkPoint.x, checkPoint.y); CCPoint t_ap = ccp((afterPoint.x-1)*pixelSize+1, (afterPoint.y-1)*pixelSize+1); if(sqrtf(powf(t_ap.x-getPositionX(), 2.f)+powf(t_ap.y-getPositionY(), 2.f)) > 5.f) { CCLOG("line %d, gPx %.1f, gPy %.1f, aPx %.1f, aPy %.1f", __LINE__, getPositionX(), getPositionY(), t_ap.x, t_ap.y); } CCPoint turnPosition = ccpAdd(getPosition(), ccp(t_speed*dv.dx,t_speed*dv.dy)); turnPosition = checkOutlineTurnPosition(turnPosition); setPosition(turnPosition); // if(mySGD->getSelectedCharacterHistory().characterNo.getV() == 2) // { IntDirection t_direction = dv.getDirection(); if(t_direction == directionLeft) { if(jack_ccb_manager->getRunningSequenceName() == NULL || jack_ccb_manager->getRunningSequenceName() != string("draw_left")) jack_ccb_manager->runAnimationsForSequenceNamed("draw_left"); } else if(t_direction == directionRight) { if(jack_ccb_manager->getRunningSequenceName() == NULL || jack_ccb_manager->getRunningSequenceName() != string("draw_right")) jack_ccb_manager->runAnimationsForSequenceNamed("draw_right"); } else if(t_direction == directionUp) { if(jack_ccb_manager->getRunningSequenceName() == NULL || jack_ccb_manager->getRunningSequenceName() != string("draw_up")) jack_ccb_manager->runAnimationsForSequenceNamed("draw_up"); } else if(t_direction == directionDown) { if(jack_ccb_manager->getRunningSequenceName() == NULL || jack_ccb_manager->getRunningSequenceName() != string("draw_down")) jack_ccb_manager->runAnimationsForSequenceNamed("draw_down"); } jack_img_direction = t_direction; // } // else // { // if(jack_ccb_manager->getRunningSequenceName() == NULL || jack_ccb_manager->getRunningSequenceName() != string("draw")) // jack_ccb_manager->runAnimationsForSequenceNamed("draw"); // // if(dv.dx == -1 && jack_img_direction == directionRight) // { // jackImg->setScaleX(-1.f); // jack_img_direction = directionLeft; // } // else if(dv.dx == 1 && jack_img_direction == directionLeft) // { // jackImg->setScaleX(1.f); // jack_img_direction = directionRight; // } // } } else stopMove(); } else { if(s_dv.dx == 0 && s_dv.dy == 0) stopMove(); else if(checkPoint.isInnerMap() && myGD->mapState[checkPoint.x][checkPoint.y] == mapNewline && isDrawingOn && s_checkPoint.isInnerMap() && (myGD->mapState[s_checkPoint.x][s_checkPoint.y] == mapEmpty || myGD->mapState[s_checkPoint.x][s_checkPoint.y] == mapOldline)) { if(is_end_turn) { is_end_turn = false; IntPointVector t_pv = IntPointVector(jp.x, jp.y, s_dv.dx, s_dv.dy); myGD->communication("PM_addPath", t_pv); } // jack drawing afterPoint = IntPoint(s_checkPoint.x, s_checkPoint.y); CCPoint t_ap = ccp((afterPoint.x-1)*pixelSize+1, (afterPoint.y-1)*pixelSize+1); if(sqrtf(powf(t_ap.x-getPositionX(), 2.f)+powf(t_ap.y-getPositionY(), 2.f)) > 5.f) { CCLOG("line %d, gPx %.1f, gPy %.1f, aPx %.1f, aPy %.1f", __LINE__, getPositionX(), getPositionY(), t_ap.x, t_ap.y); } CCPoint turnPosition = ccpAdd(getPosition(), ccp(t_speed*s_dv.dx,t_speed*s_dv.dy)); turnPosition = checkOutlineTurnPosition(turnPosition); setPosition(turnPosition); // if(mySGD->getSelectedCharacterHistory().characterNo.getV() == 2) // { IntDirection t_direction = s_dv.getDirection(); if(t_direction == directionLeft) { if(jack_ccb_manager->getRunningSequenceName() == NULL || jack_ccb_manager->getRunningSequenceName() != string("draw_left")) jack_ccb_manager->runAnimationsForSequenceNamed("draw_left"); } else if(t_direction == directionRight) { if(jack_ccb_manager->getRunningSequenceName() == NULL || jack_ccb_manager->getRunningSequenceName() != string("draw_right")) jack_ccb_manager->runAnimationsForSequenceNamed("draw_right"); } else if(t_direction == directionUp) { if(jack_ccb_manager->getRunningSequenceName() == NULL || jack_ccb_manager->getRunningSequenceName() != string("draw_up")) jack_ccb_manager->runAnimationsForSequenceNamed("draw_up"); } else if(t_direction == directionDown) { if(jack_ccb_manager->getRunningSequenceName() == NULL || jack_ccb_manager->getRunningSequenceName() != string("draw_down")) jack_ccb_manager->runAnimationsForSequenceNamed("draw_down"); } jack_img_direction = t_direction; // } // else // { // if(jack_ccb_manager->getRunningSequenceName() == NULL || jack_ccb_manager->getRunningSequenceName() != string("draw")) // jack_ccb_manager->runAnimationsForSequenceNamed("draw"); // // if(s_dv.dx == -1 && jack_img_direction == directionRight) // { // jackImg->setScaleX(-1.f); // jack_img_direction = directionLeft; // } // else if(s_dv.dx == 1 && jack_img_direction == directionLeft) // { // jackImg->setScaleX(1.f); // jack_img_direction = directionRight; // } // } } else if(s_dv_reverse.dx == 0 && s_dv_reverse.dy == 0) stopMove(); else if(checkPoint.isInnerMap() && myGD->mapState[checkPoint.x][checkPoint.y] == mapNewline && isDrawingOn && s_checkPoint_reverse.isInnerMap() && (myGD->mapState[s_checkPoint_reverse.x][s_checkPoint_reverse.y] == mapEmpty || myGD->mapState[s_checkPoint_reverse.x][s_checkPoint_reverse.y] == mapOldline)) { if(is_end_turn) { is_end_turn = false; IntPointVector t_pv = IntPointVector(jp.x, jp.y, s_dv_reverse.dx, s_dv_reverse.dy); myGD->communication("PM_addPath", t_pv); } // jack drawing afterPoint = IntPoint(s_checkPoint_reverse.x, s_checkPoint_reverse.y); CCPoint t_ap = ccp((afterPoint.x-1)*pixelSize+1, (afterPoint.y-1)*pixelSize+1); if(sqrtf(powf(t_ap.x-getPositionX(), 2.f)+powf(t_ap.y-getPositionY(), 2.f)) > 5.f) { CCLOG("line %d, gPx %.1f, gPy %.1f, aPx %.1f, aPy %.1f", __LINE__, getPositionX(), getPositionY(), t_ap.x, t_ap.y); } CCPoint turnPosition = ccpAdd(getPosition(), ccp(t_speed*s_dv_reverse.dx,t_speed*s_dv_reverse.dy)); turnPosition = checkOutlineTurnPosition(turnPosition); setPosition(turnPosition); // if(mySGD->getSelectedCharacterHistory().characterNo.getV() == 2) // { IntDirection t_direction = s_dv_reverse.getDirection(); if(t_direction == directionLeft) { if(jack_ccb_manager->getRunningSequenceName() == NULL || jack_ccb_manager->getRunningSequenceName() != string("draw_left")) jack_ccb_manager->runAnimationsForSequenceNamed("draw_left"); } else if(t_direction == directionRight) { if(jack_ccb_manager->getRunningSequenceName() == NULL || jack_ccb_manager->getRunningSequenceName() != string("draw_right")) jack_ccb_manager->runAnimationsForSequenceNamed("draw_right"); } else if(t_direction == directionUp) { if(jack_ccb_manager->getRunningSequenceName() == NULL || jack_ccb_manager->getRunningSequenceName() != string("draw_up")) jack_ccb_manager->runAnimationsForSequenceNamed("draw_up"); } else if(t_direction == directionDown) { if(jack_ccb_manager->getRunningSequenceName() == NULL || jack_ccb_manager->getRunningSequenceName() != string("draw_down")) jack_ccb_manager->runAnimationsForSequenceNamed("draw_down"); } jack_img_direction = t_direction; // } // else // { // if(jack_ccb_manager->getRunningSequenceName() == NULL || jack_ccb_manager->getRunningSequenceName() != string("draw")) // jack_ccb_manager->runAnimationsForSequenceNamed("draw"); // // if(s_dv_reverse.dx == -1 && jack_img_direction == directionRight) // { // jackImg->setScaleX(-1.f); // jack_img_direction = directionLeft; // } // else if(s_dv_reverse.dx == 1 && jack_img_direction == directionLeft) // { // jackImg->setScaleX(1.f); // jack_img_direction = directionRight; // } // } } else // don't move { stopMove(); } } } float t_distance = sqrtf(powf(beforePosition.x-getPositionX(), 2.f) + powf(beforePosition.y-getPositionY(), 2.f)); if(t_distance >= 2.f) { is_end_turn = true; check_turn_cnt++; IntPoint beforePoint = myGD->getJackPoint(); CCPoint t_ap = ccp((afterPoint.x-1)*pixelSize+1, (afterPoint.y-1)*pixelSize+1); if(sqrtf(powf(t_ap.x-getPositionX(), 2.f)+powf(t_ap.y-getPositionY(), 2.f)) > 5.f) { CCLOG("line %d, gPx %.1f, gPy %.1f, aPx %.1f, aPy %.1f", __LINE__, getPositionX(), getPositionY(), t_ap.x, t_ap.y); afterPoint = IntPoint::convertToIntPoint(getPosition()); } myGD->setJackPoint(afterPoint); if(myGD->mapState[afterPoint.x][afterPoint.y] == mapOldline && myGD->mapState[beforePoint.x][beforePoint.y] == mapNewline) // != mapOldline { if(myState == jackStateDrawing) { setPosition(ccp((afterPoint.x-1)*pixelSize+1, (afterPoint.y-1)*pixelSize+1)); // isDrawingOn = false; afterDirection = directionStop; setJackState(jackStateNormal); // new rect get !!! myGD->communication("SW_stopAllSW"); myGD->communication("MS_ingNewlineToRealNewline"); myGD->communication("MS_scanMap"); myGD->communication("PM_cleanPath"); escapeJack(); } } else if(myGD->mapState[afterPoint.x][afterPoint.y] == mapEmpty) { if(!myDSH->getBoolForKey(kDSH_Key_isDisableLineOver)) myGD->communication("PM_checkBeforeNewline", afterPoint); myGD->mapState[afterPoint.x][afterPoint.y] = mapNewline; // CCLOG("draw after point x : %d, y : %d", afterPoint.x, afterPoint.y); } else if(!myDSH->getBoolForKey(kDSH_Key_isDisableLineOver) && myGD->mapState[afterPoint.x][afterPoint.y] == mapNewline) { if(!myDSH->getBoolForKey(kDSH_Key_isDisableLineOver)) myGD->communication("PM_checkBeforeNewline", afterPoint); } if(afterDirection == directionStop) { // CCPoint t_ap = ccp((afterPoint.x-1)*pixelSize+1, (afterPoint.y-1)*pixelSize+1); // if(sqrtf(powf(t_ap.x-getPositionX(), 2.f)+powf(t_ap.y-getPositionY(), 2.f)) > 5.f) // { // CCLOG("line %d, gPx %.1f, gPy %.1f, aPx %.1f, aPy %.1f", __LINE__, getPositionX(), getPositionY(), t_ap.x, t_ap.y); // afterPoint = IntPoint::convertToIntPoint(getPosition()); // } setPosition(ccp((afterPoint.x-1)*pixelSize+1, (afterPoint.y-1)*pixelSize+1)); // direction = afterDirection; stopMove(); } else { int check_top_line, check_bottom_line; if(myGD->game_step == kGS_limited) { check_top_line = myGD->limited_step_top; check_bottom_line = myGD->limited_step_bottom; } else { check_top_line = mapHeightInnerEnd-1; check_bottom_line = mapHeightInnerBegin; } if(direction == directionLeftDown) { if(before_x_cnt > 0) { if(before_x_direction == directionLeft && afterPoint.y > check_bottom_line) before_x_direction = directionDown; else if(before_x_direction == directionDown && afterPoint.x > mapWidthInnerBegin) before_x_direction = directionLeft; before_x_cnt = 0; } else { if(before_x_direction != directionLeft && before_x_direction != directionDown) { before_x_direction = secondDirection; before_x_cnt = 0; } else before_x_cnt++; } } else if(direction == directionRightDown) { if(before_x_cnt > 0) { if(before_x_direction == directionRight && afterPoint.y > check_bottom_line) before_x_direction = directionDown; else if(before_x_direction == directionDown && afterPoint.x < mapWidthInnerEnd-1) before_x_direction = directionRight; before_x_cnt = 0; } else { if(before_x_direction != directionRight && before_x_direction != directionDown) { before_x_direction = secondDirection; before_x_cnt = 0; } else before_x_cnt++; } } else if(direction == directionRightUp) { if(before_x_cnt > 0) { if(before_x_direction == directionRight && afterPoint.y < check_top_line) before_x_direction = directionUp; else if(before_x_direction == directionUp && afterPoint.x < mapWidthInnerEnd-1) before_x_direction = directionRight; before_x_cnt = 0; } else { if(before_x_direction != directionRight && before_x_direction != directionUp) { before_x_direction = secondDirection; before_x_cnt = 0; } else before_x_cnt++; } } else if(direction == directionLeftUp) { if(before_x_cnt > 0) { if(before_x_direction == directionLeft && afterPoint.y < check_top_line) before_x_direction = directionUp; else if(before_x_direction == directionUp && afterPoint.x > mapWidthInnerBegin) before_x_direction = directionLeft; before_x_cnt = 0; } else { if(before_x_direction != directionLeft && before_x_direction != directionUp) { before_x_direction = secondDirection; before_x_cnt = 0; } else before_x_cnt++; } } if(direction != afterDirection) { check_turn_cnt = 0; IntPoint a_jp = afterPoint; setPosition(ccp((a_jp.x-1)*pixelSize+1, (a_jp.y-1)*pixelSize+1)); // CCLOG("change direction x : %d , y : %d , before : %d , after : %d", a_jp.x, a_jp.y, direction, afterDirection); // myGD->communication("PM_lastPathRemove"); IntVector t_vector = IntVector::directionVector(afterDirection); IntPointVector t_pv = IntPointVector(afterPoint.x, afterPoint.y, t_vector.dx, t_vector.dy); myGD->communication("PM_checkLastAddPath", t_pv); before_x_direction = directionStop; before_x_cnt = 0; direction = afterDirection; } } test_speed = after_speed; } if(willBackTracking) { // direction = afterDirection = directionStop; stopMove(); setPosition(ccp((afterPoint.x-1)*pixelSize+1, (afterPoint.y-1)*pixelSize+1)); if(myGD->mapState[afterPoint.x][afterPoint.y] == mapNewline) { if(!myDSH->getBoolForKey(kDSH_Key_isDisableLineOver)) { if(myGD->getCommunicationBool("PM_checkRemoveNewline", afterPoint)) myGD->mapState[afterPoint.x][afterPoint.y] = mapEmpty; } else myGD->mapState[afterPoint.x][afterPoint.y] = mapEmpty; } setJackState(jackStateBackTracking); if(!btPoint.isNull()) { myGD->setJackPoint(btPoint); setPosition(ccp((btPoint.x-1)*pixelSize+1, (btPoint.y-1)*pixelSize+1)); } isDrawingOn = myDSH->getBoolForKey(kDSH_Key_isDisableDrawButton); if(!isStun) myGD->communication("Main_startBackTracking"); else myGD->communication("Main_stunBackTracking"); } if(is_double_moving) { moveTest(); } } Jack* Jack::create() { Jack* myJack = new Jack(); myJack->myInit(); myJack->autorelease(); return myJack; } void Jack::setPosition( CCPoint t_sp ) { // float t_distance = sqrtf(powf(t_sp.x-getPositionX(), 2.f) + powf(t_sp.y-getPositionY(), 2.f)); // if(t_distance > 5.f) // { // CCLOG("what?!"); // } CCNode::setPosition(t_sp); myGD->communication("Main_moveGamePosition", t_sp); myGD->communication("VS_setMoveGamePosition", t_sp); } void Jack::changeDirection( IntDirection t_d, IntDirection t_sd ) { if(isReverse) { t_d = reverseDirection(t_d); t_sd = reverseDirection(t_sd); } IntPoint jp = myGD->getJackPoint(); if(jp.isNull()) return; if(myGD->mapState[jp.x-1][jp.y] != mapOldline && myGD->mapState[jp.x-1][jp.y] != mapNewline && myGD->mapState[jp.x+1][jp.y] != mapOldline && myGD->mapState[jp.x+1][jp.y] != mapNewline && myGD->mapState[jp.x][jp.y-1] != mapOldline && myGD->mapState[jp.x][jp.y-1] != mapNewline && myGD->mapState[jp.x][jp.y+1] != mapOldline && myGD->mapState[jp.x][jp.y+1] != mapNewline) { escapeJack(); } IntDirection c_d = directionStop; IntDirection c_sd = directionStop; if(t_d == directionLeftDown) { c_d = t_sd; if(t_sd == directionLeft) c_sd = directionDown; else if(t_sd == directionDown) c_sd = directionLeft; } else if(t_d == directionRightDown) { c_d = t_sd; if(t_sd == directionDown) c_sd = directionRight; else if(t_sd == directionRight) c_sd = directionDown; } else if(t_d == directionRightUp) { c_d = t_sd; if(t_sd == directionRight) c_sd = directionUp; else if(t_sd == directionUp) c_sd = directionRight; } else if(t_d == directionLeftUp) { c_d = t_sd; if(t_sd == directionLeft) c_sd = directionUp; else if(t_sd == directionUp) c_sd = directionLeft; } else { c_d = t_d; c_sd = t_sd; } if(direction == directionStop && t_d != directionStop) // move start { IntVector dv = IntVector::directionVector(t_d); IntVector cv = IntVector::directionVector(c_d); if(!isDrawingOn && myGD->mapState[jp.x+cv.dx][jp.y+cv.dy] == mapEmpty) { IntVector sdv = IntVector::directionVector(c_sd); if(!myGD->mapState[jp.x+sdv.dx][jp.y+sdv.dy] == mapOldline) { return; } else { check_turn_cnt = 0; direction = t_d; no_draw_direction = c_d; afterDirection = direction; secondDirection = t_sd; no_draw_secondDirection = c_sd; startMove(); return; } // isDrawingOn = true; } // else if(!isDrawingOn && myGD->mapState[jp.x+dv.dx][jp.y+dv.dy] == mapOldget) // if gesture // { // IntVector sdv = IntVector::directionVector(t_sd); // int loop_cnt = 0; // while(myGD->mapState[jp.x+sdv.dx][jp.y+sdv.dy] == mapOldline && loop_cnt < 3) // { // loop_cnt++; // if(myGD->mapState[jp.x+sdv.dx+dv.dx][jp.y+sdv.dy+dv.dy] == mapOldline) // { // check_turn_cnt = 4; // direction = t_sd; // afterDirection = direction; // secondDirection = t_d; // loop_cnt = 5; // startMove(); // break; // } // else // { // IntVector t_sdv = IntVector::directionVector(t_sd); // sdv.dx += t_sdv.dx; // sdv.dy += t_sdv.dy; // } // } // if(loop_cnt < 5) // { // sdv = IntVector::reverseDirectionVector(t_sd); // loop_cnt = 0; // while(myGD->mapState[jp.x+sdv.dx][jp.y+sdv.dy] == mapOldline && loop_cnt < 3) // { // loop_cnt++; // if(myGD->mapState[jp.x+sdv.dx+dv.dx][jp.y+sdv.dy+dv.dy] == mapOldline) // { // check_turn_cnt = 4; // direction = IntVector::getReverseDirection(t_sd); // afterDirection = direction; // secondDirection = t_d; // loop_cnt = 5; // startMove(); // break; // } // else // { // IntVector t_sdv = IntVector::reverseDirectionVector(t_sd); // sdv.dx += t_sdv.dx; // sdv.dy += t_sdv.dy; // } // } // } // // return; // } // else if(myGD->mapState[jp.x+dv.dx][jp.y+dv.dy] == mapNewline) // { // check_turn_cnt = 4; // isReverseGesture = true; // direction = t_sd; // afterDirection = t_d; // secondDirection = t_d; // keep_direction = kKeepDirection_empty; // startMove(); // return; // } check_turn_cnt = 0; direction = t_d; no_draw_direction = c_d; afterDirection = direction; secondDirection = t_sd; no_draw_secondDirection = c_sd; startMove(); } // else if(t_d == directionStop) // move stop // { // afterDirection = t_d; // secondDirection = t_sd; // } else // real change direction { IntVector dv = IntVector::directionVector(t_d); IntVector cv = IntVector::directionVector(c_d); if(!isDrawingOn && (myGD->mapState[jp.x+cv.dx][jp.y+cv.dy] == mapEmpty || myGD->mapState[jp.x+cv.dx][jp.y+cv.dy] == mapOldget)) { IntVector sdv = IntVector::directionVector(c_sd); if(!myGD->mapState[jp.x+sdv.dx][jp.y+sdv.dy] == mapOldline) { if(isMoving) stopMove(); } else { check_turn_cnt = 0; direction = t_d; no_draw_direction = c_d; afterDirection = direction; secondDirection = t_sd; no_draw_secondDirection = c_sd; // startMove(); } return; } if(t_d == direction) { check_turn_cnt = 0; } // if((t_d != directionStop && t_sd != directionStop) && myGD->mapState[jp.x+dv.dx][jp.y+dv.dy] == mapNewline) // { // isReverseGesture = true; // reverseTurnCnt = 0; // afterDirection = t_sd; // secondDirection = t_d; // } // else // { // if(isReverseGesture) isReverseGesture = false; afterDirection = t_d; secondDirection = t_sd; no_draw_direction = c_d; no_draw_secondDirection = c_sd; keep_direction = kKeepDirection_empty; // } } // if() // { // direction = directionStop; // afterDirection = directionStop; // secondDirection = directionStop; // } } void Jack::backTrackingAtAfterMoving( IntPoint t_p ) { if(t_p.isNull()) return; if(isMoving) { btPoint = t_p; } else { myGD->setJackPoint(t_p); setPosition(ccp((t_p.x-1)*pixelSize+1, (t_p.y-1)*pixelSize+1)); if(myState != jackStateBackTracking) myGD->communication("Main_startBackTracking"); setJackState(jackStateBackTracking); } } void Jack::endBackTracking() { setJackState(jackStateNormal); if(jack_ccb_manager->getRunningSequenceName() == NULL || jack_ccb_manager->getRunningSequenceName() != string("stop")) { jack_ccb_manager->runAnimationsForSequenceNamed("stop"); // if(mySGD->getSelectedCharacterHistory().characterNo.getV() == 2) jack_img_direction = directionStop; } afterDirection = directionStop; secondDirection = directionStop; keep_direction = kKeepDirection_empty; // isReverseGesture = false; for(int i=mapWidthInnerBegin;i<mapWidthInnerEnd;i++) { for(int j=mapHeightInnerBegin;j<mapHeightInnerEnd;j++) { if(myGD->mapState[i][j] == mapNewline) { if(!myDSH->getBoolForKey(kDSH_Key_isDisableLineOver)) { if(myGD->getCommunicationBool("PM_checkRemoveNewline", IntPoint(i,j))) myGD->mapState[i][j] = mapEmpty; } else myGD->mapState[i][j] = mapEmpty; } } } afterPoint = IntPoint::convertToIntPoint(getPosition()); if(myGD->mapState[afterPoint.x][afterPoint.y] != mapOldline) { IntMoveState searchFirstMoveState = IntMoveState(afterPoint.x, afterPoint.y, directionStop); searchAndMoveOldline(searchFirstMoveState); } } void Jack::changeSpeed( float t_s ) { if(t_s > 4.f) t_s = 4.f; else if(t_s > 2.f) t_s = 2.f; else if(t_s < 0.8f) t_s = 0.8f; after_speed = t_s; if(test_speed < after_speed) { speed_change_img = SpeedChangeEffect::create(true); addChild(speed_change_img, kJackZ_stunEffect); speed_change_img->startAction(); } else if(test_speed > after_speed) { speed_change_img = SpeedChangeEffect::create(false); addChild(speed_change_img, kJackZ_stunEffect); speed_change_img->startAction(); } } void Jack::createHammer() { if(!t_se) { t_se = StunHammer::create(this, callfunc_selector(Jack::stunJack)); addChild(t_se, kJackZ_stunEffect); ((StunHammer*)t_se)->startAction(); } else { ((StunHammer*)t_se)->showHammer(); } } void Jack::createFog() { if(!t_se) { t_se = IceFog::create(this, callfunc_selector(Jack::stunJack)); addChild(t_se, kJackZ_stunEffect); ((IceFog*)t_se)->startAction(); } else { ((IceFog*)t_se)->showFog(); } } void Jack::createSleep() { if(!t_se) { t_se = Sleep::create(this, callfunc_selector(Jack::stunJack)); addChild(t_se, kJackZ_stunEffect); ((Sleep*)t_se)->startAction(); } else { ((Sleep*)t_se)->showCircle(); } } void Jack::createChaos() { if(!t_chaos) { t_chaos = Chaos::create(this, callfunc_selector(Jack::reverseOn)); addChild(t_chaos, kJackZ_stunEffect); t_chaos->startAction(); } else { t_chaos->showCircle(); } } void Jack::reverseOn() { isReverse = true; } void Jack::reverseOff() { isReverse = false; if(t_chaos) { t_chaos->removeFromParentAndCleanup(true); t_chaos = NULL; } } void Jack::stunJack() { myGD->communication("Main_touchEnd"); if(isDrawingOn) isDrawingOn = myDSH->getBoolForKey(kDSH_Key_isDisableDrawButton); } IntDirection Jack::getDirection() { return direction; } IntDirection Jack::getSecondDirection() { return secondDirection; } jackState Jack::getJackState() { return myState; } void Jack::stopMove() { if(getJackState() == jackStateNormal) { if(jack_ccb_manager->getRunningSequenceName() == NULL || jack_ccb_manager->getRunningSequenceName() != string("stop")) { jack_ccb_manager->runAnimationsForSequenceNamed("stop"); // if(mySGD->getSelectedCharacterHistory().characterNo.getV() == 2) jack_img_direction = directionStop; } } else if(getJackState() == jackStateDrawing) { if(jack_ccb_manager->getRunningSequenceName() == NULL || jack_ccb_manager->getRunningSequenceName() != string("draw_stop")) { jack_ccb_manager->runAnimationsForSequenceNamed("draw_stop"); // if(mySGD->getSelectedCharacterHistory().characterNo.getV() == 2) jack_img_direction = directionStop; } } direction = directionStop; afterDirection = directionStop; secondDirection = directionStop; before_x_direction = directionStop; before_x_cnt = 0; isMoving = false; unschedule(schedule_selector(Jack::moveTest)); escapeJack(); } void Jack::stopJack() { unschedule(schedule_selector(Jack::moveTest)); } void Jack::startDieEffect( int die_type ) /* after coding */ { // return; if(!isDie && !myGD->getJackIsUnbeatable() && !myGD->getIsGameover()) { myGD->communication("Main_checkHideStartMapGacha"); AudioEngine::sharedInstance()->playEffect(CCString::createWithFormat("ment_die%d.mp3", rand()%3+1)->getCString(), false, true); myGD->toFun(); myGD->communication("UI_writeDie"); myGD->communication("CP_onJackDie"); if(die_type == DieType::kDieType_other) { myLog->addLog(kLOG_die_other, myGD->getCommunication("UI_getUseTime")); // if(!myDSH->getBoolForKey(kDSH_Key_wasTutorialPopupCrashArea)) // { // myDSH->setBoolForKey(kDSH_Key_wasTutorialPopupCrashArea, true); // CCNode* exit_target = getParent()->getParent(); // exit_target->onExit(); // // ASPopupView* t_popup = ASPopupView::create(-200); // // CCSize screen_size = CCEGLView::sharedOpenGLView()->getFrameSize(); // float screen_scale_x = screen_size.width/screen_size.height/1.5f; // if(screen_scale_x < 1.f) // screen_scale_x = 1.f; // // t_popup->setDimmedSize(CCSizeMake(screen_scale_x*480.f, myDSH->ui_top));// /myDSH->screen_convert_rate)); // t_popup->setDimmedPosition(ccp(240, myDSH->ui_center_y)); // t_popup->setBasePosition(ccp(240, myDSH->ui_center_y)); // // CCNode* t_container = CCNode::create(); // t_popup->setContainerNode(t_container); // exit_target->getParent()->addChild(t_popup); // //// CCScale9Sprite* case_back = CCScale9Sprite::create("popup3_case_back.png", CCRectMake(0, 0, 150, 150), CCRectMake(13, 45, 135-13, 105-13)); //// case_back->setPosition(CCPointZero); //// t_container->addChild(case_back); //// //// case_back->setContentSize(CCSizeMake(348, 245)); // // CCSprite* content_back = CCSprite::create("tutorial_popup3.png"); // content_back->setPosition(ccp(0,0)); // t_container->addChild(content_back); // // KSLabelTTF* content_label = KSLabelTTF::create(myLoc->getLocalForKey(kMyLocalKey_dieTutorial3), mySGD->getFont().c_str(), 12.5f); // content_label->setHorizontalAlignment(kCCTextAlignmentLeft); // content_label->setAnchorPoint(ccp(0,0.5)); // content_label->setPosition(ccp(60,35)); // content_back->addChild(content_label); // //// CCSprite* title_img = CCSprite::create("tutorial_popup_title.png"); //// title_img->setPosition(ccp(0, 102)); //// t_container->addChild(title_img); // //// CCLabelTTF* content_label = CCLabelTTF::create("몬스터가 쏘는 미사일중에는\n획득영역을 지우는 것도 있어요.", mySGD->getFont().c_str(), 11); //// content_label->setPosition(ccp(12,-65)); //// t_container->addChild(content_label); // // CCSprite* n_close = CCSprite::create("whitePaper.png"); // n_close->setOpacity(0); // CCSprite* s_close = CCSprite::create("whitePaper.png"); // s_close->setOpacity(0); // // CCMenuLambda* close_menu = CCMenuLambda::create(); // // close_menu->setTouchPriority(t_popup->getTouchPriority()-1); // close_menu->setPosition(ccp(240, myDSH->ui_center_y)); // close_menu->setVisible(false); // t_popup->addChild(close_menu); // // CCMenuItemSpriteLambda* close_item = CCMenuItemSpriteLambda::create(n_close, s_close, [=](CCObject* sender) // { // close_menu->setVisible(false); // // t_container->addChild(KSTimer::create(0.2f, [=](){ // exit_target->onEnter(); // ((Maingame*)exit_target)->controlStunOff(); // t_popup->removeFromParent(); // })); // // t_container->addChild(KSGradualValue<float>::create(1.f, 1.2f, 0.05f, [=](float t){t_container->setScaleY(t);}, [=](float t){t_container->setScaleY(1.2f); // t_container->addChild(KSGradualValue<float>::create(1.2f, 0.f, 0.1f, [=](float t){t_container->setScaleY(t);}, [=](float t){t_container->setScaleY(0.f);}));})); // // t_container->addChild(KSGradualValue<int>::create(255, 0, 0.15f, [=](int t){KS::setOpacity(t_container, t);}, [=](int t){KS::setOpacity(t_container, 0);})); // // // }); // // close_menu->addChild(close_item); // // // // t_container->setScaleY(0.f); // // t_container->addChild(KSGradualValue<float>::create(0.f, 1.2f, 0.1f, [=](float t){t_container->setScaleY(t);}, [=](float t){t_container->setScaleY(1.2f); // t_container->addChild(KSGradualValue<float>::create(1.2f, 0.8f, 0.1f, [=](float t){t_container->setScaleY(t);}, [=](float t){t_container->setScaleY(0.8f); // t_container->addChild(KSGradualValue<float>::create(0.8f, 1.f, 0.05f, [=](float t){t_container->setScaleY(t);}, [=](float t){t_container->setScaleY(1.f); // close_menu->setVisible(true);}));}));})); // // t_container->addChild(KSGradualValue<int>::create(0, 255, 0.25f, [=](int t){KS::setOpacity(t_container, t);}, [=](int t){KS::setOpacity(t_container, 255);})); // } } else if(die_type == DieType::kDieType_missileToLine) { myLog->addLog(kLOG_die_missileToLine, myGD->getCommunication("UI_getUseTime")); if(!myDSH->getBoolForKey(kDSH_Key_wasTutorialPopupMissileTrace)) { myDSH->setBoolForKey(kDSH_Key_wasTutorialPopupMissileTrace, true); CCNode* exit_target = getParent()->getParent(); exit_target->onExit(); ASPopupView* t_popup = ASPopupView::create(-200); CCSize screen_size = CCEGLView::sharedOpenGLView()->getFrameSize(); float screen_scale_x = screen_size.width/screen_size.height/1.5f; if(screen_scale_x < 1.f) screen_scale_x = 1.f; t_popup->setDimmedSize(CCSizeMake(screen_scale_x*480.f, myDSH->ui_top));// /myDSH->screen_convert_rate)); t_popup->setDimmedPosition(ccp(240, myDSH->ui_center_y)); t_popup->setBasePosition(ccp(240, myDSH->ui_center_y)); CCNode* t_container = CCNode::create(); t_popup->setContainerNode(t_container); exit_target->getParent()->addChild(t_popup); CCSprite* content_back = CCSprite::create("tutorial_popup1.png"); content_back->setPosition(ccp(0,0)); t_container->addChild(content_back); KSLabelTTF* warning_label = KSLabelTTF::create(myLoc->getLocalForKey(kMyLocalKey_warningDie), mySGD->getFont().c_str(), 15.f); warning_label->disableOuterStroke(); warning_label->setPosition(ccp(52,66)); content_back->addChild(warning_label); KSLabelTTF* content_label = KSLabelTTF::create(myLoc->getLocalForKey(kMyLocalKey_dieTutorial1), mySGD->getFont().c_str(), 12.5f); content_label->setColor(ccc3(20, 50, 70)); content_label->disableOuterStroke(); content_label->setAnchorPoint(ccp(0.5f,0.5f)); content_label->setPosition(ccp(content_back->getContentSize().width/2.f,50)); content_back->addChild(content_label); CCSprite* n_close = CCSprite::create("whitePaper.png"); n_close->setOpacity(0); CCSprite* s_close = CCSprite::create("whitePaper.png"); s_close->setOpacity(0); CCMenuLambda* close_menu = CCMenuLambda::create(); close_menu->setTouchPriority(t_popup->getTouchPriority()-1); close_menu->setPosition(ccp(240, myDSH->ui_center_y)); close_menu->setVisible(false); t_popup->addChild(close_menu); CCMenuItemSpriteLambda* close_item = CCMenuItemSpriteLambda::create(n_close, s_close, [=](CCObject* sender) { close_menu->setVisible(false); t_container->addChild(KSTimer::create(0.2f, [=](){ exit_target->onEnter(); ((Maingame*)exit_target)->controlStunOff(); t_popup->removeFromParent(); })); CommonAnimation::closePopup(t_popup, t_container, nullptr, [=](){ }, [=](){ // end_func(); removeFromParent(); }); }); close_menu->addChild(close_item); CommonAnimation::openPopup(t_popup, t_container, nullptr, [=](){ }, [=](){ close_menu->setVisible(true); }); } } else if(die_type == DieType::kDieType_shockwave) { myLog->addLog(kLOG_die_shockwave, myGD->getCommunication("UI_getUseTime")); if(!myDSH->getBoolForKey(kDSH_Key_wasTutorialPopupShockWave)) { myDSH->setBoolForKey(kDSH_Key_wasTutorialPopupShockWave, true); CCNode* exit_target = getParent()->getParent(); exit_target->onExit(); ASPopupView* t_popup = ASPopupView::create(-200); CCSize screen_size = CCEGLView::sharedOpenGLView()->getFrameSize(); float screen_scale_x = screen_size.width/screen_size.height/1.5f; if(screen_scale_x < 1.f) screen_scale_x = 1.f; t_popup->setDimmedSize(CCSizeMake(screen_scale_x*480.f, myDSH->ui_top));// /myDSH->screen_convert_rate)); t_popup->setDimmedPosition(ccp(240, myDSH->ui_center_y)); t_popup->setBasePosition(ccp(240, myDSH->ui_center_y)); CCNode* t_container = CCNode::create(); t_popup->setContainerNode(t_container); exit_target->getParent()->addChild(t_popup); CCSprite* content_back = CCSprite::create("tutorial_popup2.png"); content_back->setPosition(ccp(0,0)); t_container->addChild(content_back); KSLabelTTF* warning_label = KSLabelTTF::create(myLoc->getLocalForKey(kMyLocalKey_warningDie), mySGD->getFont().c_str(), 15.f); warning_label->disableOuterStroke(); warning_label->setPosition(ccp(52,66)); content_back->addChild(warning_label); KSLabelTTF* content_label = KSLabelTTF::create(myLoc->getLocalForKey(kMyLocalKey_dieTutorial2), mySGD->getFont().c_str(), 12.5f); content_label->setColor(ccc3(20, 50, 70)); content_label->disableOuterStroke(); content_label->setAnchorPoint(ccp(0.5f,0.5f)); content_label->setPosition(ccp(content_back->getContentSize().width/2.f,50)); content_back->addChild(content_label); CCSprite* n_close = CCSprite::create("whitePaper.png"); n_close->setOpacity(0); CCSprite* s_close = CCSprite::create("whitePaper.png"); s_close->setOpacity(0); CCMenuLambda* close_menu = CCMenuLambda::create(); close_menu->setTouchPriority(t_popup->getTouchPriority()-1); close_menu->setPosition(ccp(240, myDSH->ui_center_y)); close_menu->setVisible(false); t_popup->addChild(close_menu); CCMenuItemSpriteLambda* close_item = CCMenuItemSpriteLambda::create(n_close, s_close, [=](CCObject* sender) { close_menu->setVisible(false); t_container->addChild(KSTimer::create(0.2f, [=](){ exit_target->onEnter(); ((Maingame*)exit_target)->controlStunOff(); t_popup->removeFromParent(); })); CommonAnimation::closePopup(t_container, t_container, nullptr, [=](){ }, [=](){ // end_func(); removeFromParent(); }); }); close_menu->addChild(close_item); CommonAnimation::openPopup(t_popup, t_container, nullptr, [=](){ }, [=](){ close_menu->setVisible(true); }); } } else if(die_type == DieType::kDieType_timeover) { } myGD->communication("UI_endFever"); myGD->communication("UI_stopCombo"); // Well512 t_well512; // myGD->setJackPoint(IntPoint(t_well512.GetValue(mapWidthInnerBegin, mapWidthInnerEnd),t_well512.GetValue(mapHeightInnerBegin, mapHeightInnerEnd))); // if(getJackState() == jackStateDrawing) // { // jack_drawing->setVisible(false); // } setJackState(jackStateNormal); // jack_barrier->setVisible(false); isDrawingOn = myDSH->getBoolForKey(kDSH_Key_isDisableDrawButton); myGD->removeMapNewline(); myGD->communication("PM_cleanPath"); isStun = true; myGD->communication("Main_startSpecialAttack"); // AudioEngine::sharedInstance()->playEffect("sound_jack_die.mp3", false); // AudioEngine::sharedInstance()->playEffect("sound_die_jack.mp3", false); isDie = true; dieEffectCnt = 0; if(jack_ccb_manager->getRunningSequenceName() == NULL || jack_ccb_manager->getRunningSequenceName() != string("die")) { jack_ccb_manager->runAnimationsForSequenceNamed("die"); // if(mySGD->getSelectedCharacterHistory().characterNo.getV() == 2) jack_img_direction = directionStop; } // jackImg->removeFromParentAndCleanup(true); CCNodeLoaderLibrary* nodeLoader = CCNodeLoaderLibrary::sharedCCNodeLoaderLibrary(); CCBReader* reader = new CCBReader(nodeLoader); die_particle = dynamic_cast<CCSprite*>(reader->readNodeGraphFromFile("fx_cha_die1.ccbi",this)); reader->getAnimationManager()->setDelegate(this); // jackImg = CCSprite::create("jack_die.png"); // jackImg->setScale(0.2f); addChild(die_particle, kJackZ_main); reader->release(); KS::setBlendFunc(die_particle, ccBlendFunc{GL_SRC_ALPHA, GL_ONE}); schedule(schedule_selector(Jack::dieEffect)); } } void Jack::completedAnimationSequenceNamed (char const * name) { string t_name = name; if(t_name == "end_die_animation") { die_particle->removeFromParent(); } } void Jack::showMB() { if(!isDie) { MissileBarrier* t_mb = MissileBarrier::create(); // t_mb->setScale(0.8f); addChild(t_mb, kJackZ_ActiveBarrier); } } IntDirection Jack::getRecentDirection() { return direction; } void Jack::setTouchPointByJoystick( CCPoint t_p, IntDirection t_direction, bool is_touchEnd ) { if(!joystickSpr_byJoystick) { joystickSpr_byJoystick = CCSprite::create("control_joystick_small_circle.png"); addChild(joystickSpr_byJoystick, kJackZ_defaultBarrier); } if(!touchPointSpr_byJoystick) { touchPointSpr_byJoystick = CCSprite::create("control_joystick_small_ball.png"); addChild(touchPointSpr_byJoystick, kJackZ_defaultBarrier); } if(!directionSpr_byJoystick) { directionSpr_byJoystick = CCSprite::create("control_joystick_arrow.png"); addChild(directionSpr_byJoystick, kJackZ_defaultBarrier); } if(is_touchEnd || t_direction == directionStop) { touchPointSpr_byJoystick->setVisible(false); directionSpr_byJoystick->setVisible(false); joystickSpr_byJoystick->setVisible(false); return; } else { touchPointSpr_byJoystick->setVisible(false); // true directionSpr_byJoystick->setVisible(false); // true joystickSpr_byJoystick->setVisible(false); // true } touchPointSpr_byJoystick->setPosition(ccpMult(t_p, 0.385f)); if(t_direction == directionLeft) { directionSpr_byJoystick->setRotation(-90); directionSpr_byJoystick->setPosition(ccp(-30,0)); } else if(t_direction == directionDown) { directionSpr_byJoystick->setRotation(-180); directionSpr_byJoystick->setPosition(ccp(0,-30)); } else if(t_direction == directionRight) { directionSpr_byJoystick->setRotation(90); directionSpr_byJoystick->setPosition(ccp(30,0)); } else if(t_direction == directionUp) { directionSpr_byJoystick->setRotation(0); directionSpr_byJoystick->setPosition(ccp(0,30)); } else if(t_direction == directionStop) { directionSpr_byJoystick->setVisible(false); } } void Jack::takeSpeedUpItem() { if(myGD->jack_base_speed + speed_up_value >= 2.f) { myGD->communication("Main_takeSpeedUpEffect", int(((2.f-1.1f) - (2.f-(myGD->jack_base_speed + speed_up_value)))/0.1f)); AudioEngine::sharedInstance()->playEffect(CCString::createWithFormat("ment_attack%d.mp3", rand()%4+1)->getCString(), false, true); int weapon_type = mySGD->getSelectedCharacterHistory().characterNo.getV()-1; int weapon_level = mySGD->getSelectedCharacterHistory().level.getV(); int weapon_rank = (weapon_level-1)/5 + 1; weapon_level = (weapon_level-1)%5 + 1; myGD->createJackMissileWithStoneFunctor((StoneType)weapon_type, weapon_rank, weapon_level, 1, getPosition(), mySGD->getSelectedCharacterHistory().power.getV()); // string missile_code; // missile_code = NSDS_GS(kSDS_CI_int1_missile_type_s, myDSH->getIntegerForKey(kDSH_Key_selectedCard)); // int missile_type = MissileDamageData::getMissileType(missile_code.c_str()); // // // myGD->communication("Main_goldGettingEffect", jackPosition, int((t_p - t_beforePercentage)/JM_CONDITION*myDSH->getGoldGetRate())); // float missile_speed = NSDS_GD(kSDS_CI_int1_missile_speed_d, myDSH->getIntegerForKey(kDSH_Key_selectedCard)); // // myGD->communication("MP_createJackMissile", missile_type, 1, missile_speed, getPosition()); } else { speed_up_value += 0.1f; changeSpeed(myGD->jack_base_speed + speed_up_value + alpha_speed_value); myGD->communication("Main_takeSpeedUpEffect", int(((2.f-1.1f) - (2.f-(myGD->jack_base_speed + speed_up_value)))/0.1f)); } } float Jack::getSpeedUpValue() { return speed_up_value; } float Jack::getAlphaSpeed() { return alpha_speed_value; } void Jack::setAlphaSpeed( float t_s ) { alpha_speed_value = t_s; changeSpeed(myGD->jack_base_speed + speed_up_value + alpha_speed_value); } void Jack::initStartPosition( CCPoint t_p ) { int base_value = roundf(-t_p.y/((480.f-myGD->boarder_value*2)/(320.f))/2.f); // 중간 괄호 : myGD->game_scale CCSize screen_size = CCEGLView::sharedOpenGLView()->getFrameSize(); float screen_height = roundf(480*screen_size.height/screen_size.width/2.f); IntPoint checking_point = IntPoint(80,base_value+roundf(screen_height/((480.f-myGD->boarder_value*2)/(320.f))/2.f)); // 중간 괄호 : myGD->game_scale int map_end_check_cnt = 0; bool is_found = false; for(int i=0;!is_found && map_end_check_cnt < 2;i++) { if(i%2 == 0) checking_point.x -= i; else checking_point.x += i; if(!checking_point.isInnerMap()) { map_end_check_cnt++; continue; } if(myGD->mapState[checking_point.x][checking_point.y] == mapOldline) { is_found = true; myGD->setJackPoint(checking_point); afterPoint = checking_point; CCNode::setPosition(checking_point.convertToCCP()); break; } } if(!is_found) { CCLOG("faskdhfn;asjbfv;kjqdhbf;kvuhqasdk;cn"); } } void Jack::setJackState( jackState t_s ) { bool is_changed = t_s != myState; myState = t_s; myGD->setJackState(myState); if(myState == jackStateNormal) { // if(mySGD->getSelectedCharacterHistory().characterNo.getV() != 2) // { // if(jack_ccb_manager->getRunningSequenceName() == NULL || jack_ccb_manager->getRunningSequenceName() != string("move")) // jack_ccb_manager->runAnimationsForSequenceNamed("move"); // } // else // { if(jack_ccb_manager->getRunningSequenceName() == NULL || jack_ccb_manager->getRunningSequenceName() != string("move_down")) jack_ccb_manager->runAnimationsForSequenceNamed("move_down"); // } // jackImg->setColor(ccWHITE); // jackImg->setVisible(true); // line_edge->setVisible(false); myGD->communication("Main_setLineParticle", false); // if(!is_hard && !jack_barrier->isVisible()) // jack_barrier->setVisible(true); if(is_changed) myGD->communication("GIM_removeBeautyStone"); } else if(myState == jackStateDrawing) { // line_edge->setVisible(true); myGD->communication("Main_setLineParticle", true); // if(mySGD->getSelectedCharacterHistory().characterNo.getV() != 2) // { // if(jack_ccb_manager->getRunningSequenceName() == NULL || jack_ccb_manager->getRunningSequenceName() != string("draw")) // jack_ccb_manager->runAnimationsForSequenceNamed("draw"); // } // else // { if(jack_ccb_manager->getRunningSequenceName() == NULL || jack_ccb_manager->getRunningSequenceName() != string("draw_down")) jack_ccb_manager->runAnimationsForSequenceNamed("draw_down"); // } // jackImg->setVisible(false); // if(!is_hard && jack_barrier->isVisible()) // jack_barrier->setVisible(false); if(is_changed) myGD->communication("GIM_showBeautyStone"); } else if(myState == jackStateBackTracking) { // line_edge->setVisible(false); myGD->communication("Main_setLineParticle", false); if(jack_ccb_manager->getRunningSequenceName() == NULL || jack_ccb_manager->getRunningSequenceName() != string("rewind")) { jack_ccb_manager->runAnimationsForSequenceNamed("rewind"); // if(mySGD->getSelectedCharacterHistory().characterNo.getV() == 2) jack_img_direction = directionStop; } // jackImg->setColor(ccGRAY); // if(!is_hard && jack_barrier->isVisible()) // jack_barrier->setVisible(false); if(is_changed) myGD->communication("GIM_removeBeautyStone"); } } IntDirection Jack::reverseDirection( IntDirection t_d ) { IntDirection returnDirection; if(t_d == directionLeftUp) returnDirection = directionRightDown; else if(t_d == directionLeft) returnDirection = directionRight; else if(t_d == directionLeftDown) returnDirection = directionRightUp; else if(t_d == directionDown) returnDirection = directionUp; else if(t_d == directionRightDown) returnDirection = directionLeftUp; else if(t_d == directionRight) returnDirection = directionLeft; else if(t_d == directionRightUp) returnDirection = directionLeftDown; else if(t_d == directionUp) returnDirection = directionDown; else returnDirection = directionStop; return returnDirection; } void Jack::dieEffect() { dieEffectCnt++; if(dieEffectCnt < 30) { // jackImg->setScale(0.2f + dieEffectCnt*0.02f); // jackImg->setOpacity(255-dieEffectCnt*5); } else if(dieEffectCnt == 30) { unschedule(schedule_selector(Jack::dieEffect)); dieEscapeJack(); if(myGD->getIsGameover()) { jackImg->setVisible(false); endGame(); } else { if(myDSH->getIntegerForKey(kDSH_Key_tutorial_flowStep) == kTutorialFlowStep_ingame) { myGD->communication("UI_addGameTime30Sec"); speed_up_value = 0.f; changeSpeed(myGD->jack_base_speed + speed_up_value + alpha_speed_value); startReviveAnimation(jackImg); } else if(myGD->getCommunicationBool("UI_beRevivedJack")) { speed_up_value = 0.f; changeSpeed(myGD->jack_base_speed + speed_up_value + alpha_speed_value); // jackImg->removeFromParentAndCleanup(true); // // CCTexture2D* jack_texture = CCTextureCache::sharedTextureCache()->addImage("jack2.png"); // // jackImg = CCSprite::createWithTexture(jack_texture, CCRectMake(0, 0, 23, 23)); // jackImg->setScale(0.8f); // addChild(jackImg, kJackZ_main); startReviveAnimation(jackImg); } else { if(mySGD->is_endless_mode || continue_on_count < 2) { continue_on_count++; myGD->communication("UI_showContinuePopup", this, callfunc_selector(Jack::endGame), this, callfunc_selector(Jack::continueGame)); } else { jackImg->setVisible(false); endGame(); } } } } // else if(dieEffectCnt > 80) // { // unschedule(schedule_selector(Jack::dieEffect)); // // if(myGD->getCommunicationBool("UI_beRevivedJack")) // { // speed_up_value = 0.f; // changeSpeed(myGD->jack_base_speed + speed_up_value + alpha_speed_value); // // isDie = false; // isStun = false; // // dieEscapeJack(); // // if(myGD->getIsGameover()) // endGame(); // else // { // jackImg->removeFromParentAndCleanup(true); // // CCTexture2D* jack_texture = CCTextureCache::sharedTextureCache()->addImage("jack2.png"); // // jackImg = CCSprite::createWithTexture(jack_texture, CCRectMake(0, 0, 23, 23)); // jackImg->setScale(0.8f); // addChild(jackImg, kJackZ_main); // // CCAnimation* jack_animation = CCAnimation::create(); // jack_animation->setDelayPerUnit(0.1f); // jack_animation->addSpriteFrameWithTexture(jack_texture, CCRectMake(0, 0, 23, 23)); // jack_animation->addSpriteFrameWithTexture(jack_texture, CCRectMake(0, 0, 23, 23)); // jack_animation->addSpriteFrameWithTexture(jack_texture, CCRectMake(23, 0, 23, 23)); // // CCAnimate* jack_animate = CCAnimate::create(jack_animation); // CCRepeatForever* jack_repeat = CCRepeatForever::create(jack_animate); // jackImg->runAction(jack_repeat); // // setTouchPointByJoystick(CCPointZero, directionStop, true); // setJackState(jackStateNormal); // // myGD->communication("GIM_dieCreateItem"); // myGD->communication("Main_resetIsLineDie"); // myGD->communication("Main_stopSpecialAttack"); // } // } // else // { // myGD->communication("UI_showContinuePopup", this, callfunc_selector(Jack::endGame), this, callfunc_selector(Jack::continueGame)); // } // } } void Jack::endReviveJack() { isDie = false; isStun = false; myGD->communication("Main_stopBackingCheck"); // CCTexture2D* jack_texture = CCTextureCache::sharedTextureCache()->addImage("jack2.png"); // // CCAnimation* jack_animation = CCAnimation::create(); // jack_animation->setDelayPerUnit(0.1f); // jack_animation->addSpriteFrameWithTexture(jack_texture, CCRectMake(0, 0, 23, 23)); // jack_animation->addSpriteFrameWithTexture(jack_texture, CCRectMake(0, 0, 23, 23)); // jack_animation->addSpriteFrameWithTexture(jack_texture, CCRectMake(23, 0, 23, 23)); // // CCAnimate* jack_animate = CCAnimate::create(jack_animation); // CCRepeatForever* jack_repeat = CCRepeatForever::create(jack_animate); // jackImg->runAction(jack_repeat); if(myGD->mapState[afterPoint.x][afterPoint.y] != mapOldline) { IntMoveState searchFirstMoveState = IntMoveState(afterPoint.x, afterPoint.y, directionStop); searchAndMoveOldline(searchFirstMoveState); } setTouchPointByJoystick(CCPointZero, directionStop, true); setJackState(jackStateNormal); if(jack_ccb_manager->getRunningSequenceName() == NULL || jack_ccb_manager->getRunningSequenceName() != string("stop")) { jack_ccb_manager->runAnimationsForSequenceNamed("stop"); // if(mySGD->getSelectedCharacterHistory().characterNo.getV() == 2) jack_img_direction = directionStop; } // jack_barrier->setVisible(true); myGD->communication("UI_resumeCounting"); myGD->communication("GIM_dieCreateItem"); myGD->communication("Main_resetIsLineDie"); myGD->communication("Main_stopSpecialAttack"); myGD->communication("CP_onJackRevived"); } void Jack::continueGame() { speed_up_value = 0.f; changeSpeed(myGD->jack_base_speed + speed_up_value + alpha_speed_value); // jackImg->removeFromParentAndCleanup(true); // // CCTexture2D* jack_texture = CCTextureCache::sharedTextureCache()->addImage("jack2.png"); // // jackImg = CCSprite::createWithTexture(jack_texture, CCRectMake(0, 0, 23, 23)); // jackImg->setScale(0.8f); // addChild(jackImg, kJackZ_main); startReviveAnimation(jackImg); } void Jack::endGame() { int i = kAchievementCode_hidden_dieEasy; if(!myAchieve->isCompleted(AchievementCode(i)) && !myAchieve->isAchieve(AchievementCode(i))) { if(!myAchieve->isNoti(AchievementCode(i)) && !myAchieve->isCompleted(AchievementCode(i)) && myGD->getCommunication("UI_getUseTime") <= myAchieve->getCondition(AchievementCode(i))) { myAchieve->changeIngCount(AchievementCode(i), myAchieve->getCondition(AchievementCode(i))); AchieveNoti* t_noti = AchieveNoti::create(AchievementCode(i)); CCDirector::sharedDirector()->getRunningScene()->addChild(t_noti); } } mySGD->fail_code = kFC_gameover; myGD->setIsGameover(true); myGD->communication("Main_allStopSchedule"); myGD->communication("Main_gameover"); } void Jack::escapeJack() { if(afterPoint.isInnerMap()) { if(myGD->mapState[afterPoint.x-1][afterPoint.y] == mapOldget && myGD->mapState[afterPoint.x+1][afterPoint.y] == mapOldget && myGD->mapState[afterPoint.x][afterPoint.y-1] == mapOldget && myGD->mapState[afterPoint.x][afterPoint.y+1] == mapOldget) { IntMoveState searchFirstMoveState = IntMoveState(afterPoint.x, afterPoint.y, directionStop); searchAndMoveOldline(searchFirstMoveState); } bool is_go_inner = (myGD->mapState[afterPoint.x][afterPoint.y] == mapNewline || myGD->mapState[afterPoint.x-1][afterPoint.y] == mapNewline || myGD->mapState[afterPoint.x+1][afterPoint.y] == mapNewline || myGD->mapState[afterPoint.x][afterPoint.y-1] == mapNewline || myGD->mapState[afterPoint.x][afterPoint.y+1] == mapNewline); for(int x = mapWidthInnerBegin+1;x < mapWidthInnerEnd-1 && !is_go_inner;x++) { if(!(myGD->mapState[x][mapHeightInnerBegin] == mapOldline && myGD->mapState[x][mapHeightInnerBegin+1] == mapOldget)) is_go_inner = true; if(!(myGD->mapState[x][mapHeightInnerEnd-1] == mapOldline && myGD->mapState[x][mapHeightInnerEnd-1-1] == mapOldget)) is_go_inner = true; } for(int y = mapHeightInnerBegin+1;y < mapHeightInnerEnd-1 && !is_go_inner;y++) { if(!(myGD->mapState[mapWidthInnerBegin][y] == mapOldline && myGD->mapState[mapWidthInnerBegin+1][y] == mapOldget)) is_go_inner = true; if(!(myGD->mapState[mapWidthInnerEnd-1][y] == mapOldline && myGD->mapState[mapWidthInnerEnd-1-1][y] == mapOldget)) is_go_inner = true; } if(!is_go_inner) { IntMoveState searchFirstMoveState = IntMoveState(afterPoint.x, afterPoint.y, directionStop); searchAndMoveOldline(searchFirstMoveState); } } } void Jack::dieEscapeJack() { IntMoveState searchFirstMoveState = IntMoveState(afterPoint.x, afterPoint.y, directionStop); searchAndMoveOldline(searchFirstMoveState); } void Jack::startMove() { is_end_turn = true; isMoving = true; moveValue = 0; move_loop_cnt = 0; moveTest(); schedule(schedule_selector(Jack::moveTest)); } void Jack::resetStopEffects() { t_se = NULL; // t_chaos = NULL; } void Jack::positionRefresh() { setPosition(getPosition()); } bool Jack::isDieJack() { return isDie; } CCNode* Jack::getJack() { return this; } void Jack::myInit() { continue_on_count = 0; before_x_direction = directionStop; before_x_cnt = 0; keep_direction = kKeepDirection_empty; isDrawingOn = myDSH->getBoolForKey(kDSH_Key_isDisableDrawButton); // isReverseGesture = false; isReverse = false; t_se = NULL; t_chaos = NULL; isStun = false; isDie = false; is_double_moving = false; myGD->V_F["Jack_changeSpeed"] = std::bind(&Jack::changeSpeed, this, _1); myGD->V_I["Jack_startDieEffect"] = std::bind(&Jack::startDieEffect, this, _1); myGD->V_V["Jack_createHammer"] = std::bind(&Jack::createHammer, this); myGD->V_V["Jack_createFog"] = std::bind(&Jack::createFog, this); myGD->V_V["Jack_createSleep"] = std::bind(&Jack::createSleep, this); myGD->V_V["Jack_createChaos"] = std::bind(&Jack::createChaos, this); myGD->V_V["Jack_reverseOff"] = std::bind(&Jack::reverseOff, this); myGD->V_V["Jack_resetStopEffects"] = std::bind(&Jack::resetStopEffects, this); myGD->V_V["Jack_showMB"] = std::bind(&Jack::showMB, this); myGD->V_V["Jack_takeSpeedUpItem"] = std::bind(&Jack::takeSpeedUpItem, this); myGD->F_V["Jack_getAlphaSpeed"] = std::bind(&Jack::getAlphaSpeed, this); myGD->V_F["Jack_setAlphaSpeed"] = std::bind(&Jack::setAlphaSpeed, this, _1); myGD->F_V["Jack_getSpeedUpValue"] = std::bind(&Jack::getSpeedUpValue, this); myGD->V_V["Jack_positionRefresh"] = std::bind(&Jack::positionRefresh, this); myGD->B_V["Jack_isDie"] = std::bind(&Jack::isDieJack, this); myGD->CCN_V["Jack_getJack"] = std::bind(&Jack::getJack, this); isMoving = false; willBackTracking = false; btPoint = IntPoint(); direction = directionStop; afterDirection = directionStop; //////////////////////////////////////////////////////////// move test //////////////////////////////// speed_up_value = 0.f; alpha_speed_value = 0.f; test_speed = myGD->jack_base_speed + speed_up_value + alpha_speed_value; after_speed = test_speed; //////////////////////////////////////////////////////////// move test //////////////////////////////// myState = jackStateNormal; afterState = jackStateNormal; string path_color; int path_color_code = NSDS_GI(kSDS_GI_characterInfo_int1_statInfo_lineColor_i, mySGD->getSelectedCharacterHistory().characterNo.getV()); if(path_color_code == 1) path_color = "life"; else if(path_color_code == 2) path_color = "fire"; else if(path_color_code == 3) path_color = "water"; else if(path_color_code == 4) path_color = "wind"; else if(path_color_code == 5) path_color = "lightning"; else if(path_color_code == 6) path_color = "plasma"; else path_color = "empty"; // line_edge = CCSprite::create("jack_drawing_point.png");//("path_edge_" + path_color + ".png").c_str()); // line_edge->setVisible(false); // line_edge->setScale(0.5f); // addChild(line_edge, kJackZ_line); auto t_pair = KS::loadCCBIForFullPath<CCSprite*>(this, StageImgLoader::sharedInstance()->getDocumentPath() + NSDS_GS(kSDS_GI_characterInfo_int1_resourceInfo_ccbiID_s, mySGD->getSelectedCharacterHistory().characterNo.getV()) + ".ccbi"); jackImg = t_pair.first; jack_ccb_manager = t_pair.second; // CCTexture2D* jack_texture = CCTextureCache::sharedTextureCache()->addImage("jack2.png"); // // jackImg = CCSprite::createWithTexture(jack_texture, CCRectMake(0, 0, 23, 23)); // jackImg->setScale(0.8f); addChild(jackImg, kJackZ_main); if(jack_ccb_manager->getRunningSequenceName() == NULL || jack_ccb_manager->getRunningSequenceName() != string("stop")) { jack_ccb_manager->runAnimationsForSequenceNamed("stop"); // if(mySGD->getSelectedCharacterHistory().characterNo.getV() == 2) } jack_img_direction = directionStop; // if(mySGD->getSelectedCharacterHistory().characterNo.getV() != 2) // jack_img_direction = directionRight; startShowJackAnimation(jackImg); // CCAnimation* jack_animation = CCAnimation::create(); // jack_animation->setDelayPerUnit(0.1f); // jack_animation->addSpriteFrameWithTexture(jack_texture, CCRectMake(0, 0, 23, 23)); // jack_animation->addSpriteFrameWithTexture(jack_texture, CCRectMake(0, 0, 23, 23)); // jack_animation->addSpriteFrameWithTexture(jack_texture, CCRectMake(23, 0, 23, 23)); // // CCAnimate* jack_animate = CCAnimate::create(jack_animation); // CCRepeatForever* jack_repeat = CCRepeatForever::create(jack_animate); // jackImg->runAction(jack_repeat); is_hard = false; // CCSprite* t_texture = CCSprite::create("jack_barrier.png"); // // jack_barrier = CCSprite::createWithTexture(t_texture->getTexture(), CCRectMake(100, 0, 25, 25)); // jack_barrier->setScale(0.8f); // addChild(jack_barrier, kJackZ_defaultBarrier); // jack_barrier->setOpacity(0); // // CCAnimation* t_animation = CCAnimation::create(); // t_animation->setDelayPerUnit(0.1); // for(int i=0;i<5;i++) // t_animation->addSpriteFrameWithTexture(t_texture->getTexture(), CCRectMake(i*25, 0, 25, 25)); // CCAnimate* t_animate = CCAnimate::create(t_animation); // CCRepeatForever* t_repeat = CCRepeatForever::create(t_animate); // // jack_barrier->runAction(t_repeat); setScale(1/myGD->game_scale);//NSDS_GD(mySD->getSilType(), kSDS_SI_scale_d) } void Jack::setStartPosition() { IntMoveState searchFirstMoveState = IntMoveState(160/2, 215/2, directionStop); searchAndMoveOldline(searchFirstMoveState); } void Jack::keepDirectionAction( IntPoint jp, IntDirection t_d ) { IntVector left_vector = IntVector::directionVector(IntVector::getLeftDirection(t_d)); IntVector right_vector = IntVector::directionVector(IntVector::getRightDirection(t_d)); IntPoint left_point = IntPoint(jp.x+left_vector.dx, jp.y+left_vector.dy); IntPoint right_point = IntPoint(jp.x+right_vector.dx, jp.y+right_vector.dy); if(left_point.isInnerMap() && right_point.isInnerMap() && (((myGD->mapState[left_point.x][left_point.y] == mapOldget || myGD->mapState[left_point.x][left_point.y] == mapOldline) && (myGD->mapState[right_point.x][right_point.y] == mapOldget || myGD->mapState[right_point.x][right_point.y] == mapOldline)) || (myGD->mapState[left_point.x][left_point.y] == mapEmpty && myGD->mapState[right_point.x][right_point.y] == mapEmpty))) { } else { if(left_point.isInnerMap() && (myGD->mapState[left_point.x][left_point.y] == mapOldget || myGD->mapState[left_point.x][left_point.y] == mapOldline)) keep_direction = kKeepDirection_left; else if(right_point.isInnerMap() && (myGD->mapState[right_point.x][right_point.y] == mapOldget || myGD->mapState[right_point.x][right_point.y] == mapOldline)) keep_direction = kKeepDirection_right; } } bool Jack::rotarySelection( IntPoint jp, IntDirection t_d ) { // if(myGD->mapState[jp.x][jp.y] != mapOldline) // return false; IntVector left_vector = IntVector::directionVector(IntVector::getLeftDirection(t_d)); IntVector right_vector = IntVector::directionVector(IntVector::getRightDirection(t_d)); IntVector direct_vector = IntVector::directionVector(t_d); IntPoint left_point = IntPoint(jp.x+left_vector.dx, jp.y+left_vector.dy); IntPoint right_point = IntPoint(jp.x+right_vector.dx, jp.y+right_vector.dy); IntPoint direct_point = IntPoint(jp.x+direct_vector.dx, jp.y+direct_vector.dy); IntPoint return_point = IntPoint(jp.x-direct_vector.dx, jp.y-direct_vector.dy); int rotary_cnt = 0; bool is_left = false; bool is_right = false; bool is_direct = false; int oldget_cnt = 0; if(left_point.isInnerMap() && myGD->mapState[left_point.x][left_point.y] == mapOldline) { is_left = true; rotary_cnt++; } else if(left_point.isInnerMap() && myGD->mapState[left_point.x][left_point.y] == mapOldget) { oldget_cnt++; } if(right_point.isInnerMap() && myGD->mapState[right_point.x][right_point.y] == mapOldline) { is_right = true; rotary_cnt++; } else if(right_point.isInnerMap() && myGD->mapState[right_point.x][right_point.y] == mapOldget) { oldget_cnt++; } if(direct_point.isInnerMap() && myGD->mapState[direct_point.x][direct_point.y] == mapOldline) { is_direct = true; rotary_cnt++; } else if(direct_point.isInnerMap() && myGD->mapState[direct_point.x][direct_point.y] == mapOldget) { oldget_cnt++; } if(return_point.isInnerMap() && myGD->mapState[return_point.x][return_point.y] == mapOldget) { oldget_cnt++; } if(rotary_cnt >= 2 && oldget_cnt >= 2) { return false; } if(rotary_cnt >= 2 && keep_direction != kKeepDirection_empty) { if(keep_direction == kKeepDirection_left && is_right) { check_turn_cnt = 4; direction = IntVector::getRightDirection(t_d); afterDirection = direction; } else if(keep_direction == kKeepDirection_right && is_left) { check_turn_cnt = 4; direction = IntVector::getLeftDirection(t_d); afterDirection = direction; } else return false; return true; } else return false; } CCPoint Jack::checkOutlineTurnPosition( CCPoint turnPosition ) { if(turnPosition.x < (mapWidthInnerBegin-1)*pixelSize+1) turnPosition.x = (mapWidthInnerBegin-1)*pixelSize+1; if(turnPosition.x > (mapWidthInnerEnd-1-1)*pixelSize+1) turnPosition.x = (mapWidthInnerEnd-1-1)*pixelSize+1; if(myGD->game_step == kGS_limited) { if(turnPosition.y < (myGD->limited_step_bottom-1)*pixelSize+1) turnPosition.y = (myGD->limited_step_bottom-1)*pixelSize+1; if(turnPosition.y > (myGD->limited_step_top-1)*pixelSize+1) turnPosition.y = (myGD->limited_step_top-1)*pixelSize+1; } else { if(turnPosition.y < (mapHeightInnerBegin-1)*pixelSize+1) turnPosition.y = (mapHeightInnerBegin-1)*pixelSize+1; if(turnPosition.y > (mapHeightInnerEnd-1-1)*pixelSize+1) turnPosition.y = (mapHeightInnerEnd-1-1)*pixelSize+1; } return turnPosition; } void Jack::startReviveAnimation( CCSprite* t_jack_img ) { AudioEngine::sharedInstance()->playEffect(CCString::createWithFormat("ment_resurrection%d.mp3", rand()%2+1)->getCString(), false, true); if(jack_ccb_manager->getRunningSequenceName() == NULL || jack_ccb_manager->getRunningSequenceName() != string("born")) { jack_ccb_manager->runAnimationsForSequenceNamed("born"); // if(mySGD->getSelectedCharacterHistory().characterNo.getV() == 2) jack_img_direction = directionStop; } // t_jack_img->setOpacity(0); // t_jack_img->runAction(CCSequence::createWithTwoActions(CCDelayTime::create(0.8f), CCFadeTo::create(0.5f, 255))); CCNode* animation_node = CCNode::create(); animation_node->setPosition(ccp(t_jack_img->getContentSize().width/2.f, t_jack_img->getContentSize().height/2.f)); t_jack_img->addChild(animation_node); startInnerParticle(animation_node); CCDelayTime* delay1 = CCDelayTime::create(0.1f); CCCallFuncO* call1 = CCCallFuncO::create(this, callfuncO_selector(Jack::startLightSprite), animation_node); CCDelayTime* delay2 = CCDelayTime::create(0.2f); CCCallFuncO* call2 = CCCallFuncO::create(this, callfuncO_selector(Jack::startOutterParticle), animation_node); CCDelayTime* delay3 = CCDelayTime::create(0.5f); CCCallFunc* call3 = CCCallFunc::create(this, callfunc_selector(Jack::endReviveJack)); CCCallFunc* call4 = CCCallFunc::create(animation_node, callfunc_selector(CCNode::removeFromParent)); CCSequence* t_seq = CCSequence::create(delay1, call1, delay2, call2, delay3, call3, call4, NULL); animation_node->runAction(t_seq); } void Jack::startShowJackAnimation( CCSprite* t_jack_img ) { if(jack_ccb_manager->getRunningSequenceName() == NULL || jack_ccb_manager->getRunningSequenceName() != string("born")) { jack_ccb_manager->runAnimationsForSequenceNamed("born"); // if(mySGD->getSelectedCharacterHistory().characterNo.getV() == 2) jack_img_direction = directionStop; } // t_jack_img->setOpacity(0); // t_jack_img->runAction(CCFadeTo::create(1.3f, 255)); CCNode* animation_node = CCNode::create(); animation_node->setPosition(ccp(t_jack_img->getContentSize().width/2.f, t_jack_img->getContentSize().height/2.f)); t_jack_img->addChild(animation_node); startInnerParticle(animation_node); CCDelayTime* delay1 = CCDelayTime::create(0.2f); CCCallFuncO* call1 = CCCallFuncO::create(this, callfuncO_selector(Jack::startLightSprite), animation_node); CCDelayTime* delay2 = CCDelayTime::create(0.4f); CCCallFuncO* call2 = CCCallFuncO::create(this, callfuncO_selector(Jack::startOutterParticle), animation_node); CCDelayTime* delay3 = CCDelayTime::create(1.f); CCCallFunc* call4 = CCCallFunc::create(animation_node, callfunc_selector(CCNode::removeFromParent)); CCSequence* t_seq = CCSequence::create(delay1, call1, delay2, call2, delay3, call4, NULL); animation_node->runAction(t_seq); } void Jack::startInnerParticle( CCNode* target_node ) { CCParticleSystemQuad* inner_particle = CCParticleSystemQuad::createWithTotalParticles(100); inner_particle->setTexture(CCTextureCache::sharedTextureCache()->addImage("particle2.png")); inner_particle->setEmissionRate(166.67f); inner_particle->setAngle(90.f); inner_particle->setAngleVar(360.f); ccBlendFunc inner_blend_func = {GL_SRC_ALPHA, GL_ONE}; inner_particle->setBlendFunc(inner_blend_func); inner_particle->setDuration(0.5f); inner_particle->setEmitterMode(kCCParticleModeRadius); inner_particle->setStartColor(ccc4f(1.f, 1.f, 0.55f, 1.f)); inner_particle->setStartColorVar(ccc4f(0.f, 0.28f, 0.57f, 1.f)); inner_particle->setEndColor(ccc4f(0.f, 0.f, 0.f, 1.f)); inner_particle->setEndColorVar(ccc4f(0.f, 0.f, 0.f, 0.f)); inner_particle->setStartSize(15.f); inner_particle->setStartSizeVar(7.f); inner_particle->setEndSize(10.f); inner_particle->setEndSizeVar(5.f); inner_particle->setRotatePerSecond(0.f); inner_particle->setRotatePerSecondVar(0.f); inner_particle->setStartRadius(80.f); inner_particle->setStartRadiusVar(40.f); inner_particle->setEndRadius(15.f); inner_particle->setTotalParticles(100); inner_particle->setLife(0.6f); inner_particle->setLifeVar(0.3f); inner_particle->setStartSpin(0.f); inner_particle->setStartSpinVar(0.f); inner_particle->setEndSpin(0.f); inner_particle->setEndSpinVar(0.f); inner_particle->setPosition(ccp(0,0)); inner_particle->setPosVar(CCPointZero); inner_particle->setAutoRemoveOnFinish(true); target_node->addChild(inner_particle); } void Jack::startLightSprite( CCNode* target_node ) { CCNodeLoaderLibrary* nodeLoader = CCNodeLoaderLibrary::sharedCCNodeLoaderLibrary(); CCBReader* reader = new CCBReader(nodeLoader); CCSprite* lighter = dynamic_cast<CCSprite*>(reader->readNodeGraphFromFile("fx_cha_new.ccbi",this)); lighter->setPosition(ccp(0,0)); target_node->addChild(lighter); reader->release(); KS::setBlendFunc(lighter, ccBlendFunc{GL_SRC_ALPHA, GL_ONE}); } void Jack::startOutterParticle( CCNode* target_node ) { CCParticleSystemQuad* outter_particle = CCParticleSystemQuad::createWithTotalParticles(100); outter_particle->setTexture(CCTextureCache::sharedTextureCache()->addImage("particle2.png")); outter_particle->setEmissionRate(166.67f); outter_particle->setAngle(90.f); outter_particle->setAngleVar(90.f); ccBlendFunc outter_blend_func = {GL_SRC_ALPHA, GL_ONE}; outter_particle->setBlendFunc(outter_blend_func); outter_particle->setDuration(0.4f); outter_particle->setEmitterMode(kCCParticleModeGravity); outter_particle->setStartColor(ccc4f(1.f, 1.f, 0.55f, 1.f)); outter_particle->setStartColorVar(ccc4f(0.f, 0.28f, 0.57f, 1.f)); outter_particle->setEndColor(ccc4f(0.f, 0.f, 0.f, 1.f)); outter_particle->setEndColorVar(ccc4f(0.f, 0.f, 0.f, 0.f)); outter_particle->setStartSize(10.f); outter_particle->setStartSizeVar(5.f); outter_particle->setEndSize(10.f); outter_particle->setEndSizeVar(5.f); outter_particle->setGravity(ccp(0.f,300.f)); outter_particle->setRadialAccel(0.f); outter_particle->setRadialAccelVar(0.f); outter_particle->setSpeed(100.f); outter_particle->setSpeedVar(40.f); outter_particle->setTangentialAccel(0.f); outter_particle->setTangentialAccelVar(0.f); outter_particle->setTotalParticles(100); outter_particle->setLife(0.4f); outter_particle->setLifeVar(0.5f); outter_particle->setStartSpin(0.f); outter_particle->setStartSpinVar(0.f); outter_particle->setEndSpin(0.f); outter_particle->setEndSpinVar(0.f); outter_particle->setPosition(ccp(0,0)); outter_particle->setPosVar(ccp(40.f,40.f)); outter_particle->setAutoRemoveOnFinish(true); target_node->addChild(outter_particle); } StunHammer* StunHammer::create( CCObject* t_jack, SEL_CallFunc d_stun ) { StunHammer* t_sh = new StunHammer(); t_sh->myInit(t_jack, d_stun); t_sh->autorelease(); return t_sh; } void StunHammer::startAction() { CCAnimation* t_animation = CCAnimation::create(); t_animation->setDelayPerUnit(0.1); t_animation->addSpriteFrameWithFileName("stun_hammer1.png"); t_animation->addSpriteFrameWithFileName("stun_hammer1.png"); t_animation->addSpriteFrameWithFileName("stun_hammer2.png"); CCAnimate* t_animate = CCAnimate::create(t_animation); CCRotateBy* t_rotate = CCRotateBy::create(0.3, -90); CCSpawn* t_spawn = CCSpawn::createWithTwoActions(t_animate, t_rotate); CCCallFunc* t_call = CCCallFunc::create(this, callfunc_selector(StunHammer::afterAction)); CCSequence* t_seq = CCSequence::createWithTwoActions(t_spawn, t_call); hammerImg->runAction(t_seq); } void StunHammer::showHammer() { CCSprite* t_hammer = CCSprite::create("stun_hammer1.png"); t_hammer->setAnchorPoint(ccp(1.0,0.5)); t_hammer->setRotation(90); t_hammer->setPosition(ccp(34,20)); addChild(t_hammer); CCAnimation* t_animation = CCAnimation::create(); t_animation->setDelayPerUnit(0.1); t_animation->addSpriteFrameWithFileName("stun_hammer1.png"); t_animation->addSpriteFrameWithFileName("stun_hammer1.png"); t_animation->addSpriteFrameWithFileName("stun_hammer2.png"); CCAnimate* t_animate = CCAnimate::create(t_animation); CCRotateBy* t_rotate = CCRotateBy::create(0.3, -90); CCSpawn* t_spawn = CCSpawn::createWithTwoActions(t_animate, t_rotate); CCCallFuncO* t_call = CCCallFuncO::create(this, callfuncO_selector(StunHammer::deleteTempHammer), t_hammer); CCSequence* t_seq = CCSequence::createWithTwoActions(t_spawn, t_call); t_hammer->runAction(t_seq); } void StunHammer::selfRemove() { myGD->communication("Jack_resetStopEffects"); myGD->communication("Main_touchOn"); removeFromParentAndCleanup(true); } void StunHammer::deleteTempHammer( CCObject* t_hammer ) { ((CCNode*)t_hammer)->removeFromParentAndCleanup(true); } void StunHammer::afterAction() { hammerImg->removeFromParentAndCleanup(true); AudioEngine::sharedInstance()->playEffect("sound_stun_hit.mp3",false); (target_jack->*delegate_stun)(); starImg = CCSprite::create("stun_star.png", CCRectMake(0, 0, 20, 13)); starImg->setPosition(ccp(0,12)); CCSprite* t_texture = CCSprite::create("stun_star.png"); CCAnimation* t_animation = CCAnimation::create(); t_animation->setDelayPerUnit(0.1); for(int i=0;i<3;i++) { t_animation->addSpriteFrameWithTexture(t_texture->getTexture(), CCRectMake(0, i*13, 20, 13)); } CCAnimate* t_animate = CCAnimate::create(t_animation); CCRepeatForever* t_repeat = CCRepeatForever::create(t_animate); addChild(starImg); starImg->runAction(t_repeat); } void StunHammer::myInit( CCObject* t_jack, SEL_CallFunc d_stun ) { target_jack = t_jack; delegate_stun = d_stun; hammerImg = CCSprite::create("stun_hammer1.png"); hammerImg->setAnchorPoint(ccp(1.0,0.5)); hammerImg->setRotation(90); hammerImg->setPosition(ccp(34,20)); addChild(hammerImg); } IceFog* IceFog::create( CCObject* t_jack, SEL_CallFunc d_freeze ) { IceFog* t_if = new IceFog(); t_if->myInit(t_jack, d_freeze); t_if->autorelease(); return t_if; } void IceFog::startAction() { CCDelayTime* t_delay = CCDelayTime::create(0.2f); CCCallFunc* t_call = CCCallFunc::create(this, callfunc_selector(IceFog::afterAction)); CCSequence* t_seq = CCSequence::createWithTwoActions(t_delay, t_call); runAction(t_seq); } void IceFog::showFog() { fogImg->removeFromParent(); stopAllActions(); fogImg = KS::loadCCBI<CCSprite*>(this, "fx_freezing_1.ccbi").first; KS::setBlendFunc(fogImg, ccBlendFunc{GL_SRC_ALPHA, GL_ONE}); addChild(fogImg); } void IceFog::selfRemove() { myGD->communication("Jack_resetStopEffects"); myGD->communication("Main_touchOn"); fog_manager->runAnimationsForSequenceNamed("stop"); CCDelayTime* t_delay = CCDelayTime::create(0.3f); CCCallFunc* t_call = CCCallFunc::create(this, callfunc_selector(CCNode::removeFromParent)); CCSequence* t_seq = CCSequence::create(t_delay, t_call, NULL); runAction(t_seq); // removeFromParentAndCleanup(true); } void IceFog::deleteFog() { // fogImg->removeFromParentAndCleanup(true); } void IceFog::afterAction() { AudioEngine::sharedInstance()->playEffect("sound_ice_hold.mp3", false); (target_jack->*delegate_freeze)(); // fogImg->removeFromParentAndCleanup(true); // iceImg = CCSprite::create("ice.png"); // addChild(iceImg); } void IceFog::myInit( CCObject* t_jack, SEL_CallFunc d_freeze ) { target_jack = t_jack; delegate_freeze = d_freeze; auto t_ccb = KS::loadCCBI<CCSprite*>(this, "fx_freezing_1.ccbi"); fogImg = t_ccb.first; KS::setBlendFunc(fogImg, ccBlendFunc{GL_SRC_ALPHA, GL_ONE}); addChild(fogImg); fog_manager = t_ccb.second; } Sleep* Sleep::create( CCObject* t_jack, SEL_CallFunc d_sleep ) { Sleep* t_s = new Sleep(); t_s->myInit(t_jack, d_sleep); t_s->autorelease(); return t_s; } void Sleep::startAction() { CCDelayTime* t_delay = CCDelayTime::create(1.0); CCCallFunc* t_call = CCCallFunc::create(this, callfunc_selector(Sleep::afterAction)); CCSequence* t_seq = CCSequence::createWithTwoActions(t_delay, t_call); runAction(t_seq); } void Sleep::showCircle() { CircleCreater* t_cc = CircleCreater::create(ccYELLOW, 12); addChild(t_cc); CCDelayTime* t_delay = CCDelayTime::create(1.0); CCCallFuncO* t_call = CCCallFuncO::create(this, callfuncO_selector(Sleep::deleteCircle), t_cc); CCSequence* t_seq = CCSequence::createWithTwoActions(t_delay, t_call); runAction(t_seq); } void Sleep::selfRemove() { myGD->communication("Jack_resetStopEffects"); myGD->communication("Main_touchOn"); removeFromParentAndCleanup(true); } void Sleep::deleteCircle( CCObject* t_remove ) { ((CircleCreater*)t_remove)->stopCreate(); } void Sleep::afterAction() { AudioEngine::sharedInstance()->playEffect("sound_sleep.mp3", false); (target_jack->*delegate_sleep)(); my_cc->stopCreate(); // real sleep add sleepImg = CCSprite::create("sleep_zzz.png", CCRectMake(0, 0, 30, 25)); sleepImg->setPosition(ccp(10,18)); addChild(sleepImg); CCSprite* t_texture = CCSprite::create("sleep_zzz.png"); CCAnimation* t_animation = CCAnimation::create(); t_animation->setDelayPerUnit(0.1); for(int i=0;i<5;i++) { t_animation->addSpriteFrameWithTexture(t_texture->getTexture(), CCRectMake(i*30, 0, 30, 25)); } CCAnimate* t_animate = CCAnimate::create(t_animation); CCRepeatForever* t_repeat = CCRepeatForever::create(t_animate); sleepImg->runAction(t_repeat); } void Sleep::myInit( CCObject* t_jack, SEL_CallFunc d_sleep ) { target_jack = t_jack; delegate_sleep = d_sleep; my_cc = CircleCreater::create(ccYELLOW, 12); addChild(my_cc); } Chaos* Chaos::create( CCObject* t_jack, SEL_CallFunc d_chaos ) { Chaos* t_c = new Chaos(); t_c->myInit(t_jack, d_chaos); t_c->autorelease(); return t_c; } void Chaos::startAction() { CCDelayTime* t_delay = CCDelayTime::create(1.0); CCCallFunc* t_call = CCCallFunc::create(this, callfunc_selector(Chaos::afterAction)); CCSequence* t_seq = CCSequence::createWithTwoActions(t_delay, t_call); runAction(t_seq); } void Chaos::showCircle() { CircleCreater* t_cc = CircleCreater::create(ccBLUE, 12); addChild(t_cc); CCDelayTime* t_delay = CCDelayTime::create(1.0); CCCallFuncO* t_call = CCCallFuncO::create(this, callfuncO_selector(Chaos::deleteCircle), t_cc); CCSequence* t_seq = CCSequence::createWithTwoActions(t_delay, t_call); runAction(t_seq); } void Chaos::selfRemove() { myGD->communication("Jack_resetStopEffects"); removeFromParentAndCleanup(true); } void Chaos::deleteCircle( CCObject* t_remove ) { ((CircleCreater*)t_remove)->stopCreate(); } void Chaos::afterAction() { (target_jack->*delegate_chaos)(); my_cc->stopCreate(); chaosImg = CCSprite::create("chaos.png"); chaosImg->setAnchorPoint(ccp(0.5,0)); chaosImg->setRotation(-45); addChild(chaosImg); CCRotateTo* t_rotate_left = CCRotateTo::create(0.5, 45); CCRotateTo* t_rotate_right = CCRotateTo::create(0.5, -45); CCSequence* t_seq = CCSequence::createWithTwoActions(t_rotate_left, t_rotate_right); CCRepeatForever* t_repeat = CCRepeatForever::create(t_seq); chaosImg->runAction(t_repeat); } void Chaos::myInit( CCObject* t_jack, SEL_CallFunc d_chaos ) { target_jack = t_jack; delegate_chaos = d_chaos; my_cc = CircleCreater::create(ccBLUE, 12); addChild(my_cc); } MissileBarrier* MissileBarrier::create() { MissileBarrier* t_mb = new MissileBarrier(); t_mb->myInit(); t_mb->autorelease(); return t_mb; } void MissileBarrier::selfRemove() { removeFromParentAndCleanup(true); } void MissileBarrier::myInit() { AudioEngine::sharedInstance()->playEffect("sound_barrier_pass.mp3",false); CCTexture2D* t_texture = CCTextureCache::sharedTextureCache()->addImage("jack_missile_barrier.png"); initWithTexture(t_texture, CCRectMake(0, 0, 38, 38)); CCAnimation* t_animation = CCAnimation::create(); t_animation->setDelayPerUnit(0.1); for(int i=0;i<3;i++) t_animation->addSpriteFrameWithTexture(t_texture, CCRectMake(38*i, 0, 38, 38)); CCAnimate* t_animate = CCAnimate::create(t_animation); CCCallFunc* t_call = CCCallFunc::create(this, callfunc_selector(MissileBarrier::selfRemove)); CCSequence* t_seq = CCSequence::createWithTwoActions(t_animate, t_call); runAction(t_seq); }
dbc3942fc147d0547396a0b97cda05956468aead
5a8bf8d140fa5aa3acc6a8e335f4f2f0974931fc
/uva/543 - Goldbach's Conjecture.cpp
e75d5ea0e24cc52cbc5ee8cf2acd56ee278e24a3
[ "MIT" ]
permissive
taufique71/sports-programming
72dbec005f790d8f6b55d1fb030cc3d50ffe7df2
c29a92b5e5424c7de6f94e302fc6783561de9b3d
refs/heads/master
2020-03-25T04:43:54.418420
2019-10-10T19:51:40
2019-10-10T19:51:40
134,890,558
0
0
null
null
null
null
UTF-8
C++
false
false
677
cpp
#include <iostream> #define MAX 1000000 using namespace std; int prime[MAX+10]={1}; void seive() { long int i,j; for(i=0;i<=MAX;i++) prime[i]=1; prime[0]=0; prime[1]=0; for(i=2;i<=MAX;) { if((i*i)>MAX) break; for(j=i+i;j<=MAX;j=j+i) prime[j]=0; for (i++; !prime[i]; i++); } } void print(long int n) { long int i,j; for(i=3,j=n-i;i<=j;i++,j--) { if(prime[i]&&prime[j]) break; } cout<<n<<" = "<<i<<" + "<<j<<endl; } int main(void) { long int n; seive(); while(cin>>n) { if(n==0) break; print(n); } return 0; }
5f1769a8775251f1993c0fcc09995d0ca5247406
a80db26373b943e5adf764453a534925592b613d
/src/remote_control_server/main.cc
2a50056743eeacb144da331cf07397f3e99392dc
[]
no_license
20496e76696e6369626c65/qt_simple_teamviewer
34b3c808f3730adc83d48efa7521742ccdb217c8
ac21c87aa7920e8408b333bb6792cdd2de5bd4ed
refs/heads/master
2020-04-30T18:21:06.496477
2019-03-21T19:02:24
2019-03-21T19:02:24
177,007,149
2
1
null
null
null
null
UTF-8
C++
false
false
333
cc
#include <QApplication> #include "../include/remote_control_server.h" int main( int argc, char* argv[] ) { QApplication a( argc, argv ); RemoteControlServer server; if( !server.Start() ) { qDebug() << "Server failed to start"; return 1; } qDebug() << "Server started"; return a.exec(); }
4114658b23abae253e5886e56121ecbe5493bf55
69ab565e491c73d55aaaa55b5d802dbbb04e8e3d
/QRD/src/QRD/DBObjects/Record.cpp
edb0ef4525a31722b9997d6c5cc6cbde6fa32360
[]
no_license
CAt0mIcS/DatabaseManagementSystem
8cfa82f0f1af77a10f6a3cc9d05549d036c7ac4b
f7dfc950b0ecc914099fac5a4b787fab37ee9a41
refs/heads/master
2022-12-25T07:38:10.594944
2020-10-09T13:40:54
2020-10-09T13:40:54
281,762,655
0
0
null
null
null
null
UTF-8
C++
false
false
835
cpp
#include <sstream> #include "Record.h" namespace QRD { bool Record::operator==(const Record& other) const { return m_RecordData == other.GetRecordData() && m_RecordId == other.GetRecordId(); } void Record::DeleteData(unsigned short fieldId) { m_RecordData.erase(m_RecordData.begin() + fieldId); } std::string Record::ToString() const { std::ostringstream ss2; for (unsigned int i = 0; i < m_RecordData.size(); ++i) { ss2 << "\n\t [" << i << "]: " << m_RecordData[i]; } std::ostringstream ss; ss << "Record object: " << "\n\t[Record::Location]: " << this << "\n\t[Record::m_Data]: " << ss2.str() << "\n\t[Record::m_RecordId]: " << m_RecordId << '\n'; return ss.str(); } }
d580940c7056640554342e4afdbe83d597f64844
5deaaee37871d0268328f889a74ffe4cee5c6170
/ArrayOfStructure.cpp
2b3c82d9ef53910d7a223cd272f4e3c96fbe20bc
[]
no_license
harshitbansal373/c-plus-plus
096fe8cf2069fb5c3fa2b7ccf1732a5edcede00e
43c2b851e748142d5a18498d743d746a7ed63a61
refs/heads/master
2023-01-05T14:31:42.397967
2020-10-28T11:12:51
2020-10-28T11:12:51
158,512,426
5
32
null
2020-12-09T06:00:48
2018-11-21T08:05:06
C++
UTF-8
C++
false
false
430
cpp
//array of structure #include<conio.h> #include<iostream> using namespace std; struct record{ char name[100]; int roll_no; char branch[10]; }; int main(){ int i; struct record r[5]; cout<<"enter the name, roll no. and branch"; for(i=0;i<5;i++){ cin>>r[i].name>>r[i].roll_no>>r[i].branch; } cout<<"details of students are under"; for(i=0;i<5;i++){ cout<<"\n"<<r[i].name<<r[i].roll_no<<r[i].branch; } return 0; }
cb500b328d62ec582adca0a694e582a83b3c0459
e372d895d7a55b9031403ce04822ae1c36ab055f
/d05/ex02/Bureaucrat.hpp
25b4cc79a0fdfd191c2cae2584abf1f9b4006480
[]
no_license
maryna-kryshchuk/CPP-Piscine
9b74766a5aa31dbf0ff7026a86b5bdb9a9e9f09f
1bd945498f5d7ec2809b43ee77eea520ede4cee6
refs/heads/master
2021-09-17T14:00:19.635452
2018-07-02T11:31:03
2018-07-02T11:31:03
null
0
0
null
null
null
null
UTF-8
C++
false
false
2,055
hpp
// ************************************************************************** // // // // ::: :::::::: // // Bureaucrat.hpp :+: :+: :+: // // +:+ +:+ +:+ // // By: avolgin <[email protected]> +#+ +:+ +#+ // // +#+#+#+#+#+ +#+ // // Created: 2018/06/25 14:51:04 by avolgin #+# #+# // // Updated: 2018/06/26 16:27:45 by avolgin ### ########.fr // // // // ************************************************************************** // #ifndef BUREAUCRAT_HPP # define BUREAUCRAT_HPP #include <iostream> #include "Form.hpp" class Form; class Bureaucrat { public: class GradeTooHighException : public std::exception{ public: GradeTooHighException(void)throw(); ~GradeTooHighException(void)throw(); GradeTooHighException(const GradeTooHighException & obj)throw(); virtual const char * what() const throw(); }; class GradeTooLowException : public std::exception{ public: virtual const char * what() const throw(); GradeTooLowException(void)throw(); ~GradeTooLowException(void)throw(); GradeTooLowException(const GradeTooLowException & obj)throw(); }; Bureaucrat(std::string const & name, int grade); Bureaucrat(const Bureaucrat & obj); virtual void executeForm(Form const & form)const; virtual ~Bureaucrat(void); virtual std::string getName(void) const; virtual void addGrade(int); virtual void subGrade(int); virtual int getGrade(void) const; Bureaucrat & operator=(Bureaucrat const &); void signForm(Form &)throw(); private: Bureaucrat(void); std::string _name; int _grade; }; std::ostream & operator<<(std::ostream & o, Bureaucrat const & rhs); #endif
0b2e8029550d11608e1afc71fde7ab3582883768
ad822f849322c5dcad78d609f28259031a96c98e
/SDK/OrganicPOI_Radiated_Crust_functions.cpp
167d17f63c8f7839f0b738eee37ac8ebe18ac382
[]
no_license
zH4x-SDK/zAstroneer-SDK
1cdc9c51b60be619202c0258a0dd66bf96898ac4
35047f506eaef251a161792fcd2ddd24fe446050
refs/heads/main
2023-07-24T08:20:55.346698
2021-08-27T13:33:33
2021-08-27T13:33:33
null
0
0
null
null
null
null
UTF-8
C++
false
false
861
cpp
#include "../SDK.h" // Name: Astroneer-SDK, Version: 1.0.0 #ifdef _MSC_VER #pragma pack(push, 0x8) #endif namespace SDK { //--------------------------------------------------------------------------- // Functions //--------------------------------------------------------------------------- // Function OrganicPOI_Radiated_Crust.OrganicPOI_Radiated_Crust_C.UserConstructionScript // (Event, Public, BlueprintCallable, BlueprintEvent) void AOrganicPOI_Radiated_Crust_C::UserConstructionScript() { static auto fn = UObject::FindObject<UFunction>("Function OrganicPOI_Radiated_Crust.OrganicPOI_Radiated_Crust_C.UserConstructionScript"); AOrganicPOI_Radiated_Crust_C_UserConstructionScript_Params params; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } } #ifdef _MSC_VER #pragma pack(pop) #endif
a9b40f884b0523d8615290e1c0b8616a5a203c3e
fe7466fdc3f8251aa049268638e9b81d59161fe5
/Linux C++/Parameter_BinningHV2/Grab_BinningHV2.cpp
cce14c6c8efda7b2fbcdb2e031b41bdbf3ddb7ac
[]
no_license
Setsu00/SentechSDK_FunctionSample
a4eb5664caf6a66813cf6e8e92d435cb800d1bad
75fc81af00f0c6a400a25449fa5a351895676302
refs/heads/master
2023-03-11T08:40:14.215138
2023-02-02T03:06:03
2023-02-02T03:06:03
187,120,246
7
0
null
null
null
null
UTF-8
C++
false
false
3,530
cpp
/* BinningHV2: Set Camera Binning Horizontal / Binning Vertical to 2 */ #define ENABLED_ST_GUI #include <StApi_TL.h> #ifdef ENABLED_ST_GUI #include <StApi_GUI.h> #include <iomanip> //std::setprecision #endif using namespace StApi; using namespace std; const uint64_t nCountOfImagesToGrab = 100; int main(int /* argc */, char ** /* argv */) { try { CStApiAutoInit objStApiAutoInit; CIStSystemPtr pIStSystem(CreateIStSystem(StSystemVendor_Sentech)); CIStDevicePtr pIStDevice(pIStSystem->CreateFirstIStDevice()); cout << "Device=" << pIStDevice->GetIStDeviceInfo()->GetDisplayName() << endl; #ifdef ENABLED_ST_GUI CIStImageDisplayWndPtr pIStImageDisplayWnd(CreateIStWnd(StWindowType_ImageDisplay)); #endif CIStDataStreamPtr pIStDataStream(pIStDevice->CreateIStDataStream(0)); // ============================================================================================================== // Demostration of setting Binning Horizontal / Binning Veritcal to 2 // Create NodeMap pointer for accessing parameters GenApi::CNodeMapPtr pNodeMapCameraParam(pIStDevice->GetRemoteIStPort()->GetINodeMap()); // Get Node for Binning Horizontal GenApi::CNodePtr pNodeBinningH = pNodeMapCameraParam->GetNode("BinningHorizontal"); // Convert Node to CIntegerPtr for setting value GenApi::CIntegerPtr pIntBinningH(pNodeBinningH); // Set BinningHorizontal to 2 pIntBinningH->SetValue(2); // Get Node for WiBinning Vertical GenApi::CNodePtr pNodeBinningV = pNodeMapCameraParam->GetNode("BinningVertical"); // Convert Node to CIntegerPtr for setting value GenApi::CIntegerPtr pIntBinningV(pNodeBinningV); // Set BinningVertical to 2 pIntBinningV->SetValue(2); // ============================================================================================================== pIStDataStream->StartAcquisition(nCountOfImagesToGrab); pIStDevice->AcquisitionStart(); while (pIStDataStream->IsGrabbing()) { CIStStreamBufferPtr pIStStreamBuffer(pIStDataStream->RetrieveBuffer(5000)); if (pIStStreamBuffer->GetIStStreamBufferInfo()->IsImagePresent()) { IStImage *pIStImage = pIStStreamBuffer->GetIStImage(); #ifdef ENABLED_ST_GUI stringstream ss; ss << pIStDevice->GetIStDeviceInfo()->GetDisplayName(); ss << " "; ss << pIStImage->GetImageWidth() << " x " << pIStImage->GetImageHeight(); ss << " "; ss << fixed << std::setprecision(2) << pIStDataStream->GetCurrentFPS(); ss << "[fps]"; GenICam::gcstring strText(ss.str().c_str()); pIStImageDisplayWnd->SetUserStatusBarText(strText); if (!pIStImageDisplayWnd->IsVisible()) { pIStImageDisplayWnd->Show(NULL, StWindowMode_Modaless); pIStImageDisplayWnd->SetPosition(0, 0, pIStImage->GetImageWidth(), pIStImage->GetImageHeight()); } pIStImageDisplayWnd->RegisterIStImage(pIStImage); processEventGUI(); #else cout << "BlockId=" << pIStStreamBuffer->GetIStStreamBufferInfo()->GetFrameID() << " Size:" << pIStImage->GetImageWidth() << " x " << pIStImage->GetImageHeight() << " First byte =" << (uint32_t)*(uint8_t*)pIStImage->GetImageBuffer() << endl; #endif } else { cout << "Image data does not exist" << endl; } } pIStDevice->AcquisitionStop(); pIStDataStream->StopAcquisition(); } catch (const GenICam::GenericException &e) { cerr << endl << "An exception occurred." << endl << e.GetDescription() << endl; } cout << endl << "Press Enter to exit." << endl; while (cin.get() != '\n'); return(0); }
35d8b8d365c7ef0228ac37710372faefba8707ad
04e5b6df2ee3bcfb7005d8ec91aab8e380333ac4
/clang_codecompletion/llvm/Object/IRObjectFile.h
db47960237a0159a43c47afe60bf941a6ae72bbd
[ "MIT" ]
permissive
ColdGrub1384/Pyto
64e2a593957fd640907f0e4698d430ea7754a73e
7557485a733dd7e17ba0366b92794931bdb39975
refs/heads/main
2023-08-01T03:48:35.694832
2022-07-20T14:38:45
2022-07-20T14:38:45
148,944,721
884
157
MIT
2023-02-26T21:34:04
2018-09-15T22:29:07
C
UTF-8
C++
false
false
2,915
h
//===- IRObjectFile.h - LLVM IR object file implementation ------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // // This file declares the IRObjectFile template class. // //===----------------------------------------------------------------------===// #ifndef LLVM_OBJECT_IROBJECTFILE_H #define LLVM_OBJECT_IROBJECTFILE_H #include "llvm/ADT/PointerUnion.h" #include "llvm/Object/IRSymtab.h" #include "llvm/Object/ModuleSymbolTable.h" #include "llvm/Object/SymbolicFile.h" namespace llvm { class BitcodeModule; class Module; namespace object { class ObjectFile; class IRObjectFile : public SymbolicFile { std::vector<std::unique_ptr<Module>> Mods; ModuleSymbolTable SymTab; IRObjectFile(MemoryBufferRef Object, std::vector<std::unique_ptr<Module>> Mods); public: ~IRObjectFile() override; void moveSymbolNext(DataRefImpl &Symb) const override; Error printSymbolName(raw_ostream &OS, DataRefImpl Symb) const override; Expected<uint32_t> getSymbolFlags(DataRefImpl Symb) const override; basic_symbol_iterator symbol_begin() const override; basic_symbol_iterator symbol_end() const override; StringRef getTargetTriple() const; static bool classof(const Binary *v) { return v->isIR(); } using module_iterator = pointee_iterator<std::vector<std::unique_ptr<Module>>::const_iterator, const Module>; module_iterator module_begin() const { return module_iterator(Mods.begin()); } module_iterator module_end() const { return module_iterator(Mods.end()); } iterator_range<module_iterator> modules() const { return make_range(module_begin(), module_end()); } /// Finds and returns bitcode embedded in the given object file, or an /// error code if not found. static Expected<MemoryBufferRef> findBitcodeInObject(const ObjectFile &Obj); /// Finds and returns bitcode in the given memory buffer (which may /// be either a bitcode file or a native object file with embedded bitcode), /// or an error code if not found. static Expected<MemoryBufferRef> findBitcodeInMemBuffer(MemoryBufferRef Object); static Expected<std::unique_ptr<IRObjectFile>> create(MemoryBufferRef Object, LLVMContext &Context); }; /// The contents of a bitcode file and its irsymtab. Any underlying data /// for the irsymtab are owned by Symtab and Strtab. struct IRSymtabFile { std::vector<BitcodeModule> Mods; SmallVector<char, 0> Symtab, Strtab; irsymtab::Reader TheReader; }; /// Reads a bitcode file, creating its irsymtab if necessary. Expected<IRSymtabFile> readIRSymtab(MemoryBufferRef MBRef); } } #endif
ae2df820f517b94260ebc071ea1b804c463a3d03
dee038fd8d612fb25333286e5cbaa7ed4da5bc61
/src/util/mm_io/readGraph.tcc
3056ed86b7b7876913a224118b73a0a6edb7940c
[ "MIT" ]
permissive
IronySuzumiya/G-Sim
9506ea5780848e4331ecf4075788059a6b89a54a
b6bf4d22da0b0fde190490a2cbb600b21a4ee395
refs/heads/master
2022-12-16T18:37:29.132826
2019-11-04T04:30:01
2019-11-04T04:30:01
292,493,679
0
0
MIT
2020-09-03T07:06:57
2020-09-03T07:06:56
null
UTF-8
C++
false
false
10,736
tcc
#include <cstdio> #include <cstdlib> #include <cassert> #include <iostream> #include <fstream> #include <string> #include <unistd.h> #include <map> #include <set> #include <filesystem> extern "C" { #include "mm_io.h" } template<class v_t> void Utility::readGraph<v_t>::allocateGraph() { // Initialize node pointers nodePtrs = (unsigned int *)malloc((*numNodes + 2) * sizeof(unsigned int)); // Dummy for zero, plus extra at the end for M+1 bounds vertex_property = (v_t *)malloc((*numNodes + 1) * sizeof(v_t)); for(int i = 0 ; i < *numNodes + 1; i ++) { vertex_property[i] = initialVertexValue; } nodeNeighbors = (unsigned int *)malloc(*numNeighbors * sizeof(unsigned int)); edgeWeights = (double *)malloc(*numNeighbors * sizeof(double)); nodeIncomingPtrs = (unsigned int *)malloc((*numNodes + 1) * sizeof(unsigned int)); nodeIncomingNeighbors = (unsigned int *)malloc(*numNeighbors * sizeof(unsigned int)); } template<class v_t> void Utility::readGraph<v_t>::readMatrixMarket(const char *mmInputFile) { fprintf(stderr, "[readMatrixMarket] allocating space for shared integers \n"); numNodes = (int*) malloc(sizeof(int)); numNeighbors = (int*) malloc(sizeof(int)); std::string binFname = std::string(mmInputFile)+".bin"; bool success = readBin(binFname); if(!success) { int M, N, nz, *I, *J; double *val; MM_typecode matcode; fprintf(stderr, "[readMatrixMarket] Reading matrix market file \n"); int retval = mm_read_mtx_crd(mmInputFile, &M, &N, &nz, &I, &J, &val, &matcode); if(retval < 0) { fprintf(stderr, "matrix read failed!\n"); exit(-1); } // Check values: no vertices should be zero or > M for(int j=0; j<nz; j++){ if((I[j] <= 0) || (J[j] <= 0)) { fprintf(stderr, "[readMatrixMarket] ERROR: matrix file contains an unsupported 0 vertex at %i\n", j); assert(false); } if(I[j] > nz) { fprintf(stderr, "[readMatrixMarket] ERROR: matrix file contains an out-of-bounds vertex (%i > (nz=%i)) at position %i\n", I[j], nz, j); assert(false); } if(J[j] > nz) { fprintf(stderr, "[readMatrixMarket] ERROR: matrix file contains an out-of-bounds vertex (%i > (nz=%i)) at position %i\n", I[j], nz, j); assert(false); } } *numNodes = M; *numNeighbors = nz; allocateGraph(); bool jIsInorder = true; for(int j=0; j<nz-1; j++) { if(j%PRINT_STEP == 0) fprintf(stderr, "[readMatrixMarket] preprocessing %i/%i\n", j, nz); if(J[j] > J[j+1]) jIsInorder = false; } fprintf(stderr, "[readMatrixMarket] Converting matrix market to expected input \n"); unsigned int *nodePtr = nodePtrs; unsigned int *nodeNeighbor = nodeNeighbors; double *edgeWeight = edgeWeights; int n = 0; *nodePtr = n; nodePtr[0] = 0; // initialize the first pointer to the start of the edge list if(jIsInorder) { //fprintf(stderr, "Test If\n"); int curJ = 0; for(n = 0; n < nz; n++) { if(n%PRINT_STEP == 0) fprintf(stderr, "[readMatrixMarket] postprocessing %i/%i\n", n, nz); //printf ("Test If 1 %d\n", n); nodeNeighbor[n] = I[n]; //printf ("Test If 2\n"); if(mm_is_real(matcode)) *(edgeWeight++) = val[n]; //Giving error else *(edgeWeight++) = 1.; while(curJ != J[n]) nodePtr[++curJ] = n; } // Update the very last node ptr nodePtr[++curJ] = *numNeighbors; } else { //fprintf(stderr, " Test Else \n"); for(int i=0; i<=M; i++) { for(int ind=0; ind < nz; ind++) { if(n%PRINT_STEP == 0) fprintf(stderr, "[readMatrixMarket] postprocessing %i, %i/%i\n", i, ind, nz); if(I[ind] == i) { *(nodeNeighbor++) = J[ind]; if(mm_is_real(matcode)) *(edgeWeight++) = val[ind]; else *(edgeWeight++) = 1.; n++; } } *(++nodePtr) = n; } // Update the very last node pointer *(++nodePtr) = *numNeighbors; } //fprintf(stderr, "Test \n"); //assert((nodeNeighbors)[0] == (nodeNeighbors)[1] == 0); unsigned int p = 0; unsigned int idx_cnt = 0; memset(nodeIncomingNeighbors, 0, (*numNeighbors)*sizeof(unsigned int)); memset(nodeIncomingPtrs, 0, (*numNodes + 1)*sizeof(unsigned int)); std::map<int, std::set<int> > incomingNodes; for(int nodeInd = 0; nodeInd <= M; nodeInd++) { if(nodeInd%PRINT_STEP == 0) fprintf(stderr, "[readMatrixMarket] postpostprocessing %i/%i\n", nodeInd, M); for(unsigned int neighborInd = nodePtrs[nodeInd]; neighborInd < nodePtrs[nodeInd+1]; neighborInd++) { int neighbor = nodeNeighbors[neighborInd]; incomingNodes[neighbor].insert(nodeInd); } } for(int nodeInd = 0; nodeInd <= M; nodeInd++) { if(nodeInd%PRINT_STEP == 0) fprintf(stderr, "[readMatrixMarket] postpostpostprocessing %i/%i\n", nodeInd, M); nodeIncomingPtrs[nodeInd] = p; p += incomingNodes[nodeInd].size(); for(int neighborInd : incomingNodes[nodeInd]) { nodeIncomingNeighbors[idx_cnt++] = neighborInd; } } assert(nodeIncomingPtrs[0] == 0); nodeIncomingPtrs[M+1] = p; // check some stuff for(int j = 0; j < M+2; j++) { assert((nodePtrs[j] >=0) && (nodePtrs[j] <= ((unsigned int)nz))); assert((nodeIncomingPtrs[j] >=0) && (nodeIncomingPtrs[j] <= ((unsigned int)nz))); } for(int j = 0; j < nz; j++) { assert((nodeNeighbors[j] >=1) && (nodeNeighbors[j] <= ((unsigned int)M))); assert((nodeIncomingNeighbors[j] >=1) && (nodeIncomingNeighbors[j] <= ((unsigned int)M))); } free(val); free(J); free(I); writeBin(binFname); } } template<class v_t> void Utility::readGraph<v_t>::printEdgeWeights(void) { for(int i = 0; i < *numNeighbors; i++) { fprintf(stderr, "[readGraph DEBUG] edge %u: %lf\n", i, edgeWeights[i]); } } template<class v_t> void Utility::readGraph<v_t>::printNodePtrs(void) { fprintf(stderr, "[readGraph DEBUG] nodePtrs:\n"); for(int i = 1; i < *numNodes; i++) { fprintf(stderr, " node %u: %u\n", i, nodePtrs[i]); } } template<class v_t> void Utility::readGraph<v_t>::printGraph(void) { for(int i = 1 ; i <= *numNodes; i++) { std::cerr << "Node: " << i << "\n"; std::cerr << " Property: " << getVertexProperty(i) << "\n"; for(int j = getNodePtr(i); j < getNodePtr(i+1); j++) { std::cerr << " Edge " << j << " weight " << getEdgeWeight(j) << "\n"; std::cerr << " Neighbor: " << getNodeNeighbor(j) << "\n"; } } } template<class v_t> void Utility::readGraph<v_t>::printVertexProperties(int num) { std::cerr << "[ "; for(int i = 1; i <= *numNodes && i < num; i++) { std::cerr << getVertexProperty(i) << ", "; } std::cerr << "]\n"; } template<class v_t> void Utility::readGraph<v_t>::writeBin(std::string binFname) { fprintf(stderr, "[writeBin] writing binary\n"); std::ofstream binFile; binFile.open(binFname.c_str(), std::ios::out | std::ios::binary); assert(binFile.is_open()); binFile.write((char*)numNodes, sizeof(int)); binFile.write((char*)numNeighbors, sizeof(int)); binFile.write((char*)nodePtrs, sizeof(unsigned int)*((*numNodes)+1)); binFile.write((char*)nodeNeighbors, sizeof(unsigned int)*(*numNeighbors)); binFile.write((char*)edgeWeights, sizeof(double)*(*numNeighbors)); binFile.write((char*)nodeIncomingPtrs, sizeof(unsigned int)*((*numNodes)+1)); binFile.write((char*)nodeIncomingNeighbors, sizeof(unsigned int)*(*numNeighbors)); binFile.close(); } template<class v_t> bool Utility::readGraph<v_t>::readBin(std::string binFname) { std::ifstream binFile; binFile.open(binFname.c_str(), std::ios::in | std::ios::binary); if(!binFile.good()) return false; uint64_t fileSize = std::filesystem::file_size(binFname.c_str()); const size_t startIdx = binFname.find_last_of("/"); binFname.erase(0, startIdx+1); boost::interprocess::permissions perm; perm.set_unrestricted(); if(shouldInit == 1) boost::interprocess::shared_memory_object::remove(binFname.c_str()); graphData = boost::interprocess::shared_memory_object(boost::interprocess::open_or_create, binFname.c_str(), boost::interprocess::read_write, perm); graphData.truncate(fileSize); region = boost::interprocess::mapped_region(graphData, boost::interprocess::read_write, 0, fileSize); uint8_t *dataPtr = (uint8_t*)region.get_address(); numNodes = (int*)dataPtr; dataPtr += sizeof(int); numNeighbors = (int*)dataPtr; dataPtr += sizeof(int); nodePtrs = (unsigned int*)dataPtr; dataPtr += sizeof(unsigned int)*((*numNodes)+1); nodeNeighbors = (unsigned int*)dataPtr; dataPtr += sizeof(unsigned int)*(*numNeighbors); edgeWeights = (double*)dataPtr; dataPtr += sizeof(double)*(*numNeighbors); nodeIncomingPtrs = (unsigned int*)dataPtr; dataPtr += sizeof(unsigned int)*((*numNodes)+1); nodeIncomingNeighbors = (unsigned int*)dataPtr; dataPtr += sizeof(unsigned int)*(*numNeighbors); assert(dataPtr <= (uint8_t*)region.get_address() + region.get_size()); if(shouldInit != 0) { fprintf(stderr, "[writeBin] reading binary\n"); binFile.read((char*)numNodes, sizeof(int)); assert(!binFile.fail()); fprintf(stderr, "%li bytes read\n", binFile.gcount()); binFile.read((char*)numNeighbors, sizeof(int)); assert(!binFile.fail()); fprintf(stderr, "%li bytes read\n", binFile.gcount()); fprintf(stderr, "[writeBin] read numNodes(%p): %i and numNeighbors(%p): %i\n", numNodes, *numNodes, numNeighbors, *numNeighbors); binFile.read((char*)nodePtrs, sizeof(unsigned int)*((*numNodes)+1)); assert(!binFile.fail()); fprintf(stderr, "%li bytes read\n", binFile.gcount()); binFile.read((char*)nodeNeighbors, sizeof(unsigned int)*(*numNeighbors)); assert(!binFile.fail()); fprintf(stderr, "%li bytes read\n", binFile.gcount()); binFile.read((char*)edgeWeights, sizeof(double)*(*numNeighbors)); assert(!binFile.fail()); fprintf(stderr, "%li bytes read\n", binFile.gcount()); binFile.read((char*)nodeIncomingPtrs, sizeof(unsigned int)*((*numNodes)+1)); assert(!binFile.fail()); fprintf(stderr, "%li bytes read\n", binFile.gcount()); binFile.read((char*)nodeIncomingNeighbors, sizeof(unsigned int)*(*numNeighbors)); assert(!binFile.fail()); fprintf(stderr, "%li bytes read\n", binFile.gcount()); } else fprintf(stderr, "skipping graph initialization\n"); binFile.close(); return true; }
1ccecc19ba0ee47d600671ebfdf0fd493d6d268e
ec3ef9226427cdb361b8dd98a4d3b39fea6653d6
/src/qt/bitcoinamountfield.cpp
866b364e714ee3936d380a77ab50c2b876b7cbee
[ "MIT" ]
permissive
investhubcoin/Invest-Hub-Coin
96e4fe9f839d107c5f4f990932c965abce419f38
7845dd9798302ca2631a723cb8434c0a71c03de7
refs/heads/master
2020-05-29T21:41:29.128492
2019-05-30T09:50:48
2019-05-30T09:50:48
187,916,304
0
0
null
null
null
null
UTF-8
C++
false
false
8,182
cpp
// Copyright (c) 2011-2014 The Bitcoin developers // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "bitcoinamountfield.h" #include "bitcoinunits.h" #include "guiconstants.h" #include "qvaluecombobox.h" #include <QAbstractSpinBox> #include <QApplication> #include <QHBoxLayout> #include <QKeyEvent> #include <QLineEdit> /** QSpinBox that uses fixed-point numbers internally and uses our own * formatting/parsing functions. */ class AmountSpinBox : public QAbstractSpinBox { Q_OBJECT public: explicit AmountSpinBox(QWidget* parent) : QAbstractSpinBox(parent), currentUnit(BitcoinUnits::IHC), singleStep(100000) // satoshis { setAlignment(Qt::AlignRight); connect(lineEdit(), SIGNAL(textEdited(QString)), this, SIGNAL(valueChanged())); } QValidator::State validate(QString& text, int& pos) const { if (text.isEmpty()) return QValidator::Intermediate; bool valid = false; parse(text, &valid); /* Make sure we return Intermediate so that fixup() is called on defocus */ return valid ? QValidator::Intermediate : QValidator::Invalid; } void fixup(QString& input) const { bool valid = false; CAmount val = parse(input, &valid); if (valid) { input = BitcoinUnits::format(currentUnit, val, false, BitcoinUnits::separatorAlways); lineEdit()->setText(input); } } CAmount value(bool* valid_out = 0) const { return parse(text(), valid_out); } void setValue(const CAmount& value) { lineEdit()->setText(BitcoinUnits::format(currentUnit, value, false, BitcoinUnits::separatorAlways)); emit valueChanged(); } void stepBy(int steps) { bool valid = false; CAmount val = value(&valid); val = val + steps * singleStep; val = qMin(qMax(val, CAmount(0)), BitcoinUnits::maxMoney()); setValue(val); } void setDisplayUnit(int unit) { bool valid = false; CAmount val = value(&valid); currentUnit = unit; if (valid) setValue(val); else clear(); } void setSingleStep(const CAmount& step) { singleStep = step; } QSize minimumSizeHint() const { if (cachedMinimumSizeHint.isEmpty()) { ensurePolished(); const QFontMetrics fm(fontMetrics()); int h = lineEdit()->minimumSizeHint().height(); int w = fm.width(BitcoinUnits::format(BitcoinUnits::IHC, BitcoinUnits::maxMoney(), false, BitcoinUnits::separatorAlways)); w += 2; // cursor blinking space QStyleOptionSpinBox opt; initStyleOption(&opt); QSize hint(w, h); QSize extra(35, 6); opt.rect.setSize(hint + extra); extra += hint - style()->subControlRect(QStyle::CC_SpinBox, &opt, QStyle::SC_SpinBoxEditField, this).size(); // get closer to final result by repeating the calculation opt.rect.setSize(hint + extra); extra += hint - style()->subControlRect(QStyle::CC_SpinBox, &opt, QStyle::SC_SpinBoxEditField, this).size(); hint += extra; hint.setHeight(h); opt.rect = rect(); cachedMinimumSizeHint = style()->sizeFromContents(QStyle::CT_SpinBox, &opt, hint, this).expandedTo(QApplication::globalStrut()); } return cachedMinimumSizeHint; } private: int currentUnit; CAmount singleStep; mutable QSize cachedMinimumSizeHint; /** * Parse a string into a number of base monetary units and * return validity. * @note Must return 0 if !valid. */ CAmount parse(const QString& text, bool* valid_out = 0) const { CAmount val = 0; bool valid = BitcoinUnits::parse(currentUnit, text, &val); if (valid) { if (val < 0 || val > BitcoinUnits::maxMoney()) valid = false; } if (valid_out) *valid_out = valid; return valid ? val : 0; } protected: bool event(QEvent* event) { if (event->type() == QEvent::KeyPress || event->type() == QEvent::KeyRelease) { QKeyEvent* keyEvent = static_cast<QKeyEvent*>(event); if (keyEvent->key() == Qt::Key_Comma) { // Translate a comma into a period QKeyEvent periodKeyEvent(event->type(), Qt::Key_Period, keyEvent->modifiers(), ".", keyEvent->isAutoRepeat(), keyEvent->count()); return QAbstractSpinBox::event(&periodKeyEvent); } } return QAbstractSpinBox::event(event); } StepEnabled stepEnabled() const { StepEnabled rv = 0; if (isReadOnly()) // Disable steps when AmountSpinBox is read-only return StepNone; if (text().isEmpty()) // Allow step-up with empty field return StepUpEnabled; bool valid = false; CAmount val = value(&valid); if (valid) { if (val > 0) rv |= StepDownEnabled; if (val < BitcoinUnits::maxMoney()) rv |= StepUpEnabled; } return rv; } signals: void valueChanged(); }; #include "bitcoinamountfield.moc" BitcoinAmountField::BitcoinAmountField(QWidget* parent) : QWidget(parent), amount(0) { amount = new AmountSpinBox(this); amount->setLocale(QLocale::c()); amount->installEventFilter(this); amount->setMaximumWidth(170); QHBoxLayout* layout = new QHBoxLayout(this); layout->addWidget(amount); unit = new QValueComboBox(this); unit->setModel(new BitcoinUnits(this)); layout->addWidget(unit); layout->addStretch(1); layout->setContentsMargins(0, 0, 0, 0); setLayout(layout); setFocusPolicy(Qt::TabFocus); setFocusProxy(amount); // If one if the widgets changes, the combined content changes as well connect(amount, SIGNAL(valueChanged()), this, SIGNAL(valueChanged())); connect(unit, SIGNAL(currentIndexChanged(int)), this, SLOT(unitChanged(int))); // Set default based on configuration unitChanged(unit->currentIndex()); } void BitcoinAmountField::clear() { amount->clear(); unit->setCurrentIndex(0); } void BitcoinAmountField::setEnabled(bool fEnabled) { amount->setEnabled(fEnabled); unit->setEnabled(fEnabled); } bool BitcoinAmountField::validate() { bool valid = false; value(&valid); setValid(valid); return valid; } void BitcoinAmountField::setValid(bool valid) { if (valid) amount->setStyleSheet(""); else amount->setStyleSheet(STYLE_INVALID); } bool BitcoinAmountField::eventFilter(QObject* object, QEvent* event) { if (event->type() == QEvent::FocusIn) { // Clear invalid flag on focus setValid(true); } return QWidget::eventFilter(object, event); } QWidget* BitcoinAmountField::setupTabChain(QWidget* prev) { QWidget::setTabOrder(prev, amount); QWidget::setTabOrder(amount, unit); return unit; } CAmount BitcoinAmountField::value(bool* valid_out) const { return amount->value(valid_out); } void BitcoinAmountField::setValue(const CAmount& value) { amount->setValue(value); } void BitcoinAmountField::setReadOnly(bool fReadOnly) { amount->setReadOnly(fReadOnly); unit->setEnabled(!fReadOnly); } void BitcoinAmountField::unitChanged(int idx) { // Use description tooltip for current unit for the combobox unit->setToolTip(unit->itemData(idx, Qt::ToolTipRole).toString()); // Determine new unit ID int newUnit = unit->itemData(idx, BitcoinUnits::UnitRole).toInt(); amount->setDisplayUnit(newUnit); } void BitcoinAmountField::setDisplayUnit(int newUnit) { unit->setValue(newUnit); } void BitcoinAmountField::setSingleStep(const CAmount& step) { amount->setSingleStep(step); }
6cff4452ac19bae4813bc72b8d585a7c49543f3e
d4881694449a8c8c7925bdc5c45ed9909d36edba
/Project1/Project1/brizaaaa.cpp
5f3bd47444a791d3957e9326d505abde64cfe89d
[]
no_license
Silentbroo/Projects.quiz
46d7b17b7c576425ba05b4c2ab6e4a99a96c265a
d66532f05f5faa3c7d16cb4c6875d344cf9eb27d
refs/heads/master
2021-01-18T13:12:56.060225
2017-05-19T14:45:29
2017-05-19T14:45:29
80,738,757
0
1
null
null
null
null
UTF-8
C++
false
false
2,762
cpp
#include <stdio.h> #include <allegro5/allegro.h> #include <cmath> const float FPS = 100; const int SCREEN_W = 640; const int SCREEN_H = 480; //change this number to change the size of the "marker tip" that draws the shape! const int BOUNCER_SIZE = 15; int main(int argc, char **argv) { ALLEGRO_DISPLAY *display = NULL; ALLEGRO_EVENT_QUEUE *event_queue = NULL; ALLEGRO_TIMER *timer = NULL; ALLEGRO_BITMAP *bouncer = NULL; float bouncer_x = SCREEN_W / 2.0 - BOUNCER_SIZE / 2.0; float bouncer_y = SCREEN_H / 2.0 - BOUNCER_SIZE / 2.0; float bouncer_dx = -4.0, bouncer_dy = 4.0; bool redraw = true; double t = 1; al_init(); timer = al_create_timer(1.0 / FPS); display = al_create_display(SCREEN_W, SCREEN_H); bouncer = al_create_bitmap(BOUNCER_SIZE, BOUNCER_SIZE); al_set_target_bitmap(bouncer); al_clear_to_color(al_map_rgb(255, 0, 255)); al_set_target_bitmap(al_get_backbuffer(display)); event_queue = al_create_event_queue(); al_register_event_source(event_queue, al_get_display_event_source(display)); al_register_event_source(event_queue, al_get_timer_event_source(timer)); //change the numbers to change the background color, 000 is black al_clear_to_color(al_map_rgb(67, 5, 9)); al_flip_display(); al_start_timer(timer); while (1) { t++; ALLEGRO_EVENT ev; al_wait_for_event(event_queue, &ev); if (ev.type == ALLEGRO_EVENT_TIMER) { if (bouncer_x < 0 || bouncer_x > SCREEN_W - BOUNCER_SIZE) { bouncer_dx = -bouncer_dx; } if (bouncer_y < 0 || bouncer_y > SCREEN_H - BOUNCER_SIZE) { bouncer_dy = -bouncer_dy; } ////////////////////////////////////////////////////////////////////////////////////////////// //here's the parametric equations that determine the shape!! bouncer_x = 250 + .25*(cos(t) + t*sin(t)); bouncer_y = 250 + (.25*(sin(t) - t*cos(t)))*-1; ///////////////////////////////////////////////////////////////////////////////////////////////////// redraw = true; } else if (ev.type == ALLEGRO_EVENT_DISPLAY_CLOSE) { break; } if (redraw && al_is_event_queue_empty(event_queue)) { redraw = false; //a well-placed if statement here might make it blink //uncommenting this line makes it moving dots instead of picture //also, change the number values to change the background color // al_clear_to_color(al_map_rgb(0,0,0)); al_set_target_bitmap(bouncer); //mess with this last line here to change colors al_clear_to_color(al_map_rgb(90, t, 110)); al_set_target_bitmap(al_get_backbuffer(display)); al_draw_bitmap(bouncer, bouncer_x, bouncer_y, 1); al_flip_display(); } } al_destroy_bitmap(bouncer); al_destroy_timer(timer); al_destroy_display(display); al_destroy_event_queue(event_queue); return 0; }
[ "Game110AM@605-110-STU21" ]
Game110AM@605-110-STU21
0b704fc268fb225fdb3ac9e1eeff19c20a8662ba
a0e65f99c7928552d16b46966046ea63f48810b3
/hw3/tool/print_mat.cpp
f7fc4c5df7a0fed6685c970e48142350ffaee379
[]
no_license
SuXY-O-O/ParallerComputing
72758f293ce30f77db72ad9f5425a3a480e8eb7d
b2f44aed3162cd400c6f09c1278e3bd567ba3b73
refs/heads/master
2023-05-09T05:43:15.145529
2021-06-06T07:29:30
2021-06-06T07:29:30
374,295,507
0
0
null
null
null
null
UTF-8
C++
false
false
1,335
cpp
// print.cxx // print the double precision matrix from the input file #include <stdio.h> #include <stdlib.h> #include <sys/stat.h> int main(int argc, char **argv) { FILE *fh; if (argc < 2) { printf("Invalid arguments!\n"); printf("Run the program as ./print filename\n"); exit(-1); } if (!(fh = fopen(argv[1], "r"))) { printf("Can't open file %s\n", argv[1]); exit(-1); } struct stat fstat; int n1, n2, fsize; char *fstream; stat(argv[1], &fstat); fsize = fstat.st_size; fstream = (char *)malloc(fsize); fread(fstream, sizeof(char), fsize, fh); n1 = ((int *)fstream)[0]; n2 = ((int *)fstream)[1]; if (n1 <= 0 || n2 <= 0) { printf("Matrix size error, %dx%d\n", n1, n2); exit(-1); } if (fsize < (sizeof(int) * 2 + sizeof(double) * n1 * n2)) { printf("Actual size mismatches with stated size\n"); exit(-1); } double *A = (double *)(fstream + sizeof(int) * 2); printf(" ---- %s: %d*%d Matrix -----\n", argv[1], n1, n2); for (int i = 0; i < n1; i++) { for (int j = 0; j < n2; j++) { printf("%.4f ", *(A + i * n2 + j)); // A[i,j] } printf("\n"); } free(fstream); fclose(fh); return 0; }
8c82ed972acc620b86f663b9b5003a476934b108
4145500714b175cd40f6ecbd215635b5b859241f
/engine/XEffeEngine/XControl/XControlBasic.cpp
7f979612b64f0c9e03760bf6fb3753c605240779
[]
no_license
QiangJi/XEffect2D
3fbb1e5f1a3a7c94f9d1ab3abb57943fa9da7b62
bf7224542d8bb48de19b15a0b06a094bc78bd9f5
refs/heads/master
2020-12-13T12:52:53.945387
2014-04-22T08:45:37
2014-04-22T08:45:37
null
0
0
null
null
null
null
GB18030
C++
false
false
1,380
cpp
//++++++++++++++++++++++++++++++++ //Author: 贾胜华(JiaShengHua) //Version: 1.0.0 //Date: See the header file. //-------------------------------- #include "XControlBasic.h" _XControlBasic::_XControlBasic() :m_mouseRect(0.0f,0.0f,1.0f,1.0f) //控件的鼠标响应范围 ,m_size(1.0f,1.0f) //控件的大小 ,m_position(0.0f,0.0f) //控件的位置 ,m_color(1.0f,1.0f,1.0f,1.0f) //控件的颜色 ,m_isEnable(0) //控件是否有效,有效的物件才能设置下面的属性 ,m_isVisiable(0) //控件是否可见,可见的物件才能设置下面的属性 ,m_isActive(0) //控件是否处于激活状态,激活的物件才能接收控制信号 ,m_isBeChoose(0) { static int controlOrder = 0; controlOrder ++; m_objectID = controlOrder; } _XBool _XControlBasic::setACopy(const _XControlBasic & temp) { m_mouseRect = temp.m_mouseRect; //控件的鼠标响应范围 m_size = temp.m_size; //控件的大小 m_position = temp.m_position; //控件的位置 m_color = temp.m_color; //控件的颜色 m_isEnable = temp.m_isEnable; //控件是否有效,有效的物件才能设置下面的属性 m_isVisiable = temp.m_isVisiable; //控件是否可见,可见的物件才能设置下面的属性 m_isActive = temp.m_isActive; //控件是否处于激活状态,激活的物件才能接收控制信号 m_isBeChoose = temp.m_isBeChoose; return XTrue; }
fbf4bbf24ade965c8beb34736487f85201390ff0
97903b44eef6a0b080d0b4169a1c3487e75569b5
/src/engine/src/vertex.cpp
6ed103abaf992fa884c1bed0212ec67638636920
[]
no_license
1whatleytay/ivory
74dd5aa791b225d0b03c03b67e0c262410f4e66a
2bc153fa9dc56c4a135170b21551de8993215de1
refs/heads/master
2023-05-10T03:20:38.748844
2021-05-29T03:04:54
2021-05-29T03:11:02
347,225,561
0
0
null
null
null
null
UTF-8
C++
false
false
760
cpp
#include <engine/vertex.h> Vec2::Vec2(float x, float y) : x(x), y(y) { } std::array<uint8_t, 4> Color::data() const { return { static_cast<uint8_t>(red * 255.0f), static_cast<uint8_t>(green * 255.0f), static_cast<uint8_t>(blue * 255.0f), 255 }; } Color::Color(uint32_t color) { red = (float)(color >> 16u) / 255.0f; green = (float)((color >> 8u) & 0xFFu) / 255.0f; blue = (float)(color & 0xFFu) / 255.0f; } void Vertex::mark() { glVertexAttribPointer(0, 3, GL_FLOAT, false, sizeof(Vertex), (void *)offsetof(Vertex, position)); glVertexAttribPointer(1, 2, GL_FLOAT, false, sizeof(Vertex), (void *)offsetof(Vertex, texCoord)); glEnableVertexAttribArray(0); glEnableVertexAttribArray(1); }
368d2ad75a8c3796852c1e978c948d023ada570a
68e794d0ef476f13c77b2ad912c08f9a2bf4205e
/tests/tests/cookie_encoding.cpp
10d5b64704600032edb3634c188399b45fdd7c89
[]
no_license
omerhorev/cryptopals
8fbd829eacd038b6fe0f2c4e2fff63df4d274c02
3ab6ec686d8f2f319f7a0e3b7014a9156742e8ca
refs/heads/master
2020-06-19T11:23:13.414944
2019-12-28T12:20:13
2019-12-28T12:20:13
196,691,133
2
0
null
2019-11-17T10:16:21
2019-07-13T07:16:33
C++
UTF-8
C++
false
false
1,181
cpp
// // Created by omerh on 24/08/2019. // #include <gtest/gtest.h> #include "utils/cookie_encoding.h" struct example_object { int foo; char baz[4]; float zap; }; namespace utils { template<> class cookie_encoder<example_object> : internal::encode_cookie_base { public: std::string encode(const example_object &val) { std::string s; s += encode_field("baz", val.baz); s += encode_field("foo", val.foo); s += encode_field("zap", val.zap); return s; } void decode(const std::string &string, example_object &obj) { decode_field(string, "baz", obj.baz); decode_field(string, "foo", obj.foo); decode_field(string, "zap", obj.zap); } }; } TEST(cookie, encode) { example_object obj1 = {}; obj1.zap = 0.5; obj1.baz[0] = 'a'; obj1.baz[1] = 'b'; obj1.baz[2] = 0; obj1.foo = 3; example_object obj2 = {}; utils::decode_as_cookie(utils::encode_as_cookie(obj1), obj2); ASSERT_EQ(obj1.zap, obj2.zap); ASSERT_EQ(obj1.foo, obj2.foo); ASSERT_STREQ(obj1.baz, obj2.baz); }
51869a48fa230d08a6bd090d693775dbb1ce8ce3
8d83c56718f0845423ec1eff847df9f590b0a116
/Mods/CrysisWarsMod/Code/GameCVars.cpp
e5436fed335cf2de3607110314fa91097a6e66a5
[]
no_license
CyberSys/Crysis-Wars-Source-Code
534e7936a9856b529fce327ae4d2388828066498
9cfe9fa887f6583b72f3bf1dc3c5609077e44fc6
refs/heads/master
2021-09-02T12:54:05.307572
2018-01-02T20:29:59
2018-01-02T20:29:59
null
0
0
null
null
null
null
WINDOWS-1250
C++
false
false
89,769
cpp
/************************************************************************* Crytek Source File. Copyright (C), Crytek Studios, 2001-2004. ------------------------------------------------------------------------- $Id$ $DateTime$ ------------------------------------------------------------------------- History: - 11:8:2004 10:50 : Created by Márcio Martins *************************************************************************/ #include "StdAfx.h" #include "GameCVars.h" #include "GameRules.h" #include "ItemSharedParams.h" #include <INetwork.h> #include <IGameObject.h> #include <IActorSystem.h> #include <IItemSystem.h> #include "WeaponSystem.h" #include "ServerSynchedStorage.h" #include "ItemString.h" #include "HUD/HUD.h" #include "Menus/QuickGame.h" #include "Environment/BattleDust.h" #include "NetInputChainDebug.h" #include "Menus/FlashMenuObject.h" #include "Menus/MPHub.h" #include "INetworkService.h" static void BroadcastChangeSafeMode( ICVar * ) { SGameObjectEvent event(eCGE_ResetMovementController, eGOEF_ToExtensions); IEntitySystem * pES = gEnv->pEntitySystem; IEntityItPtr pIt = pES->GetEntityIterator(); while (!pIt->IsEnd()) { if (IEntity * pEnt = pIt->Next()) if (IActor * pActor = g_pGame->GetIGameFramework()->GetIActorSystem()->GetActor(pEnt->GetId())) pActor->HandleEvent( event ); } } void CmdBulletTimeMode( IConsoleCmdArgs* cmdArgs) { g_pGameCVars->goc_enable = 0; g_pGameCVars->goc_tpcrosshair = 0; g_pGameCVars->bt_ironsight = 1; g_pGameCVars->bt_speed = 0; g_pGameCVars->bt_energy_decay = 2.5; g_pGameCVars->bt_end_reload = 1; g_pGameCVars->bt_end_select = 1; g_pGameCVars->bt_end_melee = 0; } void CmdGOCMode( IConsoleCmdArgs* cmdArgs) { g_pGameCVars->goc_enable = 1; g_pGameCVars->goc_tpcrosshair = 1; g_pGameCVars->bt_ironsight = 1; g_pGameCVars->bt_speed = 0; g_pGameCVars->bt_energy_decay = 0; g_pGameCVars->bt_end_reload = 1; g_pGameCVars->bt_end_select = 1; g_pGameCVars->bt_end_melee = 0; // CPlayer *pPlayer = static_cast<CPlayer *>(gEnv->pGame->GetIGameFramework()->GetClientActor()); if(pPlayer && !pPlayer->IsThirdPerson()) { pPlayer->ToggleThirdPerson(); } } void CmdListInvisiblePlayers(IConsoleCmdArgs* cmdArgs) { IActorIteratorPtr it = g_pGame->GetIGameFramework()->GetIActorSystem()->CreateActorIterator(); while (IActor* pActor = it->Next()) { if(pActor->IsPlayer() && !pActor->IsClient()) { IEntityRenderProxy* pProxy = static_cast<IEntityRenderProxy*>(pActor->GetEntity()->GetProxy(ENTITY_PROXY_RENDER)); if(pProxy ) { CryLogAlways("Player %s is %s", pActor->GetEntity()->GetName(), pProxy->IsRenderProxyVisAreaVisible() ? "visible" : "invisible"); } } } } // game related cvars must start with an g_ // game server related cvars must start with sv_ // game client related cvars must start with cl_ // no other types of cvars are allowed to be defined here! void SCVars::InitCVars(IConsole *pConsole) { //client cvars pConsole->Register("cl_hud",&cl_hud,1,0,"Show/Hide the HUD", CHUDCommon::HUD); pConsole->Register("cl_fov", &cl_fov, 60.0f, 0, "field of view."); pConsole->Register("cl_bob", &cl_bob, 1.0f, 0, "view/weapon bobbing multiplier"); pConsole->Register("cl_headBob", &cl_headBob, 1.0f, 0, "head bobbing multiplier"); pConsole->Register("cl_headBobLimit", &cl_headBobLimit, 0.06f, 0, "head bobbing distance limit"); pConsole->Register("cl_tpvDist", &cl_tpvDist, 3.5f, 0, "camera distance in 3rd person view"); pConsole->Register("cl_tpvYaw", &cl_tpvYaw, 0, 0, "camera angle offset in 3rd person view"); pConsole->Register("cl_nearPlane", &cl_nearPlane, 0, 0, "overrides the near clipping plane if != 0, just for testing."); pConsole->Register("cl_sprintShake", &cl_sprintShake, 0.0f, 0, "sprint shake"); pConsole->Register("cl_sensitivityZeroG", &cl_sensitivityZeroG, 70.0f, VF_DUMPTODISK, "Set mouse sensitivity in ZeroG!"); pConsole->Register("cl_sensitivity", &cl_sensitivity, 45.0f, VF_DUMPTODISK, "Set mouse sensitivity!"); pConsole->Register("cl_controllersensitivity", &cl_controllersensitivity, 45.0f, VF_DUMPTODISK, "Set controller sensitivity!"); pConsole->Register("cl_invertMouse", &cl_invertMouse, 0, VF_DUMPTODISK, "mouse invert?"); pConsole->Register("cl_invertController", &cl_invertController, 0, VF_DUMPTODISK, "Controller Look Up-Down invert"); pConsole->Register("cl_crouchToggle", &cl_crouchToggle, 0, VF_DUMPTODISK, "To make the crouch key work as a toggle"); pConsole->Register("cl_fpBody", &cl_fpBody, 2, 0, "first person body"); //FIXME:just for testing pConsole->Register("cl_strengthscale", &cl_strengthscale, 1.0f, 0, "nanosuit strength scale"); /* // GOC pConsole->Register("goc_enable", &goc_enable, 0, VF_CHEAT, "gears of crysis"); pConsole->Register("goc_tpcrosshair", &goc_tpcrosshair, 0, VF_CHEAT, "keep crosshair in third person"); pConsole->Register("goc_targetx", &goc_targetx, 0.5f, VF_CHEAT, "target position of camera"); pConsole->Register("goc_targety", &goc_targety, -2.5f, VF_CHEAT, "target position of camera"); pConsole->Register("goc_targetz", &goc_targetz, 0.2f, VF_CHEAT, "target position of camera"); pConsole->AddCommand("GOCMode", CmdGOCMode, VF_CHEAT, "Enable GOC mode"); // BulletTime pConsole->Register("bt_speed", &bt_speed, 0, VF_CHEAT, "bullet-time when in speed mode"); pConsole->Register("bt_ironsight", &bt_ironsight, 0, VF_CHEAT, "bullet-time when in ironsight"); pConsole->Register("bt_end_reload", &bt_end_reload, 0, VF_CHEAT, "end bullet-time when reloading"); pConsole->Register("bt_end_select", &bt_end_select, 0, VF_CHEAT, "end bullet-time when selecting a new weapon"); pConsole->Register("bt_end_melee", &bt_end_melee, 0, VF_CHEAT, "end bullet-time when melee"); pConsole->Register("bt_time_scale", &bt_time_scale, 0.2f, VF_CHEAT, "bullet-time time scale to apply"); pConsole->Register("bt_pitch", &bt_pitch, -0.4f, VF_CHEAT, "sound pitch shift for bullet-time"); pConsole->Register("bt_energy_max", &bt_energy_max, 1.0f, VF_CHEAT, "maximum bullet-time energy"); pConsole->Register("bt_energy_decay", &bt_energy_decay, 2.5f, VF_CHEAT, "bullet time energy decay rate"); pConsole->Register("bt_energy_regen", &bt_energy_regen, 0.5f, VF_CHEAT, "bullet time energy regeneration rate"); pConsole->AddCommand("bulletTimeMode", CmdBulletTimeMode, VF_CHEAT, "Enable bullet time mode"); */ pConsole->Register("dt_enable", &dt_enable, 0, 0, "suit actions activated by double-tapping"); pConsole->Register("dt_time", &dt_time, 0.25f, 0, "time in seconds between double taps"); pConsole->Register("dt_meleeTime", &dt_meleeTime, 0.3f, 0, "time in seconds between double taps for melee"); pConsole->Register("i_staticfiresounds", &i_staticfiresounds, 1, VF_DUMPTODISK, "Enable/Disable static fire sounds. Static sounds are not unloaded when idle."); pConsole->Register("i_soundeffects", &i_soundeffects, 1, VF_DUMPTODISK, "Enable/Disable playing item sound effects."); pConsole->Register("i_lighteffects", &i_lighteffects, 1, VF_DUMPTODISK, "Enable/Disable lights spawned during item effects."); pConsole->Register("i_particleeffects", &i_particleeffects, 1, VF_DUMPTODISK, "Enable/Disable particles spawned during item effects."); pConsole->Register("i_rejecteffects", &i_rejecteffects, 1, VF_DUMPTODISK, "Enable/Disable ammo reject effects during weapon firing."); pConsole->Register("i_offset_front", &i_offset_front, 0.0f, 0, "Item position front offset"); pConsole->Register("i_offset_up", &i_offset_up, 0.0f, 0, "Item position up offset"); pConsole->Register("i_offset_right", &i_offset_right, 0.0f, 0, "Item position right offset"); pConsole->Register("i_unlimitedammo", &i_unlimitedammo, 0, VF_CHEAT, "unlimited ammo"); pConsole->Register("i_iceeffects", &i_iceeffects, 0, VF_CHEAT, "Enable/Disable specific weapon effects for ice environments"); pConsole->Register("i_lighteffectShadows", &i_lighteffectsShadows, 0, VF_DUMPTODISK, "Enable/Disable shadow casting on weapon lights. 1 - Player only, 2 - Other players/AI, 3 - All (require i_lighteffects enabled)."); // marcok TODO: seem to be only used on script side ... pConsole->RegisterFloat("cl_motionBlur", 2, 0, "motion blur type (0=off, 1=accumulation-based, 2=velocity-based)"); pConsole->RegisterFloat("cl_sprintBlur", 0.6f, 0, "sprint blur"); pConsole->RegisterFloat("cl_hitShake", 1.25f, 0, "hit shake"); pConsole->RegisterFloat("cl_hitBlur", 0.25f, 0, "blur on hit"); pConsole->RegisterInt("cl_righthand", 1, 0, "Select right-handed weapon!"); pConsole->RegisterInt("cl_screeneffects", 1, 0, "Enable player screen effects (depth-of-field, motion blur, ...)."); pConsole->Register("cl_debugSwimming", &cl_debugSwimming, 0, VF_CHEAT, "enable swimming debugging"); pConsole->Register("cl_g15lcdEnable", &cl_g15lcdEnable, 1, VF_DUMPTODISK, "enable support for Logitech G15 LCD"); pConsole->Register("cl_g15lcdTick", &cl_g15lcdTick, 250, VF_DUMPTODISK, "milliseconds between lcd updates"); ca_GameControlledStrafingPtr = pConsole->GetCVar("ca_GameControlledStrafing"); pConsole->Register("pl_curvingSlowdownSpeedScale", &pl_curvingSlowdownSpeedScale, 0.5f, VF_CHEAT, "Player only slowdown speedscale when curving/leaning extremely."); pConsole->Register("ac_enableProceduralLeaning", &ac_enableProceduralLeaning, 1.0f, VF_CHEAT, "Enable procedural leaning (disabled asset leaning and curving slowdown)."); pConsole->Register("cl_shallowWaterSpeedMulPlayer", &cl_shallowWaterSpeedMulPlayer, 0.6f, VF_CHEAT, "shallow water speed multiplier (Players only)"); pConsole->Register("cl_shallowWaterSpeedMulAI", &cl_shallowWaterSpeedMulAI, 0.8f, VF_CHEAT, "Shallow water speed multiplier (AI only)"); pConsole->Register("cl_shallowWaterDepthLo", &cl_shallowWaterDepthLo, 0.3f, VF_CHEAT, "Shallow water depth low (below has zero slowdown)"); pConsole->Register("cl_shallowWaterDepthHi", &cl_shallowWaterDepthHi, 1.0f, VF_CHEAT, "Shallow water depth high (above has full slowdown)"); pConsole->RegisterInt("g_grabLog", 0, 0, "verbosity for grab logging (0-2)"); pConsole->Register("pl_inputAccel", &pl_inputAccel, 30.0f, 0, "Movement input acceleration"); pConsole->RegisterInt("cl_actorsafemode", 0, VF_CHEAT, "Enable/disable actor safe mode", BroadcastChangeSafeMode); pConsole->Register("h_useIK", &h_useIK, 1, 0, "Hunter uses always IK"); pConsole->Register("h_drawSlippers", &h_drawSlippers, 0, 0, "Red ball when tentacle is lifted, green when on ground"); pConsole->Register("g_tentacle_joint_limit", &g_tentacle_joint_limit, -1.0f, 0, "forces specific tentacle limits; used for tweaking"); pConsole->Register("g_enableSpeedLean", &g_enableSpeedLean, 0, 0, "Enables player-controlled curve leaning in speed mode."); // pConsole->Register("int_zoomAmount", &int_zoomAmount, 0.75f, VF_CHEAT, "Maximum zoom, between 0.0 and 1.0. Default = .75"); pConsole->Register("int_zoomInTime", &int_zoomInTime, 5.0f, VF_CHEAT, "Number of seconds it takes to zoom in. Default = 5.0"); pConsole->Register("int_moveZoomTime", &int_moveZoomTime, 0.1f, VF_CHEAT, "Number of seconds it takes to zoom out when moving. Default = 0.2"); pConsole->Register("int_zoomOutTime", &int_zoomOutTime, 0.1f, VF_CHEAT, "Number of seconds it takes to zoom out when you stop firing. Default = 0.5"); pConsole->RegisterFloat("aa_maxDist", 10.0f, VF_CHEAT, "max lock distance"); pConsole->Register("hr_rotateFactor", &hr_rotateFactor, -.1f, VF_CHEAT, "rotate factor"); pConsole->Register("hr_rotateTime", &hr_rotateTime, .07f, VF_CHEAT, "rotate time"); pConsole->Register("hr_dotAngle", &hr_dotAngle, .75f, VF_CHEAT, "max angle for FOV change"); pConsole->Register("hr_fovAmt", &hr_fovAmt, .03f, VF_CHEAT, "goal FOV when hit"); pConsole->Register("hr_fovTime", &hr_fovTime, .05f, VF_CHEAT, "fov time"); // frozen shake vars (for tweaking only) pConsole->Register("cl_debugFreezeShake", &cl_debugFreezeShake, 0, VF_CHEAT|VF_DUMPTODISK, "Toggle freeze shake debug draw"); pConsole->Register("cl_frozenSteps", &cl_frozenSteps, 3, VF_CHEAT, "Number of steps for unfreeze shaking"); pConsole->Register("cl_frozenSensMin", &cl_frozenSensMin, 1.0f, VF_CHEAT, "Frozen sensitivity min"); // was 0.2 pConsole->Register("cl_frozenSensMax", &cl_frozenSensMax, 1.0f, VF_CHEAT, "Frozen sensitivity max"); // was 0.4 pConsole->Register("cl_frozenAngleMin", &cl_frozenAngleMin, 1.f, VF_CHEAT, "Frozen clamp angle min"); pConsole->Register("cl_frozenAngleMax", &cl_frozenAngleMax, 10.f, VF_CHEAT, "Frozen clamp angle max"); pConsole->Register("cl_frozenMouseMult", &cl_frozenMouseMult, 0.00015f, VF_CHEAT, "Frozen mouseshake multiplier"); pConsole->Register("cl_frozenKeyMult", &cl_frozenKeyMult, 0.02f, VF_CHEAT, "Frozen movement keys multiplier"); pConsole->Register("cl_frozenSoundDelta", &cl_frozenSoundDelta, 0.004f, VF_CHEAT, "Threshold for unfreeze shake to trigger a crack sound"); pConsole->Register("g_frostDecay", &g_frostDecay, 0.25f, VF_CHEAT, "Frost decay speed when freezing actors"); pConsole->Register("g_stanceTransitionSpeed", &g_stanceTransitionSpeed, 15.0f, VF_CHEAT, "Set speed of camera transition from stance to stance"); pConsole->Register("g_stanceTransitionSpeedSecondary", &g_stanceTransitionSpeedSecondary, 6.0f, VF_CHEAT, "Set speed of camera transition from stance to stance"); pConsole->Register("g_playerHealthValue", &g_playerHealthValue, 200, VF_CHEAT, "Maximum player health."); pConsole->Register("g_walkMultiplier", &g_walkMultiplier, 1, VF_SAVEGAME, "Modify movement speed"); pConsole->Register("g_suitRecoilEnergyCost", &g_suitRecoilEnergyCost, 3.0f, VF_CHEAT, "Subtracted energy when weapon is fired in strength mode."); pConsole->Register("g_suitSpeedMult", &g_suitSpeedMult, 1.85f, 0, "Modify speed mode effect."); pConsole->Register("g_suitSpeedMultMultiplayer", &g_suitSpeedMultMultiplayer, 0.35f, 0, "Modify speed mode effect for Multiplayer."); pConsole->Register("g_suitArmorHealthValue", &g_suitArmorHealthValue, 200.0f, 0, "This defines how much damage is reduced by 100% energy, not considering recharge. The value should be between 1 and <SuitMaxEnergy>."); pConsole->Register("g_suitSpeedEnergyConsumption", &g_suitSpeedEnergyConsumption, 110.0f, 0, "Energy reduction in speed mode per second."); pConsole->Register("g_suitSpeedEnergyConsumptionMultiplayer", &g_suitSpeedEnergyConsumptionMultiplayer, 50.0f, 0, "Energy reduction in speed mode per second in multiplayer."); pConsole->Register("g_suitCloakEnergyDrainAdjuster", &g_suitCloakEnergyDrainAdjuster, 1.0f, 0, "Multiplier for energy reduction in cloak mode."); pConsole->Register("g_mpSpeedRechargeDelay", &g_mpSpeedRechargeDelay, 1, VF_CHEAT, "Toggles delay when sprinting below 20% energy."); pConsole->Register("g_AiSuitEnergyRechargeTime", &g_AiSuitEnergyRechargeTime, 10.0f, VF_CHEAT, "Modify suit energy recharge for AI."); pConsole->Register("g_AiSuitStrengthMeleeMult", &g_AiSuitStrengthMeleeMult, 0.4f, VF_CHEAT, "Modify AI strength mode melee damage relative to player damage."); pConsole->Register("g_AiSuitHealthRegenTime", &g_AiSuitHealthRegenTime, 33.3f, VF_CHEAT, "Modify suit health recharge for AI."); pConsole->Register("g_AiSuitArmorModeHealthRegenTime", &g_AiSuitArmorModeHealthRegenTime, 20.0f, VF_CHEAT, "Modify suit health recharge for AI in armor mode."); pConsole->Register("g_playerSuitEnergyRechargeTime", &g_playerSuitEnergyRechargeTime, 8.0f, VF_CHEAT, "Modify suit energy recharge for Player."); pConsole->Register("g_playerSuitEnergyRechargeTimeArmor", &g_playerSuitEnergyRechargeTimeArmor, 6.0f, VF_CHEAT, "Modify suit energy recharge for Player in singleplayer in armor mode."); pConsole->Register("g_playerSuitEnergyRechargeTimeArmorMoving", &g_playerSuitEnergyRechargeTimeArmorMoving, 7.0f, VF_CHEAT, "Modify suit energy recharge for Player in singleplayer in armor mode while moving."); pConsole->Register("g_playerSuitEnergyRechargeTimeMultiplayer", &g_playerSuitEnergyRechargeTimeMultiplayer, 10.0f, VF_CHEAT, "Modify suit energy recharge for Player in multiplayer."); pConsole->Register("g_playerSuitEnergyRechargeDelay", &g_playerSuitEnergyRechargeDelay, 1.0f, VF_CHEAT, "Delay of energy recharge after the player has been hit."); pConsole->Register("g_playerSuitHealthRegenTime", &g_playerSuitHealthRegenTime, 20.0f, VF_CHEAT, "Modify suit health recharge for Player."); pConsole->Register("g_playerSuitHealthRegenTimeMoving", &g_playerSuitHealthRegenTimeMoving, 27.0f, VF_CHEAT, "Modify suit health recharge for moving Player."); pConsole->Register("g_playerSuitArmorModeHealthRegenTime", &g_playerSuitArmorModeHealthRegenTime, 10.0f, VF_CHEAT, "Modify suit health recharge for Player in armor mode."); pConsole->Register("g_playerSuitArmorModeHealthRegenTimeMoving", &g_playerSuitArmorModeHealthRegenTimeMoving, 15.0f, VF_CHEAT, "Modify suit health recharge for Player moving in armor mode."); pConsole->Register("g_playerSuitHealthRegenDelay", &g_playerSuitHealthRegenDelay, 2.5f, VF_CHEAT, "Delay of health regeneration after the player has been hit."); pConsole->Register("g_difficultyLevel", &g_difficultyLevel, 2, VF_CHEAT|VF_READONLY, "Difficulty level"); pConsole->Register("g_difficultyHintSystem", &g_difficultyHintSystem, 2, VF_CHEAT|VF_READONLY, "Lower difficulty hint system (0 is off, 1 is radius based, 2 is save-game based)"); pConsole->Register("g_difficultyRadius", &g_difficultyRadius, 300, VF_CHEAT|VF_READONLY, "Radius in which player needs to die to display lower difficulty level hint."); pConsole->Register("g_difficultyRadiusThreshold", &g_difficultyRadiusThreshold, 5, VF_CHEAT|VF_READONLY, "Number of times player has to die within radius to trigger difficulty hint."); pConsole->Register("g_difficultySaveThreshold", &g_difficultySaveThreshold, 5, VF_CHEAT|VF_READONLY, "Number of times player has to die with same savegame active to trigger difficulty hint."); pConsole->Register("g_pp_scale_income", &g_pp_scale_income, 1, 0, "Scales incoming PP."); pConsole->Register("g_pp_scale_price", &g_pp_scale_price, 1, 0, "Scales PP prices."); pConsole->Register("g_energy_scale_price", &g_energy_scale_price, 0, 0, "Scales energy prices."); pConsole->Register("g_energy_scale_income", &g_energy_scale_income, 1, 0, "Scales incoming energy."); pConsole->Register("g_enableFriendlyFallAndPlay", &g_enableFriendlyFallAndPlay, 0, 0, "Enables fall&play feedback for friendly actors."); pConsole->Register("g_playerRespawns", &g_playerRespawns, 0, VF_SAVEGAME, "Sets the player lives."); pConsole->Register("g_playerLowHealthThreshold", &g_playerLowHealthThreshold, 40.0f, VF_CHEAT, "The player health threshold when the low health effect kicks in."); pConsole->Register("g_playerLowHealthThreshold2", &g_playerLowHealthThreshold2, 60.0f, VF_CHEAT, "The player health threshold when the low health effect reaches maximum."); pConsole->Register("g_playerLowHealthThresholdMultiplayer", &g_playerLowHealthThresholdMultiplayer, 20.0f, VF_CHEAT, "The player health threshold when the low health effect kicks in."); pConsole->Register("g_playerLowHealthThreshold2Multiplayer", &g_playerLowHealthThreshold2Multiplayer, 30.0f, VF_CHEAT, "The player health threshold when the low health effect reaches maximum."); pConsole->Register("g_punishFriendlyDeaths", &g_punishFriendlyDeaths, 1, VF_CHEAT, "The player gets punished by death when killing a friendly unit."); pConsole->Register("g_enableMPStealthOMeter", &g_enableMPStealthOMeter, 0, VF_CHEAT, "Enables the stealth-o-meter to detect enemies in MP matches."); pConsole->Register("g_meleeWhileSprinting", &g_meleeWhileSprinting, 0, 0, "Enables option to melee while sprinting, using left mouse button."); pConsole->Register("g_fallAndPlayThreshold", &g_fallAndPlayThreshold, 50, VF_CHEAT, "Minimum damage for fall and play."); // Depth of Field control pConsole->Register("g_dofset_minScale", &g_dofset_minScale, 1.0f, VF_CHEAT, "Scale Dof_FocusMin param when it gets set Default = 1"); pConsole->Register("g_dofset_maxScale", &g_dofset_maxScale, 3.0f, VF_CHEAT, "Scale Dof_FocusMax param when it gets set Default = 3"); pConsole->Register("g_dofset_limitScale", &g_dofset_limitScale, 9.0f, VF_CHEAT, "Scale Dof_FocusLimit param when it gets set Default = 9"); pConsole->Register("g_dof_minHitScale", &g_dof_minHitScale, 0.25f, VF_CHEAT, "Scale of ray hit distance which Min tries to approach. Default = 0.25"); pConsole->Register("g_dof_maxHitScale", &g_dof_maxHitScale, 2.0f, VF_CHEAT, "Scale of ray hit distance which Max tries to approach. Default = 2.0f"); pConsole->Register("g_dof_sampleAngle", &g_dof_sampleAngle, 5.0f, VF_CHEAT, "Sample angle in degrees. Default = 5"); pConsole->Register("g_dof_minAdjustSpeed", &g_dof_minAdjustSpeed, 100.0f, VF_CHEAT, "Speed that DoF can adjust the min value with. Default = 100"); pConsole->Register("g_dof_maxAdjustSpeed", &g_dof_maxAdjustSpeed, 200.0f, VF_CHEAT, "Speed that DoF can adjust the max value with. Default = 200"); pConsole->Register("g_dof_averageAdjustSpeed", &g_dof_averageAdjustSpeed, 20.0f, VF_CHEAT, "Speed that the average between min and max can be approached. Default = 20"); pConsole->Register("g_dof_distAppart", &g_dof_distAppart, 10.0f, VF_CHEAT, "Minimum distance that max and min can be apart. Default = 10"); pConsole->Register("g_dof_ironsight", &g_dof_ironsight, 1, VF_CHEAT, "Enable ironsight dof. Default = 1"); // explosion culling pConsole->Register("g_ec_enable", &g_ec_enable, 1, VF_CHEAT, "Enable/Disable explosion culling of small objects. Default = 1"); pConsole->Register("g_ec_radiusScale", &g_ec_radiusScale, 2.0f, VF_CHEAT, "Explosion culling scale to apply to explosion radius for object query."); pConsole->Register("g_ec_volume", &g_ec_volume, 0.75f, VF_CHEAT, "Explosion culling volume which needs to be exceed for objects to not be culled."); pConsole->Register("g_ec_extent", &g_ec_extent, 2.0f, VF_CHEAT, "Explosion culling length of an AABB side which needs to be exceed for objects to not be culled."); pConsole->Register("g_ec_removeThreshold", &g_ec_removeThreshold, 20, VF_CHEAT, "At how many items in exploding area will it start removing items."); pConsole->Register("g_radialBlur", &g_radialBlur, 1.0f, VF_CHEAT, "Radial blur on explosions. Default = 1, 0 to disable"); pConsole->Register("g_playerFallAndPlay", &g_playerFallAndPlay, 0, 0, "When enabled, the player doesn't die from direct damage, but goes to fall and play."); pConsole->Register("g_enableTracers", &g_enableTracers, 1, 0, "Enable/Disable tracers."); pConsole->Register("g_enableAlternateIronSight", &g_enableAlternateIronSight, 0, 0, "Enable/Disable alternate ironsight mode"); pConsole->Register("g_ragdollMinTime", &g_ragdollMinTime, 10.0f, 0, "minimum time in seconds that a ragdoll will be visible"); pConsole->Register("g_ragdollUnseenTime", &g_ragdollUnseenTime, 2.0f, 0, "time in seconds that the player has to look away from the ragdoll before it disappears"); pConsole->Register("g_ragdollPollTime", &g_ragdollPollTime, 0.5f, 0, "time in seconds where 'unseen' polling is done"); pConsole->Register("g_ragdollDistance", &g_ragdollDistance, 10.0f, 0, "distance in meters that the player has to be away from the ragdoll before it can disappear"); pConsole->Register("g_debugaimlook", &g_debugaimlook, 0, VF_CHEAT, "Debug aim/look direction"); pConsole->Register("g_enableIdleCheck", &g_enableIdleCheck, 1, 0); // Crysis supported gamemode CVars pConsole->Register("g_timelimit", &g_timelimit, 60.0f, 0, "Duration of a time-limited game (in minutes). Default is 0, 0 means no time-limit."); pConsole->Register("g_roundtime", &g_roundtime, 2.0f, 0, "Duration of a round (in minutes). Default is 0, 0 means no time-limit."); pConsole->Register("g_preroundtime", &g_preroundtime, 8, 0, "Frozen time before round starts. Default is 8, 0 Disables freeze time."); pConsole->Register("g_suddendeathtime", &g_suddendeathtime, 30, 0, "Number of seconds before round end to start sudden death. Default if 30. 0 Disables sudden death."); pConsole->Register("g_roundlimit", &g_roundlimit, 30, 0, "Maximum numbers of rounds to be played. Default is 0, 0 means no limit."); pConsole->Register("g_fraglimit", &g_fraglimit, 0, 0, "Number of frags before a round restarts. Default is 0, 0 means no frag-limit."); pConsole->Register("g_fraglead", &g_fraglead, 1, 0, "Number of frags a player has to be ahead of other players once g_fraglimit is reached. Default is 1."); pConsole->Register("g_scorelimit", &g_scorelimit, 300, 0, "Score before a round restarts. Default is 300, 0 means no score-limit."); pConsole->Register("g_scorelead", &g_scorelead, 1, 0, "Score a team has to be ahead of other team once g_scorelimit is reached. Default is 1."); pConsole->Register("g_spawnteamdist", &g_spawnteamdist, 20, 0, "TIA; tend to choose spawnpoints with max teammates withing the dist."); pConsole->Register("g_spawnenemydist", &g_spawnenemydist, 15, 0, "TIA; reject spawn-points closer than this to enemy."); pConsole->Register("g_spawndeathdist", &g_spawndeathdist, 20, 0, "TIA; reject spawn-points closer than this to death position."); pConsole->Register("g_spawndebug", &g_spawnDebug, 0, VF_CHEAT, "enables debugging spawn for TIA"); pConsole->Register("g_friendlyfireratio", &g_friendlyfireratio, 0.5f, 0, "Sets friendly damage ratio."); pConsole->Register("g_friendlyVehicleCollisionRatio", &g_friendlyVehicleCollisionRatio, 0.5f, 0, "Sets ratio of damage applied by friendly vehicles"); pConsole->Register("g_revivetime", &g_revivetime, 15, 0, "Revive wave timer."); pConsole->Register("g_autoteambalance", &g_autoteambalance, 1, 0, "Enables auto team balance."); pConsole->Register("g_autoteambalance_threshold", &g_autoteambalance_threshold, 3, 0, "Sets the auto team balance player threshold."); pConsole->Register("g_minplayerlimit", &g_minplayerlimit, 2, 0, "Minimum number of players to start a match."); pConsole->Register("g_minteamlimit", &g_minteamlimit, 1, 0, "Minimum number of players in each team to start a match."); pConsole->Register("g_tk_punish", &g_tk_punish, 1, 0, "Turns on punishment for team kills"); pConsole->Register("g_tk_punish_limit", &g_tk_punish_limit, 5, 0, "Number of team kills user will be banned for"); pConsole->Register("g_teamlock", &g_teamlock, 2, 0, "Number of players one team needs to have over the other, for the game to deny joining it. 0 disables."); pConsole->Register("g_useHitSoundFeedback", &g_useHitSoundFeedback, 1, 0, "Switches hit readability feedback sounds on/off."); pConsole->Register("g_debugNetPlayerInput", &g_debugNetPlayerInput, 0, VF_CHEAT, "Show some debug for player input"); pConsole->Register("g_debug_fscommand", &g_debug_fscommand, 0, 0, "Print incoming fscommands to console"); pConsole->Register("g_debugDirectMPMenu", &g_debugDirectMPMenu, 0, 0, "Jump directly to MP menu on application start."); pConsole->Register("g_skipIntro", &g_skipIntro, 0, VF_CHEAT, "Skip all the intro videos."); pConsole->Register("g_resetActionmapOnStart", &g_resetActionmapOnStart, 0, 0, "Resets Keyboard mapping on application start."); pConsole->Register("g_useProfile", &g_useProfile, 1, 0, "Don't save anything to or load anything from profile."); pConsole->Register("g_startFirstTime", &g_startFirstTime, 1, VF_DUMPTODISK, "1 before the game was started first time ever."); pConsole->Register("g_cutsceneSkipDelay", &g_cutsceneSkipDelay, 0.0f, 0, "Skip Delay for Cutscenes."); pConsole->Register("g_enableAutoSave", &g_enableAutoSave, 1, 0, "Switches all savegames created by Flowgraph (checkpoints). Does not affect user generated saves or levelstart savegames."); // pConsole->Register("g_godMode", &g_godMode, 0, VF_CHEAT, "God Mode"); pConsole->Register("g_detachCamera", &g_detachCamera, 0, VF_CHEAT, "Detach camera"); pConsole->Register("g_suicideDelay", &g_suicideDelay, 2, VF_CHEAT, "delay in sec before executing kill command"); pConsole->Register("g_debugCollisionDamage", &g_debugCollisionDamage, 0, VF_DUMPTODISK, "Log collision damage"); pConsole->Register("g_debugHits", &g_debugHits, 0, VF_DUMPTODISK, "Log hits"); pConsole->Register("g_trooperProneMinDistance", &g_trooperProneMinDistance, 10, VF_DUMPTODISK, "Distance to move for trooper to switch to prone stance"); // pConsole->Register("g_trooperMaxPhysicsAnimBlend", &g_trooperMaxPhysicAnimBlend, 0, VF_DUMPTODISK, "Max value for trooper tentacle dynamic physics/anim blending"); // pConsole->Register("g_trooperPhysicsAnimBlendSpeed", &g_trooperPhysicAnimBlendSpeed, 100.f, VF_DUMPTODISK, "Trooper tentacle dynamic physics/anim blending speed"); pConsole->Register("g_trooperTentacleAnimBlend", &g_trooperTentacleAnimBlend, 0, VF_DUMPTODISK, "Trooper tentacle physic_anim blend (0..1) - overrides the physic_blend AG parameter when it's not 0"); pConsole->Register("g_trooperBankingMultiplier", &g_trooperBankingMultiplier, 1, VF_DUMPTODISK, "Trooper banking multiplier coeff (0..x)"); pConsole->Register("g_alienPhysicsAnimRatio", &g_alienPhysicsAnimRatio, 0.0f, VF_CHEAT ); pConsole->Register("g_spRecordGameplay", &g_spRecordGameplay, 0, 0, "Write sp gameplay information to harddrive."); pConsole->Register("g_spGameplayRecorderUpdateRate", &g_spGameplayRecorderUpdateRate, 1.0f, 0, "Update-delta of gameplay recorder in seconds."); pConsole->Register("pl_debug_ladders", &pl_debug_ladders, 0, VF_CHEAT); pConsole->Register("pl_debug_movement", &pl_debug_movement, 0, VF_CHEAT); pConsole->Register("pl_debug_jumping", &pl_debug_jumping, 0, VF_CHEAT); pl_debug_filter = pConsole->RegisterString("pl_debug_filter","",VF_CHEAT); pConsole->Register("aln_debug_movement", &aln_debug_movement, 0, VF_CHEAT); aln_debug_filter = pConsole->RegisterString("aln_debug_filter","",VF_CHEAT); // emp grenade pConsole->Register("g_emp_style", &g_empStyle, 0, VF_CHEAT, ""); pConsole->Register("g_emp_nanosuit_downtime", &g_empNanosuitDowntime, 10.0f, VF_CHEAT, "Time that the nanosuit is deactivated after leaving the EMP field."); // hud cvars pConsole->Register("hud_mpNamesDuration", &hud_mpNamesDuration, 2, 0, "MP names will fade after this duration."); pConsole->Register("hud_mpNamesNearDistance", &hud_mpNamesNearDistance, 1, 0, "MP names will be fully visible when nearer than this."); pConsole->Register("hud_mpNamesFarDistance", &hud_mpNamesFarDistance, 100, 0, "MP names will be fully invisible when farther than this."); pConsole->Register("hud_onScreenNearDistance", &hud_onScreenNearDistance, 10, 0, "On screen icons won't scale anymore, when nearer than this."); pConsole->Register("hud_onScreenFarDistance", &hud_onScreenFarDistance, 500, 0, "On screen icons won't scale anymore, when farther than this."); pConsole->Register("hud_onScreenNearSize", &hud_onScreenNearSize, 1.4f, 0, "On screen icon size when nearest."); pConsole->Register("hud_onScreenFarSize", &hud_onScreenFarSize, 0.7f, 0, "On screen icon size when farthest."); pConsole->Register("hud_colorLine", &hud_colorLine, 4481854, 0, "HUD line color."); pConsole->Register("hud_colorOver", &hud_colorOver, 14125840, 0, "HUD hovered color."); pConsole->Register("hud_colorText", &hud_colorText, 12386209, 0, "HUD text color."); pConsole->Register("hud_voicemode", &hud_voicemode, 1, 0, "Usage of the voice when switching of Nanosuit mode."); pConsole->Register("hud_enableAlienInterference", &hud_enableAlienInterference, 1, VF_SAVEGAME, "Switched the alien interference effect."); pConsole->Register("hud_alienInterferenceStrength", &hud_alienInterferenceStrength, 0.8f, VF_SAVEGAME, "Scales alien interference effect strength."); pConsole->Register("hud_godFadeTime", &hud_godFadeTime, 3, VF_CHEAT, "sets the fade time of the god mode message"); pConsole->Register("hud_crosshair_enable", &hud_crosshair_enable, 1,0, "Toggles singleplayer crosshair visibility.", CHUD::OnCrosshairCVarChanged); pConsole->Register("hud_crosshair", &hud_crosshair, 1,0, "Select the crosshair (1-8)", CHUD::OnCrosshairCVarChanged); pConsole->Register("hud_alternateCrosshairSpread",&hud_iAlternateCrosshairSpread,0, 0, "Switch new crosshair spread code on/off."); pConsole->Register("hud_alternateCrosshairSpreadCrouch",&hud_fAlternateCrosshairSpreadCrouch,12.0f, VF_CHEAT); pConsole->Register("hud_alternateCrosshairSpreadNeutral",&hud_fAlternateCrosshairSpreadNeutral,6.0f, VF_CHEAT); pConsole->Register("hud_chDamageIndicator", &hud_chDamageIndicator, 1,0,"Switch crosshair-damage indicator... (1 on, 0 off)"); pConsole->Register("hud_showAllObjectives", &hud_showAllObjectives, 0, 0, "Show all on screen objectives, not only the active one."); pConsole->Register("hud_showObjectiveMessages", &hud_showObjectiveMessages, 0, 0, "Show objective messages for Powerstruggle player."); pConsole->Register("hud_panoramicHeight", &hud_panoramicHeight, 10,0,"Set screen border for 'cinematic view' in percent.", CHUD::OnSubtitlePanoramicHeightCVarChanged); pConsole->Register("hud_subtitles", &hud_subtitles, 0,0,"Subtitle mode. 0==Off, 1=All, 2=CutscenesOnly", CHUD::OnSubtitleCVarChanged); pConsole->Register("hud_subtitlesDebug", &hud_subtitlesDebug, 0,0,"Debug subtitles"); pConsole->Register("hud_subtitlesRenderMode", &hud_subtitlesRenderMode, 0,0,"Subtitle RenderMode. 0==Flash, 1=3DEngine"); pConsole->Register("hud_subtitlesFontSize", &hud_subtitlesFontSize, 16, 0, "FontSize for Subtitles."); pConsole->Register("hud_subtitlesHeight", &hud_subtitlesHeight, 10, 0,"Height of Subtitles in Percent. Normally same as hud_PanoramicHeight"); pConsole->Register("hud_subtitlesShowCharName", &hud_subtitlesShowCharName, 1, 0,"Show Character talking along with Subtitle"); pConsole->Register("hud_subtitlesQueueCount", &hud_subtitlesQueueCount, 1, 0,"Maximum amount of subtitles in Update Queue"); pConsole->Register("hud_subtitlesVisibleCount", &hud_subtitlesVisibleCount, 1, 0,"Maximum amount of subtitles in Visible Queue"); pConsole->Register("hud_attachBoughEquipment", &hud_attachBoughtEquipment, 0,VF_CHEAT,"Attach equipment in PS equipment packs to the last bought/selected weapon."); pConsole->Register("hud_radarBackground", &hud_radarBackground, 1, 0, "Switches the miniMap-background for the radar."); pConsole->Register("hud_radarJammingEffectScale", &hud_radarJammingEffectScale, 0.75f, 0, "Scales the intensity of the radar jamming effect."); pConsole->Register("hud_radarJammingThreshold", &hud_radarJammingThreshold, 0.99f, 0, "Threshold to disable the radar (independent from effect)."); pConsole->Register("hud_startPaused", &hud_startPaused, 1, 0, "The game starts paused, waiting for user input."); pConsole->Register("hud_faderDebug", &hud_faderDebug, 0, 0, "Show Debug Information for FullScreen Faders."); pConsole->Register("hud_nightVisionConsumption", &hud_nightVisionConsumption, 0.5f, VF_CHEAT, "Scales the energy consumption of the night vision."); pConsole->Register("hud_nightVisionRecharge", &hud_nightVisionRecharge, 2.0f, VF_CHEAT, "Scales the energy recharge of the night vision."); pConsole->Register("hud_showBigVehicleReload", &hud_showBigVehicleReload, 0, 0, "Enables an additional reload bar around the crosshair in big vehicles."); pConsole->Register("hud_radarScanningDelay", &hud_binocsScanningDelay, 0.55f, VF_CHEAT, "Defines the delay in seconds the binoculars take to scan an object."); pConsole->Register("hud_binocsScanningWidth", &hud_binocsScanningWidth, 0.3f, VF_CHEAT, "Defines the width/height in which the binocular raycasts are offset from the center to scan objects."); pConsole->Register("hud_creategame_pb_server", &hud_creategame_pb_server, 0, 0, "Contains the value of the Punkbuster checkbox in the create game screen."); // Controller aim helper cvars pConsole->Register("aim_assistSearchBox", &aim_assistSearchBox, 100.0f, 0, "The area autoaim looks for enemies within"); pConsole->Register("aim_assistMaxDistance", &aim_assistMaxDistance, 150.0f, 0, "The maximum range at which autoaim operates"); pConsole->Register("aim_assistSnapDistance", &aim_assistSnapDistance, 3.0f, 0, "The maximum deviation autoaim is willing to compensate for"); pConsole->Register("aim_assistVerticalScale", &aim_assistVerticalScale, 0.75f, 0, "The amount of emphasis on vertical correction (the less the number is the more vertical component is compensated)"); pConsole->Register("aim_assistSingleCoeff", &aim_assistSingleCoeff, 1.0f, 0, "The scale of single-shot weapons' aim assistance"); pConsole->Register("aim_assistAutoCoeff", &aim_assistAutoCoeff, 0.5f, 0, "The scale of auto weapons' aim assistance at continuous fire"); pConsole->Register("aim_assistRestrictionTimeout", &aim_assistRestrictionTimeout, 20.0f, 0, "The restriction timeout on aim assistance after user uses a mouse"); // Controller control pConsole->Register("hud_aspectCorrection", &hud_aspectCorrection, 2, 0, "Aspect ratio corrections for controller rotation: 0-off, 1-direct, 2-inverse"); pConsole->Register("hud_ctrl_Curve_X", &hud_ctrl_Curve_X, 3.0f, 0, "Analog controller X rotation curve"); pConsole->Register("hud_ctrl_Curve_Z", &hud_ctrl_Curve_Z, 3.0f, 0, "Analog controller Z rotation curve"); pConsole->Register("hud_ctrl_Coeff_X", &hud_ctrl_Coeff_X, 3.5f*3.5f, 0, "Analog controller X rotation scale"); // was 3.5*3.5 but aspect ratio correction does the scaling now! adjust only if that gives no satisfactory results pConsole->Register("hud_ctrl_Coeff_Z", &hud_ctrl_Coeff_Z, 5.0f*5.0f, 0, "Analog controller Z rotation scale"); pConsole->Register("hud_ctrlZoomMode", &hud_ctrlZoomMode, 0, 0, "Weapon aiming mode with controller. 0 is same as mouse zoom, 1 cancels at release"); pConsole->Register("g_combatFadeTime", &g_combatFadeTime, 17.0f, 0, "sets the battle fade time in seconds "); pConsole->Register("g_combatFadeTimeDelay", &g_combatFadeTimeDelay, 7.0f, 0, "waiting time before the battle starts fading out, in seconds "); pConsole->Register("g_battleRange", &g_battleRange, 50.0f, 0, "sets the battle range in meters "); // Assistance switches pConsole->Register("aim_assistAimEnabled", &aim_assistAimEnabled, 1, 0, "Enable/disable aim assitance on aim zooming"); pConsole->Register("aim_assistTriggerEnabled", &aim_assistTriggerEnabled, 1, 0, "Enable/disable aim assistance on firing the weapon"); pConsole->Register("hit_assistSingleplayerEnabled", &hit_assistSingleplayerEnabled, 1, 0, "Enable/disable minimum damage hit assistance"); pConsole->Register("hit_assistMultiplayerEnabled", &hit_assistMultiplayerEnabled, 1, 0, "Enable/disable minimum damage hit assistance in multiplayer games"); //movement cvars pConsole->Register("v_profileMovement", &v_profileMovement, 0, 0, "Used to enable profiling of the current vehicle movement (1 to enable)"); pConsole->Register("v_pa_surface", &v_pa_surface, 1, VF_CHEAT, "Enables/disables vehicle surface particles"); pConsole->Register("v_wind_minspeed", &v_wind_minspeed, 0.f, VF_CHEAT, "If non-zero, vehicle wind areas always set wind >= specified value"); pConsole->Register("v_draw_suspension", &v_draw_suspension, 0, VF_DUMPTODISK, "Enables/disables display of wheel suspension, for the vehicle that has v_profileMovement enabled"); pConsole->Register("v_draw_slip", &v_draw_slip, 0, VF_DUMPTODISK, "Draw wheel slip status"); pConsole->Register("v_invertPitchControl", &v_invertPitchControl, 0, VF_DUMPTODISK, "Invert the pitch control for driving some vehicles, including the helicopter and the vtol"); pConsole->Register("v_sprintSpeed", &v_sprintSpeed, 0.f, 0, "Set speed for acceleration measuring"); pConsole->Register("v_rockBoats", &v_rockBoats, 1, 0, "Enable/disable boats idle rocking"); pConsole->Register("v_dumpFriction", &v_dumpFriction, 0, 0, "Dump vehicle friction status"); pConsole->Register("v_debugSounds", &v_debugSounds, 0, 0, "Enable/disable vehicle sound debug drawing"); pConsole->Register("v_debugMountedWeapon", &v_debugMountedWeapon, 0, 0, "Enable/disable vehicle mounted weapon camera debug draw"); pConsole->Register("v_newBrakingFriction", &v_newBrakingFriction, 1, VF_CHEAT, "Change rear wheel friction under handbraking (true/false)"); pConsole->Register("v_newBoost", &v_newBoost, 0, VF_CHEAT, "Apply new boost scheme (true/false)"); pAltitudeLimitCVar = pConsole->Register("v_altitudeLimit", &v_altitudeLimit, v_altitudeLimitDefault(), VF_CHEAT, "Used to restrict the helicopter and VTOL movement from going higher than a set altitude. If set to zero, the altitude limit is disabled."); pAltitudeLimitLowerOffsetCVar = pConsole->Register("v_altitudeLimitLowerOffset", &v_altitudeLimitLowerOffset, 0.1f, VF_CHEAT, "Used in conjunction with v_altitudeLimit to set the zone when gaining altitude start to be more difficult."); pConsole->Register("v_help_tank_steering", &v_help_tank_steering, 0, 0, "Enable tank steering help for AI"); pConsole->Register("v_stabilizeVTOL", &v_stabilizeVTOL, 0.35f, VF_DUMPTODISK, "Specifies if the air movements should automatically stabilize"); pConsole->Register("pl_swimBaseSpeed", &pl_swimBaseSpeed, 4.0f, VF_CHEAT, "Swimming base speed."); pConsole->Register("pl_swimBackSpeedMul", &pl_swimBackSpeedMul, 0.8f, VF_CHEAT, "Swimming backwards speed mul."); pConsole->Register("pl_swimSideSpeedMul", &pl_swimSideSpeedMul, 0.9f, VF_CHEAT, "Swimming sideways speed mul."); pConsole->Register("pl_swimVertSpeedMul", &pl_swimVertSpeedMul, 0.5f, VF_CHEAT, "Swimming vertical speed mul."); pConsole->Register("pl_swimNormalSprintSpeedMul", &pl_swimNormalSprintSpeedMul, 1.5f, VF_CHEAT, "Swimming Non-Speed sprint speed mul."); pConsole->Register("pl_swimSpeedSprintSpeedMul", &pl_swimSpeedSprintSpeedMul, 2.5f, VF_CHEAT, "Swimming Speed sprint speed mul."); pConsole->Register("pl_swimUpSprintSpeedMul", &pl_swimUpSprintSpeedMul, 2.0f, VF_CHEAT, "Swimming sprint while looking up (dolphin rocket)."); pConsole->Register("pl_swimJumpStrengthCost", &pl_swimJumpStrengthCost, 50.0f, VF_CHEAT, "Swimming strength shift+jump energy cost (dolphin rocket)."); pConsole->Register("pl_swimJumpStrengthSprintMul", &pl_swimJumpStrengthSprintMul, 2.5f, VF_CHEAT, "Swimming strength shift+jump velocity mul (dolphin rocket)."); pConsole->Register("pl_swimJumpStrengthBaseMul", &pl_swimJumpStrengthBaseMul, 1.0f, VF_CHEAT, "Swimming strength normal jump velocity mul (dolphin rocket)."); pConsole->Register("pl_swimJumpSpeedCost", &pl_swimJumpSpeedCost, 50.0f, VF_CHEAT, "Swimming speed shift+jump energy cost (dolphin rocket)."); pConsole->Register("pl_swimJumpSpeedSprintMul", &pl_swimJumpSpeedSprintMul, 2.5f, VF_CHEAT, "Swimming speed shift+jump velocity mul (dolphin rocket)."); pConsole->Register("pl_swimJumpSpeedBaseMul", &pl_swimJumpSpeedBaseMul, 1.0f, VF_CHEAT, "Swimming speed normal jump velocity mul (dolphin rocket)."); pConsole->Register("pl_fallDamage_SpeedSafe", &pl_fallDamage_Normal_SpeedSafe, 8.0f, VF_CHEAT, "Safe fall speed (in all modes, including strength jump on flat ground)."); pConsole->Register("pl_fallDamage_SpeedFatal", &pl_fallDamage_Normal_SpeedFatal, 13.7f, VF_CHEAT, "Fatal fall speed in armor mode (13.5 m/s after falling freely for ca 20m)."); pConsole->Register("pl_fallDamage_SpeedBias", &pl_fallDamage_SpeedBias, 1.5f, VF_CHEAT, "Damage bias for medium fall speed: =1 linear, <1 more damage, >1 less damage."); pConsole->Register("pl_debugFallDamage", &pl_debugFallDamage, 0, VF_CHEAT, "Enables console output of fall damage information."); pConsole->Register("pl_zeroGSpeedMultNormal", &pl_zeroGSpeedMultNormal, 1.2f, VF_CHEAT, "Modify movement speed in zeroG, in normal mode."); pConsole->Register("pl_zeroGSpeedMultNormalSprint", &pl_zeroGSpeedMultNormalSprint, 1.7f, VF_CHEAT, "Modify movement speed in zeroG, in normal sprint."); pConsole->Register("pl_zeroGSpeedMultSpeed", &pl_zeroGSpeedMultSpeed, 1.7f, VF_CHEAT, "Modify movement speed in zeroG, in speed mode."); pConsole->Register("pl_zeroGSpeedMultSpeedSprint", &pl_zeroGSpeedMultSpeedSprint, 5.0f, VF_CHEAT, "Modify movement speed in zeroG, in speed sprint."); pConsole->Register("pl_zeroGUpDown", &pl_zeroGUpDown, 1.0f, 0, "Scales the z-axis movement speed in zeroG."); pConsole->Register("pl_zeroGBaseSpeed", &pl_zeroGBaseSpeed, 3.0f, 0, "Maximum player speed request limit for zeroG."); pConsole->Register("pl_zeroGSpeedMaxSpeed", &pl_zeroGSpeedMaxSpeed, -1.0f, 0, "(DEPRECATED) Maximum player speed request limit for zeroG while in speed mode."); pConsole->Register("pl_zeroGSpeedModeEnergyConsumption", &pl_zeroGSpeedModeEnergyConsumption, 0.5f, 0, "Percentage consumed per second while speed sprinting in ZeroG."); pConsole->Register("pl_zeroGDashEnergyConsumption", &pl_zeroGDashEnergyConsumption, 0.25f, 0, "Percentage consumed when doing a dash in ZeroG."); pConsole->Register("pl_zeroGSwitchableGyro", &pl_zeroGSwitchableGyro, 0, 0, "MERGE/REVERT"); pConsole->Register("pl_zeroGEnableGBoots", &pl_zeroGEnableGBoots, 0, 0, "Switch G-Boots action on/off (if button assigned)."); pConsole->Register("pl_zeroGThrusterResponsiveness", &pl_zeroGThrusterResponsiveness, 0.3f, VF_CHEAT, "Thrusting responsiveness."); pConsole->Register("pl_zeroGFloatDuration", &pl_zeroGFloatDuration, 1.25f, VF_CHEAT, "Floating duration until full stop (after stopped thrusting)."); pConsole->Register("pl_zeroGParticleTrail", &pl_zeroGParticleTrail, 0, 0, "Enable particle trail when in zerog."); pConsole->Register("pl_zeroGEnableGyroFade", &pl_zeroGEnableGyroFade, 2, VF_CHEAT, "Enable fadeout of gyro-stabilizer for vertical view angles (2=disable speed fade as well)."); pConsole->Register("pl_zeroGGyroFadeAngleInner", &pl_zeroGGyroFadeAngleInner, 20.0f, VF_CHEAT, "ZeroG gyro inner angle (default is 20)."); pConsole->Register("pl_zeroGGyroFadeAngleOuter", &pl_zeroGGyroFadeAngleOuter, 60.0f, VF_CHEAT, "ZeroG gyro outer angle (default is 60)."); pConsole->Register("pl_zeroGGyroFadeExp", &pl_zeroGGyroFadeExp, 2.0f, VF_CHEAT, "ZeroG gyro angle bias (default is 2.0)."); pConsole->Register("pl_zeroGGyroStrength", &pl_zeroGGyroStrength, 1.0f, VF_CHEAT, "ZeroG gyro strength (default is 1.0)."); pConsole->Register("pl_zeroGAimResponsiveness", &pl_zeroGAimResponsiveness, 8.0f, VF_CHEAT, "ZeroG aim responsiveness vs. inertia (default is 8.0)."); // weapon system i_debuggun_1 = pConsole->RegisterString("i_debuggun_1", "ai_statsTarget", VF_DUMPTODISK, "Command to execute on primary DebugGun fire"); i_debuggun_2 = pConsole->RegisterString("i_debuggun_2", "ag_debug", VF_DUMPTODISK, "Command to execute on secondary DebugGun fire"); pConsole->Register("tracer_min_distance", &tracer_min_distance, 4.0f, 0, "Distance at which to start scaling/lengthening tracers."); pConsole->Register("tracer_max_distance", &tracer_max_distance, 50.0f, 0, "Distance at which to stop scaling/lengthening tracers."); pConsole->Register("tracer_min_scale", &tracer_min_scale, 0.5f, 0, "Scale at min distance."); pConsole->Register("tracer_max_scale", &tracer_max_scale, 5.0f, 0, "Scale at max distance."); pConsole->Register("tracer_max_count", &tracer_max_count, 32, 0, "Max number of active tracers."); pConsole->Register("tracer_player_radiusSqr", &tracer_player_radiusSqr, 400.0f, 0, "Sqr Distance around player at which to start decelerate/acelerate tracer speed."); pConsole->Register("i_debug_projectiles", &i_debug_projectiles, 0, VF_CHEAT, "Displays info about projectile status, where available."); pConsole->Register("i_auto_turret_target", &i_auto_turret_target, 1, VF_CHEAT, "Enables/Disables auto turrets aquiring targets."); pConsole->Register("i_auto_turret_target_tacshells", &i_auto_turret_target_tacshells, 0, 0, "Enables/Disables auto turrets aquiring TAC shells as targets"); pConsole->Register("i_debug_zoom_mods", &i_debug_zoom_mods, 0, VF_CHEAT, "Use zoom mode spread/recoil mods"); pConsole->Register("i_debug_sounds", &i_debug_sounds, 0, VF_CHEAT, "Enable item sound debugging"); pConsole->Register("i_debug_turrets", &i_debug_turrets, 0, VF_CHEAT, "Enable GunTurret debugging.\n" "Values:\n" "0: off" "1: basics\n" "2: prediction\n" "3: sweeping\n" "4: searching\n" "5: deviation\n" ); pConsole->Register("i_debug_mp_flowgraph", &i_debug_mp_flowgraph, 0, VF_CHEAT, "Displays info on the MP flowgraph node"); pConsole->Register("h_turnSpeed", &h_turnSpeed, 1.3f, 0); // quick game g_quickGame_map = pConsole->RegisterString("g_quickGame_map","",VF_DUMPTODISK, "QuickGame option"); g_quickGame_mode = pConsole->RegisterString("g_quickGame_mode","PowerStruggle", VF_DUMPTODISK, "QuickGame option"); pConsole->Register("g_quickGame_min_players",&g_quickGame_min_players,0,VF_DUMPTODISK,"QuickGame option"); pConsole->Register("g_quickGame_prefer_lan",&g_quickGame_prefer_lan,0,VF_DUMPTODISK,"QuickGame option"); pConsole->Register("g_quickGame_prefer_favorites",&g_quickGame_prefer_favorites,0,VF_DUMPTODISK,"QuickGame option"); pConsole->Register("g_quickGame_prefer_mycountry",&g_quickGame_prefer_my_country,0,VF_DUMPTODISK,"QuickGame option"); pConsole->Register("g_quickGame_ping1_level",&g_quickGame_ping1_level,80,VF_DUMPTODISK,"QuickGame option"); pConsole->Register("g_quickGame_ping2_level",&g_quickGame_ping2_level,170,VF_DUMPTODISK,"QuickGame option"); pConsole->Register("g_quickGame_debug",&g_quickGame_debug,0,VF_CHEAT,"QuickGame option"); pConsole->Register("g_displayIgnoreList",&g_displayIgnoreList,1,VF_DUMPTODISK,"Display ignore list in chat tab."); pConsole->Register("g_buddyMessagesIngame",&g_buddyMessagesIngame,1,VF_DUMPTODISK,"Output incoming buddy messages in chat while playing game."); pConsole->RegisterInt("g_showIdleStats", 0, 0); // battledust pConsole->Register("g_battleDust_enable", &g_battleDust_enable, 1, 0, "Enable/Disable battledust"); pConsole->Register("g_battleDust_debug", &g_battleDust_debug, 0, 0, "0: off, 1: text, 2: text+gfx"); g_battleDust_effect = pConsole->RegisterString("g_battleDust_effect", "misc.battledust.light", 0, "Sets the effect to use for battledust"); pConsole->Register("g_PSTutorial_Enabled", &g_PSTutorial_Enabled, 1, 0, "Enable/disable powerstruggle tutorial"); pConsole->Register("g_proneNotUsableWeapon_FixType", &g_proneNotUsableWeapon_FixType, 1, 0, "Test various fixes for not selecting hurricane while prone"); pConsole->Register("g_proneAimAngleRestrict_Enable", &g_proneAimAngleRestrict_Enable, 1, 0, "Test fix for matching aim restrictions between 1st and 3rd person"); pConsole->Register("sv_voting_timeout", &sv_votingTimeout, 60, 0, "Voting timeout"); pConsole->Register("sv_voting_cooldown", &sv_votingCooldown, 180, 0, "Voting cooldown"); pConsole->Register("sv_voting_ratio",&sv_votingRatio, 0.51f, 0, "Part of player's votes needed for successful vote."); pConsole->Register("sv_voting_team_ratio",&sv_votingTeamRatio, 0.67f, 0, "Part of team member's votes needed for successful vote."); pConsole->Register("sv_input_timeout",&sv_input_timeout, 0, 0, "Experimental timeout in ms to stop interpolating client inputs since last update."); pConsole->Register("g_spectate_TeamOnly", &g_spectate_TeamOnly, 1, 0, "If true, you can only spectate players on your team"); pConsole->Register("g_spectate_FixedOrientation", &g_spectate_FixedOrientation, 0, 0, "If true, spectator camera is fixed behind player. Otherwise spectator controls orientation"); pConsole->Register("g_claymore_limit", &g_explosiveLimits[eET_Claymore], 2, 0, "Max claymores a player can place (recycled above this value)"); pConsole->Register("g_avmine_limit", &g_explosiveLimits[eET_AVMine], 3, 0, "Max avmines a player can place (recycled above this value)"); pConsole->Register("g_c4_limit", &g_explosiveLimits[eET_C4], 1, 0, "Max C4 a player can place (recycled above this value)"); pConsole->Register("g_fgl_limit", &g_explosiveLimits[eET_LaunchedGrenade], 2, 0, "Max FGL remote grenades a player can launch (recycled above this value)"); pConsole->Register("g_debugMines", &g_debugMines, 0, 0, "Enable debug output for mines and claymores"); pConsole->Register("aim_assistCrosshairSize", &aim_assistCrosshairSize, 25, VF_CHEAT, "screen size used for crosshair aim assistance"); pConsole->Register("aim_assistCrosshairDebug", &aim_assistCrosshairDebug, 0, VF_CHEAT, "debug crosshair aim assistance"); pConsole->Register("g_MPDeathCam", &g_deathCam, 1, 0, "Enables / disables the MP death camera (shows the killer's location)"); pConsole->Register("g_MPDeathCamMaxZoomFOV", &g_deathCamMaxZoomFOV, 0.1f, 0, "FOV at maximum zoom of the death camera"); pConsole->Register("g_MPDeathCamMinZoom", &g_deathCamMinZoomDistance, 2, 0, "Distance at which the death camera begins to zoom on the killer"); pConsole->Register("g_MPDeathCamMaxZoom", &g_deathCamMaxZoomDistance, 50, 0, "Distance to the killer at which the death camera is fully zoomed in"); pConsole->Register("g_MPDeathEffects", &g_deathEffects, 0, 0, "Enables / disables the MP death screen-effects"); pConsole->Register("sv_pacifist", &sv_pacifist, 0, 0, "Pacifist mode (only works on dedicated server)"); pVehicleQuality = pConsole->GetCVar("v_vehicle_quality"); assert(pVehicleQuality); i_restrictItems = pConsole->RegisterString("i_restrictItems", "", 0, "List of items to restrict for this MP round", RestrictedItemsChanged ); pConsole->Register("g_spawnProtectionTime", &g_spawnProtectionTime, 2, 0, "Number of seconds of invulnerability after a respawn in MP"); pConsole->Register("g_roundRestartTime", &g_roundRestartTime, 30, 0, "Time until round start after minimum people join"); net_mapDownloadURL = pConsole->RegisterString("net_mapDownloadURL", "", 0, "URL for clients to download the current map"); pConsole->Register("g_debugShotValidator", &g_debugShotValidator, 0, 0, "Debug the shot validator"); pConsole->AddCommand("g_listVisiblePlayers", CmdListInvisiblePlayers, 0, "List all players and their visible status"); pConsole->Register("g_painSoundGap", &g_painSoundGap, 0.1f, 0, "Minimum time gap between local player pain sounds"); pConsole->Register("g_explosionScreenShakeMultiplier", &g_explosionScreenShakeMultiplier, 0.25f, 0, "Multiplier for explosion screenshake"); NetInputChainInitCVars(); } //------------------------------------------------------------------------ void SCVars::ReleaseCVars() { IConsole* pConsole = gEnv->pConsole; pConsole->UnregisterVariable("cl_fov", true); pConsole->UnregisterVariable("cl_bob", true); pConsole->UnregisterVariable("cl_tpvDist", true); pConsole->UnregisterVariable("cl_tpvYaw", true); pConsole->UnregisterVariable("cl_nearPlane", true); pConsole->UnregisterVariable("cl_sprintShake", true); pConsole->UnregisterVariable("cl_sensitivityZeroG", true); pConsole->UnregisterVariable("cl_sensitivity", true); pConsole->UnregisterVariable("cl_controllersensitivity", true); pConsole->UnregisterVariable("cl_invertMouse", true); pConsole->UnregisterVariable("cl_invertController", true); pConsole->UnregisterVariable("cl_crouchToggle", true); pConsole->UnregisterVariable("cl_fpBody", true); pConsole->UnregisterVariable("cl_hud", true); pConsole->UnregisterVariable("i_staticfiresounds", true); pConsole->UnregisterVariable("i_soundeffects", true); pConsole->UnregisterVariable("i_lighteffects", true); pConsole->UnregisterVariable("i_lighteffectShadows", true); pConsole->UnregisterVariable("i_particleeffects", true); pConsole->UnregisterVariable("i_offset_front", true); pConsole->UnregisterVariable("i_offset_up", true); pConsole->UnregisterVariable("i_offset_right", true); pConsole->UnregisterVariable("i_unlimitedammo", true); pConsole->UnregisterVariable("i_iceeffects", true); pConsole->UnregisterVariable("cl_strengthscale", true); pConsole->UnregisterVariable("cl_motionBlur", true); pConsole->UnregisterVariable("cl_sprintBlur", true); pConsole->UnregisterVariable("cl_hitShake", true); pConsole->UnregisterVariable("cl_hitBlur", true); pConsole->UnregisterVariable("cl_righthand", true); pConsole->UnregisterVariable("cl_screeneffects", true); pConsole->UnregisterVariable("pl_inputAccel", true); pConsole->UnregisterVariable("cl_actorsafemode", true); pConsole->UnregisterVariable("g_hunterIK", true); pConsole->UnregisterVariable("g_tentacle_joint_limit", true); pConsole->UnregisterVariable("g_enableSpeedLean", true); pConsole->UnregisterVariable("int_zoomAmount", true); pConsole->UnregisterVariable("int_zoomInTime", true); pConsole->UnregisterVariable("int_moveZoomTime", true); pConsole->UnregisterVariable("int_zoomOutTime", true); pConsole->UnregisterVariable("aa_maxDist", true); pConsole->UnregisterVariable("hr_rotateFactor", true); pConsole->UnregisterVariable("hr_rotateTime", true); pConsole->UnregisterVariable("hr_dotAngle", true); pConsole->UnregisterVariable("hr_fovAmt", true); pConsole->UnregisterVariable("hr_fovTime", true); pConsole->UnregisterVariable("cl_debugFreezeShake", true); pConsole->UnregisterVariable("cl_frozenSteps", true); pConsole->UnregisterVariable("cl_frozenSensMin", true); pConsole->UnregisterVariable("cl_frozenSensMax", true); pConsole->UnregisterVariable("cl_frozenAngleMin", true); pConsole->UnregisterVariable("cl_frozenAngleMax", true); pConsole->UnregisterVariable("cl_frozenMouseMult", true); pConsole->UnregisterVariable("cl_frozenKeyMult", true); pConsole->UnregisterVariable("cl_frozenSoundDelta", true); pConsole->UnregisterVariable("g_frostDecay", true); pConsole->UnregisterVariable("g_stanceTransitionSpeed", true); pConsole->UnregisterVariable("g_stanceTransitionSpeedSecondary", true); pConsole->UnregisterVariable("g_playerHealthValue", true); pConsole->UnregisterVariable("g_walkMultiplier", true); pConsole->UnregisterVariable("g_suitSpeedMult", true); pConsole->UnregisterVariable("g_suitRecoilEnergyCost", true); pConsole->UnregisterVariable("g_suitSpeedMultMultiplayer", true); pConsole->UnregisterVariable("g_suitArmorHealthValue", true); pConsole->UnregisterVariable("g_suitSpeedEnergyConsumption", true); pConsole->UnregisterVariable("g_suitSpeedEnergyConsumptionMultiplayer", true); pConsole->UnregisterVariable("g_AiSuitEnergyRechargeTime", true); pConsole->UnregisterVariable("g_AiSuitHealthRechargeTime", true); pConsole->UnregisterVariable("g_AiSuitArmorModeHealthRegenTime", true); pConsole->UnregisterVariable("g_AiSuitStrengthMeleeMult", true); pConsole->UnregisterVariable("g_playerSuitEnergyRechargeTime", true); pConsole->UnregisterVariable("g_playerSuitEnergyRechargeTimeArmor", true); pConsole->UnregisterVariable("g_playerSuitEnergyRechargeTimeArmorMoving", true); pConsole->UnregisterVariable("g_playerSuitEnergyRechargeTimeMultiplayer", true); pConsole->UnregisterVariable("g_playerSuitHealthRechargeTime", true); pConsole->UnregisterVariable("g_playerSuitArmorModeHealthRegenTime", true); pConsole->UnregisterVariable("g_playerSuitHealthRechargeTimeMoving", true); pConsole->UnregisterVariable("g_playerSuitArmorModeHealthRegenTimeMoving", true); pConsole->UnregisterVariable("g_useHitSoundFeedback", true); pConsole->UnregisterVariable("g_playerLowHealthThreshold", true); pConsole->UnregisterVariable("g_playerLowHealthThreshold2", true); pConsole->UnregisterVariable("g_playerLowHealthThresholdMultiplayer", true); pConsole->UnregisterVariable("g_playerLowHealthThreshold2Multiplayer", true); pConsole->UnregisterVariable("g_pp_scale_income", true); pConsole->UnregisterVariable("g_pp_scale_price", true); pConsole->UnregisterVariable("g_radialBlur", true); pConsole->UnregisterVariable("g_PlayerFallAndPlay", true); pConsole->UnregisterVariable("g_fallAndPlayThreshold", true); pConsole->UnregisterVariable("g_enableAlternateIronSight",true); pConsole->UnregisterVariable("g_enableTracers", true); pConsole->UnregisterVariable("g_meleeWhileSprinting", true); pConsole->UnregisterVariable("g_spawndebug", true); pConsole->UnregisterVariable("g_spawnteamdist", true); pConsole->UnregisterVariable("g_spawnenemydist", true); pConsole->UnregisterVariable("g_spawndeathdist", true); pConsole->UnregisterVariable("g_timelimit", true); pConsole->UnregisterVariable("g_teamlock", true); pConsole->UnregisterVariable("g_roundlimit", true); pConsole->UnregisterVariable("g_preroundtime", true); pConsole->UnregisterVariable("g_suddendeathtime", true); pConsole->UnregisterVariable("g_roundtime", true); pConsole->UnregisterVariable("g_fraglimit", true); pConsole->UnregisterVariable("g_fraglead", true); pConsole->UnregisterVariable("g_debugNetPlayerInput", true); pConsole->UnregisterVariable("g_debug_fscommand", true); pConsole->UnregisterVariable("g_debugDirectMPMenu", true); pConsole->UnregisterVariable("g_skipIntro", true); pConsole->UnregisterVariable("g_resetActionmapOnStart", true); pConsole->UnregisterVariable("g_useProfile", true); pConsole->UnregisterVariable("g_startFirstTime", true); pConsole->UnregisterVariable("g_tk_punish", true); pConsole->UnregisterVariable("g_tk_punish_limit", true); pConsole->UnregisterVariable("g_godMode", true); pConsole->UnregisterVariable("g_detachCamera", true); pConsole->UnregisterVariable("g_suicideDelay", true); pConsole->UnregisterVariable("g_debugCollisionDamage", true); pConsole->UnregisterVariable("g_debugHits", true); pConsole->UnregisterVariable("g_trooperProneMinDistance", true); pConsole->UnregisterVariable("g_trooperTentacleAnimBlend", true); pConsole->UnregisterVariable("g_trooperBankingMultiplier", true); pConsole->UnregisterVariable("v_profileMovement", true); pConsole->UnregisterVariable("v_pa_surface", true); pConsole->UnregisterVariable("v_wind_minspeed", true); pConsole->UnregisterVariable("v_draw_suspension", true); pConsole->UnregisterVariable("v_draw_slip", true); pConsole->UnregisterVariable("v_invertPitchControl", true); pConsole->UnregisterVariable("v_sprintSpeed", true); pConsole->UnregisterVariable("v_rockBoats", true); pConsole->UnregisterVariable("v_debugMountedWeapon", true); pConsole->UnregisterVariable("v_zeroGSpeedMultSpeed", true); pConsole->UnregisterVariable("v_zeroGSpeedMultSpeedSprint", true); pConsole->UnregisterVariable("v_zeroGSpeedMultNormal", true); pConsole->UnregisterVariable("v_zeroGSpeedMultNormalSprint", true); pConsole->UnregisterVariable("v_zeroGUpDown", true); pConsole->UnregisterVariable("v_zeroGMaxSpeed", true); pConsole->UnregisterVariable("v_zeroGSpeedMaxSpeed", true); pConsole->UnregisterVariable("v_zeroGSpeedModeEnergyConsumption", true); pConsole->UnregisterVariable("v_zeroGSwitchableGyro", true); pConsole->UnregisterVariable("v_zeroGEnableGBoots", true); pConsole->UnregisterVariable("v_dumpFriction", true); pConsole->UnregisterVariable("v_debugSounds", true); pConsole->UnregisterVariable("v_altitudeLimit", true); pConsole->UnregisterVariable("v_altitudeLimitLowerOffset", true); pConsole->UnregisterVariable("v_airControlSensivity", true); // variables from CPlayer pConsole->UnregisterVariable("player_DrawIK", true); pConsole->UnregisterVariable("player_NoIK", true); pConsole->UnregisterVariable("g_enableIdleCheck", true); pConsole->UnregisterVariable("pl_debug_ladders", true); pConsole->UnregisterVariable("pl_debug_movement", true); pConsole->UnregisterVariable("pl_debug_filter", true); // alien debugging pConsole->UnregisterVariable("aln_debug_movement", true); pConsole->UnregisterVariable("aln_debug_filter", true); // variables from CPlayerMovementController pConsole->UnregisterVariable("g_showIdleStats", true); pConsole->UnregisterVariable("g_debugaimlook", true); // variables from CHUD pConsole->UnregisterVariable("hud_mpNamesNearDistance", true); pConsole->UnregisterVariable("hud_mpNamesFarDistance", true); pConsole->UnregisterVariable("hud_onScreenNearDistance", true); pConsole->UnregisterVariable("hud_onScreenFarDistance", true); pConsole->UnregisterVariable("hud_onScreenNearSize", true); pConsole->UnregisterVariable("hud_onScreenFarSize", true); pConsole->UnregisterVariable("hud_colorLine", true); pConsole->UnregisterVariable("hud_colorOver", true); pConsole->UnregisterVariable("hud_colorText", true); pConsole->UnregisterVariable("hud_showAllObjectives", true); pConsole->UnregisterVariable("hud_showObjectiveMessages", true); pConsole->UnregisterVariable("hud_godfadetime", true); pConsole->UnregisterVariable("g_combatfadetime", true); pConsole->UnregisterVariable("g_combatfadetimedelay", true); pConsole->UnregisterVariable("g_battlerange", true); pConsole->UnregisterVariable("hud_centernames", true); pConsole->UnregisterVariable("hud_crosshair", true); pConsole->UnregisterVariable("hud_chdamageindicator", true); pConsole->UnregisterVariable("hud_panoramic", true); pConsole->UnregisterVariable("hud_voicemode", true); pConsole->UnregisterVariable("hud_enableAlienInterference", true); pConsole->UnregisterVariable("hud_alienInterferenceStrength", true); pConsole->UnregisterVariable("hud_crosshair_enable", true); pConsole->UnregisterVariable("hud_attachBoughEquipment", true); pConsole->UnregisterVariable("hud_subtitlesRenderMode", true); pConsole->UnregisterVariable("hud_panoramicHeight", true); pConsole->UnregisterVariable("hud_subtitles", true); pConsole->UnregisterVariable("hud_subtitlesFontSize", true); pConsole->UnregisterVariable("hud_subtitlesHeight", true); pConsole->UnregisterVariable("hud_startPaused", true); pConsole->UnregisterVariable("hud_nightVisionRecharge", true); pConsole->UnregisterVariable("hud_nightVisionConsumption", true); pConsole->UnregisterVariable("hud_showBigVehicleReload", true); pConsole->UnregisterVariable("hud_binocsScanningDelay", true); pConsole->UnregisterVariable("hud_binocsScanningWidth", true); pConsole->UnregisterVariable("hud_creategame_pb_server", true); pConsole->UnregisterVariable("hud_alternateCrosshairSpread", true); pConsole->UnregisterVariable("hud_alternateCrosshairSpreadCrouch", true); pConsole->UnregisterVariable("hud_alternateCrosshairSpreadNeutral", true); // variables from CHUDRadar pConsole->UnregisterVariable("hud_radarBackground", true); pConsole->UnregisterVariable("hud_radarJammingThreshold", true); pConsole->UnregisterVariable("hud_radarJammingEffectScale", true); // Controller aim helper cvars pConsole->UnregisterVariable("aim_assistSearchBox", true); pConsole->UnregisterVariable("aim_assistMaxDistance", true); pConsole->UnregisterVariable("aim_assistSnapDistance", true); pConsole->UnregisterVariable("aim_assistVerticalScale", true); pConsole->UnregisterVariable("aim_assistSingleCoeff", true); pConsole->UnregisterVariable("aim_assistAutoCoeff", true); pConsole->UnregisterVariable("aim_assistRestrictionTimeout", true); pConsole->UnregisterVariable("hud_aspectCorrection", true); pConsole->UnregisterVariable("hud_ctrl_Curve_X", true); pConsole->UnregisterVariable("hud_ctrl_Curve_Z", true); pConsole->UnregisterVariable("hud_ctrl_Coeff_X", true); pConsole->UnregisterVariable("hud_ctrl_Coeff_Z", true); pConsole->UnregisterVariable("hud_ctrlZoomMode", true); // Aim assitance switches pConsole->UnregisterVariable("aim_assistAimEnabled", true); pConsole->UnregisterVariable("aim_assistTriggerEnabled", true); pConsole->UnregisterVariable("hit_assistSingleplayerEnabled", true); pConsole->UnregisterVariable("hit_assistMultiplayerEnabled", true); // weapon system pConsole->UnregisterVariable("i_debuggun_1", true); pConsole->UnregisterVariable("i_debuggun_2", true); pConsole->UnregisterVariable("tracer_min_distance", true); pConsole->UnregisterVariable("tracer_max_distance", true); pConsole->UnregisterVariable("tracer_min_scale", true); pConsole->UnregisterVariable("tracer_max_scale", true); pConsole->UnregisterVariable("tracer_max_count", true); pConsole->UnregisterVariable("tracer_player_radiusSqr", true); pConsole->UnregisterVariable("i_debug_projectiles", true); pConsole->UnregisterVariable("i_auto_turret_target", true); pConsole->UnregisterVariable("i_auto_turret_target_tacshells", true); pConsole->UnregisterVariable("i_debug_zoom_mods", true); pConsole->UnregisterVariable("i_debug_mp_flowgraph", true); pConsole->UnregisterVariable("g_quickGame_map",true); pConsole->UnregisterVariable("g_quickGame_mode",true); pConsole->UnregisterVariable("g_quickGame_min_players",true); pConsole->UnregisterVariable("g_quickGame_prefer_lan",true); pConsole->UnregisterVariable("g_quickGame_prefer_favorites",true); pConsole->UnregisterVariable("g_quickGame_prefer_mycountry",true); pConsole->UnregisterVariable("g_quickGame_ping1_level",true); pConsole->UnregisterVariable("g_quickGame_ping2_level",true); pConsole->UnregisterVariable("g_quickGame_debug",true); pConsole->UnregisterVariable("g_skip_tutorial",true); pConsole->UnregisterVariable("g_displayIgnoreList",true); pConsole->UnregisterVariable("g_buddyMessagesIngame",true); pConsole->UnregisterVariable("g_battleDust_enable", true); pConsole->UnregisterVariable("g_battleDust_debug", true); pConsole->UnregisterVariable("g_battleDust_effect", true); pConsole->UnregisterVariable("g_PSTutorial_Enabled", true); pConsole->UnregisterVariable("g_proneNotUsableWeapon_FixType", true); pConsole->UnregisterVariable("g_proneAimAngleRestrict_Enable", true); pConsole->UnregisterVariable("sv_voting_timeout",true); pConsole->UnregisterVariable("sv_voting_cooldown",true); pConsole->UnregisterVariable("sv_voting_ratio",true); pConsole->UnregisterVariable("sv_voting_team_ratio",true); pConsole->UnregisterVariable("g_spectate_TeamOnly", true); pConsole->UnregisterVariable("g_claymore_limit", true); pConsole->UnregisterVariable("g_avmine_limit", true); pConsole->UnregisterVariable("g_debugMines", true); pConsole->UnregisterVariable("aim_assistCrosshairSize", true); pConsole->UnregisterVariable("aim_assistCrosshairDebug", true); pConsole->UnregisterVariable("i_restrictItems", true); pConsole->UnregisterVariable("g_spawnProtectionTime", true); pConsole->UnregisterVariable("g_roundRestartTime", true); pConsole->UnregisterVariable("net_mapDownloadURL", true); pConsole->UnregisterVariable("g_debugShotValidator", true); pConsole->UnregisterVariable("g_painSoundFrequency", true); pConsole->UnregisterVariable("g_explosionScreenShakeMultiplier", true); } //------------------------------------------------------------------------ void CGame::CmdDumpSS(IConsoleCmdArgs *pArgs) { g_pGame->GetSynchedStorage()->Dump(); } //------------------------------------------------------------------------ void CGame::RegisterConsoleVars() { assert(m_pConsole); if (m_pCVars) { m_pCVars->InitCVars(m_pConsole); } } //------------------------------------------------------------------------ void CmdDumpItemNameTable(IConsoleCmdArgs *pArgs) { SharedString::CSharedString::DumpNameTable(); } //------------------------------------------------------------------------ void CmdHelp(IConsoleCmdArgs* pArgs) { if(pArgs && pArgs->GetArgCount() == 1) { if(gEnv->pSystem->IsDedicated()) { // dedicated server help here. Load it from text file FILE * f = gEnv->pCryPak->FOpen( "Game/Scripts/Network/Help.txt", "rt" ); if (!f) return; static const int BUFSZ = 4096; char buf[BUFSZ]; size_t nRead; do { nRead = gEnv->pCryPak->FRead( buf, BUFSZ, f ); // scan for newlines int i=0; for(size_t c = 0; c < nRead; ++c) { if(buf[c] == '\n') { string output(&buf[i], c-i); gEnv->pConsole->PrintLine(output); i = c+1; } } } while (nRead == BUFSZ); gEnv->pCryPak->FClose( f ); } else { gEnv->pConsole->ExecuteString("help ?"); } } else if(pArgs && pArgs->GetArgCount() == 2) { string cmd = pArgs->GetArg(1); cmd += " ?"; gEnv->pConsole->ExecuteString(cmd.c_str()); } } //------------------------------------------------------------------------ void CGame::RegisterConsoleCommands() { assert(m_pConsole); m_pConsole->AddCommand("quit", "System.Quit()", VF_RESTRICTEDMODE, "Quits the game"); m_pConsole->AddCommand("goto", "g_localActor:SetWorldPos({x=%1, y=%2, z=%3})", VF_CHEAT, "Sets current player position."); m_pConsole->AddCommand("gotoe", "local e=System.GetEntityByName(%1); if (e) then g_localActor:SetWorldPos(e:GetWorldPos()); end", VF_CHEAT, "Sets current player position."); m_pConsole->AddCommand("freeze", "g_gameRules:SetFrozenAmount(g_localActor,1)", 0, "Freezes player"); m_pConsole->AddCommand("loadactionmap", CmdLoadActionmap, 0, "Loads a key configuration file"); m_pConsole->AddCommand("restartgame", CmdRestartGame, 0, "Restarts Crysis Wars completely."); m_pConsole->AddCommand("lastinv", CmdLastInv, 0, "Selects last inventory item used."); m_pConsole->AddCommand("team", CmdTeam, VF_RESTRICTEDMODE, "Sets player team."); m_pConsole->AddCommand("loadLastSave", CmdLoadLastSave, 0, "Loads the last savegame if available."); m_pConsole->AddCommand("spectator", CmdSpectator, 0, "Sets the player as a spectator."); m_pConsole->AddCommand("join_game", CmdJoinGame, VF_RESTRICTEDMODE, "Enter the current ongoing game."); m_pConsole->AddCommand("kill", CmdKill, VF_RESTRICTEDMODE, "Kills the player."); m_pConsole->AddCommand("v_kill", CmdVehicleKill, VF_CHEAT, "Kills the players vehicle."); m_pConsole->AddCommand("sv_restart", CmdRestart, 0, "Restarts the round."); m_pConsole->AddCommand("sv_say", CmdSay, 0, "Broadcasts a message to all clients."); m_pConsole->AddCommand("i_reload", CmdReloadItems, 0, "Reloads item scripts."); m_pConsole->AddCommand("dumpss", CmdDumpSS, 0, "test synched storage."); m_pConsole->AddCommand("dumpnt", CmdDumpItemNameTable, 0, "Dump ItemString table."); m_pConsole->AddCommand("g_reloadGameRules", CmdReloadGameRules, 0, "Reload GameRules script"); m_pConsole->AddCommand("g_quickGame", CmdQuickGame, 0, "Quick connect to good server."); m_pConsole->AddCommand("g_quickGameStop", CmdQuickGameStop, 0, "Cancel quick game search."); m_pConsole->AddCommand("g_nextlevel", CmdNextLevel,0,"Switch to next level in rotation or restart current one."); m_pConsole->AddCommand("vote", CmdVote, VF_RESTRICTEDMODE, "Vote on current topic."); m_pConsole->AddCommand("startKickVoting",CmdStartKickVoting, VF_RESTRICTEDMODE, "Initiate voting."); m_pConsole->AddCommand("listplayers",CmdListPlayers, VF_RESTRICTEDMODE, "Initiate voting."); m_pConsole->AddCommand("startNextMapVoting",CmdStartNextMapVoting, VF_RESTRICTEDMODE, "Initiate voting."); m_pConsole->AddCommand("g_battleDust_reload", CmdBattleDustReload, 0, "Reload the battle dust parameters xml"); m_pConsole->AddCommand("login",CmdLogin, 0, "Log in to GameSpy using nickname and password as arguments"); m_pConsole->AddCommand("login_profile", CmdLoginProfile, 0, "Log in to GameSpy using email, profile and password as arguments"); m_pConsole->AddCommand("register", CmdRegisterNick, VF_CHEAT, "Register nickname with email, nickname and password"); m_pConsole->AddCommand("connect_crynet",CmdCryNetConnect,0,"Connect to online game server"); m_pConsole->AddCommand("preloadforstats","PreloadForStats()",VF_CHEAT,"Preload multiplayer assets for memory statistics."); m_pConsole->AddCommand("help", CmdHelp, VF_RESTRICTEDMODE, "Information on console commands"); } //------------------------------------------------------------------------ void CGame::UnregisterConsoleCommands() { assert(m_pConsole); m_pConsole->RemoveCommand("quit"); m_pConsole->RemoveCommand("goto"); m_pConsole->RemoveCommand("freeze"); m_pConsole->RemoveCommand("loadactionmap"); m_pConsole->RemoveCommand("restartgame"); m_pConsole->RemoveCommand("team"); m_pConsole->RemoveCommand("kill"); m_pConsole->RemoveCommand("v_kill"); m_pConsole->RemoveCommand("sv_restart"); m_pConsole->RemoveCommand("sv_say"); m_pConsole->RemoveCommand("i_reload"); m_pConsole->RemoveCommand("dumpss"); m_pConsole->RemoveCommand("g_reloadGameRules"); m_pConsole->RemoveCommand("g_quickGame"); m_pConsole->RemoveCommand("g_quickGameStop"); m_pConsole->RemoveCommand("g_nextlevel"); m_pConsole->RemoveCommand("vote"); m_pConsole->RemoveCommand("startKickVoting"); m_pConsole->RemoveCommand("startNextMapVoting"); m_pConsole->RemoveCommand("listplayers"); m_pConsole->RemoveCommand("g_battleDust_reload"); m_pConsole->RemoveCommand("bulletTimeMode"); m_pConsole->RemoveCommand("GOCMode"); m_pConsole->RemoveCommand("help"); // variables from CHUDCommon m_pConsole->RemoveCommand("ShowGODMode"); } //------------------------------------------------------------------------ void CGame::CmdLastInv(IConsoleCmdArgs *pArgs) { if (!gEnv->bClient) return; if (CActor *pClientActor=static_cast<CActor *>(g_pGame->GetIGameFramework()->GetClientActor())) pClientActor->SelectLastItem(true); } //------------------------------------------------------------------------ void CGame::CmdTeam(IConsoleCmdArgs *pArgs) { if (!gEnv->bClient) return; IActor *pClientActor=g_pGame->GetIGameFramework()->GetClientActor(); if (!pClientActor) return; CGameRules *pGameRules = g_pGame->GetGameRules(); if (pGameRules) pGameRules->ChangeTeam(pGameRules->GetActorByEntityId(pClientActor->GetEntityId()), pArgs->GetArg(1)); } //------------------------------------------------------------------------ void CGame::CmdLoadLastSave(IConsoleCmdArgs *pArgs) { if (!gEnv->bClient || gEnv->bMultiplayer) return; if(g_pGame->GetMenu() && g_pGame->GetMenu()->IsActive()) return; string* lastSave = NULL; if(g_pGame->GetMenu()) lastSave = g_pGame->GetMenu()->GetLastInGameSave(); if(lastSave && lastSave->size()) { if(!g_pGame->GetIGameFramework()->LoadGame(lastSave->c_str(), true)) g_pGame->GetIGameFramework()->LoadGame(g_pGame->GetLastSaveGame().c_str(), false); } else { const string& file = g_pGame->GetLastSaveGame().c_str(); if(!g_pGame->GetIGameFramework()->LoadGame(file.c_str(), true)) g_pGame->GetIGameFramework()->LoadGame(file.c_str(), false); } } //------------------------------------------------------------------------ void CGame::CmdSpectator(IConsoleCmdArgs *pArgs) { if (!gEnv->bClient) return; IActor *pClientActor=g_pGame->GetIGameFramework()->GetClientActor(); if (!pClientActor) return; CGameRules *pGameRules = g_pGame->GetGameRules(); if (pGameRules) { int mode=2; if (pArgs->GetArgCount()==2) mode=atoi(pArgs->GetArg(1)); pGameRules->ChangeSpectatorMode(pGameRules->GetActorByEntityId(pClientActor->GetEntityId()), mode, 0, true); } } //------------------------------------------------------------------------ void CGame::CmdJoinGame(IConsoleCmdArgs *pArgs) { if (!gEnv->bClient) return; IActor *pClientActor=g_pGame->GetIGameFramework()->GetClientActor(); if (!pClientActor) return; if (g_pGame->GetGameRules()->GetTeamCount()>0) return; CGameRules *pGameRules = g_pGame->GetGameRules(); if (pGameRules) pGameRules->ChangeSpectatorMode(pGameRules->GetActorByEntityId(pClientActor->GetEntityId()), 0, 0, true); } //------------------------------------------------------------------------ void CGame::CmdKill(IConsoleCmdArgs *pArgs) { if (!gEnv->bClient) return; CActor *pClientActor=static_cast<CActor*>(g_pGame->GetIGameFramework()->GetClientActor()); if (!pClientActor) return; pClientActor->Suicide(g_pGameCVars->g_suicideDelay); } //------------------------------------------------------------------------ void CGame::CmdVehicleKill(IConsoleCmdArgs *pArgs) { if (!gEnv->bClient) return; IActor *pClientActor=g_pGame->GetIGameFramework()->GetClientActor(); if (!pClientActor) return; IVehicle* pVehicle = pClientActor->GetLinkedVehicle(); if (!pVehicle) return; CGameRules *pGameRules = g_pGame->GetGameRules(); if (pGameRules) { HitInfo suicideInfo(pVehicle->GetEntityId(), pVehicle->GetEntityId(), pVehicle->GetEntityId(), -1, 0, 0, -1, 0, pVehicle->GetEntity()->GetWorldPos(), ZERO, ZERO); suicideInfo.SetDamage(10000); pGameRules->ClientHit(suicideInfo); } } //------------------------------------------------------------------------ void CGame::CmdRestart(IConsoleCmdArgs *pArgs) { if(g_pGame && g_pGame->GetGameRules()) g_pGame->GetGameRules()->Restart(); } //------------------------------------------------------------------------ void CGame::CmdSay(IConsoleCmdArgs *pArgs) { if (pArgs->GetArgCount()>1 && gEnv->bServer && g_pGame->GetGameRules()) { const char *msg=pArgs->GetCommandLine()+strlen(pArgs->GetArg(0))+1; g_pGame->GetGameRules()->SendTextMessage(eTextMessageServer, msg, eRMI_ToAllClients); if (!gEnv->bClient) CryLogAlways("** Server: %s **", msg); } } //------------------------------------------------------------------------ void CGame::CmdLoadActionmap(IConsoleCmdArgs *pArgs) { if(pArgs->GetArg(1)) g_pGame->LoadActionMaps(pArgs->GetArg(1)); } //------------------------------------------------------------------------ void CGame::CmdRestartGame(IConsoleCmdArgs *pArgs) { GetISystem()->Relaunch(true); GetISystem()->Quit(); } //------------------------------------------------------------------------ void CGame::CmdReloadItems(IConsoleCmdArgs *pArgs) { g_pGame->GetItemSharedParamsList()->Reset(); g_pGame->GetIGameFramework()->GetIItemSystem()->Reload(); g_pGame->GetWeaponSystem()->Reload(); } //------------------------------------------------------------------------ void CGame::CmdReloadGameRules(IConsoleCmdArgs *pArgs) { if (gEnv->bMultiplayer) return; IGameRulesSystem* pGameRulesSystem = g_pGame->GetIGameFramework()->GetIGameRulesSystem(); IGameRules* pGameRules = pGameRulesSystem->GetCurrentGameRules(); const char* name = "SinglePlayer"; IEntityClass* pEntityClass = 0; if (pGameRules) { pEntityClass = pGameRules->GetEntity()->GetClass(); name = pEntityClass->GetName(); } else pEntityClass = gEnv->pEntitySystem->GetClassRegistry()->FindClass(name); if (pEntityClass) { pEntityClass->LoadScript(true); if (pGameRulesSystem->CreateGameRules(name)) CryLog("reloaded GameRules <%s>", name); else GameWarning("reloading GameRules <%s> failed!", name); } } void CGame::CmdNextLevel(IConsoleCmdArgs* pArgs) { ILevelRotation *pLevelRotation = g_pGame->GetIGameFramework()->GetILevelSystem()->GetLevelRotation(); if (pLevelRotation->GetLength()) pLevelRotation->ChangeLevel(pArgs); } void CGame::CmdStartKickVoting(IConsoleCmdArgs* pArgs) { if (!gEnv->bClient) return; if (pArgs->GetArgCount() < 2) { CryLogAlways("Usage: startKickVoting player_id"); CryLogAlways("Use listplayers to get a list of player ids."); return; } IActor *pClientActor=g_pGame->GetIGameFramework()->GetClientActor(); if (!pClientActor) return; if (CGameRules *pGameRules = g_pGame->GetGameRules()) { if (CActor *pActor=pGameRules->GetActorByChannelId(atoi(pArgs->GetArg(1)))) pGameRules->StartVoting(static_cast<CActor *>(pClientActor), eVS_kick, pActor->GetEntityId(), pActor->GetEntity()->GetName()); } } void CGame::CmdStartNextMapVoting(IConsoleCmdArgs* pArgs) { IActor *pClientActor=NULL; if (gEnv->bClient) pClientActor=g_pGame->GetIGameFramework()->GetClientActor(); if (CGameRules *pGameRules = g_pGame->GetGameRules()) pGameRules->StartVoting(static_cast<CActor *>(pClientActor), eVS_nextMap, 0, ""); } void CGame::CmdVote(IConsoleCmdArgs* pArgs) { if (!gEnv->bClient) return; IActor *pClientActor=g_pGame->GetIGameFramework()->GetClientActor(); if (!pClientActor) return; if (CGameRules *pGameRules = g_pGame->GetGameRules()) pGameRules->Vote(pGameRules->GetActorByEntityId(pClientActor->GetEntityId()), true); } void CGame::CmdListPlayers(IConsoleCmdArgs* pArgs) { if (CGameRules *pGameRules = g_pGame->GetGameRules()) { CGameRules::TPlayers players; pGameRules->GetPlayers(players); if (!players.empty()) { CryLogAlways(" [id] [name]"); for (CGameRules::TPlayers::iterator it=players.begin(); it!=players.end(); ++it) { if (CActor *pActor=pGameRules->GetActorByEntityId(*it)) CryLogAlways(" %5d %s", pActor->GetChannelId(), pActor->GetEntity()->GetName()); } } } } void CGame::CmdQuickGame(IConsoleCmdArgs* pArgs) { g_pGame->GetMenu()->GetMPHub()->OnQuickGame(); } void CGame::CmdQuickGameStop(IConsoleCmdArgs* pArgs) { } void CGame::CmdBattleDustReload(IConsoleCmdArgs* pArgs) { if(CBattleDust* pBD = g_pGame->GetGameRules()->GetBattleDust()) { pBD->ReloadXml(); } } static bool GSCheckComplete() { INetworkService* serv = gEnv->pNetwork->GetService("GameSpy"); if(!serv) return true; return serv->GetState() != eNSS_Initializing; } static bool GSLoggingIn() { return !g_pGame->GetMenu()->GetMPHub()->IsLoggingIn(); } void CGame::CmdLogin(IConsoleCmdArgs* pArgs) { if(pArgs->GetArgCount()>2) { g_pGame->BlockingProcess(&GSCheckComplete); INetworkService* serv = gEnv->pNetwork->GetService("GameSpy"); if(!serv || serv->GetState() != eNSS_Ok) return; if(gEnv->pSystem->IsDedicated()) { if(INetworkProfile* profile = serv->GetNetworkProfile()) { profile->Login(pArgs->GetArg(1),pArgs->GetArg(2)); } } else { if(g_pGame->GetMenu() && g_pGame->GetMenu()->GetMPHub()) { g_pGame->GetMenu()->GetMPHub()->DoLogin(pArgs->GetArg(1),pArgs->GetArg(2)); g_pGame->BlockingProcess(&GSLoggingIn); } } } else GameWarning("Invalid parameters."); } static bool GSRegisterNick() { INetworkService* serv = gEnv->pNetwork->GetService("GameSpy"); if(!serv) return true; INetworkProfile* profile = serv->GetNetworkProfile(); if(!profile) return true; return !profile->IsLoggingIn() || profile->IsLoggedIn(); } void CGame::CmdRegisterNick(IConsoleCmdArgs* pArgs) { if(!gEnv->pSystem->IsDedicated()) { GameWarning("This can be used only on dedicated server."); return; } if(pArgs->GetArgCount()>3) { g_pGame->BlockingProcess(&GSCheckComplete); INetworkService* serv = gEnv->pNetwork->GetService("GameSpy"); if(!serv || serv->GetState() != eNSS_Ok) return; if(INetworkProfile* profile = serv->GetNetworkProfile()) { profile->Register(pArgs->GetArg(1), pArgs->GetArg(2), pArgs->GetArg(3), "", SRegisterDayOfBirth(ZERO)); } g_pGame->BlockingProcess(&GSRegisterNick); if(INetworkProfile* profile = serv->GetNetworkProfile()) { profile->Logoff(); } } else GameWarning("Invalid parameters."); } void CGame::CmdLoginProfile(IConsoleCmdArgs* pArgs) { if(pArgs->GetArgCount()>3) { g_pGame->BlockingProcess(&GSCheckComplete); INetworkService* serv = gEnv->pNetwork->GetService("GameSpy"); if(!serv || serv->GetState() != eNSS_Ok) return; g_pGame->GetMenu()->GetMPHub()->DoLoginProfile(pArgs->GetArg(1),pArgs->GetArg(2),pArgs->GetArg(3)); g_pGame->BlockingProcess(&GSLoggingIn); } else GameWarning("Invalid parameters."); } static bool gGSConnecting = false; struct SCryNetConnectListener : public IServerListener { virtual void RemoveServer(const int id){} virtual void UpdatePing(const int id,const int ping){} virtual void UpdateValue(const int id,const char* name,const char* value){} virtual void UpdatePlayerValue(const int id,const int playerNum,const char* name,const char* value){} virtual void UpdateTeamValue(const int id,const int teamNum,const char *name,const char* value){} virtual void UpdateComplete(bool cancelled){} //we only need this thing to connect to server virtual void OnError(const EServerBrowserError) { End(false); } virtual void NewServer(const int id,const SBasicServerInfo* info) { UpdateServer(id, info); } virtual void UpdateServer(const int id,const SBasicServerInfo* info) { m_port = info->m_hostPort; } virtual void ServerUpdateFailed(const int id) { End(false); } virtual void ServerUpdateComplete(const int id) { m_browser->CheckDirectConnect(id,m_port); } virtual void ServerDirectConnect(bool neednat, uint ip, ushort port) { string connect; if(neednat) { int cookie = rand() + (rand()<<16); connect.Format("connect <nat>%d|%d.%d.%d.%d:%d",cookie,ip&0xFF,(ip>>8)&0xFF,(ip>>16)&0xFF,(ip>>24)&0xFF,port); m_browser->SendNatCookie(ip,port,cookie); } else { connect.Format("connect %d.%d.%d.%d:%d",ip&0xFF,(ip>>8)&0xFF,(ip>>16)&0xFF,(ip>>24)&0xFF,port); } m_browser->Stop(); End(true); g_pGame->GetIGameFramework()->ExecuteCommandNextFrame(connect.c_str()); } void End(bool success) { if(!success) CryLog("Server is not responding."); gGSConnecting = false; m_browser->Stop(); m_browser->SetListener(0); delete this; } IServerBrowser* m_browser; ushort m_port; }; static bool GSConnect() { return !gGSConnecting; } void CGame::CmdCryNetConnect(IConsoleCmdArgs* pArgs) { ushort port = SERVER_DEFAULT_PORT; if(pArgs->GetArgCount()>2) port = atoi(pArgs->GetArg(2)); else { ICVar* pv = GetISystem()->GetIConsole()->GetCVar("cl_serverport"); if(pv) port = pv->GetIVal(); } if(pArgs->GetArgCount()>1) { g_pGame->BlockingProcess(&GSCheckComplete); INetworkService* serv = gEnv->pNetwork->GetService("GameSpy"); if(!serv || serv->GetState() != eNSS_Ok) return; IServerBrowser* sb = serv->GetServerBrowser(); SCryNetConnectListener* lst = new SCryNetConnectListener(); lst->m_browser = sb; sb->SetListener(lst); sb->Start(false); sb->BrowseForServer(pArgs->GetArg(1),port); gGSConnecting = true; g_pGame->BlockingProcess(&GSConnect); } else GameWarning("Invalid parameters."); } void SCVars::RestrictedItemsChanged(ICVar* var) { // pass new restricted item string to game rules CGameRules* pGameRules = g_pGame->GetGameRules(); if(pGameRules && var && gEnv->bMultiplayer) { pGameRules->CreateRestrictedItemList(var->GetString()); } }
6050614394a1b89f884e9e36a25c9ea21c1ea2e0
9895bc169c7585e6fd6888916096f90c16135a5a
/Rainbow Pinball/ModuleRender.cpp
46bd670d41d8ad448a8a6fbbed161f8d922f8d86
[ "MIT" ]
permissive
RustikTie/Pinball
60d3821d9c99e1d54109acef453013dc80ab9bc2
e416dac239c883c5eed6713722beaffea82d2873
refs/heads/master
2021-07-23T11:43:09.994904
2017-11-02T22:58:33
2017-11-02T22:58:33
108,077,221
0
0
null
null
null
null
UTF-8
C++
false
false
4,617
cpp
#include "Globals.h" #include "Application.h" #include "ModuleWindow.h" #include "ModuleRender.h" #include <math.h> ModuleRender::ModuleRender(Application* app, bool start_enabled) : Module(app, start_enabled) { renderer = NULL; camera.x = camera.y = 0; camera.w = SCREEN_WIDTH; camera.h = SCREEN_HEIGHT; } // Destructor ModuleRender::~ModuleRender() {} // Called before render is available bool ModuleRender::Init() { LOG("Creating Renderer context"); bool ret = true; Uint32 flags = 0; if(VSYNC == true) { flags |= SDL_RENDERER_PRESENTVSYNC; } renderer = SDL_CreateRenderer(App->window->window, -1, flags); if(renderer == NULL) { LOG("Renderer could not be created! SDL_Error: %s\n", SDL_GetError()); ret = false; } return ret; } // PreUpdate: clear buffer update_status ModuleRender::PreUpdate() { SDL_SetRenderDrawColor(renderer, 0, 0, 0, 0); SDL_RenderClear(renderer); return UPDATE_CONTINUE; } // Update: debug camera update_status ModuleRender::Update() { /* int speed = 3; if(App->input->GetKey(SDL_SCANCODE_UP) == KEY_REPEAT) App->renderer->camera.y += speed; if(App->input->GetKey(SDL_SCANCODE_DOWN) == KEY_REPEAT) App->renderer->camera.y -= speed; if(App->input->GetKey(SDL_SCANCODE_LEFT) == KEY_REPEAT) App->renderer->camera.x += speed; if(App->input->GetKey(SDL_SCANCODE_RIGHT) == KEY_REPEAT) App->renderer->camera.x -= speed; */ return UPDATE_CONTINUE; } // PostUpdate present buffer to screen update_status ModuleRender::PostUpdate() { SDL_RenderPresent(renderer); return UPDATE_CONTINUE; } // Called before quitting bool ModuleRender::CleanUp() { LOG("Destroying renderer"); //Destroy window if(renderer != NULL) { SDL_DestroyRenderer(renderer); } return true; } // Blit to screen bool ModuleRender::Blit(SDL_Texture* texture, int x, int y, SDL_Rect* section, float speed, double angle, int pivot_x, int pivot_y ) { bool ret = true; SDL_Rect rect; rect.x = (int) (camera.x * speed) + x * SCREEN_SIZE; rect.y = (int) (camera.y * speed) + y * SCREEN_SIZE; if(section != NULL) { rect.w = section->w; rect.h = section->h; } else { SDL_QueryTexture(texture, NULL, NULL, &rect.w, &rect.h); } rect.w *= SCREEN_SIZE; rect.h *= SCREEN_SIZE; SDL_Point* p = NULL; SDL_Point pivot; if(pivot_x != INT_MAX && pivot_y != INT_MAX) { pivot.x = pivot_x; pivot.y = pivot_y; p = &pivot; } if(SDL_RenderCopyEx(renderer, texture, section, &rect, angle, p, SDL_FLIP_NONE) != 0) { LOG("Cannot blit to screen. SDL_RenderCopy error: %s", SDL_GetError()); ret = false; } return ret; } bool ModuleRender::DrawQuad(const SDL_Rect& rect, Uint8 r, Uint8 g, Uint8 b, Uint8 a, bool filled, bool use_camera) { bool ret = true; SDL_SetRenderDrawBlendMode(renderer, SDL_BLENDMODE_BLEND); SDL_SetRenderDrawColor(renderer, r, g, b, a); SDL_Rect rec(rect); if(use_camera) { rec.x = (int)(camera.x + rect.x * SCREEN_SIZE); rec.y = (int)(camera.y + rect.y * SCREEN_SIZE); rec.w *= SCREEN_SIZE; rec.h *= SCREEN_SIZE; } int result = (filled) ? SDL_RenderFillRect(renderer, &rec) : SDL_RenderDrawRect(renderer, &rec); if(result != 0) { LOG("Cannot draw quad to screen. SDL_RenderFillRect error: %s", SDL_GetError()); ret = false; } return ret; } bool ModuleRender::DrawLine(int x1, int y1, int x2, int y2, Uint8 r, Uint8 g, Uint8 b, Uint8 a, bool use_camera) { bool ret = true; SDL_SetRenderDrawBlendMode(renderer, SDL_BLENDMODE_BLEND); SDL_SetRenderDrawColor(renderer, r, g, b, a); int result = -1; if(use_camera) result = SDL_RenderDrawLine(renderer, camera.x + x1 * SCREEN_SIZE, camera.y + y1 * SCREEN_SIZE, camera.x + x2 * SCREEN_SIZE, camera.y + y2 * SCREEN_SIZE); else result = SDL_RenderDrawLine(renderer, x1 * SCREEN_SIZE, y1 * SCREEN_SIZE, x2 * SCREEN_SIZE, y2 * SCREEN_SIZE); if(result != 0) { LOG("Cannot draw quad to screen. SDL_RenderFillRect error: %s", SDL_GetError()); ret = false; } return ret; } bool ModuleRender::DrawCircle(int x, int y, int radius, Uint8 r, Uint8 g, Uint8 b, Uint8 a, bool use_camera) { bool ret = true; SDL_SetRenderDrawBlendMode(renderer, SDL_BLENDMODE_BLEND); SDL_SetRenderDrawColor(renderer, r, g, b, a); int result = -1; SDL_Point points[360]; float factor = (float) M_PI / 180.0f; for(uint i = 0; i < 360; ++i) { points[i].x = (int) (x + radius * cos( i * factor)); points[i].y = (int) (y + radius * sin( i * factor)); } result = SDL_RenderDrawPoints(renderer, points, 1200); if(result != 0) { LOG("Cannot draw quad to screen. SDL_RenderFillRect error: %s", SDL_GetError()); ret = false; } return ret; }
2f6ae0c8eaea4f957e4707ed6562bf5ce93aa0fb
ab08c44b635f24ab08aee1de18b9caac07a230f0
/EscapeBuilding 4.17/Source/EscapeBuilding/OpenDoor.cpp
2143e0471ddbc39c56571185abea35b6b8072b09
[]
no_license
Mkaral/repos
50ea4d103ed72612209e95fc816e93d73048ae90
fa4103621737dcb86759451c284d364895fb1ad5
refs/heads/master
2021-01-16T18:22:12.519942
2017-08-16T08:23:42
2017-08-16T08:23:42
100,064,854
0
0
null
null
null
null
UTF-8
C++
false
false
1,199
cpp
// Fill out your copyright notice in the Description page of Project Settings. #include "OpenDoor.h" // Sets default values for this component's properties UOpenDoor::UOpenDoor() { // Set this component to be initialized when the game starts, and to be ticked every frame. You can turn these features // off to improve performance if you don't need them. PrimaryComponentTick.bCanEverTick = true; // ... } // Called when the game starts void UOpenDoor::BeginPlay() { Super::BeginPlay(); Owner = GetOwner(); ActorThatOpens = GetWorld()->GetFirstPlayerController()->GetPawn(); } void UOpenDoor::OpenDoor() { Owner->SetActorRotation(FRotator(0.0f, openAngle, 0.0f)); } // Called every frame void UOpenDoor::TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) { Super::TickComponent(DeltaTime, TickType, ThisTickFunction); if (PressurePlate->IsOverlappingActor(ActorThatOpens)) { OpenDoor(); LastDoorOpenTime = GetWorld()->GetTimeSeconds(); } if (GetWorld()->GetTimeSeconds() - LastDoorOpenTime > DoorCloseDelay) { CloseDoor(); } } void UOpenDoor::CloseDoor() { Owner->SetActorRotation(FRotator(0.0f, 0.0f, 0.0f)); }
74920e16229d800abb4dd62a8c49e91d4143e39f
838e7a6c843119327e867a1927fc625ff0594ed7
/apps/t3player/src/Interface.h
7bd80dab1bc755b1506beba9bcc603ea3227cba2
[]
no_license
albarral/sam
4723c9651047f575e01ef2435302e4a5113a70c7
6a2fba2ba4ed98a1ef7da26b56ac6d12efcfa0ce
refs/heads/master
2020-05-18T07:32:11.981113
2016-01-15T21:52:09
2016-01-15T21:52:09
32,345,569
1
0
null
null
null
null
UTF-8
C++
false
false
1,138
h
/*************************************************************************** * Copyright (C) 2015 by Migtron Robotics * * [email protected] * ***************************************************************************/ #ifndef _INTERFACE_H #define _INTERFACE_H #include "ui_Interface.h" #include <QPushButton> #include <iostream> #include <vector> #include <QMouseEvent> #include <QMessageBox> #include<QGraphicsView> #include<QGraphicsScene> #include<QGraphicsRectItem> #include<QVector> #include<QGraphicsPolygonItem> #include<QGraphicsSceneMouseEvent> class Interface : public QMainWindow { Q_OBJECT public: Interface(QMainWindow *parent = 0); private: Ui::Interface widget; QGraphicsScene *scene; QGraphicsView *view; QGraphicsPolygonItem *polygon; QGraphicsRectItem *rectangle; private slots: void start(); void userWins(); void agentWins(); void draw(); void play(); void setScene(); //std::vector<int> randomMove(std::vector<int> positions); }; #endif /* _INTERFACE_H */
bd262f603f877477dea99b1d46db3d4cdc2f8ed6
33b6d591ffa7e066f2e361ef4cba94731bcfcec3
/nocode/design_pattern/LuaForVisualCPlusPlus/lua515/lua_tinker/lua_tinker.h
0d347476cc9ade55a9a72e4f57a95dd4eece958a
[ "LicenseRef-scancode-other-permissive" ]
permissive
projectDaemon/nocode
c0a8f7d6b5f15127fcc7ffcd25e7883d70b0be85
972bf19f57ae034a6dba2e432e409484ecc665a8
refs/heads/master
2021-01-24T12:12:01.522986
2018-02-26T17:37:32
2018-02-26T17:37:32
null
0
0
null
null
null
null
UTF-8
C++
false
false
24,732
h
// lua_tinker.h // // LuaTinker - Simple and light C++ wrapper for Lua. // // Copyright (c) 2005-2007 Kwon-il Lee ([email protected]) // // please check Licence.txt file for licence and legal issues. #if !defined(_LUA_TINKER_H_) #define _LUA_TINKER_H_ #include <new> extern "C" { #include "../lua515/src/lua.h" #include "../lua515/src/lualib.h" #include "../lua515/src/lauxlib.h" }; namespace lua_tinker { // init LuaTinker void init(lua_State *L); void init_s64(lua_State *L); void init_u64(lua_State *L); // excution void dofile(lua_State *L, const char *filename); void dostring(lua_State *L, const char* buff); void dobuffer(lua_State *L, const char* buff, size_t sz); // debug helpers void enum_stack(lua_State *L); int on_error(lua_State *L); void print_error(lua_State *L, const char* fmt, ...); // dynamic type extention struct lua_value { virtual void to_lua(lua_State *L) = 0; }; // type trait template<typename T> struct class_name; struct table; template<bool C, typename A, typename B> struct if_ {}; template<typename A, typename B> struct if_<true, A, B> { typedef A type; }; template<typename A, typename B> struct if_<false, A, B> { typedef B type; }; template<typename A> struct is_ptr { static const bool value = false; }; template<typename A> struct is_ptr<A*> { static const bool value = true; }; template<typename A> struct is_ref { static const bool value = false; }; template<typename A> struct is_ref<A&> { static const bool value = true; }; template<typename A> struct remove_const { typedef A type; }; template<typename A> struct remove_const<const A> { typedef A type; }; template<typename A> struct base_type { typedef A type; }; template<typename A> struct base_type<A*> { typedef A type; }; template<typename A> struct base_type<A&> { typedef A type; }; template<typename A> struct class_type { typedef typename remove_const<typename base_type<A>::type>::type type; }; ///////////////////////////////// enum { no = 1, yes = 2 }; typedef char (& no_type )[no]; typedef char (& yes_type)[yes]; struct int_conv_type { int_conv_type(int); }; no_type int_conv_tester (...); yes_type int_conv_tester (int_conv_type); no_type vfnd_ptr_tester (const volatile char *); no_type vfnd_ptr_tester (const volatile short *); no_type vfnd_ptr_tester (const volatile int *); no_type vfnd_ptr_tester (const volatile long *); no_type vfnd_ptr_tester (const volatile double *); no_type vfnd_ptr_tester (const volatile float *); no_type vfnd_ptr_tester (const volatile bool *); yes_type vfnd_ptr_tester (const volatile void *); template <typename T> T* add_ptr(T&); template <bool C> struct bool_to_yesno { typedef no_type type; }; template <> struct bool_to_yesno<true> { typedef yes_type type; }; template <typename T> struct is_enum { static T arg; static const bool value = ( (sizeof(int_conv_tester(arg)) == sizeof(yes_type)) && (sizeof(vfnd_ptr_tester(add_ptr(arg))) == sizeof(yes_type)) ); }; ///////////////////////////////// // from lua template<typename T> struct void2val { static T invoke(void* input){ return *(T*)input; } }; template<typename T> struct void2ptr { static T* invoke(void* input){ return (T*)input; } }; template<typename T> struct void2ref { static T& invoke(void* input){ return *(T*)input; } }; template<typename T> struct void2type { static T invoke(void* ptr) { return if_<is_ptr<T>::value ,void2ptr<base_type<T>::type> ,if_<is_ref<T>::value ,void2ref<base_type<T>::type> ,void2val<base_type<T>::type> >::type >::type::invoke(ptr); } }; template<typename T> struct user2type { static T invoke(lua_State *L, int index) { return void2type<T>::invoke(lua_touserdata(L, index)); } }; template<typename T> struct lua2enum { static T invoke(lua_State *L, int index) { return (T)(int)lua_tonumber(L, index); } }; template<typename T> struct lua2object { static T invoke(lua_State *L, int index) { if(!lua_isuserdata(L,index)) { lua_pushstring(L, "no class at first argument. (forgot ':' expression ?)"); lua_error(L); } return void2type<T>::invoke(user2type<user*>::invoke(L,index)->m_p); } }; template<typename T> T lua2type(lua_State *L, int index) { return if_<is_enum<T>::value ,lua2enum<T> ,lua2object<T> >::type::invoke(L, index); } struct user { user(void* p) : m_p(p) {} virtual ~user() {} void* m_p; }; template<typename T> struct val2user : user { val2user() : user(new T) {} template<typename T1> val2user(T1 t1) : user(new T(t1)) {} template<typename T1, typename T2> val2user(T1 t1, T2 t2) : user(new T(t1, t2)) {} template<typename T1, typename T2, typename T3> val2user(T1 t1, T2 t2, T3 t3) : user(new T(t1, t2, t3)) {} ~val2user() { delete ((T*)m_p); } }; template<typename T> struct ptr2user : user { ptr2user(T* t) : user((void*)t) {} }; template<typename T> struct ref2user : user { ref2user(T& t) : user(&t) {} }; // to lua template<typename T> struct val2lua { static void invoke(lua_State *L, T& input){ new(lua_newuserdata(L, sizeof(val2user<T>))) val2user<T>(input); } }; template<typename T> struct ptr2lua { static void invoke(lua_State *L, T* input){ if(input) new(lua_newuserdata(L, sizeof(ptr2user<T>))) ptr2user<T>(input); else lua_pushnil(L); } }; template<typename T> struct ref2lua { static void invoke(lua_State *L, T& input){ new(lua_newuserdata(L, sizeof(ref2user<T>))) ref2user<T>(input); } }; template<typename T> struct enum2lua { static void invoke(lua_State *L, T val) { lua_pushnumber(L, (int)val); } }; template<typename T> struct object2lua { static void invoke(lua_State *L, T val) { if_<is_ptr<T>::value ,ptr2lua<base_type<T>::type> ,if_<is_ref<T>::value ,ref2lua<base_type<T>::type> ,val2lua<base_type<T>::type> >::type >::type::invoke(L, val); meta_push(L, class_name<class_type<T>::type>::name()); lua_setmetatable(L, -2); } }; template<typename T> void type2lua(lua_State *L, T val) { if_<is_enum<T>::value ,enum2lua<T> ,object2lua<T> >::type::invoke(L, val); } // get value from cclosure template<typename T> T upvalue_(lua_State *L) { return user2type<T>::invoke(L, lua_upvalueindex(1)); } // read a value from lua stack template<typename T> T read(lua_State *L, int index) { return lua2type<T>(L, index); } template<> char* read(lua_State *L, int index); template<> const char* read(lua_State *L, int index); template<> char read(lua_State *L, int index); template<> unsigned char read(lua_State *L, int index); template<> short read(lua_State *L, int index); template<> unsigned short read(lua_State *L, int index); template<> long read(lua_State *L, int index); template<> unsigned long read(lua_State *L, int index); template<> int read(lua_State *L, int index); template<> unsigned int read(lua_State *L, int index); template<> float read(lua_State *L, int index); template<> double read(lua_State *L, int index); template<> bool read(lua_State *L, int index); template<> void read(lua_State *L, int index); template<> __int64 read(lua_State *L, int index); template<> unsigned __int64 read(lua_State *L, int index); template<> table read(lua_State *L, int index); // push a value to lua stack template<typename T> void push(lua_State *L, T ret) { type2lua<T>(L, ret); } template<> void push(lua_State *L, char ret); template<> void push(lua_State *L, unsigned char ret); template<> void push(lua_State *L, short ret); template<> void push(lua_State *L, unsigned short ret); template<> void push(lua_State *L, long ret); template<> void push(lua_State *L, unsigned long ret); template<> void push(lua_State *L, int ret); template<> void push(lua_State *L, unsigned int ret); template<> void push(lua_State *L, float ret); template<> void push(lua_State *L, double ret); template<> void push(lua_State *L, char* ret); template<> void push(lua_State *L, const char* ret); template<> void push(lua_State *L, bool ret); template<> void push(lua_State *L, lua_value* ret); template<> void push(lua_State *L, __int64 ret); template<> void push(lua_State *L, unsigned __int64 ret); template<> void push(lua_State *L, table ret); // pop a value from lua stack template<typename T> T pop(lua_State *L) { T t = read<T>(L, -1); lua_pop(L, 1); return t; } template<> void pop(lua_State *L); template<> table pop(lua_State *L); // functor template<typename T1=void, typename T2=void, typename T3=void, typename T4=void, typename T5=void> struct functor { template<typename RVal> static int invoke(lua_State *L) { push(L,upvalue_<RVal(*)(T1,T2,T3,T4,T5)>(L)(read<T1>(L,1),read<T2>(L,2),read<T3>(L,3),read<T4>(L,4),read<T5>(L,5))); return 1; } template<> static int invoke<void>(lua_State *L) { upvalue_<void(*)(T1,T2,T3,T4,T5)>(L)(read<T1>(L,1),read<T2>(L,2),read<T3>(L,3),read<T4>(L,4),read<T5>(L,5)); return 0; } }; template<typename T1, typename T2, typename T3, typename T4> struct functor<T1,T2,T3,T4> { template<typename RVal> static int invoke(lua_State *L) { push(L,upvalue_<RVal(*)(T1,T2,T3,T4)>(L)(read<T1>(L,1),read<T2>(L,2),read<T3>(L,3),read<T4>(L,4))); return 1; } template<> static int invoke<void>(lua_State *L) { upvalue_<void(*)(T1,T2,T3,T4)>(L)(read<T1>(L,1),read<T2>(L,2),read<T3>(L,3),read<T4>(L,4)); return 0; } }; template<typename T1, typename T2, typename T3> struct functor<T1,T2,T3> { template<typename RVal> static int invoke(lua_State *L) { push(L,upvalue_<RVal(*)(T1,T2,T3)>(L)(read<T1>(L,1),read<T2>(L,2),read<T3>(L,3))); return 1; } template<> static int invoke<void>(lua_State *L) { upvalue_<void(*)(T1,T2,T3)>(L)(read<T1>(L,1),read<T2>(L,2),read<T3>(L,3)); return 0; } }; template<typename T1, typename T2> struct functor<T1,T2> { template<typename RVal> static int invoke(lua_State *L) { push(L,upvalue_<RVal(*)(T1,T2)>(L)(read<T1>(L,1),read<T2>(L,2))); return 1; } template<> static int invoke<void>(lua_State *L) { upvalue_<void(*)(T1,T2)>(L)(read<T1>(L,1),read<T2>(L,2)); return 0; } }; template<typename T1> struct functor<T1> { template<typename RVal> static int invoke(lua_State *L) { push(L,upvalue_<RVal(*)(T1)>(L)(read<T1>(L,1))); return 1; } template<> static int invoke<void>(lua_State *L) { upvalue_<void(*)(T1)>(L)(read<T1>(L,1)); return 0; } }; template<> struct functor<> { template<typename RVal> static int invoke(lua_State *L) { push(L,upvalue_<RVal(*)()>(L)()); return 1; } template<> static int invoke<void>(lua_State *L) { upvalue_<void(*)()>(L)(); return 0; } }; // push_functor template<typename RVal> void push_functor(lua_State *L, RVal (*func)()) { lua_pushcclosure(L, functor<>::invoke<RVal>, 1); } template<typename RVal, typename T1> void push_functor(lua_State *L, RVal (*func)(T1)) { lua_pushcclosure(L, functor<T1>::invoke<RVal>, 1); } template<typename RVal, typename T1, typename T2> void push_functor(lua_State *L, RVal (*func)(T1,T2)) { lua_pushcclosure(L, functor<T1,T2>::invoke<RVal>, 1); } template<typename RVal, typename T1, typename T2, typename T3> void push_functor(lua_State *L, RVal (*func)(T1,T2,T3)) { lua_pushcclosure(L, functor<T1,T2,T3>::invoke<RVal>, 1); } template<typename RVal, typename T1, typename T2, typename T3, typename T4> void push_functor(lua_State *L, RVal (*func)(T1,T2,T3,T4)) { lua_pushcclosure(L, functor<T1,T2,T3,T4>::invoke<RVal>, 1); } template<typename RVal, typename T1, typename T2, typename T3, typename T4, typename T5> void push_functor(lua_State *L, RVal (*func)(T1,T2,T3,T4,T5)) { lua_pushcclosure(L, functor<T1,T2,T3,T4,T5>::invoke<RVal>, 1); } // member variable struct var_base { virtual void get(lua_State *L) = 0; virtual void set(lua_State *L) = 0; }; template<typename T, typename V> struct mem_var : var_base { V T::*_var; mem_var(V T::*val) : _var(val) {} void get(lua_State *L) { push(L, read<T*>(L,1)->*(_var)); } void set(lua_State *L) { read<T*>(L,1)->*(_var) = read<V>(L, 3); } }; // member function template<typename T, typename T1=void, typename T2=void, typename T3=void, typename T4=void, typename T5=void> struct mem_functor { template<typename RVal> static int invoke(lua_State *L) { push(L,(read<T*>(L,1)->*upvalue_<RVal(T::*)(T1,T2,T3,T4,T5)>(L))(read<T1>(L,2),read<T2>(L,3),read<T3>(L,4),read<T4>(L,5),read<T5>(L,6)));; return 1; } template<> static int invoke<void>(lua_State *L) { (read<T*>(L,1)->*upvalue_<void(T::*)(T1,T2,T3,T4,T5)>(L))(read<T1>(L,2),read<T2>(L,3),read<T3>(L,4),read<T4>(L,5),read<T5>(L,6)); return 0; } }; template<typename T, typename T1, typename T2, typename T3, typename T4> struct mem_functor<T,T1,T2,T3,T4> { template<typename RVal> static int invoke(lua_State *L) { push(L,(read<T*>(L,1)->*upvalue_<RVal(T::*)(T1,T2,T3,T4)>(L))(read<T1>(L,2),read<T2>(L,3),read<T3>(L,4),read<T4>(L,5))); return 1; } template<> static int invoke<void>(lua_State *L) { (read<T*>(L,1)->*upvalue_<void(T::*)(T1,T2,T3,T4)>(L))(read<T1>(L,2),read<T2>(L,3),read<T3>(L,4),read<T4>(L,5)); return 0; } }; template<typename T, typename T1, typename T2, typename T3> struct mem_functor<T,T1,T2,T3> { template<typename RVal> static int invoke(lua_State *L) { push(L,(read<T*>(L,1)->*upvalue_<RVal(T::*)(T1,T2,T3)>(L))(read<T1>(L,2),read<T2>(L,3),read<T3>(L,4))); return 1; } template<> static int invoke<void>(lua_State *L) { (read<T*>(L,1)->*upvalue_<void(T::*)(T1,T2,T3)>(L))(read<T1>(L,2),read<T2>(L,3),read<T3>(L,4)); return 0; } }; template<typename T, typename T1, typename T2> struct mem_functor<T,T1, T2> { template<typename RVal> static int invoke(lua_State *L) { push(L,(read<T*>(L,1)->*upvalue_<RVal(T::*)(T1,T2)>(L))(read<T1>(L,2),read<T2>(L,3))); return 1; } template<> static int invoke<void>(lua_State *L) { (read<T*>(L,1)->*upvalue_<void(T::*)(T1,T2)>(L))(read<T1>(L,2),read<T2>(L,3)); return 0; } }; template<typename T, typename T1> struct mem_functor<T,T1> { template<typename RVal> static int invoke(lua_State *L) { push(L,(read<T*>(L,1)->*upvalue_<RVal(T::*)(T1)>(L))(read<T1>(L,2))); return 1; } template<> static int invoke<void>(lua_State *L) { (read<T*>(L,1)->*upvalue_<void(T::*)(T1)>(L))(read<T1>(L,2)); return 0; } }; template<typename T> struct mem_functor<T> { template<typename RVal> static int invoke(lua_State *L) { push(L,(read<T*>(L,1)->*upvalue_<RVal(T::*)()>(L))()); return 1; } template<> static int invoke<void>(lua_State *L) { (read<T*>(L,1)->*upvalue_<void(T::*)()>(L))(); return 0; } }; // push_functor template<typename RVal, typename T> void push_functor(lua_State *L, RVal (T::*func)()) { lua_pushcclosure(L, mem_functor<T>::invoke<RVal>, 1); } template<typename RVal, typename T> void push_functor(lua_State *L, RVal (T::*func)() const) { lua_pushcclosure(L, mem_functor<T>::invoke<RVal>, 1); } template<typename RVal, typename T, typename T1> void push_functor(lua_State *L, RVal (T::*func)(T1)) { lua_pushcclosure(L, mem_functor<T,T1>::invoke<RVal>, 1); } template<typename RVal, typename T, typename T1> void push_functor(lua_State *L, RVal (T::*func)(T1) const) { lua_pushcclosure(L, mem_functor<T,T1>::invoke<RVal>, 1); } template<typename RVal, typename T, typename T1, typename T2> void push_functor(lua_State *L, RVal (T::*func)(T1,T2)) { lua_pushcclosure(L, mem_functor<T,T1,T2>::invoke<RVal>, 1); } template<typename RVal, typename T, typename T1, typename T2> void push_functor(lua_State *L, RVal (T::*func)(T1,T2) const) { lua_pushcclosure(L, mem_functor<T,T1,T2>::invoke<RVal>, 1); } template<typename RVal, typename T, typename T1, typename T2, typename T3> void push_functor(lua_State *L, RVal (T::*func)(T1,T2,T3)) { lua_pushcclosure(L, mem_functor<T,T1,T2,T3>::invoke<RVal>, 1); } template<typename RVal, typename T, typename T1, typename T2, typename T3> void push_functor(lua_State *L, RVal (T::*func)(T1,T2,T3) const) { lua_pushcclosure(L, mem_functor<T,T1,T2,T3>::invoke<RVal>, 1); } template<typename RVal, typename T, typename T1, typename T2, typename T3, typename T4> void push_functor(lua_State *L, RVal (T::*func)(T1,T2,T3,T4)) { lua_pushcclosure(L, mem_functor<T,T1,T2,T3,T4>::invoke<RVal>, 1); } template<typename RVal, typename T, typename T1, typename T2, typename T3, typename T4> void push_functor(lua_State *L, RVal (T::*func)(T1,T2,T3,T4) const) { lua_pushcclosure(L, mem_functor<T,T1,T2,T3,T4>::invoke<RVal>, 1); } template<typename RVal, typename T, typename T1, typename T2, typename T3, typename T4, typename T5> void push_functor(lua_State *L, RVal (T::*func)(T1,T2,T3,T4,T5)) { lua_pushcclosure(L, mem_functor<T,T1,T2,T3,T4,T5>::invoke<RVal>, 1); } template<typename RVal, typename T, typename T1, typename T2, typename T3, typename T4, typename T5> void push_functor(lua_State *L, RVal (T::*func)(T1,T2,T3,T4,T5) const) { lua_pushcclosure(L, mem_functor<T,T1,T2,T3,T4,T5>::invoke<RVal>, 1); } // constructor template<typename T1=void, typename T2=void, typename T3=void, typename T4=void> struct constructor {}; template<typename T1, typename T2, typename T3> struct constructor<T1,T2,T3> { template<typename T> static void invoke(lua_State *L) { new(lua_newuserdata(L, sizeof(val2user<T>))) val2user<T>(read<T1>(L,2),read<T2>(L,3),read<T3>(L,4)); } }; template<typename T1, typename T2> struct constructor<T1,T2> { template<typename T> static void invoke(lua_State *L) { new(lua_newuserdata(L, sizeof(val2user<T>))) val2user<T>(read<T1>(L,2),read<T2>(L,3)); } }; template<typename T1> struct constructor<T1> { template<typename T> static void invoke(lua_State *L) { new(lua_newuserdata(L, sizeof(val2user<T>))) val2user<T>(read<T1>(L,2)); } }; template<> struct constructor<void> { template<typename T> static void invoke(lua_State *L) { new(lua_newuserdata(L, sizeof(val2user<T>))) val2user<T>(); } }; template<typename T> struct creator { template<typename CONSTRUCTOR> static int invoke(lua_State *L) { CONSTRUCTOR::invoke<T>(L); meta_push(L, class_name<class_type<T>::type>::name()); lua_setmetatable(L, -2); return 1; } }; // destroyer template<typename T> int destroyer(lua_State *L) { ((user*)lua_touserdata(L, 1))->~user(); return 0; } // global function template<typename F> void def(lua_State* L, const char* name, F func) { lua_pushstring(L, name); lua_pushlightuserdata(L, func); push_functor(L, func); lua_settable(L, LUA_GLOBALSINDEX); } // global variable template<typename T> void set(lua_State* L, const char* name, T object) { lua_pushstring(L, name); push(L, object); lua_settable(L, LUA_GLOBALSINDEX); } template<typename T> T get(lua_State* L, const char* name) { lua_pushstring(L, name); lua_gettable(L, LUA_GLOBALSINDEX); return pop<T>(L); } template<typename T> void decl(lua_State* L, const char* name, T object) { set(L, name, object); } // call template<typename RVal> RVal call(lua_State* L, const char* name) { lua_pushcclosure(L, on_error, 0); int errfunc = lua_gettop(L); lua_pushstring(L, name); lua_gettable(L, LUA_GLOBALSINDEX); if(lua_isfunction(L,-1)) { if(lua_pcall(L, 0, 1, errfunc) != 0) { lua_pop(L, 1); } } else { print_error(L, "lua_tinker::call() attempt to call global `%s' (not a function)", name); } lua_remove(L, -2); return pop<RVal>(L); } template<typename RVal, typename T1> RVal call(lua_State* L, const char* name, T1 arg) { lua_pushcclosure(L, on_error, 0); int errfunc = lua_gettop(L); lua_pushstring(L, name); lua_gettable(L, LUA_GLOBALSINDEX); if(lua_isfunction(L,-1)) { push(L, arg); if(lua_pcall(L, 1, 1, errfunc) != 0) { lua_pop(L, 1); } } else { print_error(L, "lua_tinker::call() attempt to call global `%s' (not a function)", name); } lua_remove(L, -2); return pop<RVal>(L); } template<typename RVal, typename T1, typename T2> RVal call(lua_State* L, const char* name, T1 arg1, T2 arg2) { lua_pushcclosure(L, on_error, 0); int errfunc = lua_gettop(L); lua_pushstring(L, name); lua_gettable(L, LUA_GLOBALSINDEX); if(lua_isfunction(L,-1)) { push(L, arg1); push(L, arg2); if(lua_pcall(L, 2, 1, errfunc) != 0) { lua_pop(L, 1); } } else { print_error(L, "lua_tinker::call() attempt to call global `%s' (not a function)", name); } lua_remove(L, -2); return pop<RVal>(L); } template<typename RVal, typename T1, typename T2, typename T3> RVal call(lua_State* L, const char* name, T1 arg1, T2 arg2, T3 arg3) { lua_pushcclosure(L, on_error, 0); int errfunc = lua_gettop(L); lua_pushstring(L, name); lua_gettable(L, LUA_GLOBALSINDEX); if(lua_isfunction(L,-1)) { push(L, arg1); push(L, arg2); push(L, arg3); if(lua_pcall(L, 3, 1, errfunc) != 0) { lua_pop(L, 1); } } else { print_error(L, "lua_tinker::call() attempt to call global `%s' (not a function)", name); } lua_remove(L, -2); return pop<RVal>(L); } // class helper int meta_get(lua_State *L); int meta_set(lua_State *L); void meta_push(lua_State *L, const char* name); // class init template<typename T> void class_add(lua_State* L, const char* name) { class_name<T>::name(name); lua_pushstring(L, name); lua_newtable(L); lua_pushstring(L, "__name"); lua_pushstring(L, name); lua_rawset(L, -3); lua_pushstring(L, "__index"); lua_pushcclosure(L, meta_get, 0); lua_rawset(L, -3); lua_pushstring(L, "__newindex"); lua_pushcclosure(L, meta_set, 0); lua_rawset(L, -3); lua_pushstring(L, "__gc"); lua_pushcclosure(L, destroyer<T>, 0); lua_rawset(L, -3); lua_settable(L, LUA_GLOBALSINDEX); } // Tinker Class Inheritence template<typename T, typename P> void class_inh(lua_State* L) { meta_push(L, class_name<T>::name()); if(lua_istable(L, -1)) { lua_pushstring(L, "__parent"); meta_push(L, class_name<P>::name()); lua_rawset(L, -3); } lua_pop(L, 1); } // Tinker Class Constructor template<typename T, typename CONSTRUCTOR> void class_con(lua_State* L, CONSTRUCTOR) { meta_push(L, class_name<T>::name()); if(lua_istable(L, -1)) { lua_newtable(L); lua_pushstring(L, "__call"); lua_pushcclosure(L, creator<T>::invoke<CONSTRUCTOR>, 0); lua_rawset(L, -3); lua_setmetatable(L, -2); } lua_pop(L, 1); } // Tinker Class Functions template<typename T, typename F> void class_def(lua_State* L, const char* name, F func) { meta_push(L, class_name<T>::name()); if(lua_istable(L, -1)) { lua_pushstring(L, name); new(lua_newuserdata(L,sizeof(F))) F(func); push_functor(L, func); lua_rawset(L, -3); } lua_pop(L, 1); } // Tinker Class Variables template<typename T, typename BASE, typename VAR> void class_mem(lua_State* L, const char* name, VAR BASE::*val) { meta_push(L, class_name<T>::name()); if(lua_istable(L, -1)) { lua_pushstring(L, name); new(lua_newuserdata(L,sizeof(mem_var<BASE,VAR>))) mem_var<BASE,VAR>(val); lua_rawset(L, -3); } lua_pop(L, 1); } template<typename T> struct class_name { // global name static const char* name(const char* name = NULL) { static char temp[256] = ""; if(name) strcpy(temp, name); return temp; } }; // Table Object on Stack struct table_obj { table_obj(lua_State* L, int index); ~table_obj(); void inc_ref(); void dec_ref(); bool validate(); template<typename T> void set(const char* name, T object) { if(validate()) { lua_pushstring(m_L, name); push(m_L, object); lua_settable(m_L, m_index); } } template<typename T> T get(const char* name) { if(validate()) { lua_pushstring(m_L, name); lua_gettable(m_L, m_index); } else { lua_pushnil(m_L); } return pop<T>(m_L); } lua_State* m_L; int m_index; const void* m_pointer; int m_ref; }; // Table Object Holder struct table { table(lua_State* L); table(lua_State* L, int index); table(lua_State* L, const char* name); table(const table& input); ~table(); template<typename T> void set(const char* name, T object) { m_obj->set(name, object); } template<typename T> T get(const char* name) { return m_obj->get<T>(name); } table_obj* m_obj; }; } // namespace lua_tinker #endif //_LUA_TINKER_H_
1f01f099d47b6848f81203c5d1393ba5cdef5cff
be379c5decf2b8a8a7aac102e489563ae0da8593
/extern/irrogles/source/Irrlicht/CGUISpriteBank.h
e57c62c503a4ce84516f786312aa6f14516fda57
[]
no_license
codeman001/gsleveleditor
6050daf26d623af4f6ab9fa97f032d958fb4c5ae
d30e54874a4c7ae4fd0a364aa92a2082f73a5d7c
refs/heads/master
2021-01-10T13:09:01.347502
2013-05-12T09:14:47
2013-05-12T09:14:47
44,381,635
1
0
null
null
null
null
UTF-8
C++
false
false
2,309
h
// Copyright (C) 2002-2011 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h #ifndef __C_GUI_SPRITE_BANK_H_INCLUDED__ #define __C_GUI_SPRITE_BANK_H_INCLUDED__ #include "IrrCompileConfig.h" #ifdef _IRR_COMPILE_WITH_GUI_ #include "IGUISpriteBank.h" namespace irr { namespace video { class IVideoDriver; class ITexture; } namespace gui { class IGUIEnvironment; //! Sprite bank interface. class CGUISpriteBank : public IGUISpriteBank { public: CGUISpriteBank(IGUIEnvironment* env); virtual ~CGUISpriteBank(); virtual core::array< core::rect<s32> >& getPositions(); virtual core::array< SGUISprite >& getSprites(); virtual u32 getTextureCount() const; virtual video::ITexture* getTexture(u32 index) const; virtual void addTexture(video::ITexture* texture); virtual void setTexture(u32 index, video::ITexture* texture); //! Add the texture and use it for a single non-animated sprite. virtual s32 addTextureAsSprite(video::ITexture* texture); //! clears sprites, rectangles and textures virtual void clear(); //! Draws a sprite in 2d with position and color virtual void draw2DSprite(u32 index, const core::position2di& pos, const core::rect<s32>* clip=0, const video::SColor& color= video::SColor(255,255,255,255), u32 starttime=0, u32 currenttime=0, bool loop=true, bool center=false); //! Draws a sprite batch in 2d using an array of positions and a color virtual void draw2DSpriteBatch(const core::array<u32>& indices, const core::array<core::position2di>& pos, const core::rect<s32>* clip=0, const video::SColor& color= video::SColor(255,255,255,255), u32 starttime=0, u32 currenttime=0, bool loop=true, bool center=false); protected: struct SDrawBatch { core::array<core::position2di> positions; core::array<core::recti> sourceRects; u32 textureNumber; }; core::array<SGUISprite> Sprites; core::array< core::rect<s32> > Rectangles; core::array<video::ITexture*> Textures; IGUIEnvironment* Environment; video::IVideoDriver* Driver; }; } // end namespace gui } // end namespace irr #endif // _IRR_COMPILE_WITH_GUI_ #endif // __C_GUI_SPRITE_BANK_H_INCLUDED__
e8319536d72c8e3e2993a8d05c9eb10806da4128
b9643226fed06909dc1e2daf417e78cfb3a42ec3
/real_estate_database_manager/Property.h
df439bfbead9b08a92eea4c0a3ba3e72a23ab6f1
[]
no_license
karimrhoualem/realEstateManager
d7f1117df929c2283009589aa7c5f6b5eafc1d9d
c3a04c9da4b8626119d0a12acce4977779a688b5
refs/heads/master
2020-12-05T20:50:17.376874
2020-01-07T04:52:04
2020-01-07T04:52:04
232,243,887
0
0
null
null
null
null
UTF-8
C++
false
false
1,137
h
/* Karim Rhoualem - Student #26603157 Dilara Omeroglu - Student #40030357 */ #pragma once #include <iostream> using namespace std; #include <string> #include "Client.h" #include "RealEstateAgent.h" #include "Date.h" class Property { private: string m_streetAddress; string m_cityName; Client* m_seller; // Initialized to the Client parameter of the constructor function. Client* m_buyer; // Initialized to a null pointer. RealEstateAgent* m_agent; Date m_listingDate; public: Property(); Property(string streetAddress, string cityName, Client* seller, RealEstateAgent* agent, Date listingDate); Property(const Property& anotherProperty); //Copy constructor ~Property(); void setStreetAddress(string streetAddress); string getStreetAddress() const; void setCityName(string cityName); string getCityName() const; void setSeller(Client* seller); Client* getSeller() const; void setBuyer(Client* buyer); Client* getBuyer() const; void setAgent(RealEstateAgent* agent); RealEstateAgent* getAgent() const; void setListingDate(Date listingDate); Date getListingDate() const; virtual void print() const; };
8c6e2b07b4e01cfd1122e0f88755d44d2d91be4e
627446942aa275ffc1323e467140c37566cd94ad
/LabProject08-0-1/Scene.cpp
11c373b44fe69992acecad8e586dd1acdbbc4703
[]
no_license
yeongjo/SchoolDx12_2
ec6f45114f4a74842d23d4fe70cfdf5ae0aea2e4
de947fe3955560a77ae82b62f8cc34a343ca0a15
refs/heads/master
2023-06-01T17:41:08.512774
2020-12-19T02:51:48
2020-12-19T02:51:48
376,394,420
0
0
null
null
null
null
UHC
C++
false
false
18,270
cpp
//----------------------------------------------------------------------------- // File: CScene.cpp //----------------------------------------------------------------------------- #include "stdafx.h" #include "Scene.h" CScene::CScene() { } CScene::~CScene() { } void CScene::BuildDefaultLightsAndMaterials() { m_nLights = 4; m_pLights = new LIGHT[m_nLights]; ::ZeroMemory(m_pLights, sizeof(LIGHT) * m_nLights); m_xmf4GlobalAmbient = XMFLOAT4(0.15f, 0.15f, 0.15f, 1.0f); m_pLights[0].m_bEnable = true; m_pLights[0].m_nType = POINT_LIGHT; m_pLights[0].m_fRange = 1000.0f; m_pLights[0].m_xmf4Ambient = XMFLOAT4(0.1f, 0.0f, 0.0f, 1.0f); m_pLights[0].m_xmf4Diffuse = XMFLOAT4(0.8f, 0.0f, 0.0f, 1.0f); m_pLights[0].m_xmf4Specular = XMFLOAT4(0.5f, 0.5f, 0.5f, 0.0f); m_pLights[0].m_xmf3Position = XMFLOAT3(30.0f, 30.0f, 30.0f); m_pLights[0].m_xmf3Direction = XMFLOAT3(0.0f, 0.0f, 0.0f); m_pLights[0].m_xmf3Attenuation = XMFLOAT3(1.0f, 0.001f, 0.0001f); m_pLights[1].m_bEnable = true; m_pLights[1].m_nType = SPOT_LIGHT; m_pLights[1].m_fRange = 500.0f; m_pLights[1].m_xmf4Ambient = XMFLOAT4(0.1f, 0.1f, 0.1f, 1.0f); m_pLights[1].m_xmf4Diffuse = XMFLOAT4(0.4f, 0.4f, 0.4f, 1.0f); m_pLights[1].m_xmf4Specular = XMFLOAT4(0.3f, 0.3f, 0.3f, 0.0f); m_pLights[1].m_xmf3Position = XMFLOAT3(-50.0f, 20.0f, -5.0f); m_pLights[1].m_xmf3Direction = XMFLOAT3(0.0f, 0.0f, 1.0f); m_pLights[1].m_xmf3Attenuation = XMFLOAT3(1.0f, 0.01f, 0.0001f); m_pLights[1].m_fFalloff = 8.0f; m_pLights[1].m_fPhi = (float)cos(XMConvertToRadians(40.0f)); m_pLights[1].m_fTheta = (float)cos(XMConvertToRadians(20.0f)); m_pLights[2].m_bEnable = true; m_pLights[2].m_nType = DIRECTIONAL_LIGHT; m_pLights[2].m_xmf4Ambient = XMFLOAT4(0.3f, 0.3f, 0.3f, 1.0f); m_pLights[2].m_xmf4Diffuse = XMFLOAT4(0.7f, 0.7f, 0.7f, 1.0f); m_pLights[2].m_xmf4Specular = XMFLOAT4(0.4f, 0.4f, 0.4f, 0.0f); m_pLights[2].m_xmf3Direction = XMFLOAT3(1.0f, 0.0f, 0.0f); m_pLights[3].m_bEnable = true; m_pLights[3].m_nType = SPOT_LIGHT; m_pLights[3].m_fRange = 600.0f; m_pLights[3].m_xmf4Ambient = XMFLOAT4(0.3f, 0.3f, 0.3f, 1.0f); m_pLights[3].m_xmf4Diffuse = XMFLOAT4(0.3f, 0.7f, 0.0f, 1.0f); m_pLights[3].m_xmf4Specular = XMFLOAT4(0.3f, 0.3f, 0.3f, 0.0f); m_pLights[3].m_xmf3Position = XMFLOAT3(50.0f, 30.0f, 30.0f); m_pLights[3].m_xmf3Direction = XMFLOAT3(0.0f, 1.0f, 1.0f); m_pLights[3].m_xmf3Attenuation = XMFLOAT3(1.0f, 0.01f, 0.0001f); m_pLights[3].m_fFalloff = 8.0f; m_pLights[3].m_fPhi = (float)cos(XMConvertToRadians(90.0f)); m_pLights[3].m_fTheta = (float)cos(XMConvertToRadians(30.0f)); } void CScene::BuildObjects(ID3D12Device *pd3dDevice, ID3D12GraphicsCommandList *pd3dCommandList) { m_pd3dGraphicsRootSignature = CreateGraphicsRootSignature(pd3dDevice); BuildDefaultLightsAndMaterials(); m_pSkyBox = new CSkyBox(pd3dDevice, pd3dCommandList, m_pd3dGraphicsRootSignature); m_nShaders = 1; m_ppShaders = new CShader*[m_nShaders]; CObjectsShader *pObjectsShader = new CObjectsShader(); pObjectsShader->CreateShader(pd3dDevice, pd3dCommandList, m_pd3dGraphicsRootSignature); pObjectsShader->BuildObjects(pd3dDevice, pd3dCommandList, m_pd3dGraphicsRootSignature, NULL); m_ppShaders[0] = pObjectsShader; CreateShaderVariables(pd3dDevice, pd3dCommandList); } void CScene::ReleaseObjects() { if (m_pd3dGraphicsRootSignature) m_pd3dGraphicsRootSignature->Release(); if (m_ppShaders) { for (int i = 0; i < m_nShaders; i++) { m_ppShaders[i]->ReleaseShaderVariables(); m_ppShaders[i]->ReleaseObjects(); m_ppShaders[i]->Release(); } delete[] m_ppShaders; } if (m_pSkyBox) delete m_pSkyBox; if (m_ppGameObjects) { for (int i = 0; i < m_nGameObjects; i++) if (m_ppGameObjects[i]) m_ppGameObjects[i]->Release(); delete[] m_ppGameObjects; } ReleaseShaderVariables(); if (m_pLights) delete[] m_pLights; } ID3D12RootSignature *CScene::CreateGraphicsRootSignature(ID3D12Device *pd3dDevice) { ID3D12RootSignature *pd3dGraphicsRootSignature = NULL; #ifdef _WITH_STANDARD_TEXTURE_MULTIPLE_DESCRIPTORS D3D12_DESCRIPTOR_RANGE pd3dDescriptorRanges[8]; pd3dDescriptorRanges[0].RangeType = D3D12_DESCRIPTOR_RANGE_TYPE_SRV; pd3dDescriptorRanges[0].NumDescriptors = 1; pd3dDescriptorRanges[0].BaseShaderRegister = 6; //t6: gtxtAlbedoTexture pd3dDescriptorRanges[0].RegisterSpace = 0; pd3dDescriptorRanges[0].OffsetInDescriptorsFromTableStart = D3D12_DESCRIPTOR_RANGE_OFFSET_APPEND; pd3dDescriptorRanges[1].RangeType = D3D12_DESCRIPTOR_RANGE_TYPE_SRV; pd3dDescriptorRanges[1].NumDescriptors = 1; pd3dDescriptorRanges[1].BaseShaderRegister = 7; //t7: gtxtSpecularTexture pd3dDescriptorRanges[1].RegisterSpace = 0; pd3dDescriptorRanges[1].OffsetInDescriptorsFromTableStart = D3D12_DESCRIPTOR_RANGE_OFFSET_APPEND; pd3dDescriptorRanges[2].RangeType = D3D12_DESCRIPTOR_RANGE_TYPE_SRV; pd3dDescriptorRanges[2].NumDescriptors = 1; pd3dDescriptorRanges[2].BaseShaderRegister = 8; //t8: gtxtNormalTexture pd3dDescriptorRanges[2].RegisterSpace = 0; pd3dDescriptorRanges[2].OffsetInDescriptorsFromTableStart = D3D12_DESCRIPTOR_RANGE_OFFSET_APPEND; pd3dDescriptorRanges[3].RangeType = D3D12_DESCRIPTOR_RANGE_TYPE_SRV; pd3dDescriptorRanges[3].NumDescriptors = 1; pd3dDescriptorRanges[3].BaseShaderRegister = 9; //t9: gtxtMetallicTexture pd3dDescriptorRanges[3].RegisterSpace = 0; pd3dDescriptorRanges[3].OffsetInDescriptorsFromTableStart = D3D12_DESCRIPTOR_RANGE_OFFSET_APPEND; pd3dDescriptorRanges[4].RangeType = D3D12_DESCRIPTOR_RANGE_TYPE_SRV; pd3dDescriptorRanges[4].NumDescriptors = 1; pd3dDescriptorRanges[4].BaseShaderRegister = 10; //t10: gtxtEmissionTexture pd3dDescriptorRanges[4].RegisterSpace = 0; pd3dDescriptorRanges[4].OffsetInDescriptorsFromTableStart = D3D12_DESCRIPTOR_RANGE_OFFSET_APPEND; pd3dDescriptorRanges[5].RangeType = D3D12_DESCRIPTOR_RANGE_TYPE_SRV; pd3dDescriptorRanges[5].NumDescriptors = 1; pd3dDescriptorRanges[5].BaseShaderRegister = 11; //t11: gtxtDetailAlbedoTexture pd3dDescriptorRanges[5].RegisterSpace = 0; pd3dDescriptorRanges[5].OffsetInDescriptorsFromTableStart = D3D12_DESCRIPTOR_RANGE_OFFSET_APPEND; pd3dDescriptorRanges[6].RangeType = D3D12_DESCRIPTOR_RANGE_TYPE_SRV; pd3dDescriptorRanges[6].NumDescriptors = 1; pd3dDescriptorRanges[6].BaseShaderRegister = 12; //t12: gtxtDetailNormalTexture pd3dDescriptorRanges[6].RegisterSpace = 0; pd3dDescriptorRanges[6].OffsetInDescriptorsFromTableStart = D3D12_DESCRIPTOR_RANGE_OFFSET_APPEND; pd3dDescriptorRanges[7].RangeType = D3D12_DESCRIPTOR_RANGE_TYPE_SRV; pd3dDescriptorRanges[7].NumDescriptors = 1; pd3dDescriptorRanges[7].BaseShaderRegister = 13; //t13: gtxtSkyBoxTexture pd3dDescriptorRanges[7].RegisterSpace = 0; pd3dDescriptorRanges[7].OffsetInDescriptorsFromTableStart = D3D12_DESCRIPTOR_RANGE_OFFSET_APPEND; D3D12_ROOT_PARAMETER pd3dRootParameters[11]; pd3dRootParameters[0].ParameterType = D3D12_ROOT_PARAMETER_TYPE_CBV; pd3dRootParameters[0].Descriptor.ShaderRegister = 1; //Camera pd3dRootParameters[0].Descriptor.RegisterSpace = 0; pd3dRootParameters[0].ShaderVisibility = D3D12_SHADER_VISIBILITY_ALL; pd3dRootParameters[1].ParameterType = D3D12_ROOT_PARAMETER_TYPE_32BIT_CONSTANTS; pd3dRootParameters[1].Constants.Num32BitValues = 33; pd3dRootParameters[1].Constants.ShaderRegister = 2; //GameObject pd3dRootParameters[1].Constants.RegisterSpace = 0; pd3dRootParameters[1].ShaderVisibility = D3D12_SHADER_VISIBILITY_ALL; pd3dRootParameters[2].ParameterType = D3D12_ROOT_PARAMETER_TYPE_CBV; pd3dRootParameters[2].Descriptor.ShaderRegister = 4; //Lights pd3dRootParameters[2].Descriptor.RegisterSpace = 0; pd3dRootParameters[2].ShaderVisibility = D3D12_SHADER_VISIBILITY_ALL; pd3dRootParameters[3].ParameterType = D3D12_ROOT_PARAMETER_TYPE_DESCRIPTOR_TABLE; pd3dRootParameters[3].DescriptorTable.NumDescriptorRanges = 1; pd3dRootParameters[3].DescriptorTable.pDescriptorRanges = &(pd3dDescriptorRanges[0]); pd3dRootParameters[3].ShaderVisibility = D3D12_SHADER_VISIBILITY_PIXEL; pd3dRootParameters[4].ParameterType = D3D12_ROOT_PARAMETER_TYPE_DESCRIPTOR_TABLE; pd3dRootParameters[4].DescriptorTable.NumDescriptorRanges = 1; pd3dRootParameters[4].DescriptorTable.pDescriptorRanges = &(pd3dDescriptorRanges[1]); pd3dRootParameters[4].ShaderVisibility = D3D12_SHADER_VISIBILITY_PIXEL; pd3dRootParameters[5].ParameterType = D3D12_ROOT_PARAMETER_TYPE_DESCRIPTOR_TABLE; pd3dRootParameters[5].DescriptorTable.NumDescriptorRanges = 1; pd3dRootParameters[5].DescriptorTable.pDescriptorRanges = &(pd3dDescriptorRanges[2]); pd3dRootParameters[5].ShaderVisibility = D3D12_SHADER_VISIBILITY_PIXEL; pd3dRootParameters[6].ParameterType = D3D12_ROOT_PARAMETER_TYPE_DESCRIPTOR_TABLE; pd3dRootParameters[6].DescriptorTable.NumDescriptorRanges = 1; pd3dRootParameters[6].DescriptorTable.pDescriptorRanges = &(pd3dDescriptorRanges[3]); pd3dRootParameters[6].ShaderVisibility = D3D12_SHADER_VISIBILITY_PIXEL; pd3dRootParameters[7].ParameterType = D3D12_ROOT_PARAMETER_TYPE_DESCRIPTOR_TABLE; pd3dRootParameters[7].DescriptorTable.NumDescriptorRanges = 1; pd3dRootParameters[7].DescriptorTable.pDescriptorRanges = &(pd3dDescriptorRanges[4]); pd3dRootParameters[7].ShaderVisibility = D3D12_SHADER_VISIBILITY_PIXEL; pd3dRootParameters[8].ParameterType = D3D12_ROOT_PARAMETER_TYPE_DESCRIPTOR_TABLE; pd3dRootParameters[8].DescriptorTable.NumDescriptorRanges = 1; pd3dRootParameters[8].DescriptorTable.pDescriptorRanges = &(pd3dDescriptorRanges[5]); pd3dRootParameters[8].ShaderVisibility = D3D12_SHADER_VISIBILITY_PIXEL; pd3dRootParameters[9].ParameterType = D3D12_ROOT_PARAMETER_TYPE_DESCRIPTOR_TABLE; pd3dRootParameters[9].DescriptorTable.NumDescriptorRanges = 1; pd3dRootParameters[9].DescriptorTable.pDescriptorRanges = &(pd3dDescriptorRanges[6]); pd3dRootParameters[9].ShaderVisibility = D3D12_SHADER_VISIBILITY_PIXEL; pd3dRootParameters[10].ParameterType = D3D12_ROOT_PARAMETER_TYPE_DESCRIPTOR_TABLE; pd3dRootParameters[10].DescriptorTable.NumDescriptorRanges = 1; pd3dRootParameters[10].DescriptorTable.pDescriptorRanges = &(pd3dDescriptorRanges[7]); pd3dRootParameters[10].ShaderVisibility = D3D12_SHADER_VISIBILITY_PIXEL; #else D3D12_DESCRIPTOR_RANGE pd3dDescriptorRanges[2]; pd3dDescriptorRanges[0].RangeType = D3D12_DESCRIPTOR_RANGE_TYPE_SRV; pd3dDescriptorRanges[0].NumDescriptors = 7; pd3dDescriptorRanges[0].BaseShaderRegister = 6; //t6: gtxtStandardTextures[7] //0:Albedo, 1:Specular, 2:Metallic, 3:Normal, 4:Emission, 5:DetailAlbedo, 6:DetailNormal pd3dDescriptorRanges[0].RegisterSpace = 0; pd3dDescriptorRanges[0].OffsetInDescriptorsFromTableStart = D3D12_DESCRIPTOR_RANGE_OFFSET_APPEND; pd3dDescriptorRanges[1].RangeType = D3D12_DESCRIPTOR_RANGE_TYPE_SRV; pd3dDescriptorRanges[1].NumDescriptors = 1; pd3dDescriptorRanges[1].BaseShaderRegister = 13; //t13: gtxtSkyBoxTexture pd3dDescriptorRanges[1].RegisterSpace = 0; pd3dDescriptorRanges[1].OffsetInDescriptorsFromTableStart = D3D12_DESCRIPTOR_RANGE_OFFSET_APPEND; D3D12_ROOT_PARAMETER pd3dRootParameters[5]; pd3dRootParameters[0].ParameterType = D3D12_ROOT_PARAMETER_TYPE_CBV; pd3dRootParameters[0].Descriptor.ShaderRegister = 1; //Camera pd3dRootParameters[0].Descriptor.RegisterSpace = 0; pd3dRootParameters[0].ShaderVisibility = D3D12_SHADER_VISIBILITY_ALL; pd3dRootParameters[1].ParameterType = D3D12_ROOT_PARAMETER_TYPE_32BIT_CONSTANTS; pd3dRootParameters[1].Constants.Num32BitValues = 33; pd3dRootParameters[1].Constants.ShaderRegister = 2; //GameObject pd3dRootParameters[1].Constants.RegisterSpace = 0; pd3dRootParameters[1].ShaderVisibility = D3D12_SHADER_VISIBILITY_ALL; pd3dRootParameters[2].ParameterType = D3D12_ROOT_PARAMETER_TYPE_CBV; pd3dRootParameters[2].Descriptor.ShaderRegister = 4; //Lights pd3dRootParameters[2].Descriptor.RegisterSpace = 0; pd3dRootParameters[2].ShaderVisibility = D3D12_SHADER_VISIBILITY_ALL; pd3dRootParameters[3].ParameterType = D3D12_ROOT_PARAMETER_TYPE_DESCRIPTOR_TABLE; pd3dRootParameters[3].DescriptorTable.NumDescriptorRanges = 1; pd3dRootParameters[3].DescriptorTable.pDescriptorRanges = &(pd3dDescriptorRanges[0]); pd3dRootParameters[3].ShaderVisibility = D3D12_SHADER_VISIBILITY_PIXEL; pd3dRootParameters[4].ParameterType = D3D12_ROOT_PARAMETER_TYPE_DESCRIPTOR_TABLE; pd3dRootParameters[4].DescriptorTable.NumDescriptorRanges = 1; pd3dRootParameters[4].DescriptorTable.pDescriptorRanges = &(pd3dDescriptorRanges[1]); pd3dRootParameters[4].ShaderVisibility = D3D12_SHADER_VISIBILITY_PIXEL; #endif D3D12_STATIC_SAMPLER_DESC pd3dSamplerDescs[2]; pd3dSamplerDescs[0].Filter = D3D12_FILTER_MIN_MAG_MIP_LINEAR; pd3dSamplerDescs[0].AddressU = D3D12_TEXTURE_ADDRESS_MODE_WRAP; pd3dSamplerDescs[0].AddressV = D3D12_TEXTURE_ADDRESS_MODE_WRAP; pd3dSamplerDescs[0].AddressW = D3D12_TEXTURE_ADDRESS_MODE_WRAP; pd3dSamplerDescs[0].MipLODBias = 0; pd3dSamplerDescs[0].MaxAnisotropy = 1; pd3dSamplerDescs[0].ComparisonFunc = D3D12_COMPARISON_FUNC_ALWAYS; pd3dSamplerDescs[0].MinLOD = 0; pd3dSamplerDescs[0].MaxLOD = D3D12_FLOAT32_MAX; pd3dSamplerDescs[0].ShaderRegister = 0; pd3dSamplerDescs[0].RegisterSpace = 0; pd3dSamplerDescs[0].ShaderVisibility = D3D12_SHADER_VISIBILITY_PIXEL; pd3dSamplerDescs[1].Filter = D3D12_FILTER_MIN_MAG_MIP_LINEAR; pd3dSamplerDescs[1].AddressU = D3D12_TEXTURE_ADDRESS_MODE_CLAMP; pd3dSamplerDescs[1].AddressV = D3D12_TEXTURE_ADDRESS_MODE_CLAMP; pd3dSamplerDescs[1].AddressW = D3D12_TEXTURE_ADDRESS_MODE_CLAMP; pd3dSamplerDescs[1].MipLODBias = 0; pd3dSamplerDescs[1].MaxAnisotropy = 1; pd3dSamplerDescs[1].ComparisonFunc = D3D12_COMPARISON_FUNC_ALWAYS; pd3dSamplerDescs[1].MinLOD = 0; pd3dSamplerDescs[1].MaxLOD = D3D12_FLOAT32_MAX; pd3dSamplerDescs[1].ShaderRegister = 1; pd3dSamplerDescs[1].RegisterSpace = 0; pd3dSamplerDescs[1].ShaderVisibility = D3D12_SHADER_VISIBILITY_PIXEL; D3D12_ROOT_SIGNATURE_FLAGS d3dRootSignatureFlags = D3D12_ROOT_SIGNATURE_FLAG_ALLOW_INPUT_ASSEMBLER_INPUT_LAYOUT | D3D12_ROOT_SIGNATURE_FLAG_DENY_HULL_SHADER_ROOT_ACCESS | D3D12_ROOT_SIGNATURE_FLAG_DENY_DOMAIN_SHADER_ROOT_ACCESS | D3D12_ROOT_SIGNATURE_FLAG_DENY_GEOMETRY_SHADER_ROOT_ACCESS; D3D12_ROOT_SIGNATURE_DESC d3dRootSignatureDesc; ::ZeroMemory(&d3dRootSignatureDesc, sizeof(D3D12_ROOT_SIGNATURE_DESC)); d3dRootSignatureDesc.NumParameters = _countof(pd3dRootParameters); d3dRootSignatureDesc.pParameters = pd3dRootParameters; d3dRootSignatureDesc.NumStaticSamplers = _countof(pd3dSamplerDescs); d3dRootSignatureDesc.pStaticSamplers = pd3dSamplerDescs; d3dRootSignatureDesc.Flags = d3dRootSignatureFlags; ID3DBlob *pd3dSignatureBlob = NULL; ID3DBlob *pd3dErrorBlob = NULL; D3D12SerializeRootSignature(&d3dRootSignatureDesc, D3D_ROOT_SIGNATURE_VERSION_1, &pd3dSignatureBlob, &pd3dErrorBlob); pd3dDevice->CreateRootSignature(0, pd3dSignatureBlob->GetBufferPointer(), pd3dSignatureBlob->GetBufferSize(), __uuidof(ID3D12RootSignature), (void **)&pd3dGraphicsRootSignature); if (pd3dSignatureBlob) pd3dSignatureBlob->Release(); if (pd3dErrorBlob) pd3dErrorBlob->Release(); return(pd3dGraphicsRootSignature); } void CScene::CreateShaderVariables(ID3D12Device *pd3dDevice, ID3D12GraphicsCommandList *pd3dCommandList) { UINT ncbElementBytes = ((sizeof(LIGHTS) + 255) & ~255); //256의 배수 m_pd3dcbLights = ::CreateBufferResource(pd3dDevice, pd3dCommandList, NULL, ncbElementBytes, D3D12_HEAP_TYPE_UPLOAD, D3D12_RESOURCE_STATE_VERTEX_AND_CONSTANT_BUFFER, NULL); m_pd3dcbLights->Map(0, NULL, (void **)&m_pcbMappedLights); } void CScene::UpdateShaderVariables(ID3D12GraphicsCommandList *pd3dCommandList) { ::memcpy(m_pcbMappedLights->m_pLights, m_pLights, sizeof(LIGHT) * m_nLights); ::memcpy(&m_pcbMappedLights->m_xmf4GlobalAmbient, &m_xmf4GlobalAmbient, sizeof(XMFLOAT4)); ::memcpy(&m_pcbMappedLights->m_nLights, &m_nLights, sizeof(int)); } void CScene::ReleaseShaderVariables() { if (m_pd3dcbLights) { m_pd3dcbLights->Unmap(0, NULL); m_pd3dcbLights->Release(); } } void CScene::ReleaseUploadBuffers() { if (m_pSkyBox) m_pSkyBox->ReleaseUploadBuffers(); for (int i = 0; i < m_nShaders; i++) m_ppShaders[i]->ReleaseUploadBuffers(); for (int i = 0; i < m_nGameObjects; i++) m_ppGameObjects[i]->ReleaseUploadBuffers(); } bool CScene::OnProcessingMouseMessage(HWND hWnd, UINT nMessageID, WPARAM wParam, LPARAM lParam) { return(false); } bool CScene::OnProcessingKeyboardMessage(HWND hWnd, UINT nMessageID, WPARAM wParam, LPARAM lParam) { switch (nMessageID) { case WM_KEYDOWN: switch (wParam) { case 'W': m_ppGameObjects[0]->MoveForward(+1.0f); break; case 'S': m_ppGameObjects[0]->MoveForward(-1.0f); break; case 'A': m_ppGameObjects[0]->MoveStrafe(-1.0f); break; case 'D': m_ppGameObjects[0]->MoveStrafe(+1.0f); break; case 'Q': m_ppGameObjects[0]->MoveUp(+1.0f); break; case 'R': m_ppGameObjects[0]->MoveUp(-1.0f); break; default: break; } break; default: break; } return(false); } bool CScene::ProcessInput(UCHAR *pKeysBuffer) { return(false); } void CScene::AnimateObjects(float fTimeElapsed) { for (int i = 0; i < m_nGameObjects; i++) if (m_ppGameObjects[i]) m_ppGameObjects[i]->Animate(fTimeElapsed, NULL); for (int i = 0; i < m_nGameObjects; i++) if (m_ppGameObjects[i]) m_ppGameObjects[i]->UpdateTransform(NULL); for (int i = 0; i < m_nShaders; i++) if (m_ppShaders[i]) m_ppShaders[i]->AnimateObjects(fTimeElapsed); if (m_pLights) { m_pLights[1].m_xmf3Position = m_pPlayer->GetPosition(); m_pLights[1].m_xmf3Direction = m_pPlayer->GetLookVector(); } } void CScene::Render(ID3D12GraphicsCommandList *pd3dCommandList, CCamera *pCamera) { if (m_pd3dGraphicsRootSignature) pd3dCommandList->SetGraphicsRootSignature(m_pd3dGraphicsRootSignature); pCamera->SetViewportsAndScissorRects(pd3dCommandList); pCamera->UpdateShaderVariables(pd3dCommandList); UpdateShaderVariables(pd3dCommandList); D3D12_GPU_VIRTUAL_ADDRESS d3dcbLightsGpuVirtualAddress = m_pd3dcbLights->GetGPUVirtualAddress(); pd3dCommandList->SetGraphicsRootConstantBufferView(2, d3dcbLightsGpuVirtualAddress); //Lights // 970에선 안된다 if (m_pSkyBox) m_pSkyBox->Render(pd3dCommandList, pCamera); for (int i = 0; i < m_nGameObjects; i++) if (m_ppGameObjects[i]) m_ppGameObjects[i]->Render(pd3dCommandList, pCamera); for (int i = 0; i < m_nShaders; i++) if (m_ppShaders[i]) m_ppShaders[i]->Render(pd3dCommandList, pCamera); }
3efecf199269cc689a08f9ce8f8677823005ffad
428989cb9837b6fedeb95e4fcc0a89f705542b24
/erle/ros2_ws/install/include/std_msgs/msg/dds_opensplice/u_int64__type_support.hpp
96c8663405cafd0acc7ecbba774bd77b8c5ef22a
[]
no_license
swift-nav/ros_rover
70406572cfcf413ce13cf6e6b47a43d5298d64fc
308f10114b35c70b933ee2a47be342e6c2f2887a
refs/heads/master
2020-04-14T22:51:38.911378
2016-07-08T21:44:22
2016-07-08T21:44:22
60,873,336
1
2
null
null
null
null
UTF-8
C++
false
false
121
hpp
/home/erle/ros2_ws/build/std_msgs/rosidl_typesupport_opensplice_cpp/std_msgs/msg/dds_opensplice/u_int64__type_support.hpp
d6ff8447ec3690ed844db4b27aa9d4cbe83249c0
8d0947f1dac5aebef957f7fda9a4b3f8e2355235
/2015/main1/main1/work2.cpp
51939f289658182f993a2bbd75cc2b542ba00299
[]
no_license
LuckLittleBoy/Freshman
f6fb8b30415782cc18a3357b813422532759987e
7ab486f6b49333f3b6f9bc739606f38ac00f3cc5
refs/heads/master
2021-05-05T16:03:21.904338
2017-09-12T02:09:09
2017-09-12T02:09:09
103,209,919
0
0
null
null
null
null
GB18030
C++
false
false
521
cpp
#include<iostream> using namespace std; struct complex { double real,image; }; complex input() { complex x; cout<<"请输入一个复数的实部和虚部:"; cin>>x.real>>x.image; return x; } complex mul(complex x,complex y) { complex z; z.real=x.real*y.real-x.image*y.image; z.image=x.image*y.real+x.real*y.image; return z; } void output(complex x) { cout<<x.real<<"+"; cout<<x.image<<"i"<<endl; } void main() { complex a,b; a=input(); b=input(); cout<<"两复数相乘得:"; output(mul(a,b)); }
63133b638a389f5ab7fb65ff1ad0a70069efbfaf
6c77cf237697f252d48b287ae60ccf61b3220044
/aws-cpp-sdk-dynamodb/include/aws/dynamodb/model/AutoScalingTargetTrackingScalingPolicyConfigurationUpdate.h
852ff1df5d03e400f6d798dab33be37d180f5e36
[ "MIT", "Apache-2.0", "JSON" ]
permissive
Gohan/aws-sdk-cpp
9a9672de05a96b89d82180a217ccb280537b9e8e
51aa785289d9a76ac27f026d169ddf71ec2d0686
refs/heads/master
2020-03-26T18:48:43.043121
2018-11-09T08:44:41
2018-11-09T08:44:41
145,232,234
1
0
Apache-2.0
2018-08-30T13:42:27
2018-08-18T15:42:39
C++
UTF-8
C++
false
false
7,646
h
/* * 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. */ #pragma once #include <aws/dynamodb/DynamoDB_EXPORTS.h> namespace Aws { namespace Utils { namespace Json { class JsonValue; class JsonView; } // namespace Json } // namespace Utils namespace DynamoDB { namespace Model { /** * <p>Represents the settings of a target tracking scaling policy that will be * modified.</p><p><h3>See Also:</h3> <a * href="http://docs.aws.amazon.com/goto/WebAPI/dynamodb-2012-08-10/AutoScalingTargetTrackingScalingPolicyConfigurationUpdate">AWS * API Reference</a></p> */ class AWS_DYNAMODB_API AutoScalingTargetTrackingScalingPolicyConfigurationUpdate { public: AutoScalingTargetTrackingScalingPolicyConfigurationUpdate(); AutoScalingTargetTrackingScalingPolicyConfigurationUpdate(Aws::Utils::Json::JsonView jsonValue); AutoScalingTargetTrackingScalingPolicyConfigurationUpdate& operator=(Aws::Utils::Json::JsonView jsonValue); Aws::Utils::Json::JsonValue Jsonize() const; /** * <p>Indicates whether scale in by the target tracking policy is disabled. If the * value is true, scale in is disabled and the target tracking policy won't remove * capacity from the scalable resource. Otherwise, scale in is enabled and the * target tracking policy can remove capacity from the scalable resource. The * default value is false.</p> */ inline bool GetDisableScaleIn() const{ return m_disableScaleIn; } /** * <p>Indicates whether scale in by the target tracking policy is disabled. If the * value is true, scale in is disabled and the target tracking policy won't remove * capacity from the scalable resource. Otherwise, scale in is enabled and the * target tracking policy can remove capacity from the scalable resource. The * default value is false.</p> */ inline void SetDisableScaleIn(bool value) { m_disableScaleInHasBeenSet = true; m_disableScaleIn = value; } /** * <p>Indicates whether scale in by the target tracking policy is disabled. If the * value is true, scale in is disabled and the target tracking policy won't remove * capacity from the scalable resource. Otherwise, scale in is enabled and the * target tracking policy can remove capacity from the scalable resource. The * default value is false.</p> */ inline AutoScalingTargetTrackingScalingPolicyConfigurationUpdate& WithDisableScaleIn(bool value) { SetDisableScaleIn(value); return *this;} /** * <p>The amount of time, in seconds, after a scale in activity completes before * another scale in activity can start. The cooldown period is used to block * subsequent scale in requests until it has expired. You should scale in * conservatively to protect your application's availability. However, if another * alarm triggers a scale out policy during the cooldown period after a scale-in, * application autoscaling scales out your scalable target immediately. </p> */ inline int GetScaleInCooldown() const{ return m_scaleInCooldown; } /** * <p>The amount of time, in seconds, after a scale in activity completes before * another scale in activity can start. The cooldown period is used to block * subsequent scale in requests until it has expired. You should scale in * conservatively to protect your application's availability. However, if another * alarm triggers a scale out policy during the cooldown period after a scale-in, * application autoscaling scales out your scalable target immediately. </p> */ inline void SetScaleInCooldown(int value) { m_scaleInCooldownHasBeenSet = true; m_scaleInCooldown = value; } /** * <p>The amount of time, in seconds, after a scale in activity completes before * another scale in activity can start. The cooldown period is used to block * subsequent scale in requests until it has expired. You should scale in * conservatively to protect your application's availability. However, if another * alarm triggers a scale out policy during the cooldown period after a scale-in, * application autoscaling scales out your scalable target immediately. </p> */ inline AutoScalingTargetTrackingScalingPolicyConfigurationUpdate& WithScaleInCooldown(int value) { SetScaleInCooldown(value); return *this;} /** * <p>The amount of time, in seconds, after a scale out activity completes before * another scale out activity can start. While the cooldown period is in effect, * the capacity that has been added by the previous scale out event that initiated * the cooldown is calculated as part of the desired capacity for the next scale * out. You should continuously (but not excessively) scale out.</p> */ inline int GetScaleOutCooldown() const{ return m_scaleOutCooldown; } /** * <p>The amount of time, in seconds, after a scale out activity completes before * another scale out activity can start. While the cooldown period is in effect, * the capacity that has been added by the previous scale out event that initiated * the cooldown is calculated as part of the desired capacity for the next scale * out. You should continuously (but not excessively) scale out.</p> */ inline void SetScaleOutCooldown(int value) { m_scaleOutCooldownHasBeenSet = true; m_scaleOutCooldown = value; } /** * <p>The amount of time, in seconds, after a scale out activity completes before * another scale out activity can start. While the cooldown period is in effect, * the capacity that has been added by the previous scale out event that initiated * the cooldown is calculated as part of the desired capacity for the next scale * out. You should continuously (but not excessively) scale out.</p> */ inline AutoScalingTargetTrackingScalingPolicyConfigurationUpdate& WithScaleOutCooldown(int value) { SetScaleOutCooldown(value); return *this;} /** * <p>The target value for the metric. The range is 8.515920e-109 to 1.174271e+108 * (Base 10) or 2e-360 to 2e360 (Base 2).</p> */ inline double GetTargetValue() const{ return m_targetValue; } /** * <p>The target value for the metric. The range is 8.515920e-109 to 1.174271e+108 * (Base 10) or 2e-360 to 2e360 (Base 2).</p> */ inline void SetTargetValue(double value) { m_targetValueHasBeenSet = true; m_targetValue = value; } /** * <p>The target value for the metric. The range is 8.515920e-109 to 1.174271e+108 * (Base 10) or 2e-360 to 2e360 (Base 2).</p> */ inline AutoScalingTargetTrackingScalingPolicyConfigurationUpdate& WithTargetValue(double value) { SetTargetValue(value); return *this;} private: bool m_disableScaleIn; bool m_disableScaleInHasBeenSet; int m_scaleInCooldown; bool m_scaleInCooldownHasBeenSet; int m_scaleOutCooldown; bool m_scaleOutCooldownHasBeenSet; double m_targetValue; bool m_targetValueHasBeenSet; }; } // namespace Model } // namespace DynamoDB } // namespace Aws
06f557c38a0dbbe3fdb342c8ef822c7962b14578
2d45bd1404bc1169bc847266071f2b4ce8871c78
/tensorflow/compiler/xla/service/hlo_runner.h
76d8b92bed484381a59d7f54e0a75bb7e75649ee
[ "Apache-2.0" ]
permissive
JuliaComputing/tensorflow
77681ce4aa19cce683d195c18fb6312ed267897b
a2e3dcdb4f439f05592b3e4698cb25a28d85a3b7
refs/heads/master
2021-07-07T06:00:11.905241
2018-09-04T23:52:11
2018-09-04T23:57:41
147,434,640
2
0
Apache-2.0
2018-09-05T00:01:43
2018-09-05T00:01:42
null
UTF-8
C++
false
false
7,654
h
/* Copyright 2017 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_COMPILER_XLA_SERVICE_HLO_RUNNER_H_ #define TENSORFLOW_COMPILER_XLA_SERVICE_HLO_RUNNER_H_ #include <map> #include <memory> #include <set> #include <string> #include <vector> #include "absl/types/span.h" #include "tensorflow/compiler/xla/service/backend.h" #include "tensorflow/compiler/xla/service/compiler.h" #include "tensorflow/compiler/xla/service/computation_placer.h" #include "tensorflow/compiler/xla/service/executable.h" #include "tensorflow/compiler/xla/service/hlo_computation.h" #include "tensorflow/compiler/xla/service/hlo_module.h" #include "tensorflow/compiler/xla/status_macros.h" #include "tensorflow/compiler/xla/statusor.h" #include "tensorflow/compiler/xla/types.h" #include "tensorflow/compiler/xla/util.h" #include "tensorflow/compiler/xla/xla_data.pb.h" #include "tensorflow/core/platform/stream_executor_no_cuda.h" namespace xla { // A base class for running an HloModule. This executes the given HloModule on a // certain backend directly without using the client interface. HloModule can be // explicitly built, or loaded from a serialization file (e.g., hlo proto // file), or parsed from a hlo textual IR string. class HloRunner { public: // The options used to configure a ExecuteReplicated() call. struct ReplicatedExecuteOptions { // The number of devices the HLO module should be replicated onto. int64 num_replicas = 1; // The arguments to be fed to each replica. Since this is used for a // replicated execution, all the arguments are the same for all replicas. std::vector<const Literal*> arguments; // If the HLO module being run has an infeed instruction, this will be the // data which will be fed to it, for as many as infeed_steps steps. const Literal* infeed = nullptr; // The number of times the infeed literal should be fed to the HLO module. // For a clean exit, this should match the iterations-per-loop parameter // used when generating the HLO module proto (that is usually the main // while bounary counter). A value higher then iterations-per-loop would // lead to infeed threads feeding to a gone computation, while a lower // value would trigger a stuck ExecuteReplicated() call (the computation // will be trying to infeed data which will never come). int64 infeed_steps = -1; // The shape of the outfeed operation. If empty, the HLO module does not // generate any outfeed. Shape outfeed_shape; // A pointer to a vector where the outfeed values will be stored. If // nullptr, the values will be read and discarded. std::vector<std::unique_ptr<Literal>>* outfeed_values = nullptr; // Whether the HLO passes should be run on the input module. Usually // saved modules are coming from after the HLO pass pipeline, so triggering // another run will likely cause errors. bool run_hlo_passes = false; }; explicit HloRunner(se::Platform* platform); ~HloRunner(); // Converts an HloModule from the given hlo textual IR string (in // HloModule::ToString format). static StatusOr<std::unique_ptr<HloModule>> CreateModuleFromString( const absl::string_view hlo_string, const DebugOptions& debug_options); // Reads the proto file in xla.HloProto format, creates and returns the // HloModule. static StatusOr<std::unique_ptr<HloModule>> ReadModuleFromBinaryProtoFile( const std::string& filename, const DebugOptions& debug_options); static StatusOr<std::unique_ptr<HloModule>> ReadModuleFromTextProtoFile( const std::string& filename, const DebugOptions& debug_options); // Reads the hlo text dump file in HloModule::ToString format, creates and // returns the HloModule. static StatusOr<std::unique_ptr<HloModule>> ReadModuleFromHloTextFile( const std::string& filename, const DebugOptions& debug_options); // Transfers data between the host and device. StatusOr<ScopedShapedBuffer> TransferLiteralToDevice(const Literal& literal); StatusOr<std::vector<ScopedShapedBuffer>> TransferLiteralsToDevice( const absl::Span<const Literal* const> literals); StatusOr<std::vector<ScopedShapedBuffer>> TransferLiteralsToDevice( const absl::Span<const std::unique_ptr<Literal>> literals); StatusOr<std::unique_ptr<Literal>> TransferLiteralFromDevice( const ShapedBuffer& buffer); // Executes the given module with given literals as input and returns the // result as a Literal. // // If run_hlo_passes is false, the module will be executed without Hlo // optimization. StatusOr<std::unique_ptr<Literal>> Execute( std::unique_ptr<HloModule> module, const absl::Span<const Literal* const> arguments, bool run_hlo_passes = true, ExecutionProfile* profile = nullptr); StatusOr<std::unique_ptr<Literal>> Execute( std::unique_ptr<HloModule> module, const absl::Span<const std::unique_ptr<Literal>> arguments, bool run_hlo_passes = true, ExecutionProfile* profile = nullptr); // As Execute(), but accepts and returns device buffers instead of host // buffers. StatusOr<ScopedShapedBuffer> ExecuteWithDeviceBuffers( std::unique_ptr<HloModule> module, const absl::Span<const ShapedBuffer* const> arguments, bool run_hlo_passes = true, ExecutionProfile* profile = nullptr); StatusOr<ScopedShapedBuffer> ExecuteWithDeviceBuffers( std::unique_ptr<HloModule> module, const absl::Span<const ScopedShapedBuffer> arguments, bool run_hlo_passes = true, ExecutionProfile* profile = nullptr); // Executes a given HLO module into a set of replicas, and returns a map // with the replica number as key, and the corresponding returned literal as // value. StatusOr<std::vector<std::unique_ptr<Literal>>> ExecuteReplicated( std::unique_ptr<HloModule> module, const ReplicatedExecuteOptions& options); // If backend is not created in the constructor, creates and returns the // default backend. If creation fails, crashes the program. // // This creates the backend lazily so it's possible to instantiate an // HloRunner in a program without any backends linked in. Backend& backend(); const Backend& backend() const; private: // Creates an executable object given an HLO module. If run_hlo_passes is // true, the HLO passes will be run before. StatusOr<std::unique_ptr<Executable>> CreateExecutable( std::unique_ptr<HloModule> module, bool run_hlo_passes); // Creates a ServiceExecutableRunOptions object to configure a run on device, // using the provided stream object. If device_assignment is not nullptr, it // will be used to configure the replication parameters. Replicated executions // should pass the device_assignment parameter. ServiceExecutableRunOptions GetServiceRunOptionsForDevice( int64 device, se::Stream* stream, DeviceAssignment* device_assignment); std::unique_ptr<Backend> backend_; }; } // namespace xla #endif // TENSORFLOW_COMPILER_XLA_SERVICE_HLO_RUNNER_H_
70c05c9e38ea6081ee2ab30298c019817df2a08e
2a7e77565c33e6b5d92ce6702b4a5fd96f80d7d0
/fuzzedpackages/sanic/src/solve_LU.cpp
22e459c091b60cd0733f3ce6a382d0cadebaedb1
[]
no_license
akhikolla/testpackages
62ccaeed866e2194652b65e7360987b3b20df7e7
01259c3543febc89955ea5b79f3a08d3afe57e95
refs/heads/master
2023-02-18T03:50:28.288006
2021-01-18T13:23:32
2021-01-18T13:23:32
329,981,898
7
1
null
null
null
null
UTF-8
C++
false
false
501
cpp
#include <RcppEigen.h> // [[Rcpp::depends(RcppEigen)]] // [[Rcpp::export]] Eigen::MatrixXd solve_PPLU( Eigen::Map<Eigen::MatrixXd> a, Eigen::Map<Eigen::MatrixXd> b) { Eigen::PartialPivLU<Eigen::MatrixXd> lu(a); Eigen::MatrixXd x = lu.solve(b); return x; } // [[Rcpp::export]] Eigen::MatrixXd solve_SLU( Eigen::MappedSparseMatrix<double> a, Eigen::Map<Eigen::MatrixXd> b) { Eigen::SparseLU<Eigen::SparseMatrix<double> > lu(a); Eigen::MatrixXd x = lu.solve(b); return x; }
06cf7b2287e62e5e24842037e6d495f1bcc6908a
fa5038cdd23db2c58112963a58f98162eb2153f7
/multisocket.h
a36f641b2c3eb1261ccd5004fe8544d877c9078c
[ "Apache-2.0" ]
permissive
Aharobot/iirlib
7cf67ba9245ca027620b3d0d43c11de0c47caa58
cf167d64e4a2157a31cefca2fe69dcbda1956525
refs/heads/master
2021-01-18T13:02:06.517628
2014-10-13T21:43:32
2014-10-13T21:43:32
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,158
h
// --*- C++ -*-- /* * IIRLIB Multi Socket Connection Modules * * Last modified on 2008 Feb 13th by Tetsunari Inamura * * Copyright (c) Tetsunari Inamura 1998-2008. * All Rights Reserved. */ #ifndef __MULTISOCKET_H__ #define __MULTISOCKET_H__ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <fcntl.h> #include <errno.h> #include <sys/stat.h> #include <time.h> #ifdef WIN32 #include <io.h> #include <winsock2.h> #else #include <unistd.h> #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <netdb.h> #endif #include "glib.h" #include "connection.h" #define MAX_MULTI_SOCKET 3 #define MULTI_SOCKET_NEW_CONNECTION (-1) #define NAMESIZE 64 class MultiSocket { public: MultiSocket (char *str, int port); int Accept (); int Close (int no ); int MaxFD (int max ); int FDSet (fd_set *readfds); int FDISSET (fd_set *readfds, int *result); int DebugPrintFD (); Connection * GetConnection (int n); private: char name[NAMESIZE]; int socket_fd; int port; Connection *connection[MAX_MULTI_SOCKET]; // sequence of Connection instances }; #endif
8ae1f6178628d0d99671b75d8306ffd33e938ffe
07e85c2ce56c3969cfb2ee164d929961e4697e5c
/WuwaFantasy/WuwaFantasy/cFrustum.cpp
47db3fa9ce5ccb4769e9b914b8945bcc0e239e09
[]
no_license
serment7/WuwaFantasy
85ad82e3431e30c4e6086cde3755a755514ce20b
10b5d30e1c19ff3909a56b801df91185029ff106
refs/heads/master
2020-12-24T07:48:48.610156
2019-12-24T13:30:35
2019-12-24T13:30:35
59,941,071
0
1
null
2016-06-05T05:01:25
2016-05-29T12:05:10
C++
SHIFT_JIS
C++
false
false
4,550
cpp
#include "stdafx.h" #include "cFrustum.h" cFrustum::cFrustum() { } cFrustum::~cFrustum() { Release(); } void cFrustum::SetFrustum(const D3DXMATRIXA16 & matV, const D3DXMATRIXA16 & matP) { ST_PC_VERTEX v; v.c = D3DXCOLOR(1, 0, 0, 1); //0,0,0,基?で絶面体を?く m_vecVertex.clear(); v.p = D3DXVECTOR3(-1.0f, -1.0f, 0.0f); m_vecVertex.push_back(v); v.p = D3DXVECTOR3(1.0f, -1.0f, 0.0f); m_vecVertex.push_back(v); v.p = D3DXVECTOR3(1.0f, -1.0f, 1.0f); m_vecVertex.push_back(v); v.p = D3DXVECTOR3(-1.0f, -1.0f, 1.0f); m_vecVertex.push_back(v); v.p = D3DXVECTOR3(-1.0f, 1.0f, 0.0f); m_vecVertex.push_back(v); v.p = D3DXVECTOR3(1.0f, 1.0f, 0.0f); m_vecVertex.push_back(v); v.p = D3DXVECTOR3(1.0f, 1.0f, 1.0f); m_vecVertex.push_back(v); v.p = D3DXVECTOR3(-1.0f, 1.0f, 1.0f); m_vecVertex.push_back(v); D3DXMATRIXA16 matVP, matInv; matVP = matV * matP; D3DXMatrixInverse(&matInv, NULL, &matVP); for (size_t i = 0; i < m_vecVertex.size(); ++i) D3DXVec3TransformCoord(&m_vecVertex[i].p, &m_vecVertex[i].p, &matInv); m_vPos = (m_vecVertex[0].p + m_vecVertex[5].p) / 2.0f; /* g_pD3DDevice->CreateVertexBuffer( m_vecVertex.size() * sizeof(ST_PC_VERTEX) , D3DUSAGE_WRITEONLY , ST_PC_VERTEX::FVF , D3DPOOL_MANAGED , &m_pVB , 0 ); ST_PC_VERTEX* vertices; m_pVB->Lock(0, 0, (LPVOID*)&vertices, 0); for (size_t j = 0; j < m_vecVertex.size(); ++j) vertices[j] = m_vecVertex[j]; m_pVB->Unlock(); */ m_vecPlane.clear(); D3DXPLANE p; D3DXPlaneFromPoints(&p, &m_vecVertex[4].p, &m_vecVertex[7].p, &m_vecVertex[6].p); m_vecPlane.push_back(p);//top D3DXPlaneFromPoints(&p, &m_vecVertex[0].p, &m_vecVertex[1].p, &m_vecVertex[2].p); m_vecPlane.push_back(p);//bottom D3DXPlaneFromPoints(&p, &m_vecVertex[0].p, &m_vecVertex[4].p, &m_vecVertex[5].p); m_vecPlane.push_back(p);//near D3DXPlaneFromPoints(&p, &m_vecVertex[2].p, &m_vecVertex[6].p, &m_vecVertex[7].p); m_vecPlane.push_back(p);//far D3DXPlaneFromPoints(&p, &m_vecVertex[0].p, &m_vecVertex[3].p, &m_vecVertex[7].p); m_vecPlane.push_back(p);//left D3DXPlaneFromPoints(&p, &m_vecVertex[1].p, &m_vecVertex[5].p, &m_vecVertex[6].p); m_vecPlane.push_back(p);//right } bool cFrustum::IsIn(D3DXVECTOR3 * pV) { float fDist = 0.0f; fDist = D3DXPlaneDotCoord(&m_vecPlane[3], pV); if (fDist > 0) return false; fDist = D3DXPlaneDotCoord(&m_vecPlane[4], pV); if (fDist > 0) return false; fDist = D3DXPlaneDotCoord(&m_vecPlane[5], pV); if (fDist > 0) return false; return true; } bool cFrustum::IsInSphere(BoundingSphere * sphere) { float fDist = 0.0f; fDist = D3DXPlaneDotCoord(&m_vecPlane[3], &sphere->vCenter); if (fDist > sphere->fRadius) return false; fDist = D3DXPlaneDotCoord(&m_vecPlane[4], &sphere->vCenter); if (fDist > sphere->fRadius) return false; fDist = D3DXPlaneDotCoord(&m_vecPlane[5], &sphere->vCenter); if (fDist > sphere->fRadius) return false; return true; } void cFrustum::Release() { SAFE_RELEASE(m_pVB); SAFE_RELEASE(m_pIB); } void cFrustum::Draw() { /* g_pD3DDevice->CreateIndexBuffer( 36 * sizeof(DWORD) , D3DUSAGE_WRITEONLY , D3DFMT_INDEX16 , D3DPOOL_MANAGED , &m_pIB , 0 ); DWORD* indices = 0; m_pIB->Lock(0, 0, (LPVOID*)&indices, 0); indices[0] = 0; indices[1] = 1; indices[2] = 2; indices[3] = 0; indices[4] = 2; indices[5] = 3; indices[6] = 4; indices[7] = 7; indices[8] = 6; indices[9] = 4; indices[10] = 6; indices[11] = 5; indices[12] = 1; indices[13] = 5; indices[14] = 6; indices[15] = 1; indices[16] = 6; indices[17] = 2; indices[18] = 0; indices[19] = 3; indices[20] = 7; indices[21] = 0; indices[22] = 7; indices[23] = 4; indices[24] = 0; indices[25] = 4; indices[26] = 5; indices[27] = 0; indices[28] = 5; indices[29] = 1; indices[30] = 3; indices[31] = 7; indices[32] = 6; indices[33] = 3; indices[34] = 6; indices[35] = 2; m_pIB->Unlock(); g_pD3DDevice->SetStreamSource(0, m_pVB, 0, sizeof(ST_PC_VERTEX)); g_pD3DDevice->SetIndices(m_pIB); g_pD3DDevice->SetFVF(ST_PC_VERTEX::FVF); g_pD3DDevice->DrawIndexedPrimitive(D3DPT_TRIANGLELIST, 0, 0, m_vecVertex.size(), 0, (m_vecVertex.size() * 3) / 2); */ } void cFrustum::SetCamPos(const D3DXVECTOR3 & camPos) { m_vPos = camPos; D3DXMATRIXA16 mat; //カメラの?ジション値をトレンスレ?ションしカメラのワ?ルド値を生成する D3DXMatrixTranslation(&mat, m_vPos.x, m_vPos.y, m_vPos.z); m_matWorld = mat; }
16ad5fe2bcc934c0c807966a81d6708b26100631
47075e364b86f553a56cc2b0d04c476d282908f8
/AClass/LiteHTMLAttributes.cpp
b33959e53c5fb9cd742b701eba86a9d2edf1b8ff
[ "MIT" ]
permissive
quantxyz/approval_list
b5d6af8b4adff176ea515020f8ca12f1b0cc5bf3
7e37164f1c93374f22a27ae84948890d90143c45
refs/heads/master
2022-05-01T06:00:07.692672
2016-01-24T17:00:57
2016-01-24T17:00:57
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,638
cpp
/** * PROJECT - HTML Reader Class Library * * LiteHTMLAttributes.cpp * * Written By Gurmeet S. Kochar <[email protected]> * Copyright (c) 2004. All rights reserved. * * This code may be used in compiled form in any way you desire * (including commercial use). The code may be redistributed * unmodified by any means PROVIDING it is not sold for profit * without the authors written consent, and providing that this * notice and the authors name and all copyright notices remains * intact. However, this file and the accompanying source code may * not be hosted on a website or bulletin board without the authors * written permission. * * This file is provided "AS IS" with no expressed or implied warranty. * The author accepts no liability for any damage/loss of business that * this product may cause. * * Although it is not necessary, but if you use this code in any of * your application (commercial or non-commercial), please INFORM me * so that I may know how useful this library is. This will encourage * me to keep updating it. */ #include "stdafx.h" #include "LiteHTMLAttributes.h" #ifdef _DEBUG # define new DEBUG_NEW # undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif // _DEBUG #pragma warning(push, 4) const COLORREF CLiteHTMLElemAttr::_clrInvalid = (COLORREF)0xFFFFFFFF; const unsigned short CLiteHTMLElemAttr::_percentMax = USHRT_MAX; // the reason behind setting the block size of our collection // to 166 is that we have a total of 166 known named colors CLiteHTMLElemAttr::CNamedColors CLiteHTMLElemAttr::_namedColors(166 /* block size */); #pragma warning(pop)
9c79ee7216fed9040416e9641dd258d8c59feb77
59c47e1f8b2738fc2b824462e31c1c713b0bdcd7
/006-All_Test_Demo/000-vital/000-sodimas_notice/000-code/TFT_4.0_4.3_switch/splashform.h
850744411cfef25580327e9f544ccfb04b21a1ae
[]
no_license
casterbn/Qt_project
8efcc46e75e2bbe03dc4aeaafeb9e175fb7b04ab
03115674eb3612e9dc65d4fd7bcbca9ba27f691c
refs/heads/master
2021-10-19T07:27:24.550519
2019-02-19T05:26:22
2019-02-19T05:26:22
null
0
0
null
null
null
null
UTF-8
C++
false
false
305
h
#ifndef SPLASHFORM_H #define SPLASHFORM_H #include <QWidget> namespace Ui { class SplashForm; } class SplashForm : public QWidget { Q_OBJECT public: explicit SplashForm(QWidget *parent = 0); ~SplashForm(); private: Ui::SplashForm *ui; }; #endif // SPLASHFORM_H
0558a436bf94f4d50863ca00755d42c18f1ac7ab
2400d76a8041b1240b12e2beac9723d2047a47a6
/library/include/model/typedefs.h
920bcc60143bd340d7d6ad9db42959718b46a1ac
[]
no_license
michalsuminski/Rental-Logic
be1b8fd7b722f784628deb429f152dc749a3083a
b75cfcd83dfecfdac07de2fc92c66464201dd0ad
refs/heads/main
2023-04-02T07:24:30.873604
2021-04-15T12:18:33
2021-04-15T12:18:33
355,577,362
0
0
null
null
null
null
UTF-8
C++
false
false
631
h
#ifndef CARRENTALPROJECT_TYPEDEFS_H #define CARRENTALPROJECT_TYPEDEFS_H #include <memory> #include <functional> class Address; class Client; class Item; class Rent; typedef std::shared_ptr <Client> ClientPtr; typedef std::shared_ptr <Rent> RentPtr; typedef std::shared_ptr <Item> ItemPtr; typedef std::shared_ptr <Address> AddressPtr; typedef std::function<bool(ClientPtr)> ClientPredicate; typedef std::function<bool(RentPtr)> RentPredicate; // obojetnie jak zdefiniuje funkcje byle by sie zgadzaly typy przyjmuje RentPtr zwraca bool typedef std::function<bool(ItemPtr)> ItemPredicate; #endif //CARRENTALPROJECT_TYPEDEFS_H
caa947584389ec00a2169b6e3b6fb8519df5d95b
d14650b04365c11a5d43c33f2acd4bbfae6b25b2
/app/src/AppMesh.cpp
63cb87a3c45424465c1c99726fa0655268dac3ba
[ "Apache-2.0" ]
permissive
ChaseDream2015/Viry3D
6a16458b588ba552ac1d2e5e1533bc627a06a123
b10f7b1259d246f4bdb9e389a24820ef86d5660f
refs/heads/master
2021-06-27T12:35:35.516019
2017-09-15T16:42:16
2017-09-15T16:42:16
null
0
0
null
null
null
null
UTF-8
C++
false
false
2,915
cpp
/* * Viry3D * Copyright 2014-2017 by Stack - [email protected] * * 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 "Main.h" #include "Application.h" #include "GameObject.h" #include "Resource.h" #include "graphics/Camera.h" #include "graphics/Mesh.h" #include "graphics/Material.h" #include "graphics/Texture2D.h" #include "renderer/MeshRenderer.h" #include "ui/UILabel.h" #include "time/Time.h" using namespace Viry3D; class AppMesh : public Application { public: AppMesh(); virtual void Start(); virtual void Update(); WeakRef<GameObject> m_cube; float m_rotate_deg; }; #if 0 VR_MAIN(AppMesh); #endif AppMesh::AppMesh() { this->SetName("Viry3D::AppMesh"); this->SetInitSize(800, 600); } void AppMesh::Start() { this->CreateFPSUI(20, 1, 1); auto camera = GameObject::Create("camera")->AddComponent<Camera>(); camera->GetTransform()->SetPosition(Vector3(0, 6, -10)); camera->GetTransform()->SetRotation(Quaternion::Euler(30, 0, 0)); camera->SetCullingMask(1 << 0); auto mesh = Mesh::Create(); mesh->vertices.Add(Vector3(-1, 1, -1)); mesh->vertices.Add(Vector3(-1, -1, -1)); mesh->vertices.Add(Vector3(1, -1, -1)); mesh->vertices.Add(Vector3(1, 1, -1)); mesh->vertices.Add(Vector3(-1, 1, 1)); mesh->vertices.Add(Vector3(-1, -1, 1)); mesh->vertices.Add(Vector3(1, -1, 1)); mesh->vertices.Add(Vector3(1, 1, 1)); mesh->uv.Add(Vector2(0, 0)); mesh->uv.Add(Vector2(0, 1)); mesh->uv.Add(Vector2(1, 1)); mesh->uv.Add(Vector2(1, 0)); mesh->uv.Add(Vector2(1, 0)); mesh->uv.Add(Vector2(1, 1)); mesh->uv.Add(Vector2(0, 1)); mesh->uv.Add(Vector2(0, 0)); unsigned short triangles[] = { 0, 1, 2, 0, 2, 3, 3, 2, 6, 3, 6, 7, 7, 6, 5, 7, 5, 4, 4, 5, 1, 4, 1, 0, 4, 0, 3, 4, 3, 7, 1, 5, 6, 1, 6, 2 }; mesh->triangles.AddRange(triangles, 36); auto mat = Material::Create("Diffuse"); mesh->Update(); auto obj = GameObject::Create("mesh"); auto renderer = obj->AddComponent<MeshRenderer>(); renderer->SetSharedMesh(mesh); renderer->SetSharedMaterial(mat); Resource::LoadTextureAsync("Assets/AppMesh/wow.png.tex", [=] (Ref<Object> obj) { auto tex = RefCast<Texture>(obj); mat->SetMainTexture(tex); }); m_cube = obj; m_rotate_deg = 0; Resource::LoadGameObjectAsync("Assets/AppMesh/plane.prefab"); } void AppMesh::Update() { m_cube.lock()->GetTransform()->SetLocalRotation(Quaternion::Euler(0, m_rotate_deg, 0)); m_rotate_deg += 30 * Time::GetDeltaTime(); }
84e370147038858df7cad2347e4653ffdca337a2
21fd3fa22e2483acf2c078aede31ab4cdbf19a3d
/src/core/transformations/morph_openclose.cpp
99292eb57650cfc0ae8a0b7021b3cd6935199852
[]
no_license
andre-wojtowicz/image-processing-project-student
449f751f3a05b994f88ba24addc0943ff5f7cf2c
9258c9a0f14953bd6b048b93b6a9e1cb33db2722
refs/heads/master
2021-01-10T14:30:47.377958
2019-10-14T08:37:13
2019-10-14T08:37:13
52,097,014
6
1
null
null
null
null
UTF-8
C++
false
false
1,024
cpp
#include "morph_openclose.h" #include "morph_erode.h" #include "morph_dilate.h" MorphOpenClose::MorphOpenClose(PNM* img) : MorphologicalOperator(img), m_type(Open) { } MorphOpenClose::MorphOpenClose(PNM* img, ImageViewer* iv) : MorphologicalOperator(img, iv), m_type(Open) { } PNM* MorphOpenClose::transform() { int size = getParameter("size").toInt();; SE shape = (SE) getParameter("shape").toInt(); m_type = (Type) getParameter("type").toInt(); qDebug() << Q_FUNC_INFO << "Not implemented yet!"; return 0; } PNM* MorphOpenClose::erode(PNM* image, int size, SE shape) { MorphErode e(image, getSupervisor()); e.setParameter("silent", true); e.setParameter("shape", shape); e.setParameter("size", size); return e.transform(); } PNM* MorphOpenClose::dilate(PNM* image, int size, SE shape) { MorphDilate e(image, getSupervisor()); e.setParameter("silent", true); e.setParameter("shape", shape); e.setParameter("size", size); return e.transform(); }
bacfbdf112bdb9b3e4b8c4d0a797ce6a811f4ab4
b65acdd4e28bac5b0b0cc088bded08cc80437ad8
/MVSProg/Task15/Project1/Project1/Source.cpp
bd5fc8c5a4e9f48ee35ebf210ca70debefacdac5
[]
no_license
YulianStrus/Examples-of-academic-homeworks
44794bb234626319810f444a3115557b4e59d54f
f2fb2b5e02f069ff8f0cbc1a95c472ad2becad4c
refs/heads/master
2023-05-27T16:09:41.220326
2021-06-02T10:04:07
2021-06-02T10:04:07
313,245,187
0
0
null
null
null
null
UTF-8
C++
false
false
1,735
cpp
#include "iostream" using namespace std; void main() { int n, l, j, i, h, k=1; char s; cout << "Choose the type of rectangular triangle: " << endl; cout << "1 +\t " << "2 +\t " << "3 +++\t " << "4 +++\t " << endl; cout << " ++\t " << " ++\t " << " ++\t " << " ++\t " << endl; cout << " +++\t " << " +++\t " << " + \t " << " +\t " << endl; cin >> n; switch (n) { case 1: cout << "Enter the length of the catheter " << endl; cin >> l; cout << "Enter symbol " << endl; cin >> s; h = l; for (i = 1; i <= h; i++) { for (j = 1; j <= l; j++) if (j >= k) { cout << " "; } else cout << s; cout << endl; k++; } break; case 2: cout << "Enter the length of the catheter " << endl; cin >> l; cout << "Enter symbol " << endl; cin >> s; h = l; k = l; for (i = 1; i <= h; i++) { for (j = 1; j <= l; j++) if (j < k) { cout << " "; } else cout << s; cout << endl; k--; } break; case 3: cout << "Enter the length of the catheter " << endl; cin >> l; cout << "Enter symbol " << endl; cin >> s; h = l; for (i = 1; i <= h; i++) { for (j = 1; j <= l; j++) cout << s; l--; cout << endl; } break; case 4: cout << "Enter the length of the catheter " << endl; cin >> l; cout << "Enter symbol " << endl; cin >> s; h = l; for (i = 1; i <= h; i++) { for (j = 1; j <= l; j++) if (j >= k) { cout << s; } else cout << " "; cout << endl; k++; } break; default: cout << "Incorrect choice!!!"; break; } system("pause"); }
75296b5c1ed5b2a5a9ee0d3c12725705a23213ec
98317d55cb8053131e700f5ad20c2f91481db4cd
/src/amount.h
3027e070bc58997debfbb656d62bf7f306addbad
[ "MIT" ]
permissive
fertcoin/fertcoin
4816ad7c08a64698177f0cc7d1e581dc1b954c85
1d644a3a15baea52acd45e82531bb1a839787d80
refs/heads/main
2023-07-10T01:22:09.630763
2021-08-10T21:37:17
2021-08-10T21:37:17
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,995
h
// Copyright (c) 2009-2010 Satoshi Nakamoto // Copyright (c) 2009-2014 The Bitcoin developers // Copyright (c) 2017 The PIVX developers // Copyright (c) 2018 The fertcoin developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_AMOUNT_H #define BITCOIN_AMOUNT_H #include "serialize.h" #include <stdlib.h> #include <string> typedef int64_t CAmount; static const CAmount COIN = 100000000; static const CAmount CENT = 1000000; /** Type-safe wrapper class to for fee rates * (how much to pay based on transaction size) */ class CFeeRate { private: CAmount nSatoshisPerK; // unit is satoshis-per-1,000-bytes public: CFeeRate() : nSatoshisPerK(0) {} explicit CFeeRate(const CAmount& _nSatoshisPerK) : nSatoshisPerK(_nSatoshisPerK) {} CFeeRate(const CAmount& nFeePaid, size_t nSize); CFeeRate(const CFeeRate& other) { nSatoshisPerK = other.nSatoshisPerK; } CAmount GetFee(size_t size) const; // unit returned is satoshis CAmount GetFeePerK() const { return GetFee(1000); } // satoshis-per-1000-bytes friend bool operator<(const CFeeRate& a, const CFeeRate& b) { return a.nSatoshisPerK < b.nSatoshisPerK; } friend bool operator>(const CFeeRate& a, const CFeeRate& b) { return a.nSatoshisPerK > b.nSatoshisPerK; } friend bool operator==(const CFeeRate& a, const CFeeRate& b) { return a.nSatoshisPerK == b.nSatoshisPerK; } friend bool operator<=(const CFeeRate& a, const CFeeRate& b) { return a.nSatoshisPerK <= b.nSatoshisPerK; } friend bool operator>=(const CFeeRate& a, const CFeeRate& b) { return a.nSatoshisPerK >= b.nSatoshisPerK; } std::string ToString() const; ADD_SERIALIZE_METHODS; template <typename Stream, typename Operation> inline void SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) { READWRITE(nSatoshisPerK); } }; #endif // BITCOIN_AMOUNT_H
38fad3e6f6bafefad6389fa3e89698cea730ca5a
088ab92e4f8251fdceef9966149ea50f027f18c0
/Assignment1/Q3.cpp
2f1efb1c00be8e259f1c21d59fef47789dfe7de4
[]
no_license
aashishbansal23/DataStructures-Algorithm-Practice
d221e9ececb360d781e33925e00222401fb501c8
53fcc0c881cbb720c0878c3dbaaa4330506f0f9b
refs/heads/master
2023-05-03T23:43:20.453563
2021-05-24T16:32:09
2021-05-24T16:32:09
313,001,031
2
0
null
2021-03-17T15:42:48
2020-11-15T09:52:41
C++
UTF-8
C++
false
false
124
cpp
#include<stdio.h> int main() { int i; int arr[5] = {1}; for(i=0; i<5; i++){ printf("%d\n", arr[i]); } return 0; }
c5d8a95187a65008742523847a9cb0ccddad6afd
5bebabc46810b6d211daf9707ecb537534595f9a
/repositories/araSoft/programs/testing/dbWriteIdentify.cc
45bf5b842e59839afd52efb78e37e7e3dc3b9a82
[]
no_license
osu-particle-astrophysics/ara-daq
9b5842f4f1ed21ada0d5796123db5001f569603e
a35d2fb89fa7957e153210f9884ecc4d9af0d4cf
refs/heads/master
2021-01-23T14:31:10.499761
2017-08-23T15:30:28
2017-08-23T15:30:28
93,254,814
0
0
null
null
null
null
UTF-8
C++
false
false
8,654
cc
// // dbWriteIdentify writes a daughterboard's identification EEPROM page 0. // // The remaining pages are undefined right now: there are several // possibilities: either calibration data (unlikely given that it's only // a 32k EEPROM and there are a lot more cal points for a DDA), // operation data (more likely - as in you store the nominal operating // Vdly/Vadj for a DDA, and the nominal thresholds for a TDA), and // maybe tracking data as well. // // dbWriteIdentify takes a file containing the write page info, in ASCII. // Format is one entry per line: // line 0: page 0 version (max 255) // line 1: daughterboard name (max 6 characters) // line 2: daughterboard revision (max 1 character) // line 3: daughterboard serial number (max 8 characters) // line 4: daughterboard build date (max 8 characters- MM/DD/YY) // line 5: daughterboard build location/by (max 8 characters) // line 6: cal date (same as build date) // line 7: cal by (same as build by) // line 8: commission date (same as build date) // line 9: installation location (max 8 characters) #include <iostream> #include <fstream> #include <cstdlib> #include <vector> #include <string> #include <iomanip> #include <sstream> extern "C" { #include "araSoft.h" #include "atriComLib/atriCom.h" } #include <getopt.h> // why don't we have this defined anywhere. Hmm. #define ATRI_NUM_DAUGHTERS 4 #include <unistd.h> #include <cstdio> #include <cstdlib> #include <errno.h> #include <sys/types.h> #include <cstring> #include <sys/socket.h> #include <sys/un.h> using std::vector; using std::string; using std::ifstream; using std::cerr; using std::cout; using std::endl; using std::hex; using std::dec; template <class T> bool from_string(T& t, const std::string& s, std::ios_base& (*f)(std::ios_base&)) { std::istringstream iss(s); return !(iss >> f >> t).fail(); } int main(int argc, char **argv) { char page0[64]; bool eos = false; int i; const char *p; bool test_mode = false; bool read_mode = false; int daughter = -1; int retval; int type = -1; // Command line processing: // We require a page 0 file name, plus a --daughter (or -D) argument // and a --type (or -t) argument. -t can be ASCII ("DDA","TDA","DRSV9", // or "DRSV10") // If --simulate (or -s) is specified, we don't actually write (or even open // the control socket), just dump what we would write. // If --read (or -r) is specified (conflicts with --test) we instead read // the page 0 file name and write it into the same format text file. static struct option options[] = { {"simulate", no_argument, 0, 's'}, {"read", no_argument, 0, 'r'}, {"daughter", required_argument, 0, 'D'}, {"type", required_argument, 0, 't'} }; int c; while (1) { int option_index; c = getopt_long(argc, argv, "srD:t:", options, &option_index); if (c == -1) break; switch (c) { case 's': test_mode = true; break; case 'r': read_mode = true; break; case 'D': daughter = strtoul(optarg, NULL, 0); if (daughter < 1 || daughter > ATRI_NUM_DAUGHTERS) { cerr << argv[0] << " --daughter options are 1-4" << endl; return 1; } // make it zero based daughter--; break; case 't': if (!strcmp(optarg, "DDA")) type = 0; if (!strcmp(optarg, "TDA")) type = 1; if (!strcmp(optarg, "DRSV9")) type = 2; if (!strcmp(optarg, "DRSV10")) type = 3; if (type < 0) { char *rp; type = strtoul(optarg, &rp, 0); if (rp == optarg || (type > 3)) { cerr << argv[0] << " --type options are DDA, TDA, DRSV9, DRSV10, or 0-3" << endl; return 1; } } break; default: exit(1); } } if (test_mode && read_mode) { cerr << argv[0] << " : --read and --simulate are exclusive" << endl; return 1; } if (optind == argc) { cerr << argv[0] << ": need a page 0 info file name" << endl; return 1; } if (daughter < 0 || type < 0) { cerr << argv[0] << ": need --daughter (-D) and --type (-t) options" << endl; return 1; } vector<string> text_file; string temp; if (!read_mode) { ifstream ifs(argv[optind]); if (!ifs.is_open()) { cerr << argv[0] << ": " << argv[optind] << " is not readable" << endl; return 1; } while (getline(ifs, temp)) text_file.push_back(temp); unsigned int page0_version; if (!from_string<unsigned int>(page0_version, text_file[0], std::dec)) { cerr << argv[0] << ": line 0 must be a decimal number from 0-255" << endl; exit(1); } if (page0_version > 255) { cerr << argv[0] << ": line 0 must be a decimal number from 0-255" << endl; exit(1); } cout << "Page 0 Version: " << page0_version << endl; cout << "Daughterboard Name: " << text_file[1] << endl; cout << "Revision: " << text_file[2] << endl; cout << "Serial Number: " << text_file[3] << endl; cout << "Build Date: " << text_file[4] << endl; cout << "Build By: " << text_file[5] << endl; cout << "Cal Date: " << text_file[6] << endl; cout << "Cal By: " << text_file[7] << endl; cout << "Commission Date: " << text_file[8] << endl; cout << "Installation Location: " << text_file[9] << endl; cout << endl; cout << "Raw Page 0: " << endl; // 0, 1, 2 are chars 0->7 page0[0] = (unsigned char) page0_version; eos = false; p = text_file[1].c_str(); for (i=0;i<6;i++) { if (!eos) page0[1+i] = p[i]; else page0[1+i] = 0; if (p[i] == 0x00) eos = true; } eos = false; p = text_file[2].c_str(); page0[7] = p[0]; // 3 is chars 8-15 p = text_file[3].c_str(); eos = false; for (i=0;i<8;i++) { if (!eos) page0[8+i] = p[i]; else page0[8+i] = 0x00; if (p[i] == 0x00) eos = true; } // 4 is 16-23 p = text_file[4].c_str(); eos = false; for (i=0;i<8;i++) { if (!eos) page0[16+i] = p[i]; else page0[16+i] = 0x00; if (p[i] == 0x00) eos = true; } // 5 is 24-31 p = text_file[5].c_str(); eos = false; for (i=0;i<8;i++) { if (!eos) page0[24+i] = p[i]; else page0[24+i] = 0x00; if (p[i] == 0x00) eos = true; } // 32-39 p = text_file[6].c_str(); eos = false; for (i=0;i<8;i++) { if (!eos) page0[32+i] = p[i]; else page0[32+i] = 0x00; if (p[i] == 0x00) eos = true; } // 40-47 p = text_file[7].c_str(); eos = false; for (i=0;i<8;i++) { if (!eos) page0[40+i] = p[i]; else page0[40+i] = 0x00; if (p[i] == 0x00) eos = true; } // 48-55 p = text_file[8].c_str(); eos = false; for (i=0;i<8;i++) { if (!eos) page0[48+i] = p[i]; else page0[48+i] = 0x00; if (p[i] == 0x00) eos = true; } // 56-63 p = text_file[9].c_str(); eos = false; for (i=0;i<8;i++) { if (!eos) page0[56+i] = p[i]; else page0[56+i] = 0x00; if (p[i] == 0x00) eos = true; } for (i=0;i<64;i++) { cout << "0x" << hex << (((unsigned int) (page0[i]))&0xFF); if (!((i+1)%8)) cout << endl; else cout << " "; } if (!test_mode) { cout << "Attempting to write page0 of daughter type " << atriDaughterTypeStrings[type] << " on stack " << atriDaughterStackStrings[daughter] << " at address " << std::hex << (unsigned int) atriEepromAddressMap[type] << endl; // We now have 64 bytes to write to the EEPROM. int auxFd = openConnectionToAtriControlSocket(); if (auxFd < 0) { return 1; } if (atriEepromAddressMap[type] == 0x00) { cerr << " -- I have no idea what the EEPROM address is on a " << atriDaughterTypeStrings[type] << endl; close(auxFd); return 1; } // we can only write 16 bytes at a time // wow do I need to rewrite the I2C controller. // so we actually only write 8 bytes at a time to keep things simple for (int i=0;i<16;i++) { uint8_t buf[10]; buf[0] = 0x00; buf[1] = i*4; memcpy(&(buf[2]), page0+i*4, 4); if ((retval = writeToAtriI2C(auxFd, (AtriDaughterStack_t) daughter, atriEepromAddressMap[type], 6, buf))) { cerr << " -- Error " << retval << " writing to page 0 (" << i*4 << "-" << i*4+3 << ")" << endl; close(auxFd); return 1; } usleep(500); } cout << " -- Write successful." << endl; closeConnectionToAtriControlSocket(auxFd); } } cout <<endl; return 0; }
ee0b3059e9c58bbc3b38881c4eb026acd98dc3fc
6101cf5997a2ee6b526d731fe094eb8fe102ddbf
/src/qt/recentrequeststablemodel.h
38a0694cfff2900a0fb70d6df384a8a7f6481f45
[ "MIT" ]
permissive
expicoin/expicore
d82458b54791f0f1b90fe394aa8c3f015b70e4d2
00461a9c66b2c80e6fa98601e5adabc7c50ff056
refs/heads/master
2020-05-23T09:01:43.348834
2019-05-26T13:29:47
2019-05-26T13:29:47
186,699,519
3
2
null
null
null
null
UTF-8
C++
false
false
3,305
h
// Copyright (c) 2011-2014 The Bitcoin developers // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_QT_RECENTREQUESTSTABLEMODEL_H #define BITCOIN_QT_RECENTREQUESTSTABLEMODEL_H #include "walletmodel.h" #include <QAbstractTableModel> #include <QDateTime> #include <QStringList> class CWallet; class RecentRequestEntry { public: RecentRequestEntry() : nVersion(RecentRequestEntry::CURRENT_VERSION), id(0) {} static const int CURRENT_VERSION = 1; int nVersion; int64_t id; QDateTime date; SendCoinsRecipient recipient; ADD_SERIALIZE_METHODS; template <typename Stream, typename Operation> inline void SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) { unsigned int nDate = date.toTime_t(); READWRITE(this->nVersion); nVersion = this->nVersion; READWRITE(id); READWRITE(nDate); READWRITE(recipient); if (ser_action.ForRead()) date = QDateTime::fromTime_t(nDate); } }; class RecentRequestEntryLessThan { public: RecentRequestEntryLessThan(int nColumn, Qt::SortOrder fOrder) : column(nColumn), order(fOrder) {} bool operator()(RecentRequestEntry& left, RecentRequestEntry& right) const; private: int column; Qt::SortOrder order; }; /** Model for list of recently generated payment requests / expi: URIs. * Part of wallet model. */ class RecentRequestsTableModel : public QAbstractTableModel { Q_OBJECT public: explicit RecentRequestsTableModel(CWallet* wallet, WalletModel* parent); ~RecentRequestsTableModel(); enum ColumnIndex { Date = 0, Label = 1, Message = 2, Amount = 3, NUMBER_OF_COLUMNS }; /** @name Methods overridden from QAbstractTableModel @{*/ int rowCount(const QModelIndex& parent) const; int columnCount(const QModelIndex& parent) const; QVariant data(const QModelIndex& index, int role) const; bool setData(const QModelIndex& index, const QVariant& value, int role); QVariant headerData(int section, Qt::Orientation orientation, int role) const; QModelIndex index(int row, int column, const QModelIndex& parent) const; bool removeRows(int row, int count, const QModelIndex& parent = QModelIndex()); Qt::ItemFlags flags(const QModelIndex& index) const; /*@}*/ const RecentRequestEntry& entry(int row) const { return list[row]; } void addNewRequest(const SendCoinsRecipient& recipient); void addNewRequest(const std::string& recipient); void addNewRequest(RecentRequestEntry& recipient); public slots: void sort(int column, Qt::SortOrder order = Qt::AscendingOrder); void updateDisplayUnit(); private: WalletModel* walletModel; QStringList columns; QList<RecentRequestEntry> list; int64_t nReceiveRequestsMaxId; /** Updates the column title to "Amount (DisplayUnit)" and emits headerDataChanged() signal for table headers to react. */ void updateAmountColumnTitle(); /** Gets title for amount column including current display unit if optionsModel reference available. */ QString getAmountTitle(); }; #endif // BITCOIN_QT_RECENTREQUESTSTABLEMODEL_H
b1b219e8a8596060c714b819cf3b3732778d62f3
027ad99a3fa9231dd96dd610fdbebd26f9fd02db
/Projects/manager_CameraLinkVis/camera_linkvis_manager.cxx
4621a98cd857c45640b685ce471120679b9081ac
[ "BSD-3-Clause" ]
permissive
droidoid/MoPlugs
ee5b6162a3a504d43d8a62ab221cfe72317afe25
fce52e6469408e32e94af8ac8a303840bc956e53
refs/heads/master
2020-12-19T04:26:07.530778
2019-08-07T22:05:07
2019-08-07T22:05:07
235,619,955
1
0
BSD-3-Clause
2020-01-22T16:54:13
2020-01-22T16:54:12
null
UTF-8
C++
false
false
6,904
cxx
////////////////////////////////////////////////////////////////////////////////////////////////// // // file: camera_linkvis_manager.cpp // // Author Sergey Solokhin (Neill3d) // // // GitHub page - https://github.com/Neill3d/MoPlugs // Licensed under BSD 3-Clause - https://github.com/Neill3d/MoPlugs/blob/master/LICENSE // /////////////////////////////////////////////////////////////////////////////////////////////////// //--- Class declaration #include "camera_linkvis_manager.h" //--- Registration defines #define CAMERA_LINKVIS__CLASS CAMERA_LINKVIS__CLASSNAME #define CAMERA_LINKVIS__NAME CAMERA_LINKVIS__CLASSSTR //--- FiLMBOX implementation and registration FBCustomManagerImplementation( CAMERA_LINKVIS__CLASS ); // Manager class name. FBRegisterCustomManager( CAMERA_LINKVIS__CLASS ); // Manager class name. /************************************************ * FiLMBOX Creation ************************************************/ bool Manager_CameraLinkVis::FBCreate() { mLastCamera = nullptr; return true; } /************************************************ * FiLMBOX Destruction. ************************************************/ void Manager_CameraLinkVis::FBDestroy() { // Free any user memory here. } /************************************************ * Execution callback. ************************************************/ bool Manager_CameraLinkVis::Init() { return true; } bool Manager_CameraLinkVis::Open() { //mSystem.OnConnectionNotify.Add(this, (FBCallback)&Manager_CameraLinkVis::EventConnDataNotify); //mSystem.OnConnectionDataNotify.Add(this, (FBCallback)&Manager_CameraLinkVis::EventConnDataNotify); //mSystem.OnUIIdle.Add(this, (FBCallback)&Manager_CameraLinkVis::EventUIIdle); //mSystem.OnVideoFrameRendering.Add(this, (FBCallback) &Manager_CameraLinkVis::EventUIIdle); mSystem.Scene->OnChange.Add(this, (FBCallback) &Manager_CameraLinkVis::EventSceneChange); FBEvaluateManager::TheOne().OnRenderingPipelineEvent.Add(this, (FBCallback) &Manager_CameraLinkVis::EventRender); //FBEvaluateManager::TheOne().OnEvaluationPipelineEvent.Add(this, (FBCallback) &Manager_CameraLinkVis::EventRender); return true; } bool Manager_CameraLinkVis::Clear() { return true; } bool Manager_CameraLinkVis::Close() { //mSystem.OnConnectionNotify.Remove(this, (FBCallback)&Manager_CameraLinkVis::EventConnDataNotify); //mSystem.OnConnectionDataNotify.Remove(this, (FBCallback)&Manager_CameraLinkVis::EventConnDataNotify); //mSystem.OnUIIdle.Remove(this, (FBCallback)&Manager_CameraLinkVis::EventUIIdle); //mSystem.OnVideoFrameRendering.Remove(this, (FBCallback) &Manager_CameraLinkVis::EventUIIdle); mSystem.Scene->OnChange.Remove(this, (FBCallback) &Manager_CameraLinkVis::EventSceneChange); FBEvaluateManager::TheOne().OnRenderingPipelineEvent.Remove(this, (FBCallback) &Manager_CameraLinkVis::EventRender); //FBEvaluateManager::TheOne().OnEvaluationPipelineEvent.Remove(this, (FBCallback) &Manager_CameraLinkVis::EventRender); return true; } void Manager_CameraLinkVis::EventConnDataNotify(HISender pSender, HKEvent pEvent) { FBEventConnectionDataNotify lEvent(pEvent); FBPlug* lPlug; if( lEvent.Plug ) { if ( FBIS(lEvent.Plug, FBCamera) ) { lPlug = lEvent.Plug; FBCamera *pCamera = (FBCamera*) lPlug; FBString cameraName ( pCamera->Name ); printf( "camera name - %s\n", cameraName ); } } } void Manager_CameraLinkVis::EventConnNotify(HISender pSender, HKEvent pEvent) { FBEventConnectionNotify lEvent(pEvent); FBPlug* lPlug; if( lEvent.SrcPlug ) { if ( FBIS(lEvent.SrcPlug, FBCamera) ) { FBString cameraName( ( (FBCamera*)(FBPlug*)lEvent.SrcPlug )->Name ); printf( "camera name - %s\n", cameraName ); } } } void Manager_CameraLinkVis::EventRender(HISender pSender, HKEvent pEvent) { FBEventEvalGlobalCallback levent(pEvent); if (levent.GetTiming() == kFBGlobalEvalCallbackBeforeRender) // kFBGlobalEvalCallbackBeforeDAG { EventUIIdle(nullptr, nullptr); } } void Manager_CameraLinkVis::EventUIIdle(HISender pSender, HKEvent pEvent) { FBCamera *pCamera = mSystem.Scene->Renderer->CurrentCamera; if (FBIS(pCamera, FBCameraSwitcher)) pCamera = ( (FBCameraSwitcher*) pCamera)->CurrentCamera; if (pCamera != mLastCamera) { // DONE: change camera //printf( "change\n" ); // leave all cameras groups FBScene *pScene = mSystem.Scene; for (int i=0; i<pScene->Cameras.GetCount(); ++i) { FBCamera *iCam = (FBCamera*) pScene->Cameras[i]; if (iCam->SystemCamera == false) LeaveCamera(iCam); } // enter one current EnterCamera(pCamera); } mLastCamera = pCamera; } bool GroupVis(const char *groupName, const bool show) { FBScene *pScene = FBSystem::TheOne().Scene; for (int i=0; i<pScene->Groups.GetCount(); ++i) { if ( strcmp( pScene->Groups[i]->Name, groupName ) == 0 ) { pScene->Groups[i]->Show = show; FBGroup *pGroup = pScene->Groups[i]; for (int j=0, count=pGroup->Items.GetCount(); j<count; ++j) { FBComponent *pcomp = pGroup->Items[j]; if (FBIS(pcomp, FBModel)) { ( (FBModel*) pcomp)->Show = show; } } return true; } } return false; } void Manager_CameraLinkVis::LeaveCamera(FBCamera *pCamera) { if (pCamera == nullptr) return; FBProperty *pProp = pCamera->PropertyList.Find( "LinkedGroup" ); if (pProp) { const char *groupName = pProp->AsString(); GroupVis( groupName, false ); } } void Manager_CameraLinkVis::EnterCamera(FBCamera *pCamera) { if (pCamera == nullptr) return; FBProperty *pProp = pCamera->PropertyList.Find( "LinkedGroup" ); if (pProp) { const char *groupName = pProp->AsString(); GroupVis( groupName, true ); } } static FBGroup *gGroup = nullptr; static FBCamera *gCamera = nullptr; FBCamera *FindCameraByGroup(const char *groupName) { FBScene *pScene = FBSystem::TheOne().Scene; for (int i=0; i<pScene->Cameras.GetCount(); ++i) { FBCamera *pCamera = (FBCamera*) pScene->Cameras[i]; if (pCamera->SystemCamera == false) { FBProperty *lProp = pCamera->PropertyList.Find( "LinkedGroup" ); if (lProp) { const char *lname = lProp->AsString(); if ( strcmp( lname, groupName ) == 0 ) { return pCamera; } } } } return nullptr; } void Manager_CameraLinkVis::EventSceneChange(HISender pSender, HKEvent pEvent) { FBEventSceneChange sceneEvent(pEvent); if (sceneEvent.Type == kFBSceneChangeRename) { if ( FBIS(sceneEvent.Component, FBGroup) ) { gGroup = (FBGroup*) (FBComponent*) sceneEvent.Component; gCamera = FindCameraByGroup(gGroup->Name); } } else if (sceneEvent.Type == kFBSceneChangeRenamed) { if (gGroup != nullptr && gCamera != nullptr) { FBProperty *lProp = gCamera->PropertyList.Find("LinkedGroup"); if (lProp) { lProp->SetString( gGroup->Name ); } } } }
21157b7000f23a5f47c97b833f576be93b5ddb41
cf86574f8dc83ac340b9f7816fb55c1583c3b5c8
/ios/Pods/Flipper-Folly/folly/portability/Builtins.h
109e620e5037564ec6587ee7b0e0a548ba0e9355
[ "Apache-2.0", "MIT" ]
permissive
juxtin/yarnu
94b9f6068ebf3dd46b02173eb2cb9b394a06c969
a3c3748a6738283644f252f87244880ca430c2f4
refs/heads/master
2022-12-30T07:17:56.708695
2020-09-28T19:29:02
2020-09-28T19:29:02
299,406,578
0
1
null
null
null
null
UTF-8
C++
false
false
4,673
h
/* * Copyright (c) Facebook, Inc. and its affiliates. * * 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 #if defined(_WIN32) && !defined(__clang__) #include <assert.h> #include <folly/Portability.h> #include <intrin.h> #include <stdint.h> namespace folly { namespace portability { namespace detail { void call_flush_instruction_cache_self_pid(void* begin, size_t size); } } // namespace portability } // namespace folly FOLLY_ALWAYS_INLINE void __builtin___clear_cache(char* begin, char* end) { if (folly::kIsArchAmd64) { // x86_64 doesn't require the instruction cache to be flushed after // modification. } else { // Default to flushing it for everything else, such as ARM. folly::portability::detail::call_flush_instruction_cache_self_pid( static_cast<void*>(begin), static_cast<size_t>(end - begin)); } } #if !defined(_MSC_VER) || (_MSC_VER < 1923) FOLLY_ALWAYS_INLINE int __builtin_clz(unsigned int x) { unsigned long index; return int(_BitScanReverse(&index, (unsigned long)x) ? 31 - index : 32); } FOLLY_ALWAYS_INLINE int __builtin_clzl(unsigned long x) { return __builtin_clz((unsigned int)x); } #if defined(_M_IX86) || defined(_M_ARM) || defined(_M_ARM64) FOLLY_ALWAYS_INLINE int __builtin_clzll(unsigned long long x) { if (x == 0) { return 64; } unsigned int msb = (unsigned int)(x >> 32); unsigned int lsb = (unsigned int)x; return (msb != 0) ? __builtin_clz(msb) : 32 + __builtin_clz(lsb); } #else FOLLY_ALWAYS_INLINE int __builtin_clzll(unsigned long long x) { unsigned long index; return int(_BitScanReverse64(&index, x) ? 63 - index : 64); } #endif FOLLY_ALWAYS_INLINE int __builtin_ctz(unsigned int x) { unsigned long index; return int(_BitScanForward(&index, (unsigned long)x) ? index : 32); } FOLLY_ALWAYS_INLINE int __builtin_ctzl(unsigned long x) { return __builtin_ctz((unsigned int)x); } #if defined(_M_IX86) || defined(_M_ARM) || defined(_M_ARM64) FOLLY_ALWAYS_INLINE int __builtin_ctzll(unsigned long long x) { unsigned long index; unsigned int msb = (unsigned int)(x >> 32); unsigned int lsb = (unsigned int)x; if (lsb != 0) { return (int)(_BitScanForward(&index, lsb) ? index : 64); } else { return (int)(_BitScanForward(&index, msb) ? index + 32 : 64); } } #else FOLLY_ALWAYS_INLINE int __builtin_ctzll(unsigned long long x) { unsigned long index; return int(_BitScanForward64(&index, x) ? index : 64); } #endif #endif // !defined(_MSC_VER) || (_MSC_VER < 1923) FOLLY_ALWAYS_INLINE int __builtin_ffs(int x) { unsigned long index; return int(_BitScanForward(&index, (unsigned long)x) ? index + 1 : 0); } FOLLY_ALWAYS_INLINE int __builtin_ffsl(long x) { return __builtin_ffs(int(x)); } #if defined(_M_IX86) || defined(_M_ARM) || defined(_M_ARM64) FOLLY_ALWAYS_INLINE int __builtin_ffsll(long long x) { int ctzll = __builtin_ctzll((unsigned long long)x); return ctzll != 64 ? ctzll + 1 : 0; } #else FOLLY_ALWAYS_INLINE int __builtin_ffsll(long long x) { unsigned long index; return int(_BitScanForward64(&index, (unsigned long long)x) ? index + 1 : 0); } FOLLY_ALWAYS_INLINE int __builtin_popcount(unsigned int x) { return int(__popcnt(x)); } #if !defined(_MSC_VER) || (_MSC_VER < 1923) FOLLY_ALWAYS_INLINE int __builtin_popcountl(unsigned long x) { static_assert(sizeof(x) == 4, ""); return int(__popcnt(x)); } #endif // !defined(_MSC_VER) || (_MSC_VER < 1923) #endif #if !defined(_MSC_VER) || (_MSC_VER < 1923) #if defined(_M_IX86) FOLLY_ALWAYS_INLINE int __builtin_popcountll(unsigned long long x) { return int(__popcnt((unsigned int)(x >> 32))) + int(__popcnt((unsigned int)x)); } #elif defined(_M_X64) FOLLY_ALWAYS_INLINE int __builtin_popcountll(unsigned long long x) { return int(__popcnt64(x)); } #endif #endif // !defined(_MSC_VER) || (_MSC_VER < 1923) FOLLY_ALWAYS_INLINE void* __builtin_return_address(unsigned int frame) { // I really hope frame is zero... (void)frame; assert(frame == 0); return _ReturnAddress(); } #endif
095b9ef490dd909b0a4114b91b15e07ad19e775b
22b8a4e1683b185718479c244cb390cdbed9abd9
/PA4_Qin_Yifeng/proj4.cpp
5de0de7ce74447bdde900110059e26ee46542d8e
[]
no_license
YifengQ/CS-202
18eb4454aef9bc5d761ec2bf085e534bcf9f8ae2
5d6ffb18e65b2dee02514749d470b6cd0d01a5a5
refs/heads/master
2021-06-24T21:55:17.851888
2021-04-10T21:47:08
2021-04-10T21:47:08
216,172,288
0
0
null
null
null
null
UTF-8
C++
false
false
19,300
cpp
//Yifeng Qin //CS202 //10/3/17 //Project 4 /* Layout ------------------ Declared classes / Prototypes Menu Functions Prototype Main Menu Functions Menu Functions Class Sensor Functions Class Car Functions Class Agency Functions */ #include <iostream> #include <fstream> using namespace std; const int maxsize = 255; void myStringCopy (char *destination, const char *source); void intStringCopy (int *destination, const int *source); class sensor{ public: //defaul and paramaterized constructors sensor(); sensor(char* temp_type, float extracost); void setType (char* t_type); char* getType(); void setExtracost(float t_extracost); float getExtracost(); // overload operator sensor operator[](int sensor); //reset functions for static int void reset_gps(); void reset_camera(); void reset_lidar(); void reset_radar(); private: char m_type [maxsize]; float m_extracost; static int gps_cnt; static int camera_cnt; static int lidar_cnt; static int radar_cnt; }; //sensor::sensor(char *m_type){ // myStringCopy(this.m_type, m_type); //} //set all my static variables to zero int sensor::gps_cnt = 0; int sensor::camera_cnt = 0; int sensor::lidar_cnt = 0; int sensor::radar_cnt = 0; class car{ public: //defaul and paramaterized constructors car(); car(char* temp_make, char* temp_model, char* temp_owner, int tempyear, float b_price, float f_price, bool t_avail); void setMake (char* t_make); char* getMake(); void setModel (char* t_model); char* getModel(); void setOwner (char* t_owner); char* getOwner(); void setYear(int t_year); int getYear(); void setBaseprice(float t_baseprice); float getBaseprice(); void setFinalprice(float t_finalprice); float getFinalprice(); void setAvailable(bool t_avaliable); bool getAvailable(); void printData(); void setSensor(int j, char* tempSensor); void getSensor(int j); // overload operator car operator[](int cars); private: char m_make [maxsize]; char m_model [maxsize]; int m_year; sensor m_sensors [3]; float m_baseprice; float m_finalprice; bool m_available; char m_owner [maxsize]; }; class agency{ public: //defaul and paramaterized constructors agency(); agency(char* tempname, int* tempzipcode); void setName(char* t_name); char* getName(); void setInv(int i, int tempYear, char *tempMake, char* tempModel, float baseprice, float finalprice, bool avail, char* tempOwner); void getInv(int j); void getInv2(int j); void getAgency(); void printExp(); void setZip(int t_zip); int* getZip(); void EstPrice(int i); void ResetAvail(char *temp_name); // overload operator agency operator[](int agency); private: char m_name[maxsize]; int m_zipcode[5]; car m_inventory [5]; }; //prototypes for my case functions void case_1(agency* agency1, car* carz, int &cg, int &cl, int &cr, int &cc); void case_2(agency* agency1, car* carz); void case_3(int cg, int cl, int cr, int cc); void case_4(agency* agency1); void myStringCopy (char *destination, const char *source); int main() { int menu; bool if_file = false; int i; agency agency1[1]; car carz[5]; int z= 0; int cg = 0, cl = 0, cr = 0, cc =0; cout << "=====================================" << endl; cout << " Menu"<< endl; cout << "=====================================" << endl; cout << "1) Input File Name" << endl; cout << "2) Print Data" << endl; cout << "3) TOTAL Number of Sensors" << endl; cout << "4) Most Expensive Car" << endl; cout << "5) Exit Program" << endl; cout << "Enter Option: "; cin >> menu; while(menu != 5) { switch(menu) { case(1): { case_1(agency1, carz, cg, cl, cr, cc); if_file = true; break; } case(2): { if(if_file == false) { cout << "No File Was Entered. Please Enter a File (Menu 1) " << endl; } else { case_2(agency1, carz); } break; } case(3): { if(if_file == false) { cout << "No File Was Entered. Please Enter a File (Menu 1) " << endl; } else { case_3(cg, cl, cr, cc); } break; } case(4): { if(if_file == false) { cout << "No File Was Entered. Please Enter a File (Menu 1) " << endl; } else { case_4(agency1); } break; } } cout << endl; cout << "Enter Menu Option: "; cin >> menu; } return 0; } //Input File Function void case_1(agency* agency1, car* carz, int &cg, int &cl, int &cr, int &cc) { // all my temporary variables to pass to functions char name[20]; char filename[20]; int zipcode; int tyear; float bprice; float fprice = 100; char tmake[30]; char tmodel[30]; bool tavail = 0; int j= 0; int i = 0; int a = 0; int z = 0; char c , x, y; int c_gps = 0; int c_radar = 0; int c_lidar = 0; int c_camera = 0; int c_none = 0; int p_gps = 5; int p_radar = 20; int p_lidar = 15; int p_camera = 10; int p_none = 0; /////////////////////////// count gps, count lidar, cound radar, count camera cg = 0, cl = 0, cr = 0, cc = 0; char t_owner = '\0'; char c_owner [maxsize]; char* owner_ptr = c_owner; char* owner_ptrz = &c_owner[0]; char t_sensor[maxsize]; char* sensor_ptr = t_sensor; char* sensor_ptrz = &t_sensor[0]; // opens file cout << endl; cout << "Enter the input file name: "; cin >> filename; cout << endl; agency* agency_ptr = agency1; car* car_ptr = carz; ifstream file; file.open(filename); //pointer to agency to set agency name and zipcode file >> name; agency_ptr -> setName(name); file >> zipcode; agency_ptr -> setZip(zipcode); //agency_ptr -> getAgency(); for(a = 0; a < 5 ; a++, j++, z++) { //takes in all the values for the car up to the sensor; file >> tyear >> tmake >> tmodel >> bprice; file >> c; if( c == '{') { while( c != '}') { x=c; file >> c; //checks if the char value is equal to letters that correspond to the sensors // then if it finds on it will increment it and set a temp char array with the snensor name if(x == '{' & c == '}') { c_none++; *sensor_ptr = 'n'; sensor_ptr++; *sensor_ptr = 'o'; sensor_ptr++; *sensor_ptr = 'n'; sensor_ptr++; *sensor_ptr = 'e'; sensor_ptr++; } //checks if the char value is equal to letters that correspond to the sensors // then if it finds on it will increment it and set a temp char array with the snensor name if(x== 'g' & c == 'p'){ c_gps++; cg++; *sensor_ptr = 'g'; sensor_ptr++; *sensor_ptr = 'p'; sensor_ptr++; *sensor_ptr = 's'; sensor_ptr++; *sensor_ptr = ' '; sensor_ptr++; } //checks if the char value is equal to letters that correspond to the sensors // then if it finds on it will increment it and set a temp char array with the snensor name if(x== 'a' & c == 'd'){ c_radar++; cr++; *sensor_ptr = 'r'; sensor_ptr++; *sensor_ptr = 'a'; sensor_ptr++; *sensor_ptr = 'd'; sensor_ptr++; *sensor_ptr = 'a'; sensor_ptr++; *sensor_ptr = 'r'; sensor_ptr++; *sensor_ptr = ' '; sensor_ptr++; } //checks if the char value is equal to letters that correspond to the sensors // then if it finds on it will increment it and set a temp char array with the snensor name if(x== 'l' & c == 'i'){ c_lidar++; cl++; *sensor_ptr = 'l'; sensor_ptr++; *sensor_ptr = 'i'; sensor_ptr++; *sensor_ptr = 'd'; sensor_ptr++; *sensor_ptr = 'a'; sensor_ptr++; *sensor_ptr = 'r'; sensor_ptr++; *sensor_ptr = ' '; sensor_ptr++; } //checks if the char value is equal to letters that correspond to the sensors // then if it finds on it will increment it and set a temp char array with the snensor name if(x== 'c' & c == 'a'){ c_camera++; cc++; *sensor_ptr = 'c'; sensor_ptr++; *sensor_ptr = 'a'; sensor_ptr++; *sensor_ptr = 'm'; sensor_ptr++; *sensor_ptr = 'e'; sensor_ptr++; *sensor_ptr = 'r'; sensor_ptr++; *sensor_ptr = 'a'; sensor_ptr++; *sensor_ptr = ' '; sensor_ptr++; } } } // totals the price by adding the base price with the total amount of that sensors and its repsected price fprice = bprice + (p_gps*c_gps + p_radar*c_radar + p_lidar * c_lidar + p_camera * c_camera); file >> tavail; t_owner = file.get(); //checks it there is a owner by using the get function to check if there is a new line or a charcter if( t_owner == '\n') { *c_owner = '\0'; } while(t_owner != '\n') { //if there is a character it will copy over the contents and end it with a null t_owner = file.get(); if(t_owner == '\n') { break; } *owner_ptr = t_owner; owner_ptr++; } *owner_ptr = '\0'; *sensor_ptr = '\0'; owner_ptr = owner_ptrz; sensor_ptr = sensor_ptrz; agency_ptr -> setInv(j, tyear, tmake, tmodel, bprice, fprice, tavail, c_owner); car_ptr -> setSensor(j, t_sensor); c_none = 0, c_gps = 0, c_lidar = 0, c_radar = 0, c_camera = 0; } file.close(); } //Print to terminal All data for the Gency and all its correspinding Cars void case_2(agency* agency1, car* carz) { int z; // calls all the print funtioncs that i have decalred agency* agency_ptr = agency1; cout << endl; agency_ptr -> getAgency(); agency_ptr -> getZip(); car* car_ptr = carz; for( z = 0; z < 5; z++) { agency_ptr -> getInv(z); car_ptr -> getSensor(z); agency_ptr -> getInv2(z); } } //Print to terminal the Total number of sensors void case_3(int cg, int cl, int cr, int cc) { //prints out all the sensors that there are int t_sensors =0; t_sensors = cg + cl + cr + cc; cout << endl; cout << "Total Sensors: " << t_sensors << endl; cout << "Gps: " << cg << endl; cout << "Lidar: " << cl << endl; cout << "Radar: " << cr << endl; cout << "Camera: " << cc << endl; } //Find the most expensive available car void case_4(agency* agency1) { //calls the functions to set the prices and change the bool values and owner int answer; int days; char name[10]; agency* agency_ptr = agency1; agency_ptr -> printExp(); cout << "Would You Like To Rent it? Yes(1)/No(2): " ; cin >> answer; if(answer == 1) { cout << "How Many Days Would You Like to Rent It? : "; cin >> days; agency_ptr -> EstPrice(days); cout << "Enter Your Name :"; cin >> name; agency_ptr -> ResetAvail(name); cout << "Successful" << endl; } } void myStringCopy (char *destination, const char *source) { while( *source!= '\0') { *destination = *source; source++; destination++; } *destination = '\0'; } void intStringCopy (int *destination, const int *source) { while( *source!= '\0') { *destination = *source; source++; destination++; } *destination = '\0'; } /////////////////////SENSOR+++++++++++++++++++++++++++++++++++++++_+___+_+_+++_++_+__+ //default constructor and paramater constructor sensor::sensor() { char tempType[10] = "none"; myStringCopy(m_type, tempType); m_extracost = 0; } //default constructor and paramater constructor sensor::sensor(char* temp_type, float extracost) { myStringCopy(m_type, temp_type); m_extracost = extracost; } void sensor::setType(char* t_type) { myStringCopy(m_type, t_type); } char* sensor::getType() { return m_type; } void sensor::setExtracost(float t_extracost) { m_extracost = t_extracost; } float sensor::getExtracost() { return m_extracost; } void sensor::reset_gps(){ gps_cnt = 0; } void sensor::reset_camera(){ camera_cnt = 0; } void sensor::reset_lidar(){ lidar_cnt = 0; } void sensor::reset_radar(){ radar_cnt = 0; } /////////////////////// CAR ++++++++++++++++++++++++++++++++++++++++++++++++++++++ //default constructor and paramater constructor//default constructor and paramater constructor car::car() { char tempval[5]= "\0"; myStringCopy(m_make, tempval); myStringCopy(m_owner, tempval); myStringCopy(m_model, tempval); m_year = 0; m_baseprice = 0; m_finalprice = 0; m_available = 0; } //default constructor and paramater constructor car::car(char* temp_make, char* temp_model, char* temp_owner, int tempyear, float b_price, float f_price, bool t_avail) { myStringCopy(m_make, temp_make); myStringCopy(m_owner, temp_model); myStringCopy(m_model, temp_model); m_year = tempyear; m_baseprice = b_price; m_finalprice = f_price; m_available = t_avail; } void car::setMake(char* t_make) { myStringCopy(m_make, t_make); } char* car::getMake() { return m_make; } void car::setModel(char* t_model) { myStringCopy(m_model, t_model); } char* car::getModel() { return m_model; } void car::setOwner(char* t_owner) { myStringCopy(m_owner, t_owner); } char* car::getOwner() { return m_owner; } void car::setYear(int t_year) { m_year = t_year; } int car::getYear() { return m_year; } void car::setBaseprice(float t_baseprice) { m_baseprice = t_baseprice; } float car::getBaseprice() { return m_baseprice; } void car::setFinalprice(float t_finalprice) { m_finalprice = t_finalprice; } float car::getFinalprice() { return m_finalprice; } void car::setAvailable(bool t_available) { m_available = t_available; } bool car::getAvailable() { return m_available; } void car::setSensor(int j, char* tempSensor) { int i; sensor* sensor_ptr = m_sensors; sensor_ptr += j; sensor_ptr -> setType(tempSensor); } void car::getSensor(int j) { int i; sensor* sensor_ptr = m_sensors; sensor_ptr += j; cout << endl; cout << "Sensors:" <<sensor_ptr -> getType() << ", "; } ////////////////////Agency ++++++++++++++++++++++++ //default constructor and paramater constructor agency::agency() { char tempval[5]= "\0"; myStringCopy(m_name, tempval); int tempzip[5] = {0}; intStringCopy(m_zipcode, tempzip); } //default constructor and paramater constructor agency::agency(char* tempname, int* tempzipcode) { myStringCopy(m_name, tempname); intStringCopy(m_zipcode, tempzipcode); } void agency::setName(char* t_name) { myStringCopy(m_name, t_name); } char* agency::getName() { return m_name; } void agency::getAgency() { cout << m_name << " "; } void agency::printExp() { float temp_price; int k = 0; int j = 0; car* car_ptr = m_inventory; car* car_ptr2 = m_inventory; car* car_ptr3 = m_inventory; // i want to run through all the price values to find the most expensive car. for (j = 0; j < 5; ++j) { car_ptr++; // if one car price is bigger it will enter this for loop. if(car_ptr -> getFinalprice() < car_ptr2 -> getFinalprice()) { // then if the get price is larger than the current temp_price, it will replace it. if(temp_price < car_ptr2 -> getFinalprice()) { temp_price = car_ptr2 -> getFinalprice(); car_ptr++; k++; } } car_ptr2++; } car_ptr+= k; cout << "Most Expensive Car: " << car_ptr3 -> getYear() << " " << car_ptr3 -> getMake() << " " << car_ptr3 -> getModel() << " $" << temp_price << endl; } //uses the same method to find the amount needed to increment the pointer to change the values and make an estmated price. void agency::EstPrice(int i) { float temp_price; int k = 0; int j = 0; float full_price; car* car_ptr = m_inventory; car* car_ptr2 = m_inventory; // i want to run through all the price values to find the most expensive car. for (j = 0; j < 5; ++j) { car_ptr++; // if one car price is bigger it will enter this for loop. if(car_ptr -> getFinalprice() < car_ptr2 -> getFinalprice()) { // then if the get price is larger than the current temp_price, it will replace it. if(temp_price < car_ptr2 -> getFinalprice()) { temp_price = car_ptr2 -> getFinalprice(); car_ptr++; k++; } } car_ptr2++; } // the full price is multiplied by the number that is passed in full_price = temp_price * i; cout <<"Total Cost: $" <<full_price << endl; } void agency::ResetAvail(char *temp_name) { float temp_price; int k = 0; int j = 0; float full_price; car* car_ptr = m_inventory; car* car_ptr2 = m_inventory; car* car_ptr3 = m_inventory; int avail = 1; // i want to run through all the price values to find the most expensive car. for (j = 0; j < 5; ++j) { car_ptr++; // if one car price is bigger it will enter this for loop. if(car_ptr -> getFinalprice() < car_ptr2 -> getFinalprice()) { // then if the get price is larger than the current temp_price, it will replace it. if(temp_price < car_ptr2 -> getFinalprice()) { temp_price = car_ptr2 -> getFinalprice(); car_ptr++; k++; } } car_ptr2++; } car_ptr += k; car_ptr3 -> setAvailable(avail); car_ptr3 -> setOwner(temp_name); } void agency::setInv(int i, int tempYear, char *tempMake, char* tempModel, float baseprice, float finalprice, bool avail, char* tempOwner) { //function in the agency so it has access to the private members of the class //pass in a value to increment the pointer to the car i want. int j; car* car_ptr = m_inventory; car_ptr += i; car_ptr -> setYear(tempYear); car_ptr ->setMake(tempMake); car_ptr ->setModel(tempModel); car_ptr ->setBaseprice(baseprice); car_ptr ->setFinalprice(finalprice); car_ptr ->setAvailable(avail); car_ptr ->setOwner(tempOwner); } void agency::getInv(int j) { //function in the agency so it has access to the private members of the class //pass in a value to increment the pointer to the car i want. int z; car* car_ptr = m_inventory; car_ptr += j; cout << car_ptr -> getYear() << " "; cout << car_ptr -> getMake() << " "; cout << car_ptr -> getModel() << ", Base Price: $"; cout << car_ptr -> getBaseprice() << ", Final Price: $"; cout << car_ptr -> getFinalprice(); } void agency::getInv2(int j) { //function in the agency so it has access to the private members of the class //pass in a value to increment the pointer to the car i want. car* car_ptr = m_inventory; car_ptr += j; cout << "Available: " << car_ptr -> getAvailable() << boolalpha << ", "; cout << "Owner:" << car_ptr -> getOwner(); cout << endl; car_ptr++; } void agency::setZip(int t_zip) { int i = 0; int* zip_ptr = m_zipcode; int z; zip_ptr += 4; while(t_zip != 0) { // increment the zip pointer because i want to give a value into the memory allocation in the array. Because the module saves it backwords, i have to increment the pointer and then decrement it to have the zop code in the right direction. z = t_zip % 10; *zip_ptr = z; t_zip /= 10; --zip_ptr; } //intStringCopy(m_zipcode, t_zip); } int* agency::getZip() { //have to use a for loop to print out the zipcode array int* zip_ptr = m_zipcode; int i=0; zip_ptr = m_zipcode; for(i = 0; i< 5; i++) { cout << *zip_ptr; zip_ptr++; } cout << endl; }
bdf24097e097669b211c714772bc8df5805ee04e
0b3d390032c56decc837dd8fe0f2ad676409e6e6
/src/SerialPort.cpp
64a479c0fd4a9d73c04b652d555507dbcfcf59c3
[]
no_license
bielpiero/lucky_bea
fffc95cf3afde4487d321da57c67646b76be2e90
f822020d1b85b4e2ab710269d79a071bfe33d1c7
refs/heads/master
2021-01-17T00:38:51.749145
2020-09-23T15:06:45
2020-09-23T15:06:45
28,190,460
2
0
null
null
null
null
UTF-8
C++
false
false
3,844
cpp
#include "SerialPort.h" const uint16_t SerialPort::vendorId = 0x1ffb; const size_t SerialPort::nProductIds = 4; const uint16_t SerialPort::productIds[] = { 0x0089, 0x008a, 0x008b, 0x008c }; SerialPort::SerialPort(){ bool found = false; libusb_init(&ctx); libusb_device** list; int count = libusb_get_device_list(ctx, &list); for (int i = 0; i < count; i++) { libusb_device* device = list[i]; struct libusb_device_descriptor desc; libusb_get_device_descriptor(device, &desc); if (isMaestroDevice(desc)) { //printdev(device); std::cout << "Pololu Maestro device detected..." << std::endl; found = true; libusb_device_handle* current_device; int ret = libusb_open(device, &current_device); device_handle.push_back(current_device); } } libusb_free_device_list(list, 1); if(!found){ std::cout << "No Pololu Maestro Device Detected..." << std::endl; libusb_exit(ctx); } } SerialPort::~SerialPort(){ for(int i = 0; i< device_handle.size(); i++){ libusb_close(device_handle[i]); } libusb_exit(ctx); } void SerialPort::printdev(libusb_device *dev) { libusb_device_descriptor desc; int r = libusb_get_device_descriptor(dev, &desc); if (r < 0) { cout<<"failed to get device descriptor"<<endl; return; } cout<<"Number of possible configurations: "<<(int)desc.bNumConfigurations<< endl; cout<<"Device Class: "<<(int)desc.bDeviceClass<< endl; cout<<"VendorID: "<<desc.idVendor<< endl; cout<<"ProductID: "<<desc.idProduct<<endl; //cout<<"extra: " << desc.extra << endl; libusb_config_descriptor *config; libusb_get_config_descriptor(dev, 0, &config); cout<<"Interfaces: "<<(int)config->bNumInterfaces<< endl; const libusb_interface *inter; const libusb_interface_descriptor *interdesc; const libusb_endpoint_descriptor *epdesc; for(int i=0; i<(int)config->bNumInterfaces; i++) { inter = &config->interface[i]; cout<<"Number of alternate settings: "<<inter->num_altsetting<<endl; for(int j=0; j<inter->num_altsetting; j++) { interdesc = &inter->altsetting[j]; cout<<"Interface Number: "<<(int)interdesc->bInterfaceNumber<<" | "; cout<<"Number of endpoints: "<<(int)interdesc->bNumEndpoints<<" | "; for(int k=0; k<(int)interdesc->bNumEndpoints; k++) { epdesc = &interdesc->endpoint[k]; cout<<"Descriptor Type: "<<(int)epdesc->bDescriptorType<<" | "; cout<<"EP Address: "<<(int)epdesc->bEndpointAddress<< endl; } } } cout<<endl<<endl<<endl; libusb_free_config_descriptor(config); } bool SerialPort::isMaestroDevice(libusb_device_descriptor& desc) { if (desc.idVendor == vendorId) { for (int i = 0; i < nProductIds; i++) { if (desc.idProduct == productIds[i]) { // vendor and product both matched return true; } } } // no product id match return false; } int SerialPort::controlTransfer(uint8_t cardId, uint8_t request, uint16_t value, uint16_t index) { int ret = libusb_control_transfer( device_handle[cardId], 0x40, request, value, index, (unsigned char*) 0, 0, 5000); return 0; } void SerialPort::setTarget(uint8_t cardId, uint8_t servo, uint16_t value) { controlTransfer(cardId, REQUEST_SET_TARGET, value, servo); } void SerialPort::setSpeed(uint8_t cardId, uint8_t servo, uint16_t value) { controlTransfer(cardId, REQUEST_SET_SERVO_VARIABLE, value, servo); } void SerialPort::setAcceleration(uint8_t cardId, uint8_t servo, uint16_t value) { // setting high bit on servo number indicates acceleration controlTransfer(cardId, REQUEST_SET_SERVO_VARIABLE, value, servo | 0x80); }
ba8204e06ce5265d9c60750dfbba0eb54e58aa24
747f684c3e988234877d581f175cddf19792d0fa
/Tests/test_kernel_module.cpp
9bd9d9bf6150e7577a371d80d6adb24878bcb16f
[]
no_license
pv-k/NNLib4
0dd07a708290ca875c62ba279438a7f02a79acfa
0ec77f2f915778a4734d1158e2ba0875b9c8ec2d
refs/heads/master
2020-04-05T23:33:07.257135
2013-06-13T17:59:24
2013-06-13T17:59:24
null
0
0
null
null
null
null
UTF-8
C++
false
false
5,969
cpp
#include <boost/test/unit_test.hpp> #include <vector> #include "test_utilities.h" #include "Tensor.h" #include "ConstantInitializer.h" #include "AbsRegularizer.h" #include "KernelModule.h" #include "MaxPoolingKernel.h" #include "KernelFactory.h" BOOST_AUTO_TEST_CASE(TestKernelModule_max_pooling) { size_t num_input_kernels = 15; size_t num_output_kernels = 1; size_t num_samples = 10; std::vector<size_t> input_dims; input_dims.push_back(50); input_dims.push_back(50); input_dims.push_back(num_input_kernels);input_dims.push_back(num_samples); Tensor<float> input_tensor = GetRandomTensor<float>(input_dims); std::vector<size_t> kernel_dims; kernel_dims.push_back(4); kernel_dims.push_back(9); kernel_dims.push_back(1); std::vector<size_t> strides;strides.push_back(4);strides.push_back(5);strides.push_back(1); std::shared_ptr<ConstantInitializer<float>> initializer(new ConstantInitializer<float>(0)); KernelModule<float> kernel_module("module1", num_output_kernels,kernel_dims,strides, MaxPoolingKernelFactory<float>(),initializer); std::vector<size_t> output_dims = kernel_module.GetKernel(0)->GetOutputTensorDimensions(input_dims); BOOST_CHECK(output_dims.size() == 4 && output_dims[0] == 12 && output_dims[1] == 9 && output_dims[2] == 15 && output_dims[3] == 10); kernel_module.train_fprop( std::shared_ptr<Tensor<float> >( new Tensor<float>(input_tensor)) ); std::shared_ptr<Tensor<float> > output_tensor = kernel_module.GetOutputBuffer(); BOOST_CHECK(output_tensor->GetDimensions() == output_dims); std::vector<size_t> sample_input_dims = input_dims; sample_input_dims.pop_back(); std::vector<size_t> sample_output_dims = output_dims; sample_output_dims.pop_back(); Tensor<float> sample_output_tensor(nullptr, sample_output_dims); Tensor<float> sample_input_tensor(nullptr, sample_input_dims); for (size_t sample_ind = 0; sample_ind<num_samples; sample_ind++) { sample_input_tensor.SetDataPtr(input_tensor.GetStartPtr()+sample_ind*sample_input_tensor.Numel()); sample_output_tensor.SetDataPtr(output_tensor->GetStartPtr()+sample_ind*sample_output_tensor.Numel()); BOOST_CHECK(test_filter_response<float>(sample_input_tensor, sample_output_tensor, *kernel_module.GetKernel(0), kernel_dims, strides)); } BOOST_CHECK_EQUAL(kernel_module.GetNumParams() , 0); // test set parameters size_t num_params = kernel_module.GetNumParams(); BOOST_CHECK( TestGetSetParameters<float>(kernel_module, kernel_module.GetNumParams()) ); } BOOST_AUTO_TEST_CASE(TestKernelModule_convolutional) { size_t num_input_kernels = 8; size_t num_output_kernels = 16; size_t num_samples = 2; std::vector<size_t> input_dims; input_dims.push_back(50); input_dims.push_back(50); input_dims.push_back(num_input_kernels);input_dims.push_back(num_samples); Tensor<double> input_tensor = GetRandomTensor<double>(input_dims); std::vector<size_t> kernel_dims; kernel_dims.push_back(4); kernel_dims.push_back(9); kernel_dims.push_back(num_input_kernels); std::vector<double> importances; for (size_t i=0; i<num_samples; i++) importances.push_back(1); std::vector<size_t> strides;strides.push_back(4);strides.push_back(5);strides.push_back(1); std::shared_ptr<ConstantInitializer<double>> initializer(new ConstantInitializer<double>(0)); std::shared_ptr<Regularizer<double>> regularizer(new AbsRegularizer<double>(0.5)); KernelModule<double> kernel_module("module1", num_output_kernels,kernel_dims,strides, ConvolutionalKernelFactory<double>(), initializer, regularizer); size_t num_params = kernel_module.GetNumParams(); std::vector<size_t> all_kernels_dims = kernel_dims; all_kernels_dims.push_back(num_output_kernels); Tensor<double> all_kernels_tensor = GetRandomTensor<double>(all_kernels_dims); double* params = all_kernels_tensor.GetStartPtr(); kernel_module.SetParameters(params); std::vector<size_t> output_dims = kernel_module.GetKernel(0)->GetOutputTensorDimensions(input_dims); output_dims[2] = num_output_kernels; kernel_module.train_fprop( std::shared_ptr<Tensor<double> >( new Tensor<double>(input_tensor)) ); std::shared_ptr<Tensor<double> > output_tensor = kernel_module.GetOutputBuffer(); BOOST_CHECK(output_tensor->GetDimensions() == output_dims); // test regularizer double reg_cost = kernel_module.GetCost(importances); double expected_reg_cost = 0; for (size_t i=0; i<all_kernels_tensor.Numel(); i++) expected_reg_cost+=num_samples*std::abs(all_kernels_tensor[i]); expected_reg_cost /= 2; BOOST_CHECK(abs(reg_cost-expected_reg_cost)<0.000001); std::vector<size_t> sample_output_dims = output_dims; sample_output_dims.pop_back(); sample_output_dims.pop_back(); std::vector<size_t> sample_input_dims = input_dims; sample_input_dims.pop_back(); Tensor<double> sample_output_tensor(nullptr, sample_output_dims); Tensor<double> sample_input_tensor(nullptr, sample_input_dims); size_t num_params_per_kernel = Tensor<double>::Numel(kernel_dims); for (size_t sample_ind = 0; sample_ind<num_samples; sample_ind++) { sample_input_tensor.SetDataPtr(input_tensor.GetStartPtr()+sample_ind*sample_input_tensor.Numel()); for (size_t kernel_ind = 0; kernel_ind<num_output_kernels; kernel_ind++) { sample_output_tensor.SetDataPtr(output_tensor->GetStartPtr()+(num_output_kernels*sample_ind + kernel_ind)*sample_output_tensor.Numel()); BOOST_CHECK(test_filter_response<double>(sample_input_tensor, sample_output_tensor, ConvolutionalKernel<double>(Tensor<double>(params + num_params_per_kernel*kernel_ind, kernel_dims), strides), kernel_dims, strides)); } } // test initializer kernel_module.InitializeParameters(); std::vector<double> parameters; kernel_module.GetParameters(parameters); for (size_t i=0; i<all_kernels_tensor.Numel(); i++) BOOST_CHECK_EQUAL(parameters[i] , 0); BOOST_CHECK_EQUAL(kernel_module.GetNumParams() , num_output_kernels*num_input_kernels*kernel_dims[0]*kernel_dims[1]); TestGetSetParameters<double>(kernel_module, kernel_module.GetNumParams()); }
0444074a4fa63e923f802774192118b6011883df
1118208a7f68175ce3138af84bd81e959e731f67
/cpp/ch7/7_3.cpp
eacbc270a4614221d817b0896f46a47b43d8868f
[]
no_license
yoonsch217/crackingthecodinginterview6th
ff18c4275be8862e4a0d0e9b22ef265aed20873a
60a3f3457be72926e701d21552b5851273a21ad5
refs/heads/master
2022-01-08T01:16:16.347074
2022-01-02T17:56:46
2022-01-02T17:56:46
201,307,755
0
0
null
null
null
null
UTF-8
C++
false
false
781
cpp
class Jukebox{ private: CDPlayer cdPlayer; User user; set<CD> cdCollection; SongSelector ts; public: Jukebox(CDPlayer cdPlayer, User user, set<CD> cdCollection, SongSelector ts){ } Song getCurrentSong(){return ts.getCurrentSong();} void setUser(User u){this.user = u;} }; class CDPlayer{ private: Playlist p; CD c; public: CDPlayer(CD c, Playlist p){ } void playSong(Song s){ } Playlist getPlaylist(){return p;} void setPlaylist(Playlist p){ this.p = p;} CD getCD(){ return c;} void setCD(CD c){this.c = c;} }; class Playlist{ private: Song song; Queue<Song> queue; public: Playlist(Song song, Queue<Song> queue){ } Song getNextSToPlay(){ return queue.peek(); } void queueUpSong(Song s){queue.add(s);} };
c5650c03166bf06b32aa5935cda0ebcbe03e2621
d0317ba18b027ad04d802cadaf2d69dc319d98cb
/lib/UnoCore/Backends/CPlusPlus/Uno/ObjectModel.h
b66b8570b72ea4c43ede05f37763c94b482e67bf
[ "MIT" ]
permissive
afrog33k/uno
aa1aebf2edd7c40ac9e37b95c8e02703f492c73f
adf8035c96c562ac6c50d7b08dbf8ee8457befb1
refs/heads/master
2020-04-09T01:55:57.759640
2018-11-01T18:10:01
2018-11-01T18:10:01
null
0
0
null
null
null
null
UTF-8
C++
false
false
21,960
h
// @(MSG_ORIGIN) // @(MSG_EDIT_WARNING) #pragma once #include <atomic> #include <cstdarg> #include <cstdlib> #include <exception> #if @(REFLECTION:Defined) #include <Uno/Reflection.h> #else #include <Uno/Memory.h> #endif @{Uno.Exception:ForwardDeclaration} struct uObjectMonitor; /** \addtogroup ObjectModel @{ */ struct uObject { uType* __type; uWeakObject* __weakptr; uObjectMonitor* __monitor; #ifdef DEBUG_ARC size_t __size; size_t __id; #endif std::atomic_int __retains; uType* GetType() const; int32_t GetHashCode(); bool Equals(uObject* object); uString* ToString(); protected: uObject() {} private: uObject& operator =(const uObject&); uObject(const uObject&); }; enum uTypeType { uTypeTypeVoid, uTypeTypeEnum, uTypeTypeStruct, uTypeTypeGeneric, uTypeTypeByRef, uTypeTypeClass, uTypeTypeDelegate, uTypeTypeInterface, uTypeTypeArray, }; enum uTypeState { uTypeStateUninitialized, uTypeStateBuilding, uTypeStateBuilt, uTypeStateInitializing, uTypeStateInitialized }; enum uTypeFlags { uTypeFlagsAbstract = 1 << 0, uTypeFlagsRetainStruct = 1 << 1, uTypeFlagsClosedKnown = 1 << 2, uTypeFlagsClosed = 1 << 3, }; enum uFieldFlags { uFieldFlagsConstrained = 1 << 0, uFieldFlagsInherited = 1 << 1, uFieldFlagsStatic = 1 << 2, uFieldFlagsWeak = 1 << 3 }; struct uFieldInfo { union { void* Address; uintptr_t Offset; }; uType* Type; size_t Flags; }; struct uInterfaceInfo { uType* Type; size_t Offset; }; struct uOperatorTable { void(*fp_StorePtr)(uType*, const void*, void*); void(*fp_StoreValue)(uType*, const void*, void*); void(*fp_StoreStrong)(uType*, const void*, void*); void(*fp_StoreStrongValue)(uType*, const void*, void*); }; struct uType : uObject { const char* FullName; uint32_t Type; uint16_t Flags; uint16_t State; size_t TypeSize; size_t ValueSize; size_t ObjectSize; size_t Alignment; #ifdef DEBUG_ARC size_t ObjectCount; #endif // Initialization void Build(); void Init(); size_t DependencyCount; uType** DependencyTypes; void SetDependencies(uType* first, ...); // Inheritance uType* Base; void SetBase(uType* base); // Interfaces size_t InterfaceCount; uInterfaceInfo* Interfaces; void SetInterfaces(uType* type, size_t offset, ...); const void* InterfacePtr(const uObject* object); // Type checking bool Is(const uType* type) const; // Fields size_t FieldCount; uFieldInfo* Fields; void SetFields(size_t inherited); void SetFields(size_t inherited, uType* type, uintptr_t offset, int flags, ...); uTField Field(uTRef object, size_t index); uTField Field(size_t index); // Generics uType* Definition; size_t GenericCount; uType** Generics; size_t MethodTypeCount; uType** MethodTypes; size_t PrecalcCount; uType** PrecalcTypes; void SetPrecalc(uType* first, ...); bool IsClosed(); uType* NewMethodType(size_t genericCount, size_t precalcCount = 0, size_t dependencyCount = 0, bool isDefinition = true); uType* NewMethodType(uType* definition); uType* GetBase(uType* definition); uType* GetVirtual(size_t index, uType* method); uType* MakeGeneric(size_t count, uType** args); uType* MakeMethod(size_t index, uType* first, ...); uType* MakeType(uType* first, ...); uType* Precalced(size_t index); uType* T(size_t index); uType* U(size_t index); uObject* New(); // Arrays uArrayType* _array; uArrayType* Array(); // Pass-by-ref uByRefType* _byRef; uByRefType* ByRef(); // Operators uOperatorTable* Operators; // ARC uObjectRefs Refs; // Reflection #if @(REFLECTION:Defined) uReflection Reflection; #endif // V-table void(*fp_build_)(uType*); const void* fp_ctor_; void(*fp_cctor_)(uType*); void(*fp_Finalize)(uObject*); void(*fp_GetHashCode)(uObject*, int32_t*); void(*fp_Equals)(uObject*, uObject*, bool*); void(*fp_ToString)(uObject*, uString**); }; struct uTypeOptions { uType* BaseDefinition; size_t FieldCount; size_t GenericCount; size_t MethodTypeCount; size_t InterfaceCount; size_t DependencyCount; size_t PrecalcCount; size_t ObjectSize; size_t TypeSize; size_t ValueSize; size_t Alignment; uTypeOptions() { memset(this, 0, sizeof(uTypeOptions)); } }; inline uType* uObject::GetType() const { return __type; } inline int32_t uObject::GetHashCode() { int32_t result; return (*__type->fp_GetHashCode)(this, &result), result; } inline bool uObject::Equals(uObject* object) { bool result; return (*__type->fp_Equals)(this, object, &result), result; } inline uString* uObject::ToString() { uString* result; return (*__type->fp_ToString)(this, &result), result; } #define U_IS_VOID(type) ((type)->Type == uTypeTypeVoid) #define U_IS_BY_REF(type) ((type)->Type >= uTypeTypeByRef) #define U_IS_OBJECT(type) ((type)->Type >= uTypeTypeClass) #define U_IS_VALUE(type) ((type)->Type < uTypeTypeByRef) #define U_IS_ABSTRACT(type) ((type)->Flags & uTypeFlagsAbstract) uType* uObject_typeof(); uType* uVoid_typeof(); /** @} */ /** \addtogroup Exception @{ */ struct uThrowable : public std::exception { @{Uno.Exception} Exception; const char* Function; int Line; uThrowable(@{Uno.Exception} exception, const char* func, int line); uThrowable(const uThrowable& copy); virtual ~uThrowable() throw(); virtual const char* what() const throw(); static U_NORETURN void ThrowIndexOutOfRange(const char* func, int line); static U_NORETURN void ThrowInvalidCast(const char* func, int line); static U_NORETURN void ThrowInvalidCast(const uType* from, const uType* to, const char* func, int line); static U_NORETURN void ThrowInvalidOperation(const char* message, const char* func, int line); static U_NORETURN void ThrowNullReference(const char* func, int line); private: uThrowable& operator =(const uThrowable&); uThrowable(); }; #define U_THROW(exception) throw uThrowable((exception), U_FUNCTION, __LINE__) #define U_THROW_ICE() uThrowable::ThrowInvalidCast(U_FUNCTION, __LINE__) #define U_THROW_ICE2(from, to) uThrowable::ThrowInvalidCast(from, to, U_FUNCTION, __LINE__) #define U_THROW_IOE(message) uThrowable::ThrowInvalidOperation(message, U_FUNCTION, __LINE__) #define U_THROW_IOORE() uThrowable::ThrowIndexOutOfRange(U_FUNCTION, __LINE__) #define U_THROW_NRE() uThrowable::ThrowNullReference(U_FUNCTION, __LINE__) /** @} */ /** \addtogroup Class @{ */ struct uClassType : uType { static uClassType* New(const char* name, uTypeOptions& options); }; uObject* uNew(uType* type); uObject* uNew(uType* type, size_t size); inline bool uIs(const uObject* object, const uType* type) { return object && object->__type->Is(type); } template<class T> T uAs(uObject* object, const uType* type) { U_ASSERT(sizeof(T) == type->ValueSize); return object && object->__type->Is(type) ? (T)object : NULL; } template<class T> T uCast(uObject* object, const uType* type) { U_ASSERT(sizeof(T) == type->ValueSize); if (object && !object->__type->Is(type)) U_THROW_ICE2(object->__type, type); return (T)object; } template<class T> T uPtr(const T& ptr) { if (!ptr) U_THROW_NRE(); return ptr; } template<class T> T uPtr(const uSStrong<T>& ref) { return uPtr(ref._object); } template<class T> T uPtr(const uStrong<T>& ref) { return uPtr(ref._object); } template<class T> T uPtr(const uSWeak<T>& ref) { return uPtr((T)uLoadWeak(ref._object)); } template<class T> T uPtr(const uWeak<T>& ref) { return uPtr((T)uLoadWeak(ref._object)); } /** @} */ /** \addtogroup Interface @{ */ struct uInterfaceType : uType { static uInterfaceType* New(const char* name, size_t genericCount = 0, size_t methodCount = 0); }; struct uInterface { uObject* _object; const void* _vtable; uInterface(uObject* object, uType* interfaceType) { U_ASSERT(interfaceType); _object = object; _vtable = interfaceType->InterfacePtr(object); } template<class T> const T* VTable() const { U_ASSERT(_object && _vtable); return (const T*)_vtable; } uObject* operator ->() const { return _object; } operator uObject*() const { return _object; } }; /** @} */ /** \addtogroup Delegate @{ */ struct uDelegateType : uType { uType* ReturnType; size_t ParameterCount; uType** ParameterTypes; void SetSignature(uType* returnType, ...); static uDelegateType* New(const char* name, size_t parameterCount = 0, size_t genericCount = 0); }; struct uDelegate : uObject { void* _this; const void* _func; uType* _generic; uStrong<uObject*> _object; uStrong<uDelegate*> _prev; void InvokeVoid(); void InvokeVoid(void* arg); void Invoke(uTRef retval, void** args, size_t count); void Invoke(uTRef retval, size_t count = 0, ...); uObject* Invoke(uArray* args = NULL); uObject* Invoke(size_t count, ...); uDelegate* Copy(); static uDelegate* New(uType* type, const void* func, uObject* object = NULL, uType* generic = NULL); static uDelegate* New(uType* type, uObject* object, size_t offset, uType* generic = NULL); static uDelegate* New(uType* type, const uInterface& iface, size_t offset, uType* generic = NULL); }; /** @} */ /** \addtogroup Struct @{ */ struct uStructType : uType { static uStructType* New(const char* name, uTypeOptions& options); // Value adapters (usable w/o boxing) void(*fp_GetHashCode_struct)(void*, uType*, int32_t*); void(*fp_Equals_struct)(void*, uType*, uObject*, bool*); void(*fp_ToString_struct)(void*, uType*, uString**); }; uObject* uBoxPtr(uType* type, const void* src, void* stack = NULL, bool ref = false); void uUnboxPtr(uType* type, uObject* object, void* dst); template<class T> uObject* uBox(uType* type, const T& value, void* stack = NULL) { U_ASSERT(type && type->ValueSize == sizeof(T)); return uBoxPtr(type, &value, stack, true); } template<class T> T uDefault() { T t; return memset(&t, 0, sizeof(T)), t; } template<class T> T uUnbox(uType* type, uObject* object) { T t; U_ASSERT(type && type->ValueSize == sizeof(T)); return uUnboxPtr(type, object, &t), t; } template<class T> T uUnbox(uObject* object) { U_ASSERT(object && object->__type->ValueSize == sizeof(T)); return *(const T*)((const uint8_t*)object + sizeof(uObject)); } /** @} */ /** \addtogroup Enum @{ */ struct uEnumLiteral { uString* Name; int64_t Value; }; struct uEnumType : uType { size_t LiteralCount; uEnumLiteral* Literals; void SetLiterals(const char* name, int64_t value, ...); static uEnumType* New(const char* name, uType* base, size_t literalCount = 0); }; struct uEnum { static bool TryParse(uType* type, uString* value, bool ignoreCase, uTRef result); static uString* GetString(uType* type, void* value); }; /** @} */ /** \addtogroup Array @{ */ struct uArrayType : uType { uType* ElementType; }; struct uArray : uObject { void* _ptr; int32_t _length; int32_t Length() const { return _length; } const void* Ptr() const { return _ptr; } void* Ptr() { return _ptr; } void MarshalPtr(int32_t index, const void* value, size_t size); uTField TItem(int32_t index); uTField TUnsafe(int32_t index); template<class T> T& Item(int32_t index) { U_ASSERT(sizeof(T) == ((uArrayType*)__type)->ElementType->ValueSize); if (index < 0 || index >= _length) U_THROW_IOORE(); return ((T*)_ptr)[index]; } template<class T> uStrong<T>& Strong(int32_t index) { U_ASSERT(sizeof(T) == ((uArrayType*)__type)->ElementType->ValueSize); if (index < 0 || index >= _length) U_THROW_IOORE(); return ((uStrong<T>*)_ptr)[index]; } template<class T> T& Unsafe(int32_t index) { U_ASSERT(sizeof(T) == ((uArrayType*)__type)->ElementType->ValueSize && index >= 0 && index < _length); return ((T*)_ptr)[index]; } template<class T> uStrong<T>& UnsafeStrong(int32_t index) { U_ASSERT(sizeof(T) == ((uArrayType*)__type)->ElementType->ValueSize && index >= 0 && index < _length); return ((uStrong<T>*)_ptr)[index]; } static uArray* New(uType* type, int32_t length, const void* optionalData = NULL); static uArray* InitT(uType* type, int32_t length, ...); template<class T> static uArray* Init(uType* type, int32_t length, ...) { va_list ap; va_start(ap, length); uArray* array = New(type, length); for (int32_t i = 0; i < length; i++) { T item = va_arg(ap, T); array->MarshalPtr(i, &item, sizeof(T)); } va_end(ap); return array; } }; /** @} */ /** \addtogroup String @{ */ struct uString : uObject { char16_t* _ptr; int32_t _length; int32_t Length() const { return _length; } const char16_t* Ptr() const { return _ptr; } const char16_t& Item(int32_t index) const { if (index < 0 || index >= _length) U_THROW_IOORE(); return _ptr[index]; } const char16_t& Unsafe(int32_t index) const { return _ptr[index]; } static uString* New(int32_t length); static uString* Ansi(const char* cstr); static uString* Ansi(const char* cstr, size_t length); static uString* Utf8(const char* mutf8); static uString* Utf8(const char* mutf8, size_t length); static uString* Utf16(const char16_t* nullTerminatedUtf16); static uString* Utf16(const char16_t* utf16, size_t length); static uString* Const(const char* mutf8); static uString* CharArray(const uArray* chars); static uString* CharArrayRange(const uArray* chars, int32_t startIndex, int32_t length); static bool Equals(const uString* left, const uString* right, bool ignoreCase = false); }; // Leak warning: The returned string must be deleted using free() char* uAllocCStr(const uString* string, size_t* length = NULL); // Deprecated: Use free() instead - the parameter type shouldn't be const void DEPRECATED("Use free() instead") uFreeCStr(const char* cstr); struct uCString { char* Ptr; size_t Length; uCString(const uString* string) { Ptr = uAllocCStr(string, &Length); } uCString(const uSStrong<uString*>& string){ Ptr = uAllocCStr(string._object, &Length); } ~uCString() { free(Ptr); } }; /** @} */ /** \addtogroup Generic @{ */ struct uGenericType : uType { size_t GenericIndex; }; struct uTBase { uType* _type; void* _address; uTBase(uType* type, void* address) : _type(type) , _address(address) { U_ASSERT(type && address); } uObject* ObjectPtr() { return *(uObject**)_address; } void* ValuePtr() { return _address; } operator void*() { return U_IS_OBJECT(_type) ? *(void**)_address : _address; } bool operator !() const { return U_IS_OBJECT(_type) && !*(uObject**)_address; } private: uTBase& operator =(const uTBase&) { U_FATAL(); } uTBase() {} }; struct uTRef { void* _address; uTRef(void* address) : _address(address) { } template<class T> T& Value(uType* type) { U_ASSERT(_address); return *(T*)_address; } uTRef& Default(uType* type) { U_ASSERT(_address && type); memset(_address, 0, type->ValueSize); return *this; } uTBase Load(uType* type) { return uTBase(type, _address); } uTRef& Store(uType* type, const void* value) { (*type->Operators->fp_StoreValue)(type, value, _address); return *this; } uTRef& Store(const uTBase& value) { (*value._type->Operators->fp_StorePtr)(value._type, value._address, _address); return *this; } private: uTRef& operator =(const uTRef&); uTRef(); }; struct uTStrongRef : uTBase { uTStrongRef(uType* type, void* address) : uTBase(type, address) { if (U_IS_OBJECT(_type)) uAutoRelease(*(uObject**)_address); } uTStrongRef(const uTStrongRef& copy) : uTBase(copy) { if (U_IS_OBJECT(_type)) uAutoRelease(*(uObject**)_address); } ~uTStrongRef() { if (U_IS_OBJECT(_type)) uRetain(*(uObject**)_address); } operator uTRef&() { return (uTRef&)_address; } }; struct uTField : uTBase { uTField(uType* type, void* address) : uTBase(type, address) { U_ASSERT(!U_IS_OBJECT(type) || !*(uObject**)address || uIs(*(uObject**)address, type)); } uTField& Default() { if (U_IS_OBJECT(_type)) uAutoRelease(*(uObject**)_address); else if (_type->Flags & uTypeFlagsRetainStruct) uAutoReleaseStruct(_type, _address); memset(_address, 0, _type->ValueSize); return *this; } template<class T> uStrong<T>& Strong() { U_ASSERT(sizeof(T) == _type->ValueSize); return *(uStrong<T>*)_address; } template<class T> T& Value() { U_ASSERT(sizeof(T) == _type->ValueSize); return *(T*)_address; } uTField& operator =(const uTField& value) { (*_type->Operators->fp_StoreStrong)(_type, value._address, _address); return *this; } uTField& operator =(const uTBase& value) { (*_type->Operators->fp_StoreStrong)(_type, value._address, _address); return *this; } uTField& operator =(const void* value) { (*_type->Operators->fp_StoreStrongValue)(_type, value, _address); return *this; } uTField operator [](size_t index) { return _type->Field(_address, index); } uTStrongRef operator &() { return uTStrongRef(_type, _address); } bool operator !() const { return U_IS_OBJECT(_type) && !*(uObject**)_address; } }; struct uT : uTBase { uT(uType* type, void* stack) : uTBase(type, stack) { memset(stack, 0, type->ValueSize); } uT(const uT& copy) : uTBase(copy) { if (_type->Flags & uTypeFlagsRetainStruct) uRetainStruct(_type, _address); } ~uT() { if (_type->Flags & uTypeFlagsRetainStruct) uAutoReleaseStruct(_type, _address); } uT& Default() { memset(_address, 0, _type->ValueSize); return *this; } uT& operator =(const uT& value) { (*_type->Operators->fp_StorePtr)(_type, value._address, _address); return *this; } uT& operator =(const uTBase& value) { (*_type->Operators->fp_StorePtr)(_type, value._address, _address); return *this; } uT& operator =(const void* value) { (*_type->Operators->fp_StoreValue)(_type, value, _address); return *this; } uTField operator [](size_t index) { return _type->Field(_address, index); } uTRef& operator &() { return (uTRef&)_address; } bool operator !() const { return U_IS_OBJECT(_type) && !*(uObject**)_address; } }; struct uTPtr { void* _ptr; uTPtr(void* ptr) : _ptr(ptr) { } uTRef& operator &() { return *(uTRef*)this; } operator void*() const { return _ptr; } private: uTPtr& operator =(const uTPtr&); uTPtr(); }; template<class T> bool uIs(const uType* type, const T& value, const uType* test) { U_ASSERT(type); return U_IS_OBJECT(type) ? uIs(*(const uObject**)&value, test) : type->Is(test); } template<class T> uTPtr uConstrain(const uType* type, const T& value) { U_ASSERT(type && type->ValueSize == sizeof(T)); return U_IS_VALUE(type) ? const_cast<T*>(&value) : *(void**)&value; } inline uTPtr uUnboxAny(const uType* type, uObject* object) { U_ASSERT(type); return U_IS_VALUE(type) ? (uint8_t*)uPtr(object) + sizeof(uObject) : (void*)object; } inline uTField uArray::TItem(int32_t index) { if (index < 0 || index >= _length) U_THROW_IOORE(); uType* type = ((uArrayType*)__type)->ElementType; return uTField(type, (uint8_t*)_ptr + type->ValueSize * index); } inline uTField uArray::TUnsafe(int32_t index) { uType* type = ((uArrayType*)__type)->ElementType; return uTField(type, (uint8_t*)_ptr + type->ValueSize * index); } inline uTField uType::Field(size_t index) { U_ASSERT(index < FieldCount); uFieldInfo& field = Fields[index]; U_ASSERT(field.Flags == uFieldFlagsStatic); return uTField(field.Type, field.Address); } inline uTField uType::Field(uTRef object, size_t index) { U_ASSERT(index < FieldCount); uFieldInfo& field = Fields[index]; U_ASSERT(field.Flags == 0 && object._address); return uTField(field.Type, (uint8_t*)object._address + field.Offset); } inline uType* uType::Precalced(size_t index) { U_ASSERT(index < PrecalcCount); return U_ASSERT_PTR(PrecalcTypes[index]); } inline uType* uType::T(size_t index) { U_ASSERT(index < GenericCount); return U_ASSERT_PTR(Generics[index]); } inline uType* uType::U(size_t index) { uGenericType* generic = (uGenericType*)this; U_ASSERT(Type == uTypeTypeGeneric && generic->GenericIndex + index < GenericCount); return U_ASSERT_PTR(Generics[generic->GenericIndex + index]); } /** @} */ /** \addtogroup ByRef @{ */ struct uByRefType : uType { uType* ValueType; }; template<class T> T* uCRef(const T& value) { return const_cast<T*>(&value); } /** @} */
0140fec62b05564bd68a97f0bc1588a2bd04d267
a1fe4dc3a7a4911607ac55a2bd7da19b29f36849
/libnet/base/Date.cc
5650c454ea318bf0867347065b72fe5618e7df66
[]
no_license
Monsterwi/myWebserver
8964c6773abf637bea85dc2d2e8493590498a7dd
264dd6079840188f76e39b88404b11edf70939c0
refs/heads/main
2023-07-27T03:55:28.671566
2021-09-10T14:46:26
2021-09-10T14:46:26
394,996,851
1
0
null
null
null
null
UTF-8
C++
false
false
1,717
cc
#include "libnet/base/Date.h" #include <stdio.h> // snprintf #include <time.h> // struct tm namespace libnet { namespace detail { char require_32_bit_integer_at_least[sizeof(int) >= sizeof(int32_t) ? 1 : -1]; // algorithm and explanation see: // http://www.faqs.org/faqs/calendars/faq/part2/ // http://blog.csdn.net/Solstice int getJulianDayNumber(int year, int month, int day) { (void) require_32_bit_integer_at_least; // no warning please int a = (14 - month) / 12; int y = year + 4800 - a; int m = month + 12 * a - 3; return day + (153*m + 2) / 5 + y*365 + y/4 - y/100 + y/400 - 32045; } struct Date::YearMonthDay getYearMonthDay(int julianDayNumber) { int a = julianDayNumber + 32044; int b = (4 * a + 3) / 146097; int c = a - ((b * 146097) / 4); int d = (4 * c + 3) / 1461; int e = c - ((1461 * d) / 4); int m = (5 * e + 2) / 153; Date::YearMonthDay ymd; ymd.day = e - ((153 * m + 2) / 5) + 1; ymd.month = m + 3 - 12 * (m / 10); ymd.year = b * 100 + d - 4800 + (m / 10); return ymd; } } // namespace detail const int Date::kJulianDayOf1970_01_01 = detail::getJulianDayNumber(1970, 1, 1); } // namespace libnet using namespace libnet; using namespace libnet::detail; Date::Date(int y, int m, int d) : julianDayNumber_(getJulianDayNumber(y, m, d)) { } Date::Date(const struct tm& t) : julianDayNumber_(getJulianDayNumber( t.tm_year+1900, t.tm_mon+1, t.tm_mday)) { } string Date::toIsoString() const { char buf[32]; YearMonthDay ymd(yearMonthDay()); snprintf(buf, sizeof buf, "%4d-%02d-%02d", ymd.year, ymd.month, ymd.day); return buf; } Date::YearMonthDay Date::yearMonthDay() const { return getYearMonthDay(julianDayNumber_); }
2678bd45e77e9ca8bc90d7c7ab7e5385525f7c9f
5f265e8a518b45e770a5ea3931a0913256f9a951
/Source/Shooter/HeroAIController.cpp
9dae9d24c78383d17850054ef6bb57f627e7acce
[]
no_license
filipstachowiak20/Shooter
5ce00104da30e9d5135e8c2f2672cbdf0cdf84b6
a397a8a4c156335233f2fa48a817b1233f4dbac6
refs/heads/main
2023-05-05T17:27:38.329250
2021-05-19T14:48:29
2021-05-19T14:48:29
367,042,446
0
0
null
null
null
null
UTF-8
C++
false
false
3,925
cpp
// Fill out your copyright notice in the Description page of Project Settings. #include "HeroAIController.h" #include "Hero.h" #include "Perception/AIPerceptionComponent.h" #include "Perception/AISenseConfig_Sight.h" #include "BehaviorTree/BehaviorTree.h" #include "BehaviorTree/BlackboardData.h" #include "BehaviorTree/BlackboardComponent.h" AHeroAIController::AHeroAIController() { PawnSensor = CreateDefaultSubobject<UAIPerceptionComponent>(TEXT("PawnSensor")); SightConfig = CreateDefaultSubobject<UAISenseConfig_Sight>(TEXT("Sight Config")); BlackboardComp = CreateDefaultSubobject<UBlackboardComponent>(TEXT("BlackboardComp")); PawnSensor->SetDominantSense(SightConfig->GetSenseImplementation()); PawnSensor->ConfigureSense(*SightConfig); SightConfig->SightRadius = 2500; SightConfig->LoseSightRadius = (3000); SightConfig->PeripheralVisionAngleDegrees = 120.0f; SightConfig->DetectionByAffiliation.bDetectEnemies = true; SightConfig->DetectionByAffiliation.bDetectNeutrals = true; SightConfig->DetectionByAffiliation.bDetectFriendlies = true; PawnSensor->ConfigureSense(*SightConfig); SetPerceptionComponent(*PawnSensor); GetPerceptionComponent()->OnTargetPerceptionUpdated.AddDynamic(this, &AHeroAIController::OnTargetPerceptionUpdated); } void AHeroAIController::BeginPlay() { Super::BeginPlay(); } void AHeroAIController::LookForGun() { //check if there is a gun in radius, if so go pick it up TArray<FHitResult> HitResultsGuns; FCollisionObjectQueryParams QueryParams =FCollisionObjectQueryParams(ECollisionChannel::ECC_GameTraceChannel3); if(!ControlledHero){return;} FVector Loc = ControlledHero->GetActorLocation()+1000*ControlledHero->GetActorForwardVector(); GetWorld()->SweepMultiByObjectType(HitResultsGuns, ControlledHero->GetActorLocation(),ControlledHero->GetActorLocation(),FQuat(), QueryParams,FCollisionShape::MakeSphere(2000)); if(HitResultsGuns.Num() > 0) { MoveToActor(HitResultsGuns[0].GetActor()); IsGunFound = true; IsRunningTowardsGun = true; return; } //gun not found, go to another random point TArray<FHitResult> HitResultsPoints; FCollisionObjectQueryParams QueryParams2 =FCollisionObjectQueryParams(ECollisionChannel::ECC_GameTraceChannel2); GetWorld()->SweepMultiByObjectType(HitResultsPoints, ControlledHero->GetActorLocation(),ControlledHero->GetActorLocation(),FQuat(), QueryParams2,FCollisionShape::MakeSphere(1000)); if(HitResultsPoints.Num()<1) {return;} auto RandomPoint = HitResultsPoints[FMath::RandRange(0,HitResultsPoints.Num()-1)].GetActor(); MoveToActor(RandomPoint); } void AHeroAIController::OnMoveCompleted(FAIRequestID RequestID, const FPathFollowingResult & Result) { Super::OnMoveCompleted(RequestID, Result); if(IsGunFound && IsRunningTowardsGun) { BlackboardComp->InitializeBlackboard(*HeroAIBT->BlackboardAsset); RunBehaviorTree(HeroAIBT); IsRunningTowardsGun = false; if(!ControlledHero->Gun) {//gun was not there anymore when player got there, look for it again IsGunFound = false; LookForGun(); } return; } if(!IsGunFound) {//gun not found, look for it again LookForGun(); } } void AHeroAIController::OnTargetPerceptionUpdated(AActor* Actor, FAIStimulus Stimulus) { if(Stimulus.WasSuccessfullySensed()) { if(BlackboardComp->GetValueAsObject("Enemy")) {//stick to first spotted enemy return;} if(Cast<AHero>(Actor) && IsGunFound && !IsRunningTowardsGun) { BlackboardComp->SetValueAsObject("Enemy", Actor); } } else if(BlackboardComp && Actor == Cast<AActor>(BlackboardComp->GetValueAsObject("Enemy"))) {//allow to stop chasing only if lost sight of primary enemy BlackboardComp->ClearValue("Enemy"); } }
a2013b57c8968c22d4d93777b40868d3a2d72bb8
75452de12ec9eea346e3b9c7789ac0abf3eb1d73
/src/developer/forensics/crash_reports/info/main_service_info.h
54bbcfd9e96d76691381e68b931f7a801b7a8f2c
[ "BSD-3-Clause" ]
permissive
oshunter/fuchsia
c9285cc8c14be067b80246e701434bbef4d606d1
2196fc8c176d01969466b97bba3f31ec55f7767b
refs/heads/master
2022-12-22T11:30:15.486382
2020-08-16T03:41:23
2020-08-16T03:41:23
287,920,017
2
2
BSD-3-Clause
2022-12-16T03:30:27
2020-08-16T10:18:30
C++
UTF-8
C++
false
false
1,295
h
// Copyright 2019 The Fuchsia 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 SRC_DEVELOPER_FORENSICS_CRASH_REPORTS_INFO_MAIN_SERVICE_INFO_H_ #define SRC_DEVELOPER_FORENSICS_CRASH_REPORTS_INFO_MAIN_SERVICE_INFO_H_ #include <memory> #include "src/developer/forensics/crash_reports/config.h" #include "src/developer/forensics/crash_reports/info/info_context.h" #include "src/developer/forensics/utils/inspect_protocol_stats.h" namespace forensics { namespace crash_reports { // Information about the agent we want to export. struct MainServiceInfo { public: MainServiceInfo(std::shared_ptr<InfoContext> context); // Exposes the static configuration of the agent. void ExposeConfig(const Config& config); // Updates stats related to fuchsia.feedback.CrashReportingProductRegister. void UpdateCrashRegisterProtocolStats(InspectProtocolStatsUpdateFn update); // Updates stats related to fuchsia.feedback.CrashReporter. void UpdateCrashReporterProtocolStats(InspectProtocolStatsUpdateFn update); private: std::shared_ptr<InfoContext> context_; }; } // namespace crash_reports } // namespace forensics #endif // SRC_DEVELOPER_FORENSICS_CRASH_REPORTS_INFO_MAIN_SERVICE_INFO_H_
6269ba354926148026e692cb95bd16888564dd43
ba9322f7db02d797f6984298d892f74768193dcf
/emr/src/model/DescribeClusterServiceRequest.cc
b35aecf8a0dc080e1a5c177f3d7e62ab17b92ef2
[ "Apache-2.0" ]
permissive
sdk-team/aliyun-openapi-cpp-sdk
e27f91996b3bad9226c86f74475b5a1a91806861
a27fc0000a2b061cd10df09cbe4fff9db4a7c707
refs/heads/master
2022-08-21T18:25:53.080066
2022-07-25T10:01:05
2022-07-25T10:01:05
183,356,893
3
0
null
2019-04-25T04:34:29
2019-04-25T04:34:28
null
UTF-8
C++
false
false
2,264
cc
/* * Copyright 2009-2017 Alibaba Cloud All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include <alibabacloud/emr/model/DescribeClusterServiceRequest.h> using AlibabaCloud::Emr::Model::DescribeClusterServiceRequest; DescribeClusterServiceRequest::DescribeClusterServiceRequest() : RpcServiceRequest("emr", "2016-04-08", "DescribeClusterService") {} DescribeClusterServiceRequest::~DescribeClusterServiceRequest() {} long DescribeClusterServiceRequest::getResourceOwnerId()const { return resourceOwnerId_; } void DescribeClusterServiceRequest::setResourceOwnerId(long resourceOwnerId) { resourceOwnerId_ = resourceOwnerId; setParameter("ResourceOwnerId", std::to_string(resourceOwnerId)); } std::string DescribeClusterServiceRequest::getRegionId()const { return regionId_; } void DescribeClusterServiceRequest::setRegionId(const std::string& regionId) { regionId_ = regionId; setParameter("RegionId", regionId); } std::string DescribeClusterServiceRequest::getServiceName()const { return serviceName_; } void DescribeClusterServiceRequest::setServiceName(const std::string& serviceName) { serviceName_ = serviceName; setParameter("ServiceName", serviceName); } std::string DescribeClusterServiceRequest::getClusterId()const { return clusterId_; } void DescribeClusterServiceRequest::setClusterId(const std::string& clusterId) { clusterId_ = clusterId; setParameter("ClusterId", clusterId); } std::string DescribeClusterServiceRequest::getAccessKeyId()const { return accessKeyId_; } void DescribeClusterServiceRequest::setAccessKeyId(const std::string& accessKeyId) { accessKeyId_ = accessKeyId; setParameter("AccessKeyId", accessKeyId); }
22d02448fe3b3aa519a247b325651b6f65b7a287
cc5a1bf6996614009c6370ee36d3210da5cb7139
/runtime/mac/AirGame-desktop.app/Contents/Resources/res/ch23/LostRoutes/frameworks/cocos2d-x/cocos/editor-support/cocostudio/CCSGUIReader.h
9c50b6a8ed387a929a8cc66842a15f59da23b1c4
[ "MIT" ]
permissive
huangjin0/AirGame
fd8218f7bbe2f9ca394156d20ee1ff1f6c311826
0e8cb5d53b17fb701ea7fe34b2d87dde473053f3
refs/heads/master
2021-01-21T18:11:22.363750
2017-05-23T06:59:45
2017-05-23T06:59:45
92,020,449
0
0
null
null
null
null
UTF-8
C++
false
false
11,389
h
/**************************************************************************** Copyright (c) 2013-2014 Chukong Technologies Inc. http://www.cocos2d-x.org Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ****************************************************************************/ #ifndef __CCSGUIREADER_H__ #define __CCSGUIREADER_H__ #include "ui/UILayout.h" #include "editor-support/cocostudio/DictionaryHelper.h" #include "editor-support/cocostudio/WidgetReader/WidgetReaderProtocol.h" #include "base/ObjectFactory.h" #include "editor-support/cocostudio/CocosStudioExport.h" #include "base/CCValue.h" namespace protocolbuffers { class NodeTree; } namespace tinyxml2 { class XMLElement; } namespace cocostudio { class CocoLoader; struct stExpCocoNode; #define kCCSVersion 1.0 typedef void (cocos2d::Ref::*SEL_ParseEvent)(const std::string&, cocos2d::Ref*, const rapidjson::Value&); #define parseselector(_SELECTOR) (SEL_ParseEvent)(&_SELECTOR) class CC_STUDIO_DLL GUIReader : public cocos2d::Ref { public: CC_DEPRECATED_ATTRIBUTE static GUIReader* shareReader() { return GUIReader::getInstance(); }; CC_DEPRECATED_ATTRIBUTE static void purgeGUIReader() { GUIReader::destroyInstance(); }; static GUIReader* getInstance(); static void destroyInstance(); cocos2d::ui::Widget* widgetFromJsonFile(const char* fileName); cocos2d::ui::Widget* widgetFromBinaryFile(const char* fileName); int getVersionInteger(const char* str); /** * @js NA */ void storeFileDesignSize(const char* fileName, const cocos2d::Size &size); /** * @js NA */ cocos2d::Size getFileDesignSize(const char* fileName) const; void setFilePath(const std::string& strFilePath) { m_strFilePath = strFilePath; } const std::string& getFilePath() const { return m_strFilePath; } void registerTypeAndCallBack(const std::string& classType, cocos2d::ObjectFactory::Instance ins, Ref* object, SEL_ParseEvent callBack); void registerTypeAndCallBack(const std::string& classType, cocos2d::ObjectFactory::InstanceFunc ins, Ref* object, SEL_ParseEvent callBack); protected: GUIReader(); ~GUIReader(); std::string m_strFilePath; cocos2d::ValueMap _fileDesignSizes; typedef std::map<std::string, SEL_ParseEvent> ParseCallBackMap; ParseCallBackMap _mapParseSelector; typedef std::map<std::string, Ref*> ParseObjectMap; ParseObjectMap _mapObject; public: ParseCallBackMap* getParseCallBackMap() { return &_mapParseSelector; }; ParseObjectMap* getParseObjectMap() { return &_mapObject; }; }; class CC_STUDIO_DLL WidgetPropertiesReader : public cocos2d::Ref { public: virtual cocos2d::ui::Widget* createWidget(const rapidjson::Value& dic, const char* fullPath, const char* fileName)=0; virtual cocos2d::ui::Widget* widgetFromJsonDictionary(const rapidjson::Value& data) = 0; virtual void setPropsForAllWidgetFromJsonDictionary(WidgetReaderProtocol* reader, cocos2d::ui::Widget* widget, const rapidjson::Value& options) = 0; virtual void setPropsForAllCustomWidgetFromJsonDictionary(const std::string& classType, cocos2d::ui::Widget* widget, const rapidjson::Value& customOptions) = 0; //add binary parsing virtual cocos2d::ui::Widget* createWidgetFromBinary(CocoLoader* cocoLoader,stExpCocoNode* pCocoNode, const char* fileName)=0; virtual cocos2d::ui::Widget* widgetFromBinary(CocoLoader* cocoLoader, stExpCocoNode* pCocoNode) = 0; virtual void setPropsForAllWidgetFromBinary(WidgetReaderProtocol* reader, cocos2d::ui::Widget* widget, CocoLoader* cocoLoader, stExpCocoNode* pCocoNode) = 0; protected: void setAnchorPointForWidget(cocos2d::ui::Widget* widget, const rapidjson::Value&options); std::string getWidgetReaderClassName(const std::string& classname); std::string getWidgetReaderClassName(cocos2d::ui::Widget *widget); std::string getGUIClassName(const std::string& name); cocos2d::ui::Widget *createGUI(const std::string& classname); WidgetReaderProtocol* createWidgetReaderProtocol(const std::string& classname); protected: std::string m_strFilePath; }; class CC_STUDIO_DLL WidgetPropertiesReader0250 : public WidgetPropertiesReader { public: WidgetPropertiesReader0250(){}; virtual ~WidgetPropertiesReader0250(){}; virtual cocos2d::ui::Widget* createWidget(const rapidjson::Value& dic, const char* fullPath, const char* fileName) override; virtual cocos2d::ui::Widget* widgetFromJsonDictionary(const rapidjson::Value& dic) override; //added for binary parsing virtual cocos2d::ui::Widget* createWidgetFromBinary(CocoLoader* cocoLoader, stExpCocoNode* pCocoNode, const char* fileName)override{return nullptr;} virtual cocos2d::ui::Widget* widgetFromBinary(CocoLoader* cocoLoader, stExpCocoNode* pCocoNode) override {return nullptr;} virtual void setPropsForAllWidgetFromBinary(WidgetReaderProtocol* reader, cocos2d::ui::Widget* widget, CocoLoader* cocoLoader, stExpCocoNode* pCocoNode) override {} virtual void setPropsForWidgetFromJsonDictionary(cocos2d::ui::Widget* widget,const rapidjson::Value& options); virtual void setColorPropsForWidgetFromJsonDictionary(cocos2d::ui::Widget* widget,const rapidjson::Value& options); virtual void setPropsForButtonFromJsonDictionary(cocos2d::ui::Widget* widget,const rapidjson::Value& options); virtual void setPropsForCheckBoxFromJsonDictionary(cocos2d::ui::Widget* widget,const rapidjson::Value& options); virtual void setPropsForImageViewFromJsonDictionary(cocos2d::ui::Widget* widget,const rapidjson::Value& options); virtual void setPropsForLabelFromJsonDictionary(cocos2d::ui::Widget* widget,const rapidjson::Value& options); virtual void setPropsForLabelAtlasFromJsonDictionary(cocos2d::ui::Widget* widget,const rapidjson::Value& options); virtual void setPropsForLabelBMFontFromJsonDictionary(cocos2d::ui::Widget* widget,const rapidjson::Value& options); virtual void setPropsForLoadingBarFromJsonDictionary(cocos2d::ui::Widget* widget,const rapidjson::Value& options); virtual void setPropsForSliderFromJsonDictionary(cocos2d::ui::Widget* widget,const rapidjson::Value& options); virtual void setPropsForTextFieldFromJsonDictionary(cocos2d::ui::Widget* widget,const rapidjson::Value& options); virtual void setPropsForLayoutFromJsonDictionary(cocos2d::ui::Widget* widget,const rapidjson::Value& options); virtual void setPropsForScrollViewFromJsonDictionary(cocos2d::ui::Widget* widget,const rapidjson::Value& options); virtual void setPropsForAllWidgetFromJsonDictionary(WidgetReaderProtocol* reader, cocos2d::ui::Widget* widget, const rapidjson::Value& options) override; virtual void setPropsForAllCustomWidgetFromJsonDictionary(const std::string& classType, cocos2d::ui::Widget* widget, const rapidjson::Value& customOptions) override; }; class CC_STUDIO_DLL WidgetPropertiesReader0300 : public WidgetPropertiesReader { public: WidgetPropertiesReader0300(){}; virtual ~WidgetPropertiesReader0300(){}; virtual cocos2d::ui::Widget* createWidget(const rapidjson::Value& dic, const char* fullPath, const char* fileName) override; //add bin parse support virtual cocos2d::ui::Widget* createWidgetFromBinary(CocoLoader* cocoLoader, stExpCocoNode* pCocoNode, const char* fileName)override; virtual cocos2d::ui::Widget* widgetFromBinary(CocoLoader* cocoLoader, stExpCocoNode* pCocoNode) override; virtual void setPropsForAllWidgetFromBinary(WidgetReaderProtocol* reader, cocos2d::ui::Widget* widget, CocoLoader* cocoLoader, stExpCocoNode* pCocoNode) override; virtual void setPropsForAllCustomWidgetFromBinary(const std::string& classType, cocos2d::ui::Widget* widget, CocoLoader* cocoLoader, stExpCocoNode* pCocoNode) { //TODO: custom property } virtual cocos2d::ui::Widget* widgetFromJsonDictionary(const rapidjson::Value& dic) override; virtual void setPropsForAllWidgetFromJsonDictionary(WidgetReaderProtocol* reader, cocos2d::ui::Widget* widget, const rapidjson::Value& options) override; virtual void setPropsForAllCustomWidgetFromJsonDictionary(const std::string& classType, cocos2d::ui::Widget* widget, const rapidjson::Value& customOptions) override; }; } #endif /* defined(__CCSGUIReader__) */