blob_id
stringlengths 40
40
| directory_id
stringlengths 40
40
| path
stringlengths 3
264
| content_id
stringlengths 40
40
| detected_licenses
listlengths 0
85
| license_type
stringclasses 2
values | repo_name
stringlengths 5
140
| snapshot_id
stringlengths 40
40
| revision_id
stringlengths 40
40
| branch_name
stringclasses 986
values | visit_date
timestamp[us] | revision_date
timestamp[us] | committer_date
timestamp[us] | github_id
int64 3.89k
681M
⌀ | star_events_count
int64 0
209k
| fork_events_count
int64 0
110k
| gha_license_id
stringclasses 23
values | gha_event_created_at
timestamp[us] | gha_created_at
timestamp[us] | gha_language
stringclasses 145
values | src_encoding
stringclasses 34
values | language
stringclasses 1
value | is_vendor
bool 1
class | is_generated
bool 2
classes | length_bytes
int64 3
10.4M
| extension
stringclasses 122
values | content
stringlengths 3
10.4M
| authors
listlengths 1
1
| author_id
stringlengths 0
158
|
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
15e8f1c7bb08ef25ddbab7a1d98fc8ac5a901709
|
3871c5adec9880d6ef7e4d60c079d8f3f23fa8a2
|
/VCECore/gpuz_info.cpp
|
4767887153e409c6465fac1740c30816e071995b
|
[
"MIT",
"Zlib",
"BSD-2-Clause"
] |
permissive
|
rigaya/VCEEnc
|
5bc4878383a37c18a83c4aed1047a311e1c12c70
|
101a1b3dcd16e0bf951f2897187396ba64be3e09
|
refs/heads/master
| 2023-07-06T10:06:44.198622
| 2023-06-23T23:49:05
| 2023-06-23T23:50:41
| 79,711,619
| 192
| 31
|
NOASSERTION
| 2023-09-11T14:48:14
| 2017-01-22T10:45:01
|
C++
|
UTF-8
|
C++
| false
| false
| 3,535
|
cpp
|
// -----------------------------------------------------------------------------------------
// QSVEnc by rigaya
// -----------------------------------------------------------------------------------------
// The MIT License
//
// Copyright (c) 2011-2016 rigaya
//
// 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.
//
// --------------------------------------------------------------------------------------------
#if (defined(_WIN32) || defined(_WIN64))
#define WIN32_LEAN_AND_MEAN
#define NOMINMAX
#include <Windows.h>
#include "gpuz_info.h"
//大文字小文字を無視して、1文字検索
static inline const WCHAR *wcsichr(const WCHAR *str, int c) {
c = tolower(c);
for (; *str; str++)
if (c == tolower(*str))
return str;
return NULL;
}
//大文字小文字を無視して、文字列を検索
static inline const WCHAR *wcsistr(const WCHAR *str, const WCHAR *substr) {
size_t len = 0;
if (substr && (len = wcslen(substr)) != NULL)
for (; (str = wcsichr(str, substr[0])) != NULL; str++)
if (_wcsnicmp(str, substr, len) == NULL)
return str;
return NULL;
}
int get_gpuz_info(GPUZ_SH_MEM *data) {
HANDLE memmap = OpenFileMapping(FILE_MAP_READ, FALSE, SHMEM_NAME);
if (NULL == memmap) {
return 1;
}
GPUZ_SH_MEM *ptr = (GPUZ_SH_MEM *)MapViewOfFile(memmap, FILE_MAP_READ, 0, 0, 0);
if (ptr == nullptr) {
CloseHandle(memmap);
return 1;
}
memcpy(data, ptr, sizeof(data[0]));
UnmapViewOfFile(ptr);
CloseHandle(memmap);
return 0;
}
double gpu_core_clock(GPUZ_SH_MEM *data) {
for (int i = 0; i < MAX_RECORDS; i++) {
if ( wcsistr(data->sensors[i].name, L"Core")
&& wcsistr(data->sensors[i].name, L"Clock")) {
return data->sensors[i].value;
}
}
return 0.0;
}
double gpu_load(GPUZ_SH_MEM *data) {
for (int i = 0; i < MAX_RECORDS; i++) {
if (wcsistr(data->sensors[i].name, L"GPU Load")) {
return data->sensors[i].value;
}
}
return 0.0;
}
double video_engine_load(GPUZ_SH_MEM *data, bool *pbVideoEngineUsage) {
for (int i = 0; i < MAX_RECORDS; i++) {
if (wcsistr(data->sensors[i].name, L"Video Engine Load")) {
if (pbVideoEngineUsage) *pbVideoEngineUsage = true;
return data->sensors[i].value;
}
}
if (pbVideoEngineUsage) *pbVideoEngineUsage = false;
return 0.0;
}
#endif //#if (defined(_WIN32) || defined(_WIN64))
|
[
"rigaya34589@live.jp"
] |
rigaya34589@live.jp
|
cea47116b47861abdfbce713b22f3d3cc502974e
|
ba73558a3ef4d207382ad1d5811f5d9f7a3c5ff3
|
/old/infoRiego.ino
|
f62cc9cdf3580e93af6e1e388f5b80454c6bedcd
|
[
"MIT"
] |
permissive
|
josepedrodiaz/germinatorII
|
b6dbfd8f383acedbebd64c376367da59cdfb8978
|
34466b8087902d4f6eb82cfae5ff56356eefe23a
|
refs/heads/master
| 2020-08-03T02:00:53.625715
| 2020-01-06T21:07:36
| 2020-01-06T21:07:36
| 211,590,787
| 1
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 718
|
ino
|
/*
* De acuerdo a la lectura del sensor de humedad del suelo
* blink el led de aviso de riego
*/
bool infoRiego(int sensorHumedadSueloVal){
int guinios; // número de guinios que hará el led de info
//Las mediciones en la maceta arrojan resultados entre 70 y 556
// pero por debajo de 420 ya esta muy seca la tierra
if( sensorHumedadSueloVal > 420){
//no hay señal de led si esta bien regado
digitalWrite(riegoLed, LOW);
} else if ( sensorHumedadSueloVal <= 420 && sensorHumedadSueloVal >= 400 ){
guinios = 10;
guiniaLed(guinios, 400, riegoLed);
} else if ( sensorHumedadSueloVal < 400 ){
digitalWrite(riegoLed, HIGH);
}
return true;
}
|
[
"josepedrodiaz@gmail.com"
] |
josepedrodiaz@gmail.com
|
d994574a7d9ad4691c64e66b3211f1079f0d72c8
|
28869ba91fcd52c281ed88e6dc0dba96c35ffe07
|
/include/ThickArrow.hpp
|
dfb41dcf0fd2758420c69196e8c38240f1addbc9
|
[] |
no_license
|
elro444/SFML-Linear-Algebra
|
e677ec3f380035a4f072732aa8a5a8dfed2ad1f5
|
83e8b0856b119cc1c4204b5f2cc79c06e7d921af
|
refs/heads/master
| 2023-07-15T06:37:57.663486
| 2021-08-15T21:18:47
| 2021-08-16T06:25:25
| 395,536,013
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 826
|
hpp
|
#include <SFML/Graphics/Drawable.hpp>
#include <SFML/Graphics/RectangleShape.hpp>
#include <SFML/Graphics/ConvexShape.hpp>
class ThickArrow
: public sf::Drawable
{
private:
mutable sf::RectangleShape m_line;
mutable sf::ConvexShape m_tip;
sf::Vector2f m_head;
sf::Vector2f m_tail;
sf::Color m_color;
float m_thickness;
float m_tipRadius;
bool m_should_invalidate;
public:
ThickArrow(float thickness, float tipRadius);
ThickArrow(sf::Vector2f tail, sf::Vector2f head, float thickness, sf::Color color, float tipRadius);
void setHeadPos(sf::Vector2f pos);
void setTailPos(sf::Vector2f pos);
void setColor(sf::Color color);
protected:
virtual void draw(sf::RenderTarget& target, sf::RenderStates states) const override;
private:
void invalidate() const;
};
|
[
"elro444@gmail.com"
] |
elro444@gmail.com
|
3804baee94cc497f71a5bd2d4e1cb340dd503c54
|
55d128c0eceb566d4005971b4b540865dc79e25e
|
/Client/win-system/PipeClient.cpp
|
166fb1528f20668f7e8daa4f9694bf12c2a28ab1
|
[] |
no_license
|
radtek/PandaRC
|
bed7f1fb68bbd0a40eea74de1bbf6bed712eef9e
|
c98b333ac77ac20aa536f203e4dc795754450f02
|
refs/heads/master
| 2021-02-17T03:35:36.074874
| 2019-06-05T05:57:37
| 2019-06-05T05:57:37
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 2,831
|
cpp
|
//// Copyright (C) 2009,2010,2011,2012 GlavSoft LLC.
//// All rights reserved.
////
////-------------------------------------------------------------------------
//// This file is part of the TightVNC software. Please visit our Web site:
////
//// http://www.tightvnc.com/
////
//// This program is free software; you can redistribute it and/or modify
//// it under the terms of the GNU General Public License as published by
//// the Free Software Foundation; either version 2 of the License, or
//// (at your option) any later version.
////
//// This program is distributed in the hope that it will be useful,
//// but WITHOUT ANY WARRANTY; without even the implied warranty of
//// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
//// GNU General Public License for more details.
////
//// You should have received a copy of the GNU General Public License along
//// with this program; if not, write to the Free Software Foundation, Inc.,
//// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
////-------------------------------------------------------------------------
////
//
//#include "PipeClient.h"
//#include "util/Exception.h"
//
//PipeClient::PipeClient()
//{
//}
//
//NamedPipe *PipeClient::connect(const TCHAR *name, unsigned int maxPortionSize)
//{
// StringStorage pipeName;
// pipeName.format(_T("\\\\.\\pipe\\%s"), name);
//
// HANDLE hPipe;
// hPipe = CreateFile(pipeName.getString(), // pipe name
// GENERIC_READ | // read and write access
// GENERIC_WRITE,
// 0, // no sharing
// NULL, // default security attributes
// OPEN_EXISTING, // opens existing pipe
// FILE_FLAG_OVERLAPPED, // asynchronous mode
// NULL); // no template file
//
// if (hPipe == INVALID_HANDLE_VALUE) {
// int errCode = GetLastError();
// StringStorage errMess;
// errMess.format(_T("Connect to pipe server failed, error code = %d"), errCode);
// throw Exception(errMess.getString());
// }
//
// DWORD dwMode = PIPE_READMODE_BYTE;
// if (!SetNamedPipeHandleState(hPipe, // pipe handle
// &dwMode, // new pipe mode
// NULL, // don't set maximum bytes
// NULL) // don't set maximum time
// ) {
// int errCode = GetLastError();
// StringStorage errMess;
// errMess.format(_T("SetNamedPipeHandleState failed, error code = %d"), errCode);
// throw Exception(errMess.getString());
// }
//
// return new NamedPipe(hPipe, maxPortionSize, false);
//}
|
[
"415893943@qq.com"
] |
415893943@qq.com
|
f25edfb3f50fed1fc24bb022e5be4c0a3e2fa6eb
|
2f557f60fc609c03fbb42badf2c4f41ef2e60227
|
/CommonTools/Utils/test/testSelectIterator.cc
|
4a42cc4641825cb65d9c47380281613f011abda2
|
[
"Apache-2.0"
] |
permissive
|
CMS-TMTT/cmssw
|
91d70fc40a7110832a2ceb2dc08c15b5a299bd3b
|
80cb3a25c0d63594fe6455b837f7c3cbe3cf42d7
|
refs/heads/TMTT_1060
| 2020-03-24T07:49:39.440996
| 2020-03-04T17:21:36
| 2020-03-04T17:21:36
| 142,576,342
| 3
| 5
|
Apache-2.0
| 2019-12-05T21:16:34
| 2018-07-27T12:48:13
|
C++
|
UTF-8
|
C++
| false
| false
| 1,452
|
cc
|
#include <cppunit/extensions/HelperMacros.h>
#include "CommonTools/Utils/interface/PtMinSelector.h"
#include "CommonTools/Utils/interface/Selection.h"
#include <iostream>
#include <vector>
#include <iterator>
#include <algorithm>
class testSelectIterator : public CppUnit::TestFixture {
CPPUNIT_TEST_SUITE(testSelectIterator);
CPPUNIT_TEST(checkAll);
CPPUNIT_TEST_SUITE_END();
public:
void setUp() {}
void tearDown() {}
void checkAll();
};
CPPUNIT_TEST_SUITE_REGISTRATION( testSelectIterator );
namespace test {
struct A {
explicit A( double x ) : x_( x ) { }
double pt() const { return x_; }
private:
double x_;
};
}
void testSelectIterator::checkAll() {
using namespace test;
using namespace std;
vector<A> v;
for( double x = 0; x < 10.1; ++ x )
v.push_back(A(x));
CPPUNIT_ASSERT( v.size() == 11 );
PtMinSelector select( 3.5 );
Selection<vector<A>, PtMinSelector> sel( v, select );
CPPUNIT_ASSERT( sel.size() == 7 );
for( size_t i = 0; i < sel.size(); ++ i ) {
CPPUNIT_ASSERT( select( sel[i]) );
}
for( Selection<vector<A>, PtMinSelector>::const_iterator i = sel.begin();
i != sel.end(); ++ i ) {
CPPUNIT_ASSERT( select( * i ) );
}
vector<A> selected;
copy( sel.begin(), sel.end(), back_inserter( selected ) );
CPPUNIT_ASSERT( sel.size() == selected.size() );
for( size_t i = 0; i < selected.size(); ++ i ) {
CPPUNIT_ASSERT( select( selected[i]) );
}
}
|
[
"giulio.eulisse@gmail.com"
] |
giulio.eulisse@gmail.com
|
c2a42a3b3454a0ce997e8519681851bacba230bc
|
4e006837ed7b91e877ec0fc9bd1c9b6e43131901
|
/oxygine-framework/oxygine/src/oxygine/UpdateState.h
|
8b5a5998bc76ff4fdf41c3a6a62f3fc440493151
|
[
"MIT"
] |
permissive
|
Poscowekh/Project
|
52be9104b0ab16c9a504b4295e0a23cadd72ac7a
|
3385c24646c951e37097b8ec1cfc29e9c5f44e05
|
refs/heads/master
| 2022-09-18T13:33:37.504605
| 2020-06-02T19:03:08
| 2020-06-02T19:03:08
| 259,675,760
| 0
| 0
| null | 2020-05-01T08:58:11
| 2020-04-28T15:24:50
|
C
|
UTF-8
|
C++
| false
| false
| 379
|
h
|
#pragma once
#include "oxygine-include.h"
namespace oxygine
{
class UpdateState
{
public:
UpdateState(): time(0), dt(0), iteration(0) {}
/**local time*/
timeMS time;
/**delta time since last update*/
timeMS dt;
/**current iteration, used with fixed Clock update */
int iteration;
};
}
|
[
"ziuwari@ya.ru"
] |
ziuwari@ya.ru
|
0cc86a56805a3ed9d435a3b7f5f2467efcbdd7bf
|
2f24e6293051ef412481351e9788a05dc5438260
|
/cpp/test/method_add.cpp
|
b2f3991633a7cf09340a797640c448c5c68810d5
|
[] |
no_license
|
erich0929/programming
|
672392e977d5687ecd8db3fd7eeaa6e65195fc15
|
3f2c6641b1538aa6b12bb665636bde58a226fc2a
|
refs/heads/master
| 2021-01-22T11:58:20.451378
| 2014-08-23T08:13:36
| 2014-08-23T08:13:36
| 22,387,139
| 0
| 1
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 321
|
cpp
|
#include <iostream>
#include <stdio.h>
using namespace std;
class CTest {
public :
int i;
public :
virtual void do_something () { };
};
int main(void)
{
CTest temp1, temp2;
printf ("temp1 method address : %p\n", &temp1.do_something);
printf ("temp2 method address : %p\n", &temp2.do_something);
return 0;
}
|
[
"erich0929@erich0929-A505-UE30K.(none)"
] |
erich0929@erich0929-A505-UE30K.(none)
|
eb40dda9c6bb24670d9f82c2ebf1027ae7f95694
|
4e09dc649d946c5ed6bc32aafb87d49ed400eb06
|
/rig/technique.cpp
|
76a583275f2c6666d72e48971368ffda066a8a71
|
[] |
no_license
|
remibasaru/rigged-hand
|
ac8ecee6cf1c177ab0235fc11c2cf33639b70b3d
|
bf9ec88c6e9063c1c5b3e8309ce0e66fbe9703b1
|
refs/heads/master
| 2022-10-26T22:20:03.340391
| 2020-06-18T14:05:59
| 2020-06-18T14:05:59
| 273,246,438
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 3,473
|
cpp
|
#include <stdio.h>
#include <string.h>
#include "util.h"
#include "technique.h"
Technique::Technique()
{
m_shaderProg = 0;
}
Technique::~Technique()
{
// Delete the intermediate shader objects that have been added to the program
// The list will only contain something if shaders were compiled but the object itself
// was destroyed prior to linking.
for (ShaderObjList::iterator it = m_shaderObjList.begin() ; it != m_shaderObjList.end() ; it++)
{
glDeleteShader(*it);
}
if (m_shaderProg != 0)
{
glDeleteProgram(m_shaderProg);
m_shaderProg = 0;
}
}
bool Technique::Init()
{
m_shaderProg = glCreateProgram();
if (m_shaderProg == 0)
{
fprintf(stderr, "Error creating shader program\n");
return false;
}
return true;
}
// Use this method to add shaders to the program. When finished - call finalize()
bool Technique::AddShader(GLenum ShaderType,const char* pFilename)
{
string s;
if (!ReadFile(pFilename, s))
{
return false;
}
GLuint ShaderObj = glCreateShader(ShaderType);
if (ShaderObj == 0)
{
fprintf(stderr, "Error creating shader type %d\n", ShaderType);
return false;
}
// Save the shader object - will be deleted in the destructor
m_shaderObjList.push_back(ShaderObj);
const GLchar* p[1];
p[0] = s.c_str();
GLint Lengths[1];
Lengths[0] = (GLint)s.size();
glShaderSource(ShaderObj, 1, p, Lengths);
glCompileShader(ShaderObj);
GLint success;
glGetShaderiv(ShaderObj, GL_COMPILE_STATUS, &success);
if (!success)
{
GLchar InfoLog[1024];
glGetShaderInfoLog(ShaderObj, 1024, NULL, InfoLog);
fprintf(stderr, "Error compiling shader type %d: '%s'\n", ShaderType, InfoLog);
return false;
}
glAttachShader(m_shaderProg, ShaderObj);
return true;
}
// After all the shaders have been added to the program call this function
// to link and validate the program.
bool Technique::Finalize()
{
GLint Success = 0;
GLchar ErrorLog[1024] = { 0 };
glLinkProgram(m_shaderProg);
glGetProgramiv(m_shaderProg, GL_LINK_STATUS, &Success);
if (Success == 0)
{
glGetProgramInfoLog(m_shaderProg, sizeof(ErrorLog), NULL, ErrorLog);
fprintf(stderr, "Error linking shader program: '%s'\n", ErrorLog);
return false;
}
glValidateProgram(m_shaderProg);
glGetProgramiv(m_shaderProg, GL_VALIDATE_STATUS, &Success);
if (!Success)
{
glGetProgramInfoLog(m_shaderProg, sizeof(ErrorLog), NULL, ErrorLog);
fprintf(stderr, "Invalid shader program: '%s'\n", ErrorLog);
return false;
}
// Delete the intermediate shader objects that have been added to the program
for (ShaderObjList::iterator it = m_shaderObjList.begin() ; it != m_shaderObjList.end() ; it++)
{
glDeleteShader(*it);
}
m_shaderObjList.clear();
return true;
}
void Technique::Enable()
{
glUseProgram(m_shaderProg);
}
GLint Technique::GetUniformLocation(const char* pUniformName)
{
GLint Location = glGetUniformLocation(m_shaderProg, pUniformName);
if (Location == 0xFFFFFFFF)
{
fprintf(stderr, "Warning! Unable to get the location of uniform '%s'\n", pUniformName);
}
return Location;
}
|
[
"remi.basaru@aol.com"
] |
remi.basaru@aol.com
|
6b90578f89224165a5f96fb630c33ff5385fddd3
|
2091e1fdd6b69a1f3475824ebc90798f949fa647
|
/Pixel.h
|
286f03f378abe0f3582063215c0b163a6529bcb0
|
[] |
no_license
|
KekKekovich/PIXELEND
|
dfc7ea3845bd7d15906aec1ec08835bee2ce135d
|
69c79d0fb2742127ff8cb4dbc72347b82a7979e2
|
refs/heads/master
| 2021-05-06T02:34:32.754300
| 2017-12-17T21:18:10
| 2017-12-17T21:18:10
| 114,569,328
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 608
|
h
|
//
// Created by idalov on 24.10.2017.
//
#ifndef DGW_MOOP_1_PIXEL_H
#define DGW_MOOP_1_PIXEL_H
class Pixel{
private:
int X,Y;
int R,G,B;
public:
int getX() const {
return X;
}
int getY() const {
return Y;
}
int getR() const {
return R;
}
int getG() const {
return G;
}
int getB() const {
return B;
}
public:
Pixel(int X, int Y, int R, int G, int B);
protected:
void setX(int X);
void setY(int Y);
void setR(int R);
void setG(int G);
void setB(int B);
};
#endif //DGW_MOOP_1_PIXEL_H
|
[
"Ilyavikt-95@mail.ru"
] |
Ilyavikt-95@mail.ru
|
8cae734683f5d3c3d72521b47c15fa026302f46f
|
96961c8f7e96ce7a8a2d37f245f50d44c4941cb1
|
/C++/matXvect.cpp
|
6ad60e4aacc2dfcbd65ec2c147c4a52217df5680
|
[] |
no_license
|
EALH/Prog_Paralela
|
a82beff37962ddbb1357a280d0aba97bd07c03c5
|
3eb6ac439524a7e4d91e8206396932e8d13ec9a2
|
refs/heads/master
| 2022-09-14T02:29:49.264709
| 2020-06-03T00:12:00
| 2020-06-03T00:12:00
| 268,922,250
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 3,512
|
cpp
|
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <math.h>
#include <pthread.h>
#include <sys/time.h>
int NUM_OF_THREADS, M, N;
float* A;
float* x;
float* y;
float* y_serial;
int _check_results(float x[], float y[])
{
int i;
for(int i = 0; i < M; i++)
if(abs(x[i] - y[i]) > 0.01) return 1;
return 0;
}
long _calc_time_secs(timeval start, timeval end)
{
long seconds, useconds;
seconds = end.tv_sec - start.tv_sec;
useconds = end.tv_usec - start.tv_usec;
return ((seconds) * 1000 + useconds/1000.0) + 0.5;
}
void Fill_Matrix(float A[], int rows, int cols);
void Fill_Vector(float x[], int rows);
void Print_Matrix(float A[], int rows, int cols);
void Print_Vector(float x[], int rows);
void *_math_vec_prod(void* rank);
void _math_vec_prod(void);
int main(int argc, char* argv[]){
timeval start;
timeval end;
long final_par, final_serial;
if(argc != 4)
{
fputs("Debe colocar M, N y el número de hilos\n", stdout);
return EXIT_FAILURE;
}
else
{
M = atoi(argv[1]);
N = atoi(argv[2]);
NUM_OF_THREADS = atoi(argv[3]);
}
srand(time(NULL));
int i, _error;
pthread_t* threads = (pthread_t *)malloc(NUM_OF_THREADS * sizeof(pthread_t));
A = (float *) malloc(M * N * sizeof(float));
x = (float *) malloc(N * sizeof(float));
y = (float *) malloc(M * sizeof(float));
y_serial = (float *) malloc(M * sizeof(float));
Fill_Matrix(A, M, N);
Fill_Vector(x, N);
gettimeofday(&start, 0);
for(i = 0; i < NUM_OF_THREADS; i++)
{
_error = pthread_create(&threads[i], NULL,
_math_vec_prod, &i);
if (_error){
fprintf(stderr, "error: pthread_create, rc: %d\n", _error);
return EXIT_FAILURE;
}
}
for (i = 0; i < NUM_OF_THREADS; i++)
pthread_join(threads[i], NULL);
gettimeofday(&end, 0);
final_par = _calc_time_secs(start, end);
gettimeofday(&start, 0);
_math_vec_prod();
gettimeofday(&end, 0);
final_serial = _calc_time_secs(start, end);
if(!_check_results(y, y_serial))
fputs("Prueba exitosa\n", stdout);
else
fputs("Prueba fallida\n", stdout);
fprintf(stdout, "TAMAÑO: %d x %d E %d THREADS\n", M, N, NUM_OF_THREADS);
fprintf(stdout, "TIEMPO CONC.:%d mseg\n", (int)final_par);
fprintf(stdout, "TIEMPO SERIAL:%d mseg\n", (int)final_serial);
if(M < 6 && N < 6)
{
puts("RES PARALELO:\n");
Print_Vector(y, M);
puts("RES SERIAL:\n");
Print_Vector(y_serial, M);
}
free(A);
free(x);
free(y);
free(y_serial);
free(threads);
}
void Fill_Matrix(float A[], int rows, int cols)
{
int i, j;
for (i = 0; i < rows; i++)
for (j = 0; j < cols; j++)
A[i * cols + j] = rand() % 1;
}
void Fill_Vector(float x[], int rows)
{
int i;
for (i = 0; i < rows; i++)
x[i] = rand() % 1;
}
void Print_Matrix(float A[], int rows, int cols) {
int i, j;
for (i = 0; i < rows; i++) {
for (j = 0; j < cols; j++)
printf("%.2f ", A[i*cols + j]);
printf("\n");
}
}
void Print_Vector(float x[], int rows) {
int i;
for (i = 0; i < rows; i++)
printf("%.5f ", x[i]*1000);
printf("\n");
}
void *_math_vec_prod(void* rank) {
int whoami = *(int *) rank;
int from = whoami * M / NUM_OF_THREADS;
int to = from + (M / NUM_OF_THREADS) - 1;
int i, j;
for (i = from; i <= to; i++) {
y[i] = 0.0f;
for (j = 0; j < M; j++)
y[i] += A[i*M+j]*x[j];
}
return NULL;
}
void _math_vec_prod(void)
{
int i,j;
for(i = 0; i < M; i++)
{
y_serial[i] = 0.0f;
for(j = 0; j < N; j++)
y_serial[i] += A[i * N + j] * x[j];
}
}
|
[
"eduardoalh02@gmail.com"
] |
eduardoalh02@gmail.com
|
a8b39438c10801b1faf4dc9987b98a58b33bf10d
|
9d188a41ec9cf5526f79bfaab0338a629234bb13
|
/src/Gmail_AddressBook.cpp
|
288abebd42f165da9632e73602b84cf1f8b6963f
|
[] |
no_license
|
manjunathcs405/addressbook
|
304dac72a2cf102d39790abff1209f532baa4e0e
|
f4656f6b29af13b49d67034ebefd21a780ee6db1
|
refs/heads/master
| 2020-05-29T19:26:47.383065
| 2014-11-05T06:56:00
| 2014-11-05T06:56:00
| 26,103,850
| 1
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 385
|
cpp
|
#include<iostream>
#include "Gmail_AddressBook.h"
Gmail_AddressBook::Gmail_AddressBook()
{
}
Gmail_AddressBook::~Gmail_AddressBook()
{
}
bool Gmail_AddressBook::addContact()
{
return true;
}
bool Gmail_AddressBook::removeContact()
{
return true;
}
bool Gmail_AddressBook::modifyContact()
{
return true;
}
bool Gmail_AddressBook::searchContact()
{
return true;
}
|
[
"manjunatha.s@lge.com"
] |
manjunatha.s@lge.com
|
44039d691d603a4d0f1f2deac9f328d86bbcb1da
|
1f41b828fb652795482cdeaac1a877e2f19c252a
|
/maya_plugins/inLocus/3dGroup/sgRigAdditionalNodes/sgRigAdditionalNodes/CollisionJointNode.cpp
|
79c62fa26e63ecfbcb92086bb4f60727cc5b46d6
|
[] |
no_license
|
jonntd/mayadev-1
|
e315efe582ea433dcf18d7f1e900920f5590b293
|
f76aeecb592df766d05a4e10fa2c2496f0310ca4
|
refs/heads/master
| 2021-05-02T07:16:17.941007
| 2018-02-05T03:55:12
| 2018-02-05T03:55:12
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 3,471
|
cpp
|
//
// Copyright (C) locus
//
// File: CollisionJointNode.cpp
//
// Dependency Graph Node: CollisionJoint
//
// Author: Maya Plug-in Wizard 2.0
//
#include "CollisionJointNode.h"
#include <maya/MPlug.h>
#include <maya/MDataBlock.h>
#include <maya/MDataHandle.h>
#include <maya/MGlobal.h>
MTypeId CollisionJoint::id( 0x00001 );
// Example attributes
//
MObject CollisionJoint::aInputMatrix;
MObject CollisionJoint::aMesh;
MObject CollisionJoint::aMeshMatrix;
MObject CollisionJoint::aAimAxis;
MObject CollisionJoint::aUpAxis;
MObject CollisionJoint::aAngleLockRate;
MObject CollisionJoint::aOutputMatrix;
CollisionJoint::CollisionJoint()
{
m_dirtyMatrix = true;
m_dirtyMesh = true;
m_dirtyMeshMatrix = true;
m_dirtyAxis = true;
m_dirtyAngleLockRate = true;
}
CollisionJoint::~CollisionJoint() {}
MStatus CollisionJoint::compute( const MPlug& plug, MDataBlock& data )
{
MStatus returnStatus;
clearMatrix( data );
clearMeshMatrix( data );
clearMesh( data );
clearAxis( data );
clearLockRate( data );
m_dirtyMatrix = false;
m_dirtyMesh = false;
m_dirtyMeshMatrix = false;
m_dirtyAxis = false;
m_dirtyAngleLockRate = false;
return MS::kSuccess;
}
void* CollisionJoint::creator()
{
return new CollisionJoint();
}
MStatus CollisionJoint::initialize()
{
MStatus status;
MFnNumericAttribute nAttr;
MFnMatrixAttribute mAttr;
MFnTypedAttribute tAttr;
MFnEnumAttribute eAttr;
aInputMatrix = mAttr.create( "inputMatrix", "inputMatrix" );
mAttr.setArray( true );
CHECK_MSTATUS_AND_RETURN_IT( addAttribute( aInputMatrix ) );
aMesh = tAttr.create( "mesh", "mesh", MFnData::kMesh );
CHECK_MSTATUS_AND_RETURN_IT( addAttribute( aMesh ) );
aMeshMatrix = mAttr.create( "meshMatrix", "meshMatrix" );
CHECK_MSTATUS_AND_RETURN_IT( addAttribute( aMeshMatrix ) );
aAimAxis = eAttr.create( "aimAxis", "aimAxis" );
eAttr.addField( "X", 0 ), eAttr.addField( "Y", 1 ), eAttr.addField( "Z", 2 );
eAttr.addField( "-X", 3 ), eAttr.addField( "-Y", 4 ), eAttr.addField( "-Z", 5 );
CHECK_MSTATUS_AND_RETURN_IT( addAttribute( aAimAxis ) );
aUpAxis = eAttr.create( "upAxis", "upAxis" );
eAttr.addField( "X", 0 ), eAttr.addField( "Y", 1 ), eAttr.addField( "Z", 2 );
eAttr.addField( "-X", 3 ), eAttr.addField( "-Y", 4 ), eAttr.addField( "-Z", 5 );
CHECK_MSTATUS_AND_RETURN_IT( addAttribute( aUpAxis ) );
aAngleLockRate = nAttr.create( "angleLockRate", "angleLockRate", MFnNumericData::kFloat, 0.0 );
CHECK_MSTATUS_AND_RETURN_IT( addAttribute( aAngleLockRate ) );
aOutputMatrix = mAttr.create( "outputMatrix", "outputMatrix" );
mAttr.setArray( true );
CHECK_MSTATUS_AND_RETURN_IT ( addAttribute( aOutputMatrix ) );
CHECK_MSTATUS_AND_RETURN_IT( attributeAffects( aInputMatrix, aOutputMatrix ) );
CHECK_MSTATUS_AND_RETURN_IT( attributeAffects( aMesh, aOutputMatrix ) );
CHECK_MSTATUS_AND_RETURN_IT( attributeAffects( aAimAxis, aOutputMatrix ) );
CHECK_MSTATUS_AND_RETURN_IT( attributeAffects( aUpAxis, aOutputMatrix ) );
return MS::kSuccess;
}
MStatus CollisionJoint::setDependentsDirty( const MPlug& plug, MPlugArray& plugArr )
{
MStatus status;
if( plug == aInputMatrix )
{
m_dirtyMatrix = true;
}
else if( plug == aMeshMatrix )
{
m_dirtyMeshMatrix = true;
}
else if( plug == aMesh )
{
m_dirtyMesh = true;
}
else if( plug == aAimAxis || plug == aUpAxis )
{
m_dirtyAxis = true;
}
else if( plug == aAngleLockRate )
{
m_dirtyAngleLockRate = true;
}
return status;
}
|
[
"kimsung9k@naver.com"
] |
kimsung9k@naver.com
|
1f2d02910eccd7c881f3768e32c7a7596c70eea8
|
6d54a7b26d0eb82152a549a6a9dfde656687752c
|
/examples/platform/linux/CommissionableInit.cpp
|
24fc347153c0537cdc29141e9ccafcb2658c77fe
|
[
"Apache-2.0",
"LicenseRef-scancode-warranty-disclaimer"
] |
permissive
|
project-chip/connectedhomeip
|
81a123d675cf527773f70047d1ed1c43be5ffe6d
|
ea3970a7f11cd227ac55917edaa835a2a9bc4fc8
|
refs/heads/master
| 2023-09-01T11:43:37.546040
| 2023-09-01T08:01:32
| 2023-09-01T08:01:32
| 244,694,174
| 6,409
| 1,789
|
Apache-2.0
| 2023-09-14T20:56:31
| 2020-03-03T17:05:10
|
C++
|
UTF-8
|
C++
| false
| false
| 4,169
|
cpp
|
/*
*
* Copyright (c) 2022 Project CHIP Authors
* All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <crypto/CHIPCryptoPAL.h>
#include <lib/support/CodeUtils.h>
#include <lib/support/logging/CHIPLogging.h>
#include <platform/TestOnlyCommissionableDataProvider.h>
#include "CommissionableInit.h"
namespace chip {
namespace examples {
using namespace chip::DeviceLayer;
CHIP_ERROR InitCommissionableDataProvider(LinuxCommissionableDataProvider & provider, LinuxDeviceOptions & options)
{
chip::Optional<uint32_t> setupPasscode;
if (options.payload.setUpPINCode != 0)
{
setupPasscode.SetValue(options.payload.setUpPINCode);
}
else if (!options.spake2pVerifier.HasValue())
{
uint32_t defaultTestPasscode = 0;
chip::DeviceLayer::TestOnlyCommissionableDataProvider TestOnlyCommissionableDataProvider;
VerifyOrDie(TestOnlyCommissionableDataProvider.GetSetupPasscode(defaultTestPasscode) == CHIP_NO_ERROR);
ChipLogError(Support,
"*** WARNING: Using temporary passcode %u due to no neither --passcode or --spake2p-verifier-base64 "
"given on command line. This is temporary and will disappear. Please update your scripts "
"to explicitly configure onboarding credentials. ***",
static_cast<unsigned>(defaultTestPasscode));
setupPasscode.SetValue(defaultTestPasscode);
options.payload.setUpPINCode = defaultTestPasscode;
}
else
{
// Passcode is 0, so will be ignored, and verifier will take over. Onboarding payload
// printed for debug will be invalid, but if the onboarding payload had been given
// properly to the commissioner later, PASE will succeed.
}
if (options.discriminator.HasValue())
{
options.payload.discriminator.SetLongValue(options.discriminator.Value());
}
else
{
uint16_t defaultTestDiscriminator = 0;
chip::DeviceLayer::TestOnlyCommissionableDataProvider TestOnlyCommissionableDataProvider;
VerifyOrDie(TestOnlyCommissionableDataProvider.GetSetupDiscriminator(defaultTestDiscriminator) == CHIP_NO_ERROR);
ChipLogError(Support,
"*** WARNING: Using temporary test discriminator %u due to --discriminator not "
"given on command line. This is temporary and will disappear. Please update your scripts "
"to explicitly configure discriminator. ***",
static_cast<unsigned>(defaultTestDiscriminator));
options.payload.discriminator.SetLongValue(defaultTestDiscriminator);
}
// Default to minimum PBKDF iterations
uint32_t spake2pIterationCount = chip::Crypto::kSpake2p_Min_PBKDF_Iterations;
if (options.spake2pIterations != 0)
{
spake2pIterationCount = options.spake2pIterations;
}
ChipLogError(Support, "PASE PBKDF iterations set to %u", static_cast<unsigned>(spake2pIterationCount));
return provider.Init(options.spake2pVerifier, options.spake2pSalt, spake2pIterationCount, setupPasscode,
options.payload.discriminator.GetLongValue());
}
CHIP_ERROR InitConfigurationManager(ConfigurationManagerImpl & configManager, LinuxDeviceOptions & options)
{
if (options.payload.vendorID != 0)
{
configManager.StoreVendorId(options.payload.vendorID);
}
if (options.payload.productID != 0)
{
configManager.StoreProductId(options.payload.productID);
}
return CHIP_NO_ERROR;
}
} // namespace examples
} // namespace chip
|
[
"noreply@github.com"
] |
project-chip.noreply@github.com
|
8c702619a2d741dcbbfffc8b28b7b60a769ab626
|
63926f6bc3dd5b3573d4e22c7d5ac0bc1a5e253c
|
/Plugins/Voxel/Source/VoxelEditor/Private/Details/VoxelLandscapeImporterDetails.h
|
e5f1c73dffb2c42f1fa73e4baab4d450cf2ee89a
|
[] |
no_license
|
chaiyuntian/MPlugins
|
8c024cf3cb815614aa4c5eaf7d6d1e0f5af9eb6b
|
9050f15e0ac92657dbf63b403d873e87485892d2
|
refs/heads/main
| 2023-01-10T23:07:38.428583
| 2020-11-10T04:02:52
| 2020-11-10T04:02:52
| 309,244,097
| 2
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 535
|
h
|
// Copyright 2020 Phyronnaz
#pragma once
#include "CoreMinimal.h"
#include "Input/Reply.h"
#include "IDetailCustomization.h"
// See sky light details in the engine code
class AVoxelLandscapeImporter;
class FVoxelLandscapeImporterDetails : public IDetailCustomization
{
public:
/** IDetailCustomization interface */
virtual void CustomizeDetails(IDetailLayoutBuilder& DetailLayout) override;
FReply OnCreateFromLandscape();
private:
/** The selected landscape modifier */
TWeakObjectPtr<AVoxelLandscapeImporter> Importer;
};
|
[
"tianyunchai@126.com"
] |
tianyunchai@126.com
|
3fb62a8bcedb86e96b6039ae0a7a1fdcc5a9afc7
|
598842e1bbb0a7e50c6fea85d3b4a427bb8d5c2d
|
/Target Tracking/Tracking/Track.h
|
4454cb38b8f76b572d9e0350e973976073663e62
|
[] |
no_license
|
aaabbbcccdddeeef/Digital-Image-Process
|
b587e1ff031c0a580c0d21c7bff4e6c2141ed2d4
|
0b83954fad418a2587a8d3e3fe25fa003256359d
|
refs/heads/master
| 2023-08-21T23:47:53.480320
| 2018-05-21T01:31:59
| 2018-05-21T01:31:59
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 681
|
h
|
#pragma once
#include <iostream>
#include <opencv2\opencv.hpp>
#include <opencv2\tracking\tracker.hpp>
#include <opencv2\xfeatures2d\nonfree.hpp>
#include "kcf\kcftracker.hpp"
using namespace std;
using namespace cv;
class Track
{
public:
Track();
~Track();
int PlayVideo(CString filename);
void GSMDetection(CString filename);
void FDiffDetection(CString filename);
void KCF(CString filename);
Rect FaceDetect(Mat Image);
void TragetTracker(CString filename, cv::String trackerType);
void MultiTrackerCompare(CString filename);
Rect GSMDetectionAre(Mat image01, Mat image02);
void WriteFPSToFile(cv::String trackertype, float fps);
};
|
[
"448435279@qq.com"
] |
448435279@qq.com
|
080e725d2266fe043f6f6f699614f82cf1318c1a
|
1040a492b7312e4085cc67cf789c6750865aad26
|
/ReaderWriter.h
|
2df40265c2d0a804ec766fbdebc9b994478422a4
|
[] |
no_license
|
thalesaguiar21/MultiThreadingMatrixProduct
|
480d2acd807c3d55e725f56753a12b4bf310a957
|
38e87f5608892b19f119c9a0daa0686a7f49942e
|
refs/heads/master
| 2020-12-11T09:04:35.151228
| 2016-09-16T00:31:15
| 2016-09-16T00:31:15
| 68,341,799
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 558
|
h
|
#ifndef READERWRITER_H
#define READERWRITER_H
#include <iostream>
#include <string>
class ReaderWriter
{
private:
std::string pathToReadFile;
std::string pathToSaveFile;
public:
ReaderWriter();
ReaderWriter(std::string pathToReadFile, std::string pathToSaveFile);
void readMatrixFrom(const std::string& fileName);
void saveMatrixAt(std::string pathToSave, std::string fileName);
//Setters
void setPathToSaveFile(std::string path){pathToReadFile = path;};
void setPathToReadFile(std::string path){pathToSaveFile = path;};
};
#endif
|
[
"thalesaguiar21@gmail.com"
] |
thalesaguiar21@gmail.com
|
621534295a21e2b5f05cee43ce3d77d61686eb8e
|
63a1ac98260e0aa78034e70b13ca4ca8c1596c16
|
/Tree/Binary_Search_Tree_BTS.cpp
|
44016b459dd904ea626e572926e03166317c2437
|
[] |
no_license
|
Hi-Pete/leetcode
|
d49f2fa935b0ebb62d4666036e7dd24c6e9307f1
|
f103c5179b5485471a3958d01253ba2b5a70b594
|
refs/heads/main
| 2023-07-31T23:43:35.414865
| 2021-09-27T16:51:53
| 2021-09-27T16:51:53
| 349,070,195
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 2,627
|
cpp
|
// 二叉查找树(Binary Search Tree, BST) 是一种特殊的二叉树:
// 对于每个父节点,其左子节点的值小于等于父结点的值,其右子节点的值大于等于父结点的值
// 因此对于一个二叉查找树,我们可以在 O(nlogn) 的时间内查找一个值是否存在:
// 从根节点开始: 若当前节点的值大于查找值则向左下走,
// 若当前节点的值小于查找值则向右下走
// 同时因为二叉查找树是有序的,对其中序遍历的结果即为排好序的数组
template <class T>
class BST{
struct Node {
T data;
Node* left;
Node* right;
};
Node* root;
Node* makeEmpty(Node* t) {
if (t == nullptr)
return nullptr;
makeEmpty(t->left);
makeEmpty(t->right);
// 后需遍历删除节点
delete t;
return nullptr;
}
Node* insert(Node* t, T x) {
if (t == nullptr) {
t = new Node;
t->data = x;
t->left = t->right = nullptr;
}
else if (x < t->data)
t->left = insert(t->left, x);
else if (x > t->data)
t->right = insert(t->right, x);
return t;
}
Node* find(Node* t, T x) {
if (t == nullptr)
return nullptr;
if (x < t->data)
return find(t->left, x);
if (x > t->data)
return find(t->right, x);
return t;
}
Node* findMin(Node* t) {
if (t == nullptr || t->left == nullptr)
return t;
return findMin(t->left);
}
Node* findMax(Node* t) {
if (t == nullptr || t->right == nullptr)
return t;
return findMax(t->right);
}
Node* remove(Node* t, T x) {
Node* temp;
if (t == nullptr)
return nullptr;
else if (x < t->data)
t->left = remove(t->left, x);
else if (x > t->data)
t->right = remove(t->right, x);
else if (t->left && t->right) {
temp = findMin(t->right);
t->data = temp->data;
t->right = remove(t->right, t->data);
}
else {
temp = t;
if (t->left == nullptr)
t = t->right;
else if (t->right == nullptr)
t = t->left;
delete temp;
}
return t;
}
public:
BST(): root(nullptr) {}
~BST() {
root = makeEmpty(root);
}
void insert(T x) {
insert(root, x);
}
void remove(T x) {
remove(root, x);
}
};
|
[
"525527051@qq.com"
] |
525527051@qq.com
|
9a3b23bd1919f1c07086dbbdd1efd30862305c31
|
f02b6dd5cee6a61df5b7b0d140ddb92ec239a5e6
|
/salesbymatch.cpp
|
6eda3f5deb517dab71a496d9431bdb25a6934391
|
[] |
no_license
|
bharathprathap/Hackerrank-Solutions
|
cc1a45dfb697c60cf02e45b529b450fae727d5af
|
598bf24b80e4e03dd00b17fbf4a456811b63618c
|
refs/heads/main
| 2023-07-08T10:36:13.459001
| 2021-08-14T12:05:59
| 2021-08-14T12:05:59
| 395,994,796
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 497
|
cpp
|
//BHARATH PRATHAP NAIR
//Problem:Sales by Match
//https://www.hackerrank.com/challenges/sock-merchant/problem
int sockMerchant(int n, vector<int> ar)
{
int pairs=0,count;
for(int i=0;i<n;i++)
{
count=0;
for(int j=i+1;j<n;j++)
{
if(ar[i]==ar[j] && ar[i]!=-1)
{
count++;
ar[j]=-1;
}
}
count++;
ar[i]=0;
pairs+=floor(count/2);
}
return pairs;
}
|
[
"noreply@github.com"
] |
bharathprathap.noreply@github.com
|
8ba9a0ae10efa0199ba553bd629f1efd76d19a1d
|
95eb3fa6c829cbd7bbc64ced21e3f84c090192a7
|
/KURSHACHI/SUPER_KERSACH/CONSOLE/Project_Tetris/Project_Tetris/Field.h
|
0bb40029de51262df71857c1f22ddb3d26aa3b27
|
[] |
no_license
|
TheTOXIN/STUDENT
|
f9693e5e053cf86aa2b559a79168a306ec2561da
|
163eb3497897773f9d692574552b0e13046bc765
|
refs/heads/master
| 2020-03-23T18:38:17.554458
| 2018-07-26T08:20:45
| 2018-07-26T08:20:45
| 141,921,781
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 414
|
h
|
#pragma once
class CField
{
public:
CField(int width_c, int height_c);
int width;
int height;
int matrix[20][10];
int getWidth();
int getHeight();
int addScore(int countLine);
void getMatrix(int tmp[20][10]);
int getValue(int x, int y);
void setValue(int x, int y, int value);
void clearField();
int remove();
int countHeight();
int countLines();
int countHoles();
int countMonoton();
private:
};
|
[
"thetoksin@mail.ru"
] |
thetoksin@mail.ru
|
cdc7939a49b8e5b26147c17d10ad5fed9bf1e593
|
8afb5afd38548c631f6f9536846039ef6cb297b9
|
/MY_REPOS/misc-experiments/_FIREBFIRE/firebase-cpp-sdk/auth/src/user.cc
|
1328002df6a21939bc2890eb7f62dcce945a1ec5
|
[
"MIT",
"Apache-2.0",
"LicenseRef-scancode-proprietary-license"
] |
permissive
|
bgoonz/UsefulResourceRepo2.0
|
d87588ffd668bb498f7787b896cc7b20d83ce0ad
|
2cb4b45dd14a230aa0e800042e893f8dfb23beda
|
refs/heads/master
| 2023-03-17T01:22:05.254751
| 2022-08-11T03:18:22
| 2022-08-11T03:18:22
| 382,628,698
| 10
| 12
|
MIT
| 2022-10-10T14:13:54
| 2021-07-03T13:58:52
| null |
UTF-8
|
C++
| false
| false
| 2,037
|
cc
|
/*
* Copyright 2016 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
namespace firebase {
namespace auth {
AUTH_RESULT_FN(User, GetToken, std::string)
AUTH_RESULT_FN(User, UpdateEmail, void)
AUTH_RESULT_FN(User, UpdatePassword, void)
AUTH_RESULT_FN(User, Reauthenticate, void)
AUTH_RESULT_FN(User, ReauthenticateAndRetrieveData, SignInResult)
AUTH_RESULT_FN(User, SendEmailVerification, void)
AUTH_RESULT_FN(User, UpdateUserProfile, void)
AUTH_RESULT_FN(User, LinkWithCredential, User*)
AUTH_RESULT_FN(User, LinkAndRetrieveDataWithCredential, SignInResult)
AUTH_RESULT_FN(User, Unlink, User*)
AUTH_RESULT_FN(User, UpdatePhoneNumberCredential, User*)
AUTH_RESULT_FN(User, Reload, void)
AUTH_RESULT_FN(User, Delete, void)
#if defined(INTERNAL_EXPERIMENTAL)
// I'd like to change all the above functions to use LastResultProxy, as it
// makes multi-threaded situations more deterministic. However, LastResult
// functions are public in the C++ SDK. And even while they are
// non-deterministic in multi-threaded situations, someone might rely on their
// current behavior. So for now, we only use it in Unity, and only for
// GetToken where there is a real, reproductible issue.
Future<std::string> User::GetTokenThreadSafe(bool force_refresh) {
Future<std::string> future = GetToken(force_refresh);
if (future.status() != kFutureStatusPending) {
return future;
} else {
FutureBase base = auth_data_->future_impl.LastResultProxy(kUserFn_GetToken);
const FutureBase& rFuture = base;
return static_cast<const Future<std::string>&>(rFuture);
}
}
#endif // defined(INTERNAL_EXPERIMENTAL)
// Non-inline implementation of UserInfoInterface's virtual destructor
// to prevent its vtable being emitted in each translation unit.
UserInfoInterface::~UserInfoInterface() {}
} // namespace auth
} // namespace firebase
|
[
"bryan.guner@gmail.com"
] |
bryan.guner@gmail.com
|
df0e071326ae141947e1e3a4992e81323ceca3e7
|
231d755f50889734283f1673c1d33f86633865b3
|
/temperature.h
|
599e71c195c49e74ad83a928741c8c1a2502189f
|
[] |
no_license
|
jasonivey/testcpp
|
bcb90295fa910764cfe3562d93a3230df2004de9
|
754af9093a0c652b3f6bdd8d80545f318dd65f22
|
refs/heads/master
| 2023-08-28T11:31:51.227070
| 2021-10-29T08:08:12
| 2021-10-29T08:08:12
| 261,923,993
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 472
|
h
|
#pragma once
#include <string>
namespace mmotd::temperature {
double GetCpuTemperature();
double GetGpuTemperature();
double ConvertCelciusToFahrenheit(double celcius_temperature) noexcept;
enum class Scale { Unknown, Low, Medium, High };
Scale GetScaleFromTemperature(double celcius_temperature) noexcept;
std::string GetTemperatureIcon(double celcius_temperature) noexcept;
std::string GetTemperatureIcon(Scale scale) noexcept;
} // namespace mmotd::temperature
|
[
"jasonivey@gmail.com"
] |
jasonivey@gmail.com
|
e5bc8724147a6c37d0592cd8b82e5d8c5f79f2f3
|
0ca63a629db6c094c263b83502d127cb59683bbc
|
/NAVE.cpp
|
4ec64e99cecbfb051a24c1ff1b0b19c726f29434
|
[] |
no_license
|
ValenSampayo/Proyecto-NAVE
|
e775852a0c9a8e966954d2e0828c02654dd6c985
|
3ce45fcb333e20a38828aced5dafd74daa6dc8b1
|
refs/heads/master
| 2022-05-22T17:28:10.784607
| 2020-04-17T20:19:32
| 2020-04-17T20:19:32
| 256,600,928
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 4,880
|
cpp
|
#include<stdio.h>
#include<windows.h>
#include<conio.h>
#include<stdlib.h>
#include<list>
using namespace std;
#define ARRIBA 72
#define IZQUIERDA 75
#define DERECHA 77
#define ABAJO 80
void gotoxy(int x, int y){
HANDLE hCon;
hCon = GetStdHandle(STD_OUTPUT_HANDLE);
COORD dwPos;
dwPos.X = x;
dwPos.Y = y;
SetConsoleCursorPosition(hCon, dwPos);
}
void OcultarCursor(){
HANDLE hCon;
hCon = GetStdHandle(STD_OUTPUT_HANDLE);
CONSOLE_CURSOR_INFO cci;
cci.dwSize = 100;//Este valor hace mas alto o mas bajo el Cursor
cci.bVisible = FALSE;//Si este valor esta en TRUE se muestra el cursor, sino no
SetConsoleCursorInfo(hCon,&cci);
}
void Pintar_limites(){
for(int i=2;i<78;i++){
gotoxy(i,3);printf("%c",205);
gotoxy(i,33);printf("%c",205);
}
for(int i=4;i<33;i++){
gotoxy(2,i);printf("%c",186);
gotoxy(77,i);printf("%c",186);
}
gotoxy(2,3);printf("%c",201);
gotoxy(2,33);printf("%c",200);
gotoxy(77,3);printf("%c",187);
gotoxy(77,33);printf("%c",188);
}
class NAVE{
int x,y;
int corazones;
int vidas;
public:
NAVE(int _x, int _y, int _corazones, int _vidas):x(_x),y(_y), corazones(_corazones),vidas(_vidas){}
int X(){ return x;}
int Y(){ return y;}
void pintar();
void borrar();
void mover();
void pintar_corazones();
void morir();
void COR(){corazones--;};
int VID(){return vidas;}
};
void NAVE::pintar(){
gotoxy(x,y); printf(" %c",30);
gotoxy(x,y+1);printf(" %c%c%c",40,207,41);
gotoxy(x,y+2);printf("%c%c %c%c",30,190,190,30);
}
void NAVE::borrar(){
gotoxy(x,y);printf(" ");
gotoxy(x,y+1);printf(" ");
gotoxy(x,y+2);printf(" ");
}
void NAVE::mover(){
if(kbhit()){
char tecla = getch();
borrar();
if(tecla == IZQUIERDA && x>3) x--;//Las coordenadas estan invertidas Suma para ir a derecha y bajar
if(tecla == DERECHA && x+6<77) x++;//Resto para ir a la izquierda y subir
if(tecla == ARRIBA && y>4) y--;
if(tecla == ABAJO && y+3<33) y++;
if(tecla == 'e')corazones--;
pintar();
pintar_corazones();
}
}
void NAVE::pintar_corazones(){
gotoxy(50,2);printf("Vidas %d",vidas);
gotoxy(64,2);printf("Salud");
gotoxy(70,2);printf(" ");
for(int i=0; i<corazones; i++){
gotoxy(70+i,2);printf("%c",3);
}
}
void NAVE::morir(){
if(corazones==0){
borrar();
gotoxy(x,y);printf(" ** ");
gotoxy(x,y+1);printf(" **** ");
gotoxy(x,y+2);printf(" ** ");
Sleep(200);
borrar();
gotoxy(x,y);printf(" * ** * ");
gotoxy(x,y+1);printf(" **** ");
gotoxy(x,y+2);printf(" * ** * ");
Sleep(200);
borrar();
vidas--;
corazones = 3;
pintar_corazones();
pintar();
}
}
class AST{
int x,y;
public:
AST(int _x, int _y):x(_x),y(_y){}
void pintar();
void mover();
void choque(class NAVE &N);
int X(){return x;
}
int Y(){return y;
}
};
void AST::pintar(){
gotoxy(x,y); printf("%c",184);
}
void AST::mover(){
gotoxy(x,y);printf(" ");
y++;
if(y>32){
x=rand()%71 + 4;
y=4;
}
pintar();
}
void AST::choque(class NAVE &N){
if(x>= N.X() && x < N.X()+6 && y>= N.Y() && y<= N.Y()+2){
N.COR();
N.pintar();
N.borrar();
N.pintar_corazones();
x=rand()%71 + 4;
y=4;
}
}
class BALA{
int x,y;
public:
BALA(int _x, int _y): x(_x),y(_y){}
int X(){return x;
}
int Y(){return y;
}
void mover();
bool fuera();
};
void BALA::mover(){
gotoxy(x,y);printf(" ");
y--;
gotoxy(x,y);printf("*");
}
bool BALA::fuera(){
if(y==4)return true;
return false;
}
int main(){
OcultarCursor();
Pintar_limites();
NAVE N(37,30,3,3);
N.pintar();
N.pintar_corazones();
list<AST*> A;
list<AST*>::iterator itA;
for(int i=0;i<5;i++){
A.push_back(new AST(rand()%75+3,rand()%5+4));
}
list<BALA*> B;
list<BALA*>::iterator it;
bool game_over = false;
int puntos =0;
while(!game_over){
gotoxy(4,2);printf("Puntos %d",puntos);
if(kbhit){
char tecla = getch();
if(tecla == 'a'){
B.push_back(new BALA(N.X()+2,N.Y()-1));
}
}
for(it=B.begin();it!=B.end();it++){
(*it)->mover();
if((*it)->fuera()){
gotoxy((*it)->X(),(*it)->Y());printf(" ");
delete(*it);
it = B.erase(it);
}
}
for(itA=A.begin();itA!=A.end();itA++){
(*itA)->mover();
(*itA)->choque(N);
}
for(itA = A.begin(); itA != A.end(); itA++){
for(it = B.begin();it != B.end(); it++){
if((*itA)->X() == (*it)->X() && ( (*itA)->Y()+1 == (*it)-> Y() || (*itA)->Y() == (*it)-> Y()) ){
gotoxy((*it)->X(),(*it)->Y());printf(" ");
delete(*it);
it = B.erase(it);
A.push_back(new AST(rand()%75+3,4));
gotoxy((*itA)->X(),(*itA)->Y());printf(" ");
delete(*itA);
itA = A.erase(itA);
puntos+=5;
}
}
}
if(N.VID() == 0) game_over = true;
N.mover();
N.morir();
Sleep(50);
}
return 0;
}
|
[
"noreply@github.com"
] |
ValenSampayo.noreply@github.com
|
f7380f1df4ead82a5c9428f14faa560330625b47
|
e8ecc5a25be493d2bed7df4305fa4b9933342d7e
|
/src/_resources/menu_logo.png.cpp
|
0515a6b49a6c34ebae817435bf089b374409aa6f
|
[
"MIT"
] |
permissive
|
friedcroc/tizen_spacerace
|
a3b01ff8797d6664984d2c7ba99706349d508451
|
08550b8ce4432f502da243522de375b52fdf5925
|
refs/heads/master
| 2020-06-05T02:30:25.322206
| 2018-04-28T21:45:54
| 2018-04-28T21:56:51
| 18,323,542
| 0
| 1
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 35,269
|
cpp
|
#include <cstddef>
extern const size_t file_menu_logo_png_size = 6985;
extern const unsigned char file_menu_logo_png[] = {
0x89,0x50,0x4E,0x47,0x0D,0x0A,0x1A,0x0A,0x00,0x00,0x00,0x0D,0x49,0x48,0x44,0x52,0x00,0x00,0x02,0x31,0x00,0x00,0x00,0x9D,0x08,0x06,0x00,0x00,0x00,0x45,0x2E,0x29,
0x48,0x00,0x00,0x00,0x09,0x70,0x48,0x59,0x73,0x00,0x00,0x0B,0x13,0x00,0x00,0x0B,0x13,0x01,0x00,0x9A,0x9C,0x18,0x00,0x00,0x0A,0x4F,0x69,0x43,0x43,0x50,0x50,0x68,
0x6F,0x74,0x6F,0x73,0x68,0x6F,0x70,0x20,0x49,0x43,0x43,0x20,0x70,0x72,0x6F,0x66,0x69,0x6C,0x65,0x00,0x00,0x78,0xDA,0x9D,0x53,0x67,0x54,0x53,0xE9,0x16,0x3D,0xF7,
0xDE,0xF4,0x42,0x4B,0x88,0x80,0x94,0x4B,0x6F,0x52,0x15,0x08,0x20,0x52,0x42,0x8B,0x80,0x14,0x91,0x26,0x2A,0x21,0x09,0x10,0x4A,0x88,0x21,0xA1,0xD9,0x15,0x51,0xC1,
0x11,0x45,0x45,0x04,0x1B,0xC8,0xA0,0x88,0x03,0x8E,0x8E,0x80,0x8C,0x15,0x51,0x2C,0x0C,0x8A,0x0A,0xD8,0x07,0xE4,0x21,0xA2,0x8E,0x83,0xA3,0x88,0x8A,0xCA,0xFB,0xE1,
0x7B,0xA3,0x6B,0xD6,0xBC,0xF7,0xE6,0xCD,0xFE,0xB5,0xD7,0x3E,0xE7,0xAC,0xF3,0x9D,0xB3,0xCF,0x07,0xC0,0x08,0x0C,0x96,0x48,0x33,0x51,0x35,0x80,0x0C,0xA9,0x42,0x1E,
0x11,0xE0,0x83,0xC7,0xC4,0xC6,0xE1,0xE4,0x2E,0x40,0x81,0x0A,0x24,0x70,0x00,0x10,0x08,0xB3,0x64,0x21,0x73,0xFD,0x23,0x01,0x00,0xF8,0x7E,0x3C,0x3C,0x2B,0x22,0xC0,
0x07,0xBE,0x00,0x01,0x78,0xD3,0x0B,0x08,0x00,0xC0,0x4D,0x9B,0xC0,0x30,0x1C,0x87,0xFF,0x0F,0xEA,0x42,0x99,0x5C,0x01,0x80,0x84,0x01,0xC0,0x74,0x91,0x38,0x4B,0x08,
0x80,0x14,0x00,0x40,0x7A,0x8E,0x42,0xA6,0x00,0x40,0x46,0x01,0x80,0x9D,0x98,0x26,0x53,0x00,0xA0,0x04,0x00,0x60,0xCB,0x63,0x62,0xE3,0x00,0x50,0x2D,0x00,0x60,0x27,
0x7F,0xE6,0xD3,0x00,0x80,0x9D,0xF8,0x99,0x7B,0x01,0x00,0x5B,0x94,0x21,0x15,0x01,0xA0,0x91,0x00,0x20,0x13,0x65,0x88,0x44,0x00,0x68,0x3B,0x00,0xAC,0xCF,0x56,0x8A,
0x45,0x00,0x58,0x30,0x00,0x14,0x66,0x4B,0xC4,0x39,0x00,0xD8,0x2D,0x00,0x30,0x49,0x57,0x66,0x48,0x00,0xB0,0xB7,0x00,0xC0,0xCE,0x10,0x0B,0xB2,0x00,0x08,0x0C,0x00,
0x30,0x51,0x88,0x85,0x29,0x00,0x04,0x7B,0x00,0x60,0xC8,0x23,0x23,0x78,0x00,0x84,0x99,0x00,0x14,0x46,0xF2,0x57,0x3C,0xF1,0x2B,0xAE,0x10,0xE7,0x2A,0x00,0x00,0x78,
0x99,0xB2,0x3C,0xB9,0x24,0x39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0x3E,0x01,0x7B,0x91,0x2D,0xA8,0x5D,0x63,0x03,0xF6,0x4B,0x27,0x10,0x58,0x74,0xC0,0xE2,0xF7,0x00,0x00,0xF2,0xBB,0x6F,0xC1,0xD4,0x28,0x08,0x03,0x80,
0x68,0x83,0xE1,0xCF,0x77,0xFF,0xEF,0x3F,0xFD,0x47,0xA0,0x25,0x00,0x80,0x66,0x49,0x92,0x71,0x00,0x00,0x5E,0x44,0x24,0x2E,0x54,0xCA,0xB3,0x3F,0xC7,0x08,0x00,0x00,
0x44,0xA0,0x81,0x2A,0xB0,0x41,0x1B,0xF4,0xC1,0x18,0x2C,0xC0,0x06,0x1C,0xC1,0x05,0xDC,0xC1,0x0B,0xFC,0x60,0x36,0x84,0x42,0x24,0xC4,0xC2,0x42,0x10,0x42,0x0A,0x64,
0x80,0x1C,0x72,0x60,0x29,0xAC,0x82,0x42,0x28,0x86,0xCD,0xB0,0x1D,0x2A,0x60,0x2F,0xD4,0x40,0x1D,0x34,0xC0,0x51,0x68,0x86,0x93,0x70,0x0E,0x2E,0xC2,0x55,0xB8,0x0E,
0x3D,0x70,0x0F,0xFA,0x61,0x08,0x9E,0xC1,0x28,0xBC,0x81,0x09,0x04,0x41,0xC8,0x08,0x13,0x61,0x21,0xDA,0x88,0x01,0x62,0x8A,0x58,0x23,0x8E,0x08,0x17,0x99,0x85,0xF8,
0x21,0xC1,0x48,0x04,0x12,0x8B,0x24,0x20,0xC9,0x88,0x14,0x51,0x22,0x4B,0x91,0x35,0x48,0x31,0x52,0x8A,0x54,0x20,0x55,0x48,0x1D,0xF2,0x3D,0x72,0x02,0x39,0x87,0x5C,
0x46,0xBA,0x91,0x3B,0xC8,0x00,0x32,0x82,0xFC,0x86,0xBC,0x47,0x31,0x94,0x81,0xB2,0x51,0x3D,0xD4,0x0C,0xB5,0x43,0xB9,0xA8,0x37,0x1A,0x84,0x46,0xA2,0x0B,0xD0,0x64,
0x74,0x31,0x9A,0x8F,0x16,0xA0,0x9B,0xD0,0x72,0xB4,0x1A,0x3D,0x8C,0x36,0xA1,0xE7,0xD0,0xAB,0x68,0x0F,0xDA,0x8F,0x3E,0x43,0xC7,0x30,0xC0,0xE8,0x18,0x07,0x33,0xC4,
0x6C,0x30,0x2E,0xC6,0xC3,0x42,0xB1,0x38,0x2C,0x09,0x93,0x63,0xCB,0xB1,0x22,0xAC,0x0C,0xAB,0xC6,0x1A,0xB0,0x56,0xAC,0x03,0xBB,0x89,0xF5,0x63,0xCF,0xB1,0x77,0x04,
0x12,0x81,0x45,0xC0,0x09,0x36,0x04,0x77,0x42,0x20,0x61,0x1E,0x41,0x48,0x58,0x4C,0x58,0x4E,0xD8,0x48,0xA8,0x20,0x1C,0x24,0x34,0x11,0xDA,0x09,0x37,0x09,0x03,0x84,
0x51,0xC2,0x27,0x22,0x93,0xA8,0x4B,0xB4,0x26,0xBA,0x11,0xF9,0xC4,0x18,0x62,0x32,0x31,0x87,0x58,0x48,0x2C,0x23,0xD6,0x12,0x8F,0x13,0x2F,0x10,0x7B,0x88,0x43,0xC4,
0x37,0x24,0x12,0x89,0x43,0x32,0x27,0xB9,0x90,0x02,0x49,0xB1,0xA4,0x54,0xD2,0x12,0xD2,0x46,0xD2,0x6E,0x52,0x23,0xE9,0x2C,0xA9,0x9B,0x34,0x48,0x1A,0x23,0x93,0xC9,
0xDA,0x64,0x6B,0xB2,0x07,0x39,0x94,0x2C,0x20,0x2B,0xC8,0x85,0xE4,0x9D,0xE4,0xC3,0xE4,0x33,0xE4,0x1B,0xE4,0x21,0xF2,0x5B,0x0A,0x9D,0x62,0x40,0x71,0xA4,0xF8,0x53,
0xE2,0x28,0x52,0xCA,0x6A,0x4A,0x19,0xE5,0x10,0xE5,0x34,0xE5,0x06,0x65,0x98,0x32,0x41,0x55,0xA3,0x9A,0x52,0xDD,0xA8,0xA1,0x54,0x11,0x35,0x8F,0x5A,0x42,0xAD,0xA1,
0xB6,0x52,0xAF,0x51,0x87,0xA8,0x13,0x34,0x75,0x9A,0x39,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B,0x86,0x0D,0x86,0xEB,0x9E,0x38,0x3E,0x39,0x39,0xE2,0x3F,0x72,0xFD,0xE9,0xFC,0xA7,0x43,0xCF,0x64,0xCF,0x26,0x9E,0x17,0xFE,0xA2,0xFE,0xCB,
0xAE,0x17,0x16,0x2F,0x7E,0xF8,0xD5,0xEB,0xD7,0xCE,0xD1,0x98,0xD1,0xA1,0x97,0xF2,0x97,0x93,0xBF,0x6D,0x7C,0xA5,0xFD,0xEA,0xC0,0xEB,0x19,0xAF,0xDB,0xC6,0xC2,0xC6,
0x1E,0xBE,0xC9,0x78,0x33,0x31,0x5E,0xF4,0x56,0xFB,0xED,0xC1,0x77,0xDC,0x77,0x1D,0xEF,0xA3,0xDF,0x0F,0x4F,0xE4,0x7C,0x20,0x7F,0x28,0xFF,0x68,0xF9,0xB1,0xF5,0x53,
0xD0,0xA7,0xFB,0x93,0x19,0x93,0x93,0xFF,0x04,0x03,0x98,0xF3,0xFC,0x63,0x33,0x2D,0xDB,0x00,0x00,0x00,0x20,0x63,0x48,0x52,0x4D,0x00,0x00,0x7A,0x25,0x00,0x00,0x80,
0x83,0x00,0x00,0xF9,0xFF,0x00,0x00,0x80,0xE9,0x00,0x00,0x75,0x30,0x00,0x00,0xEA,0x60,0x00,0x00,0x3A,0x98,0x00,0x00,0x17,0x6F,0x92,0x5F,0xC5,0x46,0x00,0x00,0x10,
0x74,0x49,0x44,0x41,0x54,0x78,0xDA,0xEC,0xDD,0xE1,0x71,0xA3,0x38,0x1B,0x00,0x60,0xDD,0xCD,0x35,0xE0,0xAF,0x04,0x5F,0x09,0xDE,0x12,0xD8,0x12,0x7C,0x25,0x78,0x4B,
0xF0,0x96,0x90,0x94,0x10,0x97,0xB0,0x29,0xC1,0x2E,0x21,0x2E,0x21,0x29,0x21,0x2E,0x81,0xEF,0x47,0xF0,0xAC,0xCF,0x67,0x1B,0x09,0x24,0x0C,0xC9,0xF3,0xCC,0x30,0x37,
0x37,0xEB,0xC0,0x8B,0x24,0xC4,0x8B,0x00,0xF1,0x47,0x5D,0xD7,0x01,0x00,0x60,0x6A,0xFE,0x54,0x04,0x00,0x80,0x24,0x06,0x00,0x40,0x12,0x03,0x00,0x20,0x89,0x01,0x00,
0x24,0x31,0x00,0x00,0x92,0x18,0x00,0x00,0x49,0x0C,0x00,0x20,0x89,0x01,0x00,0x90,0xC4,0x00,0x00,0x48,0x62,0x00,0x00,0x24,0x31,0x00,0x80,0x24,0x06,0x00,0x40,0x12,
0x03,0x00,0x20,0x89,0x01,0x00,0x24,0x31,0x00,0x00,0x92,0x18,0x00,0x00,0x49,0x0C,0x00,0x20,0x89,0x01,0x00,0x90,0xC4,0x00,0x00,0x48,0x62,0x00,0x00,0x24,0x31,0x00,
0x80,0x24,0x06,0x00,0x40,0x12,0x03,0x00,0x20,0x89,0x01,0x00,0x24,0x31,0x00,0x00,0x92,0x18,0x00,0x00,0x49,0x0C,0x00,0x20,0x89,0x01,0x00,0x90,0xC4,0x00,0x00,0x48,
0x62,0x00,0x00,0x24,0x31,0x00,0x80,0x24,0x06,0x00,0x40,0x12,0x03,0x00,0x20,0x89,0x01,0x00,0x24,0x31,0x00,0x00,0x92,0x18,0x00,0x00,0x49,0x0C,0x00,0x20,0x89,0x01,
0x00,0x90,0xC4,0x00,0x00,0x48,0x62,0x00,0x00,0x24,0x31,0x00,0x80,0x24,0x06,0x00,0x40,0x12,0x03,0x00,0x20,0x89,0x01,0x00,0x24,0x31,0x00,0x00,0x92,0x18,0x00,0x00,
0x49,0x0C,0x00,0x20,0x89,0x01,0x00,0x90,0xC4,0x00,0x00,0x48,0x62,0x00,0x00,0x24,0x31,0x00,0x80,0x24,0x06,0x68,0xB3,0x0C,0x21,0xFC,0x0A,0x21,0xD4,0xCD,0xF2,0x1A,
0x42,0x58,0x87,0x10,0x66,0x5F,0xB8,0x4C,0x66,0x4D,0x19,0xBC,0x36,0x65,0xF2,0x1E,0x42,0x78,0xFA,0xE2,0x65,0x02,0x74,0xF4,0x47,0x5D,0xD7,0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0x43,0xC6,0x39,0xA6,0x3A,0xBA,0xD6,0x06,0x1F,0x3A,0xC4,0xFE,0x92,0xE1,0x02,0x7B,0x7E,0xE5,0xD8,0x7E,0x2A,0x99,0x5B,0xFC,
0x51,0xD7,0x75,0x18,0xD8,0x22,0xFC,0x7E,0xCA,0xFC,0xD0,0xE3,0x79,0x90,0x79,0xF8,0xF7,0xDC,0x0F,0xBB,0x42,0xF7,0xDC,0xA6,0x16,0xEF,0x98,0x62,0x3E,0x4E,0x21,0x3E,
0x3F,0x19,0xFE,0xDF,0x75,0xDC,0xF6,0x73,0xC1,0xE7,0x1F,0x66,0xE1,0xDF,0xDF,0x31,0xC9,0x59,0x37,0xA7,0x75,0xF1,0x96,0x71,0xF8,0xF9,0xB4,0x6C,0x2F,0xCD,0x3F,0xB1,
0x1B,0xA0,0x9D,0x85,0x93,0x6D,0x2F,0xCE,0x86,0x8E,0x6F,0xBD,0x35,0x77,0x5E,0xDE,0x25,0xEB,0xB6,0x3A,0xA9,0x87,0x4B,0xB7,0x61,0x8F,0xB1,0x1E,0x46,0xD6,0x6E,0x6E,
0x6D,0x6F,0x11,0x7E,0xCF,0x05,0x74,0xBE,0x3F,0xC7,0x07,0x91,0x4B,0xC7,0x12,0x4E,0xE2,0x98,0x5F,0x29,0xD7,0x5D,0x8F,0x36,0x9D,0xDA,0x5F,0x0C,0x19,0xE7,0x98,0xEA,
0x28,0xE7,0xB1,0x74,0xFA,0x99,0x9A,0x3E,0xB1,0xE5,0x5A,0x4F,0x94,0x7B,0x24,0x31,0x00,0x00,0xBD,0xFD,0xA9,0x08,0x00,0x00,0x49,0x0C,0x00,0x80,0x24,0x06,0x00,0x40,
0x12,0x03,0x00,0x48,0x62,0x00,0x00,0x24,0x31,0x00,0x00,0x92,0x18,0x00,0x40,0x12,0x03,0x00,0x20,0x89,0x01,0x00,0x90,0xC4,0x00,0x00,0x48,0x62,0x00,0x00,0x49,0x0C,
0x00,0x80,0x24,0x06,0x00,0x40,0x12,0x03,0x00,0x48,0x62,0x00,0x00,0x24,0x31,0x00,0x00,0x92,0x18,0x00,0x40,0x12,0x03,0x00,0x20,0x89,0x01,0x00,0x90,0xC4,0x00,0x00,
0x48,0x62,0x00,0x00,0x49,0x0C,0x00,0x80,0x24,0x06,0x00,0x40,0x12,0x03,0x00,0x48,0x62,0x00,0x00,0x24,0x31,0x00,0x00,0x92,0x18,0x00,0x40,0x12,0x03,0x00,0x20,0x89,
0x01,0x00,0x90,0xC4,0x00,0x00,0x48,0x62,0x00,0x00,0x49,0x0C,0x00,0x80,0x24,0x06,0x00,0x40,0x12,0x03,0x00,0x48,0x62,0x00,0x00,0x24,0x31,0x00,0x00,0x92,0x18,0x00,
0x40,0x12,0x03,0x00,0x20,0x89,0x01,0x00,0x90,0xC4,0x00,0x00,0x48,0x62,0x00,0x00,0x49,0x0C,0x00,0x80,0x24,0x06,0x00,0x40,0x12,0x03,0x00,0x48,0x62,0x00,0x00,0x24,
0x31,0x00,0x00,0x92,0x18,0x00,0x40,0x12,0x03,0x00,0x20,0x89,0x01,0x00,0x90,0xC4,0x00,0x00,0x48,0x62,0x00,0x00,0x49,0x0C,0x00,0x80,0x24,0x06,0x00,0x40,0x12,0x03,
0x00,0x48,0x62,0x00,0x00,0x24,0x31,0x00,0x00,0x92,0x18,0x00,0x40,0x12,0x03,0x00,0x30,0x39,0xFF,0x1F,0x00,0x11,0x06,0x61,0x07,0xDC,0x0A,0xFB,0xD0,0x00,0x00,0x00,
0x00,0x49,0x45,0x4E,0x44,0xAE,0x42,0x60,0x82,};
|
[
"zapolnov@gmail.com"
] |
zapolnov@gmail.com
|
fb4bca19daee9435906def8b18cae9ed82b11312
|
5cd8d6efd159f55e53ff39b2764bb4d447a25699
|
/Back-tracking/RatInMaze.cpp
|
839aec725015f25f693b92738aee7bf68265c64d
|
[] |
no_license
|
Shaswat-2203/DataStructures-Algorithms
|
9181c285f0114496395ed50ea015e150b6dc6a10
|
5e110d1245382794eba75eb574ff7c1fbfc69476
|
refs/heads/main
| 2023-08-21T21:44:19.349768
| 2021-10-03T19:42:55
| 2021-10-03T19:42:55
| 413,178,924
| 1
| 0
| null | 2021-10-03T19:38:23
| 2021-10-03T19:38:23
| null |
UTF-8
|
C++
| false
| false
| 1,432
|
cpp
|
#include <bits/stdc++.h>
using namespace std;
bool isSafe (int **arr, int x, int y, int n){
if (x < n && y < n && arr[x][y] == 1){
return true;
}
return false;
}
bool ratInMaze(int **arr, int x, int y, int n, int **resultArr){
if (x == n-1 && y == n-1){
resultArr[x][y] = 1;
return true;
}
if (isSafe(arr, x, y, n)){
resultArr[x][y] = 1;
if (ratInMaze (arr, x+1, y, n, resultArr)){
return true;
}
if (ratInMaze (arr, x, y+1, n, resultArr)){
return true;
}
resultArr[x][y] = 0; //Backtracking
return false;
}
return false;
}
int main() {
int n; cin >> n;
int** arr = new int*[n];
for (int i = 0; i < n; i++){
arr[i] = new int[n];
}
for (int i = 0; i < n; i++){
for (int j = 0; j < n; j++){
cin >> arr[i][j];
}
}
cout << "\n";
int **resultArr = new int*[n];
for (int i = 0; i < n; i++){
resultArr[i] = new int[n];
for (int j = 0; j < n; j++){
resultArr[i][j] = 0;
}
}
if(ratInMaze(arr, 0, 0, n, resultArr)){
for (int i = 0; i < n; i++){
for (int j = 0; j < n; j++){
cout << resultArr[i][j] <<" ";
}
cout << "\n";
}
}
return 0;
}
/*
1 0 1 0 1
1 1 1 1 1
0 1 0 1 0
1 0 0 1 1
1 1 1 0 1
*/
|
[
"rahulranjan25.RR@gmail.com"
] |
rahulranjan25.RR@gmail.com
|
89a570c5aa5cf71af96b4dd7ea66412b55233e10
|
18e9db71a0e207dbc7654135123bceaa7b3339e4
|
/7.代码练习/noip入门组/207评奖2.cpp
|
a142c4ccb710873c0ee086d1047dc8d9f280ae08
|
[] |
no_license
|
TheIslland/learning-in-collegelife
|
358490cc74914b87d4d626a6485c2fe1ff06462f
|
1794e18addfd05e32cf8108895ac1585586394e1
|
refs/heads/master
| 2021-07-08T00:51:00.908370
| 2020-07-11T01:04:35
| 2020-07-11T01:04:35
| 144,252,958
| 2
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,144
|
cpp
|
/*************************************************************************
> File Name: 207评奖2.cpp
> Author: TheIslland
> Mail: voidland@163.com, 861436930@qq.com
> Created Time: Wed Nov 6 19:55:51 2019
************************************************************************/
#include<iostream>
#include<algorithm>
#include<iomanip>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<string>
typedef long long ll;
using namespace std;
struct student {
string name;
int grade;
};
bool cmp(struct student &a, struct student &b) {
return a.grade > b.grade;
}
int main() {
int n, max = -1, min = 1000;
string name;
struct student a[35];
cin >> n;
for(int i = 0; i < n; i++) {
cin >> name;
int sum = 0, m;
for (int i = 0; i < 4; i++) {
cin >> m;
m > max && (max = m);
m < min && (min = m);
sum += m;
}
cout << sum << endl;
struct student temp = {name, sum};
a[i] = temp;
}
sort(a, a + n, cmp);
cout << a[0].name << endl;
cout << max << " " << min << endl;
return 0;
}
|
[
"861436930@qq.com"
] |
861436930@qq.com
|
fda39371509dfc674e6e446c81822d015ed949ac
|
ca1400d67b5c38c440f188da7628252618430d40
|
/QuickSearch/searchManage.cpp
|
953bd3da73d8ebfa8a27882184de69dff01b1210
|
[] |
no_license
|
ykerit/QuickSearch
|
638231a246bf018e2aea79fa1e894ca9659be56a
|
e82d0deb5849cb515a441cb91434adbb8d6a9516
|
refs/heads/master
| 2020-06-26T01:15:16.147554
| 2019-07-29T15:30:33
| 2019-07-29T15:30:33
| 199,478,950
| 1
| 0
| null | null | null | null |
GB18030
|
C++
| false
| false
| 5,952
|
cpp
|
#include "searchManage.h"
namespace quicksearch
{
using namespace util;
// 监控间隔
#define INTERVAL 10
void SearchManage::InitSearch()
{
// 初始化数据库
db_ = new DataBase("record.db");
db_->Init();
// 初始化USN日志
usn_ = new UsnManage("E:");
usn_->Init();
std::thread work(&SearchManage::BGDataService, this);
work.detach();
}
void SearchManage::Search()
{
while (true)
{
std::string input;
std::cout << "请输入想搜索的文件或目录" << std::endl;
std::cin >> input;
std::string pinyin = Util::ChineseConvertPy(input);
std::string pinyinAbbr = Util::ChineseConvertPyAbbre(input);
std::vector<FRInfo> result;
db_->QueryRecord(pinyin, pinyinAbbr, result);
displayResult(result, input, pinyin, pinyinAbbr);
}
}
void SearchManage::stopBGDataService()
{
isShutDown_ = true;
}
// 文件系统监控
void SearchManage::BGDataService()
{
// 第一次检索
if (db_->isEmpty())
{
usn_->GetRecord(records_);
// 之后批量插入
db_->BatchInsert(records_);
}
else
{
while (!isShutDown_)
{
// 检查文件系统变化
std::vector<util::ChangeInfo> record;
usn_->ChangeRecord(record);
// 获取后对数据库更新
if (!record.empty())
{
updateDB(record);
}
std::this_thread::sleep_for(std::chrono::seconds(INTERVAL));
}
}
}
void SearchManage::displayResult(const std::vector<FRInfo>& result,
std::string& input,
std::string& pinyin,
std::string& pinyinAbbr)
{
int pos;
for (auto& res : result)
{
std::string filename = res.filename_;
int len = filename.size();
// 如果直接模糊匹配 直接找到字串高亮;
if ((pos = res.filename_.find(input)) != std::string::npos)
{
std::cout << filename.substr(0, pos);
Util::HighLight(filename.substr(pos, input.size()).c_str());
std::cout << filename.substr(pos + input.size()) << std::endl;
std::cout << " ";
std::cout << res.path_ << std::endl;
}
else
{
// 如果是全拼或者拼音首字母
// 先转拼音和首字母
std::string pinyinR = Util::ChineseConvertPy(res.filename_);
std::string pinyinAbbrR = Util::ChineseConvertPyAbbre(res.filename_);
if ((pos = pinyinR.find(pinyin)) != std::string::npos)
{
int count = 0;
// 前缀
int i;
for (i = 0; i < len;)
{
// 如果头部就是找到的, 就没有前缀
if (count == pos)
{
break;
}
// 如果是字母
if (filename[i] >= 0 && filename[i] <= 128)
{
++i;
count++;
continue;
}
// 如果是汉字
std::string temp; // 保存单个汉字
temp.push_back(filename[i]);
temp.push_back(filename[i + 1]);
temp = Util::ChineseConvertPy(temp);
count += temp.size(); // 拼音长度
i += 2;
if (count >= pos)
{
break;
}
}
int j;
count = 0;
// 高亮部分
for (j = i; j < len;)
{
if (filename[j] >= 0 && filename[j] <= 128)
{
++j;
count++;
continue;
}
// 如果是汉字
std::string temp; // 保存单个汉字
temp.push_back(filename[j]);
temp.push_back(filename[j + 1]);
temp = Util::ChineseConvertPy(temp);
count += temp.size(); // 拼音长度
j += 2;
if (count == pinyin.size())
{
break;
}
}
// 输出
std::cout << filename.substr(0, i);
Util::HighLight(filename.substr(i, j - i).c_str());
std::cout << filename.substr(j);
//std::cout << " ";
printf("%50s\n", res.path_.c_str());
// std::cout << res.path_ << std::endl;
std::cout << std::endl;
}
else if ((pos = pinyinAbbrR.find(pinyinAbbr)) != std::string::npos) // 首字母
{
int count = 0;
// 前缀
int i;
for (i = 0; i < len;)
{
// 如果头部就是找到的, 就没有前缀
if (count == pos)
{
break;
}
// 如果是字母
if (filename[i] >= 0 && filename[i] <= 128)
{
++i;
count++;
continue;
}
// 如果是汉字
std::string temp; // 保存单个汉字
temp.push_back(filename[i]);
temp.push_back(filename[i + 1]);
temp = Util::ChineseConvertPyAbbre(temp);
count += temp.size(); // 拼音长度
i += 2;
if (count >= pos)
{
break;
}
}
int j;
count = 0;
// 高亮部分
for (j = i; j < len;)
{
if (filename[j] >= 0 && filename[j] <= 128)
{
++j;
count++;
continue;
}
// 如果是汉字
std::string temp; // 保存单个汉字
temp.push_back(filename[j]);
temp.push_back(filename[j + 1]);
temp = Util::ChineseConvertPyAbbre(temp);
count += temp.size(); // 拼音长度
j += 2;
if (count == pinyin.size())
{
break;
}
}
// 输出
std::cout << filename.substr(0, i);
Util::HighLight(filename.substr(i, j - i).c_str());
std::cout << filename.substr(j);
/*std::cout << " ";
std::cout << res.path_ << std::endl;*/
printf("%50s\n", res.path_.c_str());
std::cout << std::endl;
}
}
}
}
void SearchManage::updateDB(std::vector<util::ChangeInfo>& record)
{
for (auto& e : record)
{
// 如果文件不存在了 删除文件
if (!e.isExist_ && e.oldName_.size() > 0)
{
db_->DelRecord(e.oldName_);
}
else
{
// 新创建文件
if (e.isNew_)
{
FRInfo info;
info.filename_ = e.filename_;
info.path_ = e.path_;
info.py_ = Util::ChineseConvertPy(e.filename_);
info.py_Abbreviation_ = Util::ChineseConvertPyAbbre(e.filename_);
db_->insert(info);
}
// 更名
else if (e.oldName_ != e.newName_)
{
db_->UpdateRecord(e);
}
}
}
}
}
|
[
"ykerforit@gmail.com"
] |
ykerforit@gmail.com
|
d5bebb9f1239f9b0e8440e92adedc429d4cc10ec
|
cfeac52f970e8901871bd02d9acb7de66b9fb6b4
|
/generated/src/aws-cpp-sdk-ec2/include/aws/ec2/model/TransitGatewayRouteState.h
|
e813e590e4941398b270a8182004fd727ea58230
|
[
"Apache-2.0",
"MIT",
"JSON"
] |
permissive
|
aws/aws-sdk-cpp
|
aff116ddf9ca2b41e45c47dba1c2b7754935c585
|
9a7606a6c98e13c759032c2e920c7c64a6a35264
|
refs/heads/main
| 2023-08-25T11:16:55.982089
| 2023-08-24T18:14:53
| 2023-08-24T18:14:53
| 35,440,404
| 1,681
| 1,133
|
Apache-2.0
| 2023-09-12T15:59:33
| 2015-05-11T17:57:32
| null |
UTF-8
|
C++
| false
| false
| 734
|
h
|
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#pragma once
#include <aws/ec2/EC2_EXPORTS.h>
#include <aws/core/utils/memory/stl/AWSString.h>
namespace Aws
{
namespace EC2
{
namespace Model
{
enum class TransitGatewayRouteState
{
NOT_SET,
pending,
active,
blackhole,
deleting,
deleted
};
namespace TransitGatewayRouteStateMapper
{
AWS_EC2_API TransitGatewayRouteState GetTransitGatewayRouteStateForName(const Aws::String& name);
AWS_EC2_API Aws::String GetNameForTransitGatewayRouteState(TransitGatewayRouteState value);
} // namespace TransitGatewayRouteStateMapper
} // namespace Model
} // namespace EC2
} // namespace Aws
|
[
"sdavtaker@users.noreply.github.com"
] |
sdavtaker@users.noreply.github.com
|
bec823a2cd62eb03543cb7662655270cf8adc883
|
48d4de83d911acabbe6935fe6fdedac244ba38ea
|
/SDK/PUBG_WeapCrossbow_2_parameters.hpp
|
9c6fbf3cddf56b834a701893172d32346bacbb80
|
[] |
no_license
|
yuaom/PUBG-SDK-1
|
af9c18e7d69a05074d4e6596f5f6ac1761192e7d
|
5958d6039aabe8a42d40c2f6a6978af0fffcb87b
|
refs/heads/master
| 2023-06-10T12:42:33.106376
| 2018-02-24T04:38:15
| 2018-02-24T04:38:15
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,330
|
hpp
|
#pragma once
// PLAYERUNKNOWN'S BATTLEGROUNDS (3.6.13.14) SDK
#ifdef _MSC_VER
#pragma pack(push, 0x8)
#endif
#include "../SDK.hpp"
namespace Classes
{
//---------------------------------------------------------------------------
//Parameters
//---------------------------------------------------------------------------
// Function WeapCrossbow_2.WeapCrossbow_1_C.UserConstructionScript
struct AWeapCrossbow_1_C_UserConstructionScript_Params
{
};
// Function WeapCrossbow_2.WeapCrossbow_1_C.ReceiveTick
struct AWeapCrossbow_1_C_ReceiveTick_Params
{
float* DeltaSeconds; // (Parm, ZeroConstructor, IsPlainOldData)
};
// Function WeapCrossbow_2.WeapCrossbow_1_C.ServerSetAmmoState
struct AWeapCrossbow_1_C_ServerSetAmmoState_Params
{
TEnumAsByte<ENUM_CrossbowState> NewAmmoState; // (Parm, ZeroConstructor, IsPlainOldData)
};
// Function WeapCrossbow_2.WeapCrossbow_1_C.ExecuteUbergraph_WeapCrossbow_2
struct AWeapCrossbow_1_C_ExecuteUbergraph_WeapCrossbow_2_Params
{
int EntryPoint; // (Parm, ZeroConstructor, IsPlainOldData)
};
}
#ifdef _MSC_VER
#pragma pack(pop)
#endif
|
[
"mtz007@x.y.z"
] |
mtz007@x.y.z
|
f70d4e94e953b24add8959f8ba066071fc1f38a0
|
1e59bd4634b0eae8de5fa55fd29ced21e7054dab
|
/server/tcpserver.hpp
|
90616b8eb71a28bf78a4cde6ccfabfccf18a3663
|
[
"MIT"
] |
permissive
|
KeltorHD/Client-Server-Application-Design-Patterns-Teaching
|
472528210d275347812e9ddb40e58977983c9aba
|
7461234f828ebfa900366f5a5f965b4aa0d02ce6
|
refs/heads/main
| 2023-05-09T02:00:28.590666
| 2021-05-12T10:18:19
| 2021-05-12T10:18:19
| 359,933,510
| 2
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,225
|
hpp
|
#pragma once
#pragma comment(lib, "ws2_32.lib")
#define _WINSOCK_DEPRECATED_NO_WARNINGS
#define _CRT_SECURE_NO_WARNINGS
#include <Winsock2.h>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <functional>
#include <thread>
#include <mutex>
#include <list>
#include <string>
#include <vector>
#include <algorithm>
class TCPServer
{
public:
class TCPClient;
TCPServer(unsigned port, std::function<void(TCPClient&)> callback);
~TCPServer();
void start();
private:
unsigned port;
SOCKET S; //дескриптор прослушивающего сокета
SOCKET NS;
sockaddr_in serv_addr;
WSADATA wsadata;
std::function<void(TCPClient&)> callback;
std::list<std::thread> threads;
std::list<std::shared_ptr<TCPClient>> clients;
std::mutex print_mutex;
std::mutex vec_mutex;
std::vector<size_t> del;
void client_loop(std::shared_ptr<TCPClient> client);
};
class TCPServer::TCPClient
{
public:
TCPClient(SOCKET S, sockaddr_in cli_addr);
~TCPClient();
const std::string& get_data();
void send_data(const std::string& text);
friend class TCPServer;
private:
SOCKET S; //сокет клиента
sockaddr_in cli_addr;
std::string data;
const std::string& get_data(bool& err);
};
|
[
"keltorplaylife@gmail.com"
] |
keltorplaylife@gmail.com
|
ae4428879968469801ce4ba181c44f8042b34705
|
909b6b8e930b01f0fb8e2cc74f4e061da18552e0
|
/raygame/Game.cpp
|
4b0a05c5c2b519e9f93495b5e53da06ec73bca5e
|
[
"MIT"
] |
permissive
|
SamuelDaman/Custom-Phys-Assessment-Cpp
|
70014f4833a6d3e917428da5b0273420666dac65
|
41d69d9963398be6983474e2b7fff610f333241c
|
refs/heads/master
| 2022-12-12T14:26:40.079486
| 2020-09-17T05:15:15
| 2020-09-17T05:15:15
| 294,776,159
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 3,997
|
cpp
|
#include "Game.h"
#include <iostream>
#include <ctime>
#include <cstdlib>
#include "Raylib.h"
#include "enumUtils.h"
collisionMap setupCollisionChecks()
{
collisionMap map;
map[(collisionPair)(ShapeType::CIRCLE | ShapeType::CIRCLE)] = checkCircleCircle;
map[(collisionPair)(ShapeType::CIRCLE | ShapeType::AABB)] = checkCircleBox;
map[(collisionPair)(ShapeType::AABB | ShapeType::AABB)] = checkBoxBox;
return map;
}
depenetrationMap setupDepenetrationFuncs()
{
depenetrationMap map;
map[(collisionPair)(ShapeType::CIRCLE | ShapeType::CIRCLE)] = depenetrateCircleCircle;
map[(collisionPair)(ShapeType::CIRCLE | ShapeType::AABB)] = depenetrateCircleBox;
map[(collisionPair)(ShapeType::AABB | ShapeType::AABB)] = depenetrateBoxBox;
return map;
}
collisionMap Game::collisionCheckers = setupCollisionChecks();
depenetrationMap Game::depenetrationFuncs = setupDepenetrationFuncs();
Game::Game()
{
accumulatedDeltaTime = 0.0f;
fixedTimeStep = 1.0f / 30.0f;
srand(time(0));
}
void Game::init()
{
int screenWidth = 800;
int screenHeight = 450;
InitWindow(screenWidth, screenHeight, "raylib [core] example - basic window");
SetTargetFPS(60);
}
bool Game::tick()
{
accumulatedDeltaTime += GetFrameTime();
if (IsMouseButtonPressed(0))
{
auto cursorPos = GetMousePosition();
PhysObject spawn;
spawn.pos = { cursorPos.x, cursorPos.y };
spawn.mass = (rand() % 10) + 5;
if (rand() % 2 == 0)
{
spawn.shape.circleData.radius = spawn.mass + 4;
}
else
{
spawn.shape.colliderShape = ShapeType::AABB;
spawn.shape.boxData.bounds = { spawn.mass + 4, spawn.mass + 4 };
}
spawn.addImpulse({ (rand() % 501) - 250, (rand() % 501) - 250 });
PhysObjects.push_back(spawn);
}
if (IsMouseButtonPressed(1))
{
auto cursorPos = GetMousePosition();
for (auto& obj : PhysObjects)
{
auto * object = &obj;
if (glm::length(vec2(cursorPos.x, cursorPos.y) - object->pos) < 100)
{
obj.addImpulse(glm::normalize(object->pos - vec2(cursorPos.x, cursorPos.y)) * 5000.0f);
}
}
}
return !WindowShouldClose();
}
void Game::tickPhysics()
{
accumulatedDeltaTime -= fixedTimeStep;
for (auto& obj : PhysObjects)
{
obj.addAccel(vec2(0, 98));
glm::clamp(obj.vel.x, -10.0f, 10.0f);
glm::clamp(obj.vel.y, -10.0f, 10.0f);
}
for (auto& lhs : PhysObjects)
{
for (auto& rhs : PhysObjects)
{
if (&lhs == &rhs) { continue; }
auto * first = &lhs;
auto * second = &rhs;
if (static_cast<uint8_t>(lhs.shape.colliderShape) > static_cast<uint8_t>(rhs.shape.colliderShape))
{
first = &rhs;
second = &lhs;
}
collisionPair pairType = (collisionPair)(lhs.shape.colliderShape | rhs.shape.colliderShape);
bool collision = collisionCheckers[pairType](first->pos, first->shape, second->pos, second->shape);
if (collision)
{
float pen = 0.0f;
vec2 normal = depenetrationFuncs[pairType](first->pos, first->shape, second->pos, second->shape, pen);
vec2 resImpulses[2];
resolveCollision(first->pos, first->vel, first->mass, second->pos, second->vel, second->mass, 1.0f, normal, resImpulses);
first->pos += normal * pen;
second->pos -= normal * pen;
first->vel = resImpulses[0];
second->vel = resImpulses[1];
}
}
}
for (auto& obj : PhysObjects)
{
obj.tickPhysics(fixedTimeStep);
}
for (auto& obj : PhysObjects)
{
auto * object = &obj;
int scrWidth = GetScreenWidth();
int scrHeight = GetScreenHeight();
if (object->pos.x < -10)
{
object->pos.x = scrWidth + 10;
}
if (object->pos.x > scrWidth + 10)
{
object->pos.x = -10;
}
if (object->pos.y < -10)
{
object->pos.y = scrHeight + 10;
}
if (object->pos.y > scrHeight + 10)
{
object->pos.y = -10;
}
}
}
bool Game::shouldTickPhysics() const
{
return accumulatedDeltaTime >= fixedTimeStep;
}
void Game::draw() const
{
BeginDrawing();
ClearBackground(RAYWHITE);
for (auto& obj : PhysObjects)
{
obj.draw();
}
EndDrawing();
}
void Game::exit()
{
CloseWindow();
}
|
[
"54036673+SamuelDaman@users.noreply.github.com"
] |
54036673+SamuelDaman@users.noreply.github.com
|
30d4111ee52c21a9959093024d7c8cc0fee0268e
|
f0f0a8d3079bbdc6847dae5f562cb65a8bb7f32e
|
/Chapter_4/1.cpp
|
a815114fb2901721597748a2aea4c4414f2bc1c7
|
[] |
no_license
|
RapunzeI/Cpp
|
f20c02fac700c9458e50bae19a286818dfc5dc69
|
d1ecb7826e485cc50a8f31712699079ba82f4c10
|
refs/heads/main
| 2023-05-29T20:42:01.385343
| 2021-06-05T14:36:04
| 2021-06-05T14:36:04
| 355,849,784
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 576
|
cpp
|
#include <iostream>
using namespace std;
class Color {
int red, green, blue;
public:
Color(){ red = green = blue = 0; }
Color(int r, int g, int b) { red = r; green = g; blue = b; }
void setColor(int r, int g, int b){ red = r; green = g; blue = b; }
void show() { cout << red << ' ' << green << ' ' << blue << endl; }
};
int main(){
Color screenColor(225, 0, 0);
Color *p;
p = &screenColor;
p->show();
Color colors[3];
p = colors;
p[0].setColor(255, 0, 0);
p[1].setColor(0, 255, 0);
p[2].setColor(0, 0, 255);
for (int i = 0; i < 3; i++){
p[i].show();
}
}
|
[
"noreply@github.com"
] |
RapunzeI.noreply@github.com
|
0beb07aadc5150d444d1146bc80f206beaa43a23
|
93e87a15e6a3f249179b8e700b54ebdbb47c3bb7
|
/SerialRelais16.h
|
eecc10d1225f88c93189156d6331367c8e3e8e9c
|
[] |
no_license
|
sylvainpasquiet/FilPilote
|
3cbff87aa6470414331007a62a4455c2931c44ec
|
1e41a819b4de960e089750a24e4cacf83e38624c
|
refs/heads/master
| 2020-04-14T13:00:41.913932
| 2019-01-12T14:14:25
| 2019-01-12T14:14:25
| 163,856,966
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 517
|
h
|
#ifndef SerialRelais16_h
#define SerialRelais16_h
#include "Arduino.h"
enum EtatRelai {
INCONNU,
OUVERT,
FERME
};
class SERIAL_RELAIS_16
{
public:
SERIAL_RELAIS_16(int _latchPin,int _dataPin,int _clockPin);
EtatRelai GetRelai(char index);
void SetRelai(char index,EtatRelai Valeur);
void SetAllRelai(EtatRelai Valeur);
void Refresh();
private:
EtatRelai Relais[16];
int latchPin;
int dataPin;
int clockPin;
};
#endif
|
[
"sylvain.pasquiet80@gmail.com"
] |
sylvain.pasquiet80@gmail.com
|
fbc852048916ca37eeb2d163a72993ea3e31c7cb
|
40e326893d52d8741630e1d3176d24207bd8e1d3
|
/matcher.cpp
|
f5cedfce458505f472f3b8c9ed56c67ee920a0f6
|
[] |
no_license
|
zinglax/dylan-openCV
|
372f88f60b8bd371783b8388e0111d0d98c6a98f
|
9a2d4f43085769c3fb182f636ba5ebcdcb8a14b3
|
refs/heads/master
| 2021-01-22T06:54:31.552675
| 2014-10-06T01:14:58
| 2014-10-06T01:14:58
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 925
|
cpp
|
#include "opencv2/core/core.hpp"
Mat img1 = imread(argv[1], CV_LOAD_IMAGE_GRAYSCALE);
Mat img2 = imread(argv[2], CV_LOAD_IMAGE_GRAYSCALE);
if(img1.empty() || img2.empty())
{
printf("Can't read one of the images\n");
return -1;
}
// detecting keypoints
SurfFeatureDetector detector(400);
vector<KeyPoint> keypoints1, keypoints2;
detector.detect(img1, keypoints1);
detector.detect(img2, keypoints2);
// computing descriptors
SurfDescriptorExtractor extractor;
Mat descriptors1, descriptors2;
extractor.compute(img1, keypoints1, descriptors1);
extractor.compute(img2, keypoints2, descriptors2);
// matching descriptors
BruteForceMatcher<L2<float> > matcher;
vector<DMatch> matches;
matcher.match(descriptors1, descriptors2, matches);
// drawing the results
namedWindow("matches", 1);
Mat img_matches;
drawMatches(img1, keypoints1, img2, keypoints2, matches, img_matches);
imshow("matches", img_matches);
waitKey(0);
|
[
"dylanzingler@gmail.com"
] |
dylanzingler@gmail.com
|
4e0e6bde863706f7f52788aa781270226d9c8c08
|
70898884dda5659a93f544c0bea4a18fcd05f444
|
/OBJECT ORIENTED C++/Workshop6/athome/w6_p2.cpp
|
af647eaede7d2398f555f28d29e19805d6fe726b
|
[] |
no_license
|
pmahida1/BTP305
|
4d7acd3e3bd60f3cf978906d623b941468d1037c
|
1c49b6ebda5a67619e715b922b440d916a39691e
|
refs/heads/master
| 2023-03-04T01:47:13.209270
| 2021-01-22T01:13:48
| 2021-01-22T01:13:48
| 331,798,276
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 3,330
|
cpp
|
// Name: Parth Mahida
// Seneca Student ID: 140 172 180
// Seneca email: pmahida1@myseneca.ca
// Date of completion: November 2nd, 2020
//
// I confirm that I am the only author of this file
// and the content was created entirely by me.
#include <iostream>
#include <iomanip>
#include <fstream>
#include "Autoshop.h"
#include "Autoshop.h"
#include "Utilities.h"
#include "Utilities.h"
#include "Autoshop.h"
void loadData(const char* filename, sdds::Autoshop& as)
{
std::ifstream file(filename);
if (!file)
{
std::cerr << "ERROR: Cannot open file [" << filename << "].\n";
return;
}
while (file)
{
// TODO: This code can throw errors to signal that something went wrong while
// extracting data. Write code to catch and handle the following errors:
// - the type of vehicle is not recognized: the first non-empty character
// on the line is not 'c', 'C', 'r', or 'R'. In this case print
// "Unrecognized record type: [TAG]<endl>"
// - one of the fields in the record contains invalid data. In this case print
// "Invalid record!<endl>"
try {
sdds::Vehicle* aVehicle = sdds::createInstance(file);
if (aVehicle)
as += aVehicle;
}
catch (char dummy) {
std::cout << "Unrecognized record type: [" << dummy << "]" << std::endl;
}
catch (const char* msg) {
std::wcout << msg << std::endl;
}
}
}
// ws dataClean.txt dataMessy.txt
int main(int argc, char** argv)
{
std::cout << "Command Line:\n";
std::cout << "--------------------------\n";
for (int i = 0; i < argc; i++)
std::cout << std::setw(3) << i + 1 << ": " << argv[i] << '\n';
std::cout << "--------------------------\n\n";
sdds::Autoshop as;
loadData(argv[1], as);
as.display(std::cout);
std::cout << "\n";
loadData(argv[2], as);
as.display(std::cout);
std::cout << std::endl;
std::list<const sdds::Vehicle*> vehicles;
{
// TODO: Create a lambda expression that receives as parameter `const sdds::Vehicle*`
// and returns true if the vehicle has a top speed >300km/h
auto fastVehicles = [](const sdds::Vehicle* v)->bool
{
bool flag = false;
if (v->topSpeed() > 300.00)
flag = true;
return flag;
};
as.select(fastVehicles, vehicles);
std::cout << "--------------------------------\n";
std::cout << "| Fast Vehicles |\n";
std::cout << "--------------------------------\n";
for (auto it = vehicles.begin(); it != vehicles.end(); ++it)
{
(*it)->display(std::cout);
std::cout << std::endl;
}
std::cout << "--------------------------------\n";
}
vehicles.clear();
std::cout << std::endl;
{
// TODO: Create a lambda expression that receives as parameter `const sdds::Vehicle*`
// and returns true if the vehicle is broken and needs repairs.
auto brokenVehicles = [](const sdds::Vehicle* v)->bool
{
bool flag = false;
if (v->condition() == "broken")
flag = true;
return flag;
};
as.select(brokenVehicles, vehicles);
std::cout << "--------------------------------\n";
std::cout << "| Vehicles in need of repair |\n";
std::cout << "--------------------------------\n";
for (const auto vehicle : vehicles)
{
vehicle->display(std::cout);
std::cout << std::endl;
}
std::cout << "--------------------------------\n";
}
return 0;
}
|
[
"mahida.parth566@gmail.com"
] |
mahida.parth566@gmail.com
|
b951ba69315ebf7e0aebb5faf715c64fab0418e1
|
d0fb46aecc3b69983e7f6244331a81dff42d9595
|
/sgw/include/alibabacloud/sgw/model/ValidateGatewayNameResult.h
|
6feae7dd819a37d43ac9d81028c0043e7f1ee8db
|
[
"Apache-2.0"
] |
permissive
|
aliyun/aliyun-openapi-cpp-sdk
|
3d8d051d44ad00753a429817dd03957614c0c66a
|
e862bd03c844bcb7ccaa90571bceaa2802c7f135
|
refs/heads/master
| 2023-08-29T11:54:00.525102
| 2023-08-29T03:32:48
| 2023-08-29T03:32:48
| 115,379,460
| 104
| 82
|
NOASSERTION
| 2023-09-14T06:13:33
| 2017-12-26T02:53:27
|
C++
|
UTF-8
|
C++
| false
| false
| 1,549
|
h
|
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef ALIBABACLOUD_SGW_MODEL_VALIDATEGATEWAYNAMERESULT_H_
#define ALIBABACLOUD_SGW_MODEL_VALIDATEGATEWAYNAMERESULT_H_
#include <string>
#include <vector>
#include <utility>
#include <alibabacloud/core/ServiceResult.h>
#include <alibabacloud/sgw/SgwExport.h>
namespace AlibabaCloud
{
namespace Sgw
{
namespace Model
{
class ALIBABACLOUD_SGW_EXPORT ValidateGatewayNameResult : public ServiceResult
{
public:
ValidateGatewayNameResult();
explicit ValidateGatewayNameResult(const std::string &payload);
~ValidateGatewayNameResult();
std::string getMessage()const;
std::string getCode()const;
bool getSuccess()const;
bool getIsValid()const;
protected:
void parse(const std::string &payload);
private:
std::string message_;
std::string code_;
bool success_;
bool isValid_;
};
}
}
}
#endif // !ALIBABACLOUD_SGW_MODEL_VALIDATEGATEWAYNAMERESULT_H_
|
[
"sdk-team@alibabacloud.com"
] |
sdk-team@alibabacloud.com
|
2e254bd05999b6ff939e467dc8b4babc3fbecefc
|
794a247a36094589a6ea55d7cad91b7aa9de0660
|
/algo/sorting/selectionsort/selectionsort.h
|
86c72434713cc2846c407b9b3c941598ad3d7995
|
[] |
no_license
|
sunilrpandey/dsalgo
|
e3d3d3107971cfaf1aa4eb2ac09c255f86433922
|
047402c388e160b374a07d400f7631255bd65867
|
refs/heads/master
| 2021-07-03T08:11:21.318673
| 2020-09-28T17:47:21
| 2020-09-28T17:47:21
| 179,428,722
| 1
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 337
|
h
|
#pragma once
#include <iostream>
namespace algos
{
void Selectionsort (int * arr, int sz)
{
for(int i = 0; i < sz-1; i++) {
int min_index = i;
for(int j = i + 1; j < sz; j++) {
if(arr[j] < arr[min_index]) {
min_index = j;
}
}
if(min_index != i)
std::swap(arr[i],arr[min_index]);
}
}
};
|
[
"inkingmind@gmail.com"
] |
inkingmind@gmail.com
|
081133ced64d6faf1560f06ee4e9e094340b512e
|
327a0fd1d791a2d928200d9e1e29a68937e9f031
|
/redist/deps/fmstream/fmstream.h
|
addcc6d8b959590d7b45ac01304f3eba93ca68d4
|
[
"Zlib",
"BSD-3-Clause",
"MIT"
] |
permissive
|
Meowhax/apathy
|
aa29254a07b583c90c5d09d53cd5451232844ae4
|
5273e14f29e3705f09df48cb813e4ec6e3a4e619
|
refs/heads/master
| 2020-04-13T17:44:09.443385
| 2015-06-12T17:42:17
| 2015-06-13T09:42:01
| 43,214,773
| 1
| 0
| null | 2015-09-26T17:12:17
| 2015-09-26T17:12:17
| null |
UTF-8
|
C++
| false
| false
| 29,221
|
h
|
/*
* Copyright (c) 2013, Benichou Software
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the author nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE AUTHOR 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.
*
* Purpose: Provide read-write access to memory-mapped files on Windows and POSIX systems.
*
* $Id: fmstream.h 4 2013-09-24 14:03:10Z benichou $
*/
#ifndef FILE_MAPPING_STREAM_H_
#define FILE_MAPPING_STREAM_H_
#include <istream>
/**
* At this time, move constructor and move assignment for streams are only implements in Microsoft Visual Studio 2010 and Intel C++ Compiler 12
*/
#if ((__cplusplus > 199711L) || (_HAS_CPP0X > 0)) && ((_MSC_VER >= 1600) || (__INTEL_COMPILER >= 1200))
#define _HAS_CPP11_ 1
#endif
/**
* File mapping utility class.
*/
class filemapping
{
public:
/**
* Get memory offset granularity.
* Return the offset granularity of the system.
* @return Return the offset granularity of the system.
* @see filemappingbuf::open()
* @see ifmstream::open()
* @see fmstream::open()
*/
static std::streamoff offset_granularity();
};
/**
* File mapping stream buffer.
* This class applies the functionality of the std::streambuf class to read and write from/to memory-mapped files.
* By calling member open, a physical file is associated to the file buffer as its associated character sequence.
* Depending on the mode used in this operation, the access to the controlled input sequence or the controlled output sequence may be restricted.
* The state of the filemappingbuf object -i.e. whether a file is open or not- may be tested by calling member function is_open.
* Internally, filemappingbuf objects operate as defined in the std::streambuf class.
* The class overrides some virtual members inherited from streambuf to provide a specific functionality for memory-mapped files.
*/
class filemappingbuf : public std::streambuf
{
public:
/**
* Construct object.
* A filemappingbuf object is constructed, initializing all its pointers to null pointers and initializing the object's locale.
*/
filemappingbuf();
/**
* Destructs the filemappingbuf object.
*/
virtual ~filemappingbuf();
#ifdef _HAS_CPP11_
/** @name C++11
* The following methods requires some features introduced by the latest revision of the C++ standard (2011). Older compilers may not support it.
*/
///@{
/**
* Move constructor (requires C++11).
* Acquires the contents of rhs_buf, by move-assigning its members and base classes.
* @param rhs_buf filemappingbuf to move. rhs_buf becomes of invalid state after the operation.
* @see swap()
* @see operator=()
*/
filemappingbuf(filemappingbuf&& rhs_buf);
/**
* Move assignment (requires C++11).
* Closes the source filemappingbuf (as if member close was called), and then acquires the contents of rhs_buf.
* @param rhs_buf filemappingbuf to move. rhs_buf becomes of invalid state after the operation.
* @return *this.
* @see swap()
*/
filemappingbuf& operator=(filemappingbuf&& rhs_buf);
/**
* Swap internals (requires C++11).
* Exchanges the state of the filemappingbuf with those of other.
* @param buf filemappingbuf to exchange the state with.
* @see operator=()
*/
void swap(filemappingbuf& buf);
///@}
#endif // _HAS_CPP11_
/**
* Check if a file is open.
* The function returns true if a previous call to open succeeded and there have been no calls to the member close since,
* meaning that the filemappingbuf object is currently associated with a file.
* @return true if a file is open, i.e. associated to this stream buffer object. false otherwise.
* @see open()
* @see close()
*/
bool is_open() const;
/**
* Open file.
* Opens a file, associating its content with the stream buffer object to perform input/output operations on it.
* The operations allowed and some operating details depend on parameter mode.
* If the object already has a file associated (open), this function fails.
* If the i/o mode is input only and the file do not exist, this function fails.
* If the i/o mode is output and the file do not exist, the file is created with the 'offset + max_length' size.
* If the size of the opened file is less than 'offset + max_length', the file growing.
* If the size of the opened file is greater than max_length, the file is not truncated.
* An attempt to map a file with a length of 0 fails.
* @param path_name C-string contains the name of the file to be opened.
* @param mode Flags describing the requested i/o mode for the file. This is an object of type std::ios_base::openmode.
* It consists of a combination of the following member constants:
* - std::ios_base::ate (at end) Set the stream's position indicator to the end of the file on opening.
* - std::ios_base::in (input) Allow input operations on the stream.
* - std::ios_base::out (output) Allow output operations on the stream.
* @param max_length Maximum length of the file mapping. If this parameter is 0, the mapping extends from the specified offset to the end of the file.
* @param offset File offset where the mapping begins. They must also match the memory allocation granularity of the system.
* That is, the offset must be a multiple of the allocation granularity. To obtain the offset granularity of the system, use filemapping::offset_granularity().
* @return The function returns this if successful. In case of failure, close is called and a null pointer is returned.
* @see is_open()
* @see close()
* @see filemapping::offset_granularity()
*/
filemappingbuf* open(const char* path_name, std::ios_base::openmode mode, std::streamsize max_length = 0, std::streamoff offset = 0);
/**
* Close file.
* Closes the file currently associated with the object and disassociates it.
* The function fails if no file is currently open (associated) with this object.
* @return In case of success, the function returns this. In case of failure, a null pointer is returned.
* @see open()
* @see is_open()
*/
filemappingbuf* close();
/**
* Set internal position pointer to absolute position.
* Calls protected virtual member seekptr, which sets a new position value for one or both of the internal position pointers.
* The parameter which determines which of the position pointers is affected: either the get pointer or the put pointer, or both.
* The function fails if no file is currently open (associated) with this object.
* @param ptr New absolute position for the position pointer.
* @param which Determines which of the internal position pointers shall be modified: the input pointer, the output pointer, or both. This is an object of type std::ios_base::openmode.
* @return In case of success, return the new position value of the modified position pointer. In case of failure, a null pointer is returned.
* @see std::streambuf::pubseekpos()
* @see std::streambuf::pubseekoff()
*/
void* pubseekptr(void* ptr, std::ios_base::openmode which = std::ios_base::in | std::ios_base::out);
/**
* Get the read-only base address of the mapping.
* The function fails if no file is currently open (associated) with this object.
* @return In case of success, returns the constant base address of the mapping. In case of failure, a null pointer is returned.
* @see size()
*/
const void* data() const;
/**
* Get the base address of the mapping.
* The function fails if no file is currently open (associated) with this object.
* @return In case of success, returns the base address of the mapping. In case of failure, a null pointer is returned.
* @see size()
*/
void* data();
/**
* Get the maximum byte length of the mapping.
* The function fails if no file is currently open (associated) with this object.
* @return In case of success, returns the length of the mapping. In case of failure, 0 is returned.
* @see data()
*/
std::streamsize size() const;
protected:
virtual int sync();
virtual std::streampos seekoff(std::streamoff off, std::ios_base::seekdir way, std::ios_base::openmode which);
virtual std::streampos seekpos(std::streampos sp, std::ios_base::openmode which);
virtual void* seekptr(void* ptr, std::ios_base::openmode which);
private:
/**
* Copy constructor is private: this class is not copyable.
*/
filemappingbuf(const filemappingbuf&);
/**
* Copy operator is private: this class is not copyable.
*/
filemappingbuf& operator=(const filemappingbuf&);
private:
char* m_pAddress; //!< Base address of the mapping
std::streamsize m_MapLength; //!< Length of the mapping
#ifdef _WIN32
void* m_pFile; //!< Windows handle to the file mapping object
void* m_pFileMapping; //!< Windows handle to the opened file
#else // If not Windows, this is a POSIX system !
int m_fd; //!< File descriptor to the opened file
#endif
};
/**
* ifmstream provides an interface to read data from memory-mapped files as input streams.
* The objects of this class maintain internally a pointer to a filemappingbuf object that can be obtained by calling member rdbuf.
* The file to be associated with the stream can be specified either as a parameter in the constructor or by calling member open.
* After all necessary operations on a file have been performed, it can be closed (or disassociated) by calling member close. Once closed, the same file stream object may be used to open another file.
* The member function is_open can be used to determine whether the stream object is currently associated with a file.
* ifmstream can be used in place of std::ifstream.
*/
class ifmstream : public std::istream
{
public:
/**
* Construct object.
* Constructs an object of the ifstream class.
* This implies the initialization of the associated filemappingbuf object and the call to the constructor of its base class with the filemappingbuf object as parameter.
*/
ifmstream();
/**
* Construct object and open a file.
* Constructs an object of the ifstream class.
* This implies the initialization of the associated filemappingbuf object and the call to the constructor of its base class with the filemappingbuf object as parameter.
* The stream is associated with a physical file as if a call to the member function open with the same parameters was made.
* If the constructor is not successful in opening the file, the object is still created although no file is associated to the stream buffer and the stream's failbit is set (which can be checked with inherited member fail).
* @param path_name C-string contains the name of the file to be opened.
* @param max_length Maximum length of the file mapping. If this parameter are 0, the maximum length of the file mapping object is equal to the current size of the file.
* @param offset File offset where the mapping begins. They must also match the memory allocation granularity of the system.
* That is, the offset must be a multiple of the allocation granularity. To obtain the offset granularity of the system, use filemapping::offset_granularity().
* @see open()
* @see is_open()
* @see close()
* @see filemapping::offset_granularity()
*/
explicit ifmstream(const char* path_name, std::streamsize max_length = 0, std::streamoff offset = 0);
/**
* Destructs the ifmstream object.
*/
virtual ~ifmstream() {}
#ifdef _HAS_CPP11_
/** @name C++11
* The following methods requires some features introduced by the latest revision of the C++ standard (2011). Older compilers may not support it.
*/
///@{
/**
* Move constructor (requires C++11).
* Acquires the contents of rhs_stream, by move-assigning its members and base classes.
* @param rhs_stream File stream to move. rhs_stream becomes of invalid state after the operation.
* @see swap()
* @see operator=()
*/
ifmstream(ifmstream&& rhs_stream);
/**
* Move assignment (requires C++11).
* Closes the source stream (as if member close was called), and then acquires the contents of rhs_stream.
* @param rhs_stream File stream to move. rhs_stream becomes of invalid state after the operation.
* @return *this.
* @see swap()
*/
ifmstream& operator=(ifmstream&& rhs_stream);
/**
* Swap internals (requires C++11).
* Exchanges the state of the stream with those of other.
* @param stream ifmstream to exchange the state with.
* @see operator=()
*/
void swap(ifmstream& stream);
///@}
#endif // _HAS_CPP11_
/**
* Get the associated filemappingbuf object.
* Returns a pointer to the filemappingbuf object associated with the stream.
* @return A pointer to the filemappingbuf object associated with the stream.
* Notice that for any successfully constructed ifmstream object this pointer is never a null pointer, even if no files have been opened or if the stream is unbuffered.
*/
filemappingbuf* rdbuf() const;
/**
* Check if a file is open.
* Returns true if the stream is currently associated with a file, and false otherwise.
* The stream is associated with a file if either a previous call to member open succeeded or if the object was successfully constructed using the parameterized constructor, and close has not been called since.
* @return true if a file is open, i.e. associated to this stream object. false otherwise.
* @see open()
* @see close()
*/
bool is_open() const;
/**
* Open file.
* Opens a file whose name is path_name, associating its content with the stream object to perform input/output operations on it.
* The operations allowed and some operating details depend on parameter mode.
* If the object already has a file associated (open), this function fails.
* If the file do not exist, this function fails.
* An attempt to map a file with a length of 0 fails.
* On failure, the failbit flag is set (which can be checked with member fail), and depending on the value set with exceptions an exception may be thrown.
* @param path_name C-string contains the name of the file to be opened.
* @param max_length Maximum length of the file mapping. If this parameter are 0, the maximum length of the file mapping object is equal to the current size of the file.
* @param offset File offset where the mapping begins. They must also match the memory allocation granularity of the system.
* That is, the offset must be a multiple of the allocation granularity. To obtain the offset granularity of the system, use filemapping::offset_granularity().
* @see is_open()
* @see close()
* @see filemapping::offset_granularity()
*/
void open(const char* path_name, std::streamsize max_length = 0, std::streamoff offset = 0);
/**
* Close file.
* Closes the file currently associated with the object and disassociates it.
* The function fails if no file is currently open (associated) with this object.
* On failure, the failbit flag is set (which can be checked with member fail), and depending on the value set with exceptions an exception may be thrown.
* @see open()
* @see is_open()
*/
void close();
/**
* Get position of the get pointer.
* The get pointer determines the next location in the input sequence to be read by the next input operation.
* The function fails if no file is currently open (associated) with this object.
* @return Return the address of the get pointer. In case of failure, a null pointer is returned.
* @see pseekg()
* @see std::istream::tellg()
*/
const void* ptellg();
/**
* Sets the position of the get pointer.
* The get pointer determines the next location to be read in the source associated to the stream.
* The function fails if no file is currently open (associated) with this object.
* On failure, the failbit flag is set (which can be checked with member fail), and depending on the value set with exceptions an exception may be thrown.
* @param ptr New absolute position for the input pointer.
* @return The function returns *this.
* @see ptellg()
* @see std::istream::seekg()
*/
std::istream& pseekg(const void* ptr);
/**
* Get the read-only base address of the mapping.
* The function fails if no file is currently open (associated) with this object.
* @return In case of success, returns the constant base address of the mapping. In case of failure, a null pointer is returned.
* @see size()
*/
const void* data() const;
/**
* Get the maximum byte length of the mapping.
* The function fails if no file is currently open (associated) with this object.
* @return In case of success, returns the length of the mapping. In case of failure, 0 is returned.
* @see data()
*/
std::streamsize size() const;
private:
/**
* Copy constructor is private: this class is not copyable.
*/
ifmstream(const ifmstream&);
/**
* Copy operator is private: this class is not copyable.
*/
ifmstream& operator=(const ifmstream&);
private:
filemappingbuf m_rdbuf; //!< filemappingbuf object
};
/**
* fmstream provides an interface to read/write data from/to memory-mapped files as input/output streams.
* The objects of this class maintain internally a pointer to a filemappingbuf object that can be obtained by calling member rdbuf.
* The file to be associated with the stream can be specified either as a parameter in the constructor or by calling member open.
* After all necessary operations on a file have been performed, it can be closed (or disassociated) by calling member close.
* Once closed, the same file stream object may be used to open another file.
* The member function is_open can be used to determine whether the stream object is currently associated with a file.
* fmstream can be used in place of std::fstream.
*/
class fmstream : public std::iostream
{
public:
/**
* Construct object.
* Constructs an object of the fstream class.
* This implies the initialization of the associated filemappingbuf object and the call to the constructor of its base class with the filemappingbuf object as parameter.
*/
fmstream();
/**
* Construct object and open or create a file.
* Constructs an object of the fstream class.
* This implies the initialization of the associated filemappingbuf object and the call to the constructor of its base class with the filemappingbuf object as parameter.
* The stream is associated with a physical file as if a call to the member function open with the same parameters was made.
* If the constructor is not successful in opening the file, the object is still created although no file is associated to the stream buffer and the stream's failbit is set (which can be checked with inherited member fail).
* @param path_name C-string contains the name of the file to be opened or created.
* @param max_length Maximum length of the file mapping. If this parameter are 0, the maximum length of the file mapping object is equal to the current size of the file.
* @param offset File offset where the mapping begins. They must also match the memory allocation granularity of the system.
* That is, the offset must be a multiple of the allocation granularity. To obtain the offset granularity of the system, use filemapping::offset_granularity().
* @see open()
* @see is_open()
* @see close()
* @see filemapping::offset_granularity()
*/
explicit fmstream(const char* path_name, std::streamsize max_length = 0, std::streamoff offset = 0);
/**
* Destructs the fmstream object.
*/
virtual ~fmstream() {}
#ifdef _HAS_CPP11_
/** @name C++11
* The following methods requires some features introduced by the latest revision of the C++ standard (2011). Older compilers may not support it.
*/
///@{
/**
* Move constructor (requires C++11).
* Acquires the contents of rhs_stream, by move-assigning its members and base classes.
* @param rhs_stream File stream to move. rhs_stream becomes of invalid state after the operation.
* @see swap()
* @see operator=()
*/
fmstream(fmstream&& rhs_stream);
/**
* Move assignment (requires C++11).
* Closes the source stream (as if member close was called), and then acquires the contents of rhs_stream.
* @param rhs_stream File stream to move. rhs_stream becomes of invalid state after the operation.
* @return *this.
* @see swap()
*/
fmstream& operator=(fmstream&& rhs_stream);
/**
* Swap internals (requires C++11).
* Exchanges the state of the stream with those of other.
* @param stream fmstream to exchange the state with.
* @see operator=()
*/
void swap(fmstream& stream);
///@}
#endif // _HAS_CPP11_
/**
* Get the associated filemappingbuf object.
* Returns a pointer to the filemappingbuf object associated with the stream.
* @return A pointer to the filemappingbuf object associated with the stream.
* Notice that for any successfully constructed fmstream object this pointer is never a null pointer, even if no files have been opened or if the stream is unbuffered.
*/
filemappingbuf* rdbuf() const;
/**
* Check if a file is open.
* Returns true if the stream is currently associated with a file, and false otherwise.
* The stream is associated with a file if either a previous call to member open succeeded or if the object was successfully constructed using the parameterized constructor, and close has not been called since.
* @return true if a file is open, i.e. associated to this stream object. false otherwise.
* @see open()
* @see close()
*/
bool is_open() const;
/**
* Open file.
* Opens a file whose name is path_name, associating its content with the stream object to perform input/output operations on it.
* The operations allowed and some operating details depend on parameter mode.
* If the object already has a file associated (open), this function fails.
* If the file do not exist, the file is created with the 'offset + max_length' size.
* If the size of the opened file is less than 'offset + max_length', the file growing.
* If the size of the opened file is greater than 'offset + max_length', the file is not truncated.
* An attempt to map a file with a length of 0 fails.
* On failure, the failbit flag is set (which can be checked with member fail), and depending on the value set with exceptions an exception may be thrown.
* @param path_name C-string contains the name of the file to be opened.
* @param max_length Maximum length of the file mapping. If this parameter are 0, the maximum length of the file mapping object is equal to the current size of the file.
* @param offset File offset where the mapping begins. They must also match the memory allocation granularity of the system.
* That is, the offset must be a multiple of the allocation granularity. To obtain the offset granularity of the system, use filemapping::offset_granularity().
* @see is_open()
* @see close()
* @see filemapping::offset_granularity()
*/
void open(const char* path_name, std::streamsize max_length = 0, std::streamoff offset = 0);
/**
* Close file.
* Closes the file currently associated with the object and disassociates it.
* The function fails if no file is currently open (associated) with this object.
* On failure, the failbit flag is set (which can be checked with member fail), and depending on the value set with exceptions an exception may be thrown.
* @see open()
* @see is_open()
*/
void close();
/**
* Get position of the get pointer.
* The get pointer determines the next location in the input sequence to be read by the next input operation.
* The function fails if no file is currently open (associated) with this object.
* @return Return the address of the get pointer. In case of failure, a null pointer is returned.
* @see ptellp()
* @see pseekg()
* @see std::istream::tellg()
*/
const void* ptellg();
/**
* Get position of the put pointer.
* The put pointer determines the location in the output sequence where the next output operation is going to take place.
* The function fails if no file is currently open (associated) with this object.
* @return Return the address of the put pointer. In case of failure, a null pointer is returned.
* @see ptellg()
* @see pseekp()
* @see std::istream::tellp()
*/
void* ptellp();
/**
* Sets the position of the get pointer.
* The get pointer determines the next location to be read in the source associated to the stream.
* The function fails if no file is currently open (associated) with this object.
* On failure, the failbit flag is set (which can be checked with member fail), and depending on the value set with exceptions an exception may be thrown.
* @param ptr New absolute position for the input pointer.
* @return The function returns *this.
* @see pseekp()
* @see ptellg()
* @see std::istream::seekg()
*/
std::istream& pseekg(const void* ptr);
/**
* Sets the position of the put pointer.
* The put pointer determines the location in the output sequence where the next output operation is going to take place.
* The function fails if no file is currently open (associated) with this object.
* On failure, the failbit flag is set (which can be checked with member fail), and depending on the value set with exceptions an exception may be thrown.
* @param ptr New absolute position for the output pointer.
* @return The function returns *this.
* @see pseekg()
* @see ptellp()
* @see std::istream::seekp()
*/
std::ostream& pseekp(void* ptr);
/**
* Get the read-only base address of the mapping.
* The function fails if no file is currently open (associated) with this object.
* @return In case of success, returns the constant base address of the mapping. In case of failure, a null pointer is returned.
* @see size()
*/
const void* data() const;
/**
* Get the base address of the mapping.
* The function fails if no file is currently open (associated) with this object.
* @return In case of success, returns the base address of the mapping. In case of failure, a null pointer is returned.
* @see size()
*/
void* data();
/**
* Get the maximum byte length of the mapping.
* The function fails if no file is currently open (associated) with this object.
* @return In case of success, returns the length of the mapping. In case of failure, 0 is returned.
* @see data()
*/
std::streamsize size() const;
private:
/**
* Copy constructor is private: this class is not copyable.
*/
fmstream(const fmstream&);
/**
* Copy operator is private: this class is not copyable.
*/
fmstream& operator=(const fmstream&);
private:
filemappingbuf m_rdbuf; //!< filemappingbuf object
};
#ifdef _HAS_CPP11_
/** @name C++11
* The following methods requires some features introduced by the latest revision of the C++ standard (2011). Older compilers may not support it.
*/
///@{
/**
* Swap two filemappingbuf (requires C++11).
* Overloads the std::swap algorithm for filemappingbuf. Exchanges the state of lhs with that of rhs.
* Effectively calls lhs.swap(rhs).
* @param lhs filemappingbuf to exchange the state with.
* @param rhs filemappingbuf to exchange the state with.
*/
void swap(filemappingbuf& lhs, filemappingbuf& rhs);
/**
* Swap two ifmstream (requires C++11).
* Overloads the std::swap algorithm for ifmstream. Exchanges the state of lhs with that of rhs.
* Effectively calls lhs.swap(rhs).
* @param lhs ifmstream to exchange the state with.
* @param rhs ifmstream to exchange the state with.
*/
void swap(ifmstream& lhs, ifmstream& rhs);
/**
* Swap two fmstream (requires C++11).
* Overloads the std::swap algorithm for fmstream. Exchanges the state of lhs with that of rhs.
* Effectively calls lhs.swap(rhs).
* @param lhs fmstream to exchange the state with.
* @param rhs fmstream to exchange the state with.
*/
void swap(fmstream& lhs, fmstream& rhs);
///@}
#endif // _HAS_CPP11_
#endif /* FILE_MAPPING_STREAM_H_ */
|
[
"r-lyeh"
] |
r-lyeh
|
50f3debc5380d08da1fe1531ee7697be7ac90cd3
|
37867f639363ab2f188028dc158b483b6e6b81f3
|
/Src/AI/LAInteractSO.cpp
|
2fc64e32dd7d9c0849b3168c5b98f66e35e0841b
|
[] |
no_license
|
ailuoxz/BadPrincess-Game
|
704143bcafe1205a2ccdd7dbd68ed284c6fa1d76
|
47caae1a03fdfe8058260e44add25fd8e89f99c3
|
refs/heads/master
| 2021-12-14T15:13:50.974644
| 2017-05-04T16:31:22
| 2017-05-04T16:31:22
| null | 0
| 0
| null | null | null | null |
ISO-8859-1
|
C++
| false
| false
| 12,216
|
cpp
|
#include "LAInteractSO.h"
#include "Server.h"
#include "AI/EntityManager.h"
#include "Logic\Entity\Entity.h"
#include "Logic/Entity/Components/WorkmanState.h"
#include "Logic\UnitMessages.h"
#include "Logic\MovementMessages.h"
#include "Logic\AudioMessages.h"
#include "Logic\SmartObjectMessages.h"
#include "Logic\WorkmanMessages.h"
#include "Logic/RouteCalculationMessages.h"
namespace AI
{
bool CLAInteractSO::acceptN(const std::shared_ptr<NMessage> &message)
{
return (message->type.compare("AvatarMoveToEntity") == 0) || (message->type.compare("SmartDataAction") == 0) || (message->type.compare("ResourceAutoDestroy") == 0) || (message->type.compare("AvatarRouteTo") == 0) || (message->type.compare("AvatarFinishedRoute") == 0);
}
void CLAInteractSO::processN(const std::shared_ptr<NMessage> &message)
{
if(message->type.compare("AvatarMoveToEntity") == 0)
{
// Cuando el usuario indica que la unidad debe mover hacia una nueva smartEntity...
std::shared_ptr<AvatarMoveToEntity> m = std::static_pointer_cast<AvatarMoveToEntity>(message);
// Si la smartEntity no es la que actualmente se está utilizando...
if(stateComponent != nullptr && m->target != stateComponent->getSmartEntity())
{
// Se elimina a la unidad como usuario de la smartEntity que se actualmente se está utilizando.
auto removeMessage = std::make_shared<removeFromWorkmanList>();
removeMessage->sender = _entity;
stateComponent->getSmartEntity()->emitMessageN(removeMessage);
// Se libera la smartPosition que se estaba utilizando.
freeSmartPosition();
// Se almacena que la nueva smartEntity es la que se está utilizando.
stateComponent->setSmartEntity(m->target);
currentTimeGather = 0;
// La acción latente fracasa.
this->abort();
}
}
else if(message->type.compare("SmartDataAction") == 0)
{
// Cuando se recibe la forma de interacción...
std::shared_ptr<SmartDataAction> m = std::static_pointer_cast<SmartDataAction>(message);
// Se apunta el tipo de recurso que se estaba recolectando.
ResourceType lastType = stateComponent->getResourceType();
// Se actualiza la acción a realizar en el stateComponent.
stateComponent->setAction(static_cast<Logic::CWorkmanState::WorkmanAction>(m->actionType));
// Se guarda la animación que corresponde a la acción a realizar.
animation = m->animation;
if(stateComponent->getAction() != Logic::CWorkmanState::storeResource && stateComponent->getAction() != Logic::CWorkmanState::gatherFull)
{
// Se actualiza el tipo de recurso que se va a recolectar en el stateComponent.
switch(stateComponent->getAction())
{
case Logic::CWorkmanState::gatherWood:
stateComponent->setResourceType(ResourceType::Wood);
break;
case Logic::CWorkmanState::gatherIron:
stateComponent->setResourceType(ResourceType::Iron);
break;
case Logic::CWorkmanState::gatherStone:
stateComponent->setResourceType(ResourceType::Stone);
break;
default:
//stateComponent->setResourceType(ResourceType::none);
break;
}
// Si el nuevo tipo de recurso a recolectar es distinto del tipo que ya se estaba recolectando,
// la unidad se deshace de los recursos que estaba cargando.
if(lastType != stateComponent->getResourceType())
{
stateComponent->setCurrentCharge(0);
// Se modifica la velocidad de movimiento por la velocidad por defecto.
auto modidySpeedMessage= std::make_shared<ModifyMaxLinearSpeed>();
modidySpeedMessage->speed = stateComponent->getSpeed();
_entity->emitMessageN(modidySpeedMessage);
}
}
// Se reanuda la acción latente.
this->resume();
}
else if(message->type.compare("ResourceAutoDestroy") == 0)
{
// Cuando la smartEntity que se está utilizando resulta destruida...
//std::cout << "DESTROYED" << std::endl;
std::shared_ptr<ResourceAutoDestroy> m = std::static_pointer_cast<ResourceAutoDestroy>(message);
// Si hay una smartEntity "siguiente", se almacena en el stateComponent de la unidad.
if(stateComponent != nullptr && m->nextItem != nullptr)
{
stateComponent->setSmartEntity(m->nextItem);
stateComponent->setLastResource(m->nextItem);
// Si la unidad estaba recolectando, se aborta la acción latente para que continúe recolectando en el recurso más cercano.
if(stateComponent->getAction() == Logic::CWorkmanState::gatherWood|| stateComponent->getAction() == Logic::CWorkmanState::gatherIron || stateComponent->getAction() == Logic::CWorkmanState::gatherStone)
this->abort();
// Si NO hay una smartEntity "siguiente", se almacena "nullptr".
}else if(stateComponent != nullptr && m->nextItem == nullptr)
{
stateComponent->setSmartEntity(nullptr);
stateComponent->setLastResource(nullptr);
// Si la unidad estaba recolectando, como no existe un recurso cercano,
// la unidad considera que no puede recolectar más.
if(stateComponent->getAction() == Logic::CWorkmanState::gatherWood|| stateComponent->getAction() == Logic::CWorkmanState::gatherIron || stateComponent->getAction() == Logic::CWorkmanState::gatherStone)
{
stateComponent->setAction(Logic::CWorkmanState::gatherFull);
this->resume();
}
}
}
else if (message->type.compare("AvatarRouteTo") == 0)
{
// Cuando la unidad recibe un mensaje de ruta externo...
// Se libera la smartPosition que la unidad estaba utilizando.
freeSmartPosition();
currentTimeGather = 0;
// Se deja de utilizar la smartEntity actual.
stateComponent->setSmartEntity(nullptr);
}else if (message->type.compare("AvatarFinishedRoute") == 0)
{
sendAnimationMessage("Idle");
}
}
CLatentAction::LAStatus CLAInteractSO::OnStart()
{
// Si no se ha recuperado aún el stateComponent de la unidad, entonces se recupera.
if(_entity != nullptr)
{
if(stateComponent == nullptr)
{
Logic::IComponent *iComponent = _entity->getComponent("CWorkmanState");
if(iComponent != nullptr)
stateComponent = static_cast<Logic::CWorkmanState*>(iComponent);
}
}
// La unidad mira hacia la smartEntity.
lookAtSmartObject();
// Se le indica a la smartEntity que la unidad está en la smartPosition, lista para recibir la forma de interacción.
if(stateComponent->getSmartEntity() != nullptr)
{
auto m = std::make_shared<SmartDataAvatarReady>();
m->entity = _entity;
stateComponent->getSmartEntity()->emitMessageN(m);
auto playAudioMessage = std::make_shared<PlayAudio>();
playAudioMessage->eventName = "default";
stateComponent->getSmartEntity()->emitMessageN(playAudioMessage);
}
// se suspende la ejecución de la acción latente a la espera de que la smartEntity envíe la forma de interacción.
return SUSPENDED;
}
CLatentAction::LAStatus CLAInteractSO::OnRun(unsigned int msecs)
{
if(stateComponent->getCurrentCharge() > stateComponent->getGatherMax())
{
// El obrero nunca debe llevar recursos por encima de su carga máxima.
stateComponent->setCurrentCharge(stateComponent->getGatherMax());
}
// Según sea la acción a realizar...
switch (stateComponent->getAction())
{
// Si se trata de recolectar algún tipo de recurso:
case Logic::CWorkmanState::gatherWood:
case Logic::CWorkmanState::gatherIron:
case Logic::CWorkmanState::gatherStone:
{
// Si el recurso fue destruido la acción latente fracasa.
if(stateComponent->getSmartEntity() == nullptr)
this->abort();
// Si la unidad ha llegado a su capacidad máxima de carga, no podrá seguir recolectando.
if(stateComponent->getCurrentCharge() >= stateComponent->getGatherMax())
{
stateComponent->setAction(Logic::CWorkmanState::gatherFull);
currentTimeGather = 0;
auto stopAudioMessage = std::make_shared<StopAudio>();
stateComponent->getSmartEntity()->emitMessageN(stopAudioMessage);
break;
}
// Se activa la animación que concuerda con la forma de interacción del recurso.
sendAnimationMessage(animation);
// Se incrementa el tiempo que la unidad lleva recolectando.
currentTimeGather += stateComponent->getTime();
// Cuando se llega al tiempo que tarda en recolectar la unidad.
if(currentTimeGather >= stateComponent->getGatherTime())
{
if(stateComponent->getCurrentCharge() > 0) // Evita división por cero.
{
// Se modifica la velocidad de movimiento, para reducirla en función de la carga actual.
auto modidySpeedMessage= std::make_shared<ModifyMaxLinearSpeed>();
modidySpeedMessage->speed = stateComponent->getSpeed() - (stateComponent->getSpeed() * 0.07f /* Sacar a MAP!! */ * (stateComponent->getCurrentCharge() / stateComponent->getGatherUnit()));
_entity->emitMessageN(modidySpeedMessage);
}
// Se aumenta la carga actual de la unidad en su stateComponent.
stateComponent->setCurrentCharge(stateComponent->getCurrentCharge() + stateComponent->getGatherUnit());
// Se reinicia la cuenta del tiempo que lleva recolectando.
currentTimeGather = 0; //-= stateComponent->getGatherTime();
// Se le restan recursos a la smartEntity que se está utilizando.
auto m = std::make_shared<GatherMessage>();
m->quantity = stateComponent->getGatherUnit();
stateComponent->getSmartEntity()->emitMessageN(m);
}
break;
}
// Si se trata de almacenar algún tipo de recurso:
case Logic::CWorkmanState::storeResource:
{
// Se libera la smarPosition que se estaba utilizando (la del cofre).
freeSmartPosition();
// Se suman los recursos del tipo recolectado al contador corresponiendte.
AI::ResourceServer::getInstance()->addResource(stateComponent->getResourceType(),stateComponent->getCurrentCharge());
// Se libera a la unidad de su carga, actualizando su stateComponent.
stateComponent->setCurrentCharge(0);
// Se modifica la velocidad de movimiento por la velocidad por defecto.
auto modidySpeedMessage= std::make_shared<ModifyMaxLinearSpeed>();
modidySpeedMessage->speed = stateComponent->getSpeed();
_entity->emitMessageN(modidySpeedMessage);
// Se recupera el último recurso utilizado, para regresar a él.
stateComponent->setSmartEntity(stateComponent->getLastResource());
// La acción latente finaliza con éxito.
return SUCCESS;
break;
}
// Si se ha alcanzado el máximo de capacidad de la unidad.
case Logic::CWorkmanState::gatherFull:
{
// Se libera la smarPosition que se estaba utilizando (la del recurso).
freeSmartPosition();
// Se busca le cofre más cercano.
Logic::CEntity* closestChest = AI::CServer::getSingletonPtr()->getEntityManager()->getClosestEntity(AI::CEntityManager::EntityType::Chest,_entity->getPosition());
// Se apunta cúal ha sido el último recurso (smartEntity) utilizado, para regresar más tarde.
stateComponent->setLastResource(stateComponent->getSmartEntity());
// Se pone como smartEntity en uso el cofre.
stateComponent->setSmartEntity(closestChest);
//La acción latente finaliza con éxito.
return SUCCESS;
break;
}
default:
break;
}
// La acción latente se continúa ejecutando.
return RUNNING;
}
CLatentAction::LAStatus CLAInteractSO::OnAbort()
{
return FAIL;
}
void CLAInteractSO::lookAtSmartObject()
{
auto rotationMessage = std::make_shared<AvatarControl>();
rotationMessage->controlType = "turn";
Vector3 direction = stateComponent->getSmartEntity()->getPosition() - _entity->getPosition();
double rotation = AI::CServer::correctAngle(atan2(-direction.x, -direction.z) - _entity->getYaw());
rotationMessage->attribute = (float) rotation;
_entity->emitMessageN(rotationMessage);
}
void CLAInteractSO::freeSmartPosition()
{
auto freeMessage = std::make_shared<SmartDataFreePosition>();
freeMessage->entity=_entity;
freeMessage->position=stateComponent->getPosition();
if(stateComponent->getSmartEntity() != nullptr)
{
stateComponent->getSmartEntity()->emitMessageN(freeMessage);
}
}
} //namespace AI
|
[
"raycosanchezgarcia@gmail.com"
] |
raycosanchezgarcia@gmail.com
|
98613a386173a0a1614f5851ff00684fa65330ee
|
258b680977ededde8716d026e705999b53257f0b
|
/ActorDemo/Actor1/Date.h
|
dff493170105775f5c10a70183b8e04389c26336
|
[] |
no_license
|
EmiPark/ActorDemo
|
5ee040134daf1d3632d06248823ac082b4609c97
|
410055f2ec8cd8aaf059cadd986cb1cc41b11807
|
refs/heads/master
| 2021-06-26T21:22:04.943570
| 2017-09-17T03:36:12
| 2017-09-17T03:36:12
| 103,265,626
| 1
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 704
|
h
|
#pragma once
#ifndef _DATE_H_
#define _DATE_H_
class Date
{
public:
Date::Date() {};
Date(int y, int m, int d);
int getYear() const
{
return year;
}
int getMonth() const
{
return month;
}
int getDay() const
{
return day;
}
void setYear(int y)
{
year = y;
}
void setMonth(int m)
{
month = m;
}
void setDay(int d)
{
day = d;
}
private:
int year;
int month;
int day;
};
Date::Date(int y, int m, int d)
{
year = y;
month = m;
day = d;
}
bool operator ==(const Date& d1, const Date& d2)
{
return (d1.getYear() == d2.getYear()) && (d1.getMonth() == d2.getMonth()) && (d1.getDay() == d2.getDay());
}
#endif // !_DATE_H_
|
[
"362308457@qq.com"
] |
362308457@qq.com
|
6afa596ab3fab6bcc70f501d007403e55d7583bc
|
5d6c856c7b2ce846f9e78ff4a9faff885d216433
|
/Week-02/1. Primitive/Solutions/Mukesh Kumar (Gcs-1840095)/Solution-02.cpp
|
b6d27aeb2c85426f7c9485e7a17591bbe7ae0e5a
|
[] |
no_license
|
SSDC-SLIET/practice
|
c285f8f6553a0f3a89f7c18d22d722ca06f9ccc1
|
a77259450e4a9455c099265c99e4fd931178a5ce
|
refs/heads/master
| 2021-07-23T20:57:41.702153
| 2020-07-19T15:13:31
| 2020-07-19T15:13:31
| 199,048,826
| 11
| 48
| null | 2019-09-01T13:50:19
| 2019-07-26T16:30:20
|
Python
|
UTF-8
|
C++
| false
| false
| 178
|
cpp
|
int convertFive(int n)
{
if (n == 0)
return 0;
int digit = n % 10;
if (digit == 0)
digit = 5;
return convertFive(n/10)*10 +digit;
}
|
[
"noreply@github.com"
] |
SSDC-SLIET.noreply@github.com
|
5c24def8b3a47376cd9342d14b8f3009e2474cff
|
c9c27f4c1595c5d1d9ad433765be15899afc394f
|
/src/macierzC.cpp
|
528a2eb369c38937518ee8dc5d5c805a4eac7519
|
[] |
no_license
|
filip452/dron
|
a9ae1d12ac84db50305529201b3b52b14a61f465
|
f1f84a8f0b4434e8b7ca21297800891a4bd51161
|
refs/heads/master
| 2022-10-13T14:41:35.193609
| 2020-06-08T09:21:13
| 2020-06-08T09:21:13
| 263,037,454
| 1
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 301
|
cpp
|
#include "macierz.cpp"
template class macierz<double,3>;
template std::istream & operator>>(std::istream & strm,macierz<double,3> & M);
template std::ostream & operator<<(std::ostream & strm, const macierz<double,3> & M);
template macierz<double,3> operator*(double l2,const macierz<double,3> & M);
|
[
"253983@student.pwr.edu.pl"
] |
253983@student.pwr.edu.pl
|
8bb8779e78080001124b2babb5975022cbe25a10
|
c5980a4b6317c499f871fdfd9a40ce030c0c53bc
|
/devel/include/geographic_msgs/UpdateGeographicMapRequest.h
|
b2c16745b198c1d16e3b7b588bdbcd215ff99391
|
[] |
no_license
|
lizhiwei0304/udp_comm
|
28475a66e599375ed54a203f7679ad48842a4201
|
5490e1e84be13a1e98fc7589f56ae8925731d432
|
refs/heads/master
| 2022-11-09T12:05:01.963363
| 2020-06-23T14:59:33
| 2020-06-23T14:59:33
| 274,434,920
| 2
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 10,558
|
h
|
// Generated by gencpp from file geographic_msgs/UpdateGeographicMapRequest.msg
// DO NOT EDIT!
#ifndef GEOGRAPHIC_MSGS_MESSAGE_UPDATEGEOGRAPHICMAPREQUEST_H
#define GEOGRAPHIC_MSGS_MESSAGE_UPDATEGEOGRAPHICMAPREQUEST_H
#include <string>
#include <vector>
#include <map>
#include <ros/types.h>
#include <ros/serialization.h>
#include <ros/builtin_message_traits.h>
#include <ros/message_operations.h>
#include <geographic_msgs/GeographicMapChanges.h>
namespace geographic_msgs
{
template <class ContainerAllocator>
struct UpdateGeographicMapRequest_
{
typedef UpdateGeographicMapRequest_<ContainerAllocator> Type;
UpdateGeographicMapRequest_()
: updates() {
}
UpdateGeographicMapRequest_(const ContainerAllocator& _alloc)
: updates(_alloc) {
(void)_alloc;
}
typedef ::geographic_msgs::GeographicMapChanges_<ContainerAllocator> _updates_type;
_updates_type updates;
typedef boost::shared_ptr< ::geographic_msgs::UpdateGeographicMapRequest_<ContainerAllocator> > Ptr;
typedef boost::shared_ptr< ::geographic_msgs::UpdateGeographicMapRequest_<ContainerAllocator> const> ConstPtr;
}; // struct UpdateGeographicMapRequest_
typedef ::geographic_msgs::UpdateGeographicMapRequest_<std::allocator<void> > UpdateGeographicMapRequest;
typedef boost::shared_ptr< ::geographic_msgs::UpdateGeographicMapRequest > UpdateGeographicMapRequestPtr;
typedef boost::shared_ptr< ::geographic_msgs::UpdateGeographicMapRequest const> UpdateGeographicMapRequestConstPtr;
// constants requiring out of line definition
template<typename ContainerAllocator>
std::ostream& operator<<(std::ostream& s, const ::geographic_msgs::UpdateGeographicMapRequest_<ContainerAllocator> & v)
{
ros::message_operations::Printer< ::geographic_msgs::UpdateGeographicMapRequest_<ContainerAllocator> >::stream(s, "", v);
return s;
}
} // namespace geographic_msgs
namespace ros
{
namespace message_traits
{
// BOOLTRAITS {'IsFixedSize': False, 'IsMessage': True, 'HasHeader': False}
// {'std_msgs': ['/opt/ros/kinetic/share/std_msgs/cmake/../msg'], 'geographic_msgs': ['/home/lizhiwei/Desktop/udp_comm/src/msgs/geographic_msgs/msg'], 'geometry_msgs': ['/opt/ros/kinetic/share/geometry_msgs/cmake/../msg'], 'uuid_msgs': ['/home/lizhiwei/Desktop/udp_comm/src/msgs/uuid_msgs/msg']}
// !!!!!!!!!!! ['__class__', '__delattr__', '__dict__', '__doc__', '__eq__', '__format__', '__getattribute__', '__hash__', '__init__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', '_parsed_fields', 'constants', 'fields', 'full_name', 'has_header', 'header_present', 'names', 'package', 'parsed_fields', 'short_name', 'text', 'types']
template <class ContainerAllocator>
struct IsFixedSize< ::geographic_msgs::UpdateGeographicMapRequest_<ContainerAllocator> >
: FalseType
{ };
template <class ContainerAllocator>
struct IsFixedSize< ::geographic_msgs::UpdateGeographicMapRequest_<ContainerAllocator> const>
: FalseType
{ };
template <class ContainerAllocator>
struct IsMessage< ::geographic_msgs::UpdateGeographicMapRequest_<ContainerAllocator> >
: TrueType
{ };
template <class ContainerAllocator>
struct IsMessage< ::geographic_msgs::UpdateGeographicMapRequest_<ContainerAllocator> const>
: TrueType
{ };
template <class ContainerAllocator>
struct HasHeader< ::geographic_msgs::UpdateGeographicMapRequest_<ContainerAllocator> >
: FalseType
{ };
template <class ContainerAllocator>
struct HasHeader< ::geographic_msgs::UpdateGeographicMapRequest_<ContainerAllocator> const>
: FalseType
{ };
template<class ContainerAllocator>
struct MD5Sum< ::geographic_msgs::UpdateGeographicMapRequest_<ContainerAllocator> >
{
static const char* value()
{
return "8d8da723a1fadc5f7621a18b4e72fc3b";
}
static const char* value(const ::geographic_msgs::UpdateGeographicMapRequest_<ContainerAllocator>&) { return value(); }
static const uint64_t static_value1 = 0x8d8da723a1fadc5fULL;
static const uint64_t static_value2 = 0x7621a18b4e72fc3bULL;
};
template<class ContainerAllocator>
struct DataType< ::geographic_msgs::UpdateGeographicMapRequest_<ContainerAllocator> >
{
static const char* value()
{
return "geographic_msgs/UpdateGeographicMapRequest";
}
static const char* value(const ::geographic_msgs::UpdateGeographicMapRequest_<ContainerAllocator>&) { return value(); }
};
template<class ContainerAllocator>
struct Definition< ::geographic_msgs::UpdateGeographicMapRequest_<ContainerAllocator> >
{
static const char* value()
{
return "\n\
\n\
\n\
GeographicMapChanges updates\n\
\n\
\n\
================================================================================\n\
MSG: geographic_msgs/GeographicMapChanges\n\
# A list of geographic map changes.\n\
\n\
Header header # stamp specifies time of change\n\
# frame_id (normally /map)\n\
\n\
GeographicMap diffs # new and changed points and features\n\
uuid_msgs/UniqueID[] deletes # deleted map components\n\
\n\
================================================================================\n\
MSG: std_msgs/Header\n\
# Standard metadata for higher-level stamped data types.\n\
# This is generally used to communicate timestamped data \n\
# in a particular coordinate frame.\n\
# \n\
# sequence ID: consecutively increasing ID \n\
uint32 seq\n\
#Two-integer timestamp that is expressed as:\n\
# * stamp.sec: seconds (stamp_secs) since epoch (in Python the variable is called 'secs')\n\
# * stamp.nsec: nanoseconds since stamp_secs (in Python the variable is called 'nsecs')\n\
# time-handling sugar is provided by the client library\n\
time stamp\n\
#Frame this data is associated with\n\
# 0: no frame\n\
# 1: global frame\n\
string frame_id\n\
\n\
================================================================================\n\
MSG: geographic_msgs/GeographicMap\n\
# Geographic map for a specified region.\n\
\n\
Header header # stamp specifies time\n\
# frame_id (normally /map)\n\
\n\
uuid_msgs/UniqueID id # identifier for this map\n\
BoundingBox bounds # 2D bounding box containing map\n\
\n\
WayPoint[] points # way-points\n\
MapFeature[] features # map features\n\
KeyValue[] props # map properties\n\
\n\
================================================================================\n\
MSG: uuid_msgs/UniqueID\n\
# A universally unique identifier (UUID).\n\
#\n\
# http://en.wikipedia.org/wiki/Universally_unique_identifier\n\
# http://tools.ietf.org/html/rfc4122.html\n\
\n\
uint8[16] uuid\n\
\n\
================================================================================\n\
MSG: geographic_msgs/BoundingBox\n\
# Geographic map bounding box. \n\
#\n\
# The two GeoPoints denote diagonally opposite corners of the box.\n\
#\n\
# If min_pt.latitude is NaN, the bounding box is \"global\", matching\n\
# any valid latitude, longitude and altitude.\n\
#\n\
# If min_pt.altitude is NaN, the bounding box is two-dimensional and\n\
# matches any altitude within the specified latitude and longitude\n\
# range.\n\
\n\
GeoPoint min_pt # lowest and most Southwestern corner\n\
GeoPoint max_pt # highest and most Northeastern corner\n\
\n\
================================================================================\n\
MSG: geographic_msgs/GeoPoint\n\
# Geographic point, using the WGS 84 reference ellipsoid.\n\
\n\
# Latitude [degrees]. Positive is north of equator; negative is south\n\
# (-90 <= latitude <= +90).\n\
float64 latitude\n\
\n\
# Longitude [degrees]. Positive is east of prime meridian; negative is\n\
# west (-180 <= longitude <= +180). At the poles, latitude is -90 or\n\
# +90, and longitude is irrelevant, but must be in range.\n\
float64 longitude\n\
\n\
# Altitude [m]. Positive is above the WGS 84 ellipsoid (NaN if unspecified).\n\
float64 altitude\n\
\n\
================================================================================\n\
MSG: geographic_msgs/WayPoint\n\
# Way-point element for a geographic map.\n\
\n\
uuid_msgs/UniqueID id # Unique way-point identifier\n\
GeoPoint position # Position relative to WGS 84 ellipsoid\n\
KeyValue[] props # Key/value properties for this point\n\
\n\
================================================================================\n\
MSG: geographic_msgs/KeyValue\n\
# Geographic map tag (key, value) pair\n\
#\n\
# This is equivalent to diagnostic_msgs/KeyValue, repeated here to\n\
# avoid introducing a trivial stack dependency.\n\
\n\
string key # tag label\n\
string value # corresponding value\n\
\n\
================================================================================\n\
MSG: geographic_msgs/MapFeature\n\
# Geographic map feature.\n\
#\n\
# A list of WayPoint IDs for features like streets, highways, hiking\n\
# trails, the outlines of buildings and parking lots in sequential\n\
# order.\n\
#\n\
# Feature lists may also contain other feature lists as members.\n\
\n\
uuid_msgs/UniqueID id # Unique feature identifier\n\
uuid_msgs/UniqueID[] components # Sequence of feature components\n\
KeyValue[] props # Key/value properties for this feature\n\
";
}
static const char* value(const ::geographic_msgs::UpdateGeographicMapRequest_<ContainerAllocator>&) { return value(); }
};
} // namespace message_traits
} // namespace ros
namespace ros
{
namespace serialization
{
template<class ContainerAllocator> struct Serializer< ::geographic_msgs::UpdateGeographicMapRequest_<ContainerAllocator> >
{
template<typename Stream, typename T> inline static void allInOne(Stream& stream, T m)
{
stream.next(m.updates);
}
ROS_DECLARE_ALLINONE_SERIALIZER
}; // struct UpdateGeographicMapRequest_
} // namespace serialization
} // namespace ros
namespace ros
{
namespace message_operations
{
template<class ContainerAllocator>
struct Printer< ::geographic_msgs::UpdateGeographicMapRequest_<ContainerAllocator> >
{
template<typename Stream> static void stream(Stream& s, const std::string& indent, const ::geographic_msgs::UpdateGeographicMapRequest_<ContainerAllocator>& v)
{
s << indent << "updates: ";
s << std::endl;
Printer< ::geographic_msgs::GeographicMapChanges_<ContainerAllocator> >::stream(s, indent + " ", v.updates);
}
};
} // namespace message_operations
} // namespace ros
#endif // GEOGRAPHIC_MSGS_MESSAGE_UPDATEGEOGRAPHICMAPREQUEST_H
|
[
"lizw_0304@163.com"
] |
lizw_0304@163.com
|
6ba184537b57f2eb705eb1a8b1a5c55d32688bc5
|
1c635d3afdd215602001f20c1260e9fee2c0f9f7
|
/CarND-MPC-Project-master/src/main.cpp
|
7188b4c57fec0ef3dbd87f5b392a39d5403d4d15
|
[] |
no_license
|
anilhd2410/SelfDrivingCar-term2
|
ba503e622873d3fd387a03b21a884b45e9aa8222
|
eecd3b926101fc219ec7c544dc5be86f38c86d9e
|
refs/heads/master
| 2021-07-12T19:09:50.685456
| 2017-10-12T21:20:34
| 2017-10-12T21:20:34
| 104,525,860
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 8,206
|
cpp
|
#include <math.h>
#include <uWS/uWS.h>
#include <chrono>
#include <iostream>
#include <thread>
#include <vector>
#include "Eigen-3.3/Eigen/Core"
#include "Eigen-3.3/Eigen/QR"
#include "MPC.h"
#include "json.hpp"
// for convenience
using json = nlohmann::json;
// For converting back and forth between radians and degrees.
constexpr double pi() { return M_PI; }
double deg2rad(double x) { return x * pi() / 180; }
double rad2deg(double x) { return x * 180 / pi(); }
// Checks if the SocketIO event has JSON data.
// If there is data the JSON object in string format will be returned,
// else the empty string "" will be returned.
string hasData(string s) {
auto found_null = s.find("null");
auto b1 = s.find_first_of("[");
auto b2 = s.rfind("}]");
if (found_null != string::npos) {
return "";
} else if (b1 != string::npos && b2 != string::npos) {
return s.substr(b1, b2 - b1 + 2);
}
return "";
}
// Evaluate a polynomial.
double polyeval(Eigen::VectorXd coeffs, double x) {
double result = 0.0;
for (int i = 0; i < coeffs.size(); i++) {
result += coeffs[i] * pow(x, i);
}
return result;
}
// Fit a polynomial.
// Adapted from
// https://github.com/JuliaMath/Polynomials.jl/blob/master/src/Polynomials.jl#L676-L716
Eigen::VectorXd polyfit(Eigen::VectorXd xvals, Eigen::VectorXd yvals,
int order) {
assert(xvals.size() == yvals.size());
assert(order >= 1 && order <= xvals.size() - 1);
Eigen::MatrixXd A(xvals.size(), order + 1);
for (int i = 0; i < xvals.size(); i++) {
A(i, 0) = 1.0;
}
for (int j = 0; j < xvals.size(); j++) {
for (int i = 0; i < order; i++) {
A(j, i + 1) = A(j, i) * xvals(j);
}
}
auto Q = A.householderQr();
auto result = Q.solve(yvals);
return result;
}
int main() {
uWS::Hub h;
// MPC is initialized here!
MPC mpc;
h.onMessage([&mpc](uWS::WebSocket<uWS::SERVER> ws, char *data, size_t length,
uWS::OpCode opCode) {
// "42" at the start of the message means there's a websocket message event.
// The 4 signifies a websocket message
// The 2 signifies a websocket event
string sdata = string(data).substr(0, length);
cout << sdata << endl;
if (sdata.size() > 2 && sdata[0] == '4' && sdata[1] == '2') {
string s = hasData(sdata);
if (s != "") {
auto j = json::parse(s);
string event = j[0].get<string>();
if (event == "telemetry") {
// j[1] is the data JSON object
vector<double> ptsx = j[1]["ptsx"];
vector<double> ptsy = j[1]["ptsy"];
double px = j[1]["x"];
double py = j[1]["y"];
double psi = j[1]["psi"];
double v = j[1]["speed"];
int i = 0;
for( ; i < ptsx.size(); ++i)
{
//shift car reference angle to 90 degrees
double x_shift = ptsx[i] - px; // x coordinate is zero
double y_shift = ptsy[i] - py; // y coordinate is zero
//in order to make the size is zero, rotate all the points, reference system is at zero degrees
//help to polynomial fit, the car is same as orientation line, horizontal line
ptsx[i] = (x_shift * cos(0 - psi) - y_shift * sin(0 - psi));
ptsy[i] = (x_shift * sin(0 - psi) + y_shift * cos(0 - psi));
}
double *ptrx = &ptsx[0];
double *ptry = &ptsy[0];
Eigen::Map<Eigen::VectorXd> ptsx_transform(ptrx, 6);
Eigen::Map<Eigen::VectorXd> ptsy_transform(ptry, 6);
//3rd degree polynomial
auto coeffs = polyfit(ptsx_transform, ptsy_transform, 3);
//calculate the cte
double cte = polyeval(coeffs, 0); //car at(0,0) and angel is zero, 2nd param
//caluculate the epsi
//double epsi = psi - atan(coeffs[1] + 2 * px * coeffs[2] + 3 * coeffs[3] * pow(px, 2))
double epsi = -atan(coeffs[1]); //the difefrenece in r side and path angle
double steer_value = j[1]["steering_angle"];
double throttle_value = j[1]["throttle"];
// Predict vehcile state
double predict_px = v * dt;
double predict_py = 0.0;
double predict_psi = v * -steer_value / Lf * dt;
double predict_v = v + throttle_value * dt;
double predict_cte = cte + v * sin(epsi) * dt;
double predpredict_epsi = epsi + predict_psi;
Eigen::VectorXd state(6);
//x, y, psi, cte, epsi
//state << 0, 0, 0, v, cte, epsi;
state << predict_px, predict_py, predict_psi, predict_v, predict_cte, predpredict_epsi;
/*
* TODO: Calculate steering angle and throttle using MPC.
*
* Both are in between [-1, 1].
*
*/
//coeffs, path to be followed how far away from the path, calculate furure cte and epsi
vector<double> vars = mpc.Solve(state, coeffs);
//Display the waypoints/reference line
vector<double> waypoints_x;
vector<double> waypoints_y;
//visualization of path, connecting way points
double poly_inc = 2.5;
int num_points = 25;
for( i = 1; i < num_points; ++i)
{
waypoints_x.push_back(poly_inc * i);
waypoints_y.push_back(polyeval(coeffs, poly_inc * i));
}
//Display the MPC predicted trajectory
vector<double> mpc_x_vals;
vector<double> mpc_y_vals;
mpc_x_vals.push_back(0);
mpc_y_vals.push_back(0);
for(i = 2; i < vars.size(); ++i )
{
if(i % 2 == 0)
{
mpc_x_vals.push_back(vars[i]); //x
}
else
{
mpc_y_vals.push_back(vars[i]); //y
}
}
json msgJson;
// NOTE: Remember to divide by deg2rad(25) before you send the steering value back.
// Otherwise the values will be in between [-deg2rad(25), deg2rad(25] instead of [-1, 1].
msgJson["steering_angle"] = vars[0] / (deg2rad(25) * Lf);
msgJson["throttle"] = vars[1];
//.. add (x,y) points to list here, points are in reference to the vehicle's coordinate system
// the points in the simulator are connected by a Green line
msgJson["mpc_x"] = mpc_x_vals;
msgJson["mpc_y"] = mpc_y_vals;
//.. add (x,y) points to list here, points are in reference to the vehicle's coordinate system
// the points in the simulator are connected by a Yellow line
msgJson["next_x"] = waypoints_x;
msgJson["next_y"] = waypoints_y;
auto msg = "42[\"steer\"," + msgJson.dump() + "]";
std::cout << msg << std::endl;
// Latency
// The purpose is to mimic real driving conditions where
// the car does actuate the commands instantly.
//
// Feel free to play around with this value but should be to drive
// around the track with 100ms latency.
//
// NOTE: REMEMBER TO SET THIS TO 100 MILLISECONDS BEFORE
// SUBMITTING.
this_thread::sleep_for(chrono::milliseconds(100));
ws.send(msg.data(), msg.length(), uWS::OpCode::TEXT);
}
} else {
// Manual driving
std::string msg = "42[\"manual\",{}]";
ws.send(msg.data(), msg.length(), uWS::OpCode::TEXT);
}
}
});
// We don't need this since we're not using HTTP but if it's removed the
// program
// doesn't compile :-(
h.onHttpRequest([](uWS::HttpResponse *res, uWS::HttpRequest req, char *data,
size_t, size_t) {
const std::string s = "<h1>Hello world!</h1>";
if (req.getUrl().valueLength == 1) {
res->end(s.data(), s.length());
} else {
// i guess this should be done more gracefully?
res->end(nullptr, 0);
}
});
h.onConnection([&h](uWS::WebSocket<uWS::SERVER> ws, uWS::HttpRequest req) {
std::cout << "Connected!!!" << std::endl;
});
h.onDisconnection([&h](uWS::WebSocket<uWS::SERVER> ws, int code,
char *message, size_t length) {
ws.close();
std::cout << "Disconnected" << std::endl;
});
int port = 4567;
if (h.listen(port)) {
std::cout << "Listening to port " << port << std::endl;
} else {
std::cerr << "Failed to listen to port" << std::endl;
return -1;
}
h.run();
}
|
[
"anil.hd2410@gmail.com"
] |
anil.hd2410@gmail.com
|
822db19547b44baa2e05494dc2fbd6eec30d887a
|
5e55f52b4d7c1819a44a6599c6b383afb658d19a
|
/NatsuLib/natCryptography.cpp
|
bd2201e923ef4e80ea335365e2264ca4b9e133b8
|
[] |
no_license
|
akemimadoka/NatsuLib
|
40428d096e5e40d83c33421078871e55d4019871
|
e95ca605c6519220acef3af860bfbc5458f3acb0
|
refs/heads/master
| 2020-04-12T06:38:36.141989
| 2018-11-18T10:02:51
| 2018-11-18T10:02:51
| 61,736,666
| 44
| 2
| null | 2017-03-26T03:01:55
| 2016-06-22T17:02:35
|
C++
|
UTF-8
|
C++
| false
| false
| 16,753
|
cpp
|
#include "stdafx.h"
#include "natCryptography.h"
#include "gzguts.h"
#include <random>
using namespace NatsuLib;
namespace NatsuLib
{
namespace detail_
{
constexpr nuInt Crc32One(const nuInt* crc32Table, nuInt c, nuInt b) noexcept
{
return ((crc32Table[((c ^ b) & 0xff)]) ^ (c >> 8));
}
constexpr nuInt DecryptByte(const nuInt* pKeys) noexcept
{
const auto temp = (pKeys[2] & 0xffff) | 2;
return ((temp * (temp ^ 1)) >> 8) & 0xff;
}
constexpr void UpdateKeys(nuInt* pKeys, const nuInt* crc32Table, nuInt c) noexcept
{
pKeys[0] = Crc32One(crc32Table, pKeys[0], c);
pKeys[1] += pKeys[0] & 0xff;
pKeys[1] = pKeys[1] * 134775813u + 1;
pKeys[2] = Crc32One(crc32Table, pKeys[2], pKeys[1] >> 24);
}
constexpr void InitKeys(ncData password, size_t passwordLength, nuInt* pKeys, const nuInt* crc32Table) noexcept
{
pKeys[0] = 305419896u;
pKeys[1] = 591751049u;
pKeys[2] = 878082192u;
const auto pRead = password;
const auto pEnd = password + passwordLength;
for (const auto item : make_range(pRead, pEnd))
{
UpdateKeys(pKeys, crc32Table, item);
}
}
constexpr nuInt DecodeOne(nuInt* pKeys, const nuInt* crc32Table, nuInt c) noexcept
{
UpdateKeys(pKeys, crc32Table, c ^= DecryptByte(pKeys));
return c;
}
constexpr nuInt EncodeOne(nuInt* pKeys, const nuInt* crc32Table, nuInt c) noexcept
{
const auto t = DecryptByte(pKeys) ^ c;
UpdateKeys(pKeys, crc32Table, c);
return t;
}
// 不检查缓存大小,直接生成,调用者需保证调用时buf的大小不小于PKzipWeakProcessor::HeaderSize
void UncheckedCryptHead(nData buf, nuInt* pKeys, const nuInt* crc32Table, nuInt crcForCrypting) noexcept
{
std::random_device randomDevice;
std::generate_n(buf, PKzipWeakProcessor::HeaderSize - 2, [&]()
{
return static_cast<nByte>(EncodeOne(pKeys, crc32Table, static_cast<nuInt>(randomDevice() & 0xff)));
});
buf[PKzipWeakProcessor::HeaderSize - 2] = static_cast<nByte>(EncodeOne(pKeys, crc32Table, (crcForCrypting >> 16) & 0xff));
buf[PKzipWeakProcessor::HeaderSize - 1] = static_cast<nByte>(EncodeOne(pKeys, crc32Table, (crcForCrypting >> 24) & 0xff));
}
nBool CryptHead(ncData password, size_t passwordLength, nData buf, size_t bufSize, nuInt* pKeys, const nuInt* crc32Table, nuInt crcForCrypting) noexcept
{
if (bufSize < PKzipWeakProcessor::HeaderSize)
{
return false;
}
InitKeys(password, passwordLength, pKeys, crc32Table);
UncheckedCryptHead(buf, pKeys, crc32Table, crcForCrypting);
return true;
}
}
}
ICryptoProcessor::~ICryptoProcessor()
{
}
ICryptoAlgorithm::~ICryptoAlgorithm()
{
}
PKzipWeakProcessor::PKzipWeakProcessor(CryptoType cryptoType)
: m_IsCrypt{ cryptoType == CryptoType::Crypt }
{
}
PKzipWeakProcessor::~PKzipWeakProcessor()
{
}
void PKzipWeakProcessor::InitCipher(ncData password, nLen passwordLength)
{
m_Keys.emplace();
detail_::InitKeys(password, static_cast<size_t>(passwordLength), m_Keys.value().data(), get_crc_table());
}
void PKzipWeakProcessor::InitHeaderFrom(ncData buffer, nLen bufferLength)
{
assert(!m_IsCrypt && "No need to initialize header in crypt mode.");
if (!m_Keys)
{
nat_Throw(natErrException, NatErr_InternalErr, "Keys not initialized."_nv);
}
if (!m_Header)
{
m_Header.emplace();
}
auto& header = m_Header.value();
std::memmove(header.data(), buffer, static_cast<size_t>(bufferLength));
decryptHeader();
}
void PKzipWeakProcessor::InitHeaderFrom(natRefPointer<natStream> const& stream)
{
assert(!m_IsCrypt && "No need to initialize header in crypt mode.");
if (!m_Keys)
{
nat_Throw(natErrException, NatErr_InternalErr, "Keys not initialized."_nv);
}
if (!m_Header)
{
m_Header.emplace();
}
auto& header = m_Header.value();
stream->ReadBytes(header.data(), sizeof header);
decryptHeader();
}
nBool PKzipWeakProcessor::GetHeader(nData buffer, nLen bufferLength)
{
if (!m_IsCrypt || !m_Header || bufferLength < HeaderSize)
{
return false;
}
std::memmove(buffer, m_Header.value().data(), HeaderSize);
m_Header.reset();
return true;
}
nBool PKzipWeakProcessor::CheckHeaderWithCrc32(nuInt crc32) const
{
if (m_IsCrypt)
{
nat_Throw(natErrException, NatErr_IllegalState, "Processor is not in decrypt mode."_nv);
}
if (!m_Header)
{
nat_Throw(natErrException, NatErr_IllegalState, "Header not prepared."_nv);
}
if (!m_Keys)
{
nat_Throw(natErrException, NatErr_IllegalState, "Keys not prepared, header may not be decrypted."_nv);
}
const auto& header = m_Header.value();
return header[HeaderSize - 2] == static_cast<nByte>((crc32 >> 16) & 0xff) && header[HeaderSize - 1] == static_cast<nByte>((crc32 >> 24) & 0xff);
}
void PKzipWeakProcessor::GenerateHeaderWithCrc32(nuInt crc32)
{
if (!m_IsCrypt)
{
nat_Throw(natErrException, NatErr_IllegalState, "Processor is not in crypt mode."_nv);
}
if (!m_Keys)
{
nat_Throw(natErrException, NatErr_IllegalState, "Keys not prepared."_nv);
}
const auto crc32Table = get_crc_table();
m_Header.emplace();
auto& header = m_Header.value();
auto& keys = m_Keys.value();
detail_::UncheckedCryptHead(header.data(), keys.data(), crc32Table, crc32);
}
CryptoType PKzipWeakProcessor::GetCryptoType() const noexcept
{
return m_IsCrypt ? CryptoType::Crypt : CryptoType::Decrypt;
}
nLen PKzipWeakProcessor::GetInputBlockSize() const noexcept
{
return InputBlockSize;
}
nLen PKzipWeakProcessor::GetOutputBlockSize() const noexcept
{
return OutputBlockSize;
}
nBool PKzipWeakProcessor::CanProcessMultiBlocks() const noexcept
{
return true;
}
nBool PKzipWeakProcessor::CanReuseProcessor() const noexcept
{
return true;
}
std::pair<nLen, nLen> PKzipWeakProcessor::Process(ncData inputData, nLen inputDataLength, nData outputData, nLen outputDataLength)
{
if (!m_Keys)
{
nat_Throw(natErrException, NatErr_IllegalState, "Processor has not initialized. (Have you called InitCipher first?)"_nv);
}
if (outputDataLength < inputDataLength)
{
nat_Throw(OutOfRange, "outputData is too small."_nv);
}
uncheckedProcess(inputData, inputDataLength, outputData);
return { inputDataLength, inputDataLength };
}
std::pair<nLen, std::vector<nByte>> PKzipWeakProcessor::ProcessFinal(ncData inputData, nLen inputDataLength)
{
std::vector<nByte> outputBuffer(static_cast<size_t>(inputDataLength));
const auto ret = Process(inputData, inputDataLength, outputBuffer.data(), outputBuffer.size());
m_Keys.reset();
return { ret.first, move(outputBuffer) };
}
void PKzipWeakProcessor::uncheckedProcess(ncData inputData, nLen inputDataLength, nData outputData)
{
assert(m_Keys);
auto keys = m_Keys.value().data();
for (nLen i = 0; i < inputDataLength; ++i)
{
outputData[i] = static_cast<nByte>((m_IsCrypt ? detail_::EncodeOne : detail_::DecodeOne)(keys, get_crc_table(), inputData[i]));
}
}
void PKzipWeakProcessor::decryptHeader()
{
assert(m_Header);
const auto header = m_Header.value().data();
uncheckedProcess(header, HeaderSize, header);
}
natRefPointer<ICryptoProcessor> PKzipWeakAlgorithm::CreateEncryptor()
{
return make_ref<PKzipWeakProcessor>(CryptoType::Crypt);
}
natRefPointer<ICryptoProcessor> PKzipWeakAlgorithm::CreateDecryptor()
{
return make_ref<PKzipWeakProcessor>(CryptoType::Decrypt);
}
natCryptoStream::natCryptoStream(natRefPointer<natStream> stream, natRefPointer<ICryptoProcessor> cryptoProcessor, CryptoStreamMode mode)
: natRefObjImpl{ std::move(stream) },
m_Processor{ std::move(cryptoProcessor) },
m_InputBlockSize{ static_cast<size_t>(m_Processor->GetInputBlockSize()) }, m_OutputBlockSize{ static_cast<size_t>(m_Processor->GetOutputBlockSize()) },
m_IsReadMode{ mode == CryptoStreamMode::Read },
m_InputBufferSize{}, m_OutputBufferSize{},
m_InputBuffer(m_InputBlockSize), m_OutputBuffer(m_OutputBlockSize),
m_FinalBlockProcessed{ false }
{
if (!m_InternalStream)
{
nat_Throw(natErrException, NatErr_InvalidArg, "stream is nullptr."_nv);
}
if (!m_Processor)
{
nat_Throw(natErrException, NatErr_InvalidArg, "cryptoProcessor is nullptr."_nv);
}
if (m_IsReadMode && !m_InternalStream->CanRead())
{
nat_Throw(natErrException, NatErr_InvalidArg, "stream should be readable in read mode."_nv);
}
if (!m_IsReadMode && !m_InternalStream->CanWrite())
{
nat_Throw(natErrException, NatErr_InvalidArg, "stream should be writable in write mode."_nv);
}
}
natCryptoStream::~natCryptoStream()
{
if (!m_FinalBlockProcessed)
{
FlushFinalBlock();
}
}
natRefPointer<ICryptoProcessor> natCryptoStream::GetProcessor() const noexcept
{
return m_Processor;
}
nBool natCryptoStream::CanWrite() const
{
return !m_IsReadMode;
}
nBool natCryptoStream::CanRead() const
{
return m_IsReadMode;
}
nBool natCryptoStream::CanResize() const
{
return false;
}
nBool natCryptoStream::CanSeek() const
{
return false;
}
nLen natCryptoStream::GetSize() const
{
nat_Throw(natErrException, NatErr_NotSupport, "The type of this stream does not support this operation."_nv);
}
void natCryptoStream::SetSize(nLen Size)
{
nat_Throw(natErrException, NatErr_NotSupport, "The type of this stream does not support this operation."_nv);
}
nLen natCryptoStream::GetPosition() const
{
nat_Throw(natErrException, NatErr_NotSupport, "The type of this stream does not support this operation."_nv);
}
void natCryptoStream::SetPosition(NatSeek, nLong)
{
nat_Throw(natErrException, NatErr_NotSupport, "The type of this stream does not support this operation."_nv);
}
nLen natCryptoStream::ReadBytes(nData pData, nLen Length)
{
if (!m_IsReadMode)
{
nat_Throw(natErrException, NatErr_IllegalState, "This stream cannot be read."_nv);
}
auto bytesToRead = static_cast<size_t>(Length);
auto pWrite = pData;
if (m_OutputBufferSize)
{
if (m_OutputBufferSize < bytesToRead)
{
std::memmove(pWrite, m_OutputBuffer.data(), m_OutputBufferSize);
bytesToRead -= m_OutputBufferSize;
pWrite += m_OutputBufferSize;
m_OutputBufferSize = 0;
}
else
{
std::memmove(pWrite, m_OutputBuffer.data(), bytesToRead);
std::memmove(m_OutputBuffer.data(), m_OutputBuffer.data() + bytesToRead, m_OutputBufferSize - bytesToRead);
m_OutputBufferSize -= bytesToRead;
return bytesToRead;
}
}
if (m_FinalBlockProcessed)
{
return Length - bytesToRead;
}
nLen amountRead;
nLen outputBytes;
if (bytesToRead > m_OutputBlockSize)
{
if (m_Processor->CanProcessMultiBlocks())
{
const auto blocksToProcess = bytesToRead / m_OutputBlockSize;
const auto inputSize = static_cast<size_t>(blocksToProcess * m_InputBlockSize);
std::vector<nByte> tmpInputBuffer(inputSize);
std::memmove(tmpInputBuffer.data(), m_InputBuffer.data(), m_InputBufferSize);
amountRead = m_InputBufferSize;
amountRead += m_InternalStream->ReadBytes(tmpInputBuffer.data() + m_InputBufferSize, inputSize - m_InputBufferSize);
m_InputBufferSize = 0;
if (amountRead <= m_InputBlockSize)
{
m_InputBuffer = move(tmpInputBuffer);
m_InputBufferSize = static_cast<size_t>(amountRead);
goto Normal;
}
const auto totalInputSize = amountRead - amountRead % m_InputBlockSize;
const auto ignoredBytes = amountRead - totalInputSize;
if (ignoredBytes)
{
std::memmove(m_InputBuffer.data(), tmpInputBuffer.data() + totalInputSize, static_cast<size_t>(ignoredBytes));
m_InputBufferSize = static_cast<size_t>(ignoredBytes);
}
std::vector<nByte> tmpOutputBuffer(static_cast<size_t>(totalInputSize / m_InputBlockSize * m_OutputBlockSize));
tie(std::ignore, outputBytes) = m_Processor->Process(tmpInputBuffer.data(), totalInputSize, tmpOutputBuffer.data(), tmpOutputBuffer.size());
std::memmove(pWrite, tmpOutputBuffer.data(), static_cast<size_t>(outputBytes));
bytesToRead -= static_cast<size_t>(outputBytes);
pWrite += outputBytes;
}
}
Normal:
while (bytesToRead)
{
while (m_InputBufferSize < m_InputBlockSize)
{
amountRead = m_InternalStream->ReadBytes(m_InputBuffer.data() + m_InputBufferSize, m_InputBlockSize - m_InputBufferSize);
if (!amountRead || m_InternalStream->IsEndOfStream())
{
goto ProcessFinalBlock;
}
m_InputBufferSize += static_cast<size_t>(amountRead);
}
tie(std::ignore, outputBytes) = m_Processor->Process(m_InputBuffer.data(), m_InputBlockSize, m_OutputBuffer.data(), m_OutputBuffer.size());
m_InputBufferSize = 0;
if (bytesToRead >= outputBytes)
{
std::memmove(pWrite, m_OutputBuffer.data(), static_cast<size_t>(outputBytes));
bytesToRead -= static_cast<size_t>(outputBytes);
pWrite += outputBytes;
}
else
{
std::memmove(pWrite, m_OutputBuffer.data(), static_cast<size_t>(bytesToRead));
m_OutputBufferSize -= static_cast<size_t>(outputBytes - bytesToRead);
std::memmove(m_OutputBuffer.data(), m_OutputBuffer.data() + bytesToRead, m_OutputBufferSize);
return Length;
}
}
return Length;
ProcessFinalBlock:
tie(std::ignore, m_OutputBuffer) = m_Processor->ProcessFinal(m_InputBuffer.data(), m_InputBufferSize);
m_OutputBufferSize = m_OutputBuffer.size();
m_FinalBlockProcessed = true;
if (bytesToRead < m_OutputBufferSize)
{
std::memmove(pWrite, m_OutputBuffer.data(), static_cast<size_t>(bytesToRead));
m_OutputBufferSize -= static_cast<size_t>(bytesToRead);
std::memmove(m_OutputBuffer.data(), m_OutputBuffer.data() + bytesToRead, m_OutputBufferSize);
return Length;
}
std::memmove(pWrite, m_OutputBuffer.data(), m_OutputBufferSize);
bytesToRead -= m_OutputBufferSize;
m_OutputBufferSize = 0;
return Length - bytesToRead;
}
nLen natCryptoStream::WriteBytes(ncData pData, nLen Length)
{
assert(!m_InputBufferSize || m_InputBlockSize <= m_InputBufferSize);
if (m_IsReadMode)
{
nat_Throw(natErrException, NatErr_IllegalState, "This stream cannot be written."_nv);
}
auto bytesToWrite = Length;
auto pRead = pData;
if (m_InputBufferSize)
{
if (bytesToWrite > m_InputBlockSize - m_InputBufferSize)
{
const auto needBytes = m_InputBlockSize - m_InputBufferSize;
std::memmove(m_InputBuffer.data() + m_InputBufferSize, pRead, needBytes);
pRead += needBytes;
bytesToWrite -= needBytes;
}
else
{
std::memmove(m_InputBuffer.data() + m_InputBufferSize, pRead, static_cast<size_t>(bytesToWrite));
m_InputBufferSize += static_cast<size_t>(bytesToWrite);
return bytesToWrite;
}
}
nLen writtenBytes = 0, currentWrittenBytes;
if (m_OutputBufferSize)
{
writtenBytes += m_InternalStream->WriteBytes(m_OutputBuffer.data(), m_OutputBufferSize);
m_OutputBufferSize = 0;
}
if (m_InputBlockSize == m_InputBufferSize)
{
tie(std::ignore, currentWrittenBytes) = m_Processor->Process(m_InputBuffer.data(), m_InputBlockSize, m_OutputBuffer.data(), m_OutputBuffer.size());
writtenBytes += m_InternalStream->WriteBytes(m_OutputBuffer.data(), currentWrittenBytes);
m_InputBufferSize = 0;
}
const auto canProcessMultiBlocks = m_Processor->CanProcessMultiBlocks();
while (bytesToWrite)
{
if (bytesToWrite > m_InputBlockSize)
{
if (canProcessMultiBlocks)
{
const auto blocksToProcess = bytesToWrite / m_InputBlockSize;
const auto inputSize = blocksToProcess * m_InputBlockSize;
std::vector<nByte> tmpOutputBuffer(static_cast<size_t>(blocksToProcess * m_OutputBlockSize));
tie(std::ignore, currentWrittenBytes) = m_Processor->Process(pRead, inputSize, tmpOutputBuffer.data(), tmpOutputBuffer.size());
writtenBytes += m_InternalStream->WriteBytes(tmpOutputBuffer.data(), currentWrittenBytes);
pRead += inputSize;
bytesToWrite -= inputSize;
}
else
{
tie(std::ignore, currentWrittenBytes) = m_Processor->Process(pRead, m_InputBlockSize, m_OutputBuffer.data(), m_OutputBuffer.size());
writtenBytes += m_InternalStream->WriteBytes(m_OutputBuffer.data(), currentWrittenBytes);
pRead += m_InputBlockSize;
bytesToWrite -= m_InputBlockSize;
}
}
else
{
std::memmove(m_InputBuffer.data(), pRead, static_cast<size_t>(bytesToWrite));
m_InputBufferSize += static_cast<size_t>(bytesToWrite);
break;
}
}
return writtenBytes;
}
void natCryptoStream::FlushFinalBlock()
{
if (m_FinalBlockProcessed)
{
nat_Throw(natErrException, NatErr_IllegalState, "Final block has been processed."_nv);
}
const auto finalBytes = m_Processor->ProcessFinal(m_InputBuffer.data(), m_InputBufferSize).second;
m_FinalBlockProcessed = true;
if (!m_IsReadMode)
{
if (m_OutputBufferSize)
{
m_InternalStream->WriteBytes(m_OutputBuffer.data(), m_OutputBufferSize);
m_OutputBufferSize = 0;
}
m_InternalStream->WriteBytes(finalBytes.data(), finalBytes.size());
}
const auto innerCryptoStream = m_InternalStream.Cast<natCryptoStream>();
if (innerCryptoStream)
{
if (!innerCryptoStream->m_FinalBlockProcessed)
{
innerCryptoStream->FlushFinalBlock();
}
}
else
{
m_InternalStream->Flush();
}
}
|
[
"jxhzq1996@126.com"
] |
jxhzq1996@126.com
|
ec255a5899402dfc9d56108c7ff551c7664b0e6c
|
78caadec60f3cbcd429d1b745027540ee82b9e99
|
/asearch.cpp
|
2cad9baf36e7cc7ef8ffbfd0ce85fc09ffb0f1f7
|
[] |
no_license
|
ogcraft/asearch
|
7d0a63a8952139bb86e9e717980041592e9d4774
|
59350886281f20fea666c6df5b07037a93a56bd9
|
refs/heads/master
| 2023-01-14T05:59:03.598915
| 2014-02-20T20:26:41
| 2014-02-20T20:26:41
| 314,747,669
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 7,357
|
cpp
|
////////////////////////////
#include <iostream>
#include <vector>
#include <algorithm>
#include <memory>
#include <string> // std::string
#include <bitset> // std::bitset
#include <sndfile.h>
//#include "armadillo"
#include "utils.h"
#include "sigproc.h"
//using namespace arma;
using namespace std;
const char* filters1[] =
{"26752 -4.37515e-07 0.260836",
"23871 -2.44615e-05 0.263986",
"26777 -3.69244e-08 0.267763",
"4635 -1.13672e-05 0.269428",
"2937 5.28804e-09 0.271896",
"27405 -0.000126494 0.272362",
"10782 4.27478e-08 0.272609",
"21033 -6.7912e-07 0.276099",
"27117 8.07178e-06 0.277762",
"27072 2.46044e-05 0.27883",
"24228 4.11255e-07 0.281743",
"23838 0.000228396 0.284479",
"17165 -1.19495e-07 0.286304",
"25263 0.000398279 0.287066",
"20721 7.15095e-07 0.288913",
"8502 -2.78361e-07 0.290424",
"17175 -1.08429e-08 0.292219",
"17811 -3.29527e-08 0.292554",
"27495 -4.47575e-07 0.290119",
"23538 -3.04273e-09 0.294539",
"8205 4.02691e-07 0.293525",
"12177 1.16873e-06 0.293832",
"27051 -0.000902544 0.296453",
"27111 -2.38425e-05 0.297428",
"21779 -1.0669e-07 0.297302",
"14817 -9.52849e-09 0.299",
"27087 1.22163e-05 0.296502",
"27081 -2.8758e-09 0.300112",
"20394 1.28237e-06 0.298693",
"28209 0.000624447 0.29812",
"23533 -2.19406e-06 0.299773",
"23865 -1.28037e-08 0.300777"};
void dump_snd_file_info(const char* fn)
{
SF_INFO sf_info;
SNDFILE* sf = sf_open(fn, SFM_READ, &sf_info) ;
if(!sf)
{
std::cout << "dump_snd_file_info(): Open " << fn << " Error: " << sf_strerror(sf) << std::endl;
return;
}
dump_sf_info(sf_info, fn);
int err = sf_close(sf);
if(err)
{
std::cout << "dump_snd_file_info(): Close Error: " << err << std::endl;
}
}
#if 0
for (;;)
{
// read some data from the file
size_t sz = read_some_source( pPCMBuffer );
if ( sz == 0 )
{
cerr << "ERROR: Insufficient input data!" << endl;
exit(1); // goodbye!
}
// Process to create the fingerprint. If process returns true
// it means he's happy with what he has.
if ( fextr.process( pPCMBuffer, sz
/*, bool: set it to true if it's EOF */ ) )
break;
}
// get the fingerprint data
pair<const char*, size_t> fpData = fextr.getFingerprint();
#endif
int test1(const string& wavfn)
{
printf ("Reading %s...\n", wavfn.c_str());
unsigned int nsamples = 0, freq = 0;
float * samples = wavread(wavfn.c_str(), &nsamples, &freq);
if (!samples) {
printf("Error reading wave file.\n");
return 0;
}
printf("Read %u samples freq: %d\n", nsamples, freq);
printf("Goin prepare %d filters\n", ARRAY_LEN(filters1));
vector<Filter> filters = prepare_filters(filters1, ARRAY_LEN(filters1));
printf("Read %u samples freq: %d\n", nsamples, freq);
unsigned int nbits;
unsigned int* bits = wav2bits(filters, samples, nsamples, freq, &nbits);
free(samples);
string bitfilename(wavfn);
bitfilename.replace(wavfn.find(".wav"), 4,".fpkey");
printf("Writing %d keys to '%s'\n", nbits, bitfilename.c_str());
writebits(bits, nbits, bitfilename.c_str());
#if 0
for (unsigned int i = 0; i < 100 /* nbits */; i++) {
std::bitset<32> b(bits[i]);
std::cout << b << std::endl;
}
#endif
free(bits);
return 0;
}
int main(int argc, char* argv[])
{
int ret = 0;
// std::cout << "Armadillo version: " << arma_version::as_string() << std::endl;
char sndflile_ver [128] ;
sf_command (NULL, SFC_GET_LIB_VERSION, sndflile_ver, sizeof (sndflile_ver)) ;
std::cout << "Sndfile version: " << sndflile_ver << std::endl << std::endl;
if(argc < 2) {
std::cout << "Usage: " << argv[0] << " wav_file_name" << std::endl;
exit(1);
}
const char* wavfile = argv[1];
std::cout << "Running " << argv[0] << " with '" << argv[1] << "'" << std::endl << std::endl;
dump_snd_file_info(wavfile);
return test1(wavfile);
SF_INFO sndinfo;
SNDFILE *sndfile = sf_open(wavfile, SFM_READ, &sndinfo);
if (sndfile == NULL) {
std::cout << "Error reading source file '" << wavfile << "': " << sf_strerror(sndfile) << std::endl;
return 1;
}
int nchannels = sndinfo.channels;
int nframes = sndinfo.frames;
int err = sf_close(sndfile);
if(err)
{
std::cout << "Close Error: " << sf_strerror(sndfile) << std::endl;
return 1;
}
return ret;
}
#if 0
3. Running the Music Identification Server
------------------------------------------
"mrserver boostextdescr.txt db.fdb db.kdb emparams.bin [port]"
26752 -4.37515e-07 0.260836
23871 -2.44615e-05 0.263986
26777 -3.69244e-08 0.267763
4635 -1.13672e-05 0.269428
2937 5.28804e-09 0.271896
27405 -0.000126494 0.272362
10782 4.27478e-08 0.272609
21033 -6.7912e-07 0.276099
27117 8.07178e-06 0.277762
27072 2.46044e-05 0.27883
24228 4.11255e-07 0.281743
23838 0.000228396 0.284479
17165 -1.19495e-07 0.286304
25263 0.000398279 0.287066
20721 7.15095e-07 0.288913
8502 -2.78361e-07 0.290424
17175 -1.08429e-08 0.292219
17811 -3.29527e-08 0.292554
27495 -4.47575e-07 0.290119
23538 -3.04273e-09 0.294539
8205 4.02691e-07 0.293525
12177 1.16873e-06 0.293832
27051 -0.000902544 0.296453
27111 -2.38425e-05 0.297428
21779 -1.0669e-07 0.297302
14817 -9.52849e-09 0.299
27087 1.22163e-05 0.296502
27081 -2.8758e-09 0.300112
20394 1.28237e-06 0.298693
28209 0.000624447 0.29812
23533 -2.19406e-06 0.299773
23865 -1.28037e-08 0.300777
#endif
////////////////////////////////////////
#if 0
int main(int argc, char* argv[])
{
int ret = 0;
std::cout << "Armadillo version: " << arma_version::as_string() << std::endl;
char sndflile_ver [128] ;
sf_command (NULL, SFC_GET_LIB_VERSION, sndflile_ver, sizeof (sndflile_ver)) ;
std::cout << "Sndfile version: " << sndflile_ver << std::endl << std::endl;
if(argc < 2) {
std::cout << "Usage: " << argv[0] << " wav_file_name" << std::endl;
exit(1);
}
const char* wavfile = argv[1];
std::cout << "Running " << argv[0] << " with '" << argv[1] << "'" << std::endl << std::endl;
dump_snd_file_info(wavfile);
SF_INFO sndinfo;
SNDFILE *sndfile = sf_open(wavfile, SFM_READ, &sndinfo);
if (sndfile == NULL) {
std::cout << "Error reading source file '" << wavfile << "': " << sf_strerror(sndfile) << std::endl;
return 1;
}
int nchannels = sndinfo.channels;
#if 0
double buffer [1024] ;
sf_count_t count = sfx_mix_mono_read_double (sndfile, buffer, ARRAY_LEN (buffer));
std::cout << count << " Frames read and mixed to mono " << std::endl;
colvec v(buffer, count);
//std::cout << "v: " << v << std::endl;
v.save("asearch.dat", raw_ascii);
#endif
//sf_seek(sndfile, 50000, SEEK_SET);
int nframes = 441000;
mat D(2, nframes);
sf_count_t read_frames = load_stereo_file_into_matrix(sndfile, nframes, D );
//std::cout << D << std::endl;
std::cout << "D.n_cols: " << D.n_cols << " D.n_rows: " << D.n_rows << std::endl;
mat M = mean(D);
std::cout << "Mean calculated " << std::endl;
//std::cout << "Mono: " << M.row(0) << std::endl;
std::cout << "M.n_cols: " << M.n_cols << " M.n_rows: " << M.n_rows << " read_frames: " << read_frames << std::endl;
mat Spectr;
int ntffs = 512;
spectrogram(M, ntffs, ntffs/2, Spectr);
std::cout << "Spectr len: " << Spectr.n_elem << " cols: " << Spectr.n_cols << " rows: " << Spectr.n_rows
<< " sizeof: " << sizeof(Spectr) << std::endl;
Spectr.save("asearch.dat", raw_ascii);
int err = sf_close(sndfile);
if(err)
{
std::cout << "Close Error: " << sf_strerror(sndfile) << std::endl;
return 1;
}
return ret;
}
#endif
|
[
"olegg@OLEG-764PC.waves.com"
] |
olegg@OLEG-764PC.waves.com
|
adda33cc0155cb5e8c15fc8a10a37da4a596ba96
|
59a0e5d431a17725ba1f24cd1baf258f08dd32a3
|
/src/common/model.h
|
c324f98a9436b7cd8f9c019fcc4b095e061f023a
|
[
"MIT"
] |
permissive
|
yuqtj/OpenGLPractice
|
588bec2ecf2d71d073ce78b14b21959f9bb95094
|
a3e2b46ee84194ce8f823c4bc497093ed8a7e254
|
refs/heads/master
| 2020-05-19T17:53:26.290056
| 2019-05-10T08:46:32
| 2019-05-10T08:46:32
| 185,144,992
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 9,816
|
h
|
#ifndef MODEL_H
#define MODEL_H
#include <glad/glad.h>
#include <glm/glm.hpp>
#include <glm/gtc/matrix_transform.hpp>
#include <stb_image.h>
#include <assimp/Importer.hpp>
#include <assimp/scene.h>
#include <assimp/postprocess.h>
#include <common/mesh.h>
#include <common/shader.h>
#include <string>
#include <fstream>
#include <sstream>
#include <iostream>
#include <map>
#include <vector>
using namespace std;
unsigned int TextureFromFile(const char *path, const string &directory, bool gamma = false);
class Model
{
public:
/* Model Data */
vector<Texture> textures_loaded; // stores all the textures loaded so far, optimization to make sure textures aren't loaded more than once.
vector<Mesh> meshes;
string directory;
bool gammaCorrection;
glm::mat4 worldMatrix;
/* Functions */
// use assimp import model
Model(string const &path, bool gamma = false) : gammaCorrection(gamma)
{
loadModel(path);
}
// draws the model, and thus all its meshes
void Draw(Shader shader)
{
for(unsigned int i = 0; i < meshes.size(); i++)
meshes[i].Draw(shader);
}
private:
/* Functions */
// loads a model with supported ASSIMP extensions from file and stores the resulting meshes in the meshes vector.
void loadModel(string const &path)
{
// read file via ASSIMP
Assimp::Importer importer;
const aiScene* scene = importer.ReadFile(path, aiProcess_Triangulate | aiProcess_FlipUVs | aiProcess_CalcTangentSpace);
// check for errors
if(!scene || scene->mFlags & AI_SCENE_FLAGS_INCOMPLETE || !scene->mRootNode) // if is Not Zero
{
cout << "ERROR::ASSIMP:: " << importer.GetErrorString() << endl;
return;
}
// retrieve the directory path of the filepath
directory = path.substr(0, path.find_last_of('/'));
// process ASSIMP's root node recursively
processNode(scene->mRootNode, scene);
}
// processes a node in a recursive fashion. Processes each individual mesh located at the node and repeats this process on its children nodes (if any).
void processNode(aiNode *node, const aiScene *scene)
{
// process each mesh located at the current node
for(unsigned int i = 0; i < node->mNumMeshes; i++)
{
// the node object only contains indices to index the actual objects in the scene.
// the scene contains all the data, node is just to keep stuff organized (like relations between nodes).
aiMesh* mesh = scene->mMeshes[node->mMeshes[i]];
meshes.push_back(processMesh(mesh, scene));
}
// after we've processed all of the meshes (if any) we then recursively process each of the children nodes
for(unsigned int i = 0; i < node->mNumChildren; i++)
{
processNode(node->mChildren[i], scene);
}
}
Mesh processMesh(aiMesh *mesh, const aiScene *scene)
{
// data to fill
vector<Vertex> vertices;
vector<unsigned int> indices;
vector<Texture> textures;
// Walk through each of the mesh's vertices
for(unsigned int i = 0; i < mesh->mNumVertices; i++)
{
Vertex vertex;
glm::vec3 vector; // we declare a placeholder vector since assimp uses its own vector class that doesn't directly convert to glm's vec3 class so we transfer the data to this placeholder glm::vec3 first.
// positions
vector.x = mesh->mVertices[i].x;
vector.y = mesh->mVertices[i].y;
vector.z = mesh->mVertices[i].z;
vertex.Position = vector;
// normals
vector.x = mesh->mNormals[i].x;
vector.y = mesh->mNormals[i].y;
vector.z = mesh->mNormals[i].z;
vertex.Normal = vector;
// texture coordinates
if(mesh->mTextureCoords[0]) // does the mesh contain texture coordinates?
{
glm::vec2 vec;
// a vertex can contain up to 8 different texture coordinates. We thus make the assumption that we won't
// use models where a vertex can have multiple texture coordinates so we always take the first set (0).
vec.x = mesh->mTextureCoords[0][i].x;
vec.y = mesh->mTextureCoords[0][i].y;
vertex.TexCoords = vec;
}
else
vertex.TexCoords = glm::vec2(0.0f, 0.0f);
// tangent
vector.x = mesh->mTangents[i].x;
vector.y = mesh->mTangents[i].y;
vector.z = mesh->mTangents[i].z;
vertex.Tangent = vector;
// bitangent
vector.x = mesh->mBitangents[i].x;
vector.y = mesh->mBitangents[i].y;
vector.z = mesh->mBitangents[i].z;
vertex.Bitangent = vector;
vertices.push_back(vertex);
}
// now wak through each of the mesh's faces (a face is a mesh its triangle) and retrieve the corresponding vertex indices.
for(unsigned int i = 0; i < mesh->mNumFaces; i++)
{
aiFace face = mesh->mFaces[i];
// retrieve all indices of the face and store them in the indices vector
for(unsigned int j = 0; j < face.mNumIndices; j++)
indices.push_back(face.mIndices[j]);
}
// process materials
aiMaterial* material = scene->mMaterials[mesh->mMaterialIndex];
// we assume a convention for sampler names in the shaders. Each diffuse texture should be named
// as 'texture_diffuseN' where N is a sequential number ranging from 1 to MAX_SAMPLER_NUMBER.
// Same applies to other texture as the following list summarizes:
// diffuse: texture_diffuseN
// specular: texture_specularN
// normal: texture_normalN
// 1. diffuse maps
vector<Texture> diffuseMaps = loadMaterialTextures(material, aiTextureType_DIFFUSE, "texture_diffuse");
textures.insert(textures.end(), diffuseMaps.begin(), diffuseMaps.end());
// 2. specular maps
vector<Texture> specularMaps = loadMaterialTextures(material, aiTextureType_SPECULAR, "texture_specular");
textures.insert(textures.end(), specularMaps.begin(), specularMaps.end());
// 3. normal maps
std::vector<Texture> normalMaps = loadMaterialTextures(material, aiTextureType_HEIGHT, "texture_normal");
textures.insert(textures.end(), normalMaps.begin(), normalMaps.end());
// 4. height maps
std::vector<Texture> heightMaps = loadMaterialTextures(material, aiTextureType_AMBIENT, "texture_height");
textures.insert(textures.end(), heightMaps.begin(), heightMaps.end());
// return a mesh object created from the extracted mesh data
return Mesh(vertices, indices, textures);
}
// checks all material textures of a given type and loads the textures if they're not loaded yet.
// the required info is returned as a Texture struct.
vector<Texture> loadMaterialTextures(aiMaterial *mat, aiTextureType type, string typeName)
{
vector<Texture> textures;
for(unsigned int i = 0; i < mat->GetTextureCount(type); i++)
{
aiString str;
mat->GetTexture(type, i, &str);
// check if texture was loaded before and if so, continue to next iteration: skip loading a new texture
bool skip = false;
for(unsigned int j = 0; j < textures_loaded.size(); j++)
{
if(std::strcmp(textures_loaded[j].path.data(), str.C_Str()) == 0)
{
textures.push_back(textures_loaded[j]);
skip = true; // a texture with the same filepath has already been loaded, continue to next one. (optimization)
break;
}
}
if(!skip)
{ // if texture hasn't been loaded already, load it
Texture texture;
texture.id = TextureFromFile(str.C_Str(), this->directory);
texture.type = typeName;
texture.path = str.C_Str();
textures.push_back(texture);
textures_loaded.push_back(texture); // store it as texture loaded for entire model, to ensure we won't unnecesery load duplicate textures.
}
}
return textures;
}
};
unsigned int TextureFromFile(const char *path, const string &directory, bool gamma)
{
string filename = string(path);
filename = directory + '/' + filename;
unsigned int textureID;
glGenTextures(1, &textureID);
int width, height, nrComponents;
unsigned char *data = stbi_load(filename.c_str(), &width, &height, &nrComponents, 0);
if (data)
{
GLenum format;
if (nrComponents == 1)
format = GL_RED;
else if (nrComponents == 3)
format = GL_RGB;
else if (nrComponents == 4)
format = GL_RGBA;
glBindTexture(GL_TEXTURE_2D, textureID);
glTexImage2D(GL_TEXTURE_2D, 0, format, width, height, 0, format, GL_UNSIGNED_BYTE, data);
glGenerateMipmap(GL_TEXTURE_2D);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
stbi_image_free(data);
}
else
{
std::cout << "Texture failed to load at path: " << path << std::endl;
stbi_image_free(data);
}
return textureID;
}
#endif
|
[
"269427899@qq.com"
] |
269427899@qq.com
|
5d76308237e0e4e8bd62e15f4a5bcfa8108e503a
|
cd9c4670683df414f814928ec69778c13095f862
|
/SpotVMFrame/SpotVMFrame/ReadTrace.cpp
|
1c1c0e5c8f047ee85f622235d0005824e7e1caab
|
[] |
no_license
|
amelieczhou/hybrid-dynamic-workflow-scheduling
|
a1d82d0ec110cf099c0eab37984622fb2c5dbf2b
|
c13d8d1aaaee95a9262a530d91746309b081c25c
|
refs/heads/master
| 2020-12-25T18:20:30.888574
| 2015-01-13T03:37:29
| 2015-01-13T03:37:29
| 32,119,838
| 1
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 3,534
|
cpp
|
#include "stdafx.h"
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <stdlib.h>
#include <fstream>
#include <iostream>
#include <omp.h>
#include "ReadTrace.h"
int ReadTrace::readfile(char* filename){
if((fp=fopen(filename, "r"))==NULL){
printf("Error: file not found: %s\n", filename);
exit(1);
}
return 0;
}
int ReadTrace::readfile(char* filename, int l){//read the l-th line
readfile(filename);
if(fp != NULL){
char str[1024]; // tmp buf for one line
for(int index = 0; index < l; index ++){
char* ptr = fgets(str, 1024, fp);
}
}
return 0;
}
int ReadTrace::readtomem(char* filename, float* result){
//readfile(filename);
std::ifstream fin(filename);
char str[14400];
char buf[32];
char *ptr, *ptr2;
int lines,cols;
if(strcmp(filename,"data1.csv")==0||strcmp(filename,"data2.csv")==0){
lines = 35971;
cols = 4;
}
else if(strcmp(filename,"tp.dat")==0||strcmp(filename,"newData/tp.dat")==0){
lines = 800;
cols = 440;
}else if(strcmp(filename,"ffp_2.dat")==0||strcmp(filename,"newData/ffp_2.dat")==0){
lines = 2520;//760;
cols = 2400;
}
int i=0;
while(fin.getline(str,14400)&&i<lines){
ptr=str;
for(int j=0; j<cols; j++){
//if(j==2399)
//printf("");
ptr2 = strchr(ptr,',');
if(ptr2 == NULL){
ptr2 = strchr(ptr,'\n');
if(ptr2 == NULL) {
memset(buf,0,32);
strncpy(buf,ptr,5);
result[i*cols+j] = atof(buf);
break;
}
}
memset(buf,0,32);
strncpy(buf,ptr,ptr2-ptr);
result[i*cols+j] = atof(buf);
ptr = ptr2 + 1;
// printf("%d\n",j);
}
i++;
}
//if(fp!=NULL){
// int setbufsize = setvbuf (fp , NULL , _IOFBF , 14400);
// char str[14400];
// char buf[32];
// char *ptr, *ptr2;
// int lines,cols;
// if(strcmp(filename,"data1.csv")==0||strcmp(filename,"data2.csv")==0){
// lines = 35971;
// cols = 4;
// }
// else if(strcmp(filename,"tp.dat")==0||strcmp(filename,"newData/tp.dat")==0){
// lines = 800;
// cols = 440;
// }else if(strcmp(filename,"ffp_2.dat")==0||strcmp(filename,"newData/ffp_2.dat")==0){
// lines = 760;
// cols = 2400;
// }
// for(int i=0; i<lines; i++){//totally 35971 lines in the trace
// ptr = fgets(str,14400,fp);
// for(int j=0; j<cols; j++){
// ptr2 = strchr(ptr,',');
// if(ptr2 == NULL){
// ptr2 = strchr(ptr,'\n');
// if(ptr2 == NULL) break;
// }
// memset(buf,0,32);
// strncpy(buf,ptr,ptr2-ptr);
// result[i*cols+j] = atof(buf);
// ptr = ptr2 + 1;
// printf("%d\n",j);
// }
// }
//}
return 0;
}
int ReadTrace::closefile(){
if(fp != NULL)
fclose(fp);
return 0;
}
int ReadTrace::readprice(float* result){
int j;
char str[1024]; // tmp buf for one line
char buf[32]; // tmp buf for one digit
char *ptr, *ptr2;
if(fp == NULL)
return NULL;
ptr = fgets(str, 1024, fp);
if(ptr==NULL){
// no more results, so just break this loop
return NULL;
}
for(j=0;j<42;++j){
ptr2 = strchr(ptr, ',');
if(ptr2 == NULL){
ptr2 = strchr(ptr, '\n');
if (ptr2 == NULL){
// we don't have more, so just break this loop
break;
}
}
// store the float value
memset(buf, 0, 32);
strncpy(buf, ptr, ptr2-ptr);
if(j == 3)//trace for small instance type
result[0] = atof(buf);
else if(j == 38)
result[1] = atof(buf);
else if(j == 30)
result[2] = atof(buf);
else if(j == 4)
result[3] = atof(buf);
// move pointer to the next position
ptr = ptr2 + 1;
}
return 0;
}
|
[
"andyzhang870914@gmail.com@0f0f248c-0e70-7bf0-40e6-9a9aec565ee8"
] |
andyzhang870914@gmail.com@0f0f248c-0e70-7bf0-40e6-9a9aec565ee8
|
c996cab86d732cd6eb175e03f094008babd77978
|
2c6221df607e3e41571e552ce6966acd5e8accab
|
/Timer.h
|
2c8e8eb2f91c5d3fe2bd3a5773b7fea4edefda4a
|
[] |
no_license
|
Charlyhash/GakkiNet
|
1a66adaa5ea82116c001943c9f5faa433fbf17ed
|
2d1c8ac4cb4c65875223a88627da8075129f92f7
|
refs/heads/master
| 2021-07-02T21:48:20.950842
| 2017-09-25T01:04:00
| 2017-09-25T01:04:00
| 104,687,870
| 0
| 0
| null | null | null | null |
GB18030
|
C++
| false
| false
| 817
|
h
|
#ifndef __TIMER_H__
#define __TIMER_H__
#include <unistd.h>
#include <stdint.h>
#include <sys/time.h>
#include <functional>
#include <memory>
using namespace std;
/*
Timer是对事件类事件的封装,包含一个到期时间和处理函数
*/
namespace GakkiNet
{
class Timer
{
public:
Timer(uint32_t interval, const function<void()> & funcHandle);
struct timeval getTimeOut();
uint64_t getTimeOutMSecond();
struct timespec getTimeInterval();
void update();
void setHandle(const function<void()> &);
static uint64_t getNowTimeMSecond();
static std::string getNowTimeDate();
void timerHandle();
private:
uint32_t intervalMs; //定时时间
struct timeval now; //当前时间
function<void()> handle; //时间到后的处理函数
};
}
#endif
|
[
"1062403542@qq.com"
] |
1062403542@qq.com
|
8f9609dac2baf108ed779f8259d27e3b73b679ae
|
8b452bf7e8bfaf255428153d2a8641b0a09027b7
|
/Franklin & Marshall/CS3/eandrewsHW1/ReallyLongInt.cc
|
9e37a37d918542a842cade3078e50510ff4deaf5
|
[] |
no_license
|
EricBAndrews/Classwork
|
6f9b60fdca94dc76cc776f63631884df51cb1940
|
7f907c612eae0eed700d0e2c3f3ee76bbf2a2323
|
refs/heads/master
| 2020-04-03T03:34:09.817660
| 2018-11-24T19:50:23
| 2018-11-24T19:50:23
| 154,989,486
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 12,572
|
cc
|
#include<math.h>
#include "ReallyLongInt.hpp"
// private
ReallyLongInt::ReallyLongInt(unsigned int* digitArr, unsigned int arrSize, bool isNeg) {
removeLeadingZeros(digitArr, arrSize);
digits = digitArr;
numDigits = arrSize;
this->isNeg = digits[0] != 0 ? isNeg : false;
}
void ReallyLongInt::removeLeadingZeros(unsigned int* x, unsigned int& xSize) const {
unsigned int i;
unsigned int j;
unsigned int tempSize = xSize; // size without leading zeros
for (i = 0; i < xSize; i++) {
// find size without leading zeros
if (x[i] == 0) {
tempSize--;
}
// shift all numbers to the front of the rlInt
else {
for (j = 0; j < tempSize; j++) {
x[j] = x[i + j];
}
break;
}
}
// zero case
if (tempSize == 0) {
tempSize = 1;
}
// new size
xSize = tempSize;
}
void ReallyLongInt::swap(ReallyLongInt other) {
std::swap(this->isNeg, other.isNeg);
std::swap(this->digits, other.digits);
std::swap(this->numDigits, other.numDigits);
}
bool ReallyLongInt::absGreater(const ReallyLongInt& other) const {
// get different orders of magnitude out of the way
if (numDigits > other.numDigits) {
return true;
}
if (other.numDigits > numDigits) {
return false;
}
// digit-by-digit comparison starting from the most significant and working down
unsigned int i;
for (i = 0; i < numDigits; i++) {
if (digits[i] > other.digits[i]) {
return true;
}
if (digits[i] < other.digits[i]) {
return false;
}
}
return false;
}
ReallyLongInt ReallyLongInt::absAdd(const ReallyLongInt& other) const {
unsigned int resultSize;
if (this->absGreater(other)) {
resultSize = numDigits + 1;
}
else {
resultSize = other.numDigits + 1;
}
unsigned int* sum = new unsigned int[resultSize];
unsigned int carry = 0;
unsigned int i;
unsigned int xDigit;
unsigned int yDigit;
unsigned int curDigit;
ReallyLongInt* ret;
for (i = 0; i < resultSize; i++) {
// get digits to add
if (i > numDigits - 1) {
xDigit = 0;
}
else {
xDigit = digits[numDigits - 1 - i];
}
if (i > other.numDigits - 1) {
yDigit = 0;
}
else {
yDigit = other.digits[other.numDigits - 1 - i];
}
// add the digits
curDigit = xDigit + yDigit + carry;
carry = 0;
// carry
if (curDigit > 9) {
sum[resultSize - 1 - i] = curDigit % 10;
carry = curDigit / 10;
}
else {
sum[resultSize - 1 - i] = curDigit;
}
}
removeLeadingZeros(sum, resultSize);
ret = new ReallyLongInt();
ret->isNeg = false;
ret->digits = sum;
ret->numDigits = resultSize;
delete[] sum;
return *ret;
}
ReallyLongInt ReallyLongInt::absSub(const ReallyLongInt& other) const {
ReallyLongInt x; // larger operand
ReallyLongInt y; // smaller operand
bool retIsNeg;
unsigned int difDigits;
unsigned int* dif;
unsigned int i;
unsigned int borrowIndex;
ReallyLongInt* ret;
if (other.absGreater(*this)) {
x = other;
y = *this;
retIsNeg = true;
}
else {
y = other;
x = *this;
retIsNeg = false;
}
// std::cout << "x: " << x << " y: " << y << std::endl;
difDigits = x.numDigits;
dif = new unsigned int[difDigits];
for (i = 0; i < difDigits; i++) {
dif[i] = x.digits[i];
}
for (i = 0; i < y.numDigits; i++) {
if (dif[difDigits - 1 - i] < y.digits[y.numDigits - 1 - i]) {
// need to borrow
borrowIndex = difDigits - 1 - i;
dif[borrowIndex] += 10;
borrowIndex--;
while (dif[borrowIndex] == 0) {
dif[borrowIndex] = 9;
borrowIndex--;
}
dif[borrowIndex]--;
}
dif[difDigits - 1 - i] -= y.digits[y.numDigits - 1 - i];
}
removeLeadingZeros(dif, difDigits);
ret = new ReallyLongInt();
ret->isNeg = retIsNeg;
ret->digits = dif;
ret->numDigits = difDigits;
delete[] dif;
return *ret;
}
ReallyLongInt ReallyLongInt::absMult(const ReallyLongInt& other) const {
unsigned int prodNumDigits = this->numDigits + other.numDigits;
unsigned int* prod = new unsigned int[prodNumDigits];
unsigned int i;
unsigned int j;
unsigned int carry;
unsigned int curDigit;
unsigned int sum;
for (i = 0; i < prodNumDigits; i++) {
prod[i] = 0;
}
for (i = 0; i < this->numDigits; i++) {
carry = 0;
for (j = 0; j < other.numDigits; j++) {
curDigit = prodNumDigits - i - j - 1;
sum = prod[curDigit] + carry + this->digits[this->numDigits - 1 - i] *
other.digits[other.numDigits - 1 - j];
prod[curDigit] = sum % 10;
carry = sum / 10;
}
prod[this->numDigits - 1 - i] += carry;
}
removeLeadingZeros(prod, prodNumDigits);
ReallyLongInt* ret = new ReallyLongInt();
ret->digits = prod;
ret->numDigits = prodNumDigits;
delete[] prod;
return *ret;
}
void ReallyLongInt::absDiv(const ReallyLongInt& other, ReallyLongInt& quotient,
ReallyLongInt& remainder) const {
unsigned int quotSize = numDigits;
unsigned int* quotDigits = new unsigned int[quotSize];
unsigned int i;
unsigned int digit;
remainder = 0;
for (i = 0; i < numDigits; ++i) {
remainder = remainder.absMult(10);
remainder = remainder.absAdd(digits[i]);
digit = 0;
while (remainder.absGreater(other.absSub(1))) {
remainder = remainder.absSub(other);
++digit;
}
quotDigits[i] = digit;
}
removeLeadingZeros(quotDigits, quotSize);
quotient.digits = quotDigits;
quotient.numDigits = quotSize;
}
void ReallyLongInt::flipSign() {
if (*this != 0) {
isNeg = !isNeg;
}
}
// public
ReallyLongInt::ReallyLongInt() {
// creates a rlInt equal to 0
isNeg = false;
unsigned int* tempDigits = new unsigned int[1];
tempDigits[0] = 0;
digits = tempDigits;
numDigits = 1;
}
ReallyLongInt::ReallyLongInt(long long num) {
// creates a rlInt equal to num
long long tempNum;
unsigned int i;
unsigned int* tempDigits;
int digitIndex;
if (num < 0) {
isNeg = true;
tempNum = num * -1;
}
else {
isNeg = false;
tempNum = num;
}
if (num == 0) {
numDigits = 1;
}
else {
numDigits = log10(tempNum) / 1 + 1;
}
tempDigits = new unsigned int[numDigits];
digitIndex = numDigits - 1;
for (i = 0; i < numDigits; i++) {
tempDigits[digitIndex - i] = tempNum % 10;
tempNum = tempNum / 10;
}
digits = tempDigits;
}
ReallyLongInt::ReallyLongInt(const string& numStr) {
numDigits = numStr.size();
unsigned int* longNum = new unsigned int[numDigits];
unsigned int i = 0;
if (numStr[0] == '-') {
i = 1;
longNum[0] = 0;
isNeg = numStr[1] != '0' ? true : false;
}
else {
isNeg = false;
}
for (; i < numDigits; ++i) {
longNum[i] = numStr[i] - 48;
}
removeLeadingZeros(longNum, numDigits);
digits = longNum;
}
ReallyLongInt::ReallyLongInt(const ReallyLongInt& other) {
unsigned int i;
unsigned int* temp;
numDigits = other.numDigits;
isNeg = other.isNeg;
temp = new unsigned int[numDigits];
for (i = 0; i < numDigits; i++) {
temp[i] = other.digits[i];
}
digits = temp;
}
ReallyLongInt::~ReallyLongInt() {
delete[](digits);
}
long long ReallyLongInt::toLongLong() const {
ReallyLongInt* temp = new ReallyLongInt(*this);
ReallyLongInt* max = new ReallyLongInt(LLONG_MAX);
ReallyLongInt* maxPlus = new ReallyLongInt(*max);
++(*maxPlus);
while (*temp > *max) {
*temp %= *maxPlus;
}
long long ret = 0;
unsigned int i;
for (i = 0; i < temp->numDigits; i++) {
ret *= 10;
ret += temp->digits[i];
}
if (isNeg) {
ret *= -1;
}
delete temp;
delete max;
delete maxPlus;
return ret;
}
bool ReallyLongInt::equal(const ReallyLongInt& other) const {
// ASSUMES LEADING ZEROS ARE STRIPPED
// can't be equal if they're different sizes
if (numDigits != other.numDigits) {
return false;
}
// can't be equal if they're a different sign
if (isNeg ^ other.isNeg) { // i like bitwise operators. sue me.
return false;
}
// digit-by-digit comparison; direction doesn't matter
unsigned int i;
for (i = 0; i < numDigits; i++) {
if (digits[i] != other.digits[i]) {
return false;
}
}
return true;
}
bool ReallyLongInt::greater(const ReallyLongInt &other) const {
if (isNeg ^ other.isNeg) {
return other.isNeg;
}
if (isNeg) {
if (this->equal(other)) {
return false;
}
return !absGreater(other);
}
return absGreater(other);
}
ReallyLongInt ReallyLongInt::add(const ReallyLongInt &other) const {
if (isNeg && other.isNeg) {
ReallyLongInt ret = this->absAdd(other);
ret.flipSign();
return ret;
}
if (isNeg) {
return other.absSub(*this);
}
if (other.isNeg) {
return this->absSub(other);
}
return this->absAdd(other);
}
ReallyLongInt ReallyLongInt::sub(const ReallyLongInt &other) const {
if (isNeg && other.isNeg) {
return other.absSub(*this);
}
if (isNeg) {
ReallyLongInt ret = this->absAdd(other);
ret.flipSign();
return ret;
}
if (other.isNeg) {
return this->absAdd(other);
}
return this->absSub(other);
}
ReallyLongInt ReallyLongInt::mult(const ReallyLongInt &other) const {
ReallyLongInt ret = this->absMult(other);
if (isNeg ^ other.isNeg && ret != 0) {
ret.flipSign();
}
return ret;
}
void ReallyLongInt::div(const ReallyLongInt& denominator, ReallyLongInt& quotient,
ReallyLongInt& remainder) const {
this->absDiv(denominator, quotient, remainder);
if (isNeg ^ denominator.isNeg) {
quotient.flipSign();
}
if (isNeg) {
remainder.flipSign();
}
}
ReallyLongInt ReallyLongInt::operator-() const {
ReallyLongInt* ret = new ReallyLongInt(*this);
ret->isNeg = !ret->isNeg;
return *ret;
}
ReallyLongInt& ReallyLongInt::operator=(const ReallyLongInt& other) {
swap(other);
return *this;
}
ReallyLongInt& ReallyLongInt::operator+=(const ReallyLongInt &other) {
*this = *this + other;
return *this;
}
ReallyLongInt& ReallyLongInt::operator-=(const ReallyLongInt &other) {
*this = *this - other;
return *this;
}
ReallyLongInt& ReallyLongInt::operator*=(const ReallyLongInt &other) {
*this = *this * other;
return *this;
}
ReallyLongInt& ReallyLongInt::operator/=(const ReallyLongInt &other) {
*this = *this / other;
return *this;
}
ReallyLongInt& ReallyLongInt::operator%=(const ReallyLongInt &other) {
*this = *this % other;
return *this;
}
ReallyLongInt& ReallyLongInt::operator++() {
*this = *this + 1;
return *this;
}
ReallyLongInt& ReallyLongInt::operator--() {
*this = *this - 1;
return *this;
}
ReallyLongInt ReallyLongInt::operator++(int dummy) {
ReallyLongInt ret = *this;
*this = *this + 1;
return ret;
}
ReallyLongInt ReallyLongInt::operator--(int dummy) {
ReallyLongInt ret = *this;
*this = *this - 1;
return ret;
}
ostream& ReallyLongInt::print(ostream& out) const {
unsigned int i;
if (isNeg) {
out << '-';
}
for (i = 0; i < numDigits; i++) {
out << digits[i];
}
return out;
}
// independent functions
bool operator==(const ReallyLongInt& x, const ReallyLongInt& y) {
return x.equal(y);
}
bool operator!=(const ReallyLongInt& x, const ReallyLongInt& y) {
return !x.equal(y);
}
bool operator>(const ReallyLongInt& x, const ReallyLongInt& y) {
return x.greater(y);
}
bool operator<(const ReallyLongInt& x, const ReallyLongInt& y) {
return y.greater(x);
}
bool operator>=(const ReallyLongInt& x, const ReallyLongInt& y) {
return x.equal(y) || x.greater(y);
}
bool operator<=(const ReallyLongInt& x, const ReallyLongInt& y) {
return x.equal(y) || y.greater(x);
}
ReallyLongInt operator+(const ReallyLongInt& x, const ReallyLongInt& y) {
return x.add(y);
}
ReallyLongInt operator-(const ReallyLongInt& x, const ReallyLongInt& y) {
return x.sub(y);
}
ReallyLongInt operator*(const ReallyLongInt& x, const ReallyLongInt& y) {
return x.mult(y);
}
ReallyLongInt operator/(const ReallyLongInt& x, const ReallyLongInt& y) {
ReallyLongInt* quotient = new ReallyLongInt();
ReallyLongInt* remainder = new ReallyLongInt();
x.div(y, *quotient, *remainder);
return *quotient;
}
ReallyLongInt operator%(const ReallyLongInt& x, const ReallyLongInt& y) {
ReallyLongInt* quotient = new ReallyLongInt();
ReallyLongInt* remainder = new ReallyLongInt();
x.div(y, *quotient, *remainder);
return *remainder;
}
ostream& operator<<(ostream& out, const ReallyLongInt& x) {
return x.print(out);
}
|
[
"eric.barclay.andrews@gmail.com"
] |
eric.barclay.andrews@gmail.com
|
e83eae6b12a70bb5e58313e9a1c1c5a2395c499f
|
785df77400157c058a934069298568e47950e40b
|
/TnbSectPx/TnbLib/SectPx/Registry/Object/SectPx_ObjectRegistryIO.cxx
|
84e4b902385ad715ffbccc880390fecd8bc1ca12
|
[] |
no_license
|
amir5200fx/Tonb
|
cb108de09bf59c5c7e139435e0be008a888d99d5
|
ed679923dc4b2e69b12ffe621fc5a6c8e3652465
|
refs/heads/master
| 2023-08-31T08:59:00.366903
| 2023-08-31T07:42:24
| 2023-08-31T07:42:24
| 230,028,961
| 9
| 3
| null | 2023-07-20T16:53:31
| 2019-12-25T02:29:32
|
C++
|
UTF-8
|
C++
| false
| false
| 500
|
cxx
|
#include <SectPx_ObjectRegistry.hxx>
#include <SectPx_CountRegistry.hxx>
#include <SectPx_ScatterRegistry.hxx>
#include <SectPx_RegObj.hxx>
TNB_SAVE_IMPLEMENTATION(tnbLib::SectPx_ObjectRegistry)
{
ar & boost::serialization::base_object<SectPx_Entity>(*this);
ar & theCounter_;
ar & theScatter_;
ar & theObjects_;
}
TNB_LOAD_IMPLEMENTATION(tnbLib::SectPx_ObjectRegistry)
{
ar & boost::serialization::base_object<SectPx_Entity>(*this);
ar & theCounter_;
ar & theScatter_;
ar & theObjects_;
}
|
[
"aasoleimani86@gmail.com"
] |
aasoleimani86@gmail.com
|
20caa343b3171c2491179e2eccdd1fd04fc1eae3
|
80721bb1fc43e51281c828f9e28037087bbfd1f9
|
/hx/proc/abs.hh
|
2e3db432e27d2229f3a5c0a6c5b3000362c20fc3
|
[
"MIT"
] |
permissive
|
geekysuavo/hx
|
3fb0d5828dc30e9e4a15c5734f1f13c51854c4af
|
457b7c486d24e3142f2f9c259b0dfb97af03b312
|
refs/heads/main
| 2021-10-10T09:28:35.918092
| 2021-10-05T16:05:08
| 2021-10-05T16:05:08
| 142,273,838
| 1
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 714
|
hh
|
/* Copyright (c) 2019 Bradley Worley <geekysuavo@gmail.com>
* Released under the MIT License.
*/
#pragma once
namespace hx::proc {
/* hx::proc::abs<In>
*
* Processor that converts complex arrays to real arrays by taking
* the multicomplex modulus of each array element.
*/
template<typename In>
struct abs {
/* Out: real-valued array of the same dimensions.
*/
using Out = hx::build_array_t<double, hx::array_dims_t<In>>;
/* operator()() */
void operator() (const std::unique_ptr<In>& in,
const std::unique_ptr<Out>& out) const {
typename Out::index_type idx;
do {
(*out)[idx] = (*in)[idx].norm();
}
while (idx++);
}
};
/* namespace hx::proc */ }
|
[
"geekysuavo@gmail.com"
] |
geekysuavo@gmail.com
|
3e111cff8bb54d7e23ce6f563a56d7a2dc5e95a1
|
214a0bb04952b840920b90082ff47693b1846dfe
|
/algorithms/kernel/pca/pca_dense_correlation_batch_fpt_dispatcher.cpp
|
f65faebf27add2a35d856c9cfdfd05fc0596838d
|
[
"Apache-2.0",
"Intel",
"LicenseRef-scancode-warranty-disclaimer",
"BSD-2-Clause",
"MIT",
"Zlib",
"LicenseRef-scancode-unknown-license-reference"
] |
permissive
|
ShvetsKS/daal
|
f2e3bd6c9c01dcfc8fa4aa868c03e91486e0a078
|
9a212d0744029b46d0c1bc4a7459f2b435622231
|
refs/heads/master
| 2021-06-18T12:57:24.401709
| 2020-02-04T08:47:01
| 2020-02-05T10:04:52
| 208,966,273
| 0
| 0
|
Apache-2.0
| 2019-09-17T05:27:16
| 2019-09-17T05:27:16
| null |
UTF-8
|
C++
| false
| false
| 1,117
|
cpp
|
/* file: pca_dense_correlation_batch_fpt_dispatcher.cpp */
/*******************************************************************************
* Copyright 2014-2020 Intel Corporation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*******************************************************************************/
/*
//++
// Implementation of PCA Correlation algorithm container.
//--
*/
#include "pca_dense_correlation_batch_container.h"
namespace daal
{
namespace algorithms
{
__DAAL_INSTANTIATE_DISPATCH_CONTAINER_SYCL(pca::interface3::BatchContainer, batch, DAAL_FPTYPE, pca::correlationDense)
}
} // namespace daal
|
[
"nikolay.a.petrov@intel.com"
] |
nikolay.a.petrov@intel.com
|
68183a1a189f4ddb9589f87f5da9dbf77edfc042
|
5a2b4b9ed6089bbcc47b5e17708ae8b2ca697ca5
|
/src/qt/bitcoin.cpp
|
6049bbdf0d18894afb106bf1a0e439fd66b1729d
|
[
"MIT"
] |
permissive
|
yamahacoin/sourcescode
|
4fe95b17ab887b8f60378b746ae89c09d85bff0a
|
497112a52cdde72bab93e407671f9572ebfdb14a
|
refs/heads/master
| 2021-01-19T06:43:18.256173
| 2016-08-07T00:13:00
| 2016-08-07T00:13:00
| 65,090,340
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 11,104
|
cpp
|
// Copyright (c) 2011-2013 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 <QApplication>
#include "bitcoingui.h"
#include "clientmodel.h"
#include "walletmodel.h"
#include "optionsmodel.h"
#include "guiutil.h"
#include "guiconstants.h"
#include "init.h"
#include "util.h"
#include "ui_interface.h"
#include "paymentserver.h"
#include "splashscreen.h"
#include <QMessageBox>
#if QT_VERSION < 0x050000
#include <QTextCodec>
#endif
#include <QLocale>
#include <QTimer>
#include <QTranslator>
#include <QLibraryInfo>
#ifdef Q_OS_MAC
#include "macdockiconhandler.h"
#endif
#if defined(BITCOIN_NEED_QT_PLUGINS) && !defined(_BITCOIN_QT_PLUGINS_INCLUDED)
#define _BITCOIN_QT_PLUGINS_INCLUDED
#define __INSURE__
#include <QtPlugin>
Q_IMPORT_PLUGIN(qcncodecs)
Q_IMPORT_PLUGIN(qjpcodecs)
Q_IMPORT_PLUGIN(qtwcodecs)
Q_IMPORT_PLUGIN(qkrcodecs)
Q_IMPORT_PLUGIN(qtaccessiblewidgets)
#endif
// Declare meta types used for QMetaObject::invokeMethod
Q_DECLARE_METATYPE(bool*)
// Need a global reference for the notifications to find the GUI
static BitcoinGUI *guiref;
static SplashScreen *splashref;
static bool ThreadSafeMessageBox(const std::string& message, const std::string& caption, unsigned int style)
{
// Message from network thread
if(guiref)
{
bool modal = (style & CClientUIInterface::MODAL);
bool ret = false;
// In case of modal message, use blocking connection to wait for user to click a button
QMetaObject::invokeMethod(guiref, "message",
modal ? GUIUtil::blockingGUIThreadConnection() : Qt::QueuedConnection,
Q_ARG(QString, QString::fromStdString(caption)),
Q_ARG(QString, QString::fromStdString(message)),
Q_ARG(unsigned int, style),
Q_ARG(bool*, &ret));
return ret;
}
else
{
printf("%s: %s\n", caption.c_str(), message.c_str());
fprintf(stderr, "%s: %s\n", caption.c_str(), message.c_str());
return false;
}
}
static bool ThreadSafeAskFee(int64 nFeeRequired)
{
if(!guiref)
return false;
if(nFeeRequired < CTransaction::nMinTxFee || nFeeRequired <= nTransactionFee || fDaemon)
return true;
bool payFee = false;
QMetaObject::invokeMethod(guiref, "askFee", GUIUtil::blockingGUIThreadConnection(),
Q_ARG(qint64, nFeeRequired),
Q_ARG(bool*, &payFee));
return payFee;
}
static void InitMessage(const std::string &message)
{
if(splashref)
{
splashref->showMessage(QString::fromStdString(message), Qt::AlignBottom|Qt::AlignHCenter, QColor(55,55,55));
qApp->processEvents();
}
printf("init message: %s\n", message.c_str());
}
/*
Translate string to current locale using Qt.
*/
static std::string Translate(const char* psz)
{
return QCoreApplication::translate("bitcoin-core", psz).toStdString();
}
/* Handle runaway exceptions. Shows a message box with the problem and quits the program.
*/
static void handleRunawayException(std::exception *e)
{
PrintExceptionContinue(e, "Runaway exception");
QMessageBox::critical(0, "Runaway exception", BitcoinGUI::tr("A fatal error occurred. yamahacoin can no longer continue safely and will quit.") + QString("\n\n") + QString::fromStdString(strMiscWarning));
exit(1);
}
#ifndef BITCOIN_QT_TEST
int main(int argc, char *argv[])
{
// Command-line options take precedence:
ParseParameters(argc, argv);
#if QT_VERSION < 0x050000
// Internal string conversion is all UTF-8
QTextCodec::setCodecForTr(QTextCodec::codecForName("UTF-8"));
QTextCodec::setCodecForCStrings(QTextCodec::codecForTr());
#endif
Q_INIT_RESOURCE(bitcoin);
QApplication app(argc, argv);
// Register meta types used for QMetaObject::invokeMethod
qRegisterMetaType< bool* >();
// Do this early as we don't want to bother initializing if we are just calling IPC
// ... but do it after creating app, so QCoreApplication::arguments is initialized:
if (PaymentServer::ipcSendCommandLine())
exit(0);
PaymentServer* paymentServer = new PaymentServer(&app);
// Install global event filter that makes sure that long tooltips can be word-wrapped
app.installEventFilter(new GUIUtil::ToolTipToRichTextFilter(TOOLTIP_WRAP_THRESHOLD, &app));
// ... then bitcoin.conf:
if (!boost::filesystem::is_directory(GetDataDir(false)))
{
// This message can not be translated, as translation is not initialized yet
// (which not yet possible because lang=XX can be overridden in bitcoin.conf in the data directory)
QMessageBox::critical(0, "yamahacoin",
QString("Error: Specified data directory \"%1\" does not exist.").arg(QString::fromStdString(mapArgs["-datadir"])));
return 1;
}
ReadConfigFile(mapArgs, mapMultiArgs);
// Application identification (must be set before OptionsModel is initialized,
// as it is used to locate QSettings)
QApplication::setOrganizationName("yamahacoin");
QApplication::setOrganizationDomain("yamahacoin.org");
if(GetBoolArg("-testnet")) // Separate UI settings for testnet
QApplication::setApplicationName("yamahacoin-Qt-testnet");
else
QApplication::setApplicationName("yamahacoin-Qt");
// ... then GUI settings:
OptionsModel optionsModel;
// Get desired locale (e.g. "de_DE") from command line or use system locale
QString lang_territory = QString::fromStdString(GetArg("-lang", QLocale::system().name().toStdString()));
QString lang = lang_territory;
// Convert to "de" only by truncating "_DE"
lang.truncate(lang_territory.lastIndexOf('_'));
QTranslator qtTranslatorBase, qtTranslator, translatorBase, translator;
// Load language files for configured locale:
// - First load the translator for the base language, without territory
// - Then load the more specific locale translator
// Load e.g. qt_de.qm
if (qtTranslatorBase.load("qt_" + lang, QLibraryInfo::location(QLibraryInfo::TranslationsPath)))
app.installTranslator(&qtTranslatorBase);
// Load e.g. qt_de_DE.qm
if (qtTranslator.load("qt_" + lang_territory, QLibraryInfo::location(QLibraryInfo::TranslationsPath)))
app.installTranslator(&qtTranslator);
// Load e.g. bitcoin_de.qm (shortcut "de" needs to be defined in bitcoin.qrc)
if (translatorBase.load(lang, ":/translations/"))
app.installTranslator(&translatorBase);
// Load e.g. bitcoin_de_DE.qm (shortcut "de_DE" needs to be defined in bitcoin.qrc)
if (translator.load(lang_territory, ":/translations/"))
app.installTranslator(&translator);
// Subscribe to global signals from core
uiInterface.ThreadSafeMessageBox.connect(ThreadSafeMessageBox);
uiInterface.ThreadSafeAskFee.connect(ThreadSafeAskFee);
uiInterface.InitMessage.connect(InitMessage);
uiInterface.Translate.connect(Translate);
// Show help message immediately after parsing command-line options (for "-lang") and setting locale,
// but before showing splash screen.
if (mapArgs.count("-?") || mapArgs.count("--help"))
{
GUIUtil::HelpMessageBox help;
help.showOrPrint();
return 1;
}
#ifdef Q_OS_MAC
// on mac, also change the icon now because it would look strange to have a testnet splash (green) and a std app icon (orange)
if(GetBoolArg("-testnet")) {
MacDockIconHandler::instance()->setIcon(QIcon(":icons/bitcoin_testnet"));
}
#endif
SplashScreen splash(QPixmap(), 0);
if (GetBoolArg("-splash", true) && !GetBoolArg("-min"))
{
splash.show();
splash.setAutoFillBackground(true);
splashref = &splash;
}
app.processEvents();
app.setQuitOnLastWindowClosed(false);
try
{
#ifndef Q_OS_MAC
// Regenerate startup link, to fix links to old versions
// OSX: makes no sense on mac and might also scan/mount external (and sleeping) volumes (can take up some secs)
if (GUIUtil::GetStartOnSystemStartup())
GUIUtil::SetStartOnSystemStartup(true);
#endif
boost::thread_group threadGroup;
BitcoinGUI window;
guiref = &window;
QTimer* pollShutdownTimer = new QTimer(guiref);
QObject::connect(pollShutdownTimer, SIGNAL(timeout()), guiref, SLOT(detectShutdown()));
pollShutdownTimer->start(200);
if(AppInit2(threadGroup))
{
{
// Put this in a block, so that the Model objects are cleaned up before
// calling Shutdown().
optionsModel.Upgrade(); // Must be done after AppInit2
if (splashref)
splash.finish(&window);
ClientModel clientModel(&optionsModel);
WalletModel *walletModel = 0;
if(pwalletMain)
walletModel = new WalletModel(pwalletMain, &optionsModel);
window.setClientModel(&clientModel);
if(walletModel)
{
window.addWallet("~Default", walletModel);
window.setCurrentWallet("~Default");
}
// If -min option passed, start window minimized.
if(GetBoolArg("-min"))
{
window.showMinimized();
}
else
{
window.show();
}
// Now that initialization/startup is done, process any command-line
// bitcoin: URIs
QObject::connect(paymentServer, SIGNAL(receivedURI(QString)), &window, SLOT(handleURI(QString)));
QTimer::singleShot(100, paymentServer, SLOT(uiReady()));
app.exec();
window.hide();
window.setClientModel(0);
window.removeAllWallets();
guiref = 0;
delete walletModel;
}
// Shutdown the core and its threads, but don't exit Bitcoin-Qt here
threadGroup.interrupt_all();
threadGroup.join_all();
Shutdown();
}
else
{
threadGroup.interrupt_all();
threadGroup.join_all();
Shutdown();
return 1;
}
} catch (std::exception& e) {
handleRunawayException(&e);
} catch (...) {
handleRunawayException(NULL);
}
return 0;
}
#endif // BITCOIN_QT_TEST
|
[
"noreply@github.com"
] |
yamahacoin.noreply@github.com
|
866c2331bfb8bcb97a7ee2b7011674ad3ce619a9
|
2c92f0791872199207c727f09594cfec33314c79
|
/DehaxGL/Math/Vec3i.cpp
|
47bf4b00c7f0164b94f8e478cef25a82a319d065
|
[] |
no_license
|
Dehax/DehaxRenderer
|
7341421b8151a7637eafea534b2906925e8b6099
|
6e6380199dbb6936ef10630c5cf37c223a0c5c45
|
refs/heads/master
| 2020-12-21T05:06:24.995543
| 2016-07-28T09:26:42
| 2016-07-28T09:26:42
| 59,241,963
| 1
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 272
|
cpp
|
#include "Vec3i.h"
Vec3i::Vec3i(int x, int y, int z)
: x(x), y(y), z(z)
{
}
Vec3i::Vec3i(const Vec3f &v3f)
: x(v3f.x + 0.5L), y(v3f.y + 0.5L), z(v3f.z + 0.5L)
{
}
Vec3i Vec3i::operator-(const Vec3i &v3) const
{
return Vec3i(x - v3.x, y - v3.y, z - v3.z);
}
|
[
"dehax12@gmail.com"
] |
dehax12@gmail.com
|
76493cfb209036487bf592209b39909823238437
|
e78772e0cb915fac6a4d4bee88b367b5ced8726d
|
/Code/cocos2dx/layers_scenes_transitions_nodes/CCLayer.h
|
df7267d6cbba315f8e3ccaa91b86ddaee9c45328
|
[
"MIT"
] |
permissive
|
xavierbec/SpriteDraggerX
|
d68f2bca70e2b09c6d371181bc9a84cdb80c53dc
|
b978c07030f73fae4e01333961c326f06c11a99c
|
refs/heads/master
| 2021-01-15T11:14:29.837880
| 2013-12-31T04:45:02
| 2013-12-31T04:45:02
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 14,465
|
h
|
/****************************************************************************
Copyright (c) 2010-2012 cocos2d-x.org
Copyright (c) 2008-2010 Ricardo Quesada
Copyright (c) 2011 Zynga 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 __CCLAYER_H__
#define __CCLAYER_H__
#include "base_nodes/CCNode.h"
#include "CCProtocols.h"
#include "touch_dispatcher/CCTouchDelegateProtocol.h"
#include "platform/CCAccelerometerDelegate.h"
#include "keypad_dispatcher/CCKeypadDelegate.h"
#include "cocoa/CCArray.h"
NS_CC_BEGIN
/**
* @addtogroup layer
* @{
*/
class CCTouchScriptHandlerEntry;
//
// CCLayer
//
/** @brief CCLayer is a subclass of CCNode that implements the TouchEventsDelegate protocol.
All features from CCNode are valid, plus the following new features:
- It can receive iPhone Touches
- It can receive Accelerometer input
*/
class CC_DLL CCLayer : public CCNode, public CCTouchDelegate, public CCAccelerometerDelegate, public CCKeypadDelegate
{
public:
CCLayer();
virtual ~CCLayer();
bool init();
// @deprecated: This interface will be deprecated sooner or later.
CC_DEPRECATED_ATTRIBUTE static CCLayer *node(void);
/** create one layer */
static CCLayer *create(void);
virtual void onEnter();
virtual void onExit();
virtual void onEnterTransitionDidFinish();
// default implements are used to call script callback if exist
virtual bool ccTouchBegan(CCTouch *pTouch, CCEvent *pEvent);
virtual void ccTouchMoved(CCTouch *pTouch, CCEvent *pEvent);
virtual void ccTouchEnded(CCTouch *pTouch, CCEvent *pEvent);
virtual void ccTouchCancelled(CCTouch *pTouch, CCEvent *pEvent);
// default implements are used to call script callback if exist
virtual void ccTouchesBegan(CCSet *pTouches, CCEvent *pEvent);
virtual void ccTouchesMoved(CCSet *pTouches, CCEvent *pEvent);
virtual void ccTouchesEnded(CCSet *pTouches, CCEvent *pEvent);
virtual void ccTouchesCancelled(CCSet *pTouches, CCEvent *pEvent);
virtual void didAccelerate(CCAcceleration* pAccelerationValue) {CC_UNUSED_PARAM(pAccelerationValue);}
/** If isTouchEnabled, this method is called onEnter. Override it to change the
way CCLayer receives touch events.
( Default: CCTouchDispatcher::sharedDispatcher()->addStandardDelegate(this,0); )
Example:
void CCLayer::registerWithTouchDispatcher()
{
CCTouchDispatcher::sharedDispatcher()->addTargetedDelegate(this,INT_MIN+1,true);
}
@since v0.8.0
*/
virtual void registerWithTouchDispatcher(void);
/** Register script touch events handler */
void registerScriptTouchHandler(int nHandler, bool bIsMultiTouches = false, int nPriority = INT_MIN, bool bSwallowsTouches = false);
/** Unregister script touch events handler */
void unregisterScriptTouchHandler(void);
/** whether or not it will receive Touch events.
You can enable / disable touch events with this property.
Only the touches of this node will be affected. This "method" is not propagated to it's children.
@since v0.8.1
*/
bool isTouchEnabled();
void setTouchEnabled(bool value);
/** whether or not it will receive Accelerometer events
You can enable / disable accelerometer events with this property.
@since v0.8.1
*/
bool isAccelerometerEnabled();
void setAccelerometerEnabled(bool value);
/** whether or not it will receive keypad events
You can enable / disable accelerometer events with this property.
it's new in cocos2d-x
*/
bool isKeypadEnabled();
void setKeypadEnabled(bool value);
protected:
bool m_bIsTouchEnabled;
bool m_bIsAccelerometerEnabled;
bool m_bIsKeypadEnabled;
private:
// Script touch events handler
CCTouchScriptHandlerEntry* m_pScriptHandlerEntry;
int excuteScriptTouchHandler(int nEventType, CCTouch *pTouch);
int excuteScriptTouchHandler(int nEventType, CCSet *pTouches);
};
// for the subclass of CCLayer, each has to implement the static "node" method
// @deprecated: This interface will be deprecated sooner or later.
#define LAYER_NODE_FUNC(layer) \
CC_DEPRECATED_ATTRIBUTE static layer* node() \
{ \
layer *pRet = new layer(); \
if (pRet && pRet->init()) \
{ \
pRet->autorelease(); \
return pRet; \
} \
else \
{ \
delete pRet; \
pRet = NULL; \
return NULL; \
} \
}
// for the subclass of CCLayer, each has to implement the static "create" method
#define LAYER_CREATE_FUNC(layer) \
static layer* create() \
{ \
layer *pRet = new layer(); \
if (pRet && pRet->init()) \
{ \
pRet->autorelease(); \
return pRet; \
} \
else \
{ \
delete pRet; \
pRet = NULL; \
return NULL; \
} \
}
// @deprecated: This interface will be deprecated sooner or later.
#define LAYER_NODE_FUNC_PARAM(layer,__PARAMTYPE__,__PARAM__) \
CC_DEPRECATED_ATTRIBUTE static layer* node(__PARAMTYPE__ __PARAM__) \
{ \
layer *pRet = new layer(); \
if (pRet && pRet->init(__PARAM__)) \
{ \
pRet->autorelease(); \
return pRet; \
} \
else \
{ \
delete pRet; \
pRet = NULL; \
return NULL; \
} \
}
#define LAYER_CREATE_FUNC_PARAM(layer,__PARAMTYPE__,__PARAM__) \
static layer* create(__PARAMTYPE__ __PARAM__) \
{ \
layer *pRet = new layer(); \
if (pRet && pRet->init(__PARAM__)) \
{ \
pRet->autorelease(); \
return pRet; \
} \
else \
{ \
delete pRet; \
pRet = NULL; \
return NULL; \
} \
}
//
// CCLayerColor
//
/** @brief CCLayerColor is a subclass of CCLayer that implements the CCRGBAProtocol protocol.
All features from CCLayer are valid, plus the following new features:
- opacity
- RGB colors
*/
class CC_DLL CCLayerColor : public CCLayer , public CCRGBAProtocol, public CCBlendProtocol
{
protected:
ccVertex2F m_pSquareVertices[4];
ccColor4F m_pSquareColors[4];
public:
CCLayerColor();
virtual ~CCLayerColor();
virtual void draw();
virtual void setContentSize(CCSize var);
/** creates a CCLayer with color, width and height in Points
@deprecated: This interface will be deprecated sooner or later.
*/
CC_DEPRECATED_ATTRIBUTE static CCLayerColor * layerWithColor(const ccColor4B& color, GLfloat width, GLfloat height);
/** creates a CCLayer with color. Width and height are the window size.
@deprecated: This interface will be deprecated sooner or later.
*/
CC_DEPRECATED_ATTRIBUTE static CCLayerColor * layerWithColor(const ccColor4B& color);
/** creates a CCLayer with color, width and height in Points */
static CCLayerColor * create(const ccColor4B& color, GLfloat width, GLfloat height);
/** creates a CCLayer with color. Width and height are the window size. */
static CCLayerColor * create(const ccColor4B& color);
virtual bool init();
/** initializes a CCLayer with color, width and height in Points */
virtual bool initWithColor(const ccColor4B& color, GLfloat width, GLfloat height);
/** initializes a CCLayer with color. Width and height are the window size. */
virtual bool initWithColor(const ccColor4B& color);
/** change width in Points*/
void changeWidth(GLfloat w);
/** change height in Points*/
void changeHeight(GLfloat h);
/** change width and height in Points
@since v0.8
*/
void changeWidthAndHeight(GLfloat w ,GLfloat h);
/** Opacity: conforms to CCRGBAProtocol protocol */
CC_PROPERTY(GLubyte, m_cOpacity, Opacity)
/** Color: conforms to CCRGBAProtocol protocol */
CC_PROPERTY_PASS_BY_REF(ccColor3B, m_tColor, Color)
/** BlendFunction. Conforms to CCBlendProtocol protocol */
CC_PROPERTY(ccBlendFunc, m_tBlendFunc, BlendFunc)
virtual void setOpacityModifyRGB(bool bValue) {CC_UNUSED_PARAM(bValue);}
virtual bool isOpacityModifyRGB(void) { return false;}
//@deprecated: This interface will be deprecated sooner or later.
LAYER_CREATE_FUNC(CCLayerColor)
LAYER_NODE_FUNC(CCLayerColor)
protected:
virtual void updateColor();
};
//
// CCLayerGradient
//
/** CCLayerGradient is a subclass of CCLayerColor that draws gradients across
the background.
All features from CCLayerColor are valid, plus the following new features:
- direction
- final color
- interpolation mode
Color is interpolated between the startColor and endColor along the given
vector (starting at the origin, ending at the terminus). If no vector is
supplied, it defaults to (0, -1) -- a fade from top to bottom.
If 'compressedInterpolation' is disabled, you will not see either the start or end color for
non-cardinal vectors; a smooth gradient implying both end points will be still
be drawn, however.
If ' compressedInterpolation' is enabled (default mode) you will see both the start and end colors of the gradient.
@since v0.99.5
*/
class CC_DLL CCLayerGradient : public CCLayerColor
{
public:
/** Creates a full-screen CCLayer with a gradient between start and end.
@deprecated: This interface will be deprecated sooner or later.
*/
CC_DEPRECATED_ATTRIBUTE static CCLayerGradient* layerWithColor(const ccColor4B& start, const ccColor4B& end);
/** Creates a full-screen CCLayer with a gradient between start and end in the direction of v.
@deprecated: This interface will be deprecated sooner or later.
*/
CC_DEPRECATED_ATTRIBUTE static CCLayerGradient* layerWithColor(const ccColor4B& start, const ccColor4B& end, const CCPoint& v);
/** Creates a full-screen CCLayer with a gradient between start and end. */
static CCLayerGradient* create(const ccColor4B& start, const ccColor4B& end);
/** Creates a full-screen CCLayer with a gradient between start and end in the direction of v. */
static CCLayerGradient* create(const ccColor4B& start, const ccColor4B& end, const CCPoint& v);
/** Initializes the CCLayer with a gradient between start and end. */
virtual bool initWithColor(const ccColor4B& start, const ccColor4B& end);
/** Initializes the CCLayer with a gradient between start and end in the direction of v. */
virtual bool initWithColor(const ccColor4B& start, const ccColor4B& end, const CCPoint& v);
CC_PROPERTY_PASS_BY_REF(ccColor3B, m_startColor, StartColor)
CC_PROPERTY_PASS_BY_REF(ccColor3B, m_endColor, EndColor)
CC_PROPERTY(GLubyte, m_cStartOpacity, StartOpacity)
CC_PROPERTY(GLubyte, m_cEndOpacity, EndOpacity)
CC_PROPERTY_PASS_BY_REF(CCPoint, m_AlongVector, Vector)
/** Whether or not the interpolation will be compressed in order to display all the colors of the gradient both in canonical and non canonical vectors
Default: YES
*/
protected:
bool m_bCompressedInterpolation;
public:
virtual void setCompressedInterpolation(bool bCompressedInterpolation);
virtual bool isCompressedInterpolation();
// @deprecated: This interface will be deprecated sooner or later.
LAYER_NODE_FUNC(CCLayerGradient)
LAYER_CREATE_FUNC(CCLayerGradient)
protected:
virtual void updateColor();
};
/** @brief CCMultipleLayer is a CCLayer with the ability to multiplex it's children.
Features:
- It supports one or more children
- Only one children will be active a time
*/
class CC_DLL CCLayerMultiplex : public CCLayer
{
protected:
unsigned int m_nEnabledLayer;
CCArray* m_pLayers;
public:
CCLayerMultiplex();
virtual ~CCLayerMultiplex();
/** creates a CCLayerMultiplex with one or more layers using a variable argument list.
@deprecated: This interface will be deprecated sooner or later.
*/
CC_DEPRECATED_ATTRIBUTE static CCLayerMultiplex * layerWithLayers(CCLayer* layer, ... );
/**
* lua script can not init with undetermined number of variables
* so add these functinons to be used with lua.
@deprecated: This interface will be deprecated sooner or later.
*/
CC_DEPRECATED_ATTRIBUTE static CCLayerMultiplex * layerWithLayer(CCLayer* layer);
/** creates a CCLayerMultiplex with one or more layers using a variable argument list. */
static CCLayerMultiplex * create(CCLayer* layer, ... );
/**
* lua script can not init with undetermined number of variables
* so add these functinons to be used with lua.
*/
static CCLayerMultiplex * createWithLayer(CCLayer* layer);
void addLayer(CCLayer* layer);
/** initializes a MultiplexLayer with one or more layers using a variable argument list. */
bool initWithLayers(CCLayer* layer, va_list params);
/** switches to a certain layer indexed by n.
The current (old) layer will be removed from it's parent with 'cleanup:YES'.
*/
void switchTo(unsigned int n);
/** release the current layer and switches to another layer indexed by n.
The current (old) layer will be removed from it's parent with 'cleanup:YES'.
*/
void switchToAndReleaseMe(unsigned int n);
//@deprecated: This interface will be deprecated sooner or later.
LAYER_NODE_FUNC(CCLayerMultiplex)
LAYER_CREATE_FUNC(CCLayerMultiplex)
};
// end of layer group
/// @}
NS_CC_END
#endif // __CCLAYER_H__
|
[
"nat@natweiss.com"
] |
nat@natweiss.com
|
a354788e2fdd6df0db444b43cdfd179ba8c95b96
|
6b40e9dccf2edc767c44df3acd9b626fcd586b4d
|
/NT/com/ole32/com/objact/dllapi.cxx
|
7399d851d6f269918a91ac3682e143ef38f75025
|
[] |
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
| 5,482
|
cxx
|
//+-------------------------------------------------------------------------
//
// Microsoft Windows
// Copyright (C) Microsoft Corporation, 1992 - 1993.
//
// File: dllapi.cxx
//
// Contents: API entry points for DLL manipulation
//
// Functions: CoLoadLibrary
// CoFreeLibrary
// CoFreeAllLibraries
// CoFreeUnusedLibraries
//
// History: 12-May-93 Ricksa Created
// 31-Dec-93 ErikGav Chicago port
//
//--------------------------------------------------------------------------
#include <ole2int.h>
#include <objact.hxx>
STDAPI_(void) CoFreeUnusedLibrariesEx(DWORD dwUnloadDelay, DWORD dwReserved);
//+-------------------------------------------------------------------------
//
// Function: CoLoadLibrary
//
// Synopsis: Loads a DLL
//
// Arguments: [pLibName] - name of DLL to load
// [fAutoLoad] - whether DLL s/b unloaded automatically.
//
// Returns: HINSTANCE
//
// Algorithm: Just calls through to the Windows.
//
// History: 12-May-93 Ricksa Created
//
// Notes: This API is provided for Cross Platform portability.
//
//--------------------------------------------------------------------------
STDAPI_(HINSTANCE) CoLoadLibrary(LPWSTR pLibName, BOOL fAutoLoad)
{
OLETRACEIN((API_CoLoadLibrary, PARAMFMT("pLibName= %ws, fAutoLoad= %B"), pLibName, fAutoLoad));
HINSTANCE hInst = NULL;
hInst = LoadLibraryEx(pLibName, NULL, LOAD_WITH_ALTERED_SEARCH_PATH);
OLETRACEOUTEX((API_CoLoadLibrary, RETURNFMT("%x"), hInst));
return hInst;
}
//+-------------------------------------------------------------------------
//
// Function: CoFreeLibrary
//
// Synopsis: Used to free a DLL loaded by CoLoadLibrary.
//
// Arguments: [hInst] - handle to DLL
//
// Algorithm: Just passes through call to the OS
//
// History: 12-May-93 Ricksa Created
//
// Notes: This API is provided for Cross Platform portability.
//
//--------------------------------------------------------------------------
STDAPI_(void) CoFreeLibrary(HINSTANCE hInst)
{
OLETRACEIN((API_CoFreeLibrary, PARAMFMT("hInst= %x"), hInst));
FreeLibrary(hInst);
OLETRACEOUTEX((API_CoFreeLibrary, NORETURN));
}
//+-------------------------------------------------------------------------
//
// Function: CoFreeAllLibraries
//
// Synopsis: Free all libraries
//
// History: 12-May-93 Ricksa Created
//
// Notes: All libraries are freed at process exit in Win32 anyway
// so we just notify any unused libraries that they can
// go way in the DEV build so memory can be totally cleaned
// up to facilitate the discovery of memory leaks.
//
//--------------------------------------------------------------------------
STDAPI_(void) CoFreeAllLibraries(void)
{
OLETRACEIN((API_CoFreeAllLibraries, NOPARAM));
#if DBG == 1
CoFreeUnusedLibraries();
#endif // DBG
OLETRACEOUTEX((API_CoFreeAllLibraries, NORETURN));
}
//+-------------------------------------------------------------------------
//
// Function: CoFreeUnusedLibraries
//
// Synopsis: Free any unused single-threaded DLLS.
//
// Algorithm: Ask DLL cache objects to free any DLLs that respond
// to DllCanUnloadNow with TRUE.
//
// History: 12-May-93 Ricksa Created
//
// Notes: The DllCanUnloadNow protocol is as follows:
//
// Apartment Model DLLs: CoFreeUnusedLibraries must be called on
// each thread that has loaded an object from the DLL, before the
// DLL will realy be unloaded.
//
// FreeThreaded DLLs: OLE will wait 10 minutes from the last
// use of the DLL before unloading it.
//
//--------------------------------------------------------------------------
STDAPI_(void) CoFreeUnusedLibraries(void)
{
OLETRACEIN((API_CoFreeUnusedLibraries, NOPARAM));
CoFreeUnusedLibrariesEx(INFINITE, 0);
OLETRACEOUTEX((API_CoFreeUnusedLibraries, NORETURN));
}
//+-------------------------------------------------------------------------
//
// Function: CoFreeUnusedLibraries
//
// Synopsis: Free any unused single-threaded DLLS.
//
// Algorithm: Ask DLL cache objects to free any DLLs that respond
// to DllCanUnloadNow with TRUE.
//
// History: 12-May-93 Ricksa Created
//
// Notes: The DllCanUnloadNow protocol is as follows:
//
// Apartment Model DLLs: CoFreeUnusedLibraries must be called on
// each thread that has loaded an object from the DLL, before the
// DLL will realy be unloaded.
//
// ThreadNeutral and FreeThreaded DLLs: OLE will wait dwUnloadDelay
// milliseconds from the last use of the DLL before unloading it.
//
//--------------------------------------------------------------------------
STDAPI_(void) CoFreeUnusedLibrariesEx(DWORD dwUnloadDelay, DWORD dwReserved)
{
OLETRACEIN((API_CoFreeUnusedLibraries, PARAMFMT("dwUnloadDelay= %x"), dwUnloadDelay));
HRESULT hr;
COleTls tls(hr); // ensure TLS exists
if (SUCCEEDED(hr))
{
if (!IsWOWProcess())
{
CCFreeUnused(dwUnloadDelay);
}
}
OLETRACEOUTEX((API_CoFreeUnusedLibraries, NORETURN));
}
|
[
"seta7D5@protonmail.com"
] |
seta7D5@protonmail.com
|
63f2a8712b8f8cbb22d7e9535fe15e8cc5d3911d
|
c057e033602e465adfa3d84d80331a3a21cef609
|
/C/testcases/CWE415_Double_Free/s02/CWE415_Double_Free__new_delete_int_22b.cpp
|
a09f92690c7c573de88b032ba547585a1e0de049
|
[] |
no_license
|
Anzsley/My_Juliet_Test_Suite_v1.3_for_C_Cpp
|
12c2796ae7e580d89e4e7b8274dddf920361c41c
|
f278f1464588ffb763b7d06e2650fda01702148f
|
refs/heads/main
| 2023-04-11T08:29:22.597042
| 2021-04-09T11:53:16
| 2021-04-09T11:53:16
| 356,251,613
| 1
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 2,304
|
cpp
|
/* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE415_Double_Free__new_delete_int_22b.cpp
Label Definition File: CWE415_Double_Free__new_delete.label.xml
Template File: sources-sinks-22b.tmpl.cpp
*/
/*
* @description
* CWE: 415 Double Free
* BadSource: Allocate data using new and Deallocae data using delete
* GoodSource: Allocate data using new
* Sinks:
* GoodSink: do nothing
* BadSink : Deallocate data using delete
* Flow Variant: 22 Control flow: Flow controlled by value of a global variable. Sink functions are in a separate file from sources.
*
* */
#include "std_testcase.h"
#include <wchar.h>
namespace CWE415_Double_Free__new_delete_int_22
{
#ifndef OMITBAD
/* The global variable below is used to drive control flow in the sink function. Since it is in
a C++ namespace, it doesn't need a globally unique name. */
extern int badGlobal;
void badSink(int * data)
{
if(badGlobal)
{
/* POTENTIAL FLAW: Possibly deleting memory twice */
delete data;
}
}
#endif /* OMITBAD */
#ifndef OMITGOOD
/* The static variables below are used to drive control flow in the sink functions. Since they are in
a C++ namespace, they don't need globally unique names. */
extern int goodB2G1Global;
extern int goodB2G2Global;
extern int goodG2B1Global;
/* goodB2G1() - use badsource and goodsink by setting the static variable to false instead of true */
void goodB2G1Sink(int * data)
{
if(goodB2G1Global)
{
/* INCIDENTAL: CWE 561 Dead Code, the code below will never run */
printLine("Benign, fixed string");
}
else
{
/* do nothing */
/* FIX: Don't attempt to delete the memory */
; /* empty statement needed for some flow variants */
}
}
/* goodB2G2() - use badsource and goodsink by reversing the blocks in the if in the sink function */
void goodB2G2Sink(int * data)
{
if(goodB2G2Global)
{
/* do nothing */
/* FIX: Don't attempt to delete the memory */
; /* empty statement needed for some flow variants */
}
}
/* goodG2B1() - use goodsource and badsink */
void goodG2B1Sink(int * data)
{
if(goodG2B1Global)
{
/* POTENTIAL FLAW: Possibly deleting memory twice */
delete data;
}
}
#endif /* OMITGOOD */
} /* close namespace */
|
[
"65642214+Anzsley@users.noreply.github.com"
] |
65642214+Anzsley@users.noreply.github.com
|
780e19425e11a5fe8a758125bb2f7df5b9d4f4d5
|
af2098ea3cfda83a62982335e4784c71d6ab39f8
|
/CameraManager.h
|
45d24e99b3a2fc38688bbdb73518fbe2d66f6308
|
[] |
no_license
|
Juno12343412/2dFrameWork
|
4aa501e7b2d12174fc92741342f12e3d6053fb07
|
58e99702a4603a0c8294c7c30d7a41c2186c90f5
|
refs/heads/master
| 2023-04-12T22:01:05.625552
| 2021-03-20T12:36:48
| 2021-03-20T12:36:48
| 349,720,448
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 708
|
h
|
#pragma once
#include "singleton.h"
class CameraManager :
public singleton<CameraManager>
{
public:
CameraManager();
virtual ~CameraManager();
D3DXMATRIX m_matProj, m_matView;
Vector2 m_vCameraPos;
Vector2 m_vViewSize;
Vector3 m_vScale;
Vector3 m_vEndScale;
Vector3 m_vTarget;
float m_fAngle;
float m_ShakeTime;
bool moveAlarm = false;
void Init();
void Release();
void SetTransform();
void MoveCamera(const Vector2& vPlusPos);
void SetCamera(const Vector2& vSetPos);
D3DXMATRIX GetMat()
{
D3DXMatrixInverse(&m_matView, NULL, &m_matView);
return m_matView;
}
void Update();
void Reset();
void CameraShake(float _time);
};
#define CAMERA CameraManager::GetInstance()
|
[
"junoh0207@naver.com"
] |
junoh0207@naver.com
|
c63378f9c331948d0635c31c08c35b2ef75531f1
|
baa46f5a65374ae641d0025e28083481bbc617c4
|
/Computational 5 Errors/Computational 5 Errors/main.cpp
|
0cbfb55b55860c97cdcfa01b1ab20b3c8aeaca73
|
[] |
no_license
|
divyansh000915/Comp_Tech
|
f5d89fcafdfd6a4a88f96aa9fec3f65cd94e3e50
|
19936855bac0fd99d72075589ce22f1de4f4208c
|
refs/heads/master
| 2022-02-28T22:45:38.186318
| 2019-09-23T13:56:56
| 2019-09-23T13:56:56
| 208,996,750
| 0
| 1
| null | 2019-10-11T04:26:33
| 2019-09-17T08:14:04
|
C++
|
UTF-8
|
C++
| false
| false
| 729
|
cpp
|
//
// main.cpp
// Computational 5 Errors
//
// Created by Divyansh Rastogi on 11/09/19.
// Copyright © 2019 Divyansh Rastogi. All rights reserved.
//
#include <iostream>
#include <math.h>
using namespace std;
int main(int argc, const char * argv[]) {
// insert code here...
// std::cout << "Hello, World!\n";
float tval, cval;
cout << "\nEnter the True Value : ";
cin >> tval;
cout << "\nEnter the Calculated Value : ";
cin >> cval;
float abserr = abs(cval-tval);
float relerr = abserr/tval;
float pererr = relerr*100;
cout <<"\nAbsolute Error : " << abserr << endl << "\nRelative Error : " << relerr << endl << "\nPrecentage Error : " << pererr << '%' << endl;
return 0;
}
|
[
"divyansh000915@gmail.com"
] |
divyansh000915@gmail.com
|
382864f61b0acf7a1a50948fbaa58f1edf16e94a
|
2bbd3585fdbddf86abd401a484f52884523b19d2
|
/C++/Q5/text.cpp
|
e574f007f96b512f9c2e4c33a78e83fff6d0b669
|
[] |
no_license
|
ahmadreza-n/AP-HW4
|
6906d3a1e88a851656e7b463b86ae6e5b06c6034
|
93f27376ca3eec4808d91885e92e152398b029d2
|
refs/heads/master
| 2020-05-16T04:23:33.597826
| 2019-05-07T17:49:52
| 2019-05-07T17:49:52
| 182,774,790
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 160
|
cpp
|
#include "text.h"
CText::CText()
{
}
CText::~CText()
{
}
CText::CText(std::string text_) : text{text_}
{
}
std::string CText::getText()
{
return text;
}
|
[
"ahmadrezaanazari@gmail.com"
] |
ahmadrezaanazari@gmail.com
|
fc740326ad65b4958c6b4c0ac047041d82529ec4
|
69289711ad8d4252ea3cd636a93b33d884ed23e2
|
/A_Buy_the_String.cpp
|
dadc478cb6ecb881dd1e4a90fc9f34a71525cb3e
|
[] |
no_license
|
shinigamirex888/A2oj-ladders
|
75672819835eab7cb9043c65c1d967ff7ed1196c
|
65e76f1a1378e5bc0d4a11a089b80f1525bddab4
|
refs/heads/main
| 2023-07-25T03:05:09.569120
| 2021-09-03T08:52:07
| 2021-09-03T08:52:07
| 356,104,026
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,538
|
cpp
|
#include <bits/stdc++.h>
#include <bits/stdc++.h>
# include <iostream>
#define ll long long
#define INF 2000000000
using namespace std;
//cout<<fixed<<setprecision(12)<<ans<<endl;
//const int M=1e9+7;
// const int M=1e9+7;
const int M=998244353;
long long mod(long long x){
return ((x%M + M)%M);
}
long long add(long long a, long long b){
return mod(mod(a)+mod(b));
}
long long mul(long long a, long long b){
return mod(mod(a)*mod(b));
}
ll modPow(ll a, ll b){
if(b==0)
return 1LL;
if(b==1)
return a%M;
ll res=1;
while(b){
if(b%2==1)
res=mul(res,a);
a=mul(a,a);
b=b/2;
}
return res;
}
int main(){
int t;
cin>>t;
while(t--){
int n,c0,c1,h;
string s;
cin>>n>>c0>>c1>>h>>s;
int zero=0,one=0;
for(int i=0;i<n;i++){
if(s[i]=='0')
zero++;
else
one++;
}
int ans=(zero*c0)+(one*c1);
int ans0=(one*h)+(n*c0); // all 1 convert to 0
int ans1=(zero*h)+(n*c1); // all 0 convert to 1
cout<<min(ans,min(ans0,ans1))<<endl;
}
return 0;
}
|
[
"noreply@github.com"
] |
shinigamirex888.noreply@github.com
|
3aa691ac8524b93d101792369d97eed290e24bd2
|
0040cbae8d7a5585e89153da24c70333bd6b2910
|
/075/757/main.cpp
|
7afcaf040eb51b4f32c736dd02f06143818cfdd1
|
[] |
no_license
|
paulnewman1979/edocteel
|
758f0247ce04fed24419fa15f16be54eef00f402
|
2796b6478fda76cc834c9d8f5e2a3ed96da735a7
|
refs/heads/master
| 2022-09-08T23:06:00.822780
| 2022-07-27T23:34:56
| 2022-07-27T23:34:56
| 41,645,619
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 2,408
|
cpp
|
#include <iostream>
#include <vector>
#include <algorithm>
#include <stdio.h>
#include "../../template/common/Input.hh"
#include "../../template/common/Output.hh"
using namespace std;
bool compare(vector<int>& a, vector<int>& b) {
return (a[0] < b[0]);
}
class Solution {
public:
int intersectionSizeTwo(vector<vector<int>>& intervals) {
int ret = 0, i, j;
vector<int> count(intervals.size(), 0);
vector<vector<int>> point(intervals.size() * 2, vector<int>(2, 0));
vector<int> toadd;
unordered_set<int> scope;
for (i = 0; i < intervals.size(); ++i) {
point[i + i][0] = intervals[i][0];
point[i + i][1] = i;
point[i + i + 1 ][0] = intervals[i][1];
point[i + i + 1 ][1] = i;
}
sort(point.begin(), point.end(), compare);
int cur = point[0][0], minCount = 2;
for (i = 0; i < point.size(); ++i) {
if (cur != point[i][0] ) {
switch(minCount) {
case 0:
ret += 2;
for (auto& c : toadd) count[c]++;
for (auto& c : scope) count[c]+=2;
break;
case 1:
++ret;
for (auto& c : toadd) count[c]++;
for (auto& c : scope) count[c]++;
break;
default:
break;
}
for (auto& c : toadd) scope.insert(c);
toadd.clear();
minCount = 2;
cur = point[i][0];
}
j = point[i][1];
if (cur == intervals[j][0]) {
toadd.push_back(j);
} else {
if (count[j] < minCount) minCount = count[j];
scope.erase(j);
}
}
while (scope.size() > 0) {
for (auto& c : scope) {
if (count[c] < minCount) minCount = count[c];
}
}
if (minCount > 2) minCount = 2;
ret += 2 - minCount;
return ret;
}
};
int main(int argc, char* argv[])
{
// input
vector<vector<int>> valueGrid;
Input(valueGrid);
//Output(valueGrid);
// solution
Solution solution;
int ret = solution.intersectionSizeTwo(valueGrid);
// output
Output(ret);
return 0;
}
|
[
"taoliu@verizonmedia.com"
] |
taoliu@verizonmedia.com
|
a9660a9ef1ce31ddec932b0755e1543fd0d5b274
|
4d55312ef918168fd289a1a95ddfee087d7e643a
|
/src/key.h
|
66632f5b0f3e154ebbe99b0b5143d4bcf255f5fc
|
[
"MIT"
] |
permissive
|
decentralway/decentralway
|
c514434ee9afcd05b6e4c539039a0de9937eb3f2
|
d9273a378a673d024e05d382b0d8bdfb4578bc0d
|
refs/heads/master
| 2020-04-26T14:48:34.565785
| 2019-03-11T20:59:58
| 2019-03-11T20:59:58
| 159,785,919
| 1
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 6,232
|
h
|
// Copyright (c) 2009-2010 Satoshi Nakamoto
// Copyright (c) 2009-2014 The Bitcoin developers
// Copyright (c) 2015-2018 The PIVX developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#ifndef Decentralway_KEY_H
#define Decentralway_KEY_H
#include "allocators.h"
#include "serialize.h"
#include "uint256.h"
#include "pubkey.h"
#include <stdexcept>
#include <vector>
class CPubKey;
struct CExtPubKey;
/**
* secure_allocator is defined in allocators.h
* CPrivKey is a serialized private key, with all parameters included
* (PRIVATE_KEY_SIZE bytes)
*/
typedef std::vector<unsigned char, secure_allocator<unsigned char> > CPrivKey;
/** An encapsulated private key. */
class CKey
{
public:
/**
* secp256k1:
*/
static const unsigned int PRIVATE_KEY_SIZE = 279;
static const unsigned int COMPRESSED_PRIVATE_KEY_SIZE = 214;
/**
* see www.keylength.com
* script supports up to 75 for single byte push
*/
static_assert(
PRIVATE_KEY_SIZE >= COMPRESSED_PRIVATE_KEY_SIZE,
"COMPRESSED_PRIVATE_KEY_SIZE is larger than PRIVATE_KEY_SIZE");
private:
//! Whether this private key is valid. We check for correctness when modifying the key
//! data, so fValid should always correspond to the actual state.
bool fValid;
//! Whether the public key corresponding to this private key is (to be) compressed.
bool fCompressed;
//! The actual byte data
std::vector<unsigned char, secure_allocator<unsigned char> > keydata;
//! Check whether the 32-byte array pointed to be vch is valid keydata.
bool static Check(const unsigned char* vch);
public:
//! Construct an invalid private key.
CKey() : fValid(false), fCompressed(false)
{
// Important: vch must be 32 bytes in length to not break serialization
keydata.resize(32);
}
friend bool operator==(const CKey& a, const CKey& b)
{
return a.fCompressed == b.fCompressed &&
a.size() == b.size() &&
memcmp(a.keydata.data(), b.keydata.data(), a.size()) == 0;
}
//! Initialize using begin and end iterators to byte data.
template <typename T>
void Set(const T pbegin, const T pend, bool fCompressedIn)
{
if (size_t(pend - pbegin) != keydata.size()) {
fValid = false;
} else if (Check(&pbegin[0])) {
memcpy(keydata.data(), (unsigned char*)&pbegin[0], keydata.size());
fValid = true;
fCompressed = fCompressedIn;
} else {
fValid = false;
}
}
//! Simple read-only vector-like interface.
unsigned int size() const { return (fValid ? keydata.size() : 0); }
const unsigned char* begin() const { return keydata.data(); }
const unsigned char* end() const { return keydata.data() + size(); }
//! Check whether this private key is valid.
bool IsValid() const { return fValid; }
//! Check whether the public key corresponding to this private key is (to be) compressed.
bool IsCompressed() const { return fCompressed; }
//! Initialize from a CPrivKey (serialized OpenSSL private key data).
bool SetPrivKey(const CPrivKey& vchPrivKey, bool fCompressed);
//! Generate a new private key using a cryptographic PRNG.
void MakeNewKey(bool fCompressed);
uint256 GetPrivKey_256();
/**
* Convert the private key to a CPrivKey (serialized OpenSSL private key data).
* This is expensive.
*/
CPrivKey GetPrivKey() const;
/**
* Compute the public key from a private key.
* This is expensive.
*/
CPubKey GetPubKey() const;
/**
* Create a DER-serialized signature.
* The test_case parameter tweaks the deterministic nonce.
*/
bool Sign(const uint256& hash, std::vector<unsigned char>& vchSig, uint32_t test_case = 0) const;
/**
* Create a compact signature (65 bytes), which allows reconstructing the used public key.
* The format is one header byte, followed by two times 32 bytes for the serialized r and s values.
* The header byte: 0x1B = first key with even y, 0x1C = first key with odd y,
* 0x1D = second key with even y, 0x1E = second key with odd y,
* add 0x04 for compressed keys.
*/
bool SignCompact(const uint256& hash, std::vector<unsigned char>& vchSig) const;
//! Derive BIP32 child key.
bool Derive(CKey& keyChild, ChainCode &ccChild, unsigned int nChild, const ChainCode& cc) const;
/**
* Verify thoroughly whether a private key and a public key match.
* This is done using a different mechanism than just regenerating it.
*/
bool VerifyPubKey(const CPubKey& vchPubKey) const;
//! Load private key and check that public key matches.
bool Load(const CPrivKey& privkey, const CPubKey& vchPubKey, bool fSkipCheck);
//! Check whether an element of a signature (r or s) is valid.
static bool CheckSignatureElement(const unsigned char* vch, int len, bool half);
};
struct CExtKey {
unsigned char nDepth;
unsigned char vchFingerprint[4];
unsigned int nChild;
ChainCode chaincode;
CKey key;
friend bool operator==(const CExtKey& a, const CExtKey& b)
{
return a.nDepth == b.nDepth &&
memcmp(&a.vchFingerprint[0], &b.vchFingerprint[0], sizeof(vchFingerprint)) == 0 &&
a.nChild == b.nChild &&
a.chaincode == b.chaincode &&
a.key == b.key;
}
void Encode(unsigned char code[BIP32_EXTKEY_SIZE]) const;
void Decode(const unsigned char code[BIP32_EXTKEY_SIZE]);
bool Derive(CExtKey& out, unsigned int nChild) const;
CExtPubKey Neuter() const;
void SetMaster(const unsigned char* seed, unsigned int nSeedLen);
};
/** Initialize the elliptic curve support. May not be called twice without calling ECC_Stop first. */
void ECC_Start(void);
/** Deinitialize the elliptic curve support. No-op if ECC_Start wasn't called first. */
void ECC_Stop(void);
/** Check that required EC support is available at runtime. */
bool ECC_InitSanityCheck(void);
#endif // Decentralway_KEY_H
|
[
"info@decentralway.com"
] |
info@decentralway.com
|
b6a00ff8d97c2ffae4581616dea75320158303e8
|
37318e706c9b361dfcce777e65bebd61ec1bf237
|
/MiniTreeReader/EvtLoop_MatrixACR.cxx
|
01883669b240d8fe4b4892e822d423767ad38709
|
[] |
no_license
|
salboa/SMHiggsBosonCrossSection
|
cd9c0a8812f94d8cdd9c527cce1bffa668a3f33e
|
3b93cfd575c781822f7150139c8ed75997bf97a7
|
refs/heads/master
| 2022-11-29T13:46:21.594108
| 2020-07-22T21:39:57
| 2020-07-22T21:39:57
| 281,787,211
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 14,106
|
cxx
|
#include "EventLoop.h"
void EventLoop::FillRecoValues(bool keepTruth){
PRINT_VERBOSE("<EventLoop::FillRecoValues()>:: filling reco values ... ");
for(uint v=0; v<m_diffVars.size(); v++){
int vNum = GetVariableID( m_diffVars[v] );
int bin = GetVariableBin( vNum,mcType::Reco );
if( PassCondition( vNum,bin,mcType::Reco ) ){
bool m_isNonFidBorn = false, m_isNonFidDres = false;
if(m_doTruthMatch){
int binBo = -1, binDr = -1;
/* ROOT Truth Matching */
if(m_useRootTruthMatch){
Int_t treeEntry = PerformTruthMatching(event,run);
if(treeEntry>-1){
m_ThChain->GetEntry(treeEntry);
/* overwrite jet variables if restricted phase space is enabled */
EvaluateJetVariables(mcType::Born);
EvaluateJetVariables(mcType::Dres);
int binBo = GetVariableBin( vNum,mcType::Born );
int binDr = GetVariableBin( vNum,mcType::Dres );
if( bin!=binBo || !PassCondition( vNum,bin,mcType::Born ) ||
thevtType_truth>3 || !PassMassChanFidCondition(mcType::Born) ||
!PassTruthMassCut() ||
event_type!=GetVariableValue(Variable::evtype,mcType::Born) )
m_isNonFidBorn = true;
if( bin!=binDr || !PassCondition( vNum,bin,mcType::Dres ) ||
thevtType_truth>3 || !PassMassChanFidCondition(mcType::Dres) ||
!PassTruthMassCut() ||
event_type!=GetVariableValue(Variable::evtype,mcType::Dres) )
m_isNonFidDres = true;
}
}
/* Alternative Truth Matching */
else{
short int pos = vNum;
short int evtTypeBo = -1;
short int evtTypeDr = -1;
if(m_diffVars.size()==1) pos=1;
if(m_thMtc_Born[run].find(event)!=m_thMtc_Born[run].end() ){
binBo = m_thMtc_Born[run][event].at(pos);
evtTypeBo = m_thMtc_Born[run][event].at(0);
}
if(m_thMtc_Dres[run].find(event)!=m_thMtc_Dres[run].end() ){
binDr = m_thMtc_Dres[run][event].at(pos);
evtTypeDr = m_thMtc_Dres[run][event].at(0);
}
if( bin!=binBo || event_type!=evtTypeBo ) m_isNonFidBorn = true;
if( bin!=binDr || event_type!=evtTypeDr ) m_isNonFidDres = true;
}
}
PRINT_VERBOSE(" isNonFidBorn = "+
std::to_string(m_isNonFidBorn)+" , isNonFidDres = "+
std::to_string(m_isNonFidDres));
if(m_isNonFidBorn){
m_RecoBornVal[m_diffVars[v]][Channel::_incl]->at( bin ).second += mFinWgt;
m_RecoBornVal[m_diffVars[v]][event_type+1] ->at( bin ).second += mFinWgt;
m_RecoBornVal[m_diffVars[v]][m_mrgChan] ->at( bin ).second += mFinWgt;
m_RecoBornRaw[m_diffVars[v]][Channel::_incl]->at( bin ).second += 1;
m_RecoBornRaw[m_diffVars[v]][event_type+1] ->at( bin ).second += 1;
m_RecoBornRaw[m_diffVars[v]][m_mrgChan] ->at( bin ).second += 1;
m_RecoBornValInt[m_diffVars[v]]->at( Channel::_incl ).second += mFinWgt;
m_RecoBornValInt[m_diffVars[v]]->at( event_type+1 ).second += mFinWgt;
m_RecoBornValInt[m_diffVars[v]]->at( m_mrgChan ).second += mFinWgt;
m_RecoBornRawInt[m_diffVars[v]]->at( Channel::_incl ).second += 1;
m_RecoBornRawInt[m_diffVars[v]]->at( event_type+1 ).second += 1;
m_RecoBornRawInt[m_diffVars[v]]->at( m_mrgChan ).second += 1;
}
else{
m_RecoBornVal[m_diffVars[v]][Channel::_incl]->at( bin ).first += mFinWgt;
m_RecoBornVal[m_diffVars[v]][event_type+1] ->at( bin ).first += mFinWgt;
m_RecoBornVal[m_diffVars[v]][m_mrgChan] ->at( bin ).first += mFinWgt;
m_RecoBornRaw[m_diffVars[v]][Channel::_incl]->at( bin ).first += 1;
m_RecoBornRaw[m_diffVars[v]][event_type+1] ->at( bin ).first += 1;
m_RecoBornRaw[m_diffVars[v]][m_mrgChan] ->at( bin ).first += 1;
m_RecoBornValInt[m_diffVars[v]]->at( Channel::_incl ).first += mFinWgt;
m_RecoBornValInt[m_diffVars[v]]->at( event_type+1 ).first += mFinWgt;
m_RecoBornValInt[m_diffVars[v]]->at( m_mrgChan ).first += mFinWgt;
m_RecoBornRawInt[m_diffVars[v]]->at( Channel::_incl ).first += 1;
m_RecoBornRawInt[m_diffVars[v]]->at( event_type+1 ).first += 1;
m_RecoBornRawInt[m_diffVars[v]]->at( m_mrgChan ).first += 1;
}
if(m_isNonFidDres){
m_RecoDresVal[m_diffVars[v]][Channel::_incl]->at( bin ).second += mFinWgt;
m_RecoDresVal[m_diffVars[v]][event_type+1] ->at( bin ).second += mFinWgt;
m_RecoDresVal[m_diffVars[v]][m_mrgChan] ->at( bin ).second += mFinWgt;
m_RecoDresRaw[m_diffVars[v]][Channel::_incl]->at( bin ).second += 1;
m_RecoDresRaw[m_diffVars[v]][event_type+1] ->at( bin ).second += 1;
m_RecoDresRaw[m_diffVars[v]][m_mrgChan] ->at( bin ).second += 1;
m_RecoDresValInt[m_diffVars[v]]->at( Channel::_incl ).second += mFinWgt;
m_RecoDresValInt[m_diffVars[v]]->at( event_type+1 ).second += mFinWgt;
m_RecoDresValInt[m_diffVars[v]]->at( m_mrgChan ).second += mFinWgt;
m_RecoDresRawInt[m_diffVars[v]]->at( Channel::_incl ).second += 1;
m_RecoDresRawInt[m_diffVars[v]]->at( event_type+1 ).second += 1;
m_RecoDresRawInt[m_diffVars[v]]->at( m_mrgChan ).second += 1;
}
else{
m_RecoDresVal[m_diffVars[v]][Channel::_incl]->at( bin ).first += mFinWgt;
m_RecoDresVal[m_diffVars[v]][event_type+1] ->at( bin ).first += mFinWgt;
m_RecoDresVal[m_diffVars[v]][m_mrgChan] ->at( bin ).first += mFinWgt;
m_RecoDresRaw[m_diffVars[v]][Channel::_incl]->at( bin ).first += 1;
m_RecoDresRaw[m_diffVars[v]][event_type+1] ->at( bin ).first += 1;
m_RecoDresRaw[m_diffVars[v]][m_mrgChan] ->at( bin ).first += 1;
m_RecoDresValInt[m_diffVars[v]]->at( Channel::_incl ).first += mFinWgt;
m_RecoDresValInt[m_diffVars[v]]->at( event_type+1 ).first += mFinWgt;
m_RecoDresValInt[m_diffVars[v]]->at( m_mrgChan ).first += mFinWgt;
m_RecoDresRawInt[m_diffVars[v]]->at( Channel::_incl ).first += 1;
m_RecoDresRawInt[m_diffVars[v]]->at( event_type+1 ).first += 1;
m_RecoDresRawInt[m_diffVars[v]]->at( m_mrgChan ).first += 1;
}
}
}
if(m_doTruthMatch && !m_useRootTruthMatch && !keepTruth){
if(m_thMtc_Born[run].find(event)!=m_thMtc_Born[run].end() ) m_thMtc_Born[run].erase(event);
if(m_thMtc_Dres[run].find(event)!=m_thMtc_Dres[run].end() ) m_thMtc_Dres[run].erase(event);
}
}
void EventLoop::FillRecoValues4Mtx(bool keepTruth){
PRINT_VERBOSE("<EventLoop::FillRecoValues4Mtx()>:: filling reco values ... ");
for(uint v=0; v<m_diffVars.size(); v++){
int vNum = GetVariableID( m_diffVars[v] );
int bin = GetVariableBin(vNum,mcType::Reco);
if( PassCondition( vNum,bin,mcType::Reco ) ){
bool m_isNonFidBorn = false, m_isNonFidDres = false;
int binBo = -1, binDr = -1;
/* ROOT Truth Matching */
if(m_useRootTruthMatch){
Int_t treeEntry = PerformTruthMatching(event,run);
if(treeEntry>-1) {
m_ThChain->GetEntry(treeEntry);
/* overwrite jet variables if restricted phase space is enabled */
EvaluateJetVariables(mcType::Born);
EvaluateJetVariables(mcType::Dres);
int binBo = GetVariableBin( vNum,mcType::Born );
int binDr = GetVariableBin( vNum,mcType::Dres );
if( binBo==-1 || !PassCondition( vNum,bin,mcType::Born ) ||
!PassTruthMassCut() || !PassMassChanFidCondition(mcType::Born) ||
thevtType_truth>3 ||
event_type!=GetVariableValue(Variable::evtype,mcType::Born) )
m_isNonFidBorn = true;
if( binDr==-1 || !PassCondition( vNum,bin,mcType::Dres ) ||
!PassTruthMassCut() || !PassMassChanFidCondition(mcType::Dres) ||
thevtType_truth>3 ||
event_type!=GetVariableValue(Variable::evtype,mcType::Dres) )
m_isNonFidDres = true;
}
}
/* Alternative Truth Matching */
else{
short int pos = vNum;
short int evtTypeBo = -1;
short int evtTypeDr = -1;
if(m_diffVars.size()==1) pos=1;
if(m_thMtc_Born[run].find(event)!=m_thMtc_Born[run].end() ){
binBo = m_thMtc_Born[run][event].at(pos);
evtTypeBo = m_thMtc_Born[run][event].at(0);
}
if(m_thMtc_Dres[run].find(event)!=m_thMtc_Dres[run].end() ){
binDr = m_thMtc_Dres[run][event].at(pos);
evtTypeDr = m_thMtc_Dres[run][event].at(0);
}
if( binBo==-1 || event_type!=evtTypeBo ) m_isNonFidBorn = true;
if( binDr==-1 || event_type!=evtTypeDr ) m_isNonFidDres = true;
}
if( m_isNonFidBorn ){
m_NonFidBorn[m_diffVars[v]][Channel::_incl]->at(bin) += mFinWgt;
m_NonFidBorn[m_diffVars[v]][event_type+1]->at(bin) += mFinWgt;
m_NonFidBorn[m_diffVars[v]][m_mrgChan]->at(bin) += mFinWgt;
}
else{
m_RspMtxBorn_Num[m_diffVars[v]][Channel::_incl][bin]->at(binBo) += mFinWgt;
m_RspMtxBorn_Num[m_diffVars[v]][event_type+1][bin]->at(binBo) += mFinWgt;
m_RspMtxBorn_Num[m_diffVars[v]][m_mrgChan][bin]->at(binBo) += mFinWgt;
}
if(m_isNonFidDres){
m_NonFidDres[m_diffVars[v]][Channel::_incl]->at(bin) += mFinWgt;
m_NonFidDres[m_diffVars[v]][event_type+1]->at(bin) += mFinWgt;
m_NonFidDres[m_diffVars[v]][m_mrgChan]->at(bin) += mFinWgt;
}
else{
m_RspMtxDres_Num[m_diffVars[v]][Channel::_incl][bin]->at(binDr) += mFinWgt;
m_RspMtxDres_Num[m_diffVars[v]][event_type+1][bin]->at(binDr) += mFinWgt;
m_RspMtxDres_Num[m_diffVars[v]][m_mrgChan][bin]->at(binDr) += mFinWgt;
}
}
}
if(!m_useRootTruthMatch && !keepTruth){
if(m_thMtc_Born[run].find(event)!=m_thMtc_Born[run].end() ) m_thMtc_Born[run].erase(event);
if(m_thMtc_Dres[run].find(event)!=m_thMtc_Dres[run].end() ) m_thMtc_Dres[run].erase(event);
}
}
void EventLoop::FillTruthValues(){
PRINT_VERBOSE("<EventLoop::FillTruthValues()>:: filling truth values ... ");
/* Integral over whole particle level phase space */
if( m_passThMassCut && thevtType_truth<4 ){
m_TruthInt->at( Channel::_incl ) += mThFinWgt;
m_TruthInt->at( thevtType_truth+1 ) += mThFinWgt;
m_TruthInt->at( m_mrgThChanTruth ) += mThFinWgt;
m_TruthIntRaw->at( Channel::_incl ) += 1;
m_TruthIntRaw->at( thevtType_truth+1 ) += 1;
m_TruthIntRaw->at( m_mrgThChanTruth ) += 1;
for(uint v=0; v<m_diffVars.size(); v++){
int vNum = GetVariableID( m_diffVars[v] );
/* born leptons case */
PRINT_VERBOSE(" filling born values ... ");
if( m_passBornMassChan ){
int bin = GetVariableBin( vNum,mcType::Born );
if( PassCondition( vNum,bin,mcType::Born ) ){
m_FidBornVal[m_diffVars[v]][Channel::_incl] ->at( bin ) += mThFinWgt;
m_FidBornVal[m_diffVars[v]][thevtType_fidBorn+1]->at( bin ) += mThFinWgt;
m_FidBornVal[m_diffVars[v]][m_mrgThChanFidBorn] ->at( bin ) += mThFinWgt;
m_FidBornRaw[m_diffVars[v]][Channel::_incl] ->at( bin ) += 1;
m_FidBornRaw[m_diffVars[v]][thevtType_fidBorn+1]->at( bin ) += 1;
m_FidBornRaw[m_diffVars[v]][m_mrgThChanFidBorn] ->at( bin ) += 1;
m_FidBornValInt[m_diffVars[v]]->at( Channel::_incl ) += mThFinWgt;
m_FidBornValInt[m_diffVars[v]]->at( thevtType_fidBorn+1 ) += mThFinWgt;
m_FidBornValInt[m_diffVars[v]]->at( m_mrgThChanFidBorn ) += mThFinWgt;
m_FidBornRawInt[m_diffVars[v]]->at( Channel::_incl ) += 1;
m_FidBornRawInt[m_diffVars[v]]->at( thevtType_fidBorn+1 ) += 1;
m_FidBornRawInt[m_diffVars[v]]->at( m_mrgThChanFidBorn ) += 1;
if (m_useMatrix){
m_RspMtxBorn_Denom[m_diffVars[v]][Channel::_incl]->at(bin) += mThFinWgt;
m_RspMtxBorn_Denom[m_diffVars[v]][thevtType_fidBorn+1]->at(bin) += mThFinWgt;
m_RspMtxBorn_Denom[m_diffVars[v]][m_mrgThChanFidBorn]->at(bin) += mThFinWgt;
}
}
}
/* dressed leptons case */
PRINT_VERBOSE(" filling dressed values ... ");
if( m_passDresMassChan ){
int bin = GetVariableBin( vNum,mcType::Dres );
if( PassCondition( vNum,bin,mcType::Dres ) ){
m_FidDresVal[m_diffVars[v]][Channel::_incl] ->at( bin ) += mThFinWgt;
m_FidDresVal[m_diffVars[v]][thevtType_fidDres+1]->at( bin ) += mThFinWgt;
m_FidDresVal[m_diffVars[v]][m_mrgThChanFidDres] ->at( bin ) += mThFinWgt;
m_FidDresRaw[m_diffVars[v]][Channel::_incl] ->at( bin ) += 1;
m_FidDresRaw[m_diffVars[v]][thevtType_fidDres+1]->at( bin ) += 1;
m_FidDresRaw[m_diffVars[v]][m_mrgThChanFidDres] ->at( bin ) += 1;
m_FidDresValInt[m_diffVars[v]]->at( Channel::_incl ) += mThFinWgt;
m_FidDresValInt[m_diffVars[v]]->at( thevtType_fidDres+1 ) += mThFinWgt;
m_FidDresValInt[m_diffVars[v]]->at( m_mrgThChanFidDres ) += mThFinWgt;
m_FidDresRawInt[m_diffVars[v]]->at( Channel::_incl ) += 1;
m_FidDresRawInt[m_diffVars[v]]->at( thevtType_fidDres+1 ) += 1;
m_FidDresRawInt[m_diffVars[v]]->at( m_mrgThChanFidDres ) += 1;
if (m_useMatrix){
m_RspMtxDres_Denom[m_diffVars[v]][Channel::_incl]->at(bin) += mThFinWgt;
m_RspMtxDres_Denom[m_diffVars[v]][thevtType_fidDres+1]->at(bin) += mThFinWgt;
m_RspMtxDres_Denom[m_diffVars[v]][m_mrgThChanFidDres]->at(bin) += mThFinWgt;
}
}
}
/* truth particle level */
PRINT_VERBOSE(" filling truth values ... ");
int bin = GetVariableBin( vNum,mcType::Truth );
if( PassCondition( vNum,bin,mcType::Truth ) ){
m_TruthVal[m_diffVars[v]][Channel::_incl] ->at( bin ) += mThFinWgt;
m_TruthVal[m_diffVars[v]][thevtType_truth+1]->at( bin ) += mThFinWgt;
m_TruthVal[m_diffVars[v]][m_mrgThChanTruth] ->at( bin ) += mThFinWgt;
m_TruthRaw[m_diffVars[v]][Channel::_incl] ->at( bin ) += 1;
m_TruthRaw[m_diffVars[v]][thevtType_truth+1]->at( bin ) += 1;
m_TruthRaw[m_diffVars[v]][m_mrgThChanTruth] ->at( bin ) += 1;
m_TruthValInt[m_diffVars[v]]->at( Channel::_incl ) += mThFinWgt;
m_TruthValInt[m_diffVars[v]]->at( thevtType_truth+1 ) += mThFinWgt;
m_TruthValInt[m_diffVars[v]]->at( m_mrgThChanTruth ) += mThFinWgt;
m_TruthRawInt[m_diffVars[v]]->at( Channel::_incl ) += 1;
m_TruthRawInt[m_diffVars[v]]->at( thevtType_truth+1 ) += 1;
m_TruthRawInt[m_diffVars[v]]->at( m_mrgThChanTruth ) += 1;
}
}
}
}
|
[
"antonio.salvucci@cern.ch"
] |
antonio.salvucci@cern.ch
|
c36122d2600308493c8a7d92813a1dec6018022c
|
b053cbade6bcb5274cab4a94f9113a2b74007ef2
|
/matlab_version/mexopencv-master/opencv_contrib/src/+cv/detectMarkers.cpp
|
fe15f2fb385c53a2f36b7c578ec12993fe9c6e27
|
[
"BSD-3-Clause"
] |
permissive
|
neviko/Video-based-attack
|
82f3cda00fff701e9450b9940118e44f433aaeb2
|
19c5d6d320720a1f2ff09f8f160d0fbf2a7920c0
|
refs/heads/master
| 2020-01-23T21:29:56.654382
| 2017-07-12T19:28:14
| 2017-07-12T19:28:14
| 81,644,127
| 4
| 2
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,632
|
cpp
|
/**
* @file detectMarkers.cpp
* @brief mex interface for cv::aruco::detectMarkers
* @ingroup aruco
* @author Amro
* @date 2016
*/
#include "mexopencv.hpp"
#include "mexopencv_aruco.hpp"
using namespace std;
using namespace cv;
using namespace cv::aruco;
/**
* Main entry called from Matlab
* @param nlhs number of left-hand-side arguments
* @param plhs pointers to mxArrays in the left-hand-side
* @param nrhs number of right-hand-side arguments
* @param prhs pointers to mxArrays in the right-hand-side
*/
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
{
// Check the number of arguments
nargchk(nrhs>=2 && (nrhs%2)==0 && nlhs<=3);
// Argument vector
vector<MxArray> rhs(prhs, prhs+nrhs);
// Option processing
Ptr<DetectorParameters> params;
for (int i=2; i<nrhs; i+=2) {
string key(rhs[i].toString());
if (key == "DetectorParameters")
params = MxArrayToDetectorParameters(rhs[i+1]);
else
mexErrMsgIdAndTxt("mexopencv:error",
"Unrecognized option %s", key.c_str());
}
if (params.empty())
params = DetectorParameters::create();
// Process
Mat image(rhs[0].toMat(CV_8U));
Ptr<Dictionary> dictionary = MxArrayToDictionary(rhs[1]);
vector<vector<Point2f> > corners, rejectedImgPoints;
vector<int> ids;
detectMarkers(image, dictionary, corners, ids, params,
(nlhs==3) ? rejectedImgPoints : noArray());
plhs[0] = MxArray(corners);
if (nlhs > 1)
plhs[1] = MxArray(ids);
if (nlhs > 2)
plhs[2] = MxArray(rejectedImgPoints);
}
|
[
"nevosayag@gmail.com"
] |
nevosayag@gmail.com
|
9c17ef99268c00975e87f9906a76f0338e40d82b
|
be6abd934f39cb42a3664a96e7ea252c71371301
|
/Store Backend/Customer.h
|
6b338a067ba2477150e62bf27b7509942947fb7a
|
[] |
no_license
|
Jared-DeLeon/Store-BackEnd
|
8f9e044f0cd8758105c055f40205c26ebceb12eb
|
c4d0c9cf3617d41199509e68d330bd36b3df082a
|
refs/heads/master
| 2020-04-20T13:36:14.848615
| 2019-02-02T20:14:44
| 2019-02-02T20:14:44
| 168,873,229
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 776
|
h
|
#ifndef CUSTOMER_H
#define CUSTOMER_H
#include <iostream>
#include "Product.h"
class Customer {
int ID;
char name[100];
bool credit;
double balance;
char productsPurchased[5][100];
int numPurchased;
static int counter; // declares but does not define
public:
Customer(int customerID, const char name[], bool credit=false);
int getID() const;
const char* getName() const;
void setName(char const customerName[]);
bool getCredit() const;
void setCredit(bool hasCredit);
double getBalance() const;
bool processPayment(double amount);
bool processPurchase(double amount, Product product);
void outputRecentPurchases(std::ostream& os) const;
};
std::ostream& operator<<(std::ostream& os, const Customer& customer);
#endif
|
[
"noreply@github.com"
] |
Jared-DeLeon.noreply@github.com
|
c57f5ba287afbaaaf5b84d5d37ca82c9e5f830cb
|
410e7ecb6faf51412114d8dcf183cdad6fc7e7b8
|
/3Engine/src/Math/Vector4.h
|
23e62beaf940c9ebae1d0bfba7cf52470472d96d
|
[
"MIT"
] |
permissive
|
RicardoEPRodrigues/3Engine
|
9f77a8b7bb86e13e83988ee756bb89809c71e4c7
|
885029c1e7d3a3267134538a8f8de567cdb1ec00
|
refs/heads/master
| 2022-12-25T20:05:18.809315
| 2022-12-13T12:08:55
| 2022-12-13T12:08:55
| 104,476,020
| 6
| 2
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 12,160
|
h
|
/*
* File Vector4.h in project ThreeEngine
*
* Copyright (C) Ricardo Rodrigues 2017 - All Rights Reserved
*/
#ifndef THREEENGINE_VECTOR4_H
#define THREEENGINE_VECTOR4_H
#include "Maths.h"
#include "Vector.h"
namespace ThreeEngine {
struct Vector4 {
number X, Y, Z, W;
/** A zero vector (0,0,0) */
static const Vector4 ZeroVector;
/** One vector (1,1,1) */
static const Vector4 OneVector;
/** World up vector (0,0,1) */
static const Vector4 UpVector;
/** Unreal forward vector (1,0,0) */
static const Vector4 ForwardVector;
/** Unreal right vector (0,1,0) */
static const Vector4 LeftVector;
Vector4();
explicit Vector4(number in);
Vector4(number inX, number inY, number inZ, number inW = 1.0f);
explicit Vector4(const Vector2& other, number inZ = 0,
number inW = 1.0f);
explicit Vector4(const Vector& other, number inW = 1.0f);
Vector4(const Vector4& other);
Vector4& operator=(const Vector4& other);
static Vector4 GetRandom(const number& max);
/**
* Calculate the cross product between this and another vector.
*
* @param V The other vector.
* @return The cross product.
*/
Vector4 operator^(const Vector4& V) const;
/**
* Calculate the cross product of two vectors.
*
* @param A The first vector.
* @param B The second vector.
* @return The cross product.
*/
static Vector4 CrossProduct(const Vector4& A, const Vector4& B);
/**
* Calculate the dot product between this and another vector.
*
* @param V The other vector.
* @return The dot product.
*/
number operator|(const Vector4& V) const;
/**
* Calculate the dot product of two vectors.
*
* @param A The first vector.
* @param B The second vector.
* @return The dot product.
*/
static number DotProduct(const Vector4& A, const Vector4& B);
/**
* Calculate the 3D vector dot product of two vectors.
*
* @param A The first vector.
* @param B The second vector.
* @return The dot product.
*/
static number DotProduct3(const Vector4& A, const Vector4& B);
/**
* Gets the result of component-wise addition of this and another vector.
*
* @param V The vector to add to this.
* @return The result of vector addition.
*/
Vector4 operator+(const Vector4& V) const;
/**
* Gets the result of component-wise subtraction of this by another vector.
*
* @param V The vector to subtract from this.
* @return The result of vector subtraction.
*/
Vector4 operator-(const Vector4& V) const;
/**
* Gets the result of subtracting from each component of the vector.
*
* @param value How much to subtract from each component.
* @return The result of subtraction.
*/
Vector4 operator-(number value) const;
/**
* Gets the result of adding to each component of the vector.
*
* @param value How much to add to each component.
* @return The result of addition.
*/
Vector4 operator+(number value) const;
/**
* Gets the result of scaling the vector (multiplying each component by a value).
*
* @param scale What to multiply each component by.
* @return The result of multiplication.
*/
Vector4 operator*(number scale) const;
/**
* Gets the result of dividing each component of the vector by a value.
*
* @param scale What to divide each component by.
* @return The result of division.
*/
Vector4 operator/(number scale) const;
/**
* Gets the result of component-wise multiplication of this vector by another.
*
* @param V The vector to multiply with.
* @return The result of multiplication.
*/
Vector4 operator*(const Vector4& V) const;
/**
* Gets the result of component-wise division of this vector by another.
*
* @param V The vector to divide by.
* @return The result of division.
*/
Vector4 operator/(const Vector4& V) const;
/**
* Check against another vector for equality.
*
* @param V The vector to check against.
* @return true if the vectors are equal, false otherwise.
*/
bool operator==(const Vector4& V) const;
/**
* Check against another vector for inequality.
*
* @param V The vector to check against.
* @return true if the vectors are not equal, false otherwise.
*/
bool operator!=(const Vector4& V) const;
/**
* Get a negated copy of the vector.
*
* @return A negated copy of the vector.
*/
Vector4 operator-() const;
/**
* Adds another vector to this.
*
* @param V Vector to add to this.
* @return Copy of the vector after addition.
*/
Vector4 operator+=(const Vector4& V);
/**
* Adds a scalar to this.
*
* @param in Scalar to add to this.
* @return Copy of the vector after addition.
*/
Vector4 operator+=(number in);
/**
* Subtracts another vector from this.
*
* @param V Vector to subtract from this.
* @return Copy of the vector after subtraction.
*/
Vector4 operator-=(const Vector4& V);
/**
* Subtracts a scalar from this.
*
* @param in Scalar to add to this.
* @return Copy of the vector after subtraction.
*/
Vector4 operator-=(number in);
/**
* Scales the vector.
*
* @param in Amount to scale this vector by.
* @return Copy of the vector after scaling.
*/
Vector4 operator*=(number in);
/**
* Divides the vector by a number.
*
* @param in What to divide this vector by.
* @return Copy of the vector after division.
*/
Vector4 operator/=(number in);
/**
* Multiplies the vector with another vector, using component-wise multiplication.
*
* @param V What to multiply this vector with.
* @return Copy of the vector after multiplication.
*/
Vector4 operator*=(const Vector4& V);
/**
* Divides the vector by another vector, using component-wise division.
*
* @param V What to divide vector by.
* @return Copy of the vector after division.
*/
Vector4 operator/=(const Vector4& V);
/**
* Adds one to the vector.
*
* @return Reference to this vector after addition.
*/
Vector4& operator++();
/**
* Subtract one to the vector.
*
* @return Reference to this vector after subtraction.
*/
Vector4& operator--();
/**
* Results in a vector where each element is the value subtracted with the vector's component.
* @param value to subtract from.
* @param vector to subtract with.
* @return returns a vector after subtraction.
*/
friend Vector4 operator-(const number& value, const Vector4& vector);
/**
* Results in a vector where each element is the value added with the vector's component.
* @param value to add to.
* @param vector to add with.
* @return returns a vector after addition.
*/
friend Vector4 operator+(const number& value, const Vector4& vector);
/**
* Results in a vector where each element is the value multiplied with the vector's component.
* @param value to multiply to.
* @param vector to multiply with.
* @return returns a vector after multiplying.
*/
friend Vector4 operator*(const number& value, const Vector4& vector);
/**
* Results in a vector where each element is the value divided with the vector's component.
* @param value to divide to.
* @param vector to divide with.
* @return returns a vector after division.
*/
friend Vector4 operator/(const number& value, const Vector4& vector);
/**
* Sets the vectors components to the given values
*
* @param inX X coordinate
* @param inY Y coordinate
* @param inZ Z coordinate
*/
void Set(const number& inX, const number& inY, const number& inZ);
/**
* Normalize this vector in-place if it is large enough.
*
* @return true if the vector was normalized correctly, false otherwise.
*/
bool Normalize();
/**
* Checks whether vector is normalized.
*
* @return true if Normalized, false otherwise.
*/
bool IsNormalized() const;
/**
* Gets specific component of the vector.
*
* @param Index the index of vector component
* @return reference to component.
*/
float& operator[](int Index);
/**
* Gets specific component of the vector.
*
* @param Index the index of vector component
* @return reference to component.
*/
float operator[](int Index) const;
/**
* Sets the vectors components to the given values
*
* @param inX X coordinate
* @param inY Y coordinate
* @param inZ Z coordinate
* @param inW W coordinate
*/
void Set(const number& inX, const number& inY, const number& inZ,
const number& inW);
friend std::ostream&
operator<<(std::ostream& os, const Vector4& vector) {
os << "{ " << vector.X << ", " << vector.Y << ", " << vector.Z
<< ", " << vector.W
<< " }" << std::endl;
return os;
};
friend std::istream& operator>>(std::istream& is, Vector4& vector) {
is >> vector.X >> vector.Y >> vector.Z >> vector.W;
return is;
};
operator std::string() const {
return std::string(
"{ " + std::to_string(X) + ", " + std::to_string(Y) + ", " +
std::to_string(Z) + ", " + std::to_string(W) + " }");
}
operator Vector() const {
return Vector(X, Y, Z);
}
operator Vector2() const {
return Vector2(X, Y);
}
/**
* Calculates the distance value of the Vector3 in this vector
* @return Distance of the vector3
*/
number Dist3() const;
/**
* Calculates the square of the distance value of the Vector3 in this vector
* @return Square of the distance of the vector3
*/
number DistSquared3() const;
/**
* Calculates the distance value of this vector
* @return Distance
*/
number Dist() const;
/**
* Calculates the square of the distance value of this vector
* @return Square of the distance
*/
number DistSquared() const;
/**
* Calculates the projection of this vector onto the given one.
* @param A vector to project onto.
* @return Vector that resulted from the projection.
*/
Vector4 ProjectOnTo(const Vector4& A) const;
Vector4 Dehomogenize();
};
} /* namespace Divisaction */
#endif //THREEENGINE_VECTOR4_H
|
[
"ricardo.e.p.rodrigues@gmail.com"
] |
ricardo.e.p.rodrigues@gmail.com
|
fd840bc16e1958624ecd559dcb16617d4c593c8a
|
0fd90b44740098c00edd516debb0a5fa1bbd333f
|
/lexical.cpp
|
62e17c4ec7b384356ce193b6c3c67fa3738b6e96
|
[] |
no_license
|
MennaElKammah/Compiler-Phase--2--Parser-Generator
|
dbbe42b2c466dbacaa527c5c189e985fa8b3287b
|
ffe1d0868adb91dbb659f739ca371d7cbf027e0d
|
refs/heads/master
| 2020-12-30T13:46:54.182715
| 2017-05-14T16:44:42
| 2017-05-14T16:44:42
| 91,257,508
| 1
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 277
|
cpp
|
#include<NFA.h>
Node* NFA::construct_nfa (char op, string[] operands) {
if (op == '*') {
}
else if (op == '+') {
}
else if (op == '|') {
}
else if (op == '@') { // For concatination
}
else {
cout << "Error!" << endl;
}
}
|
[
"mennats@yahoo.com"
] |
mennats@yahoo.com
|
d5e8299fd3b1eaeff0852dcafb1a5554799aa690
|
01a42b69633daf62a2eb3bb70c5b1b6e2639aa5f
|
/SCUM_BP_Magazine_M16_parameters.hpp
|
a0684d7d14db5a5f71f27f4775343351fb92ea2a
|
[] |
no_license
|
Kehczar/scum_sdk
|
45db80e46dac736cc7370912ed671fa77fcb95cf
|
8d1770b44321a9d0b277e4029551f39b11f15111
|
refs/heads/master
| 2022-07-25T10:06:20.892750
| 2020-05-21T11:45:36
| 2020-05-21T11:45:36
| 265,826,541
| 1
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 2,677
|
hpp
|
#pragma once
// Scum 3.79.22573 (UE 4.24)
#ifdef _MSC_VER
#pragma pack(push, 0x8)
#endif
#include "../SDK.hpp"
namespace Classes
{
//---------------------------------------------------------------------------
//Parameters
//---------------------------------------------------------------------------
// Function ConZ.WeaponAttachmentMagazine.SetAmmoCount
struct ABP_Magazine_M16_C_SetAmmoCount_Params
{
int* Amount; // (Parm, ZeroConstructor, IsPlainOldData)
};
// Function ConZ.WeaponAttachmentMagazine.Server_InsertCartridgeIntoMagazine
struct ABP_Magazine_M16_C_Server_InsertCartridgeIntoMagazine_Params
{
class AAmmunitionItem** ammo; // (Parm, ZeroConstructor, IsPlainOldData)
};
// Function ConZ.WeaponAttachmentMagazine.OnRep_AmmoCountOwnerHelper
struct ABP_Magazine_M16_C_OnRep_AmmoCountOwnerHelper_Params
{
};
// Function ConZ.WeaponAttachmentMagazine.OnRep_AmmoCount
struct ABP_Magazine_M16_C_OnRep_AmmoCount_Params
{
};
// Function ConZ.WeaponAttachmentMagazine.OnAmmoChangedEvent
struct ABP_Magazine_M16_C_OnAmmoChangedEvent_Params
{
};
// Function ConZ.WeaponAttachmentMagazine.Multicast_SetLoadedVariables
struct ABP_Magazine_M16_C_Multicast_SetLoadedVariables_Params
{
int* ammoCount; // (Parm, ZeroConstructor, IsPlainOldData)
};
// Function ConZ.WeaponAttachmentMagazine.GetProjectileClass
struct ABP_Magazine_M16_C_GetProjectileClass_Params
{
class UClass* ReturnValue; // (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData)
};
// Function ConZ.WeaponAttachmentMagazine.GetCapacity
struct ABP_Magazine_M16_C_GetCapacity_Params
{
int ReturnValue; // (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData)
};
// Function ConZ.WeaponAttachmentMagazine.GetAmmoCount
struct ABP_Magazine_M16_C_GetAmmoCount_Params
{
int ReturnValue; // (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData)
};
// Function ConZ.WeaponAttachmentMagazine.AddAmmo
struct ABP_Magazine_M16_C_AddAmmo_Params
{
int* Amount; // (Parm, ZeroConstructor, IsPlainOldData)
};
}
#ifdef _MSC_VER
#pragma pack(pop)
#endif
|
[
"65712402+Kehczar@users.noreply.github.com"
] |
65712402+Kehczar@users.noreply.github.com
|
52a749e213ef32832cf1c11db0228acf0d876169
|
2670562b40fea67283cc2c33ed68f0e24745b345
|
/src/time_get.cpp
|
17b5d2fcf4e75d3fa2869d59e8d659d4d2227186
|
[] |
no_license
|
nyokkirokki/RSS_Clock
|
695dabb01f2942844dbf6d46f66880342af7db4e
|
96d6d8d91dd06c0be03fb80f56a608e0c0e32c3e
|
refs/heads/master
| 2023-08-05T05:39:03.967895
| 2021-09-24T05:11:15
| 2021-09-24T05:11:15
| 408,924,303
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,565
|
cpp
|
// ###########################################################
//
// NTPサーバーから時刻取得 time_get.cpp
//
//
//
// ###########################################################
#include <Arduino.h>
#include <string.h>
#include <time.h>
#include "time_get.hpp"
#include "News_Get.hpp"
int nYear = 0;
byte nMon = 0;
int nDay = 0;
byte nHour = 0;
byte nMin = 0;
int nSec = 0;
unsigned int gettime = 0;
unsigned char flag = 0;
String time_now() {
String tt = "";
again:
if((millis()/1000) - gettime > 1000 || flag == 0){
wifiConnect();
configTime(9 * 3600L, 0, "ntp.nict.jp", "time.google.com", "ntp.jst.mfeed.ad.jp");//NTPの設定
wifiDisconnect();
gettime = (millis()/1000);
flag = 1;
}
struct tm timeInfo;
getLocalTime(&timeInfo);
if(timeInfo.tm_year == 70){
flag = 0;
goto again;
}
nYear = timeInfo.tm_year + 1900;
nMon = timeInfo.tm_mon + 1;
nDay = timeInfo.tm_mday;
nHour = timeInfo.tm_hour;
nMin = timeInfo.tm_min;
nSec = timeInfo.tm_sec;
String NYear = String(nYear);
String NMon = String(nMon);
String NDay = String(nDay);
String NHour = String(nHour);
String NMin = String(nMin);
String NSec = String(nSec);
tt = "現在時間: ";
tt = tt + NYear + "年" + NMon + "月" + NDay + "日";
tt = tt + " ";
tt = tt + NHour + "時" + NMin + "分" + NSec + "秒";
tt = tt + " ";
return tt;
}
|
[
"tatsushi1119@live.jp"
] |
tatsushi1119@live.jp
|
cf4371057ea6295e284a830e08f98ca7dd1a377e
|
c51febc209233a9160f41913d895415704d2391f
|
/library/ATF/LPFILTERKEYS.hpp
|
d3f7e3e050b7a223c237a84a8b4d22859102ff23
|
[
"MIT"
] |
permissive
|
roussukke/Yorozuya
|
81f81e5e759ecae02c793e65d6c3acc504091bc3
|
d9a44592b0714da1aebf492b64fdcb3fa072afe5
|
refs/heads/master
| 2023-07-08T03:23:00.584855
| 2023-06-29T08:20:25
| 2023-06-29T08:20:25
| 463,330,454
| 0
| 0
|
MIT
| 2022-02-24T23:15:01
| 2022-02-24T23:15:00
| null |
UTF-8
|
C++
| false
| false
| 260
|
hpp
|
// This file auto generated by plugin for ida pro. Generated code only for x64. Please, dont change manually
#pragma once
#include <common/common.h>
#include <tagFILTERKEYS.hpp>
START_ATF_NAMESPACE
typedef tagFILTERKEYS *LPFILTERKEYS;
END_ATF_NAMESPACE
|
[
"b1ll.cipher@yandex.ru"
] |
b1ll.cipher@yandex.ru
|
8dc5609afda81034d0a3e8121aa38a2899a252ae
|
b6d2cb74a76194fd25fdc3607ef828e94d98039e
|
/URI/2521.cpp
|
879500c1d71aa2a730ad5eb985b9602e7be33128
|
[] |
no_license
|
giovaneaf/CompetitiveProgramming
|
22d63481015ab45a03d527c866cae339cffeb5fb
|
863f6bc61497591cb98e50973aa23bfcb9879ab8
|
refs/heads/master
| 2021-06-07T20:28:45.116299
| 2021-05-25T00:38:16
| 2021-05-25T00:38:16
| 131,643,425
| 6
| 1
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 953
|
cpp
|
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define ii pair<int, int>
#define vi vector<int>
#define vii vector<ii>
#define vb vector<bool>
#define fst first
#define snd second
#define MAXN 40
#define LOGMAXN 20
#define FOR(a, b, c) for(int a = b; a < c; ++a)
#define RFOR(a, b, c) for(int a = b; a >= c; --a)
#define mp(a, b) make_pair(a, b)
#define INF 1e9
#define EPS 1e-9
const double pi = atan(1)*4;
int n, m;
int main()
{
ios_base::sync_with_stdio(false); cin.tie(0);
int r, la, lo;
while(cin >> r >> la >> lo)
{
double x, y, z, p;
y = fabs(r*sin(la*pi/180.0));
p = fabs(r*cos(la*pi/180.0));
x = fabs(p*sin(lo*pi/180.0));
z = fabs(p*cos(lo*pi/180.0));
int rx, ry, rz;
rx = round(100*x);
ry = round(100*y);
rz = round(100*z);
if(la < 0 && ry > 0) y *= -1.0;
if(lo < 0 && rx > 0) x *= -1.0;
if(-90 < lo && lo < 90 && rz > 0) z *= -1.0;
printf("%.2f %.2f %.2f\n", x, y, z);
}
return 0;
}
|
[
"giovaneaf1995@gmail.com"
] |
giovaneaf1995@gmail.com
|
989c62103118bb47d76c3d1d91cc684744203211
|
348a1145bc5f22c5fff202010f9f4c494d4abb31
|
/opm/parser/eclipse/IntegrationTests/ParsePLYSHLOG.cpp
|
4e3698cd84376d803a94066c29fd9474ba56ea6a
|
[] |
no_license
|
edbru/opm-parser
|
072c0c44b161788ff301db23b5bde5b5fa1c34cf
|
ee09eefd7f85e7babebb7e856e3155dc213e7a57
|
refs/heads/master
| 2021-01-23T23:39:20.783393
| 2015-06-15T15:29:54
| 2015-06-15T15:29:54
| 32,381,359
| 0
| 0
| null | 2015-03-17T08:43:18
| 2015-03-17T08:43:18
| null |
UTF-8
|
C++
| false
| false
| 2,344
|
cpp
|
/*
Copyright 2015 SINTEF ICT, Applied Mathematics.
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
#define BOOST_TEST_MODULE ParsePLYSHLOG
#include <math.h>
#include <boost/test/unit_test.hpp>
#include <boost/test/test_tools.hpp>
#include <opm/parser/eclipse/Deck/Deck.hpp>
#include <opm/parser/eclipse/Parser/Parser.hpp>
#include <opm/parser/eclipse/EclipseState/EclipseState.hpp>
using namespace Opm;
BOOST_AUTO_TEST_CASE( PARSE_PLYSHLOG_OK) {
ParserPtr parser(new Parser());
boost::filesystem::path deckFile("testdata/integration_tests/POLYMER/plyshlog.data");
DeckPtr deck = parser->parseFile(deckFile.string());
DeckKeywordConstPtr kw = deck->getKeyword("PLYSHLOG");
DeckRecordConstPtr rec1 = kw->getRecord(0); // reference conditions
const auto itemRefPolyConc = rec1->getItem("REF_POLYMER_CONCENTRATION");
const auto itemRefSali = rec1->getItem("REF_SALINITY");
const auto itemRefTemp = rec1->getItem("REF_TEMPERATURE");
BOOST_CHECK_EQUAL( true, itemRefPolyConc->hasValue(0) );
BOOST_CHECK_EQUAL( true, itemRefSali->hasValue(0) );
BOOST_CHECK_EQUAL( false, itemRefTemp->hasValue(0) );
BOOST_CHECK_EQUAL( 1.0, itemRefPolyConc->getRawDouble(0) );
BOOST_CHECK_EQUAL( 3.0, itemRefSali->getRawDouble(0) );
DeckRecordConstPtr rec2 = kw->getRecord(1);
DeckItemPtr itemData = rec2->getItem(0);
BOOST_CHECK_EQUAL( 1.e-7 , itemData->getRawDouble(0) );
BOOST_CHECK_EQUAL( 1.0 , itemData->getRawDouble(1) );
BOOST_CHECK_EQUAL( 1.0 , itemData->getRawDouble(2) );
BOOST_CHECK_EQUAL( 1.2 , itemData->getRawDouble(3) );
BOOST_CHECK_EQUAL( 1.e3 , itemData->getRawDouble(4) );
BOOST_CHECK_EQUAL( 2.4 , itemData->getRawDouble(5) );
}
|
[
"kai.bao@sintef.no"
] |
kai.bao@sintef.no
|
676d3569dcf3bfd917cfbefce68bd7027bb013b2
|
cc30f3931bf83101794e62ac6f58141ffef3c93d
|
/programs_from_the_book/ch19/V3.h
|
62849b19b00e3a63e2d63b2fa6f2be5506bfcebe
|
[] |
no_license
|
Simplecpp/Simplecpp-sourcecode
|
bc046327c3f9f04c128ae3daedbd32156cbf8c34
|
aa5f757beb72b8d66c601d949de51680df8d39cf
|
refs/heads/master
| 2021-01-22T02:53:52.294049
| 2014-06-24T10:10:34
| 2014-06-24T10:10:34
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 368
|
h
|
class V3{
double x, y, z;
public:
V3(double x=0, double y=0, double z=0);
V3 operator+(V3 const &w) const;
V3 operator-(V3 const &w) const;
V3 operator*(double t);
double getx(); // accessor functions
double gety();
double getz();
friend ostream & operator<<(ostream & ost, V3 v);
double length();
};
ostream & operator<<(ostream & ost, V3 v);
|
[
"vemireddy@vemireddy.(none)"
] |
vemireddy@vemireddy.(none)
|
bce07594546d7be3481536f58a67164a3afa49bb
|
a170461845f5b240daf2090810b4be706191f837
|
/pyqt/DemoUIonly-PythonQt/chap06Forms/Demo6_2CustomDialog/QtApp/ui_QWDialogHeaders.h
|
e3ae3411af1044e5ca83670db6a71079dcbc6e62
|
[] |
no_license
|
longhuarst/QTDemo
|
ec3873f85434c61cd2a8af7e568570d62c2e6da8
|
34f87f4b2337a140122b7c38937ab4fcf5f10575
|
refs/heads/master
| 2022-04-25T10:59:54.434587
| 2020-04-26T16:55:29
| 2020-04-26T16:55:29
| 259,048,398
| 1
| 1
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 5,680
|
h
|
/********************************************************************************
** Form generated from reading UI file 'QWDialogHeaders.ui'
**
** Created by: Qt User Interface Compiler version 5.10.1
**
** WARNING! All changes made in this file will be lost when recompiling UI file!
********************************************************************************/
#ifndef UI_QWDIALOGHEADERS_H
#define UI_QWDIALOGHEADERS_H
#include <QtCore/QVariant>
#include <QtWidgets/QAction>
#include <QtWidgets/QApplication>
#include <QtWidgets/QButtonGroup>
#include <QtWidgets/QDialog>
#include <QtWidgets/QFrame>
#include <QtWidgets/QGroupBox>
#include <QtWidgets/QHBoxLayout>
#include <QtWidgets/QHeaderView>
#include <QtWidgets/QListView>
#include <QtWidgets/QPushButton>
#include <QtWidgets/QSpacerItem>
#include <QtWidgets/QVBoxLayout>
QT_BEGIN_NAMESPACE
class Ui_QWDialogHeaders
{
public:
QVBoxLayout *verticalLayout_3;
QHBoxLayout *horizontalLayout;
QGroupBox *groupBox;
QVBoxLayout *verticalLayout;
QListView *listView;
QFrame *frame;
QVBoxLayout *verticalLayout_2;
QSpacerItem *verticalSpacer_4;
QPushButton *btnOK;
QSpacerItem *verticalSpacer_2;
QPushButton *btnCancel;
QSpacerItem *verticalSpacer;
QSpacerItem *verticalSpacer_6;
QSpacerItem *verticalSpacer_5;
QSpacerItem *verticalSpacer_3;
void setupUi(QDialog *QWDialogHeaders)
{
if (QWDialogHeaders->objectName().isEmpty())
QWDialogHeaders->setObjectName(QStringLiteral("QWDialogHeaders"));
QWDialogHeaders->resize(289, 318);
QFont font;
font.setPointSize(10);
QWDialogHeaders->setFont(font);
verticalLayout_3 = new QVBoxLayout(QWDialogHeaders);
verticalLayout_3->setObjectName(QStringLiteral("verticalLayout_3"));
verticalLayout_3->setContentsMargins(5, 5, 5, 5);
horizontalLayout = new QHBoxLayout();
horizontalLayout->setObjectName(QStringLiteral("horizontalLayout"));
groupBox = new QGroupBox(QWDialogHeaders);
groupBox->setObjectName(QStringLiteral("groupBox"));
verticalLayout = new QVBoxLayout(groupBox);
verticalLayout->setSpacing(4);
verticalLayout->setObjectName(QStringLiteral("verticalLayout"));
verticalLayout->setContentsMargins(5, 5, 5, 5);
listView = new QListView(groupBox);
listView->setObjectName(QStringLiteral("listView"));
listView->setDragDropMode(QAbstractItemView::InternalMove);
listView->setDefaultDropAction(Qt::MoveAction);
listView->setAlternatingRowColors(true);
verticalLayout->addWidget(listView);
horizontalLayout->addWidget(groupBox);
frame = new QFrame(QWDialogHeaders);
frame->setObjectName(QStringLiteral("frame"));
frame->setFrameShape(QFrame::StyledPanel);
frame->setFrameShadow(QFrame::Raised);
verticalLayout_2 = new QVBoxLayout(frame);
verticalLayout_2->setObjectName(QStringLiteral("verticalLayout_2"));
verticalSpacer_4 = new QSpacerItem(20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding);
verticalLayout_2->addItem(verticalSpacer_4);
btnOK = new QPushButton(frame);
btnOK->setObjectName(QStringLiteral("btnOK"));
QIcon icon;
icon.addFile(QStringLiteral(":/icons/images/704.bmp"), QSize(), QIcon::Normal, QIcon::Off);
btnOK->setIcon(icon);
verticalLayout_2->addWidget(btnOK);
verticalSpacer_2 = new QSpacerItem(20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding);
verticalLayout_2->addItem(verticalSpacer_2);
btnCancel = new QPushButton(frame);
btnCancel->setObjectName(QStringLiteral("btnCancel"));
QIcon icon1;
icon1.addFile(QStringLiteral(":/icons/images/706.bmp"), QSize(), QIcon::Normal, QIcon::Off);
btnCancel->setIcon(icon1);
verticalLayout_2->addWidget(btnCancel);
verticalSpacer = new QSpacerItem(20, 28, QSizePolicy::Minimum, QSizePolicy::Expanding);
verticalLayout_2->addItem(verticalSpacer);
verticalSpacer_6 = new QSpacerItem(20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding);
verticalLayout_2->addItem(verticalSpacer_6);
verticalSpacer_5 = new QSpacerItem(20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding);
verticalLayout_2->addItem(verticalSpacer_5);
verticalSpacer_3 = new QSpacerItem(20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding);
verticalLayout_2->addItem(verticalSpacer_3);
horizontalLayout->addWidget(frame);
verticalLayout_3->addLayout(horizontalLayout);
retranslateUi(QWDialogHeaders);
QObject::connect(btnOK, SIGNAL(clicked()), QWDialogHeaders, SLOT(accept()));
QObject::connect(btnCancel, SIGNAL(clicked()), QWDialogHeaders, SLOT(reject()));
QMetaObject::connectSlotsByName(QWDialogHeaders);
} // setupUi
void retranslateUi(QDialog *QWDialogHeaders)
{
QWDialogHeaders->setWindowTitle(QApplication::translate("QWDialogHeaders", "\350\256\276\347\275\256\350\241\250\345\244\264\346\240\207\351\242\230", nullptr));
groupBox->setTitle(QApplication::translate("QWDialogHeaders", "\350\241\250\345\244\264\346\240\207\351\242\230", nullptr));
btnOK->setText(QApplication::translate("QWDialogHeaders", "\347\241\256\345\256\232", nullptr));
btnCancel->setText(QApplication::translate("QWDialogHeaders", "\345\217\226\346\266\210", nullptr));
} // retranslateUi
};
namespace Ui {
class QWDialogHeaders: public Ui_QWDialogHeaders {};
} // namespace Ui
QT_END_NAMESPACE
#endif // UI_QWDIALOGHEADERS_H
|
[
"841105197@qq.com"
] |
841105197@qq.com
|
df4b3edab63691f89c9266e3c6d3a31eb7cf214f
|
bc04ac4221bd533da6497d1f80150cdd211a7921
|
/instructions/Instruction_jc.cpp
|
250c76151298a8724b9208a7a9c8f2979d04fc41
|
[] |
no_license
|
WarlockD/Mil-std-1750A-Emulator-C20
|
71e8e357c81a36fe39c5b42a1f76fa13ffef130d
|
93ed87966945351773107dc6cf3ad5fd50e9cdd4
|
refs/heads/master
| 2023-03-16T07:55:57.903908
| 2012-07-16T15:57:28
| 2012-07-16T15:57:28
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 512
|
cpp
|
#include <iostream>
#include <iomanip>
#include "Instruction_jc.h"
#include "Operation_jc.h"
namespace {
opCodeRange opCode = {0x70, 0x70};
const std::string opCodeStr = "JC";
const std::string opDescription = "Jump On Condition";
}
Instruction_jc::Instruction_jc() :
Instruction_longInstructionData(opCode, opCodeStr, opDescription)
{
setOperation(new Operation_jc());
}
Instruction_jc::~Instruction_jc()
{
}
void Instruction_jc::execute() const
{
Instruction_longInstructionData::execute();
}
|
[
"ritchie@uibhist.de"
] |
ritchie@uibhist.de
|
478abc69d3b0f70ac1f2255acca1c8de6cb8e25c
|
54cd9a543d13a8e8017e633022f475dece364403
|
/SuperNova/Engine/VulkanSDK/1.2.131.2/spirv-tools/source/val/validate_id.cpp
|
7406330f73f10f789fc7afd3994539c1c0d677c9
|
[
"LicenseRef-scancode-generic-cla",
"Apache-2.0",
"MIT",
"LicenseRef-scancode-free-unknown"
] |
permissive
|
martimyc/SuperNova-Engine
|
d84a6302692567ca128e3acab7268b4c41c1e1be
|
627d3cae221341239b978ef469bf1696bc3fcfaf
|
refs/heads/master
| 2022-02-22T04:50:28.633927
| 2020-07-12T16:43:57
| 2020-07-12T16:43:57
| 161,646,985
| 0
| 0
|
Apache-2.0
| 2022-02-11T01:52:57
| 2018-12-13T13:59:08
|
C++
|
UTF-8
|
C++
| false
| false
| 10,062
|
cpp
|
// Copyright (c) 2015-2016 The Khronos Group Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include "source/val/validate.h"
#include <cassert>
#include <algorithm>
#include <iostream>
#include <iterator>
#include <stack>
#include <string>
#include <unordered_set>
#include <utility>
#include <vector>
#include "source/diagnostic.h"
#include "source/instruction.h"
#include "source/opcode.h"
#include "source/operand.h"
#include "source/spirv_validator_options.h"
#include "source/val/function.h"
#include "source/val/validation_state.h"
#include "spirv-tools/libspirv.h"
namespace spvtools {
namespace val {
spv_result_t UpdateIdUse(ValidationState_t& _, const Instruction* inst) {
for (auto& operand : inst->operands()) {
const spv_operand_type_t& type = operand.type;
const uint32_t operand_id = inst->word(operand.offset);
if (spvIsIdType(type) && type != SPV_OPERAND_TYPE_RESULT_ID) {
if (auto def = _.FindDef(operand_id))
def->RegisterUse(inst, operand.offset);
}
}
return SPV_SUCCESS;
}
/// This function checks all ID definitions dominate their use in the CFG.
///
/// This function will iterate over all ID definitions that are defined in the
/// functions of a module and make sure that the definitions appear in a
/// block that dominates their use.
///
/// NOTE: This function does NOT check module scoped functions which are
/// checked during the initial binary parse in the IdPass below
spv_result_t CheckIdDefinitionDominateUse(ValidationState_t& _) {
std::vector<const Instruction*> phi_instructions;
std::unordered_set<uint32_t> phi_ids;
for (const auto& inst : _.ordered_instructions()) {
if (inst.id() == 0) continue;
if (const Function* func = inst.function()) {
if (const BasicBlock* block = inst.block()) {
// If the Id is defined within a block then make sure all references to
// that Id appear in a blocks that are dominated by the defining block
for (auto& use_index_pair : inst.uses()) {
const Instruction* use = use_index_pair.first;
if (const BasicBlock* use_block = use->block()) {
if (use_block->reachable() == false) continue;
if (use->opcode() == SpvOpPhi) {
if (phi_ids.insert(use->id()).second) {
phi_instructions.push_back(use);
}
} else if (!block->dominates(*use->block())) {
return _.diag(SPV_ERROR_INVALID_ID, use_block->label())
<< "ID " << _.getIdName(inst.id()) << " defined in block "
<< _.getIdName(block->id())
<< " does not dominate its use in block "
<< _.getIdName(use_block->id());
}
}
}
} else {
// If the Ids defined within a function but not in a block(i.e. function
// parameters, block ids), then make sure all references to that Id
// appear within the same function
for (auto use : inst.uses()) {
const Instruction* user = use.first;
if (user->function() && user->function() != func) {
return _.diag(SPV_ERROR_INVALID_ID, _.FindDef(func->id()))
<< "ID " << _.getIdName(inst.id()) << " used in function "
<< _.getIdName(user->function()->id())
<< " is used outside of it's defining function "
<< _.getIdName(func->id());
}
}
}
}
// NOTE: Ids defined outside of functions must appear before they are used
// This check is being performed in the IdPass function
}
// Check all OpPhi parent blocks are dominated by the variable's defining
// blocks
for (const Instruction* phi : phi_instructions) {
if (phi->block()->reachable() == false) continue;
for (size_t i = 3; i < phi->operands().size(); i += 2) {
const Instruction* variable = _.FindDef(phi->word(i));
const BasicBlock* parent =
phi->function()->GetBlock(phi->word(i + 1)).first;
if (variable->block() && parent->reachable() &&
!variable->block()->dominates(*parent)) {
return _.diag(SPV_ERROR_INVALID_ID, phi)
<< "In OpPhi instruction " << _.getIdName(phi->id()) << ", ID "
<< _.getIdName(variable->id())
<< " definition does not dominate its parent "
<< _.getIdName(parent->id());
}
}
}
return SPV_SUCCESS;
}
// Performs SSA validation on the IDs of an instruction. The
// can_have_forward_declared_ids functor should return true if the
// instruction operand's ID can be forward referenced.
spv_result_t IdPass(ValidationState_t& _, Instruction* inst) {
auto can_have_forward_declared_ids =
spvOperandCanBeForwardDeclaredFunction(inst->opcode());
// Keep track of a result id defined by this instruction. 0 means it
// does not define an id.
uint32_t result_id = 0;
for (unsigned i = 0; i < inst->operands().size(); i++) {
const spv_parsed_operand_t& operand = inst->operand(i);
const spv_operand_type_t& type = operand.type;
// We only care about Id operands, which are a single word.
const uint32_t operand_word = inst->word(operand.offset);
auto ret = SPV_ERROR_INTERNAL;
switch (type) {
case SPV_OPERAND_TYPE_RESULT_ID:
// NOTE: Multiple Id definitions are being checked by the binary parser.
//
// Defer undefined-forward-reference removal until after we've analyzed
// the remaining operands to this instruction. Deferral only matters
// for OpPhi since it's the only case where it defines its own forward
// reference. Other instructions that can have forward references
// either don't define a value or the forward reference is to a function
// Id (and hence defined outside of a function body).
result_id = operand_word;
// NOTE: The result Id is added (in RegisterInstruction) *after* all of
// the other Ids have been checked to avoid premature use in the same
// instruction.
ret = SPV_SUCCESS;
break;
case SPV_OPERAND_TYPE_ID:
case SPV_OPERAND_TYPE_MEMORY_SEMANTICS_ID:
case SPV_OPERAND_TYPE_SCOPE_ID:
if (const auto def = _.FindDef(operand_word)) {
const auto opcode = inst->opcode();
if (spvOpcodeGeneratesType(def->opcode()) &&
!spvOpcodeGeneratesType(opcode) && !spvOpcodeIsDebug(opcode) &&
!inst->IsNonSemantic() && !spvOpcodeIsDecoration(opcode) &&
opcode != SpvOpFunction &&
opcode != SpvOpCooperativeMatrixLengthNV &&
!(opcode == SpvOpSpecConstantOp &&
inst->word(3) == SpvOpCooperativeMatrixLengthNV)) {
return _.diag(SPV_ERROR_INVALID_ID, inst)
<< "Operand " << _.getIdName(operand_word)
<< " cannot be a type";
} else if (def->type_id() == 0 && !spvOpcodeGeneratesType(opcode) &&
!spvOpcodeIsDebug(opcode) && !inst->IsNonSemantic() &&
!spvOpcodeIsDecoration(opcode) &&
!spvOpcodeIsBranch(opcode) && opcode != SpvOpPhi &&
opcode != SpvOpExtInst && opcode != SpvOpExtInstImport &&
opcode != SpvOpSelectionMerge &&
opcode != SpvOpLoopMerge && opcode != SpvOpFunction &&
opcode != SpvOpCooperativeMatrixLengthNV &&
!(opcode == SpvOpSpecConstantOp &&
inst->word(3) == SpvOpCooperativeMatrixLengthNV)) {
return _.diag(SPV_ERROR_INVALID_ID, inst)
<< "Operand " << _.getIdName(operand_word)
<< " requires a type";
} else if (def->IsNonSemantic() && !inst->IsNonSemantic()) {
return _.diag(SPV_ERROR_INVALID_ID, inst)
<< "Operand " << _.getIdName(operand_word)
<< " in semantic instruction cannot be a non-semantic "
"instruction";
} else {
ret = SPV_SUCCESS;
}
} else if (can_have_forward_declared_ids(i)) {
if (inst->opcode() == SpvOpTypeStruct &&
!_.IsForwardPointer(operand_word)) {
ret = _.diag(SPV_ERROR_INVALID_ID, inst)
<< "Operand " << _.getIdName(operand_word)
<< " requires a previous definition";
} else {
ret = _.ForwardDeclareId(operand_word);
}
} else {
ret = _.diag(SPV_ERROR_INVALID_ID, inst)
<< "ID " << _.getIdName(operand_word)
<< " has not been defined";
}
break;
case SPV_OPERAND_TYPE_TYPE_ID:
if (_.IsDefinedId(operand_word)) {
auto* def = _.FindDef(operand_word);
if (!spvOpcodeGeneratesType(def->opcode())) {
ret = _.diag(SPV_ERROR_INVALID_ID, inst)
<< "ID " << _.getIdName(operand_word) << " is not a type id";
} else {
ret = SPV_SUCCESS;
}
} else {
ret = _.diag(SPV_ERROR_INVALID_ID, inst)
<< "ID " << _.getIdName(operand_word)
<< " has not been defined";
}
break;
default:
ret = SPV_SUCCESS;
break;
}
if (SPV_SUCCESS != ret) return ret;
}
if (result_id) _.RemoveIfForwardDeclared(result_id);
return SPV_SUCCESS;
}
} // namespace val
} // namespace spvtools
|
[
"martimyc2@gmail.com"
] |
martimyc2@gmail.com
|
305618ac66cf1ac4a711acb432d67face48bbea8
|
632ccdbf9447b90a017ff7afa613d0d4551aa61e
|
/main.cpp
|
1a25a200c7249087feaa13c4b030c8fc8deaf7fe
|
[] |
no_license
|
NTUEE-ESLab/2019-Fall-Detection
|
d2c373182a874d67fcf9fdc87e0a7364f953ce71
|
d2ce9986a8dbc58e40f6857a833ad93aab5b98ea
|
refs/heads/master
| 2020-11-25T10:13:00.340975
| 2020-01-11T13:31:34
| 2020-01-11T13:31:34
| 228,613,619
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 16,520
|
cpp
|
/* WiFi Example
* Copyright (c) 2018 ARM Limited
*
* 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 "mbed.h"
#include "TCPSocket.h"
#include "TCPServer.h"
#include "stm32l475e_iot01_accelero.h"
#include <stdio.h>
#include <stdlib.h>
#include <queue>
#include <cmath>
#include <string.h>
#include <iostream>
#ifndef STATE_NUM
# define STATE_NUM 3
#endif
#ifndef OBSERV_NUM
# define OBSERV_NUM 8
#endif
#ifndef MOVEMENT_NUM
# define MOVEMENT_NUM 5
#endif
//forward decla. of Viterbi
typedef struct{
char* model_name;
int state_num;
int observ_num;
double initial[STATE_NUM]; //initial prob.
//usage: initial[s] = initial prob. of state s
double transition[STATE_NUM][STATE_NUM]; //transition prob.
//usage: transition[n_s][c_s] = prob. from current state c_s to next state n_s
double observation[OBSERV_NUM][STATE_NUM]; //observation prob.
//usage: observation[o_v][s] = prob. of seeing observation value o_v at state s
} HMM;
void HMM_init(HMM *, char *, int, int, double[], double[][STATE_NUM], double[][STATE_NUM]);
static void dumpHMM(FILE *, HMM *);
void viterbi(HMM *, int, int *, int, double *);
//end of forward decla. of Viterbi
#define WIFI_IDW0XX1 2
#if (defined(TARGET_DISCO_L475VG_IOT01A) || defined(TARGET_DISCO_F413ZH))
#include "ISM43362Interface.h"
ISM43362Interface wifi(false);
#else // External WiFi modules
#if MBED_CONF_APP_WIFI_SHIELD == WIFI_IDW0XX1
#include "SpwfSAInterface.h"
SpwfSAInterface wifi(MBED_CONF_APP_WIFI_TX, MBED_CONF_APP_WIFI_RX);
#endif // MBED_CONF_APP_WIFI_SHIELD == WIFI_IDW0XX1
#endif
#define SCALE_MULTIPLIER 0.004
const char *sec2str(nsapi_security_t sec)
{
switch (sec) {
case NSAPI_SECURITY_NONE:
return "None";
case NSAPI_SECURITY_WEP:
return "WEP";
case NSAPI_SECURITY_WPA:
return "WPA";
case NSAPI_SECURITY_WPA2:
return "WPA2";
case NSAPI_SECURITY_WPA_WPA2:
return "WPA/WPA2";
case NSAPI_SECURITY_UNKNOWN:
default:
return "Unknown";
}
}
int scan_demo(WiFiInterface *wifi)
{
WiFiAccessPoint *ap;
printf("Scan:\n");
int count = wifi->scan(NULL,0);
printf("%d networks available.\n", count);
/* Limit number of network arbitrary to 15 */
count = count < 15 ? count : 15;
ap = new WiFiAccessPoint[count];
count = wifi->scan(ap, count);
for (int i = 0; i < count; i++)
{
printf("Network: %s secured: %s BSSID: %hhX:%hhX:%hhX:%hhx:%hhx:%hhx RSSI: %hhd Ch: %hhd\n", ap[i].get_ssid(),
sec2str(ap[i].get_security()), ap[i].get_bssid()[0], ap[i].get_bssid()[1], ap[i].get_bssid()[2],
ap[i].get_bssid()[3], ap[i].get_bssid()[4], ap[i].get_bssid()[5], ap[i].get_rssi(), ap[i].get_channel());
}
delete[] ap;
return count;
}
void acc_server(NetworkInterface *net)
{
/*
TCPServer socket;
TCPSocket* client;*/
TCPSocket socket;
SocketAddress addr("192.168.1.237",65431);
nsapi_error_t response;
int16_t pDataXYZ[3] = {0};
char acc_json[64];
int sample_num = 0;
deque<double> output_buf;
const int buff_size = 450;
const int win_size = 150;
int iter = 0;
int current_state=0;
int buffer[buff_size];
// Open a socket on the network interface, and create a TCP connection to addr
response = socket.open(net);
if (0 != response){
printf("Error opening: %d\n", response);
}
response = socket.connect(addr);
if (0 != response){
printf("Error connecting: %d\n", response);
}
/*while (sample_num < 1000){
++sample_num;
BSP_ACCELERO_AccGetXYZ(pDataXYZ);
float x = pDataXYZ[0]*SCALE_MULTIPLIER, y = pDataXYZ[1]*SCALE_MULTIPLIER, z = pDataXYZ[2]*SCALE_MULTIPLIER;
int len = sprintf(acc_json,"%f,%f,%f,",(float)((int)(x*10000))/10000,
(float)((int)(y*10000))/10000, (float)((int)(z*10000))/10000);
response = socket.send(acc_json,len);
if (0 >= response){
printf("Error seding: %d\n", response);
}
wait(0.01);
}*/
//declaration of Viterbi variables
HMM movement_arr[MOVEMENT_NUM];
double pre_pi[3] = {1,9.56820074913016E-77,1.81858419938713E-41};
double pre_a[3][3] = {{0.938655874201866,0.128135097379301,0.195148174983384},{0.0347142240780744,0.869569485812218,3.22171776979643E-25},{0.0266299017200585,0.00229541680848012,0.804851825016615}};
double pre_b[8][3] = {
{2.05436603274678E-15,0.0125713759559856,5.05122127258106E-13},
{2.52998394807497E-22,0.114285235965998,2.22910357695258E-27},
{2.27719498162092E-07,0.873138340658857,2.53255883998954E-25},
{0.999999772280499,5.04741915858667E-06,0.00287017823161201},
{5.84207610274566E-21,3.58200708685093E-37,0.98198902187119},
{7.82574783508609E-51,1.45012517083579E-169,0.0151407998966923},
{0,0,0},
{0,0,0}};
double fall_pi[3] = {1,2.02885E-62,1.4382E-69};
double fall_a[3][3]={{0.847339186,0.094980361,0.117705798},{0.075112028,0.883376935,0.029549676},{0.077548786,0.021642704,0.852744525}};
double fall_b[8][3]={
{1.16527E-35,3.66807E-31,0.015534493},
{1.76139E-20,0.000531981,0.166125668},
{5.75741E-07,6.65886E-05,0.81833829},
{0.999946355,0.000510303,1.5493E-06},
{5.3069E-05,0.465112339,3.67054E-12},
{1.87443E-14,0.273749465,1.1375E-11},
{1.3259E-10,0.221482264,3.84995E-25},
{1.53108E-27,0.038547061,1.69949E-30}};
double run_pi[3] = {5.23E-193,1,8.79E-132};
double run_a[3][3] = {{0.911397594,0.004520484,0.117142582},{0.016535984,0.928022794,0.105564851},{0.072066422,0.067456722,0.777292568}};
double run_b[8][3] = {
{0.376659084,2.89177E-36,7.32707E-22},
{0.623340916,0.0000000000177971,0.000132496},
{4.75775E-11,2.94127E-19,0.579184439},
{1.64936E-22,5.24812E-05,0.420680016},
{3.64058E-23,0.329060907,3.04952E-06},
{2.42714E-31,0.497695775,2.88081E-15},
{5.99981E-26,0.173190837,6.12921E-17},
{0,0,0}};
double walk_pi[3] = {0.008220815,1.15E-36,0.991779185};
double walk_a[3][3] = {{0.602985679,0.094537721,0.044079307},{0.03443364,0.789671219,0.025672161},{0.362580682,0.11579106,0.930248533}};
double walk_b[8][3] = {{0,0,0},
{5.87575E-13,0.014759726,8.07681E-24},
{0.2586356,6.47283E-12,2.29926E-08},
{0.7413644,2.85666E-05,0.999999977},
{8.79061E-10,0.944622461,1.31672E-11},
{1.47098E-21,0.033209383,2.9217E-26},
{2.06214E-35,0.007379863,3.49125E-42},
{0,0,0}};
double still_pi[STATE_NUM] = {1,0,0};
double still_a[STATE_NUM][STATE_NUM] = {{1, 0, 0}, {0, 1, 0}, {0, 0, 1}};
double still_b[OBSERV_NUM][STATE_NUM] = {{0,0,0},
{0,0,0},
{0,0,0},
{1,1,1},
{0,0,0},
{0,0,0},
{0,0,0},
{0,0,0}};
char *name_0 = "predict";
char *name_1 = "fall";
char *name_2 = "run";
char *name_3 = "walk";
char *name_4 = "still";
HMM_init(&movement_arr[0], name_0, STATE_NUM, OBSERV_NUM, pre_pi, pre_a, pre_b);
HMM_init(&movement_arr[1], name_1, STATE_NUM, OBSERV_NUM, fall_pi, fall_a, fall_b);
HMM_init(&movement_arr[2], name_2, STATE_NUM, OBSERV_NUM, run_pi, run_a, run_b);
HMM_init(&movement_arr[3], name_3, STATE_NUM, OBSERV_NUM, walk_pi, walk_a, walk_b);
HMM_init(&movement_arr[4], name_4, STATE_NUM, OBSERV_NUM, still_pi, still_a, still_b);
dumpHMM(stderr, &movement_arr[0]);
dumpHMM(stderr, &movement_arr[1]);
dumpHMM(stderr, &movement_arr[2]);
dumpHMM(stderr, &movement_arr[3]);
dumpHMM(stderr, &movement_arr[4]);
//end of declaration of Viterbi variables
//printf("before while loop\n");
//end of declaration of Viterbi variables
while(1){
//printf("after while loop with iter = %d\n", iter);
BSP_ACCELERO_AccGetXYZ(pDataXYZ);
float x = pDataXYZ[0]*SCALE_MULTIPLIER, y = pDataXYZ[1]*SCALE_MULTIPLIER, z = pDataXYZ[2]*SCALE_MULTIPLIER;
double sqr_sum = x*x + y*y + z*z;
double abs_acc = sqrt(sqr_sum);
if(abs_acc>11){
buffer[iter] = 7;
}
else if(abs_acc>8.7){
buffer[iter] = 6;
}
else if(abs_acc>6.6){
buffer[iter] = 5;
}
else if(abs_acc>4.7){
buffer[iter] = 4;
}
else if(abs_acc>3.4){
buffer[iter] = 3;
}
else if(abs_acc>2.2){
buffer[iter] = 2;
}
else if(abs_acc>1.1){
buffer[iter] = 1;
}
else{
buffer[iter] = 0;
}
if (iter>=win_size-1){
//run viterbi and send data
//printf("before running viterbi with iter = %d\n",iter);
double prob[MOVEMENT_NUM] = {0};
viterbi(movement_arr, win_size, buffer + (iter - (win_size-1)), MOVEMENT_NUM, prob);
//printf("finished viterbi\n");
if(iter>=buff_size-win_size){
buffer[iter-(buff_size-win_size)]=buffer[iter];
if(iter==buff_size-1){
//memcpy(buffer, buffer + (iter - win_size + 1), win_size*sizeof(int));
iter = win_size - 1;
}
}
//end of viterbi
//select maximum movement
double max = 0;
int argmax = 0;
double sum = prob[0]+prob[1]+prob[2]+prob[3]+prob[4];
for (int i = 0; i < MOVEMENT_NUM; ++i){
if(prob[i]/sum>=max){
max = prob[i]/sum;
argmax = i;
}
}
//20200103
const int prev_bnd=30;
const int quantized_thold=1;
const double ratio=4/5;
int low_count = 0;
for (int j=0;j<prev_bnd;++j){
if (buffer[iter-prev_bnd+j+1]<=quantized_thold){
low_count++;
}
}
if (((current_state==3)||(current_state==4))&&(low_count>prev_bnd*ratio)){//walk->predict
argmax=0;
}
else if ((current_state==2)&&(argmax==1)){
argmax=2;
}
int len;
int output_size = 20;
output_buf.push_back(argmax);
if(output_buf.size()==output_size){
int count=0;
for(int i=0;i<output_size;i++){
if(output_buf[i]==argmax){
count++;
}
}
if (count==output_size){
if(current_state!=argmax){
current_state = argmax;
len = sprintf(acc_json,"%d",argmax);
cout<<movement_arr[argmax].model_name<<endl;
socket.send(acc_json,len);
}
}
output_buf.pop_front();
}
//end of movement selection
//printf("%d",argmax);
/*if(argmax==0){
len = sprintf(acc_json,"predict");
}
else if (argmax==1){
len = sprintf(acc_json,"fall");
}
else if (argmax==2){
len = sprintf(acc_json,"run");
}
else if (argmax==3){
len = sprintf(acc_json,"walk");
}
else if (argmax==4){
len = sprintf(acc_json,"still");
}
response = socket.send(acc_json,len);
if (0 >= response){
printf("Error seding: %d\n", response);
}*/
}
iter++;
wait(0.01);
}
socket.close();
}
int main()
{
printf("\nConnecting to %s...\n", MBED_CONF_APP_WIFI_SSID);
int ret = wifi.connect(MBED_CONF_APP_WIFI_SSID, MBED_CONF_APP_WIFI_PASSWORD, NSAPI_SECURITY_WPA_WPA2);
if (ret != 0) {
printf("\nConnection error\n");
return -1;
}
printf("Success\n\n");
printf("MAC: %s\n", wifi.get_mac_address());
printf("IP: %s\n", wifi.get_ip_address());
printf("Netmask: %s\n", wifi.get_netmask());
printf("Gateway: %s\n", wifi.get_gateway());
printf("RSSI: %d\n\n", wifi.get_rssi());
Thread t(osPriorityNormal,32*1024);
BSP_ACCELERO_Init();
t.start(callback(acc_server,&wifi));
//acc_server(&wifi);
wait(osWaitForever);
}
void HMM_init(HMM *model, char *name, int state_n, int observ_n, double pi[], double a[][STATE_NUM], double b[][STATE_NUM]){
model->model_name = (char *)malloc( sizeof(char) * (strlen( name)+1));
strcpy(model->model_name, name);
model->state_num = state_n;
model->observ_num = observ_n;
//printf("sizeof(a) is %d\n", sizeof(a));
/*memcpy(model->initial, pi, sizeof(pi) * STATE_NUM);
memcpy(model->transition, a, sizeof(a) * STATE_NUM * STATE_NUM);
memcpy(model->observation, b, sizeof(b) * OBSERV_NUM * STATE_NUM);*/
for(int i=0;i<STATE_NUM;i++) {
model->initial[i] = pi[i];
}
for(int i=0;i<STATE_NUM;i++) {
for(int j=0;j<STATE_NUM;j++) {
model->transition[i][j] = a[i][j];
}
}
for(int i=0;i<OBSERV_NUM;i++) {
for(int j=0;j<STATE_NUM;j++) {
model->observation[i][j] = b[i][j];
}
}
}
static void dumpHMM( FILE *fp, HMM *hmm )
{
int i, j;
//fprintf( fp, "model name: %s\n", hmm->model_name );
fprintf( fp, "initial: %d\n", hmm->state_num );
for( i = 0 ; i < hmm->state_num - 1; i++ )
fprintf( fp, "%lf ", hmm->initial[i]);
fprintf(fp, "%.5lf\n", hmm->initial[ hmm->state_num - 1 ] );
fprintf( fp, "\ntransition: %d\n", hmm->state_num );
for( i = 0 ; i < hmm->state_num ; i++ ){
for( j = 0 ; j < hmm->state_num - 1 ; j++ )
fprintf( fp, "%.5lf ", hmm->transition[i][j] );
fprintf(fp,"%.5lf\n", hmm->transition[i][hmm->state_num - 1]);
}
fprintf( fp, "\nobservation: %d\n", hmm->observ_num );
for( i = 0 ; i < hmm->observ_num ; i++ ){
for( j = 0 ; j < hmm->state_num - 1 ; j++ )
fprintf( fp, "%.5lf ", hmm->observation[i][j] );
fprintf(fp,"%.5lf\n", hmm->observation[i][hmm->state_num - 1]);
}
}
void viterbi(HMM* hmm, int seqlen, int* seq, int model_num, double* p) {
//printf("calling viterbi\n");
for(int i=1;i<model_num;i++)
{
double viterbi[hmm[i].state_num][seqlen];
for(int j=0;j<hmm[i].state_num;j++)
{
viterbi[j][0]=hmm[i].initial[j]*hmm[i].observation[seq[0]][j];
}
for(int k=1;k<seqlen;k++)
{
for(int l=0;l<hmm[i].state_num;l++)
{
double max=0;
for(int m=0;m<hmm[i].state_num;m++)
{
if(viterbi[m][k-1]*hmm[i].transition[m][l]>max)
{
max=viterbi[m][k-1]*hmm[i].transition[m][l];
}
}
viterbi[l][k]=max*hmm[i].observation[seq[k]][l];
}
}
for(int a=0;a<hmm[i].state_num;a++)
{
if(viterbi[a][seqlen-1]>p[i])
{
p[i]=viterbi[a][seqlen-1];
}
}
}
//return p;
//double sum = p[0] + p[1] + p[2] + p[3] +p[4];
//printf("%lf, %lf, %lf, %lf., %lf \n", p[0]/sum, p[1]/sum, p[2]/sum, p[3]/sum, p[4]/sum);
/*
cout << p[0] << endl
<< p[1] << endl
<< p[2] << endl
<< p[3] << endl;
*/
}
|
[
"noreply@github.com"
] |
NTUEE-ESLab.noreply@github.com
|
968edeff495e1151bf2d2f1e6787e5755fe8f595
|
99beaf867a7e8345e71416a70d18a68f34ea5617
|
/custom_JSON.h
|
ebb7babcae911abe3ad40620df7c507f51d71b58
|
[] |
no_license
|
srish/BloodLine
|
8c5d80e0e71b89c67df72ebc8790544a2b56890e
|
818a6c35cd141f4dfceca655a630f449dabaf985
|
refs/heads/master
| 2021-01-19T09:26:41.054787
| 2012-10-13T21:59:19
| 2012-10-13T21:59:19
| 6,207,895
| 1
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 951
|
h
|
#ifndef custom_JSON_H
#define custom_JSON_H
#include <QObject>
class QUrl;
class QNetworkReply;
struct custom_JSONData;
class custom_JSON : public QObject
{
Q_OBJECT
public:
static custom_JSON& instance();
custom_JSON();
~custom_JSON();
enum ValueMode {
Normal,
Configs
};
Q_INVOKABLE void init();
Q_INVOKABLE void parse(const QString& url);
Q_INVOKABLE void storeConfigs();
Q_INVOKABLE QString value(const int& id, const QString& key, custom_JSON::ValueMode mode = Normal) const;
Q_INVOKABLE int valueCount(custom_JSON::ValueMode mode = Normal) const;
Q_INVOKABLE int localIndexOfKey(const QString& key);
Q_INVOKABLE QString getUrl(const QString& key) const;
void parseString(const QString& string);
QString mapValue(int index) const;
private slots:
void onNetworkReplyFinished(QNetworkReply *reply);
private:
custom_JSONData *d;
};
#endif // custom_JSON_H
|
[
"srishakatux@srishakatux.(none)"
] |
srishakatux@srishakatux.(none)
|
b524577fac1039e1867b192cb2f684d5078fcf67
|
de07c95b5d91eb1d1b2b88eb9ebe526fc3c1a842
|
/external/common/include/wrapcaler.h
|
025dbd0554c39c662920fcd838fc07df3f7cacce
|
[] |
no_license
|
Jason-Jing/hft
|
e7abd883873cf9d29749b9223c9cc8791dc510e8
|
3a36700379d6aef17205ae626105dd5882da29bb
|
refs/heads/master
| 2020-12-03T23:07:45.810535
| 2019-12-18T12:16:17
| 2019-12-18T12:16:17
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 877
|
h
|
#include "./caler.h"
#include "./order_side.h"
#include <boost/python.hpp>
using namespace boost::python;
BOOST_PYTHON_MODULE(caler) {
class_<Fee>("Fee")
.def_readwrite("open_fee", &Fee::open_fee)
.def_readwrite("close_fee", &Fee::close_fee);
class_<FeePoint>("FeePoint")
.def_readwrite("open_fee_point", &FeePoint::open_fee_point)
.def_readwrite("close_fee_point", &FeePoint::close_fee_point);
class_<CALER>(
"CALER", init<std::string>())
.def(init<const libconfig::Setting&>())
.def("CalFee", &CALER::CalFee)
.def("CalFeePoint", &CALER::CalFeePoint)
.def("CalPnl", &CALER::CalPnl)
.def("CalNetPnl", &CALER::CalNetPnl)
.def("GetMinPriceMove", &CALER::GetMinPriceMove)
.def("GetConSize", &CALER::GetConSize);
enum_<OrderSide::Enum>("OrderSide")
.value("Buy", OrderSide::Buy)
.value("Sell", OrderSide::Sell);
}
|
[
"huang.xinyu@wanlitechnologies.com"
] |
huang.xinyu@wanlitechnologies.com
|
c1eb441ae6d10ec1f6bc715bacba077ffa4d62cb
|
0bee97c44f4666ecbebfc672d2d42c2151ea43c4
|
/4. Estructuras Repetitivas/for/main.cpp
|
94bb18e4d487409507924d92196653298d0c8689
|
[] |
no_license
|
Juandavid9909/CplusplusCourse
|
9aa831cf0b18073965ce7e80527a621757f8cb77
|
fff014b6e84d99ffca61e21b652d8ed9c037524a
|
refs/heads/master
| 2023-03-03T10:34:42.886101
| 2021-01-27T20:42:10
| 2021-01-27T20:42:10
| 330,029,639
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 302
|
cpp
|
/*La sentencia for
for(expr1; expresion logica; expr2) {
conjunto de instrucciones;
}
*/
#include <iostream>
#include <conio.h>
using namespace std;
int main() {
for(int i = 10; i >= 1; i--) {
cout << i << endl;
}
getch();
return 0;
}
|
[
"juandavid918@gmail.com"
] |
juandavid918@gmail.com
|
af3049cea972ba54a51773c58024638ed20c27df
|
26772748929329f0a6feb6c54c51f6ab02b79561
|
/Export/mac64/cpp/obj/include/Controller.h
|
46ce3446ce536f9c8749c20a1bb5f2b6ac6af5f7
|
[] |
no_license
|
pvsmartinez/ilha
|
f9c473bc4ef14a937fe80151f188c21334685265
|
24549ac14c6e2e5b3921b09fb486d7cc9d662804
|
refs/heads/master
| 2021-01-10T04:43:17.740463
| 2015-11-04T22:06:19
| 2015-11-04T22:06:19
| 44,400,109
| 2
| 0
| null | 2015-11-01T23:31:21
| 2015-10-16T17:21:55
|
C++
|
UTF-8
|
C++
| false
| false
| 1,955
|
h
|
#ifndef INCLUDED_Controller
#define INCLUDED_Controller
#ifndef HXCPP_H
#include <hxcpp.h>
#endif
#ifndef INCLUDED_openfl_display_Sprite
#include <openfl/display/Sprite.h>
#endif
HX_DECLARE_CLASS0(Body)
HX_DECLARE_CLASS0(Controller)
HX_DECLARE_CLASS2(openfl,display,DisplayObject)
HX_DECLARE_CLASS2(openfl,display,DisplayObjectContainer)
HX_DECLARE_CLASS2(openfl,display,IBitmapDrawable)
HX_DECLARE_CLASS2(openfl,display,InteractiveObject)
HX_DECLARE_CLASS2(openfl,display,Sprite)
HX_DECLARE_CLASS2(openfl,events,Event)
HX_DECLARE_CLASS2(openfl,events,EventDispatcher)
HX_DECLARE_CLASS2(openfl,events,IEventDispatcher)
HX_DECLARE_CLASS2(openfl,events,KeyboardEvent)
class HXCPP_CLASS_ATTRIBUTES Controller_obj : public ::openfl::display::Sprite_obj{
public:
typedef ::openfl::display::Sprite_obj super;
typedef Controller_obj OBJ_;
Controller_obj();
Void __construct();
public:
inline void *operator new( size_t inSize, bool inContainer=true,const char *inName="Controller")
{ return hx::Object::operator new(inSize,inContainer,inName); }
static hx::ObjectPtr< Controller_obj > __new();
static Dynamic __CreateEmpty();
static Dynamic __Create(hx::DynamicArray inArgs);
//~Controller_obj();
HX_DO_RTTI_ALL;
Dynamic __Field(const ::String &inString, hx::PropertyAccess inCallProp);
Dynamic __SetField(const ::String &inString,const Dynamic &inValue, hx::PropertyAccess inCallProp);
void __GetFields(Array< ::String> &outFields);
static void __register();
void __Mark(HX_MARK_PARAMS);
void __Visit(HX_VISIT_PARAMS);
::String __ToString() const { return HX_HCSTRING("Controller","\xbc","\x9c","\x6f","\xfb"); }
Array< bool > keys;
virtual Void move( ::Body target);
Dynamic move_dyn();
virtual Void onKeyDown( ::openfl::events::KeyboardEvent evt);
Dynamic onKeyDown_dyn();
virtual Void onKeyUp( ::openfl::events::KeyboardEvent evt);
Dynamic onKeyUp_dyn();
};
#endif /* INCLUDED_Controller */
|
[
"pvsmartinez@gmail.com"
] |
pvsmartinez@gmail.com
|
5f61b68f6eb42335c18d3a69b243d1e3ade7e6f9
|
6b8754ced745074ff1f1ffbc1849c1727249246d
|
/Program_Files/dynamic_initalization_of_object_using_constructors.cpp
|
78fbd08981b87c44e3c864f93e10ad7e8cb82ea9
|
[] |
no_license
|
Aadarshbhushan-Singh/Learning_C-
|
c8972050b24cea16bc9de52cf043ea9479ca9a51
|
28fbd1ed238f89ca9c7a82ed962394a78c99ff40
|
refs/heads/master
| 2023-05-30T17:18:58.378897
| 2021-06-17T10:28:29
| 2021-06-17T10:28:29
| 286,920,659
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 587
|
cpp
|
#include <iostream>
using namespace std;
class number{
public:
// number(void);
number(int x, float y);
number (float y, int x);
};
number::number(int x, float y){
cout<<"First number is int."<<x<<endl;
cout<<"Second number is float."<<y<<endl;
};
number::number(float y, int x){
cout<<"First number is float."<<y<<endl;
cout<<"Second number is integer."<<x<<endl;
};
int main(){
int x, p;
float y, q;
cin>>x;
cin>>y;
cin>>p;
cin>>q;
number n1(x,y);
number n2(q, p);
cout<<endl;
return 0;
};
|
[
"singhaadarsh5050@gmail.com"
] |
singhaadarsh5050@gmail.com
|
9b91dfd2a7452c71131f4c5914725b27858d7adc
|
6ddae95cef6e7ab3160cb82d985fd17f1a6967dc
|
/widget.h
|
7ed520500b6d126e2c1eb4440c57a2d17608f834
|
[] |
no_license
|
MasterDjefer/TetrisShooter
|
01f085075f40c2ce6d1a802a78eac22bdcb5d7c5
|
d516538819b311af36544bd42b6a43ab2188968b
|
refs/heads/master
| 2022-12-13T14:34:46.057333
| 2020-09-10T10:44:44
| 2020-09-10T10:44:44
| 294,380,783
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 507
|
h
|
#ifndef WIDGET_H
#define WIDGET_H
#include "tank.h"
#include "target.h"
#include <QWidget>
#include <QPainter>
#include <QKeyEvent>
#include <QTimer>
class Widget : public QWidget
{
Q_OBJECT
public:
Widget();
~Widget();
private:
Tank *mTank;
Target *mTarget;
QTimer *mTimerTargetMove;
private:
void paintEvent(QPaintEvent *event);
void keyPressEvent(QKeyEvent *event);
private slots:
void onTimeOutTargetMove();
};
#endif // WIDGET_H
|
[
"kostia210@gmail.com"
] |
kostia210@gmail.com
|
1cd3279fabd8cc3d01321e11e1fe7579ca835f93
|
cdc668f528ffb037f677ce505c6a91a6edd9ef45
|
/src/qt/polarisnetwork/settings/settingsinformationwidget.cpp
|
7d25766fdeae14f43d6a2ba60712aac494f4e382
|
[
"MIT"
] |
permissive
|
bspanda98/polaris
|
e05c6e543d3590fb36099b9b790500256ab5ef2b
|
f0d835cf699c2a131a747d48680710e364ce3b1b
|
refs/heads/master
| 2022-07-05T04:14:54.659583
| 2020-05-18T17:44:19
| 2020-05-18T17:44:19
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 5,943
|
cpp
|
// Copyright (c) 2019-2020 The POLARISNETWORK developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include "qt/polarisnetwork/settings/settingsinformationwidget.h"
#include "qt/polarisnetwork/settings/forms/ui_settingsinformationwidget.h"
#include "clientmodel.h"
#include "chainparams.h"
#include "db.h"
#include "util.h"
#include "guiutil.h"
#include "qt/polarisnetwork/qtutils.h"
#include <QDir>
SettingsInformationWidget::SettingsInformationWidget(POLARISNETWORKGUI* _window,QWidget *parent) :
PWidget(_window,parent),
ui(new Ui::SettingsInformationWidget)
{
ui->setupUi(this);
this->setStyleSheet(parent->styleSheet());
// Containers
setCssProperty(ui->left, "container");
ui->left->setContentsMargins(10,10,10,10);
setCssProperty({ui->layoutOptions1, ui->layoutOptions2, ui->layoutOptions3}, "container-options");
// Title
setCssTitleScreen(ui->labelTitle);
setCssProperty({
ui->labelTitleDataDir,
ui->labelTitleBerkeley,
ui->labelTitleAgent,
ui->labelTitleClient,
ui->labelTitleTime,
ui->labelTitleName,
ui->labelTitleConnections,
ui->labelTitleMasternodes,
ui->labelTitleBlockNumber,
ui->labelTitleBlockTime,
ui->labelTitleBlockHash,
ui->labelTitleNumberTransactions,
ui->labelInfoNumberTransactions,
ui->labelInfoClient,
ui->labelInfoAgent,
ui->labelInfoBerkeley,
ui->labelInfoDataDir,
ui->labelInfoTime,
ui->labelInfoConnections,
ui->labelInfoMasternodes,
ui->labelInfoBlockNumber
}, "text-main-settings");
setCssProperty({
ui->labelTitleGeneral,
ui->labelTitleNetwork,
ui->labelTitleBlockchain,
ui->labelTitleMemory,
},"text-title");
// TODO: Mempool section is not currently implemented and instead, hidden for now
ui->labelTitleMemory->setVisible(false);
ui->labelTitleNumberTransactions->setVisible(false);
ui->labelInfoNumberTransactions->setText("0");
ui->labelInfoNumberTransactions->setVisible(false);
// Information Network
ui->labelInfoName->setText(tr("Main"));
ui->labelInfoName->setProperty("cssClass", "text-main-settings");
ui->labelInfoConnections->setText("0 (In: 0 / Out: 0)");
ui->labelInfoMasternodes->setText("Total: 0 (IPv4: 0 / IPv6: 0 / Tor: 0 / Unknown: 0");
// Information Blockchain
ui->labelInfoBlockNumber->setText("0");
ui->labelInfoBlockTime->setText("Sept 6, 2018. Thursday, 8:21:49 PM");
ui->labelInfoBlockTime->setProperty("cssClass", "text-main-grey");
ui->labelInfoBlockHash->setProperty("cssClass", "text-main-hash");
// Buttons
setCssBtnSecondary(ui->pushButtonBackups);
setCssBtnSecondary(ui->pushButtonFile);
setCssBtnSecondary(ui->pushButtonNetworkMonitor);
// Data
#ifdef ENABLE_WALLET
// Wallet data -- remove it with if it's needed
ui->labelInfoBerkeley->setText(DbEnv::version(0, 0, 0));
ui->labelInfoDataDir->setText(QString::fromStdString(GetDataDir().string() + QDir::separator().toLatin1() + GetArg("-wallet", "wallet.dat")));
#else
ui->labelInfoBerkeley->setText(tr("No information"));
#endif
connect(ui->pushButtonBackups, &QPushButton::clicked, [this](){
if (!GUIUtil::showBackups())
inform(tr("Unable to open backups folder"));
});
connect(ui->pushButtonFile, &QPushButton::clicked, [this](){
if (!GUIUtil::openConfigfile())
inform(tr("Unable to open polarisnetwork.conf with default application"));
});
connect(ui->pushButtonNetworkMonitor, &QPushButton::clicked, this, &SettingsInformationWidget::openNetworkMonitor);
}
void SettingsInformationWidget::loadClientModel()
{
if (clientModel && clientModel->getPeerTableModel() && clientModel->getBanTableModel()) {
// Provide initial values
ui->labelInfoClient->setText(clientModel->formatFullVersion());
ui->labelInfoAgent->setText(clientModel->clientName());
ui->labelInfoTime->setText(clientModel->formatClientStartupTime());
ui->labelInfoName->setText(QString::fromStdString(Params().NetworkIDString()));
setNumConnections(clientModel->getNumConnections());
connect(clientModel, &ClientModel::numConnectionsChanged, this, &SettingsInformationWidget::setNumConnections);
setNumBlocks(clientModel->getNumBlocks());
connect(clientModel, &ClientModel::numBlocksChanged, this, &SettingsInformationWidget::setNumBlocks);
connect(clientModel, &ClientModel::strMasternodesChanged, this, &SettingsInformationWidget::setMasternodeCount);
}
}
void SettingsInformationWidget::setNumConnections(int count)
{
if (!clientModel)
return;
QString connections = QString::number(count) + " (";
connections += tr("In:") + " " + QString::number(clientModel->getNumConnections(CONNECTIONS_IN)) + " / ";
connections += tr("Out:") + " " + QString::number(clientModel->getNumConnections(CONNECTIONS_OUT)) + ")";
ui->labelInfoConnections->setText(connections);
}
void SettingsInformationWidget::setNumBlocks(int count)
{
ui->labelInfoBlockNumber->setText(QString::number(count));
if (clientModel) {
ui->labelInfoBlockTime->setText(clientModel->getLastBlockDate().toString());
ui->labelInfoBlockHash->setText(clientModel->getLastBlockHash());
}
}
void SettingsInformationWidget::setMasternodeCount(const QString& strMasternodes)
{
ui->labelInfoMasternodes->setText(strMasternodes);
}
void SettingsInformationWidget::openNetworkMonitor()
{
if (!rpcConsole) {
rpcConsole = new RPCConsole(0);
rpcConsole->setClientModel(clientModel);
}
rpcConsole->showNetwork();
}
SettingsInformationWidget::~SettingsInformationWidget()
{
delete ui;
}
|
[
"bspanda98@gmail.com"
] |
bspanda98@gmail.com
|
5ce5c51b71e1f5937a773504d0e87523cf62236e
|
c2b9f07871255a13f11037fd07e9e1ff79c8305c
|
/Device.cpp
|
a37ece7f9580368fa631dcd302ca16f15be930d6
|
[
"MIT",
"LicenseRef-scancode-public-domain",
"LicenseRef-scancode-unknown-license-reference"
] |
permissive
|
jellyr/Karma-CS-GO-Hack
|
a967676d508d3333bbbd479dbf470a7e3dfd6b76
|
be6578d39b36d4ba6d3bc060b4b5076c98d4d34c
|
refs/heads/master
| 2020-06-21T05:03:04.887129
| 2016-11-12T08:38:27
| 2016-11-12T08:38:27
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 44,050
|
cpp
|
#include "SDK.h"
#include "Globals.h"
#include "Config.h"
#include "IRC.h"
#include "Accessors.h"
extern IMGUI_API LRESULT ImGui_ImplDX9_WndProcHandler(HWND, UINT msg, WPARAM wParam, LPARAM lParam);
bool CurKey[256] = {};
void GUI_Init(IDirect3DDevice9* pDevice);
tReset oResetScene;
tEndScene oEndScene;
cOptions Options;
LRESULT __stdcall Game::hkdWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
//Captures the keys states
auto& io = ImGui::GetIO();
switch (uMsg)
{
case WM_LBUTTONDOWN:
CurKey[VK_LBUTTON] = true;
break;
case WM_LBUTTONUP:
CurKey[VK_LBUTTON] = false;
break;
case WM_RBUTTONDOWN:
CurKey[VK_RBUTTON] = true;
break;
case WM_RBUTTONUP:
CurKey[VK_RBUTTON] = false;
break;
case WM_KEYDOWN:
CurKey[wParam] = true;
break;
case WM_KEYUP:
CurKey[wParam] = false;
break;
case WM_MOUSEMOVE:
io.MousePos.x = static_cast<signed short>(lParam);
io.MousePos.y = static_cast<signed short>(lParam >> 16);
break;
default: break;
}
{
static auto isDown = false;
static auto isClicked = false;
if (CurKey[VK_INSERT])
{
isClicked = false;
isDown = true;
}
else if (!CurKey[VK_INSERT] && isDown)
{
isClicked = true;
isDown = false;
}
else
{
isClicked = false;
isDown = false;
}
if (isClicked)
{
Options.Menu.Opened = !Options.Menu.Opened;
static auto cl_mouseenable = Cvar->FindVar(XorStr("cl_mouseenable"));
cl_mouseenable->SetValue(!Options.Menu.Opened);
}
}
if (Global::Init && Options.Menu.Opened && ImGui_ImplDX9_WndProcHandler(hWnd, uMsg, wParam, lParam))
return true;
return CallWindowProc(Global::oWndProc, hWnd, uMsg, wParam, lParam);
}
#pragma region Arrays
const char* ChamsType[] =
{
"Flat",
"Textured"
};
const char* Keys[] =
{
"",
"Mouse 1",
"Mouse 2",
"Cancel",
"Middle Mouse",
"Mouse 4",
"Mouse 5",
"",
"Backspace",
"Tab",
"",
"",
"Clear",
"Enter",
"",
"",
"Shift",
"Control",
"Alt",
"Pause",
"Caps",
"",
"",
"",
"",
"",
"",
"Escape",
"",
"",
"",
"",
"Space",
"Page Up",
"Page Down",
"End",
"Home",
"Left",
"Up",
"Right",
"Down",
"",
"",
"",
"Print",
"Insert",
"Delete",
"",
"0",
"1",
"2",
"3",
"4",
"5",
"6",
"7",
"8",
"9",
"",
"",
"",
"",
"",
"",
"",
"A",
"B",
"C",
"D",
"E",
"F",
"G",
"H",
"I",
"J",
"K",
"L",
"M",
"N",
"O",
"P",
"Q",
"R",
"S",
"T",
"U",
"V",
"W",
"X",
"Y",
"Z",
"",
"",
"",
"",
"",
"Numpad 0",
"Numpad 1",
"Numpad 2",
"Numpad 3",
"Numpad 4",
"Numpad 5",
"Numpad 6",
"Numpad 7",
"Numpad 8",
"Numpad 9",
"Multiply",
"Add",
"",
"Subtract",
"Decimal",
"Divide",
"F1",
"F2",
"F3",
"F4",
"F5",
"F6",
"F7",
"F8",
"F9",
"F10",
"F11",
"F12",
};
const char* Filter[] =
{
"None",
"Most Damage",
"Body Only",
"No Arms or Head",
"Head Only",
"Arms Only"
};
const char* Bones[] =
{
"Pelvis",
"Lower Body",
"Crotch",
"Stomach",
"Chest",
"Neck",
"Head"
};
const char* Knifes[] =
{
"No Knife",
"Bayonet",
"Flip Knife",
"Gut Knife",
"Karambit",
"M9 Bayonet",
"Huntsman Knife",
"Butterfly Knife",
"Falchion Knife",
"Shadow Daggers",
"Bowie Knife"
};
#pragma endregion
HRESULT __stdcall Game::hkdEndScene(IDirect3DDevice9* pDevice)
{
if (!Global::Init)
GUI_Init(pDevice);
else
{
if (Engine->IsInGame() && Engine->IsConnected())
ImGui::GetIO().MouseDrawCursor = Options.Menu.Opened;
else
ImGui::GetIO().MouseDrawCursor = true;
ImGui_ImplDX9_NewFrame();
ImVec2 Pos;
if (Options.Menu.Opened)
{
ImGui::Begin(XorStr("Karma - CSGO"), &Options.Menu.Opened, ImVec2(400, 500), 1.f, ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoCollapse);
{
Pos = ImGui::GetWindowPos();
if (ImGui::CollapsingHeader(XorStr("RageBot")))
{
ImGui::Text(XorStr("Ragebot"));
ImGui::Separator();
ImGui::Checkbox(XorStr("Ragebot"), &Options.Rage.Aimbot.Enabled);
ImGui::Combo(XorStr("HitBox"), &Options.Rage.Aimbot.Hitbox, Bones, ARRAYSIZE(Bones));
ImGui::Combo(XorStr("AutoWall"), &Options.Rage.AutoWall.AutowallType, XorStr("Un-Invasive\0Invasive\0"));
ImGui::Combo(XorStr("HitScans"), &Options.Rage.Aimbot.HitScans, XorStr("Aim At Bones\0HitScan-MultiPoint\0HitScan Hitboxs\0Hitscan-Extreme\0Custom-Hitscans\0"));
ImGui::Combo(XorStr("Targeting"), &Options.Rage.Aimbot.Targeting, XorStr("FOV\0Healt h\0Distance\0First-Valid\0NextShot(Broken)\0Threat\0Visible Bones\0Damage\0"));
ImGui::Combo(XorStr("StopType"), &Options.Rage.Aimbot.StopType, XorStr("None\0Stop\0StopCrouch\0Full-Stop\0Full-StopCrouch\0"));
ImGui::SliderFloat(XorStr("Min-Damage"), &Options.Rage.AutoWall.MinDamage, 1.f, 100.f);
ImGui::Checkbox(XorStr("Auto-Shoot"), &Options.Rage.Aimbot.AutoShoot);
ImGui::Checkbox(XorStr("1Tap mode"), &Options.Rage.Aimbot.AS1tap);
ImGui::Checkbox(XorStr("AutoScope"), &Options.Rage.Aimbot.AutoScope);
ImGui::Checkbox(XorStr("Enemy Only"), &Options.Rage.Aimbot.EnemyOnly);
ImGui::Checkbox(XorStr("Hitchance"), &Options.Rage.Aimbot.bHitchance);
ImGui::Checkbox(XorStr("Hitchance Snipers"), &Options.Rage.Aimbot.bHitchanceSnipers);
ImGui::Checkbox(XorStr("Psuedo Nospread(!)"), &Options.Rage.Aimbot.PsuedoSpread);
ImGui::Checkbox(XorStr("pSilent(Turn off Wepconfigs)"), &Options.Legit.Aimbot.PerfectSilentAim);
ImGui::Checkbox(XorStr("SilentAim"), &Options.Rage.Aimbot.SilentAim);
ImGui::SliderFloat(XorStr("HitChance"), &Options.Rage.Aimbot.Hitchance, 1.f, 100.f);
ImGui::Checkbox(XorStr("AimSmart"), &Options.Rage.Aimbot.AimSmart);
ImGui::SameLine();
ImGui::InputInt(XorStr("Smart Shots"), &Options.Rage.Aimbot.iSmartShots);
ImGui::Text(XorStr("AA"));
ImGui::Separator();
ImGui::Checkbox(XorStr("Anti-Aims"), &Options.Rage.AntiAim.Enabled);
ImGui::Combo(XorStr("Pitch"), &Options.Rage.AntiAim.Pitch, XorStr("None\0Emotion\0Hide\0"));
ImGui::Combo(XorStr("Yaw"), &Options.Rage.AntiAim.Yaw, XorStr("None\0F-Jitter\0Back-Jitter-Target\0Element\0F-Staic\0Back-Target\0Fire-Object\0"));
if (ImGui::Button(XorStr("PlayerList"))) Options.Menu.PlayerList ^= 1;
if (ImGui::Button(XorStr("Custom Hitscans"))) Options.Menu.HitScans ^= 1;
}
if (ImGui::CollapsingHeader(XorStr("Legitbot")))
{
bool lCheck = Options.AntiCheat.FACEIT;
ImGui::Text(XorStr("Aimbot"));
ImGui::Separator();
ImGui::Checkbox(XorStr("LegitBot"), &Options.Legit.Aimbot.Enabled);
if (!lCheck)
{
ImGui::Checkbox(XorStr("SilentAim"), &Options.Legit.Aimbot.SilentAim);
ImGui::Checkbox(XorStr("RCS"), &Options.Legit.Aimbot.RCS);
ImGui::SliderFloat(XorStr("FOV"), &Options.Legit.Aimbot.Fov, 0.f, 180.f, "%.1f");
}
if (lCheck)
{
ImGui::SliderInt(XorStr("League FOV"), &Options.Legit.Aimbot.LFOV, 1, 180);
ImGui::SliderInt(XorStr("Aim Speed"), &Options.Legit.Aimbot.AimSpeed, 1, 300);
ImGui::SliderInt(XorStr("Multiply Speed"), &Options.Legit.Aimbot.MultiplySpeed, 1, 10);
ImGui::SliderInt(XorStr("FOV Boost"), &Options.Legit.Aimbot.FOVBOOST, 1, 10);
}
if (!lCheck)
{
ImGui::SliderFloat(XorStr("Smooth X"), &Options.Legit.Aimbot.Smooth[0], 1.f, 100.f, "%.1f");
ImGui::SliderFloat(XorStr("Smooth Y"), &Options.Legit.Aimbot.Smooth[1], 1.f, 100.f, "%.1f");
}
ImGui::Combo(XorStr("Bone"), &Options.Legit.Aimbot.Bone, Bones, ARRAYSIZE(Bones));
ImGui::Checkbox(XorStr("Enemy Only"), &Options.Legit.Aimbot.EnemyOnly);
}
if (ImGui::CollapsingHeader(XorStr("Visuals")))
{
ImGui::Text(XorStr("ESP"));
ImGui::Separator();
ImGui::Checkbox(XorStr("ESP"), &Options.Visuals.ESP.Enabled);
ImGui::Checkbox(XorStr("Visualize Aim Point"), &Options.Visuals.ESP.AimPoint);
ImGui::Checkbox(XorStr("Enemy-Only"), &Options.Visuals.ESP.EnemyOnly); // ??
ImGui::Combo(XorStr("Visual Detection"), &Options.Visuals.ESP.IsVisible, XorStr("Basic\0Advanced\0"));
ImGui::Checkbox(XorStr("Visual Only"), &Options.Visuals.ESP.bVisibleOnly);
ImGui::Checkbox(XorStr("Box"), &Options.Visuals.ESP.Box);
ImGui::Checkbox(XorStr("Health"), &Options.Visuals.ESP.Health);
ImGui::Checkbox(XorStr("Name"), &Options.Visuals.ESP.Name);
ImGui::Checkbox(XorStr("Weapon"), &Options.Visuals.ESP.Weapon);
ImGui::Checkbox(XorStr("Bone"), &Options.Visuals.ESP.Bone);
ImGui::Checkbox(XorStr("Barrel"), &Options.Visuals.ESP.Barrel);
ImGui::Checkbox(XorStr("ThirdPerson"), &Options.Visuals.ESP.ThirdPerson);
ImGui::Checkbox(XorStr("Hitmarker"), &Options.Visuals.ESP.Hitmarker);
ImGui::Checkbox(XorStr("Recoil Crosshair"), &Options.Visuals.ESP.RecoilCrosshair);
ImGui::Checkbox(XorStr("Auto Accept"), &Options.Visuals.ESP.AutoAccept);
ImGui::Checkbox(XorStr("Rank"), &Options.Visuals.ESP.RankESP);
ImGui::Checkbox(XorStr("Location Spam"), &Options.Visuals.ESP.LocationSpam);
ImGui::SliderInt(XorStr("Debug FOV"), &Options.Visuals.ESP.FOV, 0, 40);
ImGui::Text(XorStr("Chams"));
ImGui::Separator();
ImGui::Checkbox(XorStr("Chams"), &Options.Visuals.Chams.Enabled);
ImGui::Combo(XorStr("Type"), &Options.Visuals.Chams.Mode, ChamsType, ARRAYSIZE(ChamsType));
ImGui::Checkbox(XorStr("XQZ"), &Options.Visuals.Chams.XQZ);
ImGui::Text(XorStr("DLights"));
ImGui::Separator();
ImGui::Checkbox(XorStr("Lights"), &Options.Visuals.ESP.DLight);
ImGui::SliderInt(XorStr("Multiply Light"), &Options.Visuals.ESP.DLightRadius, 1, 10);
}
if (ImGui::CollapsingHeader(XorStr("Player Mods")))
{
ImGui::Text(XorStr("Jump"));
ImGui::Separator();
ImGui::Checkbox(XorStr("BHOP"), &Options.PlayerMods.bhop.Enabled);
ImGui::Checkbox(XorStr("AutoStrafe"), &Options.PlayerMods.AutoStrafe.Enabled);
ImGui::SameLine();
ImGui::Checkbox(XorStr("Silent"), &Options.PlayerMods.AutoStrafe.Silent);
ImGui::Text(XorStr("Command Forcing"));
ImGui::Separator();
ImGui::Checkbox(XorStr("AirStuck"), &Options.PlayerMods.AirStuck.Enabled);
ImGui::Combo(XorStr("Airstuck Key"), &Options.PlayerMods.AirStuck.Key, Keys, ARRAYSIZE(Keys));
ImGui::Text(XorStr("FakeLag"));
ImGui::Separator();
ImGui::Checkbox(XorStr("Fakelag"), &Options.PlayerMods.FakeLag.Enabled);
ImGui::InputInt(XorStr("Send"), &Options.PlayerMods.FakeLag.Send);
ImGui::InputInt(XorStr("Choke"), &Options.PlayerMods.FakeLag.Choke);
}
if (ImGui::CollapsingHeader(XorStr("Removals")))
{
ImGui::Text(XorStr("PlayerRemovals"));
ImGui::Separator();
ImGui::Checkbox(XorStr("No-Hands"), &Options.Visuals.Removals.Hands);
ImGui::Checkbox(XorStr("WireFrame Hands"), &Options.Visuals.Removals.WireframeHands);
ImGui::Checkbox(XorStr("No-Weapon"), &Options.Visuals.Removals.Weapon);
ImGui::Checkbox(XorStr("WireFrame Weapons"), &Options.Visuals.Removals.WireframeWep);
ImGui::Checkbox(XorStr("No Vis Recoil"), &Options.Visuals.Removals.VisualRecoil);
ImGui::Checkbox(XorStr("No Recoil"), &Options.Visuals.Removals.Recoil);
ImGui::Checkbox(XorStr("No-Flash"), &Options.Visuals.Removals.Flash);
}
if (ImGui::CollapsingHeader(XorStr("Trigger")))
{
ImGui::Text(XorStr("TriggerBot"));
ImGui::Separator();
ImGui::Checkbox(XorStr("TriggerBot"), &Options.Legit.Trigger.Enabled);
ImGui::Combo(XorStr("Key"), &Options.Legit.Trigger.Key, Keys, ARRAYSIZE(Keys));
ImGui::Checkbox(XorStr("EnemyOnly"), &Options.Legit.Trigger.TriggerFriends);
ImGui::Combo(XorStr("Filter"), &Options.Legit.Trigger.Filter, Filter, ARRAYSIZE(Filter));
ImGui::InputInt(XorStr("Delay"), &Options.Legit.Trigger.Delay);
}
if (ImGui::CollapsingHeader(XorStr("Visual Colors")))
{
ImGui::Text(XorStr("Cham Color"));
ImGui::Separator();
ImGui::ColorEdit3(XorStr("Chams Enemy"), Options.Visuals.Chams.EnemyColor);
ImGui::ColorEdit3(XorStr("Chams Enemy NonVis"), Options.Visuals.Chams.EnemyColorWall);
ImGui::ColorEdit3(XorStr("Chams Team"), Options.Visuals.Chams.TeamColor);
ImGui::ColorEdit3(XorStr("Chams Team NonVis"), Options.Visuals.Chams.TeamColorWall);
ImGui::Text(XorStr("ESP Color"));
ImGui::Separator();
ImGui::ColorEdit3(XorStr("ESP Enemy"), Options.Visuals.ESP.EnemyColor);
ImGui::ColorEdit3(XorStr("ESP Enemy NonVis"), Options.Visuals.ESP.EnemyColorWall);
ImGui::ColorEdit3(XorStr("ESP Team"), Options.Visuals.ESP.TeamColor);
ImGui::ColorEdit3(XorStr("ESP Team NonVis"), Options.Visuals.ESP.TeamColorWall);
}
if (ImGui::CollapsingHeader(XorStr("Anti-Anti-Cheats")))
{
ImGui::Checkbox(XorStr("Match-Making(UNTRUSTED)"), &Options.AntiCheat.MM);
ImGui::Checkbox(XorStr("Source Mod Anti-Cheat(SMAC)"), &Options.AntiCheat.SMAC);
ImGui::Checkbox(XorStr("FACEIT Anti-Cheat"), &Options.AntiCheat.FACEIT);
ImGui::Checkbox(XorStr("Cyber-Evolution Anti-Cheat(CEVO)"), &Options.AntiCheat.CEVO);
ImGui::Checkbox(XorStr("Valve Anti-Cheat(VAC)"), &Options.AntiCheat.VAC);
ImGui::Checkbox(XorStr("E-Sports Entertainment Association(ESEA)"), &Options.AntiCheat.ESEA);
}
}
if (ImGui::CollapsingHeader(XorStr("Settings")))
{
if (ImGui::Button(XorStr("Config Manager"))) Options.Menu.Configs ^= 1;
if (ImGui::Button(XorStr("Skinchanger"))) Options.Menu.Skins ^= 1;
ImGui::Text(XorStr("Weapon Settings"));
ImGui::Separator();
ImGui::Checkbox(XorStr("Weapon Configs"), &Options.Legit.Aimbot.WeaponConfigs);
if (ImGui::Button(XorStr("Weapon-Configs"))) Options.Menu.WeaponConfigs ^= 1;
}
ImGui::Text(XorStr("FrameTime : %.3f ms/frame (%.1f FPS)"), 1000.0f / ImGui::GetIO().Framerate, ImGui::GetIO().Framerate);
if (ImGui::Button(XorStr("Reflect-Injection"))) Options.Cheat.Uninject ^= 1;
if (ImGui::Button(XorStr("Open IRC"))) Options.IRC.Enabled ^= 1;
ImGui::End();
if (Options.Menu.HitScans)
{
ImGui::Begin(XorStr("CHitscans"), &Options.Menu.HitScans, ImVec2(400, 400));
ImGui::Text(XorStr("HitScan Options"));
ImGui::Separator();
ImGui::SliderInt(XorStr("MultiPoint"), &Options.Rage.Aimbot.Hitscan.Point, 0, 9);
ImGui::CollapsingHeader(XorStr("HitBoxes"));
{
ImGui::Checkbox(XorStr("Head"), &Options.Rage.Aimbot.Hitscan.Head);
ImGui::Checkbox(XorStr("Neck"), &Options.Rage.Aimbot.Hitscan.Neck);
ImGui::Checkbox(XorStr("LowerNeck"), &Options.Rage.Aimbot.Hitscan.LowerNeck);
ImGui::Checkbox(XorStr("Pelvis"), &Options.Rage.Aimbot.Hitscan.Pelvis);
ImGui::Checkbox(XorStr("Body"), &Options.Rage.Aimbot.Hitscan.Body);
ImGui::Checkbox(XorStr("Thorax"), &Options.Rage.Aimbot.Hitscan.Thorax);
ImGui::Checkbox(XorStr("Chest"), &Options.Rage.Aimbot.Hitscan.Chest);
ImGui::Checkbox(XorStr("UpperChest"), &Options.Rage.Aimbot.Hitscan.UpperChest);
ImGui::Checkbox(XorStr("RightThigh"), &Options.Rage.Aimbot.Hitscan.RightThigh);
ImGui::Checkbox(XorStr("LeftThigh"), &Options.Rage.Aimbot.Hitscan.LeftThigh);
ImGui::Checkbox(XorStr("RightCalf"), &Options.Rage.Aimbot.Hitscan.RightCalf);
ImGui::Checkbox(XorStr("LeftCalf"), &Options.Rage.Aimbot.Hitscan.LeftCalf);
ImGui::Checkbox(XorStr("RightFoot"), &Options.Rage.Aimbot.Hitscan.RightFoot);
ImGui::Checkbox(XorStr("LeftFoot"), &Options.Rage.Aimbot.Hitscan.LeftFoot);
ImGui::Checkbox(XorStr("RightHand"), &Options.Rage.Aimbot.Hitscan.RightHand);
ImGui::Checkbox(XorStr("LeftHand"), &Options.Rage.Aimbot.Hitscan.LeftHand);
ImGui::Checkbox(XorStr("RightUpperArm"), &Options.Rage.Aimbot.Hitscan.RightUpperArm);
ImGui::Checkbox(XorStr("RightForeArm"), &Options.Rage.Aimbot.Hitscan.RightForeArm);
ImGui::Checkbox(XorStr("LeftUpperArm"), &Options.Rage.Aimbot.Hitscan.LeftUpperArm);
ImGui::Checkbox(XorStr("LeftForeArm"), &Options.Rage.Aimbot.Hitscan.LeftForeArm);
ImGui::Checkbox(XorStr("Max"), &Options.Rage.Aimbot.Hitscan.Max);
}
ImGui::End();
}
if (Options.Menu.Skins)
{
// Still WIP - 6/28/16
ImGui::Begin(XorStr("Skin Changer (WIP)"), &Options.Menu.Skins, ImVec2(690, 408));
ImGui::Checkbox(XorStr("Enabled"), &Options.Skins.Enabled);
ImGui::Checkbox(XorStr("Enable Name Changer"), &Options.Skins.NEnabled);
ImGui::Separator();
if (Engine->IsInGame() && Engine->IsConnected() && Global::LocalPlayer->GetHealth() > 0)
{
auto pWeapon = Global::LocalPlayer->GetWeapon();
if (pWeapon->GetWeaponID() == 1)
{
ImGui::InputInt(XorStr("PaintKit"), &Options.Skins.deagle);
}
if (pWeapon->GetWeaponID() == 7)
{
ImGui::InputInt(XorStr("PaintKit"), &Options.Skins.ak47);
}
if (pWeapon->GetWeaponID() == 8)
{
ImGui::InputInt(XorStr("PaintKit"), &Options.Skins.aug);
}
if (pWeapon->GetWeaponID() == 9)
{
ImGui::InputInt(XorStr("PaintKit"), &Options.Skins.awp);
}
if (pWeapon->GetWeaponID() == 26)
{
ImGui::InputInt(XorStr("PaintKit"), &Options.Skins.bizon);
}
if (pWeapon->GetWeaponID() == 63)
{
ImGui::InputInt(XorStr("PaintKit"), &Options.Skins.cz75);
}
if (pWeapon->GetWeaponID() == 2)
{
ImGui::InputInt(XorStr("PaintKit"), &Options.Skins.elites);
}
if (pWeapon->GetWeaponID() == 10)
{
ImGui::InputInt(XorStr("PaintKit"), &Options.Skins.famas);
}
if (pWeapon->GetWeaponID() == 3)
{
ImGui::InputInt(XorStr("PaintKit"), &Options.Skins.fiveseven);
}
if (pWeapon->GetWeaponID() == 11)
{
ImGui::InputInt(XorStr("PaintKit"), &Options.Skins.g3sg1);
}
if (pWeapon->GetWeaponID() == 13)
{
ImGui::InputInt(XorStr("PaintKit"), &Options.Skins.galil);
}
if (pWeapon->GetWeaponID() == 4)
{
ImGui::InputInt(XorStr("PaintKit"), &Options.Skins.glock);
}
if (pWeapon->GetWeaponID() == 14)
{
ImGui::InputInt(XorStr("PaintKit"), &Options.Skins.m249);
}
if (pWeapon->GetWeaponID() == 60)
{
ImGui::InputInt(XorStr("PaintKit"), &Options.Skins.m4a1s);
}
if (pWeapon->GetWeaponID() == 16)
{
ImGui::InputInt(XorStr("PaintKit"), &Options.Skins.m4a4);
}
if (pWeapon->GetWeaponID() == 17)
{
ImGui::InputInt(XorStr("PaintKit"), &Options.Skins.mac10);
}
if (pWeapon->GetWeaponID() == 27)
{
ImGui::InputInt(XorStr("PaintKit"), &Options.Skins.mag7);
}
if (pWeapon->GetWeaponID() == 64)
{
ImGui::InputInt(XorStr("PaintKit"), &Options.Skins.magnum);
}
if (pWeapon->GetWeaponID() == 33)
{
ImGui::InputInt(XorStr("PaintKit"), &Options.Skins.mp7);
}
if (pWeapon->GetWeaponID() == 34)
{
ImGui::InputInt(XorStr("PaintKit"), &Options.Skins.mp9);
}
if (pWeapon->GetWeaponID() == 28)
{
ImGui::InputInt(XorStr("PaintKit"), &Options.Skins.negev);
}
if (pWeapon->GetWeaponID() == 35)
{
ImGui::InputInt(XorStr("PaintKit"), &Options.Skins.nova);
}
if (pWeapon->GetWeaponID() == 32)
{
ImGui::InputInt(XorStr("PaintKit"), &Options.Skins.p2000);
}
if (pWeapon->GetWeaponID() == 61)
{
ImGui::InputInt(XorStr("PaintKit"), &Options.Skins.usps);
}
if (pWeapon->GetWeaponID() == 19)
{
ImGui::InputInt(XorStr("PaintKit"), &Options.Skins.p90);
}
if (pWeapon->GetWeaponID() == 36)
{
ImGui::InputInt(XorStr("PaintKit"), &Options.Skins.p250);
}
if (pWeapon->GetWeaponID() == 29)
{
ImGui::InputInt(XorStr("PaintKit"), &Options.Skins.sawedoff);
}
if (pWeapon->GetWeaponID() == 38)
{
ImGui::InputInt(XorStr("PaintKit"), &Options.Skins.scar20);
}
if (pWeapon->GetWeaponID() == 39)
{
ImGui::InputInt(XorStr("PaintKit"), &Options.Skins.sg556);
}
if (pWeapon->GetWeaponID() == 40)
{
ImGui::InputInt(XorStr("PaintKit"), &Options.Skins.ssg08);
}
if (pWeapon->GetWeaponID() == 30)
{
ImGui::InputInt(XorStr("PaintKit"), &Options.Skins.tec9);
}
if (pWeapon->GetWeaponID() == 24)
{
ImGui::InputInt(XorStr("PaintKit"), &Options.Skins.ump45);
}
if (pWeapon->GetWeaponID() == 25)
{
ImGui::InputInt(XorStr("PaintKit"), &Options.Skins.xm1014);
}
ImGui::InputInt(XorStr("StatTrak Amount"), &Options.Skins.StatTrak);
ImGui::Separator();
ImGui::Combo(XorStr("Select a knife"), &Options.Skins.KnifeSelect, Knifes, ARRAYSIZE(Knifes));
if (Options.Skins.KnifeSelect == 1)
ImGui::InputInt(XorStr("Bayonet Paint"), &Options.Skins.KnifeIDb);
if (Options.Skins.KnifeSelect == 2)
ImGui::InputInt(XorStr("Flip Knife Paint"), &Options.Skins.KnifeIDf);
if (Options.Skins.KnifeSelect == 3)
ImGui::InputInt(XorStr("Gut Knife Paint"), &Options.Skins.KnifeIDg);
if (Options.Skins.KnifeSelect == 4)
ImGui::InputInt(XorStr("Karambit Paint"), &Options.Skins.KnifeIDk);
if (Options.Skins.KnifeSelect == 5)
ImGui::InputInt(XorStr("M9 Bayonet Paint"), &Options.Skins.KnifeIDm);
if (Options.Skins.KnifeSelect == 6)
ImGui::InputInt(XorStr("Huntsman Knife Paint"), &Options.Skins.KnifeIDh);
if (Options.Skins.KnifeSelect == 7)
ImGui::InputInt(XorStr("Butterfly Knife Paint"), &Options.Skins.KnifeIDb);
if (Options.Skins.KnifeSelect == 8)
ImGui::InputInt(XorStr("Falchion Knife Paint"), &Options.Skins.KnifeIDf);
if (Options.Skins.KnifeSelect == 9)
ImGui::InputInt(XorStr("Shadow Daggers Paint"), &Options.Skins.KnifeIDdag);
if (Options.Skins.KnifeSelect == 10)
ImGui::InputInt(XorStr("Bowie Knife Paint"), &Options.Skins.KnifeIDbow);
static char KnifeBuf[64] = ""; ImGui::InputText(XorStr("KnifeName"), KnifeBuf, 64);
Options.Skins.buf = KnifeBuf;
ImGui::Separator();
ImGui::Checkbox(XorStr("Skin Color 0"), &Options.Skins.Color.Custom0);
ImGui::ColorEdit3(XorStr("Color0"), Options.Skins.Color.color0);
ImGui::Checkbox(XorStr("Skin Color 1"), &Options.Skins.Color.Custom1);
ImGui::ColorEdit3(XorStr("Color1"), Options.Skins.Color.color1);
ImGui::Checkbox(XorStr("Skin Color 2"), &Options.Skins.Color.Custom2);
ImGui::ColorEdit3(XorStr("Color2"), Options.Skins.Color.color2);
ImGui::Checkbox(XorStr("Skin Color 3"), &Options.Skins.Color.Custom3);
ImGui::ColorEdit3(XorStr("Color3"), Options.Skins.Color.color3);
ImGui::Text(XorStr("HOME KEY = Apply Skins"));
}
else
{
if (Engine->IsInGame() && Engine->IsConnected() && !Global::LocalPlayer->GetHealth() > 0)
{
ImGui::Text(XorStr("You must be alive to change skins."));
}
else
{
ImGui::Text(XorStr("You must be ingame to change skins."));
}
}
ImGui::End();
}
if (Options.Menu.Configs)
{
ImGui::Begin(XorStr("Configs"), &Options.Menu.Configs, ImVec2(200, 200));
ImGui::Combo(XorStr("Config"), &Options.Config.Current, XorStr("Default\0Legit\0Rage\0League\0"));
if (ImGui::Button(XorStr("Load-Config")))ConSys->LoadConfig();
if (ImGui::Button(XorStr("Save-Config")))ConSys->SaveConfig();
ImGui::End();
}
if(Options.Menu.WeaponConfigs)
{
bool lCheck = Options.AntiCheat.FACEIT;
ImGui::Begin(XorStr("Weapon Config"),&Options.Menu.WeaponConfigs, ImVec2(400, 400),1.f);
ImGui::Text(XorStr("Rifles"));
ImGui::Separator();
/*Rifles*/
if (ImGui::CollapsingHeader(XorStr("Rifles")))
{
ImGui::Checkbox(XorStr("Rifle TriggerBot"), &Options.Legit.Aimbot.Configs.Rifles.Trigger);
ImGui::Checkbox(XorStr("Rifle LegitBot"), &Options.Legit.Aimbot.Configs.Rifles.Enabled);
if (!lCheck)
{
ImGui::Checkbox(XorStr("Rifle SilentAim"), &Options.Legit.Aimbot.Configs.Rifles.SilentAim);
ImGui::Checkbox(XorStr("Rifle pSilentAim"), &Options.Legit.Aimbot.Configs.Rifles.PerfectSilentAim);
ImGui::Checkbox(XorStr("Rifle RCS"), &Options.Legit.Aimbot.Configs.Rifles.RCS);
}
if (!lCheck)
{ ImGui::SliderFloat(XorStr("Rifle FOV"), &Options.Legit.Aimbot.Configs.Rifles.Fov, 0.f, 180.f, "%.1f");
ImGui::SliderFloat(XorStr("Rifle Smooth X"), &Options.Legit.Aimbot.Configs.Rifles.Smooth[0], 1.f, 100.f, "%.1f");
ImGui::SliderFloat(XorStr("Rifle Smooth Y"), &Options.Legit.Aimbot.Configs.Rifles.Smooth[1], 1.f, 100.f, "%.1f");
}
ImGui::Combo(XorStr("Rifle Bone"), &Options.Legit.Aimbot.Configs.Rifles.Bone, Bones, ARRAYSIZE(Bones));
if (lCheck)
{
ImGui::SliderInt(XorStr("Rifle League FOV"), &Options.Legit.Aimbot.Configs.Rifles.LFOV, 1, 300);
ImGui::SliderInt(XorStr("Rifle Aim Speed"), &Options.Legit.Aimbot.Configs.Rifles.AimSpeed, 1, 300);
ImGui::SliderInt(XorStr("Rifle Multiply Speed"), &Options.Legit.Aimbot.Configs.Rifles.MultiplySpeed, 1, 10);
ImGui::SliderInt(XorStr("Rifle FOV Boost"), &Options.Legit.Aimbot.Configs.Rifles.FOVBOOST, 1, 10);
}
}
ImGui::Text(XorStr("Pistols"));
ImGui::Separator();
/*Pistols*/
if (ImGui::CollapsingHeader(XorStr("Pistols")))
{
ImGui::Checkbox(XorStr("Pistol TriggerBot"), &Options.Legit.Aimbot.Configs.Pistols.Trigger);
ImGui::Checkbox(XorStr("Pistol LegitBot"), &Options.Legit.Aimbot.Configs.Pistols.Enabled);
if (!lCheck)
{
ImGui::Checkbox(XorStr("Pistol SilentAim"), &Options.Legit.Aimbot.Configs.Pistols.SilentAim);
ImGui::Checkbox(XorStr("Pistol pSilentAim"), &Options.Legit.Aimbot.Configs.Pistols.PerfectSilentAim);
ImGui::Checkbox(XorStr("Pistol RCS"), &Options.Legit.Aimbot.Configs.Pistols.RCS);
}
if (!lCheck)
{
ImGui::SliderFloat(XorStr("Pistol FOV"), &Options.Legit.Aimbot.Configs.Pistols.Fov, 0.f, 180.f, "%.1f");
ImGui::SliderFloat(XorStr("Pistol Smooth X"), &Options.Legit.Aimbot.Configs.Pistols.Smooth[0], 1.f, 100.f, "%.1f");
ImGui::SliderFloat(XorStr("Pistol Smooth Y"), &Options.Legit.Aimbot.Configs.Pistols.Smooth[1], 1.f, 100.f, "%.1f");
}
ImGui::Combo(XorStr("Pistol Bone"), &Options.Legit.Aimbot.Configs.Pistols.Bone, Bones, ARRAYSIZE(Bones));
if (lCheck)
{
ImGui::SliderInt(XorStr("Pistol League FOV"), &Options.Legit.Aimbot.Configs.Pistols.LFOV, 1, 300);
ImGui::SliderInt(XorStr("Pistol Aim Speed"), &Options.Legit.Aimbot.Configs.Pistols.AimSpeed, 1, 300);
ImGui::SliderInt(XorStr("Pistol Multiply Speed"), &Options.Legit.Aimbot.Configs.Pistols.MultiplySpeed, 1, 10);
ImGui::SliderInt(XorStr("Pistol FOV Boost"), &Options.Legit.Aimbot.Configs.Pistols.FOVBOOST, 1, 10);
}
}
ImGui::Text(XorStr("Sniper"));
ImGui::Separator();
/*Snipers*/
if (ImGui::CollapsingHeader(XorStr("Sniper")))
{
ImGui::Checkbox(XorStr("Sniper TriggerBot"), &Options.Legit.Aimbot.Configs.Snipers.Trigger);
ImGui::Checkbox(XorStr("Sniper LegitBot"), &Options.Legit.Aimbot.Configs.Snipers.Enabled);
if (!lCheck)
{
ImGui::Checkbox(XorStr("Sniper SilentAim"), &Options.Legit.Aimbot.Configs.Snipers.SilentAim);
ImGui::Checkbox(XorStr("Sniper pSilentAim"), &Options.Legit.Aimbot.Configs.Snipers.PerfectSilentAim);
ImGui::Checkbox(XorStr("Sniper RCS"), &Options.Legit.Aimbot.Configs.Snipers.RCS);
}
if (!lCheck)
{
ImGui::SliderFloat(XorStr("Sniper FOV"), &Options.Legit.Aimbot.Configs.Snipers.Fov, 0.f, 180.f, "%.1f");
ImGui::SliderFloat(XorStr("Sniper Smooth X"), &Options.Legit.Aimbot.Configs.Snipers.Smooth[0], 1.f, 100.f, "%.1f");
ImGui::SliderFloat(XorStr("Sniper Smooth Y"), &Options.Legit.Aimbot.Configs.Snipers.Smooth[1], 1.f, 100.f, "%.1f");
}
ImGui::Combo(XorStr("Sniper Bone"), &Options.Legit.Aimbot.Configs.Snipers.Bone, Bones, ARRAYSIZE(Bones));
if (lCheck)
{
ImGui::SliderInt(XorStr("Sniper League FOV"), &Options.Legit.Aimbot.Configs.Snipers.LFOV, 1, 300);
ImGui::SliderInt(XorStr("Sniper Aim Speed"), &Options.Legit.Aimbot.Configs.Snipers.AimSpeed, 1, 300);
ImGui::SliderInt(XorStr("Sniper Multiply Speed"), &Options.Legit.Aimbot.Configs.Snipers.MultiplySpeed, 1, 10);
ImGui::SliderInt(XorStr("Sniper FOV Boost"), &Options.Legit.Aimbot.Configs.Snipers.FOVBOOST, 1, 10);
}
}
ImGui::Text(XorStr("Shotgun"));
ImGui::Separator();
/*Shotguns*/
if (ImGui::CollapsingHeader(XorStr("Shotgun")))
{
ImGui::Checkbox(XorStr("Shotgun TriggerBot"), &Options.Legit.Aimbot.Configs.Shotguns.Trigger);
ImGui::Checkbox(XorStr("Shotgun LegitBot"), &Options.Legit.Aimbot.Configs.Shotguns.Enabled);
if (!lCheck)
{
ImGui::Checkbox(XorStr("Shotgun SilentAim"), &Options.Legit.Aimbot.Configs.Shotguns.SilentAim);
ImGui::Checkbox(XorStr("Shotgun pSilentAim"), &Options.Legit.Aimbot.Configs.Shotguns.PerfectSilentAim);
ImGui::Checkbox(XorStr("Shotgun RCS"), &Options.Legit.Aimbot.Configs.Shotguns.RCS);
}
if (!lCheck)
{
ImGui::SliderFloat(XorStr("Shotgun FOV"), &Options.Legit.Aimbot.Configs.Shotguns.Fov, 0.f, 180.f, "%.1f");
ImGui::SliderFloat(XorStr("Shotgun Smooth X"), &Options.Legit.Aimbot.Configs.Shotguns.Smooth[0], 1.f, 100.f, "%.1f");
ImGui::SliderFloat(XorStr("Shotgun Smooth Y"), &Options.Legit.Aimbot.Configs.Shotguns.Smooth[1], 1.f, 100.f, "%.1f");
}
ImGui::Combo(XorStr("Shotgun Bone"), &Options.Legit.Aimbot.Configs.Shotguns.Bone, Bones, ARRAYSIZE(Bones));
if (lCheck)
{
ImGui::SliderInt(XorStr("Shotgun League FOV"), &Options.Legit.Aimbot.Configs.Shotguns.LFOV, 1, 300);
ImGui::SliderInt(XorStr("ShotgunAim Speed"), &Options.Legit.Aimbot.Configs.Shotguns.AimSpeed, 1, 300);
ImGui::SliderInt(XorStr("Shotgun Multiply Speed"), &Options.Legit.Aimbot.Configs.Shotguns.MultiplySpeed, 1, 10);
ImGui::SliderInt(XorStr("Shotgun FOV Boost"), &Options.Legit.Aimbot.Configs.Shotguns.FOVBOOST, 1, 10);
}
}
ImGui::Text(XorStr("Sub-Machine-Guns"));
ImGui::Separator();
/*SubMachineGuns*/
if (ImGui::CollapsingHeader(XorStr("Sub-Machine-Guns")))
{
ImGui::Checkbox(XorStr("SMG TriggerBot"), &Options.Legit.Aimbot.Configs.SMGs.Trigger);
ImGui::Checkbox(XorStr("SMG LegitBot"), &Options.Legit.Aimbot.Configs.SMGs.Enabled);
if (!lCheck)
{
ImGui::Checkbox(XorStr("SMG SilentAim"), &Options.Legit.Aimbot.Configs.SMGs.SilentAim);
ImGui::Checkbox(XorStr("SMG pSilentAim"), &Options.Legit.Aimbot.Configs.SMGs.PerfectSilentAim);
ImGui::Checkbox(XorStr("SMG RCS"), &Options.Legit.Aimbot.Configs.SMGs.RCS);
}
if (!lCheck)
{
ImGui::SliderFloat(XorStr("SMG FOV"), &Options.Legit.Aimbot.Configs.SMGs.Fov, 0.f, 180.f, "%.1f");
ImGui::SliderFloat(XorStr("SMG Smooth X"), &Options.Legit.Aimbot.Configs.SMGs.Smooth[0], 1.f, 100.f, "%.1f");
ImGui::SliderFloat(XorStr("SMG Smooth Y"), &Options.Legit.Aimbot.Configs.SMGs.Smooth[1], 1.f, 100.f, "%.1f");
}
ImGui::Combo(XorStr("SMG Bone"), &Options.Legit.Aimbot.Configs.SMGs.Bone, Bones, ARRAYSIZE(Bones));
if (lCheck)
{
ImGui::SliderInt(XorStr("SMG League FOV"), &Options.Legit.Aimbot.Configs.SMGs.LFOV, 1, 300);
ImGui::SliderInt(XorStr("SMG Aim Speed"), &Options.Legit.Aimbot.Configs.SMGs.AimSpeed, 1, 300);
ImGui::SliderInt(XorStr("SMG Multiply Speed"), &Options.Legit.Aimbot.Configs.SMGs.MultiplySpeed, 1, 10);
ImGui::SliderInt(XorStr("SMG FOV Boost"), &Options.Legit.Aimbot.Configs.SMGs.FOVBOOST, 1, 10);
}
}
ImGui::Text(XorStr("Machine-Guns"));
ImGui::Separator();
/*Machine Guns*/
if (ImGui::CollapsingHeader(XorStr("Machine-Guns")))
{
ImGui::Checkbox(XorStr("MG TriggerBot"), &Options.Legit.Aimbot.Configs.Machineguns.Trigger);
ImGui::Checkbox(XorStr("MG LegitBot"), &Options.Legit.Aimbot.Configs.Machineguns.Enabled);
if (!lCheck)
{
ImGui::Checkbox(XorStr("MG SilentAim"), &Options.Legit.Aimbot.Configs.Machineguns.SilentAim);
ImGui::Checkbox(XorStr("MG pSilentAim"), &Options.Legit.Aimbot.Configs.Machineguns.PerfectSilentAim);
ImGui::Checkbox(XorStr("MG RCS"), &Options.Legit.Aimbot.Configs.Machineguns.RCS);
}
if (!lCheck)
{
ImGui::SliderFloat(XorStr("MG FOV"), &Options.Legit.Aimbot.Configs.Machineguns.Fov, 0.f, 180.f, "%.1f");
ImGui::SliderFloat(XorStr("MG Smooth X"), &Options.Legit.Aimbot.Configs.Machineguns.Smooth[0], 1.f, 100.f, "%.1f");
ImGui::SliderFloat(XorStr("MG Smooth Y"), &Options.Legit.Aimbot.Configs.Machineguns.Smooth[1], 1.f, 100.f, "%.1f");
}
ImGui::Combo(XorStr("MG Bone"), &Options.Legit.Aimbot.Configs.Machineguns.Bone, Bones, ARRAYSIZE(Bones));
if (lCheck)
{
ImGui::SliderInt(XorStr("MG League FOV"), &Options.Legit.Aimbot.Configs.Machineguns.LFOV, 1, 300);
ImGui::SliderInt(XorStr("MG Aim Speed"), &Options.Legit.Aimbot.Configs.Machineguns.AimSpeed, 1, 300);
ImGui::SliderInt(XorStr("MG Multiply Speed"), &Options.Legit.Aimbot.Configs.Machineguns.MultiplySpeed, 1, 10);
ImGui::SliderInt(XorStr("MG FOV Boost"), &Options.Legit.Aimbot.Configs.Machineguns.FOVBOOST, 1, 10);
}
}
ImGui::End();
}
}
if (Options.IRC.Enabled)
{
if (ImGui::Begin(XorStr("IRC"), &Options.IRC.Enabled,ImVec2(400,400)));
{
g_pIRC->Invoke();
}
ImGui::End();
}
if (Options.Menu.PlayerList)
{
static const char* team[4] = { "None","Spec","T","CT" };
static const char* IsSpec[2] = { "No","Yes" };
//ImGui::SetNextWindowSize(ImVec2(625, 400), ImGuiSetCond_Appearing);
if (ImGui::Begin(XorStr("Player List"), &Options.Menu.PlayerList))
{
ImGui::Checkbox(XorStr("AntiAntiAim"), &Options.Rage.Aimbot.AntiAntiAim);
ImGui::Checkbox(XorStr("More Info"), &Options.Menu.pList.MoreInfo);
ImGui::SameLine();
ImGui::Checkbox(XorStr("Hide Enemy's"), &Options.Rage.Aimbot.AAA.Enemyonly);
///ImGui::Combo(XorStr("AAA Type"), &Options.Rage.Aimbot.AAA.ResolverType, XorStr("None\0Dynamic\0"));
if (Options.Menu.pList.MoreInfo && !Options.Rage.Aimbot.AAA.Enemyonly)
ImGui::Columns(11, "PlayerList");
else if (Options.Menu.pList.MoreInfo && Options.Rage.Aimbot.AAA.Enemyonly)
ImGui::Columns(10, "PlayerList");
else if (!Options.Menu.pList.MoreInfo && Options.Rage.Aimbot.AAA.Enemyonly)
ImGui::Columns(6, "PlayerList");
else if (!Options.Menu.pList.MoreInfo && !Options.Rage.Aimbot.AAA.Enemyonly)
ImGui::Columns(7, "PlayerList");
ImGui::Separator();
ImGui::Text(XorStr("Name")); ImGui::NextColumn();
if (!Options.Rage.Aimbot.AAA.Enemyonly)
{
ImGui::Text(XorStr("Team")); ImGui::NextColumn();
}
if (Options.Menu.pList.MoreInfo)
{
ImGui::Text(XorStr("Index")); ImGui::NextColumn();
ImGui::Text(XorStr("Spectating Player")); ImGui::NextColumn();
ImGui::Text(XorStr("Pitch")); ImGui::NextColumn();
ImGui::Text(XorStr("Yaw")); ImGui::NextColumn();
}
ImGui::Text(XorStr("Custom Yaw Resolve")); ImGui::NextColumn();
ImGui::Text(XorStr("Custom Pitch Resolve")); ImGui::NextColumn();
ImGui::Text(XorStr("Bone Correction")); ImGui::NextColumn();
ImGui::Text(XorStr("Anti-Aimbot Correction")); ImGui::NextColumn();
ImGui::Text(XorStr("Disable Head")); ImGui::NextColumn();
ImGui::Separator();
if (Engine->IsInGame() && Engine->IsConnected())
{
for (auto i = 0; i < ClientEntList->GetHighestEntityIndex(); i++)
{
auto plClient = ClientEntList->GetClientEntity(i);
player_info_t plInfo;
if (plClient == Global::LocalPlayer)
continue;
if (plClient && Engine->GetPlayerInfo(i, &plInfo))
{
if (Options.Rage.Aimbot.AAA.Enemyonly)
{
if (plClient->GetTeam() == Global::LocalPlayer->GetTeam())
continue;
if (plClient->GetTeam() == 1 || plClient->GetTeam() == 0)
continue;
}
ImGui::Text(plInfo.name);
ImGui::NextColumn();
bool bIsSpec = 0;
DWORD hSpecTarget;
auto iTeamNum = plClient->GetTeam();
if ((!Options.Rage.Aimbot.AAA.Enemyonly))
{
if (iTeamNum == 1)
{
hSpecTarget = *reinterpret_cast<DWORD*>(reinterpret_cast<DWORD>(plClient) + offsets.m_hObserverTarget);
if (hSpecTarget)
bIsSpec = ClientEntList->GetClientEntityFromHandle(hSpecTarget) == Global::LocalPlayer;
}
}
auto oAngle = Options.Rage.Aimbot.AAA.oAngle[i];
if (iTeamNum > 3)
iTeamNum = 0;
if (!Options.Rage.Aimbot.AAA.Enemyonly)
{
ImGui::Text(team[iTeamNum]);
ImGui::NextColumn();
}
if (Options.Menu.pList.MoreInfo)
{
ImGui::Text("%i", i); ImGui::NextColumn();
ImGui::Text(IsSpec[bIsSpec]); ImGui::NextColumn();
ImGui::Text("%.3f", oAngle.x); ImGui::NextColumn();
ImGui::Text("%.3f", oAngle.y); ImGui::NextColumn();
}// these only display if mor info
char Yaw[255] = ""; char Pitch[255] = ""; char Bone[255] = ""; char Lisp[255] = ""; char Head[255] = "";
sprintf(Yaw, "%s %s", plInfo.name, "Yaw");
ImGui::InputFloat(Yaw, &Options.Rage.Aimbot.AAA.CAngle[i].y);
ImGui::NextColumn();//yaw
sprintf(Pitch, "%s %s", plInfo.name, "Pitch");
ImGui::InputFloat(Pitch, &Options.Rage.Aimbot.AAA.CAngle[i].x);
ImGui::NextColumn();//pitch
sprintf(Bone, "%s %s", plInfo.name, "Bone");
ImGui::Combo(Bone, &Options.Rage.Aimbot.AAA.bone[i],XorStr("None\0Pelvis\0Lower Body\0Crotch\0Stomach\0Chest\0Neck\0Head\0"));
ImGui::NextColumn();//bone
sprintf(Lisp, "%s %s", plInfo.name, "AAC");
ImGui::Combo(Lisp, &Options.Rage.Aimbot.AAA.Lisp[i], XorStr("None\0Level 1\0Level 2\0Level 3\0Level 4\0Level 5\0"));
ImGui::NextColumn();//Lisp
sprintf(Head, "%s %s", plInfo.name, "Head");
ImGui::Checkbox(Head, &Options.Rage.Aimbot.AAA.bDisableHead[i]);
ImGui::NextColumn();//HEad
}
}
}
ImGui::Columns(1);
ImGui::Separator();
ImGui::Text(XorStr("Anti-Aimbot Level 1 - Fix Pitch"));
ImGui::Text(XorStr("Anti-Aimbot Level 2 - Fix Jitter / fastspin and Pitch"));
ImGui::Text(XorStr("Anti-Aimbot Level 3 - Fix Jitter / fastspin and Jitter Pitch"));
ImGui::Text(XorStr("Anti-Aimbot Level 4 - Fix Lisp and Pitch"));
ImGui::Text(XorStr("Anti-Aimbot Level 5 - Hail Marry"));
}
ImGui::End();
}
/* if (!Engine->IsInGame() && !Engine->IsConnected())
std::fill(Options.Rage.Aimbot.AAA.bone,
Options.Rage.Aimbot.AAA.bone + sizeof(Options.Rage.Aimbot.AAA.bone),
7);*/
Global::g_pRenderer->BeginRendering();
if (Options.Menu.Opened)
{
Karma->pPos.x = Pos.x;
Karma->pPos.y = Pos.y - 212;// Fps Fix
if (Karma && Karma->IsInit())Karma->Draw();
}
ImGui::Render();
Global::g_pRenderer->EndRendering();
}
return oEndScene(pDevice);
}
HRESULT __stdcall Game::hkdReset(IDirect3DDevice9* pDevice, D3DPRESENT_PARAMETERS* pPresParam)
{
if (!Global::Init) return oResetScene(pDevice, pPresParam);
Global::g_pRenderer->OnLostDevice();
Karma->Release();
ImGui_ImplDX9_InvalidateDeviceObjects();
auto newr = oResetScene(pDevice, pPresParam);
Karma = new cSprite(0, 0);
Karma->Init(pDevice, XorStr("C://Karma//Pictures//Karma.png"), 250, 250);
Global::g_pRenderer->OnResetDevice();
ImGui_ImplDX9_CreateDeviceObjects();
return newr;
}
void GUI_Init(IDirect3DDevice9* pDevice)
{
ImGui_ImplDX9_Init(Global::Window, pDevice);
Global::g_pRenderer = std::make_unique<DrawManager>(pDevice);
auto& style = ImGui::GetStyle();
style.Colors[ImGuiCol_Text] = ImVec4(1.00f, 0.00f, 0.00f, 0.95f);
style.Colors[ImGuiCol_TextDisabled] = ImVec4(0.60f, 0.60f, 0.60f, 1.00f);
style.Colors[ImGuiCol_WindowBg] = ImVec4(0.16f, 0.16f, 0.16f, 1.00f);
style.Colors[ImGuiCol_ChildWindowBg] = ImVec4(0.00f, 0.00f, 0.00f, 0.00f);
style.Colors[ImGuiCol_Border] = ImVec4(0.70f, 0.70f, 0.70f, 0.65f);
style.Colors[ImGuiCol_BorderShadow] = ImVec4(0.00f, 0.00f, 0.00f, 0.00f);
style.Colors[ImGuiCol_FrameBg] = ImVec4(0.00f, 0.00f, 0.00f, 0.34f);
style.Colors[ImGuiCol_FrameBgHovered] = ImVec4(0.90f, 0.80f, 0.80f, 0.40f);
style.Colors[ImGuiCol_FrameBgActive] = ImVec4(0.90f, 0.65f, 0.65f, 0.45f);
style.Colors[ImGuiCol_TitleBg] = ImVec4(0.28f, 0.00f, 0.00f, 0.47f);
style.Colors[ImGuiCol_TitleBgCollapsed] = ImVec4(1.00f, 0.00f, 0.10f, 0.00f);
style.Colors[ImGuiCol_TitleBgActive] = ImVec4(0.24f, 0.00f, 0.00f, 0.55f);
style.Colors[ImGuiCol_MenuBarBg] = ImVec4(0.51f, 0.00f, 0.00f, 0.80f);
style.Colors[ImGuiCol_ScrollbarBg] = ImVec4(0.16f, 0.16f, 0.16f, 0.60f);
style.Colors[ImGuiCol_ScrollbarGrab] = ImVec4(1.00f, 0.00f, 0.00f, 0.49f);
style.Colors[ImGuiCol_ScrollbarGrabHovered] = ImVec4(1.00f, 0.00f, 0.00f, 0.40f);
style.Colors[ImGuiCol_ScrollbarGrabActive] = ImVec4(0.80f, 0.50f, 0.50f, 0.40f);
style.Colors[ImGuiCol_ComboBg] = ImVec4(0.20f, 0.20f, 0.20f, 0.99f);
style.Colors[ImGuiCol_CheckMark] = ImVec4(0.89f, 0.65f, 0.53f, 0.50f);
style.Colors[ImGuiCol_SliderGrab] = ImVec4(1.00f, 1.00f, 1.00f, 0.30f);
style.Colors[ImGuiCol_SliderGrabActive] = ImVec4(0.80f, 0.50f, 0.50f, 1.00f);
style.Colors[ImGuiCol_Button] = ImVec4(0.44f, 0.00f, 0.00f, 0.60f);
style.Colors[ImGuiCol_ButtonHovered] = ImVec4(0.67f, 0.40f, 0.40f, 1.00f);
style.Colors[ImGuiCol_ButtonActive] = ImVec4(0.80f, 0.50f, 0.50f, 1.00f);
style.Colors[ImGuiCol_Header] = ImVec4(0.53f, 0.03f, 0.00f, 0.45f);
style.Colors[ImGuiCol_HeaderHovered] = ImVec4(0.40f, 0.00f, 0.00f, 0.80f);
style.Colors[ImGuiCol_HeaderActive] = ImVec4(1.00f, 1.00f, 1.00f, 0.80f);
style.Colors[ImGuiCol_Column] = ImVec4(0.50f, 0.50f, 0.50f, 1.00f);
style.Colors[ImGuiCol_ColumnHovered] = ImVec4(0.70f, 0.60f, 0.60f, 1.00f);
style.Colors[ImGuiCol_ColumnActive] = ImVec4(0.90f, 0.70f, 0.70f, 1.00f);
style.Colors[ImGuiCol_ResizeGrip] = ImVec4(1.00f, 1.00f, 1.00f, 0.30f);
style.Colors[ImGuiCol_ResizeGripHovered] = ImVec4(1.00f, 1.00f, 1.00f, 0.60f);
style.Colors[ImGuiCol_ResizeGripActive] = ImVec4(1.00f, 1.00f, 1.00f, 0.90f);
style.Colors[ImGuiCol_CloseButton] = ImVec4(1.00f, 0.00f, 0.00f, 0.00f);
style.Colors[ImGuiCol_CloseButtonHovered] = ImVec4(0.70f, 0.70f, 0.90f, 0.60f);
style.Colors[ImGuiCol_CloseButtonActive] = ImVec4(0.70f, 0.70f, 0.70f, 1.00f);
style.Colors[ImGuiCol_PlotLines] = ImVec4(1.00f, 1.00f, 1.00f, 1.00f);
style.Colors[ImGuiCol_PlotLinesHovered] = ImVec4(0.90f, 0.70f, 0.00f, 1.00f);
style.Colors[ImGuiCol_PlotHistogram] = ImVec4(0.90f, 0.70f, 0.00f, 1.00f);
style.Colors[ImGuiCol_PlotHistogramHovered] = ImVec4(1.00f, 0.60f, 0.00f, 1.00f);
style.Colors[ImGuiCol_TextSelectedBg] = ImVec4(0.00f, 0.00f, 1.00f, 0.35f);
style.Colors[ImGuiCol_TooltipBg] = ImVec4(0.05f, 0.05f, 0.10f, 0.90f);
style.Colors[ImGuiCol_ModalWindowDarkening] = ImVec4(0.20f, 0.20f, 0.20f, 0.35f);
ConSys->LoadConfig();
Karma = new cSprite(0,0);
Karma->Init(pDevice, XorStr("C://Karma//Pictures//Karma.png"), 250, 250);
Global::Init = true;
}
|
[
"noreply@github.com"
] |
jellyr.noreply@github.com
|
7a628e05b92ace106514633ac5f2c1720eba224c
|
c86369eefff66d72a2ce85cf0b7d0b56a776ae33
|
/FirstCPP/ColorWalk.cpp
|
cfd21a829b9361e400f89a229d0e7e0f43f54c15
|
[] |
no_license
|
jeff3456/Class-Projects
|
a33ab9689a818d79d6f4469ab85b54557c1ea484
|
bf54b4e1ca5066774fe205077f07cab1640348ff
|
refs/heads/master
| 2020-04-02T00:09:01.043386
| 2014-10-04T21:07:13
| 2014-10-04T21:07:13
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 3,845
|
cpp
|
/*
* ColorWalk.cpp
*
* Created on: Oct 4, 2014
* Author: jeff
*/
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <sstream>
#include <complex>
#include <ctime>
#include <cassert>
using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef pair<int, int> PII;
#define REP(i,s,t) for(int i=(s);i<(t);i++)
#define FILL(x,v) memset(x,v,sizeof(x))
const int INF = (int)1E9;
#define MAXN 15
int N;
int hit[MAXN][1 << MAXN];
int deg[MAXN][2];
#define MAXM (MAXN*MAXN*2)
int L, adj[MAXN], lid[MAXM], lc[MAXM], lnxt[MAXM];
bool v[MAXM][1 << MAXN];
void il(int a, int b, int c){
lnxt[L] = adj[a];
lid[L] = b;
lc[L] = c;
adj[a] = L++;
}
int main(){
int T;
cin >> T;
while (T--){
scanf("%d", &N);
FILL(adj, -1);
L = 0;
FILL(deg, 0);
REP(i, 0, N) REP(j, 0, N) {
int x; scanf("%d", &x);
if (x) {
il(j, i, 0);
deg[i][0] ++;
}
}
REP(i, 0, N) REP(j, 0, N){
int x; scanf("%d", &x);
if (x) {
il(j, i, 1);
deg[i][1] ++;
}
}
int ans = 0;
REP(k, 1, N+1){
int mask = (1 << k) - 1;
FILL(hit, 0);
FILL(v, 0);
queue<PII> q;
REP(i, 0, N){
if (deg[i][0] == 0){
REP(m, 0, 1 << (k - 1)){
q.push( PII(i, (m << 1)) );
}
}
if (deg[i][1] == 0){
REP(m, 0, 1 << (k - 1)){
q.push(PII(i, 1 + (m << 1)));
}
}
}
bool ok = 0;
while (!q.empty()){
PII now = q.front(); q.pop();
int x = now.first, m = now.second;
if (x == 0) {
ok = 1;
break;
}
int t = adj[x];
while (t != -1){
int y = lid[t], c = lc[t];
int m2 = ((m << 1) & mask) + c;
if (v[t][m2]){
t = lnxt[t];
continue;
}
v[t][m2] = 1;
hit[y][m2] ++;
if (hit[y][m2] == deg[y][c]){
q.push(PII(y, m2));
}
t = lnxt[t];
}
}
if (!ok) {
ans = k;
break;
}
}
printf("%d\n", ans);
}
return 0;
}
|
[
"jeff3456@gmail.com"
] |
jeff3456@gmail.com
|
08f394768a21cb6cbb5b7773fd8f8ee11fbe33b7
|
e8c2b57dd5c6d664d7071bb00a0b92ca52c528c7
|
/Solution/Space_Invaders/src/Ufo.cpp
|
942ee556925919d55732a3f472cca346994716d7
|
[] |
no_license
|
oskapok/Space-Invaders
|
53b08dbeff50dc61d6be607118eacd3a9f683841
|
04423f3202d203cced74ffa886733963d6c0e6a8
|
refs/heads/main
| 2023-01-22T01:07:33.207275
| 2020-11-24T13:20:46
| 2020-11-24T13:20:46
| 315,638,574
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 288
|
cpp
|
#include "..//include/Ufo.h"
Ufo::Ufo() {
alive = false;
size = sf::Vector2f(50, 50);
loadTexture(texture, ufoSprite, "ufo.png", size);
ufoSprite.setPosition(1350, 30);
}
void Ufo::TakeDamage() {
alive = false;
ufoSprite.setPosition(1350, 30);
}
void Ufo::Move() {
alive = true;
}
|
[
"39780690+oskapok@users.noreply.github.com"
] |
39780690+oskapok@users.noreply.github.com
|
0e4456b649e02708212d87b4dd6fbdb722890d56
|
5d103991b6adbe2d43de85478f25125469b0aab6
|
/Single Number/solution.cpp
|
9f2358f867602f023f55f21dcc2ecfb5291e56c3
|
[] |
no_license
|
danielzheng/leetcode
|
6721604802da173fc33d0b385f98ebb985ce3a55
|
868ff91006d4df504d83e86413a78432e44ff90c
|
refs/heads/master
| 2021-05-16T02:48:27.452448
| 2017-07-31T07:19:07
| 2017-07-31T07:19:07
| 18,658,071
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 199
|
cpp
|
class Solution {
public:
int singleNumber(int A[], int n) {
int ret = 0;
for (int i = 0; i < n; i++)
{
ret = ret ^ A[i];
}
return ret;
}
};
|
[
"zheng-qiang@live.cn"
] |
zheng-qiang@live.cn
|
a8b1e64cd419a1d9604d5491326e53224f25b856
|
c464b71b7936f4e0ddf9246992134a864dd02d64
|
/workWithClint/TestCase/processor0/3.2/p
|
d3597158a27e29be9817f885fbf4418155f3108a
|
[] |
no_license
|
simuBT/foamyLatte
|
c11e69cb2e890e32e43e506934ccc31b40c4dc20
|
8f5263edb1b2ae92656ffb38437cc032eb8e4a53
|
refs/heads/master
| 2021-01-18T05:28:49.236551
| 2013-10-11T04:38:23
| 2013-10-11T04:38:23
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 2,373
|
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM Extend Project: Open source CFD |
| \\ / O peration | Version: 1.6-ext |
| \\ / A nd | Web: www.extend-project.de |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
location "3.2";
object p;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 2 -2 0 0 0 0];
internalField nonuniform List<scalar>
72
(
-0.0327166
-0.033593
-0.0321097
-0.0288207
-0.0238542
-0.0175773
-0.0106206
-0.00557969
0.0049587
-0.0318884
-0.0329422
-0.0318152
-0.0291592
-0.0249045
-0.0191415
-0.012345
-0.00772083
0.00461254
-0.0335553
-0.0348416
-0.0339958
-0.0316029
-0.0273818
-0.0214018
-0.0140045
-0.00841483
0.00408027
-0.0373653
-0.0386734
-0.038111
-0.035956
-0.0316436
-0.0251001
-0.0166876
-0.00962739
0.00311866
-0.043396
-0.0442413
-0.0439404
-0.0420801
-0.0376254
-0.030331
-0.0207069
-0.0112923
0.00150532
-0.0515349
-0.0508762
-0.0508207
-0.0492653
-0.0445932
-0.0363075
-0.0253447
-0.0135724
-0.000614544
-0.0611919
-0.0570031
-0.0570324
-0.0554034
-0.050453
-0.0413171
-0.0290867
-0.0156129
-0.00271702
-0.0804281
-0.0634525
-0.0615853
-0.0589686
-0.0531189
-0.0431284
-0.0302696
-0.0162363
-0.00414181
)
;
boundaryField
{
inlet
{
type zeroGradient;
}
outlet
{
type totalPressure;
rho none;
psi none;
gamma 1;
p0 uniform 0;
value uniform 0;
}
fixedWalls
{
type zeroGradient;
}
frontAndBack
{
type empty;
}
procBoundary0to1
{
type processor;
value nonuniform List<scalar> 9(-0.0731529 -0.0646657 -0.0608986 -0.0570027 -0.0502977 -0.0399879 -0.0276801 -0.0146908 -0.0046077);
}
}
// ************************************************************************* //
|
[
"clint@clint-Parallels-Virtual-Platform.(none)"
] |
clint@clint-Parallels-Virtual-Platform.(none)
|
|
be02802d7be9a01cc5af70b0361ba04218f8b429
|
25c051aeb465ce42cc68af2a2253af0871237580
|
/find_path/TransportationGraph.h
|
f7a6af1f311cb9421d11b1ed2f5f80c1ae4dade6
|
[] |
no_license
|
ClemensWon/AlgoUE3
|
54635d430b9298103bf7033615102c044643a94f
|
e5a481298e13ef4c2846ce4159456da313518973
|
refs/heads/master
| 2023-05-12T21:32:07.937464
| 2021-06-01T13:14:04
| 2021-06-01T13:14:04
| 371,735,958
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 517
|
h
|
#pragma once
#include <vector>
#include "Station.h"
#include <fstream>
#include <sstream>
#include<algorithm>
#include <queue>
class TransportationGraph
{
std::vector<Station*> stations;
void Print(Station* currStation);
public:
void CreateFromFile(std::string path);
void CreateTestGraph(int nodeCount, int edgeCount, int costLimit);
void FindPath(std::string startStationName, std::string endStationName);
Station* dijkstra(Station* currStation, Station* endStation);
~TransportationGraph();
};
|
[
"clem1719@gmail.com"
] |
clem1719@gmail.com
|
b35b89cb822ce743c8c23912adb908264588558a
|
29330d1158f2f9cd5ae2e1292b23b65982b6d097
|
/DataStructures/Stack.cpp
|
d54e5368c2be819c2533316c3ee023d13c74413f
|
[] |
no_license
|
KhaledMoataz/Castle-Enemies
|
e5905912c30f1d068d49fe5695aac2af8c8a842c
|
989950c88916a022d6f632850299d18b24bb8518
|
refs/heads/master
| 2020-04-08T03:02:54.984376
| 2018-11-24T17:50:12
| 2018-11-24T17:50:12
| 158,959,660
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,451
|
cpp
|
#include "Stack.h"
template<typename T>
Stack<T>::Stack()
{
Top=NULL;
Size=0;
}
template<typename T>
Stack<T>::Stack(const T& Data)
{
Node<T>* NodeToAdd=new Node<T>;
if(!NodeToAdd) // memory is full
{
Top=NULL;
return;
}
NodeToAdd->SetData(Data);
Top=NodeToAdd;
}
template<typename T>
Stack<T>::~Stack()
{
Clear();
}
template<typename T>
bool Stack<T>::Pop()
{
if(IsEmpty())
return false;
Node<T>* Temp;
Temp=Top;
Top=Top->GetNext();
Temp->SetNext(NULL);
delete Temp;
Size--;
return true;
}
template<typename T>
T Stack<T>::Peek()
{
assert(!IsEmpty());
return Top->GetData();
}
template<typename T>
bool Stack<T>::Push(const T& Data)
{
Node<T>* NodeToAdd=new Node<T>;
if(!NodeToAdd) //memory is full
return false;
NodeToAdd->SetData(Data);
NodeToAdd->SetNext(Top);
Top=NodeToAdd;
Size++;
return true;
}
template<typename T>
void Stack<T>::Reverse()
{
Stack<T>aux;
Stack<T>aux2;
while (!IsEmpty())
{
aux.Push(Peek());
Pop();
}
while (!aux.IsEmpty())
{
aux2.Push(aux.Peek());
aux.Pop();
}
while (!aux2.IsEmpty())
{
Push(aux2.Peek());
aux2.Pop();
}
}
template<typename T>
bool Stack<T>::IsEmpty() const
{
if(!Top)
return true;
return false;
}
template<typename T>
int Stack<T>::GetSize() const
{
return Size;
}
/*utility function*/
template<typename T>
void Stack<T>::Clear()
{
while(!(IsEmpty()))
{
Pop();
}
}
|
[
"khaledmoataz1999@yahoo.com"
] |
khaledmoataz1999@yahoo.com
|
e667b6689bbc2ad3740f3064a011d80f11415999
|
e3219a881f083918876ac93e38b957860ebdbbf5
|
/src/tries/implementations/tessil/hat-trie/glue.cpp
|
e82ade2d0d1afbd4a924938b164f7c09c1120233
|
[] |
no_license
|
rcarbone/rperf
|
9c675d536ae087b77977966802762cd63e051639
|
8a4df73f2121d12a7cd3156c558f0aa48d358508
|
refs/heads/master
| 2020-12-02T12:45:15.330450
| 2019-08-05T07:48:00
| 2019-08-05T07:48:00
| 96,582,848
| 4
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,317
|
cpp
|
/* System headers */
#include <stdlib.h>
#include <string>
using namespace std;
/* key && val */
typedef char rkey_t;
typedef void * rval_t;
/* The implementation */
#include "htrie_map.h"
using namespace tsl;
/* Project headers */
/* librtrie - an abstract C library over real trie implementations */
typedef tsl::htrie_map<rkey_t, rval_t> rtrie_t;
#include "rtrie-api.h"
/* Node definition */
#include "nodes.h"
#include "safe.h"
rtrie_t * rtrie_alloc (void)
{
return new rtrie_t;
}
void rtrie_free (rtrie_t * trie)
{
delete trie;
}
void rtrie_foreach (rtrie_t * trie, rtrie_each_f * fn, void * data)
{
rtrie_t::iterator it;
for (it = trie -> begin (); it != trie -> end (); ++ it)
if (fn)
fn (data);
}
unsigned rtrie_count (rtrie_t * trie)
{
return trie -> size ();
}
void rtrie_add (rtrie_t * trie, void * node)
{
rnode_t * pair = (rnode_t *) node;
char * key = pair -> key;
void * val = pair -> foo;
// (* trie) [key] = val;
trie -> insert (key, val);
}
void * rtrie_get (rtrie_t * trie, void * node)
{
rnode_t * pair = (rnode_t *) node;
rtrie_t::iterator it = trie -> find (pair -> key);
return it != trie -> end () ? node : NULL;
}
void rtrie_del (rtrie_t * trie, void * node)
{
rnode_t * pair = (rnode_t *) node;
trie -> erase (pair -> key);
}
|
[
"rocco@tecsiel.it"
] |
rocco@tecsiel.it
|
346609690132f13043c83a14405d8069b558f253
|
d4b733f2e00b5d0ab103ea0df6341648d95c993b
|
/src/c-cpp/include/sst/private/is_positive/arithmetic.hpp
|
2e4fa9e5c7a9d332b47f3d30d3b1866a9d47ab5f
|
[
"MIT"
] |
permissive
|
stealthsoftwareinc/sst
|
ad6117a3d5daf97d947862674336e6938c0bc699
|
f828f77db0ab27048b3204e10153ee8cfc1b2081
|
refs/heads/master
| 2023-04-06T15:21:14.371804
| 2023-03-24T08:30:48
| 2023-03-24T08:30:48
| 302,539,309
| 1
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 2,923
|
hpp
|
//
// Copyright (C) 2012-2023 Stealth Software Technologies, Inc.
//
// 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 (including
// the next paragraph) 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.
//
// SPDX-License-Identifier: MIT
//
#ifndef SST_PRIVATE_IS_POSITIVE_ARITHMETIC_HPP
#define SST_PRIVATE_IS_POSITIVE_ARITHMETIC_HPP
#include <sst/catalog/enable_if_t.hpp>
#include <sst/catalog/is_arithmetic_ish.hpp>
#include <sst/catalog/remove_cvref_t.hpp>
#include <sst/catalog/zero.hpp>
#include <sst/private/is_positive.hpp>
namespace sst {
//----------------------------------------------------------------------
#define SST_r (x > sst::zero<T>())
template<class T>
class is_positive_functor<
sst::enable_if_t<sst::is_arithmetic_ish<T>::value>,
void,
T> {
public:
constexpr bool operator()(sst::remove_cvref_t<T> const & x) const
noexcept(noexcept(SST_r)) {
return SST_r;
}
}; //
#undef SST_r
//----------------------------------------------------------------------
} // namespace sst
//----------------------------------------------------------------------
// Compile-time tests
//----------------------------------------------------------------------
#include <sst/catalog/SST_COMPILE_TIME_TESTS.h>
#if SST_COMPILE_TIME_TESTS
#include <sst/catalog/SST_STATIC_ASSERT.h>
SST_STATIC_ASSERT(!sst::is_positive(false));
SST_STATIC_ASSERT(sst::is_positive(true));
SST_STATIC_ASSERT(!sst::is_positive(-1));
SST_STATIC_ASSERT(!sst::is_positive(0));
SST_STATIC_ASSERT(sst::is_positive(1));
SST_STATIC_ASSERT(!sst::is_positive(0U));
SST_STATIC_ASSERT(sst::is_positive(1U));
SST_STATIC_ASSERT(noexcept(sst::is_positive(false)));
SST_STATIC_ASSERT(noexcept(sst::is_positive(0)));
SST_STATIC_ASSERT(noexcept(sst::is_positive(0U)));
#endif // #if SST_COMPILE_TIME_TESTS
//----------------------------------------------------------------------
#endif // #ifndef SST_PRIVATE_IS_POSITIVE_ARITHMETIC_HPP
|
[
"sst@stealthsoftwareinc.com"
] |
sst@stealthsoftwareinc.com
|
2e661c3fd55a479f1c88c1cb1c59b1351dd0d628
|
eab8377af0c2a51a4bb7b50def0bf4265c7ab551
|
/src/builtins/builtins-function.cc
|
1f58c987ca946d217d5e75f77a8b8633f753c32c
|
[
"BSD-3-Clause",
"bzip2-1.0.6",
"SunPro"
] |
permissive
|
sarehuna/v8
|
7c7bc02bd0ddff419a2d494144ef198d9aaabcd9
|
3ef16185e43e54507e385a91a6e53a71becc9a98
|
refs/heads/master
| 2021-04-27T11:58:47.337118
| 2018-02-23T00:18:45
| 2018-02-23T00:57:38
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 12,890
|
cc
|
// Copyright 2016 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "src/builtins/builtins-utils.h"
#include "src/builtins/builtins.h"
#include "src/code-factory.h"
#include "src/compiler.h"
#include "src/conversions.h"
#include "src/counters.h"
#include "src/lookup.h"
#include "src/objects-inl.h"
#include "src/string-builder.h"
namespace v8 {
namespace internal {
namespace {
// ES6 section 19.2.1.1.1 CreateDynamicFunction
MaybeHandle<Object> CreateDynamicFunction(Isolate* isolate,
BuiltinArguments args,
const char* token) {
// Compute number of arguments, ignoring the receiver.
DCHECK_LE(1, args.length());
int const argc = args.length() - 1;
Handle<JSFunction> target = args.target();
Handle<JSObject> target_global_proxy(target->global_proxy(), isolate);
if (!Builtins::AllowDynamicFunction(isolate, target, target_global_proxy)) {
isolate->CountUsage(v8::Isolate::kFunctionConstructorReturnedUndefined);
return isolate->factory()->undefined_value();
}
// Build the source string.
Handle<String> source;
int parameters_end_pos = kNoSourcePosition;
{
IncrementalStringBuilder builder(isolate);
builder.AppendCharacter('(');
builder.AppendCString(token);
if (FLAG_harmony_function_tostring) {
builder.AppendCString(" anonymous(");
} else {
builder.AppendCharacter('(');
}
bool parenthesis_in_arg_string = false;
if (argc > 1) {
for (int i = 1; i < argc; ++i) {
if (i > 1) builder.AppendCharacter(',');
Handle<String> param;
ASSIGN_RETURN_ON_EXCEPTION(
isolate, param, Object::ToString(isolate, args.at(i)), Object);
param = String::Flatten(param);
builder.AppendString(param);
if (!FLAG_harmony_function_tostring) {
// If the formal parameters string include ) - an illegal
// character - it may make the combined function expression
// compile. We avoid this problem by checking for this early on.
DisallowHeapAllocation no_gc; // Ensure vectors stay valid.
String::FlatContent param_content = param->GetFlatContent();
for (int i = 0, length = param->length(); i < length; ++i) {
if (param_content.Get(i) == ')') {
parenthesis_in_arg_string = true;
break;
}
}
}
}
if (!FLAG_harmony_function_tostring) {
// If the formal parameters include an unbalanced block comment, the
// function must be rejected. Since JavaScript does not allow nested
// comments we can include a trailing block comment to catch this.
builder.AppendCString("\n/*``*/");
}
}
if (FLAG_harmony_function_tostring) {
builder.AppendCharacter('\n');
parameters_end_pos = builder.Length();
}
builder.AppendCString(") {\n");
if (argc > 0) {
Handle<String> body;
ASSIGN_RETURN_ON_EXCEPTION(
isolate, body, Object::ToString(isolate, args.at(argc)), Object);
builder.AppendString(body);
}
builder.AppendCString("\n})");
ASSIGN_RETURN_ON_EXCEPTION(isolate, source, builder.Finish(), Object);
// The SyntaxError must be thrown after all the (observable) ToString
// conversions are done.
if (parenthesis_in_arg_string) {
THROW_NEW_ERROR(isolate,
NewSyntaxError(MessageTemplate::kParenthesisInArgString),
Object);
}
}
// Compile the string in the constructor and not a helper so that errors to
// come from here.
Handle<JSFunction> function;
{
ASSIGN_RETURN_ON_EXCEPTION(
isolate, function,
Compiler::GetFunctionFromString(
handle(target->native_context(), isolate), source,
ONLY_SINGLE_FUNCTION_LITERAL, parameters_end_pos),
Object);
Handle<Object> result;
ASSIGN_RETURN_ON_EXCEPTION(
isolate, result,
Execution::Call(isolate, function, target_global_proxy, 0, nullptr),
Object);
function = Handle<JSFunction>::cast(result);
function->shared()->set_name_should_print_as_anonymous(true);
}
// If new.target is equal to target then the function created
// is already correctly setup and nothing else should be done
// here. But if new.target is not equal to target then we are
// have a Function builtin subclassing case and therefore the
// function has wrong initial map. To fix that we create a new
// function object with correct initial map.
Handle<Object> unchecked_new_target = args.new_target();
if (!unchecked_new_target->IsUndefined(isolate) &&
!unchecked_new_target.is_identical_to(target)) {
Handle<JSReceiver> new_target =
Handle<JSReceiver>::cast(unchecked_new_target);
Handle<Map> initial_map;
ASSIGN_RETURN_ON_EXCEPTION(
isolate, initial_map,
JSFunction::GetDerivedMap(isolate, target, new_target), Object);
Handle<SharedFunctionInfo> shared_info(function->shared(), isolate);
Handle<Map> map = Map::AsLanguageMode(initial_map, shared_info);
Handle<Context> context(function->context(), isolate);
function = isolate->factory()->NewFunctionFromSharedFunctionInfo(
map, shared_info, context, NOT_TENURED);
}
return function;
}
} // namespace
// ES6 section 19.2.1.1 Function ( p1, p2, ... , pn, body )
BUILTIN(FunctionConstructor) {
HandleScope scope(isolate);
Handle<Object> result;
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
isolate, result, CreateDynamicFunction(isolate, args, "function"));
return *result;
}
// ES6 section 25.2.1.1 GeneratorFunction (p1, p2, ... , pn, body)
BUILTIN(GeneratorFunctionConstructor) {
HandleScope scope(isolate);
RETURN_RESULT_OR_FAILURE(isolate,
CreateDynamicFunction(isolate, args, "function*"));
}
BUILTIN(AsyncFunctionConstructor) {
HandleScope scope(isolate);
Handle<Object> maybe_func;
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
isolate, maybe_func,
CreateDynamicFunction(isolate, args, "async function"));
if (!maybe_func->IsJSFunction()) return *maybe_func;
// Do not lazily compute eval position for AsyncFunction, as they may not be
// determined after the function is resumed.
Handle<JSFunction> func = Handle<JSFunction>::cast(maybe_func);
Handle<Script> script = handle(Script::cast(func->shared()->script()));
int position = script->GetEvalPosition();
USE(position);
return *func;
}
BUILTIN(AsyncGeneratorFunctionConstructor) {
HandleScope scope(isolate);
Handle<Object> maybe_func;
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
isolate, maybe_func,
CreateDynamicFunction(isolate, args, "async function*"));
if (!maybe_func->IsJSFunction()) return *maybe_func;
// Do not lazily compute eval position for AsyncFunction, as they may not be
// determined after the function is resumed.
Handle<JSFunction> func = Handle<JSFunction>::cast(maybe_func);
Handle<Script> script = handle(Script::cast(func->shared()->script()));
int position = script->GetEvalPosition();
USE(position);
return *func;
}
namespace {
Object* DoFunctionBind(Isolate* isolate, BuiltinArguments args) {
HandleScope scope(isolate);
DCHECK_LE(1, args.length());
if (!args.receiver()->IsCallable()) {
THROW_NEW_ERROR_RETURN_FAILURE(
isolate, NewTypeError(MessageTemplate::kFunctionBind));
}
// Allocate the bound function with the given {this_arg} and {args}.
Handle<JSReceiver> target = args.at<JSReceiver>(0);
Handle<Object> this_arg = isolate->factory()->undefined_value();
ScopedVector<Handle<Object>> argv(std::max(0, args.length() - 2));
if (args.length() > 1) {
this_arg = args.at(1);
for (int i = 2; i < args.length(); ++i) {
argv[i - 2] = args.at(i);
}
}
Handle<JSBoundFunction> function;
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
isolate, function,
isolate->factory()->NewJSBoundFunction(target, this_arg, argv));
LookupIterator length_lookup(target, isolate->factory()->length_string(),
target, LookupIterator::OWN);
// Setup the "length" property based on the "length" of the {target}.
// If the targets length is the default JSFunction accessor, we can keep the
// accessor that's installed by default on the JSBoundFunction. It lazily
// computes the value from the underlying internal length.
if (!target->IsJSFunction() ||
length_lookup.state() != LookupIterator::ACCESSOR ||
!length_lookup.GetAccessors()->IsAccessorInfo()) {
Handle<Object> length(Smi::kZero, isolate);
Maybe<PropertyAttributes> attributes =
JSReceiver::GetPropertyAttributes(&length_lookup);
if (attributes.IsNothing()) return isolate->heap()->exception();
if (attributes.FromJust() != ABSENT) {
Handle<Object> target_length;
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, target_length,
Object::GetProperty(&length_lookup));
if (target_length->IsNumber()) {
length = isolate->factory()->NewNumber(std::max(
0.0, DoubleToInteger(target_length->Number()) - argv.length()));
}
}
LookupIterator it(function, isolate->factory()->length_string(), function);
DCHECK_EQ(LookupIterator::ACCESSOR, it.state());
RETURN_FAILURE_ON_EXCEPTION(isolate,
JSObject::DefineOwnPropertyIgnoreAttributes(
&it, length, it.property_attributes()));
}
// Setup the "name" property based on the "name" of the {target}.
// If the target's name is the default JSFunction accessor, we can keep the
// accessor that's installed by default on the JSBoundFunction. It lazily
// computes the value from the underlying internal name.
LookupIterator name_lookup(target, isolate->factory()->name_string(), target);
if (!target->IsJSFunction() ||
name_lookup.state() != LookupIterator::ACCESSOR ||
!name_lookup.GetAccessors()->IsAccessorInfo() ||
(name_lookup.IsFound() && !name_lookup.HolderIsReceiver())) {
Handle<Object> target_name;
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, target_name,
Object::GetProperty(&name_lookup));
Handle<String> name;
if (target_name->IsString()) {
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
isolate, name,
Name::ToFunctionName(Handle<String>::cast(target_name)));
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
isolate, name, isolate->factory()->NewConsString(
isolate->factory()->bound__string(), name));
} else {
name = isolate->factory()->bound__string();
}
LookupIterator it(function, isolate->factory()->name_string());
DCHECK_EQ(LookupIterator::ACCESSOR, it.state());
RETURN_FAILURE_ON_EXCEPTION(isolate,
JSObject::DefineOwnPropertyIgnoreAttributes(
&it, name, it.property_attributes()));
}
return *function;
}
} // namespace
// ES6 section 19.2.3.2 Function.prototype.bind ( thisArg, ...args )
BUILTIN(FunctionPrototypeBind) { return DoFunctionBind(isolate, args); }
// TODO(verwaest): This is a temporary helper until the FastFunctionBind stub
// can tailcall to the builtin directly.
RUNTIME_FUNCTION(Runtime_FunctionBind) {
DCHECK_EQ(2, args.length());
Arguments* incoming = reinterpret_cast<Arguments*>(args[0]);
// Rewrap the arguments as builtins arguments.
int argc = incoming->length() + BuiltinArguments::kNumExtraArgsWithReceiver;
BuiltinArguments caller_args(argc, incoming->arguments() + 1);
return DoFunctionBind(isolate, caller_args);
}
// ES6 section 19.2.3.5 Function.prototype.toString ( )
BUILTIN(FunctionPrototypeToString) {
HandleScope scope(isolate);
Handle<Object> receiver = args.receiver();
if (receiver->IsJSBoundFunction()) {
return *JSBoundFunction::ToString(Handle<JSBoundFunction>::cast(receiver));
}
if (receiver->IsJSFunction()) {
return *JSFunction::ToString(Handle<JSFunction>::cast(receiver));
}
// With the revised toString behavior, all callable objects are valid
// receivers for this method.
if (FLAG_harmony_function_tostring && receiver->IsJSReceiver() &&
JSReceiver::cast(*receiver)->map()->is_callable()) {
return isolate->heap()->function_native_code_string();
}
THROW_NEW_ERROR_RETURN_FAILURE(
isolate, NewTypeError(MessageTemplate::kNotGeneric,
isolate->factory()->NewStringFromAsciiChecked(
"Function.prototype.toString"),
isolate->factory()->Function_string()));
}
} // namespace internal
} // namespace v8
|
[
"commit-bot@chromium.org"
] |
commit-bot@chromium.org
|
230f1ee3016c754bbef1210d1bebc4d531ceb695
|
b5fa9affae73b44b512345092c21b6c6ed5d9f6c
|
/CookieCutter.cpp
|
007eb14ff01c0dd1723fbdf88ff2a644dc0225d0
|
[] |
no_license
|
roman-dzieciol/CookieCutter
|
ae2585da6e38e82b2f357d1e1cceff2c13ebf824
|
c78d5e3f5e88bc08ff058c289257348745552d90
|
refs/heads/master
| 2020-07-03T13:04:22.439934
| 2014-07-06T07:39:33
| 2014-07-06T07:39:33
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 5,129
|
cpp
|
// :: UnrealScript TextBuffer Exporter
// :: Copyright(C) 2004 Switch` switch@thieveryut.com
#include "CookieCutter.h"
int main(int argc, char* argv[])
{
if( argc != 2 )
{
cout << endl << "INFO :: UnrealScript TextBuffer Exporter";
cout << endl << " :: Copyright(C) 2004 Switch` switch@thieveryut.com";
cout << endl;
cout << endl << "USAGE :: CookieCutter.exe UnrealPackage";
cout << endl << "EXAMPLE :: CookieCutter.exe Core.u";
cout << endl;
return 0;
}
ProcessFile(argv[1]);
return 0;
}
void ProcessFile( string FName )
{
fstream File(FName.c_str(), ios::in | ios::binary);
if( File.good() == false )
{
cout << endl << "[ERROR] Unable to open file "<< FName;
cout << endl;
return;
}
// - make directory -------------------------------------------------------
string mdcmd = "mkdir ";
string pkgdir = ".\\";
pkgdir.append(FName, 0, FName.find('.'));
pkgdir.append("\\Classes\\");
mdcmd.append(pkgdir);
system(mdcmd.c_str());
// - header ---------------------------------------------------------------
PKG_Header PKGHeader;
File.read((char*)(&PKGHeader), sizeof(PKGHeader));
// info
// cout << endl << "Package Version " << dec << LOWORD(PKGHeader.PackageVersion);
// cout << endl << "Licencee Mode " << dec << HIWORD(PKGHeader.PackageVersion);
// - get scripttext index -------------------------------------------------
DWORD STIndex = -1;
NameItem* NameList = ReadNameTable( File, PKGHeader.NameOffset, PKGHeader.NameCount, STIndex );
if( STIndex == -1 )
{
cout << endl << "[ERROR] ScriptText not found in the NameTable";
cout << endl;
return;
}
// - find scripttexts in export table -------------------------------------
ExportItem* ExportList = ReadExportTable( File, PKGHeader.ExportOffset, PKGHeader.ExportCount );
DWORD i;
for(i=0; i<PKGHeader.ExportCount; i++)
{
if( ExportList[i].ObjectName == STIndex )
{
//cout << endl << "[" << i << "] " << dec << NameList[ExportList[ExportList[i].Package-1].ObjectName].Name;
char *buffer = ReadTextBuffer( File, ExportList[i].SerialOffset );
string fname = pkgdir + "\\" + NameList[ExportList[ExportList[i].Package-1].ObjectName].Name + ".uc";
fstream SrcFile(fname.c_str(), ios_base::out | ios_base::trunc | ios_base::binary);
SrcFile << buffer;
SrcFile.close();
//cout << endl << buffer;
delete[] buffer;
}
}
File.close();
return;
}
NameItem* ReadNameTable( fstream &File, DWORD &NameOffset, DWORD &NameCount, DWORD &TextBufferIndex )
{
File.seekg( NameOffset, ios_base::beg );
BYTE NameLength;
DWORD NameFlags;
DWORD i;
NameItem *NameList;
NameList = (NameItem *) malloc(NameCount * sizeof(NameItem));
for(i=0; i<NameCount; i++)
{
NameLength = File.get();
char *buffer = new char [NameLength];
File.read( buffer, NameLength);
File.read((char*)(&(NameFlags)), sizeof(NameFlags));
NameList[i].Name = buffer;
NameList[i].Flags = NameFlags;
if( strcmp(buffer, "ScriptText") == 0 )
TextBufferIndex = i;
// cout <<endl<< NameList[i].Name;
}
return NameList;
}
ExportItem* ReadExportTable( fstream &File, DWORD &ExportOffset, DWORD &ExportCount )
{
File.seekg( ExportOffset, ios_base::beg );
DWORD i;
ExportItem *ExportList;
ExportList = (ExportItem *) malloc(ExportCount * sizeof(ExportItem));
for(i=0; i<ExportCount; i++)
{
ExportList[i].Class = ReadIndex( File );
ExportList[i].Super = ReadIndex( File );
File.read((char*)(&ExportList[i].Package), sizeof(ExportList[i].Package));
ExportList[i].ObjectName = ReadIndex( File );
File.read((char*)(&ExportList[i].ObjectFlags), sizeof(ExportList[i].ObjectFlags));
ExportList[i].SerialSize = ReadIndex( File );
if( ExportList[i].SerialSize > 0 )
ExportList[i].SerialOffset = ReadIndex( File );
// cout <<endl<< ExportList[i].ObjectName;
}
return ExportList;
}
string itos(int num)
{
ostringstream myStream;
myStream << num << flush;
return(myStream.str());
}
int ReadIndex( fstream &File )
{
BYTE b0, b1, b2, b3, b4;
int result = 0;
b0 = File.get();
if (b0 & 0x40)
{
b1 = File.get();
if (b1 & 0x80)
{
b2 = File.get();
if (b2 & 0x80)
{
b3 = File.get();
if (b3 & 0x80)
{
b4 = File.get();
result = b4;
}
result = (result << 7) + (b3 & 0x7F);
}
result = (result << 7) + (b2 & 0x7F);
}
result = (result << 7) + (b1 & 0x7F);
}
result = (result << 6) + (b0 & 0x3F);
if (b0 & 0x80)
result = -result;
return result;
}
char* ReadTextBuffer( fstream &File, DWORD Offset )
{
DWORD Pos;
DWORD Top;
WORD wtf;
DWORD TextSize;
DWORD OldOffset;
OldOffset = File.tellg();
File.seekg( Offset, ios_base::beg );
File.read((char*)(&Pos), sizeof(Pos));
File.read((char*)(&Top), sizeof(Top));
File.read((char*)(&wtf), sizeof(wtf));
TextSize = ReadIndex( File );
//cout << endl << dec << "Pos: " << Pos << ", Top: " << Top << ", wtf: " << wtf << ", TextSize: " << TextSize;
if( TextSize > 0 )
{
char *buffer = new char [TextSize];
File.read( buffer, TextSize);
File.seekg( OldOffset, ios_base::beg );
return buffer;
}
return "empty textbuffer?";
}
|
[
"roman.dzieciol@gmail.com"
] |
roman.dzieciol@gmail.com
|
27b7e308a8a9dcd43e03e55e250a1b35dda462d1
|
8eaece8f871eed7585adbf5833488077380f309b
|
/1850.cpp
|
eb13ba1753c3fd1588731d379568c7ffdac4adb3
|
[] |
no_license
|
piuto1104/BeakJoon
|
4d92bfc7e9bcd8f0d91fe02a0732f5ce8ac0f002
|
4b39de3720544c367ed91433cea6030147450b73
|
refs/heads/master
| 2020-07-18T02:38:40.402468
| 2016-08-25T05:53:37
| 2016-08-25T05:53:37
| 66,529,049
| 0
| 0
| null | null | null | null |
UHC
|
C++
| false
| false
| 978
|
cpp
|
#include <iostream>
#include <string>
#include <math.h>
using namespace std;
class Wang{
public:
long long big;
long long small;
void set(){
cin >> big >> small;
}
void get(){
long long roof;
roof = gcd(big, small);
for (long long i = 0; i<roof; i++){
cout << 1;
}
//cout << lcm(big, small) << endl;
}
long long max(long long a, long long b){
if (a > b)
return a;
else
return b;
}
long long min(long long a, long long b) {
if (a > b)
return b;
else
return a;
}
/** 유클리드 알고리즘을 통해 최대 공약수와 최소 공배수를 구함. **/
long long euclid(long long a, long long b) {
if (b == 0)
return a;
return euclid(b, a % b);
}
/* 최대 공약수 */
long long gcd(long long a, long long b) {
return euclid(max(a, b), min(a, b));
}
/* 최소 공배수 */
long long lcm(long long a, long long b) {
return (a * b) / gcd(a, b);
}
};
int main(){
Wang w;
w.set();
w.get();
return 0;
}
|
[
"piuto1104@nate.com"
] |
piuto1104@nate.com
|
bc13ef362b24c1ae6d954a72f8fb308a549027d1
|
cc3ef570cda890b73d3b01860ae18239d7d42c92
|
/src/HiCComputers.cpp
|
e35226b8ea6da11d342f5da47760e987084d570e
|
[] |
no_license
|
msauria/misha-package
|
3e9d53af95b0fb5bb9831b90794f0f3a031ad3c2
|
005713b08df0edf09c96a24f117a6afed7dc07be
|
refs/heads/master
| 2021-07-21T04:29:48.609435
| 2017-10-30T17:33:08
| 2017-10-30T17:33:08
| 108,885,504
| 1
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 12,472
|
cpp
|
#include "TGLException.h"
#include "GenomeTrack2D.h"
#include "HiCComputers.h"
#include <fstream>
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Utility structure and functions
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
struct comp_interval_start : public binary_function<GInterval, GInterval, bool> {
bool operator()(const GInterval x, const GInterval y) {
if (x.chromid != y.chromid)
return (x.chromid < y.chromid);
else
return (x.start < y.start);
}
};
struct comp_interval_end : public binary_function<GInterval, GInterval, bool> {
const bool operator()(const GInterval x, const GInterval y) {
if (x.chromid != y.chromid)
return (x.chromid < y.chromid);
else
return (x.end < y.end);
}
};
static void binary_search(const GIntervals& ints, int chromid, int64_t coord, bool is_start, int& index)
{
GIntervals::const_iterator it;
GInterval interval(chromid, coord, coord, 1);
if (is_start)
it = upper_bound (ints.begin(), ints.end(), interval, comp_interval_end());
else
it = lower_bound (ints.begin(), ints.end(), interval, comp_interval_start());
index = it - ints.begin();
}
static void write_string(BufferedFile& bfile, string str)
{
size_t size = str.size();
bfile.write(&size, sizeof(size));
if (bfile.write(&*str.begin(), sizeof(char)*size) != size)
TGLError("Writing string failed, file: %s", bfile.file_name().c_str());
}
static void read_string(BufferedFile& bfile, string& str)
{
size_t size;
bfile.read(&size, sizeof(size));
str.resize(size);
if (bfile.read(&*str.begin(), sizeof(char)*size) != size)
TGLError("Reading string failed, file: %s", bfile.file_name().c_str());
}
static void write_matrix(BufferedFile& bfile, Matrix<double>& matrix)
{
int num_rows = matrix.row_size();
int num_cols = matrix.col_size();
bfile.write(&num_rows, sizeof(num_rows));
bfile.write(&num_cols, sizeof(num_cols));
vector<double>& vec = matrix.get_vector();
if (bfile.write(&*vec.begin(), sizeof(double)*vec.size()) != sizeof(double)*vec.size())
TGLError("Writing matrix failed, file: %s", bfile.file_name().c_str());
}
static void read_matrix(BufferedFile& bfile, Matrix<double>& matrix)
{
int num_rows;
int num_cols;
bfile.read(&num_rows, sizeof(num_rows));
bfile.read(&num_cols, sizeof(num_cols));
matrix.resize(num_rows, num_cols);
vector<double>& vec = matrix.get_vector();
if (bfile.read(&*vec.begin(), sizeof(double)*vec.size()) != sizeof(double)*vec.size())
TGLError("Reading matrix failed, file: %s", bfile.file_name().c_str());
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// PotentialComputer2D
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
double PotentialComputer2D::compute(const Rectangle &rectangle, const DiagonalBand *band)
{
if (!m_loaded)
{
string track_fn1 = string(m_trackdb_path) + "/" + m_track_fn1;
string track_fn2 = string(m_trackdb_path) + "/" + m_track_fn2;
m_track1.init_read(track_fn1.c_str(), m_chromid1);
m_track2.init_read(track_fn2.c_str(), m_chromid2);
m_loaded = true;
}
GInterval interval1(m_chromid1, rectangle.x1, rectangle.x2, 1);
GInterval interval2(m_chromid2, rectangle.y1, rectangle.y2, 1);
// cout << "x1=" << rectangle.x1 << " y1=" << rectangle.y1 << " x2=" << rectangle.x2 << " y2=" << rectangle.y2 << endl;
int start1, end1, start2, end2;
const GIntervals& intervals1 = m_track1.get_intervals();
const GIntervals& intervals2 = m_track2.get_intervals();
if ((intervals1.size() == 0) || (intervals2.size() == 0))
return 0;
// find indices matching the query rectantgle
binary_search(intervals1, m_chromid1, interval1.start, true, start1);
binary_search(intervals1, m_chromid1, interval1.end, false, end1);
binary_search(intervals2, m_chromid2, interval2.start, true, start2);
binary_search(intervals2, m_chromid2, interval2.end, false, end2);
// cout << "indices: start1=" << start1 << ", end1=" << end1 << ", start2=" << start2 << ", end2=" << end2 << endl;
// cout << "start1: " << intervals1[start1].start << " - " << intervals1[start1].end << endl;
// cout << "end1: " << intervals1[end1-1].start << " - " << intervals1[end1-1].end << endl;
// cout << "start2: " << intervals2[start2].start << " - " << intervals2[start2].end << endl;
// cout << "end2: " << intervals2[end2-1].start << " - " << intervals2[end2-1].end << endl;
double result = 0;
for (int i1 = start1; i1 < end1; i1++) {
for (int i2 = start2; i2 < end2; i2++) {
if (band && band->do_contain(Rectangle(intervals1[i1].start, intervals2[i2].start, intervals1[i1].end, intervals2[i2].end)))
continue;
result++;
} }
// divide by area
double area = (rectangle.x2 - rectangle.x1) * (rectangle.y2 - rectangle.y1);
result = result / area;
return result;
}
void PotentialComputer2D::serialize(BufferedFile& bfile)
{
write_string(bfile, m_track_fn1);
write_string(bfile, m_track_fn2);
}
void PotentialComputer2D::unserialize(BufferedFile& bfile)
{
read_string(bfile, m_track_fn1);
read_string(bfile, m_track_fn2);
}
void PotentialComputer2D::dump()
{
cout << "m_type: " << m_type << endl;
cout << "m_chromid1: " << m_chromid1 << endl;
cout << "m_chromid2: " << m_chromid2 << endl;
cout << "m_track_fn1: " << m_track_fn1 << endl;
cout << "m_track_fn2: " << m_track_fn2 << endl;
}
void PotentialComputer2D::set_fend_track(const char* track_fn1, const char* track_fn2)
{
m_track_fn1 = string(track_fn1);
m_track_fn2 = string(track_fn2);
m_loaded = false;
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// TechnicalComputer2D
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
TechnicalComputer2D::~TechnicalComputer2D()
{
delete[] m_track1;
delete[] m_track2;
}
static bool file_exists(const char * filename)
{
std::fstream f;
f.open(filename);
return (f.is_open());
}
double TechnicalComputer2D::compute(const Rectangle &rectangle, const DiagonalBand *band)
{
// printf("tech pcomputer called\n");
if ( (rectangle.x1 >= rectangle.x2) || (rectangle.y1 >= rectangle.y2) )
return 0;
if (m_dim == 0)
TGLError("Assertion: dim must be >0");
if ( ((int)m_track_fn1.size() != (int)m_dim) || ((int)m_track_fn2.size() != m_dim) || ((int)m_matrix.size() != m_dim))
TGLError("Assertion: number of correction tracks (d1=%d, d2=%d) and number of correction matrices (%d) must be equal to %d",
m_track_fn1.size(), m_track_fn2.size(), m_matrix.size(), m_dim);
if (!m_loaded)
{
delete[] m_track1;
delete[] m_track2;
m_track1 = new GenomeTrackSparse[m_dim];
m_track2 = new GenomeTrackSparse[m_dim];
for (int i = 0; i < m_dim; i++) {
// track1
string track_fn1 = string(m_trackdb_path) + "/" + m_track_fn1[i];
if ( !file_exists(track_fn1.c_str()))
TGLError("File does not exist: %s", track_fn1.c_str());
m_track1[i].init_read(track_fn1.c_str(), m_chromid1);
// track2
string track_fn2 = string(m_trackdb_path) + "/" + m_track_fn2[i];
if ( !file_exists(track_fn2.c_str()))
TGLError("File does not exist: %s", track_fn2.c_str());
m_track2[i].init_read(track_fn2.c_str(), m_chromid2);
}
m_loaded = true;
}
GInterval interval1(m_chromid1, rectangle.x1, rectangle.x2, 1);
GInterval interval2(m_chromid2, rectangle.y1, rectangle.y2, 1);
int start1=0, end1=0, start2=0, end2=0;
const GIntervals& gintervals1 = m_track1[0].get_intervals();
const GIntervals& gintervals2 = m_track2[0].get_intervals();
for (int i = 0; i < m_dim; i++) {
const GIntervals& intervals1 = m_track1[i].get_intervals();
const GIntervals& intervals2 = m_track2[i].get_intervals();
int tstart1, tend1, tstart2, tend2;
// find indices matching the query rectantgle
binary_search(intervals1, m_chromid1, interval1.start, true, tstart1);
binary_search(intervals1, m_chromid1, interval1.end, false, tend1);
binary_search(intervals2, m_chromid2, interval2.start, true, tstart2);
binary_search(intervals2, m_chromid2, interval2.end, false, tend2);
if (i == 0)
{
start1 = tstart1;
start2 = tstart2;
end1 = tend1;
end2 = tend2;
}
if ( (start1 != tstart1) || (start2 != tstart2) || (end1 != tend1) || (end2 != tend2) )
TGLError("model tracks must have identical structure");
}
if ((start1 == end1) || (start2 == end2))
return 0;
// cout << "start1=" << start1 << " end1=" << end1 << " start2=" << start2 << " end2=" << end2 << endl;
//printf("prior=%e\n", m_prior);
double result = 0;
for (int i1 = start1; i1 < end1; i1++) {
for (int i2 = start2; i2 < end2; i2++) {
if (band && !band->do_contain(Rectangle(gintervals1[i1].start, gintervals2[i2].start, gintervals1[i1].end, gintervals2[i2].end)))
continue;
double value = m_prior;
for(unsigned int mi = 0; mi < m_matrix.size(); mi++) {
int f1 = (int)m_track1[mi].get_vals()[i1] - 1;
int f2 = (int)m_track2[mi].get_vals()[i2] - 1;
value *= m_matrix[mi][f1][f2];
// printf("f1=%d, f2=%d, factor=%.10f ////", f1, f2, m_matrix[mi][f1][f2]);
}
// cout << endl;
result += value;
} }
double area = (rectangle.x2 - rectangle.x1) * (rectangle.y2 - rectangle.y1);
result /= area;
return result;
}
void TechnicalComputer2D::serialize(BufferedFile& bfile)
{
// write dimension
bfile.write(&m_dim, sizeof(m_dim));
// write prior
bfile.write(&m_prior, sizeof(m_prior));
for (int i = 0; i < m_dim; i++)
{
write_string(bfile, m_track_fn1[i]);
write_string(bfile, m_track_fn2[i]);
write_matrix(bfile, m_matrix[i]);
}
}
void TechnicalComputer2D::unserialize(BufferedFile& bfile)
{
// read dimension
bfile.read(&m_dim, sizeof(m_dim));
// write prior
bfile.read(&m_prior, sizeof(m_prior));
// resize structs
m_track_fn1.resize(m_dim);
m_track_fn2.resize(m_dim);
m_matrix.resize(m_dim);
for (int i = 0; i < m_dim; i++)
{
read_string(bfile, m_track_fn1[i]);
read_string(bfile, m_track_fn2[i]);
read_matrix(bfile, m_matrix[i]);
}
}
void TechnicalComputer2D::dump()
{
cout << "m_type: " << m_type << endl;
cout << "m_chromid1: " << m_chromid1 << endl;
cout << "m_chromid2: " << m_chromid2 << endl;
cout << "m_dim: " << m_dim << endl;
for (unsigned int i = 0; i < m_track_fn1.size(); i++) {
cout << "m_track_fn1: " << m_track_fn1[i] << endl;
cout << "m_track_fn2: " << m_track_fn2[i] << endl;
cout << "m_matrix: num_cols=" << m_matrix[i].col_size() << " num_rows=" << m_matrix[i].row_size() << endl;
// for (unsigned int row = 0; row < m_matrix[i].row_size(); row++) {
// for (unsigned int col = 0; col < m_matrix[i].col_size(); col++) {
// cout << m_matrix[i][col][row] << " ";
// }
// cout << endl;
// }
}
}
void TechnicalComputer2D::set_prior(double prior)
{
m_prior = prior;
m_loaded = false;
}
void TechnicalComputer2D::add_bias(const char* track_fn1, const char* track_fn2, const Matrix<double> matrix)
{
m_track_fn1.push_back(track_fn1);
m_track_fn2.push_back(track_fn2);
m_matrix.push_back(matrix);
m_dim++;
m_loaded = false;
}
void TechnicalComputer2D::clear_biases()
{
m_track_fn1.resize(0);
m_track_fn2.resize(0);
m_matrix.resize(0);
m_dim = 0;
m_loaded = false;
}
|
[
"mike.sauria@gmail.com"
] |
mike.sauria@gmail.com
|
ba0b18879540d6fc69bbf874374a69e926a83cab
|
18b69b1fc11c00ac1bfc6cc267dea5c7adfe20a7
|
/d01/ex08/Human.cpp
|
79416e789bd6ee7cd5d2661ad98b87114b17bcd3
|
[] |
no_license
|
ArtemisKS/Piscine_CPP
|
e6344a3c386b431e5c6eb2fedc9ed16b8f9530ca
|
83881e01fb391ef70e58858e9716923ae75ebaac
|
refs/heads/master
| 2020-04-09T07:09:48.963450
| 2018-12-03T06:33:42
| 2018-12-03T06:33:42
| 160,142,993
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,810
|
cpp
|
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* Human.cpp :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: akupriia <akupriia@student.unit.ua> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2018/10/02 21:34:16 by akupriia #+# #+# */
/* Updated: 2018/10/02 21:34:16 by akupriia ### ########.fr */
/* */
/* ************************************************************************** */
#include "Human.hpp"
Human::Human( void )
{
return ;
}
Human::~Human( void )
{
return ;
}
void Human::meleeAttack(std::string const & target)
{
std::cout << "Human hits " << target << " by melee attack" << std::endl;
}
void Human::rangedAttack(std::string const & target)
{
std::cout << "Human hits " << target << " by ranged attack" << std::endl;
}
void Human::intimidatingShout(std::string const & target)
{
std::cout << "Human hits " << target << " by intimidating shout" << std::endl;
}
void Human::action(std::string const & action_name, std::string const & target)
{
void (Human::*p[3])(std::string const &) = {
&Human::meleeAttack,
&Human::rangedAttack,
&Human::intimidatingShout
};
std::string s[3] = {
"meleeAttack",
"rangedAttack",
"intimidatingShout"
};
for ( int i = 0; i < 3; i++ ) {
if ( s[i] == action_name ) {
(this->*p[i])(target);
break ;
}
}
}
|
[
"Artemkupriyanets@yahoo.com"
] |
Artemkupriyanets@yahoo.com
|
8dcb429880ab3238c987defcb5d370c19a551e29
|
8dc84558f0058d90dfc4955e905dab1b22d12c08
|
/sql/test/sql_test_base.cc
|
3eabb564cba596d79f1cea29c521994edfccbd97
|
[
"LicenseRef-scancode-unknown-license-reference",
"BSD-3-Clause"
] |
permissive
|
meniossin/src
|
42a95cc6c4a9c71d43d62bc4311224ca1fd61e03
|
44f73f7e76119e5ab415d4593ac66485e65d700a
|
refs/heads/master
| 2022-12-16T20:17:03.747113
| 2020-09-03T10:43:12
| 2020-09-03T10:43:12
| 263,710,168
| 1
| 0
|
BSD-3-Clause
| 2020-05-13T18:20:09
| 2020-05-13T18:20:08
| null |
UTF-8
|
C++
| false
| false
| 1,567
|
cc
|
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "sql/test/sql_test_base.h"
#include "base/files/file_util.h"
#include "sql/test/test_helpers.h"
namespace sql {
SQLTestBase::SQLTestBase() = default;
SQLTestBase::~SQLTestBase() = default;
base::FilePath SQLTestBase::db_path() {
return temp_dir_.GetPath().AppendASCII("SQLTest.db");
}
sql::Connection& SQLTestBase::db() {
return db_;
}
bool SQLTestBase::Reopen() {
db_.Close();
return db_.Open(db_path());
}
bool SQLTestBase::GetPathExists(const base::FilePath& path) {
return base::PathExists(path);
}
bool SQLTestBase::CorruptSizeInHeaderOfDB() {
return sql::test::CorruptSizeInHeader(db_path());
}
void SQLTestBase::WriteJunkToDatabase(WriteJunkType type) {
base::ScopedFILE file(base::OpenFile(
db_path(),
type == TYPE_OVERWRITE_AND_TRUNCATE ? "wb" : "rb+"));
ASSERT_TRUE(file.get() != NULL);
ASSERT_EQ(0, fseek(file.get(), 0, SEEK_SET));
const char* kJunk = "Now is the winter of our discontent.";
fputs(kJunk, file.get());
}
void SQLTestBase::TruncateDatabase() {
base::ScopedFILE file(base::OpenFile(db_path(), "rb+"));
ASSERT_TRUE(file.get() != NULL);
ASSERT_EQ(0, fseek(file.get(), 0, SEEK_SET));
ASSERT_TRUE(base::TruncateFile(file.get()));
}
void SQLTestBase::SetUp() {
ASSERT_TRUE(temp_dir_.CreateUniqueTempDir());
ASSERT_TRUE(db_.Open(db_path()));
}
void SQLTestBase::TearDown() {
db_.Close();
}
} // namespace sql
|
[
"arnaud@geometry.ee"
] |
arnaud@geometry.ee
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.