blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 2 247 | content_id stringlengths 40 40 | detected_licenses listlengths 0 57 | license_type stringclasses 2 values | repo_name stringlengths 4 111 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringlengths 4 58 | visit_date timestamp[ns]date 2015-07-25 18:16:41 2023-09-06 10:45:08 | revision_date timestamp[ns]date 1970-01-14 14:03:36 2023-09-06 06:22:19 | committer_date timestamp[ns]date 1970-01-14 14:03:36 2023-09-06 06:22:19 | github_id int64 3.89k 689M ⌀ | star_events_count int64 0 209k | fork_events_count int64 0 110k | gha_license_id stringclasses 25 values | gha_event_created_at timestamp[ns]date 2012-06-07 00:51:45 2023-09-14 21:58:52 ⌀ | gha_created_at timestamp[ns]date 2008-03-27 23:40:48 2023-08-24 19:49:39 ⌀ | gha_language stringclasses 159 values | src_encoding stringclasses 34 values | language stringclasses 1 value | is_vendor bool 1 class | is_generated bool 2 classes | length_bytes int64 7 10.5M | extension stringclasses 111 values | filename stringlengths 1 195 | text stringlengths 7 10.5M |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
562533d7a445d6fd04bccf2890e57ac964e5d0de | 3e0b12f070ba9f395e0568064a2c8a3e562e8808 | /WINDOWS_cpustress.cpp | e3c45c6f1bcfd25d3afacc4774a798139050e0ce | [] | no_license | kevsiraki/Linux-WindowsStressTests | dabfd0e634f42af881f41659550641d9b5ac739b | 4d570c09684892d4ed1a3ea2df4658a6a2fba5db | refs/heads/master | 2022-11-30T07:47:35.758160 | 2020-07-27T20:52:57 | 2020-07-27T20:52:57 | 283,013,854 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 565 | cpp | WINDOWS_cpustress.cpp | #include <windows.h>
#include <process.h>
#include <time.h>
#include <stdio.h>
#include <iostream>
#include <conio.h>
using namespace std;
void task1(void *)
{
while(1)
{
clock_t wakeup = clock() + 50;
while(clock() < wakeup) {}
Sleep(50);
}
}
int main(int, char**)
{
int ThreadNr;
cout<<"CPU Torture Test. Press any key to start. \n";
getch();
for(int i=0; i < 200; i++) _beginthread( task1, 0, &ThreadNr );
cout<<"Press any key to stop torture test. \n";
getch();
return 0;
}
|
fdf983a25d2a0904aead6d2e2eb33f091cca7936 | d1b788585475204e43745d080ad5bbb507b79722 | /NWERC 2019/E.cpp | 7d24d969d03b330af9825357c9aff506f44392cb | [] | no_license | yuchengdeng/Personal_Training_Deng | fa59970c1613040b3139a9100fecbcc64cf5e76a | aaa2c7d68481e05cddf108d87232d700eacbd888 | refs/heads/master | 2021-07-12T04:17:28.966783 | 2020-10-03T08:58:59 | 2020-10-03T08:58:59 | 210,610,630 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 527 | cpp | E.cpp | #include<cstdio>
#include<algorithm>
int a[5], aim, sum;
int main() {
for(int i = 1; i <= 4; i++) {
double x;
scanf("%lf", &x);
a[i] = x*1000;
sum += a[i];
}
double x;
scanf("%lf", &x);
std::sort(a+1, a+5);
aim = x*1000;
int tmp = aim*3;
if(tmp >= sum-a[1])
printf("infinite\n");
else if(tmp < sum-a[4]) printf("impossible\n");
else {
double ans = tmp-a[2]-a[3];
ans /= 1000;
printf("%.2lf\n", ans);
}
return 0;
} |
47f3d0cea54220e5aa7fdee224b702e670b55a60 | 90c81d69ed5d0d2b6eae1ec8cd9e23e479b76421 | /Worker.h | 25bf54bf2053ff1fd00b4fc2053db58e829f2085 | [] | no_license | burakcuhadar/Discrete-Event-Simulation | 9fe5663834ba176f41046bb699b186536bcc98b1 | 3ef1982255adcf61c9c1e8984f97751cbd7191f2 | refs/heads/master | 2020-03-18T21:21:04.595962 | 2018-05-29T10:13:33 | 2018-05-29T10:13:33 | 135,275,887 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 203 | h | Worker.h | #ifndef PROJECT2_WORKER_H
#define PROJECT2_WORKER_H
class Worker{
public:
double busyTime = 0.0;
bool isBusy = false;
Worker();
Worker(const Worker& other);
};
#endif //PROJECT2_WORKER_H
|
f9f7306038fac8987b99c6b3b289b3ac37801ca7 | 9762ada83b606460adfa2898be171d4203512897 | /p2Main.cpp | 81b293d844ba9aeb60831f9154a0e719ee6c000b | [] | no_license | lancenhd/c-proj | 70515adb87ed7cbbe1160e6f544e826566cdc8cc | a20f221fc31929a3ea212a9b5562391d305e386d | refs/heads/master | 2021-01-21T12:21:15.655230 | 2017-09-01T03:11:10 | 2017-09-01T03:11:10 | 102,067,879 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,889 | cpp | p2Main.cpp | /*********************************************************
//
// NAME: Lancen Daclison
//
// HOMEWORK: Project2
//
// CLASS: ICS 212
//
// INSTRUCTOR: Ravi Narayan
//
// DATE: 4/24/16
//
// FILE: p2Main.cpp
//
// DESCRIPTION: This file contains the driver and the menu which allows the user to interact with the program.
//
//*****************************************************/
#include <iostream>
using namespace std;
#include <iomanip>
#include "llist.h"
/*********************************************************
//
// Function name: main
//
// DESCRIPTION: Checks if user typed in debug or not when using command line. However, debug option is always turned on for my program.
// This function also has a menu, but in the future I should make menu into it's own function. So I can just call it instead.
//This method also calls functions of menu after user chooses choices from menu.
//
// Parameters: argc(char): Is the arguments used to start this program. For example, "homework3" would be a correct parameter.
argv(int): This is the argument that counts how much space it takes. So for example "homework3 debug" would be 2 spaces. arg[0] and arg[1].
//
//**************************************************************/
main(int argc, char *argv[])
{
/*variables*/
struct record *start = NULL;
int choice = 0;
int getOutLoop = 0;
char eatSpace[3];
char debugScanner[] = "debug";
int accountno = 0;
char name[25];
char address[80];
int yearofbirth = 0;
llist database;
string nextPage;
while(getOutLoop < 1 )
{
cout << "\n";
#ifdef DEBUG
cout << "DEBUG = ON\n";
#endif
cout << "***************************************************************\n";
cout << "Enter 1: To add new information.\n";
cout << "Enter 2: To print out a student's record.\n";
cout << "Enter 3: to modify record.\n";
cout << "Enter 4: To Print out all student records.\n";
cout << "Enter 5: To delete a student's record.\n";
cout << "Enter 6: To reverse order.\n";
cout << "Enter 7: To quit program.\n\n";
cout << "*************************************************************\n";
cout << "choice: ";
cin >> choice ;
if(choice == 1)
{
database.newPage();
cout << "Enter in an account number: ";
cin >> accountno;
cout << "Enter in a name:";
cin.getline(eatSpace,3);
cin.getline(name,25);
cout << "Enter in an address (END WITH $):";
cin.getline(address,80,'$');
cout << "Enter in the year of birth of someone: ";
cin >> yearofbirth;
getOutLoop = 0;
database.addRecord(accountno, name,address, yearofbirth);
cout << "When you are done looking press '1' or 'done'\n";
cin >> nextPage;
database.newPage();
}
if(choice == 2)
{
database.newPage();
cout << "What account number would you like to see?:";
cin >> accountno;
database.printRecord(accountno);
cout << "When you are done looking press '1' or 'done'\n";
cin >> nextPage;
database.newPage();
getOutLoop = 0;
}
if(choice == 3)
{
database.newPage();
cout << "What account number would you like to modify?:";
cin >> accountno;
cout << "\n";
cout << "Enter in a new address (END WITH $):";
cin.getline(eatSpace,3);
cin.getline(address,80,'$');
database.modifyRecord(accountno, address);
cout << "When you are done looking press '1' or 'done'\n";
cin >> nextPage;
database.newPage();
getOutLoop = 0;
}
if( choice == 4)
{
database.newPage();
/*cout << database;*/
database.printAll();
cout << "When you are done looking press '1' or 'done'\n";
cin >> nextPage;
database.newPage();
getOutLoop = 0;
}
if (choice == 5)
{
database.newPage();
cout << "Type in a account number to delete:";
cin >> accountno;
database.deleteRecord(accountno);
cout << "When you are done looking press '1' or 'done'\n";
cin >> nextPage;
database.newPage();
getOutLoop = 0;
}
if(choice == 6)
{
database.reverse();
cout << "Reverse activated!";
}
if (choice == 7)
{
cout << "\n";
cout << "Shutting down\n";
getOutLoop++;
}
if((choice >7)||(choice < 0))
{
cout << "\n";
cout << "You have preseed something that was not options 1 - 7\n";
cout << "Shutting down\n";
getOutLoop++;
}
}/*close while*/
}/*close function*/
|
edef5a2aa821be713765f4c75650dfc2b589077c | a40a49bdfbec3ec808044f97e8f866a35e6c29bf | /LockingQueue.h | cf9267a25b0b35f02a618e0fd194d0d59f901998 | [] | no_license | geopoulos/concurrentqueues | 3b324db72bbb4c878a8b00a508820d18c921378f | e25a2855eae3341e50da6749a785d75f54b8d19b | refs/heads/master | 2021-01-01T20:42:01.368079 | 2012-02-21T18:49:18 | 2012-02-21T18:49:18 | 3,506,951 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,352 | h | LockingQueue.h | #ifndef LOCKINGQUEUE_H
#define LOCKINGQUEUE_H
#include <pthread.h>
#include "IQueue.h"
namespace ConcurrentQueues
{
template<class T>
class LockingQueue : public IQueue<T> {
private:
pthread_mutex_t enqMutex;
pthread_mutex_t deqMutex;
Node<T>* head;
Node<T>* tail;
public:
LockingQueue() {
Node<T> *node = new Node<T>();
node->Next = 0;
head = tail = node;
pthread_mutex_init(&enqMutex,0);
pthread_mutex_init(&deqMutex,0);
}
~LockingQueue() {
pthread_mutex_destroy(&enqMutex);
pthread_mutex_destroy(&deqMutex);
Node<T>* node = head;
while(node){
Node<T>* next = node->Next;
delete node;
node = next;
}
}
void Enqueue(T value) {
Node<T>* node = new Node<T>();
node->Value = value;
node->Next = 0;
pthread_mutex_lock(&enqMutex);
tail->Next = node;
tail = node;
pthread_mutex_unlock(&enqMutex);
}
bool Dequeue(T* value) {
pthread_mutex_lock(&deqMutex);
Node<T>* node = head;
Node<T>* next = node->Next;
if(!next) {
pthread_mutex_unlock(&deqMutex);
return false;
}
*value = next->Value;
head = next;
pthread_mutex_unlock(&deqMutex);
delete node;
return true;
}
};
}
#endif
|
3ddd97dbd7bd83d9601ada1a2d9530460678b64f | 2b332da28ca7d188892f72724400d79f16cda1b9 | /include/ce2/scene/comp/collider/enums/collider_type.hpp | f0090dd5e41fec60b304183be91757c13dd99d54 | [
"Apache-2.0"
] | permissive | chokomancarr/chokoengine2 | e4b72f18f6fd832c2445b5c7bec1bb538ad62de1 | 2825f2b95d24689f4731b096c8be39cc9a0f759a | refs/heads/master | 2023-05-02T18:05:43.665056 | 2021-04-14T17:54:17 | 2021-04-14T17:54:17 | 191,103,464 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 201 | hpp | collider_type.hpp | #pragma once
#include "chokoengine.hpp"
CE_BEGIN_NAMESPACE
enum class ColliderType {
InfPlane,
Plane,
Sphere,
Cube,
Capsule,
Mesh
};
CE_END_NAMESPACE
#include "collider_type_str.hpp" |
f83c13c31aeed52f7420c0ca44fa044c2adc405c | 4a77b6fc74def61e4e55c03da0c0b0180a064831 | /main.cpp | 563d75ca01db4369639537960c3ff9d598989317 | [] | no_license | ReedKass/trieNodeTree | 2105246c856d0c0bfaca4ea6bfde1e6c395d7eb4 | e6a3a95cc6a5c465eac8c2c5c814920275664b66 | refs/heads/main | 2023-01-12T10:45:59.304429 | 2020-11-16T02:41:48 | 2020-11-16T02:41:48 | 313,172,841 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 468 | cpp | main.cpp | /* Name: Reed Kass-Mullet
* Date: 11 March 2019
* Assignment: comp15 - proj1
* Description: the main.cpp file for the executable of the
* trieNode tree class.
*/
#include "trieNodeTree.h"
#include "fstream"
#include "string"
using namespace std;
int main(int argc, char* argv[]){
if(argc != 3)
cerr << "Usage: ./SeqMatch [query file] [output location]\n";
else if(argc == 3){
trieNodeTree run(argv[1], argv[2]);
run.driver();
}
}
|
7e4d38214b61927d95f539997111f412d97bb939 | f67f4c6d0d3570d1e99598f51af6fc08f57ad13a | /Linked List 2/Delete every N nodes.cpp | 16729f4dfde7e79c1a6595bbd0d38c86bf9b1ac3 | [] | no_license | prateek200/Data-Structures-and-Algorithm | 71af2e32d93b9efbc5c1a3ab2193d1121031a381 | 94a9be5140d18edd613d31aa6d314a69cf428202 | refs/heads/main | 2023-07-07T07:06:43.066760 | 2021-08-12T09:05:12 | 2021-08-12T09:05:12 | 381,647,197 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,127 | cpp | Delete every N nodes.cpp | /****************************************************************
Following is the class structure of the Node class:
class Node
{
public:
int data;
Node *next;
Node(int data)
{
this->data = data;
this->next = NULL;
}
};
*****************************************************************/
Node * skipMdeleteN(Node * head, int M, int N)
{
int k;
Node * temp = head, * temp1;
while (temp != NULL)
{
for (k = 0; k < M - 1; k++)
{
temp = temp -> next;
if (temp == NULL)
return (head);
}
temp1 = temp;
if (temp1 == NULL)
break;
for (k = 0; k <= N - 1; k++)
{
temp1 = temp1 -> next;
if (temp1 == NULL)
{
temp -> next = NULL;
return (head);
}
}
temp -> next = temp1 -> next;
temp = temp1 -> next;
}
return (head);
}
|
ffee211e75137172304bbda055bde167eb808604 | 79cd409b4b12f8ab76a31130750753e147c5dd4e | /apps/shawn_apps/duty_cycling/duty_cycling_processor_factory.cpp | ed50d24f01ba8b8dac6d23ee6263bb0358951898 | [] | no_license | bjoerke/wiselib | d28eb39e9095c9bfcec6b4c635b773f5fcaf87fa | 183726cbf744be9d65f12dd01bece0f7fd842541 | refs/heads/master | 2020-12-28T20:30:40.829538 | 2014-08-18T14:10:42 | 2014-08-18T14:10:42 | 19,933,324 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,643 | cpp | duty_cycling_processor_factory.cpp | /************************************************************************
** This file is part of the network simulator Shawn. **
** Copyright (C) 2004,2005 by SwarmNet (www.swarmnet.de) **
** and SWARMS (www.swarms.de) **
** Shawn is free software; you can redistribute it and/or modify it **
** under the terms of the GNU General Public License, version 2. **
************************************************************************/
#include "../buildfiles/_legacyapps_enable_cmake.h"
#ifdef ENABLE_DUTY_CYCLING
#include "sys/processors/processor_keeper.h"
#include "legacyapps/duty_cycling/duty_cycling_processor_factory.h"
#include "legacyapps/duty_cycling/duty_cycling_processor.h"
#include "sys/simulation/simulation_controller.h"
namespace duty_cycling
{
void
DutyCyclingProcessorFactory::
register_factory( shawn::SimulationController& sc )
throw()
{
sc.processor_keeper_w().add( new DutyCyclingProcessorFactory );
}
// ----------------------------------------------------------------------
DutyCyclingProcessorFactory::
DutyCyclingProcessorFactory()
{}
// ----------------------------------------------------------------------
DutyCyclingProcessorFactory::
~DutyCyclingProcessorFactory()
{}
// ----------------------------------------------------------------------
std::string
DutyCyclingProcessorFactory::
name( void )
const throw()
{ return "duty_cycling"; }
// ----------------------------------------------------------------------
std::string
DutyCyclingProcessorFactory::
description( void )
const throw()
{
return "just a dummy which really earns this name";
}
// ----------------------------------------------------------------------
shawn::Processor*
DutyCyclingProcessorFactory::
create( void )
throw()
{
return new DutyCyclingProcessor;
}
}
#endif
/*-----------------------------------------------------------------------
* Source $Source: /cvs/shawn/shawn/tubsapps/duty_cycling/duty_cycling_processor_factory.cpp,v $
* Version $Revision: 1.3 $
* Date $Date: 2005/08/05 10:00:52 $
*-----------------------------------------------------------------------
* $Log: duty_cycling_processor_factory.cpp,v $
* Revision 1.3 2005/08/05 10:00:52 ali
* 2005 copyright notice
*
* Revision 1.2 2005/06/09 15:28:09 tbaum
* added module functionality
*
* Revision 1.1 2004/11/25 11:16:53 tbaum
* added duty_cycling
*
*-----------------------------------------------------------------------*/
|
771a97478c4959d41b5db2c97c8fc9df9363014d | a35b30a7c345a988e15d376a4ff5c389a6e8b23a | /boost/function_types/detail/synthesize_impl/arity10_1.hpp | 6dda0848957c03c3586fe137a4d50dbf559361ab | [] | no_license | huahang/thirdparty | 55d4cc1c8a34eff1805ba90fcbe6b99eb59a7f0b | 07a5d64111a55dda631b7e8d34878ca5e5de05ab | refs/heads/master | 2021-01-15T14:29:26.968553 | 2014-02-06T07:35:22 | 2014-02-06T07:35:22 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 93 | hpp | arity10_1.hpp | #include "thirdparty/boost_1_55_0/boost/function_types/detail/synthesize_impl/arity10_1.hpp"
|
65ec95261396227e6cc98072bcf6ba2172ff7965 | 565e85570d42a599351e513040e1bda8d05d3948 | /lib/dtv-canvas/src/impl/ffmpeg/audiostream.cpp | a5c314cd1678137127a6b48033a47a1bcfa7befd | [] | no_license | Hanun11/tvd | 95a74b8ee8a939ba06b4d15dce99bdc548e1be7b | 0d113c46014d738d87cb4db93b566d07fcbc031f | refs/heads/master | 2021-12-14T19:41:15.800531 | 2017-05-20T19:54:40 | 2017-05-20T19:54:40 | null | 0 | 0 | null | null | null | null | ISO-8859-1 | C++ | false | false | 5,620 | cpp | audiostream.cpp | /*******************************************************************************
Copyright (C) 2010, 2013 LIFIA - Facultad de Informatica - Univ. Nacional de La Plata
********************************************************************************
This file is part of DTV-canvas implementation.
DTV-canvas is free software: you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published by the Free
Software Foundation, either version 2 of the License.
DTV-canvas is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along with
this program. If not, see <http://www.gnu.org/licenses/>.
********************************************************************************
Este archivo es parte de la implementación de DTV-canvas.
DTV-canvas es Software Libre: Ud. puede redistribuirlo y/o modificarlo
bajo los términos de la Licencia Pública General Reducida GNU como es publicada por la
Free Software Foundation, según la versión 2 de la licencia.
DTV-canvas se distribuye esperando que resulte de utilidad, pero SIN NINGUNA
GARANTÍA; ni siquiera la garantía implícita de COMERCIALIZACIÓN o ADECUACIÓN
PARA ALGÚN PROPÓSITO PARTICULAR. Para más detalles, revise la Licencia Pública
General Reducida GNU.
Ud. debería haber recibido una copia de la Licencia Pública General Reducida GNU
junto a este programa. Si no, puede verla en <http://www.gnu.org/licenses/>.
*******************************************************************************/
#include "audiostream.h"
//#include "../../audio/stream.h"
#include "../../audio.h"
#include "../../system.h"
#include <util/log.h>
#include <util/assert.h>
extern "C" {
#if !defined(__STDC_FORMAT_MACROS)
#define __STDC_FORMAT_MACROS
#endif
#include <libavformat/avformat.h>
#include <libavcodec/avcodec.h>
#include <libavutil/samplefmt.h>
#include <libavutil/timestamp.h>
}
namespace canvas {
namespace ffmpeg {
AudioStream::AudioStream( System *sys )
: Stream( sys, stream::audio )
{
_sink = NULL;
}
AudioStream::~AudioStream()
{
DTV_ASSERT(!_sink);
}
bool AudioStream::initCodec( AVCodecContext *cCtx, AVCodec *codec ) {
#if 0
// Create audio stream
_sink = sys()->audio()->createStream();
if (!_sink) {
LERROR( "ffmpeg", "Cannot create audio stream" );
return false;
}
{ // Setup audio format to negotiate
audio::AudioFormat fmt;
if (codec->sample_fmts) {
for (int i=0; codec->sample_fmts[i] != AV_SAMPLE_FMT_NONE; i++) {
fmt.formats.push_back( (int)codec->sample_fmts[i] );
}
}
if (codec->supported_samplerates) {
for (int i=0; codec->supported_samplerates[i] != AV_SAMPLE_FMT_NONE; i++) {
fmt.rates.push_back( codec->supported_samplerates[i] );
}
}
if (codec->channel_layouts) {
for (int i=0; codec->channel_layouts[i] != 0; i++) {
fmt.channels.push_back( codec->channel_layouts[i] );
}
}
if (!_sink->initialize( fmt )) {
LERROR( "ffmpeg", "Cannot initialize audio stream" );
sys()->audio()->destroyStream( _sink );
_sink = NULL;
return false;
}
// Setup codec
cCtx->request_sample_fmt = AV_SAMPLE_FMT_S16;//(AVSampleFormat)fmt.format;
//cCtx->request_channel_layout = 0;//fmt.channelLayout;
}
#endif
LDEBUG( "ffmpeg", "Init audio codec: rate=%d, channels=%d, sampleFmt=%d, layout=%lld, req_layout=%lld, reqFmt=%d",
cCtx->sample_rate, cCtx->channels, cCtx->sample_fmt, cCtx->channel_layout, cCtx->request_channel_layout, cCtx->request_sample_fmt );
return Stream::initCodec( cCtx, codec );
}
void AudioStream::finCodec( AVCodecContext * ) {
#if 0
DTV_ASSERT(_sink);
_sink->finalize();
sys()->audio()->destroyStream( _sink );
_sink = NULL;
#endif
}
void AudioStream::processPkt( AVFrame *frame, AVPacket *pkt ) {
AVCodecContext *cCtx = stream()->codec;
// decode audio frame
int got_frame;
int ret = avcodec_decode_audio4( cCtx, frame, &got_frame, pkt );
if (ret < 0) {
char msg[AV_ERROR_MAX_STRING_SIZE];
LWARN( "ffmpeg", "Error decoding audio frame: err=%s", av_make_error_string(msg,AV_ERROR_MAX_STRING_SIZE,ret) );
}
else {
/* Some audio decoders decode only part of the packet, and have to be
* called again with the remainder of the packet data.
* Also, some decoders might over-read the packet. */
if (got_frame) {
//double pts = updatePTS( frame );
// int decoded = FFMIN(ret, pkt->size);
//size_t unpadded_linesize = frame->nb_samples * cCtx->channels * av_get_bytes_per_sample( (AVSampleFormat)frame->format );
// {
// char msg[AV_TS_MAX_STRING_SIZE];
// av_ts_make_time_string(msg, pts, &stream()->codec->time_base);
// LTRACE( "ffmpeg", "Get audio frame: nb_samples=%d, decoded=%d size=%d, pts=%s",
// frame->nb_samples, decoded, unpadded_linesize, msg );
// }
// Convert planar audio formats to packed formats
bool convert = false;
switch (cCtx->sample_fmt) {
case AV_SAMPLE_FMT_U8:
case AV_SAMPLE_FMT_S16:
case AV_SAMPLE_FMT_S32:
case AV_SAMPLE_FMT_FLT:
case AV_SAMPLE_FMT_DBL:
break;
case AV_SAMPLE_FMT_NONE:
LERROR( "ffmpeg", "Decode error; Invalid data format" );
return;
default:
convert = true;
}
if (convert) {
LTRACE( "ffmpeg", "TODO: Complete conversion: format=%d", cCtx->sample_fmt );
}
else {
//_sink->addData( pts, frame->extended_data[0], decoded );
}
}
}
}
}
}
|
1f7de5ed7b23c808960ccb52e26548960161db52 | 892b9415a759037e3492a0d6a4cdf14b218de213 | /lib/Window.cpp | 096cdb9050e149e660e88b957c1e8bfeed6a8ac5 | [] | no_license | rwols/gintonic | 7ed0153376b97ae135169fb212c8f8f889d8f0c3 | eca7ff31be4cb4a856e75bdb2d68e79ecaea73f5 | refs/heads/master | 2021-01-18T17:52:32.482638 | 2017-06-01T11:33:10 | 2017-06-01T11:33:10 | 86,819,901 | 3 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 168 | cpp | Window.cpp | #include "Window.hpp"
#include "RenderContext.hpp"
using namespace gintonic;
Window::Window() {}
Window::~Window() {}
void Window::present() { context->present(); }
|
7e74bc75d7bb2a4dac7fdc3ab5d50841fee57ae8 | f97ce0a588e023675eaa980f2f105f0a9c25ce18 | /UVa/v114/11432.cpp | 50fd77941b0fa81e8dfffe2f814e496ace4f5c1a | [] | no_license | anindya028/Programming-Contest-Problems | a5c49653d990391a6e2003f2ec9d951222cabbe2 | 7038b6267432189de72539ef5ad046d38e730ee8 | refs/heads/master | 2023-03-17T06:27:38.339049 | 2021-02-23T22:58:06 | 2021-02-23T22:58:06 | 277,399,320 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,441 | cpp | 11432.cpp | #include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#include<ctype.h>
#include<algorithm>
#include<queue>
#include<list>
#include<vector>
#include<string>
using namespace std;
#define Long long long
//#define Long __int64
#define sq(a) ((a)*(a))
#define pb(a) push_back(a)
#define Min(a,b) (((a)<(b))?(a):(b))
#define Max(a,b) (((a)>(b))?(a):(b))
#define eps 1e-9
#define inf 1<<29
#define pye 2.*acos(0.)
#define SZ(v) ((int)(v).size())
#define For(i,a,b) for(i=(a);i<(b);++i)
#define Fore(i,a,b) for(i=(a);i<=(b);++i)
#define Forc(i,v) For(i,0,SZ(v))
#define Foro(i,a) For(i,0,a)
Long memo[34][34][34][34][2];
int D,G;
Long make(int d1,int d2,int g1,int g2,int st)
{
if(g1<0 || g2<0)
return 0;
if(g1==0 && g2==0)
return 0;
if((st==0 && !d1) || (st==1 && !d2))
return 1;
else if(!d1 || !d2)
return 0;
if(memo[d1][d2][g1][g2][st]!=-1)
return memo[d1][d2][g1][g2][st];
memo[d1][d2][g1][g2][st]=make(d1-1,d2,G,g2-1,st)+make(d1,d2-1,g1-1,G,st);
return memo[d1][d2][g1][g2][st];
}
int main()
{
int cs=0,i,j,k,l;
Foro(i,34)
Foro(j,34)
Foro(k,34)
Foro(l,34)
memo[i][j][k][l][0]=memo[i][j][k][l][1]=-1;
while(scanf("%d%d",&D,&G)==2)
{
if(D<0 || G<0)
break;
if(!D && !G)
{
printf("Case %d: 1\n",++cs);
continue;
}
printf("Case %d: %lld\n",++cs,make(D-1,D,G,G-1,0)+make(D,D-1,G-1,G,1));
}
return 0;
}
|
def95a228b993d635bb87af82a906b9d5c1faae3 | 8da9d3c3e769ead17f5ad4a4cba6fb3e84a9e340 | /src/chila/codexGtk/fwd.hpp | 23c947b3dde967d91a4f9e51634addc22a399ca0 | [] | no_license | blockspacer/chila | 6884a540fafa73db37f2bf0117410c33044adbcf | b95290725b54696f7cefc1c430582f90542b1dec | refs/heads/master | 2021-06-05T10:22:53.536352 | 2016-08-24T15:07:49 | 2016-08-24T15:07:49 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,085 | hpp | fwd.hpp | /* Copyright 2011-2015 Roberto Daniel Gimenez Gamarra (chilabot@gmail.com)
* (C.I.: 1.439.390 - Paraguay)
*/
#ifndef CHILA_CODEX__FWD_HPP
#define CHILA_CODEX__FWD_HPP
#include <chila/connectionTools/loader/fwd.hpp>
#include <chila/connectionTools/lib/other/fwd.hpp>
#include <chila/connectionTools/lib/other/common/impl/connection/fwd.hpp>
#include <chila/lib/misc/util.hpp>
#include <boost/filesystem/path.hpp>
#include <chila/lib/xmlppUtils/fwd.hpp>
#include <chila/lib/gtkmm/fwd.hpp>
#include <memory>
#include <memory>
#include "macros.fgen.hpp"
MY_NSP_START
{
namespace ccLoader = chila::connectionTools::loader;
namespace cclOther = chila::connectionTools::lib::other;
namespace ccloCIConn = cclOther::common::impl::connection;
namespace clMisc = chila::lib::misc;
namespace bfs = boost::filesystem;
namespace clGtkmm = chila::lib::gtkmm;
namespace xmlppUtils = chila::lib::xmlppUtils;
using clMisc::rvalue_cast;
class CProvider
{
};
CHILA_LIB_MISC__FWDEC_SPTR(CProvider);
}
MY_NSP_END
#include "macros.fgen.hpp"
#endif
|
6c63fc9de32e41c600a92992711eb7a39e2d0b2b | 799a21e89a17fffee2508d40072d68e065c903e4 | /km2475111/Assignment1/Savitch_8thEd_Chap1_Prob9/main.cpp | d30f0c4fa083638604f20e06a3e5b044d14978f9 | [] | no_license | Hillash/CSC5_Spring_2014_42450 | 5b8204b124338587a06210cf4cf05163463ac557 | 7a513d1a2f355da9a62cf86bf7ea5120699004fa | refs/heads/master | 2020-12-28T23:04:32.682727 | 2014-10-01T06:19:38 | 2014-10-01T06:19:41 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 697 | cpp | main.cpp | /*
* File: main.cpp
* Author: Kevin R. Mindreau
* Created on February 24, 2014, 9:13 PM
*/
//System Libraries
#include <iostream>
using namespace std;
//Global Constants
//Functions and Prototypes
//Execution Begins Here!
int main(int argc, char** argv) {
// acc is ft/s
int acc = 32;
//in seconds
int time = 0;
//in feet
int distance = 0;
cout << "How long will the object be dropping? Enter seconds: ";
cin >> time;
distance = ((acc * time) * (acc * time))/2;
cout << "The object will fall " << distance
<< " feet in " << time << " seconds." << endl;
cout << "This is the end of the program." << endl;
return 0;
}
|
a86858d6c2df4684ff19b78eda5ba96d77a8b4c0 | 757c2e654af75fe27437c3f3eadf25fe8840e436 | /1155.cpp | 0e0339294dad992c9b76a1ad39774212640fa6cd | [] | no_license | AlbertoDoc/Uri-codes | ac60b61e2497978a1aff7f2885b9b55cedbae426 | 6171953d6006d1776acfa006e653e09255b23755 | refs/heads/master | 2023-03-31T06:58:21.963514 | 2023-03-19T22:20:07 | 2023-03-19T22:20:07 | 156,789,195 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 185 | cpp | 1155.cpp | #include <iostream>
#include <iomanip>
using namespace std;
int main (){
double N=1,S=0;
while(N<=100){
S+=1/N;
N++;
}
cout<<fixed<<setprecision(2);
cout<<S<<endl;
}
|
ced1f5d1bea956e52da12240b0627bcb2c5f1b9b | 06c3776c944b44d21181d4dd1f4138bbe1e8b385 | /src/world.cpp | fdb258c74a1246e452e18068b8c98a7dbd83f08e | [
"MIT"
] | permissive | ivfreire/snakie | 05e406a51ef57f555765a302466fab6369391070 | bc1cebfdcbe6ead2f716a2adfc3b2675397f06ae | refs/heads/master | 2023-01-09T21:44:29.332182 | 2020-11-14T18:25:40 | 2020-11-14T18:25:40 | 282,786,505 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,794 | cpp | world.cpp | #include "world.h"
World::World(int width, int height, int cellwidth, int cellheight) {
this->width = width;
this->height = height;
this->cellwidth = cellwidth;
this->cellheight = cellheight;
this->snake = new Snake(1, 4, 4, this->cellwidth, this->cellheight);
for (int i = 0; i < MAX_APPLES; i++) this->apples[i] = NULL;
}
void World::Start() {
this->snake->Start();
this->SpawnRedApple();
}
void World::Update(float dtime) {
this->snake->Update(dtime);
this->snake->KeepInScreen(this->width, this->height);
for (int i = 0; i < MAX_APPLES; i++) if (this->apples[i]) this->apples[i]->Update(dtime);
this->CheckForApples();
}
void World::Render(SDL_Renderer* rdr) {
for (int i = 0; i < MAX_APPLES; i++) if (this->apples[i]) this->apples[i]->Render(rdr);
this->snake->Render(rdr);
}
void World::Tick() {
this->snake->Tick();
}
void World::SpawnRedApple() {
bool found = false;
for (int i = 0; i < MAX_APPLES && !found; i++)
if (this->apples[i] == NULL) {
int x = rand() % this->width;
int y = rand() % this->height;
bool inTail = true;
while (inTail) {
for (Tail tail : this->snake->tails) {
if (x == tail.x && y == tail.y) {
x = (x + 1) % this->width;
break;
}
}
inTail = false;
}
this->apples[i] = new Apple(
x, y,
this->cellwidth,
this->cellheight,
0
);
found = true;
}
}
void World::CheckForApples() {
for (int i = 0; i < MAX_APPLES; i++) if (this->apples[i])
if (this->snake->x == this->apples[i]->x && this->snake->y == this->apples[i]->y) {
this->AppleEffect(this->apples[i]);
this->apples[i] = NULL;
}
}
void World::AppleEffect(Apple* apple) {
if (apple->type == 0) {
this->snake->Grow();
this->SpawnRedApple();
}
}
World::~World() {
this->snake->~Snake();
} |
5855f7eaf1d3b6e0643362f5cf7cc1aed12bf084 | 6b2a8dd202fdce77c971c412717e305e1caaac51 | /solutions_2453486_1/C++/sunweijun/A.cpp | 04b6f86c4423900bb11758ebcb2b3c1d9e81ec7f | [] | no_license | alexandraback/datacollection | 0bc67a9ace00abbc843f4912562f3a064992e0e9 | 076a7bc7693f3abf07bfdbdac838cb4ef65ccfcf | refs/heads/master | 2021-01-24T18:27:24.417992 | 2017-05-23T09:23:38 | 2017-05-23T09:23:38 | 84,313,442 | 2 | 4 | null | null | null | null | UTF-8 | C++ | false | false | 1,165 | cpp | A.cpp | #include<cstdio>
#include<cstring>
#define fo(i,a,b) for(i=a;i<=b;++i)
int Q,T;
char f[10][10],s1[10][10],s2[10][10];
bool win(char ch,char f[][10])
{
int i,j,s;
fo(i,1,4)
fo(j,1,4)
if(f[i][j]=='T')f[i][j]=ch;
fo(i,1,4)
{
s=0;
fo(j,1,4)s+=f[i][j]==ch;
if(s==4)return 1;
}
fo(i,1,4)
{
s=0;
fo(j,1,4)s+=f[j][i]==ch;
if(s==4)return 1;
}
s=0;
fo(i,1,4)
s+=f[i][i]==ch;
if(s==4)return 1;
s=0;
fo(i,1,4)s+=f[i][4-i+1]==ch;
if(s==4)return 1;
return 0;
}
bool full(char f[][10])
{
int i,j;
fo(i,1,4)
fo(j,1,4)
if(f[i][j]=='.')return 0;
return 1;
}
int main()
{
scanf("%d",&Q);
fo(T,1,Q)
{
int i;
fo(i,1,4)
scanf("%s",f[i]+1);
memcpy(s1,f,sizeof f);
memcpy(s2,f,sizeof f);
printf("Case #%d: ",T);
if(win('X',s1))puts("X won");
else if(win('O',s2))puts("O won");
else if(!full(f))puts("Game has not completed");
else puts("Draw");
}
return 0;
}
|
fd17e4d5a4a0141bf6b9fc3d11815055b6f9a3b2 | cefd6c17774b5c94240d57adccef57d9bba4a2e9 | /WebKit/Tools/TestWebKitAPI/Tests/WebKit2Gtk/InspectorTestServer.cpp | f13b043df16d89d0eba04772ff0f41c6c8d94bae | [
"BSL-1.0"
] | permissive | adzhou/oragle | 9c054c25b24ff0a65cb9639bafd02aac2bcdce8b | 5442d418b87d0da161429ffa5cb83777e9b38e4d | refs/heads/master | 2022-11-01T05:04:59.368831 | 2014-03-12T15:50:08 | 2014-03-12T15:50:08 | 17,238,063 | 0 | 1 | BSL-1.0 | 2022-10-18T04:23:53 | 2014-02-27T05:39:44 | C++ | UTF-8 | C++ | false | false | 2,521 | cpp | InspectorTestServer.cpp | /*
* Copyright (C) 2012 Samsung Electronics Ltd. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "config.h"
#include <gtk/gtk.h>
#include <webkit2/webkit2.h>
static void loadChangedCallback(WebKitWebView*, WebKitLoadEvent loadEvent, gpointer)
{
// Send a message to the parent process when we're ready.
if (loadEvent == WEBKIT_LOAD_FINISHED)
g_print("OK");
}
int main(int argc, char** argv)
{
gtk_init(&argc, &argv);
// Overwrite WEBKIT_INSPECTOR_SERVER variable with default value.
g_setenv("WEBKIT_INSPECTOR_SERVER", "127.0.0.1:2999", TRUE);
WebKitWebView* webView = WEBKIT_WEB_VIEW(webkit_web_view_new());
webkit_settings_set_enable_developer_extras(webkit_web_view_get_settings(webView), TRUE);
webkit_web_view_load_html(webView,
"<html><body><p>WebKitGTK+ Inspector Test Server</p></body></html>",
"http://127.0.0.1:2999/");
GtkWidget* window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_container_add(GTK_CONTAINER(window), GTK_WIDGET(webView));
gtk_widget_show_all(window);
g_signal_connect(window, "delete-event", G_CALLBACK(gtk_main_quit), 0);
g_signal_connect(webView, "load-changed", G_CALLBACK(loadChangedCallback), 0);
gtk_main();
}
|
14970227fe0ea8c8b9f0516d1591791529732489 | 620dd6f843f0d2f860f6d11ce9fa0c9cda266873 | /body.cpp | b4aacee9d9f9a4568cf69993343ca63cd8fed0e3 | [] | no_license | JonathanZelaya/Snake-Game | 40ebdff687a3d427413d15e7a6f71b59083588d3 | 9c31636ec6f991368fe3dccc8835be307021a3aa | refs/heads/master | 2020-04-09T05:26:44.572253 | 2016-09-14T07:44:28 | 2016-09-14T07:44:28 | 68,182,192 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 256 | cpp | body.cpp | #include "body.h"
void Body::move(int x1,int y1){
for(int i = count() - 1; i > 0; i--){
body_[i].x = body_[i-1].x;
body_[i].y = body_[i-1].y;
}
// set front as the new positions
body_[0].x = x1;
body_[0].y = y1;
}
|
119296623c7dcfdb837cfb087b60eb91e03d5b42 | b21b5ff3469f651c688ffc4d534f3f7183718496 | /PhotoStage/dragdropinfo.h | 1f29783a33fab5a86da06526193b7912b8aa5ffa | [] | no_license | jaapgeurts/photostage | 8d88de7e9d6fe4a714cf0931284d57356006d9d7 | aabfe1b6fd607fab6b4f52089a2b691cebf274af | refs/heads/master | 2021-01-10T10:26:15.306997 | 2019-02-22T12:38:00 | 2019-02-22T12:38:00 | 43,422,797 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 574 | h | dragdropinfo.h | #ifndef PHOTOSTAGE_DRAGDROPINFO_H
#define PHOTOSTAGE_DRAGDROPINFO_H
#include <QList>
namespace PhotoStage {
class DragDropInfo
{
public:
enum DragSourceModel { PathModel = 1, PhotoModel = 2, CollectionModel = 3 };
DragDropInfo(DragSourceModel source, const QList<long long>& idList);
DragDropInfo(const QByteArray& data);
QByteArray toByteArray();
DragSourceModel sourceModel();
const QList<long long>& idList();
private:
DragSourceModel mSourceModel;
QList<long long> mIdList;
};
} // namespace PhotoStage
#endif // PHOTOSTAGE_DRAGDROPINFO_H
|
f057fa1345e669d90889e33de1dd32be9db269ff | ff5aaec060d4e221e700653d389f9177e8104784 | /petit reseau/reseaux.cpp | e684f6d29b7d5390dcfd897125c56e7e9c84c76e | [] | no_license | hamzaberradadev/deeplearning | 2cf9b3598027d8934a559a90556ad3a2747ac874 | a5acec7ad92144d1f49052f07027459ba3e04a94 | refs/heads/main | 2023-05-07T18:52:59.840756 | 2021-05-11T02:59:59 | 2021-05-11T02:59:59 | 366,238,145 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,960 | cpp | reseaux.cpp | #include "reseaux.h"
#include< cmath >
reseaux::reseaux(){};
/// <summary>
/// en cours
/// </summary>
/// <param name="langeur"></param>
/// <param name="avant_lang"></param>
reseaux::reseaux(int langeur,int avant_lang)
{
for (int i = 0; i < langeur; i++)
{
double val;
matrice_.push_back(0);
deltas.push_back(0);
std::vector<double> ligne;
for (int j = 0; j < avant_lang; j++)
{
val = rand();
val = 1/val;
ligne.push_back(val);
}
whts_.push_back(ligne);
}
}
/// <summary>
/// fini
/// </summary>
/// <param name="langeur"></param>
/// <param name="whts"></param>
reseaux::reseaux(int langeur, std::vector<std::vector<double>> whts)
{
for (int i = 0; i < langeur; i++)
{
matrice_.push_back(0);
}
whts_=whts;
};
/// <summary>
/// fini
/// </summary>
/// <param name="avant"></param>
/// <returns></returns>
reseaux& reseaux::calcule(const std::vector<double>& matrice)
{
for (size_t i = 0; i < matrice_.size(); i++)
{
matrice_[i] = 0;
for (size_t j = 0; j < matrice.size(); j++)
{
matrice_[i] += matrice[j] * whts_[i][j];
}
matrice_[i] = 1 / (1 + exp(-matrice_[i]));
}
return *this;
}
reseaux& reseaux::calcule(const reseaux& avant)
{
for (size_t i = 0; i < matrice_.size(); i++)
{
matrice_[i] = 0;
for (size_t j = 0; j < avant.matrice_.size(); j++)
{
matrice_[i] += avant.matrice_[j] * whts_[i][j];
}
matrice_[i] = 1 / (1 + exp(-matrice_[i]));
}
return *this;
}
reseaux& reseaux::setwht(double wht, int i, int j)
{
whts_.at(i).at(j) = wht;
return *this;
}
reseaux& reseaux::setwht(const std::vector<double>& matrice, const double& poid)
{
for (size_t i = 0; i < matrice_.size(); i++)
{
for (size_t j = 0; j < matrice.size(); j++)
{
whts_.at(i).at(j) =whts_[i][j]+ poid * deltas[i] * matrice[j];
}
}
return *this;
}
std::vector<double> reseaux::getmatrice()
{
return matrice_;
}
double reseaux::getval(int position)
{
return matrice_[position];
}
double reseaux::getwht(int position1, int position2)
{
return whts_[position1][position2];
}
size_t reseaux::size()
{
return matrice_.size();
}
reseaux& reseaux::setDelta(const reseaux& prochant)
{
double delta;
for (size_t i = 0; i < matrice_.size(); i++)
{
delta = 0;
for (size_t j = 0; j < prochant.matrice_.size(); j++)
{
delta += prochant.deltas[j] * prochant.whts_[j][i];
}
deltas.at(i) = delta * (matrice_[i] * (1 - matrice_[i]));
}
return *this;
}
reseaux& reseaux::setDelta(std::vector<double> donnes)
{
for (size_t i = 0; i < matrice_.size(); i++)
{
deltas.at(i) = donnes[i] - matrice_[i];
}
return *this;
}
/// <summary>
/// fini
/// </summary>
|
f4c87d9a66523568b79f9e9bf02f89aade793a9e | 70caae4818644fd068f7e74ca0568d9ea6ce17d3 | /OBDII/library/obd/padapter.h | 935e8fe5f0a9f0700be3d3470da6ae54652e861a | [] | no_license | VooDooHeRo/diagnostic | 2ce68336aac49ec740a5639386bce6c32dd0aef3 | 96b4158076053203b7fd562b64b6fad581e6b816 | refs/heads/master | 2020-09-07T05:39:38.545086 | 2019-07-08T11:00:10 | 2019-07-08T11:00:10 | 220,672,672 | 1 | 0 | null | 2019-11-09T16:46:53 | 2019-11-09T16:46:53 | null | UTF-8 | C++ | false | false | 2,357 | h | padapter.h | /**
* See the file LICENSE for redistribution information.
*
* Copyright (c) 2009-2016 ObdDiag.Net. All rights reserved.
*
*/
#ifndef __PROTOCOL_ADAPTER_H__
#define __PROTOCOL_ADAPTER_H__
#include <adaptertypes.h>
#include <ecumsg.h>
// Command results
//
enum ReplyTypes {
REPLY_OK = 1,
REPLY_CMD_WRONG,
REPLY_DATA_ERROR,
REPLY_NO_DATA,
REPLY_ERROR,
REPLY_UNBL_2_CNNCT,
REPLY_NONE,
REPLY_BUS_BUSY,
REPLY_BUS_ERROR,
REPLY_CHKS_ERROR,
REPLY_WIRING_ERROR
};
// Protocols
//
enum ProtocolTypes {
PROT_AUTO = 0,
PROT_J1850_PWM = 1,
PROT_J1850_VPW = 2,
PROT_ISO9141 = 3,
PROT_ISO14230_5BPS = 4,
PROT_ISO14230 = 5,
PROT_ISO15765_1150 = 6,
PROT_ISO15765_2950 = 7,
PROT_ISO15765_1125 = 8,
PROT_ISO15765_2925 = 9,
PROT_J1939 = 0x0A,
PROT_ISO15765_USR_B = 0x0B
};
// Adapters
//
enum AdapterTypes {
ADPTR_AUTO = 1,
ADPTR_PWM,
ADPTR_VPW,
ADPTR_ISO,
ADPTR_CAN,
ADPTR_CAN_EXT,
ADPTR_J1939
};
class ProtocolAdapter {
public:
static ProtocolAdapter* getAdapter(int adapterType);
virtual int onConnectEcu(bool sendReply) = 0;
virtual int onRequest(const uint8_t* data, uint32_t len, uint32_t numOfResp) = 0;
virtual void getDescription() = 0;
virtual void getDescriptionNum() = 0;
virtual void dumpBuffer();
virtual void setProtocol(int protocol) { connected_ = true; }
virtual void open() { connected_ = false; }
virtual void close();
virtual void wiringCheck() = 0;
virtual void sendHeartBeat() {}
virtual int getProtocol() const = 0;
virtual void kwDisplay() {}
virtual void setFilterAndMask() {}
bool isConnected() const { return connected_; }
virtual void monitor() {}
virtual void monitor(const uint8_t* data, uint32_t len, uint32_t numOfResp) {}
void setStatus(int sts) { sts_ = sts; }
int getStatus() const { return sts_; }
static void clearHistory();
protected:
static void insertToHistory(const Ecumsg* msg);
static void appendToHistory(const Ecumsg* msg);
ProtocolAdapter();
bool connected_;
AdapterConfig* config_;
int sts_;
private:
const static int HISTORY_LEN = 256;
const static int ITEM_LEN = 16;
static int historyPos_;
static uint8_t history_[HISTORY_LEN];
};
#endif //__PROTOCOL_ADAPTER_H__
|
0c5bb0f47d72c50cbddefeb6d8311a95cf874622 | 0d73d7e2ff7f30c5b4bc4e3c3c654f519186c187 | /Library/Il2cppBuildCache/iOS/il2cppOutput/Unity.Barracuda.BurstBLAS 2.cpp | 26e037d7d6504c3929499bb5bf8ae924c0ad178d | [
"MIT"
] | permissive | Alex-Greenen/Spectral-Neural-Animation-Unity | 654710696b60db5c1dda2d912c0f15cbd20bc88e | fbd4983c2e260e21b353bf44c682e1413e480ce5 | refs/heads/main | 2023-08-01T08:17:57.781205 | 2021-09-14T17:24:26 | 2021-09-14T17:24:26 | 406,389,001 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 74,699 | cpp | Unity.Barracuda.BurstBLAS 2.cpp | #include "pch-cpp.hpp"
#ifndef _MSC_VER
# include <alloca.h>
#else
# include <malloc.h>
#endif
#include <limits>
#include <stdint.h>
// System.Char[]
struct CharU5BU5D_t7B7FC5BC8091AA3B9CB0B29CDD80B5EE9254AA34;
// System.IntPtr[]
struct IntPtrU5BU5D_t27FC72B0409D75AAF33EC42498E8094E95FEE9A6;
// System.Diagnostics.StackTrace[]
struct StackTraceU5BU5D_t4AD999C288CB6D1F38A299D12B1598D606588971;
// System.Type[]
struct TypeU5BU5D_t85B10489E46F06CEC7C4B1CCBD0E01FAB6649755;
// System.Reflection.Binder
struct Binder_t2BEE27FD84737D1E79BC47FD67F6D3DD2F2DDA30;
// Unity.Barracuda.BurstBLAS
struct BurstBLAS_t4E752AF6B1BBD5757AC2C1392B987F153286E624;
// System.Collections.IDictionary
struct IDictionary_t99871C56B8EC2452AC5C4CF3831695E617B89D3A;
// System.Reflection.MemberFilter
struct MemberFilter_t48D0AA10105D186AF42428FA532D4B4332CF8B81;
// System.Runtime.Serialization.SafeSerializationManager
struct SafeSerializationManager_tDE44F029589A028F8A3053C5C06153FAB4AAE29F;
// System.Single
struct Single_tE07797BA3C98D4CA9B5A19413C19A76688AB899E;
// System.String
struct String_t;
// System.Type
struct Type_t;
// System.Void
struct Void_t700C6383A2A510C2CF4DD86DABD5CA9FF70ADAC5;
IL2CPP_EXTERN_C RuntimeClass* D_t6A7435A1D213B72E31404960E745E561853F4C90_il2cpp_TypeInfo_var;
IL2CPP_EXTERN_C RuntimeClass* Exception_t_il2cpp_TypeInfo_var;
IL2CPP_EXTERN_C String_t* _stringLiteral8DCC3AF6F2D842D9485DCB78474DB5CA4BB24D28;
IL2CPP_EXTERN_C const RuntimeMethod* IJobParallelForExtensions_Schedule_TisUnsafeMatrixBlockMultiplyUnrolled8xhJob_t536B1D94D0877A3DB989F51DE54CBF2CAB604581_m17E6280AA7C16FF5276847AC9AD27097C0BF3FB3_RuntimeMethod_var;
struct Exception_t_marshaled_com;
struct Exception_t_marshaled_pinvoke;
IL2CPP_EXTERN_C_BEGIN
IL2CPP_EXTERN_C_END
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// <Module>
struct U3CModuleU3E_t630CFB7661E02A857D7E7C253E4C2BD0FD1869A5
{
public:
public:
};
// System.Object
struct Il2CppArrayBounds;
// System.Array
// Unity.Barracuda.BurstBLAS
struct BurstBLAS_t4E752AF6B1BBD5757AC2C1392B987F153286E624 : public RuntimeObject
{
public:
public:
};
// System.Reflection.MemberInfo
struct MemberInfo_t : public RuntimeObject
{
public:
public:
};
// System.String
struct String_t : public RuntimeObject
{
public:
// System.Int32 System.String::m_stringLength
int32_t ___m_stringLength_0;
// System.Char System.String::m_firstChar
Il2CppChar ___m_firstChar_1;
public:
inline static int32_t get_offset_of_m_stringLength_0() { return static_cast<int32_t>(offsetof(String_t, ___m_stringLength_0)); }
inline int32_t get_m_stringLength_0() const { return ___m_stringLength_0; }
inline int32_t* get_address_of_m_stringLength_0() { return &___m_stringLength_0; }
inline void set_m_stringLength_0(int32_t value)
{
___m_stringLength_0 = value;
}
inline static int32_t get_offset_of_m_firstChar_1() { return static_cast<int32_t>(offsetof(String_t, ___m_firstChar_1)); }
inline Il2CppChar get_m_firstChar_1() const { return ___m_firstChar_1; }
inline Il2CppChar* get_address_of_m_firstChar_1() { return &___m_firstChar_1; }
inline void set_m_firstChar_1(Il2CppChar value)
{
___m_firstChar_1 = value;
}
};
struct String_t_StaticFields
{
public:
// System.String System.String::Empty
String_t* ___Empty_5;
public:
inline static int32_t get_offset_of_Empty_5() { return static_cast<int32_t>(offsetof(String_t_StaticFields, ___Empty_5)); }
inline String_t* get_Empty_5() const { return ___Empty_5; }
inline String_t** get_address_of_Empty_5() { return &___Empty_5; }
inline void set_Empty_5(String_t* value)
{
___Empty_5 = value;
Il2CppCodeGenWriteBarrier((void**)(&___Empty_5), (void*)value);
}
};
// System.ValueType
struct ValueType_tDBF999C1B75C48C68621878250DBF6CDBCF51E52 : public RuntimeObject
{
public:
public:
};
// Native definition for P/Invoke marshalling of System.ValueType
struct ValueType_tDBF999C1B75C48C68621878250DBF6CDBCF51E52_marshaled_pinvoke
{
};
// Native definition for COM marshalling of System.ValueType
struct ValueType_tDBF999C1B75C48C68621878250DBF6CDBCF51E52_marshaled_com
{
};
// System.Boolean
struct Boolean_t07D1E3F34E4813023D64F584DFF7B34C9D922F37
{
public:
// System.Boolean System.Boolean::m_value
bool ___m_value_0;
public:
inline static int32_t get_offset_of_m_value_0() { return static_cast<int32_t>(offsetof(Boolean_t07D1E3F34E4813023D64F584DFF7B34C9D922F37, ___m_value_0)); }
inline bool get_m_value_0() const { return ___m_value_0; }
inline bool* get_address_of_m_value_0() { return &___m_value_0; }
inline void set_m_value_0(bool value)
{
___m_value_0 = value;
}
};
struct Boolean_t07D1E3F34E4813023D64F584DFF7B34C9D922F37_StaticFields
{
public:
// System.String System.Boolean::TrueString
String_t* ___TrueString_5;
// System.String System.Boolean::FalseString
String_t* ___FalseString_6;
public:
inline static int32_t get_offset_of_TrueString_5() { return static_cast<int32_t>(offsetof(Boolean_t07D1E3F34E4813023D64F584DFF7B34C9D922F37_StaticFields, ___TrueString_5)); }
inline String_t* get_TrueString_5() const { return ___TrueString_5; }
inline String_t** get_address_of_TrueString_5() { return &___TrueString_5; }
inline void set_TrueString_5(String_t* value)
{
___TrueString_5 = value;
Il2CppCodeGenWriteBarrier((void**)(&___TrueString_5), (void*)value);
}
inline static int32_t get_offset_of_FalseString_6() { return static_cast<int32_t>(offsetof(Boolean_t07D1E3F34E4813023D64F584DFF7B34C9D922F37_StaticFields, ___FalseString_6)); }
inline String_t* get_FalseString_6() const { return ___FalseString_6; }
inline String_t** get_address_of_FalseString_6() { return &___FalseString_6; }
inline void set_FalseString_6(String_t* value)
{
___FalseString_6 = value;
Il2CppCodeGenWriteBarrier((void**)(&___FalseString_6), (void*)value);
}
};
// System.Enum
struct Enum_t23B90B40F60E677A8025267341651C94AE079CDA : public ValueType_tDBF999C1B75C48C68621878250DBF6CDBCF51E52
{
public:
public:
};
struct Enum_t23B90B40F60E677A8025267341651C94AE079CDA_StaticFields
{
public:
// System.Char[] System.Enum::enumSeperatorCharArray
CharU5BU5D_t7B7FC5BC8091AA3B9CB0B29CDD80B5EE9254AA34* ___enumSeperatorCharArray_0;
public:
inline static int32_t get_offset_of_enumSeperatorCharArray_0() { return static_cast<int32_t>(offsetof(Enum_t23B90B40F60E677A8025267341651C94AE079CDA_StaticFields, ___enumSeperatorCharArray_0)); }
inline CharU5BU5D_t7B7FC5BC8091AA3B9CB0B29CDD80B5EE9254AA34* get_enumSeperatorCharArray_0() const { return ___enumSeperatorCharArray_0; }
inline CharU5BU5D_t7B7FC5BC8091AA3B9CB0B29CDD80B5EE9254AA34** get_address_of_enumSeperatorCharArray_0() { return &___enumSeperatorCharArray_0; }
inline void set_enumSeperatorCharArray_0(CharU5BU5D_t7B7FC5BC8091AA3B9CB0B29CDD80B5EE9254AA34* value)
{
___enumSeperatorCharArray_0 = value;
Il2CppCodeGenWriteBarrier((void**)(&___enumSeperatorCharArray_0), (void*)value);
}
};
// Native definition for P/Invoke marshalling of System.Enum
struct Enum_t23B90B40F60E677A8025267341651C94AE079CDA_marshaled_pinvoke
{
};
// Native definition for COM marshalling of System.Enum
struct Enum_t23B90B40F60E677A8025267341651C94AE079CDA_marshaled_com
{
};
// System.Int32
struct Int32_tFDE5F8CD43D10453F6A2E0C77FE48C6CC7009046
{
public:
// System.Int32 System.Int32::m_value
int32_t ___m_value_0;
public:
inline static int32_t get_offset_of_m_value_0() { return static_cast<int32_t>(offsetof(Int32_tFDE5F8CD43D10453F6A2E0C77FE48C6CC7009046, ___m_value_0)); }
inline int32_t get_m_value_0() const { return ___m_value_0; }
inline int32_t* get_address_of_m_value_0() { return &___m_value_0; }
inline void set_m_value_0(int32_t value)
{
___m_value_0 = value;
}
};
// System.Int64
struct Int64_t378EE0D608BD3107E77238E85F30D2BBD46981F3
{
public:
// System.Int64 System.Int64::m_value
int64_t ___m_value_0;
public:
inline static int32_t get_offset_of_m_value_0() { return static_cast<int32_t>(offsetof(Int64_t378EE0D608BD3107E77238E85F30D2BBD46981F3, ___m_value_0)); }
inline int64_t get_m_value_0() const { return ___m_value_0; }
inline int64_t* get_address_of_m_value_0() { return &___m_value_0; }
inline void set_m_value_0(int64_t value)
{
___m_value_0 = value;
}
};
// System.IntPtr
struct IntPtr_t
{
public:
// System.Void* System.IntPtr::m_value
void* ___m_value_0;
public:
inline static int32_t get_offset_of_m_value_0() { return static_cast<int32_t>(offsetof(IntPtr_t, ___m_value_0)); }
inline void* get_m_value_0() const { return ___m_value_0; }
inline void** get_address_of_m_value_0() { return &___m_value_0; }
inline void set_m_value_0(void* value)
{
___m_value_0 = value;
}
};
struct IntPtr_t_StaticFields
{
public:
// System.IntPtr System.IntPtr::Zero
intptr_t ___Zero_1;
public:
inline static int32_t get_offset_of_Zero_1() { return static_cast<int32_t>(offsetof(IntPtr_t_StaticFields, ___Zero_1)); }
inline intptr_t get_Zero_1() const { return ___Zero_1; }
inline intptr_t* get_address_of_Zero_1() { return &___Zero_1; }
inline void set_Zero_1(intptr_t value)
{
___Zero_1 = value;
}
};
// System.Single
struct Single_tE07797BA3C98D4CA9B5A19413C19A76688AB899E
{
public:
// System.Single System.Single::m_value
float ___m_value_0;
public:
inline static int32_t get_offset_of_m_value_0() { return static_cast<int32_t>(offsetof(Single_tE07797BA3C98D4CA9B5A19413C19A76688AB899E, ___m_value_0)); }
inline float get_m_value_0() const { return ___m_value_0; }
inline float* get_address_of_m_value_0() { return &___m_value_0; }
inline void set_m_value_0(float value)
{
___m_value_0 = value;
}
};
// Unity.Barracuda.UnsafeMatrixBlockMultiplyUnrolled8xhJob
struct UnsafeMatrixBlockMultiplyUnrolled8xhJob_t536B1D94D0877A3DB989F51DE54CBF2CAB604581
{
public:
// System.Single* Unity.Barracuda.UnsafeMatrixBlockMultiplyUnrolled8xhJob::A
float* ___A_0;
// System.Int32 Unity.Barracuda.UnsafeMatrixBlockMultiplyUnrolled8xhJob::AN
int32_t ___AN_1;
// System.Int32 Unity.Barracuda.UnsafeMatrixBlockMultiplyUnrolled8xhJob::AM
int32_t ___AM_2;
// System.Single* Unity.Barracuda.UnsafeMatrixBlockMultiplyUnrolled8xhJob::B
float* ___B_3;
// System.Int32 Unity.Barracuda.UnsafeMatrixBlockMultiplyUnrolled8xhJob::BN
int32_t ___BN_4;
// System.Int32 Unity.Barracuda.UnsafeMatrixBlockMultiplyUnrolled8xhJob::BM
int32_t ___BM_5;
// System.Single* Unity.Barracuda.UnsafeMatrixBlockMultiplyUnrolled8xhJob::C
float* ___C_6;
// System.Int32 Unity.Barracuda.UnsafeMatrixBlockMultiplyUnrolled8xhJob::CN
int32_t ___CN_7;
// System.Int32 Unity.Barracuda.UnsafeMatrixBlockMultiplyUnrolled8xhJob::CM
int32_t ___CM_8;
// System.Int32 Unity.Barracuda.UnsafeMatrixBlockMultiplyUnrolled8xhJob::bs
int32_t ___bs_9;
// System.Boolean Unity.Barracuda.UnsafeMatrixBlockMultiplyUnrolled8xhJob::scheduleRowA
bool ___scheduleRowA_10;
// System.Boolean Unity.Barracuda.UnsafeMatrixBlockMultiplyUnrolled8xhJob::transposeA
bool ___transposeA_11;
// System.Boolean Unity.Barracuda.UnsafeMatrixBlockMultiplyUnrolled8xhJob::transposeB
bool ___transposeB_12;
public:
inline static int32_t get_offset_of_A_0() { return static_cast<int32_t>(offsetof(UnsafeMatrixBlockMultiplyUnrolled8xhJob_t536B1D94D0877A3DB989F51DE54CBF2CAB604581, ___A_0)); }
inline float* get_A_0() const { return ___A_0; }
inline float** get_address_of_A_0() { return &___A_0; }
inline void set_A_0(float* value)
{
___A_0 = value;
}
inline static int32_t get_offset_of_AN_1() { return static_cast<int32_t>(offsetof(UnsafeMatrixBlockMultiplyUnrolled8xhJob_t536B1D94D0877A3DB989F51DE54CBF2CAB604581, ___AN_1)); }
inline int32_t get_AN_1() const { return ___AN_1; }
inline int32_t* get_address_of_AN_1() { return &___AN_1; }
inline void set_AN_1(int32_t value)
{
___AN_1 = value;
}
inline static int32_t get_offset_of_AM_2() { return static_cast<int32_t>(offsetof(UnsafeMatrixBlockMultiplyUnrolled8xhJob_t536B1D94D0877A3DB989F51DE54CBF2CAB604581, ___AM_2)); }
inline int32_t get_AM_2() const { return ___AM_2; }
inline int32_t* get_address_of_AM_2() { return &___AM_2; }
inline void set_AM_2(int32_t value)
{
___AM_2 = value;
}
inline static int32_t get_offset_of_B_3() { return static_cast<int32_t>(offsetof(UnsafeMatrixBlockMultiplyUnrolled8xhJob_t536B1D94D0877A3DB989F51DE54CBF2CAB604581, ___B_3)); }
inline float* get_B_3() const { return ___B_3; }
inline float** get_address_of_B_3() { return &___B_3; }
inline void set_B_3(float* value)
{
___B_3 = value;
}
inline static int32_t get_offset_of_BN_4() { return static_cast<int32_t>(offsetof(UnsafeMatrixBlockMultiplyUnrolled8xhJob_t536B1D94D0877A3DB989F51DE54CBF2CAB604581, ___BN_4)); }
inline int32_t get_BN_4() const { return ___BN_4; }
inline int32_t* get_address_of_BN_4() { return &___BN_4; }
inline void set_BN_4(int32_t value)
{
___BN_4 = value;
}
inline static int32_t get_offset_of_BM_5() { return static_cast<int32_t>(offsetof(UnsafeMatrixBlockMultiplyUnrolled8xhJob_t536B1D94D0877A3DB989F51DE54CBF2CAB604581, ___BM_5)); }
inline int32_t get_BM_5() const { return ___BM_5; }
inline int32_t* get_address_of_BM_5() { return &___BM_5; }
inline void set_BM_5(int32_t value)
{
___BM_5 = value;
}
inline static int32_t get_offset_of_C_6() { return static_cast<int32_t>(offsetof(UnsafeMatrixBlockMultiplyUnrolled8xhJob_t536B1D94D0877A3DB989F51DE54CBF2CAB604581, ___C_6)); }
inline float* get_C_6() const { return ___C_6; }
inline float** get_address_of_C_6() { return &___C_6; }
inline void set_C_6(float* value)
{
___C_6 = value;
}
inline static int32_t get_offset_of_CN_7() { return static_cast<int32_t>(offsetof(UnsafeMatrixBlockMultiplyUnrolled8xhJob_t536B1D94D0877A3DB989F51DE54CBF2CAB604581, ___CN_7)); }
inline int32_t get_CN_7() const { return ___CN_7; }
inline int32_t* get_address_of_CN_7() { return &___CN_7; }
inline void set_CN_7(int32_t value)
{
___CN_7 = value;
}
inline static int32_t get_offset_of_CM_8() { return static_cast<int32_t>(offsetof(UnsafeMatrixBlockMultiplyUnrolled8xhJob_t536B1D94D0877A3DB989F51DE54CBF2CAB604581, ___CM_8)); }
inline int32_t get_CM_8() const { return ___CM_8; }
inline int32_t* get_address_of_CM_8() { return &___CM_8; }
inline void set_CM_8(int32_t value)
{
___CM_8 = value;
}
inline static int32_t get_offset_of_bs_9() { return static_cast<int32_t>(offsetof(UnsafeMatrixBlockMultiplyUnrolled8xhJob_t536B1D94D0877A3DB989F51DE54CBF2CAB604581, ___bs_9)); }
inline int32_t get_bs_9() const { return ___bs_9; }
inline int32_t* get_address_of_bs_9() { return &___bs_9; }
inline void set_bs_9(int32_t value)
{
___bs_9 = value;
}
inline static int32_t get_offset_of_scheduleRowA_10() { return static_cast<int32_t>(offsetof(UnsafeMatrixBlockMultiplyUnrolled8xhJob_t536B1D94D0877A3DB989F51DE54CBF2CAB604581, ___scheduleRowA_10)); }
inline bool get_scheduleRowA_10() const { return ___scheduleRowA_10; }
inline bool* get_address_of_scheduleRowA_10() { return &___scheduleRowA_10; }
inline void set_scheduleRowA_10(bool value)
{
___scheduleRowA_10 = value;
}
inline static int32_t get_offset_of_transposeA_11() { return static_cast<int32_t>(offsetof(UnsafeMatrixBlockMultiplyUnrolled8xhJob_t536B1D94D0877A3DB989F51DE54CBF2CAB604581, ___transposeA_11)); }
inline bool get_transposeA_11() const { return ___transposeA_11; }
inline bool* get_address_of_transposeA_11() { return &___transposeA_11; }
inline void set_transposeA_11(bool value)
{
___transposeA_11 = value;
}
inline static int32_t get_offset_of_transposeB_12() { return static_cast<int32_t>(offsetof(UnsafeMatrixBlockMultiplyUnrolled8xhJob_t536B1D94D0877A3DB989F51DE54CBF2CAB604581, ___transposeB_12)); }
inline bool get_transposeB_12() const { return ___transposeB_12; }
inline bool* get_address_of_transposeB_12() { return &___transposeB_12; }
inline void set_transposeB_12(bool value)
{
___transposeB_12 = value;
}
};
// Native definition for P/Invoke marshalling of Unity.Barracuda.UnsafeMatrixBlockMultiplyUnrolled8xhJob
struct UnsafeMatrixBlockMultiplyUnrolled8xhJob_t536B1D94D0877A3DB989F51DE54CBF2CAB604581_marshaled_pinvoke
{
float* ___A_0;
int32_t ___AN_1;
int32_t ___AM_2;
float* ___B_3;
int32_t ___BN_4;
int32_t ___BM_5;
float* ___C_6;
int32_t ___CN_7;
int32_t ___CM_8;
int32_t ___bs_9;
int32_t ___scheduleRowA_10;
int32_t ___transposeA_11;
int32_t ___transposeB_12;
};
// Native definition for COM marshalling of Unity.Barracuda.UnsafeMatrixBlockMultiplyUnrolled8xhJob
struct UnsafeMatrixBlockMultiplyUnrolled8xhJob_t536B1D94D0877A3DB989F51DE54CBF2CAB604581_marshaled_com
{
float* ___A_0;
int32_t ___AN_1;
int32_t ___AM_2;
float* ___B_3;
int32_t ___BN_4;
int32_t ___BM_5;
float* ___C_6;
int32_t ___CN_7;
int32_t ___CM_8;
int32_t ___bs_9;
int32_t ___scheduleRowA_10;
int32_t ___transposeA_11;
int32_t ___transposeB_12;
};
// System.Void
struct Void_t700C6383A2A510C2CF4DD86DABD5CA9FF70ADAC5
{
public:
union
{
struct
{
};
uint8_t Void_t700C6383A2A510C2CF4DD86DABD5CA9FF70ADAC5__padding[1];
};
public:
};
// Unity.Collections.Allocator
struct Allocator_t9888223DEF4F46F3419ECFCCD0753599BEE52A05
{
public:
// System.Int32 Unity.Collections.Allocator::value__
int32_t ___value___2;
public:
inline static int32_t get_offset_of_value___2() { return static_cast<int32_t>(offsetof(Allocator_t9888223DEF4F46F3419ECFCCD0753599BEE52A05, ___value___2)); }
inline int32_t get_value___2() const { return ___value___2; }
inline int32_t* get_address_of_value___2() { return &___value___2; }
inline void set_value___2(int32_t value)
{
___value___2 = value;
}
};
// System.Reflection.BindingFlags
struct BindingFlags_tAAAB07D9AC588F0D55D844E51D7035E96DF94733
{
public:
// System.Int32 System.Reflection.BindingFlags::value__
int32_t ___value___2;
public:
inline static int32_t get_offset_of_value___2() { return static_cast<int32_t>(offsetof(BindingFlags_tAAAB07D9AC588F0D55D844E51D7035E96DF94733, ___value___2)); }
inline int32_t get_value___2() const { return ___value___2; }
inline int32_t* get_address_of_value___2() { return &___value___2; }
inline void set_value___2(int32_t value)
{
___value___2 = value;
}
};
// System.Exception
struct Exception_t : public RuntimeObject
{
public:
// System.String System.Exception::_className
String_t* ____className_1;
// System.String System.Exception::_message
String_t* ____message_2;
// System.Collections.IDictionary System.Exception::_data
RuntimeObject* ____data_3;
// System.Exception System.Exception::_innerException
Exception_t * ____innerException_4;
// System.String System.Exception::_helpURL
String_t* ____helpURL_5;
// System.Object System.Exception::_stackTrace
RuntimeObject * ____stackTrace_6;
// System.String System.Exception::_stackTraceString
String_t* ____stackTraceString_7;
// System.String System.Exception::_remoteStackTraceString
String_t* ____remoteStackTraceString_8;
// System.Int32 System.Exception::_remoteStackIndex
int32_t ____remoteStackIndex_9;
// System.Object System.Exception::_dynamicMethods
RuntimeObject * ____dynamicMethods_10;
// System.Int32 System.Exception::_HResult
int32_t ____HResult_11;
// System.String System.Exception::_source
String_t* ____source_12;
// System.Runtime.Serialization.SafeSerializationManager System.Exception::_safeSerializationManager
SafeSerializationManager_tDE44F029589A028F8A3053C5C06153FAB4AAE29F * ____safeSerializationManager_13;
// System.Diagnostics.StackTrace[] System.Exception::captured_traces
StackTraceU5BU5D_t4AD999C288CB6D1F38A299D12B1598D606588971* ___captured_traces_14;
// System.IntPtr[] System.Exception::native_trace_ips
IntPtrU5BU5D_t27FC72B0409D75AAF33EC42498E8094E95FEE9A6* ___native_trace_ips_15;
public:
inline static int32_t get_offset_of__className_1() { return static_cast<int32_t>(offsetof(Exception_t, ____className_1)); }
inline String_t* get__className_1() const { return ____className_1; }
inline String_t** get_address_of__className_1() { return &____className_1; }
inline void set__className_1(String_t* value)
{
____className_1 = value;
Il2CppCodeGenWriteBarrier((void**)(&____className_1), (void*)value);
}
inline static int32_t get_offset_of__message_2() { return static_cast<int32_t>(offsetof(Exception_t, ____message_2)); }
inline String_t* get__message_2() const { return ____message_2; }
inline String_t** get_address_of__message_2() { return &____message_2; }
inline void set__message_2(String_t* value)
{
____message_2 = value;
Il2CppCodeGenWriteBarrier((void**)(&____message_2), (void*)value);
}
inline static int32_t get_offset_of__data_3() { return static_cast<int32_t>(offsetof(Exception_t, ____data_3)); }
inline RuntimeObject* get__data_3() const { return ____data_3; }
inline RuntimeObject** get_address_of__data_3() { return &____data_3; }
inline void set__data_3(RuntimeObject* value)
{
____data_3 = value;
Il2CppCodeGenWriteBarrier((void**)(&____data_3), (void*)value);
}
inline static int32_t get_offset_of__innerException_4() { return static_cast<int32_t>(offsetof(Exception_t, ____innerException_4)); }
inline Exception_t * get__innerException_4() const { return ____innerException_4; }
inline Exception_t ** get_address_of__innerException_4() { return &____innerException_4; }
inline void set__innerException_4(Exception_t * value)
{
____innerException_4 = value;
Il2CppCodeGenWriteBarrier((void**)(&____innerException_4), (void*)value);
}
inline static int32_t get_offset_of__helpURL_5() { return static_cast<int32_t>(offsetof(Exception_t, ____helpURL_5)); }
inline String_t* get__helpURL_5() const { return ____helpURL_5; }
inline String_t** get_address_of__helpURL_5() { return &____helpURL_5; }
inline void set__helpURL_5(String_t* value)
{
____helpURL_5 = value;
Il2CppCodeGenWriteBarrier((void**)(&____helpURL_5), (void*)value);
}
inline static int32_t get_offset_of__stackTrace_6() { return static_cast<int32_t>(offsetof(Exception_t, ____stackTrace_6)); }
inline RuntimeObject * get__stackTrace_6() const { return ____stackTrace_6; }
inline RuntimeObject ** get_address_of__stackTrace_6() { return &____stackTrace_6; }
inline void set__stackTrace_6(RuntimeObject * value)
{
____stackTrace_6 = value;
Il2CppCodeGenWriteBarrier((void**)(&____stackTrace_6), (void*)value);
}
inline static int32_t get_offset_of__stackTraceString_7() { return static_cast<int32_t>(offsetof(Exception_t, ____stackTraceString_7)); }
inline String_t* get__stackTraceString_7() const { return ____stackTraceString_7; }
inline String_t** get_address_of__stackTraceString_7() { return &____stackTraceString_7; }
inline void set__stackTraceString_7(String_t* value)
{
____stackTraceString_7 = value;
Il2CppCodeGenWriteBarrier((void**)(&____stackTraceString_7), (void*)value);
}
inline static int32_t get_offset_of__remoteStackTraceString_8() { return static_cast<int32_t>(offsetof(Exception_t, ____remoteStackTraceString_8)); }
inline String_t* get__remoteStackTraceString_8() const { return ____remoteStackTraceString_8; }
inline String_t** get_address_of__remoteStackTraceString_8() { return &____remoteStackTraceString_8; }
inline void set__remoteStackTraceString_8(String_t* value)
{
____remoteStackTraceString_8 = value;
Il2CppCodeGenWriteBarrier((void**)(&____remoteStackTraceString_8), (void*)value);
}
inline static int32_t get_offset_of__remoteStackIndex_9() { return static_cast<int32_t>(offsetof(Exception_t, ____remoteStackIndex_9)); }
inline int32_t get__remoteStackIndex_9() const { return ____remoteStackIndex_9; }
inline int32_t* get_address_of__remoteStackIndex_9() { return &____remoteStackIndex_9; }
inline void set__remoteStackIndex_9(int32_t value)
{
____remoteStackIndex_9 = value;
}
inline static int32_t get_offset_of__dynamicMethods_10() { return static_cast<int32_t>(offsetof(Exception_t, ____dynamicMethods_10)); }
inline RuntimeObject * get__dynamicMethods_10() const { return ____dynamicMethods_10; }
inline RuntimeObject ** get_address_of__dynamicMethods_10() { return &____dynamicMethods_10; }
inline void set__dynamicMethods_10(RuntimeObject * value)
{
____dynamicMethods_10 = value;
Il2CppCodeGenWriteBarrier((void**)(&____dynamicMethods_10), (void*)value);
}
inline static int32_t get_offset_of__HResult_11() { return static_cast<int32_t>(offsetof(Exception_t, ____HResult_11)); }
inline int32_t get__HResult_11() const { return ____HResult_11; }
inline int32_t* get_address_of__HResult_11() { return &____HResult_11; }
inline void set__HResult_11(int32_t value)
{
____HResult_11 = value;
}
inline static int32_t get_offset_of__source_12() { return static_cast<int32_t>(offsetof(Exception_t, ____source_12)); }
inline String_t* get__source_12() const { return ____source_12; }
inline String_t** get_address_of__source_12() { return &____source_12; }
inline void set__source_12(String_t* value)
{
____source_12 = value;
Il2CppCodeGenWriteBarrier((void**)(&____source_12), (void*)value);
}
inline static int32_t get_offset_of__safeSerializationManager_13() { return static_cast<int32_t>(offsetof(Exception_t, ____safeSerializationManager_13)); }
inline SafeSerializationManager_tDE44F029589A028F8A3053C5C06153FAB4AAE29F * get__safeSerializationManager_13() const { return ____safeSerializationManager_13; }
inline SafeSerializationManager_tDE44F029589A028F8A3053C5C06153FAB4AAE29F ** get_address_of__safeSerializationManager_13() { return &____safeSerializationManager_13; }
inline void set__safeSerializationManager_13(SafeSerializationManager_tDE44F029589A028F8A3053C5C06153FAB4AAE29F * value)
{
____safeSerializationManager_13 = value;
Il2CppCodeGenWriteBarrier((void**)(&____safeSerializationManager_13), (void*)value);
}
inline static int32_t get_offset_of_captured_traces_14() { return static_cast<int32_t>(offsetof(Exception_t, ___captured_traces_14)); }
inline StackTraceU5BU5D_t4AD999C288CB6D1F38A299D12B1598D606588971* get_captured_traces_14() const { return ___captured_traces_14; }
inline StackTraceU5BU5D_t4AD999C288CB6D1F38A299D12B1598D606588971** get_address_of_captured_traces_14() { return &___captured_traces_14; }
inline void set_captured_traces_14(StackTraceU5BU5D_t4AD999C288CB6D1F38A299D12B1598D606588971* value)
{
___captured_traces_14 = value;
Il2CppCodeGenWriteBarrier((void**)(&___captured_traces_14), (void*)value);
}
inline static int32_t get_offset_of_native_trace_ips_15() { return static_cast<int32_t>(offsetof(Exception_t, ___native_trace_ips_15)); }
inline IntPtrU5BU5D_t27FC72B0409D75AAF33EC42498E8094E95FEE9A6* get_native_trace_ips_15() const { return ___native_trace_ips_15; }
inline IntPtrU5BU5D_t27FC72B0409D75AAF33EC42498E8094E95FEE9A6** get_address_of_native_trace_ips_15() { return &___native_trace_ips_15; }
inline void set_native_trace_ips_15(IntPtrU5BU5D_t27FC72B0409D75AAF33EC42498E8094E95FEE9A6* value)
{
___native_trace_ips_15 = value;
Il2CppCodeGenWriteBarrier((void**)(&___native_trace_ips_15), (void*)value);
}
};
struct Exception_t_StaticFields
{
public:
// System.Object System.Exception::s_EDILock
RuntimeObject * ___s_EDILock_0;
public:
inline static int32_t get_offset_of_s_EDILock_0() { return static_cast<int32_t>(offsetof(Exception_t_StaticFields, ___s_EDILock_0)); }
inline RuntimeObject * get_s_EDILock_0() const { return ___s_EDILock_0; }
inline RuntimeObject ** get_address_of_s_EDILock_0() { return &___s_EDILock_0; }
inline void set_s_EDILock_0(RuntimeObject * value)
{
___s_EDILock_0 = value;
Il2CppCodeGenWriteBarrier((void**)(&___s_EDILock_0), (void*)value);
}
};
// Native definition for P/Invoke marshalling of System.Exception
struct Exception_t_marshaled_pinvoke
{
char* ____className_1;
char* ____message_2;
RuntimeObject* ____data_3;
Exception_t_marshaled_pinvoke* ____innerException_4;
char* ____helpURL_5;
Il2CppIUnknown* ____stackTrace_6;
char* ____stackTraceString_7;
char* ____remoteStackTraceString_8;
int32_t ____remoteStackIndex_9;
Il2CppIUnknown* ____dynamicMethods_10;
int32_t ____HResult_11;
char* ____source_12;
SafeSerializationManager_tDE44F029589A028F8A3053C5C06153FAB4AAE29F * ____safeSerializationManager_13;
StackTraceU5BU5D_t4AD999C288CB6D1F38A299D12B1598D606588971* ___captured_traces_14;
Il2CppSafeArray/*NONE*/* ___native_trace_ips_15;
};
// Native definition for COM marshalling of System.Exception
struct Exception_t_marshaled_com
{
Il2CppChar* ____className_1;
Il2CppChar* ____message_2;
RuntimeObject* ____data_3;
Exception_t_marshaled_com* ____innerException_4;
Il2CppChar* ____helpURL_5;
Il2CppIUnknown* ____stackTrace_6;
Il2CppChar* ____stackTraceString_7;
Il2CppChar* ____remoteStackTraceString_8;
int32_t ____remoteStackIndex_9;
Il2CppIUnknown* ____dynamicMethods_10;
int32_t ____HResult_11;
Il2CppChar* ____source_12;
SafeSerializationManager_tDE44F029589A028F8A3053C5C06153FAB4AAE29F * ____safeSerializationManager_13;
StackTraceU5BU5D_t4AD999C288CB6D1F38A299D12B1598D606588971* ___captured_traces_14;
Il2CppSafeArray/*NONE*/* ___native_trace_ips_15;
};
// Unity.Jobs.JobHandle
struct JobHandle_t8AEB8D31C25D7774C71D62B0C662525E6E36D847
{
public:
// System.IntPtr Unity.Jobs.JobHandle::jobGroup
intptr_t ___jobGroup_0;
// System.Int32 Unity.Jobs.JobHandle::version
int32_t ___version_1;
public:
inline static int32_t get_offset_of_jobGroup_0() { return static_cast<int32_t>(offsetof(JobHandle_t8AEB8D31C25D7774C71D62B0C662525E6E36D847, ___jobGroup_0)); }
inline intptr_t get_jobGroup_0() const { return ___jobGroup_0; }
inline intptr_t* get_address_of_jobGroup_0() { return &___jobGroup_0; }
inline void set_jobGroup_0(intptr_t value)
{
___jobGroup_0 = value;
}
inline static int32_t get_offset_of_version_1() { return static_cast<int32_t>(offsetof(JobHandle_t8AEB8D31C25D7774C71D62B0C662525E6E36D847, ___version_1)); }
inline int32_t get_version_1() const { return ___version_1; }
inline int32_t* get_address_of_version_1() { return &___version_1; }
inline void set_version_1(int32_t value)
{
___version_1 = value;
}
};
// System.RuntimeTypeHandle
struct RuntimeTypeHandle_tC33965ADA3E041E0C94AF05E5CB527B56482CEF9
{
public:
// System.IntPtr System.RuntimeTypeHandle::value
intptr_t ___value_0;
public:
inline static int32_t get_offset_of_value_0() { return static_cast<int32_t>(offsetof(RuntimeTypeHandle_tC33965ADA3E041E0C94AF05E5CB527B56482CEF9, ___value_0)); }
inline intptr_t get_value_0() const { return ___value_0; }
inline intptr_t* get_address_of_value_0() { return &___value_0; }
inline void set_value_0(intptr_t value)
{
___value_0 = value;
}
};
// System.Type
struct Type_t : public MemberInfo_t
{
public:
// System.RuntimeTypeHandle System.Type::_impl
RuntimeTypeHandle_tC33965ADA3E041E0C94AF05E5CB527B56482CEF9 ____impl_9;
public:
inline static int32_t get_offset_of__impl_9() { return static_cast<int32_t>(offsetof(Type_t, ____impl_9)); }
inline RuntimeTypeHandle_tC33965ADA3E041E0C94AF05E5CB527B56482CEF9 get__impl_9() const { return ____impl_9; }
inline RuntimeTypeHandle_tC33965ADA3E041E0C94AF05E5CB527B56482CEF9 * get_address_of__impl_9() { return &____impl_9; }
inline void set__impl_9(RuntimeTypeHandle_tC33965ADA3E041E0C94AF05E5CB527B56482CEF9 value)
{
____impl_9 = value;
}
};
struct Type_t_StaticFields
{
public:
// System.Reflection.MemberFilter System.Type::FilterAttribute
MemberFilter_t48D0AA10105D186AF42428FA532D4B4332CF8B81 * ___FilterAttribute_0;
// System.Reflection.MemberFilter System.Type::FilterName
MemberFilter_t48D0AA10105D186AF42428FA532D4B4332CF8B81 * ___FilterName_1;
// System.Reflection.MemberFilter System.Type::FilterNameIgnoreCase
MemberFilter_t48D0AA10105D186AF42428FA532D4B4332CF8B81 * ___FilterNameIgnoreCase_2;
// System.Object System.Type::Missing
RuntimeObject * ___Missing_3;
// System.Char System.Type::Delimiter
Il2CppChar ___Delimiter_4;
// System.Type[] System.Type::EmptyTypes
TypeU5BU5D_t85B10489E46F06CEC7C4B1CCBD0E01FAB6649755* ___EmptyTypes_5;
// System.Reflection.Binder System.Type::defaultBinder
Binder_t2BEE27FD84737D1E79BC47FD67F6D3DD2F2DDA30 * ___defaultBinder_6;
public:
inline static int32_t get_offset_of_FilterAttribute_0() { return static_cast<int32_t>(offsetof(Type_t_StaticFields, ___FilterAttribute_0)); }
inline MemberFilter_t48D0AA10105D186AF42428FA532D4B4332CF8B81 * get_FilterAttribute_0() const { return ___FilterAttribute_0; }
inline MemberFilter_t48D0AA10105D186AF42428FA532D4B4332CF8B81 ** get_address_of_FilterAttribute_0() { return &___FilterAttribute_0; }
inline void set_FilterAttribute_0(MemberFilter_t48D0AA10105D186AF42428FA532D4B4332CF8B81 * value)
{
___FilterAttribute_0 = value;
Il2CppCodeGenWriteBarrier((void**)(&___FilterAttribute_0), (void*)value);
}
inline static int32_t get_offset_of_FilterName_1() { return static_cast<int32_t>(offsetof(Type_t_StaticFields, ___FilterName_1)); }
inline MemberFilter_t48D0AA10105D186AF42428FA532D4B4332CF8B81 * get_FilterName_1() const { return ___FilterName_1; }
inline MemberFilter_t48D0AA10105D186AF42428FA532D4B4332CF8B81 ** get_address_of_FilterName_1() { return &___FilterName_1; }
inline void set_FilterName_1(MemberFilter_t48D0AA10105D186AF42428FA532D4B4332CF8B81 * value)
{
___FilterName_1 = value;
Il2CppCodeGenWriteBarrier((void**)(&___FilterName_1), (void*)value);
}
inline static int32_t get_offset_of_FilterNameIgnoreCase_2() { return static_cast<int32_t>(offsetof(Type_t_StaticFields, ___FilterNameIgnoreCase_2)); }
inline MemberFilter_t48D0AA10105D186AF42428FA532D4B4332CF8B81 * get_FilterNameIgnoreCase_2() const { return ___FilterNameIgnoreCase_2; }
inline MemberFilter_t48D0AA10105D186AF42428FA532D4B4332CF8B81 ** get_address_of_FilterNameIgnoreCase_2() { return &___FilterNameIgnoreCase_2; }
inline void set_FilterNameIgnoreCase_2(MemberFilter_t48D0AA10105D186AF42428FA532D4B4332CF8B81 * value)
{
___FilterNameIgnoreCase_2 = value;
Il2CppCodeGenWriteBarrier((void**)(&___FilterNameIgnoreCase_2), (void*)value);
}
inline static int32_t get_offset_of_Missing_3() { return static_cast<int32_t>(offsetof(Type_t_StaticFields, ___Missing_3)); }
inline RuntimeObject * get_Missing_3() const { return ___Missing_3; }
inline RuntimeObject ** get_address_of_Missing_3() { return &___Missing_3; }
inline void set_Missing_3(RuntimeObject * value)
{
___Missing_3 = value;
Il2CppCodeGenWriteBarrier((void**)(&___Missing_3), (void*)value);
}
inline static int32_t get_offset_of_Delimiter_4() { return static_cast<int32_t>(offsetof(Type_t_StaticFields, ___Delimiter_4)); }
inline Il2CppChar get_Delimiter_4() const { return ___Delimiter_4; }
inline Il2CppChar* get_address_of_Delimiter_4() { return &___Delimiter_4; }
inline void set_Delimiter_4(Il2CppChar value)
{
___Delimiter_4 = value;
}
inline static int32_t get_offset_of_EmptyTypes_5() { return static_cast<int32_t>(offsetof(Type_t_StaticFields, ___EmptyTypes_5)); }
inline TypeU5BU5D_t85B10489E46F06CEC7C4B1CCBD0E01FAB6649755* get_EmptyTypes_5() const { return ___EmptyTypes_5; }
inline TypeU5BU5D_t85B10489E46F06CEC7C4B1CCBD0E01FAB6649755** get_address_of_EmptyTypes_5() { return &___EmptyTypes_5; }
inline void set_EmptyTypes_5(TypeU5BU5D_t85B10489E46F06CEC7C4B1CCBD0E01FAB6649755* value)
{
___EmptyTypes_5 = value;
Il2CppCodeGenWriteBarrier((void**)(&___EmptyTypes_5), (void*)value);
}
inline static int32_t get_offset_of_defaultBinder_6() { return static_cast<int32_t>(offsetof(Type_t_StaticFields, ___defaultBinder_6)); }
inline Binder_t2BEE27FD84737D1E79BC47FD67F6D3DD2F2DDA30 * get_defaultBinder_6() const { return ___defaultBinder_6; }
inline Binder_t2BEE27FD84737D1E79BC47FD67F6D3DD2F2DDA30 ** get_address_of_defaultBinder_6() { return &___defaultBinder_6; }
inline void set_defaultBinder_6(Binder_t2BEE27FD84737D1E79BC47FD67F6D3DD2F2DDA30 * value)
{
___defaultBinder_6 = value;
Il2CppCodeGenWriteBarrier((void**)(&___defaultBinder_6), (void*)value);
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
// Unity.Jobs.JobHandle Unity.Jobs.IJobParallelForExtensions::Schedule<Unity.Barracuda.UnsafeMatrixBlockMultiplyUnrolled8xhJob>(!!0,System.Int32,System.Int32,Unity.Jobs.JobHandle)
IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR JobHandle_t8AEB8D31C25D7774C71D62B0C662525E6E36D847 IJobParallelForExtensions_Schedule_TisUnsafeMatrixBlockMultiplyUnrolled8xhJob_t536B1D94D0877A3DB989F51DE54CBF2CAB604581_m17E6280AA7C16FF5276847AC9AD27097C0BF3FB3_gshared (UnsafeMatrixBlockMultiplyUnrolled8xhJob_t536B1D94D0877A3DB989F51DE54CBF2CAB604581 ___jobData0, int32_t ___arrayLength1, int32_t ___innerloopBatchCount2, JobHandle_t8AEB8D31C25D7774C71D62B0C662525E6E36D847 ___dependsOn3, const RuntimeMethod* method);
// System.Type System.Object::GetType()
IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR Type_t * Object_GetType_m571FE8360C10B98C23AAF1F066D92C08CC94F45B (RuntimeObject * __this, const RuntimeMethod* method);
// System.String System.String::Format(System.String,System.Object,System.Object)
IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR String_t* String_Format_m8D1CB0410C35E052A53AE957C914C841E54BAB66 (String_t* ___format0, RuntimeObject * ___arg01, RuntimeObject * ___arg12, const RuntimeMethod* method);
// System.Void Unity.Barracuda.D::Log(System.Object)
IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR void D_Log_m64BC80E5092B2C26B56D330052D1F5D25065E3DB (RuntimeObject * ___message0, const RuntimeMethod* method);
// Unity.Jobs.JobHandle Unity.Barracuda.BurstBLAS::ScheduleSGEMM(Unity.Jobs.JobHandle,System.Single*,System.Int32,System.Int32,System.Single*,System.Int32,System.Int32,System.Single*,System.Int32,System.Int32,System.Int32,System.Boolean,System.Boolean)
IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR JobHandle_t8AEB8D31C25D7774C71D62B0C662525E6E36D847 BurstBLAS_ScheduleSGEMM_m9B77247DAACA6D740DBAAE4C856C054CEEA4EC20 (BurstBLAS_t4E752AF6B1BBD5757AC2C1392B987F153286E624 * __this, JobHandle_t8AEB8D31C25D7774C71D62B0C662525E6E36D847 ___dependsOn0, float* ___Ap1, int32_t ___AN2, int32_t ___AM3, float* ___Bp4, int32_t ___BN5, int32_t ___BM6, float* ___Cp7, int32_t ___CN8, int32_t ___CM9, int32_t ___bs10, bool ___transposeA11, bool ___transposeB12, const RuntimeMethod* method);
// System.Void Unity.Jobs.JobHandle::Complete()
IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR void JobHandle_Complete_m947DF01E0F87C3B0A24AECEBF72D245A6CDBE148 (JobHandle_t8AEB8D31C25D7774C71D62B0C662525E6E36D847 * __this, const RuntimeMethod* method);
// Unity.Jobs.JobHandle Unity.Jobs.IJobParallelForExtensions::Schedule<Unity.Barracuda.UnsafeMatrixBlockMultiplyUnrolled8xhJob>(!!0,System.Int32,System.Int32,Unity.Jobs.JobHandle)
inline JobHandle_t8AEB8D31C25D7774C71D62B0C662525E6E36D847 IJobParallelForExtensions_Schedule_TisUnsafeMatrixBlockMultiplyUnrolled8xhJob_t536B1D94D0877A3DB989F51DE54CBF2CAB604581_m17E6280AA7C16FF5276847AC9AD27097C0BF3FB3 (UnsafeMatrixBlockMultiplyUnrolled8xhJob_t536B1D94D0877A3DB989F51DE54CBF2CAB604581 ___jobData0, int32_t ___arrayLength1, int32_t ___innerloopBatchCount2, JobHandle_t8AEB8D31C25D7774C71D62B0C662525E6E36D847 ___dependsOn3, const RuntimeMethod* method)
{
return (( JobHandle_t8AEB8D31C25D7774C71D62B0C662525E6E36D847 (*) (UnsafeMatrixBlockMultiplyUnrolled8xhJob_t536B1D94D0877A3DB989F51DE54CBF2CAB604581 , int32_t, int32_t, JobHandle_t8AEB8D31C25D7774C71D62B0C662525E6E36D847 , const RuntimeMethod*))IJobParallelForExtensions_Schedule_TisUnsafeMatrixBlockMultiplyUnrolled8xhJob_t536B1D94D0877A3DB989F51DE54CBF2CAB604581_m17E6280AA7C16FF5276847AC9AD27097C0BF3FB3_gshared)(___jobData0, ___arrayLength1, ___innerloopBatchCount2, ___dependsOn3, method);
}
// System.Void System.Object::.ctor()
IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR void Object__ctor_m88880E0413421D13FD95325EDCE231707CE1F405 (RuntimeObject * __this, const RuntimeMethod* method);
// System.Void* Unity.Collections.LowLevel.Unsafe.UnsafeUtility::Malloc(System.Int64,System.Int32,Unity.Collections.Allocator)
IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR void* UnsafeUtility_Malloc_m18FCC67A056C48A4E0F939D08C43F9E876CA1CF6 (int64_t ___size0, int32_t ___alignment1, int32_t ___allocator2, const RuntimeMethod* method);
// System.Void Unity.Barracuda.UnsafeMatrixBlockMultiplyUnrolled8xhJob::ExecutOverRowA(System.Single*,System.Single*,System.Single*,System.Int32)
IL2CPP_EXTERN_C IL2CPP_NO_INLINE IL2CPP_METHOD_ATTR void UnsafeMatrixBlockMultiplyUnrolled8xhJob_ExecutOverRowA_mA8AB95D6192218ECA0AF0646D115FC61F6BD3CEF (UnsafeMatrixBlockMultiplyUnrolled8xhJob_t536B1D94D0877A3DB989F51DE54CBF2CAB604581 * IL2CPP_PARAMETER_RESTRICT __this, float* ___blockA0, float* ___blockB1, float* ___blockC2, int32_t ___rowA3, const RuntimeMethod* method);
// System.Void Unity.Barracuda.UnsafeMatrixBlockMultiplyUnrolled8xhJob::ExecutOverColB(System.Single*,System.Single*,System.Single*,System.Int32)
IL2CPP_EXTERN_C IL2CPP_NO_INLINE IL2CPP_METHOD_ATTR void UnsafeMatrixBlockMultiplyUnrolled8xhJob_ExecutOverColB_m4DF89FDC30D530D561933C66707246F490506372 (UnsafeMatrixBlockMultiplyUnrolled8xhJob_t536B1D94D0877A3DB989F51DE54CBF2CAB604581 * IL2CPP_PARAMETER_RESTRICT __this, float* ___blockA0, float* ___blockB1, float* ___blockC2, int32_t ___colB3, const RuntimeMethod* method);
// System.Void Unity.Collections.LowLevel.Unsafe.UnsafeUtility::Free(System.Void*,Unity.Collections.Allocator)
IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR void UnsafeUtility_Free_mA805168FF1B6728E7DF3AD1DE47400B37F3441F9 (void* ___memory0, int32_t ___allocator1, const RuntimeMethod* method);
// System.Void Unity.Barracuda.UnsafeMatrixBlockMultiplyUnrolled8xhJob::Execute(System.Int32)
IL2CPP_EXTERN_C IL2CPP_NO_INLINE IL2CPP_METHOD_ATTR void UnsafeMatrixBlockMultiplyUnrolled8xhJob_Execute_m756AA12242AFBC35BA54277172DFC5D3B4CDC27F (UnsafeMatrixBlockMultiplyUnrolled8xhJob_t536B1D94D0877A3DB989F51DE54CBF2CAB604581 * IL2CPP_PARAMETER_RESTRICT __this, int32_t ___n0, const RuntimeMethod* method);
// System.Void Unity.Barracuda.MatrixUtils::CopyBlockWithPadding(System.Single*,System.Int32,System.Int32,System.Int32,System.Int32,System.Single*,System.Int32,System.Boolean)
IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR void MatrixUtils_CopyBlockWithPadding_mBBE6470B0259534E94F862B3C87D91378CB709BF (float* ___matrixIn0, int32_t ___row1, int32_t ___N2, int32_t ___col3, int32_t ___M4, float* ___blockOut5, int32_t ___bs6, bool ___transpose7, const RuntimeMethod* method);
// System.Void Unity.Barracuda.MatrixUtils::MultiplyBlockUnroll8xhPadded(System.Single*,System.Single*,System.Single*,System.Int32)
IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR void MatrixUtils_MultiplyBlockUnroll8xhPadded_m969EB4498AE893CBC23CE4E7E22CF4DE90E018C8 (float* ___Ap0, float* ___Bp1, float* ___Cp2, int32_t ___bs3, const RuntimeMethod* method);
// System.Void Unity.Barracuda.MatrixUtils::CopyBlockWithPadding(System.Single*,System.Single*,System.Int32,System.Int32,System.Int32,System.Int32,System.Int32)
IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR void MatrixUtils_CopyBlockWithPadding_mCDBD49AD6B82C8059605864EC1B6518D4812857D (float* ___blockOut0, float* ___matrixIn1, int32_t ___row2, int32_t ___N3, int32_t ___col4, int32_t ___M5, int32_t ___bs6, const RuntimeMethod* method);
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// System.Boolean Unity.Barracuda.BurstBLAS::IsNative()
IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR bool BurstBLAS_IsNative_m77585B97BB890CB54DB68EB2F18F06F777546B1B (BurstBLAS_t4E752AF6B1BBD5757AC2C1392B987F153286E624 * __this, const RuntimeMethod* method)
{
{
// return false; // not a native fast BLAS implementation
return (bool)0;
}
}
// System.Boolean Unity.Barracuda.BurstBLAS::IsCurrentPlatformSupported()
IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR bool BurstBLAS_IsCurrentPlatformSupported_m3ED8F95B69E7C69EB66807DA08612A0F51463682 (BurstBLAS_t4E752AF6B1BBD5757AC2C1392B987F153286E624 * __this, const RuntimeMethod* method)
{
Exception_t * V_0 = NULL;
bool V_1 = false;
il2cpp::utils::ExceptionSupportStack<RuntimeObject*, 1> __active_exceptions;
il2cpp::utils::ExceptionSupportStack<int32_t, 2> __leave_targets;
IL_0000:
try
{ // begin try (depth: 1)
// }
goto IL_001d;
} // end try (depth: 1)
catch(Il2CppExceptionWrapper& e)
{
if(il2cpp_codegen_class_is_assignable_from (((RuntimeClass*)il2cpp_codegen_initialize_runtime_metadata_inline((uintptr_t*)&Exception_t_il2cpp_TypeInfo_var)), il2cpp_codegen_object_class(e.ex)))
{
IL2CPP_PUSH_ACTIVE_EXCEPTION(e.ex);
goto CATCH_0002;
}
throw e;
}
CATCH_0002:
{ // begin catch(System.Exception)
// catch (Exception e)
V_0 = ((Exception_t *)IL2CPP_GET_ACTIVE_EXCEPTION(Exception_t *));
// D.Log($"C# Job system not found. Disabling {this.GetType()}. Error: {e}");
Type_t * L_0;
L_0 = Object_GetType_m571FE8360C10B98C23AAF1F066D92C08CC94F45B(__this, /*hidden argument*/NULL);
Exception_t * L_1 = V_0;
String_t* L_2;
L_2 = String_Format_m8D1CB0410C35E052A53AE957C914C841E54BAB66(((String_t*)il2cpp_codegen_initialize_runtime_metadata_inline((uintptr_t*)&_stringLiteral8DCC3AF6F2D842D9485DCB78474DB5CA4BB24D28)), L_0, L_1, /*hidden argument*/NULL);
IL2CPP_RUNTIME_CLASS_INIT(((RuntimeClass*)il2cpp_codegen_initialize_runtime_metadata_inline((uintptr_t*)&D_t6A7435A1D213B72E31404960E745E561853F4C90_il2cpp_TypeInfo_var)));
D_Log_m64BC80E5092B2C26B56D330052D1F5D25065E3DB(L_2, /*hidden argument*/NULL);
// return false;
V_1 = (bool)0;
IL2CPP_POP_ACTIVE_EXCEPTION();
goto IL_001f;
} // end catch (depth: 1)
IL_001d:
{
// return true;
return (bool)1;
}
IL_001f:
{
// }
bool L_3 = V_1;
return L_3;
}
}
// System.Void Unity.Barracuda.BurstBLAS::SGEMM(System.Single*,System.Int32,System.Int32,System.Single*,System.Int32,System.Int32,System.Single*,System.Int32,System.Int32,System.Int32,System.Boolean,System.Boolean)
IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR void BurstBLAS_SGEMM_mA5159A52C4AA70D7D9CACDBCC940318C04031745 (BurstBLAS_t4E752AF6B1BBD5757AC2C1392B987F153286E624 * __this, float* ___Ap0, int32_t ___AN1, int32_t ___AM2, float* ___Bp3, int32_t ___BN4, int32_t ___BM5, float* ___Cp6, int32_t ___CN7, int32_t ___CM8, int32_t ___bs9, bool ___transposeA10, bool ___transposeB11, const RuntimeMethod* method)
{
JobHandle_t8AEB8D31C25D7774C71D62B0C662525E6E36D847 V_0;
memset((&V_0), 0, sizeof(V_0));
JobHandle_t8AEB8D31C25D7774C71D62B0C662525E6E36D847 V_1;
memset((&V_1), 0, sizeof(V_1));
{
// var noDependencies = new JobHandle();
il2cpp_codegen_initobj((&V_0), sizeof(JobHandle_t8AEB8D31C25D7774C71D62B0C662525E6E36D847 ));
// var fence = ScheduleSGEMM(noDependencies, Ap, AN, AM, Bp, BN, BM, Cp, CN, CM, bs, transposeA, transposeB);
JobHandle_t8AEB8D31C25D7774C71D62B0C662525E6E36D847 L_0 = V_0;
float* L_1 = ___Ap0;
int32_t L_2 = ___AN1;
int32_t L_3 = ___AM2;
float* L_4 = ___Bp3;
int32_t L_5 = ___BN4;
int32_t L_6 = ___BM5;
float* L_7 = ___Cp6;
int32_t L_8 = ___CN7;
int32_t L_9 = ___CM8;
int32_t L_10 = ___bs9;
bool L_11 = ___transposeA10;
bool L_12 = ___transposeB11;
JobHandle_t8AEB8D31C25D7774C71D62B0C662525E6E36D847 L_13;
L_13 = BurstBLAS_ScheduleSGEMM_m9B77247DAACA6D740DBAAE4C856C054CEEA4EC20(__this, L_0, (float*)(float*)L_1, L_2, L_3, (float*)(float*)L_4, L_5, L_6, (float*)(float*)L_7, L_8, L_9, L_10, L_11, L_12, /*hidden argument*/NULL);
V_1 = L_13;
// fence.Complete();
JobHandle_Complete_m947DF01E0F87C3B0A24AECEBF72D245A6CDBE148((JobHandle_t8AEB8D31C25D7774C71D62B0C662525E6E36D847 *)(&V_1), /*hidden argument*/NULL);
// }
return;
}
}
// Unity.Jobs.JobHandle Unity.Barracuda.BurstBLAS::ScheduleSGEMM(Unity.Jobs.JobHandle,System.Single*,System.Int32,System.Int32,System.Single*,System.Int32,System.Int32,System.Single*,System.Int32,System.Int32,System.Int32,System.Boolean,System.Boolean)
IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR JobHandle_t8AEB8D31C25D7774C71D62B0C662525E6E36D847 BurstBLAS_ScheduleSGEMM_m9B77247DAACA6D740DBAAE4C856C054CEEA4EC20 (BurstBLAS_t4E752AF6B1BBD5757AC2C1392B987F153286E624 * __this, JobHandle_t8AEB8D31C25D7774C71D62B0C662525E6E36D847 ___dependsOn0, float* ___Ap1, int32_t ___AN2, int32_t ___AM3, float* ___Bp4, int32_t ___BN5, int32_t ___BM6, float* ___Cp7, int32_t ___CN8, int32_t ___CM9, int32_t ___bs10, bool ___transposeA11, bool ___transposeB12, const RuntimeMethod* method)
{
static bool s_Il2CppMethodInitialized;
if (!s_Il2CppMethodInitialized)
{
il2cpp_codegen_initialize_runtime_metadata((uintptr_t*)&IJobParallelForExtensions_Schedule_TisUnsafeMatrixBlockMultiplyUnrolled8xhJob_t536B1D94D0877A3DB989F51DE54CBF2CAB604581_m17E6280AA7C16FF5276847AC9AD27097C0BF3FB3_RuntimeMethod_var);
s_Il2CppMethodInitialized = true;
}
UnsafeMatrixBlockMultiplyUnrolled8xhJob_t536B1D94D0877A3DB989F51DE54CBF2CAB604581 V_0;
memset((&V_0), 0, sizeof(V_0));
int32_t G_B7_0 = 0;
UnsafeMatrixBlockMultiplyUnrolled8xhJob_t536B1D94D0877A3DB989F51DE54CBF2CAB604581 G_B7_1;
memset((&G_B7_1), 0, sizeof(G_B7_1));
int32_t G_B6_0 = 0;
UnsafeMatrixBlockMultiplyUnrolled8xhJob_t536B1D94D0877A3DB989F51DE54CBF2CAB604581 G_B6_1;
memset((&G_B6_1), 0, sizeof(G_B6_1));
int32_t G_B8_0 = 0;
int32_t G_B8_1 = 0;
UnsafeMatrixBlockMultiplyUnrolled8xhJob_t536B1D94D0877A3DB989F51DE54CBF2CAB604581 G_B8_2;
memset((&G_B8_2), 0, sizeof(G_B8_2));
int32_t G_B11_0 = 0;
UnsafeMatrixBlockMultiplyUnrolled8xhJob_t536B1D94D0877A3DB989F51DE54CBF2CAB604581 G_B11_1;
memset((&G_B11_1), 0, sizeof(G_B11_1));
int32_t G_B10_0 = 0;
UnsafeMatrixBlockMultiplyUnrolled8xhJob_t536B1D94D0877A3DB989F51DE54CBF2CAB604581 G_B10_1;
memset((&G_B10_1), 0, sizeof(G_B10_1));
int32_t G_B12_0 = 0;
int32_t G_B12_1 = 0;
UnsafeMatrixBlockMultiplyUnrolled8xhJob_t536B1D94D0877A3DB989F51DE54CBF2CAB604581 G_B12_2;
memset((&G_B12_2), 0, sizeof(G_B12_2));
{
// if (transposeA)
bool L_0 = ___transposeA11;
if (!L_0)
{
goto IL_000b;
}
}
{
// var tmp = AN;
int32_t L_1 = ___AN2;
// AN = AM;
int32_t L_2 = ___AM3;
___AN2 = L_2;
// AM = tmp;
___AM3 = L_1;
}
IL_000b:
{
// if (transposeB)
bool L_3 = ___transposeB12;
if (!L_3)
{
goto IL_0017;
}
}
{
// var tmp = BN;
int32_t L_4 = ___BN5;
// BN = BM;
int32_t L_5 = ___BM6;
___BN5 = L_5;
// BM = tmp;
___BM6 = L_4;
}
IL_0017:
{
// UnsafeMatrixBlockMultiplyUnrolled8xhJob job = new UnsafeMatrixBlockMultiplyUnrolled8xhJob();
il2cpp_codegen_initobj((&V_0), sizeof(UnsafeMatrixBlockMultiplyUnrolled8xhJob_t536B1D94D0877A3DB989F51DE54CBF2CAB604581 ));
// job.A = Ap;
float* L_6 = ___Ap1;
(&V_0)->set_A_0((float*)L_6);
// job.AN = AN;
int32_t L_7 = ___AN2;
(&V_0)->set_AN_1(L_7);
// job.AM = AM;
int32_t L_8 = ___AM3;
(&V_0)->set_AM_2(L_8);
// job.B = Bp;
float* L_9 = ___Bp4;
(&V_0)->set_B_3((float*)L_9);
// job.BN = BN;
int32_t L_10 = ___BN5;
(&V_0)->set_BN_4(L_10);
// job.BM = BM;
int32_t L_11 = ___BM6;
(&V_0)->set_BM_5(L_11);
// job.C = Cp;
float* L_12 = ___Cp7;
(&V_0)->set_C_6((float*)L_12);
// job.CN = CN;
int32_t L_13 = ___CN8;
(&V_0)->set_CN_7(L_13);
// job.CM = CM;
int32_t L_14 = ___CM9;
(&V_0)->set_CM_8(L_14);
// job.bs = bs;
int32_t L_15 = ___bs10;
(&V_0)->set_bs_9(L_15);
// job.transposeA = transposeA;
bool L_16 = ___transposeA11;
(&V_0)->set_transposeA_11(L_16);
// job.transposeB = transposeB;
bool L_17 = ___transposeB12;
(&V_0)->set_transposeB_12(L_17);
// if (AN < BM)
int32_t L_18 = ___AN2;
int32_t L_19 = ___BM6;
if ((((int32_t)L_18) >= ((int32_t)L_19)))
{
goto IL_00b1;
}
}
{
// job.scheduleRowA = false;
(&V_0)->set_scheduleRowA_10((bool)0);
// return job.Schedule((BM / bs) + (BM % bs > 0 ? 1 : 0), 1, dependsOn);
UnsafeMatrixBlockMultiplyUnrolled8xhJob_t536B1D94D0877A3DB989F51DE54CBF2CAB604581 L_20 = V_0;
int32_t L_21 = ___BM6;
int32_t L_22 = ___bs10;
int32_t L_23 = ___BM6;
int32_t L_24 = ___bs10;
G_B6_0 = ((int32_t)((int32_t)L_21/(int32_t)L_22));
G_B6_1 = L_20;
if ((((int32_t)((int32_t)((int32_t)L_23%(int32_t)L_24))) > ((int32_t)0)))
{
G_B7_0 = ((int32_t)((int32_t)L_21/(int32_t)L_22));
G_B7_1 = L_20;
goto IL_00a7;
}
}
{
G_B8_0 = 0;
G_B8_1 = G_B6_0;
G_B8_2 = G_B6_1;
goto IL_00a8;
}
IL_00a7:
{
G_B8_0 = 1;
G_B8_1 = G_B7_0;
G_B8_2 = G_B7_1;
}
IL_00a8:
{
JobHandle_t8AEB8D31C25D7774C71D62B0C662525E6E36D847 L_25 = ___dependsOn0;
JobHandle_t8AEB8D31C25D7774C71D62B0C662525E6E36D847 L_26;
L_26 = IJobParallelForExtensions_Schedule_TisUnsafeMatrixBlockMultiplyUnrolled8xhJob_t536B1D94D0877A3DB989F51DE54CBF2CAB604581_m17E6280AA7C16FF5276847AC9AD27097C0BF3FB3(G_B8_2, ((int32_t)il2cpp_codegen_add((int32_t)G_B8_1, (int32_t)G_B8_0)), 1, L_25, /*hidden argument*/IJobParallelForExtensions_Schedule_TisUnsafeMatrixBlockMultiplyUnrolled8xhJob_t536B1D94D0877A3DB989F51DE54CBF2CAB604581_m17E6280AA7C16FF5276847AC9AD27097C0BF3FB3_RuntimeMethod_var);
return L_26;
}
IL_00b1:
{
// job.scheduleRowA = true;
(&V_0)->set_scheduleRowA_10((bool)1);
// return job.Schedule((AN / bs) + (AN % bs > 0 ? 1 : 0), 1, dependsOn);
UnsafeMatrixBlockMultiplyUnrolled8xhJob_t536B1D94D0877A3DB989F51DE54CBF2CAB604581 L_27 = V_0;
int32_t L_28 = ___AN2;
int32_t L_29 = ___bs10;
int32_t L_30 = ___AN2;
int32_t L_31 = ___bs10;
G_B10_0 = ((int32_t)((int32_t)L_28/(int32_t)L_29));
G_B10_1 = L_27;
if ((((int32_t)((int32_t)((int32_t)L_30%(int32_t)L_31))) > ((int32_t)0)))
{
G_B11_0 = ((int32_t)((int32_t)L_28/(int32_t)L_29));
G_B11_1 = L_27;
goto IL_00c8;
}
}
{
G_B12_0 = 0;
G_B12_1 = G_B10_0;
G_B12_2 = G_B10_1;
goto IL_00c9;
}
IL_00c8:
{
G_B12_0 = 1;
G_B12_1 = G_B11_0;
G_B12_2 = G_B11_1;
}
IL_00c9:
{
JobHandle_t8AEB8D31C25D7774C71D62B0C662525E6E36D847 L_32 = ___dependsOn0;
JobHandle_t8AEB8D31C25D7774C71D62B0C662525E6E36D847 L_33;
L_33 = IJobParallelForExtensions_Schedule_TisUnsafeMatrixBlockMultiplyUnrolled8xhJob_t536B1D94D0877A3DB989F51DE54CBF2CAB604581_m17E6280AA7C16FF5276847AC9AD27097C0BF3FB3(G_B12_2, ((int32_t)il2cpp_codegen_add((int32_t)G_B12_1, (int32_t)G_B12_0)), 1, L_32, /*hidden argument*/IJobParallelForExtensions_Schedule_TisUnsafeMatrixBlockMultiplyUnrolled8xhJob_t536B1D94D0877A3DB989F51DE54CBF2CAB604581_m17E6280AA7C16FF5276847AC9AD27097C0BF3FB3_RuntimeMethod_var);
return L_33;
}
}
// System.Void Unity.Barracuda.BurstBLAS::.ctor()
IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR void BurstBLAS__ctor_m4C793DE6A3B23E1EBF7FF90D2D4F9E576946C3D5 (BurstBLAS_t4E752AF6B1BBD5757AC2C1392B987F153286E624 * __this, const RuntimeMethod* method)
{
{
Object__ctor_m88880E0413421D13FD95325EDCE231707CE1F405(__this, /*hidden argument*/NULL);
return;
}
}
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// Conversion methods for marshalling of: Unity.Barracuda.UnsafeMatrixBlockMultiplyUnrolled8xhJob
IL2CPP_EXTERN_C void UnsafeMatrixBlockMultiplyUnrolled8xhJob_t536B1D94D0877A3DB989F51DE54CBF2CAB604581_marshal_pinvoke(const UnsafeMatrixBlockMultiplyUnrolled8xhJob_t536B1D94D0877A3DB989F51DE54CBF2CAB604581& unmarshaled, UnsafeMatrixBlockMultiplyUnrolled8xhJob_t536B1D94D0877A3DB989F51DE54CBF2CAB604581_marshaled_pinvoke& marshaled)
{
marshaled.___A_0 = unmarshaled.get_A_0();
marshaled.___AN_1 = unmarshaled.get_AN_1();
marshaled.___AM_2 = unmarshaled.get_AM_2();
marshaled.___B_3 = unmarshaled.get_B_3();
marshaled.___BN_4 = unmarshaled.get_BN_4();
marshaled.___BM_5 = unmarshaled.get_BM_5();
marshaled.___C_6 = unmarshaled.get_C_6();
marshaled.___CN_7 = unmarshaled.get_CN_7();
marshaled.___CM_8 = unmarshaled.get_CM_8();
marshaled.___bs_9 = unmarshaled.get_bs_9();
marshaled.___scheduleRowA_10 = static_cast<int32_t>(unmarshaled.get_scheduleRowA_10());
marshaled.___transposeA_11 = static_cast<int32_t>(unmarshaled.get_transposeA_11());
marshaled.___transposeB_12 = static_cast<int32_t>(unmarshaled.get_transposeB_12());
}
IL2CPP_EXTERN_C void UnsafeMatrixBlockMultiplyUnrolled8xhJob_t536B1D94D0877A3DB989F51DE54CBF2CAB604581_marshal_pinvoke_back(const UnsafeMatrixBlockMultiplyUnrolled8xhJob_t536B1D94D0877A3DB989F51DE54CBF2CAB604581_marshaled_pinvoke& marshaled, UnsafeMatrixBlockMultiplyUnrolled8xhJob_t536B1D94D0877A3DB989F51DE54CBF2CAB604581& unmarshaled)
{
unmarshaled.set_A_0(marshaled.___A_0);
int32_t unmarshaled_AN_temp_1 = 0;
unmarshaled_AN_temp_1 = marshaled.___AN_1;
unmarshaled.set_AN_1(unmarshaled_AN_temp_1);
int32_t unmarshaled_AM_temp_2 = 0;
unmarshaled_AM_temp_2 = marshaled.___AM_2;
unmarshaled.set_AM_2(unmarshaled_AM_temp_2);
unmarshaled.set_B_3(marshaled.___B_3);
int32_t unmarshaled_BN_temp_4 = 0;
unmarshaled_BN_temp_4 = marshaled.___BN_4;
unmarshaled.set_BN_4(unmarshaled_BN_temp_4);
int32_t unmarshaled_BM_temp_5 = 0;
unmarshaled_BM_temp_5 = marshaled.___BM_5;
unmarshaled.set_BM_5(unmarshaled_BM_temp_5);
unmarshaled.set_C_6(marshaled.___C_6);
int32_t unmarshaled_CN_temp_7 = 0;
unmarshaled_CN_temp_7 = marshaled.___CN_7;
unmarshaled.set_CN_7(unmarshaled_CN_temp_7);
int32_t unmarshaled_CM_temp_8 = 0;
unmarshaled_CM_temp_8 = marshaled.___CM_8;
unmarshaled.set_CM_8(unmarshaled_CM_temp_8);
int32_t unmarshaled_bs_temp_9 = 0;
unmarshaled_bs_temp_9 = marshaled.___bs_9;
unmarshaled.set_bs_9(unmarshaled_bs_temp_9);
bool unmarshaled_scheduleRowA_temp_10 = false;
unmarshaled_scheduleRowA_temp_10 = static_cast<bool>(marshaled.___scheduleRowA_10);
unmarshaled.set_scheduleRowA_10(unmarshaled_scheduleRowA_temp_10);
bool unmarshaled_transposeA_temp_11 = false;
unmarshaled_transposeA_temp_11 = static_cast<bool>(marshaled.___transposeA_11);
unmarshaled.set_transposeA_11(unmarshaled_transposeA_temp_11);
bool unmarshaled_transposeB_temp_12 = false;
unmarshaled_transposeB_temp_12 = static_cast<bool>(marshaled.___transposeB_12);
unmarshaled.set_transposeB_12(unmarshaled_transposeB_temp_12);
}
// Conversion method for clean up from marshalling of: Unity.Barracuda.UnsafeMatrixBlockMultiplyUnrolled8xhJob
IL2CPP_EXTERN_C void UnsafeMatrixBlockMultiplyUnrolled8xhJob_t536B1D94D0877A3DB989F51DE54CBF2CAB604581_marshal_pinvoke_cleanup(UnsafeMatrixBlockMultiplyUnrolled8xhJob_t536B1D94D0877A3DB989F51DE54CBF2CAB604581_marshaled_pinvoke& marshaled)
{
}
// Conversion methods for marshalling of: Unity.Barracuda.UnsafeMatrixBlockMultiplyUnrolled8xhJob
IL2CPP_EXTERN_C void UnsafeMatrixBlockMultiplyUnrolled8xhJob_t536B1D94D0877A3DB989F51DE54CBF2CAB604581_marshal_com(const UnsafeMatrixBlockMultiplyUnrolled8xhJob_t536B1D94D0877A3DB989F51DE54CBF2CAB604581& unmarshaled, UnsafeMatrixBlockMultiplyUnrolled8xhJob_t536B1D94D0877A3DB989F51DE54CBF2CAB604581_marshaled_com& marshaled)
{
marshaled.___A_0 = unmarshaled.get_A_0();
marshaled.___AN_1 = unmarshaled.get_AN_1();
marshaled.___AM_2 = unmarshaled.get_AM_2();
marshaled.___B_3 = unmarshaled.get_B_3();
marshaled.___BN_4 = unmarshaled.get_BN_4();
marshaled.___BM_5 = unmarshaled.get_BM_5();
marshaled.___C_6 = unmarshaled.get_C_6();
marshaled.___CN_7 = unmarshaled.get_CN_7();
marshaled.___CM_8 = unmarshaled.get_CM_8();
marshaled.___bs_9 = unmarshaled.get_bs_9();
marshaled.___scheduleRowA_10 = static_cast<int32_t>(unmarshaled.get_scheduleRowA_10());
marshaled.___transposeA_11 = static_cast<int32_t>(unmarshaled.get_transposeA_11());
marshaled.___transposeB_12 = static_cast<int32_t>(unmarshaled.get_transposeB_12());
}
IL2CPP_EXTERN_C void UnsafeMatrixBlockMultiplyUnrolled8xhJob_t536B1D94D0877A3DB989F51DE54CBF2CAB604581_marshal_com_back(const UnsafeMatrixBlockMultiplyUnrolled8xhJob_t536B1D94D0877A3DB989F51DE54CBF2CAB604581_marshaled_com& marshaled, UnsafeMatrixBlockMultiplyUnrolled8xhJob_t536B1D94D0877A3DB989F51DE54CBF2CAB604581& unmarshaled)
{
unmarshaled.set_A_0(marshaled.___A_0);
int32_t unmarshaled_AN_temp_1 = 0;
unmarshaled_AN_temp_1 = marshaled.___AN_1;
unmarshaled.set_AN_1(unmarshaled_AN_temp_1);
int32_t unmarshaled_AM_temp_2 = 0;
unmarshaled_AM_temp_2 = marshaled.___AM_2;
unmarshaled.set_AM_2(unmarshaled_AM_temp_2);
unmarshaled.set_B_3(marshaled.___B_3);
int32_t unmarshaled_BN_temp_4 = 0;
unmarshaled_BN_temp_4 = marshaled.___BN_4;
unmarshaled.set_BN_4(unmarshaled_BN_temp_4);
int32_t unmarshaled_BM_temp_5 = 0;
unmarshaled_BM_temp_5 = marshaled.___BM_5;
unmarshaled.set_BM_5(unmarshaled_BM_temp_5);
unmarshaled.set_C_6(marshaled.___C_6);
int32_t unmarshaled_CN_temp_7 = 0;
unmarshaled_CN_temp_7 = marshaled.___CN_7;
unmarshaled.set_CN_7(unmarshaled_CN_temp_7);
int32_t unmarshaled_CM_temp_8 = 0;
unmarshaled_CM_temp_8 = marshaled.___CM_8;
unmarshaled.set_CM_8(unmarshaled_CM_temp_8);
int32_t unmarshaled_bs_temp_9 = 0;
unmarshaled_bs_temp_9 = marshaled.___bs_9;
unmarshaled.set_bs_9(unmarshaled_bs_temp_9);
bool unmarshaled_scheduleRowA_temp_10 = false;
unmarshaled_scheduleRowA_temp_10 = static_cast<bool>(marshaled.___scheduleRowA_10);
unmarshaled.set_scheduleRowA_10(unmarshaled_scheduleRowA_temp_10);
bool unmarshaled_transposeA_temp_11 = false;
unmarshaled_transposeA_temp_11 = static_cast<bool>(marshaled.___transposeA_11);
unmarshaled.set_transposeA_11(unmarshaled_transposeA_temp_11);
bool unmarshaled_transposeB_temp_12 = false;
unmarshaled_transposeB_temp_12 = static_cast<bool>(marshaled.___transposeB_12);
unmarshaled.set_transposeB_12(unmarshaled_transposeB_temp_12);
}
// Conversion method for clean up from marshalling of: Unity.Barracuda.UnsafeMatrixBlockMultiplyUnrolled8xhJob
IL2CPP_EXTERN_C void UnsafeMatrixBlockMultiplyUnrolled8xhJob_t536B1D94D0877A3DB989F51DE54CBF2CAB604581_marshal_com_cleanup(UnsafeMatrixBlockMultiplyUnrolled8xhJob_t536B1D94D0877A3DB989F51DE54CBF2CAB604581_marshaled_com& marshaled)
{
}
// System.Void Unity.Barracuda.UnsafeMatrixBlockMultiplyUnrolled8xhJob::Execute(System.Int32)
IL2CPP_EXTERN_C IL2CPP_NO_INLINE IL2CPP_METHOD_ATTR void UnsafeMatrixBlockMultiplyUnrolled8xhJob_Execute_m756AA12242AFBC35BA54277172DFC5D3B4CDC27F (UnsafeMatrixBlockMultiplyUnrolled8xhJob_t536B1D94D0877A3DB989F51DE54CBF2CAB604581 * IL2CPP_PARAMETER_RESTRICT __this, int32_t ___n0, const RuntimeMethod* method)
{
float* V_0 = NULL;
float* V_1 = NULL;
float* V_2 = NULL;
{
// int sz = bs * bs * 4;
int32_t L_0 = __this->get_bs_9();
int32_t L_1 = __this->get_bs_9();
// float* blockA = (float*) UnsafeUtility.Malloc(sz, 4, Allocator.TempJob);
int32_t L_2 = ((int32_t)il2cpp_codegen_multiply((int32_t)((int32_t)il2cpp_codegen_multiply((int32_t)L_0, (int32_t)L_1)), (int32_t)4));
void* L_3;
L_3 = UnsafeUtility_Malloc_m18FCC67A056C48A4E0F939D08C43F9E876CA1CF6(((int64_t)((int64_t)L_2)), 4, 3, /*hidden argument*/NULL);
V_0 = (float*)L_3;
// float* blockB = (float*) UnsafeUtility.Malloc(sz, 4, Allocator.TempJob);
int32_t L_4 = L_2;
void* L_5;
L_5 = UnsafeUtility_Malloc_m18FCC67A056C48A4E0F939D08C43F9E876CA1CF6(((int64_t)((int64_t)L_4)), 4, 3, /*hidden argument*/NULL);
V_1 = (float*)L_5;
// float* blockC = (float*) UnsafeUtility.Malloc(sz, 4, Allocator.TempJob);
void* L_6;
L_6 = UnsafeUtility_Malloc_m18FCC67A056C48A4E0F939D08C43F9E876CA1CF6(((int64_t)((int64_t)L_4)), 4, 3, /*hidden argument*/NULL);
V_2 = (float*)L_6;
// if (scheduleRowA)
bool L_7 = __this->get_scheduleRowA_10();
if (!L_7)
{
goto IL_0047;
}
}
{
// ExecutOverRowA(blockA, blockB, blockC, n * bs);
float* L_8 = V_0;
float* L_9 = V_1;
float* L_10 = V_2;
int32_t L_11 = ___n0;
int32_t L_12 = __this->get_bs_9();
UnsafeMatrixBlockMultiplyUnrolled8xhJob_ExecutOverRowA_mA8AB95D6192218ECA0AF0646D115FC61F6BD3CEF((UnsafeMatrixBlockMultiplyUnrolled8xhJob_t536B1D94D0877A3DB989F51DE54CBF2CAB604581 *)__this, (float*)(float*)L_8, (float*)(float*)L_9, (float*)(float*)L_10, ((int32_t)il2cpp_codegen_multiply((int32_t)L_11, (int32_t)L_12)), /*hidden argument*/NULL);
goto IL_0058;
}
IL_0047:
{
// ExecutOverColB(blockA, blockB, blockC, n * bs);
float* L_13 = V_0;
float* L_14 = V_1;
float* L_15 = V_2;
int32_t L_16 = ___n0;
int32_t L_17 = __this->get_bs_9();
UnsafeMatrixBlockMultiplyUnrolled8xhJob_ExecutOverColB_m4DF89FDC30D530D561933C66707246F490506372((UnsafeMatrixBlockMultiplyUnrolled8xhJob_t536B1D94D0877A3DB989F51DE54CBF2CAB604581 *)__this, (float*)(float*)L_13, (float*)(float*)L_14, (float*)(float*)L_15, ((int32_t)il2cpp_codegen_multiply((int32_t)L_16, (int32_t)L_17)), /*hidden argument*/NULL);
}
IL_0058:
{
// UnsafeUtility.Free(blockA, Allocator.TempJob);
float* L_18 = V_0;
UnsafeUtility_Free_mA805168FF1B6728E7DF3AD1DE47400B37F3441F9((void*)(void*)L_18, 3, /*hidden argument*/NULL);
// UnsafeUtility.Free(blockB, Allocator.TempJob);
float* L_19 = V_1;
UnsafeUtility_Free_mA805168FF1B6728E7DF3AD1DE47400B37F3441F9((void*)(void*)L_19, 3, /*hidden argument*/NULL);
// UnsafeUtility.Free(blockC, Allocator.TempJob);
float* L_20 = V_2;
UnsafeUtility_Free_mA805168FF1B6728E7DF3AD1DE47400B37F3441F9((void*)(void*)L_20, 3, /*hidden argument*/NULL);
// }
return;
}
}
IL2CPP_EXTERN_C void UnsafeMatrixBlockMultiplyUnrolled8xhJob_Execute_m756AA12242AFBC35BA54277172DFC5D3B4CDC27F_AdjustorThunk (RuntimeObject * IL2CPP_PARAMETER_RESTRICT __this, int32_t ___n0, const RuntimeMethod* method)
{
int32_t _offset = 1;
UnsafeMatrixBlockMultiplyUnrolled8xhJob_t536B1D94D0877A3DB989F51DE54CBF2CAB604581 * _thisAdjusted = reinterpret_cast<UnsafeMatrixBlockMultiplyUnrolled8xhJob_t536B1D94D0877A3DB989F51DE54CBF2CAB604581 *>(__this + _offset);
UnsafeMatrixBlockMultiplyUnrolled8xhJob_Execute_m756AA12242AFBC35BA54277172DFC5D3B4CDC27F(_thisAdjusted, ___n0, method);
}
// System.Void Unity.Barracuda.UnsafeMatrixBlockMultiplyUnrolled8xhJob::ExecutOverColB(System.Single*,System.Single*,System.Single*,System.Int32)
IL2CPP_EXTERN_C IL2CPP_NO_INLINE IL2CPP_METHOD_ATTR void UnsafeMatrixBlockMultiplyUnrolled8xhJob_ExecutOverColB_m4DF89FDC30D530D561933C66707246F490506372 (UnsafeMatrixBlockMultiplyUnrolled8xhJob_t536B1D94D0877A3DB989F51DE54CBF2CAB604581 * IL2CPP_PARAMETER_RESTRICT __this, float* ___blockA0, float* ___blockB1, float* ___blockC2, int32_t ___colB3, const RuntimeMethod* method)
{
int32_t V_0 = 0;
int32_t V_1 = 0;
{
// for (int rowA = 0; rowA < AN; rowA += bs)
V_0 = 0;
goto IL_00ca;
}
IL_0007:
{
// for (int l = 0; l < AM; l += bs)
V_1 = 0;
goto IL_00b5;
}
IL_000e:
{
// MatrixUtils.CopyBlockWithPadding(A, rowA, AN, l, AM, blockA, bs, transposeA);
float* L_0 = __this->get_A_0();
int32_t L_1 = V_0;
int32_t L_2 = __this->get_AN_1();
int32_t L_3 = V_1;
int32_t L_4 = __this->get_AM_2();
float* L_5 = ___blockA0;
int32_t L_6 = __this->get_bs_9();
bool L_7 = __this->get_transposeA_11();
MatrixUtils_CopyBlockWithPadding_mBBE6470B0259534E94F862B3C87D91378CB709BF((float*)(float*)L_0, L_1, L_2, L_3, L_4, (float*)(float*)L_5, L_6, L_7, /*hidden argument*/NULL);
// MatrixUtils.CopyBlockWithPadding(B, l, BN, colB, BM, blockB, bs, transposeB);
float* L_8 = __this->get_B_3();
int32_t L_9 = V_1;
int32_t L_10 = __this->get_BN_4();
int32_t L_11 = ___colB3;
int32_t L_12 = __this->get_BM_5();
float* L_13 = ___blockB1;
int32_t L_14 = __this->get_bs_9();
bool L_15 = __this->get_transposeB_12();
MatrixUtils_CopyBlockWithPadding_mBBE6470B0259534E94F862B3C87D91378CB709BF((float*)(float*)L_8, L_9, L_10, L_11, L_12, (float*)(float*)L_13, L_14, L_15, /*hidden argument*/NULL);
// MatrixUtils.CopyBlockWithPadding(C, rowA, CN, colB, CM, blockC, bs);
float* L_16 = __this->get_C_6();
int32_t L_17 = V_0;
int32_t L_18 = __this->get_CN_7();
int32_t L_19 = ___colB3;
int32_t L_20 = __this->get_CM_8();
float* L_21 = ___blockC2;
int32_t L_22 = __this->get_bs_9();
MatrixUtils_CopyBlockWithPadding_mBBE6470B0259534E94F862B3C87D91378CB709BF((float*)(float*)L_16, L_17, L_18, L_19, L_20, (float*)(float*)L_21, L_22, (bool)0, /*hidden argument*/NULL);
// MatrixUtils.MultiplyBlockUnroll8xhPadded(blockA, blockB, blockC, bs);
float* L_23 = ___blockA0;
float* L_24 = ___blockB1;
float* L_25 = ___blockC2;
int32_t L_26 = __this->get_bs_9();
MatrixUtils_MultiplyBlockUnroll8xhPadded_m969EB4498AE893CBC23CE4E7E22CF4DE90E018C8((float*)(float*)L_23, (float*)(float*)L_24, (float*)(float*)L_25, L_26, /*hidden argument*/NULL);
// MatrixUtils.CopyBlockWithPadding(blockC, C, rowA, CN, colB, CM, bs);
float* L_27 = ___blockC2;
float* L_28 = __this->get_C_6();
int32_t L_29 = V_0;
int32_t L_30 = __this->get_CN_7();
int32_t L_31 = ___colB3;
int32_t L_32 = __this->get_CM_8();
int32_t L_33 = __this->get_bs_9();
MatrixUtils_CopyBlockWithPadding_mCDBD49AD6B82C8059605864EC1B6518D4812857D((float*)(float*)L_27, (float*)(float*)L_28, L_29, L_30, L_31, L_32, L_33, /*hidden argument*/NULL);
// for (int l = 0; l < AM; l += bs)
int32_t L_34 = V_1;
int32_t L_35 = __this->get_bs_9();
V_1 = ((int32_t)il2cpp_codegen_add((int32_t)L_34, (int32_t)L_35));
}
IL_00b5:
{
// for (int l = 0; l < AM; l += bs)
int32_t L_36 = V_1;
int32_t L_37 = __this->get_AM_2();
if ((((int32_t)L_36) < ((int32_t)L_37)))
{
goto IL_000e;
}
}
{
// for (int rowA = 0; rowA < AN; rowA += bs)
int32_t L_38 = V_0;
int32_t L_39 = __this->get_bs_9();
V_0 = ((int32_t)il2cpp_codegen_add((int32_t)L_38, (int32_t)L_39));
}
IL_00ca:
{
// for (int rowA = 0; rowA < AN; rowA += bs)
int32_t L_40 = V_0;
int32_t L_41 = __this->get_AN_1();
if ((((int32_t)L_40) < ((int32_t)L_41)))
{
goto IL_0007;
}
}
{
// }
return;
}
}
IL2CPP_EXTERN_C void UnsafeMatrixBlockMultiplyUnrolled8xhJob_ExecutOverColB_m4DF89FDC30D530D561933C66707246F490506372_AdjustorThunk (RuntimeObject * IL2CPP_PARAMETER_RESTRICT __this, float* ___blockA0, float* ___blockB1, float* ___blockC2, int32_t ___colB3, const RuntimeMethod* method)
{
int32_t _offset = 1;
UnsafeMatrixBlockMultiplyUnrolled8xhJob_t536B1D94D0877A3DB989F51DE54CBF2CAB604581 * _thisAdjusted = reinterpret_cast<UnsafeMatrixBlockMultiplyUnrolled8xhJob_t536B1D94D0877A3DB989F51DE54CBF2CAB604581 *>(__this + _offset);
UnsafeMatrixBlockMultiplyUnrolled8xhJob_ExecutOverColB_m4DF89FDC30D530D561933C66707246F490506372(_thisAdjusted, ___blockA0, ___blockB1, ___blockC2, ___colB3, method);
}
// System.Void Unity.Barracuda.UnsafeMatrixBlockMultiplyUnrolled8xhJob::ExecutOverRowA(System.Single*,System.Single*,System.Single*,System.Int32)
IL2CPP_EXTERN_C IL2CPP_NO_INLINE IL2CPP_METHOD_ATTR void UnsafeMatrixBlockMultiplyUnrolled8xhJob_ExecutOverRowA_mA8AB95D6192218ECA0AF0646D115FC61F6BD3CEF (UnsafeMatrixBlockMultiplyUnrolled8xhJob_t536B1D94D0877A3DB989F51DE54CBF2CAB604581 * IL2CPP_PARAMETER_RESTRICT __this, float* ___blockA0, float* ___blockB1, float* ___blockC2, int32_t ___rowA3, const RuntimeMethod* method)
{
int32_t V_0 = 0;
int32_t V_1 = 0;
{
// for (int colB = 0; colB < BM; colB += bs)
V_0 = 0;
goto IL_00ca;
}
IL_0007:
{
// for (int l = 0; l < AM; l += bs)
V_1 = 0;
goto IL_00b5;
}
IL_000e:
{
// MatrixUtils.CopyBlockWithPadding(A, rowA, AN, l, AM, blockA, bs, transposeA);
float* L_0 = __this->get_A_0();
int32_t L_1 = ___rowA3;
int32_t L_2 = __this->get_AN_1();
int32_t L_3 = V_1;
int32_t L_4 = __this->get_AM_2();
float* L_5 = ___blockA0;
int32_t L_6 = __this->get_bs_9();
bool L_7 = __this->get_transposeA_11();
MatrixUtils_CopyBlockWithPadding_mBBE6470B0259534E94F862B3C87D91378CB709BF((float*)(float*)L_0, L_1, L_2, L_3, L_4, (float*)(float*)L_5, L_6, L_7, /*hidden argument*/NULL);
// MatrixUtils.CopyBlockWithPadding(B, l, BN, colB, BM, blockB, bs, transposeB);
float* L_8 = __this->get_B_3();
int32_t L_9 = V_1;
int32_t L_10 = __this->get_BN_4();
int32_t L_11 = V_0;
int32_t L_12 = __this->get_BM_5();
float* L_13 = ___blockB1;
int32_t L_14 = __this->get_bs_9();
bool L_15 = __this->get_transposeB_12();
MatrixUtils_CopyBlockWithPadding_mBBE6470B0259534E94F862B3C87D91378CB709BF((float*)(float*)L_8, L_9, L_10, L_11, L_12, (float*)(float*)L_13, L_14, L_15, /*hidden argument*/NULL);
// MatrixUtils.CopyBlockWithPadding(C, rowA, CN, colB, CM, blockC, bs);
float* L_16 = __this->get_C_6();
int32_t L_17 = ___rowA3;
int32_t L_18 = __this->get_CN_7();
int32_t L_19 = V_0;
int32_t L_20 = __this->get_CM_8();
float* L_21 = ___blockC2;
int32_t L_22 = __this->get_bs_9();
MatrixUtils_CopyBlockWithPadding_mBBE6470B0259534E94F862B3C87D91378CB709BF((float*)(float*)L_16, L_17, L_18, L_19, L_20, (float*)(float*)L_21, L_22, (bool)0, /*hidden argument*/NULL);
// MatrixUtils.MultiplyBlockUnroll8xhPadded(blockA, blockB, blockC, bs);
float* L_23 = ___blockA0;
float* L_24 = ___blockB1;
float* L_25 = ___blockC2;
int32_t L_26 = __this->get_bs_9();
MatrixUtils_MultiplyBlockUnroll8xhPadded_m969EB4498AE893CBC23CE4E7E22CF4DE90E018C8((float*)(float*)L_23, (float*)(float*)L_24, (float*)(float*)L_25, L_26, /*hidden argument*/NULL);
// MatrixUtils.CopyBlockWithPadding(blockC, C, rowA, CN, colB, CM, bs);
float* L_27 = ___blockC2;
float* L_28 = __this->get_C_6();
int32_t L_29 = ___rowA3;
int32_t L_30 = __this->get_CN_7();
int32_t L_31 = V_0;
int32_t L_32 = __this->get_CM_8();
int32_t L_33 = __this->get_bs_9();
MatrixUtils_CopyBlockWithPadding_mCDBD49AD6B82C8059605864EC1B6518D4812857D((float*)(float*)L_27, (float*)(float*)L_28, L_29, L_30, L_31, L_32, L_33, /*hidden argument*/NULL);
// for (int l = 0; l < AM; l += bs)
int32_t L_34 = V_1;
int32_t L_35 = __this->get_bs_9();
V_1 = ((int32_t)il2cpp_codegen_add((int32_t)L_34, (int32_t)L_35));
}
IL_00b5:
{
// for (int l = 0; l < AM; l += bs)
int32_t L_36 = V_1;
int32_t L_37 = __this->get_AM_2();
if ((((int32_t)L_36) < ((int32_t)L_37)))
{
goto IL_000e;
}
}
{
// for (int colB = 0; colB < BM; colB += bs)
int32_t L_38 = V_0;
int32_t L_39 = __this->get_bs_9();
V_0 = ((int32_t)il2cpp_codegen_add((int32_t)L_38, (int32_t)L_39));
}
IL_00ca:
{
// for (int colB = 0; colB < BM; colB += bs)
int32_t L_40 = V_0;
int32_t L_41 = __this->get_BM_5();
if ((((int32_t)L_40) < ((int32_t)L_41)))
{
goto IL_0007;
}
}
{
// }
return;
}
}
IL2CPP_EXTERN_C void UnsafeMatrixBlockMultiplyUnrolled8xhJob_ExecutOverRowA_mA8AB95D6192218ECA0AF0646D115FC61F6BD3CEF_AdjustorThunk (RuntimeObject * IL2CPP_PARAMETER_RESTRICT __this, float* ___blockA0, float* ___blockB1, float* ___blockC2, int32_t ___rowA3, const RuntimeMethod* method)
{
int32_t _offset = 1;
UnsafeMatrixBlockMultiplyUnrolled8xhJob_t536B1D94D0877A3DB989F51DE54CBF2CAB604581 * _thisAdjusted = reinterpret_cast<UnsafeMatrixBlockMultiplyUnrolled8xhJob_t536B1D94D0877A3DB989F51DE54CBF2CAB604581 *>(__this + _offset);
UnsafeMatrixBlockMultiplyUnrolled8xhJob_ExecutOverRowA_mA8AB95D6192218ECA0AF0646D115FC61F6BD3CEF(_thisAdjusted, ___blockA0, ___blockB1, ___blockC2, ___rowA3, method);
}
#ifdef __clang__
#pragma clang diagnostic pop
#endif
|
cb17b4a7a5f26c9a0ba2978f249551c61b8f5055 | 69b090ef355f26185de7e0df2f6889d5e70356ec | /arduino kit projects/ldrpiano_wo_LEDs/ldrpiano_wo_LEDs.ino | 8d870385223dbd53e5cef96c055223cee87f1315 | [] | no_license | Makeistan/makeistan | 2fec3591da868aedf5521c2129b4b33101ebb9f2 | 65be9e5a03b76e4668d50b6f2b051616ce46daef | refs/heads/master | 2021-01-15T18:14:54.521365 | 2016-09-23T08:08:31 | 2016-09-23T08:08:31 | 60,160,256 | 2 | 1 | null | 2016-06-01T08:43:17 | 2016-06-01T08:43:17 | null | UTF-8 | C++ | false | false | 1,641 | ino | ldrpiano_wo_LEDs.ino | int frequencies1 []= {262, 294, 330};
int frequencies2 []= {349, 392, 415};
int frequencies3 []= {440, 466, 740};
int frequencies4 []= {784, 831, 988};
int frequencies5 []= {1109, 1175, 2093};
const int buzzerPin= 9;
int buttonState=0;
int buttonState2=0;
int buttonState3=0;
int buttonState4=0;
int buttonState5=0;
void setup() {
// put your setup code here, to run once:
pinMode(2,INPUT);
pinMode(3,INPUT);
pinMode(4,INPUT);
pinMode(5,INPUT);
pinMode(6,INPUT);
pinMode(buzzerPin,OUTPUT);
for (int i=0; i<3; i++)
{
tone(buzzerPin,frequencies1 [i], 500);
Serial.begin(9600);
delay(500);
}
}
void loop() {
buttonState=digitalRead(2);
buttonState2=digitalRead(3);
buttonState3=digitalRead(4);
buttonState4=digitalRead(5);
buttonState5=digitalRead(6);
Serial.println(buttonState);
Serial.println(buttonState2);
Serial.println(buttonState3);
Serial.println(buttonState4);
Serial.println(buttonState5);
if(buttonState==1){
for (int i=0; i<3; i++)
{
tone(buzzerPin,frequencies1 [i], 500);
delay(500);
}}
if(buttonState2==1){
for (int i=0; i<3; i++)
{
tone(buzzerPin,frequencies2 [i], 500);
delay(500);
}}
if(buttonState3==1){
for (int i=0; i<3; i++)
{
tone(buzzerPin,frequencies3 [i], 500);
delay(500);
} }
if(buttonState4==1){
for (int i=0; i<3; i++)
{
tone(buzzerPin,frequencies4 [i], 500);
delay(500);
}}
if(buttonState5==1){
for (int i=0; i<3; i++)
{
tone(buzzerPin,frequencies5 [i], 500);
delay(500);
}
}
delay(500); // put your main code here, to run repeatedly:
}
|
eb28727a38a0dc18b799b5bc56e2e1ba59c7cfbb | 3a8c346a8904296e3edf4d36571f59dc5c78fb07 | /scene/animation/animate.h | 979b9875bc3c90a0903e35bc5fdf9e14ebf95643 | [] | no_license | guidoinit/Look3d | 90b6e9c96f58818e07ef3a1d1ac41ab919a3dafe | 5707cce8a8cf967d18547d8472cb58332a0d2a8d | refs/heads/master | 2021-10-09T13:19:45.496606 | 2017-10-13T21:03:50 | 2017-10-13T21:03:50 | 106,879,514 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,236 | h | animate.h | #ifndef ANIMATE_H
#define ANIMATE_H
#include <math.h>
#include <vector>
#include "scene/animation/frame.h"
#include "scene/animation/keyframe.h"
#include "mesh/animation/actionvertex.h"
#include "mesh/animation/meshanimation.h"
#include "mesh/animation/meshkeyframe.h"
#include "mesh/animation/meshframe.h"
#include "mesh/l3d_mesh.h"
#include "mesh/l3d_action.h"
#include "scene/animation/l3d_frame.h"
using namespace l3d::mesh;
class animate
{
public:
int m_nNumFrame;
string m_StrName;
animate();
animate(string);
~animate();
l3d_frame_list m_frames;
void AddObject(l3d_mesh_struct);
int GetSizeObject();
void GenerateAction();
int GetPrevFrame(int iobject,int iframe ,int iaction);
l3d_vertex_fast *GetWPObject(int index);
l3d_vertex_fast GetWPObjectFrame(int findex,int oindex);
l3d_vertex_fast GetScaleObjectFrame(int findex,int oindex);
l3d_vertex_fast GetRotateObjectFrame(int findex,int oindex);
l3d_mesh_struct * GetObject(int);
int IsKFPresent(keyframe kf);
keyframe *GetKeyFrame(int kindex);
animate( const animate &ani )
{
l3d_uint x,nindex;
m_nNumFrame= ani.m_nNumFrame;
m_StrName=ani.m_StrName;
nindex=m_frames.size();
//for (x=0; x< nindex ; x++)
// m_frames.add((pl3d_frame)ani.m_frames.get(x));
/*nindex=m_ostate.size();
for (x=0; x< nindex ; x++)
m_ostate.push_back((object3d &)ani.m_ostate.at(x));
nindex=m_ostatevertex.size();
for (x=0; x< nindex ; x++)
m_ostatevertex.push_back((vertex &)ani.m_ostatevertex.at(x));
nindex=m_keyframe.size();
for (x=0; x< nindex ; x++)
m_keyframe.push_back((keyframe&)ani.m_keyframe.at(x));*/
}
animate& operator=( const animate &ani )
{
l3d_uint x;
m_nNumFrame= ani.m_nNumFrame;
m_StrName=ani.m_StrName;
//l3d_uint nindex=ani.m_frames.size();
//for (x=0; x< nindex ; x++)
// m_frames.add(ani.m_frames.get(x));
/*
nindex=m_ostate.size();
for (x=0; x< nindex ; x++)
m_ostate.push_back((object3d &)ani.m_ostate.at(x));
nindex=m_ostatevertex.size();
for (x=0; x< nindex ; x++)
m_ostatevertex.push_back((vertex &)ani.m_ostatevertex.at(x));
nindex=m_keyframe.size();
for (x=0; x< nindex ; x++)
m_keyframe.push_back((keyframe&)ani.m_keyframe.at(x));
*/
return *this;
}
//virtual void Serialize(CArchive& ar);
l3d_vertex_fast GetObjectAngolo(int index);
l3d_vertex_fast GetObjectScale(int index);
void SetInitialState(int io);
void AddKeyFrame(keyframe mkeyframe);
private:
l3d_mesh m_ostate;
l3d_vertex m_ostatevertex;
l3d_vertex m_ostateangolo;
l3d_vertex m_ostatescale;
std::vector<keyframe> m_keyframe;
void DeleteActionKeyframe();
void SortKeyframe();
void GenerateActionMove();
void GenerateActionRotate();
void GenerateActionScale();
protected:
};
#endif // ANIMATE_H
|
f7abb35a7b2c84d873223465310a0e1a21ac8102 | 4d4fbfd4ed5b38fb807fc23b8ab5caf30b62b32d | /opencore-linux/engines/2way/src/pv_2way_mux_datapath.cpp | 598fac43384b56621e2007663615992ed08905c9 | [
"MIT",
"LicenseRef-scancode-other-permissive",
"Artistic-2.0",
"LicenseRef-scancode-philippe-de-muyter",
"Apache-2.0",
"LicenseRef-scancode-mpeg-iso",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | rcoscali/ftke | e88464f1e85502ffb9c199106bc6cb24f789efcf | e9d4e59c4387400387b65124d4b47b70072dd098 | refs/heads/master | 2021-01-10T05:01:03.546718 | 2010-09-23T02:49:21 | 2010-09-23T02:49:21 | 47,364,325 | 6 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,592 | cpp | pv_2way_mux_datapath.cpp | /* ------------------------------------------------------------------
* Copyright (C) 1998-2009 PacketVideo
*
* 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 "pv_2way_mux_datapath.h"
CPV2WayMuxDatapath *CPV2WayMuxDatapath::NewL(PVLogger *aLogger,
PVMFFormatType aFormat,
CPV324m2Way *a2Way)
{
CPV2WayMuxDatapath *self = OSCL_NEW(CPV2WayMuxDatapath, (aLogger, aFormat, a2Way));
OsclError::LeaveIfNull(self);
if (self)
{
OSCL_TRAPSTACK_PUSH(self);
self->ConstructL();
}
OSCL_TRAPSTACK_POP();
return self;
}
void CPV2WayMuxDatapath::OpenComplete()
{
i2Way->CheckConnect();
}
void CPV2WayMuxDatapath::PauseComplete()
{
//Mux cannot pause
}
void CPV2WayMuxDatapath::ResumeComplete()
{
//Mux cannot resume
}
void CPV2WayMuxDatapath::CloseComplete()
{
i2Way->iIsStackConnected = false;
i2Way->CheckDisconnect();
}
void CPV2WayMuxDatapath::DatapathError()
{
i2Way->SetState(EDisconnecting);
Close();
}
|
af7f9e57de33b91e51bbf139548628efab8a6ea7 | 0d435ccf219bd0011e2b18072d1096260d19f5a3 | /Class Circle Double Linked List/Circle Double Linked List.cpp | 6059c4d6d1a23c85a262a8df387f75cf53a3584f | [] | no_license | canceryoon/Data-Structure-Algorithm | e97b5050cb85b21032d7281047b5f173572c0aa5 | 91a1dc8e9b2a534f8e41bd314b397e9335704551 | refs/heads/master | 2021-01-19T21:19:45.517828 | 2018-02-01T05:50:58 | 2018-02-01T05:50:58 | 88,640,189 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,614 | cpp | Circle Double Linked List.cpp | #include<iostream>
using namespace std;
struct node
{
int val;
node* prev;
node* next;
};
node* HEAD;
node* createNode(int _val)
{
node* tmp = new node;
tmp->val = _val;
tmp->next = NULL;
tmp->prev = NULL;
return tmp;
}
void appendNode(node* inNode)
{
if(HEAD)
{
node* head = HEAD;
head->prev->next = inNode;
inNode->prev = head->prev;
head->prev = inNode;
inNode->next = head;
}
else
{
HEAD = inNode;
HEAD->next = HEAD;
HEAD->prev = HEAD;
}
}
void insertNode(int offset, node* inNode)
{
node* node = HEAD;
int cnt=1;
if(!HEAD)
{
cout << "No create List." << endl;
return;
}
while(node->next != HEAD)
{
if( cnt == offset )
{
inNode->prev = node->prev;
inNode->next = node;
node->prev->next = inNode;
node->prev = inNode;
return;
}
cnt++;
node = node->next;
}
delete inNode;
cout << "No offset" << endl;
}
void showAllNode()
{
node* node = HEAD;
if(!HEAD)
{
cout << "No create Node." << endl;
return;
}
while(1)
{
cout << node->prev->val << " " << node->val << " " << node->next->val << endl;
node = node->next;
if(node == HEAD) break;
}
}
void showNode(int offset)
{
node* head = HEAD;
int cnt = 1;
if(!HEAD)
{
cout << "No create List." << endl;
return;
}
do
{
if( cnt++ == offset)
{
cout << offset << " offset node value : " << head->val << endl;
return ;
}
head = head->next;
}while( head != HEAD);
cout << "No " << offset << " Node." << endl;
}
void deleteALLNode()
{
node* head = HEAD;
node* tmp;
if(!HEAD)
{
cout << "No create List." << endl;
return;
}
while(head)
{
if(head->next == head)
{
cout << "Delete value: " << head->val << endl;
delete head;
head = NULL;
break;
}
cout << "Delete value: " << head->val << endl;
head->prev->next = head->next;
head->next->prev = head->prev;
tmp = head->next;
delete head;
head = NULL;
head = tmp;
}
}
void deleteNode(int offset)
{
node* head = HEAD;
node* tmp;
int cnt = 1;
if(!HEAD)
{
cout << "No create List." << endl;
return;
}
do
{
if( cnt++ == offset)
{
head->next->prev = head->prev;
head->prev->next = head->next;
delete head;
head = NULL;
return;
}
head = head->next;
}while( head != HEAD);
cout << "No create " << offset << " node." << endl;
}
void updateNode(int offset, int val)
{
node* head = HEAD;
int cnt = 1;
if(!HEAD)
{
cout << "No create List." << endl;
return;
}
do
{
if( cnt++ == offset)
{
head->val = val;
return;
}
head = head->next;
}while( head != HEAD);
cout << "No " << offset << " Node." << endl;
}
int main()
{
int x, val, offset;
do
{
cout << endl << "1. Insert" << endl << "2. InsertNode" << endl << "3. ShowNode" << endl << "4. ShowAll" << endl << "5. DeleteNode" << endl << "6 UpdateNode" << endl << "7. ENd" << endl;
cin >> x;
switch(x)
{
case 1:
cout << "Input Num: " ;
cin >> val;
appendNode(createNode(val));
break;
case 2:
cout << "Input Insert offset: ";
cin >> offset;
cout << "Input Num: ";
cin >> val;
insertNode(offset, createNode(val));
break;
case 3:
cout << "Input Select offset" ;
cin >> offset;
showNode(offset);
break;
case 4:
showAllNode();
break;
case 5:
cout << "Input Delete Offset";
cin >> offset;
deleteNode(offset);
break;
case 6:
cout << "Input Update Offset";
cin >> offset;
cout << "Input Update NUm";
cin >> val;
updateNode(offset, val);
}
}while(x != 7);
cout << "END:" << endl;
deleteALLNode();
return 1;
}
|
a9eb16043360581a35cb51a225cc3ad0495582d7 | 7c62729c7c3f2f195f49eaa89dcb6a60909df3e9 | /GstRtpTest/server/main.cpp | cd3acf46e77b56d77f26ce331db14d8394c343ed | [] | no_license | guxinkobe/GstRtp | 68cc03385a0e0723022164cb6ae13a79089a01cc | 22bbe59d41d16367589d2c7ad779ac3abac07cf0 | refs/heads/master | 2020-06-25T19:13:08.055413 | 2019-08-13T08:26:43 | 2019-08-13T08:26:43 | 199,398,841 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,645 | cpp | main.cpp | #include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <string.h>
#include <pthread.h>
#include <sys/un.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <ctype.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include "RtpVideo.h"
RtpStreamSender *sender;
//========================================================================// APP
void *GenerateAVCDataThread(void *argv)
{
DEBUG("GenerateAVCDataThread is running\n");
FILE *fp = NULL;
int iRet = -1;
//================================//
int iVideoSize = 0;
char *pVideoBuffer = NULL;
int iCnt = 0;
int iLastPos = 0;
int tmpFlag = 0;
//static stVideoAxis CarplayDispAxis[2] = {{0, 0, 800, 450}, {0, 0, 540, 960}};
DEBUG("GenerateAVCDataThread is running 0\n");
pthread_detach(pthread_self());
INFO("Open file: %s...\n", (const char *)argv);
fp = fopen((const char *)argv, "r");
if(NULL == fp)
{
ERROR("Open file failed!\n");
pthread_exit(&iRet);
return NULL;
}
//================================// Read video file
DEBUG("GenerateAVCDataThread is running 2\n");
fseek(fp, 0, SEEK_END);
iVideoSize = ftell(fp);
rewind(fp);
pVideoBuffer = (char *)malloc(iVideoSize + 1);
iRet = fread(pVideoBuffer, 1, iVideoSize, fp);
if(iRet > 0)
{
DEBUG("bfw\n");
#ifdef FEED_FLV
if(isFlvPacket(pVideoBuffer, iVideoSize))
{
FeedFlvPacket(pVideoBuffer, iVideoSize);
}
#else
while(1)
{
for(iCnt=1; iCnt < iVideoSize; iCnt++)
{
if( (0x00 == pVideoBuffer[iCnt])
&& (0x00 == pVideoBuffer[iCnt + 1])
&& (0x00 == pVideoBuffer[iCnt + 2])
&& (0x01 == pVideoBuffer[iCnt + 3]))
//if(0 == (iCnt % 10240))
{
DEBUG("bfd: %d!\n", iCnt - iLastPos);
sender->FeedH264ToPlayer(pVideoBuffer + iLastPos, iCnt - iLastPos);
//usleep(40*1000);
iLastPos = iCnt;
}
}
DEBUG("bfd: %d!\n", iCnt - iLastPos);
sender->FeedH264ToPlayer(pVideoBuffer + iLastPos, iCnt - iLastPos);
iLastPos = 0;
}
#endif
DEBUG("fnw: %d\n", iRet);
}
else
{
ERROR("iRet: %d", iRet);
}
DEBUG("GenerateAVCDataThread is running 3\n");
fclose(fp);
free(pVideoBuffer);
pthread_exit(NULL);
//exit(0);
}
#define STREAM
int main()
{
pthread_t ptGenAVC;
const char *pVideoFilePath = "/home/guxin/test.264";
#ifdef STREAM
sender = new RtpStreamSender(6664,6665, STREAM_MODE);
#else
sender = new RtpStreamSender(6664,6665, FILE_MODE, pVideoFilePath);
#endif
sender->InitStreamPlayer();
sender->StartStreamPlayer();
#ifdef STREAM
pthread_create(&ptGenAVC, NULL, &GenerateAVCDataThread, (char *)pVideoFilePath);
#endif
sleep(1800);
delete sender;
sender = NULL;
return 0;
}
|
bcfe96066810719a320361bdaa2fafb19c149456 | 8e5329ff8b9db2716f250b46236bf164e2caa2dc | /C++/TestCodes/test_arr.cc | 4190504499fb0cbe59a6da31c65a0d087fb5af94 | [] | no_license | mmbillah/ProgPrac | cec857718ded3bca0d61ddec72c98c7bed5d6236 | a40376854fd4f23cbf635a6fbb6142976e24d462 | refs/heads/main | 2023-05-28T20:36:23.849952 | 2021-06-09T23:18:41 | 2021-06-09T23:18:41 | 369,649,731 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 394 | cc | test_arr.cc | #include<iostream>
using namespace std;
int i,j,k;
int arr[3][3][3];
int main(){
for (i=0;i<3;i++)
for (j=0;j<3;j++)
for (k=0;k<3;k++)
arr[i][j][k]=1;
for (i=0;i<3;i++)
for (j=0;j<3;j++)
for (k=0;k<3;k++)
cout<<arr[i][j][k]<<endl;
cout<<"element: "<<arr[0][1][2]*arr[2][1][0]<<endl;
return 0;
}
|
2a5be0873b6e5fcfe636e099efcb27dd6354122a | efa0c98149583a7b0f8902d390d188b1b85de035 | /18_2.cpp | db74652b33695969fb7b492bdc8f535d9eb98f6a | [] | no_license | ChenCongGit/-offer- | 71b7b08bd64a030b620cd6215918d6eafb260e86 | 2085d6dac8cf631571f2418a08cbe442fd4ebf5e | refs/heads/master | 2020-09-30T19:45:00.598795 | 2019-12-11T12:24:21 | 2019-12-11T12:24:21 | 227,359,484 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 8,373 | cpp | 18_2.cpp | # include <iostream>
using namespace std;
struct ListNode
{
int m_nValue;
ListNode* m_pNext;
ListNode(int value, ListNode* next=nullptr):m_nValue(value), m_pNext(next) {}
};
ListNode* CreateListNode(int value);
void ConnectListNodes(ListNode* pCurrent, ListNode* pNext);
void PrintListNode(ListNode* pNode);
void PrintList(ListNode* pHead);
void DestroyList(ListNode* pHead);
void AddToTail(ListNode** pHead, int value);
void RemoveNode(ListNode** pHead, int value);
void DeleteDuplication(ListNode* &pHead)
{
// 特殊情况
if (pHead == nullptr) return;
// 辅助头节点
ListNode* firstNode = new ListNode(-1, pHead);
// 从前到后遍历链表
ListNode* preNode = firstNode;
ListNode* curNode = pHead;
while (curNode != nullptr)
{
// 循环直到找到下一个不重复的节点,将中间的节点全部删除
ListNode* pNode = curNode;
bool haveDupicate = false;
while (pNode->m_pNext != nullptr && pNode->m_pNext->m_nValue == pNode->m_nValue)
{
haveDupicate = true;
ListNode* deletedNode = pNode;
pNode = pNode->m_pNext;
delete deletedNode;
}
// 删除最后一个重复结点
if (haveDupicate)
{
preNode->m_pNext = pNode->m_pNext;
delete pNode;
curNode = preNode->m_pNext;
}
else
{
preNode = preNode->m_pNext;
curNode = curNode->m_pNext;
}
}
pHead = firstNode->m_pNext; // 头节点可能相同,被删除
}
// ====================测试代码====================
void Test(char* testName, ListNode** pHead, int* expectedValues, int expectedLength)
{
if(testName != nullptr)
printf("%s begins: ", testName);
DeleteDuplication(*pHead);
int index = 0;
ListNode* pNode = *pHead;
while(pNode != nullptr && index < expectedLength)
{
if(pNode->m_nValue != expectedValues[index])
break;
pNode = pNode->m_pNext;
index++;
}
if(pNode == nullptr && index == expectedLength)
printf("Passed.\n");
else
printf("FAILED.\n");
PrintList(*pHead);
}
// 某些结点是重复的
void Test1()
{
ListNode* pNode1 = CreateListNode(1);
ListNode* pNode2 = CreateListNode(2);
ListNode* pNode3 = CreateListNode(3);
ListNode* pNode4 = CreateListNode(3);
ListNode* pNode5 = CreateListNode(3);
ListNode* pNode3_1 = CreateListNode(3);
ListNode* pNode4_2 = CreateListNode(3);
ListNode* pNode5_3 = CreateListNode(3);
ListNode* pNode6 = CreateListNode(4);
ListNode* pNode7 = CreateListNode(4);
ListNode* pNode8 = CreateListNode(5);
ConnectListNodes(pNode1, pNode2);
ConnectListNodes(pNode2, pNode3);
ConnectListNodes(pNode3, pNode4);
ConnectListNodes(pNode4, pNode5);
ConnectListNodes(pNode5, pNode3_1);
ConnectListNodes(pNode3_1, pNode4_2);
ConnectListNodes(pNode4_2, pNode5_3);
ConnectListNodes(pNode5_3, pNode6);
// ConnectListNodes(pNode5, pNode6);
ConnectListNodes(pNode6, pNode7);
ConnectListNodes(pNode7, pNode8);
ListNode* pHead = pNode1;
int expectedValues[] = { 1, 2, 5 };
Test("Test1", &pHead, expectedValues, sizeof(expectedValues) / sizeof(int));
DestroyList(pHead);
}
// 没有重复的结点
void Test2()
{
ListNode* pNode1 = CreateListNode(1);
ListNode* pNode2 = CreateListNode(2);
ListNode* pNode3 = CreateListNode(3);
ListNode* pNode4 = CreateListNode(4);
ListNode* pNode5 = CreateListNode(5);
ListNode* pNode6 = CreateListNode(6);
ListNode* pNode7 = CreateListNode(7);
ConnectListNodes(pNode1, pNode2);
ConnectListNodes(pNode2, pNode3);
ConnectListNodes(pNode3, pNode4);
ConnectListNodes(pNode4, pNode5);
ConnectListNodes(pNode5, pNode6);
ConnectListNodes(pNode6, pNode7);
ListNode* pHead = pNode1;
int expectedValues[] = { 1, 2, 3, 4, 5, 6, 7 };
Test("Test2", &pHead, expectedValues, sizeof(expectedValues) / sizeof(int));
DestroyList(pHead);
}
// 除了一个结点之外其他所有结点的值都相同
void Test3()
{
ListNode* pNode1 = CreateListNode(1);
ListNode* pNode2 = CreateListNode(1);
ListNode* pNode3 = CreateListNode(1);
ListNode* pNode4 = CreateListNode(1);
ListNode* pNode5 = CreateListNode(1);
ListNode* pNode6 = CreateListNode(1);
ListNode* pNode7 = CreateListNode(2);
ConnectListNodes(pNode1, pNode2);
ConnectListNodes(pNode2, pNode3);
ConnectListNodes(pNode3, pNode4);
ConnectListNodes(pNode4, pNode5);
ConnectListNodes(pNode5, pNode6);
ConnectListNodes(pNode6, pNode7);
ListNode* pHead = pNode1;
int expectedValues[] = { 2 };
Test("Test3", &pHead, expectedValues, sizeof(expectedValues) / sizeof(int));
DestroyList(pHead);
}
// 所有结点的值都相同
void Test4()
{
ListNode* pNode1 = CreateListNode(1);
ListNode* pNode2 = CreateListNode(1);
ListNode* pNode3 = CreateListNode(1);
ListNode* pNode4 = CreateListNode(1);
ListNode* pNode5 = CreateListNode(1);
ListNode* pNode6 = CreateListNode(1);
ListNode* pNode7 = CreateListNode(1);
ConnectListNodes(pNode1, pNode2);
ConnectListNodes(pNode2, pNode3);
ConnectListNodes(pNode3, pNode4);
ConnectListNodes(pNode4, pNode5);
ConnectListNodes(pNode5, pNode6);
ConnectListNodes(pNode6, pNode7);
ListNode* pHead = pNode1;
Test("Test4", &pHead, nullptr, 0);
DestroyList(pHead);
}
// 所有结点都成对出现
void Test5()
{
ListNode* pNode1 = CreateListNode(1);
ListNode* pNode2 = CreateListNode(1);
ListNode* pNode3 = CreateListNode(2);
ListNode* pNode4 = CreateListNode(2);
ListNode* pNode5 = CreateListNode(3);
ListNode* pNode6 = CreateListNode(3);
ListNode* pNode7 = CreateListNode(4);
ListNode* pNode8 = CreateListNode(4);
ConnectListNodes(pNode1, pNode2);
ConnectListNodes(pNode2, pNode3);
ConnectListNodes(pNode3, pNode4);
ConnectListNodes(pNode4, pNode5);
ConnectListNodes(pNode5, pNode6);
ConnectListNodes(pNode6, pNode7);
ConnectListNodes(pNode7, pNode8);
ListNode* pHead = pNode1;
Test("Test5", &pHead, nullptr, 0);
DestroyList(pHead);
}
// 除了两个结点之外其他结点都成对出现
void Test6()
{
ListNode* pNode1 = CreateListNode(1);
ListNode* pNode2 = CreateListNode(1);
ListNode* pNode3 = CreateListNode(2);
ListNode* pNode4 = CreateListNode(3);
ListNode* pNode5 = CreateListNode(3);
ListNode* pNode6 = CreateListNode(4);
ListNode* pNode7 = CreateListNode(5);
ListNode* pNode8 = CreateListNode(5);
ConnectListNodes(pNode1, pNode2);
ConnectListNodes(pNode2, pNode3);
ConnectListNodes(pNode3, pNode4);
ConnectListNodes(pNode4, pNode5);
ConnectListNodes(pNode5, pNode6);
ConnectListNodes(pNode6, pNode7);
ConnectListNodes(pNode7, pNode8);
ListNode* pHead = pNode1;
int expectedValues[] = { 2, 4 };
Test("Test6", &pHead, expectedValues, sizeof(expectedValues) / sizeof(int));
DestroyList(pHead);
}
// 链表中只有两个不重复的结点
void Test7()
{
ListNode* pNode1 = CreateListNode(1);
ListNode* pNode2 = CreateListNode(2);
ConnectListNodes(pNode1, pNode2);
ListNode* pHead = pNode1;
int expectedValues[] = { 1, 2 };
Test("Test7", &pHead, expectedValues, sizeof(expectedValues) / sizeof(int));
DestroyList(pHead);
}
// 结点中只有一个结点
void Test8()
{
ListNode* pNode1 = CreateListNode(1);
ConnectListNodes(pNode1, nullptr);
ListNode* pHead = pNode1;
int expectedValues[] = { 1 };
Test("Test8", &pHead, expectedValues, sizeof(expectedValues) / sizeof(int));
DestroyList(pHead);
}
// 结点中只有两个重复的结点
void Test9()
{
ListNode* pNode1 = CreateListNode(1);
ListNode* pNode2 = CreateListNode(1);
ConnectListNodes(pNode1, pNode2);
ListNode* pHead = pNode1;
Test("Test9", &pHead, nullptr, 0);
DestroyList(pHead);
}
// 空链表
void Test10()
{
ListNode* pHead = nullptr;
Test("Test10", &pHead, nullptr, 0);
}
int main(int argc, char* argv[])
{
Test1();
Test2();
Test3();
Test4();
Test5();
Test6();
Test7();
Test8();
Test9();
Test10();
return 0;
} |
fd3c2065af6a0edd313d9a005f8ddb380a833df2 | 992b4a29066b038e4a8e0ea8257eaac865e6166c | /src/visualisation/ftPressureField.h | c1839d0b5236ce4d80facd6d35e4bc9089463894 | [
"MIT"
] | permissive | julapy/ofxFlowTools | 22af5a773bca8d87f917ea42def73e55cad56003 | 5ae948352fb044bc3de3414070b5172fa54323a8 | refs/heads/master | 2021-01-18T10:51:41.312405 | 2015-07-22T10:12:28 | 2015-07-22T10:12:28 | 41,412,540 | 2 | 1 | null | 2015-08-26T07:59:01 | 2015-08-26T07:59:01 | null | UTF-8 | C++ | false | false | 1,581 | h | ftPressureField.h |
#pragma once
#include "ofMain.h"
#include "ftPressureFieldShader.h"
namespace flowTools {
class ftPressureField {
public:
void setup(int _width, int _height){
width = _width;
height = _height;
fieldMesh.setMode(OF_PRIMITIVE_POINTS);
float xStep = 1. / width;
float yStep = 1. / height;
for (int x=0; x<width; x++) {
for (int y=0; y<height; y++) {
fieldMesh.addVertex(ofVec3f((x + 0.5) * xStep, (y + 0.5) * yStep, 0));
}
}
fieldVbo.setMesh(fieldMesh, GL_DYNAMIC_DRAW, false, false, false);
parameters.setName("pressure field");
parameters.add(pressureScale.set("pressure scale", .45, 0, 1));
};
void draw(int _x, int _y, int _width, int _height) {
ofPushMatrix();
ofPushStyle();
ofEnableAlphaBlending();
ofDisableAntiAliasing();
ofScale(_width, _height);
float radius = 2.0 / (height) * 0.275;
pressureFieldShader.update(fieldVbo, *pressureTexture, pressureScale.get(), radius);
ofEnableAntiAliasing();
ofPopStyle();
ofPopMatrix();
}
void setPressure(ofTexture& tex) { pressureTexture = &tex; }
void setPressureScale(float _value) { pressureScale.set(_value); }
float getPressureScale() { return pressureScale.get(); }
int getWidth() { return width; }
int getHeight() { return height; }
ofParameterGroup parameters;
protected:
int width;
int height;
ofParameter<float> pressureScale;
ofTexture* pressureTexture;
ofMesh fieldMesh;
ofVbo fieldVbo;
ftPressureFieldShader pressureFieldShader;
};
}
|
fd828e2cdd48a26ab01e5e5fc9523a3e0ed3c67e | d4919fec5e01d84abbd9f782611ca66a80d0b61a | /OOP_labs/lab3/vector.h | 9c09d2891f624655b8b3420009737f8c6852f2f2 | [] | no_license | Fogapod/university_projects | b749f978b11bd350192d9557fb6d3808d1e770f0 | e7fe4bd12324833eb6a584cec201dc1d60eac49c | refs/heads/master | 2021-07-10T06:22:04.882826 | 2019-03-16T06:38:36 | 2019-03-16T06:38:36 | 103,112,866 | 0 | 2 | null | 2017-12-30T19:41:41 | 2017-09-11T08:54:38 | C | UTF-8 | C++ | false | false | 224 | h | vector.h | #include <cmath>
class Vector {
public:
double x, y;
double get_module() {
return std::hypot(x, y);
}
void add(Vector v2) {
x += v2.x;
y += v2.y;
}
void substract(Vector v2) {
x -= v2.x;
y -= v2.y;
}
};
|
4353b425ef7469b31be90dd96f491d34a7b0b779 | 7b7570ef6a05e916d67f584ff487068495a75530 | /basicofprogram/pepcodingquestion/theorypart/arraypep/BarChart.cpp | 5206d6b0350ebcbbd306767a840baa28b67b321e | [] | no_license | JeetYad07/DSA | 09a7193c3e54c8f5b4a6aff9efc2cf19df3c5b84 | 484d2760d4c0bba3988cdaa886f06d1857d6ac77 | refs/heads/main | 2023-06-02T07:27:38.815108 | 2021-06-20T08:42:39 | 2021-06-20T08:42:39 | 378,594,055 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 777 | cpp | BarChart.cpp | #include<iostream>
using namespace std;
// The main concept is here to find max value of an array, which act as a floor or row
int main(){
int n;
// cout<<"Enter a number:"<<endl;
cin>>n;
int arr[n];
for(int i=0;i<n;i++){
cin>>arr[i];
}
int max=arr[0];
for(int i=0;i<n;i++){
if(arr[i]>max){
max=arr[i];
}
}
for(int floor=max;floor>0;floor--){ // this will act as a row or max value in a array
for(int i=0;i<n;i++){ // This will be for printing elements in column
if(arr[i]>=floor){ // building height>=floor number
cout<<"*\t";
}
else{
cout<<"\t";
}
}
cout<<endl;
}
}
|
96a57bfdfa6e8083c4904c96134a0563979eec31 | 8b4cd859b2365d8800970f8d699b1a10f46e98bf | /17.电话号码的字母组合.cpp | aa18ebdbcd0578c63552969e82a6e6284826f082 | [] | no_license | 2013fangwentao/leetcode | 4aa2be2422be6e1c10d8f1b804591f43b320d398 | 2ba5639927f6da9f415450b0e01d04503d1790ce | refs/heads/master | 2020-07-07T09:24:45.216182 | 2019-09-03T13:54:47 | 2019-09-03T13:54:47 | 203,314,769 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,984 | cpp | 17.电话号码的字母组合.cpp | /*
* @lc app=leetcode.cn id=17 lang=cpp
*
* [17] 电话号码的字母组合
*
* https://leetcode-cn.com/problems/letter-combinations-of-a-phone-number/description/
*
* algorithms
* Medium (49.84%)
* Likes: 367
* Dislikes: 0
* Total Accepted: 31K
* Total Submissions: 62.2K
* Testcase Example: '"23"'
*
* 给定一个仅包含数字 2-9 的字符串,返回所有它能表示的字母组合。
*
* 给出数字到字母的映射如下(与电话按键相同)。注意 1 不对应任何字母。
*
*
*
* 示例:
*
* 输入:"23"
* 输出:["ad", "ae", "af", "bd", "be", "bf", "cd", "ce", "cf"].
*
*
* 说明:
* 尽管上面的答案是按字典序排列的,但是你可以任意选择答案输出的顺序。
*
*/
#include <string>
#include <vector>
using std::string;
using std::vector;
class Solution
{
public:
void PushBackWord(int dight, vector<string> &letter)
{
if (letter.size() == 0)
{
for (auto alphabet : key[dight])
{
string temp_word{alphabet};
letter.emplace_back(temp_word);
}
return;
}
for (auto word = letter.begin(); word != letter.end(); )
{
for (auto alphabet : key[dight])
{
string temp_word = (*word) + (alphabet);
word = letter.insert(word, temp_word);
word++;
}
letter.erase(word);
}
}
public:
std::string key[8] = {"abc", "def", "ghi", "jkl", "mno", "pqrs", "tuv", "wxyz"};
vector<string> letterCombinations(string digits)
{
std::vector<string> result;
for (auto nums : digits)
{
int dight = nums - '2';
PushBackWord(dight, result);
}
return result;
}
};
// int main()
// {
// Solution sol;
// vector<int> test{0, 0, 0, 0};
// auto result = sol.letterCombinations("23");
// }
|
0789e39be047b3f06e9e15f1272920f0d43f09ca | c603e00f13957e726f2e94a53a19b268ea0f60d7 | /code/Uncertainty/FPG/FPG/source/model/Probabilistic.h | 5dd3f395677c28cf1f03fb34d2b99192290b0537 | [] | no_license | xuanjianwu/plantool | 97015351670732297b5fbe742395c228b7e5ddba | 4fe56c6ff8897690cc2a3f185901dfe3faeb819a | refs/heads/master | 2021-01-21T20:39:03.688983 | 2017-05-30T00:57:44 | 2017-05-30T00:57:44 | 91,229,802 | 2 | 0 | null | 2017-05-14T08:24:03 | 2017-05-14T08:24:03 | null | UTF-8 | C++ | false | false | 1,257 | h | Probabilistic.h | /*
* Probabilistic.h
*
* An interface representing a grouping of probabilities. The
* sum of all Outcomes within this probabilistic group must sum
* to be 1.0. A Probabilistic instance can manipulate the probabilities
* of its child DOMOutcomes to ensure this.
*
* Currently this is implemented by DOMAction.
*
* Created by Owen Thomas on 13/03/06.
* Copyright 2006 __MyCompanyName__. All rights reserved.
*
*/
#ifndef inc_probabilistic
#define inc_probabilistic
#include "ProbabilisticListener.h"
#include <map>
class DOMOutcome;
class DOMAction;
class Probabilistic
{
public:
virtual ~Probabilistic() { }
//add, remove Outcomes of this Probabilistic.
virtual map<DOMOutcome*, double>& getOutcomes () = 0;
virtual void setOutcomes ( map<DOMOutcome*, double> ) = 0;
virtual int getNumberOfOutcomes () = 0;
virtual void setProbabilisticListener (ProbabilisticListener*) = 0;
virtual DOMAction* getParent () = 0;
/**
* Generic way of sampling from an outcome
* @return pointer to sampled outcome
* @author daa
*/
virtual DOMOutcome* sampleOutcome() = 0;
/**
* Get most likey outcome
* @author daa
*/
virtual DOMOutcome* getMostLikelyOutcome() = 0;
};
#endif
|
08b898bac334c1da34e4585271a18c74688dc30f | 6d76328bbd60ef9fe0e59fe6e20ba1df03d665d1 | /GeneratedFiles/ui_bovwtrainer.h | 83ce68c1467cca98c845aef33b162e4fb6b86ee9 | [] | no_license | WilliamLiPro/BoWtrainer | 9f5e343b3dddff37cbf06a2eb37d7a5ce05259ba | 1b0fca1b2558808de43a0f57111e5e0c937df30c | refs/heads/master | 2020-04-29T17:17:59.709714 | 2019-04-23T02:29:57 | 2019-04-23T02:29:57 | 176,292,682 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 24,163 | h | ui_bovwtrainer.h | /********************************************************************************
** Form generated from reading UI file 'bovwtrainer.ui'
**
** Created by: Qt User Interface Compiler version 5.3.1
**
** WARNING! All changes made in this file will be lost when recompiling UI file!
********************************************************************************/
#ifndef UI_BOVWTRAINER_H
#define UI_BOVWTRAINER_H
#include <QtCore/QVariant>
#include <QtWidgets/QAction>
#include <QtWidgets/QApplication>
#include <QtWidgets/QButtonGroup>
#include <QtWidgets/QComboBox>
#include <QtWidgets/QGroupBox>
#include <QtWidgets/QHeaderView>
#include <QtWidgets/QLabel>
#include <QtWidgets/QMainWindow>
#include <QtWidgets/QMenu>
#include <QtWidgets/QMenuBar>
#include <QtWidgets/QProgressBar>
#include <QtWidgets/QSpinBox>
#include <QtWidgets/QStatusBar>
#include <QtWidgets/QTextBrowser>
#include <QtWidgets/QToolBar>
#include <QtWidgets/QToolButton>
#include <QtWidgets/QWidget>
QT_BEGIN_NAMESPACE
class Ui_BoVWTrainerClass
{
public:
QAction *actionHelp;
QAction *actionExit;
QWidget *centralWidget;
QLabel *show_im_feature;
QTextBrowser *text_showfile;
QProgressBar *progressBar;
QGroupBox *groupBox_4;
QLabel *label_2;
QComboBox *sample_detector;
QLabel *label_3;
QComboBox *sample_extractor;
QGroupBox *groupBox_3;
QToolButton *button_select_in_path_2;
QLabel *load_dataset;
QLabel *label_4;
QComboBox *open_camera;
QToolButton *sample_pause;
QToolButton *sample_run;
QToolButton *sample_stop;
QGroupBox *groupBox;
QLabel *label_6;
QComboBox *trainbovw_feature;
QSpinBox *bovw_levels;
QLabel *label_7;
QSpinBox *bovw_branches;
QLabel *label_8;
QToolButton *trainbovw_pause;
QToolButton *trainbovw_run;
QToolButton *trainbovw_stop;
QMenuBar *menuBar;
QMenu *menu;
QToolBar *mainToolBar;
QStatusBar *statusBar;
void setupUi(QMainWindow *BoVWTrainerClass)
{
if (BoVWTrainerClass->objectName().isEmpty())
BoVWTrainerClass->setObjectName(QStringLiteral("BoVWTrainerClass"));
BoVWTrainerClass->resize(680, 505);
BoVWTrainerClass->setStyleSheet(QStringLiteral("background-color: qlineargradient(spread:pad, x1:0.550773, y1:1, x2:0.551136, y2:0.023, stop:0 rgba(80, 120, 250, 120), stop:1 rgba(200, 240, 255, 200));"));
actionHelp = new QAction(BoVWTrainerClass);
actionHelp->setObjectName(QStringLiteral("actionHelp"));
actionExit = new QAction(BoVWTrainerClass);
actionExit->setObjectName(QStringLiteral("actionExit"));
centralWidget = new QWidget(BoVWTrainerClass);
centralWidget->setObjectName(QStringLiteral("centralWidget"));
show_im_feature = new QLabel(centralWidget);
show_im_feature->setObjectName(QStringLiteral("show_im_feature"));
show_im_feature->setGeometry(QRect(20, 10, 320, 240));
show_im_feature->setStyleSheet(QStringLiteral("background-color: rgb(255, 255, 255);"));
text_showfile = new QTextBrowser(centralWidget);
text_showfile->setObjectName(QStringLiteral("text_showfile"));
text_showfile->setGeometry(QRect(370, 10, 296, 246));
text_showfile->setStyleSheet(QStringLiteral("background-color: rgb(250, 255, 255);"));
text_showfile->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
text_showfile->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded);
text_showfile->setSizeAdjustPolicy(QAbstractScrollArea::AdjustToContents);
progressBar = new QProgressBar(centralWidget);
progressBar->setObjectName(QStringLiteral("progressBar"));
progressBar->setGeometry(QRect(210, 260, 131, 10));
progressBar->setValue(0);
progressBar->setTextVisible(false);
groupBox_4 = new QGroupBox(centralWidget);
groupBox_4->setObjectName(QStringLiteral("groupBox_4"));
groupBox_4->setGeometry(QRect(10, 280, 356, 151));
QFont font;
font.setFamily(QString::fromUtf8("\345\256\213\344\275\223"));
font.setPointSize(10);
font.setBold(false);
font.setItalic(false);
font.setWeight(9);
groupBox_4->setFont(font);
groupBox_4->setAcceptDrops(false);
groupBox_4->setToolTipDuration(-1);
groupBox_4->setStyleSheet(QString::fromUtf8("background-color: qlineargradient(spread:pad, x1:0.550773, y1:1, x2:0.551136, y2:0.023, stop:0 rgba(78, 114, 238, 150), stop:1 rgba(255, 255, 255, 255));\n"
"font: 75 10pt \"\345\256\213\344\275\223\";\n"
"color: rgb(0, 0, 81);"));
groupBox_4->setFlat(false);
groupBox_4->setCheckable(false);
label_2 = new QLabel(groupBox_4);
label_2->setObjectName(QStringLiteral("label_2"));
label_2->setGeometry(QRect(10, 25, 51, 21));
label_2->setStyleSheet(QLatin1String("background-color: rgb(255, 255, 255,0);\n"
"color: rgb(0, 0, 81);"));
sample_detector = new QComboBox(groupBox_4);
sample_detector->setObjectName(QStringLiteral("sample_detector"));
sample_detector->setGeometry(QRect(60, 25, 71, 21));
sample_detector->setFont(font);
sample_detector->setAutoFillBackground(false);
sample_detector->setStyleSheet(QStringLiteral("background-color: rgb(255, 255, 220);"));
sample_detector->setMaxVisibleItems(8);
sample_detector->setInsertPolicy(QComboBox::InsertAtCurrent);
label_3 = new QLabel(groupBox_4);
label_3->setObjectName(QStringLiteral("label_3"));
label_3->setGeometry(QRect(10, 60, 51, 21));
label_3->setStyleSheet(QLatin1String("background-color: rgb(255, 255, 255,0);\n"
"color: rgb(0, 0, 81);"));
sample_extractor = new QComboBox(groupBox_4);
sample_extractor->setObjectName(QStringLiteral("sample_extractor"));
sample_extractor->setGeometry(QRect(60, 60, 71, 21));
sample_extractor->setFont(font);
sample_extractor->setAutoFillBackground(false);
sample_extractor->setStyleSheet(QStringLiteral("background-color: rgb(255, 255, 220);"));
sample_extractor->setMaxVisibleItems(8);
sample_extractor->setInsertPolicy(QComboBox::InsertAtCurrent);
groupBox_3 = new QGroupBox(groupBox_4);
groupBox_3->setObjectName(QStringLiteral("groupBox_3"));
groupBox_3->setGeometry(QRect(140, 15, 206, 76));
groupBox_3->setFont(font);
groupBox_3->setAcceptDrops(false);
groupBox_3->setToolTipDuration(-1);
groupBox_3->setStyleSheet(QStringLiteral("background-color: qlineargradient(spread:pad, x1:0.550773, y1:1, x2:0.551136, y2:0.023, stop:0 rgba(78, 114, 238, 150), stop:1 rgba(255, 255, 255, 255));"));
groupBox_3->setFlat(false);
groupBox_3->setCheckable(false);
button_select_in_path_2 = new QToolButton(groupBox_3);
button_select_in_path_2->setObjectName(QStringLiteral("button_select_in_path_2"));
button_select_in_path_2->setGeometry(QRect(90, 40, 41, 31));
button_select_in_path_2->setAcceptDrops(false);
button_select_in_path_2->setAutoFillBackground(false);
button_select_in_path_2->setStyleSheet(QLatin1String("border-radius:5px;border-width:0px;\n"
"border-radius:5px;border-width:0px;\\nbackground-color: qlineargradient(spread:pad, x1:0.550773, y1:1, x2:0.551136, y2:0.023, stop:0 rgba(150, 180, 238, 255), stop:1 rgba(255, 255, 255, 255));\n"
""));
button_select_in_path_2->setInputMethodHints(Qt::ImhNone);
QIcon icon;
icon.addFile(QStringLiteral(":/BoVWTrainer/Resources/ooopic_1489847848.ico"), QSize(), QIcon::Normal, QIcon::Off);
button_select_in_path_2->setIcon(icon);
button_select_in_path_2->setIconSize(QSize(48, 48));
button_select_in_path_2->setArrowType(Qt::NoArrow);
load_dataset = new QLabel(groupBox_3);
load_dataset->setObjectName(QStringLiteral("load_dataset"));
load_dataset->setGeometry(QRect(15, 45, 86, 21));
load_dataset->setStyleSheet(QLatin1String("background-color: rgb(255, 255, 255,0);\n"
"color: rgb(0, 0, 81);"));
label_4 = new QLabel(groupBox_3);
label_4->setObjectName(QStringLiteral("label_4"));
label_4->setGeometry(QRect(15, 10, 71, 21));
label_4->setStyleSheet(QLatin1String("background-color: rgb(255, 255, 255,0);\n"
"color: rgb(0, 0, 81);"));
open_camera = new QComboBox(groupBox_3);
open_camera->setObjectName(QStringLiteral("open_camera"));
open_camera->setGeometry(QRect(90, 10, 111, 21));
open_camera->setFont(font);
open_camera->setAutoFillBackground(false);
open_camera->setStyleSheet(QStringLiteral("background-color: rgb(255, 255, 220);"));
open_camera->setEditable(false);
open_camera->setMaxVisibleItems(8);
open_camera->setInsertPolicy(QComboBox::InsertAtCurrent);
sample_pause = new QToolButton(groupBox_4);
sample_pause->setObjectName(QStringLiteral("sample_pause"));
sample_pause->setGeometry(QRect(75, 100, 41, 41));
sample_pause->setAcceptDrops(false);
sample_pause->setAutoFillBackground(false);
sample_pause->setStyleSheet(QLatin1String("border-radius:5px;border-width:0px;\n"
""));
sample_pause->setInputMethodHints(Qt::ImhNone);
QIcon icon1;
icon1.addFile(QStringLiteral(":/BoVWTrainer/Resources/ooopic_1489847914.ico"), QSize(), QIcon::Normal, QIcon::Off);
sample_pause->setIcon(icon1);
sample_pause->setIconSize(QSize(48, 48));
sample_run = new QToolButton(groupBox_4);
sample_run->setObjectName(QStringLiteral("sample_run"));
sample_run->setGeometry(QRect(20, 100, 41, 41));
sample_run->setAcceptDrops(false);
sample_run->setAutoFillBackground(false);
sample_run->setStyleSheet(QLatin1String("border-radius:5px;border-width:0px;\n"
""));
sample_run->setInputMethodHints(Qt::ImhNone);
QIcon icon2;
icon2.addFile(QStringLiteral(":/BoVWTrainer/Resources/ooopic_1489847909.ico"), QSize(), QIcon::Normal, QIcon::Off);
sample_run->setIcon(icon2);
sample_run->setIconSize(QSize(48, 48));
sample_stop = new QToolButton(groupBox_4);
sample_stop->setObjectName(QStringLiteral("sample_stop"));
sample_stop->setGeometry(QRect(130, 100, 41, 41));
sample_stop->setAcceptDrops(false);
sample_stop->setAutoFillBackground(false);
sample_stop->setStyleSheet(QLatin1String("border-radius:5px;border-width:0px;\n"
""));
sample_stop->setInputMethodHints(Qt::ImhNone);
QIcon icon3;
icon3.addFile(QStringLiteral(":/BoVWTrainer/Resources/ooopic_1489847941.ico"), QSize(), QIcon::Normal, QIcon::Off);
sample_stop->setIcon(icon3);
sample_stop->setIconSize(QSize(48, 48));
groupBox = new QGroupBox(centralWidget);
groupBox->setObjectName(QStringLiteral("groupBox"));
groupBox->setGeometry(QRect(370, 280, 296, 151));
groupBox->setFont(font);
groupBox->setAcceptDrops(false);
groupBox->setToolTipDuration(-1);
groupBox->setStyleSheet(QString::fromUtf8("background-color: qlineargradient(spread:pad, x1:0.550773, y1:1, x2:0.551136, y2:0.023, stop:0 rgba(78, 114, 238, 255), stop:1 rgba(255, 255, 255, 255));\n"
"font: 75 10pt \"\345\256\213\344\275\223\";\n"
"color: rgb(0, 0, 81);"));
groupBox->setFlat(false);
groupBox->setCheckable(false);
label_6 = new QLabel(groupBox);
label_6->setObjectName(QStringLiteral("label_6"));
label_6->setGeometry(QRect(15, 30, 71, 21));
label_6->setStyleSheet(QLatin1String("background-color: rgb(255, 255, 255,0);\n"
"color: rgb(0, 0, 81);"));
trainbovw_feature = new QComboBox(groupBox);
trainbovw_feature->setObjectName(QStringLiteral("trainbovw_feature"));
trainbovw_feature->setGeometry(QRect(80, 30, 61, 21));
trainbovw_feature->setFont(font);
trainbovw_feature->setAutoFillBackground(false);
trainbovw_feature->setStyleSheet(QStringLiteral("background-color: rgb(255, 255, 220);"));
trainbovw_feature->setMaxVisibleItems(8);
trainbovw_feature->setInsertPolicy(QComboBox::InsertAtCurrent);
bovw_levels = new QSpinBox(groupBox);
bovw_levels->setObjectName(QStringLiteral("bovw_levels"));
bovw_levels->setGeometry(QRect(235, 25, 31, 21));
bovw_levels->setStyleSheet(QStringLiteral("background-color: rgb(255, 255, 220);"));
bovw_levels->setMinimum(4);
bovw_levels->setMaximum(12);
label_7 = new QLabel(groupBox);
label_7->setObjectName(QStringLiteral("label_7"));
label_7->setGeometry(QRect(165, 25, 56, 21));
QSizePolicy sizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
sizePolicy.setHorizontalStretch(0);
sizePolicy.setVerticalStretch(0);
sizePolicy.setHeightForWidth(label_7->sizePolicy().hasHeightForWidth());
label_7->setSizePolicy(sizePolicy);
label_7->setFont(font);
label_7->setStyleSheet(QLatin1String("background-color: rgb(255, 255, 255,0);\n"
"color: rgb(0, 0, 79);"));
bovw_branches = new QSpinBox(groupBox);
bovw_branches->setObjectName(QStringLiteral("bovw_branches"));
bovw_branches->setGeometry(QRect(235, 55, 31, 21));
bovw_branches->setStyleSheet(QStringLiteral("background-color: rgb(255, 255, 220);"));
bovw_branches->setMinimum(2);
bovw_branches->setMaximum(10);
bovw_branches->setValue(2);
label_8 = new QLabel(groupBox);
label_8->setObjectName(QStringLiteral("label_8"));
label_8->setGeometry(QRect(160, 55, 66, 21));
sizePolicy.setHeightForWidth(label_8->sizePolicy().hasHeightForWidth());
label_8->setSizePolicy(sizePolicy);
label_8->setFont(font);
label_8->setStyleSheet(QLatin1String("background-color: rgb(255, 255, 255,0);\n"
"color: rgb(0, 0, 79);"));
trainbovw_pause = new QToolButton(groupBox);
trainbovw_pause->setObjectName(QStringLiteral("trainbovw_pause"));
trainbovw_pause->setGeometry(QRect(75, 100, 41, 41));
trainbovw_pause->setAcceptDrops(false);
trainbovw_pause->setAutoFillBackground(false);
trainbovw_pause->setStyleSheet(QLatin1String("border-radius:5px;border-width:0px;\n"
""));
trainbovw_pause->setInputMethodHints(Qt::ImhNone);
trainbovw_pause->setIcon(icon1);
trainbovw_pause->setIconSize(QSize(48, 48));
trainbovw_run = new QToolButton(groupBox);
trainbovw_run->setObjectName(QStringLiteral("trainbovw_run"));
trainbovw_run->setGeometry(QRect(20, 100, 41, 41));
trainbovw_run->setAcceptDrops(false);
trainbovw_run->setAutoFillBackground(false);
trainbovw_run->setStyleSheet(QLatin1String("border-radius:5px;border-width:0px;\n"
""));
trainbovw_run->setInputMethodHints(Qt::ImhNone);
trainbovw_run->setIcon(icon2);
trainbovw_run->setIconSize(QSize(48, 48));
trainbovw_stop = new QToolButton(groupBox);
trainbovw_stop->setObjectName(QStringLiteral("trainbovw_stop"));
trainbovw_stop->setGeometry(QRect(130, 100, 41, 41));
trainbovw_stop->setAcceptDrops(false);
trainbovw_stop->setAutoFillBackground(false);
trainbovw_stop->setStyleSheet(QLatin1String("border-radius:5px;border-width:0px;\n"
""));
trainbovw_stop->setInputMethodHints(Qt::ImhNone);
trainbovw_stop->setIcon(icon3);
trainbovw_stop->setIconSize(QSize(48, 48));
BoVWTrainerClass->setCentralWidget(centralWidget);
menuBar = new QMenuBar(BoVWTrainerClass);
menuBar->setObjectName(QStringLiteral("menuBar"));
menuBar->setGeometry(QRect(0, 0, 680, 23));
menuBar->setStyleSheet(QStringLiteral("background-color: rgb(200, 220, 255);"));
menu = new QMenu(menuBar);
menu->setObjectName(QStringLiteral("menu"));
BoVWTrainerClass->setMenuBar(menuBar);
mainToolBar = new QToolBar(BoVWTrainerClass);
mainToolBar->setObjectName(QStringLiteral("mainToolBar"));
BoVWTrainerClass->addToolBar(Qt::TopToolBarArea, mainToolBar);
statusBar = new QStatusBar(BoVWTrainerClass);
statusBar->setObjectName(QStringLiteral("statusBar"));
BoVWTrainerClass->setStatusBar(statusBar);
menuBar->addAction(menu->menuAction());
menu->addAction(actionHelp);
menu->addAction(actionExit);
retranslateUi(BoVWTrainerClass);
QObject::connect(sample_detector, SIGNAL(currentTextChanged(QString)), BoVWTrainerClass, SLOT(setFeatureType()));
QObject::connect(sample_extractor, SIGNAL(currentIndexChanged(QString)), BoVWTrainerClass, SLOT(setFeatureType()));
QObject::connect(open_camera, SIGNAL(currentTextChanged(QString)), BoVWTrainerClass, SLOT(setCamera()));
QObject::connect(button_select_in_path_2, SIGNAL(released()), BoVWTrainerClass, SLOT(selectDatasetPath()));
QObject::connect(sample_run, SIGNAL(released()), BoVWTrainerClass, SLOT(runSampling()));
QObject::connect(sample_pause, SIGNAL(released()), BoVWTrainerClass, SLOT(pauseSampling()));
QObject::connect(sample_stop, SIGNAL(released()), BoVWTrainerClass, SLOT(stopSampling()));
QObject::connect(trainbovw_feature, SIGNAL(currentIndexChanged(QString)), BoVWTrainerClass, SLOT(setBoVWFeatureType()));
QObject::connect(bovw_levels, SIGNAL(valueChanged(int)), BoVWTrainerClass, SLOT(setBoVWlevels()));
QObject::connect(bovw_branches, SIGNAL(valueChanged(int)), BoVWTrainerClass, SLOT(setBoVWbranches()));
QObject::connect(trainbovw_run, SIGNAL(released()), BoVWTrainerClass, SLOT(runBoVWtrain()));
QObject::connect(trainbovw_pause, SIGNAL(released()), BoVWTrainerClass, SLOT(pauseBoVWtrain()));
QObject::connect(trainbovw_stop, SIGNAL(released()), BoVWTrainerClass, SLOT(stopBoVWtrain()));
QObject::connect(open_camera, SIGNAL(highlighted(QString)), BoVWTrainerClass, SLOT(updateCameraInfo()));
QObject::connect(actionHelp, SIGNAL(triggered()), BoVWTrainerClass, SLOT(openHelp()));
QObject::connect(actionExit, SIGNAL(triggered()), BoVWTrainerClass, SLOT(close()));
QMetaObject::connectSlotsByName(BoVWTrainerClass);
} // setupUi
void retranslateUi(QMainWindow *BoVWTrainerClass)
{
BoVWTrainerClass->setWindowTitle(QApplication::translate("BoVWTrainerClass", "BoVWTrainer", 0));
actionHelp->setText(QApplication::translate("BoVWTrainerClass", "Help", 0));
actionExit->setText(QApplication::translate("BoVWTrainerClass", "Exit", 0));
show_im_feature->setText(QApplication::translate("BoVWTrainerClass", "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n"
"<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n"
"p, li { white-space: pre-wrap; }\n"
"</style></head><body style=\" font-family:'SimSun'; font-size:9pt; font-weight:400; font-style:normal;\">\n"
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p></body></html>", 0));
text_showfile->setHtml(QApplication::translate("BoVWTrainerClass", "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n"
"<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n"
"p, li { white-space: pre-wrap; }\n"
"</style></head><body style=\" font-family:'SimSun'; font-size:9pt; font-weight:400; font-style:normal;\">\n"
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p></body></html>", 0));
text_showfile->setPlaceholderText(QString());
groupBox_4->setTitle(QApplication::translate("BoVWTrainerClass", "\347\211\271\345\276\201\351\207\207\346\240\267", 0));
label_2->setText(QApplication::translate("BoVWTrainerClass", "<html><head/><body><p><span style=\" font-weight:400;\">\346\243\200\346\265\213\345\231\250</span></p></body></html>", 0));
sample_detector->clear();
sample_detector->insertItems(0, QStringList()
<< QApplication::translate("BoVWTrainerClass", "SURF", 0)
<< QApplication::translate("BoVWTrainerClass", "SIFT", 0)
<< QApplication::translate("BoVWTrainerClass", "ORB", 0)
<< QApplication::translate("BoVWTrainerClass", "BRISK", 0)
<< QApplication::translate("BoVWTrainerClass", "FAST", 0)
<< QApplication::translate("BoVWTrainerClass", "GFTT", 0)
<< QApplication::translate("BoVWTrainerClass", "MSER", 0)
<< QApplication::translate("BoVWTrainerClass", "STAR", 0)
<< QApplication::translate("BoVWTrainerClass", "HARRIS", 0)
);
label_3->setText(QApplication::translate("BoVWTrainerClass", "<html><head/><body><p><span style=\" font-weight:400;\">\346\217\217\350\277\260\345\255\220</span></p></body></html>", 0));
sample_extractor->clear();
sample_extractor->insertItems(0, QStringList()
<< QApplication::translate("BoVWTrainerClass", "SURF", 0)
<< QApplication::translate("BoVWTrainerClass", "SIFT", 0)
<< QApplication::translate("BoVWTrainerClass", "ORB", 0)
<< QApplication::translate("BoVWTrainerClass", "BRISK", 0)
<< QApplication::translate("BoVWTrainerClass", "BRIEF", 0)
<< QApplication::translate("BoVWTrainerClass", "FREAK", 0)
);
groupBox_3->setTitle(QString());
button_select_in_path_2->setText(QString());
load_dataset->setText(QApplication::translate("BoVWTrainerClass", "<html><head/><body><p>\350\257\273\345\217\226\346\225\260\346\215\256\351\233\206</p></body></html>", 0));
label_4->setText(QApplication::translate("BoVWTrainerClass", "<html><head/><body><p>\345\220\257\347\224\250\346\221\204\345\203\217\345\244\264</p></body></html>", 0));
open_camera->clear();
open_camera->insertItems(0, QStringList()
<< QApplication::translate("BoVWTrainerClass", "\344\270\215\345\274\200\345\220\257", 0)
);
sample_pause->setText(QString());
sample_run->setText(QString());
sample_stop->setText(QApplication::translate("BoVWTrainerClass", "\345\201\234\346\255\242", 0));
groupBox->setTitle(QApplication::translate("BoVWTrainerClass", "BoVW\350\256\255\347\273\203", 0));
label_6->setText(QApplication::translate("BoVWTrainerClass", "<html><head/><body><p>\347\211\271\345\276\201\347\261\273\345\236\213</p></body></html>", 0));
trainbovw_feature->clear();
trainbovw_feature->insertItems(0, QStringList()
<< QApplication::translate("BoVWTrainerClass", "SURF", 0)
<< QApplication::translate("BoVWTrainerClass", "SIFT", 0)
<< QApplication::translate("BoVWTrainerClass", "ORB", 0)
<< QApplication::translate("BoVWTrainerClass", "BRISK", 0)
<< QApplication::translate("BoVWTrainerClass", "BRIEF \345\273\272\350\256\256\347\224\250SURF/SIFT\347\211\271\345\276\201", 0)
<< QApplication::translate("BoVWTrainerClass", "FREAK \345\273\272\350\256\256\347\224\250SURF/SIFT\347\211\271\345\276\201", 0)
);
label_7->setText(QApplication::translate("BoVWTrainerClass", "BoVW\345\261\202\346\225\260", 0));
label_8->setText(QApplication::translate("BoVWTrainerClass", "\346\257\217\345\261\202\345\210\206\346\224\257\346\225\260", 0));
trainbovw_pause->setText(QString());
trainbovw_run->setText(QString());
trainbovw_stop->setText(QApplication::translate("BoVWTrainerClass", "\345\201\234\346\255\242", 0));
menu->setTitle(QApplication::translate("BoVWTrainerClass", "\350\217\234\345\215\225", 0));
} // retranslateUi
};
namespace Ui {
class BoVWTrainerClass: public Ui_BoVWTrainerClass {};
} // namespace Ui
QT_END_NAMESPACE
#endif // UI_BOVWTRAINER_H
|
61f925e66bb52b5b20b7158bc6cc11d16cc00dab | cc3b2f2d0b32fd30d7a5b586af82d6548a93b21a | /PropHunt_Game/src/Components/VictoryCheck.h | 64ef1c27d4dff5fede896c1170ac041f9dc1438d | [] | no_license | AndreiRafael/PropHunt_Multiplayer | 5398f9f659647e38d271933871b985c259f23cbe | 62f69c5a73a338b154e0dfd8570191353d8ed3ed | refs/heads/master | 2020-04-06T06:25:56.472422 | 2016-11-25T15:40:09 | 2016-11-25T15:40:09 | 73,871,973 | 0 | 0 | null | 2016-11-18T22:49:59 | 2016-11-16T01:38:40 | C | UTF-8 | C++ | false | false | 1,339 | h | VictoryCheck.h | #pragma once
#include <HifireLibrary.h>
#include <UDPComponent.h>
class VictoryCheck : public Component{
public:
UDPComponent* udpComp;
HudRenderer* rend;
private:
bool ended = false;
bool HuntWon(){
bool propsDead = true;
for (int i = 0; i < NUM_PLAYERS; i++){
if (udpComp->propArray[i]->IsActive())
propsDead = false;
}
if (propsDead){
for (int i = 0; i < NUM_PLAYERS; i++){
if (udpComp->hunterArray[i]->IsActive())
return true;
}
}
return false;
}
bool PropWon(){
bool huntersDead = true;
for (int i = 0; i < NUM_PLAYERS; i++){
if (udpComp->hunterArray[i]->IsActive())
huntersDead = false;
}
if (huntersDead){
for (int i = 0; i < NUM_PLAYERS; i++){
if (udpComp->propArray[i]->IsActive())
return true;
}
}
return false;
}
//Start is called at the start of a scene
void Start(){
rend = GetComponent<HudRenderer>();
rend->SetEnabled(false);
rend->SetTexture("sprintes/apres/huntWin.png");
}
//Update is called once per frame
void Update(){
if (!ended){
if (HuntWon()){
std::cout << "HuntWon" << std::endl;
rend->SetEnabled(true);
rend->SetTexture("sprintes/apres/huntWin.png");
ended = true;
}
if (PropWon()){
rend->SetEnabled(true);
rend->SetTexture("sprintes/apres/propWin.png");
ended = true;
}
}
}
}; |
1aaae56cf3f85a13d2eb238419adec4130be1ce2 | d021b7c69ccb0e485c5304246a278f8b6978f3ef | /1141.cpp | 6cdbd6ca82e3ae670739e836e3883bf279483e54 | [] | no_license | caoshen/codehdu | bb888e23691cc7a713017ad942ae39591340b641 | 97672d29d2b123d3d209dedd1637ecc0e1524c85 | refs/heads/master | 2016-09-06T03:11:24.209846 | 2014-07-18T09:27:46 | 2014-07-18T09:27:46 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 288 | cpp | 1141.cpp | /**1141
**/
#include <iostream>
#include <cmath>
using namespace std;
int main() {
int y;
while (cin >> y , y ) {
int n = pow(2.0, (y - 1960) / 10) * 4;
int num = 1;
double sum = 0;
while (sum <= n) {
sum += log(num++) / log(2);
}
num--;
cout << --num << endl;
}
}
|
4082e0bf30838306d963bffbf352c7b6e645b30d | a5673b7665482ecc069ffab5464076ae38968987 | /spheroidal/sphwv/adder.hpp | 90a9e9e8aebbda522c06d5195983a776f9629e24 | [
"BSD-2-Clause"
] | permissive | leewujung/scattering | b3dd5eaf712bde85990c37a947624925c6787aea | 68ffea5605d9da87db0593ba7c56c7f60f6b3fae | refs/heads/master | 2020-04-10T06:54:56.734530 | 2018-03-04T23:15:11 | 2018-03-04T23:15:11 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,799 | hpp | adder.hpp | //
// Copyright (c) 2014, Ross Adelman, Nail A. Gumerov, and Ramani Duraiswami
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
#ifndef ADDER_HPP
#define ADDER_HPP
#include "real.hpp"
#include <vector>
class adder
{
public:
std::vector<real> addends;
real prev_sum;
adder();
void clear();
void add(const real & a);
real calculate_sum();
};
class complex_adder
{
public:
adder real_adder;
adder imag_adder;
complex_adder();
void clear();
void add(const complex & a);
complex calculate_sum();
};
#endif
|
37812fbe0c46ccb98c9183565b8fa21fbb24d9a8 | 2d000b353e54ebb6f55d281d567f46be369b8cc6 | /src/python/corrade/bootstrap.h | 5278628cf33f4692e48d42d3ab1ef1df30147d53 | [
"MIT"
] | permissive | mosra/magnum-bindings | cb31ab52501bed22eddfa3d4688de56e902f22d8 | 93f9eb814bf8532129e1fa4a241bca3a0b69e4e6 | refs/heads/master | 2023-08-02T22:54:48.539927 | 2023-07-23T10:49:03 | 2023-07-23T10:49:03 | 184,422,650 | 20 | 11 | NOASSERTION | 2022-11-29T23:17:22 | 2019-05-01T13:46:31 | C++ | UTF-8 | C++ | false | false | 1,974 | h | bootstrap.h | #ifndef corrade_h
#define corrade_h
/*
This file is part of Magnum.
Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019,
2020, 2021, 2022, 2023 Vladimír Vondruš <mosra@centrum.cz>
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
*/
#include <pybind11/detail/common.h> /* for PYBIND11_VERSION_* */
namespace pybind11 {
/* pybind11 2.6 changes py::module to py::module_ to be compatible with C++
modules. In order to be forward-compatible, we use module_ everywhere
and define it as an alias to module on < 2.6 */
#if PYBIND11_VERSION_MAJOR*100 + PYBIND11_VERSION_MINOR >= 206
class module_;
#else
class module;
typedef module module_;
#endif
}
namespace Corrade {}
namespace corrade {
using namespace Corrade;
namespace py = pybind11;
void containers(py::module_& m);
void pluginmanager(py::module_& m);
void utility(py::module_& m);
}
#endif
|
9aed3d95ff71e717b4c18825fb8331fc2d352ab8 | 88a759d540bbd1c59a4d6558b357c78dfd875d88 | /cppprimer/firstread/prog28.cc | 13db42494540c9055997197b2ae254980ca0624a | [] | no_license | ivantan/cppdevelopment | 20d7df1de7145378af9919989f1a1455cd64884b | aa7ac87c98afbda167ea55dfef1687d6a4455bcd | refs/heads/master | 2016-08-03T05:42:06.446905 | 2015-08-24T13:41:17 | 2015-08-24T13:41:17 | 28,193,100 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 460 | cc | prog28.cc | // Chap 3: String, Vectors, and Arrays
// 'string' type
#include <iostream>
using std::cin;
using std::cout;
using std::endl;
using std::string;
int main()
{
string s; // s1 is the empty string
cin >> s;
cout << s << endl;
return 0;
// if the input is two words, 'Hello World'
// only 'Hello' will be printed out
// to print both words, you need to chain
// multiple reads and writes, as we have
// done in the previous programs
return 0;
}
|
e1f1fcdd95055d372e94fa061903d81402f386d0 | 729504b2cd94f8d190f459f1f7f367b1a27d3e69 | /src/test/InputSignals.h | 5b70c538a099bd236e89578205a564aa8e8f700a | [
"MIT"
] | permissive | vallant/reta | 76acc08101a010351df4e208695c246ff7536f0d | f9eb515a956ebdb8163beda0cd927dfc64875b62 | refs/heads/develop | 2023-02-28T16:26:25.998866 | 2021-02-01T16:56:20 | 2021-02-01T16:56:20 | 322,025,016 | 2 | 0 | MIT | 2021-02-01T16:56:21 | 2020-12-16T15:33:44 | C++ | UTF-8 | C++ | false | false | 873 | h | InputSignals.h | #pragma once
#include <buffer/Buffer.h>
using InputSignal = std::pair<const char*, int>;
/* A class to hold all available input signals */
class InputSignals
{
public:
/* Initialize the input signals */
InputSignals();
/* Return the number of input signals */
static size_t size();
/* Get the signal at index */
Buffer get (size_t index) const;
/* Return a vector of the original signal partitioned into blocks, and replicated for all input channels */
std::vector<Buffer> get (size_t index, size_t blockSize, double sampleRate,
const juce::AudioProcessor::BusesLayout& layout) const;
/* Return the number of samples each input signal has */
size_t numSamples() const;
private:
static std::vector<InputSignal> signals();
std::vector<Buffer> inputBuffers;
};
|
e88daa0e7aee742996dfa526726893876d6a121a | a373dfebbc35c9fbcf41120b664560c48777b90d | /VolumeRender.cpp | 517c0211506d687c72af3d37532c51a8de121de0 | [] | no_license | hopexn/DVR_RayTracing | 7c13e0c132947dd8c49b10c149ee07da9384929c | 3c65cc3f3a21418ed6645ec370c1b4e3c40d7d67 | refs/heads/master | 2020-04-14T04:10:46.612295 | 2018-12-31T00:42:10 | 2018-12-31T00:42:10 | 163,627,813 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 7,483 | cpp | VolumeRender.cpp | #include "VolumeRender.h"
#include <iostream>
#include <QLabel>
#include <QPixmap>
#define VOLUME_MAXIMUM_VALUE 255
using namespace std;
VolumeRender::VolumeRender(QWidget *parent) : QWidget(parent) {
width = 256;
height = 256;
this->setFixedWidth(width);
this->setFixedHeight(height);
image = new QImage(width, height, QImage::Format_RGB32);
cam_pos_init = vec3(0.0f, 0.0f, 6.0f);
cam_right_init = vec3(1.0f, 0.0f, 0.0f);
cam_screen_dist = 4.0f;
rotationX = 0;
rotationY = 0;
rotationZ = 0;
rotate();
}
void VolumeRender::paintEvent(QPaintEvent *event) {
QPainter painter(this);
if (image == NULL) {
cout << "Image is NULL" << endl;
return;
}
QRect rect(0, 0, image->width(), image->height());
painter.drawImage(rect, *image);
cout << "Paint completed" << endl;
}
void VolumeRender::updateVolume(string filename) {
volume.loadRawData(filename.c_str());
}
/**
* 为每一个面编号:
* 底: 1
* 左: 2
* 后: 3
* 右: 4
* 前: 5
* 上: 6
*/
float VolumeRender::caculate_enter_leave(vec3 ray_dir, int enter_or_leave) {
float lamda = 0.0f;
vec3 dst_pos;
if ((cam_pos.x > 0.0f) ^ enter_or_leave) {
lamda = (0.5f * volume.xfSize - cam_pos.x) / ray_dir.x;
} else {
lamda = (-0.5f * volume.xfSize - cam_pos.x) / ray_dir.x;
}
dst_pos = cam_pos + lamda * ray_dir;
if (dst_pos.y > -0.5f * volume.yfSize && dst_pos.y < 0.5f * volume.yfSize
&& dst_pos.z > -0.5f * volume.zfSize && dst_pos.z < 0.5f * volume.zfSize) {
return lamda;
}
if ((cam_pos.y > 0.0f) ^ enter_or_leave) {
lamda = (0.5f * volume.yfSize - cam_pos.y) / ray_dir.y;
} else {
lamda = (-0.5f * volume.yfSize - cam_pos.y) / ray_dir.y;
}
dst_pos = cam_pos + lamda * ray_dir;
if (dst_pos.x > -0.5f * volume.xfSize && dst_pos.x < 0.5f * volume.xfSize
&& dst_pos.z > -0.5f * volume.zfSize && dst_pos.z < 0.5f * volume.zfSize) {
return lamda;
}
if ((cam_pos.z > 0.0f) ^ enter_or_leave) {
lamda = (0.5f * volume.zfSize - cam_pos.z) / ray_dir.z;
} else {
lamda = (-0.5f * volume.zfSize - cam_pos.z) / ray_dir.z;
}
dst_pos = cam_pos + lamda * ray_dir;
if (dst_pos.x > -0.5f * volume.xfSize && dst_pos.x < 0.5f * volume.xfSize
&& dst_pos.y > -0.5f * volume.yfSize && dst_pos.y < 0.5f * volume.yfSize) {
return lamda;
}
if (!enter_or_leave) {
return INFINITY;
} else {
return 0;
}
}
void VolumeRender::updateImage() {
// 1. 从前向后
// C'(i+1) = C(i) + (1 - A(i)) * C'(i)
// - C'(x) 表示从起点到x的累积光强
// - C(x) 表示x点发光强度
// - A(x) 表示x点的不透明度
//
// 2. 从后到前
// C'(i) = C'(i + 1) + (1 - A'(i+1)) * C(i)
// A'(i) = A'(i + 1) + (1 - A'(i+1)) * A(i)
// - C'(x)表示从x到终点所有能到终点的光强之和
// - C(x)表示x点的发光强度
// - A'(x)表示从x点到终点的不透明度
float threshold = 1.0f;
vec3 screen_center = cam_screen_dist * cam_dir + cam_pos;
for (int i = 0; i < width; i++) {
for (int j = 0; j < height; j++) {
vec3 pixel_pos = screen_center
+ (-0.5f + 1.0f * i / width) * cam_right
+ (-0.5f + 1.0f * j / height) * cam_up;
//光线方向
vec3 ray_dir = fastNormalize(pixel_pos - cam_pos);
//计算进入点与离开点
float begin = caculate_enter_leave(ray_dir, 0);
float end = caculate_enter_leave(ray_dir, 1);
glm::vec3 color_cum(0, 0, 0);
float opacity_cum = 0;
for (int k = 0; begin + k * volume.step_dist < end; k++) {
vec3 pos = cam_pos + (begin + k * volume.step_dist) * ray_dir;
float value = volume.getVolumeValue(pos);
glm::vec4 color_and_alpha = volume.tf1d.trans_func(value);
color_cum.r = glm::min(color_cum.r + (1.0f - opacity_cum) * color_and_alpha.r, threshold);
color_cum.g = glm::min(color_cum.g + (1.0f - opacity_cum) * color_and_alpha.g, threshold);
color_cum.b = glm::min(color_cum.b + (1.0f - opacity_cum) * color_and_alpha.b, threshold);
opacity_cum = glm::min(opacity_cum + (1.0f - opacity_cum) * color_and_alpha.a, threshold);
if (opacity_cum >= threshold) break;
}
image->setPixel(i, j, qRgb((int) (255 * (1 - color_cum.r)),
(int) (255 * (1 - color_cum.g)),
(int) (255 * (1 - color_cum.b))));
}
}
cout << "Update Image completed" << endl;
}
void VolumeRender::mousePressEvent(QMouseEvent *event) {
last_pos = event->pos();
}
void VolumeRender::mouseMoveEvent(QMouseEvent *event) {
float dx = float(event->x() - last_pos.x()) / width;
float dy = float(event->y() - last_pos.y()) / height;
if (event->buttons() & Qt::LeftButton) {
rotationX += 3.14 * dx;
rotationY += 3.14 * dy;
rotate();
updateImage();
repaint();
}
last_pos = event->pos();
}
void VolumeRender::rotate() {
if (rotationX == 0 && rotationY == 0) {
cam_pos = cam_pos_init;
cam_right = cam_right_init;
cam_dir = fastNormalize(volume.center - cam_pos);
cam_up = fastNormalize(cross(cam_dir, cam_right));
return;
}
vec3 axis = fastNormalize(cross(vec3(0, 0, 1), vec3(rotationX, rotationY, 0)));
int sign = rotationX * rotationY > 0 ? 1 : -1;
float theta = (float) (glm::sqrt(glm::pow(rotationX, 2) + glm::pow(rotationY, 2)));
float u = axis.x;
float v = axis.y;
float w = axis.z;
float m00, m01, m02, m10, m11, m12, m20, m21, m22;
m00 = cosf(theta) + (u * u) * (1 - cosf(theta));
m01 = u * v * (1 - cosf(theta)) + w * sinf(theta);
m02 = u * w * (1 - cosf(theta)) - v * sinf(theta);
m10 = u * v * (1 - cosf(theta)) - w * sinf(theta);
m11 = cosf(theta) + v * v * (1 - cosf(theta));
m12 = w * v * (1 - cosf(theta)) + u * sinf(theta);
m20 = u * w * (1 - cosf(theta)) + v * sinf(theta);
m21 = v * w * (1 - cosf(theta)) - u * sinf(theta);
m22 = cosf(theta) + w * w * (1 - cosf(theta));
cam_pos.x = cam_pos_init.x * m00 + cam_pos_init.y * m01 + cam_pos_init.z * m02;
cam_pos.y = cam_pos_init.x * m10 + cam_pos_init.y * m11 + cam_pos_init.z * m12;
cam_pos.z = cam_pos_init.x * m20 + cam_pos_init.y * m21 + cam_pos_init.z * m22;
cam_right.x = cam_right_init.x * m00 + cam_right_init.y * m01 + cam_right_init.z * m02;
cam_right.y = cam_right_init.x * m10 + cam_right_init.y * m11 + cam_right_init.z * m12;
cam_right.z = cam_right_init.x * m20 + cam_right_init.y * m21 + cam_right_init.z * m22;
cam_dir = fastNormalize(volume.center - cam_pos);
cam_up = fastNormalize(cross(cam_dir, cam_right));
double dist = glm::pow(cam_pos.x, 2) + glm::pow(cam_pos.y, 2) + glm::pow(cam_pos.z, 2);
cout << "cam_pos:" << cam_pos.x << " " << cam_pos.y << " " << cam_pos.z << " " << dist << endl;
cout << "cam_right:" << cam_right.x << " " << cam_right.y << " " << cam_right.z << endl;
cout << "cam_up:" << cam_up.x << " " << cam_up.y << " " << cam_up.z << endl;
cout << "rotate:" << rotationX << " " << rotationY << " " << rotationZ << endl;
}
|
e0b81aa76f979fc7b60dd0bdf6d8ec1c9d91ad1f | fb0f9abad373cd635c2635bbdf491ea0f32da5ff | /src/coreclr/pal/inc/rt/weakreference.h | d0b88d62e6c1565144f321eb8cb0ef4fdf2acea7 | [
"MIT"
] | permissive | dotnet/runtime | f6fd23936752e202f8e4d6d94f3a4f3b0e77f58f | 47bb554d298e1e34c4e3895d7731e18ad1c47d02 | refs/heads/main | 2023-09-03T15:35:46.493337 | 2023-09-03T08:13:23 | 2023-09-03T08:13:23 | 210,716,005 | 13,765 | 5,179 | MIT | 2023-09-14T21:58:52 | 2019-09-24T23:36:39 | C# | UTF-8 | C++ | false | false | 2,512 | h | weakreference.h | // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
//
//
// ===========================================================================
// File: weakreference.h
//
// ===========================================================================
// simplified weakreference.h for PAL
#include "rpc.h"
#include "rpcndr.h"
#include "unknwn.h"
#ifndef __IInspectable_INTERFACE_DEFINED__
#define __IInspectable_INTERFACE_DEFINED__
typedef struct HSTRING__{
int unused;
} HSTRING__;
typedef HSTRING__* HSTRING;
typedef /* [v1_enum] */
enum TrustLevel
{
BaseTrust = 0,
PartialTrust = ( BaseTrust + 1 ) ,
FullTrust = ( PartialTrust + 1 )
} TrustLevel;
// AF86E2E0-B12D-4c6a-9C5A-D7AA65101E90
const IID IID_IInspectable = { 0xaf86e2e0, 0xb12d, 0x4c6a, { 0x9c, 0x5a, 0xd7, 0xaa, 0x65, 0x10, 0x1e, 0x90} };
MIDL_INTERFACE("AF86E2E0-B12D-4c6a-9C5A-D7AA65101E90")
IInspectable : public IUnknown
{
public:
virtual HRESULT STDMETHODCALLTYPE GetIids(
/* [out] */ ULONG * iidCount,
/* [size_is][size_is][out] */ IID * *iids) = 0;
virtual HRESULT STDMETHODCALLTYPE GetRuntimeClassName(
/* [out] */ HSTRING * className) = 0;
virtual HRESULT STDMETHODCALLTYPE GetTrustLevel(
/* [out] */ TrustLevel * trustLevel) = 0;
};
#endif // __IInspectable_INTERFACE_DEFINED__
#ifndef __IWeakReference_INTERFACE_DEFINED__
#define __IWeakReference_INTERFACE_DEFINED__
// 00000037-0000-0000-C000-000000000046
const IID IID_IWeakReference = { 0x00000037, 0x0000, 0x0000, { 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46} };
MIDL_INTERFACE("00000037-0000-0000-C000-000000000046")
IWeakReference : public IUnknown
{
public:
virtual HRESULT STDMETHODCALLTYPE Resolve(
/* [in] */ REFIID riid,
/* [iid_is][out] */ IInspectable **objectReference) = 0;
};
#endif // __IWeakReference_INTERFACE_DEFINED__
#ifndef __IWeakReferenceSource_INTERFACE_DEFINED__
#define __IWeakReferenceSource_INTERFACE_DEFINED__
// 00000038-0000-0000-C000-000000000046
const IID IID_IWeakReferenceSource = { 0x00000038, 0x0000, 0x0000, { 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46} };
MIDL_INTERFACE("00000038-0000-0000-C000-000000000046")
IWeakReferenceSource : public IUnknown
{
public:
virtual HRESULT STDMETHODCALLTYPE GetWeakReference(
/* [retval][out] */ IWeakReference * *weakReference) = 0;
};
#endif // __IWeakReferenceSource_INTERFACE_DEFINED__
|
92a860c5b409caf0ca83aca63b1dab6a04299de7 | 4a95ed16ad5f59a7fe5493716f60138518704a74 | /IC_server/win_admin_tcp.cpp | bd6ac2288f37e210a54f53fc22e9e2a5417dcabf | [] | no_license | tingroger/IntelligentCommunity | 2096c15e0db8c20cc6977c2eecf91bacc936c180 | 726eaa57542a5fc08f6fba7c9fb79a6ebeecebbc | refs/heads/master | 2023-03-18T20:37:01.208761 | 2020-12-08T22:38:07 | 2020-12-08T22:38:07 | 319,767,062 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 5,174 | cpp | win_admin_tcp.cpp | #include "win_admin.h"
#include "ui_win_admin.h"
#include <QFileInfo>
void WinAdmin::init_tcp_server()
{
server = new QTcpServer;
//监听客户端
if(!server->listen(QHostAddress::Any,SERVER_PORT))
{
qDebug() << "TCP server listen failed";
return;
}
//建立newConnection信号的槽连接
connect(server,&QTcpServer::newConnection,this, &WinAdmin::slot_new_client);
}
void WinAdmin::slot_new_client()
{
qDebug() << "TCP new connection";
//接受挂起的连接作为已连接的QTcpSocket
socket = server->nextPendingConnection();
//当客户端有信息(数据块)到达时,会发送readyRead(),建立与该信号对应的槽函数
connect(socket, &QTcpSocket::readyRead, this, &WinAdmin::slot_get_data);
}
void WinAdmin::slot_get_data()
{
QByteArray msg = socket->readAll();
QString ip = socket->peerAddress().toString();
qDebug() << "ip = " << ip;
qDebug() << "msg = " << msg;
QStringList info = QString::fromUtf8(msg).split(TCP_INFO_SEPARATOR);
int code = info[0].toInt();
qDebug() << "code = " << code;
switch(code)
{
case REGISTER_CODE:
tcp_register_new_user(info);
break;
case LOGIN_CODE:
tcp_user_login(info);
break;
case GET_VIDEO_CODE:
tcp_video_file(info);
break;
}
}
void WinAdmin::tcp_register_new_user(const QStringList &list)
{
User *newUser = new User;
newUser->set_user_role(resident);
newUser->set_user_account(list.at(1));
newUser->set_user_passwd(list.at(2));
newUser->set_user_phone(list.at(3).toULong());
QString registerACK;
registerACK += QString::number(REGISTER_ACK);
registerACK += TCP_INFO_SEPARATOR;
if(db->insert_new_user(*newUser))
{
init_user_table();
registerACK += "1";
}
else
{
registerACK += "0";
}
socket->write(registerACK.toUtf8());
}
void WinAdmin::tcp_user_login(const QStringList &list)
{
bool isNewUser = false;
QString loginACK;
loginACK += QString::number(LOGIN_ACK);
loginACK += TCP_INFO_SEPARATOR;
User user;
if(db->get_user_by_item(account, list.at(1), user) &&
list.at(2) == user.get_user_passwd())
{
loginACK += "1";
isNewUser = true;
}
else {
loginACK += "0";
}
socket->write(loginACK.toUtf8());
if(isNewUser)
{
static int row = 0;
ui->table_login_user->setRowCount(row+1);
QString ip = socket->peerAddress().toString();
qDebug() << "ip = " << ip;
qDebug() << "account = " << list.at(1);
QTableWidgetItem *newLoginIP = new QTableWidgetItem(ip);
QTableWidgetItem *newLoginAccount = new QTableWidgetItem(list.at(1));
ui->table_login_user->setItem(row, 0, newLoginIP);
ui->table_login_user->setItem(row, 1, newLoginAccount);
// ui->table_login_user->show();
++row;
}
}
void WinAdmin::tcp_video_file(const QStringList &list)
{
//文件名为空或者客户端已有该文件则返回
if(ui->label_video_filename->text() == "" ||
ui->label_video_filename->text() == list.at(1))
return;
//获取文件信息
QFileInfo fileinfo(ui->label_video_filename->text());
QString videoFileACK;
videoFileACK += QString::number(GET_VIDEO_ACK);
videoFileACK += TCP_INFO_SEPARATOR;
videoFileACK += (fileinfo.fileName() + TCP_INFO_SEPARATOR);
videoFileACK += (QString::number(fileinfo.size()) + TCP_INFO_SEPARATOR);
socket->write(videoFileACK.toUtf8());
//准备文件
videoFile.setFileName(ui->label_video_filename->text());
videoFile.open(QIODevice::ReadOnly);
//写入文件
static qint64 sendSize = 0;
while(sendSize < fileinfo.size())
{
QByteArray data = videoFile.read(TRANSFER_MAX_SIZE);
qint64 writed = socket->write(data);
sendSize += writed;
qDebug() << "send size = " << sendSize;
emit sig_send_video();
}
qDebug() << fileinfo.size();
qDebug() << videoFile.size();
if(sendSize == fileinfo.size())
{
qDebug() << "发送文件成功";
videoFile.close();
sendSize = 0;
}
else if(sendSize > fileinfo.size())
{
qDebug() << "发送文件失败";
videoFile.close();
sendSize = 0;
}
// connect(this, &WinAdmin::sig_send_video, this, &WinAdmin::slot_send_video_file);
// emit sig_send_video();
}
void WinAdmin::slot_send_video_file()
{
static qint64 sendSize = 0;
if(sendSize < videoFile.size())
{
QByteArray data = videoFile.read(TRANSFER_MAX_SIZE);
qint64 writed = socket->write(data);
qDebug() << "write size = "<< writed;
sendSize += writed;
emit sig_send_video();
}
else if(sendSize == videoFile.size())
{
videoFile.close();
sendSize = 0;
}
else
{
qDebug() << "发送文件失败";
}
}
|
655aeb709abeb278595540349a848838faf63fdc | 505ab4574ab1b72f38160ccc5b7a0c3e96aae23b | /wcrg/particle.cpp | d0efe926612761cbd277dd94a238f409125a6adf | [] | no_license | Huaguiyuan/codebase | fd67429336ce0c65fb920d75989f179a3fbfd266 | dedaa11970bae31d90ba5206c1b8ee0a84f5fa18 | refs/heads/master | 2020-03-23T09:13:49.504754 | 2017-05-26T18:56:15 | 2017-05-26T18:56:15 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,196 | cpp | particle.cpp | #include "particle.hpp"
particle::particle(const fermi_surface &fs, const hamiltonian &H): H_(H), fs_(fs)
{
patch_ = -1;
kk_ << 0.0, 0.0, 0.0;
bix_ = 0;
sp_ = 0;
}
particle::particle(int patch, int bix, int sp, const fermi_surface &fs, const hamiltonian &H): H_(H), fs_(fs)
{
patch_ = patch;
kk_ = fs_.get_kpt(patch,bix,sp);
bix_ = bix;
sp_ = sp;
}
particle::particle(Vector3d kk, int bix, int sp, const fermi_surface &fs, const hamiltonian &H): H_(H), fs_(fs)
{
patch_ = -1;
kk_ = kk;
bix_ = bix;
sp_ = sp;
}
particle& particle::operator= (const particle &other)
{
// avoid self-assignment
if ( this != &other )
{
patch_ = other.patch_;
kk_ = other.kk_;
bix_ = other.bix_;
sp_ = other.sp_;
}
return *this;
}
particle Pinv(const particle &other)
{
particle pp(other);
pp.Pinv();
return pp;
}
particle Tinv(const particle &other)
{
particle pp(other);
pp.Tinv();
return pp;
}
particle Sp(const particle &other)
{
particle pp(other);
pp.Sp();
return pp;
}
particle Uop(const particle &other, int op)
{
particle pp(other);
pp.Uop(op);
return pp;
}
cmplx charc(const particle &other, int op)
{
particle pp(other);
return pp.get_char(op);
}
particle::particle(const particle &other) : H_(other.H_), fs_(other.fs_)
{
patch_ = other.patch_;
kk_ = other.kk_;
bix_ = other.bix_;
sp_ = other.sp_;
}
ostream& operator<<(ostream& out, const particle& pp)
{
out.precision(8);
out << "patch = " << pp.get_patch() << " kk = " << setw(10) << right << (pp.get_kk()).transpose();
out << " bix = " << pp.get_bix() << " sp = " << pp.get_sp();
return out;
}
void particle::set_particle(int patch, int bix, int sp)
{
patch_ = patch;
kk_ = fs_.get_kpt(patch, bix, sp);
bix_ = bix;
sp_ = sp;
}
void particle::set_particle(Vector3d kk, int bix, int sp)
{
patch_ = -1;
kk_ = kk;
bix_ = bix;
sp_ = sp;
}
int particle::get_patch() const
{
return patch_;
}
Vector3d particle::get_kk() const
{
return kk_;
}
int particle::get_bix() const
{
return bix_;
}
int particle::get_sp() const
{
return sp_;
}
VectorXcd particle::get_state() const
{
MatrixXcd mat = H_.get_ham_eigmat(kk_);
return mat.col(fs_.ind(bix_,sp_));
}
double particle::get_en() const
{
return H_.get_ham_eigval(kk_, fs_.ind(bix_,sp_));
}
void particle::Tinv()
{
int k1m;
sp_ = (sp_ + 1) % 2;
if (patch_ == -1)
{
set_particle(-kk_, bix_, sp_);
}
else
{
k1m = fs_.get_minus(patch_, bix_, sp_);
set_particle(k1m, bix_, sp_);
}
}
void particle::Pinv()
{
int k1m;
if (patch_ == -1)
{
set_particle(-kk_, bix_, sp_);
}
else
{
k1m = fs_.get_minus(patch_, bix_, sp_);
set_particle(k1m, bix_, sp_);
}
}
void particle::Sp()
{
sp_ = (sp_ + 1) % 2;
set_particle(kk_, bix_, sp_);
}
void particle::Uop(int op)
{
int k1s;
if (patch_ == -1)
{
sym_rep sym;
set_particle(sym.get_k_op(op)*kk_, bix_, sp_);
}
else
{
k1s = fs_.sym_patch(patch_, bix_, sp_, op);
set_particle(k1s, bix_, sp_);
}
}
cmplx particle::get_char(int op)
{
if (patch_ == -1)
{
return fs_.get_char(kk_, bix_, sp_, op);
}
else
{
return fs_.get_char(patch_, bix_, sp_, op);
}
}
|
2850994c85dca573c27991e3b26592852cd960eb | 326c7db4f747d3fb8444c6514ee8d04479a444c0 | /include/fluxoExtracao/leitorMapa.h | 80b0381031cac47195783c40716dbd7b729e807c | [] | no_license | LivDelgado/estruturas-de-dados-tp1 | c91ea85bdf9b091214a7bfef3ad1d58f3ea6cea4 | fd6527df6534af9f0d933c76534107a0c12eae2b | refs/heads/main | 2023-07-02T15:01:29.649501 | 2021-08-07T01:25:35 | 2021-08-07T01:25:35 | 333,572,916 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 417 | h | leitorMapa.h | #include "fluxoExtracao/leitorArquivos.h"
#include "planeta/mapa.h"
#include <string>
#ifndef LEITOR_MAPA
#define LEITOR_MAPA
namespace extracaoZ {
class LeitorMapa : LeitorArquivos {
private:
Mapa* criarMapa(std::string* linhasArquivo);
public:
LeitorMapa();
~LeitorMapa();
Mapa* inicializarMapa(std::string caminhoArquivo);
};
}
#endif
|
d04c93531049b2b75603ad95c468552ae31c1f8f | 16151e6183a9db973516c7fad3383a41329a49da | /utility/DFileUtil.cpp | 60a8a71f749a7b6356009299d8fb06a7f084f77f | [
"Apache-2.0"
] | permissive | PaulusChen/Dagger | e00f8c7205011b0687582f7bb474be717403cc08 | 28f6531a708eec0488cc6af4024edad757a4235b | refs/heads/master | 2021-08-23T19:12:30.737890 | 2017-11-30T09:52:13 | 2017-11-30T09:52:13 | 53,682,040 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,307 | cpp | DFileUtil.cpp |
#include <dagger/Dagger.hpp>
#ifdef WIN32
#include <windows.h>
#elif __linux__
#include <unistd.h>
#include <dirent.h>
#include <sys/stat.h>
#include <linux/limits.h>
#include <string.h>
#endif
using namespace Dagger::Utils;
using namespace std;
void DFileUtil::SetCurrentDir(const ::std::string &path)
{
#ifdef WIN32
SetCurrentDirectory(path.c_str());
#elif __linux__
chdir(path.c_str());
#endif
}
void DFileUtil::GetCurrentDir(string &cur) {
#ifdef WIN32
const int pathLen = 1000;
#elif __linux__
const int pathLen = PATH_MAX;
#endif
char buf[pathLen];
#ifdef WIN32
GetCurrentDirectory(pathLen,buf);
#elif __linux__
getcwd(buf,pathLen);
#endif
cur = buf;
}
::std::string DFileUtil::GetCurrentDir()
{
string cur;
GetCurrentDir(cur);
return cur;
}
void DFileUtil::ResolvePath(const ::std::string &path,
::std::string *dir,
::std::string *filename,
::std::string *extname)
{
string fullPath = path;
GetFullPath(fullPath);
string::size_type lastSlashPos = fullPath.find_last_of("/\\");
if (dir)
*dir = fullPath.substr(0,lastSlashPos);
string::size_type dotaPos = fullPath.find_last_of(".");
if (dotaPos == string::npos)
{
if (filename) {
*filename = fullPath.substr(lastSlashPos + 1,string::npos);
}
if (extname) {
*extname = "";
}
return;
}
if (filename) {
*filename = fullPath.substr(lastSlashPos + 1,dotaPos - lastSlashPos - 1);
}
if (extname) {
*extname = fullPath.substr(dotaPos + 1,string::npos);
}
}
void DFileUtil::GetFullPath(::std::string &path) {
#ifdef WIN32
if (path->at(1) != ':')
path = (DFileUtil::GetCurrentDir() + path);
#elif __linux__
if (path.size() > 0 && path.front() == '~') {
path.erase(path.begin());
const char *homeStr = getenv("HOME");
path.insert(0,homeStr);
}
char realPath[PATH_MAX];
realpath(path.c_str(),realPath);
path = realPath;
#endif
}
int DFileUtil::traversesDirInner(std::string &path,DFileUtil::TraversePred pred,void *param) {
struct stat statBuf;
if (lstat(path.c_str(), &statBuf) < 0) { /* stat error*/
return pred(path.c_str(),DIR_ENTRY_TYPE_ERR_STAT,param);
}
if (S_ISDIR(statBuf.st_mode) == 0) { /* not a directory */
return pred(path.c_str(),DIR_ENTRY_TYPE_FILE,param);
}
int ret = (0);
if ((ret = pred(path.c_str(),DIR_ENTRY_TYPE_DIR,param)) < 0) {
return ret;
}
path.append("/");
size_t pos = path.size();
DIR *dp;
if ((dp = opendir(path.c_str())) == NULL) {
return pred(path.c_str(),DIR_ENTRY_TYPE_ERR_RDIR,param);
}
struct dirent *dirp;
while ((dirp = readdir(dp)) != NULL) {
if (strcmp(dirp->d_name, ".") == 0
|| strcmp(dirp->d_name, "..") == 0) {
continue;
}
path.append(dirp->d_name);
if ((ret = traversesDirInner(path,pred,param)) < 0) {
break;
}
path.erase(pos);
}
if (closedir(dp) < 0) {
return -1;
}
return 0;
}
int DFileUtil::TraverseDir(const std::string &path,DFileUtil::TraversePred pred,void *param) {
string localPath = path;
GetFullPath(localPath);
return traversesDirInner(localPath,pred,param);
#ifdef WIN32
char save_path[200];
char szFile[MAX_PATH] = {0};
char szFind[MAX_PATH];
WIN32_FIND_DATA FindFileData;
strcpy(szFind,lpPath);
strcat(szFind,"*");
HANDLE hFind = FindFirstFile(szFind,&FindFileData);
if(INVALID_HANDLE_VALUE == hFind) return;
uint32_t foundCounter = 0;
while(TRUE)
{
if(FindFileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
{
if(FindFileData.cFileName[0]!='.')
{
strcpy(szFile,lpPath);
strcat(szFile,FindFileData.cFileName);
strcat(szFile,"\\");
Traverse(szFile,pred,param);
}
}
else
{
pred((::std::string(lpPath) + FindFileData.cFileName).c_str(),param);
}
if(!FindNextFile(hFind,&FindFileData)) break;
}
FindClose(hFind);
#endif
}
|
5a5a066a1af33c8ba6828de36ce19038e59b9b32 | c75c04e8a98426272519fa2976dd82dbc3d3c765 | /src/crypto_concepts.hh | f8d0d27925c1236e4ea246b027841b6947f1c096 | [
"BSL-1.0"
] | permissive | everard/libecstk-crypto | 916a488a7edb0739b6b9a6f65ee49d597d1fa111 | 2b6539ed349fc437e867115e07a0c9eb286c873d | refs/heads/master | 2023-05-13T14:14:55.986331 | 2021-06-08T17:03:28 | 2021-06-08T17:03:28 | 361,812,967 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,932 | hh | crypto_concepts.hh | // Copyright Nezametdinov E. Ildus 2021.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// https://www.boost.org/LICENSE_1_0.txt)
//
#ifndef H_7EF44563B1C6470B8FFFEFB77C5D88DF
#define H_7EF44563B1C6470B8FFFEFB77C5D88DF
#include "buffer.hh"
#include <numeric>
#include <optional>
namespace ecstk::crypto {
namespace std = ::std;
////////////////////////////////////////////////////////////////////////////////
// Side of operation.
////////////////////////////////////////////////////////////////////////////////
enum struct side { client, server };
////////////////////////////////////////////////////////////////////////////////
// Key exchange schema concept.
////////////////////////////////////////////////////////////////////////////////
namespace kx {
// clang-format off
template <typename T>
concept schema =
static_byte_buffer<typename T::public_key> &&
static_byte_buffer<typename T::secret_key> &&
static_byte_buffer<typename T::session_key> &&
std::semiregular<typename T::shared_secret> &&
std::copyable<typename T::keychain> &&
requires(ref<typename T::secret_key> sk, side s) {
{ T::keychain::initialize(sk, s) } ->
std::same_as<std::optional<typename T::keychain>>;
} &&
requires(typename T::keychain const& kc) {
{ kc.pk() } -> std::convertible_to<typename T::public_key>;
} &&
requires(typename T::keychain const& kc, ref<typename T::public_key> pk) {
{ T::handshake(kc, pk) } ->
std::same_as<std::optional<typename T::shared_secret>>;
} &&
requires(typename T::shared_secret secret) {
{ secret.rx_k } -> std::same_as<typename T::session_key>;
{ secret.tx_k } -> std::same_as<typename T::session_key>;
};
// clang-format on
} // namespace kx
////////////////////////////////////////////////////////////////////////////////
// MAC schema concept.
////////////////////////////////////////////////////////////////////////////////
namespace mac {
// clang-format off
template <typename T>
concept schema =
static_byte_buffer<typename T::key> &&
static_byte_buffer<typename T::tag> &&
requires(ref<typename T::key> k, byte_sequence msg) {
{ T::sign(k, msg) } -> std::same_as<typename T::tag>;
} &&
requires(ref<typename T::key> k, ref<typename T::tag> t,
byte_sequence msg) {
{ T::verify(k, t, msg) } -> std::same_as<bool>;
};
// clang-format on
} // namespace mac
////////////////////////////////////////////////////////////////////////////////
// Public key authentication schema concept.
////////////////////////////////////////////////////////////////////////////////
namespace pk_auth {
// clang-format off
template <typename T>
concept schema =
static_byte_buffer<typename T::public_key> &&
static_byte_buffer<typename T::secret_key> &&
static_byte_buffer<typename T::signature> &&
std::copyable<typename T::keychain> &&
requires(ref<typename T::secret_key> sk) {
{ T::keychain::initialize(sk) } ->
std::same_as<std::optional<typename T::keychain>>;
} &&
requires(typename T::keychain const& kc) {
{ kc.pk() } -> std::convertible_to<typename T::public_key>;
} &&
requires(typename T::keychain const& kc, byte_sequence msg) {
{ T::sign(kc, msg) } -> std::same_as<typename T::signature>;
} &&
requires(ref<typename T::public_key> pk, ref<typename T::signature> sig,
byte_sequence msg) {
{ T::verify(pk, sig, msg) } -> std::same_as<bool>;
};
// clang-format on
} // namespace pk_auth
////////////////////////////////////////////////////////////////////////////////
// PRG schema concept.
////////////////////////////////////////////////////////////////////////////////
namespace prg {
// clang-format off
template <typename T>
concept schema =
static_byte_buffer<typename T::key> &&
std::copyable<T> &&
requires(ref<typename T::key> k) {
T{k};
} &&
requires(T g, mut_byte_sequence buf) {
{ g.generate(buf) } -> std::same_as<void>;
};
// clang-format on
} // namespace prg
////////////////////////////////////////////////////////////////////////////////
// Stream cipher concept.
////////////////////////////////////////////////////////////////////////////////
namespace stream {
// clang-format off
template <typename T>
concept cipher =
static_byte_buffer<typename T::key> &&
static_byte_buffer<typename T::nonce> &&
std::copyable<T> &&
requires(ref<typename T::key> k, ref<typename T::nonce> n) {
T{k, n};
} &&
requires(T g, mut_byte_sequence buf) {
{ g.generate(buf) } -> std::same_as<void>;
{ g.xor_buf(buf) } -> std::same_as<void>;
};
// clang-format on
} // namespace stream
} // namespace ecstk::crypto
#endif // H_7EF44563B1C6470B8FFFEFB77C5D88DF
|
ec77d1127dfe51b8e7bf2bcac707a07c2e0bad7c | 7a478ef9efd0c3b4424c5f2f3a17fede7bb95254 | /Libraries/RegisterMonoModules.cpp | 030783a95c8bb51744ac48eabe27f4fde4112fd0 | [] | no_license | Marcurion/test2 | dfe1bfd3cc50fa24a76cd88f74b52c2c8f9096e5 | 37425035a4db1084b4b03154b16d6cac90c2e31b | refs/heads/master | 2021-01-10T17:01:21.212134 | 2015-11-26T10:32:37 | 2015-11-26T10:32:37 | 46,919,935 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 262 | cpp | RegisterMonoModules.cpp | #ifndef INIT_SCRIPTING_BACKEND
extern void RegisterAllClassesIPhone();
void RegisterAllClasses()
{
// Register classes for unit tests
RegisterAllClassesIPhone();
}
void RegisterAllStrippedInternalCalls() {}
#endif
void RegisterMonoModules() {}
|
9ae28d446cb660dff7f61460fda184bf9f0ce0bc | 46c98ed99c6f37736725851205be9862f254796c | /include/pgen/pgen.hpp | 88115b0e8fc7551969335a39384445ae26432022 | [
"MIT"
] | permissive | sadn1ck/pgen | 1461476399ea9ea66cbf342b49f7a38301d4461d | ae7b5df204e8cf4d7718a20b2e1339fb3105b9fd | refs/heads/master | 2023-01-15T23:58:29.011127 | 2020-11-24T17:13:48 | 2020-11-24T17:13:48 | 303,749,080 | 8 | 0 | MIT | 2020-10-29T05:28:56 | 2020-10-13T15:34:34 | C++ | UTF-8 | C++ | false | false | 1,436 | hpp | pgen.hpp | #ifndef pgen_H
#define pgen_H
#include <string>
/**
* @brief The pgen class
* @author Anik Das
* @date 23 October, 2020
*/
class Pgen
{
public:
/**
* Constructor
*/
Pgen();
/**
* Destructor
*/
~Pgen();
const char *LENGTH = "-l"; /**< CLI argument of the length */
const char *EXTRA = "e"; /**< CLI argument of whether to use extra chars */
const char *HELP = "-h"; /**< CLI argument to show help section */
/**
* @brief Function to show help and options
*/
void showHelp();
/**
* @brief Checks if the paramater passed is a valid number, and between 8 and
* 100
* @param parameter - the command line argument passed as length (after -l)
* @returns whether or not parameter is valid
*/
bool isValid(const char *parameter);
/**
* @brief Returns a random password by taking in length and whether or not to
* use extra characters
* @param length - the valid length passed as command line arguments
* @param extra - boolean value to denote if extra characters are to be used
* @returns the generated password
*/
std::string generatePassword(int length, bool extra);
/**
* @brief Returns a random index within the size of the string
* @param space - string from which you want the random index
* @returns an index within the length of the space string
*/
int getRandomNumber(std::string space);
};
#endif |
ed7b87c9b3995565e57da125186d590436513e27 | 3af953e3624b7feb7145ebb6081fc751b0c10bc1 | /opengl_renderer/source/index_buffer.cpp | b7a61653a9734aac9b5add95a78330393cff46d4 | [] | no_license | Jengerer/Re-Quake-II | 1a245d501ffde0c1b8dfd27e476afc3b10d7adda | 5e76e7c80ade23f47e525d35e96e56639f0b11f9 | refs/heads/master | 2020-05-26T08:05:04.736766 | 2015-01-15T03:16:20 | 2015-01-15T03:16:20 | 28,839,575 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,724 | cpp | index_buffer.cpp | #include "index_buffer.h"
#include <error_stack.h>
#include <memory_manager.h>
namespace OpenGL
{
IndexBuffer::IndexBuffer()
{
}
IndexBuffer::~IndexBuffer()
{
if (handle != 0) {
glDeleteBuffers(1, &handle);
}
}
// Initialize the index buffer.
bool IndexBuffer::Initialize()
{
glGenBuffers(1, &handle);
if (glGetError() != GL_NO_ERROR) {
ErrorStack::Log("Failed to generate OpenGL index buffer.");
return false;
}
return true;
}
// Initialize from index data.
bool IndexBuffer::Load(
const void *indices,
unsigned int bufferSize,
Renderer::DataType indexType)
{
// Set new index count and type.
this->type = TranslateIndexType(indexType);
// Pass new data to buffer.
Bind();
glBufferData(GL_ELEMENT_ARRAY_BUFFER, bufferSize, indices, GL_STATIC_DRAW);
if (glGetError() != GL_NO_ERROR) {
Unbind();
ErrorStack::Log("Failed to load %u bytes of data to buffer.", bufferSize);
return false;
}
Unbind();
return true;
}
// Bind indices as the element reference.
void IndexBuffer::Bind() const
{
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, handle);
}
// Unbind indices from element reference.
void IndexBuffer::Unbind() const
{
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
}
// Translate index type to OpenGL type.
// Assumes data type is an integral type.
GLenum IndexBuffer::TranslateIndexType(Renderer::DataType indexType)
{
switch (indexType) {
case Renderer::UnsignedByteType:
return GL_UNSIGNED_BYTE;
case Renderer::UnsignedShortType:
return GL_UNSIGNED_SHORT;
case Renderer::UnsignedIntType:
return GL_UNSIGNED_INT;
default:
ErrorStack::Log("Expected unsigned integral type for index data type.");
return 0;
}
}
}
|
d4c9dec146647d267c25bd98c58a9a79268aca23 | 7f9b37a228205b0fd303096ac56baea3c1b8f5a8 | /tools/llvm-pdbdump/YAMLOutputStyle.h | cbd1817773ce79383efa468bf357c52fcd264647 | [
"NCSA"
] | permissive | weliveindetail/pj-llvm | 774c73412b64960aea644a68fbfab18adaa0997a | a3a6b523e79b797b6db43dfdf21918e7fcd443ab | refs/heads/master | 2021-01-17T18:06:06.162663 | 2016-06-20T12:51:55 | 2016-06-20T12:51:55 | 58,360,621 | 3 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 1,421 | h | YAMLOutputStyle.h | //===- YAMLOutputStyle.h -------------------------------------- *- C++ --*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_TOOLS_LLVMPDBDUMP_YAMLOUTPUTSTYLE_H
#define LLVM_TOOLS_LLVMPDBDUMP_YAMLOUTPUTSTYLE_H
#include "OutputStyle.h"
#include "PdbYaml.h"
#include "llvm/DebugInfo/CodeView/TypeDumper.h"
#include "llvm/Support/ScopedPrinter.h"
#include "llvm/Support/YAMLTraits.h"
namespace llvm {
namespace pdb {
class YAMLOutputStyle : public OutputStyle {
public:
YAMLOutputStyle(PDBFile &File);
Error dumpFileHeaders() override;
Error dumpStreamSummary() override;
Error dumpStreamBlocks() override;
Error dumpStreamData() override;
Error dumpInfoStream() override;
Error dumpNamedStream() override;
Error dumpTpiStream(uint32_t StreamIdx) override;
Error dumpDbiStream() override;
Error dumpSectionContribs() override;
Error dumpSectionMap() override;
Error dumpPublicsStream() override;
Error dumpSectionHeaders() override;
Error dumpFpoStream() override;
void flush() override;
private:
PDBFile &File;
llvm::yaml::Output Out;
yaml::PdbObject Obj;
};
} // namespace pdb
} // namespace llvm
#endif // LLVM_TOOLS_LLVMPDBDUMP_YAMLOUTPUTSTYLE_H
|
1fee74c738bf1d736f3fd62481c5cb5c7d15a81f | 6b2a8dd202fdce77c971c412717e305e1caaac51 | /solutions_1674486_0/C++/petterbb/1.cpp | cdcc20899341800b8135a4d662e7eb678445e959 | [] | no_license | alexandraback/datacollection | 0bc67a9ace00abbc843f4912562f3a064992e0e9 | 076a7bc7693f3abf07bfdbdac838cb4ef65ccfcf | refs/heads/master | 2021-01-24T18:27:24.417992 | 2017-05-23T09:23:38 | 2017-05-23T09:23:38 | 84,313,442 | 2 | 4 | null | null | null | null | UTF-8 | C++ | false | false | 1,753 | cpp | 1.cpp | #include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cstring>
#include <vector>
#include <queue>
using namespace std;
bool vis[1010];
int indgree[1010];
vector<int> a[1010];
int main(){
freopen("1.out", "w", stdout);
int t;
cin >> t;
for(int testCases = 1; testCases <= t; testCases++){
int n;
cin >> n;
memset(indgree, 0, sizeof(indgree));
memset(vis, false, sizeof(vis));
for(int i = 1; i <= n; i++){
a[i].clear();
}
int num;
for(int i = 1; i <= n; i++){
cin >> num;
for(int j = 0; j < num; j++){
int tmp;
cin >> tmp;
a[i].push_back(tmp);
indgree[tmp]++;
}
}
queue<int> q;
printf("Case #%d: ", testCases);
bool flag = false;
for(int i = 1; i <= n && !flag; i++){
while(!q.empty())
q.pop();
memset(vis, false, sizeof(vis));
if(indgree[i] == 0){
q.push(i);
vis[i] = true;
while(!q.empty() && !flag){
int top = q.front();
q.pop();
for(int i = 0; i < a[top].size(); i++){
if(vis[a[top][i]] == true){
flag = true;
cout << "Yes" << endl;
break;
}
q.push(a[top][i]);
vis[a[top][i]] = true;
}
}
}
}
if(!flag)
cout << "No" << endl;
}
return 0;
}
|
0ed972d319375175895f0552471b99afb532a20f | 5010b46a3ee3be24f7cac71a4ca76053f01647af | /catkin_ws/src/loam_velodyne/src/MapStitcher.cpp | e855191fa5102a14809962f13c80fc8a18b1dcbc | [
"BSD-3-Clause"
] | permissive | el766/Depth-Guided-Inpainting | f3afca7114c4743a6272194b60c013c20d048fbf | 0f3499d9cd5deed2ee213ee8d70395d7202e69ee | refs/heads/master | 2023-04-10T06:40:01.883254 | 2021-04-22T23:11:54 | 2021-04-22T23:11:54 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 8,533 | cpp | MapStitcher.cpp | #include <ros/ros.h>
#include <rosbag/bag.h>
#include <rosbag/view.h>
#include <message_filters/subscriber.h>
#include <sensor_msgs/point_cloud2_iterator.h>
#include <pcl/io/ply_io.h>
#include "../include/loam_velodyne/Twist.h"
#include "loam_velodyne/LaserMapping.h"
#include "lib/math_utils.h"
#include "../include/loam_velodyne/common.h"
//std::unique_ptr<loam::LaserMapping> laser_mapper;
//
//void mySigIntHandler(int sig)
//{
// laser_mapper->savePoses("../Documents/global_poses.txt");
//}
/**
* Inherits from message_filters::SimpleFilter<M>
* to use protected signalMessage function
*/
struct PointXYZIS {
PointXYZIS() {
}
PointXYZIS(float ix, float iy, float iz, float inten, float rp) :
x(ix), y(iy), z(iz), intensity(inten), rotate_percentage(rp) {
}
float x, y, z;
float intensity;
float rotate_percentage;
};
template<class M>
class BagSubscriber: public message_filters::SimpleFilter<M> {
public:
void newMessage(const boost::shared_ptr<M const> &msg) {
signalMessage(msg);
}
};
void WriteToPLY(const std::vector<PointXYZIS> &pc,
const std::string &file_name) {
pcl::PointCloud < pcl::PointXYZI > cloud;
// Fill in the cloud data
cloud.width = pc.size();
cloud.height = 1;
cloud.is_dense = false;
cloud.points.resize(cloud.width * cloud.height);
for (int i = 0; i < cloud.size(); i++) {
cloud.points[i].x = pc[i].x;
cloud.points[i].y = pc[i].y;
cloud.points[i].z = pc[i].z;
cloud.points[i].intensity = pc[i].intensity;
}
pcl::PLYWriter writer;
writer.write(file_name, cloud);
}
std::map<unsigned long long, loam::Twist> ReadPose(
const std::string &file_name) {
std::map<unsigned long long, loam::Twist> time_pose;
std::ifstream is(file_name);
if (is.is_open()) {
unsigned long long ts;
float rx, ry, rz, x, y, z;
while (is >> ts >> rx >> ry >> rz >> x >> y >> z) {
loam::Twist transform;
transform.rot_x = rx;
transform.rot_y = ry;
transform.rot_z = rz;
transform.pos.x() = x;
transform.pos.y() += y;
transform.pos.z() += z;
time_pose[ts] = transform;
}
is.close();
}
return time_pose;
}
std::vector<PointXYZIS> ScanRegistration(
const std::vector<PointXYZIS> &laserCloudIn) {
std::vector<PointXYZIS> laserCloudOut;
size_t cloudSize = laserCloudIn.size();
// determine scan start and end orientations
float startOri = -std::atan2(laserCloudIn[0].y, laserCloudIn[0].x);
float endOri = -std::atan2(laserCloudIn[cloudSize - 1].y,
laserCloudIn[cloudSize - 1].x) + 2 * float(M_PI);
if (endOri - startOri > 3 * M_PI) {
endOri -= 2 * M_PI;
} else if (endOri - startOri < M_PI) {
endOri += 2 * M_PI;
}
bool halfPassed = false;
PointXYZIS point;
// extract valid points from input cloud
for (int i = 0; i < cloudSize; i++) {
point.x = laserCloudIn[i].y;
point.y = laserCloudIn[i].z;
point.z = laserCloudIn[i].x;
point.intensity = laserCloudIn[i].intensity;
// skip NaN and INF valued points
if (!std::isfinite(point.x) || !std::isfinite(point.y)
|| !std::isfinite(point.z)) {
continue;
}
// skip zero valued points
if (point.x * point.x + point.y * point.y + point.z * point.z
< 0.0001) {
continue;
}
// // calculate vertical point angle and scan ID
// float angle = std::atan(point.y / std::sqrt(point.x * point.x + point.z * point.z));
// int scanID = _scanMapper.getRingForAngle(angle);
// if (scanID >= _scanMapper.getNumberOfScanRings() || scanID < 0 ){
// continue;
// }
// calculate horizontal point angle
float ori = -std::atan2(point.x, point.z);
if (!halfPassed) {
if (ori < startOri - M_PI / 2) {
ori += 2 * M_PI;
} else if (ori > startOri + M_PI * 3 / 2) {
ori -= 2 * M_PI;
}
if (ori - startOri > M_PI) {
halfPassed = true;
}
} else {
ori += 2 * M_PI;
if (ori < endOri - M_PI * 3 / 2) {
ori += 2 * M_PI;
} else if (ori > endOri + M_PI / 2) {
ori -= 2 * M_PI;
}
}
point.rotate_percentage = (ori - startOri) / (endOri - startOri);
laserCloudOut.push_back(point);
// calculate relative scan time based on point orientation
//float relTime = config().scanPeriod * (ori - startOri) / (endOri - startOri);
//point.intensity = scanID + relTime;
//projectPointToStartOfSweep(point, relTime);
//_laserCloudScans[scanID].push_back(point);
}
return laserCloudOut;
}
void transformToEnd(std::vector<PointXYZIS>& cloud,
const loam::Twist &transform) {
size_t cloudSize = cloud.size();
for (size_t i = 0; i < cloudSize; i++) {
PointXYZIS& point = cloud[i];
float s = point.rotate_percentage;
point.x -= s * transform.pos.x();
point.y -= s * transform.pos.y();
point.z -= s * transform.pos.z();
//point.intensity = int(point.intensity);
loam::Angle rx = -s * transform.rot_x.rad();
loam::Angle ry = -s * transform.rot_y.rad();
loam::Angle rz = -s * transform.rot_z.rad();
rotateZXY(point, rz, rx, ry);
rotateYXZ(point, transform.rot_y, transform.rot_x, transform.rot_z);
point.x += transform.pos.x();
point.y += transform.pos.y();
point.z += transform.pos.z();
}
}
void pointAssociateToMap(std::vector<PointXYZIS>& cloud,
const loam::Twist &transform) {
for (auto &po : cloud) {
rotateZXY(po, transform.rot_z, transform.rot_x, transform.rot_y);
po.x += transform.pos.x();
po.y += transform.pos.y();
po.z += transform.pos.z();
}
}
std::vector<std::string> StringSplit(const std::string &input_str,
const std::string &delimiter) {
std::vector < std::string > output;
std::string s = input_str;
size_t pos = 0;
std::string token;
while ((pos = s.find(delimiter)) != std::string::npos) {
token = s.substr(0, pos);
output.push_back(token);
s.erase(0, pos + delimiter.length());
}
output.push_back(s);
return output;
}
/** Main node entry point. */
int main(int argc, char **argv) {
std::vector < std::string > bag_files = StringSplit(argv[1], ",");
std::map<unsigned long long, loam::Twist> rel_poses = ReadPose(argv[2]);
std::map<unsigned long long, loam::Twist> glb_poses = ReadPose(argv[3]);
int frame_cnt = -1;
std::vector<PointXYZIS> stitched_map;
for (auto const &f : bag_files) {
std::cout<<f<<std::endl;
rosbag::Bag bag;
bag.open(f, rosbag::bagmode::Read);
//std::vector < std::string > topics;
//topics.push_back("/velodyne_points");
//rosbag::View view(bag, rosbag::TopicQuery(topics));
rosbag::View view(bag);
// Set up fake subscribers to capture images
//BagSubscriber<sensor_msgs::PointCloud2> lidar_sub;
// Load all messages into our stereo dataset
for (rosbag::MessageInstance const m : view) {
if (m.getTopic() == "/sensor/velodyne64/PointCloud2") {
sensor_msgs::PointCloud2::ConstPtr pr = m.instantiate<
sensor_msgs::PointCloud2>();
if (pr != NULL) {
sensor_msgs::PointCloud2 mm = *pr;
sensor_msgs::PointCloud2Iterator<float> iter_x(mm, "x");
sensor_msgs::PointCloud2Iterator<float> iter_y(mm, "y");
sensor_msgs::PointCloud2Iterator<float> iter_z(mm, "z");
sensor_msgs::PointCloud2Iterator < uint8_t
> iter_intensity(mm, "intensity");
int i = 0;
std::vector<PointXYZIS> cloud;
for (; iter_x != iter_x.end();
++i, ++iter_x, ++iter_y, ++iter_z, ++iter_intensity) {
cloud.emplace_back(*iter_x, *iter_y, *iter_z,
*iter_intensity, 0);
}
std::chrono::system_clock::time_point t = loam::fromROSTime(
pr->header.stamp);
unsigned long long time_ms = std::chrono::duration_cast
< std::chrono::microseconds
> (t.time_since_epoch()).count();
auto rel_ptr = rel_poses.find(time_ms);
auto glb_ptr = glb_poses.find(time_ms);
if (rel_ptr != rel_poses.end()
&& glb_ptr != glb_poses.end()) {
++frame_cnt;
std::cout << frame_cnt << std::endl;
//WriteToPLY(cloud, "../Documents/motion_orig.ply");
std::vector<PointXYZIS> filtered_cloud =
ScanRegistration(cloud);
//WriteToPLY(filtered_cloud, "../Documents/motion_before"+std::to_string(time_ms)+".ply");
transformToEnd(filtered_cloud, rel_ptr->second);
//WriteToPLY(filtered_cloud, "../Documents/motion_after"+std::to_string(time_ms)+".ply");
pointAssociateToMap(filtered_cloud, glb_ptr->second);
//stitched_map.insert(stitched_map.end(), filtered_cloud.begin(), filtered_cloud.end());
for (int j = 0; j < filtered_cloud.size(); j += 10) {
stitched_map.push_back(filtered_cloud[j]);
}
}
}
}
}
}
WriteToPLY(stitched_map, "../Documents/stitched_map.ply");
return 0;
}
|
c0875ef1377b4b0bee0189855123dbc62ec6d3ee | 07cc4d9e645f506056c45787507017db9b857fdd | /day4/const.cc | 3f872e4790e8bd7f60163ab8acffe4e49e33d5e9 | [] | no_license | lesswork/plus | b5aa96ef9455682306c287d8a418484b3a1c7f32 | de27ea6808f8ec76c08a3e942c87a8176811fe35 | refs/heads/master | 2020-12-25T16:47:49.661307 | 2016-08-25T06:44:02 | 2016-08-25T06:44:02 | 66,532,418 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 570 | cc | const.cc | #include <iostream>
using namespace std;
class Base
{
const int c;
int b;
public:
Base(int arguments) : c(arguments)
{
b = 10;
cout << "cttor() called" << endl;
}
~Base()
{
cout << "dttor() called" << endl;
}
void display(void) const
{
//we can not modify in const function
//b++;
cout << "const Value : " << c << endl;
}
void display(void)
{
//we can not modify in const function
//b++;
cout << "Value : " << c << endl;
}
/* data */
};
int main(void)
{
Base b1(5);
const Base b2(12);
b1.display();
b2.display();
return 0;
}
|
278032b425b1f7b29ed37de7352273f0f905586e | f5b3bf329be9f4cdc9b896577a1206c6b126f0ac | /Source/Client/CMP303 Coursework 1701542/GameState.cpp | 7a1a9d6ce2d392a4f854ce2b6d90e8018d4966a9 | [] | no_license | 1701542/NetworkingCoursework | acae0da6c9c34f7be2c5eb6946de22195a76e559 | 9c0ad0e53623d7d44e10239d2949c1bf3140c75d | refs/heads/main | 2023-03-29T19:31:10.671159 | 2021-03-08T16:20:58 | 2021-03-08T16:20:58 | 345,718,244 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,172 | cpp | GameState.cpp | #include "GameState.h"
#include <string>
GameState::GameState(sf::RenderWindow* hwnd, InputManager* input, _STATE* state)
{
window = hwnd;
inputManager = input;
currentState = state;
level = new Level(window);
}
GameState::~GameState()
{
}
void GameState::AddNewPlayer(unsigned short port)
{
// Create a player at the end of the vector using the default constructor
playerVector.emplace_back();
// Initialise the empty player
playerVector.back().port = port;
playerVector.back().character = new Character(window, inputManager);
}
// Update a specific player
bool GameState::UpdatePlayer(unsigned short port, sf::Vector2f position, float rotation)
{
for (int i = 0; i < playerVector.size(); i++)
{
if (playerVector[i].port == port)
{
playerVector[i].character->setPosition(position);
playerVector[i].character->setRotation(rotation);
return true;
}
}
return false;
}
void GameState::DeletePlayer(unsigned short port)
{
// Loop through the list of players
for (int i = 0; i < playerVector.size(); i++)
{
// If the element port matches then delete the character then erase the element
if (playerVector[i].port == port)
{
delete playerVector[i].character;
playerVector.erase(playerVector.begin() + i);
// Return as we only need to delete this one instance of player
return;
}
}
}
// Return a vector containing the identifying factor of each player
std::vector<unsigned short> GameState::GetPlayers()
{
std::vector<unsigned short> portVector;
for (int i = 0; i < playerVector.size(); i++)
portVector.push_back(playerVector[i].port);
return portVector;
}
void GameState::Update(float deltaTime)
{
gameTime += deltaTime;
playerVector[0].character->Update(deltaTime, level->getMap());
UpdateInput();
Render(deltaTime);
}
// Check for input
void GameState::UpdateInput()
{
if (inputManager->getKey(sf::Keyboard::Space))
{
*currentState = _STATE::MENU;
inputManager->setKey(sf::Keyboard::Space, false);
}
}
// Render the scene
void GameState::Render(float deltaTime)
{
window->clear();
level->Render();
for (auto player : playerVector)
player.character->Render();
window->display();
} |
c512fa5b42563f2e7fcb988675dbaa64602efd1e | 2e0472397ec7145d50081d4890eb0af2323eb175 | /Code/include/OE/Graphics/2D/PathRenderer.hpp | b3306c1d9df4ee5f467ae5adbe386c10045c8d65 | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | mlomb/OrbitEngine | 5c471a853ea555f0738427999dd9cef3a1c90a01 | 41f053626f05782e81c2e48f5c87b04972f9be2c | refs/heads/master | 2021-09-09T01:27:31.097901 | 2021-08-28T16:07:16 | 2021-08-28T16:07:16 | 99,012,019 | 26 | 3 | null | null | null | null | UTF-8 | C++ | false | false | 4,690 | hpp | PathRenderer.hpp | #ifndef GRAPHICS_PATH_RENDERER_HPP
#define GRAPHICS_PATH_RENDERER_HPP
#include "OE/Math/Vec2.hpp"
#include "OE/Math/Vec4.hpp"
#include "OE/Math/Mat4.hpp"
#include "OE/Math/Scissor.hpp"
#define MAX_DRAW_COMMANDS_BUFFER_SIZE 50000
#define MAX_POINTS_BUFFER_SIZE 50000
#define MAX_PATHS_BUFFER_SIZE 5000
/* Based on NanoVG implementation */
namespace OrbitEngine { namespace Graphics {
enum PathRendererCommandType {
MOVETO = 0,
LINETO,
BEZIERTO,
CLOSE
};
struct PathPoint {
Math::Vec2f position;
Math::Vec2f direction;
Math::Vec2f directionm;
float length;
bool equals(const PathPoint* b, float tolerance) {
float deltax = b->position.x - position.x;
float deltay = b->position.y - position.y;
float dist = sqrt((deltax * deltax) + (deltay * deltay));
return dist < tolerance;
}
};
struct Path {
bool closed = false;
int offset, count;
int fillOffset, fillCount;
int strokeOffset, strokeCount;
};
struct PaintStyle {
Math::Mat4 paintMat;
Math::Vec4f innerColor = Math::Vec4f(1, 1, 1, 1);
Math::Vec4f outerColor = Math::Vec4f(0, 0, 0, 1);
Math::Vec2f extent;
float radius = 0;
float feather = 1;
float texid = 0;
float pad1, pad2, pad3;
};
struct PathRendererUniformData {
//Math::Scissor scissor;
Math::Vec4f scissor = Math::Vec4f(0, 0, 32000, 32000);
PaintStyle paint;
float texid = 0;
float strokeMul;
float pad4, pad5;
};
struct PathRendererCall {
Path* paths;
unsigned int pathsCount;
unsigned int trianglesOffset, trianglesCount;
PathRendererUniformData data;
};
class PathRenderer {
public:
static PaintStyle SolidColor(const Math::Vec4f& color);
static PaintStyle BoxGradient(const Math::Vec2f& position, const Math::Vec2f& size, float radius, float feather, const Math::Vec4f& innerColor, const Math::Vec4f& outerColor);
static PaintStyle LinearGradient(const Math::Vec2f& position, const Math::Vec2f& size, const Math::Vec4f& innerColor, const Math::Vec4f& outerColor);
static PaintStyle ImagePattern(const Math::Vec2f& position, const Math::Vec2f& size, unsigned int texture);
void beginFrame();
void setDPR(float devicePixelRatio);
/* Create path */
void pushCommands(float* data, int count);
void beginPath();
void moveTo(const Math::Vec2f& position);
void lineTo(const Math::Vec2f& position);
void bezierTo(const Math::Vec2f& position, const Math::Vec2f& c1, const Math::Vec2f& c2);
void closePath();
/* From Shapes */
void shapeCareOfStroke(bool careOfStroke);
void roundedRect(const Math::Vec2f& position, const Math::Vec2f& size, const Math::Vec4f& radius);
void ellipse(const Math::Vec2f& position, const Math::Vec2f& size);
void rect(const Math::Vec2f& position, const Math::Vec2f& size);
void roundedRect(const Math::Vec2f& position, const Math::Vec2f& size, float radius) { return roundedRect(position, size, Math::Vec4f(radius, radius, radius, radius)); };
void circle(const Math::Vec2f& position, float radius) { return ellipse(position, Math::Vec2f(radius, radius)); }
/* Change style */
void fillStyle(const PaintStyle& p) { m_FillStyle = p; p_DirtyState = true; };
void fillColor(const Math::Vec4f& color) { fillStyle(SolidColor(color)); };
void strokeStyle(const PaintStyle& p) { m_StrokeStyle = p; p_DirtyState = true; };
void strokeColor(const Math::Vec4f& color) { strokeStyle(SolidColor(color)); };
void strokeWidth(float strokeWidth) { m_StrokeWidth = strokeWidth; p_DirtyState = true; };
PaintStyle fillStyle() { return m_FillStyle; }
PaintStyle strokeStyle() { return m_StrokeStyle; }
/* Fill or stroke */
void fill();
void stroke();
void strokeFill();
private:
float* m_CommandsBuffer;
unsigned int m_CommandsSize;
float m_AA_Fringe = 1.0f;
float m_CareOfStroke = false;
// Transform the current commands to paths and fill points cache
void computePaths();
void computeJoins();
void __addCall();
void __addPath();
void __addPoint(const Math::Vec2f& position);
void __tesselateBezier(float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4, int level = 0);
/* DPR */
float m_TesselationTolerance;
/* -- Cache -- */
PathRendererCall* m_CurrentCall;
Path* m_CurrentPath;
Math::Vec4f m_Bounds;
Path* m_Paths;
PathPoint* m_Points;
unsigned int m_NPaths, m_NPoints;
PaintStyle m_FillStyle;
PaintStyle m_StrokeStyle;
float m_StrokeWidth;
protected:
PathRenderer();
virtual ~PathRenderer();
bool p_DirtyState;
virtual void pushVertex(const Math::Vec2f& position, const Math::Vec2f& uv) = 0;
virtual void pushCall(PathRendererCall* call) = 0;
virtual unsigned int getVertexOffset() = 0;
};
} }
#endif |
45bd3fb863a82d87a6b79072e589e81b50ebbdf7 | a3d6556180e74af7b555f8d47d3fea55b94bcbda | /components/signin/internal/identity_manager/account_capabilities_fetcher.cc | b93286b42e35b8226e530b23d00b92c5ef14ccc5 | [
"BSD-3-Clause"
] | permissive | chromium/chromium | aaa9eda10115b50b0616d2f1aed5ef35d1d779d6 | a401d6cf4f7bf0e2d2e964c512ebb923c3d8832c | refs/heads/main | 2023-08-24T00:35:12.585945 | 2023-08-23T22:01:11 | 2023-08-23T22:01:11 | 120,360,765 | 17,408 | 7,102 | BSD-3-Clause | 2023-09-10T23:44:27 | 2018-02-05T20:55:32 | null | UTF-8 | C++ | false | false | 923 | cc | account_capabilities_fetcher.cc | // Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "components/signin/internal/identity_manager/account_capabilities_fetcher.h"
AccountCapabilitiesFetcher::AccountCapabilitiesFetcher(
const CoreAccountInfo& account_info,
OnCompleteCallback on_complete_callback)
: account_info_(account_info),
on_complete_callback_(std::move(on_complete_callback)) {
DCHECK(on_complete_callback_);
}
AccountCapabilitiesFetcher::~AccountCapabilitiesFetcher() = default;
void AccountCapabilitiesFetcher::Start() {
DCHECK(!started_);
started_ = true;
StartImpl();
}
void AccountCapabilitiesFetcher::CompleteFetchAndMaybeDestroySelf(
const absl::optional<AccountCapabilities>& capabilities) {
DCHECK(on_complete_callback_);
std::move(on_complete_callback_).Run(account_info_.account_id, capabilities);
}
|
8e5cd0a0db0d1763acaeb231248befd3d8196836 | d14853c465ede75b0f18f3ee59654310580e2551 | /editor/mainwindow.h | 0c894c73ee44941c650eae4a5c3703bea91204ab | [] | no_license | k3a/Panther3D-2 | dec2f4ef742c1b57da1f17e2b55c39d471e0309a | f906796e331d70ac963d0b899c4c83c50b71cdc0 | refs/heads/master | 2021-01-10T22:23:02.226127 | 2014-11-08T21:31:46 | 2014-11-08T21:31:46 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 741 | h | mainwindow.h | #ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QtGui/QMainWindow>
#include "propertyeditor.h"
#include "engine.h"
namespace Ui
{
class MainWindow;
}
using namespace P3D;
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
MainWindow(QWidget *parent = 0);
~MainWindow();
PropertyEditor* GetPropertyEditor()const{ return propEditor; }
//static IEngine* mEngine(){ return s_pEngine; };
private slots:
void on_menu_about();
void on_testButton_clicked();
void on_action_Exit_activated();
private:
Ui::MainWindow *ui;
static Engine* s_pEngine;
// modules
//static IEngine* s_pEngine;
//
PropertyEditor* propEditor;
};
#endif // MAINWINDOW_H
|
20e9314641e2f4d25698d0fc411d69b6d761bc9a | 6c4aa65b25a759d63579086d323e074e4050cca8 | /Stream IO/PhoneBookWithFile/PhoneBookWithFile/PhoneBookWithFile.cpp | 5256f1048abfbc5c2926bde192c962a1ac9cb658 | [] | no_license | ElenaSerbova/C-OOP | 629e74c32c489b948792a7f7ac601cec2d367f12 | 410ed8845a3565f1b001c731d4207f27e1216953 | refs/heads/main | 2023-07-18T03:18:03.887635 | 2021-08-25T11:04:19 | 2021-08-25T11:04:19 | 348,690,051 | 1 | 0 | null | null | null | null | WINDOWS-1251 | C++ | false | false | 3,308 | cpp | PhoneBookWithFile.cpp | #include <iostream>
#include <fstream>
#include <string>
#include <iomanip>
using namespace std;
class Contact
{
public:
string name;
string phone;
};
//ввод данных с клавиатуры
void InputNewContact(Contact& contact);
//сохраниение контакта в файл
void SaveContact(const Contact& contact);
//считывание всех контактов из файла
void ReadContacts();
int main()
{
Contact contact;
InputNewContact(contact);
SaveContact(contact);
ReadContacts();
}
//ввод данных с клавиатуры
void InputNewContact(Contact& contact)
{
cout << "Enter name: ";
getline(cin, contact.name); //ввод строки с пробелами
cout << "Enter phone: ";
getline(cin, contact.phone);
}
//сохраниение контакта в файл
void SaveContact(const Contact& contact)
{
//открываем файл для добавления в бинарном режиме
//в первый раз он будет создаваться
ofstream fout("Contacts.bin", ios::app | ios::binary);
if (!fout.is_open())
{
cerr << "file not opened" << endl;
return;
}
//если записывать объект типа string в вфайл,
//то запишится лишь указатель, а не сами данные
//при ситывании файла это приведет к ошибке этапа выполнения
//т.к. считанный указатель будет битым
//в файл нужно записывать сами данные
//для того, чтобы при считывании знать сколько символов мы сохраняли
//я в начале записываю в файл размер строки, учитывая ноль терминатор
const char* name = contact.name.c_str();
int sizeName = contact.name.size() + 1;
const char* phone = contact.phone.c_str();
int sizePhone = contact.phone.size() + 1;
fout.write((char*)&sizeName, sizeof(int));
fout.write(name, sizeName);
fout.write((char*)&sizePhone, sizeof(int));
fout.write(phone, sizePhone);
fout.close();
}
void ReadContacts()
{
ifstream fin("Contacts.bin", ios::in | ios::binary);
if (!fin.is_open())
{
cerr << "file not opened" << endl;
return;
}
//при считывании из файла, вначале я считываю размер строки
//а затем саму строку
while (!fin.eof())
{
int size;
char name[255];
char phone[255];
fin.read((char*)&size, sizeof(int));
fin.read(name, size);
fin.read((char*)&size, sizeof(int));
fin.read(phone, size);
if (fin.good()) //если считывание прошло успешно
{
Contact contact; //создаем объект
contact.name = name; //и записываем в него данные
contact.phone = phone;
cout << setw(15) << contact.name
<< setw(10) << contact.phone << endl;
}
}
fin.close();
}
|
4422747d87f017189847f00a57bd6c30916f5d7d | ab5d268ff52f93985b2f59033856b00e110029e0 | /37_Sudoku Solver.cc | c63b1731c54ba2de4dec0c255b8422a62413b66c | [] | no_license | fiony/leetcode | 8d120a0f5ae9e2248003e36152a2cbe6431fbe63 | 216924f88478619d853d260fa640b3a5d349ea02 | refs/heads/master | 2021-01-02T09:00:36.192553 | 2018-02-15T13:03:41 | 2018-02-15T13:03:41 | 99,121,811 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,956 | cc | 37_Sudoku Solver.cc | class Solution {
private:
const int NUM = 9;
const int SUB_NUM = 3;
const int ALL_CANDIDATE = 0x1FF;
const int digit2flag [9] = {0x1, 0x2, 0x4, 0x8, 0x10, 0x20, 0x40, 0x80, 0x100};
public:
typedef struct{
int i;
int j;
int candidates; // avaialbe candidates to fill the cell
}cell;
void solveSudoku(vector<vector<char>>& board) {
//vector<vector<int>> candidates(NUM,vector<int>(NUM, 0));
vector<cell> solved_cells;
for(int i = 0; i < NUM; i++)
{
for(int j = 0; j < NUM; j++)
{
if(board[i][j] != '.') continue;
auto new_cell = cell{ i, j, ALL_CANDIDATE};
if(GetNextCandidate(new_cell, board))
{
// push to solved cell list
solved_cells.push_back(new_cell);
}else{
// cannot fill current cell, back track
while(true)
{
auto& prev_solved_cell = solved_cells.back();
if(GetNextCandidate(prev_solved_cell, board))
{
// set prev cell with next candidate
i = prev_solved_cell.i;
j = prev_solved_cell.j;
break;
}else
{
solved_cells.pop_back(); // back track
if(solved_cells.empty())
return; // failed to solve
}
}
}
}
}
return; //solved all cells
}
string ParseCandidates(int x)
{
string result;
for(int i=0; i < NUM; i++)
{
if((x & digit2flag[i]))
result.append(1, i +'1' );
}
return result;
}
// 1. initialize empty cell with all possible filled values (ie. candidates)
// 2. Fill the cell with next avaialbe candidate
// 3. If failed find next candidate to fill, clear the cell to empty
bool GetNextCandidate(cell& c, vector<vector<char>>& board)
{
int i = c.i;
int j = c.j;
int box_i = i/SUB_NUM * SUB_NUM;
int box_j = j/SUB_NUM * SUB_NUM;
char x = board[i][j];
if(x == '.')
{
//initialize alll possible candidates
for(int k = 0; k < NUM; k++)
{
// exclude others on the same row i
if(k != j && board[i][k] != '.')
c.candidates &= ~digit2flag[board[i][k]-'1']; //clear:&=~, set:|=, toggle:^=
// exclude others on the same col j
if(k != i && board[k][j] != '.')
c.candidates &= ~digit2flag[board[k][j]-'1'];
//exclude others in the same sub box
int ii = box_i + k / SUB_NUM;
int jj = box_j + k % SUB_NUM;
if( ii != i && jj != j && board[ii][jj] != '.' )
c.candidates &= ~digit2flag[board[ii][jj]-'1'];
}
}
// get next candidate from start_pos
int start_pos = (x=='.') ? 0 : (x-'1') + 1;
for(int k=start_pos; k < NUM; k++)
{
if((c.candidates & digit2flag[k]))
{
board[i][j] = k + '1'; // fill cell with the next candidate
//cout << "NEXT [" << i << ", " << j << "]=" << board[i][j] <<" candidates=" << ParseCandidates(c.candidates)<<endl;
return true;
}
}
board[i][j] = '.'; // clear cell if cannot find next candidate
//cout << "CLEAR [" << i << ", " << j << "]=" << board[i][j] << " candidates=" <<ParseCandidates(c.candidates) << endl;
return false;
}
};
|
fad9138625fcbe54395b4078108ed46910dca835 | 04ae93f4a65c511db92d8064f85851dcaf65eb07 | /ar_jitendra __testproject/basic/aruco_simple.cpp~ | 003310e25b75db247c34236ffd6fb6de15bbfc96 | [] | no_license | jitenderss/Summer14 | b32e1ddfc6f27f2ce5fe7b61c9e187d586a74102 | 049cba0fcb48f7986433e2b54f1e73f6d1d8ca8c | refs/heads/master | 2016-09-06T18:37:15.458495 | 2014-07-10T07:53:03 | 2014-07-10T07:53:03 | 19,976,957 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,102 | aruco_simple.cpp~ | #include <iostream>
#include <aruco/aruco.h>
#include <aruco/cvdrawingutils.h>
#include <opencv2/highgui/highgui.hpp>
using namespace cv;
using namespace aruco;
int main(int argc,char **argv)
{
try
{
if (argc!=2) {
cerr<<"Usage: in.jpg "<<endl;
return -1;
}
MarkerDetector MDetector;
vector<Marker> Markers;
//read the input image
cv::Mat InImage;
InImage=cv::imread(argv[1]);
//Ok, let's detect
MDetector.detect(InImage,Markers);
//for each marker, draw info and its boundaries in the image
for (unsigned int i=0;i<Markers.size();i++) {
cout<<Markers[i]<<endl;
cout<<Markers[0][0].x<<endl;
cout<<Markers[0].Tvec.at<float>(0,0)<<endl; //x value of Tvec and Markers[0].Tvec then whole Tvec will be printed
Markers[i].draw(InImage,Scalar(0,0,255),2);
}
cv::imshow("in",InImage);
cv::waitKey(0);//wait for key to be pressed
} catch (std::exception &ex)
{
cout<<"Exception :"<<ex.what()<<endl;
}
return 0;
}
| |
d0c84688da5633d40e8f6cf5cda34fa55a0bb467 | 46e3575e04c55b84c3c7bb5dc60fa6d34d5f4236 | /KaboomGraphicsEngine/stdafx.h | da694b3bc178ff7983851eb8047cf68f8865ff9d | [] | no_license | blockspacer/Kaboom | ba269827bdc86cba890f48ee0cc0134f7bda8acc | 6b75e1a5ff08ef1ebdb73bbd07c4fe8214644e58 | refs/heads/master | 2021-03-03T19:16:26.676258 | 2017-04-20T04:58:37 | 2017-04-20T04:58:37 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 936 | h | stdafx.h | // stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
//
#pragma once
#include "targetver.h"
#include <stdio.h>
#include <tchar.h>
#include <iostream>
#include <string>
#include <vector>
#include <iostream>
#include <fstream>
#include <algorithm>
#include <set>
#include <map>
#include <unordered_map>
#include <list>
#include <deque>
#include <memory>
#include <osg/Vec3>
#include <osgDB/ReadFile>
#include <osgDB/FileUtils>
#include <osgDB/FileNameUtils>
#include <osgDB/Options>
#include <osgDB/XmlParser>
#include <osg/Texture2D>
#include <osg/ShapeDrawable>
#include <osg/Geometry>
#include <osg/MatrixTransform>
#include <osgDB/ReadFile>
#include <osgUtil/LineSegmentIntersector>
#include <osgText/Text>
#include <osgViewer/Viewer>
#include <osg/io_utils>
// TODO: reference additional headers your program requires here
|
853f80ddc2febf1c75ea0ecf0be960551186ea39 | 6d258d9abc888d6c4640b77afa23355f9bafb5a0 | /c++17/boyer_moore.cpp | a3bd4d3f1c8588efc8def2f97288c0483f9dbae7 | [] | no_license | ohwada/MAC_cpp_Samples | e281130c8fd339ec327d4fad6d8cdf4e9bab4edc | 74699e40343f13464d64cf5eb3e965140a6b31a2 | refs/heads/master | 2023-02-05T00:50:47.447668 | 2023-01-28T05:09:34 | 2023-01-28T05:09:34 | 237,116,830 | 15 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 715 | cpp | boyer_moore.cpp | /**
* boyer_moore.cpp
* 2022-06-01 K.OHWADA
*/
// g++-11 boyer_moore.cpp -std=c++17
// reference : https://qiita.com/Reputeless/items/db7dda0096f3ae91d450
#include <iostream>
#include <string>
#include <algorithm>
/**
* main
*/
int main()
{
const std::string in = "ATGGTTGGTTCGCTAAACTGCATCGTCGCTGTGTCCCAGAA";
const std::string pattern = "TGTGTCCCAG";
std::boyer_moore_searcher searcher(pattern.begin(), pattern.end());
const auto it = std::search(in.begin(), in.end(), searcher);
if (it != in.end())
{
// found
std::cout << std::distance(in.begin(), it) << std::endl; // 29
}
else
{
std::cout << "not found" << std::endl;;
}
}
// 29
|
98bc1d79d8141d9caf6fd50ac14076c93a817f49 | de45eb787bf813be6f2a1951f514984b4e36c039 | /WindowsStore/WindowsStoreImpl.cpp | 3a3999d32e598b45453e5c0772865d8041ecec07 | [
"LicenseRef-scancode-generic-cla",
"MIT"
] | permissive | microsoft/MFCStoreClient | bfedeea23df0731652b4a42121f8c95bcbbc2085 | 5da0d0c5c25fd444c60b418a61a4b72e1ff04723 | refs/heads/master | 2023-08-24T12:48:13.725927 | 2022-09-01T21:30:42 | 2022-09-01T21:30:42 | 160,876,128 | 14 | 11 | MIT | 2022-09-01T21:30:43 | 2018-12-07T21:14:34 | C++ | UTF-8 | C++ | false | false | 5,683 | cpp | WindowsStoreImpl.cpp | // Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
#include "WindowsStoreImpl.h"
#include <ppltasks.h>
#include <shobjidl.h>
#include <wrl.h>
#include <string>
#include <sstream>
#include <functional>
using namespace concurrency;
using namespace WinRT;
using namespace Microsoft::WRL;
using namespace Windows::Foundation;
using namespace Windows::Services::Store;
using namespace Windows::Storage::Streams;
using namespace std::placeholders;
using namespace std::placeholders;
WindowsStoreImpl::WindowsStoreImpl()
{
}
WindowsStoreImpl::~WindowsStoreImpl()
{
if (m_storeContext != nullptr)
{
m_storeContext->OfflineLicensesChanged -= m_eventRegistrationToken;
}
}
WindowsStoreErrorType WindowsStoreImpl::Initialize(HWND hwnd, WindowsStoreCallback licenseChangedCallback, void* userData)
{
WindowsStoreErrorType result = WINRT_NO_ERROR;
m_licenseChangedCallback = licenseChangedCallback;
m_hwnd = hwnd;
m_userData = userData;
m_storeContext = StoreContext::GetDefault();
m_eventRegistrationToken = m_storeContext->OfflineLicensesChanged += ref new TypedEventHandler<StoreContext^, Platform::Object^>(std::bind(&WindowsStoreImpl::OfflineLicensesChanged, this, _1, _2));
return result;
}
void WindowsStoreImpl::Purchase(WindowsStoreCallback callback, void* userData)
{
// Assign the app's hwnd to the storeContext
ComPtr<IInitializeWithWindow> initWindow;
IUnknown* temp = reinterpret_cast<IUnknown*>(m_storeContext);
HRESULT hr = temp->QueryInterface(initWindow.GetAddressOf());
if (SUCCEEDED(hr))
{
hr = initWindow->Initialize(m_hwnd);
if (!SUCCEEDED(hr))
{
std::wstringstream ws;
callback(hr, L"Can't initial StoreContext with hwnd: ", userData);
return;
}
}
create_task(m_storeContext->GetStoreProductForCurrentAppAsync()).then([this, callback, userData](StoreProductResult^ productResult)
{
if (productResult->ExtendedError.Value != S_OK)
{
std::wstringstream ws;
ws << L"GetStoreProductForCurrentAppAsync Error: " << productResult->ExtendedError.Value;
callback(productResult->ExtendedError.Value, ws.str().c_str(), userData);
return;
}
create_task(m_storeContext->GetAppLicenseAsync()).then([this, productResult, callback, userData](StoreAppLicense^ license)
{
if (license->IsTrial)
{
create_task(productResult->Product->RequestPurchaseAsync()).then([this, callback, userData](StorePurchaseResult^ result)
{
std::wstringstream ws;
switch (result->Status)
{
case StorePurchaseStatus::AlreadyPurchased:
ws << L"You already bought this app and have a fully-licensed version.";
break;
case StorePurchaseStatus::Succeeded:
// License will refresh automatically using the StoreContext.OfflineLicensesChanged event
break;
case StorePurchaseStatus::NotPurchased:
ws << L"Product was not purchased, it may have been canceled";
break;
case StorePurchaseStatus::NetworkError:
ws << L"Product was not purchased due to a Network Error.";
break;
case StorePurchaseStatus::ServerError:
ws << L"Product was not purchased due to a Server Error.";
break;
default:
ws << L"Product was not purchased due to a Unknown Error.";
break;
}
callback(E_FAIL, ws.str().c_str(), userData);
});
}
else
{
std::wstringstream ws;
callback(S_OK, L"You already bought this app and have a fully-licensed version.", userData);
}
}, task_continuation_context::get_current_winrt_context());
}, task_continuation_context::get_current_winrt_context());
}
void WindowsStoreImpl::GetLicenseState(WindowsStoreCallback callback, void* userData)
{
create_task(m_storeContext->GetAppLicenseAsync()).then([this, callback, userData](StoreAppLicense^ license)
{
if (license->IsActive)
{
if (license->IsTrial)
{
callback(S_OK, L"IsTrial", userData);
}
else
{
callback(S_OK, L"Full", userData);
}
}
else
{
callback(S_OK, L"inactive", userData);
}
}, task_continuation_context::get_current_winrt_context());
}
void WindowsStoreImpl::GetPrice(WindowsStoreCallback callback, void* userData)
{
create_task(m_storeContext->GetStoreProductForCurrentAppAsync()).then([this, callback, userData](StoreProductResult^ result)
{
if (result->ExtendedError.Value == S_OK)
{
callback(S_OK, result->Product->Price->FormattedPrice->Data(), userData);
}
else
{
callback(result->ExtendedError.Value, L"Unknown", userData);
}
}, task_continuation_context::get_current_winrt_context());
}
void WindowsStoreImpl::OfflineLicensesChanged(StoreContext^ sender, Platform::Object^ args)
{
if (m_licenseChangedCallback != nullptr)
{
GetLicenseState(m_licenseChangedCallback, m_userData);
}
}
|
b498e12969f64dbad4f6a3d3808ea62c41fe1466 | d9b6de55af0b6e1493fc77abd28a9cab21ed5c36 | /unit_tests/_gtest_extensions/gtest_throw_what.hh | 7ceb45b35edb06146897a073d4827b5b85a57ab3 | [] | no_license | flow123d/flow123d | 016af7cd55b5a8ed9426d843aace62f12b01cbb1 | 1f02b2c851f0e6ec2f93321b623000381b558a0b | refs/heads/master | 2023-09-05T01:38:06.288200 | 2023-09-04T13:24:38 | 2023-09-04T13:24:38 | 13,628,170 | 17 | 16 | null | 2023-09-12T11:27:36 | 2013-10-16T18:56:28 | C++ | UTF-8 | C++ | false | false | 2,787 | hh | gtest_throw_what.hh | /*
* gtest_throw_what.hh
*
* Created on: May 21, 2012
* Author: jb
*/
#ifndef GTEST_THROW_WHAT_HH_
#define GTEST_THROW_WHAT_HH_
/**
* Macros for death test that test particular class of exception
* and more over test contents of message created by its what() method.
*/
#include <gtest/gtest.h>
// Returns an indented copy of stderr output for a death test.
// This makes distinguishing death test output lines from regular log lines
// much easier.
static ::std::string FormatDeathTestOutput(const ::std::string& output) {
::std::string ret;
for (size_t at = 0; ; ) {
const size_t line_end = output.find('\n', at);
ret += "[ DEATH ] ";
if (line_end == ::std::string::npos) {
ret += output.substr(at);
break;
}
ret += output.substr(at, line_end + 1 - at);
at = line_end + 1;
}
return ret;
}
#define GTEST_TEST_THROW_WHAT_(statement, expected_exception, re_pattern, fail) \
GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
if (::testing::internal::ConstCharPtr gtest_msg = "") { \
bool gtest_caught_expected = false; \
try { \
GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \
} \
catch (expected_exception const& exc) { \
gtest_caught_expected = true; \
char const * msg = exc.what(); \
const ::testing::internal::RE& gtest_regex = (re_pattern); \
if (msg == NULL || ! ::testing::internal::RE::PartialMatch(msg, gtest_regex ) ) { \
std::ostringstream buffer; \
buffer << " Result: throws but not with expected message.\n" \
<< " Expected: " << gtest_regex.pattern() << "\n" \
<< "Actual msg:\n" << FormatDeathTestOutput(std::string(msg)); \
buffer << std::endl; \
static std::string msg_buffer = buffer.str(); \
gtest_msg.value = msg_buffer.c_str(); \
goto GTEST_CONCAT_TOKEN_(gtest_label_testthrow_, __LINE__); \
} \
} \
catch (...) { \
gtest_msg.value = \
"Expected: " #statement " throws an exception of type " \
#expected_exception ".\n Actual: it throws a different type."; \
goto GTEST_CONCAT_TOKEN_(gtest_label_testthrow_, __LINE__); \
} \
if (!gtest_caught_expected) { \
gtest_msg.value = \
"Expected: " #statement " throws an exception of type " \
#expected_exception ".\n Actual: it throws nothing."; \
goto GTEST_CONCAT_TOKEN_(gtest_label_testthrow_, __LINE__); \
} \
} else \
GTEST_CONCAT_TOKEN_(gtest_label_testthrow_, __LINE__): \
fail(gtest_msg.value)
#define EXPECT_THROW_WHAT(statement, expected_exception, pattern) \
GTEST_TEST_THROW_WHAT_(statement, expected_exception, pattern, GTEST_NONFATAL_FAILURE_)
#endif /* GTEST_THROW_WHAT_HH_ */
|
9a3a07a30626c59663dedd2f4cbaafc14ef91667 | ffac7f82e8e637c4b283b274d053c576a6e442e6 | /software-renderer/crender-mt/crender-base.h | 528c5cb823959a68bc67523d3140227356d3a0c3 | [] | no_license | Zeimd/crender-mt | fb4dd919849c535c6676163fd5460ee7e7ff631e | ac577975fa99f95ef8d59c11153df198d71b4961 | refs/heads/master | 2022-12-08T22:41:01.296965 | 2022-12-06T12:21:33 | 2022-12-06T12:21:33 | 157,098,182 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 799 | h | crender-base.h | /*****************************************************************************
*
* crender-base.h
*
* By Jari Korkala 4/2013
*
*****************************************************************************/
#ifndef _CENG_CRENDER_BASE_H
#define _CENG_CRENDER_BASE_H
#include <ceng/datatypes/basic-types.h>
#include <ceng/datatypes/return-val.h>
#include <ceng/datatypes/boolean.h>
namespace Ceng
{
static const UINT32 CRENDER_MAX_COLOR_TARGETS = 8;
static const UINT32 CRENDER_MAX_SHADER_TEXTURES = 8;
static const UINT32 CRENDER_MAX_VTX_DECL_FLOATS = 64;
static const UINT32 CRENDER_MAX_VERTEX_STREAMS = 8;
static const UINT32 CRENDER_TEXCOORD_MAX_INDEX = 8;
static const Ceng::FLOAT32 math_pi = 3.1415926535f;
static const Ceng::FLOAT32 degrees_to_radians = math_pi / 180.0f;
}
#endif |
a003e80659f0c7195781d9043d72b49ca5d5b0b5 | d932716790743d0e2ae7db7218fa6d24f9bc85dc | /ash/laser/laser_pointer_view.cc | 81d376e6c22ef26d3b9ed3c09cc24747b2c6d981 | [
"BSD-3-Clause"
] | permissive | vade/chromium | c43f0c92fdede38e8a9b858abd4fd7c2bb679d9c | 35c8a0b1c1a76210ae000a946a17d8979b7d81eb | refs/heads/Syphon | 2023-02-28T00:10:11.977720 | 2017-05-24T16:38:21 | 2017-05-24T16:38:21 | 80,049,719 | 19 | 3 | null | 2017-05-24T19:05:34 | 2017-01-25T19:31:53 | null | UTF-8 | C++ | false | false | 28,870 | cc | laser_pointer_view.cc | // Copyright 2016 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 "ash/laser/laser_pointer_view.h"
#include <GLES2/gl2.h>
#include <GLES2/gl2ext.h>
#include <GLES2/gl2extchromium.h>
#include <algorithm>
#include <array>
#include <cmath>
#include <memory>
#include "ash/laser/laser_pointer_points.h"
#include "ash/laser/laser_segment_utils.h"
#include "ash/public/cpp/shell_window_ids.h"
#include "ash/shell.h"
#include "base/containers/adapters.h"
#include "base/memory/ptr_util.h"
#include "base/threading/thread_task_runner_handle.h"
#include "base/trace_event/trace_event.h"
#include "cc/output/compositor_frame.h"
#include "cc/output/compositor_frame_sink.h"
#include "cc/output/compositor_frame_sink_client.h"
#include "cc/output/context_provider.h"
#include "cc/quads/texture_draw_quad.h"
#include "cc/resources/texture_mailbox.h"
#include "cc/resources/transferable_resource.h"
#include "gpu/command_buffer/client/context_support.h"
#include "gpu/command_buffer/client/gles2_interface.h"
#include "gpu/command_buffer/client/gpu_memory_buffer_manager.h"
#include "third_party/skia/include/core/SkColor.h"
#include "third_party/skia/include/core/SkTypes.h"
#include "ui/aura/env.h"
#include "ui/aura/window.h"
#include "ui/base/layout.h"
#include "ui/events/base_event_utils.h"
#include "ui/events/event.h"
#include "ui/gfx/canvas.h"
#include "ui/gfx/gpu_memory_buffer.h"
#include "ui/views/widget/widget.h"
namespace ash {
namespace {
// Variables for rendering the laser. Radius in DIP.
const float kPointInitialRadius = 5.0f;
const float kPointFinalRadius = 0.25f;
const int kPointInitialOpacity = 200;
const int kPointFinalOpacity = 10;
const SkColor kPointColor = SkColorSetRGB(255, 0, 0);
// Change this when debugging prediction code.
const SkColor kPredictionPointColor = kPointColor;
float DistanceBetweenPoints(const gfx::PointF& point1,
const gfx::PointF& point2) {
return (point1 - point2).Length();
}
float LinearInterpolate(float initial_value,
float final_value,
float progress) {
return initial_value + (final_value - initial_value) * progress;
}
} // namespace
////////////////////////////////////////////////////////////////////////////////
// The laser segment calcuates the path needed to draw a laser segment. A laser
// segment is used instead of just a regular line segments to avoid overlapping.
// A laser segment looks as follows:
// _______ _________ _________ _________
// / \ \ / / / / \ |
// | A | 2|. B .|1 2|. C .|1 2|. D \.1 |
// | | | | | | | / |
// \_____/ /_______\ \_________\ \_________/ |
//
//
// Given a start and end point (represented by the periods in the above
// diagrams), we create each segment by projecting each point along the normal
// to the line segment formed by the start(1) and end(2) points. We then
// create a path using arcs and lines. There are three types of laser segments:
// head(B), regular(C) and tail(D). A typical laser is created by rendering one
// tail(D), zero or more regular segments(C), one head(B) and a circle at the
// end(A). They are meant to fit perfectly with the previous and next segments,
// so that no whitespace/overlap is shown.
// A more detailed version of this is located at https://goo.gl/qixdux.
class LaserSegment {
public:
LaserSegment(const std::vector<gfx::PointF>& previous_points,
const gfx::PointF& start_point,
const gfx::PointF& end_point,
float start_radius,
float end_radius,
bool is_last_segment) {
DCHECK(previous_points.empty() || previous_points.size() == 2u);
bool is_first_segment = previous_points.empty();
// Calculate the variables for the equation of the lines which pass through
// the start and end points, and are perpendicular to the line segment
// between the start and end points.
float slope, start_y_intercept, end_y_intercept;
ComputeNormalLineVariables(start_point, end_point, &slope,
&start_y_intercept, &end_y_intercept);
// Project the points along normal line by the given radius.
gfx::PointF end_first_projection, end_second_projection;
ComputeProjectedPoints(end_point, slope, end_y_intercept, end_radius,
&end_first_projection, &end_second_projection);
// Create a collection of the points used to create the path and reorder
// them as needed.
std::vector<gfx::PointF> ordered_points;
ordered_points.reserve(4);
if (!is_first_segment) {
ordered_points.push_back(previous_points[1]);
ordered_points.push_back(previous_points[0]);
} else {
// We push two of the same point, so that for both cases we have 4 points,
// and we can use the same indexes when creating the path.
ordered_points.push_back(start_point);
ordered_points.push_back(start_point);
}
// Push the projected points so that the the smaller angle relative to the
// line segment between the two data points is first. This will ensure there
// is always a anticlockwise arc between the last two points, and always a
// clockwise arc for these two points if and when they are used in the next
// segment.
if (IsFirstPointSmallerAngle(start_point, end_point, end_first_projection,
end_second_projection)) {
ordered_points.push_back(end_first_projection);
ordered_points.push_back(end_second_projection);
} else {
ordered_points.push_back(end_second_projection);
ordered_points.push_back(end_first_projection);
}
// Create the path. The path always goes as follows:
// 1. Move to point 0.
// 2. Arc clockwise from point 0 to point 1. This step is skipped if it
// is the tail segment.
// 3. Line from point 1 to point 2.
// 4. Arc anticlockwise from point 2 to point 3. Arc clockwise if this is
// the head segment.
// 5. Line from point 3 to point 0.
// 2 1
// *---------* |
// / / |
// | | |
// | | |
// \ \ |
// *--------*
// 3 0
DCHECK_EQ(4u, ordered_points.size());
path_.moveTo(ordered_points[0].x(), ordered_points[0].y());
if (!is_first_segment) {
path_.arcTo(start_radius, start_radius, 180.0f, gfx::Path::kSmall_ArcSize,
gfx::Path::kCW_Direction, ordered_points[1].x(),
ordered_points[1].y());
}
path_.lineTo(ordered_points[2].x(), ordered_points[2].y());
path_.arcTo(
end_radius, end_radius, 180.0f, gfx::Path::kSmall_ArcSize,
is_last_segment ? gfx::Path::kCW_Direction : gfx::Path::kCCW_Direction,
ordered_points[3].x(), ordered_points[3].y());
path_.lineTo(ordered_points[0].x(), ordered_points[0].y());
// Store data to be used by the next segment.
path_points_.push_back(ordered_points[2]);
path_points_.push_back(ordered_points[3]);
}
SkPath path() const { return path_; }
std::vector<gfx::PointF> path_points() const { return path_points_; }
private:
SkPath path_;
std::vector<gfx::PointF> path_points_;
DISALLOW_COPY_AND_ASSIGN(LaserSegment);
};
class LaserCompositorFrameSinkHolder : public cc::CompositorFrameSinkClient {
public:
LaserCompositorFrameSinkHolder(
LaserPointerView* view,
std::unique_ptr<cc::CompositorFrameSink> frame_sink)
: view_(view), frame_sink_(std::move(frame_sink)) {
frame_sink_->BindToClient(this);
}
~LaserCompositorFrameSinkHolder() override {
frame_sink_->DetachFromClient();
}
cc::CompositorFrameSink* frame_sink() { return frame_sink_.get(); }
// Called before laser pointer view is destroyed.
void OnLaserPointerViewDestroying() { view_ = nullptr; }
// Overridden from cc::CompositorFrameSinkClient:
void SetBeginFrameSource(cc::BeginFrameSource* source) override {}
void ReclaimResources(const cc::ReturnedResourceArray& resources) override {
if (view_)
view_->ReclaimResources(resources);
}
void SetTreeActivationCallback(const base::Closure& callback) override {}
void DidReceiveCompositorFrameAck() override {
if (view_)
view_->DidReceiveCompositorFrameAck();
}
void DidLoseCompositorFrameSink() override {}
void OnDraw(const gfx::Transform& transform,
const gfx::Rect& viewport,
bool resourceless_software_draw) override {}
void SetMemoryPolicy(const cc::ManagedMemoryPolicy& policy) override {}
void SetExternalTilePriorityConstraints(
const gfx::Rect& viewport_rect,
const gfx::Transform& transform) override {}
private:
LaserPointerView* view_;
std::unique_ptr<cc::CompositorFrameSink> frame_sink_;
DISALLOW_COPY_AND_ASSIGN(LaserCompositorFrameSinkHolder);
};
// This struct contains the resources associated with a laser pointer frame.
struct LaserResource {
LaserResource() {}
~LaserResource() {
if (context_provider) {
gpu::gles2::GLES2Interface* gles2 = context_provider->ContextGL();
if (texture)
gles2->DeleteTextures(1, &texture);
if (image)
gles2->DestroyImageCHROMIUM(image);
}
}
scoped_refptr<cc::ContextProvider> context_provider;
uint32_t texture = 0;
uint32_t image = 0;
gpu::Mailbox mailbox;
};
// LaserPointerView
LaserPointerView::LaserPointerView(base::TimeDelta life_duration,
base::TimeDelta presentation_delay,
aura::Window* root_window)
: laser_points_(life_duration),
predicted_laser_points_(life_duration),
presentation_delay_(presentation_delay),
weak_ptr_factory_(this) {
widget_.reset(new views::Widget);
views::Widget::InitParams params;
params.type = views::Widget::InitParams::TYPE_WINDOW_FRAMELESS;
params.name = "LaserOverlay";
params.accept_events = false;
params.activatable = views::Widget::InitParams::ACTIVATABLE_NO;
params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET;
params.opacity = views::Widget::InitParams::TRANSLUCENT_WINDOW;
params.parent =
Shell::GetContainer(root_window, kShellWindowId_OverlayContainer);
params.layer_type = ui::LAYER_SOLID_COLOR;
widget_->Init(params);
widget_->Show();
widget_->SetContentsView(this);
widget_->SetBounds(root_window->GetBoundsInScreen());
set_owned_by_client();
scale_factor_ = ui::GetScaleFactorForNativeView(widget_->GetNativeView());
frame_sink_holder_ = base::MakeUnique<LaserCompositorFrameSinkHolder>(
this, widget_->GetNativeView()->CreateCompositorFrameSink());
}
LaserPointerView::~LaserPointerView() {
frame_sink_holder_->OnLaserPointerViewDestroying();
}
void LaserPointerView::Stop() {
buffer_damage_rect_.Union(GetBoundingBox());
laser_points_.Clear();
predicted_laser_points_.Clear();
OnPointsUpdated();
}
void LaserPointerView::AddNewPoint(const gfx::PointF& new_point,
const base::TimeTicks& new_time) {
TRACE_EVENT1("ui", "LaserPointerView::AddNewPoint", "new_point",
new_point.ToString());
TRACE_COUNTER1(
"ui", "LaserPointerPredictionError",
predicted_laser_points_.GetNumberOfPoints()
? std::round((new_point -
predicted_laser_points_.laser_points().front().location)
.Length())
: 0);
buffer_damage_rect_.Union(GetBoundingBox());
laser_points_.AddPoint(new_point, new_time);
// Current time is needed to determine presentation time and the number of
// predicted points to add.
base::TimeTicks current_time = ui::EventTimeForNow();
// Create a new set of predicted points based on the last four points added.
// We add enough predicted points to fill the time between the new point and
// the expected presentation time. Note that estimated presentation time is
// based on current time and inefficient rendering of points can result in an
// actual presentation time that is later.
predicted_laser_points_.Clear();
// Normalize all coordinates to screen size.
gfx::Size screen_size = widget_->GetNativeView()->GetBoundsInScreen().size();
gfx::Vector2dF scale(1.0f / screen_size.width(), 1.0f / screen_size.height());
// TODO(reveman): Determine interval based on history when event time stamps
// are accurate. b/36137953
const float kPredictionIntervalMs = 5.0f;
const float kMaxPointIntervalMs = 10.0f;
base::TimeDelta prediction_interval =
base::TimeDelta::FromMilliseconds(kPredictionIntervalMs);
base::TimeDelta max_point_interval =
base::TimeDelta::FromMilliseconds(kMaxPointIntervalMs);
base::TimeTicks last_point_time = new_time;
gfx::PointF last_point_location =
gfx::ScalePoint(new_point, scale.x(), scale.y());
// Use the last four points for prediction.
using PositionArray = std::array<gfx::PointF, 4>;
PositionArray position;
PositionArray::iterator it = position.begin();
for (const auto& point : base::Reversed(laser_points_.laser_points())) {
// Stop adding positions if interval between points is too large to provide
// an accurate history for prediction.
if ((last_point_time - point.time) > max_point_interval)
break;
last_point_time = point.time;
last_point_location = gfx::ScalePoint(point.location, scale.x(), scale.y());
*it++ = last_point_location;
// Stop when no more positions are needed.
if (it == position.end())
break;
}
// Pad with last point if needed.
std::fill(it, position.end(), last_point_location);
// Note: Currently there's no need to divide by the time delta between
// points as we assume a constant delta between points that matches the
// prediction point interval.
gfx::Vector2dF velocity[3];
for (size_t i = 0; i < arraysize(velocity); ++i)
velocity[i] = position[i] - position[i + 1];
gfx::Vector2dF acceleration[2];
for (size_t i = 0; i < arraysize(acceleration); ++i)
acceleration[i] = velocity[i] - velocity[i + 1];
gfx::Vector2dF jerk = acceleration[0] - acceleration[1];
// Adjust max prediction time based on speed as prediction data is not great
// at lower speeds.
const float kMaxPredictionScaleSpeed = 1e-5;
double speed = velocity[0].LengthSquared();
base::TimeTicks max_prediction_time =
current_time +
std::min(presentation_delay_ * (speed / kMaxPredictionScaleSpeed),
presentation_delay_);
// Add predicted points until we reach the max prediction time.
gfx::PointF location = position[0];
for (base::TimeTicks time = new_time + prediction_interval;
time < max_prediction_time; time += prediction_interval) {
// Note: Currently there's no need to multiply by the prediction interval
// as the velocity is calculated based on a time delta between points that
// is the same as the prediction interval.
velocity[0] += acceleration[0];
acceleration[0] += jerk;
location += velocity[0];
predicted_laser_points_.AddPoint(
gfx::ScalePoint(location, screen_size.width(), screen_size.height()),
time);
// Always stop at three predicted points as a four point history doesn't
// provide accurate prediction of more points.
if (predicted_laser_points_.GetNumberOfPoints() == 3)
break;
}
// Move forward to next presentation time.
base::TimeTicks next_presentation_time = current_time + presentation_delay_;
laser_points_.MoveForwardToTime(next_presentation_time);
predicted_laser_points_.MoveForwardToTime(next_presentation_time);
buffer_damage_rect_.Union(GetBoundingBox());
OnPointsUpdated();
}
void LaserPointerView::UpdateTime() {
buffer_damage_rect_.Union(GetBoundingBox());
// Do not add the point but advance the time if the view is in process of
// fading away.
base::TimeTicks next_presentation_time =
ui::EventTimeForNow() + presentation_delay_;
laser_points_.MoveForwardToTime(next_presentation_time);
predicted_laser_points_.MoveForwardToTime(next_presentation_time);
buffer_damage_rect_.Union(GetBoundingBox());
OnPointsUpdated();
}
void LaserPointerView::DidReceiveCompositorFrameAck() {
base::ThreadTaskRunnerHandle::Get()->PostTask(
FROM_HERE, base::Bind(&LaserPointerView::OnDidDrawSurface,
weak_ptr_factory_.GetWeakPtr()));
}
void LaserPointerView::ReclaimResources(
const cc::ReturnedResourceArray& resources) {
DCHECK_EQ(resources.size(), 1u);
auto it = resources_.find(resources.front().id);
DCHECK(it != resources_.end());
std::unique_ptr<LaserResource> resource = std::move(it->second);
resources_.erase(it);
gpu::gles2::GLES2Interface* gles2 = resource->context_provider->ContextGL();
if (resources.front().sync_token.HasData())
gles2->WaitSyncTokenCHROMIUM(resources.front().sync_token.GetConstData());
if (!resources.front().lost)
returned_resources_.push_back(std::move(resource));
}
gfx::Rect LaserPointerView::GetBoundingBox() {
// Expand the bounding box so that it includes the radius of the points on the
// edges and antialiasing.
gfx::Rect bounding_box = laser_points_.GetBoundingBox();
bounding_box.Union(predicted_laser_points_.GetBoundingBox());
const int kOutsetForAntialiasing = 1;
int outset = kPointInitialRadius + kOutsetForAntialiasing;
bounding_box.Inset(-outset, -outset);
return bounding_box;
}
void LaserPointerView::OnPointsUpdated() {
if (pending_update_buffer_)
return;
pending_update_buffer_ = true;
base::ThreadTaskRunnerHandle::Get()->PostTask(
FROM_HERE, base::Bind(&LaserPointerView::UpdateBuffer,
weak_ptr_factory_.GetWeakPtr()));
}
void LaserPointerView::UpdateBuffer() {
TRACE_EVENT1("ui", "LaserPointerView::UpdatedBuffer", "damage",
buffer_damage_rect_.ToString());
DCHECK(pending_update_buffer_);
pending_update_buffer_ = false;
gfx::Rect screen_bounds = widget_->GetNativeView()->GetBoundsInScreen();
gfx::Rect update_rect = buffer_damage_rect_;
buffer_damage_rect_ = gfx::Rect();
// Create and map a single GPU memory buffer. The laser pointer will be
// written into this buffer without any buffering. The result is that we
// might be modifying the buffer while it's being displayed. This provides
// minimal latency but potential tearing. Note that we have to draw into
// a temporary surface and copy it into GPU memory buffer to avoid flicker.
if (!gpu_memory_buffer_) {
gpu_memory_buffer_ =
aura::Env::GetInstance()
->context_factory()
->GetGpuMemoryBufferManager()
->CreateGpuMemoryBuffer(
gfx::ScaleToCeiledSize(screen_bounds.size(), scale_factor_),
SK_B32_SHIFT ? gfx::BufferFormat::RGBA_8888
: gfx::BufferFormat::BGRA_8888,
gfx::BufferUsage::SCANOUT_CPU_READ_WRITE,
gpu::kNullSurfaceHandle);
if (!gpu_memory_buffer_) {
LOG(ERROR) << "Failed to allocate GPU memory buffer";
return;
}
// Make sure the first update rectangle covers the whole buffer.
update_rect = gfx::Rect(screen_bounds.size());
}
// Constrain update rectangle to buffer size and early out if empty.
update_rect.Intersect(gfx::Rect(screen_bounds.size()));
if (update_rect.IsEmpty())
return;
// Map buffer for writing.
if (!gpu_memory_buffer_->Map()) {
LOG(ERROR) << "Failed to map GPU memory buffer";
return;
}
// Create a temporary canvas for update rectangle.
gfx::Canvas canvas(update_rect.size(), scale_factor_, false);
cc::PaintFlags flags;
flags.setStyle(cc::PaintFlags::kFill_Style);
flags.setAntiAlias(true);
// Compute the offset of the current widget.
gfx::Vector2d widget_offset(
widget_->GetNativeView()->GetBoundsInRootWindow().origin().x(),
widget_->GetNativeView()->GetBoundsInRootWindow().origin().y());
int num_points = laser_points_.GetNumberOfPoints() +
predicted_laser_points_.GetNumberOfPoints();
if (num_points) {
LaserPointerPoints::LaserPoint previous_point = laser_points_.GetOldest();
previous_point.location -= widget_offset + update_rect.OffsetFromOrigin();
LaserPointerPoints::LaserPoint current_point;
std::vector<gfx::PointF> previous_segment_points;
float previous_radius;
int current_opacity;
for (int i = 0; i < num_points; ++i) {
if (i < laser_points_.GetNumberOfPoints()) {
current_point = laser_points_.laser_points()[i];
} else {
current_point =
predicted_laser_points_
.laser_points()[i - laser_points_.GetNumberOfPoints()];
}
current_point.location -= widget_offset + update_rect.OffsetFromOrigin();
// Set the radius and opacity based on the distance.
float current_radius = LinearInterpolate(
kPointInitialRadius, kPointFinalRadius, current_point.age);
current_opacity = static_cast<int>(LinearInterpolate(
kPointInitialOpacity, kPointFinalOpacity, current_point.age));
// If we draw laser_points_ that are within a stroke width of each other,
// the result will be very jagged, unless we are on the last point, then
// we draw regardless.
float distance_threshold = current_radius * 2.0f;
if (DistanceBetweenPoints(previous_point.location,
current_point.location) <= distance_threshold &&
i != num_points - 1) {
continue;
}
LaserSegment current_segment(
previous_segment_points, gfx::PointF(previous_point.location),
gfx::PointF(current_point.location), previous_radius, current_radius,
i == num_points - 1);
SkPath path = current_segment.path();
if (i < laser_points_.GetNumberOfPoints())
flags.setColor(SkColorSetA(kPointColor, current_opacity));
else
flags.setColor(SkColorSetA(kPredictionPointColor, current_opacity));
canvas.DrawPath(path, flags);
previous_segment_points = current_segment.path_points();
previous_radius = current_radius;
previous_point = current_point;
}
// Draw the last point as a circle.
flags.setStyle(cc::PaintFlags::kFill_Style);
canvas.DrawCircle(current_point.location, kPointInitialRadius, flags);
}
// Copy result to GPU memory buffer. This is effectiely a memcpy and unlike
// drawing to the buffer directly this ensures that the buffer is never in a
// state that would result in flicker.
{
TRACE_EVENT0("ui", "LaserPointerView::OnPointsUpdated::Copy");
// Convert update rectangle to pixel coordinates.
gfx::Rect pixel_rect =
gfx::ScaleToEnclosingRect(update_rect, scale_factor_);
uint8_t* data = static_cast<uint8_t*>(gpu_memory_buffer_->memory(0));
int stride = gpu_memory_buffer_->stride(0);
canvas.GetBitmap().readPixels(
SkImageInfo::MakeN32Premul(pixel_rect.width(), pixel_rect.height()),
data + pixel_rect.y() * stride + pixel_rect.x() * 4, stride, 0, 0);
}
// Unmap to flush writes to buffer.
gpu_memory_buffer_->Unmap();
// Update surface damage rectangle.
surface_damage_rect_.Union(update_rect);
needs_update_surface_ = true;
// Early out if waiting for last surface update to be drawn.
if (pending_draw_surface_)
return;
UpdateSurface();
}
void LaserPointerView::UpdateSurface() {
TRACE_EVENT1("ui", "LaserPointerView::UpdatedSurface", "damage",
surface_damage_rect_.ToString());
DCHECK(needs_update_surface_);
needs_update_surface_ = false;
std::unique_ptr<LaserResource> resource;
// Reuse returned resource if available.
if (!returned_resources_.empty()) {
resource = std::move(returned_resources_.back());
returned_resources_.pop_back();
}
// Create new resource if needed.
if (!resource)
resource = base::MakeUnique<LaserResource>();
// Acquire context provider for resource if needed.
// Note: We make no attempts to recover if the context provider is later
// lost. It is expected that this class is short-lived and requiring a
// new instance to be created in lost context situations is acceptable and
// keeps the code simple.
if (!resource->context_provider) {
resource->context_provider = aura::Env::GetInstance()
->context_factory()
->SharedMainThreadContextProvider();
if (!resource->context_provider) {
LOG(ERROR) << "Failed to acquire a context provider";
return;
}
}
gpu::gles2::GLES2Interface* gles2 = resource->context_provider->ContextGL();
if (resource->texture) {
gles2->ActiveTexture(GL_TEXTURE0);
gles2->BindTexture(GL_TEXTURE_2D, resource->texture);
} else {
gles2->GenTextures(1, &resource->texture);
gles2->ActiveTexture(GL_TEXTURE0);
gles2->BindTexture(GL_TEXTURE_2D, resource->texture);
gles2->TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
gles2->TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
gles2->TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
gles2->TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
gles2->GenMailboxCHROMIUM(resource->mailbox.name);
gles2->ProduceTextureCHROMIUM(GL_TEXTURE_2D, resource->mailbox.name);
}
gfx::Size buffer_size = gpu_memory_buffer_->GetSize();
if (resource->image) {
gles2->ReleaseTexImage2DCHROMIUM(GL_TEXTURE_2D, resource->image);
} else {
resource->image = gles2->CreateImageCHROMIUM(
gpu_memory_buffer_->AsClientBuffer(), buffer_size.width(),
buffer_size.height(), SK_B32_SHIFT ? GL_RGBA : GL_BGRA_EXT);
if (!resource->image) {
LOG(ERROR) << "Failed to create image";
return;
}
}
gles2->BindTexImage2DCHROMIUM(GL_TEXTURE_2D, resource->image);
gpu::SyncToken sync_token;
uint64_t fence_sync = gles2->InsertFenceSyncCHROMIUM();
gles2->OrderingBarrierCHROMIUM();
gles2->GenUnverifiedSyncTokenCHROMIUM(fence_sync, sync_token.GetData());
cc::TransferableResource transferable_resource;
transferable_resource.id = next_resource_id_++;
transferable_resource.format = cc::RGBA_8888;
transferable_resource.filter = GL_LINEAR;
transferable_resource.size = buffer_size;
transferable_resource.mailbox_holder =
gpu::MailboxHolder(resource->mailbox, sync_token, GL_TEXTURE_2D);
transferable_resource.is_overlay_candidate = true;
gfx::Rect quad_rect(widget_->GetNativeView()->GetBoundsInScreen().size());
const int kRenderPassId = 1;
std::unique_ptr<cc::RenderPass> render_pass = cc::RenderPass::Create();
render_pass->SetNew(kRenderPassId, quad_rect, surface_damage_rect_,
gfx::Transform());
surface_damage_rect_ = gfx::Rect();
cc::SharedQuadState* quad_state =
render_pass->CreateAndAppendSharedQuadState();
quad_state->quad_layer_rect = quad_rect;
quad_state->visible_quad_layer_rect = quad_rect;
quad_state->opacity = 1.0f;
cc::CompositorFrame frame;
// TODO(eseckler): LaserPointerView should use BeginFrames and set the ack
// accordingly.
frame.metadata.begin_frame_ack =
cc::BeginFrameAck::CreateManualAckWithDamage();
frame.metadata.device_scale_factor =
widget_->GetLayer()->device_scale_factor();
cc::TextureDrawQuad* texture_quad =
render_pass->CreateAndAppendDrawQuad<cc::TextureDrawQuad>();
float vertex_opacity[4] = {1.0, 1.0, 1.0, 1.0};
gfx::PointF uv_top_left(0.f, 0.f);
gfx::PointF uv_bottom_right(1.f, 1.f);
texture_quad->SetNew(quad_state, quad_rect, gfx::Rect(), quad_rect,
transferable_resource.id, true, uv_top_left,
uv_bottom_right, SK_ColorTRANSPARENT, vertex_opacity,
false, false, false);
texture_quad->set_resource_size_in_pixels(transferable_resource.size);
frame.resource_list.push_back(transferable_resource);
frame.render_pass_list.push_back(std::move(render_pass));
frame_sink_holder_->frame_sink()->SubmitCompositorFrame(std::move(frame));
resources_[transferable_resource.id] = std::move(resource);
DCHECK(!pending_draw_surface_);
pending_draw_surface_ = true;
}
void LaserPointerView::OnDidDrawSurface() {
pending_draw_surface_ = false;
if (needs_update_surface_)
UpdateSurface();
}
} // namespace ash
|
b2b89856a952f707062f53f092b89cbf8a0c9936 | 4539096063554682a5c5ce71f5e508d2cfe55ecc | /loop_openmp_mt.cpp | 5cfe2b03646c4d0204127b50337ff172fc9dd92e | [
"MIT"
] | permissive | wedusk101/CPP | 6002035c2c95749d290e32e9415cdcdf42746ff0 | 0ab6ea1304bf82990d83d8c2d1bf19b277c21c57 | refs/heads/master | 2023-05-30T07:28:20.952376 | 2023-05-26T17:16:07 | 2023-05-26T17:16:07 | 77,129,709 | 2 | 2 | null | null | null | null | UTF-8 | C++ | false | false | 589 | cpp | loop_openmp_mt.cpp | #include <iostream>
#include <ctime>
#include <cstdlib>
#include <omp.h>
int main()
{
srand(time(NULL));
unsigned long long x= 0, sum = 0;
std::clock_t start, stop;
std::cout<<"Please enter the number of terms to add."<<std::endl;
std::cin>>x;
//omp_set_num_threads(2);
start = std::clock();
//#pragma omp parallel for
for(int i = 0; i <= x; i++)
{
unsigned long long r = rand() % 100;
sum += r * r;
}
stop = std::clock();
std::cout<<"The sum is "<<sum<<"."<<std::endl;
std::cout<<"Time taken is "<<((float)stop - (float)start)/CLOCKS_PER_SEC<<" seconds."<<std::endl;
} |
ae66e0e4e5f1aab3215d02e7fecefbcfe72e30cb | aab8c32b55d7c75cd7806ce8a4c4170891926bff | /cnodetablemodel.h | 7691f47f38ccbeae0c2cca014f77262fab07e87a | [] | no_license | INSYEN/DTNOTronAdminGUI | 129333862d09f304882b8788ecb9ef242e40e008 | 1b6223c02c4a30a8ada9a84d26ad6073b8929d63 | refs/heads/master | 2021-01-01T05:17:02.974924 | 2016-05-09T11:44:41 | 2016-05-09T11:44:41 | 58,369,453 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 968 | h | cnodetablemodel.h | #ifndef CNODETABLEMODEL_H
#define CNODETABLEMODEL_H
#include "cjsonarraytablemodel.h"
class CNodeTableModel : public CJsonArrayTableModel
{
Q_OBJECT
public:
//Typedefs and enums
typedef enum
{
COL_NODENUM,
COL_AMPEID,
COL_HOSTNAME,
COL_COMMANDGENERATOR,
COL_PROTOCOLS,
COL_REPORTSTORUN,
COL_VALIDREPORTS
} NodeColumns;
CNodeTableModel(CHTTPCommunicator* httpComm, QObject *parent = 0);
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
bool insertRows(int row, int count, const QModelIndex &parent);
Qt::ItemFlags flags(const QModelIndex &index) const;
public slots:
void refresh();
//void save();
//Overridden slots
void TableChanged(QString& tableType,QJsonArray& json);
protected:
//Cached elements, updated on refresh
QVariantList m_commandProducers;
QVariantMap m_protocolDefaults;
};
#endif // CNODETABLEMODEL_H
|
afd92b9c905be244483f27efd951d2a16e14151f | f0074aa6e7ed67b1f7b655966292ae2bc44ecec1 | /Raytracer/Raytracer/Light.cpp | 55297197cdac59cbe126c5dfb004e8d7bc9b1289 | [] | no_license | mvignale1987/computer-graphics | 68d4d3d3a4b4ee879f6a6a93891baf54712e9db6 | 397f2753c4431bff9a7ce76015ede7bcbdf2e9a1 | refs/heads/master | 2021-01-01T04:01:19.644099 | 2015-01-07T02:35:44 | 2015-01-07T02:35:44 | 58,962,261 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 738 | cpp | Light.cpp | #include "Light.h"
Light::Light():
m_linearAttenuation(0),
m_quadAttenuation(0)
{
}
Light::Light(
const Vector3& position,
const Vector3& ambientColor,
const Vector3& diffuseColor,
float linearAttenuation,
float quadAttenuation
):
m_position(position),
m_ambientColor(ambientColor),
m_diffuseColor(diffuseColor),
m_linearAttenuation(linearAttenuation),
m_quadAttenuation(quadAttenuation)
{
}
Vector3 Light::position() const
{
return m_position;
}
Vector3 Light::ambientColor() const
{
return m_ambientColor;
}
Vector3 Light::diffuseColor() const
{
return m_diffuseColor;
}
float Light::linearAttenuation() const
{
return m_linearAttenuation;
}
float Light::quadAttenuation() const
{
return m_quadAttenuation;
}
|
01288f599465b9f7503287d8e53449331d090fe8 | 5f0c0b915d537de3a60af8cb61a8610efad0667a | /PlaneSimulation/src/runway.cpp | 4742d803ed7463ab7d6e671dcf46339ca7b5ef60 | [] | no_license | jackdvpt/Airplane | a4f4fde7da9f6bae9b5ce4dffdd8ee282c1af2d6 | 1adc7ee7df699c909877356302288baff4537156 | refs/heads/master | 2021-09-02T14:16:27.318285 | 2018-01-03T05:08:55 | 2018-01-03T05:08:55 | 116,093,204 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 604 | cpp | runway.cpp | /*
* runway.cpp
* Draws a runway (as a square) and then stretches it out
* Created on: 30/05/2017
* Author: Jack Davenport
*/
#include "runway.h"
void run(void) {
glBegin(GL_POLYGON);
glVertex3f(1, 0.1, 1);
glVertex3f(-1, 0.1, 1);
glVertex3f(-1, 0.1, -1);
glVertex3f(1, 0.1, -1);
glEnd();
glTranslatef(0, 0, -0.75);
glutSolidCube(0.25);
glTranslatef(0, 0, 0.5);
glutSolidCube(0.25);
glTranslatef(0, 0, 0.5);
glutSolidCube(0.25);
glTranslatef(0, 0, 0.5);
glutSolidCube(0.25);
}
void runway::DrawModel() {
glScalef(8, 1, -15);
run();
}
|
4f0c340e7de6e6fb59d5db98f6692e2496aa6533 | ddd6148607906a91b584f57134c439747858925a | /IR_tx.cpp | 1d728b3b77661005e06480963d7fc15747e11154 | [] | no_license | bobparadiso/voiceRemote | 4861b9c6d3ba462b3ad9b2438fa95cf231972b3f | 82684097a3451daf30dca700ef6d09978e8a75c3 | refs/heads/master | 2021-01-01T03:58:25.720513 | 2016-05-04T02:22:06 | 2016-05-04T02:22:06 | 58,015,986 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,189 | cpp | IR_tx.cpp | #include <Arduino.h>
//digital pins 10 & 11
#define IR_LED_PORT PORTB
#define IR_LED_DDR DDRB
#define IR_LED_Mask (_BV(2) | _BV(3))
//
void setupIR_TX()
{
IR_LED_DDR |= IR_LED_Mask;
}
// This procedure sends a given kHz pulse to the IRledPin
// for a certain # of microseconds. We'll use this whenever we need to send codes
void pulseIR(uint16_t kHz, long microsecs)
{
int waveLength = 1000 / kHz;
int halfWaveLength = waveLength / 2;
//Serial.println(waveLength);
cli(); // this turns off any background interrupts
while (microsecs > 0)
{
IR_LED_PORT |= IR_LED_Mask;
delayMicroseconds(halfWaveLength);
IR_LED_PORT &= ~IR_LED_Mask;
delayMicroseconds(halfWaveLength);
microsecs -= waveLength;
}
sei(); // this turns them back on
}
//
void sendCode(const uint16_t *code)
{
//Serial.println("\nSendCode");
const uint16_t *pulse = code;
uint16_t kHz = pgm_read_word(pulse++);
while (true)
{
int on = pgm_read_word(pulse++);
int off = pgm_read_word(pulse++);
// Serial.print("on:");
// Serial.println(on);
pulseIR(kHz, on);
delayMicroseconds(off);
// Serial.print("off:");
// Serial.println(off);
if (off == 0)
return;
}
}
|
4730c4b0055379644ebf099b82fe1600bbb9a3ad | 061a75b319351f530b428413c33e1efc6b2937a1 | /keyssortfilterproxymodel.cpp | 6aa7dd7fb24d9a00744b9af3f4a8504c7c2141a9 | [] | no_license | ravirdv/s60-password-manager | 169531c1457fe266dc66cb4112e656a7081419c5 | e8329741c2ef7ca23699fe2c8284f8c654e1757f | refs/heads/master | 2021-01-21T18:06:33.542841 | 2012-02-04T17:30:27 | 2012-02-04T17:30:27 | 92,015,784 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 542 | cpp | keyssortfilterproxymodel.cpp | #include "keyssortfilterproxymodel.h"
#include "QDebug"
KeysSortFilterProxyModel::KeysSortFilterProxyModel(QObject *parent) :
QSortFilterProxyModel(parent)
{
}
void KeysSortFilterProxyModel::sortBy(QString roleName)
{
beginResetModel(); // Do I really need that?
if (roleName == "name") {
setSortRole(1);
endResetModel();
}
}
void KeysSortFilterProxyModel::search(QString search)
{
setFilterCaseSensitivity(Qt::CaseInsensitive);
setFilterRole(1);
setFilterWildcard(search);
}
|
7d8d22d98926594e86ac2e587f2fc36d9babd8cc | cb56f8fe6b0fb074c4b52b834bb67866e1f9d280 | /sources/Application/Player/PlayerChannel.cpp | d673e1092e3f932acfa74918a6d25031f226db4a | [
"BSD-3-Clause"
] | permissive | djdiskmachine/LittleGPTracker | 64f45a650e8211aa78fd77bc891d4316ce9a41e9 | ec13c06cd07ac9dd93f7390d6464fc02010b100b | refs/heads/master | 2023-07-25T22:31:15.699304 | 2023-02-16T21:23:18 | 2023-02-16T21:23:18 | 520,839,751 | 17 | 5 | BSD-3-Clause | 2023-09-12T13:59:00 | 2022-08-03T10:43:10 | C++ | UTF-8 | C++ | false | false | 1,549 | cpp | PlayerChannel.cpp |
#include "PlayerChannel.h"
#include "Application/Player/SyncMaster.h"
#include "Application/Mixer/MixerService.h"
#include "Application/Model/Mixer.h"
PlayerChannel::PlayerChannel(int index) {
index_=index ;
instr_=0 ;
muted_=false ;
mixBus_=0 ;
busIndex_=-1 ;
}
PlayerChannel::~PlayerChannel() {
}
void PlayerChannel::StartInstrument(I_Instrument *instr,unsigned char note,bool trigger) {
if (instr_) {
StopInstrument() ;
}
if (instr->Start(index_,note,trigger)) { // note could be refused coz it's out of the keymap
instr_=instr ;
} else {
instr_=0 ;
};
} ;
void PlayerChannel::StopInstrument() {
if (instr_) {
instr_->Stop(index_) ;
}
instr_=0 ;
} ;
bool PlayerChannel::Render(fixed *buffer,int samplecount) {
if (instr_) {
bool tableSlice=SyncMaster::GetInstance()->TableSlice() ;
bool status=instr_->Render(index_,buffer,samplecount,tableSlice) ;
return ((status)&&(!muted_)) ;
} else {
return false ;
}
} ;
I_Instrument *PlayerChannel::GetInstrument() {
return instr_ ;
} ;
void PlayerChannel::SetMute(bool muted) {
muted_=muted ;
}
bool PlayerChannel::IsMuted() {
return muted_ ;
}
void PlayerChannel::SetMixBus(int i) {
if (i==busIndex_) return ;
if (mixBus_) {
mixBus_->Remove(*this) ;
}
mixBus_=MixerService::GetInstance()->GetMixBus(i) ;
if (mixBus_) {
mixBus_->Insert(*this) ;
}
} ;
void PlayerChannel::Reset() {
if (mixBus_) {
mixBus_->Remove(*this) ;
}
muted_=false ;
busIndex_=-1 ;
} ; |
3c5f8178ff95cb6459193d11c085ea1a5d586742 | a395d2a29a1d47afe9addf1a0d3f8cf3e19879f9 | /src/HaltonSequence.cpp | 7d95e8947ec1706dc428efe06f8a978f7bfa1d0c | [
"LicenseRef-scancode-warranty-disclaimer"
] | no_license | eliask/libseq | c467d55053bf49731cb9a45da550bea20a66b584 | 6ae01e34f91c5008bae46f3f19068d5f36869ca1 | refs/heads/master | 2021-01-13T01:55:26.973994 | 2013-01-30T12:16:22 | 2013-01-30T12:16:22 | 7,913,606 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 5,263 | cpp | HaltonSequence.cpp | //////////////////////////////////////////////////////////////////////////////
//
// HaltonSequence.cpp, 8.8.99, Ilja Friedel
//
//////////////////////////////////////////////////////////////////////////////
//
// Status: not tested in context of class Sequence
//
//////////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 1992 - 1996, Alex Keller (keller@informatik.uni-kl.de) //
// //
// All rights reserved //
// //
// This software may be freely copied, modified, and redistributed //
// provided that this copyright notice is preserved on all copies. //
// //
// You may not distribute this software, in whole or in part, as part of //
// any commercial product without the express consent of the authors. //
// //
// There is no warranty or other guarantee of fitness of this software //
// for any purpose. It is provided solely "as is". //
// //
//////////////////////////////////////////////////////////////////////////////
#include "HaltonSequence.h"
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
HaltonSequence::HaltonSequence(UL_int Dimension, Rng * rng_ptr, UL_int offset, int *Primes)
: Sequence(Dimension,rng_ptr)
{
n = offset;
n0 = offset;
Radical = new double[dimension];
assert(Radical);
ownBase = (! Primes);
if(ownBase)
Base = FirstPrimes((L_int)dimension);
else
Base = Primes;
for(int j = 0; j < dimension; j++)
{
Radical[j] = 1.0 / (double) Base[j];
X[j] = 0.0;
}
SetInstance(n0);
}
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
HaltonSequence::~HaltonSequence()
{
if(ownBase) delete [] Base;
Base=NULL;
delete [] Radical;
Radical=NULL;
}
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
void HaltonSequence::operator++()
{
const double one = 1.0 - 1e-10;
double h, hh, remainder;
n++;
if(n & 8191)
{
for(int j = 0; j < dimension; j++)
{
remainder = one - X[j];
if(remainder < 0.0)
X[j] = 0.0;
else if(Radical[j] < remainder)
X[j] += Radical[j];
else
{
h = Radical[j];
do
{
hh = h;
h *= Radical[j];
}
while(h >= remainder);
X[j] += hh + h - 1.0;
}
}
/* updated 30.april 1996
if((h = X[j] + Radical[j]) <= one)
X[j] = h;
else
{
if(X[j] >= one)
X[j] = 0;
else
{
h = Radical[j];
do
{
h *= Radical[j];
}
while(X[j] + h >= one);
X[j] += h / Radical[j] + h - 1.0;
}
}*/
}
else
/// change 5.10.94
if(n >= 1073741824) // == 2^30
SetInstance(0);
else
/// change 5.10.94
SetInstance(n);
}
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
void HaltonSequence::SetInstance(const unsigned long Instance)
{
unsigned long im;
int b;
double fac;
n = Instance;
for(int j = 0; j < dimension; j++)
{
X[j] = 0.0;
fac = Radical[j];
b = Base[j];
for(im = n; im > 0; im /= b, fac *= Radical[j])
X[j] += fac * (double) (im % b);
}
}
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
int * HaltonSequence::FirstPrimes(const long N) const
{
int *Prime, i, j, p, b;
if(N == 0)
return NULL;
Prime = new int[N];
assert(Prime);
Prime[0] = 2;
for(p = 3, i = 1; i < N; p += 2)
{
Prime[i] = p;
for(j = 1; (b = Prime[j] <= p / Prime[j]) && (p % Prime[j]) ; j++);
if(b == 0)
i++;
}
return Prime;
}
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
|
7b82743d95cc17adf37fd6ff65b7383b6fa8a603 | 85883da801481f8a1e3467b4f36cbe483f69430d | /muduo/chp01/mutable.cc | f3b1ed5ca65903644f50819f211d7c9a9f9e2ff1 | [] | no_license | g1050/Daily_2020 | a55fd2181a60c870ae16f8adf02bcbc22dd94869 | 96e3a15625cd9313b3062b2a08f243e1aab71810 | refs/heads/master | 2020-12-23T00:11:57.154246 | 2020-05-31T01:10:02 | 2020-05-31T01:10:02 | 236,970,139 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 411 | cc | mutable.cc | #include <iostream>
class Test{
public:
Test():times(0){}
~Test(){}
void Output() const{
std::cout << "Hello World\n" << std::endl;
times++;
}
int getTimes() const{
return times;
}
private:
mutable int times;//mutable变量在const中是可以修改的
};
int main()
{
Test test;
test.Output();
std::cout << test.getTimes() << std::endl;
return 0;
}
|
b6fdfea2889992fb3de9788411729f417ff35cc8 | e620cff91edffba0ebae17d9235f03db27363ffe | /controllers/test.cpp | f8faa2e57286c35be98b218800b4e53e7622fa9b | [] | no_license | marty1885/drogon-pytorch-poc | 5aa23bac7f7ec945b1ed6132ed080f1439b1d122 | a58943dcc44041d024596b18c538b036cfd52797 | refs/heads/master | 2023-07-14T05:54:30.163512 | 2021-08-29T08:42:30 | 2021-08-29T08:42:30 | 400,919,660 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 964 | cpp | test.cpp | #include <drogon/HttpController.h>
#include <torch/torch.h>
#include <ATen/ATen.h>
using namespace drogon;
class testctl : public drogon::HttpController<testctl>
{
public:
METHOD_LIST_BEGIN
//use METHOD_ADD to add your custom processing function here;
ADD_METHOD_TO(testctl::invoke,"/models/{1:model_name}/invoke", Get);
METHOD_LIST_END
void invoke(const HttpRequestPtr &, std::function<void (const HttpResponsePtr &)> &&callback, std::string model_name) const
{
LOG_DEBUG <<"invoke model: " << model_name;
//Authentication algorithm, read database, verify identity, etc...
//...
at::Tensor a = at::ones({2, 2}, at::kInt);
at::Tensor b = at::randn({2, 2});
auto c = a + b.to(at::kInt);
Json::Value ret;
ret["hello"] = "world";
ret["uuid"] = drogon::utils::getUuid();
auto resp=HttpResponse::newHttpJsonResponse(ret);
callback(resp);
}
};
|
f88c719c4e175fc7c864f0c6f32d8db00a3e4d38 | 338e958ce2b6f0cad9fa53e2ece8a77187dbbafe | /src/TessaSRMM.cpp | c08e3534e8fdf66db8598e1e89ef0467aeb4d759 | [] | no_license | sander/tessa | 5f705971e18ff6a35b7f8dab785da4d13152a45a | 3cc66fae33d0e448cf1ac104ca4f4973162d868d | refs/heads/master | 2021-01-23T15:58:36.633874 | 2007-11-26T22:32:41 | 2007-11-26T22:32:41 | 33,049,382 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,313 | cpp | TessaSRMM.cpp | #include "TessaSRMM.h"
BEGIN_EVENT_TABLE(TessaConversation, wxWindow)
EVT_SIZE ( TessaConversation::OnSize)
END_EVENT_TABLE()
TessaConversation::TessaConversation(wxWindow *parent, wxWindowID id)
{
// Create frame window
wxWindow::Create((wxWindow*)parent,id, wxDefaultPosition, parent->GetClientSize(),wxDEFAULT_FRAME_STYLE,_T("Conversation"));
// Create splitter
m_Splitter.Create(this, -1, wxPoint(0,0), GetClientSize(), wxSP_3D, _T("ConversationSplit"));
m_Splitter.Show();
// Create sub-windows
m_MessageLog.Create(&m_Splitter, -1, _T("Messages"), wxPoint(0,0), wxSize(GetClientSize().x, 100), wxTE_MULTILINE);
m_InputArea.Create(&m_Splitter, -1, _T("Hello!"), wxPoint(0,0), wxSize(GetClientSize().x, 100), wxTE_MULTILINE);
m_Splitter.SplitHorizontally(&m_MessageLog, &m_InputArea, -100);
m_Splitter.Show();
}
void TessaConversation::OnSize(wxSizeEvent& evt)
{
m_Splitter.SetSize(evt.GetSize());
}
int TessaSRMMSystem::NewConversation(wxString Contact, wxString PreferredContainer)
{
TessaContainer* cont = new TessaContainer(Contact);
TessaConversation* conv = new TessaConversation(cont, -1);
cont->Show();
conv->Show();
Conversations[Contact] = conv;
Containers[PreferredContainer] = cont;
return 0;
}
|
e873308fb8899e140c16ade5fa740b41c7b142c3 | 6c44f94a9f1ede431534007007477112c83bb31b | /Source/ertgertgergre.cpp | c70811163d010445624d800514cad2e7829b7fe2 | [] | no_license | ItsVisual/GTA-V-SHADOW-MOD-MENU-SOURCE | e24b5a6fbc6151fcec7d6ae706fa6e5bffd25fb7 | ecc220bc53a2d77d06c7667d6a401e0062135752 | refs/heads/master | 2022-11-20T00:25:30.379274 | 2020-07-19T15:29:37 | 2020-07-19T15:29:37 | 280,697,670 | 1 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 10,888 | cpp | ertgertgergre.cpp | //Menu::Option("Airport Top", -1030.025146, -3015.658691, 49.091133);
//Menu::Option("Airport Bottom", -1500.652588f, -2858.271729f, 13.954378f);
//Menu::Option("Airport Office", -1559.734741, -3237.086182, 29.634100);
//Menu::Option("Franklin's Crib", 8.069606, 537.153015, 176.028015);
//Menu::Option("Micheal's Crib", -813.176453, 179.232452, 72.159149);
//Menu::Option("Trevor's Crib", 1980.774902, 3828.217041, 31.819498);
//Menu::Option("Morningwood Ammunation", -1330.267822, -390.644684, 36.602779);
//Menu::Option("Burton LS Customs", -384.217834, -118.733658, 38.689579);
//Menu::Option("10 Car Garage", 228.7188, -989.9847, -99.0);
//Menu::Option("Paleto Bank", -107.862190, 6466.428223, 31.626722);
//Menu::Option("Mount Chilliad", 501.980743, 5604.786133, 797.909363);
//Menu::Option("Trevor Airfield", 1704.752686, 3275.902832, 41.157715);
//Menu::MenuOption("Secret Army Tower", -2358.946045, 3252.216797, 101.450424);
//Menu::Option("Secret Island", -2167.429932, 5190.774414, 16.238092);
//Menu::Option("Desert Night Club", 1956.499878, 3083.499756, 46.781418);
//Menu::Option("FIB Building", 135.534073, -749.334595, 258.151764);
//Menu::Option("IAA Building", 121.494728, -622.014954, 206.046783);
//Menu::Option("Lab Upper Level", 3618.517822, 3740.693604, 28.690096);
//Menu::Option("Lab Lower Level", 3526.256836, 3706.816895, 20.991793);
//Menu::Option("Eclipse Tower Apartment", -810.110901, 300.467865, 86.118515);
//Menu::Option("Tinsel Tower Apartment", -641.864624, 24.014740, 39.351025);
//Menu::Option("Bank Vault", 263.021759, 220.656754, 106.282593);
//Menu::Option("Lazer Spawn 1", -2150.634277, 3234.995117, 32.810455);
//Menu::Option("Lazer Spawn 2", -2246.638672, 3230.022949, 32.810146);
//Menu::Option("Lazer Spawn 3", -2138.139893, 3056.729736, 32.809875);
//Menu::Option("Lazer Spawn 4", -2022.258423, 2973.546875, 33.118137);
//Menu::Option("Lazer Spawn 5", -2007.929932, 3098.386475, 32.810257);
//Menu::Option("Bridge Top", -546.417297, -2229.224365, 122.364899);
//addTeleportOption("Trevor's Torture Room", 136.323441, -2203.203857, 7.309136);
//addTeleportOption("Maze Tower", -73.92588, -818.455078, 326.174377);
//addTeleportOption("Construction Tower", -143.881927, -984.810852, 269.134308);
//addTeleportOption("LSPD Station", 446.413544, -985.128113, 30.689520);
//addTeleportOption("Clock Tower", -1238.675537, -847.954590, 85.161690);
//addTeleportOption("Sniper Tower", -550.989380, -193.862366, 76.499336);
//addTeleportOption("Merryweather", 568.406006, -3125.799805, 18.768612);
//addTeleportOption("Meth Lab", 1397.5240, 3607.4230, 38.9419);
//addTeleportOption("Emergency HeliPad", 308.9238, -1458.9330, 46.5095);
//addTeleportOption("HeliPad", -736.7500, -1437.7500, 5.0003);
//addTeleportOption("Under the bridge Glitch", 721.6599, -1000.6510, 23.5455);
//addTeleportOption("Alta St Apartment Enter", -266.0524, -968.6304, 31.2243);
//addTeleportOption("Police HeliPad", 369.4300, -1601.8320, 36.9502);
//addTeleportOption("Police Parking Roof", 334.2101, -1644.7660, 98.4960);
//addTeleportOption("Lester's House", 1248.1830, -1728.1040, 56.0000);
//addTeleportOption("Waynes Cousins House", -1159.0340, -1521.1800, 10.6327);
//addTeleportOption("Airport Terminal", -1561.5250, -3232.3460, 26.3361);
//addTeleportOption("Crane(1)", -167.9822, -1001.9265, 296.2061);
//addTeleportOption("Crane(2) Balcony", -120.3508, -977.8608, 304.2478);
//addTeleportOption("Crane 3 (Scenic)", -119.859985, -976.43866, 306.3385);
//addTeleportOption("Ontop of Vinewood Logo", 776.8780, 1175.6080, 345.9564);
//addTeleportOption("City Wall(Glitch)", -254.9432, -147.3534, 42.7314);
//addTeleportOption("Far Away Beach", 178.3295, 7041.8220, 1.8671);
//addTeleportOption("Coral Reef", 106.6972, 7282.0550, 1.8821);
//addTeleportOption("Underwater Ocean", 103.4720, 7744.1870, -158.1106);
//addTeleportOption("Dirtbike Trail", -1202.0910, 2802.4400, 14.8256);
//addTeleportOption("Private Hangout(Creek)", -463.6622, 4483.6540, 36.0373);
//addTeleportOption("Private hangout 2(Waterfall)", -597.9525, 4475.2910, 25.6890);
//addTeleportOption("Ontop of Waterfall", -540.4822, 4402.3590, 34.3786);
//addTeleportOption("Canyon Bridge/Tunnel/TrainTracks", -530.6747, 4534.9960, 89.0457);
//addTeleportOption("Calafia Bridge(Near Canyon bridge)", -175.2189, 4244.1940, 44.0730);
//addTeleportOption("Inside Casino", 937.4756, 42.4248, 80.8990);
//addTeleportOption("Lookout", -179.9843, 6150.4780, 42.6373);
//addTeleportOption("Behind Bar In Strip Club", 126.1211, -1278.5130, 29.2696);
//addTeleportOption("EMPTY CLOSED IN ROOM", 134.1213, -1289.5810, 29.2696);
//addTeleportOption("Inside Gun range", 22.8730, -1073.8800, 29.7970);
//addTeleportOption("Ammunation Office", 12.4553, -1110.2580, 29.7970);
//addTeleportOption("Just Above the Clouds", -149.3451, 7130.2460, 700.1167);
//addTeleportOption("HIGH IN THE SKY!!!!", -129.9640, 8130.8730, 6705.6510);
//addTeleportOption("Underground Tunnel", 16.9691, -646.1804, 16.0881);
//addTeleportOption("Tunnel Loop", -4.5786, -742.4279, 16.5030);
//addTeleportOption("Tunnel exit", 1033.7290, -270.5642, 50.8552);
//addTeleportOption("I Don't Know Where", -1907.3500, -577.2352, 20.1223);
//addTeleportOption("On top of Light house", 3433.6570, 5175.4090, 35.8053);
//addTeleportOption("Water Fountain", -104.8196, -856.3741, 41.0868);
//addTeleportOption("Water Fountain With Cube", -131.0631, -865.8098, 29.4677);
//addTeleportOption("Inside Jonny Tung", -879.0649, -247.7447, 40.1937);
//addTeleportOption("Vesupucci House Glitch", -976.0147, 2.1502, 2.1502);
//addTeleportOption("GO Postal", 78.9777, 113.4168, 81.1687);
//addTeleportOption("GO Postal 2", 67.4079, 123.5255, 86.1291);
//addTeleportOption("Under Roof", -1883.7390, 2062.8590, 144.8217);
//addTeleportOption("RockfordHill", -869.2877, -250.0446, 39.7795);
//addTeleportOption("PaletoBay Shed", -179.0000, 6150.0000, 42.0000);
//addTeleportOption("Luxury Auto", -783.1708, -246.4606, 37.0212);
//addTeleportOption("DelPerroPier", -1600.0930, -1041.8920, 13.0209);
//addTeleportOption("Middle of Ferris Wheel", -1664.1670, -1126.5330, 32.1513);
//addTeleportOption("Cherry Popper Stand", -1645.5460, -1102.3670, 13.4518);
//addTeleportOption("Cherry Popper 2", 1685.9830, -1104.1350, 13.1523);
//addTeleportOption("Building Wireframe", -129.3836, -951.1331, 218.8816);
//addTeleportOption("Mechanic Glitch", 546.0365, -183.3675, 54.4982);
//addTeleportOption("Land Act Dam", 1655.8130, 0.8890, 173.7747);
//addTeleportOption("Garage(Second Room)", 222.5924, -968.1003, -98.9999);
//addTeleportOption("Humane Lab(Waterbody)", 3524.0700, 3711.9500, 20.9913);
//addTeleportOption("Track", 1226.7500, 125.5000, 81.8394);
//addTeleportOption("Paleto Cove", -1441.6340, 5410.9190, 24.5786);
//addTeleportOption("Vinewood Garage(Storymode)", -66.8998, 81.6470, 71.5300);
//addTeleportOption("Mount Josiah", -1186.1070, 3849.7530, 489.0641);
//addTeleportOption("Theatre Balcony", 335.4643, 170.8678, 111.4973);
//addTeleportOption("Elysian Island Base", 574.3914, -3121.3220, 18.7687);
//addTeleportOption("Prison", 1679.0490, 2513.7110, 45.5649);
//addTeleportOption("Prison Gym", 1640.7910, 2530.0440, 45.5649);
//addTeleportOption("Trapped In Box", -655.6762, -160.8557, 42.1480);
//addTeleportOption("Horses Head", -690.9756, -243.3482, 45.8285);
addTeleportOption("Tongva Valley", -1523.1900, 1494.3620, 111.5874);
addTeleportOption("Pretty Hill", -2130.4500, -101.4395, 46.5871);
addTeleportOption("Mount Gordo", 2948.4480, 5323.8120, 101.1872);
addTeleportOption("Prison Tower", 1541.6290, 2470.1400, 62.8751);
addTeleportOption("Another pool", -1197.1560, -246.1534, 37.9545);
addTeleportOption("Ghost Mountain", 3056.7250, 5622.6430, 205.2412);
addTeleportOption("Cave", -1909.6820, 1389.1480, 218.4604);
addTeleportOption("MogShot Stand", -1641.5500, -1097.6340, 13.4500);
addTeleportOption("MogShot 2", -1682.1570, -1107.2580, 13.1523);
addTeleportOption("Gifts At The Pier", -1639.9170, -1092.0860, 13.5766);
addTeleportOption("Gifts At The Pier 2", -1678.2000, -1110.5410, 13.1523);
addTeleportOption("The Oriental TS(L)", 282.2156, 199.8016, 104.3740);
addTeleportOption("The Oriental TS(R)", 314.1337, 188.3539, 103.9276);
addTeleportOption("Cannibal Camp", -1170.1150, 4926.1340, 224.3552);
addTeleportOption("Cannibal Camp Roof", -1143.1450, 4951.1880, 230.1531);
addTeleportOption("Cannibal Mountain top", -935.9363, 4836.7470, 310.5199);
addTeleportOption("Building Glitch", -91.6870, 33.0948, 71.4655);
addTeleportOption("Dock(Near Lighthouse)", 3369.2240, 5184.1500, 1.4602);
addTeleportOption("Winding stairs", 3336.1740, 5172.9410, 18.3161);
addTeleportOption("Creek(Mountain Tower)", 2784.6060, 6000.8770, 357.2007);
addTeleportOption("Pool", -17.1920, 340.4356, 111.3410);
addTeleportOption("Inside Store", -1244.1380, -1454.9980, 4.3478);
addTeleportOption("Hidden beach", 3852.0770, 3625.5670, 9.2139);
addTeleportOption("Submarine Location", -1606.2000, 5266.9700, -1.4726);
addTeleportOption("Punpkin Patch", 3285.2290, 5183.5380, 18.4154);
addTeleportOption("Trapped In Steel", 149.4357, -769.7214, 262.8629);
addTeleportOption("Maze Bank", -73.925, -818.455, 326.174);
addTeleportOption("Ponsonby", -719.570313, -158.645645, 37.001133);
addTeleportOption("Hairdressers", -830.110291, -192.846985, 37.391479);
addTeleportOption("Tattoo Parlor", 318.459259, 171.248474, 103.764900);
addTeleportOption("City Center", 254.376099, -874.268738, 30.292122);
addTeleportOption("Masks", -1339.129395, -1278.866089, 4.970420);
addTeleportOption("Rob's Liquor", -1499.416992, -388.572693, 40.088326);
addTeleportOption("Drift Hill", 809.532898, 1274.701782, 360.507294);
addTeleportOption("Acadius", -144.037292, -594.253357, 211.775497);
addTeleportOption("Eclipse Towers", -773.351990, 309.809235, 85.699196);
addTeleportOption("Eclipse Garage", -797.140381, 302.651764, 85.702003);
addTeleportOption("Tinsel Towers", -641.864624, 24.014740, 39.351025);
addTeleportOption("Tinsel Garage", -639.464539, 58.500191, 44.365139);
addTeleportOption("Richmond Heights", -940.926270, -380.033081, 38.961258);
addTeleportOption("Richmond Garage", -869.513245, -373.289185, 39.260021);
addTeleportOption("Weazel Plaza", -925.957397, -461.375000, 37.211693);
addTeleportOption("Weazel Garage", -822.350098, -440.906952, 36.639874);
addTeleportOption("Alta St", -256.458557, -982.208313, 31.219646);
addTeleportOption("Alta St Garage", -253.267319, -1004.790161, 28.904947);
addTeleportOption("Del Perro", -1434.260864, -552.883179, 34.742386);
addTeleportOption("Del Perro Garage", -1459.286011, -493.489288, 33.035912);
addTeleportOption("Integrity Way", -53.871826, -585.092163, 36.687317);
addTeleportOption("Integrity Way Garage", -17.791501, -628.589233, 35.723454); |
9ba0aca9fcd1a5576b2a0f0eb7da9d5250aeefad | e15251ea93ce87e59d446e4e4a84b9fcb85ad64f | /my_work/rush00/Entity.class.hpp | 6db5897dae589e10cb86cbae9b0333d50cd285db | [] | no_license | motaylormo/CPP-Piscine | 91d920e170554ebf9d692f253c7812d0abb73ca9 | 2e3d072966183788fd500ca44ad63c66d1cb2cfd | refs/heads/master | 2020-08-21T00:16:58.188147 | 2019-11-21T18:40:16 | 2019-11-21T18:40:16 | 216,080,850 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 612 | hpp | Entity.class.hpp | #ifndef ENTITY_H
# define ENTITY_H
# include <curses.h>
class Entity {
public:
Entity(void);
~Entity(void);
Entity(const Entity &ref);
Entity& operator=(Entity const &rhs);
Entity(int x, int y, int size, char c);
bool left(int min);
bool right(int max);
bool up(int min);
bool down(int max);
void print(void) const;
int getX(void) const;
int getY(void) const;
int getSize(void) const;
char getSymbol(void) const;
protected:
int _x;
int _y;
int _size;
char _symbol;
void print(char c) const;
bool increment(int *ptr, int max);
bool decrement(int *ptr, int min);
};
#endif
|
1118c022d7632e115cd804dab50009f696437611 | 59d8f0558f841c9c046d63ed24a124931bfa831a | /searchbar.cpp | d54bb627be46b08e7f51410aa6c751d0f45c1d56 | [] | no_license | jbw3/SearchTest | 0d003e5d4597c1eb3fad5eb5be542fd719272f80 | 7a012f405406bcc4972cae7d5fb0a27fd157d5fe | refs/heads/master | 2020-04-17T19:55:40.936879 | 2015-03-21T18:52:35 | 2015-03-21T18:52:35 | 32,645,237 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 352 | cpp | searchbar.cpp | #include <QKeyEvent>
#include "searchbar.h"
SearchBar::SearchBar(QWidget* parent/* = 0*/) :
QLineEdit(parent)
{
}
void SearchBar::keyPressEvent(QKeyEvent* event)
{
if (event->key() == Qt::Key_Enter || event->key() == Qt::Key_Return)
{
emit enterKeyPressed();
}
else
{
QLineEdit::keyPressEvent(event);
}
}
|
4a8d72050436e909fe45d8693279c229c79c40da | 4b19135464a032c1d5271cd1ae58afb21df38584 | /Samples/C++/Demos/Donuts4/StdAfx.h | 80270526c93fe02d8633c64532d29f22fa0e8e0f | [] | no_license | sjk7/DX90SDK | f47cebbba53133923880004bc6e3a33cff1fe895 | dd155425badb2cd3993c27f869efc007764e599b | refs/heads/master | 2021-08-26T07:47:03.826451 | 2021-08-12T05:03:03 | 2021-08-12T05:03:03 | 253,911,891 | 3 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 2,524 | h | StdAfx.h | //----------------------------------------------------------------------------
// File: stdafx.h
//
// Copyright (C) Microsoft Corporation. All Rights Reserved.
//-----------------------------------------------------------------------------
#pragma once
#ifndef STRICT
#define STRICT
#endif
#define DIRECTINPUT_VERSION 0x0900
#define D3D_OVERLOADS
#include <tchar.h>
#include <Windows.h>
#include <mmsystem.h>
#include <windowsx.h>
#include <basetsd.h>
#include <cguid.h>
#include <assert.h>
#include <math.h>
#include <stdarg.h>
#include <stdio.h>
#include <tchar.h>
#include <d3d9.h>
#include <d3dx9.h>
#include <dinput.h>
#include <dmerror.h>
#include <dmusicc.h>
#include <dmusici.h>
#include <dsound.h>
#include <dxerr9.h>
// Simple function for generating random numbers
inline FLOAT rnd( FLOAT low, FLOAT high )
{
return low + ( high - low ) * ( (FLOAT)rand() ) / RAND_MAX;
}
class CD3DCamera;
FLOAT rnd( FLOAT low=-1.0f, FLOAT high=1.0f );
#include "D3DFile.h"
#include "D3DFont.h"
#include "D3DUtil.h"
#include "DIUtil.h"
#include "DMUtil.h"
#include "DSUtil.h"
#include "DXUtil.h"
#include "resource.h"
#include "3DDrawManager.h"
#include "3dmodel.h"
#include "gamemenu.h"
#include "filewatch.h"
#include "profile.h"
#include "notifytool.h"
#include "TerrainMesh.h"
#include "TerrainEngine.h"
#include "displayobject.h"
#include "3ddisplayobject.h"
#include "enemyship.h"
#include "playership.h"
#include "bullet.h"
#include "FileWatch.h"
#include "D3DFont.h"
#include "D3DUtil.h"
#include "notifytool.h"
#include "ParticleSystem.h"
#include "inputmanager.h"
#include "donuts.h"
extern HINSTANCE g_hInst;
extern CProfile g_Profile;
extern CTerrainEngine* g_pTerrain;
extern CMyApplication* g_pApp;
extern CInputManager::UserInput* g_pUserInput;
extern IDirect3DDevice9* g_pd3dDevice;
extern C3DDrawManager* g_p3DDrawManager;
// For debugging
extern D3DXVECTOR3 g_vDebugMove;
extern D3DXVECTOR3 g_vDebugRotate;
extern BOOL g_bDebugFreezeZoneRender;
extern BOOL g_bDebugIsZoneRenderFroze;
extern BOOL g_bDebugFreezeZoneRender;
extern CEnemyShip* g_pDebugFirstEnemy;
D3DXMATRIX* Donuts_MatrixOrthroNormalize( D3DXMATRIX* pOut, D3DXMATRIX* pM );
|
c9787e306668bbc2e54fa849d79f1778507bc95b | ca1805c587ef2dbf86e44856f4956a89dfe8e89c | /src/graph/graphsearch.cc | abbbe91e7d7ca88245e6f5589d3af85d34cabc05 | [
"MIT"
] | permissive | y26jin/liby26jin | f29eed8c4959d3eff20b71caa4565fe1ea6c6d92 | cb331d07d04d8ccc15d356a3ba7e31fd2e1ceb9d | refs/heads/master | 2021-01-10T19:39:21.614638 | 2014-03-02T20:55:49 | 2014-03-02T20:55:49 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 344 | cc | graphsearch.cc | #include "liby26jin.h"
#include "graphsearch.h"
void BFS(Graph *graph){
if(graph == NULL){
DEBUG("Graph is NULL!");
return;
}
// Keep track of visited vertices
Vertex *finishList = (Vertex *)malloc(graph->vnum * sizeof(Vertex));
Vertex *targetList = (Vertex *)malloc();
}
void DFS(Graph *graph, Vertex **finishList){
}
|
7194676f52df4106cbb278d69d82470e769f4d16 | 5c18374f3f2fd48fa0f029183910eec54373b63c | /Bits/ToggleBitAtPosition.cpp | 99f66ac547fa822b9a38d2eb139fb13917c248c3 | [] | no_license | nguyenchiemminhvu/Algorithms | f65984e903a8ebd64fad5ad2069d2a6a019440df | 88359a31097ebea7e76588b0c2a42880c64d1aba | refs/heads/master | 2021-08-17T00:20:26.661854 | 2021-07-03T00:46:51 | 2021-07-03T00:46:51 | 274,611,559 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 634 | cpp | ToggleBitAtPosition.cpp | /*
Toggling means to turn bit ‘on'(1) if it was ‘off'(0) and to turn ‘off'(0) if it was ‘on'(1) previously.We will be using ‘XOR’ operator here which is this ‘^’. The reason behind ‘XOR’ operator is because of its properties.
Properties of ‘XOR’ operator.
1^1 = 0
0^0 = 0
1^0 = 1
0^1 = 1
If two bits are different then ‘XOR’ operator returns a set bit(1) else it returns an unset bit(0).
*/
#include <iostream>
using namespace std;
void ToggleBit(int &num, int pos)
{
num ^= (1 << pos);
}
int main()
{
int n = 0b11011;
ToggleBit(n, 2);
std::cout << n << std::endl;
return 0;
} |
bac7a0292ba47a3568cac85e1360d0740ed589ba | 40e5d332268d05c3f2ed0b4a1bdbd70ef650977f | /lib/Transforms/Optimizations/DivideGlobalAPIntoAPs.cpp | 8d0b541ee8ec405a6361878b818a9996b37bdfe7 | [] | no_license | sinferwu/onnc | 7c4766d0aedadb268a010eebbae1644381b3649b | 6628eb7eafa2fd9820a7e1191feff441ac03811e | refs/heads/master | 2023-08-25T07:26:28.360621 | 2021-06-17T17:57:18 | 2021-06-17T17:57:18 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 10,313 | cpp | DivideGlobalAPIntoAPs.cpp | //===- DivideGlobalAPIntoAPs.cpp ------------------------------------------===//
//
// The ONNC Project
//
// See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#include <onnc/Core/PassSupport.h>
#include <onnc/IR/ComputeOperator.h>
#include <onnc/IR/Compute/Attributes.h>
#include <onnc/IR/Compute/AveragePool.h>
#include <onnc/IR/Compute/GlobalAveragePool.h>
#include <onnc/IR/Compute/Initializer.h>
#include <onnc/IR/Compute/Mul.h>
#include <onnc/IR/Compute/Tensor.h>
#include <onnc/Transforms/Optimizations/OptimizationsUtils.h>
#include <onnc/Transforms/Optimizations/DivideGlobalAPIntoAPs.h>
using namespace onnc;
//===----------------------------------------------------------------------===//
// DivideGlobalAPIntoAPs
//===----------------------------------------------------------------------===//
unsigned DivideGlobalAPIntoAPs::tensorIdx = 0;
DivideGlobalAPIntoAPs::ValueType
DivideGlobalAPIntoAPs::getBestSize(const ValueType& kernelSize,
const ValueType& maxKernelSize) {
assert(kernelSize < int64_t(1000000));
ValueType cnt = 1;
ValueType curValue = maxKernelSize;
while (curValue < kernelSize) {
curValue *= maxKernelSize;
++cnt;
}
return cnt;
}
DivideGlobalAPIntoAPs::VectorType
DivideGlobalAPIntoAPs::canBeComposedOf(const ValueType& kernelSize,
const ValueType& maxKernelSize) {
VectorType retVector;
assert(maxKernelSize >= 2 && "maxKernelSize must greater equal than 2");
if (kernelSize <= maxKernelSize) {
retVector.emplace_back(kernelSize);
return retVector;
}
ValueType curSize = kernelSize;
for(ValueType sz = maxKernelSize; sz >= 2; --sz) {
while((curSize % sz) == 0) {
retVector.emplace_back(sz);
curSize /= sz;
}
}
if (curSize != 1 || retVector.size() > getBestSize(kernelSize, maxKernelSize)) {
retVector.clear();
}
return retVector;
}
DivideGlobalAPIntoAPs::VectorType
DivideGlobalAPIntoAPs::divideKernelSizeOf(const ValueType& kernelSize,
const ValueType& maxKernelSize)
{
VectorType lstOfKernels;
ValueType start = kernelSize;
do {
lstOfKernels = canBeComposedOf(start, maxKernelSize);
++start;
}
while(lstOfKernels.empty());
return lstOfKernels;
}
template <int T>
std::pair<ComputeOperator*, ComputeOperator*>
DivideGlobalAPIntoAPs::genListOfAPsMul(ComputeGraph& pCG,
const Tensor* inputTensor,
const VectorType& lstOfKernels)
{
assert(false && "should not reach here, no matched tensor type");
return {nullptr, nullptr};
}
template <typename FirstTensorType, typename... RestTensorTypes, int T>
std::pair<ComputeOperator*, ComputeOperator*>
DivideGlobalAPIntoAPs::genListOfAPsMul(ComputeGraph& pCG,
const Tensor* inputTensor,
const VectorType& lstOfKernels)
{
static const std::string prefixName = "divide_globalap_into_aps_";
const auto* pT = dynamic_cast<const FirstTensorType*>(inputTensor);
if (pT == nullptr) {
return genListOfAPsMul<RestTensorTypes...>(pCG, inputTensor, lstOfKernels);
}
else {
// Assume inputTensor Dims : (N, C, H, W)
// lstOfKernels(according to max(H, W)): (k1, k2, ..., kt)
assert(inputTensor->getNumOfDimensions() == 4);
assert(lstOfKernels.size() >= 2);
auto createTensor = [&pCG] () {
FirstTensorType* outTensor =
pCG.addValue<FirstTensorType>(prefixName + std::to_string(tensorIdx));
++tensorIdx;
assert(outTensor != nullptr && "The name must be unique");
return outTensor;
};
std::pair<ComputeOperator*, ComputeOperator*> retPair;
VectorType::size_type n = lstOfKernels.size();
FirstTensorType* preTensor = nullptr;
FirstTensorType* outTensor = nullptr;
ValueType inputHW = inputTensor->getDimensions()[2] *
inputTensor->getDimensions()[3];
ValueType totalHW = 1;
// create AveragePools
for (VectorType::size_type idx = 0; idx < n; ++idx) {
const Tensor::Dimensions& lastDims = (preTensor == nullptr) ? inputTensor->getDimensions() :
preTensor->getDimensions();
const ValueType H = lastDims[2];
const ValueType W = lastDims[3];
const ValueType hSize = lstOfKernels[idx] < H ? lstOfKernels[idx] : H;
const ValueType wSize = lstOfKernels[idx] < W ? lstOfKernels[idx] : W;
totalHW *= hSize * wSize;
if (idx == n-1) {
assert(lastDims[2] <= hSize && lastDims[3] <= wSize &&
"The last kernel must cover the tensor");
}
IntsAttr pKernel(IntsAttr::VectorType(2, 0));
pKernel.at(0) = hSize;
pKernel.at(1) = wSize;
IntsAttr pPads(IntsAttr::VectorType(4, 0));
pPads.at(0) = (hSize - (H % hSize)) % hSize;
pPads.at(1) = (wSize - (W % wSize)) % wSize;
// strides is the same as kernelShape
AveragePool *pA = pCG.addOperator<AveragePool>(StringAttr("NOTSET"), 1,
pKernel, pPads, pKernel);
if (preTensor != nullptr) {
pA->addInput(*preTensor);
}
// If it's not last one or it has padding, then we need to add Tensor
if (idx != n-1 || inputHW != totalHW) {
// K -> (K + (sz - 1)) / sz
Tensor::Dimensions newDims = lastDims;
newDims[2] = (newDims[2] + hSize-1) / hSize;
newDims[3] = (newDims[3] + wSize-1) / wSize;
outTensor = createTensor();
outTensor->setDimensions(newDims);
pA->addOutput(*outTensor);
preTensor = outTensor;
}
if (idx == 0) retPair.first = static_cast<ComputeOperator*>(pA);
if (idx == n-1) retPair.second = static_cast<ComputeOperator*>(pA);
}
// check whether there's a need of Mul
if (inputHW != totalHW) {
Initializer* pIRatio = pCG.addOperator<Initializer>();
FirstTensorType* ratioTensor = createTensor();
using RatioType = typename FirstTensorType::ValueType;
RatioType HW = static_cast<RatioType>(inputHW);
RatioType curHW = static_cast<RatioType>(totalHW);
RatioType ratio = curHW / HW;
ratioTensor->setDimensions({1});
ratioTensor->getValues() = typename FirstTensorType::ValueList(1, ratio);
pIRatio->addOutput(*ratioTensor);
Mul *pM = pCG.addOperator<Mul>();
assert(preTensor != nullptr);
pM->addInput(*preTensor);
pM->addInput(*ratioTensor);
retPair.second = static_cast<ComputeOperator*>(pM);
}
return retPair;
}
return {nullptr, nullptr};
}
Pass::ReturnType DivideGlobalAPIntoAPs::runOnModule(Module& pModule)
{
Pass::ReturnType ret = BaseType::runOnModule(pModule);
if (ret != kModuleNoChanged) {
pModule.eraseUnusedValues();
}
return ret;
}
Pass::ReturnType DivideGlobalAPIntoAPs::runOnComputeGraph(ComputeGraph& pCG)
{
Pass::ReturnType ret = Pass::kModuleNoChanged;
// Start from rear and stand on GlobalAveragePool, run in reversed order
// Will not repeat on new AveragePool or Mul that had been created
ComputeOperator* node;
bool erased;
for (pCG.getRear(node); node != nullptr;
node = erased ? node : node->getPrevNode()) {
erased = false;
if (GlobalAveragePool* pG = dyn_cast<GlobalAveragePool>(node)) {
assert(pG->getNumOfInputs() == 1 &&
"GlobalAveragePool must have exactly one input");
assert(pG->getNumOfOutputs() == 1 &&
"GlobalAveragePool must have exactly one output");
Tensor* inputTensor = pG->getInput(0);
assert(inputTensor->getNumOfDimensions() == 4 &&
"Currently only support input tensor of four dimensions, This \
assertion should be removed after backend can support generalized \
version of AvergePool, i.e. support 3 or 5 dims ... etc.");
if (inputTensor->getDimensions()[2] <= m_MaxKernelSize &&
inputTensor->getDimensions()[3] <= m_MaxKernelSize) {
// Transform GlobalAveragePool into one AveragePool
ValueType ndims = static_cast<ValueType>(inputTensor->getNumOfDimensions());
assert(ndims > 2);
ndims -= 2;
using IntsSize = IntsAttr::VectorType::size_type;
IntsAttr pPads(IntsAttr::VectorType(static_cast<IntsSize>(2 * ndims), 0));
IntsAttr pKernel(IntsAttr::VectorType(static_cast<IntsSize>(ndims)));
for (ValueType idx = 0; idx < ndims; ++idx) {
pKernel.at(idx) = inputTensor->getDimensions()[idx+2];
}
AveragePool *pA = pCG.addOperator<AveragePool>(StringAttr("NOTSET"), 0,
pKernel, pPads, pKernel);
pA->addInput(*inputTensor);
Value* outV = node->getOutput(0);
outV->clearDefine();
pA->addOutput(*outV);
}
else {
// Transform GlobalAveragePool into several AveragePools + (Mul)
assert(inputTensor->getNumOfDimensions() == 4 &&
"Currently only support input tensor of four dimensions");
ValueType K = std::max(inputTensor->getDimensions()[2],
inputTensor->getDimensions()[3]);
VectorType lstOfKernels = divideKernelSizeOf(K, m_MaxKernelSize);
// the last element of lstOfKernels is the size of padding
assert(lstOfKernels.size() >= 2 &&
"There must be at least two AveragePools");
auto pairOfNodePtrs = genListOfAPsMul<PP_UNWRAP(FP_TENSORTYPE_LIST)>
(pCG, inputTensor, lstOfKernels);
pairOfNodePtrs.first->addInput(*inputTensor);
Value* outV = node->getOutput(0);
outV->clearDefine();
pairOfNodePtrs.second->addOutput(*outV);
}
ComputeOperator* rmNode = node;
node = node->getPrevNode();
// Do not removeAllOutputs() here, because the output has been clearDefine()
rmNode->removeAllInputs();
pCG.erase(*rmNode);
erased = true;
ret |= Pass::kModuleChanged;
}
}
if (ret != kModuleNoChanged) {
pCG.topologicalSort();
}
return ret;
}
|
84ac27283208d7f37027f45ef3e42480a2a301fa | f89d365228e236cb9875114524c9460360234676 | /Week-01/Day-02/16. AnimalsAndLegs/main.cpp | ecbf07b1db74b14364382e09ac751b3a718d8eed | [] | no_license | green-fox-academy/Dextyh | 8c08afc3318df61b99029c8a3c821c8eed21da0b | 2da333d385526aeda779605f129e35e70b266034 | refs/heads/master | 2020-04-02T17:22:06.014213 | 2019-01-30T11:36:03 | 2019-01-30T11:36:03 | 154,655,041 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 416 | cpp | main.cpp | #include <iostream>
int main() {
int chickens;
int pigs;
std::cout << "Greetings Farmer! Can I ask how many chickens you have? And also tell me how many pigs you own please!" << std::endl;
std::cin >> chickens >> pigs;
std::cout << "Nice! Do you know that how many legs all of them have? I will tell you now! They has got " << chickens*2+pigs*4 << " legs!" << std::endl;
return 0;
} |
c766e7a668df3ec8819c32bf2713424c177ba867 | d4638a5bc8c372a32afe115dcb26a7f05b420165 | /gyazowin/Size.cpp | df3e201360cef107a50b2e3a05f2b4f30294612b | [] | no_license | ffoxin/gyazo | aa0b14873ec3be426b80b94f6c635d0829280dcb | b9ebd0a9e211e842050c05ea6594a793220c5576 | refs/heads/master | 2021-01-23T03:12:23.760105 | 2014-11-11T11:53:27 | 2014-11-11T11:53:27 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,350 | cpp | Size.cpp | #include "size.h"
#include <utility>
namespace Gyazo
{
BaseSize::BaseSize()
: cx(size.cx)
, cy(size.cy)
{
// empty
}
BaseSize& BaseSize::operator=(BaseSize const& baseSize)
{
if (this != &baseSize)
{
size = baseSize.size;
}
return *this;
}
void BaseSize::Init(LONG const& cx_, LONG const& cy_)
{
cx = cx_;
cy = cy_;
}
//----------------------------------
Size::Size()
{
Init(0, 0);
}
Size::Size(LONG const& x_, LONG const& y_)
{
Init(x_, y_);
}
Size::Size(SIZE const& size_)
{
size = size_;
}
Size::Size(Size const& size_)
{
size = size_.size;
}
Size::~Size()
{
// empty
}
Size& Size::operator=(SIZE const& size_)
{
if (&size != &size_)
{
size = size_;
}
return *this;
}
Size& Size::operator=(Size const& size_)
{
return operator=(size_.size);
}
Size& Size::operator+=(Size const& size_)
{
cx += size_.cx;
cy += size_.cy;
return *this;
}
Size& Size::operator-=(Size const& size_)
{
cx -= size_.cx;
cy -= size_.cy;
return *this;
}
Size::operator LPSIZE()
{
return &size;
}
Size operator+(Size const& lhr, Size const& rhr)
{
Size temp(lhr);
temp += rhr;
return temp;
}
Size operator-(Size const& lhr, Size const& rhr)
{
Size temp(lhr);
temp -= rhr;
return temp;
}
} // namespace Gyazo
|
b08c79ed98d328ccf31f162963d87259ea3fc775 | 3488502026b9f40fdc91ede22b76ab98c58faee0 | /lib/Acoustic Alarm/Buzzer.cpp | a9d917ca2da30020b906d2cd3aa6fe6f8eccce9e | [] | permissive | HDventilator/hdvent-control | 2aa224a5d428ec3c35e69ba65e4c2abfe09825c7 | fd04688063a77674115c6904edd5a38ea36c10b8 | refs/heads/master | 2021-05-18T21:18:19.859172 | 2020-12-15T15:18:12 | 2020-12-15T15:18:12 | 251,425,210 | 0 | 0 | MIT | 2020-05-17T20:35:08 | 2020-03-30T20:50:08 | C++ | UTF-8 | C++ | false | false | 1,010 | cpp | Buzzer.cpp | //
// Created by david on 26.09.20.
//
#include "Buzzer.h"
Buzzer::Buzzer(uint8_t pin, uint16_t onInterval, uint16_t offInterval) : _pin(pin), _hiInterval(
onInterval), _loInterval(offInterval) {
_isHigh = false;
_on = false;
}
void Buzzer::service() {
if (_on){
if (_isHigh) {
if (_stopwatch.getElapsedTime() > _hiInterval) {
digitalWrite(_pin, LOW);
_stopwatch.start();
_isHigh = false;
}
}
else if ((_stopwatch.getElapsedTime() > _loInterval)){
//tone(_pin, _frequency);
digitalWrite(_pin, HIGH);
_stopwatch.start();
_isHigh = true;
}
}
}
bool Buzzer::isOn() const {
return _on;
}
void Buzzer::saveTurnOn() {
//tone(_pin, _frequency);
if(!_on){
digitalWrite(_pin, HIGH);
_stopwatch.start();
_isHigh = true;
_on = true;}
}
void Buzzer::turnOff() {
_on = false;
digitalWrite(_pin, LOW);
}
|
169832ff582f719149e2d78887aee97c2dc4b710 | 00add89b1c9712db1a29a73f34864854a7738686 | /packages/utility/interpolation/src/Utility_HistogramInterpolator.hpp | 48ed798c911769cff7bda7cab54f0f3da322fd8c | [
"BSD-3-Clause"
] | permissive | FRENSIE/FRENSIE | a4f533faa02e456ec641815886bc530a53f525f9 | 1735b1c8841f23d415a4998743515c56f980f654 | refs/heads/master | 2021-11-19T02:37:26.311426 | 2021-09-08T11:51:24 | 2021-09-08T11:51:24 | 7,826,404 | 11 | 6 | NOASSERTION | 2021-09-08T11:51:25 | 2013-01-25T19:03:09 | C++ | UTF-8 | C++ | false | false | 4,517 | hpp | Utility_HistogramInterpolator.hpp | //---------------------------------------------------------------------------//
//!
//! \file Utility_HistogramInterpolator.hpp
//! \author Alex Robinson
//! \brief The histogram interpolator declaration
//!
//---------------------------------------------------------------------------//
#ifndef UTILITY_HISTOGRAM_INTERPOLATOR_HPP
#define UTILITY_HISTOGRAM_INTERPOLATOR_HPP
// Std Lib Includes
#include <memory>
// FRENSIE Includes
#include "Utility_Interpolator.hpp"
namespace Utility{
//! The histogram interpolator class
template<typename IndependentUnit, typename DependentUnit, typename T=double>
class HistogramUnitAwareInterpolator : public UnitAwareInterpolator<IndependentUnit,DependentUnit,T>
{
protected:
//! The independent quantity type
typedef typename UnitAwareInterpolator<IndependentUnit,DependentUnit,T>::IndepQuantity IndepQuantity;
//! The dependent quantity type
typedef typename UnitAwareInterpolator<IndependentUnit,DependentUnit,T>::DepQuantity DepQuantity;
//! The independent quantity traits
typedef QuantityTraits<IndepQuantity> IQT;
//! The dependent quantity traits
typedef QuantityTraits<DepQuantity> DQT;
//! The raw quantity traits
typedef QuantityTraits<T> QT;
public:
//! Get an instance of the interpolator
static std::shared_ptr<const UnitAwareInterpolator<IndependentUnit,DependentUnit,T> > getInstance();
//! Destructor
~HistogramUnitAwareInterpolator()
{ /* ... */ }
//! Get the interpolation type
InterpolationType getInterpolationType() const;
//! Test if the independent value is in a valid range
bool isIndepVarInValidRange( const IndepQuantity& indep_var ) const;
//! Test if the dependent value is in a valid range
bool isDepVarInValidRange( const DepQuantity& dep_var ) const;
//! Process the independent value
T processIndepVar( const IndepQuantity& indep_var ) const;
//! Process the dependent value
T processDepVar( const DepQuantity& dep_var ) const;
//! Recover the processed independent value
IndepQuantity recoverProcessedIndepVar( const T processed_indep_var ) const;
//! Recover the processed dependent value
DepQuantity recoverProcessedDepVar( const T processed_dep_var ) const;
//! Interpolate between two points
DepQuantity interpolate( const IndepQuantity indep_var_0,
const IndepQuantity indep_var_1,
const IndepQuantity indep_var,
const DepQuantity dep_var_0,
const DepQuantity dep_var_1 ) const;
//! Interpolate between two processed points
DepQuantity interpolateProcessed( const T processed_indep_var_0,
const T processed_indep_var,
const T processed_dep_var_0,
const T processed_slope) const;
//! Interpolate between two points and return the processed value
T interpolateAndProcess( const IndepQuantity indep_var_0,
const IndepQuantity indep_var_1,
const IndepQuantity indep_var,
const DepQuantity dep_var_0,
const DepQuantity dep_var_1 ) const;
//! Interpolate between two processed points and return the processed value
T interpolateProcessedAndProcess( const T processed_indep_var_0,
const T processed_indep_var,
const T processed_dep_var_0,
const T processed_slope) const;
private:
// Constructor
HistogramUnitAwareInterpolator();
// The interpolator instance
static std::shared_ptr<const UnitAwareInterpolator<IndependentUnit,DependentUnit,T> > s_instance;
};
//! The histogram interpolator (unit-agnostic)
template<typename T> using HistogramInterpolator =
HistogramUnitAwareInterpolator<void,void,T>;
} // end Utility namespace
//---------------------------------------------------------------------------//
// Template Includes
//---------------------------------------------------------------------------//
#include "Utility_HistogramInterpolator_def.hpp"
//---------------------------------------------------------------------------//
#endif // end UTILITY_HISTOGRAM_INTERPOLATOR_HPP
//---------------------------------------------------------------------------//
// end Utility_HistogramInterpolator.hpp
//---------------------------------------------------------------------------//
|
5b48fc8821448880c5e2c2d3566ad3dea278d603 | c7326f7e59c2635b3e5caf2f06ba0c509ab00c05 | /tests/stack_test.cpp | d18bac8686d3b57493867df71d903ff88d5a0562 | [
"MIT"
] | permissive | senior-sigan/data-structures-training | d9e37412311863bbaf4d3a69160ca7208b3c90a0 | 4317ff8d029dbc368328fa3afb6bbb48e0ac1c30 | refs/heads/master | 2022-12-08T03:11:31.450063 | 2020-08-22T15:46:13 | 2020-08-22T15:46:13 | 260,488,535 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,300 | cpp | stack_test.cpp | #include <gtest/gtest.h>
#include <stack/stack.h>
#include <memory>
TEST(stack, just_create_stack) {
my::Stack<int> stack;
}
TEST(stack, push_object_to_stack_changes_size) {
my::Stack<int> stack;
ASSERT_EQ(stack.size(), 0);
stack.push(42);
ASSERT_EQ(stack.size(), 1);
stack.push(7);
ASSERT_EQ(stack.size(), 2);
}
TEST(stack, pushed_object_is_on_top) {
my::Stack<int> stack;
stack.push(42);
ASSERT_EQ(stack.top(), 42);
stack.push(7);
ASSERT_EQ(stack.top(), 7);
}
TEST(stack, pop_objects_freed_space) {
my::Stack<int> stack;
stack.push(42);
stack.push(7);
ASSERT_EQ(stack.size(), 2);
ASSERT_EQ(stack.top(), 7);
stack.pop();
ASSERT_EQ(stack.size(), 1);
ASSERT_EQ(stack.top(), 42);
stack.pop();
ASSERT_EQ(stack.size(), 0);
}
TEST(stack, push_object_without_default_constructor) {
class Box {
public:
int a_;
explicit Box(int a) : a_(a) {}
};
my::Stack<Box> stack;
stack.push(Box(42));
ASSERT_EQ(stack.top().a_, 42);
}
class Box {
public:
int a_;
int* counter_;
explicit Box(int* counter, int a) : a_(a), counter_(counter) {}
~Box() {
(*counter_)++;
}
};
TEST(stack, push_const_ref) {
int counter = 0;
{
my::Stack<Box> stack;
Box box(&counter, 42);
stack.push(box);
ASSERT_EQ(counter, 0);
ASSERT_EQ(stack.top().a_, 42);
ASSERT_EQ(counter, 0);
}
ASSERT_EQ(counter, 2);
}
TEST(stack, push_and_move) {
my::Stack<std::unique_ptr<int>> stack;
stack.push(std::make_unique<int>(42));
ASSERT_EQ(*stack.top().get(), 42);
}
TEST(stack, pop_should_delete_object) {
int counter = 0;
{
my::Stack<Box> stack;
stack.push(Box(&counter, 13));
stack.push(Box(&counter, 42));
ASSERT_EQ(counter, 2); // one deletion for temporal object
stack.pop();
ASSERT_EQ(counter, 3);
}
ASSERT_EQ(counter, 4);
}
TEST(stack, top_const_check) {
struct A {
my::Stack<int> stack;
A() {
stack.push(42);
}
int non_const_top() {
stack.top()++;
return stack.top();
}
int const_top() const {
return stack.top();
}
};
A a;
ASSERT_EQ(a.const_top(), 42);
ASSERT_EQ(a.non_const_top(), 43);
}
TEST(stack, reallocate_memory_for_copyable_objects) {
my::Stack<int> stack;
stack.push(1);
stack.push(2);
ASSERT_EQ(stack.size(), 2);
ASSERT_EQ(stack.capacity(), 2);
stack.push(3);
ASSERT_EQ(stack.size(), 3);
ASSERT_EQ(stack.capacity(), 4);
stack.push(4);
ASSERT_EQ(stack.size(), 4);
ASSERT_EQ(stack.capacity(), 4);
stack.push(4);
ASSERT_EQ(stack.size(), 5);
ASSERT_EQ(stack.capacity(), 8);
}
TEST(stack, reallocate_memory_for_movable_objects) {
my::Stack<std::unique_ptr<int>> stack;
stack.push(std::make_unique<int>(1));
stack.push(std::make_unique<int>(2));
ASSERT_EQ(stack.size(), 2);
ASSERT_EQ(stack.capacity(), 2);
ASSERT_EQ(*stack.top().get(), 2);
stack.push(std::make_unique<int>(3));
ASSERT_EQ(stack.size(), 3);
ASSERT_EQ(stack.capacity(), 4);
ASSERT_EQ(*stack.top().get(), 3);
stack.push(std::make_unique<int>(4));
ASSERT_EQ(stack.size(), 4);
ASSERT_EQ(stack.capacity(), 4);
ASSERT_EQ(*stack.top().get(), 4);
stack.push(std::make_unique<int>(5));
ASSERT_EQ(stack.size(), 5);
ASSERT_EQ(stack.capacity(), 8);
ASSERT_EQ(*stack.top().get(), 5);
}
TEST(stack, deallocate_momoey_for_movable_objects) {
my::Stack<std::unique_ptr<int>> stack;
stack.push(std::make_unique<int>(1));
stack.push(std::make_unique<int>(2));
stack.push(std::make_unique<int>(3));
stack.push(std::make_unique<int>(4));
stack.push(std::make_unique<int>(5));
ASSERT_EQ(stack.size(), 5);
ASSERT_EQ(stack.capacity(), 8);
stack.pop(); // 4
stack.pop(); // 3
stack.pop(); // 2
ASSERT_EQ(stack.size(), 2);
ASSERT_EQ(stack.capacity(), 4);
stack.pop(); // 1
stack.pop(); // 0
ASSERT_EQ(stack.size(), 0);
ASSERT_EQ(stack.capacity(), 0);
}
TEST(stack, deep_copy) {
my::Stack<int> stack1;
stack1.push(1);
stack1.push(2);
stack1.push(3);
my::Stack<int> stack2;
ASSERT_EQ(stack2.size(), 0);
ASSERT_EQ(stack2.capacity(), 0);
stack2 = stack1;
ASSERT_EQ(stack2.size(), 3);
ASSERT_EQ(stack2.capacity(), 4);
ASSERT_EQ(stack1.size(), 3);
ASSERT_EQ(stack1.capacity(), 4);
ASSERT_EQ(stack1.top(), 3);
ASSERT_EQ(stack2.top(), 3);
} |
431f978df32ae50eccaa60b05579a2827d29dbce | 0c69ac4bb6bb84db8d7b3f498fb1ffa67fe9aa76 | /cdb proj/кружок/подсчёт покрытых точек/main.cpp | 0b391117d316858d71aeb32d0af352ff9f26e199 | [] | no_license | petr-konovalov/c-projects | 42325cc0f2462bf7cb40028823c94176f300e68c | 9cec0f43790d3339148d8e5dbde03342f5900e52 | refs/heads/master | 2020-09-12T02:00:54.887681 | 2020-03-01T12:45:14 | 2020-03-01T12:45:14 | 222,263,394 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,484 | cpp | main.cpp | #include <bits/stdc++.h>
using namespace std;
#define forn(i, n) for(int i = 0; i < n; ++i)
#define debug(...) fprintf(stderr, __VA_ARGS__); fflush(stderr)
#define pb push_back
#define mp make_pair
#define F first
#define S second
const int K = 2e5 + 10;
typedef long long ll;
typedef double db;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
typedef pair<db, db> pdd;
int n;
ll cnt[K];
ll l[K];
ll r[K];
vector<pair<ll, int> > bounds;
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(NULL);
cout.tie(NULL);
cin >> n;
forn (i, n)
{
cin >> l[i] >> r[i];
bounds.pb(mp(l[i], 0));
bounds.pb(mp(r[i], 1));
}
sort(bounds.begin(), bounds.end());
ll prev = 0;
int k = 0;
int i = 0;
while (i < bounds.size())
{
ll bound = bounds[i].F;
if (bounds[i].S == 0)
{
cnt[k] += bound - prev;
prev = bound;
while (bounds[i].S == 0 && bounds[i].F == bound)
{
++k;
++i;
}
}
else
{
cnt[k] += bound - prev + 1;
prev = bound + 1;
while (i < bounds.size() && bounds[i].S == 1 && bounds[i].F == bound)
{
--k;
++i;
}
}
}
for (int i = 1; i <= n; ++i)
cout << cnt[i] << ' ';
return 0;
}
|
c970bcd7f3d247cd8719ed6470419111b6cfa00e | 0a6ad2f54688ec99e17ed4f74c47b7cac5955904 | /include/Components/GUIElement.hpp | 5fc8f0679ae84bfa1f0c0f91c66fcfbb6abe5f54 | [] | no_license | jamilettel/IndieStudio | b758ba2eb21ef006a88b3f6cf050cbdd75951fcc | 5dfef5e3797c8e1916ed0a19cc52b49b83f3ec46 | refs/heads/master | 2022-10-12T22:12:57.172659 | 2020-06-15T13:29:43 | 2020-06-15T13:29:43 | 261,168,491 | 3 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 915 | hpp | GUIElement.hpp | /*
** EPITECH PROJECT, 2020
** IndieStudio
** File description:
** GUIElement
*/
#ifndef GUIELEMENTCOMPONENT_HPP_
#define GUIELEMENTCOMPONENT_HPP_
#include "ECS/Component.hpp"
#include "Components/Window.hpp"
namespace is::components {
class GUIElementComponent: public is::ecs::Component {
public:
explicit GUIElementComponent(std::shared_ptr<is::ecs::Entity> &e);
~GUIElementComponent() override = default;
GUIElementComponent(const GUIElementComponent &) = delete;
GUIElementComponent &operator=(const GUIElementComponent &) = delete;
virtual void bringToFront() = 0;
virtual void init(std::shared_ptr<is::components::WindowComponent> &ptr_window) = 0;
public:
int layer = 0;
protected:
std::shared_ptr<WindowComponent> _window;
};
}
#endif /* !GUIELEMENTCOMPONENT_HPP_ */
|
d1709cb777ca1dc9f961600bdc3364179a516a7d | 211325f1b3c6cff31ac1538e43df8f65b7b41103 | /src/tcp_listener.hpp | b15a4f896c1e8a634ed5931ebf8f9fe541bcd808 | [
"BSD-3-Clause"
] | permissive | byao001/bsnet | 00cc51a24cc0fe9b45a62e96665784dc5882a33e | 70095881d7038e247032e4d8102355bdf3a25238 | refs/heads/master | 2021-08-31T16:33:31.220071 | 2017-12-22T03:12:40 | 2017-12-22T03:12:40 | 109,085,800 | 0 | 0 | null | 2017-11-01T04:20:23 | 2017-11-01T04:10:38 | C++ | UTF-8 | C++ | false | false | 843 | hpp | tcp_listener.hpp | //
// Created by byao on 10/31/17.
// Copyright (c) 2017 byao. All rights reserved.
//
#ifndef BSNET_TCPLISTENER_HPP
#define BSNET_TCPLISTENER_HPP
#include "event.hpp"
#include "eventedfd.hpp"
#include "utility.hpp"
#include <cstdint>
namespace bsnet {
class Addr;
class TcpStream;
class TcpListener : public EventedFd {
public:
static TcpListener bind(const Addr &addr, std::size_t listen_backlog);
TcpListener(TcpListener &&other) noexcept;
~TcpListener() noexcept override = default;
void swap(TcpListener &other) noexcept {
using std::swap;
swap(_fd, other._fd);
}
TcpStream accept(Addr *peer = nullptr);
void local_addr(Addr &addr);
private:
TcpListener(int sock) : EventedFd(sock) {}
};
inline void swap(TcpListener &lhs, TcpListener &rhs) noexcept { lhs.swap(rhs); }
}
#endif // BSNET_TCPLISTENER_HPP
|
a0dbfae4f11e3595a753ddb487c9faaf1b3718f1 | 55eb2ffe4aa9ee4b18b1ee4d2e9f02e817bd059e | /Week 2/3. Lists/include.cpp | 39b3558a783423c13248475cd3d4e4667e005ce8 | [] | no_license | wmoralesdev/AA0220 | e5803838805defbc09cdb0bb93c630400cee1a68 | 83d97cd624b03d518a3562fd20e4af42e5bc8d5f | refs/heads/empty | 2023-06-01T02:06:06.290716 | 2021-06-29T05:04:27 | 2021-06-29T05:04:27 | 287,404,924 | 13 | 15 | null | 2020-09-22T22:14:42 | 2020-08-14T00:14:03 | C++ | UTF-8 | C++ | false | false | 2,410 | cpp | include.cpp | // Linked list, not circular, not double linked
#include <iostream>
#include <list>
using namespace std;
int main(void) {
list<int> l;
// push_back - appends element at list end
l.push_back(1);
l.push_back(2);
l.push_back(3);
l.push_back(4);
// push_front - inserts element at list start
l.push_front(10);
l.push_front(20);
l.push_front(30);
l.push_front(40);
// empty - returns boolean indicating if list has elements
cout << "List is empty: " << (l.empty() ? "true" : "false") << endl << endl;
// size - returns elements count
cout << "Size: " << l.size() << endl << endl;
#pragma region iterators
// begin - returns read / write reference to element (similar to front)
auto itBegin = l.begin();
cout << "Begin element before modifying is: " << *itBegin << endl;
*itBegin = 1;
cout << "Begin element after modifying is: " << *itBegin << endl << endl;
// end - returns read / write reference pointing to one past last element
auto itEnd = l.end();
// Iterator prev to actual last element of list
itEnd = prev(itEnd, 1);
cout << "End element before modifying is: " << *itEnd << endl;
*itEnd = 999;
cout << "End element after modifying is: " << *itEnd << endl<< endl;
// cbegin - returns read only reference to element
auto cBegin = l.cbegin();
cout << "Begin element: " << *cBegin << endl;
// cend - returns read only refrerence pointing to one past last element
auto cEnd = l.cend();
cEnd = prev(cEnd, 1);
cout << "End element: " << *cEnd << endl;
#pragma endregion
// back - returns read / write referente pointing to last element (not as iterator)
auto bck = l.back();
// remove_if - deletes elements based on boolean predicative (boolean typed function)
cout << "Printing elements before deleting even numbers" << endl;
for(auto iter = l.begin(); iter != l.end(); iter++) {
cout << *iter << " ";
}
cout << endl << endl;
// predicative is a lambda
l.remove_if([](int e) -> bool {
return e % 2 == 0;
});
cout << "Printing elements after deleting even numbers" << endl;
for(auto iter = l.begin(); iter != l.end(); iter++) {
cout << *iter << " ";
}
cout << endl << endl;
return 0;
}
|
931a0c1a5df909083de630c311a6a7af8acffc0c | 33394856a8de0e824ec49a3643e387cdbacca0c6 | /SolvedProblems/HDU/2056.cpp | fec2285644eaf9ce9db1e711ded59c05140d1dfe | [] | no_license | MoogleAndChocobo/ACM-Learning | caf116d713c24d14af166dac701e7812e495405b | 9a86daf172c3a74aab69f2054f222f51c5939830 | refs/heads/master | 2021-08-10T15:40:43.108255 | 2018-09-14T07:06:04 | 2018-09-14T07:06:04 | 129,596,917 | 2 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 1,007 | cpp | 2056.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long LL;
#define rep(i, a, b) for(int i = a; i <= b; i++)
#define mem(a) memset(a, 0, sizeof(a))
#define dow(i, a, b) for(int i = a; i >= b; i--)
#define sfi(a) scanf("%d", &a)
const int MAX = 1e4 + 5;
const int N = 1e4;
struct Node
{
double x1, y1, x2, y2;
};
int main()
{
Node a, b;
while(~scanf("%lf%lf%lf%lf%lf%lf%lf%lf", &a.x1, &a.y1, &a.x2, &a.y2, &b.x1, &b.y1, &b.x2, &b.y2))
{
if((a.x1 >= b.x1 && a.x1 >= b.x2 && a.x2 >= b.x1 && a.x2 >= b.x2) || (b.x1 >= a.x1 && b.x1 >= a.x2 && b.x2 >= a.x1 && b.x2 >= a.x2) || (a.y1 >= b.y1 && a.y1 >= b.y2 && a.y2 >= b.y1 && a.y2 >= b.y2) || (b.y1 >= a.y1 && b.y1 >= a.y2 && b.y2 >= a.y1 && b.y2 >= a.y2))
{
puts("0.00");
continue;
}
double x[MAX], y[MAX];
x[1] = a.x1, x[2] = a.x2, x[3] = b.x1, x[4] = b.x2;
y[1] = a.y1, y[2] = a.y2, y[3] = b.y1, y[4] = b.y2;
sort(x + 1, x + 5);
sort(y + 1, y + 5);
printf("%.2lf\n", (x[3] - x[2]) * (y[3] - y[2]));
}
return 0;
} |
da1a9a42835c9c16883142d39df66fdd3badd7c2 | 82cbd7396dd988a861d8493715642b8b48c90352 | /code/chapter_8_the_io_library/exercise8.9.cpp | 7b9adad108158725e5002fa07245a5d32e57e99c | [] | no_license | max-young/cpp_study | 7f548aa252430f1f09dab61ed1ef0a3ba5a5276c | 5f3606d96c08d88576cd7293356b6860c4b78e73 | refs/heads/main | 2022-07-09T20:11:51.090084 | 2022-07-07T08:01:40 | 2022-07-07T08:01:40 | 339,992,576 | 3 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 523 | cpp | exercise8.9.cpp | // Exercise 8.9:
// Use the function you wrote for the exercise 8.1 to print the contents of an istringstream object.
#include <iostream>
#include <string>
#include <sstream>
using std::cin;
using std::cout;
using std::endl;
using std::istream;
using std::istringstream;
using std::string;
istream &printStream(istream &in)
{
string s;
while (in >> s)
{
cout << s << endl;
}
in.clear(); // reset the stream
return in;
}
int main()
{
istringstream iss("Hello world");
printStream(iss);
return 0;
} |
c89e6fd355873dc786a2ef3d491450e2daf1e01b | 6fcea3030826b88cb41040ceba177aee8e8ba443 | /C - Servers.cpp | a88b60b42b1d66fd3e228477b961fc2c3ca925a6 | [] | no_license | KhaledMosaad/Comptitve_Programming | f1121d027c0730364623b4ab1fcbaea94c4e3c3d | f79235389827be3a90ee6f6948561471dc576ab0 | refs/heads/main | 2023-05-27T20:09:00.431124 | 2021-06-11T01:07:10 | 2021-06-11T01:07:10 | 375,865,525 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,566 | cpp | C - Servers.cpp | #include <bits/stdc++.h>
using namespace std;
#define all(v) (v.begin(),v.end())
#define sz(v) ((int)((v).size()))
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define endl '\n'
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair< ll, ll> pll;
typedef vector<pll> vll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<ull> vul;
typedef vector<pii> vii;
typedef vector<vi> vvi;
int i8[8] = {0, -1, 0, 1, -1, -1, 1, 1};
int j8[8] = { -1, 0, 1, 0, -1, 1, 1, -1};
int i4[4] = {0, -1, 0, 1};
int j4[4] = { -1, 0, 1, 0};
void fast() {
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
#ifndef ONLINE_JUDGE
freopen("inputf.txt", "r", stdin);
freopen("outputf.txt", "w", stdout);
#endif
}
void solve()
{
int n, q;
cin >> n >> q;
vector < pair<pair<int , int >, int> > v(q);
vi ser(n + 1, 0);
vi res(q);
for (int i = 0; i < q; i++)
{
cin >> v[i].F.F >> v[i].F.S >> v[i].S;
}
for (int i = 0; i < q; i++)
{
int time = v[i].F.F + v[i].S, cnt = 0, r = 0;
for (int j = 1; j <= n; j++)
{
if (ser[j] <= v[i].F.F) {
cnt++;
}
}
if (cnt >= v[i].F.S)
{
int temp = 0;
for (int w = 1; w <= n; w++)
{
if (ser[w] <= v[i].F.F)
{
r += w;
ser[w] = time;
temp++;
}
if (temp == v[i].F.S)
{
break;
}
}
res[i] = r;
}
else
res[i] = -1;
}
for (int i = 0; i < q; i++)
cout << res[i] << endl;
}
int main() {
fast();
//int t;
//cin >> t;
//while (t--)
solve();
return 0;
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.