blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
3
264
content_id
stringlengths
40
40
detected_licenses
sequencelengths
0
85
license_type
stringclasses
2 values
repo_name
stringlengths
5
140
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringclasses
905 values
visit_date
timestamp[us]date
2015-08-09 11:21:18
2023-09-06 10:45:07
revision_date
timestamp[us]date
1997-09-14 05:04:47
2023-09-17 19:19:19
committer_date
timestamp[us]date
1997-09-14 05:04:47
2023-09-06 06:22:19
github_id
int64
3.89k
681M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
22 values
gha_event_created_at
timestamp[us]date
2012-06-07 00:51:45
2023-09-14 21:58:39
gha_created_at
timestamp[us]date
2008-03-27 23:40:48
2023-08-21 23:17:38
gha_language
stringclasses
141 values
src_encoding
stringclasses
34 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
3
10.4M
extension
stringclasses
115 values
content
stringlengths
3
10.4M
authors
sequencelengths
1
1
author_id
stringlengths
0
158
b45057810ccfd2efa712d2130cdc61aa2f390955
d17404e081bc8deeb51a60c1832f7765c22f324d
/TFGapp/TFGapp/BBDD.cpp
1f032ad99f181c292b7c6d229ca041d09888f9fd
[]
no_license
polditathereal/tfg
3b9e1ecd8da5268b60a8d6212f728b92a5bc7174
2519405d22f98b16289b7604223442f43d2ab05a
refs/heads/master
2020-05-07T10:15:07.799939
2019-04-08T14:11:33
2019-04-08T14:11:33
null
0
0
null
null
null
null
UTF-8
C++
false
false
3,801
cpp
#include "Header.h" static int BBDD callback(void *NotUsed, int argc, char **argv, char **azColName) { int i; for (i = 0; i < argc; i++) { printf("%s = %s\n", azColName[i], argv[i] ? argv[i] : "NULL"); } printf("\n"); return 0; } void BBDD crearTablaHorario(sqlite3 *bd) { char sql[] = "CREATE TABLE IF NOT EXISTS horarios(" \ "nombre TEXT PRIMARY KEY NOT NULL,"\ "dia INT,"\ "sloot1 INT,"\ "sloot2 INT,"\ "sloot3 INT,"\ "sloot4 INT,"\ "sloot5 INT,"\ "sloot6 INT,"\ "sloot7 INT);"; char * error = NULL; int resultado = sqlite3_exec(bd, sql, 0, 0, &error); if (resultado != SQLITE_OK) { fprintf(stderr, "SQL error: %s\n", error); sqlite3_free(error); } else { fprintf(stdout, "Table created successfully\n"); } } void BBDD crearTablaAlumno(sqlite3 *bd) { char sql[] = "CREATE TABLE IF NOT EXISTS alumnos(" \ "nombre TEXT,"\ "apellido1 TEXT,"\ "apellido2 TEXT,"\ "correo TEXT PRIMARY KEY NOT NULL,"\ "grado INT);"; char * error = NULL; int resultado = sqlite3_exec(bd, sql, 0, 0, &error); if (resultado != SQLITE_OK) { fprintf(stderr, "SQL error: %s\n", error); sqlite3_free(error); } else { fprintf(stdout, "Table created successfully\n"); } } void BBDD crearTablaProfesor(sqlite3 *bd) { char sql[] = "CREATE TABLE IF NOT EXISTS profesores(" \ "nombreCompleto TEXT,"\ "doctor INT);"; char * error = NULL; int resultado = sqlite3_exec(bd, sql, 0, 0, &error); if (resultado != SQLITE_OK) { fprintf(stderr, "SQL error: %s\n", error); sqlite3_free(error); } else { fprintf(stdout, "Table created successfully\n"); } } void BBDD insertarHorario(sqlite3 * bd, Horario horario) { string sql = "INSERT OR REPLACE INTO horarios(nombre,dia,sloot1,sloot2,sloot3,sloot4,sloot5,sloot6,sloot7) VALUES ('"; sql += horario.getProfesor().getNombre(); sql += "',"; sql += to_string(horario.getDia()); sql += ","; sql += to_string(horario.getSloot(2)); sql += ", "; sql += to_string(horario.getSloot(3)); sql += ", "; sql += to_string(horario.getSloot(4)); sql += ", "; sql += to_string(horario.getSloot(5)); sql += ", "; sql += to_string(horario.getSloot(6)); sql += ", "; sql += to_string(horario.getSloot(7)); sql += ", "; sql += to_string(horario.getSloot(8)); sql += ");"; char * error = NULL; int resultado = sqlite3_exec(bd, sql.c_str(), 0, 0, &error); if (resultado != SQLITE_OK) { fprintf(stderr, "SQL error: %s\n", error); sqlite3_free(error); } } void BBDD insertarAlumno(sqlite3 * bd, Alumno alumno) { string sql = "INSERT OR REPLACE INTO alumnos (nombre,apellido1,apellido2,correo,grado) VALUES ('"; sql += alumno.nombre; sql += "', '"; sql += alumno.apellido1; sql += "', '"; sql += alumno.apellido2; sql += "', '"; sql += alumno.correo; sql += "', "; sql += to_string(alumno.grado); sql += ");"; char * error = NULL; int resultado = sqlite3_exec(bd, sql.c_str(), 0, 0, &error); if (resultado != SQLITE_OK) { fprintf(stderr, "SQL error: %s\n", error); sqlite3_free(error); } } void BBDD insertarProfesor(sqlite3 * bd, Profesor profesor) { string sql = "INSERT OR REPLACE INTO profesores (nombreCompleto, doctor) VALUES ('"; sql += profesor.getNombre(); sql += "', "; sql += to_string(profesor.getDoctor()); sql += ");"; char * error = NULL; int resultado = sqlite3_exec(bd, sql.c_str(), 0, 0, &error); if (resultado != SQLITE_OK) { fprintf(stderr, "SQL error: %s\n", error); sqlite3_free(error); } } void BBDD insertarHorarios(list<Horario> lista, sqlite3 * db) { for (auto dummy : lista) insertarHorario(db, dummy); } void BBDD insertarAlumnos(list<Alumno> lista, sqlite3 * db) { for (auto dummy : lista) insertarAlumno(db, dummy); } void BBDD insertarProfesores(list<Profesor> lista, sqlite3 * db) { for (auto dummy : lista) insertarProfesor(db, dummy); }
d4bd959af21c0eac9e347ff77fe242b5ea2d6f00
eb40a068cef3cabd7a0df37a0ec2bde3c1e4e5ae
/dnn/src/x86/convolution/fma/convolution_conv_fh2_fma.cpp
ffcced381f830563abffaa9b2aa5cd165453a8e7
[ "Apache-2.0", "LicenseRef-scancode-generic-cla" ]
permissive
tpoisonooo/MegEngine
ccb5c089a951e848344f136eaf10a5c66ae8eb6f
b8f7ad47419ef287a1ca17323fd6362c6c69445c
refs/heads/master
2022-11-07T04:50:40.987573
2021-05-27T08:55:50
2021-05-27T08:55:50
249,964,363
1
0
NOASSERTION
2021-05-27T08:55:50
2020-03-25T11:48:35
null
UTF-8
C++
false
false
53,031
cpp
/** * \file dnn/src/x86/convolution/fma/convolution_conv_fh2_fma.cpp * MegEngine is Licensed under the Apache License, Version 2.0 (the "License") * * Copyright (c) 2014-2021 Megvii Inc. All rights reserved. * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT ARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */ #define SIMD_H1 \ do { \ const size_t sh = dh; \ const float* src_d = src + sh * src_w; \ float* dst_d = dst + dh * dst_w; \ size_t dw = dst_w_beg; \ for (; dw < dst_w_end; dw += 8) { \ const size_t sw = dw; \ float* dst_dd = dst_d + dw; \ __m256 tmp0; \ __m256 res0; \ res0 = _mm256_loadu_ps(dst_dd + 0 * dst_w); \ for (size_t fw = 0; fw < flt_w; ++fw) { \ const float* src_dd = src_d + sw + fw; \ __m256 vf0 = _mm256_broadcast_ss( \ &filter[0 * flt_w + flt_w - fw - 1]); \ __m256 vf1 = _mm256_broadcast_ss( \ &filter[1 * flt_w + flt_w - fw - 1]); \ tmp0 = _mm256_loadu_ps(src_dd + 0 * src_w); \ res0 = _mm256_fmadd_ps(tmp0, vf1, res0); \ tmp0 = _mm256_loadu_ps(src_dd + 1 * src_w); \ res0 = _mm256_fmadd_ps(tmp0, vf0, res0); \ } \ _mm256_storeu_ps(dst_dd + 0 * dst_w, res0); \ } \ } while (0) #define SIMD_H2 \ do { \ const size_t sh = dh; \ const float* src_d = src + sh * src_w; \ float* dst_d = dst + dh * dst_w; \ size_t dw = dst_w_beg; \ for (; dw < dst_w_end; dw += 8) { \ const size_t sw = dw; \ float* dst_dd = dst_d + dw; \ __m256 tmp0; \ __m256 res0; \ res0 = _mm256_loadu_ps(dst_dd + 0 * dst_w); \ __m256 res1; \ res1 = _mm256_loadu_ps(dst_dd + 1 * dst_w); \ for (size_t fw = 0; fw < flt_w; ++fw) { \ const float* src_dd = src_d + sw + fw; \ __m256 vf0 = _mm256_broadcast_ss( \ &filter[0 * flt_w + flt_w - fw - 1]); \ __m256 vf1 = _mm256_broadcast_ss( \ &filter[1 * flt_w + flt_w - fw - 1]); \ tmp0 = _mm256_loadu_ps(src_dd + 0 * src_w); \ res0 = _mm256_fmadd_ps(tmp0, vf1, res0); \ tmp0 = _mm256_loadu_ps(src_dd + 1 * src_w); \ res0 = _mm256_fmadd_ps(tmp0, vf0, res0); \ res1 = _mm256_fmadd_ps(tmp0, vf1, res1); \ tmp0 = _mm256_loadu_ps(src_dd + 2 * src_w); \ res1 = _mm256_fmadd_ps(tmp0, vf0, res1); \ } \ _mm256_storeu_ps(dst_dd + 0 * dst_w, res0); \ _mm256_storeu_ps(dst_dd + 1 * dst_w, res1); \ } \ } while (0) #define SIMD_H3 \ do { \ const size_t sh = dh; \ const float* src_d = src + sh * src_w; \ float* dst_d = dst + dh * dst_w; \ size_t dw = dst_w_beg; \ for (; dw < dst_w_end; dw += 8) { \ const size_t sw = dw; \ float* dst_dd = dst_d + dw; \ __m256 tmp0; \ __m256 res0; \ res0 = _mm256_loadu_ps(dst_dd + 0 * dst_w); \ __m256 res1; \ res1 = _mm256_loadu_ps(dst_dd + 1 * dst_w); \ __m256 res2; \ res2 = _mm256_loadu_ps(dst_dd + 2 * dst_w); \ for (size_t fw = 0; fw < flt_w; ++fw) { \ const float* src_dd = src_d + sw + fw; \ __m256 vf0 = _mm256_broadcast_ss( \ &filter[0 * flt_w + flt_w - fw - 1]); \ __m256 vf1 = _mm256_broadcast_ss( \ &filter[1 * flt_w + flt_w - fw - 1]); \ tmp0 = _mm256_loadu_ps(src_dd + 0 * src_w); \ res0 = _mm256_fmadd_ps(tmp0, vf1, res0); \ tmp0 = _mm256_loadu_ps(src_dd + 1 * src_w); \ res0 = _mm256_fmadd_ps(tmp0, vf0, res0); \ res1 = _mm256_fmadd_ps(tmp0, vf1, res1); \ tmp0 = _mm256_loadu_ps(src_dd + 2 * src_w); \ res1 = _mm256_fmadd_ps(tmp0, vf0, res1); \ res2 = _mm256_fmadd_ps(tmp0, vf1, res2); \ tmp0 = _mm256_loadu_ps(src_dd + 3 * src_w); \ res2 = _mm256_fmadd_ps(tmp0, vf0, res2); \ } \ _mm256_storeu_ps(dst_dd + 0 * dst_w, res0); \ _mm256_storeu_ps(dst_dd + 1 * dst_w, res1); \ _mm256_storeu_ps(dst_dd + 2 * dst_w, res2); \ } \ } while (0) #define SIMD_H4 \ do { \ const size_t sh = dh; \ const float* src_d = src + sh * src_w; \ float* dst_d = dst + dh * dst_w; \ size_t dw = dst_w_beg; \ for (; dw < dst_w_end; dw += 8) { \ const size_t sw = dw; \ float* dst_dd = dst_d + dw; \ __m256 tmp0; \ __m256 res0; \ res0 = _mm256_loadu_ps(dst_dd + 0 * dst_w); \ __m256 res1; \ res1 = _mm256_loadu_ps(dst_dd + 1 * dst_w); \ __m256 res2; \ res2 = _mm256_loadu_ps(dst_dd + 2 * dst_w); \ __m256 res3; \ res3 = _mm256_loadu_ps(dst_dd + 3 * dst_w); \ for (size_t fw = 0; fw < flt_w; ++fw) { \ const float* src_dd = src_d + sw + fw; \ __m256 vf0 = _mm256_broadcast_ss( \ &filter[0 * flt_w + flt_w - fw - 1]); \ __m256 vf1 = _mm256_broadcast_ss( \ &filter[1 * flt_w + flt_w - fw - 1]); \ tmp0 = _mm256_loadu_ps(src_dd + 0 * src_w); \ res0 = _mm256_fmadd_ps(tmp0, vf1, res0); \ tmp0 = _mm256_loadu_ps(src_dd + 1 * src_w); \ res0 = _mm256_fmadd_ps(tmp0, vf0, res0); \ res1 = _mm256_fmadd_ps(tmp0, vf1, res1); \ tmp0 = _mm256_loadu_ps(src_dd + 2 * src_w); \ res1 = _mm256_fmadd_ps(tmp0, vf0, res1); \ res2 = _mm256_fmadd_ps(tmp0, vf1, res2); \ tmp0 = _mm256_loadu_ps(src_dd + 3 * src_w); \ res2 = _mm256_fmadd_ps(tmp0, vf0, res2); \ res3 = _mm256_fmadd_ps(tmp0, vf1, res3); \ tmp0 = _mm256_loadu_ps(src_dd + 4 * src_w); \ res3 = _mm256_fmadd_ps(tmp0, vf0, res3); \ } \ _mm256_storeu_ps(dst_dd + 0 * dst_w, res0); \ _mm256_storeu_ps(dst_dd + 1 * dst_w, res1); \ _mm256_storeu_ps(dst_dd + 2 * dst_w, res2); \ _mm256_storeu_ps(dst_dd + 3 * dst_w, res3); \ } \ } while (0) #define SIMD_H5 \ do { \ const size_t sh = dh; \ const float* src_d = src + sh * src_w; \ float* dst_d = dst + dh * dst_w; \ size_t dw = dst_w_beg; \ for (; dw < dst_w_end; dw += 8) { \ const size_t sw = dw; \ float* dst_dd = dst_d + dw; \ __m256 tmp0; \ __m256 res0; \ res0 = _mm256_loadu_ps(dst_dd + 0 * dst_w); \ __m256 res1; \ res1 = _mm256_loadu_ps(dst_dd + 1 * dst_w); \ __m256 res2; \ res2 = _mm256_loadu_ps(dst_dd + 2 * dst_w); \ __m256 res3; \ res3 = _mm256_loadu_ps(dst_dd + 3 * dst_w); \ __m256 res4; \ res4 = _mm256_loadu_ps(dst_dd + 4 * dst_w); \ for (size_t fw = 0; fw < flt_w; ++fw) { \ const float* src_dd = src_d + sw + fw; \ __m256 vf0 = _mm256_broadcast_ss( \ &filter[0 * flt_w + flt_w - fw - 1]); \ __m256 vf1 = _mm256_broadcast_ss( \ &filter[1 * flt_w + flt_w - fw - 1]); \ tmp0 = _mm256_loadu_ps(src_dd + 0 * src_w); \ res0 = _mm256_fmadd_ps(tmp0, vf1, res0); \ tmp0 = _mm256_loadu_ps(src_dd + 1 * src_w); \ res0 = _mm256_fmadd_ps(tmp0, vf0, res0); \ res1 = _mm256_fmadd_ps(tmp0, vf1, res1); \ tmp0 = _mm256_loadu_ps(src_dd + 2 * src_w); \ res1 = _mm256_fmadd_ps(tmp0, vf0, res1); \ res2 = _mm256_fmadd_ps(tmp0, vf1, res2); \ tmp0 = _mm256_loadu_ps(src_dd + 3 * src_w); \ res2 = _mm256_fmadd_ps(tmp0, vf0, res2); \ res3 = _mm256_fmadd_ps(tmp0, vf1, res3); \ tmp0 = _mm256_loadu_ps(src_dd + 4 * src_w); \ res3 = _mm256_fmadd_ps(tmp0, vf0, res3); \ res4 = _mm256_fmadd_ps(tmp0, vf1, res4); \ tmp0 = _mm256_loadu_ps(src_dd + 5 * src_w); \ res4 = _mm256_fmadd_ps(tmp0, vf0, res4); \ } \ _mm256_storeu_ps(dst_dd + 0 * dst_w, res0); \ _mm256_storeu_ps(dst_dd + 1 * dst_w, res1); \ _mm256_storeu_ps(dst_dd + 2 * dst_w, res2); \ _mm256_storeu_ps(dst_dd + 3 * dst_w, res3); \ _mm256_storeu_ps(dst_dd + 4 * dst_w, res4); \ } \ } while (0) #define SIMD_H6 \ do { \ const size_t sh = dh; \ const float* src_d = src + sh * src_w; \ float* dst_d = dst + dh * dst_w; \ size_t dw = dst_w_beg; \ for (; dw < dst_w_end; dw += 8) { \ const size_t sw = dw; \ float* dst_dd = dst_d + dw; \ __m256 tmp0; \ __m256 res0; \ res0 = _mm256_loadu_ps(dst_dd + 0 * dst_w); \ __m256 res1; \ res1 = _mm256_loadu_ps(dst_dd + 1 * dst_w); \ __m256 res2; \ res2 = _mm256_loadu_ps(dst_dd + 2 * dst_w); \ __m256 res3; \ res3 = _mm256_loadu_ps(dst_dd + 3 * dst_w); \ __m256 res4; \ res4 = _mm256_loadu_ps(dst_dd + 4 * dst_w); \ __m256 res5; \ res5 = _mm256_loadu_ps(dst_dd + 5 * dst_w); \ for (size_t fw = 0; fw < flt_w; ++fw) { \ const float* src_dd = src_d + sw + fw; \ __m256 vf0 = _mm256_broadcast_ss( \ &filter[0 * flt_w + flt_w - fw - 1]); \ __m256 vf1 = _mm256_broadcast_ss( \ &filter[1 * flt_w + flt_w - fw - 1]); \ tmp0 = _mm256_loadu_ps(src_dd + 0 * src_w); \ res0 = _mm256_fmadd_ps(tmp0, vf1, res0); \ tmp0 = _mm256_loadu_ps(src_dd + 1 * src_w); \ res0 = _mm256_fmadd_ps(tmp0, vf0, res0); \ res1 = _mm256_fmadd_ps(tmp0, vf1, res1); \ tmp0 = _mm256_loadu_ps(src_dd + 2 * src_w); \ res1 = _mm256_fmadd_ps(tmp0, vf0, res1); \ res2 = _mm256_fmadd_ps(tmp0, vf1, res2); \ tmp0 = _mm256_loadu_ps(src_dd + 3 * src_w); \ res2 = _mm256_fmadd_ps(tmp0, vf0, res2); \ res3 = _mm256_fmadd_ps(tmp0, vf1, res3); \ tmp0 = _mm256_loadu_ps(src_dd + 4 * src_w); \ res3 = _mm256_fmadd_ps(tmp0, vf0, res3); \ res4 = _mm256_fmadd_ps(tmp0, vf1, res4); \ tmp0 = _mm256_loadu_ps(src_dd + 5 * src_w); \ res4 = _mm256_fmadd_ps(tmp0, vf0, res4); \ res5 = _mm256_fmadd_ps(tmp0, vf1, res5); \ tmp0 = _mm256_loadu_ps(src_dd + 6 * src_w); \ res5 = _mm256_fmadd_ps(tmp0, vf0, res5); \ } \ _mm256_storeu_ps(dst_dd + 0 * dst_w, res0); \ _mm256_storeu_ps(dst_dd + 1 * dst_w, res1); \ _mm256_storeu_ps(dst_dd + 2 * dst_w, res2); \ _mm256_storeu_ps(dst_dd + 3 * dst_w, res3); \ _mm256_storeu_ps(dst_dd + 4 * dst_w, res4); \ _mm256_storeu_ps(dst_dd + 5 * dst_w, res5); \ } \ } while (0) #define SIMD_H7 \ do { \ const size_t sh = dh; \ const float* src_d = src + sh * src_w; \ float* dst_d = dst + dh * dst_w; \ size_t dw = dst_w_beg; \ for (; dw < dst_w_end; dw += 8) { \ const size_t sw = dw; \ float* dst_dd = dst_d + dw; \ __m256 tmp0; \ __m256 res0; \ res0 = _mm256_loadu_ps(dst_dd + 0 * dst_w); \ __m256 res1; \ res1 = _mm256_loadu_ps(dst_dd + 1 * dst_w); \ __m256 res2; \ res2 = _mm256_loadu_ps(dst_dd + 2 * dst_w); \ __m256 res3; \ res3 = _mm256_loadu_ps(dst_dd + 3 * dst_w); \ __m256 res4; \ res4 = _mm256_loadu_ps(dst_dd + 4 * dst_w); \ __m256 res5; \ res5 = _mm256_loadu_ps(dst_dd + 5 * dst_w); \ __m256 res6; \ res6 = _mm256_loadu_ps(dst_dd + 6 * dst_w); \ for (size_t fw = 0; fw < flt_w; ++fw) { \ const float* src_dd = src_d + sw + fw; \ __m256 vf0 = _mm256_broadcast_ss( \ &filter[0 * flt_w + flt_w - fw - 1]); \ __m256 vf1 = _mm256_broadcast_ss( \ &filter[1 * flt_w + flt_w - fw - 1]); \ tmp0 = _mm256_loadu_ps(src_dd + 0 * src_w); \ res0 = _mm256_fmadd_ps(tmp0, vf1, res0); \ tmp0 = _mm256_loadu_ps(src_dd + 1 * src_w); \ res0 = _mm256_fmadd_ps(tmp0, vf0, res0); \ res1 = _mm256_fmadd_ps(tmp0, vf1, res1); \ tmp0 = _mm256_loadu_ps(src_dd + 2 * src_w); \ res1 = _mm256_fmadd_ps(tmp0, vf0, res1); \ res2 = _mm256_fmadd_ps(tmp0, vf1, res2); \ tmp0 = _mm256_loadu_ps(src_dd + 3 * src_w); \ res2 = _mm256_fmadd_ps(tmp0, vf0, res2); \ res3 = _mm256_fmadd_ps(tmp0, vf1, res3); \ tmp0 = _mm256_loadu_ps(src_dd + 4 * src_w); \ res3 = _mm256_fmadd_ps(tmp0, vf0, res3); \ res4 = _mm256_fmadd_ps(tmp0, vf1, res4); \ tmp0 = _mm256_loadu_ps(src_dd + 5 * src_w); \ res4 = _mm256_fmadd_ps(tmp0, vf0, res4); \ res5 = _mm256_fmadd_ps(tmp0, vf1, res5); \ tmp0 = _mm256_loadu_ps(src_dd + 6 * src_w); \ res5 = _mm256_fmadd_ps(tmp0, vf0, res5); \ res6 = _mm256_fmadd_ps(tmp0, vf1, res6); \ tmp0 = _mm256_loadu_ps(src_dd + 7 * src_w); \ res6 = _mm256_fmadd_ps(tmp0, vf0, res6); \ } \ _mm256_storeu_ps(dst_dd + 0 * dst_w, res0); \ _mm256_storeu_ps(dst_dd + 1 * dst_w, res1); \ _mm256_storeu_ps(dst_dd + 2 * dst_w, res2); \ _mm256_storeu_ps(dst_dd + 3 * dst_w, res3); \ _mm256_storeu_ps(dst_dd + 4 * dst_w, res4); \ _mm256_storeu_ps(dst_dd + 5 * dst_w, res5); \ _mm256_storeu_ps(dst_dd + 6 * dst_w, res6); \ } \ } while (0) #define SIMD_H8 \ do { \ const size_t sh = dh; \ const float* src_d = src + sh * src_w; \ float* dst_d = dst + dh * dst_w; \ size_t dw = dst_w_beg; \ for (; dw < dst_w_end; dw += 8) { \ const size_t sw = dw; \ float* dst_dd = dst_d + dw; \ __m256 tmp0; \ __m256 res0; \ res0 = _mm256_loadu_ps(dst_dd + 0 * dst_w); \ __m256 res1; \ res1 = _mm256_loadu_ps(dst_dd + 1 * dst_w); \ __m256 res2; \ res2 = _mm256_loadu_ps(dst_dd + 2 * dst_w); \ __m256 res3; \ res3 = _mm256_loadu_ps(dst_dd + 3 * dst_w); \ __m256 res4; \ res4 = _mm256_loadu_ps(dst_dd + 4 * dst_w); \ __m256 res5; \ res5 = _mm256_loadu_ps(dst_dd + 5 * dst_w); \ __m256 res6; \ res6 = _mm256_loadu_ps(dst_dd + 6 * dst_w); \ __m256 res7; \ res7 = _mm256_loadu_ps(dst_dd + 7 * dst_w); \ for (size_t fw = 0; fw < flt_w; ++fw) { \ const float* src_dd = src_d + sw + fw; \ __m256 vf0 = _mm256_broadcast_ss( \ &filter[0 * flt_w + flt_w - fw - 1]); \ __m256 vf1 = _mm256_broadcast_ss( \ &filter[1 * flt_w + flt_w - fw - 1]); \ tmp0 = _mm256_loadu_ps(src_dd + 0 * src_w); \ res0 = _mm256_fmadd_ps(tmp0, vf1, res0); \ tmp0 = _mm256_loadu_ps(src_dd + 1 * src_w); \ res0 = _mm256_fmadd_ps(tmp0, vf0, res0); \ res1 = _mm256_fmadd_ps(tmp0, vf1, res1); \ tmp0 = _mm256_loadu_ps(src_dd + 2 * src_w); \ res1 = _mm256_fmadd_ps(tmp0, vf0, res1); \ res2 = _mm256_fmadd_ps(tmp0, vf1, res2); \ tmp0 = _mm256_loadu_ps(src_dd + 3 * src_w); \ res2 = _mm256_fmadd_ps(tmp0, vf0, res2); \ res3 = _mm256_fmadd_ps(tmp0, vf1, res3); \ tmp0 = _mm256_loadu_ps(src_dd + 4 * src_w); \ res3 = _mm256_fmadd_ps(tmp0, vf0, res3); \ res4 = _mm256_fmadd_ps(tmp0, vf1, res4); \ tmp0 = _mm256_loadu_ps(src_dd + 5 * src_w); \ res4 = _mm256_fmadd_ps(tmp0, vf0, res4); \ res5 = _mm256_fmadd_ps(tmp0, vf1, res5); \ tmp0 = _mm256_loadu_ps(src_dd + 6 * src_w); \ res5 = _mm256_fmadd_ps(tmp0, vf0, res5); \ res6 = _mm256_fmadd_ps(tmp0, vf1, res6); \ tmp0 = _mm256_loadu_ps(src_dd + 7 * src_w); \ res6 = _mm256_fmadd_ps(tmp0, vf0, res6); \ res7 = _mm256_fmadd_ps(tmp0, vf1, res7); \ tmp0 = _mm256_loadu_ps(src_dd + 8 * src_w); \ res7 = _mm256_fmadd_ps(tmp0, vf0, res7); \ } \ _mm256_storeu_ps(dst_dd + 0 * dst_w, res0); \ _mm256_storeu_ps(dst_dd + 1 * dst_w, res1); \ _mm256_storeu_ps(dst_dd + 2 * dst_w, res2); \ _mm256_storeu_ps(dst_dd + 3 * dst_w, res3); \ _mm256_storeu_ps(dst_dd + 4 * dst_w, res4); \ _mm256_storeu_ps(dst_dd + 5 * dst_w, res5); \ _mm256_storeu_ps(dst_dd + 6 * dst_w, res6); \ _mm256_storeu_ps(dst_dd + 7 * dst_w, res7); \ } \ } while (0) #define SIMD_H9 \ do { \ const size_t sh = dh; \ const float* src_d = src + sh * src_w; \ float* dst_d = dst + dh * dst_w; \ size_t dw = dst_w_beg; \ for (; dw < dst_w_end; dw += 8) { \ const size_t sw = dw; \ float* dst_dd = dst_d + dw; \ __m256 tmp0; \ __m256 res0; \ res0 = _mm256_loadu_ps(dst_dd + 0 * dst_w); \ __m256 res1; \ res1 = _mm256_loadu_ps(dst_dd + 1 * dst_w); \ __m256 res2; \ res2 = _mm256_loadu_ps(dst_dd + 2 * dst_w); \ __m256 res3; \ res3 = _mm256_loadu_ps(dst_dd + 3 * dst_w); \ __m256 res4; \ res4 = _mm256_loadu_ps(dst_dd + 4 * dst_w); \ __m256 res5; \ res5 = _mm256_loadu_ps(dst_dd + 5 * dst_w); \ __m256 res6; \ res6 = _mm256_loadu_ps(dst_dd + 6 * dst_w); \ __m256 res7; \ res7 = _mm256_loadu_ps(dst_dd + 7 * dst_w); \ __m256 res8; \ res8 = _mm256_loadu_ps(dst_dd + 8 * dst_w); \ for (size_t fw = 0; fw < flt_w; ++fw) { \ const float* src_dd = src_d + sw + fw; \ __m256 vf0 = _mm256_broadcast_ss( \ &filter[0 * flt_w + flt_w - fw - 1]); \ __m256 vf1 = _mm256_broadcast_ss( \ &filter[1 * flt_w + flt_w - fw - 1]); \ tmp0 = _mm256_loadu_ps(src_dd + 0 * src_w); \ res0 = _mm256_fmadd_ps(tmp0, vf1, res0); \ tmp0 = _mm256_loadu_ps(src_dd + 1 * src_w); \ res0 = _mm256_fmadd_ps(tmp0, vf0, res0); \ res1 = _mm256_fmadd_ps(tmp0, vf1, res1); \ tmp0 = _mm256_loadu_ps(src_dd + 2 * src_w); \ res1 = _mm256_fmadd_ps(tmp0, vf0, res1); \ res2 = _mm256_fmadd_ps(tmp0, vf1, res2); \ tmp0 = _mm256_loadu_ps(src_dd + 3 * src_w); \ res2 = _mm256_fmadd_ps(tmp0, vf0, res2); \ res3 = _mm256_fmadd_ps(tmp0, vf1, res3); \ tmp0 = _mm256_loadu_ps(src_dd + 4 * src_w); \ res3 = _mm256_fmadd_ps(tmp0, vf0, res3); \ res4 = _mm256_fmadd_ps(tmp0, vf1, res4); \ tmp0 = _mm256_loadu_ps(src_dd + 5 * src_w); \ res4 = _mm256_fmadd_ps(tmp0, vf0, res4); \ res5 = _mm256_fmadd_ps(tmp0, vf1, res5); \ tmp0 = _mm256_loadu_ps(src_dd + 6 * src_w); \ res5 = _mm256_fmadd_ps(tmp0, vf0, res5); \ res6 = _mm256_fmadd_ps(tmp0, vf1, res6); \ tmp0 = _mm256_loadu_ps(src_dd + 7 * src_w); \ res6 = _mm256_fmadd_ps(tmp0, vf0, res6); \ res7 = _mm256_fmadd_ps(tmp0, vf1, res7); \ tmp0 = _mm256_loadu_ps(src_dd + 8 * src_w); \ res7 = _mm256_fmadd_ps(tmp0, vf0, res7); \ res8 = _mm256_fmadd_ps(tmp0, vf1, res8); \ tmp0 = _mm256_loadu_ps(src_dd + 9 * src_w); \ res8 = _mm256_fmadd_ps(tmp0, vf0, res8); \ } \ _mm256_storeu_ps(dst_dd + 0 * dst_w, res0); \ _mm256_storeu_ps(dst_dd + 1 * dst_w, res1); \ _mm256_storeu_ps(dst_dd + 2 * dst_w, res2); \ _mm256_storeu_ps(dst_dd + 3 * dst_w, res3); \ _mm256_storeu_ps(dst_dd + 4 * dst_w, res4); \ _mm256_storeu_ps(dst_dd + 5 * dst_w, res5); \ _mm256_storeu_ps(dst_dd + 6 * dst_w, res6); \ _mm256_storeu_ps(dst_dd + 7 * dst_w, res7); \ _mm256_storeu_ps(dst_dd + 8 * dst_w, res8); \ } \ } while (0) #define SIMD_H10 \ do { \ const size_t sh = dh; \ const float* src_d = src + sh * src_w; \ float* dst_d = dst + dh * dst_w; \ size_t dw = dst_w_beg; \ for (; dw < dst_w_end; dw += 8) { \ const size_t sw = dw; \ float* dst_dd = dst_d + dw; \ __m256 tmp0; \ __m256 res0; \ res0 = _mm256_loadu_ps(dst_dd + 0 * dst_w); \ __m256 res1; \ res1 = _mm256_loadu_ps(dst_dd + 1 * dst_w); \ __m256 res2; \ res2 = _mm256_loadu_ps(dst_dd + 2 * dst_w); \ __m256 res3; \ res3 = _mm256_loadu_ps(dst_dd + 3 * dst_w); \ __m256 res4; \ res4 = _mm256_loadu_ps(dst_dd + 4 * dst_w); \ __m256 res5; \ res5 = _mm256_loadu_ps(dst_dd + 5 * dst_w); \ __m256 res6; \ res6 = _mm256_loadu_ps(dst_dd + 6 * dst_w); \ __m256 res7; \ res7 = _mm256_loadu_ps(dst_dd + 7 * dst_w); \ __m256 res8; \ res8 = _mm256_loadu_ps(dst_dd + 8 * dst_w); \ __m256 res9; \ res9 = _mm256_loadu_ps(dst_dd + 9 * dst_w); \ for (size_t fw = 0; fw < flt_w; ++fw) { \ const float* src_dd = src_d + sw + fw; \ __m256 vf0 = _mm256_broadcast_ss( \ &filter[0 * flt_w + flt_w - fw - 1]); \ __m256 vf1 = _mm256_broadcast_ss( \ &filter[1 * flt_w + flt_w - fw - 1]); \ tmp0 = _mm256_loadu_ps(src_dd + 0 * src_w); \ res0 = _mm256_fmadd_ps(tmp0, vf1, res0); \ tmp0 = _mm256_loadu_ps(src_dd + 1 * src_w); \ res0 = _mm256_fmadd_ps(tmp0, vf0, res0); \ res1 = _mm256_fmadd_ps(tmp0, vf1, res1); \ tmp0 = _mm256_loadu_ps(src_dd + 2 * src_w); \ res1 = _mm256_fmadd_ps(tmp0, vf0, res1); \ res2 = _mm256_fmadd_ps(tmp0, vf1, res2); \ tmp0 = _mm256_loadu_ps(src_dd + 3 * src_w); \ res2 = _mm256_fmadd_ps(tmp0, vf0, res2); \ res3 = _mm256_fmadd_ps(tmp0, vf1, res3); \ tmp0 = _mm256_loadu_ps(src_dd + 4 * src_w); \ res3 = _mm256_fmadd_ps(tmp0, vf0, res3); \ res4 = _mm256_fmadd_ps(tmp0, vf1, res4); \ tmp0 = _mm256_loadu_ps(src_dd + 5 * src_w); \ res4 = _mm256_fmadd_ps(tmp0, vf0, res4); \ res5 = _mm256_fmadd_ps(tmp0, vf1, res5); \ tmp0 = _mm256_loadu_ps(src_dd + 6 * src_w); \ res5 = _mm256_fmadd_ps(tmp0, vf0, res5); \ res6 = _mm256_fmadd_ps(tmp0, vf1, res6); \ tmp0 = _mm256_loadu_ps(src_dd + 7 * src_w); \ res6 = _mm256_fmadd_ps(tmp0, vf0, res6); \ res7 = _mm256_fmadd_ps(tmp0, vf1, res7); \ tmp0 = _mm256_loadu_ps(src_dd + 8 * src_w); \ res7 = _mm256_fmadd_ps(tmp0, vf0, res7); \ res8 = _mm256_fmadd_ps(tmp0, vf1, res8); \ tmp0 = _mm256_loadu_ps(src_dd + 9 * src_w); \ res8 = _mm256_fmadd_ps(tmp0, vf0, res8); \ res9 = _mm256_fmadd_ps(tmp0, vf1, res9); \ tmp0 = _mm256_loadu_ps(src_dd + 10 * src_w); \ res9 = _mm256_fmadd_ps(tmp0, vf0, res9); \ } \ _mm256_storeu_ps(dst_dd + 0 * dst_w, res0); \ _mm256_storeu_ps(dst_dd + 1 * dst_w, res1); \ _mm256_storeu_ps(dst_dd + 2 * dst_w, res2); \ _mm256_storeu_ps(dst_dd + 3 * dst_w, res3); \ _mm256_storeu_ps(dst_dd + 4 * dst_w, res4); \ _mm256_storeu_ps(dst_dd + 5 * dst_w, res5); \ _mm256_storeu_ps(dst_dd + 6 * dst_w, res6); \ _mm256_storeu_ps(dst_dd + 7 * dst_w, res7); \ _mm256_storeu_ps(dst_dd + 8 * dst_w, res8); \ _mm256_storeu_ps(dst_dd + 9 * dst_w, res9); \ } \ } while (0) #define SIMD_H11 \ do { \ const size_t sh = dh; \ const float* src_d = src + sh * src_w; \ float* dst_d = dst + dh * dst_w; \ size_t dw = dst_w_beg; \ for (; dw < dst_w_end; dw += 8) { \ const size_t sw = dw; \ float* dst_dd = dst_d + dw; \ __m256 tmp0; \ __m256 res0; \ res0 = _mm256_loadu_ps(dst_dd + 0 * dst_w); \ __m256 res1; \ res1 = _mm256_loadu_ps(dst_dd + 1 * dst_w); \ __m256 res2; \ res2 = _mm256_loadu_ps(dst_dd + 2 * dst_w); \ __m256 res3; \ res3 = _mm256_loadu_ps(dst_dd + 3 * dst_w); \ __m256 res4; \ res4 = _mm256_loadu_ps(dst_dd + 4 * dst_w); \ __m256 res5; \ res5 = _mm256_loadu_ps(dst_dd + 5 * dst_w); \ __m256 res6; \ res6 = _mm256_loadu_ps(dst_dd + 6 * dst_w); \ __m256 res7; \ res7 = _mm256_loadu_ps(dst_dd + 7 * dst_w); \ __m256 res8; \ res8 = _mm256_loadu_ps(dst_dd + 8 * dst_w); \ __m256 res9; \ res9 = _mm256_loadu_ps(dst_dd + 9 * dst_w); \ __m256 res10; \ res10 = _mm256_loadu_ps(dst_dd + 10 * dst_w); \ for (size_t fw = 0; fw < flt_w; ++fw) { \ const float* src_dd = src_d + sw + fw; \ __m256 vf0 = _mm256_broadcast_ss( \ &filter[0 * flt_w + flt_w - fw - 1]); \ __m256 vf1 = _mm256_broadcast_ss( \ &filter[1 * flt_w + flt_w - fw - 1]); \ tmp0 = _mm256_loadu_ps(src_dd + 0 * src_w); \ res0 = _mm256_fmadd_ps(tmp0, vf1, res0); \ tmp0 = _mm256_loadu_ps(src_dd + 1 * src_w); \ res0 = _mm256_fmadd_ps(tmp0, vf0, res0); \ res1 = _mm256_fmadd_ps(tmp0, vf1, res1); \ tmp0 = _mm256_loadu_ps(src_dd + 2 * src_w); \ res1 = _mm256_fmadd_ps(tmp0, vf0, res1); \ res2 = _mm256_fmadd_ps(tmp0, vf1, res2); \ tmp0 = _mm256_loadu_ps(src_dd + 3 * src_w); \ res2 = _mm256_fmadd_ps(tmp0, vf0, res2); \ res3 = _mm256_fmadd_ps(tmp0, vf1, res3); \ tmp0 = _mm256_loadu_ps(src_dd + 4 * src_w); \ res3 = _mm256_fmadd_ps(tmp0, vf0, res3); \ res4 = _mm256_fmadd_ps(tmp0, vf1, res4); \ tmp0 = _mm256_loadu_ps(src_dd + 5 * src_w); \ res4 = _mm256_fmadd_ps(tmp0, vf0, res4); \ res5 = _mm256_fmadd_ps(tmp0, vf1, res5); \ tmp0 = _mm256_loadu_ps(src_dd + 6 * src_w); \ res5 = _mm256_fmadd_ps(tmp0, vf0, res5); \ res6 = _mm256_fmadd_ps(tmp0, vf1, res6); \ tmp0 = _mm256_loadu_ps(src_dd + 7 * src_w); \ res6 = _mm256_fmadd_ps(tmp0, vf0, res6); \ res7 = _mm256_fmadd_ps(tmp0, vf1, res7); \ tmp0 = _mm256_loadu_ps(src_dd + 8 * src_w); \ res7 = _mm256_fmadd_ps(tmp0, vf0, res7); \ res8 = _mm256_fmadd_ps(tmp0, vf1, res8); \ tmp0 = _mm256_loadu_ps(src_dd + 9 * src_w); \ res8 = _mm256_fmadd_ps(tmp0, vf0, res8); \ res9 = _mm256_fmadd_ps(tmp0, vf1, res9); \ tmp0 = _mm256_loadu_ps(src_dd + 10 * src_w); \ res9 = _mm256_fmadd_ps(tmp0, vf0, res9); \ res10 = _mm256_fmadd_ps(tmp0, vf1, res10); \ tmp0 = _mm256_loadu_ps(src_dd + 11 * src_w); \ res10 = _mm256_fmadd_ps(tmp0, vf0, res10); \ } \ _mm256_storeu_ps(dst_dd + 0 * dst_w, res0); \ _mm256_storeu_ps(dst_dd + 1 * dst_w, res1); \ _mm256_storeu_ps(dst_dd + 2 * dst_w, res2); \ _mm256_storeu_ps(dst_dd + 3 * dst_w, res3); \ _mm256_storeu_ps(dst_dd + 4 * dst_w, res4); \ _mm256_storeu_ps(dst_dd + 5 * dst_w, res5); \ _mm256_storeu_ps(dst_dd + 6 * dst_w, res6); \ _mm256_storeu_ps(dst_dd + 7 * dst_w, res7); \ _mm256_storeu_ps(dst_dd + 8 * dst_w, res8); \ _mm256_storeu_ps(dst_dd + 9 * dst_w, res9); \ _mm256_storeu_ps(dst_dd + 10 * dst_w, res10); \ } \ } while (0) #define SIMD_H12 \ do { \ const size_t sh = dh; \ const float* src_d = src + sh * src_w; \ float* dst_d = dst + dh * dst_w; \ size_t dw = dst_w_beg; \ for (; dw < dst_w_end; dw += 8) { \ const size_t sw = dw; \ float* dst_dd = dst_d + dw; \ __m256 tmp0; \ __m256 res0; \ res0 = _mm256_loadu_ps(dst_dd + 0 * dst_w); \ __m256 res1; \ res1 = _mm256_loadu_ps(dst_dd + 1 * dst_w); \ __m256 res2; \ res2 = _mm256_loadu_ps(dst_dd + 2 * dst_w); \ __m256 res3; \ res3 = _mm256_loadu_ps(dst_dd + 3 * dst_w); \ __m256 res4; \ res4 = _mm256_loadu_ps(dst_dd + 4 * dst_w); \ __m256 res5; \ res5 = _mm256_loadu_ps(dst_dd + 5 * dst_w); \ __m256 res6; \ res6 = _mm256_loadu_ps(dst_dd + 6 * dst_w); \ __m256 res7; \ res7 = _mm256_loadu_ps(dst_dd + 7 * dst_w); \ __m256 res8; \ res8 = _mm256_loadu_ps(dst_dd + 8 * dst_w); \ __m256 res9; \ res9 = _mm256_loadu_ps(dst_dd + 9 * dst_w); \ __m256 res10; \ res10 = _mm256_loadu_ps(dst_dd + 10 * dst_w); \ __m256 res11; \ res11 = _mm256_loadu_ps(dst_dd + 11 * dst_w); \ for (size_t fw = 0; fw < flt_w; ++fw) { \ const float* src_dd = src_d + sw + fw; \ __m256 vf0 = _mm256_broadcast_ss( \ &filter[0 * flt_w + flt_w - fw - 1]); \ __m256 vf1 = _mm256_broadcast_ss( \ &filter[1 * flt_w + flt_w - fw - 1]); \ tmp0 = _mm256_loadu_ps(src_dd + 0 * src_w); \ res0 = _mm256_fmadd_ps(tmp0, vf1, res0); \ tmp0 = _mm256_loadu_ps(src_dd + 1 * src_w); \ res0 = _mm256_fmadd_ps(tmp0, vf0, res0); \ res1 = _mm256_fmadd_ps(tmp0, vf1, res1); \ tmp0 = _mm256_loadu_ps(src_dd + 2 * src_w); \ res1 = _mm256_fmadd_ps(tmp0, vf0, res1); \ res2 = _mm256_fmadd_ps(tmp0, vf1, res2); \ tmp0 = _mm256_loadu_ps(src_dd + 3 * src_w); \ res2 = _mm256_fmadd_ps(tmp0, vf0, res2); \ res3 = _mm256_fmadd_ps(tmp0, vf1, res3); \ tmp0 = _mm256_loadu_ps(src_dd + 4 * src_w); \ res3 = _mm256_fmadd_ps(tmp0, vf0, res3); \ res4 = _mm256_fmadd_ps(tmp0, vf1, res4); \ tmp0 = _mm256_loadu_ps(src_dd + 5 * src_w); \ res4 = _mm256_fmadd_ps(tmp0, vf0, res4); \ res5 = _mm256_fmadd_ps(tmp0, vf1, res5); \ tmp0 = _mm256_loadu_ps(src_dd + 6 * src_w); \ res5 = _mm256_fmadd_ps(tmp0, vf0, res5); \ res6 = _mm256_fmadd_ps(tmp0, vf1, res6); \ tmp0 = _mm256_loadu_ps(src_dd + 7 * src_w); \ res6 = _mm256_fmadd_ps(tmp0, vf0, res6); \ res7 = _mm256_fmadd_ps(tmp0, vf1, res7); \ tmp0 = _mm256_loadu_ps(src_dd + 8 * src_w); \ res7 = _mm256_fmadd_ps(tmp0, vf0, res7); \ res8 = _mm256_fmadd_ps(tmp0, vf1, res8); \ tmp0 = _mm256_loadu_ps(src_dd + 9 * src_w); \ res8 = _mm256_fmadd_ps(tmp0, vf0, res8); \ res9 = _mm256_fmadd_ps(tmp0, vf1, res9); \ tmp0 = _mm256_loadu_ps(src_dd + 10 * src_w); \ res9 = _mm256_fmadd_ps(tmp0, vf0, res9); \ res10 = _mm256_fmadd_ps(tmp0, vf1, res10); \ tmp0 = _mm256_loadu_ps(src_dd + 11 * src_w); \ res10 = _mm256_fmadd_ps(tmp0, vf0, res10); \ res11 = _mm256_fmadd_ps(tmp0, vf1, res11); \ tmp0 = _mm256_loadu_ps(src_dd + 12 * src_w); \ res11 = _mm256_fmadd_ps(tmp0, vf0, res11); \ } \ _mm256_storeu_ps(dst_dd + 0 * dst_w, res0); \ _mm256_storeu_ps(dst_dd + 1 * dst_w, res1); \ _mm256_storeu_ps(dst_dd + 2 * dst_w, res2); \ _mm256_storeu_ps(dst_dd + 3 * dst_w, res3); \ _mm256_storeu_ps(dst_dd + 4 * dst_w, res4); \ _mm256_storeu_ps(dst_dd + 5 * dst_w, res5); \ _mm256_storeu_ps(dst_dd + 6 * dst_w, res6); \ _mm256_storeu_ps(dst_dd + 7 * dst_w, res7); \ _mm256_storeu_ps(dst_dd + 8 * dst_w, res8); \ _mm256_storeu_ps(dst_dd + 9 * dst_w, res9); \ _mm256_storeu_ps(dst_dd + 10 * dst_w, res10); \ _mm256_storeu_ps(dst_dd + 11 * dst_w, res11); \ } \ } while (0) #define SIMD_H13 \ do { \ const size_t sh = dh; \ const float* src_d = src + sh * src_w; \ float* dst_d = dst + dh * dst_w; \ size_t dw = dst_w_beg; \ for (; dw < dst_w_end; dw += 8) { \ const size_t sw = dw; \ float* dst_dd = dst_d + dw; \ __m256 tmp0; \ __m256 res0; \ res0 = _mm256_loadu_ps(dst_dd + 0 * dst_w); \ __m256 res1; \ res1 = _mm256_loadu_ps(dst_dd + 1 * dst_w); \ __m256 res2; \ res2 = _mm256_loadu_ps(dst_dd + 2 * dst_w); \ __m256 res3; \ res3 = _mm256_loadu_ps(dst_dd + 3 * dst_w); \ __m256 res4; \ res4 = _mm256_loadu_ps(dst_dd + 4 * dst_w); \ __m256 res5; \ res5 = _mm256_loadu_ps(dst_dd + 5 * dst_w); \ __m256 res6; \ res6 = _mm256_loadu_ps(dst_dd + 6 * dst_w); \ __m256 res7; \ res7 = _mm256_loadu_ps(dst_dd + 7 * dst_w); \ __m256 res8; \ res8 = _mm256_loadu_ps(dst_dd + 8 * dst_w); \ __m256 res9; \ res9 = _mm256_loadu_ps(dst_dd + 9 * dst_w); \ __m256 res10; \ res10 = _mm256_loadu_ps(dst_dd + 10 * dst_w); \ __m256 res11; \ res11 = _mm256_loadu_ps(dst_dd + 11 * dst_w); \ __m256 res12; \ res12 = _mm256_loadu_ps(dst_dd + 12 * dst_w); \ for (size_t fw = 0; fw < flt_w; ++fw) { \ const float* src_dd = src_d + sw + fw; \ __m256 vf0 = _mm256_broadcast_ss( \ &filter[0 * flt_w + flt_w - fw - 1]); \ __m256 vf1 = _mm256_broadcast_ss( \ &filter[1 * flt_w + flt_w - fw - 1]); \ tmp0 = _mm256_loadu_ps(src_dd + 0 * src_w); \ res0 = _mm256_fmadd_ps(tmp0, vf1, res0); \ tmp0 = _mm256_loadu_ps(src_dd + 1 * src_w); \ res0 = _mm256_fmadd_ps(tmp0, vf0, res0); \ res1 = _mm256_fmadd_ps(tmp0, vf1, res1); \ tmp0 = _mm256_loadu_ps(src_dd + 2 * src_w); \ res1 = _mm256_fmadd_ps(tmp0, vf0, res1); \ res2 = _mm256_fmadd_ps(tmp0, vf1, res2); \ tmp0 = _mm256_loadu_ps(src_dd + 3 * src_w); \ res2 = _mm256_fmadd_ps(tmp0, vf0, res2); \ res3 = _mm256_fmadd_ps(tmp0, vf1, res3); \ tmp0 = _mm256_loadu_ps(src_dd + 4 * src_w); \ res3 = _mm256_fmadd_ps(tmp0, vf0, res3); \ res4 = _mm256_fmadd_ps(tmp0, vf1, res4); \ tmp0 = _mm256_loadu_ps(src_dd + 5 * src_w); \ res4 = _mm256_fmadd_ps(tmp0, vf0, res4); \ res5 = _mm256_fmadd_ps(tmp0, vf1, res5); \ tmp0 = _mm256_loadu_ps(src_dd + 6 * src_w); \ res5 = _mm256_fmadd_ps(tmp0, vf0, res5); \ res6 = _mm256_fmadd_ps(tmp0, vf1, res6); \ tmp0 = _mm256_loadu_ps(src_dd + 7 * src_w); \ res6 = _mm256_fmadd_ps(tmp0, vf0, res6); \ res7 = _mm256_fmadd_ps(tmp0, vf1, res7); \ tmp0 = _mm256_loadu_ps(src_dd + 8 * src_w); \ res7 = _mm256_fmadd_ps(tmp0, vf0, res7); \ res8 = _mm256_fmadd_ps(tmp0, vf1, res8); \ tmp0 = _mm256_loadu_ps(src_dd + 9 * src_w); \ res8 = _mm256_fmadd_ps(tmp0, vf0, res8); \ res9 = _mm256_fmadd_ps(tmp0, vf1, res9); \ tmp0 = _mm256_loadu_ps(src_dd + 10 * src_w); \ res9 = _mm256_fmadd_ps(tmp0, vf0, res9); \ res10 = _mm256_fmadd_ps(tmp0, vf1, res10); \ tmp0 = _mm256_loadu_ps(src_dd + 11 * src_w); \ res10 = _mm256_fmadd_ps(tmp0, vf0, res10); \ res11 = _mm256_fmadd_ps(tmp0, vf1, res11); \ tmp0 = _mm256_loadu_ps(src_dd + 12 * src_w); \ res11 = _mm256_fmadd_ps(tmp0, vf0, res11); \ res12 = _mm256_fmadd_ps(tmp0, vf1, res12); \ tmp0 = _mm256_loadu_ps(src_dd + 13 * src_w); \ res12 = _mm256_fmadd_ps(tmp0, vf0, res12); \ } \ _mm256_storeu_ps(dst_dd + 0 * dst_w, res0); \ _mm256_storeu_ps(dst_dd + 1 * dst_w, res1); \ _mm256_storeu_ps(dst_dd + 2 * dst_w, res2); \ _mm256_storeu_ps(dst_dd + 3 * dst_w, res3); \ _mm256_storeu_ps(dst_dd + 4 * dst_w, res4); \ _mm256_storeu_ps(dst_dd + 5 * dst_w, res5); \ _mm256_storeu_ps(dst_dd + 6 * dst_w, res6); \ _mm256_storeu_ps(dst_dd + 7 * dst_w, res7); \ _mm256_storeu_ps(dst_dd + 8 * dst_w, res8); \ _mm256_storeu_ps(dst_dd + 9 * dst_w, res9); \ _mm256_storeu_ps(dst_dd + 10 * dst_w, res10); \ _mm256_storeu_ps(dst_dd + 11 * dst_w, res11); \ _mm256_storeu_ps(dst_dd + 12 * dst_w, res12); \ } \ } while (0) #include <immintrin.h> #include <avxintrin.h> #include <fmaintrin.h> #include <algorithm> #include "../convolution_direct_special_cases.h" namespace megdnn { namespace x86 { namespace detail { void convolution_conv_fh2_fma(const float *src, const float *filter, float *dst, const size_t src_h, const size_t src_w, const size_t dst_h, const size_t dst_w, const size_t flt_w) { (void)src_h; const size_t dst_h_beg = 0; const size_t dst_h_end = dst_h; const size_t dst_w_beg = 0; const size_t dst_w_end = dst_w; size_t dh = dst_h_beg; for (; dh + 13 <= dst_h_end; dh += 13) { SIMD_H13; } switch (dst_h_end - dh) { case 1: SIMD_H1; break; case 2: SIMD_H2; break; case 3: SIMD_H3; break; case 4: SIMD_H4; break; case 5: SIMD_H5; break; case 6: SIMD_H6; break; case 7: SIMD_H7; break; case 8: SIMD_H8; break; case 9: SIMD_H9; break; case 10: SIMD_H10; break; case 11: SIMD_H11; break; case 12: SIMD_H12; break; } } } // namespace detail } // namespace x86 } // namespace megdnn #undef SIMD_H1 #undef SIMD_H2 #undef SIMD_H3 #undef SIMD_H4 #undef SIMD_H5 #undef SIMD_H6 #undef SIMD_H7 #undef SIMD_H8 #undef SIMD_H9 #undef SIMD_H10 #undef SIMD_H11 #undef SIMD_H12 #undef SIMD_H13
d0b6bf24d4f37645b9317d334d45f37a2ba5625b
7d5f853706ad7dbf9c9e9d3753793bb9aef1f966
/9/9.15/vector是否相等.cpp
d032ae3b858a1afb2d4a7728f9f81a2567081384
[]
no_license
Clins28/CPlusPlusPrimer
2e98d598f7a7baaee293aececf625514f5c3cae2
db05a74af54d1f4662124678fa97ac3d9b0c45ce
refs/heads/master
2020-04-14T07:47:20.083530
2018-07-17T12:16:05
2018-07-17T12:16:05
null
0
0
null
null
null
null
UTF-8
C++
false
false
357
cpp
#include <string> using std::string; #include <list> using std::list; #include <deque> using std::deque; #include <vector> using std::vector; #include <iostream> using std::cout; using std::cin; using std::endl; int main() { vector<int> v1{ 1,2,3,4,5,6,7,8,9 }; vector<int> v2{ 1,2,3,4,5,6,9 }; cout << (v1 == v2) << endl; system("pause"); return 0; }
b95ac747df2037ec8f880323ef6f4a03cb17faa1
bcad3845567f19ed74b3295c76d2f2212e85725c
/VulkanSamples/ForwardRenderingModel/vDeleter.h
7c50d67622f4e4cfce52882cd1ee9add63389e7e
[ "MIT" ]
permissive
centauroWaRRIor/VulkanSamples
9edf0fea591f008b1db26bb37441689d7021812c
5a7c58de820207cc0931a9db8c90f00453e31631
refs/heads/master
2021-07-15T23:58:39.107675
2020-06-07T00:03:55
2020-06-07T00:03:55
67,762,144
0
0
null
null
null
null
UTF-8
C++
false
false
2,422
h
#pragma once #include <functional> // used for lambda functions in the resource management // Thin vulkan objects wrapper to facilitate its resource management. This model // follows the RAII principle as it cleans up the object the moment it goes out of // scope template <typename T> class VDeleter { public: // default constructor with dummy deleter useful for list of deleters VDeleter() : VDeleter([](T, VkAllocationCallbacks*) {}) {} VDeleter(std::function<void(T, VkAllocationCallbacks*)> deletef) { this->deleter = [=](T obj) { deletef(obj, nullptr); }; } VDeleter(const VDeleter<VkInstance>& instance, std::function<void(VkInstance, T, VkAllocationCallbacks*)> deletef) { this->deleter = [&instance, deletef](T obj) { deletef(instance, obj, nullptr); }; } VDeleter(const VDeleter<VkDevice>& device, std::function<void(VkDevice, T, VkAllocationCallbacks*)> deletef) { this->deleter = [&device, deletef](T obj) { deletef(device, obj, nullptr); }; } ~VDeleter() { cleanup(); } // overloading the address of operator, useful for // making wrapper transparent const T* operator &() const { return &object; } // It overloads the address - of, assignment, comparison and casting operators to make // the wrapper as transparent as possible. When the wrapped object goes out of scope, // the destructor is invoked, which in turn calls the cleanup function we specified. // The address - of operator returns a constant pointer to make sure that the object // within the wrapper is not unexpectedly changed. If you want to replace the handle // within the wrapper through a pointer, then you should use the replace() function // instead. It will invoke the cleanup function for the existing handle so that you // can safely overwrite it afterwards. // There is also a default constructor with a dummy deleter function that can be used // to initialize it later, which will be useful for lists of deleters. T* replace() { cleanup(); return &object; } void operator=(T rhs) { cleanup(); object = rhs; } template<typename V> bool operator==(V rhs) { return object == T(rhs); } // overloading the casting or conversion operator. operator T() const { return object; } private: T object{ VK_NULL_HANDLE }; std::function<void(T)> deleter; void cleanup() { if (object != VK_NULL_HANDLE) { deleter(object); } object = VK_NULL_HANDLE; } };
e2f7a914d337b55f765ba7cd931bfc0e32508b88
855b85cbcbfe4b109f293320b03f68c268a900d7
/src/main.cpp
27bff70c06c7834c39ce6d9e45d57523e0307163
[]
no_license
foopod/they-see-me-rollin
8cf0b672c8d72ddefbdfdc50994f5bd2640d6b26
2d1319c19c9aeac4e58827ff668b48ff3af131d1
refs/heads/main
2023-06-26T06:30:26.732755
2021-07-27T19:25:10
2021-07-27T19:25:10
389,766,216
0
0
null
null
null
null
UTF-8
C++
false
false
7,070
cpp
#include "bn_core.h" #include "bn_random.h" #include "dr_scene_type.h" #include "dr_rotation.h" #include "dr_scene_intro.h" #include "dr_scene_up_button.h" #include "dr_scene_up_plug.h" #include "dr_scene_down_buns.h" #include "dr_scene_down_grill.h" #include "dr_scene_down_dog.h" #include "dr_scene_left_cutlery.h" #include "dr_scene_left_fryer.h" #include "dr_scene_left_rocks.h" #include "dr_scene_right_mustard.h" #include "dr_scene_right_fridge.h" #include "dr_scene_right_dump.h" #include "dr_scene_finish.h" #include "dr_scene_success.h" #include "dr_scene_failure.h" #include "dr_player_data.h" #include "dr_font.h" int main() { bn::core::init(); bn::random random = bn::random(); dr::Rotation outcome_rot = dr::Rotation::Right; //player data dr::PlayerData player_data = dr::PlayerData(); //text generator bn::sprite_text_generator text_generator(dr::fixed_8x8_sprite_font); // scenes // bn::sprite_ptr scenes[5] = { // dr::RightMustard(player_data, text_generator), // dr::DownBuns(player_data, text_generator), // dr::LeftCutlery(player_data, text_generator), // dr::UpButton(player_data, text_generator), // dr::RightFridge(player_data, text_generator), // }; int successes = 0; //first scene dr::SceneType scene = dr::SceneType::INTRO; while(true) { bool outcome = false; switch (scene) { case dr::SceneType::UP_BUTTON : { dr::UpButton upButton = dr::UpButton(player_data, text_generator); outcome = upButton.execute(); outcome_rot = dr::Rotation::Normal; scene = dr::SceneType::RIGHT_MUSTARD; break; } case dr::SceneType::LEFT_CUTLERY : { dr::LeftCutlery left_cutlery = dr::LeftCutlery(player_data, text_generator); outcome = left_cutlery.execute(); outcome_rot = dr::Rotation::Left; scene = dr::SceneType::UP_PLUG; break; } case dr::SceneType::RIGHT_MUSTARD : { dr::RightMustard right_mustard = dr::RightMustard(player_data, text_generator); outcome = right_mustard.execute(); outcome_rot = dr::Rotation::Right; scene = dr::SceneType::DOWN_GRILL; break; } case dr::SceneType::DOWN_BUNS : { dr::DownBuns down_buns = dr::DownBuns(player_data, text_generator); outcome = down_buns.execute(); outcome_rot = dr::Rotation::UpsideDown; scene = dr::SceneType::LEFT_FRYER; break; } case dr::SceneType::RIGHT_FRIDGE : { dr::RightFridge right_fridge = dr::RightFridge(player_data, text_generator); outcome = right_fridge.execute(); outcome_rot = dr::Rotation::Right; scene = dr::SceneType::DOWN_BUNS; break; } case dr::SceneType::DOWN_GRILL : { dr::DownGrill down_grill = dr::DownGrill(player_data, text_generator); outcome = down_grill.execute(); outcome_rot = dr::Rotation::UpsideDown; scene = dr::SceneType::LEFT_CUTLERY; break; } case dr::SceneType::LEFT_FRYER : { dr::LeftFryer left_fryer = dr::LeftFryer(player_data, text_generator); outcome = left_fryer.execute(); outcome_rot = dr::Rotation::Left; scene = dr::SceneType::UP_BUTTON; break; } case dr::SceneType::UP_PLUG : { dr::UpPlug up_plug = dr::UpPlug(player_data, text_generator); outcome = up_plug.execute(); outcome_rot = dr::Rotation::Normal; scene = dr::SceneType::RIGHT_DUMP; break; } case dr::SceneType::RIGHT_DUMP : { dr::RightDump right_dump = dr::RightDump(player_data, text_generator); outcome = right_dump.execute(); outcome_rot = dr::Rotation::Right; scene = dr::SceneType::DOWN_DOG; break; } case dr::SceneType::DOWN_DOG : { dr::DownDog down_dog = dr::DownDog(player_data, text_generator); outcome = down_dog.execute(); outcome_rot = dr::Rotation::UpsideDown; scene = dr::SceneType::LEFT_ROCKS; break; } case dr::SceneType::LEFT_ROCKS : { dr::LeftRocks left_rocks = dr::LeftRocks(player_data, text_generator); outcome = left_rocks.execute(); outcome_rot = dr::Rotation::Left; scene = dr::SceneType::FINISH; break; } case dr::SceneType::FINISH : { dr::Finish finish = dr::Finish(player_data, text_generator); finish.execute(successes); // finish.execute(5); outcome_rot = dr::Rotation::Normal; scene = dr::SceneType::INTRO; break; } case dr::SceneType::INTRO : { successes = 0; dr::Intro intro = dr::Intro(player_data, text_generator); intro.execute(); outcome_rot = dr::Rotation::Normal; scene = dr::SceneType::RIGHT_FRIDGE; break; } default: break; } if(scene != dr::SceneType::RIGHT_FRIDGE && scene != dr::SceneType::INTRO){ if(outcome){ //success dr::Success success = dr::Success(player_data, text_generator); success.execute(outcome_rot); ++successes; } else { //fail dr::Failure failure = dr::Failure(player_data, text_generator); failure.execute(outcome_rot); } } // if(random.get() % 100 < 25){ // scene = dr::SceneType::UP; // } else if(random.get() % 100 < 50) { // scene = dr::SceneType::DOWN; // } else if(random.get() % 100 < 75) { // scene = dr::SceneType::LEFT; // } else { // scene = dr::SceneType::RIGHT; // } bn::core::update(); } }
ecf8b2643082442c73d637ee58552849ea76a13b
f027e05000522e7c4b4cf74a1b4254e37e81be0c
/AppSim.h
687d4d7507a840112b1b6ad14e93c0d80e64bd07
[]
no_license
zouwen198317/solver
3cfa8ef001f688cc9a9d169e00c024a892337df6
5a71d4ec445c7d32be73b57baca010e6f52021f3
refs/heads/master
2021-01-21T08:12:22.230713
2015-02-10T05:34:50
2015-02-10T05:34:50
null
0
0
null
null
null
null
UTF-8
C++
false
false
817
h
#ifndef __APP_SIM_H__ #define __APP_SIM_H__ #include "AppMates.h" #include "Visualizer.h" #include <memory> /// advmates-simアプリケーションクラス /** * 計算と簡易可視化を同時に行う * * @ingroup Initialization */ class AppSim : public AppMates { public: AppSim(){}; ~AppSim(){}; /// 初期化とコマンドライン引数の処理 virtual void init(int argc, char** argv, bool output); protected: /// コマンドライン引数を処理する virtual void parseArgument(int argc, char** argv); /// 説明を出力する virtual void printUsage(); public: /// シミュレーションを開始する int run(); private: /// 可視化とGUIを担当するオブジェクト std::auto_ptr<Visualizer> _vis; }; #endif //__APP_SIM_H__
166498cefe75dc3c23e0343103b92cdfca2f643d
16dbe02dab45576023bf0a24d0b7f42c7bee4263
/Program 6/IntList.h
f7f7105b2469d9213c9e9f64d6c2f27f3d9d2680
[]
no_license
indranisen2003/CS012
4b4dbffe6f769140153e3239de9e60b236497431
2fa0e64030d79d53e8a3868de74fe10ddc80293b
refs/heads/master
2022-02-14T23:54:29.577651
2019-04-01T22:31:55
2019-04-01T22:31:55
null
0
0
null
null
null
null
UTF-8
C++
false
false
924
h
#ifndef INTLIST_H #define INTLIST_H #include <ostream> using namespace std; struct IntNode { int data; IntNode* next; IntNode(int data) : data(data), next(0) { } }; class IntList { protected: IntNode *head; IntNode *tail; public: IntList(); IntList(const IntList &); IntList & operator=(const IntList &); ~IntList(); bool empty() const; void display() const; void push_front(int); void push_back(int); void pop_front(); void selection_sort(); void insert_ordered(int); void remove_duplicates(); void clear(); friend ostream & operator<<(ostream &, const IntList &); private: // Used by selection_sort function. // Just have this function return nullptr if you don't use this function. IntNode * min(IntNode*); // Used by copy constructor and/or copy assignment operator. // Just implement an empty function if you don't use this function. void copy(const IntList &); }; #endif
182fbc79a20c8339e55847666912dedb14f36f0c
11fb912c54742b8a147bcb59085f275850e249bb
/algorithms/perfectCircle.cpp
ab8c60f880a9a992be1813ce83ab9a5381307210
[]
no_license
rodp63/CG-3-Mosqueteros
e631302d671c2d0df31e43182962d529dc3fec7a
376d7358681f1ff8579fde778273c63686dbddab
refs/heads/master
2023-06-11T20:52:03.541426
2021-07-06T23:16:40
2021-07-06T23:16:40
355,275,689
0
0
null
null
null
null
UTF-8
C++
false
false
1,008
cpp
#include <iostream> #include <math.h> struct Point { Point(double X, double Y) : x(X), y(Y){}; double x; double y; }; //Simple Point structure int main() { double mi, ro,ni ; int i; ; const double PI = 3.14159; std::cout << "input: centro x | centro y | radio | indice de vertice de inicio" << std::endl; std::cin >> mi >> ni >> ro >> i; Point Autor(mi, ni); std::cout << "COPIAR A PARTIR DE AQUI\n" << std::endl; std::cout << mi << "f, " << ni << "f, " << "0.0f, // " << i << std::endl; i++; for (double angle = 0, j = i; angle <= 2 * PI; angle += 0.1, j++) std::cout << (Autor.x + ro * cos(angle)) << "f, " << (Autor.y + ro * sin(angle)) << "f, " << "0.0f, // " << j << std::endl; int q = i + 62; for (int j = i; j < q; j++) { std::cout << i - 1 << ", " << j << ", " << j + 1 << "," << std::endl; } std::cout << i - 1 << ", " << q << ", " << i << "," << std::endl; }
[ "BasicAlgorithm" ]
BasicAlgorithm
fcb70869877d70c12e7b2a5d688cc2d000a2273c
95a3f7b2207b899d5e443915b64a440be44a8f1a
/implementation/Galaxterminate/ChangeEngine.hpp
98dec9daff217d5010ddfbb7bd0474d5aed899a5
[]
no_license
cedmans/ChangeEngine
32a918bc4301d4da6c44750275530e4daf9f2eaa
f7a226cc19fa89bb9e769246d278cbc0a199018c
refs/heads/master
2020-06-05T13:18:26.748806
2011-06-15T23:32:05
2011-06-15T23:32:05
null
0
0
null
null
null
null
UTF-8
C++
false
false
32
hpp
../ChangeEngine/ChangeEngine.hpp
70ef973734c44bdb412d4fa4491a2116b79d8cf5
0fa0a47b7bffe1805ecb8201df51e8c84d85e9d3
/src/Fle_MultiColorChooserDialog.cpp
d7008680487b7fa5dbb72cb0872efabe5dfd3015
[]
no_license
Moaaz-Rafique/FL-Essentials
28e0cd73e7b6811cf32b1b4b4cb71c5b84f8e343
16ab22d65fc3974cb0be34edd9585d4d4a102021
refs/heads/master
2023-03-16T19:47:33.708122
2021-01-09T01:05:26
2021-01-09T01:05:26
null
0
0
null
null
null
null
UTF-8
C++
false
false
5,063
cpp
/********************************************************************************* created: 2017/11/22 04:02AM filename: Fle_MultiColorChooserDialog.cpp file base: Fle_MultiColorChooserDialog file ext: cpp author: Furqan Ullah (Post-doc, Ph.D.) website: http://real3d.pk CopyRight: All Rights Reserved purpose: customized multi color dialog that creates two color choosers inside of a dialog box with OK, Cancel, and Default buttons. /********************************************************************************** FL-ESSENTIALS (FLE) - FLTK Utility Widgets Copyright (C) 2014-2019 REAL3D This file and its content is protected by a software license. You should have received a copy of this license with this file. If not, please contact Dr. Furqan Ullah immediately: **********************************************************************************/ #include <FLE/Fle_MultiColorChooserDialog.h> using namespace R3D; Fle_MultiColorChooserDialog::Fle_MultiColorChooserDialog(int _w, int _h, double _r1, double _g1, double _b1, double _r2, double _g2, double _b2, const char* _title) { m_default_color1[0] = 1; m_default_color1[1] = 1; m_default_color1[2] = 1; m_default_color2[0] = 1; m_default_color2[1] = 1; m_default_color2[2] = 1; p_dialog = new Fle_Dialog(_w, _h, _title, 58, 0, 0); p_dialog->setBackgroundColor(74, 84, 89); p_dialog->callback(close_cb, p_dialog); p_dialog->setMargins(10, 10, 10, 10); p_dialog->size_range(_w, _h, _w, _h); p_layout = p_dialog->getCentralLayout()->addHLayout(150); p_layout->begin(); { p_cc1 = new Fle_ColorChooser(0, 0, 285, 150); p_cc1->box(FL_FLAT_BOX); p_cc1->rgb(_r1, _g1, _b1); p_cc1->color(fl_rgb_color(74, 84, 89)); p_cc1->color2(fl_rgb_color(74, 84, 89)); p_cc1->selection_color(fl_rgb_color(74, 84, 89)); p_cc1->labelcolor(fl_rgb_color(255, 255, 255)); p_cc1->labelsize(14); p_cc1->mode(1); p_cc1->when(FL_WHEN_RELEASE); p_cc2 = new Fle_ColorChooser(0, 0, 285, 150); p_cc2->box(FL_FLAT_BOX); p_cc2->rgb(_r2, _g2, _b2); p_cc2->color(fl_rgb_color(74, 84, 89)); p_cc2->color2(fl_rgb_color(74, 84, 89)); p_cc2->selection_color(fl_rgb_color(74, 84, 89)); p_cc2->labelcolor(fl_rgb_color(255, 255, 255)); p_cc2->labelsize(14); p_cc2->mode(1); p_cc2->when(FL_WHEN_RELEASE); } p_layout->end(); auto hl1 = p_dialog->getStatusBar()->addLayoutLR(23); hl1->setBackgroundColor(74, 84, 89); hl1->beginRight(); { p_ok = new Fle_Button(0, 0, 90, 22, "OK"); p_ok->color(fl_rgb_color(74, 84, 89)); p_ok->selection_color(fl_rgb_color(74, 84, 89)); p_ok->labelcolor(fl_rgb_color(255, 255, 255)); p_ok->labelsize(12); p_dialog->setOkButton(p_ok); p_cancel = new Fle_Button(0, 0, 90, 22, "Cancel"); p_cancel->color(fl_rgb_color(74, 84, 89)); p_cancel->selection_color(fl_rgb_color(74, 84, 89)); p_cancel->labelcolor(fl_rgb_color(255, 255, 255)); p_cancel->labelsize(12); p_dialog->setCancelButton(p_cancel); p_reset = new Fle_Button(0, 0, 90, 22, "Default"); p_reset->color(fl_rgb_color(74, 84, 89)); p_reset->selection_color(fl_rgb_color(74, 84, 89)); p_reset->labelcolor(fl_rgb_color(255, 255, 255)); p_reset->labelsize(12); p_reset->callback(default_colors_cb, this); } hl1->end(); p_dialog->getCentralLayout()->getCentralLayout()->setMargins(10, 10, 15, 0); // set dialog's margins. p_dialog->getStatusBar()->getCentralLayout()->setMargins(10, 10, 10, 0); // set statusbar's margins and height. p_dialog->setStatusBarFixedHeight(58); p_dialog->resizable(p_dialog); p_dialog->hotspot(p_ok); p_dialog->set_modal(); int X, Y, W, H; Fl::screen_work_area(X, Y, W, H); p_dialog->position(X + W / 2 - _w / 2, Y + H / 2 - _h / 2); } Fle_MultiColorChooserDialog::~Fle_MultiColorChooserDialog() { } void Fle_MultiColorChooserDialog::close_cb(Fl_Widget* _w, void* _p) { Fle_Dialog* d = static_cast<Fle_Dialog*>(_p); if (!d) return; d->hide(); Fl::delete_widget(d); } void Fle_MultiColorChooserDialog::default_colors_cb(Fl_Widget* _w, void* _p) { auto cc = static_cast<Fle_MultiColorChooserDialog*>(_p); if (!cc) return; cc->p_cc1->rgb(cc->m_default_color1[0], cc->m_default_color1[1], cc->m_default_color1[2]); cc->p_cc2->rgb(cc->m_default_color2[0], cc->m_default_color2[1], cc->m_default_color2[2]); cc->p_cc1->do_callback(); cc->p_cc2->do_callback(); } void Fle_MultiColorChooserDialog::setDefaultColors(double _r1, double _g1, double _b1, double _r2, double _g2, double _b2) { m_default_color1[0] = _r1; m_default_color1[1] = _g1; m_default_color1[2] = _b1; m_default_color2[0] = _r2; m_default_color2[1] = _g2; m_default_color2[2] = _b2; } int Fle_MultiColorChooserDialog::exec() { p_dialog->show(); while (p_dialog->shown()) { Fl::wait(); Fl_Widget* o; while (((o = Fl::readqueue())) && p_dialog->shown()) { if (o == p_ok) { p_dialog->hide(); Fl::delete_widget(p_dialog); return 1; } else { if (o == p_cancel || o == p_dialog) { p_dialog->hide(); Fl::delete_widget(p_dialog); return 0; } } } } return 0; }
a20ba7d3504c0e54b6505ea034fb47dd5d70cd35
449cae7b21b46f5be5c782bd0091d916861397fd
/TestTCP/PublicCode/Head File/Thread/ClassThread.h
317010040c38ca3117c914f25f992516ec1e39ff
[]
no_license
Mertion/TestTCP
a1783ac53d55f0a9b53e6d8374260b033eed75e6
4dc95e1a3a60a49f56a98aefccd27fc55d7bbceb
refs/heads/master
2020-05-22T00:36:53.934009
2019-05-11T19:58:35
2019-05-11T19:58:35
186,175,851
0
0
null
null
null
null
GB18030
C++
false
false
1,538
h
#pragma once //线程回调函数指针类型 typedef unsigned(*pfuncThread) (void*pArguments);//线程工作函数 //周期循环线程类 class ClassThread { public: enum ENUM_THREADINFO { ENUM_THREADINFO_SUCCESS = 0, ENUM_THREADINFO_CREATTHREADFAILD, //创建线程失败 ENUM_THREADINFO_FUNCISEMPYT, //函数指针为空 ENUM_THREADINFO_THREADISRUN, //线程已经在运行 }; public: ClassThread(); ~ClassThread(); unsigned ThreadTask(); //static unsigned __stdcall ThreadStaticEntryPoint(void * pThis); //启动线程 int Start(); //停止线程 void Stop(); //暂停线程运行 void SuspendThread(); //恢复线程运行 void ResumeThread(); //设置回调函数 void SetFunction(pfuncThread p_pFunc); //设置线程参数 void SetArg(void* p_pArg); //设置线程初始状态:默认为零 void SetInitFlag(unsigned p_uiInitFlag); //设置扫描时间间隔 void SetInterval(int p_nInterval); protected: //线程暂停标志 bool m_bSuspendThread = false; //退出线程标志 bool m_bExitThread = false; //线程开始信号 HANDLE m_hStartEvent = NULL; //线程结束信号 HANDLE m_hFinishEvent = NULL; //线程句柄 HANDLE m_hThredHandle = NULL; //线程初始状态: 0-立即运行,CREATE_SUSPEND-创建后挂起 unsigned m_uiInitFlag = 0; //线程ID unsigned m_uiThreadID = 0; //线程函数指针 pfuncThread m_pFunc = NULL; //线程参数列表 void* m_pArg = NULL; //线程状态码 DWORD dwExitCode = 0; //线程扫描间隔 int m_nInterval = 10; };
987acea4b44e61c782968df6a7eba3d489c0939d
253f1f7dc64c8078abc135d4ccd619e10314e24f
/university/sorting/main.cpp
6c9d9f877c46d3859694e620a2e522b64145c45b
[]
no_license
JustSlavic/snippets
4a3f1cf5822213515818f7ee32fad73c31df7796
8f5b77ab4f75f0eae1c42637aba2c9496db8cb61
refs/heads/master
2021-05-18T21:22:59.203006
2020-06-02T21:11:13
2020-06-02T21:11:13
251,427,567
0
0
null
null
null
null
UTF-8
C++
false
false
1,009
cpp
#include <stdio.h> #include <stdlib.h> #include <time.h> typedef struct _array { int* arr; int n; } array; array* make_array(int n) { array* a = malloc(sizeof(array)); a->arr = calloc(n, sizeof(int)); a->n = n; } void swap(int* a, int* b) { int tmp = *a; *a = *b; *b = tmp; } array* sort(array* a) { for (int i = 0; i < a->n; ++i) { for (int j = i+1; j < a->n; ++j) { if (a->arr[i] > a->arr[j]) swap(a->arr+i, a->arr+j); } } return a; } array* fill(array* a) { for (int i = 0; i < a->n; ++i) { a->arr[i] = rand() % 100; } return a; } array print(array a) { printf("[%d", a.arr[0]); for (int i = 1; i < a.n; ++i) { printf(", %d", a[i]); } printf("]\n"); return a; } array partial_sort(array a, int k) { k = 2; return a; } int main() { srand(time(0)); array a; a.n = 10; a.arr = calloc(a.n, sizeof(int)); print(sort(fill(a))); return 0; }
b290bf1407927a4d203f90d2e2a8c0cd5851ba30
8dcadce26703ff8c4b5de1018a10ebb7806818b4
/include/fxx/tuple/slice.h
bb85585cfe206646cdda510e56f191081a0f5b8a
[]
no_license
KFAFSP/fxx
62577556056d2b5da4bc19f9ea2461e3f1736817
df7073f4c3be6b62d906489d97ea21109b57f486
refs/heads/master
2020-06-30T02:08:26.600377
2019-08-05T20:55:21
2019-08-05T20:55:21
200,688,379
0
0
null
null
null
null
UTF-8
C++
false
false
1,510
h
/** Implements std::tuple slicing. * * @file tuple/slice.h * @author Karl F. A. Friebel ([email protected]) * * @version 0.1 * @date 2019-06-05 * * @copyright Copyright (c) 2019 */ #ifndef FXX_TUPLE_SLICE_H #define FXX_TUPLE_SLICE_H #pragma once #include <fxx/meta/indices.h> // fxx::meta::(apply_index_sequence_t, make_index_range) #include <fxx/tuple/pick.h> // fxx::tuple::pick_f namespace fxx { namespace tuple { /** Functor for std::tuple slicing. * * @todo Adapt documentation from fxx::meta::tuple_slice_t. * * @tparam Start Start index. * @tparam Length Range length. */ template<std::size_t Start, std::size_t Length> struct slice_f { template<class Tuple> constexpr auto operator()(Tuple&& tuple) noexcept { using idx_range_t = fxx::meta::make_index_range<Start, Length>; using pick_f_t = fxx::meta::apply_index_sequence_t<pick_f, idx_range_t>; return pick_f_t{}(std::forward<Tuple>(tuple)); } }; /** Slice a range of std::tuple elements. * * @todo Adapt documentation from fxx::meta::tuple_slice_t. * * @tparam Start Start index. * @tparam Length Range length. * @tparam Tuple Input tuple type. * * @param [in] tuple Input tuple. * * @return Result tuple. */ template<std::size_t Start, std::size_t Length, class Tuple> constexpr auto slice(Tuple&& tuple) noexcept { return slice_f<Start, Length>{}(std::forward<Tuple>(tuple)); } } } // namespace fxx::tuple #endif
21c8b7955273631612148155d8b248d75de63966
065d717cb3375b843498840d709c689ad1e936dc
/1078.cpp
1cd4dffa13abaf24eaaab3fad12163cfb28d09e5
[]
no_license
otifik/algorithm
6060d19f1090fe6a31c1c523e3e31fe3dabd0877
2f5eafd7f8a3099df0add6ce65e36d860c86c73f
refs/heads/master
2023-09-04T23:04:18.537769
2021-10-04T02:03:20
2021-10-04T02:03:20
389,320,303
0
0
null
null
null
null
UTF-8
C++
false
false
872
cpp
#include<iostream> #include<math.h> #include<string.h> using namespace std; int m,n; int num; int hashTable[10010]; bool isPrime(int number){ if(number==1){ return false; } for(int i=2;i<=sqrt(number);i++){ if(number%i==0){ return false; } } return true; } int main(){ memset(hashTable,-1,sizeof(hashTable)); cin>>m>>n; while(!isPrime(m)){ m++; } for(int i=0;i<n;i++){ if(i){ cout<<" "; } cin>>num; int flag=0; int pos; for(int j=0;j<m;j++){ pos = (num+j*j)%m; if(hashTable[pos]==-1){ hashTable[pos]=num; flag=1; break; } } if(!flag){ cout<<"-"; }else { cout<<pos; } } return 0; }
dff589f31fd1dc2bf17c56b0e69c54ed00da431e
3e11dc7aee5b08d296762de34aa56ad628de968f
/sample/SampleBroadcaster-Swift/Pods/boost/boost/unordered/detail/buckets.hpp
85681a685c79a43b20931529d527de1b7309145a
[ "LGPL-2.1-only", "MIT", "BSL-1.0" ]
permissive
ParsifalC/VideoCore
9f6fb03729992022e19b34f22568e1c24819ad01
1ecb3b261e0ad6139e27299d5be459bf91a1a17f
refs/heads/master
2023-05-28T18:53:27.178985
2016-04-27T09:37:23
2016-04-27T09:37:23
57,192,837
0
0
MIT
2023-05-11T02:48:06
2016-04-27T07:24:46
C++
UTF-8
C++
false
false
32,078
hpp
// Copyright (C) 2003-2004 Jeremy B. Maitin-Shepard. // Copyright (C) 2005-2011 Daniel James // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) #ifndef BOOST_UNORDERED_DETAIL_MANAGER_HPP_INCLUDED #define BOOST_UNORDERED_DETAIL_MANAGER_HPP_INCLUDED #if defined(_MSC_VER) && (_MSC_VER >= 1020) # pragma once #endif #include <boost/unordered/detail/util.hpp> #include <boost/unordered/detail/allocate.hpp> #include <boost/type_traits/aligned_storage.hpp> #include <boost/type_traits/alignment_of.hpp> #include <boost/swap.hpp> #include <boost/assert.hpp> #include <boost/limits.hpp> #include <boost/iterator.hpp> #if defined(BOOST_MSVC) #pragma warning(push) #pragma warning(disable:4127) // conditional expression is constant #endif namespace boost { namespace unordered { namespace detail { template <typename Types> struct table; template <typename NodePointer> struct bucket; struct ptr_bucket; template <typename A, typename Bucket, typename Node, typename Policy> struct buckets; template <typename Types> struct table_impl; template <typename Types> struct grouped_table_impl; /////////////////////////////////////////////////////////////////// // // Node construction template <typename NodeAlloc> struct node_constructor { private: typedef NodeAlloc node_allocator; typedef boost::unordered::detail::allocator_traits<NodeAlloc> node_allocator_traits; typedef typename node_allocator_traits::value_type node; typedef typename node_allocator_traits::pointer node_pointer; typedef typename node::value_type value_type; node_allocator& alloc_; node_pointer node_; bool constructed_; public: node_constructor(node_allocator& n) : alloc_(n), node_(), constructed_(false) { } ~node_constructor(); void construct_node(); template <BOOST_UNORDERED_EMPLACE_TEMPLATE> void construct_value(BOOST_UNORDERED_EMPLACE_ARGS) { BOOST_ASSERT(node_ && !constructed_); boost::unordered::detail::construct_node(alloc_, boost::addressof(*node_), BOOST_UNORDERED_EMPLACE_FORWARD); node_->init(static_cast<typename node::link_pointer>(node_)); constructed_ = true; } template <typename A0> void construct_value2(BOOST_FWD_REF(A0) a0) { BOOST_ASSERT(node_ && !constructed_); boost::unordered::detail::construct_node(alloc_, boost::addressof(*node_), BOOST_UNORDERED_EMPLACE_ARGS1(boost::forward<A0>(a0))); constructed_ = true; node_->init(static_cast<typename node::link_pointer>(node_)); } value_type const& value() const { BOOST_ASSERT(node_ && constructed_); return node_->value(); } node_pointer get() { return node_; } // no throw node_pointer release() { node_pointer p = node_; node_ = node_pointer(); return p; } private: node_constructor(node_constructor const&); node_constructor& operator=(node_constructor const&); }; template <typename Alloc> node_constructor<Alloc>::~node_constructor() { if (node_) { if (constructed_) { boost::unordered::detail::destroy_node(alloc_, boost::addressof(*node_)); } node_allocator_traits::deallocate(alloc_, node_, 1); } } template <typename Alloc> void node_constructor<Alloc>::construct_node() { if(!node_) { constructed_ = false; node_ = node_allocator_traits::allocate(alloc_, 1); } else if (constructed_) { boost::unordered::detail::destroy_node(alloc_, boost::addressof(*node_)); constructed_ = false; } } /////////////////////////////////////////////////////////////////// // // Bucket template <typename NodePointer> struct bucket { typedef NodePointer previous_pointer; previous_pointer next_; bucket() : next_() {} previous_pointer first_from_start() { return next_; } enum { extra_node = true }; }; struct ptr_bucket { typedef ptr_bucket* previous_pointer; previous_pointer next_; ptr_bucket() : next_(0) {} previous_pointer first_from_start() { return this; } enum { extra_node = false }; }; template <typename LinkPointer> struct node_base { typedef LinkPointer link_pointer; link_pointer next_; node_base() : next_() {} }; }}} namespace boost { namespace unordered { namespace iterator_detail { //////////////////////////////////////////////////////////////////////////// // Iterators // // all no throw template <typename NodePointer, typename Value> struct iterator; template <typename ConstNodePointer, typename NodePointer, typename Value> struct c_iterator; template <typename NodePointer, typename Value, typename Policy> struct l_iterator; template <typename ConstNodePointer, typename NodePointer, typename Value, typename Policy> struct cl_iterator; // Local Iterators // // all no throw template <typename NodePointer, typename Value, typename Policy> struct l_iterator : public boost::iterator< std::forward_iterator_tag, Value, std::ptrdiff_t, NodePointer, Value&> { #if !defined(BOOST_NO_MEMBER_TEMPLATE_FRIENDS) template <typename ConstNodePointer, typename NodePointer2, typename Value2, typename Policy2> friend struct boost::unordered::iterator_detail::cl_iterator; private: #endif typedef NodePointer node_pointer; typedef boost::unordered::iterator_detail::iterator<NodePointer, Value> iterator; node_pointer ptr_; std::size_t bucket_; std::size_t bucket_count_; public: l_iterator() : ptr_() {} l_iterator(iterator x, std::size_t b, std::size_t c) : ptr_(x.node_), bucket_(b), bucket_count_(c) {} Value& operator*() const { return ptr_->value(); } Value* operator->() const { return ptr_->value_ptr(); } l_iterator& operator++() { ptr_ = static_cast<node_pointer>(ptr_->next_); if (ptr_ && Policy::to_bucket(bucket_count_, ptr_->hash_) != bucket_) ptr_ = node_pointer(); return *this; } l_iterator operator++(int) { l_iterator tmp(*this); ++(*this); return tmp; } bool operator==(l_iterator x) const { return ptr_ == x.ptr_; } bool operator!=(l_iterator x) const { return ptr_ != x.ptr_; } }; template <typename ConstNodePointer, typename NodePointer, typename Value, typename Policy> struct cl_iterator : public boost::iterator< std::forward_iterator_tag, Value, std::ptrdiff_t, ConstNodePointer, Value const&> { friend struct boost::unordered::iterator_detail::l_iterator <NodePointer, Value, Policy>; private: typedef NodePointer node_pointer; typedef boost::unordered::iterator_detail::iterator<NodePointer, Value> iterator; node_pointer ptr_; std::size_t bucket_; std::size_t bucket_count_; public: cl_iterator() : ptr_() {} cl_iterator(iterator x, std::size_t b, std::size_t c) : ptr_(x.node_), bucket_(b), bucket_count_(c) {} cl_iterator(boost::unordered::iterator_detail::l_iterator< NodePointer, Value, Policy> const& x) : ptr_(x.ptr_), bucket_(x.bucket_), bucket_count_(x.bucket_count_) {} Value const& operator*() const { return ptr_->value(); } Value const* operator->() const { return ptr_->value_ptr(); } cl_iterator& operator++() { ptr_ = static_cast<node_pointer>(ptr_->next_); if (ptr_ && Policy::to_bucket(bucket_count_, ptr_->hash_) != bucket_) ptr_ = node_pointer(); return *this; } cl_iterator operator++(int) { cl_iterator tmp(*this); ++(*this); return tmp; } friend bool operator==(cl_iterator const& x, cl_iterator const& y) { return x.ptr_ == y.ptr_; } friend bool operator!=(cl_iterator const& x, cl_iterator const& y) { return x.ptr_ != y.ptr_; } }; template <typename NodePointer, typename Value> struct iterator : public boost::iterator< std::forward_iterator_tag, Value, std::ptrdiff_t, NodePointer, Value&> { #if !defined(BOOST_NO_MEMBER_TEMPLATE_FRIENDS) template <typename, typename, typename> friend struct boost::unordered::iterator_detail::c_iterator; template <typename, typename, typename> friend struct boost::unordered::iterator_detail::l_iterator; template <typename, typename, typename, typename> friend struct boost::unordered::iterator_detail::cl_iterator; template <typename> friend struct boost::unordered::detail::table; template <typename, typename, typename, typename> friend struct boost::unordered::detail::buckets; template <typename> friend struct boost::unordered::detail::table_impl; template <typename> friend struct boost::unordered::detail::grouped_table_impl; private: #endif typedef NodePointer node_pointer; node_pointer node_; public: iterator() : node_() {} explicit iterator(node_pointer const& x) : node_(x) {} Value& operator*() const { return node_->value(); } Value* operator->() const { return &node_->value(); } iterator& operator++() { node_ = static_cast<node_pointer>(node_->next_); return *this; } iterator operator++(int) { iterator tmp(node_); node_ = static_cast<node_pointer>(node_->next_); return tmp; } bool operator==(iterator const& x) const { return node_ == x.node_; } bool operator!=(iterator const& x) const { return node_ != x.node_; } }; template <typename ConstNodePointer, typename NodePointer, typename Value> struct c_iterator : public boost::iterator< std::forward_iterator_tag, Value, std::ptrdiff_t, ConstNodePointer, Value const&> { friend struct boost::unordered::iterator_detail::iterator< NodePointer, Value>; #if !defined(BOOST_NO_MEMBER_TEMPLATE_FRIENDS) template <typename> friend struct boost::unordered::detail::table; template <typename, typename, typename, typename> friend struct boost::unordered::detail::buckets; template <typename> friend struct boost::unordered::detail::table_impl; template <typename> friend struct boost::unordered::detail::grouped_table_impl; private: #endif typedef NodePointer node_pointer; typedef boost::unordered::iterator_detail::iterator<NodePointer, Value> iterator; node_pointer node_; public: c_iterator() : node_() {} explicit c_iterator(node_pointer const& x) : node_(x) {} c_iterator(boost::unordered::iterator_detail::iterator< NodePointer, Value> const& x) : node_(x.node_) {} Value const& operator*() const { return node_->value(); } Value const* operator->() const { return &node_->value(); } c_iterator& operator++() { node_ = static_cast<node_pointer>(node_->next_); return *this; } c_iterator operator++(int) { c_iterator tmp(node_); node_ = static_cast<node_pointer>(node_->next_); return tmp; } friend bool operator==(c_iterator const& x, c_iterator const& y) { return x.node_ == y.node_; } friend bool operator!=(c_iterator const& x, c_iterator const& y) { return x.node_ != y.node_; } }; }}} namespace boost { namespace unordered { namespace detail { /////////////////////////////////////////////////////////////////// // // Hash Policy // // Don't really want buckets to derive from this, but will for now. template <typename SizeT> struct prime_policy { template <typename Hash, typename T> static inline SizeT apply_hash(Hash const& hf, T const& x) { return hf(x); } static inline SizeT to_bucket(SizeT bucket_count, SizeT hash) { return hash % bucket_count; } static inline SizeT new_bucket_count(SizeT min) { return boost::unordered::detail::next_prime(min); } static inline SizeT prev_bucket_count(SizeT max) { return boost::unordered::detail::prev_prime(max); } }; template <typename SizeT> struct mix64_policy { template <typename Hash, typename T> static inline SizeT apply_hash(Hash const& hf, T const& x) { SizeT key = hf(x); key = (~key) + (key << 21); // key = (key << 21) - key - 1; key = key ^ (key >> 24); key = (key + (key << 3)) + (key << 8); // key * 265 key = key ^ (key >> 14); key = (key + (key << 2)) + (key << 4); // key * 21 key = key ^ (key >> 28); key = key + (key << 31); return key; } static inline SizeT to_bucket(SizeT bucket_count, SizeT hash) { return hash & (bucket_count - 1); } static inline SizeT new_bucket_count(SizeT min) { if (min <= 4) return 4; --min; min |= min >> 1; min |= min >> 2; min |= min >> 4; min |= min >> 8; min |= min >> 16; min |= min >> 32; return min + 1; } static inline SizeT prev_bucket_count(SizeT max) { max |= max >> 1; max |= max >> 2; max |= max >> 4; max |= max >> 8; max |= max >> 16; max |= max >> 32; return (max >> 1) + 1; } }; template <int digits, int radix> struct pick_policy_impl { typedef prime_policy<std::size_t> type; }; template <> struct pick_policy_impl<64, 2> { typedef mix64_policy<std::size_t> type; }; struct pick_policy : pick_policy_impl< std::numeric_limits<std::size_t>::digits, std::numeric_limits<std::size_t>::radix> {}; /////////////////////////////////////////////////////////////////// // // Buckets template <typename A, typename Bucket, typename Node, typename Policy> struct buckets : Policy { private: buckets(buckets const&); buckets& operator=(buckets const&); public: typedef boost::unordered::detail::allocator_traits<A> traits; typedef typename traits::value_type value_type; typedef Policy policy; typedef Node node; typedef Bucket bucket; typedef typename boost::unordered::detail::rebind_wrap<A, node>::type node_allocator; typedef typename boost::unordered::detail::rebind_wrap<A, bucket>::type bucket_allocator; typedef boost::unordered::detail::allocator_traits<node_allocator> node_allocator_traits; typedef boost::unordered::detail::allocator_traits<bucket_allocator> bucket_allocator_traits; typedef typename node_allocator_traits::pointer node_pointer; typedef typename node_allocator_traits::const_pointer const_node_pointer; typedef typename bucket_allocator_traits::pointer bucket_pointer; typedef typename bucket::previous_pointer previous_pointer; typedef boost::unordered::detail::node_constructor<node_allocator> node_constructor; typedef boost::unordered::iterator_detail:: iterator<node_pointer, value_type> iterator; typedef boost::unordered::iterator_detail:: c_iterator<const_node_pointer, node_pointer, value_type> c_iterator; typedef boost::unordered::iterator_detail:: l_iterator<node_pointer, value_type, policy> l_iterator; typedef boost::unordered::iterator_detail:: cl_iterator<const_node_pointer, node_pointer, value_type, policy> cl_iterator; // Members bucket_pointer buckets_; std::size_t bucket_count_; std::size_t size_; boost::unordered::detail::compressed<bucket_allocator, node_allocator> allocators_; // Data access bucket_allocator const& bucket_alloc() const { return allocators_.first(); } node_allocator const& node_alloc() const { return allocators_.second(); } bucket_allocator& bucket_alloc() { return allocators_.first(); } node_allocator& node_alloc() { return allocators_.second(); } std::size_t max_bucket_count() const { // -1 to account for the start bucket. return policy::prev_bucket_count( bucket_allocator_traits::max_size(bucket_alloc()) - 1); } bucket_pointer get_bucket(std::size_t bucket_index) const { return buckets_ + static_cast<std::ptrdiff_t>(bucket_index); } previous_pointer get_previous_start() const { return this->get_bucket(this->bucket_count_)->first_from_start(); } previous_pointer get_previous_start(std::size_t bucket_index) const { return this->get_bucket(bucket_index)->next_; } iterator get_start() const { return iterator(static_cast<node_pointer>( this->get_previous_start()->next_)); } iterator get_start(std::size_t bucket_index) const { previous_pointer prev = this->get_previous_start(bucket_index); return prev ? iterator(static_cast<node_pointer>(prev->next_)) : iterator(); } float load_factor() const { BOOST_ASSERT(this->bucket_count_ != 0); return static_cast<float>(this->size_) / static_cast<float>(this->bucket_count_); } std::size_t bucket_size(std::size_t index) const { if (!this->size_) return 0; iterator it = this->get_start(index); if (!it.node_) return 0; std::size_t count = 0; while(it.node_ && policy::to_bucket( this->bucket_count_, it.node_->hash_) == index) { ++count; ++it; } return count; } //////////////////////////////////////////////////////////////////////// // Constructors buckets(node_allocator const& a, std::size_t bucket_count) : buckets_(), bucket_count_(bucket_count), size_(), allocators_(a,a) { } buckets(buckets& b, boost::unordered::detail::move_tag m) : buckets_(), bucket_count_(b.bucket_count_), size_(), allocators_(b.allocators_, m) { swap(b); } template <typename Types> buckets(boost::unordered::detail::table<Types>& x, boost::unordered::detail::move_tag m) : buckets_(), bucket_count_(x.bucket_count_), size_(), allocators_(x.allocators_, m) { swap(x); } //////////////////////////////////////////////////////////////////////// // Create buckets // (never called in constructor to avoid exception issues) void create_buckets() { boost::unordered::detail::array_constructor<bucket_allocator> constructor(bucket_alloc()); // Creates an extra bucket to act as the start node. constructor.construct(bucket(), this->bucket_count_ + 1); if (bucket::extra_node) { node_constructor a(this->node_alloc()); a.construct_node(); // Since this node is just to mark the beginning it doesn't // contain a value, so just construct node::node_base // which containers the pointer to the next element. node_allocator_traits::construct(node_alloc(), static_cast<typename node::node_base*>( boost::addressof(*a.get())), typename node::node_base()); (constructor.get() + static_cast<std::ptrdiff_t>(this->bucket_count_))->next_ = a.release(); } this->buckets_ = constructor.release(); } //////////////////////////////////////////////////////////////////////// // Swap and Move void swap(buckets& other, false_type = false_type()) { BOOST_ASSERT(node_alloc() == other.node_alloc()); boost::swap(buckets_, other.buckets_); boost::swap(bucket_count_, other.bucket_count_); boost::swap(size_, other.size_); } void swap(buckets& other, true_type) { allocators_.swap(other.allocators_); boost::swap(buckets_, other.buckets_); boost::swap(bucket_count_, other.bucket_count_); boost::swap(size_, other.size_); } void move_buckets_from(buckets& other) { BOOST_ASSERT(node_alloc() == other.node_alloc()); BOOST_ASSERT(!this->buckets_); this->buckets_ = other.buckets_; this->bucket_count_ = other.bucket_count_; this->size_ = other.size_; other.buckets_ = bucket_pointer(); other.bucket_count_ = 0; other.size_ = 0; } //////////////////////////////////////////////////////////////////////// // Delete/destruct inline void delete_node(c_iterator n) { boost::unordered::detail::destroy_node( node_alloc(), boost::addressof(*n.node_)); node_allocator_traits::deallocate(node_alloc(), n.node_, 1); --size_; } std::size_t delete_nodes(c_iterator begin, c_iterator end) { std::size_t count = 0; while(begin != end) { c_iterator n = begin; ++begin; delete_node(n); ++count; } return count; } inline void delete_extra_node(bucket_pointer) {} inline void delete_extra_node(node_pointer n) { node_allocator_traits::destroy(node_alloc(), static_cast<typename node::node_base*>(boost::addressof(*n))); node_allocator_traits::deallocate(node_alloc(), n, 1); } inline ~buckets() { this->delete_buckets(); } void delete_buckets() { if(this->buckets_) { previous_pointer prev = this->get_previous_start(); while(prev->next_) { node_pointer n = static_cast<node_pointer>(prev->next_); prev->next_ = n->next_; delete_node(iterator(n)); } delete_extra_node(prev); bucket_pointer end = this->get_bucket(this->bucket_count_ + 1); for(bucket_pointer it = this->buckets_; it != end; ++it) { bucket_allocator_traits::destroy(bucket_alloc(), boost::addressof(*it)); } bucket_allocator_traits::deallocate(bucket_alloc(), this->buckets_, this->bucket_count_ + 1); this->buckets_ = bucket_pointer(); } BOOST_ASSERT(!this->size_); } void clear() { if(!this->size_) return; previous_pointer prev = this->get_previous_start(); while(prev->next_) { node_pointer n = static_cast<node_pointer>(prev->next_); prev->next_ = n->next_; delete_node(iterator(n)); } bucket_pointer end = this->get_bucket(this->bucket_count_); for(bucket_pointer it = this->buckets_; it != end; ++it) { it->next_ = node_pointer(); } BOOST_ASSERT(!this->size_); } // This is called after erasing a node or group of nodes to fix up // the bucket pointers. void fix_buckets(bucket_pointer this_bucket, previous_pointer prev, node_pointer next) { if (!next) { if (this_bucket->next_ == prev) this_bucket->next_ = node_pointer(); } else { bucket_pointer next_bucket = this->get_bucket( policy::to_bucket(this->bucket_count_, next->hash_)); if (next_bucket != this_bucket) { next_bucket->next_ = prev; if (this_bucket->next_ == prev) this_bucket->next_ = node_pointer(); } } } // This is called after erasing a range of nodes to fix any bucket // pointers into that range. void fix_buckets_range(std::size_t bucket_index, previous_pointer prev, node_pointer begin, node_pointer end) { node_pointer n = begin; // If we're not at the start of the current bucket, then // go to the start of the next bucket. if (this->get_bucket(bucket_index)->next_ != prev) { for(;;) { n = static_cast<node_pointer>(n->next_); if (n == end) return; std::size_t new_bucket_index = policy::to_bucket(this->bucket_count_, n->hash_); if (bucket_index != new_bucket_index) { bucket_index = new_bucket_index; break; } } } // Iterate through the remaining nodes, clearing out the bucket // pointers. this->get_bucket(bucket_index)->next_ = previous_pointer(); for(;;) { n = static_cast<node_pointer>(n->next_); if (n == end) break; std::size_t new_bucket_index = policy::to_bucket(this->bucket_count_, n->hash_); if (bucket_index != new_bucket_index) { bucket_index = new_bucket_index; this->get_bucket(bucket_index)->next_ = previous_pointer(); } }; // Finally fix the bucket containing the trailing node. if (n) { this->get_bucket( policy::to_bucket(this->bucket_count_, n->hash_))->next_ = prev; } } }; //////////////////////////////////////////////////////////////////////////// // Functions // Assigning and swapping the equality and hash function objects // needs strong exception safety. To implement that normally we'd // require one of them to be known to not throw and the other to // guarantee strong exception safety. Unfortunately they both only // have basic exception safety. So to acheive strong exception // safety we have storage space for two copies, and assign the new // copies to the unused space. Then switch to using that to use // them. This is implemented in 'set_hash_functions' which // atomically assigns the new function objects in a strongly // exception safe manner. template <class H, class P> class set_hash_functions; template <class H, class P> class functions { friend class boost::unordered::detail::set_hash_functions<H, P>; functions& operator=(functions const&); typedef compressed<H, P> function_pair; typedef typename boost::aligned_storage< sizeof(function_pair), boost::alignment_of<function_pair>::value>::type aligned_function; bool current_; // The currently active functions. aligned_function funcs_[2]; function_pair const& current() const { return *static_cast<function_pair const*>( static_cast<void const*>(&funcs_[current_])); } void construct(bool which, H const& hf, P const& eq) { new((void*) &funcs_[which]) function_pair(hf, eq); } void construct(bool which, function_pair const& f) { new((void*) &funcs_[which]) function_pair(f); } void destroy(bool which) { boost::unordered::detail::destroy((function_pair*)(&funcs_[which])); } public: functions(H const& hf, P const& eq) : current_(false) { construct(current_, hf, eq); } functions(functions const& bf) : current_(false) { construct(current_, bf.current()); } ~functions() { this->destroy(current_); } H const& hash_function() const { return current().first(); } P const& key_eq() const { return current().second(); } }; template <class H, class P> class set_hash_functions { set_hash_functions(set_hash_functions const&); set_hash_functions& operator=(set_hash_functions const&); functions<H,P>& functions_; bool tmp_functions_; public: set_hash_functions(functions<H,P>& f, H const& h, P const& p) : functions_(f), tmp_functions_(!f.current_) { f.construct(tmp_functions_, h, p); } set_hash_functions(functions<H,P>& f, functions<H,P> const& other) : functions_(f), tmp_functions_(!f.current_) { f.construct(tmp_functions_, other.current()); } ~set_hash_functions() { functions_.destroy(tmp_functions_); } void commit() { functions_.current_ = tmp_functions_; tmp_functions_ = !tmp_functions_; } }; }}} #if defined(BOOST_MSVC) #pragma warning(pop) #endif #endif
14ce8ca45cb2eeb7976938b9c50fff3d1cf6ccc4
ce702eb37c0bde25c461deddaef7030188ce9a26
/src/compass-rccars-daq-DIALOGCommunication/messagecontainer.cpp
60b569f6f5f4df190be54202d51ba36ae2d68d13
[]
no_license
lemochus1/DIALOG
f43c4fd3ebf1cebdb13a65cef367b1c3371d2644
f67782ef756e296148e97e81ab75866e6246369b
refs/heads/master
2022-12-17T05:59:15.137798
2020-08-29T14:23:55
2020-08-29T14:23:55
284,671,166
0
0
null
null
null
null
UTF-8
C++
false
false
886
cpp
#include "messagecontainer.h" MessageContainer::MessageContainer(QByteArray* headerInit, QByteArray* messageInit, quint32 messageCounterInit) { header = headerInit; message = messageInit; messageCounter = messageCounterInit; } MessageContainer::~MessageContainer() { if (message) delete message; } QByteArray* MessageContainer::getHeader() { return header; } QByteArray* MessageContainer::getMessage() { return message; } quint32 MessageContainer::deleteMessage() { if (messageCounter > 0) messageCounter--; return messageCounter; } quint32 MessageContainer::getSize() { quint32 messageSize = 0; if (header) { messageSize += header->size(); } if (message) { messageSize += message->size(); } return messageSize; }
24740dddacc9a8736d398c509c3821a414d8bc30
617228d1459396a87c3032c34c8f3059cabaea80
/yassine's work/pack.cpp
b8b2f6fecdeb727189135ba6a7ef2efeff715613
[]
no_license
syrine20/Smart_Wedding_Reception_2A11
807f078ab64408dd251bf2891fa318e35c6279d8
893e721fb119029065e66de0de169c437314a24a
refs/heads/master
2023-02-13T14:28:32.591018
2021-01-06T12:39:22
2021-01-06T12:39:22
316,333,230
0
4
null
2021-01-06T12:39:23
2020-11-26T20:44:08
C++
UTF-8
C++
false
false
4,039
cpp
#include "pack.h" #include <QMessageBox> #include "QSqlQueryModel" #include "mainwindow.h" pack::pack() { } pack::pack(int iP ,QString c,QString l,int prix_i) { id_pack= iP; categorie= c; liste= l; prix_initial= prix_i; } bool pack::ajouter() { QSqlQuery query; query.prepare("INSERT INTO pack (id_pack,categorie,liste,prix_initial) VALUES(:id_pack,:categorie,:liste,:prix_initial) "); QString r= QString::number(id_pack); QString f= QString::number(prix_initial); query.bindValue(":id_pack",id_pack); query.bindValue(":categorie",categorie); query.bindValue(":liste",liste); query.bindValue(":prix_initial",prix_initial); return query.exec(); } QSqlQueryModel * pack::afficher() {QSqlQueryModel * model= new QSqlQueryModel(); model->setQuery("select * from pack"); model->setHeaderData(0, Qt::Horizontal, QObject::tr("id_pack")); model->setHeaderData(1, Qt::Horizontal, QObject::tr("categorie")); model->setHeaderData(2, Qt::Horizontal, QObject::tr("liste")); model->setHeaderData(3, Qt::Horizontal, QObject::tr("prix_initial")); return model; } bool pack::supprimer(QString id_pack){ QSqlQuery query; query.prepare("delete from pack where id_pack = :id_pack"); query.bindValue(":id_pack",id_pack); return query.exec(); } bool pack::modifier(int id_pack) { QSqlQuery query ; ////////// query.prepare("update pack set categorie= :categorie ,liste= :liste, prix_initial= :prix_initial where id_pack = :id_pack"); query.bindValue(":id_pack",id_pack); query.bindValue(":categorie",categorie); query.bindValue(":liste", liste); query.bindValue(":prix_initial",prix_initial); return query.exec(); } void pack::recherche(Ui::Dialog *ui) { QSqlQuery q; QSqlQueryModel *modal=new QSqlQueryModel(); QString mot =ui->lineEdit_rechercher_packs_consulter->text(); q.prepare("select * from pack where (id_pack LIKE '%"+mot+"%' or prix_initial LIKE '%"+mot+"%' or categorie LIKE '%"+mot+"%' or liste LIKE '%"+mot+"%')"); q.exec() ; modal->setQuery(q); ui->tableView_packs_consulter->setModel(modal); } void pack::TRI_ID(Ui::Dialog *ui) { QSqlQuery q; QSqlQueryModel *model=new QSqlQueryModel(); q.prepare("select * from pack order by id_pack"); q.exec(); model->setQuery(q); ui->tableView_packs_consulter->setModel(model); } QSqlQueryModel *pack::tri_IDinv() { QSqlQuery * q = new QSqlQuery (); QSqlQueryModel * model = new QSqlQueryModel (); q->prepare("SELECT * FROM pack order by id_pack DESC"); q->exec(); model->setQuery(*q); return model; } void pack::TRI_Categorie(Ui::Dialog *ui) { QSqlQuery q; QSqlQueryModel *model=new QSqlQueryModel(); q.prepare("select * from pack order by categorie"); q.exec(); model->setQuery(q); ui->tableView_packs_consulter->setModel(model); } QSqlQueryModel *pack::tri_Categorieinv() { QSqlQuery * q = new QSqlQuery (); QSqlQueryModel * model = new QSqlQueryModel (); q->prepare("SELECT * FROM pack order by categorie DESC"); q->exec(); model->setQuery(*q); return model; } void pack::TRI_Prix(Ui::Dialog *ui) { QSqlQuery q; QSqlQueryModel *model=new QSqlQueryModel(); q.prepare("select * from pack order by prix_initial"); q.exec(); model->setQuery(q); ui->tableView_packs_consulter->setModel(model); } QSqlQueryModel *pack::tri_prixinv() { QSqlQuery * q = new QSqlQuery (); QSqlQueryModel * model = new QSqlQueryModel (); q->prepare("SELECT * FROM pack order by prix_initial DESC"); q->exec(); model->setQuery(*q); return model; }
19b33166ff009b79d6cd7452e5c0877bc1c9828d
b89ab9485b8714676b13fc73eb30993c998695f5
/LinkedList/triangular.cpp
8086abe76924dc6371a06235b97f71b73a018bf2
[]
no_license
suman2826/Building_BLocks_of_Competitive
8a96dbc3c405870fa84f7d877c9cd91585464443
17b47fc8640d0912e5406de5d16ccc9c7fcb9fd3
refs/heads/master
2022-11-27T04:23:36.863788
2020-08-01T14:11:12
2020-08-01T14:11:12
254,287,953
0
0
null
null
null
null
UTF-8
C++
false
false
252
cpp
#include<stdio.h> #include<iostream> using namespace std; int main() { printf("Enter the coordinates: "); int x,y,i,res=0; scanf("%d%d",&x,&y); res = (x*(x+1))/2; for(i = 1;i<y;i++) { res = res + x; x = x+1; } printf("Result: %d",res); }
75e78146731ecf18bb01c79aa1a073cccd98587e
ad3c7df40bd2b8a1dbbcfe91f4505b000cdf20f6
/实验代码/2-test.cpp
3c2c495d7ba9a9384723ef5dfb0e941c847fa6c5
[ "MIT" ]
permissive
weishuo2/Algorithms_base
cc96abc29edf2928db2932e53c1921cdb0f0a5b3
b413060b740958b809e44a48c0cea10a3e348bca
refs/heads/master
2020-03-06T18:31:28.629925
2018-03-27T15:35:27
2018-03-27T15:35:27
127,008,790
0
0
null
null
null
null
GB18030
C++
false
false
6,633
cpp
#include <iostream> #include <string> using namespace std; inline int compare(string str1,string str2) {//相等返回0,大于返回1,小于返回-1 if (str1.size()>str2.size()) return 1; //长度长的整数大于长度小的整数 else if (str1.size()<str2.size()) return -1; else return str1.compare(str2); //若长度相等,则头到尾按位比较 } string SUB_INT(string str1,string str2); string ADD_INT(string str1,string str2) {//高精度加法 int sign=1; //sign 为符号位 string str; if (str1[0]=='-') { if (str2[0]=='-') { sign=-1; str=ADD_INT(str1.erase(0,1),str2.erase(0,1)); } else { str=SUB_INT(str2,str1.erase(0,1)); } } else { if (str2[0]=='-') { str=SUB_INT(str1,str2.erase(0,1)); } else { //把两个整数对齐,短整数前面加0补齐 string::size_type L1,L2; int i; L1=str1.size(); L2=str2.size(); if (L1<L2) { for (i=1;i<=L2-L1;i++) str1="0"+str1; } else { for (i=1;i<=L1-L2;i++) str2="0"+str2; } int int1=0,int2=0; //int2 记录进位 for (i=str1.size()-1;i>=0;i--) { int1=(int(str1[i])-'0'+int(str2[i])-'0'+int2)%10; int2=(int(str1[i])-'0'+int(str2[i])-'0'+int2)/10; str=char(int1+'0')+str; } if (int2!=0) str=char(int2+'0')+str; } } //运算后处理符号位 if ((sign==-1)&&(str[0]!='0')) str="-"+str; return str; } string SUB_INT(string str1,string str2) {//高精度减法 int sign=1; //sign 为符号位 string str; int i,j; if (str2[0]=='-') { str=ADD_INT(str1,str2.erase(0,1)); } else { int res=compare(str1,str2); if (res==0) return "0"; if (res<0) { sign=-1; string temp =str1; str1=str2; str2=temp; } string::size_type tempint; tempint=str1.size()-str2.size(); for (i=str2.size()-1;i>=0;i--) { if (str1[i+tempint]<str2[i]) { j=1; while (1) {//zhao4zhong1添加 if (str1[i+tempint-j]=='0') { str1[i+tempint-j]='9'; j++; } else { str1[i+tempint-j]=char(int(str1[i+tempint-j])-1); break; } } str=char(str1[i+tempint]-str2[i]+':')+str; } else { str=char(str1[i+tempint]-str2[i]+'0')+str; } } for (i=tempint-1;i>=0;i--) str=str1[i]+str; } //去除结果中多余的前导0 str.erase(0,str.find_first_not_of('0')); if (str.empty()) str="0"; if ((sign==-1) && (str[0]!='0')) str ="-"+str; return str; } string MUL_INT(string str1,string str2) {//高精度乘法 int sign=1; //sign 为符号位 string str; if (str1[0]=='-') { sign*=-1; str1 =str1.erase(0,1); } if (str2[0]=='-') { sign*=-1; str2 =str2.erase(0,1); } int i,j; string::size_type L1,L2; L1=str1.size(); L2=str2.size(); for (i=L2-1;i>=0;i--) { //模拟手工乘法竖式 string tempstr; int int1=0,int2=0,int3=int(str2[i])-'0'; if (int3!=0) { for (j=1;j<=(int)(L2-1-i);j++) tempstr="0"+tempstr; for (j=L1-1;j>=0;j--) { int1=(int3*(int(str1[j])-'0')+int2)%10; int2=(int3*(int(str1[j])-'0')+int2)/10; tempstr=char(int1+'0')+tempstr; } if (int2!=0) tempstr=char(int2+'0')+tempstr; } str=ADD_INT(str,tempstr); } //去除结果中的前导0 str.erase(0,str.find_first_not_of('0')); if (str.empty()) str="0"; if ((sign==-1) && (str[0]!='0')) str="-"+str; return str; } string DIVIDE_INT(string str1,string str2,int flag) {//高精度除法。flag==1时,返回商; flag==0时,返回余数 string quotient,residue; //定义商和余数 int sign1=1,sign2=1; if (str2 == "0") { //判断除数是否为0 quotient= "ERROR!"; residue = "ERROR!"; if (flag==1) return quotient; else return residue ; } if (str1=="0") { //判断被除数是否为0 quotient="0"; residue ="0"; } if (str1[0]=='-') { str1 = str1.erase(0,1); sign1 *= -1; sign2 = -1; } if (str2[0]=='-') { str2 = str2.erase(0,1); sign1 *= -1; } int res=compare(str1,str2); if (res<0) { quotient="0"; residue =str1; } else if (res == 0) { quotient="1"; residue ="0"; } else { string::size_type L1,L2; L1=str1.size(); L2=str2.size(); string tempstr; tempstr.append(str1,0,L2-1); for (int i=L2-1;i<L1;i++) { //模拟手工除法竖式 tempstr=tempstr+str1[i]; tempstr.erase(0,tempstr.find_first_not_of('0'));//zhao4zhong1添加 if (tempstr.empty()) tempstr="0";//zhao4zhong1添加 for (char ch='9';ch>='0';ch--) { //试商 string str; str=str+ch; if (compare(MUL_INT(str2,str),tempstr)<=0) { quotient=quotient+ch; tempstr =SUB_INT(tempstr,MUL_INT(str2,str)); break; } } } residue=tempstr; } //去除结果中的前导0 quotient.erase(0,quotient.find_first_not_of('0')); if (quotient.empty()) quotient="0"; if ((sign1==-1)&&(quotient[0]!='0')) quotient="-"+quotient; if ((sign2==-1)&&(residue [0]!='0')) residue ="-"+residue ; if (flag==1) return quotient; else return residue ; } string DIV_INT(string str1,string str2) {//高精度除法,返回商 return DIVIDE_INT(str1,str2,1); } string MOD_INT(string str1,string str2) {//高精度除法,返回余数 return DIVIDE_INT(str1,str2,0); } int main() { char ch; string s1,s2,res; while (cin>>s1>>ch>>s2) { switch (ch) { case '+':res=ADD_INT(s1,s2);break; case '-':res=SUB_INT(s1,s2);break; case '*':res=MUL_INT(s1,s2);break; case '/':res=DIV_INT(s1,s2);break; case '%':res=MOD_INT(s1,s2);break; default : break; } cout<<res<<endl; } return(0); }
605e9837d9fcfe7f8be0682fe8c1020bb291549b
770ac2dd33e1a0c8030be06cfcb26a6d89a3f01f
/lab 4/prob1/stack.cpp
0f9d21b3835fe3b11ca62d8909cdf6b14ca9e820
[]
no_license
yashvanjani/MA253-Data-Structures-Lab
837edcad40687dfb98c9ae60a1009fc8eea30a22
e2ab6d328a0089b5ade9118e4589f6e72037140a
refs/heads/master
2021-01-21T12:59:07.311927
2016-04-16T17:50:37
2016-04-16T17:50:37
54,201,834
0
0
null
null
null
null
UTF-8
C++
false
false
538
cpp
#include "stack.h" //Define all the member functions (except show()) of class 'stack' // which are declared in header file 'stack.h' // write your code here stack::stack(int size) { MAX = size; s = new int[MAX]; top=-1; } stack::~stack(void) { delete[] s; } void stack::push(int a) { top++; s[top]=a; } int stack::pop(void) { int t =s[top]; top--; return t; } bool stack::isempty(void) { if(top==-1) return true; else return false; } bool stack::isfull(void) { if(top==MAX-1) return true; else return false; }
24338454a8a9051fe4d7bca5a6d7fe4e196e0228
a9ad2bc73324cdf48010e0ebfdad08c4eeea5bca
/DevTools/UserspaceEmulator/Region.h
b75f37f5177f7c6ce6d105e2706a4acf6809d03b
[ "BSD-2-Clause" ]
permissive
asliturk/serenity
8fa0489d3327789da8488de39058360c056bb49a
fc75421d50b2e149c9aa7d59f81b41178b192b34
refs/heads/master
2021-07-19T05:46:51.465569
2021-01-01T01:19:45
2021-01-01T01:19:45
223,545,030
1
0
BSD-2-Clause
2019-11-23T06:50:43
2019-11-23T06:50:42
null
UTF-8
C++
false
false
3,395
h
/* * Copyright (c) 2020, Andreas Kling <[email protected]> * 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. */ #pragma once #include "ValueWithShadow.h" #include <AK/Types.h> namespace UserspaceEmulator { class Emulator; class Region { public: virtual ~Region() { } u32 base() const { return m_base; } u32 size() const { return m_size; } u32 end() const { return m_base + m_size; } bool contains(u32 address) const { return address >= base() && address < end(); } virtual void write8(u32 offset, ValueWithShadow<u8>) = 0; virtual void write16(u32 offset, ValueWithShadow<u16>) = 0; virtual void write32(u32 offset, ValueWithShadow<u32>) = 0; virtual void write64(u32 offset, ValueWithShadow<u64>) = 0; virtual ValueWithShadow<u8> read8(u32 offset) = 0; virtual ValueWithShadow<u16> read16(u32 offset) = 0; virtual ValueWithShadow<u32> read32(u32 offset) = 0; virtual ValueWithShadow<u64> read64(u32 offset) = 0; virtual u8* cacheable_ptr([[maybe_unused]] u32 offset) { return nullptr; } virtual bool is_shared_buffer() const { return false; } virtual bool is_mmap() const { return false; } bool is_stack() const { return m_stack; } void set_stack(bool b) { m_stack = b; } bool is_text() const { return m_text; } void set_text(bool b) { m_text = b; } bool is_readable() const { return m_readable; } bool is_writable() const { return m_writable; } bool is_executable() const { return m_executable; } void set_readable(bool b) { m_readable = b; } void set_writable(bool b) { m_writable = b; } void set_executable(bool b) { m_executable = b; } virtual u8* data() = 0; virtual u8* shadow_data() = 0; Emulator& emulator() { return m_emulator; } const Emulator& emulator() const { return m_emulator; } protected: Region(u32 base, u32 size); private: Emulator& m_emulator; u32 m_base { 0 }; u32 m_size { 0 }; bool m_stack { false }; bool m_text { false }; bool m_readable { true }; bool m_writable { true }; bool m_executable { true }; }; }
08f7482e2d4f336512d4876a01c9c91a7e106d02
75f26ed9dd20e44f6998a19d3cd46359f5e61a93
/City.h
1bce28adf24ece3a5269e07a4fc9f03418a38fd3
[]
no_license
Dawlatly/My-World-Guide
8f14578b4b298b9eb053056b82c34884612a91ce
4c57576747e514674fa9b267ac0f883ff0d2fb61
refs/heads/master
2021-04-29T01:25:43.703083
2017-01-01T13:51:11
2017-01-01T13:51:11
77,780,492
0
0
null
null
null
null
UTF-8
C++
false
false
1,009
h
/************************************* Program: My_World_Guide.cpp Course: OOPDS Year: 2015/16 Trimester 2 Name: Mahmoud Abdelazim Ali Eldewaletly ID: 1132702480 Lecture: TC01 Lab: TT02 Email: [email protected] Phone: 013-2184233 *************************************/ #ifndef __TT02_M1_MahmoudAbdelazimAli__City__ #define __TT02_M1_MahmoudAbdelazimAli__City__ #include <stdio.h> #include <string> #include "Attraction.h" #include "Sport.h" #include "Culture.h" #include "Nightlife.h" #include <vector> #include "LinkedList.h" using namespace std; class City { int id; string name; LinkedList<Culture>* C; LinkedList<Sport>* S; LinkedList<Nightlife>* N; public: City(int id, string name): id(id), name(name){}; string getName(); int getID(); void setAttractions(LinkedList<Culture>& Cl,LinkedList<Sport>& Sp,LinkedList<Nightlife>& Nl); void setName(string name); }; #endif /* defined(__TT02_M1_MahmoudAbdelazimAli__City__) */
4dfdf957805a9cfb87f90f673cf2cf19172ed0c7
595c2ee187afe3df148124d4ccde0e84ec362c4c
/runH.cc
3959ebf2b586fe42470bd7b49005a5173cf1ceac
[]
no_license
ursl/h0
91850883e5b53898cc33630a9e252995f41e8f91
71a8fd73ba89bb355be07ece6d0cf0b251b5b86c
refs/heads/master
2016-09-06T15:46:03.442711
2015-10-16T11:56:55
2015-10-16T11:56:55
21,931,700
0
0
null
null
null
null
UTF-8
C++
false
false
7,243
cc
#include <iostream> #include <fstream> #include <iomanip> #include <cstdlib> #include <math.h> #include "TROOT.h" #include "TRint.h" #include "TChain.h" #include "TFile.h" #include "TDirectory.h" #include "TString.h" #include "TRandom.h" #include "TUnixSystem.h" #include "anaH.hh" using namespace std; // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // %% Usage: ./runH -f test.root // %% ./runH -c chains/bg-test -D root // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% int main(int argc, char *argv[]) { int processID = gSystem->GetPid(); cout << "Running under process ID " << processID << endl; string progName = argv[0]; string writeName, fileName, jsonName; int file(0), json(0); int dirspec(0); int nevents(-1), start(-1); int randomSeed(processID); int verbose(-99); int blind(1); int isMC(0); int year(0); // Change the MaxTreeSize to 100 GB (default since root v5.26) TTree::SetMaxTreeSize(100000000000ll); // 100 GB // -- Some defaults string dirBase("./"); // this could point to "/home/ursl/data/root/." string dirName("."); dirspec = 0; // and this to, e.g. "bmm", "bee", "bem", ... string cutFile("default.cuts"); string treeName("Delphes"); string readerName("bmmReader"); TString histfile(""); // -- command line arguments for (int i = 0; i < argc; i++){ if (!strcmp(argv[i],"-h")) { cout << "List of arguments:" << endl; cout << "-b {0,1} run blind?" << endl; cout << "-c filename chain definition file" << endl; cout << "-C filename file with cuts" << endl; cout << "-D path where to put the output" << endl; cout << "-f filename single file instead of chain" << endl; cout << "-m use MC information" << endl; cout << "-n integer number of events to run on" << endl; cout << "-r class name which tree reader class to run" << endl; cout << "-s number seed for random number generator" << endl; cout << "-S start starting event number" << endl; cout << "-o filename set output file" << endl; cout << "-v level set verbosity level" << endl; cout << "-y year set year" << endl; cout << "-h prints this message and exits" << endl; return 0; } if (!strcmp(argv[i],"-b")) {blind = atoi(argv[++i]); } // run blind? if (!strcmp(argv[i],"-c")) {fileName = string(argv[++i]); file = 0; } // file with chain definition if (!strcmp(argv[i],"-C")) {cutFile = string(argv[++i]); } // file with cuts if (!strcmp(argv[i],"-D")) {dirName = string(argv[++i]); dirspec = 1; } // where to put the output if (!strcmp(argv[i],"-f")) {fileName = string(argv[++i]); file = 1; } // single file instead of chain if (!strcmp(argv[i],"-j")) {jsonName = string(argv[++i]); json = 1; } // single file instead of chain if (!strcmp(argv[i],"-m")) {isMC = 1; } // use MC information? if (!strcmp(argv[i],"-n")) {nevents = atoi(argv[++i]); } // number of events to run if (!strcmp(argv[i],"-r")) {readerName = string(argv[++i]); } // which tree reader class to run if (!strcmp(argv[i],"-s")) {randomSeed = atoi(argv[++i]); } // set seed for random gen. if (!strcmp(argv[i],"-S")) {start = atoi(argv[++i]); } // set start event number if (!strcmp(argv[i],"-o")) {histfile = TString(argv[++i]); } // set output file if (!strcmp(argv[i],"-v")) {verbose = atoi(argv[++i]); } // set verbosity level if (!strcmp(argv[i],"-y")) {year = atoi(argv[++i]); } // set year } // -- Prepare histfilename variation with (part of) cut file name TString fn(cutFile); fn.ReplaceAll("cuts/", ""); fn.ReplaceAll(".cuts", ""); fn.ReplaceAll("tree", ""); // -- Determine filename for output histograms and 'final' small/reduced tree TString meta = fileName; if(histfile == "") { TString barefile(fileName), chainFile, meta; if (file == 0) { // -- input from chain if (barefile.Contains("chains/")) { barefile.ReplaceAll("chains/", ""); histfile = barefile + "." + fn + ".root"; if (dirspec) { if (dirName[0] == '/') { histfile = dirName + "/" + histfile; } else { histfile = dirBase + "/" + dirName + "/" + histfile; } } } else { histfile = barefile + "." + fn + ".root"; if (dirspec) { if (dirName[0] == '/') { histfile = dirName + "/" + histfile; } else { histfile = dirBase + "/" + dirName + "/" + histfile; } } } // -- The following lines strip everything from the string up to and including the last '/' int fl = barefile.Last('/'); TString bla(barefile); bla.Replace(0, fl+1, ' '); bla.Strip(TString::kLeading, ' '); bla.Remove(0,1); histfile = bla + "." + fn + ".root"; if (dirspec) { histfile = dirBase + "/" + dirName + "/" + histfile; } } else if (file == 1) { // -- single file input // -- The following lines strip everything from the string up to and including the last '/' int fl = barefile.Last('/'); TString bla(barefile); bla.Replace(0, fl+1, ' '); bla.Strip(TString::kLeading, ' '); bla.Remove(0,1); histfile = bla; histfile.ReplaceAll(".root", ""); histfile += "." + fn + ".root"; if (dirspec) { if (dirName[0] == '/') { histfile = dirName + "/" + histfile; } else { histfile = dirBase + "/" + dirName + "/" + histfile; } } } } cout << "Opening " << histfile.Data() << " for output histograms" << endl; cout << "Opening " << fileName.c_str() << " for input" << endl; // -- Set up chain TChain *chain = new TChain(TString(treeName)); cout << "Chaining ... " << treeName << endl; char pName[2000]; int nentries; if (file == 0) { // -- non-trivial chain input ifstream is(meta); while(meta.ReadLine(is) && (!meta.IsNull())){ nentries = -1; if (meta.Data()[0] == '#') continue; sscanf(meta.Data(), "%s %d", pName, &nentries); if (nentries > -1) { cout << pName << " -> " << nentries << " entries" << endl; chain->Add(pName, nentries); } else { cout << meta << endl; chain->Add(meta); } } is.close(); } else if (file == 1) { // -- single file input cout << fileName << endl; chain->Add(TString(fileName)); } anaH *a = new anaH(chain); if (a) { string shistfile = histfile.Data(); a->openHistFile(shistfile); a->bookHist(); a->startAnalysis(); a->loop(nevents, start); a->endAnalysis(); a->closeHistFile(); } else cerr << "Readerclass '" << readerName << "' not found" << endl; delete a; // so we can dump some information in the destructor return 0; }
ac68b3bade81528e56492141f1ff1fd5429e0021
2db38ac67db7bce85060328b5cacbeb3bd730d7b
/GEM/include/GEMEventActionMessenger.hh
bc7ed96b3c516c7ec3754d5ee3db8f8b7f8c6fa8
[]
no_license
icpark00/GEM
5af9de14f38be8952183c8d2d826239bcf4e6aca
4b15fd3620995b195aef0bb7f2adaa3f4806acb8
refs/heads/master
2021-01-15T03:45:36.325546
2013-11-13T08:11:14
2013-11-13T08:11:14
null
0
0
null
null
null
null
UTF-8
C++
false
false
2,369
hh
// // ******************************************************************** // * License and Disclaimer * // * * // * The Geant4 software is copyright of the Copyright Holders of * // * the Geant4 Collaboration. It is provided under the terms and * // * conditions of the Geant4 Software License, included in the file * // * LICENSE and available at http://cern.ch/geant4/license . These * // * include a list of copyright holders. * // * * // * Neither the authors of this software system, nor their employing * // * institutes,nor the agencies providing financial support for this * // * work make any representation or warranty, express or implied, * // * regarding this software system or assume any liability for its * // * use. Please see the license in the file LICENSE and URL above * // * for the full disclaimer and the limitation of liability. * // * * // * This code implementation is the result of the scientific and * // * technical work of the GEANT4 collaboration. * // * By using, copying, modifying or distributing the software (or * // * any work based on the software) you agree to acknowledge its * // * use in resulting scientific publications, and indicate your * // * acceptance of all terms of the Geant4 Software license. * // ******************************************************************** // // $Id: GEMEventActionMessenger.hh,v 1.6 2006-06-29 16:31:06 gunter Exp $ // -------------------------------------------------------------- // #ifndef GEMEventActionMessenger_h #define GEMEventActionMessenger_h 1 class GEMEventAction; class G4UIcmdWithAnInteger; #include "G4UImessenger.hh" #include "globals.hh" class GEMEventActionMessenger: public G4UImessenger { public: GEMEventActionMessenger(GEMEventAction* mpga); ~GEMEventActionMessenger(); public: void SetNewValue(G4UIcommand * command,G4String newValues); G4String GetCurrentValue(G4UIcommand * command); private: GEMEventAction* target; private: //commands G4UIcmdWithAnInteger* verboseCmd; }; #endif
159cdf5639e97cc5100d21dc8003a90fd6d117d8
d06b42c56912f61fe81d04a02020a82a0d59d5ad
/SPlisHSPlasH/Viscosity/Viscosity_Peer2016.cpp
4e0212a6fd27996c50e39e3962e0c82df6de1ffe
[ "MIT" ]
permissive
scarensac/SPlisHSPlasH_for_cuda
240c22d8c0c8a34c9c3d670f269cb81425347af1
6e00d50d3b6372b9c587cbb30749dc09d3a1984f
refs/heads/master
2022-10-30T01:39:33.834157
2022-10-26T14:30:01
2022-10-26T14:30:01
109,022,638
0
0
null
null
null
null
UTF-8
C++
false
false
11,378
cpp
#include "Viscosity_Peer2016.h" #include "SPlisHSPlasH/TimeManager.h" #include "SPlisHSPlasH/Utilities/Timing.h" using namespace SPH; Viscosity_Peer2016::Viscosity_Peer2016(FluidModel *model) : ViscosityBase(model) { m_targetNablaV.resize(model->numParticles(), Matrix3r::Zero()); m_omega.resize(model->numParticles(), Vector3r::Zero()); m_maxIter = 100; m_maxError = 0.01; } Viscosity_Peer2016::~Viscosity_Peer2016(void) { m_targetNablaV.clear(); m_omega.clear(); } void Viscosity_Peer2016::matrixVecProdV(const Real* vec, Real *result, void *userData) { FluidModel *model = (FluidModel*)userData; const unsigned int numParticles = model->numActiveParticles(); #pragma omp parallel default(shared) { #pragma omp for schedule(static) for (int i = 0; i < (int)numParticles; i++) { // Diagonal element const Vector3r &xi = model->getPosition(0, i); result[i] = (model->getDensity(i) - model->getMass(i) * model->W_zero()) * vec[i]; for (unsigned int j = 0; j < model->numberOfNeighbors(0, i); j++) { const unsigned int neighborIndex = model->getNeighbor(0, i, j); const Vector3r &xj = model->getPosition(0, neighborIndex); result[i] -= model->getMass(neighborIndex) * model->W(xi - xj) * vec[neighborIndex]; } } } } void Viscosity_Peer2016::diagonalMatrixElementV(const unsigned int i, Real &result, void *userData) { // Diagonal element FluidModel *model = (FluidModel*)userData; result = model->getDensity(i) - model->getMass(i) * model->W_zero(); } void Viscosity_Peer2016::matrixVecProdOmega(const Real* vec, Real *result, void *userData) { FluidModel *model = (FluidModel*)userData; const unsigned int numParticles = model->numActiveParticles(); #pragma omp parallel default(shared) { #pragma omp for schedule(static) for (int i = 0; i < (int)numParticles; i++) { // Diagonal element const Vector3r &xi = model->getPosition(0, i); // Compute current fluid density for particle i Real density_i = model->getMass(i) * model->W_zero(); ////////////////////////////////////////////////////////////////////////// // Fluid ////////////////////////////////////////////////////////////////////////// for (unsigned int j = 0; j < model->numberOfNeighbors(0, i); j++) { const unsigned int neighborIndex = model->getNeighbor(0, i, j); const Vector3r &xj = model->getPosition(0, neighborIndex); density_i += model->getMass(neighborIndex) * model->W(xi - xj); } result[i] = (density_i - model->getMass(i) * model->W_zero()) * vec[i]; for (unsigned int j = 0; j < model->numberOfNeighbors(0, i); j++) { const unsigned int neighborIndex = model->getNeighbor(0, i, j); const Vector3r &xj = model->getPosition(0, neighborIndex); result[i] -= model->getMass(neighborIndex) * model->W(xi - xj) * vec[neighborIndex]; } } } } void Viscosity_Peer2016::diagonalMatrixElementOmega(const unsigned int i, Real &result, void *userData) { // Diagonal element FluidModel *model = (FluidModel*)userData; const Vector3r &xi = model->getPosition(0, i); // Compute current fluid density for particle i Real density_i = model->getMass(i) * model->W_zero(); ////////////////////////////////////////////////////////////////////////// // Fluid ////////////////////////////////////////////////////////////////////////// for (unsigned int j = 0; j < model->numberOfNeighbors(0, i); j++) { const unsigned int neighborIndex = model->getNeighbor(0, i, j); const Vector3r &xj = model->getPosition(0, neighborIndex); density_i += model->getMass(neighborIndex) * model->W(xi - xj); } result = density_i - model->getMass(i) * model->W_zero(); } void Viscosity_Peer2016::step() { /* const int numParticles = (int) m_model->numActiveParticles(); const Real viscosity = 1.0 - m_viscosity; const Real density0 = m_model->getDensity0(); const Real h = TimeManager::getCurrent()->getTimeStepSize(); ////////////////////////////////////////////////////////////////////////// // Init linear system solver and preconditioner ////////////////////////////////////////////////////////////////////////// MatrixReplacement A(m_model->numActiveParticles(), matrixVecProdV, (void*)m_model); m_solverV.preconditioner().init(m_model->numActiveParticles(), diagonalMatrixElementV, (void*)m_model); m_solverV.setTolerance(m_maxError); m_solverV.setMaxIterations(m_maxIter); m_solverV.compute(A); MatrixReplacement A2(m_model->numActiveParticles(), matrixVecProdOmega, (void*)m_model); m_solverOmega.preconditioner().init(m_model->numActiveParticles(), diagonalMatrixElementOmega, (void*)m_model); m_solverOmega.setTolerance(m_maxError); m_solverOmega.setMaxIterations(m_maxIter); m_solverOmega.compute(A2); EINGEN_FLOATING_VECTOR b0(numParticles); EINGEN_FLOATING_VECTOR b1(numParticles); EINGEN_FLOATING_VECTOR b2(numParticles); EINGEN_FLOATING_VECTOR x0(numParticles); EINGEN_FLOATING_VECTOR x1(numParticles); EINGEN_FLOATING_VECTOR x2(numParticles); EINGEN_FLOATING_VECTOR g0(numParticles); EINGEN_FLOATING_VECTOR g1(numParticles); EINGEN_FLOATING_VECTOR g2(numParticles); #pragma omp parallel default(shared) { #pragma omp for schedule(static) nowait for (int i = 0; i < numParticles; i++) { const Vector3r &xi = m_model->getPosition(0, i); const Vector3r &vi = m_model->getVelocity(0, i); const Real density_i = m_model->getDensity(i); ////////////////////////////////////////////////////////////////////////// // compute nabla v ////////////////////////////////////////////////////////////////////////// Matrix3r nablaV; nablaV.setZero(); for (unsigned int j = 0; j < m_model->numberOfNeighbors(0, i); j++) { const unsigned int neighborIndex = m_model->getNeighbor(0, i, j); const Vector3r &xj = m_model->getPosition(0, neighborIndex); const Vector3r &vj = m_model->getVelocity(0, neighborIndex); const Vector3r gradW = m_model->gradW(xi - xj); Matrix3r dyad = (vj - vi) * gradW.transpose(); nablaV += (1.0 / density_i) * m_model->getMass(neighborIndex) * dyad; } ////////////////////////////////////////////////////////////////////////// // decomposition of velocity gradient ////////////////////////////////////////////////////////////////////////// Matrix3r &target = getTargetNablaV(i); Matrix3r R = 0.5 * (nablaV - nablaV.transpose()); const Real divergence = nablaV(0, 0) + nablaV(1, 1) + nablaV(2, 2); const Matrix3r V = (1.0 / 3.0) * divergence * Matrix3r::Identity(); const Matrix3r S = 0.5 * (nablaV + nablaV.transpose()) - V; ////////////////////////////////////////////////////////////////////////// // extract omega ////////////////////////////////////////////////////////////////////////// Vector3r &omega = getOmega(i); omega[0] = 2.0 * R(2, 1); omega[1] = 2.0 * R(0, 2); omega[2] = 2.0 * R(1, 0); ////////////////////////////////////////////////////////////////////////// // compute target nabla v without spin tensor ////////////////////////////////////////////////////////////////////////// if (density_i >= density0) { target = V + viscosity * S; } else { if (-divergence < 0.0) target = V + viscosity * S; else target = viscosity * S; } } } ////////////////////////////////////////////////////////////////////////// // Compute RHS of vorticity diffusion system ////////////////////////////////////////////////////////////////////////// #pragma omp parallel default(shared) { #pragma omp for schedule(static) nowait for (int i = 0; i < (int)numParticles; i++) { const Vector3r &xi = m_model->getPosition(0, i); Vector3r rhs; rhs.setZero(); for (unsigned int j = 0; j < m_model->numberOfNeighbors(0, i); j++) { const unsigned int neighborIndex = m_model->getNeighbor(0, i, j); const Real m = m_model->getMass(neighborIndex); const Vector3r &xj = m_model->getPosition(0, neighborIndex); const Vector3r xij = xi - xj; const Real W = m_model->W(xij); rhs += m *(m_omega[i] - m_omega[neighborIndex]) * W; } const Vector3r &omegai = getOmega(i); g0[i] = omegai[0]; g1[i] = omegai[1]; g2[i] = omegai[2]; b0[i] = viscosity * rhs[0]; b1[i] = viscosity * rhs[1]; b2[i] = viscosity * rhs[2]; } } ////////////////////////////////////////////////////////////////////////// // Solve linear system ////////////////////////////////////////////////////////////////////////// START_TIMING("CG solve omega"); x0 = m_solverOmega.solveWithGuess(b0, g0); //x0 = m_solver.solve(b0); if (m_solverOmega.iterations() == 0) x0 = g0; x1 = m_solverOmega.solveWithGuess(b1, g1); //x1 = m_solver.solve(b1); if (m_solverOmega.iterations() == 0) x1 = g1; x2 = m_solverOmega.solveWithGuess(b2, g2); //x2 = m_solver.solve(b2); if (m_solverOmega.iterations() == 0) x2 = g2; STOP_TIMING_AVG; ////////////////////////////////////////////////////////////////////////// // Determine new spin tensor and add it to target nabla v ////////////////////////////////////////////////////////////////////////// #pragma omp parallel default(shared) { #pragma omp for schedule(static) nowait for (int i = 0; i < (int)numParticles; i++) { Matrix3r R; R << 0.0, -0.5*x2[i], 0.5*x1[i], 0.5*x2[i], 0.0, -0.5*x0[i], -0.5*x1[i], 0.5*x0[i], 0.0; Matrix3r &target = getTargetNablaV(i); target += R; } } ////////////////////////////////////////////////////////////////////////// // Compute RHS ////////////////////////////////////////////////////////////////////////// #pragma omp parallel default(shared) { #pragma omp for schedule(static) nowait for (int i = 0; i < (int)numParticles; i++) { const Vector3r &xi = m_model->getPosition(0, i); Vector3r rhs; rhs.setZero(); for (unsigned int j = 0; j < m_model->numberOfNeighbors(0, i); j++) { const unsigned int neighborIndex = m_model->getNeighbor(0, i, j); const Real m = m_model->getMass(neighborIndex); const Vector3r &xj = m_model->getPosition(0, neighborIndex); const Vector3r xij = xi - xj; const Real W = m_model->W(xij); rhs += m * 0.5 * (getTargetNablaV(i) + getTargetNablaV(neighborIndex)) * xij * W; } const Vector3r &vi = m_model->getVelocity(0, i); g0[i] = vi[0]; g1[i] = vi[1]; g2[i] = vi[2]; b0[i] = rhs[0]; b1[i] = rhs[1]; b2[i] = rhs[2]; } } ////////////////////////////////////////////////////////////////////////// // Solve linear system ////////////////////////////////////////////////////////////////////////// START_TIMING("CG solve"); int iter = 0; x0 = m_solverV.solveWithGuess(b0, g0); if (m_solverV.iterations() == 0) x0 = g0; iter += (int)m_solverV.iterations(); x1 = m_solverV.solveWithGuess(b1, g1); if (m_solverV.iterations() == 0) x1 = g1; iter += (int)m_solverV.iterations(); x2 = m_solverV.solveWithGuess(b2, g2); if (m_solverV.iterations() == 0) x2 = g2; iter += (int)m_solverV.iterations(); STOP_TIMING_AVG; #pragma omp parallel default(shared) { #pragma omp for schedule(static) nowait for (int i = 0; i < (int)numParticles; i++) { Vector3r &vi = m_model->getVelocity(0, i); vi[0] = x0[i]; vi[1] = x1[i]; vi[2] = x2[i]; } } //*/ } void Viscosity_Peer2016::reset() { } void Viscosity_Peer2016::performNeighborhoodSearchSort() { }
db025629fedd308dc2da8347076e9dece415ab02
719d57ab59222a0563a915c8b0267573b2667170
/tools/ContextMenu/items/KeybindContextMenuItem.cpp
2405ca378ce4ec9c19fef59272fa065ffe4794a0
[ "MIT" ]
permissive
Adrikikicp/BetterEdit
e93487acb57e6f405e7d2793b29ce47fe8c61cc9
014af9903a69fde7aa038bcc58efe97b9c6ff1c5
refs/heads/master
2023-09-03T19:25:43.441879
2021-10-29T03:00:06
2021-10-29T03:00:06
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,622
cpp
#include "../ContextMenu.hpp" #include "../CustomizeCMLayer.hpp" #include "../../EditorLayerInput/editorLayerInput.hpp" #define MORD(x, d) (this->m_pMenu ? this->m_pMenu->x : d) bool KeybindContextMenuItem::init(ContextMenu* menu, keybind_id const& id) { if (!ContextMenuItem::init(menu)) return false; this->m_sID = id; this->m_pLabel = this->createLabel(); this->m_pLabel->setColor(to3B(m_pMenu->m_colText)); this->addChild(this->m_pLabel); auto target = KeybindManager::get()->getTargetByID(id); this->m_pCallback = target.bind; if (target.bind) this->m_pLabel->setString(target.bind->name.c_str()); else this->m_pLabel->setString("Invalid\nkeybind"); return true; } void KeybindContextMenuItem::visit() { this->m_pLabel->setPosition( this->getContentSize() / 2 ); this->m_pLabel->limitLabelWidth( this->getScaledContentSize().width - 10.0f, this->m_pMenu ? this->m_pMenu->m_fFontScale : .4f, .02f ); ContextMenuItem::visit(); } void KeybindContextMenuItem::activate() { KeybindManager::get()->invokeCallback( this->m_sID, LevelEditorLayer::get()->getEditorUI(), nullptr ); SuperMouseManager::get()->releaseCapture(this); if (this->m_pMenu) this->m_pMenu->hide(); } KeybindContextMenuItem* KeybindContextMenuItem::create( ContextMenu* menu, keybind_id const& id ) { auto ret = new KeybindContextMenuItem; if (ret && ret->init(menu, id)) { ret->autorelease(); return ret; } CC_SAFE_DELETE(ret); return nullptr; }
85234f6bd634325d68d3516acd04f3e936ac9a23
f8596afd9e23b7809a09573cac3bd9b0b36452cf
/src/XML_Child_Value.hh
1722448814e05217f4bc09f94097057623c5463d
[]
no_license
brbass/hare
d6a9a424ab056e81e2c0d247e3b27ca660c63f15
8c0336b121644c0e93e361d5b25275b598db58f8
refs/heads/master
2022-12-22T17:45:29.923210
2022-12-14T19:14:14
2022-12-14T19:14:14
55,440,520
0
1
null
null
null
null
UTF-8
C++
false
false
3,358
hh
#ifndef XML_Child_Value_hh #define XML_Child_Value_hh #include <algorithm> #include <iterator> #include <sstream> #include <string> #include <type_traits> #include <vector> #include "pugixml.hpp" #include "Check.hh" using std::string; using std::vector; /* Helper functions for pugixml parser Automatically converts values to desired format and ensures that they exist */ /* Helper functions */ template<class T> void string_to_vector(string const &data_string, vector<T> &data) { std::istringstream iss(data_string); data = vector<T>{std::istream_iterator<T>(iss), std::istream_iterator<double>()}; } template<class T> void vector_to_string(string &data_string, vector<T> const &data) { std::ostringstream oss; std::copy(data.begin(), data.end(), std::ostream_iterator<T>(oss, " ")); data_string = oss.str(); } /* Get a child value from a certain node */ template<typename T> T child_value(pugi::xml_node &node, string description, bool required = true); template<> inline string child_value<string> (pugi::xml_node &node, string description, bool required) { string value = static_cast<string>(node.child_value(description.c_str())); if (required && value == "") { AssertMsg(false, "required value (" + description + ") not found"); } return value; } template<> inline int child_value<int> (pugi::xml_node &node, string description, bool required) { return stoi(child_value<string>(node, description, required)); } template<> inline double child_value<double> (pugi::xml_node &node, string description, bool required) { return stof(child_value<string>(node, description, required)); } /* Get a child vector from a certain node */ template<typename T> vector<T> child_vector(pugi::xml_node &node, string description, unsigned expected_size, bool required = true) { vector<T> value; string_to_vector(child_value<string>(node, description, required), value); AssertMsg(value.size() == expected_size, description + " size"); return value; } /* Append a child value to a certain node */ template<typename T> void append_child(pugi::xml_node &node, T data, string description, unsigned precision = 0) { std::stringstream ss; ss << data; string data_string = ss.str(); pugi::xml_node child = node.append_child(description.c_str()); child.append_child(pugi::node_pcdata).set_value(data_string.c_str()); } /* Append a child vector to a certain node */ template<typename T> void append_child(pugi::xml_node &node, vector<T> const &data, string description, string index_order = "") { string data_string; vector_to_string(data_string, data); pugi::xml_node child = node.append_child(description.c_str()); child.append_child(pugi::node_pcdata).set_value(data_string.c_str()); if (index_order != "") { pugi::xml_attribute it = child.append_attribute("data_order"); it.set_value(index_order.c_str()); } } #endif
8966b5a9c1b7779cd65f31d76e8a340af0265a32
f7576b0290fafc0d819465a61537cca99df08d7c
/test/test_packet_rw.cpp
46978dc2a014a76ff7aa3624959b470249c7903d
[]
no_license
robertocosta/uep
d4168b25920a08e085cf614cc389ad518c78e95a
5d08f3ddde44e1178d8899db7680e1775efdcd3b
refs/heads/master
2021-01-12T07:57:23.098482
2017-11-18T20:38:32
2017-11-18T20:38:32
77,057,719
0
1
null
2017-11-01T23:16:41
2016-12-21T14:18:15
C++
UTF-8
C++
false
false
4,198
cpp
#define BOOST_TEST_MODULE packet_rw_test #include <boost/test/unit_test.hpp> #include <boost/numeric/conversion/cast.hpp> #include "packets_rw.hpp" using namespace std; BOOST_AUTO_TEST_CASE(read_write_test) { fountain_packet test_fp; test_fp.block_number(0x4); test_fp.sequence_number(0xedde); test_fp.block_seed(0xffee00bb); test_fp.resize(3); test_fp[0] = 0x11; test_fp[1] = 0x22; test_fp[2] = 0x33; vector<char> raw = build_raw_packet(test_fp); const char *expected_raw = "\x00\x00\x04\xed\xde\xff\xee\x00\xbb\x00\x03\x11\x22\x33"; for (size_t i = 0; i != raw.size(); ++i) { BOOST_CHECK_EQUAL(raw[i], expected_raw[i]); } fountain_packet decoded_fp = parse_raw_data_packet(raw); BOOST_CHECK_EQUAL(test_fp, decoded_fp); } BOOST_AUTO_TEST_CASE(limit_test) { fountain_packet test_fp; test_fp.block_number(0xffff); test_fp.sequence_number(0xffff); test_fp.block_seed(0xffffffff); test_fp.resize(0xffff); BOOST_CHECK_NO_THROW(build_raw_packet(test_fp)); test_fp.resize(0); BOOST_CHECK_NO_THROW(build_raw_packet(test_fp)); test_fp = fountain_packet(); test_fp.block_number(0xffff + 1); BOOST_CHECK_THROW(build_raw_packet(test_fp), exception); test_fp = fountain_packet(); test_fp.sequence_number(0xffff + 1); BOOST_CHECK_THROW(build_raw_packet(test_fp), exception); } BOOST_AUTO_TEST_CASE(wrong_raw) { const char *raw = "\x00\x00\x04\xed\xde\xff\xee\x00\xbb\x00\x03\x11\x22\x33"; const vector<char> v(raw, raw + data_header_size+3); vector<char> u; u = v; u[0] = 4; BOOST_CHECK_THROW(parse_raw_data_packet(u), exception); u = v; u[10] = 2; BOOST_CHECK_NO_THROW(parse_raw_data_packet(u)); u = v; u[10] = 4; BOOST_CHECK_THROW(parse_raw_data_packet(u), exception); u = v; u.resize(data_header_size + 2); BOOST_CHECK_THROW(parse_raw_data_packet(u), exception); u = v; u.resize(data_header_size + 4); BOOST_CHECK_NO_THROW(parse_raw_data_packet(u)); u = v; u.resize(data_header_size + 2); u[10] = 2; BOOST_CHECK_NO_THROW(parse_raw_data_packet(u)); u = v; u.resize(1); BOOST_CHECK_THROW(parse_raw_data_packet(u), exception); } BOOST_AUTO_TEST_CASE(build_ack) { const char *expected1 = "\x01\x00\xff"; const char *expected2 = "\x01\xff\x00"; std::size_t blockno1 = 0xff, blockno2 = 0xff00; std::vector<char> ack1 = build_raw_ack(blockno1); std::vector<char> ack2 = build_raw_ack(blockno2); BOOST_CHECK(equal(ack1.cbegin(), ack1.cend(), expected1)); BOOST_CHECK(equal(ack2.cbegin(), ack2.cend(), expected2)); } BOOST_AUTO_TEST_CASE(parse_ack) { const char *raw_str1 = "\x01\x00\xff"; const char *raw_str2 = "\x01\xff\x00"; const std::vector<char> raw1(raw_str1, raw_str1+ack_header_size); const std::vector<char> raw2(raw_str2, raw_str2+ack_header_size); const std::size_t blockno1 = 0xff, blockno2 = 0xff00; BOOST_CHECK_EQUAL(blockno1, parse_raw_ack_packet(raw1)); BOOST_CHECK_EQUAL(blockno2, parse_raw_ack_packet(raw2)); } BOOST_AUTO_TEST_CASE(ack_build_parse) { const std::size_t bns[] = {0, 0xffff, 0x1234, 1, 0x1000}; for (int i = 0; i < 5; ++i) { std::vector<char> raw = build_raw_ack(bns[i]); size_t parsed = parse_raw_ack_packet(raw); BOOST_CHECK_EQUAL(parsed, bns[i]); } } BOOST_AUTO_TEST_CASE(ack_fail) { std::vector<char> shr(2, '\x01'); std::vector<char> lng(4, '\x01'); std::vector<char> empty; BOOST_CHECK_THROW(parse_raw_ack_packet(empty), runtime_error); BOOST_CHECK_THROW(parse_raw_ack_packet(shr), runtime_error); BOOST_CHECK_NO_THROW(parse_raw_ack_packet(lng)); std::size_t overflow_bn = 0x10000; BOOST_CHECK_THROW(build_raw_ack(overflow_bn), boost::numeric::positive_overflow); } BOOST_AUTO_TEST_CASE(wrong_type) { std::vector<char> raw_ack(ack_header_size); raw_ack[0] = raw_packet_type::block_ack; std::vector<char> raw_data(data_header_size); raw_data[0] = raw_packet_type::data; BOOST_CHECK_THROW(parse_raw_data_packet(raw_ack), runtime_error); BOOST_CHECK_THROW(parse_raw_ack_packet(raw_data), runtime_error); raw_data[0] = 0xff; BOOST_CHECK_THROW(parse_raw_data_packet(raw_data), runtime_error); BOOST_CHECK_THROW(parse_raw_ack_packet(raw_data), runtime_error); }
d45d48bc7d2125adb39600e6848c3a3f73fe96ec
28b926fb59e493066af5a106320c4fea396615c7
/smartptr/Uniqueptr.cpp
01248acd462578407f303f781899f3c0ad5abd45
[]
no_license
Jelly-Ye/Jelly-C-
f974e8e03d085d5243fc5e86fea3bc3619cff376
551e825b4dba5e932b8aa88c3606e82f1129bb60
refs/heads/master
2020-04-24T15:46:37.703759
2019-08-11T13:27:54
2019-08-11T13:27:54
null
0
0
null
null
null
null
GB18030
C++
false
false
577
cpp
#include <iostream> using namespace std; template <class T> class UniquePtr { public: UniquePtr(T* ptr) :_ptr(ptr) {} ~UniquePtr() { if (_ptr) delete _ptr; } //C++防拷贝方式 UniquePtr(UniquePtr<T> const& ) = delete; UniquePtr<T> operator=(UniquePtr<T>const & ) = delete; //C++98防拷贝方式 (只声明不定义)不能不写,它会用默认的,所以必须写 //UniquePtr(UniquePtr<T> const&); //UniquePtr<T>operator=(UniquePtr<T> const &); T& operator* () { return *_ptr; } T* operator->() { return _ptr; } private: T* _ptr; };
9e21773b28bc97959fb97a9db74b06e72c0d4ea5
8cb2fcb6929c2c1781296d218eaa15f37ba66190
/src/hw_soln/running_threshold/solution1/.autopilot/db/running_threshold.pp.0.cpp.ap-line.cpp.CXX
245f18349bfd65982730ccb2b9341184b7a9626a
[]
no_license
chrisqinxz/Underwater-Acoustic-Detection
5477c8efb859aa694c015ce7d63591665e46c3ae
f0c5a53f428b867151befe9fb2ff008a1f9f387b
refs/heads/master
2021-04-23T12:38:19.114445
2017-06-14T19:08:43
2017-06-14T19:08:43
null
0
0
null
null
null
null
UTF-8
C++
false
false
62,334
cxx
#pragma line 1 "running_threshold.cpp" ::: 0 #pragma line 1 "running_threshold.cpp" 1 ::: 1 #pragma line 1 "<built-in>" 1 ::: 2 #pragma line 1 "<built-in>" 3 ::: 3 #pragma line 152 "<built-in>" 3 ::: 4 #pragma line 1 "<command line>" 1 ::: 5 #pragma line 1 "C:/Xilinx/Vivado_HLS/2015.4/common/technology/autopilot\\etc/autopilot_ssdm_op.h" 1 ::: 11 #pragma line 145 "C:/Xilinx/Vivado_HLS/2015.4/common/technology/autopilot\\etc/autopilot_ssdm_op.h" ::: 64 #pragma line 407 "C:/Xilinx/Vivado_HLS/2015.4/common/technology/autopilot\\etc/autopilot_ssdm_op.h" ::: 199 #pragma line 7 "<command line>" 2 ::: 202 #pragma line 1 "<built-in>" 2 ::: 203 #pragma line 1 "running_threshold.cpp" 2 ::: 204 #pragma line 1 "./running_threshold.h" 1 ::: 205 #pragma line 1 "C:/Xilinx/Vivado_HLS/2015.4/common/technology/autopilot\\ap_int.h" 1 ::: 209 #pragma line 60 "C:/Xilinx/Vivado_HLS/2015.4/common/technology/autopilot\\ap_int.h" ::: 261 #pragma line 1 "C:/Xilinx/Vivado_HLS/2015.4/common/technology/autopilot/ap_int_syn.h" 1 ::: 262 #pragma line 68 "C:/Xilinx/Vivado_HLS/2015.4/common/technology/autopilot/ap_int_syn.h" ::: 314 #pragma line 1 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\iostream" 1 3 ::: 315 #pragma line 37 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\iostream" 3 ::: 353 #pragma line 1 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2/x86_64-w64-mingw32\\bits/c++config.h" 1 3 ::: 355 #pragma line 63 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2/x86_64-w64-mingw32\\bits/c++config.h" 3 ::: 408 #pragma line 90 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2/x86_64-w64-mingw32\\bits/c++config.h" 3 ::: 426 #pragma line 187 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2/x86_64-w64-mingw32\\bits/c++config.h" 3 ::: 453 #pragma line 197 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2/x86_64-w64-mingw32\\bits/c++config.h" 3 ::: 455 #pragma line 207 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2/x86_64-w64-mingw32\\bits/c++config.h" 3 ::: 457 #pragma line 217 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2/x86_64-w64-mingw32\\bits/c++config.h" 3 ::: 459 #pragma line 238 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2/x86_64-w64-mingw32\\bits/c++config.h" 3 ::: 461 #pragma line 258 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2/x86_64-w64-mingw32\\bits/c++config.h" 3 ::: 467 #pragma line 272 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2/x86_64-w64-mingw32\\bits/c++config.h" 3 ::: 470 #pragma line 1 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2/x86_64-w64-mingw32\\bits/os_defines.h" 1 3 ::: 475 #pragma line 57 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2/x86_64-w64-mingw32\\bits/os_defines.h" 3 ::: 520 #pragma line 276 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2/x86_64-w64-mingw32\\bits/c++config.h" 2 3 ::: 525 #pragma line 1 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2/x86_64-w64-mingw32\\bits/cpu_defines.h" 1 3 ::: 529 #pragma line 279 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2/x86_64-w64-mingw32\\bits/c++config.h" 2 3 ::: 558 #pragma line 339 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2/x86_64-w64-mingw32\\bits/c++config.h" 3 ::: 594 #pragma line 379 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2/x86_64-w64-mingw32\\bits/c++config.h" 3 ::: 612 #pragma line 39 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\iostream" 2 3 ::: 1415 #pragma line 1 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\ostream" 1 3 ::: 1416 #pragma line 38 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\ostream" 3 ::: 1455 #pragma line 1 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\ios" 1 3 ::: 1457 #pragma line 37 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\ios" 3 ::: 1495 #pragma line 1 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\iosfwd" 1 3 ::: 1497 #pragma line 38 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\iosfwd" 3 ::: 1536 #pragma line 1 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\bits/stringfwd.h" 1 3 ::: 1539 #pragma line 39 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\bits/stringfwd.h" 3 ::: 1579 #pragma line 80 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\bits/stringfwd.h" 3 ::: 1609 #pragma line 41 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\iosfwd" 2 3 ::: 1613 #pragma line 1 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\bits/postypes.h" 1 3 ::: 1614 #pragma line 40 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\bits/postypes.h" 3 ::: 1655 #pragma line 1 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\cwchar" 1 3 ::: 1657 #pragma line 41 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\cwchar" 3 ::: 1699 #pragma line 1 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\cstddef" 1 3 ::: 1702 #pragma line 41 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\cstddef" 3 ::: 1744 #pragma line 1 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin/../lib/clang/3.1/include\\stddef.h" 1 3 4 ::: 1747 #pragma line 56 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin/../lib/clang/3.1/include\\stddef.h" 3 4 ::: 1783 #pragma line 44 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\cstddef" 2 3 ::: 1786 #pragma line 44 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\cwchar" 2 3 ::: 1797 #pragma line 1 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin/../lib/clang/3.1/../../../x86_64-w64-mingw32/include\\wchar.h" 1 3 ::: 1800 #pragma line 1 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin/../lib/clang/3.1/../../../x86_64-w64-mingw32/include\\_mingw.h" 1 3 ::: 1810 #pragma line 1 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin/../lib/clang/3.1/../../../x86_64-w64-mingw32/include/_mingw_mac.h" 1 3 ::: 1821 #pragma line 18 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin/../lib/clang/3.1/../../../x86_64-w64-mingw32/include/_mingw_mac.h" 3 ::: 1827 #pragma line 62 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin/../lib/clang/3.1/../../../x86_64-w64-mingw32/include/_mingw_mac.h" 3 ::: 1841 #pragma line 10 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin/../lib/clang/3.1/../../../x86_64-w64-mingw32/include\\_mingw.h" 2 3 ::: 1848 #pragma line 32 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin/../lib/clang/3.1/../../../x86_64-w64-mingw32/include\\_mingw.h" 3 ::: 1852 #pragma line 147 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin/../lib/clang/3.1/../../../x86_64-w64-mingw32/include\\_mingw.h" 3 ::: 1855 #pragma line 225 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin/../lib/clang/3.1/../../../x86_64-w64-mingw32/include\\_mingw.h" 3 ::: 1859 #pragma line 247 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin/../lib/clang/3.1/../../../x86_64-w64-mingw32/include\\_mingw.h" 3 ::: 1861 #pragma line 277 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin/../lib/clang/3.1/../../../x86_64-w64-mingw32/include\\_mingw.h" 3 ::: 1863 #pragma line 1 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin/../lib/clang/3.1/../../../x86_64-w64-mingw32/include\\vadefs.h" 1 3 ::: 1864 #pragma line 1 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin/../lib/clang/3.1/../../../x86_64-w64-mingw32/include\\_mingw.h" 1 3 ::: 1878 #pragma line 674 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin/../lib/clang/3.1/../../../x86_64-w64-mingw32/include\\_mingw.h" 3 ::: 1884 #pragma line 1 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin/../lib/clang/3.1/../../../x86_64-w64-mingw32/include/sdks/_mingw_directx.h" 1 3 ::: 1885 #pragma line 674 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin/../lib/clang/3.1/../../../x86_64-w64-mingw32/include\\_mingw.h" 2 3 ::: 1886 #pragma line 1 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin/../lib/clang/3.1/../../../x86_64-w64-mingw32/include/sdks/_mingw_ddk.h" 1 3 ::: 1888 #pragma line 675 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin/../lib/clang/3.1/../../../x86_64-w64-mingw32/include\\_mingw.h" 2 3 ::: 1889 #pragma line 13 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin/../lib/clang/3.1/../../../x86_64-w64-mingw32/include\\vadefs.h" 2 3 ::: 1890 #pragma line 46 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin/../lib/clang/3.1/../../../x86_64-w64-mingw32/include\\vadefs.h" 3 ::: 1910 #pragma line 99 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin/../lib/clang/3.1/../../../x86_64-w64-mingw32/include\\vadefs.h" 3 ::: 1912 #pragma line 277 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin/../lib/clang/3.1/../../../x86_64-w64-mingw32/include\\_mingw.h" 2 3 ::: 1917 #pragma line 316 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin/../lib/clang/3.1/../../../x86_64-w64-mingw32/include\\_mingw.h" 3 ::: 1921 #pragma line 370 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin/../lib/clang/3.1/../../../x86_64-w64-mingw32/include\\_mingw.h" 3 ::: 1927 #pragma line 380 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin/../lib/clang/3.1/../../../x86_64-w64-mingw32/include\\_mingw.h" 3 ::: 1929 #pragma line 392 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin/../lib/clang/3.1/../../../x86_64-w64-mingw32/include\\_mingw.h" 3 ::: 1931 #pragma line 405 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin/../lib/clang/3.1/../../../x86_64-w64-mingw32/include\\_mingw.h" 3 ::: 1933 #pragma line 418 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin/../lib/clang/3.1/../../../x86_64-w64-mingw32/include\\_mingw.h" 3 ::: 1935 #pragma line 436 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin/../lib/clang/3.1/../../../x86_64-w64-mingw32/include\\_mingw.h" 3 ::: 1937 #pragma line 456 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin/../lib/clang/3.1/../../../x86_64-w64-mingw32/include\\_mingw.h" 3 ::: 1940 #pragma line 518 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin/../lib/clang/3.1/../../../x86_64-w64-mingw32/include\\_mingw.h" 3 ::: 1960 #pragma line 605 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin/../lib/clang/3.1/../../../x86_64-w64-mingw32/include\\_mingw.h" 3 ::: 1974 #pragma line 9 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin/../lib/clang/3.1/../../../x86_64-w64-mingw32/include\\wchar.h" 2 3 ::: 2038 #pragma line 27 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin/../lib/clang/3.1/../../../x86_64-w64-mingw32/include\\wchar.h" 3 ::: 2045 #pragma line 66 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin/../lib/clang/3.1/../../../x86_64-w64-mingw32/include\\wchar.h" 3 ::: 2063 #pragma line 164 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin/../lib/clang/3.1/../../../x86_64-w64-mingw32/include\\wchar.h" 3 ::: 2105 #pragma line 178 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin/../lib/clang/3.1/../../../x86_64-w64-mingw32/include\\wchar.h" 3 ::: 2107 #pragma line 193 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin/../lib/clang/3.1/../../../x86_64-w64-mingw32/include\\wchar.h" 3 ::: 2109 #pragma line 217 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin/../lib/clang/3.1/../../../x86_64-w64-mingw32/include\\wchar.h" 3 ::: 2111 #pragma line 360 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin/../lib/clang/3.1/../../../x86_64-w64-mingw32/include\\wchar.h" 3 ::: 2215 #pragma line 412 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin/../lib/clang/3.1/../../../x86_64-w64-mingw32/include\\wchar.h" 3 ::: 2246 #pragma line 493 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin/../lib/clang/3.1/../../../x86_64-w64-mingw32/include\\wchar.h" 3 ::: 2318 #pragma line 507 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin/../lib/clang/3.1/../../../x86_64-w64-mingw32/include\\wchar.h" 3 ::: 2323 #pragma line 540 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin/../lib/clang/3.1/../../../x86_64-w64-mingw32/include\\wchar.h" 3 ::: 2345 #pragma line 621 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin/../lib/clang/3.1/../../../x86_64-w64-mingw32/include\\wchar.h" 3 ::: 2417 #pragma line 669 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin/../lib/clang/3.1/../../../x86_64-w64-mingw32/include\\wchar.h" 3 ::: 2446 #pragma line 816 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin/../lib/clang/3.1/../../../x86_64-w64-mingw32/include\\wchar.h" 3 ::: 2584 #pragma line 876 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin/../lib/clang/3.1/../../../x86_64-w64-mingw32/include\\wchar.h" 3 ::: 2610 #pragma line 1 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin/../lib/clang/3.1/../../../x86_64-w64-mingw32/include\\sec_api/wchar_s.h" 1 3 ::: 2617 #pragma line 1 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin/../lib/clang/3.1/../../../x86_64-w64-mingw32/include\\wchar.h" 1 3 ::: 2627 #pragma line 9 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin/../lib/clang/3.1/../../../x86_64-w64-mingw32/include\\sec_api/wchar_s.h" 2 3 ::: 2633 #pragma line 881 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin/../lib/clang/3.1/../../../x86_64-w64-mingw32/include\\wchar.h" 2 3 ::: 2634 #pragma line 47 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\cwchar" 2 3 ::: 2635 #pragma line 64 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\cwchar" 3 ::: 2643 #pragma line 138 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\cwchar" 3 ::: 2651 #pragma line 257 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\cwchar" 3 ::: 2763 #pragma line 42 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\bits/postypes.h" 2 3 ::: 2777 #pragma line 69 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\bits/postypes.h" 3 ::: 2782 #pragma line 238 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\bits/postypes.h" 3 ::: 2944 #pragma line 42 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\iosfwd" 2 3 ::: 2946 #pragma line 39 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\ios" 2 3 ::: 3064 #pragma line 1 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\exception" 1 3 ::: 3065 #pragma line 35 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\exception" 3 ::: 3101 #pragma line 40 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\ios" 2 3 ::: 3214 #pragma line 1 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\bits/char_traits.h" 1 3 ::: 3215 #pragma line 39 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\bits/char_traits.h" 3 ::: 3255 #pragma line 1 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\bits/stl_algobase.h" 1 3 ::: 3257 #pragma line 1 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\cstddef" 1 3 ::: 3319 #pragma line 41 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\cstddef" 3 ::: 3361 #pragma line 1 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin/../lib/clang/3.1/include\\stddef.h" 1 3 4 ::: 3364 #pragma line 56 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin/../lib/clang/3.1/include\\stddef.h" 3 4 ::: 3389 #pragma line 44 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\cstddef" 2 3 ::: 3392 #pragma line 62 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\bits/stl_algobase.h" 2 3 ::: 3393 #pragma line 1 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\bits/functexcept.h" 1 3 ::: 3394 #pragma line 1 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\exception_defines.h" 1 3 ::: 3432 #pragma line 38 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\bits/functexcept.h" 2 3 ::: 3471 #pragma line 63 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\bits/stl_algobase.h" 2 3 ::: 3533 #pragma line 1 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\bits/cpp_type_traits.h" 1 3 ::: 3534 #pragma line 36 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\bits/cpp_type_traits.h" 3 ::: 3571 #pragma line 193 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\bits/cpp_type_traits.h" 3 ::: 3711 #pragma line 416 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\bits/cpp_type_traits.h" 3 ::: 3922 #pragma line 64 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\bits/stl_algobase.h" 2 3 ::: 3952 #pragma line 1 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\ext/type_traits.h" 1 3 ::: 3953 #pragma line 32 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\ext/type_traits.h" 3 ::: 3986 #pragma line 65 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\bits/stl_algobase.h" 2 3 ::: 4157 #pragma line 1 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\ext/numeric_traits.h" 1 3 ::: 4158 #pragma line 32 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\ext/numeric_traits.h" 3 ::: 4191 #pragma line 51 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\ext/numeric_traits.h" 3 ::: 4200 #pragma line 96 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\ext/numeric_traits.h" 3 ::: 4225 #pragma line 66 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\bits/stl_algobase.h" 2 3 ::: 4258 #pragma line 1 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\bits/stl_pair.h" 1 3 ::: 4259 #pragma line 1 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\bits/move.h" 1 3 ::: 4320 #pragma line 1 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\cstddef" 1 3 ::: 4355 #pragma line 41 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\cstddef" 3 ::: 4397 #pragma line 1 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin/../lib/clang/3.1/include\\stddef.h" 1 3 4 ::: 4400 #pragma line 56 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin/../lib/clang/3.1/include\\stddef.h" 3 4 ::: 4425 #pragma line 44 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\cstddef" 2 3 ::: 4428 #pragma line 35 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\bits/move.h" 2 3 ::: 4429 #pragma line 1 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\bits/concept_check.h" 1 3 ::: 4430 #pragma line 33 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\bits/concept_check.h" 3 ::: 4464 #pragma line 36 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\bits/move.h" 2 3 ::: 4475 #pragma line 95 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\bits/move.h" 3 ::: 4476 #pragma line 61 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\bits/stl_pair.h" 2 3 ::: 4509 #pragma line 112 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\bits/stl_pair.h" 3 ::: 4538 #pragma line 149 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\bits/stl_pair.h" 3 ::: 4544 #pragma line 198 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\bits/stl_pair.h" 3 ::: 4583 #pragma line 257 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\bits/stl_pair.h" 3 ::: 4601 #pragma line 67 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\bits/stl_algobase.h" 2 3 ::: 4603 #pragma line 1 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\bits/stl_iterator_base_types.h" 1 3 ::: 4604 #pragma line 63 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\bits/stl_iterator_base_types.h" 3 ::: 4668 #pragma line 1 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\cstddef" 1 3 ::: 4671 #pragma line 41 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\cstddef" 3 ::: 4713 #pragma line 1 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin/../lib/clang/3.1/include\\stddef.h" 1 3 4 ::: 4716 #pragma line 56 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin/../lib/clang/3.1/include\\stddef.h" 3 4 ::: 4741 #pragma line 44 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\cstddef" 2 3 ::: 4744 #pragma line 66 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\bits/stl_iterator_base_types.h" 2 3 ::: 4745 #pragma line 68 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\bits/stl_algobase.h" 2 3 ::: 4859 #pragma line 1 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\bits/stl_iterator_base_funcs.h" 1 3 ::: 4860 #pragma line 63 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\bits/stl_iterator_base_funcs.h" 3 ::: 4924 #pragma line 69 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\bits/stl_algobase.h" 2 3 ::: 5038 #pragma line 1 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\bits/stl_iterator.h" 1 3 ::: 5039 #pragma line 68 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\bits/stl_iterator.h" 3 ::: 5099 #pragma line 442 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\bits/stl_iterator.h" 3 ::: 5458 #pragma line 532 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\bits/stl_iterator.h" 3 ::: 5533 #pragma line 646 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\bits/stl_iterator.h" 3 ::: 5630 #pragma line 70 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\bits/stl_algobase.h" 2 3 ::: 5881 #pragma line 1 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\debug/debug.h" 1 3 ::: 5883 #pragma line 72 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\bits/stl_algobase.h" 2 3 ::: 5942 #pragma line 134 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\bits/stl_algobase.h" 3 ::: 5996 #pragma line 339 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\bits/stl_algobase.h" 3 ::: 6186 #pragma line 377 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\bits/stl_algobase.h" 3 ::: 6204 #pragma line 514 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\bits/stl_algobase.h" 3 ::: 6304 #pragma line 542 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\bits/stl_algobase.h" 3 ::: 6317 #pragma line 572 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\bits/stl_algobase.h" 3 ::: 6331 #pragma line 689 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\bits/stl_algobase.h" 3 ::: 6407 #pragma line 41 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\bits/char_traits.h" 2 3 ::: 6945 #pragma line 1 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\cwchar" 1 3 ::: 6947 #pragma line 41 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\cwchar" 3 ::: 6989 #pragma line 1 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\cstddef" 1 3 ::: 6992 #pragma line 41 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\cstddef" 3 ::: 7034 #pragma line 1 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin/../lib/clang/3.1/include\\stddef.h" 1 3 4 ::: 7037 #pragma line 56 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin/../lib/clang/3.1/include\\stddef.h" 3 4 ::: 7062 #pragma line 44 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\cstddef" 2 3 ::: 7065 #pragma line 44 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\cwchar" 2 3 ::: 7066 #pragma line 43 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\bits/char_traits.h" 2 3 ::: 7067 #pragma line 41 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\ios" 2 3 ::: 7399 #pragma line 1 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\bits/localefwd.h" 1 3 ::: 7400 #pragma line 39 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\bits/localefwd.h" 3 ::: 7440 #pragma line 1 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2/x86_64-w64-mingw32\\bits/c++locale.h" 1 3 ::: 7443 #pragma line 40 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2/x86_64-w64-mingw32\\bits/c++locale.h" 3 ::: 7484 #pragma line 1 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\clocale" 1 3 ::: 7486 #pragma line 41 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\clocale" 3 ::: 7528 #pragma line 1 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin/../lib/clang/3.1/../../../x86_64-w64-mingw32/include\\locale.h" 1 3 ::: 7531 #pragma line 1 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin/../lib/clang/3.1/../../../x86_64-w64-mingw32/include\\_mingw.h" 1 3 ::: 7541 #pragma line 9 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin/../lib/clang/3.1/../../../x86_64-w64-mingw32/include\\locale.h" 2 3 ::: 7547 #pragma line 41 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin/../lib/clang/3.1/../../../x86_64-w64-mingw32/include\\locale.h" 3 ::: 7554 #pragma line 75 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin/../lib/clang/3.1/../../../x86_64-w64-mingw32/include\\locale.h" 3 ::: 7575 #pragma line 44 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\clocale" 2 3 ::: 7596 #pragma line 42 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2/x86_64-w64-mingw32\\bits/c++locale.h" 2 3 ::: 7612 #pragma line 1 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\cstddef" 1 3 ::: 7613 #pragma line 41 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\cstddef" 3 ::: 7655 #pragma line 1 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin/../lib/clang/3.1/include\\stddef.h" 1 3 4 ::: 7658 #pragma line 56 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin/../lib/clang/3.1/include\\stddef.h" 3 4 ::: 7683 #pragma line 44 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\cstddef" 2 3 ::: 7686 #pragma line 43 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2/x86_64-w64-mingw32\\bits/c++locale.h" 2 3 ::: 7687 #pragma line 42 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\bits/localefwd.h" 2 3 ::: 7734 #pragma line 1 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\cctype" 1 3 ::: 7736 #pragma line 41 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\cctype" 3 ::: 7778 #pragma line 1 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin/../lib/clang/3.1/../../../x86_64-w64-mingw32/include\\ctype.h" 1 3 ::: 7781 #pragma line 1 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin/../lib/clang/3.1/../../../x86_64-w64-mingw32/include\\_mingw.h" 1 3 ::: 7791 #pragma line 9 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin/../lib/clang/3.1/../../../x86_64-w64-mingw32/include\\ctype.h" 2 3 ::: 7797 #pragma line 70 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin/../lib/clang/3.1/../../../x86_64-w64-mingw32/include\\ctype.h" 3 ::: 7802 #pragma line 100 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin/../lib/clang/3.1/../../../x86_64-w64-mingw32/include\\ctype.h" 3 ::: 7815 #pragma line 193 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin/../lib/clang/3.1/../../../x86_64-w64-mingw32/include\\ctype.h" 3 ::: 7853 #pragma line 275 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin/../lib/clang/3.1/../../../x86_64-w64-mingw32/include\\ctype.h" 3 ::: 7855 #pragma line 44 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\cctype" 2 3 ::: 7857 #pragma line 63 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\cctype" 3 ::: 7863 #pragma line 44 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\bits/localefwd.h" 2 3 ::: 7881 #pragma line 42 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\ios" 2 3 ::: 8025 #pragma line 1 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\bits/ios_base.h" 1 3 ::: 8026 #pragma line 39 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\bits/ios_base.h" 3 ::: 8066 #pragma line 1 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\ext/atomicity.h" 1 3 ::: 8068 #pragma line 1 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2/x86_64-w64-mingw32\\bits/gthr.h" 1 3 ::: 8103 #pragma line 162 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2/x86_64-w64-mingw32\\bits/gthr.h" 3 ::: 8247 #pragma line 1 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2/x86_64-w64-mingw32\\bits/gthr-default.h" 1 3 ::: 8248 #pragma line 1 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin/../lib/clang/3.1/../../../x86_64-w64-mingw32/include\\errno.h" 1 3 ::: 8319 #pragma line 1 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin/../lib/clang/3.1/../../../x86_64-w64-mingw32/include\\_mingw.h" 1 3 ::: 8329 #pragma line 9 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin/../lib/clang/3.1/../../../x86_64-w64-mingw32/include\\errno.h" 2 3 ::: 8335 #pragma line 74 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin/../lib/clang/3.1/../../../x86_64-w64-mingw32/include\\errno.h" 3 ::: 8349 #pragma line 71 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2/x86_64-w64-mingw32\\bits/gthr-default.h" 2 3 ::: 8351 #pragma line 1 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin/../lib/clang/3.1/../../../x86_64-w64-mingw32/include\\_mingw.h" 1 3 ::: 8353 #pragma line 73 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2/x86_64-w64-mingw32\\bits/gthr-default.h" 2 3 ::: 8359 #pragma line 340 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2/x86_64-w64-mingw32\\bits/gthr-default.h" 3 ::: 8360 #pragma line 371 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2/x86_64-w64-mingw32\\bits/gthr-default.h" 3 ::: 8382 #pragma line 401 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2/x86_64-w64-mingw32\\bits/gthr-default.h" 3 ::: 8395 #pragma line 767 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2/x86_64-w64-mingw32\\bits/gthr-default.h" 3 ::: 8533 #pragma line 163 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2/x86_64-w64-mingw32\\bits/gthr.h" 2 3 ::: 8535 #pragma line 35 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\ext/atomicity.h" 2 3 ::: 8544 #pragma line 1 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2/x86_64-w64-mingw32\\bits/atomic_word.h" 1 3 ::: 8545 #pragma line 36 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\ext/atomicity.h" 2 3 ::: 8591 #pragma line 61 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\ext/atomicity.h" 3 ::: 8607 #pragma line 41 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\bits/ios_base.h" 2 3 ::: 8653 #pragma line 1 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\bits/locale_classes.h" 1 3 ::: 8655 #pragma line 39 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\bits/locale_classes.h" 3 ::: 8695 #pragma line 1 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\string" 1 3 ::: 8698 #pragma line 38 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\string" 3 ::: 8737 #pragma line 1 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\bits/allocator.h" 1 3 ::: 8742 #pragma line 1 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2/x86_64-w64-mingw32\\bits/c++allocator.h" 1 3 ::: 8791 #pragma line 1 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\ext/new_allocator.h" 1 3 ::: 8826 #pragma line 1 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\new" 1 3 ::: 8860 #pragma line 39 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\new" 3 ::: 8900 #pragma line 1 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\cstddef" 1 3 ::: 8902 #pragma line 41 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\cstddef" 3 ::: 8944 #pragma line 1 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin/../lib/clang/3.1/include\\stddef.h" 1 3 4 ::: 8947 #pragma line 56 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin/../lib/clang/3.1/include\\stddef.h" 3 4 ::: 8972 #pragma line 44 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\cstddef" 2 3 ::: 8975 #pragma line 41 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\new" 2 3 ::: 8976 #pragma line 34 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\ext/new_allocator.h" 2 3 ::: 9048 #pragma line 114 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\ext/new_allocator.h" 3 ::: 9121 #pragma line 35 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2/x86_64-w64-mingw32\\bits/c++allocator.h" 2 3 ::: 9137 #pragma line 49 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\bits/allocator.h" 2 3 ::: 9138 #pragma line 204 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\bits/allocator.h" 3 ::: 9268 #pragma line 43 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\string" 2 3 ::: 9270 #pragma line 1 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\bits/ostream_insert.h" 1 3 ::: 9273 #pragma line 33 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\bits/ostream_insert.h" 3 ::: 9307 #pragma line 1 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\cxxabi-forced.h" 1 3 ::: 9310 #pragma line 33 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\cxxabi-forced.h" 3 ::: 9344 #pragma line 36 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\bits/ostream_insert.h" 2 3 ::: 9369 #pragma line 46 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\string" 2 3 ::: 9459 #pragma line 1 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\bits/stl_function.h" 1 3 ::: 9463 #pragma line 1 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\backward/binders.h" 1 3 ::: 10176 #pragma line 713 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\bits/stl_function.h" 2 3 ::: 10344 #pragma line 50 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\string" 2 3 ::: 10345 #pragma line 1 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\bits/basic_string.h" 1 3 ::: 10348 #pragma line 39 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\bits/basic_string.h" 3 ::: 10388 #pragma line 1 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\initializer_list" 1 3 ::: 10392 #pragma line 33 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\initializer_list" 3 ::: 10426 #pragma line 43 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\bits/basic_string.h" 2 3 ::: 10427 #pragma line 510 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\bits/basic_string.h" 3 ::: 10868 #pragma line 584 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\bits/basic_string.h" 3 ::: 10914 #pragma line 695 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\bits/basic_string.h" 3 ::: 10989 #pragma line 753 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\bits/basic_string.h" 3 ::: 11035 #pragma line 915 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\bits/basic_string.h" 3 ::: 11186 #pragma line 981 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\bits/basic_string.h" 3 ::: 11241 #pragma line 1033 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\bits/basic_string.h" 3 ::: 11276 #pragma line 1117 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\bits/basic_string.h" 3 ::: 11349 #pragma line 1164 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\bits/basic_string.h" 3 ::: 11381 #pragma line 1620 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\bits/basic_string.h" 3 ::: 11818 #pragma line 53 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\string" 2 3 ::: 12856 #pragma line 1 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\bits/basic_string.tcc" 1 3 ::: 12859 #pragma line 42 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\bits/basic_string.tcc" 3 ::: 12902 #pragma line 239 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\bits/basic_string.tcc" 3 ::: 13091 #pragma line 56 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\string" 2 3 ::: 14017 #pragma line 42 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\bits/locale_classes.h" 2 3 ::: 14018 #pragma line 1 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\bits/locale_classes.tcc" 1 3 ::: 14792 #pragma line 37 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\bits/locale_classes.tcc" 3 ::: 14830 #pragma line 815 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\bits/locale_classes.h" 2 3 ::: 15063 #pragma line 43 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\bits/ios_base.h" 2 3 ::: 15064 #pragma line 53 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\bits/ios_base.h" 3 ::: 15065 #pragma line 43 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\ios" 2 3 ::: 15984 #pragma line 1 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\streambuf" 1 3 ::: 15985 #pragma line 37 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\streambuf" 3 ::: 16023 #pragma line 1 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\bits/streambuf.tcc" 1 3 ::: 16786 #pragma line 38 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\bits/streambuf.tcc" 3 ::: 16825 #pragma line 799 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\streambuf" 2 3 ::: 16960 #pragma line 44 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\ios" 2 3 ::: 16961 #pragma line 1 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\bits/basic_ios.h" 1 3 ::: 16962 #pragma line 35 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\bits/basic_ios.h" 3 ::: 16998 #pragma line 1 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\bits/locale_facets.h" 1 3 ::: 17002 #pragma line 39 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\bits/locale_facets.h" 3 ::: 17042 #pragma line 1 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\cwctype" 1 3 ::: 17044 #pragma line 41 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\cwctype" 3 ::: 17086 #pragma line 1 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin/../lib/clang/3.1/../../../x86_64-w64-mingw32/include\\wctype.h" 1 3 ::: 17091 #pragma line 1 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin/../lib/clang/3.1/../../../x86_64-w64-mingw32/include\\_mingw.h" 1 3 ::: 17105 #pragma line 13 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin/../lib/clang/3.1/../../../x86_64-w64-mingw32/include\\wctype.h" 2 3 ::: 17111 #pragma line 166 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin/../lib/clang/3.1/../../../x86_64-w64-mingw32/include\\wctype.h" 3 ::: 17118 #pragma line 46 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\cwctype" 2 3 ::: 17129 #pragma line 75 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\cwctype" 3 ::: 17136 #pragma line 41 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\bits/locale_facets.h" 2 3 ::: 17165 #pragma line 1 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\cctype" 1 3 ::: 17166 #pragma line 41 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\cctype" 3 ::: 17208 #pragma line 42 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\bits/locale_facets.h" 2 3 ::: 17209 #pragma line 1 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2/x86_64-w64-mingw32\\bits/ctype_base.h" 1 3 ::: 17210 #pragma line 43 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\bits/locale_facets.h" 2 3 ::: 17272 #pragma line 1 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\bits/streambuf_iterator.h" 1 3 ::: 17279 #pragma line 35 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\bits/streambuf_iterator.h" 3 ::: 17315 #pragma line 50 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\bits/locale_facets.h" 2 3 ::: 17678 #pragma line 1 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2/x86_64-w64-mingw32\\bits/ctype_inline.h" 1 3 ::: 19138 #pragma line 1509 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\bits/locale_facets.h" 2 3 ::: 19211 #pragma line 1 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\bits/locale_facets.tcc" 1 3 ::: 20304 #pragma line 35 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\bits/locale_facets.tcc" 3 ::: 20340 #pragma line 729 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\bits/locale_facets.tcc" 3 ::: 21017 #pragma line 1024 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\bits/locale_facets.tcc" 3 ::: 21294 #pragma line 1151 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\bits/locale_facets.tcc" 3 ::: 21413 #pragma line 2601 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\bits/locale_facets.h" 2 3 ::: 21621 #pragma line 39 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\bits/basic_ios.h" 2 3 ::: 21622 #pragma line 1 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\bits/basic_ios.tcc" 1 3 ::: 22055 #pragma line 34 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\bits/basic_ios.tcc" 3 ::: 22090 #pragma line 471 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\bits/basic_ios.h" 2 3 ::: 22242 #pragma line 45 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\ios" 2 3 ::: 22243 #pragma line 40 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\ostream" 2 3 ::: 22244 #pragma line 582 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\ostream" 3 ::: 22768 #pragma line 1 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\bits/ostream.tcc" 1 3 ::: 22773 #pragma line 39 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\bits/ostream.tcc" 3 ::: 22813 #pragma line 586 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\ostream" 2 3 ::: 23180 #pragma line 40 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\iostream" 2 3 ::: 23181 #pragma line 1 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\istream" 1 3 ::: 23182 #pragma line 38 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\istream" 3 ::: 23221 #pragma line 850 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\istream" 3 ::: 24015 #pragma line 1 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\bits/istream.tcc" 1 3 ::: 24020 #pragma line 39 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\bits/istream.tcc" 3 ::: 24060 #pragma line 854 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\istream" 2 3 ::: 25092 #pragma line 41 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin\\..\\lib\\clang\\3.1/../../../include/c++/4.5.2\\iostream" 2 3 ::: 25093 #pragma line 69 "C:/Xilinx/Vivado_HLS/2015.4/common/technology/autopilot/ap_int_syn.h" 2 ::: 25128 #pragma line 1 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin/../lib/clang/3.1/../../../x86_64-w64-mingw32/include\\math.h" 1 3 ::: 25129 #pragma line 10 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin/../lib/clang/3.1/../../../x86_64-w64-mingw32/include\\math.h" 3 ::: 25140 #pragma line 1 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin/../lib/clang/3.1/../../../x86_64-w64-mingw32/include\\_mingw.h" 1 3 ::: 25143 #pragma line 12 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin/../lib/clang/3.1/../../../x86_64-w64-mingw32/include\\math.h" 2 3 ::: 25149 #pragma line 55 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin/../lib/clang/3.1/../../../x86_64-w64-mingw32/include\\math.h" 3 ::: 25155 #pragma line 75 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin/../lib/clang/3.1/../../../x86_64-w64-mingw32/include\\math.h" 3 ::: 25160 #pragma line 91 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin/../lib/clang/3.1/../../../x86_64-w64-mingw32/include\\math.h" 3 ::: 25166 #pragma line 135 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin/../lib/clang/3.1/../../../x86_64-w64-mingw32/include\\math.h" 3 ::: 25200 #pragma line 162 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin/../lib/clang/3.1/../../../x86_64-w64-mingw32/include\\math.h" 3 ::: 25219 #pragma line 260 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin/../lib/clang/3.1/../../../x86_64-w64-mingw32/include\\math.h" 3 ::: 25279 #pragma line 278 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin/../lib/clang/3.1/../../../x86_64-w64-mingw32/include\\math.h" 3 ::: 25286 #pragma line 325 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin/../lib/clang/3.1/../../../x86_64-w64-mingw32/include\\math.h" 3 ::: 25311 #pragma line 372 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin/../lib/clang/3.1/../../../x86_64-w64-mingw32/include\\math.h" 3 ::: 25325 #pragma line 403 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin/../lib/clang/3.1/../../../x86_64-w64-mingw32/include\\math.h" 3 ::: 25333 #pragma line 552 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin/../lib/clang/3.1/../../../x86_64-w64-mingw32/include\\math.h" 3 ::: 25455 #pragma line 583 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin/../lib/clang/3.1/../../../x86_64-w64-mingw32/include\\math.h" 3 ::: 25477 #pragma line 594 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin/../lib/clang/3.1/../../../x86_64-w64-mingw32/include\\math.h" 3 ::: 25479 #pragma line 737 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin/../lib/clang/3.1/../../../x86_64-w64-mingw32/include\\math.h" 3 ::: 25549 #pragma line 871 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin/../lib/clang/3.1/../../../x86_64-w64-mingw32/include\\math.h" 3 ::: 25645 #pragma line 893 "C:/Xilinx/Vivado_HLS/2015.4/win64/tools/clang/bin/../lib/clang/3.1/../../../x86_64-w64-mingw32/include\\math.h" 3 ::: 25657 #pragma line 70 "C:/Xilinx/Vivado_HLS/2015.4/common/technology/autopilot/ap_int_syn.h" 2 ::: 25664 #pragma line 109 "C:/Xilinx/Vivado_HLS/2015.4/common/technology/autopilot/ap_int_syn.h" ::: 25684 #pragma line 127 "C:/Xilinx/Vivado_HLS/2015.4/common/technology/autopilot/ap_int_syn.h" ::: 25687 #pragma line 145 "C:/Xilinx/Vivado_HLS/2015.4/common/technology/autopilot/ap_int_syn.h" ::: 25689 #pragma line 182 "C:/Xilinx/Vivado_HLS/2015.4/common/technology/autopilot/ap_int_syn.h" ::: 25702 #pragma line 1 "C:/Xilinx/Vivado_HLS/2015.4/common/technology/autopilot/etc/autopilot_dt.def" 1 ::: 25703 #pragma line 183 "C:/Xilinx/Vivado_HLS/2015.4/common/technology/autopilot/ap_int_syn.h" 2 ::: 26742 #pragma line 601 "C:/Xilinx/Vivado_HLS/2015.4/common/technology/autopilot/ap_int_syn.h" ::: 26743 #pragma line 644 "C:/Xilinx/Vivado_HLS/2015.4/common/technology/autopilot/ap_int_syn.h" ::: 26745 #pragma line 1 "C:/Xilinx/Vivado_HLS/2015.4/common/technology/autopilot/etc/autopilot_ssdm_bits.h" 1 ::: 26746 #pragma line 98 "C:/Xilinx/Vivado_HLS/2015.4/common/technology/autopilot/etc/autopilot_ssdm_bits.h" ::: 26799 #pragma line 108 "C:/Xilinx/Vivado_HLS/2015.4/common/technology/autopilot/etc/autopilot_ssdm_bits.h" ::: 26801 #pragma line 129 "C:/Xilinx/Vivado_HLS/2015.4/common/technology/autopilot/etc/autopilot_ssdm_bits.h" ::: 26803 #pragma line 143 "C:/Xilinx/Vivado_HLS/2015.4/common/technology/autopilot/etc/autopilot_ssdm_bits.h" ::: 26808 #pragma line 156 "C:/Xilinx/Vivado_HLS/2015.4/common/technology/autopilot/etc/autopilot_ssdm_bits.h" ::: 26811 #pragma line 192 "C:/Xilinx/Vivado_HLS/2015.4/common/technology/autopilot/etc/autopilot_ssdm_bits.h" ::: 26813 #pragma line 645 "C:/Xilinx/Vivado_HLS/2015.4/common/technology/autopilot/ap_int_syn.h" 2 ::: 26815 #pragma line 879 "C:/Xilinx/Vivado_HLS/2015.4/common/technology/autopilot/ap_int_syn.h" ::: 27041 #pragma line 918 "C:/Xilinx/Vivado_HLS/2015.4/common/technology/autopilot/ap_int_syn.h" ::: 27070 #pragma line 1564 "C:/Xilinx/Vivado_HLS/2015.4/common/technology/autopilot/ap_int_syn.h" ::: 27709 #pragma line 1682 "C:/Xilinx/Vivado_HLS/2015.4/common/technology/autopilot/ap_int_syn.h" ::: 27816 #pragma line 1816 "C:/Xilinx/Vivado_HLS/2015.4/common/technology/autopilot/ap_int_syn.h" ::: 27942 #pragma line 2040 "C:/Xilinx/Vivado_HLS/2015.4/common/technology/autopilot/ap_int_syn.h" ::: 28151 #pragma line 2103 "C:/Xilinx/Vivado_HLS/2015.4/common/technology/autopilot/ap_int_syn.h" ::: 28206 #pragma line 2504 "C:/Xilinx/Vivado_HLS/2015.4/common/technology/autopilot/ap_int_syn.h" ::: 28600 #pragma line 2623 "C:/Xilinx/Vivado_HLS/2015.4/common/technology/autopilot/ap_int_syn.h" ::: 28708 #pragma line 2757 "C:/Xilinx/Vivado_HLS/2015.4/common/technology/autopilot/ap_int_syn.h" ::: 28834 #pragma line 2986 "C:/Xilinx/Vivado_HLS/2015.4/common/technology/autopilot/ap_int_syn.h" ::: 29047 #pragma line 3049 "C:/Xilinx/Vivado_HLS/2015.4/common/technology/autopilot/ap_int_syn.h" ::: 29102 #pragma line 3363 "C:/Xilinx/Vivado_HLS/2015.4/common/technology/autopilot/ap_int_syn.h" ::: 29391 #pragma line 3398 "C:/Xilinx/Vivado_HLS/2015.4/common/technology/autopilot/ap_int_syn.h" ::: 29413 #pragma line 3423 "C:/Xilinx/Vivado_HLS/2015.4/common/technology/autopilot/ap_int_syn.h" ::: 29419 #pragma line 3517 "C:/Xilinx/Vivado_HLS/2015.4/common/technology/autopilot/ap_int_syn.h" ::: 29431 #pragma line 3576 "C:/Xilinx/Vivado_HLS/2015.4/common/technology/autopilot/ap_int_syn.h" ::: 29451 #pragma line 3632 "C:/Xilinx/Vivado_HLS/2015.4/common/technology/autopilot/ap_int_syn.h" ::: 29480 #pragma line 3688 "C:/Xilinx/Vivado_HLS/2015.4/common/technology/autopilot/ap_int_syn.h" ::: 29509 #pragma line 3730 "C:/Xilinx/Vivado_HLS/2015.4/common/technology/autopilot/ap_int_syn.h" ::: 29527 #pragma line 3755 "C:/Xilinx/Vivado_HLS/2015.4/common/technology/autopilot/ap_int_syn.h" ::: 29545 #pragma line 3907 "C:/Xilinx/Vivado_HLS/2015.4/common/technology/autopilot/ap_int_syn.h" ::: 29556 #pragma line 3933 "C:/Xilinx/Vivado_HLS/2015.4/common/technology/autopilot/ap_int_syn.h" ::: 29574 #pragma line 61 "C:/Xilinx/Vivado_HLS/2015.4/common/technology/autopilot\\ap_int.h" 2 ::: 29585 #pragma line 1 "C:/Xilinx/Vivado_HLS/2015.4/common/technology/autopilot/ap_fixed_syn.h" 1 ::: 29586 #pragma line 62 "C:/Xilinx/Vivado_HLS/2015.4/common/technology/autopilot/ap_fixed_syn.h" ::: 29639 #pragma line 79 "C:/Xilinx/Vivado_HLS/2015.4/common/technology/autopilot/ap_fixed_syn.h" ::: 29643 #pragma line 1245 "C:/Xilinx/Vivado_HLS/2015.4/common/technology/autopilot/ap_fixed_syn.h" ::: 30800 #pragma line 1329 "C:/Xilinx/Vivado_HLS/2015.4/common/technology/autopilot/ap_fixed_syn.h" ::: 30871 #pragma line 1347 "C:/Xilinx/Vivado_HLS/2015.4/common/technology/autopilot/ap_fixed_syn.h" ::: 30881 #pragma line 1478 "C:/Xilinx/Vivado_HLS/2015.4/common/technology/autopilot/ap_fixed_syn.h" ::: 30975 #pragma line 1523 "C:/Xilinx/Vivado_HLS/2015.4/common/technology/autopilot/ap_fixed_syn.h" ::: 30994 #pragma line 1581 "C:/Xilinx/Vivado_HLS/2015.4/common/technology/autopilot/ap_fixed_syn.h" ::: 31015 #pragma line 1613 "C:/Xilinx/Vivado_HLS/2015.4/common/technology/autopilot/ap_fixed_syn.h" ::: 31033 #pragma line 1682 "C:/Xilinx/Vivado_HLS/2015.4/common/technology/autopilot/ap_fixed_syn.h" ::: 31072 #pragma line 1696 "C:/Xilinx/Vivado_HLS/2015.4/common/technology/autopilot/ap_fixed_syn.h" ::: 31075 #pragma line 1731 "C:/Xilinx/Vivado_HLS/2015.4/common/technology/autopilot/ap_fixed_syn.h" ::: 31090 #pragma line 1743 "C:/Xilinx/Vivado_HLS/2015.4/common/technology/autopilot/ap_fixed_syn.h" ::: 31092 #pragma line 1791 "C:/Xilinx/Vivado_HLS/2015.4/common/technology/autopilot/ap_fixed_syn.h" ::: 31111 #pragma line 1805 "C:/Xilinx/Vivado_HLS/2015.4/common/technology/autopilot/ap_fixed_syn.h" ::: 31114 #pragma line 1835 "C:/Xilinx/Vivado_HLS/2015.4/common/technology/autopilot/ap_fixed_syn.h" ::: 31129 #pragma line 1882 "C:/Xilinx/Vivado_HLS/2015.4/common/technology/autopilot/ap_fixed_syn.h" ::: 31163 #pragma line 2155 "C:/Xilinx/Vivado_HLS/2015.4/common/technology/autopilot/ap_fixed_syn.h" ::: 31427 #pragma line 2273 "C:/Xilinx/Vivado_HLS/2015.4/common/technology/autopilot/ap_fixed_syn.h" ::: 31477 #pragma line 2323 "C:/Xilinx/Vivado_HLS/2015.4/common/technology/autopilot/ap_fixed_syn.h" ::: 31495 #pragma line 2408 "C:/Xilinx/Vivado_HLS/2015.4/common/technology/autopilot/ap_fixed_syn.h" ::: 31550 #pragma line 2448 "C:/Xilinx/Vivado_HLS/2015.4/common/technology/autopilot/ap_fixed_syn.h" ::: 31568 #pragma line 62 "C:/Xilinx/Vivado_HLS/2015.4/common/technology/autopilot\\ap_int.h" 2 ::: 31575 #pragma line 5 "./running_threshold.h" 2 ::: 32039 #pragma line 1 "C:/Xilinx/Vivado_HLS/2015.4/common/technology/autopilot\\hls_stream.h" 1 ::: 32040 #pragma line 1 "C:/Xilinx/Vivado_HLS/2015.4/common/technology/autopilot/etc/autopilot_enum.h" 1 ::: 32107 #pragma line 67 "C:/Xilinx/Vivado_HLS/2015.4/common/technology/autopilot\\hls_stream.h" 2 ::: 32237 #pragma line 6 "./running_threshold.h" 2 ::: 32338 #pragma line 2 "running_threshold.cpp" 2 ::: 32351
eaa3a521a6162607e5cbdea73d31a12e2d67cb61
bc0d3a75d4eec1d170188894657fb1b92091946d
/projects/kv260/kv260_stepper_motor/app/main.cpp
433e44442943331572953cdce48cb19a148b2b7f
[ "MIT" ]
permissive
ryuz/jelly
b0d9e7f067cdb09ef3522521790a62e8562287cc
c195e9ff67655065ef3fe27a8f249b1b82e5c043
refs/heads/master
2023-08-19T06:08:05.547962
2023-08-05T02:34:13
2023-08-05T02:34:13
2,084,115
42
13
MIT
2023-08-05T02:34:14
2011-07-21T15:20:53
Verilog
UTF-8
C++
false
false
2,958
cpp
// --------------------------------------------------------------------------- // udmabuf テスト // Copyright (C) 2015-2020 by Ryuz // https://github.com/ryuz/ // --------------------------------------------------------------------------- #include <iostream> #include <unistd.h> #include "jelly/UioAccessor.h" #include "jelly/UdmabufAccessor.h" #define REG_STMC_CORE_ID 0x00 #define REG_STMC_CTL_ENABLE 0x01 #define REG_STMC_CTL_TARGET 0x02 #define REG_STMC_CTL_PWM 0x03 #define REG_STMC_TARGET_X 0x04 #define REG_STMC_TARGET_V 0x06 #define REG_STMC_TARGET_A 0x07 #define REG_STMC_MAX_V 0x09 #define REG_STMC_MAX_A 0x0a #define REG_STMC_MAX_A_NEAR 0x0f #define REG_STMC_CUR_X 0x10 #define REG_STMC_CUR_V 0x12 #define REG_STMC_CUR_A 0x13 #define REG_STMC_TIME 0x20 int main() { // mmap uio jelly::UioAccessor uio_acc("uio_pl_peri", 0x00800000); if ( !uio_acc.IsMapped() ) { std::cout << "uio_pl_peri mmap error" << std::endl; return 1; } // UIOの中をさらにコアごとに割り当て auto gid_acc = uio_acc.GetAccessor(0x000000); auto stmc_acc = uio_acc.GetAccessor(0x410000); std::cout << "gid : " << std::hex << gid_acc.ReadReg(0) << std::endl; std::cout << "stmc : " << std::hex << stmc_acc.ReadReg(0) << std::endl; stmc_acc.WriteReg(REG_STMC_MAX_A, 100); stmc_acc.WriteReg(REG_STMC_MAX_V, 200000); stmc_acc.WriteReg(REG_STMC_CTL_ENABLE, 1); std::cout << "speed 1000" << std::endl; stmc_acc.WriteReg(REG_STMC_TARGET_V, 1000); stmc_acc.WriteReg(REG_STMC_CTL_TARGET, 2); sleep(3); std::cout << "speed -5000" << std::endl; stmc_acc.WriteReg(REG_STMC_TARGET_V, -5000); stmc_acc.WriteReg(REG_STMC_CTL_TARGET, 2); sleep(3); stmc_acc.WriteReg(REG_STMC_CTL_TARGET, 1); stmc_acc.WriteReg(REG_STMC_TARGET_X, 10000); std::cout << "go to 10000" << std::endl; sleep(3); std::cout << "go to -10000" << std::endl; stmc_acc.WriteReg(REG_STMC_TARGET_X, -10000); sleep(3); std::cout << "go to 0" << std::endl; stmc_acc.WriteReg(REG_STMC_TARGET_X, 0); sleep(3); std::cout << "stop" << std::endl; stmc_acc.WriteReg(REG_STMC_TARGET_A, 0); stmc_acc.WriteReg(REG_STMC_TARGET_V, 0); stmc_acc.WriteReg(REG_STMC_CTL_TARGET, 2); sleep(1); stmc_acc.WriteReg(REG_STMC_CTL_TARGET, 4); for ( int i = 0; i < 2; ++i ) { std::cout << "accelerate +10" << std::endl; stmc_acc.WriteReg(REG_STMC_TARGET_A, +10); sleep(4); std::cout << "accelerate -10" << std::endl; stmc_acc.WriteReg(REG_STMC_TARGET_A, -10); sleep(4); } std::cout << "release" << std::endl; stmc_acc.WriteReg(REG_STMC_TARGET_A, 0); stmc_acc.WriteReg(REG_STMC_TARGET_V, 0); stmc_acc.WriteReg(REG_STMC_CTL_ENABLE, 0); return 0; } // end of file
7c346328160174b4ed9d5ff1206637e2890c5c7d
a06515f4697a3dbcbae4e3c05de2f8632f8d5f46
/corpus/taken_from_cppcheck_tests/stolen_363.cpp
d151d107f9deb7a10cd738a088068894f90e8d8a
[]
no_license
pauldreik/fuzzcppcheck
12d9c11bcc182cc1f1bb4893e0925dc05fcaf711
794ba352af45971ff1f76d665b52adeb42dcab5f
refs/heads/master
2020-05-01T01:55:04.280076
2019-03-22T21:05:28
2019-03-22T21:05:28
177,206,313
0
0
null
null
null
null
UTF-8
C++
false
false
53
cpp
void f(int x) { if ((5 && x) > 1) a++; }
91c61484b032b90c90311b42c26a114c06fbf745
a9f6a01aae6830b6b72eaa001274fcf07950b6eb
/esp8266-control-panel/Connection.ino
77b54e73a62c3aa3cd353e6ecfd9c8c8375e95fe
[]
no_license
Rasti003/HeatingController
b21287bfef21e7e25d70b8824f7a4271d6697652
5fc11da232a7e4fcb51128174ef097715089d35c
refs/heads/master
2021-09-03T18:03:38.195333
2018-01-10T23:40:22
2018-01-10T23:40:22
117,007,711
0
0
null
null
null
null
UTF-8
C++
false
false
640
ino
void Connection() { WiFi.begin(myssid, mypass); display.print("Podlaczanie do sieci"); display.display(); // Wait for successful connection int i = 0; while (WiFi.status() != WL_CONNECTED) { delay(500); display.print("."); display.display(); i++; if ( i > 20) { isConected = false; break; } } if (isConected == true) { display.clearDisplay(); display.println("Polaczono do"); display.println(myssid); display.display(); delay(2000); } else { display.clearDisplay(); display.println("NIE POLACZONO!"); display.display(); delay(2000); } }
e8b3b63b163ea6952262981370696cc9ca3119ce
455ecd26f1439cd4a44856c743b01d711e3805b6
/java/include/android.view.ContextMenu_ContextMenuInfo.hpp
932929d5a796788e3a6cf0178a2d7533d52419aa
[]
no_license
lbguilherme/duvidovc-app
00662bf024f82a842c808673109b30fe2b70e727
f7c86ea812d2ae8dd892918b65ea429e9906531c
refs/heads/master
2021-03-24T09:17:17.834080
2015-09-08T02:32:44
2015-09-08T02:32:44
33,072,192
0
0
null
null
null
null
UTF-8
C++
false
false
1,242
hpp
#pragma once #include "../src/java-core.hpp" #include <jni.h> #include <cstdint> #include <memory> #include <vector> #include "java.lang.Object.hpp" namespace android { namespace view { class ContextMenu_ContextMenuInfo : public virtual ::java::lang::Object { public: static jclass _class; #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wreorder" explicit ContextMenu_ContextMenuInfo(jobject _obj) : ::java::lang::Object(_obj) {} #pragma GCC diagnostic pop #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wreorder" ContextMenu_ContextMenuInfo(const ::android::view::ContextMenu_ContextMenuInfo& x) : ::java::lang::Object((jobject)0) {obj = x.obj;} ContextMenu_ContextMenuInfo(::android::view::ContextMenu_ContextMenuInfo&& x) : ::java::lang::Object((jobject)0) {obj = x.obj; x.obj = JavaObjectHolder((jobject)0);} #pragma GCC diagnostic pop ::android::view::ContextMenu_ContextMenuInfo& operator=(const ::android::view::ContextMenu_ContextMenuInfo& x) {obj = x.obj; return *this;} ::android::view::ContextMenu_ContextMenuInfo& operator=(::android::view::ContextMenu_ContextMenuInfo&& x) {obj = std::move(x.obj); return *this;} }; } }
dea0e7714c41036f005cd2db53bc1bec47c24a4e
775dea4b8ea51b22936aec82467ada7bd797e1d9
/thread/ThreadService.h
4982e8f40a4d17dc42b328bb8a25c6c4ed75dcb0
[]
no_license
yuandaxing/utils
d66b5c65d60b498a6630be47be84e396a1e84517
02815fc60e09c37dd9badf37cd656c28748baee5
refs/heads/master
2016-08-08T14:55:08.776088
2014-11-03T10:23:25
2014-11-03T10:23:25
null
0
0
null
null
null
null
UTF-8
C++
false
false
3,832
h
#ifndef _SIMPLETHREAD_H_INC #define _SIMPLETHREAD_H_INC #include <stdlib.h> #include <pthread.h> #include <list> #include <boost/noncopyable.hpp> #include <sys/types.h> #include <unistd.h> #include <Queue.h> #include <boost/function.hpp> #include <boost/shared_ptr.hpp> #include <boost/ptr_container/ptr_vector.hpp> #include <boost/bind.hpp> namespace threadSafe{ class SimpleThread: private boost::noncopyable { public: typedef void* (*fun)(void *); explicit SimpleThread(fun ff): f(ff), thread_id(0) { } void start() { pthread_create(&thread_id, NULL, f, NULL); } void join() const { pthread_join(thread_id, NULL); } private: fun f; pthread_t thread_id; }; /*----------------------------------------------------------------------------- * we create a Thread object, and then start the thread, object must still * alive *-----------------------------------------------------------------------------*/ class Thread: private boost::noncopyable { public: typedef boost::function<void ()> func; explicit Thread(const func &ff): f(ff), thread_id(0) { } void start() { pthread_create(&thread_id, NULL, thread_func, this); } void join() const { pthread_join(thread_id, NULL); } private: func f; pthread_t thread_id; static void* thread_func(void *t) { Thread *thread = static_cast<Thread *>(t); thread->f(); } }; /*----------------------------------------------------------------------------- * this class is for wrapping your working, the work must create in heap, so the * construct is private, and the deconstructor is public, and we donnot want * boost::function to wrap the work, because that will need more copy overhead. *-----------------------------------------------------------------------------*/ template <typename T> class Work: private boost::noncopyable { public: typedef void (*func)(T &data); T data; func f; static boost::shared_ptr<Work<T> > getWork( const T &data, func f_) { return boost::shared_ptr<Work<T> >(new Work(data, f_)); } static boost::shared_ptr<Work<T> > getWork( const func &f_) { return boost::shared_ptr<Work<T> >(new Work(f_)); } private: Work(const T &d, func f_): data(d), f(f_) { } explicit Work(func f_): f(f_) { } }; template <typename T> class ThreadPoolWorker: private boost::noncopyable { private: boost::ptr_vector<Thread> threads; bool running; const int nThread; std::list<boost::shared_ptr<Work<T> > > works; Mutex m; Condition notEmpty; void function() { while(running) { try{ boost::shared_ptr<Work<T> > work ; { MutexGuard mg(m); while(running && works.empty()) notEmpty.wait(); if(works.empty()) continue; work = works.front(); works.pop_front(); } work->f(work->data); } catch(...) { fprintf(stderr, "some error in ThreadPoolWorker"); } } } public: void putWork(const boost::shared_ptr<Work<T> > &ptr) { MutexGuard mg(m); works.push_back(ptr); notEmpty.notify(); } ThreadPoolWorker(const int &nThread_): nThread(nThread_), running(false), notEmpty(m) { } ~ThreadPoolWorker() { stop(); } void start() { { MutexGuard mg(m); if(running) return ; running = true; } for(int i = 0; i < nThread; i++) { threads.push_back(new Thread( boost::bind(&ThreadPoolWorker::function, this))); threads[i].start(); } } void join() { for(int i = 0; i < nThread; i++) threads[i].join(); } void stop() { if(running == false) return ; running = false; notEmpty.notifyAll(); join(); } }; namespace ThreadUtils{ inline pid_t pid() { return getpid();} inline pthread_t thread_id() { return pthread_self(); } } } #endif /* ----- #ifndef _SIMPLETHREAD_H_INC ----- */
6cf309ff778ad7acb9d323583e7c0ec018b4d719
e76ea38dbe5774fccaf14e1a0090d9275cdaee08
/src/chrome/browser/extensions/api/messaging/native_process_launcher_win.cc
fd7345c918039473495b44aa4565c404b0f2aa96
[ "BSD-3-Clause" ]
permissive
eurogiciel-oss/Tizen_Crosswalk
efc424807a5434df1d5c9e8ed51364974643707d
a68aed6e29bd157c95564e7af2e3a26191813e51
refs/heads/master
2021-01-18T19:19:04.527505
2014-02-06T13:43:21
2014-02-06T13:43:21
16,070,101
1
3
null
null
null
null
UTF-8
C++
false
false
5,542
cc
// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "chrome/browser/extensions/api/messaging/native_process_launcher.h" #include <windows.h> #include "base/command_line.h" #include "base/logging.h" #include "base/process/kill.h" #include "base/process/launch.h" #include "base/strings/string16.h" #include "base/strings/string_number_conversions.h" #include "base/strings/stringprintf.h" #include "base/strings/utf_string_conversions.h" #include "base/win/registry.h" #include "base/win/scoped_handle.h" #include "crypto/random.h" namespace extensions { const wchar_t kNativeMessagingRegistryKey[] = L"SOFTWARE\\Google\\Chrome\\NativeMessagingHosts"; namespace { // Reads path to the native messaging host manifest from the registry. Returns // empty string if the path isn't found. string16 GetManifestPath(const string16& native_host_name, DWORD flags) { base::win::RegKey key; string16 result; if (key.Open(HKEY_LOCAL_MACHINE, kNativeMessagingRegistryKey, KEY_QUERY_VALUE | flags) != ERROR_SUCCESS || key.OpenKey(native_host_name.c_str(), KEY_QUERY_VALUE | flags) != ERROR_SUCCESS || key.ReadValue(NULL, &result) != ERROR_SUCCESS) { return string16(); } return result; } } // namespace // static base::FilePath NativeProcessLauncher::FindManifest( const std::string& native_host_name, std::string* error_message) { string16 native_host_name_wide = UTF8ToUTF16(native_host_name); // First check 32-bit registry and then try 64-bit. string16 manifest_path_str = GetManifestPath(native_host_name_wide, KEY_WOW64_32KEY); if (manifest_path_str.empty()) manifest_path_str = GetManifestPath(native_host_name_wide, KEY_WOW64_64KEY); if (manifest_path_str.empty()) { *error_message = "Native messaging host " + native_host_name + " is not registered"; return base::FilePath(); } base::FilePath manifest_path(manifest_path_str); if (!manifest_path.IsAbsolute()) { *error_message = "Path to native messaging host manifest must be absolute."; return base::FilePath(); } return manifest_path; } // static bool NativeProcessLauncher::LaunchNativeProcess( const CommandLine& command_line, base::ProcessHandle* process_handle, base::PlatformFile* read_file, base::PlatformFile* write_file) { // Timeout for the IO pipes. const DWORD kTimeoutMs = 5000; // Windows will use default buffer size when 0 is passed to // CreateNamedPipeW(). const DWORD kBufferSize = 0; if (!command_line.GetProgram().IsAbsolute()) { LOG(ERROR) << "Native Messaging host path must be absolute."; return false; } uint64 pipe_name_token; crypto::RandBytes(&pipe_name_token, sizeof(pipe_name_token)); string16 out_pipe_name = base::StringPrintf( L"\\\\.\\pipe\\chrome.nativeMessaging.out.%llx", pipe_name_token); string16 in_pipe_name = base::StringPrintf( L"\\\\.\\pipe\\chrome.nativeMessaging.in.%llx", pipe_name_token); // Create the pipes to read and write from. base::win::ScopedHandle stdout_pipe( CreateNamedPipeW(out_pipe_name.c_str(), PIPE_ACCESS_INBOUND | FILE_FLAG_OVERLAPPED | FILE_FLAG_FIRST_PIPE_INSTANCE, PIPE_TYPE_BYTE, 1, kBufferSize, kBufferSize, kTimeoutMs, NULL)); if (!stdout_pipe.IsValid()) { LOG(ERROR) << "Failed to create pipe " << out_pipe_name; return false; } base::win::ScopedHandle stdin_pipe( CreateNamedPipeW(in_pipe_name.c_str(), PIPE_ACCESS_OUTBOUND | FILE_FLAG_OVERLAPPED | FILE_FLAG_FIRST_PIPE_INSTANCE, PIPE_TYPE_BYTE, 1, kBufferSize, kBufferSize, kTimeoutMs, NULL)); if (!stdin_pipe.IsValid()) { LOG(ERROR) << "Failed to create pipe " << in_pipe_name; return false; } DWORD comspec_length = ::GetEnvironmentVariable(L"COMSPEC", NULL, 0); if (comspec_length == 0) { LOG(ERROR) << "COMSPEC is not set"; return false; } scoped_ptr<wchar_t[]> comspec(new wchar_t[comspec_length]); ::GetEnvironmentVariable(L"COMSPEC", comspec.get(), comspec_length); string16 command_line_string = command_line.GetCommandLineString(); string16 command = base::StringPrintf( L"%ls /c %ls < %ls > %ls", comspec.get(), command_line_string.c_str(), in_pipe_name.c_str(), out_pipe_name.c_str()); base::LaunchOptions options; options.start_hidden = true; base::ProcessHandle cmd_handle; if (!base::LaunchProcess(command.c_str(), options, &cmd_handle)) { LOG(ERROR) << "Error launching process " << command_line.GetProgram().MaybeAsASCII(); return false; } bool stdout_connected = ConnectNamedPipe(stdout_pipe.Get(), NULL) ? TRUE : GetLastError() == ERROR_PIPE_CONNECTED; bool stdin_connected = ConnectNamedPipe(stdin_pipe.Get(), NULL) ? TRUE : GetLastError() == ERROR_PIPE_CONNECTED; if (!stdout_connected || !stdin_connected) { base::KillProcess(cmd_handle, 0, false); base::CloseProcessHandle(cmd_handle); LOG(ERROR) << "Failed to connect IO pipes when starting " << command_line.GetProgram().MaybeAsASCII(); return false; } *process_handle = cmd_handle; *read_file = stdout_pipe.Take(); *write_file = stdin_pipe.Take(); return true; } } // namespace extensions
15635e28adf43af1385ab117ccf07de17f96e106
9dae417fa03cc2f34becc1b2e16b7b19a19ab5f4
/tensorflow/compiler/tf2xla/xla_compiler.h
6ab8bde542d0586baeea1f66a9b4bcdf95f5b1e6
[ "Apache-2.0" ]
permissive
Trustyboard/tensorflow
84c780f26606f97f8dcc101bde64eb14693e188a
73e53d634306df3f209588e7fa24c088a532c0f5
refs/heads/master
2020-07-15T07:25:52.608059
2019-08-31T05:49:43
2019-08-31T05:55:53
205,510,284
2
0
Apache-2.0
2019-08-31T07:15:20
2019-08-31T07:15:20
null
UTF-8
C++
false
false
22,775
h
/* Copyright 2017 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ==============================================================================*/ #ifndef TENSORFLOW_COMPILER_TF2XLA_XLA_COMPILER_H_ #define TENSORFLOW_COMPILER_TF2XLA_XLA_COMPILER_H_ #include <stack> #include "absl/types/span.h" #include "absl/types/variant.h" #include "tensorflow/compiler/tf2xla/host_compute_metadata.pb.h" #include "tensorflow/compiler/tf2xla/xla_compilation_device.h" #include "tensorflow/compiler/tf2xla/xla_expression.h" #include "tensorflow/compiler/tf2xla/xla_op_registry.h" #include "tensorflow/compiler/xla/client/local_client.h" #include "tensorflow/compiler/xla/client/xla_builder.h" #include "tensorflow/compiler/xla/client/xla_computation.h" #include "tensorflow/compiler/xla/status_macros.h" #include "tensorflow/core/common_runtime/device.h" #include "tensorflow/core/common_runtime/device_mgr.h" #include "tensorflow/core/common_runtime/function.h" #include "tensorflow/core/framework/function.h" #include "tensorflow/core/lib/core/errors.h" #include "tensorflow/core/platform/env.h" #include "tensorflow/core/platform/mutex.h" #include "tensorflow/core/platform/notification.h" #include "tensorflow/core/platform/thread_annotations.h" #include "tensorflow/core/public/version.h" namespace tensorflow { class XlaContext; // The XlaCompiler class is responsible for compilation of a self-contained // subgraph of a TensorFlow computation using the XLA linear algebra runtime. // It does a symbolic execution of the graph starting from specific input // shapes, using a JIT device to convert operators into XLA computations. // // XlaCompiler is typically invoked from an `XlaLaunch` operator once the // shapes of all input parameters to the computation are known. This is // because the symbolic execution requires known shapes for all operations. // // XlaCompiler compiles Tensorflow graphs that received inputs via _Arg nodes, // and return outputs via _Retval nodes. // // The XlaCompiler requires one Argument struct for each _Arg index, that // describes each argument. Arguments can be compile-time constants // (kind kConstant), run-time parameters (kind kParameter), or resources // (kind kResource). // // Only kParameter and initialized kResource arguments become runtime parameters // to the generated XLA computation. // // The run-time outputs of the XLA computation are arranged in the following // order: // +------------------+-----------------------------------------+ // | _Retval values | Updated values of kResource arguments | // +------------------+-----------------------------------------+ // _Retval values are ordered by _Retval index, whereas kResource values are // ordered by the original _Arg position of the variable. // // If a shape representation function is provided as part of // XlaCompiler::CompileOptions, kParameter arguments and return values to an // entry computation will be reshaped in accordance to the shape function. // Arguments and return values to a non-entry computation are not reshaped. // Variable resource arguments are passed and returned in reshaped form, even // for non-entry computations. This feature allows TensorFlow to keep on-device // tensors with a different shape to their representation inside the XLA // computation. // // In computation outputs, updated kResource values are placed the end. When // emitting While loop bodies, we must ensure that the loop body has // identical input and output signatures. By passing variable values // at the end of the argument list and using the // `return_updated_values_for_all_variables` option, we can ensure that the // input and output values of resources appear at the same positions. // // Resources are passed as parameters or returned as resource updates in // "packed" form. // kStack resources are packed as (array, size of stack) XLA tuples. // kTensorArray resources without gradients are packed as the array that // backs the TensorArray. If gradients are present (`tensor_array_gradients`), // the packed representation is a (array, gradient0, gradient1, ...) tuple, // where gradient_k is the value of the k-th gradient in the // `tensor_array_gradients` ordered set. class XlaCompiler { public: // Describes how to derive the value of each _Arg node in the graph/function // being compiled. There must be one Argument for each _Arg index. struct Argument { enum Kind { // Default value; not a valid kind. kInvalid, // Argument is a compile-time constant. No associated runtime parameter. kConstant, // Argument is a Variable, TensorArray, or Stack resource. Has an // associated runtime parameter iff `initialized` is true. kResource, // Argument is a run-time parameter. kParameter, // Argument is an XLA token. kToken, // Argument is a TensorList. kTensorList, }; Kind kind = kInvalid; // The type of the argument. If the argument is a resource, this // is the type of the variable's value, not DT_RESOURCE. DataType type = DT_INVALID; // The shape of the argument. For: // * a parameter: the shape of the parameter. We allow setting the xla shape // if known. This helps avoid conversions to and from TensorShape. // * a constant: ignored; the shape given by constant_value is used // instead. // * an uninitialized resource: ignored. We don't yet know the shape of an // uninitialized resource (otherwise we would have initialized it!) // * an initialized variable: the shape of the variable's value. // * an initialized TensorArray or Stack resource: the shape of an entry in // the TensorArray/Stack. Note this is the size of a single entry, not the // XLA data structure that represents the complete stack/array. absl::variant<TensorShape, xla::Shape> shape; // The value of the argument, if it is a compile-time constant. Must be a // host-memory tensor. Tensor constant_value; // The name of this argument, used for debugging. string name; // For a kResource, what kind of resource is it? XlaResource::Kind resource_kind = XlaResource::kInvalid; // For a kResource, has this resource been initialized? bool initialized = false; // For a TensorArray or Stack resource, what is the array's declared size? // (Used for lazy initialization.) int64 max_array_size = -1; // TensorArray resource parameters are passed as (array, gradient array 0, // ..., gradient array k), where the gradient arrays are in the same order // as `tensor_array_gradients`. std::set<string> tensor_array_gradients; // dynamic dims to arg number map. Empty if no dynamic shapes. std::map<int32, int32> dynamic_dim_to_arg_num_map; bool is_pad_arg = false; // Whether this argument will receive the same data across all replicas. bool is_same_data_across_replicas = false; bool operator==(const Argument& other) const; // Returns a human-readable summary of the argument. string HumanString() const; // Returns the dimension sizes for either TensorShape or xla::Shape. std::vector<int64> DimensionSizes() const; // Returns the human-readable string for either TensorShape or xla::Shape. string ShapeHumanString() const; }; // Options pertaining to an individual call to CompileGraph() or // CompileFunction(). struct CompileOptions { // If `use_tuple_arg` is true, a single tuple parameter will be used for all // arguments; if false, each argument gets its own parameter. bool use_tuple_arg = false; // If 'return_updated_values_for_all_resources' is true, then updated // values of all resource arguments will be included in the // 'resource_updates' of the computation, even if the resource was not // modified by the computation. Used when compiling loop bodies to ensure // the input and output signatures match. bool return_updated_values_for_all_resources = false; // If 'resolve_compile_time_constants' is true, then outputs of a // computation that are known to be compile-time constants will be returned // as Tensors at compile-time, rather than as run-time outputs of the // computation. bool resolve_compile_time_constants = true; // If 'always_return_tuple' is true, then the output of a computation will // always be a tuple. Otherwise, a single-element output will not be wrapped // in a tuple. bool always_return_tuple = true; // True when compiling the entry computation, false for subcomputations // (while, call, etc.) bool is_entry_computation = true; // True when we should add XLA input & output to the graph/function. bool add_token_input_output = false; }; struct OutputDescription { // Type and shape of the output. The shape is the unflattened shape. // When `type` is DT_RESOURCE, `shape` is the shape of the resource // variable's value. DataType type; TensorShape shape; // Constant output value, if known to be constant at JIT compilation time. // 'Tensor' is in host memory. bool is_constant = false; Tensor constant_value; // When this output is a resource, i.e. `type == DT_RESOURCE`, this is // the index of the input that contains the resource. int input_index; // Whether this output is a TensorList. bool is_tensor_list = false; }; // Describes a variable write side effect of the computation. struct ResourceUpdate { // Index of the input that contains the variable resource to write to. int input_index; // Type and shape of the tensor to be written back. // The `shape` field has the same meaning as the Argument::shape field. DataType type; TensorShape shape; // Was the value of the variable modified by the computation? // (Always true, unless `return_updated_values_for_all_resources` is true.) bool modified; // If the resource is a TensorArray, the set of gradients read or written. std::set<string> tensor_array_gradients_accessed; }; struct CompilationResult { // Vector that maps from the parameters of the XLA computation to their // original argument positions. To handle compile-time constant inputs, the // parameters to the XLA computation may be a subset of the original // arguments. The relative ordering of parameters are maintained. std::vector<int> input_mapping; // Input shapes of the computation. If we are flattening inputs, these are // the flattened shapes. std::vector<xla::Shape> xla_input_shapes; // Output shape in XLA format. The output shape is always a tuple. If we // are flattening outputs, these are the flattened shapes. xla::Shape xla_output_shape; // TensorFlow shapes of outputs, together with the values of any // constant arguments. Vector indexed by Tensorflow _Retval number, // containing both constant and non-constant results. std::vector<OutputDescription> outputs; // TensorFlow shapes and types of sends/recvs from HostCompute Ops to their // matching RecvAtHost/SendFromHost Ops in the outer graph. tf2xla::HostComputeMetadata host_compute_metadata; // Resources whose values were updated by the computation, ordered // by return value position (which is the same as the order the resources // were passed as arguments). Resource updates follow the non-constant // results in the outputs of XLA computation. std::vector<ResourceUpdate> resource_updates; // The XLA computation built from the tensorflow subgraph. std::shared_ptr<xla::XlaComputation> computation; }; typedef std::function<xla::StatusOr<xla::Shape>(const TensorShape&, DataType, bool)> ShapeRepresentationFn; struct Options { // Name of the compilation device to use. It must be set by the caller. // The default empty value is invalid. DeviceType device_type = DeviceType(""); // The device to use during compilation to execute instructions on, for // example for auto-tuning. // Valid values are defined by `xla::Backend::devices_ordinal_supported()`. // -1 indicates the default device should be used. int device_ordinal = -1; xla::Client* client = nullptr; // Function library in which to find function definitions. Must be non-null. const FunctionLibraryDefinition* flib_def = nullptr; // The graph def version to be compiled. int graph_def_version = TF_GRAPH_DEF_VERSION; // If 'allow_cpu_custom_calls' is true, kernels may make use of CustomCall() // for CPU. bool allow_cpu_custom_calls = false; // If both this and 'allow_cpu_custom_calls' are true then tf.fake_quant_* // ops will be emitted as custom calls to a 'fake_quant_with_min_max_vars' // function accepting the input, min, max, num_bits, and narrow_range values // as runtime arguments. bool custom_fake_quant_op_calls = false; // If set, the XLA representation of variables represented to XLA as the // shape given by this shape function. Variables are reshaped to this shape // on write, and reshaped to their original shape on read. ShapeRepresentationFn shape_representation_fn; // If not nullptr, populate_resource_manager is called with the // compilation device's resource manager when the compilation // device is created, and can be used to create metadata objects // that can be accessed by XLA op kernels. std::function<Status(ResourceMgr*)>* populate_resource_manager = nullptr; // If not nullptr, this memory allocator can be used by the compiler for // temporary allocations it might want to make during compilation. // // For example, the compiler may want to try out different algorithms and // choose the fastest one, and it might run those algorithms over buffers // created using this allocator. // // The compiler can function correctly without an explicit allocator given // here, but on some devices (notably, GPUs), TensorFlow tends to eagerly // allocate most or all available memory on the device, leaving none for the // compiler to access, unless it can use TensorFlow's allocator. se::DeviceMemoryAllocator* device_allocator = nullptr; // Alias input and output buffers for parameters that are passed-through XLA // modules without being changed. bool alias_passthrough_params = false; }; explicit XlaCompiler(Options options); ~XlaCompiler(); Status CompileFunction(const CompileOptions& options, const NameAttrList& fn_name_attrs, absl::Span<const Argument> args, CompilationResult* result); // Compiles a tensorflow::Graph into an xla::XlaComputation. // Similar to CompileFunction, but takes a Graph as input rather than a // function. Status CompileGraph( const CompileOptions& options, string const& name, std::unique_ptr<Graph> graph, absl::Span<const Argument> args, absl::Span<const xla::XlaBuilder::InputOutputAlias> user_aliases, CompilationResult* result); // Compiles a single Op, given by `node_def`, into an // xla::XlaComputation. Similar to CompileFunction but takes a single Op as // input. Status CompileSingleOp(const CompileOptions& options, const NodeDef& node_def, absl::Span<const Argument> args, absl::Span<const DataType> result_types, CompilationResult* result); // Returns the shape of the XLA parameter for an argument 'arg'. // See the class comment for more details about the argument passing // convention. Status XLAShapeForArgument(const Argument& arg, bool is_entry_computation, xla::Shape* xla_shape) const; // Retrieves the channel handle associated with `key`. Allocates // a new channel handle if none exists. // Channel handles can be used to communicate between different // computations. Computations that communicate should be compiled with the // same XlaCompiler. Status GetChannelHandle(const string& key, xla::ChannelHandle* channel); // Retrieves the host-to-device channel handle associated with `key`. // Allocates a new channel handle if none exists. Status GetHostToDeviceChannelHandle(const string& key, xla::ChannelHandle* channel); // Retrieves the device-to-host channel handle associated with `key`. // Allocates a new channel handle if none exists. Status GetDeviceToHostChannelHandle(const string& key, xla::ChannelHandle* channel); // Sets the shapes and types for the device to host transfer associated with // 'key'. Status SetDeviceToHostMetadata(const string& key, absl::Span<const DataType> types, absl::Span<const TensorShape> shapes); // Gets the shapes the device to host transfer associated with 'key'. Status GetDeviceToHostShapes(const string& key, std::vector<TensorShape>* shapes) const; // Sets the shapes and types for the host to device transfer associated with // 'key'. Status SetHostToDeviceMetadata(const string& key, absl::Span<const DataType> types, absl::Span<const TensorShape> shapes); // In order to avoid deadlocks from dependencies in host computations, it can // be necessary to enforce a partial order on the execution of HostCompute // Ops. In particular it may be necessary to constrain the SendToHost for one // HostCompute to run before blocking on the RecvAtHost for another // HostCompute. The compiler maintains a mapping from 'host_compute_name' to // handle, where the handle is an 'output' of the HostCompute Op corresponding // to 'host_compute_name'. Another HostCompute Op that needs to be sequenced // later can add the handle as an 'input' to enforce the constraints. // 'host_compute_name' can be any string the client wishes to use to identify // a given HostCompute Op as long as the names are unique within the // compilation. Status GetHostComputeControlDependency(const string& host_compute_name, xla::XlaOp* handle); Status SetHostComputeControlDependency(const string& host_compute_name, const xla::XlaOp& handle); const Options& options() const { return options_; } xla::Client* client() const { return options_.client; } FunctionLibraryRuntime* flib_runtime() const { return flib_runtime_; } void PushNodeTokenMapping(); Status PopNodeTokenMapping(); Status SetNodeToken(const string& node_name, const xla::XlaOp& op); xla::StatusOr<xla::XlaOp> GetNodeToken(const string& node_name); // Sets the function body `fbody` to the one registered as `function`. Status FindFunctionBody(const NameAttrList& function, const FunctionBody** fbody); private: // Returns the optimized graph object in this function body. std::unique_ptr<Graph> GetGraph(const FunctionBody* fbody); // Builds XLA computations for each of the arguments to the computation. // `args` are the arguments to the computation. Status BuildArguments(const Graph& graph, const std::vector<XlaCompiler::Argument>& args, bool use_tuple_arg, xla::XlaBuilder* builder, XlaContext* context, const std::map<int, xla::OpSharding>& arg_shardings, std::vector<XlaExpression>* arg_expressions, std::vector<int>* input_to_args, std::vector<xla::Shape>* input_shapes, bool is_entry_computation); // Graph compiler needs to know how to get an optimized graph from a function // body. friend class GraphCompiler; friend class XlaCompilerTest; Options options_; // Status set to non-OK in the constructor if initialization fails. Status initialization_status_; // Returns the next step sequence number. int64 NextStepId(); // Internal sequence number for steps executed on the compilation device. int64 next_step_id_; XlaCompilationDevice* device_; // Owned by device_mgr_ StaticDeviceMgr device_mgr_; // To avoid copying the client's function library, use a local function // library and runtime for functions created as part of the functionalize // control flow transformation. std::unique_ptr<FunctionLibraryDefinition> local_flib_def_; std::unique_ptr<ProcessFunctionLibraryRuntime> pflr_; std::unique_ptr<ProcessFunctionLibraryRuntime> local_pflr_; FunctionLibraryRuntime* local_flib_runtime_; // owned by local_pflr_. FunctionLibraryRuntime* flib_runtime_; // owned by pflr_. struct SignatureHash { uint64 operator()( const std::pair<string, std::vector<Argument>>& signature) const; }; std::unordered_map<std::pair<string, std::vector<Argument>>, CompilationResult, SignatureHash> cache_; std::unordered_map<string, xla::ChannelHandle> channels_; std::unordered_map<string, tf2xla::HostTransferMetadata> host_compute_sends_; std::unordered_map<string, tf2xla::HostTransferMetadata> host_compute_recvs_; std::unordered_map<string, xla::XlaOp> host_compute_control_output_; // This is used to store <node name, token output> mapping. Side-effecting // ops call SetNodeToken() to record its token output, so later side-effecting // ops can use GetNodeToken() to get it and use it as token input. // // It's a stack because we need a mapping like this for each level of nested // CompileGraph() call. In CompileGraph(), we will push a new mapping to the // stack, and pop the mapping before returning. std::stack<std::map<string, xla::XlaOp>> node_token_mapping_stack_; TF_DISALLOW_COPY_AND_ASSIGN(XlaCompiler); }; } // namespace tensorflow #endif // TENSORFLOW_COMPILER_TF2XLA_XLA_COMPILER_H_
2fd2c089c88d4108e57aa4af62a83780796ff64e
683c65f1357209f4166b89c715adb55113f37869
/qtsrc/emulelectrometer.h
299339fed3a81ab2968d19fc8f45c0c92ad2d9c8
[]
no_license
Ivansquark/Bigprog
5c58bef7d220881d742962664d85829628a70442
755e5536998cade3819756b9295d85bb83451e42
refs/heads/master
2022-12-04T12:58:28.922116
2020-08-17T10:38:08
2020-08-17T10:38:08
288,150,890
0
0
null
null
null
null
UTF-8
C++
false
false
749
h
#ifndef EMULELECTROMETER_H #define EMULELECTROMETER_H #include <QObject> #include <QTimer> #include <QDebug> class EmulElectrometer:public QObject { Q_OBJECT public: EmulElectrometer(); ~EmulElectrometer(); signals: void sendd(QString str); private slots: void timeOut(); private: QString comString{"273f4f5f6f7f\0"}; //инициализируем строку данными наподобие данных приходящих с АЦП электрометра QString sendString{""}; QTimer *timer{nullptr}; long iter=0; public: void start(); //старт эмулятора void stop(); //стоп эмулятора //QString getString(); }; #endif // EMULELECTROMETER_H
1e4b5d7eddeee467c908b26e0501cb4938b0923c
aa311af8250cab6b8b686b43a39a7386961cc6d0
/Figures/CLine.h
588534fb91d8a0893beb6ad78f8b0ad58e9b0c33
[]
no_license
phella/Paint-for-kids
aba37a8bf61cdcaacb8c1150b55df2525b2cc76e
56461e50adf4bec50028d2c76063410579da0350
refs/heads/master
2022-12-29T16:03:33.810320
2020-10-21T08:06:21
2020-10-21T08:06:21
305,951,597
0
0
null
null
null
null
UTF-8
C++
false
false
574
h
#ifndef CLine_H #define CLine_H #include "CFigure.h" class CLine : public CFigure { private: Point point1; Point point2; public: CLine() {} CLine(Point , Point, GfxInfo FigureGfxInfo ); virtual void Draw(Output* pOut) const; virtual bool check(int,int); virtual void PrintInfo(Output* pOut) ; int minn(int ,int ); int maxx(int,int); virtual CFigure* TransferFigure(Point p); virtual void save(ofstream &savefile); virtual void Load(ifstream &loadfile); virtual CFigure* copy(); virtual int gettype() ; void rotate(Point&,Point&,Point&,GfxInfo&); }; #endif
54f8a88df49b29e4e711447c1335fe4148c18af4
6e5f1a4d98aac14aaad8a6e334292f2446531d7d
/src/test/versionbits_tests.cpp
092b15289ea9a3fe4d72c07e061b81b2a9053df6
[ "MIT" ]
permissive
sforpay/sfor
28fbead51c3e21dab7d8280558c20d23ad936346
0d84f7de9b87418855d77ca503bfc9fa56a87f14
refs/heads/master
2020-08-20T07:34:18.989375
2019-10-19T11:36:42
2019-10-19T11:36:42
215,996,872
0
0
null
null
null
null
UTF-8
C++
false
false
17,817
cpp
// Copyright (c) 2014-2016 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "chain.h" #include "versionbits.h" #include "test/test_sfor.h" #include "test/test_random.h" #include "chainparams.h" #include "validation.h" #include "consensus/params.h" #include <boost/test/unit_test.hpp> /* Define a virtual block time, one block per 10 minutes after Nov 14 2014, 0:55:36am */ int32_t TestTime(int nHeight) { return 1415926536 + 600 * nHeight; } static const Consensus::Params paramsDummy = Consensus::Params(); class TestConditionChecker : public AbstractThresholdConditionChecker { private: mutable ThresholdConditionCache cache; public: int64_t BeginTime(const Consensus::Params& params) const override { return TestTime(10000); } int64_t EndTime(const Consensus::Params& params) const override { return TestTime(20000); } int Period(const Consensus::Params& params) const override { return 1000; } int Threshold(const Consensus::Params& params) const override { return 900; } bool Condition(const CBlockIndex* pindex, const Consensus::Params& params) const override { return (pindex->nVersion & 0x100); } ThresholdState GetStateFor(const CBlockIndex* pindexPrev) const { return AbstractThresholdConditionChecker::GetStateFor(pindexPrev, paramsDummy, cache); } int GetStateSinceHeightFor(const CBlockIndex* pindexPrev) const { return AbstractThresholdConditionChecker::GetStateSinceHeightFor(pindexPrev, paramsDummy, cache); } }; #define CHECKERS 6 class VersionBitsTester { // A fake blockchain std::vector<CBlockIndex*> vpblock; // 6 independent checkers for the same bit. // The first one performs all checks, the second only 50%, the third only 25%, etc... // This is to test whether lack of cached information leads to the same results. TestConditionChecker checker[CHECKERS]; // Test counter (to identify failures) int num; public: VersionBitsTester() : num(0) {} VersionBitsTester& Reset() { for (unsigned int i = 0; i < vpblock.size(); i++) { delete vpblock[i]; } for (unsigned int i = 0; i < CHECKERS; i++) { checker[i] = TestConditionChecker(); } vpblock.clear(); return *this; } ~VersionBitsTester() { Reset(); } VersionBitsTester& Mine(unsigned int height, int32_t nTime, int32_t nVersion) { while (vpblock.size() < height) { CBlockIndex* pindex = new CBlockIndex(); pindex->nHeight = vpblock.size(); pindex->pprev = vpblock.size() > 0 ? vpblock.back() : NULL; pindex->nTime = nTime; pindex->nVersion = nVersion; pindex->BuildSkip(); vpblock.push_back(pindex); } return *this; } VersionBitsTester& TestStateSinceHeight(int height) { for (int i = 0; i < CHECKERS; i++) { if ((insecure_rand() & ((1 << i) - 1)) == 0) { BOOST_CHECK_MESSAGE(checker[i].GetStateSinceHeightFor(vpblock.empty() ? NULL : vpblock.back()) == height, strprintf("Test %i for StateSinceHeight", num)); } } num++; return *this; } VersionBitsTester& TestDefined() { for (int i = 0; i < CHECKERS; i++) { if ((insecure_rand() & ((1 << i) - 1)) == 0) { BOOST_CHECK_MESSAGE(checker[i].GetStateFor(vpblock.empty() ? NULL : vpblock.back()) == THRESHOLD_DEFINED, strprintf("Test %i for DEFINED", num)); } } num++; return *this; } VersionBitsTester& TestStarted() { for (int i = 0; i < CHECKERS; i++) { if ((insecure_rand() & ((1 << i) - 1)) == 0) { BOOST_CHECK_MESSAGE(checker[i].GetStateFor(vpblock.empty() ? NULL : vpblock.back()) == THRESHOLD_STARTED, strprintf("Test %i for STARTED", num)); } } num++; return *this; } VersionBitsTester& TestLockedIn() { for (int i = 0; i < CHECKERS; i++) { if ((insecure_rand() & ((1 << i) - 1)) == 0) { BOOST_CHECK_MESSAGE(checker[i].GetStateFor(vpblock.empty() ? NULL : vpblock.back()) == THRESHOLD_LOCKED_IN, strprintf("Test %i for LOCKED_IN", num)); } } num++; return *this; } VersionBitsTester& TestActive() { for (int i = 0; i < CHECKERS; i++) { if ((insecure_rand() & ((1 << i) - 1)) == 0) { BOOST_CHECK_MESSAGE(checker[i].GetStateFor(vpblock.empty() ? NULL : vpblock.back()) == THRESHOLD_ACTIVE, strprintf("Test %i for ACTIVE", num)); } } num++; return *this; } VersionBitsTester& TestFailed() { for (int i = 0; i < CHECKERS; i++) { if ((insecure_rand() & ((1 << i) - 1)) == 0) { BOOST_CHECK_MESSAGE(checker[i].GetStateFor(vpblock.empty() ? NULL : vpblock.back()) == THRESHOLD_FAILED, strprintf("Test %i for FAILED", num)); } } num++; return *this; } CBlockIndex * Tip() { return vpblock.size() ? vpblock.back() : NULL; } }; BOOST_FIXTURE_TEST_SUITE(versionbits_tests, TestingSetup) BOOST_AUTO_TEST_CASE(versionbits_test) { for (int i = 0; i < 64; i++) { // DEFINED -> FAILED VersionBitsTester().TestDefined().TestStateSinceHeight(0) .Mine(1, TestTime(1), 0x100).TestDefined().TestStateSinceHeight(0) .Mine(11, TestTime(11), 0x100).TestDefined().TestStateSinceHeight(0) .Mine(989, TestTime(989), 0x100).TestDefined().TestStateSinceHeight(0) .Mine(999, TestTime(20000), 0x100).TestDefined().TestStateSinceHeight(0) .Mine(1000, TestTime(20000), 0x100).TestFailed().TestStateSinceHeight(1000) .Mine(1999, TestTime(30001), 0x100).TestFailed().TestStateSinceHeight(1000) .Mine(2000, TestTime(30002), 0x100).TestFailed().TestStateSinceHeight(1000) .Mine(2001, TestTime(30003), 0x100).TestFailed().TestStateSinceHeight(1000) .Mine(2999, TestTime(30004), 0x100).TestFailed().TestStateSinceHeight(1000) .Mine(3000, TestTime(30005), 0x100).TestFailed().TestStateSinceHeight(1000) // DEFINED -> STARTED -> FAILED .Reset().TestDefined().TestStateSinceHeight(0) .Mine(1, TestTime(1), 0).TestDefined().TestStateSinceHeight(0) .Mine(1000, TestTime(10000) - 1, 0x100).TestDefined().TestStateSinceHeight(0) // One second more and it would be defined .Mine(2000, TestTime(10000), 0x100).TestStarted().TestStateSinceHeight(2000) // So that's what happens the next period .Mine(2051, TestTime(10010), 0).TestStarted().TestStateSinceHeight(2000) // 51 old blocks .Mine(2950, TestTime(10020), 0x100).TestStarted().TestStateSinceHeight(2000) // 899 new blocks .Mine(3000, TestTime(20000), 0).TestFailed().TestStateSinceHeight(3000) // 50 old blocks (so 899 out of the past 1000) .Mine(4000, TestTime(20010), 0x100).TestFailed().TestStateSinceHeight(3000) // DEFINED -> STARTED -> FAILED while threshold reached .Reset().TestDefined().TestStateSinceHeight(0) .Mine(1, TestTime(1), 0).TestDefined().TestStateSinceHeight(0) .Mine(1000, TestTime(10000) - 1, 0x101).TestDefined().TestStateSinceHeight(0) // One second more and it would be defined .Mine(2000, TestTime(10000), 0x101).TestStarted().TestStateSinceHeight(2000) // So that's what happens the next period .Mine(2999, TestTime(30000), 0x100).TestStarted().TestStateSinceHeight(2000) // 999 new blocks .Mine(3000, TestTime(30000), 0x100).TestFailed().TestStateSinceHeight(3000) // 1 new block (so 1000 out of the past 1000 are new) .Mine(3999, TestTime(30001), 0).TestFailed().TestStateSinceHeight(3000) .Mine(4000, TestTime(30002), 0).TestFailed().TestStateSinceHeight(3000) .Mine(14333, TestTime(30003), 0).TestFailed().TestStateSinceHeight(3000) .Mine(24000, TestTime(40000), 0).TestFailed().TestStateSinceHeight(3000) // DEFINED -> STARTED -> LOCKEDIN at the last minute -> ACTIVE .Reset().TestDefined() .Mine(1, TestTime(1), 0).TestDefined().TestStateSinceHeight(0) .Mine(1000, TestTime(10000) - 1, 0x101).TestDefined().TestStateSinceHeight(0) // One second more and it would be defined .Mine(2000, TestTime(10000), 0x101).TestStarted().TestStateSinceHeight(2000) // So that's what happens the next period .Mine(2050, TestTime(10010), 0x200).TestStarted().TestStateSinceHeight(2000) // 50 old blocks .Mine(2950, TestTime(10020), 0x100).TestStarted().TestStateSinceHeight(2000) // 900 new blocks .Mine(2999, TestTime(19999), 0x200).TestStarted().TestStateSinceHeight(2000) // 49 old blocks .Mine(3000, TestTime(29999), 0x200).TestLockedIn().TestStateSinceHeight(3000) // 1 old block (so 900 out of the past 1000) .Mine(3999, TestTime(30001), 0).TestLockedIn().TestStateSinceHeight(3000) .Mine(4000, TestTime(30002), 0).TestActive().TestStateSinceHeight(4000) .Mine(14333, TestTime(30003), 0).TestActive().TestStateSinceHeight(4000) .Mine(24000, TestTime(40000), 0).TestActive().TestStateSinceHeight(4000) // DEFINED multiple periods -> STARTED multiple periods -> FAILED .Reset().TestDefined().TestStateSinceHeight(0) .Mine(999, TestTime(999), 0).TestDefined().TestStateSinceHeight(0) .Mine(1000, TestTime(1000), 0).TestDefined().TestStateSinceHeight(0) .Mine(2000, TestTime(2000), 0).TestDefined().TestStateSinceHeight(0) .Mine(3000, TestTime(10000), 0).TestStarted().TestStateSinceHeight(3000) .Mine(4000, TestTime(10000), 0).TestStarted().TestStateSinceHeight(3000) .Mine(5000, TestTime(10000), 0).TestStarted().TestStateSinceHeight(3000) .Mine(6000, TestTime(20000), 0).TestFailed().TestStateSinceHeight(6000) .Mine(7000, TestTime(20000), 0x100).TestFailed().TestStateSinceHeight(6000); } // Sanity checks of version bit deployments const Consensus::Params &mainnetParams = Params(CBaseChainParams::MAIN).GetConsensus(); for (int i=0; i<(int) Consensus::MAX_VERSION_BITS_DEPLOYMENTS; i++) { uint32_t bitmask = VersionBitsMask(mainnetParams, (Consensus::DeploymentPos)i); // Make sure that no deployment tries to set an invalid bit. BOOST_CHECK_EQUAL(bitmask & ~(uint32_t)VERSIONBITS_TOP_MASK, bitmask); // Verify that the deployment windows of different deployment using the // same bit are disjoint. // This test may need modification at such time as a new deployment // is proposed that reuses the bit of an activated soft fork, before the // end time of that soft fork. (Alternatively, the end time of that // activated soft fork could be later changed to be earlier to avoid // overlap.) for (int j=i+1; j<(int) Consensus::MAX_VERSION_BITS_DEPLOYMENTS; j++) { if (VersionBitsMask(mainnetParams, (Consensus::DeploymentPos)j) == bitmask) { BOOST_CHECK(mainnetParams.vDeployments[j].nStartTime > mainnetParams.vDeployments[i].nTimeout || mainnetParams.vDeployments[i].nStartTime > mainnetParams.vDeployments[j].nTimeout); } } } } BOOST_AUTO_TEST_CASE(versionbits_computeblockversion) { // Check that ComputeBlockVersion will set the appropriate bit correctly // on mainnet. const Consensus::Params &mainnetParams = Params(CBaseChainParams::MAIN).GetConsensus(); // Use the TESTDUMMY deployment for testing purposes. int64_t bit = mainnetParams.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].bit; int64_t nStartTime = mainnetParams.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].nStartTime; int64_t nTimeout = mainnetParams.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].nTimeout; assert(nStartTime < nTimeout); // In the first chain, test that the bit is set by CBV until it has failed. // In the second chain, test the bit is set by CBV while STARTED and // LOCKED-IN, and then no longer set while ACTIVE. VersionBitsTester firstChain, secondChain; // Start generating blocks before nStartTime int64_t nTime = nStartTime - 1; // Before MedianTimePast of the chain has crossed nStartTime, the bit // should not be set. CBlockIndex *lastBlock = NULL; lastBlock = firstChain.Mine(2016, nTime, VERSIONBITS_LAST_OLD_BLOCK_VERSION).Tip(); BOOST_CHECK_EQUAL(ComputeBlockVersion(lastBlock, mainnetParams) & (1<<bit), 0); // Mine 2011 more blocks at the old time, and check that CBV isn't setting the bit yet. for (int i=1; i<2012; i++) { lastBlock = firstChain.Mine(2016+i, nTime, VERSIONBITS_LAST_OLD_BLOCK_VERSION).Tip(); // This works because VERSIONBITS_LAST_OLD_BLOCK_VERSION happens // to be 4, and the bit we're testing happens to be bit 28. BOOST_CHECK_EQUAL(ComputeBlockVersion(lastBlock, mainnetParams) & (1<<bit), 0); } // Now mine 5 more blocks at the start time -- MTP should not have passed yet, so // CBV should still not yet set the bit. nTime = nStartTime; for (int i=2012; i<=2016; i++) { lastBlock = firstChain.Mine(2016+i, nTime, VERSIONBITS_LAST_OLD_BLOCK_VERSION).Tip(); BOOST_CHECK_EQUAL(ComputeBlockVersion(lastBlock, mainnetParams) & (1<<bit), 0); } // Advance to the next period and transition to STARTED, lastBlock = firstChain.Mine(6048, nTime, VERSIONBITS_LAST_OLD_BLOCK_VERSION).Tip(); // so ComputeBlockVersion should now set the bit, BOOST_CHECK((ComputeBlockVersion(lastBlock, mainnetParams) & (1<<bit)) != 0); // and should also be using the VERSIONBITS_TOP_BITS. BOOST_CHECK_EQUAL(ComputeBlockVersion(lastBlock, mainnetParams) & VERSIONBITS_TOP_MASK, VERSIONBITS_TOP_BITS); // Check that ComputeBlockVersion will set the bit until nTimeout nTime += 600; int blocksToMine = 4032; // test blocks for up to 2 time periods int nHeight = 6048; // These blocks are all before nTimeout is reached. while (nTime < nTimeout && blocksToMine > 0) { lastBlock = firstChain.Mine(nHeight+1, nTime, VERSIONBITS_LAST_OLD_BLOCK_VERSION).Tip(); BOOST_CHECK((ComputeBlockVersion(lastBlock, mainnetParams) & (1<<bit)) != 0); BOOST_CHECK_EQUAL(ComputeBlockVersion(lastBlock, mainnetParams) & VERSIONBITS_TOP_MASK, VERSIONBITS_TOP_BITS); blocksToMine--; nTime += 600; nHeight += 1; } nTime = nTimeout; // FAILED is only triggered at the end of a period, so CBV should be setting // the bit until the period transition. for (int i=0; i<2015; i++) { lastBlock = firstChain.Mine(nHeight+1, nTime, VERSIONBITS_LAST_OLD_BLOCK_VERSION).Tip(); BOOST_CHECK((ComputeBlockVersion(lastBlock, mainnetParams) & (1<<bit)) != 0); nHeight += 1; } // The next block should trigger no longer setting the bit. lastBlock = firstChain.Mine(nHeight+1, nTime, VERSIONBITS_LAST_OLD_BLOCK_VERSION).Tip(); BOOST_CHECK_EQUAL(ComputeBlockVersion(lastBlock, mainnetParams) & (1<<bit), 0); // On a new chain: // verify that the bit will be set after lock-in, and then stop being set // after activation. nTime = nStartTime; // Mine one period worth of blocks, and check that the bit will be on for the // next period. lastBlock = secondChain.Mine(2016, nStartTime, VERSIONBITS_LAST_OLD_BLOCK_VERSION).Tip(); BOOST_CHECK((ComputeBlockVersion(lastBlock, mainnetParams) & (1<<bit)) != 0); // Mine another period worth of blocks, signaling the new bit. lastBlock = secondChain.Mine(4032, nStartTime, VERSIONBITS_TOP_BITS | (1<<bit)).Tip(); // After one period of setting the bit on each block, it should have locked in. // We keep setting the bit for one more period though, until activation. BOOST_CHECK((ComputeBlockVersion(lastBlock, mainnetParams) & (1<<bit)) != 0); // Now check that we keep mining the block until the end of this period, and // then stop at the beginning of the next period. lastBlock = secondChain.Mine(6047, nStartTime, VERSIONBITS_LAST_OLD_BLOCK_VERSION).Tip(); BOOST_CHECK((ComputeBlockVersion(lastBlock, mainnetParams) & (1<<bit)) != 0); lastBlock = secondChain.Mine(6048, nStartTime, VERSIONBITS_LAST_OLD_BLOCK_VERSION).Tip(); BOOST_CHECK_EQUAL(ComputeBlockVersion(lastBlock, mainnetParams) & (1<<bit), 0); // Finally, verify that after a soft fork has activated, CBV no longer uses // VERSIONBITS_LAST_OLD_BLOCK_VERSION. //BOOST_CHECK_EQUAL(ComputeBlockVersion(lastBlock, mainnetParams) & VERSIONBITS_TOP_MASK, VERSIONBITS_TOP_BITS); } BOOST_AUTO_TEST_SUITE_END()
cfd04e5e3833a9aed6207f7ef365de91825adcb7
487cce96a6d2e9b3f73480f676835ef378194548
/windbg/userctrl.cpp
e77d34260ae17cc82def63b60fca243b22467348
[]
no_license
fromasmtodisasm/windbg
a11012e05fdfeeefb7aa571288046789844d928c
8d97f9aca0879f27a6e6a5b1442198c4b352141d
refs/heads/master
2021-05-26T12:44:09.714759
2013-09-20T16:40:15
2013-09-20T16:40:15
null
0
0
null
null
null
null
UTF-8
C++
false
false
13,906
cpp
/* * Copyright Microsoft 1991 * * Date Jan 09, 1991 * * Project Asterix/Obelix * * History * Date Initial Description * ---- ------- ----------- * 01-09-91 ChauV Created for use with Tools and Status bars. * */ #include "precomp.h" #pragma hdrstop /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++/ /* begin static function prototypes *****************************************/ /* user defined Rectangular box */ void DrawBitmapButton (HWND, LPRECT) ; /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++/ /* begin variable definitions ***********************************************/ static BOOL bTrack = FALSE ; // mouse down flag static WORD wOldState ; // preserve the control state just before // a button is being pushed. /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++/ /*** EnableQCQPCtrl ** ** Synopsis: ** void = EnableQCQPCtrl(hWnd, id, fEnable) ** ** Entry: ** hWnd - parent's handle ** id - control's ID ** fEnable - FALSE for disable ** ** Returns: ** nothing ** ** Description: ** This function enable or disable a control identified by the the ** parent's handle and the control's ID. If enable is FALSE, the control ** is grayed, otherwise it is activated. This function is only valid to ** pushbutton style (QCQP_CS_PUSHBUTTON). ** */ void EnableQCQPCtrl( HWND hWnd, int id, BOOL enable ) { HWND hwndControl; hwndControl = GetDlgItem(hWnd, id); InvalidateRect(hwndControl, (LPRECT)NULL, FALSE); return; } /* EnableQCQPCtrl() */ /*** GetBitmapIndex ** ** Synopsis: ** word = GetBitmapIndex(state) ** ** Entry: ** state - ** ** Returns: ** ** Description: ** */ WORD NEAR GetBitmapIndex(WORD State) { switch (State) { case STATE_NORMAL: return CBWNDEXTRA_BMAP_NORMAL; case STATE_PUSHED: return CBWNDEXTRA_BMAP_PUSHED; case STATE_GRAYED: return CBWNDEXTRA_BMAP_GREYED; default: Assert(FALSE); // Have to return something. return CBWNDEXTRA_BMAP_NORMAL; } } /* GetBitmapIndex() */ /*** CreateQCQPWindow ** ** Synopsis: ** hwnd = CreateQCQPWindow(lpszWindowName, dwStyle, x, y, dx, dy ** hParent, hMenu, hInstance, wMessage) ** ** Entry: ** lpszWindowName - ** dwStyle - ** x - ** y - ** dx - ** dy - ** hParent - ** hMenu - ** hInstance - ** wMessage - ** ** Returns: ** ** Description: ** */ HWND CreateQCQPWindow(LPSTR lpWindowName, DWORD dwStyle, int x, int y, int dx, int dy, HWND hParent, HMENU hMenu, HINSTANCE hInstance, WPARAM wMessage) { HWND hTemp ; char szClass[MAX_MSG_TXT] ; WORD BaseId = 0; WORD State; HBITMAP hBitmap; Dbg(LoadString(hInstance, SYS_QCQPCtrl_wClass, szClass, MAX_MSG_TXT)) ; hTemp = CreateWindow( (LPSTR)szClass, // Window szClass name lpWindowName, // Window's title WS_CHILD | WS_VISIBLE, // window created visible x, y, // X, Y dx, dy, // Width, Height of window hParent, // Parent window's handle hMenu, // child's id hInstance, // Instance of window NULL); // Create struct for WM_CREATE if (hTemp != NULL) { SetWindowWord (hTemp, CBWNDEXTRA_STYLE, LOWORD(dwStyle)) ; SetWindowWord (hTemp, CBWNDEXTRA_BITMAP, HIWORD(dwStyle)) ; SetWindowWord (hTemp, CBWNDEXTRA_STATE, STATE_NORMAL) ; SetWindowHandle (hTemp, CBWNDEXTRA_MESSAGE, wMessage) ; if (LOWORD(dwStyle) == QCQP_CS_PUSHBUTTON) { // Load the bitmaps and store the handles switch (HIWORD(dwStyle)) { case IDS_CTRL_TRACENORMAL: case IDS_CTRL_TRACEPUSHED: case IDS_CTRL_TRACEGRAYED: BaseId = VGA_TRACE_NORMAL; break; case IDS_CTRL_STEPNORMAL: case IDS_CTRL_STEPPUSHED: case IDS_CTRL_STEPGRAYED: BaseId = VGA_STEP_NORMAL; break; case IDS_CTRL_BREAKNORMAL: case IDS_CTRL_BREAKPUSHED: case IDS_CTRL_BREAKGRAYED: BaseId = VGA_BREAK_NORMAL; break; case IDS_CTRL_GONORMAL: case IDS_CTRL_GOPUSHED: case IDS_CTRL_GOGRAYED: BaseId = VGA_GO_NORMAL; break; case IDS_CTRL_HALTNORMAL: case IDS_CTRL_HALTPUSHED: case IDS_CTRL_HALTGRAYED: BaseId = VGA_HALT_NORMAL; break; case IDS_CTRL_QWATCHNORMAL: case IDS_CTRL_QWATCHPUSHED: case IDS_CTRL_QWATCHGRAYED: BaseId = VGA_QWATCH_NORMAL; break; case IDS_CTRL_SMODENORMAL: case IDS_CTRL_SMODEPUSHED: case IDS_CTRL_SMODEGRAYED: BaseId = VGA_SMODE_NORMAL; break; case IDS_CTRL_AMODENORMAL: case IDS_CTRL_AMODEPUSHED: case IDS_CTRL_AMODEGRAYED: BaseId = VGA_AMODE_NORMAL; break; case IDS_CTRL_FORMATNORMAL: case IDS_CTRL_FORMATPUSHED: case IDS_CTRL_FORMATGRAYED: BaseId = VGA_FORMAT_NORMAL; break; default: Assert(FALSE); } // Load the bitmaps for each state for the button for (State = STATE_NORMAL; State <= STATE_GRAYED; State++) { Dbg(hBitmap = LoadBitmap(hInstance, MAKEINTRESOURCE( BaseId + State ))); SetWindowHandle(hTemp, GetBitmapIndex(State), (WPARAM)hBitmap); } } } return hTemp ; } /* CreateQCQPWindow() */ /*** QCQPCtrlWndProc ** ** Synopsis: ** lresult = QCQPCtrlWndProc(hWnd, iMessage, wParam, lParam) ** ** Entry: ** hWnd ** iMessage ** wParam ** lParam ** ** Returns: ** ** Description: ** */ LRESULT CALLBACK QCQPCtrlWndProc( HWND hWnd, UINT iMessage, WPARAM wParam, LPARAM lParam ) { PAINTSTRUCT ps ; // char szText [128] ; WPARAM wStyle ; RECT r ; wStyle = GetWindowWord (hWnd, CBWNDEXTRA_STYLE) ; switch ( iMessage ) { case WM_CREATE: bTrack = FALSE ; break ; case WM_PAINT: GetClientRect (hWnd, (LPRECT)&r) ; BeginPaint (hWnd, &ps) ; switch ( wStyle ) { case QCQP_CS_PUSHBUTTON: case QCQP_CS_LATCHBUTTON: DrawBitmapButton (hWnd, (LPRECT)&r) ; break ; default: break ; } EndPaint (hWnd, &ps) ; break ; case WM_LBUTTONUP: if ( GetWindowWord (hWnd, CBWNDEXTRA_STATE) != STATE_GRAYED ) { bTrack = FALSE ; ReleaseCapture () ; switch (wStyle) { case QCQP_CS_PUSHBUTTON: // Only change the state and send message back to parent // if state is not normal. This prevent user from clicking // the mouse on the button then dragging it outside of // the button. if (GetWindowWord (hWnd, CBWNDEXTRA_STATE) != STATE_NORMAL) { SetWindowWord (hWnd, CBWNDEXTRA_STATE, STATE_NORMAL) ; InvalidateRect (hWnd, (LPRECT)NULL, FALSE) ; // Send information back to where the function key is being // used for the same purpose. SendMessage (GetParent (hWnd), WM_COMMAND, (WPARAM) GetWindowHandle (hWnd, CBWNDEXTRA_MESSAGE), MAKELONG(0, GetDlgCtrlID (hWnd))) ; } break ; case QCQP_CS_LATCHBUTTON: if (GetWindowWord (hWnd, CBWNDEXTRA_STATE) != wOldState) { if (wOldState == STATE_NORMAL) SetWindowWord (hWnd, CBWNDEXTRA_STATE, STATE_ON) ; else SetWindowWord (hWnd, CBWNDEXTRA_STATE, STATE_NORMAL) ; InvalidateRect (hWnd, (LPRECT)NULL, FALSE) ; // Send information back to where the function key is being // used for the same purpose. SendMessage (GetParent (hWnd), WM_COMMAND, (WPARAM) GetWindowHandle (hWnd, CBWNDEXTRA_MESSAGE), MAKELONG(0, GetDlgCtrlID (hWnd))) ; } break ; } } break ; case WM_LBUTTONDOWN: if ( GetWindowWord (hWnd, CBWNDEXTRA_STATE) != STATE_GRAYED ) { bTrack = TRUE ; wOldState = GetWindowWord (hWnd, CBWNDEXTRA_STATE) ; switch (wStyle) { case QCQP_CS_PUSHBUTTON: case QCQP_CS_LATCHBUTTON: SetWindowWord (hWnd, CBWNDEXTRA_STATE, STATE_PUSHED) ; InvalidateRect (hWnd, (LPRECT)NULL, FALSE) ; break ; } SetCapture (hWnd) ; } break ; case WM_MOUSEMOVE: if ( GetWindowWord (hWnd, CBWNDEXTRA_STATE) != STATE_GRAYED ) { if ( bTrack ) { int x, y ; x = LOWORD (lParam) ; // get x position y = HIWORD (lParam) ; // get y position GetClientRect (hWnd, &r) ; // if mouse position is outside of button area, bring it // back to its old state stored in wOldState. if ( ((x < r.left) || (x > r.right)) || ((y < r.top) || (y > r.bottom)) ) { // redraw the button only if it's not in normal position. if ( GetWindowWord (hWnd, CBWNDEXTRA_STATE) != wOldState ) { SetWindowWord (hWnd, CBWNDEXTRA_STATE, wOldState) ; InvalidateRect (hWnd, (LPRECT)NULL, FALSE) ; } } else { // redraw the button only if it's not in pushed position. if ( GetWindowWord (hWnd, CBWNDEXTRA_STATE) != STATE_PUSHED ) { SetWindowWord (hWnd, CBWNDEXTRA_STATE, STATE_PUSHED) ; InvalidateRect (hWnd, (LPRECT)NULL, FALSE) ; } } } } break ; default: return DefWindowProc (hWnd, iMessage, wParam, lParam) ; break ; } return 0L ; } /* QCQPCtrlWndProc() */ /*** DrawBitmapButton ** ** Synopsis: ** void = DrawBitmapButton(hWnd, r) ** ** Entry: ** hWnd ** r ** ** Returns: ** Nothing ** ** Description: ** ** */ void DrawBitmapButton (HWND hWnd, LPRECT r) { HDC hDC, hMemoryDC ; HBITMAP hBitmap, hTempBitmap ; int OldStretchMode ; BITMAP Bitmap ; WORD State; State = (WORD) GetWindowWord(hWnd, CBWNDEXTRA_STATE); hBitmap = (HBITMAP) GetWindowHandle(hWnd, GetBitmapIndex(State)); hDC = GetDC (hWnd) ; Dbg(hMemoryDC = CreateCompatibleDC (hDC)); Dbg(GetObject (hBitmap, sizeof(BITMAP), (LPSTR) &Bitmap)); // save the current bitmap handle. Dbg(hTempBitmap = (HBITMAP) SelectObject (hMemoryDC, hBitmap)); OldStretchMode = SetStretchBltMode (hDC, COLORONCOLOR); StretchBlt (hDC, r->left, r->top, r->right, r->bottom, hMemoryDC, 0, 0, Bitmap.bmWidth, Bitmap.bmHeight, SRCCOPY); SetStretchBltMode(hDC, OldStretchMode); // restore the old bitmap back into DC SelectObject(hMemoryDC, hTempBitmap); Dbg(DeleteDC(hMemoryDC)); Dbg(ReleaseDC(hWnd, hDC)); return; } /* DrawBitmapButton() */ /*** FreeBitmaps ** ** Synopsis: ** void = FreeBitmaps(hwnd, ctrlId) ** ** Entry: ** hwnd - ** ctrlId - ** ** Returns: ** nothing ** ** Description; ** */ void NEAR FreeBitmaps(HWND hwndToolbar, int CtrlId) { HWND hwndCtrl; WORD State; HBITMAP hBitmap; hwndCtrl = GetDlgItem(hwndToolbar, CtrlId); for (State = STATE_NORMAL; State <= STATE_GRAYED; State++) { hBitmap = (HBITMAP)GetWindowHandle(hwndCtrl, GetBitmapIndex(State)); Dbg(DeleteObject(hBitmap)); } } /* FreeBitmaps() */
59882ef21688d19a1371727dd3f00fc60302a26a
b17cc0b4428608c15610a1eb133a4d0e94c1ac18
/5. String/Length of the last word.cpp
55430c3859b6d30117465116f01f4838c08c9d20
[]
no_license
viveky1794/LeetCode-Problems
afbefa7ff790e44141e11b3c333605e866d12e18
8e5b32c274aeba6d6f2a8b19836756ae79a02299
refs/heads/master
2022-12-11T04:37:22.990379
2020-09-04T20:29:28
2020-09-04T20:29:28
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,326
cpp
/* Given a string s consists of upper/lower-case alphabets and empty space characters ' ', return the length of last word (last word means the last appearing word if we loop from left to right) in the string. If the last word does not exist, return 0. Note: A word is defined as a maximal substring consisting of non-space characters only. Example: Input: "Hello World" Output: 5 */ class Solution { public: int lengthOfLastWord(string s) { //Basic Null/zero case if(s.length() == 0) { return 0; } int length = 0; int i=0; while(i<s.length()) { //If there is a space, increment to a point when there is a character. //If the length has reached, then do not reset length. But if the end //has still not reached then reset length to 0. if(s[i] == ' ') { while(s[i] == ' ') { i++; } if(i < s.length()) { length = 0; } } //Simply increment the pointer and the length count when there is a //character. else { i++; length++; } } return length; } };
70d521fa3e4e4c8c556d9375aa9a6a9b7bd1960e
1fbb86a68429b4a013e4dd5536bd11b5f01bd481
/src/OGLSample3_VS_FS_Interpolation/sampleapp.cpp
6af5f997aff2d40fb67d4b6247d8ffdb6a6fc9f5
[]
no_license
drzajwo/UJ-Programowanie-grafiki-3D
e1dfcf0c6ba7706eada293425262905588136f26
9e76ed4d528208bb18525e2b5e80a74944a9b67d
refs/heads/master
2020-08-28T12:06:27.049514
2019-11-23T12:49:47
2019-11-23T12:49:47
217,693,941
0
0
null
null
null
null
UTF-8
C++
false
false
7,024
cpp
#include "sampleapp.h" SampleApp::SampleApp() : OGLAppFramework::OGLApplication(1366u, 768u, "OGLSample 2 - IB VBO", 3u, 3u), simple_program(0u), vbo_handle(0u), index_buffer_handle(0u), vao_handle(0u) { } SampleApp::~SampleApp() { } void SampleApp::reshapeCallback(std::uint16_t width, std::uint16_t height) { std::cout << "Reshape..." << std::endl; std::cout << "New window size: " << width << " x " << height << std::endl; gl::glViewport(0, 0, width, height); } void SampleApp::keyCallback(int key, int scancode, int action, int mods) { //std::cout << "Key pressed" << std::endl; } void SampleApp::cursorPosCallback(double xpos, double ypos) { //std::cout << "Cursor pos: " << xpos << ", " << ypos << std::endl; } void SampleApp::mouseButtonCallback(int button, int action, int mods) { //std::cout << "Mouse button pressed" << std::endl; } bool SampleApp::init(void) { std::cout << "Init..." << std::endl; // ustalamy domyślny kolor ekranu gl::glClearColor(0.2f, 0.2f, 0.2f, 1.f); // wlaczmy renderowanie tylko jednej strony poligon-ow // gl::glEnable(gl::GL_CULL_FACE); // ustalamy, ktora strona jest "przodem" // gl::glFrontFace(gl::GL_CCW); // ustalamy, ktorej strony nie bedziemy renderowac // gl::glCullFace(gl::GL_BACK); std::cout << "Shaders compilation..." << std::endl; // wczytanie z plikow i skompilowanie shaderow oraz utworzenie programu (VS + FS) std::string vs_path = "../../../shaders/simple_vs.glsl"; std::string fs_path = "../../../shaders/simple_fs.glsl"; #if WIN32 vs_path = "../../../../shaders/simple_vs.glsl"; fs_path = "../../../../shaders/simple_fs.glsl"; #endif if (auto create_program_result = OGLAppFramework::createProgram(vs_path, fs_path)) { simple_program = create_program_result.value(); } else { std::cerr << "Error - can't create program..." << std::endl; return false; } // ustawienie informacji o lokalizacji atrybutu pozycji w vs (musi sie zgadzac z tym co mamy w VS!!!) const gl::GLuint vertex_position_loction = 0u; // ustawienie programu, ktory bedzie uzywany podczas rysowania gl::glUseProgram(simple_program); // stworzenie tablicy z danymi o wierzcholkach 3x (x, y, z) std::array<gl::GLfloat, 42u> vertices = { -0.5f, 0.f, 0.f, 1.0f, 0.f, 0.f, 0.5f, 0.f, 0.f, 0.0f, 1.0f, 0.f, 0.f, 0.5f, 0.f, 0.f, 0.f, 1.0f, -0.4f, 0.f, 0.f, 1.0f, 0.f, 0.f, -0.4f, -0.5f, 0.f, 0.0f, 1.0f, 0.f, 0.4f, -0.5f, 0.f, 0.0f, 0.f, 1.0f, 0.4f, 0.f, 0.f, 0.0f, 1.0f, 0.f, }; // stworzenie tablicy z danymi o indeksach std::array<gl::GLushort, 9u> indices = { 0, 1, 2, 3, 4, 5, 3, 5, 6}; std::cout << "Generating buffers..." << std::endl; // stworzenie bufora gl::glGenBuffers(1, &vbo_handle); // zbindowanie bufora jako VBO gl::glBindBuffer(gl::GL_ARRAY_BUFFER, vbo_handle); // alokacja pamieci dla bufora zbindowanego jako VBO i skopiowanie danych z tablicy "vertices" gl::glBufferData(gl::GL_ARRAY_BUFFER, vertices.size() * sizeof(gl::GLfloat), vertices.data(), gl::GL_STATIC_DRAW); // odbindowanie buffora zbindowanego jako VBO (zeby przypadkiem nie narobic sobie klopotow...) gl::glBindBuffer(gl::GL_ARRAY_BUFFER, 0); // stworzenie bufora gl::glGenBuffers(1, &index_buffer_handle); // zbindowanie bufora jako IB gl::glBindBuffer(gl::GL_ELEMENT_ARRAY_BUFFER, index_buffer_handle); // alokacja pamieci dla bufora zbindowanego jako IB i skopiowanie danych z tablicy "indeices" gl::glBufferData(gl::GL_ELEMENT_ARRAY_BUFFER, indices.size() * sizeof(gl::GLushort), indices.data(), gl::GL_STATIC_DRAW); // odbindowanie buffora zbindowanego jako IB (zeby przypadkiem nie narobic sobie klopotow...) gl::glBindBuffer(gl::GL_ELEMENT_ARRAY_BUFFER, 0); // stworzenie VAO gl::glGenVertexArrays(1, &vao_handle); // zbindowanie VAO gl::glBindVertexArray(vao_handle); // zbindowanie VBO do aktualnego VAO gl::glBindBuffer(gl::GL_ARRAY_BUFFER, vbo_handle); // ustalenie jak maja byc interpretowane dane z VBO gl::glVertexAttribPointer(vertex_position_loction, 3, gl::GL_FLOAT, gl::GL_FALSE, sizeof(float)* 6, nullptr); // odblokowanie mozliwosci wczytywania danych z danej lokalizacji gl::glEnableVertexAttribArray(vertex_position_loction); gl::glVertexAttribPointer(1, 3, gl::GL_FLOAT, gl::GL_FALSE, sizeof(float)* 6, (const void *)12); // odblokowanie mozliwosci wczytywania danych z danej lokalizacji gl::glEnableVertexAttribArray(1); // zbindowanie IB do aktualnego VAO gl::glBindBuffer(gl::GL_ELEMENT_ARRAY_BUFFER, index_buffer_handle); // odbindowanie VAO (ma ono teraz informacje m.in. o VBO + IB, wiec gdy zajdzie potrzeba uzycia VBO + IB, wystarczy zbindowac VAO) gl::glBindVertexArray(0u); // odbindowanie buffora zbindowanego jako VBO (zeby przypadkiem nie narobic sobie klopotow...) gl::glBindBuffer(gl::GL_ARRAY_BUFFER, 0); // odbindowanie buffora zbindowanego jako bufor indeksow (zeby przypadkiem nie narobic sobie klopotow...) gl::glBindBuffer(gl::GL_ELEMENT_ARRAY_BUFFER, 0); // na tym mozna zakonczyc // w tej prostej aplikacji bedziemy rysowac tylko 1 (powyzej stworzony) model, dlatego mozemy juz teraz ustawic odpowiednie dane dla naszych shaderow (nie beda sie one zmieniac co klatke...) // zeby narysowac nasz model musimy ustawic odpowiednie VBO + IB (a dzieki temu ze VAO ma o nich iformacje sprowadza sie to do ustawienia odpowiedniego VAO, a przez to reszte buforow) // Czyli znowu bindujemy VAO gl::glBindVertexArray(vao_handle); return true; } bool SampleApp::frame(float delta_time) { // rozpoczynamy rysowanie uzywajac ustawionego programu (shader-ow) i ustawionych buforow gl::glDrawElements(gl::GL_TRIANGLES, 9, gl::GL_UNSIGNED_SHORT, nullptr); return true; } void SampleApp::release(void) { std::cout << "Release..." << std::endl; // odbindowanie VAO gl::glBindVertexArray(0); if (vao_handle) { // usuniecie VAO gl::glDeleteVertexArrays(1, &vao_handle); vao_handle = 0u; } // odbindowanie VBO gl::glBindBuffer(gl::GL_ARRAY_BUFFER, 0); if (vbo_handle) { // usuniecie VBO gl::glDeleteBuffers(1, &vbo_handle); vbo_handle = 0u; } // odbindowanie IB glBindBuffer(gl::GL_ELEMENT_ARRAY_BUFFER, 0); if (index_buffer_handle) { // usuniecie IB gl::glDeleteBuffers(1, &index_buffer_handle); index_buffer_handle = 0u; } // ustawienie aktywnego programu na 0 (zaden) gl::glUseProgram(0); // usuniecie programu gl::glDeleteProgram(simple_program); }
546daef2c8cdfb7bc7d3d0b046b185f916a46901
7ff1f31385f3ad711ebedc471fbc4590be96e178
/solutions/Codeforces/559/A.cpp
ff509c920cf68745d27a18d2a7b8ab1b8f46d149
[ "Unlicense" ]
permissive
yumeno-ukihashi/competitive-programming
6bf303daa6ea0edfc333731ed8295802f0136978
5cc3a7938b62133d8dc71a179cb11dfe985315d3
refs/heads/master
2020-05-19T06:53:53.650508
2019-06-13T03:00:44
2019-06-13T03:00:44
184,885,681
0
0
null
null
null
null
UTF-8
C++
false
false
947
cpp
#include<bits/stdc++.h> #define REP(x,y,z) for(int x=y;x<=z;x++) #define MSET(x,y) memset(x,y,sizeof(x)) #define M 100005 using namespace std; using LL = long long; int n,m; int cnt[M], in1[M], in2[M]; int main() { while (~scanf("%d %d", &n, &m)) { REP(i,1,n) scanf("%d", &in1[i]); REP(i,1,m) scanf("%d", &in2[i]); sort(in1+1, in1+n+1); sort(in2+1, in2+m+1); MSET(cnt, 0); LL ans = 0; if (*min_element(in2+1,in2+m+1) > *max_element(in1+1,in1+n+1)) { cnt[n] = m-1; cnt[n-1] = 1; REP(i,1,m) ans += in2[i]; } else if (*min_element(in2+1,in2+m+1) == *max_element(in1+1,in1+n+1)) { cnt[n] = m; REP(i,1,m) ans += in2[i]; } else { puts("-1"); continue; } REP(i,1,n) { ans += (LL)in1[i] * (m-cnt[i]); } cout << ans << endl; } return 0; }
d9ea40c25829f290718ab5a93a1fab2f83ebe86c
cbfc13ac2ccc377c82fb0fa2eca469a52f50fafc
/Project1/LinkedList.h
52dd3e72d4f0d96344233fb57735eaeb5bf70cd6
[]
no_license
Mzitow/SparseTable
2f240fa1175d650c630f4ccd61174691a3f806db
90af8cb887d1525962cb598de5a07d1c161dfdd0
refs/heads/main
2023-02-16T01:26:52.310262
2020-12-27T05:06:35
2020-12-27T05:06:35
324,688,658
0
0
null
null
null
null
UTF-8
C++
false
false
4,581
h
#pragma once #ifndef LINKED_LIST #define LINKED_LIST template <typename T> struct Node { T data; Node* next; }; template <typename T> class LinkedList { public: int length_; Node<T>* head_; Node<T>* tail_; LinkedList(); ~LinkedList(); bool isEmpty() { return this->head_ == nullptr; } int length() { return this->length_; } void prependNode(T data); bool searchKey(LinkedList<T>* head, int x); void appendNode(T data); void deleteNodeAt(int idx); void deleteNodesByValue(T value); void printSequence(); }; template <typename T> LinkedList<T>::LinkedList() { this->length_ = 0; this->head_ = nullptr; this->tail_ = nullptr; } template <typename T> LinkedList<T>::~LinkedList() { Node<T>* next = this->head_; Node<T>* curr = nullptr; while (next != nullptr) { curr = next; next = next->next; delete curr; } std::cout << "List deleted." << std::endl; } template <typename T> void LinkedList<T>::prependNode(T data) { Node<T>* node = new Node<T>; node->data = data; node->next = this->head_; if (isEmpty()) { this->tail_ = node; } this->head_ = node; this->length_++; } template <typename T> bool LinkedList<T>::searchKey(LinkedList<T>* head, int x) { Node<T>* current = head->head_; // Initialize current while (current != NULL) { if (current->data == x) return true; current = current->next; } return false; } template <typename T> void LinkedList<T>::appendNode(T data) { Node<T>* node = nullptr; if (isEmpty()) { node = new Node<T>; this->head_ = node; } else { node = this->tail_; node->next = new Node<T>; node = node->next; } node->data = data; node->next = nullptr; this->tail_ = node; this->length_++; } template <typename T> void LinkedList<T>::deleteNodeAt(int idx) { if ((idx < 0) || (idx >= this->length_)) { std::cout << "Index " << idx << " exceeds current list length of " << this->length_ << '.' << std::endl; } else { Node<T>* node = this->head_; if (idx == 0) { // Update head this->head_ = node->next; delete node; if (isEmpty()) { this->tail_ = nullptr; } } else { for (int i = 0; i < idx - 1; i++) { node = node->next; } Node<T>* tmp = node->next; node->next = node->next->next; delete tmp; if (idx == this->length_ - 1) { // Update tail to point to end node this->tail_ = node; } } this->length_--; } } template <typename T> void LinkedList<T>::deleteNodesByValue(T value) { int num_deleted = 0; Node<T>* curr = this->head_; Node<T>* tmp; while (!isEmpty() && curr->data == value) { tmp = curr; this->head_ = curr->next; curr = curr->next; delete tmp; num_deleted++; } while (!isEmpty() && curr->next != nullptr) { if (curr->next->data == value) { tmp = curr->next; curr->next = curr->next->next; delete tmp; if (curr->next == nullptr) { // Update tail this->tail_ = curr; } num_deleted++; } curr = curr->next; } if (isEmpty()) { this->tail_ = nullptr; } if (num_deleted) { std::cout << "Deleted " << num_deleted << " nodes with value " << value << '.' << std::endl; } else { if (!isEmpty()) { std::cout << "Value " << value << " not found in list." << std::endl; } else { std::cout << "-" << std::endl; } } } template <typename T> void LinkedList<T>::printSequence() { if (isEmpty()) { std::cout << " - "; } else { Node<T>* node = this->head_; std::cout << " "; while (node != nullptr) { std::cout << node->data << ' '; node = node->next; } std::cout << ""; } } template <typename T> void checkTail(LinkedList<T>* list) { std::cout << "Tail is set to nullprt: " << (list->tail_ == nullptr) << std::endl; } template <typename T> void checkHead(LinkedList<T>* list) { std::cout << "Head is set to nullprt: " << list->isEmpty() << std::endl; } #endif
06e3792a2c0b4003b32bcddeec8655977b5d7b96
be05e64302acbf855938ce34bb0297620dc7d397
/Player/CRPlayerController.cpp
d5cc1416fa169f626ce77fecec54c1d6ad47c9c0
[ "MIT" ]
permissive
CarstenZarbock/CRESH
806c5dd42b8f2a523d667347323bc0254631b300
da0cfee97d33c0fcdd3c87c92f93c1e55fd3cbf4
refs/heads/master
2022-08-23T15:47:36.436529
2020-05-24T15:25:45
2020-05-24T15:25:45
258,272,326
0
0
null
2020-05-24T15:25:46
2020-04-23T16:57:17
C++
UTF-8
C++
false
false
498
cpp
#pragma once #include "Engine.h" #include "..\Interface\CRInterface.h" #include "Scene\Scene.h" #include "CRPlayerController.h" void CRPlayerController::Initialize() { Interface = new CRInterface(Engine); Interface->Initialize(); Scene->NewObject(this); } void CRPlayerController::Tick(const float deltaTime) { if (Interface != nullptr) { Interface->Tick(deltaTime); } } void CRPlayerController::OnDestroy() { if (Interface != nullptr) { delete Interface; } Interface = nullptr; }
4d1802392528b42ea438885de309bf95d5f93a04
85c91b680d74357b379204ecf7643ae1423f8d1e
/tags/rel_0_1_0/qedo/ComponentContainer/ReceptaclePort.cpp
33627b608b23de8ec887ddeab6fdbaca514a22e3
[]
no_license
BackupTheBerlios/qedo-svn
6fdec4ca613d24b99a20b138fb1488f1ae9a80a2
3679ffe8ac7c781483b012dbef70176e28fea174
refs/heads/master
2020-11-26T09:42:37.603285
2010-07-02T10:00:26
2010-07-02T10:00:26
40,806,890
0
0
null
null
null
null
UTF-8
C++
false
false
6,236
cpp
/***************************************************************************/ /* Qedo - Quality of Service Enabled Distributed Objects */ /* */ /* http://qedo.berlios.de/ */ /* */ /* Copyright (C) 2002 by the Qedo Team */ /* */ /* This library 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.1 of the License, or (at your option) any later version. */ /* */ /* This library is distributed in the hope that it will be useful, */ /* but WITHOUT ANY WARRANTY; without even the implied warranty of */ /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU */ /* Lesser General Public License for more details. */ /* */ /* You should have received a copy of the GNU Lesser General Public */ /* License along with this library; if not, write to the Free Software */ /* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /***************************************************************************/ static char rcsid[] = "$Id: ReceptaclePort.cpp,v 1.3 2002/12/03 07:57:46 stoinski Exp $"; #include "ReceptaclePort.h" #include "Output.h" namespace Qedo { ReceptacleConnection::ReceptacleConnection (CORBA::Object_ptr connection, Cookie_impl* cookie) : connection_ (CORBA::Object::_duplicate (connection)), cookie_ (cookie) { cookie_->_add_ref(); } ReceptacleConnection::ReceptacleConnection() { } ReceptacleConnection::ReceptacleConnection (const ReceptacleConnection& rec_conn) : connection_ (CORBA::Object::_duplicate (rec_conn.connection_)), cookie_ (rec_conn.cookie_) { cookie_->_add_ref(); } ReceptacleConnection& ReceptacleConnection::operator= (const ReceptacleConnection& rec_conn) { connection_ = CORBA::Object::_duplicate (rec_conn.connection_); if (cookie_) cookie_->_remove_ref(); cookie_ = rec_conn.cookie_; cookie_->_add_ref(); return *this; } ReceptacleConnection::~ReceptacleConnection() { cookie_->_remove_ref(); } ConnectionDescription_impl* ReceptacleConnection::connection_description() const { ConnectionDescription_impl* con_desc = new ConnectionDescription_impl (cookie_, connection_); return con_desc; } const CORBA::Object_ptr ReceptacleConnection::connection() const { return CORBA::Object::_duplicate (connection_); } Cookie_impl* ReceptacleConnection::cookie() const { cookie_->_add_ref(); return cookie_; } CORBA::Boolean ReceptacleConnection::same_connection (Components::Cookie* cookie) const { return cookie_->equal (cookie); } ReceptaclePort::ReceptaclePort (const char* name, const char* type_id, CORBA::Boolean is_multiplex) : PortBase (name, type_id), is_multiplex_ (is_multiplex) { } ReceptaclePort::ReceptaclePort() { } ReceptaclePort::ReceptaclePort (const ReceptaclePort& rec_port) : PortBase (rec_port), is_multiplex_ (rec_port.is_multiplex_), connections_ (rec_port.connections_) { } ReceptaclePort::~ReceptaclePort() { } Components::ConnectedDescriptions* ReceptaclePort::connected_descriptions() const { Components::ConnectedDescriptions_var con_descs = new Components::ConnectedDescriptions(); con_descs->length (connections_.size()); for (unsigned int i = 0; i < con_descs->length(); i++) { (*con_descs)[i] = connections_[i].connection_description(); } return con_descs._retn(); } Components::ReceptacleDescription* ReceptaclePort::receptacle_description() const { Components::ConnectedDescriptions_var con_descs = connected_descriptions(); Components::ReceptacleDescription_var rec_desc = new ReceptacleDescription_impl (port_name_.c_str(), type_id_.c_str(), is_multiplex_, con_descs); return rec_desc._retn(); } Cookie_impl* ReceptaclePort::add_connection (CORBA::Object_ptr connection) throw (Components::InvalidConnection, Components::AlreadyConnected, Components::ExceededConnectionLimit) { // Test whether already connected if ( !is_multiplex_ && connections_.size() > 0 ) { DEBUG_OUT2 ("ReceptaclePort: Multiple connections not allowed for receptacle ", port_name_); throw Components::AlreadyConnected(); } // Test for type of connection if (! connection->_is_a (type_id_.c_str())) { DEBUG_OUT2 ( "ReceptaclePort: Connection has wrong type for receptacle ", port_name_ ); throw Components::InvalidConnection(); } // Create cookie Cookie_impl* new_cookie = new Cookie_impl(); // Create connection entry ReceptacleConnection new_entry (connection, new_cookie); connections_.push_back (new_entry); return new_cookie; } void ReceptaclePort::remove_connection (Components::Cookie* cookie) throw (Components::InvalidConnection, Components::CookieRequired, Components::NoConnection) { if (is_multiplex_ && ! cookie) // Multiple receptacle needs cookie { throw Components::CookieRequired(); } ConnectionVector::iterator con_iter; // Search connection for (con_iter = connections_.begin(); con_iter != connections_.end(); con_iter++) { if ((! is_multiplex_ ) || // Simple receptacles always have at most 1 connection (*con_iter).same_connection (cookie)) // Multiple receptacles need matching cookie { connections_.erase (con_iter); DEBUG_OUT2 ( "ReceptaclePort: Disconnection from receptacle ", port_name_ ); return; } } // Not found if (is_multiplex_) { throw Components::InvalidConnection(); } else { throw Components::NoConnection(); } } } // namespace Qedo
[ "(no author)@798282e8-cfd4-0310-a90d-ae7fb11434eb" ]
(no author)@798282e8-cfd4-0310-a90d-ae7fb11434eb
c974d526a3cde1d16e639df8ca0bdb5d73986ae2
426df7d9b4a41da6c8dff51b195baae502389c9e
/JSShell/JSShell.cpp
3b6ef179eac85c71febb876660d0a50dabcd9b09
[]
no_license
lowjoel/arachnidape
4cc01ca13319a61835cabee57e3960d5d266c374
2e678c7b522e0f3eee52020aaf6ab154174a8eca
refs/heads/master
2020-12-24T14:53:35.718621
2013-05-03T00:19:58
2013-05-03T00:19:58
6,111,428
0
1
null
null
null
null
UTF-8
C++
false
false
12,359
cpp
// JSShell.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include "Handle.h" #include "Util.h" namespace { struct ExecutionArguments { bool RunInteractively; TCHAR BasePath[MAX_PATH]; std::vector<TCHAR*> FilesToExecute; std::vector<TCHAR*> ShellArguments; }; void StartJavaScriptShell(const ExecutionArguments& arguments); /// Sends a command to the Shell using the given pipe and executes it. void SendJavaScriptShellCommand(const std::string& command, HANDLE pipe); /// Sends a command to the Shell using the given pipe, but does not /// flush the buffer. void StreamJavaScriptShellCommand(const std::string& command, HANDLE pipe); void LoadJavaScriptSources(const std::vector<TCHAR*>& files, HANDLE pipe); void JavaScriptStdOutFilter(std::vector<char>& buffer); void JavaScriptStdOutPostFilter(); void JavaScriptStdErrFilter(std::vector<char>& buffer); void JavaScriptStdErrPostFilter(); void JavaScriptStdInFilter(std::vector<char>& buffer); /// Filter state which will filter out all JavaScript shell prompts. bool SuppressShellPrompt = true; /// The input event object. This will be signaled only when the shell is ready /// to accept input. HANDLE InputEvent = nullptr; /// The output mutex. This will be signaled only when the shell is /// ready to accept output. CRITICAL_SECTION OutputEvent = { 0 }; } int _tmain(int argc, _TCHAR* argv[]) { ExecutionArguments arguments; arguments.RunInteractively = false; //First find our executable's directory. We will find Stub.js and //js.exe there { TCHAR drive[MAX_PATH]; TCHAR directory[MAX_PATH]; _tsplitpath_s(argv[0], drive, MAX_PATH, directory, MAX_PATH, nullptr, 0, nullptr, 0); _tcscpy_s(arguments.BasePath, drive); _tcscpy_s(arguments.BasePath + _tcslen(arguments.BasePath), MAX_PATH - _tcslen(arguments.BasePath), directory); } for (int i = 1; i < argc; ++i) { if (_tcscmp(_T("-f"), argv[i]) == 0 && i + 1 < argc) { arguments.FilesToExecute.push_back(argv[++i]); } else if (_tcscmp(_T("-i"), argv[i]) == 0) { arguments.RunInteractively = true; } else { arguments.ShellArguments.push_back(argv[i]); } } //One fix up: if we have no files to execute, we should run interactively. if (arguments.FilesToExecute.empty() && !arguments.RunInteractively) arguments.RunInteractively = true; StartJavaScriptShell(arguments); } namespace { std::vector<HANDLE> StartJavaScriptShellInternal(const ExecutionArguments& arguments) { STARTUPINFO jsShellStartupInfo = { 0 }; PROCESS_INFORMATION jsShellInfo = { 0 }; //Create our command line. TCHAR cmdLine[MAX_PATH * 4]; wsprintf(cmdLine, L"%sjs.exe -U -f %sStub.js -i", arguments.BasePath, arguments.BasePath); //Create our process creation information. jsShellStartupInfo.cb = sizeof(jsShellStartupInfo); jsShellStartupInfo.dwFlags = STARTF_USESTDHANDLES; //Create our redirected pipes KernelHandle stdInRead, stdInWrite; KernelHandle stdOutRead, stdOutWrite; KernelHandle stdErrRead, stdErrWrite; { HANDLE hStdInRead, hStdInWrite; HANDLE hStdOutRead, hStdOutWrite; HANDLE hStdErrRead, hStdErrWrite; //We need an inheritable security permission SECURITY_ATTRIBUTES saAttr; saAttr.nLength = sizeof(SECURITY_ATTRIBUTES); saAttr.bInheritHandle = TRUE; saAttr.lpSecurityDescriptor = NULL; if (!CreatePipe(&hStdInRead, &hStdInWrite, &saAttr, 0)) throw GetLastError(); stdInRead = KernelHandle(hStdInRead); stdInWrite = KernelHandle(hStdInWrite); //Don't let the child process inherit the stdin write handle. SetHandleInformation(stdInWrite.get(), HANDLE_FLAG_INHERIT, 0); if (!CreatePipe(&hStdOutRead, &hStdOutWrite, &saAttr, 0)) throw GetLastError(); stdOutRead = KernelHandle(hStdOutRead); stdOutWrite = KernelHandle(hStdOutWrite); //Don't let the child process inherit the stdin write handle. SetHandleInformation(stdOutRead.get(), HANDLE_FLAG_INHERIT, 0); if (!CreatePipe(&hStdErrRead, &hStdErrWrite, &saAttr, 0)) throw GetLastError(); stdErrRead = KernelHandle(hStdErrRead); stdErrWrite = KernelHandle(hStdErrWrite); //Don't let the child process inherit the stdin write handle. SetHandleInformation(stdErrRead.get(), HANDLE_FLAG_INHERIT, 0); } jsShellStartupInfo.hStdInput = stdInRead.get(); jsShellStartupInfo.hStdOutput = stdOutWrite.get(); jsShellStartupInfo.hStdError = stdErrWrite.get(); //Create the process. KernelHandle jsShellProcess; KernelHandle jsShellThread; if (!CreateProcess(nullptr, cmdLine, nullptr, nullptr, true, 0, nullptr, nullptr, &jsShellStartupInfo, &jsShellInfo)) { unsigned error = GetLastError(); _tprintf_s(_T("Could not start Mozilla JavaScript shell. Is js.exe in ") _T("your path? [GetLastError()=%d]"), error); throw error; } //Assign the handle to auto-destruct jsShellProcess = KernelHandle(jsShellInfo.hProcess); jsShellThread = KernelHandle(jsShellInfo.hThread); //Create threads to handle stdout and stderr std::vector<HANDLE> threadHandles; KernelHandle inputEvent(CreateEvent(nullptr, false, false, nullptr)); InputEvent = inputEvent.get(); InitializeCriticalSection(&OutputEvent); KernelHandle thisStdOutWrite = GetStdHandle(STD_OUTPUT_HANDLE); CopyOutputArguments stdOutReaderArgs = { stdOutRead, thisStdOutWrite, JavaScriptStdOutFilter, JavaScriptStdOutPostFilter }; threadHandles.push_back(reinterpret_cast<HANDLE>( _beginthreadex(nullptr, 0, &CopyOutput, &stdOutReaderArgs, 0, nullptr)) ); KernelHandle thisStdErrWrite = GetStdHandle(STD_ERROR_HANDLE); CopyOutputArguments stdErrReaderArgs = { stdErrRead, thisStdErrWrite, JavaScriptStdErrFilter, JavaScriptStdErrPostFilter }; threadHandles.push_back(reinterpret_cast<HANDLE>( _beginthreadex(nullptr, 0, &CopyOutput, &stdErrReaderArgs, 0, nullptr)) ); //Before we do stdin (for interactivity), we need to load all the files //the user specified in order. LoadJavaScriptSources(arguments.FilesToExecute, stdInWrite.get()); //Then we handle the situation where we may need interactivity, or not. KernelHandle thisStdInRead = GetStdHandle(STD_INPUT_HANDLE); if (arguments.RunInteractively) { //We can now enable the js> prompt. WaitForSingleObject(InputEvent, INFINITE); SuppressShellPrompt = false; SendJavaScriptShellCommand("", stdInWrite.get()); CopyOutputArguments stdInReaderArgs = { thisStdInRead, stdInWrite, JavaScriptStdInFilter }; threadHandles.push_back(reinterpret_cast<HANDLE>( _beginthreadex(nullptr, 0, &CopyOutput, &stdInReaderArgs, 0, nullptr)) ); } else { SendJavaScriptShellCommand("quit();", stdInWrite.get()); } //Wait for the process to terminate WaitForSingleObject(jsShellProcess.get(), INFINITE); //Wait for our threads to all drain the pipes return threadHandles; } void StartJavaScriptShell(const ExecutionArguments& arguments) { std::vector<HANDLE> threads(StartJavaScriptShellInternal(arguments)); WaitForMultipleObjects(threads.size(), &threads.front(), true, INFINITE); FlushFileBuffers(GetStdHandle(STD_OUTPUT_HANDLE)); FlushFileBuffers(GetStdHandle(STD_ERROR_HANDLE)); } void SendJavaScriptShellCommand(const std::string& command, HANDLE pipe) { //Wrap the command with a with(window) {} const std::string commandText = "with (window) {" + command + "}"; //Send the command. StreamJavaScriptShellCommand(commandText, pipe); StreamJavaScriptShellCommand("\r\n", pipe); FlushFileBuffers(pipe); } void StreamJavaScriptShellCommand(const std::string& command, HANDLE pipe) { DWORD read = 0; WriteFile(pipe, command.c_str(), command.length(), &read, nullptr); } void LoadJavaScriptSources(const std::vector<TCHAR*>& files, HANDLE pipe) { for (std::vector<TCHAR*>::const_iterator i = files.begin(); i != files.end(); ++i) { KernelHandle fileHandle(CreateFile(*i, GENERIC_READ, 0, nullptr, OPEN_EXISTING, 0, nullptr)); if (!fileHandle) { unsigned lastError = GetLastError(); switch (lastError) { case ERROR_FILE_NOT_FOUND: fwprintf(stderr, _T("can't open %s: No such file or directory\r\n"), *i); break; } continue; } //Wait for the shell to accept input. WaitForSingleObject(InputEvent, INFINITE); //Send the opening command StreamJavaScriptShellCommand("evaluate('with (window) {", pipe); //Send the file to the Shell. char buffer[65536]; DWORD read = 0; std::vector<char> sendBuffer; while (ReadFile(fileHandle.get(), buffer, sizeof(buffer) / sizeof(buffer[0]), &read, nullptr)) { if (!read) break; sendBuffer.reserve(read); for (size_t i = 0; i < read; ++i) { //Inject a \ before all \'s and quotes if (buffer[i] == '\'' || buffer[i] == '\\') sendBuffer.push_back('\\'); //If it is a carriage return/newline, translate it to the JavaScript //equivalent else if (buffer[i] == '\r') { sendBuffer.push_back('\\'); sendBuffer.push_back('r'); continue; } else if (buffer[i] == '\n') { sendBuffer.push_back('\\'); sendBuffer.push_back('n'); continue; } sendBuffer.push_back(buffer[i]); } //Stream the command. std::string partialCommand(sendBuffer.begin(), sendBuffer.end()); StreamJavaScriptShellCommand(partialCommand, pipe); sendBuffer.clear(); } switch (GetLastError()) { default: ; } //Send closing command. StreamJavaScriptShellCommand("\\r\\n}', { fileName: \"" + wcs2utf8(*i) + "\", newContext: true }), undefined;\r\n", pipe); } } bool InCommandEntry = false; void JavaScriptStdOutFilter(std::vector<char>& buffer) { //Obtain a lock on stdout. EnterCriticalSection(&OutputEvent); char* bufferFront = &buffer.front(); bool shellPromptOnly = buffer.size() == 4 && !memcmp(bufferFront, "js> ", 4); std::vector<char>::iterator shellPromptString = buffer.end(); { std::vector<char> searchBuffer(buffer.begin(), buffer.end()); searchBuffer.push_back('\0'); char* str = &searchBuffer.front(); //Try to find the last occurrance of \r\njs> while ((str = strstr(str, "\r\njs> ")) != nullptr) { size_t offset = str - &searchBuffer.front(); if (offset > buffer.size()) break; shellPromptString = buffer.begin() + offset; ++str; } //See if it ends with the prompt. if (shellPromptString != buffer.end()) { if (shellPromptString + 6 != buffer.end()) shellPromptString = buffer.end(); } } if (shellPromptOnly || shellPromptString != buffer.end()) { InCommandEntry = true; SetEvent(InputEvent); if (SuppressShellPrompt) { if (shellPromptOnly) buffer.clear(); else buffer.erase(shellPromptString, buffer.end()); } } else { InCommandEntry = false; } } void JavaScriptStdOutPostFilter() { //Release the lock on stdout LeaveCriticalSection(&OutputEvent); } WORD consoleAttributes = 0; void JavaScriptStdErrFilter(std::vector<char>& buffer) { //Lock stdout EnterCriticalSection(&OutputEvent); CONSOLE_SCREEN_BUFFER_INFO info = {0}; if (GetConsoleScreenBufferInfo(GetStdHandle(STD_ERROR_HANDLE), &info)) consoleAttributes = info.wAttributes; SetConsoleTextAttribute(GetStdHandle(STD_ERROR_HANDLE), FOREGROUND_RED | FOREGROUND_INTENSITY); } void JavaScriptStdErrPostFilter() { if (consoleAttributes) { SetConsoleTextAttribute(GetStdHandle(STD_ERROR_HANDLE), consoleAttributes); consoleAttributes = 0; } //Release the lock on stdout LeaveCriticalSection(&OutputEvent); } void JavaScriptStdInFilter(std::vector<char>& buffer) { static bool InWith = false; if (!InWith && InCommandEntry) { InWith = true; const char Header[] = "with (window) {"; buffer.insert(buffer.begin(), Header, Header + sizeof(Header) - 1); } const char* newline = nullptr; if (!buffer.empty()) { char* bufferPtr = &buffer.front(); newline = strstr(bufferPtr, "\r\n"); if (!newline) newline = strchr(bufferPtr, '\n'); } if (InWith && newline) { InWith = false; InCommandEntry = false; const char Footer[] = "}"; buffer.insert(buffer.begin() + (newline - &buffer.front()), Footer, Footer + sizeof(Footer) - 1); } } }
77d6f022bc5c125b890b15792a5fff16cb996af1
bf5b3d41672ebfe80cfa5b21e5f73ab746dd6f18
/subphonic/g_comp/g_doppler.cpp
f44454236db397919433e7cd332bbbf58bb15144
[]
no_license
tenso/subphonic
b20a6c78a7412d1f3ba4d151277b4e899bfd847a
406109bbc04b25927c16a88c54facc274fe72981
refs/heads/master
2021-01-15T21:50:17.373008
2012-01-01T22:52:33
2012-01-01T22:52:33
3,084,568
0
0
null
null
null
null
UTF-8
C++
false
false
1,171
cpp
#include "g_doppler.h" GDoppler::GDoppler(BitmapFont* f, GroundMixer& g) : SoundComp(g) { doppler = new ValueDoppler(NUM-1, &empty); doppler->setInput(&empty); Pixmap* back_pix = new Pixmap(pix["128x38"]); add(back_pix); add(new MoveBorder(this,back_pix->pos.w,20),0,0); Label* l = new Label(fnt["label"]); l->printF("doppler"); add(l,GCOMP_LABEL_XOFF, GCOMP_LABEL_YOFF); uint yoff=20; //inputs it = new InputTaker(pix["in"], this,0); addInputTaker(it); add(it,5, yoff); //output for(uint i=0;i<NUM;i++) { og[i] = new OutputGiver(pix["out"],this, i); addOutputGiver(og[i]); add(og[i], 30+16*i, yoff); } l = new Label(f); l->printF(">"); add(l,20,yoff+2); } Value** GDoppler::getOutput(unsigned int id) { if(id==0)return (Value**)&doppler; DASSERT(id-1 >= 0 && id-1 < NUM-1); return doppler->getSlave(id-1); } void GDoppler::addInput(Value** out, unsigned int fromid) { //in=out; doppler->setInput(out); } void GDoppler::remInput(Value** out, unsigned int fromid) { doppler->setInput(&empty); }
623090a59014e1c4c9585a41ed6f07f927528fdc
6b2a8dd202fdce77c971c412717e305e1caaac51
/solutions_5636311922769920_1/C++/iamnoobi/D2.cpp
76f012ae3bf0b60f2720e9f3fb572f97747df94a
[]
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,975
cpp
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef vector<int> vi; typedef vector<vi> vvi; typedef pair<int, int> ii; typedef pair<int, ii> iii; typedef vector<ii> vii; template <typename Type> void print_array(Type* array, int start, int end); template <typename Type> void print_vector(vector<Type> v); #define FOR(i,a,b) for (int i = (a),_b = (b); i < _b; i++) #define DOW(i,b,a) for (int i = (b),_a = (a); i >= _a; i--) #define fill(a,v) memset(a, v, sizeof a) #define checkbit(n,b) ((n >> b) & 1) #define pb(a) push_back(a) #define ALL(a) (a).begin(), (a).end() #define SZ(a) (int)(a).size() #define INF 1e9 #define PI acos(-1.0) #define s(n) scanf("%d",&n) #define sc(n) scanf("%c",&n) #define sl(n) scanf("%lld",&n) #define sf(n) scanf("%lf",&n) #define ss(n) scanf("%s",n) int tc; ll k,c,s; int cse=1; int main() { ios::sync_with_stdio(false); cin.tie(NULL); freopen("output.txt", "w", stdout); cin >> tc; while(tc--){ cout << "Case #" << cse++ << ":"; cin >> k >> c >> s; int expected = (k+c-1) / c; if(s < expected) { cout << " IMPOSSIBLE" << endl; continue; } vector<ll> starting; FOR(i, 0, k) starting.push_back(i); FOR(i, 1, c){ vector<ll> newstart; FOR(j, 0, SZ(starting)-1){ newstart.push_back(starting[j] * k + i + j); } starting = newstart; } int idx = SZ(starting)-1; while(idx > -c){ if(idx >= 0) cout << " " << starting[idx] + 1; else cout << " " << starting[0] + 1; idx -= c; } cout << endl; } return 0; } template <typename Type> void print_array(Type* array, int start, int end){ cout << "["; FOR(i, start, end){ cout << array[i] << " "; } cout << "]\n"; } template <typename Type> void print_vector(vector<Type> v){ cout << "["; FOR(i, 0, SZ(v)){ cout << v[i] << " "; } cout << "]\n"; }
91d16a11f6d57134a55e7d3778b8160b2f888522
91a882547e393d4c4946a6c2c99186b5f72122dd
/Source/XPSP1/NT/inetsrv/msmq/src/trigger/trigobjs/trigset.hpp
e6e3f0a7983935756284c87465caba4834eff680
[]
no_license
IAmAnubhavSaini/cryptoAlgorithm-nt5src
94f9b46f101b983954ac6e453d0cf8d02aa76fc7
d9e1cdeec650b9d6d3ce63f9f0abe50dabfaf9e2
refs/heads/master
2023-09-02T10:14:14.795579
2021-11-20T13:47:06
2021-11-20T13:47:06
null
0
0
null
null
null
null
UTF-8
C++
false
false
6,243
hpp
//***************************************************************************** // // Class Name : CLog // // Author : James Simpson (Microsoft Consulting Services) // // Description : Implements a log object that provides the MSMQ trigger objects // with a single interface for writing to a log. // // When | Who | Change Description // ------------------------------------------------------------------ // 02/01/98 | jsimpson | Initial Release // //***************************************************************************** #ifndef __MSMQTRIGGERSET_H_ #define __MSMQTRIGGERSET_H_ #include "resource.h" // Base class that handle receiving and sending notification msgs #include "trignotf.hpp" // Used to allow STL to compile without thousands of warnings. #pragma warning(disable:4786) // Include the definition of the CRuntimeTriggerInfo class (used to hold trigger info) #include "triginfo.hpp" // Define a new type - a 2D map of Trigger-ID's and pointers to instance of CRuntimeTriggerInfo typedef std::map<std::wstring,CRuntimeTriggerInfo*, std::less<std::wstring> > TRIGGER_MAP; class ATL_NO_VTABLE CMSMQTriggerSet : public CComObjectRootEx<CComMultiThreadModel>, public CComCoClass<CMSMQTriggerSet, &CLSID_MSMQTriggerSet>, public ISupportErrorInfo, public IConnectionPointContainerImpl<CMSMQTriggerSet>, public IDispatchImpl<IMSMQTriggerSet, &IID_IMSMQTriggerSet, &LIBID_MSMQTriggerObjects>, public CMSMQTriggerNotification { public: CMSMQTriggerSet(); ~CMSMQTriggerSet(); DECLARE_REGISTRY_RESOURCEID(IDR_MSMQTRIGGERSET) DECLARE_GET_CONTROLLING_UNKNOWN() DECLARE_PROTECT_FINAL_CONSTRUCT() BEGIN_COM_MAP(CMSMQTriggerSet) COM_INTERFACE_ENTRY(IMSMQTriggerSet) COM_INTERFACE_ENTRY(IDispatch) COM_INTERFACE_ENTRY(ISupportErrorInfo) COM_INTERFACE_ENTRY(IConnectionPointContainer) COM_INTERFACE_ENTRY_AGGREGATE(IID_IMarshal, m_pUnkMarshaler.p) END_COM_MAP() BEGIN_CONNECTION_POINT_MAP(CMSMQTriggerSet) END_CONNECTION_POINT_MAP() HRESULT FinalConstruct() { return CoCreateFreeThreadedMarshaler(GetControllingUnknown(), &m_pUnkMarshaler.p); } void FinalRelease() { m_pUnkMarshaler.Release(); } CComPtr<IUnknown> m_pUnkMarshaler; private: // A map of CRuntimeTriggerInfo objects keyed by Trigger ID. TRIGGER_MAP m_mapTriggers; // Used to destroy the contents of the rule map. void ClearTriggerMap(); // Builds the map of triggers based on registry data. bool PopulateTriggerMap(); // Used to find a trigger in the map based on the trigger id. long FindTriggerInMap(BSTR sTriggerID, CRuntimeTriggerInfo ** ppTrigger,TRIGGER_MAP::iterator &i); // Check if exist triggers that are attached to given queue bool ExistTriggersForQueue(const BSTR& bstrQueueName) const; // Check if Receive triggers exist for the requested queue bool ExistsReceiveTrigger(const BSTR& bstrQueueName) const; DWORD GetNoOfTriggersForQueue(const BSTR& bstrQueueName) const; void SetComClassError(HRESULT hr); public: STDMETHOD(get_TriggerStoreMachineName)(/*[out, retval]*/ BSTR *pVal); STDMETHOD(Init)(/*[in]*/ BSTR bstrMachineName); STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid); STDMETHOD(UpdateTrigger)(/*[in]*/ BSTR sTriggerID, /*[in]*/ BSTR sTriggerName , /*[in]*/ BSTR sQueueName, /*[in]*/ SystemQueueIdentifier SystemQueue, /*[in]*/ long lEnabled , /*[in]*/ long lSerialized, /*[in]*/ MsgProcessingType msgProcType); STDMETHOD(Refresh)(); STDMETHOD(AddTrigger)(/*[in]*/ BSTR sTriggerName, /*[in]*/ BSTR sQueueName, /*[in]*/ SystemQueueIdentifier SystemQueue, /*[in]*/ long lEnabled, /*[in]*/ long lSerialized, /*[in]*/ MsgProcessingType msgProcType, /*[out]*/ BSTR * psTriggerID); STDMETHOD(DeleteTrigger)(/*[in]*/ BSTR sTriggerID); STDMETHOD(GetRuleDetailsByTriggerID)(/*[in]*/ BSTR sTriggerID, /*[in]*/ long lRuleIndex, /*[out]*/ BSTR * psRuleID, /*[out]*/ BSTR * psRuleName, /*[out]*/ BSTR * psDescription, /*[out]*/ BSTR * psCondition , /*[out]*/ BSTR * psAction , /*[out]*/ BSTR * psImplementationProgID, /*[out]*/ BOOL * pfShowWindow);//, ///*[out]*/ long * plRefCount ); STDMETHOD(GetRuleDetailsByTriggerIndex)(/*[in]*/ long lTriggerIndex, /*[in]*/ long lRuleIndex, /*[out]*/ BSTR *psRuleID, /*[out]*/ BSTR *psRuleName, /*[out]*/ BSTR * psDescription, /*[out]*/ BSTR *psCondition, /*[out]*/ BSTR *psAction , /*[out]*/ BSTR * psImplementationProgID, /*[out]*/ BOOL * pfShowWindow);//, ///*[out]*/ long * plRefCount ); STDMETHOD(GetTriggerDetailsByID)(/*[in]*/ BSTR sTriggerID , /*[out]*/ BSTR * psTriggerName , /*[out]*/ BSTR * psQueueName, /*[out]*/ SystemQueueIdentifier* pSystemQueue, /*[out]*/ long * plNumberOfRules, /*[out]*/ long * plEnabledStatus, /*[out]*/ long * plSerialized, /*[out]*/ MsgProcessingType * pMsgProcType); STDMETHOD(GetTriggerDetailsByIndex)(/*[in]*/ long lTriggerIndex , /*[out]*/ BSTR * psTriggerID , /*[out]*/ BSTR * psTriggerName , /*[out]*/ BSTR * psQueueName, /*[out]*/ SystemQueueIdentifier* pSystemQueue, /*[out]*/ long * plNumberOfRules, /*[out]*/ long * plEnabledStatus, /*[out]*/ long * plSerialized, /*[out]*/ MsgProcessingType * pMsgProcType); STDMETHOD(get_Count)(/*[out, retval]*/ long *pVal); STDMETHOD(DetachRule)(/*[in]*/ BSTR sTriggerID, /*[in]*/ BSTR sRuleID); STDMETHOD(AttachRule)(/*[in]*/ BSTR sTriggerID , /*[in]*/ BSTR sRuleID , /*[in] */ long lPriority); STDMETHOD(DetachAllRules)(/*[in]*/ BSTR sTriggerID); }; #endif //__MSMQTRIGGERSET_H_
545f3fbd68ef0694d8c3624c89397b5610041cb9
5e00242dc035fdab6aa6bbb40c6d7e6c119ad8e6
/Vault/Codeforces Problems/1032A.cpp
710de08dbe49c44f0a9ca7563538a34e3e2f8c8c
[]
no_license
AkiLotus/AkikazeCP
39b9c649383dcb7c71962a161e830b9a9a54a4b3
064db52198873bf61872ea66235d66b97fcde80e
refs/heads/master
2023-07-15T09:53:36.520644
2021-09-03T09:54:06
2021-09-03T09:54:06
141,382,884
9
1
null
null
null
null
UTF-8
C++
false
false
26,326
cpp
/********************************************************** * Code written by Akikaze * * Duy-Bach Le, #Team4T's Chief Executor * * #Team4T Tertiary Flagship - Oblivion * * * * Written by a random fan of momocashew and Chiho * * * * Arigatougozaimasu, imouto-chan. * **********************************************************/ /************** [OPTIMIZATION PROTOCOL] **************/ #pragma comment(linker, "/stack:225450978") #pragma GCC optimize("Ofast") /*****************************************************/ /************** [LIBRARY PROTOCOL] **************/ #include <bits/stdc++.h> using namespace std; /************************************************/ /************** [LEGENDS/CONSTANTS] **************/ #define endl '\n' #define i64 long long #define ld long double #define rsz resize #define pub push_back #define mp make_pair #define fi first #define se second typedef vector<i64> vi; typedef vector<ld> vd; typedef vector<string> vs; typedef vector<char> vc; typedef vector<bool> vb; typedef pair<i64, i64> pii; typedef pair<i64, pii> pip; typedef pair<pii, i64> ppi; const long long Mod = 1000000007LL, INF = 1e9, LINF = 1e18; const long double Pi = 3.141592653589793116, EPS = 1e-9, Gold = ((1+sqrt(5))/2); long long keymod[] = {1000000007LL, 1000000009LL, 1000000021LL, 1000000033LL}; long long keyCount = sizeof(keymod) / sizeof(long long); /*************************************************/ /************** [BITWISE FUNCTIONS] **************/ template<class T> int getbit(T s, int i) { return (s >> i) & 1; } template<class T> T onbit(T s, int i) { return s | (T(1) << i); } template<class T> T offbit(T s, int i) { return s & (~(T(1) << i)); } template<class T> int cntbit(T s) { return __builtin_popcountll(s); } /*************************************************/ /************** [MASTER CONTROLS - PHASE 1] **************/ auto TimeStart = chrono::steady_clock::now(); auto TimeEnd = chrono::steady_clock::now(); #define OImode 227420978 #define MultiTest 227420978 #define Interactive 227420978 #undef OImode // Switch this off if submitting OI problems. #undef MultiTest // Switch this off if submitting multi-test problems. #undef Interactive // Switch this off if submitting interactive problems. Also required when you need to debug step-by-step. void ControlIO(int argc, char* argv[]); void TimerStart(); void TimerStop(); void Exit(); string cppstr_infile = "FILE.IN"; string cppstr_outfile = "FILE.OUT"; /*********************************************************/ /************** [GLOBAL VARIABLES] **************/ i64 n, k; vi a, cnt(101, 0); /************************************************/ /************** [FUNCTIONS] **************/ void Input() { cin >> n >> k; a.rsz(n); for (auto &x: a) { cin >> x; cnt[x]++; } } void Solve() { i64 ans = 0; i64 Max = *max_element(cnt.begin(), cnt.end()); i64 dishes = (Max / k) + (Max % k != 0); for (i64 i=0; i<101; i++) { if (!cnt[i]) continue; ans += max(0LL, k * dishes - cnt[i]); } cout << ans; } /*****************************************/ /************** [MAIN] **************/ int main(int argc, char* argv[]) { ControlIO(argc, argv); #ifndef Interactive ios_base::sync_with_stdio(0); cin.tie(NULL); #else ios_base::sync_with_stdio(0); #endif #ifndef MultiTest Input(); TimerStart(); Solve(); TimerStop(); #else int T; cin >> T; TimerStart(); while(T--) {Input(); Solve();} TimerStop(); #endif return 0; } /************************************/ /************** [MASTER CONTROLS - PHASE 2] **************/ void ControlIO(int argc, char* argv[]) { char* infile = new char[cppstr_infile.size()+1]; char* outfile = new char[cppstr_outfile.size()+1]; strcpy(infile, cppstr_infile.c_str()); strcpy(outfile, cppstr_outfile.c_str()); #ifdef Akikaze time_t t = time(0); tm* now = localtime(&t); cout << "Source code by #Team4T-Akikaze.\n"; cout << "Current time: "; cout << (now->tm_year + 1900) << '-' << ((now->tm_mon < 9) ? "0" : "") << (now->tm_mon + 1) << '-' << ((now->tm_mday < 10) ? "0" : "") << now->tm_mday << " | " << ((now->tm_hour < 10) ? "0" : "") << now->tm_hour << ":" << ((now->tm_min < 10) ? "0" : "") << now->tm_min << ":" << ((now->tm_sec < 10) ? "0" : "") << now->tm_sec << "\n\n"; #ifdef OImode cout << "OI-Mode: ON\n"; cout << "Input file: " << infile << endl; cout << "Output file: " << outfile << endl; cout << "\n"; #else cout << "OI-Mode: OFF\n"; cout << "Input file: NULL\n"; cout << "Output file: NULL\n"; cout << "\n"; #endif #ifdef MultiTest cout << "MultiTest-Mode: ON\n"; #else cout << "MultiTest-Mode: OFF\n"; #endif #ifdef Interactive cout << "Interactive-Mode: ON\n\n"; #else cout << "Interactive-Mode: OFF\n\n"; #endif if (argc > 1) assert(freopen(argv[1], "r", stdin)); if (argc > 2) assert(freopen(argv[2], "w", stdout)); #elif OImode freopen(infile, "r", stdin); freopen(outfile, "w", stdout); #endif } void TimerStart() { #ifdef Akikaze TimeStart = chrono::steady_clock::now(); #endif } void TimerStop() { #ifdef Akikaze TimeEnd = chrono::steady_clock::now(); auto ElapsedTime = TimeEnd - TimeStart; cout << "\n\nTime elapsed: " << chrono::duration<double>(ElapsedTime).count() << " seconds.\n"; #endif } void Exit() { TimerStop(); exit(0); } /*********************************************************/ /********************************************************************************************************************************************************************************************************* * ti;. .:,:i: :,;;itt;. fDDEDDEEEEEEKEEEEEKEEEEEEEEEEEEEEEEE###WKKKKKKKKKKKKKKKKKKKKWWWWWWWWWWWWWWWWWWW#WWWWWKKKKKEE :,:. f::::. .,ijLGDDDDDDDEEEEEEE* *ti;. .:,:i: .:,;itt;: GLDEEGEEEEEEEEEEEEEEEEEEDEEEEEEEEEEE#W#WEKKKKKKKKKKKKKKKKKKKKKKKWWWWWWWWWWWWWWWWWWWWWWKKKKKKG. .::. f:,...,ijLGDDDDDDDDEEEEEE * *ti;. .:,:i: :,;;iti, :fDDEEEEEEEEEEEEEEEKEEEEDEEEEEEEEEEEW##WEEEKKKKKKKKKKKKKKKKKKKKKWWWWWWWWWWWWWWWWWWWWWWWKKKKKKEG .::. .f,::,ijLGDDDDDDDDEEEEEE * *ti;. .:,:i: .,,;iti;. LDDEEEEEEEEEEKEEEEWEEEDDEEEEEEEEEEE#WWWEEEEEKKKKKKKKKKKKKKKKKKKKKKKKKWWWWWWWWWWWWWWWWWWWKKKKKEDj .::. .:L;;ijfGDDDDDDDDDEEEEE * *ti;. .:,:i: .:,;;iii:LLDEEEEEEEEEEEKEEEEEEEEDEEEEEEEEEEEW#WWEEEEEEEKKKKKKKKKKKKKKKKKKKKKKKKKWWKWWWWWWWWWWWWWWKKKKKKKEL .::. .:;LijLGGDDDDDDDDEEEEE * *ti;. .:,:;: :,;;ittfDEEEEEEEEEEEEEEEEKEEEGEEEEEEEEEEEKWWWEEEEEEEEEKKKKKKKKKKKKKKKKKKKKKKKKKKWWWWWWWWWWWWWWWKKKKKKKELj .::. :,;jffGGDDDDDDDDDEEEE * *ti;. .:,:i: .,;;tGGDEEEEEEEEEEEKEEEKEEEDEEEEEEEEEEEEWWWEEEEEEEEEEEEKKKKKKKKKKKKKKKKKKKKKKKKKKWWWWWWKWWWWWWKKKKKKKEEL .::. .:;itDGGDDDDDDDDDEEEE * *ti;. .:::;: :;ifDEEEEEEEEEEEEKEEEKEEEEEEEEEEEEEEEWWWEEEEEEEEEEEEEEKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKW#WWWKKKKKKKKEEf .::. :,itfGEDDDDDDDDDDDEE * *ti;. .:::;: :GGEEEEEEEEEEEKEKEEKEEEEEEEEEEEEEEEEWWEEEEEEEEEEEEEEEEEKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKW#WKKKKKKKKKEEDG .::. .,;jfLGKDLDDDDDDEEDD * *ti;. .:::;: fDEEEEEEKKKKKKKKKEKEEEEEEEEEEEEEEE#WEEEEEEEEEEEEEEEEEEKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKW#KKKKKKKKKKEEf .:::. .,;tfLGDEDDDDDDDDEEE * *ti;. :::;: fDEEEEEEKKKKKKKKKKWKEEEEEEEEEEEEEEEWKEEEEEEEEEEEEEEEEEEEEKEKKKKKKKKKKKKKKKKKKKKKKKKKKKKW##KKKKKKKKKEEft :::. .,;tfLGDDDKDDDDDDDDD * *ti;. .::;: fDEEEEEEKKKKKKKWKKKKKEEEEEEEEEEEEE#WEEWEEEEEDEEDEEEEEEEEEEEEKKKKKKKKKKKKKKKKKKKKKKKKKKKKW#WKKKKKKKKEEGG :,:. .,;tfLGGDDDKDDDDDDDD * *ti;. .:.;: tGDEEEEKKKKKKKKKKKKKKKKKEEEEEEEEEEEWEEKWEEEEEEEDEEEEEEEEEEEEEEKEKKKKKKKKKKKKKKKKKKKKKKKKKKWWWKKKKKKKEEDf :::. .,;tfLGGDDDDEDDDDDDD * *ti;. .::;: fDEEEEEKKKKKKKKKKKWKKKKKKKKEEEEEEEWWEEWEEEEEEEEEEEEEEEEEEEEEEEEEEKKKKKKKKKKKKKKKKKKKKKKKKKW##KKKKKKKEEEft.::. .,;tfLGGDDDDDDEDDDDD * *ti;. .:.;: tGDEEEKKKKKKKKKKKKKKKKKKKKKKEKEEEEE#EEWWEEEEEEEEEEEEEEEEEEEEEEEEEEEEKKKKKKKKKKKKKKKKKKKKKKKKW#WKKKKKKEEEGD:::. .,;tfLGGDDDDDDDEDDDD * *ti;. .:.,. LDEEEEKKKKKKKKKKWKWKKKKKKKKKKKKEEEKWEKW#EEEEEEEEEEEEEEEEKEEEEEEEEEEEEEEEKKKKKKKKKKKKKKKKKKKKW##KKKKKKEEEEf,,:. .,;tfLGGDDDDDDDDEDDD * *ti;. ..:.,. LGDEEEEKKKKKKKKKKWKKKKKKKKKKKKKKKKKWEEW#WEEEEEEEEEEEEEEEKEEEEEEEEEEEEEEEEEEEKEKKKKKKKKKKKKKKKK##KKKKKEEEEEfi;,. .,;tfLGGDDDDDDDDDKDD * *tt;. .:.,: jDEEEEKKKKKKKKKKWWKKKKKKKKKKKKKKKKKWKE#WWEEEEEEEEEEEEEEWEEEEEEEEEEEEEEEEEEEEEEEKKKKKKKKKKKKKKKKWWKKKKEEEEDfG;,: .,;tfLGGDDDDDDDDDDKD * *tii,. .:.,. tGDEEEEKKKKKKKKKKWWWKKKKKKKKKKKKKKKWKKWWWKEEEEEEEEEEEEEKEEEEEEEEEEEEEEEEEEEEEEEEEEEEEKKKKKKKKKKKW#KKKKEEEEDGGi;,. .,;tfLGGDDDDDDDDDDDE * *ti;;,:. .:.,: fDEEEEKKKKKKKKKKKWKKKKKKKKKKKKKKKKKWEK#WWKEEEEEEEEEEEEDEEEEEEEEEEEEEEGEEEEEEEEEEEEEEEEEEEKKKKKKKWWKKEEEEEEDDf;;;,. .,;tfLGGDDDDDDDDDDDD * *tii;,,:.. ...,. ;LEEEEEKKKKKKWKKKKWKKKKKKKKKKKKKKKKKEKKW#WEEEEEEEEEEEEEjEEEEEEEEEKEEEEGEEEEEEEEEKEEEEEEEEEEEEEEEEE#WKEEEEEEDDf;;;;,: .,itfLGGDDDDDDDDDDDD * *ti;,,,,,:. ...,. LDEEEEKKKKKKKKKKKWWWKKKKKKKKKKKKKKKWKK#W#WEEEEEEEEEEEDDLEEEEEEEEEWEEEEDEEEEEEEEEKEEEEEEEEEEEEEEEEEWWEEEEEEEDDfj,,,,,:. .,itfGGGDDDDDDDDDDDD * *tii,,,,::::. ...,: .fDEEEEKKKKKKWKKKKWWWKKKKKKKKKKKKKKKEKKW#WWEEEEEEEEEEEKiKEEKEEEEEEWEEEEDEEEEEEEEEEEEEEEEEEEEEEEEEEEWWEEEEEEEDDLD:::,,,:. .,ijfGGGDDDDDDDDDDDD * *ti;:::::::::.. .:.,: LDEEEEKKKKKKKWKKKKWWKKKKKKKKKKKKKKKKtKKWWWWKEEEEEEEEEDiiDEEEEEEEEWWEEEEEEDEEEEEEEEEEEEEEEEEEEEEEEEEEWKEEEEEDDDGL:. .:,,,: .,ijLGGGDDDDDDDDDDDD * *tt;. .::::::::.. ...,: :fDEEEKKKKKKKKKKKKWW#KKKKKKKKKKKKKKKKfKKWWWWKEEEEEEEEDti,DEKEEEEEEWWEEEDEEEEEEEEEKEEEEEEEEEEEEEDEEEEE#WEEEEEGGDGf:. .:,;,:. .,ijLGGDDDDDDDDDDDDD * *tt;. .:::::::.. ...,: GDEEEKKKKKKKKWKKKKWWWKKKWKKKKKKKWWWKDEKLWWWWKKEEEEEEDEi,LDEEEEEEEEWWEEEEEEEEEEEEEEEEEEEEEEEEEDEDEEEEEW#EEEEDDDDGf,. :,,,:...,ijLGGGDDDDDDDDDDDD * *tt;. .....::::.. ...,: fDEEEKKKKKKKKWKKKKWWWWKKKWKKKKKKKKKKfWKiWWW#KKEEEEEEEi;.EDfEEEDEEiWWEEEEEEEEEEEEDGKEEEEEEEEEEDEEEEEEEWWEEEEDDDGGLi. .,;,:::,ijLGGGDDDDDDDDDDDD * *tt;. ....:::::. ...,. iDEEEEKKKKKKKKWKKWKWWWWWKKWWWKKKKKKKKtWKt#WWWKKEEEEEDji..DDKDDEDEGiWKEEEEEEEEEEDDEjEEEEEEEEEEEDEEEEEEEKWKEEDDDDGGff. .:,;,,;ijLGGGDDDDDDDDDDDD * *tt;. ....::::.. .:.,: .LDEEEKKKKKKKKKKKKWWWWKWWWWWWWWWWKKKKWtKKiDWWWKKKEEEEKi:..DEDDDDDDiiWKEEEEEEEEEEDDEijDEEEEEKEEEEEEEEEEEEWWEEGDDDGGLG. .:,;;iijLGGGDDDDDDDDDDDD * *tt;. .....:::.. ...,. .fEEEEKKKKKKKKWKKKKWWWWWWWWWWWWWWKWKKKiKDiLWWWWKEEEEEi,..fD:DDDDDti;WEEEEEEEEEEKDDi:iDDEEEEWEEEEEEEEEEEE#WEEGDDDDGGG. :,iitjLGGGDDDDDDDDDDDD * *tti. .....:::.. ...,. GDEEEKKKKKKKKKWKKKWWW#WWWWWWWWWWWKWKKjiEjitWWWKKWEEEDi...DDLDDDDji;;WEEEEEEEEEEEDEj.iDDEEEEWEEEEEEEEEEEEWWEEDDDDDDGf. .,;tjfLGGDDDDDDDDDDDD * *tti. ....::::.. ...,. fEEEKKKKKKKKKKKKKKKW#WWWWWWWWWWWWWWWWtiEiiiWWWKKEWKEi....D.EDDDEi;.fWEEEEEEEEEEDDfL.;EDDEEEWEEEEEEEEEEEEWWEEEDDDDDGf. :;ijfLGGDDDDDDDDDDDD * *tti. ....::::.. ...,. LDEEEKKKKKKKKKKKKKKWWWWWWWWWWWWWWWW####WKiiiWWWKKKEEK,...:E:DDDEii..GWEEEEEEEEDWDDiL.,KDDEEEWEEEEEEEEEEEEWWKEEDDDDDGf: .,itfLGGDDDDDDDDDDDD * *tti. .....:::.. ...,. fDEEEKKKKKKKKKWKKKKWWWWWWWWWWWWW########WLiiWWWKKKEEjD...G,DDDDi;...EWEEEEEEEEDKDEii..LDDEEEWEEEEEEEEEEEEWWWEEDDDDDGfi .,;tfLGGGDDDDDDDDDDD * *tti. .....:::.. ...,. iGEEEKKKKKKKKKKWKKKKWWWWWWWWWWWW###########KiWWWKKEEE,.D..D.DDDii:...KKEEEEEEEEEDDj:...tEDEEEWEEEEEEEEEEEEWWWEEEDDDDDLL .,;tjLLGGDDDDDDDDDDD * *tti. ....::::......:. LEEEKKKKKKKKKKWWKKKWWW#KWWWWWWWW#####W####W##KWWKKEEL..:D.jjDDi;,....KKEEEEEEEDfDDi...:iKDEEEWKEEEEEEEEEEEWWWEEEEDDDDLG .,;tjLLGGDDDDDDDDDDD * *tti. ...::::::..,. :GEEEKKKKKKKKKKKKWWWWW##WWWWWWWWW##WKWK#W#W####WWKEEK.....G.DDti,.....KKEEEEEEDWGDf.,...iKDEEEWWEEEEEEEEEEEW#WEEEEEDDDGL .,;tjLLGGDDDDDDDDDDD * *tti. ....::::::,. GDEEKKKKKKKKKKKKKWWWW###WWWWWWWWWW#WWWK###W#####WKEKK.....jDDL;;......KKEEEEEEEEEDi.f...;KDEEEWWEEEEEEEEEEEWWWWEEEEEDDGf .,;tjLLGGDDDDDDDDDDD * *tti. ....:::,,. .LEEEKKKKKWKKKKKWWWWWW###WWWWWWWWWW#WWKW#WW##W#WWWKEKD:....:DD:;......;KEEEEEEEKiDD..f...,KKEEEWWEEEEEEEEEEEWWWWEEEEEDDDf .:;tjLLGGGDDDDDDDDDD * *tti. ...::,,,:. GDEEKKKKKKKKKKKKWWWWWWW#WWWWWWWWWWW#KjKWWWWWWWWWWWWEK.j,..;fD.;.......fKEEEEEDKG:Di..,....DKEEEWWEEEEEEKEKKKWWWWEEEEEEDDf .:;tjLLGGDDDDDDDDDDD * *jti. ...::,,,,:. .fEEEKKKKKWKKKKKKWWWWWWW#WWWWWWWWWWK#KKKWWWWWWWWWWWWWK..f:.:G.,:.......EKEEEEEKK;:E:.......fKEEEWWKEKEKKKKKKKW#WWEEEEEEDDf: .,;tfLLGGDDDDDDDDDDD * *tti. ...:,,,;;,: iDEEKKKKKWKKKKKKKWWWWWWW#WWWWWWWWWWK#WDKWWKKWWWWWWWWWE..;G:G..,........KKEEEEEKi.Gi..:.....tKEEKWWWKKKKKKKKKKW##WKEEEEEEDfi .,;tfLLGGGDDDDDDDDDD * *tti. ....::,,;;;,LEEKKKKKKWKKKKKWWWWWWW###WWWWWWWWWWKWWDKWEEEWKKWWWWWKKj.:LG..;.........EKEEEEKG;.G...;.....;KKEKWWWKKKKKKKKKKW##WWKEEEEEDfL .,;tfLGGGDDDDDDDDDDD * *jti. ...::::,;ijDEEKKKKKWKKKKKKWKWWWWW##WWWWWWWWWWWKK#KKGDGDWEEWKKWKKGE,.i;.:.........:EKEEEKE;.:L...j.....,KWEKWWWKKKKKKKKKK####WKKEEEEDLG .,;tfLGGGGDDDDDDDDDD * *jti. ...:...,,;GEEKKKKKWWKKKKKWWWWWWWW###WWWWWWWWWKKKWWKiLGGEDEDEKGKKiEG..;...........jKEEEKK;:.G....,.....:KKEWWWWKKKKKKKWKK####WKKKKEEEGL .,;tfLGGGGDDDDDDDDDD * *jti. ...:. .:,GEEKKKKKWKKKKKWWWWWWWW####WWWWWWWWWKKKWWKii;fDLGDK: EEi:E:.............EKEEKK;;..L...........KKKWWWWKKKKKKKWKK####WKKKWKEEDf .,;tfGGGGDDDDDDDDDDD * *jti. ...:. ,EEKKKKKWWKKKKKWWWWWWWWW###WWWWWWWWKKKKfWWLt;i,. fi EG..D:.............EKEKK;;..t....:.......KWKWWWWKKKKKKKWKK####WKKKWEEEDf:. .,;tfGGGGDDDDDDDDDDD * *jti. ...:. GEEKKKKKWKKKKKWWWWWWWWW####WWWWWWWKKKKKt;KKEfff .;t.................KKKKi;:..GtGGfG.......KWWWWWWKKKKKKKWKK###WWWKKKKEEEf,,: .,;tfGGGGDDDDDDDDDDD * *jti. ...:. GEKKKKKWWKKKKKWWWWWWWWWW##WWWWWWWKKKKKKt;EiKKKK, ...t................jEKKG;;..,.....,LGi....KWWWWWWKKKKKKWKKKW####WKKKKKEEL,,,:. .,;tfGGGDDDDDDDDDDDD * *jti. ...:. .GEEKKKKKWKKKKKWWWWWWWWWW###WWWWWWWKKKKKKtiE::tGG........................EEEj;;...,.........:D..DKWWWWWWKKKKK#KKW###W#WKKKKKEEfj:,,,:. .,;tfGGGDDDDDDDDDDDD * *jti. ...:. DEKKKKKWWKKKKKWWWWWWWWW####WWWWWWWKKKKKKiiE:::.::.......................EEi;;...j.....f......:iDKWWWWWWKKKKK#WW######WKKKKKEELG :,,,,:. .,;tfGGGDDDDDDDDDDDD * *jti. ...:. fEEKKKKWWKKKKWWWWWWWWWWW###WWWWWWWWKKKKKK;tE::..........................DD;.;,.::......;........EWWWWWWWKKKKW#WW#####WWKKKWKKELG .:,,,:::,;tfGGGDDDDDDDDDDDD * *jti. ...:. .DEKEKKKWWKKKKWWWWWWWWWWW###WWWWWWWWKKKKKE,iD::..........................D..,;.,;tLffi...........DWDWWWW#KKKWWWWW#####W#KKKWKEEGL .:,;,,,;tfGGGDDDDDDDDDDDD * *jti. ...:. ;EEKKKKWWKKKKKWWWWWW#WWWW####WWWWWWKKKKKEL:iD:..........................j ..;..;;:.....i,........DKtWWWWWKKWWWWWW#####WWWKKKEKEDf .:,;;;itfGGGDDDDDDDDDDDD * *jti. ...:. DEKKKKKWWKKKKWWWWWWW#WWWW####WWWWWWKKKKKEj:iG...............................:....................GKiWWWWWKKWW#WWW######WWKKKKKEEf .,;iitfGGGDDDDDDDDDDDD * *jti. ...:.:EKKKKKWWKKKKKWWWWWWW#WWW#####WWWWWKWKKKKEi:if:.................................iEKEKKKKKKDj......DKiWWWWWKWK##WW#######WWKKK:KEEL .:;itfGGGDDDDDDDDDDDD * *jji. ...:,DEEKKKWWWKWKKWWWWWWWWWWWW#####WWWWWWWKKKKEi:it..................................j. KKKKKKKKKKKf..DKiWWWWWKWW##WW#######WWKKK,KEEf .,;tfGGGDDDDDDDDDDDD * *jji. ..L:iDEEKKKWWKKKKKWWWWWWWWWWWW#####WWWWWKWKKKKKi.i;.................................. . KKKWWWWWWWWK..DGiWWWWWKK##WWW#####W#WWKKKjEKEL, .:;tfGGGDDDDDDDDDDDD * *jji. .f:::EEEKKKWWWKKKKKWWWWWWWWWWWW#####WWWWWKWKKKKK;.i,.................................:: KKEKWWWWWWfWK..EiiWWWWWKWW#WW##########KKKD,KELj .:;tfGGDDDDDDDDDDDDD * *jji. .t::::,DEEKKKWWKKKKWWWWWWWWW#WWWW#####WWWWKKWKKKEK;.i:.................................GDDEEEKKKWWWWWtWWD.E;iWWWWWW###WW#########WWKKK.EEDG .:;tfGGGDDDDDDDDDDDD * *jji. . j..::::EKEKKKWWWKKKKWWWWWWWWW#WWW######WWWWKKWKKKEK;.t:.................................ELLEDDEEEWWWWEtWK,.KiiWWWWWW###W##########WWKKK:EEEG .;tjfLLGDDDDDDDDDDDDDDD * *jji. i.::::::,EEEKKWWWKKKKKWWWWWWWWW#WWW#####WWWWWKWKKKKEE,.t..................................DfiEGDDDEEKKKttKWG.KiiWWWWW##WWW##########WWKKK:fEEL ,fGGGDDDDDDDDEEEDDDDDDDDDD * *jji. .;:..:::::DEEEKKWWWKKKKKWWWWWWWWW#WWWW####WWWWWWWKKKKED,.t..................................ifjDDGGEGDKK.ttKKE.DiWWWWW###WW##########WWWKKK:.KELiLGGGGDDDDDDDDDDDDEEEDDDDDDD * *jji. i.:.::::::,KEEKKWWWKKKKKKWWWWWWWWW#WWWW####WWWWWWWKKKKEL:.j..................................GGf,;ifLLED .iiKKi:fWWWWWW##W#W##########WWWKKK:.KKLGGDDDDDDDDDDDDDDDDEDDEEDDDDD * *jji. .j:.::::::::EEEKKKWWWKKKKKKWWWWWWWW##WWW#####WWWWWWWKKKKKf:.f..................................:EEfftf .,. ;iE,..jWWWWWWW###W############WWKKK,:KKGDDDDDDDDDDDDDDDDDDDDDDDEDDDD * *jji. .:.::::::::,,EEEKKWWWKKKKKKKWWWWWWWW##WWW#####WWWWWWWKKKKKt..G....................................EEELL; .j....tKWWWWWWW################WWWKKtfGKGEDDDDDDDDDDDDDDDDDDDDDDDEEDD * *jji. :...:::::::,,jEEKKWWWWKKKKKKWWWWWWWWW##KWW#####KWWWWWWKKKKEi..D....................................:jEEE.........;KKWWWWWWWW#WW##W##########WWKKDLGKEKDDDDDDDDDDDDDDDDDDDDDDDDDED * *jji. i:.::::::::,,,EEEKKWWWWKKKKKWWWWWWWWWW##WWW#####WWWWWWWKKKKKi..D......................................:::::......,KKKWWWWWWWWW#####W########WWWKKKGGKKEGGGGGGGGDDDDDDDDDDDDDDDDDDE * *jji. i..:::::::::,,tEEKKWWWWKKKKKWWWWWWWWWWW##WW######WWWWWWWKKKKKi..D......................................::::......:EKKKWWWWWWWWWWW##WW########W#WKKWGGKKGGGGGGGGGGGGGGGDDDDDDDDDDDDD * *jji. .:::::::::::,,,EEEKKWWWWKKKKKWWWWWWWWWWW##WW#####WWWWWWWWKKKKKi..D....................................:::::::::..tELii;KWWWWWWWWWW##WW######WWWWWWKWGGGKGGGGGGGGGGGGGGGGGGGGGGGGGGDG * *jjt. :.::::::::,,,,fEEKKWWWWKKKKKKWWWWWWWWWW###WW####WWWWWWW#WKKKKKi..D....................................:::::::.:.,;;;;;;,KKWWWWWWWWW#WW########WWWKKWGGGKGGGGGGGGGGGGGGGGGGGGGGGGGGGG * *jji. ;.::::::::,,,,;EEEKWWWWWKKKKKWWWWWWWWWWWW##WW###WKWWWWWK#WKKKKKi..G......................................:::::::,;;;;:...KKKWWWWWWWWWKWW#######WWWWKKGLGKDGGGGGGLLGGGGGGGGGGGGGGGGGGG * *jjt. f.:::::::::,,,,fEEKKWWWWWKKKKKWWWWWWWWWWW###WW##WKKWWWWWW#WKKKKK;.jt........i.............................:::::::;j;;....:E.KKKWWWWWWWKWW#####W#WWWWKKLLGWEEGGGGGLGGGGGGGGGGGGGGGGGGGG * *jjt. ...:::::::,,,,,;DEEKWWWWWKKKKKWWWWWWWWWWWW####WWWKKKWWWWWWWWKKKKK;.E;.........t.............................:::::ii;;.....D...KKWWWWWWWKWW#####WWEWWWKKGGGEKKGGGGGLGGGGGGGGGGGGGLGGGGGG * *fji. ;.:::::::,,,,,;LEEKKWWWWWKKKKKWWWWWWWWWWWW####KWKKKKWWWWWWWWKKKKKi.D;..........j.............................:::tt;,.....:.....KKWWWWWWKWWWW##WWWGWWWKKGGGGKEGGGGGGGGGGGGGGGGGGGLLGGGGL * *fji. t::::::::,,,,,,;EEEKWWWWWKKKKKKKWWWWWWWWWWW##WKWKKKKKWWWWWWWWKKKKKi:D;............j...........................::LL;,.............KKWWWWWKWWWWWWWWWGWWWKKGGGGKGGGGGGGGGGGGGGGGGGGGLLGGGGL * *fjt: .:::::::,,,,,,,DEEKWWWWWWKKKKKKKWWWWWWWWWWWWKKWKKKKKKWWWWK#WWKKKKWitE;........... ............................:G;;:...............KKKWWKKWWWWWWWWWGWWWKKGGGGWGGGGGGGGGGGGGGGGGGGGGGGGGGL * *fjji;:. .f:::::::,,,,,,,;EEEKWWWWWWKKKKKKWWWWWWWWWWWKKKKKKKKKKKWWKWWWWWKKKKWGKD;........................................L;;..................DKKWKKWWWWWWWWWGWWWKKDGGGKDGGGGGGGGGGGGGGGGGGGGGGGGGG * *fjjtii;,:. :::::::,,,,,,,;EEEKWWWWWWKKKKKKWWWWWWWWWWKKKKKKKKKKKKWWWWWW#WWKKKKWiEj;......................................:i,;....,...............;KKEKWWWWWWWWWGKWWKKDDGGDEGGGDGGGGGDGGGGGGGGGGGGGGGG * *fjtiiiii;;:. j::::::,,,,,,,;;EEEKWWWWW#KKKKKWWWWWWWWWKKKKKKWKKKKKKKWWWWWWWWWKKKKWtEL;:....................................;;;:...,;j................:KEEWWWWWWWWWDDWWKKDDDDDKDDDDDDDDDDDDDDDGGGGGGGGGGG * *fjti;;iiii;;,:::::::,,,,,,,,;EEEKWWWWWWWKKKKWWWWWWWWKKKKKKKWKKKKKKKWWWWWWW#W#KKKKWEEii;...................................f;:....,;L...................EEKWWWWWWWWDDWWKKDDDDDKEDDDDDDDDDDDDDDDDDDDDDGGGG * *fjt,,,;;;;ii;f::::::,,,,,,,;;EEKWWWWWWWKKKKKWWWKWWKKKKKKKKKKKKKKKKKWWWWWWW#W#KKKKWKEij;:...............................:G;,.....,;f....................:tKKWWWWWWWDDWWKKDDDDDKKDDDDDDDDDDDDDDDDDDDDDDDDD * *jjt. ..:,;;;;,::::,,,,,,,,;;GEEWWWWWWWWKKKKWKKWKKKKKKKKKKKKKKKKKKKKWWWWWWW#W#KKKKWEDi;j;............................,Li;L;;;..,;;f........................KKKKWWWKDDWWKKDDDGDKKGGGGGGGGDGDDDDDDDDDDDDDDD * *fjt. .:,,,:::::,,,,,,,;;;EEKWWWWWWWKKKKKKWKKKKKKKKKKKKKKKKKKKKKWKKKWKW##W#KKKKWEti;;G;........................tEEEL;;;;;;;;;;L..........................DKKKKKEDDWWKEDGftiLE;;;;itjLGGGGGGDDDDDDDDDDD * *fjt. .j::::,,,,,,,;;;DEEWWWWWWWWKKKKWKKKKKKKKKKKKKKKKKKKKKKKWKKWWWK##W#KKKKKEii;;;L;...................iDEEEEEEKKi;j;;;;jD.....:......................,KKKKDGGEKKE:::::;E::::::::::,tLGGDDDDDDDDDD * *fjt. .;:::,,,,,,,;;;;EEKWWWWWWWWKWKKKKKKKKKKKKKKKWKKKKKKKKKKWKKWWWW#WW#KKKKKKii;;;;f;.............:tDEEEEEKKKKKKKKEti;;;L...............................EEKf;:iKKE::::::E::::::::::::::ifDDDDDDDDD * *fjt: :::,,,,,,,,;;;DEEWWWWWWWWWEKKKKKKKKKKKKKKKKKKKKKKKKKKWWKKWWWW####KKKKKEiii;;;;f,.........iDEEEEKKKKKKKKKKKKKKKf;iG......i..........................fK::::KKE::::::E::::::::::::::::,tGGDDDDD * *fjt: t:::,,,,,,;;;;iDEKWWWWWWKEKKKKKKKKKKKKKKKKKKKKKKKKKKKKWWKKWWWW####WKKKKLiii;;;;;L,....,Li;EDEEEEKKKKKKKKKKKKKKKKiG......;:...........................:i:::KKE:::::,E,::::::::::::::::::iGDDDD * *jjt. f::,,,,,,,;;;;GEEWWWWKEEKEKKKKKKKKKKKKKKKKWKKKKKKKKKKKWWKWWWWW###WWKKKKiii;;;;;;;G,;L;;iiEEEEEEEKKKKKKKKKKKKKWWKE......;t.........:....................j::KEE:,::,,D,,::::,,,,,,:::::::::tDDD * *fjt:. ,::,,,,,,,;;;;EEWWKEEEEEEKKKKKKKKKKKKKKKKWKKKKKKKKKKKWWKKWWWWW#W#KKKKKKiiiiii;;;;;i;;iiiEEKEEKKWKKKKKKKWKKKKKWWWGi;...;t......,;;;;,....................:,EEE,,,,,,D,,,,,,,,,,,,,,,,::,::::tG * *fjt:. ,::,,,,,,,;;;;DEKEEEEEEEEKKKKKKKKKKKKKKKKKKKKKKKKKKKKKWWWWWWWWW#W#KKKKKKiiiii;;i;;;;;iiiKKKEKKKKWWKWWWWWWKKKKWWWWW;;;:;L.....;;;;;;;;;....................,KEE,,,,,,E,,,,,,,,,,,,,,,,,,,,,,,,; * *fjt:. f:,,,,,,,;;;;jEDEEEEEEEEEKKKKKKKKKKKKKKKKKKKKKKKKKKKKKWWWWWWWW#W##KKKKKKiiiiiiii;i;;iiiEKKKKKKKKWKWWWWWWWWKKKWWWWWKi;;i.....,jEEfGi;;;;;...................EED,,,,,,E,,,,,,,,,,,,,,,,,,,,,,,,, * *fjt:. .f::,,,,,,;;jEEDEEEEEEEEEEKKKKKKKKKKKKKKKWKKKKKKKKKKKKKWWWKWWWWW###KKKKKLiiiiiiiiiiiiiiEEKKKKKKKKWWWWWWWWWWWWKWWWWWWGi;i;,..;jDDDKEGi;;;;;;:................EED,,,,,,D,,,,,,,,,,,,,,,,,,,,,,,,, * *fjt:. .. ;::,,,,,;;EDDEEEEEEEEEEKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKWWKKW#WW####KWKKKiiiiiiiiiiiiijKKKKKKKKKKWWWWWWWWWWWWWWWWWWWWWt;i;;;;i;DDDDDDGi;;;;;;;;:.............EDf;,,,;,G;;;;;;;;;;;;;;;,,,,,,,,,, * *fjt:......:,,,,,,;LDDDEEEEEEEEEEEKKKKKKKKKKKKKKKKWKKKKKKKKKKKKKWWWWKWWWW####KKKKKiiiiiiiiiiijKEKKWKKKKKKKWWWWWWWWWWWWWWWWWWWWWWiLiii;i;DEEEEDDE;i;;;;;;;;;:..........EDi,;;;;;L;;;;;;;;;;;;;;;;;;,,,,,,, * *fjt:......:,,,,,;EDDDEEKEEEEEEEEEKKKKKKKKKKKKKKKWKKKKKKKKKKKKKKWWWWKKWWW##W#KWKKWEiiiiiijGKKKKKWWKKKKKKKKWWWWWWWWWWWWWWWWWWWWWWKi;iiiiDDEEEEEEDEi;;;;;;;;;;;;;,:.....ED;;;;;;;j;;;;;;;;;;;;;;;;;;;;;;;,, * *fjt:.....t,,,,,;DDDDEEEKEEEEEEEEKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKWWWKKKWWWW##WKWKKWKiiiKKKKKKKKKWWKKKKKKKKWWWWWWWWWWWWWWW#WWWWWWWWWiiiiifLEEEEEEEEDi;i;;;;;;;;;;;;.....DD;;;;;;;i;;;;;;;;;;;;;;;;;;;;;;;;; * *fjt:.....G,,,,,GDDDEEEEEEEEEEEEKKKKKKKKKKKKKKKKWKKKKKKKKKKKKKKKWWWKKKWWW###WKWKKWKitKKKKKKKKKWKKKKKKKKKKWWWWWWWWWWWWWW###WWWWWWWWEiiiiiiiEEEEEEEEDGiiii;;;;;;;;;.....GD;;;;;;;i;;;;;;;;;;;;;;;;;;;;;;;;; * *fjt:.....L,,,,;GDDDEEEEEEEEEEKEKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKWWWWWDGWWW###KKWWKWKKKKKKKKKKKKKKKKKKKKKKKWWWWWWWWWWWWW####WWWWWWWWWiiiiiiiiEEEEEEEEEEDi;i;;;;;;;;.....Lj;;;;;;i;iiiiii;;;;;;ii;;;;;;;;;;; * ***********************************************************************************************************************************************************************************************************/
30b2c352df06ee28bb6bc2aa9ddf79bba29556b7
df84eebd8f6f6d3cb6e220ff050d28f593d764e5
/dialog.h
8b081ae53c04e2ede96a60e279f52ddf33511125
[]
no_license
Liuxz17/QTCppGame
29d6981e2503b6db4db0dd0be58c48fe2fca169e
17cf405b4954ba0a5c8c64a0b360a2dc243c74ca
refs/heads/master
2020-03-28T09:17:13.983224
2018-09-09T13:04:40
2018-09-09T13:04:40
null
0
0
null
null
null
null
UTF-8
C++
false
false
719
h
#ifndef DIALOG_H #define DIALOG_H #include <QDialog> #include "EdpBass.h" #include "KeyIO.h" #include "TestView.h" using namespace edp; namespace Ui { class Dialog; } class Dialog : public QDialog { Q_OBJECT public: explicit Dialog(QWidget *parent = 0); ~Dialog(); protected: virtual void keyPressEvent(QKeyEvent *event); virtual void keyReleaseEvent(QKeyEvent *event); private: Ui::Dialog *ui; TestView *view; private slots: void on_pushButton_4_clicked(); void on_progressBar_valueChanged(int value); void on_horizontalSlider_valueChanged(int value); void on_pushButton_2_clicked(); void on_pushButton_clicked(); void animate(); }; #endif // DIALOG_H
40a8f4e8d147bdb8cc1cd04d0c108e7faaf60bcd
e5dc9d8142d807b87e6a7980670ecba28e4a9523
/KsDevDX11/device/KsIndexBufferDX11.h
bbc51a3cf7b062766c3dedaf024d3eeabbd37f34
[ "MIT" ]
permissive
a567w/AriaGame
e2c692e32d0afcf3e7ec7a676456e4d4a35c19d7
bf90f79cecd5e27e221fa0e791a784d9be5ef06f
refs/heads/master
2020-07-01T05:03:26.856425
2019-11-05T13:45:56
2019-11-05T13:45:56
201,052,112
0
0
null
null
null
null
SHIFT_JIS
C++
false
false
4,733
h
/************************************************************************************************/ /** * @file KsIndexBufferDX11.h * @brief インデックスバッファ * @author Tsukasa Kato * @date ----/--/-- * @since ----/--/-- * @version 1.0.0 */ /************************************************************************************************/ #ifndef __KSINDEXBUFFERDX11_H__ #define __KSINDEXBUFFERDX11_H__ /*==============================================================================================*/ /* << インクルード >> */ /*==============================================================================================*/ /*==============================================================================================*/ /* << 定義 >> */ /*==============================================================================================*/ /*==============================================================================================*/ /* << 宣言 >> */ /*==============================================================================================*/ class KsRenderSystemDX11; /************************************************************************************************/ /** * @class KsIndexBufferDX * @brief インデックスバッファ * @author Tsukasa Kato * @date ----/--/-- * @since ----/--/-- */ /************************************************************************************************/ class ksDEVDX11_API KsIndexBufferDX11 : public KsIndexBuffer { friend class KsRenderContextDX11; public: /** * コンストラクタ * @param pRenderSystem 描画システム * @param pData データ読み込み用のポインタ * @param size データサイズ * @param numIndex インデックスの数 * @param indexFormat インデックスフォーマット * @param flags フラグ */ KsIndexBufferDX11( KsRenderSystemDX11* pRenderSystem, void* pData, KsUInt32 size, KsUInt32 numIndex, KsUInt32 indexFormat, KsUInt32 flags ); /** * デストラクタ */ virtual ~KsIndexBufferDX11(); /** * インデックスバッファを生成する * @param pRenderSystem 描画システム * @param pData データ読み込み用のポインタ * @param size データサイズ * @param numIndex インデックスの数 * @param indexFormat インデックスフォーマット * @param flags フラグ * @retval ksTRUE 生成成功 * @retval ksFALSE 生成失敗 */ virtual KsBool create( KsRenderSystemDX11* pRenderSystem, void* pData, KsUInt32 size, KsUInt32 numIndex, KsUInt32 indexFormat, KsUInt32 flags ); /** * 破棄処理 */ virtual void destroy(); /** * リソースを取得する * @return リソース */ virtual void* getBufferResource(); /** * インデックスバッファをロックする * @param pContext 描画コンテキスト * @param flags ロックフラグ * @return ロックしたバッファの先頭ポインタ */ virtual void* lock( const KsRenderContext* pContext, KsUInt32 flags ); /** * インデックスバッファのロックを解除する * @param pContext 描画コンテキスト */ virtual void unlock( const KsRenderContext* pContext ); /** * インデックスバッファからの読み込み * @param pContext 描画コンテキスト * @param pData データ読み込み用のポインタ * @param size データサイズ */ virtual void read( const KsRenderContext* pContext, void* pData, KsUInt32 size ); /** * インデックスバッファへの書き込み * @param pContext 描画コンテキスト * @param pData データ読み込み用のポインタ * @param size データサイズ */ virtual void write( const KsRenderContext* pContext, void* pData, KsUInt32 size ); /** * インデックスバッファバッファを取得 * @return インデックスバッファのポインタ */ ID3D11Buffer* getIndexBuffer() { return m_pIndexBuffer; } private: KsRenderSystemDX11* m_pRenderSystem; /**< 描画システム */ ID3D11Buffer* m_pIndexBuffer; /**< DirectXインデックスバッファ */ KsUInt32 m_indexSize; /**< インデックスサイズ */ D3D11_MAPPED_SUBRESOURCE m_resource; /**< アクセス用リソース */ }; #endif /* __KSINDEXBUFFERDX11_H__ */
3dd0030b4a463a3ceab7741dd477f501239fb822
b446b8610ea2601b3eaaa45d1292eb3adc199841
/program3/matt/validation.cpp
11ac61710390f98f1cedbf57bdb565d5d4faaeba
[]
no_license
rc735/ece4960_RobustProgramming
3ad97890f151a514b2a743e7f8a27dc93705cb0d
0fd95a63efa8ade75dc226179320af4a67513f42
refs/heads/master
2021-01-21T13:26:51.874297
2016-05-09T19:46:12
2016-05-09T19:46:12
51,113,328
0
0
null
null
null
null
UTF-8
C++
false
false
8,163
cpp
// // validation.cpp // Program3 // // Created by Matthew Magaldi on 3/19/16. // Copyright © 2016 Matthew Magaldi. All rights reserved. // #include "validation.hpp" #include "matrixOps.hpp" #include <cmath> #include <iostream> using namespace std; /* Generate S value function INPUTS: *a - pointer to parameter array *x - pointer to x array size - number of parameters index - index of the S_model in terms of which x data point *S_model - pointer to the S model array Constraint is that number of parameters must be 1 or greater */ void generateS(double *a, double x, int size, int index, double *S_model) { if (size < 1) { return; } double S = a[0]; for (int i = 1; i < size; i++) { S += a[i]*pow(x, i); } S_model[index] = S; } /* Generic V least square fitting INPUTS: *a - pointer to parameter array *x - pointer to x array *S_measured - pointer to the measurement data array */ double V(double *a, double *x, double *S_measured) { double V = 0; double S_model[10]; int size = 2; for (int i = 0; i < 10; i++) { generateS(a, x[i], size, i, S_model); V += pow(S_model[i]-S_measured[i], 2); } return V; } /* Computes the Hessian or second partial derivative matrix numerically INPUTS: **hessian - pointer to the hessian matrix stored in memory *a - pointer to parameter array *x - pointer to x array *S_measured - pointer to data array size - number of parameters */ void computeHessianMatrix(double **hessian, double * a, double * x, double * S_measured, double * derivative, int size) { //know rank of hessian matrix to be size^2 double t = 0.001; double da[2] = {a[0]*t,a[1]*t}; //this is delta of all parameters - need to generalize this double a1[2] = {a[0], a[1]}; //this is parameters with delta for first parameter double a2[2] = {a[0], a[1]}; //this is parameters with delta for second double a3[2] = {a[0], a[1]}; double a4[2] = {a[0], a[1]}; double a5[2] = {a[0], a[1]}; double a6[2] = {a[0], a[1]}; double a7[2] = {a[0], a[1]}; double dVda1, dVda2, d2Vda1, d2Vda2, d2Vda12; //hardcode a 2-dimensional finite difference hessian matrix to test a2[0] += da[0]; //(x+h,y) a3[0] -= da[0]; //(x-h,y) a4[1] += da[1]; //(x,y+k) a5[1] -= da[1]; //(x,y-k) a6[0] += da[0]; a6[1] += da[1]; //(x+h,y+k) a7[0] -= da[0]; a7[1] -= da[1]; //(x-h,y-k) dVda1 = (V(a2,x,S_measured) - V(a3, x, S_measured))/(2*da[0]); dVda2 = (V(a4,x,S_measured) - V(a5, x, S_measured))/(2*da[1]); d2Vda1 = (V(a2,x,S_measured) - 2*V(a1, x, S_measured) + V(a3, x, S_measured))/(pow(da[0], 2)); d2Vda2 = (V(a4,x,S_measured) - 2*V(a1, x, S_measured) + V(a5, x, S_measured))/(pow(da[1], 2)); d2Vda12 = (V(a6,x,S_measured) - V(a2, x, S_measured) - V(a4, x, S_measured) + 2*V(a1, x, S_measured) - V(a3, x, S_measured) - V(a5, x, S_measured) + V(a7, x, S_measured)); derivative[0] = dVda1; derivative[1] = dVda2; hessian[0][0] = d2Vda1; hessian[0][1] = d2Vda12; hessian[1][0] = d2Vda12; hessian[1][1] = d2Vda2; /* for (int i=0; i < size; i++) { a1[i] += da[i]; dVda1_1 = (V(a,x,S_measured)-V(a1, x, S_measured))/da[i]; derivative[i] = dVda1_1; for (int j = 0; j < size; j++) { if (i ==j) { a2[j] += 2*da[j]; dVda1_2 = (V(a1,x,S_measured)-V(a2, x, S_measured))/da[j]; d2V = (dVda1_1-dVda1_2)/da[j]; } else { a2[j] += da[j]; aT[i] += da[i]; aT[j] += da[j]; dVda1_2 = (V(a2,x,S_measured)-V(aT, x, S_measured))/da[i]; d2V = (dVda1_1-dVda1_2)/da[j]; } a2[j] = a[j]; aT[i] = a[i]; aT[j] = a[j]; //update hessian matrix with scalar estimate parameter hessian[i][j] = d2V; } a1[i] = a[i]; } */ } /* Generic Newton's method INPUTS: *a - pointer to initial parameter array guess *b - pointer to final parameter array (result output) *x - pointer to measurement x values *S_measured - pointer to measurement values *size - number of parameters Constraint are: - that x and S_measured array must be of the same size - that a and b (input and output parameter arrays must be of the same size indicated by 'size' */ double * newtonsMethod(double *a, double *b, double *x, double *S_measured, int size) { // initialize loop variables int stop = 0; double da[size]; double a_old[size]; double a_new[size]; double derivative[2]; for (int i = 0; i < size; i++) { da[i] = a[i]; b[i] = a[i]; derivative[i] = 0; } //dynamically allocate 2-d hessian and inverse matrix in memory for iteration use double ** hessian = 0; double ** inverse = 0; hessian = new double*[size]; inverse = new double*[size]; for (int i = 0; i < size ; i++) { hessian[i] = new double[size]; inverse[i] = new double[size]; } // iterative newtons method while (stop == 0) { //go on with newton's method - use b an most up to date parameter array computeHessianMatrix(hessian, b, x, S_measured, derivative, size); MatrixInversion(hessian, size, inverse); MatrixVectorMultiply(inverse, derivative, da, size); //now we perform a line search using da and a_old to find minimization linear search variable t double t = 2; double min_t = 1; double temp[2]; double V_new, V_old; V_old = V(a, x, S_measured); for (int i = 0; i < 100; i++) { t = t/2; temp[0] = b[0] - t*da[0]; temp[1] = b[1] - t*da[1]; V_new = V(temp,x,S_measured); if (abs(V_new) < abs(V_old)) { //find the t that minimizes V min_t = t; V_old = V_new; } } // if step is small enough, we can quit double norm; for (int i=0; i < size; i++) { norm += pow((min_t*da[i]),2); } norm = sqrt(norm); if (norm < 1e-5) { stop = 1; } int count = 0; for(int i = 0; i < size; i++) { if(da[i] < 1e-8) { count++; } } if(count >= size) stop = 1; // otherwise continue and set a_new = a_old - t*da for (int i = 0; i < size; i++) { b[i] = b[i] - min_t*da[i]; } cout << "t is: " << min_t << " and new guess is: " << b[0] << ", " << b[1] << endl; } //clean up memory for (int i = 0; i < size; i++) { delete [] inverse[i]; delete [] hessian[i]; } delete [] inverse; delete [] hessian; hessian = 0, inverse = 0; return b; } /* Validation of parameter extraction program for y=c0*(x^m) */ void validityTest() { double S_model[10]; double S_measured[10]; double a[2] = {log(10), -0.5}; //parameters double b[2]; double x[10]; //x values double x_measured[10]; int size = 2; double noise = 0; //Generate 10 samples of S_measured with random noises between 10-20% for (int i = 0; i < 10; i++) { x[i] = log(i+1); } for (int i = 0; i < 10; i++) { generateS(a, x[i], size, i, S_model); S_measured[i] = randError(S_model[i], (int)noise); //x_measured[i] = randError(x[i], noise); } double guess[2] = {log(12), -0.53}; newtonsMethod(guess, b, x, S_measured, size); cout << "b[0] is : " << b[0] << " and b[1] is: " << b[1] << endl; } /* Adds random noise of noise% to x */ double randError(double a, int percent) { if(percent == 0) return a; return a * (double) (1.0 - percent/100.0 + (random() % (percent*200))/10000.0); }
05c6837fefab2995f04b43928b050fba9ae0aa29
948f4e13af6b3014582909cc6d762606f2a43365
/testcases/juliet_test_suite/testcases/CWE415_Double_Free/s01/CWE415_Double_Free__new_delete_array_class_42.cpp
0c86aa36f129b1a925448ac67edf0a0bc4461b38
[]
no_license
junxzm1990/ASAN--
0056a341b8537142e10373c8417f27d7825ad89b
ca96e46422407a55bed4aa551a6ad28ec1eeef4e
refs/heads/master
2022-08-02T15:38:56.286555
2022-06-16T22:19:54
2022-06-16T22:19:54
408,238,453
74
13
null
2022-06-16T22:19:55
2021-09-19T21:14:59
null
UTF-8
C++
false
false
3,153
cpp
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE415_Double_Free__new_delete_array_class_42.cpp Label Definition File: CWE415_Double_Free__new_delete_array.label.xml Template File: sources-sinks-42.tmpl.cpp */ /* * @description * CWE: 415 Double Free * BadSource: Allocate data using new and Deallocae data using delete * GoodSource: Allocate data using new * Sinks: * GoodSink: do nothing * BadSink : Deallocate data using delete * Flow Variant: 42 Data flow: data returned from one function to another in the same source file * * */ #include "std_testcase.h" #include <wchar.h> namespace CWE415_Double_Free__new_delete_array_class_42 { #ifndef OMITBAD static TwoIntsClass * badSource(TwoIntsClass * data) { data = new TwoIntsClass[100]; /* POTENTIAL FLAW: delete the array data in the source - the bad sink deletes the array data as well */ delete [] data; return data; } void bad() { TwoIntsClass * data; /* Initialize data */ data = NULL; data = badSource(data); /* POTENTIAL FLAW: Possibly deleting memory twice */ delete [] data; } #endif /* OMITBAD */ #ifndef OMITGOOD /* goodG2B() uses the GoodSource with the BadSink */ static TwoIntsClass * goodG2BSource(TwoIntsClass * data) { data = new TwoIntsClass[100]; /* FIX: Do NOT delete the array data in the source - the bad sink deletes the array data */ return data; } static void goodG2B() { TwoIntsClass * data; /* Initialize data */ data = NULL; data = goodG2BSource(data); /* POTENTIAL FLAW: Possibly deleting memory twice */ delete [] data; } /* goodB2G() uses the BadSource with the GoodSink */ static TwoIntsClass * goodB2GSource(TwoIntsClass * data) { data = new TwoIntsClass[100]; /* POTENTIAL FLAW: delete the array data in the source - the bad sink deletes the array data as well */ delete [] data; return data; } static void goodB2G() { TwoIntsClass * data; /* Initialize data */ data = NULL; data = goodB2GSource(data); /* do nothing */ /* FIX: Don't attempt to delete the memory */ ; /* empty statement needed for some flow variants */ } void good() { goodG2B(); goodB2G(); } #endif /* OMITGOOD */ } /* close namespace */ /* Below is the main(). It is only used when building this testcase on its own for testing or for building a binary to use in testing binary analysis tools. It is not used when compiling all the testcases as one application, which is how source code analysis tools are tested. */ #ifdef INCLUDEMAIN using namespace CWE415_Double_Free__new_delete_array_class_42; /* so that we can use good and bad easily */ int main(int argc, char * argv[]) { /* seed randomness */ srand( (unsigned)time(NULL) ); #ifndef OMITGOOD printLine("Calling good()..."); good(); printLine("Finished good()"); #endif /* OMITGOOD */ #ifndef OMITBAD printLine("Calling bad()..."); bad(); printLine("Finished bad()"); #endif /* OMITBAD */ return 0; } #endif
873ba7ea85279e5fb9b71acb764326af2662a079
b71b8bd385c207dffda39d96c7bee5f2ccce946c
/testcases/CWE36_Absolute_Path_Traversal/s02/CWE36_Absolute_Path_Traversal__char_file_fopen_12.cpp
e3eb2e8e1ea705f47995394aaf950c29c82b635a
[]
no_license
Sporknugget/Juliet_prep
e9bda84a30bdc7938bafe338b4ab2e361449eda5
97d8922244d3d79b62496ede4636199837e8b971
refs/heads/master
2023-05-05T14:41:30.243718
2021-05-25T16:18:13
2021-05-25T16:18:13
369,334,230
0
0
null
null
null
null
UTF-8
C++
false
false
3,575
cpp
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE36_Absolute_Path_Traversal__char_file_fopen_12.cpp Label Definition File: CWE36_Absolute_Path_Traversal.label.xml Template File: sources-sink-12.tmpl.cpp */ /* * @description * CWE: 36 Absolute Path Traversal * BadSource: file Read input from a file * GoodSource: Full path and file name * Sink: fopen * BadSink : Open the file named in data using fopen() * Flow Variant: 12 Control flow: if(globalReturnsTrueOrFalse()) * * */ #include "std_testcase.h" #ifndef _WIN32 #include <wchar.h> #endif #ifdef _WIN32 #define FILENAME "C:\\temp\\file.txt" #else #define FILENAME "/tmp/file.txt" #endif #ifdef _WIN32 #define FOPEN fopen #else #define FOPEN fopen #endif namespace CWE36_Absolute_Path_Traversal__char_file_fopen_12 { #ifndef OMITBAD void bad() { char * data; char dataBuffer[FILENAME_MAX] = ""; data = dataBuffer; { { /* Read input from a file */ size_t dataLen = strlen(data); FILE * pFile; /* if there is room in data, attempt to read the input from a file */ if (FILENAME_MAX-dataLen > 1) { pFile = fopen(FILENAME, "r"); if (pFile != NULL) { /* POTENTIAL FLAW: Read data from a file */ if (fgets(data+dataLen, (int)(FILENAME_MAX-dataLen), pFile) == NULL) { printLine("fgets() failed"); /* Restore NUL terminator if fgets fails */ data[dataLen] = '\0'; } fclose(pFile); } } } } { FILE *pFile = NULL; /* POTENTIAL FLAW: Possibly opening a file without validating the file name or path */ pFile = FOPEN(data, "wb+"); if (pFile != NULL) { fclose(pFile); } } } #endif /* OMITBAD */ #ifndef OMITGOOD /* goodG2B() - use goodsource and badsink by changing the "if" so that both branches use the GoodSource */ static void goodG2B() { char * data; char dataBuffer[FILENAME_MAX] = ""; data = dataBuffer; { #ifdef _WIN32 /* FIX: Use a fixed, full path and file name */ strcat(data, "c:\\temp\\file.txt"); #else /* FIX: Use a fixed, full path and file name */ strcat(data, "/tmp/file.txt"); #endif } { FILE *pFile = NULL; /* POTENTIAL FLAW: Possibly opening a file without validating the file name or path */ pFile = FOPEN(data, "wb+"); if (pFile != NULL) { fclose(pFile); } } } void good() { goodG2B(); } #endif /* OMITGOOD */ } /* close namespace */ /* Below is the main(). It is only used when building this testcase on its own for testing or for building a binary to use in testing binary analysis tools. It is not used when compiling all the testcases as one application, which is how source code analysis tools are tested. */ #ifdef INCLUDEMAIN using namespace CWE36_Absolute_Path_Traversal__char_file_fopen_12; /* so that we can use good and bad easily */ int main(int argc, char * argv[]) { /* seed randomness */ srand( (unsigned)time(NULL) ); #ifndef OMITGOOD printLine("Calling good()..."); good(); printLine("Finished good()"); #endif /* OMITGOOD */ #ifndef OMITBAD printLine("Calling bad()..."); bad(); printLine("Finished bad()"); #endif /* OMITBAD */ return 0; } #endif
cceacb27b6661e037581d0934af2da8bbecffad4
10c0a8cb0899692014417ef60093ace05e5e1763
/libsrc/gmsg/GMsg_GiveItem.cpp
af25f0bae6414ba514eb008778891a394a5b5af2
[ "BSD-3-Clause" ]
permissive
openunderlight/ULServer
56cb96360c57598be6f72f2a20c41f69b41b56bd
42e12e245506e6a76c3905d64378eff79c908fc5
refs/heads/dev
2023-03-10T22:50:51.591229
2023-01-31T20:27:44
2023-01-31T20:27:44
145,008,033
7
5
NOASSERTION
2019-12-24T19:08:59
2018-08-16T15:40:15
TSQL
UTF-8
C++
false
false
1,626
cpp
// GMsg_GiveItem.cpp -*- C++ -*- // $Id: GMsg_GiveItem.cpp,v 1.1 1997-09-18 16:51:12-07 jason Exp $ // Copyright 1996-1997 Lyra LLC, All rights reserved. // // message implementation #ifdef __GNUC__ #pragma implementation "GMsg_GiveItem.h" #endif #ifdef WIN32 #define STRICT #include "unix.h" #include <winsock2.h> #else /* !WIN32 */ #include <sys/types.h> #include <netinet/in.h> #endif /* WIN32 */ #include <stdio.h> #include <string.h> #include "GMsg_GiveItem.h" #include "LyraDefs.h" #include "GMsg.h" #ifndef USE_INLINE #include "GMsg_GiveItem.i" #endif //// // constructor //// GMsg_GiveItem::GMsg_GiveItem() : LmMesg(GMsg::GIVEITEM, sizeof(data_t), sizeof(data_t), &data_) { // initialize default message data values Init(0, LmItemHdr::DEFAULT_INSTANCE); } //// // destructor //// GMsg_GiveItem::~GMsg_GiveItem() { // empty } //// // Init //// void GMsg_GiveItem::Init(lyra_id_t targetid, const LmItemHdr& itemheader) { SetTargetID(targetid); SetItemHeader(itemheader); } //// // hton //// void GMsg_GiveItem::hton() { HTONL(data_.targetid); data_.itemheader.ConvertToNetwork(); } //// // ntoh //// void GMsg_GiveItem::ntoh() { NTOHL(data_.targetid); data_.itemheader.ConvertToHost(); } //// // Dump: print to FILE stream //// #ifdef USE_DEBUG void GMsg_GiveItem::Dump(FILE* f, int indent) const { INDENT(indent, f); _ftprintf(f, _T("<GMsg_GiveItem[%p]: "), this); if (ByteOrder() == ByteOrder::HOST) { _ftprintf(f, _T("data>\n")); } else { _ftprintf(f, _T("(network order)>\n")); } // print out base class LmMesg::Dump(f, indent + 1); } #endif /* USE_DEBUG */
[ "root@underlightlyra.(none)" ]
root@underlightlyra.(none)
7932cebcc7a68b691abd49609b624e9641c9ea5b
3404cb1e271f929cc063c13128d581241d4e07a8
/45.cpp
c20f7ef2216724e47d52ab9439c78fd57890156f
[]
no_license
mashiuruab/leetcode
811b08dd9bff025587e6145b3dee52ed50391f5a
7d3adf053b1d5a50f40ec49a8c60c28998c76132
refs/heads/master
2020-04-17T02:23:57.391337
2019-01-17T00:19:12
2019-01-17T00:19:12
166,131,889
0
0
null
null
null
null
UTF-8
C++
false
false
1,033
cpp
#include<iostream> #include<vector> #include<climits> using namespace std; bool can_reach = false; int length; vector<bool> reachable; int min_step = INT_MAX; void traverse(vector<int>& nums, int index, int steps) { //cout << index << ", value = " << nums[index] << ", length = " << length << endl; if(index == (length - 1)){ if(min_step > steps) { min_step = steps; } can_reach |= true; return; } if(nums[index] == 0) { can_reach |= false; return; } if(index > (length-1)) { can_reach |= false; return; } steps += 1; for(int i=nums[index];i>=1;i--) { if(index + i < length && (reachable[index+i])) { traverse(nums, index + i, steps); reachable[index+i] = can_reach; } } } int jump(vector<int>& nums) { length = nums.size(); reachable.resize(length); for(int i=0;i<length;i++) { reachable[i] = true; } traverse(nums, 0, 0); return min_step; } int main(int argc, char** argv) { vector<int> nums1 = {2,3,1,1,4}; cout << jump(nums1) << endl; return 0; }
c533d56c8e6d60e433bc555002820255bbc3d043
c56b86c0c098948a1aa7ca3b4a25c7be47af2f45
/Qt/my_programm/MODBUS/Test_MODBUS/src/main.cpp
a29cbc49a8b24b1644e83dfa5385aa1fe7a5a2a9
[]
no_license
jianglin2045/mega_GIT
764e460282f1242be5530c8e20e498119f20f827
7224c3cf50bf029ff127a3e3db0bb3698af28aa4
refs/heads/master
2023-02-13T19:41:30.407632
2021-01-11T21:09:31
2021-01-11T21:09:31
null
0
0
null
null
null
null
UTF-8
C++
false
false
3,497
cpp
/********************************************************************************* ** ** ** Copyright (C) 2012 ** ** ** ** This program is free software: you can redistribute it and/or modify ** ** it under the terms of the GNU General Public License as published by ** ** the Free Software Foundation, either version 3 of the License, or ** ** (at your option) any later version. ** ** ** ** This program is distributed in the hope that it will be useful, ** ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** ** GNU General Public License for more details. ** ** ** ** You should have received a copy of the GNU General Public License ** ** along with this program. If not, see http://www.gnu.org/licenses/. ** ** ** ********************************************************************************** ** Author: Bikbao Rinat Zinorovich ** **********************************************************************************/ #ifdef HAVE_QT5 # include <QtWidgets> #else # include <QtGui> #endif //-------------------------------------------------------------------------------- #include "qtsingleapplication.h" #include "mysplashscreen.hpp" #include "mainwindow.hpp" #include "test_modbus_mainbox.hpp" #include "defines.hpp" #include "version.hpp" //-------------------------------------------------------------------------------- #include "codecs.h" //-------------------------------------------------------------------------------- #ifdef QT_DEBUG # include <QDebug> #endif //-------------------------------------------------------------------------------- int main(int argc, char *argv[]) { set_codecs(); #ifdef SINGLE_APP QtSingleApplication app(argc, argv); if(app.isRunning()) { //QMessageBox::critical(nullptr, QObject::tr("Error"), QObject::tr("Application already running!")); if(app.sendMessage("Wake up!")) return 0; } #else QApplication app(argc, argv); #endif app.setOrganizationName(QObject::tr(ORGNAME)); app.setApplicationName(QObject::tr(APPNAME)); app.setWindowIcon(QIcon(ICON_PROGRAMM)); QPixmap pixmap(":/logo/logo.png"); MySplashScreen *splash = new MySplashScreen(pixmap, 10); Q_ASSERT(splash); splash->show(); MainWindow *main_window = new MainWindow; //main_window->setWindowFlags(Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowContextHelpButtonHint); MainBox *mainBox = new MainBox(main_window, splash); main_window->setCentralWidget(mainBox); main_window->show(); splash->finish(main_window); qDebug() << qPrintable(QString(QObject::tr("Starting application %1")).arg(QObject::tr(APPNAME))); // return app.exec(); } //--------------------------------------------------------------------------------
5366a81fa7d9632631e89fd1cc7e025b87b47a15
aab5dba1eeef1568bb043d119c80ba13732b73a7
/middleware/arduino/time.cpp
e27bcca047606d66e06a3f268288272f1d4a3c37
[ "Apache-2.0" ]
permissive
D-zz/ArduinoFramework-AliOSThings
f46c0487f1d4ed02e899bbf8a2e881b7b67f5033
65af4dbb0369be4da419d65dc5c04afd61ca6808
refs/heads/master
2022-09-02T18:57:29.875906
2020-04-24T02:20:30
2020-04-24T02:20:30
null
0
0
null
null
null
null
UTF-8
C++
false
false
865
cpp
/* * Copyright (C) 2019 MRNIU */ #include <include/arduino.h> #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ #include <stddef.h> #include <stdio.h> #include <aos/kernel.h> #include <aos/hal/gpio.h> long long millis(void); long long micros(void); void delay(int ms); void delayMicroseconds(long us); /** * Get current time in ms. * * @return ms */ long long millis(void) { return aos_now_ms(); } /** * Get current time in us. * * @return us */ long long micros(void) { return aos_now()/1000; } /** * sleep ms * * @param[in] ms sleep time in ms * * @return void */ void delay(int ms) { aos_msleep(ms); return; } /** * sleep us * NOT AVAILABLE!!! * * @param[in] us sleep time in us * * @return void */ void delayMicroseconds(long us) { return; } #ifdef __cplusplus } #endif /* __cplusplus */
34816306621c93f4f4168d853df02980af0a29c7
4767b63b5c0af03daf6fd5dd8992638ae7472d93
/Snake/Square.cpp
a15b69ea42ce4ba9ef39d7fa7709bda9da355970
[ "MIT" ]
permissive
raph-r/Worm
6cc89f169b29e8e681f267787be5d0ac84a9748a
824fa31818bddb515ec63e76c8917b8c0fa13b75
refs/heads/master
2020-06-29T02:10:33.291996
2019-08-16T01:56:09
2019-08-16T01:56:09
200,407,146
3
0
null
null
null
null
UTF-8
C++
false
false
1,119
cpp
#include "Square.h" Square::Square(const int& top_left_x, const int& top_left_y, const int& width, const int& height, const char * name) { this->top_left_x = top_left_x; this->top_left_y = top_left_y; this->width = width; this->height = height; this->name = name; } Square::~Square(){} int Square::get_line_top() const { return this->top_left_y; } int Square::get_line_botton() const { return this->top_left_y + this->height; } int Square::get_line_left() const { return this->top_left_x; } int Square::get_line_right() const { return this->top_left_x + this->width; } bool Square::is_overlapped(const Square const * object) { if (this->get_line_left() == object->get_line_left() && this->get_line_top() == object->get_line_top() && this->get_line_right() == object->get_line_right() && this->get_line_botton() == object->get_line_botton()) { return true; } return false; } const char * Square::get_name() { return this->name; } void Square::add_top_left_x(const int & value) { this->top_left_x += value; } void Square::add_top_left_y(const int & value) { this->top_left_y += value; }
e9505ed6c886a0a7f3f7cdb57e52013dff558f71
5eaa902a346967e03b61650876a91f7ca26248d1
/mkr_linux/udorx_deps/carto_deps/core/MapVec.cpp
282573f47b42f196b872601284dd0a7fe744d1bf
[]
no_license
UniChargersInc/UCLinux
65ea7d5a90b8908b6d779d382549e7b06fb9424d
ad0c482be8f489b6b5ebb99789ced74644eb1932
refs/heads/master
2023-08-30T03:11:57.562212
2021-11-05T22:57:47
2021-11-05T22:57:47
425,097,401
0
0
null
null
null
null
UTF-8
C++
false
false
4,503
cpp
#include "MapVec.h" #include "core/MapPos.h" //#include "components/Exceptions.h" #include <cmath> #include <iomanip> #include <sstream> #include <stdexcept> #include <functional> namespace carto { MapVec::MapVec() : _x(0), _y(0), _z(0) { } MapVec::MapVec(double x, double y) : _x(x), _y(y), _z(0) { } MapVec::MapVec(double x, double y, double z) : _x(x), _y(y), _z(z) { } double MapVec::getX() const { return _x; } void MapVec::setX(double x) { _x = x; } double MapVec::getY() const { return _y; } void MapVec::setY(double y) { _y = y; } double MapVec::getZ() const { return _z; } void MapVec::setZ(double z) { _z = z; } double MapVec::operator [](std::size_t n) const { switch (n) { case 0: return _x; case 1: return _y; case 2: return _z; } //throw OutOfRangeException("MapVec::operator[]"); } double& MapVec::operator [](std::size_t n) { switch (n) { case 0: return _x; case 1: return _y; case 2: return _z; } //throw OutOfRangeException("MapVec::operator[]"); } void MapVec::setCoords(double x, double y) { _x = x; _y = y; } void MapVec::setCoords(double x, double y, double z) { _x = x; _y = y; _z = z; } bool MapVec::operator ==(const MapVec& v) const { return _x == v._x && _y == v._y && _z == v._z; } bool MapVec::operator !=(const MapVec& v) const { return !(*this == v); } MapVec& MapVec::operator +=(const MapVec& v) { _x += v.getX(); _y += v.getY(); _z += v.getZ(); return *this; } MapVec& MapVec::operator -=(const MapVec& v) { _x -= v.getX(); _y -= v.getY(); _z -= v.getZ(); return *this; } MapVec& MapVec::operator *=(double multiplier) { _x *= multiplier; _y *= multiplier; _z *= multiplier; return *this; } MapVec& MapVec::operator /=(double divider) { _x /= divider; _y /= divider; _z /= divider; return *this; } MapVec MapVec::operator +(const MapVec& v) const { return MapVec(_x + v._x, _y + v._y, _z + v._z); } MapVec MapVec::operator -(const MapVec& v) const { return MapVec(_x - v._x, _y - v._y, _z - v._z); } MapVec MapVec::operator *(double multiplier) const { return MapVec(_x * multiplier, _y * multiplier, _z * multiplier); } MapVec MapVec::operator /(double divider) const { return MapVec(_x / divider, _y / divider, _z / divider); } double MapVec::length() const { return std::sqrt(lengthSqr()); } double MapVec::lengthSqr() const { return dotProduct(*this); } MapVec& MapVec::normalize() { double len = length(); *this /= len; return *this; } MapVec MapVec::getNormalized() const { double len = length(); return MapVec(_x / len, _y / len, _z / len); } MapVec& MapVec::rotate2D(double sin, double cos) { double x = cos * _x - sin * _y; double y = sin * _x + cos * _y; _x = x; _y = y; return *this; } MapVec MapVec::getRotated2D(double sin, double cos) const { MapVec mapVec(*this); mapVec.rotate2D(sin, cos); return mapVec; } double MapVec::crossProduct2D(const MapVec& v) const { return _x * v._y - _y * v._x; } MapVec MapVec::crossProduct3D(const MapVec& v) const { double x = _y * v._z - _z * v._y; double y = _z * v._x - _x * v._z; double z = _x * v._y - _y * v._x; return MapVec(x, y, z); } double MapVec::dotProduct(const MapVec& v) const { return _x * v._x + _y * v._y + _z * v._z; } int MapVec::hash() const { std::hash<double> hasher; return static_cast<int>((hasher(_z) << 16) ^ (hasher(_y) << 8) ^ hasher(_x)); } std::string MapVec::toString() const { std::stringstream ss; ss << std::setiosflags(std::ios::fixed); ss << "MapVec [x="<< _x << ", y=" << _y << ", z=" << _z << "]"; return ss.str(); } }
ddddac4b89329f7ccc19e8560e414fe006e16751
ae936fb07d9478152cb998e94b9937d625f5c3dd
/Codeforces/CF1278D.cpp
ade3558da49e380e0e83a9fd3cdfe11227545897
[]
no_license
Jorgefiestas/CompetitiveProgramming
f035978fd2d3951dbd1ffd14d60236ef548a1974
b35405d6be5adf87e9a257be2fa0b14f5eba3c83
refs/heads/master
2021-06-12T06:28:20.878137
2021-04-21T01:32:37
2021-04-21T01:32:37
164,651,348
0
0
null
null
null
null
UTF-8
C++
false
false
992
cpp
#include <bits/stdc++.h> using namespace std; using pii = pair<int, int>; const int N = 5e5 + 100; int n, dsu[N]; pii seg[N]; int root(int x) { while (x != dsu[x]) { dsu[x] = dsu[dsu[x]]; x = dsu[x]; } return x; } void join(int a, int b) { a = root(a); b = root(b); dsu[a] = b; } bool poss() { int cnt = 0; set<pii> ends; for (int i = 0; i < n; i++) { int l = seg[i].first; int r = seg[i].second; auto it = ends.upper_bound({l, 0}); while (it != ends.end()) { pii p = *it; if (p.first > r) break; int j = p.second; if (root(i) == root(j)) { return false; } join(i, j); cnt += 1; it++; } ends.insert({r, i}); } return cnt == n - 1; } int main() { ios_base::sync_with_stdio(0); cin.tie(0); for (int i = 0; i < N; i++) { dsu[i] = i; } cin >> n; for (int i = 0; i < n; i++) { cin >> seg[i].first >> seg[i].second; } sort(seg, seg + n); if (poss()) { cout << "YES\n"; } else { cout << "NO\n"; } return 0; }
d0f1c7ff675f3920db41763d7e7336a077734cb0
995fef3accf2aedbcd431dd98bc9ab2a2ecace9d
/src/plugins/lmp/recommendationswidget.cpp
5745a38bdda91210a5784d1bc8264410ab9e329b
[ "BSL-1.0" ]
permissive
eringus/leechcraft
2e3da6263e7530f002b532aae616a4b158d53ff6
415a9a49aa4c942a4953e8c6e59876fc7e217b24
refs/heads/master
2020-12-26T04:56:09.461868
2013-12-17T13:03:26
2013-12-17T13:03:26
null
0
0
null
null
null
null
UTF-8
C++
false
false
3,955
cpp
/********************************************************************** * LeechCraft - modular cross-platform feature rich internet client. * Copyright (C) 2006-2013 Georg Rudoy * * Boost Software License - Version 1.0 - August 17th, 2003 * * Permission is hereby granted, free of charge, to any person or organization * obtaining a copy of the software and accompanying documentation covered by * this license (the "Software") to use, reproduce, display, distribute, * execute, and transmit the Software, and to prepare derivative works of the * Software, and to permit third-parties to whom the Software is furnished to * do so, all subject to the following: * * The copyright notices in the Software and this entire statement, including * the above license grant, this restriction and the following disclaimer, * must be included in all copies of the Software, in whole or in part, and * all derivative works of the Software, unless such copies or derivative * works are solely in the form of machine-executable object code generated by * a source language processor. * * 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, TITLE AND NON-INFRINGEMENT. IN NO EVENT * SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE * FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. **********************************************************************/ #include "recommendationswidget.h" #include <QtDebug> #include <interfaces/core/ipluginsmanager.h> #include <interfaces/media/irecommendedartists.h> #include <interfaces/media/iaudioscrobbler.h> #include <interfaces/media/ipendingsimilarartists.h> #include <interfaces/iinfo.h> #include "core.h" #include "xmlsettingsmanager.h" #include "util.h" namespace LeechCraft { namespace LMP { RecommendationsWidget::RecommendationsWidget (QWidget *parent) : QWidget (parent) { Ui_.setupUi (this); } void RecommendationsWidget::InitializeProviders () { const auto& lastProv = ShouldRememberProvs () ? XmlSettingsManager::Instance () .Property ("LastUsedRecsProvider", QString ()).toString () : QString (); bool lastFound = false; const auto& roots = Core::Instance ().GetProxy ()->GetPluginsManager ()-> GetAllCastableRoots<Media::IRecommendedArtists*> (); for (auto root : roots) { auto scrob = qobject_cast<Media::IAudioScrobbler*> (root); if (!scrob) continue; Ui_.RecProvider_->addItem (qobject_cast<IInfo*> (root)->GetIcon (), scrob->GetServiceName ()); ProvRoots_ << root; Providers_ << qobject_cast<Media::IRecommendedArtists*> (root); if (scrob->GetServiceName () == lastProv) { const int idx = Providers_.size () - 1; Ui_.RecProvider_->setCurrentIndex (idx); on_RecProvider__activated (idx); lastFound = true; } } if (!lastFound) Ui_.RecProvider_->setCurrentIndex (-1); } void RecommendationsWidget::handleGotRecs () { auto pending = qobject_cast<Media::IPendingSimilarArtists*> (sender ()); if (!pending) { qWarning () << Q_FUNC_INFO << "not a pending sender" << sender (); return; } const auto& similars = pending->GetSimilar (); Ui_.RecView_->SetSimilarArtists (similars); } void RecommendationsWidget::on_RecProvider__activated (int index) { if (index < 0 || index >= Providers_.size ()) return; auto pending = Providers_.at (index)->RequestRecommended (10); connect (pending->GetQObject (), SIGNAL (ready ()), this, SLOT (handleGotRecs ())); auto scrob = qobject_cast<Media::IAudioScrobbler*> (ProvRoots_.at (index)); XmlSettingsManager::Instance () .setProperty ("LastUsedRecsProvider", scrob->GetServiceName ()); } } }
1061b8325411c9a7cdf13afe95d54ddb85773a86
19194c2f2c07ab3537f994acfbf6b34ea9b55ae7
/android-32/android/media/audiofx/DynamicsProcessing_Channel.def.hpp
2ef1893fc5e28c68afc2f5ab94f428591b3f22c0
[ "GPL-3.0-only" ]
permissive
YJBeetle/QtAndroidAPI
e372609e9db0f96602da31b8417c9f5972315cae
ace3f0ea2678967393b5eb8e4edba7fa2ca6a50c
refs/heads/Qt6
2023-08-05T03:14:11.842336
2023-07-24T08:35:31
2023-07-24T08:35:31
249,539,770
19
4
Apache-2.0
2022-03-14T12:15:32
2020-03-23T20:42:54
C++
UTF-8
C++
false
false
2,315
hpp
#pragma once #include "../../../JObject.hpp" namespace android::media::audiofx { class DynamicsProcessing_Eq; } namespace android::media::audiofx { class DynamicsProcessing_EqBand; } namespace android::media::audiofx { class DynamicsProcessing_Limiter; } namespace android::media::audiofx { class DynamicsProcessing_Mbc; } namespace android::media::audiofx { class DynamicsProcessing_MbcBand; } class JString; namespace android::media::audiofx { class DynamicsProcessing_Channel : public JObject { public: // Fields // QJniObject forward template<typename ...Ts> explicit DynamicsProcessing_Channel(const char *className, const char *sig, Ts...agv) : JObject(className, sig, std::forward<Ts>(agv)...) {} DynamicsProcessing_Channel(QJniObject obj) : JObject(obj) {} // Constructors DynamicsProcessing_Channel(android::media::audiofx::DynamicsProcessing_Channel &arg0); DynamicsProcessing_Channel(jfloat arg0, jboolean arg1, jint arg2, jboolean arg3, jint arg4, jboolean arg5, jint arg6, jboolean arg7); // Methods jfloat getInputGain() const; android::media::audiofx::DynamicsProcessing_Limiter getLimiter() const; android::media::audiofx::DynamicsProcessing_Mbc getMbc() const; android::media::audiofx::DynamicsProcessing_MbcBand getMbcBand(jint arg0) const; android::media::audiofx::DynamicsProcessing_Eq getPostEq() const; android::media::audiofx::DynamicsProcessing_EqBand getPostEqBand(jint arg0) const; android::media::audiofx::DynamicsProcessing_Eq getPreEq() const; android::media::audiofx::DynamicsProcessing_EqBand getPreEqBand(jint arg0) const; void setInputGain(jfloat arg0) const; void setLimiter(android::media::audiofx::DynamicsProcessing_Limiter arg0) const; void setMbc(android::media::audiofx::DynamicsProcessing_Mbc arg0) const; void setMbcBand(jint arg0, android::media::audiofx::DynamicsProcessing_MbcBand arg1) const; void setPostEq(android::media::audiofx::DynamicsProcessing_Eq arg0) const; void setPostEqBand(jint arg0, android::media::audiofx::DynamicsProcessing_EqBand arg1) const; void setPreEq(android::media::audiofx::DynamicsProcessing_Eq arg0) const; void setPreEqBand(jint arg0, android::media::audiofx::DynamicsProcessing_EqBand arg1) const; JString toString() const; }; } // namespace android::media::audiofx
8eeef40ed110335f76f01f177fac6e76b8f8fea7
f0b9f7ba3e2a7bdf731ea4e8262350c3a2a0d92c
/hiho104_Splay平衡树/test/splay5.cpp
48b5a1f9565f5e0742bb2e1ffc0ddb0e294a817a
[]
no_license
haoyuanliu/hihoCoder
098ca6f80a567057dde066cc007d4e335373b0b0
ebadfaf1ae9ecdbddc757c63722bff078fb1a1be
refs/heads/master
2021-01-24T08:21:30.668850
2017-03-12T14:18:11
2017-03-12T14:18:11
53,253,758
0
1
null
null
null
null
UTF-8
C++
false
false
5,643
cpp
#include <iostream> #define MIN_K -1 #define MAX_K 1000000001 using namespace std; typedef struct node { int key; node *father, *left, *right; node(int key_) : key(key_) { this->father = NULL; this->left = NULL; this->right = NULL; } }*Node; Node root = NULL; void right_rotate(Node x) { Node p = x->father; x->father = p->father; if(p->father) { if(p->father->left == p) p->father->left = x; else p->father->right = x; } else root = x; p->left = x->right; if(x->right) x->right->father = p; x->right = p; p->father = x; } void left_rotate(Node x) { Node p = x->father; x->father = p->father; if(p->father) { if(p->father->left == p) p->father->left = x; else p->father->right = x; } else root = x; p->right = x->left; if(x->left) x->left->father = p; x->left = p; p->father = x; } void splay(Node x, Node y) { if(x == NULL) return; while(x->father != y) { Node p = x->father; if(p->father == y) { if(p->left == x) right_rotate(x); else left_rotate(x); } else { Node g = p->father; if(g->left == p) { if(p->left == x) { right_rotate(p); right_rotate(x); } else { left_rotate(x); left_rotate(x); } } else { if(p->right == x) { left_rotate(p); left_rotate(x); } else { right_rotate(x); left_rotate(x); } } } } } Node bst_find(Node n, int k) { if(n->key == k) return n; if(n->key > k) { if(n->left == NULL) return NULL; else return bst_find(n->left, k); } else { if(n->right == NULL) return NULL; else return bst_find(n->right, k); } } void find(int key) { Node n = bst_find(root, key); splay(n, NULL); } Node bst_insert(Node n, int k) { if(k < n->key) { if(n->left == NULL) { n->left == new node(k); n->left->father = n; return n->left; } else return bst_insert(n->left, k); } else { if(n->right == NULL) { n->right = new node(k); n->right->father = n; return n->right; } else return bst_insert(n->right, k); } } void insert(int k) { if(root == NULL) { root = new node(k); } else { Node n = bst_insert(root, k); splay(n, NULL); } } /*Node findPrev(int k) { find(k); Node n = root->left; while(n->right) n = n->right; return n; } Node findNext(int k) { find(k); Node n = root->right; while(n->left) n = n->left; return n; }*/ Node findPrev(int k) { Node n = bst_find(root, k); splay(n, NULL); if(n) { Node l = n->left; while(l->key == k) l = l->left; while(l->right && l->right->key < k) l = l->right; return l; } else { cout << "Find prev error!" << endl; return NULL; } } Node findNext(int k) { Node n = bst_find(root, k); splay(n, NULL); if(n) { Node r = n->right; while(r->key == k) r = r->right; while(r->left && r->left->key > k) r = r->left; return r; } else { cout << "Find next error!" << endl; return NULL; } } void del(int k) { Node prev = findPrev(k); Node next = findNext(k); splay(prev, NULL); splay(next, prev); next->left = NULL; } void deleteInterval(int a, int b) { if(a <= MIN_K) a = MIN_K + 1; if(b >= MAX_K) b = MAX_K - 1; Node aa = bst_find(root, a); if(aa == NULL) insert(a); Node prev = findPrev(a); Node bb = bst_find(root, b); if(bb == NULL) insert(b); Node next = findNext(b); splay(prev, NULL); splay(next, prev); if(next != NULL) next->left = NULL; } void query(int k) { Node p = root; int res = 0; while(p) { if(p->key <= k) { res = p->key; p = p->right; } else p = p->left; } if(res == 0) cout << k << endl; else cout << res << endl; } /*int res = 0; int query(Node n, int k) { if(n->key == k) return k; if(n->key > k) { if(n->left == NULL) return res; else return query(n->left, k); } if(n->right == NULL) return n->key; else { res = n->key; return query(n-right, k); } }*/ int main() { int n, num, num1; char ch; insert(MIN_K); insert(MAX_K); cin >> n; while(n--) { cin >> ch >> num; if(ch == 'I') insert(num); else if(ch == 'Q') query(num); else if(ch == 'D') { cin >> num1; deleteInterval(num, num1); } } return 0; }
9c7494c7194b71e679b01b03723aabd1c58c5c43
7524106d9776f24311be4e6050cedd2a10e31282
/problems/uva/pid/12661/main_12661.cpp
58c4843435cf53b737d54254391b0dfd2f7dcb15
[]
no_license
Exr0nProjects/learn_cpp
f0d0ab1fd26adaea18d711c3cce16d63e0b2a7dc
c0fcb9783fa4ce76701fe234599bc13876cc4083
refs/heads/master
2023-04-11T08:19:42.923015
2021-01-27T02:41:35
2021-01-27T02:41:35
180,021,931
1
0
null
null
null
null
UTF-8
C++
false
false
2,536
cpp
/* TASK: 12661 LANG: C++14 */ /* * Problem 12661 (oj/pid/12661) * Create time: Mon 20 Apr 2020 @ 12:41 (PDT) * Accept time: [!meta:end!] * */ #include <iostream> #include <sstream> #include <cstdio> #include <tuple> #include <vector> #include <string> #include <cstring> #include <list> #include <array> #include <queue> #include <stack> #include <set> #include <map> #include <unordered_set> #include <unordered_map> #include <cmath> #include <random> #include <chrono> #include <utility> #include <iterator> #include <exception> #include <algorithm> #include <functional> #define ll long long #define dl double #define ca const auto & #define vi vector<int> #define pii pair<int, int> #define vii vector<pii> #define pb push_back #define eb emplace_back #define mp make_pair #define F first #define S second #define g(t, i) get<i>(t) #define mt make_tuple #define FOR_(i, b, e) for (long long i = (b); i < (e); ++i) #define FOR(i, e) FOR_(i, 0, (e)) #define FORR_(i, b, e) for (long long i = (e)-1; i >= (b); --i) #define FORR(i, e) FORR_(i, 0, e) #define TRAV(a, x) for (auto &a : x) using namespace std; const int MX = 311; int N, M, S, T; struct Edge { int u, v, w, a, b; Edge(int u, int v, int w, int a, int b): u(u), v(v), w(w), a(a), b(b) {} }; list<Edge> head[MX]; int dist[MX]; int main() { int kase=0; while (scanf("%d%d%d%d", &N, &M, &S, &T) == 4) { FOR(i, MX) head[i].clear(); memset(dist, 0x40, sizeof dist); FOR(i, M) { int u, v, w, a, b; scanf("%d%d%d%d%d", &u, &v, &a, &b, &w); head[u].eb(u, v, w, a, b); } /* FOR(i, N) { printf("head %d:\n", i); TRAV(e, head[i]) printf("%d -%d-> %d (%d %d)\n", e.u, e.w, e.v, e.a, e.b); } */ // printf("\nS %d -> T %d\n\n", S, T); priority_queue<pair<int, int>, deque<pair<int, int> >, greater<pair<int, int> > > pq; // <time, node> pq.emplace(0, S); while (!pq.empty()) { pair<int, int> cur = pq.top(); pq.pop(); printf("at %d after %d\n", cur.S, cur.F); if (cur.S == T) { printf("Case %d: %d\n", ++kase, cur.F); break; } if (dist[cur.S] < cur.F) continue; TRAV(e, head[cur.S]) { const int enter = cur.F % (e.a + e.b); const int exit = (cur.F + e.w) % (e.a + e.b); int eta; if (enter <= e.a && exit <= e.a && enter / (e.a + e.b) == exit / (e.a + e.b)) eta = cur.F + e.w; else eta = (cur.F/(e.a+e.b)+1)*(e.a+e.b) + e.w; if (dist[e.v] > eta) { dist[e.v] = eta; pq.emplace(eta, e.v); } } } } return 0; }
c3b642744903ecb7d1a8f8d7f302a94a3070d602
661fe96e4d4e7c994cdeba6ed5fde070ac82eb30
/CoralSdkPopStarDemo/Classes/GameOver.h
c2f153d3f5ce1b143a97b14c800bd2515cb42248
[]
no_license
antiwise/coralsdk
1ffff15ec49123017d14f06dc074ef696f5274f3
c6ff90975a4294522ef6c5767a0b2f89cd58c31f
refs/heads/master
2020-12-03T00:03:00.107783
2014-05-27T05:55:57
2014-05-27T05:55:57
null
0
0
null
null
null
null
UTF-8
C++
false
false
281
h
#ifndef _GAME_OVER_H_ #define _GAME_OVER_H_ #include "cocos2d.h" class CGameOver : public cocos2d::Layer { public: CREATE_FUNC(CGameOver); bool Over(); void BnFunc(); int score; private: virtual bool init(); }; #endif //_GAME_OVER_H_
3e2c049baddccd8365709ed72d807c67bf05d3c3
c9163f2cb6a345959154318a923c57abe8182ea5
/parser.cpp
0813b4b1e82bd9e20c7cb09a7ad64780de318504
[]
no_license
RaphaelPLM/Enigma-Machine
3ff3ced8e1c1b9bfb75252372139ae9c748376c9
a8c0822d759e6b5a0cccf01298605d880f388518
refs/heads/master
2020-05-29T16:33:29.349324
2020-04-07T22:31:49
2020-04-07T22:31:49
189,248,698
0
0
null
null
null
null
UTF-8
C++
false
false
2,552
cpp
#include <bits/stdc++.h> #include "parser.h" using namespace std; // Extract both model and wirings of the rotor referenced in string s. This is done by splitting a given line into a model name, and its respective wirings. pair<string, string> getFields(string s) { string model = ""; string wiring = ""; for (auto c : s) { // The model and the wiring for each rotor are separated by a ":". if (c != ':') model += c; else { // Removes the model name and the two following characters ": " from s. The resultant string is the wiring for the rotor referenced by model. wiring = s.erase(0, model.length() + 2); break; } } pair<string, string> pair_model_wiring = make_pair(model, wiring); return pair_model_wiring; } pair<string, string> searchRotor(int rotor_index) { map<int, string> map_rotorModels = { {1, "ROTOR_I"}, {2, "ROTOR_II"}, {3, "ROTOR_III"}}; //Allocate a file enabled for read-only ifstream f_rotor_wirings; //Open specified .GraphModellingLanguage file f_rotor_wirings.open("wirings.txt"); if (!f_rotor_wirings) { cout << "Unable to read rotor wirings. Check if the file 'wirings.txt' exists.\n"; } string line; pair<string, string> pair_model_wirings; while (getline(f_rotor_wirings, line)) { pair_model_wirings = getFields(line); if (pair_model_wirings.first == map_rotorModels[rotor_index]) break; } return pair_model_wirings; } pair<string, string> searchReflector(int reflector_index) { map<int, string> map_reflectorModels = { {1, "REFLECTOR_A"}}; //Allocate a file enabled for read-only ifstream f_reflector_wirings; //Open specified .GraphModellingLanguage file f_reflector_wirings.open("reflector-wiring.txt"); if (!f_reflector_wirings) { cout << "Unable to read reflector wirings. Check if the file 'reflector.txt' exists.\n"; } string line; pair<string, string> pair_model_wirings; while (getline(f_reflector_wirings, line)) { pair_model_wirings = getFields(line); if (pair_model_wirings.first == map_reflectorModels[reflector_index]) break; } return pair_model_wirings; }
06d6554c3db7759d6259c75ce75d2d4044fcb964
11891088d2219b0429c7f9f4b88c5f35d88fcda7
/C++ Practice/Introduction/Variable Sized Arrays/Solution.cpp
cc4a52ca13291230adfe50da5a69a93db0b4ca2b
[]
no_license
llenroc/HackerRank-Solutions
9d6302ea3c2117a854d129cf7bc8dbad5cd33426
bc8632fede2606d2fa30128d623f58a624bdc03e
refs/heads/main
2023-05-17T19:29:28.736163
2021-06-11T11:56:06
2021-06-11T11:56:06
null
0
0
null
null
null
null
UTF-8
C++
false
false
496
cpp
#include <cmath> #include <cstdio> #include <vector> #include <iostream> #include <algorithm> using namespace std; int main(){ int n; int q; std::cin >> n >> q; int** arr = new int*[n]; for (auto i = 0; i < n; ++i) { int k; std::cin >> k; arr[i] = new int[k]; for (auto j = 0; j < k; ++j) { std::cin >> arr[i][j]; } } for (auto i = 0; i < q; ++i) { int a; int b; std::cin >> a >> b; std::cout << arr[a][b] << std::endl; } return 0; }
c8d6c1ea99b9cffaaee46149c8c6982880223fb6
38c9e1136559390cb47093393bf0e9acc05653a2
/jni/NativeFormats/zlibrary/core/src/xml/ZLPlainAsynchronousInputStream.h
2c9b0d29d305c2b3a862c667d22084d2664fe2f4
[]
no_license
gezhonglunta/FBReaderJ_2
7df7d0a604b68956eaea3a902af75b6889f2cc24
ceae178cb7c9c66f7e661681922d5b38096a74f0
refs/heads/master
2020-04-06T16:18:38.693924
2012-12-03T13:44:04
2012-12-03T13:44:04
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,420
h
/* * Copyright (C) 2009-2012 Geometer Plus <[email protected]> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA. */ #ifndef __ZLPLAINASYNCHRONOUSINPUTSTREAM_H__ #define __ZLPLAINASYNCHRONOUSINPUTSTREAM_H__ #include <ZLAsynchronousInputStream.h> class ZLPlainAsynchronousInputStream : public ZLAsynchronousInputStream { public: ZLPlainAsynchronousInputStream(const char *encoding = 0); private: bool processInputInternal(Handler &handler); private: // disable copying ZLPlainAsynchronousInputStream(const ZLPlainAsynchronousInputStream &); const ZLPlainAsynchronousInputStream &operator = (const ZLPlainAsynchronousInputStream &); }; #endif /* __ZLPLAINASYNCHRONOUSINPUTSTREAM_H__ */
aa149c1e291b41f7c3f1afb3697903d1266f2119
fc214bfc7caf6050eec8ec5201e7f7eb568e3a17
/Windows/Qt/Qt5.12-msvc2019_static_64/5.12/msvc2019_static_64/include/Qt3DRender/5.12.12/Qt3DRender/private/qboundingvolume_p.h
571e4c18be1393a9b705975df266fa74a50801ca
[]
no_license
MediaArea/MediaArea-Utils-Binaries
44402a1dacb43e19ef6857da46a48289b106137d
5cde31480dba6092e195dfae96478c261018bf32
refs/heads/master
2023-09-01T04:54:34.216269
2023-04-11T08:44:15
2023-04-11T08:44:15
57,366,211
4
1
null
2023-04-11T08:44:16
2016-04-29T07:51:36
C++
UTF-8
C++
false
false
3,135
h
/**************************************************************************** ** ** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB). ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the Qt3D module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms ** and conditions see https://www.qt.io/terms-conditions. For further ** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 3 as published by the Free Software ** Foundation and appearing in the file LICENSE.LGPL3 included in the ** packaging of this file. Please review the following information to ** ensure the GNU Lesser General Public License version 3 requirements ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. ** ** GNU General Public License Usage ** Alternatively, this file may be used under the terms of the GNU ** General Public License version 2.0 or (at your option) the GNU General ** Public license version 3 or any later version approved by the KDE Free ** Qt Foundation. The licenses are as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 ** included in the packaging of this file. Please review the following ** information to ensure the GNU General Public License requirements will ** be met: https://www.gnu.org/licenses/gpl-2.0.html and ** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** ****************************************************************************/ #ifndef QT3DRENDER_QBOUNDINGVOLUME_P_H #define QT3DRENDER_QBOUNDINGVOLUME_P_H // // W A R N I N G // ------------- // // This file is not part of the Qt API. It exists for the convenience // of other Qt classes. This header file may change from version to // version without notice, or even be removed. // // We mean it. // #include <Qt3DRender/qt3drender_global.h> #include <Qt3DCore/qnodeid.h> #include <Qt3DCore/private/vector3d_p.h> QT_BEGIN_NAMESPACE namespace Qt3DRender { namespace RayCasting { class QRay3D; class QT3DRENDERSHARED_EXPORT QBoundingVolume { public: QBoundingVolume(); virtual ~QBoundingVolume(); enum Type { Sphere = 0, Triangle }; virtual Qt3DCore::QNodeId id() const = 0; virtual bool intersects(const QRay3D &ray, Vector3D *q = nullptr, Vector3D *uvw = nullptr) const = 0; virtual Type type() const = 0; }; } // namespace RayCasting } // namespace Qt3DRender QT_END_NAMESPACE Q_DECLARE_METATYPE(Qt3DRender::RayCasting::QBoundingVolume*) // LCOV_EXCL_LINE #endif // QT3DRENDER_QBOUNDINGVOLUME_P_H
3537db037bd28dc9266784a246d641b2c6e2d82e
268af85e67fa67cfa3b17af0ca04a7e400fc5e21
/src/datamanager.h
bf615ea3ab5e5014ad6ed7b7557c5cda43794dea
[]
no_license
phi2039/AgilePCDaemon
f3226574135a253fc2ca9d59d26484f101826032
c5f25a9dfaebae5ba4c554da4ecbc4d422c30f5d
refs/heads/master
2021-01-21T12:03:16.427172
2014-10-22T01:42:06
2014-10-22T01:42:23
null
0
0
null
null
null
null
UTF-8
C++
false
false
357
h
#ifndef DATAMANAGER_H #define DATAMANAGER_H #include "database.h" class CDataManager { public: CDataManager(); virtual ~CDataManager(); bool Initialize(); int LoadDataFile(const char* pFileName); protected: int ImportCSV_Internal(const char* pFileName, const char* pTableName); CDatabase* m_pDB; private: }; #endif // DATAMANAGER_H
d9c7424c56745953aa8390babb64eca50a32aaa3
871c1580dd21fe23ebfe54a9fe3396d2b8c10ed3
/RevisitOneImageSerie/RevisitOneImageSerie/RevisitOneImageSerie.cpp
5b1ad3a7174df1928dbf7639c79ba857d6c8430e
[]
no_license
marcinkociolek/ProjectsDirectionalityDetection
d8a7f70655c05dc98489a0a6c9f75c1088c054f4
1900bb05ff61e89ac0361df57ff58ca2d85deabf
refs/heads/master
2021-01-17T17:25:59.966373
2017-07-24T07:42:27
2017-07-24T07:42:27
57,299,438
0
0
null
null
null
null
UTF-8
C++
false
false
12,431
cpp
// RevisitOneImageSerie.cpp : Defines the entry point for the console application. // #include <boost\filesystem.hpp> #include <boost/regex.hpp> #include <iostream> #include <fstream> #include <math.h> #include "..\..\..\ProjectsLib\LibMarcin\ParamFromXML.h" //#include "..\..\..\ProjectsLib\LibMarcin\DispLib.h" #include "..\..\..\ProjectsLib\LibMarcin\StringFcLib.h" //#include <tinyxml.h> //#include <tinystr.h> #define PI 3.14159265 //using namespace cv; using namespace std; using namespace boost; using namespace boost::filesystem; //const int stepNr = 180; int main(int argc, char* argv[]) { if (argc < 2) { cout << "\nTo few arguments."; return 0; } path ConfigFile(argv[1]); if (!exists(ConfigFile)) { cout << ConfigFile.filename().string() << " not exists " << '\n'; return 0; } ProcessOptions ProcOptions; ProcOptions.LoadParams(ConfigFile.string()); cout << ProcOptions.ShowParams(); path PathToProcess(ProcOptions.OutFolderName1); if (!exists(PathToProcess)) { cout << PathToProcess << " not exists " << '\n'; return 0; } if (!is_directory(PathToProcess)) { cout << PathToProcess << " This is not a directory path " << '\n'; return 0; } /* int *DirHist = new int[360]; float *LengthHist = new float[360]; for (int i = 0; i < 360; i++) { DirHist[i] = 0; LengthHist[i] = 0; } */ // float *Samples = new float[65536]; // for (int i = 0; i < 65536; i++) // { // Samples[i] = 0.0; // } //float *LocalErrors = new float[10000]; float globalDirErrorsMean; float globalDirErrorsAbsMean; float globalDirErrorsStd; float globalDirErrorsMax = 0.0; int globalDirErrorsCount = 0; float *DirErrorsMean = new float[91]; float *DirErrorsAbsMean = new float[91]; float *DirErrorsStd = new float[91]; float *DirErrorsMax = new float[91]; int *DirErrorsCount = new int[91]; int *DirCount = new int[91]; for (int i = 0; i < 91; i++) { DirErrorsMean[i] = 0.0; DirErrorsAbsMean[i] = 0.0; DirErrorsStd[i] = 0.0; DirErrorsMax[i] = 0.0; DirErrorsCount[i] = 0; DirCount[i] = 0; } string StringOut = ""; string StringOutCommon = ""; StringOut += ProcOptions.ShowParams(); StringOut += "\n"; int fileCount = 0; int globalCounter = 0; double globalSumOfAbsErrors = 0; double globalSumOfErrors = 0; float globalMaxAbsError = 0; double globalSumForStd = 0; for (directory_entry& FileToProcess : directory_iterator(PathToProcess)) { path InPath = FileToProcess.path(); if (!exists(InPath)) { cout << InPath.filename().string() << " File not exists" << "\n"; break; } regex FilePattern(ProcOptions.InFilePattern2); if (!regex_match(InPath.filename().string().c_str(), FilePattern)) continue; // looking for direction in the file name string::const_iterator start, end; string FileName = InPath.filename().string(); start = FileName.begin(); end = FileName.end(); match_results<std::string::const_iterator> AngleStringIterator; match_flag_type flags = boost::match_default; regex AngleStringPattern("Angle[[:digit:]]{3}"); if (!regex_search(start, end, AngleStringIterator, AngleStringPattern, flags)) continue; string AngleString = AngleStringIterator[0]; start = AngleString.begin(); end = AngleString.end(); match_results<std::string::const_iterator> AngleValStringIterator; regex AngleValStringPattern("[[:digit:]]{3}"); if (!regex_search(start, end, AngleValStringIterator, AngleValStringPattern, flags)) continue; string AngleValString = AngleValStringIterator[0]; float dirFomFileName = stof(AngleValString); fileCount++; StringOut += ItoStrLZ(fileCount, 3) + "\t"; StringOut += InPath.filename().string(); StringOut += "\n"; string Line1, Line2; std::ifstream inFile1(InPath.string());//FileToProcess.path().filename().string()); if (!inFile1.is_open()) { cout << InPath.stem() << "could not be openned " << "\n"; break; } while (inFile1.good()) { getline(inFile1, Line1); if (Line1 == "Tile Y\tTile X\tAngle\tBest Angle Count\tMean Intensity\tTile min norm\tTile max norm")//"yRoiNr\txRoiNr\tdirection\tDDC\tmean Tile\tstd Tile\tmean tile 2\tstd Tile 2") break; StringOutCommon += Line1; //StringOutCommon += "\t\t\t\t\t\t\t\t"; StringOutCommon += "\n"; } StringOutCommon += Line1; StringOutCommon += "\n"; int x1, y1; float dir1, dDC1, mean1, std1; bool dir1IsNAN; int x2, y2; float dir2, dDC2, mean2, std2; bool dir2IsNAN; float dirError; int localCounter = 0; // for (int i = 0; i < 10000; i++) // { // LocalErrors[i] = 0.0; // } double sumOfAbsErrors = 0; double sumOfErrors = 0; float maxAbsError = 0; double sumForStd = 0; int errorCounter = 0; while (inFile1.good()) { //getline(inFile1, Line1); getline(inFile1, Line1, '\t'); if (Line1 != "") { y1 = atoi(Line1.c_str()); StringOutCommon += Line1; StringOutCommon += "\t"; getline(inFile1, Line1, '\t'); x1 = atoi(Line1.c_str()); StringOutCommon += Line1; StringOutCommon += "\t"; getline(inFile1, Line1, '\t'); dir1 = atof(Line1.c_str()); StringOutCommon += Line1; StringOutCommon += "\t"; if (Line1 == "NAN") dir1IsNAN = 1; else dir1IsNAN = 0; getline(inFile1, Line1, '\t'); dDC1 = atof(Line1.c_str()); StringOutCommon += Line1; StringOutCommon += "\t"; getline(inFile1, Line1, '\t'); mean1 = atof(Line1.c_str()); StringOutCommon += Line1; StringOutCommon += "\t"; getline(inFile1, Line1, '\n'); std1 = atof(Line1.c_str()); StringOutCommon += Line1; StringOutCommon += "\t\t"; dirError = dirFomFileName - dir1; if (dirError > 90.0) dirError = dirFomFileName - dir1 - 180; if (dirError < -90.0) dirError = dirFomFileName - dir1 + 180; StringOutCommon += to_string(dirError); //StringOutCommon += Line1; //StringOutCommon += "\t"; //StringOutCommon += "\t\t\t"; StringOutCommon += "\n"; // if (localCounter < 10000) // LocalErrors[localCounter] = dirError; // Actin dir hist estimation if (!dir1IsNAN )//(& mean1 >= ProcOptions.treshold1)) { localCounter++; globalCounter++; sumOfErrors += (double)(dirError); sumOfAbsErrors += abs((double)(dirError)); if (maxAbsError < abs(dirError)) maxAbsError = abs(dirError); sumForStd += ((double)dirError) * ((double)dirError); globalSumOfErrors += (double)(dirError); globalSumOfAbsErrors += abs((double)(dirError)); if (globalMaxAbsError < abs(dirError)) globalMaxAbsError = abs(dirError); globalSumForStd += ((double)dirError) * ((double)dirError); if (dirError) { globalDirErrorsCount++; errorCounter++; } //DirHist[(int)dir1]++; //DirHist[(int)dir1 + 180]++; } } } StringOutCommon += "\n"; //mean error estimation float errorAbsMean = (float)(sumOfAbsErrors / (double)localCounter); float errorMean = (float)(sumOfErrors / (double)localCounter); DirErrorsMean[(int)dirFomFileName] = errorMean; DirErrorsAbsMean[(int)dirFomFileName] = errorAbsMean; DirErrorsStd[(int)dirFomFileName] = (float)sqrt(sumForStd / (double)localCounter); DirErrorsMax[(int)dirFomFileName] = maxAbsError; DirErrorsCount[(int)dirFomFileName] = errorCounter; DirCount[(int)dirFomFileName] = localCounter; inFile1.close(); } globalDirErrorsMean = (float)(globalSumOfErrors / (double)globalCounter); globalDirErrorsAbsMean = (float)(globalSumOfAbsErrors / (double)globalCounter); globalDirErrorsStd = (float)sqrt(globalSumForStd / (double)globalCounter); // globalDirErrorsMax = maxAbsError; /* //resulting direction estimation float maxLength = 0; float dirForMaxLength = 0; for (int i = 0; i < 180; i++) { float a = 0; float b = 0; for (int k = 0; k < 180; k++) { int dir = k + i; float val = (float)DirHist[dir]; float dirF = (float)dir / 180.0 * PI; a += val*cos(dirF); b += val*sin(dirF); } float length = sqrt(a*a + b*b); if (maxLength < length) { maxLength = length; dirForMaxLength = atan2(b, a) / PI * 180.0; } LengthHist[i] = length; LengthHist[i + 180] = length; } if (dirForMaxLength < 0) dirForMaxLength = 180 + dirForMaxLength; StringOut += "\n"; StringOut += "max Lenght\t"; StringOut += to_string(maxLength); StringOut += "\n"; StringOut += "Angle\t"; StringOut += to_string(dirForMaxLength); StringOut += "\n"; StringOut += "Hist Count\t"; StringOut += to_string(histCount); StringOut += "\n"; StringOut += "\n\n"; StringOut += "Direction\t"; StringOut += "hist A\t"; StringOut += "\n"; for (int i = 0; i < 360; i++) { StringOut += to_string(180 - i); StringOut += "\t"; StringOut += to_string(DirHist[359 - i]); //StringOut += "\t"; //StringOut += to_string(LengthHist[359 - i]); //StringOut += "\t"; //StringOut += to_string(DirHist[359 - i] - dirForMaxLength); StringOut += "\n"; } string HistFullFileNameOut = ConfigFile.string() + "_DirHist" + ".txt"; std::ofstream outFile(HistFullFileNameOut);//FileToProcess.path().filename().string()); outFile << StringOut; outFile.close(); string StringOutA = ""; for (int i = 0; i < 65000; i++) { if (i >= histCount) break; StringOutA += to_string(Samples[i] - dirForMaxLength); StringOutA += "\n"; } CommonFullFileNameOut = ConfigFile.string() + "_DirForTTest" + ".txt"; std::ofstream outFileA(CommonFullFileNameOut);//FileToProcess.path().filename().string()); outFileA << StringOutA; outFileA.close(); */ /* string ErrorPlotsFileNameOut = ConfigFile.string() + "_DirHist" + ".txt"; std::ofstream outFile(ErrorPlotsFileNameOut);//FileToProcess.path().filename().string()); outFile << StringOut; outFile.close(); string StringOutA = ""; for (int i = 0; i < 65000; i++) { if (i >= histCount) break; StringOutA += to_string(Samples[i] - dirForMaxLength); StringOutA += "\n"; } CommonFullFileNameOut = ConfigFile.string() + "_DirForTTest" + ".txt"; std::ofstream outFileA(CommonFullFileNameOut);//FileToProcess.path().filename().string()); outFileA << StringOutA; outFileA.close(); */ string CommonFullFileNameOut = ProcOptions.OutFolderName2 + ConfigFile.filename().string() + "_CommonNew" + ".txt"; std::ofstream outFileCommon(CommonFullFileNameOut);//FileToProcess.path().filename().string()); outFileCommon << StringOutCommon; outFileCommon.close(); string StringDirStats = ProcOptions.ShowParams(); StringDirStats += "\n\n"; StringDirStats += "File\tGlobal Error Mean\tGlobal Error ABS Mean\tGlobal Error Std\tGlobal Error Max\tGlobal Error Count\t Global Sample Count\t\tMin Offset\Max Offset"; StringDirStats += "\n"; StringDirStats += ConfigFile.string(); StringDirStats += "\t"; StringDirStats += to_string(globalDirErrorsMean); StringDirStats += "\t"; StringDirStats += to_string(globalDirErrorsAbsMean); StringDirStats += "\t"; StringDirStats += to_string(globalDirErrorsStd); StringDirStats += "\t"; StringDirStats += to_string(globalMaxAbsError); StringDirStats += "\t"; StringDirStats += to_string(globalDirErrorsCount); StringDirStats += "\t"; StringDirStats += to_string(globalCounter); StringDirStats += "\t\t"; StringDirStats += to_string(ProcOptions.minOfset); StringDirStats += "\t"; StringDirStats += to_string(ProcOptions.maxOfset); StringDirStats += "\n\n"; StringDirStats += "direction\tError Mean\tError ABS Mean\tError Std\tError Max\tError Count \tSample Count\t\tMin Offset\Max Offset"; StringDirStats += "\n"; for(int i = 0; i < 91; i++) { StringDirStats += to_string(i); StringDirStats += "\t"; StringDirStats += to_string(DirErrorsMean[i]); StringDirStats += "\t"; StringDirStats += to_string(DirErrorsAbsMean[i]); StringDirStats += "\t"; StringDirStats += to_string(DirErrorsStd[i]); StringDirStats += "\t"; StringDirStats += to_string(DirErrorsMax[i]); StringDirStats += "\t"; StringDirStats += to_string(DirErrorsCount[i]); StringDirStats += "\t"; StringDirStats += to_string(DirCount[i]); StringDirStats += "\n"; } string DirStatsFileNameOut = ProcOptions.OutFolderName2 + ConfigFile.filename().string() + "_DirStats" + ".txt"; std::ofstream dirStatsFileCommon(DirStatsFileNameOut);//FileToProcess.path().filename().string()); dirStatsFileCommon << StringDirStats; dirStatsFileCommon.close(); //string in; //std::cin >> in; return 0; }
455cdcaccb33af17fbfc197c2196f6b4c2018a68
cdab8b42636f0cb3017442576cd797357ba41c69
/subwayCharge/subwayCommand/subwayCmdProc/src/subwayQueryLineProc.cpp
fa2242ec14a90e562efd680f0daec45f110729f5
[]
no_license
tmiao1/huawei_subway
f8d692ce35c7b8b139851aab7ce5efc56b7b3348
a847645d2527af011aedf49ad81974fff700361a
refs/heads/master
2021-01-12T00:24:40.752718
2017-01-12T08:04:40
2017-01-12T08:04:40
78,721,494
0
0
null
null
null
null
GB18030
C++
false
false
645
cpp
#include "stdafx.h" #include <iostream> #include "subwayGlobalDef.h" #include "subwayMacro.h" #include "subwayCard.h" #include "subwayCmdParse.h" #include "subwayline.h" #include "subwayPrice.h" #include "subwayCommon.h" #include "subwayOutput.h" #include "subwayError.h" using namespace std; /* @ 查询地铁线 @ 入参:unCmd, 命令内容 @ 出参: returnStr @ 返回值: 无 */ void ProcQueryLineCmd(UN_CMD &unCmd, char returnStr[MAX_SEND_BUFFER_LENGTH]) { //查询所有地铁线 GetLineInfo string resultStr; GetLineInfo(resultStr); memcpy_s(returnStr,MAX_SEND_BUFFER_LENGTH,resultStr.c_str(),resultStr.length()); return; }
1bd8f7671eb25618bfd6f4059a0ce3b38fdd57b9
6b2a8dd202fdce77c971c412717e305e1caaac51
/solutions_5751500831719424_0/C++/Rez/repeater.cpp
8a272ed17b30e6d37d9e33c7e39d31f74b188050
[]
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,972
cpp
#include <iostream> int findMinimumDev(int* countChar, int N) { int min = INT_MAX; int max = INT_MIN; for(int i = 0; i < N; i++) { if(min > countChar[i]) min = countChar[i]; if(max < countChar[i]) max = countChar[i]; } int minit = INT_MAX; for(int j = min; j <= max; j++) { int sum = 0; for(int i = 0; i < N; i++) { sum += (abs(countChar[i] - j)); } if(sum < minit) { minit = sum; } } return minit; } int main() { char filename1[100] = "C:\\Users\\RezaulAkram\\Desktop\\A-small-attempt1.in"; char filename2[100] = "C:\\Users\\RezaulAkram\\Desktop\\op5.txt"; FILE* file = fopen(filename1,"r"); FILE* file2 = fopen(filename2,"w"); int T; fscanf(file,"%d\n", &T); for(int i =0 ; i < T; i++) { int N = -1; char strings[100][101]; fscanf(file,"%d\n", &N); for(int j = 0; j < N; j++) { fscanf(file, "%s", strings[j]); } int countChar[100]; int character[100] = {0}; int position[100] = {0}; int done = 0, lastchar = 0; int iter = 0; int result; while(done != 1) { result = 0; for(int j = 0; j < N; j++) { countChar[j] = 1; int stringlen = strlen(strings[j]); if(position[j] >= stringlen) { character[j]= 0; lastchar = 1; } else character[j] = strings[j][position[j]]; if(j != 0 && character[j] != character[0]) { result = -1; break; } int k = position[j]; while(( k < (stringlen - 1)) && (strings[j][k] == strings[j][k+1])) { k++; countChar[j]++; } position[j] = k+1; } if(result == -1) break; iter += findMinimumDev(countChar, N); if(lastchar == 1) done = 1; } if(result == -1) fprintf(file2,"Case #%d: Fegla Won\n", (i+1)); else fprintf(file2,"Case #%d: %d\n", (i+1), iter); } fclose(file); fclose(file2); }
b3bf3fc7fa612d8a6b752d8d56528f8209961560
936abcf5c18e3c5818037f90d4954b59dab700fe
/Table/Table/main.cpp
870c653daa79cf997df7f105a793651b38339a82
[]
no_license
whistlinwilly/SMAART
9b540214455ba06ab700c4ccf41455008e884f70
8014c40361b2dad2a2624cbb059d87d4b701d0fa
refs/heads/master
2021-01-02T23:13:27.685974
2013-04-13T23:35:20
2013-04-13T23:35:20
null
0
0
null
null
null
null
UTF-8
C++
false
false
294
cpp
#include "Initialization.h" #include "Table.h" int main(int argc, char* argv[]) { //construct a table with (ip, port, cameraNumber); Table* table = new Table("10.0.1.187", 6881, 0); //run the initialization table->initialize(); //run whatever we want to run table->run(); return 0; }
a2ce62a16655436103b8969350f00917426a5fac
6e9058974e04aa2b292102372a0377291c04e907
/json_builder.h
1e222176f73cc9c1c63f86689026b1767e6a2d9a
[]
no_license
Alexsander-ggo/Transport-Directory
708db42f799b49a73177fea1f2292bc68b99889d
833a3327051605c62ae3dc4f0ae13a53dfa4c24f
refs/heads/main
2023-06-05T23:32:04.102640
2021-06-20T14:14:15
2021-06-20T14:14:15
378,658,415
0
1
null
null
null
null
UTF-8
C++
false
false
3,075
h
#pragma once #include <memory> #include <stack> #include <string> #include "json.h" namespace json { class BuildConstructor; class BuildContextFirst; class BuildContextSecond; class KeyContext; class ValueKeyContext; class ValueArrayContext; class DictContext; class ArrayContext; class Builder; //------------ BuildConstructor --------------- class BuildConstructor { public: explicit BuildConstructor(Builder& builder); protected: Builder& builder_; }; //------------ BuildContextFirst --------------- class BuildContextFirst : public BuildConstructor { public: explicit BuildContextFirst(Builder& builder); DictContext& StartDict(); ArrayContext& StartArray(); }; //------------ BuildContextSecond --------------- class BuildContextSecond : public BuildConstructor { public: explicit BuildContextSecond(Builder& builder); KeyContext& Key(std::string key); Builder& EndDict(); }; //------------ KeyContext --------------- class KeyContext : public BuildContextFirst { public: explicit KeyContext(Builder& builder); ValueKeyContext& Value(Node::Value value); }; //------------ ValueKeyContext --------------- class ValueKeyContext : public BuildContextSecond { public: explicit ValueKeyContext(Builder& builder); }; //------------ ValueArrayContext --------------- class ValueArrayContext : public BuildContextFirst { public: explicit ValueArrayContext(Builder& builder); ValueArrayContext& Value(Node::Value value); Builder& EndArray(); }; //------------ DictContext --------------- class DictContext : public BuildContextSecond { public: explicit DictContext(Builder& builder); }; //------------ ArrayContext --------------- class ArrayContext : public ValueArrayContext { public: explicit ArrayContext(Builder& builder); }; //------------ Builder --------------- class Builder final : virtual public KeyContext, virtual public ValueKeyContext, virtual public DictContext, virtual public ArrayContext { public: Builder(); KeyContext& Key(std::string key); Builder& Value(Node::Value value); DictContext& StartDict(); Builder& EndDict(); ArrayContext& StartArray(); Builder& EndArray(); Node Build() const; private: bool UnableAdd() const; bool IsMakeObj() const; bool UnableUseKey() const; bool UnableUseValue() const; bool UnableUseStartDict() const; bool UnableUseEndDict() const; bool UnableUseStartArray() const; bool UnableUseEndArray() const; bool UnableUseBuild() const; Builder& AddNode(const Node& node); void PushNode(Node::Value value); private: Node root_ = nullptr; std::stack<std::unique_ptr<Node>> nodes_; }; }
4e6273a9a20e13df8ac9279950d45a4191f597db
13c2d3db2d49c40c74c2e6420a9cd89377f1c934
/program_data/github_cpp_program_data/49/270.cpp
9a7103c446ab471e7125e85a78f7670a11b6d331
[ "MIT" ]
permissive
qiuchili/ggnn_graph_classification
c2090fefe11f8bf650e734442eb96996a54dc112
291ff02404555511b94a4f477c6974ebd62dcf44
refs/heads/master
2021-10-18T14:54:26.154367
2018-10-21T23:34:14
2018-10-21T23:34:14
null
0
0
null
null
null
null
UTF-8
C++
false
false
5,907
cpp
#include <fstream> #include <iostream> #include <cmath> #include "helfer.h" #include "gamma.h" using namespace std; // The following class implements the linear fit to the function a + b * t class Fitab { private: // Initialisation of vectors containing data (already chopped to the required interval) VecDoub x; VecDoub y; VecDoub std_y; // Standard deviation in y VecDoub t; // Auxiliary variables for fit const int N; // Number of lines passed to the object double S, S_x, S_xx, S_y, S_xy, S_tt; public: Fitab(VecDoub x_in, VecDoub y_in, VecDoub std_y_in) : x(x_in), y(y_in), std_y(std_y_in), N( x_in.size() ) { t.resize(N); // I tried to initialise it as t(N), but it gives a not well defined behaviour set_auxiliary_t(); // Initialise auxiliary values t[i] // Calculation of the different sums S = Sum(); S_x = Sum_x(); S_xx = Sum_xx(); S_y = Sum_y(); S_xy = Sum_xy(); S_tt = Sum_tt(); } // Definition of functions that calculate the different sums double Sum(); double Sum_x(); double Sum_xx(); double Sum_y(); double Sum_xy(); double Sum_tt(); void set_auxiliary_t(); // Initialises auxiliary t[i] values // Calculation of parameters of the fit and corresponding uncertainties + D.O.F (degrees of freedom) VecDoub get_parameters(); int get_dof(); }; double Fitab::Sum() { double sum = 0; for (int i = 0; i < N; ++i) sum += 1./(std_y[i]*std_y[i]); return sum; } double Fitab::Sum_x() { double sum = 0; for (int i = 0; i < N; ++i) sum += x[i]/(std_y[i]*std_y[i]); return sum; } double Fitab::Sum_xx() { double sum = 0; for (int i = 0; i < N; ++i) sum += (x[i]*x[i])/(std_y[i]*std_y[i]); return sum; } double Fitab::Sum_y() { double sum = 0; for (int i = 0; i < N; ++i) sum += y[i]/(std_y[i]*std_y[i]); return sum; } double Fitab::Sum_xy() { double sum = 0; for (int i = 0; i < N; ++i) sum += (x[i]*y[i])/(std_y[i]*std_y[i]); return sum; } double Fitab::Sum_tt() { double sum = 0; for (int i = 0; i < N; ++i) sum += t[i]*t[i]; return sum; } void Fitab::set_auxiliary_t() { for (int i = 0; i < N; ++i) { t[i] = 1./std_y[i] * (x[i] - Sum_x()/Sum()); } } VecDoub Fitab::get_parameters() { double sum = 0; VecDoub parameters(5); // Vector that will contain the different parameters double chi2 = 0; for (int i = 0; i < N; ++i) sum += t[i] * y[i] / std_y[i]; double b = 1./S_tt * sum; double var_b = 1./S_tt; double a = (S_y - S_x * b)/S; double var_a = 1./S * (1+S_x*S_x/(S_tt*S)); for (int i = 0; i < N; ++i) { chi2 += (y[i]-(a + b * x[i]))/(std_y[i])*(y[i]-(a + b * x[i]))/(std_y[i]); } // The following lines could have been directly written above as parameters[0] = b = ...? only if b,a, etc had been initialised? parameters[0] = b; parameters[1] = var_b; parameters[2] = a; parameters[3] = var_a; parameters[4] = chi2; return parameters; } int Fitab::get_dof() { return N - 2; // Degrees of freedom for chi-square test } int main() { const int N = 5000; // Number of lines of data file: possible improvement: use a function to calculate it (for loop with function get_lines() ? ) VecDoub t(N), x2(N), std_x2(N), y2(N), std_y2(N); ifstream import("msq.txt", ios::in); // Open input stream int j = 0; const double threshold = 600; // Lower bound of fitting interval (time >=600) bool flag = 1; // Flag used to indicate when we import the first value of time that satisfies t>=600 int skip_line; // Number of line corresponding to minimum time // Import all data. Possible improvement: skip first 600 lines straight away? while ( import.good() && !import.eof() ) { import >> t[j++] >> x2[j] >> std_x2[j] >> y2[j] >> std_y2[j]; // Note: compiler gives me a warning about possible undefined behaviour for j if ( t[j-1] >= threshold && flag ) // Detect when we read first value of time above threshold t > = 600 { skip_line = j-1; flag = 0; } } // Selecting the range of data (in lines) we're interested in (t >= 600) and calculate perpendicular displacement and uncertainty int size_subset = N - skip_line; VecDoub t_subset(size_subset); VecDoub r_perp2(size_subset); VecDoub std_r_perp2(size_subset); for (int i = 0; i < size_subset; ++i) // This could easily be done in the while loop above if we'd created the corresponding VecDoub's before { t_subset[i] = t[skip_line + i]; r_perp2[i] = (x2[skip_line + i] + y2[skip_line + i])/2; // standard deviation of r_perp2: Right now standard propagation of errors used in physics std_r_perp2[i] = sqrt(std_x2[skip_line + i]*std_x2[skip_line + i] + std_y2[skip_line + i]*std_y2[skip_line + i])/2; } // Fitting procedure Fitab fit(t_subset, r_perp2, std_r_perp2); VecDoub parameters = fit.get_parameters(); int dof = fit.get_dof();// Degrees of freedom: number of points(of the fit) - free parameters (a, b) // Calculation of p-value Gamma Q; // Instantiation of gamma-integral object double chi2 = parameters[4]; double p_value = Q.gammq(dof/2, chi2/2); // Showing the results of the fit cout << "# b +- std_b:" << parameters[0] << "+-" << sqrt(parameters[1]) << "\n" << "# a +- std_a:" << parameters[2] << "+-" << sqrt(parameters[3]) << "\n" << "# chi^2 = " << chi2 << "\n" << "# p-value = " << p_value << endl; cout << "# Since p-value > significance level (typically 0.01 or 0.05), we conclude from the statistical test that null hypothesis is valid at that significance level, i.e. the data is correctly modelled (at that significance level) by a straight line (the p-value represents the probability of finding a discrepancy between observed and theoretical model at least as large as the one measured here if the null hypothesis is valid (i.e. data follows linear model). In other words, probability of chance fluctuations w.r.t. theoretical model giving at least such a discrepancy. The larger the p-value (in this case), the more accurate the model)" << endl; }
7156fe409ce0c26552af35b87dc9cb6c1feaf43e
b677894966f2ae2d0585a31f163a362e41a3eae0
/ns3/ns-3.26/src/lte/test/test-lte-x2-handover.cc
fe62123024dcb182221532ab40e41b879364d596
[ "LicenseRef-scancode-free-unknown", "GPL-2.0-only", "Apache-2.0" ]
permissive
cyliustack/clusim
667a9eef2e1ea8dad1511fd405f3191d150a04a8
cbedcf671ba19fded26e4776c0e068f81f068dfd
refs/heads/master
2022-10-06T20:14:43.052930
2022-10-01T19:42:19
2022-10-01T19:42:19
99,692,344
7
3
Apache-2.0
2018-07-04T10:09:24
2017-08-08T12:51:33
Python
UTF-8
C++
false
false
30,635
cc
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ /* * Copyright (c) 2012 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation; * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * Author: Nicola Baldo <[email protected]> */ #include <ns3/core-module.h> #include <ns3/network-module.h> #include <ns3/mobility-module.h> #include <ns3/lte-module.h> #include <ns3/internet-module.h> #include <ns3/applications-module.h> #include <ns3/point-to-point-module.h> using namespace ns3; NS_LOG_COMPONENT_DEFINE ("LteX2HandoverTest"); struct HandoverEvent { Time startTime; uint32_t ueDeviceIndex; uint32_t sourceEnbDeviceIndex; uint32_t targetEnbDeviceIndex; }; class LteX2HandoverTestCase : public TestCase { public: /** * * * \param nUes number of UEs in the test * \param nDedicatedBearers number of bearers to be activated per UE * \param handoverEventList * \param handoverEventListName * \param useUdp true if UDP is to be used, false if TCP is to be used * * \return */ LteX2HandoverTestCase (uint32_t nUes, uint32_t nDedicatedBearers, std::list<HandoverEvent> handoverEventList, std::string handoverEventListName, bool useUdp, std::string schedulerType, bool admitHo, bool useIdealRrc); private: static std::string BuildNameString (uint32_t nUes, uint32_t nDedicatedBearers, std::string handoverEventListName, bool useUdp, std::string schedulerType, bool admitHo, bool useIdealRrc); virtual void DoRun (void); void CheckConnected (Ptr<NetDevice> ueDevice, Ptr<NetDevice> enbDevice); uint32_t m_nUes; // number of UEs in the test uint32_t m_nDedicatedBearers; // number of UEs in the test std::list<HandoverEvent> m_handoverEventList; std::string m_handoverEventListName; bool m_epc; bool m_useUdp; std::string m_schedulerType; bool m_admitHo; bool m_useIdealRrc; Ptr<LteHelper> m_lteHelper; Ptr<PointToPointEpcHelper> m_epcHelper; struct BearerData { uint32_t bid; Ptr<PacketSink> dlSink; Ptr<PacketSink> ulSink; uint32_t dlOldTotalRx; uint32_t ulOldTotalRx; }; struct UeData { uint32_t id; std::list<BearerData> bearerDataList; }; void SaveStatsAfterHandover (uint32_t ueIndex); void CheckStatsAWhileAfterHandover (uint32_t ueIndex); std::vector<UeData> m_ueDataVector; const Time m_maxHoDuration; const Time m_statsDuration; const Time m_udpClientInterval; const uint32_t m_udpClientPktSize; }; std::string LteX2HandoverTestCase::BuildNameString (uint32_t nUes, uint32_t nDedicatedBearers, std::string handoverEventListName, bool useUdp, std::string schedulerType, bool admitHo, bool useIdealRrc) { std::ostringstream oss; oss << " nUes=" << nUes << " nDedicatedBearers=" << nDedicatedBearers << " udp=" << useUdp << " " << schedulerType << " admitHo=" << admitHo << " hoList: " << handoverEventListName; if (useIdealRrc) { oss << ", ideal RRC"; } else { oss << ", real RRC"; } return oss.str (); } LteX2HandoverTestCase::LteX2HandoverTestCase (uint32_t nUes, uint32_t nDedicatedBearers, std::list<HandoverEvent> handoverEventList, std::string handoverEventListName, bool useUdp, std::string schedulerType, bool admitHo, bool useIdealRrc) : TestCase (BuildNameString (nUes, nDedicatedBearers, handoverEventListName, useUdp, schedulerType, admitHo, useIdealRrc)), m_nUes (nUes), m_nDedicatedBearers (nDedicatedBearers), m_handoverEventList (handoverEventList), m_handoverEventListName (handoverEventListName), m_epc (true), m_useUdp (useUdp), m_schedulerType (schedulerType), m_admitHo (admitHo), m_useIdealRrc (useIdealRrc), m_maxHoDuration (Seconds (0.1)), m_statsDuration (Seconds (0.1)), m_udpClientInterval (Seconds (0.01)), m_udpClientPktSize (100) { } void LteX2HandoverTestCase::DoRun () { NS_LOG_FUNCTION (this << BuildNameString (m_nUes, m_nDedicatedBearers, m_handoverEventListName, m_useUdp, m_schedulerType, m_admitHo, m_useIdealRrc)); Config::Reset (); Config::SetDefault ("ns3::UdpClient::Interval", TimeValue (m_udpClientInterval)); Config::SetDefault ("ns3::UdpClient::MaxPackets", UintegerValue (1000000)); Config::SetDefault ("ns3::UdpClient::PacketSize", UintegerValue (m_udpClientPktSize)); //Disable Uplink Power Control Config::SetDefault ("ns3::LteUePhy::EnableUplinkPowerControl", BooleanValue (false)); int64_t stream = 1; m_lteHelper = CreateObject<LteHelper> (); m_lteHelper->SetAttribute ("PathlossModel", StringValue ("ns3::FriisSpectrumPropagationLossModel")); m_lteHelper->SetSchedulerType (m_schedulerType); m_lteHelper->SetHandoverAlgorithmType ("ns3::NoOpHandoverAlgorithm"); // disable automatic handover m_lteHelper->SetAttribute ("UseIdealRrc", BooleanValue (m_useIdealRrc)); NodeContainer enbNodes; enbNodes.Create (2); NodeContainer ueNodes; ueNodes.Create (m_nUes); if (m_epc) { m_epcHelper = CreateObject<PointToPointEpcHelper> (); m_lteHelper->SetEpcHelper (m_epcHelper); } Ptr<ListPositionAllocator> positionAlloc = CreateObject<ListPositionAllocator> (); positionAlloc->Add (Vector (-3000, 0, 0)); // enb0 positionAlloc->Add (Vector ( 3000, 0, 0)); // enb1 for (uint16_t i = 0; i < m_nUes; i++) { positionAlloc->Add (Vector (0, 0, 0)); } MobilityHelper mobility; mobility.SetPositionAllocator (positionAlloc); mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel"); mobility.Install (enbNodes); mobility.Install (ueNodes); NetDeviceContainer enbDevices; enbDevices = m_lteHelper->InstallEnbDevice (enbNodes); stream += m_lteHelper->AssignStreams (enbDevices, stream); for (NetDeviceContainer::Iterator it = enbDevices.Begin (); it != enbDevices.End (); ++it) { Ptr<LteEnbRrc> enbRrc = (*it)->GetObject<LteEnbNetDevice> ()->GetRrc (); enbRrc->SetAttribute ("AdmitHandoverRequest", BooleanValue (m_admitHo)); } NetDeviceContainer ueDevices; ueDevices = m_lteHelper->InstallUeDevice (ueNodes); stream += m_lteHelper->AssignStreams (ueDevices, stream); Ipv4Address remoteHostAddr; Ipv4StaticRoutingHelper ipv4RoutingHelper; Ipv4InterfaceContainer ueIpIfaces; Ptr<Node> remoteHost; if (m_epc) { // Create a single RemoteHost NodeContainer remoteHostContainer; remoteHostContainer.Create (1); remoteHost = remoteHostContainer.Get (0); InternetStackHelper internet; internet.Install (remoteHostContainer); // Create the Internet PointToPointHelper p2ph; p2ph.SetDeviceAttribute ("DataRate", DataRateValue (DataRate ("100Gb/s"))); p2ph.SetDeviceAttribute ("Mtu", UintegerValue (1500)); p2ph.SetChannelAttribute ("Delay", TimeValue (Seconds (0.010))); Ptr<Node> pgw = m_epcHelper->GetPgwNode (); NetDeviceContainer internetDevices = p2ph.Install (pgw, remoteHost); Ipv4AddressHelper ipv4h; ipv4h.SetBase ("1.0.0.0", "255.0.0.0"); Ipv4InterfaceContainer internetIpIfaces = ipv4h.Assign (internetDevices); // in this container, interface 0 is the pgw, 1 is the remoteHost remoteHostAddr = internetIpIfaces.GetAddress (1); Ipv4StaticRoutingHelper ipv4RoutingHelper; Ptr<Ipv4StaticRouting> remoteHostStaticRouting = ipv4RoutingHelper.GetStaticRouting (remoteHost->GetObject<Ipv4> ()); remoteHostStaticRouting->AddNetworkRouteTo (Ipv4Address ("7.0.0.0"), Ipv4Mask ("255.0.0.0"), 1); // Install the IP stack on the UEs internet.Install (ueNodes); ueIpIfaces = m_epcHelper->AssignUeIpv4Address (NetDeviceContainer (ueDevices)); } // attachment (needs to be done after IP stack configuration) // all UEs attached to eNB 0 at the beginning m_lteHelper->Attach (ueDevices, enbDevices.Get (0)); if (m_epc) { // always true: bool epcDl = true; // always true: bool epcUl = true; // the rest of this block is copied from lena-dual-stripe // Install and start applications on UEs and remote host uint16_t dlPort = 10000; uint16_t ulPort = 20000; // randomize a bit start times to avoid simulation artifacts // (e.g., buffer overflows due to packet transmissions happening // exactly at the same time) Ptr<UniformRandomVariable> startTimeSeconds = CreateObject<UniformRandomVariable> (); startTimeSeconds->SetAttribute ("Min", DoubleValue (0)); startTimeSeconds->SetAttribute ("Max", DoubleValue (0.010)); startTimeSeconds->SetStream (stream++); for (uint32_t u = 0; u < ueNodes.GetN (); ++u) { Ptr<Node> ue = ueNodes.Get (u); // Set the default gateway for the UE Ptr<Ipv4StaticRouting> ueStaticRouting = ipv4RoutingHelper.GetStaticRouting (ue->GetObject<Ipv4> ()); ueStaticRouting->SetDefaultRoute (m_epcHelper->GetUeDefaultGatewayAddress (), 1); UeData ueData; for (uint32_t b = 0; b < m_nDedicatedBearers; ++b) { ++dlPort; ++ulPort; ApplicationContainer clientApps; ApplicationContainer serverApps; BearerData bearerData; if (m_useUdp) { // always true: if (epcDl) { UdpClientHelper dlClientHelper (ueIpIfaces.GetAddress (u), dlPort); clientApps.Add (dlClientHelper.Install (remoteHost)); PacketSinkHelper dlPacketSinkHelper ("ns3::UdpSocketFactory", InetSocketAddress (Ipv4Address::GetAny (), dlPort)); ApplicationContainer sinkContainer = dlPacketSinkHelper.Install (ue); bearerData.dlSink = sinkContainer.Get (0)->GetObject<PacketSink> (); serverApps.Add (sinkContainer); } // always true: if (epcUl) { UdpClientHelper ulClientHelper (remoteHostAddr, ulPort); clientApps.Add (ulClientHelper.Install (ue)); PacketSinkHelper ulPacketSinkHelper ("ns3::UdpSocketFactory", InetSocketAddress (Ipv4Address::GetAny (), ulPort)); ApplicationContainer sinkContainer = ulPacketSinkHelper.Install (remoteHost); bearerData.ulSink = sinkContainer.Get (0)->GetObject<PacketSink> (); serverApps.Add (sinkContainer); } } else // use TCP { // always true: if (epcDl) { BulkSendHelper dlClientHelper ("ns3::TcpSocketFactory", InetSocketAddress (ueIpIfaces.GetAddress (u), dlPort)); dlClientHelper.SetAttribute ("MaxBytes", UintegerValue (0)); clientApps.Add (dlClientHelper.Install (remoteHost)); PacketSinkHelper dlPacketSinkHelper ("ns3::TcpSocketFactory", InetSocketAddress (Ipv4Address::GetAny (), dlPort)); ApplicationContainer sinkContainer = dlPacketSinkHelper.Install (ue); bearerData.dlSink = sinkContainer.Get (0)->GetObject<PacketSink> (); serverApps.Add (sinkContainer); } // always true: if (epcUl) { BulkSendHelper ulClientHelper ("ns3::TcpSocketFactory", InetSocketAddress (remoteHostAddr, ulPort)); ulClientHelper.SetAttribute ("MaxBytes", UintegerValue (0)); clientApps.Add (ulClientHelper.Install (ue)); PacketSinkHelper ulPacketSinkHelper ("ns3::TcpSocketFactory", InetSocketAddress (Ipv4Address::GetAny (), ulPort)); ApplicationContainer sinkContainer = ulPacketSinkHelper.Install (remoteHost); bearerData.ulSink = sinkContainer.Get (0)->GetObject<PacketSink> (); serverApps.Add (sinkContainer); } } // end if (useUdp) Ptr<EpcTft> tft = Create<EpcTft> (); // always true: if (epcDl) { EpcTft::PacketFilter dlpf; dlpf.localPortStart = dlPort; dlpf.localPortEnd = dlPort; tft->Add (dlpf); } // always true: if (epcUl) { EpcTft::PacketFilter ulpf; ulpf.remotePortStart = ulPort; ulpf.remotePortEnd = ulPort; tft->Add (ulpf); } // always true: if (epcDl || epcUl) { EpsBearer bearer (EpsBearer::NGBR_VIDEO_TCP_DEFAULT); m_lteHelper->ActivateDedicatedEpsBearer (ueDevices.Get (u), bearer, tft); } Time startTime = Seconds (startTimeSeconds->GetValue ()); serverApps.Start (startTime); clientApps.Start (startTime); ueData.bearerDataList.push_back (bearerData); } // end for b m_ueDataVector.push_back (ueData); } } else // (epc == false) { // for radio bearer activation purposes, consider together home UEs and macro UEs for (uint32_t u = 0; u < ueDevices.GetN (); ++u) { Ptr<NetDevice> ueDev = ueDevices.Get (u); for (uint32_t b = 0; b < m_nDedicatedBearers; ++b) { enum EpsBearer::Qci q = EpsBearer::NGBR_VIDEO_TCP_DEFAULT; EpsBearer bearer (q); m_lteHelper->ActivateDataRadioBearer (ueDev, bearer); } } } m_lteHelper->AddX2Interface (enbNodes); // check initial RRC connection const Time maxRrcConnectionEstablishmentDuration = Seconds (0.080); for (NetDeviceContainer::Iterator it = ueDevices.Begin (); it != ueDevices.End (); ++it) { Simulator::Schedule (maxRrcConnectionEstablishmentDuration, &LteX2HandoverTestCase::CheckConnected, this, *it, enbDevices.Get (0)); } // schedule handover events and corresponding checks Time stopTime = Seconds (0); for (std::list<HandoverEvent>::iterator hoEventIt = m_handoverEventList.begin (); hoEventIt != m_handoverEventList.end (); ++hoEventIt) { Simulator::Schedule (hoEventIt->startTime, &LteX2HandoverTestCase::CheckConnected, this, ueDevices.Get (hoEventIt->ueDeviceIndex), enbDevices.Get (hoEventIt->sourceEnbDeviceIndex)); m_lteHelper->HandoverRequest (hoEventIt->startTime, ueDevices.Get (hoEventIt->ueDeviceIndex), enbDevices.Get (hoEventIt->sourceEnbDeviceIndex), enbDevices.Get (hoEventIt->targetEnbDeviceIndex)); Time hoEndTime = hoEventIt->startTime + m_maxHoDuration; Simulator::Schedule (hoEndTime, &LteX2HandoverTestCase::CheckConnected, this, ueDevices.Get (hoEventIt->ueDeviceIndex), enbDevices.Get (m_admitHo ? hoEventIt->targetEnbDeviceIndex : hoEventIt->sourceEnbDeviceIndex)); Simulator::Schedule (hoEndTime, &LteX2HandoverTestCase::SaveStatsAfterHandover, this, hoEventIt->ueDeviceIndex); Time checkStatsAfterHoTime = hoEndTime + m_statsDuration; Simulator::Schedule (checkStatsAfterHoTime, &LteX2HandoverTestCase::CheckStatsAWhileAfterHandover, this, hoEventIt->ueDeviceIndex); if (stopTime <= checkStatsAfterHoTime) { stopTime = checkStatsAfterHoTime + MilliSeconds (1); } } // m_lteHelper->EnableRlcTraces (); // m_lteHelper->EnablePdcpTraces(); Simulator::Stop (stopTime); Simulator::Run (); Simulator::Destroy (); } void LteX2HandoverTestCase::CheckConnected (Ptr<NetDevice> ueDevice, Ptr<NetDevice> enbDevice) { Ptr<LteUeNetDevice> ueLteDevice = ueDevice->GetObject<LteUeNetDevice> (); Ptr<LteUeRrc> ueRrc = ueLteDevice->GetRrc (); NS_TEST_ASSERT_MSG_EQ (ueRrc->GetState (), LteUeRrc::CONNECTED_NORMALLY, "Wrong LteUeRrc state!"); Ptr<LteEnbNetDevice> enbLteDevice = enbDevice->GetObject<LteEnbNetDevice> (); Ptr<LteEnbRrc> enbRrc = enbLteDevice->GetRrc (); uint16_t rnti = ueRrc->GetRnti (); Ptr<UeManager> ueManager = enbRrc->GetUeManager (rnti); NS_TEST_ASSERT_MSG_NE (ueManager, 0, "RNTI " << rnti << " not found in eNB"); UeManager::State ueManagerState = ueManager->GetState (); NS_TEST_ASSERT_MSG_EQ (ueManagerState, UeManager::CONNECTED_NORMALLY, "Wrong UeManager state!"); NS_ASSERT_MSG (ueManagerState == UeManager::CONNECTED_NORMALLY, "Wrong UeManager state!"); uint16_t ueCellId = ueRrc->GetCellId (); uint16_t enbCellId = enbLteDevice->GetCellId (); uint8_t ueDlBandwidth = ueRrc->GetDlBandwidth (); uint8_t enbDlBandwidth = enbLteDevice->GetDlBandwidth (); uint8_t ueUlBandwidth = ueRrc->GetUlBandwidth (); uint8_t enbUlBandwidth = enbLteDevice->GetUlBandwidth (); uint8_t ueDlEarfcn = ueRrc->GetDlEarfcn (); uint8_t enbDlEarfcn = enbLteDevice->GetDlEarfcn (); uint8_t ueUlEarfcn = ueRrc->GetUlEarfcn (); uint8_t enbUlEarfcn = enbLteDevice->GetUlEarfcn (); uint64_t ueImsi = ueLteDevice->GetImsi (); uint64_t enbImsi = ueManager->GetImsi (); NS_TEST_ASSERT_MSG_EQ (ueImsi, enbImsi, "inconsistent IMSI"); NS_TEST_ASSERT_MSG_EQ (ueCellId, enbCellId, "inconsistent CellId"); NS_TEST_ASSERT_MSG_EQ (ueDlBandwidth, enbDlBandwidth, "inconsistent DlBandwidth"); NS_TEST_ASSERT_MSG_EQ (ueUlBandwidth, enbUlBandwidth, "inconsistent UlBandwidth"); NS_TEST_ASSERT_MSG_EQ (ueDlEarfcn, enbDlEarfcn, "inconsistent DlEarfcn"); NS_TEST_ASSERT_MSG_EQ (ueUlEarfcn, enbUlEarfcn, "inconsistent UlEarfcn"); ObjectMapValue enbDataRadioBearerMapValue; ueManager->GetAttribute ("DataRadioBearerMap", enbDataRadioBearerMapValue); NS_TEST_ASSERT_MSG_EQ (enbDataRadioBearerMapValue.GetN (), m_nDedicatedBearers + 1, "wrong num bearers at eNB"); ObjectMapValue ueDataRadioBearerMapValue; ueRrc->GetAttribute ("DataRadioBearerMap", ueDataRadioBearerMapValue); NS_TEST_ASSERT_MSG_EQ (ueDataRadioBearerMapValue.GetN (), m_nDedicatedBearers + 1, "wrong num bearers at UE"); ObjectMapValue::Iterator enbBearerIt = enbDataRadioBearerMapValue.Begin (); ObjectMapValue::Iterator ueBearerIt = ueDataRadioBearerMapValue.Begin (); while (enbBearerIt != enbDataRadioBearerMapValue.End () && ueBearerIt != ueDataRadioBearerMapValue.End ()) { Ptr<LteDataRadioBearerInfo> enbDrbInfo = enbBearerIt->second->GetObject<LteDataRadioBearerInfo> (); Ptr<LteDataRadioBearerInfo> ueDrbInfo = ueBearerIt->second->GetObject<LteDataRadioBearerInfo> (); //NS_TEST_ASSERT_MSG_EQ (enbDrbInfo->m_epsBearer, ueDrbInfo->m_epsBearer, "epsBearer differs"); NS_TEST_ASSERT_MSG_EQ ((uint32_t) enbDrbInfo->m_epsBearerIdentity, (uint32_t) ueDrbInfo->m_epsBearerIdentity, "epsBearerIdentity differs"); NS_TEST_ASSERT_MSG_EQ ((uint32_t) enbDrbInfo->m_drbIdentity, (uint32_t) ueDrbInfo->m_drbIdentity, "drbIdentity differs"); //NS_TEST_ASSERT_MSG_EQ (enbDrbInfo->m_rlcConfig, ueDrbInfo->m_rlcConfig, "rlcConfig differs"); NS_TEST_ASSERT_MSG_EQ ((uint32_t) enbDrbInfo->m_logicalChannelIdentity, (uint32_t) ueDrbInfo->m_logicalChannelIdentity, "logicalChannelIdentity differs"); //NS_TEST_ASSERT_MSG_EQ (enbDrbInfo->m_logicalChannelConfig, ueDrbInfo->m_logicalChannelConfig, "logicalChannelConfig differs"); ++enbBearerIt; ++ueBearerIt; } NS_ASSERT_MSG (enbBearerIt == enbDataRadioBearerMapValue.End (), "too many bearers at eNB"); NS_ASSERT_MSG (ueBearerIt == ueDataRadioBearerMapValue.End (), "too many bearers at UE"); } void LteX2HandoverTestCase::SaveStatsAfterHandover (uint32_t ueIndex) { for (std::list<BearerData>::iterator it = m_ueDataVector.at (ueIndex).bearerDataList.begin (); it != m_ueDataVector.at (ueIndex).bearerDataList.end (); ++it) { it->dlOldTotalRx = it->dlSink->GetTotalRx (); it->ulOldTotalRx = it->ulSink->GetTotalRx (); } } void LteX2HandoverTestCase::CheckStatsAWhileAfterHandover (uint32_t ueIndex) { uint32_t b = 1; for (std::list<BearerData>::iterator it = m_ueDataVector.at (ueIndex).bearerDataList.begin (); it != m_ueDataVector.at (ueIndex).bearerDataList.end (); ++it) { uint32_t dlRx = it->dlSink->GetTotalRx () - it->dlOldTotalRx; uint32_t ulRx = it->ulSink->GetTotalRx () - it->ulOldTotalRx; uint32_t expectedBytes = m_udpClientPktSize * (m_statsDuration.GetSeconds () / m_udpClientInterval.GetSeconds ()); // tolerance NS_TEST_ASSERT_MSG_GT (dlRx, 0.500 * expectedBytes, "too few RX bytes in DL, ue=" << ueIndex << ", b=" << b); NS_TEST_ASSERT_MSG_GT (ulRx, 0.500 * expectedBytes, "too few RX bytes in UL, ue=" << ueIndex << ", b=" << b); ++b; } } class LteX2HandoverTestSuite : public TestSuite { public: LteX2HandoverTestSuite (); }; LteX2HandoverTestSuite::LteX2HandoverTestSuite () : TestSuite ("lte-x2-handover", SYSTEM) { // in the following: // fwd means handover from enb 0 to enb 1 // bwd means handover from enb 1 to enb 0 HandoverEvent ue1fwd; ue1fwd.startTime = MilliSeconds (100); ue1fwd.ueDeviceIndex = 0; ue1fwd.sourceEnbDeviceIndex = 0; ue1fwd.targetEnbDeviceIndex = 1; HandoverEvent ue1bwd; ue1bwd.startTime = MilliSeconds (300); ue1bwd.ueDeviceIndex = 0; ue1bwd.sourceEnbDeviceIndex = 1; ue1bwd.targetEnbDeviceIndex = 0; HandoverEvent ue1fwdagain; ue1fwdagain.startTime = MilliSeconds (500); ue1fwdagain.ueDeviceIndex = 0; ue1fwdagain.sourceEnbDeviceIndex = 0; ue1fwdagain.targetEnbDeviceIndex = 1; HandoverEvent ue2fwd; ue2fwd.startTime = MilliSeconds (110); ue2fwd.ueDeviceIndex = 1; ue2fwd.sourceEnbDeviceIndex = 0; ue2fwd.targetEnbDeviceIndex = 1; HandoverEvent ue2bwd; ue2bwd.startTime = MilliSeconds (250); ue2bwd.ueDeviceIndex = 1; ue2bwd.sourceEnbDeviceIndex = 1; ue2bwd.targetEnbDeviceIndex = 0; std::string hel0name ("none"); std::list<HandoverEvent> hel0; std::string hel1name ("1 fwd"); std::list<HandoverEvent> hel1; hel1.push_back (ue1fwd); std::string hel2name ("1 fwd & bwd"); std::list<HandoverEvent> hel2; hel2.push_back (ue1fwd); hel2.push_back (ue1bwd); std::string hel3name ("1 fwd & bwd & fwd"); std::list<HandoverEvent> hel3; hel3.push_back (ue1fwd); hel3.push_back (ue1bwd); hel3.push_back (ue1fwdagain); std::string hel4name ("1+2 fwd"); std::list<HandoverEvent> hel4; hel4.push_back (ue1fwd); hel4.push_back (ue2fwd); std::string hel5name ("1+2 fwd & bwd"); std::list<HandoverEvent> hel5; hel5.push_back (ue1fwd); hel5.push_back (ue1bwd); hel5.push_back (ue2fwd); hel5.push_back (ue2bwd); std::string hel6name ("2 fwd"); std::list<HandoverEvent> hel6; hel6.push_back (ue2fwd); std::string hel7name ("2 fwd & bwd"); std::list<HandoverEvent> hel7; hel7.push_back (ue2fwd); hel7.push_back (ue2bwd); std::vector<std::string> schedulers; schedulers.push_back ("ns3::RrFfMacScheduler"); schedulers.push_back ("ns3::PfFfMacScheduler"); for (std::vector<std::string>::iterator schedIt = schedulers.begin (); schedIt != schedulers.end (); ++schedIt) { for (int32_t useIdealRrc = 1; useIdealRrc >= 0; --useIdealRrc) { // nUes, nDBearers, helist, name, useUdp, sched, admitHo, idealRrc AddTestCase (new LteX2HandoverTestCase ( 1, 0, hel0, hel0name, true, *schedIt, true, useIdealRrc), TestCase::EXTENSIVE); AddTestCase (new LteX2HandoverTestCase ( 2, 0, hel0, hel0name, true, *schedIt, true, useIdealRrc), TestCase::EXTENSIVE); AddTestCase (new LteX2HandoverTestCase ( 1, 5, hel0, hel0name, true, *schedIt, true, useIdealRrc), TestCase::EXTENSIVE); AddTestCase (new LteX2HandoverTestCase ( 2, 5, hel0, hel0name, true, *schedIt, true, useIdealRrc), TestCase::EXTENSIVE); AddTestCase (new LteX2HandoverTestCase ( 1, 0, hel1, hel1name, true, *schedIt, true, useIdealRrc), TestCase::EXTENSIVE); AddTestCase (new LteX2HandoverTestCase ( 1, 1, hel1, hel1name, true, *schedIt, true, useIdealRrc), TestCase::EXTENSIVE); AddTestCase (new LteX2HandoverTestCase ( 1, 2, hel1, hel1name, true, *schedIt, true, useIdealRrc), TestCase::EXTENSIVE); AddTestCase (new LteX2HandoverTestCase ( 1, 0, hel1, hel1name, true, *schedIt, false, useIdealRrc), TestCase::EXTENSIVE); AddTestCase (new LteX2HandoverTestCase ( 1, 1, hel1, hel1name, true, *schedIt, false, useIdealRrc), TestCase::EXTENSIVE); AddTestCase (new LteX2HandoverTestCase ( 1, 2, hel1, hel1name, true, *schedIt, false, useIdealRrc), TestCase::EXTENSIVE); AddTestCase (new LteX2HandoverTestCase ( 2, 0, hel1, hel1name, true, *schedIt, true, useIdealRrc), TestCase::EXTENSIVE); AddTestCase (new LteX2HandoverTestCase ( 2, 1, hel1, hel1name, true, *schedIt, true, useIdealRrc), TestCase::EXTENSIVE); AddTestCase (new LteX2HandoverTestCase ( 2, 2, hel1, hel1name, true, *schedIt, true, useIdealRrc), TestCase::EXTENSIVE); AddTestCase (new LteX2HandoverTestCase ( 2, 0, hel1, hel1name, true, *schedIt, false, useIdealRrc), TestCase::EXTENSIVE); AddTestCase (new LteX2HandoverTestCase ( 2, 1, hel1, hel1name, true, *schedIt, false, useIdealRrc), TestCase::EXTENSIVE); AddTestCase (new LteX2HandoverTestCase ( 2, 2, hel1, hel1name, true, *schedIt, false, useIdealRrc), TestCase::EXTENSIVE); AddTestCase (new LteX2HandoverTestCase ( 1, 0, hel2, hel2name, true, *schedIt, true, useIdealRrc), TestCase::EXTENSIVE); AddTestCase (new LteX2HandoverTestCase ( 1, 1, hel2, hel2name, true, *schedIt, true, useIdealRrc), TestCase::EXTENSIVE); AddTestCase (new LteX2HandoverTestCase ( 1, 2, hel2, hel2name, true, *schedIt, true, useIdealRrc), TestCase::EXTENSIVE); AddTestCase (new LteX2HandoverTestCase ( 1, 0, hel3, hel3name, true, *schedIt, true, useIdealRrc), TestCase::EXTENSIVE); AddTestCase (new LteX2HandoverTestCase ( 1, 1, hel3, hel3name, true, *schedIt, true, useIdealRrc), TestCase::EXTENSIVE); AddTestCase (new LteX2HandoverTestCase ( 1, 2, hel3, hel3name, true, *schedIt, true, useIdealRrc), TestCase::EXTENSIVE); AddTestCase (new LteX2HandoverTestCase ( 2, 0, hel3, hel3name, true, *schedIt, true, useIdealRrc), TestCase::EXTENSIVE); AddTestCase (new LteX2HandoverTestCase ( 2, 1, hel3, hel3name, true, *schedIt, true, useIdealRrc), TestCase::EXTENSIVE); AddTestCase (new LteX2HandoverTestCase ( 2, 2, hel3, hel3name, true, *schedIt, true, useIdealRrc), TestCase::QUICK); AddTestCase (new LteX2HandoverTestCase ( 2, 0, hel4, hel4name, true, *schedIt, true, useIdealRrc), TestCase::EXTENSIVE); AddTestCase (new LteX2HandoverTestCase ( 2, 1, hel4, hel4name, true, *schedIt, true, useIdealRrc), TestCase::EXTENSIVE); AddTestCase (new LteX2HandoverTestCase ( 2, 2, hel4, hel4name, true, *schedIt, true, useIdealRrc), TestCase::EXTENSIVE); AddTestCase (new LteX2HandoverTestCase ( 2, 0, hel5, hel5name, true, *schedIt, true, useIdealRrc), TestCase::EXTENSIVE); AddTestCase (new LteX2HandoverTestCase ( 2, 1, hel5, hel5name, true, *schedIt, true, useIdealRrc), TestCase::EXTENSIVE); AddTestCase (new LteX2HandoverTestCase ( 2, 2, hel5, hel5name, true, *schedIt, true, useIdealRrc), TestCase::EXTENSIVE); AddTestCase (new LteX2HandoverTestCase ( 3, 0, hel3, hel3name, true, *schedIt, true, useIdealRrc), TestCase::EXTENSIVE); AddTestCase (new LteX2HandoverTestCase ( 3, 1, hel3, hel3name, true, *schedIt, true, useIdealRrc), TestCase::EXTENSIVE); AddTestCase (new LteX2HandoverTestCase ( 3, 2, hel3, hel3name, true, *schedIt, true, useIdealRrc), TestCase::EXTENSIVE); AddTestCase (new LteX2HandoverTestCase ( 3, 0, hel4, hel4name, true, *schedIt, true, useIdealRrc), TestCase::EXTENSIVE); AddTestCase (new LteX2HandoverTestCase ( 3, 1, hel4, hel4name, true, *schedIt, true, useIdealRrc), TestCase::EXTENSIVE); AddTestCase (new LteX2HandoverTestCase ( 3, 2, hel4, hel4name, true, *schedIt, true, useIdealRrc), TestCase::EXTENSIVE); AddTestCase (new LteX2HandoverTestCase ( 3, 0, hel5, hel5name, true, *schedIt, true, useIdealRrc), TestCase::EXTENSIVE); AddTestCase (new LteX2HandoverTestCase ( 3, 1, hel5, hel5name, true, *schedIt, true, useIdealRrc), TestCase::EXTENSIVE); AddTestCase (new LteX2HandoverTestCase ( 3, 2, hel5, hel5name, true, *schedIt, true, useIdealRrc), TestCase::QUICK); } } } static LteX2HandoverTestSuite g_lteX2HandoverTestSuiteInstance;
1ec26d904f409f2f74220946095b251b9ab360aa
3fd42c9e70e4b3a569902613df5295d969b596df
/huzzah-esp8266-wifi/Home-Automation/JeeNode-RF12B_SoladinNode/JeeNode-RF12B_SoladinNode.ino
9f34156d2e2d952691454dc32b9c7d136a96f547
[]
no_license
tdamdouni/AdaBox-Projects
8dbbab1e47ebc1a7fb447ec9c2e7f99f55ffa6e7
ea5a83592baf7484f17ccffd849fd63184e167f8
refs/heads/master
2018-09-06T19:55:48.667134
2018-08-26T14:24:57
2018-08-26T14:24:57
103,637,655
6
0
null
null
null
null
UTF-8
C++
false
false
8,302
ino
// Soladin Node, talks to Soladin 600 Inverter #include <JeeLib.h> #include <avr/sleep.h> #include <PortsLCD.h> #include <Soladin.h> #include <SoftwareSerial.h> #define SERIAL 1 // set to 1 to also report readings on the serial port #define MEASURE_PERIOD 10 // how often to measure, in tenths of seconds #define RETRY_PERIOD 10 // how soon to retry if ACK didn't come in #define RETRY_LIMIT 5 // maximum number of times to retry #define ACK_TIME 10 // number of milliseconds to wait for an ack #define REPORT_EVERY 5 // report every N measurement cycles // set the sync mode to 2 if the fuses are still the Arduino default // mode 3 (full powerdown) can only be used with 258 CK startup fuses #define RADIO_SYNC_MODE 2 // The scheduler makes it easy to perform various tasks at various times: enum { MEASURE, REPORT, TASK_END }; static word schedbuf[TASK_END]; Scheduler scheduler (schedbuf, TASK_END); // Other variables used in various places in the code: static byte reportCount; // count up until next report, i.e. packet send #define MYNODE 11 //Should be unique on network, node ID 30 reserved for base station #define freq RF12_868MHZ //frequency - match to same frequency as RFM12B module (change to 868Mhz or 915Mhz if appropriate) #define group 30 //network group, must be same as emonTx and emonBase // This defines the structure of the packets which get sent out by wireless: typedef struct { byte NodeType; // NodeType &H?? = Soladin Node int PVvolt; int PVamp; int ACgridPower; int ACgridFreq; int ACgridVolt; int DeviceTemp; int AlarmFlag; int TotalPower; int TotalOperationTime; byte lobat :1; // supply voltage dropped under 3.1V: 0..1 } PayloadSoladin; PayloadSoladin soladin; // has to be defined because we're using the watchdog for low-power waiting ISR(WDT_vect) { Sleepy::watchdogEvent(); } PortI2C myI2C (1); // LCD Port 1 LiquidCrystalI2C lcd (myI2C); SoftwareSerial solcom(5, 6); // serial to conect to soladin (DIO3 RX, DIO2 TX) Soladin sol; // copy of soladin class boolean connect = 0 ; // if soladin respons static void doMeasure(){ sol.PVvolt = 0; sol.PVamp = 0; sol.Gridpower = 0; sol.Gridfreq = 0; sol.Gridvolt = 0; sol.DeviceTemp = 0; sol.Flag = 0; sol.Totalpower = 0; sol.TotalOperaTime = 0; doDS(); soladin.NodeType = 0x16; soladin.PVvolt = sol.PVvolt; soladin.PVamp = sol.PVamp; soladin.ACgridPower = sol.Gridpower; soladin.ACgridFreq = sol.Gridfreq; soladin.ACgridVolt = sol.Gridvolt; soladin.DeviceTemp = sol.DeviceTemp; soladin.AlarmFlag = sol.Flag; soladin.TotalPower = sol.Totalpower; soladin.TotalOperationTime = sol.TotalOperaTime; soladin.lobat = rf12_lowbat(); lcd.setCursor(0, 1); lcd.print("PV: "); if((float(sol.PVvolt)/10) < 100){ lcd.print("0"); } if((float(sol.PVvolt)/10) < 10){ lcd.print("0"); } lcd.print(float(sol.PVvolt)/10); lcd.print("V "); lcd.print(float(sol.PVamp)/100); lcd.print("A"); lcd.setCursor(0, 2); lcd.print("AC: "); lcd.print(sol.Gridvolt); lcd.print("V "); lcd.print(float(sol.Gridfreq)/100); lcd.print("Hz"); lcd.setCursor(0, 3); lcd.print("Power: "); if(sol.Gridpower < 100){ lcd.print("0"); } if(sol.Gridpower < 10){ lcd.print("0"); } lcd.print(sol.Gridpower); lcd.print(" Watt "); lcd.setCursor(17, 0); if(sol.DeviceTemp < 10){ lcd.print("0"); } lcd.print(sol.DeviceTemp); lcd.print("C"); } static void serialFlush() { #if ARDUINO >= 100 Serial.flush(); #endif delay(2); // make sure tx buf is empty before going back to sleep } // periodic report, i.e. send out a packet and optionally report on serial port static void doReport() { rf12_sleep(RF12_WAKEUP); while (!rf12_canSend()) rf12_recvDone(); rf12_sendStart(0, &soladin, sizeof soladin, RADIO_SYNC_MODE); rf12_sleep(RF12_SLEEP); Serial.println("Sending Report"); #if SERIAL SPrintDS(); serialFlush(); #endif } void setup() { rf12_initialize(MYNODE, freq,group); Serial.begin(57600); Serial.print("[Soladin Node #"); Serial.print(MYNODE); Serial.println("]"); serialFlush(); solcom.begin(9600); sol.begin(&solcom); lcd.backlight(); // set up the LCD's number of rows and columns: lcd.begin(20, 4); // Print a message to the LCD. lcd.setCursor(0, 0); lcd.print("Soladin Node #"); lcd.print(MYNODE); rf12_sleep(RF12_SLEEP); // power down reportCount = REPORT_EVERY; // report right away for easy debugging scheduler.timer(MEASURE, 0); // start the measurement loop going } void loop() { if (!connect) { // Try to connect Serial.print("Soladin 600"); for (int i=0 ; i < 4 ; i++) { if (sol.query(PRB)) { // Try connecting to slave connect = true; Serial.println("...Connected"); doFW(); delay(1000); SPrintFW(); break; } Serial.print("."); delay(1000); } } switch (scheduler.pollWaiting()) { case MEASURE: // reschedule these measurements periodically scheduler.timer(MEASURE, MEASURE_PERIOD); doMeasure(); // every so often, a report needs to be sent out if (++reportCount >= REPORT_EVERY) { reportCount = 0; scheduler.timer(REPORT, 0); } break; case REPORT: doReport(); break; } } void doFW(){ if (connect) { // already connected for (int i=0 ; i < 4 ; i++) { // give me some time to return by hand if (sol.query(FWI)) { // request firware information break; } } } } void doDS(){ if (connect) { for (int i=0 ; i < 4 ; i++) { if (sol.query(DVS)) { // request Device status break; } } } } void SPrintFW() { Serial.print("FW ID= "); Serial.println(byte(sol.FW_ID),HEX); Serial.print("Ver= "); Serial.println(word(sol.FW_version),HEX); Serial.print("Date= "); Serial.println(word(sol.FW_date),HEX); Serial.println(); } void SPrintDS() { Serial.print("PV= "); Serial.print(float(sol.PVvolt)/10); Serial.print("V; "); Serial.print(float(sol.PVamp)/100); Serial.println("A"); Serial.print("AC= "); Serial.print(sol.Gridpower); Serial.print("W; "); Serial.print(float(sol.Gridfreq)/100); Serial.print("Hz; "); Serial.print(sol.Gridvolt); Serial.println("Volt"); Serial.print("Device Temperature= "); Serial.print(sol.DeviceTemp); Serial.println(" Celcius"); Serial.print("AlarmFlag= "); Serial.println(sol.Flag,BIN); Serial.print("Total Power= "); Serial.print(float(sol.Totalpower)/100); Serial.println("kWh"); // I really don't know, wy i must split the sprintf ? Serial.print("Total Operating time= "); char timeStr[14]; sprintf(timeStr, "%04d:",(sol.TotalOperaTime/60)); Serial.print(timeStr); sprintf(timeStr, "%02d hh:mm ", (sol.TotalOperaTime%60)); Serial.println(timeStr); Serial.println(); if (sol.Flag != 0x00) { // Print error flags SPrintflag(); } } void SPrintflag(){ if ( sol.Flag & 0x0001 ){ Serial.println("Usolar too high"); } if( sol.Flag & 0x0002 ){ Serial.println("Usolar too low"); } if( sol.Flag & 0x0004 ){ Serial.println("No Grid"); } if( sol.Flag & 0x0008 ){ Serial.println("Uac too high"); } if( sol.Flag & 0x0010 ){ Serial.println("Uac too low"); } if( sol.Flag & 0x0020 ){ Serial.println("Fac too high"); } if( sol.Flag & 0x0040 ){ Serial.println("Fac too low"); } if( sol.Flag & 0x0080 ){ Serial.println("Temperature to high"); } if( sol.Flag & 0x0100 ){ Serial.println("Hardware failure"); } if( sol.Flag & 0x0200 ){ Serial.println("Starting"); } if( sol.Flag & 0x0400 ){ Serial.println("Max Power"); } if( sol.Flag & 0x0800 ){ Serial.println("Max current"); } }
b0041319311d23cf3a44edca82b51fdb64c8f276
9ebd43420bf045a5978d860d8d191dff72c8ba61
/StableMarriages/main.cpp
002f83873ba3066ff6f3973b63134ae8c655fb9f
[]
no_license
sbbzplt/StableMarriages
ffefc7a570c918f50ec8f43fb9c7f953bebb66a7
de47bb7b688f5d6f3acbf4a7945350f6caae3e7c
refs/heads/master
2021-08-29T12:20:01.794543
2017-12-13T23:59:31
2017-12-13T23:59:31
113,928,471
0
0
null
null
null
null
UTF-8
C++
false
false
3,724
cpp
#include "classes.h" int main() { Man Ali; Man Veli; Man Ahmet; Man Mehmet; Woman Ayse; Woman Fatma; Woman Zeynep; Woman Kadriye; bool isAllEngaged = false; int population = 3; std::vector<Man>::iterator itm; std::vector<Woman>::iterator itw; Ali.setName("Ali"); Veli.setName("Veli"); Ahmet.setName("Ahmet"); Mehmet.setName("Mehmet"); Ayse.setName("Ayse"); Fatma.setName("Fatma"); Zeynep.setName("Zeynep"); Kadriye.setName("Kadriye"); // Testing the operator overloading "==" std::cout << (Ayse == Fatma) << std::endl; std::cout << (Zeynep == Zeynep) << std::endl; std::cout << (Mehmet == Ali) << std::endl; std::cout << (Ahmet == Ahmet) << std::endl; int a; std::cin >> a; Ali.setPrefList(Ayse); Ali.setPrefList(Zeynep); Ali.setPrefList(Kadriye); Ali.setPrefList(Fatma); std::vector<Woman> womanList = Ali.getPrefList(); Veli.setPrefList(Zeynep); Veli.setPrefList(Fatma); Veli.setPrefList(Kadriye); Veli.setPrefList(Ayse); Ahmet.setPrefList(Kadriye); Ahmet.setPrefList(Ayse); Ahmet.setPrefList(Zeynep); Ahmet.setPrefList(Fatma); Mehmet.setPrefList(Ayse); Mehmet.setPrefList(Kadriye); Mehmet.setPrefList(Zeynep); Mehmet.setPrefList(Fatma); Ayse.setPrefList(Ahmet); Ayse.setPrefList(Veli); Ayse.setPrefList(Ali); Ayse.setPrefList(Mehmet); std::vector<Man> manList = Ayse.getPrefList(); Fatma.setPrefList(Veli); Fatma.setPrefList(Mehmet); Fatma.setPrefList(Ahmet); Fatma.setPrefList(Ali); Zeynep.setPrefList(Ahmet); Zeynep.setPrefList(Mehmet); Zeynep.setPrefList(Ali); Zeynep.setPrefList(Veli); Kadriye.setPrefList(Ali); Kadriye.setPrefList(Veli); Kadriye.setPrefList(Mehmet); Kadriye.setPrefList(Ahmet); while (!isAllEngaged) { // Every morning, women in the village left a message on their the (next-)best choices. for (itw = womanList.begin(); itw != womanList.end(); ++itw) { Woman woman = *itw; bool st = woman.getStatus(); std::cout << woman.getName() << " " << st << std::endl; if (!st) { size_t round = woman.getRound(); std::vector<Man> prefList = woman.getPrefList(); Man nextOnTheList = prefList.at(round); nextOnTheList.setMessageBox(woman); ++round; woman.setRound(round); } } // Every afternoon men check their message box and reply according to their preference list. for (itm = manList.begin(); itm != manList.end(); ++itm) { Man man = *itm; std::vector<Woman> messageBox = man.getMessageBox(); if (messageBox.size() != 0) { std::vector<Woman> prefList = man.getPrefList(); bool st = man.getStatus(); if (!st) { // Kendine teklif getiren kizlara bakacak. Listede kendi nisanlisindan daha ustte biri varsa nisan atip yeni adayla nisanlanacak. } else { // Kendine teklif getiren kizlara bakacak. Listede en ust siradaki adayla nisanlanacak. for (itw = messageBox.begin(); itw != messageBox.end(); ++itw) { Woman woman = *itw; int pos1 = std::find(messageBox.begin(), messageBox.end(), woman) - messageBox.begin(); } man.setStatus(true); } } } // Checking marital status of the village at the end of the day. int numOfCouples = 0; for (itm = manList.begin(); itm != manList.end(); ++itm) { Man man = *itm; bool st = man.getStatus(); std::cout << man.getName() << " " << st << std::endl; if (st) { ++numOfCouples; } } if (numOfCouples == population) { isAllEngaged = true; } std::cout << numOfCouples << std::endl; } //std::cout << Ali.getName(); //std::cout << Veli.getName(); //std::cout << Hasan.getName(); //std::cout << Ayse.getName(); //std::cout << Fatma.getName(); //std::cout << Hayriye.getName(); return 0; }
cec2c0b1bd8b2289c2f066e9298a9ee62340b73c
982b41f148a368fe31bb6963a8b2d105e009954e
/Common/Sources/Components/MeshRender/mesh_render.cpp
b571700670fc0aabc3fe21970f928e0c927cbfaf
[]
no_license
Dunder-Muffin/RayTracingGPU
2647590c20373a7811e8fafa3de848b96c04e8cb
ded50307dd01857da3e71a7d8905c5a3a1ff533f
refs/heads/main
2023-08-02T19:18:34.490592
2021-10-01T19:43:08
2021-10-01T19:43:08
354,262,198
2
0
null
null
null
null
UTF-8
C++
false
false
5,103
cpp
/* #include "mesh_render.h" #include "GameObject/game_object.h" MeshRender::MeshRender(MeshPtr mesh_ptr, MaterialPtr materail_ptr, const Shader& shader): mesh(mesh_ptr), material(materail_ptr), shader(shader) { } void MeshRender::render(const Camera& mainCam, const DirectionLight& light, bool wire_frame) { render(game_object()->get_component<Transform>(), mainCam, light, wire_frame); } void MeshRender::render(const Transform *transform, const Camera& mainCam, const DirectionLight& light, bool wire_frame) { shader.use(); light.bind_to_shader(shader); mainCam.set_to_shader(shader); material->bind_to_shader(shader); if (transform) transform->set_to_shader(shader); mesh->render(wire_frame); material->unbind_to_shader(shader); light.unbind_to_shader(shader); } MaterialPtr MeshRender::get_material() const { return material; } const Shader& MeshRender::get_shader() const { return shader; } Shader& MeshRender::get_shader() { return shader; } shared_ptr<MeshRender> create_plane(bool create_uv) { static MeshPtr uvMesh = nullptr; static MeshPtr notUvMesh = nullptr; if (!uvMesh || !notUvMesh) { vector<vec3> vertices = {vec3(-1,0,-1), vec3(1,0,-1), vec3(1,0,1), vec3(-1,0,1)}; vector<vec3> normals(4, vec3(0,1,0)); vector<uint> indices = {0,1,2,0,2,3}; vector<vec2> uv = {vec2(0,0), vec2(1,0), vec2(1,1),vec2(0,1)}; uvMesh = make_mesh(VertexArrayObject(indices, vertices, normals, uv)); notUvMesh = make_mesh(VertexArrayObject(indices, vertices, normals)); } MaterialPtr material = create_uv ? standart_textured_material(nullptr): standart_material(); MeshPtr mesh = create_uv ? uvMesh : notUvMesh; return make_shared<MeshRender>(mesh, material, create_uv ? get_shader("standart_normal_uv") : get_shader("standart_normal")); } shared_ptr<MeshRender> create_cube(bool create_uv) { static MeshPtr uvMesh = nullptr; static MeshPtr notUvMesh = nullptr; if (!uvMesh || !notUvMesh) { vector<uint> indices; vector<vec3> vertices, normals; vector<vec2> uv; for (int face = 0; face < 3; face++) { for (int d = -1; d <= 1; d += 2) { vec3 norm = vec3(); norm[face] = d; int ind = vertices.size(); float a = -1, b = -1, ta, tb; for (int i = 0; i < 4; i++) { vec3 v; v[face] = d; v[(face + 1) % 3] = a; v[(face + 2) % 3] = b; vec2 u; if (face != 1) { u.x = (v.x + v.z - d + 1.f) * 0.5f; if ((d < 0) ^ (face == 0)) u.x = 1.f - u.x; u.y = 1.f - (v.y + 1.f) * 0.5f; } else { u = (vec2(a,b) + vec2(1.f))*0.5f; } ta = -b * d; tb = a * d; a = ta; b = tb; vertices.push_back(v); normals.push_back(norm); uv.push_back(u); } indices.push_back(ind); indices.push_back(ind + 2);indices.push_back(ind + 1); indices.push_back(ind); indices.push_back(ind + 3); indices.push_back(ind + 2); } } uvMesh = make_mesh(VertexArrayObject(indices, vertices, normals, uv)); notUvMesh = make_mesh(VertexArrayObject(indices, vertices, normals)); } MaterialPtr material = create_uv ? standart_textured_material(nullptr): standart_material(); MeshPtr mesh = create_uv ? uvMesh : notUvMesh; return make_shared<MeshRender>(mesh, material, create_uv ? get_shader("standart_normal_uv") : get_shader("standart_normal")); } shared_ptr<MeshRender> create_sphere(int detailed, bool smooth, bool create_uv) { detailed = glm::clamp(detailed, 1, 20); int t = (int)smooth; t = t * 2 + (int)create_uv; t = t + detailed * 4; static map<int, MeshPtr> spheres; MeshPtr mesh; if (spheres[t] != nullptr) mesh = spheres[t]; else { int n = detailed + 2; int m = detailed + 2; vector<uint> indices; vector<vec3> vertices, normals; vector<vec2> uv; for (int i = 0; i <= n; i++) for (int j = 0; j <= m; j++) { float u = (1.f * i / m); float v = (1.f * j / n); float b = u * PI * 2; float a = (v - 0.5f) * PI; float x = cos(a) * cos(b); float z = cos(a) * sin(b); float y = sin(a); vec3 p = vec3(x, y, z); vertices.push_back(p); normals.push_back(p); uv.push_back(vec2(u, 1.f - v)); } for (int i = 0; i < n; i++) for (int j = 0; j < m; j++) { int a = i * (n + 1) + j; int b = a + 1; int c = a + n + 1; int d = c + 1; indices.push_back(a); indices.push_back(d); indices.push_back(b); indices.push_back(a); indices.push_back(c); indices.push_back(d); } mesh = spheres[t] = make_mesh(VertexArrayObject(indices, vertices, normals, uv)); } MaterialPtr material = create_uv ? standart_textured_material(nullptr): standart_material(); return make_shared<MeshRender>(mesh, material, create_uv ? get_shader("standart_normal_uv") : get_shader("standart_normal")); }*/
7ade3a27f2ab9124cce6727e49dd6675ad330483
089e059887c75eea1111aa8c66f7623591ed549d
/Cherenkov/src/Cherenkov/Core/Layer.cpp
74e2d738d1f1fd684ec7cf1245db8188b84b04cb
[ "Apache-2.0" ]
permissive
CalSeedy/Cherenkov-Engine
2dcc6ba1b7f2acfdd110b8a949f25f9e93a25579
d6d95feae207a9a4a10fef521768943c6b891025
refs/heads/master
2022-01-12T17:17:19.748561
2021-08-19T23:45:26
2021-08-19T23:46:10
162,950,314
0
0
null
null
null
null
UTF-8
C++
false
false
145
cpp
#include "ckpch.h" #include "Cherenkov/Core/Layer.h" namespace Cherenkov { Layer::Layer(const std::string &name) : m_DebugName(name) { } }
f9525a44a58323bca1e73a1a8f5aed8e8c691982
5964055fde04aabffa758318ffd1af82a81a570a
/VerrevEngine2D/CUICheckbox.cpp
1078bc2b6115ce88d51d17be97f31cc5f6791ced
[]
no_license
verrev/VerrevEngine2D
b3a52c0ab72de81e597f9a7e4f6ddd6466d3614d
4f4be3c666bcafc5f970609382e470330d8504b7
refs/heads/master
2021-03-12T23:04:20.587911
2015-08-20T21:22:14
2015-08-20T21:22:14
41,119,442
0
0
null
null
null
null
UTF-8
C++
false
false
1,115
cpp
#include "CUICheckbox.h" #include "CInput.h" void CUICheckBox::init(CD2DRenderer *r, UI_ELEMENT_DESC *desc) { UI_CHECKBOX_DESC *d = reinterpret_cast<UI_CHECKBOX_DESC*>(desc); mRenderer = r; id = d->id; mX = d->x; mY = d->y; mSize = d->size; mIsChecked = d->checked; mBrushName = "background-brush"; mBrushName += id; mCheckBrushName = "check-brush"; mCheckBrushName += id; mRenderer->addSolidBrush(mBrushName, d->backgroundColor); mRenderer->addSolidBrush(mCheckBrushName, d->checkColor); } bool CUICheckBox::isCursorInBounds(const int &x, const int &y) { return x >= mX && x <= mX + mSize && y >= mY && y <= mY + mSize; } void CUICheckBox::draw() { mRenderer->fillRect(mX, mY, mSize, mSize, mBrushName); if (mIsChecked) { float f = mSize / 8; mRenderer->fillRect(mX + f, mY + f, mSize - 2 * f, mSize - 2 * f, mCheckBrushName); } } void CUICheckBox::notify(CSubject *subject) { CInput *i = static_cast<CInput*>(subject); if (i->mKeys[VK_LBUTTON]) { if (isCursorInBounds(i->mX, i->mY) && !mStillDown) { mStillDown = 1; mIsChecked = !mIsChecked; } } else { mStillDown = 0; } }
5e4d606d48336177c1f071e3b09cff71d1a1520c
94dd226d343480e0fa55e2a6ee59089eef211ece
/arduino_sketches/nes_turbo_delay/nes_turbo_delay.ino
dec18b381309030e267ff113c0319228b3222cdd
[]
no_license
facelesstech/nes2usb_adaptor
22b1f5f0929bb68629967f7ff2a20c0196b60bf8
b26335558533cac6d4359ce720ec7dbe55927d43
refs/heads/master
2022-06-19T19:58:39.088429
2018-03-17T15:14:48
2018-03-17T15:14:48
null
0
0
null
null
null
null
UTF-8
C++
false
false
4,157
ino
#include <NESpad.h> // https://github.com/joshmarinacci/nespad-arduino #include <Joystick.h> // https://github.com/MHeironimus/ArduinoJoystickLibrary/tree/version-1.0 // put your own strobe/clock/data pin numbers here -- see the pinout in readme.txt NESpad nintendo = NESpad(2,3,4); byte state = 0; int turboSwitch = 0; const int switchPin = 6; const int turboLedPin = 10; // the number of the LED pin /* A button gets marked as true as soon as it is pressed. That way we know to not "press" it again */ boolean a = false; //A Button boolean b = false; //B Button boolean u = false; //Up Button boolean d = false; //Down Button boolean l = false; //Left Button boolean r = false; //Right Button boolean s = false; //Start Button boolean e = false; //Select Button void setup() { Joystick.begin(); pinMode(switchPin, INPUT_PULLUP); pinMode(turboLedPin, OUTPUT); } void loop() { turboSwitch = digitalRead(switchPin); delay(5); state = nintendo.buttons(); if (turboSwitch == HIGH) { digitalWrite(turboLedPin, HIGH); // A if (state & NES_A) { if(!a) { Joystick.pressButton(0); delay(20); Joystick.releaseButton(0); } } // B if (state & NES_B) { if(!b) { Joystick.pressButton(1); delay(20); Joystick.releaseButton(1); } } } else { digitalWrite(turboLedPin, LOW); // A if (state & NES_A) { if(!a) { a = true; //Make sure the button is only pressed once Joystick.pressButton(0); } } //Key might have been released so we check and if so change the //value in our released array else if (a == true) { a = false; Joystick.releaseButton(0); } // B if (state & NES_B) { if(!b) { b = true; //Make sure the button is only pressed once Joystick.pressButton(1); } } //Key might have been released so we check and if so change the //value in our released array else if (b == true) { b = false; Joystick.releaseButton(1); } } // Up if (state & NES_UP) { if(!u) { u = true; //Make sure the button is only pressed once Joystick.pressButton(2); } } //Key might have been released so we check and if so change the //value in our released array else if (u == true) { u = false; Joystick.releaseButton(2); } // Down if (state & NES_DOWN) { if(!d) { d = true; //Make sure the button is only pressed once Joystick.pressButton(3); } } //Key might have been released so we check and if so change the //value in our released array else if (d == true) { d = false; Joystick.releaseButton(3); } // Left if (state & NES_LEFT) { if(!l) { l = true; //Make sure the button is only pressed once Joystick.pressButton(4); } } //Key might have been released so we check and if so change the //value in our released array else if (l == true) { l = false; Joystick.releaseButton(4); } //Right if (state & NES_RIGHT) { if(!r) { r = true; //Make sure the button is only pressed once Joystick.pressButton(5); } } //Key might have been released so we check and if so change the //value in our released array else if (r == true) { r = false; Joystick.releaseButton(5); } //Start if (state & NES_START) { if(!s) { s = true; //Make sure the button is only pressed once Joystick.pressButton(6); } } //Key might have been released so we check and if so change the //value in our released array else if (s == true) { s = false; Joystick.releaseButton(6); } //Select if (state & NES_SELECT) { if(!e) { e = true; //Make sure the button is only pressed once Joystick.pressButton(7); } } //Key might have been released so we check and if so change the //value in our released array else if (e == true) { e = false; Joystick.releaseButton(7); } }
27582d3bbebb5dbaba991a0bad8bea16a6eb7f48
a597f0c1b2ed98cc216d947a49244e1b3ee88fd9
/libEyeRenderer3/cameras/PerspectiveCamera.cpp
12b12d53caa9139da0085f5c26723a6679ee4b41
[ "MIT" ]
permissive
alexdewar/eye-renderer
fbde1b7a0135859901fb565e10f7e8af110102fa
f8fd621d5ab398013c7654b5f6581844a74f6aee
refs/heads/master
2023-08-30T06:38:05.266059
2021-11-07T11:59:10
2021-11-07T11:59:10
null
0
0
null
null
null
null
UTF-8
C++
false
false
981
cpp
#include "PerspectiveCamera.h" PerspectiveCamera::PerspectiveCamera(const std::string name) : DataRecordCamera<PerspectiveCameraData>(name) { // Set the scale of the perspective camera specializedData.scale = make_float3(10.0f, 10.0f, 1.0f); } PerspectiveCamera::~PerspectiveCamera() { } void PerspectiveCamera::setXFOV(float xFOV) { xFOV = fromDegrees(xFOV); specializedData.scale.x = tan(xFOV/2.0f) * specializedData.scale.z; specializedData.scale.y = specializedData.scale.y/aspectRatio; } void PerspectiveCamera::setYFOV(float yFOV) { yFOV = fromDegrees(yFOV); specializedData.scale.y = tan(yFOV/2.0f) * specializedData.scale.z; specializedData.scale.x = specializedData.scale.y * aspectRatio; } void PerspectiveCamera::setAspectRatio(float r) { aspectRatio = r; float previousYfov = atan(specializedData.scale.y/specializedData.scale.z)*2.0f; setYFOV(previousYfov); } inline float PerspectiveCamera::fromDegrees(float d) { return (d/180 * M_PIf); }
c913dde7dad9a7b952daba9c6d178355d3031257
df6976abd47d8538d75da966bfda6ca58abe8ca0
/src/storage_device.cpp
5d4cf922e64ff5810797005baa5481799103c0b1
[ "BSD-3-Clause" ]
permissive
aruna-datti/wlan-cloud-ucentralgw
0b01ddcd5b8d1542da22af7fc00fdbb6587e08c7
0fa0af3159e374761465129d2f2f1e30b80ab2bf
refs/heads/master
2023-08-02T13:34:46.643992
2021-09-21T17:02:03
2021-09-21T17:02:03
null
0
0
null
null
null
null
UTF-8
C++
false
false
26,493
cpp
// // License type: BSD 3-Clause License // License copy: https://github.com/Telecominfraproject/wlan-cloud-ucentralgw/blob/master/LICENSE // // Created by Stephane Bourque on 2021-03-04. // Arilia Wireless Inc. // #include "Poco/Data/RecordSet.h" #include "CentralConfig.h" #include "StorageService.h" #include "Utils.h" #include "RESTAPI_utils.h" #include "Daemon.h" #include "DeviceRegistry.h" #include "OUIServer.h" #include "StateProcessor.h" #include "SerialNumberCache.h" namespace OpenWifi { bool Storage::GetDeviceCount(uint64_t &Count) { try { Poco::Data::Session Sess = Pool_->get(); Poco::Data::Statement Select(Sess); std::string st{"SELECT COUNT(*) FROM Devices"}; Select << st , Poco::Data::Keywords::into(Count); Select.execute(); return true; } catch(const Poco::Exception & E) { Logger_.log(E); } return false; } bool Storage::GetDeviceSerialNumbers(uint64_t From, uint64_t HowMany, std::vector<std::string> &SerialNumbers) { try { Poco::Data::Session Sess = Pool_->get(); Poco::Data::Statement Select(Sess); std::string st{"SELECT SerialNumber From Devices ORDER BY SerialNumber ASC " }; Select << st + ComputeRange(From, HowMany), Poco::Data::Keywords::into(SerialNumbers); Select.execute(); return true; } catch (const Poco::Exception &E ) { Logger_.log(E); } return false; } bool Storage::UpdateDeviceConfiguration(std::string &SerialNumber, std::string &Configuration, uint64_t &NewUUID) { try { Config::Config Cfg(Configuration); if (!Cfg.Valid()) { Logger_.warning(Poco::format("CONFIG-UPDATE(%s): Configuration was not valid", SerialNumber)); return false; } Poco::Data::Session Sess = Pool_->get(); Poco::Data::Statement Select(Sess); uint64_t CurrentUUID; std::string St{"SELECT UUID FROM Devices WHERE SerialNumber=?"}; Select << ConvertParams(St), Poco::Data::Keywords::into(CurrentUUID), Poco::Data::Keywords::use(SerialNumber); Select.execute(); uint64_t Now = time(nullptr); NewUUID = CurrentUUID==Now ? Now + 1 : Now; if (Cfg.SetUUID(NewUUID)) { std::string NewConfig = Cfg.get(); Poco::Data::Statement Update(Sess); std::string St2{"UPDATE Devices SET Configuration=? , UUID=?, LastConfigurationChange=? WHERE SerialNumber=?"}; Update << ConvertParams(St2), Poco::Data::Keywords::use(NewConfig), Poco::Data::Keywords::use(NewUUID), Poco::Data::Keywords::use(Now), Poco::Data::Keywords::use(SerialNumber); Update.execute(); Logger_.information(Poco::format("CONFIG-UPDATE(%s): UUID is %Lu", SerialNumber, NewUUID)); Configuration = NewConfig; return true; } return false; } catch (const Poco::Exception &E) { Logger_.warning( Poco::format("%s(%s): Failed with: %s", std::string(__func__), SerialNumber, E.displayText())); } return false; } bool Storage::CreateDevice(GWObjects::Device &DeviceDetails) { // std::lock_guard<std::mutex> guard(Mutex_); std::string SerialNumber; try { Poco::Data::Session Sess = Pool_->get(); Poco::Data::Statement Select(Sess); std::string St{"SELECT SerialNumber FROM Devices WHERE SerialNumber=?"}; Select << ConvertParams(St), Poco::Data::Keywords::into(SerialNumber), Poco::Data::Keywords::use(DeviceDetails.SerialNumber); Select.execute(); if (SerialNumber.empty()) { Config::Config Cfg(DeviceDetails.Configuration); if (Cfg.Valid() && Cfg.SetUUID(DeviceDetails.UUID)) { DeviceDetails.Configuration = Cfg.get(); uint64_t Now = time(nullptr); Poco::Data::Statement Insert(Sess); std::string St2{"INSERT INTO Devices (" "SerialNumber," "DeviceType, " "MACAddress, " "Manufacturer, " "Configuration, " "Notes, " "Owner, " "Location, " "Firmware," "Compatible," "FWUpdatePolicy," "UUID, " "CreationTimestamp, " "LastConfigurationChange, " "LastConfigurationDownload, " "LastFWUpdate, " "Venue " ")" "VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"}; auto NotesString = RESTAPI_utils::to_string(DeviceDetails.Notes); Insert << ConvertParams(St2), Poco::Data::Keywords::use(DeviceDetails.SerialNumber), Poco::Data::Keywords::use(DeviceDetails.DeviceType), Poco::Data::Keywords::use(DeviceDetails.MACAddress), Poco::Data::Keywords::use(DeviceDetails.Manufacturer), Poco::Data::Keywords::use(DeviceDetails.Configuration), Poco::Data::Keywords::use(NotesString), Poco::Data::Keywords::use(DeviceDetails.Owner), Poco::Data::Keywords::use(DeviceDetails.Location), Poco::Data::Keywords::use(DeviceDetails.Firmware), Poco::Data::Keywords::use(DeviceDetails.Compatible), Poco::Data::Keywords::use(DeviceDetails.FWUpdatePolicy), Poco::Data::Keywords::use(DeviceDetails.UUID), Poco::Data::Keywords::use(Now), Poco::Data::Keywords::use(Now), Poco::Data::Keywords::use(Now), Poco::Data::Keywords::use(Now), Poco::Data::Keywords::use(DeviceDetails.Venue); Insert.execute(); SerialNumberCache()->AddSerialNumber(DeviceDetails.SerialNumber); return true; } else { Logger_.warning("Cannot create device: invalid configuration."); return false; } } } catch (const Poco::Exception &E) { Logger_.warning( Poco::format("%s(%s): Failed with: %s", std::string(__func__), SerialNumber, E.displayText())); } return false; } bool Storage::CreateDefaultDevice(const std::string &SerialNumber, const std::string &Capabilities, std::string & Firmware, std::string &Compat) { GWObjects::Device D; Logger_.information(Poco::format("AUTO-CREATION(%s)", SerialNumber)); uint64_t Now = time(nullptr); Config::Capabilities Caps(Capabilities); GWObjects::DefaultConfiguration DefConfig; if (FindDefaultConfigurationForModel(Caps.Model(), DefConfig)) { Config::Config NewConfig(DefConfig.Configuration); NewConfig.SetUUID(Now); D.Configuration = NewConfig.get(); } else { Config::Config NewConfig; NewConfig.SetUUID(Now); D.Configuration = NewConfig.get(); } D.SerialNumber = Poco::toLower(SerialNumber); Compat = D.Compatible = Caps.Compatible(); D.DeviceType = Daemon()->IdentifyDevice(D.Compatible); D.MACAddress = Utils::SerialToMAC(SerialNumber); D.Manufacturer = Caps.Model(); D.Firmware = Firmware; D.UUID = Now; D.Notes = SecurityObjects::NoteInfoVec { SecurityObjects::NoteInfo{ (uint64_t)std::time(nullptr), "", "Auto-provisioned."}}; D.CreationTimestamp = D.LastConfigurationDownload = D.LastConfigurationChange = Now; return CreateDevice(D); } bool Storage::SetLocation(std::string & SerialNumber, std::string & LocationUUID) { try { Poco::Data::Session Sess = Pool_->get(); Poco::Data::Statement Update(Sess); std::string St{"UPDATE Devices SET Location=? WHERE SerialNumber=?"}; Update << ConvertParams(St) , Poco::Data::Keywords::use(LocationUUID), Poco::Data::Keywords::use(SerialNumber); Update.execute(); return true; } catch (const Poco::Exception &E) { Logger_.warning( Poco::format("%s(%s): Failed with: %s", std::string(__func__), SerialNumber, E.displayText())); } return false; } bool Storage::SetVenue(std::string & SerialNumber, std::string & VenueUUID) { try { Poco::Data::Session Sess = Pool_->get(); Poco::Data::Statement Update(Sess); std::string St{"UPDATE Devices SET Venue=? WHERE SerialNumber=?"}; Update << ConvertParams(St) , Poco::Data::Keywords::use(VenueUUID), Poco::Data::Keywords::use(SerialNumber); Update.execute(); return true; } catch (const Poco::Exception &E) { Logger_.warning( Poco::format("%s(%s): Failed with: %s", std::string(__func__), SerialNumber, E.displayText())); } return false; } bool Storage::GetDeviceFWUpdatePolicy(std::string &SerialNumber, std::string &Policy) { try { Poco::Data::Session Sess = Pool_->get(); Poco::Data::Statement Select(Sess); std::string St{"SELECT FWUpdatePolicy FROM Devices WHERE SerialNumber=?"}; Select << ConvertParams(St) , Poco::Data::Keywords::into(Policy), Poco::Data::Keywords::use(SerialNumber); Select.execute(); return true; } catch (const Poco::Exception &E) { Logger_.warning( Poco::format("%s(%s): Failed with: %s", std::string(__func__), SerialNumber, E.displayText())); } return false; } bool Storage::SetDevicePassword(std::string & SerialNumber, std::string & Password) { try { Poco::Data::Session Sess = Pool_->get(); Poco::Data::Statement Update(Sess); std::string St{"UPDATE Devices SET DevicePassword=? WHERE SerialNumber=?"}; Update << ConvertParams(St) , Poco::Data::Keywords::use(Password), Poco::Data::Keywords::use(SerialNumber); Update.execute(); return true; } catch (const Poco::Exception &E) { Logger_.warning( Poco::format("%s(%s): Failed with: %s", std::string(__func__), SerialNumber, E.displayText())); } return false; } bool Storage::SetOwner(std::string & SerialNumber, std::string & OwnerUUID) { try { Poco::Data::Session Sess = Pool_->get(); Poco::Data::Statement Update(Sess); std::string St{"UPDATE Devices SET Owner=? WHERE SerialNumber=?"}; Update << ConvertParams(St) , Poco::Data::Keywords::use(OwnerUUID), Poco::Data::Keywords::use(SerialNumber); Update.execute(); return true; } catch (const Poco::Exception &E) { Logger_.warning( Poco::format("%s(%s): Failed with: %s", std::string(__func__), SerialNumber, E.displayText())); } return false; } bool Storage::SetConnectInfo(std::string &SerialNumber, std::string &Firmware) { try { Poco::Data::Session Sess = Pool_->get(); Poco::Data::Statement Select(Sess); // Get the old version and if they do not match, set the last date std::string St{"SELECT Firmware FROM Devices WHERE SerialNumber=?"}; std::string TmpFirmware; Select << ConvertParams(St) , Poco::Data::Keywords::into(TmpFirmware), Poco::Data::Keywords::use(SerialNumber); Select.execute(); if(TmpFirmware != Firmware) { Poco::Data::Statement Update(Sess); std::string St2{"UPDATE Devices SET Firmware=?, LastFWUpdate=? WHERE SerialNumber=?"}; uint64_t Now = time(nullptr); Update << ConvertParams(St2), Poco::Data::Keywords::use(Firmware), Poco::Data::Keywords::use(Now), Poco::Data::Keywords::use(SerialNumber); Update.execute(); return true; } return true; } catch (const Poco::Exception &E) { Logger_.warning( Poco::format("%s(%s): Failed with: %s", std::string(__func__), SerialNumber, E.displayText())); } return false; } bool Storage::DeleteDevice(std::string &SerialNumber) { // std::lock_guard<std::mutex> guard(Mutex_); try { Poco::Data::Session Sess = Pool_->get(); Poco::Data::Statement Delete(Sess); std::string St{"DELETE FROM Devices WHERE SerialNumber=?"}; Delete << ConvertParams(St), Poco::Data::Keywords::use(SerialNumber); Delete.execute(); SerialNumberCache()->DeleteSerialNumber(SerialNumber); return true; } catch (const Poco::Exception &E) { Logger_.warning( Poco::format("%s(%s): Failed with: %s", std::string(__func__), SerialNumber, E.displayText())); } return false; } bool Storage::GetDevice(std::string &SerialNumber, GWObjects::Device &DeviceDetails) { // std::lock_guard<std::mutex> guard(Mutex_); try { Poco::Data::Session Sess = Pool_->get(); Poco::Data::Statement Select(Sess); std::string St{"SELECT " "SerialNumber," "DeviceType, " "MACAddress, " "Manufacturer, " "Configuration, " "Notes, " "Owner, " "Location, " "Firmware," "Compatible," "FWUpdatePolicy," "UUID, " "CreationTimestamp, " "LastConfigurationChange, " "LastConfigurationDownload, " "LastFWUpdate, " "Venue, " "DevicePassword " "FROM Devices WHERE SerialNumber=?"}; std::string NI; Select << ConvertParams(St), Poco::Data::Keywords::into(DeviceDetails.SerialNumber), Poco::Data::Keywords::into(DeviceDetails.DeviceType), Poco::Data::Keywords::into(DeviceDetails.MACAddress), Poco::Data::Keywords::into(DeviceDetails.Manufacturer), Poco::Data::Keywords::into(DeviceDetails.Configuration), Poco::Data::Keywords::into(NI), Poco::Data::Keywords::into(DeviceDetails.Owner), Poco::Data::Keywords::into(DeviceDetails.Location), Poco::Data::Keywords::into(DeviceDetails.Firmware), Poco::Data::Keywords::into(DeviceDetails.Compatible), Poco::Data::Keywords::into(DeviceDetails.FWUpdatePolicy), Poco::Data::Keywords::into(DeviceDetails.UUID), Poco::Data::Keywords::into(DeviceDetails.CreationTimestamp), Poco::Data::Keywords::into(DeviceDetails.LastConfigurationChange), Poco::Data::Keywords::into(DeviceDetails.LastConfigurationDownload), Poco::Data::Keywords::into(DeviceDetails.LastFWUpdate), Poco::Data::Keywords::into(DeviceDetails.Venue), Poco::Data::Keywords::into(DeviceDetails.DevicePassword), Poco::Data::Keywords::use(SerialNumber); Select.execute(); DeviceDetails.Notes = RESTAPI_utils::to_object_array<SecurityObjects::NoteInfo>(NI); if (DeviceDetails.SerialNumber.empty()) return false; return true; } catch (const Poco::Exception &E) { Logger_.warning( Poco::format("%s(%s): Failed with: %s", std::string(__func__), SerialNumber, E.displayText())); } return false; } bool Storage::DeviceExists(std::string &SerialNumber) { try { Poco::Data::Session Sess = Pool_->get(); Poco::Data::Statement Select(Sess); std::string Serial; std::string St{"SELECT SerialNumber FROM Devices WHERE SerialNumber=?"}; Select << ConvertParams(St), Poco::Data::Keywords::into(Serial), Poco::Data::Keywords::use(SerialNumber); Select.execute(); if (Serial.empty()) return false; return true; } catch (const Poco::Exception &E) { Logger_.warning( Poco::format("%s(%s): Failed with: %s", std::string(__func__), SerialNumber, E.displayText())); } return false; } bool Storage::GetDevicesWithoutFirmware(std::string &Compatible, std::string &Version, std::vector<std::string> &SerialNumbers) { try { Poco::Data::Session Sess = Pool_->get(); Poco::Data::Statement Select(Sess); std::string St{"SELECT SerialNumber FROM Devices WHERE Compatible=? AND Firmware!=?"}; Select << ConvertParams(St), Poco::Data::Keywords::into(SerialNumbers), Poco::Data::Keywords::use(Compatible), Poco::Data::Keywords::use(Version); Select.execute(); return true; } catch (const Poco::Exception &E) { Logger_.log(E); } return false; } bool Storage::UpdateDevice(GWObjects::Device &NewDeviceDetails) { try { Poco::Data::Session Sess = Pool_->get(); Poco::Data::Statement Update(Sess); GWObjects::Device ExistingDevice; if(!GetDevice(NewDeviceDetails.SerialNumber,ExistingDevice)) return false; uint64_t Now = std::time(nullptr); if(!NewDeviceDetails.DeviceType.empty()) ExistingDevice.DeviceType=NewDeviceDetails.DeviceType; if(!NewDeviceDetails.MACAddress.empty()) ExistingDevice.MACAddress=NewDeviceDetails.MACAddress; if(!NewDeviceDetails.FWUpdatePolicy.empty()) ExistingDevice.FWUpdatePolicy=NewDeviceDetails.FWUpdatePolicy; if(!NewDeviceDetails.DevicePassword.empty()) ExistingDevice.DevicePassword=NewDeviceDetails.DevicePassword; if(!NewDeviceDetails.Notes.empty()) { for(const auto &i:NewDeviceDetails.Notes) ExistingDevice.Notes.push_back(i); } std::string NotesString = RESTAPI_utils::to_string(ExistingDevice.Notes); std::string St2{"UPDATE Devices SET " "DeviceType=?, " "MACAddress=?, " "Manufacturer=?, " "Notes=?, " "Owner=?, " "Location=?, " "FWUpdatePolicy=?," "Venue=? " " WHERE SerialNumber=?"}; auto NI = RESTAPI_utils::to_string(ExistingDevice.Notes); Update << ConvertParams(St2), Poco::Data::Keywords::use(ExistingDevice.DeviceType), Poco::Data::Keywords::use(ExistingDevice.MACAddress), Poco::Data::Keywords::use(ExistingDevice.Manufacturer), Poco::Data::Keywords::use(NI), Poco::Data::Keywords::use(ExistingDevice.Owner), Poco::Data::Keywords::use(ExistingDevice.Location), Poco::Data::Keywords::use(ExistingDevice.FWUpdatePolicy), Poco::Data::Keywords::use(ExistingDevice.Venue), Poco::Data::Keywords::use(ExistingDevice.SerialNumber); Update.execute(); GetDevice(ExistingDevice.SerialNumber,NewDeviceDetails); return true; } catch (const Poco::Exception &E) { Logger_.warning(Poco::format("%s(%s): Failed with: %s", std::string(__func__), NewDeviceDetails.SerialNumber, E.displayText())); } return false; } bool Storage::GetDevices(uint64_t From, uint64_t HowMany, std::vector<GWObjects::Device> &Devices) { typedef Poco::Tuple< std::string, std::string, std::string, std::string, std::string, std::string, std::string, std::string, std::string, std::string, std::string, uint64_t, uint64_t, uint64_t, uint64_t, uint64_t, std::string, std::string > DeviceRecord; typedef std::vector<DeviceRecord> RecordList; RecordList Records; try { Poco::Data::Session Sess = Pool_->get(); Poco::Data::Statement Select(Sess); Select << "SELECT " "SerialNumber," "DeviceType, " "MACAddress, " "Manufacturer, " "Configuration, " "Notes, " "Owner, " "Location, " "Firmware," "Compatible," "FWUpdatePolicy," "UUID, " "CreationTimestamp, " "LastConfigurationChange, " "LastConfigurationDownload, " "LastFWUpdate, " "Venue, " "DevicePassword " "FROM Devices ORDER BY SerialNumber ASC " + ComputeRange(From, HowMany), Poco::Data::Keywords::into(Records); Select.execute(); for (auto i: Records) { SecurityObjects::NoteInfoVec NI; NI = RESTAPI_utils::to_object_array<SecurityObjects::NoteInfo>(i.get<5>()); GWObjects::Device R{ .SerialNumber = i.get<0>(), .DeviceType = i.get<1>(), .MACAddress = i.get<2>(), .Manufacturer = i.get<3>(), .Configuration = i.get<4>(), .Notes = NI, .Owner = i.get<6>(), .Location = i.get<7>(), .Firmware = i.get<8>(), .Compatible = i.get<9>(), .FWUpdatePolicy = i.get<10>(), .UUID = i.get<11>(), .CreationTimestamp = i.get<12>(), .LastConfigurationChange = i.get<13>(), .LastConfigurationDownload = i.get<14>(), .LastFWUpdate = i.get<15>(), .Venue = i.get<16>(), .DevicePassword = i.get<17>()}; Devices.push_back(R); } return true; } catch (const Poco::Exception &E) { Logger_.warning(Poco::format("%s: Failed with: %s", std::string(__func__), E.displayText())); } return false; } bool Storage::ExistingConfiguration(std::string &SerialNumber, uint64_t CurrentConfig, std::string &NewConfig, uint64_t & NewUUID) { // std::lock_guard<std::mutex> guard(Mutex_); std::string SS; try { Poco::Data::Session Sess = Pool_->get(); Poco::Data::Statement Select(Sess); uint64_t Now = time(nullptr); std::string St{"SELECT SerialNumber, UUID, Configuration FROM Devices WHERE SerialNumber=?"}; Select << ConvertParams(St), Poco::Data::Keywords::into(SS), Poco::Data::Keywords::into(NewUUID), Poco::Data::Keywords::into(NewConfig), Poco::Data::Keywords::use(SerialNumber); Select.execute(); if (SS.empty()) { // No configuration exists, so we should return false; } // Let's update the last downloaded time Poco::Data::Statement Update(Sess); std::string St2{"UPDATE Devices SET LastConfigurationDownload=? WHERE SerialNumber=?"}; Update << ConvertParams(St2), Poco::Data::Keywords::use(Now), Poco::Data::Keywords::use(SerialNumber); Update.execute(); return true; } catch (const Poco::Exception &E) { Logger_.warning( Poco::format("%s(%s): Failed with: %s", std::string(__func__), SerialNumber, E.displayText())); } return false; } bool Storage::SetDeviceCompatibility(std::string &SerialNumber, std::string &Compatible) { try { Poco::Data::Session Sess = Pool_->get(); Poco::Data::Statement Update(Sess); std::string st{"UPDATE Devices SET Compatible=? WHERE SerialNumber=?"}; Update << ConvertParams(st), Poco::Data::Keywords::use(Compatible), Poco::Data::Keywords::use(SerialNumber); Update.execute(); return true; } catch (const Poco::Exception &E) { Logger_.log(E); } return false; } bool Storage::UpdateSerialNumberCache() { try { Poco::Data::Session Sess = Pool_->get(); Poco::Data::Statement Select(Sess); Select << "SELECT SerialNumber FROM Devices"; Select.execute(); Poco::Data::RecordSet RSet(Select); bool More = RSet.moveFirst(); while(More) { auto SerialNumber = RSet[0].convert<std::string>(); SerialNumberCache()->AddSerialNumber(SerialNumber); More = RSet.moveNext(); } return true; } catch(const Poco::Exception &E) { Logger_.log(E); } return false; } static std::string ComputeCertificateTag( GWObjects::CertificateValidation V) { switch(V) { case GWObjects::NO_CERTIFICATE: return "no certificate"; case GWObjects::VALID_CERTIFICATE: return "non TIP certificate"; case GWObjects::MISMATCH_SERIAL: return "serial mismatch"; case GWObjects::VERIFIED: return "verified"; } return "unknown"; } static const uint64_t SECONDS_MONTH = 30*24*60*60; static const uint64_t SECONDS_WEEK = 7*24*60*60; static const uint64_t SECONDS_DAY = 1*24*60*60; static const uint64_t SECONDS_HOUR = 1*24*60*60; static std::string ComputeUpLastContactTag(uint64_t T1) { uint64_t T = T1 - std::time(nullptr); if( T>SECONDS_MONTH) return ">month"; if( T>SECONDS_WEEK) return ">week"; if( T>SECONDS_DAY) return ">day"; if( T>SECONDS_HOUR) return ">hour"; return "now"; } static std::string ComputeSanityTag(uint64_t T) { if( T==100) return "100%"; if( T>90) return ">90%"; if( T>60) return ">60%"; return "<60%"; } static std::string ComputeUpTimeTag(uint64_t T) { if( T>SECONDS_MONTH) return ">month"; if( T>SECONDS_WEEK) return ">week"; if( T>SECONDS_DAY) return ">day"; if( T>SECONDS_HOUR) return ">hour"; return "now"; } static std::string ComputeLoadTag(uint64_t T) { float V=100.0*((float)T/65536.0); if(V<5.0) return "< 5%"; if(V<25.0) return "< 25%"; if(V<50.0) return "< 50%"; if(V<75.0) return "< 75%"; return ">75%"; } static std::string ComputeFreeMemoryTag(uint64_t Free, uint64_t Total) { float V = 100.0 * ((float)Free/(float(Total))); if(V<5.0) return "< 5%"; if(V<25.0) return "< 25%"; if(V<50.0) return "< 50%"; if(V<75.0) return "< 75%"; return ">75%"; } int ChannelToBand(uint64_t C) { if(C>=1 && C<=16) return 2; return 5; } bool Storage::AnalyzeDevices(GWObjects::Dashboard &Dashboard) { try { Poco::Data::Session Sess = Pool_->get(); Poco::Data::Statement Select(Sess); Select << "SELECT SerialNumber, Compatible, Firmware FROM Devices"; Select.execute(); Poco::Data::RecordSet RSet(Select); bool More = RSet.moveFirst(); while(More) { Dashboard.numberOfDevices++; auto SerialNumber = RSet[0].convert<std::string>(); auto DeviceType = RSet[1].convert<std::string>(); auto Revision = RSet[2].convert<std::string>(); Types::UpdateCountedMap(Dashboard.vendors, OUIServer()->GetManufacturer(SerialNumber)); Types::UpdateCountedMap(Dashboard.deviceType, DeviceType); GWObjects::ConnectionState ConnState; if(DeviceRegistry()->GetState(SerialNumber, ConnState)) { Types::UpdateCountedMap(Dashboard.status, ConnState.Connected ? "connected" : "not connected"); Types::UpdateCountedMap(Dashboard.certificates, ComputeCertificateTag(ConnState.VerifiedCertificate)); Types::UpdateCountedMap(Dashboard.lastContact, ComputeUpLastContactTag(ConnState.LastContact)); GWObjects::HealthCheck HC; if(DeviceRegistry()->GetHealthcheck(SerialNumber,HC)) Types::UpdateCountedMap(Dashboard.healths, ComputeSanityTag(HC.Sanity)); std::string LastStats; if(DeviceRegistry()->GetStatistics(SerialNumber, LastStats) && !LastStats.empty()) { Poco::JSON::Parser P; auto RawObject = P.parse(LastStats).extract<Poco::JSON::Object::Ptr>(); if(RawObject->has("unit")) { auto Unit = RawObject->getObject("unit"); if (Unit->has("uptime")) { Types::UpdateCountedMap(Dashboard.upTimes, ComputeUpTimeTag(Unit->get("uptime"))); } if (Unit->has("memory")) { auto Memory = Unit->getObject("memory"); uint64_t Free = Memory->get("free"); uint64_t Total = Memory->get("total"); Types::UpdateCountedMap(Dashboard.memoryUsed, ComputeFreeMemoryTag(Free, Total)); } if (Unit->has("load")) { auto Load = Unit->getArray("load"); Types::UpdateCountedMap(Dashboard.load1, ComputeLoadTag(Load->getElement<uint64_t>(0))); Types::UpdateCountedMap(Dashboard.load5, ComputeLoadTag(Load->getElement<uint64_t>(1))); Types::UpdateCountedMap(Dashboard.load15, ComputeLoadTag(Load->getElement<uint64_t>(2))); } } uint64_t Associations_2G, Associations_5G; StateProcessor::GetAssociations(RawObject, Associations_2G, Associations_5G); Types::UpdateCountedMap(Dashboard.associations, "2G", Associations_2G); Types::UpdateCountedMap(Dashboard.associations, "5G", Associations_5G); } Types::UpdateCountedMap(Dashboard.status, ConnState.Connected ? "connected" : "not connected"); } else { Types::UpdateCountedMap(Dashboard.status, "not connected"); } More = RSet.moveNext(); } return true; } catch(const Poco::Exception &E) { Logger_.log(E); } return false; } }
0ba3db8f0663777b3ba3840232bc50e4436ef709
2814b4ed8ebe8bbeb2e4210ed083326dd6ce7252
/Hard/239. Sliding Window Maximum/maxSlidingWindow(multiset).cpp
b937ffc3beeb441361b256faf3aabf60be8733ce
[]
no_license
teddy8997/LeetCode
31970b5efe1945204bf2f8fc4e5d6924f05636db
399edc5300fb1cb2cb0fe51b42ce3a913c830d25
refs/heads/master
2023-04-10T21:14:28.684276
2021-04-19T06:12:34
2021-04-19T06:12:34
303,752,589
0
0
null
null
null
null
UTF-8
C++
false
false
475
cpp
class Solution { public: vector<int> maxSlidingWindow(vector<int>& nums, int k) { multiset<int> st; vector<int> ans; int r = 0; while(r < nums.size()){ if(st.size() >= k){ st.erase(st.find(nums[r - k])); } st.insert(nums[r]); if(r >= k - 1){ //window大小是k ans.push_back(*st.rbegin()); } r++; } return ans; } };
c8d66e954429a2b7187215c75cda657af1142814
d85b1f3ce9a3c24ba158ca4a51ea902d152ef7b9
/testcases/CWE762_Mismatched_Memory_Management_Routines/s03/CWE762_Mismatched_Memory_Management_Routines__delete_class_calloc_43.cpp
62bdc3609ddbe003211acee550ffc02117499160
[]
no_license
arichardson/juliet-test-suite-c
cb71a729716c6aa8f4b987752272b66b1916fdaa
e2e8cf80cd7d52f824e9a938bbb3aa658d23d6c9
refs/heads/master
2022-12-10T12:05:51.179384
2022-11-17T15:41:30
2022-12-01T15:25:16
179,281,349
34
34
null
2022-12-01T15:25:18
2019-04-03T12:03:21
null
UTF-8
C++
false
false
3,296
cpp
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE762_Mismatched_Memory_Management_Routines__delete_class_calloc_43.cpp Label Definition File: CWE762_Mismatched_Memory_Management_Routines__delete.label.xml Template File: sources-sinks-43.tmpl.cpp */ /* * @description * CWE: 762 Mismatched Memory Management Routines * BadSource: calloc Allocate data using calloc() * GoodSource: Allocate data using new * Sinks: * GoodSink: Deallocate data using free() * BadSink : Deallocate data using delete * Flow Variant: 43 Data flow: data flows using a C++ reference from one function to another in the same source file * * */ #include "std_testcase.h" namespace CWE762_Mismatched_Memory_Management_Routines__delete_class_calloc_43 { #ifndef OMITBAD void badSource(TwoIntsClass * &data) { /* POTENTIAL FLAW: Allocate memory with a function that requires free() to free the memory */ data = (TwoIntsClass *)calloc(100, sizeof(TwoIntsClass)); if (data == NULL) {exit(-1);} } void bad() { TwoIntsClass * data; /* Initialize data*/ data = NULL; badSource(data); /* POTENTIAL FLAW: Deallocate memory using delete - the source memory allocation function may * require a call to free() to deallocate the memory */ delete data; } #endif /* OMITBAD */ #ifndef OMITGOOD /* goodG2B() uses the GoodSource with the BadSink */ static void goodG2BSource(TwoIntsClass * &data) { /* FIX: Allocate memory from the heap using new */ data = new TwoIntsClass; } static void goodG2B() { TwoIntsClass * data; /* Initialize data*/ data = NULL; goodG2BSource(data); /* POTENTIAL FLAW: Deallocate memory using delete - the source memory allocation function may * require a call to free() to deallocate the memory */ delete data; } /* goodB2G() uses the BadSource with the GoodSink */ static void goodB2GSource(TwoIntsClass * &data) { /* POTENTIAL FLAW: Allocate memory with a function that requires free() to free the memory */ data = (TwoIntsClass *)calloc(100, sizeof(TwoIntsClass)); if (data == NULL) {exit(-1);} } static void goodB2G() { TwoIntsClass * data; /* Initialize data*/ data = NULL; goodB2GSource(data); /* FIX: Deallocate the memory using free() */ free(data); } void good() { goodG2B(); goodB2G(); } #endif /* OMITGOOD */ } /* close namespace */ /* Below is the main(). It is only used when building this testcase on its own for testing or for building a binary to use in testing binary analysis tools. It is not used when compiling all the testcases as one application, which is how source code analysis tools are tested. */ #ifdef INCLUDEMAIN using namespace CWE762_Mismatched_Memory_Management_Routines__delete_class_calloc_43; /* so that we can use good and bad easily */ int main(int argc, char * argv[]) { /* seed randomness */ srand( (unsigned)time(NULL) ); #ifndef OMITGOOD printLine("Calling good()..."); good(); printLine("Finished good()"); #endif /* OMITGOOD */ #ifndef OMITBAD printLine("Calling bad()..."); bad(); printLine("Finished bad()"); #endif /* OMITBAD */ return 0; } #endif
5025f32b3d53b210365121f7c7a9aeec29705d3d
08b8cf38e1936e8cec27f84af0d3727321cec9c4
/data/crawl/squid/old_hunk_2474.cpp
2101ad0763179aa9c7b2cff507b0aa27d5c28c87
[]
no_license
ccdxc/logSurvey
eaf28e9c2d6307140b17986d5c05106d1fd8e943
6b80226e1667c1e0760ab39160893ee19b0e9fb1
refs/heads/master
2022-01-07T21:31:55.446839
2018-04-21T14:12:43
2018-04-21T14:12:43
null
0
0
null
null
null
null
UTF-8
C++
false
false
661
cpp
void Rock::SwapDir::ioCompletedNotification() { if (!theFile) { debugs(47, 1, HERE << filePath << ": initialization failure or " << "premature close of rock db file"); fatalf("Rock cache_dir failed to initialize db file: %s", filePath); } if (theFile->error()) { debugs(47, 1, HERE << filePath << ": " << xstrerror()); fatalf("Rock cache_dir failed to open db file: %s", filePath); } // TODO: lower debugging level debugs(47,1, "Rock cache_dir[" << index << "] limits: " << std::setw(12) << maxSize() << " disk bytes and " << std::setw(7) << map->entryLimit() << " entries");
5266ed85aa85819bfeefb681f44993adec075e47
3bc7611f3eabed78373c17e3aa805afc48133bbd
/include/lll.h
0cbf64c373b9115a29d9a922ce5612af06870521
[ "MIT" ]
permissive
pdx-cs-tutors/pdp
9fd401c0210e70dfcf4aa573559fbf7d2c41c72a
48622b1a4bdbf724795a1a6faed4ba1df16319a8
refs/heads/master
2021-01-20T01:33:39.708106
2017-06-02T22:31:44
2017-06-02T22:31:44
89,296,577
11
1
null
null
null
null
UTF-8
C++
false
false
630
h
#pragma once #include <cstddef> namespace lll { // This is our LLL node: struct node { int data; node* next; }; // Implement the following in src/lll/insertion.cpp: int append(node*& head, int value); int append_unique(node*& head, int value); int prepend(node*& head, int value); int prepend_unique(node*& head, int value); int insert_ordered(node*& head, int value); // Implement the following in src/lll/removal.cpp: int remove(node*& head, int value); int remove_all(node*& head, int value); int remove_evens(node*& head); int destroy(node*& head); }
b0186163ec084696aae75a62d7d4a0e242288cff
5e117c7f994525ed76be9cab04a633fd99ef1d15
/AdvancedLevel/1064.Complete Binary Search Tree(30)/main.cpp
d7094a6ae65fe40d1605b789fafcc0c1df67ad71
[]
no_license
Weijun-H/PAT
05151dd355bb87e1b18d7a2139a9acd1b57b5d2e
923260408375f9d06f426f05c7d6654baf8a039c
refs/heads/master
2022-02-16T04:07:25.194752
2019-09-07T16:27:45
2019-09-07T16:27:45
null
0
0
null
null
null
null
UTF-8
C++
false
false
502
cpp
#include <cstdio> #include <algorithm> using namespace std; const int maxn = 1010; int n, number[maxn], CBT[maxn], inde = 0; void inOrder(int root){ if(root > n)return; inOrder(root*2); CBT[root] = number[inde++]; inOrder(root * 2+1); } int main() { scanf("%d",&n); for (int i = 0; i < n; ++i) { scanf("%d",&number[i]); } sort(number,number+n); inOrder(1); for (int i = 1; i <= n; ++i) { printf("%d",CBT[i]); if(i < n)printf(" "); } }
b45e6784db3830197f2e3e42a862d2725ef18079
d6d4d56f20424d31dbb9e7f2ee0d1f4edc68442d
/behavioral_pattern/filter/abstract_criteria.h
925cb908af99a64a531786865434c221033f3673
[]
no_license
inthra-onsap/cpp-design-pattern
f61e85bb88fb835bc8ff26773edeb773f68b81ce
0ed27cb36b38162981fb388f5bf3d19a5449ad29
refs/heads/master
2020-03-25T05:10:02.106457
2018-08-19T18:51:31
2018-08-19T18:51:31
143,432,893
0
0
null
null
null
null
UTF-8
C++
false
false
459
h
#ifndef CPP_DESIGN_PATTERN_BEHAVIORAL_ABSTRACTCRITERIA_H_ #define CPP_DESIGN_PATTERN_BEHAVIORAL_ABSTRACTCRITERIA_H_ #include "person.h" #include <vector> namespace cpp_design_pattern { namespace behavioral_pattern { class AbstractCriteria { public: virtual std::vector<Person *> filter(std::vector<Person *> persons) = 0; }; } //namespace behavioral_pattern } //namespace cpp_design_pattern #endif //CPP_DESIGN_PATTERN_BEHAVIORAL_ABSTRACTCRITERIA_H_
5ea2f6dcb8232b89661a490f50d673199bcbf3f9
e0542ed632b7ad7db10f426b7d9f7fa826adb424
/scan_service/scanner.cpp
518ab6064eca76d2528cd5223de190193fb4ce58
[]
no_license
he-2-iiu/scan_util_client-server
f575cf3243e8a39e1cd951dc98e3f4d0e115ee6c
09d3e6b828bdc658091c0833f897a1a713a51daa
refs/heads/main
2023-05-31T04:08:29.741161
2021-07-06T19:40:49
2021-07-06T19:40:49
382,907,998
0
0
null
null
null
null
UTF-8
C++
false
false
3,400
cpp
#include "scanner.h" #include <string> #include <vector> #include <fstream> #include <filesystem> #include <chrono> #include <thread> #include <atomic> #include <condition_variable> #include <mutex> constexpr unsigned thread_max = 4; static std::atomic<unsigned> available_threads = thread_max; static std::condition_variable cv; static std::atomic<size_t> n_errors{}; static std::atomic<size_t> n_js_detects{}; static std::atomic<size_t> n_unix_detects{}; static std::atomic<size_t> n_macos_detects{}; static void inspect_file_task(const std::filesystem::directory_entry& entry); int scan_directory(const char* directory_path, size_t results[]) { std::filesystem::path dir_path{ directory_path }; if (!std::filesystem::exists(dir_path)) { return SCANNER_ERROR_NO_DIR; } if (!std::filesystem::is_directory(dir_path)) { return SCANNER_ERROR_NO_DIR; } { std::ifstream dir{ dir_path }; if (!dir.is_open()) { return SCANNER_ERROR_NO_PERMISSIONS; } } size_t n_searched{}; std::vector<std::thread> tasks{}; tasks.reserve(thread_max); std::mutex m{}; std::unique_lock<std::mutex> lock{ m }; auto start{ std::chrono::high_resolution_clock::now() }; for (const auto& entry : std::filesystem::directory_iterator{ dir_path, std::filesystem::directory_options::skip_permission_denied }) { ++n_searched; cv.wait(lock, [&] { return available_threads > 0; }); --available_threads; tasks.emplace_back(std::thread(inspect_file_task, entry)); } for (auto& thread : tasks) thread.join(); auto duration{ std::chrono::high_resolution_clock::now() - start }; results[ScannerResultsTypes::Searched] = n_searched; results[ScannerResultsTypes::Errors] = n_errors; results[ScannerResultsTypes::JsDetects] = n_js_detects; results[ScannerResultsTypes::UnixDetects] = n_unix_detects; results[ScannerResultsTypes::MacosDetects] = n_macos_detects; results[ScannerResultsTypes::DurationS] = std::chrono::duration_cast<std::chrono::seconds>(duration).count(); results[ScannerResultsTypes::DurationMs] = std::chrono::duration_cast<std::chrono::milliseconds>(duration).count() % 1000; results[ScannerResultsTypes::DurationUs] = std::chrono::duration_cast<std::chrono::microseconds>(duration).count() % 1000; n_errors = 0; n_js_detects = 0; n_unix_detects = 0; n_macos_detects = 0; return SCANNER_SUCCESS; } static void inspect_file_task(const std::filesystem::directory_entry& entry) { std::ifstream file{ entry.path() }; if (!file.is_open()) { ++n_errors; ++available_threads; cv.notify_all(); return; } const char* js_suspicious{ "<script>evil_script()</script>" }; const char* unix_suspicious{ "rm -rf ~/Documents" }; const char* macos_suspicious{ "system(\"launchctl load /Library/LaunchAgents/com.malware.agent\")" }; std::string line; const auto& extension = entry.path().extension().string(); while (getline(file, line)) { if (extension == ".js" && line.find(js_suspicious) != std::string::npos) { ++n_js_detects; break; } if (line.find(unix_suspicious) != std::string::npos) { ++n_unix_detects; break; } if (line.find(macos_suspicious) != std::string::npos) { ++n_macos_detects; break; } } ++available_threads; cv.notify_all(); }
ec9975f2dc7d0bb0db56c3d7356d7688ab5dedb8
f9f43c8098489ce14cf60fe8ce264fbb71e5539a
/ANTAREX/Hdf5Types/clava_generate_example_3/src/test_lib.cpp
b66f34f5e2c84e8fb49b23ec2f9de295fb02a0a1
[ "MIT" ]
permissive
specs-feup/specs-lara
f2ff9295a01ad6bf893b35143d591b4d41c41b6c
53ff627d7477d34c0ce91faa5ace060fee660db9
refs/heads/master
2022-09-01T18:43:24.153586
2022-08-10T13:57:28
2022-08-10T13:57:28
96,773,200
0
0
null
null
null
null
UTF-8
C++
false
false
250
cpp
#include "test_lib.h" #include <iostream> #include "CompType.h" #include <H5CompType.h> void foo(A& a) { } void foo(B& a) { } void foo(C& a) { } int main() { std::cout << "Hello\n"; H5::CompType aCompType = hdf5type::AType::GetCompType(); }
557764479165cf6f109642f3bf0deac2a9179d65
322c0a83ffe50f4d6b1e2a793421fd988bd78a80
/2014多校标程和数据/2014 Multi-University Training Contest 1(标程+数据)/多校第一场(标程+数据)/多校第一场-标程/1004.cpp
439bfa71ea3f37904599b88f179db1036d05a19b
[]
no_license
huanzhizun/ACM-material
333b4632addeff10d58213176d9311d6c3688a7e
542132ab2afa18f7436479b5661fb64bdd22b676
refs/heads/master
2020-04-15T09:49:01.178558
2019-01-08T05:12:04
2019-01-08T05:12:04
164,566,380
2
0
null
null
null
null
UTF-8
C++
false
false
1,018
cpp
#include<stdio.h> #include<string.h> #include<map> #include<iostream> #include<algorithm> using namespace std; const int N = 100005; struct P { int x,y; }a[N],b[N]; bool cmp(P a,P b) { if(a.x==b.x)return a.y>b.y; return a.x>b.x; } map<int,int>mapp; char s[N]; int main() { //freopen("0.in","r",stdin); //freopen("0.out","w",stdout); int n,m,i,j,ans1; long long ans2; while(~scanf("%d %d",&n,&m)) { for(i=0;i<n;i++) { scanf("%d %d",&a[i].x,&a[i].y); } for(i=0;i<m;i++) { scanf("%d %d",&b[i].x,&b[i].y); } sort(a,a+n,cmp); sort(b,b+m,cmp); mapp.clear(); j=0,ans1=0,ans2=0; for(i=0;i<m;i++) { while(j<n&&a[j].x>=b[i].x) { mapp[a[j].y]++; j++; } map<int,int>::iterator it=mapp.lower_bound(b[i].y); if(it!=mapp.end()) { ans1++; ans2+=(b[i].x*500+b[i].y*2); int t=it->first; mapp[t]--; if(mapp[t]==0)mapp.erase(t); } } printf("%d %I64d\n",ans1,ans2); } return 0; }
ead7ca8cf26ebe5cbbbe3afad75402ad4c091797
e825df84e093afd63d1c44c4eebacef89c47c4bd
/Fifth/PNoOp.hpp
730b196e486c11e0b514a5becfd7bc258e8d22b9
[]
no_license
fitzpatricksrus/Fifth
0cfd6e3d0fa4d388870ddef7bd19664d084a96f3
e8e31209c5963e9b5ab9664754f55736f0586d41
refs/heads/master
2021-01-09T16:06:36.907470
2016-06-04T06:13:24
2016-06-04T06:13:24
60,396,193
0
0
null
null
null
null
UTF-8
C++
false
false
435
hpp
#ifndef PNoOp_hpp #define PNoOp_hpp #include "Word.hpp" namespace us_cownet_fifth_primitives { using us_cownet_fifth_interp::ExecutionThread; using us_cownet_fifth_interp::Word; class PNoOp : public Word { public: virtual void execute(ExecutionThread& thread); virtual std::string debugName() { return "PNoOp"; }; static PNoOp& INSTANCE; }; } #endif /* PInteger_hpp */
fad5b9bcce09e21068b03aff09931a64e60f2732
e17c43db9488f57cb835129fa954aa2edfdea8d5
/Libraries/IFC/IFC4/lib/IfcTypeProcess.cpp
35153128d019e297ebbbee86556454e42939dba3
[]
no_license
claudioperez/Rts
6e5868ab8d05ea194a276b8059730dbe322653a7
3609161c34f19f1649b713b09ccef0c8795f8fe7
refs/heads/master
2022-11-06T15:57:39.794397
2020-06-27T23:00:11
2020-06-27T23:00:11
null
0
0
null
null
null
null
UTF-8
C++
false
false
6,509
cpp
/* Code generated by IfcQuery EXPRESS generator, www.ifcquery.com */ #include <sstream> #include <limits> #include "model/IfcPPException.h" #include "model/IfcPPAttributeObject.h" #include "model/IfcPPGuid.h" #include "reader/ReaderUtil.h" #include "writer/WriterUtil.h" #include "IFC4/include/IfcGloballyUniqueId.h" #include "IFC4/include/IfcIdentifier.h" #include "IFC4/include/IfcLabel.h" #include "IFC4/include/IfcOwnerHistory.h" #include "IFC4/include/IfcPropertySetDefinition.h" #include "IFC4/include/IfcRelAggregates.h" #include "IFC4/include/IfcRelAssigns.h" #include "IFC4/include/IfcRelAssignsToProcess.h" #include "IFC4/include/IfcRelAssociates.h" #include "IFC4/include/IfcRelDeclares.h" #include "IFC4/include/IfcRelDefinesByType.h" #include "IFC4/include/IfcRelNests.h" #include "IFC4/include/IfcText.h" #include "IFC4/include/IfcTypeProcess.h" // ENTITY IfcTypeProcess IfcTypeProcess::IfcTypeProcess() {} IfcTypeProcess::IfcTypeProcess( int id ) { m_entity_id = id; } IfcTypeProcess::~IfcTypeProcess() {} shared_ptr<IfcPPObject> IfcTypeProcess::getDeepCopy( IfcPPCopyOptions& options ) { shared_ptr<IfcTypeProcess> copy_self( new IfcTypeProcess() ); if( m_GlobalId ) { if( options.create_new_IfcGloballyUniqueId ) { copy_self->m_GlobalId = shared_ptr<IfcGloballyUniqueId>(new IfcGloballyUniqueId( createGUID32_wstr().c_str() ) ); } else { copy_self->m_GlobalId = dynamic_pointer_cast<IfcGloballyUniqueId>( m_GlobalId->getDeepCopy(options) ); } } if( m_OwnerHistory ) { if( options.shallow_copy_IfcOwnerHistory ) { copy_self->m_OwnerHistory = m_OwnerHistory; } else { copy_self->m_OwnerHistory = dynamic_pointer_cast<IfcOwnerHistory>( m_OwnerHistory->getDeepCopy(options) ); } } if( m_Name ) { copy_self->m_Name = dynamic_pointer_cast<IfcLabel>( m_Name->getDeepCopy(options) ); } if( m_Description ) { copy_self->m_Description = dynamic_pointer_cast<IfcText>( m_Description->getDeepCopy(options) ); } if( m_ApplicableOccurrence ) { copy_self->m_ApplicableOccurrence = dynamic_pointer_cast<IfcIdentifier>( m_ApplicableOccurrence->getDeepCopy(options) ); } for( size_t ii=0; ii<m_HasPropertySets.size(); ++ii ) { auto item_ii = m_HasPropertySets[ii]; if( item_ii ) { copy_self->m_HasPropertySets.push_back( dynamic_pointer_cast<IfcPropertySetDefinition>(item_ii->getDeepCopy(options) ) ); } } if( m_Identification ) { copy_self->m_Identification = dynamic_pointer_cast<IfcIdentifier>( m_Identification->getDeepCopy(options) ); } if( m_LongDescription ) { copy_self->m_LongDescription = dynamic_pointer_cast<IfcText>( m_LongDescription->getDeepCopy(options) ); } if( m_ProcessType ) { copy_self->m_ProcessType = dynamic_pointer_cast<IfcLabel>( m_ProcessType->getDeepCopy(options) ); } return copy_self; } void IfcTypeProcess::getStepLine( std::stringstream& stream ) const { stream << "#" << m_entity_id << "= IFCTYPEPROCESS" << "("; if( m_GlobalId ) { m_GlobalId->getStepParameter( stream ); } else { stream << "*"; } stream << ","; if( m_OwnerHistory ) { stream << "#" << m_OwnerHistory->m_entity_id; } else { stream << "*"; } stream << ","; if( m_Name ) { m_Name->getStepParameter( stream ); } else { stream << "*"; } stream << ","; if( m_Description ) { m_Description->getStepParameter( stream ); } else { stream << "*"; } stream << ","; if( m_ApplicableOccurrence ) { m_ApplicableOccurrence->getStepParameter( stream ); } else { stream << "*"; } stream << ","; writeEntityList( stream, m_HasPropertySets ); stream << ","; if( m_Identification ) { m_Identification->getStepParameter( stream ); } else { stream << "$"; } stream << ","; if( m_LongDescription ) { m_LongDescription->getStepParameter( stream ); } else { stream << "$"; } stream << ","; if( m_ProcessType ) { m_ProcessType->getStepParameter( stream ); } else { stream << "$"; } stream << ");"; } void IfcTypeProcess::getStepParameter( std::stringstream& stream, bool ) const { stream << "#" << m_entity_id; } const std::wstring IfcTypeProcess::toString() const { return L"IfcTypeProcess"; } void IfcTypeProcess::readStepArguments( const std::vector<std::wstring>& args, const std::map<int,shared_ptr<IfcPPEntity> >& map ) { const size_t num_args = args.size(); if( num_args != 9 ){ std::stringstream err; err << "Wrong parameter count for entity IfcTypeProcess, expecting 9, having " << num_args << ". Entity ID: " << m_entity_id << std::endl; throw IfcPPException( err.str().c_str() ); } m_GlobalId = IfcGloballyUniqueId::createObjectFromSTEP( args[0], map ); readEntityReference( args[1], m_OwnerHistory, map ); m_Name = IfcLabel::createObjectFromSTEP( args[2], map ); m_Description = IfcText::createObjectFromSTEP( args[3], map ); m_ApplicableOccurrence = IfcIdentifier::createObjectFromSTEP( args[4], map ); readEntityReferenceList( args[5], m_HasPropertySets, map ); m_Identification = IfcIdentifier::createObjectFromSTEP( args[6], map ); m_LongDescription = IfcText::createObjectFromSTEP( args[7], map ); m_ProcessType = IfcLabel::createObjectFromSTEP( args[8], map ); } void IfcTypeProcess::getAttributes( std::vector<std::pair<std::string, shared_ptr<IfcPPObject> > >& vec_attributes ) { IfcTypeObject::getAttributes( vec_attributes ); vec_attributes.push_back( std::make_pair( "Identification", m_Identification ) ); vec_attributes.push_back( std::make_pair( "LongDescription", m_LongDescription ) ); vec_attributes.push_back( std::make_pair( "ProcessType", m_ProcessType ) ); } void IfcTypeProcess::getAttributesInverse( std::vector<std::pair<std::string, shared_ptr<IfcPPObject> > >& vec_attributes_inverse ) { IfcTypeObject::getAttributesInverse( vec_attributes_inverse ); if( m_OperatesOn_inverse.size() > 0 ) { shared_ptr<IfcPPAttributeObjectVector> OperatesOn_inverse_vec_obj( new IfcPPAttributeObjectVector() ); for( size_t i=0; i<m_OperatesOn_inverse.size(); ++i ) { if( !m_OperatesOn_inverse[i].expired() ) { OperatesOn_inverse_vec_obj->m_vec.push_back( shared_ptr<IfcRelAssignsToProcess>( m_OperatesOn_inverse[i] ) ); } } vec_attributes_inverse.push_back( std::make_pair( "OperatesOn_inverse", OperatesOn_inverse_vec_obj ) ); } } void IfcTypeProcess::setInverseCounterparts( shared_ptr<IfcPPEntity> ptr_self_entity ) { IfcTypeObject::setInverseCounterparts( ptr_self_entity ); } void IfcTypeProcess::unlinkFromInverseCounterparts() { IfcTypeObject::unlinkFromInverseCounterparts(); }