text
stringlengths 8
6.88M
|
|---|
#ifndef COSMOS_RELEASE_MINER
#define COSMOS_RELEASE_MINER
#include <cosmos/cosmos.hpp>
#include <data/tools/ordered_list.hpp>
#include <thread>
#include <csignal>
namespace cosmos::bitcoin {
// an address miner
struct miner {
// way of organizing addresses by proof-of-work
struct address {
secret Secret;
pubkey Pubkey;
bitcoin::address Address;
bool valid() {
return Secret.valid() && Pubkey.valid() && Address.valid();
}
bool operator<=(const address& a) const {
return Address.Digest >= a.Address.Digest;
}
address(secret s) : Secret{s}, Pubkey{s.to_public()}, Address{Pubkey.address()} {}
address(std::string& wif) : address(secret{wif}) {}
};
// ordered list of addresses.
struct addresses {
uint32 MaxSize;
data::ordered_list<address> List;
addresses update(address next) const {
if (next <= List.first()) return {MaxSize, List.rest().insert(next)};
return *this;
}
address min() const {
return List.last();
}
address max() const {
return List.first();
}
};
// current state of the program.
struct state {
uint32 Increment;
addresses Addresses;
secret Next;
std::string Error;
state() {}
state(const std::string& e) : Error{e} {}
state(uint32 i, addresses a, secret n) : Increment{i}, Addresses{a}, Next{n} {}
void round(); /*{
Addresses = Addresses.update(Next);
Next.Secret.Value += Increment;
}*/
// read in program state from user input.
static state restore(std::istream& disk);
void save(std::ostream& out) const;
};
enum command {
none = 0,
stop = 1
};
// work until a command is received to stop.
static state work(state s, data::channel<command> user) {
const uint32 rounds = 10000;
while (true) {
for (uint32 i = 0; i < rounds; i++) s.round();
command c;
if (user.get(c, false))
switch (c) {
default:
case command::none:
break;
case command::stop:
return s;
}
}
}
static state run(state s, data::channel<command> user) {
try {
return work(s, user);
} catch (std::exception& e) {
return state{std::string{e.what()}};
} catch (...) {
return state{std::string{"unknown error"}};
}
}
class running {
struct program {
data::channel<command> User;
void operator()(state s);
};
std::thread Program;
data::channel<command> User;
running(state s, data::channel<command> user) : Program{program{user}, s} {}
public:
static running* run(state s) {
return new running{s, data::channel<command>{}};
}
state stop() {
User.put(command::stop);
Program.join();
return {}; // TODO put what ought to be here.
}
};
data::program::output operator()(int argc, char* argv[]);
};
}
#endif
|
#include "error_indication.h"
// Sets up error indication
void setup_error_indication() {
pinMode(PIN_ERROR_LED1, OUTPUT);
pinMode(PIN_ERROR_LED2, OUTPUT);
pinMode(PIN_ERROR_SOUNDER, OUTPUT);
}
// Turn on or off error LED 1
void error_1 (bool on) {
if (on) {
digitalWrite(PIN_ERROR_LED1, HIGH);
} else {
digitalWrite(PIN_ERROR_LED1, LOW);
}
}
// Turn on or off error LED 2
void error_2 (bool on) {
if (on) {
digitalWrite(PIN_ERROR_LED2, HIGH);
} else {
digitalWrite(PIN_ERROR_LED2, LOW);
}
}
// Turn on or off error sounder
void error_sounder (bool on) {
if (on) {
digitalWrite(PIN_ERROR_SOUNDER, LOW);
} else {
digitalWrite(PIN_ERROR_SOUNDER, HIGH);
}
}
|
#include "stdafx.h"
#include "data/datafactory.h"
#include "data/dta_loader.h"
#include "data/naf_loader.h"
namespace data
{
//////////////////////////////////////////////////////////////////////////
shared_ptr<loader> factory::get_loader(std::string path)
{
shared_ptr<dta_loader> dta_file;
dta_file.reset(new dta_loader(path));
if (dta_file->check_file_format())
return dta_file;
shared_ptr<naf_loader> naf_file;
naf_file.reset( new naf_loader(path));
if (naf_file->check_file_format())
return naf_file;
return dta_file;
}
void loader::init(data::pwriter_t)
{
}
}
|
#include <compressor/cli.h>
int main(int argc, char *argv[]) {
compressor::CLI cmd(std::make_unique<argparser::Argparser>(argc, argv),
std::make_unique<compressor::Compressor>());
cmd.run();
return 0;
}
|
//=============================================================================================
// A beadott program csak ebben a fajlban lehet, a fajl 1 byte-os ASCII karaktereket tartalmazhat, BOM kihuzando.
// Tilos:
// - mast "beincludolni", illetve mas konyvtarat hasznalni
// - faljmuveleteket vegezni a printf-et kiveve
// - Mashonnan atvett programresszleteket forrasmegjeloles nelkul felhasznalni es
// - felesleges programsorokat a beadott programban hagyni!!!!!!!
// - felesleges kommenteket a beadott programba irni a forrasmegjelolest kommentjeit kiveve
// ---------------------------------------------------------------------------------------------
// A feladatot ANSI C++ nyelvu forditoprogrammal ellenorizzuk, a Visual Studio-hoz kepesti elteresekrol
// es a leggyakoribb hibakrol (pl. ideiglenes objektumot nem lehet referencia tipusnak ertekul adni)
// a hazibeado portal ad egy osszefoglalot.
// ---------------------------------------------------------------------------------------------
// A feladatmegoldasokban csak olyan OpenGL fuggvenyek hasznalhatok, amelyek az oran a feladatkiadasig elhangzottak
// A keretben nem szereplo GLUT fuggvenyek tiltottak.
//
// NYILATKOZAT
// ---------------------------------------------------------------------------------------------
// Nev : Karpati Mark Andras
// Neptun : O1BG0Z
// ---------------------------------------------------------------------------------------------
// ezennel kijelentem, hogy a feladatot magam keszitettem, es ha barmilyen segitseget igenybe vettem vagy
// mas szellemi termeket felhasznaltam, akkor a forrast es az atvett reszt kommentekben egyertelmuen jeloltem.
// A forrasmegjeloles kotelme vonatkozik az eloadas foliakat es a targy oktatoi, illetve a
// grafhazi doktor tanacsait kiveve barmilyen csatornan (szoban, irasban, Interneten, stb.) erkezo minden egyeb
// informaciora (keplet, program, algoritmus, stb.). Kijelentem, hogy a forrasmegjelolessel atvett reszeket is ertem,
// azok helyessegere matematikai bizonyitast tudok adni. Tisztaban vagyok azzal, hogy az atvett reszek nem szamitanak
// a sajat kontribucioba, igy a feladat elfogadasarol a tobbi resz mennyisege es minosege alapjan szuletik dontes.
// Tudomasul veszem, hogy a forrasmegjeloles kotelmenek megsertese eseten a hazifeladatra adhato pontokat
// negativ elojellel szamoljak el es ezzel parhuzamosan eljaras is indul velem szemben.
//=============================================================================================
#include "framework.h"
const vec3 N = vec3(0.17f, 0.35f, 1.5f);
const vec3 KAPPA = vec3(3.1f, 2.7f, 1.9f);
const float epsilon = 0.0001f;
const vec3 one(1.0f, 1.0f, 1.0f);
enum MaterialType {
ROUGH, REFLECTIVE, PORTAL
};
struct Material {
vec3 ka, kd, ks, F0;
float shininess;
MaterialType type;
Material(MaterialType t) { type = t; }
};
struct RoughMaterial : Material {
RoughMaterial(vec3 _kd, vec3 _ks, float _shininess) : Material(ROUGH) {
ka = _kd * M_PI;
kd = _kd;
ks = _ks;
shininess = _shininess;
}
};
vec3 operator/(vec3 num, vec3 denom) {
return vec3(num.x / denom.x, num.y / denom.y, num.z / denom.z);
}
struct ReflectiveMaterial : Material {
ReflectiveMaterial(vec3 n, vec3 kappa) : Material(REFLECTIVE) {
F0 = ((n - one) * (n - one) + kappa * kappa) / ((n + one) * (n + one) + kappa * kappa);
}
};
struct PortalMaterial: Material {
PortalMaterial() : Material(PORTAL) {
vec3 n(0.0f,0.0f,0.0f);
vec3 kappa(1.0f,1.0f,1.0f);
F0 = ((n - one) * (n - one) + kappa * kappa) / ((n + one) * (n + one) + kappa * kappa);
}
};
struct Hit {
float t;
vec3 position, normal, faceCenter;
Material *material;
Hit() { t = -1.0f; }
};
struct Ray {
vec3 start, dir;
Ray(vec3 _start, vec3 _dir) {
start = _start;
dir = normalize(_dir);
}
};
float distance(vec3 p1, vec3 p2) {
return sqrtf(powf(p1.x - p2.x, 2) +
powf(p1.y - p2.y, 2) +
powf(p1.z - p2.z, 2));
}
vec3 fresnel(vec3 F0, vec3 v, vec3 n) {
float cosTheata = dot(-v, n);
vec3 returnValue = F0 + (one - F0) * (pow(1.0f - cosTheata, 5.0f));
return returnValue;
}
class Intersectable {
protected:
Material *material;
public:
virtual Hit intersect(const Ray &ray) = 0;
};
struct Quadrics : public Intersectable {
mat4 Q;
vec3 pointOfSphare;
float radius;
vec3 translation;
Quadrics(mat4 &_Q, vec3 _pointOfSphare, float _radius, vec3 _translation, Material *_material) {
Q = _Q;
pointOfSphare = _pointOfSphare;
radius = _radius;
translation = _translation;
material = _material;
}
vec3 gradf(vec3 r) {
vec4 g = vec4(r.x, r.y, r.z, 1) * Q * 2;
return vec3(g.x, g.y, g.z);
}
Hit intersect(const Ray &ray) {
Hit hit;
vec3 start = ray.start - translation;
vec4 S(start.x, start.y, start.z, 1.0f), D(ray.dir.x, ray.dir.y, ray.dir.z, 0.0f);
float a = dot(D * Q, D), b = dot(S * Q, D) * 2.0f, c = dot(S * Q, S);
float discr = b * b - 4.0f * a * c;
if (discr < 0.0f) return hit;
float sqrt_discr = sqrtf(discr);
//cuttin to spheare
float t1 = (-b + sqrt_discr) / 2.0f / a;
vec3 p1 = ray.start + ray.dir * t1;
float dp1 = distance(pointOfSphare, p1);
if (dp1 > radius) {
t1 = -1.0f;
}
//cuttin to spheare
float t2 = (-b - sqrt_discr) / 2.0f / a;
vec3 p2 = ray.start + ray.dir * t2;
float dp2 = distance(pointOfSphare, p2);
if (dp2 > radius) {
t2 = -1.0f;
}
//selecting best t
if (t1 <= 0.0f && t2 <= 0.0f) {
return hit;
} else if (t1 <= 0.0f) {
hit.t = t2;
} else if (t2 <= 0.0f) {
hit.t = t1;
} else if (t2 < t1) {
hit.t = t2;
} else {
hit.t = t1;
}
hit.position = start + ray.dir * hit.t;
hit.normal = normalize(gradf(hit.position));
hit.position = hit.position + translation;
hit.material = material;
if (dot(hit.normal, ray.dir) >= 0.0f) {
hit.normal = hit.normal * -1.0f;
}
hit.material = material;
return hit;
}
};
struct ConvexPolyhedron : public Intersectable {
static const int objFaces = 12;
std::vector<vec3> v;
std::vector<int> planes;
Material *portal = new PortalMaterial();
public:
ConvexPolyhedron() {
v = {vec3(0, 0.618, 1.618), vec3(0, -0.618, 1.618), vec3(0, -0.618, -1.618),
vec3(0, 0.618, -1.618), vec3(1.618, 0, 0.618), vec3(-1.618, 0, 0.618),
vec3(-1.618, 0, -0.618), vec3(1.618, 0, -0.618), vec3(0.618, 1.618, 0),
vec3(-0.618, 1.618, 0), vec3(-0.618, -1.618, 0), vec3(0.618, -1.618, 0),
vec3(1, 1, 1), vec3(-1, 1, 1), vec3(-1, -1, 1), vec3(1, -1, 1),
vec3(1, -1, -1), vec3(1, 1, -1), vec3(-1, 1, -1), vec3(-1, -1, -1)};
planes = {
1, 2, 16, 5, 13, 1, 13, 9, 10, 14, 1, 14, 6, 15, 2, 2, 15, 11, 12, 16,
3, 4, 18, 8, 17, 3, 17, 12, 11, 20, 3, 20, 7, 19, 4, 19, 10, 9, 18, 4,
16, 12, 17, 8, 5, 5, 8, 18, 9, 13, 14, 10, 19, 7, 6, 6, 7, 20, 11, 15
};
material = new RoughMaterial(vec3(0.3f, 0.2f, 0.1f), vec3(2.0f, 2.0f, 2.0f), 50);
}
Hit intersect(const Ray &ray) {
Hit hit;
vec3 p1, p2, p3, p4, p5;
float t = 0.0f;
for (int i = 0; i < objFaces; i++) {
p1 = v[planes[5 * i] - 1], p2 = v[planes[5 * i + 1] - 1];
p3 = v[planes[5 * i + 2] - 1];
p4 = v[planes[5 * i + 3] - 1];
p5 = v[planes[5 * i + 4] - 1];
vec3 faceCenter = (p1 + p2 + p3 + p4 + p5) / 5.0f;
vec3 normal = cross(p2 - p1, p3 - p1);
if (dot(p1, normal) < 0) normal = -normal;
vec3 point = p1;
t = fabs(dot(normal, ray.dir)) > epsilon ? dot(point - ray.start, normal) / dot(normal, ray.dir) : -1;
if (t > epsilon && (hit.t > t || hit.t <= 0)) {
vec3 intersectPoint = ray.start + ray.dir * t;
bool inside = true;
for (int j = 0; j < 12; j++) {
if (j != i) {
vec3 op1 = v[planes[5 * j] - 1], op2 = v[planes[5 * j + 1] - 1], op3 = v[planes[5 * j + 2] - 1];
vec3 normalOther = cross(op2 - op1, op3 - op1);
if (dot(normalOther, intersectPoint - op1) > 0) {
inside = false;
break;
}
}
}
if (inside) {
hit.t = t;
hit.normal = normalize(normal);
hit.position = intersectPoint;
hit.material = portal;
hit.faceCenter = faceCenter;
if (length(cross(p2 - p1, hit.position - p1)) / length(p2 - p1) < 0.1) {
hit.material = material;
}
if (length(cross(p3 - p2, hit.position - p2)) / length(p3 - p2) < 0.1) {
hit.material = material;
}
if (length(cross(p4 - p3, hit.position - p3)) / length(p4 - p3) < 0.1) {
hit.material = material;
}
if (length(cross(p5 - p4, hit.position - p4)) / length(p5 - p4) < 0.1) {
hit.material = material;
}
if (length(cross(p1 - p5, hit.position - p5)) / length(p1 - p5) < 0.1) {
hit.material = material;
}
}
}
}
return hit;
}
};
class Camera {
vec3 eye, lookat, right, up;
float fov;
public:
void set(vec3 _eye, vec3 _lookat, vec3 vup, float _fov) {
eye = _eye;
lookat = _lookat;
fov = _fov;
vec3 w = eye - lookat;
float windowsSize = length(w) * tanf(fov / 2);
right = normalize(cross(vup, w)) * windowsSize;
up = normalize(cross(w, right)) * windowsSize;
}
Ray getRay(int X, int Y) {
vec3 dir =
lookat + right * (2.0f * (X + 0.5f) / windowWidth - 1) + up * (2.0f * (Y + 0.5f) / windowHeight - 1) -
eye;
return Ray(eye, dir);
}
void Animate(float dt) {
vec3 d = eye - lookat;
eye = vec3(d.x * cosf(dt) + d.z * sinf(dt), d.y, -d.x * sinf(dt) + d.z * cosf(dt)) + lookat;
set(eye, lookat, up, fov);
}
};
struct Light {
vec3 Le;
vec3 location;
Light(vec3 _Le, vec3 _location) {
Le = _Le;
location = _location;
}
vec3 getDirection(vec3 p1) {
return normalize(location - p1);
}
vec3 getRadiance(vec3 p1) {
float d = distance(p1, location);
return Le / powf(d, 2);
}
};
class Scene {
std::vector<Intersectable *> objects;
std::vector<Light *> lights;
Camera camera;
vec3 La;
public:
void build() {
vec3 eye = vec3(0, 0, 1), vup = vec3(0, 1, 0), lookat = vec3(0, 0, 0);
float fov = 45 * M_PI / 180;
camera.set(eye, lookat, vup, fov);
La = vec3(0.4f, 0.4f, 0.4f);
vec3 Le(0.9f, 0.9f, 0.9f);
lights.push_back(new Light(Le, vec3(-0.5, 0, -1)));
Material *material02 = new ReflectiveMaterial(N, KAPPA);//gold
float a = 6.1, b = 2.1, c = 0.2;
mat4 paraboloid = mat4(a, 0, 0, 0,
0, b, 0, 0,
0, 0, 0, (-c/2),
0, 0, (-c/2), 0);
objects.push_back(new Quadrics(paraboloid, vec3(0.0f, 0.0f, 0.0f), 0.3, vec3(0.0f, 0.0f, 0.0f), material02));
objects.push_back(new ConvexPolyhedron());
}
void render(std::vector<vec4> &image) {
for (int Y = 0; Y < windowHeight; Y++) {
for (int X = 0; X < windowWidth; X++) {
vec3 color = trace(camera.getRay(X, Y));
image[Y * windowWidth + X] = vec4(color.x, color.y, color.z, 1);
}
}
}
Hit firstIntersect(Ray ray) {
Hit bestHit;
for (Intersectable *object : objects) {
Hit hit = object->intersect(ray);
if (hit.t > 0 && (bestHit.t < 0 || hit.t < bestHit.t)) {
bestHit = hit;
}
}
if (dot(ray.dir, bestHit.normal) > 0) {
bestHit.normal = bestHit.normal * (-1);
}
return bestHit;
}
bool shadowIntersect(Ray ray, float maxDistance) {
for (Intersectable *object : objects) {
if (object->intersect(ray).t > 0 && length((ray.dir * object->intersect(ray).t)) < maxDistance) {
return true;
}
}
return false;
}
vec3 trace(Ray ray, int depth = 0) {
if (depth > 5) { return La; }
Hit hit = firstIntersect(ray);
if (hit.t < 0) { return La; }
vec3 outRadiance(0, 0, 0);
if (hit.material->type == ROUGH) {
outRadiance = hit.material->ka * La;
for (Light *light : lights) {
Ray shadowRay(hit.position + hit.normal * epsilon, light->getDirection(hit.position));
float cosTheta = dot(hit.normal, light->getDirection(hit.position));
if (cosTheta > 0 &&
!shadowIntersect(shadowRay, distance(light->location, hit.position))) { // shadow computation
outRadiance = outRadiance + light->getRadiance(hit.position) * hit.material->kd * cosTheta;
vec3 halfway = normalize(-ray.dir + light->getDirection(hit.position));
float cosDelta = dot(hit.normal, halfway);
if (cosDelta > 0) {
outRadiance =
outRadiance + light->Le * hit.material->ks * powf(cosDelta, hit.material->shininess);
}
}
}
} else if (hit.material->type == REFLECTIVE) {
vec3 reflectedDir = ray.dir - hit.normal * dot(hit.normal, ray.dir) * 2.0f;
vec3 F = fresnel(hit.material->F0, ray.dir, hit.normal);
outRadiance = outRadiance + trace(Ray(hit.position + hit.normal * epsilon, reflectedDir), depth + 1) * F;
} else if (hit.material->type == PORTAL) {
mat4 rotM = RotationMatrix(2.0f * M_PI / 5.0f, hit.normal);
vec3 v3 = hit.position - hit.faceCenter;
vec4 v4 = vec4(v3.x, v3.y, v3.z, 1) * rotM;
ray.start = hit.faceCenter + vec3(v4.x, v4.y, v4.z) + hit.normal * epsilon;
vec4 dir = vec4(ray.dir.x, ray.dir.y, ray.dir.z, 0) * rotM;
ray.dir = vec3(dir.x, dir.y, dir.z);
ray.dir = ray.dir-hit.normal*dot(hit.normal, ray.dir)*2.0f;
outRadiance=outRadiance+trace(ray,depth+1);
}
return outRadiance;
}
void Animate(float dt) { camera.Animate(dt); }
};
GPUProgram gpuProgram;
Scene scene;
// vertex shader in GLSL
const char *vertexSource = R"(
#version 330
precision highp float;
layout(location = 0) in vec2 cVertexPosition; // Attrib Array 0
out vec2 texcoord;
void main() {
texcoord = (cVertexPosition + vec2(1, 1))/2; // -1,1 to 0,1
gl_Position = vec4(cVertexPosition.x, cVertexPosition.y, 0, 1); // transform to clipping space
}
)";
// fragment shader in GLSL
const char *fragmentSource = R"(
#version 330
precision highp float;
uniform sampler2D textureUnit;
in vec2 texcoord; // interpolated texture coordinates
out vec4 fragmentColor; // output that goes to the raster memory as told by glBindFragDataLocation
void main() {
fragmentColor = texture(textureUnit, texcoord);
}
)";
class FullScreenTexturedQuad {
unsigned int vao = 0, textureId = 0; // vertex array object id and texture id
public:
FullScreenTexturedQuad(int windowWidth, int windowHeight) {
glGenVertexArrays(1, &vao); // create 1 vertex array object
glBindVertexArray(vao); // make it active
unsigned int vbo; // vertex buffer objects
glGenBuffers(1, &vbo); // Generate 1 vertex buffer objects
// vertex coordinates: vbo0 -> Attrib Array 0 -> vertexPosition of the vertex shader
glBindBuffer(GL_ARRAY_BUFFER, vbo); // make it active, it is an array
float vertexCoords[] = {-1, -1, 1, -1, 1, 1, -1, 1}; // two triangles forming a quad
glBufferData(GL_ARRAY_BUFFER, sizeof(vertexCoords), vertexCoords,
GL_STATIC_DRAW); // copy to that part of the memory which is not modified
glEnableVertexAttribArray(0);
glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, 0, NULL); // stride and offset: it is tightly packed
glGenTextures(1, &textureId);
glBindTexture(GL_TEXTURE_2D, textureId);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
}
void LoadTexture(std::vector<vec4> &image) {
glBindTexture(GL_TEXTURE_2D, textureId);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, windowWidth, windowHeight, 0, GL_RGBA, GL_FLOAT, &image[0]);
}
void Draw() {
glBindVertexArray(vao);
int location = glGetUniformLocation(gpuProgram.getId(), "textureUnit");
const unsigned int textureUnit = 0;
if (location >= 0) {
glUniform1i(location, textureUnit);
glActiveTexture(GL_TEXTURE0 + textureUnit);
glBindTexture(GL_TEXTURE_2D, textureId);
}
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
}
};
FullScreenTexturedQuad *fullScreenTexturedQuad;
void onInitialization() {
glViewport(0, 0, windowWidth, windowHeight);
scene.build();
fullScreenTexturedQuad = new FullScreenTexturedQuad(windowWidth, windowHeight);
gpuProgram.create(vertexSource, fragmentSource, "fragmentColor");
}
void onDisplay() {
std::vector<vec4> image(windowWidth * windowHeight);
scene.render(image);
fullScreenTexturedQuad->LoadTexture(image);
fullScreenTexturedQuad->Draw();
glutSwapBuffers();
}
void onKeyboard(unsigned char key, int pX, int pY) {
}
void onKeyboardUp(unsigned char key, int pX, int pY) {
}
void onMouse(int button, int state, int pX, int pY) {
}
void onMouseMotion(int pX, int pY) {
}
void onIdle() {
scene.Animate(0.5f);
glutPostRedisplay();
}
|
/**********************************************************************
markdown_lib.c - markdown in C using a PEG grammar.
(c) 2008 John MacFarlane (jgm at berkeley dot edu).
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License or the MIT
license. See LICENSE for details.
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.
***********************************************************************/
#include "lib_api.h"
#include <string>
#include <clocale>
#include "parsings.h"
#include "output.h"
#ifdef __cplusplus
extern "C" {
#endif
#include "types.h"
#ifdef __cplusplus
}
#endif
using std::string;
static void print_tree(element * elt, int indent);
// replace tabs with spaces
// CALLER is responsible to free the allocated heap memory
static string* preformat_text(char *text) {
if (nullptr == text)
return nullptr;
const char* tab_expansion = " "; // tabstop = 4
string *result = new string();
char next_char;
while ((next_char = *text++) != '\0') {
if ('\t' == next_char) {
result->append(tab_expansion);
continue;
}
*result += next_char;
}
result->append("\n\n");
return result;
}
/* process_raw_blocks - traverses an element list, replacing any RAW elements with
* the result of parsing them as markdown text, and recursing into the children
* of parent elements. The result should be a tree of elements without any RAWs. */
static element * process_raw_blocks(element *input, int extensions, element *references, element *notes) {
element *current = NULL;
element *last_child = NULL;
char *contents;
current = input;
while (current != NULL) {
if (current->key == RAW) {
/* \001 is used to indicate boundaries between nested lists when there
* is no blank line. We split the string by \001 and parse
* each chunk separately. */
contents = strtok(current->contents.str, "\001");
current->key = LIST;
current->children = parse_markdown(contents, extensions, references, notes);
last_child = current->children;
while ((contents = strtok(NULL, "\001"))) {
while (last_child->next != NULL)
last_child = last_child->next;
last_child->next = parse_markdown(contents, extensions, references, notes);
}
free(current->contents.str);
current->contents.str = NULL;
}
if (current->children != NULL)
current->children = process_raw_blocks(current->children, extensions, references, notes);
current = current->next;
}
return input;
}
string* markdown_to_cpp_string(char *text, int extensions, int output_format) {
string* out;
string* preformatted_text;
char *preformatted_text_c;
element *parsing_result;
element *references;
element *notes;
preformatted_text = preformat_text(text);
preformatted_text_c = const_cast<char*>(preformatted_text->c_str());
references = parse_references(preformatted_text_c, extensions);
notes = parse_notes(preformatted_text_c, extensions, references);
parsing_result = parse_markdown(preformatted_text_c, extensions, references, notes);
parsing_result = process_raw_blocks(parsing_result, extensions, references, notes);
// free resource ASAP to moderate memory pressure
delete preformatted_text;
preformatted_text = nullptr;
preformatted_text_c = nullptr;
out = new string(); // allocate memory; to be freed by caller
#ifdef _DEBUG
print_tree(parsing_result, 10);
#endif
print_element_list(out, parsing_result, output_format, extensions);
// free resource ASAP
free_element_list(parsing_result);
free_element_list(notes);
free_element_list(references);
return out;
}
// consider moving the buffer to global, thus to avoid allocating it every time when calling this func
char* markdown_to_string(char *text, int extensions, int output_format) {
string* cpp_str_result = markdown_to_cpp_string(text, extensions, output_format);
char *result = _strdup(cpp_str_result->c_str()); // create a copy
delete cpp_str_result;
cpp_str_result = nullptr;
return result;
}
//////////////////////////////////////////////////////////////////////
/// Misc
//////////////////////////////////////////////////////////////////////
#ifdef _DEBUG
/// for debugging only
/// print_tree - print tree of elements
static void print_tree(element * elt, int indent) {
int i;
char * key;
while (elt != NULL) {
for (i = 0; i < indent; i++)
fputc(' ', stderr);
switch (elt->key) {
case LIST: key = "LIST"; break;
case RAW: key = "RAW"; break;
case SPACE: key = "SPACE"; break;
case LINEBREAK: key = "LINEBREAK"; break;
case ELLIPSIS: key = "ELLIPSIS"; break;
case EMDASH: key = "EMDASH"; break;
case ENDASH: key = "ENDASH"; break;
case APOSTROPHE: key = "APOSTROPHE"; break;
case SINGLEQUOTED: key = "SINGLEQUOTED"; break;
case DOUBLEQUOTED: key = "DOUBLEQUOTED"; break;
case STR: key = "STR"; break;
case LINK: key = "LINK"; break;
case IMAGE: key = "IMAGE"; break;
case CODE: key = "CODE"; break;
case HTML: key = "HTML"; break;
case EMPH: key = "EMPH"; break;
case STRONG: key = "STRONG"; break;
case PLAIN: key = "PLAIN"; break;
case PARA: key = "PARA"; break;
case LISTITEM: key = "LISTITEM"; break;
case BULLETLIST: key = "BULLETLIST"; break;
case ORDEREDLIST: key = "ORDEREDLIST"; break;
case H1: key = "H1"; break;
case H2: key = "H2"; break;
case H3: key = "H3"; break;
case H4: key = "H4"; break;
case H5: key = "H5"; break;
case H6: key = "H6"; break;
case BLOCKQUOTE: key = "BLOCKQUOTE"; break;
case VERBATIM: key = "VERBATIM"; break;
case HTMLBLOCK: key = "HTMLBLOCK"; break;
case HRULE: key = "HRULE"; break;
case REFERENCE: key = "REFERENCE"; break;
case NOTE: key = "NOTE"; break;
default: key = "?";
}
if (elt->key == STR) {
fprintf(stderr, "0x%p: %s '%s'\n", (void *)elt, key, elt->contents.str);
}
else {
fprintf(stderr, "0x%p: %s\n", (void *)elt, key);
}
if (elt->children)
print_tree(elt->children, indent + 4);
elt = elt->next;
}
}
#endif
|
#include <iostream>
#include "pretty_printing.h"
using namespace std;
// Terrible, but it's topcoder. Everything should be in one file.
#include "sol.cc"
int main(int argc, char **argv) {
test_bitpowersets();
int m;
cin >> m;
vector<int> peg_values;
for (int i = 0; i < m; i++) {
peg_values.push_back(-1);
cin >> peg_values.back();
}
int n;
cin >> n;
vector<string> board;
for (int i = 0; i < n; i++) {
board.push_back("");
cin >> board.back();
}
//cerr << board << endl;
vector<string> moves = PegJumping().getMoves(peg_values, board);
cout << moves.size() << endl;
for (auto move : moves)
cout << move << endl;
return 0;
}
|
#include <memory>
#include "MenuPageJoinServer.hpp"
#include "../../state/StateManager.hpp"
#include "../PlayState.hpp"
#include <string.h>
MenuPageJoinServer::MenuPageJoinServer(StateManager& manager, nk_context* nk)
: MenuPage(manager, nk, "join server") {
strcpy(hostname, "localhost");
strcpy(username, "I are Client");
hostnameLength = strlen(hostname);
usernameLength = strlen(username);
}
MenuPageJoinServer::~MenuPageJoinServer() { }
void MenuPageJoinServer::updateContent() {
nk_layout_row_dynamic(nk, 30, 1);
nk_label(nk, "Join Server", NK_TEXT_ALIGN_CENTERED|NK_TEXT_ALIGN_BOTTOM);
nk_layout_row_dynamic(nk, 30, 1);
nk_label(nk, "Hostname or IP:", NK_TEXT_ALIGN_LEFT|NK_TEXT_ALIGN_BOTTOM);
nk_layout_row_dynamic(nk, 30, 1);
nk_edit_string(nk, NK_EDIT_SIMPLE, hostname, &hostnameLength, 256, nk_filter_default);
nk_layout_row_dynamic(nk, 30, 1);
nk_label(nk, "Username:", NK_TEXT_ALIGN_LEFT|NK_TEXT_ALIGN_BOTTOM);
nk_layout_row_dynamic(nk, 30, 1);
nk_edit_string(nk, NK_EDIT_SIMPLE, username, &usernameLength, 256, nk_filter_default);
nk_layout_row_dynamic(nk, 30, 0);
nk_layout_row_dynamic(nk, 30, 2);
if (nk_button_label(nk, "Back")) {
manager.pop();
}
if (nk_button_label(nk, "Connect")) {
manager.pop();
manager.push(std::make_shared<ClientPlayState>(manager, nk, hostname, 1234, username));
}
}
void MenuPageJoinServer::setHostname(const std::string &hostname_) {
strcpy(hostname, hostname_.c_str());
hostnameLength = strlen(hostname);
}
|
#ifndef _INPUT_H_
#define _INPUT_H_
#define DIRECTINPUT_VERSION 0x0800
#pragma comment(lib, "dinput8.lib")
#pragma comment(lib, "dxguid.lib")
#include <dinput.h>
#include "keyboardinput.h"
#include "mouseinput.h"
#include "inputsenum.h"
#include <vector>
class InputController
{
public:
InputController();
InputController(const InputController&);
~InputController();
bool Initialize(HINSTANCE, HWND, int screenWidth, int screenHeight);
void Shutdown();
//this check is done in every Frame
std::vector<InputEvent>* checkDeviceInputs();
std::vector<int>* getMouseLocation();
private:
IDirectInput8* m_directInput;
KeyboardInput* keyboard;
MouseInput* mouse;
int m_screenWidth, m_screenHeight;
};
#endif
|
/**
* Definition for binary tree
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode(int x) : val(x), left(NULL), right(NULL) {}
* };
*/
class Solution {
public:
bool isValidBST(TreeNode *root) {
return isv(root, -10000000000ll, 10000000000ll);
}
bool isv(TreeNode *root, long long min, long long max) {
if(root == NULL) return true;
if((root->val <= min) || (root->val >= max)) return false;
if(!isv(root->left,min,(long long) root->val)) return false;
if(!isv(root->right, (long long) root->val,max)) return false;
return true;
}
};
|
// github.com/andy489
// https://codeforces.com/contest/475/problem/D
// https://codeforces.com/blog/entry/14168
#include <iostream>
#include <vector>
#include <unordered_map>
using namespace std;
#define ios ios::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr)
#define rep(i, s, e) for(int i=s; i<e; ++i)
typedef long long ll;
vector<vector<int>> st;
vector<int> arr, logarithm;
unordered_map<int, ll> ans;
int n;
int GCD(int a, int b) {
return b == 0 ? a : GCD(b, a % b);
}
void build() {
logarithm.resize(n + 1);
rep(i, 2, n + 1) logarithm[i] = logarithm[i / 2] + 1;
int K = logarithm[n];
st.assign(n, vector<int>(K + 1));
rep(i, 0, n) st[i][0] = arr[i];
for (int j = 1; j <= K; ++j)
for (int i = 0; i + (1 << j) <= n; ++i)
st[i][j] = GCD(st[i][j - 1], st[i + (1 << (j - 1))][j - 1]);
}
int query(int L, int R) {
int j = logarithm[R - L + 1];
return GCD(st[L][j], st[R - (1 << j) + 1][j]);
}
int next(int val, int L, int R) {
int l = R, r = n - 1, mid, pos;
while (l <= r) {
mid = (l + r) >> 1;
if (query(L, mid) == val) {
pos = mid;
l = mid + 1;
} else
r = mid - 1;
}
return pos + 1;
}
void solve() {
build();
int L, R, prevR;
rep(i, 0, n) {
L = R = prevR = i;
int currGCD = arr[i];
while (R < n) {
R = next(currGCD, L, R);
ans[currGCD] += R - prevR;
prevR = R;
if (R < n)
currGCD = GCD(currGCD, arr[R]);
}
}
}
int main() {
ios;
cin >> n;
arr.resize(n);
rep(i, 0, n) cin >> arr[i];
solve();
int q, x;
cin >> q;
while (q--) {
cin >> x;
cout << (ans.count(x) ? ans[x] : 0) << '\n';
}
return 0;
}
|
/**
* \file ItemTile.h
*
* \author PaulaRed
*
* Base class for any tile in the game
*/
#pragma once
#include <memory>
#include <string>
#include "ImageMap.h"
#include "Item.h"
#include "ItemVisitor.h"
/**
* Base class for any tile in the game
*/
class CItemTile :
public CItem
{
public:
CItemTile(CLevel* level, CGame* game, int imageID);
/// Default constructor (disabled)
CItemTile() = delete;
/// Copy constructor (disabled)
CItemTile(const CItemTile&) = delete;
/// destructor
~CItemTile() {}
virtual void SetGridLocation(int x, int y);
virtual void Draw(Gdiplus::Graphics* graphics) override;
virtual void XmlLoad(const std::shared_ptr<xmlnode::CXmlNode>& node) override;
/** Accept a visitor
* \param visitor The visitor we accept */
virtual void Accept(CItemVisitor* visitor) override { visitor->VisitTile(this); }
/** Getter for X grid position
* \returns the X grid index */
int GetGridX() const { return mGridPositionX; }
/** Getter for Y grid position
* \returns the Y grid index */
int GetGridY() const { return mGridPositionY; }
/** Getter for standard tile height
* \returns the height in pixels */
const int GetHeight() const { return TileHeight; }
/** Getter for standard tile width
* \returns the width in pixels */
const int GetWidth() const { return TileWidth; }
/// Sets the open boolean for when an item (tower) is placed or removed from the tile.
/// \param isOpen True if the tile is open for object placement
virtual void SetOpen(bool isOpen) { mOpen = isOpen; }
/// Getter for if the tile is open for tower placement or not
/// \returns True if the tile is open, false if it's occupied.
virtual bool IsOpen() { return mOpen; }
/// the constant height for every tile
const int TileHeight = 64;
/// the constant width for every tile
const int TileWidth = 64;
private:
/// The X position index when placed on the grid (not pixels!)
int mGridPositionX = 0;
/// The Y position index when placed on the grid (not pixels!)
int mGridPositionY = 0;
/// This boolean represents if this tile is able to have something placed on it, like a tower
bool mOpen = false;
};
|
#include "../apue.h"
#include "../error.c"
int glob = 6;
char buf[] = "a write to stdout\n";
int main (void){
int var;
pid_t pid;
var = 88;
if (write(STDOUT_FILENO, buf, sizeof(buf)-1) != sizeof(buf)-1)
err_sys("write error");
printf("before fork\n");
if ((pid = fork()) < 0){
err_sys("forl error");
}else if(pid == 0){
glob++;
}else{
sleep(2);
}
printf("pid = %d, glob = %d, var %d\n", getpid(), glob, var);
exit(0);
}
|
#include <windows.h>
#include <gl/glut.h>
void DoDisplay();
void DoMenu(int value);
int Action;
int APIENTRY WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance
,LPSTR lpszCmdParam,int nCmdShow)
{
glutCreateWindow("OpenGL");
glutDisplayFunc(DoDisplay);
glutCreateMenu(DoMenu);
glutAddMenuEntry("점 찍기",0);
glutAddMenuEntry("10픽셀로 점 확대",1);
glutAddMenuEntry("선그리기",2);
glutAddMenuEntry("선 연결하기",3);
glutAddMenuEntry("여러 개의 선 긋기",4);
glutAddMenuEntry("선 굵기 변경",5);
glutAddMenuEntry("선 모양 변경",6);
glutAddMenuEntry("삼각형",7);
glutAddMenuEntry("삼각형 이어 그리기",8);
glutAddMenuEntry("삼각형 팬",9);
glutAddMenuEntry("사각형",10);
glutAddMenuEntry("마름모",11);
glutAddMenuEntry("다각형",12);
glutAddMenuEntry("분할한 다각형",13);
glutAttachMenu(GLUT_RIGHT_BUTTON);
glutMainLoop();
return 0;
}
void DoMenu(int value)
{
if (value < 100) {
Action = value;
glClearColor(0.0, 0.0, 0.0, 1.0);
glColor3f(1.0, 1.0, 1.0);
glPointSize(1.0);
glLineWidth(1);
glDisable(GL_LINE_STIPPLE);
glutPostRedisplay();
return;
}
}
void DoDisplay()
{
switch(Action) {
case 0:
// 점 찍기
glClear(GL_COLOR_BUFFER_BIT);
glBegin(GL_POINTS);
glVertex2f(0.0, 0.5);
glVertex2f(-0.5, -0.5);
glVertex2f(0.5, -0.5);
glEnd();
glFlush();
break;
case 1:
// 10픽셀로 점 확대
glClear(GL_COLOR_BUFFER_BIT);
glPointSize(10.0);
glBegin(GL_POINTS);
glVertex2f(0.0, 0.5);
glVertex2f(-0.5, -0.5);
glVertex2f(0.5, -0.5);
glEnd();
glFlush();
break;
case 2:
// 선그리기
glClear(GL_COLOR_BUFFER_BIT);
glBegin(GL_LINE_STRIP);
glVertex2f(0.0, 0.5);
glVertex2f(-0.5, -0.5);
glVertex2f(0.5, -0.5);
glEnd();
glFlush();
break;
case 3:
// 선 연결하기
glClear(GL_COLOR_BUFFER_BIT);
glBegin(GL_LINE_LOOP);
glVertex2f(0.0, 0.5);
glVertex2f(-0.5, -0.5);
glVertex2f(0.5, -0.5);
glEnd();
glFlush();
break;
case 4:
{
// 여러 개의 선 긋기
glClear(GL_COLOR_BUFFER_BIT);
glBegin(GL_LINES);
GLfloat x = -0.8;
GLfloat y = 0.4;
for (int i = 0; i < 6; i++) {
glVertex2f(x, y);
x += 0.3;
y *= -1;
}
glEnd();
glFlush();
}
break;
case 5:
{
// 선 굵기 변경
glClear(GL_COLOR_BUFFER_BIT);
GLfloat y;
GLfloat w = 1;
for (y = 0.8; y > -0.8;y -= 0.2) {
glLineWidth(w++);
glBegin(GL_LINES);
glVertex2f(-0.8, y);
glVertex2f(0.8, y);
glEnd();
}
glFlush();
}
break;
case 6:
{
// 선 모양 변경
GLushort arPat[]={0xaaaa,0xaaaa,0xaaaa,0xaaaa,0x33ff,0x33ff,0x33ff,0x57ff,0x57ff };
GLint arFac[] = { 1, 2, 3, 4, 1, 2, 3, 1, 2};
glClear(GL_COLOR_BUFFER_BIT);
glEnable(GL_LINE_STIPPLE);
GLfloat y;
GLint idx = 0;
for (y = 0.8; y > -0.8;y -= 0.2) {
glLineStipple(arFac[idx], arPat[idx]);
glBegin(GL_LINES);
glVertex2f(-0.8, y);
glVertex2f(0.8, y);
glEnd();
idx++;
}
glFlush();
}
break;
case 7:
{
// 삼각형
glClear(GL_COLOR_BUFFER_BIT);
glBegin(GL_TRIANGLES);
GLfloat x = -0.8;
GLfloat y = 0.4;
for (int i = 0; i < 6; i++) {
glVertex2f(x, y);
x += 0.3;
y *= -1;
}
glEnd();
glFlush();
}
break;
case 8:
{
// 삼각형 이어 그리기
glClear(GL_COLOR_BUFFER_BIT);
glShadeModel(GL_FLAT);
glBegin(GL_TRIANGLE_STRIP);
GLfloat x = -0.8;
GLfloat y = 0.4;
for (int i = 0; i < 6; i++) {
if (i % 2 == 0) {
glColor3f(1.0, 0.0, 0.0);
} else {
glColor3f(0.0, 1.0, 0.0);
}
glVertex2f(x, y);
x += 0.3;
y *= -1;
}
glEnd();
glFlush();
}
break;
case 9:
// 삼각형 팬
glClear(GL_COLOR_BUFFER_BIT);
glShadeModel(GL_FLAT);
glBegin(GL_TRIANGLE_FAN);
glColor3f(1.0, 0.0, 0.0);
glVertex2f(0.0, 0.0);
glVertex2f(0.0, 0.5);
glVertex2f(-0.35, 0.35);
glColor3f(0.0, 1.0, 0.0);
glVertex2f(-0.5, 0.0);
glColor3f(1.0, 0.0, 0.0);
glVertex2f(-0.35, -0.35);
glColor3f(0.0, 1.0, 0.0);
glVertex2f(0.0, -0.5);
glEnd();
glFlush();
break;
case 10:
// 사각형
glClear(GL_COLOR_BUFFER_BIT);
glRectf(-0.8, 0.8, 0.8, -0.8);
glFlush();
break;
case 11:
// 마름모
glClear(GL_COLOR_BUFFER_BIT);
glBegin(GL_QUADS);
glVertex2f(0.0, 0.5);
glVertex2f(-0.5, 0.0);
glVertex2f(0.0, -0.5);
glVertex2f(0.5, 0.0);
glEnd();
glFlush();
break;
case 12:
// 다각형
glClear(GL_COLOR_BUFFER_BIT);
glBegin(GL_POLYGON);
glVertex2f(0.0, 0.5);
glVertex2f(-0.5, 0.0);
glVertex2f(0.5, 0.0);
glVertex2f(0.0, -0.5);
glEnd();
glFlush();
break;
case 13:
// 분할한 다각형
glClear(GL_COLOR_BUFFER_BIT);
glBegin(GL_TRIANGLES);
glVertex2f(0.0, 0.5);
glVertex2f(-0.5, 0.0);
glVertex2f(0.0, 0.0);
glVertex2f(0.0, 0.0);
glVertex2f(0.5, 0.0);
glVertex2f(0.0, -0.5);
glEnd();
glFlush();
break;
}
}
|
#include <gtest/gtest.h>
#include <Expected.h>
#include <Errors.h>
#include "Common.h"
TEST(ErrorList, handleAllErrors_ListOrder)
{
auto expected = Expected_AlwaysErrorList();
EXPECT_FALSE(isInSuccessState(expected));
int order = 0;
llvm::handleAllErrors(expected.takeError(),
[&](const llvm::StringError &err) {
EXPECT_EQ(1, order); // handled second
++order;
},
[&](ExtraPayloadError &err) {
consumeExtraPayload(err.takeExtraPayload());
EXPECT_EQ(0, order); // handled first
++order;
},
[](const llvm::ErrorInfoBase &err) {
EXPECT_TRUE(false); // unreachable
}
);
}
TEST(ErrorList, handleAllErrors_MultiLevelOrder)
{
auto expectedA = Expected_AlwaysExtraPayloadError();
auto expectedB = Expected_AlwaysStringError();
auto errorList2 = llvm::joinErrors(expectedA.takeError(),
expectedB.takeError());
auto EC = std::make_error_code(std::errc::invalid_argument);
auto errorList3 = llvm::joinErrors(std::move(errorList2),
llvm::errorCodeToError(EC));
auto errorList4 = llvm::joinErrors(llvm::Error::success(),
std::move(errorList3));
// errorList4:
// ErrorList
// / \
// ErrorSuccess ErrorList
// / \
// ErrorList ECError
// / \
// ExtraPayloadError StringError
int order = 0;
llvm::handleAllErrors(std::move(errorList4),
[&](const llvm::ErrorList &err) {
EXPECT_TRUE(false); // unreachable
},
[&](ExtraPayloadError &err) {
consumeExtraPayload(err.takeExtraPayload());
EXPECT_EQ(0, order); // first (Success won't call back)
++order;
},
[&](const llvm::StringError &err) {
EXPECT_EQ(1, order); // second
++order;
},
[&](const llvm::ECError &err) {
EXPECT_EQ(2, order); // last
++order;
},
[](const llvm::ErrorInfoBase &err) {
EXPECT_TRUE(false); // unreachable
}
);
}
|
#pragma once
/*
*基于C++template实现的单链表类
*作者:刘涵
*时间:2017/11/13
*/
#ifndef _SINGLELIST_H
#define _SINGLELIST_H
//结点结构
template<class T>
class Node
{
public:
Node() = default;
Node(T _value,Node* _next):value(_value),next(_next){}
public:
T value;
Node* next;
};
//单链表
template<class T>
class SingleList
{
public:
typedef Node<T>* pointer;//用来遍历链表
SingleList();
~SingleList();
int size();//获取长度
bool isEmpty();//判断是否为空
Node<T>* insert(int index, T t);//在指定位置进行插入
Node<T>* insert_head(T t);//在链表头插入
Node<T>* insert_last(T t);//在链尾插入
Node<T>* del(int index);//在指定位置删除
Node<T>* del_head();//删除链表头
Node<T>* del_last();//删除表尾
T get(int index);//获取指定位置的元素
T get_head();//获取链表头元素
T get_last();//获取链表尾元素
Node<T>* getHead();//获取链表头结点
private:
int count;
Node<T>* head;//头结点
private:
Node<T>* getNode(int index);//获取指定位置的结点
};
template<class T>
SingleList<T>::SingleList():count(0),head(nullptr)
{
//创建头结点
head = new Node<T>();
head->next = nullptr;
}
template<class T>
SingleList<T>::~SingleList()
{
Node<T>* node = head->next;
while (node!=nullptr)
{
Node<T>* temp = node;
node = node->next;
delete temp;
}
}
template<class T>
int SingleList<T>::size()
{
return count;
}
template<class T>
bool SingleList<T>::isEmpty()
{
return count == 0;
}
template<class T>
Node<T>* SingleList<T>::insert(int index, T t)
{
Node<T>* node = getNode(index);
if (node)
{
Node<T>* newnode = new Node<T>(t, node->next);
node->next = newnode;
count++;
return newnode;
}
return nullptr;
}
template<class T>
Node<T>* SingleList<T>::insert_head(T t)
{
return insert(0, t);
}
template<class T>
Node<T>* SingleList<T>::insert_last(T t)
{
return insert(count, t);
}
template<class T>
Node<T>* SingleList<T>::getHead()
{
return head->next;
}
template<class T>
T SingleList<T>::get(int index)
{
Node<T>* node = getNode(index);
node = node->next;
return node->value;
}
template<class T>
T SingleList<T>::get_head()
{
return get(0);
}
template<class T>
T SingleList<T>::get_last()
{
return get(count);
}
template<class T>
Node<T>* SingleList<T>::getNode(int index)//返回指定索引的前一个位置结点,若链表为空,则返回头结点
{
if (index > count || index < 0)
return nullptr;
int temp = 0;
Node<T>* node = head;
while (temp < index)
{
temp++;
node = node->next;
}
return node;
}
template<class T>
Node<T>* SingleList<T>::del(int index)
{
if (isEmpty())
return nullptr;
Node<T>* node = getNode(index);
Node<T>* delnode = node->next;
node->next = delnode->next;
delete delnode;
count--;
return node->next;
}
template<class T>
Node<T>* SingleList<T>::del_head()
{
return del(0);
}
template<class T>
Node<T>* SingleList<T>::del_last()
{
return del(count);
}
#endif // !_SINGLELIST_H
|
#pragma once
#include <iostream>
enum MonsterType
{
Ogr,
Goblin,
Orc,
Skelet,
Troll
};
struct Monster
{
MonsterType type;
std::string name;
int hp;
uint16_t speed;
};
std::string GetMonsterInfo(Monster monster);
std::string GetMonsterTypeName(MonsterType type);
|
#include "Player.hpp"
Player::Player( void ) : _name(1), _color(0x000000), _capturedPawns(0)
{
return ;
}
Player::Player( int name, int color ) : _name(name), _color(color), _capturedPawns(0)
{
return ;
}
Player::~Player( void )
{
return ;
}
Player::Player( Player const & src )
{
*this = src;
}
Player & Player::operator=( Player const & rhs )
{
if ( this != &rhs )
{
}
return ( *this );
}
std::pair<int, int> Player::play(Board* currentBoard, std::pair<int, int> xy)
{
// std::cout << this->_name << " playing" << std::endl;
(void)currentBoard;
return xy;
}
bool Player::referee(Board* currentBoard, std::pair<int, int> key)
{
int x = key.first;
int y = key.second;
if (x > 18 || x < 0 || y > 18 || y < 0)
{
return ( false );
}
if (currentBoard->findPawn(x, y))
{
return (false);
}
if (isDoubleThree(currentBoard, key))
{
return ( false );
}
return ( true );
}
bool Player::isDoubleThreeForVector(Board* board, std::pair<int, int> key, std::pair<int, int> v)
{
Pawn *tmp1;
int tmp1_x = key.first + v.first;
int tmp1_y = key.second + v.second;
Pawn *tmp2;
int tmp2_x = tmp1_x + v.first;
int tmp2_y = tmp1_y + v.second;
Pawn *tmp3;
int tmp3_x = tmp2_x + v.first;
int tmp3_y = tmp2_y + v.second;
Pawn *tmp4;
int tmp4_x = tmp3_x + v.first;
int tmp4_y = tmp3_y + v.second;
Pawn *tmpOposite;
int tmpO_x = key.first - v.first;
int tmpO_y = key.second - v.second;
Pawn *tmpOpositeNext;
int tmpOpositeNext_x = tmpO_x - v.first;
int tmpOpositeNext_y = tmpO_y - v.second;
// _ 0 0 X 0
// 3 2 1 X O
if (board->isPairInsideBoard(tmp1_x, tmp1_y) && board->isPairInsideBoard(tmp2_x, tmp2_y) && board->isPairInsideBoard(tmpO_x, tmpO_y))
{
//if we are on the situation with three pawns aligned ? ? 0 X _ [X: the pawn we are checking | 0: current player pawn]
tmp1 = board->findPawn(tmp1_x, tmp1_y);
tmp2 = board->findPawn(tmp2_x, tmp2_y);
tmpOposite = board->findPawn(tmpO_x, tmpO_y);
if (tmp1 != NULL && tmpOposite != NULL && tmp1->getPlayer()->getName() == this->getName() && tmpOposite->getPlayer()->getName() == this->getName())
{
tmpOpositeNext = board->findPawn(tmpOpositeNext_x, tmpOpositeNext_y);
if (tmp2 == NULL && tmpOpositeNext == NULL)
return true;
}
if (tmp1 != NULL && tmp1->getPlayer()->getName() == this->getName())
{
// ? 0 0 X _
tmp3 = board->findPawn(tmp3_x, tmp3_y);
if (tmp2 != NULL && tmp2->getPlayer()->getName() == this->getName())
{
//? 0 0 X _ TRUE ? 0 0 X . FALSE
return (tmpOposite == NULL && tmp3 == NULL);
}
}
else if (board->isPairInsideBoard(tmp3_x, tmp3_y)) // ? ? _ X _
{
tmp3 = board->findPawn(tmp3_x, tmp3_y);
tmp4 = board->findPawn(tmp4_x, tmp4_y);
if (tmp2 != NULL && tmp2->getPlayer()->getName() == this->getName() &&
tmp3 != NULL && tmp3->getPlayer()->getName() == this->getName())
{
return (tmpOposite == NULL && tmp4 == NULL);
}
}
}
return false;
}
bool Player::isDoubleThree(Board* currentBoard, std::pair<int, int> key)
{
int doubleThreeTab[8] = {0};
int res = 0;
//checkin if there is a double three situation in each direction vector
doubleThreeTab[0] = (isDoubleThreeForVector(currentBoard, key, std::make_pair(-1, 0))) ? 1 : 0; //left
if (doubleThreeTab[0] == 0)
doubleThreeTab[1] = (isDoubleThreeForVector(currentBoard, key, std::make_pair(1, 0))) ? 1 : 0; //right
doubleThreeTab[2] = (isDoubleThreeForVector(currentBoard, key, std::make_pair(-1, -1))) ? 1 : 0; //bottom left
if (doubleThreeTab[2] == 0)
doubleThreeTab[3] = (isDoubleThreeForVector(currentBoard, key, std::make_pair(1, 1))) ? 1 : 0; //top right
doubleThreeTab[4] = (isDoubleThreeForVector(currentBoard, key, std::make_pair(-1, 1))) ? 1 : 0; //top left
if (doubleThreeTab[4] == 0)
doubleThreeTab[5] = (isDoubleThreeForVector(currentBoard, key, std::make_pair(1, -1))) ? 1 : 0; //bottom right
doubleThreeTab[6] = (isDoubleThreeForVector(currentBoard, key, std::make_pair(0, 1))) ? 1 : 0; //top
if (doubleThreeTab[6] == 0)
doubleThreeTab[7] = (isDoubleThreeForVector(currentBoard, key, std::make_pair(0, -1))) ? 1 : 0; //bottom
for (int s = 0; s < 8; s++)
{
if (doubleThreeTab[s] > 0)
res++;
}
return (res >= 2);
}
int Player::getName() const
{
return this->_name;
}
int Player::getColor() const
{
return this->_color;
}
void Player::setOpponent(Player* opponent)
{
_opponent = opponent;
return ;
}
|
#pragma once
#include "../pch.h"
//#include "Player.h"
class Player;
class Game;
#include "../Cards/Cards.h"
#include "../GameCore/GameCore.h"
class Strategy {
public:
Strategy();
virtual Card* buyCard(Player* player, CardSpace& cardSpace, Deck& deck);
virtual void performAction(Game* game, Player* player, Card* cardBeingPurchased);
static Card* autoBuyCard(Player* player, CardSpace& cardSpace, Deck& deck, string strategy);
static void autoPerformAction(Game* game, Player* player, Card* cardBeingPurchased, string strategy);
};
class HumanStrategy : public Strategy {
public:
HumanStrategy();
Card* buyCard(Player* player, CardSpace& cardSpace, Deck& deck);
void performAction(Game* game, Player* player, Card* cardBeingPurchased);
};
class GreedyStrategy : public Strategy {
public:
GreedyStrategy();
Card* buyCard(Player* player, CardSpace& cardSpace, Deck& deck);
void performAction(Game* game, Player* player, Card* cardBeingPurchased);
};
class ModerateStrategy : public Strategy {
public:
ModerateStrategy();
Card* buyCard(Player* player, CardSpace& cardSpace, Deck& deck);
void performAction(Game* game, Player* player, Card* cardBeingPurchased);
};
|
#include<bits/stdc++.h>
using namespace std;
int a[100010];
struct SegmentTree{
int s,e;
vector<int> v;
SegmentTree *l, *r;
void build(int start, int end){
s = start;
e = end;
if(s!=e){
l = new SegmentTree;
r = new SegmentTree;
l->build(s,(s+e)/2);
r->build((s+e)/2+1,e);
int xs = l->v.size();
int ys = r->v.size();
int x=0,y=0;
while(x<xs || y<ys){
int vx = 1e9+10, vy = 1e9+10;
if(x<xs) vx = l->v[x];
if(y<ys) vy = r->v[y];
if(vx < vy){
v.push_back(vx);
x++;
} else {
v.push_back(vy);
y++;
}
}
} else v.push_back(a[s]);
}
int get(int tarS, int tarE, int k){
if(e<tarS||tarE<s) return 0;
else if(tarS<=s&&e<=tarE){
int ub = upper_bound(v.begin(),v.end(),k)-v.begin();
return v.size()-ub;
} else return l->get(tarS,tarE,k) + r->get(tarS,tarE,k);
}
};
int n;
int main(){
scanf("%d",&n);
for(int i=0;i<n;i++) scanf("%d",&a[i]);
SegmentTree* st = new SegmentTree;
st->build(0,n-1);
int m;
scanf("%d",&m);
for(int i=0;i<m;i++){
int x,y,k;
scanf("%d %d %d",&x,&y,&k);
printf("%d\n",st->get(x-1,y-1,k));
}
}
|
#ifndef _INDEXED_LINE_SET_HPP_
#define _INDEXED_LINE_SET_HPP_
// VRML'97
//
// IndexedLineSet {
// eventIn MFInt32 set_colorIndex
// eventIn MFInt32 set_coordIndex
// exposedField SFNode coord NULL
// field MFInt32 coordIndex [] # [-1,)
// exposedField SFNode color NULL
// field MFInt32 colorIndex [] # [-1,)
// field SFBool colorPerVertex TRUE
// }
#include "Node.hpp"
#include <vector>
using namespace std;
class IndexedLineSet : public Node {
private:
vector<float> _coord;
vector<int> _coordIndex;
vector<float> _color;
vector<int> _colorIndex;
bool _colorPerVertex;
public:
IndexedLineSet();
void clear();
bool& getColorPerVertex();
vector<float>& getCoord();
vector<int>& getCoordIndex();
vector<float>& getColor();
vector<int>& getColorIndex();
int getNumberOfPolylines();
int getNumberOfCoord();
int getNumberOfColor();
void setColorPerVertex(bool value);
virtual bool isIndexedLineSet() const { return true; }
virtual string getType() const { return "IndexedLineSet"; }
typedef bool (*Property)(IndexedLineSet& ifs);
typedef void (*Operator)(IndexedLineSet& ifs);
// can be used for debugging
virtual void printInfo(string indent);
};
#endif // _INDEXED_LINE_SET_HPP_
|
#include "precompiled.h"
#include "mathematics.h"
#include "gameCT.h"
void GameCT::drawGameOver(sf::RenderWindow& windowView) {
sf::Texture texture;
texture.loadFromFile("./textures/gameOver.jpg");
sf::Sprite sprite;
sprite.setPosition(Xyla::getCenterPosition(sf::Vector2f(1920, 1080), (sf::Vector2f) texture.getSize()));
sprite.setTexture(texture);
sf::FloatRect size = sprite.getLocalBounds();
windowView.draw(sprite);
sf::Text text;
sf::Font font;
font.loadFromFile("./fonts/jmh_typewriter/JMH Typewriter.ttf");
text.setColor(sf::Color::Green);
text.setFont(font);
text.setCharacterSize(24);
text.setPosition(0, 30);
std::string str = "press c to start a new game or exit the game";
text.setString(str);
text.setStyle(sf::Text::Bold | sf::Text::Underlined);
windowView.draw(text);
}
|
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>
using namespace std;
using namespace cv;
#define WINDOW_NAME1 "[原始图片]"
#define WINDOW_NAME2 "[效果窗口]"
Mat g_srcImage;
Mat g_templateImage;
Mat g_resultImage;
int g_nMatchMethod;
int g_nMaxTrackbarNum = 5;
void on_Matching(int, void*);
int main(int argc, char *argv[]) {
// [1] 载入原图和模板块
g_srcImage = imread("beauty.jpg", 1);
g_templateImage = imread("beauty_face.jpg", 1);
// [2] 创建窗口
namedWindow(WINDOW_NAME1, CV_WINDOW_AUTOSIZE);
namedWindow(WINDOW_NAME2, CV_WINDOW_AUTOSIZE);
// [3] 创建滚动条并进行一次初始化
createTrackbar("方法", WINDOW_NAME1, &g_nMatchMethod, g_nMaxTrackbarNum, on_Matching);
on_Matching(0, 0);
waitKey(0);
return 0;
}
void on_Matching(int, void*) {
// [1] 给局部变量初始化
Mat srcImage;
g_srcImage.copyTo(srcImage);
// [2] 初始化用于结果输出的矩阵
int resultImage_cols = g_srcImage.cols - g_templateImage.cols + 1;
int resultImage_rows = g_srcImage.rows - g_templateImage.rows + 1;
g_resultImage.create(resultImage_cols, resultImage_rows, CV_32FC1);
// [3] 进行匹配和标准化
matchTemplate(g_srcImage, g_templateImage, g_resultImage, g_nMatchMethod);
normalize(g_resultImage, g_resultImage, 0, 1, NORM_MINMAX, -1, Mat());
// [4] 通过函数minMaxLoc定位最匹配的位置
double minValue;
double maxValue;
Point minLocation;
Point MaxLocation;
Point matchLocation;
minMaxLoc(g_resultImage, &minValue, &maxValue, &minLocation, &MaxLocation, Mat());
// [5] 对于方法SQDIFF和SQDIFF_NORMED, 越小的数值有着更高的匹配结果, 而其余的方法, 数值越大匹配效果越好
if (g_nMatchMethod == TM_SQDIFF || g_nMatchMethod == TM_SQDIFF_NORMED) {
matchLocation = minLocation;
}
else {
matchLocation = MaxLocation;
}
// [6] 绘制出矩形, 并显示最终结果
rectangle(srcImage, matchLocation, Point(matchLocation.x + g_templateImage.cols, matchLocation.y + g_templateImage.rows),
Scalar(0, 0, 255), 2, 8, 0);
rectangle(g_resultImage, matchLocation, Point(matchLocation.x + g_templateImage.cols, matchLocation.y + g_templateImage.rows),
Scalar(0, 0, 255), 2, 8, 0);
imshow(WINDOW_NAME1, srcImage);
imshow(WINDOW_NAME2, g_resultImage);
}
|
/*********************************************************************
Matt Marchant 2014 - 2016
http://trederia.blogspot.com
xygine - Zlib license.
This software is provided 'as-is', without any express or
implied warranty. In no event will the authors be held
liable for any damages arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute
it freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented;
you must not claim that you wrote the original software.
If you use this software in a product, an acknowledgment
in the product documentation would be appreciated but
is not required.
2. Altered source versions must be plainly marked as such,
and must not be misrepresented as being the original software.
3. This notice may not be removed or altered from any
source distribution.
*********************************************************************/
#ifndef XY_UI_SCORE_LIST_HPP_
#define XY_UI_SCORE_LIST_HPP_
#include <xygine/ui/Control.hpp>
#include <xygine/Score.hpp>
#include <SFML/Graphics/Text.hpp>
#include <memory>
namespace xy
{
namespace UI
{
/*!
\brief An animated scrolling list of items for displaying scores.
Designed for specifically displaying xy::Scores::Item - could
probably be made to be more flexible
*/
class XY_EXPORT_API ScoreList final : public Control
{
public:
/*!
\brief Constructor
\param sf::Font Font to use for th displayed text
*/
explicit ScoreList(const sf::Font&);
~ScoreList() = default;
/*!
\see Control
*/
bool selectable() const override;
/*!
\see Control
*/
void select() override;
/*!
\see Control
*/
void deselect() override;
/*!
\see Control
*/
void activate() override;
/*!
\see Control
*/
void deactivate() override;
/*!
\see Control
*/
void handleEvent(const sf::Event&, const sf::Vector2f&) override;
/*!
\see Control
*/
void update(float) override;
/*!
\see Control
*/
void setAlignment(Alignment) override;
/*!
\see Control
*/
bool contains(const sf::Vector2f&) const override;
/*!
\brief Scrolls the item list a given distance
*/
void scroll(float);
/*!
\brief Sets the list of Scores::Items to display
*/
void setList(const std::vector<Scores::Item>&);
/*!
\brief Set the currently selected index
*/
void setIndex(Index);
/*!
\brief Get the vertical spacing between items
As fonts vary in size as does the distance between
items in the list. Use this to determine how far to
scroll when switching between items
*/
float getVerticalSpacing() const;
private:
std::vector<sf::Text> m_texts;
sf::FloatRect m_bounds;
const sf::Font& m_font;
float m_scrollTargetDistance;
float m_scrollCurrentDistance;
float m_scrollSpeed;
bool m_doScroll;
void draw(sf::RenderTarget&, sf::RenderStates) const override;
void updateTexts(float);
};
}
}
#endif //XY_UI_SCORE_LIST_HPP_
|
#include "client_main_window.h"
#include "ui_client_main_window.h"
#include <common/dwiz_assert.h>
#include <common/network/network_connector_factory_interface.h>
#include <common/protocols/login_protocol_interface.h>
#include <common/protocols/protocol_factory_interface.h>
#include <common_qt/error_handler/qt_error_handler_interface.h>
#include <QCloseEvent>
namespace dwiz
{
ClientMainWindow::ClientMainWindow(QWidget* const f_parent, Qt::WindowFlags const f_flags)
: QMainWindow(f_parent, f_flags)
, m_ui(new Ui::ClientMainWindowUi())
{
m_ui->setupUi(this);
setCentralWidget(m_ui->stackedWidget);
}
ClientMainWindow::~ClientMainWindow() = default;
void ClientMainWindow::init(
std::unique_ptr<QtErrorHandlerInterface> f_error_handler,
std::unique_ptr<NetworkConnectorFactoryInterface> f_networkConnectorFactory,
std::unique_ptr<ProtocolFactoryInterface> f_protocolFactory)
{
DWIZ_ASSERT(f_error_handler != nullptr);
DWIZ_ASSERT(f_networkConnectorFactory != nullptr);
DWIZ_ASSERT(f_protocolFactory != nullptr);
m_error_handler = std::move(f_error_handler);
// m_networkConnectorFactory = std::move(f_networkConnectorFactory);
m_networkConnector = f_networkConnectorFactory->createNetworkConnector();
m_protocolFactory = std::move(f_protocolFactory);
m_ui->loginPage->setErrorHandler(m_error_handler);
m_ui->loginPage->setNetworkConnector(m_networkConnector);
m_ui->loginPage->setLoginProtocol(m_protocolFactory->createLoginProtocol());
}
void ClientMainWindow::closeEvent(QCloseEvent* f_event)
{
f_event->accept();
emit closed();
}
} // namespace dwiz
|
#include "../include/hdivider_worker.h"
|
#pragma once
#include <assert.h>
#include <array>
#include "MemoryPoolElement.h"
namespace GraphicsEngine
{
template<typename Type, size_t Size>
class MemoryPool
{
public:
MemoryPool()
{
m_activeElements = 0;
m_firstAvailable = &m_pool[0];
// Initialize a list of available elements:
for (size_t i = 0; i < m_pool.size() - 1; i++)
m_pool[i].SetNext(&m_pool[i + 1]);
// Set the last element to end with a nullptr:
m_pool[Size - 1].SetNext(nullptr);
}
~MemoryPool() = default;
template<typename... ArgumentsType>
Type& NewElement(ArgumentsType&&... arguments)
{
// Make sure that the pool isn't full:
assert(m_firstAvailable != nullptr);
++m_activeElements;
// Remove new element from the list of available elements:
auto& newElement = *m_firstAvailable;
m_firstAvailable = newElement.GetNext();
// Initialize element:
newElement.Initialize(std::forward<ArgumentsType>(arguments)...);
// Return pointer to element:
return newElement.GetElement();
}
void DeleteElement(Type& element)
{
// Calculating the index of the element:
auto baseAddress = reinterpret_cast<size_t>(&m_pool[0]);
auto elementAddress = reinterpret_cast<size_t>(&element);
auto index = (elementAddress - baseAddress) / sizeof(MemoryPoolElement<Type>);
auto& poolElement = m_pool[index];
if (poolElement.IsInitialized())
{
poolElement.Shutdown(m_firstAvailable);
m_firstAvailable = &poolElement;
--m_activeElements;
}
}
Type& operator[](size_t index)
{
return m_pool[index].GetElement();
}
size_t GetActiveElements() const
{
return m_activeElements;
}
static constexpr size_t GetMaxSize()
{
return Size;
}
private:
std::array<MemoryPoolElement<Type>, Size> m_pool;
size_t m_activeElements;
MemoryPoolElement<Type>* m_firstAvailable;
};
}
|
#pragma once
#include <2D-Game-Engine/Scene.h>
#define NUM_STARS 50
#define NUM_BULLETS 1000
#define RELOAD_TIME 16
#define BULLET_SPEED 9.6f
#define STAR_SPEED 2.75f
#define NUM_ASTEROIDS 50
struct Bullet : public Engine::StaticSprite {
bool isAlive;
bool isFriendly;
};
struct Asteroid : public Engine::StaticSprite {
int life;
};
class GameScene : public Engine::Scene {
public:
void initScene() override;
void update(float dt) override;
private:
Engine::AnimatedSprite m_Player;
int m_PlayerHealth;
Bullet m_Bullets[NUM_BULLETS];
int m_CurrentBulletTime;
bool m_Reloaded;
Engine::StaticSprite m_Stars[NUM_STARS];
Engine::SpriteFont m_Font;
Engine::Label m_TimeLabel;
int m_CurrentTime;
Asteroid m_Asteroids[NUM_ASTEROIDS];
int m_AsteroidTime;
int m_Score;
Engine::Label m_ScoreLabel;
};
|
#include <ESP8266WiFi.h>
#include <Wire.h> //I2C needed for sensors
#include "MPL3115A2.h" //Pressure sensor
#include "DHT.h"
#define DHTPIN 2 //Pin to attach the DHT (pinD4 en el node)
#define DHTTYPE DHT11 //type of DTH
const char* ssid = "Network";
const char* password = "****";
const int sleepTimeS = 60; //18000 for Half hour, 300 for 5 minutes etc.
const byte WDIR = A0;
const byte WSPEED = 14;
///////////////Weather////////////////////////
char server [] = "weatherstation.wunderground.com";
char WEBPAGE [] = "GET /weatherstation/updateweatherstation.php?";
char ID [] = "IREGINDE61";
char PASSWORD [] = "vIcente25";
MPL3115A2 myPressure; //Create an instance of the pressure sensor
/////////////IFTTT///////////////////////
//////////////////////////////////////////
DHT dht(DHTPIN, DHTTYPE);
void setup()
{
Serial.begin(9600);
dht.begin();
Wire.begin(4, 5);
pinMode(WDIR, INPUT);
pinMode(WSPEED, INPUT_PULLUP); // input from wind meters windspeed sensor
//Configure the pressure sensor
myPressure.begin(); // Get sensor online
myPressure.setModeBarometer(); // Measure pressure in Pascals from 20 to 110 kPa
myPressure.setOversampleRate(128); // Set Oversample to the recommended 128
myPressure.enableEventFlags(); // Enable all three pressure and temp event flags
myPressure.setModeActive(); // Go to active mode and start measuring!
delay(100);
Serial.println();
Serial.println();
Serial.println("Inicializando Sistema ");
Serial.print("Conectando a ");
Serial.println(ssid);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
Serial.println("");
Serial.println("WiFi connected");
Serial.println("IP address: ");
Serial.println(WiFi.localIP());
}
void loop(){
//Check battery
// int level = analogRead(A0);
// level = map(level, 0, 1024, 0, 100);
// if(level<50)
// {
// mandarNot(); //Send IFTT
// Serial.println("Low batter");
// delay(500);
// }
//Get sensor data
Serial.println("Leyendo sensor");
float tempc = dht.readTemperature();
Serial.println("Sensor leido");
Serial.print("Temperatura: ");
Serial.print(tempc);
Serial.print(" C ");
float tempf = (tempc * 9.0)/ 5.0 + 32.0;
Serial.print(tempf);
Serial.println(" F");
float humidity = dht.readHumidity();
Serial.print("Humedad: ");
Serial.print(humidity);
Serial.println(" %");
double dewptf = (dewPoint(tempf, dht.readHumidity()));
Serial.print("Punto de rocio: ");
Serial.println(dewptf);
float pressure = myPressure.readPressure();
Serial.print("Pressure: ");
Serial.println(pressure);
float presion=pressure *=0.000295301;
Serial.print("Presion: ");
Serial.println(presion);
//check sensor data
Serial.println("+++++++++++++++++++++++++");
Serial.print("tempF= ");
Serial.print(tempf);
Serial.println(" *F");
Serial.print("tempC= ");
Serial.print(tempc);
Serial.println(" *C");
Serial.print("dew point= ");
Serial.println(dewptf);
Serial.print("humidity= ");
Serial.println(humidity);
//Send data to Weather Underground
Serial.print("connecting to ");
Serial.println(server);
WiFiClient client;
if (!client.connect(server, 80)) {
Serial.println("Conection Fail");
return;
}
client.print(WEBPAGE);
client.print("ID=");
client.print(ID);
client.print("&PASSWORD=");
client.print(PASSWORD);
client.print("&dateutc=");
client.print("now");
client.print("&tempf=");
client.print(tempf);
// client.print("&dewptf=");
// client.print(dewptf);
client.print("&humidity=");
client.print(humidity);
client.print("&softwaretype=ESP%208266O%20version1&action=updateraw&realtime=1&rtfreq=2.5");
client.println();
delay(500);
while(client.available()){
String line = client.readStringUntil('\r');
Serial.print(line);
}
Serial.println();
Serial.println("closing connection");
Serial.println(server);
Serial.print(WEBPAGE);
Serial.print("ID=");
Serial.print(ID);
Serial.print("&PASSWORD=");
Serial.print(PASSWORD);
Serial.print("&dateutc=");
Serial.print("now");
Serial.print("&tempf=");
Serial.print(tempf);
Serial.print("&dewptf=");
Serial.print(dewptf);
Serial.print("&humidity=");
Serial.print(humidity);
Serial.print("&softwaretype=ESP%208266O%20version1&action=updateraw&realtime=1&rtfreq=2.5");
Serial.println();
// sleepMode();
}
double dewPoint(double tempc, double humidity) //Calculate dew Point
{
double AA= 17.271;
double Ab= 237.7;
Serial.print("Temperatura: ");
Serial.print(tempc);
Serial.println(" C ");
Serial.print("Humedad: ");
Serial.println(humidity);
double Ac= 0.01;
//log(humidity*0.01);
Serial.print("Ac ");
Serial.println(Ac);
double SUM = (AA * tempc) / (Ab + tempc) + Ac;
Serial.println("SUM ");
Serial.println(SUM);
double VP = (Ab * SUM) / (AA - SUM);
Serial.print("VP ");
Serial.println(VP);
double BB= VP;
Serial.print("BB ");
Serial.println(BB);
return BB;
}
void sleepMode(){
Serial.print(F("Sleeping..."));
// ESP.deepSleep(sleepTimeS * 1000000);
}
|
#include "mainwindow.h"
#include "ui_mainwindow.h"
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
init();
this->ptimer=new QTimer;
go=0;
connect(this->ptimer,SIGNAL(timeout()),this,SLOT(update_Time()));
}
MainWindow::~MainWindow()
{
delete ui;
}
void MainWindow::paintEvent(QPaintEvent *event)//绘制数独布局
{
QPainter painter(this);
QPen pen;
pen.setColor(Qt::black);
for(int i=0;i<10;++i){
if(i%3==0){
pen.setWidth(2);
pen.setColor(Qt::black);
}else {
pen.setWidth(1);
pen.setColor(Qt::gray);
}
painter.setPen(pen);
painter.drawLine(QPoint(dis_x,dis_y+i*r),QPoint(dis_x+r*9,dis_y+i*r));
}
for(int i=0;i<10;++i){
if(i%3==0){
pen.setWidth(2);
pen.setColor(Qt::black);
}else {
pen.setWidth(1);
pen.setColor(Qt::gray);
}
painter.setPen(pen);
painter.drawLine(QPoint(dis_x+i*r,dis_y),QPoint(dis_x+i*r,dis_y+r*9));
}
for(int i=0;i<10;++i){
if(i%3==0){
pen.setWidth(2);
}else {
pen.setWidth(1);
}
painter.setPen(pen);
painter.drawLine(QPoint(dis_x+10*r,dis_y+i*r),QPoint(dis_x+r*11,dis_y+i*r));
}
for(int i=10;i<12;i++){
painter.drawLine(QPoint(dis_x+i*r,dis_y),QPoint(dis_x+i*r,dis_y+r*9));
}
}
void MainWindow::mousePressEvent(QMouseEvent *event)
{
if (event->button() == Qt::LeftButton){
QPoint point=event->pos();
if(point.x()>=dis_x&&point.x()<=dis_x+r*9&&point.y()>=dis_y&&point.y()<=dis_y+9*r){
if(go==-1){
this->carryOn();
}
if(this->map_[choose_point.y()][choose_point.x()]!=0){
this->label_map[choose_point.y()][choose_point.x()]->setStyleSheet("font: 30pt;color:gray");
}else {
this->label_map[choose_point.y()][choose_point.x()]->setStyleSheet("font:30pt;");
}
//this->label_map[choose_point.y()][choose_point.x()]->setStyleSheet("font:30pt;");
if(this->map_[(point.y()-dis_y)/r][(point.x()-dis_x)/r]!=0)return;
this->choose_point.setX((point.x()-dis_x)/r);
this->choose_point.setY((point.y()-dis_y)/r);
// qDebug()<<this->choose_point;
this->label_map[choose_point.y()][choose_point.x()]->setStyleSheet("font:30pt;background-color:rgb(237, 240, 200);");
//this->label_map[choose_point.y()][choose_point.x()]->setText("");
}
else if(point.x()>=dis_x+10*r&&point.x()<=dis_x+11*r&&point.y()>=dis_y&&point.y()<=dis_y+9*r){
if(map_[choose_point.y()][choose_point.x()]!=0)return;
this->choose_val=(point.y()-dis_y)/r+1;
//this->label_map[choose_point.y()][choose_point.x()]->setStyleSheet("font:30pt");
this->label_map[choose_point.y()][choose_point.x()]->setText(QString::number(this->choose_val));
this->map[choose_point.y()][choose_point.x()]=choose_val;
//qDebug()<<choose_val;
}
}
else if (event->button() == Qt::RightButton){
//qDebug() << "right click";
QPoint point=event->pos();
if(point.x()>=dis_x&&point.x()<=dis_x+r*9&&point.y()>=dis_y&&point.y()<=dis_y+9*r){
if(go==-1){
this->carryOn();
}
if(this->map_[choose_point.y()][choose_point.x()]!=0){
this->label_map[choose_point.y()][choose_point.x()]->setStyleSheet("font: 30pt;color:gray");
}else {
this->label_map[choose_point.y()][choose_point.x()]->setStyleSheet("font:30pt;");
}
//this->label_map[choose_point.y()][choose_point.x()]->setStyleSheet("font:30pt;");
if(this->map_[(point.y()-dis_y)/r][(point.x()-dis_x)/r]!=0)return;
this->choose_point.setX((point.x()-dis_x)/r);
this->choose_point.setY((point.y()-dis_y)/r);
// qDebug()<<this->choose_point;
this->label_map[choose_point.y()][choose_point.x()]->setStyleSheet("font:30pt;background-color:rgb(237, 240, 200);");
this->label_map[choose_point.y()][choose_point.x()]->setText("");
this->map[choose_point.y()][choose_point.x()]=0;
}
}
}
bool MainWindow::init()
{
this->ui->label->setText("00:00:00");
this->map=new int*[9];
this->map_=new int*[9];
level=0;
for(int i=0;i<9;++i){
this->map[i]=new int[9]();
this->map_[i]=new int[9]();
}
dis_x=30,dis_y=80;
r=50;
for(int i=0;i<9;i++){
vector<QLabel*> temp;
for(int j=0;j<9;j++){
QLabel *label=new QLabel(this);
label->setAlignment(Qt::AlignHCenter);
label->setText("");
label->setGeometry(dis_x/*+r/4*/+j*r+1,dis_y+i*r+1,r-2,r-2);
label->setStyleSheet("font: 30pt;color:gray");
temp.push_back(label);
}
this->label_map.push_back(temp);
}
for(int i=0;i<9;++i){
QLabel *label=new QLabel(this);
label->setText(QString::number(i+1,10,0));
label->setAlignment(Qt::AlignHCenter);
label->setGeometry(dis_x+10*r+1,dis_y+i*r+1,r-2,r-2);
label->setStyleSheet("font: 27pt;color:black");
this->label_val.push_back(label);
}
return true;
}
bool MainWindow::clear()
{
for(int i=0;i<9;++i){
for(int j=0;j<9;++j){
map[i][j]=0;
this->label_map[i][j]->setText("");
}
}
// for(int i=0;i<9;++i){
// delete map[i];
// }
// delete map;
// for(int i=0;i<9;++i){
// for(int j=0;j<9;++j){
// delete this->label_map[i][j];
// }
// delete this->label_val[i];
// }
// this->label_map.clear();
// this->label_val.clear();
return true;
}
bool MainWindow::newGame()
{
for(int i=0;i<9;++i){
for(int j=0;j<9;++j){
this->map_[i][j]=0;
}
}
sudoku.createSudoku(this->map_,30);
for(int i=0;i<9;++i){
for(int j=0;j<9;++j){
map[i][j]=map_[i][j];
if(map_[i][j]==0)continue;
this->label_map[i][j]->setText(QString::number(map_[i][j]));
this->label_map[i][j]->setStyleSheet("font: 30pt;color:gray");
}
}
return true;
}
bool MainWindow::check_()
{
int row[10]={0};
int col[10]={0};
int jiu[10]={0};
for(int i=0;i<9;++i){
memset(row,0,sizeof(row));
memset(col,0,sizeof(col));
memset(jiu,0,sizeof(jiu));
for(int j=0;j<9;++j){
if(!checkVal_(row,map[i][j])||!checkVal_(col,map[j][i])||!checkVal_(jiu,map[3*(i/3) + j/3][3*(i%3) + j%3])){
return false;
}
}
}
return true;
}
bool MainWindow::checkVal_(int vec[], int val)
{
if(val==0)return true;
if(vec[val]==1)return false;
vec[val]=1;
return true;
}
bool MainWindow::finished()
{
for(int i=0;i<9;++i){
for(int j=0;j<9;++j){
if(map[i][j]==0)return false;
}
}
return true;
}
void MainWindow::start()
{
this->basetime=QTime::currentTime();
this->ptimer->start(10);
go=1;
}
void MainWindow::pause()
{
pauseTime=QTime::currentTime();
this->ptimer->stop();
go=-1;
}
void MainWindow::carryOn()
{
QTime cut=QTime::currentTime();
int t=pauseTime.msecsTo(cut);
this->basetime=this->basetime.addMSecs(t);
this->ptimer->start(10);
go=1;
}
void MainWindow::on_actionnew_game_triggered()
{
this->clear();
newGame();
start();
}
void MainWindow::update_Time()
{
QTime current=QTime::currentTime();
int t=this->basetime.msecsTo(current);
QTime showtime(0,0,0,0);
showtime=showtime.addMSecs(t);
QString showstr=showtime.toString("mm:ss:zzz");
this->ui->label->setText(showstr.left(showstr.length()-1));
}
void MainWindow::on_btn_restart_clicked()
{
this->clear();
newGame();
start();
}
void MainWindow::on_btn_clear_clicked()
{
for(int i=0;i<9;++i){
for(int j=0;j<9;++j){
if(this->map_[i][j]==0){
this->map[i][j]=0;
this->label_map[i][j]->setText("");
this->label_map[i][j]->setStyleSheet("font:30pt");
}
}
}
}
void MainWindow::on_btn_auto_clicked()
{
int a[81],k=0;
for(int i=0;i<9;++i){
for(int j=0;j<9;++j){
a[k++]=this->map_[i][j];
}
}
DanceLinked *p=new DanceLinked(a);
p->getSolution(a);
k=0;
for(int i=0;i<9;++i){
for(int j=0;j<9;++j){
if(this->map_[i][j]==0){
this->label_map[i][j]->setText(QString::number(a[k]));
this->label_map[i][j]->setStyleSheet("font:30pt");
this->map[i][j]=a[k];
}
k++;
}
}
delete p;
}
void MainWindow::on_btn_submit_clicked()
{
if(!finished()){
QMessageBox::information(this,"haven't finished","Please continue");return;
}
if(check_()){
this->pause();
int ret=QMessageBox::question(this,"Success","Next level?","Yes","Quit","Cancel");
if(ret==1){
this->close();
}
else if(ret==0){
this->on_btn_restart_clicked();
this->ui->level->setText("level "+QString::number(++level));
}
}else {
int ret=QMessageBox::question(this,"Failed","Again?","Yes","Quit","Cancel");
if(ret==0){
this->on_btn_clear_clicked();start();
}else if(ret==1){
this->close();
}
}
}
void MainWindow::on_btn_pause_clicked()
{
if(go==1){
this->pause();
}
}
|
/**
* Definition for singly-linked list with a random pointer.
* struct RandomListNode {
* int label;
* RandomListNode *next, *random;
* RandomListNode(int x) : label(x), next(NULL), random(NULL) {}
* };
*/
class Solution {
public:
RandomListNode *copyRandomList(RandomListNode *head) {
RandomListNode dummy(-1);
RandomListNode *copy = &dummy;
RandomListNode *p1 = head;
unordered_map<RandomListNode*,RandomListNode*> link;
while (head) {
copy->next = new RandomListNode(head->label);
link[head] = copy->next;
copy = copy->next;
head = head->next;
}
head = p1;
copy = dummy.next;
while (head) {
copy->random = (head->random)?link[head->random]:NULL;
copy = copy->next;
head = head->next;
}
return dummy.next;
}
};
|
/**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode(int x) : val(x), left(NULL), right(NULL) {}
* };
*/
class Solution { // 贪心算法
private:
int result;
int traversal(TreeNode* cur) { // 首先是后序遍历。这是因为贪心的思路导致的,我们希望从叶子结点的父节点开始部署摄像头,这样节约资源。
// 不从头开始是因为叶子的基数大,根节点只有一个,叶子有好多。这体现了贪心的想法,因此这道题本质是贪心算法。
if (cur == nullptr) return 2; // 分三种情况思考,0代表没有覆盖,1代表安装了摄像头,2代表有覆盖但没有摄像头。
// 上面,如果是空节点,那么判定为2号状态,原因见链接。
int left = traversal(cur->left); // 后序遍历
int right = traversal(cur->right);
if (left == 2 && right == 2) return 0;
else if (left == 0 || right == 0) {
result++;
return 1;
} else return 2;
}
public:
int minCameraCover(TreeNode* root) {
result = 0;
// 这里的if语句判别了根节点是否最后是空的,如果是,需要加入一个摄像头。
if (traversal(root) == 0) result++;
return result;
}
};
// reference https://mp.weixin.qq.com/s/kCxlLLjWKaE6nifHC3UL2Q
/*
详细解答见链接,这个解答非常好。
class Solution {
private:
int result;
int traversal(TreeNode* cur) {
// 空节点,该节点有覆盖
if (cur == NULL) return 2;
int left = traversal(cur->left); // 左
int right = traversal(cur->right); // 右
// 情况1
// 左右节点都有覆盖
if (left == 2 && right == 2) return 0;
// 情况2
// left == 0 && right == 0 左右节点无覆盖
// left == 1 && right == 0 左节点有摄像头,右节点无覆盖
// left == 0 && right == 1 左节点有无覆盖,右节点摄像头
// left == 0 && right == 2 左节点无覆盖,右节点覆盖
// left == 2 && right == 0 左节点覆盖,右节点无覆盖
if (left == 0 || right == 0) {
result++;
return 1;
}
// 情况3
// left == 1 && right == 2 左节点有摄像头,右节点有覆盖
// left == 2 && right == 1 左节点有覆盖,右节点有摄像头
// left == 1 && right == 1 左右节点都有摄像头
// 其他情况前段代码均已覆盖
if (left == 1 || right == 1) return 2;
// 以上代码我没有使用else,主要是为了把各个分支条件展现出来,这样代码有助于读者理解
// 这个 return -1 逻辑不会走到这里。
return -1;
}
public:
int minCameraCover(TreeNode* root) {
result = 0;
// 情况4
if (traversal(root) == 0) { // root 无覆盖
result++;
}
return result;
}
};
*/
|
// Author: AlexHG @ XENOBYTE.XYZ
// License: MIT License
// Website: https://XENOBYTE.XYZ
#ifndef SCANNER_H
#define SCANNER_H
//opencv libs
#include <opencv2/opencv.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>
//C++ STDs
#include <iostream>
class Scanner
{
private:
//webcam loader
cv::VideoCapture webcam;
//images
cv::Mat originalFrame;
cv::Mat backupFrame;
//options
bool grayScale, customContrast, invertBits, edgeDetection;
//contrast settings
int contrastBeta;
double contrastAlpha;
public:
Scanner();
~Scanner();
//initialize webcam
int initialize(int camera, int w, int h);
int changeCamera(int newCamera);
//update webcam
int processFrame();
//modifications
void changeContrast(int beta, double alpha);
void applyGrayScale();
void applyBitInvertion();
void cannyEdgeDetection(int ratio, int treshold, int kernel);
void scanImage();
//return images
cv::Mat getFrame();
cv::Mat getBackupFrame();
};
#endif //SCANNER_H
|
/*******************************************************************************
* Cristian Alexandrescu *
* 2163013577ba2bc237f22b3f4d006856 *
* 11a4bb2c77aca6a9927b85f259d9af10db791ce5cf884bb31e7f7a889d4fb385 *
* bc9a53289baf23d369484f5343ed5d6c *
*******************************************************************************/
/* Problem 13287 - Shattered Cake */
#include <iostream>
using namespace std;
int main() {
int nW;
while (cin >> nW) {
int nN, nTotalArea = 0;
for (cin >> nN; nN--; ) {
int nPieceW, nPieceH;
cin >> nPieceW >> nPieceH;
nTotalArea += nPieceW * nPieceH;
}
cout << nTotalArea / nW << endl;
}
return 0;
}
|
/*======================================================================================
* 05-two_pumas.cpp
*
*
* Elena Galbally & Adrian Piedra (based on: https://github.com/manips-sai/cs327a)
*
*======================================================================================*/
/* --------------------------------------------------------------------------------------
Include Required Libraries and Files
-----------------------------------------------------------------------------------------*/
#include <iostream>
#include <string>
#include <thread>
#include <chrono>
#include <math.h>
#include "Sai2Model.h"
#include "Sai2Graphics.h"
#include "Sai2Simulation.h"
#include <dynamics3d.h>
#include "timer/LoopTimer.h"
#include "force_sensor/ForceSensorSim.h"
#include "tasks/PosOriTask.h"
#include <GLFW/glfw3.h> //must be loaded after loading opengl/glew as part of graphicsinterface
using namespace std;
const double time_slowdown_factor = 10;
const string world_fname = "resources/world_puma.urdf";
const string robot_fname = "resources/puma_gripper.urdf";
const string robot1_name = "Puma1";
const string robot2_name = "Puma2";
const string object_name = "CoordObject";
const string object_fname = "resources/object.urdf";
const string object_link_name = "object";
const string camera_name = "camera_front";
const string ee_link_name = "end-effector";
const string gripper_joint_name = "gripper";
Eigen::Vector3d sensed_force1;
Eigen::Vector3d sensed_force2;
Eigen::Vector3d sensed_moment1;
Eigen::Vector3d sensed_moment2;
/* ----------------------------------------------------------------------------------
Simulation and Control Loop Setup
-------------------------------------------------------------------------------------*/
// state machine setup
enum ControlMode {
CONTROL_GRASP_STABILIZE = 0,
CONTROL_AUGMENTED_OBJECT
};
// simulation loop
bool fSimulationRunning = false;
void control(Sai2Model::Sai2Model* robot1, Sai2Model::Sai2Model* robot2, Sai2Model::Sai2Model* object_model, Simulation::Sai2Simulation* sim);
void simulation(ForceSensorSim* fsensor1, ForceSensorSim* fsensor2, Simulation::Sai2Simulation* sim);
// initialize window manager
GLFWwindow* glfwInitialize();
// callback to print glfw errors
void glfwError(int error, const char* description);
// callback when a key is pressed
void keySelect(GLFWwindow* window, int key, int scancode, int action, int mods);
/* =======================================================================================
MAIN LOOP
========================================================================================== */
int main (int argc, char** argv) {
cout << "Loading URDF world model file: " << world_fname << endl;
// load graphics scene
auto graphics = new Sai2Graphics::Sai2Graphics(world_fname, false);
// load robots
auto robot1 = new Sai2Model::Sai2Model(robot_fname, false);
auto robot2 = new Sai2Model::Sai2Model(robot_fname, false);
// load object
auto coobject = new Sai2Model::Sai2Model(object_fname, false);
// load simulated force sensor
Eigen::Affine3d T_sensor = Eigen::Affine3d::Identity();
// T_sensor.translation() = Eigen::Vector3d(0.0, 0.0, 0.1725);
auto fsensor1 = new ForceSensorSim(robot1_name, ee_link_name, T_sensor, robot1);
auto fsensor2 = new ForceSensorSim(robot2_name, ee_link_name, T_sensor, robot2);
// load simulation world
auto sim = new Simulation::Sai2Simulation(world_fname, false);
// set co-efficient of restition to zero to avoid bounce
// see issue: https://github.com/manips-sai/sai2-simulation/issues/1
sim->setCollisionRestitution(0.0);
sim->setCoeffFrictionStatic(0.5);
sim->setCoeffFrictionDynamic(0.5);
// //Display frame on held object
// auto vis_world_ptr = graphics->_world;
// chai3d::cGenericObject* object_ptr;
// for (uint i = 0; i < vis_world_ptr->getNumChildren(); i++) {
// auto temp_ptr = vis_world_ptr->getChild(i);
// if (strcmp(temp_ptr->m_name.c_str(), object_name.c_str()) == 0) {
// object_ptr = temp_ptr;
// }
// }
// object_ptr->setShowFrame(true, false);
// set joint damping on grippers: TODO: the values needed seem to much larger than physical!
auto base_1 = sim->_world->getBaseNode(robot1_name);
auto gripper_1 = base_1->getJoint(gripper_joint_name);
gripper_1->setDamping(10.0);
gripper_1->setJointLimits(-0.005, 0.068, 0.005);
auto base_2 = sim->_world->getBaseNode(robot2_name);
auto gripper_2 = base_2->getJoint(gripper_joint_name);
gripper_2->setDamping(10.0);
gripper_2->setJointLimits(-0.005, 0.068, 0.005);
// set initial conditions
robot1->_q << 90/180.0*M_PI,
-22.5/180.0*M_PI,
212/180.0*M_PI,
90.0/180.0*M_PI,
100/180.0*M_PI,
180/180.0*M_PI,
0.0;
sim->setJointPositions(robot1_name, robot1->_q);
robot1->updateModel();
robot2->_q << 90/180.0*M_PI,
202.5/180.0*M_PI,
-28/180.0*M_PI,
-90.0/180.0*M_PI,
97/180.0*M_PI,
180/180.0*M_PI,
0.0;
sim->setJointPositions(robot2_name, robot2->_q);
robot2->updateModel();
Eigen::Affine3d ee_trans;
// robot1->transform(ee_trans, ee_link_name);
// cout << ee_trans.translation().transpose() << endl;
// cout << ee_trans.rotation() << endl;
// initialize GLFW window
GLFWwindow* window = glfwInitialize();
// set callbacks
glfwSetKeyCallback(window, keySelect);
// start the simulation thread first
fSimulationRunning = true;
thread sim_thread(simulation, fsensor1, fsensor2, sim);
// next start the control thread
thread ctrl_thread(control, robot1, robot2, coobject, sim);
// while window is open:
while (!glfwWindowShouldClose(window)) {
// update kinematic models
// robot->updateModel();
// update graphics. this automatically waits for the correct amount of time
int width, height;
glfwGetFramebufferSize(window, &width, &height);
graphics->updateGraphics(robot1_name, robot1);
graphics->updateGraphics(robot2_name, robot2);
graphics->updateGraphics(object_name, coobject);
graphics->render(camera_name, width, height);
glfwSwapBuffers(window);
glFinish();
// poll for events
glfwPollEvents();
}
// stop simulation
fSimulationRunning = false;
sim_thread.join();
ctrl_thread.join();
// destroy context
glfwDestroyWindow(window);
// terminate
glfwTerminate();
return 0;
}
/* ----------------------------------------------------------------------------------
Utility functions
-------------------------------------------------------------------------------------*/
// Calculate the cross product matrix
Eigen::Matrix3d getCrossProductMat(const Eigen::Vector3d& t) {
Eigen::Matrix3d ret;
ret << 0, -t(2), t(1),
t(2), 0, -t(0),
-t(1), t(0), 0;
return ret;
}
/* =======================================================================================
CONTROL LOOP
========================================================================================== */
void control(Sai2Model::Sai2Model* robot1, Sai2Model::Sai2Model* robot2, Sai2Model::Sai2Model* object_model, Simulation::Sai2Simulation* sim) {
// create a timer
LoopTimer timer;
timer.initializeTimer();
timer.setLoopFrequency(1000); //1000Hz timer
double last_time = timer.elapsedTime()/time_slowdown_factor; //secs
Sai2Primitives::PosOriTask* posori_task1 = new Sai2Primitives::PosOriTask(robot1, ee_link_name, Eigen::Vector3d::Zero());
Sai2Primitives::PosOriTask* posori_task2 = new Sai2Primitives::PosOriTask(robot2, ee_link_name, Eigen::Vector3d::Zero());
// load robot global frame to robot base transformations: todo: move out to a function
Eigen::Affine3d robot1_base_frame = sim->getRobotBaseTransform(robot1_name);
Eigen::Affine3d robot2_base_frame = sim->getRobotBaseTransform(robot2_name);
// cache variables
bool fTimerDidSleep = true;
bool fTorqueUseDefaults = false; // set true when torques are overriden for the first time
Eigen::VectorXd tau1 = Eigen::VectorXd::Zero(robot1->dof());
Eigen::VectorXd tau2 = Eigen::VectorXd::Zero(robot2->dof());
Eigen::Affine3d object_com_frame;
Eigen::MatrixXd object_inertia(6,6);
Eigen::MatrixXd object_j(6,6);
Eigen::VectorXd object_p(6);
Eigen::VectorXd robot1_g(robot1->dof());
Eigen::VectorXd robot2_g(robot2->dof());
Eigen::MatrixXd robot1_j0_ee(6, robot1->dof());
Eigen::MatrixXd robot2_j0_ee(6, robot2->dof());
Eigen::Affine3d robot1_ee_frame_local;
Eigen::Affine3d robot2_ee_frame_local;
Eigen::Vector3d robot1_object_com_frame_local;
Eigen::Vector3d robot2_object_com_frame_local;
Eigen::MatrixXd robot1_j0_objcom(6, robot1->dof());
Eigen::MatrixXd robot2_j0_objcom(6, robot2->dof());
Eigen::MatrixXd robot1_j0_objectcom_bar(robot1->dof(), 6);
Eigen::MatrixXd robot2_j0_objectcom_bar(robot2->dof(), 6);
Eigen::MatrixXd robot1_objcom_inertia(6,6);
Eigen::MatrixXd robot2_objcom_inertia(6,6);
Eigen::VectorXd robot1_objectcom_p(6);
Eigen::VectorXd robot2_objectcom_p(6);
Eigen::MatrixXd augmented_object_inertia(6,6);
Eigen::VectorXd augmented_object_p(6);
Eigen::MatrixXd G(2*6, 2*6);
Eigen::MatrixXd W(6, 2*6);
Eigen::Vector3d obj_des_pos;
Eigen::Vector3d obj_ori_error;
Eigen::VectorXd obj_task_err(6);
Eigen::VectorXd force_des_vec(12);
Eigen::VectorXd force_ee_vec(12);
Eigen::VectorXd force_obj_act_vec(12);
Eigen::VectorXd force_ee_act_vec(12);
double kp = 30;
double kv = 10;
// control mode
ControlMode control_mode = CONTROL_GRASP_STABILIZE; // 0 = grasp stabilizing controller, 1 = augmented object controller
while (fSimulationRunning) { //automatically set to false when simulation is quit
fTimerDidSleep = timer.waitForNextLoop();
// update time
double curr_time = timer.elapsedTime()/time_slowdown_factor;
double loop_dt = curr_time - last_time;
// read joint positions, velocities
sim->getJointPositions(robot1_name, robot1->_q);
sim->getJointVelocities(robot1_name, robot1->_dq);
robot1->updateModel();
sim->getJointPositions(robot2_name, robot2->_q);
sim->getJointVelocities(robot2_name, robot2->_dq);
robot2->updateModel();
// read object position
sim->getJointPositions(object_name, object_model->_q);
sim->getJointVelocities(object_name, object_model->_dq);
object_model->updateModel();
// update object dynamics
// - find object COM frame in global frame
object_model->transform(object_com_frame, object_link_name);
// - obtain object inertia matrix in world frame
object_model->J_0(object_j, object_link_name, Eigen::Vector3d::Zero());
object_inertia = (object_j*object_model->_M_inv*object_j.transpose()).inverse();
// - obtain object p
object_p << 0, 0, 9.8*0.5, 0, 0, 0;
// ---------------------------------------------------------------------------------
/* ---------------------- Manipulator Jacobians ---------------------- */
// - Obtain object COM location in robot1 end effector frame
robot1->transform(robot1_ee_frame_local, ee_link_name);
robot1_object_com_frame_local = ((robot1_base_frame*robot1_ee_frame_local).inverse() * object_com_frame).translation();
// - Obtain object COM location in robot2 end effector frame
robot2->transform(robot2_ee_frame_local, ee_link_name);
robot2_object_com_frame_local = ((robot2_base_frame*robot2_ee_frame_local).inverse() * object_com_frame).translation();
// - Obtain robot1 EE Jacobian at the object COM in world frame
robot1->J_0(robot1_j0_objcom, ee_link_name, robot1_object_com_frame_local);
// - Obtain robot1 EE Jacobian at the object COM in world frame
robot1->J_0(robot2_j0_objcom, ee_link_name, robot2_object_com_frame_local);
/* ---------------------- Augmented object model --------------------- */
robot1_objcom_inertia = (robot1_j0_objcom*robot1->_M_inv*robot1_j0_objcom.transpose()).inverse();
robot2_objcom_inertia = (robot2_j0_objcom*robot2->_M_inv*robot2_j0_objcom.transpose()).inverse();
// - Add it all up
augmented_object_inertia = object_inertia + robot1_objcom_inertia + robot2_objcom_inertia;
// - Obtain robot1 g, j_objectcom_bar, p
robot1->gravityVector(robot1_g);
robot1_j0_objectcom_bar = robot1->_M_inv*robot1_j0_objcom.transpose()*robot1_objcom_inertia;
robot1_objectcom_p = robot1_j0_objectcom_bar.transpose()*robot1_g;
// - Obtain robot2 g, j_objectcom_bar, p
robot2->gravityVector(robot2_g);
robot2_j0_objectcom_bar = robot2->_M_inv*robot2_j0_objcom.transpose()*robot2_objcom_inertia;
robot2_objectcom_p = robot2_j0_objectcom_bar.transpose()*robot2_g;
// - Add it all up
augmented_object_p = object_p + robot1_objectcom_p + robot2_objectcom_p;
/* ---------------------- Grasp matrix ---------------------- */
// NOTE: we calculate everything in the world frame. But any frame is good enough as
// long as all quantities are calculated in the same frame.
// - Get W
W.setZero();
W.block(0,0,3,3) = Eigen::Matrix3d::Identity();
W.block(0,6,3,3) = Eigen::Matrix3d::Identity();
W.block(3,3,3,3) = Eigen::Matrix3d::Identity();
W.block(3,9,3,3) = Eigen::Matrix3d::Identity();
// - - set r1: from object COM to robot 1 end effector
W.block(3,0,3,3) = getCrossProductMat((robot1_base_frame*robot1_ee_frame_local).translation() - object_com_frame.translation());
// - - set r2: from object COM to robot 2 end effector
W.block(3,6,3,3) = getCrossProductMat((robot2_base_frame*robot2_ee_frame_local).translation() - object_com_frame.translation());
// - Get G
G.setZero();
G.block(0,0,6,2*6) = W;
// - set tension component
Eigen::Vector3d e12 = (robot2_base_frame*robot2_ee_frame_local).translation() - (robot1_base_frame*robot1_ee_frame_local).translation();
e12.normalize();
G.block(6,0,1,3) = -0.5*e12.transpose(); // for tension between the end-effectors, use -e12, for compression, use e12
G.block(6,6,1,3) = 0.5*e12.transpose();
// - set moment components at end effector normal to the ee-ee axis
Eigen::Vector3d e1_z = (robot1_ee_frame_local).linear().col(2);// set to end effector z-axis
Eigen::Vector3d e1_y = e1_z.cross(e12);
G.block(7,3,1,3) = e1_z.transpose();
G.block(8,3,1,3) = e1_y.transpose();
Eigen::Vector3d e2_z = (robot2_ee_frame_local).linear().col(2);// set to end effector z-axis
Eigen::Vector3d e2_y = e2_z.cross(e12);
G.block(9,9,1,3) = e2_z.transpose();
G.block(10,9,1,3) = e2_y.transpose();
// - set twist along ee-ee link axis
G.block(11,3,1,3) = -0.5*e12.transpose();
G.block(11,9,1,3) = 0.5*e12.transpose();
// update sensed values (need to put them back in sensor frame)
Eigen::Affine3d sensor_frame_in_link = Eigen::Affine3d::Identity();
Eigen::Matrix3d R_link1;
robot1->rotation(R_link1, ee_link_name);
Eigen::Matrix3d R_sensor1 = R_link1*sensor_frame_in_link.rotation();
posori_task1->updateSensedForceAndMoment(- R_sensor1.transpose() * sensed_force1, - R_sensor1.transpose() * sensed_moment1);
Eigen::Matrix3d R_link2;
robot2->rotation(R_link2, ee_link_name);
Eigen::Matrix3d R_sensor2 = R_link2*sensor_frame_in_link.rotation();
posori_task2->updateSensedForceAndMoment(- R_sensor2.transpose() * sensed_force2, - R_sensor2.transpose() * sensed_moment2);
/* ---------------------- Force control ---------------------- */
if (control_mode == CONTROL_AUGMENTED_OBJECT) {
// - desired object position and current task error
// obj_des_pos << 0, 0.4,0.15*sin(2*M_PI*curr_time/3);
// obj_des_pos << 0, 0.15*sin(2*M_PI*curr_time/3), 0.4;
obj_des_pos << 0.15*cos(2*M_PI*curr_time/3), 0.15*sin(2*M_PI*curr_time/3), 0.4;
// obj_des_pos << 0, 0, 0;
Sai2Model::orientationError(obj_ori_error, Eigen::Matrix3d::Identity(), object_com_frame.linear());
obj_task_err << (object_com_frame.translation() - obj_des_pos), obj_ori_error;
// - obtain desired force at augmented object location
force_des_vec.setZero();
force_des_vec.head(6) = object_p + augmented_object_inertia*(-kv*object_j*object_model->_dq - kp*(obj_task_err));
force_des_vec[6] = -15.0; // 15N compression // 20N causes a bus error in Sai2-simulation!
// - solve for ee forces
force_ee_vec = G.lu().solve(force_des_vec);
// - set joint torques
robot1->J_0(robot1_j0_ee, ee_link_name, Eigen::Vector3d::Zero());
robot2->J_0(robot2_j0_ee, ee_link_name, Eigen::Vector3d::Zero());
tau1 = robot1_j0_ee.transpose()*force_ee_vec.head(6) + robot1_g;
tau2 = robot2_j0_ee.transpose()*force_ee_vec.tail(6) + robot2_g;
} else if (control_mode == CONTROL_GRASP_STABILIZE) { // initial grasp stabilization
robot1->J_0(robot1_j0_ee, ee_link_name, Eigen::Vector3d::Zero());
robot2->J_0(robot2_j0_ee, ee_link_name, Eigen::Vector3d::Zero());
tau1 = robot1_j0_ee.transpose()*(object_p/2) + robot1->_M*(-10.0*robot1->_dq) + robot1_g;
tau2 = robot2_j0_ee.transpose()*(object_p/2) + robot2->_M*(-10.0*robot2->_dq) + robot2_g;
static uint grasp1Counter = 0;
static uint grasp2Counter = 0;
if (robot1->_dq[6] < 0.1) {
grasp1Counter += 1;
} else {
grasp1Counter = 0;
}
if (robot2->_dq[6] < 0.1) {
grasp2Counter += 1;
} else {
grasp2Counter = 0;
}
if (grasp1Counter > 40 && grasp2Counter > 40) {
cout << "----- Switch Control Mode to Augmented Object Model -----" << endl;
control_mode = CONTROL_AUGMENTED_OBJECT;
}
}
// -------------------------------------------
// set constant gripper forces.
tau1[6] = 15;
tau2[6] = 15;
// Default values if torques are exceeded:
bool fTorqueOverride = false; // to avoid robot blow-ups
const double tau1_max = 200;
const double tau2_max = 200;
if (!fTorqueUseDefaults) {
if (tau1.cwiseAbs().maxCoeff() > tau1_max || tau2.cwiseAbs().maxCoeff() > tau2_max) {
fTorqueOverride = true;
cerr << "Torque overriden. User asked torques beyond safe limit: \n";
cerr << "Robot 1: " << tau1.transpose() << "\n";
cerr << "Robot 2: " << tau2.transpose() << "\n";
fTorqueUseDefaults = true;
}
// Also default values if object is dropped
const double object_thickness = 0.05;
bool fRobot1DroppedObject = robot1->_q[6] > object_thickness/2;
bool fRobot2DroppedObject = robot2->_q[6] > object_thickness/2;
if (fRobot1DroppedObject || fRobot2DroppedObject) {
cerr << "Torque overriden. Robot 1 or 2 dropped object. \n";
fTorqueUseDefaults = true;
}
}
else {
robot1->gravityVector(tau1);
tau1 = tau1 + robot1->_M*(-10.0*robot1->_dq);
tau1 = (tau1.array() >= tau1_max).select(tau1_max*Eigen::VectorXd::Ones(robot1->dof()), tau1);
tau1 = (tau1.array() <= -tau1_max).select(-tau1_max*Eigen::VectorXd::Ones(robot1->dof()), tau1);
robot2->gravityVector(tau2);
tau2 = tau2 + robot2->_M*(-10.0*robot2->_dq);
tau2 = (tau2.array() >= tau2_max).select(tau2_max*Eigen::VectorXd::Ones(robot2->dof()), tau2);
tau2 = (tau2.array() <= -tau2_max).select(-tau2_max*Eigen::VectorXd::Ones(robot2->dof()), tau2);
}
sim->setJointTorques(robot1_name, tau1);
sim->setJointTorques(robot2_name, tau2);
// compute the actual internal object forces from sensed force and moment
force_ee_act_vec << sensed_force1, sensed_force2, sensed_moment1, sensed_moment2;
force_obj_act_vec = G * force_ee_act_vec;
// cout << force_obj_act_vec[6] << endl;
// update last time
last_time = curr_time;
}
}
/* =======================================================================================
SIMULATION SETUP
-----------------------
* Simulation loop
* Window initialization
* Window error
* Mouse click commands
========================================================================================== */
void simulation(ForceSensorSim* fsensor1, ForceSensorSim* fsensor2, Simulation::Sai2Simulation* sim) {
fSimulationRunning = true;
// create a timer
LoopTimer timer;
timer.initializeTimer();
timer.setLoopFrequency(10000); //10000Hz timer
// sleep for a few moments to let graphics start
// std::this_thread::sleep_for(std::chrono::seconds(1));
double last_time = timer.elapsedTime()/time_slowdown_factor; //secs
bool fTimerDidSleep = true;
while (fSimulationRunning) {
fTimerDidSleep = timer.waitForNextLoop();
// if (timer.elapsedCycles() % 10000 == 0) {
// cout << "Simulation loop frequency: " << timer.elapsedCycles()/timer.elapsedTime() << endl;
// }
// force sensor update
fsensor1->update(sim);
fsensor1->getForce(sensed_force1);
fsensor1->getMoment(sensed_moment1);
// force sensor update
fsensor2->update(sim);
fsensor2->getForce(sensed_force2);
fsensor2->getMoment(sensed_moment2);
// integrate forward
double curr_time = timer.elapsedTime()/time_slowdown_factor;
double loop_dt = curr_time - last_time;
// sim->integrate(loop_dt);
sim->integrate(loop_dt);
// if (!fTimerDidSleep) {
// cout << "Warning: timer underflow! dt: " << loop_dt << "\n";
// }
// update last time
last_time = curr_time;
}
}
//------------------------------------------------------------------------------
GLFWwindow* glfwInitialize() {
/*------- Set up visualization -------*/
// set up error callback
glfwSetErrorCallback(glfwError);
// initialize GLFW
glfwInit();
// retrieve resolution of computer display and position window accordingly
GLFWmonitor* primary = glfwGetPrimaryMonitor();
const GLFWvidmode* mode = glfwGetVideoMode(primary);
// information about computer screen and GLUT display window
int screenW = mode->width;
int screenH = mode->height;
int windowW = 0.8 * screenH;
int windowH = 0.5 * screenH;
int windowPosY = (screenH - windowH) / 2;
int windowPosX = windowPosY;
// create window and make it current
glfwWindowHint(GLFW_VISIBLE, 0);
GLFWwindow* window = glfwCreateWindow(windowW, windowH, "SAI2.0 - CS327a HW4", NULL, NULL);
glfwSetWindowPos(window, windowPosX, windowPosY);
glfwShowWindow(window);
glfwMakeContextCurrent(window);
glfwSwapInterval(1);
return window;
}
//------------------------------------------------------------------------------
void glfwError(int error, const char* description) {
cerr << "GLFW Error: " << description << endl;
exit(1);
}
//------------------------------------------------------------------------------
void keySelect(GLFWwindow* window, int key, int scancode, int action, int mods)
{
// option ESC: exit
if (key == GLFW_KEY_ESCAPE && action == GLFW_PRESS)
{
// exit application
glfwSetWindowShouldClose(window, 1);
}
}
|
/***************************************************************************
Copyright (c) 2020 Philip Fortier
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.
***************************************************************************/
#pragma once
//
// CExtNoFlickerStatic
// Helper class for drawing images. The regular CStatic's SetBitmap
// behaves differently on different OS's, and is prone to leaks as a result.
// NOTE: We may not need this anymore... it's possible prof-uis's CExtLabel would suffice?
//
class CExtNoFlickerStatic : public CExtLabel
{
public:
CExtNoFlickerStatic() {}
virtual ~CExtNoFlickerStatic() {}
// This does *not* take ownership of the HBITMAP
bool FromBitmap(HBITMAP hbmp, int cx, int cy, bool correctForAspectRatio);
protected:
DECLARE_MESSAGE_MAP()
virtual void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct);
CExtBitmap _bitmap;
int _cx;
int _cy;
bool _correctForAspectRatio;
};
|
/*
#include <iostream>
#include <cstring>
using namespace std;
class Person{
char* name;
int id;
public:
Person(int id, char* name);
Person(Person& person); // 복사 생성자
~Person();
void changeName(char *name);
void show() { cout << id << ',' << name << endl; }
};
Person::Person(int id, char* name) {
this->id = id;
int len = strlen(name);
this -> name = new char [len+1]; // name 문자열 공간 할당
strcpy(this->name, name);
}
Person::Person(Person& person) {
this->id = person.id; // id값 복사
int len = strlen(person.name);
this->name = new char [len+1];
strcpy(this->name, person.name);
cout << "복사 생성자 실행. 원본 객체의 이름 " << this->name << endl;
}
Person::~Person() {
if(name) // 만일 name에 동적 할당된 배열이 있으면
delete [] name; // 메모리 소멸
}
void Person::changeName(char* name) { // 이름 변경
if(strlen(name) > strlen(this->name))
return;
strcpy(this->name, name);
}
void f(Person person) {
person.changeName("dummy");
}
Person g() {
Person mother(2, "Jane");
return mother;
}
int main() {
Person father(1, "Kitae"); //(1) father 객체 생성
Person son = father; //(2) daughter 객체 복사 생성, 복사생성자 호출
f(father);
g();
}
*/
|
#include "Buff.h"
void Buff::draw(bool filling)
{
string buff;
if (filling)
{
switch (bufftype)
{
case LIFEBUFF:
drawAtPoint(x, y, "◎", RED);
break;
case SPEEDBUFF:
drawAtPoint(x, y, "◎", BLUE);
break;
case POWERBUFF:
drawAtPoint(x, y, "◎", YELLOW);
break;
case VOLUMEBUFF:
drawAtPoint(x, y, "◎", GREEN);
break;
default:
break;
}
}
else
{
drawAtPoint(x, y, " ", "");
}
}
|
#include<vector>
#include<stack>
#include<algorithm>
using namespace std;
class NestedInteger
{
public:
// Return true if this NestedInteger holds a single integer,
//rather than a nested list.
bool isInteger() const;
// Return the single integer that this NestedInteger holds,
//if it holds a single integer
// The result is undefined if this NestedInteger holds a nested list
int getInteger() const;
// Return the nested list that this NestedInteger holds,
//if it holds a nested list
// The result is undefined if this NestedInteger holds a single integer
const vector<NestedInteger> &getList() const;
//vector<NestedInteger>&getList();
};
//author by Shao
class NestedIterator
{
private://I also can use vector
vector<NestedInteger>myStack;
public:
NestedIterator(vector<NestedInteger>&nestedList)
{
int size = nestedList.size();
for (int i = size-1; i >=0; i--)
myStack.push_back(nestedList[i]);
}
int next()
{
int result = myStack.back().getInteger();
myStack.pop_back();
return result;
}
bool hasNext()
{
while (!myStack.empty())
{
NestedInteger cur = myStack.back();
if (cur.isInteger())
return true;
myStack.pop_back();
vector<NestedInteger>subList = cur.getList();
int size = subList.size();
for (int i = size - 1; i >= 0; i--)
myStack.push_back(subList[i]);
}/**/
return false;
}
};
|
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
int abs(int n) {
if (n < 0)
n = -n;
return n;
}
vector<int> getparr(vector<int> p) {
int m = p.size();
int j = 0;
vector<int> pi(m, 0);
for (int i = 1; i < m; i++) {
while (j > 0 && p[i] != p[j])
j = pi[j - 1];
if (p[i] == p[j])
pi[i] = ++j;
}
return pi;
}
vector<int> kmp(vector<int> s, vector<int> p) {
vector<int> ans;
auto pi = getparr(p);
int n = s.size(), m = p.size(), j = 0;
for (int i = 0; i < n; i++) {
while (j > 0 && s[i] != p[j])
j = pi[j - 1];
if (s[i] == p[j]) {
if (j == m - 1) {
ans.push_back(i - m + 1);
j = pi[j];
}
else {
j++;
}
}
}
return ans;
}
int main() {
ifstream fp1("polygon.inp");
ofstream fp2("polygon.out");
int T;
fp1 >> T;
while (T--) {
int n;
vector<int> A, B;
fp1 >> n;
for (int i = 0; i < n; i++) {
int buf;
fp1 >> buf;
A.push_back(buf);
}
for (int i = 0; i < n; i++) {
int buf;
fp1 >> buf;
B.push_back(buf);
}
A.insert(A.end(), A.begin(), A.end());
vector<int> ans = kmp(A, B);
reverse(A.begin(), A.end());
A.push_back(A[0]);
for (int i = 0; i < A.size() - 1; i++) {
if (A[i + 1] > 0) {
A[i] = -abs(A[i]);
}
else {
A[i] = abs(A[i]);
}
}
A.pop_back();
vector<int> revans = kmp(A, B);
if (!ans.empty() || !revans.empty())
fp2 << 1 << endl;
else
fp2 << 0 << endl;
}
}
|
#pragma once
#include "OGLRender.hpp"
#include "Physics.hpp"
#include "PhysicsWidget.hpp"
#include "diligentGraphics/Math.hpp"
#include "imgui/imgui.h"
#include <SDL.h>
class ParticleSystemApp
{
public:
ParticleSystemApp();
~ParticleSystemApp() = default;
void run();
bool isInit() const { return m_init; }
private:
bool initWindow();
bool closeWindow();
bool checkSDLStatus();
void checkMouseState();
void displayMainWidget();
std::shared_ptr<Core::Physics> m_physicsEngine;
std::unique_ptr<Render::OGLRender> m_graphicsEngine;
std::unique_ptr<UI::PhysicsWidget> m_physicsWidget;
SDL_Window* m_window;
SDL_GLContext m_OGLContext;
std::string m_nameApp;
Math::int2 m_windowSize;
Math::int2 m_mousePrevPos;
ImVec4 m_backGroundColor;
bool m_buttonLeftActivated;
bool m_buttonRightActivated;
bool m_init;
int m_numEntities;
int m_boxSize;
};
|
#ifndef RESTY_MUX_ROUTER_H_
#define RESTY_MUX_ROUTER_H_
#include <qhttpfwd.hpp>
#include <QMetaType>
#include <QString>
#include <QRegularExpression>
#include <vector>
#include <memory>
#include <string>
#include "fwds.h"
namespace resty {
namespace mux {
class PrefixChecker;
class Router {
public:
Router();
~Router();
typedef std::function<std::unique_ptr<RouteMatch>(const Request* request, const RouteMatch& partial)> MatchFunction;
Router(const Router&) = delete;
Router& operator=(const Router&) = delete;
void addCheck(const MatchFunction& matcher);
void addResourceHandler(QString path, Handler handler);
void addSubRouter(std::shared_ptr<Router> router);
void setPrefix(QString prefix);
void setNotFoundHandler(Handler handler);
void operator()(Request* request, Response* response);
Handler handler;
std::unique_ptr<RouteMatch> match(const Request* request, const RouteMatch& partial) const;
private:
Handler notFoundHandler;
std::unique_ptr<PrefixChecker> prefixChecker;
std::vector<MatchFunction> matchers;
std::vector<std::shared_ptr<Router>> subRouters;
std::vector<std::shared_ptr<Route>> routes;
};
}
}
#endif
|
#pragma once
#include <SDL.h>
#include <SDL_image.h>
#include <vector>
// forward declarations
class Rect;
class Renderer;
enum class BlendMode;
/*
Encapsulates SDLs textures
Sprites can be loaded from the renderer class
*/
class Sprite {
friend class Renderer;
private:
SDL_Texture* _texture = nullptr;
int _width = 0;
int _height = 0;
public:
Sprite(SDL_Texture* texture, int width, int height);
~Sprite();
// color modulation
void setColor(Uint8 red, Uint8 green, Uint8 blue);
// set blending
void setBlendMode(BlendMode blending);
// set alpha (opacity)
void setAlpha(Uint8 alpha);
// accessors
int getWidth() const;
int getHeight() const;
};
class SpriteSheet {
private:
std::vector<Rect> _animations;
int _currentAnimation = 0;
Sprite* _sprite = nullptr;
public:
SpriteSheet(std::vector<Rect> animations, Sprite* sprite);
// set sprite to next sprite
void nextSprite();
// set sprite to previous sprite
void prevSprite();
// set the sprite index
void setSprite(int idx);
// return the spritesheet
Sprite* getSprite() const;
// return the Rect showing the position of the sprite on the spritesheet
Rect* getSpriteSrc();
};
|
#include "Easing.h"
#include "ExecutionManager.h"
Easing::Easing(float from, float to, int duration_ticks)
{
_from = from;
_val = from;
_to = to;
_total_ticks = duration_ticks;
_current_ticks = 0;
}
void Easing::run(int ticks)
{
if (_current_ticks >= _total_ticks) return;
_current_ticks += ticks;
if (_current_ticks > _total_ticks) _current_ticks = _total_ticks;
_val = tfunc(_from, _to, _val, (float)_current_ticks / (float)_total_ticks);
on_step(_val);
if (_current_ticks >= _total_ticks)
{
ExecutionManager::RunDeferred(on_done);
return;
}
}
bool Easing::is_done()
{
return _current_ticks >= _total_ticks;
}
|
/*
Copyright (c) 2005-2023, University of Oxford.
All rights reserved.
University of Oxford means the Chancellor, Masters and Scholars of the
University of Oxford, having an administrative office at Wellington
Square, Oxford OX1 2JD, UK.
This file is part of Chaste.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of the University of Oxford nor the names of its
contributors may be used to endorse or promote products derived from this
software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 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.
*/
#include "ParameterisedCvode.hpp"
#include "OdeSystemInformation.hpp"
#include "VectorHelperFunctions.hpp"
#ifdef CHASTE_CVODE
bool ParameterisedCvode::fakeSecondParameter = false;
bool ParameterisedCvode::noParameterDefaults = false;
ParameterisedCvode::ParameterisedCvode() : AbstractCvodeSystem(1) // 1 here is the number of variables
{
this->mpSystemInfo = OdeSystemInformation<ParameterisedCvode>::Instance();
Init();
if (!noParameterDefaults)
{
CreateVectorIfEmpty(mParameters,1);
SetVectorComponent(mParameters, 0, 0.0);
if (fakeSecondParameter)
{
SetVectorComponent(mParameters, 1, -1.0);
}
}
}
void ParameterisedCvode::EvaluateYDerivatives(double time, const N_Vector rY, N_Vector rDY)
{
NV_Ith_S(rDY, 0) = GetVectorComponent(mParameters,0);
}
N_Vector ParameterisedCvode::ComputeDerivedQuantities(double time,
const N_Vector& rState)
{
N_Vector derived_quantities = NULL;
CreateVectorIfEmpty(derived_quantities,1);
SetVectorComponent(derived_quantities, 0,
2*GetVectorComponent(mParameters,0) + GetVectorComponent(rState,0));
return derived_quantities;
}
#include "SerializationExportWrapperForCpp.hpp"
CHASTE_CLASS_EXPORT(ParameterisedCvode)
template<>
void OdeSystemInformation<ParameterisedCvode>::Initialise()
{
this->mSystemName = "ParameterisedCvode";
this->mVariableNames.push_back("y");
this->mVariableUnits.push_back("dimensionless");
this->mInitialConditions.push_back(0.0);
this->mParameterNames.push_back("a");
this->mParameterUnits.push_back("dimensionless");
this->mDerivedQuantityNames.push_back("2a_plus_y");
this->mDerivedQuantityUnits.push_back("dimensionless");
this->mAttributes["attr"] = 1.1;
this->mInitialised = true;
}
#endif // CHASTE_CVODE
|
/***************************************************************************
Copyright (c) 2020 Philip Fortier
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.
***************************************************************************/
#pragma once
struct AudioNegativeComponent;
struct AudioComponent;
enum class AudioFlags : uint8_t;
void SixteenBitToFloat(const int16_t *bufferIn, size_t sampleCount, std::vector<float> &result);
void FloatToSixteenBit(const std::vector<float> &bufferIn, std::vector<int16_t> &result);
void ProcessSound(const AudioNegativeComponent &negative, AudioComponent &audioFinal, AudioFlags finalFlags);
|
#pragma once
#include "Range.h"
#include "RangeF.h"
#include "RangeColor.h"
#include "../GMApplication.h"
#include <SDL2/SDL.h>
#include <math.h>
class EmitterParameter
{
public:
EmitterParameter();
EmitterParameter(Range q, RangeF spd, SDL_Color col1, SDL_Color col2, RangeF o, RangeF scl, RangeF rot, RangeF ang, RangeF m);
~EmitterParameter(void);
Range Quantity;
RangeF Speed;
RangeColor Color;
RangeF Opacity;
RangeF Scale;
RangeF Rotation;
RangeF AngularVelocity;
RangeF Mass;
};
|
#ifndef __ChangeBGScene_H__
#define __ChangeBGScene_H__
#include "cocos2d.h"
#include "SimpleAudioEngine.h"
#include "cocos-ext.h"
using namespace cocos2d;
using namespace cocos2d::extension;
class ChangeBGScene : public cocos2d::Layer
{
public:
// 这个是用来初始化函数的
virtual bool init();
// 设置一个静态的场景函数
static cocos2d::Scene* createScene();
static cocos2d::Scene* createScene(RenderTexture* sqr);
// 设置一个菜单的回调函数。
void menuCloseCallback(Ref* pSender);
// 这个是一个创建对象的代码,他会自动创建对象,
// 如果失败会自动回收内存,如果回收内存也失败的话,他会自动的删除对象。
CREATE_FUNC(ChangeBGScene);
void changeBG(Ref * sender, Control::EventType controlEvent);
void backToMenu(Ref * sender, Control::EventType controlEvent);
//生命周期
virtual void onEnter();
virtual void onEnterTransitionDidFinish();
virtual void onExit();
};
#endif // __ChangeBGScene_H__
|
#pragma once
#include <QWidget>
#include <QScopedPointer>
#include "Subject.hpp"
#include "SubjectDateModel.hpp"
namespace Ui {
class EditSubject;
}
class EditSubject : public QWidget
{
Q_OBJECT
public:
explicit EditSubject(QWidget *parent = 0);
Subject subject() const;
void setSubject(const Subject &subject_);
~EditSubject();
private slots:
void accept();
void setDatesState(int state);
void setHourCount(int count);
void updateDates();
private:
Ui::EditSubject *ui;
QScopedPointer<Subject> m_subject;
SubjectDateModel *m_subjectDateModel;
};
|
#pragma once
#include <pthread.h>
#include "Util.h"
START_NAMESPACE
class Mutex {
public:
Mutex();
Mutex(Mutex&&) = delete;
Mutex(const Mutex&) = delete;
Mutex& operator=(const Mutex&) = delete;
Mutex& operator =(Mutex&&) = delete;
~Mutex();
bool isLockedByThisThread() const;
void assertLocked() const;
void lock();
void unlock();
pthread_mutex_t* getPthreadMutex();
private:
pthread_mutex_t mutex_;
pid_t holder_;
friend class Condition;
};
class LockGuard {
public:
explicit LockGuard(Mutex& lock);
~LockGuard();
private:
Mutex& lock_;
};
END_NAMESPACE
|
/*
Problem Statement
You have given a singly linked list and two integers 'N' and 'M'. Delete 'N' nodes after every 'M' nodes, or we can say more clearly that traverse the linked list such that you retain M nodes then delete next N nodes, continue the same till the end of the linked list.
Input Format :
The first line of input contains the elements of the singly linked list separated by a single space and terminated by -1. Hence, -1 would never be a list element.
The second line contains the two single space-separated integers 'N' and 'M'.
Output Format :
The only line of output contains the resultant linked list after performing required operation denoted as the elements separated by a single space and terminated by -1.
Note :
You do not need to print anything, it has already been taken care.
Constraints :
0 <= L <= 10^6
-10^9 <= data <= 10^9 and data != -1
0 <= N <= 10^6
1 <= M <= 10^6
Where L is the number of nodes in Linked List and N and M are parameters of Problem.
Time Limit: 1 sec
Note :
Try to solve this problem in O(N) time complexity and O(1) space complexity.
Sample Input 1 :
3 2 0 -4 -1
1 1
Sample Output 1 :
3 0 -1
Explanation To Sample Input 1 :
The first and third Nodes are retained, and rest are deleted.
Sample Input 2 :
3 2 0 -4 7 -9 -8 10 5 -1
1 2
Sample Output 2 :
3 2 -4 7 -8 10 -1
Explanation To Sample Input 2 :
The first, second, fourth, fifth, seventh and eighth Nodes are retained, and rest are deleted.
Sample Input 3 :
3 2 0 -4 7 -9 -8 10 5 -1
2 1
Sample Output 3 :
3 -4 -8 -1
Explanation To Sample Input 3 :
The first, fourth and seventh Nodes are retained, and rest are deleted.
*/
//Code
/****************************************************************
Following is the class structure of the Node class:
class Node
{
public:
int data;
Node *next;
Node(int data)
{
this->data = data;
this->next = NULL;
}
};
*****************************************************************/
Node *getListAfterDeleteOperation(Node *head, int n, int m)
{
// Write your code here
Node *ans=head;
int x=0;
int y=0;
Node *prev=NULL;
while(head!=NULL)
{
if(x<m)
{
prev=head;
head=head->next;
x++;
y=0;
}else{
x=0;
while(y<n && head!=NULL)
{
Node *temp=head;
head=head->next;
if(prev!=NULL){
prev->next=head;
}else{
ans=NULL;
}
delete temp;
y++;
}
}
}
return ans;
}
|
#include "GamePhysics.h"
GamePhysics::GamePhysics(float g, int gH)
{
gravity = g;
groundHeight = gH;
}
|
/*
* main.cpp
*
* Created on: Sep 12, 2016
* Author: Daghamos
*/
#include "Person.h"
#include <iostream>
#include <fstream>
int determineSize(string s){
/*
* Determins the size of the array based on the imput file.
*/
ifstream fin(s.c_str());
if(!fin){
cout<< "couldn't open the file \n";
return 0;
}
else{
int lineCount=0;
string line;
//counting lines
while(getline(fin,line) && !fin.fail()){
lineCount++;
}
return lineCount;
}
}
void print(Person p[], const int n){
for(int i = 0; i < n;i++){
cout<<i<<" ";
p[i].print();
}
}
void finData(string s, Person p[]){
/*
* It populates the array of books.
*/
ifstream fin(s.c_str());
if(!fin){
cout<< "couldn't open the file \n";
}
else{
//Populating the array with information.
string ssn,fn,ln,dob;
for(int i = 0; !fin.fail(); i++){
fin>>ssn;
if(fin.fail()) break;
fin>> fn;
if(fin.fail()) break;
fin>>ln;
if(fin.fail()) break;
fin>>dob;
if(fin.fail()) break;
p[i].setPerson(ssn,fn,ln,dob);
}
}
}
void bubbleSort(Person a[], const int n){
Person temp;
for(int i = 0; i< n; i++){
for(int j = 0; j<(n-1)-i; j++){
if(a[j].age()>a[j+1].age()){
temp = a[j+1];
a[j+1]= a[j];
a[j]=temp;
}
}
}
}
void shakerSort(Person a[], const int n){
Person temp;
for(int i = 0; i< n; i++){
//left -> right
for(int j = i; j<(n-1)-i; j++){
if(a[j].age()>a[j+1].age()){
temp = a[j+1];
a[j+1]= a[j];
a[j]=temp;
}
}
//right -> left
for(int j = (n-1)-i; j>i; j--){
if(a[j].age()<a[j-1].age()){
temp = a[j-1];
a[j-1]= a[j];
a[j]=temp;
}
}
}
}
void selectionSort(Person a[], const int n){
int maxIndex;
Person temp;
for(int i = n-1; i>0; i--){
//find max index
maxIndex =i;
for(int j = 0; j <i;j++){
if(a[maxIndex].age()<a[j].age()) maxIndex = j;
}
//swap
if(a[maxIndex].age()!=a[i].age()){
temp = a[maxIndex];
a[maxIndex] = a[i];
a[i]=temp;
}
}
}
void insertionSort(Person a[], const int n){
Person tmp;
for (int i = 1; i < n; i++) {
for (int j = i;a[j - 1].age() > a[j].age() && j > 0; j--) {
tmp = a[j];
a[j] = a[j - 1];
a[j - 1] = tmp;
}
}
}
void reverse(Person p[], const int n){
/*
* I could pass a boolean function into the sorting functions,
* but I found this easier to debug and doesn't take a long time.
* I would have to change the comparisons on the sorting functions
* to change the conditions for the sorting algorithms. Or I can
* pass a boolean parameter that tells the function if it's
* ascending(true) or decending(false) with and if(ascending)
* sort assending, else sort decending, but personally I din't
* like the way the long functions looked.
*/
Person temp;
for(int i = 0; i < n/2; i++){
temp = p[i];
p[i] = p[(n-i)-1];
p[(n-i)-1] = temp;
}
}
int main(){
cout<<"Running...\n\n";
/*
* Change the imput file here to whatever file you want to read into the person array
* as long as it's in the format ssn fn ln YYYYMMDD\n.
*/
string s = "database1.txt";
//This function finds the number of lines the fin has.
int n = determineSize(s);
// After determining the size, the array of books is created.
Person *p = new Person[1000];
finData(s, p);
/*
//I commented out this section because of automation, if you want to check my
//sorting algorithms just uncomment this section.
cout<<"Populated the array with the file \n";
finData(s, p);
bubbleSort(p,n);
shakerSort(p,n);
selectionSort(p,n);
insertionSort(p,n);
print(p,n);
//*/
/*AUTOMATION SECTION
* This section is to measure the time it takes to sort an array.
* It starts by defining the fin file name ex: s = "database20.txt";
* It then deletes the array stored in the heap and creats one according
* to the size of the new file
* There are 4 sections, one for each sorting algorithms, that each have a
* for loop. Each time the for loop restarts it fins the file to
* hace a clean array that repeat each sorting algorithm 3 times to obtain an
* average. Each time it goes through the loop it prints out the three
* different times it took to sort, sort the sorted array, and sort
* the reversed array.
*
* You can change the database by modifying the string s
*/
// <- delete one "/" to comment this whole section out
//initialize doubles to measure time and index.
double beforeUnsorted, afterUnsorted,beforeSorted, afterSorted, beforeReversed, afterReversed,i;
//////////////////////////////////////////////////////////////////////
s = "database1.txt";
delete[] p; //prevents leaks
n = determineSize(s);
p = new Person[n];
cout<<" Using bubble sort for "<<s<<endl;
for(i =1; i<=3;i++){
finData(s, p);
beforeUnsorted = getCPUTime();
bubbleSort(p,n);
afterUnsorted = getCPUTime();
beforeSorted = getCPUTime();
bubbleSort(p,n);
afterSorted = getCPUTime();
reverse(p,n);
beforeReversed = getCPUTime();
bubbleSort(p,n);
afterReversed = getCPUTime();
cout<<"\n ===================================== \n";
cout<<" Trial number: "<< i<<endl;
cout<< "Unsorted time = "<<afterUnsorted-beforeUnsorted<<endl;
cout<< "Sorted time = "<<afterSorted-beforeSorted<<endl;
cout<< "Reversed time = "<< afterReversed - beforeReversed<<endl;
}
cout<<"\n //////////////////////////////////////////////";
cout<<"\n //////////////////////////////////////////////\n";
cout<<" Using Shaker sort for:"<<s<<endl;
for(i =1; i<=3;i++){
finData(s, p);
beforeUnsorted = getCPUTime();
shakerSort(p,n);
afterUnsorted = getCPUTime();
beforeSorted = getCPUTime();
shakerSort(p,n);
afterSorted = getCPUTime();
reverse(p,n);
beforeReversed = getCPUTime();
shakerSort(p,n);
afterReversed = getCPUTime();
cout<<"\n ===================================== \n";
cout<<" Trial number: "<< i<<endl;
cout<< "Unsorted time = "<<afterUnsorted-beforeUnsorted<<endl;
cout<< "Sorted time = "<<afterSorted-beforeSorted<<endl;
cout<< "Reversed time = "<< afterReversed - beforeReversed<<endl;
}
cout<<"\n //////////////////////////////////////////////";
cout<<"\n //////////////////////////////////////////////\n";
cout<<" Using selection sort for:"<<s<<endl;
for(i =1; i<=3;i++){
finData(s, p);
beforeUnsorted = getCPUTime();
selectionSort(p,n);
afterUnsorted = getCPUTime();
beforeSorted = getCPUTime();
selectionSort(p,n);
afterSorted = getCPUTime();
reverse(p,n);
beforeReversed = getCPUTime();
selectionSort(p,n);
afterReversed = getCPUTime();
cout<<"\n ===================================== \n";
cout<<" Trial number: "<< i<<endl;
cout<< "Unsorted time = "<<afterUnsorted-beforeUnsorted<<endl;
cout<< "Sorted time = "<<afterSorted-beforeSorted<<endl;
cout<< "Reversed time = "<< afterReversed - beforeReversed<<endl;
}
cout<<"\n //////////////////////////////////////////////";
cout<<"\n //////////////////////////////////////////////\n";
cout<<" Using insertion sort for:"<<s<<endl;
for(i =1; i<=3;i++){
finData(s, p);
beforeUnsorted = getCPUTime();
insertionSort(p,n);
afterUnsorted = getCPUTime();
beforeSorted = getCPUTime();
insertionSort(p,n);
afterSorted = getCPUTime();
reverse(p,n);
beforeReversed = getCPUTime();
insertionSort(p,n);
afterReversed = getCPUTime();
cout<<"\n ===================================== \n";
cout<<" Trial number: "<< i<<endl;
cout<< "Unsorted time = "<<afterUnsorted-beforeUnsorted<<endl;
cout<< "Sorted time = "<<afterSorted-beforeSorted<<endl;
cout<< "Reversed time = "<< afterReversed - beforeReversed<<endl;
}
cout<<"\n#############################################################\n";
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//*/
return 0;
}
|
#include "Stage.hpp"
Stage::Stage()
{}
void Stage::MakeStage(RenderWindow* window, b2World* World, TempObjectHandler* toh){
Window=window;
world=World;
TOH=toh;
//ground
b2BodyDef groundBodyDef;
groundBodyDef.position.Set(1200.0f, 1795.0f);
b2Body* groundBody = world->CreateBody(&groundBodyDef);
b2PolygonDef groundShapeDef;
groundShapeDef.SetAsBox(1200.0f, 5.0f);
groundShapeDef.friction=1.1f;
groundBody->CreateShape(&groundShapeDef);
grounddata.label="GROUND";
grounddata.object=this;
groundBody->SetUserData(&grounddata);
//grassImg.LoadFromFile("contents/d.bg_grass.png");
//grassImg.LoadFromFile("contents/xmas_ground.png");
GrassSp.SetImage(grassImg);
GrassSp.SetPosition(-50,1760);
//Ground=Shape::Rectangle(0, 0, 800, 10, Color(0,0,200));
//Ground.SetCenter(400,5);
//Ground.SetPosition(400,595);
//wall 1
b2BodyDef wall1BodyDef;
wall1BodyDef.position.Set(5.0f, 900.0f);
wall1Body = world->CreateBody(&wall1BodyDef);
b2PolygonDef wall1ShapeDef;
wall1ShapeDef.SetAsBox(5.0f, 900.0f);
wall1Body->CreateShape(&wall1ShapeDef);
wall1data.label="wall1";
wall1data.object=this;
wall1Body->SetUserData(&wall1data);
Wall1=Shape::Rectangle(0, 0, wall1ShapeDef.vertices[2].x*2, wall1ShapeDef.vertices[2].y*2, Color(0,0,200));
Wall1.SetCenter(wall1ShapeDef.vertices[2].x, wall1ShapeDef.vertices[2].y);
Wall1.SetPosition(wall1BodyDef.position.x,wall1BodyDef.position.y);
//wall 2
b2BodyDef wall2BodyDef;
wall2BodyDef.position.Set(2395.0f, 900.0f);
wall2Body = world->CreateBody(&wall2BodyDef);
b2PolygonDef wall2ShapeDef;
wall2ShapeDef.SetAsBox(5.0f, 900.0f);
wall2Body->CreateShape(&wall2ShapeDef);
wall2data.label="wall2";
wall2data.object=this;
wall2Body->SetUserData(&wall2data);
Wall2=Shape::Rectangle(0, 0, wall2ShapeDef.vertices[2].x*2, wall2ShapeDef.vertices[2].y*2, Color(0,0,200));
Wall2.SetCenter(wall2ShapeDef.vertices[2].x, wall2ShapeDef.vertices[2].y);
Wall2.SetPosition(wall2BodyDef.position.x,wall2BodyDef.position.y);
//roof
b2BodyDef roofBodyDef;
roofBodyDef.position.Set(1200.0f, 5.0f);
roofBody = world->CreateBody(&roofBodyDef);
b2PolygonDef roofShapeDef;
roofShapeDef.SetAsBox(1200.0f, 5.0f);
roofBody->CreateShape(&roofShapeDef);
roofdata.label="roof";
roofdata.object=this;
roofBody->SetUserData(&roofdata);
Roof=Shape::Rectangle(0, 0, roofShapeDef.vertices[2].x*2, roofShapeDef.vertices[2].y*2, Color(0,0,200));
Roof.SetCenter(roofShapeDef.vertices[2].x, roofShapeDef.vertices[2].y);
Roof.SetPosition(roofBodyDef.position.x,roofBodyDef.position.y);
/*treeImg.LoadFromFile("contents/fákk1.png");
TreeSp.SetImage(treeImg);
TreeSp.SetCenter(220,850);
TreeSp.SetScale(2,2);
TreeSp.SetPosition(5,1800);*/
bacgroundImg.LoadFromFile("contents/Fantasy_War_014653_.jpg");
BacgroundSp.SetImage(bacgroundImg);
BacgroundSp.SetScale(1.5,1.5);
b2BodyDef stageBodyDef;
stageBodyDef.position.Set(520.0f, 1780.0f);
stageBody = world->CreateBody(&stageBodyDef);
b2PolygonDef stageShapeDef;
stageShapeDef.SetAsBox(510.0f, 15.0f);
stageBody->CreateShape(&stageShapeDef);
stageShapeDef.SetAsBox(15.0f, 30.0f, b2Vec2(500,0),0);
//stageShapeDef.localPosition.Set(500,0);
stageBody->CreateShape(&stageShapeDef);
stagedata.label="stage";
stagedata.object=this;
stageBody->SetUserData(&stagedata);
//StageShape=Shape::Rectangle(0, 0, stageShapeDef.vertices[2].x*2, stageShapeDef.vertices[2].y*2, Color(0,0,200));
StageShape=Shape::Rectangle(0, 0, 30, 60, Color(0,0,200));
StageShape.SetCenter(stageShapeDef.vertices[2].x, stageShapeDef.vertices[2].y);
//StageShape.SetPosition(stageBodyDef.position.x,stageBodyDef.position.y);
StageShape.SetPosition(stageBodyDef.position.x+1000,stageBodyDef.position.y);
stageImg.LoadFromFile("contents/roof.png");
StageSp.SetImage(stageImg);
StageSp.SetPosition(-100,1690);
/*TOH->Add(new DestroyableBody(Window, world, TOH, 1600, 1500, 0, true));
TOH->Add(new DestroyableBody(Window, world, TOH, 2000, 1500, 270, true));
TOH->Add(new DestroyableBody(Window, world, TOH, 2100, 1500, 90, true));
TOH->Add(new DestroyableBody(Window, world, TOH, 2100, 1000, 180, true));
*/
for(int i=0;i<5;i++){
TOH->Add(new DestroyableBody(Window, world, TOH, 300+(i*500), 1500, 270, true));
}
}
void Stage::Show(){
//Window->Draw(Ground);
Window->Draw(BacgroundSp);
Window->Draw(StageSp);
//Window->Draw(StageShape);
Window->Draw(Wall1);
Window->Draw(Wall2);
Window->Draw(Roof);
Window->Draw(GrassSp);
GrassSp.SetPosition(-40,1765);
}
void Stage::ShowAfter(){
//Window->Draw(TreeSp);
Window->Draw(GrassSp);
GrassSp.SetPosition(-50,1760);
//db->Show();
//db2->Show();
//db3->Show();
}
void Stage::InputHandling(){
//db->InputHandling();
//db2->InputHandling();
//db3->InputHandling();
}
|
#include <iostream>
#include <stdlib.h>
using namespace std;
typedef struct _node
{
int data;
struct _node* left;
struct _node* right;
}node;
node* createNode(int x)
{
node* p=(node*)malloc(sizeof(struct _node));
p->data=x;
p->right=NULL;
p->left=NULL;
return p;
}
int search(int in[],int start,int end,int data)
{
for(int i=start;i<=end;i++)
{
if(in[i]==data)
return i;
}
}
node* build_tree(int in[],int pre[],int start,int end,int* counter)
{
if(start>end)
return NULL;
node* theNode=createNode(pre[(*counter)++]);
if(start==end)
return theNode;
int index=search(in,start,end,theNode->data);
theNode->left=build_tree(in,pre,start,index-1,counter);
theNode->right=build_tree(in,pre,index+1,end,counter);
return theNode;
}
void printTree(node* root)
{
if(root!=NULL)
{
printTree(root->left);
printTree(root->right);
cout<<root->data<<" ";
}
}
int main()
{
cout<<"Tell the number of elements"<<endl;
int n;
cin>>n;
int in[n],pre[n];
for(int i=0;i<n;i++)
cin>>in[i];
for(int i=0;i<n;i++)
cin>>pre[i];
node* root=NULL;
int counter=0;
root=build_tree(in,pre,0,n-1,&counter);
printTree(root);
}
|
#ifndef TABLE_H
#define TABLE_H
#include <list>
#include "order.h"
enum TableState {
EMPTY,
NEW_GUEST,
ORDER_PENDING,
READY_TO_PAY
};
class Table
{
private:
static int count;
std::list<const Order*> orderList;
TableState state;
public:
Table();
Table(const Table&);
Table(Table&&);
TableState getState() const;
void setState(TableState _state);
bool addOrder(const Order*);
bool eraseOrder(const Order*);
};
#endif // TABLE_H
|
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main(){
ios::sync_with_stdio(0); cin.tie(0);
int n;
cin >> n;
ll ans = 0;
vector < ll > v(n);
for(int i =0 ; i < n; i++){
cin >> v[i] ;
}
for(int i = 0; i < n; i++){
int tmp;
cin >> tmp;
v[i] -= tmp;
}
sort(v.begin(), v.end());
for(int i = 0; i < n; i++){
ll tmp = upper_bound(v.begin(), v.end(),-v[i]) - v.begin();
tmp = n - tmp;
if(v[i] > 0 && tmp > 0 ) tmp--;
//cout << v[i] << " " << tmp << endl;
ans += tmp;
}
cout << ans / 2 << endl;
return 0;
}
|
#include <cmath>
#include <iostream>
using namespace std;
double Delta = 0.0001;
double Round (double X,double Delta)
{
if (Delta<=1E-9)
{
puts("Неверное задание точности округления\n");
exit(1);
}
if (X>0.0)
return (Delta*(long((X/Delta)+0.5)));
else
return (Delta*(long((X/Delta)-0.5)));
}
double Eitken(int a, int b, double x)
{
double masX[4];
masX[0] = Round(0.315236273252746, Delta);
// masX[1] = 0.9536;
// masX[2] = 1.1080;
// masX[3] = 2.4728;
masX[1] = Round(4.17921233625173, Delta);
// masX[5] = 4.5616;
// masX[6] = 4.6304;
masX[2] = Round(4.6704674547625, Delta);
// masX[8] = 5.2480;
masX[3] = Round(5.5680073432236745, Delta);
// masX[10] = 6.3568;
double masY[4];
masY[0] = Round(pow(masX[0], 3), Delta);
// masY[1] = -0.0994;
// masY[2] = 0.1823;
// masY[3] = -0.3571;
masY[1] = Round(pow(masX[1], 3), Delta);
// masY[5] = 14.2471;
// masY[6] = 15.5694;
masY[2] = Round(pow(masX[2], 3), Delta);
// masY[8] = 31.0168;
masY[3] = Round(pow(masX[3], 3), Delta);
// masY[10] = 78.3427;
double dx1,dx2;
if(b - a == 1)
{
// для соседних значений в таблице
dx1 = (x - masX[a]) * masY[b]; // вычисление опредилителя
dx2 = (x - masX[b]) * masY[a];
return((dx1 - dx2) / (masX[b] - masX[a]));
}
else // если элементы не соседние, то вычисляем значение интерполяционных многочленов более мелких порядков
return(((x - masX[a]) * Eitken(a + 1, b, x) - (x - masX[b]) * Eitken(a,b - 1, x)) / (masX[b] - masX[a]));
}
int main() {
double x, y;
cout << "Input the argument: x = ";
cin >> x;
y = Eitken(0, 3, x);
cout << "The method of Eitken: y = " << y;
return 0; }
|
// ==============================================================
// RTL generated by Vivado(TM) HLS - High-Level Synthesis from C, C++ and SystemC
// Version: 2013.4
// Copyright (C) 2013 Xilinx Inc. All rights reserved.
//
// ===========================================================
#include "combiner_top.h"
#include "AESL_pkg.h"
using namespace std;
namespace ap_rtl {
const sc_logic combiner_top::ap_const_logic_1 = sc_dt::Log_1;
const sc_logic combiner_top::ap_const_logic_0 = sc_dt::Log_0;
const sc_lv<5> combiner_top::ap_ST_st1_fsm_0 = "00000";
const sc_lv<5> combiner_top::ap_ST_st2_fsm_1 = "1";
const sc_lv<5> combiner_top::ap_ST_st3_fsm_2 = "10";
const sc_lv<5> combiner_top::ap_ST_st4_fsm_3 = "11";
const sc_lv<5> combiner_top::ap_ST_st5_fsm_4 = "100";
const sc_lv<5> combiner_top::ap_ST_pp1_stg0_fsm_5 = "101";
const sc_lv<5> combiner_top::ap_ST_st14_fsm_6 = "110";
const sc_lv<5> combiner_top::ap_ST_pp2_stg0_fsm_7 = "111";
const sc_lv<5> combiner_top::ap_ST_st23_fsm_8 = "1000";
const sc_lv<5> combiner_top::ap_ST_st24_fsm_9 = "1001";
const sc_lv<5> combiner_top::ap_ST_st25_fsm_10 = "1010";
const sc_lv<5> combiner_top::ap_ST_st26_fsm_11 = "1011";
const sc_lv<5> combiner_top::ap_ST_pp4_stg0_fsm_12 = "1100";
const sc_lv<5> combiner_top::ap_ST_pp4_stg1_fsm_13 = "1101";
const sc_lv<5> combiner_top::ap_ST_pp4_stg2_fsm_14 = "1110";
const sc_lv<5> combiner_top::ap_ST_st66_fsm_15 = "1111";
const sc_lv<5> combiner_top::ap_ST_pp5_stg0_fsm_16 = "10000";
const sc_lv<5> combiner_top::ap_ST_st70_fsm_17 = "10001";
const sc_lv<5> combiner_top::ap_ST_st71_fsm_18 = "10010";
const sc_lv<32> combiner_top::ap_const_lv32_0 = "00000000000000000000000000000000";
const sc_lv<1> combiner_top::ap_const_lv1_0 = "0";
const sc_lv<9> combiner_top::ap_const_lv9_0 = "000000000";
const sc_lv<6> combiner_top::ap_const_lv6_0 = "000000";
const sc_lv<5> combiner_top::ap_const_lv5_0 = "00000";
const sc_lv<30> combiner_top::ap_const_lv30_0 = "000000000000000000000000000000";
const sc_lv<32> combiner_top::ap_const_lv32_30 = "110000";
const sc_lv<32> combiner_top::ap_const_lv32_20 = "100000";
const sc_lv<9> combiner_top::ap_const_lv9_100 = "100000000";
const sc_lv<9> combiner_top::ap_const_lv9_1 = "1";
const sc_lv<32> combiner_top::ap_const_lv32_2 = "10";
const sc_lv<32> combiner_top::ap_const_lv32_1F = "11111";
const sc_lv<6> combiner_top::ap_const_lv6_30 = "110000";
const sc_lv<6> combiner_top::ap_const_lv6_1 = "1";
const sc_lv<32> combiner_top::ap_const_lv32_1 = "1";
const sc_lv<6> combiner_top::ap_const_lv6_20 = "100000";
const sc_lv<5> combiner_top::ap_const_lv5_10 = "10000";
const sc_lv<5> combiner_top::ap_const_lv5_1 = "1";
const sc_lv<2> combiner_top::ap_const_lv2_0 = "00";
const sc_lv<7> combiner_top::ap_const_lv7_1 = "1";
const sc_lv<1> combiner_top::ap_const_lv1_1 = "1";
const sc_lv<7> combiner_top::ap_const_lv7_2 = "10";
const sc_lv<32> combiner_top::ap_const_lv32_10 = "10000";
const sc_lv<32> combiner_top::ap_const_lv32_C = "1100";
const sc_lv<30> combiner_top::ap_const_lv30_1 = "1";
combiner_top::combiner_top(sc_module_name name) : sc_module(name), mVcdFile(0) {
centre_buffer_0_wgtCent_value_U = new combiner_top_centre_buffer_0_wgtCent_value("centre_buffer_0_wgtCent_value_U");
centre_buffer_0_wgtCent_value_U->clk(ap_clk);
centre_buffer_0_wgtCent_value_U->reset(ap_rst);
centre_buffer_0_wgtCent_value_U->address0(centre_buffer_0_wgtCent_value_address0);
centre_buffer_0_wgtCent_value_U->ce0(centre_buffer_0_wgtCent_value_ce0);
centre_buffer_0_wgtCent_value_U->we0(centre_buffer_0_wgtCent_value_we0);
centre_buffer_0_wgtCent_value_U->d0(centre_buffer_0_wgtCent_value_d0);
centre_buffer_0_wgtCent_value_U->q0(centre_buffer_0_wgtCent_value_q0);
centre_buffer_1_wgtCent_value_U = new combiner_top_centre_buffer_0_wgtCent_value("centre_buffer_1_wgtCent_value_U");
centre_buffer_1_wgtCent_value_U->clk(ap_clk);
centre_buffer_1_wgtCent_value_U->reset(ap_rst);
centre_buffer_1_wgtCent_value_U->address0(centre_buffer_1_wgtCent_value_address0);
centre_buffer_1_wgtCent_value_U->ce0(centre_buffer_1_wgtCent_value_ce0);
centre_buffer_1_wgtCent_value_U->we0(centre_buffer_1_wgtCent_value_we0);
centre_buffer_1_wgtCent_value_U->d0(centre_buffer_1_wgtCent_value_d0);
centre_buffer_1_wgtCent_value_U->q0(centre_buffer_1_wgtCent_value_q0);
centre_buffer_2_wgtCent_value_U = new combiner_top_centre_buffer_0_wgtCent_value("centre_buffer_2_wgtCent_value_U");
centre_buffer_2_wgtCent_value_U->clk(ap_clk);
centre_buffer_2_wgtCent_value_U->reset(ap_rst);
centre_buffer_2_wgtCent_value_U->address0(centre_buffer_2_wgtCent_value_address0);
centre_buffer_2_wgtCent_value_U->ce0(centre_buffer_2_wgtCent_value_ce0);
centre_buffer_2_wgtCent_value_U->we0(centre_buffer_2_wgtCent_value_we0);
centre_buffer_2_wgtCent_value_U->d0(centre_buffer_2_wgtCent_value_d0);
centre_buffer_2_wgtCent_value_U->q0(centre_buffer_2_wgtCent_value_q0);
centre_buffer_sum_sq_U = new combiner_top_centre_buffer_0_wgtCent_value("centre_buffer_sum_sq_U");
centre_buffer_sum_sq_U->clk(ap_clk);
centre_buffer_sum_sq_U->reset(ap_rst);
centre_buffer_sum_sq_U->address0(centre_buffer_sum_sq_address0);
centre_buffer_sum_sq_U->ce0(centre_buffer_sum_sq_ce0);
centre_buffer_sum_sq_U->we0(centre_buffer_sum_sq_we0);
centre_buffer_sum_sq_U->d0(centre_buffer_sum_sq_d0);
centre_buffer_sum_sq_U->q0(centre_buffer_sum_sq_q0);
centre_buffer_count_U = new combiner_top_centre_buffer_0_wgtCent_value("centre_buffer_count_U");
centre_buffer_count_U->clk(ap_clk);
centre_buffer_count_U->reset(ap_rst);
centre_buffer_count_U->address0(centre_buffer_count_address0);
centre_buffer_count_U->ce0(centre_buffer_count_ce0);
centre_buffer_count_U->we0(centre_buffer_count_we0);
centre_buffer_count_U->d0(centre_buffer_count_d0);
centre_buffer_count_U->q0(centre_buffer_count_q0);
i_buffer_U = new combiner_top_i_buffer("i_buffer_U");
i_buffer_U->clk(ap_clk);
i_buffer_U->reset(ap_rst);
i_buffer_U->address0(i_buffer_address0);
i_buffer_U->ce0(i_buffer_ce0);
i_buffer_U->we0(i_buffer_we0);
i_buffer_U->d0(i_buffer_d0);
i_buffer_U->q0(i_buffer_q0);
p_buffer_U = new combiner_top_p_buffer("p_buffer_U");
p_buffer_U->clk(ap_clk);
p_buffer_U->reset(ap_rst);
p_buffer_U->address0(p_buffer_address0);
p_buffer_U->ce0(p_buffer_ce0);
p_buffer_U->we0(p_buffer_we0);
p_buffer_U->d0(p_buffer_d0);
p_buffer_U->q0(p_buffer_q0);
p_buffer_U->address1(p_buffer_address1);
p_buffer_U->ce1(p_buffer_ce1);
p_buffer_U->q1(p_buffer_q1);
c_buffer_U = new combiner_top_c_buffer("c_buffer_U");
c_buffer_U->clk(ap_clk);
c_buffer_U->reset(ap_rst);
c_buffer_U->address0(c_buffer_address0);
c_buffer_U->ce0(c_buffer_ce0);
c_buffer_U->we0(c_buffer_we0);
c_buffer_U->d0(c_buffer_d0);
c_buffer_U->q0(c_buffer_q0);
combiner_top_sdiv_32ns_32ns_32_35_U1 = new combiner_top_sdiv_32ns_32ns_32_35<1,35,32,32,32>("combiner_top_sdiv_32ns_32ns_32_35_U1");
combiner_top_sdiv_32ns_32ns_32_35_U1->clk(ap_clk);
combiner_top_sdiv_32ns_32ns_32_35_U1->reset(ap_rst);
combiner_top_sdiv_32ns_32ns_32_35_U1->din0(grp_fu_917_p0);
combiner_top_sdiv_32ns_32ns_32_35_U1->din1(grp_fu_917_p1);
combiner_top_sdiv_32ns_32ns_32_35_U1->ce(grp_fu_917_ce);
combiner_top_sdiv_32ns_32ns_32_35_U1->dout(grp_fu_917_p2);
combiner_top_sdiv_32ns_32ns_32_35_U2 = new combiner_top_sdiv_32ns_32ns_32_35<2,35,32,32,32>("combiner_top_sdiv_32ns_32ns_32_35_U2");
combiner_top_sdiv_32ns_32ns_32_35_U2->clk(ap_clk);
combiner_top_sdiv_32ns_32ns_32_35_U2->reset(ap_rst);
combiner_top_sdiv_32ns_32ns_32_35_U2->din0(grp_fu_930_p0);
combiner_top_sdiv_32ns_32ns_32_35_U2->din1(grp_fu_930_p1);
combiner_top_sdiv_32ns_32ns_32_35_U2->ce(grp_fu_930_ce);
combiner_top_sdiv_32ns_32ns_32_35_U2->dout(grp_fu_930_p2);
combiner_top_sdiv_32ns_32ns_32_35_U3 = new combiner_top_sdiv_32ns_32ns_32_35<3,35,32,32,32>("combiner_top_sdiv_32ns_32ns_32_35_U3");
combiner_top_sdiv_32ns_32ns_32_35_U3->clk(ap_clk);
combiner_top_sdiv_32ns_32ns_32_35_U3->reset(ap_rst);
combiner_top_sdiv_32ns_32ns_32_35_U3->din0(grp_fu_936_p0);
combiner_top_sdiv_32ns_32ns_32_35_U3->din1(grp_fu_936_p1);
combiner_top_sdiv_32ns_32ns_32_35_U3->ce(grp_fu_936_ce);
combiner_top_sdiv_32ns_32ns_32_35_U3->dout(grp_fu_936_p2);
SC_METHOD(thread_ap_clk_no_reset_);
dont_initialize();
sensitive << ( ap_clk.pos() );
SC_METHOD(thread_ap_done);
sensitive << ( ap_CS_fsm );
sensitive << ( distortion_out1ack_in );
SC_METHOD(thread_ap_idle);
sensitive << ( ap_start );
sensitive << ( ap_CS_fsm );
SC_METHOD(thread_ap_ready);
sensitive << ( ap_CS_fsm );
sensitive << ( distortion_out1ack_in );
SC_METHOD(thread_ap_sig_bdd_1186);
sensitive << ( ap_CS_fsm );
sensitive << ( tmp_1_fu_872_p2 );
SC_METHOD(thread_ap_sig_bdd_1189);
sensitive << ( ap_CS_fsm );
sensitive << ( tmp_1_reg_1213 );
sensitive << ( tmp_13_reg_1242 );
SC_METHOD(thread_ap_sig_bdd_218);
sensitive << ( master_portA_rsp_empty_n );
sensitive << ( ap_reg_ppstg_exitcond9_reg_1097_pp1_it5 );
SC_METHOD(thread_ap_sig_bdd_251);
sensitive << ( master_portA_rsp_empty_n );
sensitive << ( ap_reg_ppstg_exitcond1_reg_1116_pp2_it5 );
SC_METHOD(thread_ap_sig_bdd_565);
sensitive << ( master_portA_req_full_n );
sensitive << ( ap_reg_ppstg_exitcond_reg_1315_pp5_it1 );
SC_METHOD(thread_b_1_fu_866_p2);
sensitive << ( b_reg_471 );
SC_METHOD(thread_c_buffer_address0);
sensitive << ( ap_CS_fsm );
sensitive << ( ap_reg_ppiten_pp4_it12 );
sensitive << ( ap_reg_ppiten_pp5_it0 );
sensitive << ( tmp_12_fu_941_p1 );
sensitive << ( tmp_26_1_fu_950_p1 );
sensitive << ( tmp_26_2_fu_960_p1 );
sensitive << ( tmp_28_fu_1031_p1 );
SC_METHOD(thread_c_buffer_ce0);
sensitive << ( ap_CS_fsm );
sensitive << ( ap_reg_ppiten_pp4_it12 );
sensitive << ( ap_reg_ppiten_pp5_it0 );
sensitive << ( ap_sig_bdd_565 );
sensitive << ( ap_reg_ppiten_pp5_it2 );
SC_METHOD(thread_c_buffer_d0);
sensitive << ( ap_CS_fsm );
sensitive << ( ap_reg_ppiten_pp4_it12 );
sensitive << ( grp_fu_917_p2 );
sensitive << ( grp_fu_930_p2 );
sensitive << ( grp_fu_936_p2 );
SC_METHOD(thread_c_buffer_we0);
sensitive << ( ap_CS_fsm );
sensitive << ( ap_reg_ppiten_pp4_it12 );
sensitive << ( ap_reg_ppstg_tmp_1_reg_1213_pp4_it11 );
sensitive << ( ap_reg_ppstg_tmp_1_reg_1213_pp4_it12 );
SC_METHOD(thread_centre_buffer_0_wgtCent_value_address0);
sensitive << ( ap_CS_fsm );
sensitive << ( centre_buffer_0_wgtCent_value_addr_2_reg_1193 );
sensitive << ( ap_reg_ppiten_pp4_it0 );
sensitive << ( tmp_8_reg_1222 );
sensitive << ( tmp_2_fu_583_p1 );
sensitive << ( tmp_27_fu_824_p1 );
SC_METHOD(thread_centre_buffer_0_wgtCent_value_ce0);
sensitive << ( ap_CS_fsm );
sensitive << ( ap_reg_ppiten_pp4_it0 );
SC_METHOD(thread_centre_buffer_0_wgtCent_value_d0);
sensitive << ( ap_CS_fsm );
sensitive << ( tmp_33_fu_847_p2 );
SC_METHOD(thread_centre_buffer_0_wgtCent_value_we0);
sensitive << ( ap_CS_fsm );
sensitive << ( exitcond6_reg_1129 );
sensitive << ( exitcond8_fu_571_p2 );
SC_METHOD(thread_centre_buffer_1_wgtCent_value_address0);
sensitive << ( ap_CS_fsm );
sensitive << ( centre_buffer_1_wgtCent_value_addr_2_reg_1198 );
sensitive << ( ap_reg_ppiten_pp4_it0 );
sensitive << ( tmp_8_reg_1222 );
sensitive << ( tmp_2_fu_583_p1 );
sensitive << ( tmp_27_fu_824_p1 );
SC_METHOD(thread_centre_buffer_1_wgtCent_value_ce0);
sensitive << ( ap_CS_fsm );
sensitive << ( ap_reg_ppiten_pp4_it0 );
SC_METHOD(thread_centre_buffer_1_wgtCent_value_d0);
sensitive << ( ap_CS_fsm );
sensitive << ( tmp_43_1_fu_853_p2 );
SC_METHOD(thread_centre_buffer_1_wgtCent_value_we0);
sensitive << ( ap_CS_fsm );
sensitive << ( exitcond6_reg_1129 );
sensitive << ( exitcond8_fu_571_p2 );
SC_METHOD(thread_centre_buffer_2_wgtCent_value_address0);
sensitive << ( ap_CS_fsm );
sensitive << ( centre_buffer_2_wgtCent_value_addr_2_reg_1203 );
sensitive << ( ap_reg_ppiten_pp4_it0 );
sensitive << ( tmp_8_reg_1222 );
sensitive << ( tmp_2_fu_583_p1 );
sensitive << ( tmp_27_fu_824_p1 );
SC_METHOD(thread_centre_buffer_2_wgtCent_value_ce0);
sensitive << ( ap_CS_fsm );
sensitive << ( ap_reg_ppiten_pp4_it0 );
SC_METHOD(thread_centre_buffer_2_wgtCent_value_d0);
sensitive << ( ap_CS_fsm );
sensitive << ( tmp_43_2_fu_859_p2 );
SC_METHOD(thread_centre_buffer_2_wgtCent_value_we0);
sensitive << ( ap_CS_fsm );
sensitive << ( exitcond6_reg_1129 );
sensitive << ( exitcond8_fu_571_p2 );
SC_METHOD(thread_centre_buffer_count_address0);
sensitive << ( ap_CS_fsm );
sensitive << ( centre_buffer_count_addr_2_reg_1183 );
sensitive << ( ap_reg_ppiten_pp4_it0 );
sensitive << ( tmp_8_fu_883_p1 );
sensitive << ( tmp_2_fu_583_p1 );
sensitive << ( tmp_27_fu_824_p1 );
SC_METHOD(thread_centre_buffer_count_ce0);
sensitive << ( ap_CS_fsm );
sensitive << ( ap_reg_ppiten_pp4_it0 );
SC_METHOD(thread_centre_buffer_count_d0);
sensitive << ( ap_CS_fsm );
sensitive << ( tmp_31_fu_833_p2 );
SC_METHOD(thread_centre_buffer_count_we0);
sensitive << ( ap_CS_fsm );
sensitive << ( exitcond6_reg_1129 );
sensitive << ( exitcond8_fu_571_p2 );
SC_METHOD(thread_centre_buffer_sum_sq_address0);
sensitive << ( ap_CS_fsm );
sensitive << ( centre_buffer_sum_sq_addr_2_reg_1188 );
sensitive << ( ap_reg_ppiten_pp4_it0 );
sensitive << ( tmp_8_reg_1222 );
sensitive << ( tmp_2_fu_583_p1 );
sensitive << ( tmp_27_fu_824_p1 );
SC_METHOD(thread_centre_buffer_sum_sq_ce0);
sensitive << ( ap_CS_fsm );
sensitive << ( ap_reg_ppiten_pp4_it0 );
SC_METHOD(thread_centre_buffer_sum_sq_d0);
sensitive << ( ap_CS_fsm );
sensitive << ( tmp_32_fu_840_p2 );
SC_METHOD(thread_centre_buffer_sum_sq_we0);
sensitive << ( ap_CS_fsm );
sensitive << ( exitcond6_reg_1129 );
sensitive << ( exitcond8_fu_571_p2 );
SC_METHOD(thread_centres_out_addr0ack_out);
sensitive << ( ap_CS_fsm );
sensitive << ( distortion_out1ack_in );
SC_METHOD(thread_data_points_in_addr0ack_out);
sensitive << ( ap_CS_fsm );
sensitive << ( distortion_out1ack_in );
SC_METHOD(thread_distortion_out);
sensitive << ( distortion_out1data_reg );
SC_METHOD(thread_distortion_out1ack_in);
sensitive << ( distortion_out1vld_reg );
SC_METHOD(thread_distortion_out1vld_in);
sensitive << ( ap_CS_fsm );
SC_METHOD(thread_exitcond1_fu_702_p2);
sensitive << ( ap_CS_fsm );
sensitive << ( ap_reg_ppiten_pp2_it0 );
sensitive << ( ap_sig_bdd_251 );
sensitive << ( ap_reg_ppiten_pp2_it6 );
sensitive << ( indvar2_phi_fu_499_p4 );
SC_METHOD(thread_exitcond6_fu_725_p2);
sensitive << ( ap_CS_fsm );
sensitive << ( i1_reg_507 );
SC_METHOD(thread_exitcond8_fu_571_p2);
sensitive << ( ap_CS_fsm );
sensitive << ( i_reg_460 );
SC_METHOD(thread_exitcond9_fu_654_p2);
sensitive << ( ap_CS_fsm );
sensitive << ( ap_reg_ppiten_pp1_it0 );
sensitive << ( ap_sig_bdd_218 );
sensitive << ( ap_reg_ppiten_pp1_it6 );
sensitive << ( indvar_phi_fu_487_p4 );
SC_METHOD(thread_exitcond_fu_1020_p2);
sensitive << ( ap_CS_fsm );
sensitive << ( indvar1_reg_553 );
sensitive << ( tmp_38_add_i32_shr_reg_1305 );
sensitive << ( ap_reg_ppiten_pp5_it0 );
sensitive << ( ap_sig_bdd_565 );
sensitive << ( ap_reg_ppiten_pp5_it2 );
SC_METHOD(thread_grp_fu_917_ce);
SC_METHOD(thread_grp_fu_917_p0);
sensitive << ( ap_CS_fsm );
sensitive << ( ap_reg_ppiten_pp4_it0 );
sensitive << ( centre_buffer_0_wgtCent_value_q0 );
SC_METHOD(thread_grp_fu_917_p1);
sensitive << ( ap_CS_fsm );
sensitive << ( ap_reg_ppiten_pp4_it0 );
sensitive << ( count_reg_1246 );
sensitive << ( tmp_9_fu_905_p2 );
SC_METHOD(thread_grp_fu_930_ce);
SC_METHOD(thread_grp_fu_930_p0);
sensitive << ( ap_CS_fsm );
sensitive << ( ap_reg_ppiten_pp4_it1 );
sensitive << ( centre_buffer_1_wgtCent_value_q0 );
SC_METHOD(thread_grp_fu_930_p1);
sensitive << ( ap_CS_fsm );
sensitive << ( ap_reg_ppiten_pp4_it1 );
sensitive << ( i_count_reg_1262 );
SC_METHOD(thread_grp_fu_936_ce);
SC_METHOD(thread_grp_fu_936_p0);
sensitive << ( ap_CS_fsm );
sensitive << ( ap_reg_ppiten_pp4_it1 );
sensitive << ( centre_buffer_2_wgtCent_value_load_reg_1295 );
SC_METHOD(thread_grp_fu_936_p1);
sensitive << ( ap_CS_fsm );
sensitive << ( ap_reg_ppiten_pp4_it1 );
sensitive << ( i_count_reg_1262 );
SC_METHOD(thread_i1_cast2_fu_737_p1);
sensitive << ( i1_reg_507 );
SC_METHOD(thread_i5_phi_fu_534_p4);
sensitive << ( ap_CS_fsm );
sensitive << ( i5_reg_530 );
sensitive << ( tmp_1_reg_1213 );
sensitive << ( ap_reg_ppiten_pp4_it1 );
sensitive << ( i_2_reg_1217 );
sensitive << ( tmp_13_reg_1242 );
SC_METHOD(thread_i_1_fu_577_p2);
sensitive << ( i_reg_460 );
SC_METHOD(thread_i_2_fu_877_p2);
sensitive << ( i5_phi_fu_534_p4 );
SC_METHOD(thread_i_3_fu_731_p2);
sensitive << ( i1_reg_507 );
SC_METHOD(thread_i_buffer_address0);
sensitive << ( ap_CS_fsm );
sensitive << ( ap_reg_ppiten_pp2_it7 );
sensitive << ( tmp_34_fu_720_p1 );
sensitive << ( tmp_19_fu_751_p1 );
sensitive << ( tmp_21_fu_805_p1 );
SC_METHOD(thread_i_buffer_ce0);
sensitive << ( ap_CS_fsm );
sensitive << ( ap_sig_bdd_251 );
sensitive << ( ap_reg_ppiten_pp2_it6 );
sensitive << ( ap_reg_ppiten_pp2_it7 );
SC_METHOD(thread_i_buffer_d0);
sensitive << ( ap_CS_fsm );
sensitive << ( ap_reg_ppiten_pp2_it7 );
sensitive << ( reg_565 );
SC_METHOD(thread_i_buffer_we0);
sensitive << ( ap_CS_fsm );
sensitive << ( ap_sig_bdd_251 );
sensitive << ( ap_reg_ppiten_pp2_it6 );
sensitive << ( ap_reg_ppiten_pp2_it7 );
sensitive << ( ap_reg_ppstg_exitcond1_reg_1116_pp2_it6 );
SC_METHOD(thread_i_count_fu_910_p3);
sensitive << ( count_reg_1246 );
sensitive << ( tmp_9_fu_905_p2 );
SC_METHOD(thread_indvar2_phi_fu_499_p4);
sensitive << ( ap_CS_fsm );
sensitive << ( indvar2_reg_495 );
sensitive << ( ap_reg_ppiten_pp2_it1 );
sensitive << ( exitcond1_reg_1116 );
sensitive << ( indvar_next2_reg_1120 );
SC_METHOD(thread_indvar_next1_fu_1025_p2);
sensitive << ( indvar1_reg_553 );
SC_METHOD(thread_indvar_next2_fu_708_p2);
sensitive << ( indvar2_phi_fu_499_p4 );
SC_METHOD(thread_indvar_next_fu_660_p2);
sensitive << ( indvar_phi_fu_487_p4 );
SC_METHOD(thread_indvar_phi_fu_487_p4);
sensitive << ( ap_CS_fsm );
sensitive << ( indvar_reg_483 );
sensitive << ( ap_reg_ppiten_pp1_it1 );
sensitive << ( exitcond9_reg_1097 );
sensitive << ( indvar_next_reg_1101 );
SC_METHOD(thread_isIter0_fu_666_p2);
sensitive << ( ap_CS_fsm );
sensitive << ( ap_reg_ppiten_pp1_it0 );
sensitive << ( ap_sig_bdd_218 );
sensitive << ( ap_reg_ppiten_pp1_it6 );
sensitive << ( exitcond9_fu_654_p2 );
sensitive << ( indvar_phi_fu_487_p4 );
SC_METHOD(thread_isIter1_fu_714_p2);
sensitive << ( ap_CS_fsm );
sensitive << ( ap_reg_ppiten_pp2_it0 );
sensitive << ( ap_sig_bdd_251 );
sensitive << ( ap_reg_ppiten_pp2_it6 );
sensitive << ( exitcond1_fu_702_p2 );
sensitive << ( indvar2_phi_fu_499_p4 );
SC_METHOD(thread_isIter_fu_1036_p2);
sensitive << ( ap_CS_fsm );
sensitive << ( indvar1_reg_553 );
sensitive << ( exitcond_fu_1020_p2 );
sensitive << ( ap_reg_ppiten_pp5_it0 );
sensitive << ( ap_sig_bdd_565 );
sensitive << ( ap_reg_ppiten_pp5_it2 );
SC_METHOD(thread_k0ack_out);
sensitive << ( ap_CS_fsm );
sensitive << ( distortion_out1ack_in );
SC_METHOD(thread_kernel_info_in_addr0ack_out);
sensitive << ( ap_CS_fsm );
sensitive << ( distortion_out1ack_in );
SC_METHOD(thread_master_portA_address);
sensitive << ( ap_CS_fsm );
sensitive << ( ap_reg_ppiten_pp1_it1 );
sensitive << ( exitcond9_reg_1097 );
sensitive << ( ap_sig_bdd_218 );
sensitive << ( ap_reg_ppiten_pp1_it6 );
sensitive << ( ap_reg_ppiten_pp2_it1 );
sensitive << ( exitcond1_reg_1116 );
sensitive << ( ap_sig_bdd_251 );
sensitive << ( ap_reg_ppiten_pp2_it6 );
sensitive << ( master_portA_addr_reg_1091 );
sensitive << ( isIter0_reg_1106 );
sensitive << ( master_portA_addr_1_reg_1110 );
sensitive << ( isIter1_reg_1125 );
sensitive << ( master_portA_addr_2_reg_1300 );
sensitive << ( ap_reg_ppstg_exitcond_reg_1315_pp5_it1 );
sensitive << ( ap_sig_bdd_565 );
sensitive << ( ap_reg_ppiten_pp5_it2 );
sensitive << ( ap_reg_ppstg_isIter_reg_1329_pp5_it1 );
SC_METHOD(thread_master_portA_dataout);
sensitive << ( ap_CS_fsm );
sensitive << ( ap_reg_ppstg_exitcond_reg_1315_pp5_it1 );
sensitive << ( ap_sig_bdd_565 );
sensitive << ( ap_reg_ppiten_pp5_it2 );
sensitive << ( c_buffer_load_reg_1333 );
SC_METHOD(thread_master_portA_req_din);
sensitive << ( ap_CS_fsm );
sensitive << ( ap_reg_ppiten_pp1_it1 );
sensitive << ( exitcond9_reg_1097 );
sensitive << ( ap_sig_bdd_218 );
sensitive << ( ap_reg_ppiten_pp1_it6 );
sensitive << ( ap_reg_ppiten_pp2_it1 );
sensitive << ( exitcond1_reg_1116 );
sensitive << ( ap_sig_bdd_251 );
sensitive << ( ap_reg_ppiten_pp2_it6 );
sensitive << ( isIter0_reg_1106 );
sensitive << ( isIter1_reg_1125 );
sensitive << ( ap_reg_ppstg_exitcond_reg_1315_pp5_it1 );
sensitive << ( ap_sig_bdd_565 );
sensitive << ( ap_reg_ppiten_pp5_it2 );
sensitive << ( ap_reg_ppstg_isIter_reg_1329_pp5_it1 );
SC_METHOD(thread_master_portA_req_write);
sensitive << ( ap_CS_fsm );
sensitive << ( ap_reg_ppiten_pp1_it1 );
sensitive << ( exitcond9_reg_1097 );
sensitive << ( ap_sig_bdd_218 );
sensitive << ( ap_reg_ppiten_pp1_it6 );
sensitive << ( ap_reg_ppiten_pp2_it1 );
sensitive << ( exitcond1_reg_1116 );
sensitive << ( ap_sig_bdd_251 );
sensitive << ( ap_reg_ppiten_pp2_it6 );
sensitive << ( isIter0_reg_1106 );
sensitive << ( isIter1_reg_1125 );
sensitive << ( ap_reg_ppstg_exitcond_reg_1315_pp5_it1 );
sensitive << ( ap_sig_bdd_565 );
sensitive << ( ap_reg_ppiten_pp5_it2 );
sensitive << ( ap_reg_ppstg_isIter_reg_1329_pp5_it1 );
SC_METHOD(thread_master_portA_rsp_read);
sensitive << ( ap_CS_fsm );
sensitive << ( ap_reg_ppstg_exitcond9_reg_1097_pp1_it5 );
sensitive << ( ap_sig_bdd_218 );
sensitive << ( ap_reg_ppiten_pp1_it6 );
sensitive << ( ap_reg_ppstg_exitcond1_reg_1116_pp2_it5 );
sensitive << ( ap_sig_bdd_251 );
sensitive << ( ap_reg_ppiten_pp2_it6 );
SC_METHOD(thread_master_portA_size);
sensitive << ( ap_CS_fsm );
sensitive << ( ap_reg_ppiten_pp1_it1 );
sensitive << ( exitcond9_reg_1097 );
sensitive << ( ap_sig_bdd_218 );
sensitive << ( ap_reg_ppiten_pp1_it6 );
sensitive << ( ap_reg_ppiten_pp2_it1 );
sensitive << ( exitcond1_reg_1116 );
sensitive << ( ap_sig_bdd_251 );
sensitive << ( ap_reg_ppiten_pp2_it6 );
sensitive << ( isIter0_reg_1106 );
sensitive << ( isIter1_reg_1125 );
sensitive << ( tmp_25_reg_1310 );
sensitive << ( ap_reg_ppstg_exitcond_reg_1315_pp5_it1 );
sensitive << ( ap_sig_bdd_565 );
sensitive << ( ap_reg_ppiten_pp5_it2 );
sensitive << ( ap_reg_ppstg_isIter_reg_1329_pp5_it1 );
SC_METHOD(thread_n0ack_out);
sensitive << ( ap_CS_fsm );
sensitive << ( distortion_out1ack_in );
SC_METHOD(thread_p_buffer_address0);
sensitive << ( ap_CS_fsm );
sensitive << ( ap_reg_ppiten_pp1_it7 );
sensitive << ( tmp_26_fu_672_p1 );
sensitive << ( tmp_30_fu_778_p1 );
SC_METHOD(thread_p_buffer_address1);
sensitive << ( ap_CS_fsm );
sensitive << ( tmp_29_1_fu_793_p1 );
sensitive << ( tmp_29_2_fu_819_p1 );
SC_METHOD(thread_p_buffer_ce0);
sensitive << ( ap_CS_fsm );
sensitive << ( ap_sig_bdd_218 );
sensitive << ( ap_reg_ppiten_pp1_it6 );
sensitive << ( ap_reg_ppiten_pp1_it7 );
SC_METHOD(thread_p_buffer_ce1);
sensitive << ( ap_CS_fsm );
SC_METHOD(thread_p_buffer_d0);
sensitive << ( ap_CS_fsm );
sensitive << ( ap_reg_ppiten_pp1_it7 );
sensitive << ( reg_565 );
SC_METHOD(thread_p_buffer_we0);
sensitive << ( ap_CS_fsm );
sensitive << ( ap_sig_bdd_218 );
sensitive << ( ap_reg_ppiten_pp1_it6 );
sensitive << ( ap_reg_ppiten_pp1_it7 );
sensitive << ( ap_reg_ppstg_exitcond9_reg_1097_pp1_it6 );
SC_METHOD(thread_p_shl4_cast_fu_764_p1);
sensitive << ( p_shl4_fu_756_p3 );
SC_METHOD(thread_p_shl4_fu_756_p3);
sensitive << ( tmp_36_fu_741_p1 );
SC_METHOD(thread_p_sum1_cast_fu_692_p1);
sensitive << ( p_sum1_fu_687_p2 );
SC_METHOD(thread_p_sum1_fu_687_p2);
sensitive << ( tmp_cast_reg_1083 );
sensitive << ( tmp_11_cast_fu_683_p1 );
SC_METHOD(thread_p_sum_cast_fu_644_p1);
sensitive << ( p_sum_fu_639_p2 );
SC_METHOD(thread_p_sum_fu_639_p2);
sensitive << ( tmp_5_cast_reg_1078 );
sensitive << ( tmp_7_cast_fu_635_p1 );
SC_METHOD(thread_tmp_10_fu_623_p2);
sensitive << ( b_reg_471 );
SC_METHOD(thread_tmp_11_cast_fu_683_p1);
sensitive << ( tmp_35_fu_677_p2 );
SC_METHOD(thread_tmp_11_fu_894_p2);
sensitive << ( i5_phi_fu_534_p4 );
sensitive << ( tmp_17_fu_888_p2 );
SC_METHOD(thread_tmp_12_fu_941_p1);
sensitive << ( ap_reg_ppstg_tmp_11_reg_1235_pp4_it11 );
SC_METHOD(thread_tmp_13_fu_900_p2);
sensitive << ( ap_CS_fsm );
sensitive << ( k0data_reg );
sensitive << ( tmp_1_fu_872_p2 );
sensitive << ( ap_reg_ppiten_pp4_it0 );
sensitive << ( i5_phi_fu_534_p4 );
SC_METHOD(thread_tmp_14_fu_965_p4);
sensitive << ( centres_out_addr0data_reg );
SC_METHOD(thread_tmp_15_fu_974_p1);
sensitive << ( tmp_14_fu_965_p4 );
SC_METHOD(thread_tmp_16_fu_989_p2);
sensitive << ( k0data_reg );
sensitive << ( tmp_18_fu_984_p2 );
SC_METHOD(thread_tmp_17_fu_888_p2);
sensitive << ( i5_phi_fu_534_p4 );
SC_METHOD(thread_tmp_18_fu_984_p2);
sensitive << ( k0data_reg );
SC_METHOD(thread_tmp_19_fu_751_p1);
sensitive << ( tmp_37_fu_745_p2 );
SC_METHOD(thread_tmp_1_fu_872_p2);
sensitive << ( ap_CS_fsm );
sensitive << ( k0data_reg );
sensitive << ( ap_reg_ppiten_pp4_it0 );
sensitive << ( i5_phi_fu_534_p4 );
SC_METHOD(thread_tmp_20_fu_798_p3);
sensitive << ( tmp_36_reg_1138 );
SC_METHOD(thread_tmp_21_fu_805_p1);
sensitive << ( tmp_20_fu_798_p3 );
SC_METHOD(thread_tmp_22_fu_768_p2);
sensitive << ( p_shl4_cast_fu_764_p1 );
sensitive << ( i1_cast2_fu_737_p1 );
SC_METHOD(thread_tmp_23_fu_994_p2);
sensitive << ( tmp_16_fu_989_p2 );
SC_METHOD(thread_tmp_24_fu_1000_p2);
sensitive << ( tmp_23_fu_994_p2 );
SC_METHOD(thread_tmp_25_1_fu_945_p2);
sensitive << ( ap_reg_ppstg_tmp_11_reg_1235_pp4_it12 );
SC_METHOD(thread_tmp_25_2_fu_955_p2);
sensitive << ( ap_reg_ppstg_tmp_11_reg_1235_pp4_it12 );
SC_METHOD(thread_tmp_25_fu_1016_p1);
sensitive << ( tmp_38_add_i32_shr_fu_1006_p4 );
SC_METHOD(thread_tmp_26_1_fu_950_p1);
sensitive << ( tmp_25_1_fu_945_p2 );
SC_METHOD(thread_tmp_26_2_fu_960_p1);
sensitive << ( tmp_25_2_fu_955_p2 );
SC_METHOD(thread_tmp_26_fu_672_p1);
sensitive << ( ap_reg_ppstg_indvar_reg_483_pp1_it6 );
SC_METHOD(thread_tmp_27_fu_824_p1);
sensitive << ( i_buffer_q0 );
SC_METHOD(thread_tmp_28_1_fu_783_p2);
sensitive << ( tmp_22_fu_768_p2 );
SC_METHOD(thread_tmp_28_2_fu_810_p2);
sensitive << ( tmp_22_reg_1148 );
SC_METHOD(thread_tmp_28_fu_1031_p1);
sensitive << ( indvar1_reg_553 );
SC_METHOD(thread_tmp_29_1_fu_793_p0);
sensitive << ( ap_CS_fsm );
sensitive << ( tmp_28_1_fu_783_p2 );
SC_METHOD(thread_tmp_29_1_fu_793_p1);
sensitive << ( tmp_29_1_fu_793_p0 );
SC_METHOD(thread_tmp_29_2_fu_819_p0);
sensitive << ( ap_CS_fsm );
sensitive << ( tmp_28_2_fu_810_p2 );
SC_METHOD(thread_tmp_29_2_fu_819_p1);
sensitive << ( tmp_29_2_fu_819_p0 );
SC_METHOD(thread_tmp_2_fu_583_p1);
sensitive << ( i_reg_460 );
SC_METHOD(thread_tmp_30_fu_778_p0);
sensitive << ( ap_CS_fsm );
sensitive << ( tmp_22_fu_768_p2 );
SC_METHOD(thread_tmp_30_fu_778_p1);
sensitive << ( tmp_30_fu_778_p0 );
SC_METHOD(thread_tmp_31_fu_833_p2);
sensitive << ( centre_buffer_count_q0 );
SC_METHOD(thread_tmp_32_fu_840_p2);
sensitive << ( centre_buffer_sum_sq_q0 );
sensitive << ( i_buffer_q0 );
SC_METHOD(thread_tmp_33_fu_847_p2);
sensitive << ( p_buffer_load_reg_1168 );
sensitive << ( centre_buffer_0_wgtCent_value_q0 );
SC_METHOD(thread_tmp_34_fu_720_p1);
sensitive << ( ap_reg_ppstg_indvar2_reg_495_pp2_it6 );
SC_METHOD(thread_tmp_35_fu_677_p2);
sensitive << ( b_reg_471 );
SC_METHOD(thread_tmp_36_fu_741_p1);
sensitive << ( i1_reg_507 );
SC_METHOD(thread_tmp_37_fu_745_p2);
sensitive << ( i1_reg_507 );
SC_METHOD(thread_tmp_38_add_i32_shr_fu_1006_p4);
sensitive << ( tmp_24_fu_1000_p2 );
SC_METHOD(thread_tmp_3_fu_618_p2);
sensitive << ( ap_CS_fsm );
sensitive << ( n0data_reg );
sensitive << ( b_reg_471 );
SC_METHOD(thread_tmp_43_1_fu_853_p2);
sensitive << ( p_buffer_load_1_reg_1173 );
sensitive << ( centre_buffer_1_wgtCent_value_q0 );
SC_METHOD(thread_tmp_43_2_fu_859_p2);
sensitive << ( p_buffer_q1 );
sensitive << ( centre_buffer_2_wgtCent_value_q0 );
SC_METHOD(thread_tmp_5_cast_fu_601_p1);
sensitive << ( tmp_5_fu_592_p4 );
SC_METHOD(thread_tmp_5_fu_592_p4);
sensitive << ( data_points_in_addr0data_reg );
SC_METHOD(thread_tmp_6_fu_629_p2);
sensitive << ( b_reg_471 );
sensitive << ( tmp_10_fu_623_p2 );
SC_METHOD(thread_tmp_7_cast_fu_635_p1);
sensitive << ( tmp_6_fu_629_p2 );
SC_METHOD(thread_tmp_8_fu_883_p1);
sensitive << ( i5_phi_fu_534_p4 );
SC_METHOD(thread_tmp_9_fu_905_p2);
sensitive << ( ap_CS_fsm );
sensitive << ( tmp_1_reg_1213 );
sensitive << ( ap_reg_ppiten_pp4_it0 );
sensitive << ( count_reg_1246 );
SC_METHOD(thread_tmp_cast_fu_614_p1);
sensitive << ( tmp_s_fu_605_p4 );
SC_METHOD(thread_tmp_s_fu_605_p4);
sensitive << ( kernel_info_in_addr0data_reg );
SC_METHOD(thread_total_distortion_2_fu_924_p2);
sensitive << ( total_distortion_reg_518 );
sensitive << ( centre_buffer_sum_sq_q0 );
SC_METHOD(thread_total_distortion_phi_fu_522_p4);
sensitive << ( ap_CS_fsm );
sensitive << ( total_distortion_reg_518 );
sensitive << ( tmp_1_reg_1213 );
sensitive << ( ap_reg_ppiten_pp4_it1 );
sensitive << ( tmp_13_reg_1242 );
sensitive << ( total_distortion_2_reg_1284 );
SC_METHOD(thread_ap_NS_fsm);
sensitive << ( ap_start );
sensitive << ( ap_CS_fsm );
sensitive << ( distortion_out1ack_in );
sensitive << ( ap_reg_ppiten_pp1_it0 );
sensitive << ( ap_reg_ppiten_pp1_it1 );
sensitive << ( ap_sig_bdd_218 );
sensitive << ( ap_reg_ppiten_pp1_it6 );
sensitive << ( ap_reg_ppiten_pp1_it7 );
sensitive << ( ap_reg_ppiten_pp2_it0 );
sensitive << ( ap_reg_ppiten_pp2_it1 );
sensitive << ( ap_sig_bdd_251 );
sensitive << ( ap_reg_ppiten_pp2_it6 );
sensitive << ( ap_reg_ppiten_pp2_it7 );
sensitive << ( tmp_3_fu_618_p2 );
sensitive << ( exitcond9_fu_654_p2 );
sensitive << ( exitcond1_fu_702_p2 );
sensitive << ( exitcond6_fu_725_p2 );
sensitive << ( ap_reg_ppiten_pp4_it11 );
sensitive << ( ap_reg_ppiten_pp4_it12 );
sensitive << ( exitcond_fu_1020_p2 );
sensitive << ( ap_reg_ppiten_pp5_it0 );
sensitive << ( ap_reg_ppiten_pp5_it1 );
sensitive << ( ap_sig_bdd_565 );
sensitive << ( ap_reg_ppiten_pp5_it2 );
sensitive << ( exitcond8_fu_571_p2 );
SC_THREAD(thread_hdltv_gen);
sensitive << ( ap_clk.pos() );
ap_CS_fsm = "00000";
data_points_in_addr0data_reg = "00000000000000000000000000000000";
data_points_in_addr0vld_reg = SC_LOGIC_0;
kernel_info_in_addr0data_reg = "00000000000000000000000000000000";
kernel_info_in_addr0vld_reg = SC_LOGIC_0;
centres_out_addr0data_reg = "00000000000000000000000000000000";
centres_out_addr0vld_reg = SC_LOGIC_0;
distortion_out1data_reg = "00000000000000000000000000000000";
distortion_out1vld_reg = SC_LOGIC_0;
n0data_reg = "00000000000000000000000000000000";
n0vld_reg = SC_LOGIC_0;
k0data_reg = "00000000000000000000000000000000";
k0vld_reg = SC_LOGIC_0;
ap_reg_ppiten_pp1_it0 = SC_LOGIC_0;
ap_reg_ppiten_pp1_it1 = SC_LOGIC_0;
ap_reg_ppiten_pp1_it2 = SC_LOGIC_0;
ap_reg_ppiten_pp1_it3 = SC_LOGIC_0;
ap_reg_ppiten_pp1_it4 = SC_LOGIC_0;
ap_reg_ppiten_pp1_it5 = SC_LOGIC_0;
ap_reg_ppiten_pp1_it6 = SC_LOGIC_0;
ap_reg_ppiten_pp1_it7 = SC_LOGIC_0;
ap_reg_ppiten_pp2_it0 = SC_LOGIC_0;
ap_reg_ppiten_pp2_it1 = SC_LOGIC_0;
ap_reg_ppiten_pp2_it2 = SC_LOGIC_0;
ap_reg_ppiten_pp2_it3 = SC_LOGIC_0;
ap_reg_ppiten_pp2_it4 = SC_LOGIC_0;
ap_reg_ppiten_pp2_it5 = SC_LOGIC_0;
ap_reg_ppiten_pp2_it6 = SC_LOGIC_0;
ap_reg_ppiten_pp2_it7 = SC_LOGIC_0;
ap_reg_ppiten_pp4_it0 = SC_LOGIC_0;
ap_reg_ppiten_pp4_it1 = SC_LOGIC_0;
ap_reg_ppiten_pp4_it2 = SC_LOGIC_0;
ap_reg_ppiten_pp4_it3 = SC_LOGIC_0;
ap_reg_ppiten_pp4_it4 = SC_LOGIC_0;
ap_reg_ppiten_pp4_it5 = SC_LOGIC_0;
ap_reg_ppiten_pp4_it6 = SC_LOGIC_0;
ap_reg_ppiten_pp4_it7 = SC_LOGIC_0;
ap_reg_ppiten_pp4_it8 = SC_LOGIC_0;
ap_reg_ppiten_pp4_it9 = SC_LOGIC_0;
ap_reg_ppiten_pp4_it10 = SC_LOGIC_0;
ap_reg_ppiten_pp4_it11 = SC_LOGIC_0;
ap_reg_ppiten_pp4_it12 = SC_LOGIC_0;
ap_reg_ppiten_pp5_it0 = SC_LOGIC_0;
ap_reg_ppiten_pp5_it1 = SC_LOGIC_0;
ap_reg_ppiten_pp5_it2 = SC_LOGIC_0;
static int apTFileNum = 0;
stringstream apTFilenSS;
apTFilenSS << "combiner_top_sc_trace_" << apTFileNum ++;
string apTFn = apTFilenSS.str();
mVcdFile = sc_create_vcd_trace_file(apTFn.c_str());
mVcdFile->set_time_unit(1, SC_PS);
if (1) {
#ifdef __HLS_TRACE_LEVEL_PORT__
sc_trace(mVcdFile, ap_clk, "(port)ap_clk");
sc_trace(mVcdFile, ap_rst, "(port)ap_rst");
sc_trace(mVcdFile, ap_start, "(port)ap_start");
sc_trace(mVcdFile, ap_done, "(port)ap_done");
sc_trace(mVcdFile, ap_idle, "(port)ap_idle");
sc_trace(mVcdFile, ap_ready, "(port)ap_ready");
sc_trace(mVcdFile, master_portA_req_din, "(port)master_portA_req_din");
sc_trace(mVcdFile, master_portA_req_full_n, "(port)master_portA_req_full_n");
sc_trace(mVcdFile, master_portA_req_write, "(port)master_portA_req_write");
sc_trace(mVcdFile, master_portA_rsp_empty_n, "(port)master_portA_rsp_empty_n");
sc_trace(mVcdFile, master_portA_rsp_read, "(port)master_portA_rsp_read");
sc_trace(mVcdFile, master_portA_address, "(port)master_portA_address");
sc_trace(mVcdFile, master_portA_datain, "(port)master_portA_datain");
sc_trace(mVcdFile, master_portA_dataout, "(port)master_portA_dataout");
sc_trace(mVcdFile, master_portA_size, "(port)master_portA_size");
sc_trace(mVcdFile, data_points_in_addr, "(port)data_points_in_addr");
sc_trace(mVcdFile, kernel_info_in_addr, "(port)kernel_info_in_addr");
sc_trace(mVcdFile, centres_out_addr, "(port)centres_out_addr");
sc_trace(mVcdFile, distortion_out, "(port)distortion_out");
sc_trace(mVcdFile, n, "(port)n");
sc_trace(mVcdFile, k, "(port)k");
#endif
#ifdef __HLS_TRACE_LEVEL_INT__
sc_trace(mVcdFile, ap_CS_fsm, "ap_CS_fsm");
sc_trace(mVcdFile, data_points_in_addr0data_reg, "data_points_in_addr0data_reg");
sc_trace(mVcdFile, data_points_in_addr0vld_reg, "data_points_in_addr0vld_reg");
sc_trace(mVcdFile, data_points_in_addr0ack_out, "data_points_in_addr0ack_out");
sc_trace(mVcdFile, kernel_info_in_addr0data_reg, "kernel_info_in_addr0data_reg");
sc_trace(mVcdFile, kernel_info_in_addr0vld_reg, "kernel_info_in_addr0vld_reg");
sc_trace(mVcdFile, kernel_info_in_addr0ack_out, "kernel_info_in_addr0ack_out");
sc_trace(mVcdFile, centres_out_addr0data_reg, "centres_out_addr0data_reg");
sc_trace(mVcdFile, centres_out_addr0vld_reg, "centres_out_addr0vld_reg");
sc_trace(mVcdFile, centres_out_addr0ack_out, "centres_out_addr0ack_out");
sc_trace(mVcdFile, distortion_out1data_reg, "distortion_out1data_reg");
sc_trace(mVcdFile, distortion_out1vld_reg, "distortion_out1vld_reg");
sc_trace(mVcdFile, distortion_out1vld_in, "distortion_out1vld_in");
sc_trace(mVcdFile, distortion_out1ack_in, "distortion_out1ack_in");
sc_trace(mVcdFile, n0data_reg, "n0data_reg");
sc_trace(mVcdFile, n0vld_reg, "n0vld_reg");
sc_trace(mVcdFile, n0ack_out, "n0ack_out");
sc_trace(mVcdFile, k0data_reg, "k0data_reg");
sc_trace(mVcdFile, k0vld_reg, "k0vld_reg");
sc_trace(mVcdFile, k0ack_out, "k0ack_out");
sc_trace(mVcdFile, indvar_reg_483, "indvar_reg_483");
sc_trace(mVcdFile, ap_reg_ppstg_indvar_reg_483_pp1_it1, "ap_reg_ppstg_indvar_reg_483_pp1_it1");
sc_trace(mVcdFile, ap_reg_ppiten_pp1_it0, "ap_reg_ppiten_pp1_it0");
sc_trace(mVcdFile, ap_reg_ppiten_pp1_it1, "ap_reg_ppiten_pp1_it1");
sc_trace(mVcdFile, ap_reg_ppiten_pp1_it2, "ap_reg_ppiten_pp1_it2");
sc_trace(mVcdFile, ap_reg_ppiten_pp1_it3, "ap_reg_ppiten_pp1_it3");
sc_trace(mVcdFile, ap_reg_ppiten_pp1_it4, "ap_reg_ppiten_pp1_it4");
sc_trace(mVcdFile, ap_reg_ppiten_pp1_it5, "ap_reg_ppiten_pp1_it5");
sc_trace(mVcdFile, exitcond9_reg_1097, "exitcond9_reg_1097");
sc_trace(mVcdFile, ap_reg_ppstg_exitcond9_reg_1097_pp1_it5, "ap_reg_ppstg_exitcond9_reg_1097_pp1_it5");
sc_trace(mVcdFile, ap_sig_bdd_218, "ap_sig_bdd_218");
sc_trace(mVcdFile, ap_reg_ppiten_pp1_it6, "ap_reg_ppiten_pp1_it6");
sc_trace(mVcdFile, ap_reg_ppiten_pp1_it7, "ap_reg_ppiten_pp1_it7");
sc_trace(mVcdFile, ap_reg_ppstg_indvar_reg_483_pp1_it2, "ap_reg_ppstg_indvar_reg_483_pp1_it2");
sc_trace(mVcdFile, ap_reg_ppstg_indvar_reg_483_pp1_it3, "ap_reg_ppstg_indvar_reg_483_pp1_it3");
sc_trace(mVcdFile, ap_reg_ppstg_indvar_reg_483_pp1_it4, "ap_reg_ppstg_indvar_reg_483_pp1_it4");
sc_trace(mVcdFile, ap_reg_ppstg_indvar_reg_483_pp1_it5, "ap_reg_ppstg_indvar_reg_483_pp1_it5");
sc_trace(mVcdFile, ap_reg_ppstg_indvar_reg_483_pp1_it6, "ap_reg_ppstg_indvar_reg_483_pp1_it6");
sc_trace(mVcdFile, indvar2_reg_495, "indvar2_reg_495");
sc_trace(mVcdFile, ap_reg_ppstg_indvar2_reg_495_pp2_it1, "ap_reg_ppstg_indvar2_reg_495_pp2_it1");
sc_trace(mVcdFile, ap_reg_ppiten_pp2_it0, "ap_reg_ppiten_pp2_it0");
sc_trace(mVcdFile, ap_reg_ppiten_pp2_it1, "ap_reg_ppiten_pp2_it1");
sc_trace(mVcdFile, ap_reg_ppiten_pp2_it2, "ap_reg_ppiten_pp2_it2");
sc_trace(mVcdFile, ap_reg_ppiten_pp2_it3, "ap_reg_ppiten_pp2_it3");
sc_trace(mVcdFile, ap_reg_ppiten_pp2_it4, "ap_reg_ppiten_pp2_it4");
sc_trace(mVcdFile, ap_reg_ppiten_pp2_it5, "ap_reg_ppiten_pp2_it5");
sc_trace(mVcdFile, exitcond1_reg_1116, "exitcond1_reg_1116");
sc_trace(mVcdFile, ap_reg_ppstg_exitcond1_reg_1116_pp2_it5, "ap_reg_ppstg_exitcond1_reg_1116_pp2_it5");
sc_trace(mVcdFile, ap_sig_bdd_251, "ap_sig_bdd_251");
sc_trace(mVcdFile, ap_reg_ppiten_pp2_it6, "ap_reg_ppiten_pp2_it6");
sc_trace(mVcdFile, ap_reg_ppiten_pp2_it7, "ap_reg_ppiten_pp2_it7");
sc_trace(mVcdFile, ap_reg_ppstg_indvar2_reg_495_pp2_it2, "ap_reg_ppstg_indvar2_reg_495_pp2_it2");
sc_trace(mVcdFile, ap_reg_ppstg_indvar2_reg_495_pp2_it3, "ap_reg_ppstg_indvar2_reg_495_pp2_it3");
sc_trace(mVcdFile, ap_reg_ppstg_indvar2_reg_495_pp2_it4, "ap_reg_ppstg_indvar2_reg_495_pp2_it4");
sc_trace(mVcdFile, ap_reg_ppstg_indvar2_reg_495_pp2_it5, "ap_reg_ppstg_indvar2_reg_495_pp2_it5");
sc_trace(mVcdFile, ap_reg_ppstg_indvar2_reg_495_pp2_it6, "ap_reg_ppstg_indvar2_reg_495_pp2_it6");
sc_trace(mVcdFile, total_distortion_reg_518, "total_distortion_reg_518");
sc_trace(mVcdFile, i5_reg_530, "i5_reg_530");
sc_trace(mVcdFile, indvar1_reg_553, "indvar1_reg_553");
sc_trace(mVcdFile, reg_565, "reg_565");
sc_trace(mVcdFile, i_1_fu_577_p2, "i_1_fu_577_p2");
sc_trace(mVcdFile, tmp_5_cast_fu_601_p1, "tmp_5_cast_fu_601_p1");
sc_trace(mVcdFile, tmp_5_cast_reg_1078, "tmp_5_cast_reg_1078");
sc_trace(mVcdFile, tmp_cast_fu_614_p1, "tmp_cast_fu_614_p1");
sc_trace(mVcdFile, tmp_cast_reg_1083, "tmp_cast_reg_1083");
sc_trace(mVcdFile, master_portA_addr_reg_1091, "master_portA_addr_reg_1091");
sc_trace(mVcdFile, tmp_3_fu_618_p2, "tmp_3_fu_618_p2");
sc_trace(mVcdFile, exitcond9_fu_654_p2, "exitcond9_fu_654_p2");
sc_trace(mVcdFile, ap_reg_ppstg_exitcond9_reg_1097_pp1_it1, "ap_reg_ppstg_exitcond9_reg_1097_pp1_it1");
sc_trace(mVcdFile, ap_reg_ppstg_exitcond9_reg_1097_pp1_it2, "ap_reg_ppstg_exitcond9_reg_1097_pp1_it2");
sc_trace(mVcdFile, ap_reg_ppstg_exitcond9_reg_1097_pp1_it3, "ap_reg_ppstg_exitcond9_reg_1097_pp1_it3");
sc_trace(mVcdFile, ap_reg_ppstg_exitcond9_reg_1097_pp1_it4, "ap_reg_ppstg_exitcond9_reg_1097_pp1_it4");
sc_trace(mVcdFile, ap_reg_ppstg_exitcond9_reg_1097_pp1_it6, "ap_reg_ppstg_exitcond9_reg_1097_pp1_it6");
sc_trace(mVcdFile, indvar_next_fu_660_p2, "indvar_next_fu_660_p2");
sc_trace(mVcdFile, indvar_next_reg_1101, "indvar_next_reg_1101");
sc_trace(mVcdFile, isIter0_fu_666_p2, "isIter0_fu_666_p2");
sc_trace(mVcdFile, isIter0_reg_1106, "isIter0_reg_1106");
sc_trace(mVcdFile, master_portA_addr_1_reg_1110, "master_portA_addr_1_reg_1110");
sc_trace(mVcdFile, exitcond1_fu_702_p2, "exitcond1_fu_702_p2");
sc_trace(mVcdFile, ap_reg_ppstg_exitcond1_reg_1116_pp2_it1, "ap_reg_ppstg_exitcond1_reg_1116_pp2_it1");
sc_trace(mVcdFile, ap_reg_ppstg_exitcond1_reg_1116_pp2_it2, "ap_reg_ppstg_exitcond1_reg_1116_pp2_it2");
sc_trace(mVcdFile, ap_reg_ppstg_exitcond1_reg_1116_pp2_it3, "ap_reg_ppstg_exitcond1_reg_1116_pp2_it3");
sc_trace(mVcdFile, ap_reg_ppstg_exitcond1_reg_1116_pp2_it4, "ap_reg_ppstg_exitcond1_reg_1116_pp2_it4");
sc_trace(mVcdFile, ap_reg_ppstg_exitcond1_reg_1116_pp2_it6, "ap_reg_ppstg_exitcond1_reg_1116_pp2_it6");
sc_trace(mVcdFile, indvar_next2_fu_708_p2, "indvar_next2_fu_708_p2");
sc_trace(mVcdFile, indvar_next2_reg_1120, "indvar_next2_reg_1120");
sc_trace(mVcdFile, isIter1_fu_714_p2, "isIter1_fu_714_p2");
sc_trace(mVcdFile, isIter1_reg_1125, "isIter1_reg_1125");
sc_trace(mVcdFile, exitcond6_fu_725_p2, "exitcond6_fu_725_p2");
sc_trace(mVcdFile, exitcond6_reg_1129, "exitcond6_reg_1129");
sc_trace(mVcdFile, i_3_fu_731_p2, "i_3_fu_731_p2");
sc_trace(mVcdFile, i_3_reg_1133, "i_3_reg_1133");
sc_trace(mVcdFile, tmp_36_fu_741_p1, "tmp_36_fu_741_p1");
sc_trace(mVcdFile, tmp_36_reg_1138, "tmp_36_reg_1138");
sc_trace(mVcdFile, tmp_22_fu_768_p2, "tmp_22_fu_768_p2");
sc_trace(mVcdFile, tmp_22_reg_1148, "tmp_22_reg_1148");
sc_trace(mVcdFile, p_buffer_q0, "p_buffer_q0");
sc_trace(mVcdFile, p_buffer_load_reg_1168, "p_buffer_load_reg_1168");
sc_trace(mVcdFile, p_buffer_q1, "p_buffer_q1");
sc_trace(mVcdFile, p_buffer_load_1_reg_1173, "p_buffer_load_1_reg_1173");
sc_trace(mVcdFile, centre_buffer_count_addr_2_reg_1183, "centre_buffer_count_addr_2_reg_1183");
sc_trace(mVcdFile, centre_buffer_sum_sq_addr_2_reg_1188, "centre_buffer_sum_sq_addr_2_reg_1188");
sc_trace(mVcdFile, centre_buffer_0_wgtCent_value_addr_2_reg_1193, "centre_buffer_0_wgtCent_value_addr_2_reg_1193");
sc_trace(mVcdFile, centre_buffer_1_wgtCent_value_addr_2_reg_1198, "centre_buffer_1_wgtCent_value_addr_2_reg_1198");
sc_trace(mVcdFile, centre_buffer_2_wgtCent_value_addr_2_reg_1203, "centre_buffer_2_wgtCent_value_addr_2_reg_1203");
sc_trace(mVcdFile, b_1_fu_866_p2, "b_1_fu_866_p2");
sc_trace(mVcdFile, tmp_1_fu_872_p2, "tmp_1_fu_872_p2");
sc_trace(mVcdFile, tmp_1_reg_1213, "tmp_1_reg_1213");
sc_trace(mVcdFile, ap_reg_ppiten_pp4_it0, "ap_reg_ppiten_pp4_it0");
sc_trace(mVcdFile, ap_reg_ppiten_pp4_it1, "ap_reg_ppiten_pp4_it1");
sc_trace(mVcdFile, ap_reg_ppiten_pp4_it2, "ap_reg_ppiten_pp4_it2");
sc_trace(mVcdFile, ap_reg_ppiten_pp4_it3, "ap_reg_ppiten_pp4_it3");
sc_trace(mVcdFile, ap_reg_ppiten_pp4_it4, "ap_reg_ppiten_pp4_it4");
sc_trace(mVcdFile, ap_reg_ppiten_pp4_it5, "ap_reg_ppiten_pp4_it5");
sc_trace(mVcdFile, ap_reg_ppiten_pp4_it6, "ap_reg_ppiten_pp4_it6");
sc_trace(mVcdFile, ap_reg_ppiten_pp4_it7, "ap_reg_ppiten_pp4_it7");
sc_trace(mVcdFile, ap_reg_ppiten_pp4_it8, "ap_reg_ppiten_pp4_it8");
sc_trace(mVcdFile, ap_reg_ppiten_pp4_it9, "ap_reg_ppiten_pp4_it9");
sc_trace(mVcdFile, ap_reg_ppiten_pp4_it10, "ap_reg_ppiten_pp4_it10");
sc_trace(mVcdFile, ap_reg_ppiten_pp4_it11, "ap_reg_ppiten_pp4_it11");
sc_trace(mVcdFile, ap_reg_ppiten_pp4_it12, "ap_reg_ppiten_pp4_it12");
sc_trace(mVcdFile, ap_reg_ppstg_tmp_1_reg_1213_pp4_it1, "ap_reg_ppstg_tmp_1_reg_1213_pp4_it1");
sc_trace(mVcdFile, ap_reg_ppstg_tmp_1_reg_1213_pp4_it2, "ap_reg_ppstg_tmp_1_reg_1213_pp4_it2");
sc_trace(mVcdFile, ap_reg_ppstg_tmp_1_reg_1213_pp4_it3, "ap_reg_ppstg_tmp_1_reg_1213_pp4_it3");
sc_trace(mVcdFile, ap_reg_ppstg_tmp_1_reg_1213_pp4_it4, "ap_reg_ppstg_tmp_1_reg_1213_pp4_it4");
sc_trace(mVcdFile, ap_reg_ppstg_tmp_1_reg_1213_pp4_it5, "ap_reg_ppstg_tmp_1_reg_1213_pp4_it5");
sc_trace(mVcdFile, ap_reg_ppstg_tmp_1_reg_1213_pp4_it6, "ap_reg_ppstg_tmp_1_reg_1213_pp4_it6");
sc_trace(mVcdFile, ap_reg_ppstg_tmp_1_reg_1213_pp4_it7, "ap_reg_ppstg_tmp_1_reg_1213_pp4_it7");
sc_trace(mVcdFile, ap_reg_ppstg_tmp_1_reg_1213_pp4_it8, "ap_reg_ppstg_tmp_1_reg_1213_pp4_it8");
sc_trace(mVcdFile, ap_reg_ppstg_tmp_1_reg_1213_pp4_it9, "ap_reg_ppstg_tmp_1_reg_1213_pp4_it9");
sc_trace(mVcdFile, ap_reg_ppstg_tmp_1_reg_1213_pp4_it10, "ap_reg_ppstg_tmp_1_reg_1213_pp4_it10");
sc_trace(mVcdFile, ap_reg_ppstg_tmp_1_reg_1213_pp4_it11, "ap_reg_ppstg_tmp_1_reg_1213_pp4_it11");
sc_trace(mVcdFile, ap_reg_ppstg_tmp_1_reg_1213_pp4_it12, "ap_reg_ppstg_tmp_1_reg_1213_pp4_it12");
sc_trace(mVcdFile, i_2_fu_877_p2, "i_2_fu_877_p2");
sc_trace(mVcdFile, i_2_reg_1217, "i_2_reg_1217");
sc_trace(mVcdFile, tmp_8_fu_883_p1, "tmp_8_fu_883_p1");
sc_trace(mVcdFile, tmp_8_reg_1222, "tmp_8_reg_1222");
sc_trace(mVcdFile, tmp_11_fu_894_p2, "tmp_11_fu_894_p2");
sc_trace(mVcdFile, tmp_11_reg_1235, "tmp_11_reg_1235");
sc_trace(mVcdFile, ap_reg_ppstg_tmp_11_reg_1235_pp4_it1, "ap_reg_ppstg_tmp_11_reg_1235_pp4_it1");
sc_trace(mVcdFile, ap_reg_ppstg_tmp_11_reg_1235_pp4_it2, "ap_reg_ppstg_tmp_11_reg_1235_pp4_it2");
sc_trace(mVcdFile, ap_reg_ppstg_tmp_11_reg_1235_pp4_it3, "ap_reg_ppstg_tmp_11_reg_1235_pp4_it3");
sc_trace(mVcdFile, ap_reg_ppstg_tmp_11_reg_1235_pp4_it4, "ap_reg_ppstg_tmp_11_reg_1235_pp4_it4");
sc_trace(mVcdFile, ap_reg_ppstg_tmp_11_reg_1235_pp4_it5, "ap_reg_ppstg_tmp_11_reg_1235_pp4_it5");
sc_trace(mVcdFile, ap_reg_ppstg_tmp_11_reg_1235_pp4_it6, "ap_reg_ppstg_tmp_11_reg_1235_pp4_it6");
sc_trace(mVcdFile, ap_reg_ppstg_tmp_11_reg_1235_pp4_it7, "ap_reg_ppstg_tmp_11_reg_1235_pp4_it7");
sc_trace(mVcdFile, ap_reg_ppstg_tmp_11_reg_1235_pp4_it8, "ap_reg_ppstg_tmp_11_reg_1235_pp4_it8");
sc_trace(mVcdFile, ap_reg_ppstg_tmp_11_reg_1235_pp4_it9, "ap_reg_ppstg_tmp_11_reg_1235_pp4_it9");
sc_trace(mVcdFile, ap_reg_ppstg_tmp_11_reg_1235_pp4_it10, "ap_reg_ppstg_tmp_11_reg_1235_pp4_it10");
sc_trace(mVcdFile, ap_reg_ppstg_tmp_11_reg_1235_pp4_it11, "ap_reg_ppstg_tmp_11_reg_1235_pp4_it11");
sc_trace(mVcdFile, ap_reg_ppstg_tmp_11_reg_1235_pp4_it12, "ap_reg_ppstg_tmp_11_reg_1235_pp4_it12");
sc_trace(mVcdFile, tmp_13_fu_900_p2, "tmp_13_fu_900_p2");
sc_trace(mVcdFile, tmp_13_reg_1242, "tmp_13_reg_1242");
sc_trace(mVcdFile, centre_buffer_count_q0, "centre_buffer_count_q0");
sc_trace(mVcdFile, count_reg_1246, "count_reg_1246");
sc_trace(mVcdFile, i_count_fu_910_p3, "i_count_fu_910_p3");
sc_trace(mVcdFile, i_count_reg_1262, "i_count_reg_1262");
sc_trace(mVcdFile, centre_buffer_0_wgtCent_value_q0, "centre_buffer_0_wgtCent_value_q0");
sc_trace(mVcdFile, total_distortion_2_fu_924_p2, "total_distortion_2_fu_924_p2");
sc_trace(mVcdFile, total_distortion_2_reg_1284, "total_distortion_2_reg_1284");
sc_trace(mVcdFile, centre_buffer_1_wgtCent_value_q0, "centre_buffer_1_wgtCent_value_q0");
sc_trace(mVcdFile, centre_buffer_2_wgtCent_value_q0, "centre_buffer_2_wgtCent_value_q0");
sc_trace(mVcdFile, centre_buffer_2_wgtCent_value_load_reg_1295, "centre_buffer_2_wgtCent_value_load_reg_1295");
sc_trace(mVcdFile, master_portA_addr_2_reg_1300, "master_portA_addr_2_reg_1300");
sc_trace(mVcdFile, tmp_38_add_i32_shr_fu_1006_p4, "tmp_38_add_i32_shr_fu_1006_p4");
sc_trace(mVcdFile, tmp_38_add_i32_shr_reg_1305, "tmp_38_add_i32_shr_reg_1305");
sc_trace(mVcdFile, tmp_25_fu_1016_p1, "tmp_25_fu_1016_p1");
sc_trace(mVcdFile, tmp_25_reg_1310, "tmp_25_reg_1310");
sc_trace(mVcdFile, exitcond_fu_1020_p2, "exitcond_fu_1020_p2");
sc_trace(mVcdFile, exitcond_reg_1315, "exitcond_reg_1315");
sc_trace(mVcdFile, ap_reg_ppiten_pp5_it0, "ap_reg_ppiten_pp5_it0");
sc_trace(mVcdFile, ap_reg_ppiten_pp5_it1, "ap_reg_ppiten_pp5_it1");
sc_trace(mVcdFile, ap_reg_ppstg_exitcond_reg_1315_pp5_it1, "ap_reg_ppstg_exitcond_reg_1315_pp5_it1");
sc_trace(mVcdFile, ap_sig_bdd_565, "ap_sig_bdd_565");
sc_trace(mVcdFile, ap_reg_ppiten_pp5_it2, "ap_reg_ppiten_pp5_it2");
sc_trace(mVcdFile, indvar_next1_fu_1025_p2, "indvar_next1_fu_1025_p2");
sc_trace(mVcdFile, isIter_fu_1036_p2, "isIter_fu_1036_p2");
sc_trace(mVcdFile, isIter_reg_1329, "isIter_reg_1329");
sc_trace(mVcdFile, ap_reg_ppstg_isIter_reg_1329_pp5_it1, "ap_reg_ppstg_isIter_reg_1329_pp5_it1");
sc_trace(mVcdFile, c_buffer_q0, "c_buffer_q0");
sc_trace(mVcdFile, c_buffer_load_reg_1333, "c_buffer_load_reg_1333");
sc_trace(mVcdFile, centre_buffer_0_wgtCent_value_address0, "centre_buffer_0_wgtCent_value_address0");
sc_trace(mVcdFile, centre_buffer_0_wgtCent_value_ce0, "centre_buffer_0_wgtCent_value_ce0");
sc_trace(mVcdFile, centre_buffer_0_wgtCent_value_we0, "centre_buffer_0_wgtCent_value_we0");
sc_trace(mVcdFile, centre_buffer_0_wgtCent_value_d0, "centre_buffer_0_wgtCent_value_d0");
sc_trace(mVcdFile, centre_buffer_1_wgtCent_value_address0, "centre_buffer_1_wgtCent_value_address0");
sc_trace(mVcdFile, centre_buffer_1_wgtCent_value_ce0, "centre_buffer_1_wgtCent_value_ce0");
sc_trace(mVcdFile, centre_buffer_1_wgtCent_value_we0, "centre_buffer_1_wgtCent_value_we0");
sc_trace(mVcdFile, centre_buffer_1_wgtCent_value_d0, "centre_buffer_1_wgtCent_value_d0");
sc_trace(mVcdFile, centre_buffer_2_wgtCent_value_address0, "centre_buffer_2_wgtCent_value_address0");
sc_trace(mVcdFile, centre_buffer_2_wgtCent_value_ce0, "centre_buffer_2_wgtCent_value_ce0");
sc_trace(mVcdFile, centre_buffer_2_wgtCent_value_we0, "centre_buffer_2_wgtCent_value_we0");
sc_trace(mVcdFile, centre_buffer_2_wgtCent_value_d0, "centre_buffer_2_wgtCent_value_d0");
sc_trace(mVcdFile, centre_buffer_sum_sq_address0, "centre_buffer_sum_sq_address0");
sc_trace(mVcdFile, centre_buffer_sum_sq_ce0, "centre_buffer_sum_sq_ce0");
sc_trace(mVcdFile, centre_buffer_sum_sq_we0, "centre_buffer_sum_sq_we0");
sc_trace(mVcdFile, centre_buffer_sum_sq_d0, "centre_buffer_sum_sq_d0");
sc_trace(mVcdFile, centre_buffer_sum_sq_q0, "centre_buffer_sum_sq_q0");
sc_trace(mVcdFile, centre_buffer_count_address0, "centre_buffer_count_address0");
sc_trace(mVcdFile, centre_buffer_count_ce0, "centre_buffer_count_ce0");
sc_trace(mVcdFile, centre_buffer_count_we0, "centre_buffer_count_we0");
sc_trace(mVcdFile, centre_buffer_count_d0, "centre_buffer_count_d0");
sc_trace(mVcdFile, i_buffer_address0, "i_buffer_address0");
sc_trace(mVcdFile, i_buffer_ce0, "i_buffer_ce0");
sc_trace(mVcdFile, i_buffer_we0, "i_buffer_we0");
sc_trace(mVcdFile, i_buffer_d0, "i_buffer_d0");
sc_trace(mVcdFile, i_buffer_q0, "i_buffer_q0");
sc_trace(mVcdFile, p_buffer_address0, "p_buffer_address0");
sc_trace(mVcdFile, p_buffer_ce0, "p_buffer_ce0");
sc_trace(mVcdFile, p_buffer_we0, "p_buffer_we0");
sc_trace(mVcdFile, p_buffer_d0, "p_buffer_d0");
sc_trace(mVcdFile, p_buffer_address1, "p_buffer_address1");
sc_trace(mVcdFile, p_buffer_ce1, "p_buffer_ce1");
sc_trace(mVcdFile, c_buffer_address0, "c_buffer_address0");
sc_trace(mVcdFile, c_buffer_ce0, "c_buffer_ce0");
sc_trace(mVcdFile, c_buffer_we0, "c_buffer_we0");
sc_trace(mVcdFile, c_buffer_d0, "c_buffer_d0");
sc_trace(mVcdFile, i_reg_460, "i_reg_460");
sc_trace(mVcdFile, exitcond8_fu_571_p2, "exitcond8_fu_571_p2");
sc_trace(mVcdFile, b_reg_471, "b_reg_471");
sc_trace(mVcdFile, indvar_phi_fu_487_p4, "indvar_phi_fu_487_p4");
sc_trace(mVcdFile, indvar2_phi_fu_499_p4, "indvar2_phi_fu_499_p4");
sc_trace(mVcdFile, i1_reg_507, "i1_reg_507");
sc_trace(mVcdFile, total_distortion_phi_fu_522_p4, "total_distortion_phi_fu_522_p4");
sc_trace(mVcdFile, i5_phi_fu_534_p4, "i5_phi_fu_534_p4");
sc_trace(mVcdFile, total_distortion_1_reg_541, "total_distortion_1_reg_541");
sc_trace(mVcdFile, tmp_2_fu_583_p1, "tmp_2_fu_583_p1");
sc_trace(mVcdFile, tmp_26_fu_672_p1, "tmp_26_fu_672_p1");
sc_trace(mVcdFile, tmp_34_fu_720_p1, "tmp_34_fu_720_p1");
sc_trace(mVcdFile, tmp_19_fu_751_p1, "tmp_19_fu_751_p1");
sc_trace(mVcdFile, tmp_30_fu_778_p1, "tmp_30_fu_778_p1");
sc_trace(mVcdFile, tmp_29_1_fu_793_p1, "tmp_29_1_fu_793_p1");
sc_trace(mVcdFile, tmp_21_fu_805_p1, "tmp_21_fu_805_p1");
sc_trace(mVcdFile, tmp_29_2_fu_819_p1, "tmp_29_2_fu_819_p1");
sc_trace(mVcdFile, tmp_27_fu_824_p1, "tmp_27_fu_824_p1");
sc_trace(mVcdFile, tmp_12_fu_941_p1, "tmp_12_fu_941_p1");
sc_trace(mVcdFile, tmp_26_1_fu_950_p1, "tmp_26_1_fu_950_p1");
sc_trace(mVcdFile, tmp_26_2_fu_960_p1, "tmp_26_2_fu_960_p1");
sc_trace(mVcdFile, tmp_28_fu_1031_p1, "tmp_28_fu_1031_p1");
sc_trace(mVcdFile, p_sum_cast_fu_644_p1, "p_sum_cast_fu_644_p1");
sc_trace(mVcdFile, p_sum1_cast_fu_692_p1, "p_sum1_cast_fu_692_p1");
sc_trace(mVcdFile, tmp_15_fu_974_p1, "tmp_15_fu_974_p1");
sc_trace(mVcdFile, tmp_31_fu_833_p2, "tmp_31_fu_833_p2");
sc_trace(mVcdFile, tmp_32_fu_840_p2, "tmp_32_fu_840_p2");
sc_trace(mVcdFile, tmp_33_fu_847_p2, "tmp_33_fu_847_p2");
sc_trace(mVcdFile, tmp_43_1_fu_853_p2, "tmp_43_1_fu_853_p2");
sc_trace(mVcdFile, tmp_43_2_fu_859_p2, "tmp_43_2_fu_859_p2");
sc_trace(mVcdFile, grp_fu_917_p2, "grp_fu_917_p2");
sc_trace(mVcdFile, grp_fu_930_p2, "grp_fu_930_p2");
sc_trace(mVcdFile, grp_fu_936_p2, "grp_fu_936_p2");
sc_trace(mVcdFile, tmp_5_fu_592_p4, "tmp_5_fu_592_p4");
sc_trace(mVcdFile, tmp_s_fu_605_p4, "tmp_s_fu_605_p4");
sc_trace(mVcdFile, tmp_10_fu_623_p2, "tmp_10_fu_623_p2");
sc_trace(mVcdFile, tmp_6_fu_629_p2, "tmp_6_fu_629_p2");
sc_trace(mVcdFile, tmp_7_cast_fu_635_p1, "tmp_7_cast_fu_635_p1");
sc_trace(mVcdFile, p_sum_fu_639_p2, "p_sum_fu_639_p2");
sc_trace(mVcdFile, tmp_35_fu_677_p2, "tmp_35_fu_677_p2");
sc_trace(mVcdFile, tmp_11_cast_fu_683_p1, "tmp_11_cast_fu_683_p1");
sc_trace(mVcdFile, p_sum1_fu_687_p2, "p_sum1_fu_687_p2");
sc_trace(mVcdFile, tmp_37_fu_745_p2, "tmp_37_fu_745_p2");
sc_trace(mVcdFile, p_shl4_fu_756_p3, "p_shl4_fu_756_p3");
sc_trace(mVcdFile, p_shl4_cast_fu_764_p1, "p_shl4_cast_fu_764_p1");
sc_trace(mVcdFile, i1_cast2_fu_737_p1, "i1_cast2_fu_737_p1");
sc_trace(mVcdFile, tmp_30_fu_778_p0, "tmp_30_fu_778_p0");
sc_trace(mVcdFile, tmp_28_1_fu_783_p2, "tmp_28_1_fu_783_p2");
sc_trace(mVcdFile, tmp_29_1_fu_793_p0, "tmp_29_1_fu_793_p0");
sc_trace(mVcdFile, tmp_20_fu_798_p3, "tmp_20_fu_798_p3");
sc_trace(mVcdFile, tmp_28_2_fu_810_p2, "tmp_28_2_fu_810_p2");
sc_trace(mVcdFile, tmp_29_2_fu_819_p0, "tmp_29_2_fu_819_p0");
sc_trace(mVcdFile, tmp_17_fu_888_p2, "tmp_17_fu_888_p2");
sc_trace(mVcdFile, tmp_9_fu_905_p2, "tmp_9_fu_905_p2");
sc_trace(mVcdFile, grp_fu_917_p0, "grp_fu_917_p0");
sc_trace(mVcdFile, grp_fu_917_p1, "grp_fu_917_p1");
sc_trace(mVcdFile, grp_fu_930_p0, "grp_fu_930_p0");
sc_trace(mVcdFile, grp_fu_930_p1, "grp_fu_930_p1");
sc_trace(mVcdFile, grp_fu_936_p0, "grp_fu_936_p0");
sc_trace(mVcdFile, grp_fu_936_p1, "grp_fu_936_p1");
sc_trace(mVcdFile, tmp_25_1_fu_945_p2, "tmp_25_1_fu_945_p2");
sc_trace(mVcdFile, tmp_25_2_fu_955_p2, "tmp_25_2_fu_955_p2");
sc_trace(mVcdFile, tmp_14_fu_965_p4, "tmp_14_fu_965_p4");
sc_trace(mVcdFile, tmp_18_fu_984_p2, "tmp_18_fu_984_p2");
sc_trace(mVcdFile, tmp_16_fu_989_p2, "tmp_16_fu_989_p2");
sc_trace(mVcdFile, tmp_23_fu_994_p2, "tmp_23_fu_994_p2");
sc_trace(mVcdFile, tmp_24_fu_1000_p2, "tmp_24_fu_1000_p2");
sc_trace(mVcdFile, grp_fu_917_ce, "grp_fu_917_ce");
sc_trace(mVcdFile, grp_fu_930_ce, "grp_fu_930_ce");
sc_trace(mVcdFile, grp_fu_936_ce, "grp_fu_936_ce");
sc_trace(mVcdFile, ap_NS_fsm, "ap_NS_fsm");
sc_trace(mVcdFile, ap_sig_bdd_1186, "ap_sig_bdd_1186");
sc_trace(mVcdFile, ap_sig_bdd_1189, "ap_sig_bdd_1189");
#endif
}
mHdltvinHandle.open("combiner_top.hdltvin.dat");
mHdltvoutHandle.open("combiner_top.hdltvout.dat");
}
combiner_top::~combiner_top() {
if (mVcdFile)
sc_close_vcd_trace_file(mVcdFile);
mHdltvinHandle << "] " << endl;
mHdltvoutHandle << "] " << endl;
mHdltvinHandle.close();
mHdltvoutHandle.close();
delete centre_buffer_0_wgtCent_value_U;
delete centre_buffer_1_wgtCent_value_U;
delete centre_buffer_2_wgtCent_value_U;
delete centre_buffer_sum_sq_U;
delete centre_buffer_count_U;
delete i_buffer_U;
delete p_buffer_U;
delete c_buffer_U;
delete combiner_top_sdiv_32ns_32ns_32_35_U1;
delete combiner_top_sdiv_32ns_32ns_32_35_U2;
delete combiner_top_sdiv_32ns_32ns_32_35_U3;
}
void combiner_top::thread_ap_clk_no_reset_() {
if ( ap_rst.read() == ap_const_logic_1) {
ap_CS_fsm = ap_ST_st1_fsm_0;
} else {
ap_CS_fsm = ap_NS_fsm.read();
}
if ( ap_rst.read() == ap_const_logic_1) {
ap_reg_ppiten_pp1_it0 = ap_const_logic_0;
} else {
if ((esl_seteq<1,5,5>(ap_ST_pp1_stg0_fsm_5, ap_CS_fsm.read()) &&
!(ap_sig_bdd_218.read() && esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp1_it6.read())) &&
!esl_seteq<1,1,1>(ap_const_lv1_0, exitcond9_fu_654_p2.read()))) {
ap_reg_ppiten_pp1_it0 = ap_const_logic_0;
} else if ((esl_seteq<1,5,5>(ap_ST_st5_fsm_4, ap_CS_fsm.read()) &&
esl_seteq<1,1,1>(ap_const_lv1_0, tmp_3_fu_618_p2.read()))) {
ap_reg_ppiten_pp1_it0 = ap_const_logic_1;
}
}
if ( ap_rst.read() == ap_const_logic_1) {
ap_reg_ppiten_pp1_it1 = ap_const_logic_0;
} else {
if ((esl_seteq<1,5,5>(ap_ST_pp1_stg0_fsm_5, ap_CS_fsm.read()) &&
!(ap_sig_bdd_218.read() && esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp1_it6.read())) &&
esl_seteq<1,1,1>(ap_const_lv1_0, exitcond9_fu_654_p2.read()))) {
ap_reg_ppiten_pp1_it1 = ap_const_logic_1;
} else if (((esl_seteq<1,5,5>(ap_ST_st5_fsm_4, ap_CS_fsm.read()) &&
esl_seteq<1,1,1>(ap_const_lv1_0, tmp_3_fu_618_p2.read())) ||
(esl_seteq<1,5,5>(ap_ST_pp1_stg0_fsm_5, ap_CS_fsm.read()) &&
!(ap_sig_bdd_218.read() && esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp1_it6.read())) &&
!esl_seteq<1,1,1>(ap_const_lv1_0, exitcond9_fu_654_p2.read())))) {
ap_reg_ppiten_pp1_it1 = ap_const_logic_0;
}
}
if ( ap_rst.read() == ap_const_logic_1) {
ap_reg_ppiten_pp1_it2 = ap_const_logic_0;
} else {
if ((esl_seteq<1,5,5>(ap_ST_pp1_stg0_fsm_5, ap_CS_fsm.read()) &&
!(ap_sig_bdd_218.read() && esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp1_it6.read())))) {
ap_reg_ppiten_pp1_it2 = ap_reg_ppiten_pp1_it1.read();
}
}
if ( ap_rst.read() == ap_const_logic_1) {
ap_reg_ppiten_pp1_it3 = ap_const_logic_0;
} else {
if ((esl_seteq<1,5,5>(ap_ST_pp1_stg0_fsm_5, ap_CS_fsm.read()) &&
!(ap_sig_bdd_218.read() && esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp1_it6.read())))) {
ap_reg_ppiten_pp1_it3 = ap_reg_ppiten_pp1_it2.read();
}
}
if ( ap_rst.read() == ap_const_logic_1) {
ap_reg_ppiten_pp1_it4 = ap_const_logic_0;
} else {
if ((esl_seteq<1,5,5>(ap_ST_pp1_stg0_fsm_5, ap_CS_fsm.read()) &&
!(ap_sig_bdd_218.read() && esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp1_it6.read())))) {
ap_reg_ppiten_pp1_it4 = ap_reg_ppiten_pp1_it3.read();
}
}
if ( ap_rst.read() == ap_const_logic_1) {
ap_reg_ppiten_pp1_it5 = ap_const_logic_0;
} else {
if ((esl_seteq<1,5,5>(ap_ST_pp1_stg0_fsm_5, ap_CS_fsm.read()) &&
!(ap_sig_bdd_218.read() && esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp1_it6.read())))) {
ap_reg_ppiten_pp1_it5 = ap_reg_ppiten_pp1_it4.read();
}
}
if ( ap_rst.read() == ap_const_logic_1) {
ap_reg_ppiten_pp1_it6 = ap_const_logic_0;
} else {
if ((esl_seteq<1,5,5>(ap_ST_pp1_stg0_fsm_5, ap_CS_fsm.read()) &&
!(ap_sig_bdd_218.read() && esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp1_it6.read())))) {
ap_reg_ppiten_pp1_it6 = ap_reg_ppiten_pp1_it5.read();
}
}
if ( ap_rst.read() == ap_const_logic_1) {
ap_reg_ppiten_pp1_it7 = ap_const_logic_0;
} else {
if ((esl_seteq<1,5,5>(ap_ST_pp1_stg0_fsm_5, ap_CS_fsm.read()) &&
!(ap_sig_bdd_218.read() && esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp1_it6.read())))) {
ap_reg_ppiten_pp1_it7 = ap_reg_ppiten_pp1_it6.read();
} else if ((esl_seteq<1,5,5>(ap_ST_st5_fsm_4, ap_CS_fsm.read()) &&
esl_seteq<1,1,1>(ap_const_lv1_0, tmp_3_fu_618_p2.read()))) {
ap_reg_ppiten_pp1_it7 = ap_const_logic_0;
}
}
if ( ap_rst.read() == ap_const_logic_1) {
ap_reg_ppiten_pp2_it0 = ap_const_logic_0;
} else {
if ((esl_seteq<1,5,5>(ap_ST_pp2_stg0_fsm_7, ap_CS_fsm.read()) &&
!(ap_sig_bdd_251.read() && esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp2_it6.read())) &&
!esl_seteq<1,1,1>(ap_const_lv1_0, exitcond1_fu_702_p2.read()))) {
ap_reg_ppiten_pp2_it0 = ap_const_logic_0;
} else if (esl_seteq<1,5,5>(ap_ST_st14_fsm_6, ap_CS_fsm.read())) {
ap_reg_ppiten_pp2_it0 = ap_const_logic_1;
}
}
if ( ap_rst.read() == ap_const_logic_1) {
ap_reg_ppiten_pp2_it1 = ap_const_logic_0;
} else {
if ((esl_seteq<1,5,5>(ap_ST_pp2_stg0_fsm_7, ap_CS_fsm.read()) &&
!(ap_sig_bdd_251.read() && esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp2_it6.read())) &&
esl_seteq<1,1,1>(ap_const_lv1_0, exitcond1_fu_702_p2.read()))) {
ap_reg_ppiten_pp2_it1 = ap_const_logic_1;
} else if ((esl_seteq<1,5,5>(ap_ST_st14_fsm_6, ap_CS_fsm.read()) ||
(esl_seteq<1,5,5>(ap_ST_pp2_stg0_fsm_7, ap_CS_fsm.read()) &&
!(ap_sig_bdd_251.read() && esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp2_it6.read())) &&
!esl_seteq<1,1,1>(ap_const_lv1_0, exitcond1_fu_702_p2.read())))) {
ap_reg_ppiten_pp2_it1 = ap_const_logic_0;
}
}
if ( ap_rst.read() == ap_const_logic_1) {
ap_reg_ppiten_pp2_it2 = ap_const_logic_0;
} else {
if ((esl_seteq<1,5,5>(ap_ST_pp2_stg0_fsm_7, ap_CS_fsm.read()) &&
!(ap_sig_bdd_251.read() && esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp2_it6.read())))) {
ap_reg_ppiten_pp2_it2 = ap_reg_ppiten_pp2_it1.read();
}
}
if ( ap_rst.read() == ap_const_logic_1) {
ap_reg_ppiten_pp2_it3 = ap_const_logic_0;
} else {
if ((esl_seteq<1,5,5>(ap_ST_pp2_stg0_fsm_7, ap_CS_fsm.read()) &&
!(ap_sig_bdd_251.read() && esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp2_it6.read())))) {
ap_reg_ppiten_pp2_it3 = ap_reg_ppiten_pp2_it2.read();
}
}
if ( ap_rst.read() == ap_const_logic_1) {
ap_reg_ppiten_pp2_it4 = ap_const_logic_0;
} else {
if ((esl_seteq<1,5,5>(ap_ST_pp2_stg0_fsm_7, ap_CS_fsm.read()) &&
!(ap_sig_bdd_251.read() && esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp2_it6.read())))) {
ap_reg_ppiten_pp2_it4 = ap_reg_ppiten_pp2_it3.read();
}
}
if ( ap_rst.read() == ap_const_logic_1) {
ap_reg_ppiten_pp2_it5 = ap_const_logic_0;
} else {
if ((esl_seteq<1,5,5>(ap_ST_pp2_stg0_fsm_7, ap_CS_fsm.read()) &&
!(ap_sig_bdd_251.read() && esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp2_it6.read())))) {
ap_reg_ppiten_pp2_it5 = ap_reg_ppiten_pp2_it4.read();
}
}
if ( ap_rst.read() == ap_const_logic_1) {
ap_reg_ppiten_pp2_it6 = ap_const_logic_0;
} else {
if ((esl_seteq<1,5,5>(ap_ST_pp2_stg0_fsm_7, ap_CS_fsm.read()) &&
!(ap_sig_bdd_251.read() && esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp2_it6.read())))) {
ap_reg_ppiten_pp2_it6 = ap_reg_ppiten_pp2_it5.read();
}
}
if ( ap_rst.read() == ap_const_logic_1) {
ap_reg_ppiten_pp2_it7 = ap_const_logic_0;
} else {
if ((esl_seteq<1,5,5>(ap_ST_pp2_stg0_fsm_7, ap_CS_fsm.read()) &&
!(ap_sig_bdd_251.read() && esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp2_it6.read())))) {
ap_reg_ppiten_pp2_it7 = ap_reg_ppiten_pp2_it6.read();
} else if (esl_seteq<1,5,5>(ap_ST_st14_fsm_6, ap_CS_fsm.read())) {
ap_reg_ppiten_pp2_it7 = ap_const_logic_0;
}
}
if ( ap_rst.read() == ap_const_logic_1) {
ap_reg_ppiten_pp4_it0 = ap_const_logic_0;
} else {
if ((esl_seteq<1,5,5>(ap_ST_pp4_stg2_fsm_14, ap_CS_fsm.read()) &&
(!esl_seteq<1,1,1>(ap_const_lv1_0, tmp_1_reg_1213.read()) ||
(esl_seteq<1,1,1>(ap_const_lv1_0, tmp_1_reg_1213.read()) &&
!esl_seteq<1,1,1>(ap_const_lv1_0, tmp_13_reg_1242.read()))))) {
ap_reg_ppiten_pp4_it0 = ap_const_logic_0;
} else if ((esl_seteq<1,5,5>(ap_ST_st5_fsm_4, ap_CS_fsm.read()) &&
!esl_seteq<1,1,1>(ap_const_lv1_0, tmp_3_fu_618_p2.read()))) {
ap_reg_ppiten_pp4_it0 = ap_const_logic_1;
}
}
if ( ap_rst.read() == ap_const_logic_1) {
ap_reg_ppiten_pp4_it1 = ap_const_logic_0;
} else {
if (esl_seteq<1,5,5>(ap_ST_pp4_stg2_fsm_14, ap_CS_fsm.read())) {
ap_reg_ppiten_pp4_it1 = ap_reg_ppiten_pp4_it0.read();
} else if ((esl_seteq<1,5,5>(ap_ST_st5_fsm_4, ap_CS_fsm.read()) &&
!esl_seteq<1,1,1>(ap_const_lv1_0, tmp_3_fu_618_p2.read()))) {
ap_reg_ppiten_pp4_it1 = ap_const_logic_0;
}
}
if ( ap_rst.read() == ap_const_logic_1) {
ap_reg_ppiten_pp4_it10 = ap_const_logic_0;
} else {
if (esl_seteq<1,5,5>(ap_ST_pp4_stg2_fsm_14, ap_CS_fsm.read())) {
ap_reg_ppiten_pp4_it10 = ap_reg_ppiten_pp4_it9.read();
}
}
if ( ap_rst.read() == ap_const_logic_1) {
ap_reg_ppiten_pp4_it11 = ap_const_logic_0;
} else {
if (esl_seteq<1,5,5>(ap_ST_pp4_stg2_fsm_14, ap_CS_fsm.read())) {
ap_reg_ppiten_pp4_it11 = ap_reg_ppiten_pp4_it10.read();
}
}
if ( ap_rst.read() == ap_const_logic_1) {
ap_reg_ppiten_pp4_it12 = ap_const_logic_0;
} else {
if (esl_seteq<1,5,5>(ap_ST_pp4_stg2_fsm_14, ap_CS_fsm.read())) {
ap_reg_ppiten_pp4_it12 = ap_reg_ppiten_pp4_it11.read();
} else if ((esl_seteq<1,5,5>(ap_ST_st5_fsm_4, ap_CS_fsm.read()) &&
!esl_seteq<1,1,1>(ap_const_lv1_0, tmp_3_fu_618_p2.read()))) {
ap_reg_ppiten_pp4_it12 = ap_const_logic_0;
}
}
if ( ap_rst.read() == ap_const_logic_1) {
ap_reg_ppiten_pp4_it2 = ap_const_logic_0;
} else {
if (esl_seteq<1,5,5>(ap_ST_pp4_stg2_fsm_14, ap_CS_fsm.read())) {
ap_reg_ppiten_pp4_it2 = ap_reg_ppiten_pp4_it1.read();
}
}
if ( ap_rst.read() == ap_const_logic_1) {
ap_reg_ppiten_pp4_it3 = ap_const_logic_0;
} else {
if (esl_seteq<1,5,5>(ap_ST_pp4_stg2_fsm_14, ap_CS_fsm.read())) {
ap_reg_ppiten_pp4_it3 = ap_reg_ppiten_pp4_it2.read();
}
}
if ( ap_rst.read() == ap_const_logic_1) {
ap_reg_ppiten_pp4_it4 = ap_const_logic_0;
} else {
if (esl_seteq<1,5,5>(ap_ST_pp4_stg2_fsm_14, ap_CS_fsm.read())) {
ap_reg_ppiten_pp4_it4 = ap_reg_ppiten_pp4_it3.read();
}
}
if ( ap_rst.read() == ap_const_logic_1) {
ap_reg_ppiten_pp4_it5 = ap_const_logic_0;
} else {
if (esl_seteq<1,5,5>(ap_ST_pp4_stg2_fsm_14, ap_CS_fsm.read())) {
ap_reg_ppiten_pp4_it5 = ap_reg_ppiten_pp4_it4.read();
}
}
if ( ap_rst.read() == ap_const_logic_1) {
ap_reg_ppiten_pp4_it6 = ap_const_logic_0;
} else {
if (esl_seteq<1,5,5>(ap_ST_pp4_stg2_fsm_14, ap_CS_fsm.read())) {
ap_reg_ppiten_pp4_it6 = ap_reg_ppiten_pp4_it5.read();
}
}
if ( ap_rst.read() == ap_const_logic_1) {
ap_reg_ppiten_pp4_it7 = ap_const_logic_0;
} else {
if (esl_seteq<1,5,5>(ap_ST_pp4_stg2_fsm_14, ap_CS_fsm.read())) {
ap_reg_ppiten_pp4_it7 = ap_reg_ppiten_pp4_it6.read();
}
}
if ( ap_rst.read() == ap_const_logic_1) {
ap_reg_ppiten_pp4_it8 = ap_const_logic_0;
} else {
if (esl_seteq<1,5,5>(ap_ST_pp4_stg2_fsm_14, ap_CS_fsm.read())) {
ap_reg_ppiten_pp4_it8 = ap_reg_ppiten_pp4_it7.read();
}
}
if ( ap_rst.read() == ap_const_logic_1) {
ap_reg_ppiten_pp4_it9 = ap_const_logic_0;
} else {
if (esl_seteq<1,5,5>(ap_ST_pp4_stg2_fsm_14, ap_CS_fsm.read())) {
ap_reg_ppiten_pp4_it9 = ap_reg_ppiten_pp4_it8.read();
}
}
if ( ap_rst.read() == ap_const_logic_1) {
ap_reg_ppiten_pp5_it0 = ap_const_logic_0;
} else {
if ((esl_seteq<1,5,5>(ap_ST_pp5_stg0_fsm_16, ap_CS_fsm.read()) &&
!(ap_sig_bdd_565.read() && esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp5_it2.read())) &&
!esl_seteq<1,1,1>(ap_const_lv1_0, exitcond_fu_1020_p2.read()))) {
ap_reg_ppiten_pp5_it0 = ap_const_logic_0;
} else if (esl_seteq<1,5,5>(ap_ST_st66_fsm_15, ap_CS_fsm.read())) {
ap_reg_ppiten_pp5_it0 = ap_const_logic_1;
}
}
if ( ap_rst.read() == ap_const_logic_1) {
ap_reg_ppiten_pp5_it1 = ap_const_logic_0;
} else {
if ((esl_seteq<1,5,5>(ap_ST_pp5_stg0_fsm_16, ap_CS_fsm.read()) &&
!(ap_sig_bdd_565.read() && esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp5_it2.read())) &&
esl_seteq<1,1,1>(ap_const_lv1_0, exitcond_fu_1020_p2.read()))) {
ap_reg_ppiten_pp5_it1 = ap_const_logic_1;
} else if ((esl_seteq<1,5,5>(ap_ST_st66_fsm_15, ap_CS_fsm.read()) ||
(esl_seteq<1,5,5>(ap_ST_pp5_stg0_fsm_16, ap_CS_fsm.read()) &&
!(ap_sig_bdd_565.read() && esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp5_it2.read())) &&
!esl_seteq<1,1,1>(ap_const_lv1_0, exitcond_fu_1020_p2.read())))) {
ap_reg_ppiten_pp5_it1 = ap_const_logic_0;
}
}
if ( ap_rst.read() == ap_const_logic_1) {
ap_reg_ppiten_pp5_it2 = ap_const_logic_0;
} else {
if ((esl_seteq<1,5,5>(ap_ST_pp5_stg0_fsm_16, ap_CS_fsm.read()) &&
!(ap_sig_bdd_565.read() && esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp5_it2.read())))) {
ap_reg_ppiten_pp5_it2 = ap_reg_ppiten_pp5_it1.read();
} else if (esl_seteq<1,5,5>(ap_ST_st66_fsm_15, ap_CS_fsm.read())) {
ap_reg_ppiten_pp5_it2 = ap_const_logic_0;
}
}
if (esl_seteq<1,5,5>(ap_ST_st4_fsm_3, ap_CS_fsm.read())) {
b_reg_471 = ap_const_lv32_0;
} else if (esl_seteq<1,5,5>(ap_ST_st26_fsm_11, ap_CS_fsm.read())) {
b_reg_471 = b_1_fu_866_p2.read();
}
if ( ap_rst.read() == ap_const_logic_1) {
centres_out_addr0data_reg = ap_const_lv32_0;
} else {
if (((!(!esl_seteq<1,1,1>(ap_const_logic_1, ap_start.read()) && esl_seteq<1,5,5>(ap_ST_st1_fsm_0, ap_CS_fsm.read())) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_const_logic_1) &&
esl_seteq<1,1,1>(ap_const_logic_0, centres_out_addr0vld_reg.read())) ||
(!(!esl_seteq<1,1,1>(ap_const_logic_1, ap_start.read()) && esl_seteq<1,5,5>(ap_ST_st1_fsm_0, ap_CS_fsm.read())) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_const_logic_1) &&
esl_seteq<1,1,1>(ap_const_logic_1, centres_out_addr0vld_reg.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, centres_out_addr0ack_out.read())))) {
centres_out_addr0data_reg = centres_out_addr.read();
}
}
if ( ap_rst.read() == ap_const_logic_1) {
centres_out_addr0vld_reg = ap_const_logic_0;
} else {
}
if ( ap_rst.read() == ap_const_logic_1) {
data_points_in_addr0data_reg = ap_const_lv32_0;
} else {
if (((!(!esl_seteq<1,1,1>(ap_const_logic_1, ap_start.read()) && esl_seteq<1,5,5>(ap_ST_st1_fsm_0, ap_CS_fsm.read())) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_const_logic_1) &&
esl_seteq<1,1,1>(ap_const_logic_0, data_points_in_addr0vld_reg.read())) ||
(!(!esl_seteq<1,1,1>(ap_const_logic_1, ap_start.read()) && esl_seteq<1,5,5>(ap_ST_st1_fsm_0, ap_CS_fsm.read())) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_const_logic_1) &&
esl_seteq<1,1,1>(ap_const_logic_1, data_points_in_addr0vld_reg.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, data_points_in_addr0ack_out.read())))) {
data_points_in_addr0data_reg = data_points_in_addr.read();
}
}
if ( ap_rst.read() == ap_const_logic_1) {
data_points_in_addr0vld_reg = ap_const_logic_0;
} else {
}
if ( ap_rst.read() == ap_const_logic_1) {
distortion_out1data_reg = ap_const_lv32_0;
} else {
if (((!(!esl_seteq<1,1,1>(ap_const_logic_1, ap_start.read()) && esl_seteq<1,5,5>(ap_ST_st1_fsm_0, ap_CS_fsm.read())) &&
esl_seteq<1,1,1>(ap_const_logic_1, distortion_out1vld_in.read()) &&
esl_seteq<1,1,1>(ap_const_logic_0, distortion_out1vld_reg.read())) ||
(!(!esl_seteq<1,1,1>(ap_const_logic_1, ap_start.read()) && esl_seteq<1,5,5>(ap_ST_st1_fsm_0, ap_CS_fsm.read())) &&
esl_seteq<1,1,1>(ap_const_logic_1, distortion_out1vld_in.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, distortion_out1vld_reg.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_const_logic_1)))) {
distortion_out1data_reg = total_distortion_1_reg_541.read();
}
}
if ( ap_rst.read() == ap_const_logic_1) {
distortion_out1vld_reg = ap_const_logic_0;
} else {
}
if ((esl_seteq<1,5,5>(ap_ST_pp2_stg0_fsm_7, ap_CS_fsm.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp2_it0.read()) &&
!(ap_sig_bdd_251.read() && esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp2_it6.read())) &&
!esl_seteq<1,1,1>(ap_const_lv1_0, exitcond1_fu_702_p2.read()))) {
i1_reg_507 = ap_const_lv5_0;
} else if ((esl_seteq<1,1,1>(ap_const_lv1_0, exitcond6_reg_1129.read()) &&
esl_seteq<1,5,5>(ap_ST_st25_fsm_10, ap_CS_fsm.read()))) {
i1_reg_507 = i_3_reg_1133.read();
}
if ((esl_seteq<1,5,5>(ap_ST_st5_fsm_4, ap_CS_fsm.read()) &&
!esl_seteq<1,1,1>(ap_const_lv1_0, tmp_3_fu_618_p2.read()))) {
i5_reg_530 = ap_const_lv32_0;
} else if ((esl_seteq<1,5,5>(ap_ST_pp4_stg0_fsm_12, ap_CS_fsm.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp4_it1.read()) &&
esl_seteq<1,1,1>(ap_const_lv1_0, tmp_1_reg_1213.read()) &&
esl_seteq<1,1,1>(ap_const_lv1_0, tmp_13_reg_1242.read()))) {
i5_reg_530 = i_2_reg_1217.read();
}
if ((esl_seteq<1,5,5>(ap_ST_st3_fsm_2, ap_CS_fsm.read()) &&
esl_seteq<1,1,1>(ap_const_lv1_0, exitcond8_fu_571_p2.read()))) {
i_reg_460 = i_1_fu_577_p2.read();
} else if (esl_seteq<1,5,5>(ap_ST_st2_fsm_1, ap_CS_fsm.read())) {
i_reg_460 = ap_const_lv9_0;
}
if (esl_seteq<1,5,5>(ap_ST_st66_fsm_15, ap_CS_fsm.read())) {
indvar1_reg_553 = ap_const_lv30_0;
} else if ((esl_seteq<1,5,5>(ap_ST_pp5_stg0_fsm_16, ap_CS_fsm.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp5_it0.read()) &&
!(ap_sig_bdd_565.read() && esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp5_it2.read())) &&
esl_seteq<1,1,1>(ap_const_lv1_0, exitcond_fu_1020_p2.read()))) {
indvar1_reg_553 = indvar_next1_fu_1025_p2.read();
}
if (esl_seteq<1,5,5>(ap_ST_st14_fsm_6, ap_CS_fsm.read())) {
indvar2_reg_495 = ap_const_lv6_0;
} else if ((esl_seteq<1,5,5>(ap_ST_pp2_stg0_fsm_7, ap_CS_fsm.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp2_it1.read()) &&
!(ap_sig_bdd_251.read() && esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp2_it6.read())) &&
esl_seteq<1,1,1>(ap_const_lv1_0, exitcond1_reg_1116.read()))) {
indvar2_reg_495 = indvar_next2_reg_1120.read();
}
if ((esl_seteq<1,5,5>(ap_ST_st5_fsm_4, ap_CS_fsm.read()) &&
esl_seteq<1,1,1>(ap_const_lv1_0, tmp_3_fu_618_p2.read()))) {
indvar_reg_483 = ap_const_lv6_0;
} else if ((esl_seteq<1,5,5>(ap_ST_pp1_stg0_fsm_5, ap_CS_fsm.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp1_it1.read()) &&
!(ap_sig_bdd_218.read() && esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp1_it6.read())) &&
esl_seteq<1,1,1>(exitcond9_reg_1097.read(), ap_const_lv1_0))) {
indvar_reg_483 = indvar_next_reg_1101.read();
}
if ( ap_rst.read() == ap_const_logic_1) {
k0data_reg = ap_const_lv32_0;
} else {
if (((!(!esl_seteq<1,1,1>(ap_const_logic_1, ap_start.read()) && esl_seteq<1,5,5>(ap_ST_st1_fsm_0, ap_CS_fsm.read())) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_const_logic_1) &&
esl_seteq<1,1,1>(ap_const_logic_0, k0vld_reg.read())) ||
(!(!esl_seteq<1,1,1>(ap_const_logic_1, ap_start.read()) && esl_seteq<1,5,5>(ap_ST_st1_fsm_0, ap_CS_fsm.read())) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_const_logic_1) &&
esl_seteq<1,1,1>(ap_const_logic_1, k0vld_reg.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, k0ack_out.read())))) {
k0data_reg = k.read();
}
}
if ( ap_rst.read() == ap_const_logic_1) {
k0vld_reg = ap_const_logic_0;
} else {
}
if ( ap_rst.read() == ap_const_logic_1) {
kernel_info_in_addr0data_reg = ap_const_lv32_0;
} else {
if (((!(!esl_seteq<1,1,1>(ap_const_logic_1, ap_start.read()) && esl_seteq<1,5,5>(ap_ST_st1_fsm_0, ap_CS_fsm.read())) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_const_logic_1) &&
esl_seteq<1,1,1>(ap_const_logic_0, kernel_info_in_addr0vld_reg.read())) ||
(!(!esl_seteq<1,1,1>(ap_const_logic_1, ap_start.read()) && esl_seteq<1,5,5>(ap_ST_st1_fsm_0, ap_CS_fsm.read())) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_const_logic_1) &&
esl_seteq<1,1,1>(ap_const_logic_1, kernel_info_in_addr0vld_reg.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, kernel_info_in_addr0ack_out.read())))) {
kernel_info_in_addr0data_reg = kernel_info_in_addr.read();
}
}
if ( ap_rst.read() == ap_const_logic_1) {
kernel_info_in_addr0vld_reg = ap_const_logic_0;
} else {
}
if ( ap_rst.read() == ap_const_logic_1) {
n0data_reg = ap_const_lv32_0;
} else {
if (((!(!esl_seteq<1,1,1>(ap_const_logic_1, ap_start.read()) && esl_seteq<1,5,5>(ap_ST_st1_fsm_0, ap_CS_fsm.read())) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_const_logic_1) &&
esl_seteq<1,1,1>(ap_const_logic_0, n0vld_reg.read())) ||
(!(!esl_seteq<1,1,1>(ap_const_logic_1, ap_start.read()) && esl_seteq<1,5,5>(ap_ST_st1_fsm_0, ap_CS_fsm.read())) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_const_logic_1) &&
esl_seteq<1,1,1>(ap_const_logic_1, n0vld_reg.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, n0ack_out.read())))) {
n0data_reg = n.read();
}
}
if ( ap_rst.read() == ap_const_logic_1) {
n0vld_reg = ap_const_logic_0;
} else {
}
if (esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp4_it0.read())) {
if (ap_sig_bdd_1189.read()) {
total_distortion_1_reg_541 = total_distortion_2_fu_924_p2.read();
} else if (ap_sig_bdd_1186.read()) {
total_distortion_1_reg_541 = total_distortion_phi_fu_522_p4.read();
}
}
if ((esl_seteq<1,5,5>(ap_ST_st5_fsm_4, ap_CS_fsm.read()) &&
!esl_seteq<1,1,1>(ap_const_lv1_0, tmp_3_fu_618_p2.read()))) {
total_distortion_reg_518 = ap_const_lv32_0;
} else if ((esl_seteq<1,5,5>(ap_ST_pp4_stg0_fsm_12, ap_CS_fsm.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp4_it1.read()) &&
esl_seteq<1,1,1>(ap_const_lv1_0, tmp_1_reg_1213.read()) &&
esl_seteq<1,1,1>(ap_const_lv1_0, tmp_13_reg_1242.read()))) {
total_distortion_reg_518 = total_distortion_2_reg_1284.read();
}
if ((esl_seteq<1,5,5>(ap_ST_pp2_stg0_fsm_7, ap_CS_fsm.read()) && !(ap_sig_bdd_251.read() && esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp2_it6.read())))) {
ap_reg_ppstg_exitcond1_reg_1116_pp2_it1 = exitcond1_reg_1116.read();
ap_reg_ppstg_exitcond1_reg_1116_pp2_it2 = ap_reg_ppstg_exitcond1_reg_1116_pp2_it1.read();
ap_reg_ppstg_exitcond1_reg_1116_pp2_it3 = ap_reg_ppstg_exitcond1_reg_1116_pp2_it2.read();
ap_reg_ppstg_exitcond1_reg_1116_pp2_it4 = ap_reg_ppstg_exitcond1_reg_1116_pp2_it3.read();
ap_reg_ppstg_exitcond1_reg_1116_pp2_it5 = ap_reg_ppstg_exitcond1_reg_1116_pp2_it4.read();
ap_reg_ppstg_exitcond1_reg_1116_pp2_it6 = ap_reg_ppstg_exitcond1_reg_1116_pp2_it5.read();
ap_reg_ppstg_indvar2_reg_495_pp2_it1 = indvar2_reg_495.read();
ap_reg_ppstg_indvar2_reg_495_pp2_it2 = ap_reg_ppstg_indvar2_reg_495_pp2_it1.read();
ap_reg_ppstg_indvar2_reg_495_pp2_it3 = ap_reg_ppstg_indvar2_reg_495_pp2_it2.read();
ap_reg_ppstg_indvar2_reg_495_pp2_it4 = ap_reg_ppstg_indvar2_reg_495_pp2_it3.read();
ap_reg_ppstg_indvar2_reg_495_pp2_it5 = ap_reg_ppstg_indvar2_reg_495_pp2_it4.read();
ap_reg_ppstg_indvar2_reg_495_pp2_it6 = ap_reg_ppstg_indvar2_reg_495_pp2_it5.read();
}
if ((esl_seteq<1,5,5>(ap_ST_pp1_stg0_fsm_5, ap_CS_fsm.read()) && !(ap_sig_bdd_218.read() && esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp1_it6.read())))) {
ap_reg_ppstg_exitcond9_reg_1097_pp1_it1 = exitcond9_reg_1097.read();
ap_reg_ppstg_exitcond9_reg_1097_pp1_it2 = ap_reg_ppstg_exitcond9_reg_1097_pp1_it1.read();
ap_reg_ppstg_exitcond9_reg_1097_pp1_it3 = ap_reg_ppstg_exitcond9_reg_1097_pp1_it2.read();
ap_reg_ppstg_exitcond9_reg_1097_pp1_it4 = ap_reg_ppstg_exitcond9_reg_1097_pp1_it3.read();
ap_reg_ppstg_exitcond9_reg_1097_pp1_it5 = ap_reg_ppstg_exitcond9_reg_1097_pp1_it4.read();
ap_reg_ppstg_exitcond9_reg_1097_pp1_it6 = ap_reg_ppstg_exitcond9_reg_1097_pp1_it5.read();
ap_reg_ppstg_indvar_reg_483_pp1_it1 = indvar_reg_483.read();
ap_reg_ppstg_indvar_reg_483_pp1_it2 = ap_reg_ppstg_indvar_reg_483_pp1_it1.read();
ap_reg_ppstg_indvar_reg_483_pp1_it3 = ap_reg_ppstg_indvar_reg_483_pp1_it2.read();
ap_reg_ppstg_indvar_reg_483_pp1_it4 = ap_reg_ppstg_indvar_reg_483_pp1_it3.read();
ap_reg_ppstg_indvar_reg_483_pp1_it5 = ap_reg_ppstg_indvar_reg_483_pp1_it4.read();
ap_reg_ppstg_indvar_reg_483_pp1_it6 = ap_reg_ppstg_indvar_reg_483_pp1_it5.read();
}
if ((esl_seteq<1,5,5>(ap_ST_pp5_stg0_fsm_16, ap_CS_fsm.read()) && !(ap_sig_bdd_565.read() && esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp5_it2.read())))) {
ap_reg_ppstg_exitcond_reg_1315_pp5_it1 = exitcond_reg_1315.read();
ap_reg_ppstg_isIter_reg_1329_pp5_it1 = isIter_reg_1329.read();
}
if (esl_seteq<1,5,5>(ap_ST_pp4_stg0_fsm_12, ap_CS_fsm.read())) {
ap_reg_ppstg_tmp_11_reg_1235_pp4_it1 = tmp_11_reg_1235.read();
ap_reg_ppstg_tmp_11_reg_1235_pp4_it10 = ap_reg_ppstg_tmp_11_reg_1235_pp4_it9.read();
ap_reg_ppstg_tmp_11_reg_1235_pp4_it11 = ap_reg_ppstg_tmp_11_reg_1235_pp4_it10.read();
ap_reg_ppstg_tmp_11_reg_1235_pp4_it12 = ap_reg_ppstg_tmp_11_reg_1235_pp4_it11.read();
ap_reg_ppstg_tmp_11_reg_1235_pp4_it2 = ap_reg_ppstg_tmp_11_reg_1235_pp4_it1.read();
ap_reg_ppstg_tmp_11_reg_1235_pp4_it3 = ap_reg_ppstg_tmp_11_reg_1235_pp4_it2.read();
ap_reg_ppstg_tmp_11_reg_1235_pp4_it4 = ap_reg_ppstg_tmp_11_reg_1235_pp4_it3.read();
ap_reg_ppstg_tmp_11_reg_1235_pp4_it5 = ap_reg_ppstg_tmp_11_reg_1235_pp4_it4.read();
ap_reg_ppstg_tmp_11_reg_1235_pp4_it6 = ap_reg_ppstg_tmp_11_reg_1235_pp4_it5.read();
ap_reg_ppstg_tmp_11_reg_1235_pp4_it7 = ap_reg_ppstg_tmp_11_reg_1235_pp4_it6.read();
ap_reg_ppstg_tmp_11_reg_1235_pp4_it8 = ap_reg_ppstg_tmp_11_reg_1235_pp4_it7.read();
ap_reg_ppstg_tmp_11_reg_1235_pp4_it9 = ap_reg_ppstg_tmp_11_reg_1235_pp4_it8.read();
ap_reg_ppstg_tmp_1_reg_1213_pp4_it1 = tmp_1_reg_1213.read();
ap_reg_ppstg_tmp_1_reg_1213_pp4_it10 = ap_reg_ppstg_tmp_1_reg_1213_pp4_it9.read();
ap_reg_ppstg_tmp_1_reg_1213_pp4_it11 = ap_reg_ppstg_tmp_1_reg_1213_pp4_it10.read();
ap_reg_ppstg_tmp_1_reg_1213_pp4_it12 = ap_reg_ppstg_tmp_1_reg_1213_pp4_it11.read();
ap_reg_ppstg_tmp_1_reg_1213_pp4_it2 = ap_reg_ppstg_tmp_1_reg_1213_pp4_it1.read();
ap_reg_ppstg_tmp_1_reg_1213_pp4_it3 = ap_reg_ppstg_tmp_1_reg_1213_pp4_it2.read();
ap_reg_ppstg_tmp_1_reg_1213_pp4_it4 = ap_reg_ppstg_tmp_1_reg_1213_pp4_it3.read();
ap_reg_ppstg_tmp_1_reg_1213_pp4_it5 = ap_reg_ppstg_tmp_1_reg_1213_pp4_it4.read();
ap_reg_ppstg_tmp_1_reg_1213_pp4_it6 = ap_reg_ppstg_tmp_1_reg_1213_pp4_it5.read();
ap_reg_ppstg_tmp_1_reg_1213_pp4_it7 = ap_reg_ppstg_tmp_1_reg_1213_pp4_it6.read();
ap_reg_ppstg_tmp_1_reg_1213_pp4_it8 = ap_reg_ppstg_tmp_1_reg_1213_pp4_it7.read();
ap_reg_ppstg_tmp_1_reg_1213_pp4_it9 = ap_reg_ppstg_tmp_1_reg_1213_pp4_it8.read();
}
if ((esl_seteq<1,5,5>(ap_ST_pp5_stg0_fsm_16, ap_CS_fsm.read()) && esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp5_it1.read()) && !(ap_sig_bdd_565.read() && esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp5_it2.read())) && esl_seteq<1,1,1>(ap_const_lv1_0, exitcond_reg_1315.read()))) {
c_buffer_load_reg_1333 = c_buffer_q0.read();
}
if ((esl_seteq<1,5,5>(ap_ST_st24_fsm_9, ap_CS_fsm.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, exitcond6_reg_1129.read()))) {
centre_buffer_0_wgtCent_value_addr_2_reg_1193 = (sc_lv<8>) (tmp_27_fu_824_p1.read());
centre_buffer_1_wgtCent_value_addr_2_reg_1198 = (sc_lv<8>) (tmp_27_fu_824_p1.read());
centre_buffer_2_wgtCent_value_addr_2_reg_1203 = (sc_lv<8>) (tmp_27_fu_824_p1.read());
centre_buffer_count_addr_2_reg_1183 = (sc_lv<8>) (tmp_27_fu_824_p1.read());
centre_buffer_sum_sq_addr_2_reg_1188 = (sc_lv<8>) (tmp_27_fu_824_p1.read());
p_buffer_load_1_reg_1173 = p_buffer_q1.read();
p_buffer_load_reg_1168 = p_buffer_q0.read();
}
if ((esl_seteq<1,5,5>(ap_ST_pp4_stg0_fsm_12, ap_CS_fsm.read()) && esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp4_it1.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_1_reg_1213.read()))) {
centre_buffer_2_wgtCent_value_load_reg_1295 = centre_buffer_2_wgtCent_value_q0.read();
}
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp4_it0.read()) && esl_seteq<1,5,5>(ap_ST_pp4_stg1_fsm_13, ap_CS_fsm.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_1_reg_1213.read()))) {
count_reg_1246 = centre_buffer_count_q0.read();
}
if ((esl_seteq<1,5,5>(ap_ST_pp2_stg0_fsm_7, ap_CS_fsm.read()) && esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp2_it0.read()) && !(ap_sig_bdd_251.read() && esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp2_it6.read())))) {
exitcond1_reg_1116 = exitcond1_fu_702_p2.read();
indvar_next2_reg_1120 = indvar_next2_fu_708_p2.read();
}
if (esl_seteq<1,5,5>(ap_ST_st23_fsm_8, ap_CS_fsm.read())) {
exitcond6_reg_1129 = exitcond6_fu_725_p2.read();
i_3_reg_1133 = i_3_fu_731_p2.read();
}
if ((esl_seteq<1,5,5>(ap_ST_pp1_stg0_fsm_5, ap_CS_fsm.read()) && esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp1_it0.read()) && !(ap_sig_bdd_218.read() && esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp1_it6.read())))) {
exitcond9_reg_1097 = exitcond9_fu_654_p2.read();
indvar_next_reg_1101 = indvar_next_fu_660_p2.read();
}
if ((esl_seteq<1,5,5>(ap_ST_pp5_stg0_fsm_16, ap_CS_fsm.read()) && esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp5_it0.read()) && !(ap_sig_bdd_565.read() && esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp5_it2.read())))) {
exitcond_reg_1315 = exitcond_fu_1020_p2.read();
}
if ((esl_seteq<1,5,5>(ap_ST_pp4_stg0_fsm_12, ap_CS_fsm.read()) && esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp4_it0.read()))) {
i_2_reg_1217 = i_2_fu_877_p2.read();
tmp_1_reg_1213 = tmp_1_fu_872_p2.read();
}
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp4_it0.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_1_reg_1213.read()) && esl_seteq<1,5,5>(ap_ST_pp4_stg2_fsm_14, ap_CS_fsm.read()))) {
i_count_reg_1262 = i_count_fu_910_p3.read();
total_distortion_2_reg_1284 = total_distortion_2_fu_924_p2.read();
}
if ((esl_seteq<1,5,5>(ap_ST_pp1_stg0_fsm_5, ap_CS_fsm.read()) && esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp1_it0.read()) && !(ap_sig_bdd_218.read() && esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp1_it6.read())) && esl_seteq<1,1,1>(ap_const_lv1_0, exitcond9_fu_654_p2.read()))) {
isIter0_reg_1106 = isIter0_fu_666_p2.read();
}
if ((esl_seteq<1,5,5>(ap_ST_pp2_stg0_fsm_7, ap_CS_fsm.read()) && esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp2_it0.read()) && !(ap_sig_bdd_251.read() && esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp2_it6.read())) && esl_seteq<1,1,1>(ap_const_lv1_0, exitcond1_fu_702_p2.read()))) {
isIter1_reg_1125 = isIter1_fu_714_p2.read();
}
if ((esl_seteq<1,5,5>(ap_ST_pp5_stg0_fsm_16, ap_CS_fsm.read()) && esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp5_it0.read()) && !(ap_sig_bdd_565.read() && esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp5_it2.read())) && esl_seteq<1,1,1>(ap_const_lv1_0, exitcond_fu_1020_p2.read()))) {
isIter_reg_1329 = isIter_fu_1036_p2.read();
}
if (esl_seteq<1,5,5>(ap_ST_st14_fsm_6, ap_CS_fsm.read())) {
master_portA_addr_1_reg_1110 = (sc_lv<32>) (p_sum1_cast_fu_692_p1.read());
}
if (esl_seteq<1,5,5>(ap_ST_st66_fsm_15, ap_CS_fsm.read())) {
master_portA_addr_2_reg_1300 = (sc_lv<32>) (tmp_15_fu_974_p1.read());
tmp_25_reg_1310 = tmp_25_fu_1016_p1.read();
tmp_38_add_i32_shr_reg_1305 = tmp_24_fu_1000_p2.read().range(31, 2);
}
if ((esl_seteq<1,5,5>(ap_ST_st5_fsm_4, ap_CS_fsm.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_3_fu_618_p2.read()))) {
master_portA_addr_reg_1091 = (sc_lv<32>) (p_sum_cast_fu_644_p1.read());
}
if (((esl_seteq<1,5,5>(ap_ST_pp1_stg0_fsm_5, ap_CS_fsm.read()) &&
esl_seteq<1,1,1>(ap_reg_ppstg_exitcond9_reg_1097_pp1_it5.read(), ap_const_lv1_0) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp1_it6.read()) &&
!(ap_sig_bdd_218.read() && esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp1_it6.read()))) || (esl_seteq<1,5,5>(ap_ST_pp2_stg0_fsm_7, ap_CS_fsm.read()) &&
esl_seteq<1,1,1>(ap_const_lv1_0, ap_reg_ppstg_exitcond1_reg_1116_pp2_it5.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp2_it6.read()) &&
!(ap_sig_bdd_251.read() && esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp2_it6.read()))))) {
reg_565 = master_portA_datain.read();
}
if ((esl_seteq<1,5,5>(ap_ST_pp4_stg0_fsm_12, ap_CS_fsm.read()) && esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp4_it0.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_1_fu_872_p2.read()))) {
tmp_11_reg_1235 = tmp_11_fu_894_p2.read();
tmp_13_reg_1242 = tmp_13_fu_900_p2.read();
tmp_8_reg_1222 = tmp_8_fu_883_p1.read();
}
if ((esl_seteq<1,5,5>(ap_ST_st23_fsm_8, ap_CS_fsm.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, exitcond6_fu_725_p2.read()))) {
tmp_22_reg_1148 = tmp_22_fu_768_p2.read();
tmp_36_reg_1138 = tmp_36_fu_741_p1.read();
}
if (esl_seteq<1,5,5>(ap_ST_st4_fsm_3, ap_CS_fsm.read())) {
tmp_5_cast_reg_1078 = tmp_5_cast_fu_601_p1.read();
tmp_cast_reg_1083 = tmp_cast_fu_614_p1.read();
}
}
void combiner_top::thread_ap_done() {
if ((esl_seteq<1,5,5>(ap_ST_st71_fsm_18, ap_CS_fsm.read()) &&
!esl_seteq<1,1,1>(distortion_out1ack_in.read(), ap_const_logic_0))) {
ap_done = ap_const_logic_1;
} else {
ap_done = ap_const_logic_0;
}
}
void combiner_top::thread_ap_idle() {
if ((!esl_seteq<1,1,1>(ap_const_logic_1, ap_start.read()) &&
esl_seteq<1,5,5>(ap_ST_st1_fsm_0, ap_CS_fsm.read()))) {
ap_idle = ap_const_logic_1;
} else {
ap_idle = ap_const_logic_0;
}
}
void combiner_top::thread_ap_ready() {
if ((esl_seteq<1,5,5>(ap_ST_st71_fsm_18, ap_CS_fsm.read()) &&
!esl_seteq<1,1,1>(distortion_out1ack_in.read(), ap_const_logic_0))) {
ap_ready = ap_const_logic_1;
} else {
ap_ready = ap_const_logic_0;
}
}
void combiner_top::thread_ap_sig_bdd_1186() {
ap_sig_bdd_1186 = (esl_seteq<1,5,5>(ap_ST_pp4_stg0_fsm_12, ap_CS_fsm.read()) && !esl_seteq<1,1,1>(ap_const_lv1_0, tmp_1_fu_872_p2.read()));
}
void combiner_top::thread_ap_sig_bdd_1189() {
ap_sig_bdd_1189 = (esl_seteq<1,1,1>(ap_const_lv1_0, tmp_1_reg_1213.read()) && esl_seteq<1,5,5>(ap_ST_pp4_stg2_fsm_14, ap_CS_fsm.read()) && !esl_seteq<1,1,1>(ap_const_lv1_0, tmp_13_reg_1242.read()));
}
void combiner_top::thread_ap_sig_bdd_218() {
ap_sig_bdd_218 = (esl_seteq<1,1,1>(master_portA_rsp_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_reg_ppstg_exitcond9_reg_1097_pp1_it5.read(), ap_const_lv1_0));
}
void combiner_top::thread_ap_sig_bdd_251() {
ap_sig_bdd_251 = (esl_seteq<1,1,1>(master_portA_rsp_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_const_lv1_0, ap_reg_ppstg_exitcond1_reg_1116_pp2_it5.read()));
}
void combiner_top::thread_ap_sig_bdd_565() {
ap_sig_bdd_565 = (esl_seteq<1,1,1>(master_portA_req_full_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_const_lv1_0, ap_reg_ppstg_exitcond_reg_1315_pp5_it1.read()));
}
void combiner_top::thread_b_1_fu_866_p2() {
b_1_fu_866_p2 = (!b_reg_471.read().is_01() || !ap_const_lv32_10.is_01())? sc_lv<32>(): (sc_bigint<32>(b_reg_471.read()) + sc_biguint<32>(ap_const_lv32_10));
}
void combiner_top::thread_c_buffer_address0() {
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp4_it12.read()) &&
esl_seteq<1,5,5>(ap_ST_pp4_stg2_fsm_14, ap_CS_fsm.read()))) {
c_buffer_address0 = (sc_lv<10>) (tmp_26_2_fu_960_p1.read());
} else if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp4_it12.read()) &&
esl_seteq<1,5,5>(ap_ST_pp4_stg1_fsm_13, ap_CS_fsm.read()))) {
c_buffer_address0 = (sc_lv<10>) (tmp_26_1_fu_950_p1.read());
} else if ((esl_seteq<1,5,5>(ap_ST_pp4_stg0_fsm_12, ap_CS_fsm.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp4_it12.read()))) {
c_buffer_address0 = (sc_lv<10>) (tmp_12_fu_941_p1.read());
} else if ((esl_seteq<1,5,5>(ap_ST_pp5_stg0_fsm_16, ap_CS_fsm.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp5_it0.read()))) {
c_buffer_address0 = (sc_lv<10>) (tmp_28_fu_1031_p1.read());
} else {
c_buffer_address0 = (sc_lv<10>) ("XXXXXXXXXX");
}
}
void combiner_top::thread_c_buffer_ce0() {
if (((esl_seteq<1,5,5>(ap_ST_pp5_stg0_fsm_16, ap_CS_fsm.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp5_it0.read()) &&
!(ap_sig_bdd_565.read() && esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp5_it2.read()))) ||
(esl_seteq<1,5,5>(ap_ST_pp4_stg0_fsm_12, ap_CS_fsm.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp4_it12.read())) ||
(esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp4_it12.read()) &&
esl_seteq<1,5,5>(ap_ST_pp4_stg1_fsm_13, ap_CS_fsm.read())) ||
(esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp4_it12.read()) &&
esl_seteq<1,5,5>(ap_ST_pp4_stg2_fsm_14, ap_CS_fsm.read())))) {
c_buffer_ce0 = ap_const_logic_1;
} else {
c_buffer_ce0 = ap_const_logic_0;
}
}
void combiner_top::thread_c_buffer_d0() {
if (esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp4_it12.read())) {
if (esl_seteq<1,5,5>(ap_ST_pp4_stg2_fsm_14, ap_CS_fsm.read())) {
c_buffer_d0 = grp_fu_936_p2.read();
} else if (esl_seteq<1,5,5>(ap_ST_pp4_stg1_fsm_13, ap_CS_fsm.read())) {
c_buffer_d0 = grp_fu_930_p2.read();
} else if (esl_seteq<1,5,5>(ap_ST_pp4_stg0_fsm_12, ap_CS_fsm.read())) {
c_buffer_d0 = grp_fu_917_p2.read();
} else {
c_buffer_d0 = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
}
} else {
c_buffer_d0 = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
}
}
void combiner_top::thread_c_buffer_we0() {
if (((esl_seteq<1,5,5>(ap_ST_pp4_stg0_fsm_12, ap_CS_fsm.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp4_it12.read()) &&
esl_seteq<1,1,1>(ap_const_lv1_0, ap_reg_ppstg_tmp_1_reg_1213_pp4_it11.read())) ||
(esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp4_it12.read()) &&
esl_seteq<1,5,5>(ap_ST_pp4_stg1_fsm_13, ap_CS_fsm.read()) &&
esl_seteq<1,1,1>(ap_const_lv1_0, ap_reg_ppstg_tmp_1_reg_1213_pp4_it12.read())) ||
(esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp4_it12.read()) &&
esl_seteq<1,5,5>(ap_ST_pp4_stg2_fsm_14, ap_CS_fsm.read()) &&
esl_seteq<1,1,1>(ap_const_lv1_0, ap_reg_ppstg_tmp_1_reg_1213_pp4_it12.read())))) {
c_buffer_we0 = ap_const_logic_1;
} else {
c_buffer_we0 = ap_const_logic_0;
}
}
void combiner_top::thread_centre_buffer_0_wgtCent_value_address0() {
if (esl_seteq<1,5,5>(ap_ST_st25_fsm_10, ap_CS_fsm.read())) {
centre_buffer_0_wgtCent_value_address0 = centre_buffer_0_wgtCent_value_addr_2_reg_1193.read();
} else if (esl_seteq<1,5,5>(ap_ST_st3_fsm_2, ap_CS_fsm.read())) {
centre_buffer_0_wgtCent_value_address0 = (sc_lv<8>) (tmp_2_fu_583_p1.read());
} else if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp4_it0.read()) &&
esl_seteq<1,5,5>(ap_ST_pp4_stg1_fsm_13, ap_CS_fsm.read()))) {
centre_buffer_0_wgtCent_value_address0 = (sc_lv<8>) (tmp_8_reg_1222.read());
} else if (esl_seteq<1,5,5>(ap_ST_st24_fsm_9, ap_CS_fsm.read())) {
centre_buffer_0_wgtCent_value_address0 = (sc_lv<8>) (tmp_27_fu_824_p1.read());
} else {
centre_buffer_0_wgtCent_value_address0 = (sc_lv<8>) ("XXXXXXXX");
}
}
void combiner_top::thread_centre_buffer_0_wgtCent_value_ce0() {
if ((esl_seteq<1,5,5>(ap_ST_st3_fsm_2, ap_CS_fsm.read()) ||
esl_seteq<1,5,5>(ap_ST_st24_fsm_9, ap_CS_fsm.read()) ||
(esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp4_it0.read()) &&
esl_seteq<1,5,5>(ap_ST_pp4_stg1_fsm_13, ap_CS_fsm.read())) ||
esl_seteq<1,5,5>(ap_ST_st25_fsm_10, ap_CS_fsm.read()))) {
centre_buffer_0_wgtCent_value_ce0 = ap_const_logic_1;
} else {
centre_buffer_0_wgtCent_value_ce0 = ap_const_logic_0;
}
}
void combiner_top::thread_centre_buffer_0_wgtCent_value_d0() {
if (esl_seteq<1,5,5>(ap_ST_st25_fsm_10, ap_CS_fsm.read())) {
centre_buffer_0_wgtCent_value_d0 = tmp_33_fu_847_p2.read();
} else if (esl_seteq<1,5,5>(ap_ST_st3_fsm_2, ap_CS_fsm.read())) {
centre_buffer_0_wgtCent_value_d0 = ap_const_lv32_0;
} else {
centre_buffer_0_wgtCent_value_d0 = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
}
}
void combiner_top::thread_centre_buffer_0_wgtCent_value_we0() {
if (((esl_seteq<1,5,5>(ap_ST_st3_fsm_2, ap_CS_fsm.read()) &&
esl_seteq<1,1,1>(ap_const_lv1_0, exitcond8_fu_571_p2.read())) ||
(esl_seteq<1,1,1>(ap_const_lv1_0, exitcond6_reg_1129.read()) &&
esl_seteq<1,5,5>(ap_ST_st25_fsm_10, ap_CS_fsm.read())))) {
centre_buffer_0_wgtCent_value_we0 = ap_const_logic_1;
} else {
centre_buffer_0_wgtCent_value_we0 = ap_const_logic_0;
}
}
void combiner_top::thread_centre_buffer_1_wgtCent_value_address0() {
if (esl_seteq<1,5,5>(ap_ST_st25_fsm_10, ap_CS_fsm.read())) {
centre_buffer_1_wgtCent_value_address0 = centre_buffer_1_wgtCent_value_addr_2_reg_1198.read();
} else if (esl_seteq<1,5,5>(ap_ST_st3_fsm_2, ap_CS_fsm.read())) {
centre_buffer_1_wgtCent_value_address0 = (sc_lv<8>) (tmp_2_fu_583_p1.read());
} else if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp4_it0.read()) &&
esl_seteq<1,5,5>(ap_ST_pp4_stg2_fsm_14, ap_CS_fsm.read()))) {
centre_buffer_1_wgtCent_value_address0 = (sc_lv<8>) (tmp_8_reg_1222.read());
} else if (esl_seteq<1,5,5>(ap_ST_st24_fsm_9, ap_CS_fsm.read())) {
centre_buffer_1_wgtCent_value_address0 = (sc_lv<8>) (tmp_27_fu_824_p1.read());
} else {
centre_buffer_1_wgtCent_value_address0 = (sc_lv<8>) ("XXXXXXXX");
}
}
void combiner_top::thread_centre_buffer_1_wgtCent_value_ce0() {
if ((esl_seteq<1,5,5>(ap_ST_st3_fsm_2, ap_CS_fsm.read()) ||
esl_seteq<1,5,5>(ap_ST_st24_fsm_9, ap_CS_fsm.read()) ||
(esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp4_it0.read()) &&
esl_seteq<1,5,5>(ap_ST_pp4_stg2_fsm_14, ap_CS_fsm.read())) ||
esl_seteq<1,5,5>(ap_ST_st25_fsm_10, ap_CS_fsm.read()))) {
centre_buffer_1_wgtCent_value_ce0 = ap_const_logic_1;
} else {
centre_buffer_1_wgtCent_value_ce0 = ap_const_logic_0;
}
}
void combiner_top::thread_centre_buffer_1_wgtCent_value_d0() {
if (esl_seteq<1,5,5>(ap_ST_st25_fsm_10, ap_CS_fsm.read())) {
centre_buffer_1_wgtCent_value_d0 = tmp_43_1_fu_853_p2.read();
} else if (esl_seteq<1,5,5>(ap_ST_st3_fsm_2, ap_CS_fsm.read())) {
centre_buffer_1_wgtCent_value_d0 = ap_const_lv32_0;
} else {
centre_buffer_1_wgtCent_value_d0 = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
}
}
void combiner_top::thread_centre_buffer_1_wgtCent_value_we0() {
if (((esl_seteq<1,5,5>(ap_ST_st3_fsm_2, ap_CS_fsm.read()) &&
esl_seteq<1,1,1>(ap_const_lv1_0, exitcond8_fu_571_p2.read())) ||
(esl_seteq<1,1,1>(ap_const_lv1_0, exitcond6_reg_1129.read()) &&
esl_seteq<1,5,5>(ap_ST_st25_fsm_10, ap_CS_fsm.read())))) {
centre_buffer_1_wgtCent_value_we0 = ap_const_logic_1;
} else {
centre_buffer_1_wgtCent_value_we0 = ap_const_logic_0;
}
}
void combiner_top::thread_centre_buffer_2_wgtCent_value_address0() {
if (esl_seteq<1,5,5>(ap_ST_st25_fsm_10, ap_CS_fsm.read())) {
centre_buffer_2_wgtCent_value_address0 = centre_buffer_2_wgtCent_value_addr_2_reg_1203.read();
} else if (esl_seteq<1,5,5>(ap_ST_st3_fsm_2, ap_CS_fsm.read())) {
centre_buffer_2_wgtCent_value_address0 = (sc_lv<8>) (tmp_2_fu_583_p1.read());
} else if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp4_it0.read()) &&
esl_seteq<1,5,5>(ap_ST_pp4_stg2_fsm_14, ap_CS_fsm.read()))) {
centre_buffer_2_wgtCent_value_address0 = (sc_lv<8>) (tmp_8_reg_1222.read());
} else if (esl_seteq<1,5,5>(ap_ST_st24_fsm_9, ap_CS_fsm.read())) {
centre_buffer_2_wgtCent_value_address0 = (sc_lv<8>) (tmp_27_fu_824_p1.read());
} else {
centre_buffer_2_wgtCent_value_address0 = (sc_lv<8>) ("XXXXXXXX");
}
}
void combiner_top::thread_centre_buffer_2_wgtCent_value_ce0() {
if ((esl_seteq<1,5,5>(ap_ST_st3_fsm_2, ap_CS_fsm.read()) ||
esl_seteq<1,5,5>(ap_ST_st24_fsm_9, ap_CS_fsm.read()) ||
(esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp4_it0.read()) &&
esl_seteq<1,5,5>(ap_ST_pp4_stg2_fsm_14, ap_CS_fsm.read())) ||
esl_seteq<1,5,5>(ap_ST_st25_fsm_10, ap_CS_fsm.read()))) {
centre_buffer_2_wgtCent_value_ce0 = ap_const_logic_1;
} else {
centre_buffer_2_wgtCent_value_ce0 = ap_const_logic_0;
}
}
void combiner_top::thread_centre_buffer_2_wgtCent_value_d0() {
if (esl_seteq<1,5,5>(ap_ST_st25_fsm_10, ap_CS_fsm.read())) {
centre_buffer_2_wgtCent_value_d0 = tmp_43_2_fu_859_p2.read();
} else if (esl_seteq<1,5,5>(ap_ST_st3_fsm_2, ap_CS_fsm.read())) {
centre_buffer_2_wgtCent_value_d0 = ap_const_lv32_0;
} else {
centre_buffer_2_wgtCent_value_d0 = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
}
}
void combiner_top::thread_centre_buffer_2_wgtCent_value_we0() {
if (((esl_seteq<1,5,5>(ap_ST_st3_fsm_2, ap_CS_fsm.read()) &&
esl_seteq<1,1,1>(ap_const_lv1_0, exitcond8_fu_571_p2.read())) ||
(esl_seteq<1,1,1>(ap_const_lv1_0, exitcond6_reg_1129.read()) &&
esl_seteq<1,5,5>(ap_ST_st25_fsm_10, ap_CS_fsm.read())))) {
centre_buffer_2_wgtCent_value_we0 = ap_const_logic_1;
} else {
centre_buffer_2_wgtCent_value_we0 = ap_const_logic_0;
}
}
void combiner_top::thread_centre_buffer_count_address0() {
if (esl_seteq<1,5,5>(ap_ST_st25_fsm_10, ap_CS_fsm.read())) {
centre_buffer_count_address0 = centre_buffer_count_addr_2_reg_1183.read();
} else if (esl_seteq<1,5,5>(ap_ST_st3_fsm_2, ap_CS_fsm.read())) {
centre_buffer_count_address0 = (sc_lv<8>) (tmp_2_fu_583_p1.read());
} else if ((esl_seteq<1,5,5>(ap_ST_pp4_stg0_fsm_12, ap_CS_fsm.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp4_it0.read()))) {
centre_buffer_count_address0 = (sc_lv<8>) (tmp_8_fu_883_p1.read());
} else if (esl_seteq<1,5,5>(ap_ST_st24_fsm_9, ap_CS_fsm.read())) {
centre_buffer_count_address0 = (sc_lv<8>) (tmp_27_fu_824_p1.read());
} else {
centre_buffer_count_address0 = (sc_lv<8>) ("XXXXXXXX");
}
}
void combiner_top::thread_centre_buffer_count_ce0() {
if ((esl_seteq<1,5,5>(ap_ST_st3_fsm_2, ap_CS_fsm.read()) ||
esl_seteq<1,5,5>(ap_ST_st24_fsm_9, ap_CS_fsm.read()) ||
(esl_seteq<1,5,5>(ap_ST_pp4_stg0_fsm_12, ap_CS_fsm.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp4_it0.read())) ||
esl_seteq<1,5,5>(ap_ST_st25_fsm_10, ap_CS_fsm.read()))) {
centre_buffer_count_ce0 = ap_const_logic_1;
} else {
centre_buffer_count_ce0 = ap_const_logic_0;
}
}
void combiner_top::thread_centre_buffer_count_d0() {
if (esl_seteq<1,5,5>(ap_ST_st25_fsm_10, ap_CS_fsm.read())) {
centre_buffer_count_d0 = tmp_31_fu_833_p2.read();
} else if (esl_seteq<1,5,5>(ap_ST_st3_fsm_2, ap_CS_fsm.read())) {
centre_buffer_count_d0 = ap_const_lv32_0;
} else {
centre_buffer_count_d0 = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
}
}
void combiner_top::thread_centre_buffer_count_we0() {
if (((esl_seteq<1,5,5>(ap_ST_st3_fsm_2, ap_CS_fsm.read()) &&
esl_seteq<1,1,1>(ap_const_lv1_0, exitcond8_fu_571_p2.read())) ||
(esl_seteq<1,1,1>(ap_const_lv1_0, exitcond6_reg_1129.read()) &&
esl_seteq<1,5,5>(ap_ST_st25_fsm_10, ap_CS_fsm.read())))) {
centre_buffer_count_we0 = ap_const_logic_1;
} else {
centre_buffer_count_we0 = ap_const_logic_0;
}
}
void combiner_top::thread_centre_buffer_sum_sq_address0() {
if (esl_seteq<1,5,5>(ap_ST_st25_fsm_10, ap_CS_fsm.read())) {
centre_buffer_sum_sq_address0 = centre_buffer_sum_sq_addr_2_reg_1188.read();
} else if (esl_seteq<1,5,5>(ap_ST_st3_fsm_2, ap_CS_fsm.read())) {
centre_buffer_sum_sq_address0 = (sc_lv<8>) (tmp_2_fu_583_p1.read());
} else if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp4_it0.read()) &&
esl_seteq<1,5,5>(ap_ST_pp4_stg1_fsm_13, ap_CS_fsm.read()))) {
centre_buffer_sum_sq_address0 = (sc_lv<8>) (tmp_8_reg_1222.read());
} else if (esl_seteq<1,5,5>(ap_ST_st24_fsm_9, ap_CS_fsm.read())) {
centre_buffer_sum_sq_address0 = (sc_lv<8>) (tmp_27_fu_824_p1.read());
} else {
centre_buffer_sum_sq_address0 = (sc_lv<8>) ("XXXXXXXX");
}
}
void combiner_top::thread_centre_buffer_sum_sq_ce0() {
if ((esl_seteq<1,5,5>(ap_ST_st3_fsm_2, ap_CS_fsm.read()) ||
esl_seteq<1,5,5>(ap_ST_st24_fsm_9, ap_CS_fsm.read()) ||
(esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp4_it0.read()) &&
esl_seteq<1,5,5>(ap_ST_pp4_stg1_fsm_13, ap_CS_fsm.read())) ||
esl_seteq<1,5,5>(ap_ST_st25_fsm_10, ap_CS_fsm.read()))) {
centre_buffer_sum_sq_ce0 = ap_const_logic_1;
} else {
centre_buffer_sum_sq_ce0 = ap_const_logic_0;
}
}
void combiner_top::thread_centre_buffer_sum_sq_d0() {
if (esl_seteq<1,5,5>(ap_ST_st25_fsm_10, ap_CS_fsm.read())) {
centre_buffer_sum_sq_d0 = tmp_32_fu_840_p2.read();
} else if (esl_seteq<1,5,5>(ap_ST_st3_fsm_2, ap_CS_fsm.read())) {
centre_buffer_sum_sq_d0 = ap_const_lv32_0;
} else {
centre_buffer_sum_sq_d0 = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
}
}
void combiner_top::thread_centre_buffer_sum_sq_we0() {
if (((esl_seteq<1,5,5>(ap_ST_st3_fsm_2, ap_CS_fsm.read()) &&
esl_seteq<1,1,1>(ap_const_lv1_0, exitcond8_fu_571_p2.read())) ||
(esl_seteq<1,1,1>(ap_const_lv1_0, exitcond6_reg_1129.read()) &&
esl_seteq<1,5,5>(ap_ST_st25_fsm_10, ap_CS_fsm.read())))) {
centre_buffer_sum_sq_we0 = ap_const_logic_1;
} else {
centre_buffer_sum_sq_we0 = ap_const_logic_0;
}
}
void combiner_top::thread_centres_out_addr0ack_out() {
if ((esl_seteq<1,5,5>(ap_ST_st71_fsm_18, ap_CS_fsm.read()) &&
!esl_seteq<1,1,1>(distortion_out1ack_in.read(), ap_const_logic_0))) {
centres_out_addr0ack_out = ap_const_logic_1;
} else {
centres_out_addr0ack_out = ap_const_logic_0;
}
}
void combiner_top::thread_data_points_in_addr0ack_out() {
if ((esl_seteq<1,5,5>(ap_ST_st71_fsm_18, ap_CS_fsm.read()) &&
!esl_seteq<1,1,1>(distortion_out1ack_in.read(), ap_const_logic_0))) {
data_points_in_addr0ack_out = ap_const_logic_1;
} else {
data_points_in_addr0ack_out = ap_const_logic_0;
}
}
void combiner_top::thread_distortion_out() {
distortion_out = distortion_out1data_reg.read();
}
void combiner_top::thread_distortion_out1ack_in() {
if ((esl_seteq<1,1,1>(ap_const_logic_0, distortion_out1vld_reg.read()) ||
(esl_seteq<1,1,1>(ap_const_logic_1, distortion_out1vld_reg.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_const_logic_1)))) {
distortion_out1ack_in = ap_const_logic_1;
} else {
distortion_out1ack_in = ap_const_logic_0;
}
}
void combiner_top::thread_distortion_out1vld_in() {
if (esl_seteq<1,5,5>(ap_ST_st70_fsm_17, ap_CS_fsm.read())) {
distortion_out1vld_in = ap_const_logic_1;
} else {
distortion_out1vld_in = ap_const_logic_0;
}
}
void combiner_top::thread_exitcond1_fu_702_p2() {
exitcond1_fu_702_p2 = (!indvar2_phi_fu_499_p4.read().is_01() || !ap_const_lv6_20.is_01())? sc_lv<1>(): sc_lv<1>(indvar2_phi_fu_499_p4.read() == ap_const_lv6_20);
}
void combiner_top::thread_exitcond6_fu_725_p2() {
exitcond6_fu_725_p2 = (!i1_reg_507.read().is_01() || !ap_const_lv5_10.is_01())? sc_lv<1>(): sc_lv<1>(i1_reg_507.read() == ap_const_lv5_10);
}
void combiner_top::thread_exitcond8_fu_571_p2() {
exitcond8_fu_571_p2 = (!i_reg_460.read().is_01() || !ap_const_lv9_100.is_01())? sc_lv<1>(): sc_lv<1>(i_reg_460.read() == ap_const_lv9_100);
}
void combiner_top::thread_exitcond9_fu_654_p2() {
exitcond9_fu_654_p2 = (!indvar_phi_fu_487_p4.read().is_01() || !ap_const_lv6_30.is_01())? sc_lv<1>(): sc_lv<1>(indvar_phi_fu_487_p4.read() == ap_const_lv6_30);
}
void combiner_top::thread_exitcond_fu_1020_p2() {
exitcond_fu_1020_p2 = (!indvar1_reg_553.read().is_01() || !tmp_38_add_i32_shr_reg_1305.read().is_01())? sc_lv<1>(): sc_lv<1>(indvar1_reg_553.read() == tmp_38_add_i32_shr_reg_1305.read());
}
void combiner_top::thread_grp_fu_917_ce() {
grp_fu_917_ce = ap_const_logic_1;
}
void combiner_top::thread_grp_fu_917_p0() {
grp_fu_917_p0 = centre_buffer_0_wgtCent_value_q0.read();
}
void combiner_top::thread_grp_fu_917_p1() {
grp_fu_917_p1 = (!tmp_9_fu_905_p2.read()[0].is_01())? sc_lv<32>(): ((tmp_9_fu_905_p2.read()[0].to_bool())? ap_const_lv32_1: count_reg_1246.read());
}
void combiner_top::thread_grp_fu_930_ce() {
grp_fu_930_ce = ap_const_logic_1;
}
void combiner_top::thread_grp_fu_930_p0() {
grp_fu_930_p0 = centre_buffer_1_wgtCent_value_q0.read();
}
void combiner_top::thread_grp_fu_930_p1() {
grp_fu_930_p1 = i_count_reg_1262.read();
}
void combiner_top::thread_grp_fu_936_ce() {
grp_fu_936_ce = ap_const_logic_1;
}
void combiner_top::thread_grp_fu_936_p0() {
grp_fu_936_p0 = centre_buffer_2_wgtCent_value_load_reg_1295.read();
}
void combiner_top::thread_grp_fu_936_p1() {
grp_fu_936_p1 = i_count_reg_1262.read();
}
void combiner_top::thread_i1_cast2_fu_737_p1() {
i1_cast2_fu_737_p1 = esl_zext<7,5>(i1_reg_507.read());
}
void combiner_top::thread_i5_phi_fu_534_p4() {
if ((esl_seteq<1,5,5>(ap_ST_pp4_stg0_fsm_12, ap_CS_fsm.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp4_it1.read()) &&
esl_seteq<1,1,1>(ap_const_lv1_0, tmp_1_reg_1213.read()) &&
esl_seteq<1,1,1>(ap_const_lv1_0, tmp_13_reg_1242.read()))) {
i5_phi_fu_534_p4 = i_2_reg_1217.read();
} else {
i5_phi_fu_534_p4 = i5_reg_530.read();
}
}
void combiner_top::thread_i_1_fu_577_p2() {
i_1_fu_577_p2 = (!i_reg_460.read().is_01() || !ap_const_lv9_1.is_01())? sc_lv<9>(): (sc_bigint<9>(i_reg_460.read()) + sc_biguint<9>(ap_const_lv9_1));
}
void combiner_top::thread_i_2_fu_877_p2() {
i_2_fu_877_p2 = (!i5_phi_fu_534_p4.read().is_01() || !ap_const_lv32_1.is_01())? sc_lv<32>(): (sc_bigint<32>(i5_phi_fu_534_p4.read()) + sc_biguint<32>(ap_const_lv32_1));
}
void combiner_top::thread_i_3_fu_731_p2() {
i_3_fu_731_p2 = (!i1_reg_507.read().is_01() || !ap_const_lv5_1.is_01())? sc_lv<5>(): (sc_bigint<5>(i1_reg_507.read()) + sc_biguint<5>(ap_const_lv5_1));
}
void combiner_top::thread_i_buffer_address0() {
if ((esl_seteq<1,5,5>(ap_ST_pp2_stg0_fsm_7, ap_CS_fsm.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp2_it7.read()))) {
i_buffer_address0 = (sc_lv<5>) (tmp_34_fu_720_p1.read());
} else if (esl_seteq<1,5,5>(ap_ST_st24_fsm_9, ap_CS_fsm.read())) {
i_buffer_address0 = (sc_lv<5>) (tmp_21_fu_805_p1.read());
} else if (esl_seteq<1,5,5>(ap_ST_st23_fsm_8, ap_CS_fsm.read())) {
i_buffer_address0 = (sc_lv<5>) (tmp_19_fu_751_p1.read());
} else {
i_buffer_address0 = (sc_lv<5>) ("XXXXX");
}
}
void combiner_top::thread_i_buffer_ce0() {
if ((esl_seteq<1,5,5>(ap_ST_st23_fsm_8, ap_CS_fsm.read()) ||
esl_seteq<1,5,5>(ap_ST_st24_fsm_9, ap_CS_fsm.read()) ||
(esl_seteq<1,5,5>(ap_ST_pp2_stg0_fsm_7, ap_CS_fsm.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp2_it7.read()) &&
!(ap_sig_bdd_251.read() && esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp2_it6.read()))))) {
i_buffer_ce0 = ap_const_logic_1;
} else {
i_buffer_ce0 = ap_const_logic_0;
}
}
void combiner_top::thread_i_buffer_d0() {
i_buffer_d0 = reg_565.read();
}
void combiner_top::thread_i_buffer_we0() {
if (((esl_seteq<1,5,5>(ap_ST_pp2_stg0_fsm_7, ap_CS_fsm.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp2_it7.read()) &&
!(ap_sig_bdd_251.read() && esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp2_it6.read())) &&
esl_seteq<1,1,1>(ap_const_lv1_0, ap_reg_ppstg_exitcond1_reg_1116_pp2_it6.read())))) {
i_buffer_we0 = ap_const_logic_1;
} else {
i_buffer_we0 = ap_const_logic_0;
}
}
void combiner_top::thread_i_count_fu_910_p3() {
i_count_fu_910_p3 = (!tmp_9_fu_905_p2.read()[0].is_01())? sc_lv<32>(): ((tmp_9_fu_905_p2.read()[0].to_bool())? ap_const_lv32_1: count_reg_1246.read());
}
void combiner_top::thread_indvar2_phi_fu_499_p4() {
if ((esl_seteq<1,5,5>(ap_ST_pp2_stg0_fsm_7, ap_CS_fsm.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp2_it1.read()) &&
esl_seteq<1,1,1>(ap_const_lv1_0, exitcond1_reg_1116.read()))) {
indvar2_phi_fu_499_p4 = indvar_next2_reg_1120.read();
} else {
indvar2_phi_fu_499_p4 = indvar2_reg_495.read();
}
}
void combiner_top::thread_indvar_next1_fu_1025_p2() {
indvar_next1_fu_1025_p2 = (!indvar1_reg_553.read().is_01() || !ap_const_lv30_1.is_01())? sc_lv<30>(): (sc_bigint<30>(indvar1_reg_553.read()) + sc_biguint<30>(ap_const_lv30_1));
}
void combiner_top::thread_indvar_next2_fu_708_p2() {
indvar_next2_fu_708_p2 = (!indvar2_phi_fu_499_p4.read().is_01() || !ap_const_lv6_1.is_01())? sc_lv<6>(): (sc_bigint<6>(indvar2_phi_fu_499_p4.read()) + sc_biguint<6>(ap_const_lv6_1));
}
void combiner_top::thread_indvar_next_fu_660_p2() {
indvar_next_fu_660_p2 = (!indvar_phi_fu_487_p4.read().is_01() || !ap_const_lv6_1.is_01())? sc_lv<6>(): (sc_bigint<6>(indvar_phi_fu_487_p4.read()) + sc_biguint<6>(ap_const_lv6_1));
}
void combiner_top::thread_indvar_phi_fu_487_p4() {
if ((esl_seteq<1,5,5>(ap_ST_pp1_stg0_fsm_5, ap_CS_fsm.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp1_it1.read()) &&
esl_seteq<1,1,1>(exitcond9_reg_1097.read(), ap_const_lv1_0))) {
indvar_phi_fu_487_p4 = indvar_next_reg_1101.read();
} else {
indvar_phi_fu_487_p4 = indvar_reg_483.read();
}
}
void combiner_top::thread_isIter0_fu_666_p2() {
isIter0_fu_666_p2 = (!indvar_phi_fu_487_p4.read().is_01() || !ap_const_lv6_0.is_01())? sc_lv<1>(): sc_lv<1>(indvar_phi_fu_487_p4.read() == ap_const_lv6_0);
}
void combiner_top::thread_isIter1_fu_714_p2() {
isIter1_fu_714_p2 = (!indvar2_phi_fu_499_p4.read().is_01() || !ap_const_lv6_0.is_01())? sc_lv<1>(): sc_lv<1>(indvar2_phi_fu_499_p4.read() == ap_const_lv6_0);
}
void combiner_top::thread_isIter_fu_1036_p2() {
isIter_fu_1036_p2 = (!indvar1_reg_553.read().is_01() || !ap_const_lv30_0.is_01())? sc_lv<1>(): sc_lv<1>(indvar1_reg_553.read() == ap_const_lv30_0);
}
void combiner_top::thread_k0ack_out() {
if ((esl_seteq<1,5,5>(ap_ST_st71_fsm_18, ap_CS_fsm.read()) &&
!esl_seteq<1,1,1>(distortion_out1ack_in.read(), ap_const_logic_0))) {
k0ack_out = ap_const_logic_1;
} else {
k0ack_out = ap_const_logic_0;
}
}
void combiner_top::thread_kernel_info_in_addr0ack_out() {
if ((esl_seteq<1,5,5>(ap_ST_st71_fsm_18, ap_CS_fsm.read()) &&
!esl_seteq<1,1,1>(distortion_out1ack_in.read(), ap_const_logic_0))) {
kernel_info_in_addr0ack_out = ap_const_logic_1;
} else {
kernel_info_in_addr0ack_out = ap_const_logic_0;
}
}
void combiner_top::thread_master_portA_address() {
if ((esl_seteq<1,5,5>(ap_ST_pp5_stg0_fsm_16, ap_CS_fsm.read()) &&
esl_seteq<1,1,1>(ap_const_lv1_0, ap_reg_ppstg_exitcond_reg_1315_pp5_it1.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp5_it2.read()) &&
!(ap_sig_bdd_565.read() && esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp5_it2.read())) &&
!esl_seteq<1,1,1>(ap_const_lv1_0, ap_reg_ppstg_isIter_reg_1329_pp5_it1.read()))) {
master_portA_address = master_portA_addr_2_reg_1300.read();
} else if ((esl_seteq<1,5,5>(ap_ST_pp2_stg0_fsm_7, ap_CS_fsm.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp2_it1.read()) &&
!(ap_sig_bdd_251.read() && esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp2_it6.read())) &&
esl_seteq<1,1,1>(ap_const_lv1_0, exitcond1_reg_1116.read()) &&
!esl_seteq<1,1,1>(ap_const_lv1_0, isIter1_reg_1125.read()))) {
master_portA_address = master_portA_addr_1_reg_1110.read();
} else if ((esl_seteq<1,5,5>(ap_ST_pp1_stg0_fsm_5, ap_CS_fsm.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp1_it1.read()) &&
!(ap_sig_bdd_218.read() && esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp1_it6.read())) &&
esl_seteq<1,1,1>(exitcond9_reg_1097.read(), ap_const_lv1_0) &&
!esl_seteq<1,1,1>(ap_const_lv1_0, isIter0_reg_1106.read()))) {
master_portA_address = master_portA_addr_reg_1091.read();
} else {
master_portA_address = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
}
}
void combiner_top::thread_master_portA_dataout() {
master_portA_dataout = c_buffer_load_reg_1333.read();
}
void combiner_top::thread_master_portA_req_din() {
if (((esl_seteq<1,5,5>(ap_ST_pp5_stg0_fsm_16, ap_CS_fsm.read()) &&
esl_seteq<1,1,1>(ap_const_lv1_0, ap_reg_ppstg_exitcond_reg_1315_pp5_it1.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp5_it2.read()) &&
!(ap_sig_bdd_565.read() && esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp5_it2.read())) &&
!esl_seteq<1,1,1>(ap_const_lv1_0, ap_reg_ppstg_isIter_reg_1329_pp5_it1.read())) ||
(esl_seteq<1,5,5>(ap_ST_pp5_stg0_fsm_16, ap_CS_fsm.read()) &&
esl_seteq<1,1,1>(ap_const_lv1_0, ap_reg_ppstg_exitcond_reg_1315_pp5_it1.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp5_it2.read()) &&
!(ap_sig_bdd_565.read() && esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp5_it2.read()))))) {
master_portA_req_din = ap_const_logic_1;
} else if (((esl_seteq<1,5,5>(ap_ST_pp1_stg0_fsm_5, ap_CS_fsm.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp1_it1.read()) &&
!(ap_sig_bdd_218.read() && esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp1_it6.read())) &&
esl_seteq<1,1,1>(exitcond9_reg_1097.read(), ap_const_lv1_0) &&
!esl_seteq<1,1,1>(ap_const_lv1_0, isIter0_reg_1106.read())) ||
(esl_seteq<1,5,5>(ap_ST_pp2_stg0_fsm_7, ap_CS_fsm.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp2_it1.read()) &&
!(ap_sig_bdd_251.read() && esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp2_it6.read())) &&
esl_seteq<1,1,1>(ap_const_lv1_0, exitcond1_reg_1116.read()) &&
!esl_seteq<1,1,1>(ap_const_lv1_0, isIter1_reg_1125.read())))) {
master_portA_req_din = ap_const_logic_0;
} else {
master_portA_req_din = ap_const_logic_0;
}
}
void combiner_top::thread_master_portA_req_write() {
if (((esl_seteq<1,5,5>(ap_ST_pp1_stg0_fsm_5, ap_CS_fsm.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp1_it1.read()) &&
!(ap_sig_bdd_218.read() && esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp1_it6.read())) &&
esl_seteq<1,1,1>(exitcond9_reg_1097.read(), ap_const_lv1_0) &&
!esl_seteq<1,1,1>(ap_const_lv1_0, isIter0_reg_1106.read())) ||
(esl_seteq<1,5,5>(ap_ST_pp2_stg0_fsm_7, ap_CS_fsm.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp2_it1.read()) &&
!(ap_sig_bdd_251.read() && esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp2_it6.read())) &&
esl_seteq<1,1,1>(ap_const_lv1_0, exitcond1_reg_1116.read()) &&
!esl_seteq<1,1,1>(ap_const_lv1_0, isIter1_reg_1125.read())) ||
(esl_seteq<1,5,5>(ap_ST_pp5_stg0_fsm_16, ap_CS_fsm.read()) &&
esl_seteq<1,1,1>(ap_const_lv1_0, ap_reg_ppstg_exitcond_reg_1315_pp5_it1.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp5_it2.read()) &&
!(ap_sig_bdd_565.read() && esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp5_it2.read())) &&
!esl_seteq<1,1,1>(ap_const_lv1_0, ap_reg_ppstg_isIter_reg_1329_pp5_it1.read())) ||
(esl_seteq<1,5,5>(ap_ST_pp5_stg0_fsm_16, ap_CS_fsm.read()) &&
esl_seteq<1,1,1>(ap_const_lv1_0, ap_reg_ppstg_exitcond_reg_1315_pp5_it1.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp5_it2.read()) &&
!(ap_sig_bdd_565.read() && esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp5_it2.read()))))) {
master_portA_req_write = ap_const_logic_1;
} else {
master_portA_req_write = ap_const_logic_0;
}
}
void combiner_top::thread_master_portA_rsp_read() {
if (((esl_seteq<1,5,5>(ap_ST_pp1_stg0_fsm_5, ap_CS_fsm.read()) &&
esl_seteq<1,1,1>(ap_reg_ppstg_exitcond9_reg_1097_pp1_it5.read(), ap_const_lv1_0) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp1_it6.read()) &&
!(ap_sig_bdd_218.read() && esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp1_it6.read()))) ||
(esl_seteq<1,5,5>(ap_ST_pp2_stg0_fsm_7, ap_CS_fsm.read()) &&
esl_seteq<1,1,1>(ap_const_lv1_0, ap_reg_ppstg_exitcond1_reg_1116_pp2_it5.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp2_it6.read()) &&
!(ap_sig_bdd_251.read() && esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp2_it6.read()))))) {
master_portA_rsp_read = ap_const_logic_1;
} else {
master_portA_rsp_read = ap_const_logic_0;
}
}
void combiner_top::thread_master_portA_size() {
if ((esl_seteq<1,5,5>(ap_ST_pp5_stg0_fsm_16, ap_CS_fsm.read()) &&
esl_seteq<1,1,1>(ap_const_lv1_0, ap_reg_ppstg_exitcond_reg_1315_pp5_it1.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp5_it2.read()) &&
!(ap_sig_bdd_565.read() && esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp5_it2.read())) &&
!esl_seteq<1,1,1>(ap_const_lv1_0, ap_reg_ppstg_isIter_reg_1329_pp5_it1.read()))) {
master_portA_size = tmp_25_reg_1310.read();
} else if ((esl_seteq<1,5,5>(ap_ST_pp2_stg0_fsm_7, ap_CS_fsm.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp2_it1.read()) &&
!(ap_sig_bdd_251.read() && esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp2_it6.read())) &&
esl_seteq<1,1,1>(ap_const_lv1_0, exitcond1_reg_1116.read()) &&
!esl_seteq<1,1,1>(ap_const_lv1_0, isIter1_reg_1125.read()))) {
master_portA_size = ap_const_lv32_20;
} else if ((esl_seteq<1,5,5>(ap_ST_pp1_stg0_fsm_5, ap_CS_fsm.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp1_it1.read()) &&
!(ap_sig_bdd_218.read() && esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp1_it6.read())) &&
esl_seteq<1,1,1>(exitcond9_reg_1097.read(), ap_const_lv1_0) &&
!esl_seteq<1,1,1>(ap_const_lv1_0, isIter0_reg_1106.read()))) {
master_portA_size = ap_const_lv32_30;
} else {
master_portA_size = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
}
}
void combiner_top::thread_n0ack_out() {
if ((esl_seteq<1,5,5>(ap_ST_st71_fsm_18, ap_CS_fsm.read()) &&
!esl_seteq<1,1,1>(distortion_out1ack_in.read(), ap_const_logic_0))) {
n0ack_out = ap_const_logic_1;
} else {
n0ack_out = ap_const_logic_0;
}
}
void combiner_top::thread_p_buffer_address0() {
if ((esl_seteq<1,5,5>(ap_ST_pp1_stg0_fsm_5, ap_CS_fsm.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp1_it7.read()))) {
p_buffer_address0 = (sc_lv<6>) (tmp_26_fu_672_p1.read());
} else if (esl_seteq<1,5,5>(ap_ST_st23_fsm_8, ap_CS_fsm.read())) {
p_buffer_address0 = (sc_lv<6>) (tmp_30_fu_778_p1.read());
} else {
p_buffer_address0 = (sc_lv<6>) ("XXXXXX");
}
}
void combiner_top::thread_p_buffer_address1() {
if (esl_seteq<1,5,5>(ap_ST_st24_fsm_9, ap_CS_fsm.read())) {
p_buffer_address1 = (sc_lv<6>) (tmp_29_2_fu_819_p1.read());
} else if (esl_seteq<1,5,5>(ap_ST_st23_fsm_8, ap_CS_fsm.read())) {
p_buffer_address1 = (sc_lv<6>) (tmp_29_1_fu_793_p1.read());
} else {
p_buffer_address1 = (sc_lv<6>) ("XXXXXX");
}
}
void combiner_top::thread_p_buffer_ce0() {
if ((esl_seteq<1,5,5>(ap_ST_st23_fsm_8, ap_CS_fsm.read()) ||
(esl_seteq<1,5,5>(ap_ST_pp1_stg0_fsm_5, ap_CS_fsm.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp1_it7.read()) &&
!(ap_sig_bdd_218.read() && esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp1_it6.read()))))) {
p_buffer_ce0 = ap_const_logic_1;
} else {
p_buffer_ce0 = ap_const_logic_0;
}
}
void combiner_top::thread_p_buffer_ce1() {
if ((esl_seteq<1,5,5>(ap_ST_st23_fsm_8, ap_CS_fsm.read()) ||
esl_seteq<1,5,5>(ap_ST_st24_fsm_9, ap_CS_fsm.read()))) {
p_buffer_ce1 = ap_const_logic_1;
} else {
p_buffer_ce1 = ap_const_logic_0;
}
}
void combiner_top::thread_p_buffer_d0() {
p_buffer_d0 = reg_565.read();
}
void combiner_top::thread_p_buffer_we0() {
if (((esl_seteq<1,5,5>(ap_ST_pp1_stg0_fsm_5, ap_CS_fsm.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp1_it7.read()) &&
!(ap_sig_bdd_218.read() && esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp1_it6.read())) &&
esl_seteq<1,1,1>(ap_const_lv1_0, ap_reg_ppstg_exitcond9_reg_1097_pp1_it6.read())))) {
p_buffer_we0 = ap_const_logic_1;
} else {
p_buffer_we0 = ap_const_logic_0;
}
}
void combiner_top::thread_p_shl4_cast_fu_764_p1() {
p_shl4_cast_fu_764_p1 = esl_zext<7,6>(p_shl4_fu_756_p3.read());
}
void combiner_top::thread_p_shl4_fu_756_p3() {
p_shl4_fu_756_p3 = esl_concat<4,2>(tmp_36_fu_741_p1.read(), ap_const_lv2_0);
}
void combiner_top::thread_p_sum1_cast_fu_692_p1() {
p_sum1_cast_fu_692_p1 = esl_zext<64,33>(p_sum1_fu_687_p2.read());
}
void combiner_top::thread_p_sum1_fu_687_p2() {
p_sum1_fu_687_p2 = (!tmp_cast_reg_1083.read().is_01() || !tmp_11_cast_fu_683_p1.read().is_01())? sc_lv<33>(): (sc_bigint<33>(tmp_cast_reg_1083.read()) + sc_biguint<33>(tmp_11_cast_fu_683_p1.read()));
}
void combiner_top::thread_p_sum_cast_fu_644_p1() {
p_sum_cast_fu_644_p1 = esl_zext<64,33>(p_sum_fu_639_p2.read());
}
void combiner_top::thread_p_sum_fu_639_p2() {
p_sum_fu_639_p2 = (!tmp_5_cast_reg_1078.read().is_01() || !tmp_7_cast_fu_635_p1.read().is_01())? sc_lv<33>(): (sc_bigint<33>(tmp_5_cast_reg_1078.read()) + sc_biguint<33>(tmp_7_cast_fu_635_p1.read()));
}
void combiner_top::thread_tmp_10_fu_623_p2() {
tmp_10_fu_623_p2 = (!ap_const_lv32_2.is_01())? sc_lv<32>(): b_reg_471.read() << (unsigned short)ap_const_lv32_2.to_uint();
}
void combiner_top::thread_tmp_11_cast_fu_683_p1() {
tmp_11_cast_fu_683_p1 = esl_zext<33,32>(tmp_35_fu_677_p2.read());
}
void combiner_top::thread_tmp_11_fu_894_p2() {
tmp_11_fu_894_p2 = (!tmp_17_fu_888_p2.read().is_01() || !i5_phi_fu_534_p4.read().is_01())? sc_lv<32>(): (sc_bigint<32>(tmp_17_fu_888_p2.read()) - sc_biguint<32>(i5_phi_fu_534_p4.read()));
}
void combiner_top::thread_tmp_12_fu_941_p1() {
tmp_12_fu_941_p1 = esl_zext<64,32>(ap_reg_ppstg_tmp_11_reg_1235_pp4_it11.read());
}
void combiner_top::thread_tmp_13_fu_900_p2() {
tmp_13_fu_900_p2 = (!i5_phi_fu_534_p4.read().is_01() || !k0data_reg.read().is_01())? sc_lv<1>(): sc_lv<1>(i5_phi_fu_534_p4.read() == k0data_reg.read());
}
void combiner_top::thread_tmp_14_fu_965_p4() {
tmp_14_fu_965_p4 = centres_out_addr0data_reg.read().range(31, 2);
}
void combiner_top::thread_tmp_15_fu_974_p1() {
tmp_15_fu_974_p1 = esl_zext<64,30>(tmp_14_fu_965_p4.read());
}
void combiner_top::thread_tmp_16_fu_989_p2() {
tmp_16_fu_989_p2 = (!tmp_18_fu_984_p2.read().is_01() || !k0data_reg.read().is_01())? sc_lv<32>(): (sc_bigint<32>(tmp_18_fu_984_p2.read()) - sc_biguint<32>(k0data_reg.read()));
}
void combiner_top::thread_tmp_17_fu_888_p2() {
tmp_17_fu_888_p2 = (!ap_const_lv32_2.is_01())? sc_lv<32>(): i5_phi_fu_534_p4.read() << (unsigned short)ap_const_lv32_2.to_uint();
}
void combiner_top::thread_tmp_18_fu_984_p2() {
tmp_18_fu_984_p2 = (!ap_const_lv32_2.is_01())? sc_lv<32>(): k0data_reg.read() << (unsigned short)ap_const_lv32_2.to_uint();
}
void combiner_top::thread_tmp_19_fu_751_p1() {
tmp_19_fu_751_p1 = esl_zext<64,5>(tmp_37_fu_745_p2.read());
}
void combiner_top::thread_tmp_1_fu_872_p2() {
tmp_1_fu_872_p2 = (!i5_phi_fu_534_p4.read().is_01() || !k0data_reg.read().is_01())? sc_lv<1>(): (sc_biguint<32>(i5_phi_fu_534_p4.read()) > sc_biguint<32>(k0data_reg.read()));
}
void combiner_top::thread_tmp_20_fu_798_p3() {
tmp_20_fu_798_p3 = esl_concat<4,1>(tmp_36_reg_1138.read(), ap_const_lv1_1);
}
void combiner_top::thread_tmp_21_fu_805_p1() {
tmp_21_fu_805_p1 = esl_zext<64,5>(tmp_20_fu_798_p3.read());
}
void combiner_top::thread_tmp_22_fu_768_p2() {
tmp_22_fu_768_p2 = (!p_shl4_cast_fu_764_p1.read().is_01() || !i1_cast2_fu_737_p1.read().is_01())? sc_lv<7>(): (sc_bigint<7>(p_shl4_cast_fu_764_p1.read()) - sc_biguint<7>(i1_cast2_fu_737_p1.read()));
}
void combiner_top::thread_tmp_23_fu_994_p2() {
tmp_23_fu_994_p2 = (!ap_const_lv32_2.is_01())? sc_lv<32>(): tmp_16_fu_989_p2.read() << (unsigned short)ap_const_lv32_2.to_uint();
}
void combiner_top::thread_tmp_24_fu_1000_p2() {
tmp_24_fu_1000_p2 = (!tmp_23_fu_994_p2.read().is_01() || !ap_const_lv32_C.is_01())? sc_lv<32>(): (sc_bigint<32>(tmp_23_fu_994_p2.read()) + sc_biguint<32>(ap_const_lv32_C));
}
void combiner_top::thread_tmp_25_1_fu_945_p2() {
tmp_25_1_fu_945_p2 = (!ap_reg_ppstg_tmp_11_reg_1235_pp4_it12.read().is_01() || !ap_const_lv32_1.is_01())? sc_lv<32>(): (sc_bigint<32>(ap_reg_ppstg_tmp_11_reg_1235_pp4_it12.read()) + sc_biguint<32>(ap_const_lv32_1));
}
void combiner_top::thread_tmp_25_2_fu_955_p2() {
tmp_25_2_fu_955_p2 = (!ap_reg_ppstg_tmp_11_reg_1235_pp4_it12.read().is_01() || !ap_const_lv32_2.is_01())? sc_lv<32>(): (sc_bigint<32>(ap_reg_ppstg_tmp_11_reg_1235_pp4_it12.read()) + sc_biguint<32>(ap_const_lv32_2));
}
void combiner_top::thread_tmp_25_fu_1016_p1() {
tmp_25_fu_1016_p1 = esl_zext<32,30>(tmp_38_add_i32_shr_fu_1006_p4.read());
}
void combiner_top::thread_tmp_26_1_fu_950_p1() {
tmp_26_1_fu_950_p1 = esl_zext<64,32>(tmp_25_1_fu_945_p2.read());
}
void combiner_top::thread_tmp_26_2_fu_960_p1() {
tmp_26_2_fu_960_p1 = esl_zext<64,32>(tmp_25_2_fu_955_p2.read());
}
void combiner_top::thread_tmp_26_fu_672_p1() {
tmp_26_fu_672_p1 = esl_zext<64,6>(ap_reg_ppstg_indvar_reg_483_pp1_it6.read());
}
void combiner_top::thread_tmp_27_fu_824_p1() {
tmp_27_fu_824_p1 = esl_zext<64,32>(i_buffer_q0.read());
}
void combiner_top::thread_tmp_28_1_fu_783_p2() {
tmp_28_1_fu_783_p2 = (!tmp_22_fu_768_p2.read().is_01() || !ap_const_lv7_1.is_01())? sc_lv<7>(): (sc_bigint<7>(tmp_22_fu_768_p2.read()) + sc_biguint<7>(ap_const_lv7_1));
}
void combiner_top::thread_tmp_28_2_fu_810_p2() {
tmp_28_2_fu_810_p2 = (!tmp_22_reg_1148.read().is_01() || !ap_const_lv7_2.is_01())? sc_lv<7>(): (sc_bigint<7>(tmp_22_reg_1148.read()) + sc_biguint<7>(ap_const_lv7_2));
}
void combiner_top::thread_tmp_28_fu_1031_p1() {
tmp_28_fu_1031_p1 = esl_zext<64,30>(indvar1_reg_553.read());
}
void combiner_top::thread_tmp_29_1_fu_793_p0() {
tmp_29_1_fu_793_p0 = esl_sext<32,7>(tmp_28_1_fu_783_p2.read());
}
void combiner_top::thread_tmp_29_1_fu_793_p1() {
tmp_29_1_fu_793_p1 = esl_zext<64,32>(tmp_29_1_fu_793_p0.read());
}
void combiner_top::thread_tmp_29_2_fu_819_p0() {
tmp_29_2_fu_819_p0 = esl_sext<32,7>(tmp_28_2_fu_810_p2.read());
}
void combiner_top::thread_tmp_29_2_fu_819_p1() {
tmp_29_2_fu_819_p1 = esl_zext<64,32>(tmp_29_2_fu_819_p0.read());
}
void combiner_top::thread_tmp_2_fu_583_p1() {
tmp_2_fu_583_p1 = esl_zext<64,9>(i_reg_460.read());
}
void combiner_top::thread_tmp_30_fu_778_p0() {
tmp_30_fu_778_p0 = esl_sext<32,7>(tmp_22_fu_768_p2.read());
}
void combiner_top::thread_tmp_30_fu_778_p1() {
tmp_30_fu_778_p1 = esl_zext<64,32>(tmp_30_fu_778_p0.read());
}
void combiner_top::thread_tmp_31_fu_833_p2() {
tmp_31_fu_833_p2 = (!centre_buffer_count_q0.read().is_01() || !ap_const_lv32_1.is_01())? sc_lv<32>(): (sc_bigint<32>(centre_buffer_count_q0.read()) + sc_biguint<32>(ap_const_lv32_1));
}
void combiner_top::thread_tmp_32_fu_840_p2() {
tmp_32_fu_840_p2 = (!centre_buffer_sum_sq_q0.read().is_01() || !i_buffer_q0.read().is_01())? sc_lv<32>(): (sc_bigint<32>(centre_buffer_sum_sq_q0.read()) + sc_biguint<32>(i_buffer_q0.read()));
}
void combiner_top::thread_tmp_33_fu_847_p2() {
tmp_33_fu_847_p2 = (!p_buffer_load_reg_1168.read().is_01() || !centre_buffer_0_wgtCent_value_q0.read().is_01())? sc_lv<32>(): (sc_bigint<32>(p_buffer_load_reg_1168.read()) + sc_biguint<32>(centre_buffer_0_wgtCent_value_q0.read()));
}
void combiner_top::thread_tmp_34_fu_720_p1() {
tmp_34_fu_720_p1 = esl_zext<64,6>(ap_reg_ppstg_indvar2_reg_495_pp2_it6.read());
}
void combiner_top::thread_tmp_35_fu_677_p2() {
tmp_35_fu_677_p2 = (!ap_const_lv32_1.is_01())? sc_lv<32>(): b_reg_471.read() << (unsigned short)ap_const_lv32_1.to_uint();
}
void combiner_top::thread_tmp_36_fu_741_p1() {
tmp_36_fu_741_p1 = i1_reg_507.read().range(4-1, 0);
}
void combiner_top::thread_tmp_37_fu_745_p2() {
tmp_37_fu_745_p2 = (!ap_const_lv5_1.is_01())? sc_lv<5>(): i1_reg_507.read() << (unsigned short)ap_const_lv5_1.to_uint();
}
void combiner_top::thread_tmp_38_add_i32_shr_fu_1006_p4() {
tmp_38_add_i32_shr_fu_1006_p4 = tmp_24_fu_1000_p2.read().range(31, 2);
}
void combiner_top::thread_tmp_3_fu_618_p2() {
tmp_3_fu_618_p2 = (!b_reg_471.read().is_01() || !n0data_reg.read().is_01())? sc_lv<1>(): (sc_biguint<32>(b_reg_471.read()) > sc_biguint<32>(n0data_reg.read()));
}
void combiner_top::thread_tmp_43_1_fu_853_p2() {
tmp_43_1_fu_853_p2 = (!p_buffer_load_1_reg_1173.read().is_01() || !centre_buffer_1_wgtCent_value_q0.read().is_01())? sc_lv<32>(): (sc_bigint<32>(p_buffer_load_1_reg_1173.read()) + sc_biguint<32>(centre_buffer_1_wgtCent_value_q0.read()));
}
void combiner_top::thread_tmp_43_2_fu_859_p2() {
tmp_43_2_fu_859_p2 = (!p_buffer_q1.read().is_01() || !centre_buffer_2_wgtCent_value_q0.read().is_01())? sc_lv<32>(): (sc_bigint<32>(p_buffer_q1.read()) + sc_biguint<32>(centre_buffer_2_wgtCent_value_q0.read()));
}
void combiner_top::thread_tmp_5_cast_fu_601_p1() {
tmp_5_cast_fu_601_p1 = esl_zext<33,30>(tmp_5_fu_592_p4.read());
}
void combiner_top::thread_tmp_5_fu_592_p4() {
tmp_5_fu_592_p4 = data_points_in_addr0data_reg.read().range(31, 2);
}
void combiner_top::thread_tmp_6_fu_629_p2() {
tmp_6_fu_629_p2 = (!tmp_10_fu_623_p2.read().is_01() || !b_reg_471.read().is_01())? sc_lv<32>(): (sc_bigint<32>(tmp_10_fu_623_p2.read()) - sc_biguint<32>(b_reg_471.read()));
}
void combiner_top::thread_tmp_7_cast_fu_635_p1() {
tmp_7_cast_fu_635_p1 = esl_zext<33,32>(tmp_6_fu_629_p2.read());
}
void combiner_top::thread_tmp_8_fu_883_p1() {
tmp_8_fu_883_p1 = esl_zext<64,32>(i5_phi_fu_534_p4.read());
}
void combiner_top::thread_tmp_9_fu_905_p2() {
tmp_9_fu_905_p2 = (!count_reg_1246.read().is_01() || !ap_const_lv32_0.is_01())? sc_lv<1>(): sc_lv<1>(count_reg_1246.read() == ap_const_lv32_0);
}
void combiner_top::thread_tmp_cast_fu_614_p1() {
tmp_cast_fu_614_p1 = esl_zext<33,30>(tmp_s_fu_605_p4.read());
}
void combiner_top::thread_tmp_s_fu_605_p4() {
tmp_s_fu_605_p4 = kernel_info_in_addr0data_reg.read().range(31, 2);
}
void combiner_top::thread_total_distortion_2_fu_924_p2() {
total_distortion_2_fu_924_p2 = (!centre_buffer_sum_sq_q0.read().is_01() || !total_distortion_reg_518.read().is_01())? sc_lv<32>(): (sc_bigint<32>(centre_buffer_sum_sq_q0.read()) + sc_biguint<32>(total_distortion_reg_518.read()));
}
void combiner_top::thread_total_distortion_phi_fu_522_p4() {
if ((esl_seteq<1,5,5>(ap_ST_pp4_stg0_fsm_12, ap_CS_fsm.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp4_it1.read()) &&
esl_seteq<1,1,1>(ap_const_lv1_0, tmp_1_reg_1213.read()) &&
esl_seteq<1,1,1>(ap_const_lv1_0, tmp_13_reg_1242.read()))) {
total_distortion_phi_fu_522_p4 = total_distortion_2_reg_1284.read();
} else {
total_distortion_phi_fu_522_p4 = total_distortion_reg_518.read();
}
}
void combiner_top::thread_ap_NS_fsm() {
switch (ap_CS_fsm.read().to_uint()) {
case 0 :
if (!esl_seteq<1,1,1>(ap_start.read(), ap_const_logic_0)) {
ap_NS_fsm = ap_ST_st2_fsm_1;
} else {
ap_NS_fsm = ap_ST_st1_fsm_0;
}
break;
case 1 :
ap_NS_fsm = ap_ST_st3_fsm_2;
break;
case 2 :
if (esl_seteq<1,1,1>(ap_const_lv1_0, exitcond8_fu_571_p2.read())) {
ap_NS_fsm = ap_ST_st3_fsm_2;
} else {
ap_NS_fsm = ap_ST_st4_fsm_3;
}
break;
case 3 :
ap_NS_fsm = ap_ST_st5_fsm_4;
break;
case 4 :
if (esl_seteq<1,1,1>(ap_const_lv1_0, tmp_3_fu_618_p2.read())) {
ap_NS_fsm = ap_ST_pp1_stg0_fsm_5;
} else {
ap_NS_fsm = ap_ST_pp4_stg0_fsm_12;
}
break;
case 5 :
if ((!(esl_seteq<1,5,5>(ap_ST_pp1_stg0_fsm_5, ap_CS_fsm.read()) && esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp1_it7.read()) && !(ap_sig_bdd_218.read() && esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp1_it6.read())) && !esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp1_it6.read())) && !(esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp1_it0.read()) && !(ap_sig_bdd_218.read() && esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp1_it6.read())) && !esl_seteq<1,1,1>(ap_const_lv1_0, exitcond9_fu_654_p2.read()) && !esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp1_it1.read())))) {
ap_NS_fsm = ap_ST_pp1_stg0_fsm_5;
} else if (((esl_seteq<1,5,5>(ap_ST_pp1_stg0_fsm_5, ap_CS_fsm.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp1_it7.read()) &&
!(ap_sig_bdd_218.read() && esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp1_it6.read())) &&
!esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp1_it6.read())) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp1_it0.read()) &&
!(ap_sig_bdd_218.read() && esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp1_it6.read())) &&
!esl_seteq<1,1,1>(ap_const_lv1_0, exitcond9_fu_654_p2.read()) &&
!esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp1_it1.read())))) {
ap_NS_fsm = ap_ST_st14_fsm_6;
} else {
ap_NS_fsm = ap_ST_pp1_stg0_fsm_5;
}
break;
case 6 :
ap_NS_fsm = ap_ST_pp2_stg0_fsm_7;
break;
case 7 :
if ((!(esl_seteq<1,5,5>(ap_ST_pp2_stg0_fsm_7, ap_CS_fsm.read()) && esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp2_it7.read()) && !(ap_sig_bdd_251.read() && esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp2_it6.read())) && !esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp2_it6.read())) && !(esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp2_it0.read()) && !(ap_sig_bdd_251.read() && esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp2_it6.read())) && !esl_seteq<1,1,1>(ap_const_lv1_0, exitcond1_fu_702_p2.read()) && !esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp2_it1.read())))) {
ap_NS_fsm = ap_ST_pp2_stg0_fsm_7;
} else if (((esl_seteq<1,5,5>(ap_ST_pp2_stg0_fsm_7, ap_CS_fsm.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp2_it7.read()) &&
!(ap_sig_bdd_251.read() && esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp2_it6.read())) &&
!esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp2_it6.read())) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp2_it0.read()) &&
!(ap_sig_bdd_251.read() && esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp2_it6.read())) &&
!esl_seteq<1,1,1>(ap_const_lv1_0, exitcond1_fu_702_p2.read()) &&
!esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp2_it1.read())))) {
ap_NS_fsm = ap_ST_st23_fsm_8;
} else {
ap_NS_fsm = ap_ST_pp2_stg0_fsm_7;
}
break;
case 8 :
if (esl_seteq<1,1,1>(ap_const_lv1_0, exitcond6_fu_725_p2.read())) {
ap_NS_fsm = ap_ST_st24_fsm_9;
} else {
ap_NS_fsm = ap_ST_st26_fsm_11;
}
break;
case 9 :
ap_NS_fsm = ap_ST_st25_fsm_10;
break;
case 10 :
ap_NS_fsm = ap_ST_st23_fsm_8;
break;
case 11 :
ap_NS_fsm = ap_ST_st5_fsm_4;
break;
case 12 :
ap_NS_fsm = ap_ST_pp4_stg1_fsm_13;
break;
case 13 :
ap_NS_fsm = ap_ST_pp4_stg2_fsm_14;
break;
case 14 :
if (!(esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp4_it12.read()) && esl_seteq<1,5,5>(ap_ST_pp4_stg2_fsm_14, ap_CS_fsm.read()) && !esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp4_it11.read()))) {
ap_NS_fsm = ap_ST_pp4_stg0_fsm_12;
} else {
ap_NS_fsm = ap_ST_st66_fsm_15;
}
break;
case 15 :
ap_NS_fsm = ap_ST_pp5_stg0_fsm_16;
break;
case 16 :
if ((!(esl_seteq<1,5,5>(ap_ST_pp5_stg0_fsm_16, ap_CS_fsm.read()) && esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp5_it2.read()) && !(ap_sig_bdd_565.read() && esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp5_it2.read())) && !esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp5_it1.read())) && !(esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp5_it0.read()) && !(ap_sig_bdd_565.read() && esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp5_it2.read())) && !esl_seteq<1,1,1>(ap_const_lv1_0, exitcond_fu_1020_p2.read()) && !esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp5_it1.read())))) {
ap_NS_fsm = ap_ST_pp5_stg0_fsm_16;
} else if (((esl_seteq<1,5,5>(ap_ST_pp5_stg0_fsm_16, ap_CS_fsm.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp5_it2.read()) &&
!(ap_sig_bdd_565.read() && esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp5_it2.read())) &&
!esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp5_it1.read())) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp5_it0.read()) &&
!(ap_sig_bdd_565.read() && esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp5_it2.read())) &&
!esl_seteq<1,1,1>(ap_const_lv1_0, exitcond_fu_1020_p2.read()) &&
!esl_seteq<1,1,1>(ap_const_logic_1, ap_reg_ppiten_pp5_it1.read())))) {
ap_NS_fsm = ap_ST_st70_fsm_17;
} else {
ap_NS_fsm = ap_ST_pp5_stg0_fsm_16;
}
break;
case 17 :
ap_NS_fsm = ap_ST_st71_fsm_18;
break;
case 18 :
if (!esl_seteq<1,1,1>(distortion_out1ack_in.read(), ap_const_logic_0)) {
ap_NS_fsm = ap_ST_st1_fsm_0;
} else {
ap_NS_fsm = ap_ST_st71_fsm_18;
}
break;
default :
ap_NS_fsm = (sc_lv<5>) ("XXXXX");
break;
}
}
void combiner_top::thread_hdltv_gen() {
const char* dump_tv = std::getenv("AP_WRITE_TV");
if (!(dump_tv && string(dump_tv) == "on")) return;
wait();
mHdltvinHandle << "[ " << endl;
mHdltvoutHandle << "[ " << endl;
int ap_cycleNo = 0;
while (1) {
wait();
const char* mComma = ap_cycleNo == 0 ? " " : ", " ;
mHdltvinHandle << mComma << "{" << " \"ap_rst\" : \"" << ap_rst.read() << "\" ";
mHdltvinHandle << " , " << " \"ap_start\" : \"" << ap_start.read() << "\" ";
mHdltvoutHandle << mComma << "{" << " \"ap_done\" : \"" << ap_done.read() << "\" ";
mHdltvoutHandle << " , " << " \"ap_idle\" : \"" << ap_idle.read() << "\" ";
mHdltvoutHandle << " , " << " \"ap_ready\" : \"" << ap_ready.read() << "\" ";
mHdltvoutHandle << " , " << " \"master_portA_req_din\" : \"" << master_portA_req_din.read() << "\" ";
mHdltvinHandle << " , " << " \"master_portA_req_full_n\" : \"" << master_portA_req_full_n.read() << "\" ";
mHdltvoutHandle << " , " << " \"master_portA_req_write\" : \"" << master_portA_req_write.read() << "\" ";
mHdltvinHandle << " , " << " \"master_portA_rsp_empty_n\" : \"" << master_portA_rsp_empty_n.read() << "\" ";
mHdltvoutHandle << " , " << " \"master_portA_rsp_read\" : \"" << master_portA_rsp_read.read() << "\" ";
mHdltvoutHandle << " , " << " \"master_portA_address\" : \"" << master_portA_address.read() << "\" ";
mHdltvinHandle << " , " << " \"master_portA_datain\" : \"" << master_portA_datain.read() << "\" ";
mHdltvoutHandle << " , " << " \"master_portA_dataout\" : \"" << master_portA_dataout.read() << "\" ";
mHdltvoutHandle << " , " << " \"master_portA_size\" : \"" << master_portA_size.read() << "\" ";
mHdltvinHandle << " , " << " \"data_points_in_addr\" : \"" << data_points_in_addr.read() << "\" ";
mHdltvinHandle << " , " << " \"kernel_info_in_addr\" : \"" << kernel_info_in_addr.read() << "\" ";
mHdltvinHandle << " , " << " \"centres_out_addr\" : \"" << centres_out_addr.read() << "\" ";
mHdltvoutHandle << " , " << " \"distortion_out\" : \"" << distortion_out.read() << "\" ";
mHdltvinHandle << " , " << " \"n\" : \"" << n.read() << "\" ";
mHdltvinHandle << " , " << " \"k\" : \"" << k.read() << "\" ";
mHdltvinHandle << "}" << std::endl;
mHdltvoutHandle << "}" << std::endl;
ap_cycleNo++;
}
}
}
|
//
// Compiler/Platform/Platform_i386_OSX.h
//
// Brian T. Kelley <brian@briantkelley.com>
// Copyright (c) 2014 Brian T. Kelley
//
// This software is licensed as described in the file LICENSE, which you should have received as part of this distribution.
//
#ifndef COMPILER_PLATFORM_PLATFORM_I386_OSX_H
#define COMPILER_PLATFORM_PLATFORM_I386_OSX_H
#include "Compiler/Platform/IPlatform.h"
namespace Compiler { namespace Platform {
class Platform_i386_OSX : public IPlatform {
public:
std::string GetTriple() const override;
std::string GetCppFunctionSymbol(const Compiler::AST::Method& method, bool forHashTable = false) const override;
std::string GetCppVirtualTableSymbol(std::string className) const override;
};
} /* namespace Platform */ } /* namespace Compiler */
#endif // COMPILER_PLATFORM_PLATFORM_I386_OSX_H
|
#include <iostream>
#include "queue.hpp"
using namespace std;
int main() {
queue<int> q1;
if (q1.isEmpty()) {
cout << "Queue is indeed empty" << endl;
}
q1.push(1);
q1.push(2);
q1.push(3);
cout << "At the top:" << q1.peek() << endl;
cout << "Pop #1:" << q1.pop() << endl;
cout << "Pop #2:" << q1.pop() << endl;
cout << "Pop #3:" << q1.pop() << endl;
if (q1.isEmpty()) {
cout << "Queue is indeed empty" << endl;
}
q1.push(4);
q1.push(5);
cout << "At the top:" << q1.peek() << endl;
cout << "Pop #4:" << q1.pop() << endl;
cout << "Pop #5:" << q1.pop() << endl;
return 0;
}
|
#ifndef SINGLEGAME_H
#define SINGLEGAME_H
#include"Board.h"
class SingleGame:public Board
{
Q_OBJECT
public:
explicit SingleGame(QWidget *parent = 0);
~SingleGame();
int _level; //记录博弈算法的层次深度
void back();
virtual void click(int id,int row,int col);//在SingleGame子类中重载click函数
Step* getBestMove(); //函数返回当前最佳操作
void getAllPossibleMove(QVector<Step*>& steps);//利用一个数组保存所有可行策略
int getMinScore(int level, int curMin); //返回执行两步后每个分支得分最小值中的最大值
int getMaxScore(int level, int curMax); //返回执行两步后每个分支得分最大值中的最小值
int score(); //计算当前局面分
void fakeMove(Step* step); //由killStone和moveStone组成
void unfakeMove(Step* step); //将fakeMove的棋子移动回去
signals:
public slots:// 槽函数
void computerMove();
};
#endif // SINGLEGAME_H
|
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstring>
#include <fstream>
#include "Header.h"
Grid::Grid() : content(NULL)
{
setColumn(column);
setRow(row);
setContent(content);
}
void Grid::setColumn(int column)
{
this->column = column;
}
void Grid::setRow(int row)
{
this->row = row;
}
void Grid::setContent(char* content)
{
if (!content)
{
delete[] this->content;
this->content = NULL;
return;
}
delete[] this->content;
this->content = new char[strlen(content)+1];
strcpy(this->content, content);
}
Grid::Grid(const Grid& table): content(NULL)
{
setColumn(table.column);
setRow(table.row);
setContent(table.content);
}
Grid& Grid::operator=(const Grid& table)
{
if (this != &table)
{
setColumn(table.column);
setRow(table.row);
setContent(table.content);
}
return *this;
}
int Grid:: getColumn()
{
return column;
}
int Grid::getRow()
{
return row;
}
const char* Grid::getContent()
{
return content;
}
Grid::~Grid()
{
delete[] content;
}
bool Grid::checkStr(Grid cell) // this function checks if the content of the cell
// has any error in it
{ // returns false if is of uknown data
// and otherwise it returns true
int comma = 0;
int i = 0;
if (cell.getContent()[0] == '+' || cell.getContent()[0] == '-')
i++;
for (i; i < strlen(cell.getContent()); i++)
{
if ((cell.getContent()[i]<'0' || cell.getContent()[i]>'9') && cell.getContent()[0]!='='
&& cell.getContent()[i] != '.'
|| cell.getContent()[0] == '.' )
return false;
if (cell.getContent()[i] == '.')
comma++;
}
if (comma > 1)
return false;
return true;
}
void Grid::printError()
{
std::cout << "Error: row " << getRow() << ", col " << getColumn() << ", "
<< getContent() << " is unknown data type." << std::endl;
}
|
#include <algorithm>
#include <cstdio>
#include <iostream>
using namespace std;
// #define DEBUG
const int maxm = 5005;
int n, m;
struct Nainong {
int price, quantity;
Nainong() {}
};
Nainong nainong[maxm];
bool cmp(Nainong& a, Nainong& b) { return a.price < b.price; }
int main() {
#ifdef DEBUG
freopen("d:\\input.txt", "r", stdin);
freopen("d:\\output.txt", "w", stdout);
#endif
cin >> n >> m;
for (int i = 0; i < m; ++i)
cin >> nainong[i].price >> nainong[i].quantity;
sort(nainong, nainong + m, cmp);
int sum = 0, ans = 0;
for (int i = 0; i < m; ++i) {
if (sum + nainong[i].quantity >= n) {
ans += (n - sum) * nainong[i].price;
cout << ans;
return 0;
} else {
sum += nainong[i].quantity;
ans += nainong[i].quantity * nainong[i].price;
}
}
cout << ans;
return 0;
}
|
#ifndef ROSE_TRANSFORMATION_SUPPORT
#define ROSE_TRANSFORMATION_SUPPORT
// #include "transformationOptions.h"
#include "optionDeclaration.h"
// Access to Query Libraries
#include "roseQueryLib.h"
// include "nodeQuery.h"
// include "nameQuery.h"
// include "numberQuery.h"
/*! \brief This class simplifies the development of queries on the AST resulting in a
list of AST nodes.
\ingroup transformationSupportLib
This class holds functions that are generally useful for a broad cross-section of
transformations. Functionality specific to any specific transformation should be represented in
a similar transformation support class that is a part of the preprocessor source code
representing that specific transformation.
*/
class TransformationSupport
{
public:
/*! \if documentDevelopmentVersionUsingDoxygen
\brief Enum values required to classify all possible overloaded C++ operators.
Enum value supports the conversion of overloaded function names --> operator codes used to
distiguish different sorts of transformations for each catagory of overloaded function.
\internal We could not use the Cxx_GrammarVariants enum since it does
not contain a classification for operator() and operator[].
\endif
*/
enum operatorCodeType
{
//! normal function call (used as the default value)
FUNCTION_CALL_OPERATOR_CODE = 0,
// binary operators
ADD_OPERATOR_CODE = 1,
SUBT_OPERATOR_CODE = 2,
MULT_OPERATOR_CODE = 3,
DIV_OPERATOR_CODE = 4,
INTEGER_DIV_OPERATOR_CODE = 5,
MOD_OPERATOR_CODE = 6,
AND_OPERATOR_CODE = 7,
OR_OPERATOR_CODE = 8,
BITXOR_OPERATOR_CODE = 9,
BITAND_OPERATOR_CODE = 10,
BITOR_OPERATOR_CODE = 11,
EQ_OPERATOR_CODE = 12,
LT_OPERATOR_CODE = 13,
GT_OPERATOR_CODE = 14,
NE_OPERATOR_CODE = 15,
LE_OPERATOR_CODE = 16,
GE_OPERATOR_CODE = 17,
ASSIGN_OPERATOR_CODE = 18,
PLUS_ASSIGN_OPERATOR_CODE = 19,
MINUS_ASSIGN_OPERATOR_CODE = 20,
AND_ASSIGN_OPERATOR_CODE = 21,
IOR_ASSIGN_OPERATOR_CODE = 22,
MULT_ASSIGN_OPERATOR_CODE = 23,
DIV_ASSIGN_OPERATOR_CODE = 24,
MOD_ASSIGN_OPERATOR_CODE = 25,
XOR_ASSIGN_OPERATOR_CODE = 26,
// operator() and operator[]
PARENTHESIS_OPERATOR_CODE = 27,
BRACKET_OPERATOR_CODE = 28,
// unary operators
NOT_OPERATOR_CODE = 29,
DEREFERENCE_OPERATOR_CODE = 30,
ADDRESS_OPERATOR_CODE = 31,
LSHIFT_OPERATOR_CODE = 32,
RSHIFT_OPERATOR_CODE = 33,
LSHIFT_ASSIGN_OPERATOR_CODE = 34,
RSHIFT_ASSIGN_OPERATOR_CODE = 35,
PREFIX_PLUSPLUS_OPERATOR_CODE = 36,
POSTFIX_PLUSPLUS_OPERATOR_CODE = 37,
PREFIX_MINUSMINUS_OPERATOR_CODE = 38,
POSTFIX_MINUSMINUS_OPERATOR_CODE = 39,
// End of list tag
OPERATOR_CODE_LAST_TAG = 99
};
/*! \brief generates a source code string from operator name.
This function returns a string representing the elementwise operator (for primative types)
that would be match that associated with the overloaded operator for a user-defined
abstractions (e.g. identifyOperator("operator+()") returns "+").
*/
static std::string stringifyOperator (std::string name);
/*! \brief Classifies operator and returns an operatorCodeType value
(useful for switch statements).
This function is useful in switch statements to further refine the type of
function based on the function name, number of parameters, and if it is a
prefix or postfix operator. These are the minimum requirements to classify
all possible C++ overloaded functions (though usually the name is sufficient
so the additional parameters are optional).
*/
static operatorCodeType classifyOverloadedOperator (
std::string name,
int numberOfParameters = 0,
bool prefixOperator = false);
/*! \brief Return string representing operator node in AST.
This function returns a string representing the operator associated with the SgNode*
(assuming it is an SgExpression*). It calls the identifyOperator() function to convert
overloaded functions to strings.
*/
static std::string buildOperatorString ( SgNode* astNode );
//! Get the string representing the function name (should be added to Sage III interface).
static std::string getFunctionName ( SgFunctionCallExp* functionCallExp );
//! Get the string representing the type name (should be added to Sage III interface).
static std::string getTypeName ( SgType* type );
/*! \brief Similar to getFunctionName(SgNode* astNode) above, but for member functions.
For member fuinctions this returns the class name of the class for which this functon is a
member and for non-member functions this function returns the name of the class associated
with the return type (this might be done better).
*/
static std::string getFunctionTypeName ( SgFunctionCallExp* functionCallExpression );
/*! \brief wrap any string representing a macro into something that the unparser will unparse as a macro definition
This mechanism is a hack for now since it embeds a substring into a
comment which the unparser presently will recognize. This needs to
be fixed to work more cleanly.
*/
static std::string buildMacro ( std::string s );
/*! @{
\name Applications Specific Transformation Option Mechanism
\brief Supporting functions for reading transformation specifications (hints)
Preprocessors can optionally retrive hints embedded within the user's application.
The mechanism is useful to provide additional information used to make more
sophisticated optimizations than the knowledge of the semantics of abstractions
might provide. It also is a way to pass on information as a substitution for
program analysis.
*/
/*! \brief This interface permits a more general specification of options
using strings to identify the options and values to associate
with the identified option. \sa OptionDeclaration
This function is the only interface to the general mechanism that permits passing data from the user's application to a preprocessor. If this mechanism is used, the user's application is optionally annotated with declarations (which have no side-effect to the execution of the user's application) but which can be read and interpreted by a preprocessor. This function makes ...
*/
static void getTransformationOptions (
SgNode* astNode,
std::list<OptionDeclaration> & variableNameList,
std::string identifingTypeName );
/*! \if documentDevelopmentVersionUsingDoxygen
\brief Get the list\<int\> of options (if any are specified).
\deprecated This function is superceeded by the more general
form:
getTransformationOptions (SgNode* astNode,list<OptionDeclaration>&variableNameList,string identifingTypeName )
\endif
*/
static void getTransformationOptions (
SgNode* astNode,
std::list<int> & variableNameList,
std::string identifingTypeName );
/*! \if documentDevelopmentVersionUsingDoxygen
\brief Function used internally (for list\<int\> interface)
\endif
*/
static void getTransformationOptionsFromVariableDeclarationConstructorArguments (
SgVariableDeclaration* variableDeclaration,
std::list<int> & returnList );
/*! \if documentDevelopmentVersionUsingDoxygen
\brief Function used internally (used with list\<string\> version of interface)
\endif
*/
static void getTransformationOptionsFromVariableDeclarationConstructorArguments (
SgVariableDeclaration* variableDeclaration,
std::list<OptionDeclaration> & returnList );
/*! @} */
/*! \brief Builds variable declarations for all variable and types defined in subtree at astNode.
New variables and types introduced by way of a transformation need to be
defined in the application before they are used. This sort of transofrmation
can be generally automated.
\internal There may be some cases where this mechanism can be outsmarted :-).
*/
static std::string internalSupportingGlobalDeclarations( SgNode* astNode, std::string prefixString );
// DQ (9/26/03) Added here to eliminate ProjectQueryLibrary
// (which as mostly an experiment with the reverse traversal)
static SgProject* getProject( const SgNode* astNode);
static SgDirectory* getDirectory( const SgNode* astNode);
static SgFile* getFile( const SgNode* astNode);
static SgSourceFile* getSourceFile( const SgNode* astNode);
static SgBinaryComposite* getBinaryFile( const SgNode* astNode);
static SgGlobal* getGlobalScope( const SgNode* astNode);
static SgStatement* getStatement(const SgNode* astNode);
static SgFunctionDeclaration* getFunctionDeclaration( const SgNode* astNode);
static SgFunctionDefinition* getFunctionDefinition( const SgNode* astNode);
static SgClassDefinition* getClassDefinition( const SgNode* astNode);
static SgModuleStatement* getModuleStatement( const SgNode* astNode);
// DQ (5/11/2011): This function was moved to SgTemplateArgument a long time ago and is not longer available.
// DQ (6/9/2007): This function traverses through the parents to the first scope (used for name qualification support of template arguments)
// static SgScopeStatement* getScope(const SgNode* astNode);
// static SgValueExp* getValueExpr(const SgNode* astNode);
};
// endif for ROSE_TRANSFORMATION_SUPPORT
#endif
|
#include <iostream>
using namespace std;
int solution(int X, int Y, int D)
{
if(X<Y)
{
if((Y-X)%D != 0)
{
return ((Y-X)/D)+1;
}
return ((Y-X)/D);
}
return 0;
}
int main()
{
int JUMP = solution(10, 85, 30);
cout<<JUMP;
}
|
#include "ofxKuDrawRasters.h"
//--------------------------------------------------------------
void ofxKuDrawRaster(vector<unsigned char> &pix, int w, int h, float X, float Y, float W, float H, bool nearest_filter, bool rgb) {
if (pix.size() != w * h * ((rgb) ? 3 : 1) || w * h <= 0) {
cout << "ofxKuDrawRaster error, bad pix size" << endl;
return;
}
ofTexture texture;
texture.loadData(&pix[0],w,h,(rgb)?GL_RGB:GL_LUMINANCE);
if (nearest_filter) {
texture.setTextureMinMagFilter(GL_NEAREST, GL_NEAREST);
}
texture.draw(X,Y,W,H);
}
//--------------------------------------------------------------
void ofxKuDrawRaster(vector<float> &pix, int w, int h, float X, float Y, float W, float H, float val0, float val1,
bool nearest_filter) {
if (pix.size() != w*h || w*h <= 0) return;
vector<unsigned char> pix1(w*h);
for (int i=0; i<w*h; i++) {
pix1[i] = ofMap(pix[i],val0,val1,0,255,true);
}
ofxKuDrawRaster(pix1, w, h, X, Y, W, H, nearest_filter);
}
//--------------------------------------------------------------
void ofxKuOfGrayPixelsToRaster(ofPixels &pixels, vector<unsigned char> &pix, int &w, int &h) {
w = pixels.getWidth();
h = pixels.getHeight();
pix.resize(w*h);
unsigned char *data = pixels.getPixels();
for (int i=0; i<w*h; i++) {
pix[i] = data[i];
}
}
//--------------------------------------------------------------
//Sets drawing matrix for drawing aligned images, fit in a given rectangle; image can be scaled using "scale"
//"align" = 0 - center, -1 - top/left, 1 - right/bottom
//usage:
// ofPushMatrix();
// ofxKuDrawImageSetMatrixFit(...);
// tex.draw(0,0);
// ofPopMatrix();
void ofxKuDrawImageSetMatrixFit(float img_w, float img_h, ofRectangle rect_to_fit, int align_x, int align_y, float scale) {
float X = rect_to_fit.getLeft();
float Y = rect_to_fit.getTop();
float W = rect_to_fit.getWidth();
float H = rect_to_fit.getHeight();
if (W <= 0 || H <= 0 || img_w <= 0 || img_h <= 0) {
cout << "ofxKuDrawImagePushMatrixFit - empty image or negative params" << endl;
return;
}
//fit size
float scl = min(W / img_w, H / img_h) * scale;
float resw = img_w * scl;
float resh = img_h * scl;
float x = 0; //left
float y = 0; //top
if (align_x == 0) {
x = (W - resw) / 2;
}
if (align_x == 1) {
x = W - resw;
}
if (align_y == 0) {
y = (H - resh) / 2;
}
if (align_y == 1) {
y = H - resh;
}
ofTranslate(X + x, Y + y); //<------ Translating
ofScale(scl, scl);
}
//--------------------------------------------------------------
|
// Copyright 1998-2019 Epic Games, Inc. All Rights Reserved.
#pragma once
#include "CoreMinimal.h"
#include "Layout/Visibility.h"
#include "Textures/SlateIcon.h"
#include "Widgets/SWidget.h"
#include "UnrealClient.h"
#include "IDetailCustomization.h"
#include "Private/CyLandEditorDetailCustomization_Base.h"
#include "CyLandEditorDetailCustomization_ProceduralLayers.h"
#include "CyLandEditorDetailCustomization_ProceduralBrushStack.h"
class FCyLandEditorDetailCustomization_AlphaBrush;
class FCyLandEditorDetailCustomization_CopyPaste;
class FCyLandEditorDetailCustomization_MiscTools;
class FCyLandEditorDetailCustomization_NewCyLand;
class FCyLandEditorDetailCustomization_ResizeCyLand;
class FCyLandEditorDetailCustomization_TargetLayers;
class FUICommandList;
class IDetailLayoutBuilder;
class UCyLandInfo;
class FCyLandEditorDetails : public FCyLandEditorDetailCustomization_Base
{
public:
/** Makes a new instance of this detail layout class for a specific detail view requesting it */
static TSharedRef<IDetailCustomization> MakeInstance();
/** IDetailCustomization interface */
virtual void CustomizeDetails(IDetailLayoutBuilder& DetailBuilder) override;
protected:
static FText GetLocalizedName(FString Name);
static EVisibility GetTargetCyLandSelectorVisibility();
static FText GetTargetCyLandName();
static TSharedRef<SWidget> GetTargetCyLandMenu();
static void OnChangeTargetCyLand(TWeakObjectPtr<UCyLandInfo> CyLandInfo);
FText GetCurrentToolName() const;
FSlateIcon GetCurrentToolIcon() const;
TSharedRef<SWidget> GetToolSelector();
bool GetToolSelectorIsVisible() const;
EVisibility GetToolSelectorVisibility() const;
FText GetCurrentBrushName() const;
FSlateIcon GetCurrentBrushIcon() const;
TSharedRef<SWidget> GetBrushSelector();
bool GetBrushSelectorIsVisible() const;
FText GetCurrentBrushFalloffName() const;
FSlateIcon GetCurrentBrushFalloffIcon() const;
TSharedRef<SWidget> GetBrushFalloffSelector();
bool GetBrushFalloffSelectorIsVisible() const;
TSharedPtr<FUICommandList> CommandList;
TSharedPtr<FCyLandEditorDetailCustomization_NewCyLand> Customization_NewCyLand;
TSharedPtr<FCyLandEditorDetailCustomization_ResizeCyLand> Customization_ResizeCyLand;
TSharedPtr<FCyLandEditorDetailCustomization_CopyPaste> Customization_CopyPaste;
TSharedPtr<FCyLandEditorDetailCustomization_MiscTools> Customization_MiscTools;
TSharedPtr<FCyLandEditorDetailCustomization_AlphaBrush> Customization_AlphaBrush;
TSharedPtr<FCyLandEditorDetailCustomization_TargetLayers> Customization_TargetLayers;
TSharedPtr<FCyLandEditorDetailCustomization_ProceduralLayers> Customization_ProceduralLayers;
TSharedPtr<FCyLandEditorDetailCustomization_ProceduralBrushStack> Customization_ProceduralBrushStack;
};
|
#include <iostream>
#include <math.h>
#include <cmath>
using namespace std;
int main() {
int t;
cin>>t;
while(t--)
{
int r;
cin>>r;
int a[3][2];
for(int i=0;i<3;i++)
{
for(int j=0;j<2;j++)
{
cin>>a[i][j];
}
}
float dis[3];
for(int i=1;i<3;i++)
{
float g= a[i][0]-a[i-1][0], k=a[i][1]-a[i-1][1];
float v=pow(g,2) , w=pow(k,2);
dis[i] = sqrt(v+w);
}
dis[0] = sqrt(pow(a[0][0]-a[2][0],2)+pow(a[0][1]-a[2][1],2));
int count = 0;
for(int i=0;i<3;i++)
{
if(dis[i]<=r)
{
count++;
}
}
if(count>=2)
cout<<"yes"<<endl;
else
cout<<"no"<<endl;
}
return 0;
}
|
#include <iostream>
#include <string>
#include <vector>
#include <fstream>
using namespace std;
class Transport{
private:
int posNS;
int posWE;
protected:
int load;
public:
string name;
void przypisz();
void wypisz();
friend void save();
friend void open();
};
class Ladowy : public Transport{
private:
int liczbaKol;
protected:
string kolor;
public:
string name;
void przypisz();
void wypisz();
friend void save();
friend void open();
};
class Pociag : public Ladowy{
private:
int iloscWagonow;
protected:
string przewoznik;
public:
string name;
void przypisz();
void wypisz();
friend void save();
friend void open();
};
class Samochod : public Ladowy{
private:
int spalanie;
protected:
int paliwo;
public:
string name;
void przypisz();
void wypisz();
friend void save();
friend void open();
};
class Rower : public Ladowy{
private:
string marka;
protected:
string rodzajRamy;
public:
void dzwonek();
string name;
void przypisz();
void wypisz();
friend void save();
friend void open();
};
class Wodny : public Transport {
private:
string armator;
protected:
int zanurzenie;
public:
string name;
void przypisz();
void wypisz();
friend void save();
friend void open();
};
class Okret : public Wodny{
private:
string rodzaj;
protected:
int liczbaDzial;
public:
string name;
void przypisz();
void wypisz();
friend void save();
friend void open();
};
class Powietrzny : public Transport{
private:
int height;
protected:
string typ;
public:
string name;
void przypisz();
void wypisz();
friend void save();
friend void open();
};
class Smiglowiec : public Powietrzny{
private:
int liczbaSmigiel;
protected:
int obrot;
public:
string name;
void przypisz();
void wypisz();
friend void save();
friend void open();
};
class Odrzutowiec : public Powietrzny{
private:
int paliwo;
protected:
int range;
public:
string name;
void przypisz();
void wypisz();
friend void save();
friend void open();
};
/////////////////////////////////////////////////FUNKCJE///////////////////////////////////////
void Transport::przypisz(){
cout << "Podaj pozycje WE:" << endl;
cin >> posWE;
cout << "Podaj pozycje NS:" << endl;
cin >> posNS;
cout << "Podaj wartosc ladunku:" << endl;
cin >> load;
}
void Transport::wypisz(){
cout << "Aktualna pozycja obiektu: (" << posWE << "," << posNS << ") z " << load << " kg ladunku." << endl;
}
void Ladowy::przypisz(){
Transport::przypisz();
cout << "Podaj kolor pojazdu:" << endl;
cin >> kolor;
cout << "Podaj liczbe kol pojazdu: " << endl;
cin >> liczbaKol;
}
void Ladowy::wypisz(){
Transport::wypisz();
cout << "Ten pojazd jest " << kolor << endl;
cout << "Pojazd ma " << liczbaKol <<" kol"<< endl;
}
void Pociag::przypisz(){
Ladowy::przypisz();
cout << "Podaj ilosc wagonow w skladzie:" << endl;
cin >> iloscWagonow;
cout << "Podaj nazwe przewoznika:" << endl;
cin >> przewoznik;
}
void Pociag::wypisz(){
Ladowy::wypisz();
cout << "Sklad ma " << iloscWagonow << " wagonow." << endl;
cout << "Przewoz realizuje spolka. " << przewoznik << endl;
}
void Samochod::przypisz(){
Ladowy::przypisz();
cout << "Podaj spalanie:" << endl;
cin >> spalanie;
cout << "Podaj ilosc paliwa w baku:" << endl;
cin >> paliwo;
}
void Samochod::wypisz(){
Ladowy::wypisz();
cout << "Obiekt ma spalanie " << spalanie << "l/100km i " << paliwo << "l paliwa" << endl;
}
void Rower::przypisz(){
Ladowy::przypisz();
cout << "Podaj marke roweru:" << endl;
cin >> marka;
cout << "Podaj rodzaj ramy:" << endl;
cin >> rodzajRamy;
}
void Rower::wypisz(){
Ladowy::wypisz();
cout << "Marka roweru to " << marka << ". Jest to rower typu " << rodzajRamy << endl;
}
void Rower::dzwonek(){
cout << "Dzyn, Dzyn!" << endl;
}
void Wodny::przypisz(){
Transport::przypisz();
cout << "Podaj zanurzenie statku:" << endl;
cin >> zanurzenie;
cout << "Podaj nazwe armatora:" << endl;
cin >> armator;
}
void Wodny::wypisz(){
Transport::wypisz();
cout << "Zanurzenie to " << zanurzenie << "mm" << endl;
cout << "Statek nalezy do " << armator << endl;
}
void Okret::przypisz(){
Wodny::przypisz();
cout << "Podaj liczbe dzial:" << endl;
cin >> liczbaDzial;
cout << "Podaj rodzaj statku:" << endl;
cin >> rodzaj;
}
void Okret::wypisz(){
Wodny::wypisz();
cout << "Liczba dzial: " << liczbaDzial << endl;
cout << " Jest to statek typu: " << rodzaj << endl;
}
void Powietrzny::przypisz(){
Transport::przypisz();
cout << "Podaj wysokosc: " << endl;
cin >> height;
cout << "Podaj typ srodku transportu: " << endl;
cin >> typ;
}
void Powietrzny::wypisz(){
Transport::wypisz();
cout << "Pjazd znajduje sie na wysokosci: " << height <<"ft."<< endl;
cout << "Jest to: " << typ << endl;
}
void Smiglowiec::przypisz(){
Powietrzny::przypisz();
cout << "Podaj obrot o kat:" << endl;
cin >> obrot;
cout << "Podaj liczbe smigiel:" << endl;
cin >> liczbaSmigiel;
}
void Smiglowiec::wypisz(){
Powietrzny::wypisz();
cout << "Obrocono o kat " << obrot <<"deg." << endl;
cout << "Ten smiglowiec ma " << liczbaSmigiel << " smigiel" << endl;
}
void Odrzutowiec::przypisz(){
Powietrzny::przypisz();
cout << "Podaj zasieg odrzutowca:" << endl;
cin >> range;
cout << "Podaj ilosc paliwa w zbiornikach:" << endl;
cin >> paliwo;
}
void Odrzutowiec::wypisz(){
Powietrzny::wypisz();
cout << "Zasieg samolotu to " << range <<" mil."<< endl;
cout << "Mamy " << paliwo << " ton paliwa" << endl;
}
/////////////////////////////////////////////WEKTORY I LICZNIKI///////////////////////////////
int counterJet = 0,
counterHelicopter = 0,
counterCar = 0,
counterSailingShip = 0,
counterBike = 0,
counterTrain = 0;
string currentNode = "Transport";
vector <Odrzutowiec> jet;
vector <Smiglowiec> helicopter;
vector <Pociag> train;
vector <Samochod> car;
vector <Rower> bike;
vector <Okret> ship;
///////////////////////////////////////////////OBSLUGA/////////////////////////////////////////////////
/**
*Pomocnicza, sprawdza czy dana klasa istnieje
*/
bool isNode(string node){
bool tmp;
string nodeName[] =
{ "Odrzutowiec", "Smiglowiec", "Okret", "Samochod",
"Rower", "Pociag", "Transport", "Wodny", "Ladowy", "Powietrzny" };
int counter = 0;
for (int i = 0; i < 10; i++){
if (node == nodeName[i]){
tmp = true;
}
else{
counter++;
}
}
if (counter == 10){
tmp = false;
}
return tmp;
}
/**
*Pomocnicza, sprawdza czy dana klasa jest lisciem
*/
bool isLeaf(string leaf){
bool tmp;
string leafName[] =
{ "Odrzutowiec", "Smiglowiec", "Okret", "Samochod",
"Rower", "Pociag" };
int counter = 0;
for (int i = 0; i < 6; i++){
if (leaf == leafName[i]){
tmp = true;
}
else{
counter++;
}
}
if (counter == 6){
tmp = false;
}
return tmp;
}
/**
*Przechodzi do wybranego wezla
*/
void changeNode(string target){
if (isNode(target)){
if (target == currentNode){
cout << "Jestes juz w tym wezle." << endl;
cout << "Jestes teraz w wezle: " << currentNode << endl;
}
else{
currentNode = target;
cout << "Jestes teraz w wezle: " << currentNode << endl;
}
}
else{
cout << "Nie ma takiej klasy!" << endl;
}
}
/**
*Przechodzi do wybranego liscia
*/
void goToLeaf(string target){
do{
if (isLeaf(target)){
if (target == currentNode){
cout << "Jestes juz w tym lisciu." << endl;
cout << "Jestes teraz w lisciu: " << currentNode << endl;
}
else{
currentNode = target;
cout << "Jestes teraz w lisciu: " << currentNode << endl;
}
}
else{
cout << "Nie ma takiego liscia!" << endl;
}
} while (false);
}
/**
*Zapisuje obiekty do pliku
*/
void save(){
ofstream saved;
saved.open("obj.txt");
unsigned int i;
for (i = 0; i<jet.size(); i++){
saved << "Odrzutowiec" << endl;
saved << jet[i].name << endl;
saved << jet[i].posNS << endl;
saved << jet[i].posWE << endl;
saved << jet[i].load << endl;
saved << jet[i].height << endl;
saved << jet[i].range << endl;
saved << jet[i].paliwo << endl;
saved << jet[i].typ << endl;
}
for (i = 0; i<helicopter.size(); i++){
saved << "Smiglowiec" << endl;
saved << helicopter[i].name << endl;
saved << helicopter[i].posNS << endl;
saved << helicopter[i].posWE << endl;
saved << helicopter[i].load << endl;
saved << helicopter[i].height << endl;
saved << helicopter[i].obrot << endl;
saved << helicopter[i].typ << endl;
saved << helicopter[i].liczbaSmigiel << endl;
}
for (i = 0; i<car.size(); i++){
saved << "Samochod" << endl;
saved << car[i].name << endl;
saved << car[i].posNS << endl;
saved << car[i].posWE << endl;
saved << car[i].load << endl;
saved << car[i].kolor << endl;
saved << car[i].paliwo << endl;
saved << car[i].spalanie << endl;
saved << car[i].liczbaKol << endl;
}
for (i = 0; i<bike.size(); i++){
saved << "Rower" << endl;
saved << bike[i].name << endl;
saved << bike[i].posNS << endl;
saved << bike[i].posWE << endl;
saved << bike[i].load << endl;
saved << bike[i].kolor << endl;
saved << bike[i].marka << endl;
saved << bike[i].rodzajRamy << endl;
saved << bike[i].liczbaKol << endl;
}
for (i = 0; i<train.size(); i++){
saved << "Pociag" << endl;
saved << train[i].name << endl;
saved << train[i].posNS << endl;
saved << train[i].posWE << endl;
saved << train[i].load << endl;
saved << train[i].kolor << endl;
saved << train[i].iloscWagonow << endl;
saved << train[i].liczbaKol << endl;
saved << train[i].przewoznik << endl;
}
for (i = 0; i<ship.size(); i++){
saved << "Okret" << endl;
saved << ship[i].name << endl;
saved << ship[i].posWE << endl;
saved << ship[i].posNS << endl;
saved << ship[i].load << endl;
saved << ship[i].zanurzenie << endl;
saved << ship[i].liczbaDzial << endl;
saved << ship[i].armator << endl;
saved << ship[i].rodzaj << endl;
}
}
/**
*Wczytuje obiekty z pliku
*/
void open(){
string label;
ifstream opened;
opened.open("obj.txt");
while (opened >> label){
if (label == "Odrzutowiec"){
Odrzutowiec *pJet = new Odrzutowiec();
jet.push_back(*pJet);
opened >> jet[counterJet].name;
opened >> jet[counterJet].posNS;
opened >> jet[counterJet].posWE;
opened >> jet[counterJet].load;
opened >> jet[counterJet].height;
opened >> jet[counterJet].range;
opened >> jet[counterJet].paliwo;
opened >> jet[counterJet].typ;
counterJet++;
}
else if (label == "Smiglowiec"){
Smiglowiec *pHeli = new Smiglowiec();
helicopter.push_back(*pHeli);
opened >> helicopter[counterHelicopter].name;
opened >> helicopter[counterHelicopter].posNS;
opened >> helicopter[counterHelicopter].posWE;
opened >> helicopter[counterHelicopter].load;
opened >> helicopter[counterHelicopter].height;
opened >> helicopter[counterHelicopter].obrot;
opened >> helicopter[counterHelicopter].typ;
opened >> helicopter[counterHelicopter].liczbaSmigiel;
counterHelicopter++;
}
else if (label == "Samochod"){
Samochod *pCar = new Samochod();
car.push_back(*pCar);
opened >> car[counterCar].name;
opened >> car[counterCar].posNS;
opened >> car[counterCar].posWE;
opened >> car[counterCar].load;
opened >> car[counterCar].kolor;
opened >> car[counterCar].paliwo;
opened >> car[counterCar].spalanie;
opened >> car[counterCar].liczbaKol;
counterCar++;
}
else if (label == "Rower"){
Rower *pBike = new Rower();
bike.push_back(*pBike);
opened >> bike[counterBike].name;
opened >> bike[counterBike].posNS;
opened >> bike[counterBike].posWE;
opened >> bike[counterBike].load;
opened >> bike[counterBike].kolor;
opened >> bike[counterBike].marka;
opened >> bike[counterBike].rodzajRamy;
opened >> bike[counterBike].liczbaKol;
counterBike++;
}
else if (label == "Pociag"){
Pociag *pTrain = new Pociag();
train.push_back(*pTrain);
opened >> train[counterTrain].name;
opened >> train[counterTrain].posNS;
opened >> train[counterTrain].posWE;
opened >> train[counterTrain].load;
opened >> train[counterTrain].kolor;
opened >> train[counterTrain].iloscWagonow;
opened >> train[counterTrain].liczbaKol;
opened >> train[counterTrain].przewoznik;
counterTrain++;
}
else if (label == "Okret"){
Okret *pShip = new Okret();
ship.push_back(*pShip);
opened >> ship[counterSailingShip].name;
opened >> ship[counterSailingShip].posWE;
opened >> ship[counterSailingShip].posNS;
opened >> ship[counterSailingShip].load;
opened >> ship[counterSailingShip].zanurzenie;
opened >> ship[counterSailingShip].liczbaDzial;
opened >> ship[counterSailingShip].armator;
opened >> ship[counterSailingShip].rodzaj;
counterSailingShip++;
}
}
}
/**
*Tworzy nowy obiekt
*/
void createObject(string objectName){
bool isCreated = false;
string leaf;
do{
if (isLeaf(currentNode)){
if (currentNode == "Odrzutowiec"){
Odrzutowiec* pointerJet = new Odrzutowiec();
jet.push_back(*pointerJet);
jet[counterJet].Odrzutowiec::przypisz();
jet[counterJet].name = objectName;
counterJet++;
isCreated = true;
}
else if (currentNode == "Smiglowiec"){
Smiglowiec* pointerHeli = new Smiglowiec();
helicopter.push_back(*pointerHeli);
helicopter[counterHelicopter].Smiglowiec::przypisz();
helicopter[counterHelicopter].name = objectName;
counterHelicopter++;
isCreated = true;
}
else if (currentNode == "Samochod"){
Samochod* pointerCar = new Samochod();
car.push_back(*pointerCar);
car[counterHelicopter].Samochod::przypisz();
car[counterCar].name = objectName;
counterCar++;
isCreated = true;
}
else if (currentNode == "Rower"){
Rower* pointerBike = new Rower();
bike.push_back(*pointerBike);
bike[counterBike].Rower::przypisz();
bike[counterBike].name = objectName;
counterBike++;
isCreated = true;
}
else if (currentNode == "Pociag"){
Pociag* pointerTrain = new Pociag();
train.push_back(*pointerTrain);
train[counterTrain].Pociag::przypisz();
train[counterTrain].name = objectName;
counterTrain++;
isCreated = true;
}
else if (currentNode == "Okret"){
Okret* pointerShip = new Okret();
ship.push_back(*pointerShip);
ship[counterSailingShip].Okret::przypisz();
ship[counterSailingShip].name = objectName;
counterSailingShip++;
isCreated = true;
}
}
else{
cout << "Zeby dodac obiekt liscia musisz byc w lisciu" << endl;
cout << "Do jakiego liscia chcesz sie udac?" << endl;
cin >> leaf;
goToLeaf(leaf);
}
cout << "Utworzono obiekt '" << objectName << "'" << endl;
} while (isCreated == false);
}
/**
*Usuwa obiekt
*/
void deleteObject(string objectName){
bool isDeleted = false;
bool found = false;
string leaf;
do{
if (isLeaf(currentNode)){
if (currentNode == "Odrzutowiec"){
for (unsigned int i = 0; i < jet.size(); i++){
if (objectName == jet[i].name){
jet[jet.size() - 1] = jet[i];
jet.pop_back();
counterJet--;
found = true;
isDeleted = true;
}
}
}
else if (currentNode == "Smiglowiec"){
for (unsigned int i = 0; i < helicopter.size(); i++){
if (objectName == helicopter[i].name){
helicopter[helicopter.size() - 1] = helicopter[i];
helicopter.pop_back();
counterHelicopter--;
found = true;
isDeleted = true;
}
}
}
else if (currentNode == "Okret"){
for (unsigned int i = 0; i < ship.size(); i++){
if (objectName == ship[i].name){
ship[ship.size() - 1] = ship[i];
ship.pop_back();
counterSailingShip--;
found = true;
isDeleted = true;
}
}
}
else if (currentNode == "Samochod"){
for (unsigned int i = 0; i < car.size(); i++){
if (objectName == car[i].name){
car[car.size() - 1] = car[i];
car.pop_back();
counterCar--;
found = true;
isDeleted = true;
}
}
}
else if (currentNode == "Rower"){
for (unsigned int i = 0; i < bike.size(); i++){
if (objectName == bike[i].name){
bike[bike.size() - 1] = bike[i];
bike.pop_back();
counterBike--;
found = true;
isDeleted = true;
}
}
}
else if (currentNode == "Pociag"){
for (unsigned int i = 0; i < train.size(); i++){
if (objectName == train[i].name){
train[train.size() - 1] = train[i];
train.pop_back();
counterTrain--;
found = true;
isDeleted = true;
}
}
}
}
else{
cout << "Zeby usunac obiekt liscia musisz byc w lisciu" << endl;
cout << "Do jakiego liscia chcesz sie udac?" << endl;
cin >> leaf;
goToLeaf(leaf);
}
if (found == false){
cout << "Nie ma takiego obiektu!" << endl;
isDeleted = true;
}
cout << "Usunieto obiekt '" << objectName << "'" << endl;
} while (isDeleted == false);
}
/**
*Pokazuje strukture klas
*/
void tree(){
cout << " -----> Odrzutowiec(" << counterJet << ")" << endl;
cout << " |" << endl;
cout << " ----------> Powietrzny |" << endl;
cout << " | | " << endl;
cout << " | -----> Smiglowiec(" << counterHelicopter << ")" << endl;
cout << " |" << endl;
cout << "Transport ----------> Wodny |--------> Okret(" << counterSailingShip << ")" << endl;
cout << " |" << endl;
cout << " | ---------> Rower(" << counterBike << ")" << endl;
cout << " | |" << endl;
cout << " ----------> Ladowy |--------> Samochod(" << counterCar << ")" << endl;
cout << " |" << endl;
cout << " ---------> Pociag(" << counterTrain << ")" << endl;
}
/**
*Pokazuje informacje o wybranym obiekcie
*/
void showObjectInfo(string objectName){
int counter = 0;
bool found = false;
string leaf;
unsigned int i;
do{
if (isLeaf(currentNode)){
if (currentNode == "Odrzutowiec"&&jet.empty() != true){
for (i = 0; i<jet.size(); i++){
if (objectName == jet[i].name)
jet[i].Odrzutowiec::wypisz();
found = true;
}
}
else if (currentNode == "Smiglowiec"&&helicopter.empty() != true){
for (i = 0; i<helicopter.size(); i++){
if (objectName == helicopter[i].name)
helicopter[i].Smiglowiec::wypisz();
found = true;
}
}
else if (currentNode == "Samochod"&&car.empty() != true){
for (i = 0; i<car.size(); i++){
if (objectName == car[i].name)
car[i].Samochod::wypisz();
found = true;
}
}
else if (currentNode == "Rower"&&bike.empty() != true){
for (i = 0; i<bike.size(); i++){
if (objectName == bike[i].name)
bike[i].Rower::wypisz();
found = true;
}
}
else if (currentNode == "Pociag"&&train.empty() != true){
for (i = 0; i<train.size(); i++){
if (objectName == train[i].name)
train[i].Pociag::wypisz();
found = true;
}
}
else if (currentNode == "Okret"&&ship.empty() != true){
for (i = 0; i<ship.size(); i++){
if (objectName == ship[i].name)
ship[i].Okret::wypisz();
found = true;
}
}
else{
cout << "W wybranym lisciu nie ma obiektu o nazwie '" << objectName << "'." << endl;
found = true;
}
}
else{
cout << "Informacje o obiekcie mozna przegladac tylko bedac w lisciu.\n Do jakiego liscia chcesz sie udac?" << endl;
cin >> leaf;
goToLeaf(leaf);
}
counter++;
} while (found == false);
}
/**
*Modyfikuje wybrany obiekt
*/
void modifyObject(string objectName){
int counter = 0;
bool found = false;
unsigned int i;
string leaf;
do{
if (isLeaf(currentNode)){
if (currentNode == "Odrzutowiec"&&jet.empty() != true){
for (i = 0; i<jet.size(); i++){
if (objectName == jet[i].name){
cout << "Modyfikujesz obiekt '" << objectName << "'." << endl;
jet[i].Odrzutowiec::przypisz();
cout << "Zmodyfikowano obiekt '" << objectName << "'." << endl;
found = true;
}
}
}
else if (currentNode == "Smiglowiec"&&helicopter.empty() != true){
for (i = 0; i<helicopter.size(); i++){
if (objectName == helicopter[i].name){
cout << "Modyfikujesz obiekt '" << objectName << "'." << endl;
helicopter[i].Smiglowiec::przypisz();
found = true;
cout << "Zmodyfikowano obiekt '" << objectName << "'." << endl;
}
}
}
else if (currentNode == "Samochod"&&car.empty() != true){
for (i = 0; i<car.size(); i++){
if (objectName == car[i].name){
cout << "Modyfikujesz obiekt '" << objectName << "'." << endl;
car[i].Samochod::przypisz();
found = true;
cout << "Zmodyfikowano obiekt '" << objectName << "'." << endl;
}
}
}
else if (currentNode == "Rower"&&bike.empty() != true){
for (i = 0; i<bike.size(); i++){
if (objectName == bike[i].name)
cout << "Modyfikujesz obiekt '" << objectName << "'." << endl;
bike[i].Rower::przypisz();
found = true;
}
}
else if (currentNode == "Pociag"&&train.empty() != true){
for (i = 0; i<train.size(); i++){
if (objectName == train[i].name){
cout << "Modyfikujesz obiekt '" << objectName << "'." << endl;
train[i].Pociag::przypisz();
found = true;
cout << "Zmodyfikowano obiekt '" << objectName << "'." << endl;
}
}
}
else if (currentNode == "Okret"&&ship.empty() != true){
for (i = 0; i<ship.size(); i++){
if (objectName == ship[i].name){
cout << "Modyfikujesz obiekt '" << objectName << "'." << endl;
ship[i].Okret::przypisz();
found = true;
cout << "Zmodyfikowano obiekt '" << objectName << "'." << endl;
}
}
}
else{
cout << "W wybranym lisciu nie ma obiektu o nazwie '" << objectName << "'." << endl;
found = true;
}
}
else{
cout << "Obiekty mozna modyfikowac tylko z liscia. \nDo jakiego liscia chcesz sie udac?" << endl;
cin >> leaf;
goToLeaf(leaf);
}
counter++;
} while (found == false);
}
/**
*Wypisuje obiekty lisci wychodzacych z wezla
*/
void directory(){
unsigned int i;
if (currentNode == "Transport"){
for (i = 0; i<jet.size(); i++) cout << jet[i].name << endl;
for (i = 0; i<helicopter.size(); i++) cout << helicopter[i].name << endl;
for (i = 0; i<car.size(); i++) cout << car[i].name << endl;
for (i = 0; i<bike.size(); i++) cout << bike[i].name << endl;
for (i = 0; i<train.size(); i++) cout << train[i].name << endl;
for (i = 0; i<ship.size(); i++) cout << ship[i].name << endl;
}
else if (currentNode == "Wodny" || currentNode == "Okret"){
for (i = 0; i<ship.size(); i++) cout << ship[i].name << endl;
}
else if (currentNode == "Powietrzny"){
for (i = 0; i<jet.size(); i++) cout << jet[i].name << endl;
for (i = 0; i<helicopter.size(); i++) cout << helicopter[i].name << endl;
}
else if (currentNode == "Ladowy"){
for (i = 0; i<car.size(); i++) cout << car[i].name << endl;
for (i = 0; i<bike.size(); i++) cout << bike[i].name << endl;
for (i = 0; i<train.size(); i++) cout << train[i].name << endl;
}
else if (currentNode == "Smiglowiec"){
for (i = 0; i<helicopter.size(); i++) cout << helicopter[i].name << endl;
}
else if (currentNode == "Odrzutowiec"){
for (i = 0; i<helicopter.size(); i++) cout << helicopter[i].name << endl;
}
else if (currentNode == "Samochod"){
for (i = 0; i<car.size(); i++) cout << car[i].name << endl;
}
else if (currentNode == "Rower"){
for (i = 0; i<bike.size(); i++) cout << bike[i].name << endl;
}
else if (currentNode == "Pociag"){
for (i = 0; i<train.size(); i++) cout << train[i].name << endl;
}
}
/**
*Pobiera komende z konsoli, rozbija ja na czesci pierwsze, tj,
*na argument i polecenie. dodatlkowo obs³uguje zdarzenia w programie
*/
int validation(string command){
int charCounter1 = 0;
int charCounter2 = 0;
int validate;
for (unsigned int a = 0; a < command.length(); a++){
if (command.at(a) == '['){
charCounter1++;
}
else if (command.at(a) == ']'){
charCounter2++;
}
}
if (charCounter1 == 1 && charCounter2 == 1){
validate = 1;
}
else if (charCounter1 == 0 && charCounter2 == 0){
validate = 2;
}
else{
validate = 0;
}
return validate;
}
/**
*Stprawdza czy komenda przyjmuje parametr
*/
int isParam(string com){
string valid[] = { "DO", "MO", "DIR", "CD", "MOD", "HELP", "SHOW", "TREE", "SAVE", "READ", "EXIT" };
string parametred[] = { "DO", "MO", "CD", "MOD", "SHOW" };
string nonParametred[] = { "HELP", "DIR", "TREE", "SAVE", "READ", "EXIT" };
int p1 = 0, p2 = 0, p3 = 0;
int ret;
for (int i = 0; i < 10; i++){
if (com == valid[i]){
for (int a = 0; a<6; a++){
if (com == parametred[a]){
p1++;
}
else{
if (com == nonParametred[a]){
p2++;
}
}
}
}
else{
p3++;
}
}
if (p1 == 1){
ret = 1;
}
else if (p2 == 1){
ret = 2;
}
else if (p2 == 0 && p1 == 0){
ret = 3;
}
return ret;
}
/**
*Obsluga komend
*/
void commands(string command){
string parametred[] = { "DO", "MO", "SHOW", "CD", "MOD" };
string nonParametred[] = { "HELP", "TREE", "SAVE", "READ", "EXIT", "DIR" };
string com;
int pos1;
if (validation(command) == 1){
pos1 = command.find_first_of('['),
com = command.substr(0, pos1);
int pos2 = command.find_first_of(']');
string param = command.substr(pos1, pos2);
param = param.substr(param.find_first_of('[') + 1, param.find_first_of(']') - 1);
if (isParam(com) == 1){
if (com == "DO"){
deleteObject(param);
}
else if (com == "MO"){
createObject(param);
}
else if (com == "CD"){
changeNode(param);
}
else if (com == "MOD"){
modifyObject(param);
}
else if (com == "SHOW"){
showObjectInfo(param);
}
}
else if ((isParam(com) == 1) == false || param == ""){
cout << "Zle sformulowana komenda" << endl;
cout << "Wpisz HELP, zeby przejzec dostepne komendy" << endl;
}
}
else if (validation(command) == 2){
com = command;
if (isParam(com) == 2){
if (com == "HELP"){
cout << "DO[] MO[] DIR CD[] MOD[] HELP SHOW[] TREE SAVE READ EXIT" << endl;
}
else if (com == "TREE"){
tree();
}
else if (com == "SAVE"){
save();
}
else if (com == "READ"){
open();
}
else if (com == "DIR"){
directory();
}
else if (com == "EXIT"){
}
}
else{
cout << "Zle sformuowana komenda" << endl;
cout << "Wpisz HELP, zeby przejzec dostepne komendy" << endl;
}
}
else if (validation(command) == 3){
cout << "Zle sformuowana komenda" << endl;
cout << "Wpisz HELP, zeby przejzec dostepne komendy" << endl;
}
else{
}
}
///////////////////////////////////////////////MAIN///////////////////////////////////////////////////
int main()
{
string command;
cout << "Wpisz HELP, zeby przejzec dostepne komendy" << endl;
while (1){
cout << "Wprowadz komende:" << endl;
cin >> command;
if (command == "EXIT"){
break;
}
else{
commands(command);
}
}
return 0;
}
|
#ifndef FULLSCREENWIDGET_H
#define FULLSCREENWIDGET_H
#include <QWidget>
#include <QtGui>
#include <QtCore>
#include <QKeyEvent>
#include "experiment.h"
namespace Ui {
class FullScreenWidget;
}
class FullScreenWidget : public QWidget
{
Q_OBJECT
public:
explicit FullScreenWidget(QWidget *parent = 0);
~FullScreenWidget();
void setLinesThickness(qreal lineThickness);
void setLinesWhite();
void setLinesBlue();
void setLinesRed();
void setLinesBlack();
void setLeftLineBlue();
void setRightLineBlue();
void setLeftLine(qreal x1, qreal y1, qreal x2, qreal y2);
void setRightLine(qreal x1, qreal y1, qreal x2, qreal y2);
private:
Ui::FullScreenWidget *ui;
QPen m_leftPen;
QPen m_rightPen;
QLineF m_leftLine;
QLineF m_rightLine;
protected:
//Event Handlers
void paintEvent(QPaintEvent *e);
void keyPressEvent(QKeyEvent *e);
void closeEvent ( QCloseEvent * e);
signals:
void fullscreenClosed();
void leftBtnPushed();
void rightBtnPushed();
void upBtnPushed();
};
#endif // FULLSCREENWIDGET_H
|
// =============================================================================
// Copyright 2012.
// Scott Alexander Holm.
// All Rights Reserved.
// =============================================================================
#include "confederateplayer.h"
#include "computerplayer.h"
ConfederatePlayer::ConfederatePlayer (Player *p) {
strcpy(name, "CONFEDERATE PLAYER");
num_cards = p->getNumCards();
points = p->getPoints();
}
ConfederatePlayer::ConfederatePlayer (short unsigned int new_points,
short unsigned int cards) {
strcpy(name, "CRIB TEST PLAYER");
num_cards = cards;
points = new_points;
}
bool ConfederatePlayer::hasPlayRankOrLess( short unsigned int bound) {
// get rid of compiler warning
bound;
// if we have at least one card then we'll have a confederate card
// to play less than bound
return (num_cards > 0);
}
short int ConfederatePlayer::getNumCards () const {
return num_cards;
}
// methods
Card ConfederatePlayer::playCard (short unsigned int count, Card *played,
short int played_index, Player *opponent, bool opponents_go,
short int current_player_points_seed,
short int opponent_player_points_seed) {
// trivial use of unused parameters
//played[0];
//played_index;
//*opponent;
// reduce the number of cards we can have since we'll play a card in
// this method
num_cards--;
// create new array to pass to new play object
Player *p[2];
// new card to play
Card test_c;
// card to return
Card c;
// keep higest point value returned. start with -infinity
short int highest_return = -GAME_HOLE;
// the return from the last card played
short int current_return;
// iterate through 0-12 card values (A-K of diamonds)
for (int i=0; i < 13; i++) {
// set the face of card
test_c.setFace(i);
// if the play rank of the card exceeds the bound then stop iterating
// through possible cards
if (test_c.getPlayRank() + count > MAX_PLAY_COUNT) {
// bring the face down to the last card in bound
test_c.setFace(i-1);
break;
}
// new players
p[0] = new ConfederatePlayer(this);
p[1] = new ComputerPlayer();
//*p[0] = *this;
*p[1] = *opponent;
//cout << *p[1] << " HAND: " << p[1]->getHand() << "\n";
ConfederatePlay confederateplay(p, count, played, played_index,
opponents_go,
current_player_points_seed,
opponent_player_points_seed);
// play a card
current_return =
confederateplay.playCard(
test_c);
// check for highest return
if (current_return > highest_return) {
c = test_c;
highest_return = current_return;
}
// delete this line
//confederateplay.announcePlay();
// flip the turn
//confederateplay.endTurn();
// iterate through the rest of play
//confederateplay.playSet();
//cout << "card number " << i << "\n";
//cout << "Card to Play " << choices[i] << "\n";
//cout << "Card earns " << confederateplay.playCard(choices[i]) << "\n";
// ponts_earned_over_oppenent = Game(players card)
// if point_earned_over_opponent > highest_so_far_points_earned_over_opp
// then c = players card
// clean up the temp workspace
delete p[0];
delete p[1];
}
//return addDiscard(removeRandomCardWithPlayRankOrLess(MAX_PLAY_COUNT-count));
//for (int i = 0; i <= played_index; i++) {
// cout << "Played " << played[i] << "\n";
//}
//cout << "COUNT = " << count << "\n";
//cout << " --------------------------- \n";
if (c.getFace() < 0) {
//c = test_c;
cout << "FATAL ERROR!!!! ABORT!!!! NEGATIVE FACE VALUE!!!!\n";
cout << "AHHHHHHHHHHHHHHHHHHHHHHHHHHH!!!!\n";
cout << "COUNT = " << count << "\n";
for (int i = 0; i <= played_index; i++) {
cout << "Played " << played[i] << "\n";
}
cout << "CARD TO PLAY = " << c << "\n";
cout << "CURRENT RETURN = " << current_return << "\n";
cout << "HIGHEST RETURN = " << highest_return << "\n";
}
return c;
}
|
#pragma once
#include "VertexBuffer.h"
#include "NonCopyable.h"
#include "glm/glm.hpp"
struct VertexArray : private NonCopyable
{
VertexArray();
~VertexArray();
VertexArray(VertexArray&&) noexcept;
VertexArray& operator=(VertexArray&&) noexcept;
void reset();
void attachTransparentVBO();
void attachOpaqueVBO();
void bindOpaqueVAO() const;
void bindTransparentVAO() const;
VertexBuffer m_opaqueVertexBuffer;
VertexBuffer m_transparentVertexBuffer;
unsigned int m_opaqueID;
unsigned int m_transparentID;
private:
void onDestroy();
};
|
/// @file GbmBddEngineOneHot.cc
/// @brief GbmBddEngineOneHot の実装ファイル
/// @author Yusuke Matsunaga (松永 裕介)
///
/// Copyright (C) 2014 Yusuke Matsunaga
/// All rights reserved.
#include "GbmBddEngineOneHot.h"
#include "YmLogic/BddLitSet.h"
BEGIN_NAMESPACE_YM
//////////////////////////////////////////////////////////////////////
// クラス GbmBddEngineOneHot
//////////////////////////////////////////////////////////////////////
// @brief コンストラクタ
// @param[in] mgr BddMgr
GbmBddEngineOneHot::GbmBddEngineOneHot(BddMgr& mgr) :
mMgr(mgr),
mDebug(false)
{
}
// @brief デストラクタ
GbmBddEngineOneHot::~GbmBddEngineOneHot()
{
}
// @brief debug フラグを立てる
void
GbmBddEngineOneHot::debug_on()
{
mDebug = true;
}
// @brief debug フラグを降ろす
void
GbmBddEngineOneHot::debug_off()
{
mDebug = false;
}
// @brief debug フラグの値を得る.
bool
GbmBddEngineOneHot::debug() const
{
return mDebug;
}
// @brief 対称性を考慮して初期解を作る.
// @param[in] rep 関数の対称変数の代表番号を収める配列
void
GbmBddEngineOneHot::init_vars(const RcfNetwork& network,
const vector<ymuint>& rep)
{
ymuint nc = network.conf_var_num();
mConfVarArray.clear();
mConfVarArray.resize(nc);
mInputNum = network.input_num();
mIorderVarArray.clear();
mIorderVarArray.resize(mInputNum * mInputNum);
// 最初に入力順を表す変数を確保する.
for (ymuint i = 0; i < mInputNum; ++ i) {
for (ymuint j = 0; j < mInputNum; ++ j) {
VarId vid(i * mInputNum + j);
mIorderVarArray[i * mInputNum + j] = vid;
bool stat = mMgr.new_var(vid);
ASSERT_COND( stat );
}
}
// 次に configuration bit 用の変数を確保する.
ymuint base = mInputNum * mInputNum;
for (ymuint i = 0; i < mConfVarArray.size(); ++ i) {
VarId vid(base + i);
mConfVarArray[i] = vid;
bool stat = mMgr.new_var(vid);
ASSERT_COND( stat );
}
// one-hot 制約と対称性を考慮して初期解を作る.
ymuint var_list = 0U;
for (ymuint i = 0; i < mInputNum; ++ i) {
var_list |= (1U << i);
}
ymuint ni_exp = 1U << mInputNum;
mIorderBddArray.clear();
mIorderBddArray.resize(ni_exp, mMgr.make_zero());
mIorderBddArray[0] = mMgr.make_one();
mSolution = make_iorder_bdd(0, var_list, network);
if ( debug() ) {
mpz_class mc = mSolution.minterm_count(nc);
cout << "Total " << mc << " permutations" << endl;
mSolution.print(cout);
}
}
// @brief 入力値を割り当てて解の候補を求める.
// @param[in] network 対象の LUT ネットワーク
// @param[in] bit_pat 外部入力の割り当てを表すビットパタン
// @param[in] oid 出力のノード番号
// @param[in] oval 出力の値
// @return 結果が空でなければ true を返し,model にその1つを収める.
Bool3
GbmBddEngineOneHot::make_bdd(const RcfNetwork& network,
ymuint bitpat,
bool oval)
{
ymuint nn = network.node_num();
mNodeBddArray.clear();
mNodeBddArray.resize(nn);
for (ymuint i = 0; i < mInputNum; ++ i) {
const RcfNode* node = network.input_node(i);
ymuint id = node->id();
Bdd y = mMgr.make_zero();
for (ymuint j = 0; j < mInputNum; ++ j) {
if ( bitpat & (1U << j) ) {
VarId vid_j = mIorderVarArray[i * mInputNum + j];
Bdd x1 = mMgr.make_posiliteral(vid_j);
y |= x1;
}
}
mNodeBddArray[id] = y;
}
// 外部出力のノード番号と極性
RcfNodeHandle output = network.output();
ymuint oid = output.id();
bool oinv = output.inv();
if ( oinv ) {
oval = !oval;
}
ymuint nf = network.func_node_num();
for (ymuint i = 0; i < nf; ++ i) {
const RcfNode* node = network.func_node(i);
make_node_func(node);
}
if ( oval ) {
mSolution &= mNodeBddArray[oid];
}
else {
mSolution &= ~mNodeBddArray[oid];
}
if ( mSolution.is_zero() ) {
return kB3False;
}
if ( mSolution.is_invalid() ) {
return kB3X;
}
return kB3True;
}
// @brief 結果からモデルを一つ取り出す.
void
GbmBddEngineOneHot::get_model(vector<Bool3>& model)
{
ASSERT_COND( !mSolution.is_invalid() );
if ( mSolution.is_zero() ) {
return;
}
ymuint nall = mConfVarArray.size() + mIorderVarArray.size();
model.clear();
model.resize(nall, kB3X);
BddLitSet opath = mSolution.onepath();
LiteralVector lv;
opath.to_vector(lv);
for (LiteralVector::iterator p = lv.begin();
p != lv.end(); ++ p) {
Literal l = *p;
if ( l.is_positive() ) {
model[l.varid().val()] = kB3True;
}
else {
model[l.varid().val()] = kB3False;
}
}
}
// @brief SAT モデルから設定変数の割り当てを取り出す.
// @param[in] model SAT モデル
// @param[out] conf_bits 設定変数の割り当て
void
GbmBddEngineOneHot::get_conf_bits(const vector<Bool3>& model,
vector<bool>& conf_bits) const
{
ymuint nc = mConfVarArray.size();
for (ymuint i = 0; i < nc; ++ i) {
VarId vid = mConfVarArray[i];
if ( vid.val() >= model.size() ) {
cout << " vid.val() >= model.size()" << endl
<< " vid.val() = " << vid.val() << endl
<< " model.size() = " << model.size() << endl;
}
if ( model[vid.val()] == kB3True ) {
conf_bits[i] = true;
}
else {
conf_bits[i] = false;
}
}
}
// @brief SAT モデルから入力順を取り出す.
// @param[in] model SAT モデル
// @param[out] iorder 入力順
// iorder[pos] に network の pos 番めの入力に対応した
// 関数の入力番号が入る.
void
GbmBddEngineOneHot::get_iorder(const vector<Bool3>& model,
vector<ymuint>& iorder) const
{
ymuint ni = iorder.size();
for (ymuint i = 0; i < ni; ++ i) {
ymuint base = i * ni;
for (ymuint j = 0; j < ni; ++ j) {
VarId vid = mIorderVarArray[base + j];
if ( model[vid.val()] == kB3True ) {
iorder[i] = j;
break;
}
}
}
}
// @brief 変数順を表すBDDを作る.
// @param[in] level レベル
// @param[in] var_list 変数の集合を表すビットベクタ
//
// var_list に含まれる変数の順列をすべて表す
// BDD を返す.
Bdd
GbmBddEngineOneHot::make_iorder_bdd(ymuint level,
ymuint var_list,
const RcfNetwork& network)
{
#if 0
cout << "make_iorder_bdd(" << level << ")" << endl;
for (ymuint i = 0; i < mInputNum; ++ i) {
if ( var_list & (1U << i) ) {
cout << "1";
}
else {
cout << "0";
}
}
cout << endl;
#endif
Bdd f = mIorderBddArray[var_list];
if ( f.is_zero() ) {
f = mMgr.make_zero();
for (ymuint i = 0; i < mInputNum; ++ i) {
if ( var_list & (1U << i) ) {
#if 1
ymuint pred;
if ( network.get_pred(i, pred) ) {
if ( var_list & (1U << pred) ) {
// LUTの対称性による枝刈り
continue;
}
}
#endif
ymuint var_list1 = var_list & ~(1U << i);
Bdd f1 = make_iorder_bdd(level + 1, var_list1, network);
for (ymuint j = 0; j < mInputNum; ++ j) {
if ( j == i ) {
f1 &= mMgr.make_posiliteral(mIorderVarArray[level * mInputNum + j]);
}
else {
f1 &= ~mMgr.make_posiliteral(mIorderVarArray[level * mInputNum + j]);
}
}
f |= f1;
}
}
mIorderBddArray[var_list] = f;
}
#if 0
cout << "==> " << endl;
f.print(cout);
#endif
return f;
}
// @brief RcfNode に対応する関数を計算する.
// @param[in] node 対象のノード
// @note 結果は mNodeBddArray に格納される.
void
GbmBddEngineOneHot::make_node_func(const RcfNode* node)
{
ASSERT_COND( !node->is_input() );
ymuint ni = node->fanin_num();
vector<Bdd> inputs(ni);
for (ymuint i = 0; i < ni; ++ i) {
RcfNodeHandle ih = node->fanin(i);
ASSERT_COND( !ih.is_const() );
ymuint id = ih.id();
Bdd f = mNodeBddArray[id];
if ( ih.inv() ) {
f = ~f;
}
inputs[i] = f;
}
Bdd output;
if ( node->is_and() ) {
output = inputs[0];
for (ymuint i = 1; i < ni; ++ i) {
output &= inputs[i];
}
}
else if ( node->is_lut() ) {
ymuint ni_exp = 1U << ni;
vector<Bdd> lut_vars(ni_exp);
ymuint conf0 = node->conf_base();
for (ymuint i = 0; i < ni_exp; ++ i) {
lut_vars[i] = mMgr.make_posiliteral(mConfVarArray[conf0 + i]);
}
output = make_LUT(inputs, lut_vars);
}
else if ( node->is_mux() ) {
ymuint ns = node->conf_size();
vector<Bdd> s_vars(ns);
ymuint s0 = node->conf_base();
for (ymuint i = 0; i < ns; ++ i) {
s_vars[i] = mMgr.make_posiliteral(mConfVarArray[s0 + i]);
}
output = make_MUX(inputs, s_vars);
}
mNodeBddArray[node->id()] = output;
}
// @brief LUT ノードの出力の論理関数を計算する.
// @param[in] inputs ファンインの論理関数
// @param[in] lut_vars LUT のコンフィグレーションメモリ
Bdd
GbmBddEngineOneHot::make_LUT(const vector<Bdd>& inputs,
const vector<Bdd>& lut_vars)
{
return make_MUX(lut_vars, inputs);
}
// @brief セレクタの出力の論理関数を計算する.
// @param[in] inputs ファンインの論理関数
// @param[in] s_vars 選択変数
Bdd
GbmBddEngineOneHot::make_MUX(const vector<Bdd>& inputs,
const vector<Bdd>& s_vars)
{
ymuint nd = inputs.size();
ymuint ns = s_vars.size();
ASSERT_COND( (1U << ns) == nd );
Bdd output = mMgr.make_zero();
for (ymuint b = 0; b < nd; ++ b) {
Bdd dvar = inputs[b];
for (ymuint i = 0; i < ns; ++ i) {
Bdd svar = s_vars[i];
if ( (1 << i) & b ) {
dvar &= svar;
}
else {
dvar &= ~svar;
}
}
output |= dvar;
}
return output;
}
END_NAMESPACE_YM
|
/*867. Transpose Matrix
Given a matrix A, return the transpose of A.
The transpose of a matrix is the matrix flipped over it's main diagonal, switching the row and column indices of the matrix.
Example 1:
Input: [[1,2,3],[4,5,6],[7,8,9]]
Output: [[1,4,7],[2,5,8],[3,6,9]]
Example 2:
Input: [[1,2,3],[4,5,6]]
Output: [[1,4],[2,5],[3,6]]
*/
#include <vector>
#include <iostream>
using vvi = std::vector<std::vector<int>>;
void printMatrix(vvi const &matrix)
{
for (auto const &row : matrix)
{
for (auto const &col : row)
{
std::cout << col << " ";
}
std::cout << '\n';
}
}
vvi transpose(vvi& A)
{
int colSize = A[0].size();
int rowSize = A.size();
vvi transposedMatrix(colSize, std::vector<int>(rowSize, 0));
for(int i = 0; i<colSize; i++)
{
for(int j=0; j<rowSize; j++)
{
transposedMatrix[i][j] = A[j][i];
}
}
return transposedMatrix;
}
int main()
{
vvi test1 = { {1,2,3}, {4,5,6}, {7,8,9} };
vvi test2 = { {1,2,3}, {4,5,6} };
vvi result1 = transpose(test1);
vvi result2 = transpose(test2);
printMatrix(result1);
printMatrix(result2);
return 0;
}
|
/*
GNSS 의 느린 Hz를 보정해줄 DR 구현 스레드
*/
#include <stdio.h>
#include <iostream>
#include "env_setting.h"
#include <sys/time.h>
#include <unistd.h>
#include <queue>
#include <fstream>
// Read Coordinates Map Data
//void Coordinates_Map_Data();
#define DOT_STEERING_MODEL
//#define ACKERMANN_STEERING_BICYCLE_MODEL // Not working
//#define KINEMATIC_BICYCLE_MODEL
//#define ONLY_DGPS
//#define YAW_ANGLE_WRITE
void* Dead_Reckoning(void *DR_error_flag_)
{
// 스티어링 각도의 변화량을 계산하기 위한 값.
std::queue<double> steering_angle;
steering_angle.push(0.0);
// check running time
double elapsedTime = 0;
#ifdef YAW_ANGLE_WRITE
std::ofstream fin;
#ifdef __APPLE__
fin.open("../../YAW_ANGLE/yaw_angle_save.txt");
#else
fin.open("/home/chp/darknet_ros_ws/src/darknet_ros/ioniq_control/YAW_ANGLE/yaw_angle_save.txt");
#endif
#endif
while(1)
{
if(gnss_initial_flag == 1)
{
// check running time
struct timeval t1, t2;
// double elapsedTime;
// start timer
gettimeofday(&t1, NULL);
// usleep(100);
#if defined(DOT_STEERING_MODEL) || defined(ACKERMANN_STEERING_BICYCLE_MODEL)// || defined(BICYCLE_MODEL)
// Dead reckoning
// 시간 기준은 GNSS thread의 elapsedTime으로 잡음. 해당 갱신이 chassis CAN의 갱신보다 빠르면 약간의 오차가 발생함. 나중에 mutex로 잡으면 될 듯.
// Dead Reckoning으로 yaw_angle 구하기
// rad/s?? degree/s?? * ms
// 우선 deg/s로 계산 --> 환산하면 1/1000 deg / ms
// 1deg/s = 1deg/1000ms
// 얘 단위 수정해야함. **********************************************
if(vehicle_yaw_rate_error_correct == 1)
dr_yaw_rate_integral_val = -vehicle_yaw_rate / 1000 * elapsedTime;
// steering angle 기반 dr yaw angle (재대로 계산)
// steering_angle.push(vehicle_steering_angle * 0.06);//0.09);
// double steering_angle_tmp = steering_angle.front();
//// std::cout << "steering_angle_tmp = " << steering_angle_tmp << std::endl;
// steering_angle.pop();
// steering_angle_tmp += -steering_angle.front();
// dr_yaw_rate_integral_val = steering_angle_tmp;// / 1000 * elapsedTime;
// 기존 yaw_angle에 적분된 yaw_rate (=yaw_angle) 더하기
// gnss_yaw_angle += dr_yaw_rate_integral_val; // gnss_yaw_angle += 적분 vehicle_yaw_rate(chassis CAN);
// dr_yaw_angle = gnss_yaw_angle;// + dr_yaw_rate_integral_val;
// steering angle기반 dr yaw angle (야매)
// dr_yaw_angle = gnss_yaw_angle - vehicle_steering_angle * 0.09;
// 앞 - 뒤 (부호)
// 스티어앵글 변화량
// double steering_rate = vehicle_steering_angle * 0.09;
// 이전 스티어앵글 각 - 지금 스티어앵글 값 에다 시간 계산해서 요레이트 뽑기?
// yaw rate 누적에 대한 결과를 따로 빼서 계산. 얘가맞음!
yaw_rate_accum_tmp += dr_yaw_rate_integral_val;
if(vehicle_yaw_rate_error_correct == 1)
gnss_yaw_angle = gnss_yaw_angle + dr_yaw_rate_integral_val;
dr_yaw_angle = gnss_yaw_angle;
// std::cout << "dr_yaw_angle = " << dr_yaw_angle << "\t\tyar_rate_accum_tmp = " << yaw_rate_accum_tmp << "\t\tdr_yaw_rate_integral_val = "<< dr_yaw_rate_integral_val << "\t\tvehicle_yaw_rate = "<< vehicle_yaw_rate << std::endl;
// printf("dr_yaw_angle = %f\n", dr_yaw_angle);
#endif
#ifdef DOT_STEERING_MODEL // Coord 기준 : GNSS 설치 위치
// x축 변화량 구하기 (elapsedTime을 이용해 적분 효과)
// current_vehicle_speed가 kph이므로 m/ms로 바꾸려면 3600을 나눠주면 됨.
// delta_dr_x = elapsedTime * (double)current_vehicle_speed / 3600. * cos(3.1415926 / 180. * dr_yaw_angle); // (m/ms)
delta_dr_x = (double)current_vehicle_speed / 3600. * cos(3.1415926 / 180. * dr_yaw_angle); // (m/ms)
// delta_dr_x = elapsedTime * (double)current_vehicle_speed / 3600. * cos(3.1415926 / 180. * (gnss_yaw_angle - vehicle_steering_angle * 0.09));
// printf("current_vehicle_speed = %d\n", current_vehicle_speed);
// printf("yaw_rate = %f\n", vehicle_yaw_rate);
// printf("elapsedTime * current_vehicle_speed / 3600 = %f\n", elapsedTime * (double)current_vehicle_speed / 3600.);
// printf("cos(3.1415926 / 180 * dr_yaw_angle) = %f\n", cos(3.1415926 / 180. * dr_yaw_angle));
// 기존 x좌표에 x축 변화량 더하기
gnss_x += (delta_dr_x * elapsedTime);
dr_x = gnss_x;// + delta_dr_x;
// dr_hard_x += delta_dr_x;
// dr_x = dr_hard_x;
// y축 변화량 구하기 (elapsedTime을 이용해 적분 효과)
// current_vehicle_speed가 kph이므로 m/ms로 바꾸려면 3600을 나눠주면 됨.
delta_dr_y = (double)current_vehicle_speed / 3600. * sin(3.1415926 / 180. * dr_yaw_angle);//cos(3.1415926 / 180. * (90. - dr_yaw_angle));
// delta_dr_y = elapsedTime * (double)current_vehicle_speed / 3600. * sin(3.1415926 / 180. * (gnss_yaw_angle - vehicle_steering_angle * 0.09));
//cos(3.1415926 / 180. * (90. - (gnss_yaw_angle - vehicle_steering_angle * 0.0819)));
// 기존 y좌표에 y축 변화량 더하기
gnss_y += (delta_dr_y * elapsedTime);
dr_y = gnss_y;// + delta_dr_y;
// dr_hard_y += delta_dr_y;
// dr_y = dr_hard_y;
//최종 출력 : dr_yaw_angle, dr_x, dr_y
//std::cout << std::fixed;
//std::cout.precision(7);
//std::cout<< dr_x << "\t\t" << dr_y << "\t\t" << dr_yaw_angle << "\t\t" << "DR" << std::endl;
#endif
#ifdef ACKERMANN_STEERING_BICYCLE_MODEL
dr_yaw_angle = dr_yaw_angle < 0.01 ? 0.01 : dr_yaw_angle;
double r = 2.7 / (cos((90-dr_yaw_angle) * 3.1415926 / 180));
double delta_theta_s = (double)current_vehicle_speed * elapsedTime / r * 180 / 3.1415926; // rad/s^2;
double a1 = cos(-delta_theta_s * 3.1415926 / 180);
double a2 = -sin(-delta_theta_s * 3.1415926 / 180);
double a3 = sin(-delta_theta_s * 3.1415926 / 180);
double a4 = cos(-delta_theta_s * 3.1415926 / 180);
delta_dr_x = (a1 * dr_x + a2 * dr_y) - dr_x;
delta_dr_y = (a3 * dr_x + a4 * dr_y) - dr_y;
// 기존 x좌표에 x축 변화량 더하기
gnss_x += (delta_dr_x * elapsedTime);
dr_x = gnss_x;// + delta_dr_x;
gnss_y += (delta_dr_y * elapsedTime);
dr_y = gnss_y;// + delta_dr_y;
//최종 출력 : dr_yaw_angle, dr_x, dr_y
// std::cout << std::fixed;
// std::cout.precision(7);
// std::cout<< delta_theta_s << "\t\t" << delta_dr_x << "\t\t" << delta_dr_y << "\t\t" << dr_x << "\t\t" << dr_y << "\t\t" << dr_yaw_angle << "\t\t" << "DR" << std::endl;
#endif
#ifdef ONLY_DGPS
dr_x = gnss_x;
dr_y = gnss_y;
dr_yaw_angle = gnss_yaw_angle;
#endif
#ifdef KINEMATIC_BICYCLE_MODEL // No IMS, Coord 기준 : 무게중심 ?
double KBM_l_r = 1.57;//1.35; // m
double KBM_l_f = 1.13;//1.35; // m
steer_angle = steer_angle > 30 ? 30 : steer_angle;
steer_angle = steer_angle < -30 ? -30 : steer_angle;
double KBM_beta = atan(KBM_l_r / (KBM_l_r + KBM_l_f) * tan(3.1415926 / 180. * steer_angle * 30 / 500)) * 180. / 3.1415926;
double KBM_psi_delta = (double)current_vehicle_speed / 3600 / KBM_l_r * sin(3.1415926 / 180. * KBM_beta);// * 180. / 3.141592;
double KBM_psi = KBM_psi_delta * elapsedTime; // KBM_psi_delta 부호, KBM_psi_delta를 deg/s로 가정 -> 1deg/s = 1deg/1,000ms
// yaw_rate_accum_tmp += KBM_psi;
// Method 1
if(vehicle_yaw_rate_error_correct == 1)
gnss_yaw_angle = gnss_yaw_angle + KBM_psi;
dr_yaw_angle = gnss_yaw_angle;
delta_dr_x = (double)current_vehicle_speed / 3600 * cos(3.1415926 / 180. * (dr_yaw_angle + KBM_beta)); // m/ms
// 기존 x좌표에 x축 변화량 더하기
gnss_x += (delta_dr_x * elapsedTime);
dr_x = gnss_x;// + delta_dr_x;
delta_dr_y = (double)current_vehicle_speed / 3600 * sin(3.1415926 / 180. * (dr_yaw_angle + KBM_beta)); // m/ms
// 기존 x좌표에 x축 변화량 더하기
gnss_y += (delta_dr_y * elapsedTime);
dr_y = gnss_y;// + delta_dr_x;
// // Method 2
// delta_dr_x = (double)current_vehicle_speed / 3600 * cos(3.1415926 / 180. * (KBM_psi + KBM_beta)); // m/ms
// // 기존 x좌표에 x축 변화량 더하기
// gnss_x += (delta_dr_x * elapsedTime);
// dr_x = gnss_x;// + delta_dr_x;
//
// delta_dr_y = (double)current_vehicle_speed / 3600 * sin(3.1415926 / 180. * (KBM_psi + KBM_beta)); // m/ms
// // 기존 x좌표에 x축 변화량 더하기
// gnss_y += (delta_dr_y * elapsedTime);
// dr_y = gnss_y;// + delta_dr_x;
#endif
#ifdef OpenCV_View_MAP
// pthread_mutex_lock(&mutex); // 잠금을 생성한다.
// opencv viewer에 그릴 좌표 설정
opencv_x = dr_x * opencv_viewer_zoom;
opencv_y = dr_y * opencv_viewer_zoom;
// printf("elapsedTime = %f \t\t delta_dr_x = %f \t\t opencv_x = %f \t\t opencv_y = %f\n", elapsedTime, delta_dr_x, opencv_x, opencv_y);
// pthread_mutex_unlock(&mutex); // 잠금을 생성한다.
// cv::circle을 이용한 좌표 그리기
cv::Point dot(dr_x*opencv_viewer_zoom, dr_y*opencv_viewer_zoom);
cv::circle(img, dot, 1, CvScalar(0,255,255));
// img data에 접근하여 픽셀 변경을 통한 좌표 그리기
// img.data[(int)(dr_y*4) * img.cols * 3 + (int)(dr_x*4) * 3 + 0] = 0;
// img.data[(int)(dr_y*4) * img.cols * 3 + (int)(dr_x*4) * 3 + 1] = 255;
// img.data[(int)(dr_y*4) * img.cols * 3 + (int)(dr_x*4) * 3 + 2] = 255;
// usleep(1);
// count_dr++;
// printf("count_dr = %d\n", count_dr);
// imshow는 main()에서. thread에서는 imshow 애러뜸.
#endif
#ifdef YAW_ANGLE_WRITE
fin << std::fixed;
fin.precision(8);
fin << "GNSS heading" << "\t\t" << "dr_yaw_angle" << "\t\t" << "yaw_rate_accum_tmp" << std::endl;
if(vehicle_yaw_rate_error_correct == 1)
{
fin << std::fixed;
fin.precision(8);
fin << GNSS_heading << "\t\t" << dr_yaw_angle << "\t\t" << yaw_rate_accum_tmp << std::endl;
//std::cout << GNSS_heading << "\t\t" << dr_yaw_angle << "\t\t" << yaw_rate_accum_tmp << std::endl;
}
usleep(100000);
#endif
// finish timer
gettimeofday(&t2, NULL);
// compute and print the elapsed time in millisec
elapsedTime = (t2.tv_sec - t1.tv_sec) * 1000.0; // sec to ms
elapsedTime += (t2.tv_usec - t1.tv_usec) / 1000.0; // us to ms
// std::cout << std::fixed;
// std::cout.precision(4);
// std::cout << elapsedTime << " ms.\n";
}
}
#ifdef YAW_ANGLE_WRITE
fin.close();
#endif
}
|
#pragma once
#include <iostream>
#ifdef __unix || __unix__
#include <GL/glut.h>
#else
#include <glut.h>
#endif
#include <math.h>
#include <vector>
using namespace std;
/*! \brief
* A 3D point
*/
struct Point3D
{
GLfloat x,y,z;
/*!
* Constructs a 3D point
*/
Point3D(GLfloat x=0,GLfloat y=0,GLfloat z=0):
x(x), y(y), z(z)
{}
Point3D operator+(Point3D point)
{
return Point3D(x+point.x,y+point.y,z+point.z);
}
Point3D operator-(Point3D point)
{
return Point3D(x-point.x,y-point.y,z-point.z);
}
void operator +=(Point3D point)
{
*this = *this+point;
}
Point3D operator*(GLfloat value)
{
return Point3D(x*value,y*value,z*value);
}
Point3D operator/(GLfloat value)
{
return Point3D(x/value,y/value,z/value);
}
GLfloat operator*(Point3D point)
{
return x*point.x+y*point.y+z*point.z;
}
/*! Distance from a point to the origin */
GLfloat Magnitude()
{
return sqrt(x*x+y*y+z*z);
}
/*!Rotates a vector around the Y axis
@param angle by wich the vector rotates
*/
Point3D rotateY(GLfloat angle)
{
GLfloat PI = 3.14159265359;
return Point3D(x*cos(angle*PI/180) - z*sin(angle*PI/180), 0.0, x*sin(angle*PI/180) + z*cos(angle*PI/180));
}
/*!Returns a vector with the same direction as this vector but with a length of 1*/
Point3D Normalize()
{
GLfloat magnitude = Magnitude();
if(magnitude == 0)
return Point3D(0,0,0);
return (*this)/magnitude;
}
/*! Returns the angle between to vectors*/
GLfloat AngleBetween(Point3D point)
{
GLfloat PI = 3.14159265359;
GLfloat dotProduct = ((*this)*point);
return acos(dotProduct/1.0)*180/PI;
}
};
/*! \brief
* A 3D object
*/
class WorldObject
{
protected:
/*! Draws the object on the screen */
virtual void DrawObject() = 0;
/*! Changes the perspective to that of the object */
void ModifyPerspective();
/* Changes the perspective back to the world*/
void ModifyPerspectiveBack();
/*!< the rotation of the object*/
Point3D rotate;
/*!< the position of the object*/
Point3D translate;
/*! the width and height of the object*/
GLfloat width, height;
public:
WorldObject(GLfloat W = 0.0, GLfloat H = 0.0,GLfloat X = 0.0, GLfloat Y = 0.0, GLfloat Z = 0.0);
~WorldObject();
/*! Translates the object by a value
* @param point the amount by wich the object is translated
*/
void Translate(Point3D point);
/*! Rotates the object by a value
* @param point the amount by wich the object is rotated
*/
void Rotate(Point3D point);
void Draw();
/*! Gets the forward direction of the object*/
Point3D GetForward();
/*! Gets the right direction of the object*/
Point3D GetRight();
Point3D GetTranslate();
Point3D GetRotate();
};
|
class Sudoku
{
public:
//int array[9][9];
void giveQuestion();
void readIn();
void solve();
void transform();
void change();
void changeNum(int a,int b);
void changeRow(int a,int b);
void changeCol(int a,int b);
void rotate(int n);
void flip(int n);
};
|
#include "DistanceMeasure.h"
void DistanceMeasure::updatepitchyaw(double pitch, double yaw){
_yaw = yaw;
_pitch = pitch;
Vec3f theta(_pitch, _yaw, _roll);
R = eulerAnglesToRotationMatrix(theta);
head = R.inv()*cameraMatrix.inv();
}
// void DistanceMeasure::ConfigParam(config cfg){
// _fx = cfg.instrinsics[0];
// _fy = cfg.instrinsics[1];
// _cx = cfg.instrinsics[2];
// _cy = cfg.instrinsics[3];
// _pitch = cfg.extrinsics[0];
// _yaw = cfg.extrinsics[1];
// _roll = cfg.extrinsics[2];
// cameraMatrix = (Mat_<double>(3,3) << _fx,0,_cx,
// 0,_fy,_cy,
// 0,0,1);
// cameraMatrix_inv = cameraMatrix.inv();
// Vec3f theta(_pitch, _yaw, _roll);
// R = eulerAnglesToRotationMatrix(theta);
// head = R.inv()*cameraMatrix.inv();
// //rotamatrix(_rota);
// //instrinmatrix(_intrin);
// _t << cfg.transform[0], cfg.transform[1], cfg.transform[2];
// _k1 = cfg.distortion[0];
// _k2 = cfg.distortion[1];
// _p1 = cfg.distortion[2];
// _p2 = cfg.distortion[3];
// _k3 = cfg.distortion[4];
// distort = (Mat_<double>(5,1)<<_k1,_k2,_p1,_p2,_k3);
// //memcpy(_distort, cfg.distortion, sizeof(double)*5);
// }
void DistanceMeasure::ConfigParam(double fx, double fy , double cx, double cy, double k1, double k2,
double p1, double p2, double k3, double pitch, double yaw, double roll, double Cam2Chamber, double Cam2Center ,double CamHeight){
_fx = fx;
_fy = fy;
_cx = cx;
_cy = cy;
_pitch = pitch;
_yaw = yaw;
_roll = roll;
cameraMatrix = (Mat_<double>(3,3) << _fx,0,_cx,
0,_fy,_cy,
0,0,1);
cameraMatrix_inv = cameraMatrix.inv();
Vec3f theta(_pitch, _yaw, _roll);
R = eulerAnglesToRotationMatrix(theta);
head = R.inv()*cameraMatrix.inv();
//rotamatrix(_rota);
//instrinmatrix(_intrin);
_t <<Cam2Chamber, Cam2Center, CamHeight;
_k1 = k1;
_k2 = k2;
_p1 = p1;
_p2 = p2;
_k3 = k3;
distort = (Mat_<double>(5,1)<<_k1,_k2,_p1,_p2,_k3);
//memcpy(_distort, cfg.distortion, sizeof(double)*5);
}
Vector2d DistanceMeasure::pixelonly(double i,double j){
vector<Point2f> px{Point2f(i,j)};
Vector2d coord;
//undistortPoints(px,px,cameraMatrix,distort);
//px[0].x=cameraMatrix.at<double>(0,0)*px[0].x+cameraMatrix.at<double>(0,1)*px[0].y+cameraMatrix.at<double>(0,2);
//px[0].y=cameraMatrix.at<double>(1,0)*px[0].x+cameraMatrix.at<double>(1,1)*px[0].y+cameraMatrix.at<double>(1,2);
Point3d p;
p.x = px[0].x;
p.y = px[0].y;
p.z = 1;
double x = p.x*head.at<double>(0,0)+p.y*head.at<double>(0,1)+p.z*head.at<double>(0,2);
double y = p.x*head.at<double>(1,0)+p.y*head.at<double>(1,1)+p.z*head.at<double>(1,2);
double z = p.x*head.at<double>(2,0)+p.y*head.at<double>(2,1)+p.z*head.at<double>(2,2);
double zc = _t(2)/y;
double zx = zc*x;
double zz = zc*z;
coord(0) = zx-_t(1);//left negtive right positive
coord(1) = zz+_t(0);
return coord;
}
void DistanceMeasure::pixel2worldpixelonly(Rect2f &PixelBoundingBox, Rect2f &WorldBoudingBox){
double i = PixelBoundingBox.x;double j = PixelBoundingBox.y;
Vector2d world = this->pixelonly(i,j);
WorldBoudingBox.x = world(0);WorldBoudingBox.y = world(1);
}
void DistanceMeasure::pixel2worldwidthheight(Rect2f &PixelBoundingBox, Rect2f &WorldBoudingBox){
double i = PixelBoundingBox.x;double j = PixelBoundingBox.y;
double w = PixelBoundingBox.width;double h = PixelBoundingBox.height;
double midi = i+w/2.;double midj = j+h;
double lefti = i;double leftj = j+h;
double righti = i+w; double rightj = j+h;
double topi = i+w/2;double topj = j;
Vector2d mid = this->pixelonly(midi, midj);
Vector2d left = this->pixelonly(lefti,leftj);
Vector2d right = this->pixelonly(righti, rightj);
double distance = mid(1);
Vector2d top = this->pixel2worldzplane(topi,topj,distance);
WorldBoudingBox.x = mid(0);WorldBoudingBox.y = mid(1);
WorldBoudingBox.width = abs(left(0)-right(0));
WorldBoudingBox.height = abs(top(1));
//cout << "world: " <<WorldBoudingBox << endl;
}
void DistanceMeasure::pixel2worldwidthlength(Rect2f &PixelBoundingBox, Rect2f &WorldBoudingBox){
double i = PixelBoundingBox.x;double j = PixelBoundingBox.y;
double w = PixelBoundingBox.width;double h = PixelBoundingBox.height;
double midi = i+w/2.;double midj = j+h;
double lefti = i;double leftj = j+h;
double righti = i+w; double rightj = j+h;
double topi = i+w/2;double topj = j;
Vector2d mid = this->pixelonly(midi, midj);
Vector2d left = this->pixelonly(lefti,leftj);
Vector2d right = this->pixelonly(righti, rightj);
Vector2d top = this->pixelonly(topi, topj);
WorldBoudingBox.x = mid(0);WorldBoudingBox.y = mid(1);
WorldBoudingBox.width = abs(left(0)-right(0));
WorldBoudingBox.height = abs(top(1) - mid(1));
}
void DistanceMeasure::pixel2world(Rect2f &PixelBoundingBox, Rect2f &WorldBoudingBox, TransferType transfertype){
switch (transfertype)
{
case PixelOnly:
this->pixel2worldpixelonly(PixelBoundingBox,WorldBoudingBox);
break;
case WidthHeight:
this->pixel2worldwidthheight(PixelBoundingBox,WorldBoudingBox);
break;
case WidthLength:
this->pixel2worldwidthlength(PixelBoundingBox,WorldBoudingBox);
break;
default:
break;
}
}
Vector2d DistanceMeasure::pixel2worldzplane(double i,double j, double z){
vector<Point2f> px{Point2f(i,j)};
undistortPoints(px,px,cameraMatrix,distort);
px[0].x=cameraMatrix.at<double>(0,0)*px[0].x+cameraMatrix.at<double>(0,1)*px[0].y+cameraMatrix.at<double>(0,2);
px[0].y=cameraMatrix.at<double>(1,0)*px[0].x+cameraMatrix.at<double>(1,1)*px[0].y+cameraMatrix.at<double>(1,2);
Point3d p;
p.x = px[0].x;
p.y = px[0].y;
p.z = 1;
double zc = (z+_t(0))/(p.x*head.at<double>(2,0)+p.y*head.at<double>(2,1)+p.z*head.at<double>(2,2));
double x = p.x*head.at<double>(0,0)+p.y*head.at<double>(0,1)+p.z*head.at<double>(0,2);
double y = p.x*head.at<double>(1,0)+p.y*head.at<double>(1,1)+p.z*head.at<double>(1,2);
double zx = zc*x;
double zy = zc*y;
//cout << i << " "<< j << " " << z << " "<< zy << endl;
//cout << p << endl;
Vector2d coord;
coord(0) = zx+_t(1);
coord(1) = _t(2)-zy;
return coord;
}
Mat DistanceMeasure::eulerAnglesToRotationMatrix(Vec3f &theta)
{
theta = theta/180*3.1415926;
Mat R_x = (Mat_<double>(3,3) <<
1, 0, 0,
0, cos(theta[0]), -sin(theta[0]),
0, sin(theta[0]), cos(theta[0])
);
Mat R_y = (Mat_<double>(3,3) <<
cos(theta[1]), 0, sin(theta[1]),
0, 1, 0,
-sin(theta[1]), 0, cos(theta[1])
);
Mat R_z = (Mat_<double>(3,3) <<
cos(theta[2]), -sin(theta[2]), 0,
sin(theta[2]), cos(theta[2]), 0,
0, 0, 1);
Mat R = R_z * R_y * R_x;
return R;
}
Point2f DistanceMeasure::estimationvp(){
Mat re = cameraMatrix*R;
vector<Point2f> pleft,pright;
for(int i=10000;i<200000;i=i+10000){
Point3f p1;
p1.x = 4000;
p1.y = _t(2);
p1.z = i;
Point2f p1map;
p1map.x = p1.x*re.at<double>(0,0)+p1.y*re.at<double>(0,1)+p1.z*re.at<double>(0,2);
p1map.y = p1.x*re.at<double>(1,0)+p1.y*re.at<double>(1,1)+p1.z*re.at<double>(1,2);
double z = p1.x*re.at<double>(2,0)+p1.y*re.at<double>(2,1)+p1.z*re.at<double>(2,2);
p1map.x = p1map.x/z;
p1map.y = p1map.y/z;
//cout << p1map << endl;
pleft.push_back(p1map);
}
for(int i=10000;i<200000;i=i+10000){
Point3f p1;
p1.x = -4000;
p1.y = _t(2);
p1.z = i;
Point2f p1map;
p1map.x = p1.x*re.at<double>(0,0)+p1.y*re.at<double>(0,1)+p1.z*re.at<double>(0,2);
p1map.y = p1.x*re.at<double>(1,0)+p1.y*re.at<double>(1,1)+p1.z*re.at<double>(1,2);
double z = p1.x*re.at<double>(2,0)+p1.y*re.at<double>(2,1)+p1.z*re.at<double>(2,2);
p1map.x = p1map.x/z;
p1map.y = p1map.y/z;
pright.push_back(p1map);
}
double x11 = pleft.begin()->x;double x12 = (pleft.end()-1)->x;
double x21 = pright.begin()->x;double x22 = (pright.end()-1)->x;
double x0 = (x11*x22 - x21*x12)/(x22-x12 + x11-x21);
double y11 = pleft.begin()->y;double y12 = (pleft.end()-2)->y;
double y21 = pright.begin()->y;double y22 = (pright.end()-2)->y;
double y0 = (y11*y22 - y21*y12)/(y22-y12 + y11-y21);
//cout << (y22-y12 + y11-y21) << endl;
Point2f p(x0,y0);
//std::cout << "Vanished Points:" << p << endl;
CurrentVPPoint = p;
return p;
}
void DistanceMeasure::vpadjust(Point2f pointvpadjust){
for (int i = 0; i < 4; i++)
{
// cout << CurrentVPPoint << endl;
// cout << pointvpadjust << endl;
Point2f ad1 = CurrentVPPoint-pointvpadjust;
double alfa1 = tan(_pitch/180*3.1415926);
double belta1 = ad1.y/_fy;
double eta1 = alfa1+belta1;
// cout << "pitch: " << atan(eta1)*180/3.1415926 << endl;
_pitch = atan(eta1)*180/3.1415926;
double alfa2 = tan(_yaw/180*3.1415296);
double belta2 = ad1.x / _fx;
double eta2 = alfa2-belta2;
// cout << "yaw: " << atan(eta2)*180/3.1415926 << endl;
_yaw = atan(eta2)*180/3.1415926;
Vec3f theta1(_pitch, _yaw, _roll);
R = eulerAnglesToRotationMatrix(theta1);
head = R.inv()*cameraMatrix.inv();
CurrentVPPoint = estimationvp();
}
}
|
#include "MoleculeModel.h"
#include <glm/glm.hpp>
MoleculeModel::MoleculeModel(glm::mat4 modelMatrix, std::shared_ptr<Material> material, Molecule& molecule)
:modelMatrix(modelMatrix), material(material)
{
GeometryData geometryData;
for (const auto& atom : molecule.atoms)
{
ProceduralGeometry::createSphereGeometry(0.5f*atom.radius, 8u, 8u, atom.position, geometryData);
}
//Create Vertex Array Object
glGenVertexArrays(1, &vao);
glBindVertexArray(vao);
//create vertex position array
glGenBuffers(1, &vboPositions); glBindBuffer(GL_ARRAY_BUFFER, vboPositions);
glBufferData(GL_ARRAY_BUFFER, geometryData.positions.size() * sizeof(glm::vec3), geometryData.positions.data(), GL_STATIC_DRAW);
//Bind vertex positions to location 0
glEnableVertexAttribArray(0);
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 0, 0);
//create normals array buffer
glGenBuffers(1, &vboNormals);
glBindBuffer(GL_ARRAY_BUFFER, vboNormals);
glBufferData(GL_ARRAY_BUFFER, geometryData.normals.size() * sizeof(glm::vec3), geometryData.normals.data(), GL_STATIC_DRAW);
//Bind vertex normals to location 1
glEnableVertexAttribArray(1);
glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, 0, 0);
//create uv array buffer
glGenBuffers(1, &vboUV);
glBindBuffer(GL_ARRAY_BUFFER, vboUV);
glBufferData(GL_ARRAY_BUFFER, geometryData.uv.size() * sizeof(glm::vec2), geometryData.uv.data(), GL_STATIC_DRAW);
//Bind vertex uv to location 2
glEnableVertexAttribArray(2);
glVertexAttribPointer(2, 2, GL_FLOAT, GL_FALSE, 0, 0);
//create Index Array
glGenBuffers(1, &vboIndices);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, vboIndices);
glBufferData(GL_ELEMENT_ARRAY_BUFFER, geometryData.indices.size() * sizeof(unsigned int), geometryData.indices.data(), GL_STATIC_DRAW);
//Reset all bindings to 0
glBindVertexArray(0);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
//set color
color = glm::vec4(0.0f, 0.0f, 0.0f, 1.0f);
nrOfVertices = geometryData.indices.size();
isEmpty = false;
}
MoleculeModel::~MoleculeModel()
{
glDeleteBuffers(1, &vboIndices);
glDeleteBuffers(1, &vboUV);
glDeleteBuffers(1, &vboPositions);
glDeleteBuffers(1, &vboIndices);
glDeleteVertexArrays(1, &vao);
}
void MoleculeModel::draw(glm::mat4 matrix)
{
//Combined Matrices, would allow hierarchical animation later
glm::mat4 totalMatrix = matrix * modelMatrix;
std::shared_ptr<Shader> shader = material->getShader();
//set Model Uniforms
material->setUniforms();
shader->use();
shader->setUniform("modelMatrix", totalMatrix);
shader->setUniform("normalMatrix", glm::mat3(glm::inverse(glm::transpose(totalMatrix))));
//shader->setUniform("materialColor", color);
//Bind Buffers
glBindVertexArray(vao);
glDrawElements(GL_TRIANGLES, nrOfVertices, GL_UNSIGNED_INT, 0);
glBindVertexArray(0);
}
|
// C++ for the Windows Runtime vv1.0.170303.6
// Copyright (c) 2017 Microsoft Corporation. All rights reserved.
#pragma once
#include "base.h"
WINRT_WARNING_PUSH
#include "internal/Windows.Web.Http.3.h"
#include "internal/Windows.Foundation.3.h"
#include "internal/Windows.Storage.Streams.3.h"
#include "internal/Windows.Foundation.Collections.3.h"
#include "internal/Windows.Media.Streaming.Adaptive.3.h"
#include "Windows.Media.h"
#include "Windows.Foundation.h"
#include "Windows.Media.Core.h"
WINRT_EXPORT namespace winrt {
namespace impl {
template <typename D>
struct produce<D, Windows::Media::Streaming::Adaptive::IAdaptiveMediaSource> : produce_base<D, Windows::Media::Streaming::Adaptive::IAdaptiveMediaSource>
{
HRESULT __stdcall get_IsLive(bool * value) noexcept override
{
try
{
typename D::abi_guard guard(this->shim());
*value = detach_abi(this->shim().IsLive());
return S_OK;
}
catch (...)
{
return impl::to_hresult();
}
}
HRESULT __stdcall get_DesiredLiveOffset(impl::abi_arg_out<Windows::Foundation::TimeSpan> value) noexcept override
{
try
{
typename D::abi_guard guard(this->shim());
*value = detach_abi(this->shim().DesiredLiveOffset());
return S_OK;
}
catch (...)
{
return impl::to_hresult();
}
}
HRESULT __stdcall put_DesiredLiveOffset(impl::abi_arg_in<Windows::Foundation::TimeSpan> value) noexcept override
{
try
{
typename D::abi_guard guard(this->shim());
this->shim().DesiredLiveOffset(*reinterpret_cast<const Windows::Foundation::TimeSpan *>(&value));
return S_OK;
}
catch (...)
{
return impl::to_hresult();
}
}
HRESULT __stdcall get_InitialBitrate(uint32_t * value) noexcept override
{
try
{
typename D::abi_guard guard(this->shim());
*value = detach_abi(this->shim().InitialBitrate());
return S_OK;
}
catch (...)
{
return impl::to_hresult();
}
}
HRESULT __stdcall put_InitialBitrate(uint32_t value) noexcept override
{
try
{
typename D::abi_guard guard(this->shim());
this->shim().InitialBitrate(value);
return S_OK;
}
catch (...)
{
return impl::to_hresult();
}
}
HRESULT __stdcall get_CurrentDownloadBitrate(uint32_t * value) noexcept override
{
try
{
typename D::abi_guard guard(this->shim());
*value = detach_abi(this->shim().CurrentDownloadBitrate());
return S_OK;
}
catch (...)
{
return impl::to_hresult();
}
}
HRESULT __stdcall get_CurrentPlaybackBitrate(uint32_t * value) noexcept override
{
try
{
typename D::abi_guard guard(this->shim());
*value = detach_abi(this->shim().CurrentPlaybackBitrate());
return S_OK;
}
catch (...)
{
return impl::to_hresult();
}
}
HRESULT __stdcall get_AvailableBitrates(impl::abi_arg_out<Windows::Foundation::Collections::IVectorView<uint32_t>> value) noexcept override
{
try
{
typename D::abi_guard guard(this->shim());
*value = detach_abi(this->shim().AvailableBitrates());
return S_OK;
}
catch (...)
{
*value = nullptr;
return impl::to_hresult();
}
}
HRESULT __stdcall get_DesiredMinBitrate(impl::abi_arg_out<Windows::Foundation::IReference<uint32_t>> value) noexcept override
{
try
{
typename D::abi_guard guard(this->shim());
*value = detach_abi(this->shim().DesiredMinBitrate());
return S_OK;
}
catch (...)
{
*value = nullptr;
return impl::to_hresult();
}
}
HRESULT __stdcall put_DesiredMinBitrate(impl::abi_arg_in<Windows::Foundation::IReference<uint32_t>> value) noexcept override
{
try
{
typename D::abi_guard guard(this->shim());
this->shim().DesiredMinBitrate(*reinterpret_cast<const Windows::Foundation::IReference<uint32_t> *>(&value));
return S_OK;
}
catch (...)
{
return impl::to_hresult();
}
}
HRESULT __stdcall get_DesiredMaxBitrate(impl::abi_arg_out<Windows::Foundation::IReference<uint32_t>> value) noexcept override
{
try
{
typename D::abi_guard guard(this->shim());
*value = detach_abi(this->shim().DesiredMaxBitrate());
return S_OK;
}
catch (...)
{
*value = nullptr;
return impl::to_hresult();
}
}
HRESULT __stdcall put_DesiredMaxBitrate(impl::abi_arg_in<Windows::Foundation::IReference<uint32_t>> value) noexcept override
{
try
{
typename D::abi_guard guard(this->shim());
this->shim().DesiredMaxBitrate(*reinterpret_cast<const Windows::Foundation::IReference<uint32_t> *>(&value));
return S_OK;
}
catch (...)
{
return impl::to_hresult();
}
}
HRESULT __stdcall get_AudioOnlyPlayback(bool * value) noexcept override
{
try
{
typename D::abi_guard guard(this->shim());
*value = detach_abi(this->shim().AudioOnlyPlayback());
return S_OK;
}
catch (...)
{
return impl::to_hresult();
}
}
HRESULT __stdcall get_InboundBitsPerSecond(uint64_t * value) noexcept override
{
try
{
typename D::abi_guard guard(this->shim());
*value = detach_abi(this->shim().InboundBitsPerSecond());
return S_OK;
}
catch (...)
{
return impl::to_hresult();
}
}
HRESULT __stdcall get_InboundBitsPerSecondWindow(impl::abi_arg_out<Windows::Foundation::TimeSpan> value) noexcept override
{
try
{
typename D::abi_guard guard(this->shim());
*value = detach_abi(this->shim().InboundBitsPerSecondWindow());
return S_OK;
}
catch (...)
{
return impl::to_hresult();
}
}
HRESULT __stdcall put_InboundBitsPerSecondWindow(impl::abi_arg_in<Windows::Foundation::TimeSpan> value) noexcept override
{
try
{
typename D::abi_guard guard(this->shim());
this->shim().InboundBitsPerSecondWindow(*reinterpret_cast<const Windows::Foundation::TimeSpan *>(&value));
return S_OK;
}
catch (...)
{
return impl::to_hresult();
}
}
HRESULT __stdcall add_DownloadBitrateChanged(impl::abi_arg_in<Windows::Foundation::TypedEventHandler<Windows::Media::Streaming::Adaptive::AdaptiveMediaSource, Windows::Media::Streaming::Adaptive::AdaptiveMediaSourceDownloadBitrateChangedEventArgs>> handler, event_token * token) noexcept override
{
try
{
typename D::abi_guard guard(this->shim());
*token = detach_abi(this->shim().DownloadBitrateChanged(*reinterpret_cast<const Windows::Foundation::TypedEventHandler<Windows::Media::Streaming::Adaptive::AdaptiveMediaSource, Windows::Media::Streaming::Adaptive::AdaptiveMediaSourceDownloadBitrateChangedEventArgs> *>(&handler)));
return S_OK;
}
catch (...)
{
return impl::to_hresult();
}
}
HRESULT __stdcall remove_DownloadBitrateChanged(event_token token) noexcept override
{
try
{
typename D::abi_guard guard(this->shim());
this->shim().DownloadBitrateChanged(token);
return S_OK;
}
catch (...)
{
return impl::to_hresult();
}
}
HRESULT __stdcall add_PlaybackBitrateChanged(impl::abi_arg_in<Windows::Foundation::TypedEventHandler<Windows::Media::Streaming::Adaptive::AdaptiveMediaSource, Windows::Media::Streaming::Adaptive::AdaptiveMediaSourcePlaybackBitrateChangedEventArgs>> handler, event_token * token) noexcept override
{
try
{
typename D::abi_guard guard(this->shim());
*token = detach_abi(this->shim().PlaybackBitrateChanged(*reinterpret_cast<const Windows::Foundation::TypedEventHandler<Windows::Media::Streaming::Adaptive::AdaptiveMediaSource, Windows::Media::Streaming::Adaptive::AdaptiveMediaSourcePlaybackBitrateChangedEventArgs> *>(&handler)));
return S_OK;
}
catch (...)
{
return impl::to_hresult();
}
}
HRESULT __stdcall remove_PlaybackBitrateChanged(event_token token) noexcept override
{
try
{
typename D::abi_guard guard(this->shim());
this->shim().PlaybackBitrateChanged(token);
return S_OK;
}
catch (...)
{
return impl::to_hresult();
}
}
HRESULT __stdcall add_DownloadRequested(impl::abi_arg_in<Windows::Foundation::TypedEventHandler<Windows::Media::Streaming::Adaptive::AdaptiveMediaSource, Windows::Media::Streaming::Adaptive::AdaptiveMediaSourceDownloadRequestedEventArgs>> handler, event_token * token) noexcept override
{
try
{
typename D::abi_guard guard(this->shim());
*token = detach_abi(this->shim().DownloadRequested(*reinterpret_cast<const Windows::Foundation::TypedEventHandler<Windows::Media::Streaming::Adaptive::AdaptiveMediaSource, Windows::Media::Streaming::Adaptive::AdaptiveMediaSourceDownloadRequestedEventArgs> *>(&handler)));
return S_OK;
}
catch (...)
{
return impl::to_hresult();
}
}
HRESULT __stdcall remove_DownloadRequested(event_token token) noexcept override
{
try
{
typename D::abi_guard guard(this->shim());
this->shim().DownloadRequested(token);
return S_OK;
}
catch (...)
{
return impl::to_hresult();
}
}
HRESULT __stdcall add_DownloadCompleted(impl::abi_arg_in<Windows::Foundation::TypedEventHandler<Windows::Media::Streaming::Adaptive::AdaptiveMediaSource, Windows::Media::Streaming::Adaptive::AdaptiveMediaSourceDownloadCompletedEventArgs>> handler, event_token * token) noexcept override
{
try
{
typename D::abi_guard guard(this->shim());
*token = detach_abi(this->shim().DownloadCompleted(*reinterpret_cast<const Windows::Foundation::TypedEventHandler<Windows::Media::Streaming::Adaptive::AdaptiveMediaSource, Windows::Media::Streaming::Adaptive::AdaptiveMediaSourceDownloadCompletedEventArgs> *>(&handler)));
return S_OK;
}
catch (...)
{
return impl::to_hresult();
}
}
HRESULT __stdcall remove_DownloadCompleted(event_token token) noexcept override
{
try
{
typename D::abi_guard guard(this->shim());
this->shim().DownloadCompleted(token);
return S_OK;
}
catch (...)
{
return impl::to_hresult();
}
}
HRESULT __stdcall add_DownloadFailed(impl::abi_arg_in<Windows::Foundation::TypedEventHandler<Windows::Media::Streaming::Adaptive::AdaptiveMediaSource, Windows::Media::Streaming::Adaptive::AdaptiveMediaSourceDownloadFailedEventArgs>> handler, event_token * token) noexcept override
{
try
{
typename D::abi_guard guard(this->shim());
*token = detach_abi(this->shim().DownloadFailed(*reinterpret_cast<const Windows::Foundation::TypedEventHandler<Windows::Media::Streaming::Adaptive::AdaptiveMediaSource, Windows::Media::Streaming::Adaptive::AdaptiveMediaSourceDownloadFailedEventArgs> *>(&handler)));
return S_OK;
}
catch (...)
{
return impl::to_hresult();
}
}
HRESULT __stdcall remove_DownloadFailed(event_token token) noexcept override
{
try
{
typename D::abi_guard guard(this->shim());
this->shim().DownloadFailed(token);
return S_OK;
}
catch (...)
{
return impl::to_hresult();
}
}
};
template <typename D>
struct produce<D, Windows::Media::Streaming::Adaptive::IAdaptiveMediaSource2> : produce_base<D, Windows::Media::Streaming::Adaptive::IAdaptiveMediaSource2>
{
HRESULT __stdcall get_AdvancedSettings(impl::abi_arg_out<Windows::Media::Streaming::Adaptive::IAdaptiveMediaSourceAdvancedSettings> value) noexcept override
{
try
{
typename D::abi_guard guard(this->shim());
*value = detach_abi(this->shim().AdvancedSettings());
return S_OK;
}
catch (...)
{
*value = nullptr;
return impl::to_hresult();
}
}
};
template <typename D>
struct produce<D, Windows::Media::Streaming::Adaptive::IAdaptiveMediaSource3> : produce_base<D, Windows::Media::Streaming::Adaptive::IAdaptiveMediaSource3>
{
HRESULT __stdcall get_MinLiveOffset(impl::abi_arg_out<Windows::Foundation::IReference<Windows::Foundation::TimeSpan>> value) noexcept override
{
try
{
typename D::abi_guard guard(this->shim());
*value = detach_abi(this->shim().MinLiveOffset());
return S_OK;
}
catch (...)
{
*value = nullptr;
return impl::to_hresult();
}
}
HRESULT __stdcall get_MaxSeekableWindowSize(impl::abi_arg_out<Windows::Foundation::IReference<Windows::Foundation::TimeSpan>> value) noexcept override
{
try
{
typename D::abi_guard guard(this->shim());
*value = detach_abi(this->shim().MaxSeekableWindowSize());
return S_OK;
}
catch (...)
{
*value = nullptr;
return impl::to_hresult();
}
}
HRESULT __stdcall get_DesiredSeekableWindowSize(impl::abi_arg_out<Windows::Foundation::IReference<Windows::Foundation::TimeSpan>> value) noexcept override
{
try
{
typename D::abi_guard guard(this->shim());
*value = detach_abi(this->shim().DesiredSeekableWindowSize());
return S_OK;
}
catch (...)
{
*value = nullptr;
return impl::to_hresult();
}
}
HRESULT __stdcall put_DesiredSeekableWindowSize(impl::abi_arg_in<Windows::Foundation::IReference<Windows::Foundation::TimeSpan>> value) noexcept override
{
try
{
typename D::abi_guard guard(this->shim());
this->shim().DesiredSeekableWindowSize(*reinterpret_cast<const Windows::Foundation::IReference<Windows::Foundation::TimeSpan> *>(&value));
return S_OK;
}
catch (...)
{
return impl::to_hresult();
}
}
HRESULT __stdcall get_Diagnostics(impl::abi_arg_out<Windows::Media::Streaming::Adaptive::IAdaptiveMediaSourceDiagnostics> value) noexcept override
{
try
{
typename D::abi_guard guard(this->shim());
*value = detach_abi(this->shim().Diagnostics());
return S_OK;
}
catch (...)
{
*value = nullptr;
return impl::to_hresult();
}
}
HRESULT __stdcall abi_GetCorrelatedTimes(impl::abi_arg_out<Windows::Media::Streaming::Adaptive::IAdaptiveMediaSourceCorrelatedTimes> value) noexcept override
{
try
{
typename D::abi_guard guard(this->shim());
*value = detach_abi(this->shim().GetCorrelatedTimes());
return S_OK;
}
catch (...)
{
*value = nullptr;
return impl::to_hresult();
}
}
};
template <typename D>
struct produce<D, Windows::Media::Streaming::Adaptive::IAdaptiveMediaSourceAdvancedSettings> : produce_base<D, Windows::Media::Streaming::Adaptive::IAdaptiveMediaSourceAdvancedSettings>
{
HRESULT __stdcall get_AllSegmentsIndependent(bool * value) noexcept override
{
try
{
typename D::abi_guard guard(this->shim());
*value = detach_abi(this->shim().AllSegmentsIndependent());
return S_OK;
}
catch (...)
{
return impl::to_hresult();
}
}
HRESULT __stdcall put_AllSegmentsIndependent(bool value) noexcept override
{
try
{
typename D::abi_guard guard(this->shim());
this->shim().AllSegmentsIndependent(value);
return S_OK;
}
catch (...)
{
return impl::to_hresult();
}
}
HRESULT __stdcall get_DesiredBitrateHeadroomRatio(impl::abi_arg_out<Windows::Foundation::IReference<double>> value) noexcept override
{
try
{
typename D::abi_guard guard(this->shim());
*value = detach_abi(this->shim().DesiredBitrateHeadroomRatio());
return S_OK;
}
catch (...)
{
*value = nullptr;
return impl::to_hresult();
}
}
HRESULT __stdcall put_DesiredBitrateHeadroomRatio(impl::abi_arg_in<Windows::Foundation::IReference<double>> value) noexcept override
{
try
{
typename D::abi_guard guard(this->shim());
this->shim().DesiredBitrateHeadroomRatio(*reinterpret_cast<const Windows::Foundation::IReference<double> *>(&value));
return S_OK;
}
catch (...)
{
return impl::to_hresult();
}
}
HRESULT __stdcall get_BitrateDowngradeTriggerRatio(impl::abi_arg_out<Windows::Foundation::IReference<double>> value) noexcept override
{
try
{
typename D::abi_guard guard(this->shim());
*value = detach_abi(this->shim().BitrateDowngradeTriggerRatio());
return S_OK;
}
catch (...)
{
*value = nullptr;
return impl::to_hresult();
}
}
HRESULT __stdcall put_BitrateDowngradeTriggerRatio(impl::abi_arg_in<Windows::Foundation::IReference<double>> value) noexcept override
{
try
{
typename D::abi_guard guard(this->shim());
this->shim().BitrateDowngradeTriggerRatio(*reinterpret_cast<const Windows::Foundation::IReference<double> *>(&value));
return S_OK;
}
catch (...)
{
return impl::to_hresult();
}
}
};
template <typename D>
struct produce<D, Windows::Media::Streaming::Adaptive::IAdaptiveMediaSourceCorrelatedTimes> : produce_base<D, Windows::Media::Streaming::Adaptive::IAdaptiveMediaSourceCorrelatedTimes>
{
HRESULT __stdcall get_Position(impl::abi_arg_out<Windows::Foundation::IReference<Windows::Foundation::TimeSpan>> value) noexcept override
{
try
{
typename D::abi_guard guard(this->shim());
*value = detach_abi(this->shim().Position());
return S_OK;
}
catch (...)
{
*value = nullptr;
return impl::to_hresult();
}
}
HRESULT __stdcall get_PresentationTimeStamp(impl::abi_arg_out<Windows::Foundation::IReference<Windows::Foundation::TimeSpan>> value) noexcept override
{
try
{
typename D::abi_guard guard(this->shim());
*value = detach_abi(this->shim().PresentationTimeStamp());
return S_OK;
}
catch (...)
{
*value = nullptr;
return impl::to_hresult();
}
}
HRESULT __stdcall get_ProgramDateTime(impl::abi_arg_out<Windows::Foundation::IReference<Windows::Foundation::DateTime>> value) noexcept override
{
try
{
typename D::abi_guard guard(this->shim());
*value = detach_abi(this->shim().ProgramDateTime());
return S_OK;
}
catch (...)
{
*value = nullptr;
return impl::to_hresult();
}
}
};
template <typename D>
struct produce<D, Windows::Media::Streaming::Adaptive::IAdaptiveMediaSourceCreationResult> : produce_base<D, Windows::Media::Streaming::Adaptive::IAdaptiveMediaSourceCreationResult>
{
HRESULT __stdcall get_Status(Windows::Media::Streaming::Adaptive::AdaptiveMediaSourceCreationStatus * value) noexcept override
{
try
{
typename D::abi_guard guard(this->shim());
*value = detach_abi(this->shim().Status());
return S_OK;
}
catch (...)
{
return impl::to_hresult();
}
}
HRESULT __stdcall get_MediaSource(impl::abi_arg_out<Windows::Media::Streaming::Adaptive::IAdaptiveMediaSource> value) noexcept override
{
try
{
typename D::abi_guard guard(this->shim());
*value = detach_abi(this->shim().MediaSource());
return S_OK;
}
catch (...)
{
*value = nullptr;
return impl::to_hresult();
}
}
HRESULT __stdcall get_HttpResponseMessage(impl::abi_arg_out<Windows::Web::Http::IHttpResponseMessage> value) noexcept override
{
try
{
typename D::abi_guard guard(this->shim());
*value = detach_abi(this->shim().HttpResponseMessage());
return S_OK;
}
catch (...)
{
*value = nullptr;
return impl::to_hresult();
}
}
};
template <typename D>
struct produce<D, Windows::Media::Streaming::Adaptive::IAdaptiveMediaSourceCreationResult2> : produce_base<D, Windows::Media::Streaming::Adaptive::IAdaptiveMediaSourceCreationResult2>
{
HRESULT __stdcall get_ExtendedError(HRESULT * value) noexcept override
{
try
{
typename D::abi_guard guard(this->shim());
*value = detach_abi(this->shim().ExtendedError());
return S_OK;
}
catch (...)
{
return impl::to_hresult();
}
}
};
template <typename D>
struct produce<D, Windows::Media::Streaming::Adaptive::IAdaptiveMediaSourceDiagnosticAvailableEventArgs> : produce_base<D, Windows::Media::Streaming::Adaptive::IAdaptiveMediaSourceDiagnosticAvailableEventArgs>
{
HRESULT __stdcall get_DiagnosticType(Windows::Media::Streaming::Adaptive::AdaptiveMediaSourceDiagnosticType * value) noexcept override
{
try
{
typename D::abi_guard guard(this->shim());
*value = detach_abi(this->shim().DiagnosticType());
return S_OK;
}
catch (...)
{
return impl::to_hresult();
}
}
HRESULT __stdcall get_RequestId(impl::abi_arg_out<Windows::Foundation::IReference<int32_t>> value) noexcept override
{
try
{
typename D::abi_guard guard(this->shim());
*value = detach_abi(this->shim().RequestId());
return S_OK;
}
catch (...)
{
*value = nullptr;
return impl::to_hresult();
}
}
HRESULT __stdcall get_Position(impl::abi_arg_out<Windows::Foundation::IReference<Windows::Foundation::TimeSpan>> value) noexcept override
{
try
{
typename D::abi_guard guard(this->shim());
*value = detach_abi(this->shim().Position());
return S_OK;
}
catch (...)
{
*value = nullptr;
return impl::to_hresult();
}
}
HRESULT __stdcall get_SegmentId(impl::abi_arg_out<Windows::Foundation::IReference<uint64_t>> value) noexcept override
{
try
{
typename D::abi_guard guard(this->shim());
*value = detach_abi(this->shim().SegmentId());
return S_OK;
}
catch (...)
{
*value = nullptr;
return impl::to_hresult();
}
}
HRESULT __stdcall get_ResourceType(impl::abi_arg_out<Windows::Foundation::IReference<winrt::Windows::Media::Streaming::Adaptive::AdaptiveMediaSourceResourceType>> value) noexcept override
{
try
{
typename D::abi_guard guard(this->shim());
*value = detach_abi(this->shim().ResourceType());
return S_OK;
}
catch (...)
{
*value = nullptr;
return impl::to_hresult();
}
}
HRESULT __stdcall get_ResourceUri(impl::abi_arg_out<Windows::Foundation::IUriRuntimeClass> value) noexcept override
{
try
{
typename D::abi_guard guard(this->shim());
*value = detach_abi(this->shim().ResourceUri());
return S_OK;
}
catch (...)
{
*value = nullptr;
return impl::to_hresult();
}
}
HRESULT __stdcall get_ResourceByteRangeOffset(impl::abi_arg_out<Windows::Foundation::IReference<uint64_t>> value) noexcept override
{
try
{
typename D::abi_guard guard(this->shim());
*value = detach_abi(this->shim().ResourceByteRangeOffset());
return S_OK;
}
catch (...)
{
*value = nullptr;
return impl::to_hresult();
}
}
HRESULT __stdcall get_ResourceByteRangeLength(impl::abi_arg_out<Windows::Foundation::IReference<uint64_t>> value) noexcept override
{
try
{
typename D::abi_guard guard(this->shim());
*value = detach_abi(this->shim().ResourceByteRangeLength());
return S_OK;
}
catch (...)
{
*value = nullptr;
return impl::to_hresult();
}
}
HRESULT __stdcall get_Bitrate(impl::abi_arg_out<Windows::Foundation::IReference<uint32_t>> value) noexcept override
{
try
{
typename D::abi_guard guard(this->shim());
*value = detach_abi(this->shim().Bitrate());
return S_OK;
}
catch (...)
{
*value = nullptr;
return impl::to_hresult();
}
}
};
template <typename D>
struct produce<D, Windows::Media::Streaming::Adaptive::IAdaptiveMediaSourceDiagnostics> : produce_base<D, Windows::Media::Streaming::Adaptive::IAdaptiveMediaSourceDiagnostics>
{
HRESULT __stdcall add_DiagnosticAvailable(impl::abi_arg_in<Windows::Foundation::TypedEventHandler<Windows::Media::Streaming::Adaptive::AdaptiveMediaSourceDiagnostics, Windows::Media::Streaming::Adaptive::AdaptiveMediaSourceDiagnosticAvailableEventArgs>> handler, event_token * token) noexcept override
{
try
{
typename D::abi_guard guard(this->shim());
*token = detach_abi(this->shim().DiagnosticAvailable(*reinterpret_cast<const Windows::Foundation::TypedEventHandler<Windows::Media::Streaming::Adaptive::AdaptiveMediaSourceDiagnostics, Windows::Media::Streaming::Adaptive::AdaptiveMediaSourceDiagnosticAvailableEventArgs> *>(&handler)));
return S_OK;
}
catch (...)
{
return impl::to_hresult();
}
}
HRESULT __stdcall remove_DiagnosticAvailable(event_token token) noexcept override
{
try
{
typename D::abi_guard guard(this->shim());
this->shim().DiagnosticAvailable(token);
return S_OK;
}
catch (...)
{
return impl::to_hresult();
}
}
};
template <typename D>
struct produce<D, Windows::Media::Streaming::Adaptive::IAdaptiveMediaSourceDownloadBitrateChangedEventArgs> : produce_base<D, Windows::Media::Streaming::Adaptive::IAdaptiveMediaSourceDownloadBitrateChangedEventArgs>
{
HRESULT __stdcall get_OldValue(uint32_t * value) noexcept override
{
try
{
typename D::abi_guard guard(this->shim());
*value = detach_abi(this->shim().OldValue());
return S_OK;
}
catch (...)
{
return impl::to_hresult();
}
}
HRESULT __stdcall get_NewValue(uint32_t * value) noexcept override
{
try
{
typename D::abi_guard guard(this->shim());
*value = detach_abi(this->shim().NewValue());
return S_OK;
}
catch (...)
{
return impl::to_hresult();
}
}
};
template <typename D>
struct produce<D, Windows::Media::Streaming::Adaptive::IAdaptiveMediaSourceDownloadBitrateChangedEventArgs2> : produce_base<D, Windows::Media::Streaming::Adaptive::IAdaptiveMediaSourceDownloadBitrateChangedEventArgs2>
{
HRESULT __stdcall get_Reason(Windows::Media::Streaming::Adaptive::AdaptiveMediaSourceDownloadBitrateChangedReason * value) noexcept override
{
try
{
typename D::abi_guard guard(this->shim());
*value = detach_abi(this->shim().Reason());
return S_OK;
}
catch (...)
{
return impl::to_hresult();
}
}
};
template <typename D>
struct produce<D, Windows::Media::Streaming::Adaptive::IAdaptiveMediaSourceDownloadCompletedEventArgs> : produce_base<D, Windows::Media::Streaming::Adaptive::IAdaptiveMediaSourceDownloadCompletedEventArgs>
{
HRESULT __stdcall get_ResourceType(Windows::Media::Streaming::Adaptive::AdaptiveMediaSourceResourceType * value) noexcept override
{
try
{
typename D::abi_guard guard(this->shim());
*value = detach_abi(this->shim().ResourceType());
return S_OK;
}
catch (...)
{
return impl::to_hresult();
}
}
HRESULT __stdcall get_ResourceUri(impl::abi_arg_out<Windows::Foundation::IUriRuntimeClass> value) noexcept override
{
try
{
typename D::abi_guard guard(this->shim());
*value = detach_abi(this->shim().ResourceUri());
return S_OK;
}
catch (...)
{
*value = nullptr;
return impl::to_hresult();
}
}
HRESULT __stdcall get_ResourceByteRangeOffset(impl::abi_arg_out<Windows::Foundation::IReference<uint64_t>> value) noexcept override
{
try
{
typename D::abi_guard guard(this->shim());
*value = detach_abi(this->shim().ResourceByteRangeOffset());
return S_OK;
}
catch (...)
{
*value = nullptr;
return impl::to_hresult();
}
}
HRESULT __stdcall get_ResourceByteRangeLength(impl::abi_arg_out<Windows::Foundation::IReference<uint64_t>> value) noexcept override
{
try
{
typename D::abi_guard guard(this->shim());
*value = detach_abi(this->shim().ResourceByteRangeLength());
return S_OK;
}
catch (...)
{
*value = nullptr;
return impl::to_hresult();
}
}
HRESULT __stdcall get_HttpResponseMessage(impl::abi_arg_out<Windows::Web::Http::IHttpResponseMessage> value) noexcept override
{
try
{
typename D::abi_guard guard(this->shim());
*value = detach_abi(this->shim().HttpResponseMessage());
return S_OK;
}
catch (...)
{
*value = nullptr;
return impl::to_hresult();
}
}
};
template <typename D>
struct produce<D, Windows::Media::Streaming::Adaptive::IAdaptiveMediaSourceDownloadCompletedEventArgs2> : produce_base<D, Windows::Media::Streaming::Adaptive::IAdaptiveMediaSourceDownloadCompletedEventArgs2>
{
HRESULT __stdcall get_RequestId(int32_t * value) noexcept override
{
try
{
typename D::abi_guard guard(this->shim());
*value = detach_abi(this->shim().RequestId());
return S_OK;
}
catch (...)
{
return impl::to_hresult();
}
}
HRESULT __stdcall get_Statistics(impl::abi_arg_out<Windows::Media::Streaming::Adaptive::IAdaptiveMediaSourceDownloadStatistics> value) noexcept override
{
try
{
typename D::abi_guard guard(this->shim());
*value = detach_abi(this->shim().Statistics());
return S_OK;
}
catch (...)
{
*value = nullptr;
return impl::to_hresult();
}
}
HRESULT __stdcall get_Position(impl::abi_arg_out<Windows::Foundation::IReference<Windows::Foundation::TimeSpan>> value) noexcept override
{
try
{
typename D::abi_guard guard(this->shim());
*value = detach_abi(this->shim().Position());
return S_OK;
}
catch (...)
{
*value = nullptr;
return impl::to_hresult();
}
}
};
template <typename D>
struct produce<D, Windows::Media::Streaming::Adaptive::IAdaptiveMediaSourceDownloadFailedEventArgs> : produce_base<D, Windows::Media::Streaming::Adaptive::IAdaptiveMediaSourceDownloadFailedEventArgs>
{
HRESULT __stdcall get_ResourceType(Windows::Media::Streaming::Adaptive::AdaptiveMediaSourceResourceType * value) noexcept override
{
try
{
typename D::abi_guard guard(this->shim());
*value = detach_abi(this->shim().ResourceType());
return S_OK;
}
catch (...)
{
return impl::to_hresult();
}
}
HRESULT __stdcall get_ResourceUri(impl::abi_arg_out<Windows::Foundation::IUriRuntimeClass> value) noexcept override
{
try
{
typename D::abi_guard guard(this->shim());
*value = detach_abi(this->shim().ResourceUri());
return S_OK;
}
catch (...)
{
*value = nullptr;
return impl::to_hresult();
}
}
HRESULT __stdcall get_ResourceByteRangeOffset(impl::abi_arg_out<Windows::Foundation::IReference<uint64_t>> value) noexcept override
{
try
{
typename D::abi_guard guard(this->shim());
*value = detach_abi(this->shim().ResourceByteRangeOffset());
return S_OK;
}
catch (...)
{
*value = nullptr;
return impl::to_hresult();
}
}
HRESULT __stdcall get_ResourceByteRangeLength(impl::abi_arg_out<Windows::Foundation::IReference<uint64_t>> value) noexcept override
{
try
{
typename D::abi_guard guard(this->shim());
*value = detach_abi(this->shim().ResourceByteRangeLength());
return S_OK;
}
catch (...)
{
*value = nullptr;
return impl::to_hresult();
}
}
HRESULT __stdcall get_HttpResponseMessage(impl::abi_arg_out<Windows::Web::Http::IHttpResponseMessage> value) noexcept override
{
try
{
typename D::abi_guard guard(this->shim());
*value = detach_abi(this->shim().HttpResponseMessage());
return S_OK;
}
catch (...)
{
*value = nullptr;
return impl::to_hresult();
}
}
};
template <typename D>
struct produce<D, Windows::Media::Streaming::Adaptive::IAdaptiveMediaSourceDownloadFailedEventArgs2> : produce_base<D, Windows::Media::Streaming::Adaptive::IAdaptiveMediaSourceDownloadFailedEventArgs2>
{
HRESULT __stdcall get_RequestId(int32_t * value) noexcept override
{
try
{
typename D::abi_guard guard(this->shim());
*value = detach_abi(this->shim().RequestId());
return S_OK;
}
catch (...)
{
return impl::to_hresult();
}
}
HRESULT __stdcall get_ExtendedError(HRESULT * value) noexcept override
{
try
{
typename D::abi_guard guard(this->shim());
*value = detach_abi(this->shim().ExtendedError());
return S_OK;
}
catch (...)
{
return impl::to_hresult();
}
}
HRESULT __stdcall get_Statistics(impl::abi_arg_out<Windows::Media::Streaming::Adaptive::IAdaptiveMediaSourceDownloadStatistics> value) noexcept override
{
try
{
typename D::abi_guard guard(this->shim());
*value = detach_abi(this->shim().Statistics());
return S_OK;
}
catch (...)
{
*value = nullptr;
return impl::to_hresult();
}
}
HRESULT __stdcall get_Position(impl::abi_arg_out<Windows::Foundation::IReference<Windows::Foundation::TimeSpan>> value) noexcept override
{
try
{
typename D::abi_guard guard(this->shim());
*value = detach_abi(this->shim().Position());
return S_OK;
}
catch (...)
{
*value = nullptr;
return impl::to_hresult();
}
}
};
template <typename D>
struct produce<D, Windows::Media::Streaming::Adaptive::IAdaptiveMediaSourceDownloadRequestedDeferral> : produce_base<D, Windows::Media::Streaming::Adaptive::IAdaptiveMediaSourceDownloadRequestedDeferral>
{
HRESULT __stdcall abi_Complete() noexcept override
{
try
{
typename D::abi_guard guard(this->shim());
this->shim().Complete();
return S_OK;
}
catch (...)
{
return impl::to_hresult();
}
}
};
template <typename D>
struct produce<D, Windows::Media::Streaming::Adaptive::IAdaptiveMediaSourceDownloadRequestedEventArgs> : produce_base<D, Windows::Media::Streaming::Adaptive::IAdaptiveMediaSourceDownloadRequestedEventArgs>
{
HRESULT __stdcall get_ResourceType(Windows::Media::Streaming::Adaptive::AdaptiveMediaSourceResourceType * value) noexcept override
{
try
{
typename D::abi_guard guard(this->shim());
*value = detach_abi(this->shim().ResourceType());
return S_OK;
}
catch (...)
{
return impl::to_hresult();
}
}
HRESULT __stdcall get_ResourceUri(impl::abi_arg_out<Windows::Foundation::IUriRuntimeClass> value) noexcept override
{
try
{
typename D::abi_guard guard(this->shim());
*value = detach_abi(this->shim().ResourceUri());
return S_OK;
}
catch (...)
{
*value = nullptr;
return impl::to_hresult();
}
}
HRESULT __stdcall get_ResourceByteRangeOffset(impl::abi_arg_out<Windows::Foundation::IReference<uint64_t>> value) noexcept override
{
try
{
typename D::abi_guard guard(this->shim());
*value = detach_abi(this->shim().ResourceByteRangeOffset());
return S_OK;
}
catch (...)
{
*value = nullptr;
return impl::to_hresult();
}
}
HRESULT __stdcall get_ResourceByteRangeLength(impl::abi_arg_out<Windows::Foundation::IReference<uint64_t>> value) noexcept override
{
try
{
typename D::abi_guard guard(this->shim());
*value = detach_abi(this->shim().ResourceByteRangeLength());
return S_OK;
}
catch (...)
{
*value = nullptr;
return impl::to_hresult();
}
}
HRESULT __stdcall get_Result(impl::abi_arg_out<Windows::Media::Streaming::Adaptive::IAdaptiveMediaSourceDownloadResult> value) noexcept override
{
try
{
typename D::abi_guard guard(this->shim());
*value = detach_abi(this->shim().Result());
return S_OK;
}
catch (...)
{
*value = nullptr;
return impl::to_hresult();
}
}
HRESULT __stdcall abi_GetDeferral(impl::abi_arg_out<Windows::Media::Streaming::Adaptive::IAdaptiveMediaSourceDownloadRequestedDeferral> deferral) noexcept override
{
try
{
typename D::abi_guard guard(this->shim());
*deferral = detach_abi(this->shim().GetDeferral());
return S_OK;
}
catch (...)
{
*deferral = nullptr;
return impl::to_hresult();
}
}
};
template <typename D>
struct produce<D, Windows::Media::Streaming::Adaptive::IAdaptiveMediaSourceDownloadRequestedEventArgs2> : produce_base<D, Windows::Media::Streaming::Adaptive::IAdaptiveMediaSourceDownloadRequestedEventArgs2>
{
HRESULT __stdcall get_RequestId(int32_t * value) noexcept override
{
try
{
typename D::abi_guard guard(this->shim());
*value = detach_abi(this->shim().RequestId());
return S_OK;
}
catch (...)
{
return impl::to_hresult();
}
}
HRESULT __stdcall get_Position(impl::abi_arg_out<Windows::Foundation::IReference<Windows::Foundation::TimeSpan>> value) noexcept override
{
try
{
typename D::abi_guard guard(this->shim());
*value = detach_abi(this->shim().Position());
return S_OK;
}
catch (...)
{
*value = nullptr;
return impl::to_hresult();
}
}
};
template <typename D>
struct produce<D, Windows::Media::Streaming::Adaptive::IAdaptiveMediaSourceDownloadResult> : produce_base<D, Windows::Media::Streaming::Adaptive::IAdaptiveMediaSourceDownloadResult>
{
HRESULT __stdcall get_ResourceUri(impl::abi_arg_out<Windows::Foundation::IUriRuntimeClass> value) noexcept override
{
try
{
typename D::abi_guard guard(this->shim());
*value = detach_abi(this->shim().ResourceUri());
return S_OK;
}
catch (...)
{
*value = nullptr;
return impl::to_hresult();
}
}
HRESULT __stdcall put_ResourceUri(impl::abi_arg_in<Windows::Foundation::IUriRuntimeClass> value) noexcept override
{
try
{
typename D::abi_guard guard(this->shim());
this->shim().ResourceUri(*reinterpret_cast<const Windows::Foundation::Uri *>(&value));
return S_OK;
}
catch (...)
{
return impl::to_hresult();
}
}
HRESULT __stdcall get_InputStream(impl::abi_arg_out<Windows::Storage::Streams::IInputStream> value) noexcept override
{
try
{
typename D::abi_guard guard(this->shim());
*value = detach_abi(this->shim().InputStream());
return S_OK;
}
catch (...)
{
*value = nullptr;
return impl::to_hresult();
}
}
HRESULT __stdcall put_InputStream(impl::abi_arg_in<Windows::Storage::Streams::IInputStream> value) noexcept override
{
try
{
typename D::abi_guard guard(this->shim());
this->shim().InputStream(*reinterpret_cast<const Windows::Storage::Streams::IInputStream *>(&value));
return S_OK;
}
catch (...)
{
return impl::to_hresult();
}
}
HRESULT __stdcall get_Buffer(impl::abi_arg_out<Windows::Storage::Streams::IBuffer> value) noexcept override
{
try
{
typename D::abi_guard guard(this->shim());
*value = detach_abi(this->shim().Buffer());
return S_OK;
}
catch (...)
{
*value = nullptr;
return impl::to_hresult();
}
}
HRESULT __stdcall put_Buffer(impl::abi_arg_in<Windows::Storage::Streams::IBuffer> value) noexcept override
{
try
{
typename D::abi_guard guard(this->shim());
this->shim().Buffer(*reinterpret_cast<const Windows::Storage::Streams::IBuffer *>(&value));
return S_OK;
}
catch (...)
{
return impl::to_hresult();
}
}
HRESULT __stdcall get_ContentType(impl::abi_arg_out<hstring> value) noexcept override
{
try
{
typename D::abi_guard guard(this->shim());
*value = detach_abi(this->shim().ContentType());
return S_OK;
}
catch (...)
{
*value = nullptr;
return impl::to_hresult();
}
}
HRESULT __stdcall put_ContentType(impl::abi_arg_in<hstring> value) noexcept override
{
try
{
typename D::abi_guard guard(this->shim());
this->shim().ContentType(*reinterpret_cast<const hstring *>(&value));
return S_OK;
}
catch (...)
{
return impl::to_hresult();
}
}
HRESULT __stdcall get_ExtendedStatus(uint32_t * value) noexcept override
{
try
{
typename D::abi_guard guard(this->shim());
*value = detach_abi(this->shim().ExtendedStatus());
return S_OK;
}
catch (...)
{
return impl::to_hresult();
}
}
HRESULT __stdcall put_ExtendedStatus(uint32_t value) noexcept override
{
try
{
typename D::abi_guard guard(this->shim());
this->shim().ExtendedStatus(value);
return S_OK;
}
catch (...)
{
return impl::to_hresult();
}
}
};
template <typename D>
struct produce<D, Windows::Media::Streaming::Adaptive::IAdaptiveMediaSourceDownloadResult2> : produce_base<D, Windows::Media::Streaming::Adaptive::IAdaptiveMediaSourceDownloadResult2>
{
HRESULT __stdcall get_ResourceByteRangeOffset(impl::abi_arg_out<Windows::Foundation::IReference<uint64_t>> value) noexcept override
{
try
{
typename D::abi_guard guard(this->shim());
*value = detach_abi(this->shim().ResourceByteRangeOffset());
return S_OK;
}
catch (...)
{
*value = nullptr;
return impl::to_hresult();
}
}
HRESULT __stdcall put_ResourceByteRangeOffset(impl::abi_arg_in<Windows::Foundation::IReference<uint64_t>> value) noexcept override
{
try
{
typename D::abi_guard guard(this->shim());
this->shim().ResourceByteRangeOffset(*reinterpret_cast<const Windows::Foundation::IReference<uint64_t> *>(&value));
return S_OK;
}
catch (...)
{
return impl::to_hresult();
}
}
HRESULT __stdcall get_ResourceByteRangeLength(impl::abi_arg_out<Windows::Foundation::IReference<uint64_t>> value) noexcept override
{
try
{
typename D::abi_guard guard(this->shim());
*value = detach_abi(this->shim().ResourceByteRangeLength());
return S_OK;
}
catch (...)
{
*value = nullptr;
return impl::to_hresult();
}
}
HRESULT __stdcall put_ResourceByteRangeLength(impl::abi_arg_in<Windows::Foundation::IReference<uint64_t>> value) noexcept override
{
try
{
typename D::abi_guard guard(this->shim());
this->shim().ResourceByteRangeLength(*reinterpret_cast<const Windows::Foundation::IReference<uint64_t> *>(&value));
return S_OK;
}
catch (...)
{
return impl::to_hresult();
}
}
};
template <typename D>
struct produce<D, Windows::Media::Streaming::Adaptive::IAdaptiveMediaSourceDownloadStatistics> : produce_base<D, Windows::Media::Streaming::Adaptive::IAdaptiveMediaSourceDownloadStatistics>
{
HRESULT __stdcall get_ContentBytesReceivedCount(uint64_t * value) noexcept override
{
try
{
typename D::abi_guard guard(this->shim());
*value = detach_abi(this->shim().ContentBytesReceivedCount());
return S_OK;
}
catch (...)
{
return impl::to_hresult();
}
}
HRESULT __stdcall get_TimeToHeadersReceived(impl::abi_arg_out<Windows::Foundation::IReference<Windows::Foundation::TimeSpan>> value) noexcept override
{
try
{
typename D::abi_guard guard(this->shim());
*value = detach_abi(this->shim().TimeToHeadersReceived());
return S_OK;
}
catch (...)
{
*value = nullptr;
return impl::to_hresult();
}
}
HRESULT __stdcall get_TimeToFirstByteReceived(impl::abi_arg_out<Windows::Foundation::IReference<Windows::Foundation::TimeSpan>> value) noexcept override
{
try
{
typename D::abi_guard guard(this->shim());
*value = detach_abi(this->shim().TimeToFirstByteReceived());
return S_OK;
}
catch (...)
{
*value = nullptr;
return impl::to_hresult();
}
}
HRESULT __stdcall get_TimeToLastByteReceived(impl::abi_arg_out<Windows::Foundation::IReference<Windows::Foundation::TimeSpan>> value) noexcept override
{
try
{
typename D::abi_guard guard(this->shim());
*value = detach_abi(this->shim().TimeToLastByteReceived());
return S_OK;
}
catch (...)
{
*value = nullptr;
return impl::to_hresult();
}
}
};
template <typename D>
struct produce<D, Windows::Media::Streaming::Adaptive::IAdaptiveMediaSourcePlaybackBitrateChangedEventArgs> : produce_base<D, Windows::Media::Streaming::Adaptive::IAdaptiveMediaSourcePlaybackBitrateChangedEventArgs>
{
HRESULT __stdcall get_OldValue(uint32_t * value) noexcept override
{
try
{
typename D::abi_guard guard(this->shim());
*value = detach_abi(this->shim().OldValue());
return S_OK;
}
catch (...)
{
return impl::to_hresult();
}
}
HRESULT __stdcall get_NewValue(uint32_t * value) noexcept override
{
try
{
typename D::abi_guard guard(this->shim());
*value = detach_abi(this->shim().NewValue());
return S_OK;
}
catch (...)
{
return impl::to_hresult();
}
}
HRESULT __stdcall get_AudioOnly(bool * value) noexcept override
{
try
{
typename D::abi_guard guard(this->shim());
*value = detach_abi(this->shim().AudioOnly());
return S_OK;
}
catch (...)
{
return impl::to_hresult();
}
}
};
template <typename D>
struct produce<D, Windows::Media::Streaming::Adaptive::IAdaptiveMediaSourceStatics> : produce_base<D, Windows::Media::Streaming::Adaptive::IAdaptiveMediaSourceStatics>
{
HRESULT __stdcall abi_IsContentTypeSupported(impl::abi_arg_in<hstring> contentType, bool * result) noexcept override
{
try
{
typename D::abi_guard guard(this->shim());
*result = detach_abi(this->shim().IsContentTypeSupported(*reinterpret_cast<const hstring *>(&contentType)));
return S_OK;
}
catch (...)
{
return impl::to_hresult();
}
}
HRESULT __stdcall abi_CreateFromUriAsync(impl::abi_arg_in<Windows::Foundation::IUriRuntimeClass> uri, impl::abi_arg_out<Windows::Foundation::IAsyncOperation<Windows::Media::Streaming::Adaptive::AdaptiveMediaSourceCreationResult>> result) noexcept override
{
try
{
typename D::abi_guard guard(this->shim());
*result = detach_abi(this->shim().CreateFromUriAsync(*reinterpret_cast<const Windows::Foundation::Uri *>(&uri)));
return S_OK;
}
catch (...)
{
*result = nullptr;
return impl::to_hresult();
}
}
HRESULT __stdcall abi_CreateFromUriWithDownloaderAsync(impl::abi_arg_in<Windows::Foundation::IUriRuntimeClass> uri, impl::abi_arg_in<Windows::Web::Http::IHttpClient> httpClient, impl::abi_arg_out<Windows::Foundation::IAsyncOperation<Windows::Media::Streaming::Adaptive::AdaptiveMediaSourceCreationResult>> result) noexcept override
{
try
{
typename D::abi_guard guard(this->shim());
*result = detach_abi(this->shim().CreateFromUriAsync(*reinterpret_cast<const Windows::Foundation::Uri *>(&uri), *reinterpret_cast<const Windows::Web::Http::HttpClient *>(&httpClient)));
return S_OK;
}
catch (...)
{
*result = nullptr;
return impl::to_hresult();
}
}
HRESULT __stdcall abi_CreateFromStreamAsync(impl::abi_arg_in<Windows::Storage::Streams::IInputStream> stream, impl::abi_arg_in<Windows::Foundation::IUriRuntimeClass> uri, impl::abi_arg_in<hstring> contentType, impl::abi_arg_out<Windows::Foundation::IAsyncOperation<Windows::Media::Streaming::Adaptive::AdaptiveMediaSourceCreationResult>> result) noexcept override
{
try
{
typename D::abi_guard guard(this->shim());
*result = detach_abi(this->shim().CreateFromStreamAsync(*reinterpret_cast<const Windows::Storage::Streams::IInputStream *>(&stream), *reinterpret_cast<const Windows::Foundation::Uri *>(&uri), *reinterpret_cast<const hstring *>(&contentType)));
return S_OK;
}
catch (...)
{
*result = nullptr;
return impl::to_hresult();
}
}
HRESULT __stdcall abi_CreateFromStreamWithDownloaderAsync(impl::abi_arg_in<Windows::Storage::Streams::IInputStream> stream, impl::abi_arg_in<Windows::Foundation::IUriRuntimeClass> uri, impl::abi_arg_in<hstring> contentType, impl::abi_arg_in<Windows::Web::Http::IHttpClient> httpClient, impl::abi_arg_out<Windows::Foundation::IAsyncOperation<Windows::Media::Streaming::Adaptive::AdaptiveMediaSourceCreationResult>> result) noexcept override
{
try
{
typename D::abi_guard guard(this->shim());
*result = detach_abi(this->shim().CreateFromStreamAsync(*reinterpret_cast<const Windows::Storage::Streams::IInputStream *>(&stream), *reinterpret_cast<const Windows::Foundation::Uri *>(&uri), *reinterpret_cast<const hstring *>(&contentType), *reinterpret_cast<const Windows::Web::Http::HttpClient *>(&httpClient)));
return S_OK;
}
catch (...)
{
*result = nullptr;
return impl::to_hresult();
}
}
};
}
namespace Windows::Media::Streaming::Adaptive {
template <typename D> Windows::Media::Streaming::Adaptive::AdaptiveMediaSourceCreationStatus impl_IAdaptiveMediaSourceCreationResult<D>::Status() const
{
Windows::Media::Streaming::Adaptive::AdaptiveMediaSourceCreationStatus value {};
check_hresult(WINRT_SHIM(IAdaptiveMediaSourceCreationResult)->get_Status(&value));
return value;
}
template <typename D> Windows::Media::Streaming::Adaptive::AdaptiveMediaSource impl_IAdaptiveMediaSourceCreationResult<D>::MediaSource() const
{
Windows::Media::Streaming::Adaptive::AdaptiveMediaSource value { nullptr };
check_hresult(WINRT_SHIM(IAdaptiveMediaSourceCreationResult)->get_MediaSource(put_abi(value)));
return value;
}
template <typename D> Windows::Web::Http::HttpResponseMessage impl_IAdaptiveMediaSourceCreationResult<D>::HttpResponseMessage() const
{
Windows::Web::Http::HttpResponseMessage value { nullptr };
check_hresult(WINRT_SHIM(IAdaptiveMediaSourceCreationResult)->get_HttpResponseMessage(put_abi(value)));
return value;
}
template <typename D> HRESULT impl_IAdaptiveMediaSourceCreationResult2<D>::ExtendedError() const
{
HRESULT value {};
check_hresult(WINRT_SHIM(IAdaptiveMediaSourceCreationResult2)->get_ExtendedError(&value));
return value;
}
template <typename D> bool impl_IAdaptiveMediaSourceStatics<D>::IsContentTypeSupported(hstring_view contentType) const
{
bool result {};
check_hresult(WINRT_SHIM(IAdaptiveMediaSourceStatics)->abi_IsContentTypeSupported(get_abi(contentType), &result));
return result;
}
template <typename D> Windows::Foundation::IAsyncOperation<Windows::Media::Streaming::Adaptive::AdaptiveMediaSourceCreationResult> impl_IAdaptiveMediaSourceStatics<D>::CreateFromUriAsync(const Windows::Foundation::Uri & uri) const
{
Windows::Foundation::IAsyncOperation<Windows::Media::Streaming::Adaptive::AdaptiveMediaSourceCreationResult> result;
check_hresult(WINRT_SHIM(IAdaptiveMediaSourceStatics)->abi_CreateFromUriAsync(get_abi(uri), put_abi(result)));
return result;
}
template <typename D> Windows::Foundation::IAsyncOperation<Windows::Media::Streaming::Adaptive::AdaptiveMediaSourceCreationResult> impl_IAdaptiveMediaSourceStatics<D>::CreateFromUriAsync(const Windows::Foundation::Uri & uri, const Windows::Web::Http::HttpClient & httpClient) const
{
Windows::Foundation::IAsyncOperation<Windows::Media::Streaming::Adaptive::AdaptiveMediaSourceCreationResult> result;
check_hresult(WINRT_SHIM(IAdaptiveMediaSourceStatics)->abi_CreateFromUriWithDownloaderAsync(get_abi(uri), get_abi(httpClient), put_abi(result)));
return result;
}
template <typename D> Windows::Foundation::IAsyncOperation<Windows::Media::Streaming::Adaptive::AdaptiveMediaSourceCreationResult> impl_IAdaptiveMediaSourceStatics<D>::CreateFromStreamAsync(const Windows::Storage::Streams::IInputStream & stream, const Windows::Foundation::Uri & uri, hstring_view contentType) const
{
Windows::Foundation::IAsyncOperation<Windows::Media::Streaming::Adaptive::AdaptiveMediaSourceCreationResult> result;
check_hresult(WINRT_SHIM(IAdaptiveMediaSourceStatics)->abi_CreateFromStreamAsync(get_abi(stream), get_abi(uri), get_abi(contentType), put_abi(result)));
return result;
}
template <typename D> Windows::Foundation::IAsyncOperation<Windows::Media::Streaming::Adaptive::AdaptiveMediaSourceCreationResult> impl_IAdaptiveMediaSourceStatics<D>::CreateFromStreamAsync(const Windows::Storage::Streams::IInputStream & stream, const Windows::Foundation::Uri & uri, hstring_view contentType, const Windows::Web::Http::HttpClient & httpClient) const
{
Windows::Foundation::IAsyncOperation<Windows::Media::Streaming::Adaptive::AdaptiveMediaSourceCreationResult> result;
check_hresult(WINRT_SHIM(IAdaptiveMediaSourceStatics)->abi_CreateFromStreamWithDownloaderAsync(get_abi(stream), get_abi(uri), get_abi(contentType), get_abi(httpClient), put_abi(result)));
return result;
}
template <typename D> bool impl_IAdaptiveMediaSource<D>::IsLive() const
{
bool value {};
check_hresult(WINRT_SHIM(IAdaptiveMediaSource)->get_IsLive(&value));
return value;
}
template <typename D> Windows::Foundation::TimeSpan impl_IAdaptiveMediaSource<D>::DesiredLiveOffset() const
{
Windows::Foundation::TimeSpan value {};
check_hresult(WINRT_SHIM(IAdaptiveMediaSource)->get_DesiredLiveOffset(put_abi(value)));
return value;
}
template <typename D> void impl_IAdaptiveMediaSource<D>::DesiredLiveOffset(const Windows::Foundation::TimeSpan & value) const
{
check_hresult(WINRT_SHIM(IAdaptiveMediaSource)->put_DesiredLiveOffset(get_abi(value)));
}
template <typename D> uint32_t impl_IAdaptiveMediaSource<D>::InitialBitrate() const
{
uint32_t value {};
check_hresult(WINRT_SHIM(IAdaptiveMediaSource)->get_InitialBitrate(&value));
return value;
}
template <typename D> void impl_IAdaptiveMediaSource<D>::InitialBitrate(uint32_t value) const
{
check_hresult(WINRT_SHIM(IAdaptiveMediaSource)->put_InitialBitrate(value));
}
template <typename D> uint32_t impl_IAdaptiveMediaSource<D>::CurrentDownloadBitrate() const
{
uint32_t value {};
check_hresult(WINRT_SHIM(IAdaptiveMediaSource)->get_CurrentDownloadBitrate(&value));
return value;
}
template <typename D> uint32_t impl_IAdaptiveMediaSource<D>::CurrentPlaybackBitrate() const
{
uint32_t value {};
check_hresult(WINRT_SHIM(IAdaptiveMediaSource)->get_CurrentPlaybackBitrate(&value));
return value;
}
template <typename D> Windows::Foundation::Collections::IVectorView<uint32_t> impl_IAdaptiveMediaSource<D>::AvailableBitrates() const
{
Windows::Foundation::Collections::IVectorView<uint32_t> value;
check_hresult(WINRT_SHIM(IAdaptiveMediaSource)->get_AvailableBitrates(put_abi(value)));
return value;
}
template <typename D> Windows::Foundation::IReference<uint32_t> impl_IAdaptiveMediaSource<D>::DesiredMinBitrate() const
{
Windows::Foundation::IReference<uint32_t> value;
check_hresult(WINRT_SHIM(IAdaptiveMediaSource)->get_DesiredMinBitrate(put_abi(value)));
return value;
}
template <typename D> void impl_IAdaptiveMediaSource<D>::DesiredMinBitrate(const optional<uint32_t> & value) const
{
check_hresult(WINRT_SHIM(IAdaptiveMediaSource)->put_DesiredMinBitrate(get_abi(value)));
}
template <typename D> Windows::Foundation::IReference<uint32_t> impl_IAdaptiveMediaSource<D>::DesiredMaxBitrate() const
{
Windows::Foundation::IReference<uint32_t> value;
check_hresult(WINRT_SHIM(IAdaptiveMediaSource)->get_DesiredMaxBitrate(put_abi(value)));
return value;
}
template <typename D> void impl_IAdaptiveMediaSource<D>::DesiredMaxBitrate(const optional<uint32_t> & value) const
{
check_hresult(WINRT_SHIM(IAdaptiveMediaSource)->put_DesiredMaxBitrate(get_abi(value)));
}
template <typename D> bool impl_IAdaptiveMediaSource<D>::AudioOnlyPlayback() const
{
bool value {};
check_hresult(WINRT_SHIM(IAdaptiveMediaSource)->get_AudioOnlyPlayback(&value));
return value;
}
template <typename D> uint64_t impl_IAdaptiveMediaSource<D>::InboundBitsPerSecond() const
{
uint64_t value {};
check_hresult(WINRT_SHIM(IAdaptiveMediaSource)->get_InboundBitsPerSecond(&value));
return value;
}
template <typename D> Windows::Foundation::TimeSpan impl_IAdaptiveMediaSource<D>::InboundBitsPerSecondWindow() const
{
Windows::Foundation::TimeSpan value {};
check_hresult(WINRT_SHIM(IAdaptiveMediaSource)->get_InboundBitsPerSecondWindow(put_abi(value)));
return value;
}
template <typename D> void impl_IAdaptiveMediaSource<D>::InboundBitsPerSecondWindow(const Windows::Foundation::TimeSpan & value) const
{
check_hresult(WINRT_SHIM(IAdaptiveMediaSource)->put_InboundBitsPerSecondWindow(get_abi(value)));
}
template <typename D> event_token impl_IAdaptiveMediaSource<D>::DownloadBitrateChanged(const Windows::Foundation::TypedEventHandler<Windows::Media::Streaming::Adaptive::AdaptiveMediaSource, Windows::Media::Streaming::Adaptive::AdaptiveMediaSourceDownloadBitrateChangedEventArgs> & handler) const
{
event_token token {};
check_hresult(WINRT_SHIM(IAdaptiveMediaSource)->add_DownloadBitrateChanged(get_abi(handler), &token));
return token;
}
template <typename D> event_revoker<IAdaptiveMediaSource> impl_IAdaptiveMediaSource<D>::DownloadBitrateChanged(auto_revoke_t, const Windows::Foundation::TypedEventHandler<Windows::Media::Streaming::Adaptive::AdaptiveMediaSource, Windows::Media::Streaming::Adaptive::AdaptiveMediaSourceDownloadBitrateChangedEventArgs> & handler) const
{
return impl::make_event_revoker<D, IAdaptiveMediaSource>(this, &ABI::Windows::Media::Streaming::Adaptive::IAdaptiveMediaSource::remove_DownloadBitrateChanged, DownloadBitrateChanged(handler));
}
template <typename D> void impl_IAdaptiveMediaSource<D>::DownloadBitrateChanged(event_token token) const
{
check_hresult(WINRT_SHIM(IAdaptiveMediaSource)->remove_DownloadBitrateChanged(token));
}
template <typename D> event_token impl_IAdaptiveMediaSource<D>::PlaybackBitrateChanged(const Windows::Foundation::TypedEventHandler<Windows::Media::Streaming::Adaptive::AdaptiveMediaSource, Windows::Media::Streaming::Adaptive::AdaptiveMediaSourcePlaybackBitrateChangedEventArgs> & handler) const
{
event_token token {};
check_hresult(WINRT_SHIM(IAdaptiveMediaSource)->add_PlaybackBitrateChanged(get_abi(handler), &token));
return token;
}
template <typename D> event_revoker<IAdaptiveMediaSource> impl_IAdaptiveMediaSource<D>::PlaybackBitrateChanged(auto_revoke_t, const Windows::Foundation::TypedEventHandler<Windows::Media::Streaming::Adaptive::AdaptiveMediaSource, Windows::Media::Streaming::Adaptive::AdaptiveMediaSourcePlaybackBitrateChangedEventArgs> & handler) const
{
return impl::make_event_revoker<D, IAdaptiveMediaSource>(this, &ABI::Windows::Media::Streaming::Adaptive::IAdaptiveMediaSource::remove_PlaybackBitrateChanged, PlaybackBitrateChanged(handler));
}
template <typename D> void impl_IAdaptiveMediaSource<D>::PlaybackBitrateChanged(event_token token) const
{
check_hresult(WINRT_SHIM(IAdaptiveMediaSource)->remove_PlaybackBitrateChanged(token));
}
template <typename D> event_token impl_IAdaptiveMediaSource<D>::DownloadRequested(const Windows::Foundation::TypedEventHandler<Windows::Media::Streaming::Adaptive::AdaptiveMediaSource, Windows::Media::Streaming::Adaptive::AdaptiveMediaSourceDownloadRequestedEventArgs> & handler) const
{
event_token token {};
check_hresult(WINRT_SHIM(IAdaptiveMediaSource)->add_DownloadRequested(get_abi(handler), &token));
return token;
}
template <typename D> event_revoker<IAdaptiveMediaSource> impl_IAdaptiveMediaSource<D>::DownloadRequested(auto_revoke_t, const Windows::Foundation::TypedEventHandler<Windows::Media::Streaming::Adaptive::AdaptiveMediaSource, Windows::Media::Streaming::Adaptive::AdaptiveMediaSourceDownloadRequestedEventArgs> & handler) const
{
return impl::make_event_revoker<D, IAdaptiveMediaSource>(this, &ABI::Windows::Media::Streaming::Adaptive::IAdaptiveMediaSource::remove_DownloadRequested, DownloadRequested(handler));
}
template <typename D> void impl_IAdaptiveMediaSource<D>::DownloadRequested(event_token token) const
{
check_hresult(WINRT_SHIM(IAdaptiveMediaSource)->remove_DownloadRequested(token));
}
template <typename D> event_token impl_IAdaptiveMediaSource<D>::DownloadCompleted(const Windows::Foundation::TypedEventHandler<Windows::Media::Streaming::Adaptive::AdaptiveMediaSource, Windows::Media::Streaming::Adaptive::AdaptiveMediaSourceDownloadCompletedEventArgs> & handler) const
{
event_token token {};
check_hresult(WINRT_SHIM(IAdaptiveMediaSource)->add_DownloadCompleted(get_abi(handler), &token));
return token;
}
template <typename D> event_revoker<IAdaptiveMediaSource> impl_IAdaptiveMediaSource<D>::DownloadCompleted(auto_revoke_t, const Windows::Foundation::TypedEventHandler<Windows::Media::Streaming::Adaptive::AdaptiveMediaSource, Windows::Media::Streaming::Adaptive::AdaptiveMediaSourceDownloadCompletedEventArgs> & handler) const
{
return impl::make_event_revoker<D, IAdaptiveMediaSource>(this, &ABI::Windows::Media::Streaming::Adaptive::IAdaptiveMediaSource::remove_DownloadCompleted, DownloadCompleted(handler));
}
template <typename D> void impl_IAdaptiveMediaSource<D>::DownloadCompleted(event_token token) const
{
check_hresult(WINRT_SHIM(IAdaptiveMediaSource)->remove_DownloadCompleted(token));
}
template <typename D> event_token impl_IAdaptiveMediaSource<D>::DownloadFailed(const Windows::Foundation::TypedEventHandler<Windows::Media::Streaming::Adaptive::AdaptiveMediaSource, Windows::Media::Streaming::Adaptive::AdaptiveMediaSourceDownloadFailedEventArgs> & handler) const
{
event_token token {};
check_hresult(WINRT_SHIM(IAdaptiveMediaSource)->add_DownloadFailed(get_abi(handler), &token));
return token;
}
template <typename D> event_revoker<IAdaptiveMediaSource> impl_IAdaptiveMediaSource<D>::DownloadFailed(auto_revoke_t, const Windows::Foundation::TypedEventHandler<Windows::Media::Streaming::Adaptive::AdaptiveMediaSource, Windows::Media::Streaming::Adaptive::AdaptiveMediaSourceDownloadFailedEventArgs> & handler) const
{
return impl::make_event_revoker<D, IAdaptiveMediaSource>(this, &ABI::Windows::Media::Streaming::Adaptive::IAdaptiveMediaSource::remove_DownloadFailed, DownloadFailed(handler));
}
template <typename D> void impl_IAdaptiveMediaSource<D>::DownloadFailed(event_token token) const
{
check_hresult(WINRT_SHIM(IAdaptiveMediaSource)->remove_DownloadFailed(token));
}
template <typename D> Windows::Media::Streaming::Adaptive::AdaptiveMediaSourceAdvancedSettings impl_IAdaptiveMediaSource2<D>::AdvancedSettings() const
{
Windows::Media::Streaming::Adaptive::AdaptiveMediaSourceAdvancedSettings value { nullptr };
check_hresult(WINRT_SHIM(IAdaptiveMediaSource2)->get_AdvancedSettings(put_abi(value)));
return value;
}
template <typename D> Windows::Foundation::IReference<Windows::Foundation::TimeSpan> impl_IAdaptiveMediaSource3<D>::MinLiveOffset() const
{
Windows::Foundation::IReference<Windows::Foundation::TimeSpan> value;
check_hresult(WINRT_SHIM(IAdaptiveMediaSource3)->get_MinLiveOffset(put_abi(value)));
return value;
}
template <typename D> Windows::Foundation::IReference<Windows::Foundation::TimeSpan> impl_IAdaptiveMediaSource3<D>::MaxSeekableWindowSize() const
{
Windows::Foundation::IReference<Windows::Foundation::TimeSpan> value;
check_hresult(WINRT_SHIM(IAdaptiveMediaSource3)->get_MaxSeekableWindowSize(put_abi(value)));
return value;
}
template <typename D> Windows::Foundation::IReference<Windows::Foundation::TimeSpan> impl_IAdaptiveMediaSource3<D>::DesiredSeekableWindowSize() const
{
Windows::Foundation::IReference<Windows::Foundation::TimeSpan> value;
check_hresult(WINRT_SHIM(IAdaptiveMediaSource3)->get_DesiredSeekableWindowSize(put_abi(value)));
return value;
}
template <typename D> void impl_IAdaptiveMediaSource3<D>::DesiredSeekableWindowSize(const optional<Windows::Foundation::TimeSpan> & value) const
{
check_hresult(WINRT_SHIM(IAdaptiveMediaSource3)->put_DesiredSeekableWindowSize(get_abi(value)));
}
template <typename D> Windows::Media::Streaming::Adaptive::AdaptiveMediaSourceDiagnostics impl_IAdaptiveMediaSource3<D>::Diagnostics() const
{
Windows::Media::Streaming::Adaptive::AdaptiveMediaSourceDiagnostics value { nullptr };
check_hresult(WINRT_SHIM(IAdaptiveMediaSource3)->get_Diagnostics(put_abi(value)));
return value;
}
template <typename D> Windows::Media::Streaming::Adaptive::AdaptiveMediaSourceCorrelatedTimes impl_IAdaptiveMediaSource3<D>::GetCorrelatedTimes() const
{
Windows::Media::Streaming::Adaptive::AdaptiveMediaSourceCorrelatedTimes value { nullptr };
check_hresult(WINRT_SHIM(IAdaptiveMediaSource3)->abi_GetCorrelatedTimes(put_abi(value)));
return value;
}
template <typename D> bool impl_IAdaptiveMediaSourceAdvancedSettings<D>::AllSegmentsIndependent() const
{
bool value {};
check_hresult(WINRT_SHIM(IAdaptiveMediaSourceAdvancedSettings)->get_AllSegmentsIndependent(&value));
return value;
}
template <typename D> void impl_IAdaptiveMediaSourceAdvancedSettings<D>::AllSegmentsIndependent(bool value) const
{
check_hresult(WINRT_SHIM(IAdaptiveMediaSourceAdvancedSettings)->put_AllSegmentsIndependent(value));
}
template <typename D> Windows::Foundation::IReference<double> impl_IAdaptiveMediaSourceAdvancedSettings<D>::DesiredBitrateHeadroomRatio() const
{
Windows::Foundation::IReference<double> value;
check_hresult(WINRT_SHIM(IAdaptiveMediaSourceAdvancedSettings)->get_DesiredBitrateHeadroomRatio(put_abi(value)));
return value;
}
template <typename D> void impl_IAdaptiveMediaSourceAdvancedSettings<D>::DesiredBitrateHeadroomRatio(const optional<double> & value) const
{
check_hresult(WINRT_SHIM(IAdaptiveMediaSourceAdvancedSettings)->put_DesiredBitrateHeadroomRatio(get_abi(value)));
}
template <typename D> Windows::Foundation::IReference<double> impl_IAdaptiveMediaSourceAdvancedSettings<D>::BitrateDowngradeTriggerRatio() const
{
Windows::Foundation::IReference<double> value;
check_hresult(WINRT_SHIM(IAdaptiveMediaSourceAdvancedSettings)->get_BitrateDowngradeTriggerRatio(put_abi(value)));
return value;
}
template <typename D> void impl_IAdaptiveMediaSourceAdvancedSettings<D>::BitrateDowngradeTriggerRatio(const optional<double> & value) const
{
check_hresult(WINRT_SHIM(IAdaptiveMediaSourceAdvancedSettings)->put_BitrateDowngradeTriggerRatio(get_abi(value)));
}
template <typename D> Windows::Foundation::IReference<Windows::Foundation::TimeSpan> impl_IAdaptiveMediaSourceCorrelatedTimes<D>::Position() const
{
Windows::Foundation::IReference<Windows::Foundation::TimeSpan> value;
check_hresult(WINRT_SHIM(IAdaptiveMediaSourceCorrelatedTimes)->get_Position(put_abi(value)));
return value;
}
template <typename D> Windows::Foundation::IReference<Windows::Foundation::TimeSpan> impl_IAdaptiveMediaSourceCorrelatedTimes<D>::PresentationTimeStamp() const
{
Windows::Foundation::IReference<Windows::Foundation::TimeSpan> value;
check_hresult(WINRT_SHIM(IAdaptiveMediaSourceCorrelatedTimes)->get_PresentationTimeStamp(put_abi(value)));
return value;
}
template <typename D> Windows::Foundation::IReference<Windows::Foundation::DateTime> impl_IAdaptiveMediaSourceCorrelatedTimes<D>::ProgramDateTime() const
{
Windows::Foundation::IReference<Windows::Foundation::DateTime> value;
check_hresult(WINRT_SHIM(IAdaptiveMediaSourceCorrelatedTimes)->get_ProgramDateTime(put_abi(value)));
return value;
}
template <typename D> uint32_t impl_IAdaptiveMediaSourceDownloadBitrateChangedEventArgs<D>::OldValue() const
{
uint32_t value {};
check_hresult(WINRT_SHIM(IAdaptiveMediaSourceDownloadBitrateChangedEventArgs)->get_OldValue(&value));
return value;
}
template <typename D> uint32_t impl_IAdaptiveMediaSourceDownloadBitrateChangedEventArgs<D>::NewValue() const
{
uint32_t value {};
check_hresult(WINRT_SHIM(IAdaptiveMediaSourceDownloadBitrateChangedEventArgs)->get_NewValue(&value));
return value;
}
template <typename D> Windows::Media::Streaming::Adaptive::AdaptiveMediaSourceDownloadBitrateChangedReason impl_IAdaptiveMediaSourceDownloadBitrateChangedEventArgs2<D>::Reason() const
{
Windows::Media::Streaming::Adaptive::AdaptiveMediaSourceDownloadBitrateChangedReason value {};
check_hresult(WINRT_SHIM(IAdaptiveMediaSourceDownloadBitrateChangedEventArgs2)->get_Reason(&value));
return value;
}
template <typename D> uint32_t impl_IAdaptiveMediaSourcePlaybackBitrateChangedEventArgs<D>::OldValue() const
{
uint32_t value {};
check_hresult(WINRT_SHIM(IAdaptiveMediaSourcePlaybackBitrateChangedEventArgs)->get_OldValue(&value));
return value;
}
template <typename D> uint32_t impl_IAdaptiveMediaSourcePlaybackBitrateChangedEventArgs<D>::NewValue() const
{
uint32_t value {};
check_hresult(WINRT_SHIM(IAdaptiveMediaSourcePlaybackBitrateChangedEventArgs)->get_NewValue(&value));
return value;
}
template <typename D> bool impl_IAdaptiveMediaSourcePlaybackBitrateChangedEventArgs<D>::AudioOnly() const
{
bool value {};
check_hresult(WINRT_SHIM(IAdaptiveMediaSourcePlaybackBitrateChangedEventArgs)->get_AudioOnly(&value));
return value;
}
template <typename D> Windows::Media::Streaming::Adaptive::AdaptiveMediaSourceResourceType impl_IAdaptiveMediaSourceDownloadRequestedEventArgs<D>::ResourceType() const
{
Windows::Media::Streaming::Adaptive::AdaptiveMediaSourceResourceType value {};
check_hresult(WINRT_SHIM(IAdaptiveMediaSourceDownloadRequestedEventArgs)->get_ResourceType(&value));
return value;
}
template <typename D> Windows::Foundation::Uri impl_IAdaptiveMediaSourceDownloadRequestedEventArgs<D>::ResourceUri() const
{
Windows::Foundation::Uri value { nullptr };
check_hresult(WINRT_SHIM(IAdaptiveMediaSourceDownloadRequestedEventArgs)->get_ResourceUri(put_abi(value)));
return value;
}
template <typename D> Windows::Foundation::IReference<uint64_t> impl_IAdaptiveMediaSourceDownloadRequestedEventArgs<D>::ResourceByteRangeOffset() const
{
Windows::Foundation::IReference<uint64_t> value;
check_hresult(WINRT_SHIM(IAdaptiveMediaSourceDownloadRequestedEventArgs)->get_ResourceByteRangeOffset(put_abi(value)));
return value;
}
template <typename D> Windows::Foundation::IReference<uint64_t> impl_IAdaptiveMediaSourceDownloadRequestedEventArgs<D>::ResourceByteRangeLength() const
{
Windows::Foundation::IReference<uint64_t> value;
check_hresult(WINRT_SHIM(IAdaptiveMediaSourceDownloadRequestedEventArgs)->get_ResourceByteRangeLength(put_abi(value)));
return value;
}
template <typename D> Windows::Media::Streaming::Adaptive::AdaptiveMediaSourceDownloadResult impl_IAdaptiveMediaSourceDownloadRequestedEventArgs<D>::Result() const
{
Windows::Media::Streaming::Adaptive::AdaptiveMediaSourceDownloadResult value { nullptr };
check_hresult(WINRT_SHIM(IAdaptiveMediaSourceDownloadRequestedEventArgs)->get_Result(put_abi(value)));
return value;
}
template <typename D> Windows::Media::Streaming::Adaptive::AdaptiveMediaSourceDownloadRequestedDeferral impl_IAdaptiveMediaSourceDownloadRequestedEventArgs<D>::GetDeferral() const
{
Windows::Media::Streaming::Adaptive::AdaptiveMediaSourceDownloadRequestedDeferral deferral { nullptr };
check_hresult(WINRT_SHIM(IAdaptiveMediaSourceDownloadRequestedEventArgs)->abi_GetDeferral(put_abi(deferral)));
return deferral;
}
template <typename D> int32_t impl_IAdaptiveMediaSourceDownloadRequestedEventArgs2<D>::RequestId() const
{
int32_t value {};
check_hresult(WINRT_SHIM(IAdaptiveMediaSourceDownloadRequestedEventArgs2)->get_RequestId(&value));
return value;
}
template <typename D> Windows::Foundation::IReference<Windows::Foundation::TimeSpan> impl_IAdaptiveMediaSourceDownloadRequestedEventArgs2<D>::Position() const
{
Windows::Foundation::IReference<Windows::Foundation::TimeSpan> value;
check_hresult(WINRT_SHIM(IAdaptiveMediaSourceDownloadRequestedEventArgs2)->get_Position(put_abi(value)));
return value;
}
template <typename D> Windows::Foundation::Uri impl_IAdaptiveMediaSourceDownloadResult<D>::ResourceUri() const
{
Windows::Foundation::Uri value { nullptr };
check_hresult(WINRT_SHIM(IAdaptiveMediaSourceDownloadResult)->get_ResourceUri(put_abi(value)));
return value;
}
template <typename D> void impl_IAdaptiveMediaSourceDownloadResult<D>::ResourceUri(const Windows::Foundation::Uri & value) const
{
check_hresult(WINRT_SHIM(IAdaptiveMediaSourceDownloadResult)->put_ResourceUri(get_abi(value)));
}
template <typename D> Windows::Storage::Streams::IInputStream impl_IAdaptiveMediaSourceDownloadResult<D>::InputStream() const
{
Windows::Storage::Streams::IInputStream value;
check_hresult(WINRT_SHIM(IAdaptiveMediaSourceDownloadResult)->get_InputStream(put_abi(value)));
return value;
}
template <typename D> void impl_IAdaptiveMediaSourceDownloadResult<D>::InputStream(const Windows::Storage::Streams::IInputStream & value) const
{
check_hresult(WINRT_SHIM(IAdaptiveMediaSourceDownloadResult)->put_InputStream(get_abi(value)));
}
template <typename D> Windows::Storage::Streams::IBuffer impl_IAdaptiveMediaSourceDownloadResult<D>::Buffer() const
{
Windows::Storage::Streams::IBuffer value;
check_hresult(WINRT_SHIM(IAdaptiveMediaSourceDownloadResult)->get_Buffer(put_abi(value)));
return value;
}
template <typename D> void impl_IAdaptiveMediaSourceDownloadResult<D>::Buffer(const Windows::Storage::Streams::IBuffer & value) const
{
check_hresult(WINRT_SHIM(IAdaptiveMediaSourceDownloadResult)->put_Buffer(get_abi(value)));
}
template <typename D> hstring impl_IAdaptiveMediaSourceDownloadResult<D>::ContentType() const
{
hstring value;
check_hresult(WINRT_SHIM(IAdaptiveMediaSourceDownloadResult)->get_ContentType(put_abi(value)));
return value;
}
template <typename D> void impl_IAdaptiveMediaSourceDownloadResult<D>::ContentType(hstring_view value) const
{
check_hresult(WINRT_SHIM(IAdaptiveMediaSourceDownloadResult)->put_ContentType(get_abi(value)));
}
template <typename D> uint32_t impl_IAdaptiveMediaSourceDownloadResult<D>::ExtendedStatus() const
{
uint32_t value {};
check_hresult(WINRT_SHIM(IAdaptiveMediaSourceDownloadResult)->get_ExtendedStatus(&value));
return value;
}
template <typename D> void impl_IAdaptiveMediaSourceDownloadResult<D>::ExtendedStatus(uint32_t value) const
{
check_hresult(WINRT_SHIM(IAdaptiveMediaSourceDownloadResult)->put_ExtendedStatus(value));
}
template <typename D> Windows::Foundation::IReference<uint64_t> impl_IAdaptiveMediaSourceDownloadResult2<D>::ResourceByteRangeOffset() const
{
Windows::Foundation::IReference<uint64_t> value;
check_hresult(WINRT_SHIM(IAdaptiveMediaSourceDownloadResult2)->get_ResourceByteRangeOffset(put_abi(value)));
return value;
}
template <typename D> void impl_IAdaptiveMediaSourceDownloadResult2<D>::ResourceByteRangeOffset(const optional<uint64_t> & value) const
{
check_hresult(WINRT_SHIM(IAdaptiveMediaSourceDownloadResult2)->put_ResourceByteRangeOffset(get_abi(value)));
}
template <typename D> Windows::Foundation::IReference<uint64_t> impl_IAdaptiveMediaSourceDownloadResult2<D>::ResourceByteRangeLength() const
{
Windows::Foundation::IReference<uint64_t> value;
check_hresult(WINRT_SHIM(IAdaptiveMediaSourceDownloadResult2)->get_ResourceByteRangeLength(put_abi(value)));
return value;
}
template <typename D> void impl_IAdaptiveMediaSourceDownloadResult2<D>::ResourceByteRangeLength(const optional<uint64_t> & value) const
{
check_hresult(WINRT_SHIM(IAdaptiveMediaSourceDownloadResult2)->put_ResourceByteRangeLength(get_abi(value)));
}
template <typename D> void impl_IAdaptiveMediaSourceDownloadRequestedDeferral<D>::Complete() const
{
check_hresult(WINRT_SHIM(IAdaptiveMediaSourceDownloadRequestedDeferral)->abi_Complete());
}
template <typename D> Windows::Media::Streaming::Adaptive::AdaptiveMediaSourceResourceType impl_IAdaptiveMediaSourceDownloadCompletedEventArgs<D>::ResourceType() const
{
Windows::Media::Streaming::Adaptive::AdaptiveMediaSourceResourceType value {};
check_hresult(WINRT_SHIM(IAdaptiveMediaSourceDownloadCompletedEventArgs)->get_ResourceType(&value));
return value;
}
template <typename D> Windows::Foundation::Uri impl_IAdaptiveMediaSourceDownloadCompletedEventArgs<D>::ResourceUri() const
{
Windows::Foundation::Uri value { nullptr };
check_hresult(WINRT_SHIM(IAdaptiveMediaSourceDownloadCompletedEventArgs)->get_ResourceUri(put_abi(value)));
return value;
}
template <typename D> Windows::Foundation::IReference<uint64_t> impl_IAdaptiveMediaSourceDownloadCompletedEventArgs<D>::ResourceByteRangeOffset() const
{
Windows::Foundation::IReference<uint64_t> value;
check_hresult(WINRT_SHIM(IAdaptiveMediaSourceDownloadCompletedEventArgs)->get_ResourceByteRangeOffset(put_abi(value)));
return value;
}
template <typename D> Windows::Foundation::IReference<uint64_t> impl_IAdaptiveMediaSourceDownloadCompletedEventArgs<D>::ResourceByteRangeLength() const
{
Windows::Foundation::IReference<uint64_t> value;
check_hresult(WINRT_SHIM(IAdaptiveMediaSourceDownloadCompletedEventArgs)->get_ResourceByteRangeLength(put_abi(value)));
return value;
}
template <typename D> Windows::Web::Http::HttpResponseMessage impl_IAdaptiveMediaSourceDownloadCompletedEventArgs<D>::HttpResponseMessage() const
{
Windows::Web::Http::HttpResponseMessage value { nullptr };
check_hresult(WINRT_SHIM(IAdaptiveMediaSourceDownloadCompletedEventArgs)->get_HttpResponseMessage(put_abi(value)));
return value;
}
template <typename D> uint64_t impl_IAdaptiveMediaSourceDownloadStatistics<D>::ContentBytesReceivedCount() const
{
uint64_t value {};
check_hresult(WINRT_SHIM(IAdaptiveMediaSourceDownloadStatistics)->get_ContentBytesReceivedCount(&value));
return value;
}
template <typename D> Windows::Foundation::IReference<Windows::Foundation::TimeSpan> impl_IAdaptiveMediaSourceDownloadStatistics<D>::TimeToHeadersReceived() const
{
Windows::Foundation::IReference<Windows::Foundation::TimeSpan> value;
check_hresult(WINRT_SHIM(IAdaptiveMediaSourceDownloadStatistics)->get_TimeToHeadersReceived(put_abi(value)));
return value;
}
template <typename D> Windows::Foundation::IReference<Windows::Foundation::TimeSpan> impl_IAdaptiveMediaSourceDownloadStatistics<D>::TimeToFirstByteReceived() const
{
Windows::Foundation::IReference<Windows::Foundation::TimeSpan> value;
check_hresult(WINRT_SHIM(IAdaptiveMediaSourceDownloadStatistics)->get_TimeToFirstByteReceived(put_abi(value)));
return value;
}
template <typename D> Windows::Foundation::IReference<Windows::Foundation::TimeSpan> impl_IAdaptiveMediaSourceDownloadStatistics<D>::TimeToLastByteReceived() const
{
Windows::Foundation::IReference<Windows::Foundation::TimeSpan> value;
check_hresult(WINRT_SHIM(IAdaptiveMediaSourceDownloadStatistics)->get_TimeToLastByteReceived(put_abi(value)));
return value;
}
template <typename D> int32_t impl_IAdaptiveMediaSourceDownloadCompletedEventArgs2<D>::RequestId() const
{
int32_t value {};
check_hresult(WINRT_SHIM(IAdaptiveMediaSourceDownloadCompletedEventArgs2)->get_RequestId(&value));
return value;
}
template <typename D> Windows::Media::Streaming::Adaptive::AdaptiveMediaSourceDownloadStatistics impl_IAdaptiveMediaSourceDownloadCompletedEventArgs2<D>::Statistics() const
{
Windows::Media::Streaming::Adaptive::AdaptiveMediaSourceDownloadStatistics value { nullptr };
check_hresult(WINRT_SHIM(IAdaptiveMediaSourceDownloadCompletedEventArgs2)->get_Statistics(put_abi(value)));
return value;
}
template <typename D> Windows::Foundation::IReference<Windows::Foundation::TimeSpan> impl_IAdaptiveMediaSourceDownloadCompletedEventArgs2<D>::Position() const
{
Windows::Foundation::IReference<Windows::Foundation::TimeSpan> value;
check_hresult(WINRT_SHIM(IAdaptiveMediaSourceDownloadCompletedEventArgs2)->get_Position(put_abi(value)));
return value;
}
template <typename D> Windows::Media::Streaming::Adaptive::AdaptiveMediaSourceResourceType impl_IAdaptiveMediaSourceDownloadFailedEventArgs<D>::ResourceType() const
{
Windows::Media::Streaming::Adaptive::AdaptiveMediaSourceResourceType value {};
check_hresult(WINRT_SHIM(IAdaptiveMediaSourceDownloadFailedEventArgs)->get_ResourceType(&value));
return value;
}
template <typename D> Windows::Foundation::Uri impl_IAdaptiveMediaSourceDownloadFailedEventArgs<D>::ResourceUri() const
{
Windows::Foundation::Uri value { nullptr };
check_hresult(WINRT_SHIM(IAdaptiveMediaSourceDownloadFailedEventArgs)->get_ResourceUri(put_abi(value)));
return value;
}
template <typename D> Windows::Foundation::IReference<uint64_t> impl_IAdaptiveMediaSourceDownloadFailedEventArgs<D>::ResourceByteRangeOffset() const
{
Windows::Foundation::IReference<uint64_t> value;
check_hresult(WINRT_SHIM(IAdaptiveMediaSourceDownloadFailedEventArgs)->get_ResourceByteRangeOffset(put_abi(value)));
return value;
}
template <typename D> Windows::Foundation::IReference<uint64_t> impl_IAdaptiveMediaSourceDownloadFailedEventArgs<D>::ResourceByteRangeLength() const
{
Windows::Foundation::IReference<uint64_t> value;
check_hresult(WINRT_SHIM(IAdaptiveMediaSourceDownloadFailedEventArgs)->get_ResourceByteRangeLength(put_abi(value)));
return value;
}
template <typename D> Windows::Web::Http::HttpResponseMessage impl_IAdaptiveMediaSourceDownloadFailedEventArgs<D>::HttpResponseMessage() const
{
Windows::Web::Http::HttpResponseMessage value { nullptr };
check_hresult(WINRT_SHIM(IAdaptiveMediaSourceDownloadFailedEventArgs)->get_HttpResponseMessage(put_abi(value)));
return value;
}
template <typename D> int32_t impl_IAdaptiveMediaSourceDownloadFailedEventArgs2<D>::RequestId() const
{
int32_t value {};
check_hresult(WINRT_SHIM(IAdaptiveMediaSourceDownloadFailedEventArgs2)->get_RequestId(&value));
return value;
}
template <typename D> HRESULT impl_IAdaptiveMediaSourceDownloadFailedEventArgs2<D>::ExtendedError() const
{
HRESULT value {};
check_hresult(WINRT_SHIM(IAdaptiveMediaSourceDownloadFailedEventArgs2)->get_ExtendedError(&value));
return value;
}
template <typename D> Windows::Media::Streaming::Adaptive::AdaptiveMediaSourceDownloadStatistics impl_IAdaptiveMediaSourceDownloadFailedEventArgs2<D>::Statistics() const
{
Windows::Media::Streaming::Adaptive::AdaptiveMediaSourceDownloadStatistics value { nullptr };
check_hresult(WINRT_SHIM(IAdaptiveMediaSourceDownloadFailedEventArgs2)->get_Statistics(put_abi(value)));
return value;
}
template <typename D> Windows::Foundation::IReference<Windows::Foundation::TimeSpan> impl_IAdaptiveMediaSourceDownloadFailedEventArgs2<D>::Position() const
{
Windows::Foundation::IReference<Windows::Foundation::TimeSpan> value;
check_hresult(WINRT_SHIM(IAdaptiveMediaSourceDownloadFailedEventArgs2)->get_Position(put_abi(value)));
return value;
}
template <typename D> Windows::Media::Streaming::Adaptive::AdaptiveMediaSourceDiagnosticType impl_IAdaptiveMediaSourceDiagnosticAvailableEventArgs<D>::DiagnosticType() const
{
Windows::Media::Streaming::Adaptive::AdaptiveMediaSourceDiagnosticType value {};
check_hresult(WINRT_SHIM(IAdaptiveMediaSourceDiagnosticAvailableEventArgs)->get_DiagnosticType(&value));
return value;
}
template <typename D> Windows::Foundation::IReference<int32_t> impl_IAdaptiveMediaSourceDiagnosticAvailableEventArgs<D>::RequestId() const
{
Windows::Foundation::IReference<int32_t> value;
check_hresult(WINRT_SHIM(IAdaptiveMediaSourceDiagnosticAvailableEventArgs)->get_RequestId(put_abi(value)));
return value;
}
template <typename D> Windows::Foundation::IReference<Windows::Foundation::TimeSpan> impl_IAdaptiveMediaSourceDiagnosticAvailableEventArgs<D>::Position() const
{
Windows::Foundation::IReference<Windows::Foundation::TimeSpan> value;
check_hresult(WINRT_SHIM(IAdaptiveMediaSourceDiagnosticAvailableEventArgs)->get_Position(put_abi(value)));
return value;
}
template <typename D> Windows::Foundation::IReference<uint64_t> impl_IAdaptiveMediaSourceDiagnosticAvailableEventArgs<D>::SegmentId() const
{
Windows::Foundation::IReference<uint64_t> value;
check_hresult(WINRT_SHIM(IAdaptiveMediaSourceDiagnosticAvailableEventArgs)->get_SegmentId(put_abi(value)));
return value;
}
template <typename D> Windows::Foundation::IReference<winrt::Windows::Media::Streaming::Adaptive::AdaptiveMediaSourceResourceType> impl_IAdaptiveMediaSourceDiagnosticAvailableEventArgs<D>::ResourceType() const
{
Windows::Foundation::IReference<winrt::Windows::Media::Streaming::Adaptive::AdaptiveMediaSourceResourceType> value;
check_hresult(WINRT_SHIM(IAdaptiveMediaSourceDiagnosticAvailableEventArgs)->get_ResourceType(put_abi(value)));
return value;
}
template <typename D> Windows::Foundation::Uri impl_IAdaptiveMediaSourceDiagnosticAvailableEventArgs<D>::ResourceUri() const
{
Windows::Foundation::Uri value { nullptr };
check_hresult(WINRT_SHIM(IAdaptiveMediaSourceDiagnosticAvailableEventArgs)->get_ResourceUri(put_abi(value)));
return value;
}
template <typename D> Windows::Foundation::IReference<uint64_t> impl_IAdaptiveMediaSourceDiagnosticAvailableEventArgs<D>::ResourceByteRangeOffset() const
{
Windows::Foundation::IReference<uint64_t> value;
check_hresult(WINRT_SHIM(IAdaptiveMediaSourceDiagnosticAvailableEventArgs)->get_ResourceByteRangeOffset(put_abi(value)));
return value;
}
template <typename D> Windows::Foundation::IReference<uint64_t> impl_IAdaptiveMediaSourceDiagnosticAvailableEventArgs<D>::ResourceByteRangeLength() const
{
Windows::Foundation::IReference<uint64_t> value;
check_hresult(WINRT_SHIM(IAdaptiveMediaSourceDiagnosticAvailableEventArgs)->get_ResourceByteRangeLength(put_abi(value)));
return value;
}
template <typename D> Windows::Foundation::IReference<uint32_t> impl_IAdaptiveMediaSourceDiagnosticAvailableEventArgs<D>::Bitrate() const
{
Windows::Foundation::IReference<uint32_t> value;
check_hresult(WINRT_SHIM(IAdaptiveMediaSourceDiagnosticAvailableEventArgs)->get_Bitrate(put_abi(value)));
return value;
}
template <typename D> event_token impl_IAdaptiveMediaSourceDiagnostics<D>::DiagnosticAvailable(const Windows::Foundation::TypedEventHandler<Windows::Media::Streaming::Adaptive::AdaptiveMediaSourceDiagnostics, Windows::Media::Streaming::Adaptive::AdaptiveMediaSourceDiagnosticAvailableEventArgs> & handler) const
{
event_token token {};
check_hresult(WINRT_SHIM(IAdaptiveMediaSourceDiagnostics)->add_DiagnosticAvailable(get_abi(handler), &token));
return token;
}
template <typename D> event_revoker<IAdaptiveMediaSourceDiagnostics> impl_IAdaptiveMediaSourceDiagnostics<D>::DiagnosticAvailable(auto_revoke_t, const Windows::Foundation::TypedEventHandler<Windows::Media::Streaming::Adaptive::AdaptiveMediaSourceDiagnostics, Windows::Media::Streaming::Adaptive::AdaptiveMediaSourceDiagnosticAvailableEventArgs> & handler) const
{
return impl::make_event_revoker<D, IAdaptiveMediaSourceDiagnostics>(this, &ABI::Windows::Media::Streaming::Adaptive::IAdaptiveMediaSourceDiagnostics::remove_DiagnosticAvailable, DiagnosticAvailable(handler));
}
template <typename D> void impl_IAdaptiveMediaSourceDiagnostics<D>::DiagnosticAvailable(event_token token) const
{
check_hresult(WINRT_SHIM(IAdaptiveMediaSourceDiagnostics)->remove_DiagnosticAvailable(token));
}
inline bool AdaptiveMediaSource::IsContentTypeSupported(hstring_view contentType)
{
return get_activation_factory<AdaptiveMediaSource, IAdaptiveMediaSourceStatics>().IsContentTypeSupported(contentType);
}
inline Windows::Foundation::IAsyncOperation<Windows::Media::Streaming::Adaptive::AdaptiveMediaSourceCreationResult> AdaptiveMediaSource::CreateFromUriAsync(const Windows::Foundation::Uri & uri)
{
return get_activation_factory<AdaptiveMediaSource, IAdaptiveMediaSourceStatics>().CreateFromUriAsync(uri);
}
inline Windows::Foundation::IAsyncOperation<Windows::Media::Streaming::Adaptive::AdaptiveMediaSourceCreationResult> AdaptiveMediaSource::CreateFromUriAsync(const Windows::Foundation::Uri & uri, const Windows::Web::Http::HttpClient & httpClient)
{
return get_activation_factory<AdaptiveMediaSource, IAdaptiveMediaSourceStatics>().CreateFromUriAsync(uri, httpClient);
}
inline Windows::Foundation::IAsyncOperation<Windows::Media::Streaming::Adaptive::AdaptiveMediaSourceCreationResult> AdaptiveMediaSource::CreateFromStreamAsync(const Windows::Storage::Streams::IInputStream & stream, const Windows::Foundation::Uri & uri, hstring_view contentType)
{
return get_activation_factory<AdaptiveMediaSource, IAdaptiveMediaSourceStatics>().CreateFromStreamAsync(stream, uri, contentType);
}
inline Windows::Foundation::IAsyncOperation<Windows::Media::Streaming::Adaptive::AdaptiveMediaSourceCreationResult> AdaptiveMediaSource::CreateFromStreamAsync(const Windows::Storage::Streams::IInputStream & stream, const Windows::Foundation::Uri & uri, hstring_view contentType, const Windows::Web::Http::HttpClient & httpClient)
{
return get_activation_factory<AdaptiveMediaSource, IAdaptiveMediaSourceStatics>().CreateFromStreamAsync(stream, uri, contentType, httpClient);
}
}
}
template<>
struct std::hash<winrt::Windows::Media::Streaming::Adaptive::IAdaptiveMediaSource>
{
size_t operator()(const winrt::Windows::Media::Streaming::Adaptive::IAdaptiveMediaSource & value) const noexcept
{
return winrt::impl::hash_unknown(value);
}
};
template<>
struct std::hash<winrt::Windows::Media::Streaming::Adaptive::IAdaptiveMediaSource2>
{
size_t operator()(const winrt::Windows::Media::Streaming::Adaptive::IAdaptiveMediaSource2 & value) const noexcept
{
return winrt::impl::hash_unknown(value);
}
};
template<>
struct std::hash<winrt::Windows::Media::Streaming::Adaptive::IAdaptiveMediaSource3>
{
size_t operator()(const winrt::Windows::Media::Streaming::Adaptive::IAdaptiveMediaSource3 & value) const noexcept
{
return winrt::impl::hash_unknown(value);
}
};
template<>
struct std::hash<winrt::Windows::Media::Streaming::Adaptive::IAdaptiveMediaSourceAdvancedSettings>
{
size_t operator()(const winrt::Windows::Media::Streaming::Adaptive::IAdaptiveMediaSourceAdvancedSettings & value) const noexcept
{
return winrt::impl::hash_unknown(value);
}
};
template<>
struct std::hash<winrt::Windows::Media::Streaming::Adaptive::IAdaptiveMediaSourceCorrelatedTimes>
{
size_t operator()(const winrt::Windows::Media::Streaming::Adaptive::IAdaptiveMediaSourceCorrelatedTimes & value) const noexcept
{
return winrt::impl::hash_unknown(value);
}
};
template<>
struct std::hash<winrt::Windows::Media::Streaming::Adaptive::IAdaptiveMediaSourceCreationResult>
{
size_t operator()(const winrt::Windows::Media::Streaming::Adaptive::IAdaptiveMediaSourceCreationResult & value) const noexcept
{
return winrt::impl::hash_unknown(value);
}
};
template<>
struct std::hash<winrt::Windows::Media::Streaming::Adaptive::IAdaptiveMediaSourceCreationResult2>
{
size_t operator()(const winrt::Windows::Media::Streaming::Adaptive::IAdaptiveMediaSourceCreationResult2 & value) const noexcept
{
return winrt::impl::hash_unknown(value);
}
};
template<>
struct std::hash<winrt::Windows::Media::Streaming::Adaptive::IAdaptiveMediaSourceDiagnosticAvailableEventArgs>
{
size_t operator()(const winrt::Windows::Media::Streaming::Adaptive::IAdaptiveMediaSourceDiagnosticAvailableEventArgs & value) const noexcept
{
return winrt::impl::hash_unknown(value);
}
};
template<>
struct std::hash<winrt::Windows::Media::Streaming::Adaptive::IAdaptiveMediaSourceDiagnostics>
{
size_t operator()(const winrt::Windows::Media::Streaming::Adaptive::IAdaptiveMediaSourceDiagnostics & value) const noexcept
{
return winrt::impl::hash_unknown(value);
}
};
template<>
struct std::hash<winrt::Windows::Media::Streaming::Adaptive::IAdaptiveMediaSourceDownloadBitrateChangedEventArgs>
{
size_t operator()(const winrt::Windows::Media::Streaming::Adaptive::IAdaptiveMediaSourceDownloadBitrateChangedEventArgs & value) const noexcept
{
return winrt::impl::hash_unknown(value);
}
};
template<>
struct std::hash<winrt::Windows::Media::Streaming::Adaptive::IAdaptiveMediaSourceDownloadBitrateChangedEventArgs2>
{
size_t operator()(const winrt::Windows::Media::Streaming::Adaptive::IAdaptiveMediaSourceDownloadBitrateChangedEventArgs2 & value) const noexcept
{
return winrt::impl::hash_unknown(value);
}
};
template<>
struct std::hash<winrt::Windows::Media::Streaming::Adaptive::IAdaptiveMediaSourceDownloadCompletedEventArgs>
{
size_t operator()(const winrt::Windows::Media::Streaming::Adaptive::IAdaptiveMediaSourceDownloadCompletedEventArgs & value) const noexcept
{
return winrt::impl::hash_unknown(value);
}
};
template<>
struct std::hash<winrt::Windows::Media::Streaming::Adaptive::IAdaptiveMediaSourceDownloadCompletedEventArgs2>
{
size_t operator()(const winrt::Windows::Media::Streaming::Adaptive::IAdaptiveMediaSourceDownloadCompletedEventArgs2 & value) const noexcept
{
return winrt::impl::hash_unknown(value);
}
};
template<>
struct std::hash<winrt::Windows::Media::Streaming::Adaptive::IAdaptiveMediaSourceDownloadFailedEventArgs>
{
size_t operator()(const winrt::Windows::Media::Streaming::Adaptive::IAdaptiveMediaSourceDownloadFailedEventArgs & value) const noexcept
{
return winrt::impl::hash_unknown(value);
}
};
template<>
struct std::hash<winrt::Windows::Media::Streaming::Adaptive::IAdaptiveMediaSourceDownloadFailedEventArgs2>
{
size_t operator()(const winrt::Windows::Media::Streaming::Adaptive::IAdaptiveMediaSourceDownloadFailedEventArgs2 & value) const noexcept
{
return winrt::impl::hash_unknown(value);
}
};
template<>
struct std::hash<winrt::Windows::Media::Streaming::Adaptive::IAdaptiveMediaSourceDownloadRequestedDeferral>
{
size_t operator()(const winrt::Windows::Media::Streaming::Adaptive::IAdaptiveMediaSourceDownloadRequestedDeferral & value) const noexcept
{
return winrt::impl::hash_unknown(value);
}
};
template<>
struct std::hash<winrt::Windows::Media::Streaming::Adaptive::IAdaptiveMediaSourceDownloadRequestedEventArgs>
{
size_t operator()(const winrt::Windows::Media::Streaming::Adaptive::IAdaptiveMediaSourceDownloadRequestedEventArgs & value) const noexcept
{
return winrt::impl::hash_unknown(value);
}
};
template<>
struct std::hash<winrt::Windows::Media::Streaming::Adaptive::IAdaptiveMediaSourceDownloadRequestedEventArgs2>
{
size_t operator()(const winrt::Windows::Media::Streaming::Adaptive::IAdaptiveMediaSourceDownloadRequestedEventArgs2 & value) const noexcept
{
return winrt::impl::hash_unknown(value);
}
};
template<>
struct std::hash<winrt::Windows::Media::Streaming::Adaptive::IAdaptiveMediaSourceDownloadResult>
{
size_t operator()(const winrt::Windows::Media::Streaming::Adaptive::IAdaptiveMediaSourceDownloadResult & value) const noexcept
{
return winrt::impl::hash_unknown(value);
}
};
template<>
struct std::hash<winrt::Windows::Media::Streaming::Adaptive::IAdaptiveMediaSourceDownloadResult2>
{
size_t operator()(const winrt::Windows::Media::Streaming::Adaptive::IAdaptiveMediaSourceDownloadResult2 & value) const noexcept
{
return winrt::impl::hash_unknown(value);
}
};
template<>
struct std::hash<winrt::Windows::Media::Streaming::Adaptive::IAdaptiveMediaSourceDownloadStatistics>
{
size_t operator()(const winrt::Windows::Media::Streaming::Adaptive::IAdaptiveMediaSourceDownloadStatistics & value) const noexcept
{
return winrt::impl::hash_unknown(value);
}
};
template<>
struct std::hash<winrt::Windows::Media::Streaming::Adaptive::IAdaptiveMediaSourcePlaybackBitrateChangedEventArgs>
{
size_t operator()(const winrt::Windows::Media::Streaming::Adaptive::IAdaptiveMediaSourcePlaybackBitrateChangedEventArgs & value) const noexcept
{
return winrt::impl::hash_unknown(value);
}
};
template<>
struct std::hash<winrt::Windows::Media::Streaming::Adaptive::IAdaptiveMediaSourceStatics>
{
size_t operator()(const winrt::Windows::Media::Streaming::Adaptive::IAdaptiveMediaSourceStatics & value) const noexcept
{
return winrt::impl::hash_unknown(value);
}
};
template<>
struct std::hash<winrt::Windows::Media::Streaming::Adaptive::AdaptiveMediaSource>
{
size_t operator()(const winrt::Windows::Media::Streaming::Adaptive::AdaptiveMediaSource & value) const noexcept
{
return winrt::impl::hash_unknown(value);
}
};
template<>
struct std::hash<winrt::Windows::Media::Streaming::Adaptive::AdaptiveMediaSourceAdvancedSettings>
{
size_t operator()(const winrt::Windows::Media::Streaming::Adaptive::AdaptiveMediaSourceAdvancedSettings & value) const noexcept
{
return winrt::impl::hash_unknown(value);
}
};
template<>
struct std::hash<winrt::Windows::Media::Streaming::Adaptive::AdaptiveMediaSourceCorrelatedTimes>
{
size_t operator()(const winrt::Windows::Media::Streaming::Adaptive::AdaptiveMediaSourceCorrelatedTimes & value) const noexcept
{
return winrt::impl::hash_unknown(value);
}
};
template<>
struct std::hash<winrt::Windows::Media::Streaming::Adaptive::AdaptiveMediaSourceCreationResult>
{
size_t operator()(const winrt::Windows::Media::Streaming::Adaptive::AdaptiveMediaSourceCreationResult & value) const noexcept
{
return winrt::impl::hash_unknown(value);
}
};
template<>
struct std::hash<winrt::Windows::Media::Streaming::Adaptive::AdaptiveMediaSourceDiagnosticAvailableEventArgs>
{
size_t operator()(const winrt::Windows::Media::Streaming::Adaptive::AdaptiveMediaSourceDiagnosticAvailableEventArgs & value) const noexcept
{
return winrt::impl::hash_unknown(value);
}
};
template<>
struct std::hash<winrt::Windows::Media::Streaming::Adaptive::AdaptiveMediaSourceDiagnostics>
{
size_t operator()(const winrt::Windows::Media::Streaming::Adaptive::AdaptiveMediaSourceDiagnostics & value) const noexcept
{
return winrt::impl::hash_unknown(value);
}
};
template<>
struct std::hash<winrt::Windows::Media::Streaming::Adaptive::AdaptiveMediaSourceDownloadBitrateChangedEventArgs>
{
size_t operator()(const winrt::Windows::Media::Streaming::Adaptive::AdaptiveMediaSourceDownloadBitrateChangedEventArgs & value) const noexcept
{
return winrt::impl::hash_unknown(value);
}
};
template<>
struct std::hash<winrt::Windows::Media::Streaming::Adaptive::AdaptiveMediaSourceDownloadCompletedEventArgs>
{
size_t operator()(const winrt::Windows::Media::Streaming::Adaptive::AdaptiveMediaSourceDownloadCompletedEventArgs & value) const noexcept
{
return winrt::impl::hash_unknown(value);
}
};
template<>
struct std::hash<winrt::Windows::Media::Streaming::Adaptive::AdaptiveMediaSourceDownloadFailedEventArgs>
{
size_t operator()(const winrt::Windows::Media::Streaming::Adaptive::AdaptiveMediaSourceDownloadFailedEventArgs & value) const noexcept
{
return winrt::impl::hash_unknown(value);
}
};
template<>
struct std::hash<winrt::Windows::Media::Streaming::Adaptive::AdaptiveMediaSourceDownloadRequestedDeferral>
{
size_t operator()(const winrt::Windows::Media::Streaming::Adaptive::AdaptiveMediaSourceDownloadRequestedDeferral & value) const noexcept
{
return winrt::impl::hash_unknown(value);
}
};
template<>
struct std::hash<winrt::Windows::Media::Streaming::Adaptive::AdaptiveMediaSourceDownloadRequestedEventArgs>
{
size_t operator()(const winrt::Windows::Media::Streaming::Adaptive::AdaptiveMediaSourceDownloadRequestedEventArgs & value) const noexcept
{
return winrt::impl::hash_unknown(value);
}
};
template<>
struct std::hash<winrt::Windows::Media::Streaming::Adaptive::AdaptiveMediaSourceDownloadResult>
{
size_t operator()(const winrt::Windows::Media::Streaming::Adaptive::AdaptiveMediaSourceDownloadResult & value) const noexcept
{
return winrt::impl::hash_unknown(value);
}
};
template<>
struct std::hash<winrt::Windows::Media::Streaming::Adaptive::AdaptiveMediaSourceDownloadStatistics>
{
size_t operator()(const winrt::Windows::Media::Streaming::Adaptive::AdaptiveMediaSourceDownloadStatistics & value) const noexcept
{
return winrt::impl::hash_unknown(value);
}
};
template<>
struct std::hash<winrt::Windows::Media::Streaming::Adaptive::AdaptiveMediaSourcePlaybackBitrateChangedEventArgs>
{
size_t operator()(const winrt::Windows::Media::Streaming::Adaptive::AdaptiveMediaSourcePlaybackBitrateChangedEventArgs & value) const noexcept
{
return winrt::impl::hash_unknown(value);
}
};
WINRT_WARNING_POP
|
#ifndef WIDGETIDENTIFY_H
#define WIDGETIDENTIFY_H
#include <QWidget>
#include <QLabel>
#include <QBoxLayout>
#include <QGridLayout>
#include "Widget/widgetcharacterinfo.h"
#define MAX_SHOW_NUM 125
#define MAX_ROW 10
#define MAX_COLUMN 10
class WidgetIdentify : public QWidget
{
Q_OBJECT
public:
explicit WidgetIdentify(QWidget *parent = 0,int width=1600,int height=900);
signals:
public slots:
protected:
// void resizeEvent(QResizeEvent *event);
private:
void CreatePicBox();
void PictureMove();
void addInfo();
private:
WidgetCharacterInfo *m_pArrayInfo[MAX_SHOW_NUM];
QLabel *m_pLabelType[MAX_ROW];
QGridLayout *m_pLayoutMain;
private:
int m_iRow;
int m_iColumn;
int m_iWhiteRowCount;
int m_iBlackRowCount;
int m_iStrangerRowCount;
};
#endif // WIDGETIDENTIFY_H
|
// -*- C++ -*-
//
// Copyright (C) 1998, 1999, 2000, 2002 Los Alamos National Laboratory,
// Copyright (C) 1998, 1999, 2000, 2002 CodeSourcery, LLC
//
// This file is part of FreePOOMA.
//
// FreePOOMA is free software; you can redistribute it and/or modify it
// under the terms of the Expat license.
//
// 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 Expat
// license for more details.
//
// You should have received a copy of the Expat license along with
// FreePOOMA; see the file LICENSE.
//
//-----------------------------------------------------------------------------
// Function templates:
// Algorithms::delete_backfill
// Algorithms::delete_shiftup
// Algorithms::copy
//-----------------------------------------------------------------------------
#ifndef POOMA_UTILITIES_ALGORITHMS_H
#define POOMA_UTILITIES_ALGORITHMS_H
/** @file
* @ingroup Utilities
* @brief
* copy, delete_backfill and delete_shiftup algorithms.
*
* copy(start, end, dest)
* - An STL-like copy algorithm. This one first checks, using
* ElementProperties, for whether or not the element is "concrete".
* If so, it performs the copy with std::copy or with std::memmove.
* If not, it does the copy explicitly using ElementProperties::construct.
*
* delete_backfill(data_begin, data_end, kill_begin, kill_end)
* - Deletes the elements described by the range [kill_begin,kill_end)
* from the data described by the range [data_begin,data_end), filling
* the deleted slots from the end of the list. All iterators are assumed
* to be random access iterators. Returns the number of deleted elements.
*
* delete_shiftup(data_begin, data_end, kill_begin, kill_end)
* - Deletes the elements described by the range [kill_begin,kill_end)
* from the data described by the range [data_begin,data_end), filling
* the deleted slots from the end of the list. All iterators are assumed
* to be random access iterators. Returns the number of deleted elements.
*/
//-----------------------------------------------------------------------------
// Includes:
//-----------------------------------------------------------------------------
#include "Utilities/ElementProperties.h"
#include "Utilities/PAssert.h"
#include <iterator> // iterator_traits, reverse_iterator
#include <string.h> // memmove
#include <algorithm>// copy
// Open namespaces:
namespace Pooma {
namespace Algorithms {
/**
* Tag class used to choose the proper specialization of copy.
*/
#define POOMA_TAG_DUMMY_MEMBERS(tagclassname) \
inline tagclassname() { }; \
inline tagclassname(const tagclassname &) { }; \
inline tagclassname &operator=(const tagclassname &) { return *this; }
template <bool type>
struct IsConcrete
{
POOMA_TAG_DUMMY_MEMBERS(IsConcrete);
};
/// void copy(Iterator begin, Iterator end, Iterator2 dest)
///
/// General version of Pooma's copy routine. Uses ElementProperties to
/// determine whether elements are concrete or not and calls the appropriate
/// specialization.
///
/// This will work with overlapping regions if the destination is below
/// the source (std::copy has the same limitation).
template <class It, class It2>
inline It2 copy(It begin, It end, It2 dest)
{
PAssert(begin <= end);
PAssert(dest <= begin);
typedef typename std::iterator_traits<It>::value_type Value_t;
typedef ElementProperties<Value_t> EP_t;
typedef IsConcrete<EP_t::concrete> ConcreteType_t;
return copy_special(begin, end, dest, ConcreteType_t());
}
/// void copy_special(Iterator begin, Iterator end,
/// Iterator2 dest, IsConcrete<true>)
///
/// Version of Pooma's copy routine for "concrete" types. Uses either the stl
/// copy algorithm or memmove to copy the data, depending on the data size.
/// (Some stl copy algorithms may already make this optimization in which case
/// this could be simplified - probably should have a cpp macro that comments
/// out the memmove version for platform where copy is just as fast.)
template <class It, class It2>
inline It2 copy_special(It begin, It end, It2 dest, IsConcrete<true>)
{
typedef std::iterator_traits<It> DataTraits_t;
#if POOMA_NONSTANDARD_ITERATOR
typedef typename DataTraits_t::distance_type Diff_t;
#else
typedef typename DataTraits_t::difference_type Diff_t;
#endif
typedef typename DataTraits_t::value_type Value_t;
// Comment out this test for long data block and just use std::copy
// because std::advance does not work correctly with MS header files
// when tmp is not a pointer or a std::iterator type.
#if 0
const Diff_t len = end - begin;
if (len < 100)
return std::copy(begin, end, dest);
else
{
memmove(&(*dest), &(*begin), len*sizeof(Value_t));
It2 tmp(dest);
std::advance(tmp,len);
return tmp;
}
#else
return std::copy(begin, end, dest);
#endif
}
/// void copy_special(Iterator begin, Iterator end,
/// Iterator2 dest, IsConcrete<false>)
///
/// Version of Pooma's copy routine for non-"concrete" types. This uses
/// ElementProperties::construct to do the copy.
template <class It, class It2>
inline It2 copy_special(It begin, It end, It2 dest, IsConcrete<false>)
{
typedef typename std::iterator_traits<It>::value_type Value_t;
while (begin < end)
{
ElementProperties<Value_t>::construct(dest++, *begin++);
}
return dest;
}
/// difference_type delete_backfill(DataIterator, DataIterator,
/// KillIterator, KillIterator, difference_type)
///
/// Loop through the data and destroy the desired elements, replacing
/// them with elements from the end of the list. The KillIterators
/// refer to a list of indices of elements to be killed. The final
/// optional argument provides an offset for the kill list index values,
/// for cases in which they are not zero-based.
/// Return the number of elements killed.
///
/// NOTE: This algorithm assumes that the killList is sorted
/// and that all iterators are random-access iterators.
template <class DataIterator, class KillIterator>
inline
#if POOMA_NONSTANDARD_ITERATOR
typename std::iterator_traits<DataIterator>::distance_type
#else
typename std::iterator_traits<DataIterator>::difference_type
#endif
delete_backfill(DataIterator data_begin, DataIterator data_end,
const KillIterator kill_begin, const KillIterator kill_end,
#if POOMA_NONSTANDARD_ITERATOR
typename std::iterator_traits<DataIterator>::distance_type offset = 0)
#else
typename std::iterator_traits<DataIterator>::difference_type offset = 0)
#endif
{
PAssert(data_end >= data_begin);
PAssert(kill_end >= kill_begin);
// No data has to be moved if we're destroying values that are at
// the end of the sequence. Thus we look for these first.
#if POOMA_NONSTANDARD_ITERATOR
std::reverse_iterator<KillIterator, const int> rk_pos(kill_end);
std::reverse_iterator<KillIterator, const int> rk_end(kill_begin);
#else
std::reverse_iterator<KillIterator> rk_pos(kill_end);
std::reverse_iterator<KillIterator> rk_end(kill_begin);
#endif
typedef std::iterator_traits<DataIterator> DataTraits_t;
#if POOMA_NONSTANDARD_ITERATOR
typedef typename DataTraits_t::distance_type Diff_t;
#else
typedef typename DataTraits_t::difference_type Diff_t;
#endif
Diff_t last = data_end - data_begin - 1;
while (!(rk_pos == rk_end))
{
// If we're no longer deleting the last element, we break and
// finish up below. (Can't do post inc/dec here as it would put
// the count off by one when we break.)
if ((*rk_pos - offset) != last) break;
// We're still on the last element. Deleting it is simply a matter
// of moving our last pointer and continuing.
--last;
++rk_pos;
}
// Now we're deleting non-last elements. This only executes if
// the above loop was terminated early by the break.
// You have to go through the data backward to ensure that you
// don't fill with an element you're going to later want to delete.
DataIterator last_pos = data_begin + last;
while (!(rk_pos == rk_end))
{
// For BackFill, we overwrite the deleted element with
// the current last element and then decrement the "last"
// index since that element has effectively been moved.
*(data_begin + (*rk_pos++ - offset)) = *last_pos--;
}
return kill_end - kill_begin;
}
/// difference_type delete_shiftup(DataIterator, DataIterator,
/// KillIterator, KillIterator, difference_type)
///
/// Loop through the data and destroy the desired elements, shifting
/// remaining elements forward in the list so as to maintain their order.
/// The KillIterators refer to a list of indices of elements to be killed.
/// The final optional argument provides an offset for the kill list index
/// values, for cases in which they are not zero-based.
/// Return the number of elements killed.
///
/// NOTE: This algorithm assumes that the killList is sorted
/// and that all iterators are random-access iterators.
template <class DataIterator, class KillIterator>
inline
#if POOMA_NONSTANDARD_ITERATOR
typename std::iterator_traits<DataIterator>::distance_type
#else
typename std::iterator_traits<DataIterator>::difference_type
#endif
delete_shiftup(DataIterator data_begin, DataIterator data_end,
KillIterator kill_begin, KillIterator kill_end,
#if POOMA_NONSTANDARD_ITERATOR
typename std::iterator_traits<DataIterator>::distance_type offset = 0)
#else
typename std::iterator_traits<DataIterator>::difference_type offset = 0)
#endif
{
DataIterator insert_pos = data_begin + (*kill_begin - offset);
KillIterator kill_pos = kill_begin;
typedef std::iterator_traits<DataIterator> DataTraits_t;
typedef typename DataTraits_t::value_type Value_t;
#if POOMA_NONSTANDARD_ITERATOR
typedef typename DataTraits_t::distance_type Diff_t;
#else
typedef typename DataTraits_t::difference_type Diff_t;
#endif
while (kill_pos < kill_end)
{
Diff_t copy_index = *kill_pos + 1;
while ( (kill_pos + 1) < kill_end && copy_index == *(kill_pos + 1) )
{
++copy_index;
++kill_pos;
}
DataIterator copy_begin = data_begin + (copy_index - offset);
DataIterator copy_end;
if (copy_begin < data_end)
{
if (kill_pos + 1 < kill_end)
copy_end = data_begin + (*(kill_pos + 1) - offset);
else
copy_end = data_end;
const Diff_t length = copy_end - copy_begin;
Pooma::Algorithms::copy(copy_begin, copy_end, insert_pos);
insert_pos += length;
}
++kill_pos;
}
return kill_end - kill_begin;
}
/// DataIterator find_most_common(DataIterator, DataIterator)
///
/// Loop through the data, counting each distinct value and
/// return an iterator pointing to the most common one (or the end of
/// the sequence if not found).
///
/// NOTE: This algorithm assumes that the data is sorted.
template<class DataIterator>
inline DataIterator
find_most_common(DataIterator dataBegin, DataIterator dataEnd)
{
DataIterator checkValue, mostCommonValue = dataEnd;
int checkCount, count = 0;
while (dataBegin != dataEnd)
{
checkValue = dataBegin++;
checkCount = 1;
while (dataBegin != dataEnd && *dataBegin == *checkValue)
{
++checkCount;
++dataBegin;
}
if (checkCount > count)
{
mostCommonValue = checkValue;
count = checkCount;
}
}
return mostCommonValue;
}
} // namespace Algorithms
} // namespace Pooma
#endif // POOMA_UTILITIES_ALGORITHMS
|
#include "I2Cdev.h"
#include "MPU6050.h"
#if I2CDEV_IMPLEMENTATION == I2CDEV_ARDUINO_WIRE
#include "Wire.h"
#endif
MPU6050 accelgyro;
int16_t ax, ay, az;
int16_t gx, gy, gz;
#include <MaxMatrix.h>
const byte DATA1 = 6; // 資料輸入線
const byte CS1= 5; // 晶片選擇線
const byte CLK1 = 4; // 時脈線
const byte DATA2 = 11; // 資料輸入線
const byte CS2= 10; // 晶片選擇線
const byte CLK2 = 9; // 時脈線
const byte maxInUse = 6; // 代表串連兩個MAX7219模組
MaxMatrix m1(DATA1, CS1, CLK1, maxInUse);
MaxMatrix m2(DATA2, CS2, CLK2, maxInUse);
long long int light_data1[] = {0, 0, 0, 0, 0, 0, 0, 0};
long long int light_data2[] = {0, 0, 0, 0, 0, 0, 0, 0};
short LED_R1[16] = {3, 7, 2, 4, 0, 5, 1, 6, 27, 31, 26, 28, 24, 29, 25, 30};
short LED_G1[16] = {14, 8, 10, 11, 22, 21, 20, 19, 38, 32, 34, 35, 46, 45, 44, 43};
short LED_B1[16] = {9, 13, 12, 15, 17, 16, 18, 23, 33, 37, 36, 39, 41, 40, 42, 47};
short LED_R2[16] = {27, 31, 26, 28, 24, 29, 25, 30, 3, 7, 2, 4, 0, 5, 1, 6};
short LED_G2[16] = {33, 32, 34, 35, 41, 40, 42, 43, 9, 8, 10, 11, 22, 16, 18, 19};
short LED_B2[16] = {38, 37, 36, 39, 46, 45, 44, 47, 14, 13, 12, 15, 17, 21, 20, 23};
void reset1(){
for (int i=0;i<8;i++){
light_data1[i] = (long long int)0;
}
}
void reset2(){
for (int i=0;i<8;i++){
light_data2[i] = (long long int)0;
}
}
void set_color1(int LED_NUM, int R, int G, int B){
for (int i=0;i<R;i++){
light_data1[i] |= ((long long int)1 << LED_R1[LED_NUM]);
}
for (int i=0;i<G;i++){
light_data1[i] |= ((long long int)1 << LED_G1[LED_NUM]);
}
for (int i=0;i<B;i++){
light_data1[i] |= ((long long int)1 << LED_B1[LED_NUM]);
}
}
void set_color2(int LED_NUM, int R, int G, int B){
for (int i=0;i<R;i++){
light_data2[i] |= ((long long int)1 << LED_R2[LED_NUM]);
}
for (int i=0;i<G;i++){
light_data2[i] |= ((long long int)1 << LED_G2[LED_NUM]);
}
for (int i=0;i<B;i++){
light_data2[i] |= ((long long int)1 << LED_B2[LED_NUM]);
}
}
void show1(){
for (int i=0;i<6;i++){
byte ttt[] = {8, 8, 0, 0, 0, 0, 0, 0, 0, 0};
for (int j=0;j<8;j++){
ttt[j+2] = (light_data1[j] >> (i*8));
//Serial.print(ttt[j+2]);
//Serial.print(" ");
}
//Serial.println();
m1.writeSprite(i*8, 0, ttt);
}
}
void show2(){
for (int i=0;i<6;i++){
byte ttt[] = {8, 8, 0, 0, 0, 0, 0, 0, 0, 0};
for (int j=0;j<8;j++){
ttt[j+2] = (light_data2[j] >> (i*8));
//Serial.print(ttt[j+2]);
//Serial.print(" ");
}
//Serial.println();
m2.writeSprite(i*8, 0, ttt);
}
}
void setup() {
#if I2CDEV_IMPLEMENTATION == I2CDEV_ARDUINO_WIRE
Wire.begin();
#elif I2CDEV_IMPLEMENTATION == I2CDEV_BUILTIN_FASTWIRE
Fastwire::setup(400, true);
#endif
accelgyro.initialize();
// put your setup code here, to run once:
m1.init();
m2.init();
m1.setIntensity(20);
m2.setIntensity(20);
//delay(1000);
pinMode(13, OUTPUT);
Serial.begin(9600);
}
byte allon[] = {8, 8, 255, 255, 255, 255, 255, 255, 255, 255};
byte M2[] = {8, 1, B1, B1, B0, B0, B0, B0, B0, B0};
byte M3[] = {8, 1, B1, B1, B1, B0, B0, B0, B0, B0};
byte M4[] = {8, 1, B1, B1, B1, B1, B0, B0, B0, B0};
byte M5[] = {8, 1, B1, B1, B1, B1, B1, B0, B0, B0};
byte M6[] = {8, 1, B1, B1, B1, B1, B1, B1, B0, B0};
byte M7[] = {8, 1, B1, B1, B1, B1, B1, B1, B1, B0};
byte M8[] = {8, 1, B1, B1, B1, B1, B1, B1, B1, B1};
void loop() {
m1.init();
m2.init();
accelgyro.getMotion6(&ax, &ay, &az, &gx, &gy, &gz);
int color;
if (abs(ax) > abs(ay) && abs(ax) > abs(az)){
color = 0;
}
else if (abs(ay) > abs(az)){
color = 1;
}
else {
color = 2;
}
reset1();
reset2();
switch(color){
case 0:
for (int i=0;i<16;i++){
set_color1(i, 8, 0, 0);
set_color2(i, 8, 0, 0);
}
break;
case 1:
for (int i=0;i<16;i++){
set_color1(i, 0, 8, 0);
set_color2(i, 0, 8, 0);
}
break;
case 2:
for (int i=0;i<16;i++){
set_color1(i, 0, 0, 8);
set_color2(i, 0, 0, 8);
}
break;
}
show1();
show2();
Serial.println(color);
}
|
#include<iostream>
#include<bits/stdc++.h>
// How to use pairs
/* pair <int, int> p1;
p1.first = 10;
p1.second = 20;
cout<<p1.first<<" "<<p1.second; */
using namespace std;
// For making the edges of a pair
typedef pair <int, int> intP;
#define INF 99999999
char alphabet(int);
void addEdge(vector <intP> adj[], int u, int v, int wt)
{
// To insert pair value in vector use {} per pair
adj[u].push_back(make_pair(v, wt));
adj[v].push_back(make_pair(u, wt));
}
void primMST(vector <intP> adj[], int V)
{
priority_queue < intP, vector <intP>, greater <intP> > pq;
// Taking source vertex = 0
int src = 0;
// Vector for keys and initialize keys to INF
vector <int> key(V, INF);
// To store parent array
// V - size, -1 - initial value
vector <int> parent(V, -1);
// To keep track of visited nodes
vector <bool> visited(V, false);
pq.push(make_pair(0, src));
key[src] = 0;
// Looping till empty
while(!pq.empty())
{
// First vertex is the min key vertex
// Vertex label is second of the pair
int u = pq.top().second;
pq.pop();
visited[u]= true;
for(auto x=adj[u].begin(); x!=adj[u].end(); x++)
{
// Get wt and label of current adjacent of u
int v = (*x).first;
int weight = (*x).second;
if(visited[v] == false && key[v] > weight)
{
// Update key of v
key[v] = weight;
pq.push(make_pair(key[v], v));
parent[v] = u;
}
}
}
for(int i=1; i<V; ++i)
{
cout<<alphabet(parent[i])<<" - "<<alphabet(i)<<"\n";
}
}
// Modify according to your needs
char alphabet(int u)
{
switch(u)
{
case 0: return 'Z';
break;
case 1: return 'A';
break;
case 2: return 'B';
break;
case 3: return 'C';
break;
case 4: return 'D';
break;
case 5: return 'E';
break;
case 6: return 'F';
break;
case 7: return 'G';
break;
case 8: return 'H';
break;
case 9: return 'I';
break;
case 10: return 'J';
break;
default: break;
}
}
int main()
{
// Change according to needs
// Z - 0, A-1 , B-2, C-3, D-4, E-5, F-6, G-7, H-8, I-9, J-10
// Input format (adj_mat, u, v, cost))
int V = 9;
vector < intP > adj[V];
// making above shown graph
addEdge(adj, 0, 7, 8);
addEdge(adj, 0, 1, 4);
addEdge(adj, 1, 7, 11);
addEdge(adj, 1, 2, 8);
addEdge(adj, 2, 5, 4);
addEdge(adj, 2, 3, 7);
addEdge(adj, 2, 8, 2);
addEdge(adj, 3, 4, 9);
addEdge(adj, 3, 5, 14);
addEdge(adj, 4, 5, 10);
addEdge(adj, 5, 6, 2);
addEdge(adj, 6, 7, 1);
addEdge(adj, 6, 8, 6);
addEdge(adj, 7, 8, 7);
cout<<"The edges included in MST are: \n";
primMST(adj, V);
return 0;
}
|
// Dikstra
// shortest path with a single source without negative edge
// with adjacent matrix cost[][]
#include <limits>
const int INF = std::numeric_limits<int>::max(); // 2,147,483,647 == 2^31 -1
const int MAX_V = 100;
const int MAX_E = 10000;
int cost[MAX_V][MAX_V];
int d[MAX_V];
bool used[MAX_V];
int V;
void dijkstra(int s){
fill(d,d+V,INF);
fill(used,used+V,false);
d[s]=0;
while(true){
int v=-1;
// find shortest vertex
for(int u=0; u<V; u++){
if (!used[u]&&(v == -1 || d[u] < d[v])) v=u;
}
if(v==-1) break;
used[v] = true;
for(int u=0; u<V; u++){
d[u] = min(d[u], d[v] + cost[v][u]);
}
}
}
|
#ifndef __Utility_H__
#define __Utility_H__
#define PI 3.1415926535897932384626433832795f
const float FEQUALEPSILON = 0.00001f;
inline bool fequal(const float a, const float b, const float epsilon = FEQUALEPSILON)
{
return fabs(a - b) <= epsilon;
}
inline bool fnotequal(const float a, const float b, const float epsilon = FEQUALEPSILON)
{
return fabs(a - b) > epsilon;
}
template <class MyType> void MySwap(MyType &v1, MyType &v2)
{
MyType temp = v1;
v1 = v2;
v2 = temp;
}
template <class MyType> void MyClamp(MyType &value, MyType min, MyType max)
{
if( value < min )
value = min;
if( value > max )
value = max;
}
template <class MyType> MyType MyClamp_Return(MyType value, MyType min, MyType max)
{
MyType temp = value;
if( temp < min )
temp = min;
if( temp > max )
temp = max;
return temp;
}
template <class MyType> void IncreaseIfBigger(MyType &value, MyType newvalue)
{
if( newvalue > value )
value = newvalue;
}
template <class MyType> void DecreaseIfLower(MyType &value, MyType newvalue, bool treatzeroasinfinite = false)
{
if( treatzeroasinfinite && value == 0 )
value = newvalue;
if( newvalue < value )
value = newvalue;
}
#endif //__Utility_H__
|
#pragma once
#include "Room.h"
#include "Inventory.h"
#include <iostream>
#include "Weapon.h"
#include "Shield.h"
using namespace std;
class Player
{
public:
Player();
~Player();
void MoveDirection(Room::Direction direction);
void setName(string n) { name = n; }
string getName() { return name; }
void setCurrentHealth(int i) { currentHealth = i; }
int getCurrentHealth() { return currentHealth; }
void setTotalHealth(int i) { totalHealth = i; }
int getTotalHealth() { return totalHealth * level; }
void setLevel(int l) { level = l; }
int getLevel() { return level; }
void setExperience(int e);
int getExperience() { return experience; }
void setCurrentRoom(Room* room) { currentRoom = room; }
Room* getCurrentRoom() { return currentRoom; }
Inventory getInventory() { return inventory; }
Weapon* getMainHand() { return mainHand; }
Shield* getOffHand() { return offHand; }
void setMainHand(Weapon* weapon) { mainHand = weapon; }
void setOffHand(Shield* shield) { offHand = shield; }
void TakeDamage(int amount);
private:
Weapon* mainHand;
Shield* offHand;
string name;
int totalHealth, currentHealth, level, experience;
Room* currentRoom;
Inventory inventory;
};
|
// C++ for the Windows Runtime vv1.0.170303.6
// Copyright (c) 2017 Microsoft Corporation. All rights reserved.
#pragma once
#include "../base.h"
#include "Windows.Security.Credentials.UI.0.h"
#include "Windows.Storage.Streams.0.h"
#include "Windows.Foundation.1.h"
WINRT_EXPORT namespace winrt {
namespace ABI::Windows::Security::Credentials::UI {
struct __declspec(uuid("965a0b4c-95fa-467f-992b-0b22e5859bf6")) __declspec(novtable) ICredentialPickerOptions : Windows::Foundation::IInspectable
{
virtual HRESULT __stdcall put_Caption(hstring value) = 0;
virtual HRESULT __stdcall get_Caption(hstring * value) = 0;
virtual HRESULT __stdcall put_Message(hstring value) = 0;
virtual HRESULT __stdcall get_Message(hstring * value) = 0;
virtual HRESULT __stdcall put_ErrorCode(uint32_t value) = 0;
virtual HRESULT __stdcall get_ErrorCode(uint32_t * value) = 0;
virtual HRESULT __stdcall put_TargetName(hstring value) = 0;
virtual HRESULT __stdcall get_TargetName(hstring * value) = 0;
virtual HRESULT __stdcall put_AuthenticationProtocol(winrt::Windows::Security::Credentials::UI::AuthenticationProtocol value) = 0;
virtual HRESULT __stdcall get_AuthenticationProtocol(winrt::Windows::Security::Credentials::UI::AuthenticationProtocol * value) = 0;
virtual HRESULT __stdcall put_CustomAuthenticationProtocol(hstring value) = 0;
virtual HRESULT __stdcall get_CustomAuthenticationProtocol(hstring * value) = 0;
virtual HRESULT __stdcall put_PreviousCredential(Windows::Storage::Streams::IBuffer * value) = 0;
virtual HRESULT __stdcall get_PreviousCredential(Windows::Storage::Streams::IBuffer ** value) = 0;
virtual HRESULT __stdcall put_AlwaysDisplayDialog(bool value) = 0;
virtual HRESULT __stdcall get_AlwaysDisplayDialog(bool * value) = 0;
virtual HRESULT __stdcall put_CallerSavesCredential(bool value) = 0;
virtual HRESULT __stdcall get_CallerSavesCredential(bool * value) = 0;
virtual HRESULT __stdcall put_CredentialSaveOption(winrt::Windows::Security::Credentials::UI::CredentialSaveOption value) = 0;
virtual HRESULT __stdcall get_CredentialSaveOption(winrt::Windows::Security::Credentials::UI::CredentialSaveOption * value) = 0;
};
struct __declspec(uuid("1948f99a-cc30-410c-9c38-cc0884c5b3d7")) __declspec(novtable) ICredentialPickerResults : Windows::Foundation::IInspectable
{
virtual HRESULT __stdcall get_ErrorCode(uint32_t * value) = 0;
virtual HRESULT __stdcall get_CredentialSaveOption(winrt::Windows::Security::Credentials::UI::CredentialSaveOption * value) = 0;
virtual HRESULT __stdcall get_CredentialSaved(bool * value) = 0;
virtual HRESULT __stdcall get_Credential(Windows::Storage::Streams::IBuffer ** value) = 0;
virtual HRESULT __stdcall get_CredentialDomainName(hstring * value) = 0;
virtual HRESULT __stdcall get_CredentialUserName(hstring * value) = 0;
virtual HRESULT __stdcall get_CredentialPassword(hstring * value) = 0;
};
struct __declspec(uuid("aa3a5c73-c9ea-4782-99fb-e6d7e938e12d")) __declspec(novtable) ICredentialPickerStatics : Windows::Foundation::IInspectable
{
virtual HRESULT __stdcall abi_PickWithOptionsAsync(Windows::Security::Credentials::UI::ICredentialPickerOptions * options, Windows::Foundation::IAsyncOperation<Windows::Security::Credentials::UI::CredentialPickerResults> ** operation) = 0;
virtual HRESULT __stdcall abi_PickWithMessageAsync(hstring targetName, hstring message, Windows::Foundation::IAsyncOperation<Windows::Security::Credentials::UI::CredentialPickerResults> ** operation) = 0;
virtual HRESULT __stdcall abi_PickWithCaptionAsync(hstring targetName, hstring message, hstring caption, Windows::Foundation::IAsyncOperation<Windows::Security::Credentials::UI::CredentialPickerResults> ** operation) = 0;
};
struct __declspec(uuid("af4f3f91-564c-4ddc-b8b5-973447627c65")) __declspec(novtable) IUserConsentVerifierStatics : Windows::Foundation::IInspectable
{
virtual HRESULT __stdcall abi_CheckAvailabilityAsync(Windows::Foundation::IAsyncOperation<winrt::Windows::Security::Credentials::UI::UserConsentVerifierAvailability> ** result) = 0;
virtual HRESULT __stdcall abi_RequestVerificationAsync(hstring message, Windows::Foundation::IAsyncOperation<winrt::Windows::Security::Credentials::UI::UserConsentVerificationResult> ** result) = 0;
};
}
namespace ABI {
template <> struct traits<Windows::Security::Credentials::UI::CredentialPickerOptions> { using default_interface = Windows::Security::Credentials::UI::ICredentialPickerOptions; };
template <> struct traits<Windows::Security::Credentials::UI::CredentialPickerResults> { using default_interface = Windows::Security::Credentials::UI::ICredentialPickerResults; };
}
namespace Windows::Security::Credentials::UI {
template <typename D>
struct WINRT_EBO impl_ICredentialPickerOptions
{
void Caption(hstring_view value) const;
hstring Caption() const;
void Message(hstring_view value) const;
hstring Message() const;
void ErrorCode(uint32_t value) const;
uint32_t ErrorCode() const;
void TargetName(hstring_view value) const;
hstring TargetName() const;
void AuthenticationProtocol(Windows::Security::Credentials::UI::AuthenticationProtocol value) const;
Windows::Security::Credentials::UI::AuthenticationProtocol AuthenticationProtocol() const;
void CustomAuthenticationProtocol(hstring_view value) const;
hstring CustomAuthenticationProtocol() const;
void PreviousCredential(const Windows::Storage::Streams::IBuffer & value) const;
Windows::Storage::Streams::IBuffer PreviousCredential() const;
void AlwaysDisplayDialog(bool value) const;
bool AlwaysDisplayDialog() const;
void CallerSavesCredential(bool value) const;
bool CallerSavesCredential() const;
void CredentialSaveOption(Windows::Security::Credentials::UI::CredentialSaveOption value) const;
Windows::Security::Credentials::UI::CredentialSaveOption CredentialSaveOption() const;
};
template <typename D>
struct WINRT_EBO impl_ICredentialPickerResults
{
uint32_t ErrorCode() const;
Windows::Security::Credentials::UI::CredentialSaveOption CredentialSaveOption() const;
bool CredentialSaved() const;
Windows::Storage::Streams::IBuffer Credential() const;
hstring CredentialDomainName() const;
hstring CredentialUserName() const;
hstring CredentialPassword() const;
};
template <typename D>
struct WINRT_EBO impl_ICredentialPickerStatics
{
Windows::Foundation::IAsyncOperation<Windows::Security::Credentials::UI::CredentialPickerResults> PickAsync(const Windows::Security::Credentials::UI::CredentialPickerOptions & options) const;
Windows::Foundation::IAsyncOperation<Windows::Security::Credentials::UI::CredentialPickerResults> PickAsync(hstring_view targetName, hstring_view message) const;
Windows::Foundation::IAsyncOperation<Windows::Security::Credentials::UI::CredentialPickerResults> PickAsync(hstring_view targetName, hstring_view message, hstring_view caption) const;
};
template <typename D>
struct WINRT_EBO impl_IUserConsentVerifierStatics
{
Windows::Foundation::IAsyncOperation<winrt::Windows::Security::Credentials::UI::UserConsentVerifierAvailability> CheckAvailabilityAsync() const;
Windows::Foundation::IAsyncOperation<winrt::Windows::Security::Credentials::UI::UserConsentVerificationResult> RequestVerificationAsync(hstring_view message) const;
};
}
namespace impl {
template <> struct traits<Windows::Security::Credentials::UI::ICredentialPickerOptions>
{
using abi = ABI::Windows::Security::Credentials::UI::ICredentialPickerOptions;
template <typename D> using consume = Windows::Security::Credentials::UI::impl_ICredentialPickerOptions<D>;
};
template <> struct traits<Windows::Security::Credentials::UI::ICredentialPickerResults>
{
using abi = ABI::Windows::Security::Credentials::UI::ICredentialPickerResults;
template <typename D> using consume = Windows::Security::Credentials::UI::impl_ICredentialPickerResults<D>;
};
template <> struct traits<Windows::Security::Credentials::UI::ICredentialPickerStatics>
{
using abi = ABI::Windows::Security::Credentials::UI::ICredentialPickerStatics;
template <typename D> using consume = Windows::Security::Credentials::UI::impl_ICredentialPickerStatics<D>;
};
template <> struct traits<Windows::Security::Credentials::UI::IUserConsentVerifierStatics>
{
using abi = ABI::Windows::Security::Credentials::UI::IUserConsentVerifierStatics;
template <typename D> using consume = Windows::Security::Credentials::UI::impl_IUserConsentVerifierStatics<D>;
};
template <> struct traits<Windows::Security::Credentials::UI::CredentialPicker>
{
static constexpr const wchar_t * name() noexcept { return L"Windows.Security.Credentials.UI.CredentialPicker"; }
};
template <> struct traits<Windows::Security::Credentials::UI::CredentialPickerOptions>
{
using abi = ABI::Windows::Security::Credentials::UI::CredentialPickerOptions;
static constexpr const wchar_t * name() noexcept { return L"Windows.Security.Credentials.UI.CredentialPickerOptions"; }
};
template <> struct traits<Windows::Security::Credentials::UI::CredentialPickerResults>
{
using abi = ABI::Windows::Security::Credentials::UI::CredentialPickerResults;
static constexpr const wchar_t * name() noexcept { return L"Windows.Security.Credentials.UI.CredentialPickerResults"; }
};
template <> struct traits<Windows::Security::Credentials::UI::UserConsentVerifier>
{
static constexpr const wchar_t * name() noexcept { return L"Windows.Security.Credentials.UI.UserConsentVerifier"; }
};
}
}
|
// This file is subject to the terms and conditions defined in 'LICENSE' in the source code package
#ifndef JACTORIO_INCLUDE_GUI_LAYOUT_H
#define JACTORIO_INCLUDE_GUI_LAYOUT_H
#pragma once
#include <functional>
#include <sstream>
#include <imgui.h>
#include "jactorio.h"
#include "gui/colors.h"
namespace jactorio::gui
{
constexpr int kInventorySlotWidth = 36;
/// Between slots
constexpr int kInventorySlotPadding = 2;
/// Between image and edge of slot
constexpr int kInventorySlotImagePadding = 2;
constexpr int kInventoryItemCountXOffset = 0;
constexpr int kInventoryItemCountYOffset = 0;
// ======================================================================
// Widget Positioning
/// Gets height of current ImGui font
float GetFontHeight();
constexpr unsigned GetTotalItemSlotWidth(const unsigned slots, const unsigned scale = 1) {
assert(scale > 0);
if (slots == 0)
return 0;
return slots * scale * (kInventorySlotWidth + kInventorySlotPadding) - kInventorySlotPadding;
}
/// Padding left and right of each window left as empty space
constexpr unsigned GetTotalWindowPaddingX() {
return 2 * kGuiStyleWindowPaddingX;
}
/// \param items Items after the first item
constexpr unsigned GetTotalWindowItemSpacingX(const unsigned items) {
return items * kGuiStyleItemSpacingX;
};
/// Adds additional vertical space
void AddVerticalSpace(float y);
/// Adds additional vertical space, disregarding the imgui style var "itemSpacing"
void AddVerticalSpaceAbsolute(float y);
// ======================================================================
// Window positioning
/// The window size is calculated on the size of the player's inventory
J_NODISCARD ImVec2 GetWindowSize();
/// Gets the center window position
J_NODISCARD ImVec2 GetWindowCenter();
/// The next window drawn will be on the left center of the screen
void SetupNextWindowLeft(const ImVec2& window_size);
void SetupNextWindowLeft();
/// The next window drawn will be on the left center of the screen
void SetupNextWindowRight(const ImVec2& window_size);
void SetupNextWindowRight();
/// The next window drawn will be centered on the screen
void SetupNextWindowCenter(const ImVec2& window_size);
void SetupNextWindowCenter();
} // namespace jactorio::gui
#endif // JACTORIO_INCLUDE_GUI_LAYOUT_H
|
#ifndef SPHERE_H
#define SPHERE_H
#include <glm/glm.hpp>
#include <vector>
#define _USE_MATH_DEFINES
#include <cmath>
#include "shader.h"
namespace renderer {
class Sphere {
public:
Sphere(Shader* p_shader, float radius = 0.5f, int sector_count = 32, int stack_count = 18) {
float x, y, z, xy;
float nx, ny, nz, length_inv = 1.0f / radius;
float sector_step = 2 * M_PI / sector_count;
float stack_step = M_PI / stack_count;
float sector_angle, stack_angle;
for (int i = 0; i <= stack_count; i++) {
stack_angle = M_PI / 2 - i * stack_step;
xy = radius * cosf(stack_angle);
z = radius * sinf(stack_angle);
// Add (sector_count + 1) vertices per stack
for (int j = 0; j <= sector_count; j++) {
sector_angle = j * sector_step;
// Vertex positions
x = xy * cosf(sector_angle);
y = xy * sinf(sector_angle);
m_vertices.push_back(x);
m_vertices.push_back(y);
m_vertices.push_back(z);
// Normalized vertex data
nx = x * length_inv;
ny = y * length_inv;
nz = z * length_inv;
m_normals.push_back(nx);
m_normals.push_back(ny);
m_normals.push_back(nz);
}
}
// Indices
//
// k1--k1+1
// | \ |
// | \ |
// | \ |
// k2--k2+1
for (int i = 0; i < stack_count; i++) {
float k1 = i * (sector_count + 1);
float k2 = k1 + sector_count + 1;
for (int j = 0; j < sector_count; j++, k1++, k2++) {
if (i != 0) {
m_indices.push_back(k1);
m_indices.push_back(k2);
m_indices.push_back(k1 + 1);
}
if (i != (stack_count - 1)) {
m_indices.push_back(k1 + 1);
m_indices.push_back(k2);
m_indices.push_back(k2 + 1);
}
}
}
// Create a unique vector with all data
std::size_t count = m_vertices.size();
for (std::size_t i = 0; i < count; i += 3) {
m_sphereData.push_back(m_vertices[i]);
m_sphereData.push_back(m_vertices[i + 1]);
m_sphereData.push_back(m_vertices[i + 2]);
m_sphereData.push_back(m_normals[i]);
m_sphereData.push_back(m_normals[i + 1]);
m_sphereData.push_back(m_normals[i + 2]);
}
// Load data to GPU
p_shader->Use();
glGenVertexArrays(1, &VAO);
glGenBuffers(1, &VBO);
glGenBuffers(1, &iVBO);
glBindVertexArray(VAO);
glBindBuffer(GL_ARRAY_BUFFER, VBO);
glBufferData(GL_ARRAY_BUFFER, m_sphereData.size() * sizeof(float), &m_sphereData[0], GL_STATIC_DRAW);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, iVBO);
glBufferData(GL_ELEMENT_ARRAY_BUFFER, m_indices.size() * sizeof(float), &m_indices[0], GL_STATIC_DRAW);
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 6 * sizeof(float), (void*)(0));
glEnableVertexAttribArray(0);
glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, 6 * sizeof(float), (void*)(3 * sizeof(float)));
glEnableVertexAttribArray(1);
}
unsigned int GetSphereVAO() { return VAO; }
unsigned int GetSphereVBO() { return VBO; }
unsigned int GetSphereiVBO() { return iVBO; }
unsigned int GetNumOfIndices() { return m_indices.size(); }
unsigned int VAO, VBO, iVBO;
private:
std::vector<float> m_vertices;
std::vector<float> m_normals;
std::vector<float> m_sphereData;
std::vector<unsigned int> m_indices; // Probably not needed
};
}
#endif
|
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main()
{
ll n;
cin>>n;
int rem=(n%2);
if(rem!=0)
cout<<'0'<<endl;
else
{
ll x=n/2;
if(x%2)
cout<<x/2<<endl;
else
cout<<(x/2 -1)<<endl;
}
return 0;
}
|
#include "bounding_box.hpp"
#include "logging.hpp"
namespace cxl {
BoundingBox::BoundingBox(vec4 min, vec4 max) {
#ifndef NDEBUG
CXL_CHECK(max.x >= min.x);
CXL_CHECK(max.y >= min.y);
CXL_CHECK(max.z >= min.z);
#endif // NDEBUG
min_ = min;
max_ = max;
}
bool BoundingBox::contains(vec4 v) const {
if (is_empty()) return false;
if (v.x < min_.x || v.x > max_.x) return false;
if (v.y < min_.y || v.y > max_.y) return false;
if (v.z < min_.z || v.z > max_.z) return false;
return true;
}
void BoundingBox::incorporate(vec4 v) {
min_.x = glm::min(min_.x, v.x);
min_.y = glm::min(min_.y, v.y);
min_.z = glm::min(min_.z, v.z);
max_.x = glm::max(min_.x, v.x);
max_.y = glm::max(min_.y, v.y);
max_.z = glm::max(min_.z, v.z);
}
void BoundingBox::combine(const BoundingBox& b) {
}
} // cxl
|
#ifndef BP_NOMOTION_LOCATION_NODE__H
#define BP_NOMOTION_LOCATION_NODE__H
#include "ros/ros.h"
#include "std_msgs/String.h"
#include <tf/tf.h>
#include <tf/transform_listener.h>
#include <tf/transform_broadcaster.h>
#include <cmath>
#pragma once
void loadMapFromFile(nav_msgs::OccupancyGrid *map,
const char *fname, double res, bool negate,
double occ_th, double free_th, double *origin,
bool trinary);
int readMap(nav_msgs::OccupancyGrid *map, const std::string &fname);
bool getMapFileInfo(std::string fname, std::string &image, double &resolution, double &origin_x, double &origin_y, double &origin_z, int &negate, double &occupied_thresh, double &free_thresh);
void testFun(const char *filepath);
void amclPoseCallBack(const geometry_msgs::PoseWithCovarianceStamped &msg);
int readMap(nav_msgs::OccupancyGrid *map, const std::string &fname);
void testPoints();
bool worldToMap(nav_msgs::OccupancyGrid &map, double wx, double wy, unsigned int &mx, unsigned int &my);
bool canGenLineOnMap(double x1, double y1, double x2, double y2, std::string map, double r);
#endif
|
#include <Sprite.h>
namespace dngine{
Sprite::Sprite(SDL_Renderer_ptr r, std::string fname) : renderer(r), filename(fname) {
}
Sprite::~Sprite(){
}
SDL_Texture_ptr Sprite::get_texture(){
return image;
}
void Sprite::set_location(SDL_Rect_ptr loc){
location = loc;
}
void Sprite::set_location(int x, int y, int h, int w){
location->x = x;
location->y = y;
location->h = h;
location->w = w;
}
SDL_Rect_ptr Sprite::get_location() const{
return location;
}
void Sprite::load_image(){
image = SDL_Texture_ptr(IMG_LoadTexture(renderer.get(), filename.c_str()), SDL_DestroyTexture);
}
void Sprite::render(){
SDL_RenderCopy(renderer.get(), image.get(), NULL, location.get());
}
}
|
// Мигание светодиодом
#define F_CPU 8000000UL
#include <avr/io.h>
#include <util/delay.h>
int main(void) {
DDRA = 0xFF;
PORTA = 0x01;
while (1) {
PORTA = PORTA<<1;
if(PORTA == 0x00)
PORTA = 0x01;
_delay_ms(100);
}
}
|
// Fill out your copyright notice in the Description page of Project Settings.
#include "TankMovementComponent.h"
#include "TankTrack.h"
UFUNCTION(BlueprintCallable, Category = "Movement") void UTankMovementComponent::IntendMoveForward(float Throw)
{
//UE_LOG(LogTemp, Warning, TEXT("Intend move forward throw: %f"),Throw);
if (!ensure(LeftTrack && RightTrack))
{
//UE_LOG(LogTemp, Warning, TEXT("UTankMovementComponent::IntendMoveForward ERROR. IntendMoveForward"));
return;
}
LeftTrack->SetThrottle(Throw);
RightTrack->SetThrottle(Throw);
}
UFUNCTION(BlueprintCallable, Category = "Movement") void UTankMovementComponent::IntendTurnRight(float Throw)
{
//UE_LOG(LogTemp, Warning, TEXT("Intend move forward throw: %f"),Throw);
if (!ensure(LeftTrack && RightTrack))
{
//UE_LOG(LogTemp, Warning, TEXT("UTankMovementComponent::IntendMoveForward ERROR: IntendTurnRight"));
return;
}
LeftTrack->SetThrottle(Throw);
//set RightTrack to -Throw in order to turn.
RightTrack->SetThrottle(-Throw);
}
UFUNCTION(BlueprintCallable, Category = "Movement") void UTankMovementComponent::IntendTurnLeft(float Throw)
{
//UE_LOG(LogTemp, Warning, TEXT("Intend move forward throw: %f"),Throw);
if (!ensure(LeftTrack && RightTrack))
{
UE_LOG(LogTemp, Warning, TEXT("UTankMovementComponent::IntendMoveForward ERROR."));
return;
}
LeftTrack->SetThrottle(-Throw);
//set RightTrack to -Throw in order to turn.
RightTrack->SetThrottle(-Throw);
}
UFUNCTION(BlueprintCallable, Category = "Setup") void UTankMovementComponent::Initialise(UTankTrack * LeftTrackToSet, UTankTrack * RightTrackToSet)
{
if (!ensure(LeftTrackToSet && RightTrackToSet))
{
return;
}
LeftTrack = LeftTrackToSet;
RightTrack = RightTrackToSet;
}
//TODO: Study on DotProduct and Crossproduct.
void UTankMovementComponent::RequestDirectMove(const FVector & MoveVelocity, bool bForceMaxSpeed)
{
//No need to call Super as we're overriding.
auto Name = GetOwner()->GetName();
auto TankForward = GetOwner()->GetActorForwardVector().GetSafeNormal(); //returns size of vector(magnitude), as unit vector.
//gets normal of Velocity, in order for DotProduct calculations to work.
auto AiForwardIntention = MoveVelocity.GetSafeNormal();
//calcs dotProduct in order to know direction of movement for AI tanks.
auto ForwardThrow = FVector::DotProduct(AiForwardIntention, TankForward);
IntendMoveForward(ForwardThrow);
auto RightThrow = FVector::CrossProduct(AiForwardIntention, TankForward).Z;
IntendTurnRight(RightThrow);
//UE_LOG(LogTemp, Warning, TEXT("%s: DotProduct: %f"),*Name,ForwardThrow);
}
|
#include "WerkplaatsCard.h"
WerkplaatsCard::WerkplaatsCard()
{
}
std::unique_ptr<Card> WerkplaatsCard::Create()
{
std::unique_ptr<Card> card(new WerkplaatsCard());
return std::move(card);
}
WerkplaatsCard::~WerkplaatsCard()
{
}
|
//! Bismillahi-Rahamanirahim.
/** ========================================**
** @Author: Md. Abu Farhad ( RUET, CSE'15)
** @Category:
/** ========================================**/
#include<bits/stdc++.h>
#include<stdio.h>
using namespace std;
#define ll long long
#define scl(n) scanf("%lld", &n)
int main()
{
ll m,n,t,b,c,d,i,j,k,x,y,z,l,q,r;
ll cnt=0,ans=0;
cin>>n>>m>>k;
if(n<=m && n<=k)cout<<"YES"<<endl;
else cout<<"NO"<<endl;
return 0;
}
|
#include <string>
#include <ostream>
#include <fstream>
#include <iostream>
#include <sstream>
#include <stdexcept>
#include <algorithm>
#include "../utils/macros.hpp"
#include "bmatset.hpp"
using namespace std;
using namespace Eigen;
namespace cbasis {
// ==== BVec ====
void BVec::Write(string filename) const {
ofstream f;
f.open(filename.c_str(), ios::out|ios::binary|ios::trunc);
if(!f) {
string msg; SUB_LOCATION(msg); msg = "\n" + msg + "file not found";
throw runtime_error(msg);
}
int id(6677);
f.write((char*)&id, sizeof(int));
int num = this->size();
f.write((char*)&num, sizeof(int));
for(const_iterator it = this->begin(); it != this->end(); ++it) {
int irrep = it->first;
f.write((char*)&irrep, sizeof(int));
const VectorXcd& V = it->second;
int n = V.size();
f.write((char*)&n, sizeof(int));
for(int i = 0; i < n; i++) {
f.write((char*)&V.coeff(i), sizeof(dcomplex));
}
}
}
void BVec::Read(string filename) {
ifstream f(filename.c_str(), ios::in|ios::binary);
if(!f) {
string msg; SUB_LOCATION(msg);
msg = "\n" + msg + "file not found. filename: " + filename;
throw runtime_error(msg);
}
int id;
f.read((char*)&id, sizeof(int));
if(id != 6677) {
string msg; SUB_LOCATION(msg);
msg = "\n" + msg + ": invalid format. filename: " + filename;
throw runtime_error(msg);
}
int num;
f.read((char*)&num, sizeof(int));
for(int i = 0; i < num; i++) {
int irrep, n;
f.read((char*)&irrep, sizeof(int));
f.read((char*)&n, sizeof(int));
this->at(irrep) = VectorXcd::Zero(n);
VectorXcd& V = (*this)(irrep);
for(int i = 0; i < n; i++) {
dcomplex v;
f.read((char*)&v, sizeof(dcomplex));
V(i) = v;
}
}
}
ostream& operator << (ostream& os, const BVec& a) {
os << "==== BVec ====" << endl;
os << "Block vector object" << endl;
os << "name: " << a.get_name() << endl;
for(BVec::const_iterator it = a.begin(); it != a.end(); ++it) {
int irrep = it->first;
const VectorXcd& vec = it->second;
os << "irrep = " << irrep << endl;
os << vec << endl;
}
os << "==============" << endl;
return os;
}
// ==== BMat ====
void BMat::swap(BMat& o) {
this->name_.swap(o.name_);
this->map_.swap(o.map_);
}
void BMat::Write(string filename) const {
ofstream f;
f.open(filename.c_str(), ios::out|ios::binary|ios::trunc);
if(!f) {
string msg; SUB_LOCATION(msg); msg = "\n" + msg + "file not found";
throw runtime_error(msg);
}
int id(668778);
f.write((char*)&id, sizeof(int));
int num = this->size();
f.write((char*)&num, sizeof(int));
for(const_iterator it = this->begin(); it != this->end(); ++it) {
int irrep = it->first.first;
int jrrep = it->first.second;
f.write((char*)&irrep, sizeof(int));
f.write((char*)&jrrep, sizeof(int));
const MatrixXcd& M = it->second;
int n = M.rows();
int m = M.cols();
f.write((char*)&n, sizeof(int));
f.write((char*)&m, sizeof(int));
for(int i = 0; i < n; i++) {
for(int j = 0; j < m; j++) {
f.write((char*)&M.coeff(i, j), sizeof(dcomplex));
}
}
}
}
void BMat::Read(string filename) {
ifstream f(filename.c_str(), ios::in|ios::binary);
if(!f) {
string msg; SUB_LOCATION(msg);
msg = "\n" + msg + "file not found. filename: " + filename;
throw runtime_error(msg);
}
int id;
f.read((char*)&id, sizeof(int));
if(id != 668778) {
string msg; SUB_LOCATION(msg);
msg = "\n" + msg + "invalid format. filename: "+filename;
throw runtime_error(msg);
}
int num;
f.read((char*)&num, sizeof(int));
for(int i = 0; i < num; i++) {
int irrep, jrrep, n, m;
f.read((char*)&irrep, sizeof(int));
f.read((char*)&jrrep, sizeof(int));
f.read((char*)&n, sizeof(int));
f.read((char*)&m, sizeof(int));
(*this)(irrep, jrrep) = MatrixXcd::Zero(n, m);
MatrixXcd& M = (*this)(irrep, jrrep);
for(int i = 0; i < n; i++) {
for(int j = 0; j < m; j++) {
dcomplex v;
f.read((char*)&v, sizeof(dcomplex));
M(i, j) = v;
}
}
}
}
ostream& operator << (ostream& os, const BMat& a) {
os << "==== BMat ====" << endl;
os << "Block matrix object" << endl;
os << "name: " << a.get_name() << endl;
os << "non0_block: " << a.size() << endl;
for(BMat::const_iterator it = a.begin(); it != a.end(); ++it) {
BMat::Key key = it->first;
int irrep = key.first;
int jrrep = key.second;
const MatrixXcd& mat = it->second;
os << "(irrep, jrrep) = (" << irrep << ", " << jrrep << ")" << endl;
os << mat << endl;
}
os << "==============" << endl;
return os;
}
void BMatRead(BMat::Map& bmat, string fn) {
ifstream f(fn.c_str(), ios::in|ios::binary);
if(!f) {
string msg; SUB_LOCATION(msg);
msg += ": file not found";
throw runtime_error(msg);
}
int id;
f.read((char*)&id, sizeof(int));
if(id != 8371) {
string msg; SUB_LOCATION(msg);
msg = "\n" + msg + ": invalid format";
throw runtime_error(msg);
}
int num;
f.read((char*)&num, sizeof(int));
for(int i = 0; i < num; i++) {
int irrep, jrrep, n, m;
f.read((char*)&irrep, sizeof(int));
f.read((char*)&jrrep, sizeof(int));
f.read((char*)&n, sizeof(int));
f.read((char*)&m, sizeof(int));
MatrixXcd M(n, m);
for(int i = 0; i < n; i++) {
for(int j = 0; j < m; j++) {
dcomplex v;
f.read((char*)&v, sizeof(dcomplex));
M(i, j) = v;
}
}
bmat[make_pair(irrep, jrrep)] = MatrixXcd::Zero(1, 1);
bmat[make_pair(irrep, jrrep)].swap(M);
}
}
void BMatWrite(BMat::Map& bmat, string fn) {
ofstream f;
f.open(fn.c_str(), ios::out|ios::binary|ios::trunc);
if(!f) {
string msg; SUB_LOCATION(msg); msg+=": file not found";
throw runtime_error(msg);
}
int id(8371);
f.write((char*)&id, sizeof(int));
int num = bmat.size();
f.write((char*)&num, sizeof(int));
for(BMat::iterator it = bmat.begin(); it != bmat.end(); ++it) {
int irrep = it->first.first;
int jrrep = it->first.second;
f.write((char*)&irrep, sizeof(int));
f.write((char*)&jrrep, sizeof(int));
MatrixXcd& M = it->second;
int n = M.rows();
int m = M.cols();
f.write((char*)&n, sizeof(int));
f.write((char*)&m, sizeof(int));
for(int i = 0; i < n; i++) {
for(int j = 0; j < m; j++) {
f.write((char*)&M.coeff(i, j), sizeof(dcomplex));
}
}
}
}
// ==== BlockMatrixSets ====
_BMatSet::_BMatSet(): block_num_(1) {}
_BMatSet::_BMatSet(int _block_num): block_num_(_block_num) {}
void _BMatSet::SetMatrix(string name, int i, int j, MatrixXcd& mat) {
#ifndef ARG_NO_CHECK
#endif
MatrixXcd tmp;
mat_map_[name][make_pair(i, j)] = tmp;
mat_map_[name][make_pair(i, j)].swap(mat);
if(block_num_ <= i)
block_num_ = i+1;
if(block_num_ <= j)
block_num_ = j+1;
}
bool _BMatSet::Exist(string name, int i, int j) {
if(i < 0 || block_num_ <= i ||
j < 0 || block_num_ <= j) {
string msg; SUB_LOCATION(msg);
stringstream ss;
ss << msg;
ss << ": Error for int i or j" << endl;
ss << "i: " << i << endl;
ss << "j: " << j << endl;
ss << "block_num: " << block_num_ << endl;
throw runtime_error(ss.str());
}
if(mat_map_.find(name) == mat_map_.end())
return false;
if(mat_map_[name].find(make_pair(i, j)) == mat_map_[name].end())
return false;
MatrixXcd& mat = mat_map_[name][make_pair(i, j)];
if(mat.rows() == 0 || mat.cols() == 0)
return false;
return true;
}
const MatrixXcd& _BMatSet::GetMatrix(string name, int i, int j) {
if(mat_map_.find(name) == mat_map_.end()) {
string msg; SUB_LOCATION(msg);
stringstream ss;
ss << ": failed to find name." << endl
<< "name : " << name <<endl;
msg += ss.str();
throw runtime_error(msg);
}
if(mat_map_[name].find(make_pair(i, j)) == mat_map_[name].end()) {
string msg; SUB_LOCATION(msg);
stringstream ss;
ss << ": failed to find index.\n"
<< "i : " << i << endl
<< "j : " << j << endl;
msg += ": failed to find index.\n";
msg += ss.str();
throw runtime_error(msg);
}
return mat_map_[name][make_pair(i, j)];
}
const BMat& _BMatSet::GetBlockMatrix(std::string name) {
return mat_map_[name];
}
BMat& _BMatSet::RefBlockMatrix(std::string name) {
return mat_map_[name];
}
void _BMatSet::SelfAdd(string name, int i, int j, int a, int b, dcomplex v) {
#ifndef ARG_NO_CHECK
if(i < 0 || block_num_ <= i ||
j < 0 || block_num_ <= j) {
string msg; SUB_LOCATION(msg);
msg += "Error for int i or j.";
throw runtime_error(msg);
}
if(mat_map_.find(name) == mat_map_.end()) {
string msg; SUB_LOCATION(msg);
msg += " : key not found.\n" ;
msg += "name : " + name;
throw runtime_error(msg);
}
if(mat_map_[name].find(make_pair(i, j)) == mat_map_[name].end()) {
string msg; SUB_LOCATION(msg);
msg += " : matrix (i,j) is not found.\n";
throw runtime_error(msg);
}
#endif
mat_map_[name][make_pair(i, j)](a, b) += v;
}
dcomplex _BMatSet::GetValue(string name, int i, int j, int a, int b) {
#ifndef ARG_NO_CHECK
if(mat_map_.find(name) == mat_map_.end()) {
string msg; SUB_LOCATION(msg);
msg += ": key not found.\n" ;
msg += "name : " + name;
throw runtime_error(msg);
}
if(i < 0 || block_num_ <= i ||
j < 0 || block_num_ <= j) {
string msg; SUB_LOCATION(msg);
stringstream oss;
oss << msg << endl << "Error for int i or j" << endl;
oss << "i = " << i << endl;
oss << "j = " << j << endl;
oss << "block_num = " << block_num_ << endl;
throw runtime_error(oss.str());
}
if(mat_map_[name].find(make_pair(i, j)) == mat_map_[name].end()) {
string msg; SUB_LOCATION(msg);
msg += ": matrix (i,j) is not found.\n";
throw runtime_error(msg);
}
#endif
return mat_map_[name][make_pair(i, j)](a, b);
}
void _BMatSet::swap(_BMatSet& o) {
::swap(this->block_num_, o.block_num_);
this->mat_map_.swap(o.mat_map_);
/*
typedef BMatMap::iterator It;
BMatMap tmp_o;
for(It it_o = o.mat_map_.begin(); it_o != o.mat_map_.end();) {
tmp_o[it_o->first] = BMat::Map();
::swap(tmp_o[it_o->first], it_o->second);
o.mat_map_.erase(it_o++);
}
for(It it_this = this->mat_map_.begin(); it_this != this->mat_map_.end();) {
o.mat_map_[it_this->first] = BMat::Map();
o.mat_map_[it_this->first].swap(it_this->second);
this->mat_map_.erase(it_this++);
}
for(It it_tmp = tmp_o.begin(); it_tmp != tmp_o.end();) {
this->mat_map_[it_tmp->first] = BMat::Map();
this->mat_map_[it_tmp->first].swap(it_tmp->second);
++it_tmp;
}
int tmp = o.block_num_;
o.block_num_ = this->block_num_;
this->block_num_ = tmp;
*/
}
string _BMatSet::str() const {
ostringstream oss;
for(BMatMap::const_iterator it = mat_map_.begin(); it != mat_map_.end(); ++it) {
oss << it->first << endl;
for(BMat::const_iterator it_mat = it->second.begin(); it_mat != it->second.end();
++it_mat) {
oss << it_mat->first.first << ", " << it_mat->first.second<< endl
<< it_mat->second << endl;
}
}
return oss.str();
}
// ==== External ====
void swap(BMat::Map& a, BMat::Map& b) {
typedef map<pair<int, int>, MatrixXcd>::iterator It;
map<pair<int, int>, MatrixXcd> tmp_a;
for(It it_a = a.begin(); it_a != a.end();) {
tmp_a[it_a->first] = MatrixXcd();
tmp_a[it_a->first].swap(it_a->second);
a.erase(it_a++);
}
for(It it_b = b.begin(); it_b != b.end();) {
a[it_b->first] = MatrixXcd();
a[it_b->first].swap(it_b->second);
b.erase(it_b++);
}
for(It it_tmp = tmp_a.begin(); it_tmp != tmp_a.end();) {
b[it_tmp->first] = MatrixXcd();
b[it_tmp->first].swap(it_tmp->second);
it_tmp++;
}
}
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.