hexsha
stringlengths
40
40
size
int64
7
1.05M
ext
stringclasses
13 values
lang
stringclasses
1 value
max_stars_repo_path
stringlengths
4
269
max_stars_repo_name
stringlengths
5
109
max_stars_repo_head_hexsha
stringlengths
40
40
max_stars_repo_licenses
listlengths
1
9
max_stars_count
int64
1
191k
max_stars_repo_stars_event_min_datetime
stringlengths
24
24
max_stars_repo_stars_event_max_datetime
stringlengths
24
24
max_issues_repo_path
stringlengths
4
269
max_issues_repo_name
stringlengths
5
116
max_issues_repo_head_hexsha
stringlengths
40
40
max_issues_repo_licenses
listlengths
1
9
max_issues_count
int64
1
48.5k
max_issues_repo_issues_event_min_datetime
stringlengths
24
24
max_issues_repo_issues_event_max_datetime
stringlengths
24
24
max_forks_repo_path
stringlengths
4
269
max_forks_repo_name
stringlengths
5
116
max_forks_repo_head_hexsha
stringlengths
40
40
max_forks_repo_licenses
listlengths
1
9
max_forks_count
int64
1
105k
max_forks_repo_forks_event_min_datetime
stringlengths
24
24
max_forks_repo_forks_event_max_datetime
stringlengths
24
24
content
stringlengths
7
1.05M
avg_line_length
float64
1.21
330k
max_line_length
int64
6
990k
alphanum_fraction
float64
0.01
0.99
author_id
stringlengths
2
40
02ee48b730b0657571d19095f67b4e1bed1d3f02
1,774
cpp
C++
source/ff.ui/source/stream.cpp
spadapet/ff_game_library
f1bf00f90adde66c2c2aa35b109fe61b8d2c6352
[ "MIT" ]
null
null
null
source/ff.ui/source/stream.cpp
spadapet/ff_game_library
f1bf00f90adde66c2c2aa35b109fe61b8d2c6352
[ "MIT" ]
null
null
null
source/ff.ui/source/stream.cpp
spadapet/ff_game_library
f1bf00f90adde66c2c2aa35b109fe61b8d2c6352
[ "MIT" ]
null
null
null
#include "pch.h" #include "stream.h" ff::internal::ui::stream::stream(ff::auto_resource_value&& resource) : resource_(std::move(resource)) { auto resource_file = this->resource_.valid() ? std::dynamic_pointer_cast<ff::resource_file>(this->resource_.value()->get<ff::resource_object_base>()) : nullptr; if (resource_file && resource_file->saved_data()) { this->reader_ = resource_file->saved_data()->loaded_reader(); } assert(this->reader_); } ff::internal::ui::stream::stream(std::shared_ptr<ff::reader_base> reader) : reader_(reader) { assert(this->reader_); } void ff::internal::ui::stream::SetPosition(uint32_t pos) { if (this->reader_) { this->reader_->pos(static_cast<size_t>(pos)); } } uint32_t ff::internal::ui::stream::GetPosition() const { if (this->reader_) { return static_cast<uint32_t>(this->reader_->pos()); } return 0; } uint32_t ff::internal::ui::stream::GetLength() const { if (this->reader_) { return static_cast<uint32_t>(this->reader_->size()); } return 0; } uint32_t ff::internal::ui::stream::Read(void* buffer, uint32_t size) { if (this->reader_) { size = std::min<uint32_t>(size, this->GetLength() - this->GetPosition()); if (buffer) { uint32_t size_read = static_cast<uint32_t>(this->reader_->read(buffer, static_cast<size_t>(size))); assert(size_read == size); size = size_read; } else { this->SetPosition(this->GetPosition() + size); } return size; } return 0; } void ff::internal::ui::stream::Close() { this->resource_ = ff::auto_resource_value(); this->reader_.reset(); }
21.901235
112
0.603157
spadapet
02ef14bf890e376f0d8cad173b481bcacf150d69
1,505
cpp
C++
engine/source/gfx/source/src/Animation_player.cpp
mateusgondim/Demos
6aa5da3a6c0e960d10811c9e71e9a0a746e8d6ab
[ "MIT" ]
5
2019-02-12T07:23:55.000Z
2020-06-22T15:03:36.000Z
engine/source/gfx/source/src/Animation_player.cpp
mateusgondim/Demos
6aa5da3a6c0e960d10811c9e71e9a0a746e8d6ab
[ "MIT" ]
null
null
null
engine/source/gfx/source/src/Animation_player.cpp
mateusgondim/Demos
6aa5da3a6c0e960d10811c9e71e9a0a746e8d6ab
[ "MIT" ]
2
2019-06-17T05:04:21.000Z
2020-04-22T09:05:57.000Z
#include <vector> #include <iostream> #include "Animation_player.hpp" #include "Animation.hpp" gfx::Animation_player::Animation_player(const gfx::Animation & animation) : m_animation(animation), m_playing(true), m_current_frame(-1), m_local_clock(0.0f), m_changed_frame(true) { m_seconds_per_frame = 1.0f / m_animation.frames_per_second(); //m_next_frame_time = g_timer.get_time(); m_next_frame_time = m_local_clock; } void gfx::Animation_player::update(const float dt) { if (m_playing) { float scaled_dt = dt * m_animation.get_playback_rate(); m_local_clock += scaled_dt; } else { return; } if (m_next_frame_time > m_local_clock) { //if it is not yet time to change to the next frame m_changed_frame = false; return; } ++m_current_frame; if (m_current_frame >= m_animation.num_frames()) { // played the last frame if (m_animation.loop()) { // looped animation m_current_frame = 0; } else { m_current_frame--; m_playing = false; return; } } m_next_frame_time = m_local_clock + m_seconds_per_frame; m_changed_frame = true; } //pauses the current animation void gfx::Animation_player::pause() { m_playing = false; } //continuies from where it was void gfx::Animation_player::resume() { if (!m_playing) { m_playing = true; } } void gfx::Animation_player::start_from_beg() { if (!m_playing) { m_changed_frame = true; m_playing = true; m_current_frame = 0; m_local_clock = 0.0f; m_next_frame_time = m_seconds_per_frame; } }
20.902778
107
0.712292
mateusgondim
02f1fa5cda8dcad8043b57289b4afbec682f789d
964
hh
C++
packages/solid/Sphere.hh
brbass/ibex
5a4cc5b4d6d46430d9667970f8a34f37177953d4
[ "MIT" ]
2
2020-04-13T20:06:41.000Z
2021-02-12T17:55:54.000Z
packages/solid/Sphere.hh
brbass/ibex
5a4cc5b4d6d46430d9667970f8a34f37177953d4
[ "MIT" ]
1
2018-10-22T21:03:35.000Z
2018-10-22T21:03:35.000Z
packages/solid/Sphere.hh
brbass/ibex
5a4cc5b4d6d46430d9667970f8a34f37177953d4
[ "MIT" ]
3
2019-04-03T02:15:37.000Z
2022-01-04T05:50:23.000Z
#ifndef Sphere_hh #define Sphere_hh #include "Surface.hh" class Sphere : public Surface { public: Sphere(int index, int dimension, Surface_Type surface_type); // Sphere methods virtual double radius() const = 0; virtual std::vector<double> const &origin() const = 0; // Surface methods virtual Surface_Class surface_class() const { return Surface_Class::SPHERE; } virtual Relation relation(std::vector<double> const &position, bool check_equality = false) const = 0; virtual Intersection intersection(std::vector<double> const &initial_position, std::vector<double> const &initial_direction) const = 0; virtual Normal normal_direction(std::vector<double> const &position, bool check_normal = true) const = 0; virtual void output(XML_Node output_node) const; }; #endif
29.212121
94
0.621369
brbass
02f25d8294c5f536346ee749ae9d3e6464a84c6a
3,659
cpp
C++
dialogs/dialogfieldinformation.cpp
avttrue/fungus
c6ca9ef94317ecbe930da25606ca7331f048ef60
[ "MIT" ]
null
null
null
dialogs/dialogfieldinformation.cpp
avttrue/fungus
c6ca9ef94317ecbe930da25606ca7331f048ef60
[ "MIT" ]
2
2020-08-20T05:04:33.000Z
2020-09-22T17:10:39.000Z
dialogs/dialogfieldinformation.cpp
avttrue/fungus
c6ca9ef94317ecbe930da25606ca7331f048ef60
[ "MIT" ]
null
null
null
#include "dialogfieldinformation.h" #include "properties.h" #include "controls/infopanel.h" #include "controls/separators.h" #include "field/field.h" #include "field/fieldinformation.h" #include <QDebug> #include <QToolBar> #include <QApplication> #include <QIcon> #include <QScrollArea> #include <QVBoxLayout> #include <QMetaProperty> DialogFieldInformation::DialogFieldInformation(QWidget *parent, const QString& title, Field* field) : DialogBody(parent, title, ":/resources/img/field.svg"), m_Field(field) { auto saContent = new QScrollArea(); saContent->setAlignment(Qt::AlignTop); saContent->setFrameStyle(QFrame::NoFrame); saContent->setWidgetResizable(true); auto wContent = new QWidget(); saContent->setWidget(wContent); glContent = new QGridLayout(); wContent->setLayout(glContent); glContent->setAlignment(Qt::AlignTop); glContent->setMargin(1); glContent->setSpacing(1); ToolBar()->addWidget(new WidgetSpacer()); addDialogContent(saContent); loadInformation(); QObject::connect(field, &QObject::destroyed, this, &QDialog::close, Qt::DirectConnection); QObject::connect(this, &QObject::destroyed, [=](){ qDebug() << "DialogFieldInformation" << windowTitle() << "destroyed"; }); qDebug() << "DialogFieldInformation" << windowTitle() << "created"; } void DialogFieldInformation::loadInformation() { glContent->addWidget(new InfoPanel(this, tr("Properties"), QVariant())); auto fi = m_Field->getInformation(); auto fi_mo = fi->metaObject(); for(int i = fi_mo->propertyOffset(); i < fi_mo->propertyCount(); ++i) { auto p = fi_mo->property(i); auto value = fi->property(p.name()); auto dip = new InfoPanel(this, p.name(), value); glContent->addWidget(dip); if(QString(p.name()) == "Age") QObject::connect(fi, &FieldInformation::signalAgeChanged, dip, &InfoPanel::setValue, Qt::QueuedConnection); else if(QString(p.name()) == "DeadCells") QObject::connect(fi, &FieldInformation::signalDeadCellsChanged, dip, &InfoPanel::setValue, Qt::QueuedConnection); else if(QString(p.name()) == "AliveCells") QObject::connect(fi, &FieldInformation::signalAliveCellsChanged, dip, &InfoPanel::setValue, Qt::QueuedConnection); else if(QString(p.name()) == "CursedCells") QObject::connect(fi, &FieldInformation::signalCursedCellsChanged, dip, &InfoPanel::setValue, Qt::QueuedConnection); else if(QString(p.name()) == "ActiveCells") QObject::connect(fi, &FieldInformation::signalActiveCellsChanged, dip, &InfoPanel::setValue, Qt::QueuedConnection); else if(QString(p.name()) == "LastActiveAge") QObject::connect(fi, &FieldInformation::signalLastActiveAgeChanged, dip, &InfoPanel::setValue, Qt::QueuedConnection); else if(QString(p.name()) == "Density") QObject::connect(fi, &FieldInformation::signalDensityChanged, dip, &InfoPanel::setValue, Qt::QueuedConnection); else if(QString(p.name()) == "MaxDensity") QObject::connect(fi, &FieldInformation::signalMaxDensityChanged, dip, &InfoPanel::setValue, Qt::QueuedConnection); else if(QString(p.name()) == "AgeMaxDensity") QObject::connect(fi, &FieldInformation::signalAgeMaxDensityChanged, dip, &InfoPanel::setValue, Qt::QueuedConnection); else if(QString(p.name()) == "CellsWithTrait") QObject::connect(fi, &FieldInformation::signalCellsWithTraitChanged, dip, &InfoPanel::setValue, Qt::QueuedConnection); } } Field *DialogFieldInformation::getField() const { return m_Field; }
43.559524
130
0.68434
avttrue
02f344ce9f29f0c714e4a49cbb59e581fd892afc
2,600
hpp
C++
src/framework/frontend/type/type.hpp
aamshukov/arcturus
4d10cd15ff2b79f23621853961a2178c0bde7d79
[ "MIT" ]
1
2020-12-10T02:33:41.000Z
2020-12-10T02:33:41.000Z
src/framework/frontend/type/type.hpp
aamshukov/arcturus
4d10cd15ff2b79f23621853961a2178c0bde7d79
[ "MIT" ]
null
null
null
src/framework/frontend/type/type.hpp
aamshukov/arcturus
4d10cd15ff2b79f23621853961a2178c0bde7d79
[ "MIT" ]
null
null
null
//.............................. // UI Lab Inc. Arthur Amshukov . //.............................. #ifndef __TYPE_H__ #define __TYPE_H__ #pragma once BEGIN_NAMESPACE(frontend) USING_NAMESPACE(core) class type : public visitable { public: using index_type = int32_t; enum class flag : uint64_t { clear = 0x00 }; DECLARE_ENUM_OPERATORS(flag) using flags_type = flag; protected: string_type my_name; std::size_t my_size; // size in bits, abstract width, like C type hierarchy std::size_t my_platform_size; // size in bits, platform specific width std::size_t my_alignment; // alignment in memory flags_type my_flags; std::size_t my_cardinality; // scalar (0), vector/1D-array(1), matrix/2D-array(2), etc. public: type(); type(const type& other) = default; type(type&& other) = default; virtual ~type() = 0; type& operator = (const type& other) = default; type& operator = (type&& other) = default; const string_type& name() const; string_type& name(); std::size_t size() const; std::size_t& size(); std::size_t platform_size() const; std::size_t& platform_size(); std::size_t alignment() const; std::size_t& alignment(); flags_type flags() const; flags_type& flags(); std::size_t cardinality() const; std::size_t& cardinality(); ACCEPT_METHOD; }; template <typename Traits> class abstract_type : public type { public: using traits_type = Traits; using kind_type = typename traits_type::kind; protected: kind_type my_kind; // kind of type public: abstract_type(kind_type kind = abstract_type<traits_type>::kind_type::unknown_type); abstract_type(const abstract_type& other) = default; abstract_type(abstract_type&& other) = default; virtual ~abstract_type() = 0; abstract_type& operator = (const abstract_type& other) = default; abstract_type& operator = (abstract_type&& other) = default; kind_type kind() const; kind_type& kind(); }; END_NAMESPACE #endif // __TYPE_H__
26.530612
108
0.521923
aamshukov
02f7e0741d115d9cad1db6806420b4e53ff02d62
1,003
cpp
C++
problems/codeforces/1210/c-kamil-and-making-a-stream/code.cpp
brunodccarvalho/competitive
4177c439174fbe749293b9da3445ce7303bd23c2
[ "MIT" ]
7
2020-10-15T22:37:10.000Z
2022-02-26T17:23:49.000Z
problems/codeforces/1210/c-kamil-and-making-a-stream/code.cpp
brunodccarvalho/competitive
4177c439174fbe749293b9da3445ce7303bd23c2
[ "MIT" ]
null
null
null
problems/codeforces/1210/c-kamil-and-making-a-stream/code.cpp
brunodccarvalho/competitive
4177c439174fbe749293b9da3445ce7303bd23c2
[ "MIT" ]
null
null
null
#include <bits/stdc++.h> using namespace std; #define long int64_t // ***** constexpr long mod = 1e9 + 7; long ans = 0; vector<vector<int>> adj; vector<long> beauty; void dfs(int u, int p, unordered_map<long, int> cnts) { unordered_map<long, int> new_cnts; for (auto [g, n] : cnts) { new_cnts[gcd(g, beauty[u])] += n; } new_cnts[beauty[u]]++; for (const auto& [g, n] : new_cnts) { ans = (ans + g * n) % mod; } for (int v : adj[u]) { if (v != p) { dfs(v, u, new_cnts); } } } auto solve() { int N; cin >> N; adj.assign(N, {}); beauty.assign(N, 0); for (int i = 0; i < N; i++) { cin >> beauty[i]; } for (int i = 0; i < N - 1; i++) { int u, v; cin >> u >> v, u--, v--; adj[u].push_back(v); adj[v].push_back(u); } dfs(0, -1, {}); return ans; } // ***** int main() { ios::sync_with_stdio(false); cout << solve() << endl; return 0; }
18.236364
55
0.464606
brunodccarvalho
02fede09ff91b1f539ae503e098b3f0db91676c5
379
cpp
C++
allMatuCommit/7_将输入单词译成密码_2021010911010_20210920145352.cpp
BachWV/matu
d4e3a89385f0a205431dd34c2c7214af40bb8ddb
[ "MIT" ]
null
null
null
allMatuCommit/7_将输入单词译成密码_2021010911010_20210920145352.cpp
BachWV/matu
d4e3a89385f0a205431dd34c2c7214af40bb8ddb
[ "MIT" ]
null
null
null
allMatuCommit/7_将输入单词译成密码_2021010911010_20210920145352.cpp
BachWV/matu
d4e3a89385f0a205431dd34c2c7214af40bb8ddb
[ "MIT" ]
null
null
null
#include<stdio.h> #include<string.h> int main() { int i; char a[21]; gets(a); for (i = 0; a[i] != 0; i++) { if ((a[i] >= 'A' && a[i] <= 'V') || (a[i] >= 'a' && a[i] <= 'v')) printf("%c", a[i] + 4); else if ((a[i] >= 'W' && a[i] <= 'Z') || (a[i] >= 'w' && a[i] <= 'z')) printf("%c", a[i] - 22); else printf("error\n"); } return 0; }
19.947368
74
0.356201
BachWV
02ff84352a4fce7d7782262154dc621f3bc5c3d5
1,143
cpp
C++
nTA/Source/unit_MoveInfo.cpp
loganjones/nTA-Total-Annihilation-Clone
d7d0e4d33f1d452d17cf2fed2b2bcb7f6d7d4d14
[ "MIT" ]
2
2020-05-09T20:50:12.000Z
2021-06-20T08:34:58.000Z
nTA/Source/unit_MoveInfo.cpp
loganjones/nTA-Total-Annihilation-Clone
d7d0e4d33f1d452d17cf2fed2b2bcb7f6d7d4d14
[ "MIT" ]
null
null
null
nTA/Source/unit_MoveInfo.cpp
loganjones/nTA-Total-Annihilation-Clone
d7d0e4d33f1d452d17cf2fed2b2bcb7f6d7d4d14
[ "MIT" ]
2
2018-01-08T00:12:04.000Z
2020-06-14T10:56:50.000Z
// unit_MoveInfo.cpp // \author Logan Jones ////////////////////// \date 4/16/2002 /// \file /// \brief ... ///////////////////////////////////////////////////////////////////// #include "unit.h" #include "unit_MoveInfo.h" // Include inline implementaions here for a debug build #ifdef _DEBUG #include "unit_MoveInfo.inl" #endif // defined( _DEBUG ) ////////////////////////////////////////////////////////////////////// // unit_MoveInfo::unit_MoveInfo() // \author Logan Jones /////////////////////////////////// \date 4/16/2002 // //==================================================================== // unit_MoveInfo::unit_MoveInfo(): IsMoving( 0 ), Speed( 0 ), Orientation( 0, 0, fPI/2 ), Direction( 0, 1 ), TurnAngle( 0 ), Acceleration( 0 ) {} // End unit_MoveInfo::unit_MoveInfo() ////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////// // End - unit_MoveInfo.cpp // ////////////////////////////
30.891892
71
0.328084
loganjones
f30011dd875bf4a9842d428b290747e077cd5b82
181
hpp
C++
src/agl/engine/camera/world_to_eye.hpp
the-last-willy/abstractgl
d685bef25ac18773d3eea48ca52806c3a3485ddb
[ "MIT" ]
null
null
null
src/agl/engine/camera/world_to_eye.hpp
the-last-willy/abstractgl
d685bef25ac18773d3eea48ca52806c3a3485ddb
[ "MIT" ]
null
null
null
src/agl/engine/camera/world_to_eye.hpp
the-last-willy/abstractgl
d685bef25ac18773d3eea48ca52806c3a3485ddb
[ "MIT" ]
null
null
null
#pragma once #include "camera.hpp" #include "eye_to_world.hpp" namespace agl::engine { inline auto world_to_eye(const eng::Camera& c) { return inverse(eye_to_world(c)); } }
12.928571
41
0.712707
the-last-willy
f300d206a6f749a2e2374f08ee78187daa983deb
35,523
cpp
C++
src/WEDProperties/WED_PropertyTable.cpp
maboehme/xptools
24bc6023f45d3ba73a282e97dc6e04a2e5fbd898
[ "X11", "MIT" ]
null
null
null
src/WEDProperties/WED_PropertyTable.cpp
maboehme/xptools
24bc6023f45d3ba73a282e97dc6e04a2e5fbd898
[ "X11", "MIT" ]
null
null
null
src/WEDProperties/WED_PropertyTable.cpp
maboehme/xptools
24bc6023f45d3ba73a282e97dc6e04a2e5fbd898
[ "X11", "MIT" ]
null
null
null
/* * Copyright (c) 2007, Laminar Research. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. * */ #include "WED_PropertyTable.h" #include "WED_Archive.h" #include "WED_Thing.h" #include "ISelection.h" #include "IOperation.h" #include "IGIS.h" #include "IHasResource.h" #include "ILibrarian.h" #include "WED_Entity.h" #include "STLUtils.h" #include "WED_GISComposite.h" #include "WED_GISPolygon.h" #include "WED_Airport.h" #include "WED_AirportNode.h" #include "WED_Group.h" #include "WED_Root.h" #include "WED_ATCFlow.h" #include "PlatformUtils.h" #include "WED_UIDefs.h" #include "GUI_Messages.h" #include "WED_Messages.h" #include "WED_ToolUtils.h" #include "WED_GroupCommands.h" #include "WED_EnumSystem.h" #include "GUI_Commander.h" #include "WED_Menus.h" #include "WED_RampPosition.h" #include "WED_TaxiRoute.h" #include "WED_TaxiRouteNode.h" #include "WED_TruckDestination.h" #include "WED_TruckParkingLocation.h" #include "WED_Runway.h" inline int count_strs(const char ** p) { if (!p) return 0; int n = 0; while(*p) ++p, ++n; return n; } inline bool AnyLocked(WED_Thing * t) { if (t == NULL) return false; WED_Entity * e = dynamic_cast<WED_Entity *>(t); if (e == NULL) return false; if (e->GetLocked()) return true; return AnyLocked(t->GetParent()); } inline bool AnyHidden(WED_Thing * t) { if (t == NULL) return false; WED_Entity * e = dynamic_cast<WED_Entity *>(t); if (e == NULL) return false; if (e->GetHidden()) return true; return AnyHidden(t->GetParent()); } WED_PropertyTable::WED_PropertyTable( GUI_Commander * cmdr, IResolver * resolver, const char ** col_names, int * def_col_widths, int vertical, int dynamic_cols, int sel_only, const char ** filter) : GUI_SimpleTableGeometry( count_strs(col_names), def_col_widths), GUI_Commander(cmdr), mVertical(vertical), mDynamicCols(dynamic_cols), mSelOnly(sel_only), mResolver(resolver), mCacheValid(false) { RebuildCache(); if (col_names) while(*col_names) mColNames.push_back(*col_names++); RecalculateColumns(); if (filter) while (*filter) mFilter.insert(*filter++); } WED_PropertyTable::~WED_PropertyTable() { } void WED_PropertyTable::RecalculateColumns() { if (mDynamicCols) { set<string> cols; cols.insert("Name"); mColNames.clear(); mColNames.push_back("Name"); int total_objs = mVertical ? GetColCount() : GetRowCount(); for (int i = 0; i < total_objs; ++i) { WED_Thing * t = FetchNth(i); if (t) { int pcount = t->CountProperties(); for (int p = 0; p < pcount; ++p) { PropertyInfo_t info; t->GetNthPropertyInfo(p,info); if(!info.prop_name.empty() && info.prop_name[0] != '.') if (cols.count(info.prop_name) == 0) { cols.insert(info.prop_name); mColNames.insert(mColNames.begin(), info.prop_name); } } } } } } void WED_PropertyTable::GetCellContent( int cell_x, int cell_y, GUI_CellContent& the_content) { char buf[100], fmt[16]; // By the end of this we need to have filled the_content out with // 1. Abilities - can_edit, can_disclose, can_drag, etc... // 2. State - is_disclosed, is_selected, indent_level // 3. Content - content_type, its corrisponding value filled in //Our default assumptions the_content.content_type = gui_Cell_None; the_content.string_is_resource = 0; the_content.can_delete = false; the_content.can_edit = 0; the_content.can_disclose = 0; the_content.can_select = 0; the_content.is_disclosed = 0; the_content.is_selected = 0; the_content.can_drag = 1; the_content.indent_level = 0; //Find the row or column we're dealing with WED_Thing * t = FetchNth(mVertical ? cell_x : cell_y); if (t == NULL) return; ISelection * s = WED_GetSelect(mResolver); //Find the property index in said row or column based on the name int idx = t->FindProperty(mColNames[mVertical ? cell_y : cell_x].c_str()); //If there has been one found, use the_content as it is and exit if (idx == -1) return; WED_Thing * my_parent = t->GetParent(); if(my_parent) if(!WED_IsFolder(my_parent)) the_content.can_drag = 0; //With the property index, get the property's value and info PropertyInfo_t inf; PropertyVal_t val; t->GetNthPropertyInfo(idx,inf); t->GetNthProperty(idx, val); the_content.can_select = mSelOnly ? 0 : 1; the_content.is_selected = s->IsSelected(t); //Based on type turn PropertyVal_t into GUI_CellContent, //taking care of "3. Content" switch(inf.prop_kind) { case prop_Int: the_content.content_type = gui_Cell_Integer; the_content.int_val = val.int_val; sprintf(fmt,"%%%dd", inf.digits); snprintf(buf,sizeof(buf),fmt,val.int_val); the_content.text_val = buf; break; case prop_Double: the_content.content_type = gui_Cell_Double; the_content.double_val = val.double_val; sprintf(fmt,"%%%d.%dlf %.6s",inf.digits, inf.decimals, inf.units); // info.units may be not zero terminated snprintf(buf,sizeof(buf),fmt,val.double_val); the_content.text_val = buf; break; case prop_String: the_content.content_type = gui_Cell_EditText; the_content.text_val = val.string_val; break; case prop_TaxiSign: the_content.content_type = gui_Cell_TaxiText; the_content.text_val = val.string_val; break; case prop_FilePath: the_content.content_type = gui_Cell_FileText; the_content.text_val = val.string_val; break; case prop_Bool: the_content.content_type = gui_Cell_CheckBox; the_content.int_val = val.int_val; the_content.bool_val = gui_Bool_Check; the_content.bool_partial = 0; if (mColNames[mVertical ? cell_y : cell_x] == "Locked") { the_content.bool_val = gui_Bool_Lock; if (!the_content.int_val) the_content.bool_partial = AnyLocked(t); } if (mColNames[mVertical ? cell_y : cell_x] == "Hidden") { the_content.bool_val = gui_Bool_Visible; if (!the_content.int_val) the_content.bool_partial = AnyHidden(t); } if((mColNames[mVertical ? cell_y : cell_x] == "Locked" || mColNames[mVertical ? cell_y : cell_x] == "Hidden") && SAFE_CAST(WED_GISPolygon,my_parent)) { the_content.bool_partial = 1; // don't give the impression the inner/outer rings of polygons could/should be hidden or locked, ever return; } break; case prop_Enum: the_content.content_type = gui_Cell_Enum; t->GetNthPropertyDictItem(idx, val.int_val,the_content.text_val); the_content.int_val = val.int_val; break; case prop_EnumSet: the_content.content_type = (inf.domain == LinearFeature ? gui_Cell_LineEnumSet : gui_Cell_EnumSet); the_content.int_set_val = val.set_val; the_content.text_val.clear(); for(set<int>::iterator iter=val.set_val.begin();iter != val.set_val.end(); ++iter) { if(*iter == 0) continue; // SetUnion can now insert 0 to indicate lines with partial blank setgemnts if (!the_content.text_val.empty()) the_content.text_val += ","; string label; t->GetNthPropertyDictItem(idx,*iter,label); if (ENUM_Domain(*iter) == LinearFeature) { label = ENUM_Name(*iter); label += ".png"; the_content.string_is_resource = 1; } the_content.text_val += label; } if (the_content.text_val.empty()) the_content.text_val="None"; if(inf.exclusive && the_content.int_set_val.empty()) the_content.int_set_val.insert(0); // not needed any more now that SetUnion adds this ? break; } int unused_vis, unused_kids; // if (cell_x == 0) if (!mVertical && !mSelOnly) if (mColNames[mVertical ? cell_y : cell_x] == "Name") { //Fill in more about abilities and state, see method for more comments GetFilterStatus(t, s, unused_vis, unused_kids, the_content.can_disclose,the_content.is_disclosed); the_content.indent_level = GetThingDepth(t); /// as long as "cell 0" is the diclose level, might as well have it be the indent level too. } the_content.can_delete = inf.can_delete; the_content.can_edit = inf.can_edit; if (the_content.can_edit) if (WED_GetWorld(mResolver) == t) the_content.can_edit = 0; //THIS IS A HACK to stop the user from being able to disclose arrows during search mode if (mSearchFilter.empty() == false) { if (the_content.can_disclose) { the_content.is_disclosed = true; } } #if DEV //the_content.printCellInfo(true,true,false,true,false,false,true,false,true,false,false,false,false,false); #endif } void WED_PropertyTable::GetEnumDictionary( int cell_x, int cell_y, GUI_EnumDictionary& out_dictionary) { out_dictionary.clear(); WED_Thing * t = FetchNth(mVertical ? cell_x : cell_y); int idx = t->FindProperty(mColNames[mVertical ? cell_y : cell_x].c_str()); if (idx == -1) return; t->GetNthPropertyDict(idx, out_dictionary); PropertyInfo_t info; t->GetNthPropertyInfo(idx,info); if(info.prop_kind == prop_EnumSet) if(info.exclusive) out_dictionary.insert(GUI_EnumDictionary::value_type(0,make_pair(string("None"),true))); } void WED_PropertyTable::AcceptEdit( int cell_x, int cell_y, const GUI_CellContent& the_content, int apply_all) { vector<WED_Thing *> apply_vec; GUI_CellContent content(the_content); if (content.content_type == gui_Cell_FileText) { ILibrarian * librarian = WED_GetLibrarian(mResolver); librarian->LookupPath(content.text_val); char fbuf[2048]; strcpy(fbuf,content.text_val.c_str()); if (!GetFilePathFromUser(getFile_Open,"Pick file", "Open", FILE_DIALOG_PROPERTY_TABLE, fbuf,sizeof(fbuf))) return; content.text_val = fbuf; librarian->ReducePath(content.text_val); } if (apply_all) { ISelection * sel = WED_GetSelect(mResolver); sel->IterateSelectionOr(Iterate_CollectThings, &apply_vec); } else { WED_Thing * t = FetchNth(mVertical ? cell_x : cell_y); if (t != NULL) apply_vec.push_back(t); } WED_Thing * started = NULL; for (int iter = 0; iter < apply_vec.size(); ++iter) { WED_Thing * t = apply_vec[iter]; int idx = t->FindProperty(mColNames[mVertical ? cell_y : cell_x].c_str()); if (idx == -1) continue; PropertyInfo_t inf; PropertyVal_t val; t->GetNthPropertyInfo(idx,inf); if (inf.prop_kind == prop_Int && content.content_type != gui_Cell_Integer ) continue; if (inf.prop_kind == prop_Double && content.content_type != gui_Cell_Double ) continue; if (inf.prop_kind == prop_String && content.content_type != gui_Cell_EditText) continue; if (inf.prop_kind == prop_TaxiSign && content.content_type != gui_Cell_TaxiText) continue; if (inf.prop_kind == prop_FilePath && content.content_type != gui_Cell_FileText) continue; if (inf.prop_kind == prop_Bool && content.content_type != gui_Cell_CheckBox) continue; if (inf.prop_kind == prop_Enum && content.content_type != gui_Cell_Enum ) continue; if (inf.prop_kind == prop_EnumSet && ( content.content_type != gui_Cell_EnumSet && content.content_type != gui_Cell_LineEnumSet )) continue; switch(inf.prop_kind) { case prop_Int: val.prop_kind = prop_Int; val.int_val = content.int_val; break; case prop_Double: val.prop_kind = prop_Double; val.double_val = content.double_val; break; case prop_String: val.prop_kind = prop_String; val.string_val = content.text_val; break; case prop_TaxiSign: val.prop_kind = prop_TaxiSign; val.string_val = content.text_val; break; case prop_FilePath: val.prop_kind = prop_FilePath; val.string_val = content.text_val; break; case prop_Bool: val.prop_kind = prop_Bool; val.int_val = content.int_val; if((mColNames[mVertical ? cell_y : cell_x] == "Locked" || mColNames[mVertical ? cell_y : cell_x] == "Hidden") && SAFE_CAST(WED_GISPolygon,t->GetParent()) ) { val.int_val = 0; // don't let anyone ever set polygon inner/outer rings to be hidden or locked. } break; case prop_Enum: val.prop_kind = prop_Enum; val.int_val = content.int_val; break; case prop_EnumSet: val.prop_kind = prop_EnumSet; if (inf.exclusive) { val.set_val.clear(); if (content.int_val != 0) val.set_val.insert(content.int_val); } else val.set_val = content.int_set_val; break; } string foo = string("Change ") + inf.prop_name; if (!started) { started = t; started->StartCommand(foo); } t->SetNthProperty(idx, val); } if (started) started->CommitCommand(); } void WED_PropertyTable::ToggleDisclose( int cell_x, int cell_y) { WED_Thing * t = FetchNth(mVertical ? cell_x : cell_y); if (t) ToggleOpen(t->GetID()); mCacheValid = false; BroadcastMessage(GUI_TABLE_CONTENT_RESIZED,0); } void WED_PropertyTable::DoDeleteCell( int cell_x, int cell_y) { //Get the airport WED_Airport * airport = static_cast<WED_Airport * >(FetchNth(0)); airport->StartCommand("Delete Meta Data Key"); //To be in uniform with other IPropertyMethods we'll transform cell_y->NS_META_DATA int ns_meta_data = (airport->WED_GISComposite::CountProperties()); airport->DeleteNthProperty(ns_meta_data + airport->CountMetaDataKeys() - cell_y - 1); airport->CommitCommand(); //TODO - Is this needed? BroadcastMessage(GUI_TABLE_CONTENT_RESIZED, 0); } void WED_PropertyTable::DoDrag( GUI_Pane * drag_emitter, int mouse_x, int mouse_y, int button, int bounds[4]) { WED_DoDragSelection(drag_emitter, mouse_x, mouse_y, button, bounds); } void WED_PropertyTable::SelectionStart( int clear) { ISelection * s = WED_GetSelect(mResolver); IOperation * op = dynamic_cast<IOperation *>(s); op->StartOperation("Change Selection"); if (clear) s->Clear(); s->GetSelectionVector(mSelSave); } int WED_PropertyTable::SelectGetExtent( int& low_x, int& low_y, int& high_x, int& high_y) { #if OPTIMIZE speed of this sux #endif ISelection * s = WED_GetSelect(mResolver); int num = mVertical ? GetColCount() : GetRowCount(); int op = mVertical ? GetRowCount() : GetColCount(); int has = 0; if (mVertical) { low_y = 0; high_y = op; low_x = num; high_x = 0; } else { low_x = 0; high_x = op; low_y = num; high_y = 0; } for (int n = 0; n < num; ++n) { WED_Thing * t = FetchNth(n); if (t) { if (s->IsSelected(t)) { has = 1; if (mVertical) { low_x = min(low_x, n); high_x = max(high_x, n); } else { low_y = min(low_y, n); high_y = max(high_y, n); } } } } return has; } int WED_PropertyTable::SelectGetLimits( int& low_x, int& low_y, int& high_x, int& high_y) { low_x = low_y = 0; high_x = GetColCount()-1; high_y = GetRowCount()-1; return (high_x >= 0 && high_y >= 0); } void WED_PropertyTable::SelectRange( int start_x, int start_y, int end_x, int end_y, int is_toggle) { ISelection * s = WED_GetSelect(mResolver); s->Clear(); for (vector<ISelectable *>::iterator u = mSelSave.begin(); u != mSelSave.end(); ++u) s->Insert(*u); #if OPTIMIZE provide accelerated sel-save-restore ops! #endif for (int n = (mVertical ? start_x : start_y); n <= (mVertical ? end_x : end_y); ++n) { #if OPTIMIZE for loop is n-squared perf - fix this! #endif WED_Thing * t = FetchNth(n); if (t) { if (is_toggle) s->Toggle(t); else s->Insert(t); } } } void WED_PropertyTable::SelectionEnd(void) { ISelection * s = WED_GetSelect(mResolver); IOperation * op = dynamic_cast<IOperation *>(s); op->CommitOperation(); mSelSave.clear(); if(gModeratorMode) // special behavior requested by Julian { DispatchHandleCommand(wed_ZoomSelection); ISelectable * sel0 = s->GetNthSelection(0); WED_Group * grp = SAFE_CAST(WED_Group, sel0); string grpnam; if (grp) grp->GetName(grpnam); if (SAFE_CAST(WED_RampPosition, sel0) || SAFE_CAST(WED_TaxiRoute, sel0) || SAFE_CAST(WED_TaxiRouteNode, sel0) || SAFE_CAST(WED_TruckParkingLocation, sel0) || SAFE_CAST(WED_TruckDestination, sel0) || SAFE_CAST(WED_Runway, sel0) || grpnam == "Runways" || grpnam == "Ramp Starts" || grpnam == "Ground Vehicles" || grpnam == "Taxi Routes" || grpnam == "Ground Routes" ) { DispatchHandleCommand(wed_MapATC); } // else if (SAFE_CAST(WED_FacadePlacement, sel0) || SAFE_CAST(WED_ObjPlacement, sel0)) // { // mMapPane->SetTabFilterMode(tab_3D); // DispatchHandleCommand(wed_Map3D); // } // else if(SAFE_CAST(WED_Runway, sel0) || grpnam == "Runways" ) // { // DispatchHandleCommand(wed_MapPavement); // } else { DispatchHandleCommand(wed_MapSelection); } } } int WED_PropertyTable::SelectDisclose( int open_it, int all) { if (mVertical) return 0; if (all) { int cc = GetRowCount(); vector<int> things(cc); for (int n = 0; n < cc; ++n) { WED_Thing * t = FetchNth(n); things.push_back(t->GetID()); } for (int n = 0; n <things.size(); ++n) SetOpen(things[n], open_it); } else { ISelection * sel = WED_GetSelect(mResolver); vector<ISelectable *> sv; sel->GetSelectionVector(sv); for (int n = 0; n < sv.size(); ++n) { WED_Thing * t = dynamic_cast<WED_Thing *>(sv[n]); if (t) { SetOpen(t->GetID(), open_it); } } } mCacheValid = false; BroadcastMessage(GUI_TABLE_CONTENT_RESIZED,0); return 1; } int WED_PropertyTable::TabAdvance( int& io_x, int& io_y, int reverse, GUI_CellContent& the_content) { int start_x = io_x; int start_y = io_y; int width = GetColCount(); int height =GetRowCount(); if (height == 0 || width == 0) return 0; int tries = 0; do { if (mVertical) { if(reverse<0 ) ++io_y; else if(reverse>0 ) --io_y; if (io_y >=height) { io_y = 0; --io_x; } if (io_y < 0 ) { io_y = height-1;++io_x; } if (io_x >= width) { io_x = 0; } if (io_x < 0 ) { io_x = width-1; } } else { if(reverse<0 ) --io_x; else if(reverse>0 ) ++io_x; if (io_x >= width) { io_x = 0; --io_y; } if (io_x < 0 ) { io_x = width-1; ++io_y; } if (io_y >=height) { io_y = 0; } if (io_y < 0 ) { io_y = height-1; } } GetCellContent(io_x, io_y, the_content); if (the_content.can_edit && ( the_content.content_type == gui_Cell_EditText || the_content.content_type == gui_Cell_TaxiText || the_content.content_type == gui_Cell_Integer || the_content.content_type == gui_Cell_Double)) { WED_Thing * t = FetchNth(mVertical ? io_x : io_y); ISelection * sel = WED_GetSelect(mResolver); if (!sel->IsSelected(t)) { t->StartOperation("Select Next"); sel->Select(t); t->CommitOperation(); } return 1; } if (reverse==0)reverse=1; ++tries; } while ((start_x != io_x || start_y != io_y || tries <= 1) && tries < 100); // prevent infinite loop if nothing in table is "advanceable" to, e.g. a taxi route edge runway segment return 0; } int WED_PropertyTable::DoubleClickCell( int cell_x, int cell_y) { return 0; } void WED_PropertyTable::GetLegalDropOperations( int& allow_between_col, int& allow_between_row, int& allow_into_cell) { allow_between_col = mVertical && !mSelOnly && mFilter.empty(); allow_between_row = !mVertical && !mSelOnly && mFilter.empty(); allow_into_cell = !mSelOnly && mFilter.empty(); } GUI_DragOperation WED_PropertyTable::CanDropIntoCell( int cell_x, int cell_y, GUI_DragData * drag, GUI_DragOperation allowed, GUI_DragOperation recommended, int& whole_col, int& whole_row) { if (mSelOnly) return gui_Drag_None; if (!mFilter.empty()) return gui_Drag_None; whole_col = mVertical; whole_row = !mVertical; if (!WED_IsDragSelection(drag)) return gui_Drag_None; #if BENTODO address allow/recommend #endif WED_Thing * who = FetchNth(mVertical ? cell_x : cell_y); if (who) return WED_CanMoveSelectionTo(mResolver, who, who->CountChildren()) ? gui_Drag_Move : gui_Drag_None; return gui_Drag_None; } GUI_DragOperation WED_PropertyTable::CanDropBetweenColumns( int cell_x, GUI_DragData * drag, GUI_DragOperation allowed, GUI_DragOperation recommended) { if (mSelOnly) return gui_Drag_None; if (!mFilter.empty()) return gui_Drag_None; if (!mVertical) return gui_Drag_None; if (!WED_IsDragSelection(drag)) return gui_Drag_None; if (cell_x == GetColCount()) { WED_Thing * who = FetchNth(cell_x-1); if (who && who->GetParent()) return WED_CanMoveSelectionTo(mResolver, who->GetParent(), who->GetMyPosition()+1) ? gui_Drag_Move : gui_Drag_None; } else { WED_Thing * who = FetchNth(cell_x); if (who && who->GetParent()) return WED_CanMoveSelectionTo(mResolver, who->GetParent(), who->GetMyPosition()) ? gui_Drag_Move : gui_Drag_None; } return gui_Drag_None; } GUI_DragOperation WED_PropertyTable::CanDropBetweenRows( int cell_y, GUI_DragData * drag, GUI_DragOperation allowed, GUI_DragOperation recommended) { if (mSelOnly) return gui_Drag_None; if (!mFilter.empty()) return gui_Drag_None; if (mVertical) return gui_Drag_None; if (!WED_IsDragSelection(drag)) return gui_Drag_None; if (cell_y == GetRowCount()) { // We are dragging into the top slot of the table. Go right before the top entity. WED_Thing * who = FetchNth(cell_y-1); if (who && who->GetParent()) return WED_CanMoveSelectionTo(mResolver, who->GetParent(), who->GetMyPosition()) ? gui_Drag_Move : gui_Drag_None; } else { // All drags other than the top slot are handled by finding teh guy above us. If above us is open, we drop right into his // first slot, otherwise we go right behind him in his parent. WED_Thing * who = FetchNth(cell_y); if (who && who->GetParent()) { int v,r,c,i; GetFilterStatus(who, WED_GetSelect(mResolver),v,r,c,i); if (i) return WED_CanMoveSelectionTo(mResolver, who, 0) ? gui_Drag_Move : gui_Drag_None; else return WED_CanMoveSelectionTo(mResolver, who->GetParent(), who->GetMyPosition()+1) ? gui_Drag_Move : gui_Drag_None; } } return gui_Drag_None; } GUI_DragOperation WED_PropertyTable::DoDropIntoCell( int cell_x, int cell_y, GUI_DragData * drag, GUI_DragOperation allowed, GUI_DragOperation recommended) { WED_Thing * who = FetchNth(mVertical ? cell_x : cell_y); if (who) WED_DoMoveSelectionTo(mResolver, who, who->CountChildren()); return gui_Drag_Copy; } GUI_DragOperation WED_PropertyTable::DoDropBetweenColumns( int cell_x, GUI_DragData * drag, GUI_DragOperation allowed, GUI_DragOperation recommended) { if (!mVertical) return gui_Drag_None; if (cell_x == GetColCount()) { WED_Thing * who = FetchNth(cell_x-1); if (who && who->GetParent()) WED_DoMoveSelectionTo(mResolver, who->GetParent(), who->GetMyPosition()+1); } else { WED_Thing * who = FetchNth(cell_x); if (who && who->GetParent()) WED_DoMoveSelectionTo(mResolver, who->GetParent(), who->GetMyPosition()); } return gui_Drag_Copy; } GUI_DragOperation WED_PropertyTable::DoDropBetweenRows( int cell_y, GUI_DragData * drag, GUI_DragOperation allowed, GUI_DragOperation recommended) { if (mVertical) return gui_Drag_None; if (cell_y == GetRowCount()) { WED_Thing * who = FetchNth(cell_y-1); if (who && who->GetParent()) WED_DoMoveSelectionTo(mResolver, who->GetParent(), who->GetMyPosition()+1); } else { WED_Thing * who = FetchNth(cell_y); if (who && who->GetParent()) { int v,r,c,i; GetFilterStatus(who, WED_GetSelect(mResolver),v,r,c,i); if (i) WED_DoMoveSelectionTo(mResolver, who, 0); else WED_DoMoveSelectionTo(mResolver, who->GetParent(), who->GetMyPosition()+1); } } return gui_Drag_Copy; } #pragma mark - void WED_PropertyTable::RebuildCacheRecursive(WED_Thing * e, ISelection * sel, set<WED_Thing *> * sel_and_friends) { if (e == NULL) return; int vis,kids,can_disclose,is_disclose; GetFilterStatus(e,sel,vis,kids,can_disclose, is_disclose); if (vis) mThingCache.push_back(e); if (sel_and_friends) if (sel_and_friends->count(e) == 0) return; for (int n = 0; n < kids; ++n) RebuildCacheRecursive(e->GetNthChild(n), sel, sel_and_friends); } // Selection iterator: ref is a ptr to a set. Accumulate the selected thing and all of its parents. static int SelectAndParents(ISelectable * what, void * ref) { set<WED_Thing *> * all = (set<WED_Thing *> *) ref; WED_Thing * who = dynamic_cast<WED_Thing *>(what); while(who) { if (!all->insert(who).second) return 0; who = who->GetParent(); } return 0; } void WED_PropertyTable::RebuildCache(void) { mThingCache.clear(); mCacheValid = true; set<WED_Thing*> all_sel; // Performance note: the "selection" hierarchy (all selected entities) is effectively ALWAYS fully disclosed, because we must iterate // through everything to find the selection. In a situation with a huge hierarchy, this gives us a horribly slow time to rebuild // the contents of the table, even if only one object is selected. (But we DO want to iterate, to go in hierarchy order.) // It turns out we can do better: we build a set (all_sel) that contains the selection and all views that have a selected thing as its // child. This represents a subset of the total tree that needs iteration. When we rebulid our cache, if we hit a thing that isn't in // "selection and friends" set, we simply stop. // This cuts out iteration of whole sub-trees where there is no selection...for a trivial selection this really speeds up rebuild. WED_Thing * root = WED_GetWorld(mResolver); ISelection * sel = WED_GetSelect(mResolver); if (mSelOnly) sel->IterateSelectionOr(SelectAndParents,&all_sel); if (root) RebuildCacheRecursive(root,sel,mSelOnly ? &all_sel : NULL); } WED_Thing * WED_PropertyTable::FetchNth(int row) { if (!mCacheValid) { if (mSearchFilter.empty() == true) { RebuildCache(); } else { Resort(); } } vector<WED_Thing*>& current_cache = mSearchFilter.empty() ? mThingCache : mSortedCache; if (!mVertical) { row = current_cache.size() - row - 1; } return current_cache[row]; } int WED_PropertyTable::GetThingDepth(WED_Thing * d) { WED_Thing * root = WED_GetWorld(mResolver); if (!root) return 0; int ret = 0; while (d) { if (d == root) break; d = d->GetParent(); ++ret; } return ret; } int WED_PropertyTable::GetColCount(void) { if (!mVertical) return mColNames.size(); if (!mCacheValid) { if (mSearchFilter.empty() == true) { RebuildCache(); } else { Resort(); } } vector<WED_Thing*>& current_cache = mSearchFilter.empty() ? mThingCache : mSortedCache; return current_cache.size(); } int WED_PropertyTable::ColForX(int n) { int c = GUI_SimpleTableGeometry::ColForX(n); int cc = GetColCount(); return min(c,cc-1); } int WED_PropertyTable::GetRowCount(void) { if (mVertical) return mColNames.size(); if (!mCacheValid) { if (mSearchFilter.empty() == true) { RebuildCache(); } else { Resort(); } } vector<WED_Thing*>& current_cache = mSearchFilter.empty() ? mThingCache : mSortedCache; return current_cache.size(); } void WED_PropertyTable::ReceiveMessage( GUI_Broadcaster * inSrc, intptr_t inMsg, intptr_t inParam) { // if (inMsg == msg_SelectionChanged) BroadcastMessage(GUI_TABLE_CONTENT_CHANGED,0); if (inMsg == msg_ArchiveChanged) { // Set this to false FIRST, lest we have an explosion due to a stale cache! if (inParam & (wed_Change_CreateDestroy | wed_Change_Topology)) mCacheValid = false; if (mSelOnly && (inParam & wed_Change_Selection)) mCacheValid = false; RecalculateColumns(); BroadcastMessage(GUI_TABLE_CONTENT_RESIZED,0); } } void WED_PropertyTable::GetHeaderContent( int cell_x, GUI_HeaderContent& the_content) { the_content.is_selected = 0; the_content.can_resize = 0; the_content.can_select = 0; if (cell_x >= 0 && cell_x < mColNames.size()) { the_content.title = mColNames[cell_x]; the_content.can_resize = true; } } void WED_PropertyTable::SetClosed(const set<int>& closed_list) { WED_Thing * root = WED_GetWorld(mResolver); WED_Archive * arch = root->GetArchive(); for( set<int>::const_iterator it = closed_list.begin(); it != closed_list.end(); ++it) if(arch->Fetch(*it) != NULL) { SetOpen(*it,0); } mCacheValid = false; BroadcastMessage(GUI_TABLE_CONTENT_RESIZED,0); } void WED_PropertyTable::GetClosed(set<int>& closed_list) { closed_list.clear(); WED_Thing * root = WED_GetWorld(mResolver); WED_Archive * arch = root->GetArchive(); for (hash_map<int, int>::iterator it = mOpen.begin(); it != mOpen.end(); ++it) { if ((arch->Fetch(it->first) != NULL) && (!GetOpen(it->first))) { closed_list.insert(it->first); } } } //--IFilterable---------------------------------------------------------------- void WED_PropertyTable::SetFilter(const string & filter) { if(filter.empty()) { RebuildCache(); // rebuild mCache, so any changes of the hierachy list get recognized } mSearchFilter = filter; Resort(); // this only rebuilds the mSortedCache, not the mCache BroadcastMessage(GUI_TABLE_CONTENT_RESIZED, 0); } //parameters //thing - the current thing //search_filter - the search filter //sorted_cache - the sorted_cache of wed things we're building up //sorted_open_ids - the hash map of id and true false if its open or not //returns number of bad leafs int collect_recusive(WED_Thing * thing, const ci_string& isearch_filter, vector<WED_Thing*>& sorted_cache) { DebugAssert(thing != NULL); bool is_group_like = thing->GetClass() == WED_Group::sClass || thing->GetClass() == WED_Airport::sClass || thing->GetClass() == WED_ATCFlow::sClass; string thing_name; thing->GetName(thing_name); ci_string ithing_name(thing_name.begin(),thing_name.end()); bool is_match = ithing_name.find(isearch_filter) != ci_string::npos; IHasResource * has_resource = NULL; IHasAttr * has_attr = NULL; if (is_match == false) { string res; has_resource = dynamic_cast<IHasResource*>(thing); if (has_resource) has_resource->GetResource(res); else { has_attr = dynamic_cast<IHasAttr*>(thing); if (has_attr) has_attr->GetResource(res); } res = string ("^") + res + "$"; // Adding ^ and $ are to emulate regex-style line start/end makers, so to // allow macthing one of "Red Line", "Red Line (Black)" or "Wide Red Line" is_match = ci_string(res.begin(), res.end()).find(isearch_filter) != ci_string::npos; } int nc = thing->CountChildren(); if (nc == 0 || (is_match && (has_resource || has_attr))) // prevent showing nodes for uniformly set taxilines or taxiways { if (is_match) { sorted_cache.push_back(thing); return 0; //No bad leafs here! } else { return 1; } } else { int current_end_pos = sorted_cache.size(); int bad_leafs = 0; for (int n = 0; n < nc; ++n) { bad_leafs += collect_recusive(thing->GetNthChild(n), isearch_filter, sorted_cache); } //If bad_leafs is less than the number of kids it means that there is at least some reason to keep this group //Or if the group name exactly matches if ((bad_leafs < nc && is_group_like) || is_match) { sorted_cache.insert(sorted_cache.begin() + current_end_pos, thing); return 0; } else { return 1; //Ignore me } } } void WED_PropertyTable::Resort() { mSortedCache.clear(); if (mSearchFilter.empty() == false) { mSortedCache.reserve(mThingCache.size()); ci_string isearch_filter(mSearchFilter.begin(), mSearchFilter.end()); collect_recusive(WED_GetWorld(mResolver), isearch_filter, mSortedCache); } mCacheValid = true; } //----------------------------------------------------------------------------- // These routines encapsulate the hash table that tracks the disclosure of various WED things. We wrap it like this so we can // easily map "no entry" to open. This makes new entities default to open, which seems to be preferable. It'd be easy to customize // the behavior. bool WED_PropertyTable::GetOpen(int id) { return mOpen.count(id) == 0 || mOpen[id] != 0; } void WED_PropertyTable::ToggleOpen(int id) { if (mSearchFilter.empty() == true) { int old_val = GetOpen(id); mOpen[id] = old_val ? 0 : 1; } } void WED_PropertyTable::SetOpen(int id, int o) { if (mSearchFilter.empty() == true) { mOpen[id] = o; } } // This is the main "filter" function - it determines four properties at once about an entity: // 1. Can we actually see this entity? // 2. How many kids do we recurse (basically forcing this to 0 "hides" it. // 3. Is there UI to disclose this element? // 4. Is it disclosed now? // This routine assures some useful sync: // - It understands that vertical layouts (entities across the top) don't have tree behavior. // - It makes sure the children are not listed if the item is not disclosed. // - It makes sure that filtered items are inherently open (since we can't disclose them). // - Right now it is programmed not to iterate on the children of not-truly-composite GIS entities // (Thus it hides the guts of a polygon). void WED_PropertyTable::GetFilterStatus(WED_Thing * what, ISelection * sel, int& visible, int& recurse_children, int& can_disclose, int& is_disclose) { visible = recurse_children = can_disclose = is_disclose = 0; if (what == NULL) return; int is_composite = WED_IsFolder(what); // IGISEntity * e = SAFE_CAST(IGISEntity, what); // if (e) is_composite = e->GetGISClass() == gis_Composite; if (mSelOnly) is_composite = 1; if (!mSelOnly || !sel || sel->IsSelected(what)) if (mFilter.empty() || mFilter.count(what->GetClass())) visible = 1; recurse_children = what->CountChildren(); if (!visible || mVertical) { if (!is_composite) recurse_children = 0; } else { can_disclose = is_composite; is_disclose = can_disclose && GetOpen(what->GetID()); if (!is_disclose) { recurse_children = 0; } } // if(!mVertical && IsGraphNode(what)) visible = 0; // this allows to drag taxiroutes into a subgroup and leave the (invisible) nodes behind. Then lock that group and the nodes are still selectable. No good. }
28.282643
208
0.677364
maboehme
f30c8484815dbe32536af7eda17e7e10f4d4ae26
295
hpp
C++
OCR/ANN/PreprocessorANN.hpp
liuouya/basicOCR
99940949db010839ca42c4e5dad07dd9cf611e64
[ "MIT" ]
null
null
null
OCR/ANN/PreprocessorANN.hpp
liuouya/basicOCR
99940949db010839ca42c4e5dad07dd9cf611e64
[ "MIT" ]
null
null
null
OCR/ANN/PreprocessorANN.hpp
liuouya/basicOCR
99940949db010839ca42c4e5dad07dd9cf611e64
[ "MIT" ]
null
null
null
#pragma once #include <opencv2/core.hpp> #include "../IPreprocessor.hpp" class PreprocessorANN : public IPreprocessor { public: virtual ~PreprocessorANN() {} virtual cv::Mat apply(cv::Mat* image, bool target = false); virtual std::vector<cv::Mat> segmentation(cv::Mat* image); };
18.4375
62
0.698305
liuouya
f30e8c71d68ef695059d706b7cd74b9160789285
3,405
cc
C++
hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/tools/hdfs-allow-snapshot/hdfs-allow-snapshot.cc
luoyuan3471/hadoop
20b78c8f978dc74f03a0dd5551904f8ec40ccf82
[ "Apache-2.0", "BSD-2-Clause", "MIT", "ECL-2.0", "BSD-3-Clause" ]
14,425
2015-01-01T15:34:43.000Z
2022-03-31T15:28:37.000Z
hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/tools/hdfs-allow-snapshot/hdfs-allow-snapshot.cc
bharatviswa504/hadoop-1
3bf014d8717603828ef2dd166d9ec014b7d9b2c9
[ "Apache-2.0", "BSD-2-Clause", "MIT", "ECL-2.0", "BSD-3-Clause" ]
3,805
2015-03-20T15:58:53.000Z
2022-03-31T23:58:37.000Z
hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/tools/hdfs-allow-snapshot/hdfs-allow-snapshot.cc
bharatviswa504/hadoop-1
3bf014d8717603828ef2dd166d9ec014b7d9b2c9
[ "Apache-2.0", "BSD-2-Clause", "MIT", "ECL-2.0", "BSD-3-Clause" ]
9,521
2015-01-01T19:12:52.000Z
2022-03-31T03:07:51.000Z
/* Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ #include <iostream> #include <memory> #include <ostream> #include <sstream> #include <string> #include "hdfs-allow-snapshot.h" #include "tools_common.h" namespace hdfs::tools { AllowSnapshot::AllowSnapshot(const int argc, char **argv) : HdfsTool(argc, argv) {} bool AllowSnapshot::Initialize() { opt_desc_.add_options()("help,h", "Show the help for hdfs_allowSnapshot")( "path", po::value<std::string>(), "The path to the directory to make it snapshot-able"); // We allow only one argument to be passed to this tool. An exception is // thrown if multiple arguments are passed. pos_opt_desc_.add("path", 1); po::store(po::command_line_parser(argc_, argv_) .options(opt_desc_) .positional(pos_opt_desc_) .run(), opt_val_); po::notify(opt_val_); return true; } std::string AllowSnapshot::GetDescription() const { std::stringstream desc; desc << "Usage: hdfs_allowSnapshot [OPTION] PATH" << std::endl << std::endl << "Allowing snapshots of a directory at PATH to be created." << std::endl << "If the operation completes successfully, the directory becomes " "snapshottable." << std::endl << std::endl << " -h display this help and exit" << std::endl << std::endl << "Examples:" << std::endl << "hdfs_allowSnapshot hdfs://localhost.localdomain:8020/dir" << std::endl << "hdfs_allowSnapshot /dir1/dir2" << std::endl; return desc.str(); } bool AllowSnapshot::Do() { if (!Initialize()) { std::cerr << "Unable to initialize HDFS allow snapshot tool" << std::endl; return false; } if (!ValidateConstraints()) { std::cout << GetDescription(); return false; } if (opt_val_.count("help") > 0) { return HandleHelp(); } if (opt_val_.count("path") > 0) { const auto path = opt_val_["path"].as<std::string>(); return HandlePath(path); } return true; } bool AllowSnapshot::HandleHelp() const { std::cout << GetDescription(); return true; } bool AllowSnapshot::HandlePath(const std::string &path) const { // Building a URI object from the given uri_path auto uri = hdfs::parse_path_or_exit(path); const auto fs = hdfs::doConnect(uri, false); if (fs == nullptr) { std::cerr << "Could not connect to the file system. " << std::endl; return false; } const auto status = fs->AllowSnapshot(uri.get_path()); if (!status.ok()) { std::cerr << "Error: " << status.ToString() << std::endl; return false; } return true; } } // namespace hdfs::tools
29.608696
78
0.659031
luoyuan3471
f30f51755007b57339865aed77869ac55dab2cd2
618
cpp
C++
state.cpp
MatthewSmithPhysics/Ising-Model
af5e150603aa0cdae4fd73cdfe36975651ec528d
[ "MIT" ]
null
null
null
state.cpp
MatthewSmithPhysics/Ising-Model
af5e150603aa0cdae4fd73cdfe36975651ec528d
[ "MIT" ]
null
null
null
state.cpp
MatthewSmithPhysics/Ising-Model
af5e150603aa0cdae4fd73cdfe36975651ec528d
[ "MIT" ]
null
null
null
#include"state.h" using namespace std; State::State() { this->scramble(); } State::State(int d, int n) { this->d = d; this->n = n; this->scramble(); } State::State(int d, int n, double J) { this->d = d; this->n = n; this->J = J; this->scramble(); } State State::copy() { State Y = State(this->d, this->n, this->J); for(int i = 0; i < pow(this->n, this->d); i++) Y.S[i] = this->S[i]; return Y; } void State::scramble() { this->S = {}; for(int i = 0; i < pow(this->n, this->d); i++) { int s = rand() % 2; if(s == 0) s = -1; this->S.push_back(s); } }
14.372093
69
0.490291
MatthewSmithPhysics
f310d16cfc96110602cbb8ad8eb738b37b3e1549
24,606
cpp
C++
test/pt-client-2/test_pt_client.cpp
costanic/mbed-edge
4900e950ff67f8974b7aeef955289ef56606c964
[ "Apache-2.0" ]
24
2018-03-27T16:44:18.000Z
2020-04-28T15:28:34.000Z
test/pt-client-2/test_pt_client.cpp
costanic/mbed-edge
4900e950ff67f8974b7aeef955289ef56606c964
[ "Apache-2.0" ]
19
2021-01-28T20:14:45.000Z
2021-11-23T13:08:59.000Z
test/pt-client-2/test_pt_client.cpp
costanic/mbed-edge
4900e950ff67f8974b7aeef955289ef56606c964
[ "Apache-2.0" ]
28
2018-04-02T02:36:48.000Z
2020-10-13T05:37:16.000Z
#include <stdint.h> #include "CppUTest/TestHarness.h" #include "CppUTestExt/MockSupport.h" #include "test-lib/msg_api_mocks.h" #include "test-lib/mutex_helper.h" extern "C" { #include "common/edge_mutex.h" #include "test-lib/evbase_mock.h" #include "libwebsocket-mock/lws_mock.h" #include "pt-client-2/pt_api_internal.h" #include "pt-client-2/pt_client_api.h" #include "pt-client-2/pt_client_helper.h" #include "edge-rpc/rpc_timeout_api.h" } TEST_GROUP(pt_client_2){ void setup() { CHECK_EQUAL(0, mock_msg_api_messages_in_queue()); } void teardown() { mock_msg_api_wipeout_messages(); } }; TEST(pt_client_2, test_pt_api_init_fails) { mock().expectOneCall("evthread_use_pthreads").andReturnValue(1); int rc = pt_api_init(); CHECK(1 == rc); mock().checkExpectations(); } TEST(pt_client_2, test_pt_api_init_succeeds) { mock().expectOneCall("evthread_use_pthreads").andReturnValue(0); int rc = pt_api_init(); CHECK(0 == rc); mock().checkExpectations(); } TEST(pt_client_2, test_pt_client_create_callbacks_null) { pt_client_t *client = pt_client_create(NULL, NULL); CHECK(NULL == client); mock().checkExpectations(); } TEST(pt_client_2, test_pt_client_create_callbacks_empty_fields) { protocol_translator_callbacks_t callbacks; initialize_callbacks(&callbacks); callbacks.connection_ready_cb = NULL; callbacks.connection_shutdown_cb = NULL; pt_client_t *client = pt_client_create(NULL, &callbacks); CHECK(NULL == client); callbacks.connection_ready_cb = test_connection_ready_cb; client = pt_client_create(NULL, &callbacks); CHECK(NULL == client); callbacks.connection_ready_cb = NULL; callbacks.connection_shutdown_cb = test_connection_shutdown_cb; client = pt_client_create(NULL, &callbacks); CHECK(NULL == client); mock().checkExpectations(); } TEST(pt_client_2, test_pt_client_create_no_mutex) { protocol_translator_callbacks_t callbacks; initialize_callbacks(&callbacks); pt_client_t *client = pt_client_create(NULL, &callbacks); CHECK(NULL == client); mock().checkExpectations(); } TEST(pt_client_2, test_pt_client_create_null_socket_path) { protocol_translator_callbacks_t callbacks; initialize_callbacks(&callbacks); pt_client_t *client = pt_client_create(NULL, &callbacks); CHECK(NULL == client); mock().checkExpectations(); } TEST(pt_client_2, test_pt_client_start_client_is_null) { pt_client_start(NULL, NULL, NULL, NULL, NULL); mock().checkExpectations(); } TEST(pt_client_2, test_pt_client_start_name_is_null) { protocol_translator_callbacks_t callbacks; initialize_callbacks(&callbacks); pt_client_t *client = pt_client_create("/tmp/test-socket-path", &callbacks); CHECK(NULL != client); CHECK(NULL != pt_client_get_devices(client)); pt_client_start(client, NULL, NULL, NULL, NULL); pt_client_free(client); mock().checkExpectations(); } TEST(pt_client_2, test_pt_client_start_null_success_and_failure_handler) { protocol_translator_callbacks_t callbacks; initialize_callbacks(&callbacks); pt_client_t *client = create_client(&callbacks); CHECK(NULL != client); CHECK(NULL != pt_client_get_devices(client)); pt_client_start(client, NULL, NULL, "test-name", NULL); pt_client_free(client); mock().checkExpectations(); } TEST(pt_client_2, test_pt_client_start_null_success_handler) { protocol_translator_callbacks_t callbacks; initialize_callbacks(&callbacks); pt_client_t *client = create_client(&callbacks); CHECK(NULL != client); CHECK(NULL != pt_client_get_devices(client)); pt_client_start(client, NULL, test_failure_handler, "test-name", NULL); pt_client_free(client); mock().checkExpectations(); } TEST(pt_client_2, test_pt_client_start_null_failure_handler) { protocol_translator_callbacks_t callbacks; initialize_callbacks(&callbacks); pt_client_t *client = create_client(&callbacks); CHECK(NULL != client); CHECK(NULL != pt_client_get_devices(client)); pt_client_start(client, test_success_handler, NULL, "test-name", NULL); pt_client_free(client); mock().checkExpectations(); } TEST(pt_client_2, test_pt_client_start_null_ev_base) { protocol_translator_callbacks_t callbacks; initialize_callbacks(&callbacks); pt_client_t *client = create_client(&callbacks); CHECK(NULL != client); CHECK(NULL != pt_client_get_devices(client)); mock().expectOneCall("event_base_new").andReturnValue((void *) NULL); mock().expectOneCall("event_base_free"). withParameter("base", (void *) NULL); mock().expectOneCall("libevent_global_shutdown"); mh_expect_mutexing(&rpc_mutex); pt_client_start(client, test_success_handler, test_failure_handler, "test-name", NULL); pt_client_free(client); mock().checkExpectations(); } TEST(pt_client_2, test_pt_client_start_initial_message_fails) { protocol_translator_callbacks_t callbacks; initialize_callbacks(&callbacks); pt_client_t *client = create_client(&callbacks); CHECK(NULL != client); CHECK(NULL != pt_client_get_devices(client)); struct event_base ev_base = {0}; ev_base.event_loop_wait_simulation = false; mock().expectOneCall("event_base_new").andReturnValue(&ev_base); mock().expectOneCall("websocket_set_log_level_and_emit_function"); struct event *timer_event = (struct event *) calloc(1, sizeof(struct event)); timer_event->base = &ev_base; mock().expectOneCall("event_new") .withPointerParameter("base", &ev_base) .withIntParameter("fd", -1) .withIntParameter("flags", EV_PERSIST) .withPointerParameter("callback_fn", (void *) handle_timed_out_requests) .andReturnValue(timer_event); mock().expectOneCall("event_add").andReturnValue(0); mock().expectOneCall("msg_api_send_message").andReturnValue(false); mock().expectOneCall("event_del").withPointerParameter("ev", timer_event).andReturnValue(0); mock().expectOneCall("event_free").withPointerParameter("ev", timer_event); mock().expectOneCall("event_base_free"). withParameter("base", &ev_base); mock().expectOneCall("libevent_global_shutdown"); mh_expect_mutexing(&rpc_mutex); pt_client_start(client, test_success_handler, test_failure_handler, "test-name", NULL); pt_client_free(client); mock().checkExpectations(); free(timer_event); } TEST(pt_client_2, test_pt_client_start_event_dispatch_fails) { protocol_translator_callbacks_t callbacks; initialize_callbacks(&callbacks); pt_client_t *client = create_client(&callbacks); CHECK(NULL != client); CHECK(NULL != pt_client_get_devices(client)); struct event_base ev_base = {0}; ev_base.event_loop_wait_simulation = false; mock().expectOneCall("event_base_new").andReturnValue(&ev_base); mock().expectOneCall("websocket_set_log_level_and_emit_function"); struct event *timer_event = (struct event *) calloc(1, sizeof(struct event)); timer_event->base = &ev_base; mock().expectOneCall("event_new") .withPointerParameter("base", &ev_base) .withIntParameter("fd", -1) .withIntParameter("flags", EV_PERSIST) .withPointerParameter("callback_fn", (void *) handle_timed_out_requests) .andReturnValue(timer_event); mock().expectOneCall("event_add").andReturnValue(0); mock().expectOneCall("msg_api_send_message").andReturnValue(true); mock().expectOneCall("event_base_dispatch").withParameter("base", &ev_base).andReturnValue(1); mock().expectOneCall("event_base_free").withParameter("base", &ev_base); mock().expectOneCall("libevent_global_shutdown"); mh_expect_mutexing(&rpc_mutex); mock().expectOneCall("event_del").withPointerParameter("ev", timer_event).andReturnValue(0); mock().expectOneCall("event_free").withPointerParameter("ev", timer_event); pt_client_start(client, test_success_handler, test_failure_handler, "test-name", NULL); pt_client_free(client); mock().checkExpectations(); free(timer_event); } TEST(pt_client_2, test_pt_client_start) { protocol_translator_callbacks_t callbacks; initialize_callbacks(&callbacks); pt_client_t *client = create_client(&callbacks); client->name = strdup("name, that gets freed."); CHECK(NULL != client); CHECK(NULL != pt_client_get_devices(client)); struct event_base ev_base = {0}; ev_base.event_loop_wait_simulation = false; mock().expectOneCall("event_base_new").andReturnValue(&ev_base); mock().expectOneCall("websocket_set_log_level_and_emit_function"); struct event *timer_event = (struct event *) calloc(1, sizeof(struct event)); timer_event->base = &ev_base; mock().expectOneCall("event_new") .withPointerParameter("base", &ev_base) .withIntParameter("fd", -1) .withIntParameter("flags", EV_PERSIST) .withPointerParameter("callback_fn", (void *) handle_timed_out_requests) .andReturnValue(timer_event); mock().expectOneCall("event_add").andReturnValue(0); mock().expectOneCall("msg_api_send_message").andReturnValue(true); mock().expectOneCall("event_base_dispatch").withParameter("base", &ev_base).andReturnValue(0); mock().expectOneCall("event_del").withPointerParameter("ev", timer_event).andReturnValue(0); mock().expectOneCall("event_free").withPointerParameter("ev", timer_event); mock().expectOneCall("event_base_free"). withParameter("base", &ev_base); mock().expectOneCall("libevent_global_shutdown"); mh_expect_mutexing(&rpc_mutex); pt_client_start(client, test_success_handler, test_failure_handler, "test-name", NULL); pt_client_free(client); mock().checkExpectations(); free(timer_event); } TEST(pt_client_2, test_create_connection_cb_already_closed) { mock().expectOneCall("evthread_use_pthreads").andReturnValue(0); CHECK(0 == pt_api_init()); pt_client_t client; client.close_client = true; mh_expect_mutexing(&api_mutex); create_connection_cb(&client); mock().checkExpectations(); } TEST(pt_client_2, test_create_connection_cb) { mock().expectOneCall("evthread_use_pthreads").andReturnValue(0); CHECK(0 == pt_api_init()); struct lws_context *lws_ctx = (struct lws_context*) malloc(sizeof(struct lws_context)); struct lws lws; mock().expectOneCall("lws_create_context").andReturnValue(lws_ctx); mock().expectOneCall("lws_client_connect_via_info") .withStringParameter("path", "/1/pt") .andReturnValue(&lws); protocol_translator_callbacks_t callbacks; initialize_callbacks(&callbacks); pt_client_t *client = create_client(&callbacks); client->close_client = false; mh_expect_mutexing(&api_mutex); create_connection_cb(client); struct event_base ev_base = {0}; ev_base.event_loop_started = false; ev_base.event_loop_wait_simulation = true; client->ev_base = &ev_base; mock().expectOneCall("lws_context_destroy"); mock().expectOneCall("event_base_loopexit").withParameter("base", &ev_base) .withParameter("tv", (void *) NULL) .andReturnValue(0); client->close_client = true; destroy_connection_and_restart_reconnection_timer(find_connection(client->connection_id)); pt_client_free(client); mock().checkExpectations(); } TEST(pt_client_2, test_create_connection_cb_websocket_create_fails_and_succeeds) { mock().expectOneCall("evthread_use_pthreads").andReturnValue(0); CHECK(0 == pt_api_init()); protocol_translator_callbacks_t callbacks; initialize_callbacks(&callbacks); pt_client_t *client = create_client(&callbacks); client->close_client = false; mock().expectOneCall("lws_create_context").andReturnValue((void *) NULL); mock().expectOneCall("lws_context_destroy"); mock().expectOneCall("msg_api_send_message_after_timeout_in_ms") .andReturnValue(true); mh_expect_mutexing(&api_mutex); create_connection_cb(client); pt_client_free(client); mock().checkExpectations(); } TEST(pt_client_2, test_pt_client_shutdown_success) { protocol_translator_callbacks_t callbacks; initialize_callbacks(&callbacks); pt_client_t *client = create_client(&callbacks); mock().expectOneCall("msg_api_send_message").andReturnValue(true); CHECK(PT_STATUS_SUCCESS == pt_client_shutdown(client)); pt_client_free(client); mock().checkExpectations(); } TEST(pt_client_2, test_pt_client_no_client) { CHECK(PT_STATUS_ERROR == pt_client_shutdown(NULL)); mock().checkExpectations(); } TEST(pt_client_2, test_pt_client_shutdown_failure) { protocol_translator_callbacks_t callbacks; initialize_callbacks(&callbacks); pt_client_t *client = create_client(&callbacks); mock().expectOneCall("msg_api_send_message").andReturnValue(false); CHECK(PT_STATUS_ERROR == pt_client_shutdown(client)); pt_client_free(client); mock().checkExpectations(); } TEST(pt_client_2, test_pt_client_shutdown_cb_connection_found_and_ok) { protocol_translator_callbacks_t callbacks; initialize_callbacks(&callbacks); pt_client_t *client = create_client(&callbacks); mock().expectOneCall("evthread_use_pthreads"); pt_api_init(); struct lws_context *lws_ctx = (struct lws_context *) malloc(sizeof(struct lws_context)); struct lws lws; mock().expectOneCall("lws_create_context").andReturnValue(lws_ctx); mock().expectOneCall("lws_client_connect_via_info").withStringParameter("path", "/1/pt").andReturnValue(&lws); create_client_connection(client); mock().expectOneCall("lws_callback_on_writable"); mh_expect_mutexing(&api_mutex); pt_client_shutdown_cb(client); mock().expectOneCall("lws_context_destroy"); connection_t *connection = find_connection(client->connection_id); transport_connection_t *transport_connection = connection->transport_connection; websocket_connection_t *websocket_conn = (websocket_connection_t *) transport_connection->transport; websocket_connection_t_destroy(&websocket_conn); transport_connection_t_destroy(&transport_connection); connection_destroy(connection); pt_client_free(client); mock().checkExpectations(); } TEST(pt_client_2, test_pt_client_shutdown_cb_connection_found_and_no_websocket_connection) { protocol_translator_callbacks_t callbacks; initialize_callbacks(&callbacks); pt_client_t *client = create_client(&callbacks); mock().expectOneCall("evthread_use_pthreads"); pt_api_init(); connection_t *connection = connection_init(client); client->connection_id = get_connection_id(connection); mh_expect_mutexing(&api_mutex); pt_client_shutdown_cb(client); connection_destroy(connection); pt_client_free(client); mock().checkExpectations(); } TEST(pt_client_2, test_pt_client_shutdown_cb_no_connections) { protocol_translator_callbacks_t callbacks; initialize_callbacks(&callbacks); pt_client_t *client = create_client(&callbacks); mh_expect_mutexing(&api_mutex); pt_client_shutdown_cb(client); pt_client_free(client); mock().checkExpectations(); } char *test_generate_msg_id() { return (char *) "STATIC-ID"; } TEST(pt_client_2, test_pt_client_set_msg_id_generator) { pt_client_t client; pt_client_set_msg_id_generator(&client, NULL); pt_client_set_msg_id_generator(&client, test_generate_msg_id); mock().checkExpectations(); } TEST(pt_client_2, test_pt_client_get_connection_id) { pt_client_t client; client.connection_id = 0; CHECK(0 == pt_client_get_connection_id(&client)); mock().checkExpectations(); } TEST(pt_client_2, test_default_check_close_condition) { pt_client_t client; CHECK(default_check_close_condition(&client, true)); CHECK(!default_check_close_condition(&client, false)); mock().checkExpectations(); } TEST(pt_client_2, test_pt_client_write_data_success) { websocket_connection_t ws_connection; transport_connection_t transport_connection; transport_connection.transport = &ws_connection; connection_t connection; connection.transport_connection = &transport_connection; const char *data = "Data."; mock().expectOneCall("send_to_websocket").andReturnValue(0); CHECK(0 == pt_client_write_data(&connection, (char *) data, strlen(data))); mock().checkExpectations(); } TEST(pt_client_2, test_pt_client_write_data_failure) { websocket_connection_t ws_connection; transport_connection_t transport_connection; transport_connection.transport = &ws_connection; connection_t connection; connection.transport_connection = &transport_connection; const char *data = "Data."; mock().expectOneCall("send_to_websocket").andReturnValue(1); CHECK(1 == pt_client_write_data(&connection, (char *) data, strlen(data))); mock().checkExpectations(); } int test_method(json_t *request, json_t *json_params, json_t **result, void *userdata) { *result = json_string("test_method_result"); return mock().actualCall("test_method") .returnIntValue(); } static int test_write_function(connection_t *connection, char *data, size_t len) { int rc = mock().actualCall("test_write_function").returnIntValue(); printf("test_write_function: %.*s\n", (int) len, data); free(data); return rc; } struct jsonrpc_method_entry_t test_method_table[] = { {"test", test_method, NULL}, {NULL, NULL, "o"} }; TEST(pt_client_2, test_pt_client_read_data_success) { char *data = (char *) "{\"jsonrpc\":\"2.0\", \"id\":\"90\",\"method\":\"test\"}"; transport_connection_t transport_connection; transport_connection.write_function = test_write_function; pt_client_t client; client.method_table = test_method_table; connection_t connection; connection.client = &client; connection.transport_connection = &transport_connection; mock().expectOneCall("test_method").andReturnValue(0); mock().expectOneCall("test_write_function").andReturnValue(0); CHECK(0 == pt_client_read_data(&connection, data, strlen(data))); mock().checkExpectations(); } TEST(pt_client_2, test_pt_client_read_data_protocol_error) { char *data = (char *) "{\"jsonrpc\":\"2.0\", \"id\":\"90\",\"method\":\"test\"}BROKEN_MSG"; transport_connection_t transport_connection; transport_connection.write_function = test_write_function; pt_client_t client; client.method_table = test_method_table; connection_t connection; connection.client = &client; connection.transport_connection = &transport_connection; CHECK(1 == pt_client_read_data(&connection, data, strlen(data))); mock().checkExpectations(); } TEST(pt_client_2, test_pt_client_read_data_failure) { char *data = (char *) "{\"jsonrpc\":\"2.0\", \"id\":\"90\",\"method\":\"test\"}"; transport_connection_t transport_connection; transport_connection.write_function = test_write_function; pt_client_t client; client.method_table = test_method_table; connection_t connection; connection.client = &client; connection.transport_connection = &transport_connection; mock().expectOneCall("test_method").andReturnValue(0); mock().expectOneCall("test_write_function").andReturnValue(1); CHECK(2 == pt_client_read_data(&connection, data, strlen(data))); mock().checkExpectations(); } TEST(pt_client_2, test_pt_client_disconnected_cb_close_flag_set) { struct event_base ev_base = {0}; ev_base.event_loop_started = false; pt_client_t client; client.close_client = true; client.close_condition_impl = default_check_close_condition; client.ev_base = &ev_base; mh_expect_mutexing(&api_mutex); mock().expectOneCall("event_base_loopexit") .withPointerParameter("base", &ev_base) .withPointerParameter("tv", NULL); pt_client_disconnected_cb(&client); mock().checkExpectations(); } TEST(pt_client_2, test_pt_client_disconnected_cb_restart_connection_timer) { pt_client_t client; client.close_client = false; client.reconnection_triggered = false; client.tries = 0; client.backoff_time_in_sec = 0; client.close_condition_impl = default_check_close_condition; // run reconnection attempts for (int i = 0; i < 6; i++) { mh_expect_mutexing(&api_mutex); mock().expectOneCall("msg_api_send_message_after_timeout_in_ms").andReturnValue(true); client.reconnection_triggered = false; pt_client_disconnected_cb(&client); int tries = i < 5 ? (i + 1) : 5; CHECK(tries == client.tries); int backoff_time = i < 5 ? (i + 1) * 1 : 5; CHECK(backoff_time == client.backoff_time_in_sec); } // run with reconnection_triggered = true CHECK(client.reconnection_triggered); mh_expect_mutexing(&api_mutex); pt_client_disconnected_cb(&client); mock().checkExpectations(); } TEST(pt_client_2, test_pt_client_disconnected_cb_destroy_connection_and_restart) { pt_client_t client; client.close_client = false; client.reconnection_triggered = true; client.close_condition_impl = default_check_close_condition; mock().expectOneCall("evthread_use_pthreads").andReturnValue(0); CHECK(0 == pt_api_init()); struct lws_context *lws_ctx = (struct lws_context *) malloc(sizeof(struct lws_context)); struct lws lws; mock().expectOneCall("lws_create_context").andReturnValue(lws_ctx); mock().expectOneCall("lws_client_connect_via_info").withStringParameter("path", "/1/pt").andReturnValue(&lws); create_client_connection(&client); mh_expect_mutexing(&api_mutex); mock().expectOneCall("lws_context_destroy"); pt_client_disconnected_cb(&client); mock().checkExpectations(); } TEST(pt_client_2, test_websocket_disconnected_no_connection) { websocket_connection_t websocket_connection; websocket_connection.conn = NULL; websocket_disconnected(&websocket_connection); mock().checkExpectations(); } TEST(pt_client_2, test_websocket_disconnected_connection_unable_to_send_message) { protocol_translator_callbacks_t callbacks; initialize_callbacks(&callbacks); pt_client_t *client = create_client(&callbacks); connection_t connection; connection.connected = true; connection.client = client; websocket_connection_t websocket_connection; websocket_connection.conn = &connection; mh_expect_mutexing(&rpc_mutex); mock().expectOneCall("test_disconnected_cb"); mock().expectOneCall("msg_api_send_message").andReturnValue(false); websocket_disconnected(&websocket_connection); CHECK(!connection.connected); pt_client_free(client); mock().checkExpectations(); } TEST(pt_client_2, test_websocket_disconnected_connection) { protocol_translator_callbacks_t callbacks; initialize_callbacks(&callbacks); pt_client_t *client = create_client(&callbacks); connection_t connection; connection.connected = true; connection.client = client; websocket_connection_t websocket_connection; websocket_connection.conn = &connection; mh_expect_mutexing(&rpc_mutex); mock().expectOneCall("test_disconnected_cb"); mock().expectOneCall("msg_api_send_message").andReturnValue(true); websocket_disconnected(&websocket_connection); CHECK(!connection.connected); pt_client_free(client); mock().checkExpectations(); } TEST(pt_client_2, test_websocket_connection_t_destroy) { struct lws_context *lws_ctx = (struct lws_context *) malloc(sizeof(struct lws_context)); websocket_connection_t *ws_connection = (websocket_connection_t *) malloc(sizeof(websocket_connection_t)); ws_connection->lws_context = lws_ctx; websocket_message_list_t *ws_msg_list = (websocket_message_list_t *) malloc(sizeof(websocket_message_list_t)); ws_connection->sent = ws_msg_list; ns_list_init(ws_connection->sent); websocket_message_t *msg_1 = (websocket_message_t *) malloc(sizeof(websocket_message_t)); msg_1->bytes = (uint8_t *) strdup("msg_1"); websocket_message_t *msg_2 = (websocket_message_t *) malloc(sizeof(websocket_message_t)); msg_2->bytes = (uint8_t *) strdup("msg_2"); ns_list_add_to_end(ws_msg_list, msg_1); ns_list_add_to_end(ws_msg_list, msg_2); mock().expectOneCall("lws_context_destroy"); websocket_connection_t_destroy(&ws_connection); mock().checkExpectations(); }
33.432065
114
0.736731
costanic
f3129105bbf6009f766bca0bc87eda7dbeaf7254
3,060
cpp
C++
modules/core/gallery/unit/gallery/magic.cpp
psiha/nt2
5e829807f6b57b339ca1be918a6b60a2507c54d0
[ "BSL-1.0" ]
34
2017-05-19T18:10:17.000Z
2022-01-04T02:18:13.000Z
modules/core/gallery/unit/gallery/magic.cpp
psiha/nt2
5e829807f6b57b339ca1be918a6b60a2507c54d0
[ "BSL-1.0" ]
null
null
null
modules/core/gallery/unit/gallery/magic.cpp
psiha/nt2
5e829807f6b57b339ca1be918a6b60a2507c54d0
[ "BSL-1.0" ]
7
2017-12-02T12:59:17.000Z
2021-07-31T12:46:14.000Z
//============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #define NT2_UNIT_MODULE "nt2 gallery toolbox - magic function" #include <nt2/table.hpp> #include <nt2/include/functions/magic.hpp> #include <nt2/include/functions/transpose.hpp> #include <nt2/include/functions/ones.hpp> #include <nt2/include/functions/cast.hpp> #include <nt2/include/functions/cons.hpp> #include <nt2/sdk/unit/tests.hpp> #include <nt2/sdk/unit/module.hpp> #include <nt2/sdk/unit/tests/exceptions.hpp> NT2_TEST_CASE_TPL ( magicodd, NT2_REAL_TYPES) { nt2::table<T> m3 = nt2::trans(nt2::reshape(nt2::cons( T(8), T(1), T(6), T(3), T(5), T(7), T(4), T(9), T(2) ), nt2::of_size(3, 3))); nt2::table<T> v = nt2::magic(3, nt2::meta::as_<T>()); NT2_DISPLAY(v); nt2::table<T> v1 = nt2::cast<T>(nt2::magic(3)); nt2::table<T> v2 = nt2::magic<T>(3); NT2_TEST_EQUAL(v, m3); NT2_TEST_EQUAL(v1, m3); NT2_TEST_EQUAL(v2, m3); } NT2_TEST_CASE_TPL ( magic2even, NT2_REAL_TYPES) { nt2::table<T> m4 = nt2::trans(nt2::reshape(nt2::cons( T(16), T(2), T(3), T(13), T(5), T(11), T(10), T(8), T(9), T(7), T( 6), T(12), T(4), T(14), T(15), T(1) ), nt2::of_size(4, 4))); nt2::table<T> v = nt2::magic(4, nt2::meta::as_<T>()); NT2_DISPLAY(v); nt2::table<T> v1 = nt2::cast<T>(nt2::magic(4)); nt2::table<T> v2 = nt2::magic<T>(4); NT2_TEST_EQUAL(v, m4); NT2_TEST_EQUAL(v1, m4); NT2_TEST_EQUAL(v2, m4); } NT2_TEST_CASE_TPL ( magiceven, NT2_REAL_TYPES) { nt2::table<T> m6 = nt2::trans(nt2::reshape(nt2::cons( T(35), T(1), T(6), T(26), T(19), T(24), T(3), T(32), T(7), T(21), T(23), T(25), T(31), T(9), T(2), T(22), T(27), T(20), T(8), T(28), T(33), T(17), T(10), T(15), T(30), T(5), T(34), T(12), T(14), T(16), T(4), T(36), T(29), T(13), T(18), T(11) ), nt2::of_size(6, 6))); nt2::table<T> v = nt2::magic(6, nt2::meta::as_<T>()); nt2::table<T> v1 = nt2::cast<T>(nt2::magic(6)); nt2::table<T> v2 = nt2::magic<T>(6); NT2_TEST_EQUAL(v, m6); NT2_TEST_EQUAL(v1, m6); NT2_TEST_EQUAL(v2, m6); }
38.25
84
0.448693
psiha
f31525d3f14956f46ae95478176b673f0912151f
18,220
cpp
C++
src/gle/color.cpp
vlabella/GLE
ff6b424fda75d674c6a9f270ccdade3ab149e24f
[ "BSD-3-Clause" ]
3
2022-03-03T06:48:33.000Z
2022-03-13T21:18:11.000Z
src/gle/color.cpp
vlabella/GLE
ff6b424fda75d674c6a9f270ccdade3ab149e24f
[ "BSD-3-Clause" ]
1
2022-03-14T13:01:29.000Z
2022-03-14T13:13:23.000Z
src/gle/color.cpp
vlabella/GLE
ff6b424fda75d674c6a9f270ccdade3ab149e24f
[ "BSD-3-Clause" ]
1
2021-12-21T23:14:06.000Z
2021-12-21T23:14:06.000Z
/************************************************************************ * * * GLE - Graphics Layout Engine <http://www.gle-graphics.org/> * * * * Modified BSD License * * * * Copyright (C) 2009 GLE. * * * * Redistribution and use in source and binary forms, with or without * * modification, are permitted provided that the following conditions * * are met: * * * * 1. Redistributions of source code must retain the above copyright * * notice, this list of conditions and the following disclaimer. * * * * 2. Redistributions in binary form must reproduce the above * * copyright notice, this list of conditions and the following * * disclaimer in the documentation and/or other materials provided with * * the distribution. * * * * 3. The name of the author may not be used to endorse or promote * * products derived from this software without specific prior written * * permission. * * * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR * * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY * * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE * * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER * * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR * * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN * * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * * ************************************************************************/ #include <fstream> #include "all.h" #include "cutils.h" #include "gle-interface/gle-interface.h" #include "color.h" GLEColorList* g_ColorList = NULL; GLEColorList* GLEGetColorList() { if (g_ColorList == NULL) { g_ColorList = new GLEColorList(); g_ColorList->defineDefaultColors(); } return g_ColorList; } GLEColorList::GLEColorList() { } GLEColorList::~GLEColorList() { } void GLEColorList::reset() { m_Colors.clear(); m_ColorHash.clear(); m_OldColors.clear(); m_OldColorHash.clear(); defineDefaultColors(); } GLEColor* GLEColorList::get(const string& name) { int idx = m_ColorHash.try_get(name); if (idx != -1) { return m_Colors.get(idx); } int old_idx = m_OldColorHash.try_get(name); if (old_idx != -1) { return m_OldColors.get(old_idx); } return NULL; } GLEColor* GLEColorList::getSafeDefaultBlack(const string& name) { GLEColor* res = get(name); if (res == NULL) res = getColor(GLE_COLOR_BLACK); return res; } void GLEColorList::defineColor(const char* name, unsigned int value) { string key = name; defineColor(key, value); } void GLEColorList::defineColor(const string& name, unsigned int value) { GLEColor* color = new GLEColor(); color->setHexValue(value); defineColor(name, color); } void GLEColorList::defineColor(const string& name, GLEColor* color) { color->setName(name); int idx = m_ColorHash.try_get(name); if (idx != -1) { m_Colors[idx] = color; } else { int new_pos = m_Colors.size(); m_Colors.add(color); m_ColorHash.add_item(name, new_pos); } } void GLEColorList::defineOldColor(const char* name, unsigned int value) { string key = name; defineOldColor(key, value); } void GLEColorList::defineOldColor(const string& name, unsigned int value) { GLEColor* color = new GLEColor(); color->setHexValue(value); color->setName(name); int idx = m_OldColorHash.try_get(name); if (idx != -1) { m_OldColors[idx] = color; } else { int new_pos = m_OldColors.size(); m_OldColors.add(color); m_OldColorHash.add_item(name, new_pos); } } void GLEColorList::defineDefaultColors() { defineGrays(); defineSVGColors(); defineOldGLEColors(); } void GLEColorList::defineGrays() { defineColor("GRAY1", GLE_COLOR_GRAY1); defineColor("GRAY5", GLE_COLOR_GRAY5); defineColor("GRAY10", GLE_COLOR_GRAY10); defineColor("GRAY20", GLE_COLOR_GRAY20); defineColor("GRAY30", GLE_COLOR_GRAY30); defineColor("GRAY40", GLE_COLOR_GRAY40); defineColor("GRAY50", GLE_COLOR_GRAY50); defineColor("GRAY60", GLE_COLOR_GRAY60); defineColor("GRAY70", GLE_COLOR_GRAY70); defineColor("GRAY80", GLE_COLOR_GRAY80); defineColor("GRAY90", GLE_COLOR_GRAY90); } void GLEColorList::defineSVGColors() { defineColor("ALICEBLUE", GLE_COLOR_ALICEBLUE); defineColor("ANTIQUEWHITE", GLE_COLOR_ANTIQUEWHITE); defineColor("AQUA", GLE_COLOR_AQUA); defineColor("AQUAMARINE", GLE_COLOR_AQUAMARINE); defineColor("AZURE", GLE_COLOR_AZURE); defineColor("BEIGE", GLE_COLOR_BEIGE); defineColor("BISQUE", GLE_COLOR_BISQUE); defineColor("BLACK", GLE_COLOR_BLACK); defineColor("BLANCHEDALMOND", GLE_COLOR_BLANCHEDALMOND); defineColor("BLUE", GLE_COLOR_BLUE); defineColor("BLUEVIOLET", GLE_COLOR_BLUEVIOLET); defineColor("BROWN", GLE_COLOR_BROWN); defineColor("BURLYWOOD", GLE_COLOR_BURLYWOOD); defineColor("CADETBLUE", GLE_COLOR_CADETBLUE); defineColor("CHARTREUSE", GLE_COLOR_CHARTREUSE); defineColor("CHOCOLATE", GLE_COLOR_CHOCOLATE); defineColor("CORAL", GLE_COLOR_CORAL); defineColor("CORNFLOWERBLUE", GLE_COLOR_CORNFLOWERBLUE); defineColor("CORNSILK", GLE_COLOR_CORNSILK); defineColor("CRIMSON", GLE_COLOR_CRIMSON); defineColor("CYAN", GLE_COLOR_CYAN); defineColor("DARKBLUE", GLE_COLOR_DARKBLUE); defineColor("DARKCYAN", GLE_COLOR_DARKCYAN); defineColor("DARKGOLDENROD", GLE_COLOR_DARKGOLDENROD); defineColor("DARKGRAY", GLE_COLOR_DARKGRAY); defineColor("DARKGREEN", GLE_COLOR_DARKGREEN); defineColor("DARKKHAKI", GLE_COLOR_DARKKHAKI); defineColor("DARKMAGENTA", GLE_COLOR_DARKMAGENTA); defineColor("DARKOLIVEGREEN", GLE_COLOR_DARKOLIVEGREEN); defineColor("DARKORANGE", GLE_COLOR_DARKORANGE); defineColor("DARKORCHID", GLE_COLOR_DARKORCHID); defineColor("DARKRED", GLE_COLOR_DARKRED); defineColor("DARKSALMON", GLE_COLOR_DARKSALMON); defineColor("DARKSEAGREEN", GLE_COLOR_DARKSEAGREEN); defineColor("DARKSLATEBLUE", GLE_COLOR_DARKSLATEBLUE); defineColor("DARKSLATEGRAY", GLE_COLOR_DARKSLATEGRAY); defineColor("DARKTURQUOISE", GLE_COLOR_DARKTURQUOISE); defineColor("DARKVIOLET", GLE_COLOR_DARKVIOLET); defineColor("DEEPPINK", GLE_COLOR_DEEPPINK); defineColor("DEEPSKYBLUE", GLE_COLOR_DEEPSKYBLUE); defineColor("DIMGRAY", GLE_COLOR_DIMGRAY); defineColor("DODGERBLUE", GLE_COLOR_DODGERBLUE); defineColor("FIREBRICK", GLE_COLOR_FIREBRICK); defineColor("FLORALWHITE", GLE_COLOR_FLORALWHITE); defineColor("FORESTGREEN", GLE_COLOR_FORESTGREEN); defineColor("FUCHSIA", GLE_COLOR_FUCHSIA); defineColor("GAINSBORO", GLE_COLOR_GAINSBORO); defineColor("GHOSTWHITE", GLE_COLOR_GHOSTWHITE); defineColor("GOLD", GLE_COLOR_GOLD); defineColor("GOLDENROD", GLE_COLOR_GOLDENROD); defineColor("GRAY", GLE_COLOR_GRAY); defineColor("GREEN", GLE_COLOR_GREEN); defineColor("GREENYELLOW", GLE_COLOR_GREENYELLOW); defineColor("HONEYDEW", GLE_COLOR_HONEYDEW); defineColor("HOTPINK", GLE_COLOR_HOTPINK); defineColor("INDIANRED", GLE_COLOR_INDIANRED); defineColor("INDIGO", GLE_COLOR_INDIGO); defineColor("IVORY", GLE_COLOR_IVORY); defineColor("KHAKI", GLE_COLOR_KHAKI); defineColor("LAVENDER", GLE_COLOR_LAVENDER); defineColor("LAVENDERBLUSH", GLE_COLOR_LAVENDERBLUSH); defineColor("LAWNGREEN", GLE_COLOR_LAWNGREEN); defineColor("LEMONCHIFFON", GLE_COLOR_LEMONCHIFFON); defineColor("LIGHTBLUE", GLE_COLOR_LIGHTBLUE); defineColor("LIGHTCORAL", GLE_COLOR_LIGHTCORAL); defineColor("LIGHTCYAN", GLE_COLOR_LIGHTCYAN); defineColor("LIGHTGOLDENRODYELLOW", GLE_COLOR_LIGHTGOLDENRODYELLOW); defineColor("LIGHTGRAY", GLE_COLOR_LIGHTGRAY); defineColor("LIGHTGREEN", GLE_COLOR_LIGHTGREEN); defineColor("LIGHTPINK", GLE_COLOR_LIGHTPINK); defineColor("LIGHTSALMON", GLE_COLOR_LIGHTSALMON); defineColor("LIGHTSEAGREEN", GLE_COLOR_LIGHTSEAGREEN); defineColor("LIGHTSKYBLUE", GLE_COLOR_LIGHTSKYBLUE); defineColor("LIGHTSLATEGRAY", GLE_COLOR_LIGHTSLATEGRAY); defineColor("LIGHTSTEELBLUE", GLE_COLOR_LIGHTSTEELBLUE); defineColor("LIGHTYELLOW", GLE_COLOR_LIGHTYELLOW); defineColor("LIME", GLE_COLOR_LIME); defineColor("LIMEGREEN", GLE_COLOR_LIMEGREEN); defineColor("LINEN", GLE_COLOR_LINEN); defineColor("MAGENTA", GLE_COLOR_MAGENTA); defineColor("MAROON", GLE_COLOR_MAROON); defineColor("MEDIUMAQUAMARINE", GLE_COLOR_MEDIUMAQUAMARINE); defineColor("MEDIUMBLUE", GLE_COLOR_MEDIUMBLUE); defineColor("MEDIUMORCHID", GLE_COLOR_MEDIUMORCHID); defineColor("MEDIUMPURPLE", GLE_COLOR_MEDIUMPURPLE); defineColor("MEDIUMSEAGREEN", GLE_COLOR_MEDIUMSEAGREEN); defineColor("MEDIUMSLATEBLUE", GLE_COLOR_MEDIUMSLATEBLUE); defineColor("MEDIUMSPRINGGREEN", GLE_COLOR_MEDIUMSPRINGGREEN); defineColor("MEDIUMTURQUOISE", GLE_COLOR_MEDIUMTURQUOISE); defineColor("MEDIUMVIOLETRED", GLE_COLOR_MEDIUMVIOLETRED); defineColor("MIDNIGHTBLUE", GLE_COLOR_MIDNIGHTBLUE); defineColor("MINTCREAM", GLE_COLOR_MINTCREAM); defineColor("MISTYROSE", GLE_COLOR_MISTYROSE); defineColor("MOCCASIN", GLE_COLOR_MOCCASIN); defineColor("NAVAJOWHITE", GLE_COLOR_NAVAJOWHITE); defineColor("NAVY", GLE_COLOR_NAVY); defineColor("OLDLACE", GLE_COLOR_OLDLACE); defineColor("OLIVE", GLE_COLOR_OLIVE); defineColor("OLIVEDRAB", GLE_COLOR_OLIVEDRAB); defineColor("ORANGE", GLE_COLOR_ORANGE); defineColor("ORANGERED", GLE_COLOR_ORANGERED); defineColor("ORCHID", GLE_COLOR_ORCHID); defineColor("PALEGOLDENROD", GLE_COLOR_PALEGOLDENROD); defineColor("PALEGREEN", GLE_COLOR_PALEGREEN); defineColor("PALETURQUOISE", GLE_COLOR_PALETURQUOISE); defineColor("PALEVIOLETRED", GLE_COLOR_PALEVIOLETRED); defineColor("PAPAYAWHIP", GLE_COLOR_PAPAYAWHIP); defineColor("PEACHPUFF", GLE_COLOR_PEACHPUFF); defineColor("PERU", GLE_COLOR_PERU); defineColor("PINK", GLE_COLOR_PINK); defineColor("PLUM", GLE_COLOR_PLUM); defineColor("POWDERBLUE", GLE_COLOR_POWDERBLUE); defineColor("PURPLE", GLE_COLOR_PURPLE); defineColor("RED", GLE_COLOR_RED); defineColor("ROSYBROWN", GLE_COLOR_ROSYBROWN); defineColor("ROYALBLUE", GLE_COLOR_ROYALBLUE); defineColor("SADDLEBROWN", GLE_COLOR_SADDLEBROWN); defineColor("SALMON", GLE_COLOR_SALMON); defineColor("SANDYBROWN", GLE_COLOR_SANDYBROWN); defineColor("SEAGREEN", GLE_COLOR_SEAGREEN); defineColor("SEASHELL", GLE_COLOR_SEASHELL); defineColor("SIENNA", GLE_COLOR_SIENNA); defineColor("SILVER", GLE_COLOR_SILVER); defineColor("SKYBLUE", GLE_COLOR_SKYBLUE); defineColor("SLATEBLUE", GLE_COLOR_SLATEBLUE); defineColor("SLATEGRAY", GLE_COLOR_SLATEGRAY); defineColor("SNOW", GLE_COLOR_SNOW); defineColor("SPRINGGREEN", GLE_COLOR_SPRINGGREEN); defineColor("STEELBLUE", GLE_COLOR_STEELBLUE); defineColor("TAN", GLE_COLOR_TAN); defineColor("TEAL", GLE_COLOR_TEAL); defineColor("THISTLE", GLE_COLOR_THISTLE); defineColor("TOMATO", GLE_COLOR_TOMATO); defineColor("TURQUOISE", GLE_COLOR_TURQUOISE); defineColor("VIOLET", GLE_COLOR_VIOLET); defineColor("WHEAT", GLE_COLOR_WHEAT); defineColor("WHITE", GLE_COLOR_WHITE); defineColor("WHITESMOKE", GLE_COLOR_WHITESMOKE); defineColor("YELLOW", GLE_COLOR_YELLOW); defineColor("YELLOWGREEN", GLE_COLOR_YELLOWGREEN); } void GLEColorList::defineOldGLEColors() { defineOldColor("BAKERS_CHOCOLATE", 0x5C3317); defineOldColor("BLUE_VIOLET", 0x9F5F9F); defineOldColor("BRASS", 0xB5A642); defineOldColor("BRIGHT_GOLD", 0xD9D919); defineOldColor("BRONZE", 0x8C7853); defineOldColor("BRONZE_II", 0xA67D3D); defineOldColor("BROWN_WEB", 0xA62A2A); defineOldColor("CADET_BLUE", 0x5F9F9F); defineOldColor("COOL_COPPER", 0xD98719); defineOldColor("COPPER", 0xB87333); defineOldColor("CORN_FLOWER_BLUE", 0x42426F); defineOldColor("DARK_BROWN", 0x5C4033); defineOldColor("DARK_GREEN", 0x2F4F2F); defineOldColor("DARK_GREEN_COPPER", 0x4A766E); defineOldColor("DARK_OLIVE_GREEN", 0x4F4F2F); defineOldColor("DARK_ORCHID", 0x9932CD); defineOldColor("DARK_PURPLE", 0x871F78); defineOldColor("DARK_SLATE_BLUE", 0x6B238E); defineOldColor("DARK_SLATE_GRAY", 0x2F4F4F); defineOldColor("DARK_SLATE_GREY", 0x2F4F4F); defineOldColor("DARK_TAN", 0x97694F); defineOldColor("DARK_TURQUOISE", 0x7093DB); defineOldColor("DARK_WOOD", 0x855E42); defineOldColor("DIM_GRAY", 0x545454); defineOldColor("DIM_GREY", 0x545454); defineOldColor("DUSTY_ROSE", 0x856363); defineOldColor("FELDSPAR", 0xD19275); defineOldColor("FOREST_GREEN", 0x228B22); defineOldColor("FOREST_GREEN_WEB", 0x238E23); defineOldColor("GRAY_WEB", 0xC0C0C0); defineOldColor("GREEN_COPPER", 0x527F76); defineOldColor("GREEN_YELLOW", 0x93DB70); defineOldColor("GREY", 0x7F7F7F); defineOldColor("GREY1", 0xFDFDFD); defineOldColor("GREY10", 0xC8C8C8); defineOldColor("GREY20", 0xAFAFAF); defineOldColor("GREY30", 0x969696); defineOldColor("GREY40", 0x7D7D7D); defineOldColor("GREY5", 0xF0F0F0); defineOldColor("GREY50", 0x646464); defineOldColor("GREY60", 0x4B4B4B); defineOldColor("GREY70", 0x323232); defineOldColor("GREY80", 0x191919); defineOldColor("GREY90", 0x060606); defineOldColor("GREY_WEB", 0xC0C0C0); defineOldColor("HUNTER_GREEN", 0x215E21); defineOldColor("INDIAN_RED", 0x4E2F2F); defineOldColor("LAWN_GREEN", 0x7CFC00); defineOldColor("LIGHT_BLUE", 0xC0D9D9); defineOldColor("LIGHT_GRAY", 0xA8A8A8); defineOldColor("LIGHT_GREY", 0xA8A8A8); defineOldColor("LIGHT_STEEL_BLUE", 0x8F8FBD); defineOldColor("LIGHT_WOOD", 0xE9C2A6); defineOldColor("LIME_GREEN", 0x32CD32); defineOldColor("MANDARIAN_ORANGE", 0xE47833); defineOldColor("MAROON_WEB", 0x8E236B); defineOldColor("MEDIUM_AQUAMARINE", 0x32CD99); defineOldColor("MEDIUM_BLUE", 0x3232CD); defineOldColor("MEDIUM_FOREST_GREEN", 0x6B8E23); defineOldColor("MEDIUM_GOLDENROD", 0xEAEAAE); defineOldColor("MEDIUM_ORCHID", 0x9370DB); defineOldColor("MEDIUM_SEA_GREEN", 0x426F42); defineOldColor("MEDIUM_SLATE_BLUE", 0x7F00FF); defineOldColor("MEDIUM_SPRING_GREEN", 0x7FFF00); defineOldColor("MEDIUM_TURQUOISE", 0x70DBDB); defineOldColor("MEDIUM_VIOLET_RED", 0xDB7093); defineOldColor("MEDIUM_WOOD", 0xA68064); defineOldColor("MIDNIGHT_BLUE", 0x2F2F4F); defineOldColor("NAVY_BLUE", 0x23238E); defineOldColor("NEON_BLUE", 0x4D4DFF); defineOldColor("NEON_PINK", 0xFF6EC7); defineOldColor("NEW_MIDNIGHT_BLUE", 0x00009C); defineOldColor("NEW_TAN", 0xEBC79E); defineOldColor("OLD_GOLD", 0xCFB53B); defineOldColor("ORANGE_RED", 0xFF2400); defineOldColor("ORANGE_WEB", 0xFF7F00); defineOldColor("PALE_GREEN", 0x8FBC8F); defineOldColor("PINK_WEB", 0xBC8F8F); defineOldColor("QUARTZ", 0xD9D9F3); defineOldColor("RICH_BLUE", 0x5959AB); defineOldColor("SCARLET", 0x8C1717); defineOldColor("SEA_GREEN", 0x238E68); defineOldColor("SEMI_SWEET_CHOCOLATE", 0x6B4226); defineOldColor("SILVER_WEB", 0xE6E8FA); defineOldColor("SKY_BLUE", 0x3299CC); defineOldColor("SLATE_BLUE", 0x007FFF); defineOldColor("SPICY_PINK", 0xFF1CAE); defineOldColor("SPRING_GREEN", 0x00FF7F); defineOldColor("STEEL_BLUE", 0x236B8E); defineOldColor("SUMMER_SKY", 0x38B0DE); defineOldColor("TAN_COLOR", 0x008080); defineOldColor("VERY_DARK_BROWN", 0x5C4033); defineOldColor("VERY_LIGHT_GRAY", 0xCDCDCD); defineOldColor("VERY_LIGHT_GREY", 0xCDCDCD); defineOldColor("VIOLET_RED", 0xCC3299); defineOldColor("VIOLET_WEB", 0x4F2F4F); defineOldColor("YELLOW_GREEN", 0x99CC32); } GLERC<GLEColor> color_or_fill_from_int(int hexValue) { GLERC<GLEColor> result(new GLEColor()); result->setHexValueGLE(hexValue); return result; } void update_color_foreground(GLEColor* updateMe, GLEColor* color) { updateMe->setRGBA(color->getRed(), color->getGreen(), color->getBlue(), color->getAlpha()); updateMe->setTransparent(color->isTransparent()); updateMe->setName(color->getNameS()); } void update_color_foreground_and_pattern(GLEColor* updateMe, GLEColor* color) { update_color_foreground(updateMe, color); if (color->isFill() && color->getFill()->getFillType() == GLE_FILL_TYPE_PATTERN) { update_color_fill_pattern(updateMe, static_cast<GLEPatternFill*>(color->getFill())); } } void update_color_fill_pattern(GLEColor* updateMe, GLEPatternFill* fill) { if (updateMe->isFill() && updateMe->getFill()->getFillType() == GLE_FILL_TYPE_PATTERN) { GLEPatternFill* myFill = static_cast<GLEPatternFill*>(updateMe->getFill()); myFill->setFillDescription(fill->getFillDescription()); } else { updateMe->setFill(new GLEPatternFill(fill->getFillDescription())); } updateMe->setTransparent(false); } void update_color_fill_background(GLEColor* updateMe, GLEColor* color) { if (updateMe->isFill() && updateMe->getFill()->getFillType() == GLE_FILL_TYPE_PATTERN) { GLEPatternFill* myFill = static_cast<GLEPatternFill*>(updateMe->getFill()); myFill->setBackground(color); } else { GLEPatternFill* myFill = new GLEPatternFill(0X02010020); myFill->setBackground(color); updateMe->setFill(myFill); } updateMe->setTransparent(false); } GLERC<GLEColor> get_fill_background(GLEColor* fill) { if (fill->isFill() && fill->getFill()->getFillType() == GLE_FILL_TYPE_PATTERN) { GLEPatternFill* myFill = static_cast<GLEPatternFill*>(fill->getFill()); return myFill->getBackground(); } else { return color_or_fill_from_int(GLE_COLOR_WHITE); } } GLERC<GLEColor> get_fill_foreground(GLEColor* fill) { GLERC<GLEColor> result(new GLEColor()); update_color_foreground(result.get(), fill); return result; }
40.669643
92
0.727607
vlabella
f3180be9e3e08ecbc66586b42743f74714df8bda
1,839
cpp
C++
VectorOfPtr/VectorOfPtr.cpp
jbcoe/CppSandbox
574dc31bbd3640a8cf1b7642c4a449bee687cce5
[ "MIT" ]
7
2015-01-18T13:30:09.000Z
2021-08-21T19:50:26.000Z
VectorOfPtr/VectorOfPtr.cpp
jbcoe/CppSandbox
574dc31bbd3640a8cf1b7642c4a449bee687cce5
[ "MIT" ]
1
2016-03-13T21:26:37.000Z
2016-03-13T21:26:37.000Z
VectorOfPtr/VectorOfPtr.cpp
jbcoe/CppSandbox
574dc31bbd3640a8cf1b7642c4a449bee687cce5
[ "MIT" ]
1
2016-02-16T04:56:25.000Z
2016-02-16T04:56:25.000Z
#include <iostream> #include <algorithm> #include <memory> #include <iterator> #include <boost/date_time/posix_time/posix_time.hpp> #include <boost/lexical_cast.hpp> #include <Common/Timer.h> class MySimpleClass { public: double m_x = 0.0; double m_y = 0.0; std::string m_name; }; int main(int argc, char* argv[]) { size_t count = 10000000; if (argc == 2) { count = boost::lexical_cast<size_t>(argv[1]); } { std::vector<std::unique_ptr<MySimpleClass>> vptrObjects; vptrObjects.reserve(count); { Timer t("Build pointer vector"); std::generate_n(std::back_inserter(vptrObjects), count, []() { return std::unique_ptr<MySimpleClass>( new MySimpleClass()); }); } { Timer t("Modify Pointer Vector"); std::for_each(vptrObjects.begin(), vptrObjects.end(), [](std::unique_ptr<MySimpleClass>& ptr) { ptr->m_x = 2.0; ptr->m_y = 0.78 * ptr->m_x; }); } { Timer t("Delete Pointer Vector"); vptrObjects.resize(0); } } std::cout << std::endl; { std::vector<MySimpleClass> objects; objects.reserve(count); { Timer t("Build Object Vector"); std::generate_n(std::back_inserter(objects), count, []() { return MySimpleClass(); }); } { Timer t("Modify Object Vector"); std::for_each(objects.begin(), objects.end(), [](MySimpleClass& m) { m.m_x = 2.0; m.m_y = 0.78 * m.m_x; }); } { Timer t("Delete Object Vector"); objects.resize(0); } } }
23.576923
72
0.49429
jbcoe
f31c7aea2800bb394da04b1a45f74cbf78ac91e3
2,089
cpp
C++
test/function/scalar/ilog2.cpp
TobiasLudwig/boost.simd
c04d0cc56747188ddb9a128ccb5715dd3608dbc1
[ "BSL-1.0" ]
6
2018-02-25T22:23:33.000Z
2021-01-15T15:13:12.000Z
test/function/scalar/ilog2.cpp
remymuller/boost.simd
3caefb7ee707e5f68dae94f8f31f72f34b7bb5de
[ "BSL-1.0" ]
null
null
null
test/function/scalar/ilog2.cpp
remymuller/boost.simd
3caefb7ee707e5f68dae94f8f31f72f34b7bb5de
[ "BSL-1.0" ]
7
2017-12-12T12:36:31.000Z
2020-02-10T14:27:07.000Z
//================================================================================================== /*! Copyright 2016 NumScale SAS Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) */ //================================================================================================== #include <boost/simd/function/scalar/ilog2.hpp> #include <scalar_test.hpp> #include <boost/simd/detail/dispatch/meta/as_integer.hpp> #include <boost/simd/constant/three.hpp> #include <boost/simd/constant/four.hpp> #include <boost/simd/constant/pi.hpp> #include <boost/simd/constant/one.hpp> #include <boost/simd/constant/two.hpp> #include <boost/simd/constant/valmax.hpp> STF_CASE_TPL (" ilog2real", STF_IEEE_TYPES) { namespace bs = boost::simd; namespace bd = boost::dispatch; using bs::ilog2; // return type conformity test STF_EXPR_IS(ilog2(T()), bd::as_integer_t<T>); // specific values tests STF_EQUAL(ilog2(bs::Two<T>()), 1); STF_EQUAL(ilog2(bs::Three<T>()), 1); STF_EQUAL(ilog2(bs::Four<T> ()), 2); STF_EQUAL(ilog2(bs::Pi<T> ()), 1); STF_EQUAL(ilog2(bs::One<T>()), 0); } // end of test for real_ STF_CASE_TPL (" ilog2signed_int", STF_SIGNED_INTEGRAL_TYPES) { namespace bs = boost::simd; namespace bd = boost::dispatch; using bs::ilog2; // return type conformity test STF_EXPR_IS(ilog2(T()), bd::as_integer_t<T>); // specific values tests STF_EQUAL(ilog2(bs::One<T>()), 0); STF_EQUAL(ilog2(bs::Two<T>()), 1); } // end of test for signed_int_ STF_CASE_TPL (" ilog2unsigned_int", STF_UNSIGNED_INTEGRAL_TYPES) { namespace bs = boost::simd; namespace bd = boost::dispatch; using bs::ilog2; // return type conformity test STF_EXPR_IS(ilog2(T()), bd::as_integer_t<T>); // specific values tests STF_EQUAL(ilog2(bs::One<T>()), 0u); STF_EQUAL(ilog2(bs::Two<T>()),1u); T j = 1; for(T i=2; i < bs::Valmax<T>()/2; i*= 2) { STF_EQUAL(ilog2(T(i)),j); STF_EQUAL(ilog2(T(i+1)),j); ++j; } } // end of test for unsigned_int_
29.013889
100
0.611297
TobiasLudwig
f32133642073fd1278db485b674e43248210c4a0
4,610
cc
C++
src/Model.cc
AnotherHermit/VoxelConeTracing
3c10cd07584fcec805c154abc08cf07838933a66
[ "Beerware" ]
16
2016-08-09T15:25:27.000Z
2021-06-11T21:48:31.000Z
src/Model.cc
AnotherHermit/VoxelConeTracing
3c10cd07584fcec805c154abc08cf07838933a66
[ "Beerware" ]
null
null
null
src/Model.cc
AnotherHermit/VoxelConeTracing
3c10cd07584fcec805c154abc08cf07838933a66
[ "Beerware" ]
3
2021-03-22T09:48:29.000Z
2021-07-04T11:14:13.000Z
/////////////////////////////////////// // // Computer Graphics TSBK03 // Conrad Wahlén - conwa099 // /////////////////////////////////////// #include "Model.h" #include "GL_utilities.h" #include <iostream> Model::Model() { subDrawID = 0; subVoxelizeID = 0; diffuseID = 0; maskID = 0; diffColor = glm::vec3(1.0f, 0.0f, 0.0f); vao = 0; } void Model::SetMaterial(TextureData* textureData) { subDrawID = textureData->subID; subVoxelizeID = (GLuint)(subDrawID != 0); diffuseID = textureData->diffuseID; maskID = textureData->maskID; diffColor = textureData->diffColor; } void Model::SetStandardData(size_t numVertices, GLfloat* verticeData, size_t numNormals, GLfloat* normalData, size_t numIndices, GLuint* indexData, size_t numTangents, GLfloat* tangentData, size_t numBiTangents, GLfloat* biTangentData) { nIndices = numIndices; // Create buffers if(vao == 0) { glGenVertexArrays(1, &vao); } glGenBuffers(5, meshBuffers); // Allocate enough memory for instanced drawing buffers glBindBuffer(GL_ARRAY_BUFFER, meshBuffers[0]); glBufferData(GL_ARRAY_BUFFER, sizeof(GLfloat) * numVertices, verticeData, GL_STATIC_DRAW); glBindBuffer(GL_ARRAY_BUFFER, meshBuffers[1]); glBufferData(GL_ARRAY_BUFFER, sizeof(GLfloat) * numNormals, normalData, GL_STATIC_DRAW); glBindBuffer(GL_ARRAY_BUFFER, meshBuffers[2]); glBufferData(GL_ARRAY_BUFFER, sizeof(GLfloat) * numTangents, tangentData, GL_STATIC_DRAW); glBindBuffer(GL_ARRAY_BUFFER, meshBuffers[3]); glBufferData(GL_ARRAY_BUFFER, sizeof(GLfloat) * numBiTangents, biTangentData, GL_STATIC_DRAW); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, meshBuffers[4]); glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(GLuint) * numIndices, indexData, GL_STATIC_DRAW); // Set the GPU pointers for drawing glBindVertexArray(vao); glBindBuffer(GL_ARRAY_BUFFER, meshBuffers[0]); glEnableVertexAttribArray(VERT_POS); glVertexAttribPointer(VERT_POS, 3, GL_FLOAT, GL_FALSE, 0, 0); glBindBuffer(GL_ARRAY_BUFFER, meshBuffers[1]); glEnableVertexAttribArray(VERT_NORMAL); glVertexAttribPointer(VERT_NORMAL, 3, GL_FLOAT, GL_FALSE, 0, 0); glBindBuffer(GL_ARRAY_BUFFER, meshBuffers[2]); glEnableVertexAttribArray(VERT_TANGENT); glVertexAttribPointer(VERT_TANGENT, 3, GL_FLOAT, GL_FALSE, 0, 0); glBindBuffer(GL_ARRAY_BUFFER, meshBuffers[3]); glEnableVertexAttribArray(VERT_BITANGENT); glVertexAttribPointer(VERT_BITANGENT, 3, GL_FLOAT, GL_FALSE, 0, 0); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, meshBuffers[4]); glBindVertexArray(0); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); } void Model::SetTextureData(size_t numTexCoords, GLfloat* texCoordData) { if(vao == 0) { glGenVertexArrays(1, &vao); } glGenBuffers(1, &texbufferID); // Allocate enough memory for instanced drawing buffers glBindBuffer(GL_ARRAY_BUFFER, texbufferID); glBufferData(GL_ARRAY_BUFFER, sizeof(GLfloat) * numTexCoords, texCoordData, GL_STATIC_DRAW); // Set the data pointer for the draw program glBindVertexArray(vao); glBindBuffer(GL_ARRAY_BUFFER, texbufferID); glEnableVertexAttribArray(VERT_TEX_COORD); glVertexAttribPointer(VERT_TEX_COORD, 2, GL_FLOAT, GL_FALSE, 0, 0); glBindVertexArray(0); } void Model::SetPositionData(GLuint positionBufferID) { if(vao == 0) { glGenVertexArrays(1, &vao); } glBindVertexArray(vao); glBindBuffer(GL_ARRAY_BUFFER, positionBufferID); glEnableVertexAttribArray(DATA_POS); glVertexAttribIPointer(DATA_POS, 1, GL_UNSIGNED_INT, 0, 0); glVertexAttribDivisor(DATA_POS, 1); glBindVertexArray(0); } bool Model::hasDiffuseTex() { return diffuseID != 0; } bool Model::hasMaskTex() { return maskID != 0; } void Model::Voxelize() { glUniform3f(DIFF_COLOR, diffColor.r, diffColor.g, diffColor.b); glActiveTexture(GL_TEXTURE0); glBindTexture(GL_TEXTURE_2D, diffuseID); glBindVertexArray(vao); glUniformSubroutinesuiv(GL_FRAGMENT_SHADER, 1, &subVoxelizeID); glDrawElements(GL_TRIANGLES, (GLsizei)nIndices, GL_UNSIGNED_INT, 0L); } void Model::ShadowMap() { glBindVertexArray(vao); glDrawElements(GL_TRIANGLES, (GLsizei)nIndices, GL_UNSIGNED_INT, 0L); } void Model::Draw() { glUniform3f(DIFF_COLOR, diffColor.r, diffColor.g, diffColor.b); glActiveTexture(GL_TEXTURE0); glBindTexture(GL_TEXTURE_2D, diffuseID); glActiveTexture(GL_TEXTURE1); glBindTexture(GL_TEXTURE_2D, maskID); glBindVertexArray(vao); glUniformSubroutinesuiv(GL_FRAGMENT_SHADER, 1, &subDrawID); // Disable cull faces for transparent models if(hasMaskTex()) { glDisable(GL_CULL_FACE); } else { glEnable(GL_CULL_FACE); } glDrawElements(GL_TRIANGLES, (GLsizei)nIndices, GL_UNSIGNED_INT, 0L); }
27.771084
95
0.756833
AnotherHermit
f322fde77daf78dd7e91117d9027a40ae4552f4b
793
hpp
C++
contracts/system/test/include/ramconsumption.hpp
EOSPowerNetwork/system-epn
dfa836101f6b148916b08b3c2988b591ed92ce9e
[ "MIT" ]
null
null
null
contracts/system/test/include/ramconsumption.hpp
EOSPowerNetwork/system-epn
dfa836101f6b148916b08b3c2988b591ed92ce9e
[ "MIT" ]
null
null
null
contracts/system/test/include/ramconsumption.hpp
EOSPowerNetwork/system-epn
dfa836101f6b148916b08b3c2988b591ed92ce9e
[ "MIT" ]
null
null
null
#pragma once #include <eosio/eosio.hpp> namespace system_epn { namespace ramConsumption_bytes { namespace firstEmplace { constexpr int64_t DraftDonation = 237; constexpr int64_t SignDonation = 900; } // namespace firstEmplace namespace subsequentEmplace { constexpr int64_t DraftDonation = 125; constexpr int64_t SignDonation = 123123; } // namespace subsequentEmplace namespace modify { namespace oldPayer { //constexpr int64_t SignDonation = -126; } namespace newPayer { //constexpr int64_t SignDonation = 166; } } // namespace modify } // namespace ramConsumption_bytes } // namespace system_epn
33.041667
56
0.598991
EOSPowerNetwork
f323c56e9a241ca5fd268d7d67c4ef6af7a9899a
23,625
cpp
C++
windows_desktop/e_transactions_w.cpp
MrCryptoT/mwc-qt-wallet
7de81b73f4259ef203f8031c31cc25811e70e338
[ "Apache-2.0" ]
1
2021-05-06T22:54:13.000Z
2021-05-06T22:54:13.000Z
windows_desktop/e_transactions_w.cpp
MrCryptoT/mwc-qt-wallet
7de81b73f4259ef203f8031c31cc25811e70e338
[ "Apache-2.0" ]
null
null
null
windows_desktop/e_transactions_w.cpp
MrCryptoT/mwc-qt-wallet
7de81b73f4259ef203f8031c31cc25811e70e338
[ "Apache-2.0" ]
1
2021-12-09T06:15:16.000Z
2021-12-09T06:15:16.000Z
// Copyright 2019 The MWC Developers // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #include "e_transactions_w.h" #include "ui_e_transactions.h" #include "../control_desktop/messagebox.h" #include "../util_desktop/timeoutlock.h" #include <QDebug> #include "../dialogs_desktop/e_showproofdlg.h" #include "../dialogs_desktop/e_showtransactiondlg.h" #include "../bridge/wallet_b.h" #include "../bridge/config_b.h" #include "../bridge/util_b.h" #include "../bridge/wnd/e_transactions_b.h" #include "../core/global.h" // It is exception for Mobile, CSV export not likely needed into mobile wallet #include "../util/Files.h" namespace wnd { void TransactionData::setBtns(control::RichItem * _ritem, control::RichButton * _cancelBtn, control::RichButton * _repostBtn, control::RichButton * _proofBtn, QLabel * _noteL) { ritem = _ritem; cancelBtn = _cancelBtn; repostBtn = _repostBtn; proofBtn = _proofBtn; noteL = _noteL; } //////////////////////////////////////////////////////////////////////////////////////////////////// Transactions::Transactions(QWidget *parent) : core::NavWnd(parent), ui(new Ui::Transactions) { ui->setupUi(this); config = new bridge::Config(this); wallet = new bridge::Wallet(this); transaction = new bridge::Transactions(this); util = new bridge::Util(this); QObject::connect( wallet, &bridge::Wallet::sgnWalletBalanceUpdated, this, &Transactions::onSgnWalletBalanceUpdated, Qt::QueuedConnection); QObject::connect( wallet, &bridge::Wallet::sgnTransactions, this, &Transactions::onSgnTransactions, Qt::QueuedConnection); QObject::connect( wallet, &bridge::Wallet::sgnCancelTransacton, this, &Transactions::onSgnCancelTransacton, Qt::QueuedConnection); QObject::connect( wallet, &bridge::Wallet::sgnTransactionById, this, &Transactions::onSgnTransactionById, Qt::QueuedConnection); QObject::connect( wallet, &bridge::Wallet::sgnExportProofResult, this, &Transactions::onSgnExportProofResult, Qt::QueuedConnection); QObject::connect( wallet, &bridge::Wallet::sgnVerifyProofResult, this, &Transactions::onSgnVerifyProofResult, Qt::QueuedConnection); QObject::connect( wallet, &bridge::Wallet::sgnNodeStatus, this, &Transactions::onSgnNodeStatus, Qt::QueuedConnection); QObject::connect( wallet, &bridge::Wallet::sgnNewNotificationMessage, this, &Transactions::onSgnNewNotificationMessage, Qt::QueuedConnection); QObject::connect( wallet, &bridge::Wallet::sgnRepost, this, &Transactions::onSgnRepost, Qt::QueuedConnection); QObject::connect(ui->transactionTable, &control::RichVBox::onItemActivated, this, &Transactions::onItemActivated, Qt::QueuedConnection); ui->progress->initLoader(true); ui->progressFrame->hide(); onSgnWalletBalanceUpdated(); requestTransactions(); updateData(); } Transactions::~Transactions() { delete ui; } void Transactions::updateData() { ui->transactionTable->clearAll(); QDateTime current = QDateTime::currentDateTime(); int expectedConfirmNumber = config->getInputConfirmationNumber(); QString currentAccount = ui->accountComboBox->currentData().toString(); int txCnt = 0; for ( int idx = allTrans.size()-1; idx>=0 && txCnt<5000; idx--, txCnt++) { TransactionData &tr = allTrans[idx]; const wallet::WalletTransaction &trans = tr.trans; // if the node is online and in sync, display the number of confirmations instead of time // trans.confirmationTime format: 2020-10-13 04:36:54 // Expected: Jan 2, 2020 / 2:07am QString txTimeStr = trans.confirmationTime; if (txTimeStr.isEmpty() || txTimeStr == "None") txTimeStr = trans.creationTime; QDateTime txTime = QDateTime::fromString(txTimeStr, "HH:mm:ss dd-MM-yyyy"); txTimeStr = txTime.toString("MMM d, yyyy / H:mmap"); bool blocksPrinted = false; if (trans.confirmed && nodeHeight > 0 && trans.height > 0) { int needConfirms = trans.isCoinbase() ? mwc::COIN_BASE_CONFIRM_NUMBER : expectedConfirmNumber; // confirmations are 1 more than the difference between the node and transaction heights int64_t confirmations = nodeHeight - trans.height + 1; if (needConfirms >= confirmations) { txTimeStr = "(" + QString::number(confirmations) + "/" + QString::number(needConfirms) + " blocks)"; blocksPrinted = true; } } control::RichItem *itm = control::createMarkedItem(QString::number(idx), ui->transactionTable, trans.canBeCancelled()); { // First line itm->hbox().setContentsMargins(0, 0, 0, 0).setSpacing(4); // Adding Icon and a text itm->addWidget( control::createLabel(itm, false, false, "#" + QString::number(trans.txIdx + 1)) ).addFixedHSpacer(10); if (trans.transactionType & wallet::WalletTransaction::TRANSACTION_TYPE::CANCELLED) { itm->addWidget(control::createIcon(itm, ":/img/iconClose@2x.svg", control::ROW_HEIGHT, control::ROW_HEIGHT)) .addWidget(control::createLabel(itm, false, false, "Cancelled")); } else if (!trans.confirmed) { itm->addWidget(control::createIcon(itm, ":/img/iconUnconfirmed@2x.svg", control::ROW_HEIGHT, control::ROW_HEIGHT)) .addWidget(control::createLabel(itm, false, false, "Unconfirmed")); } else if (trans.transactionType & wallet::WalletTransaction::TRANSACTION_TYPE::SEND) { itm->addWidget(control::createIcon(itm, ":/img/iconSent@2x.svg", control::ROW_HEIGHT, control::ROW_HEIGHT)) .addWidget(control::createLabel(itm, false, false, "Sent")); } else if (trans.transactionType & wallet::WalletTransaction::TRANSACTION_TYPE::RECEIVE) { itm->addWidget(control::createIcon(itm, ":/img/iconReceived@2x.svg", control::ROW_HEIGHT, control::ROW_HEIGHT)) .addWidget(control::createLabel(itm, false, false, "Received")); } else if (trans.transactionType & wallet::WalletTransaction::TRANSACTION_TYPE::COIN_BASE) { itm->addWidget(control::createIcon(itm, ":/img/iconCoinbase@2x.svg", control::ROW_HEIGHT, control::ROW_HEIGHT)) .addWidget(control::createLabel(itm, false, false, "CoinBase")); } else { Q_ASSERT(false); } // Update with time or blocks itm->addHSpacer().addWidget(control::createLabel(itm, false, true, txTimeStr)); itm->pop(); } // First line itm->addWidget(control::createHorzLine(itm)); control::RichButton *cancelBtn = nullptr; control::RichButton *repostBtn = nullptr; // Line with amount { QString amount = util::nano2one(trans.coinNano); itm->hbox().setContentsMargins(0, 0, 0, 0).setSpacing(4); itm->addWidget(control::createLabel(itm, false, false, amount + " MWC", control::FONT_LARGE)); itm->addHSpacer(); if (!blocksPrinted && nodeHeight > 0 && trans.height > 0) { itm->addWidget(control::createLabel(itm, false, true, "Conf: " + QString::number(nodeHeight - trans.height + 1))); } if (trans.canBeCancelled()) { itm->addWidget(new control::RichButton(itm, "Cancel", 60, control::ROW_HEIGHT, "Cancel this transaction and unlock coins")); cancelBtn = (control::RichButton *) itm->getCurrentWidget(); cancelBtn->setCallback(this, "Cancel:" + QString::number(idx)); } // Can be reposted if (trans.transactionType == wallet::WalletTransaction::TRANSACTION_TYPE::SEND && !trans.confirmed) { itm->addWidget(new control::RichButton(itm, "Repost", 60, control::ROW_HEIGHT, "Report this transaction to the network")); repostBtn = (control::RichButton *) itm->getCurrentWidget(); repostBtn->setCallback(this, "Repost:" + QString::number(idx) + ":" + currentAccount); } itm->pop(); } control::RichButton *proofBtn = nullptr; // Line with ID { itm->hbox().setContentsMargins(0, 0, 0, 0).setSpacing(4); itm->addWidget(control::createLabel(itm, false, true, trans.txid, control::FONT_SMALL)); itm->addHSpacer(); if (trans.proof) { itm->addWidget(new control::RichButton(itm, "Proof", 60, control::ROW_HEIGHT, "Generate proof file for this transaction. Proof file can be validated by public at MWC Block Explorer")); proofBtn = (control::RichButton *) itm->getCurrentWidget(); proofBtn->setCallback(this, "Proof:" + QString::number(idx)); } itm->pop(); } // Address field... if (!trans.address.isEmpty()) { itm->hbox().setContentsMargins(0, 0, 0, 0); itm->addWidget(control::createLabel(itm, false, true, trans.address, control::FONT_SMALL)); itm->addHSpacer().pop(); } // And the last optional line is comment QLabel *noteL = nullptr; { QString txnNote = config->getTxNote(trans.txid); itm->hbox().setContentsMargins(0, 0, 0, 0); itm->addWidget(control::createLabel(itm, true, false, txnNote)); //itm->addHSpacer(); itm->pop(); noteL = (QLabel *) itm->getCurrentWidget(); if (txnNote.isEmpty()) noteL->hide(); } Q_ASSERT(noteL); itm->apply(); tr.setBtns(itm, cancelBtn, repostBtn, proofBtn, noteL); ui->transactionTable->addItem(itm); } ui->transactionTable->apply(); } void Transactions::richButtonPressed(control::RichButton * button, QString coockie) { Q_UNUSED(button) QStringList res = coockie.split(':'); if (res.size()<2) { Q_ASSERT(false); return; } QString id = res[0]; int idx = res[1].toInt(); if (idx<0 || idx>=allTrans.size()) { Q_ASSERT(false); // might happen during refresh. return; } wallet::WalletTransaction tx2process = allTrans[idx].trans; if (id=="Cancel") { util::TimeoutLockObject to("Transactions"); if (control::MessageBox::questionText(this, "Transaction cancellation", "Are you sure you want to cancel transaction #" + QString::number(tx2process.txIdx + 1) + ", TXID " + tx2process.txid, "No", "Yes", "Keep my transaction, I am expecting it to be finalized", "Continue and cancel the transaction, I am not expecting it to be finalized", true, false) == core::WndManager::RETURN_CODE::BTN2) { wallet->requestCancelTransacton(account, QString::number(tx2process.txIdx)); } } else if (id=="Repost") { if (res.size()<3) { Q_ASSERT(false); return; } QString currentAccount = res[2]; wallet->repost( currentAccount, tx2process.txIdx, config->isFluffSet() ); // response by the signal... ui->progressFrame->show(); ui->transactionTable->hide(); } else if ( id == "Proof" ) { util::TimeoutLockObject to("Transactions"); if (!tx2process.proof) { Q_ASSERT(false); control::MessageBox::messageText(this, "Need info", "Please select qualify transaction to generate a proof."); return; } QString fileName = util->getSaveFileName("Create transaction proof file", "Transactions", "transaction proof (*.proof)", ".proof"); if (fileName.isEmpty()) return; wallet->generateTransactionProof(QString::number(tx2process.txIdx), fileName); } else { // Unexpected id Q_ASSERT(false); } } void Transactions::onSgnRepost( int idx, QString err ) { ui->progressFrame->hide(); ui->transactionTable->show(); if (err.isEmpty()) { notify::appendNotificationMessage( notify::MESSAGE_LEVEL::INFO, "Transaction #" + QString::number(idx+1) + " was successfully reposted." ); core::getWndManager()->messageTextDlg("Repost", "Transaction #" + QString::number(idx+1) + " was successfully reposted." ); } else { notify::appendNotificationMessage( notify::MESSAGE_LEVEL::CRITICAL, "Failed to repost transaction #" + QString::number(idx+1) + ". " + err ); core::getWndManager()->messageTextDlg("Repost", "Failed to repost transaction #" + QString::number(idx+1) + ".\n\n" + err ); } } void Transactions::onSgnTransactions( QString acc, QString height, QVector<QString> transactions) { Q_UNUSED(height) if (acc != ui->accountComboBox->currentData().toString() ) return; ui->progressFrame->hide(); ui->transactionTable->show(); account = acc; allTrans.clear(); for (QString & t : transactions ) { TransactionData dt; dt.trans = wallet::WalletTransaction::fromJson(t); allTrans.push_back( dt ); } updateData(); } void Transactions::onSgnExportProofResult(bool success, QString fn, QString msg ) { util::TimeoutLockObject to( "Transactions" ); if (success) { dlg::ProofInfo proof; if (proof.parseProofText(msg)) { dlg::ShowProofDlg dlg(this, fn, proof ); dlg.exec(); } else { control::MessageBox::messageText(this, "Failure", "Internal error. Unable to decode the results of the proof located at " + fn + "\n\n" + msg ); } } else { control::MessageBox::messageText(this, "Failure", msg ); } } void Transactions::onSgnVerifyProofResult(bool success, QString fn, QString msg ) { util::TimeoutLockObject to( "Transactions" ); if (success) { dlg::ProofInfo proof; if (proof.parseProofText(msg)) { dlg::ShowProofDlg dlg(this, fn, proof ); dlg.exec(); } else { control::MessageBox::messageText(this, "Failure", "Internal error. Unable to decode the results of the proof from the file " + fn + "\n\n" + msg ); } } else { control::MessageBox::messageText(this, "Failure", msg ); } } void Transactions::requestTransactions() { allTrans.clear(); nodeHeight = -1; QString account = ui->accountComboBox->currentData().toString(); if (account.isEmpty()) return; ui->progressFrame->show(); ui->transactionTable->hide(); ui->transactionTable->clearAll(); // !!! Note, order is important even it is async. We want node status be processed first.. wallet->requestNodeStatus(); // Need to know th height. wallet->requestTransactions(account, true); updateData(); } void Transactions::on_refreshButton_clicked() { requestTransactions(); } void Transactions::on_validateProofButton_clicked() { util::TimeoutLockObject to( "Transactions" ); QString fileName = util->getOpenFileName("Open proof file", "Transactions", "transaction proof (*.proof);;All files (*.*)"); if (fileName.isEmpty()) return; wallet->verifyTransactionProof(fileName); } void Transactions::on_exportButton_clicked() { util::TimeoutLockObject to( "Transactions" ); if (allTrans.isEmpty()) { control::MessageBox::messageText(this, "Export Error", "You don't have any transactions to export."); return; } QString fileName = util->getSaveFileName("Export Transactions", "TxExportCsv", "Export Options (*.csv)", ".csv"); if (fileName.isEmpty()) return; // qt-wallet displays the transactions last to first // however when exporting the transactions, we want to export first to last QStringList exportRecords; // retrieve the first transaction and get the CSV headers const wallet::WalletTransaction & trans = allTrans[0].trans; QString csvHeaders = trans.getCSVHeaders(); exportRecords << csvHeaders; QString csvValues = trans.toStringCSV(); exportRecords << csvValues; // now retrieve the remaining transactions and add them to our list for ( int idx=1; idx < allTrans.size(); idx++) { const wallet::WalletTransaction & trans = allTrans[idx].trans; QString csvValues = trans.toStringCSV(); exportRecords << csvValues; } // Note: Mobile doesn't expect to export anything. That is why we are breaking bridge rule here and usung util::writeTextFile directly // warning: When using a debug build, avoid testing with an existing file which has // read-only permissions. writeTextFile will hit a Q_ASSERT causing qt-wallet // to crash. bool exportOk = util::writeTextFile(fileName, exportRecords); if (!exportOk) { control::MessageBox::messageText(this, "Error", "Export unable to write to file: " + fileName); } else { // some users may have a large number of transactions which take time to write to the file // so indicate when the file write has completed control::MessageBox::messageText(this, "Success", "Exported transactions to file: " + fileName); } return; } void Transactions::onItemActivated(QString itemId) { int idx = itemId.toInt(); if (idx<0 || idx>=allTrans.size()) { Q_ASSERT(false); return; } QString account = ui->accountComboBox->currentData().toString(); const wallet::WalletTransaction & selected = allTrans[idx].trans; // respond will come at updateTransactionById wallet->requestTransactionById(account, QString::number(selected.txIdx) ); ui->progressFrame->show(); ui->transactionTable->hide(); } void Transactions::onSgnNodeStatus( bool online, QString errMsg, int _nodeHeight, int peerHeight, QString totalDifficulty, int connections ) { Q_UNUSED(errMsg); Q_UNUSED(peerHeight); Q_UNUSED(totalDifficulty); Q_UNUSED(connections); if (online) nodeHeight = _nodeHeight; } void Transactions::onSgnTransactionById(bool success, QString account, QString height, QString transactionJson, QVector<QString> outputsJson, QVector<QString> messages) { Q_UNUSED(account) Q_UNUSED(height) ui->progressFrame->hide(); ui->transactionTable->show(); util::TimeoutLockObject to( "Transactions" ); if (!success) { control::MessageBox::messageText(this, "Transaction details", "Internal error. Transaction details are not found."); return; } wallet::WalletTransaction transaction = wallet::WalletTransaction::fromJson(transactionJson); QVector<wallet::WalletOutput> outputs; for (auto & json : outputsJson) outputs.push_back( wallet::WalletOutput::fromJson(json)); QString txnNote = config->getTxNote(transaction.txid); dlg::ShowTransactionDlg showTransDlg(this, account, transaction, outputs, messages, txnNote); if ( showTransDlg.exec() == QDialog::Accepted ) { if (txnNote != showTransDlg.getTransactionNote() ) { txnNote = showTransDlg.getTransactionNote(); if (txnNote.isEmpty()) { config->deleteTxNote(transaction.txid); } else { // add new note or update existing note for this commitment config->updateTxNote(transaction.txid, txnNote); } // Updating the UI for (const auto & tx : allTrans) { if (tx.trans.txid == transaction.txid) { tx.noteL->setText(txnNote); if (txnNote.isEmpty()) tx.noteL->hide(); else tx.noteL->show(); } } } } } void Transactions::on_accountComboBox_activated(int index) { Q_UNUSED(index); QString account = ui->accountComboBox->currentData().toString(); if (!account.isEmpty()) wallet->switchAccount(account); requestTransactions(); } void Transactions::onSgnCancelTransacton(bool success, QString account, QString trIdxStr, QString errMessage) { Q_UNUSED(account) Q_UNUSED(errMessage) ui->progressFrame->hide(); ui->transactionTable->show(); int64_t trIdx = trIdxStr.toLongLong(); util::TimeoutLockObject to("Transactions"); if (success) { requestTransactions(); // We don't need this confirmation, it makes UX worse //control::MessageBox::messageText(this, "Transaction was cancelled", "Transaction number " + QString::number(trIdx+1) + " was successfully cancelled"); } else { control::MessageBox::messageText(this, "Failed to cancel transaction", "Cancel request for transaction number " + QString::number(trIdx+1) + " has failed.\n\n"); } } void Transactions::onSgnWalletBalanceUpdated() { // Pairs: [ account, full_name ] QVector<QString> accounts = wallet->getWalletBalance(true,false,true); QString selectedAccount = wallet->getCurrentAccountName(); int selectedAccIdx = 0; ui->accountComboBox->clear(); int idx=0; for ( int i=1; i<accounts.size(); i+=2) { if (accounts[i-1] == selectedAccount) selectedAccIdx = idx; ui->accountComboBox->addItem( accounts[i], QVariant(accounts[i-1]) ); idx++; } ui->accountComboBox->setCurrentIndex(selectedAccIdx); } void Transactions::onSgnNewNotificationMessage(int level, QString message) // level: notify::MESSAGE_LEVEL values { Q_UNUSED(level) if (message.contains("Changing transaction")) { on_refreshButton_clicked(); } } }
38.539967
169
0.600085
MrCryptoT
f3289870f2eefd025f37b488bec90568e604a650
39,828
cpp
C++
Source/General/Driver/Filter/BPTC/Core/BC7CompressorSIMD.cpp
paintdream/paintsnow
3a1cbc9e571eaa2e62a3a2d60f75817b45f0c781
[ "MIT" ]
null
null
null
Source/General/Driver/Filter/BPTC/Core/BC7CompressorSIMD.cpp
paintdream/paintsnow
3a1cbc9e571eaa2e62a3a2d60f75817b45f0c781
[ "MIT" ]
null
null
null
Source/General/Driver/Filter/BPTC/Core/BC7CompressorSIMD.cpp
paintdream/paintsnow
3a1cbc9e571eaa2e62a3a2d60f75817b45f0c781
[ "MIT" ]
null
null
null
//-------------------------------------------------------------------------------------- // Copyright 2011 Intel Corporation // All Rights Reserved // // Permission is granted to use, copy, distribute and prepare derivative works of this // software for any purpose and without fee, provided, that the above copyright notice // and this statement appear in all copies. Intel makes no representations about the // suitability of this software for any purpose. THIS SOFTWARE IS PROVIDED "AS IS." // INTEL SPECIFICALLY DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, AND ALL LIABILITY, // INCLUDING CONSEQUENTIAL AND OTHER INDIRECT DAMAGES, FOR THE USE OF THIS SOFTWARE, // INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PROPRIETARY RIGHTS, AND INCLUDING THE // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. Intel does not // assume any responsibility for any errors which may appear in this software nor any // responsibility to update it. // //-------------------------------------------------------------------------------------- #if defined(_M_IX86) || defined(_M_AMD64) || defined(__i386__) || defined(__x86_64__) #include "BC7CompressorDLL.h" #include "BC7CompressionModeSIMD.h" #include "RGBAEndpointsSIMD.h" #include "BCLookupTables.h" #include "BitStream.h" #ifdef _MSC_VER #define ALIGN_SSE __declspec( align(16) ) #else #define ALIGN_SSE alignas(16) #endif static const UINT kNumShapes2 = 64; static const WORD kShapeMask2[kNumShapes2] = { 0xcccc, 0x8888, 0xeeee, 0xecc8, 0xc880, 0xfeec, 0xfec8, 0xec80, 0xc800, 0xffec, 0xfe80, 0xe800, 0xffe8, 0xff00, 0xfff0, 0xf000, 0xf710, 0x008e, 0x7100, 0x08ce, 0x008c, 0x7310, 0x3100, 0x8cce, 0x088c, 0x3110, 0x6666, 0x366c, 0x17e8, 0x0ff0, 0x718e, 0x399c, 0xaaaa, 0xf0f0, 0x5a5a, 0x33cc, 0x3c3c, 0x55aa, 0x9696, 0xa55a, 0x73ce, 0x13c8, 0x324c, 0x3bdc, 0x6996, 0xc33c, 0x9966, 0x0660, 0x0272, 0x04e4, 0x4e40, 0x2720, 0xc936, 0x936c, 0x39c6, 0x639c, 0x9336, 0x9cc6, 0x817e, 0xe718, 0xccf0, 0x0fcc, 0x7744, 0xee22 }; static const int kAnchorIdx2[kNumShapes2] = { 15,15,15,15,15,15,15,15, 15,15,15,15,15,15,15,15, 15, 2, 8, 2, 2, 8, 8,15, 2, 8, 2, 2, 8, 8, 2, 2, 15,15, 6, 8, 2, 8,15,15, 2, 8, 2, 2, 2,15,15, 6, 6, 2, 6, 8,15,15, 2, 2, 15,15,15,15,15, 2, 2, 15 }; static const UINT kNumShapes3 = 64; static const WORD kShapeMask3[kNumShapes3][2] = { { 0xfecc, 0xf600 }, { 0xffc8, 0x7300 }, { 0xff90, 0x3310 }, { 0xecce, 0x00ce }, { 0xff00, 0xcc00 }, { 0xcccc, 0xcc00 }, { 0xffcc, 0x00cc }, { 0xffcc, 0x3300 }, { 0xff00, 0xf000 }, { 0xfff0, 0xf000 }, { 0xfff0, 0xff00 }, { 0xcccc, 0x8888 }, { 0xeeee, 0x8888 }, { 0xeeee, 0xcccc }, { 0xffec, 0xec80 }, { 0x739c, 0x7310 }, { 0xfec8, 0xc800 }, { 0x39ce, 0x3100 }, { 0xfff0, 0xccc0 }, { 0xfccc, 0x0ccc }, { 0xeeee, 0xee00 }, { 0xff88, 0x7700 }, { 0xeec0, 0xcc00 }, { 0x7730, 0x3300 }, { 0x0cee, 0x00cc }, { 0xffcc, 0xfc88 }, { 0x6ff6, 0x0660 }, { 0xff60, 0x6600 }, { 0xcbbc, 0xc88c }, { 0xf966, 0xf900 }, { 0xceec, 0x0cc0 }, { 0xff10, 0x7310 }, { 0xff80, 0xec80 }, { 0xccce, 0x08ce }, { 0xeccc, 0xec80 }, { 0x6666, 0x4444 }, { 0x0ff0, 0x0f00 }, { 0x6db6, 0x4924 }, { 0x6bd6, 0x4294 }, { 0xcf3c, 0x0c30 }, { 0xc3fc, 0x03c0 }, { 0xffaa, 0xff00 }, { 0xff00, 0x5500 }, { 0xfcfc, 0xcccc }, { 0xcccc, 0x0c0c }, { 0xf6f6, 0x6666 }, { 0xaffa, 0x0ff0 }, { 0xfff0, 0x5550 }, { 0xfaaa, 0xf000 }, { 0xeeee, 0x0e0e }, { 0xf8f8, 0x8888 }, { 0xfff0, 0x9990 }, { 0xeeee, 0xe00e }, { 0x8ff8, 0x8888 }, { 0xf666, 0xf000 }, { 0xff00, 0x9900 }, { 0xff66, 0xff00 }, { 0xcccc, 0xc00c }, { 0xcffc, 0xcccc }, { 0xf000, 0x9000 }, { 0x8888, 0x0808 }, { 0xfefe, 0xeeee }, { 0xfffa, 0xfff0 }, { 0x7bde, 0x7310 } }; static const UINT kWMValues[] = { 0x32b92180, 0x32ba3080, 0x31103200, 0x28103c80, 0x32bb3080, 0x25903600, 0x3530b900, 0x3b32b180, 0x34b5b980 }; static const UINT kNumWMVals = sizeof(kWMValues) / sizeof(kWMValues[0]); static UINT gWMVal = -1; static const int kAnchorIdx3[2][kNumShapes3] = { { 3, 3,15,15, 8, 3,15,15, 8, 8, 6, 6, 6, 5, 3, 3, 3, 3, 8,15, 3, 3, 6,10, 5, 8, 8, 6, 8, 5,15,15, 8,15, 3, 5, 6,10, 8,15, 15, 3,15, 5,15,15,15,15, 3,15, 5, 5, 5, 8, 5,10, 5,10, 8,13,15,12, 3, 3 }, { 15, 8, 8, 3,15,15, 3, 8, 15,15,15,15,15,15,15, 8, 15, 8,15, 3,15, 8,15, 8, 3,15, 6,10,15,15,10, 8, 15, 3,15,10,10, 8, 9,10, 6,15, 8,15, 3, 6, 6, 8, 15, 3,15,15,15,15,15,15, 15,15,15,15, 3,15,15, 8 } }; const UINT kBC7InterpolationValuesScalar[4][16][2] = { { {64, 0}, {33, 31}, {0, 64}, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { {64, 0}, {43, 21}, {21, 43}, {0, 64}, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { {64, 0}, {55, 9}, {46, 18}, {37, 27}, {27, 37}, {18, 46}, {9, 55}, {0, 64}, 0, 0, 0, 0, 0, 0, 0, 0 }, { {64, 0}, {60, 4}, {55, 9}, {51, 13}, {47, 17}, {43, 21}, {38, 26}, {34, 30}, {30, 34}, {26, 38}, {21, 43}, {17, 47}, {13, 51}, {9, 55}, {4, 60}, {0, 64} } }; ALIGN_SSE UINT kZeroVector[4] = { 0, 0, 0, 0 }; const __m128i kBC7InterpolationValuesSIMD[4][16][2] = { { { _mm_set1_epi32(64), *((const __m128i *)kZeroVector)}, { _mm_set1_epi32(33), _mm_set1_epi32(31) }, { *((const __m128i *)kZeroVector), _mm_set1_epi32(64) }, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { { _mm_set1_epi32(64), *((const __m128i *)kZeroVector)}, { _mm_set1_epi32(43), _mm_set1_epi32(21)}, { _mm_set1_epi32(21), _mm_set1_epi32(43)}, { *((const __m128i *)kZeroVector), _mm_set1_epi32(64)}, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { { _mm_set1_epi32(64), *((const __m128i *)kZeroVector) }, { _mm_set1_epi32(55), _mm_set1_epi32(9) }, { _mm_set1_epi32(46), _mm_set1_epi32(18)}, { _mm_set1_epi32(37), _mm_set1_epi32(27)}, { _mm_set1_epi32(27), _mm_set1_epi32(37)}, { _mm_set1_epi32(18), _mm_set1_epi32(46)}, { _mm_set1_epi32(9), _mm_set1_epi32(55)}, { *((const __m128i *)kZeroVector), _mm_set1_epi32(64)}, 0, 0, 0, 0, 0, 0, 0, 0 }, { { _mm_set1_epi32(64), *((const __m128i *)kZeroVector)}, { _mm_set1_epi32(60), _mm_set1_epi32(4)}, { _mm_set1_epi32(55), _mm_set1_epi32(9)}, { _mm_set1_epi32(51), _mm_set1_epi32(13)}, { _mm_set1_epi32(47), _mm_set1_epi32(17)}, { _mm_set1_epi32(43), _mm_set1_epi32(21)}, { _mm_set1_epi32(38), _mm_set1_epi32(26)}, { _mm_set1_epi32(34), _mm_set1_epi32(30)}, { _mm_set1_epi32(30), _mm_set1_epi32(34)}, { _mm_set1_epi32(26), _mm_set1_epi32(38)}, { _mm_set1_epi32(21), _mm_set1_epi32(43)}, { _mm_set1_epi32(17), _mm_set1_epi32(47)}, { _mm_set1_epi32(13), _mm_set1_epi32(51)}, { _mm_set1_epi32(9), _mm_set1_epi32(55)}, { _mm_set1_epi32(4), _mm_set1_epi32(60)}, { *((const __m128i *)kZeroVector), _mm_set1_epi32(64)} } }; ALIGN_SSE UINT kByteValMask[4] = { 0xFF, 0xFF, 0xFF, 0xFF }; static inline __m128i sad(const __m128i &a, const __m128i &b) { const __m128i maxab = _mm_max_epu8(a, b); const __m128i minab = _mm_min_epu8(a, b); return _mm_and_si128( *((const __m128i *)kByteValMask), _mm_subs_epu8( maxab, minab ) ); } #include <cstdio> #include <cstdlib> #include <cstring> #include <cassert> #include <cfloat> #include <ctime> int BC7CompressionModeSIMD::MaxAnnealingIterations = 20; // This is a setting. int BC7CompressionModeSIMD::NumUses[8] = { 0, 0, 0, 0, 0, 0, 0, 0 }; BC7CompressionModeSIMD::Attributes BC7CompressionModeSIMD::kModeAttributes[kNumModes] = { { 0, 4, 3, 3, 4, 4, 4, 0, BC7CompressionModeSIMD::ePBitType_NotShared }, { 1, 6, 2, 3, 6, 6, 6, 0, BC7CompressionModeSIMD::ePBitType_Shared }, { 2, 6, 3, 2, 5, 5, 5, 0, BC7CompressionModeSIMD::ePBitType_None }, { 3, 6, 2, 2, 7, 7, 7, 0, BC7CompressionModeSIMD::ePBitType_NotShared }, { 0 }, // Mode 4 not supported { 0 }, // Mode 5 not supported { 6, 0, 1, 4, 7, 7, 7, 7, BC7CompressionModeSIMD::ePBitType_NotShared }, { 7, 6, 2, 2, 5, 5, 5, 5, BC7CompressionModeSIMD::ePBitType_NotShared }, }; void BC7CompressionModeSIMD::ClampEndpointsToGrid(RGBAVectorSIMD &p1, RGBAVectorSIMD &p2, int &bestPBitCombo) const { const int nPbitCombos = GetNumPbitCombos(); const bool hasPbits = nPbitCombos > 1; __m128i qmask; GetQuantizationMask(qmask); ClampEndpoints(p1, p2); // !SPEED! This can be faster. We're searching through all possible // pBit combos to find the best one. Instead, we should be seeing what // the pBit type is for this compression mode and finding the closest // quantization. float minDist = FLT_MAX; RGBAVectorSIMD bp1, bp2; for(int i = 0; i < nPbitCombos; i++) { __m128i qp1, qp2; if(hasPbits) { qp1 = p1.ToPixel(qmask, GetPBitCombo(i)[0]); qp2 = p2.ToPixel(qmask, GetPBitCombo(i)[1]); } else { qp1 = p1.ToPixel(qmask); qp2 = p2.ToPixel(qmask); } RGBAVectorSIMD np1 = RGBAVectorSIMD( _mm_cvtepi32_ps( qp1 ) ); RGBAVectorSIMD np2 = RGBAVectorSIMD( _mm_cvtepi32_ps( qp2 ) ); RGBAVectorSIMD d1 = np1 - p1; RGBAVectorSIMD d2 = np2 - p2; float dist = (d1 * d1) + (d2 * d2); if(dist < minDist) { minDist = dist; bp1 = np1; bp2 = np2; bestPBitCombo = i; } } p1 = bp1; p2 = bp2; } int BC7CompressionModeSIMD::GetSubsetForIndex(int idx, const int shapeIdx) const { int subset = 0; const int nSubsets = GetNumberOfSubsets(); switch(nSubsets) { case 2: { subset = !!((1 << idx) & kShapeMask2[shapeIdx]); } break; case 3: { if(1 << idx & kShapeMask3[shapeIdx][0]) subset = 1 + !!((1 << idx) & kShapeMask3[shapeIdx][1]); else subset = 0; } break; default: break; } return subset; } int BC7CompressionModeSIMD::GetAnchorIndexForSubset(int subset, const int shapeIdx) const { const int nSubsets = GetNumberOfSubsets(); int anchorIdx = 0; switch(subset) { case 1: { if(nSubsets == 2) { anchorIdx = kAnchorIdx2[shapeIdx]; } else { anchorIdx = kAnchorIdx3[0][shapeIdx]; } } break; case 2: { assert(nSubsets == 3); anchorIdx = kAnchorIdx3[1][shapeIdx]; } break; default: break; } return anchorIdx; } double BC7CompressionModeSIMD::CompressSingleColor(const RGBAVectorSIMD &p, RGBAVectorSIMD &p1, RGBAVectorSIMD &p2, int &bestPbitCombo) const { // Our pixel to compress... const __m128i pixel = p.ToPixel(*((const __m128i *)kByteValMask)); UINT bestDist = 0xFF; bestPbitCombo = -1; for(int pbi = 0; pbi < GetNumPbitCombos(); pbi++) { const int *pbitCombo = GetPBitCombo(pbi); UINT dist = 0x0; UINT bestValI[kNumColorChannels] = { (UINT)-1, (UINT)-1, (UINT)-1, (UINT)-1 }; UINT bestValJ[kNumColorChannels] = { (UINT)-1, (UINT)-1, (UINT)-1, (UINT)-1 }; for(int ci = 0; ci < kNumColorChannels; ci++) { const BYTE val = ((BYTE *)(&pixel))[4*ci]; int nBits = 0; switch(ci) { case 0: nBits = GetRedChannelPrecision(); break; case 1: nBits = GetGreenChannelPrecision(); break; case 2: nBits = GetBlueChannelPrecision(); break; case 3: nBits = GetAlphaChannelPrecision(); break; } // If we don't handle this channel, then we don't need to // worry about how well we interpolate. if(nBits == 0) { bestValI[ci] = bestValJ[ci] = 0xFF; continue; } const int nPossVals = (1 << nBits); int possValsH[256]; int possValsL[256]; // Do we have a pbit? const bool havepbit = GetPBitType() != ePBitType_None; if(havepbit) nBits++; for(int i = 0; i < nPossVals; i++) { int vh = i, vl = i; if(havepbit) { vh <<= 1; vl <<= 1; vh |= pbitCombo[1]; vl |= pbitCombo[0]; } possValsH[i] = (vh << (8 - nBits)); possValsH[i] |= (possValsH[i] >> nBits); possValsL[i] = (vl << (8 - nBits)); possValsL[i] |= (possValsL[i] >> nBits); } const UINT interpVal0 = kBC7InterpolationValuesScalar[GetNumberOfBitsPerIndex() - 1][1][0]; const UINT interpVal1 = kBC7InterpolationValuesScalar[GetNumberOfBitsPerIndex() - 1][1][1]; // Find the closest interpolated val that to the given val... UINT bestChannelDist = 0xFF; for(int i = 0; bestChannelDist > 0 && i < nPossVals; i++) for(int j = 0; bestChannelDist > 0 && j < nPossVals; j++) { const UINT v1 = possValsL[i]; const UINT v2 = possValsH[j]; const UINT combo = (interpVal0*v1 + (interpVal1 * v2) + 32) >> 6; const UINT err = (combo > val)? combo - val : val - combo; if(err < bestChannelDist) { bestChannelDist = err; bestValI[ci] = v1; bestValJ[ci] = v2; } } dist = max(bestChannelDist, dist); } if(dist < bestDist) { bestDist = dist; bestPbitCombo = pbi; for(int ci = 0; ci < kNumColorChannels; ci++) { p1.c[ci] = float(bestValI[ci]); p2.c[ci] = float(bestValJ[ci]); } } } return bestDist; } ALIGN_SSE UINT kOneVec[4] = { 1, 1, 1, 1 }; // Fast random number generator. See more information at // http://software.intel.com/en-us/articles/fast-random-number-generator-on-the-intel-pentiumr-4-processor/ static UINT g_seed = UINT(time(NULL)); static inline UINT fastrand() { g_seed = (214013 * g_seed + 2531011); return (g_seed>>16) & RAND_MAX; } static __m128i cur_seed = _mm_set1_epi32( int(time(NULL)) ); static inline __m128i rand_dir() { // static const __m128i mult = _mm_set_epi32( 214013, 17405, 214013, 69069 ); // static const __m128i gadd = _mm_set_epi32( 2531011, 10395331, 13737667, 1 ); ALIGN_SSE UINT mult[4] = { 214013, 17405, 214013, 0 }; ALIGN_SSE UINT gadd[4] = { 2531011, 10395331, 13737667, 0 }; ALIGN_SSE UINT masklo[4] = { RAND_MAX, RAND_MAX, RAND_MAX, RAND_MAX }; cur_seed = _mm_mullo_epi32( *((const __m128i *)mult), cur_seed ); cur_seed = _mm_add_epi32( *((const __m128i *)gadd), cur_seed ); const __m128i resShift = _mm_srai_epi32( cur_seed, 16 ); const __m128i result = _mm_and_si128( resShift, *((const __m128i *)kOneVec) ); return result; } // Fast generation of floats between 0 and 1. It generates a float // whose exponent forces the value to be between 1 and 2, then it // populates the mantissa with a random assortment of bits, and returns // the bytes interpreted as a float. This prevents two things: 1, a // division, and 2, a cast from an integer to a float. #define COMPILE_ASSERT(x) extern int __compile_assert_[(int)(x)]; COMPILE_ASSERT(RAND_MAX == 0x7FFF) static inline float frand() { const WORD r = fastrand(); // RAND_MAX is 0x7FFF, which offers 15 bits // of precision. Therefore, we move the bits // into the top of the 23 bit mantissa, and // repeat the most significant bits of r in // the least significant of the mantissa const UINT m = (r << 8) | (r >> 7); const UINT flt = (127 << 23) | m; return *(reinterpret_cast<const float *>(&flt)) - 1.0f; } ALIGN_SSE UINT kSevenVec[4] = { 7, 7, 7, 7 }; ALIGN_SSE UINT kNegOneVec[4] = { 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF }; ALIGN_SSE UINT kFloatSignBit[4] = { 0x40000000, 0x40000000, 0x40000000, 0x40000000 }; static void ChangePointForDirWithoutPbitChange(RGBAVectorSIMD &v, const __m128 &stepVec) { const __m128i dirBool = rand_dir(); const __m128i cmp = _mm_cmpeq_epi32( dirBool, *((const __m128i *)kZeroVector) ); const __m128 negStepVec = _mm_sub_ps( _mm_castsi128_ps( *((const __m128i *)kZeroVector) ), stepVec ); const __m128 step = _mm_blendv_ps( negStepVec, stepVec, _mm_castsi128_ps( cmp ) ); v.vec = _mm_add_ps( v.vec, step ); } static void ChangePointForDirWithPbitChange(RGBAVectorSIMD &v, int oldPbit, const __m128 &stepVec) { const __m128i pBitVec = _mm_set1_epi32( oldPbit ); const __m128i cmpPBit = _mm_cmpeq_epi32( pBitVec, *((const __m128i *)kZeroVector) ); const __m128i notCmpPBit = _mm_xor_si128( cmpPBit, *((const __m128i *)kNegOneVec) ); const __m128i dirBool = rand_dir(); const __m128i cmpDir = _mm_cmpeq_epi32( dirBool, *((const __m128i *)kOneVec) ); const __m128i notCmpDir = _mm_xor_si128( cmpDir, *((const __m128i *)kNegOneVec) ); const __m128i shouldDec = _mm_and_si128( cmpDir, cmpPBit ); const __m128i shouldInc = _mm_and_si128( notCmpDir, notCmpPBit ); const __m128 decStep = _mm_blendv_ps( _mm_castsi128_ps( *((const __m128i *)kZeroVector) ), stepVec, _mm_castsi128_ps( shouldDec ) ); v.vec = _mm_sub_ps( v.vec, decStep ); const __m128 incStep = _mm_blendv_ps( _mm_castsi128_ps( *((const __m128i *)kZeroVector) ), stepVec, _mm_castsi128_ps( shouldInc ) ); v.vec = _mm_add_ps( v.vec, incStep ); } void BC7CompressionModeSIMD::PickBestNeighboringEndpoints(const RGBAClusterSIMD &cluster, const RGBAVectorSIMD &p1, const RGBAVectorSIMD &p2, const int curPbitCombo, RGBAVectorSIMD &np1, RGBAVectorSIMD &np2, int &nPbitCombo, const __m128 &stepVec) const { np1 = p1; np2 = p2; // First, let's figure out the new pbit combo... if there's no pbit then we don't need // to worry about it. const EPBitType pBitType = GetPBitType(); if(pBitType != ePBitType_None) { // If there is a pbit, then we must change it, because those will provide the closest values // to the current point. if(pBitType == ePBitType_Shared) nPbitCombo = (curPbitCombo + 1) % 2; else { // Not shared... p1 needs to change and p2 needs to change... which means that // combo 0 gets rotated to combo 3, combo 1 gets rotated to combo 2 and vice // versa... nPbitCombo = 3 - curPbitCombo; } assert(GetPBitCombo(curPbitCombo)[0] + GetPBitCombo(nPbitCombo)[0] == 1); assert(GetPBitCombo(curPbitCombo)[1] + GetPBitCombo(nPbitCombo)[1] == 1); const int *pBitCombo = GetPBitCombo(curPbitCombo); ChangePointForDirWithPbitChange(np1, pBitCombo[0], stepVec); ChangePointForDirWithPbitChange(np2, pBitCombo[1], stepVec); } else { ChangePointForDirWithoutPbitChange(np1, stepVec); ChangePointForDirWithoutPbitChange(np2, stepVec); } ClampEndpoints(np1, np2); } bool BC7CompressionModeSIMD::AcceptNewEndpointError(float newError, float oldError, float temp) const { const float p = exp((0.15f * (oldError - newError)) / temp); // const double r = (double(rand()) / double(RAND_MAX)); const float r = frand(); return r < p; } double BC7CompressionModeSIMD::OptimizeEndpointsForCluster(const RGBAClusterSIMD &cluster, RGBAVectorSIMD &p1, RGBAVectorSIMD &p2, __m128i *bestIndices, int &bestPbitCombo) const { const int nBuckets = (1 << GetNumberOfBitsPerIndex()); const int nPbitCombos = GetNumPbitCombos(); __m128i qmask; GetQuantizationMask(qmask); // Here we use simulated annealing to traverse the space of clusters to find the best possible endpoints. float curError = cluster.QuantizedError(p1, p2, nBuckets, qmask, GetPBitCombo(bestPbitCombo), bestIndices); int curPbitCombo = bestPbitCombo; float bestError = curError; RGBAVectorSIMD bp1 = p1, bp2 = p2; assert(curError == cluster.QuantizedError(p1, p2, nBuckets, qmask, GetPBitCombo(bestPbitCombo))); __m128i precVec = _mm_setr_epi32( GetRedChannelPrecision(), GetGreenChannelPrecision(), GetBlueChannelPrecision(), GetAlphaChannelPrecision() ); const __m128i precMask = _mm_xor_si128( _mm_cmpeq_epi32( precVec, *((const __m128i *)kZeroVector) ), *((const __m128i *)kNegOneVec) ); precVec = _mm_sub_epi32( *((const __m128i *)kSevenVec), precVec ); precVec = _mm_slli_epi32( precVec, 23 ); precVec = _mm_or_si128( precVec, *((const __m128i *)kFloatSignBit) ); //__m128 stepSzVec = _mm_set1_ps(1.0f); //__m128 stepVec = _mm_mul_ps( stepSzVec, _mm_castsi128_ps( _mm_and_si128( precMask, precVec ) ) ); __m128 stepVec = _mm_castsi128_ps( _mm_and_si128( precMask, precVec ) ); const int maxEnergy = MaxAnnealingIterations; for(int energy = 0; bestError > 0 && energy < maxEnergy; energy++) { float temp = float(energy) / float(maxEnergy-1); __m128i indices[kMaxNumDataPoints/4]; RGBAVectorSIMD np1, np2; int nPbitCombo; PickBestNeighboringEndpoints(cluster, p1, p2, curPbitCombo, np1, np2, nPbitCombo, stepVec); float error = cluster.QuantizedError(np1, np2, nBuckets, qmask, GetPBitCombo(nPbitCombo), indices); if(AcceptNewEndpointError(error, curError, temp)) { curError = error; p1 = np1; p2 = np2; curPbitCombo = nPbitCombo; } if(error < bestError) { memcpy(bestIndices, indices, sizeof(indices)); bp1 = np1; bp2 = np2; bestPbitCombo = nPbitCombo; bestError = error; // Restart... energy = 0; } } p1 = bp1; p2 = bp2; return bestError; } double BC7CompressionModeSIMD::CompressCluster(const RGBAClusterSIMD &cluster, RGBAVectorSIMD &p1, RGBAVectorSIMD &p2, __m128i *bestIndices, int &bestPbitCombo) const { // If all the points are the same in the cluster, then we need to figure out what the best // approximation to this point is.... if(cluster.AllSamePoint()) { const RGBAVectorSIMD &p = cluster.GetPoint(0); double bestErr = CompressSingleColor(p, p1, p2, bestPbitCombo); // We're assuming all indices will be index 1... for(int i = 0; i < 4; i++) { bestIndices[i] = _mm_set1_epi32(1); } return bestErr; } const int nBuckets = (1 << GetNumberOfBitsPerIndex()); const int nPbitCombos = GetNumPbitCombos(); RGBAVectorSIMD avg = cluster.GetTotal() / float(cluster.GetNumPoints()); RGBADirSIMD axis; ::GetPrincipalAxis(cluster, axis); float mindp = FLT_MAX, maxdp = -FLT_MAX; for(int i = 0 ; i < cluster.GetNumPoints(); i++) { float dp = (cluster.GetPoint(i) - avg) * axis; if(dp < mindp) mindp = dp; if(dp > maxdp) maxdp = dp; } RGBAVectorSIMD pts[1 << 4]; // At most 4 bits per index. float numPts[1<<4]; assert(nBuckets <= 1 << 4); p1 = avg + mindp * axis; p2 = avg + maxdp * axis; ClampEndpoints(p1, p2); for(int i = 0; i < nBuckets; i++) { float s = (float(i) / float(nBuckets - 1)); pts[i] = (1.0f - s) * p1 + s * p2; } assert(pts[0] == p1); assert(pts[nBuckets - 1] == p2); // Do k-means clustering... int bucketIdx[kMaxNumDataPoints]; bool fixed = false; while(!fixed) { RGBAVectorSIMD newPts[1 << 4]; // Assign each of the existing points to one of the buckets... for(int i = 0; i < cluster.GetNumPoints(); i++) { int minBucket = -1; float minDist = FLT_MAX; for(int j = 0; j < nBuckets; j++) { RGBAVectorSIMD v = cluster.GetPoint(i) - pts[j]; float distSq = v * v; if(distSq < minDist) { minDist = distSq; minBucket = j; } } assert(minBucket >= 0); bucketIdx[i] = minBucket; } // Calculate new buckets based on centroids of clusters... for(int i = 0; i < nBuckets; i++) { numPts[i] = 0.0f; newPts[i] = RGBAVectorSIMD(0.0f); for(int j = 0; j < cluster.GetNumPoints(); j++) { if(bucketIdx[j] == i) { numPts[i] += 1.0f; newPts[i] += cluster.GetPoint(j); } } // If there are no points in this cluster, then it should // remain the same as last time and avoid a divide by zero. if(0.0f != numPts[i]) newPts[i] /= numPts[i]; } // If we haven't changed, then we're done. fixed = true; for(int i = 0; i < nBuckets; i++) { if(pts[i] != newPts[i]) fixed = false; } // Assign the new points to be the old points. for(int i = 0; i < nBuckets; i++) { pts[i] = newPts[i]; } } // If there's only one bucket filled, then just compress for that single color... int numBucketsFilled = 0, lastFilledBucket = -1; for(int i = 0; i < nBuckets; i++) { if(numPts[i] > 0.0f) { numBucketsFilled++; lastFilledBucket = i; } } assert(numBucketsFilled > 0); if(1 == numBucketsFilled) { const RGBAVectorSIMD &p = pts[lastFilledBucket]; double bestErr = CompressSingleColor(p, p1, p2, bestPbitCombo); // We're assuming all indices will be index 1... for(int i = 0; i < 4; i++) { bestIndices[i] = _mm_set1_epi32(1); } return bestErr; } // Now that we know the index of each pixel, we can assign the endpoints based on a least squares fit // of the clusters. For more information, take a look at this article by NVidia: // http://developer.download.nvidia.com/compute/cuda/1.1-Beta/x86_website/projects/dxtc/doc/cuda_dxtc.pdf float asq = 0.0, bsq = 0.0, ab = 0.0; RGBAVectorSIMD ax(0.0f), bx(0.0f); for(int i = 0; i < nBuckets; i++) { float a = float(nBuckets - 1 - i) / float(nBuckets - 1); float b = float(i) / float(nBuckets - 1); float n = numPts[i]; RGBAVectorSIMD x = pts[i]; asq += n * a * a; bsq += n * b * b; ab += n * a * b; ax += x * a * n; bx += x * b * n; } float f = 1.0f / (asq * bsq - ab * ab); p1 = f * (ax * bsq - bx * ab); p2 = f * (bx * asq - ax * ab); ClampEndpointsToGrid(p1, p2, bestPbitCombo); #ifdef _DEBUG int pBitCombo = bestPbitCombo; RGBAVectorSIMD tp1 = p1, tp2 = p2; ClampEndpointsToGrid(tp1, tp2, pBitCombo); assert(p1 == tp1); assert(p2 == tp2); assert(pBitCombo == bestPbitCombo); #endif assert(bestPbitCombo >= 0); return OptimizeEndpointsForCluster(cluster, p1, p2, bestIndices, bestPbitCombo); } double BC7CompressionModeSIMD::Compress(BitStream &stream, const int shapeIdx, const RGBAClusterSIMD *clusters) const { const int kModeNumber = GetModeNumber(); const int nPartitionBits = GetNumberOfPartitionBits(); const int nSubsets = GetNumberOfSubsets(); // Mode # stream.WriteBits(1 << kModeNumber, kModeNumber + 1); // Partition # assert((((1 << nPartitionBits) - 1) & shapeIdx) == shapeIdx); stream.WriteBits(shapeIdx, nPartitionBits); RGBAVectorSIMD p1[kMaxNumSubsets], p2[kMaxNumSubsets]; int bestIndices[kMaxNumSubsets][kMaxNumDataPoints] = { { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }, { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }, { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 } }; int bestPbitCombo[kMaxNumSubsets] = { -1, -1, -1 }; double totalErr = 0.0; for(int cidx = 0; cidx < nSubsets; cidx++) { ALIGN_SSE int indices[kMaxNumDataPoints]; // Compress this cluster totalErr += CompressCluster(clusters[cidx], p1[cidx], p2[cidx], (__m128i *)indices, bestPbitCombo[cidx]); // !SPEED! We can precompute the subsets for each index based on the shape. This // isn't the bottleneck for the compressor, but it could prove to be a little // faster... // Map the indices to their proper position. int idx = 0; for(int i = 0; i < 16; i++) { int subs = GetSubsetForIndex(i, shapeIdx); if(subs == cidx) { bestIndices[cidx][i] = indices[idx++]; } } } #ifdef _DEBUG for(int i = 0; i < kMaxNumDataPoints; i++) { int nSet = 0; for(int j = 0; j < nSubsets; j++) { if(bestIndices[j][i] >= 0) nSet++; } assert(nSet == 1); } #endif // Get the quantization mask __m128i qmask; GetQuantizationMask(qmask); //Quantize the points... __m128i pixel1[kMaxNumSubsets], pixel2[kMaxNumSubsets]; for(int i = 0; i < nSubsets; i++) { switch(GetPBitType()) { default: case ePBitType_None: pixel1[i] = p1[i].ToPixel(qmask); pixel2[i] = p2[i].ToPixel(qmask); break; case ePBitType_Shared: case ePBitType_NotShared: pixel1[i] = p1[i].ToPixel(qmask, GetPBitCombo(bestPbitCombo[i])[0]); pixel2[i] = p2[i].ToPixel(qmask, GetPBitCombo(bestPbitCombo[i])[1]); break; } } // If the anchor index does not have 0 in the leading bit, then // we need to swap EVERYTHING. for(int sidx = 0; sidx < nSubsets; sidx++) { int anchorIdx = GetAnchorIndexForSubset(sidx, shapeIdx); assert(bestIndices[sidx][anchorIdx] != -1); int nIndexBits = GetNumberOfBitsPerIndex(); if(bestIndices[sidx][anchorIdx] >> (nIndexBits - 1)) { __m128i t = pixel1[sidx]; pixel1[sidx] = pixel2[sidx]; pixel2[sidx] = t; int nIndexVals = 1 << nIndexBits; for(int i = 0; i < 16; i++) { bestIndices[sidx][i] = (nIndexVals - 1) - bestIndices[sidx][i]; } } assert(!(bestIndices[sidx][anchorIdx] >> (nIndexBits - 1))); } // Get the quantized values... BYTE r1[kMaxNumSubsets], g1[kMaxNumSubsets], b1[kMaxNumSubsets], a1[kMaxNumSubsets]; BYTE r2[kMaxNumSubsets], g2[kMaxNumSubsets], b2[kMaxNumSubsets], a2[kMaxNumSubsets]; for(int i = 0; i < nSubsets; i++) { r1[i] = ((BYTE *)(&(pixel1[i])))[0]; r2[i] = ((BYTE *)(&(pixel2[i])))[0]; g1[i] = ((BYTE *)(&(pixel1[i])))[4]; g2[i] = ((BYTE *)(&(pixel2[i])))[4]; b1[i] = ((BYTE *)(&(pixel1[i])))[8]; b2[i] = ((BYTE *)(&(pixel2[i])))[8]; a1[i] = ((BYTE *)(&(pixel1[i])))[12]; a2[i] = ((BYTE *)(&(pixel2[i])))[12]; } // Write them out... const int nRedBits = GetRedChannelPrecision(); for(int i = 0; i < nSubsets; i++) { stream.WriteBits(r1[i] >> (8 - nRedBits), nRedBits); stream.WriteBits(r2[i] >> (8 - nRedBits), nRedBits); } const int nGreenBits = GetGreenChannelPrecision(); for(int i = 0; i < nSubsets; i++) { stream.WriteBits(g1[i] >> (8 - nGreenBits), nGreenBits); stream.WriteBits(g2[i] >> (8 - nGreenBits), nGreenBits); } const int nBlueBits = GetBlueChannelPrecision(); for(int i = 0; i < nSubsets; i++) { stream.WriteBits(b1[i] >> (8 - nBlueBits), nBlueBits); stream.WriteBits(b2[i] >> (8 - nBlueBits), nBlueBits); } const int nAlphaBits = GetAlphaChannelPrecision(); for(int i = 0; i < nSubsets; i++) { stream.WriteBits(a1[i] >> (8 - nAlphaBits), nAlphaBits); stream.WriteBits(a2[i] >> (8 - nAlphaBits), nAlphaBits); } // Write out the best pbits.. if(GetPBitType() != ePBitType_None) { for(int s = 0; s < nSubsets; s++) { const int *pbits = GetPBitCombo(bestPbitCombo[s]); stream.WriteBits(pbits[0], 1); if(GetPBitType() != ePBitType_Shared) stream.WriteBits(pbits[1], 1); } } for(int i = 0; i < 16; i++) { const int subs = GetSubsetForIndex(i, shapeIdx); const int idx = bestIndices[subs][i]; const int anchorIdx = GetAnchorIndexForSubset(subs, shapeIdx); const int nBitsForIdx = GetNumberOfBitsPerIndex(); assert(idx >= 0 && idx < (1 << nBitsForIdx)); assert(i != anchorIdx || !(idx >> (nBitsForIdx - 1)) || !"Leading bit of anchor index is not zero!"); stream.WriteBits(idx, (i == anchorIdx)? nBitsForIdx - 1 : nBitsForIdx); } assert(stream.GetBitsWritten() == 128); return totalErr; } namespace BC7C { // Function prototypes static void ExtractBlock(const BYTE* inPtr, int width, UINT* colorBlock); static void CompressBC7Block(const UINT *block, BYTE *outBuf); // Returns true if the entire block is a single color. static bool AllOneColor(const UINT block[16]) { const UINT pixel = block[0]; for(int i = 1; i < 16; i++) { if( block[i] != pixel ) return false; } return true; } // Write out a transparent block. static void WriteTransparentBlock(BitStream &stream) { // Use mode 6 stream.WriteBits(1 << 6, 7); stream.WriteBits(0, 128-7); assert(stream.GetBitsWritten() == 128); } // Compresses a single color optimally and outputs the result. static void CompressOptimalColorBC7(UINT pixel, BitStream &stream) { stream.WriteBits(1 << 5, 6); // Mode 5 stream.WriteBits(0, 2); // No rotation bits. BYTE r = pixel & 0xFF; BYTE g = (pixel >> 8) & 0xFF; BYTE b = (pixel >> 16) & 0xFF; BYTE a = (pixel >> 24) & 0xFF; // Red endpoints stream.WriteBits(Optimal7CompressBC7Mode5[r][0], 7); stream.WriteBits(Optimal7CompressBC7Mode5[r][1], 7); // Green endpoints stream.WriteBits(Optimal7CompressBC7Mode5[g][0], 7); stream.WriteBits(Optimal7CompressBC7Mode5[g][1], 7); // Blue endpoints stream.WriteBits(Optimal7CompressBC7Mode5[b][0], 7); stream.WriteBits(Optimal7CompressBC7Mode5[b][1], 7); // Alpha endpoints... are just the same. stream.WriteBits(a, 8); stream.WriteBits(a, 8); // Color indices are 1 for each pixel... // Anchor index is 0, so 1 bit for the first pixel, then // 01 for each following pixel giving the sequence of 31 bits: // ...010101011 stream.WriteBits(0xaaaaaaab, 31); // Alpha indices... stream.WriteBits(kWMValues[gWMVal = (gWMVal+1) % kNumWMVals], 31); } // Compress an image using BC7 compression. Use the inBuf parameter to point to an image in // 4-byte RGBA format. The width and height parameters specify the size of the image in pixels. // The buffer pointed to by outBuf should be large enough to store the compressed image. This // implementation has an 4:1 compression ratio. void CompressImageBC7SIMD(const BYTE* inBuf, BYTE* outBuf, int width, int height) { ALIGN_SSE UINT block[16]; _MM_SET_ROUNDING_MODE( _MM_ROUND_TOWARD_ZERO ); BC7CompressionModeSIMD::ResetNumUses(); BC7CompressionModeSIMD::MaxAnnealingIterations = GetQualityLevel(); for(int j = 0; j < height; j += 4, inBuf += width * 4 * 4) { for(int i = 0; i < width; i += 4) { ExtractBlock(inBuf + i * 4, width, block); CompressBC7Block(block, outBuf); outBuf += 16; } } } // Extract a 4 by 4 block of pixels from inPtr and store it in colorBlock. The width parameter // specifies the size of the image in pixels. static void ExtractBlock(const BYTE* inPtr, int width, UINT* colorBlock) { // Compute the stride. const int stride = width * 4; // Copy the first row of pixels from inPtr into colorBlock. _mm_store_si128((__m128i*)colorBlock, _mm_load_si128((__m128i*)inPtr)); inPtr += stride; // Copy the second row of pixels from inPtr into colorBlock. _mm_store_si128((__m128i*)(colorBlock + 4), _mm_load_si128((__m128i*)inPtr)); inPtr += stride; // Copy the third row of pixels from inPtr into colorBlock. _mm_store_si128((__m128i*)(colorBlock + 8), _mm_load_si128((__m128i*)inPtr)); inPtr += stride; // Copy the forth row of pixels from inPtr into colorBlock. _mm_store_si128((__m128i*)(colorBlock + 12), _mm_load_si128((__m128i*)inPtr)); } static double CompressTwoClusters(int shapeIdx, const RGBAClusterSIMD *clusters, BYTE *outBuf, double estimatedError) { BYTE tempBuf1[16]; BitStream tmpStream1(tempBuf1, 128, 0); BC7CompressionModeSIMD compressor1(1, estimatedError); double bestError = compressor1.Compress(tmpStream1, shapeIdx, clusters); memcpy(outBuf, tempBuf1, 16); if(bestError == 0.0) { return 0.0; } BYTE tempBuf3[16]; BitStream tmpStream3(tempBuf3, 128, 0); BC7CompressionModeSIMD compressor3(3, estimatedError); double error; if((error = compressor3.Compress(tmpStream3, shapeIdx, clusters)) < bestError) { bestError = error; memcpy(outBuf, tempBuf3, 16); if(bestError == 0.0) { return 0.0; } } // Mode 3 offers more precision for RGB data. Mode 7 is really only if we have alpha. //BYTE tempBuf7[16]; //BitStream tmpStream7(tempBuf7, 128, 0); //BC7CompressionModeSIMD compressor7(7, estimatedError); //if((error = compressor7.Compress(tmpStream7, shapeIdx, clusters)) < bestError) { // memcpy(outBuf, tempBuf7, 16); // return error; //} return bestError; } static double CompressThreeClusters(int shapeIdx, const RGBAClusterSIMD *clusters, BYTE *outBuf, double estimatedError) { BYTE tempBuf0[16]; BitStream tmpStream0(tempBuf0, 128, 0); BYTE tempBuf2[16]; BitStream tmpStream2(tempBuf2, 128, 0); BC7CompressionModeSIMD compressor0(0, estimatedError); BC7CompressionModeSIMD compressor2(2, estimatedError); double error, bestError = (shapeIdx < 16)? compressor0.Compress(tmpStream0, shapeIdx, clusters) : DBL_MAX; memcpy(outBuf, tempBuf0, 16); if(bestError == 0.0) { return 0.0; } if((error = compressor2.Compress(tmpStream2, shapeIdx, clusters)) < bestError) { memcpy(outBuf, tempBuf2, 16); return error; } return bestError; } static void PopulateTwoClustersForShape(const RGBAClusterSIMD &points, int shapeIdx, RGBAClusterSIMD *clusters) { const WORD shape = kShapeMask2[shapeIdx]; for(int pt = 0; pt < kMaxNumDataPoints; pt++) { const RGBAVectorSIMD &p = points.GetPoint(pt); if((1 << pt) & shape) clusters[1].AddPoint(p, pt); else clusters[0].AddPoint(p, pt); } assert(!(clusters[0].GetPointBitString() & clusters[1].GetPointBitString())); assert((clusters[0].GetPointBitString() ^ clusters[1].GetPointBitString()) == 0xFFFF); assert((shape & clusters[1].GetPointBitString()) == shape); } static void PopulateThreeClustersForShape(const RGBAClusterSIMD &points, int shapeIdx, RGBAClusterSIMD *clusters) { for(int pt = 0; pt < kMaxNumDataPoints; pt++) { const RGBAVectorSIMD &p = points.GetPoint(pt); if((1 << pt) & kShapeMask3[shapeIdx][0]) { if((1 << pt) & kShapeMask3[shapeIdx][1]) clusters[2].AddPoint(p, pt); else clusters[1].AddPoint(p, pt); } else clusters[0].AddPoint(p, pt); } assert(!(clusters[0].GetPointBitString() & clusters[1].GetPointBitString())); assert(!(clusters[2].GetPointBitString() & clusters[1].GetPointBitString())); assert(!(clusters[0].GetPointBitString() & clusters[2].GetPointBitString())); } static double EstimateTwoClusterError(RGBAClusterSIMD &c) { RGBAVectorSIMD Min, Max, v; c.GetBoundingBox(Min, Max); v = Max - Min; if(v * v == 0) { return 0.0; } return 0.0001 + c.QuantizedError(Min, Max, 8, _mm_set1_epi32(0xFF)); } static double EstimateThreeClusterError(RGBAClusterSIMD &c) { RGBAVectorSIMD Min, Max, v; c.GetBoundingBox(Min, Max); v = Max - Min; if(v * v == 0) { return 0.0; } return 0.0001 + c.QuantizedError(Min, Max, 4, _mm_set1_epi32(0xFF)); } // Compress a single block. void CompressBC7Block(const UINT *block, BYTE *outBuf) { // All a single color? if(AllOneColor(block)) { BitStream bStrm(outBuf, 128, 0); CompressOptimalColorBC7(*((const UINT *)block), bStrm); return; } RGBAClusterSIMD blockCluster; bool opaque = true; bool transparent = true; for(int i = 0; i < kMaxNumDataPoints; i++) { RGBAVectorSIMD p = RGBAVectorSIMD(block[i]); blockCluster.AddPoint(p, i); if(fabs(p.a - 255.0f) > 1e-10) opaque = false; if(p.a > 0.0f) transparent = false; } // The whole block is transparent? if(transparent) { BitStream bStrm(outBuf, 128, 0); WriteTransparentBlock(bStrm); return; } // First we must figure out which shape to use. To do this, simply // see which shape has the smallest sum of minimum bounding spheres. double bestError[2] = { DBL_MAX, DBL_MAX }; int bestShapeIdx[2] = { -1, -1 }; RGBAClusterSIMD bestClusters[2][3]; for(int i = 0; i < kNumShapes2; i++) { RGBAClusterSIMD clusters[2]; PopulateTwoClustersForShape(blockCluster, i, clusters); double err = 0.0; for(int ci = 0; ci < 2; ci++) { err += EstimateTwoClusterError(clusters[ci]); } // If it's small, we'll take it! if(err < 1e-9) { CompressTwoClusters(i, clusters, outBuf, err); return; } if(err < bestError[0]) { bestError[0] = err; bestShapeIdx[0] = i; bestClusters[0][0] = clusters[0]; bestClusters[0][1] = clusters[1]; } } // There are not 3 subset blocks that support alpha... if(opaque) { for(int i = 0; i < kNumShapes3; i++) { RGBAClusterSIMD clusters[3]; PopulateThreeClustersForShape(blockCluster, i, clusters); double err = 0.0; for(int ci = 0; ci < 3; ci++) { err += EstimateThreeClusterError(clusters[ci]); } // If it's small, we'll take it! if(err < 1e-9) { CompressThreeClusters(i, clusters, outBuf, err); return; } if(err < bestError[1]) { bestError[1] = err; bestShapeIdx[1] = i; bestClusters[1][0] = clusters[0]; bestClusters[1][1] = clusters[1]; bestClusters[1][2] = clusters[2]; } } } if(opaque) { BYTE tempBuf1[16]; BYTE tempBuf2[16]; BitStream tempStream1 (tempBuf1, 128, 0); BC7CompressionModeSIMD compressor(6, DBL_MAX); double best = compressor.Compress(tempStream1, 0, &blockCluster); if(best == 0.0f) { memcpy(outBuf, tempBuf1, 16); return; } double error = DBL_MAX; if((error = CompressTwoClusters(bestShapeIdx[0], bestClusters[0], tempBuf2, bestError[0])) < best) { best = error; if(error == 0.0f) { memcpy(outBuf, tempBuf2, 16); return; } else { memcpy(tempBuf1, tempBuf2, 16); } } if(CompressThreeClusters(bestShapeIdx[1], bestClusters[1], tempBuf2, bestError[1]) < best) { memcpy(outBuf, tempBuf2, 16); return; } memcpy(outBuf, tempBuf1, 16); } else { assert(!"Don't support alpha yet!"); } } } #endif
31.939054
255
0.657
paintdream
f3289a364207d1bc7600864e1de90fd816ea0a59
1,775
hpp
C++
serial_communication/include/serial_communication/serial_windows.hpp
Terabee/hardware_drivers
09eb0404cff615ccba7cbb2866c4b65fe8d6a517
[ "MIT" ]
1
2020-06-22T21:44:32.000Z
2020-06-22T21:44:32.000Z
serial_communication/include/serial_communication/serial_windows.hpp
Terabee/hardware_drivers
09eb0404cff615ccba7cbb2866c4b65fe8d6a517
[ "MIT" ]
null
null
null
serial_communication/include/serial_communication/serial_windows.hpp
Terabee/hardware_drivers
09eb0404cff615ccba7cbb2866c4b65fe8d6a517
[ "MIT" ]
2
2020-06-24T07:07:50.000Z
2021-03-30T15:37:40.000Z
#ifndef SERIAL_WINDOWS_H #define SERIAL_WINDOWS_H #include "serial_communication/iserial.hpp" #include <windows.h> namespace terabee { namespace serial_communication { class SerialWindows : public ISerial { public: SerialWindows() = delete; /** * Constructs Serial from given port, e.g. /dev/ttyUSB0 * * with default settings: * - baud 9600 * - parity none * - bytesize 8 * - 1 stop bit * - no flow control * - timeout == 0 (non-blocking) */ SerialWindows(const std::string &port); SerialWindows(const SerialWindows &other) = delete; SerialWindows(SerialWindows &&other) = delete; ~SerialWindows() override; bool open() override; bool close() override; bool clear() override; bool isOpen() override; size_t available() override; bool setPortName(std::string portname) override; bool setBaudrate(uint32_t baudrate) override; bool setParity(parity_t iparity) override; bool setBytesize(bytesize_t ibytesize) override; bool setStopbits(stopbits_t istopbits) override; bool setFlowcontrol(flowcontrol_t iflowcontrol) override; bool setTimeout(std::chrono::milliseconds timeout) override; std::string readline(size_t max_buffer_size, char eol) override; bool flushInput() override; bool flushOutput() override; size_t write(const uint8_t *data, size_t size) override; size_t read(uint8_t *buffer, size_t size) override; private: bool is_open_; std::string portname_; DWORD baudrate_; BYTE parity_; BYTE stop_bits_; BYTE byte_size_; std::chrono::milliseconds timeout_; bool blocking_; HANDLE serial_handle_; }; } // namespace serial_communication } // namespace terabee #endif // SERIAL_WINDOWS_H
27.307692
67
0.703099
Terabee
f3314bdc07fc13583b425d4d663513c73a2d7497
1,543
cpp
C++
tests_cpp14/benchmark/benchmark.cpp
p-groarke/fea_libs
b7ddec06be807efb0eba51cf52bedf1cd800ef52
[ "BSD-3-Clause" ]
4
2021-01-23T03:35:33.000Z
2022-03-19T03:04:28.000Z
tests_cpp14/benchmark/benchmark.cpp
p-groarke/fea_libs
b7ddec06be807efb0eba51cf52bedf1cd800ef52
[ "BSD-3-Clause" ]
null
null
null
tests_cpp14/benchmark/benchmark.cpp
p-groarke/fea_libs
b7ddec06be807efb0eba51cf52bedf1cd800ef52
[ "BSD-3-Clause" ]
null
null
null
#include <chrono> #include <cstdio> #include <fea/benchmark/benchmark.hpp> #include <gtest/gtest.h> #include <thread> using namespace std::chrono_literals; namespace { TEST(fea_benchmark, basics) { // TODO : This tests nothing, rewrite. fea::bench::suite suite; suite.title("suite test"); suite.benchmark("test1 blee", []() { std::this_thread::sleep_for(0.1s); }); suite.benchmark("test2 blee", []() { std::this_thread::sleep_for(0.2s); }); suite.benchmark("test2 blee", []() { std::this_thread::sleep_for(0.5s); }); // suite.print(); suite.title("suite averages"); suite.average(2); suite.benchmark("test1 blee", []() { std::this_thread::sleep_for(0.2s); }); suite.average(4); suite.benchmark("test2 blee", []() { std::this_thread::sleep_for(0.1s); }); suite.average(10); suite.benchmark("test2 blee", []() { std::this_thread::sleep_for(0.05s); }); // suite.print(); size_t in_between = 0; suite.title("suite averages in-between"); suite.average(1); suite.benchmark( "test1 blee", []() { std::this_thread::sleep_for(0.2s); }, [&]() { ++in_between; }); suite.average(2); suite.benchmark( "test1 blee", []() { std::this_thread::sleep_for(0.2s); }, [&]() { ++in_between; }); suite.average(4); suite.benchmark( "test2 blee", []() { std::this_thread::sleep_for(0.1s); }, [&]() { ++in_between; }); suite.average(10); suite.benchmark( "test2 blee", []() { std::this_thread::sleep_for(0.05s); }, [&]() { ++in_between; }); EXPECT_EQ(in_between, 17u); // suite.print(); } } // namespace
26.152542
77
0.631238
p-groarke
f334aebe60b0ab8eaba6ef7d14e7c33e99e17f83
1,263
cpp
C++
example.cpp
wzhao18/easy-just-in-time
4f28cb18a8d7783fe9fd55d6b5a37a546e426125
[ "BSD-3-Clause" ]
null
null
null
example.cpp
wzhao18/easy-just-in-time
4f28cb18a8d7783fe9fd55d6b5a37a546e426125
[ "BSD-3-Clause" ]
null
null
null
example.cpp
wzhao18/easy-just-in-time
4f28cb18a8d7783fe9fd55d6b5a37a546e426125
[ "BSD-3-Clause" ]
1
2021-06-29T19:15:31.000Z
2021-06-29T19:15:31.000Z
// RUN: %clangxx %cxxflags %include_flags %ld_flags %s -Xclang -load -Xclang %lib_pass -o %t // RUN: %t > %t.out // RUN: %FileCheck %s < %t.out #include <easy/jit.h> #include <llvm/Transforms/Utils/Cloning.h> #include <functional> #include <cstdio> using namespace std::placeholders; double add (double a, double b) { return a+b; } template<class T, class ... Args> std::unique_ptr<easy::Function> get_function(easy::Context const &C, T &&Fun) { auto* FunPtr = easy::meta::get_as_pointer(Fun); return easy::Function::Compile(reinterpret_cast<void*>(FunPtr), C); } template<class T, class ... Args> std::unique_ptr<easy::Function> EASY_JIT_COMPILER_INTERFACE _jit(T &&Fun, Args&& ... args) { auto C = easy::get_context_for<T, Args...>(std::forward<Args>(args)...); return get_function<T, Args...>(C, std::forward<T>(Fun)); } void WriteOptimizedToFile(llvm::Module const &M) { std::error_code Error; llvm::raw_fd_ostream Out("bitcode", Error, llvm::sys::fs::F_None); Out << M; } int main() { std::unique_ptr<easy::Function> CompiledFunction = _jit(add, _1, 1); llvm::Module const & M = CompiledFunction->getLLVMModule(); std::unique_ptr<llvm::Module> Embed = llvm::CloneModule(M); WriteOptimizedToFile(*Embed); return 0; }
26.3125
92
0.683294
wzhao18
f3356db94db7c66fc5d0f42d454550da332ce7e8
697
cpp
C++
concurrency/ex2_1.cpp
hahnjiang/cpp-practices
c8ea5e5e82b9c42c9c99b92b60bb0efaea879e12
[ "MIT" ]
null
null
null
concurrency/ex2_1.cpp
hahnjiang/cpp-practices
c8ea5e5e82b9c42c9c99b92b60bb0efaea879e12
[ "MIT" ]
null
null
null
concurrency/ex2_1.cpp
hahnjiang/cpp-practices
c8ea5e5e82b9c42c9c99b92b60bb0efaea879e12
[ "MIT" ]
null
null
null
#include <algorithm> #include <functional> #include <iostream> #include <thread> #include <vector> using namespace std; class WorkerThread { public: void operator()() { cout << "Worker Thread " << this_thread::get_id() << "is Executing" << endl; } }; int main(void) { vector<thread> threadList; for (int i = 0; i < 10; i++) { threadList.push_back(thread(WorkerThread())); } // 等待所有的工作线程结束,即对每一个 thread 对象调用 join() 函数 cout << "wait for all the worker thread to finish" << endl; for_each(threadList.begin(), threadList.end(), mem_fn(&thread::join)); // 下面这条语句是最后打印的 cout << "Exiting from Main Thread" << endl; return 0; }
23.233333
75
0.615495
hahnjiang
f335b95156763a5021a572e39d7672b0d35cedfd
2,271
cc
C++
src/xpdf/goo/FixedPoint.cc
hackbinary/pdfedit
5efb58265d0b86c2786d7b218aa0d6f895b926d3
[ "CECILL-B" ]
63
2016-01-08T14:48:19.000Z
2022-03-23T11:21:28.000Z
src/xpdf/goo/FixedPoint.cc
mmoselhy/PDF-X
b72597bbb0c6c86d99e44cf18f7b46d5175a7bfa
[ "CECILL-B" ]
2
2017-05-12T02:57:20.000Z
2020-08-15T13:16:00.000Z
src/xpdf/goo/FixedPoint.cc
mmoselhy/PDF-X
b72597bbb0c6c86d99e44cf18f7b46d5175a7bfa
[ "CECILL-B" ]
27
2015-01-21T01:33:56.000Z
2022-03-22T19:42:45.000Z
//======================================================================== // // FixedPoint.cc // // Fixed point type, with C++ operators. // // Copyright 2004 Glyph & Cog, LLC // //======================================================================== #include <xpdf-aconf.h> #if USE_FIXEDPOINT #ifdef USE_GCC_PRAGMAS #pragma implementation #endif #include "goo/FixedPoint.h" #define ln2 ((FixedPoint)0.69314718) FixedPoint FixedPoint::sqrt(FixedPoint x) { FixedPoint y0, y1, z; if (x.val <= 0) { y1.val = 0; } else { y1.val = x.val == 1 ? 2 : x.val >> 1; do { y0.val = y1.val; z = x / y0; y1.val = (y0.val + z.val) >> 1; } while (::abs(y0.val - y1.val) > 1); } return y1; } FixedPoint FixedPoint::pow(FixedPoint x, FixedPoint y) { FixedPoint t, t2, lnx0, lnx, z0, z; int d, n, i; if (y.val <= 0) { z.val = 0; } else { // y * ln(x) t = (x - 1) / (x + 1); t2 = t * t; d = 1; lnx = 0; do { lnx0 = lnx; lnx += t / d; t *= t2; d += 2; } while (::abs(lnx.val - lnx0.val) > 2); lnx.val <<= 1; t = y * lnx; // exp(y * ln(x)) n = floor(t / ln2); t -= ln2 * n; t2 = t; d = 1; i = 1; z = 1; do { z0 = z; z += t2 / d; t2 *= t; ++i; d *= i; } while (::abs(z.val - z0.val) > 2 && d < (1 << fixptShift)); if (n >= 0) { z.val <<= n; } else if (n < 0) { z.val >>= -n; } } return z; } int FixedPoint::mul(int x, int y) { #if 1 //~tmp return ((FixPtInt64)x * y) >> fixptShift; #else int ah0, ah, bh, al, bl; ah0 = x & fixptMaskH; ah = x >> fixptShift; al = x - ah0; bh = y >> fixptShift; bl = y - (bh << fixptShift); return ah0 * bh + ah * bl + al * bh + ((al * bl) >> fixptShift); #endif } int FixedPoint::div(int x, int y) { #if 1 //~tmp return ((FixPtInt64)x << fixptShift) / y; #else #endif } GBool FixedPoint::divCheck(FixedPoint x, FixedPoint y, FixedPoint *result) { #if 1 //~tmp FixPtInt64 z; z = ((FixPtInt64)x.val << fixptShift) / y.val; if ((z == 0 && x != 0) || z >= ((FixPtInt64)1 << 31) || z < -((FixPtInt64)1 << 31)) { return gFalse; } result->val = z; return gTrue; #else #endif } #endif // USE_FIXEDPOINT
19.084034
76
0.459269
hackbinary
f3371ebd667ad084db50fb42547ca725350cac23
6,731
hpp
C++
src/server/UserCommandProcessor.hpp
nopdotcom/opentxs
140428ba8f1bd4c09654ebf0a1c1725f396efa8b
[ "MIT" ]
null
null
null
src/server/UserCommandProcessor.hpp
nopdotcom/opentxs
140428ba8f1bd4c09654ebf0a1c1725f396efa8b
[ "MIT" ]
null
null
null
src/server/UserCommandProcessor.hpp
nopdotcom/opentxs
140428ba8f1bd4c09654ebf0a1c1725f396efa8b
[ "MIT" ]
null
null
null
// Copyright (c) 2018 The Open-Transactions developers // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at http://mozilla.org/MPL/2.0/. #pragma once #include "Internal.hpp" #include "opentxs/Types.hpp" #include <cstdint> #include <memory> namespace opentxs { namespace server { class UserCommandProcessor { public: static bool check_client_isnt_server( const Identifier& nymID, const Nym& serverNym); static bool check_message_notary( const Identifier& notaryID, const Identifier& realNotaryID); static bool check_server_lock(const Identifier& nymID); static void drop_reply_notice_to_nymbox( const api::Wallet& wallet, const String& messageString, const std::int64_t& requestNum, const bool replyTransSuccess, ClientContext& context, Server& server); static bool isAdmin(const Identifier& nymID); bool ProcessUserCommand(const Message& msgIn, Message& msgOut); private: friend class Server; class FinalizeResponse { public: FinalizeResponse( const api::Core& core, const Nym& nym, ReplyMessage& reply, Ledger& ledger); FinalizeResponse() = delete; FinalizeResponse(const FinalizeResponse&) = delete; FinalizeResponse(FinalizeResponse&&) = delete; FinalizeResponse& operator=(const FinalizeResponse&) = delete; FinalizeResponse& operator=(FinalizeResponse&&) = delete; OTTransaction* Release(); OTTransaction* Response(); void SetResponse(OTTransaction* response); ~FinalizeResponse(); private: const api::Core& api_; const Nym& nym_; ReplyMessage& reply_; Ledger& ledger_; std::unique_ptr<OTTransaction> response_{nullptr}; std::size_t counter_{0}; }; Server& server_; const opentxs::api::server::Manager& manager_; bool add_numbers_to_nymbox( const TransactionNumber transactionNumber, const NumList& newNumbers, bool& savedNymbox, Ledger& nymbox, Identifier& nymboxHash) const; void check_acknowledgements(ReplyMessage& reply) const; bool check_client_nym(ReplyMessage& reply) const; bool check_ping_notary(const Message& msgIn) const; bool check_request_number( const Message& msgIn, const RequestNumber& correctNumber) const; bool check_usage_credits(ReplyMessage& reply) const; bool cmd_add_claim(ReplyMessage& reply) const; bool cmd_check_nym(ReplyMessage& reply) const; bool cmd_delete_asset_account(ReplyMessage& reply) const; bool cmd_delete_user(ReplyMessage& reply) const; bool cmd_get_account_data(ReplyMessage& reply) const; bool cmd_get_box_receipt(ReplyMessage& reply) const; // Get the publicly-available list of offers on a specific market. bool cmd_get_instrument_definition(ReplyMessage& reply) const; // Get the list of markets on this server. bool cmd_get_market_list(ReplyMessage& reply) const; bool cmd_get_market_offers(ReplyMessage& reply) const; // Get a report of recent trades that have occurred on a specific market. bool cmd_get_market_recent_trades(ReplyMessage& reply) const; #if OT_CASH bool cmd_get_mint(ReplyMessage& reply) const; #endif // OT_CASH bool cmd_get_nym_market_offers(ReplyMessage& reply) const; // Get the offers that a specific Nym has placed on a specific market. bool cmd_get_nymbox(ReplyMessage& reply) const; bool cmd_get_request_number(ReplyMessage& reply) const; bool cmd_get_transaction_numbers(ReplyMessage& reply) const; bool cmd_issue_basket(ReplyMessage& reply) const; bool cmd_notarize_transaction(ReplyMessage& reply) const; bool cmd_ping_notary(ReplyMessage& reply) const; bool cmd_process_inbox(ReplyMessage& reply) const; bool cmd_process_nymbox(ReplyMessage& reply) const; bool cmd_query_instrument_definitions(ReplyMessage& reply) const; bool cmd_register_account(ReplyMessage& reply) const; bool cmd_register_contract(ReplyMessage& reply) const; bool cmd_register_instrument_definition(ReplyMessage& reply) const; bool cmd_register_nym(ReplyMessage& reply) const; bool cmd_request_admin(ReplyMessage& reply) const; bool cmd_send_nym_message(ReplyMessage& reply) const; bool cmd_trigger_clause(ReplyMessage& reply) const; bool cmd_usage_credits(ReplyMessage& reply) const; std::unique_ptr<Ledger> create_nymbox( const Identifier& nymID, const Identifier& serverID, const Nym& serverNym) const; bool hash_check(const ClientContext& context, Identifier& nymboxHash) const; RequestNumber initialize_request_number(ClientContext& context) const; std::unique_ptr<Ledger> load_inbox( const Identifier& nymID, const Identifier& accountID, const Identifier& serverID, const Nym& serverNym, const bool verifyAccount) const; std::unique_ptr<Ledger> load_nymbox( const Identifier& nymID, const Identifier& serverID, const Nym& serverNym, const bool verifyAccount) const; std::unique_ptr<Ledger> load_outbox( const Identifier& nymID, const Identifier& accountID, const Identifier& serverID, const Nym& serverNym, const bool verifyAccount) const; bool reregister_nym(ReplyMessage& reply) const; bool save_box(const Nym& nym, Ledger& box) const; bool save_inbox(const Nym& nym, Identifier& hash, Ledger& inbox) const; bool save_nymbox(const Nym& nym, Identifier& hash, Ledger& nymbox) const; bool save_outbox(const Nym& nym, Identifier& hash, Ledger& outbox) const; bool send_message_to_nym( const Identifier& notaryID, const Identifier& senderNymID, const Identifier& recipientNymID, const Message& msg) const; bool verify_box( const Identifier& ownerID, Ledger& box, const Nym& nym, const bool full) const; bool verify_transaction(const OTTransaction* transaction, const Nym& signer) const; UserCommandProcessor( Server& server, const opentxs::api::server::Manager& manager); UserCommandProcessor() = delete; UserCommandProcessor(const UserCommandProcessor&) = delete; UserCommandProcessor(UserCommandProcessor&&) = delete; UserCommandProcessor& operator=(const UserCommandProcessor&) = delete; UserCommandProcessor& operator=(UserCommandProcessor&&) = delete; }; } // namespace server } // namespace opentxs
38.462857
80
0.710741
nopdotcom
f33777ff123a37ff9c34b4f3edf49fe5bc5fc534
1,635
cpp
C++
control/MwcLabel.cpp
velezladonna/mwc-qt-wallet
bd241b91d28350e17e52a10208e663fcb992d7cc
[ "Apache-2.0" ]
1
2020-03-19T10:02:16.000Z
2020-03-19T10:02:16.000Z
control/MwcLabel.cpp
velezladonna/mwc-qt-wallet
bd241b91d28350e17e52a10208e663fcb992d7cc
[ "Apache-2.0" ]
null
null
null
control/MwcLabel.cpp
velezladonna/mwc-qt-wallet
bd241b91d28350e17e52a10208e663fcb992d7cc
[ "Apache-2.0" ]
null
null
null
// Copyright 2019 The MWC Developers // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #include "MwcLabel.h" namespace control { MwcLabelTiny::MwcLabelTiny(QWidget *parent, Qt::WindowFlags f) : QLabel(parent,f) {} MwcLabelTiny::MwcLabelTiny(const QString &text, QWidget *parent, Qt::WindowFlags f) : QLabel(text,parent, f) {} MwcLabelTiny::~MwcLabelTiny() {} MwcLabelSmall::MwcLabelSmall(QWidget *parent, Qt::WindowFlags f) : QLabel(parent,f) {} MwcLabelSmall::MwcLabelSmall(const QString &text, QWidget *parent, Qt::WindowFlags f) : QLabel(text,parent, f) {} MwcLabelSmall::~MwcLabelSmall() {} MwcLabelNormal::MwcLabelNormal(QWidget *parent, Qt::WindowFlags f) : QLabel(parent,f) {} MwcLabelNormal::MwcLabelNormal(const QString &text, QWidget *parent, Qt::WindowFlags f) : QLabel(text,parent, f) {} MwcLabelNormal::~MwcLabelNormal() {} MwcLabelLarge::MwcLabelLarge(QWidget *parent, Qt::WindowFlags f) : QLabel(parent,f) {} MwcLabelLarge::MwcLabelLarge(const QString &text, QWidget *parent, Qt::WindowFlags f) : QLabel(text,parent, f) {} MwcLabelLarge::~MwcLabelLarge() {} }
25.546875
89
0.727217
velezladonna
f3378089971b220c12c735ba6f52957dde086632
1,545
cpp
C++
shared_model/backend/protobuf/query_responses/impl/proto_account_asset_response.cpp
akshatkarani/iroha
5acef9dd74720c6185360d951e9b11be4ef73260
[ "Apache-2.0" ]
1,467
2016-10-25T12:27:19.000Z
2022-03-28T04:32:05.000Z
shared_model/backend/protobuf/query_responses/impl/proto_account_asset_response.cpp
akshatkarani/iroha
5acef9dd74720c6185360d951e9b11be4ef73260
[ "Apache-2.0" ]
2,366
2016-10-25T10:07:57.000Z
2022-03-31T22:03:24.000Z
shared_model/backend/protobuf/query_responses/impl/proto_account_asset_response.cpp
akshatkarani/iroha
5acef9dd74720c6185360d951e9b11be4ef73260
[ "Apache-2.0" ]
662
2016-10-26T04:41:22.000Z
2022-03-31T04:15:02.000Z
/** * Copyright Soramitsu Co., Ltd. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0 */ #include "backend/protobuf/query_responses/proto_account_asset_response.hpp" namespace shared_model { namespace proto { AccountAssetResponse::AccountAssetResponse( iroha::protocol::QueryResponse &query_response) : account_asset_response_{query_response.account_assets_response()}, account_assets_{query_response.mutable_account_assets_response() ->mutable_account_assets() ->begin(), query_response.mutable_account_assets_response() ->mutable_account_assets() ->end()}, next_asset_id_{[this]() -> decltype(next_asset_id_) { if (account_asset_response_.opt_next_asset_id_case() == iroha::protocol::AccountAssetResponse::kNextAssetId) { return this->account_asset_response_.next_asset_id(); } return std::nullopt; }()} {} const interface::types::AccountAssetCollectionType AccountAssetResponse::accountAssets() const { return account_assets_; } std::optional<interface::types::AssetIdType> AccountAssetResponse::nextAssetId() const { return next_asset_id_; } size_t AccountAssetResponse::totalAccountAssetsNumber() const { return account_asset_response_.total_number(); } } // namespace proto } // namespace shared_model
35.113636
76
0.640777
akshatkarani
f339ddb5db89a64b0a37ea73ea78c32c0887d4e9
2,423
cpp
C++
src/nnfusion/core/operators/generic_op/generic_op_define/Convert.cpp
lynex/nnfusion
6332697c71b6614ca6f04c0dac8614636882630d
[ "MIT" ]
null
null
null
src/nnfusion/core/operators/generic_op/generic_op_define/Convert.cpp
lynex/nnfusion
6332697c71b6614ca6f04c0dac8614636882630d
[ "MIT" ]
null
null
null
src/nnfusion/core/operators/generic_op/generic_op_define/Convert.cpp
lynex/nnfusion
6332697c71b6614ca6f04c0dac8614636882630d
[ "MIT" ]
null
null
null
// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. #include "nnfusion/common/type/element_type.hpp" #include "nnfusion/core/operators/generic_op/generic_op.hpp" REGISTER_OP(Convert) .infershape(nnfusion::op::infershape::unimplemented_and_not_used) .translate([](std::shared_ptr<graph::GNode> gnode) -> std::string { auto op = static_pointer_cast<nnfusion::op::Convert>(gnode->get_op_ptr()); NNFUSION_CHECK_NOT_NULLPTR(op) << "Node type is not " << gnode->get_op_ptr()->get_op_type(); std::string in_dtype; bool ret = element::Type::nnfusion_element_type_to_dtype_string( gnode->get_input_element_type(0), in_dtype); NNFUSION_CHECK(ret == true) << "cast type is not supported: " << gnode->get_input_element_type(0).c_type_string(); std::string out_dtype; ret = element::Type::nnfusion_element_type_to_dtype_string(op->get_convert_element_type(), out_dtype); NNFUSION_CHECK(ret == true) << "cast type is not supported: " << op->get_convert_element_type().c_type_string(); return op::create_code_from_template( R"( - input("input0", @input_shape@, dtype="@in_dtype@"); output(@input_shape@, topi=topi.cast(args("input0"), dtype="@out_dtype@")); )", {{"input_shape", vector_to_string(gnode->get_input_shape(0))}, {"in_dtype", in_dtype}, {"out_dtype", out_dtype}}); }) .translate_v2([](std::shared_ptr<graph::GNode> gnode) -> std::string { auto op = static_pointer_cast<nnfusion::op::Convert>(gnode->get_op_ptr()); NNFUSION_CHECK_NOT_NULLPTR(op) << "Node type is not " << gnode->get_op_ptr()->get_op_type(); std::string out_dtype; bool ret = element::Type::nnfusion_element_type_to_dtype_string( op->get_convert_element_type(), out_dtype); NNFUSION_CHECK(ret == true) << "cast type is not supported: " << op->get_convert_element_type().c_type_string(); return op::create_code_from_template( "@output0@@data_layout@ = @input0@@data_layout@.cast(\"@out_dtype@\");", {{"data_layout", op::create_layout_from_dims(gnode->get_output_shape(0))}, {"out_dtype", out_dtype}}); });
52.673913
149
0.616178
lynex
f33b5eca580d7501cb35b8a0a215e6fdfc904b42
3,920
cpp
C++
week10/BattleShip/BBoardTest.cpp
WeiChienHsu/CS165
65e95efc90415c8acc707e2d544eb384d3982e18
[ "MIT" ]
1
2019-01-06T22:36:01.000Z
2019-01-06T22:36:01.000Z
week10/BattleShip/BBoardTest.cpp
WeiChienHsu/CS165
65e95efc90415c8acc707e2d544eb384d3982e18
[ "MIT" ]
null
null
null
week10/BattleShip/BBoardTest.cpp
WeiChienHsu/CS165
65e95efc90415c8acc707e2d544eb384d3982e18
[ "MIT" ]
null
null
null
#include <iostream> #include "BBoard.hpp" #include <gtest/gtest.h> namespace { class BBoardTest : public ::testing::Test { protected: Ship destroyer1; Ship destroyer2; Ship carrier1; Ship carrier2; Ship battleship1; Ship battleship2; BBoard board; BBoardTest(): destroyer1("destroyer", 2), destroyer2("destroyer", 2), carrier1("carrier", 5), carrier2("carrier", 5), battleship1("battleship", 4), battleship2("battleship", 4) { } }; TEST_F(BBoardTest, ShipPlacementRowNEdge) { EXPECT_EQ(true, board.placeShip(destroyer1, 1, 1, 'R')) << "failure to place ship in row orientation" << ", not edge of board"; EXPECT_EQ(1, board.getNumShipsRemaining()) << "Ships counted incorrectly when added to board."; EXPECT_EQ(&destroyer1, board.getShipsArrayElement(1, 1)); EXPECT_EQ(&destroyer1, board.getShipsArrayElement(1, 2)) << "failure to place ship in correct orientation"; } TEST_F(BBoardTest, ShipPlacementColNEdge) { EXPECT_EQ(true, board.placeShip(carrier1, 1, 1, 'C')) << "failure to place ship in col orientation, " << "not edge of board."; for(int i = 0; i < carrier1.getLength(); i++) { EXPECT_EQ(&carrier1, board.getShipsArrayElement(1 + i, 1)) << "failure to place ship in correct orientation, " << "not at edge of board."; } } TEST_F(BBoardTest, ShipPlacementRowEdge) { EXPECT_EQ(true, board.placeShip(destroyer1, 1, 8, 'R')) << "failure to place ship in row orientation" << ", not edge of board"; for(int i = 0; i < destroyer1.getLength(); i++) { EXPECT_EQ(&destroyer1, board.getShipsArrayElement(1, 8 + i)) << "failure to place ship in correct orientation"; } EXPECT_EQ(false, board.placeShip(destroyer1, 2, 9, 'R')) << "Placed ship out of bounds."; } TEST_F(BBoardTest, ShipPlacementColEdge) { EXPECT_EQ(true, board.placeShip(carrier1, 5, 1, 'C')) << "failure to place ship in col orientation, " << "not edge of board."; for(int i = 0; i < carrier1.getLength(); i++) { EXPECT_EQ(&carrier1, board.getShipsArrayElement(5 + i, 1)) << "failure to place ship in correct orientation, " << "not at edge of board."; } EXPECT_EQ(false, board.placeShip(carrier1, 6, 1, 'C')) << "Placed ship out of bounds."; } TEST_F(BBoardTest, ShipPlacementOverlap) { board.placeShip(battleship1, 2, 2, 'R'); for(int i = 0; i < battleship1.getLength(); i++) { EXPECT_EQ(false, board.placeShip(battleship2, 2, 2 + i, 'C')) << "Placed ship on top of another."; } } TEST_F(BBoardTest, AttackFunctional) { board.placeShip(battleship1, 2, 2, 'R'); EXPECT_EQ(1, board.getNumShipsRemaining()) << "Incorrect number ships recorded."; EXPECT_EQ(0, battleship1.getDamage()) << "Ship wasn't placed with full health."; for(int i = 0; i < battleship1.getLength(); i++) { board.attack(2, 2 + i); EXPECT_EQ(i + 1, battleship1.getDamage()) << "Not properly counting damage."; } EXPECT_EQ(0, board.getNumShipsRemaining()) << "Ship did not sink properly"; EXPECT_EQ(true, board.attack(2, 2)) << "Hitting damaged square not returning true."; EXPECT_EQ(0, board.getNumShipsRemaining()) << "Ship sunk twice."; EXPECT_EQ(false, board.attack(0, 0)) << "Attack returned true when empty square was attacked."; } }//namespace int main(int argc, char** argv) { ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); }
31.612903
72
0.577551
WeiChienHsu
f33bd8f2e7870fcafeb5e6ff5ac265d47af15f2b
21,172
cpp
C++
owl/Context.cpp
jeffamstutz/owl
fff3b9b29a01f39292f62c173f9bd8452b2fcef1
[ "Apache-2.0" ]
null
null
null
owl/Context.cpp
jeffamstutz/owl
fff3b9b29a01f39292f62c173f9bd8452b2fcef1
[ "Apache-2.0" ]
null
null
null
owl/Context.cpp
jeffamstutz/owl
fff3b9b29a01f39292f62c173f9bd8452b2fcef1
[ "Apache-2.0" ]
null
null
null
// ======================================================================== // // Copyright 2019-2021 Ingo Wald // // // // Licensed under the Apache License, Version 2.0 (the "License"); // // you may not use this file except in compliance with the License. // // You may obtain a copy of the License at // // // // http://www.apache.org/licenses/LICENSE-2.0 // // // // Unless required by applicable law or agreed to in writing, software // // distributed under the License is distributed on an "AS IS" BASIS, // // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // // See the License for the specific language governing permissions and // // limitations under the License. // // ======================================================================== // #include "Context.h" #include "Module.h" #include "Geometry.h" #include "Triangles.h" #include "UserGeom.h" #include "Texture.h" #include "TrianglesGeomGroup.h" #include "UserGeomGroup.h" #define LOG(message) \ if (Context::logging()) \ std::cout \ << OWL_TERMINAL_LIGHT_BLUE \ << "#owl: " \ << message \ << OWL_TERMINAL_DEFAULT << std::endl #define LOG_OK(message) \ if (Context::logging()) \ std::cout \ << OWL_TERMINAL_BLUE \ << "#owl: " \ << message \ << OWL_TERMINAL_DEFAULT << std::endl namespace owl { Context::Context(int32_t *requestedDeviceIDs, int numRequestedDevices) : buffers(this), textures(this), groups(this), rayGenTypes(this), rayGens(this), missProgTypes(this), missProgs(this), geomTypes(this), geoms(this), modules(this), launchParamTypes(this), launchParams(this), devices(createDeviceContexts(this, requestedDeviceIDs, numRequestedDevices)) { enablePeerAccess(); LaunchParamsType::SP emptyLPType = createLaunchParamsType(0,{}); dummyLaunchParams = createLaunchParams(emptyLPType); } Context::~Context() { devices.clear(); } void Context::enablePeerAccess() { LOG("enabling peer access ('.'=self, '+'=can access other device)"); auto &devices = getDevices(); int deviceCount = int(devices.size()); LOG("found " << deviceCount << " CUDA capable devices"); for (auto device : devices) LOG(" - device #" << device->ID << " : " << device->getDeviceName()); LOG("enabling peer access:"); for (auto device : devices) { std::stringstream ss; SetActiveGPU forLifeTime(device); ss << " - device #" << device->ID << " : "; int cuda_i = device->getCudaDeviceID(); int i = device->ID; for (int j=0;j<deviceCount;j++) { if (j == i) { ss << " ."; } else { int cuda_j = devices[j]->getCudaDeviceID(); int canAccessPeer = 0; cudaError_t rc = cudaDeviceCanAccessPeer(&canAccessPeer, cuda_i,cuda_j); if (rc != cudaSuccess) OWL_RAISE("cuda error in cudaDeviceCanAccessPeer: " +std::to_string(rc)); if (!canAccessPeer) { // huh. this can happen if you have differnt device // types (in my case, a 2070 and a rtx 8000). // nvm - yup, this isn't an error. Expect certain configs to not allow peer access. // disabling this, as it's concerning end users. // std::cerr << "cannot not enable peer access!? ... skipping..." << std::endl; continue; } rc = cudaDeviceEnablePeerAccess(cuda_j,0); if (rc != cudaSuccess) OWL_RAISE("cuda error in cudaDeviceEnablePeerAccess: " +std::to_string(rc)); ss << " +"; } } LOG(ss.str()); } } /*! creates a buffer that uses CUDA host pinned memory; that memory is pinned on the host and accessive to all devices in the device group */ Buffer::SP Context::hostPinnedBufferCreate(OWLDataType type, size_t count) { Buffer::SP buffer = std::make_shared<HostPinnedBuffer>(this,type); assert(buffer); buffer->createDeviceData(getDevices()); buffer->resize(count); return buffer; } /*! creates a buffer that uses CUDA managed memory; that memory is managed by CUDA (see CUDAs documentatoin on managed memory) and accessive to all devices in the deviec group */ Buffer::SP Context::managedMemoryBufferCreate(OWLDataType type, size_t count, const void *init) { Buffer::SP buffer = std::make_shared<ManagedMemoryBuffer>(this,type); assert(buffer); buffer->createDeviceData(getDevices()); buffer->resize(count); if (init) buffer->upload(init, 0, -1); return buffer; } Buffer::SP Context::deviceBufferCreate(OWLDataType type, size_t count, const void *init) { Buffer::SP buffer = std::make_shared<DeviceBuffer>(this,type); assert(buffer); buffer->createDeviceData(getDevices()); buffer->resize(count); if (init) buffer->upload(init, 0, -1); return buffer; } Texture::SP Context::texture2DCreate(OWLTexelFormat texelFormat, OWLTextureFilterMode filterMode, OWLTextureAddressMode addressMode, OWLTextureColorSpace colorSpace, const vec2i size, uint32_t linePitchInBytes, const void *texels) { Texture::SP texture = std::make_shared<Texture>(this,size,linePitchInBytes, texelFormat,filterMode,addressMode,colorSpace, texels); assert(texture); return texture; } Buffer::SP Context::graphicsBufferCreate(OWLDataType type, size_t count, cudaGraphicsResource_t resource) { Buffer::SP buffer = std::make_shared<GraphicsBuffer>(this, type, resource); assert(buffer); buffer->createDeviceData(getDevices()); buffer->resize(count); return buffer; } RayGen::SP Context::createRayGen(const std::shared_ptr<RayGenType> &type) { RayGen::SP rg = std::make_shared<RayGen>(this,type); rg->createDeviceData(getDevices()); return rg; } LaunchParams::SP Context::createLaunchParams(const std::shared_ptr<LaunchParamsType> &type) { LaunchParams::SP lp = std::make_shared<LaunchParams>(this,type); lp->createDeviceData(getDevices()); return lp; } MissProg::SP Context::createMissProg(const std::shared_ptr<MissProgType> &type) { MissProg::SP mp = std::make_shared<MissProg>(this,type); mp->createDeviceData(getDevices()); // for backwards compatibility: automatically set miss prog if none are set, yet if (mp->ID < numRayTypes && (mp->ID >= (int)missProgPerRayType.size() || !missProgPerRayType[mp->ID])) LOG("for backwards compatibility to pre-0.9.0 versions of OWL, " "hereby installing this miss program for ray type #" << mp->ID); setMissProg(mp->ID,mp); return mp; } /*! sets miss prog to use for a given ray type */ void Context::setMissProg(int rayTypeToSet, MissProg::SP missProgToUse) { assert(rayTypeToSet >= 0 && rayTypeToSet < numRayTypes); if ((int)missProgPerRayType.size() < numRayTypes) missProgPerRayType.resize(numRayTypes); missProgPerRayType[rayTypeToSet] = missProgToUse; } RayGenType::SP Context::createRayGenType(Module::SP module, const std::string &progName, size_t varStructSize, const std::vector<OWLVarDecl> &varDecls) { RayGenType::SP rgt = std::make_shared<RayGenType>(this, module,progName, varStructSize, varDecls); rgt->createDeviceData(getDevices()); return rgt; } LaunchParamsType::SP Context::createLaunchParamsType(size_t varStructSize, const std::vector<OWLVarDecl> &varDecls) { LaunchParamsType::SP lpt = std::make_shared<LaunchParamsType>(this, varStructSize, varDecls); lpt->createDeviceData(getDevices()); return lpt; } MissProgType::SP Context::createMissProgType(Module::SP module, const std::string &progName, size_t varStructSize, const std::vector<OWLVarDecl> &varDecls) { MissProgType::SP mpt = std::make_shared<MissProgType>(this, module,progName, varStructSize, varDecls); mpt->createDeviceData(getDevices()); return mpt; } GeomGroup::SP Context::trianglesGeomGroupCreate(size_t numChildren) { GeomGroup::SP gg = std::make_shared<TrianglesGeomGroup>(this,numChildren); gg->createDeviceData(getDevices()); return gg; } GeomGroup::SP Context::userGeomGroupCreate(size_t numChildren) { GeomGroup::SP gg = std::make_shared<UserGeomGroup>(this,numChildren); gg->createDeviceData(getDevices()); return gg; } GeomType::SP Context::createGeomType(OWLGeomKind kind, size_t varStructSize, const std::vector<OWLVarDecl> &varDecls) { GeomType::SP gt; switch(kind) { case OWL_GEOMETRY_TRIANGLES: gt = std::make_shared<TrianglesGeomType>(this,varStructSize,varDecls); break; case OWL_GEOMETRY_USER: gt = std::make_shared<UserGeomType>(this,varStructSize,varDecls); break; default: OWL_NOTIMPLEMENTED; } gt->createDeviceData(getDevices()); return gt; } Module::SP Context::createModule(const std::string &ptxCode) { Module::SP module = std::make_shared<Module>(this,ptxCode); assert(module); module->createDeviceData(getDevices()); return module; } std::shared_ptr<Geom> UserGeomType::createGeom() { GeomType::SP self = std::dynamic_pointer_cast<GeomType>(shared_from_this()); Geom::SP geom = std::make_shared<UserGeom>(context,self); geom->createDeviceData(context->getDevices()); return geom; } std::shared_ptr<Geom> TrianglesGeomType::createGeom() { GeomType::SP self = std::dynamic_pointer_cast<GeomType>(shared_from_this()); Geom::SP geom = std::make_shared<TrianglesGeom>(context,self); geom->createDeviceData(context->getDevices()); return geom; } void Context::buildHitGroupRecordsOn(const DeviceContext::SP &device) { LOG("building SBT hit group records"); SetActiveGPU forLifeTime(device); if (device->sbt.hitGroupRecordsBuffer.alloced()) device->sbt.hitGroupRecordsBuffer.free(); size_t maxHitProgDataSize = 0; for (size_t i=0;i<geoms.size();i++) { Geom *geom = (Geom *)geoms.getPtr(i); if (!geom) continue; assert(geom->geomType); maxHitProgDataSize = std::max(maxHitProgDataSize,geom->geomType->varStructSize); } size_t numHitGroupEntries = sbtRangeAllocator.maxAllocedID; // always add 1 so we always have a hit group array, even for // programs that didn't create any Groups (yet?) size_t numHitGroupRecords = numHitGroupEntries*numRayTypes + 1; size_t hitGroupRecordSize = OPTIX_SBT_RECORD_HEADER_SIZE + smallestMultipleOf<OPTIX_SBT_RECORD_ALIGNMENT>(maxHitProgDataSize); assert((OPTIX_SBT_RECORD_HEADER_SIZE % OPTIX_SBT_RECORD_ALIGNMENT) == 0); device->sbt.hitGroupRecordSize = hitGroupRecordSize; device->sbt.hitGroupRecordCount = numHitGroupRecords; size_t totalHitGroupRecordsArraySize = numHitGroupRecords * hitGroupRecordSize; std::vector<uint8_t> hitGroupRecords(totalHitGroupRecordsArraySize); // ------------------------------------------------------------------ // now, write all records (only on the host so far): we need to // write one record per geometry, per ray type // ------------------------------------------------------------------ for (size_t groupID=0;groupID<groups.size();groupID++) { Group *group = groups.getPtr(groupID); if (!group) continue; GeomGroup *gg = dynamic_cast<GeomGroup *>(group); if (!gg) continue; const size_t sbtOffset = gg->sbtOffset; for (size_t childID=0;childID<gg->geometries.size();childID++) { Geom::SP geom = gg->geometries[childID]; if (!geom) continue; // const int geomID = geom->ID; for (int rayTypeID=0;rayTypeID<numRayTypes;rayTypeID++) { // ------------------------------------------------------------------ // compute pointer to entire record: // ------------------------------------------------------------------ const size_t recordID = (sbtOffset+childID)*numRayTypes + rayTypeID; assert(recordID < numHitGroupRecords); uint8_t *const sbtRecord = hitGroupRecords.data() + recordID*hitGroupRecordSize; // let the geometry write itself: geom->writeSBTRecord(sbtRecord,device,rayTypeID); } } } device->sbt.hitGroupRecordsBuffer.alloc(hitGroupRecords.size()); device->sbt.hitGroupRecordsBuffer.upload(hitGroupRecords); LOG_OK("done building (and uploading) SBT hit group records"); } void Context::buildMissProgRecordsOn(const DeviceContext::SP &device) { LOG("building SBT miss group records"); SetActiveGPU forLifeTime(device); size_t numMissProgRecords = numRayTypes; if ((int)missProgPerRayType.size() < numRayTypes) missProgPerRayType.resize(numRayTypes); size_t maxMissProgDataSize = 0; for (int i=0;i<(int)missProgPerRayType.size();i++) { MissProg::SP missProg = missProgPerRayType[i]; if (!missProg) continue; assert(missProg->type); maxMissProgDataSize = std::max(maxMissProgDataSize,missProg->type->varStructSize); } size_t missProgRecordSize = OPTIX_SBT_RECORD_HEADER_SIZE + smallestMultipleOf<OPTIX_SBT_RECORD_ALIGNMENT>(maxMissProgDataSize); assert((OPTIX_SBT_RECORD_HEADER_SIZE % OPTIX_SBT_RECORD_ALIGNMENT) == 0); device->sbt.missProgRecordSize = missProgRecordSize; device->sbt.missProgRecordCount = numMissProgRecords; size_t totalMissProgRecordsArraySize = numMissProgRecords * missProgRecordSize; std::vector<uint8_t> missProgRecords(totalMissProgRecordsArraySize); // ------------------------------------------------------------------ // now, write all records (only on the host so far): we need to // write one record per geometry, per ray type // ------------------------------------------------------------------ for (size_t recordID=0;recordID<numMissProgRecords;recordID++) { MissProg::SP miss = missProgPerRayType[recordID]; if (!miss) continue; uint8_t *const sbtRecord = missProgRecords.data() + recordID*missProgRecordSize; miss->writeSBTRecord(sbtRecord,device); } device->sbt.missProgRecordsBuffer.alloc(missProgRecords.size()); device->sbt.missProgRecordsBuffer.upload(missProgRecords); LOG_OK("done building (and uploading) SBT miss group records"); } void Context::buildRayGenRecordsOn(const DeviceContext::SP &device) { LOG("building SBT rayGen prog records"); SetActiveGPU forLifeTime(device); for (size_t rgID=0;rgID<rayGens.size();rgID++) { auto rg = rayGens.getPtr(rgID); assert(rg); auto &dd = rg->getDD(device); std::vector<uint8_t> hostMem(dd.rayGenRecordSize); rg->writeSBTRecord(hostMem.data(),device); dd.sbtRecordBuffer.upload(hostMem); } } void Context::buildSBT(OWLBuildSBTFlags flags) { if (flags & OWL_SBT_HITGROUPS) for (auto device : getDevices()) buildHitGroupRecordsOn(device); // ----------- build miss prog(s) ----------- if (flags & OWL_SBT_MISSPROGS) for (auto device : getDevices()) buildMissProgRecordsOn(device); // ----------- build raygens ----------- if (flags & OWL_SBT_RAYGENS) for (auto device : getDevices()) buildRayGenRecordsOn(device); } void Context::buildPipeline() { for (auto device : getDevices()) { device->destroyPipeline(); device->buildPipeline(); } } void Context::buildModules(bool debug) { destroyModules(); for (auto device : getDevices()) { device->configurePipelineOptions(debug); for (int moduleID=0;moduleID<(int)modules.size();moduleID++) { Module *module = modules.getPtr(moduleID); if (!module) continue; module->getDD(device).build(); } } } void Context::setRayTypeCount(size_t rayTypeCount) { /* TODO; sanity checking that this is a useful value, and that no geoms etc are created yet */ this->numRayTypes = int(rayTypeCount); } void Context::setBoundLaunchParamValues(const std::vector<OWLBoundValueDecl> &boundValues) { #if OPTIX_VERSION >= 70200 this->boundLaunchParamValues.clear(); this->boundLaunchParamValues.reserve(boundValues.size()); for (const OWLBoundValueDecl &v : boundValues) { this->boundLaunchParamValues.push_back( { v.var.offset, sizeOf(v.var.type), v.boundValuePtr }); } #else LOG("Ignoring bound launch params for old version of OptiX"); #endif } /*! sets maximum instancing depth for the given context: '0' means 'no instancing allowed, only bottom-level accels; '1' means 'at most one layer of instances' (ie, a two-level scene), where the 'root' world rays are traced against can be an instance group, but every child in that inscne group is a geometry group. 'N>1" means "up to N layers of instances are allowed. The default instancing depth is 1 (ie, a two-level scene), since this allows for most use cases of instancing and is still hardware-accelerated. Using a node graph with instancing deeper than the configured value will result in wrong results; but be aware that using any value > 1 here will come with a cost. It is recommended to, if at all possible, leave this value to one and convert the input scene to a two-level scene layout (ie, with only one level of instances) */ void Context::setMaxInstancingDepth(int32_t maxInstanceDepth) { this->maxInstancingDepth = maxInstanceDepth; if (maxInstancingDepth < 1) OWL_RAISE ("a instancing depth of < 1 isnt' currently supported in OWL; " "please see comments on owlSetMaxInstancingDepth() (owl/owl_host.h)"); for (auto device : getDevices()) { assert("check pipeline isn't already created" && device->pipeline == nullptr); device->configurePipelineOptions(); } } void Context::enableMotionBlur() { motionBlurEnabled = true; } void Context::setNumAttributeValues(size_t numAttributeValues) { for (auto device : getDevices()) { assert("check programs have not been built" && device->allActivePrograms.empty()); } this->numAttributeValues = (int)numAttributeValues; } void Context::buildPrograms(bool debug) { buildModules(debug); for (auto device : getDevices()) { SetActiveGPU forLifeTime(device); device->buildPrograms(); } } void Context::destroyModules() { for (size_t moduleID=0;moduleID<modules.size();moduleID++) { Module *module = modules.getPtr(moduleID); if (module) for (auto device : getDevices()) module->getDD(device).destroy(); } } void Context::destroyPrograms() { for (auto device : getDevices()) device->destroyPrograms(); } } // ::owl
34.093398
95
0.584026
jeffamstutz
f33c035eff045f8263df44781692910ca022c268
2,095
cpp
C++
src/util/helpers.cpp
darksworm/imgsel-x11
5271301932de3af9fd3e2312e89e8e145db86949
[ "MIT" ]
null
null
null
src/util/helpers.cpp
darksworm/imgsel-x11
5271301932de3af9fd3e2312e89e8e145db86949
[ "MIT" ]
null
null
null
src/util/helpers.cpp
darksworm/imgsel-x11
5271301932de3af9fd3e2312e89e8e145db86949
[ "MIT" ]
null
null
null
#include "helpers.h" #include <unistd.h> #include <pwd.h> #include <iostream> void drawText(WindowManager *windowManager, const std::string &text, Dimensions position) { XClearArea( windowManager->getDisplay(), windowManager->getWindow(), position.x - 10, position.y - 10, 320, 60, false ); auto display = windowManager->getDisplay(); auto window = windowManager->getWindow(); int screen_num = DefaultScreen(display); GC gc = XCreateGC(display, window, 0, nullptr); XSetForeground(display, gc, WhitePixel(display, screen_num)); XSetBackground(display, gc, BlackPixel(display, screen_num)); XDrawString( windowManager->getDisplay(), windowManager->getWindow(), gc, (int) position.x, (int) position.y, text.c_str(), (int) text.length() ); XFreeGC(display, gc); } void drawCenteredText(WindowManager *windowManager, const std::string &text, Dimensions position) { auto display = windowManager->getDisplay(); auto window = windowManager->getWindow(); int screen_num = DefaultScreen(display); GC gc = XCreateGC(display, window, 0, nullptr); const char * fontname = "-*-fixed-*-r-*-*-20-*-*-*-*-*-*-*"; auto font = XLoadQueryFont (display, fontname); if(!font) { font = XLoadQueryFont(display, "fixed"); } XSetFont(display, gc, font->fid); XSetForeground(display, gc, WhitePixel(display, screen_num)); XSetBackground(display, gc, BlackPixel(display, screen_num)); auto textWidth = XTextWidth(font, text.c_str(), text.length()); XDrawString( windowManager->getDisplay(), windowManager->getWindow(), gc, (int) position.x - (textWidth / 2), (int) position.y, text.c_str(), (int) text.length() ); XFreeGC(display, gc); } std::string getHomeDir() { std::string homedir = getpwuid(getuid())->pw_dir; return homedir; }
26.858974
99
0.596659
darksworm
f33f888a0be3caa0fcc9651244a677fa1edfe367
424,079
cpp
C++
Acceleration/memcached/hls/memcachedPipeline_prj/solution1/syn/systemc/response_r.cpp
pratik0509/HLSx_Xilinx_edit
14bdbcdb3107aa225e46a0bfe7d4a2a426e9e1ca
[ "BSD-3-Clause" ]
null
null
null
Acceleration/memcached/hls/memcachedPipeline_prj/solution1/syn/systemc/response_r.cpp
pratik0509/HLSx_Xilinx_edit
14bdbcdb3107aa225e46a0bfe7d4a2a426e9e1ca
[ "BSD-3-Clause" ]
null
null
null
Acceleration/memcached/hls/memcachedPipeline_prj/solution1/syn/systemc/response_r.cpp
pratik0509/HLSx_Xilinx_edit
14bdbcdb3107aa225e46a0bfe7d4a2a426e9e1ca
[ "BSD-3-Clause" ]
1
2018-11-13T17:59:49.000Z
2018-11-13T17:59:49.000Z
// ============================================================== // RTL generated by Vivado(TM) HLS - High-Level Synthesis from C, C++ and SystemC // Version: 2018.2 // Copyright (C) 1986-2018 Xilinx, Inc. All Rights Reserved. // // =========================================================== #include "response_r.h" #include "AESL_pkg.h" using namespace std; namespace ap_rtl { const sc_logic response_r::ap_const_logic_1 = sc_dt::Log_1; const sc_logic response_r::ap_const_logic_0 = sc_dt::Log_0; const sc_lv<1> response_r::ap_ST_iter0_fsm_state1 = "1"; const sc_lv<2> response_r::ap_ST_iter1_fsm_state2 = "10"; const sc_lv<2> response_r::ap_ST_iter2_fsm_state3 = "10"; const sc_lv<2> response_r::ap_ST_iter1_fsm_state0 = "1"; const sc_lv<2> response_r::ap_ST_iter2_fsm_state0 = "1"; const sc_lv<32> response_r::ap_const_lv32_0 = "00000000000000000000000000000000"; const bool response_r::ap_const_boolean_1 = true; const sc_lv<1> response_r::ap_const_lv1_0 = "0"; const sc_lv<1> response_r::ap_const_lv1_1 = "1"; const sc_lv<32> response_r::ap_const_lv32_1 = "1"; const sc_lv<2> response_r::ap_const_lv2_0 = "00"; const sc_lv<2> response_r::ap_const_lv2_2 = "10"; const sc_lv<2> response_r::ap_const_lv2_3 = "11"; const sc_lv<2> response_r::ap_const_lv2_1 = "1"; const sc_lv<5> response_r::ap_const_lv5_0 = "00000"; const sc_lv<8> response_r::ap_const_lv8_0 = "00000000"; const sc_lv<248> response_r::ap_const_lv248_lc_1 = "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"; const sc_lv<16> response_r::ap_const_lv16_0 = "0000000000000000"; const sc_lv<64> response_r::ap_const_lv64_0 = "0000000000000000000000000000000000000000000000000000000000000000"; const sc_lv<8> response_r::ap_const_lv8_FF = "11111111"; const sc_lv<5> response_r::ap_const_lv5_6 = "110"; const sc_lv<5> response_r::ap_const_lv5_5 = "101"; const sc_lv<5> response_r::ap_const_lv5_4 = "100"; const sc_lv<5> response_r::ap_const_lv5_7 = "111"; const sc_lv<5> response_r::ap_const_lv5_3 = "11"; const sc_lv<5> response_r::ap_const_lv5_2 = "10"; const sc_lv<5> response_r::ap_const_lv5_1 = "1"; const sc_lv<64> response_r::ap_const_lv64_313020524F525245 = "11000100110000001000000101001001001111010100100101001001000101"; const sc_lv<112> response_r::ap_const_lv112_0 = "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"; const sc_lv<16> response_r::ap_const_lv16_5 = "101"; const sc_lv<8> response_r::ap_const_lv8_1 = "1"; const sc_lv<8> response_r::ap_const_lv8_4 = "100"; const sc_lv<32> response_r::ap_const_lv32_20 = "100000"; const sc_lv<32> response_r::ap_const_lv32_3F = "111111"; const sc_lv<4> response_r::ap_const_lv4_0 = "0000"; const sc_lv<4> response_r::ap_const_lv4_1 = "1"; const sc_lv<4> response_r::ap_const_lv4_2 = "10"; const sc_lv<4> response_r::ap_const_lv4_3 = "11"; const sc_lv<4> response_r::ap_const_lv4_4 = "100"; const sc_lv<4> response_r::ap_const_lv4_5 = "101"; const sc_lv<4> response_r::ap_const_lv4_6 = "110"; const sc_lv<4> response_r::ap_const_lv4_7 = "111"; const sc_lv<16> response_r::ap_const_lv16_4 = "100"; const sc_lv<8> response_r::ap_const_lv8_3 = "11"; const sc_lv<8> response_r::ap_const_lv8_7 = "111"; const sc_lv<8> response_r::ap_const_lv8_F = "1111"; const sc_lv<8> response_r::ap_const_lv8_1F = "11111"; const sc_lv<8> response_r::ap_const_lv8_3F = "111111"; const sc_lv<8> response_r::ap_const_lv8_7F = "1111111"; const sc_lv<16> response_r::ap_const_lv16_8 = "1000"; const sc_lv<16> response_r::ap_const_lv16_FFF8 = "1111111111111000"; const sc_lv<16> response_r::ap_const_lv16_FFFC = "1111111111111100"; const sc_lv<8> response_r::ap_const_lv8_8 = "1000"; const sc_lv<32> response_r::ap_const_lv32_8000000 = "1000000000000000000000000000"; const sc_lv<32> response_r::ap_const_lv32_4 = "100"; const sc_lv<32> response_r::ap_const_lv32_18 = "11000"; const sc_lv<32> response_r::ap_const_lv32_1F = "11111"; const sc_lv<32> response_r::ap_const_lv32_10 = "10000"; const sc_lv<32> response_r::ap_const_lv32_17 = "10111"; const sc_lv<32> response_r::ap_const_lv32_8 = "1000"; const sc_lv<32> response_r::ap_const_lv32_F = "1111"; const sc_lv<32> response_r::ap_const_lv32_27 = "100111"; const sc_lv<32> response_r::ap_const_lv32_FFFFFFF8 = "11111111111111111111111111111000"; const sc_lv<32> response_r::ap_const_lv32_7C = "1111100"; const sc_lv<32> response_r::ap_const_lv32_DB = "11011011"; const sc_lv<32> response_r::ap_const_lv32_68 = "1101000"; const sc_lv<32> response_r::ap_const_lv32_6F = "1101111"; const sc_lv<32> response_r::ap_const_lv32_70 = "1110000"; const sc_lv<32> response_r::ap_const_lv32_77 = "1110111"; const sc_lv<16> response_r::ap_const_lv16_14 = "10100"; const sc_lv<16> response_r::ap_const_lv16_20 = "100000"; const sc_lv<16> response_r::ap_const_lv16_18 = "11000"; const sc_lv<3> response_r::ap_const_lv3_0 = "000"; const sc_lv<6> response_r::ap_const_lv6_3F = "111111"; const sc_lv<6> response_r::ap_const_lv6_1F = "11111"; const sc_lv<32> response_r::ap_const_lv32_5 = "101"; const sc_lv<7> response_r::ap_const_lv7_20 = "100000"; const sc_lv<7> response_r::ap_const_lv7_60 = "1100000"; const sc_lv<7> response_r::ap_const_lv7_3F = "111111"; const sc_lv<64> response_r::ap_const_lv64_FFFFFFFFFFFFFFFF = "1111111111111111111111111111111111111111111111111111111111111111"; const sc_lv<48> response_r::ap_const_lv48_0 = "000000000000000000000000000000000000000000000000"; const sc_lv<8> response_r::ap_const_lv8_81 = "10000001"; const sc_lv<48> response_r::ap_const_lv48_40000 = "1000000000000000000"; const sc_lv<32> response_r::ap_const_lv32_38 = "111000"; const bool response_r::ap_const_boolean_0 = false; const sc_lv<96> response_r::ap_const_lv96_0 = "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"; response_r::response_r(sc_module_name name) : sc_module(name), mVcdFile(0) { memcachedPipelinebkb_U100 = new memcachedPipelinebkb<1,1,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8>("memcachedPipelinebkb_U100"); memcachedPipelinebkb_U100->din0(ap_var_for_const0); memcachedPipelinebkb_U100->din1(ap_var_for_const1); memcachedPipelinebkb_U100->din2(ap_var_for_const2); memcachedPipelinebkb_U100->din3(ap_var_for_const3); memcachedPipelinebkb_U100->din4(ap_var_for_const4); memcachedPipelinebkb_U100->din5(ap_var_for_const5); memcachedPipelinebkb_U100->din6(ap_var_for_const6); memcachedPipelinebkb_U100->din7(ap_var_for_const7); memcachedPipelinebkb_U100->din8(ap_var_for_const0); memcachedPipelinebkb_U100->din9(ap_var_for_const0); memcachedPipelinebkb_U100->din10(ap_var_for_const0); memcachedPipelinebkb_U100->din11(ap_var_for_const0); memcachedPipelinebkb_U100->din12(ap_var_for_const0); memcachedPipelinebkb_U100->din13(ap_var_for_const0); memcachedPipelinebkb_U100->din14(ap_var_for_const0); memcachedPipelinebkb_U100->din15(ap_var_for_const0); memcachedPipelinebkb_U100->din16(ap_var_for_const0); memcachedPipelinebkb_U100->din17(ap_var_for_const0); memcachedPipelinebkb_U100->din18(ap_var_for_const0); memcachedPipelinebkb_U100->din19(ap_var_for_const0); memcachedPipelinebkb_U100->din20(ap_var_for_const0); memcachedPipelinebkb_U100->din21(ap_var_for_const0); memcachedPipelinebkb_U100->din22(ap_var_for_const0); memcachedPipelinebkb_U100->din23(ap_var_for_const0); memcachedPipelinebkb_U100->din24(ap_var_for_const0); memcachedPipelinebkb_U100->din25(ap_var_for_const0); memcachedPipelinebkb_U100->din26(ap_var_for_const0); memcachedPipelinebkb_U100->din27(ap_var_for_const0); memcachedPipelinebkb_U100->din28(ap_var_for_const0); memcachedPipelinebkb_U100->din29(ap_var_for_const0); memcachedPipelinebkb_U100->din30(ap_var_for_const0); memcachedPipelinebkb_U100->din31(ap_var_for_const0); memcachedPipelinebkb_U100->din32(ap_var_for_const0); memcachedPipelinebkb_U100->din33(ap_var_for_const0); memcachedPipelinebkb_U100->din34(ap_var_for_const0); memcachedPipelinebkb_U100->din35(ap_var_for_const0); memcachedPipelinebkb_U100->din36(ap_var_for_const0); memcachedPipelinebkb_U100->din37(ap_var_for_const0); memcachedPipelinebkb_U100->din38(ap_var_for_const0); memcachedPipelinebkb_U100->din39(ap_var_for_const0); memcachedPipelinebkb_U100->din40(ap_var_for_const0); memcachedPipelinebkb_U100->din41(ap_var_for_const0); memcachedPipelinebkb_U100->din42(ap_var_for_const0); memcachedPipelinebkb_U100->din43(ap_var_for_const0); memcachedPipelinebkb_U100->din44(ap_var_for_const0); memcachedPipelinebkb_U100->din45(ap_var_for_const0); memcachedPipelinebkb_U100->din46(ap_var_for_const0); memcachedPipelinebkb_U100->din47(ap_var_for_const0); memcachedPipelinebkb_U100->din48(ap_var_for_const0); memcachedPipelinebkb_U100->din49(ap_var_for_const0); memcachedPipelinebkb_U100->din50(ap_var_for_const0); memcachedPipelinebkb_U100->din51(ap_var_for_const0); memcachedPipelinebkb_U100->din52(ap_var_for_const0); memcachedPipelinebkb_U100->din53(ap_var_for_const0); memcachedPipelinebkb_U100->din54(ap_var_for_const0); memcachedPipelinebkb_U100->din55(ap_var_for_const0); memcachedPipelinebkb_U100->din56(ap_var_for_const0); memcachedPipelinebkb_U100->din57(ap_var_for_const0); memcachedPipelinebkb_U100->din58(ap_var_for_const0); memcachedPipelinebkb_U100->din59(ap_var_for_const0); memcachedPipelinebkb_U100->din60(ap_var_for_const0); memcachedPipelinebkb_U100->din61(ap_var_for_const0); memcachedPipelinebkb_U100->din62(ap_var_for_const0); memcachedPipelinebkb_U100->din63(ap_var_for_const0); memcachedPipelinebkb_U100->din64(ap_var_for_const0); memcachedPipelinebkb_U100->din65(ap_var_for_const0); memcachedPipelinebkb_U100->din66(ap_var_for_const0); memcachedPipelinebkb_U100->din67(ap_var_for_const0); memcachedPipelinebkb_U100->din68(ap_var_for_const0); memcachedPipelinebkb_U100->din69(ap_var_for_const0); memcachedPipelinebkb_U100->din70(ap_var_for_const0); memcachedPipelinebkb_U100->din71(ap_var_for_const0); memcachedPipelinebkb_U100->din72(ap_var_for_const0); memcachedPipelinebkb_U100->din73(ap_var_for_const0); memcachedPipelinebkb_U100->din74(ap_var_for_const0); memcachedPipelinebkb_U100->din75(ap_var_for_const0); memcachedPipelinebkb_U100->din76(ap_var_for_const0); memcachedPipelinebkb_U100->din77(ap_var_for_const0); memcachedPipelinebkb_U100->din78(ap_var_for_const0); memcachedPipelinebkb_U100->din79(ap_var_for_const0); memcachedPipelinebkb_U100->din80(ap_var_for_const0); memcachedPipelinebkb_U100->din81(ap_var_for_const0); memcachedPipelinebkb_U100->din82(ap_var_for_const0); memcachedPipelinebkb_U100->din83(ap_var_for_const0); memcachedPipelinebkb_U100->din84(ap_var_for_const0); memcachedPipelinebkb_U100->din85(ap_var_for_const0); memcachedPipelinebkb_U100->din86(ap_var_for_const0); memcachedPipelinebkb_U100->din87(ap_var_for_const0); memcachedPipelinebkb_U100->din88(ap_var_for_const0); memcachedPipelinebkb_U100->din89(ap_var_for_const0); memcachedPipelinebkb_U100->din90(ap_var_for_const0); memcachedPipelinebkb_U100->din91(ap_var_for_const0); memcachedPipelinebkb_U100->din92(ap_var_for_const0); memcachedPipelinebkb_U100->din93(ap_var_for_const0); memcachedPipelinebkb_U100->din94(ap_var_for_const0); memcachedPipelinebkb_U100->din95(ap_var_for_const0); memcachedPipelinebkb_U100->din96(ap_var_for_const0); memcachedPipelinebkb_U100->din97(ap_var_for_const0); memcachedPipelinebkb_U100->din98(ap_var_for_const0); memcachedPipelinebkb_U100->din99(ap_var_for_const0); memcachedPipelinebkb_U100->din100(ap_var_for_const0); memcachedPipelinebkb_U100->din101(ap_var_for_const0); memcachedPipelinebkb_U100->din102(ap_var_for_const0); memcachedPipelinebkb_U100->din103(ap_var_for_const0); memcachedPipelinebkb_U100->din104(ap_var_for_const0); memcachedPipelinebkb_U100->din105(ap_var_for_const0); memcachedPipelinebkb_U100->din106(ap_var_for_const0); memcachedPipelinebkb_U100->din107(ap_var_for_const0); memcachedPipelinebkb_U100->din108(ap_var_for_const0); memcachedPipelinebkb_U100->din109(ap_var_for_const0); memcachedPipelinebkb_U100->din110(ap_var_for_const0); memcachedPipelinebkb_U100->din111(ap_var_for_const0); memcachedPipelinebkb_U100->din112(ap_var_for_const0); memcachedPipelinebkb_U100->din113(ap_var_for_const0); memcachedPipelinebkb_U100->din114(ap_var_for_const0); memcachedPipelinebkb_U100->din115(ap_var_for_const0); memcachedPipelinebkb_U100->din116(ap_var_for_const0); memcachedPipelinebkb_U100->din117(ap_var_for_const0); memcachedPipelinebkb_U100->din118(ap_var_for_const0); memcachedPipelinebkb_U100->din119(ap_var_for_const0); memcachedPipelinebkb_U100->din120(ap_var_for_const0); memcachedPipelinebkb_U100->din121(ap_var_for_const0); memcachedPipelinebkb_U100->din122(ap_var_for_const0); memcachedPipelinebkb_U100->din123(ap_var_for_const0); memcachedPipelinebkb_U100->din124(ap_var_for_const0); memcachedPipelinebkb_U100->din125(ap_var_for_const0); memcachedPipelinebkb_U100->din126(ap_var_for_const0); memcachedPipelinebkb_U100->din127(ap_var_for_const0); memcachedPipelinebkb_U100->din128(ap_var_for_const0); memcachedPipelinebkb_U100->din129(ap_var_for_const0); memcachedPipelinebkb_U100->din130(ap_var_for_const0); memcachedPipelinebkb_U100->din131(ap_var_for_const0); memcachedPipelinebkb_U100->din132(ap_var_for_const0); memcachedPipelinebkb_U100->din133(ap_var_for_const0); memcachedPipelinebkb_U100->din134(ap_var_for_const0); memcachedPipelinebkb_U100->din135(ap_var_for_const0); memcachedPipelinebkb_U100->din136(ap_var_for_const0); memcachedPipelinebkb_U100->din137(ap_var_for_const0); memcachedPipelinebkb_U100->din138(ap_var_for_const0); memcachedPipelinebkb_U100->din139(ap_var_for_const0); memcachedPipelinebkb_U100->din140(ap_var_for_const0); memcachedPipelinebkb_U100->din141(ap_var_for_const0); memcachedPipelinebkb_U100->din142(ap_var_for_const0); memcachedPipelinebkb_U100->din143(ap_var_for_const0); memcachedPipelinebkb_U100->din144(ap_var_for_const0); memcachedPipelinebkb_U100->din145(ap_var_for_const0); memcachedPipelinebkb_U100->din146(ap_var_for_const0); memcachedPipelinebkb_U100->din147(ap_var_for_const0); memcachedPipelinebkb_U100->din148(ap_var_for_const0); memcachedPipelinebkb_U100->din149(ap_var_for_const0); memcachedPipelinebkb_U100->din150(ap_var_for_const0); memcachedPipelinebkb_U100->din151(ap_var_for_const0); memcachedPipelinebkb_U100->din152(ap_var_for_const0); memcachedPipelinebkb_U100->din153(ap_var_for_const0); memcachedPipelinebkb_U100->din154(ap_var_for_const0); memcachedPipelinebkb_U100->din155(ap_var_for_const0); memcachedPipelinebkb_U100->din156(ap_var_for_const0); memcachedPipelinebkb_U100->din157(ap_var_for_const0); memcachedPipelinebkb_U100->din158(ap_var_for_const0); memcachedPipelinebkb_U100->din159(ap_var_for_const0); memcachedPipelinebkb_U100->din160(ap_var_for_const0); memcachedPipelinebkb_U100->din161(ap_var_for_const0); memcachedPipelinebkb_U100->din162(ap_var_for_const0); memcachedPipelinebkb_U100->din163(ap_var_for_const0); memcachedPipelinebkb_U100->din164(ap_var_for_const0); memcachedPipelinebkb_U100->din165(ap_var_for_const0); memcachedPipelinebkb_U100->din166(ap_var_for_const0); memcachedPipelinebkb_U100->din167(ap_var_for_const0); memcachedPipelinebkb_U100->din168(ap_var_for_const0); memcachedPipelinebkb_U100->din169(ap_var_for_const0); memcachedPipelinebkb_U100->din170(ap_var_for_const0); memcachedPipelinebkb_U100->din171(ap_var_for_const0); memcachedPipelinebkb_U100->din172(ap_var_for_const0); memcachedPipelinebkb_U100->din173(ap_var_for_const0); memcachedPipelinebkb_U100->din174(ap_var_for_const0); memcachedPipelinebkb_U100->din175(ap_var_for_const0); memcachedPipelinebkb_U100->din176(ap_var_for_const0); memcachedPipelinebkb_U100->din177(ap_var_for_const0); memcachedPipelinebkb_U100->din178(ap_var_for_const0); memcachedPipelinebkb_U100->din179(ap_var_for_const0); memcachedPipelinebkb_U100->din180(ap_var_for_const0); memcachedPipelinebkb_U100->din181(ap_var_for_const0); memcachedPipelinebkb_U100->din182(ap_var_for_const0); memcachedPipelinebkb_U100->din183(ap_var_for_const0); memcachedPipelinebkb_U100->din184(ap_var_for_const0); memcachedPipelinebkb_U100->din185(ap_var_for_const0); memcachedPipelinebkb_U100->din186(ap_var_for_const0); memcachedPipelinebkb_U100->din187(ap_var_for_const0); memcachedPipelinebkb_U100->din188(ap_var_for_const0); memcachedPipelinebkb_U100->din189(ap_var_for_const0); memcachedPipelinebkb_U100->din190(ap_var_for_const0); memcachedPipelinebkb_U100->din191(ap_var_for_const0); memcachedPipelinebkb_U100->din192(ap_var_for_const0); memcachedPipelinebkb_U100->din193(ap_var_for_const0); memcachedPipelinebkb_U100->din194(ap_var_for_const0); memcachedPipelinebkb_U100->din195(ap_var_for_const0); memcachedPipelinebkb_U100->din196(ap_var_for_const0); memcachedPipelinebkb_U100->din197(ap_var_for_const0); memcachedPipelinebkb_U100->din198(ap_var_for_const0); memcachedPipelinebkb_U100->din199(ap_var_for_const0); memcachedPipelinebkb_U100->din200(ap_var_for_const0); memcachedPipelinebkb_U100->din201(ap_var_for_const0); memcachedPipelinebkb_U100->din202(ap_var_for_const0); memcachedPipelinebkb_U100->din203(ap_var_for_const0); memcachedPipelinebkb_U100->din204(ap_var_for_const0); memcachedPipelinebkb_U100->din205(ap_var_for_const0); memcachedPipelinebkb_U100->din206(ap_var_for_const0); memcachedPipelinebkb_U100->din207(ap_var_for_const0); memcachedPipelinebkb_U100->din208(ap_var_for_const0); memcachedPipelinebkb_U100->din209(ap_var_for_const0); memcachedPipelinebkb_U100->din210(ap_var_for_const0); memcachedPipelinebkb_U100->din211(ap_var_for_const0); memcachedPipelinebkb_U100->din212(ap_var_for_const0); memcachedPipelinebkb_U100->din213(ap_var_for_const0); memcachedPipelinebkb_U100->din214(ap_var_for_const0); memcachedPipelinebkb_U100->din215(ap_var_for_const0); memcachedPipelinebkb_U100->din216(ap_var_for_const0); memcachedPipelinebkb_U100->din217(ap_var_for_const0); memcachedPipelinebkb_U100->din218(ap_var_for_const0); memcachedPipelinebkb_U100->din219(ap_var_for_const0); memcachedPipelinebkb_U100->din220(ap_var_for_const0); memcachedPipelinebkb_U100->din221(ap_var_for_const0); memcachedPipelinebkb_U100->din222(ap_var_for_const0); memcachedPipelinebkb_U100->din223(ap_var_for_const0); memcachedPipelinebkb_U100->din224(ap_var_for_const0); memcachedPipelinebkb_U100->din225(ap_var_for_const0); memcachedPipelinebkb_U100->din226(ap_var_for_const0); memcachedPipelinebkb_U100->din227(ap_var_for_const0); memcachedPipelinebkb_U100->din228(ap_var_for_const0); memcachedPipelinebkb_U100->din229(ap_var_for_const0); memcachedPipelinebkb_U100->din230(ap_var_for_const0); memcachedPipelinebkb_U100->din231(ap_var_for_const0); memcachedPipelinebkb_U100->din232(ap_var_for_const0); memcachedPipelinebkb_U100->din233(ap_var_for_const0); memcachedPipelinebkb_U100->din234(ap_var_for_const0); memcachedPipelinebkb_U100->din235(ap_var_for_const0); memcachedPipelinebkb_U100->din236(ap_var_for_const0); memcachedPipelinebkb_U100->din237(ap_var_for_const0); memcachedPipelinebkb_U100->din238(ap_var_for_const0); memcachedPipelinebkb_U100->din239(ap_var_for_const0); memcachedPipelinebkb_U100->din240(ap_var_for_const0); memcachedPipelinebkb_U100->din241(ap_var_for_const0); memcachedPipelinebkb_U100->din242(ap_var_for_const0); memcachedPipelinebkb_U100->din243(ap_var_for_const0); memcachedPipelinebkb_U100->din244(ap_var_for_const0); memcachedPipelinebkb_U100->din245(ap_var_for_const0); memcachedPipelinebkb_U100->din246(ap_var_for_const0); memcachedPipelinebkb_U100->din247(ap_var_for_const0); memcachedPipelinebkb_U100->din248(ap_var_for_const0); memcachedPipelinebkb_U100->din249(ap_var_for_const0); memcachedPipelinebkb_U100->din250(ap_var_for_const0); memcachedPipelinebkb_U100->din251(ap_var_for_const0); memcachedPipelinebkb_U100->din252(ap_var_for_const0); memcachedPipelinebkb_U100->din253(ap_var_for_const0); memcachedPipelinebkb_U100->din254(ap_var_for_const0); memcachedPipelinebkb_U100->din255(ap_var_for_const0); memcachedPipelinebkb_U100->din256(tempKeep_V_fu_620_p257); memcachedPipelinebkb_U100->dout(tempKeep_V_fu_620_p258); memcachedPipelinebkb_U101 = new memcachedPipelinebkb<1,1,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8>("memcachedPipelinebkb_U101"); memcachedPipelinebkb_U101->din0(ap_var_for_const0); memcachedPipelinebkb_U101->din1(ap_var_for_const1); memcachedPipelinebkb_U101->din2(ap_var_for_const2); memcachedPipelinebkb_U101->din3(ap_var_for_const3); memcachedPipelinebkb_U101->din4(ap_var_for_const4); memcachedPipelinebkb_U101->din5(ap_var_for_const5); memcachedPipelinebkb_U101->din6(ap_var_for_const6); memcachedPipelinebkb_U101->din7(ap_var_for_const7); memcachedPipelinebkb_U101->din8(ap_var_for_const0); memcachedPipelinebkb_U101->din9(ap_var_for_const0); memcachedPipelinebkb_U101->din10(ap_var_for_const0); memcachedPipelinebkb_U101->din11(ap_var_for_const0); memcachedPipelinebkb_U101->din12(ap_var_for_const0); memcachedPipelinebkb_U101->din13(ap_var_for_const0); memcachedPipelinebkb_U101->din14(ap_var_for_const0); memcachedPipelinebkb_U101->din15(ap_var_for_const0); memcachedPipelinebkb_U101->din16(ap_var_for_const0); memcachedPipelinebkb_U101->din17(ap_var_for_const0); memcachedPipelinebkb_U101->din18(ap_var_for_const0); memcachedPipelinebkb_U101->din19(ap_var_for_const0); memcachedPipelinebkb_U101->din20(ap_var_for_const0); memcachedPipelinebkb_U101->din21(ap_var_for_const0); memcachedPipelinebkb_U101->din22(ap_var_for_const0); memcachedPipelinebkb_U101->din23(ap_var_for_const0); memcachedPipelinebkb_U101->din24(ap_var_for_const0); memcachedPipelinebkb_U101->din25(ap_var_for_const0); memcachedPipelinebkb_U101->din26(ap_var_for_const0); memcachedPipelinebkb_U101->din27(ap_var_for_const0); memcachedPipelinebkb_U101->din28(ap_var_for_const0); memcachedPipelinebkb_U101->din29(ap_var_for_const0); memcachedPipelinebkb_U101->din30(ap_var_for_const0); memcachedPipelinebkb_U101->din31(ap_var_for_const0); memcachedPipelinebkb_U101->din32(ap_var_for_const0); memcachedPipelinebkb_U101->din33(ap_var_for_const0); memcachedPipelinebkb_U101->din34(ap_var_for_const0); memcachedPipelinebkb_U101->din35(ap_var_for_const0); memcachedPipelinebkb_U101->din36(ap_var_for_const0); memcachedPipelinebkb_U101->din37(ap_var_for_const0); memcachedPipelinebkb_U101->din38(ap_var_for_const0); memcachedPipelinebkb_U101->din39(ap_var_for_const0); memcachedPipelinebkb_U101->din40(ap_var_for_const0); memcachedPipelinebkb_U101->din41(ap_var_for_const0); memcachedPipelinebkb_U101->din42(ap_var_for_const0); memcachedPipelinebkb_U101->din43(ap_var_for_const0); memcachedPipelinebkb_U101->din44(ap_var_for_const0); memcachedPipelinebkb_U101->din45(ap_var_for_const0); memcachedPipelinebkb_U101->din46(ap_var_for_const0); memcachedPipelinebkb_U101->din47(ap_var_for_const0); memcachedPipelinebkb_U101->din48(ap_var_for_const0); memcachedPipelinebkb_U101->din49(ap_var_for_const0); memcachedPipelinebkb_U101->din50(ap_var_for_const0); memcachedPipelinebkb_U101->din51(ap_var_for_const0); memcachedPipelinebkb_U101->din52(ap_var_for_const0); memcachedPipelinebkb_U101->din53(ap_var_for_const0); memcachedPipelinebkb_U101->din54(ap_var_for_const0); memcachedPipelinebkb_U101->din55(ap_var_for_const0); memcachedPipelinebkb_U101->din56(ap_var_for_const0); memcachedPipelinebkb_U101->din57(ap_var_for_const0); memcachedPipelinebkb_U101->din58(ap_var_for_const0); memcachedPipelinebkb_U101->din59(ap_var_for_const0); memcachedPipelinebkb_U101->din60(ap_var_for_const0); memcachedPipelinebkb_U101->din61(ap_var_for_const0); memcachedPipelinebkb_U101->din62(ap_var_for_const0); memcachedPipelinebkb_U101->din63(ap_var_for_const0); memcachedPipelinebkb_U101->din64(ap_var_for_const0); memcachedPipelinebkb_U101->din65(ap_var_for_const0); memcachedPipelinebkb_U101->din66(ap_var_for_const0); memcachedPipelinebkb_U101->din67(ap_var_for_const0); memcachedPipelinebkb_U101->din68(ap_var_for_const0); memcachedPipelinebkb_U101->din69(ap_var_for_const0); memcachedPipelinebkb_U101->din70(ap_var_for_const0); memcachedPipelinebkb_U101->din71(ap_var_for_const0); memcachedPipelinebkb_U101->din72(ap_var_for_const0); memcachedPipelinebkb_U101->din73(ap_var_for_const0); memcachedPipelinebkb_U101->din74(ap_var_for_const0); memcachedPipelinebkb_U101->din75(ap_var_for_const0); memcachedPipelinebkb_U101->din76(ap_var_for_const0); memcachedPipelinebkb_U101->din77(ap_var_for_const0); memcachedPipelinebkb_U101->din78(ap_var_for_const0); memcachedPipelinebkb_U101->din79(ap_var_for_const0); memcachedPipelinebkb_U101->din80(ap_var_for_const0); memcachedPipelinebkb_U101->din81(ap_var_for_const0); memcachedPipelinebkb_U101->din82(ap_var_for_const0); memcachedPipelinebkb_U101->din83(ap_var_for_const0); memcachedPipelinebkb_U101->din84(ap_var_for_const0); memcachedPipelinebkb_U101->din85(ap_var_for_const0); memcachedPipelinebkb_U101->din86(ap_var_for_const0); memcachedPipelinebkb_U101->din87(ap_var_for_const0); memcachedPipelinebkb_U101->din88(ap_var_for_const0); memcachedPipelinebkb_U101->din89(ap_var_for_const0); memcachedPipelinebkb_U101->din90(ap_var_for_const0); memcachedPipelinebkb_U101->din91(ap_var_for_const0); memcachedPipelinebkb_U101->din92(ap_var_for_const0); memcachedPipelinebkb_U101->din93(ap_var_for_const0); memcachedPipelinebkb_U101->din94(ap_var_for_const0); memcachedPipelinebkb_U101->din95(ap_var_for_const0); memcachedPipelinebkb_U101->din96(ap_var_for_const0); memcachedPipelinebkb_U101->din97(ap_var_for_const0); memcachedPipelinebkb_U101->din98(ap_var_for_const0); memcachedPipelinebkb_U101->din99(ap_var_for_const0); memcachedPipelinebkb_U101->din100(ap_var_for_const0); memcachedPipelinebkb_U101->din101(ap_var_for_const0); memcachedPipelinebkb_U101->din102(ap_var_for_const0); memcachedPipelinebkb_U101->din103(ap_var_for_const0); memcachedPipelinebkb_U101->din104(ap_var_for_const0); memcachedPipelinebkb_U101->din105(ap_var_for_const0); memcachedPipelinebkb_U101->din106(ap_var_for_const0); memcachedPipelinebkb_U101->din107(ap_var_for_const0); memcachedPipelinebkb_U101->din108(ap_var_for_const0); memcachedPipelinebkb_U101->din109(ap_var_for_const0); memcachedPipelinebkb_U101->din110(ap_var_for_const0); memcachedPipelinebkb_U101->din111(ap_var_for_const0); memcachedPipelinebkb_U101->din112(ap_var_for_const0); memcachedPipelinebkb_U101->din113(ap_var_for_const0); memcachedPipelinebkb_U101->din114(ap_var_for_const0); memcachedPipelinebkb_U101->din115(ap_var_for_const0); memcachedPipelinebkb_U101->din116(ap_var_for_const0); memcachedPipelinebkb_U101->din117(ap_var_for_const0); memcachedPipelinebkb_U101->din118(ap_var_for_const0); memcachedPipelinebkb_U101->din119(ap_var_for_const0); memcachedPipelinebkb_U101->din120(ap_var_for_const0); memcachedPipelinebkb_U101->din121(ap_var_for_const0); memcachedPipelinebkb_U101->din122(ap_var_for_const0); memcachedPipelinebkb_U101->din123(ap_var_for_const0); memcachedPipelinebkb_U101->din124(ap_var_for_const0); memcachedPipelinebkb_U101->din125(ap_var_for_const0); memcachedPipelinebkb_U101->din126(ap_var_for_const0); memcachedPipelinebkb_U101->din127(ap_var_for_const0); memcachedPipelinebkb_U101->din128(ap_var_for_const0); memcachedPipelinebkb_U101->din129(ap_var_for_const0); memcachedPipelinebkb_U101->din130(ap_var_for_const0); memcachedPipelinebkb_U101->din131(ap_var_for_const0); memcachedPipelinebkb_U101->din132(ap_var_for_const0); memcachedPipelinebkb_U101->din133(ap_var_for_const0); memcachedPipelinebkb_U101->din134(ap_var_for_const0); memcachedPipelinebkb_U101->din135(ap_var_for_const0); memcachedPipelinebkb_U101->din136(ap_var_for_const0); memcachedPipelinebkb_U101->din137(ap_var_for_const0); memcachedPipelinebkb_U101->din138(ap_var_for_const0); memcachedPipelinebkb_U101->din139(ap_var_for_const0); memcachedPipelinebkb_U101->din140(ap_var_for_const0); memcachedPipelinebkb_U101->din141(ap_var_for_const0); memcachedPipelinebkb_U101->din142(ap_var_for_const0); memcachedPipelinebkb_U101->din143(ap_var_for_const0); memcachedPipelinebkb_U101->din144(ap_var_for_const0); memcachedPipelinebkb_U101->din145(ap_var_for_const0); memcachedPipelinebkb_U101->din146(ap_var_for_const0); memcachedPipelinebkb_U101->din147(ap_var_for_const0); memcachedPipelinebkb_U101->din148(ap_var_for_const0); memcachedPipelinebkb_U101->din149(ap_var_for_const0); memcachedPipelinebkb_U101->din150(ap_var_for_const0); memcachedPipelinebkb_U101->din151(ap_var_for_const0); memcachedPipelinebkb_U101->din152(ap_var_for_const0); memcachedPipelinebkb_U101->din153(ap_var_for_const0); memcachedPipelinebkb_U101->din154(ap_var_for_const0); memcachedPipelinebkb_U101->din155(ap_var_for_const0); memcachedPipelinebkb_U101->din156(ap_var_for_const0); memcachedPipelinebkb_U101->din157(ap_var_for_const0); memcachedPipelinebkb_U101->din158(ap_var_for_const0); memcachedPipelinebkb_U101->din159(ap_var_for_const0); memcachedPipelinebkb_U101->din160(ap_var_for_const0); memcachedPipelinebkb_U101->din161(ap_var_for_const0); memcachedPipelinebkb_U101->din162(ap_var_for_const0); memcachedPipelinebkb_U101->din163(ap_var_for_const0); memcachedPipelinebkb_U101->din164(ap_var_for_const0); memcachedPipelinebkb_U101->din165(ap_var_for_const0); memcachedPipelinebkb_U101->din166(ap_var_for_const0); memcachedPipelinebkb_U101->din167(ap_var_for_const0); memcachedPipelinebkb_U101->din168(ap_var_for_const0); memcachedPipelinebkb_U101->din169(ap_var_for_const0); memcachedPipelinebkb_U101->din170(ap_var_for_const0); memcachedPipelinebkb_U101->din171(ap_var_for_const0); memcachedPipelinebkb_U101->din172(ap_var_for_const0); memcachedPipelinebkb_U101->din173(ap_var_for_const0); memcachedPipelinebkb_U101->din174(ap_var_for_const0); memcachedPipelinebkb_U101->din175(ap_var_for_const0); memcachedPipelinebkb_U101->din176(ap_var_for_const0); memcachedPipelinebkb_U101->din177(ap_var_for_const0); memcachedPipelinebkb_U101->din178(ap_var_for_const0); memcachedPipelinebkb_U101->din179(ap_var_for_const0); memcachedPipelinebkb_U101->din180(ap_var_for_const0); memcachedPipelinebkb_U101->din181(ap_var_for_const0); memcachedPipelinebkb_U101->din182(ap_var_for_const0); memcachedPipelinebkb_U101->din183(ap_var_for_const0); memcachedPipelinebkb_U101->din184(ap_var_for_const0); memcachedPipelinebkb_U101->din185(ap_var_for_const0); memcachedPipelinebkb_U101->din186(ap_var_for_const0); memcachedPipelinebkb_U101->din187(ap_var_for_const0); memcachedPipelinebkb_U101->din188(ap_var_for_const0); memcachedPipelinebkb_U101->din189(ap_var_for_const0); memcachedPipelinebkb_U101->din190(ap_var_for_const0); memcachedPipelinebkb_U101->din191(ap_var_for_const0); memcachedPipelinebkb_U101->din192(ap_var_for_const0); memcachedPipelinebkb_U101->din193(ap_var_for_const0); memcachedPipelinebkb_U101->din194(ap_var_for_const0); memcachedPipelinebkb_U101->din195(ap_var_for_const0); memcachedPipelinebkb_U101->din196(ap_var_for_const0); memcachedPipelinebkb_U101->din197(ap_var_for_const0); memcachedPipelinebkb_U101->din198(ap_var_for_const0); memcachedPipelinebkb_U101->din199(ap_var_for_const0); memcachedPipelinebkb_U101->din200(ap_var_for_const0); memcachedPipelinebkb_U101->din201(ap_var_for_const0); memcachedPipelinebkb_U101->din202(ap_var_for_const0); memcachedPipelinebkb_U101->din203(ap_var_for_const0); memcachedPipelinebkb_U101->din204(ap_var_for_const0); memcachedPipelinebkb_U101->din205(ap_var_for_const0); memcachedPipelinebkb_U101->din206(ap_var_for_const0); memcachedPipelinebkb_U101->din207(ap_var_for_const0); memcachedPipelinebkb_U101->din208(ap_var_for_const0); memcachedPipelinebkb_U101->din209(ap_var_for_const0); memcachedPipelinebkb_U101->din210(ap_var_for_const0); memcachedPipelinebkb_U101->din211(ap_var_for_const0); memcachedPipelinebkb_U101->din212(ap_var_for_const0); memcachedPipelinebkb_U101->din213(ap_var_for_const0); memcachedPipelinebkb_U101->din214(ap_var_for_const0); memcachedPipelinebkb_U101->din215(ap_var_for_const0); memcachedPipelinebkb_U101->din216(ap_var_for_const0); memcachedPipelinebkb_U101->din217(ap_var_for_const0); memcachedPipelinebkb_U101->din218(ap_var_for_const0); memcachedPipelinebkb_U101->din219(ap_var_for_const0); memcachedPipelinebkb_U101->din220(ap_var_for_const0); memcachedPipelinebkb_U101->din221(ap_var_for_const0); memcachedPipelinebkb_U101->din222(ap_var_for_const0); memcachedPipelinebkb_U101->din223(ap_var_for_const0); memcachedPipelinebkb_U101->din224(ap_var_for_const0); memcachedPipelinebkb_U101->din225(ap_var_for_const0); memcachedPipelinebkb_U101->din226(ap_var_for_const0); memcachedPipelinebkb_U101->din227(ap_var_for_const0); memcachedPipelinebkb_U101->din228(ap_var_for_const0); memcachedPipelinebkb_U101->din229(ap_var_for_const0); memcachedPipelinebkb_U101->din230(ap_var_for_const0); memcachedPipelinebkb_U101->din231(ap_var_for_const0); memcachedPipelinebkb_U101->din232(ap_var_for_const0); memcachedPipelinebkb_U101->din233(ap_var_for_const0); memcachedPipelinebkb_U101->din234(ap_var_for_const0); memcachedPipelinebkb_U101->din235(ap_var_for_const0); memcachedPipelinebkb_U101->din236(ap_var_for_const0); memcachedPipelinebkb_U101->din237(ap_var_for_const0); memcachedPipelinebkb_U101->din238(ap_var_for_const0); memcachedPipelinebkb_U101->din239(ap_var_for_const0); memcachedPipelinebkb_U101->din240(ap_var_for_const0); memcachedPipelinebkb_U101->din241(ap_var_for_const0); memcachedPipelinebkb_U101->din242(ap_var_for_const0); memcachedPipelinebkb_U101->din243(ap_var_for_const0); memcachedPipelinebkb_U101->din244(ap_var_for_const0); memcachedPipelinebkb_U101->din245(ap_var_for_const0); memcachedPipelinebkb_U101->din246(ap_var_for_const0); memcachedPipelinebkb_U101->din247(ap_var_for_const0); memcachedPipelinebkb_U101->din248(ap_var_for_const0); memcachedPipelinebkb_U101->din249(ap_var_for_const0); memcachedPipelinebkb_U101->din250(ap_var_for_const0); memcachedPipelinebkb_U101->din251(ap_var_for_const0); memcachedPipelinebkb_U101->din252(ap_var_for_const0); memcachedPipelinebkb_U101->din253(ap_var_for_const0); memcachedPipelinebkb_U101->din254(ap_var_for_const0); memcachedPipelinebkb_U101->din255(ap_var_for_const0); memcachedPipelinebkb_U101->din256(tempOutput_keep_V_fu_1218_p257); memcachedPipelinebkb_U101->dout(tempOutput_keep_V_fu_1218_p258); memcachedPipelinebkb_U102 = new memcachedPipelinebkb<1,1,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8>("memcachedPipelinebkb_U102"); memcachedPipelinebkb_U102->din0(ap_var_for_const0); memcachedPipelinebkb_U102->din1(ap_var_for_const1); memcachedPipelinebkb_U102->din2(ap_var_for_const2); memcachedPipelinebkb_U102->din3(ap_var_for_const3); memcachedPipelinebkb_U102->din4(ap_var_for_const4); memcachedPipelinebkb_U102->din5(ap_var_for_const5); memcachedPipelinebkb_U102->din6(ap_var_for_const6); memcachedPipelinebkb_U102->din7(ap_var_for_const7); memcachedPipelinebkb_U102->din8(ap_var_for_const0); memcachedPipelinebkb_U102->din9(ap_var_for_const0); memcachedPipelinebkb_U102->din10(ap_var_for_const0); memcachedPipelinebkb_U102->din11(ap_var_for_const0); memcachedPipelinebkb_U102->din12(ap_var_for_const0); memcachedPipelinebkb_U102->din13(ap_var_for_const0); memcachedPipelinebkb_U102->din14(ap_var_for_const0); memcachedPipelinebkb_U102->din15(ap_var_for_const0); memcachedPipelinebkb_U102->din16(ap_var_for_const0); memcachedPipelinebkb_U102->din17(ap_var_for_const0); memcachedPipelinebkb_U102->din18(ap_var_for_const0); memcachedPipelinebkb_U102->din19(ap_var_for_const0); memcachedPipelinebkb_U102->din20(ap_var_for_const0); memcachedPipelinebkb_U102->din21(ap_var_for_const0); memcachedPipelinebkb_U102->din22(ap_var_for_const0); memcachedPipelinebkb_U102->din23(ap_var_for_const0); memcachedPipelinebkb_U102->din24(ap_var_for_const0); memcachedPipelinebkb_U102->din25(ap_var_for_const0); memcachedPipelinebkb_U102->din26(ap_var_for_const0); memcachedPipelinebkb_U102->din27(ap_var_for_const0); memcachedPipelinebkb_U102->din28(ap_var_for_const0); memcachedPipelinebkb_U102->din29(ap_var_for_const0); memcachedPipelinebkb_U102->din30(ap_var_for_const0); memcachedPipelinebkb_U102->din31(ap_var_for_const0); memcachedPipelinebkb_U102->din32(ap_var_for_const0); memcachedPipelinebkb_U102->din33(ap_var_for_const0); memcachedPipelinebkb_U102->din34(ap_var_for_const0); memcachedPipelinebkb_U102->din35(ap_var_for_const0); memcachedPipelinebkb_U102->din36(ap_var_for_const0); memcachedPipelinebkb_U102->din37(ap_var_for_const0); memcachedPipelinebkb_U102->din38(ap_var_for_const0); memcachedPipelinebkb_U102->din39(ap_var_for_const0); memcachedPipelinebkb_U102->din40(ap_var_for_const0); memcachedPipelinebkb_U102->din41(ap_var_for_const0); memcachedPipelinebkb_U102->din42(ap_var_for_const0); memcachedPipelinebkb_U102->din43(ap_var_for_const0); memcachedPipelinebkb_U102->din44(ap_var_for_const0); memcachedPipelinebkb_U102->din45(ap_var_for_const0); memcachedPipelinebkb_U102->din46(ap_var_for_const0); memcachedPipelinebkb_U102->din47(ap_var_for_const0); memcachedPipelinebkb_U102->din48(ap_var_for_const0); memcachedPipelinebkb_U102->din49(ap_var_for_const0); memcachedPipelinebkb_U102->din50(ap_var_for_const0); memcachedPipelinebkb_U102->din51(ap_var_for_const0); memcachedPipelinebkb_U102->din52(ap_var_for_const0); memcachedPipelinebkb_U102->din53(ap_var_for_const0); memcachedPipelinebkb_U102->din54(ap_var_for_const0); memcachedPipelinebkb_U102->din55(ap_var_for_const0); memcachedPipelinebkb_U102->din56(ap_var_for_const0); memcachedPipelinebkb_U102->din57(ap_var_for_const0); memcachedPipelinebkb_U102->din58(ap_var_for_const0); memcachedPipelinebkb_U102->din59(ap_var_for_const0); memcachedPipelinebkb_U102->din60(ap_var_for_const0); memcachedPipelinebkb_U102->din61(ap_var_for_const0); memcachedPipelinebkb_U102->din62(ap_var_for_const0); memcachedPipelinebkb_U102->din63(ap_var_for_const0); memcachedPipelinebkb_U102->din64(ap_var_for_const0); memcachedPipelinebkb_U102->din65(ap_var_for_const0); memcachedPipelinebkb_U102->din66(ap_var_for_const0); memcachedPipelinebkb_U102->din67(ap_var_for_const0); memcachedPipelinebkb_U102->din68(ap_var_for_const0); memcachedPipelinebkb_U102->din69(ap_var_for_const0); memcachedPipelinebkb_U102->din70(ap_var_for_const0); memcachedPipelinebkb_U102->din71(ap_var_for_const0); memcachedPipelinebkb_U102->din72(ap_var_for_const0); memcachedPipelinebkb_U102->din73(ap_var_for_const0); memcachedPipelinebkb_U102->din74(ap_var_for_const0); memcachedPipelinebkb_U102->din75(ap_var_for_const0); memcachedPipelinebkb_U102->din76(ap_var_for_const0); memcachedPipelinebkb_U102->din77(ap_var_for_const0); memcachedPipelinebkb_U102->din78(ap_var_for_const0); memcachedPipelinebkb_U102->din79(ap_var_for_const0); memcachedPipelinebkb_U102->din80(ap_var_for_const0); memcachedPipelinebkb_U102->din81(ap_var_for_const0); memcachedPipelinebkb_U102->din82(ap_var_for_const0); memcachedPipelinebkb_U102->din83(ap_var_for_const0); memcachedPipelinebkb_U102->din84(ap_var_for_const0); memcachedPipelinebkb_U102->din85(ap_var_for_const0); memcachedPipelinebkb_U102->din86(ap_var_for_const0); memcachedPipelinebkb_U102->din87(ap_var_for_const0); memcachedPipelinebkb_U102->din88(ap_var_for_const0); memcachedPipelinebkb_U102->din89(ap_var_for_const0); memcachedPipelinebkb_U102->din90(ap_var_for_const0); memcachedPipelinebkb_U102->din91(ap_var_for_const0); memcachedPipelinebkb_U102->din92(ap_var_for_const0); memcachedPipelinebkb_U102->din93(ap_var_for_const0); memcachedPipelinebkb_U102->din94(ap_var_for_const0); memcachedPipelinebkb_U102->din95(ap_var_for_const0); memcachedPipelinebkb_U102->din96(ap_var_for_const0); memcachedPipelinebkb_U102->din97(ap_var_for_const0); memcachedPipelinebkb_U102->din98(ap_var_for_const0); memcachedPipelinebkb_U102->din99(ap_var_for_const0); memcachedPipelinebkb_U102->din100(ap_var_for_const0); memcachedPipelinebkb_U102->din101(ap_var_for_const0); memcachedPipelinebkb_U102->din102(ap_var_for_const0); memcachedPipelinebkb_U102->din103(ap_var_for_const0); memcachedPipelinebkb_U102->din104(ap_var_for_const0); memcachedPipelinebkb_U102->din105(ap_var_for_const0); memcachedPipelinebkb_U102->din106(ap_var_for_const0); memcachedPipelinebkb_U102->din107(ap_var_for_const0); memcachedPipelinebkb_U102->din108(ap_var_for_const0); memcachedPipelinebkb_U102->din109(ap_var_for_const0); memcachedPipelinebkb_U102->din110(ap_var_for_const0); memcachedPipelinebkb_U102->din111(ap_var_for_const0); memcachedPipelinebkb_U102->din112(ap_var_for_const0); memcachedPipelinebkb_U102->din113(ap_var_for_const0); memcachedPipelinebkb_U102->din114(ap_var_for_const0); memcachedPipelinebkb_U102->din115(ap_var_for_const0); memcachedPipelinebkb_U102->din116(ap_var_for_const0); memcachedPipelinebkb_U102->din117(ap_var_for_const0); memcachedPipelinebkb_U102->din118(ap_var_for_const0); memcachedPipelinebkb_U102->din119(ap_var_for_const0); memcachedPipelinebkb_U102->din120(ap_var_for_const0); memcachedPipelinebkb_U102->din121(ap_var_for_const0); memcachedPipelinebkb_U102->din122(ap_var_for_const0); memcachedPipelinebkb_U102->din123(ap_var_for_const0); memcachedPipelinebkb_U102->din124(ap_var_for_const0); memcachedPipelinebkb_U102->din125(ap_var_for_const0); memcachedPipelinebkb_U102->din126(ap_var_for_const0); memcachedPipelinebkb_U102->din127(ap_var_for_const0); memcachedPipelinebkb_U102->din128(ap_var_for_const0); memcachedPipelinebkb_U102->din129(ap_var_for_const0); memcachedPipelinebkb_U102->din130(ap_var_for_const0); memcachedPipelinebkb_U102->din131(ap_var_for_const0); memcachedPipelinebkb_U102->din132(ap_var_for_const0); memcachedPipelinebkb_U102->din133(ap_var_for_const0); memcachedPipelinebkb_U102->din134(ap_var_for_const0); memcachedPipelinebkb_U102->din135(ap_var_for_const0); memcachedPipelinebkb_U102->din136(ap_var_for_const0); memcachedPipelinebkb_U102->din137(ap_var_for_const0); memcachedPipelinebkb_U102->din138(ap_var_for_const0); memcachedPipelinebkb_U102->din139(ap_var_for_const0); memcachedPipelinebkb_U102->din140(ap_var_for_const0); memcachedPipelinebkb_U102->din141(ap_var_for_const0); memcachedPipelinebkb_U102->din142(ap_var_for_const0); memcachedPipelinebkb_U102->din143(ap_var_for_const0); memcachedPipelinebkb_U102->din144(ap_var_for_const0); memcachedPipelinebkb_U102->din145(ap_var_for_const0); memcachedPipelinebkb_U102->din146(ap_var_for_const0); memcachedPipelinebkb_U102->din147(ap_var_for_const0); memcachedPipelinebkb_U102->din148(ap_var_for_const0); memcachedPipelinebkb_U102->din149(ap_var_for_const0); memcachedPipelinebkb_U102->din150(ap_var_for_const0); memcachedPipelinebkb_U102->din151(ap_var_for_const0); memcachedPipelinebkb_U102->din152(ap_var_for_const0); memcachedPipelinebkb_U102->din153(ap_var_for_const0); memcachedPipelinebkb_U102->din154(ap_var_for_const0); memcachedPipelinebkb_U102->din155(ap_var_for_const0); memcachedPipelinebkb_U102->din156(ap_var_for_const0); memcachedPipelinebkb_U102->din157(ap_var_for_const0); memcachedPipelinebkb_U102->din158(ap_var_for_const0); memcachedPipelinebkb_U102->din159(ap_var_for_const0); memcachedPipelinebkb_U102->din160(ap_var_for_const0); memcachedPipelinebkb_U102->din161(ap_var_for_const0); memcachedPipelinebkb_U102->din162(ap_var_for_const0); memcachedPipelinebkb_U102->din163(ap_var_for_const0); memcachedPipelinebkb_U102->din164(ap_var_for_const0); memcachedPipelinebkb_U102->din165(ap_var_for_const0); memcachedPipelinebkb_U102->din166(ap_var_for_const0); memcachedPipelinebkb_U102->din167(ap_var_for_const0); memcachedPipelinebkb_U102->din168(ap_var_for_const0); memcachedPipelinebkb_U102->din169(ap_var_for_const0); memcachedPipelinebkb_U102->din170(ap_var_for_const0); memcachedPipelinebkb_U102->din171(ap_var_for_const0); memcachedPipelinebkb_U102->din172(ap_var_for_const0); memcachedPipelinebkb_U102->din173(ap_var_for_const0); memcachedPipelinebkb_U102->din174(ap_var_for_const0); memcachedPipelinebkb_U102->din175(ap_var_for_const0); memcachedPipelinebkb_U102->din176(ap_var_for_const0); memcachedPipelinebkb_U102->din177(ap_var_for_const0); memcachedPipelinebkb_U102->din178(ap_var_for_const0); memcachedPipelinebkb_U102->din179(ap_var_for_const0); memcachedPipelinebkb_U102->din180(ap_var_for_const0); memcachedPipelinebkb_U102->din181(ap_var_for_const0); memcachedPipelinebkb_U102->din182(ap_var_for_const0); memcachedPipelinebkb_U102->din183(ap_var_for_const0); memcachedPipelinebkb_U102->din184(ap_var_for_const0); memcachedPipelinebkb_U102->din185(ap_var_for_const0); memcachedPipelinebkb_U102->din186(ap_var_for_const0); memcachedPipelinebkb_U102->din187(ap_var_for_const0); memcachedPipelinebkb_U102->din188(ap_var_for_const0); memcachedPipelinebkb_U102->din189(ap_var_for_const0); memcachedPipelinebkb_U102->din190(ap_var_for_const0); memcachedPipelinebkb_U102->din191(ap_var_for_const0); memcachedPipelinebkb_U102->din192(ap_var_for_const0); memcachedPipelinebkb_U102->din193(ap_var_for_const0); memcachedPipelinebkb_U102->din194(ap_var_for_const0); memcachedPipelinebkb_U102->din195(ap_var_for_const0); memcachedPipelinebkb_U102->din196(ap_var_for_const0); memcachedPipelinebkb_U102->din197(ap_var_for_const0); memcachedPipelinebkb_U102->din198(ap_var_for_const0); memcachedPipelinebkb_U102->din199(ap_var_for_const0); memcachedPipelinebkb_U102->din200(ap_var_for_const0); memcachedPipelinebkb_U102->din201(ap_var_for_const0); memcachedPipelinebkb_U102->din202(ap_var_for_const0); memcachedPipelinebkb_U102->din203(ap_var_for_const0); memcachedPipelinebkb_U102->din204(ap_var_for_const0); memcachedPipelinebkb_U102->din205(ap_var_for_const0); memcachedPipelinebkb_U102->din206(ap_var_for_const0); memcachedPipelinebkb_U102->din207(ap_var_for_const0); memcachedPipelinebkb_U102->din208(ap_var_for_const0); memcachedPipelinebkb_U102->din209(ap_var_for_const0); memcachedPipelinebkb_U102->din210(ap_var_for_const0); memcachedPipelinebkb_U102->din211(ap_var_for_const0); memcachedPipelinebkb_U102->din212(ap_var_for_const0); memcachedPipelinebkb_U102->din213(ap_var_for_const0); memcachedPipelinebkb_U102->din214(ap_var_for_const0); memcachedPipelinebkb_U102->din215(ap_var_for_const0); memcachedPipelinebkb_U102->din216(ap_var_for_const0); memcachedPipelinebkb_U102->din217(ap_var_for_const0); memcachedPipelinebkb_U102->din218(ap_var_for_const0); memcachedPipelinebkb_U102->din219(ap_var_for_const0); memcachedPipelinebkb_U102->din220(ap_var_for_const0); memcachedPipelinebkb_U102->din221(ap_var_for_const0); memcachedPipelinebkb_U102->din222(ap_var_for_const0); memcachedPipelinebkb_U102->din223(ap_var_for_const0); memcachedPipelinebkb_U102->din224(ap_var_for_const0); memcachedPipelinebkb_U102->din225(ap_var_for_const0); memcachedPipelinebkb_U102->din226(ap_var_for_const0); memcachedPipelinebkb_U102->din227(ap_var_for_const0); memcachedPipelinebkb_U102->din228(ap_var_for_const0); memcachedPipelinebkb_U102->din229(ap_var_for_const0); memcachedPipelinebkb_U102->din230(ap_var_for_const0); memcachedPipelinebkb_U102->din231(ap_var_for_const0); memcachedPipelinebkb_U102->din232(ap_var_for_const0); memcachedPipelinebkb_U102->din233(ap_var_for_const0); memcachedPipelinebkb_U102->din234(ap_var_for_const0); memcachedPipelinebkb_U102->din235(ap_var_for_const0); memcachedPipelinebkb_U102->din236(ap_var_for_const0); memcachedPipelinebkb_U102->din237(ap_var_for_const0); memcachedPipelinebkb_U102->din238(ap_var_for_const0); memcachedPipelinebkb_U102->din239(ap_var_for_const0); memcachedPipelinebkb_U102->din240(ap_var_for_const0); memcachedPipelinebkb_U102->din241(ap_var_for_const0); memcachedPipelinebkb_U102->din242(ap_var_for_const0); memcachedPipelinebkb_U102->din243(ap_var_for_const0); memcachedPipelinebkb_U102->din244(ap_var_for_const0); memcachedPipelinebkb_U102->din245(ap_var_for_const0); memcachedPipelinebkb_U102->din246(ap_var_for_const0); memcachedPipelinebkb_U102->din247(ap_var_for_const0); memcachedPipelinebkb_U102->din248(ap_var_for_const0); memcachedPipelinebkb_U102->din249(ap_var_for_const0); memcachedPipelinebkb_U102->din250(ap_var_for_const0); memcachedPipelinebkb_U102->din251(ap_var_for_const0); memcachedPipelinebkb_U102->din252(ap_var_for_const0); memcachedPipelinebkb_U102->din253(ap_var_for_const0); memcachedPipelinebkb_U102->din254(ap_var_for_const0); memcachedPipelinebkb_U102->din255(ap_var_for_const0); memcachedPipelinebkb_U102->din256(tempOutput_keep_V_5_fu_2087_p257); memcachedPipelinebkb_U102->dout(tempOutput_keep_V_5_fu_2087_p258); memcachedPipelinebkb_U103 = new memcachedPipelinebkb<1,1,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8>("memcachedPipelinebkb_U103"); memcachedPipelinebkb_U103->din0(ap_var_for_const0); memcachedPipelinebkb_U103->din1(ap_var_for_const1); memcachedPipelinebkb_U103->din2(ap_var_for_const2); memcachedPipelinebkb_U103->din3(ap_var_for_const3); memcachedPipelinebkb_U103->din4(ap_var_for_const4); memcachedPipelinebkb_U103->din5(ap_var_for_const5); memcachedPipelinebkb_U103->din6(ap_var_for_const6); memcachedPipelinebkb_U103->din7(ap_var_for_const7); memcachedPipelinebkb_U103->din8(ap_var_for_const0); memcachedPipelinebkb_U103->din9(ap_var_for_const0); memcachedPipelinebkb_U103->din10(ap_var_for_const0); memcachedPipelinebkb_U103->din11(ap_var_for_const0); memcachedPipelinebkb_U103->din12(ap_var_for_const0); memcachedPipelinebkb_U103->din13(ap_var_for_const0); memcachedPipelinebkb_U103->din14(ap_var_for_const0); memcachedPipelinebkb_U103->din15(ap_var_for_const0); memcachedPipelinebkb_U103->din16(ap_var_for_const0); memcachedPipelinebkb_U103->din17(ap_var_for_const0); memcachedPipelinebkb_U103->din18(ap_var_for_const0); memcachedPipelinebkb_U103->din19(ap_var_for_const0); memcachedPipelinebkb_U103->din20(ap_var_for_const0); memcachedPipelinebkb_U103->din21(ap_var_for_const0); memcachedPipelinebkb_U103->din22(ap_var_for_const0); memcachedPipelinebkb_U103->din23(ap_var_for_const0); memcachedPipelinebkb_U103->din24(ap_var_for_const0); memcachedPipelinebkb_U103->din25(ap_var_for_const0); memcachedPipelinebkb_U103->din26(ap_var_for_const0); memcachedPipelinebkb_U103->din27(ap_var_for_const0); memcachedPipelinebkb_U103->din28(ap_var_for_const0); memcachedPipelinebkb_U103->din29(ap_var_for_const0); memcachedPipelinebkb_U103->din30(ap_var_for_const0); memcachedPipelinebkb_U103->din31(ap_var_for_const0); memcachedPipelinebkb_U103->din32(ap_var_for_const0); memcachedPipelinebkb_U103->din33(ap_var_for_const0); memcachedPipelinebkb_U103->din34(ap_var_for_const0); memcachedPipelinebkb_U103->din35(ap_var_for_const0); memcachedPipelinebkb_U103->din36(ap_var_for_const0); memcachedPipelinebkb_U103->din37(ap_var_for_const0); memcachedPipelinebkb_U103->din38(ap_var_for_const0); memcachedPipelinebkb_U103->din39(ap_var_for_const0); memcachedPipelinebkb_U103->din40(ap_var_for_const0); memcachedPipelinebkb_U103->din41(ap_var_for_const0); memcachedPipelinebkb_U103->din42(ap_var_for_const0); memcachedPipelinebkb_U103->din43(ap_var_for_const0); memcachedPipelinebkb_U103->din44(ap_var_for_const0); memcachedPipelinebkb_U103->din45(ap_var_for_const0); memcachedPipelinebkb_U103->din46(ap_var_for_const0); memcachedPipelinebkb_U103->din47(ap_var_for_const0); memcachedPipelinebkb_U103->din48(ap_var_for_const0); memcachedPipelinebkb_U103->din49(ap_var_for_const0); memcachedPipelinebkb_U103->din50(ap_var_for_const0); memcachedPipelinebkb_U103->din51(ap_var_for_const0); memcachedPipelinebkb_U103->din52(ap_var_for_const0); memcachedPipelinebkb_U103->din53(ap_var_for_const0); memcachedPipelinebkb_U103->din54(ap_var_for_const0); memcachedPipelinebkb_U103->din55(ap_var_for_const0); memcachedPipelinebkb_U103->din56(ap_var_for_const0); memcachedPipelinebkb_U103->din57(ap_var_for_const0); memcachedPipelinebkb_U103->din58(ap_var_for_const0); memcachedPipelinebkb_U103->din59(ap_var_for_const0); memcachedPipelinebkb_U103->din60(ap_var_for_const0); memcachedPipelinebkb_U103->din61(ap_var_for_const0); memcachedPipelinebkb_U103->din62(ap_var_for_const0); memcachedPipelinebkb_U103->din63(ap_var_for_const0); memcachedPipelinebkb_U103->din64(ap_var_for_const0); memcachedPipelinebkb_U103->din65(ap_var_for_const0); memcachedPipelinebkb_U103->din66(ap_var_for_const0); memcachedPipelinebkb_U103->din67(ap_var_for_const0); memcachedPipelinebkb_U103->din68(ap_var_for_const0); memcachedPipelinebkb_U103->din69(ap_var_for_const0); memcachedPipelinebkb_U103->din70(ap_var_for_const0); memcachedPipelinebkb_U103->din71(ap_var_for_const0); memcachedPipelinebkb_U103->din72(ap_var_for_const0); memcachedPipelinebkb_U103->din73(ap_var_for_const0); memcachedPipelinebkb_U103->din74(ap_var_for_const0); memcachedPipelinebkb_U103->din75(ap_var_for_const0); memcachedPipelinebkb_U103->din76(ap_var_for_const0); memcachedPipelinebkb_U103->din77(ap_var_for_const0); memcachedPipelinebkb_U103->din78(ap_var_for_const0); memcachedPipelinebkb_U103->din79(ap_var_for_const0); memcachedPipelinebkb_U103->din80(ap_var_for_const0); memcachedPipelinebkb_U103->din81(ap_var_for_const0); memcachedPipelinebkb_U103->din82(ap_var_for_const0); memcachedPipelinebkb_U103->din83(ap_var_for_const0); memcachedPipelinebkb_U103->din84(ap_var_for_const0); memcachedPipelinebkb_U103->din85(ap_var_for_const0); memcachedPipelinebkb_U103->din86(ap_var_for_const0); memcachedPipelinebkb_U103->din87(ap_var_for_const0); memcachedPipelinebkb_U103->din88(ap_var_for_const0); memcachedPipelinebkb_U103->din89(ap_var_for_const0); memcachedPipelinebkb_U103->din90(ap_var_for_const0); memcachedPipelinebkb_U103->din91(ap_var_for_const0); memcachedPipelinebkb_U103->din92(ap_var_for_const0); memcachedPipelinebkb_U103->din93(ap_var_for_const0); memcachedPipelinebkb_U103->din94(ap_var_for_const0); memcachedPipelinebkb_U103->din95(ap_var_for_const0); memcachedPipelinebkb_U103->din96(ap_var_for_const0); memcachedPipelinebkb_U103->din97(ap_var_for_const0); memcachedPipelinebkb_U103->din98(ap_var_for_const0); memcachedPipelinebkb_U103->din99(ap_var_for_const0); memcachedPipelinebkb_U103->din100(ap_var_for_const0); memcachedPipelinebkb_U103->din101(ap_var_for_const0); memcachedPipelinebkb_U103->din102(ap_var_for_const0); memcachedPipelinebkb_U103->din103(ap_var_for_const0); memcachedPipelinebkb_U103->din104(ap_var_for_const0); memcachedPipelinebkb_U103->din105(ap_var_for_const0); memcachedPipelinebkb_U103->din106(ap_var_for_const0); memcachedPipelinebkb_U103->din107(ap_var_for_const0); memcachedPipelinebkb_U103->din108(ap_var_for_const0); memcachedPipelinebkb_U103->din109(ap_var_for_const0); memcachedPipelinebkb_U103->din110(ap_var_for_const0); memcachedPipelinebkb_U103->din111(ap_var_for_const0); memcachedPipelinebkb_U103->din112(ap_var_for_const0); memcachedPipelinebkb_U103->din113(ap_var_for_const0); memcachedPipelinebkb_U103->din114(ap_var_for_const0); memcachedPipelinebkb_U103->din115(ap_var_for_const0); memcachedPipelinebkb_U103->din116(ap_var_for_const0); memcachedPipelinebkb_U103->din117(ap_var_for_const0); memcachedPipelinebkb_U103->din118(ap_var_for_const0); memcachedPipelinebkb_U103->din119(ap_var_for_const0); memcachedPipelinebkb_U103->din120(ap_var_for_const0); memcachedPipelinebkb_U103->din121(ap_var_for_const0); memcachedPipelinebkb_U103->din122(ap_var_for_const0); memcachedPipelinebkb_U103->din123(ap_var_for_const0); memcachedPipelinebkb_U103->din124(ap_var_for_const0); memcachedPipelinebkb_U103->din125(ap_var_for_const0); memcachedPipelinebkb_U103->din126(ap_var_for_const0); memcachedPipelinebkb_U103->din127(ap_var_for_const0); memcachedPipelinebkb_U103->din128(ap_var_for_const0); memcachedPipelinebkb_U103->din129(ap_var_for_const0); memcachedPipelinebkb_U103->din130(ap_var_for_const0); memcachedPipelinebkb_U103->din131(ap_var_for_const0); memcachedPipelinebkb_U103->din132(ap_var_for_const0); memcachedPipelinebkb_U103->din133(ap_var_for_const0); memcachedPipelinebkb_U103->din134(ap_var_for_const0); memcachedPipelinebkb_U103->din135(ap_var_for_const0); memcachedPipelinebkb_U103->din136(ap_var_for_const0); memcachedPipelinebkb_U103->din137(ap_var_for_const0); memcachedPipelinebkb_U103->din138(ap_var_for_const0); memcachedPipelinebkb_U103->din139(ap_var_for_const0); memcachedPipelinebkb_U103->din140(ap_var_for_const0); memcachedPipelinebkb_U103->din141(ap_var_for_const0); memcachedPipelinebkb_U103->din142(ap_var_for_const0); memcachedPipelinebkb_U103->din143(ap_var_for_const0); memcachedPipelinebkb_U103->din144(ap_var_for_const0); memcachedPipelinebkb_U103->din145(ap_var_for_const0); memcachedPipelinebkb_U103->din146(ap_var_for_const0); memcachedPipelinebkb_U103->din147(ap_var_for_const0); memcachedPipelinebkb_U103->din148(ap_var_for_const0); memcachedPipelinebkb_U103->din149(ap_var_for_const0); memcachedPipelinebkb_U103->din150(ap_var_for_const0); memcachedPipelinebkb_U103->din151(ap_var_for_const0); memcachedPipelinebkb_U103->din152(ap_var_for_const0); memcachedPipelinebkb_U103->din153(ap_var_for_const0); memcachedPipelinebkb_U103->din154(ap_var_for_const0); memcachedPipelinebkb_U103->din155(ap_var_for_const0); memcachedPipelinebkb_U103->din156(ap_var_for_const0); memcachedPipelinebkb_U103->din157(ap_var_for_const0); memcachedPipelinebkb_U103->din158(ap_var_for_const0); memcachedPipelinebkb_U103->din159(ap_var_for_const0); memcachedPipelinebkb_U103->din160(ap_var_for_const0); memcachedPipelinebkb_U103->din161(ap_var_for_const0); memcachedPipelinebkb_U103->din162(ap_var_for_const0); memcachedPipelinebkb_U103->din163(ap_var_for_const0); memcachedPipelinebkb_U103->din164(ap_var_for_const0); memcachedPipelinebkb_U103->din165(ap_var_for_const0); memcachedPipelinebkb_U103->din166(ap_var_for_const0); memcachedPipelinebkb_U103->din167(ap_var_for_const0); memcachedPipelinebkb_U103->din168(ap_var_for_const0); memcachedPipelinebkb_U103->din169(ap_var_for_const0); memcachedPipelinebkb_U103->din170(ap_var_for_const0); memcachedPipelinebkb_U103->din171(ap_var_for_const0); memcachedPipelinebkb_U103->din172(ap_var_for_const0); memcachedPipelinebkb_U103->din173(ap_var_for_const0); memcachedPipelinebkb_U103->din174(ap_var_for_const0); memcachedPipelinebkb_U103->din175(ap_var_for_const0); memcachedPipelinebkb_U103->din176(ap_var_for_const0); memcachedPipelinebkb_U103->din177(ap_var_for_const0); memcachedPipelinebkb_U103->din178(ap_var_for_const0); memcachedPipelinebkb_U103->din179(ap_var_for_const0); memcachedPipelinebkb_U103->din180(ap_var_for_const0); memcachedPipelinebkb_U103->din181(ap_var_for_const0); memcachedPipelinebkb_U103->din182(ap_var_for_const0); memcachedPipelinebkb_U103->din183(ap_var_for_const0); memcachedPipelinebkb_U103->din184(ap_var_for_const0); memcachedPipelinebkb_U103->din185(ap_var_for_const0); memcachedPipelinebkb_U103->din186(ap_var_for_const0); memcachedPipelinebkb_U103->din187(ap_var_for_const0); memcachedPipelinebkb_U103->din188(ap_var_for_const0); memcachedPipelinebkb_U103->din189(ap_var_for_const0); memcachedPipelinebkb_U103->din190(ap_var_for_const0); memcachedPipelinebkb_U103->din191(ap_var_for_const0); memcachedPipelinebkb_U103->din192(ap_var_for_const0); memcachedPipelinebkb_U103->din193(ap_var_for_const0); memcachedPipelinebkb_U103->din194(ap_var_for_const0); memcachedPipelinebkb_U103->din195(ap_var_for_const0); memcachedPipelinebkb_U103->din196(ap_var_for_const0); memcachedPipelinebkb_U103->din197(ap_var_for_const0); memcachedPipelinebkb_U103->din198(ap_var_for_const0); memcachedPipelinebkb_U103->din199(ap_var_for_const0); memcachedPipelinebkb_U103->din200(ap_var_for_const0); memcachedPipelinebkb_U103->din201(ap_var_for_const0); memcachedPipelinebkb_U103->din202(ap_var_for_const0); memcachedPipelinebkb_U103->din203(ap_var_for_const0); memcachedPipelinebkb_U103->din204(ap_var_for_const0); memcachedPipelinebkb_U103->din205(ap_var_for_const0); memcachedPipelinebkb_U103->din206(ap_var_for_const0); memcachedPipelinebkb_U103->din207(ap_var_for_const0); memcachedPipelinebkb_U103->din208(ap_var_for_const0); memcachedPipelinebkb_U103->din209(ap_var_for_const0); memcachedPipelinebkb_U103->din210(ap_var_for_const0); memcachedPipelinebkb_U103->din211(ap_var_for_const0); memcachedPipelinebkb_U103->din212(ap_var_for_const0); memcachedPipelinebkb_U103->din213(ap_var_for_const0); memcachedPipelinebkb_U103->din214(ap_var_for_const0); memcachedPipelinebkb_U103->din215(ap_var_for_const0); memcachedPipelinebkb_U103->din216(ap_var_for_const0); memcachedPipelinebkb_U103->din217(ap_var_for_const0); memcachedPipelinebkb_U103->din218(ap_var_for_const0); memcachedPipelinebkb_U103->din219(ap_var_for_const0); memcachedPipelinebkb_U103->din220(ap_var_for_const0); memcachedPipelinebkb_U103->din221(ap_var_for_const0); memcachedPipelinebkb_U103->din222(ap_var_for_const0); memcachedPipelinebkb_U103->din223(ap_var_for_const0); memcachedPipelinebkb_U103->din224(ap_var_for_const0); memcachedPipelinebkb_U103->din225(ap_var_for_const0); memcachedPipelinebkb_U103->din226(ap_var_for_const0); memcachedPipelinebkb_U103->din227(ap_var_for_const0); memcachedPipelinebkb_U103->din228(ap_var_for_const0); memcachedPipelinebkb_U103->din229(ap_var_for_const0); memcachedPipelinebkb_U103->din230(ap_var_for_const0); memcachedPipelinebkb_U103->din231(ap_var_for_const0); memcachedPipelinebkb_U103->din232(ap_var_for_const0); memcachedPipelinebkb_U103->din233(ap_var_for_const0); memcachedPipelinebkb_U103->din234(ap_var_for_const0); memcachedPipelinebkb_U103->din235(ap_var_for_const0); memcachedPipelinebkb_U103->din236(ap_var_for_const0); memcachedPipelinebkb_U103->din237(ap_var_for_const0); memcachedPipelinebkb_U103->din238(ap_var_for_const0); memcachedPipelinebkb_U103->din239(ap_var_for_const0); memcachedPipelinebkb_U103->din240(ap_var_for_const0); memcachedPipelinebkb_U103->din241(ap_var_for_const0); memcachedPipelinebkb_U103->din242(ap_var_for_const0); memcachedPipelinebkb_U103->din243(ap_var_for_const0); memcachedPipelinebkb_U103->din244(ap_var_for_const0); memcachedPipelinebkb_U103->din245(ap_var_for_const0); memcachedPipelinebkb_U103->din246(ap_var_for_const0); memcachedPipelinebkb_U103->din247(ap_var_for_const0); memcachedPipelinebkb_U103->din248(ap_var_for_const0); memcachedPipelinebkb_U103->din249(ap_var_for_const0); memcachedPipelinebkb_U103->din250(ap_var_for_const0); memcachedPipelinebkb_U103->din251(ap_var_for_const0); memcachedPipelinebkb_U103->din252(ap_var_for_const0); memcachedPipelinebkb_U103->din253(ap_var_for_const0); memcachedPipelinebkb_U103->din254(ap_var_for_const0); memcachedPipelinebkb_U103->din255(ap_var_for_const0); memcachedPipelinebkb_U103->din256(tempOutput_keep_V_4_fu_2773_p257); memcachedPipelinebkb_U103->dout(tempOutput_keep_V_4_fu_2773_p258); SC_METHOD(thread_ap_clk_no_reset_); dont_initialize(); sensitive << ( ap_clk.pos() ); SC_METHOD(thread_Hi_assign_2_fu_2623_p2); sensitive << ( tmp_48_i_fu_2609_p3 ); SC_METHOD(thread_Hi_assign_fu_2617_p2); sensitive << ( tmp_48_i_fu_2609_p3 ); SC_METHOD(thread_ap_CS_iter0_fsm_state1); sensitive << ( ap_CS_iter0_fsm ); SC_METHOD(thread_ap_CS_iter1_fsm_state0); sensitive << ( ap_CS_iter1_fsm ); SC_METHOD(thread_ap_CS_iter1_fsm_state2); sensitive << ( ap_CS_iter1_fsm ); SC_METHOD(thread_ap_CS_iter2_fsm_state0); sensitive << ( ap_CS_iter2_fsm ); SC_METHOD(thread_ap_CS_iter2_fsm_state3); sensitive << ( ap_CS_iter2_fsm ); SC_METHOD(thread_ap_block_state1_pp0_stage0_iter0); sensitive << ( ap_start ); sensitive << ( ap_done_reg ); sensitive << ( valueBuffer_rf_V_V_empty_n ); sensitive << ( ap_predicate_op37_read_state1 ); sensitive << ( ap_predicate_op56_read_state1 ); sensitive << ( ap_predicate_op134_read_state1 ); sensitive << ( metadataBuffer_rf_V_s_empty_n ); sensitive << ( ap_predicate_op142_read_state1 ); SC_METHOD(thread_ap_block_state2_io); sensitive << ( respOutput_V_data_V_1_ack_in ); sensitive << ( ap_predicate_op150_write_state2 ); sensitive << ( ap_predicate_op155_write_state2 ); sensitive << ( ap_predicate_op185_write_state2 ); sensitive << ( ap_predicate_op190_write_state2 ); sensitive << ( ap_predicate_op195_write_state2 ); sensitive << ( ap_predicate_op197_write_state2 ); sensitive << ( ap_predicate_op200_write_state2 ); sensitive << ( ap_predicate_op208_write_state2 ); SC_METHOD(thread_ap_block_state2_pp0_stage0_iter1); SC_METHOD(thread_ap_block_state3_io); sensitive << ( respOutput_V_data_V_1_ack_in ); sensitive << ( ap_predicate_op218_write_state3 ); sensitive << ( ap_predicate_op221_write_state3 ); sensitive << ( ap_predicate_op223_write_state3 ); sensitive << ( ap_predicate_op226_write_state3 ); sensitive << ( ap_predicate_op227_write_state3 ); sensitive << ( ap_predicate_op229_write_state3 ); sensitive << ( ap_predicate_op230_write_state3 ); sensitive << ( ap_predicate_op231_write_state3 ); SC_METHOD(thread_ap_block_state3_pp0_stage0_iter2); sensitive << ( respOutput_V_data_V_1_ack_in ); sensitive << ( respOutput_V_user_V_1_ack_in ); sensitive << ( respOutput_V_keep_V_1_ack_in ); sensitive << ( respOutput_V_last_V_1_ack_in ); SC_METHOD(thread_ap_condition_2601); sensitive << ( tmp_i_82_fu_559_p2 ); sensitive << ( tmp_18_i_fu_570_p2 ); sensitive << ( tmp_23_i_fu_1778_p2 ); SC_METHOD(thread_ap_condition_334); sensitive << ( ap_start ); sensitive << ( ap_done_reg ); sensitive << ( ap_CS_iter0_fsm_state1 ); sensitive << ( valueBuffer_rf_V_V_empty_n ); sensitive << ( ap_predicate_op37_read_state1 ); sensitive << ( ap_predicate_op56_read_state1 ); sensitive << ( ap_predicate_op134_read_state1 ); sensitive << ( metadataBuffer_rf_V_s_empty_n ); sensitive << ( ap_predicate_op142_read_state1 ); sensitive << ( respOutput_V_data_V_1_ack_in ); sensitive << ( ap_block_state2_io ); sensitive << ( ap_CS_iter1_fsm_state2 ); sensitive << ( respOutput_V_user_V_1_ack_in ); sensitive << ( respOutput_V_keep_V_1_ack_in ); sensitive << ( respOutput_V_last_V_1_ack_in ); sensitive << ( ap_block_state3_io ); sensitive << ( ap_CS_iter2_fsm_state3 ); SC_METHOD(thread_ap_condition_658); sensitive << ( ap_start ); sensitive << ( ap_done_reg ); sensitive << ( ap_CS_iter0_fsm_state1 ); sensitive << ( valueBuffer_rf_V_V_empty_n ); sensitive << ( tmp_i_fu_541_p2 ); sensitive << ( ap_predicate_op37_read_state1 ); sensitive << ( ap_predicate_op56_read_state1 ); sensitive << ( ap_predicate_op134_read_state1 ); sensitive << ( metadataBuffer_rf_V_s_empty_n ); sensitive << ( ap_predicate_op142_read_state1 ); sensitive << ( respOutput_V_data_V_1_ack_in ); sensitive << ( ap_block_state2_io ); sensitive << ( ap_CS_iter1_fsm_state2 ); sensitive << ( respOutput_V_user_V_1_ack_in ); sensitive << ( respOutput_V_keep_V_1_ack_in ); sensitive << ( respOutput_V_last_V_1_ack_in ); sensitive << ( ap_block_state3_io ); sensitive << ( ap_CS_iter2_fsm_state3 ); SC_METHOD(thread_ap_condition_708); sensitive << ( tmp_i_fu_541_p2 ); sensitive << ( tmp_i_82_fu_559_p2 ); sensitive << ( tmp_18_i_fu_570_p2 ); sensitive << ( tmp_24_i_fu_576_p2 ); sensitive << ( tmp_29_i_fu_582_p2 ); sensitive << ( tmp_31_i_fu_588_p2 ); sensitive << ( tmp_34_i_fu_606_p2 ); sensitive << ( grp_nbreadreq_fu_256_p3 ); sensitive << ( tmp_46_i_fu_1164_p2 ); SC_METHOD(thread_ap_condition_722); sensitive << ( tmp_i_fu_541_p2 ); sensitive << ( tmp_i_82_fu_559_p2 ); sensitive << ( tmp_18_i_fu_570_p2 ); sensitive << ( tmp_24_i_fu_576_p2 ); sensitive << ( tmp_29_i_fu_582_p2 ); sensitive << ( grp_nbreadreq_fu_256_p3 ); sensitive << ( grp_fu_492_p2 ); SC_METHOD(thread_ap_condition_754); sensitive << ( tmp_i_fu_541_p2 ); sensitive << ( tmp_i_82_fu_559_p2 ); sensitive << ( tmp_18_i_fu_570_p2 ); sensitive << ( tmp_23_i_fu_1778_p2 ); SC_METHOD(thread_ap_condition_759); sensitive << ( tmp_i_fu_541_p2 ); sensitive << ( tmp_i_82_fu_559_p2 ); sensitive << ( tmp_18_i_fu_570_p2 ); sensitive << ( tmp_23_i_fu_1778_p2 ); SC_METHOD(thread_ap_condition_785); sensitive << ( tmp_i_fu_541_p2 ); sensitive << ( tmp_i_82_fu_559_p2 ); sensitive << ( or_cond2_i_fu_1902_p2 ); sensitive << ( or_cond5_i_fu_2004_p2 ); SC_METHOD(thread_ap_condition_839); sensitive << ( tmp_i_fu_541_p2 ); sensitive << ( tmp_i_82_fu_559_p2 ); sensitive << ( tmp_18_i_fu_570_p2 ); sensitive << ( tmp_24_i_fu_576_p2 ); sensitive << ( tmp_29_i_fu_582_p2 ); sensitive << ( tmp_31_i_fu_588_p2 ); sensitive << ( tmp_34_i_fu_606_p2 ); sensitive << ( grp_nbreadreq_fu_256_p3 ); sensitive << ( tmp_46_i_fu_1164_p2 ); SC_METHOD(thread_ap_condition_849); sensitive << ( tmp_i_fu_541_p2 ); sensitive << ( tmp_i_82_fu_559_p2 ); sensitive << ( tmp_18_i_fu_570_p2 ); sensitive << ( tmp_24_i_fu_576_p2 ); sensitive << ( tmp_29_i_fu_582_p2 ); sensitive << ( grp_nbreadreq_fu_256_p3 ); sensitive << ( grp_fu_492_p2 ); SC_METHOD(thread_ap_condition_88); sensitive << ( tmp_i_fu_541_p2 ); sensitive << ( tmp_i_82_fu_559_p2 ); sensitive << ( or_cond2_i_fu_1902_p2 ); sensitive << ( or_cond5_i_fu_2004_p2 ); SC_METHOD(thread_ap_condition_962); sensitive << ( ap_done_reg ); sensitive << ( respOutput_V_data_V_1_ack_in ); sensitive << ( ap_CS_iter1_fsm_state2 ); sensitive << ( respOutput_V_user_V_1_ack_in ); sensitive << ( respOutput_V_keep_V_1_ack_in ); sensitive << ( respOutput_V_last_V_1_ack_in ); sensitive << ( ap_CS_iter2_fsm_state3 ); SC_METHOD(thread_ap_done); sensitive << ( ap_done_reg ); sensitive << ( respOutput_V_data_V_1_ack_in ); sensitive << ( respOutput_V_user_V_1_ack_in ); sensitive << ( respOutput_V_keep_V_1_ack_in ); sensitive << ( respOutput_V_last_V_1_ack_in ); sensitive << ( ap_block_state3_io ); sensitive << ( ap_CS_iter2_fsm_state3 ); SC_METHOD(thread_ap_idle); sensitive << ( ap_start ); sensitive << ( ap_CS_iter0_fsm_state1 ); sensitive << ( ap_CS_iter1_fsm_state0 ); sensitive << ( ap_CS_iter2_fsm_state0 ); SC_METHOD(thread_ap_phi_mux_xtrasBuffer_V_flag_8_phi_fu_419_p18); sensitive << ( tmp_i_reg_3368 ); sensitive << ( tmp_i_82_reg_3372 ); sensitive << ( or_cond2_i_reg_3479 ); sensitive << ( ap_CS_iter1_fsm_state2 ); sensitive << ( ap_phi_reg_pp0_iter1_xtrasBuffer_V_flag_8_reg_414 ); SC_METHOD(thread_ap_phi_mux_xtrasBuffer_V_new_8_s_phi_fu_453_p18); sensitive << ( tmp_i_reg_3368 ); sensitive << ( tmp_i_82_reg_3372 ); sensitive << ( or_cond2_i_reg_3479 ); sensitive << ( ap_CS_iter1_fsm_state2 ); sensitive << ( ap_phi_reg_pp0_iter1_xtrasBuffer_V_new_i_reg_394 ); sensitive << ( ap_phi_reg_pp0_iter1_xtrasBuffer_V_new_8_s_reg_449 ); SC_METHOD(thread_ap_phi_reg_pp0_iter0_p_0492_1_i_reg_405); SC_METHOD(thread_ap_phi_reg_pp0_iter0_tmp_data_V_1_reg_385); SC_METHOD(thread_ap_phi_reg_pp0_iter0_tmp_keep_V_1_reg_352); SC_METHOD(thread_ap_phi_reg_pp0_iter0_tmp_keep_V_3_reg_322); SC_METHOD(thread_ap_phi_reg_pp0_iter0_tmp_last_V_1_reg_336); SC_METHOD(thread_ap_phi_reg_pp0_iter0_tmp_last_V_2_reg_306); SC_METHOD(thread_ap_phi_reg_pp0_iter0_tmp_last_V_reg_366); SC_METHOD(thread_ap_phi_reg_pp0_iter0_xtrasBuffer_V_flag_8_reg_414); SC_METHOD(thread_ap_phi_reg_pp0_iter0_xtrasBuffer_V_new_8_s_reg_449); SC_METHOD(thread_ap_phi_reg_pp0_iter0_xtrasBuffer_V_new_i_reg_394); SC_METHOD(thread_ap_predicate_op134_read_state1); sensitive << ( tmp_i_fu_541_p2 ); sensitive << ( tmp_i_82_fu_559_p2 ); sensitive << ( or_cond2_i_fu_1902_p2 ); sensitive << ( or_cond5_i_fu_2004_p2 ); SC_METHOD(thread_ap_predicate_op142_read_state1); sensitive << ( tmp_i_fu_541_p2 ); sensitive << ( tmp_nbreadreq_fu_270_p3 ); SC_METHOD(thread_ap_predicate_op150_write_state2); sensitive << ( tmp_i_reg_3368 ); sensitive << ( tmp_i_82_reg_3372 ); sensitive << ( tmp_18_i_reg_3383 ); sensitive << ( tmp_24_i_reg_3387 ); sensitive << ( tmp_29_i_reg_3391 ); sensitive << ( tmp_31_i_reg_3395 ); sensitive << ( tmp_35_i_reg_3399 ); sensitive << ( tmp_41_i_reg_3403 ); SC_METHOD(thread_ap_predicate_op155_write_state2); sensitive << ( tmp_i_reg_3368 ); sensitive << ( tmp_i_82_reg_3372 ); sensitive << ( tmp_18_i_reg_3383 ); sensitive << ( tmp_24_i_reg_3387 ); sensitive << ( tmp_29_i_reg_3391 ); sensitive << ( tmp_31_i_reg_3395 ); sensitive << ( tmp_35_i_reg_3399 ); SC_METHOD(thread_ap_predicate_op185_write_state2); sensitive << ( tmp_i_reg_3368 ); sensitive << ( tmp_i_82_reg_3372 ); sensitive << ( tmp_18_i_reg_3383 ); sensitive << ( tmp_24_i_reg_3387 ); sensitive << ( tmp_29_i_reg_3391 ); sensitive << ( tmp_31_i_reg_3395 ); sensitive << ( tmp_34_i_reg_3407 ); sensitive << ( tmp_39_i_reg_3415 ); sensitive << ( tmp_6_reg_3411 ); SC_METHOD(thread_ap_predicate_op190_write_state2); sensitive << ( tmp_i_reg_3368 ); sensitive << ( tmp_i_82_reg_3372 ); sensitive << ( tmp_18_i_reg_3383 ); sensitive << ( tmp_24_i_reg_3387 ); sensitive << ( tmp_29_i_reg_3391 ); sensitive << ( tmp_31_i_reg_3395 ); sensitive << ( tmp_34_i_reg_3407 ); sensitive << ( tmp_6_reg_3411 ); SC_METHOD(thread_ap_predicate_op195_write_state2); sensitive << ( tmp_i_reg_3368 ); sensitive << ( tmp_i_82_reg_3372 ); sensitive << ( tmp_18_i_reg_3383 ); sensitive << ( tmp_24_i_reg_3387 ); sensitive << ( tmp_29_i_reg_3391 ); sensitive << ( tmp_5_reg_3437 ); SC_METHOD(thread_ap_predicate_op197_write_state2); sensitive << ( tmp_i_reg_3368 ); sensitive << ( tmp_i_82_reg_3372 ); sensitive << ( tmp_18_i_reg_3383 ); sensitive << ( tmp_24_i_reg_3387 ); SC_METHOD(thread_ap_predicate_op200_write_state2); sensitive << ( tmp_i_reg_3368 ); sensitive << ( tmp_i_82_reg_3372 ); sensitive << ( tmp_18_i_reg_3383 ); SC_METHOD(thread_ap_predicate_op208_write_state2); sensitive << ( tmp_i_reg_3368 ); sensitive << ( tmp_i_82_reg_3372 ); sensitive << ( or_cond2_i_reg_3479 ); SC_METHOD(thread_ap_predicate_op218_write_state3); sensitive << ( tmp_i_reg_3368_pp0_iter1_reg ); sensitive << ( tmp_i_82_reg_3372_pp0_iter1_reg ); sensitive << ( tmp_18_i_reg_3383_pp0_iter1_reg ); sensitive << ( tmp_24_i_reg_3387_pp0_iter1_reg ); sensitive << ( tmp_29_i_reg_3391_pp0_iter1_reg ); sensitive << ( tmp_31_i_reg_3395_pp0_iter1_reg ); sensitive << ( tmp_35_i_reg_3399_pp0_iter1_reg ); sensitive << ( tmp_41_i_reg_3403_pp0_iter1_reg ); SC_METHOD(thread_ap_predicate_op221_write_state3); sensitive << ( tmp_i_reg_3368_pp0_iter1_reg ); sensitive << ( tmp_i_82_reg_3372_pp0_iter1_reg ); sensitive << ( tmp_18_i_reg_3383_pp0_iter1_reg ); sensitive << ( tmp_24_i_reg_3387_pp0_iter1_reg ); sensitive << ( tmp_29_i_reg_3391_pp0_iter1_reg ); sensitive << ( tmp_31_i_reg_3395_pp0_iter1_reg ); sensitive << ( tmp_35_i_reg_3399_pp0_iter1_reg ); SC_METHOD(thread_ap_predicate_op223_write_state3); sensitive << ( tmp_i_reg_3368_pp0_iter1_reg ); sensitive << ( tmp_i_82_reg_3372_pp0_iter1_reg ); sensitive << ( tmp_18_i_reg_3383_pp0_iter1_reg ); sensitive << ( tmp_24_i_reg_3387_pp0_iter1_reg ); sensitive << ( tmp_29_i_reg_3391_pp0_iter1_reg ); sensitive << ( tmp_31_i_reg_3395_pp0_iter1_reg ); sensitive << ( tmp_34_i_reg_3407_pp0_iter1_reg ); sensitive << ( tmp_39_i_reg_3415_pp0_iter1_reg ); sensitive << ( tmp_6_reg_3411_pp0_iter1_reg ); SC_METHOD(thread_ap_predicate_op226_write_state3); sensitive << ( tmp_i_reg_3368_pp0_iter1_reg ); sensitive << ( tmp_i_82_reg_3372_pp0_iter1_reg ); sensitive << ( tmp_18_i_reg_3383_pp0_iter1_reg ); sensitive << ( tmp_24_i_reg_3387_pp0_iter1_reg ); sensitive << ( tmp_29_i_reg_3391_pp0_iter1_reg ); sensitive << ( tmp_31_i_reg_3395_pp0_iter1_reg ); sensitive << ( tmp_34_i_reg_3407_pp0_iter1_reg ); sensitive << ( tmp_6_reg_3411_pp0_iter1_reg ); SC_METHOD(thread_ap_predicate_op227_write_state3); sensitive << ( tmp_i_reg_3368_pp0_iter1_reg ); sensitive << ( tmp_i_82_reg_3372_pp0_iter1_reg ); sensitive << ( tmp_18_i_reg_3383_pp0_iter1_reg ); sensitive << ( tmp_24_i_reg_3387_pp0_iter1_reg ); sensitive << ( tmp_29_i_reg_3391_pp0_iter1_reg ); sensitive << ( tmp_5_reg_3437_pp0_iter1_reg ); SC_METHOD(thread_ap_predicate_op229_write_state3); sensitive << ( tmp_i_reg_3368_pp0_iter1_reg ); sensitive << ( tmp_i_82_reg_3372_pp0_iter1_reg ); sensitive << ( tmp_18_i_reg_3383_pp0_iter1_reg ); sensitive << ( tmp_24_i_reg_3387_pp0_iter1_reg ); SC_METHOD(thread_ap_predicate_op230_write_state3); sensitive << ( tmp_i_reg_3368_pp0_iter1_reg ); sensitive << ( tmp_i_82_reg_3372_pp0_iter1_reg ); sensitive << ( tmp_18_i_reg_3383_pp0_iter1_reg ); SC_METHOD(thread_ap_predicate_op231_write_state3); sensitive << ( tmp_i_reg_3368_pp0_iter1_reg ); sensitive << ( tmp_i_82_reg_3372_pp0_iter1_reg ); sensitive << ( or_cond2_i_reg_3479_pp0_iter1_reg ); SC_METHOD(thread_ap_predicate_op37_read_state1); sensitive << ( tmp_i_fu_541_p2 ); sensitive << ( tmp_i_82_fu_559_p2 ); sensitive << ( tmp_18_i_fu_570_p2 ); sensitive << ( tmp_24_i_fu_576_p2 ); sensitive << ( tmp_29_i_fu_582_p2 ); sensitive << ( tmp_31_i_fu_588_p2 ); sensitive << ( tmp_34_i_fu_606_p2 ); sensitive << ( grp_nbreadreq_fu_256_p3 ); SC_METHOD(thread_ap_predicate_op56_read_state1); sensitive << ( tmp_i_fu_541_p2 ); sensitive << ( tmp_i_82_fu_559_p2 ); sensitive << ( tmp_18_i_fu_570_p2 ); sensitive << ( tmp_24_i_fu_576_p2 ); sensitive << ( tmp_29_i_fu_582_p2 ); sensitive << ( grp_nbreadreq_fu_256_p3 ); SC_METHOD(thread_ap_ready); sensitive << ( ap_start ); sensitive << ( ap_done_reg ); sensitive << ( ap_CS_iter0_fsm_state1 ); sensitive << ( valueBuffer_rf_V_V_empty_n ); sensitive << ( ap_predicate_op37_read_state1 ); sensitive << ( ap_predicate_op56_read_state1 ); sensitive << ( ap_predicate_op134_read_state1 ); sensitive << ( metadataBuffer_rf_V_s_empty_n ); sensitive << ( ap_predicate_op142_read_state1 ); sensitive << ( respOutput_V_data_V_1_ack_in ); sensitive << ( ap_block_state2_io ); sensitive << ( ap_CS_iter1_fsm_state2 ); sensitive << ( respOutput_V_user_V_1_ack_in ); sensitive << ( respOutput_V_keep_V_1_ack_in ); sensitive << ( respOutput_V_last_V_1_ack_in ); sensitive << ( ap_block_state3_io ); sensitive << ( ap_CS_iter2_fsm_state3 ); SC_METHOD(thread_br_valueLengthTemp_V_fu_2010_p2); sensitive << ( tempVar_V_fu_1922_p4 ); SC_METHOD(thread_grp_fu_492_p2); sensitive << ( ap_start ); sensitive << ( ap_done_reg ); sensitive << ( ap_CS_iter0_fsm_state1 ); sensitive << ( valueBuffer_rf_V_V_empty_n ); sensitive << ( tmp_i_fu_541_p2 ); sensitive << ( tmp_i_82_fu_559_p2 ); sensitive << ( tmp_18_i_fu_570_p2 ); sensitive << ( tmp_24_i_fu_576_p2 ); sensitive << ( tmp_29_i_fu_582_p2 ); sensitive << ( tmp_31_i_fu_588_p2 ); sensitive << ( tmp_34_i_fu_606_p2 ); sensitive << ( grp_nbreadreq_fu_256_p3 ); sensitive << ( ap_predicate_op37_read_state1 ); sensitive << ( ap_predicate_op56_read_state1 ); sensitive << ( ap_predicate_op134_read_state1 ); sensitive << ( metadataBuffer_rf_V_s_empty_n ); sensitive << ( ap_predicate_op142_read_state1 ); sensitive << ( respOutput_V_data_V_1_ack_in ); sensitive << ( ap_block_state2_io ); sensitive << ( ap_CS_iter1_fsm_state2 ); sensitive << ( respOutput_V_user_V_1_ack_in ); sensitive << ( respOutput_V_keep_V_1_ack_in ); sensitive << ( respOutput_V_last_V_1_ack_in ); sensitive << ( ap_block_state3_io ); sensitive << ( ap_CS_iter2_fsm_state3 ); sensitive << ( valueLength ); SC_METHOD(thread_grp_fu_502_p2); sensitive << ( ap_start ); sensitive << ( ap_done_reg ); sensitive << ( ap_CS_iter0_fsm_state1 ); sensitive << ( valueBuffer_rf_V_V_empty_n ); sensitive << ( tmp_i_fu_541_p2 ); sensitive << ( tmp_i_82_fu_559_p2 ); sensitive << ( tmp_18_i_fu_570_p2 ); sensitive << ( ap_predicate_op37_read_state1 ); sensitive << ( ap_predicate_op56_read_state1 ); sensitive << ( ap_predicate_op134_read_state1 ); sensitive << ( metadataBuffer_rf_V_s_empty_n ); sensitive << ( ap_predicate_op142_read_state1 ); sensitive << ( respOutput_V_data_V_1_ack_in ); sensitive << ( ap_block_state2_io ); sensitive << ( ap_CS_iter1_fsm_state2 ); sensitive << ( respOutput_V_user_V_1_ack_in ); sensitive << ( respOutput_V_keep_V_1_ack_in ); sensitive << ( respOutput_V_last_V_1_ack_in ); sensitive << ( ap_block_state3_io ); sensitive << ( ap_CS_iter2_fsm_state3 ); sensitive << ( errorCode ); sensitive << ( tmp_23_i_fu_1778_p2 ); SC_METHOD(thread_grp_fu_507_p2); sensitive << ( ap_start ); sensitive << ( ap_done_reg ); sensitive << ( ap_CS_iter0_fsm_state1 ); sensitive << ( valueBuffer_rf_V_V_empty_n ); sensitive << ( tmp_i_fu_541_p2 ); sensitive << ( tmp_i_82_fu_559_p2 ); sensitive << ( tmp_18_i_fu_570_p2 ); sensitive << ( tmp_24_i_fu_576_p2 ); sensitive << ( ap_predicate_op37_read_state1 ); sensitive << ( ap_predicate_op56_read_state1 ); sensitive << ( ap_predicate_op134_read_state1 ); sensitive << ( metadataBuffer_rf_V_s_empty_n ); sensitive << ( ap_predicate_op142_read_state1 ); sensitive << ( respOutput_V_data_V_1_ack_in ); sensitive << ( ap_block_state2_io ); sensitive << ( ap_CS_iter1_fsm_state2 ); sensitive << ( respOutput_V_user_V_1_ack_in ); sensitive << ( respOutput_V_keep_V_1_ack_in ); sensitive << ( respOutput_V_last_V_1_ack_in ); sensitive << ( ap_block_state3_io ); sensitive << ( ap_CS_iter2_fsm_state3 ); sensitive << ( outOpCode ); sensitive << ( tmp_28_i_fu_497_p2 ); sensitive << ( tmp_23_i_fu_1778_p2 ); SC_METHOD(thread_grp_fu_512_p2); sensitive << ( ap_start ); sensitive << ( ap_done_reg ); sensitive << ( ap_CS_iter0_fsm_state1 ); sensitive << ( valueBuffer_rf_V_V_empty_n ); sensitive << ( tmp_i_fu_541_p2 ); sensitive << ( tmp_i_82_fu_559_p2 ); sensitive << ( tmp_18_i_fu_570_p2 ); sensitive << ( tmp_24_i_fu_576_p2 ); sensitive << ( ap_predicate_op37_read_state1 ); sensitive << ( ap_predicate_op56_read_state1 ); sensitive << ( ap_predicate_op134_read_state1 ); sensitive << ( metadataBuffer_rf_V_s_empty_n ); sensitive << ( ap_predicate_op142_read_state1 ); sensitive << ( respOutput_V_data_V_1_ack_in ); sensitive << ( ap_block_state2_io ); sensitive << ( ap_CS_iter1_fsm_state2 ); sensitive << ( respOutput_V_user_V_1_ack_in ); sensitive << ( respOutput_V_keep_V_1_ack_in ); sensitive << ( respOutput_V_last_V_1_ack_in ); sensitive << ( ap_block_state3_io ); sensitive << ( ap_CS_iter2_fsm_state3 ); sensitive << ( outOpCode ); sensitive << ( tmp_28_i_fu_497_p2 ); sensitive << ( tmp_64_fu_1754_p2 ); sensitive << ( tmp_23_i_fu_1778_p2 ); SC_METHOD(thread_grp_fu_517_p4); sensitive << ( xtrasBuffer_V ); SC_METHOD(thread_grp_nbreadreq_fu_256_p3); sensitive << ( valueBuffer_rf_V_V_empty_n ); SC_METHOD(thread_lengthValue_assign_fu_1208_p2); sensitive << ( tmp_67_fu_1204_p1 ); SC_METHOD(thread_metadataBuffer_rf_V_s_blk_n); sensitive << ( ap_start ); sensitive << ( ap_done_reg ); sensitive << ( ap_CS_iter0_fsm_state1 ); sensitive << ( metadataBuffer_rf_V_s_empty_n ); sensitive << ( ap_predicate_op142_read_state1 ); SC_METHOD(thread_metadataBuffer_rf_V_s_read); sensitive << ( ap_start ); sensitive << ( ap_done_reg ); sensitive << ( ap_CS_iter0_fsm_state1 ); sensitive << ( valueBuffer_rf_V_V_empty_n ); sensitive << ( ap_predicate_op37_read_state1 ); sensitive << ( ap_predicate_op56_read_state1 ); sensitive << ( ap_predicate_op134_read_state1 ); sensitive << ( metadataBuffer_rf_V_s_empty_n ); sensitive << ( ap_predicate_op142_read_state1 ); sensitive << ( respOutput_V_data_V_1_ack_in ); sensitive << ( ap_block_state2_io ); sensitive << ( ap_CS_iter1_fsm_state2 ); sensitive << ( respOutput_V_user_V_1_ack_in ); sensitive << ( respOutput_V_keep_V_1_ack_in ); sensitive << ( respOutput_V_last_V_1_ack_in ); sensitive << ( ap_block_state3_io ); sensitive << ( ap_CS_iter2_fsm_state3 ); SC_METHOD(thread_or_cond1_i_fu_1890_p2); sensitive << ( grp_fu_502_p2 ); sensitive << ( or_cond913_not_i_fu_1884_p2 ); SC_METHOD(thread_or_cond2_i_fu_1902_p2); sensitive << ( grp_fu_512_p2 ); sensitive << ( or_cond915_not_i_fu_1896_p2 ); SC_METHOD(thread_or_cond3_i_fu_1784_p2); sensitive << ( grp_fu_512_p2 ); sensitive << ( grp_fu_507_p2 ); SC_METHOD(thread_or_cond4_i_fu_1790_p2); sensitive << ( or_cond3_i_fu_1784_p2 ); sensitive << ( grp_fu_502_p2 ); SC_METHOD(thread_or_cond5_i_fu_2004_p2); sensitive << ( grp_fu_502_p2 ); sensitive << ( tmp_30_i_fu_1998_p2 ); SC_METHOD(thread_or_cond913_not_i_fu_1884_p1); sensitive << ( ap_start ); sensitive << ( ap_CS_iter0_fsm_state1 ); sensitive << ( valueBuffer_rf_V_V_empty_n ); SC_METHOD(thread_or_cond913_not_i_fu_1884_p2); sensitive << ( tmp1_fu_1878_p2 ); sensitive << ( or_cond913_not_i_fu_1884_p1 ); SC_METHOD(thread_or_cond915_not_i_fu_1896_p2); sensitive << ( or_cond1_i_fu_1890_p2 ); SC_METHOD(thread_outData_TDATA); sensitive << ( respOutput_V_data_V_1_data_out ); SC_METHOD(thread_outData_TDATA_blk_n); sensitive << ( ap_predicate_op150_write_state2 ); sensitive << ( ap_predicate_op155_write_state2 ); sensitive << ( ap_predicate_op185_write_state2 ); sensitive << ( ap_predicate_op190_write_state2 ); sensitive << ( ap_predicate_op195_write_state2 ); sensitive << ( ap_predicate_op197_write_state2 ); sensitive << ( ap_predicate_op200_write_state2 ); sensitive << ( ap_predicate_op208_write_state2 ); sensitive << ( ap_CS_iter1_fsm_state2 ); sensitive << ( ap_predicate_op218_write_state3 ); sensitive << ( ap_predicate_op221_write_state3 ); sensitive << ( ap_predicate_op223_write_state3 ); sensitive << ( ap_predicate_op226_write_state3 ); sensitive << ( ap_predicate_op227_write_state3 ); sensitive << ( ap_predicate_op229_write_state3 ); sensitive << ( ap_predicate_op230_write_state3 ); sensitive << ( ap_predicate_op231_write_state3 ); sensitive << ( ap_CS_iter2_fsm_state3 ); sensitive << ( respOutput_V_data_V_1_state ); SC_METHOD(thread_outData_TKEEP); sensitive << ( respOutput_V_keep_V_1_data_out ); SC_METHOD(thread_outData_TLAST); sensitive << ( respOutput_V_last_V_1_data_out ); SC_METHOD(thread_outData_TUSER); sensitive << ( respOutput_V_user_V_1_data_out ); SC_METHOD(thread_outData_TVALID); sensitive << ( respOutput_V_last_V_1_state ); SC_METHOD(thread_p_1_cast_i_cast_cast_fu_1796_p3); sensitive << ( or_cond4_i_fu_1790_p2 ); SC_METHOD(thread_p_Result_10_fu_2079_p1); sensitive << ( grp_fu_517_p4 ); SC_METHOD(thread_p_Result_3_fu_3326_p4); sensitive << ( p_Result_2_i_reg_3488 ); SC_METHOD(thread_p_Result_4_fu_3342_p5); sensitive << ( p_Result_8_i_reg_3499 ); sensitive << ( tempOutput_data_V_fu_3335_p3 ); SC_METHOD(thread_p_Result_56_i_i_fu_1840_p4); sensitive << ( p_Val2_4_fu_1808_p2 ); SC_METHOD(thread_p_Result_5_fu_3354_p3); sensitive << ( p_Result_1_i_reg_3483 ); sensitive << ( ap_phi_reg_pp0_iter1_p_0492_1_i_reg_405 ); SC_METHOD(thread_p_Result_6_fu_3304_p3); sensitive << ( tmp_66_reg_3441 ); sensitive << ( tmp_65_fu_3300_p1 ); SC_METHOD(thread_p_Result_7_fu_3292_p3); sensitive << ( tmp_69_reg_3419 ); sensitive << ( grp_fu_517_p4 ); SC_METHOD(thread_p_Result_8_fu_2737_p2); sensitive << ( tmp_83_fu_2723_p3 ); sensitive << ( tmp_84_fu_2731_p2 ); SC_METHOD(thread_p_Result_9_fu_2763_p2); sensitive << ( p_Result_8_fu_2737_p2 ); sensitive << ( tmp_89_fu_2757_p2 ); SC_METHOD(thread_p_Result_i_83_fu_1912_p4); sensitive << ( outMetadataTempBuffe ); SC_METHOD(thread_p_Result_i_i_84_fu_1830_p4); sensitive << ( p_Val2_4_fu_1808_p2 ); SC_METHOD(thread_p_Result_i_i_fu_1820_p4); sensitive << ( p_Val2_4_fu_1808_p2 ); SC_METHOD(thread_p_Result_s_fu_3317_p4); sensitive << ( p_Result_2_i_reg_3488 ); SC_METHOD(thread_p_Val2_4_fu_1808_p2); sensitive << ( resp_ValueConvertTem ); SC_METHOD(thread_p_cast_i_cast_cast_fu_2016_p3); sensitive << ( grp_fu_502_p2 ); SC_METHOD(thread_p_not_i_fu_1872_p2); sensitive << ( ap_start ); sensitive << ( ap_done_reg ); sensitive << ( ap_CS_iter0_fsm_state1 ); sensitive << ( valueBuffer_rf_V_V_empty_n ); sensitive << ( tmp_i_fu_541_p2 ); sensitive << ( tmp_i_82_fu_559_p2 ); sensitive << ( ap_predicate_op37_read_state1 ); sensitive << ( ap_predicate_op56_read_state1 ); sensitive << ( ap_predicate_op134_read_state1 ); sensitive << ( metadataBuffer_rf_V_s_empty_n ); sensitive << ( ap_predicate_op142_read_state1 ); sensitive << ( respOutput_V_data_V_1_ack_in ); sensitive << ( ap_block_state2_io ); sensitive << ( ap_CS_iter1_fsm_state2 ); sensitive << ( respOutput_V_user_V_1_ack_in ); sensitive << ( respOutput_V_keep_V_1_ack_in ); sensitive << ( respOutput_V_last_V_1_ack_in ); sensitive << ( ap_block_state3_io ); sensitive << ( ap_CS_iter2_fsm_state3 ); sensitive << ( errorCode ); SC_METHOD(thread_respOutput_V_data_V_1_ack_in); sensitive << ( respOutput_V_data_V_1_state ); SC_METHOD(thread_respOutput_V_data_V_1_ack_out); sensitive << ( outData_TREADY ); SC_METHOD(thread_respOutput_V_data_V_1_data_in); sensitive << ( ap_predicate_op150_write_state2 ); sensitive << ( ap_predicate_op155_write_state2 ); sensitive << ( ap_predicate_op185_write_state2 ); sensitive << ( ap_predicate_op190_write_state2 ); sensitive << ( ap_predicate_op195_write_state2 ); sensitive << ( ap_predicate_op197_write_state2 ); sensitive << ( ap_predicate_op200_write_state2 ); sensitive << ( ap_predicate_op208_write_state2 ); sensitive << ( p_Result_10_fu_2079_p1 ); sensitive << ( p_Result_9_fu_2763_p2 ); sensitive << ( p_Result_7_fu_3292_p3 ); sensitive << ( p_Result_6_fu_3304_p3 ); sensitive << ( tmp_data_V_2_fu_3312_p1 ); sensitive << ( p_Result_4_fu_3342_p5 ); sensitive << ( ap_condition_962 ); SC_METHOD(thread_respOutput_V_data_V_1_data_out); sensitive << ( respOutput_V_data_V_1_payload_A ); sensitive << ( respOutput_V_data_V_1_payload_B ); sensitive << ( respOutput_V_data_V_1_sel ); SC_METHOD(thread_respOutput_V_data_V_1_load_A); sensitive << ( respOutput_V_data_V_1_sel_wr ); sensitive << ( respOutput_V_data_V_1_state_cmp_full ); SC_METHOD(thread_respOutput_V_data_V_1_load_B); sensitive << ( respOutput_V_data_V_1_sel_wr ); sensitive << ( respOutput_V_data_V_1_state_cmp_full ); SC_METHOD(thread_respOutput_V_data_V_1_sel); sensitive << ( respOutput_V_data_V_1_sel_rd ); SC_METHOD(thread_respOutput_V_data_V_1_state_cmp_full); sensitive << ( respOutput_V_data_V_1_state ); SC_METHOD(thread_respOutput_V_data_V_1_vld_in); sensitive << ( ap_done_reg ); sensitive << ( respOutput_V_data_V_1_ack_in ); sensitive << ( ap_predicate_op150_write_state2 ); sensitive << ( ap_predicate_op155_write_state2 ); sensitive << ( ap_predicate_op185_write_state2 ); sensitive << ( ap_predicate_op190_write_state2 ); sensitive << ( ap_predicate_op195_write_state2 ); sensitive << ( ap_predicate_op197_write_state2 ); sensitive << ( ap_predicate_op200_write_state2 ); sensitive << ( ap_predicate_op208_write_state2 ); sensitive << ( ap_block_state2_io ); sensitive << ( ap_CS_iter1_fsm_state2 ); sensitive << ( respOutput_V_user_V_1_ack_in ); sensitive << ( respOutput_V_keep_V_1_ack_in ); sensitive << ( respOutput_V_last_V_1_ack_in ); sensitive << ( ap_block_state3_io ); sensitive << ( ap_CS_iter2_fsm_state3 ); SC_METHOD(thread_respOutput_V_data_V_1_vld_out); sensitive << ( respOutput_V_data_V_1_state ); SC_METHOD(thread_respOutput_V_keep_V_1_ack_in); sensitive << ( respOutput_V_keep_V_1_state ); SC_METHOD(thread_respOutput_V_keep_V_1_ack_out); sensitive << ( outData_TREADY ); SC_METHOD(thread_respOutput_V_keep_V_1_data_in); sensitive << ( ap_done_reg ); sensitive << ( respOutput_V_data_V_1_ack_in ); sensitive << ( ap_predicate_op150_write_state2 ); sensitive << ( ap_predicate_op155_write_state2 ); sensitive << ( ap_predicate_op185_write_state2 ); sensitive << ( ap_predicate_op190_write_state2 ); sensitive << ( ap_predicate_op195_write_state2 ); sensitive << ( ap_predicate_op197_write_state2 ); sensitive << ( ap_predicate_op200_write_state2 ); sensitive << ( ap_predicate_op208_write_state2 ); sensitive << ( ap_CS_iter1_fsm_state2 ); sensitive << ( respOutput_V_user_V_1_ack_in ); sensitive << ( respOutput_V_keep_V_1_ack_in ); sensitive << ( respOutput_V_last_V_1_ack_in ); sensitive << ( ap_CS_iter2_fsm_state3 ); sensitive << ( tempOutput_keep_V_5_fu_2087_p258 ); sensitive << ( tempOutput_keep_V_4_fu_2773_p258 ); sensitive << ( ap_phi_reg_pp0_iter1_tmp_keep_V_3_reg_322 ); sensitive << ( ap_phi_reg_pp0_iter1_tmp_keep_V_1_reg_352 ); SC_METHOD(thread_respOutput_V_keep_V_1_data_out); sensitive << ( respOutput_V_keep_V_1_payload_A ); sensitive << ( respOutput_V_keep_V_1_payload_B ); sensitive << ( respOutput_V_keep_V_1_sel ); SC_METHOD(thread_respOutput_V_keep_V_1_load_A); sensitive << ( respOutput_V_keep_V_1_sel_wr ); sensitive << ( respOutput_V_keep_V_1_state_cmp_full ); SC_METHOD(thread_respOutput_V_keep_V_1_load_B); sensitive << ( respOutput_V_keep_V_1_sel_wr ); sensitive << ( respOutput_V_keep_V_1_state_cmp_full ); SC_METHOD(thread_respOutput_V_keep_V_1_sel); sensitive << ( respOutput_V_keep_V_1_sel_rd ); SC_METHOD(thread_respOutput_V_keep_V_1_state_cmp_full); sensitive << ( respOutput_V_keep_V_1_state ); SC_METHOD(thread_respOutput_V_keep_V_1_vld_in); sensitive << ( ap_done_reg ); sensitive << ( respOutput_V_data_V_1_ack_in ); sensitive << ( ap_predicate_op150_write_state2 ); sensitive << ( ap_predicate_op155_write_state2 ); sensitive << ( ap_predicate_op185_write_state2 ); sensitive << ( ap_predicate_op190_write_state2 ); sensitive << ( ap_predicate_op195_write_state2 ); sensitive << ( ap_predicate_op197_write_state2 ); sensitive << ( ap_predicate_op200_write_state2 ); sensitive << ( ap_predicate_op208_write_state2 ); sensitive << ( ap_block_state2_io ); sensitive << ( ap_CS_iter1_fsm_state2 ); sensitive << ( respOutput_V_user_V_1_ack_in ); sensitive << ( respOutput_V_keep_V_1_ack_in ); sensitive << ( respOutput_V_last_V_1_ack_in ); sensitive << ( ap_block_state3_io ); sensitive << ( ap_CS_iter2_fsm_state3 ); SC_METHOD(thread_respOutput_V_keep_V_1_vld_out); sensitive << ( respOutput_V_keep_V_1_state ); SC_METHOD(thread_respOutput_V_last_V_1_ack_in); sensitive << ( respOutput_V_last_V_1_state ); SC_METHOD(thread_respOutput_V_last_V_1_ack_out); sensitive << ( outData_TREADY ); SC_METHOD(thread_respOutput_V_last_V_1_data_in); sensitive << ( ap_done_reg ); sensitive << ( respOutput_V_data_V_1_ack_in ); sensitive << ( ap_predicate_op150_write_state2 ); sensitive << ( ap_predicate_op155_write_state2 ); sensitive << ( ap_predicate_op185_write_state2 ); sensitive << ( ap_predicate_op190_write_state2 ); sensitive << ( ap_predicate_op195_write_state2 ); sensitive << ( ap_predicate_op197_write_state2 ); sensitive << ( ap_predicate_op200_write_state2 ); sensitive << ( ap_predicate_op208_write_state2 ); sensitive << ( ap_CS_iter1_fsm_state2 ); sensitive << ( respOutput_V_user_V_1_ack_in ); sensitive << ( respOutput_V_keep_V_1_ack_in ); sensitive << ( respOutput_V_last_V_1_ack_in ); sensitive << ( ap_CS_iter2_fsm_state3 ); sensitive << ( ap_phi_reg_pp0_iter1_tmp_last_V_2_reg_306 ); sensitive << ( ap_phi_reg_pp0_iter1_tmp_last_V_1_reg_336 ); sensitive << ( ap_phi_reg_pp0_iter1_tmp_last_V_reg_366 ); SC_METHOD(thread_respOutput_V_last_V_1_data_out); sensitive << ( respOutput_V_last_V_1_payload_A ); sensitive << ( respOutput_V_last_V_1_payload_B ); sensitive << ( respOutput_V_last_V_1_sel ); SC_METHOD(thread_respOutput_V_last_V_1_load_A); sensitive << ( respOutput_V_last_V_1_sel_wr ); sensitive << ( respOutput_V_last_V_1_state_cmp_full ); SC_METHOD(thread_respOutput_V_last_V_1_load_B); sensitive << ( respOutput_V_last_V_1_sel_wr ); sensitive << ( respOutput_V_last_V_1_state_cmp_full ); SC_METHOD(thread_respOutput_V_last_V_1_sel); sensitive << ( respOutput_V_last_V_1_sel_rd ); SC_METHOD(thread_respOutput_V_last_V_1_state_cmp_full); sensitive << ( respOutput_V_last_V_1_state ); SC_METHOD(thread_respOutput_V_last_V_1_vld_in); sensitive << ( ap_done_reg ); sensitive << ( respOutput_V_data_V_1_ack_in ); sensitive << ( ap_predicate_op150_write_state2 ); sensitive << ( ap_predicate_op155_write_state2 ); sensitive << ( ap_predicate_op185_write_state2 ); sensitive << ( ap_predicate_op190_write_state2 ); sensitive << ( ap_predicate_op195_write_state2 ); sensitive << ( ap_predicate_op197_write_state2 ); sensitive << ( ap_predicate_op200_write_state2 ); sensitive << ( ap_predicate_op208_write_state2 ); sensitive << ( ap_block_state2_io ); sensitive << ( ap_CS_iter1_fsm_state2 ); sensitive << ( respOutput_V_user_V_1_ack_in ); sensitive << ( respOutput_V_keep_V_1_ack_in ); sensitive << ( respOutput_V_last_V_1_ack_in ); sensitive << ( ap_block_state3_io ); sensitive << ( ap_CS_iter2_fsm_state3 ); SC_METHOD(thread_respOutput_V_last_V_1_vld_out); sensitive << ( respOutput_V_last_V_1_state ); SC_METHOD(thread_respOutput_V_user_V_1_ack_in); sensitive << ( respOutput_V_user_V_1_state ); SC_METHOD(thread_respOutput_V_user_V_1_ack_out); sensitive << ( outData_TREADY ); SC_METHOD(thread_respOutput_V_user_V_1_data_in); sensitive << ( ap_done_reg ); sensitive << ( respOutput_V_data_V_1_ack_in ); sensitive << ( ap_predicate_op150_write_state2 ); sensitive << ( ap_predicate_op155_write_state2 ); sensitive << ( ap_predicate_op185_write_state2 ); sensitive << ( ap_predicate_op190_write_state2 ); sensitive << ( ap_predicate_op195_write_state2 ); sensitive << ( ap_predicate_op197_write_state2 ); sensitive << ( ap_predicate_op200_write_state2 ); sensitive << ( ap_predicate_op208_write_state2 ); sensitive << ( ap_CS_iter1_fsm_state2 ); sensitive << ( respOutput_V_user_V_1_ack_in ); sensitive << ( respOutput_V_keep_V_1_ack_in ); sensitive << ( respOutput_V_last_V_1_ack_in ); sensitive << ( ap_CS_iter2_fsm_state3 ); sensitive << ( p_Result_5_fu_3354_p3 ); SC_METHOD(thread_respOutput_V_user_V_1_data_out); sensitive << ( respOutput_V_user_V_1_payload_A ); sensitive << ( respOutput_V_user_V_1_payload_B ); sensitive << ( respOutput_V_user_V_1_sel ); SC_METHOD(thread_respOutput_V_user_V_1_load_A); sensitive << ( respOutput_V_user_V_1_sel_wr ); sensitive << ( respOutput_V_user_V_1_state_cmp_full ); SC_METHOD(thread_respOutput_V_user_V_1_load_B); sensitive << ( respOutput_V_user_V_1_sel_wr ); sensitive << ( respOutput_V_user_V_1_state_cmp_full ); SC_METHOD(thread_respOutput_V_user_V_1_sel); sensitive << ( respOutput_V_user_V_1_sel_rd ); SC_METHOD(thread_respOutput_V_user_V_1_state_cmp_full); sensitive << ( respOutput_V_user_V_1_state ); SC_METHOD(thread_respOutput_V_user_V_1_vld_in); sensitive << ( ap_done_reg ); sensitive << ( respOutput_V_data_V_1_ack_in ); sensitive << ( ap_predicate_op150_write_state2 ); sensitive << ( ap_predicate_op155_write_state2 ); sensitive << ( ap_predicate_op185_write_state2 ); sensitive << ( ap_predicate_op190_write_state2 ); sensitive << ( ap_predicate_op195_write_state2 ); sensitive << ( ap_predicate_op197_write_state2 ); sensitive << ( ap_predicate_op200_write_state2 ); sensitive << ( ap_predicate_op208_write_state2 ); sensitive << ( ap_block_state2_io ); sensitive << ( ap_CS_iter1_fsm_state2 ); sensitive << ( respOutput_V_user_V_1_ack_in ); sensitive << ( respOutput_V_keep_V_1_ack_in ); sensitive << ( respOutput_V_last_V_1_ack_in ); sensitive << ( ap_block_state3_io ); sensitive << ( ap_CS_iter2_fsm_state3 ); SC_METHOD(thread_respOutput_V_user_V_1_vld_out); sensitive << ( respOutput_V_user_V_1_state ); SC_METHOD(thread_rev_fu_2637_p2); sensitive << ( tmp_72_fu_2629_p3 ); SC_METHOD(thread_sf_fu_2709_p4); sensitive << ( tmp_78_fu_2677_p3 ); SC_METHOD(thread_st_fu_2695_p4); sensitive << ( tmp_78_fu_2677_p3 ); SC_METHOD(thread_tempKeep_V_fu_620_p257); sensitive << ( ap_start ); sensitive << ( ap_CS_iter0_fsm_state1 ); sensitive << ( valueLength ); SC_METHOD(thread_tempOutput_data_V_fu_3335_p3); sensitive << ( tmp_8_reg_3494 ); sensitive << ( p_Result_3_fu_3326_p4 ); sensitive << ( p_Result_s_fu_3317_p4 ); SC_METHOD(thread_tempOutput_keep_V_4_fu_2773_p257); sensitive << ( ap_CS_iter1_fsm_state2 ); sensitive << ( valueLength_load_reg_3376 ); SC_METHOD(thread_tempOutput_keep_V_5_fu_2087_p257); sensitive << ( ap_CS_iter1_fsm_state2 ); sensitive << ( valueLength_load_reg_3376 ); SC_METHOD(thread_tempOutput_keep_V_fu_1218_p257); sensitive << ( ap_start ); sensitive << ( ap_CS_iter0_fsm_state1 ); sensitive << ( lengthValue_assign_fu_1208_p2 ); SC_METHOD(thread_tempVar_V_fu_1922_p4); sensitive << ( outMetadataTempBuffe ); SC_METHOD(thread_tmp1_fu_1878_p2); sensitive << ( grp_fu_512_p2 ); sensitive << ( p_not_i_fu_1872_p2 ); SC_METHOD(thread_tmp_18_i_fu_570_p2); sensitive << ( ap_start ); sensitive << ( ap_done_reg ); sensitive << ( ap_CS_iter0_fsm_state1 ); sensitive << ( valueBuffer_rf_V_V_empty_n ); sensitive << ( tmp_i_fu_541_p2 ); sensitive << ( tmp_i_82_fu_559_p2 ); sensitive << ( ap_predicate_op37_read_state1 ); sensitive << ( ap_predicate_op56_read_state1 ); sensitive << ( ap_predicate_op134_read_state1 ); sensitive << ( metadataBuffer_rf_V_s_empty_n ); sensitive << ( ap_predicate_op142_read_state1 ); sensitive << ( respOutput_V_data_V_1_ack_in ); sensitive << ( ap_block_state2_io ); sensitive << ( ap_CS_iter1_fsm_state2 ); sensitive << ( respOutput_V_user_V_1_ack_in ); sensitive << ( respOutput_V_keep_V_1_ack_in ); sensitive << ( respOutput_V_last_V_1_ack_in ); sensitive << ( ap_block_state3_io ); sensitive << ( ap_CS_iter2_fsm_state3 ); sensitive << ( tmp_58_fu_537_p1 ); SC_METHOD(thread_tmp_19_i_fu_1932_p2); sensitive << ( p_Result_i_83_fu_1912_p4 ); SC_METHOD(thread_tmp_20_i_fu_1944_p2); sensitive << ( tempVar_V_fu_1922_p4 ); SC_METHOD(thread_tmp_22_i_fu_1772_p2); sensitive << ( outOpCode ); sensitive << ( errorCode ); SC_METHOD(thread_tmp_23_i_fu_1778_p2); sensitive << ( ap_start ); sensitive << ( ap_done_reg ); sensitive << ( ap_CS_iter0_fsm_state1 ); sensitive << ( valueBuffer_rf_V_V_empty_n ); sensitive << ( tmp_i_fu_541_p2 ); sensitive << ( tmp_i_82_fu_559_p2 ); sensitive << ( tmp_18_i_fu_570_p2 ); sensitive << ( ap_predicate_op37_read_state1 ); sensitive << ( ap_predicate_op56_read_state1 ); sensitive << ( ap_predicate_op134_read_state1 ); sensitive << ( metadataBuffer_rf_V_s_empty_n ); sensitive << ( ap_predicate_op142_read_state1 ); sensitive << ( respOutput_V_data_V_1_ack_in ); sensitive << ( ap_block_state2_io ); sensitive << ( ap_CS_iter1_fsm_state2 ); sensitive << ( respOutput_V_user_V_1_ack_in ); sensitive << ( respOutput_V_keep_V_1_ack_in ); sensitive << ( respOutput_V_last_V_1_ack_in ); sensitive << ( ap_block_state3_io ); sensitive << ( ap_CS_iter2_fsm_state3 ); sensitive << ( tmp_22_i_fu_1772_p2 ); SC_METHOD(thread_tmp_24_i_fu_576_p2); sensitive << ( ap_start ); sensitive << ( ap_done_reg ); sensitive << ( ap_CS_iter0_fsm_state1 ); sensitive << ( valueBuffer_rf_V_V_empty_n ); sensitive << ( tmp_i_fu_541_p2 ); sensitive << ( tmp_i_82_fu_559_p2 ); sensitive << ( tmp_18_i_fu_570_p2 ); sensitive << ( ap_predicate_op37_read_state1 ); sensitive << ( ap_predicate_op56_read_state1 ); sensitive << ( ap_predicate_op134_read_state1 ); sensitive << ( metadataBuffer_rf_V_s_empty_n ); sensitive << ( ap_predicate_op142_read_state1 ); sensitive << ( respOutput_V_data_V_1_ack_in ); sensitive << ( ap_block_state2_io ); sensitive << ( ap_CS_iter1_fsm_state2 ); sensitive << ( respOutput_V_user_V_1_ack_in ); sensitive << ( respOutput_V_keep_V_1_ack_in ); sensitive << ( respOutput_V_last_V_1_ack_in ); sensitive << ( ap_block_state3_io ); sensitive << ( ap_CS_iter2_fsm_state3 ); sensitive << ( tmp_58_fu_537_p1 ); SC_METHOD(thread_tmp_28_i_fu_497_p2); sensitive << ( ap_start ); sensitive << ( ap_done_reg ); sensitive << ( ap_CS_iter0_fsm_state1 ); sensitive << ( valueBuffer_rf_V_V_empty_n ); sensitive << ( tmp_i_fu_541_p2 ); sensitive << ( tmp_i_82_fu_559_p2 ); sensitive << ( tmp_18_i_fu_570_p2 ); sensitive << ( tmp_24_i_fu_576_p2 ); sensitive << ( ap_predicate_op37_read_state1 ); sensitive << ( ap_predicate_op56_read_state1 ); sensitive << ( ap_predicate_op134_read_state1 ); sensitive << ( metadataBuffer_rf_V_s_empty_n ); sensitive << ( ap_predicate_op142_read_state1 ); sensitive << ( respOutput_V_data_V_1_ack_in ); sensitive << ( ap_block_state2_io ); sensitive << ( ap_CS_iter1_fsm_state2 ); sensitive << ( respOutput_V_user_V_1_ack_in ); sensitive << ( respOutput_V_keep_V_1_ack_in ); sensitive << ( respOutput_V_last_V_1_ack_in ); sensitive << ( ap_block_state3_io ); sensitive << ( ap_CS_iter2_fsm_state3 ); sensitive << ( errorCode ); SC_METHOD(thread_tmp_29_i_fu_582_p2); sensitive << ( ap_start ); sensitive << ( ap_done_reg ); sensitive << ( ap_CS_iter0_fsm_state1 ); sensitive << ( valueBuffer_rf_V_V_empty_n ); sensitive << ( tmp_i_fu_541_p2 ); sensitive << ( tmp_i_82_fu_559_p2 ); sensitive << ( tmp_18_i_fu_570_p2 ); sensitive << ( tmp_24_i_fu_576_p2 ); sensitive << ( ap_predicate_op37_read_state1 ); sensitive << ( ap_predicate_op56_read_state1 ); sensitive << ( ap_predicate_op134_read_state1 ); sensitive << ( metadataBuffer_rf_V_s_empty_n ); sensitive << ( ap_predicate_op142_read_state1 ); sensitive << ( respOutput_V_data_V_1_ack_in ); sensitive << ( ap_block_state2_io ); sensitive << ( ap_CS_iter1_fsm_state2 ); sensitive << ( respOutput_V_user_V_1_ack_in ); sensitive << ( respOutput_V_keep_V_1_ack_in ); sensitive << ( respOutput_V_last_V_1_ack_in ); sensitive << ( ap_block_state3_io ); sensitive << ( ap_CS_iter2_fsm_state3 ); sensitive << ( tmp_58_fu_537_p1 ); SC_METHOD(thread_tmp_30_i_fu_1998_p2); sensitive << ( ap_start ); sensitive << ( ap_done_reg ); sensitive << ( ap_CS_iter0_fsm_state1 ); sensitive << ( valueBuffer_rf_V_V_empty_n ); sensitive << ( tmp_i_fu_541_p2 ); sensitive << ( tmp_i_82_fu_559_p2 ); sensitive << ( ap_predicate_op37_read_state1 ); sensitive << ( ap_predicate_op56_read_state1 ); sensitive << ( or_cond2_i_fu_1902_p2 ); sensitive << ( ap_predicate_op134_read_state1 ); sensitive << ( metadataBuffer_rf_V_s_empty_n ); sensitive << ( ap_predicate_op142_read_state1 ); sensitive << ( respOutput_V_data_V_1_ack_in ); sensitive << ( ap_block_state2_io ); sensitive << ( ap_CS_iter1_fsm_state2 ); sensitive << ( respOutput_V_user_V_1_ack_in ); sensitive << ( respOutput_V_keep_V_1_ack_in ); sensitive << ( respOutput_V_last_V_1_ack_in ); sensitive << ( ap_block_state3_io ); sensitive << ( ap_CS_iter2_fsm_state3 ); sensitive << ( outOpCode ); SC_METHOD(thread_tmp_31_i_fu_588_p2); sensitive << ( ap_start ); sensitive << ( ap_done_reg ); sensitive << ( ap_CS_iter0_fsm_state1 ); sensitive << ( valueBuffer_rf_V_V_empty_n ); sensitive << ( tmp_i_fu_541_p2 ); sensitive << ( tmp_i_82_fu_559_p2 ); sensitive << ( tmp_18_i_fu_570_p2 ); sensitive << ( tmp_24_i_fu_576_p2 ); sensitive << ( tmp_29_i_fu_582_p2 ); sensitive << ( ap_predicate_op37_read_state1 ); sensitive << ( ap_predicate_op56_read_state1 ); sensitive << ( ap_predicate_op134_read_state1 ); sensitive << ( metadataBuffer_rf_V_s_empty_n ); sensitive << ( ap_predicate_op142_read_state1 ); sensitive << ( respOutput_V_data_V_1_ack_in ); sensitive << ( ap_block_state2_io ); sensitive << ( ap_CS_iter1_fsm_state2 ); sensitive << ( respOutput_V_user_V_1_ack_in ); sensitive << ( respOutput_V_keep_V_1_ack_in ); sensitive << ( respOutput_V_last_V_1_ack_in ); sensitive << ( ap_block_state3_io ); sensitive << ( ap_CS_iter2_fsm_state3 ); sensitive << ( tmp_58_fu_537_p1 ); SC_METHOD(thread_tmp_34_i_fu_606_p2); sensitive << ( ap_start ); sensitive << ( ap_done_reg ); sensitive << ( ap_CS_iter0_fsm_state1 ); sensitive << ( valueBuffer_rf_V_V_empty_n ); sensitive << ( tmp_i_fu_541_p2 ); sensitive << ( tmp_i_82_fu_559_p2 ); sensitive << ( tmp_18_i_fu_570_p2 ); sensitive << ( tmp_24_i_fu_576_p2 ); sensitive << ( tmp_29_i_fu_582_p2 ); sensitive << ( tmp_31_i_fu_588_p2 ); sensitive << ( ap_predicate_op37_read_state1 ); sensitive << ( ap_predicate_op56_read_state1 ); sensitive << ( ap_predicate_op134_read_state1 ); sensitive << ( metadataBuffer_rf_V_s_empty_n ); sensitive << ( ap_predicate_op142_read_state1 ); sensitive << ( respOutput_V_data_V_1_ack_in ); sensitive << ( ap_block_state2_io ); sensitive << ( ap_CS_iter1_fsm_state2 ); sensitive << ( respOutput_V_user_V_1_ack_in ); sensitive << ( respOutput_V_keep_V_1_ack_in ); sensitive << ( respOutput_V_last_V_1_ack_in ); sensitive << ( ap_block_state3_io ); sensitive << ( ap_CS_iter2_fsm_state3 ); sensitive << ( valueLength ); SC_METHOD(thread_tmp_35_i_fu_594_p2); sensitive << ( ap_start ); sensitive << ( ap_done_reg ); sensitive << ( ap_CS_iter0_fsm_state1 ); sensitive << ( valueBuffer_rf_V_V_empty_n ); sensitive << ( tmp_i_fu_541_p2 ); sensitive << ( tmp_i_82_fu_559_p2 ); sensitive << ( tmp_18_i_fu_570_p2 ); sensitive << ( tmp_24_i_fu_576_p2 ); sensitive << ( tmp_29_i_fu_582_p2 ); sensitive << ( tmp_31_i_fu_588_p2 ); sensitive << ( ap_predicate_op37_read_state1 ); sensitive << ( ap_predicate_op56_read_state1 ); sensitive << ( ap_predicate_op134_read_state1 ); sensitive << ( metadataBuffer_rf_V_s_empty_n ); sensitive << ( ap_predicate_op142_read_state1 ); sensitive << ( respOutput_V_data_V_1_ack_in ); sensitive << ( ap_block_state2_io ); sensitive << ( ap_CS_iter1_fsm_state2 ); sensitive << ( respOutput_V_user_V_1_ack_in ); sensitive << ( respOutput_V_keep_V_1_ack_in ); sensitive << ( respOutput_V_last_V_1_ack_in ); sensitive << ( ap_block_state3_io ); sensitive << ( ap_CS_iter2_fsm_state3 ); sensitive << ( tmp_58_fu_537_p1 ); SC_METHOD(thread_tmp_38_i_fu_1192_p2); sensitive << ( valueLength ); SC_METHOD(thread_tmp_41_i_fu_600_p2); sensitive << ( ap_start ); sensitive << ( ap_done_reg ); sensitive << ( ap_CS_iter0_fsm_state1 ); sensitive << ( valueBuffer_rf_V_V_empty_n ); sensitive << ( tmp_i_fu_541_p2 ); sensitive << ( tmp_i_82_fu_559_p2 ); sensitive << ( tmp_18_i_fu_570_p2 ); sensitive << ( tmp_24_i_fu_576_p2 ); sensitive << ( tmp_29_i_fu_582_p2 ); sensitive << ( tmp_31_i_fu_588_p2 ); sensitive << ( ap_predicate_op37_read_state1 ); sensitive << ( ap_predicate_op56_read_state1 ); sensitive << ( ap_predicate_op134_read_state1 ); sensitive << ( metadataBuffer_rf_V_s_empty_n ); sensitive << ( ap_predicate_op142_read_state1 ); sensitive << ( respOutput_V_data_V_1_ack_in ); sensitive << ( ap_block_state2_io ); sensitive << ( ap_CS_iter1_fsm_state2 ); sensitive << ( respOutput_V_user_V_1_ack_in ); sensitive << ( respOutput_V_keep_V_1_ack_in ); sensitive << ( respOutput_V_last_V_1_ack_in ); sensitive << ( ap_block_state3_io ); sensitive << ( ap_CS_iter2_fsm_state3 ); sensitive << ( tmp_35_i_fu_594_p2 ); sensitive << ( tmp_58_fu_537_p1 ); SC_METHOD(thread_tmp_43_i_fu_1138_p2); sensitive << ( ap_start ); sensitive << ( ap_done_reg ); sensitive << ( ap_CS_iter0_fsm_state1 ); sensitive << ( valueBuffer_rf_V_V_empty_n ); sensitive << ( ap_predicate_op37_read_state1 ); sensitive << ( ap_predicate_op56_read_state1 ); sensitive << ( ap_predicate_op134_read_state1 ); sensitive << ( metadataBuffer_rf_V_s_empty_n ); sensitive << ( ap_predicate_op142_read_state1 ); sensitive << ( respOutput_V_data_V_1_ack_in ); sensitive << ( ap_block_state2_io ); sensitive << ( ap_CS_iter1_fsm_state2 ); sensitive << ( respOutput_V_user_V_1_ack_in ); sensitive << ( respOutput_V_keep_V_1_ack_in ); sensitive << ( respOutput_V_last_V_1_ack_in ); sensitive << ( ap_block_state3_io ); sensitive << ( ap_CS_iter2_fsm_state3 ); sensitive << ( valueLength ); SC_METHOD(thread_tmp_44_i_fu_1144_p2); sensitive << ( valueLength ); SC_METHOD(thread_tmp_45_i_fu_1150_p3); sensitive << ( tmp_43_i_fu_1138_p2 ); sensitive << ( tmp_44_i_fu_1144_p2 ); SC_METHOD(thread_tmp_46_i_fu_1164_p2); sensitive << ( ap_start ); sensitive << ( ap_done_reg ); sensitive << ( ap_CS_iter0_fsm_state1 ); sensitive << ( valueBuffer_rf_V_V_empty_n ); sensitive << ( ap_predicate_op37_read_state1 ); sensitive << ( ap_predicate_op56_read_state1 ); sensitive << ( ap_predicate_op134_read_state1 ); sensitive << ( metadataBuffer_rf_V_s_empty_n ); sensitive << ( ap_predicate_op142_read_state1 ); sensitive << ( respOutput_V_data_V_1_ack_in ); sensitive << ( ap_block_state2_io ); sensitive << ( ap_CS_iter1_fsm_state2 ); sensitive << ( respOutput_V_user_V_1_ack_in ); sensitive << ( respOutput_V_keep_V_1_ack_in ); sensitive << ( respOutput_V_last_V_1_ack_in ); sensitive << ( ap_block_state3_io ); sensitive << ( ap_CS_iter2_fsm_state3 ); sensitive << ( tmp_45_i_fu_1150_p3 ); SC_METHOD(thread_tmp_48_i_fu_2609_p3); sensitive << ( tmp_71_fu_2606_p1 ); SC_METHOD(thread_tmp_50_i_fu_1170_p2); sensitive << ( ap_start ); sensitive << ( ap_done_reg ); sensitive << ( ap_CS_iter0_fsm_state1 ); sensitive << ( valueBuffer_rf_V_V_empty_n ); sensitive << ( tmp_i_fu_541_p2 ); sensitive << ( tmp_i_82_fu_559_p2 ); sensitive << ( tmp_18_i_fu_570_p2 ); sensitive << ( tmp_24_i_fu_576_p2 ); sensitive << ( tmp_29_i_fu_582_p2 ); sensitive << ( tmp_31_i_fu_588_p2 ); sensitive << ( tmp_34_i_fu_606_p2 ); sensitive << ( grp_nbreadreq_fu_256_p3 ); sensitive << ( ap_predicate_op37_read_state1 ); sensitive << ( ap_predicate_op56_read_state1 ); sensitive << ( ap_predicate_op134_read_state1 ); sensitive << ( metadataBuffer_rf_V_s_empty_n ); sensitive << ( ap_predicate_op142_read_state1 ); sensitive << ( respOutput_V_data_V_1_ack_in ); sensitive << ( ap_block_state2_io ); sensitive << ( ap_CS_iter1_fsm_state2 ); sensitive << ( respOutput_V_user_V_1_ack_in ); sensitive << ( respOutput_V_keep_V_1_ack_in ); sensitive << ( respOutput_V_last_V_1_ack_in ); sensitive << ( ap_block_state3_io ); sensitive << ( ap_CS_iter2_fsm_state3 ); sensitive << ( tmp_46_i_fu_1164_p2 ); sensitive << ( tmp_45_i_fu_1150_p3 ); SC_METHOD(thread_tmp_58_fu_537_p1); sensitive << ( br_outWordCounter ); SC_METHOD(thread_tmp_59_fu_1850_p1); sensitive << ( p_Val2_4_fu_1808_p2 ); SC_METHOD(thread_tmp_60_fu_1736_p2); sensitive << ( ap_start ); sensitive << ( ap_done_reg ); sensitive << ( ap_CS_iter0_fsm_state1 ); sensitive << ( valueBuffer_rf_V_V_empty_n ); sensitive << ( tmp_i_fu_541_p2 ); sensitive << ( tmp_i_82_fu_559_p2 ); sensitive << ( tmp_18_i_fu_570_p2 ); sensitive << ( tmp_24_i_fu_576_p2 ); sensitive << ( ap_predicate_op37_read_state1 ); sensitive << ( ap_predicate_op56_read_state1 ); sensitive << ( ap_predicate_op134_read_state1 ); sensitive << ( metadataBuffer_rf_V_s_empty_n ); sensitive << ( ap_predicate_op142_read_state1 ); sensitive << ( respOutput_V_data_V_1_ack_in ); sensitive << ( ap_block_state2_io ); sensitive << ( ap_CS_iter1_fsm_state2 ); sensitive << ( respOutput_V_user_V_1_ack_in ); sensitive << ( respOutput_V_keep_V_1_ack_in ); sensitive << ( respOutput_V_last_V_1_ack_in ); sensitive << ( ap_block_state3_io ); sensitive << ( ap_CS_iter2_fsm_state3 ); sensitive << ( outOpCode ); sensitive << ( tmp_28_i_fu_497_p2 ); SC_METHOD(thread_tmp_62_fu_1742_p2); sensitive << ( grp_fu_507_p2 ); sensitive << ( tmp_60_fu_1736_p2 ); SC_METHOD(thread_tmp_63_fu_1748_p2); sensitive << ( ap_start ); sensitive << ( ap_done_reg ); sensitive << ( ap_CS_iter0_fsm_state1 ); sensitive << ( valueBuffer_rf_V_V_empty_n ); sensitive << ( tmp_i_fu_541_p2 ); sensitive << ( tmp_i_82_fu_559_p2 ); sensitive << ( tmp_18_i_fu_570_p2 ); sensitive << ( tmp_24_i_fu_576_p2 ); sensitive << ( ap_predicate_op37_read_state1 ); sensitive << ( ap_predicate_op56_read_state1 ); sensitive << ( ap_predicate_op134_read_state1 ); sensitive << ( metadataBuffer_rf_V_s_empty_n ); sensitive << ( ap_predicate_op142_read_state1 ); sensitive << ( respOutput_V_data_V_1_ack_in ); sensitive << ( ap_block_state2_io ); sensitive << ( ap_CS_iter1_fsm_state2 ); sensitive << ( respOutput_V_user_V_1_ack_in ); sensitive << ( respOutput_V_keep_V_1_ack_in ); sensitive << ( respOutput_V_last_V_1_ack_in ); sensitive << ( ap_block_state3_io ); sensitive << ( ap_CS_iter2_fsm_state3 ); sensitive << ( outOpCode ); sensitive << ( tmp_28_i_fu_497_p2 ); SC_METHOD(thread_tmp_64_fu_1754_p2); sensitive << ( tmp_63_fu_1748_p2 ); sensitive << ( tmp_62_fu_1742_p2 ); SC_METHOD(thread_tmp_65_fu_3300_p1); sensitive << ( xtrasBuffer_V ); SC_METHOD(thread_tmp_66_fu_1182_p1); sensitive << ( valueBuffer_rf_V_V_dout ); SC_METHOD(thread_tmp_67_fu_1204_p1); sensitive << ( valueLength ); SC_METHOD(thread_tmp_69_fu_612_p1); sensitive << ( valueBuffer_rf_V_V_dout ); SC_METHOD(thread_tmp_71_fu_2606_p1); sensitive << ( valueLength_load_reg_3376 ); SC_METHOD(thread_tmp_72_fu_2629_p3); sensitive << ( Hi_assign_2_fu_2623_p2 ); SC_METHOD(thread_tmp_73_fu_2643_p1); sensitive << ( Hi_assign_2_fu_2623_p2 ); SC_METHOD(thread_tmp_74_fu_2647_p4); sensitive << ( xtrasBuffer_V ); SC_METHOD(thread_tmp_75_fu_2657_p2); sensitive << ( tmp_73_fu_2643_p1 ); SC_METHOD(thread_tmp_76_fu_2663_p2); sensitive << ( tmp_73_fu_2643_p1 ); SC_METHOD(thread_tmp_77_fu_2669_p3); sensitive << ( rev_fu_2637_p2 ); sensitive << ( tmp_75_fu_2657_p2 ); sensitive << ( tmp_76_fu_2663_p2 ); SC_METHOD(thread_tmp_78_fu_2677_p3); sensitive << ( xtrasBuffer_V ); sensitive << ( rev_fu_2637_p2 ); sensitive << ( tmp_74_fu_2647_p4 ); SC_METHOD(thread_tmp_79_fu_2685_p2); sensitive << ( tmp_77_fu_2669_p3 ); SC_METHOD(thread_tmp_7_fu_1976_p2); sensitive << ( outOpCode ); sensitive << ( errorCode ); SC_METHOD(thread_tmp_80_fu_2691_p1); sensitive << ( tmp_79_fu_2685_p2 ); SC_METHOD(thread_tmp_81_fu_2705_p1); sensitive << ( st_fu_2695_p4 ); SC_METHOD(thread_tmp_82_fu_2719_p1); sensitive << ( sf_fu_2709_p4 ); SC_METHOD(thread_tmp_83_fu_2723_p3); sensitive << ( rev_fu_2637_p2 ); sensitive << ( tmp_81_fu_2705_p1 ); sensitive << ( tmp_82_fu_2719_p1 ); SC_METHOD(thread_tmp_84_fu_2731_p2); sensitive << ( tmp_80_fu_2691_p1 ); SC_METHOD(thread_tmp_86_fu_2743_p1); sensitive << ( Hi_assign_fu_2617_p2 ); SC_METHOD(thread_tmp_87_fu_2747_p2); sensitive << ( tmp_86_fu_2743_p1 ); SC_METHOD(thread_tmp_88_fu_2753_p1); sensitive << ( tmp_87_fu_2747_p2 ); SC_METHOD(thread_tmp_89_fu_2757_p2); sensitive << ( tmp_88_fu_2753_p1 ); SC_METHOD(thread_tmp_8_fu_1982_p2); sensitive << ( ap_start ); sensitive << ( ap_done_reg ); sensitive << ( ap_CS_iter0_fsm_state1 ); sensitive << ( valueBuffer_rf_V_V_empty_n ); sensitive << ( tmp_i_fu_541_p2 ); sensitive << ( tmp_i_82_fu_559_p2 ); sensitive << ( ap_predicate_op37_read_state1 ); sensitive << ( ap_predicate_op56_read_state1 ); sensitive << ( or_cond2_i_fu_1902_p2 ); sensitive << ( ap_predicate_op134_read_state1 ); sensitive << ( metadataBuffer_rf_V_s_empty_n ); sensitive << ( ap_predicate_op142_read_state1 ); sensitive << ( respOutput_V_data_V_1_ack_in ); sensitive << ( ap_block_state2_io ); sensitive << ( ap_CS_iter1_fsm_state2 ); sensitive << ( respOutput_V_user_V_1_ack_in ); sensitive << ( respOutput_V_keep_V_1_ack_in ); sensitive << ( respOutput_V_last_V_1_ack_in ); sensitive << ( ap_block_state3_io ); sensitive << ( ap_CS_iter2_fsm_state3 ); sensitive << ( tmp_7_fu_1976_p2 ); SC_METHOD(thread_tmp_data_V_2_fu_3312_p1); sensitive << ( ap_phi_reg_pp0_iter1_tmp_data_V_1_reg_385 ); SC_METHOD(thread_tmp_i_82_fu_559_p2); sensitive << ( ap_start ); sensitive << ( ap_done_reg ); sensitive << ( ap_CS_iter0_fsm_state1 ); sensitive << ( valueBuffer_rf_V_V_empty_n ); sensitive << ( tmp_i_fu_541_p2 ); sensitive << ( ap_predicate_op37_read_state1 ); sensitive << ( ap_predicate_op56_read_state1 ); sensitive << ( ap_predicate_op134_read_state1 ); sensitive << ( metadataBuffer_rf_V_s_empty_n ); sensitive << ( ap_predicate_op142_read_state1 ); sensitive << ( respOutput_V_data_V_1_ack_in ); sensitive << ( ap_block_state2_io ); sensitive << ( ap_CS_iter1_fsm_state2 ); sensitive << ( respOutput_V_user_V_1_ack_in ); sensitive << ( respOutput_V_keep_V_1_ack_in ); sensitive << ( respOutput_V_last_V_1_ack_in ); sensitive << ( ap_block_state3_io ); sensitive << ( ap_CS_iter2_fsm_state3 ); sensitive << ( tmp_58_fu_537_p1 ); SC_METHOD(thread_tmp_i_fu_541_p2); sensitive << ( ap_start ); sensitive << ( ap_done_reg ); sensitive << ( ap_CS_iter0_fsm_state1 ); sensitive << ( valueBuffer_rf_V_V_empty_n ); sensitive << ( ap_predicate_op37_read_state1 ); sensitive << ( ap_predicate_op56_read_state1 ); sensitive << ( ap_predicate_op134_read_state1 ); sensitive << ( metadataBuffer_rf_V_s_empty_n ); sensitive << ( ap_predicate_op142_read_state1 ); sensitive << ( respOutput_V_data_V_1_ack_in ); sensitive << ( ap_block_state2_io ); sensitive << ( ap_CS_iter1_fsm_state2 ); sensitive << ( respOutput_V_user_V_1_ack_in ); sensitive << ( respOutput_V_keep_V_1_ack_in ); sensitive << ( respOutput_V_last_V_1_ack_in ); sensitive << ( ap_block_state3_io ); sensitive << ( ap_CS_iter2_fsm_state3 ); sensitive << ( tmp_58_fu_537_p1 ); SC_METHOD(thread_tmp_i_i_fu_1854_p5); sensitive << ( tmp_59_fu_1850_p1 ); sensitive << ( p_Result_56_i_i_fu_1840_p4 ); sensitive << ( p_Result_i_i_84_fu_1830_p4 ); sensitive << ( p_Result_i_i_fu_1820_p4 ); SC_METHOD(thread_tmp_nbreadreq_fu_270_p3); sensitive << ( metadataBuffer_rf_V_s_empty_n ); SC_METHOD(thread_valueBuffer_rf_V_V_blk_n); sensitive << ( ap_start ); sensitive << ( ap_done_reg ); sensitive << ( ap_CS_iter0_fsm_state1 ); sensitive << ( valueBuffer_rf_V_V_empty_n ); sensitive << ( ap_predicate_op37_read_state1 ); sensitive << ( ap_predicate_op56_read_state1 ); sensitive << ( ap_predicate_op134_read_state1 ); SC_METHOD(thread_valueBuffer_rf_V_V_read); sensitive << ( ap_start ); sensitive << ( ap_done_reg ); sensitive << ( ap_CS_iter0_fsm_state1 ); sensitive << ( valueBuffer_rf_V_V_empty_n ); sensitive << ( ap_predicate_op37_read_state1 ); sensitive << ( ap_predicate_op56_read_state1 ); sensitive << ( ap_predicate_op134_read_state1 ); sensitive << ( metadataBuffer_rf_V_s_empty_n ); sensitive << ( ap_predicate_op142_read_state1 ); sensitive << ( respOutput_V_data_V_1_ack_in ); sensitive << ( ap_block_state2_io ); sensitive << ( ap_CS_iter1_fsm_state2 ); sensitive << ( respOutput_V_user_V_1_ack_in ); sensitive << ( respOutput_V_keep_V_1_ack_in ); sensitive << ( respOutput_V_last_V_1_ack_in ); sensitive << ( ap_block_state3_io ); sensitive << ( ap_CS_iter2_fsm_state3 ); SC_METHOD(thread_ap_NS_iter0_fsm); sensitive << ( ap_start ); sensitive << ( ap_done_reg ); sensitive << ( ap_CS_iter0_fsm ); sensitive << ( valueBuffer_rf_V_V_empty_n ); sensitive << ( ap_predicate_op37_read_state1 ); sensitive << ( ap_predicate_op56_read_state1 ); sensitive << ( ap_predicate_op134_read_state1 ); sensitive << ( metadataBuffer_rf_V_s_empty_n ); sensitive << ( ap_predicate_op142_read_state1 ); sensitive << ( respOutput_V_data_V_1_ack_in ); sensitive << ( ap_block_state2_io ); sensitive << ( ap_CS_iter1_fsm_state2 ); sensitive << ( respOutput_V_user_V_1_ack_in ); sensitive << ( respOutput_V_keep_V_1_ack_in ); sensitive << ( respOutput_V_last_V_1_ack_in ); sensitive << ( ap_block_state3_io ); sensitive << ( ap_CS_iter2_fsm_state3 ); SC_METHOD(thread_ap_NS_iter1_fsm); sensitive << ( ap_start ); sensitive << ( ap_done_reg ); sensitive << ( ap_CS_iter0_fsm_state1 ); sensitive << ( ap_CS_iter1_fsm ); sensitive << ( valueBuffer_rf_V_V_empty_n ); sensitive << ( ap_predicate_op37_read_state1 ); sensitive << ( ap_predicate_op56_read_state1 ); sensitive << ( ap_predicate_op134_read_state1 ); sensitive << ( metadataBuffer_rf_V_s_empty_n ); sensitive << ( ap_predicate_op142_read_state1 ); sensitive << ( respOutput_V_data_V_1_ack_in ); sensitive << ( ap_block_state2_io ); sensitive << ( ap_CS_iter1_fsm_state2 ); sensitive << ( respOutput_V_user_V_1_ack_in ); sensitive << ( respOutput_V_keep_V_1_ack_in ); sensitive << ( respOutput_V_last_V_1_ack_in ); sensitive << ( ap_block_state3_io ); sensitive << ( ap_CS_iter2_fsm_state3 ); SC_METHOD(thread_ap_NS_iter2_fsm); sensitive << ( ap_done_reg ); sensitive << ( ap_CS_iter2_fsm ); sensitive << ( respOutput_V_data_V_1_ack_in ); sensitive << ( ap_block_state2_io ); sensitive << ( ap_CS_iter1_fsm_state2 ); sensitive << ( respOutput_V_user_V_1_ack_in ); sensitive << ( respOutput_V_keep_V_1_ack_in ); sensitive << ( respOutput_V_last_V_1_ack_in ); sensitive << ( ap_block_state3_io ); sensitive << ( ap_CS_iter2_fsm_state3 ); SC_THREAD(thread_ap_var_for_const0); SC_THREAD(thread_ap_var_for_const1); SC_THREAD(thread_ap_var_for_const2); SC_THREAD(thread_ap_var_for_const3); SC_THREAD(thread_ap_var_for_const4); SC_THREAD(thread_ap_var_for_const5); SC_THREAD(thread_ap_var_for_const6); SC_THREAD(thread_ap_var_for_const7); ap_done_reg = SC_LOGIC_0; ap_CS_iter0_fsm = "1"; ap_CS_iter1_fsm = "01"; ap_CS_iter2_fsm = "01"; tmp_i_reg_3368 = "0"; tmp_i_82_reg_3372 = "0"; tmp_18_i_reg_3383 = "0"; tmp_24_i_reg_3387 = "0"; tmp_29_i_reg_3391 = "0"; tmp_31_i_reg_3395 = "0"; tmp_35_i_reg_3399 = "0"; tmp_41_i_reg_3403 = "0"; tmp_34_i_reg_3407 = "0"; tmp_39_i_reg_3415 = "0"; tmp_6_reg_3411 = "0"; tmp_5_reg_3437 = "0"; or_cond2_i_reg_3479 = "0"; tmp_i_reg_3368_pp0_iter1_reg = "0"; tmp_i_82_reg_3372_pp0_iter1_reg = "0"; tmp_18_i_reg_3383_pp0_iter1_reg = "0"; tmp_24_i_reg_3387_pp0_iter1_reg = "0"; tmp_29_i_reg_3391_pp0_iter1_reg = "0"; tmp_31_i_reg_3395_pp0_iter1_reg = "0"; tmp_35_i_reg_3399_pp0_iter1_reg = "0"; tmp_41_i_reg_3403_pp0_iter1_reg = "0"; tmp_34_i_reg_3407_pp0_iter1_reg = "0"; tmp_39_i_reg_3415_pp0_iter1_reg = "0"; tmp_6_reg_3411_pp0_iter1_reg = "0"; tmp_5_reg_3437_pp0_iter1_reg = "0"; or_cond2_i_reg_3479_pp0_iter1_reg = "0"; respOutput_V_data_V_1_payload_A = "0000000000000000000000000000000000000000000000000000000000000000"; respOutput_V_data_V_1_payload_B = "0000000000000000000000000000000000000000000000000000000000000000"; respOutput_V_data_V_1_sel_rd = SC_LOGIC_0; respOutput_V_data_V_1_sel_wr = SC_LOGIC_0; respOutput_V_data_V_1_state = "00"; respOutput_V_user_V_1_payload_A = "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"; respOutput_V_user_V_1_payload_B = "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"; respOutput_V_user_V_1_sel_rd = SC_LOGIC_0; respOutput_V_user_V_1_sel_wr = SC_LOGIC_0; respOutput_V_user_V_1_state = "00"; respOutput_V_keep_V_1_payload_A = "00000000"; respOutput_V_keep_V_1_payload_B = "00000000"; respOutput_V_keep_V_1_sel_rd = SC_LOGIC_0; respOutput_V_keep_V_1_sel_wr = SC_LOGIC_0; respOutput_V_keep_V_1_state = "00"; respOutput_V_last_V_1_payload_A = "0"; respOutput_V_last_V_1_payload_B = "0"; respOutput_V_last_V_1_sel_rd = SC_LOGIC_0; respOutput_V_last_V_1_sel_wr = SC_LOGIC_0; respOutput_V_last_V_1_state = "00"; br_outWordCounter = "00000"; outOpCode = "00000000"; errorCode = "00000000"; outMetadataTempBuffe = "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"; valueLength = "0000000000000000"; xtrasBuffer_V = "0000000000000000000000000000000000000000000000000000000000000000"; resp_ValueConvertTem = "00000000000000000000000000000000"; valueLength_load_reg_3376 = "0000000000000000"; tmp_69_reg_3419 = "00000000000000000000000000000000"; tmp_66_reg_3441 = "00000000000000000000000000000000"; p_Result_1_i_reg_3483 = "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"; p_Result_2_i_reg_3488 = "00000000"; tmp_8_reg_3494 = "0"; p_Result_8_i_reg_3499 = "00000000"; ap_phi_reg_pp0_iter1_tmp_last_V_2_reg_306 = "0"; ap_phi_reg_pp0_iter1_tmp_keep_V_3_reg_322 = "00000000"; ap_phi_reg_pp0_iter1_tmp_last_V_1_reg_336 = "0"; ap_phi_reg_pp0_iter1_tmp_keep_V_1_reg_352 = "00000000"; ap_phi_reg_pp0_iter1_tmp_last_V_reg_366 = "0"; ap_phi_reg_pp0_iter1_tmp_data_V_1_reg_385 = "00000000000000000000000000000000"; ap_phi_reg_pp0_iter1_xtrasBuffer_V_new_i_reg_394 = "0000000000000000000000000000000000000000000000000000000000000000"; ap_phi_reg_pp0_iter1_p_0492_1_i_reg_405 = "0000000000000000"; ap_phi_reg_pp0_iter1_xtrasBuffer_V_flag_8_reg_414 = "0"; ap_phi_reg_pp0_iter1_xtrasBuffer_V_new_8_s_reg_449 = "0000000000000000000000000000000000000000000000000000000000000000"; static int apTFileNum = 0; stringstream apTFilenSS; apTFilenSS << "response_r_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_HIER__ 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_continue, "(port)ap_continue"); sc_trace(mVcdFile, ap_idle, "(port)ap_idle"); sc_trace(mVcdFile, ap_ready, "(port)ap_ready"); sc_trace(mVcdFile, valueBuffer_rf_V_V_dout, "(port)valueBuffer_rf_V_V_dout"); sc_trace(mVcdFile, valueBuffer_rf_V_V_empty_n, "(port)valueBuffer_rf_V_V_empty_n"); sc_trace(mVcdFile, valueBuffer_rf_V_V_read, "(port)valueBuffer_rf_V_V_read"); sc_trace(mVcdFile, metadataBuffer_rf_V_s_dout, "(port)metadataBuffer_rf_V_s_dout"); sc_trace(mVcdFile, metadataBuffer_rf_V_s_empty_n, "(port)metadataBuffer_rf_V_s_empty_n"); sc_trace(mVcdFile, metadataBuffer_rf_V_s_read, "(port)metadataBuffer_rf_V_s_read"); sc_trace(mVcdFile, outData_TREADY, "(port)outData_TREADY"); sc_trace(mVcdFile, outData_TDATA, "(port)outData_TDATA"); sc_trace(mVcdFile, outData_TVALID, "(port)outData_TVALID"); sc_trace(mVcdFile, outData_TUSER, "(port)outData_TUSER"); sc_trace(mVcdFile, outData_TKEEP, "(port)outData_TKEEP"); sc_trace(mVcdFile, outData_TLAST, "(port)outData_TLAST"); #endif #ifdef __HLS_TRACE_LEVEL_INT__ sc_trace(mVcdFile, ap_done_reg, "ap_done_reg"); sc_trace(mVcdFile, ap_CS_iter0_fsm, "ap_CS_iter0_fsm"); sc_trace(mVcdFile, ap_CS_iter0_fsm_state1, "ap_CS_iter0_fsm_state1"); sc_trace(mVcdFile, ap_CS_iter1_fsm, "ap_CS_iter1_fsm"); sc_trace(mVcdFile, ap_CS_iter1_fsm_state0, "ap_CS_iter1_fsm_state0"); sc_trace(mVcdFile, ap_CS_iter2_fsm, "ap_CS_iter2_fsm"); sc_trace(mVcdFile, ap_CS_iter2_fsm_state0, "ap_CS_iter2_fsm_state0"); sc_trace(mVcdFile, tmp_i_fu_541_p2, "tmp_i_fu_541_p2"); sc_trace(mVcdFile, tmp_i_82_fu_559_p2, "tmp_i_82_fu_559_p2"); sc_trace(mVcdFile, tmp_18_i_fu_570_p2, "tmp_18_i_fu_570_p2"); sc_trace(mVcdFile, tmp_24_i_fu_576_p2, "tmp_24_i_fu_576_p2"); sc_trace(mVcdFile, tmp_29_i_fu_582_p2, "tmp_29_i_fu_582_p2"); sc_trace(mVcdFile, tmp_31_i_fu_588_p2, "tmp_31_i_fu_588_p2"); sc_trace(mVcdFile, tmp_34_i_fu_606_p2, "tmp_34_i_fu_606_p2"); sc_trace(mVcdFile, grp_nbreadreq_fu_256_p3, "grp_nbreadreq_fu_256_p3"); sc_trace(mVcdFile, ap_predicate_op37_read_state1, "ap_predicate_op37_read_state1"); sc_trace(mVcdFile, ap_predicate_op56_read_state1, "ap_predicate_op56_read_state1"); sc_trace(mVcdFile, or_cond2_i_fu_1902_p2, "or_cond2_i_fu_1902_p2"); sc_trace(mVcdFile, or_cond5_i_fu_2004_p2, "or_cond5_i_fu_2004_p2"); sc_trace(mVcdFile, ap_predicate_op134_read_state1, "ap_predicate_op134_read_state1"); sc_trace(mVcdFile, tmp_nbreadreq_fu_270_p3, "tmp_nbreadreq_fu_270_p3"); sc_trace(mVcdFile, ap_predicate_op142_read_state1, "ap_predicate_op142_read_state1"); sc_trace(mVcdFile, ap_block_state1_pp0_stage0_iter0, "ap_block_state1_pp0_stage0_iter0"); sc_trace(mVcdFile, ap_block_state2_pp0_stage0_iter1, "ap_block_state2_pp0_stage0_iter1"); sc_trace(mVcdFile, respOutput_V_data_V_1_ack_in, "respOutput_V_data_V_1_ack_in"); sc_trace(mVcdFile, tmp_i_reg_3368, "tmp_i_reg_3368"); sc_trace(mVcdFile, tmp_i_82_reg_3372, "tmp_i_82_reg_3372"); sc_trace(mVcdFile, tmp_18_i_reg_3383, "tmp_18_i_reg_3383"); sc_trace(mVcdFile, tmp_24_i_reg_3387, "tmp_24_i_reg_3387"); sc_trace(mVcdFile, tmp_29_i_reg_3391, "tmp_29_i_reg_3391"); sc_trace(mVcdFile, tmp_31_i_reg_3395, "tmp_31_i_reg_3395"); sc_trace(mVcdFile, tmp_35_i_reg_3399, "tmp_35_i_reg_3399"); sc_trace(mVcdFile, tmp_41_i_reg_3403, "tmp_41_i_reg_3403"); sc_trace(mVcdFile, ap_predicate_op150_write_state2, "ap_predicate_op150_write_state2"); sc_trace(mVcdFile, ap_predicate_op155_write_state2, "ap_predicate_op155_write_state2"); sc_trace(mVcdFile, tmp_34_i_reg_3407, "tmp_34_i_reg_3407"); sc_trace(mVcdFile, tmp_39_i_reg_3415, "tmp_39_i_reg_3415"); sc_trace(mVcdFile, tmp_6_reg_3411, "tmp_6_reg_3411"); sc_trace(mVcdFile, ap_predicate_op185_write_state2, "ap_predicate_op185_write_state2"); sc_trace(mVcdFile, ap_predicate_op190_write_state2, "ap_predicate_op190_write_state2"); sc_trace(mVcdFile, tmp_5_reg_3437, "tmp_5_reg_3437"); sc_trace(mVcdFile, ap_predicate_op195_write_state2, "ap_predicate_op195_write_state2"); sc_trace(mVcdFile, ap_predicate_op197_write_state2, "ap_predicate_op197_write_state2"); sc_trace(mVcdFile, ap_predicate_op200_write_state2, "ap_predicate_op200_write_state2"); sc_trace(mVcdFile, or_cond2_i_reg_3479, "or_cond2_i_reg_3479"); sc_trace(mVcdFile, ap_predicate_op208_write_state2, "ap_predicate_op208_write_state2"); sc_trace(mVcdFile, ap_block_state2_io, "ap_block_state2_io"); sc_trace(mVcdFile, ap_CS_iter1_fsm_state2, "ap_CS_iter1_fsm_state2"); sc_trace(mVcdFile, respOutput_V_user_V_1_ack_in, "respOutput_V_user_V_1_ack_in"); sc_trace(mVcdFile, respOutput_V_keep_V_1_ack_in, "respOutput_V_keep_V_1_ack_in"); sc_trace(mVcdFile, respOutput_V_last_V_1_ack_in, "respOutput_V_last_V_1_ack_in"); sc_trace(mVcdFile, ap_block_state3_pp0_stage0_iter2, "ap_block_state3_pp0_stage0_iter2"); sc_trace(mVcdFile, tmp_i_reg_3368_pp0_iter1_reg, "tmp_i_reg_3368_pp0_iter1_reg"); sc_trace(mVcdFile, tmp_i_82_reg_3372_pp0_iter1_reg, "tmp_i_82_reg_3372_pp0_iter1_reg"); sc_trace(mVcdFile, tmp_18_i_reg_3383_pp0_iter1_reg, "tmp_18_i_reg_3383_pp0_iter1_reg"); sc_trace(mVcdFile, tmp_24_i_reg_3387_pp0_iter1_reg, "tmp_24_i_reg_3387_pp0_iter1_reg"); sc_trace(mVcdFile, tmp_29_i_reg_3391_pp0_iter1_reg, "tmp_29_i_reg_3391_pp0_iter1_reg"); sc_trace(mVcdFile, tmp_31_i_reg_3395_pp0_iter1_reg, "tmp_31_i_reg_3395_pp0_iter1_reg"); sc_trace(mVcdFile, tmp_35_i_reg_3399_pp0_iter1_reg, "tmp_35_i_reg_3399_pp0_iter1_reg"); sc_trace(mVcdFile, tmp_41_i_reg_3403_pp0_iter1_reg, "tmp_41_i_reg_3403_pp0_iter1_reg"); sc_trace(mVcdFile, ap_predicate_op218_write_state3, "ap_predicate_op218_write_state3"); sc_trace(mVcdFile, ap_predicate_op221_write_state3, "ap_predicate_op221_write_state3"); sc_trace(mVcdFile, tmp_34_i_reg_3407_pp0_iter1_reg, "tmp_34_i_reg_3407_pp0_iter1_reg"); sc_trace(mVcdFile, tmp_39_i_reg_3415_pp0_iter1_reg, "tmp_39_i_reg_3415_pp0_iter1_reg"); sc_trace(mVcdFile, tmp_6_reg_3411_pp0_iter1_reg, "tmp_6_reg_3411_pp0_iter1_reg"); sc_trace(mVcdFile, ap_predicate_op223_write_state3, "ap_predicate_op223_write_state3"); sc_trace(mVcdFile, ap_predicate_op226_write_state3, "ap_predicate_op226_write_state3"); sc_trace(mVcdFile, tmp_5_reg_3437_pp0_iter1_reg, "tmp_5_reg_3437_pp0_iter1_reg"); sc_trace(mVcdFile, ap_predicate_op227_write_state3, "ap_predicate_op227_write_state3"); sc_trace(mVcdFile, ap_predicate_op229_write_state3, "ap_predicate_op229_write_state3"); sc_trace(mVcdFile, ap_predicate_op230_write_state3, "ap_predicate_op230_write_state3"); sc_trace(mVcdFile, or_cond2_i_reg_3479_pp0_iter1_reg, "or_cond2_i_reg_3479_pp0_iter1_reg"); sc_trace(mVcdFile, ap_predicate_op231_write_state3, "ap_predicate_op231_write_state3"); sc_trace(mVcdFile, ap_block_state3_io, "ap_block_state3_io"); sc_trace(mVcdFile, ap_CS_iter2_fsm_state3, "ap_CS_iter2_fsm_state3"); sc_trace(mVcdFile, respOutput_V_data_V_1_data_in, "respOutput_V_data_V_1_data_in"); sc_trace(mVcdFile, respOutput_V_data_V_1_data_out, "respOutput_V_data_V_1_data_out"); sc_trace(mVcdFile, respOutput_V_data_V_1_vld_in, "respOutput_V_data_V_1_vld_in"); sc_trace(mVcdFile, respOutput_V_data_V_1_vld_out, "respOutput_V_data_V_1_vld_out"); sc_trace(mVcdFile, respOutput_V_data_V_1_ack_out, "respOutput_V_data_V_1_ack_out"); sc_trace(mVcdFile, respOutput_V_data_V_1_payload_A, "respOutput_V_data_V_1_payload_A"); sc_trace(mVcdFile, respOutput_V_data_V_1_payload_B, "respOutput_V_data_V_1_payload_B"); sc_trace(mVcdFile, respOutput_V_data_V_1_sel_rd, "respOutput_V_data_V_1_sel_rd"); sc_trace(mVcdFile, respOutput_V_data_V_1_sel_wr, "respOutput_V_data_V_1_sel_wr"); sc_trace(mVcdFile, respOutput_V_data_V_1_sel, "respOutput_V_data_V_1_sel"); sc_trace(mVcdFile, respOutput_V_data_V_1_load_A, "respOutput_V_data_V_1_load_A"); sc_trace(mVcdFile, respOutput_V_data_V_1_load_B, "respOutput_V_data_V_1_load_B"); sc_trace(mVcdFile, respOutput_V_data_V_1_state, "respOutput_V_data_V_1_state"); sc_trace(mVcdFile, respOutput_V_data_V_1_state_cmp_full, "respOutput_V_data_V_1_state_cmp_full"); sc_trace(mVcdFile, respOutput_V_user_V_1_data_in, "respOutput_V_user_V_1_data_in"); sc_trace(mVcdFile, respOutput_V_user_V_1_data_out, "respOutput_V_user_V_1_data_out"); sc_trace(mVcdFile, respOutput_V_user_V_1_vld_in, "respOutput_V_user_V_1_vld_in"); sc_trace(mVcdFile, respOutput_V_user_V_1_vld_out, "respOutput_V_user_V_1_vld_out"); sc_trace(mVcdFile, respOutput_V_user_V_1_ack_out, "respOutput_V_user_V_1_ack_out"); sc_trace(mVcdFile, respOutput_V_user_V_1_payload_A, "respOutput_V_user_V_1_payload_A"); sc_trace(mVcdFile, respOutput_V_user_V_1_payload_B, "respOutput_V_user_V_1_payload_B"); sc_trace(mVcdFile, respOutput_V_user_V_1_sel_rd, "respOutput_V_user_V_1_sel_rd"); sc_trace(mVcdFile, respOutput_V_user_V_1_sel_wr, "respOutput_V_user_V_1_sel_wr"); sc_trace(mVcdFile, respOutput_V_user_V_1_sel, "respOutput_V_user_V_1_sel"); sc_trace(mVcdFile, respOutput_V_user_V_1_load_A, "respOutput_V_user_V_1_load_A"); sc_trace(mVcdFile, respOutput_V_user_V_1_load_B, "respOutput_V_user_V_1_load_B"); sc_trace(mVcdFile, respOutput_V_user_V_1_state, "respOutput_V_user_V_1_state"); sc_trace(mVcdFile, respOutput_V_user_V_1_state_cmp_full, "respOutput_V_user_V_1_state_cmp_full"); sc_trace(mVcdFile, respOutput_V_keep_V_1_data_in, "respOutput_V_keep_V_1_data_in"); sc_trace(mVcdFile, respOutput_V_keep_V_1_data_out, "respOutput_V_keep_V_1_data_out"); sc_trace(mVcdFile, respOutput_V_keep_V_1_vld_in, "respOutput_V_keep_V_1_vld_in"); sc_trace(mVcdFile, respOutput_V_keep_V_1_vld_out, "respOutput_V_keep_V_1_vld_out"); sc_trace(mVcdFile, respOutput_V_keep_V_1_ack_out, "respOutput_V_keep_V_1_ack_out"); sc_trace(mVcdFile, respOutput_V_keep_V_1_payload_A, "respOutput_V_keep_V_1_payload_A"); sc_trace(mVcdFile, respOutput_V_keep_V_1_payload_B, "respOutput_V_keep_V_1_payload_B"); sc_trace(mVcdFile, respOutput_V_keep_V_1_sel_rd, "respOutput_V_keep_V_1_sel_rd"); sc_trace(mVcdFile, respOutput_V_keep_V_1_sel_wr, "respOutput_V_keep_V_1_sel_wr"); sc_trace(mVcdFile, respOutput_V_keep_V_1_sel, "respOutput_V_keep_V_1_sel"); sc_trace(mVcdFile, respOutput_V_keep_V_1_load_A, "respOutput_V_keep_V_1_load_A"); sc_trace(mVcdFile, respOutput_V_keep_V_1_load_B, "respOutput_V_keep_V_1_load_B"); sc_trace(mVcdFile, respOutput_V_keep_V_1_state, "respOutput_V_keep_V_1_state"); sc_trace(mVcdFile, respOutput_V_keep_V_1_state_cmp_full, "respOutput_V_keep_V_1_state_cmp_full"); sc_trace(mVcdFile, respOutput_V_last_V_1_data_in, "respOutput_V_last_V_1_data_in"); sc_trace(mVcdFile, respOutput_V_last_V_1_data_out, "respOutput_V_last_V_1_data_out"); sc_trace(mVcdFile, respOutput_V_last_V_1_vld_in, "respOutput_V_last_V_1_vld_in"); sc_trace(mVcdFile, respOutput_V_last_V_1_vld_out, "respOutput_V_last_V_1_vld_out"); sc_trace(mVcdFile, respOutput_V_last_V_1_ack_out, "respOutput_V_last_V_1_ack_out"); sc_trace(mVcdFile, respOutput_V_last_V_1_payload_A, "respOutput_V_last_V_1_payload_A"); sc_trace(mVcdFile, respOutput_V_last_V_1_payload_B, "respOutput_V_last_V_1_payload_B"); sc_trace(mVcdFile, respOutput_V_last_V_1_sel_rd, "respOutput_V_last_V_1_sel_rd"); sc_trace(mVcdFile, respOutput_V_last_V_1_sel_wr, "respOutput_V_last_V_1_sel_wr"); sc_trace(mVcdFile, respOutput_V_last_V_1_sel, "respOutput_V_last_V_1_sel"); sc_trace(mVcdFile, respOutput_V_last_V_1_load_A, "respOutput_V_last_V_1_load_A"); sc_trace(mVcdFile, respOutput_V_last_V_1_load_B, "respOutput_V_last_V_1_load_B"); sc_trace(mVcdFile, respOutput_V_last_V_1_state, "respOutput_V_last_V_1_state"); sc_trace(mVcdFile, respOutput_V_last_V_1_state_cmp_full, "respOutput_V_last_V_1_state_cmp_full"); sc_trace(mVcdFile, br_outWordCounter, "br_outWordCounter"); sc_trace(mVcdFile, outOpCode, "outOpCode"); sc_trace(mVcdFile, errorCode, "errorCode"); sc_trace(mVcdFile, outMetadataTempBuffe, "outMetadataTempBuffe"); sc_trace(mVcdFile, valueLength, "valueLength"); sc_trace(mVcdFile, xtrasBuffer_V, "xtrasBuffer_V"); sc_trace(mVcdFile, resp_ValueConvertTem, "resp_ValueConvertTem"); sc_trace(mVcdFile, outData_TDATA_blk_n, "outData_TDATA_blk_n"); sc_trace(mVcdFile, metadataBuffer_rf_V_s_blk_n, "metadataBuffer_rf_V_s_blk_n"); sc_trace(mVcdFile, valueBuffer_rf_V_V_blk_n, "valueBuffer_rf_V_V_blk_n"); sc_trace(mVcdFile, valueLength_load_reg_3376, "valueLength_load_reg_3376"); sc_trace(mVcdFile, tmp_35_i_fu_594_p2, "tmp_35_i_fu_594_p2"); sc_trace(mVcdFile, tmp_41_i_fu_600_p2, "tmp_41_i_fu_600_p2"); sc_trace(mVcdFile, grp_fu_492_p2, "grp_fu_492_p2"); sc_trace(mVcdFile, tmp_69_fu_612_p1, "tmp_69_fu_612_p1"); sc_trace(mVcdFile, tmp_69_reg_3419, "tmp_69_reg_3419"); sc_trace(mVcdFile, tempKeep_V_fu_620_p258, "tempKeep_V_fu_620_p258"); sc_trace(mVcdFile, tmp_46_i_fu_1164_p2, "tmp_46_i_fu_1164_p2"); sc_trace(mVcdFile, tmp_50_i_fu_1170_p2, "tmp_50_i_fu_1170_p2"); sc_trace(mVcdFile, tmp_66_fu_1182_p1, "tmp_66_fu_1182_p1"); sc_trace(mVcdFile, tmp_66_reg_3441, "tmp_66_reg_3441"); sc_trace(mVcdFile, tempOutput_keep_V_fu_1218_p258, "tempOutput_keep_V_fu_1218_p258"); sc_trace(mVcdFile, tmp_28_i_fu_497_p2, "tmp_28_i_fu_497_p2"); sc_trace(mVcdFile, tmp_64_fu_1754_p2, "tmp_64_fu_1754_p2"); sc_trace(mVcdFile, grp_fu_512_p2, "grp_fu_512_p2"); sc_trace(mVcdFile, p_1_cast_i_cast_cast_fu_1796_p3, "p_1_cast_i_cast_cast_fu_1796_p3"); sc_trace(mVcdFile, tmp_23_i_fu_1778_p2, "tmp_23_i_fu_1778_p2"); sc_trace(mVcdFile, tmp_i_i_fu_1854_p5, "tmp_i_i_fu_1854_p5"); sc_trace(mVcdFile, p_Result_1_i_reg_3483, "p_Result_1_i_reg_3483"); sc_trace(mVcdFile, p_Result_2_i_reg_3488, "p_Result_2_i_reg_3488"); sc_trace(mVcdFile, tmp_8_fu_1982_p2, "tmp_8_fu_1982_p2"); sc_trace(mVcdFile, tmp_8_reg_3494, "tmp_8_reg_3494"); sc_trace(mVcdFile, p_Result_8_i_reg_3499, "p_Result_8_i_reg_3499"); sc_trace(mVcdFile, br_valueLengthTemp_V_fu_2010_p2, "br_valueLengthTemp_V_fu_2010_p2"); sc_trace(mVcdFile, p_cast_i_cast_cast_fu_2016_p3, "p_cast_i_cast_cast_fu_2016_p3"); sc_trace(mVcdFile, p_Result_10_fu_2079_p1, "p_Result_10_fu_2079_p1"); sc_trace(mVcdFile, tempOutput_keep_V_5_fu_2087_p258, "tempOutput_keep_V_5_fu_2087_p258"); sc_trace(mVcdFile, p_Result_9_fu_2763_p2, "p_Result_9_fu_2763_p2"); sc_trace(mVcdFile, tempOutput_keep_V_4_fu_2773_p258, "tempOutput_keep_V_4_fu_2773_p258"); sc_trace(mVcdFile, p_Result_7_fu_3292_p3, "p_Result_7_fu_3292_p3"); sc_trace(mVcdFile, p_Result_6_fu_3304_p3, "p_Result_6_fu_3304_p3"); sc_trace(mVcdFile, tmp_data_V_2_fu_3312_p1, "tmp_data_V_2_fu_3312_p1"); sc_trace(mVcdFile, p_Result_4_fu_3342_p5, "p_Result_4_fu_3342_p5"); sc_trace(mVcdFile, p_Result_5_fu_3354_p3, "p_Result_5_fu_3354_p3"); sc_trace(mVcdFile, ap_phi_reg_pp0_iter0_tmp_last_V_2_reg_306, "ap_phi_reg_pp0_iter0_tmp_last_V_2_reg_306"); sc_trace(mVcdFile, ap_phi_reg_pp0_iter1_tmp_last_V_2_reg_306, "ap_phi_reg_pp0_iter1_tmp_last_V_2_reg_306"); sc_trace(mVcdFile, ap_phi_reg_pp0_iter0_tmp_keep_V_3_reg_322, "ap_phi_reg_pp0_iter0_tmp_keep_V_3_reg_322"); sc_trace(mVcdFile, ap_phi_reg_pp0_iter1_tmp_keep_V_3_reg_322, "ap_phi_reg_pp0_iter1_tmp_keep_V_3_reg_322"); sc_trace(mVcdFile, ap_phi_reg_pp0_iter0_tmp_last_V_1_reg_336, "ap_phi_reg_pp0_iter0_tmp_last_V_1_reg_336"); sc_trace(mVcdFile, ap_phi_reg_pp0_iter1_tmp_last_V_1_reg_336, "ap_phi_reg_pp0_iter1_tmp_last_V_1_reg_336"); sc_trace(mVcdFile, ap_phi_reg_pp0_iter0_tmp_keep_V_1_reg_352, "ap_phi_reg_pp0_iter0_tmp_keep_V_1_reg_352"); sc_trace(mVcdFile, ap_phi_reg_pp0_iter1_tmp_keep_V_1_reg_352, "ap_phi_reg_pp0_iter1_tmp_keep_V_1_reg_352"); sc_trace(mVcdFile, ap_phi_reg_pp0_iter0_tmp_last_V_reg_366, "ap_phi_reg_pp0_iter0_tmp_last_V_reg_366"); sc_trace(mVcdFile, ap_phi_reg_pp0_iter1_tmp_last_V_reg_366, "ap_phi_reg_pp0_iter1_tmp_last_V_reg_366"); sc_trace(mVcdFile, ap_phi_reg_pp0_iter0_tmp_data_V_1_reg_385, "ap_phi_reg_pp0_iter0_tmp_data_V_1_reg_385"); sc_trace(mVcdFile, ap_phi_reg_pp0_iter1_tmp_data_V_1_reg_385, "ap_phi_reg_pp0_iter1_tmp_data_V_1_reg_385"); sc_trace(mVcdFile, ap_phi_reg_pp0_iter0_xtrasBuffer_V_new_i_reg_394, "ap_phi_reg_pp0_iter0_xtrasBuffer_V_new_i_reg_394"); sc_trace(mVcdFile, ap_phi_reg_pp0_iter1_xtrasBuffer_V_new_i_reg_394, "ap_phi_reg_pp0_iter1_xtrasBuffer_V_new_i_reg_394"); sc_trace(mVcdFile, ap_phi_reg_pp0_iter0_p_0492_1_i_reg_405, "ap_phi_reg_pp0_iter0_p_0492_1_i_reg_405"); sc_trace(mVcdFile, ap_phi_reg_pp0_iter1_p_0492_1_i_reg_405, "ap_phi_reg_pp0_iter1_p_0492_1_i_reg_405"); sc_trace(mVcdFile, ap_phi_mux_xtrasBuffer_V_flag_8_phi_fu_419_p18, "ap_phi_mux_xtrasBuffer_V_flag_8_phi_fu_419_p18"); sc_trace(mVcdFile, ap_phi_reg_pp0_iter0_xtrasBuffer_V_flag_8_reg_414, "ap_phi_reg_pp0_iter0_xtrasBuffer_V_flag_8_reg_414"); sc_trace(mVcdFile, ap_phi_reg_pp0_iter1_xtrasBuffer_V_flag_8_reg_414, "ap_phi_reg_pp0_iter1_xtrasBuffer_V_flag_8_reg_414"); sc_trace(mVcdFile, ap_phi_mux_xtrasBuffer_V_new_8_s_phi_fu_453_p18, "ap_phi_mux_xtrasBuffer_V_new_8_s_phi_fu_453_p18"); sc_trace(mVcdFile, ap_phi_reg_pp0_iter1_xtrasBuffer_V_new_8_s_reg_449, "ap_phi_reg_pp0_iter1_xtrasBuffer_V_new_8_s_reg_449"); sc_trace(mVcdFile, ap_phi_reg_pp0_iter0_xtrasBuffer_V_new_8_s_reg_449, "ap_phi_reg_pp0_iter0_xtrasBuffer_V_new_8_s_reg_449"); sc_trace(mVcdFile, tmp_45_i_fu_1150_p3, "tmp_45_i_fu_1150_p3"); sc_trace(mVcdFile, tmp_38_i_fu_1192_p2, "tmp_38_i_fu_1192_p2"); sc_trace(mVcdFile, tmp_20_i_fu_1944_p2, "tmp_20_i_fu_1944_p2"); sc_trace(mVcdFile, p_Val2_4_fu_1808_p2, "p_Val2_4_fu_1808_p2"); sc_trace(mVcdFile, tmp_19_i_fu_1932_p2, "tmp_19_i_fu_1932_p2"); sc_trace(mVcdFile, tmp_58_fu_537_p1, "tmp_58_fu_537_p1"); sc_trace(mVcdFile, tempKeep_V_fu_620_p257, "tempKeep_V_fu_620_p257"); sc_trace(mVcdFile, tmp_43_i_fu_1138_p2, "tmp_43_i_fu_1138_p2"); sc_trace(mVcdFile, tmp_44_i_fu_1144_p2, "tmp_44_i_fu_1144_p2"); sc_trace(mVcdFile, tmp_67_fu_1204_p1, "tmp_67_fu_1204_p1"); sc_trace(mVcdFile, lengthValue_assign_fu_1208_p2, "lengthValue_assign_fu_1208_p2"); sc_trace(mVcdFile, tempOutput_keep_V_fu_1218_p257, "tempOutput_keep_V_fu_1218_p257"); sc_trace(mVcdFile, grp_fu_507_p2, "grp_fu_507_p2"); sc_trace(mVcdFile, tmp_60_fu_1736_p2, "tmp_60_fu_1736_p2"); sc_trace(mVcdFile, tmp_63_fu_1748_p2, "tmp_63_fu_1748_p2"); sc_trace(mVcdFile, tmp_62_fu_1742_p2, "tmp_62_fu_1742_p2"); sc_trace(mVcdFile, tmp_22_i_fu_1772_p2, "tmp_22_i_fu_1772_p2"); sc_trace(mVcdFile, or_cond3_i_fu_1784_p2, "or_cond3_i_fu_1784_p2"); sc_trace(mVcdFile, grp_fu_502_p2, "grp_fu_502_p2"); sc_trace(mVcdFile, or_cond4_i_fu_1790_p2, "or_cond4_i_fu_1790_p2"); sc_trace(mVcdFile, tmp_59_fu_1850_p1, "tmp_59_fu_1850_p1"); sc_trace(mVcdFile, p_Result_56_i_i_fu_1840_p4, "p_Result_56_i_i_fu_1840_p4"); sc_trace(mVcdFile, p_Result_i_i_84_fu_1830_p4, "p_Result_i_i_84_fu_1830_p4"); sc_trace(mVcdFile, p_Result_i_i_fu_1820_p4, "p_Result_i_i_fu_1820_p4"); sc_trace(mVcdFile, p_not_i_fu_1872_p2, "p_not_i_fu_1872_p2"); sc_trace(mVcdFile, tmp1_fu_1878_p2, "tmp1_fu_1878_p2"); sc_trace(mVcdFile, or_cond913_not_i_fu_1884_p1, "or_cond913_not_i_fu_1884_p1"); sc_trace(mVcdFile, or_cond913_not_i_fu_1884_p2, "or_cond913_not_i_fu_1884_p2"); sc_trace(mVcdFile, or_cond1_i_fu_1890_p2, "or_cond1_i_fu_1890_p2"); sc_trace(mVcdFile, or_cond915_not_i_fu_1896_p2, "or_cond915_not_i_fu_1896_p2"); sc_trace(mVcdFile, p_Result_i_83_fu_1912_p4, "p_Result_i_83_fu_1912_p4"); sc_trace(mVcdFile, tempVar_V_fu_1922_p4, "tempVar_V_fu_1922_p4"); sc_trace(mVcdFile, tmp_7_fu_1976_p2, "tmp_7_fu_1976_p2"); sc_trace(mVcdFile, tmp_30_i_fu_1998_p2, "tmp_30_i_fu_1998_p2"); sc_trace(mVcdFile, grp_fu_517_p4, "grp_fu_517_p4"); sc_trace(mVcdFile, tempOutput_keep_V_5_fu_2087_p257, "tempOutput_keep_V_5_fu_2087_p257"); sc_trace(mVcdFile, tmp_71_fu_2606_p1, "tmp_71_fu_2606_p1"); sc_trace(mVcdFile, tmp_48_i_fu_2609_p3, "tmp_48_i_fu_2609_p3"); sc_trace(mVcdFile, Hi_assign_2_fu_2623_p2, "Hi_assign_2_fu_2623_p2"); sc_trace(mVcdFile, tmp_72_fu_2629_p3, "tmp_72_fu_2629_p3"); sc_trace(mVcdFile, tmp_73_fu_2643_p1, "tmp_73_fu_2643_p1"); sc_trace(mVcdFile, rev_fu_2637_p2, "rev_fu_2637_p2"); sc_trace(mVcdFile, tmp_75_fu_2657_p2, "tmp_75_fu_2657_p2"); sc_trace(mVcdFile, tmp_76_fu_2663_p2, "tmp_76_fu_2663_p2"); sc_trace(mVcdFile, tmp_74_fu_2647_p4, "tmp_74_fu_2647_p4"); sc_trace(mVcdFile, tmp_77_fu_2669_p3, "tmp_77_fu_2669_p3"); sc_trace(mVcdFile, tmp_79_fu_2685_p2, "tmp_79_fu_2685_p2"); sc_trace(mVcdFile, tmp_78_fu_2677_p3, "tmp_78_fu_2677_p3"); sc_trace(mVcdFile, st_fu_2695_p4, "st_fu_2695_p4"); sc_trace(mVcdFile, sf_fu_2709_p4, "sf_fu_2709_p4"); sc_trace(mVcdFile, tmp_81_fu_2705_p1, "tmp_81_fu_2705_p1"); sc_trace(mVcdFile, tmp_82_fu_2719_p1, "tmp_82_fu_2719_p1"); sc_trace(mVcdFile, tmp_80_fu_2691_p1, "tmp_80_fu_2691_p1"); sc_trace(mVcdFile, tmp_83_fu_2723_p3, "tmp_83_fu_2723_p3"); sc_trace(mVcdFile, tmp_84_fu_2731_p2, "tmp_84_fu_2731_p2"); sc_trace(mVcdFile, Hi_assign_fu_2617_p2, "Hi_assign_fu_2617_p2"); sc_trace(mVcdFile, tmp_86_fu_2743_p1, "tmp_86_fu_2743_p1"); sc_trace(mVcdFile, tmp_87_fu_2747_p2, "tmp_87_fu_2747_p2"); sc_trace(mVcdFile, tmp_88_fu_2753_p1, "tmp_88_fu_2753_p1"); sc_trace(mVcdFile, p_Result_8_fu_2737_p2, "p_Result_8_fu_2737_p2"); sc_trace(mVcdFile, tmp_89_fu_2757_p2, "tmp_89_fu_2757_p2"); sc_trace(mVcdFile, tempOutput_keep_V_4_fu_2773_p257, "tempOutput_keep_V_4_fu_2773_p257"); sc_trace(mVcdFile, tmp_65_fu_3300_p1, "tmp_65_fu_3300_p1"); sc_trace(mVcdFile, p_Result_3_fu_3326_p4, "p_Result_3_fu_3326_p4"); sc_trace(mVcdFile, p_Result_s_fu_3317_p4, "p_Result_s_fu_3317_p4"); sc_trace(mVcdFile, tempOutput_data_V_fu_3335_p3, "tempOutput_data_V_fu_3335_p3"); sc_trace(mVcdFile, ap_NS_iter0_fsm, "ap_NS_iter0_fsm"); sc_trace(mVcdFile, ap_NS_iter1_fsm, "ap_NS_iter1_fsm"); sc_trace(mVcdFile, ap_NS_iter2_fsm, "ap_NS_iter2_fsm"); sc_trace(mVcdFile, ap_condition_785, "ap_condition_785"); sc_trace(mVcdFile, ap_condition_88, "ap_condition_88"); sc_trace(mVcdFile, ap_condition_334, "ap_condition_334"); sc_trace(mVcdFile, ap_condition_759, "ap_condition_759"); sc_trace(mVcdFile, ap_condition_754, "ap_condition_754"); sc_trace(mVcdFile, ap_condition_722, "ap_condition_722"); sc_trace(mVcdFile, ap_condition_849, "ap_condition_849"); sc_trace(mVcdFile, ap_condition_839, "ap_condition_839"); sc_trace(mVcdFile, ap_condition_708, "ap_condition_708"); sc_trace(mVcdFile, ap_condition_962, "ap_condition_962"); sc_trace(mVcdFile, ap_condition_2601, "ap_condition_2601"); sc_trace(mVcdFile, ap_condition_658, "ap_condition_658"); #endif } } response_r::~response_r() { if (mVcdFile) sc_close_vcd_trace_file(mVcdFile); delete memcachedPipelinebkb_U100; delete memcachedPipelinebkb_U101; delete memcachedPipelinebkb_U102; delete memcachedPipelinebkb_U103; } void response_r::thread_ap_var_for_const0() { ap_var_for_const0 = ap_const_lv8_FF; } void response_r::thread_ap_var_for_const1() { ap_var_for_const1 = ap_const_lv8_1; } void response_r::thread_ap_var_for_const2() { ap_var_for_const2 = ap_const_lv8_3; } void response_r::thread_ap_var_for_const3() { ap_var_for_const3 = ap_const_lv8_7; } void response_r::thread_ap_var_for_const4() { ap_var_for_const4 = ap_const_lv8_F; } void response_r::thread_ap_var_for_const5() { ap_var_for_const5 = ap_const_lv8_1F; } void response_r::thread_ap_var_for_const6() { ap_var_for_const6 = ap_const_lv8_3F; } void response_r::thread_ap_var_for_const7() { ap_var_for_const7 = ap_const_lv8_7F; } void response_r::thread_ap_clk_no_reset_() { if ( ap_rst.read() == ap_const_logic_1) { ap_CS_iter0_fsm = ap_ST_iter0_fsm_state1; } else { ap_CS_iter0_fsm = ap_NS_iter0_fsm.read(); } if ( ap_rst.read() == ap_const_logic_1) { ap_CS_iter1_fsm = ap_ST_iter1_fsm_state0; } else { ap_CS_iter1_fsm = ap_NS_iter1_fsm.read(); } if ( ap_rst.read() == ap_const_logic_1) { ap_CS_iter2_fsm = ap_ST_iter2_fsm_state0; } else { ap_CS_iter2_fsm = ap_NS_iter2_fsm.read(); } if ( ap_rst.read() == ap_const_logic_1) { ap_done_reg = ap_const_logic_0; } else { if (esl_seteq<1,1,1>(ap_const_logic_1, ap_continue.read())) { ap_done_reg = ap_const_logic_0; } else if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter2_fsm_state3.read()) && !(esl_seteq<1,1,1>(respOutput_V_last_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_keep_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_user_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_data_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state3_io.read()) || esl_seteq<1,1,1>(ap_done_reg.read(), ap_const_logic_1)))) { ap_done_reg = ap_const_logic_1; } } if ( ap_rst.read() == ap_const_logic_1) { ap_phi_reg_pp0_iter1_p_0492_1_i_reg_405 = ap_const_lv16_0; } else { if (esl_seteq<1,1,1>(ap_condition_334.read(), ap_const_boolean_1)) { if (esl_seteq<1,1,1>(ap_condition_88.read(), ap_const_boolean_1)) { ap_phi_reg_pp0_iter1_p_0492_1_i_reg_405 = br_valueLengthTemp_V_fu_2010_p2.read(); } else if (esl_seteq<1,1,1>(ap_condition_785.read(), ap_const_boolean_1)) { ap_phi_reg_pp0_iter1_p_0492_1_i_reg_405 = p_cast_i_cast_cast_fu_2016_p3.read(); } else if (esl_seteq<1,1,1>(ap_const_boolean_1, ap_const_boolean_1)) { ap_phi_reg_pp0_iter1_p_0492_1_i_reg_405 = ap_phi_reg_pp0_iter0_p_0492_1_i_reg_405.read(); } } } if ( ap_rst.read() == ap_const_logic_1) { ap_phi_reg_pp0_iter1_tmp_data_V_1_reg_385 = ap_const_lv32_0; } else { if (esl_seteq<1,1,1>(ap_condition_334.read(), ap_const_boolean_1)) { if (esl_seteq<1,1,1>(ap_condition_754.read(), ap_const_boolean_1)) { ap_phi_reg_pp0_iter1_tmp_data_V_1_reg_385 = p_1_cast_i_cast_cast_fu_1796_p3.read(); } else if (esl_seteq<1,1,1>(ap_condition_759.read(), ap_const_boolean_1)) { ap_phi_reg_pp0_iter1_tmp_data_V_1_reg_385 = tmp_i_i_fu_1854_p5.read(); } else if (esl_seteq<1,1,1>(ap_const_boolean_1, ap_const_boolean_1)) { ap_phi_reg_pp0_iter1_tmp_data_V_1_reg_385 = ap_phi_reg_pp0_iter0_tmp_data_V_1_reg_385.read(); } } } if ( ap_rst.read() == ap_const_logic_1) { ap_phi_reg_pp0_iter1_tmp_keep_V_1_reg_352 = ap_const_lv8_0; } else { if (esl_seteq<1,1,1>(ap_condition_334.read(), ap_const_boolean_1)) { if (esl_seteq<1,1,1>(ap_condition_849.read(), ap_const_boolean_1)) { ap_phi_reg_pp0_iter1_tmp_keep_V_1_reg_352 = ap_const_lv8_FF; } else if (esl_seteq<1,1,1>(ap_condition_722.read(), ap_const_boolean_1)) { ap_phi_reg_pp0_iter1_tmp_keep_V_1_reg_352 = tempOutput_keep_V_fu_1218_p258.read(); } else if (esl_seteq<1,1,1>(ap_const_boolean_1, ap_const_boolean_1)) { ap_phi_reg_pp0_iter1_tmp_keep_V_1_reg_352 = ap_phi_reg_pp0_iter0_tmp_keep_V_1_reg_352.read(); } } } if ( ap_rst.read() == ap_const_logic_1) { ap_phi_reg_pp0_iter1_tmp_keep_V_3_reg_322 = ap_const_lv8_0; } else { if (esl_seteq<1,1,1>(ap_condition_334.read(), ap_const_boolean_1)) { if (esl_seteq<1,1,1>(ap_condition_708.read(), ap_const_boolean_1)) { ap_phi_reg_pp0_iter1_tmp_keep_V_3_reg_322 = ap_const_lv8_FF; } else if (esl_seteq<1,1,1>(ap_condition_839.read(), ap_const_boolean_1)) { ap_phi_reg_pp0_iter1_tmp_keep_V_3_reg_322 = tempKeep_V_fu_620_p258.read(); } else if (esl_seteq<1,1,1>(ap_const_boolean_1, ap_const_boolean_1)) { ap_phi_reg_pp0_iter1_tmp_keep_V_3_reg_322 = ap_phi_reg_pp0_iter0_tmp_keep_V_3_reg_322.read(); } } } if ( ap_rst.read() == ap_const_logic_1) { ap_phi_reg_pp0_iter1_tmp_last_V_1_reg_336 = ap_const_lv1_0; } else { if (esl_seteq<1,1,1>(ap_condition_334.read(), ap_const_boolean_1)) { if (esl_seteq<1,1,1>(ap_condition_849.read(), ap_const_boolean_1)) { ap_phi_reg_pp0_iter1_tmp_last_V_1_reg_336 = ap_const_lv1_0; } else if (esl_seteq<1,1,1>(ap_condition_722.read(), ap_const_boolean_1)) { ap_phi_reg_pp0_iter1_tmp_last_V_1_reg_336 = ap_const_lv1_1; } else if (esl_seteq<1,1,1>(ap_const_boolean_1, ap_const_boolean_1)) { ap_phi_reg_pp0_iter1_tmp_last_V_1_reg_336 = ap_phi_reg_pp0_iter0_tmp_last_V_1_reg_336.read(); } } } if ( ap_rst.read() == ap_const_logic_1) { ap_phi_reg_pp0_iter1_tmp_last_V_2_reg_306 = ap_const_lv1_0; } else { if (esl_seteq<1,1,1>(ap_condition_334.read(), ap_const_boolean_1)) { if (esl_seteq<1,1,1>(ap_condition_708.read(), ap_const_boolean_1)) { ap_phi_reg_pp0_iter1_tmp_last_V_2_reg_306 = ap_const_lv1_0; } else if (esl_seteq<1,1,1>(ap_condition_839.read(), ap_const_boolean_1)) { ap_phi_reg_pp0_iter1_tmp_last_V_2_reg_306 = ap_const_lv1_1; } else if (esl_seteq<1,1,1>(ap_const_boolean_1, ap_const_boolean_1)) { ap_phi_reg_pp0_iter1_tmp_last_V_2_reg_306 = ap_phi_reg_pp0_iter0_tmp_last_V_2_reg_306.read(); } } } if ( ap_rst.read() == ap_const_logic_1) { ap_phi_reg_pp0_iter1_tmp_last_V_reg_366 = ap_const_lv1_0; } else { if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter0_fsm_state1.read()) && esl_seteq<1,1,1>(tmp_i_fu_541_p2.read(), ap_const_lv1_0) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_i_82_fu_559_p2.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_18_i_fu_570_p2.read()) && !(esl_seteq<1,1,1>(ap_start.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_done_reg.read(), ap_const_logic_1) || (esl_seteq<1,1,1>(metadataBuffer_rf_V_s_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op142_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op134_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op56_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op37_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter2_fsm_state3.read()) && (esl_seteq<1,1,1>(respOutput_V_last_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_keep_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_user_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_data_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state3_io.read()))) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter1_fsm_state2.read()) && esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state2_io.read()))) && esl_seteq<1,1,1>(tmp_24_i_fu_576_p2.read(), ap_const_lv1_1) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_28_i_fu_497_p2.read()) && esl_seteq<1,1,1>(ap_const_lv1_1, tmp_64_fu_1754_p2.read()))) { ap_phi_reg_pp0_iter1_tmp_last_V_reg_366 = ap_const_lv1_1; } else if (((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter0_fsm_state1.read()) && esl_seteq<1,1,1>(tmp_i_fu_541_p2.read(), ap_const_lv1_0) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_i_82_fu_559_p2.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_18_i_fu_570_p2.read()) && !(esl_seteq<1,1,1>(ap_start.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_done_reg.read(), ap_const_logic_1) || (esl_seteq<1,1,1>(metadataBuffer_rf_V_s_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op142_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op134_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op56_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op37_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter2_fsm_state3.read()) && (esl_seteq<1,1,1>(respOutput_V_last_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_keep_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_user_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_data_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state3_io.read()))) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter1_fsm_state2.read()) && esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state2_io.read()))) && esl_seteq<1,1,1>(tmp_24_i_fu_576_p2.read(), ap_const_lv1_1) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_28_i_fu_497_p2.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_64_fu_1754_p2.read())) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter0_fsm_state1.read()) && esl_seteq<1,1,1>(tmp_i_fu_541_p2.read(), ap_const_lv1_0) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_i_82_fu_559_p2.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_18_i_fu_570_p2.read()) && !(esl_seteq<1,1,1>(ap_start.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_done_reg.read(), ap_const_logic_1) || (esl_seteq<1,1,1>(metadataBuffer_rf_V_s_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op142_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op134_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op56_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op37_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter2_fsm_state3.read()) && (esl_seteq<1,1,1>(respOutput_V_last_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_keep_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_user_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_data_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state3_io.read()))) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter1_fsm_state2.read()) && esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state2_io.read()))) && esl_seteq<1,1,1>(tmp_24_i_fu_576_p2.read(), ap_const_lv1_1) && esl_seteq<1,1,1>(ap_const_lv1_1, tmp_28_i_fu_497_p2.read())))) { ap_phi_reg_pp0_iter1_tmp_last_V_reg_366 = ap_const_lv1_0; } else if ((!(esl_seteq<1,1,1>(ap_start.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_done_reg.read(), ap_const_logic_1) || (esl_seteq<1,1,1>(metadataBuffer_rf_V_s_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op142_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op134_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op56_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op37_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter2_fsm_state3.read()) && (esl_seteq<1,1,1>(respOutput_V_last_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_keep_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_user_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_data_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state3_io.read()))) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter1_fsm_state2.read()) && esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state2_io.read()))) && esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter0_fsm_state1.read()))) { ap_phi_reg_pp0_iter1_tmp_last_V_reg_366 = ap_phi_reg_pp0_iter0_tmp_last_V_reg_366.read(); } } if ( ap_rst.read() == ap_const_logic_1) { ap_phi_reg_pp0_iter1_xtrasBuffer_V_flag_8_reg_414 = ap_const_lv1_0; } else { if (((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter0_fsm_state1.read()) && esl_seteq<1,1,1>(tmp_i_fu_541_p2.read(), ap_const_lv1_0) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_i_82_fu_559_p2.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_18_i_fu_570_p2.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_24_i_fu_576_p2.read()) && esl_seteq<1,1,1>(ap_const_lv1_1, grp_nbreadreq_fu_256_p3.read()) && esl_seteq<1,1,1>(tmp_29_i_fu_582_p2.read(), ap_const_lv1_1) && !(esl_seteq<1,1,1>(ap_start.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_done_reg.read(), ap_const_logic_1) || (esl_seteq<1,1,1>(metadataBuffer_rf_V_s_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op142_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op134_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op56_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op37_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter2_fsm_state3.read()) && (esl_seteq<1,1,1>(respOutput_V_last_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_keep_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_user_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_data_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state3_io.read()))) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter1_fsm_state2.read()) && esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state2_io.read())))) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter0_fsm_state1.read()) && esl_seteq<1,1,1>(tmp_i_fu_541_p2.read(), ap_const_lv1_0) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_i_82_fu_559_p2.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_18_i_fu_570_p2.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_24_i_fu_576_p2.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_29_i_fu_582_p2.read()) && esl_seteq<1,1,1>(tmp_31_i_fu_588_p2.read(), ap_const_lv1_1) && esl_seteq<1,1,1>(ap_const_lv1_1, tmp_34_i_fu_606_p2.read()) && esl_seteq<1,1,1>(ap_const_lv1_1, grp_nbreadreq_fu_256_p3.read()) && !(esl_seteq<1,1,1>(ap_start.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_done_reg.read(), ap_const_logic_1) || (esl_seteq<1,1,1>(metadataBuffer_rf_V_s_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op142_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op134_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op56_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op37_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter2_fsm_state3.read()) && (esl_seteq<1,1,1>(respOutput_V_last_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_keep_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_user_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_data_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state3_io.read()))) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter1_fsm_state2.read()) && esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state2_io.read())))))) { ap_phi_reg_pp0_iter1_xtrasBuffer_V_flag_8_reg_414 = ap_const_lv1_1; } else if (((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter0_fsm_state1.read()) && esl_seteq<1,1,1>(tmp_i_fu_541_p2.read(), ap_const_lv1_0) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_i_82_fu_559_p2.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_18_i_fu_570_p2.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_24_i_fu_576_p2.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_29_i_fu_582_p2.read()) && !(esl_seteq<1,1,1>(ap_start.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_done_reg.read(), ap_const_logic_1) || (esl_seteq<1,1,1>(metadataBuffer_rf_V_s_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op142_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op134_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op56_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op37_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter2_fsm_state3.read()) && (esl_seteq<1,1,1>(respOutput_V_last_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_keep_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_user_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_data_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state3_io.read()))) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter1_fsm_state2.read()) && esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state2_io.read()))) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_31_i_fu_588_p2.read())) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter0_fsm_state1.read()) && !(esl_seteq<1,1,1>(ap_start.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_done_reg.read(), ap_const_logic_1) || (esl_seteq<1,1,1>(metadataBuffer_rf_V_s_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op142_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op134_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op56_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op37_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter2_fsm_state3.read()) && (esl_seteq<1,1,1>(respOutput_V_last_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_keep_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_user_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_data_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state3_io.read()))) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter1_fsm_state2.read()) && esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state2_io.read()))) && ((esl_seteq<1,1,1>(tmp_i_fu_541_p2.read(), ap_const_lv1_0) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_i_82_fu_559_p2.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_18_i_fu_570_p2.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_24_i_fu_576_p2.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_29_i_fu_582_p2.read()) && esl_seteq<1,1,1>(tmp_31_i_fu_588_p2.read(), ap_const_lv1_1) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_34_i_fu_606_p2.read())) || (esl_seteq<1,1,1>(tmp_i_fu_541_p2.read(), ap_const_lv1_0) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_i_82_fu_559_p2.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_18_i_fu_570_p2.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_24_i_fu_576_p2.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_29_i_fu_582_p2.read()) && esl_seteq<1,1,1>(tmp_31_i_fu_588_p2.read(), ap_const_lv1_1) && esl_seteq<1,1,1>(ap_const_lv1_0, grp_nbreadreq_fu_256_p3.read())))) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter0_fsm_state1.read()) && esl_seteq<1,1,1>(tmp_i_fu_541_p2.read(), ap_const_lv1_0) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_i_82_fu_559_p2.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_18_i_fu_570_p2.read()) && !(esl_seteq<1,1,1>(ap_start.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_done_reg.read(), ap_const_logic_1) || (esl_seteq<1,1,1>(metadataBuffer_rf_V_s_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op142_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op134_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op56_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op37_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter2_fsm_state3.read()) && (esl_seteq<1,1,1>(respOutput_V_last_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_keep_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_user_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_data_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state3_io.read()))) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter1_fsm_state2.read()) && esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state2_io.read()))) && esl_seteq<1,1,1>(tmp_24_i_fu_576_p2.read(), ap_const_lv1_1)) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter0_fsm_state1.read()) && esl_seteq<1,1,1>(tmp_i_fu_541_p2.read(), ap_const_lv1_0) && esl_seteq<1,1,1>(tmp_i_82_fu_559_p2.read(), ap_const_lv1_1) && !(esl_seteq<1,1,1>(ap_start.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_done_reg.read(), ap_const_logic_1) || (esl_seteq<1,1,1>(metadataBuffer_rf_V_s_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op142_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op134_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op56_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op37_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter2_fsm_state3.read()) && (esl_seteq<1,1,1>(respOutput_V_last_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_keep_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_user_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_data_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state3_io.read()))) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter1_fsm_state2.read()) && esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state2_io.read()))) && esl_seteq<1,1,1>(ap_const_lv1_1, or_cond2_i_fu_1902_p2.read())) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter0_fsm_state1.read()) && esl_seteq<1,1,1>(tmp_i_fu_541_p2.read(), ap_const_lv1_0) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_i_82_fu_559_p2.read()) && !(esl_seteq<1,1,1>(ap_start.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_done_reg.read(), ap_const_logic_1) || (esl_seteq<1,1,1>(metadataBuffer_rf_V_s_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op142_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op134_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op56_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op37_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter2_fsm_state3.read()) && (esl_seteq<1,1,1>(respOutput_V_last_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_keep_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_user_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_data_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state3_io.read()))) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter1_fsm_state2.read()) && esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state2_io.read()))) && esl_seteq<1,1,1>(tmp_18_i_fu_570_p2.read(), ap_const_lv1_1)) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter0_fsm_state1.read()) && esl_seteq<1,1,1>(tmp_i_fu_541_p2.read(), ap_const_lv1_0) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_i_82_fu_559_p2.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_18_i_fu_570_p2.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_24_i_fu_576_p2.read()) && esl_seteq<1,1,1>(tmp_29_i_fu_582_p2.read(), ap_const_lv1_1) && !(esl_seteq<1,1,1>(ap_start.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_done_reg.read(), ap_const_logic_1) || (esl_seteq<1,1,1>(metadataBuffer_rf_V_s_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op142_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op134_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op56_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op37_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter2_fsm_state3.read()) && (esl_seteq<1,1,1>(respOutput_V_last_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_keep_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_user_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_data_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state3_io.read()))) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter1_fsm_state2.read()) && esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state2_io.read()))) && esl_seteq<1,1,1>(ap_const_lv1_0, grp_nbreadreq_fu_256_p3.read())))) { ap_phi_reg_pp0_iter1_xtrasBuffer_V_flag_8_reg_414 = ap_const_lv1_0; } else if ((!(esl_seteq<1,1,1>(ap_start.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_done_reg.read(), ap_const_logic_1) || (esl_seteq<1,1,1>(metadataBuffer_rf_V_s_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op142_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op134_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op56_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op37_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter2_fsm_state3.read()) && (esl_seteq<1,1,1>(respOutput_V_last_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_keep_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_user_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_data_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state3_io.read()))) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter1_fsm_state2.read()) && esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state2_io.read()))) && esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter0_fsm_state1.read()))) { ap_phi_reg_pp0_iter1_xtrasBuffer_V_flag_8_reg_414 = ap_phi_reg_pp0_iter0_xtrasBuffer_V_flag_8_reg_414.read(); } } if ( ap_rst.read() == ap_const_logic_1) { ap_phi_reg_pp0_iter1_xtrasBuffer_V_new_8_s_reg_449 = ap_const_lv64_0; } else { if (((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter0_fsm_state1.read()) && esl_seteq<1,1,1>(tmp_i_fu_541_p2.read(), ap_const_lv1_0) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_i_82_fu_559_p2.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_18_i_fu_570_p2.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_24_i_fu_576_p2.read()) && esl_seteq<1,1,1>(ap_const_lv1_1, grp_nbreadreq_fu_256_p3.read()) && esl_seteq<1,1,1>(tmp_29_i_fu_582_p2.read(), ap_const_lv1_1) && !(esl_seteq<1,1,1>(ap_start.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_done_reg.read(), ap_const_logic_1) || (esl_seteq<1,1,1>(metadataBuffer_rf_V_s_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op142_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op134_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op56_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op37_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter2_fsm_state3.read()) && (esl_seteq<1,1,1>(respOutput_V_last_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_keep_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_user_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_data_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state3_io.read()))) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter1_fsm_state2.read()) && esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state2_io.read())))) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter0_fsm_state1.read()) && esl_seteq<1,1,1>(tmp_i_fu_541_p2.read(), ap_const_lv1_0) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_i_82_fu_559_p2.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_18_i_fu_570_p2.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_24_i_fu_576_p2.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_29_i_fu_582_p2.read()) && esl_seteq<1,1,1>(tmp_31_i_fu_588_p2.read(), ap_const_lv1_1) && esl_seteq<1,1,1>(ap_const_lv1_1, tmp_34_i_fu_606_p2.read()) && esl_seteq<1,1,1>(ap_const_lv1_1, grp_nbreadreq_fu_256_p3.read()) && !(esl_seteq<1,1,1>(ap_start.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_done_reg.read(), ap_const_logic_1) || (esl_seteq<1,1,1>(metadataBuffer_rf_V_s_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op142_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op134_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op56_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op37_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter2_fsm_state3.read()) && (esl_seteq<1,1,1>(respOutput_V_last_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_keep_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_user_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_data_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state3_io.read()))) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter1_fsm_state2.read()) && esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state2_io.read())))))) { ap_phi_reg_pp0_iter1_xtrasBuffer_V_new_8_s_reg_449 = valueBuffer_rf_V_V_dout.read(); } else if ((!(esl_seteq<1,1,1>(ap_start.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_done_reg.read(), ap_const_logic_1) || (esl_seteq<1,1,1>(metadataBuffer_rf_V_s_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op142_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op134_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op56_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op37_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter2_fsm_state3.read()) && (esl_seteq<1,1,1>(respOutput_V_last_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_keep_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_user_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_data_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state3_io.read()))) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter1_fsm_state2.read()) && esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state2_io.read()))) && esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter0_fsm_state1.read()))) { ap_phi_reg_pp0_iter1_xtrasBuffer_V_new_8_s_reg_449 = ap_phi_reg_pp0_iter0_xtrasBuffer_V_new_8_s_reg_449.read(); } } if ( ap_rst.read() == ap_const_logic_1) { ap_phi_reg_pp0_iter1_xtrasBuffer_V_new_i_reg_394 = ap_const_lv64_0; } else { if (esl_seteq<1,1,1>(ap_condition_334.read(), ap_const_boolean_1)) { if (esl_seteq<1,1,1>(ap_condition_88.read(), ap_const_boolean_1)) { ap_phi_reg_pp0_iter1_xtrasBuffer_V_new_i_reg_394 = valueBuffer_rf_V_V_dout.read(); } else if (esl_seteq<1,1,1>(ap_condition_785.read(), ap_const_boolean_1)) { ap_phi_reg_pp0_iter1_xtrasBuffer_V_new_i_reg_394 = ap_const_lv64_0; } else if (esl_seteq<1,1,1>(ap_const_boolean_1, ap_const_boolean_1)) { ap_phi_reg_pp0_iter1_xtrasBuffer_V_new_i_reg_394 = ap_phi_reg_pp0_iter0_xtrasBuffer_V_new_i_reg_394.read(); } } } if ( ap_rst.read() == ap_const_logic_1) { br_outWordCounter = ap_const_lv5_0; } else { if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter0_fsm_state1.read()) && esl_seteq<1,1,1>(ap_predicate_op142_read_state1.read(), ap_const_boolean_1) && !(esl_seteq<1,1,1>(ap_start.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_done_reg.read(), ap_const_logic_1) || (esl_seteq<1,1,1>(metadataBuffer_rf_V_s_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op142_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op134_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op56_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op37_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter2_fsm_state3.read()) && (esl_seteq<1,1,1>(respOutput_V_last_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_keep_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_user_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_data_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state3_io.read()))) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter1_fsm_state2.read()) && esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state2_io.read()))))) { br_outWordCounter = ap_const_lv5_1; } else if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter0_fsm_state1.read()) && esl_seteq<1,1,1>(tmp_i_fu_541_p2.read(), ap_const_lv1_0) && esl_seteq<1,1,1>(tmp_i_82_fu_559_p2.read(), ap_const_lv1_1) && esl_seteq<1,1,1>(ap_const_lv1_0, or_cond2_i_fu_1902_p2.read()) && !(esl_seteq<1,1,1>(ap_start.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_done_reg.read(), ap_const_logic_1) || (esl_seteq<1,1,1>(metadataBuffer_rf_V_s_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op142_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op134_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op56_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op37_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter2_fsm_state3.read()) && (esl_seteq<1,1,1>(respOutput_V_last_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_keep_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_user_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_data_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state3_io.read()))) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter1_fsm_state2.read()) && esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state2_io.read()))))) { br_outWordCounter = ap_const_lv5_2; } else if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter0_fsm_state1.read()) && esl_seteq<1,1,1>(tmp_i_fu_541_p2.read(), ap_const_lv1_0) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_i_82_fu_559_p2.read()) && !(esl_seteq<1,1,1>(ap_start.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_done_reg.read(), ap_const_logic_1) || (esl_seteq<1,1,1>(metadataBuffer_rf_V_s_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op142_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op134_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op56_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op37_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter2_fsm_state3.read()) && (esl_seteq<1,1,1>(respOutput_V_last_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_keep_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_user_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_data_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state3_io.read()))) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter1_fsm_state2.read()) && esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state2_io.read()))) && esl_seteq<1,1,1>(tmp_18_i_fu_570_p2.read(), ap_const_lv1_1))) { br_outWordCounter = ap_const_lv5_3; } else if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter0_fsm_state1.read()) && esl_seteq<1,1,1>(tmp_i_fu_541_p2.read(), ap_const_lv1_0) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_i_82_fu_559_p2.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_18_i_fu_570_p2.read()) && !(esl_seteq<1,1,1>(ap_start.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_done_reg.read(), ap_const_logic_1) || (esl_seteq<1,1,1>(metadataBuffer_rf_V_s_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op142_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op134_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op56_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op37_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter2_fsm_state3.read()) && (esl_seteq<1,1,1>(respOutput_V_last_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_keep_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_user_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_data_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state3_io.read()))) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter1_fsm_state2.read()) && esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state2_io.read()))) && esl_seteq<1,1,1>(tmp_24_i_fu_576_p2.read(), ap_const_lv1_1) && esl_seteq<1,1,1>(ap_const_lv1_1, tmp_28_i_fu_497_p2.read()))) { br_outWordCounter = ap_const_lv5_7; } else if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter0_fsm_state1.read()) && esl_seteq<1,1,1>(tmp_i_fu_541_p2.read(), ap_const_lv1_0) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_i_82_fu_559_p2.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_18_i_fu_570_p2.read()) && !(esl_seteq<1,1,1>(ap_start.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_done_reg.read(), ap_const_logic_1) || (esl_seteq<1,1,1>(metadataBuffer_rf_V_s_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op142_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op134_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op56_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op37_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter2_fsm_state3.read()) && (esl_seteq<1,1,1>(respOutput_V_last_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_keep_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_user_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_data_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state3_io.read()))) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter1_fsm_state2.read()) && esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state2_io.read()))) && esl_seteq<1,1,1>(tmp_24_i_fu_576_p2.read(), ap_const_lv1_1) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_28_i_fu_497_p2.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_64_fu_1754_p2.read()) && esl_seteq<1,1,1>(ap_const_lv1_1, grp_fu_512_p2.read()))) { br_outWordCounter = ap_const_lv5_4; } else if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter0_fsm_state1.read()) && esl_seteq<1,1,1>(tmp_i_fu_541_p2.read(), ap_const_lv1_0) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_i_82_fu_559_p2.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_18_i_fu_570_p2.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_24_i_fu_576_p2.read()) && esl_seteq<1,1,1>(ap_const_lv1_1, grp_nbreadreq_fu_256_p3.read()) && esl_seteq<1,1,1>(tmp_29_i_fu_582_p2.read(), ap_const_lv1_1) && !(esl_seteq<1,1,1>(ap_start.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_done_reg.read(), ap_const_logic_1) || (esl_seteq<1,1,1>(metadataBuffer_rf_V_s_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op142_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op134_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op56_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op37_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter2_fsm_state3.read()) && (esl_seteq<1,1,1>(respOutput_V_last_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_keep_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_user_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_data_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state3_io.read()))) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter1_fsm_state2.read()) && esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state2_io.read()))) && esl_seteq<1,1,1>(ap_const_lv1_0, grp_fu_492_p2.read()))) { br_outWordCounter = ap_const_lv5_5; } else if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter0_fsm_state1.read()) && esl_seteq<1,1,1>(tmp_i_fu_541_p2.read(), ap_const_lv1_0) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_i_82_fu_559_p2.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_18_i_fu_570_p2.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_24_i_fu_576_p2.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_29_i_fu_582_p2.read()) && esl_seteq<1,1,1>(tmp_31_i_fu_588_p2.read(), ap_const_lv1_1) && esl_seteq<1,1,1>(ap_const_lv1_1, tmp_34_i_fu_606_p2.read()) && esl_seteq<1,1,1>(ap_const_lv1_1, grp_nbreadreq_fu_256_p3.read()) && !(esl_seteq<1,1,1>(ap_start.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_done_reg.read(), ap_const_logic_1) || (esl_seteq<1,1,1>(metadataBuffer_rf_V_s_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op142_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op134_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op56_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op37_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter2_fsm_state3.read()) && (esl_seteq<1,1,1>(respOutput_V_last_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_keep_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_user_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_data_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state3_io.read()))) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter1_fsm_state2.read()) && esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state2_io.read()))) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_46_i_fu_1164_p2.read()) && esl_seteq<1,1,1>(ap_const_lv1_1, tmp_50_i_fu_1170_p2.read()))) { br_outWordCounter = ap_const_lv5_6; } else if (((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter0_fsm_state1.read()) && esl_seteq<1,1,1>(tmp_i_fu_541_p2.read(), ap_const_lv1_0) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_i_82_fu_559_p2.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_18_i_fu_570_p2.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_24_i_fu_576_p2.read()) && esl_seteq<1,1,1>(ap_const_lv1_1, grp_nbreadreq_fu_256_p3.read()) && esl_seteq<1,1,1>(tmp_29_i_fu_582_p2.read(), ap_const_lv1_1) && !(esl_seteq<1,1,1>(ap_start.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_done_reg.read(), ap_const_logic_1) || (esl_seteq<1,1,1>(metadataBuffer_rf_V_s_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op142_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op134_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op56_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op37_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter2_fsm_state3.read()) && (esl_seteq<1,1,1>(respOutput_V_last_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_keep_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_user_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_data_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state3_io.read()))) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter1_fsm_state2.read()) && esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state2_io.read()))) && esl_seteq<1,1,1>(ap_const_lv1_1, grp_fu_492_p2.read())) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter0_fsm_state1.read()) && esl_seteq<1,1,1>(tmp_i_fu_541_p2.read(), ap_const_lv1_0) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_i_82_fu_559_p2.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_18_i_fu_570_p2.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_24_i_fu_576_p2.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_29_i_fu_582_p2.read()) && esl_seteq<1,1,1>(tmp_31_i_fu_588_p2.read(), ap_const_lv1_1) && esl_seteq<1,1,1>(ap_const_lv1_1, tmp_34_i_fu_606_p2.read()) && esl_seteq<1,1,1>(ap_const_lv1_1, grp_nbreadreq_fu_256_p3.read()) && !(esl_seteq<1,1,1>(ap_start.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_done_reg.read(), ap_const_logic_1) || (esl_seteq<1,1,1>(metadataBuffer_rf_V_s_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op142_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op134_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op56_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op37_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter2_fsm_state3.read()) && (esl_seteq<1,1,1>(respOutput_V_last_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_keep_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_user_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_data_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state3_io.read()))) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter1_fsm_state2.read()) && esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state2_io.read()))) && esl_seteq<1,1,1>(ap_const_lv1_1, tmp_46_i_fu_1164_p2.read())) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter0_fsm_state1.read()) && esl_seteq<1,1,1>(tmp_i_fu_541_p2.read(), ap_const_lv1_0) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_i_82_fu_559_p2.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_18_i_fu_570_p2.read()) && !(esl_seteq<1,1,1>(ap_start.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_done_reg.read(), ap_const_logic_1) || (esl_seteq<1,1,1>(metadataBuffer_rf_V_s_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op142_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op134_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op56_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op37_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter2_fsm_state3.read()) && (esl_seteq<1,1,1>(respOutput_V_last_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_keep_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_user_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_data_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state3_io.read()))) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter1_fsm_state2.read()) && esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state2_io.read()))) && esl_seteq<1,1,1>(tmp_24_i_fu_576_p2.read(), ap_const_lv1_1) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_28_i_fu_497_p2.read()) && esl_seteq<1,1,1>(ap_const_lv1_1, tmp_64_fu_1754_p2.read())) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter0_fsm_state1.read()) && esl_seteq<1,1,1>(tmp_i_fu_541_p2.read(), ap_const_lv1_0) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_i_82_fu_559_p2.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_18_i_fu_570_p2.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_24_i_fu_576_p2.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_29_i_fu_582_p2.read()) && !(esl_seteq<1,1,1>(ap_start.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_done_reg.read(), ap_const_logic_1) || (esl_seteq<1,1,1>(metadataBuffer_rf_V_s_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op142_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op134_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op56_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op37_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter2_fsm_state3.read()) && (esl_seteq<1,1,1>(respOutput_V_last_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_keep_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_user_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_data_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state3_io.read()))) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter1_fsm_state2.read()) && esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state2_io.read()))) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_31_i_fu_588_p2.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_35_i_fu_594_p2.read()) && esl_seteq<1,1,1>(ap_const_lv1_1, tmp_41_i_fu_600_p2.read())) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter0_fsm_state1.read()) && esl_seteq<1,1,1>(tmp_i_fu_541_p2.read(), ap_const_lv1_0) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_i_82_fu_559_p2.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_18_i_fu_570_p2.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_24_i_fu_576_p2.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_29_i_fu_582_p2.read()) && !(esl_seteq<1,1,1>(ap_start.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_done_reg.read(), ap_const_logic_1) || (esl_seteq<1,1,1>(metadataBuffer_rf_V_s_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op142_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op134_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op56_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op37_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter2_fsm_state3.read()) && (esl_seteq<1,1,1>(respOutput_V_last_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_keep_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_user_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_data_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state3_io.read()))) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter1_fsm_state2.read()) && esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state2_io.read()))) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_31_i_fu_588_p2.read()) && esl_seteq<1,1,1>(ap_const_lv1_1, tmp_35_i_fu_594_p2.read())) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter0_fsm_state1.read()) && !(esl_seteq<1,1,1>(ap_start.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_done_reg.read(), ap_const_logic_1) || (esl_seteq<1,1,1>(metadataBuffer_rf_V_s_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op142_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op134_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op56_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op37_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter2_fsm_state3.read()) && (esl_seteq<1,1,1>(respOutput_V_last_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_keep_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_user_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_data_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state3_io.read()))) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter1_fsm_state2.read()) && esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state2_io.read()))) && ((esl_seteq<1,1,1>(tmp_i_fu_541_p2.read(), ap_const_lv1_0) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_i_82_fu_559_p2.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_18_i_fu_570_p2.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_24_i_fu_576_p2.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_29_i_fu_582_p2.read()) && esl_seteq<1,1,1>(tmp_31_i_fu_588_p2.read(), ap_const_lv1_1) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_34_i_fu_606_p2.read()) && esl_seteq<1,1,1>(ap_const_lv1_1, grp_fu_492_p2.read())) || (esl_seteq<1,1,1>(tmp_i_fu_541_p2.read(), ap_const_lv1_0) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_i_82_fu_559_p2.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_18_i_fu_570_p2.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_24_i_fu_576_p2.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_29_i_fu_582_p2.read()) && esl_seteq<1,1,1>(tmp_31_i_fu_588_p2.read(), ap_const_lv1_1) && esl_seteq<1,1,1>(ap_const_lv1_0, grp_nbreadreq_fu_256_p3.read()) && esl_seteq<1,1,1>(ap_const_lv1_1, grp_fu_492_p2.read())))))) { br_outWordCounter = ap_const_lv5_0; } } if ( ap_rst.read() == ap_const_logic_1) { errorCode = ap_const_lv8_0; } else { if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter0_fsm_state1.read()) && esl_seteq<1,1,1>(ap_predicate_op142_read_state1.read(), ap_const_boolean_1) && !(esl_seteq<1,1,1>(ap_start.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_done_reg.read(), ap_const_logic_1) || (esl_seteq<1,1,1>(metadataBuffer_rf_V_s_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op142_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op134_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op56_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op37_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter2_fsm_state3.read()) && (esl_seteq<1,1,1>(respOutput_V_last_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_keep_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_user_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_data_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state3_io.read()))) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter1_fsm_state2.read()) && esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state2_io.read()))))) { errorCode = metadataBuffer_rf_V_s_dout.read().range(119, 112); } } if ( ap_rst.read() == ap_const_logic_1) { or_cond2_i_reg_3479 = ap_const_lv1_0; } else { if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter0_fsm_state1.read()) && esl_seteq<1,1,1>(tmp_i_fu_541_p2.read(), ap_const_lv1_0) && esl_seteq<1,1,1>(tmp_i_82_fu_559_p2.read(), ap_const_lv1_1) && !(esl_seteq<1,1,1>(ap_start.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_done_reg.read(), ap_const_logic_1) || (esl_seteq<1,1,1>(metadataBuffer_rf_V_s_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op142_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op134_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op56_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op37_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter2_fsm_state3.read()) && (esl_seteq<1,1,1>(respOutput_V_last_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_keep_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_user_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_data_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state3_io.read()))) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter1_fsm_state2.read()) && esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state2_io.read()))))) { or_cond2_i_reg_3479 = or_cond2_i_fu_1902_p2.read(); } } if ( ap_rst.read() == ap_const_logic_1) { or_cond2_i_reg_3479_pp0_iter1_reg = ap_const_lv1_0; } else { if ((!(esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state2_io.read()) || esl_seteq<1,1,1>(ap_done_reg.read(), ap_const_logic_1) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter2_fsm_state3.read()) && (esl_seteq<1,1,1>(respOutput_V_last_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_keep_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_user_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_data_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state3_io.read())))) && esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter1_fsm_state2.read()))) { or_cond2_i_reg_3479_pp0_iter1_reg = or_cond2_i_reg_3479.read(); } } if ( ap_rst.read() == ap_const_logic_1) { outMetadataTempBuffe = ap_const_lv248_lc_1; } else { if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter0_fsm_state1.read()) && esl_seteq<1,1,1>(ap_predicate_op142_read_state1.read(), ap_const_boolean_1) && !(esl_seteq<1,1,1>(ap_start.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_done_reg.read(), ap_const_logic_1) || (esl_seteq<1,1,1>(metadataBuffer_rf_V_s_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op142_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op134_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op56_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op37_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter2_fsm_state3.read()) && (esl_seteq<1,1,1>(respOutput_V_last_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_keep_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_user_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_data_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state3_io.read()))) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter1_fsm_state2.read()) && esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state2_io.read()))))) { outMetadataTempBuffe = metadataBuffer_rf_V_s_dout.read(); } } if ( ap_rst.read() == ap_const_logic_1) { outOpCode = ap_const_lv8_0; } else { if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter0_fsm_state1.read()) && esl_seteq<1,1,1>(ap_predicate_op142_read_state1.read(), ap_const_boolean_1) && !(esl_seteq<1,1,1>(ap_start.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_done_reg.read(), ap_const_logic_1) || (esl_seteq<1,1,1>(metadataBuffer_rf_V_s_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op142_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op134_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op56_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op37_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter2_fsm_state3.read()) && (esl_seteq<1,1,1>(respOutput_V_last_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_keep_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_user_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_data_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state3_io.read()))) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter1_fsm_state2.read()) && esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state2_io.read()))))) { outOpCode = metadataBuffer_rf_V_s_dout.read().range(111, 104); } } if ( ap_rst.read() == ap_const_logic_1) { p_Result_1_i_reg_3483 = ap_const_lv96_0; } else { if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter0_fsm_state1.read()) && esl_seteq<1,1,1>(tmp_i_fu_541_p2.read(), ap_const_lv1_0) && esl_seteq<1,1,1>(tmp_i_82_fu_559_p2.read(), ap_const_lv1_1) && esl_seteq<1,1,1>(ap_const_lv1_0, or_cond2_i_fu_1902_p2.read()) && !(esl_seteq<1,1,1>(ap_start.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_done_reg.read(), ap_const_logic_1) || (esl_seteq<1,1,1>(metadataBuffer_rf_V_s_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op142_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op134_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op56_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op37_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter2_fsm_state3.read()) && (esl_seteq<1,1,1>(respOutput_V_last_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_keep_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_user_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_data_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state3_io.read()))) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter1_fsm_state2.read()) && esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state2_io.read()))))) { p_Result_1_i_reg_3483 = outMetadataTempBuffe.read().range(219, 124); } } if ( ap_rst.read() == ap_const_logic_1) { p_Result_2_i_reg_3488 = ap_const_lv8_0; } else { if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter0_fsm_state1.read()) && esl_seteq<1,1,1>(tmp_i_fu_541_p2.read(), ap_const_lv1_0) && esl_seteq<1,1,1>(tmp_i_82_fu_559_p2.read(), ap_const_lv1_1) && esl_seteq<1,1,1>(ap_const_lv1_0, or_cond2_i_fu_1902_p2.read()) && !(esl_seteq<1,1,1>(ap_start.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_done_reg.read(), ap_const_logic_1) || (esl_seteq<1,1,1>(metadataBuffer_rf_V_s_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op142_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op134_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op56_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op37_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter2_fsm_state3.read()) && (esl_seteq<1,1,1>(respOutput_V_last_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_keep_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_user_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_data_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state3_io.read()))) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter1_fsm_state2.read()) && esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state2_io.read()))))) { p_Result_2_i_reg_3488 = outMetadataTempBuffe.read().range(111, 104); } } if ( ap_rst.read() == ap_const_logic_1) { p_Result_8_i_reg_3499 = ap_const_lv8_0; } else { if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter0_fsm_state1.read()) && esl_seteq<1,1,1>(tmp_i_fu_541_p2.read(), ap_const_lv1_0) && esl_seteq<1,1,1>(tmp_i_82_fu_559_p2.read(), ap_const_lv1_1) && esl_seteq<1,1,1>(ap_const_lv1_0, or_cond2_i_fu_1902_p2.read()) && !(esl_seteq<1,1,1>(ap_start.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_done_reg.read(), ap_const_logic_1) || (esl_seteq<1,1,1>(metadataBuffer_rf_V_s_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op142_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op134_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op56_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op37_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter2_fsm_state3.read()) && (esl_seteq<1,1,1>(respOutput_V_last_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_keep_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_user_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_data_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state3_io.read()))) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter1_fsm_state2.read()) && esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state2_io.read()))))) { p_Result_8_i_reg_3499 = outMetadataTempBuffe.read().range(119, 112); } } if ( ap_rst.read() == ap_const_logic_1) { respOutput_V_data_V_1_payload_A = ap_const_lv64_0; } else { if (esl_seteq<1,1,1>(ap_const_logic_1, respOutput_V_data_V_1_load_A.read())) { respOutput_V_data_V_1_payload_A = respOutput_V_data_V_1_data_in.read(); } } if ( ap_rst.read() == ap_const_logic_1) { respOutput_V_data_V_1_payload_B = ap_const_lv64_0; } else { if (esl_seteq<1,1,1>(ap_const_logic_1, respOutput_V_data_V_1_load_B.read())) { respOutput_V_data_V_1_payload_B = respOutput_V_data_V_1_data_in.read(); } } if ( ap_rst.read() == ap_const_logic_1) { respOutput_V_data_V_1_sel_rd = ap_const_logic_0; } else { if ((esl_seteq<1,1,1>(ap_const_logic_1, respOutput_V_data_V_1_ack_out.read()) && esl_seteq<1,1,1>(ap_const_logic_1, respOutput_V_data_V_1_vld_out.read()))) { respOutput_V_data_V_1_sel_rd = (sc_logic) (~respOutput_V_data_V_1_sel_rd.read()); } } if ( ap_rst.read() == ap_const_logic_1) { respOutput_V_data_V_1_sel_wr = ap_const_logic_0; } else { if ((esl_seteq<1,1,1>(ap_const_logic_1, respOutput_V_data_V_1_vld_in.read()) && esl_seteq<1,1,1>(ap_const_logic_1, respOutput_V_data_V_1_ack_in.read()))) { respOutput_V_data_V_1_sel_wr = (sc_logic) (~respOutput_V_data_V_1_sel_wr.read()); } } if ( ap_rst.read() == ap_const_logic_1) { respOutput_V_data_V_1_state = ap_const_lv2_0; } else { if (((esl_seteq<1,1,1>(ap_const_logic_0, respOutput_V_data_V_1_vld_in.read()) && esl_seteq<1,1,1>(ap_const_logic_1, respOutput_V_data_V_1_ack_out.read()) && esl_seteq<1,2,2>(respOutput_V_data_V_1_state.read(), ap_const_lv2_3)) || (esl_seteq<1,1,1>(ap_const_logic_0, respOutput_V_data_V_1_vld_in.read()) && esl_seteq<1,2,2>(respOutput_V_data_V_1_state.read(), ap_const_lv2_2)))) { respOutput_V_data_V_1_state = ap_const_lv2_2; } else if (((esl_seteq<1,1,1>(ap_const_logic_1, respOutput_V_data_V_1_vld_in.read()) && esl_seteq<1,1,1>(ap_const_logic_0, respOutput_V_data_V_1_ack_out.read()) && esl_seteq<1,2,2>(respOutput_V_data_V_1_state.read(), ap_const_lv2_3)) || (esl_seteq<1,1,1>(ap_const_logic_0, respOutput_V_data_V_1_ack_out.read()) && esl_seteq<1,2,2>(respOutput_V_data_V_1_state.read(), ap_const_lv2_1)))) { respOutput_V_data_V_1_state = ap_const_lv2_1; } else if (((esl_seteq<1,1,1>(ap_const_logic_1, respOutput_V_data_V_1_vld_in.read()) && esl_seteq<1,2,2>(respOutput_V_data_V_1_state.read(), ap_const_lv2_2)) || (esl_seteq<1,1,1>(ap_const_logic_1, respOutput_V_data_V_1_ack_out.read()) && esl_seteq<1,2,2>(respOutput_V_data_V_1_state.read(), ap_const_lv2_1)) || (esl_seteq<1,2,2>(respOutput_V_data_V_1_state.read(), ap_const_lv2_3) && !(esl_seteq<1,1,1>(ap_const_logic_1, respOutput_V_data_V_1_vld_in.read()) && esl_seteq<1,1,1>(ap_const_logic_0, respOutput_V_data_V_1_ack_out.read())) && !(esl_seteq<1,1,1>(ap_const_logic_0, respOutput_V_data_V_1_vld_in.read()) && esl_seteq<1,1,1>(ap_const_logic_1, respOutput_V_data_V_1_ack_out.read()))))) { respOutput_V_data_V_1_state = ap_const_lv2_3; } else { respOutput_V_data_V_1_state = ap_const_lv2_2; } } if ( ap_rst.read() == ap_const_logic_1) { respOutput_V_keep_V_1_payload_A = ap_const_lv8_0; } else { if (esl_seteq<1,1,1>(ap_const_logic_1, respOutput_V_keep_V_1_load_A.read())) { respOutput_V_keep_V_1_payload_A = respOutput_V_keep_V_1_data_in.read(); } } if ( ap_rst.read() == ap_const_logic_1) { respOutput_V_keep_V_1_payload_B = ap_const_lv8_0; } else { if (esl_seteq<1,1,1>(ap_const_logic_1, respOutput_V_keep_V_1_load_B.read())) { respOutput_V_keep_V_1_payload_B = respOutput_V_keep_V_1_data_in.read(); } } if ( ap_rst.read() == ap_const_logic_1) { respOutput_V_keep_V_1_sel_rd = ap_const_logic_0; } else { if ((esl_seteq<1,1,1>(ap_const_logic_1, respOutput_V_keep_V_1_ack_out.read()) && esl_seteq<1,1,1>(ap_const_logic_1, respOutput_V_keep_V_1_vld_out.read()))) { respOutput_V_keep_V_1_sel_rd = (sc_logic) (~respOutput_V_keep_V_1_sel_rd.read()); } } if ( ap_rst.read() == ap_const_logic_1) { respOutput_V_keep_V_1_sel_wr = ap_const_logic_0; } else { if ((esl_seteq<1,1,1>(ap_const_logic_1, respOutput_V_keep_V_1_vld_in.read()) && esl_seteq<1,1,1>(ap_const_logic_1, respOutput_V_keep_V_1_ack_in.read()))) { respOutput_V_keep_V_1_sel_wr = (sc_logic) (~respOutput_V_keep_V_1_sel_wr.read()); } } if ( ap_rst.read() == ap_const_logic_1) { respOutput_V_keep_V_1_state = ap_const_lv2_0; } else { if (((esl_seteq<1,1,1>(ap_const_logic_0, respOutput_V_keep_V_1_vld_in.read()) && esl_seteq<1,1,1>(ap_const_logic_1, respOutput_V_keep_V_1_ack_out.read()) && esl_seteq<1,2,2>(ap_const_lv2_3, respOutput_V_keep_V_1_state.read())) || (esl_seteq<1,1,1>(ap_const_logic_0, respOutput_V_keep_V_1_vld_in.read()) && esl_seteq<1,2,2>(ap_const_lv2_2, respOutput_V_keep_V_1_state.read())))) { respOutput_V_keep_V_1_state = ap_const_lv2_2; } else if (((esl_seteq<1,1,1>(ap_const_logic_1, respOutput_V_keep_V_1_vld_in.read()) && esl_seteq<1,1,1>(ap_const_logic_0, respOutput_V_keep_V_1_ack_out.read()) && esl_seteq<1,2,2>(ap_const_lv2_3, respOutput_V_keep_V_1_state.read())) || (esl_seteq<1,1,1>(ap_const_logic_0, respOutput_V_keep_V_1_ack_out.read()) && esl_seteq<1,2,2>(ap_const_lv2_1, respOutput_V_keep_V_1_state.read())))) { respOutput_V_keep_V_1_state = ap_const_lv2_1; } else if (((esl_seteq<1,1,1>(ap_const_logic_1, respOutput_V_keep_V_1_vld_in.read()) && esl_seteq<1,2,2>(ap_const_lv2_2, respOutput_V_keep_V_1_state.read())) || (esl_seteq<1,1,1>(ap_const_logic_1, respOutput_V_keep_V_1_ack_out.read()) && esl_seteq<1,2,2>(ap_const_lv2_1, respOutput_V_keep_V_1_state.read())) || (esl_seteq<1,2,2>(ap_const_lv2_3, respOutput_V_keep_V_1_state.read()) && !(esl_seteq<1,1,1>(ap_const_logic_1, respOutput_V_keep_V_1_vld_in.read()) && esl_seteq<1,1,1>(ap_const_logic_0, respOutput_V_keep_V_1_ack_out.read())) && !(esl_seteq<1,1,1>(ap_const_logic_0, respOutput_V_keep_V_1_vld_in.read()) && esl_seteq<1,1,1>(ap_const_logic_1, respOutput_V_keep_V_1_ack_out.read()))))) { respOutput_V_keep_V_1_state = ap_const_lv2_3; } else { respOutput_V_keep_V_1_state = ap_const_lv2_2; } } if ( ap_rst.read() == ap_const_logic_1) { respOutput_V_last_V_1_payload_A = ap_const_lv1_0; } else { if (esl_seteq<1,1,1>(ap_const_logic_1, respOutput_V_last_V_1_load_A.read())) { respOutput_V_last_V_1_payload_A = respOutput_V_last_V_1_data_in.read(); } } if ( ap_rst.read() == ap_const_logic_1) { respOutput_V_last_V_1_payload_B = ap_const_lv1_0; } else { if (esl_seteq<1,1,1>(ap_const_logic_1, respOutput_V_last_V_1_load_B.read())) { respOutput_V_last_V_1_payload_B = respOutput_V_last_V_1_data_in.read(); } } if ( ap_rst.read() == ap_const_logic_1) { respOutput_V_last_V_1_sel_rd = ap_const_logic_0; } else { if ((esl_seteq<1,1,1>(ap_const_logic_1, respOutput_V_last_V_1_ack_out.read()) && esl_seteq<1,1,1>(ap_const_logic_1, respOutput_V_last_V_1_vld_out.read()))) { respOutput_V_last_V_1_sel_rd = (sc_logic) (~respOutput_V_last_V_1_sel_rd.read()); } } if ( ap_rst.read() == ap_const_logic_1) { respOutput_V_last_V_1_sel_wr = ap_const_logic_0; } else { if ((esl_seteq<1,1,1>(ap_const_logic_1, respOutput_V_last_V_1_vld_in.read()) && esl_seteq<1,1,1>(ap_const_logic_1, respOutput_V_last_V_1_ack_in.read()))) { respOutput_V_last_V_1_sel_wr = (sc_logic) (~respOutput_V_last_V_1_sel_wr.read()); } } if ( ap_rst.read() == ap_const_logic_1) { respOutput_V_last_V_1_state = ap_const_lv2_0; } else { if (((esl_seteq<1,1,1>(ap_const_logic_0, respOutput_V_last_V_1_vld_in.read()) && esl_seteq<1,1,1>(ap_const_logic_1, respOutput_V_last_V_1_ack_out.read()) && esl_seteq<1,2,2>(ap_const_lv2_3, respOutput_V_last_V_1_state.read())) || (esl_seteq<1,1,1>(ap_const_logic_0, respOutput_V_last_V_1_vld_in.read()) && esl_seteq<1,2,2>(ap_const_lv2_2, respOutput_V_last_V_1_state.read())))) { respOutput_V_last_V_1_state = ap_const_lv2_2; } else if (((esl_seteq<1,1,1>(ap_const_logic_1, respOutput_V_last_V_1_vld_in.read()) && esl_seteq<1,1,1>(ap_const_logic_0, respOutput_V_last_V_1_ack_out.read()) && esl_seteq<1,2,2>(ap_const_lv2_3, respOutput_V_last_V_1_state.read())) || (esl_seteq<1,1,1>(ap_const_logic_0, respOutput_V_last_V_1_ack_out.read()) && esl_seteq<1,2,2>(ap_const_lv2_1, respOutput_V_last_V_1_state.read())))) { respOutput_V_last_V_1_state = ap_const_lv2_1; } else if (((esl_seteq<1,1,1>(ap_const_logic_1, respOutput_V_last_V_1_vld_in.read()) && esl_seteq<1,2,2>(ap_const_lv2_2, respOutput_V_last_V_1_state.read())) || (esl_seteq<1,1,1>(ap_const_logic_1, respOutput_V_last_V_1_ack_out.read()) && esl_seteq<1,2,2>(ap_const_lv2_1, respOutput_V_last_V_1_state.read())) || (esl_seteq<1,2,2>(ap_const_lv2_3, respOutput_V_last_V_1_state.read()) && !(esl_seteq<1,1,1>(ap_const_logic_1, respOutput_V_last_V_1_vld_in.read()) && esl_seteq<1,1,1>(ap_const_logic_0, respOutput_V_last_V_1_ack_out.read())) && !(esl_seteq<1,1,1>(ap_const_logic_0, respOutput_V_last_V_1_vld_in.read()) && esl_seteq<1,1,1>(ap_const_logic_1, respOutput_V_last_V_1_ack_out.read()))))) { respOutput_V_last_V_1_state = ap_const_lv2_3; } else { respOutput_V_last_V_1_state = ap_const_lv2_2; } } if ( ap_rst.read() == ap_const_logic_1) { respOutput_V_user_V_1_payload_A = ap_const_lv112_0; } else { if (esl_seteq<1,1,1>(ap_const_logic_1, respOutput_V_user_V_1_load_A.read())) { respOutput_V_user_V_1_payload_A = respOutput_V_user_V_1_data_in.read(); } } if ( ap_rst.read() == ap_const_logic_1) { respOutput_V_user_V_1_payload_B = ap_const_lv112_0; } else { if (esl_seteq<1,1,1>(ap_const_logic_1, respOutput_V_user_V_1_load_B.read())) { respOutput_V_user_V_1_payload_B = respOutput_V_user_V_1_data_in.read(); } } if ( ap_rst.read() == ap_const_logic_1) { respOutput_V_user_V_1_sel_rd = ap_const_logic_0; } else { if ((esl_seteq<1,1,1>(ap_const_logic_1, respOutput_V_user_V_1_ack_out.read()) && esl_seteq<1,1,1>(ap_const_logic_1, respOutput_V_user_V_1_vld_out.read()))) { respOutput_V_user_V_1_sel_rd = (sc_logic) (~respOutput_V_user_V_1_sel_rd.read()); } } if ( ap_rst.read() == ap_const_logic_1) { respOutput_V_user_V_1_sel_wr = ap_const_logic_0; } else { if ((esl_seteq<1,1,1>(ap_const_logic_1, respOutput_V_user_V_1_vld_in.read()) && esl_seteq<1,1,1>(ap_const_logic_1, respOutput_V_user_V_1_ack_in.read()))) { respOutput_V_user_V_1_sel_wr = (sc_logic) (~respOutput_V_user_V_1_sel_wr.read()); } } if ( ap_rst.read() == ap_const_logic_1) { respOutput_V_user_V_1_state = ap_const_lv2_0; } else { if (((esl_seteq<1,1,1>(ap_const_logic_0, respOutput_V_user_V_1_vld_in.read()) && esl_seteq<1,1,1>(ap_const_logic_1, respOutput_V_user_V_1_ack_out.read()) && esl_seteq<1,2,2>(ap_const_lv2_3, respOutput_V_user_V_1_state.read())) || (esl_seteq<1,1,1>(ap_const_logic_0, respOutput_V_user_V_1_vld_in.read()) && esl_seteq<1,2,2>(ap_const_lv2_2, respOutput_V_user_V_1_state.read())))) { respOutput_V_user_V_1_state = ap_const_lv2_2; } else if (((esl_seteq<1,1,1>(ap_const_logic_1, respOutput_V_user_V_1_vld_in.read()) && esl_seteq<1,1,1>(ap_const_logic_0, respOutput_V_user_V_1_ack_out.read()) && esl_seteq<1,2,2>(ap_const_lv2_3, respOutput_V_user_V_1_state.read())) || (esl_seteq<1,1,1>(ap_const_logic_0, respOutput_V_user_V_1_ack_out.read()) && esl_seteq<1,2,2>(ap_const_lv2_1, respOutput_V_user_V_1_state.read())))) { respOutput_V_user_V_1_state = ap_const_lv2_1; } else if (((esl_seteq<1,1,1>(ap_const_logic_1, respOutput_V_user_V_1_vld_in.read()) && esl_seteq<1,2,2>(ap_const_lv2_2, respOutput_V_user_V_1_state.read())) || (esl_seteq<1,1,1>(ap_const_logic_1, respOutput_V_user_V_1_ack_out.read()) && esl_seteq<1,2,2>(ap_const_lv2_1, respOutput_V_user_V_1_state.read())) || (esl_seteq<1,2,2>(ap_const_lv2_3, respOutput_V_user_V_1_state.read()) && !(esl_seteq<1,1,1>(ap_const_logic_1, respOutput_V_user_V_1_vld_in.read()) && esl_seteq<1,1,1>(ap_const_logic_0, respOutput_V_user_V_1_ack_out.read())) && !(esl_seteq<1,1,1>(ap_const_logic_0, respOutput_V_user_V_1_vld_in.read()) && esl_seteq<1,1,1>(ap_const_logic_1, respOutput_V_user_V_1_ack_out.read()))))) { respOutput_V_user_V_1_state = ap_const_lv2_3; } else { respOutput_V_user_V_1_state = ap_const_lv2_2; } } if ( ap_rst.read() == ap_const_logic_1) { resp_ValueConvertTem = ap_const_lv32_0; } else { if (esl_seteq<1,1,1>(ap_condition_658.read(), ap_const_boolean_1)) { if ((esl_seteq<1,1,1>(tmp_i_82_fu_559_p2.read(), ap_const_lv1_1) && esl_seteq<1,1,1>(ap_const_lv1_0, or_cond2_i_fu_1902_p2.read()))) { resp_ValueConvertTem = tmp_19_i_fu_1932_p2.read(); } else if (esl_seteq<1,1,1>(ap_condition_2601.read(), ap_const_boolean_1)) { resp_ValueConvertTem = p_Val2_4_fu_1808_p2.read(); } } } if ( ap_rst.read() == ap_const_logic_1) { tmp_18_i_reg_3383 = ap_const_lv1_0; } else { if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter0_fsm_state1.read()) && esl_seteq<1,1,1>(tmp_i_fu_541_p2.read(), ap_const_lv1_0) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_i_82_fu_559_p2.read()) && !(esl_seteq<1,1,1>(ap_start.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_done_reg.read(), ap_const_logic_1) || (esl_seteq<1,1,1>(metadataBuffer_rf_V_s_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op142_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op134_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op56_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op37_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter2_fsm_state3.read()) && (esl_seteq<1,1,1>(respOutput_V_last_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_keep_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_user_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_data_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state3_io.read()))) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter1_fsm_state2.read()) && esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state2_io.read()))))) { tmp_18_i_reg_3383 = tmp_18_i_fu_570_p2.read(); } } if ( ap_rst.read() == ap_const_logic_1) { tmp_18_i_reg_3383_pp0_iter1_reg = ap_const_lv1_0; } else { if ((!(esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state2_io.read()) || esl_seteq<1,1,1>(ap_done_reg.read(), ap_const_logic_1) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter2_fsm_state3.read()) && (esl_seteq<1,1,1>(respOutput_V_last_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_keep_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_user_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_data_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state3_io.read())))) && esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter1_fsm_state2.read()))) { tmp_18_i_reg_3383_pp0_iter1_reg = tmp_18_i_reg_3383.read(); } } if ( ap_rst.read() == ap_const_logic_1) { tmp_24_i_reg_3387 = ap_const_lv1_0; } else { if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter0_fsm_state1.read()) && esl_seteq<1,1,1>(tmp_i_fu_541_p2.read(), ap_const_lv1_0) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_i_82_fu_559_p2.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_18_i_fu_570_p2.read()) && !(esl_seteq<1,1,1>(ap_start.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_done_reg.read(), ap_const_logic_1) || (esl_seteq<1,1,1>(metadataBuffer_rf_V_s_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op142_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op134_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op56_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op37_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter2_fsm_state3.read()) && (esl_seteq<1,1,1>(respOutput_V_last_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_keep_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_user_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_data_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state3_io.read()))) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter1_fsm_state2.read()) && esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state2_io.read()))))) { tmp_24_i_reg_3387 = tmp_24_i_fu_576_p2.read(); } } if ( ap_rst.read() == ap_const_logic_1) { tmp_24_i_reg_3387_pp0_iter1_reg = ap_const_lv1_0; } else { if ((!(esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state2_io.read()) || esl_seteq<1,1,1>(ap_done_reg.read(), ap_const_logic_1) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter2_fsm_state3.read()) && (esl_seteq<1,1,1>(respOutput_V_last_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_keep_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_user_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_data_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state3_io.read())))) && esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter1_fsm_state2.read()))) { tmp_24_i_reg_3387_pp0_iter1_reg = tmp_24_i_reg_3387.read(); } } if ( ap_rst.read() == ap_const_logic_1) { tmp_29_i_reg_3391 = ap_const_lv1_0; } else { if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter0_fsm_state1.read()) && esl_seteq<1,1,1>(tmp_i_fu_541_p2.read(), ap_const_lv1_0) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_i_82_fu_559_p2.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_18_i_fu_570_p2.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_24_i_fu_576_p2.read()) && !(esl_seteq<1,1,1>(ap_start.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_done_reg.read(), ap_const_logic_1) || (esl_seteq<1,1,1>(metadataBuffer_rf_V_s_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op142_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op134_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op56_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op37_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter2_fsm_state3.read()) && (esl_seteq<1,1,1>(respOutput_V_last_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_keep_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_user_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_data_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state3_io.read()))) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter1_fsm_state2.read()) && esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state2_io.read()))))) { tmp_29_i_reg_3391 = tmp_29_i_fu_582_p2.read(); } } if ( ap_rst.read() == ap_const_logic_1) { tmp_29_i_reg_3391_pp0_iter1_reg = ap_const_lv1_0; } else { if ((!(esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state2_io.read()) || esl_seteq<1,1,1>(ap_done_reg.read(), ap_const_logic_1) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter2_fsm_state3.read()) && (esl_seteq<1,1,1>(respOutput_V_last_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_keep_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_user_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_data_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state3_io.read())))) && esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter1_fsm_state2.read()))) { tmp_29_i_reg_3391_pp0_iter1_reg = tmp_29_i_reg_3391.read(); } } if ( ap_rst.read() == ap_const_logic_1) { tmp_31_i_reg_3395 = ap_const_lv1_0; } else { if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter0_fsm_state1.read()) && esl_seteq<1,1,1>(tmp_i_fu_541_p2.read(), ap_const_lv1_0) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_i_82_fu_559_p2.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_18_i_fu_570_p2.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_24_i_fu_576_p2.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_29_i_fu_582_p2.read()) && !(esl_seteq<1,1,1>(ap_start.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_done_reg.read(), ap_const_logic_1) || (esl_seteq<1,1,1>(metadataBuffer_rf_V_s_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op142_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op134_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op56_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op37_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter2_fsm_state3.read()) && (esl_seteq<1,1,1>(respOutput_V_last_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_keep_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_user_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_data_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state3_io.read()))) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter1_fsm_state2.read()) && esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state2_io.read()))))) { tmp_31_i_reg_3395 = tmp_31_i_fu_588_p2.read(); } } if ( ap_rst.read() == ap_const_logic_1) { tmp_31_i_reg_3395_pp0_iter1_reg = ap_const_lv1_0; } else { if ((!(esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state2_io.read()) || esl_seteq<1,1,1>(ap_done_reg.read(), ap_const_logic_1) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter2_fsm_state3.read()) && (esl_seteq<1,1,1>(respOutput_V_last_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_keep_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_user_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_data_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state3_io.read())))) && esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter1_fsm_state2.read()))) { tmp_31_i_reg_3395_pp0_iter1_reg = tmp_31_i_reg_3395.read(); } } if ( ap_rst.read() == ap_const_logic_1) { tmp_34_i_reg_3407 = ap_const_lv1_0; } else { if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter0_fsm_state1.read()) && esl_seteq<1,1,1>(tmp_i_fu_541_p2.read(), ap_const_lv1_0) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_i_82_fu_559_p2.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_18_i_fu_570_p2.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_24_i_fu_576_p2.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_29_i_fu_582_p2.read()) && esl_seteq<1,1,1>(tmp_31_i_fu_588_p2.read(), ap_const_lv1_1) && !(esl_seteq<1,1,1>(ap_start.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_done_reg.read(), ap_const_logic_1) || (esl_seteq<1,1,1>(metadataBuffer_rf_V_s_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op142_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op134_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op56_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op37_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter2_fsm_state3.read()) && (esl_seteq<1,1,1>(respOutput_V_last_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_keep_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_user_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_data_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state3_io.read()))) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter1_fsm_state2.read()) && esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state2_io.read()))))) { tmp_34_i_reg_3407 = tmp_34_i_fu_606_p2.read(); } } if ( ap_rst.read() == ap_const_logic_1) { tmp_34_i_reg_3407_pp0_iter1_reg = ap_const_lv1_0; } else { if ((!(esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state2_io.read()) || esl_seteq<1,1,1>(ap_done_reg.read(), ap_const_logic_1) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter2_fsm_state3.read()) && (esl_seteq<1,1,1>(respOutput_V_last_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_keep_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_user_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_data_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state3_io.read())))) && esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter1_fsm_state2.read()))) { tmp_34_i_reg_3407_pp0_iter1_reg = tmp_34_i_reg_3407.read(); } } if ( ap_rst.read() == ap_const_logic_1) { tmp_35_i_reg_3399 = ap_const_lv1_0; } else { if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter0_fsm_state1.read()) && esl_seteq<1,1,1>(tmp_i_fu_541_p2.read(), ap_const_lv1_0) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_i_82_fu_559_p2.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_18_i_fu_570_p2.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_24_i_fu_576_p2.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_29_i_fu_582_p2.read()) && !(esl_seteq<1,1,1>(ap_start.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_done_reg.read(), ap_const_logic_1) || (esl_seteq<1,1,1>(metadataBuffer_rf_V_s_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op142_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op134_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op56_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op37_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter2_fsm_state3.read()) && (esl_seteq<1,1,1>(respOutput_V_last_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_keep_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_user_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_data_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state3_io.read()))) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter1_fsm_state2.read()) && esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state2_io.read()))) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_31_i_fu_588_p2.read()))) { tmp_35_i_reg_3399 = tmp_35_i_fu_594_p2.read(); } } if ( ap_rst.read() == ap_const_logic_1) { tmp_35_i_reg_3399_pp0_iter1_reg = ap_const_lv1_0; } else { if ((!(esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state2_io.read()) || esl_seteq<1,1,1>(ap_done_reg.read(), ap_const_logic_1) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter2_fsm_state3.read()) && (esl_seteq<1,1,1>(respOutput_V_last_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_keep_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_user_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_data_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state3_io.read())))) && esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter1_fsm_state2.read()))) { tmp_35_i_reg_3399_pp0_iter1_reg = tmp_35_i_reg_3399.read(); } } if ( ap_rst.read() == ap_const_logic_1) { tmp_39_i_reg_3415 = ap_const_lv1_0; } else { if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter0_fsm_state1.read()) && !(esl_seteq<1,1,1>(ap_start.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_done_reg.read(), ap_const_logic_1) || (esl_seteq<1,1,1>(metadataBuffer_rf_V_s_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op142_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op134_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op56_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op37_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter2_fsm_state3.read()) && (esl_seteq<1,1,1>(respOutput_V_last_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_keep_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_user_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_data_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state3_io.read()))) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter1_fsm_state2.read()) && esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state2_io.read()))) && ((esl_seteq<1,1,1>(tmp_i_fu_541_p2.read(), ap_const_lv1_0) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_i_82_fu_559_p2.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_18_i_fu_570_p2.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_24_i_fu_576_p2.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_29_i_fu_582_p2.read()) && esl_seteq<1,1,1>(tmp_31_i_fu_588_p2.read(), ap_const_lv1_1) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_34_i_fu_606_p2.read())) || (esl_seteq<1,1,1>(tmp_i_fu_541_p2.read(), ap_const_lv1_0) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_i_82_fu_559_p2.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_18_i_fu_570_p2.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_24_i_fu_576_p2.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_29_i_fu_582_p2.read()) && esl_seteq<1,1,1>(tmp_31_i_fu_588_p2.read(), ap_const_lv1_1) && esl_seteq<1,1,1>(ap_const_lv1_0, grp_nbreadreq_fu_256_p3.read()))))) { tmp_39_i_reg_3415 = grp_fu_492_p2.read(); } } if ( ap_rst.read() == ap_const_logic_1) { tmp_39_i_reg_3415_pp0_iter1_reg = ap_const_lv1_0; } else { if ((!(esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state2_io.read()) || esl_seteq<1,1,1>(ap_done_reg.read(), ap_const_logic_1) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter2_fsm_state3.read()) && (esl_seteq<1,1,1>(respOutput_V_last_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_keep_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_user_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_data_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state3_io.read())))) && esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter1_fsm_state2.read()))) { tmp_39_i_reg_3415_pp0_iter1_reg = tmp_39_i_reg_3415.read(); } } if ( ap_rst.read() == ap_const_logic_1) { tmp_41_i_reg_3403 = ap_const_lv1_0; } else { if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter0_fsm_state1.read()) && esl_seteq<1,1,1>(tmp_i_fu_541_p2.read(), ap_const_lv1_0) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_i_82_fu_559_p2.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_18_i_fu_570_p2.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_24_i_fu_576_p2.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_29_i_fu_582_p2.read()) && !(esl_seteq<1,1,1>(ap_start.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_done_reg.read(), ap_const_logic_1) || (esl_seteq<1,1,1>(metadataBuffer_rf_V_s_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op142_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op134_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op56_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op37_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter2_fsm_state3.read()) && (esl_seteq<1,1,1>(respOutput_V_last_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_keep_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_user_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_data_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state3_io.read()))) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter1_fsm_state2.read()) && esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state2_io.read()))) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_31_i_fu_588_p2.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_35_i_fu_594_p2.read()))) { tmp_41_i_reg_3403 = tmp_41_i_fu_600_p2.read(); } } if ( ap_rst.read() == ap_const_logic_1) { tmp_41_i_reg_3403_pp0_iter1_reg = ap_const_lv1_0; } else { if ((!(esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state2_io.read()) || esl_seteq<1,1,1>(ap_done_reg.read(), ap_const_logic_1) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter2_fsm_state3.read()) && (esl_seteq<1,1,1>(respOutput_V_last_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_keep_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_user_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_data_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state3_io.read())))) && esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter1_fsm_state2.read()))) { tmp_41_i_reg_3403_pp0_iter1_reg = tmp_41_i_reg_3403.read(); } } if ( ap_rst.read() == ap_const_logic_1) { tmp_5_reg_3437 = ap_const_lv1_0; } else { if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter0_fsm_state1.read()) && esl_seteq<1,1,1>(tmp_i_fu_541_p2.read(), ap_const_lv1_0) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_i_82_fu_559_p2.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_18_i_fu_570_p2.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_24_i_fu_576_p2.read()) && esl_seteq<1,1,1>(tmp_29_i_fu_582_p2.read(), ap_const_lv1_1) && !(esl_seteq<1,1,1>(ap_start.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_done_reg.read(), ap_const_logic_1) || (esl_seteq<1,1,1>(metadataBuffer_rf_V_s_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op142_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op134_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op56_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op37_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter2_fsm_state3.read()) && (esl_seteq<1,1,1>(respOutput_V_last_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_keep_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_user_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_data_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state3_io.read()))) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter1_fsm_state2.read()) && esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state2_io.read()))))) { tmp_5_reg_3437 = (sc_lv<1>) (valueBuffer_rf_V_V_empty_n.read()); } } if ( ap_rst.read() == ap_const_logic_1) { tmp_5_reg_3437_pp0_iter1_reg = ap_const_lv1_0; } else { if ((!(esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state2_io.read()) || esl_seteq<1,1,1>(ap_done_reg.read(), ap_const_logic_1) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter2_fsm_state3.read()) && (esl_seteq<1,1,1>(respOutput_V_last_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_keep_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_user_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_data_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state3_io.read())))) && esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter1_fsm_state2.read()))) { tmp_5_reg_3437_pp0_iter1_reg = tmp_5_reg_3437.read(); } } if ( ap_rst.read() == ap_const_logic_1) { tmp_66_reg_3441 = ap_const_lv32_0; } else { if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter0_fsm_state1.read()) && esl_seteq<1,1,1>(ap_predicate_op56_read_state1.read(), ap_const_boolean_1) && !(esl_seteq<1,1,1>(ap_start.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_done_reg.read(), ap_const_logic_1) || (esl_seteq<1,1,1>(metadataBuffer_rf_V_s_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op142_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op134_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op56_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op37_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter2_fsm_state3.read()) && (esl_seteq<1,1,1>(respOutput_V_last_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_keep_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_user_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_data_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state3_io.read()))) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter1_fsm_state2.read()) && esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state2_io.read()))))) { tmp_66_reg_3441 = tmp_66_fu_1182_p1.read(); } } if ( ap_rst.read() == ap_const_logic_1) { tmp_69_reg_3419 = ap_const_lv32_0; } else { if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter0_fsm_state1.read()) && esl_seteq<1,1,1>(ap_predicate_op37_read_state1.read(), ap_const_boolean_1) && !(esl_seteq<1,1,1>(ap_start.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_done_reg.read(), ap_const_logic_1) || (esl_seteq<1,1,1>(metadataBuffer_rf_V_s_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op142_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op134_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op56_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op37_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter2_fsm_state3.read()) && (esl_seteq<1,1,1>(respOutput_V_last_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_keep_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_user_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_data_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state3_io.read()))) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter1_fsm_state2.read()) && esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state2_io.read()))))) { tmp_69_reg_3419 = tmp_69_fu_612_p1.read(); } } if ( ap_rst.read() == ap_const_logic_1) { tmp_6_reg_3411 = ap_const_lv1_0; } else { if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter0_fsm_state1.read()) && esl_seteq<1,1,1>(tmp_i_fu_541_p2.read(), ap_const_lv1_0) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_i_82_fu_559_p2.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_18_i_fu_570_p2.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_24_i_fu_576_p2.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_29_i_fu_582_p2.read()) && esl_seteq<1,1,1>(tmp_31_i_fu_588_p2.read(), ap_const_lv1_1) && esl_seteq<1,1,1>(ap_const_lv1_1, tmp_34_i_fu_606_p2.read()) && !(esl_seteq<1,1,1>(ap_start.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_done_reg.read(), ap_const_logic_1) || (esl_seteq<1,1,1>(metadataBuffer_rf_V_s_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op142_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op134_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op56_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op37_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter2_fsm_state3.read()) && (esl_seteq<1,1,1>(respOutput_V_last_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_keep_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_user_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_data_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state3_io.read()))) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter1_fsm_state2.read()) && esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state2_io.read()))))) { tmp_6_reg_3411 = (sc_lv<1>) (valueBuffer_rf_V_V_empty_n.read()); } } if ( ap_rst.read() == ap_const_logic_1) { tmp_6_reg_3411_pp0_iter1_reg = ap_const_lv1_0; } else { if ((!(esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state2_io.read()) || esl_seteq<1,1,1>(ap_done_reg.read(), ap_const_logic_1) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter2_fsm_state3.read()) && (esl_seteq<1,1,1>(respOutput_V_last_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_keep_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_user_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_data_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state3_io.read())))) && esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter1_fsm_state2.read()))) { tmp_6_reg_3411_pp0_iter1_reg = tmp_6_reg_3411.read(); } } if ( ap_rst.read() == ap_const_logic_1) { tmp_8_reg_3494 = ap_const_lv1_0; } else { if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter0_fsm_state1.read()) && esl_seteq<1,1,1>(tmp_i_fu_541_p2.read(), ap_const_lv1_0) && esl_seteq<1,1,1>(tmp_i_82_fu_559_p2.read(), ap_const_lv1_1) && esl_seteq<1,1,1>(ap_const_lv1_0, or_cond2_i_fu_1902_p2.read()) && !(esl_seteq<1,1,1>(ap_start.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_done_reg.read(), ap_const_logic_1) || (esl_seteq<1,1,1>(metadataBuffer_rf_V_s_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op142_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op134_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op56_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op37_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter2_fsm_state3.read()) && (esl_seteq<1,1,1>(respOutput_V_last_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_keep_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_user_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_data_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state3_io.read()))) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter1_fsm_state2.read()) && esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state2_io.read()))))) { tmp_8_reg_3494 = tmp_8_fu_1982_p2.read(); } } if ( ap_rst.read() == ap_const_logic_1) { tmp_i_82_reg_3372 = ap_const_lv1_0; } else { if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter0_fsm_state1.read()) && esl_seteq<1,1,1>(tmp_i_fu_541_p2.read(), ap_const_lv1_0) && !(esl_seteq<1,1,1>(ap_start.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_done_reg.read(), ap_const_logic_1) || (esl_seteq<1,1,1>(metadataBuffer_rf_V_s_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op142_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op134_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op56_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op37_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter2_fsm_state3.read()) && (esl_seteq<1,1,1>(respOutput_V_last_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_keep_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_user_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_data_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state3_io.read()))) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter1_fsm_state2.read()) && esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state2_io.read()))))) { tmp_i_82_reg_3372 = tmp_i_82_fu_559_p2.read(); } } if ( ap_rst.read() == ap_const_logic_1) { tmp_i_82_reg_3372_pp0_iter1_reg = ap_const_lv1_0; } else { if ((!(esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state2_io.read()) || esl_seteq<1,1,1>(ap_done_reg.read(), ap_const_logic_1) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter2_fsm_state3.read()) && (esl_seteq<1,1,1>(respOutput_V_last_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_keep_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_user_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_data_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state3_io.read())))) && esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter1_fsm_state2.read()))) { tmp_i_82_reg_3372_pp0_iter1_reg = tmp_i_82_reg_3372.read(); } } if ( ap_rst.read() == ap_const_logic_1) { tmp_i_reg_3368 = ap_const_lv1_0; } else { if ((!(esl_seteq<1,1,1>(ap_start.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_done_reg.read(), ap_const_logic_1) || (esl_seteq<1,1,1>(metadataBuffer_rf_V_s_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op142_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op134_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op56_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op37_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter2_fsm_state3.read()) && (esl_seteq<1,1,1>(respOutput_V_last_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_keep_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_user_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_data_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state3_io.read()))) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter1_fsm_state2.read()) && esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state2_io.read()))) && esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter0_fsm_state1.read()))) { tmp_i_reg_3368 = tmp_i_fu_541_p2.read(); } } if ( ap_rst.read() == ap_const_logic_1) { tmp_i_reg_3368_pp0_iter1_reg = ap_const_lv1_0; } else { if ((!(esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state2_io.read()) || esl_seteq<1,1,1>(ap_done_reg.read(), ap_const_logic_1) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter2_fsm_state3.read()) && (esl_seteq<1,1,1>(respOutput_V_last_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_keep_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_user_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_data_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state3_io.read())))) && esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter1_fsm_state2.read()))) { tmp_i_reg_3368_pp0_iter1_reg = tmp_i_reg_3368.read(); } } if ( ap_rst.read() == ap_const_logic_1) { valueLength = ap_const_lv16_0; } else { if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter0_fsm_state1.read()) && esl_seteq<1,1,1>(tmp_i_fu_541_p2.read(), ap_const_lv1_0) && esl_seteq<1,1,1>(tmp_i_82_fu_559_p2.read(), ap_const_lv1_1) && esl_seteq<1,1,1>(ap_const_lv1_0, or_cond2_i_fu_1902_p2.read()) && !(esl_seteq<1,1,1>(ap_start.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_done_reg.read(), ap_const_logic_1) || (esl_seteq<1,1,1>(metadataBuffer_rf_V_s_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op142_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op134_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op56_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op37_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter2_fsm_state3.read()) && (esl_seteq<1,1,1>(respOutput_V_last_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_keep_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_user_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_data_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state3_io.read()))) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter1_fsm_state2.read()) && esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state2_io.read()))))) { valueLength = tmp_20_i_fu_1944_p2.read(); } else if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter0_fsm_state1.read()) && esl_seteq<1,1,1>(tmp_i_fu_541_p2.read(), ap_const_lv1_0) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_i_82_fu_559_p2.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_18_i_fu_570_p2.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_24_i_fu_576_p2.read()) && esl_seteq<1,1,1>(ap_const_lv1_1, grp_nbreadreq_fu_256_p3.read()) && esl_seteq<1,1,1>(tmp_29_i_fu_582_p2.read(), ap_const_lv1_1) && !(esl_seteq<1,1,1>(ap_start.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_done_reg.read(), ap_const_logic_1) || (esl_seteq<1,1,1>(metadataBuffer_rf_V_s_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op142_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op134_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op56_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op37_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter2_fsm_state3.read()) && (esl_seteq<1,1,1>(respOutput_V_last_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_keep_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_user_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_data_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state3_io.read()))) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter1_fsm_state2.read()) && esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state2_io.read()))) && esl_seteq<1,1,1>(ap_const_lv1_0, grp_fu_492_p2.read()))) { valueLength = tmp_38_i_fu_1192_p2.read(); } else if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter0_fsm_state1.read()) && esl_seteq<1,1,1>(ap_predicate_op37_read_state1.read(), ap_const_boolean_1) && !(esl_seteq<1,1,1>(ap_start.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_done_reg.read(), ap_const_logic_1) || (esl_seteq<1,1,1>(metadataBuffer_rf_V_s_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op142_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op134_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op56_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op37_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter2_fsm_state3.read()) && (esl_seteq<1,1,1>(respOutput_V_last_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_keep_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_user_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_data_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state3_io.read()))) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter1_fsm_state2.read()) && esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state2_io.read()))))) { valueLength = tmp_45_i_fu_1150_p3.read(); } else if (((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter0_fsm_state1.read()) && esl_seteq<1,1,1>(tmp_i_fu_541_p2.read(), ap_const_lv1_0) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_i_82_fu_559_p2.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_18_i_fu_570_p2.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_24_i_fu_576_p2.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_29_i_fu_582_p2.read()) && !(esl_seteq<1,1,1>(ap_start.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_done_reg.read(), ap_const_logic_1) || (esl_seteq<1,1,1>(metadataBuffer_rf_V_s_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op142_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op134_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op56_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op37_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter2_fsm_state3.read()) && (esl_seteq<1,1,1>(respOutput_V_last_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_keep_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_user_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_data_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state3_io.read()))) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter1_fsm_state2.read()) && esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state2_io.read()))) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_31_i_fu_588_p2.read()) && esl_seteq<1,1,1>(ap_const_lv1_1, tmp_35_i_fu_594_p2.read())) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter0_fsm_state1.read()) && !(esl_seteq<1,1,1>(ap_start.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_done_reg.read(), ap_const_logic_1) || (esl_seteq<1,1,1>(metadataBuffer_rf_V_s_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op142_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op134_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op56_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op37_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter2_fsm_state3.read()) && (esl_seteq<1,1,1>(respOutput_V_last_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_keep_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_user_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_data_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state3_io.read()))) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter1_fsm_state2.read()) && esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state2_io.read()))) && ((esl_seteq<1,1,1>(tmp_i_fu_541_p2.read(), ap_const_lv1_0) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_i_82_fu_559_p2.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_18_i_fu_570_p2.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_24_i_fu_576_p2.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_29_i_fu_582_p2.read()) && esl_seteq<1,1,1>(tmp_31_i_fu_588_p2.read(), ap_const_lv1_1) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_34_i_fu_606_p2.read()) && esl_seteq<1,1,1>(ap_const_lv1_1, grp_fu_492_p2.read())) || (esl_seteq<1,1,1>(tmp_i_fu_541_p2.read(), ap_const_lv1_0) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_i_82_fu_559_p2.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_18_i_fu_570_p2.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_24_i_fu_576_p2.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_29_i_fu_582_p2.read()) && esl_seteq<1,1,1>(tmp_31_i_fu_588_p2.read(), ap_const_lv1_1) && esl_seteq<1,1,1>(ap_const_lv1_0, grp_nbreadreq_fu_256_p3.read()) && esl_seteq<1,1,1>(ap_const_lv1_1, grp_fu_492_p2.read())))))) { valueLength = ap_const_lv16_0; } } if ( ap_rst.read() == ap_const_logic_1) { valueLength_load_reg_3376 = ap_const_lv16_0; } else { if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter0_fsm_state1.read()) && esl_seteq<1,1,1>(tmp_i_fu_541_p2.read(), ap_const_lv1_0) && !(esl_seteq<1,1,1>(ap_start.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_done_reg.read(), ap_const_logic_1) || (esl_seteq<1,1,1>(metadataBuffer_rf_V_s_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op142_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op134_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op56_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op37_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter2_fsm_state3.read()) && (esl_seteq<1,1,1>(respOutput_V_last_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_keep_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_user_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_data_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state3_io.read()))) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter1_fsm_state2.read()) && esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state2_io.read()))))) { valueLength_load_reg_3376 = valueLength.read(); } } if ( ap_rst.read() == ap_const_logic_1) { xtrasBuffer_V = ap_const_lv64_0; } else { if ((esl_seteq<1,1,1>(ap_const_lv1_0, tmp_i_reg_3368.read()) && esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter1_fsm_state2.read()) && !(esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state2_io.read()) || esl_seteq<1,1,1>(ap_done_reg.read(), ap_const_logic_1) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter2_fsm_state3.read()) && (esl_seteq<1,1,1>(respOutput_V_last_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_keep_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_user_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_data_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state3_io.read())))) && esl_seteq<1,1,1>(ap_const_lv1_1, ap_phi_mux_xtrasBuffer_V_flag_8_phi_fu_419_p18.read()))) { xtrasBuffer_V = ap_phi_mux_xtrasBuffer_V_new_8_s_phi_fu_453_p18.read(); } } } void response_r::thread_Hi_assign_2_fu_2623_p2() { Hi_assign_2_fu_2623_p2 = (!ap_const_lv6_1F.is_01() || !tmp_48_i_fu_2609_p3.read().is_01())? sc_lv<6>(): (sc_biguint<6>(ap_const_lv6_1F) + sc_biguint<6>(tmp_48_i_fu_2609_p3.read())); } void response_r::thread_Hi_assign_fu_2617_p2() { Hi_assign_fu_2617_p2 = (!ap_const_lv6_3F.is_01() || !tmp_48_i_fu_2609_p3.read().is_01())? sc_lv<6>(): (sc_bigint<6>(ap_const_lv6_3F) + sc_biguint<6>(tmp_48_i_fu_2609_p3.read())); } void response_r::thread_ap_CS_iter0_fsm_state1() { ap_CS_iter0_fsm_state1 = ap_CS_iter0_fsm.read()[0]; } void response_r::thread_ap_CS_iter1_fsm_state0() { ap_CS_iter1_fsm_state0 = ap_CS_iter1_fsm.read()[0]; } void response_r::thread_ap_CS_iter1_fsm_state2() { ap_CS_iter1_fsm_state2 = ap_CS_iter1_fsm.read()[1]; } void response_r::thread_ap_CS_iter2_fsm_state0() { ap_CS_iter2_fsm_state0 = ap_CS_iter2_fsm.read()[0]; } void response_r::thread_ap_CS_iter2_fsm_state3() { ap_CS_iter2_fsm_state3 = ap_CS_iter2_fsm.read()[1]; } void response_r::thread_ap_block_state1_pp0_stage0_iter0() { ap_block_state1_pp0_stage0_iter0 = (esl_seteq<1,1,1>(ap_start.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_done_reg.read(), ap_const_logic_1) || (esl_seteq<1,1,1>(metadataBuffer_rf_V_s_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op142_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op134_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op56_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op37_read_state1.read(), ap_const_boolean_1))); } void response_r::thread_ap_block_state2_io() { ap_block_state2_io = ((esl_seteq<1,1,1>(respOutput_V_data_V_1_ack_in.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_const_boolean_1, ap_predicate_op150_write_state2.read())) || (esl_seteq<1,1,1>(respOutput_V_data_V_1_ack_in.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_const_boolean_1, ap_predicate_op155_write_state2.read())) || (esl_seteq<1,1,1>(respOutput_V_data_V_1_ack_in.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_const_boolean_1, ap_predicate_op185_write_state2.read())) || (esl_seteq<1,1,1>(respOutput_V_data_V_1_ack_in.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_const_boolean_1, ap_predicate_op190_write_state2.read())) || (esl_seteq<1,1,1>(respOutput_V_data_V_1_ack_in.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_const_boolean_1, ap_predicate_op195_write_state2.read())) || (esl_seteq<1,1,1>(respOutput_V_data_V_1_ack_in.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_const_boolean_1, ap_predicate_op197_write_state2.read())) || (esl_seteq<1,1,1>(respOutput_V_data_V_1_ack_in.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_const_boolean_1, ap_predicate_op200_write_state2.read())) || (esl_seteq<1,1,1>(respOutput_V_data_V_1_ack_in.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_const_boolean_1, ap_predicate_op208_write_state2.read()))); } void response_r::thread_ap_block_state2_pp0_stage0_iter1() { ap_block_state2_pp0_stage0_iter1 = !esl_seteq<1,1,1>(ap_const_boolean_1, ap_const_boolean_1); } void response_r::thread_ap_block_state3_io() { ap_block_state3_io = ((esl_seteq<1,1,1>(respOutput_V_data_V_1_ack_in.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_const_boolean_1, ap_predicate_op218_write_state3.read())) || (esl_seteq<1,1,1>(respOutput_V_data_V_1_ack_in.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_const_boolean_1, ap_predicate_op221_write_state3.read())) || (esl_seteq<1,1,1>(respOutput_V_data_V_1_ack_in.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_const_boolean_1, ap_predicate_op223_write_state3.read())) || (esl_seteq<1,1,1>(respOutput_V_data_V_1_ack_in.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_const_boolean_1, ap_predicate_op226_write_state3.read())) || (esl_seteq<1,1,1>(respOutput_V_data_V_1_ack_in.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_const_boolean_1, ap_predicate_op227_write_state3.read())) || (esl_seteq<1,1,1>(respOutput_V_data_V_1_ack_in.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_const_boolean_1, ap_predicate_op229_write_state3.read())) || (esl_seteq<1,1,1>(respOutput_V_data_V_1_ack_in.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_const_boolean_1, ap_predicate_op230_write_state3.read())) || (esl_seteq<1,1,1>(respOutput_V_data_V_1_ack_in.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_const_boolean_1, ap_predicate_op231_write_state3.read()))); } void response_r::thread_ap_block_state3_pp0_stage0_iter2() { ap_block_state3_pp0_stage0_iter2 = (esl_seteq<1,1,1>(respOutput_V_data_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_user_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_keep_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_last_V_1_ack_in.read(), ap_const_logic_0)); } void response_r::thread_ap_condition_2601() { ap_condition_2601 = (esl_seteq<1,1,1>(ap_const_lv1_0, tmp_i_82_fu_559_p2.read()) && esl_seteq<1,1,1>(tmp_18_i_fu_570_p2.read(), ap_const_lv1_1) && esl_seteq<1,1,1>(ap_const_lv1_1, tmp_23_i_fu_1778_p2.read())); } void response_r::thread_ap_condition_334() { ap_condition_334 = (!(esl_seteq<1,1,1>(ap_start.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_done_reg.read(), ap_const_logic_1) || (esl_seteq<1,1,1>(metadataBuffer_rf_V_s_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op142_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op134_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op56_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op37_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter2_fsm_state3.read()) && (esl_seteq<1,1,1>(respOutput_V_last_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_keep_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_user_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_data_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state3_io.read()))) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter1_fsm_state2.read()) && esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state2_io.read()))) && esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter0_fsm_state1.read())); } void response_r::thread_ap_condition_658() { ap_condition_658 = (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter0_fsm_state1.read()) && esl_seteq<1,1,1>(tmp_i_fu_541_p2.read(), ap_const_lv1_0) && !(esl_seteq<1,1,1>(ap_start.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_done_reg.read(), ap_const_logic_1) || (esl_seteq<1,1,1>(metadataBuffer_rf_V_s_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op142_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op134_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op56_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op37_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter2_fsm_state3.read()) && (esl_seteq<1,1,1>(respOutput_V_last_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_keep_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_user_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_data_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state3_io.read()))) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter1_fsm_state2.read()) && esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state2_io.read())))); } void response_r::thread_ap_condition_708() { ap_condition_708 = (esl_seteq<1,1,1>(tmp_i_fu_541_p2.read(), ap_const_lv1_0) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_i_82_fu_559_p2.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_18_i_fu_570_p2.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_24_i_fu_576_p2.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_29_i_fu_582_p2.read()) && esl_seteq<1,1,1>(tmp_31_i_fu_588_p2.read(), ap_const_lv1_1) && esl_seteq<1,1,1>(ap_const_lv1_1, tmp_34_i_fu_606_p2.read()) && esl_seteq<1,1,1>(ap_const_lv1_1, grp_nbreadreq_fu_256_p3.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_46_i_fu_1164_p2.read())); } void response_r::thread_ap_condition_722() { ap_condition_722 = (esl_seteq<1,1,1>(tmp_i_fu_541_p2.read(), ap_const_lv1_0) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_i_82_fu_559_p2.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_18_i_fu_570_p2.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_24_i_fu_576_p2.read()) && esl_seteq<1,1,1>(ap_const_lv1_1, grp_nbreadreq_fu_256_p3.read()) && esl_seteq<1,1,1>(tmp_29_i_fu_582_p2.read(), ap_const_lv1_1) && esl_seteq<1,1,1>(ap_const_lv1_1, grp_fu_492_p2.read())); } void response_r::thread_ap_condition_754() { ap_condition_754 = (esl_seteq<1,1,1>(tmp_i_fu_541_p2.read(), ap_const_lv1_0) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_i_82_fu_559_p2.read()) && esl_seteq<1,1,1>(tmp_18_i_fu_570_p2.read(), ap_const_lv1_1) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_23_i_fu_1778_p2.read())); } void response_r::thread_ap_condition_759() { ap_condition_759 = (esl_seteq<1,1,1>(tmp_i_fu_541_p2.read(), ap_const_lv1_0) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_i_82_fu_559_p2.read()) && esl_seteq<1,1,1>(tmp_18_i_fu_570_p2.read(), ap_const_lv1_1) && esl_seteq<1,1,1>(ap_const_lv1_1, tmp_23_i_fu_1778_p2.read())); } void response_r::thread_ap_condition_785() { ap_condition_785 = (esl_seteq<1,1,1>(tmp_i_fu_541_p2.read(), ap_const_lv1_0) && esl_seteq<1,1,1>(tmp_i_82_fu_559_p2.read(), ap_const_lv1_1) && esl_seteq<1,1,1>(ap_const_lv1_0, or_cond2_i_fu_1902_p2.read()) && esl_seteq<1,1,1>(ap_const_lv1_1, or_cond5_i_fu_2004_p2.read())); } void response_r::thread_ap_condition_839() { ap_condition_839 = (esl_seteq<1,1,1>(tmp_i_fu_541_p2.read(), ap_const_lv1_0) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_i_82_fu_559_p2.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_18_i_fu_570_p2.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_24_i_fu_576_p2.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_29_i_fu_582_p2.read()) && esl_seteq<1,1,1>(tmp_31_i_fu_588_p2.read(), ap_const_lv1_1) && esl_seteq<1,1,1>(ap_const_lv1_1, tmp_34_i_fu_606_p2.read()) && esl_seteq<1,1,1>(ap_const_lv1_1, grp_nbreadreq_fu_256_p3.read()) && esl_seteq<1,1,1>(ap_const_lv1_1, tmp_46_i_fu_1164_p2.read())); } void response_r::thread_ap_condition_849() { ap_condition_849 = (esl_seteq<1,1,1>(tmp_i_fu_541_p2.read(), ap_const_lv1_0) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_i_82_fu_559_p2.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_18_i_fu_570_p2.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_24_i_fu_576_p2.read()) && esl_seteq<1,1,1>(ap_const_lv1_1, grp_nbreadreq_fu_256_p3.read()) && esl_seteq<1,1,1>(tmp_29_i_fu_582_p2.read(), ap_const_lv1_1) && esl_seteq<1,1,1>(ap_const_lv1_0, grp_fu_492_p2.read())); } void response_r::thread_ap_condition_88() { ap_condition_88 = (esl_seteq<1,1,1>(tmp_i_fu_541_p2.read(), ap_const_lv1_0) && esl_seteq<1,1,1>(tmp_i_82_fu_559_p2.read(), ap_const_lv1_1) && esl_seteq<1,1,1>(ap_const_lv1_0, or_cond2_i_fu_1902_p2.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, or_cond5_i_fu_2004_p2.read())); } void response_r::thread_ap_condition_962() { ap_condition_962 = (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter1_fsm_state2.read()) && !(esl_seteq<1,1,1>(ap_done_reg.read(), ap_const_logic_1) || ((esl_seteq<1,1,1>(respOutput_V_data_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_user_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_keep_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_last_V_1_ack_in.read(), ap_const_logic_0)) && esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter2_fsm_state3.read())))); } void response_r::thread_ap_done() { if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter2_fsm_state3.read()) && !(esl_seteq<1,1,1>(respOutput_V_last_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_keep_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_user_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_data_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state3_io.read()) || esl_seteq<1,1,1>(ap_done_reg.read(), ap_const_logic_1)))) { ap_done = ap_const_logic_1; } else { ap_done = ap_done_reg.read(); } } void response_r::thread_ap_idle() { if ((esl_seteq<1,1,1>(ap_start.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter0_fsm_state1.read()) && esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter1_fsm_state0.read()) && esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter2_fsm_state0.read()))) { ap_idle = ap_const_logic_1; } else { ap_idle = ap_const_logic_0; } } void response_r::thread_ap_phi_mux_xtrasBuffer_V_flag_8_phi_fu_419_p18() { if ((esl_seteq<1,1,1>(ap_const_lv1_0, tmp_i_reg_3368.read()) && esl_seteq<1,1,1>(ap_const_lv1_1, tmp_i_82_reg_3372.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, or_cond2_i_reg_3479.read()) && esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter1_fsm_state2.read()))) { ap_phi_mux_xtrasBuffer_V_flag_8_phi_fu_419_p18 = ap_const_lv1_1; } else { ap_phi_mux_xtrasBuffer_V_flag_8_phi_fu_419_p18 = ap_phi_reg_pp0_iter1_xtrasBuffer_V_flag_8_reg_414.read(); } } void response_r::thread_ap_phi_mux_xtrasBuffer_V_new_8_s_phi_fu_453_p18() { if ((esl_seteq<1,1,1>(ap_const_lv1_0, tmp_i_reg_3368.read()) && esl_seteq<1,1,1>(ap_const_lv1_1, tmp_i_82_reg_3372.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, or_cond2_i_reg_3479.read()) && esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter1_fsm_state2.read()))) { ap_phi_mux_xtrasBuffer_V_new_8_s_phi_fu_453_p18 = ap_phi_reg_pp0_iter1_xtrasBuffer_V_new_i_reg_394.read(); } else { ap_phi_mux_xtrasBuffer_V_new_8_s_phi_fu_453_p18 = ap_phi_reg_pp0_iter1_xtrasBuffer_V_new_8_s_reg_449.read(); } } void response_r::thread_ap_phi_reg_pp0_iter0_p_0492_1_i_reg_405() { ap_phi_reg_pp0_iter0_p_0492_1_i_reg_405 = (sc_lv<16>) ("XXXXXXXXXXXXXXXX"); } void response_r::thread_ap_phi_reg_pp0_iter0_tmp_data_V_1_reg_385() { ap_phi_reg_pp0_iter0_tmp_data_V_1_reg_385 = (sc_lv<32>) ("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"); } void response_r::thread_ap_phi_reg_pp0_iter0_tmp_keep_V_1_reg_352() { ap_phi_reg_pp0_iter0_tmp_keep_V_1_reg_352 = (sc_lv<8>) ("XXXXXXXX"); } void response_r::thread_ap_phi_reg_pp0_iter0_tmp_keep_V_3_reg_322() { ap_phi_reg_pp0_iter0_tmp_keep_V_3_reg_322 = (sc_lv<8>) ("XXXXXXXX"); } void response_r::thread_ap_phi_reg_pp0_iter0_tmp_last_V_1_reg_336() { ap_phi_reg_pp0_iter0_tmp_last_V_1_reg_336 = (sc_lv<1>) ("X"); } void response_r::thread_ap_phi_reg_pp0_iter0_tmp_last_V_2_reg_306() { ap_phi_reg_pp0_iter0_tmp_last_V_2_reg_306 = (sc_lv<1>) ("X"); } void response_r::thread_ap_phi_reg_pp0_iter0_tmp_last_V_reg_366() { ap_phi_reg_pp0_iter0_tmp_last_V_reg_366 = (sc_lv<1>) ("X"); } void response_r::thread_ap_phi_reg_pp0_iter0_xtrasBuffer_V_flag_8_reg_414() { ap_phi_reg_pp0_iter0_xtrasBuffer_V_flag_8_reg_414 = (sc_lv<1>) ("X"); } void response_r::thread_ap_phi_reg_pp0_iter0_xtrasBuffer_V_new_8_s_reg_449() { ap_phi_reg_pp0_iter0_xtrasBuffer_V_new_8_s_reg_449 = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"; } void response_r::thread_ap_phi_reg_pp0_iter0_xtrasBuffer_V_new_i_reg_394() { ap_phi_reg_pp0_iter0_xtrasBuffer_V_new_i_reg_394 = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"; } void response_r::thread_ap_predicate_op134_read_state1() { ap_predicate_op134_read_state1 = (esl_seteq<1,1,1>(tmp_i_fu_541_p2.read(), ap_const_lv1_0) && esl_seteq<1,1,1>(tmp_i_82_fu_559_p2.read(), ap_const_lv1_1) && esl_seteq<1,1,1>(ap_const_lv1_0, or_cond2_i_fu_1902_p2.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, or_cond5_i_fu_2004_p2.read())); } void response_r::thread_ap_predicate_op142_read_state1() { ap_predicate_op142_read_state1 = (esl_seteq<1,1,1>(tmp_i_fu_541_p2.read(), ap_const_lv1_1) && esl_seteq<1,1,1>(ap_const_lv1_1, tmp_nbreadreq_fu_270_p3.read())); } void response_r::thread_ap_predicate_op150_write_state2() { ap_predicate_op150_write_state2 = (esl_seteq<1,1,1>(ap_const_lv1_0, tmp_i_reg_3368.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_i_82_reg_3372.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_18_i_reg_3383.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_24_i_reg_3387.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_29_i_reg_3391.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_31_i_reg_3395.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_35_i_reg_3399.read()) && esl_seteq<1,1,1>(ap_const_lv1_1, tmp_41_i_reg_3403.read())); } void response_r::thread_ap_predicate_op155_write_state2() { ap_predicate_op155_write_state2 = (esl_seteq<1,1,1>(ap_const_lv1_0, tmp_i_reg_3368.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_i_82_reg_3372.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_18_i_reg_3383.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_24_i_reg_3387.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_29_i_reg_3391.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_31_i_reg_3395.read()) && esl_seteq<1,1,1>(ap_const_lv1_1, tmp_35_i_reg_3399.read())); } void response_r::thread_ap_predicate_op185_write_state2() { ap_predicate_op185_write_state2 = ((esl_seteq<1,1,1>(ap_const_lv1_0, tmp_i_reg_3368.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_i_82_reg_3372.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_18_i_reg_3383.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_24_i_reg_3387.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_29_i_reg_3391.read()) && esl_seteq<1,1,1>(ap_const_lv1_1, tmp_31_i_reg_3395.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_34_i_reg_3407.read()) && esl_seteq<1,1,1>(ap_const_lv1_1, tmp_39_i_reg_3415.read())) || (esl_seteq<1,1,1>(ap_const_lv1_0, tmp_i_reg_3368.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_i_82_reg_3372.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_18_i_reg_3383.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_24_i_reg_3387.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_29_i_reg_3391.read()) && esl_seteq<1,1,1>(ap_const_lv1_1, tmp_31_i_reg_3395.read()) && esl_seteq<1,1,1>(ap_const_lv1_1, tmp_39_i_reg_3415.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_6_reg_3411.read()))); } void response_r::thread_ap_predicate_op190_write_state2() { ap_predicate_op190_write_state2 = (esl_seteq<1,1,1>(ap_const_lv1_0, tmp_i_reg_3368.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_i_82_reg_3372.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_18_i_reg_3383.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_24_i_reg_3387.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_29_i_reg_3391.read()) && esl_seteq<1,1,1>(ap_const_lv1_1, tmp_31_i_reg_3395.read()) && esl_seteq<1,1,1>(ap_const_lv1_1, tmp_34_i_reg_3407.read()) && esl_seteq<1,1,1>(ap_const_lv1_1, tmp_6_reg_3411.read())); } void response_r::thread_ap_predicate_op195_write_state2() { ap_predicate_op195_write_state2 = (esl_seteq<1,1,1>(ap_const_lv1_0, tmp_i_reg_3368.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_i_82_reg_3372.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_18_i_reg_3383.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_24_i_reg_3387.read()) && esl_seteq<1,1,1>(ap_const_lv1_1, tmp_29_i_reg_3391.read()) && esl_seteq<1,1,1>(ap_const_lv1_1, tmp_5_reg_3437.read())); } void response_r::thread_ap_predicate_op197_write_state2() { ap_predicate_op197_write_state2 = (esl_seteq<1,1,1>(ap_const_lv1_0, tmp_i_reg_3368.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_i_82_reg_3372.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_18_i_reg_3383.read()) && esl_seteq<1,1,1>(ap_const_lv1_1, tmp_24_i_reg_3387.read())); } void response_r::thread_ap_predicate_op200_write_state2() { ap_predicate_op200_write_state2 = (esl_seteq<1,1,1>(ap_const_lv1_0, tmp_i_reg_3368.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_i_82_reg_3372.read()) && esl_seteq<1,1,1>(ap_const_lv1_1, tmp_18_i_reg_3383.read())); } void response_r::thread_ap_predicate_op208_write_state2() { ap_predicate_op208_write_state2 = (esl_seteq<1,1,1>(ap_const_lv1_0, tmp_i_reg_3368.read()) && esl_seteq<1,1,1>(ap_const_lv1_1, tmp_i_82_reg_3372.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, or_cond2_i_reg_3479.read())); } void response_r::thread_ap_predicate_op218_write_state3() { ap_predicate_op218_write_state3 = (esl_seteq<1,1,1>(ap_const_lv1_0, tmp_i_reg_3368_pp0_iter1_reg.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_i_82_reg_3372_pp0_iter1_reg.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_18_i_reg_3383_pp0_iter1_reg.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_24_i_reg_3387_pp0_iter1_reg.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_29_i_reg_3391_pp0_iter1_reg.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_31_i_reg_3395_pp0_iter1_reg.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_35_i_reg_3399_pp0_iter1_reg.read()) && esl_seteq<1,1,1>(ap_const_lv1_1, tmp_41_i_reg_3403_pp0_iter1_reg.read())); } void response_r::thread_ap_predicate_op221_write_state3() { ap_predicate_op221_write_state3 = (esl_seteq<1,1,1>(ap_const_lv1_0, tmp_i_reg_3368_pp0_iter1_reg.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_i_82_reg_3372_pp0_iter1_reg.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_18_i_reg_3383_pp0_iter1_reg.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_24_i_reg_3387_pp0_iter1_reg.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_29_i_reg_3391_pp0_iter1_reg.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_31_i_reg_3395_pp0_iter1_reg.read()) && esl_seteq<1,1,1>(ap_const_lv1_1, tmp_35_i_reg_3399_pp0_iter1_reg.read())); } void response_r::thread_ap_predicate_op223_write_state3() { ap_predicate_op223_write_state3 = ((esl_seteq<1,1,1>(ap_const_lv1_0, tmp_i_reg_3368_pp0_iter1_reg.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_i_82_reg_3372_pp0_iter1_reg.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_18_i_reg_3383_pp0_iter1_reg.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_24_i_reg_3387_pp0_iter1_reg.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_29_i_reg_3391_pp0_iter1_reg.read()) && esl_seteq<1,1,1>(ap_const_lv1_1, tmp_31_i_reg_3395_pp0_iter1_reg.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_34_i_reg_3407_pp0_iter1_reg.read()) && esl_seteq<1,1,1>(ap_const_lv1_1, tmp_39_i_reg_3415_pp0_iter1_reg.read())) || (esl_seteq<1,1,1>(ap_const_lv1_0, tmp_i_reg_3368_pp0_iter1_reg.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_i_82_reg_3372_pp0_iter1_reg.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_18_i_reg_3383_pp0_iter1_reg.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_24_i_reg_3387_pp0_iter1_reg.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_29_i_reg_3391_pp0_iter1_reg.read()) && esl_seteq<1,1,1>(ap_const_lv1_1, tmp_31_i_reg_3395_pp0_iter1_reg.read()) && esl_seteq<1,1,1>(ap_const_lv1_1, tmp_39_i_reg_3415_pp0_iter1_reg.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_6_reg_3411_pp0_iter1_reg.read()))); } void response_r::thread_ap_predicate_op226_write_state3() { ap_predicate_op226_write_state3 = (esl_seteq<1,1,1>(ap_const_lv1_0, tmp_i_reg_3368_pp0_iter1_reg.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_i_82_reg_3372_pp0_iter1_reg.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_18_i_reg_3383_pp0_iter1_reg.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_24_i_reg_3387_pp0_iter1_reg.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_29_i_reg_3391_pp0_iter1_reg.read()) && esl_seteq<1,1,1>(ap_const_lv1_1, tmp_31_i_reg_3395_pp0_iter1_reg.read()) && esl_seteq<1,1,1>(ap_const_lv1_1, tmp_34_i_reg_3407_pp0_iter1_reg.read()) && esl_seteq<1,1,1>(ap_const_lv1_1, tmp_6_reg_3411_pp0_iter1_reg.read())); } void response_r::thread_ap_predicate_op227_write_state3() { ap_predicate_op227_write_state3 = (esl_seteq<1,1,1>(ap_const_lv1_0, tmp_i_reg_3368_pp0_iter1_reg.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_i_82_reg_3372_pp0_iter1_reg.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_18_i_reg_3383_pp0_iter1_reg.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_24_i_reg_3387_pp0_iter1_reg.read()) && esl_seteq<1,1,1>(ap_const_lv1_1, tmp_29_i_reg_3391_pp0_iter1_reg.read()) && esl_seteq<1,1,1>(ap_const_lv1_1, tmp_5_reg_3437_pp0_iter1_reg.read())); } void response_r::thread_ap_predicate_op229_write_state3() { ap_predicate_op229_write_state3 = (esl_seteq<1,1,1>(ap_const_lv1_0, tmp_i_reg_3368_pp0_iter1_reg.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_i_82_reg_3372_pp0_iter1_reg.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_18_i_reg_3383_pp0_iter1_reg.read()) && esl_seteq<1,1,1>(ap_const_lv1_1, tmp_24_i_reg_3387_pp0_iter1_reg.read())); } void response_r::thread_ap_predicate_op230_write_state3() { ap_predicate_op230_write_state3 = (esl_seteq<1,1,1>(ap_const_lv1_0, tmp_i_reg_3368_pp0_iter1_reg.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_i_82_reg_3372_pp0_iter1_reg.read()) && esl_seteq<1,1,1>(ap_const_lv1_1, tmp_18_i_reg_3383_pp0_iter1_reg.read())); } void response_r::thread_ap_predicate_op231_write_state3() { ap_predicate_op231_write_state3 = (esl_seteq<1,1,1>(ap_const_lv1_0, tmp_i_reg_3368_pp0_iter1_reg.read()) && esl_seteq<1,1,1>(ap_const_lv1_1, tmp_i_82_reg_3372_pp0_iter1_reg.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, or_cond2_i_reg_3479_pp0_iter1_reg.read())); } void response_r::thread_ap_predicate_op37_read_state1() { ap_predicate_op37_read_state1 = (esl_seteq<1,1,1>(tmp_i_fu_541_p2.read(), ap_const_lv1_0) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_i_82_fu_559_p2.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_18_i_fu_570_p2.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_24_i_fu_576_p2.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_29_i_fu_582_p2.read()) && esl_seteq<1,1,1>(tmp_31_i_fu_588_p2.read(), ap_const_lv1_1) && esl_seteq<1,1,1>(ap_const_lv1_1, tmp_34_i_fu_606_p2.read()) && esl_seteq<1,1,1>(ap_const_lv1_1, grp_nbreadreq_fu_256_p3.read())); } void response_r::thread_ap_predicate_op56_read_state1() { ap_predicate_op56_read_state1 = (esl_seteq<1,1,1>(tmp_i_fu_541_p2.read(), ap_const_lv1_0) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_i_82_fu_559_p2.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_18_i_fu_570_p2.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, tmp_24_i_fu_576_p2.read()) && esl_seteq<1,1,1>(ap_const_lv1_1, grp_nbreadreq_fu_256_p3.read()) && esl_seteq<1,1,1>(tmp_29_i_fu_582_p2.read(), ap_const_lv1_1)); } void response_r::thread_ap_ready() { if ((!(esl_seteq<1,1,1>(ap_start.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_done_reg.read(), ap_const_logic_1) || (esl_seteq<1,1,1>(metadataBuffer_rf_V_s_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op142_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op134_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op56_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op37_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter2_fsm_state3.read()) && (esl_seteq<1,1,1>(respOutput_V_last_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_keep_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_user_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_data_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state3_io.read()))) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter1_fsm_state2.read()) && esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state2_io.read()))) && esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter0_fsm_state1.read()))) { ap_ready = ap_const_logic_1; } else { ap_ready = ap_const_logic_0; } } void response_r::thread_br_valueLengthTemp_V_fu_2010_p2() { br_valueLengthTemp_V_fu_2010_p2 = (!tempVar_V_fu_1922_p4.read().is_01() || !ap_const_lv16_14.is_01())? sc_lv<16>(): (sc_biguint<16>(tempVar_V_fu_1922_p4.read()) + sc_biguint<16>(ap_const_lv16_14)); } void response_r::thread_grp_fu_492_p2() { grp_fu_492_p2 = (!valueLength.read().is_01() || !ap_const_lv16_5.is_01())? sc_lv<1>(): (sc_biguint<16>(valueLength.read()) < sc_biguint<16>(ap_const_lv16_5)); } void response_r::thread_grp_fu_502_p2() { grp_fu_502_p2 = (!errorCode.read().is_01() || !ap_const_lv8_1.is_01())? sc_lv<1>(): sc_lv<1>(errorCode.read() == ap_const_lv8_1); } void response_r::thread_grp_fu_507_p2() { grp_fu_507_p2 = (!outOpCode.read().is_01() || !ap_const_lv8_4.is_01())? sc_lv<1>(): sc_lv<1>(outOpCode.read() == ap_const_lv8_4); } void response_r::thread_grp_fu_512_p2() { grp_fu_512_p2 = (!outOpCode.read().is_01() || !ap_const_lv8_0.is_01())? sc_lv<1>(): sc_lv<1>(outOpCode.read() == ap_const_lv8_0); } void response_r::thread_grp_fu_517_p4() { grp_fu_517_p4 = xtrasBuffer_V.read().range(63, 32); } void response_r::thread_grp_nbreadreq_fu_256_p3() { grp_nbreadreq_fu_256_p3 = (sc_lv<1>) (valueBuffer_rf_V_V_empty_n.read()); } void response_r::thread_lengthValue_assign_fu_1208_p2() { lengthValue_assign_fu_1208_p2 = (!ap_const_lv4_4.is_01() || !tmp_67_fu_1204_p1.read().is_01())? sc_lv<4>(): (sc_biguint<4>(ap_const_lv4_4) + sc_biguint<4>(tmp_67_fu_1204_p1.read())); } void response_r::thread_metadataBuffer_rf_V_s_blk_n() { if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter0_fsm_state1.read()) && esl_seteq<1,1,1>(ap_predicate_op142_read_state1.read(), ap_const_boolean_1) && !(esl_seteq<1,1,1>(ap_start.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_done_reg.read(), ap_const_logic_1)) && esl_seteq<1,1,1>(ap_const_logic_1, ap_start.read()))) { metadataBuffer_rf_V_s_blk_n = metadataBuffer_rf_V_s_empty_n.read(); } else { metadataBuffer_rf_V_s_blk_n = ap_const_logic_1; } } void response_r::thread_metadataBuffer_rf_V_s_read() { if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter0_fsm_state1.read()) && esl_seteq<1,1,1>(ap_predicate_op142_read_state1.read(), ap_const_boolean_1) && !(esl_seteq<1,1,1>(ap_start.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_done_reg.read(), ap_const_logic_1) || (esl_seteq<1,1,1>(metadataBuffer_rf_V_s_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op142_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op134_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op56_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op37_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter2_fsm_state3.read()) && (esl_seteq<1,1,1>(respOutput_V_last_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_keep_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_user_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_data_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state3_io.read()))) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter1_fsm_state2.read()) && esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state2_io.read()))))) { metadataBuffer_rf_V_s_read = ap_const_logic_1; } else { metadataBuffer_rf_V_s_read = ap_const_logic_0; } } void response_r::thread_or_cond1_i_fu_1890_p2() { or_cond1_i_fu_1890_p2 = (or_cond913_not_i_fu_1884_p2.read() | grp_fu_502_p2.read()); } void response_r::thread_or_cond2_i_fu_1902_p2() { or_cond2_i_fu_1902_p2 = (grp_fu_512_p2.read() & or_cond915_not_i_fu_1896_p2.read()); } void response_r::thread_or_cond3_i_fu_1784_p2() { or_cond3_i_fu_1784_p2 = (grp_fu_512_p2.read() | grp_fu_507_p2.read()); } void response_r::thread_or_cond4_i_fu_1790_p2() { or_cond4_i_fu_1790_p2 = (or_cond3_i_fu_1784_p2.read() & grp_fu_502_p2.read()); } void response_r::thread_or_cond5_i_fu_2004_p2() { or_cond5_i_fu_2004_p2 = (tmp_30_i_fu_1998_p2.read() | grp_fu_502_p2.read()); } void response_r::thread_or_cond913_not_i_fu_1884_p1() { or_cond913_not_i_fu_1884_p1 = (sc_lv<1>) (valueBuffer_rf_V_V_empty_n.read()); } void response_r::thread_or_cond913_not_i_fu_1884_p2() { or_cond913_not_i_fu_1884_p2 = (tmp1_fu_1878_p2.read() & or_cond913_not_i_fu_1884_p1.read()); } void response_r::thread_or_cond915_not_i_fu_1896_p2() { or_cond915_not_i_fu_1896_p2 = (or_cond1_i_fu_1890_p2.read() ^ ap_const_lv1_1); } void response_r::thread_outData_TDATA() { outData_TDATA = respOutput_V_data_V_1_data_out.read(); } void response_r::thread_outData_TDATA_blk_n() { if (((esl_seteq<1,1,1>(ap_const_boolean_1, ap_predicate_op208_write_state2.read()) && esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter1_fsm_state2.read())) || (esl_seteq<1,1,1>(ap_const_boolean_1, ap_predicate_op231_write_state3.read()) && esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter2_fsm_state3.read())) || (esl_seteq<1,1,1>(ap_const_boolean_1, ap_predicate_op200_write_state2.read()) && esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter1_fsm_state2.read())) || (esl_seteq<1,1,1>(ap_const_boolean_1, ap_predicate_op230_write_state3.read()) && esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter2_fsm_state3.read())) || (esl_seteq<1,1,1>(ap_const_boolean_1, ap_predicate_op197_write_state2.read()) && esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter1_fsm_state2.read())) || (esl_seteq<1,1,1>(ap_const_boolean_1, ap_predicate_op229_write_state3.read()) && esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter2_fsm_state3.read())) || (esl_seteq<1,1,1>(ap_const_boolean_1, ap_predicate_op195_write_state2.read()) && esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter1_fsm_state2.read())) || (esl_seteq<1,1,1>(ap_const_boolean_1, ap_predicate_op227_write_state3.read()) && esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter2_fsm_state3.read())) || (esl_seteq<1,1,1>(ap_const_boolean_1, ap_predicate_op190_write_state2.read()) && esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter1_fsm_state2.read())) || (esl_seteq<1,1,1>(ap_const_boolean_1, ap_predicate_op226_write_state3.read()) && esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter2_fsm_state3.read())) || (esl_seteq<1,1,1>(ap_const_boolean_1, ap_predicate_op185_write_state2.read()) && esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter1_fsm_state2.read())) || (esl_seteq<1,1,1>(ap_const_boolean_1, ap_predicate_op223_write_state3.read()) && esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter2_fsm_state3.read())) || (esl_seteq<1,1,1>(ap_const_boolean_1, ap_predicate_op155_write_state2.read()) && esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter1_fsm_state2.read())) || (esl_seteq<1,1,1>(ap_const_boolean_1, ap_predicate_op221_write_state3.read()) && esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter2_fsm_state3.read())) || (esl_seteq<1,1,1>(ap_const_boolean_1, ap_predicate_op150_write_state2.read()) && esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter1_fsm_state2.read())) || (esl_seteq<1,1,1>(ap_const_boolean_1, ap_predicate_op218_write_state3.read()) && esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter2_fsm_state3.read())))) { outData_TDATA_blk_n = respOutput_V_data_V_1_state.read()[1]; } else { outData_TDATA_blk_n = ap_const_logic_1; } } void response_r::thread_outData_TKEEP() { outData_TKEEP = respOutput_V_keep_V_1_data_out.read(); } void response_r::thread_outData_TLAST() { outData_TLAST = respOutput_V_last_V_1_data_out.read(); } void response_r::thread_outData_TUSER() { outData_TUSER = respOutput_V_user_V_1_data_out.read(); } void response_r::thread_outData_TVALID() { outData_TVALID = respOutput_V_last_V_1_state.read()[0]; } void response_r::thread_p_1_cast_i_cast_cast_fu_1796_p3() { p_1_cast_i_cast_cast_fu_1796_p3 = (!or_cond4_i_fu_1790_p2.read()[0].is_01())? sc_lv<32>(): ((or_cond4_i_fu_1790_p2.read()[0].to_bool())? ap_const_lv32_8000000: ap_const_lv32_0); } void response_r::thread_p_Result_10_fu_2079_p1() { p_Result_10_fu_2079_p1 = esl_zext<64,32>(grp_fu_517_p4.read()); } void response_r::thread_p_Result_3_fu_3326_p4() { p_Result_3_fu_3326_p4 = esl_concat<56,8>(esl_concat<48,8>(ap_const_lv48_40000, p_Result_2_i_reg_3488.read()), ap_const_lv8_81); } void response_r::thread_p_Result_4_fu_3342_p5() { p_Result_4_fu_3342_p5 = esl_partset<64,64,8,32,32>(tempOutput_data_V_fu_3335_p3.read(), p_Result_8_i_reg_3499.read(), ap_const_lv32_38, ap_const_lv32_3F); } void response_r::thread_p_Result_56_i_i_fu_1840_p4() { p_Result_56_i_i_fu_1840_p4 = p_Val2_4_fu_1808_p2.read().range(15, 8); } void response_r::thread_p_Result_5_fu_3354_p3() { p_Result_5_fu_3354_p3 = esl_concat<16,96>(ap_phi_reg_pp0_iter1_p_0492_1_i_reg_405.read(), p_Result_1_i_reg_3483.read()); } void response_r::thread_p_Result_6_fu_3304_p3() { p_Result_6_fu_3304_p3 = esl_concat<32,32>(tmp_66_reg_3441.read(), tmp_65_fu_3300_p1.read()); } void response_r::thread_p_Result_7_fu_3292_p3() { p_Result_7_fu_3292_p3 = esl_concat<32,32>(tmp_69_reg_3419.read(), grp_fu_517_p4.read()); } void response_r::thread_p_Result_8_fu_2737_p2() { p_Result_8_fu_2737_p2 = (tmp_83_fu_2723_p3.read() & tmp_84_fu_2731_p2.read()); } void response_r::thread_p_Result_9_fu_2763_p2() { p_Result_9_fu_2763_p2 = (p_Result_8_fu_2737_p2.read() & tmp_89_fu_2757_p2.read()); } void response_r::thread_p_Result_i_83_fu_1912_p4() { p_Result_i_83_fu_1912_p4 = outMetadataTempBuffe.read().range(39, 8); } void response_r::thread_p_Result_i_i_84_fu_1830_p4() { p_Result_i_i_84_fu_1830_p4 = p_Val2_4_fu_1808_p2.read().range(23, 16); } void response_r::thread_p_Result_i_i_fu_1820_p4() { p_Result_i_i_fu_1820_p4 = p_Val2_4_fu_1808_p2.read().range(31, 24); } void response_r::thread_p_Result_s_fu_3317_p4() { p_Result_s_fu_3317_p4 = esl_concat<56,8>(esl_concat<48,8>(ap_const_lv48_0, p_Result_2_i_reg_3488.read()), ap_const_lv8_81); } void response_r::thread_p_Val2_4_fu_1808_p2() { p_Val2_4_fu_1808_p2 = (!ap_const_lv32_4.is_01() || !resp_ValueConvertTem.read().is_01())? sc_lv<32>(): (sc_biguint<32>(ap_const_lv32_4) + sc_biguint<32>(resp_ValueConvertTem.read())); } void response_r::thread_p_cast_i_cast_cast_fu_2016_p3() { p_cast_i_cast_cast_fu_2016_p3 = (!grp_fu_502_p2.read()[0].is_01())? sc_lv<16>(): ((grp_fu_502_p2.read()[0].to_bool())? ap_const_lv16_20: ap_const_lv16_18); } void response_r::thread_p_not_i_fu_1872_p2() { p_not_i_fu_1872_p2 = (!errorCode.read().is_01() || !ap_const_lv8_1.is_01())? sc_lv<1>(): sc_lv<1>(errorCode.read() != ap_const_lv8_1); } void response_r::thread_respOutput_V_data_V_1_ack_in() { respOutput_V_data_V_1_ack_in = respOutput_V_data_V_1_state.read()[1]; } void response_r::thread_respOutput_V_data_V_1_ack_out() { respOutput_V_data_V_1_ack_out = outData_TREADY.read(); } void response_r::thread_respOutput_V_data_V_1_data_in() { if (esl_seteq<1,1,1>(ap_condition_962.read(), ap_const_boolean_1)) { if (esl_seteq<1,1,1>(ap_const_boolean_1, ap_predicate_op208_write_state2.read())) { respOutput_V_data_V_1_data_in = p_Result_4_fu_3342_p5.read(); } else if (esl_seteq<1,1,1>(ap_const_boolean_1, ap_predicate_op200_write_state2.read())) { respOutput_V_data_V_1_data_in = tmp_data_V_2_fu_3312_p1.read(); } else if (esl_seteq<1,1,1>(ap_const_boolean_1, ap_predicate_op197_write_state2.read())) { respOutput_V_data_V_1_data_in = ap_const_lv64_0; } else if (esl_seteq<1,1,1>(ap_const_boolean_1, ap_predicate_op195_write_state2.read())) { respOutput_V_data_V_1_data_in = p_Result_6_fu_3304_p3.read(); } else if (esl_seteq<1,1,1>(ap_const_boolean_1, ap_predicate_op190_write_state2.read())) { respOutput_V_data_V_1_data_in = p_Result_7_fu_3292_p3.read(); } else if (esl_seteq<1,1,1>(ap_const_boolean_1, ap_predicate_op185_write_state2.read())) { respOutput_V_data_V_1_data_in = p_Result_9_fu_2763_p2.read(); } else if (esl_seteq<1,1,1>(ap_const_boolean_1, ap_predicate_op155_write_state2.read())) { respOutput_V_data_V_1_data_in = p_Result_10_fu_2079_p1.read(); } else if (esl_seteq<1,1,1>(ap_const_boolean_1, ap_predicate_op150_write_state2.read())) { respOutput_V_data_V_1_data_in = ap_const_lv64_313020524F525245; } else { respOutput_V_data_V_1_data_in = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"; } } else { respOutput_V_data_V_1_data_in = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"; } } void response_r::thread_respOutput_V_data_V_1_data_out() { if (esl_seteq<1,1,1>(ap_const_logic_1, respOutput_V_data_V_1_sel.read())) { respOutput_V_data_V_1_data_out = respOutput_V_data_V_1_payload_B.read(); } else { respOutput_V_data_V_1_data_out = respOutput_V_data_V_1_payload_A.read(); } } void response_r::thread_respOutput_V_data_V_1_load_A() { respOutput_V_data_V_1_load_A = (respOutput_V_data_V_1_state_cmp_full.read() & ~respOutput_V_data_V_1_sel_wr.read()); } void response_r::thread_respOutput_V_data_V_1_load_B() { respOutput_V_data_V_1_load_B = (respOutput_V_data_V_1_sel_wr.read() & respOutput_V_data_V_1_state_cmp_full.read()); } void response_r::thread_respOutput_V_data_V_1_sel() { respOutput_V_data_V_1_sel = respOutput_V_data_V_1_sel_rd.read(); } void response_r::thread_respOutput_V_data_V_1_state_cmp_full() { respOutput_V_data_V_1_state_cmp_full = (sc_logic) ((!respOutput_V_data_V_1_state.read().is_01() || !ap_const_lv2_1.is_01())? sc_lv<1>(): sc_lv<1>(respOutput_V_data_V_1_state.read() != ap_const_lv2_1))[0]; } void response_r::thread_respOutput_V_data_V_1_vld_in() { if (((esl_seteq<1,1,1>(ap_const_boolean_1, ap_predicate_op155_write_state2.read()) && esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter1_fsm_state2.read()) && !(esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state2_io.read()) || esl_seteq<1,1,1>(ap_done_reg.read(), ap_const_logic_1) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter2_fsm_state3.read()) && (esl_seteq<1,1,1>(respOutput_V_last_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_keep_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_user_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_data_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state3_io.read()))))) || (esl_seteq<1,1,1>(ap_const_boolean_1, ap_predicate_op185_write_state2.read()) && esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter1_fsm_state2.read()) && !(esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state2_io.read()) || esl_seteq<1,1,1>(ap_done_reg.read(), ap_const_logic_1) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter2_fsm_state3.read()) && (esl_seteq<1,1,1>(respOutput_V_last_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_keep_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_user_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_data_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state3_io.read()))))) || (esl_seteq<1,1,1>(ap_const_boolean_1, ap_predicate_op200_write_state2.read()) && esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter1_fsm_state2.read()) && !(esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state2_io.read()) || esl_seteq<1,1,1>(ap_done_reg.read(), ap_const_logic_1) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter2_fsm_state3.read()) && (esl_seteq<1,1,1>(respOutput_V_last_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_keep_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_user_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_data_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state3_io.read()))))) || (esl_seteq<1,1,1>(ap_const_boolean_1, ap_predicate_op208_write_state2.read()) && esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter1_fsm_state2.read()) && !(esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state2_io.read()) || esl_seteq<1,1,1>(ap_done_reg.read(), ap_const_logic_1) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter2_fsm_state3.read()) && (esl_seteq<1,1,1>(respOutput_V_last_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_keep_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_user_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_data_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state3_io.read()))))) || (esl_seteq<1,1,1>(ap_const_boolean_1, ap_predicate_op150_write_state2.read()) && esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter1_fsm_state2.read()) && !(esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state2_io.read()) || esl_seteq<1,1,1>(ap_done_reg.read(), ap_const_logic_1) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter2_fsm_state3.read()) && (esl_seteq<1,1,1>(respOutput_V_last_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_keep_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_user_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_data_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state3_io.read()))))) || (esl_seteq<1,1,1>(ap_const_boolean_1, ap_predicate_op190_write_state2.read()) && esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter1_fsm_state2.read()) && !(esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state2_io.read()) || esl_seteq<1,1,1>(ap_done_reg.read(), ap_const_logic_1) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter2_fsm_state3.read()) && (esl_seteq<1,1,1>(respOutput_V_last_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_keep_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_user_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_data_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state3_io.read()))))) || (esl_seteq<1,1,1>(ap_const_boolean_1, ap_predicate_op195_write_state2.read()) && esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter1_fsm_state2.read()) && !(esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state2_io.read()) || esl_seteq<1,1,1>(ap_done_reg.read(), ap_const_logic_1) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter2_fsm_state3.read()) && (esl_seteq<1,1,1>(respOutput_V_last_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_keep_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_user_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_data_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state3_io.read()))))) || (esl_seteq<1,1,1>(ap_const_boolean_1, ap_predicate_op197_write_state2.read()) && esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter1_fsm_state2.read()) && !(esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state2_io.read()) || esl_seteq<1,1,1>(ap_done_reg.read(), ap_const_logic_1) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter2_fsm_state3.read()) && (esl_seteq<1,1,1>(respOutput_V_last_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_keep_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_user_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_data_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state3_io.read()))))))) { respOutput_V_data_V_1_vld_in = ap_const_logic_1; } else { respOutput_V_data_V_1_vld_in = ap_const_logic_0; } } void response_r::thread_respOutput_V_data_V_1_vld_out() { respOutput_V_data_V_1_vld_out = respOutput_V_data_V_1_state.read()[0]; } void response_r::thread_respOutput_V_keep_V_1_ack_in() { respOutput_V_keep_V_1_ack_in = respOutput_V_keep_V_1_state.read()[1]; } void response_r::thread_respOutput_V_keep_V_1_ack_out() { respOutput_V_keep_V_1_ack_out = outData_TREADY.read(); } void response_r::thread_respOutput_V_keep_V_1_data_in() { if ((esl_seteq<1,1,1>(ap_const_boolean_1, ap_predicate_op195_write_state2.read()) && esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter1_fsm_state2.read()) && !(esl_seteq<1,1,1>(ap_done_reg.read(), ap_const_logic_1) || ((esl_seteq<1,1,1>(respOutput_V_data_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_user_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_keep_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_last_V_1_ack_in.read(), ap_const_logic_0)) && esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter2_fsm_state3.read()))))) { respOutput_V_keep_V_1_data_in = ap_phi_reg_pp0_iter1_tmp_keep_V_1_reg_352.read(); } else if ((esl_seteq<1,1,1>(ap_const_boolean_1, ap_predicate_op190_write_state2.read()) && esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter1_fsm_state2.read()) && !(esl_seteq<1,1,1>(ap_done_reg.read(), ap_const_logic_1) || ((esl_seteq<1,1,1>(respOutput_V_data_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_user_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_keep_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_last_V_1_ack_in.read(), ap_const_logic_0)) && esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter2_fsm_state3.read()))))) { respOutput_V_keep_V_1_data_in = ap_phi_reg_pp0_iter1_tmp_keep_V_3_reg_322.read(); } else if ((esl_seteq<1,1,1>(ap_const_boolean_1, ap_predicate_op185_write_state2.read()) && esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter1_fsm_state2.read()) && !(esl_seteq<1,1,1>(ap_done_reg.read(), ap_const_logic_1) || ((esl_seteq<1,1,1>(respOutput_V_data_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_user_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_keep_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_last_V_1_ack_in.read(), ap_const_logic_0)) && esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter2_fsm_state3.read()))))) { respOutput_V_keep_V_1_data_in = tempOutput_keep_V_4_fu_2773_p258.read(); } else if ((esl_seteq<1,1,1>(ap_const_boolean_1, ap_predicate_op155_write_state2.read()) && esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter1_fsm_state2.read()) && !(esl_seteq<1,1,1>(ap_done_reg.read(), ap_const_logic_1) || ((esl_seteq<1,1,1>(respOutput_V_data_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_user_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_keep_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_last_V_1_ack_in.read(), ap_const_logic_0)) && esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter2_fsm_state3.read()))))) { respOutput_V_keep_V_1_data_in = tempOutput_keep_V_5_fu_2087_p258.read(); } else if (((esl_seteq<1,1,1>(ap_const_boolean_1, ap_predicate_op150_write_state2.read()) && esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter1_fsm_state2.read()) && !(esl_seteq<1,1,1>(ap_done_reg.read(), ap_const_logic_1) || ((esl_seteq<1,1,1>(respOutput_V_data_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_user_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_keep_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_last_V_1_ack_in.read(), ap_const_logic_0)) && esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter2_fsm_state3.read())))) || (esl_seteq<1,1,1>(ap_const_boolean_1, ap_predicate_op197_write_state2.read()) && esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter1_fsm_state2.read()) && !(esl_seteq<1,1,1>(ap_done_reg.read(), ap_const_logic_1) || ((esl_seteq<1,1,1>(respOutput_V_data_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_user_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_keep_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_last_V_1_ack_in.read(), ap_const_logic_0)) && esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter2_fsm_state3.read())))) || (esl_seteq<1,1,1>(ap_const_boolean_1, ap_predicate_op200_write_state2.read()) && esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter1_fsm_state2.read()) && !(esl_seteq<1,1,1>(ap_done_reg.read(), ap_const_logic_1) || ((esl_seteq<1,1,1>(respOutput_V_data_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_user_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_keep_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_last_V_1_ack_in.read(), ap_const_logic_0)) && esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter2_fsm_state3.read())))) || (esl_seteq<1,1,1>(ap_const_boolean_1, ap_predicate_op208_write_state2.read()) && esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter1_fsm_state2.read()) && !(esl_seteq<1,1,1>(ap_done_reg.read(), ap_const_logic_1) || ((esl_seteq<1,1,1>(respOutput_V_data_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_user_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_keep_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_last_V_1_ack_in.read(), ap_const_logic_0)) && esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter2_fsm_state3.read())))))) { respOutput_V_keep_V_1_data_in = ap_const_lv8_FF; } else { respOutput_V_keep_V_1_data_in = (sc_lv<8>) ("XXXXXXXX"); } } void response_r::thread_respOutput_V_keep_V_1_data_out() { if (esl_seteq<1,1,1>(ap_const_logic_1, respOutput_V_keep_V_1_sel.read())) { respOutput_V_keep_V_1_data_out = respOutput_V_keep_V_1_payload_B.read(); } else { respOutput_V_keep_V_1_data_out = respOutput_V_keep_V_1_payload_A.read(); } } void response_r::thread_respOutput_V_keep_V_1_load_A() { respOutput_V_keep_V_1_load_A = (respOutput_V_keep_V_1_state_cmp_full.read() & ~respOutput_V_keep_V_1_sel_wr.read()); } void response_r::thread_respOutput_V_keep_V_1_load_B() { respOutput_V_keep_V_1_load_B = (respOutput_V_keep_V_1_sel_wr.read() & respOutput_V_keep_V_1_state_cmp_full.read()); } void response_r::thread_respOutput_V_keep_V_1_sel() { respOutput_V_keep_V_1_sel = respOutput_V_keep_V_1_sel_rd.read(); } void response_r::thread_respOutput_V_keep_V_1_state_cmp_full() { respOutput_V_keep_V_1_state_cmp_full = (sc_logic) ((!respOutput_V_keep_V_1_state.read().is_01() || !ap_const_lv2_1.is_01())? sc_lv<1>(): sc_lv<1>(respOutput_V_keep_V_1_state.read() != ap_const_lv2_1))[0]; } void response_r::thread_respOutput_V_keep_V_1_vld_in() { if (((esl_seteq<1,1,1>(ap_const_boolean_1, ap_predicate_op155_write_state2.read()) && esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter1_fsm_state2.read()) && !(esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state2_io.read()) || esl_seteq<1,1,1>(ap_done_reg.read(), ap_const_logic_1) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter2_fsm_state3.read()) && (esl_seteq<1,1,1>(respOutput_V_last_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_keep_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_user_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_data_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state3_io.read()))))) || (esl_seteq<1,1,1>(ap_const_boolean_1, ap_predicate_op185_write_state2.read()) && esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter1_fsm_state2.read()) && !(esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state2_io.read()) || esl_seteq<1,1,1>(ap_done_reg.read(), ap_const_logic_1) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter2_fsm_state3.read()) && (esl_seteq<1,1,1>(respOutput_V_last_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_keep_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_user_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_data_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state3_io.read()))))) || (esl_seteq<1,1,1>(ap_const_boolean_1, ap_predicate_op200_write_state2.read()) && esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter1_fsm_state2.read()) && !(esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state2_io.read()) || esl_seteq<1,1,1>(ap_done_reg.read(), ap_const_logic_1) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter2_fsm_state3.read()) && (esl_seteq<1,1,1>(respOutput_V_last_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_keep_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_user_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_data_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state3_io.read()))))) || (esl_seteq<1,1,1>(ap_const_boolean_1, ap_predicate_op208_write_state2.read()) && esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter1_fsm_state2.read()) && !(esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state2_io.read()) || esl_seteq<1,1,1>(ap_done_reg.read(), ap_const_logic_1) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter2_fsm_state3.read()) && (esl_seteq<1,1,1>(respOutput_V_last_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_keep_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_user_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_data_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state3_io.read()))))) || (esl_seteq<1,1,1>(ap_const_boolean_1, ap_predicate_op150_write_state2.read()) && esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter1_fsm_state2.read()) && !(esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state2_io.read()) || esl_seteq<1,1,1>(ap_done_reg.read(), ap_const_logic_1) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter2_fsm_state3.read()) && (esl_seteq<1,1,1>(respOutput_V_last_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_keep_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_user_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_data_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state3_io.read()))))) || (esl_seteq<1,1,1>(ap_const_boolean_1, ap_predicate_op190_write_state2.read()) && esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter1_fsm_state2.read()) && !(esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state2_io.read()) || esl_seteq<1,1,1>(ap_done_reg.read(), ap_const_logic_1) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter2_fsm_state3.read()) && (esl_seteq<1,1,1>(respOutput_V_last_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_keep_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_user_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_data_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state3_io.read()))))) || (esl_seteq<1,1,1>(ap_const_boolean_1, ap_predicate_op195_write_state2.read()) && esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter1_fsm_state2.read()) && !(esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state2_io.read()) || esl_seteq<1,1,1>(ap_done_reg.read(), ap_const_logic_1) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter2_fsm_state3.read()) && (esl_seteq<1,1,1>(respOutput_V_last_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_keep_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_user_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_data_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state3_io.read()))))) || (esl_seteq<1,1,1>(ap_const_boolean_1, ap_predicate_op197_write_state2.read()) && esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter1_fsm_state2.read()) && !(esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state2_io.read()) || esl_seteq<1,1,1>(ap_done_reg.read(), ap_const_logic_1) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter2_fsm_state3.read()) && (esl_seteq<1,1,1>(respOutput_V_last_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_keep_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_user_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_data_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state3_io.read()))))))) { respOutput_V_keep_V_1_vld_in = ap_const_logic_1; } else { respOutput_V_keep_V_1_vld_in = ap_const_logic_0; } } void response_r::thread_respOutput_V_keep_V_1_vld_out() { respOutput_V_keep_V_1_vld_out = respOutput_V_keep_V_1_state.read()[0]; } void response_r::thread_respOutput_V_last_V_1_ack_in() { respOutput_V_last_V_1_ack_in = respOutput_V_last_V_1_state.read()[1]; } void response_r::thread_respOutput_V_last_V_1_ack_out() { respOutput_V_last_V_1_ack_out = outData_TREADY.read(); } void response_r::thread_respOutput_V_last_V_1_data_in() { if (((esl_seteq<1,1,1>(ap_const_boolean_1, ap_predicate_op200_write_state2.read()) && esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter1_fsm_state2.read()) && !(esl_seteq<1,1,1>(ap_done_reg.read(), ap_const_logic_1) || ((esl_seteq<1,1,1>(respOutput_V_data_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_user_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_keep_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_last_V_1_ack_in.read(), ap_const_logic_0)) && esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter2_fsm_state3.read())))) || (esl_seteq<1,1,1>(ap_const_boolean_1, ap_predicate_op208_write_state2.read()) && esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter1_fsm_state2.read()) && !(esl_seteq<1,1,1>(ap_done_reg.read(), ap_const_logic_1) || ((esl_seteq<1,1,1>(respOutput_V_data_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_user_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_keep_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_last_V_1_ack_in.read(), ap_const_logic_0)) && esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter2_fsm_state3.read())))))) { respOutput_V_last_V_1_data_in = ap_const_lv1_0; } else if ((esl_seteq<1,1,1>(ap_const_boolean_1, ap_predicate_op197_write_state2.read()) && esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter1_fsm_state2.read()) && !(esl_seteq<1,1,1>(ap_done_reg.read(), ap_const_logic_1) || ((esl_seteq<1,1,1>(respOutput_V_data_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_user_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_keep_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_last_V_1_ack_in.read(), ap_const_logic_0)) && esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter2_fsm_state3.read()))))) { respOutput_V_last_V_1_data_in = ap_phi_reg_pp0_iter1_tmp_last_V_reg_366.read(); } else if ((esl_seteq<1,1,1>(ap_const_boolean_1, ap_predicate_op195_write_state2.read()) && esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter1_fsm_state2.read()) && !(esl_seteq<1,1,1>(ap_done_reg.read(), ap_const_logic_1) || ((esl_seteq<1,1,1>(respOutput_V_data_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_user_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_keep_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_last_V_1_ack_in.read(), ap_const_logic_0)) && esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter2_fsm_state3.read()))))) { respOutput_V_last_V_1_data_in = ap_phi_reg_pp0_iter1_tmp_last_V_1_reg_336.read(); } else if ((esl_seteq<1,1,1>(ap_const_boolean_1, ap_predicate_op190_write_state2.read()) && esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter1_fsm_state2.read()) && !(esl_seteq<1,1,1>(ap_done_reg.read(), ap_const_logic_1) || ((esl_seteq<1,1,1>(respOutput_V_data_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_user_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_keep_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_last_V_1_ack_in.read(), ap_const_logic_0)) && esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter2_fsm_state3.read()))))) { respOutput_V_last_V_1_data_in = ap_phi_reg_pp0_iter1_tmp_last_V_2_reg_306.read(); } else if (((esl_seteq<1,1,1>(ap_const_boolean_1, ap_predicate_op150_write_state2.read()) && esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter1_fsm_state2.read()) && !(esl_seteq<1,1,1>(ap_done_reg.read(), ap_const_logic_1) || ((esl_seteq<1,1,1>(respOutput_V_data_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_user_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_keep_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_last_V_1_ack_in.read(), ap_const_logic_0)) && esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter2_fsm_state3.read())))) || (esl_seteq<1,1,1>(ap_const_boolean_1, ap_predicate_op155_write_state2.read()) && esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter1_fsm_state2.read()) && !(esl_seteq<1,1,1>(ap_done_reg.read(), ap_const_logic_1) || ((esl_seteq<1,1,1>(respOutput_V_data_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_user_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_keep_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_last_V_1_ack_in.read(), ap_const_logic_0)) && esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter2_fsm_state3.read())))) || (esl_seteq<1,1,1>(ap_const_boolean_1, ap_predicate_op185_write_state2.read()) && esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter1_fsm_state2.read()) && !(esl_seteq<1,1,1>(ap_done_reg.read(), ap_const_logic_1) || ((esl_seteq<1,1,1>(respOutput_V_data_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_user_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_keep_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_last_V_1_ack_in.read(), ap_const_logic_0)) && esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter2_fsm_state3.read())))))) { respOutput_V_last_V_1_data_in = ap_const_lv1_1; } else { respOutput_V_last_V_1_data_in = (sc_lv<1>) ("X"); } } void response_r::thread_respOutput_V_last_V_1_data_out() { if (esl_seteq<1,1,1>(ap_const_logic_1, respOutput_V_last_V_1_sel.read())) { respOutput_V_last_V_1_data_out = respOutput_V_last_V_1_payload_B.read(); } else { respOutput_V_last_V_1_data_out = respOutput_V_last_V_1_payload_A.read(); } } void response_r::thread_respOutput_V_last_V_1_load_A() { respOutput_V_last_V_1_load_A = (respOutput_V_last_V_1_state_cmp_full.read() & ~respOutput_V_last_V_1_sel_wr.read()); } void response_r::thread_respOutput_V_last_V_1_load_B() { respOutput_V_last_V_1_load_B = (respOutput_V_last_V_1_sel_wr.read() & respOutput_V_last_V_1_state_cmp_full.read()); } void response_r::thread_respOutput_V_last_V_1_sel() { respOutput_V_last_V_1_sel = respOutput_V_last_V_1_sel_rd.read(); } void response_r::thread_respOutput_V_last_V_1_state_cmp_full() { respOutput_V_last_V_1_state_cmp_full = (sc_logic) ((!respOutput_V_last_V_1_state.read().is_01() || !ap_const_lv2_1.is_01())? sc_lv<1>(): sc_lv<1>(respOutput_V_last_V_1_state.read() != ap_const_lv2_1))[0]; } void response_r::thread_respOutput_V_last_V_1_vld_in() { if (((esl_seteq<1,1,1>(ap_const_boolean_1, ap_predicate_op155_write_state2.read()) && esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter1_fsm_state2.read()) && !(esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state2_io.read()) || esl_seteq<1,1,1>(ap_done_reg.read(), ap_const_logic_1) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter2_fsm_state3.read()) && (esl_seteq<1,1,1>(respOutput_V_last_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_keep_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_user_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_data_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state3_io.read()))))) || (esl_seteq<1,1,1>(ap_const_boolean_1, ap_predicate_op185_write_state2.read()) && esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter1_fsm_state2.read()) && !(esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state2_io.read()) || esl_seteq<1,1,1>(ap_done_reg.read(), ap_const_logic_1) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter2_fsm_state3.read()) && (esl_seteq<1,1,1>(respOutput_V_last_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_keep_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_user_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_data_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state3_io.read()))))) || (esl_seteq<1,1,1>(ap_const_boolean_1, ap_predicate_op200_write_state2.read()) && esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter1_fsm_state2.read()) && !(esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state2_io.read()) || esl_seteq<1,1,1>(ap_done_reg.read(), ap_const_logic_1) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter2_fsm_state3.read()) && (esl_seteq<1,1,1>(respOutput_V_last_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_keep_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_user_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_data_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state3_io.read()))))) || (esl_seteq<1,1,1>(ap_const_boolean_1, ap_predicate_op208_write_state2.read()) && esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter1_fsm_state2.read()) && !(esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state2_io.read()) || esl_seteq<1,1,1>(ap_done_reg.read(), ap_const_logic_1) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter2_fsm_state3.read()) && (esl_seteq<1,1,1>(respOutput_V_last_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_keep_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_user_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_data_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state3_io.read()))))) || (esl_seteq<1,1,1>(ap_const_boolean_1, ap_predicate_op150_write_state2.read()) && esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter1_fsm_state2.read()) && !(esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state2_io.read()) || esl_seteq<1,1,1>(ap_done_reg.read(), ap_const_logic_1) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter2_fsm_state3.read()) && (esl_seteq<1,1,1>(respOutput_V_last_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_keep_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_user_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_data_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state3_io.read()))))) || (esl_seteq<1,1,1>(ap_const_boolean_1, ap_predicate_op190_write_state2.read()) && esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter1_fsm_state2.read()) && !(esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state2_io.read()) || esl_seteq<1,1,1>(ap_done_reg.read(), ap_const_logic_1) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter2_fsm_state3.read()) && (esl_seteq<1,1,1>(respOutput_V_last_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_keep_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_user_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_data_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state3_io.read()))))) || (esl_seteq<1,1,1>(ap_const_boolean_1, ap_predicate_op195_write_state2.read()) && esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter1_fsm_state2.read()) && !(esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state2_io.read()) || esl_seteq<1,1,1>(ap_done_reg.read(), ap_const_logic_1) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter2_fsm_state3.read()) && (esl_seteq<1,1,1>(respOutput_V_last_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_keep_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_user_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_data_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state3_io.read()))))) || (esl_seteq<1,1,1>(ap_const_boolean_1, ap_predicate_op197_write_state2.read()) && esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter1_fsm_state2.read()) && !(esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state2_io.read()) || esl_seteq<1,1,1>(ap_done_reg.read(), ap_const_logic_1) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter2_fsm_state3.read()) && (esl_seteq<1,1,1>(respOutput_V_last_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_keep_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_user_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_data_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state3_io.read()))))))) { respOutput_V_last_V_1_vld_in = ap_const_logic_1; } else { respOutput_V_last_V_1_vld_in = ap_const_logic_0; } } void response_r::thread_respOutput_V_last_V_1_vld_out() { respOutput_V_last_V_1_vld_out = respOutput_V_last_V_1_state.read()[0]; } void response_r::thread_respOutput_V_user_V_1_ack_in() { respOutput_V_user_V_1_ack_in = respOutput_V_user_V_1_state.read()[1]; } void response_r::thread_respOutput_V_user_V_1_ack_out() { respOutput_V_user_V_1_ack_out = outData_TREADY.read(); } void response_r::thread_respOutput_V_user_V_1_data_in() { if ((esl_seteq<1,1,1>(ap_const_boolean_1, ap_predicate_op208_write_state2.read()) && esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter1_fsm_state2.read()) && !(esl_seteq<1,1,1>(ap_done_reg.read(), ap_const_logic_1) || ((esl_seteq<1,1,1>(respOutput_V_data_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_user_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_keep_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_last_V_1_ack_in.read(), ap_const_logic_0)) && esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter2_fsm_state3.read()))))) { respOutput_V_user_V_1_data_in = p_Result_5_fu_3354_p3.read(); } else if (((esl_seteq<1,1,1>(ap_const_boolean_1, ap_predicate_op150_write_state2.read()) && esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter1_fsm_state2.read()) && !(esl_seteq<1,1,1>(ap_done_reg.read(), ap_const_logic_1) || ((esl_seteq<1,1,1>(respOutput_V_data_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_user_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_keep_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_last_V_1_ack_in.read(), ap_const_logic_0)) && esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter2_fsm_state3.read())))) || (esl_seteq<1,1,1>(ap_const_boolean_1, ap_predicate_op155_write_state2.read()) && esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter1_fsm_state2.read()) && !(esl_seteq<1,1,1>(ap_done_reg.read(), ap_const_logic_1) || ((esl_seteq<1,1,1>(respOutput_V_data_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_user_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_keep_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_last_V_1_ack_in.read(), ap_const_logic_0)) && esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter2_fsm_state3.read())))) || (esl_seteq<1,1,1>(ap_const_boolean_1, ap_predicate_op185_write_state2.read()) && esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter1_fsm_state2.read()) && !(esl_seteq<1,1,1>(ap_done_reg.read(), ap_const_logic_1) || ((esl_seteq<1,1,1>(respOutput_V_data_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_user_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_keep_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_last_V_1_ack_in.read(), ap_const_logic_0)) && esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter2_fsm_state3.read())))) || (esl_seteq<1,1,1>(ap_const_boolean_1, ap_predicate_op190_write_state2.read()) && esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter1_fsm_state2.read()) && !(esl_seteq<1,1,1>(ap_done_reg.read(), ap_const_logic_1) || ((esl_seteq<1,1,1>(respOutput_V_data_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_user_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_keep_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_last_V_1_ack_in.read(), ap_const_logic_0)) && esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter2_fsm_state3.read())))) || (esl_seteq<1,1,1>(ap_const_boolean_1, ap_predicate_op195_write_state2.read()) && esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter1_fsm_state2.read()) && !(esl_seteq<1,1,1>(ap_done_reg.read(), ap_const_logic_1) || ((esl_seteq<1,1,1>(respOutput_V_data_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_user_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_keep_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_last_V_1_ack_in.read(), ap_const_logic_0)) && esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter2_fsm_state3.read())))) || (esl_seteq<1,1,1>(ap_const_boolean_1, ap_predicate_op197_write_state2.read()) && esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter1_fsm_state2.read()) && !(esl_seteq<1,1,1>(ap_done_reg.read(), ap_const_logic_1) || ((esl_seteq<1,1,1>(respOutput_V_data_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_user_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_keep_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_last_V_1_ack_in.read(), ap_const_logic_0)) && esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter2_fsm_state3.read())))) || (esl_seteq<1,1,1>(ap_const_boolean_1, ap_predicate_op200_write_state2.read()) && esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter1_fsm_state2.read()) && !(esl_seteq<1,1,1>(ap_done_reg.read(), ap_const_logic_1) || ((esl_seteq<1,1,1>(respOutput_V_data_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_user_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_keep_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_last_V_1_ack_in.read(), ap_const_logic_0)) && esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter2_fsm_state3.read())))))) { respOutput_V_user_V_1_data_in = ap_const_lv112_0; } else { respOutput_V_user_V_1_data_in = (sc_lv<112>) ("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"); } } void response_r::thread_respOutput_V_user_V_1_data_out() { if (esl_seteq<1,1,1>(ap_const_logic_1, respOutput_V_user_V_1_sel.read())) { respOutput_V_user_V_1_data_out = respOutput_V_user_V_1_payload_B.read(); } else { respOutput_V_user_V_1_data_out = respOutput_V_user_V_1_payload_A.read(); } } void response_r::thread_respOutput_V_user_V_1_load_A() { respOutput_V_user_V_1_load_A = (respOutput_V_user_V_1_state_cmp_full.read() & ~respOutput_V_user_V_1_sel_wr.read()); } void response_r::thread_respOutput_V_user_V_1_load_B() { respOutput_V_user_V_1_load_B = (respOutput_V_user_V_1_sel_wr.read() & respOutput_V_user_V_1_state_cmp_full.read()); } void response_r::thread_respOutput_V_user_V_1_sel() { respOutput_V_user_V_1_sel = respOutput_V_user_V_1_sel_rd.read(); } void response_r::thread_respOutput_V_user_V_1_state_cmp_full() { respOutput_V_user_V_1_state_cmp_full = (sc_logic) ((!respOutput_V_user_V_1_state.read().is_01() || !ap_const_lv2_1.is_01())? sc_lv<1>(): sc_lv<1>(respOutput_V_user_V_1_state.read() != ap_const_lv2_1))[0]; } void response_r::thread_respOutput_V_user_V_1_vld_in() { if (((esl_seteq<1,1,1>(ap_const_boolean_1, ap_predicate_op155_write_state2.read()) && esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter1_fsm_state2.read()) && !(esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state2_io.read()) || esl_seteq<1,1,1>(ap_done_reg.read(), ap_const_logic_1) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter2_fsm_state3.read()) && (esl_seteq<1,1,1>(respOutput_V_last_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_keep_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_user_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_data_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state3_io.read()))))) || (esl_seteq<1,1,1>(ap_const_boolean_1, ap_predicate_op185_write_state2.read()) && esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter1_fsm_state2.read()) && !(esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state2_io.read()) || esl_seteq<1,1,1>(ap_done_reg.read(), ap_const_logic_1) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter2_fsm_state3.read()) && (esl_seteq<1,1,1>(respOutput_V_last_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_keep_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_user_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_data_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state3_io.read()))))) || (esl_seteq<1,1,1>(ap_const_boolean_1, ap_predicate_op200_write_state2.read()) && esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter1_fsm_state2.read()) && !(esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state2_io.read()) || esl_seteq<1,1,1>(ap_done_reg.read(), ap_const_logic_1) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter2_fsm_state3.read()) && (esl_seteq<1,1,1>(respOutput_V_last_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_keep_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_user_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_data_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state3_io.read()))))) || (esl_seteq<1,1,1>(ap_const_boolean_1, ap_predicate_op208_write_state2.read()) && esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter1_fsm_state2.read()) && !(esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state2_io.read()) || esl_seteq<1,1,1>(ap_done_reg.read(), ap_const_logic_1) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter2_fsm_state3.read()) && (esl_seteq<1,1,1>(respOutput_V_last_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_keep_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_user_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_data_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state3_io.read()))))) || (esl_seteq<1,1,1>(ap_const_boolean_1, ap_predicate_op150_write_state2.read()) && esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter1_fsm_state2.read()) && !(esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state2_io.read()) || esl_seteq<1,1,1>(ap_done_reg.read(), ap_const_logic_1) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter2_fsm_state3.read()) && (esl_seteq<1,1,1>(respOutput_V_last_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_keep_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_user_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_data_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state3_io.read()))))) || (esl_seteq<1,1,1>(ap_const_boolean_1, ap_predicate_op190_write_state2.read()) && esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter1_fsm_state2.read()) && !(esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state2_io.read()) || esl_seteq<1,1,1>(ap_done_reg.read(), ap_const_logic_1) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter2_fsm_state3.read()) && (esl_seteq<1,1,1>(respOutput_V_last_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_keep_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_user_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_data_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state3_io.read()))))) || (esl_seteq<1,1,1>(ap_const_boolean_1, ap_predicate_op195_write_state2.read()) && esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter1_fsm_state2.read()) && !(esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state2_io.read()) || esl_seteq<1,1,1>(ap_done_reg.read(), ap_const_logic_1) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter2_fsm_state3.read()) && (esl_seteq<1,1,1>(respOutput_V_last_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_keep_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_user_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_data_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state3_io.read()))))) || (esl_seteq<1,1,1>(ap_const_boolean_1, ap_predicate_op197_write_state2.read()) && esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter1_fsm_state2.read()) && !(esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state2_io.read()) || esl_seteq<1,1,1>(ap_done_reg.read(), ap_const_logic_1) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter2_fsm_state3.read()) && (esl_seteq<1,1,1>(respOutput_V_last_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_keep_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_user_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_data_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state3_io.read()))))))) { respOutput_V_user_V_1_vld_in = ap_const_logic_1; } else { respOutput_V_user_V_1_vld_in = ap_const_logic_0; } } void response_r::thread_respOutput_V_user_V_1_vld_out() { respOutput_V_user_V_1_vld_out = respOutput_V_user_V_1_state.read()[0]; } void response_r::thread_rev_fu_2637_p2() { rev_fu_2637_p2 = (tmp_72_fu_2629_p3.read() ^ ap_const_lv1_1); } void response_r::thread_sf_fu_2709_p4() { sf_fu_2709_p4 = tmp_78_fu_2677_p3.read().range(63, 32); } void response_r::thread_st_fu_2695_p4() { st_fu_2695_p4 = tmp_78_fu_2677_p3.read().range(63, 31); } void response_r::thread_tempKeep_V_fu_620_p257() { tempKeep_V_fu_620_p257 = valueLength.read().range(8-1, 0); } void response_r::thread_tempOutput_data_V_fu_3335_p3() { tempOutput_data_V_fu_3335_p3 = (!tmp_8_reg_3494.read()[0].is_01())? sc_lv<64>(): ((tmp_8_reg_3494.read()[0].to_bool())? p_Result_3_fu_3326_p4.read(): p_Result_s_fu_3317_p4.read()); } void response_r::thread_tempOutput_keep_V_4_fu_2773_p257() { tempOutput_keep_V_4_fu_2773_p257 = valueLength_load_reg_3376.read().range(8-1, 0); } void response_r::thread_tempOutput_keep_V_5_fu_2087_p257() { tempOutput_keep_V_5_fu_2087_p257 = valueLength_load_reg_3376.read().range(8-1, 0); } void response_r::thread_tempOutput_keep_V_fu_1218_p257() { tempOutput_keep_V_fu_1218_p257 = esl_zext<8,4>(lengthValue_assign_fu_1208_p2.read()); } void response_r::thread_tempVar_V_fu_1922_p4() { tempVar_V_fu_1922_p4 = outMetadataTempBuffe.read().range(23, 8); } void response_r::thread_tmp1_fu_1878_p2() { tmp1_fu_1878_p2 = (grp_fu_512_p2.read() & p_not_i_fu_1872_p2.read()); } void response_r::thread_tmp_18_i_fu_570_p2() { tmp_18_i_fu_570_p2 = (!tmp_58_fu_537_p1.read().is_01() || !ap_const_lv4_2.is_01())? sc_lv<1>(): sc_lv<1>(tmp_58_fu_537_p1.read() == ap_const_lv4_2); } void response_r::thread_tmp_19_i_fu_1932_p2() { tmp_19_i_fu_1932_p2 = (!p_Result_i_83_fu_1912_p4.read().is_01() || !ap_const_lv32_FFFFFFF8.is_01())? sc_lv<32>(): (sc_biguint<32>(p_Result_i_83_fu_1912_p4.read()) + sc_bigint<32>(ap_const_lv32_FFFFFFF8)); } void response_r::thread_tmp_20_i_fu_1944_p2() { tmp_20_i_fu_1944_p2 = (!tempVar_V_fu_1922_p4.read().is_01() || !ap_const_lv16_FFF8.is_01())? sc_lv<16>(): (sc_biguint<16>(tempVar_V_fu_1922_p4.read()) + sc_bigint<16>(ap_const_lv16_FFF8)); } void response_r::thread_tmp_22_i_fu_1772_p2() { tmp_22_i_fu_1772_p2 = (errorCode.read() | outOpCode.read()); } void response_r::thread_tmp_23_i_fu_1778_p2() { tmp_23_i_fu_1778_p2 = (!tmp_22_i_fu_1772_p2.read().is_01() || !ap_const_lv8_0.is_01())? sc_lv<1>(): sc_lv<1>(tmp_22_i_fu_1772_p2.read() == ap_const_lv8_0); } void response_r::thread_tmp_24_i_fu_576_p2() { tmp_24_i_fu_576_p2 = (!tmp_58_fu_537_p1.read().is_01() || !ap_const_lv4_3.is_01())? sc_lv<1>(): sc_lv<1>(tmp_58_fu_537_p1.read() == ap_const_lv4_3); } void response_r::thread_tmp_28_i_fu_497_p2() { tmp_28_i_fu_497_p2 = (!errorCode.read().is_01() || !ap_const_lv8_1.is_01())? sc_lv<1>(): sc_lv<1>(errorCode.read() == ap_const_lv8_1); } void response_r::thread_tmp_29_i_fu_582_p2() { tmp_29_i_fu_582_p2 = (!tmp_58_fu_537_p1.read().is_01() || !ap_const_lv4_4.is_01())? sc_lv<1>(): sc_lv<1>(tmp_58_fu_537_p1.read() == ap_const_lv4_4); } void response_r::thread_tmp_30_i_fu_1998_p2() { tmp_30_i_fu_1998_p2 = (!outOpCode.read().is_01() || !ap_const_lv8_0.is_01())? sc_lv<1>(): sc_lv<1>(outOpCode.read() != ap_const_lv8_0); } void response_r::thread_tmp_31_i_fu_588_p2() { tmp_31_i_fu_588_p2 = (!tmp_58_fu_537_p1.read().is_01() || !ap_const_lv4_5.is_01())? sc_lv<1>(): sc_lv<1>(tmp_58_fu_537_p1.read() == ap_const_lv4_5); } void response_r::thread_tmp_34_i_fu_606_p2() { tmp_34_i_fu_606_p2 = (!valueLength.read().is_01() || !ap_const_lv16_4.is_01())? sc_lv<1>(): (sc_biguint<16>(valueLength.read()) > sc_biguint<16>(ap_const_lv16_4)); } void response_r::thread_tmp_35_i_fu_594_p2() { tmp_35_i_fu_594_p2 = (!tmp_58_fu_537_p1.read().is_01() || !ap_const_lv4_6.is_01())? sc_lv<1>(): sc_lv<1>(tmp_58_fu_537_p1.read() == ap_const_lv4_6); } void response_r::thread_tmp_38_i_fu_1192_p2() { tmp_38_i_fu_1192_p2 = (!valueLength.read().is_01() || !ap_const_lv16_FFFC.is_01())? sc_lv<16>(): (sc_biguint<16>(valueLength.read()) + sc_bigint<16>(ap_const_lv16_FFFC)); } void response_r::thread_tmp_41_i_fu_600_p2() { tmp_41_i_fu_600_p2 = (!tmp_58_fu_537_p1.read().is_01() || !ap_const_lv4_7.is_01())? sc_lv<1>(): sc_lv<1>(tmp_58_fu_537_p1.read() == ap_const_lv4_7); } void response_r::thread_tmp_43_i_fu_1138_p2() { tmp_43_i_fu_1138_p2 = (!valueLength.read().is_01() || !ap_const_lv16_8.is_01())? sc_lv<1>(): (sc_biguint<16>(valueLength.read()) > sc_biguint<16>(ap_const_lv16_8)); } void response_r::thread_tmp_44_i_fu_1144_p2() { tmp_44_i_fu_1144_p2 = (!ap_const_lv16_FFF8.is_01() || !valueLength.read().is_01())? sc_lv<16>(): (sc_bigint<16>(ap_const_lv16_FFF8) + sc_biguint<16>(valueLength.read())); } void response_r::thread_tmp_45_i_fu_1150_p3() { tmp_45_i_fu_1150_p3 = (!tmp_43_i_fu_1138_p2.read()[0].is_01())? sc_lv<16>(): ((tmp_43_i_fu_1138_p2.read()[0].to_bool())? tmp_44_i_fu_1144_p2.read(): ap_const_lv16_0); } void response_r::thread_tmp_46_i_fu_1164_p2() { tmp_46_i_fu_1164_p2 = (!tmp_45_i_fu_1150_p3.read().is_01() || !ap_const_lv16_0.is_01())? sc_lv<1>(): sc_lv<1>(tmp_45_i_fu_1150_p3.read() == ap_const_lv16_0); } void response_r::thread_tmp_48_i_fu_2609_p3() { tmp_48_i_fu_2609_p3 = esl_concat<3,3>(tmp_71_fu_2606_p1.read(), ap_const_lv3_0); } void response_r::thread_tmp_50_i_fu_1170_p2() { tmp_50_i_fu_1170_p2 = (!tmp_45_i_fu_1150_p3.read().is_01() || !ap_const_lv16_5.is_01())? sc_lv<1>(): (sc_biguint<16>(tmp_45_i_fu_1150_p3.read()) < sc_biguint<16>(ap_const_lv16_5)); } void response_r::thread_tmp_58_fu_537_p1() { tmp_58_fu_537_p1 = br_outWordCounter.read().range(4-1, 0); } void response_r::thread_tmp_59_fu_1850_p1() { tmp_59_fu_1850_p1 = p_Val2_4_fu_1808_p2.read().range(8-1, 0); } void response_r::thread_tmp_60_fu_1736_p2() { tmp_60_fu_1736_p2 = (!outOpCode.read().is_01() || !ap_const_lv8_8.is_01())? sc_lv<1>(): sc_lv<1>(outOpCode.read() == ap_const_lv8_8); } void response_r::thread_tmp_62_fu_1742_p2() { tmp_62_fu_1742_p2 = (grp_fu_507_p2.read() | tmp_60_fu_1736_p2.read()); } void response_r::thread_tmp_63_fu_1748_p2() { tmp_63_fu_1748_p2 = (!outOpCode.read().is_01() || !ap_const_lv8_1.is_01())? sc_lv<1>(): sc_lv<1>(outOpCode.read() == ap_const_lv8_1); } void response_r::thread_tmp_64_fu_1754_p2() { tmp_64_fu_1754_p2 = (tmp_63_fu_1748_p2.read() | tmp_62_fu_1742_p2.read()); } void response_r::thread_tmp_65_fu_3300_p1() { tmp_65_fu_3300_p1 = xtrasBuffer_V.read().range(32-1, 0); } void response_r::thread_tmp_66_fu_1182_p1() { tmp_66_fu_1182_p1 = valueBuffer_rf_V_V_dout.read().range(32-1, 0); } void response_r::thread_tmp_67_fu_1204_p1() { tmp_67_fu_1204_p1 = valueLength.read().range(4-1, 0); } void response_r::thread_tmp_69_fu_612_p1() { tmp_69_fu_612_p1 = valueBuffer_rf_V_V_dout.read().range(32-1, 0); } void response_r::thread_tmp_71_fu_2606_p1() { tmp_71_fu_2606_p1 = valueLength_load_reg_3376.read().range(3-1, 0); } void response_r::thread_tmp_72_fu_2629_p3() { tmp_72_fu_2629_p3 = Hi_assign_2_fu_2623_p2.read().range(5, 5); } void response_r::thread_tmp_73_fu_2643_p1() { tmp_73_fu_2643_p1 = esl_zext<7,6>(Hi_assign_2_fu_2623_p2.read()); } void response_r::thread_tmp_74_fu_2647_p4() { tmp_74_fu_2647_p4 = xtrasBuffer_V.read().range(0, 63); } void response_r::thread_tmp_75_fu_2657_p2() { tmp_75_fu_2657_p2 = (!ap_const_lv7_20.is_01() || !tmp_73_fu_2643_p1.read().is_01())? sc_lv<7>(): (sc_biguint<7>(ap_const_lv7_20) - sc_biguint<7>(tmp_73_fu_2643_p1.read())); } void response_r::thread_tmp_76_fu_2663_p2() { tmp_76_fu_2663_p2 = (!ap_const_lv7_60.is_01() || !tmp_73_fu_2643_p1.read().is_01())? sc_lv<7>(): (sc_bigint<7>(ap_const_lv7_60) + sc_biguint<7>(tmp_73_fu_2643_p1.read())); } void response_r::thread_tmp_77_fu_2669_p3() { tmp_77_fu_2669_p3 = (!rev_fu_2637_p2.read()[0].is_01())? sc_lv<7>(): ((rev_fu_2637_p2.read()[0].to_bool())? tmp_75_fu_2657_p2.read(): tmp_76_fu_2663_p2.read()); } void response_r::thread_tmp_78_fu_2677_p3() { tmp_78_fu_2677_p3 = (!rev_fu_2637_p2.read()[0].is_01())? sc_lv<64>(): ((rev_fu_2637_p2.read()[0].to_bool())? tmp_74_fu_2647_p4.read(): xtrasBuffer_V.read()); } void response_r::thread_tmp_79_fu_2685_p2() { tmp_79_fu_2685_p2 = (!ap_const_lv7_3F.is_01() || !tmp_77_fu_2669_p3.read().is_01())? sc_lv<7>(): (sc_biguint<7>(ap_const_lv7_3F) - sc_biguint<7>(tmp_77_fu_2669_p3.read())); } void response_r::thread_tmp_7_fu_1976_p2() { tmp_7_fu_1976_p2 = (errorCode.read() | outOpCode.read()); } void response_r::thread_tmp_80_fu_2691_p1() { tmp_80_fu_2691_p1 = esl_zext<64,7>(tmp_79_fu_2685_p2.read()); } void response_r::thread_tmp_81_fu_2705_p1() { tmp_81_fu_2705_p1 = esl_zext<64,33>(st_fu_2695_p4.read()); } void response_r::thread_tmp_82_fu_2719_p1() { tmp_82_fu_2719_p1 = esl_zext<64,32>(sf_fu_2709_p4.read()); } void response_r::thread_tmp_83_fu_2723_p3() { tmp_83_fu_2723_p3 = (!rev_fu_2637_p2.read()[0].is_01())? sc_lv<64>(): ((rev_fu_2637_p2.read()[0].to_bool())? tmp_81_fu_2705_p1.read(): tmp_82_fu_2719_p1.read()); } void response_r::thread_tmp_84_fu_2731_p2() { tmp_84_fu_2731_p2 = (!tmp_80_fu_2691_p1.read().is_01())? sc_lv<64>(): ap_const_lv64_FFFFFFFFFFFFFFFF >> (unsigned short)tmp_80_fu_2691_p1.read().to_uint(); } void response_r::thread_tmp_86_fu_2743_p1() { tmp_86_fu_2743_p1 = esl_sext<7,6>(Hi_assign_fu_2617_p2.read()); } void response_r::thread_tmp_87_fu_2747_p2() { tmp_87_fu_2747_p2 = (!ap_const_lv7_3F.is_01() || !tmp_86_fu_2743_p1.read().is_01())? sc_lv<7>(): (sc_biguint<7>(ap_const_lv7_3F) - sc_bigint<7>(tmp_86_fu_2743_p1.read())); } void response_r::thread_tmp_88_fu_2753_p1() { tmp_88_fu_2753_p1 = esl_zext<64,7>(tmp_87_fu_2747_p2.read()); } void response_r::thread_tmp_89_fu_2757_p2() { tmp_89_fu_2757_p2 = (!tmp_88_fu_2753_p1.read().is_01())? sc_lv<64>(): ap_const_lv64_FFFFFFFFFFFFFFFF >> (unsigned short)tmp_88_fu_2753_p1.read().to_uint(); } void response_r::thread_tmp_8_fu_1982_p2() { tmp_8_fu_1982_p2 = (!tmp_7_fu_1976_p2.read().is_01() || !ap_const_lv8_0.is_01())? sc_lv<1>(): sc_lv<1>(tmp_7_fu_1976_p2.read() == ap_const_lv8_0); } void response_r::thread_tmp_data_V_2_fu_3312_p1() { tmp_data_V_2_fu_3312_p1 = esl_zext<64,32>(ap_phi_reg_pp0_iter1_tmp_data_V_1_reg_385.read()); } void response_r::thread_tmp_i_82_fu_559_p2() { tmp_i_82_fu_559_p2 = (!tmp_58_fu_537_p1.read().is_01() || !ap_const_lv4_1.is_01())? sc_lv<1>(): sc_lv<1>(tmp_58_fu_537_p1.read() == ap_const_lv4_1); } void response_r::thread_tmp_i_fu_541_p2() { tmp_i_fu_541_p2 = (!tmp_58_fu_537_p1.read().is_01() || !ap_const_lv4_0.is_01())? sc_lv<1>(): sc_lv<1>(tmp_58_fu_537_p1.read() == ap_const_lv4_0); } void response_r::thread_tmp_i_i_fu_1854_p5() { tmp_i_i_fu_1854_p5 = esl_concat<24,8>(esl_concat<16,8>(esl_concat<8,8>(tmp_59_fu_1850_p1.read(), p_Result_56_i_i_fu_1840_p4.read()), p_Result_i_i_84_fu_1830_p4.read()), p_Result_i_i_fu_1820_p4.read()); } void response_r::thread_tmp_nbreadreq_fu_270_p3() { tmp_nbreadreq_fu_270_p3 = (sc_lv<1>) (metadataBuffer_rf_V_s_empty_n.read()); } void response_r::thread_valueBuffer_rf_V_V_blk_n() { if (((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter0_fsm_state1.read()) && esl_seteq<1,1,1>(ap_predicate_op134_read_state1.read(), ap_const_boolean_1) && !(esl_seteq<1,1,1>(ap_start.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_done_reg.read(), ap_const_logic_1)) && esl_seteq<1,1,1>(ap_const_logic_1, ap_start.read())) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter0_fsm_state1.read()) && esl_seteq<1,1,1>(ap_predicate_op56_read_state1.read(), ap_const_boolean_1) && !(esl_seteq<1,1,1>(ap_start.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_done_reg.read(), ap_const_logic_1)) && esl_seteq<1,1,1>(ap_const_logic_1, ap_start.read())) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter0_fsm_state1.read()) && esl_seteq<1,1,1>(ap_predicate_op37_read_state1.read(), ap_const_boolean_1) && !(esl_seteq<1,1,1>(ap_start.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_done_reg.read(), ap_const_logic_1)) && esl_seteq<1,1,1>(ap_const_logic_1, ap_start.read())))) { valueBuffer_rf_V_V_blk_n = valueBuffer_rf_V_V_empty_n.read(); } else { valueBuffer_rf_V_V_blk_n = ap_const_logic_1; } } void response_r::thread_valueBuffer_rf_V_V_read() { if (((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter0_fsm_state1.read()) && esl_seteq<1,1,1>(ap_predicate_op37_read_state1.read(), ap_const_boolean_1) && !(esl_seteq<1,1,1>(ap_start.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_done_reg.read(), ap_const_logic_1) || (esl_seteq<1,1,1>(metadataBuffer_rf_V_s_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op142_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op134_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op56_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op37_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter2_fsm_state3.read()) && (esl_seteq<1,1,1>(respOutput_V_last_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_keep_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_user_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_data_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state3_io.read()))) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter1_fsm_state2.read()) && esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state2_io.read())))) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter0_fsm_state1.read()) && esl_seteq<1,1,1>(ap_predicate_op56_read_state1.read(), ap_const_boolean_1) && !(esl_seteq<1,1,1>(ap_start.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_done_reg.read(), ap_const_logic_1) || (esl_seteq<1,1,1>(metadataBuffer_rf_V_s_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op142_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op134_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op56_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op37_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter2_fsm_state3.read()) && (esl_seteq<1,1,1>(respOutput_V_last_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_keep_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_user_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_data_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state3_io.read()))) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter1_fsm_state2.read()) && esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state2_io.read())))) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter0_fsm_state1.read()) && esl_seteq<1,1,1>(ap_predicate_op134_read_state1.read(), ap_const_boolean_1) && !(esl_seteq<1,1,1>(ap_start.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_done_reg.read(), ap_const_logic_1) || (esl_seteq<1,1,1>(metadataBuffer_rf_V_s_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op142_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op134_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op56_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op37_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter2_fsm_state3.read()) && (esl_seteq<1,1,1>(respOutput_V_last_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_keep_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_user_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_data_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state3_io.read()))) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter1_fsm_state2.read()) && esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state2_io.read())))))) { valueBuffer_rf_V_V_read = ap_const_logic_1; } else { valueBuffer_rf_V_V_read = ap_const_logic_0; } } void response_r::thread_ap_NS_iter0_fsm() { switch (ap_CS_iter0_fsm.read().to_uint64()) { case 1 : ap_NS_iter0_fsm = ap_ST_iter0_fsm_state1; break; default : ap_NS_iter0_fsm = (sc_lv<1>) ("X"); break; } } void response_r::thread_ap_NS_iter1_fsm() { switch (ap_CS_iter1_fsm.read().to_uint64()) { case 2 : if ((!(esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state2_io.read()) || esl_seteq<1,1,1>(ap_done_reg.read(), ap_const_logic_1) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter2_fsm_state3.read()) && (esl_seteq<1,1,1>(respOutput_V_last_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_keep_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_user_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_data_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state3_io.read())))) && !(esl_seteq<1,1,1>(ap_start.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_done_reg.read(), ap_const_logic_1) || (esl_seteq<1,1,1>(metadataBuffer_rf_V_s_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op142_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op134_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op56_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op37_read_state1.read(), ap_const_boolean_1))) && esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter0_fsm_state1.read()))) { ap_NS_iter1_fsm = ap_ST_iter1_fsm_state2; } else if ((!(esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state2_io.read()) || esl_seteq<1,1,1>(ap_done_reg.read(), ap_const_logic_1) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter2_fsm_state3.read()) && (esl_seteq<1,1,1>(respOutput_V_last_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_keep_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_user_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_data_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state3_io.read())))) && (esl_seteq<1,1,1>(ap_const_logic_0, ap_CS_iter0_fsm_state1.read()) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter0_fsm_state1.read()) && (esl_seteq<1,1,1>(ap_start.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_done_reg.read(), ap_const_logic_1) || (esl_seteq<1,1,1>(metadataBuffer_rf_V_s_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op142_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op134_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op56_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op37_read_state1.read(), ap_const_boolean_1))))))) { ap_NS_iter1_fsm = ap_ST_iter1_fsm_state0; } else { ap_NS_iter1_fsm = ap_ST_iter1_fsm_state2; } break; case 1 : if ((!(esl_seteq<1,1,1>(ap_start.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_done_reg.read(), ap_const_logic_1) || (esl_seteq<1,1,1>(metadataBuffer_rf_V_s_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op142_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op134_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op56_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(valueBuffer_rf_V_V_empty_n.read(), ap_const_logic_0) && esl_seteq<1,1,1>(ap_predicate_op37_read_state1.read(), ap_const_boolean_1)) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter2_fsm_state3.read()) && (esl_seteq<1,1,1>(respOutput_V_last_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_keep_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_user_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_data_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state3_io.read()))) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter1_fsm_state2.read()) && esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state2_io.read()))) && esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter0_fsm_state1.read()))) { ap_NS_iter1_fsm = ap_ST_iter1_fsm_state2; } else { ap_NS_iter1_fsm = ap_ST_iter1_fsm_state0; } break; default : ap_NS_iter1_fsm = (sc_lv<2>) ("XX"); break; } } void response_r::thread_ap_NS_iter2_fsm() { switch (ap_CS_iter2_fsm.read().to_uint64()) { case 2 : if ((!(esl_seteq<1,1,1>(respOutput_V_last_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_keep_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_user_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_data_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state3_io.read()) || esl_seteq<1,1,1>(ap_done_reg.read(), ap_const_logic_1)) && esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter1_fsm_state2.read()) && esl_seteq<1,1,1>(ap_const_boolean_0, ap_block_state2_io.read()))) { ap_NS_iter2_fsm = ap_ST_iter2_fsm_state3; } else if ((!(esl_seteq<1,1,1>(respOutput_V_last_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_keep_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_user_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_data_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state3_io.read()) || esl_seteq<1,1,1>(ap_done_reg.read(), ap_const_logic_1)) && (esl_seteq<1,1,1>(ap_const_logic_0, ap_CS_iter1_fsm_state2.read()) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter1_fsm_state2.read()) && esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state2_io.read()))))) { ap_NS_iter2_fsm = ap_ST_iter2_fsm_state0; } else { ap_NS_iter2_fsm = ap_ST_iter2_fsm_state3; } break; case 1 : if ((!(esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state2_io.read()) || esl_seteq<1,1,1>(ap_done_reg.read(), ap_const_logic_1) || (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter2_fsm_state3.read()) && (esl_seteq<1,1,1>(respOutput_V_last_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_keep_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_user_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(respOutput_V_data_V_1_ack_in.read(), ap_const_logic_0) || esl_seteq<1,1,1>(ap_const_boolean_1, ap_block_state3_io.read())))) && esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_iter1_fsm_state2.read()))) { ap_NS_iter2_fsm = ap_ST_iter2_fsm_state3; } else { ap_NS_iter2_fsm = ap_ST_iter2_fsm_state0; } break; default : ap_NS_iter2_fsm = (sc_lv<2>) ("XX"); break; } } }
64.665904
642
0.737896
pratik0509
f3417e0ea4b44777de3be19447a4e6429f311131
740
cpp
C++
Game/Client/WXClient/Network/PacketHandler/GCBankItemInfoHandler.cpp
hackerlank/SourceCode
b702c9e0a9ca5d86933f3c827abb02a18ffc9a59
[ "MIT" ]
4
2021-07-31T13:56:01.000Z
2021-11-13T02:55:10.000Z
Game/Client/WXClient/Network/PacketHandler/GCBankItemInfoHandler.cpp
shacojx/SourceCodeGameTLBB
e3cea615b06761c2098a05427a5f41c236b71bf7
[ "MIT" ]
null
null
null
Game/Client/WXClient/Network/PacketHandler/GCBankItemInfoHandler.cpp
shacojx/SourceCodeGameTLBB
e3cea615b06761c2098a05427a5f41c236b71bf7
[ "MIT" ]
7
2021-08-31T14:34:23.000Z
2022-01-19T08:25:58.000Z
#include "StdAfx.h" #include "GCBankItemInfo.h" #include "..\..\Procedure\GameProcedure.h" #include "..\..\Object\ObjectManager.h" #include "..\..\DataPool\GMDataPool.h" #include "..\..\Action\GMActionSystem.h" #include "..\..\Event\GMEventSystem.h" uint GCBankItemInfoHandler::Execute( GCBankItemInfo* pPacket, Player* pPlayer ) { __ENTER_FUNCTION if(CGameProcedure::GetActiveProcedure() == (CGameProcedure*)CGameProcedure::s_pProcMain) { CDataPool::GetMe()->UserBank_SetItemExtraInfo(pPacket->getBankIndex(),pPacket->getIsNull(),pPacket->getItem()); CActionSystem::GetMe()->UserBank_Update(); CEventSystem::GetMe()->PushEvent(GE_UPDATE_BANK); } return PACKET_EXE_CONTINUE ; __LEAVE_FUNCTION return PACKET_EXE_ERROR ; }
27.407407
113
0.745946
hackerlank
f34540411e0e84a4c18bafeaf17c1ad829af9d03
2,863
cpp
C++
samples/RTSample.cpp
keima97/ouzel
e6673e678b4739235371a15ae3863942b692c5fb
[ "BSD-2-Clause" ]
null
null
null
samples/RTSample.cpp
keima97/ouzel
e6673e678b4739235371a15ae3863942b692c5fb
[ "BSD-2-Clause" ]
null
null
null
samples/RTSample.cpp
keima97/ouzel
e6673e678b4739235371a15ae3863942b692c5fb
[ "BSD-2-Clause" ]
null
null
null
// Copyright (C) 2016 Elviss Strazdins // This file is part of the Ouzel engine. #include "RTSample.h" #include "MainMenu.h" using namespace std; using namespace ouzel; RTSample::RTSample(Samples& aSamples): samples(aSamples), characterSprite("run.json"), backButton("button.png", "button_selected.png", "button_down.png", "", "Back", Color::BLACK, "arial.fnt") { eventHandler.uiHandler = bind(&RTSample::handleUI, this, placeholders::_1, placeholders::_2); eventHandler.keyboardHandler = bind(&RTSample::handleKeyboard, this, placeholders::_1, placeholders::_2); sharedEngine->getEventDispatcher()->addEventHandler(&eventHandler); addLayer(&rtLayer); ouzel::graphics::RenderTargetPtr renderTarget = sharedEngine->getRenderer()->createRenderTarget(); renderTarget->init(Size2(256.0f, 256.0f), false); renderTarget->setClearColor(Color(0, 64, 0)); rtCamera.setRenderTarget(renderTarget); rtLayer.addCamera(&rtCamera); camera1.setScaleMode(scene::Camera::ScaleMode::SHOW_ALL); camera1.setTargetContentSize(Size2(400.0f, 600.0f)); camera1.setViewport(Rectangle(0.0f, 0.0f, 0.5f, 1.0f)); camera2.setScaleMode(scene::Camera::ScaleMode::SHOW_ALL); camera2.setTargetContentSize(Size2(400.0f, 600.0f)); camera2.setViewport(Rectangle(0.5f, 0.0f, 0.5f, 1.0f)); layer.addCamera(&camera1); layer.addCamera(&camera2); addLayer(&layer); characterSprite.play(true); rtCharacter.addComponent(&characterSprite); rtLayer.addChild(&rtCharacter); scene::SpriteFrame rtFrame(renderTarget->getTexture(), Rectangle(0.0f, 0.0f, 256.0f, 256.0f), false, renderTarget->getTexture()->getSize(), Vector2(), Vector2(0.5f, 0.5f)); std::vector<scene::SpriteFrame> spriteFrames = { rtFrame }; rtSprite.initFromSpriteFrames(spriteFrames); rtNode.addComponent(&rtSprite); layer.addChild(&rtNode); guiCamera.setScaleMode(scene::Camera::ScaleMode::SHOW_ALL); guiCamera.setTargetContentSize(Size2(800.0f, 600.0f)); guiLayer.addCamera(&guiCamera); addLayer(&guiLayer); guiLayer.addChild(&menu); backButton.setPosition(Vector2(-200.0f, -200.0f)); menu.addWidget(&backButton); } bool RTSample::handleUI(Event::Type type, const UIEvent& event) const { if (type == Event::Type::UI_CLICK_NODE && event.node == &backButton) { samples.setScene(std::unique_ptr<scene::Scene>(new MainMenu(samples))); } return true; } bool RTSample::handleKeyboard(Event::Type type, const KeyboardEvent& event) const { if (type == Event::Type::KEY_DOWN) { switch (event.key) { case input::KeyboardKey::ESCAPE: samples.setScene(std::unique_ptr<scene::Scene>(new MainMenu(samples))); break; default: break; } } return true; }
32.168539
176
0.683199
keima97
f345777e8ee9aead06e70a2d9550ce192df34f38
2,430
cpp
C++
Underlight/cSending.cpp
christyganger/ULClient
bc008ab3042ff9b74d47cdda47ce2318311a51db
[ "BSD-3-Clause" ]
5
2018-08-17T17:17:01.000Z
2020-11-14T05:41:31.000Z
Underlight/cSending.cpp
christyganger/ULClient
bc008ab3042ff9b74d47cdda47ce2318311a51db
[ "BSD-3-Clause" ]
16
2018-08-16T15:37:04.000Z
2019-12-24T19:09:19.000Z
Underlight/cSending.cpp
christyganger/ULClient
bc008ab3042ff9b74d47cdda47ce2318311a51db
[ "BSD-3-Clause" ]
5
2018-08-16T15:34:41.000Z
2019-03-04T04:06:11.000Z
// cSending: The local monster (sending) class. // Copyright Lyra LLC, 1996. All rights reserved. #define STRICT #include "Central.h" #include "4dx.h" #include "cDSound.h" #include "cChat.h" #include "cPlayer.h" #include "cItem.h" #include "Realm.h" #include "cLevel.h" #include "Move.h" #include "cMissile.h" #include "cEffects.h" #include "cOrnament.h" #include "cSending.h" #include "resource.h" //////////////////////////////////////////////////////////////// // External Global Variables extern HINSTANCE hInstance; extern cPlayer *player; extern cDSound *cDS; extern cChat *display; extern cEffects *effects; extern timing_t *timing; extern cLevel *level; ///////////////////////////////////////////////////////////////// // Class Defintion // Constructor cSending::cSending(float s_x, float s_y, int s_angle, int avatar_type, unsigned __int64 flags) : cActor(s_x, s_y, s_angle, flags, SENDING), avatar(avatar_type) { // avatar id's are reserved as the low numbered effect id's if (!this->SetBitmapInfo(avatar)) return; health = 15; last_shot = 0; return; } // Called for updating sendings. // The AI for local monsters goes here. bool cSending::Update(void) { float dx,dy; bool animate = FALSE; if (terminate) return false; this->ModifyHeight(); angle = player->FacingAngle(x,y); // face player if (health <= 0) { new cOrnament(x, y, 0, angle, ACTOR_NOCOLLIDE, LyraBitmap::ENTRYEXIT_EFFECT); return FALSE; // we're dead... } if (level->Sectors[sector]->room != (int)player->Room()) { // _tprintf("in wrong room; player r = %d, sec = %d, us r = %d sec =%d...\n",player->Room(),player->sector,sector,level->Sectors[sector]->room); return TRUE; } dx = player->x - x; dy = player->y - y; return TRUE; } // change health and check for dead... void cSending::ChangeHealth(int healthchange) { health += healthchange; return; } bool cSending::Render(void) { return TRUE; } bool cSending::LeftClick(void) { LoadString (hInstance, IDS_MONSTER_ANGRY, disp_message, 256); display->DisplayMessage (disp_message); return true; } // identify neighbor bool cSending::RightClick(void) { LoadString (hInstance, IDS_MONSTER_ANGRY, disp_message, 256); display->DisplayMessage (disp_message); return true; } // Destructor cSending::~cSending(void) { return; } // Check invariants #ifdef DEBUG void cSending::Debug_CheckInvariants(int caller) { return; } #endif
17.357143
144
0.663786
christyganger
f349236102d5ec3d2e055f245cdf9cf85385ef63
582
cpp
C++
strcharcount.cpp
Re-taro/report-code
e8ff7543a251c33c8a58f6a8818af9c2cbb8f659
[ "MIT" ]
null
null
null
strcharcount.cpp
Re-taro/report-code
e8ff7543a251c33c8a58f6a8818af9c2cbb8f659
[ "MIT" ]
null
null
null
strcharcount.cpp
Re-taro/report-code
e8ff7543a251c33c8a58f6a8818af9c2cbb8f659
[ "MIT" ]
null
null
null
#include <iostream> using namespace std; unsigned strcharcount(char *str, char c); int main() { char str[20]="ABCDBEFGGGIJB"; cout << strcharcount(str, 'A') << endl; // 1 cout << strcharcount(str, 'B') << endl; // 3 cout << strcharcount(str+4, 'B') << endl; // 2 cout << strcharcount(str, 'G') << endl; // 3 return 0; } unsigned strcharcount(char *str, char c) { int counter = 0; while(*str != '\0') { if(*str == c){ counter++; str++; } else{ str++; } } return counter; }
21.555556
50
0.496564
Re-taro
f34b8b07c1fdb8e4ea310455e83d97d38631b3c0
752
cpp
C++
Source/RPG/Game/RPGEngineEditor.cpp
Aboutdept/RPGFramework
34c5c578e0ca1e455637082587291f6eac1bf35d
[ "BSD-2-Clause" ]
64
2015-01-04T01:47:31.000Z
2022-03-18T10:12:18.000Z
Source/RPG/Game/RPGEngineEditor.cpp
iniside/RPGFramework
72c83cd9a814ac18b19cfaa7fadbee88417f64e3
[ "BSD-2-Clause" ]
null
null
null
Source/RPG/Game/RPGEngineEditor.cpp
iniside/RPGFramework
72c83cd9a814ac18b19cfaa7fadbee88417f64e3
[ "BSD-2-Clause" ]
39
2015-01-20T02:37:56.000Z
2021-11-27T11:11:13.000Z
// Copyright 1998-2014 Epic Games, Inc. All Rights Reserved. #include "RPG.h" #include "GameplayTagsModule.h" #include "GameplayTags.h" #include "RPGEngineEditor.h" URPGEngineEditor::URPGEngineEditor(const class FPostConstructInitializeProperties& PCIP) : Super(PCIP) { } //bool URPGEngineEditor::Exec(UWorld* InWorld, const TCHAR* Cmd, FOutputDevice& Ar) //{ // return Super::Exec(InWorld, Cmd, Ar); //} void URPGEngineEditor::Init(IEngineLoop* InEngineLoop) { Super::Init(InEngineLoop); //DataTable'/Game/Blueprints/MyTags.MyTags' //DataTable'/Game/Blueprints/Tags.Tags' IGameplayTagsModule& GameplayTagsModule = IGameplayTagsModule::Get(); GameplayTagsModule.GetGameplayTagsManager().LoadGameplayTagTable("/Game/Blueprints/Tags.Tags"); }
28.923077
96
0.773936
Aboutdept
f35315950015aa1a85cc07f9049094923c5fca9b
3,857
cpp
C++
directfire_github/trunk/gameui/battle.net/gamepagetitle.cpp
zhwsh00/DirectFire-android
10c757e1be0b25dee951f9ba3a0e1f6d5c04a938
[ "MIT" ]
1
2015-08-12T04:05:33.000Z
2015-08-12T04:05:33.000Z
directfire_github/trunk/gameui/battle.net/gamepagetitle.cpp
zhwsh00/DirectFire-android
10c757e1be0b25dee951f9ba3a0e1f6d5c04a938
[ "MIT" ]
null
null
null
directfire_github/trunk/gameui/battle.net/gamepagetitle.cpp
zhwsh00/DirectFire-android
10c757e1be0b25dee951f9ba3a0e1f6d5c04a938
[ "MIT" ]
null
null
null
#include "gamepagetitle.h" GamePageTitle::GamePageTitle() { m_refreshListener = 0; m_refreshFunc = 0; m_nameSortListener = 0; m_nameSortFunc = 0; m_numSortListener = 0; m_numSortFunc = 0; m_dfListener = 0; m_dfFunc = 0; m_towerListener = 0; m_towerFunc = 0; m_theme = "default"; m_refreshImg = "titlebuttonbg"; m_refreshWidget = 0; m_refreshing = 0; } GamePageTitle::~GamePageTitle() { } void GamePageTitle::setRefreshCB(CCNode *node,SEL_CallFuncND func) { m_refreshListener = node; m_refreshFunc = func; } void GamePageTitle::setDfModelCB(CCNode *node,SEL_CallFuncND func) { m_dfListener = node; m_dfFunc = func; } void GamePageTitle::setTowerModelCB(CCNode *node,SEL_CallFuncND func) { m_towerListener = node; m_towerFunc = func; } void GamePageTitle::setSortByMapNameCB(CCNode *node,SEL_CallFuncND func) { m_nameSortListener = node; m_nameSortFunc = func; } void GamePageTitle::setSortByPlayerNumCB(CCNode *node,SEL_CallFuncND func) { m_numSortListener = node; m_numSortFunc = func; } void GamePageTitle::setTitle(const std::string &title) { m_title = title; } void GamePageTitle::setRefreshImg(const std::string &normal,const std::string &pressed) { m_refreshImg = normal; m_refreshPressedImg = pressed; } void GamePageTitle::layoutCompleted() { BorderWidget::layoutCompleted(); BasButton *df = new BasButton; df->setButtonInfo("",m_theme,"dfmode",CCSizeMake(m_anchorHeight * 0.85,m_anchorHeight * 0.85),""); this->addChild(df); df->setLeft("parent",uilib::Left); df->setVertical("parent",0.5); df->setClickCB(m_dfListener,m_dfFunc); BasButton *tower = new BasButton; tower->setButtonInfo("",m_theme,"towermode",CCSizeMake(m_anchorHeight * 0.85,m_anchorHeight * 0.85),""); this->addChild(tower); tower->setLeft(df->getName(),uilib::Right); tower->setVertical("parent",0.5); tower->setLeftMargin(10); tower->setClickCB(m_towerListener,m_towerFunc); BasButton *nameSort = new BasButton; nameSort->setButtonInfo("",m_theme,"sortmapname",CCSizeMake(m_anchorHeight * 0.85,m_anchorHeight * 0.85),m_refreshPressedImg); this->addChild(nameSort); nameSort->setLeft(tower->getName(),uilib::Right); nameSort->setVertical("parent",0.5); nameSort->setLeftMargin(10); nameSort->setClickCB(m_nameSortListener,m_nameSortFunc); BasButton *numSort = new BasButton; numSort->setButtonInfo("",m_theme,"sortplayernum",CCSizeMake(m_anchorHeight * 0.85,m_anchorHeight * 0.85),m_refreshPressedImg); this->addChild(numSort); numSort->setLeft(nameSort->getName(),uilib::Right); numSort->setVertical("parent",0.5); numSort->setLeftMargin(10); numSort->setClickCB(m_numSortListener,m_numSortFunc); BasButton *refresh = new BasButton; refresh->setButtonInfo("",m_theme,m_refreshImg,CCSizeMake(m_anchorHeight * 0.85,m_anchorHeight * 0.85),m_refreshPressedImg); this->addChild(refresh); refresh->setVertical("parent",0.5); refresh->setLeft(numSort->getName(),uilib::Right); refresh->setLeftMargin(10); refresh->setClickCB(m_refreshListener,m_refreshFunc); CCSprite *r = CCSprite::createWithSpriteFrameName("refresh.png"); BasNodeDelegateWidget *rdele =new BasNodeDelegateWidget(r,CCSizeMake(m_anchorHeight * 0.6,m_anchorHeight * 0.6)); refresh->addChild(rdele); rdele->setCenterIn("parent"); m_refreshWidget = rdele; } void GamePageTitle::setRefreshing(bool on) { m_refreshing = on; startRefresh(); } void GamePageTitle::startRefresh() { if(m_refreshWidget){ if(m_refreshing){ CCActionInterval *to = CCRotateBy::create(1,360); m_refreshWidget->runAction(CCRepeatForever::create(to)); }else{ m_refreshWidget->stopAllActions(); } } }
31.357724
131
0.705989
zhwsh00
f3536343f7075fe5a9ac4fcd8747d2a3779c1d7d
237
cpp
C++
solved/i-k/joana-and-the-odd-numbers/joana.cpp
abuasifkhan/pc-code
77ce51d692acf6edcb9e47aeb7b7f06bf56e4e90
[ "Unlicense" ]
13
2015-09-30T19:18:04.000Z
2021-06-26T21:11:30.000Z
solved/i-k/joana-and-the-odd-numbers/joana.cpp
sbmaruf/pc-code
77ce51d692acf6edcb9e47aeb7b7f06bf56e4e90
[ "Unlicense" ]
null
null
null
solved/i-k/joana-and-the-odd-numbers/joana.cpp
sbmaruf/pc-code
77ce51d692acf6edcb9e47aeb7b7f06bf56e4e90
[ "Unlicense" ]
13
2015-01-04T09:49:54.000Z
2021-06-03T13:18:44.000Z
#include <cstdio> typedef long long i64; i64 n; int main() { while (true) { if (scanf("%lld", &n) != 1) break; i64 l = n + (n - 1) * ((n - 1) / 2 + 1); printf("%lld\n", 3*l - 6); } return 0; }
11.285714
48
0.417722
abuasifkhan
f3557354993496a15b49d64f98e91c0b5f7fb343
1,101
hpp
C++
include/parse/node_expr_field.hpp
BastianBlokland/novus
3b984c36855aa84d6746c14ff7e294ab7d9c1575
[ "MIT" ]
14
2020-04-14T17:00:56.000Z
2021-08-30T08:29:26.000Z
include/parse/node_expr_field.hpp
BastianBlokland/novus
3b984c36855aa84d6746c14ff7e294ab7d9c1575
[ "MIT" ]
27
2020-12-27T16:00:44.000Z
2021-08-01T13:12:14.000Z
include/parse/node_expr_field.hpp
BastianBlokland/novus
3b984c36855aa84d6746c14ff7e294ab7d9c1575
[ "MIT" ]
1
2020-05-29T18:33:37.000Z
2020-05-29T18:33:37.000Z
#pragma once #include "lex/token.hpp" #include "parse/node.hpp" namespace parse { // Field access expression. // Example in source: 'u.name'. class FieldExprNode final : public Node { friend auto fieldExprNode(NodePtr lhs, lex::Token dot, lex::Token id) -> NodePtr; public: FieldExprNode() = delete; auto operator==(const Node& rhs) const noexcept -> bool override; auto operator!=(const Node& rhs) const noexcept -> bool override; [[nodiscard]] auto operator[](unsigned int i) const -> const Node& override; [[nodiscard]] auto getChildCount() const -> unsigned int override; [[nodiscard]] auto getSpan() const -> input::Span override; [[nodiscard]] auto getId() const -> const lex::Token&; auto accept(NodeVisitor* visitor) const -> void override; private: const NodePtr m_lhs; const lex::Token m_dot; const lex::Token m_id; FieldExprNode(NodePtr lhs, lex::Token dot, lex::Token id); auto print(std::ostream& out) const -> std::ostream& override; }; // Factories. auto fieldExprNode(NodePtr lhs, lex::Token dot, lex::Token id) -> NodePtr; } // namespace parse
27.525
83
0.702089
BastianBlokland
f355aacd268c9c69756049031a4bd21db012cf90
38,444
cc
C++
ggadget/gtk/view_widget_binder.cc
suzhe/google-gadgets-for-linux
b58baabd8458c8515c9902b8176151a08d240983
[ "Apache-2.0" ]
175
2015-01-01T12:40:33.000Z
2019-05-24T22:33:59.000Z
ggadget/gtk/view_widget_binder.cc
suzhe/google-gadgets-for-linux
b58baabd8458c8515c9902b8176151a08d240983
[ "Apache-2.0" ]
11
2015-01-19T16:30:56.000Z
2018-04-25T01:06:52.000Z
ggadget/gtk/view_widget_binder.cc
suzhe/google-gadgets-for-linux
b58baabd8458c8515c9902b8176151a08d240983
[ "Apache-2.0" ]
97
2015-01-19T15:35:29.000Z
2019-05-15T05:48:02.000Z
/* Copyright 2008 Google Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ #include <algorithm> #include <string> #include <vector> #include <cairo.h> #include <gdk/gdk.h> #include "view_widget_binder.h" #include <ggadget/common.h> #include <ggadget/logger.h> #include <ggadget/event.h> #include <ggadget/main_loop_interface.h> #include <ggadget/view_interface.h> #include <ggadget/view_host_interface.h> #include <ggadget/string_utils.h> #include <ggadget/small_object.h> #include <ggadget/clip_region.h> #include <ggadget/math_utils.h> #include "cairo_canvas.h" #include "cairo_graphics.h" #include "key_convert.h" #include "utilities.h" // It might not be necessary, because X server will grab the pointer // implicitly when button is pressed. // But using explicit mouse grabbing may avoid some issues by preventing some // events from sending to client window when mouse is grabbed. #define GRAB_POINTER_EXPLICITLY namespace ggadget { namespace gtk { static const char kUriListTarget[] = "text/uri-list"; static const char kPlainTextTarget[] = "text/plain"; // A small motion threshold to prevent a click with tiny mouse move from being // treated as window move or resize. static const double kDragThreshold = 3; #ifdef _DEBUG static const uint64_t kFPSCountDuration = 5000; #endif // Update input shape mask once per second. static const uint64_t kUpdateMaskInterval = 1000; // Minimal interval between self draws. static const unsigned int kSelfDrawInterval = 40; class ViewWidgetBinder::Impl : public SmallObject<> { public: Impl(ViewInterface *view, ViewHostInterface *host, GtkWidget *widget, bool no_background) : view_(view), host_(host), widget_(widget), #if GTK_CHECK_VERSION(2,10,0) input_shape_mask_(NULL), last_mask_time_(0), should_update_input_shape_mask_(false), enable_input_shape_mask_(false), #endif handlers_(new gulong[kEventHandlersNum]), current_drag_event_(NULL), on_zoom_connection_(NULL), dbl_click_(false), composited_(false), no_background_(no_background), focused_(false), button_pressed_(false), #ifdef GRAB_POINTER_EXPLICITLY pointer_grabbed_(false), #endif #ifdef _DEBUG draw_count_(0), last_fps_time_(0), #endif zoom_(1.0), mouse_down_x_(-1), mouse_down_y_(-1), mouse_down_hittest_(ViewInterface::HT_CLIENT), self_draw_(false), self_draw_timer_(0), last_self_draw_time_(0), sys_clip_region_(NULL) { ASSERT(view); ASSERT(host); ASSERT(GTK_IS_WIDGET(widget)); ASSERT(GTK_WIDGET_NO_WINDOW(widget) == FALSE); g_object_ref(G_OBJECT(widget_)); gtk_widget_set_app_paintable(widget_, TRUE); gtk_widget_set_double_buffered(widget_, FALSE); gint events = GDK_EXPOSURE_MASK | GDK_FOCUS_CHANGE_MASK | GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_STRUCTURE_MASK; if (GTK_WIDGET_REALIZED(widget_)) gtk_widget_add_events(widget_, events); else gtk_widget_set_events(widget_, gtk_widget_get_events(widget_) | events); GTK_WIDGET_SET_FLAGS(widget_, GTK_CAN_FOCUS); static const GtkTargetEntry kDragTargets[] = { { const_cast<char *>(kUriListTarget), 0, 0 }, { const_cast<char *>(kPlainTextTarget), 0, 0 }, }; gtk_drag_dest_set(widget_, static_cast<GtkDestDefaults>(0), kDragTargets, arraysize(kDragTargets), GDK_ACTION_COPY); SetupBackgroundMode(); for (size_t i = 0; i < kEventHandlersNum; ++i) { handlers_[i] = g_signal_connect(G_OBJECT(widget_), kEventHandlers[i].event, kEventHandlers[i].handler, this); } CairoGraphics *gfx= down_cast<CairoGraphics *>(view_->GetGraphics()); ASSERT(gfx); zoom_ = gfx->GetZoom(); on_zoom_connection_ = gfx->ConnectOnZoom(NewSlot(this, &Impl::OnZoom)); } ~Impl() { view_ = NULL; if (self_draw_timer_) { g_source_remove(self_draw_timer_); self_draw_timer_ = 0; } if (sys_clip_region_) { gdk_region_destroy(sys_clip_region_); sys_clip_region_ = NULL; } for (size_t i = 0; i < kEventHandlersNum; ++i) { if (handlers_[i] > 0) g_signal_handler_disconnect(G_OBJECT(widget_), handlers_[i]); else DLOG("Handler %s was not connected.", kEventHandlers[i].event); } delete[] handlers_; handlers_ = NULL; if (current_drag_event_) { delete current_drag_event_; current_drag_event_ = NULL; } if (on_zoom_connection_) { on_zoom_connection_->Disconnect(); on_zoom_connection_ = NULL; } g_object_unref(G_OBJECT(widget_)); #if GTK_CHECK_VERSION(2,10,0) if (input_shape_mask_) { g_object_unref(G_OBJECT(input_shape_mask_)); } #endif } void OnZoom(double zoom) { zoom_ = zoom; } // Disable background if required. void SetupBackgroundMode() { // Only try to disable background if explicitly required. if (no_background_) { composited_ = DisableWidgetBackground(widget_); } } GdkRegion *CreateExposeRegionFromViewClipRegion() { GdkRegion *region = gdk_region_new(); const ClipRegion *view_region = view_->GetClipRegion(); size_t count = view_region->GetRectangleCount(); if (count) { Rectangle rect; GdkRectangle gdk_rect; for (size_t i = 0; i < count; ++i) { rect = view_region->GetRectangle(i); if (zoom_ != 1.0) { rect.Zoom(zoom_); rect.Integerize(true); } gdk_rect.x = static_cast<int>(rect.x); gdk_rect.y = static_cast<int>(rect.y); gdk_rect.width = static_cast<int>(rect.w); gdk_rect.height = static_cast<int>(rect.h); gdk_region_union_with_rect(region, &gdk_rect); } } return region; } void AddGdkRectToSystemClipRegion(GdkRectangle *rect) { if (!sys_clip_region_) sys_clip_region_ = gdk_region_new(); gdk_region_union_with_rect(sys_clip_region_, rect); } void AddGdkRegionToSystemClipRegion(GdkRegion *region) { if (!sys_clip_region_) sys_clip_region_ = gdk_region_new(); gdk_region_union(sys_clip_region_, region); } void AddWindowUpdateAreaToSystemClipRegion() { GdkRegion *region = gdk_window_get_update_area(widget_->window); if (region) { if (!sys_clip_region_) { sys_clip_region_ = region; } else { gdk_region_union(sys_clip_region_, region); gdk_region_destroy(region); } } } void AddGdkRectToViewClipRegion(const GdkRectangle &gdk_rect) { Rectangle rect(gdk_rect.x, gdk_rect.y, gdk_rect.width, gdk_rect.height); rect.Zoom(1.0 / zoom_); rect.Integerize(true); view_->AddRectangleToClipRegion(rect); } void AddGdkRegionToViewClipRegion(GdkRegion *region) { if (!gdk_region_empty(region)) { GdkRectangle *rects; gint n_rects; gdk_region_get_rectangles(region, &rects, &n_rects); for (gint i = 0; i < n_rects; ++i) { AddGdkRectToViewClipRegion(rects[i]); } g_free(rects); } } #if GTK_CHECK_VERSION(2,10,0) bool ShouldUpdateInputShapeMask() { gint width, height; gdk_drawable_get_size(widget_->window, &width, &height); bool update_input_shape_mask = enable_input_shape_mask_ && (GetCurrentTime() - last_mask_time_ > kUpdateMaskInterval) && no_background_ && composited_; // We need set input shape mask if there is no background. if (update_input_shape_mask) { if (input_shape_mask_) { gint mask_width, mask_height; gdk_drawable_get_size(GDK_DRAWABLE(input_shape_mask_), &mask_width, &mask_height); if (mask_width != width || mask_height != height) { // input shape mask needs recreate. g_object_unref(G_OBJECT(input_shape_mask_)); input_shape_mask_ = NULL; } } if (input_shape_mask_ == NULL) { GdkRectangle rect; rect.x = 0; rect.y = 0; rect.width = width; rect.height = height; input_shape_mask_ = gdk_pixmap_new(NULL, width, height, 1); // Redraw whole view. AddGdkRectToSystemClipRegion(&rect); } } return update_input_shape_mask; } #endif GdkRegion *GetInvalidateRegion() { view_->Layout(); AddWindowUpdateAreaToSystemClipRegion(); #if GTK_CHECK_VERSION(2,10,0) should_update_input_shape_mask_ = ShouldUpdateInputShapeMask(); #endif GdkRegion *region = CreateExposeRegionFromViewClipRegion(); if (sys_clip_region_) { AddGdkRegionToViewClipRegion(sys_clip_region_); gdk_region_union(region, sys_clip_region_); gdk_region_destroy(sys_clip_region_); sys_clip_region_ = NULL; } return region; } void SelfDraw() { if (!widget_->window || !gdk_window_is_visible(widget_->window)) return; self_draw_ = true; GdkRegion *region = GetInvalidateRegion(); if (!gdk_region_empty(region)) { gdk_window_invalidate_region(widget_->window, region, TRUE); gdk_window_process_updates(widget_->window, TRUE); } gdk_region_destroy(region); last_self_draw_time_ = GetCurrentTime(); self_draw_ = false; } static gboolean ButtonPressHandler(GtkWidget *widget, GdkEventButton *event, gpointer user_data) { Impl *impl = reinterpret_cast<Impl *>(user_data); DLOG("ButtonPressHandler: widget: %p, view: %p, focused: %d, child: %p", widget, impl->view_, impl->focused_, gtk_window_get_focus(GTK_WINDOW(gtk_widget_get_toplevel(widget)))); EventResult result = EVENT_RESULT_UNHANDLED; // Clicking on this widget removes any native child widget focus. if (GTK_IS_WINDOW(widget)) { gtk_window_set_focus(GTK_WINDOW(widget), NULL); } impl->button_pressed_ = true; impl->host_->ShowTooltip(""); if (!impl->focused_) { impl->focused_ = true; SimpleEvent e(Event::EVENT_FOCUS_IN); // Ignore the result. impl->view_->OnOtherEvent(e); if (!gtk_widget_is_focus(widget)) { gtk_widget_grab_focus(widget); gdk_window_focus(impl->widget_->window, event->time); } } int mod = ConvertGdkModifierToModifier(event->state); int button = event->button == 1 ? MouseEvent::BUTTON_LEFT : event->button == 2 ? MouseEvent::BUTTON_MIDDLE : event->button == 3 ? MouseEvent::BUTTON_RIGHT : MouseEvent::BUTTON_NONE; Event::Type type = Event::EVENT_INVALID; if (event->type == GDK_BUTTON_PRESS) { type = Event::EVENT_MOUSE_DOWN; impl->mouse_down_x_ = event->x_root; impl->mouse_down_y_ = event->y_root; } else if (event->type == GDK_2BUTTON_PRESS) { impl->dbl_click_ = true; if (button == MouseEvent::BUTTON_LEFT) type = Event::EVENT_MOUSE_DBLCLICK; else if (button == MouseEvent::BUTTON_RIGHT) type = Event::EVENT_MOUSE_RDBLCLICK; } if (button != MouseEvent::BUTTON_NONE && type != Event::EVENT_INVALID) { MouseEvent e(type, event->x / impl->zoom_, event->y / impl->zoom_, 0, 0, button, mod, event); result = impl->view_->OnMouseEvent(e); impl->mouse_down_hittest_ = impl->view_->GetHitTest(); // If the View's hittest represents a special button, then handle it // here. if (result == EVENT_RESULT_UNHANDLED && button == MouseEvent::BUTTON_LEFT && type == Event::EVENT_MOUSE_DOWN) { if (impl->mouse_down_hittest_ == ViewInterface::HT_MENU) { impl->host_->ShowContextMenu(button); } else if (impl->mouse_down_hittest_ == ViewInterface::HT_CLOSE) { impl->host_->CloseView(); } result = EVENT_RESULT_HANDLED; } } return result != EVENT_RESULT_UNHANDLED; } static gboolean ButtonReleaseHandler(GtkWidget *widget, GdkEventButton *event, gpointer user_data) { GGL_UNUSED(widget); DLOG("ButtonReleaseHandler."); Impl *impl = reinterpret_cast<Impl *>(user_data); EventResult result = EVENT_RESULT_UNHANDLED; EventResult result2 = EVENT_RESULT_UNHANDLED; impl->button_pressed_ = false; impl->host_->ShowTooltip(""); #ifdef GRAB_POINTER_EXPLICITLY if (impl->pointer_grabbed_) { gdk_pointer_ungrab(event->time); impl->pointer_grabbed_ = false; } #endif int mod = ConvertGdkModifierToModifier(event->state); int button = event->button == 1 ? MouseEvent::BUTTON_LEFT : event->button == 2 ? MouseEvent::BUTTON_MIDDLE : event->button == 3 ? MouseEvent::BUTTON_RIGHT : MouseEvent::BUTTON_NONE; if (button != MouseEvent::BUTTON_NONE) { MouseEvent e(Event::EVENT_MOUSE_UP, event->x / impl->zoom_, event->y / impl->zoom_, 0, 0, button, mod, event); result = impl->view_->OnMouseEvent(e); if (!impl->dbl_click_) { MouseEvent e2(button == MouseEvent::BUTTON_LEFT ? Event::EVENT_MOUSE_CLICK : Event::EVENT_MOUSE_RCLICK, event->x / impl->zoom_, event->y / impl->zoom_, 0, 0, button, mod); result2 = impl->view_->OnMouseEvent(e2); } else { impl->dbl_click_ = false; } } impl->mouse_down_x_ = -1; impl->mouse_down_y_ = -1; impl->mouse_down_hittest_ = ViewInterface::HT_CLIENT; return result != EVENT_RESULT_UNHANDLED || result2 != EVENT_RESULT_UNHANDLED; } static gboolean KeyPressHandler(GtkWidget *widget, GdkEventKey *event, gpointer user_data) { GGL_UNUSED(widget); Impl *impl = reinterpret_cast<Impl *>(user_data); EventResult result = EVENT_RESULT_UNHANDLED; EventResult result2 = EVENT_RESULT_UNHANDLED; impl->host_->ShowTooltip(""); int mod = ConvertGdkModifierToModifier(event->state); unsigned int key_code = ConvertGdkKeyvalToKeyCode(event->keyval); if (key_code) { KeyboardEvent e(Event::EVENT_KEY_DOWN, key_code, mod, event); result = impl->view_->OnKeyEvent(e); } else { LOG("Unknown key: 0x%x", event->keyval); } guint32 key_char = 0; if ((event->state & (GDK_CONTROL_MASK | GDK_MOD1_MASK)) == 0) { if (key_code == KeyboardEvent::KEY_ESCAPE || key_code == KeyboardEvent::KEY_RETURN || key_code == KeyboardEvent::KEY_BACK || key_code == KeyboardEvent::KEY_TAB) { // gdk_keyval_to_unicode doesn't support the above keys. key_char = key_code; } else { key_char = gdk_keyval_to_unicode(event->keyval); } } else if ((event->state & GDK_CONTROL_MASK) && key_code >= 'A' && key_code <= 'Z') { // Convert CTRL+(A to Z) to key press code for compatibility. key_char = key_code - 'A' + 1; } if (key_char) { // Send the char code in KEY_PRESS event. KeyboardEvent e2(Event::EVENT_KEY_PRESS, key_char, mod, event); result2 = impl->view_->OnKeyEvent(e2); } return result != EVENT_RESULT_UNHANDLED || result2 != EVENT_RESULT_UNHANDLED; } static gboolean KeyReleaseHandler(GtkWidget *widget, GdkEventKey *event, gpointer user_data) { GGL_UNUSED(widget); Impl *impl = reinterpret_cast<Impl *>(user_data); EventResult result = EVENT_RESULT_UNHANDLED; int mod = ConvertGdkModifierToModifier(event->state); unsigned int key_code = ConvertGdkKeyvalToKeyCode(event->keyval); if (key_code) { KeyboardEvent e(Event::EVENT_KEY_UP, key_code, mod, event); result = impl->view_->OnKeyEvent(e); } else { LOG("Unknown key: 0x%x", event->keyval); } return result != EVENT_RESULT_UNHANDLED; } static gboolean ExposeHandler(GtkWidget *widget, GdkEventExpose *event, gpointer user_data) { Impl *impl = reinterpret_cast<Impl *>(user_data); if (!impl->self_draw_) { impl->AddGdkRegionToSystemClipRegion(event->region); GdkRegion *invalidate_region = impl->GetInvalidateRegion(); // We can't update the region outside event->region, so update them in a // new self draw request. gdk_region_subtract(invalidate_region, event->region); if (!gdk_region_empty(invalidate_region)) { impl->AddGdkRegionToSystemClipRegion(invalidate_region); if (!impl->self_draw_timer_) { impl->self_draw_timer_ = g_idle_add_full(GDK_PRIORITY_REDRAW, Impl::SelfDrawHandler, impl, NULL); } } gdk_region_destroy(invalidate_region); } gdk_window_begin_paint_region(widget->window, event->region); cairo_t *cr = gdk_cairo_create(widget->window); // If background is disabled, and if composited is enabled, the window // needs clearing every times. if (impl->no_background_ && impl->composited_) { cairo_operator_t op = cairo_get_operator(cr); cairo_set_operator(cr, CAIRO_OPERATOR_CLEAR); cairo_paint(cr); cairo_set_operator(cr, op); } // Let View draw on the gdk window directly. // It's ok, because the View has canvas cache internally. CairoCanvas *canvas = new CairoCanvas(cr, impl->zoom_, impl->view_->GetWidth(), impl->view_->GetHeight()); ASSERT(canvas); impl->view_->Draw(canvas); canvas->Destroy(); cairo_destroy(cr); #if GTK_CHECK_VERSION(2,10,0) // We need set input shape mask if there is no background. if (impl->should_update_input_shape_mask_ && impl->input_shape_mask_) { cairo_t *mask_cr = gdk_cairo_create(impl->input_shape_mask_); gdk_cairo_region(mask_cr, event->region); cairo_clip(mask_cr); cairo_set_operator(mask_cr, CAIRO_OPERATOR_CLEAR); cairo_paint(mask_cr); cairo_set_operator(mask_cr, CAIRO_OPERATOR_SOURCE); gdk_cairo_set_source_pixmap(mask_cr, widget->window, 0, 0); cairo_paint(mask_cr); cairo_destroy(mask_cr); gdk_window_input_shape_combine_mask(widget->window, impl->input_shape_mask_, 0, 0); impl->last_mask_time_ = GetCurrentTime(); } #endif // Copy off-screen buffer to screen. gdk_window_end_paint(widget->window); #ifdef _DEBUG ++impl->draw_count_; uint64_t current_time = GetCurrentTime(); uint64_t duration = current_time - impl->last_fps_time_; if (duration >= kFPSCountDuration) { impl->last_fps_time_ = current_time; DLOG("FPS of View %s: %f", impl->view_->GetCaption().c_str(), static_cast<double>(impl->draw_count_ * 1000) / static_cast<double>(duration)); impl->draw_count_ = 0; } #endif return TRUE; } static gboolean MotionNotifyHandler(GtkWidget *widget, GdkEventMotion *event, gpointer user_data) { Impl *impl = reinterpret_cast<Impl *>(user_data); int button = ConvertGdkModifierToButton(event->state); int mod = ConvertGdkModifierToModifier(event->state); MouseEvent e(Event::EVENT_MOUSE_MOVE, event->x / impl->zoom_, event->y / impl->zoom_, 0, 0, button, mod, event); #ifdef GRAB_POINTER_EXPLICITLY if (button != MouseEvent::BUTTON_NONE && !gdk_pointer_is_grabbed() && !impl->pointer_grabbed_) { // Grab the cursor to prevent losing events. if (gdk_pointer_grab(widget->window, FALSE, (GdkEventMask)(GDK_BUTTON_RELEASE_MASK | GDK_BUTTON_MOTION_MASK | GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK), NULL, NULL, event->time) == GDK_GRAB_SUCCESS) { impl->pointer_grabbed_ = true; } } #endif EventResult result = impl->view_->OnMouseEvent(e); if (result == EVENT_RESULT_UNHANDLED && button != MouseEvent::BUTTON_NONE && impl->mouse_down_x_ >= 0 && impl->mouse_down_y_ >= 0 && (std::abs(event->x_root - impl->mouse_down_x_) > kDragThreshold || std::abs(event->y_root - impl->mouse_down_y_) > kDragThreshold || impl->mouse_down_hittest_ != ViewInterface::HT_CLIENT)) { impl->button_pressed_ = false; // Send fake mouse up event to the view so that we can start to drag // the window. Note: no mouse click event is sent in this case, to prevent // unwanted action after window move. MouseEvent e(Event::EVENT_MOUSE_UP, event->x / impl->zoom_, event->y / impl->zoom_, 0, 0, button, mod); // Ignore the result of this fake event. impl->view_->OnMouseEvent(e); ViewInterface::HitTest hittest = impl->mouse_down_hittest_; bool resize_drag = false; // Determine the resize drag edge. if (hittest == ViewInterface::HT_LEFT || hittest == ViewInterface::HT_RIGHT || hittest == ViewInterface::HT_TOP || hittest == ViewInterface::HT_BOTTOM || hittest == ViewInterface::HT_TOPLEFT || hittest == ViewInterface::HT_TOPRIGHT || hittest == ViewInterface::HT_BOTTOMLEFT || hittest == ViewInterface::HT_BOTTOMRIGHT) { resize_drag = true; } #ifdef GRAB_POINTER_EXPLICITLY // ungrab the pointer before starting move/resize drag. if (impl->pointer_grabbed_) { gdk_pointer_ungrab(gtk_get_current_event_time()); impl->pointer_grabbed_ = false; } #endif if (resize_drag) { impl->host_->BeginResizeDrag(button, hittest); } else { impl->host_->BeginMoveDrag(button); } impl->mouse_down_x_ = -1; impl->mouse_down_y_ = -1; impl->mouse_down_hittest_ = ViewInterface::HT_CLIENT; } // Since motion hint is enabled, we must notify GTK that we're ready to // receive the next motion event. #if GTK_CHECK_VERSION(2,12,0) gdk_event_request_motions(event); // requires version 2.12 #else int x, y; gdk_window_get_pointer(widget->window, &x, &y, NULL); #endif return result != EVENT_RESULT_UNHANDLED; } static gboolean ScrollHandler(GtkWidget *widget, GdkEventScroll *event, gpointer user_data) { GGL_UNUSED(widget); Impl *impl = reinterpret_cast<Impl *>(user_data); int delta_x = 0, delta_y = 0; if (event->direction == GDK_SCROLL_UP) { delta_y = MouseEvent::kWheelDelta; } else if (event->direction == GDK_SCROLL_DOWN) { delta_y = -MouseEvent::kWheelDelta; } else if (event->direction == GDK_SCROLL_LEFT) { delta_x = MouseEvent::kWheelDelta; } else if (event->direction == GDK_SCROLL_RIGHT) { delta_x = -MouseEvent::kWheelDelta; } MouseEvent e(Event::EVENT_MOUSE_WHEEL, event->x / impl->zoom_, event->y / impl->zoom_, delta_x, delta_y, ConvertGdkModifierToButton(event->state), ConvertGdkModifierToModifier(event->state)); return impl->view_->OnMouseEvent(e) != EVENT_RESULT_UNHANDLED; } static gboolean LeaveNotifyHandler(GtkWidget *widget, GdkEventCrossing *event, gpointer user_data) { GGL_UNUSED(widget); if (event->mode != GDK_CROSSING_NORMAL || event->detail == GDK_NOTIFY_INFERIOR) return FALSE; Impl *impl = reinterpret_cast<Impl *>(user_data); // Don't send mouse out event if the mouse is grabbed. if (impl->button_pressed_) return FALSE; impl->host_->ShowTooltip(""); MouseEvent e(Event::EVENT_MOUSE_OUT, event->x / impl->zoom_, event->y / impl->zoom_, 0, 0, MouseEvent::BUTTON_NONE, ConvertGdkModifierToModifier(event->state)); return impl->view_->OnMouseEvent(e) != EVENT_RESULT_UNHANDLED; } static gboolean EnterNotifyHandler(GtkWidget *widget, GdkEventCrossing *event, gpointer user_data) { GGL_UNUSED(widget); if (event->mode != GDK_CROSSING_NORMAL || event->detail == GDK_NOTIFY_INFERIOR) return FALSE; Impl *impl = reinterpret_cast<Impl *>(user_data); impl->host_->ShowTooltip(""); MouseEvent e(Event::EVENT_MOUSE_OVER, event->x / impl->zoom_, event->y / impl->zoom_, 0, 0, MouseEvent::BUTTON_NONE, ConvertGdkModifierToModifier(event->state)); return impl->view_->OnMouseEvent(e) != EVENT_RESULT_UNHANDLED; } static gboolean FocusInHandler(GtkWidget *widget, GdkEventFocus *event, gpointer user_data) { GGL_UNUSED(event); Impl *impl = reinterpret_cast<Impl *>(user_data); DLOG("FocusInHandler: widget: %p, view: %p, focused: %d, child: %p", widget, impl->view_, impl->focused_, gtk_window_get_focus(GTK_WINDOW(gtk_widget_get_toplevel(widget)))); if (!impl->focused_) { impl->focused_ = true; SimpleEvent e(Event::EVENT_FOCUS_IN); return impl->view_->OnOtherEvent(e) != EVENT_RESULT_UNHANDLED; } return FALSE; } static gboolean FocusOutHandler(GtkWidget *widget, GdkEventFocus *event, gpointer user_data) { GGL_UNUSED(event); Impl *impl = reinterpret_cast<Impl *>(user_data); DLOG("FocusOutHandler: widget: %p, view: %p, focused: %d, child: %p", widget, impl->view_, impl->focused_, gtk_window_get_focus(GTK_WINDOW(gtk_widget_get_toplevel(widget)))); if (impl->focused_) { impl->focused_ = false; SimpleEvent e(Event::EVENT_FOCUS_OUT); #ifdef GRAB_POINTER_EXPLICITLY // Ungrab the pointer if the focus is lost. if (impl->pointer_grabbed_) { gdk_pointer_ungrab(gtk_get_current_event_time()); impl->pointer_grabbed_ = false; } #endif return impl->view_->OnOtherEvent(e) != EVENT_RESULT_UNHANDLED; } return FALSE; } static gboolean DragMotionHandler(GtkWidget *widget, GdkDragContext *context, gint x, gint y, guint time, gpointer user_data) { return OnDragEvent(widget, context, x, y, time, Event::EVENT_DRAG_MOTION, user_data); } static void DragLeaveHandler(GtkWidget *widget, GdkDragContext *context, guint time, gpointer user_data) { OnDragEvent(widget, context, 0, 0, time, Event::EVENT_DRAG_OUT, user_data); } static gboolean DragDropHandler(GtkWidget *widget, GdkDragContext *context, gint x, gint y, guint time, gpointer user_data) { return OnDragEvent(widget, context, x, y, time, Event::EVENT_DRAG_DROP, user_data); } #ifdef GRAB_POINTER_EXPLICITLY static gboolean GrabBrokenHandler(GtkWidget *widget, GdkEvent *event, gpointer user_data) { GGL_UNUSED(event); GGL_UNUSED(widget); GGL_UNUSED(user_data); Impl *impl = reinterpret_cast<Impl *>(user_data); impl->pointer_grabbed_ = false; return FALSE; } #endif static void DragDataReceivedHandler(GtkWidget *widget, GdkDragContext *context, gint x, gint y, GtkSelectionData *data, guint info, guint time, gpointer user_data) { GGL_UNUSED(widget); GGL_UNUSED(x); GGL_UNUSED(y); GGL_UNUSED(info); Impl *impl = reinterpret_cast<Impl *>(user_data); if (!impl->current_drag_event_) { // There are some cases that multiple drag events are fired in one event // loop. For example, drag_leave and drag_drop. Although current_drag_event // only contains the latter one, there are still multiple // drag_data_received events fired. return; } std::string drag_text; std::vector<std::string> uri_strings; gchar **uris = gtk_selection_data_get_uris(data); if (uris) { // The data is an uri-list. for (gchar **p = uris; *p; ++p) { if (**p) { if (drag_text.length()) drag_text.append("\n"); drag_text.append(*p); uri_strings.push_back(*p); } } g_strfreev(uris); } else { // Otherwise, try to get plain text from data. gchar *text = reinterpret_cast<gchar*>(gtk_selection_data_get_text(data)); if (text && *text) { drag_text.append(text); gchar *prev = text; gchar *p = text; // Treates \n or \r as separator of the url list. while(1) { if (*p == '\n' || *p == '\r' || *p == 0) { if (p > prev) { std::string str = TrimString(std::string(prev, p)); if (str.length()) uri_strings.push_back(str); } prev = p + 1; } if (*p == 0) break; ++p; } } g_free(text); } if (drag_text.length() == 0) { DLOG("No acceptable URI or text in drag data"); gdk_drag_status(context, static_cast<GdkDragAction>(0), time); return; } const char **drag_files = NULL; const char **drag_urls = NULL; if (uri_strings.size()) { drag_files = g_new0(const char *, uri_strings.size() + 1); drag_urls = g_new0(const char *, uri_strings.size() + 1); size_t files_count = 0; size_t urls_count = 0; for (std::vector<std::string>::iterator it = uri_strings.begin(); it != uri_strings.end(); ++it) { if (IsValidFileURL(it->c_str())) { gchar *hostname; gchar *filename = g_filename_from_uri(it->c_str(), &hostname, NULL); if (filename && !hostname) { *it = std::string(filename); drag_files[files_count++] = it->c_str();; } g_free(filename); g_free(hostname); } else if (IsValidURL(it->c_str())) { drag_urls[urls_count++] = it->c_str(); } } } Event::Type type = impl->current_drag_event_->GetType(); impl->current_drag_event_->SetDragFiles(drag_files); impl->current_drag_event_->SetDragUrls(drag_urls); impl->current_drag_event_->SetDragText(drag_text.c_str()); EventResult result = impl->view_->OnDragEvent(*impl->current_drag_event_); if (result == EVENT_RESULT_HANDLED && type == Event::EVENT_DRAG_MOTION) { gdk_drag_status(context, GDK_ACTION_COPY, time); } else { gdk_drag_status(context, static_cast<GdkDragAction>(0), time); } #ifdef _DEBUG const char *type_name = NULL; switch (type) { case Event::EVENT_DRAG_MOTION: type_name = "motion"; break; case Event::EVENT_DRAG_DROP: type_name = "drop"; break; case Event::EVENT_DRAG_OUT: type_name = "out"; break; default: type_name = "unknown"; break; } DLOG("Drag %s event was %s: x:%d, y:%d, time:%d, text:\n%s\n", type_name, (result == EVENT_RESULT_HANDLED ? "handled" : "not handled"), x, y, time, drag_text.c_str()); #endif if (type == Event::EVENT_DRAG_DROP) { DLOG("Drag operation finished."); gtk_drag_finish(context, result == EVENT_RESULT_HANDLED, FALSE, time); } delete impl->current_drag_event_; impl->current_drag_event_ = NULL; g_free(drag_files); g_free(drag_urls); } static void ScreenChangedHandler(GtkWidget *widget, GdkScreen *last_screen, gpointer user_data) { GGL_UNUSED(widget); GGL_UNUSED(last_screen); Impl *impl = reinterpret_cast<Impl *>(user_data); impl->SetupBackgroundMode(); } static void CompositedChangedHandler(GtkWidget *widget, gpointer user_data) { GGL_UNUSED(widget); Impl *impl = reinterpret_cast<Impl *>(user_data); impl->SetupBackgroundMode(); } static gboolean OnDragEvent(GtkWidget *widget, GdkDragContext *context, gint x, gint y, guint time, Event::Type event_type, gpointer user_data) { Impl *impl = reinterpret_cast<Impl *>(user_data); if (impl->current_drag_event_) { // There are some cases that multiple drag events are fired in one event // loop. For example, drag_leave and drag_drop, we use the latter one. delete impl->current_drag_event_; impl->current_drag_event_ = NULL; } impl->current_drag_event_ = new DragEvent(event_type, x, y); GdkAtom target = gtk_drag_dest_find_target( widget, context, gtk_drag_dest_get_target_list(widget)); if (target != GDK_NONE) { gtk_drag_get_data(widget, context, target, time); return TRUE; } DLOG("Drag target or action not acceptable"); gdk_drag_status(context, static_cast<GdkDragAction>(0), time); return FALSE; } static gboolean SelfDrawHandler(gpointer user_data) { Impl *impl = reinterpret_cast<Impl *>(user_data); impl->self_draw_timer_ = 0; impl->SelfDraw(); return FALSE; } ViewInterface *view_; ViewHostInterface *host_; GtkWidget *widget_; #if GTK_CHECK_VERSION(2,10,0) GdkBitmap *input_shape_mask_; uint64_t last_mask_time_; bool should_update_input_shape_mask_; bool enable_input_shape_mask_; #endif gulong *handlers_; DragEvent *current_drag_event_; Connection *on_zoom_connection_; bool dbl_click_; bool composited_; bool no_background_; bool focused_; bool button_pressed_; #ifdef GRAB_POINTER_EXPLICITLY bool pointer_grabbed_; #endif #ifdef _DEBUG int draw_count_; uint64_t last_fps_time_; #endif double zoom_; double mouse_down_x_; double mouse_down_y_; ViewInterface::HitTest mouse_down_hittest_; bool self_draw_; guint self_draw_timer_; uint64_t last_self_draw_time_; GdkRegion *sys_clip_region_; struct EventHandlerInfo { const char *event; void (*handler)(void); }; static EventHandlerInfo kEventHandlers[]; static const size_t kEventHandlersNum; }; ViewWidgetBinder::Impl::EventHandlerInfo ViewWidgetBinder::Impl::kEventHandlers[] = { { "button-press-event", G_CALLBACK(ButtonPressHandler) }, { "button-release-event", G_CALLBACK(ButtonReleaseHandler) }, #if GTK_CHECK_VERSION(2,10,0) { "composited-changed", G_CALLBACK(CompositedChangedHandler) }, #endif { "drag-data-received", G_CALLBACK(DragDataReceivedHandler) }, { "drag-drop", G_CALLBACK(DragDropHandler) }, { "drag-leave", G_CALLBACK(DragLeaveHandler) }, { "drag-motion", G_CALLBACK(DragMotionHandler) }, { "enter-notify-event", G_CALLBACK(EnterNotifyHandler) }, { "expose-event", G_CALLBACK(ExposeHandler) }, { "focus-in-event", G_CALLBACK(FocusInHandler) }, { "focus-out-event", G_CALLBACK(FocusOutHandler) }, { "key-press-event", G_CALLBACK(KeyPressHandler) }, { "key-release-event", G_CALLBACK(KeyReleaseHandler) }, { "leave-notify-event", G_CALLBACK(LeaveNotifyHandler) }, { "motion-notify-event", G_CALLBACK(MotionNotifyHandler) }, { "screen-changed", G_CALLBACK(ScreenChangedHandler) }, { "scroll-event", G_CALLBACK(ScrollHandler) }, #ifdef GRAB_POINTER_EXPLICITLY { "grab-broken-event", G_CALLBACK(GrabBrokenHandler) }, #endif }; const size_t ViewWidgetBinder::Impl::kEventHandlersNum = arraysize(ViewWidgetBinder::Impl::kEventHandlers); ViewWidgetBinder::ViewWidgetBinder(ViewInterface *view, ViewHostInterface *host, GtkWidget *widget, bool no_background) : impl_(new Impl(view, host, widget, no_background)) { } void ViewWidgetBinder::EnableInputShapeMask(bool enable) { #if GTK_CHECK_VERSION(2,10,0) if (impl_->enable_input_shape_mask_ != enable) { impl_->enable_input_shape_mask_ = enable; if (impl_->widget_ && impl_->no_background_ && impl_->composited_ && !enable) { if (impl_->widget_->window) { gdk_window_input_shape_combine_mask(impl_->widget_->window, NULL, 0, 0); } if (impl_->input_shape_mask_) { g_object_unref(G_OBJECT(impl_->input_shape_mask_)); impl_->input_shape_mask_ = NULL; } } gtk_widget_queue_draw(impl_->widget_); } #endif } ViewWidgetBinder::~ViewWidgetBinder() { delete impl_; impl_ = NULL; } void ViewWidgetBinder::QueueDraw() { if (!impl_->self_draw_timer_) { uint64_t current_time = GetCurrentTime(); if (current_time - impl_->last_self_draw_time_ >= kSelfDrawInterval) { impl_->self_draw_timer_ = g_idle_add_full(GDK_PRIORITY_REDRAW, Impl::SelfDrawHandler, impl_, NULL); } else { impl_->self_draw_timer_ = g_timeout_add(kSelfDrawInterval - (current_time - impl_->last_self_draw_time_), Impl::SelfDrawHandler, impl_); } } } void ViewWidgetBinder::DrawImmediately() { // Remove pending queue draw, as we don't need it anymore. if (impl_->self_draw_timer_) { g_source_remove(impl_->self_draw_timer_); impl_->self_draw_timer_ = 0; } impl_->SelfDraw(); } bool ViewWidgetBinder::DrawQueued() { return impl_->self_draw_timer_ != 0; } } // namespace gtk } // namespace ggadget
34.29438
81
0.638487
suzhe
f3585d17b16b4fa691d45b18daa513dc336ff2a9
759
cpp
C++
libs/gzstream/gzutil.cpp
hoehleatsu/besiq
94959e2819251805e19311ce377919e6bccb7bf9
[ "BSD-3-Clause" ]
1
2015-10-21T14:22:12.000Z
2015-10-21T14:22:12.000Z
libs/gzstream/gzutil.cpp
hoehleatsu/besiq
94959e2819251805e19311ce377919e6bccb7bf9
[ "BSD-3-Clause" ]
2
2019-05-26T20:52:31.000Z
2019-05-28T16:19:49.000Z
libs/gzstream/gzutil.cpp
hoehleatsu/besiq
94959e2819251805e19311ce377919e6bccb7bf9
[ "BSD-3-Clause" ]
2
2016-11-06T14:58:37.000Z
2019-05-26T14:03:13.000Z
#include <gzstream/gzutil.hpp> bool ends_with(const std::string &str, const std::string &end) { return str.rfind( end ) == ( str.size( ) - end.size( ) ); } shared_ptr<std::istream> open_possible_gz(const std::string &path) { if( ends_with( path, ".gz" ) ) { return shared_ptr<std::istream>( new gz::igzstream( path.c_str( ) ) ); } else { return shared_ptr<std::istream>( new std::ifstream( path.c_str( ) ) ); } } shared_ptr<std::ostream> create_possible_gz(const std::string &path) { if( ends_with( path, ".gz" ) ) { return shared_ptr<std::ostream>( new gz::ogzstream( path.c_str( ) ) ); } else { return shared_ptr<std::ostream>( new std::ofstream( path.c_str( ) ) ); } }
22.323529
78
0.592885
hoehleatsu
f35b7afb3e08dbcdd441df54c05ea755cff81ee5
25,166
cpp
C++
tests/AsyncAgencyComm/AsyncAgencyCommTest.cpp
trooso/arangodb
3a3eb78dcab73cdc7aa6bb9cfdf4c7b20bc2857c
[ "Apache-2.0" ]
1
2022-03-25T19:26:09.000Z
2022-03-25T19:26:09.000Z
tests/AsyncAgencyComm/AsyncAgencyCommTest.cpp
solisoft/arangodb
ebb11f901fdcac72ca298f7f329427c7ec51b157
[ "Apache-2.0" ]
null
null
null
tests/AsyncAgencyComm/AsyncAgencyCommTest.cpp
solisoft/arangodb
ebb11f901fdcac72ca298f7f329427c7ec51b157
[ "Apache-2.0" ]
null
null
null
//////////////////////////////////////////////////////////////////////////////// /// DISCLAIMER /// /// Copyright 2014-2020 ArangoDB GmbH, Cologne, Germany /// Copyright 2004-2014 triAGENS GmbH, Cologne, Germany /// /// Licensed under the Apache License, Version 2.0 (the "License"); /// you may not use this file except in compliance with the License. /// You may obtain a copy of the License at /// /// http://www.apache.org/licenses/LICENSE-2.0 /// /// Unless required by applicable law or agreed to in writing, software /// distributed under the License is distributed on an "AS IS" BASIS, /// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. /// See the License for the specific language governing permissions and /// limitations under the License. /// /// Copyright holder is ArangoDB GmbH, Cologne, Germany /// /// @author Lars Maier //////////////////////////////////////////////////////////////////////////////// #include "gtest/gtest.h" #include <fuerte/connection.h> #include <fuerte/requests.h> #include <velocypack/Buffer.h> #include <velocypack/Builder.h> #include <velocypack/Compare.h> #include <velocypack/Iterator.h> #include <velocypack/Options.h> #include <velocypack/Parser.h> #include <velocypack/velocypack-aliases.h> #include <utility> #include "Mocks/LogLevels.h" #include "Mocks/Servers.h" #include "Agency/AgencyPaths.h" #include "ApplicationFeatures/GreetingsFeaturePhase.h" #include "Cluster/ClusterFeature.h" #include "Network/ConnectionPool.h" #include "Network/Methods.h" #include "Network/NetworkFeature.h" #include "Scheduler/Scheduler.h" #include "Scheduler/SchedulerFeature.h" #include "Agency/AsyncAgencyComm.h" using namespace arangodb; using namespace std::chrono_literals; using VPackBufferPtr = std::shared_ptr<velocypack::Buffer<uint8_t>>; VPackBuffer<uint8_t> vpackFromJsonString(char const* c) { VPackOptions options; options.checkAttributeUniqueness = true; VPackParser parser(&options); parser.parse(c); std::shared_ptr<VPackBuilder> builder = parser.steal(); std::shared_ptr<VPackBuffer<uint8_t>> buffer = builder->steal(); VPackBuffer<uint8_t> b = std::move(*buffer); return b; } VPackBuffer<uint8_t> operator"" _vpack(const char* json, size_t) { return vpackFromJsonString(json); } bool operator==(VPackSlice a, VPackSlice b) { return arangodb::velocypack::NormalizedCompare::equals(a, b); } struct AsyncAgencyCommPoolMock final : public network::ConnectionPool { struct RequestPrototype { std::string endpoint; fuerte::RestVerb method; std::string url; VPackBuffer<uint8_t> body; fuerte::Error error; std::unique_ptr<fuerte::Response> response; void returnResponse(fuerte::StatusCode statusCode, VPackBuffer<uint8_t>&& body) { fuerte::ResponseHeader header; header.contentType(fuerte::ContentType::VPack); header.responseCode = statusCode; response = std::make_unique<fuerte::Response>(std::move(header)); response->setPayload(std::move(body), 0); } void returnError(fuerte::Error err) { error = err; response = nullptr; } void returnRedirect(std::string const& redirectTo) { fuerte::ResponseHeader header; header.contentType(fuerte::ContentType::VPack); header.responseCode = fuerte::StatusTemporaryRedirect; header.addMeta(arangodb::StaticStrings::Location, redirectTo); response = std::make_unique<fuerte::Response>(std::move(header)); response->setPayload(VPackBuffer<uint8_t>(), 0); } }; struct Connection final : public fuerte::Connection { Connection(AsyncAgencyCommPoolMock* mock, std::string endpoint) : fuerte::Connection(fuerte::detail::ConnectionConfiguration()), _mock(mock), _endpoint(std::move(endpoint)) {} std::size_t requestsLeft() const override { return 1; } State state() const override { return fuerte::Connection::State::Connected; } void cancel() override {} AsyncAgencyCommPoolMock* _mock; std::string _endpoint; void validateRequest(std::unique_ptr<fuerte::Request> const& req) { // check request ASSERT_GT(_mock->_requests.size(), 0); auto& expectReq = _mock->_requests.front(); ASSERT_EQ(expectReq.endpoint, _endpoint); ASSERT_EQ(expectReq.method, req->header.restVerb); ASSERT_EQ(expectReq.url, req->header.path); // LOG_DEVEL << VPackSlice(expectReq.body.data()).toJson() << " " << req->slice().toJson(); ASSERT_EQ(VPackSlice(expectReq.body.data()).toJson(), req->slice().toJson()); } void sendRequest(std::unique_ptr<fuerte::Request> req, fuerte::RequestCallback cb) override { validateRequest(req); // send response if (!_mock->_requests.empty()) { auto& expectReq = _mock->_requests.front(); cb(expectReq.error, std::move(req), std::move(expectReq.response)); _mock->_requests.pop_front(); } else { cb(fuerte::Error::ConnectionCanceled, std::move(req), nullptr); } } }; explicit AsyncAgencyCommPoolMock(network::ConnectionPool::Config const& c) : network::ConnectionPool(c) {} ~AsyncAgencyCommPoolMock() override { TRI_ASSERT(_requests.empty()); } std::shared_ptr<fuerte::Connection> createConnection(fuerte::ConnectionBuilder& cb) override { return std::make_shared<Connection>(this, cb.normalizedEndpoint()); } RequestPrototype& expectRequest(std::string const& endpoint, fuerte::RestVerb method, std::string const& url, VPackBuffer<uint8_t>&& body) { _requests.emplace_back(RequestPrototype{endpoint, method, url, std::move(body), fuerte::Error::NoError, nullptr}); return _requests.back(); } std::deque<RequestPrototype> _requests; }; struct AsyncAgencyCommTest : public ::testing::Test, public arangodb::tests::LogSuppressor<arangodb::Logger::THREADS, arangodb::LogLevel::FATAL> { AsyncAgencyCommTest() : server(false) { server.addFeature<SchedulerFeature>(true); server.startFeatures(); } network::ConnectionPool::Config config() { network::ConnectionPool::Config config(server.getFeature<metrics::MetricsFeature>()); config.clusterInfo = &server.getFeature<ClusterFeature>().clusterInfo(); config.numIOThreads = 1; config.maxOpenConnections = 3; config.verifyHosts = false; config.name = "AsyncAgencyCommTest"; return config; } protected: tests::mocks::MockCoordinator server; }; static void compareEndpoints(std::deque<std::string> const& first, std::deque<std::string> const& second) { ASSERT_EQ(first, second); } TEST_F(AsyncAgencyCommTest, send_with_failover) { AsyncAgencyCommPoolMock pool(config()); pool.expectRequest("http+tcp://10.0.0.1:8529", fuerte::RestVerb::Post, "/_api/agency/read", R"=([["a"]])="_vpack) .returnResponse(200, R"=([{"a":12}])="_vpack); AsyncAgencyCommManager manager(server.server()); manager.pool(&pool); manager.updateEndpoints({ "http+tcp://10.0.0.1:8529", "http+tcp://10.0.0.2:8529", "http+tcp://10.0.0.3:8529", }); auto result = AsyncAgencyComm(manager).sendReadTransaction(10s, R"=([["a"]])="_vpack).get(); ASSERT_EQ(result.error, fuerte::Error::NoError); ASSERT_EQ(result.slice().at(0).get("a").getNumber<int>(), 12); compareEndpoints(manager.endpoints(), {"http+tcp://10.0.0.1:8529", "http+tcp://10.0.0.2:8529", "http+tcp://10.0.0.3:8529"}); } TEST_F(AsyncAgencyCommTest, send_with_failover_failover) { AsyncAgencyCommPoolMock pool(config()); pool.expectRequest("http+tcp://10.0.0.1:8529", fuerte::RestVerb::Post, "/_api/agency/read", R"=([["a"]])="_vpack) .returnError(fuerte::Error::CouldNotConnect); pool.expectRequest("http+tcp://10.0.0.2:8529", fuerte::RestVerb::Post, "/_api/agency/read", R"=([["a"]])="_vpack) .returnResponse(200, R"=([{"a":12}])="_vpack); AsyncAgencyCommManager manager(server.server()); manager.pool(&pool); manager.updateEndpoints({ "http+tcp://10.0.0.1:8529", "http+tcp://10.0.0.2:8529", "http+tcp://10.0.0.3:8529", }); auto result = AsyncAgencyComm(manager).sendReadTransaction(10s, R"=([["a"]])="_vpack).get(); ASSERT_EQ(result.error, fuerte::Error::NoError); ASSERT_EQ(result.slice().at(0).get("a").getNumber<int>(), 12); compareEndpoints(manager.endpoints(), {"http+tcp://10.0.0.2:8529", "http+tcp://10.0.0.3:8529", "http+tcp://10.0.0.1:8529"}); } TEST_F(AsyncAgencyCommTest, send_with_failover_timeout_redirect) { AsyncAgencyCommPoolMock pool(config()); pool.expectRequest("http+tcp://10.0.0.1:8529", fuerte::RestVerb::Post, "/_api/agency/read", R"=([["a"]])="_vpack) .returnError(fuerte::Error::CouldNotConnect); pool.expectRequest("http+tcp://10.0.0.2:8529", fuerte::RestVerb::Post, "/_api/agency/read", R"=([["a"]])="_vpack) .returnRedirect("http://10.0.0.3:8529/_api/agency/read"); pool.expectRequest("http+tcp://10.0.0.3:8529", fuerte::RestVerb::Post, "/_api/agency/read", R"=([["a"]])="_vpack) .returnResponse(200, R"=([{"a":12}])="_vpack); AsyncAgencyCommManager manager(server.server()); manager.pool(&pool); manager.updateEndpoints({ "http+tcp://10.0.0.1:8529", "http+tcp://10.0.0.2:8529", "http+tcp://10.0.0.3:8529", }); auto result = AsyncAgencyComm(manager).sendReadTransaction(10s, R"=([["a"]])="_vpack).get(); ASSERT_EQ(result.error, fuerte::Error::NoError); ASSERT_EQ(result.slice().at(0).get("a").getNumber<int>(), 12); compareEndpoints(manager.endpoints(), {"http+tcp://10.0.0.3:8529", "http+tcp://10.0.0.1:8529", "http+tcp://10.0.0.2:8529"}); } TEST_F(AsyncAgencyCommTest, send_with_failover_redirect) { AsyncAgencyCommPoolMock pool(config()); pool.expectRequest("http+tcp://10.0.0.1:8529", fuerte::RestVerb::Post, "/_api/agency/read", R"=([["a"]])="_vpack) .returnRedirect("http://10.0.0.3:8529/_api/agency/read"); pool.expectRequest("http+tcp://10.0.0.3:8529", fuerte::RestVerb::Post, "/_api/agency/read", R"=([["a"]])="_vpack) .returnResponse(200, R"=([{"a":12}])="_vpack); AsyncAgencyCommManager manager(server.server()); manager.pool(&pool); manager.updateEndpoints({ "http+tcp://10.0.0.1:8529", "http+tcp://10.0.0.2:8529", "http+tcp://10.0.0.3:8529", }); auto result = AsyncAgencyComm(manager).sendReadTransaction(10s, R"=([["a"]])="_vpack).get(); ASSERT_EQ(result.error, fuerte::Error::NoError); ASSERT_EQ(result.slice().at(0).get("a").getNumber<int>(), 12); compareEndpoints(manager.endpoints(), {"http+tcp://10.0.0.3:8529", "http+tcp://10.0.0.2:8529", "http+tcp://10.0.0.1:8529"}); } TEST_F(AsyncAgencyCommTest, send_with_failover_redirect_new_endpoint) { AsyncAgencyCommPoolMock pool(config()); pool.expectRequest("http+tcp://10.0.0.1:8529", fuerte::RestVerb::Post, "/_api/agency/read", R"=([["a"]])="_vpack) .returnRedirect("http://10.0.0.4:8529/_api/agency/read"); pool.expectRequest("http+tcp://10.0.0.4:8529", fuerte::RestVerb::Post, "/_api/agency/read", R"=([["a"]])="_vpack) .returnResponse(200, R"=([{"a":12}])="_vpack); AsyncAgencyCommManager manager(server.server()); manager.pool(&pool); manager.updateEndpoints({ "http+tcp://10.0.0.1:8529", "http+tcp://10.0.0.2:8529", "http+tcp://10.0.0.3:8529", }); auto result = AsyncAgencyComm(manager).sendReadTransaction(10s, R"=([["a"]])="_vpack).get(); ASSERT_EQ(result.error, fuerte::Error::NoError); ASSERT_EQ(result.slice().at(0).get("a").getNumber<int>(), 12); compareEndpoints(manager.endpoints(), {"http+tcp://10.0.0.4:8529", "http+tcp://10.0.0.2:8529", "http+tcp://10.0.0.3:8529", "http+tcp://10.0.0.1:8529"}); } TEST_F(AsyncAgencyCommTest, send_with_failover_not_found) { AsyncAgencyCommPoolMock pool(config()); pool.expectRequest("http+tcp://10.0.0.1:8529", fuerte::RestVerb::Post, "/_api/agency/read", R"=([["a"]])="_vpack) .returnResponse(fuerte::StatusNotFound, R"=({"error": 412})="_vpack); AsyncAgencyCommManager manager(server.server()); manager.pool(&pool); manager.updateEndpoints({ "http+tcp://10.0.0.1:8529", "http+tcp://10.0.0.2:8529", "http+tcp://10.0.0.3:8529", }); auto result = AsyncAgencyComm(manager).sendReadTransaction(10s, R"=([["a"]])="_vpack).get(); ASSERT_EQ(result.error, fuerte::Error::NoError); ASSERT_EQ(result.statusCode(), fuerte::StatusNotFound); compareEndpoints(manager.endpoints(), {"http+tcp://10.0.0.1:8529", "http+tcp://10.0.0.2:8529", "http+tcp://10.0.0.3:8529"}); } TEST_F(AsyncAgencyCommTest, send_with_failover_prec_failed) { AsyncAgencyCommPoolMock pool(config()); pool.expectRequest("http+tcp://10.0.0.1:8529", fuerte::RestVerb::Post, "/_api/agency/read", R"=([["a"]])="_vpack) .returnResponse(fuerte::StatusPreconditionFailed, R"=({"error": 412})="_vpack); AsyncAgencyCommManager manager(server.server()); manager.pool(&pool); manager.updateEndpoints({ "http+tcp://10.0.0.1:8529", "http+tcp://10.0.0.2:8529", "http+tcp://10.0.0.3:8529", }); auto result = AsyncAgencyComm(manager).sendReadTransaction(10s, R"=([["a"]])="_vpack).get(); ASSERT_EQ(result.error, fuerte::Error::NoError); ASSERT_EQ(result.statusCode(), fuerte::StatusPreconditionFailed); compareEndpoints(manager.endpoints(), {"http+tcp://10.0.0.1:8529", "http+tcp://10.0.0.2:8529", "http+tcp://10.0.0.3:8529"}); } TEST_F(AsyncAgencyCommTest, send_with_failover_inquire_timeout_not_found) { AsyncAgencyCommPoolMock pool(config()); pool.expectRequest("http+tcp://10.0.0.1:8529", fuerte::RestVerb::Post, "/_api/agency/write", R"=([[{"a":12}, {}, "cid-1"]])="_vpack) .returnError(fuerte::Error::RequestTimeout); pool.expectRequest("http+tcp://10.0.0.2:8529", fuerte::RestVerb::Post, "/_api/agency/inquire", R"=(["cid-1"])="_vpack) .returnResponse(fuerte::StatusNotFound, R"=({"error": 404, "results": [0]})="_vpack); pool.expectRequest("http+tcp://10.0.0.2:8529", fuerte::RestVerb::Post, "/_api/agency/write", R"=([[{"a":12}, {}, "cid-1"]])="_vpack) .returnResponse(fuerte::StatusOK, R"=({"results": [15]})="_vpack); AsyncAgencyCommManager manager(server.server()); manager.pool(&pool); manager.updateEndpoints({ "http+tcp://10.0.0.1:8529", "http+tcp://10.0.0.2:8529", "http+tcp://10.0.0.3:8529", }); auto result = AsyncAgencyComm(manager) .sendWriteTransaction(10s, R"=([[{"a":12}, {}, "cid-1"]])="_vpack) .get(); ASSERT_EQ(result.error, fuerte::Error::NoError); ASSERT_EQ(result.statusCode(), fuerte::StatusOK); ASSERT_EQ(result.slice().get("results").at(0).getNumber<int>(), 15); compareEndpoints(manager.endpoints(), {"http+tcp://10.0.0.2:8529", "http+tcp://10.0.0.3:8529", "http+tcp://10.0.0.1:8529"}); } TEST_F(AsyncAgencyCommTest, send_with_failover_inquire_timeout_redirect_not_found) { AsyncAgencyCommPoolMock pool(config()); pool.expectRequest("http+tcp://10.0.0.1:8529", fuerte::RestVerb::Post, "/_api/agency/write", R"=([[{"a":12}, {}, "cid-1"]])="_vpack) .returnError(fuerte::Error::RequestTimeout); pool.expectRequest("http+tcp://10.0.0.2:8529", fuerte::RestVerb::Post, "/_api/agency/inquire", R"=(["cid-1"])="_vpack) .returnRedirect("http://10.0.0.3:8529/_api/agency/inquire"); pool.expectRequest("http+tcp://10.0.0.3:8529", fuerte::RestVerb::Post, "/_api/agency/inquire", R"=(["cid-1"])="_vpack) .returnResponse(fuerte::StatusNotFound, R"=({"error": 404, "results": [0]})="_vpack); pool.expectRequest("http+tcp://10.0.0.3:8529", fuerte::RestVerb::Post, "/_api/agency/write", R"=([[{"a":12}, {}, "cid-1"]])="_vpack) .returnResponse(fuerte::StatusOK, R"=({"results": [15]})="_vpack); AsyncAgencyCommManager manager(server.server()); manager.pool(&pool); manager.updateEndpoints({ "http+tcp://10.0.0.1:8529", "http+tcp://10.0.0.2:8529", "http+tcp://10.0.0.3:8529", }); auto result = AsyncAgencyComm(manager) .sendWriteTransaction(10s, R"=([[{"a":12}, {}, "cid-1"]])="_vpack) .get(); ASSERT_EQ(result.error, fuerte::Error::NoError); ASSERT_EQ(result.statusCode(), fuerte::StatusOK); ASSERT_EQ(result.slice().get("results").at(0).getNumber<int>(), 15); compareEndpoints(manager.endpoints(), {"http+tcp://10.0.0.3:8529", "http+tcp://10.0.0.1:8529", "http+tcp://10.0.0.2:8529"}); } TEST_F(AsyncAgencyCommTest, send_with_failover_inquire_timeout_found) { AsyncAgencyCommPoolMock pool(config()); pool.expectRequest("http+tcp://10.0.0.1:8529", fuerte::RestVerb::Post, "/_api/agency/write", R"=([[{"a":12}, {}, "cid-1"]])="_vpack) .returnError(fuerte::Error::RequestTimeout); pool.expectRequest("http+tcp://10.0.0.2:8529", fuerte::RestVerb::Post, "/_api/agency/inquire", R"=(["cid-1"])="_vpack) .returnResponse(fuerte::StatusOK, R"=({"error": 200, "results": [32]})="_vpack); AsyncAgencyCommManager manager(server.server()); manager.pool(&pool); manager.updateEndpoints({ "http+tcp://10.0.0.1:8529", "http+tcp://10.0.0.2:8529", "http+tcp://10.0.0.3:8529", }); auto result = AsyncAgencyComm(manager) .sendWriteTransaction(10s, R"=([[{"a":12}, {}, "cid-1"]])="_vpack) .get(); ASSERT_EQ(result.error, fuerte::Error::NoError); ASSERT_EQ(result.statusCode(), fuerte::StatusOK); ASSERT_EQ(result.slice().get("results").at(0).getNumber<int>(), 32); compareEndpoints(manager.endpoints(), {"http+tcp://10.0.0.2:8529", "http+tcp://10.0.0.3:8529", "http+tcp://10.0.0.1:8529"}); } TEST_F(AsyncAgencyCommTest, send_with_failover_inquire_timeout_timeout_not_found) { AsyncAgencyCommPoolMock pool(config()); pool.expectRequest("http+tcp://10.0.0.1:8529", fuerte::RestVerb::Post, "/_api/agency/write", R"=([[{"a":12}, {}, "cid-1"]])="_vpack) .returnError(fuerte::Error::RequestTimeout); pool.expectRequest("http+tcp://10.0.0.2:8529", fuerte::RestVerb::Post, "/_api/agency/inquire", R"=(["cid-1"])="_vpack) .returnError(fuerte::Error::RequestTimeout); pool.expectRequest("http+tcp://10.0.0.3:8529", fuerte::RestVerb::Post, "/_api/agency/inquire", R"=(["cid-1"])="_vpack) .returnResponse(fuerte::StatusNotFound, R"=({"error": 404, "results": [0]})="_vpack); pool.expectRequest("http+tcp://10.0.0.3:8529", fuerte::RestVerb::Post, "/_api/agency/write", R"=([[{"a":12}, {}, "cid-1"]])="_vpack) .returnResponse(fuerte::StatusOK, R"=({"results": [15]})="_vpack); AsyncAgencyCommManager manager(server.server()); manager.pool(&pool); manager.updateEndpoints({ "http+tcp://10.0.0.1:8529", "http+tcp://10.0.0.2:8529", "http+tcp://10.0.0.3:8529", }); auto result = AsyncAgencyComm(manager) .sendWriteTransaction(10s, R"=([[{"a":12}, {}, "cid-1"]])="_vpack) .get(); ASSERT_EQ(result.error, fuerte::Error::NoError); ASSERT_EQ(result.statusCode(), fuerte::StatusOK); ASSERT_EQ(result.slice().get("results").at(0).getNumber<int>(), 15); compareEndpoints(manager.endpoints(), {"http+tcp://10.0.0.3:8529", "http+tcp://10.0.0.1:8529", "http+tcp://10.0.0.2:8529"}); } TEST_F(AsyncAgencyCommTest, send_with_failover_inquire_service_unavailable) { AsyncAgencyCommPoolMock pool(config()); pool.expectRequest("http+tcp://10.0.0.1:8529", fuerte::RestVerb::Post, "/_api/agency/write", R"=([[{"a":12}, {}, "cid-1"]])="_vpack) .returnError(fuerte::Error::RequestTimeout); pool.expectRequest("http+tcp://10.0.0.2:8529", fuerte::RestVerb::Post, "/_api/agency/inquire", R"=(["cid-1"])="_vpack) .returnResponse(fuerte::StatusServiceUnavailable, R"=({"error": 503})="_vpack); pool.expectRequest("http+tcp://10.0.0.3:8529", fuerte::RestVerb::Post, "/_api/agency/inquire", R"=(["cid-1"])="_vpack) .returnResponse(fuerte::StatusNotFound, R"=({"error": 404, "results": [0]})="_vpack); pool.expectRequest("http+tcp://10.0.0.3:8529", fuerte::RestVerb::Post, "/_api/agency/write", R"=([[{"a":12}, {}, "cid-1"]])="_vpack) .returnResponse(fuerte::StatusOK, R"=({"results": [15]})="_vpack); AsyncAgencyCommManager manager(server.server()); manager.pool(&pool); manager.updateEndpoints({ "http+tcp://10.0.0.1:8529", "http+tcp://10.0.0.2:8529", "http+tcp://10.0.0.3:8529", }); auto result = AsyncAgencyComm(manager) .sendWriteTransaction(10s, R"=([[{"a":12}, {}, "cid-1"]])="_vpack) .get(); ASSERT_EQ(result.error, fuerte::Error::NoError); ASSERT_EQ(result.statusCode(), fuerte::StatusOK); ASSERT_EQ(result.slice().get("results").at(0).getNumber<int>(), 15); compareEndpoints(manager.endpoints(), {"http+tcp://10.0.0.3:8529", "http+tcp://10.0.0.1:8529", "http+tcp://10.0.0.2:8529"}); } TEST_F(AsyncAgencyCommTest, send_with_failover_read_only_timeout_not_found) { AsyncAgencyCommPoolMock pool(config()); pool.expectRequest("http+tcp://10.0.0.1:8529", fuerte::RestVerb::Post, "/_api/agency/read", R"=([["a"]])="_vpack) .returnError(fuerte::Error::RequestTimeout); pool.expectRequest("http+tcp://10.0.0.2:8529", fuerte::RestVerb::Post, "/_api/agency/read", R"=([["a"]])="_vpack) .returnError(fuerte::Error::RequestTimeout); pool.expectRequest("http+tcp://10.0.0.3:8529", fuerte::RestVerb::Post, "/_api/agency/read", R"=([["a"]])="_vpack) .returnResponse(fuerte::StatusNotFound, R"=({"error": 404, "results": [0]})="_vpack); AsyncAgencyCommManager manager(server.server()); manager.pool(&pool); manager.updateEndpoints({ "http+tcp://10.0.0.1:8529", "http+tcp://10.0.0.2:8529", "http+tcp://10.0.0.3:8529", }); auto result = AsyncAgencyComm(manager).sendReadTransaction(10s, R"=([["a"]])="_vpack).get(); ASSERT_EQ(result.error, fuerte::Error::NoError); ASSERT_EQ(result.statusCode(), fuerte::StatusNotFound); compareEndpoints(manager.endpoints(), {"http+tcp://10.0.0.3:8529", "http+tcp://10.0.0.1:8529", "http+tcp://10.0.0.2:8529"}); } TEST_F(AsyncAgencyCommTest, send_with_failover_write_no_cids_timeout) { AsyncAgencyCommPoolMock pool(config()); pool.expectRequest("http+tcp://10.0.0.1:8529", fuerte::RestVerb::Post, "/_api/agency/write", R"=([[{"a":12}, {}]])="_vpack) .returnError(fuerte::Error::RequestTimeout); AsyncAgencyCommManager manager(server.server()); manager.pool(&pool); manager.updateEndpoints({ "http+tcp://10.0.0.1:8529", "http+tcp://10.0.0.2:8529", "http+tcp://10.0.0.3:8529", }); auto result = AsyncAgencyComm(manager) .sendWriteTransaction(10s, R"=([[{"a":12}, {}]])="_vpack) .get(); ASSERT_EQ(result.error, fuerte::Error::RequestTimeout); compareEndpoints(manager.endpoints(), {"http+tcp://10.0.0.2:8529", "http+tcp://10.0.0.3:8529", "http+tcp://10.0.0.1:8529"}); } TEST_F(AsyncAgencyCommTest, get_values) { AsyncAgencyCommPoolMock pool(config()); pool.expectRequest("http+tcp://10.0.0.1:8529", fuerte::RestVerb::Post, "/_api/agency/read", R"=([["/arango/Plan"]])="_vpack) .returnResponse(fuerte::StatusOK, R"=([{"arango":{"Plan": 12}}])="_vpack); AsyncAgencyCommManager manager(server.server()); manager.pool(&pool); manager.updateEndpoints({ "http+tcp://10.0.0.1:8529", "http+tcp://10.0.0.2:8529", "http+tcp://10.0.0.3:8529", }); auto result = AsyncAgencyComm(manager) .getValues(arangodb::cluster::paths::root()->arango()->plan()) .get(); ASSERT_EQ(result.error, fuerte::Error::NoError); ASSERT_EQ(result.statusCode(), fuerte::StatusOK); ASSERT_EQ(result.value().getNumber<int>(), 12); compareEndpoints(manager.endpoints(), {"http+tcp://10.0.0.1:8529", "http+tcp://10.0.0.2:8529", "http+tcp://10.0.0.3:8529"}); }
40.009539
99
0.619129
trooso
f3615d6aa36a30eb2f2a7accce0658d248cd1bd7
26,868
cpp
C++
ThirdParty/bullet-2.82-r2704/Extras/Serialize/BulletXmlWorldImporter/btBulletXmlWorldImporter.cpp
vif/3D-STG
721402e76a9b9b99b88ba3eb06beb6abb17a9254
[ "MIT" ]
75
2016-12-22T14:53:01.000Z
2022-03-31T08:04:19.000Z
Extras/Serialize/BulletXmlWorldImporter/btBulletXmlWorldImporter.cpp
biojppm/bullet3
aff3fe089fb3f5fe5c4b07de7de99bbccb531443
[ "Zlib" ]
6
2017-04-03T21:27:16.000Z
2019-08-28T17:05:23.000Z
Extras/Serialize/BulletXmlWorldImporter/btBulletXmlWorldImporter.cpp
biojppm/bullet3
aff3fe089fb3f5fe5c4b07de7de99bbccb531443
[ "Zlib" ]
53
2017-03-16T16:38:34.000Z
2022-02-25T14:31:01.000Z
/* Bullet Continuous Collision Detection and Physics Library Copyright (c) 2003-2012 Erwin Coumans http://bulletphysics.org 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. */ #include "btBulletXmlWorldImporter.h" #include "tinyxml.h" #include "btBulletDynamicsCommon.h" #include "string_split.h" btBulletXmlWorldImporter::btBulletXmlWorldImporter(btDynamicsWorld* world) :btWorldImporter(world), m_fileVersion(-1), m_fileOk(false) { } btBulletXmlWorldImporter::~btBulletXmlWorldImporter() { } static int get_double_attribute_by_name(const TiXmlElement* pElement, const char* attribName,double* value) { if ( !pElement ) return 0; const TiXmlAttribute* pAttrib=pElement->FirstAttribute(); while (pAttrib) { if (pAttrib->Name()==attribName) if (pAttrib->QueryDoubleValue(value)==TIXML_SUCCESS) return 1; pAttrib=pAttrib->Next(); } return 0; } static int get_int_attribute_by_name(const TiXmlElement* pElement, const char* attribName,int* value) { if ( !pElement ) return 0; const TiXmlAttribute* pAttrib=pElement->FirstAttribute(); while (pAttrib) { if (!strcmp(pAttrib->Name(),attribName)) if (pAttrib->QueryIntValue(value)==TIXML_SUCCESS) return 1; // if (pAttrib->QueryDoubleValue(&dval)==TIXML_SUCCESS) printf( " d=%1.1f", dval); pAttrib=pAttrib->Next(); } return 0; } void stringToFloatArray(const std::string& string, btAlignedObjectArray<float>& floats) { btAlignedObjectArray<std::string> pieces; bullet_utils::split( pieces, string, " "); for ( int i = 0; i < pieces.size(); ++i) { assert(pieces[i]!=""); floats.push_back((float)atof(pieces[i].c_str())); } } static btVector3FloatData TextToVector3Data(const char* txt) { btAssert(txt); btAlignedObjectArray<float> floats; stringToFloatArray(txt, floats); assert(floats.size()==4); btVector3FloatData vec4; vec4.m_floats[0] = floats[0]; vec4.m_floats[1] = floats[1]; vec4.m_floats[2] = floats[2]; vec4.m_floats[3] = floats[3]; return vec4; } void btBulletXmlWorldImporter::deSerializeVector3FloatData(TiXmlNode* pParent,btAlignedObjectArray<btVector3FloatData>& vectors) { TiXmlNode* flNode = pParent->FirstChild("m_floats"); btAssert(flNode); while (flNode && flNode->FirstChild()) { TiXmlText* pText = flNode->FirstChild()->ToText(); // printf("value = %s\n",pText->Value()); btVector3FloatData vec4 = TextToVector3Data(pText->Value()); vectors.push_back(vec4); flNode = flNode->NextSibling(); } } #define SET_INT_VALUE(xmlnode, targetdata, argname) \ btAssert((xmlnode)->FirstChild(#argname) && (xmlnode)->FirstChild(#argname)->ToElement());\ if ((xmlnode)->FirstChild(#argname) && (xmlnode)->FirstChild(#argname)->ToElement())\ (targetdata)->argname= (int)atof(xmlnode->FirstChild(#argname)->ToElement()->GetText()); #define SET_FLOAT_VALUE(xmlnode, targetdata, argname) \ btAssert((xmlnode)->FirstChild(#argname) && (xmlnode)->FirstChild(#argname)->ToElement());\ if ((xmlnode)->FirstChild(#argname) && (xmlnode)->FirstChild(#argname)->ToElement())\ (targetdata)->argname= (float)atof(xmlnode->FirstChild(#argname)->ToElement()->GetText()); #define SET_POINTER_VALUE(xmlnode, targetdata, argname, pointertype) \ {\ TiXmlNode* node = xmlnode->FirstChild(#argname);\ btAssert(node);\ if (node)\ {\ const char* txt = (node)->ToElement()->GetText();\ (targetdata).argname= (pointertype) (int) atof(txt);\ }\ } #define SET_VECTOR4_VALUE(xmlnode, targetdata, argname) \ {\ TiXmlNode* flNode = xmlnode->FirstChild(#argname);\ btAssert(flNode);\ if (flNode && flNode->FirstChild())\ {\ const char* txt= flNode->FirstChild()->ToElement()->GetText();\ btVector3FloatData vec4 = TextToVector3Data(txt);\ (targetdata)->argname.m_floats[0] = vec4.m_floats[0];\ (targetdata)->argname.m_floats[1] = vec4.m_floats[1];\ (targetdata)->argname.m_floats[2] = vec4.m_floats[2];\ (targetdata)->argname.m_floats[3] = vec4.m_floats[3];\ }\ } #define SET_MATRIX33_VALUE(n, targetdata, argname) \ {\ TiXmlNode* xmlnode = n->FirstChild(#argname);\ btAssert(xmlnode);\ if (xmlnode)\ {\ TiXmlNode* eleNode = xmlnode->FirstChild("m_el");\ btAssert(eleNode);\ if (eleNode&& eleNode->FirstChild())\ {\ const char* txt= eleNode->FirstChild()->ToElement()->GetText();\ btVector3FloatData vec4 = TextToVector3Data(txt);\ (targetdata)->argname.m_el[0].m_floats[0] = vec4.m_floats[0];\ (targetdata)->argname.m_el[0].m_floats[1] = vec4.m_floats[1];\ (targetdata)->argname.m_el[0].m_floats[2] = vec4.m_floats[2];\ (targetdata)->argname.m_el[0].m_floats[3] = vec4.m_floats[3];\ \ TiXmlNode* n1 = eleNode->FirstChild()->NextSibling();\ btAssert(n1);\ if (n1)\ {\ const char* txt= n1->ToElement()->GetText();\ btVector3FloatData vec4 = TextToVector3Data(txt);\ (targetdata)->argname.m_el[1].m_floats[0] = vec4.m_floats[0];\ (targetdata)->argname.m_el[1].m_floats[1] = vec4.m_floats[1];\ (targetdata)->argname.m_el[1].m_floats[2] = vec4.m_floats[2];\ (targetdata)->argname.m_el[1].m_floats[3] = vec4.m_floats[3];\ \ TiXmlNode* n2 = n1->NextSibling();\ btAssert(n2);\ if (n2)\ {\ const char* txt= n2->ToElement()->GetText();\ btVector3FloatData vec4 = TextToVector3Data(txt);\ (targetdata)->argname.m_el[2].m_floats[0] = vec4.m_floats[0];\ (targetdata)->argname.m_el[2].m_floats[1] = vec4.m_floats[1];\ (targetdata)->argname.m_el[2].m_floats[2] = vec4.m_floats[2];\ (targetdata)->argname.m_el[2].m_floats[3] = vec4.m_floats[3];\ }\ }\ }\ }\ }\ #define SET_TRANSFORM_VALUE(n, targetdata, argname) \ {\ TiXmlNode* trNode = n->FirstChild(#argname);\ btAssert(trNode);\ if (trNode)\ {\ SET_VECTOR4_VALUE(trNode,&(targetdata)->argname,m_origin)\ SET_MATRIX33_VALUE(trNode, &(targetdata)->argname,m_basis)\ }\ }\ void btBulletXmlWorldImporter::deSerializeCollisionShapeData(TiXmlNode* pParent, btCollisionShapeData* colShapeData) { SET_INT_VALUE(pParent,colShapeData,m_shapeType) colShapeData->m_name = 0; } void btBulletXmlWorldImporter::deSerializeConvexHullShapeData(TiXmlNode* pParent) { int ptr; get_int_attribute_by_name(pParent->ToElement(),"pointer",&ptr); btConvexHullShapeData* convexHullData = (btConvexHullShapeData*)btAlignedAlloc(sizeof(btConvexHullShapeData), 16); TiXmlNode* xmlConvexInt = pParent->FirstChild("m_convexInternalShapeData"); btAssert(xmlConvexInt); TiXmlNode* xmlColShape = xmlConvexInt ->FirstChild("m_collisionShapeData"); btAssert(xmlColShape); deSerializeCollisionShapeData(xmlColShape,&convexHullData->m_convexInternalShapeData.m_collisionShapeData); SET_FLOAT_VALUE(xmlConvexInt,&convexHullData->m_convexInternalShapeData,m_collisionMargin) SET_VECTOR4_VALUE(xmlConvexInt,&convexHullData->m_convexInternalShapeData,m_localScaling) SET_VECTOR4_VALUE(xmlConvexInt,&convexHullData->m_convexInternalShapeData,m_implicitShapeDimensions) SET_POINTER_VALUE(pParent,*convexHullData,m_unscaledPointsFloatPtr,btVector3FloatData*); SET_POINTER_VALUE(pParent,*convexHullData,m_unscaledPointsDoublePtr,btVector3DoubleData*); SET_INT_VALUE(pParent,convexHullData,m_numUnscaledPoints); m_collisionShapeData.push_back((btCollisionShapeData*)convexHullData); m_pointerLookup.insert((void*)ptr,convexHullData); } void btBulletXmlWorldImporter::deSerializeCompoundShapeChildData(TiXmlNode* pParent) { int ptr; get_int_attribute_by_name(pParent->ToElement(),"pointer",&ptr); int numChildren = 0; btAlignedObjectArray<btCompoundShapeChildData>* compoundChildArrayPtr = new btAlignedObjectArray<btCompoundShapeChildData>; { TiXmlNode* transNode = pParent->FirstChild("m_transform"); TiXmlNode* colShapeNode = pParent->FirstChild("m_childShape"); TiXmlNode* marginNode = pParent->FirstChild("m_childMargin"); TiXmlNode* childTypeNode = pParent->FirstChild("m_childShapeType"); int i=0; while (transNode && colShapeNode && marginNode && childTypeNode) { compoundChildArrayPtr->expandNonInitializing(); SET_VECTOR4_VALUE (transNode,&compoundChildArrayPtr->at(i).m_transform,m_origin) SET_MATRIX33_VALUE(transNode,&compoundChildArrayPtr->at(i).m_transform,m_basis) const char* txt = (colShapeNode)->ToElement()->GetText(); compoundChildArrayPtr->at(i).m_childShape = (btCollisionShapeData*) (int) atof(txt); btAssert(childTypeNode->ToElement()); if (childTypeNode->ToElement()) { compoundChildArrayPtr->at(i).m_childShapeType = (int)atof(childTypeNode->ToElement()->GetText()); } btAssert(marginNode->ToElement()); if (marginNode->ToElement()) { compoundChildArrayPtr->at(i).m_childMargin = (float)atof(marginNode->ToElement()->GetText()); } transNode = transNode->NextSibling("m_transform"); colShapeNode = colShapeNode->NextSibling("m_childShape"); marginNode = marginNode->NextSibling("m_childMargin"); childTypeNode = childTypeNode->NextSibling("m_childShapeType"); i++; } numChildren = i; } btAssert(numChildren); if (numChildren) { m_compoundShapeChildDataArrays.push_back(compoundChildArrayPtr); btCompoundShapeChildData* cd = &compoundChildArrayPtr->at(0); m_pointerLookup.insert((void*)ptr,cd); } } void btBulletXmlWorldImporter::deSerializeCompoundShapeData(TiXmlNode* pParent) { int ptr; get_int_attribute_by_name(pParent->ToElement(),"pointer",&ptr); btCompoundShapeData* compoundData = (btCompoundShapeData*) btAlignedAlloc(sizeof(btCompoundShapeData),16); TiXmlNode* xmlColShape = pParent ->FirstChild("m_collisionShapeData"); btAssert(xmlColShape); deSerializeCollisionShapeData(xmlColShape,&compoundData->m_collisionShapeData); SET_INT_VALUE(pParent, compoundData,m_numChildShapes); TiXmlNode* xmlShapeData = pParent->FirstChild("m_collisionShapeData"); btAssert(xmlShapeData ); { TiXmlNode* node = pParent->FirstChild("m_childShapePtr");\ btAssert(node); while (node) { const char* txt = (node)->ToElement()->GetText(); compoundData->m_childShapePtr = (btCompoundShapeChildData*) (int) atof(txt); node = node->NextSibling("m_childShapePtr"); } //SET_POINTER_VALUE(xmlColShape, *compoundData,m_childShapePtr,btCompoundShapeChildData*); } SET_FLOAT_VALUE(pParent, compoundData,m_collisionMargin); m_collisionShapeData.push_back((btCollisionShapeData*)compoundData); m_pointerLookup.insert((void*)ptr,compoundData); } void btBulletXmlWorldImporter::deSerializeStaticPlaneShapeData(TiXmlNode* pParent) { int ptr; get_int_attribute_by_name(pParent->ToElement(),"pointer",&ptr); btStaticPlaneShapeData* planeData = (btStaticPlaneShapeData*) btAlignedAlloc(sizeof(btStaticPlaneShapeData),16); TiXmlNode* xmlShapeData = pParent->FirstChild("m_collisionShapeData"); btAssert(xmlShapeData ); deSerializeCollisionShapeData(xmlShapeData,&planeData->m_collisionShapeData); SET_VECTOR4_VALUE(pParent, planeData,m_localScaling); SET_VECTOR4_VALUE(pParent, planeData,m_planeNormal); SET_FLOAT_VALUE(pParent, planeData,m_planeConstant); m_collisionShapeData.push_back((btCollisionShapeData*)planeData); m_pointerLookup.insert((void*)ptr,planeData); } void btBulletXmlWorldImporter::deSerializeDynamicsWorldData(TiXmlNode* pParent) { btContactSolverInfo solverInfo; //btVector3 gravity(0,0,0); //setDynamicsWorldInfo(gravity,solverInfo); //gravity and world info } void btBulletXmlWorldImporter::deSerializeConvexInternalShapeData(TiXmlNode* pParent) { int ptr=0; get_int_attribute_by_name(pParent->ToElement(),"pointer",&ptr); btConvexInternalShapeData* convexShape = (btConvexInternalShapeData*) btAlignedAlloc(sizeof(btConvexInternalShapeData),16); memset(convexShape,0,sizeof(btConvexInternalShapeData)); TiXmlNode* xmlShapeData = pParent->FirstChild("m_collisionShapeData"); btAssert(xmlShapeData ); deSerializeCollisionShapeData(xmlShapeData,&convexShape->m_collisionShapeData); SET_FLOAT_VALUE(pParent,convexShape,m_collisionMargin) SET_VECTOR4_VALUE(pParent,convexShape,m_localScaling) SET_VECTOR4_VALUE(pParent,convexShape,m_implicitShapeDimensions) m_collisionShapeData.push_back((btCollisionShapeData*)convexShape); m_pointerLookup.insert((void*)ptr,convexShape); } /* enum btTypedConstraintType { POINT2POINT_CONSTRAINT_TYPE=3, HINGE_CONSTRAINT_TYPE, CONETWIST_CONSTRAINT_TYPE, // D6_CONSTRAINT_TYPE, SLIDER_CONSTRAINT_TYPE, CONTACT_CONSTRAINT_TYPE, D6_SPRING_CONSTRAINT_TYPE, GEAR_CONSTRAINT_TYPE, MAX_CONSTRAINT_TYPE }; */ void btBulletXmlWorldImporter::deSerializeGeneric6DofConstraintData(TiXmlNode* pParent) { int ptr=0; get_int_attribute_by_name(pParent->ToElement(),"pointer",&ptr); btGeneric6DofConstraintData2* dof6Data = (btGeneric6DofConstraintData2*)btAlignedAlloc(sizeof(btGeneric6DofConstraintData2),16); TiXmlNode* n = pParent->FirstChild("m_typeConstraintData"); if (n) { SET_POINTER_VALUE(n,dof6Data->m_typeConstraintData,m_rbA,btRigidBodyData*); SET_POINTER_VALUE(n,dof6Data->m_typeConstraintData,m_rbB,btRigidBodyData*); dof6Data->m_typeConstraintData.m_name = 0;//tbd SET_INT_VALUE(n,&dof6Data->m_typeConstraintData,m_objectType); SET_INT_VALUE(n,&dof6Data->m_typeConstraintData,m_userConstraintType); SET_INT_VALUE(n,&dof6Data->m_typeConstraintData,m_userConstraintId); SET_INT_VALUE(n,&dof6Data->m_typeConstraintData,m_needsFeedback); SET_FLOAT_VALUE(n,&dof6Data->m_typeConstraintData,m_appliedImpulse); SET_FLOAT_VALUE(n,&dof6Data->m_typeConstraintData,m_dbgDrawSize); SET_INT_VALUE(n,&dof6Data->m_typeConstraintData,m_disableCollisionsBetweenLinkedBodies); SET_INT_VALUE(n,&dof6Data->m_typeConstraintData,m_overrideNumSolverIterations); SET_FLOAT_VALUE(n,&dof6Data->m_typeConstraintData,m_breakingImpulseThreshold); SET_INT_VALUE(n,&dof6Data->m_typeConstraintData,m_isEnabled); } SET_TRANSFORM_VALUE( pParent, dof6Data, m_rbAFrame); SET_TRANSFORM_VALUE( pParent, dof6Data, m_rbBFrame); SET_VECTOR4_VALUE(pParent, dof6Data, m_linearUpperLimit); SET_VECTOR4_VALUE(pParent, dof6Data, m_linearLowerLimit); SET_VECTOR4_VALUE(pParent, dof6Data, m_angularUpperLimit); SET_VECTOR4_VALUE(pParent, dof6Data, m_angularLowerLimit); SET_INT_VALUE(pParent, dof6Data,m_useLinearReferenceFrameA); SET_INT_VALUE(pParent, dof6Data,m_useOffsetForConstraintFrame); m_constraintData.push_back((btTypedConstraintData2*)dof6Data); m_pointerLookup.insert((void*)ptr,dof6Data); } void btBulletXmlWorldImporter::deSerializeRigidBodyFloatData(TiXmlNode* pParent) { int ptr=0; if (!get_int_attribute_by_name(pParent->ToElement(),"pointer",&ptr)) { m_fileOk = false; return; } btRigidBodyData* rbData = (btRigidBodyData*)btAlignedAlloc(sizeof(btRigidBodyData),16); TiXmlNode* n = pParent->FirstChild("m_collisionObjectData"); if (n) { SET_POINTER_VALUE(n,rbData->m_collisionObjectData,m_collisionShape, void*); SET_TRANSFORM_VALUE(n,&rbData->m_collisionObjectData,m_worldTransform); SET_TRANSFORM_VALUE(n,&rbData->m_collisionObjectData,m_interpolationWorldTransform); SET_VECTOR4_VALUE(n,&rbData->m_collisionObjectData,m_interpolationLinearVelocity) SET_VECTOR4_VALUE(n,&rbData->m_collisionObjectData,m_interpolationAngularVelocity) SET_VECTOR4_VALUE(n,&rbData->m_collisionObjectData,m_anisotropicFriction) SET_FLOAT_VALUE(n,&rbData->m_collisionObjectData,m_contactProcessingThreshold); SET_FLOAT_VALUE(n,&rbData->m_collisionObjectData,m_deactivationTime); SET_FLOAT_VALUE(n,&rbData->m_collisionObjectData,m_friction); SET_FLOAT_VALUE(n,&rbData->m_collisionObjectData,m_restitution); SET_FLOAT_VALUE(n,&rbData->m_collisionObjectData,m_hitFraction); SET_FLOAT_VALUE(n,&rbData->m_collisionObjectData,m_ccdSweptSphereRadius); SET_FLOAT_VALUE(n,&rbData->m_collisionObjectData,m_ccdMotionThreshold); SET_INT_VALUE(n,&rbData->m_collisionObjectData,m_hasAnisotropicFriction); SET_INT_VALUE(n,&rbData->m_collisionObjectData,m_collisionFlags); SET_INT_VALUE(n,&rbData->m_collisionObjectData,m_islandTag1); SET_INT_VALUE(n,&rbData->m_collisionObjectData,m_companionId); SET_INT_VALUE(n,&rbData->m_collisionObjectData,m_activationState1); SET_INT_VALUE(n,&rbData->m_collisionObjectData,m_internalType); SET_INT_VALUE(n,&rbData->m_collisionObjectData,m_checkCollideWith); } // SET_VECTOR4_VALUE(pParent,rbData,m_linearVelocity); SET_MATRIX33_VALUE(pParent,rbData,m_invInertiaTensorWorld); SET_VECTOR4_VALUE(pParent,rbData,m_linearVelocity) SET_VECTOR4_VALUE(pParent,rbData,m_angularVelocity) SET_VECTOR4_VALUE(pParent,rbData,m_angularFactor) SET_VECTOR4_VALUE(pParent,rbData,m_linearFactor) SET_VECTOR4_VALUE(pParent,rbData,m_gravity) SET_VECTOR4_VALUE(pParent,rbData,m_gravity_acceleration ) SET_VECTOR4_VALUE(pParent,rbData,m_invInertiaLocal) SET_VECTOR4_VALUE(pParent,rbData,m_totalTorque) SET_VECTOR4_VALUE(pParent,rbData,m_totalForce) SET_FLOAT_VALUE(pParent,rbData,m_inverseMass); SET_FLOAT_VALUE(pParent,rbData,m_linearDamping); SET_FLOAT_VALUE(pParent,rbData,m_angularDamping); SET_FLOAT_VALUE(pParent,rbData,m_additionalDampingFactor); SET_FLOAT_VALUE(pParent,rbData,m_additionalLinearDampingThresholdSqr); SET_FLOAT_VALUE(pParent,rbData,m_additionalAngularDampingThresholdSqr); SET_FLOAT_VALUE(pParent,rbData,m_additionalAngularDampingFactor); SET_FLOAT_VALUE(pParent,rbData,m_angularSleepingThreshold); SET_FLOAT_VALUE(pParent,rbData,m_linearSleepingThreshold); SET_INT_VALUE(pParent,rbData,m_additionalDamping); m_rigidBodyData.push_back(rbData); m_pointerLookup.insert((void*)ptr,rbData); // rbData->m_collisionObjectData.m_collisionShape = (void*) (int)atof(txt); } /* TETRAHEDRAL_SHAPE_PROXYTYPE, CONVEX_TRIANGLEMESH_SHAPE_PROXYTYPE, , CONVEX_POINT_CLOUD_SHAPE_PROXYTYPE, CUSTOM_POLYHEDRAL_SHAPE_TYPE, //implicit convex shapes IMPLICIT_CONVEX_SHAPES_START_HERE, SPHERE_SHAPE_PROXYTYPE, MULTI_SPHERE_SHAPE_PROXYTYPE, CAPSULE_SHAPE_PROXYTYPE, CONE_SHAPE_PROXYTYPE, CONVEX_SHAPE_PROXYTYPE, CYLINDER_SHAPE_PROXYTYPE, UNIFORM_SCALING_SHAPE_PROXYTYPE, MINKOWSKI_SUM_SHAPE_PROXYTYPE, MINKOWSKI_DIFFERENCE_SHAPE_PROXYTYPE, BOX_2D_SHAPE_PROXYTYPE, CONVEX_2D_SHAPE_PROXYTYPE, CUSTOM_CONVEX_SHAPE_TYPE, //concave shapes CONCAVE_SHAPES_START_HERE, //keep all the convex shapetype below here, for the check IsConvexShape in broadphase proxy! TRIANGLE_MESH_SHAPE_PROXYTYPE, SCALED_TRIANGLE_MESH_SHAPE_PROXYTYPE, ///used for demo integration FAST/Swift collision library and Bullet FAST_CONCAVE_MESH_PROXYTYPE, //terrain TERRAIN_SHAPE_PROXYTYPE, ///Used for GIMPACT Trimesh integration GIMPACT_SHAPE_PROXYTYPE, ///Multimaterial mesh MULTIMATERIAL_TRIANGLE_MESH_PROXYTYPE, , , CUSTOM_CONCAVE_SHAPE_TYPE, CONCAVE_SHAPES_END_HERE, , SOFTBODY_SHAPE_PROXYTYPE, HFFLUID_SHAPE_PROXYTYPE, HFFLUID_BUOYANT_CONVEX_SHAPE_PROXYTYPE, INVALID_SHAPE_PROXYTYPE, MAX_BROADPHASE_COLLISION_TYPES */ void btBulletXmlWorldImporter::fixupConstraintData(btTypedConstraintData2* tcd) { if (tcd->m_rbA) { btRigidBodyData** ptrptr = (btRigidBodyData**)m_pointerLookup.find(tcd->m_rbA); btAssert(ptrptr); tcd->m_rbA = ptrptr? *ptrptr : 0; } if (tcd->m_rbB) { btRigidBodyData** ptrptr = (btRigidBodyData**)m_pointerLookup.find(tcd->m_rbB); btAssert(ptrptr); tcd->m_rbB = ptrptr? *ptrptr : 0; } } void btBulletXmlWorldImporter::fixupCollisionDataPointers(btCollisionShapeData* shapeData) { switch (shapeData->m_shapeType) { case COMPOUND_SHAPE_PROXYTYPE: { btCompoundShapeData* compound = (btCompoundShapeData*) shapeData; void** cdptr = m_pointerLookup.find((void*)compound->m_childShapePtr); btCompoundShapeChildData** c = (btCompoundShapeChildData**)cdptr; btAssert(c); if (c) { compound->m_childShapePtr = *c; } else { compound->m_childShapePtr = 0; } break; } case CONVEX_HULL_SHAPE_PROXYTYPE: { btConvexHullShapeData* convexData = (btConvexHullShapeData*)shapeData; btVector3FloatData** ptrptr = (btVector3FloatData**)m_pointerLookup.find((void*)convexData->m_unscaledPointsFloatPtr); btAssert(ptrptr); if (ptrptr) { convexData->m_unscaledPointsFloatPtr = *ptrptr; } else { convexData->m_unscaledPointsFloatPtr = 0; } break; } case BOX_SHAPE_PROXYTYPE: case TRIANGLE_SHAPE_PROXYTYPE: case STATIC_PLANE_PROXYTYPE: case EMPTY_SHAPE_PROXYTYPE: break; default: { btAssert(0); } } } void btBulletXmlWorldImporter::auto_serialize_root_level_children(TiXmlNode* pParent) { int numChildren = 0; btAssert(pParent); if (pParent) { TiXmlNode*pChild; for ( pChild = pParent->FirstChild(); pChild != 0; pChild = pChild->NextSibling(), numChildren++) { // printf("child Name=%s\n", pChild->Value()); if (!strcmp(pChild->Value(),"btVector3FloatData")) { int ptr; get_int_attribute_by_name(pChild->ToElement(),"pointer",&ptr); btAlignedObjectArray<btVector3FloatData> v; deSerializeVector3FloatData(pChild,v); int numVectors = v.size(); btVector3FloatData* vectors= (btVector3FloatData*) btAlignedAlloc(sizeof(btVector3FloatData)*numVectors,16); for (int i=0;i<numVectors;i++) vectors[i] = v[i]; m_floatVertexArrays.push_back(vectors); m_pointerLookup.insert((void*)ptr,vectors); continue; } if (!strcmp(pChild->Value(),"btGeneric6DofConstraintData")) { deSerializeGeneric6DofConstraintData(pChild); continue; } if (!strcmp(pChild->Value(),"btStaticPlaneShapeData")) { deSerializeStaticPlaneShapeData(pChild); continue; } if (!strcmp(pChild->Value(),"btCompoundShapeData")) { deSerializeCompoundShapeData(pChild); continue; } if (!strcmp(pChild->Value(),"btCompoundShapeChildData")) { deSerializeCompoundShapeChildData(pChild); continue; } if (!strcmp(pChild->Value(),"btConvexHullShapeData")) { deSerializeConvexHullShapeData(pChild); continue; } if (!strcmp(pChild->Value(),"btDynamicsWorldFloatData")) { deSerializeDynamicsWorldData(pChild); continue; } if (!strcmp(pChild->Value(),"btConvexInternalShapeData")) { deSerializeConvexInternalShapeData(pChild); continue; } if (!strcmp(pChild->Value(),"btRigidBodyFloatData")) { deSerializeRigidBodyFloatData(pChild); continue; } //printf("Error: btBulletXmlWorldImporter doesn't support %s yet\n", pChild->Value()); // btAssert(0); } } ///================================================================= ///fixup pointers in various places, in the right order //fixup compoundshape child data for (int i=0;i<m_compoundShapeChildDataArrays.size();i++) { btAlignedObjectArray<btCompoundShapeChildData>* childDataArray = m_compoundShapeChildDataArrays[i]; for (int c=0;c<childDataArray->size();c++) { btCompoundShapeChildData* childData = &childDataArray->at(c); btCollisionShapeData** ptrptr = (btCollisionShapeData**)m_pointerLookup[childData->m_childShape]; btAssert(ptrptr); if (ptrptr) { childData->m_childShape = *ptrptr; } } } for (int i=0;i<this->m_collisionShapeData.size();i++) { btCollisionShapeData* shapeData = m_collisionShapeData[i]; fixupCollisionDataPointers(shapeData); } ///now fixup pointers for (int i=0;i<m_rigidBodyData.size();i++) { btRigidBodyData* rbData = m_rigidBodyData[i]; void** ptrptr = m_pointerLookup.find(rbData->m_collisionObjectData.m_collisionShape); //btAssert(ptrptr); rbData->m_collisionObjectData.m_broadphaseHandle = 0; rbData->m_collisionObjectData.m_rootCollisionShape = 0; rbData->m_collisionObjectData.m_name = 0;//tbd if (ptrptr) { rbData->m_collisionObjectData.m_collisionShape = *ptrptr; } } for (int i=0;i<m_constraintData.size();i++) { btTypedConstraintData2* tcd = m_constraintData[i]; fixupConstraintData(tcd); } ///================================================================= ///convert data into Bullet data in the right order ///convert collision shapes for (int i=0;i<this->m_collisionShapeData.size();i++) { btCollisionShapeData* shapeData = m_collisionShapeData[i]; btCollisionShape* shape = convertCollisionShape(shapeData); if (shape) { m_shapeMap.insert(shapeData,shape); } if (shape&& shapeData->m_name) { char* newname = duplicateName(shapeData->m_name); m_objectNameMap.insert(shape,newname); m_nameShapeMap.insert(newname,shape); } } for (int i=0;i<m_rigidBodyData.size();i++) { #ifdef BT_USE_DOUBLE_PRECISION convertRigidBodyDouble(m_rigidBodyData[i]); #else convertRigidBodyFloat(m_rigidBodyData[i]); #endif } for (int i=0;i<m_constraintData.size();i++) { btTypedConstraintData2* tcd = m_constraintData[i]; bool isDoublePrecision = false; btRigidBody* rbA = 0; btRigidBody* rbB = 0; { btCollisionObject** ptrptr = m_bodyMap.find(tcd->m_rbA); if (ptrptr) { rbA = btRigidBody::upcast(*ptrptr); } } { btCollisionObject** ptrptr = m_bodyMap.find(tcd->m_rbB); if (ptrptr) { rbB = btRigidBody::upcast(*ptrptr); } } if (rbA || rbB) { btAssert(0);//todo //convertConstraint(tcd,rbA,rbB,isDoublePrecision, m_fileVersion); } } } void btBulletXmlWorldImporter::auto_serialize(TiXmlNode* pParent) { // TiXmlElement* root = pParent->FirstChildElement("bullet_physics"); if (pParent) { TiXmlNode*pChild; for ( pChild = pParent->FirstChild(); pChild != 0; pChild = pChild->NextSibling()) { if (pChild->Type()==TiXmlNode::TINYXML_ELEMENT) { // printf("root Name=%s\n", pChild->Value()); auto_serialize_root_level_children(pChild); } } } else { printf("ERROR: no bullet_physics element\n"); } } bool btBulletXmlWorldImporter::loadFile(const char* fileName) { TiXmlDocument doc(fileName); bool loadOkay = doc.LoadFile(); //dump_to_stdout(&doc,0); if (loadOkay) { if (get_int_attribute_by_name(doc.FirstChildElement()->ToElement(),"version", &m_fileVersion)) { if (m_fileVersion==281) { m_fileOk = true; int itemcount; get_int_attribute_by_name(doc.FirstChildElement()->ToElement(),"itemcount", &itemcount); auto_serialize(&doc); return m_fileOk; } } } return false; }
30.811927
243
0.754206
vif
f361fe616d81e4c92dc9aeb668f378273c971dca
28
cpp
C++
Pogo/src/Logic/Player.cpp
pinam45/UTBM_IA41_Pogo
1512825278d75f13e6169d3ff02c37ab19c31d16
[ "MIT" ]
null
null
null
Pogo/src/Logic/Player.cpp
pinam45/UTBM_IA41_Pogo
1512825278d75f13e6169d3ff02c37ab19c31d16
[ "MIT" ]
null
null
null
Pogo/src/Logic/Player.cpp
pinam45/UTBM_IA41_Pogo
1512825278d75f13e6169d3ff02c37ab19c31d16
[ "MIT" ]
null
null
null
#include <Logic/Player.hpp>
14
27
0.75
pinam45
f362343c753d47d69e1f9dc5b8c18475c6a39e99
3,859
hpp
C++
engine/include/Engine/Keys.hpp
Alexthehuman3/ASGE
a9cf473a3117f4b67a2dbe8fac00b1a2a4fd6e44
[ "MIT" ]
8
2020-04-26T11:48:29.000Z
2022-02-23T15:13:50.000Z
engine/include/Engine/Keys.hpp
Alexthehuman3/ASGE
a9cf473a3117f4b67a2dbe8fac00b1a2a4fd6e44
[ "MIT" ]
null
null
null
engine/include/Engine/Keys.hpp
Alexthehuman3/ASGE
a9cf473a3117f4b67a2dbe8fac00b1a2a4fd6e44
[ "MIT" ]
1
2021-05-13T16:37:24.000Z
2021-05-13T16:37:24.000Z
// Copyright (c) 2021 James Huxtable. All rights reserved. // // This work is licensed under the terms of the MIT license. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. //! @file Keys.hpp //! @brief Namespace @ref ASGE::KEYS #pragma once /** * @namespace ASGE::KEYS * @brief input key bindings * @details http://www.glfw.org/docs/latest/group__keys.html */ #include <bitset> #include <magic_enum.hpp> namespace ASGE::KEYS { constexpr int KEY_RELEASED = 0; /**< Key Release. The key or mouse button was pressed. */ constexpr int KEY_PRESSED = 1; /**< Key Press. The key or mouse button was released. */ constexpr int KEY_REPEATED = 2; /**< Key Repeat. The key was held down until it repeated. */ constexpr int KEY_SPACE = 32; constexpr int KEY_APOSTROPHE = 39; constexpr int KEY_COMMA = 44; constexpr int KEY_MINUS = 45; constexpr int KEY_PERIOD = 46; constexpr int KEY_SLASH = 47; constexpr int KEY_0 = 48; constexpr int KEY_1 = 49; constexpr int KEY_2 = 50; constexpr int KEY_3 = 51; constexpr int KEY_4 = 52; constexpr int KEY_5 = 53; constexpr int KEY_6 = 54; constexpr int KEY_7 = 55; constexpr int KEY_8 = 56; constexpr int KEY_9 = 57; constexpr int KEY_SEMICOLON = 59; constexpr int KEY_EQUAL = 61; constexpr int KEY_A = 65; constexpr int KEY_B = 66; constexpr int KEY_C = 67; constexpr int KEY_D = 68; constexpr int KEY_E = 69; constexpr int KEY_F = 70; constexpr int KEY_G = 71; constexpr int KEY_H = 72; constexpr int KEY_I = 73; constexpr int KEY_J = 74; constexpr int KEY_K = 75; constexpr int KEY_L = 76; constexpr int KEY_M = 77; constexpr int KEY_N = 78; constexpr int KEY_O = 79; constexpr int KEY_P = 80; constexpr int KEY_Q = 81; constexpr int KEY_R = 82; constexpr int KEY_S = 83; constexpr int KEY_T = 84; constexpr int KEY_U = 85; constexpr int KEY_V = 86; constexpr int KEY_W = 87; constexpr int KEY_X = 88; constexpr int KEY_Y = 89; constexpr int KEY_Z = 90; constexpr int KEY_LEFT_BRACKET = 91; constexpr int KEY_BACKSLASH = 92; constexpr int KEY_RIGHT_BRACKET = 93; constexpr int KEY_GRAVE_ACCENT = 96; constexpr int KEY_WORLD_1 = 161; constexpr int KEY_WORLD_2 = 162; constexpr int KEY_ESCAPE = 256; constexpr int KEY_ENTER = 257; constexpr int KEY_TAB = 258; constexpr int KEY_BACKSPACE = 259; constexpr int KEY_DELETE = 261; constexpr int KEY_RIGHT = 262; constexpr int KEY_LEFT = 263; constexpr int KEY_DOWN = 264; constexpr int KEY_UP = 265; constexpr int KEY_MAX = KEY_UP; enum ModKeys { MOD_KEY_SHIFT, MOD_KEY_CONTROL, MOD_KEY_ALT, MOD_KEY_SUPER, MOD_KEY_CAPS_LOCK, MOD_KEY_NUM_LOCK }; // using namespace magic_enum::bitwise_operators; using MODS = std::bitset<magic_enum::enum_count<ModKeys>()>; } // namespace ASGE::KEYS
37.105769
94
0.601451
Alexthehuman3
f3659cb2d8fca80418b3abf2d18eb7d59f26feb6
48,982
cpp
C++
tests/IResearch/ExpressionFilterTest.cpp
kapahimansi123/arangodb
66e4b96ab21baf0a857fd50bb6916e71c0defc06
[ "Apache-2.0" ]
null
null
null
tests/IResearch/ExpressionFilterTest.cpp
kapahimansi123/arangodb
66e4b96ab21baf0a857fd50bb6916e71c0defc06
[ "Apache-2.0" ]
null
null
null
tests/IResearch/ExpressionFilterTest.cpp
kapahimansi123/arangodb
66e4b96ab21baf0a857fd50bb6916e71c0defc06
[ "Apache-2.0" ]
null
null
null
//////////////////////////////////////////////////////////////////////////////// /// DISCLAIMER /// /// Copyright 2014-2020 ArangoDB GmbH, Cologne, Germany /// Copyright 2004-2014 triAGENS GmbH, Cologne, Germany /// /// Licensed under the Apache License, Version 2.0 (the "License"); /// you may not use this file except in compliance with the License. /// You may obtain a copy of the License at /// /// http://www.apache.org/licenses/LICENSE-2.0 /// /// Unless required by applicable law or agreed to in writing, software /// distributed under the License is distributed on an "AS IS" BASIS, /// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. /// See the License for the specific language governing permissions and /// limitations under the License. /// /// Copyright holder is ArangoDB GmbH, Cologne, Germany /// /// @author Andrey Abramov /// @author Vasiliy Nabatchikov //////////////////////////////////////////////////////////////////////////////// #include "gtest/gtest.h" #include "3rdParty/iresearch/tests/tests_config.hpp" #include "analysis/token_attributes.hpp" #include "index/directory_reader.hpp" #include "search/all_filter.hpp" #include "search/cost.hpp" #include "search/score.hpp" #include "search/scorers.hpp" #include "store/memory_directory.hpp" #include "store/store_utils.hpp" #include "utils/type_limits.hpp" #include "utils/utf8_path.hpp" #include "velocypack/Iterator.h" #include "IResearch/ExpressionContextMock.h" #include "IResearch/common.h" #include "Mocks/LogLevels.h" #include "Mocks/StorageEngineMock.h" #include "ApplicationFeatures/ApplicationServer.h" #include "Aql/AqlFunctionFeature.h" #include "Aql/Ast.h" #include "Aql/ExecutionPlan.h" #include "Aql/OptimizerRulesFeature.h" #include "Aql/Query.h" #include "Basics/VelocyPackHelper.h" #include "GeneralServer/AuthenticationFeature.h" #include "IResearch/ExpressionFilter.h" #include "IResearch/IResearchAnalyzerFeature.h" #include "IResearch/IResearchCommon.h" #include "IResearch/IResearchFeature.h" #include "IResearch/IResearchFilterFactory.h" #include "IResearch/IResearchView.h" #include "IResearch/VelocyPackHelper.h" #include "Logger/LogTopic.h" #include "Logger/Logger.h" #include "RestServer/AqlFeature.h" #include "RestServer/DatabaseFeature.h" #include "RestServer/DatabasePathFeature.h" #include "RestServer/MetricsFeature.h" #include "RestServer/QueryRegistryFeature.h" #include "RestServer/SystemDatabaseFeature.h" #include "RestServer/ViewTypesFeature.h" #include "Sharding/ShardingFeature.h" #include "StorageEngine/EngineSelectorFeature.h" #include "ProgramOptions/ProgramOptions.h" #include "Transaction/Methods.h" #include "Transaction/StandaloneContext.h" #include "VocBase/LogicalCollection.h" #include "VocBase/LogicalView.h" #include "VocBase/ManagedDocumentResult.h" #if USE_ENTERPRISE #include "Enterprise/Ldap/LdapFeature.h" #endif extern const char* ARGV0; // defined in main.cpp namespace { struct custom_sort : public irs::sort { static constexpr irs::string_ref type_name() noexcept { return "custom_sort"; } class prepared : public irs::prepared_sort_base<irs::doc_id_t, void> { public: class field_collector : public irs::sort::field_collector { public: field_collector(const custom_sort& sort) : sort_(sort) {} virtual void collect(const irs::sub_reader& segment, const irs::term_reader& field) override { if (sort_.field_collector_collect) { sort_.field_collector_collect(segment, field); } } virtual void collect(const irs::bytes_ref& in) override {} virtual void reset() override { } virtual void write(irs::data_output& out) const override {} private: const custom_sort& sort_; }; class term_collector : public irs::sort::term_collector { public: term_collector(const custom_sort& sort) : sort_(sort) {} virtual void collect(const irs::sub_reader& segment, const irs::term_reader& field, const irs::attribute_provider& term_attrs) override { if (sort_.term_collector_collect) { sort_.term_collector_collect(segment, field, term_attrs); } } virtual void collect(const irs::bytes_ref& in) override {} virtual void reset() override { } virtual void write(irs::data_output& out) const override {} private: const custom_sort& sort_; }; struct scorer : public irs::score_ctx { scorer(const custom_sort& sort, const irs::sub_reader& segment_reader, const irs::term_reader& term_reader, const irs::byte_type* stats, irs::byte_type* score_buf, const irs::attribute_provider& document_attrs) : document_attrs_(document_attrs), stats_(stats), score_buf_(score_buf), segment_reader_(segment_reader), sort_(sort), term_reader_(term_reader) {} const irs::attribute_provider& document_attrs_; const irs::byte_type* stats_; irs::byte_type* score_buf_; const irs::sub_reader& segment_reader_; const custom_sort& sort_; const irs::term_reader& term_reader_; }; static ptr make(prepared); prepared(const custom_sort& sort) : sort_(sort) {} virtual void collect(irs::byte_type* filter_attrs, const irs::index_reader& index, const irs::sort::field_collector* field, const irs::sort::term_collector* term) const override { if (sort_.collector_finish) { sort_.collector_finish(filter_attrs, index); } } virtual irs::IndexFeatures features() const override { return irs::IndexFeatures::NONE; } virtual irs::sort::field_collector::ptr prepare_field_collector() const override { if (sort_.prepare_field_collector) { return sort_.prepare_field_collector(); } return irs::memory::make_unique<custom_sort::prepared::field_collector>(sort_); } virtual irs::score_function prepare_scorer( irs::sub_reader const& segment_reader, irs::term_reader const& term_reader, irs::byte_type const* filter_node_attrs, irs::byte_type* score_buf, irs::attribute_provider const& document_attrs, irs::boost_t boost) const override { if (sort_.prepare_scorer) { return sort_.prepare_scorer(segment_reader, term_reader, filter_node_attrs, score_buf, document_attrs, boost); } return { std::make_unique<custom_sort::prepared::scorer>(sort_, segment_reader, term_reader, filter_node_attrs, score_buf, document_attrs), [](irs::score_ctx* ctx) -> const irs::byte_type* { auto& ctxImpl = *reinterpret_cast<const custom_sort::prepared::scorer*>(ctx); EXPECT_TRUE(ctxImpl.score_buf_); auto& doc_id = *reinterpret_cast<irs::doc_id_t*>(ctxImpl.score_buf_); doc_id = irs::get<irs::document>(ctxImpl.document_attrs_)->value; if (ctxImpl.sort_.scorer_score) { ctxImpl.sort_.scorer_score(doc_id); } return ctxImpl.score_buf_; }}; } virtual irs::sort::term_collector::ptr prepare_term_collector() const override { if (sort_.prepare_term_collector) { return sort_.prepare_term_collector(); } return irs::memory::make_unique<custom_sort::prepared::term_collector>(sort_); } virtual bool less(irs::byte_type const* lhs, const irs::byte_type* rhs) const override { return sort_.scorer_less ? sort_.scorer_less(traits_t::score_cast(lhs), traits_t::score_cast(rhs)) : false; } private: const custom_sort& sort_; }; std::function<void(const irs::sub_reader&, const irs::term_reader&)> field_collector_collect; std::function<void(const irs::sub_reader&, const irs::term_reader&, const irs::attribute_provider&)> term_collector_collect; std::function<void(irs::byte_type*, const irs::index_reader&)> collector_finish; std::function<irs::sort::field_collector::ptr()> prepare_field_collector; std::function<irs::score_function( const irs::sub_reader&, const irs::term_reader&, const irs::byte_type*, irs::byte_type*, const irs::attribute_provider&, irs::boost_t)> prepare_scorer; std::function<irs::sort::term_collector::ptr()> prepare_term_collector; std::function<void(irs::doc_id_t&, const irs::doc_id_t&)> scorer_add; std::function<bool(const irs::doc_id_t&, const irs::doc_id_t&)> scorer_less; std::function<void(irs::doc_id_t&)> scorer_score; static ptr make(); custom_sort() : sort(irs::type<custom_sort>::get()) {} virtual prepared::ptr prepare() const override { return std::make_unique<custom_sort::prepared>(*this); } }; DEFINE_FACTORY_DEFAULT(custom_sort) // ----------------------------------------------------------------------------- // --SECTION-- setup / tear-down // ----------------------------------------------------------------------------- struct IResearchExpressionFilterTest : public ::testing::Test, public arangodb::tests::LogSuppressor<arangodb::Logger::AUTHENTICATION, arangodb::LogLevel::ERR>, public arangodb::tests::LogSuppressor<arangodb::iresearch::TOPIC, arangodb::LogLevel::FATAL>, public arangodb::tests::IResearchLogSuppressor { arangodb::application_features::ApplicationServer server; StorageEngineMock engine; std::unique_ptr<TRI_vocbase_t> system; std::vector<std::pair<arangodb::application_features::ApplicationFeature&, bool>> features; IResearchExpressionFilterTest() : server(std::make_shared<arangodb::options::ProgramOptions>("", "", "", ""), nullptr), engine(server) { arangodb::tests::init(true); // setup required application features features.emplace_back(server.addFeature<arangodb::ViewTypesFeature>(), true); features.emplace_back(server.addFeature<arangodb::AuthenticationFeature>(), true); features.emplace_back(server.addFeature<arangodb::DatabasePathFeature>(), false); features.emplace_back(server.addFeature<arangodb::DatabaseFeature>(), false); features.emplace_back(server.addFeature<arangodb::EngineSelectorFeature>(), false); server.getFeature<arangodb::EngineSelectorFeature>().setEngineTesting(&engine); features.emplace_back(server.addFeature<arangodb::MetricsFeature>(), false); features.emplace_back(server.addFeature<arangodb::QueryRegistryFeature>(), false); // must be first system = irs::memory::make_unique<TRI_vocbase_t>(TRI_vocbase_type_e::TRI_VOCBASE_TYPE_NORMAL, systemDBInfo(server)); features.emplace_back(server.addFeature<arangodb::SystemDatabaseFeature>( system.get()), false); // required for IResearchAnalyzerFeature features.emplace_back(server.addFeature<arangodb::AqlFeature>(), true); features.emplace_back(server.addFeature<arangodb::ShardingFeature>(), false); features.emplace_back(server.addFeature<arangodb::aql::OptimizerRulesFeature>(), true); features.emplace_back(server.addFeature<arangodb::aql::AqlFunctionFeature>(), true); // required for IResearchAnalyzerFeature features.emplace_back(server.addFeature<arangodb::iresearch::IResearchAnalyzerFeature>(), true); auto& feature = features.emplace_back(server.addFeature<arangodb::iresearch::IResearchFeature>(), true).first; feature.collectOptions(server.options()); feature.validateOptions(server.options()); #if USE_ENTERPRISE features.emplace_back(server.addFeature<arangodb::LdapFeature>(), false); // required for AuthenticationFeature with USE_ENTERPRISE #endif for (auto& f : features) { f.first.prepare(); } for (auto& f : features) { if (f.second) { f.first.start(); } } // register fake non-deterministic function in order to suppress optimizations server.getFeature<arangodb::aql::AqlFunctionFeature>().add(arangodb::aql::Function{ "_REFERENCE_", ".", arangodb::aql::Function::makeFlags( // fake non-deterministic arangodb::aql::Function::Flags::CanRunOnDBServerCluster, arangodb::aql::Function::Flags::CanRunOnDBServerOneShard), [](arangodb::aql::ExpressionContext*, arangodb::aql::AstNode const&, arangodb::aql::VPackFunctionParameters const& params) { TRI_ASSERT(!params.empty()); return params[0]; }}); auto& dbPathFeature = server.getFeature<arangodb::DatabasePathFeature>(); arangodb::tests::setDatabasePath(dbPathFeature); // ensure test data is stored in a unique directory } ~IResearchExpressionFilterTest() { system.reset(); // destroy before reseting the 'ENGINE' arangodb::AqlFeature(server).stop(); // unset singleton instance server.getFeature<arangodb::EngineSelectorFeature>().setEngineTesting(nullptr); // destroy application features for (auto& f : features) { if (f.second) { f.first.stop(); } } for (auto& f : features) { f.first.unprepare(); } } }; // TestSetup struct FilterCtx : irs::attribute_provider { explicit FilterCtx(arangodb::iresearch::ExpressionExecutionContext& ctx) noexcept : _execCtx(&ctx) { } irs::attribute* get_mutable(irs::type_info::type_id type) noexcept override { return irs::type<arangodb::iresearch::ExpressionExecutionContext>::id() == type ? _execCtx : nullptr; } arangodb::iresearch::ExpressionExecutionContext* _execCtx; // expression execution context }; // FilterCtx } // namespace // ----------------------------------------------------------------------------- // --SECTION-- test suite // ----------------------------------------------------------------------------- TEST_F(IResearchExpressionFilterTest, test) { arangodb::velocypack::Builder testData; { irs::utf8_path resource; resource /= std::string_view(arangodb::tests::testResourceDir); resource /= std::string_view("simple_sequential.json"); testData = arangodb::basics::VelocyPackHelper::velocyPackFromFile(resource.string()); } auto testDataRoot = testData.slice(); ASSERT_TRUE(testDataRoot.isArray()); irs::memory_directory dir; // populate directory with data { struct { bool write(irs::data_output& out) { irs::write_string(out, str); return true; } irs::string_ref name() const { return "name"; } irs::string_ref str; } storedField; auto writer = irs::index_writer::make(dir, irs::formats::get("1_0"), irs::OM_CREATE); ASSERT_TRUE(writer); for (auto data : arangodb::velocypack::ArrayIterator(testDataRoot)) { storedField.str = arangodb::iresearch::getStringRef(data.get("name")); auto ctx = writer->documents(); auto doc = ctx.insert(); EXPECT_TRUE(doc.insert<irs::Action::STORE>(storedField)); EXPECT_TRUE(doc); } writer->commit(); } // setup ArangoDB database TRI_vocbase_t vocbase(TRI_vocbase_type_e::TRI_VOCBASE_TYPE_NORMAL, testDBInfo(server)); // create view { auto createJson = arangodb::velocypack::Parser::fromJson( "{ \ \"name\": \"testView\", \ \"type\": \"arangosearch\" \ }"); // add view auto view = std::dynamic_pointer_cast<arangodb::iresearch::IResearchView>( vocbase.createView(createJson->slice())); ASSERT_FALSE(!view); } // open reader auto reader = irs::directory_reader::open(dir); ASSERT_TRUE(reader); ASSERT_EQ(1, reader->size()); auto& segment = (*reader)[0]; EXPECT_TRUE(reader->docs_count() > 0); // uninitialized query { arangodb::iresearch::ByExpression filter; EXPECT_FALSE(filter); auto prepared = filter.prepare(*reader); auto docs = prepared->execute(segment); EXPECT_EQ(irs::doc_limits::eof(), docs->value()); EXPECT_FALSE(docs->next()); EXPECT_EQ(irs::doc_limits::eof(), docs->value()); } // query with false expression without order { std::string const queryString = "LET c=1 LET b=2 FOR d IN testView FILTER c==b RETURN d"; auto query = arangodb::aql::Query::create(arangodb::transaction::StandaloneContext::Create(vocbase), arangodb::aql::QueryString(queryString), nullptr); query->initTrxForTests(); ExpressionContextMock ctx; { arangodb::aql::AqlValue value(arangodb::aql::AqlValueHintInt{1}); arangodb::aql::AqlValueGuard guard(value, true); ctx.vars.emplace("c", value); } { arangodb::aql::AqlValue value(arangodb::aql::AqlValueHintInt{2}); arangodb::aql::AqlValueGuard guard(value, true); ctx.vars.emplace("b", value); } auto const parseResult = query->parse(); ASSERT_TRUE(parseResult.result.ok()); auto* ast = query->ast(); ASSERT_TRUE(ast); auto* root = ast->root(); ASSERT_TRUE(root); // find first FILTER node arangodb::aql::AstNode* filterNode = nullptr; for (size_t i = 0; i < root->numMembers(); ++i) { auto* node = root->getMemberUnchecked(i); ASSERT_TRUE(node); if (arangodb::aql::NODE_TYPE_FILTER == node->type) { filterNode = node; break; } } ASSERT_TRUE(filterNode); // find expression root auto* expression = filterNode->getMember(0); ASSERT_TRUE(expression); // setup filter std::vector<std::string> EMPTY; arangodb::transaction::Methods trx(arangodb::transaction::StandaloneContext::Create(vocbase), EMPTY, EMPTY, EMPTY, arangodb::transaction::Options()); std::unique_ptr<arangodb::aql::ExecutionPlan> plan( arangodb::aql::ExecutionPlan::instantiateFromAst(ast, false)); arangodb::iresearch::ByExpression filter; EXPECT_FALSE(filter); filter.init(*plan, *ast, *expression); EXPECT_TRUE(filter); arangodb::iresearch::ExpressionExecutionContext execCtx; ctx.setTrx(&trx); execCtx.ctx = &ctx; FilterCtx queryCtx(execCtx); auto prepared = filter.prepare(*reader, irs::order::prepared::unordered(), &queryCtx); auto docs = prepared->execute(segment, irs::order::prepared::unordered(), &queryCtx); EXPECT_EQ(irs::doc_limits::eof(), docs->value()); EXPECT_FALSE(docs->next()); EXPECT_EQ(irs::doc_limits::eof(), docs->value()); } // query with false expression without order (deferred execution) { std::string const queryString = "LET c=1 LET b=2 FOR d IN testView FILTER c==b RETURN d"; auto query = arangodb::aql::Query::create(arangodb::transaction::StandaloneContext::Create(vocbase), arangodb::aql::QueryString(queryString), nullptr); query->initTrxForTests(); ExpressionContextMock ctx; { arangodb::aql::AqlValue value(arangodb::aql::AqlValueHintInt{1}); arangodb::aql::AqlValueGuard guard(value, true); ctx.vars.emplace("c", value); } { arangodb::aql::AqlValue value(arangodb::aql::AqlValueHintInt{2}); arangodb::aql::AqlValueGuard guard(value, true); ctx.vars.emplace("b", value); } auto const parseResult = query->parse(); ASSERT_TRUE(parseResult.result.ok()); auto* ast = query->ast(); ASSERT_TRUE(ast); auto* root = ast->root(); ASSERT_TRUE(root); // find first FILTER node arangodb::aql::AstNode* filterNode = nullptr; for (size_t i = 0; i < root->numMembers(); ++i) { auto* node = root->getMemberUnchecked(i); ASSERT_TRUE(node); if (arangodb::aql::NODE_TYPE_FILTER == node->type) { filterNode = node; break; } } ASSERT_TRUE(filterNode); // find expression root auto* expression = filterNode->getMember(0); ASSERT_TRUE(expression); // setup filter std::vector<std::string> EMPTY; arangodb::transaction::Methods trx(arangodb::transaction::StandaloneContext::Create(vocbase), EMPTY, EMPTY, EMPTY, arangodb::transaction::Options()); std::unique_ptr<arangodb::aql::ExecutionPlan> plan( arangodb::aql::ExecutionPlan::instantiateFromAst(ast, false)); arangodb::iresearch::ByExpression filter; EXPECT_FALSE(filter); filter.init(*plan, *ast, *expression); EXPECT_TRUE(filter); arangodb::iresearch::ExpressionExecutionContext execCtx; ctx.setTrx(&trx); execCtx.ctx = &ctx; FilterCtx queryCtx(execCtx); auto prepared = filter.prepare(*reader, irs::order::prepared::unordered()); auto docs = prepared->execute(segment, irs::order::prepared::unordered(), &queryCtx); EXPECT_EQ(irs::doc_limits::eof(), docs->value()); EXPECT_FALSE(docs->next()); EXPECT_EQ(irs::doc_limits::eof(), docs->value()); } // query with true expression without order { std::string const queryString = "LET c=1 LET b=2 FOR d IN testView FILTER c<b RETURN d"; auto query = arangodb::aql::Query::create(arangodb::transaction::StandaloneContext::Create(vocbase), arangodb::aql::QueryString(queryString), nullptr); query->initTrxForTests(); ExpressionContextMock ctx; { arangodb::aql::AqlValue value(arangodb::aql::AqlValueHintInt{1}); arangodb::aql::AqlValueGuard guard(value, true); ctx.vars.emplace("c", value); } { arangodb::aql::AqlValue value(arangodb::aql::AqlValueHintInt{2}); arangodb::aql::AqlValueGuard guard(value, true); ctx.vars.emplace("b", value); } auto const parseResult = query->parse(); ASSERT_TRUE(parseResult.result.ok()); auto* ast = query->ast(); ASSERT_TRUE(ast); auto* root = ast->root(); ASSERT_TRUE(root); // find first FILTER node arangodb::aql::AstNode* filterNode = nullptr; for (size_t i = 0; i < root->numMembers(); ++i) { auto* node = root->getMemberUnchecked(i); ASSERT_TRUE(node); if (arangodb::aql::NODE_TYPE_FILTER == node->type) { filterNode = node; break; } } ASSERT_TRUE(filterNode); // find expression root auto* expression = filterNode->getMember(0); ASSERT_TRUE(expression); // setup filter std::vector<std::string> EMPTY; arangodb::transaction::Methods trx(arangodb::transaction::StandaloneContext::Create(vocbase), EMPTY, EMPTY, EMPTY, arangodb::transaction::Options()); std::unique_ptr<arangodb::aql::ExecutionPlan> plan( arangodb::aql::ExecutionPlan::instantiateFromAst(ast, false)); arangodb::iresearch::ByExpression filter; EXPECT_FALSE(filter); filter.init(*plan, *ast, *expression); EXPECT_TRUE(filter); arangodb::iresearch::ExpressionExecutionContext execCtx; ctx.setTrx(&trx); execCtx.ctx = &ctx; FilterCtx queryCtx(execCtx); auto prepared = filter.prepare(*reader, irs::order::prepared::unordered(), &queryCtx); EXPECT_EQ(irs::no_boost(), prepared->boost()); // no boost set EXPECT_EQ(typeid(prepared.get()), typeid(irs::all().prepare(*reader).get())); // should be same type auto column = segment.column_reader("name"); ASSERT_TRUE(column); auto columnValues = column->values(); ASSERT_TRUE(columnValues); auto docs = prepared->execute(segment, irs::order::prepared::unordered(), &queryCtx); EXPECT_EQ(irs::doc_limits::invalid(), docs->value()); auto* cost = irs::get<irs::cost>(*docs); ASSERT_TRUE(cost); EXPECT_EQ(arangodb::velocypack::ArrayIterator(testDataRoot).size(), cost->estimate()); irs::bytes_ref value; for (auto doc : arangodb::velocypack::ArrayIterator(testDataRoot)) { EXPECT_TRUE(docs->next()); EXPECT_TRUE(columnValues(docs->value(), value)); EXPECT_TRUE(arangodb::iresearch::getStringRef(doc.get("name")) == irs::to_string<irs::string_ref>(value.c_str())); } EXPECT_FALSE(docs->next()); EXPECT_EQ(irs::doc_limits::eof(), docs->value()); } // query with true expression without order (deferred execution) { std::string const queryString = "LET c=1 LET b=2 FOR d IN testView FILTER c<b RETURN d"; auto query = arangodb::aql::Query::create(arangodb::transaction::StandaloneContext::Create(vocbase), arangodb::aql::QueryString(queryString), nullptr); query->initTrxForTests(); ExpressionContextMock ctx; { arangodb::aql::AqlValue value(arangodb::aql::AqlValueHintInt{1}); arangodb::aql::AqlValueGuard guard(value, true); ctx.vars.emplace("c", value); } { arangodb::aql::AqlValue value(arangodb::aql::AqlValueHintInt{2}); arangodb::aql::AqlValueGuard guard(value, true); ctx.vars.emplace("b", value); } auto const parseResult = query->parse(); ASSERT_TRUE(parseResult.result.ok()); auto* ast = query->ast(); ASSERT_TRUE(ast); auto* root = ast->root(); ASSERT_TRUE(root); // find first FILTER node arangodb::aql::AstNode* filterNode = nullptr; for (size_t i = 0; i < root->numMembers(); ++i) { auto* node = root->getMemberUnchecked(i); ASSERT_TRUE(node); if (arangodb::aql::NODE_TYPE_FILTER == node->type) { filterNode = node; break; } } ASSERT_TRUE(filterNode); // find expression root auto* expression = filterNode->getMember(0); ASSERT_TRUE(expression); // setup filter std::vector<std::string> EMPTY; arangodb::transaction::Methods trx(arangodb::transaction::StandaloneContext::Create(vocbase), EMPTY, EMPTY, EMPTY, arangodb::transaction::Options()); std::unique_ptr<arangodb::aql::ExecutionPlan> plan( arangodb::aql::ExecutionPlan::instantiateFromAst(ast, false)); arangodb::iresearch::ByExpression filter; EXPECT_FALSE(filter); filter.init(*plan, *ast, *expression); EXPECT_TRUE(filter); arangodb::iresearch::ExpressionExecutionContext execCtx; ctx.setTrx(&trx); execCtx.ctx = &ctx; FilterCtx queryCtx(execCtx); auto prepared = filter.prepare(*reader, irs::order::prepared::unordered()); // no context provided EXPECT_EQ(irs::no_boost(), prepared->boost()); // no boost set EXPECT_EQ(typeid(prepared.get()), typeid(irs::all().prepare(*reader).get())); // should be same type auto column = segment.column_reader("name"); ASSERT_TRUE(column); auto columnValues = column->values(); ASSERT_TRUE(columnValues); auto docs = prepared->execute(segment, irs::order::prepared::unordered(), &queryCtx); EXPECT_EQ(irs::doc_limits::invalid(), docs->value()); auto* cost = irs::get<irs::cost>(*docs); ASSERT_TRUE(cost); EXPECT_EQ(arangodb::velocypack::ArrayIterator(testDataRoot).size(), cost->estimate()); irs::bytes_ref value; for (auto doc : arangodb::velocypack::ArrayIterator(testDataRoot)) { EXPECT_TRUE(docs->next()); EXPECT_TRUE(columnValues(docs->value(), value)); EXPECT_TRUE(arangodb::iresearch::getStringRef(doc.get("name")) == irs::to_string<irs::string_ref>(value.c_str())); } EXPECT_FALSE(docs->next()); EXPECT_EQ(irs::doc_limits::eof(), docs->value()); } // query with true expression without order (deferred execution) { std::string const queryString = "LET c=1 LET b=2 FOR d IN testView FILTER c<b RETURN d"; auto query = arangodb::aql::Query::create(arangodb::transaction::StandaloneContext::Create(vocbase), arangodb::aql::QueryString(queryString), nullptr); query->initTrxForTests(); ExpressionContextMock ctx; { arangodb::aql::AqlValue value(arangodb::aql::AqlValueHintInt{1}); arangodb::aql::AqlValueGuard guard(value, true); ctx.vars.emplace("c", value); } { arangodb::aql::AqlValue value(arangodb::aql::AqlValueHintInt{2}); arangodb::aql::AqlValueGuard guard(value, true); ctx.vars.emplace("b", value); } auto const parseResult = query->parse(); ASSERT_TRUE(parseResult.result.ok()); auto* ast = query->ast(); ASSERT_TRUE(ast); auto* root = ast->root(); ASSERT_TRUE(root); // find first FILTER node arangodb::aql::AstNode* filterNode = nullptr; for (size_t i = 0; i < root->numMembers(); ++i) { auto* node = root->getMemberUnchecked(i); ASSERT_TRUE(node); if (arangodb::aql::NODE_TYPE_FILTER == node->type) { filterNode = node; break; } } ASSERT_TRUE(filterNode); // find expression root auto* expression = filterNode->getMember(0); ASSERT_TRUE(expression); // setup filter std::vector<std::string> EMPTY; arangodb::transaction::Methods trx(arangodb::transaction::StandaloneContext::Create(vocbase), EMPTY, EMPTY, EMPTY, arangodb::transaction::Options()); std::unique_ptr<arangodb::aql::ExecutionPlan> plan( arangodb::aql::ExecutionPlan::instantiateFromAst(ast, false)); arangodb::iresearch::ByExpression filter; EXPECT_FALSE(filter); filter.init(*plan, *ast, *expression); EXPECT_TRUE(filter); arangodb::iresearch::ExpressionExecutionContext execCtx; ctx.setTrx(&trx); execCtx.ctx = nullptr; FilterCtx queryCtx(execCtx); auto prepared = filter.prepare(*reader, irs::order::prepared::unordered(), &queryCtx); // invalid context provided EXPECT_EQ(irs::no_boost(), prepared->boost()); // no boost set auto column = segment.column_reader("name"); ASSERT_TRUE(column); auto columnValues = column->values(); ASSERT_TRUE(columnValues); execCtx.ctx = &ctx; // fix context auto docs = prepared->execute(segment, irs::order::prepared::unordered(), &queryCtx); EXPECT_EQ(irs::doc_limits::invalid(), docs->value()); auto* cost = irs::get<irs::cost>(*docs); ASSERT_TRUE(cost); EXPECT_EQ(arangodb::velocypack::ArrayIterator(testDataRoot).size(), cost->estimate()); irs::bytes_ref value; for (auto doc : arangodb::velocypack::ArrayIterator(testDataRoot)) { EXPECT_TRUE(docs->next()); EXPECT_TRUE(columnValues(docs->value(), value)); EXPECT_TRUE(arangodb::iresearch::getStringRef(doc.get("name")) == irs::to_string<irs::string_ref>(value.c_str())); } EXPECT_FALSE(docs->next()); EXPECT_EQ(irs::doc_limits::eof(), docs->value()); } // query with true expression without order (deferred execution with invalid context) { std::string const queryString = "LET c=1 LET b=2 FOR d IN testView FILTER c<b RETURN d"; auto query = arangodb::aql::Query::create(arangodb::transaction::StandaloneContext::Create(vocbase), arangodb::aql::QueryString(queryString), nullptr); query->initTrxForTests(); ExpressionContextMock ctx; { arangodb::aql::AqlValue value(arangodb::aql::AqlValueHintInt{1}); arangodb::aql::AqlValueGuard guard(value, true); ctx.vars.emplace("c", value); } { arangodb::aql::AqlValue value(arangodb::aql::AqlValueHintInt{2}); arangodb::aql::AqlValueGuard guard(value, true); ctx.vars.emplace("b", value); } auto const parseResult = query->parse(); ASSERT_TRUE(parseResult.result.ok()); auto* ast = query->ast(); ASSERT_TRUE(ast); auto* root = ast->root(); ASSERT_TRUE(root); // find first FILTER node arangodb::aql::AstNode* filterNode = nullptr; for (size_t i = 0; i < root->numMembers(); ++i) { auto* node = root->getMemberUnchecked(i); ASSERT_TRUE(node); if (arangodb::aql::NODE_TYPE_FILTER == node->type) { filterNode = node; break; } } ASSERT_TRUE(filterNode); // find expression root auto* expression = filterNode->getMember(0); ASSERT_TRUE(expression); // setup filter std::vector<std::string> EMPTY; arangodb::transaction::Methods trx(arangodb::transaction::StandaloneContext::Create(vocbase), EMPTY, EMPTY, EMPTY, arangodb::transaction::Options()); std::unique_ptr<arangodb::aql::ExecutionPlan> plan( arangodb::aql::ExecutionPlan::instantiateFromAst(ast, false)); arangodb::iresearch::ByExpression filter; EXPECT_FALSE(filter); filter.init(*plan, *ast, *expression); EXPECT_TRUE(filter); arangodb::iresearch::ExpressionExecutionContext execCtx; ctx.setTrx(&trx); execCtx.ctx = nullptr; FilterCtx queryCtx(execCtx); auto prepared = filter.prepare(*reader, irs::order::prepared::unordered()); // no context provided EXPECT_EQ(irs::no_boost(), prepared->boost()); // no boost set auto docs = prepared->execute(segment, irs::order::prepared::unordered(), &queryCtx); EXPECT_TRUE(irs::doc_limits::eof(docs->value())); EXPECT_FALSE(docs->next()); } // query with true expression without order (deferred execution with invalid context) { std::string const queryString = "LET c=1 LET b=2 FOR d IN testView FILTER c<b RETURN d"; auto query = arangodb::aql::Query::create(arangodb::transaction::StandaloneContext::Create(vocbase), arangodb::aql::QueryString(queryString), nullptr); query->initTrxForTests(); ExpressionContextMock ctx; { arangodb::aql::AqlValue value(arangodb::aql::AqlValueHintInt{1}); arangodb::aql::AqlValueGuard guard(value, true); ctx.vars.emplace("c", value); } { arangodb::aql::AqlValue value(arangodb::aql::AqlValueHintInt{2}); arangodb::aql::AqlValueGuard guard(value, true); ctx.vars.emplace("b", value); } auto const parseResult = query->parse(); ASSERT_TRUE(parseResult.result.ok()); auto* ast = query->ast(); ASSERT_TRUE(ast); auto* root = ast->root(); ASSERT_TRUE(root); // find first FILTER node arangodb::aql::AstNode* filterNode = nullptr; for (size_t i = 0; i < root->numMembers(); ++i) { auto* node = root->getMemberUnchecked(i); ASSERT_TRUE(node); if (arangodb::aql::NODE_TYPE_FILTER == node->type) { filterNode = node; break; } } ASSERT_TRUE(filterNode); // find expression root auto* expression = filterNode->getMember(0); ASSERT_TRUE(expression); // setup filter std::vector<std::string> EMPTY; arangodb::transaction::Methods trx(arangodb::transaction::StandaloneContext::Create(vocbase), EMPTY, EMPTY, EMPTY, arangodb::transaction::Options()); std::unique_ptr<arangodb::aql::ExecutionPlan> plan( arangodb::aql::ExecutionPlan::instantiateFromAst(ast, false)); arangodb::iresearch::ByExpression filter; EXPECT_FALSE(filter); filter.init(*plan, *ast, *expression); EXPECT_TRUE(filter); arangodb::iresearch::ExpressionExecutionContext execCtx; ctx.setTrx(&trx); execCtx.ctx = nullptr; FilterCtx queryCtx(execCtx); auto prepared = filter.prepare(*reader, irs::order::prepared::unordered()); // no context provided EXPECT_EQ(irs::no_boost(), prepared->boost()); // no boost set auto docs = prepared->execute(segment, irs::order::prepared::unordered(), &queryCtx); EXPECT_TRUE(irs::doc_limits::eof(docs->value())); EXPECT_FALSE(docs->next()); } // query with nondeterministic expression without order { std::string const queryString = "LET c=1 LET b=2 FOR d IN testView FILTER " "_REFERENCE_(c)==_REFERENCE_(b) RETURN d"; auto query = arangodb::aql::Query::create(arangodb::transaction::StandaloneContext::Create(vocbase), arangodb::aql::QueryString(queryString), nullptr); query->initTrxForTests(); ExpressionContextMock ctx; { arangodb::aql::AqlValue value(arangodb::aql::AqlValueHintInt{2}); arangodb::aql::AqlValueGuard guard(value, true); ctx.vars.emplace("b", value); } auto const parseResult = query->parse(); ASSERT_TRUE(parseResult.result.ok()); auto* ast = query->ast(); ASSERT_TRUE(ast); auto* root = ast->root(); ASSERT_TRUE(root); // find first FILTER node arangodb::aql::AstNode* filterNode = nullptr; for (size_t i = 0; i < root->numMembers(); ++i) { auto* node = root->getMemberUnchecked(i); ASSERT_TRUE(node); if (arangodb::aql::NODE_TYPE_FILTER == node->type) { filterNode = node; break; } } ASSERT_TRUE(filterNode); // find expression root auto* expression = filterNode->getMember(0); ASSERT_TRUE(expression); // setup filter std::vector<std::string> EMPTY; arangodb::transaction::Methods trx(arangodb::transaction::StandaloneContext::Create(vocbase), EMPTY, EMPTY, EMPTY, arangodb::transaction::Options()); std::unique_ptr<arangodb::aql::ExecutionPlan> plan( arangodb::aql::ExecutionPlan::instantiateFromAst(ast, false)); arangodb::iresearch::ByExpression filter; EXPECT_FALSE(filter); filter.init(*plan, *ast, *expression); EXPECT_TRUE(filter); arangodb::iresearch::ExpressionExecutionContext execCtx; ctx.setTrx(&trx); execCtx.ctx = &ctx; FilterCtx queryCtx(execCtx); auto prepared = filter.prepare(*reader, irs::order::prepared::unordered(), &queryCtx); auto column = segment.column_reader("name"); ASSERT_TRUE(column); auto columnValues = column->values(); ASSERT_TRUE(columnValues); auto docs = prepared->execute(segment, irs::order::prepared::unordered(), &queryCtx); EXPECT_EQ(irs::doc_limits::invalid(), docs->value()); auto* score = irs::get<irs::score>(*docs); EXPECT_TRUE(score); EXPECT_TRUE(score->is_default()); // set reachable filter condition { ctx.vars.erase("c"); arangodb::aql::AqlValue value(arangodb::aql::AqlValueHintInt{2}); arangodb::aql::AqlValueGuard guard(value, true); ctx.vars.emplace("c", value); } irs::bytes_ref keyValue; auto it = arangodb::velocypack::ArrayIterator(testDataRoot); for (size_t i = 0; i < it.size() / 2; ++i) { ASSERT_TRUE(it.valid()); auto doc = *it; EXPECT_TRUE(docs->next()); EXPECT_TRUE(columnValues(docs->value(), keyValue)); EXPECT_TRUE(arangodb::iresearch::getStringRef(doc.get("name")) == irs::to_string<irs::string_ref>(keyValue.c_str())); it.next(); } EXPECT_TRUE(it.valid()); // set unreachable filter condition { ctx.vars.erase("c"); arangodb::aql::AqlValue value(arangodb::aql::AqlValueHintInt{1}); arangodb::aql::AqlValueGuard guard(value, true); ctx.vars.emplace("c", value); } EXPECT_FALSE(docs->next()); EXPECT_EQ(irs::doc_limits::eof(), docs->value()); } // query with nondeterministic expression and custom order { irs::order order; size_t collector_finish_count = 0; size_t field_collector_collect_count = 0; size_t term_collector_collect_count = 0; size_t scorer_score_count = 0; auto& sort = order.add<custom_sort>(false); sort.field_collector_collect = [&field_collector_collect_count](const irs::sub_reader&, const irs::term_reader&) -> void { ++field_collector_collect_count; }; sort.collector_finish = [&collector_finish_count](irs::byte_type*, const irs::index_reader&) -> void { ++collector_finish_count; }; sort.term_collector_collect = [&term_collector_collect_count](const irs::sub_reader&, const irs::term_reader&, const irs::attribute_provider&) -> void { ++term_collector_collect_count; }; sort.scorer_add = [](irs::doc_id_t& dst, const irs::doc_id_t& src) -> void { dst = src; }; sort.scorer_less = [](const irs::doc_id_t& lhs, const irs::doc_id_t& rhs) -> bool { return (lhs & 0xAAAAAAAAAAAAAAAA) < (rhs & 0xAAAAAAAAAAAAAAAA); }; sort.scorer_score = [&scorer_score_count](irs::doc_id_t) -> void { ++scorer_score_count; }; auto preparedOrder = order.prepare(); std::string const queryString = "LET c=1 LET b=2 FOR d IN testView FILTER " "_REFERENCE_(c)==_REFERENCE_(b) RETURN d"; auto query = arangodb::aql::Query::create(arangodb::transaction::StandaloneContext::Create(vocbase), arangodb::aql::QueryString(queryString), nullptr); query->initTrxForTests(); ExpressionContextMock ctx; { arangodb::aql::AqlValue value(arangodb::aql::AqlValueHintInt{2}); arangodb::aql::AqlValueGuard guard(value, true); ctx.vars.emplace("b", value); } auto const parseResult = query->parse(); ASSERT_TRUE(parseResult.result.ok()); auto* ast = query->ast(); ASSERT_TRUE(ast); auto* root = ast->root(); ASSERT_TRUE(root); // find first FILTER node arangodb::aql::AstNode* filterNode = nullptr; for (size_t i = 0; i < root->numMembers(); ++i) { auto* node = root->getMemberUnchecked(i); ASSERT_TRUE(node); if (arangodb::aql::NODE_TYPE_FILTER == node->type) { filterNode = node; break; } } ASSERT_TRUE(filterNode); // find expression root auto* expression = filterNode->getMember(0); ASSERT_TRUE(expression); // setup filter std::vector<std::string> EMPTY; arangodb::transaction::Methods trx(arangodb::transaction::StandaloneContext::Create(vocbase), EMPTY, EMPTY, EMPTY, arangodb::transaction::Options()); std::unique_ptr<arangodb::aql::ExecutionPlan> plan( arangodb::aql::ExecutionPlan::instantiateFromAst(ast, false)); arangodb::iresearch::ByExpression filter; EXPECT_FALSE(filter); filter.init(*plan, *ast, *expression); EXPECT_TRUE(filter); arangodb::iresearch::ExpressionExecutionContext execCtx; ctx.setTrx(&trx); execCtx.ctx = &ctx; FilterCtx queryCtx(execCtx); filter.boost(1.5f); EXPECT_EQ(1.5f, filter.boost()); auto prepared = filter.prepare(*reader, preparedOrder, &queryCtx); EXPECT_EQ(1.5f, prepared->boost()); auto column = segment.column_reader("name"); ASSERT_TRUE(column); auto columnValues = column->values(); ASSERT_TRUE(columnValues); auto docs = prepared->execute(segment, preparedOrder, &queryCtx); EXPECT_EQ(irs::doc_limits::invalid(), docs->value()); auto* score = irs::get<irs::score>(*docs); EXPECT_TRUE(score); EXPECT_FALSE(score->is_default()); auto* cost = irs::get<irs::cost>(*docs); ASSERT_TRUE(cost); EXPECT_EQ(arangodb::velocypack::ArrayIterator(testDataRoot).size(), cost->estimate()); // set reachable filter condition { ctx.vars.erase("c"); arangodb::aql::AqlValue value(arangodb::aql::AqlValueHintInt{2}); arangodb::aql::AqlValueGuard guard(value, true); ctx.vars.emplace("c", value); } irs::bytes_ref keyValue; auto it = arangodb::velocypack::ArrayIterator(testDataRoot); for (size_t i = 0; i < it.size() / 2; ++i) { ASSERT_TRUE(it.valid()); auto doc = *it; EXPECT_TRUE(docs->next()); [[maybe_unused]] auto* scoreValue = score->evaluate(); EXPECT_TRUE(columnValues(docs->value(), keyValue)); EXPECT_TRUE(arangodb::iresearch::getStringRef(doc.get("name")) == irs::to_string<irs::string_ref>(keyValue.c_str())); it.next(); } EXPECT_TRUE(it.valid()); // set unreachable filter condition { ctx.vars.erase("c"); arangodb::aql::AqlValue value(arangodb::aql::AqlValueHintInt{1}); arangodb::aql::AqlValueGuard guard(value, true); ctx.vars.emplace("c", value); } EXPECT_FALSE(docs->next()); EXPECT_EQ(irs::doc_limits::eof(), docs->value()); // check order EXPECT_EQ(0, field_collector_collect_count); // should not be executed EXPECT_EQ(0, term_collector_collect_count); // should not be executed EXPECT_EQ(1, collector_finish_count); EXPECT_EQ(it.size() / 2, scorer_score_count); } // query with nondeterministic expression without order, seek + next { std::shared_ptr<arangodb::velocypack::Builder> bindVars; std::string const queryString = "LET c=1 LET b=2 FOR d IN testView FILTER " "_REFERENCE_(c)==_REFERENCE_(b) RETURN d"; auto query = arangodb::aql::Query::create(arangodb::transaction::StandaloneContext::Create(vocbase), arangodb::aql::QueryString(queryString), bindVars); query->initTrxForTests(); ExpressionContextMock ctx; { arangodb::aql::AqlValue value(arangodb::aql::AqlValueHintInt{2}); arangodb::aql::AqlValueGuard guard(value, true); ctx.vars.emplace("b", value); } auto const parseResult = query->parse(); ASSERT_TRUE(parseResult.result.ok()); auto* ast = query->ast(); ASSERT_TRUE(ast); auto* root = ast->root(); ASSERT_TRUE(root); // find first FILTER node arangodb::aql::AstNode* filterNode = nullptr; for (size_t i = 0; i < root->numMembers(); ++i) { auto* node = root->getMemberUnchecked(i); ASSERT_TRUE(node); if (arangodb::aql::NODE_TYPE_FILTER == node->type) { filterNode = node; break; } } ASSERT_TRUE(filterNode); // find expression root auto* expression = filterNode->getMember(0); ASSERT_TRUE(expression); // setup filter std::vector<std::string> EMPTY; arangodb::transaction::Methods trx(arangodb::transaction::StandaloneContext::Create(vocbase), EMPTY, EMPTY, EMPTY, arangodb::transaction::Options()); std::unique_ptr<arangodb::aql::ExecutionPlan> plan( arangodb::aql::ExecutionPlan::instantiateFromAst(ast, false)); arangodb::iresearch::ByExpression filter; EXPECT_FALSE(filter); filter.init(*plan, *ast, *expression); EXPECT_TRUE(filter); arangodb::iresearch::ExpressionExecutionContext execCtx; ctx.setTrx(&trx); execCtx.ctx = &ctx; FilterCtx queryCtx(execCtx); auto prepared = filter.prepare(*reader, irs::order::prepared::unordered(), &queryCtx); auto column = segment.column_reader("name"); ASSERT_TRUE(column); auto columnValues = column->values(); ASSERT_TRUE(columnValues); auto docs = prepared->execute(segment, irs::order::prepared::unordered(), &queryCtx); EXPECT_EQ(irs::doc_limits::invalid(), docs->value()); auto* score = irs::get<irs::score>(*docs); EXPECT_TRUE(score); EXPECT_TRUE(score->is_default()); auto* cost = irs::get<irs::cost>(*docs); ASSERT_TRUE(cost); EXPECT_EQ(arangodb::velocypack::ArrayIterator(testDataRoot).size(), cost->estimate()); // set reachable filter condition { ctx.vars.erase("c"); arangodb::aql::AqlValue value(arangodb::aql::AqlValueHintInt{2}); arangodb::aql::AqlValueGuard guard(value, true); ctx.vars.emplace("c", value); } auto it = arangodb::velocypack::ArrayIterator(testDataRoot); irs::bytes_ref keyValue; size_t const seek_to = 7; for (size_t i = 0; i < seek_to; ++i) { it.next(); ASSERT_TRUE(it.valid()); } EXPECT_EQ(seek_to, docs->seek(seek_to)); for (size_t i = seek_to; i < it.size() / 2; ++i) { ASSERT_TRUE(it.valid()); auto doc = *it; EXPECT_TRUE(docs->next()); EXPECT_TRUE(columnValues(docs->value(), keyValue)); EXPECT_TRUE(arangodb::iresearch::getStringRef(doc.get("name")) == irs::to_string<irs::string_ref>(keyValue.c_str())); it.next(); } EXPECT_TRUE(it.valid()); // set unreachable filter condition { ctx.vars.erase("c"); arangodb::aql::AqlValue value(arangodb::aql::AqlValueHintInt{1}); arangodb::aql::AqlValueGuard guard(value, true); ctx.vars.emplace("c", value); } EXPECT_FALSE(docs->next()); EXPECT_EQ(irs::doc_limits::eof(), docs->value()); } }
35.779401
136
0.641501
kapahimansi123
f365cf2c3b1d1b1e63bc6bbc4acf0688f8cf2310
11,883
cpp
C++
src/algebra/curves/edwards/edwards_g2.cpp
amiller/libsnark
d34b477ed9c0e36f74c78946012658bdecde0c00
[ "MIT" ]
null
null
null
src/algebra/curves/edwards/edwards_g2.cpp
amiller/libsnark
d34b477ed9c0e36f74c78946012658bdecde0c00
[ "MIT" ]
null
null
null
src/algebra/curves/edwards/edwards_g2.cpp
amiller/libsnark
d34b477ed9c0e36f74c78946012658bdecde0c00
[ "MIT" ]
null
null
null
/** @file ***************************************************************************** * @author This file is part of libsnark, developed by SCIPR Lab * and contributors (see AUTHORS). * @copyright MIT license (see LICENSE file) *****************************************************************************/ #include "algebra/curves/edwards/edwards_g2.hpp" namespace libsnark { #ifdef PROFILE_OP_COUNTS long long edwards_G2::add_cnt = 0; long long edwards_G2::dbl_cnt = 0; #endif std::vector<size_t> edwards_G2::wnaf_window_table; std::vector<size_t> edwards_G2::fixed_base_exp_window_table; edwards_G2 edwards_G2::G2_zero; edwards_G2 edwards_G2::G2_one; edwards_G2::edwards_G2() { this->X = G2_zero.X; this->Y = G2_zero.Y; this->Z = G2_zero.Z; } edwards_Fq3 edwards_G2::mul_by_a(const edwards_Fq3 &elt) { // should be // edwards_Fq3(edwards_twist_mul_by_a_c0 * elt.c2, edwards_twist_mul_by_a_c1 * elt.c0, edwards_twist_mul_by_a_c2 * elt.c1) // but optimizing the fact that edwards_twist_mul_by_a_c1 = edwards_twist_mul_by_a_c2 = 1 return edwards_Fq3(edwards_twist_mul_by_a_c0 * elt.c2, elt.c0, elt.c1); } edwards_Fq3 edwards_G2::mul_by_d(const edwards_Fq3 &elt) { return edwards_Fq3(edwards_twist_mul_by_d_c0 * elt.c2, edwards_twist_mul_by_d_c1 * elt.c0, edwards_twist_mul_by_d_c2 * elt.c1); } void edwards_G2::print() const { if (this->is_zero()) { printf("O\n"); } else { edwards_G2 copy(*this); copy.to_affine_coordinates(); gmp_printf("(%Nd*z^2 + %Nd*z + %Nd , %Nd*z^2 + %Nd*z + %Nd)\n", copy.X.c2.as_bigint().data, edwards_Fq::num_limbs, copy.X.c1.as_bigint().data, edwards_Fq::num_limbs, copy.X.c0.as_bigint().data, edwards_Fq::num_limbs, copy.Y.c2.as_bigint().data, edwards_Fq::num_limbs, copy.Y.c1.as_bigint().data, edwards_Fq::num_limbs, copy.Y.c0.as_bigint().data, edwards_Fq::num_limbs); } } void edwards_G2::print_coordinates() const { if (this->is_zero()) { printf("O\n"); } else { gmp_printf("(%Nd*z^2 + %Nd*z + %Nd : %Nd*z^2 + %Nd*z + %Nd : %Nd*z^2 + %Nd*z + %Nd)\n", this->X.c2.as_bigint().data, edwards_Fq::num_limbs, this->X.c1.as_bigint().data, edwards_Fq::num_limbs, this->X.c0.as_bigint().data, edwards_Fq::num_limbs, this->Y.c2.as_bigint().data, edwards_Fq::num_limbs, this->Y.c1.as_bigint().data, edwards_Fq::num_limbs, this->Y.c0.as_bigint().data, edwards_Fq::num_limbs, this->Z.c2.as_bigint().data, edwards_Fq::num_limbs, this->Z.c1.as_bigint().data, edwards_Fq::num_limbs, this->Z.c0.as_bigint().data, edwards_Fq::num_limbs); } } void edwards_G2::to_affine_coordinates() { if (this->is_zero()) { this->X = edwards_Fq3::zero(); this->Y = edwards_Fq3::one(); this->Z = edwards_Fq3::one(); } else { // go from inverted coordinates to projective coordinates edwards_Fq3 tX = this->Y * this->Z; edwards_Fq3 tY = this->X * this->Z; edwards_Fq3 tZ = this->X * this->Y; // go from projective coordinates to affine coordinates edwards_Fq3 tZ_inv = tZ.inverse(); this->X = tX * tZ_inv; this->Y = tY * tZ_inv; this->Z = edwards_Fq3::one(); } } void edwards_G2::to_special() { if (this->Z.is_zero()) { return; } #ifdef DEBUG const edwards_G2 copy(*this); #endif edwards_Fq3 Z_inv = this->Z.inverse(); this->X = this->X * Z_inv; this->Y = this->Y * Z_inv; this->Z = edwards_Fq3::one(); #ifdef DEBUG assert((*this) == copy); #endif } bool edwards_G2::is_special() const { return (this->is_zero() || this->Z == edwards_Fq3::one()); } bool edwards_G2::is_zero() const { return (this->Y.is_zero() && this->Z.is_zero()); } bool edwards_G2::operator==(const edwards_G2 &other) const { if (this->is_zero()) { return other.is_zero(); } if (other.is_zero()) { return false; } /* now neither is O */ // X1/Z1 = X2/Z2 <=> X1*Z2 = X2*Z1 if ((this->X * other.Z) != (other.X * this->Z)) { return false; } // Y1/Z1 = Y2/Z2 <=> Y1*Z2 = Y2*Z1 if ((this->Y * other.Z) != (other.Y * this->Z)) { return false; } return true; } bool edwards_G2::operator!=(const edwards_G2& other) const { return !(operator==(other)); } edwards_G2 edwards_G2::operator+(const edwards_G2 &other) const { // handle special cases having to do with O if (this->is_zero()) { return other; } if (other.is_zero()) { return (*this); } return this->add(other); } edwards_G2 edwards_G2::operator-() const { return edwards_G2(-(this->X), this->Y, this->Z); } edwards_G2 edwards_G2::operator-(const edwards_G2 &other) const { return (*this) + (-other); } edwards_G2 edwards_G2::add(const edwards_G2 &other) const { #ifdef PROFILE_OP_COUNTS this->add_cnt++; #endif // NOTE: does not handle O and pts of order 2,4 // http://www.hyperelliptic.org/EFD/g1p/auto-twisted-inverted.html#addition-add-2008-bbjlp const edwards_Fq3 A = (this->Z) * (other.Z); // A = Z1*Z2 const edwards_Fq3 B = edwards_G2::mul_by_d(A.squared()); // B = d*A^2 const edwards_Fq3 C = (this->X) * (other.X); // C = X1*X2 const edwards_Fq3 D = (this->Y) * (other.Y); // D = Y1*Y2 const edwards_Fq3 E = C*D; // E = C*D const edwards_Fq3 H = C - edwards_G2::mul_by_a(D); // H = C-a*D const edwards_Fq3 I = (this->X+this->Y)*(other.X+other.Y)-C-D; // I = (X1+Y1)*(X2+Y2)-C-D const edwards_Fq3 X3 = (E+B)*H; // X3 = (E+B)*H const edwards_Fq3 Y3 = (E-B)*I; // Y3 = (E-B)*I const edwards_Fq3 Z3 = A*H*I; // Z3 = A*H*I return edwards_G2(X3, Y3, Z3); } edwards_G2 edwards_G2::fast_add_special(const edwards_G2 &other) const { #ifdef PROFILE_OP_COUNTS this->add_cnt++; #endif // handle special cases having to do with O if (this->is_zero()) { return other; } if (other.is_zero()) { return *this; } #ifdef DEBUG assert(other.is_special()); #endif // NOTE: does not handle O and pts of order 2,4 // http://www.hyperelliptic.org/EFD/g1p/auto-edwards-inverted.html#addition-madd-2007-lb const edwards_Fq3 A = this->Z; // A = Z1*Z2 const edwards_Fq3 B = edwards_G2::mul_by_d(A.squared()); // B = d*A^2 const edwards_Fq3 C = (this->X) * (other.X); // C = X1*X2 const edwards_Fq3 D = (this->Y) * (other.Y); // D = Y1*Y2 const edwards_Fq3 E = C*D; // E = C*D const edwards_Fq3 H = C - edwards_G2::mul_by_a(D); // H = C-a*D const edwards_Fq3 I = (this->X+this->Y)*(other.X+other.Y)-C-D; // I = (X1+Y1)*(X2+Y2)-C-D const edwards_Fq3 X3 = (E+B)*H; // X3 = (E+B)*H const edwards_Fq3 Y3 = (E-B)*I; // Y3 = (E-B)*I const edwards_Fq3 Z3 = A*H*I; // Z3 = A*H*I return edwards_G2(X3, Y3, Z3); } edwards_G2 edwards_G2::dbl() const { #ifdef PROFILE_OP_COUNTS this->dbl_cnt++; #endif if (this->is_zero()) { return (*this); } else { // NOTE: does not handle O and pts of order 2,4 // http://www.hyperelliptic.org/EFD/g1p/auto-twisted-inverted.html#doubling-dbl-2008-bbjlp const edwards_Fq3 A = (this->X).squared(); // A = X1^2 const edwards_Fq3 B = (this->Y).squared(); // B = Y1^2 const edwards_Fq3 U = edwards_G2::mul_by_a(B); // U = a*B const edwards_Fq3 C = A+U; // C = A+U const edwards_Fq3 D = A-U; // D = A-U const edwards_Fq3 E = (this->X+this->Y).squared()-A-B; // E = (X1+Y1)^2-A-B const edwards_Fq3 X3 = C*D; // X3 = C*D const edwards_Fq3 dZZ = edwards_G2::mul_by_d(this->Z.squared()); const edwards_Fq3 Y3 = E*(C-dZZ-dZZ); // Y3 = E*(C-2*d*Z1^2) const edwards_Fq3 Z3 = D*E; // Z3 = D*E return edwards_G2(X3, Y3, Z3); } } edwards_G2 edwards_G2::mul_by_q() const { return edwards_G2((this->X).Frobenius_map(1), edwards_twist_mul_by_q_Y * (this->Y).Frobenius_map(1), edwards_twist_mul_by_q_Z * (this->Z).Frobenius_map(1)); } bool edwards_G2::is_well_formed() const { /* Note that point at infinity is the only special case we must check as inverted representation does no cover points (0, +-c) and (+-c, 0). */ if (this->is_zero()) { return true; } else { /* a x^2 + y^2 = 1 + d x^2 y^2 We are using inverted, so equation we need to check is actually a (z/x)^2 + (z/y)^2 = 1 + d z^4 / (x^2 * y^2) z^2 (a y^2 + x^2 - dz^2) = x^2 y^2 */ edwards_Fq3 X2 = this->X.squared(); edwards_Fq3 Y2 = this->Y.squared(); edwards_Fq3 Z2 = this->Z.squared(); edwards_Fq3 aY2 = edwards_G2::mul_by_a(Y2); edwards_Fq3 dZ2 = edwards_G2::mul_by_d(Z2); return (Z2 * (aY2 + X2 - dZ2) == X2 * Y2); } } edwards_G2 edwards_G2::zero() { return G2_zero; } edwards_G2 edwards_G2::one() { return G2_one; } edwards_G2 edwards_G2::random_element() { return edwards_Fr::random_element().as_bigint() * G2_one; } std::ostream& operator<<(std::ostream &out, const edwards_G2 &g) { edwards_G2 copy(g); copy.to_affine_coordinates(); #ifdef NO_PT_COMPRESSION out << copy.X << OUTPUT_SEPARATOR << copy.Y; #else /* storing LSB of Y */ out << copy.X << OUTPUT_SEPARATOR << (copy.Y.c0.as_bigint().data[0] & 1); #endif return out; } std::istream& operator>>(std::istream &in, edwards_G2 &g) { edwards_Fq3 tX, tY; #ifdef NO_PT_COMPRESSION in >> tX; consume_OUTPUT_SEPARATOR(in); in >> tY; #else /* a x^2 + y^2 = 1 + d x^2 y^2 y = sqrt((1-ax^2)/(1-dx^2)) */ unsigned char Y_lsb; in >> tX; consume_OUTPUT_SEPARATOR(in); in.read((char*)&Y_lsb, 1); Y_lsb -= '0'; edwards_Fq3 tX2 = tX.squared(); const edwards_Fq3 tY2 = (edwards_Fq3::one() - edwards_G2::mul_by_a(tX2)) * (edwards_Fq3::one() - edwards_G2::mul_by_d(tX2)).inverse(); tY = tY2.sqrt(); if ((tY.c0.as_bigint().data[0] & 1) != Y_lsb) { tY = -tY; } #endif // using inverted coordinates g.X = tY; g.Y = tX; g.Z = tX * tY; #ifdef USE_ADD_SPECIAL g.to_special(); #endif return in; } template<typename T> void batch_to_special_all_non_zeros(std::vector<T> &vec); template<> void batch_to_special_all_non_zeros<edwards_G2>(std::vector<edwards_G2> &vec) { std::vector<edwards_Fq3> Z_vec; Z_vec.reserve(vec.size()); for (auto &el: vec) { Z_vec.emplace_back(el.Z); } batch_invert<edwards_Fq3>(Z_vec); const edwards_Fq3 one = edwards_Fq3::one(); for (size_t i = 0; i < vec.size(); ++i) { vec[i].X = vec[i].X * Z_vec[i]; vec[i].Y = vec[i].Y * Z_vec[i]; vec[i].Z = one; } } } // libsnark
28.496403
128
0.541698
amiller
f366b8e91529b3cc3caf3050449ada5fd5fb2e33
1,279
cpp
C++
aoj/ALDS1/ALDS5B/main.cpp
xirc/cp-algorithm
89c67cff2f00459c5bb020ab44bff5ae419a1728
[ "Apache-2.0" ]
8
2020-12-23T07:54:53.000Z
2021-11-23T02:46:35.000Z
aoj/ALDS1/ALDS5B/main.cpp
xirc/cp-algorithm
89c67cff2f00459c5bb020ab44bff5ae419a1728
[ "Apache-2.0" ]
1
2020-11-07T13:22:29.000Z
2020-12-20T12:54:00.000Z
aoj/ALDS1/ALDS5B/main.cpp
xirc/cp-algorithm
89c67cff2f00459c5bb020ab44bff5ae419a1728
[ "Apache-2.0" ]
1
2021-01-16T03:40:10.000Z
2021-01-16T03:40:10.000Z
#include <bits/stdc++.h> using namespace std; void dump(vector<int>& A) { for (int i = 0; i < A.size(); ++i) { if (i > 0) cout << " "; cout << A[i]; } cout << endl; } const int inf = 1e9+1; int merge(vector<int>& A, int l, int m, int r) { int count = 0; const int n1 = m - l; const int n2 = r - m; vector<int> L(n1 + 1), R(n2 + 1); copy(A.begin() + l, A.begin() + m, L.begin()); copy(A.begin() + m, A.begin() + r, R.begin()); L[n1] = inf; R[n2] = inf; int i = 0, j = 0; for (int k = l; k < r; ++k) { count++; if (L[i] <= R[j]) { A[k] = L[i]; i++; } else { A[k] = R[j]; j++; } } return count; } int merge_sort(vector<int>& A, int l, int r) { if (r - l <= 1) return 0; int count = 0; int m = (l + r) / 2; count += merge_sort(A, l, m); count += merge_sort(A, m, r); count += merge(A, l, m, r); return count; } int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); int N; cin >> N; vector<int> A(N); for (int i = 0; i < N; ++i) { cin >> A[i]; } int count = merge_sort(A, 0, N); dump(A); cout << count << endl; return 0; }
20.301587
50
0.42846
xirc
f372494af13e38f70e6df7a924e52bbcb8a6ec6c
3,222
cpp
C++
CoreTest/FaceTest.cpp
PremiumGraphicsCodes/CGLib
eecd73c5af1a9e0c044e7d675318dbb496aec6b5
[ "MIT" ]
null
null
null
CoreTest/FaceTest.cpp
PremiumGraphicsCodes/CGLib
eecd73c5af1a9e0c044e7d675318dbb496aec6b5
[ "MIT" ]
null
null
null
CoreTest/FaceTest.cpp
PremiumGraphicsCodes/CGLib
eecd73c5af1a9e0c044e7d675318dbb496aec6b5
[ "MIT" ]
1
2022-02-03T08:09:03.000Z
2022-02-03T08:09:03.000Z
#include "stdafx.h" #include "../Core/Face.h" #include "../Core/Vertex.h" #include "../Core/FaceBuilder.h" using namespace Crystal::Math; using namespace Crystal::Core; TEST(FaceTest, TestGetArea) { Vertex v1(Vector3d<float>(-1, 0, 0), 0); Vertex v2(Vector3d<float>( 1, 0, 0), 0); Vertex v3(Vector3d<float>( 1, 1, 0), 0); FaceBuilder builder({ &v1, &v2, &v3 }); auto f = builder.build(0, 1, 2); EXPECT_FLOAT_EQ(1, f->getArea()); v3.moveTo(Vector3d<float>(1, -2, 0)); EXPECT_FLOAT_EQ(2, f->getArea()); } TEST(FaceTest, TestGetOrientation) { Vertex v1(Vector3d<float>(-1, 0, 0), 0); Vertex v2(Vector3d<float>( 1, 0, 0), 0); Vertex v3(Vector3d<float>( 1, 1, 0), 0); FaceBuilder builder({ &v1, &v2, &v3 }); auto f = builder.build(0, 1, 2); EXPECT_EQ( Orientation::CCW, f->getOrientation(Vector3d<float>(0, 0, 1))); EXPECT_EQ( Orientation::CW, f->getOrientation(Vector3d<float>(0, 0,-1))); v3.moveTo(Vector3d<float>(1, -2, 0)); EXPECT_EQ( Orientation::CW, f->getOrientation(Vector3d<float>(0, 0, 1))); EXPECT_EQ( Orientation::CCW, f->getOrientation(Vector3d<float>(0, 0, -1))); EXPECT_EQ( Orientation::None, f->getOrientation(Vector3d<float>(1, 1, 0))); } TEST(FaceTest, TestToDegenerate) { Vertex v1(Vector3d<float>(-1, 0, 0), 0); Vertex v2(Vector3d<float>(1, 0, 0), 0); Vertex v3(Vector3d<float>(1, 1, 0), 0); FaceBuilder builder({ &v1, &v2, &v3 }); auto f = builder.build(0, 1, 2); EXPECT_FALSE(f->isDegenerated()); f->toDegenerate(); EXPECT_TRUE( f->isDegenerated()); } TEST(FaceTest, TestFindDouble) { Vertex v1(Vector3d<float>(-1, 0, 0), 0); Vertex v2(Vector3d<float>( 1, 0, 0), 1); Vertex v3(Vector3d<float>( 0, 1, 0), 2); Vertex v4(Vector3d<float>(-1, 0, 0), 3); Vertex v5(Vector3d<float>( 0,-1, 0), 4); Vertex v6(Vector3d<float>( 0, 1, 0), 5); FaceBuilder builder({ &v1, &v2, &v3, &v4, &v5, &v6 }); auto f1 = builder.build(0, 1, 2); auto f2 = builder.build(3, 4, 5); auto actual = f1->findDouble(*f2,1.0e-6f); EXPECT_EQ(2, actual.size()); auto found = actual.find(&v1); EXPECT_EQ(&v4, (*found).second); } TEST(FaceTest, TestMergeDouble) { Vertex v1(Vector3d<float>(-1, 0, 0), 0); Vertex v2(Vector3d<float>(1, 0, 0), 1); Vertex v3(Vector3d<float>(0, 1, 0), 2); Vertex v4(Vector3d<float>(-1, 0, 0), 3); Vertex v5(Vector3d<float>(0, -1, 0), 4); Vertex v6(Vector3d<float>(0, 1, 0), 5); FaceBuilder builder({ &v1, &v2, &v3, &v4, &v5, &v6 }); auto f1 = builder.build(0, 1, 2); auto f2 = builder.build(3, 4, 5); f1->mergeDouble(*f2, 1.0e-6f); auto edges = f2->getEdges(); EXPECT_EQ(&v1, edges.front()->getStart()); EXPECT_EQ(&v3, edges.back()->getStart()); //EXPECT_EQ(2, actual.size()); //auto found = actual.find(&v1); //EXPECT_EQ(&v4, (*found).second); } TEST(FaceTest, TestReverse) { Vertex v1(Vector3d<float>(-1, 0, 0), 0); Vertex v2(Vector3d<float>(1, 0, 0), 1); Vertex v3(Vector3d<float>(1, 1, 0), 2); FaceBuilder builder({ &v1, &v2, &v3 }); auto f = builder.build(0, 1, 2); f->reverse(); const auto& edges = f->getEdges(); EXPECT_EQ(0, edges.front()->getStart()->getId()); EXPECT_EQ(2, edges.front()->getEnd()->getId()); }
29.559633
77
0.612353
PremiumGraphicsCodes
f3726e0b9a5fdfc65372fdb8e6272caf8d61c986
4,706
cpp
C++
src/sleek/driver/texture3d.cpp
Phirxian/sleek-engine
741d55c8daad67ddf631e8b8fbdced59402d7bda
[ "BSD-2-Clause" ]
null
null
null
src/sleek/driver/texture3d.cpp
Phirxian/sleek-engine
741d55c8daad67ddf631e8b8fbdced59402d7bda
[ "BSD-2-Clause" ]
null
null
null
src/sleek/driver/texture3d.cpp
Phirxian/sleek-engine
741d55c8daad67ddf631e8b8fbdced59402d7bda
[ "BSD-2-Clause" ]
null
null
null
#include "texture3d.h" #include "context.h" #include <cstring> namespace sleek { namespace driver { static const unsigned int TextureFormatSize[] = { 1, 2, 3, 4, 4, 8, 12, 16 }; static const unsigned int TextureFormatComponant[] = { 1, 2, 3, 4, 1, 2, 3, 4 }; texture3d::texture3d(const math::vec3i &size, const TextureFormat p) noexcept : gpu(nullptr), buffer(0), isloaded(false), fmt(p) { pitch = TextureFormatSize[p-1]; component = TextureFormatComponant[p-1]; original = size; buffer = new u8[getBufferSize()]; } texture3d::~texture3d() noexcept { delete[] buffer; } /* ***************************************** */ math::vec3i texture3d::getDimension() const noexcept { return original; } u8 texture3d::getComposantCount() const noexcept { return component; } u8 texture3d::getPitch() const noexcept { return pitch; } /* ***************************************** */ void texture3d::setPixel(const math::vec3i &pos, const math::pixel &color) noexcept { u8* pixel = &buffer[(pos.x + pos.y*original.x + pos.z*original.y*original.y)*pitch]; switch(fmt) { case TXFMT_LUMINANCE: pixel[0] = color.getLuminaissance(); break; case TXFMT_LUMINANCE_ALPHA: pixel[0] = color.getLuminaissance(); pixel[1] = color.getAlpha(); break; case TXFMT_RGB: pixel[0] = color.getRed(); pixel[1] = color.getGreen(); pixel[2] = color.getBlue(); break; case TXFMT_RGBA: pixel[0] = color.getRed(); pixel[1] = color.getGreen(); pixel[2] = color.getBlue(); pixel[3] = color.getAlpha(); break; //! float case TXFMT_LUMINANCE_32F: case TXFMT_LUMINANCE_ALPHA_32F: case TXFMT_RGB_32F: case TXFMT_RGBA_32F: { float *ptr = reinterpret_cast<float*>(pixel); std::memcpy((float*)(&pixel), ptr, pitch); } break; } } math::pixel texture3d::getPixel(const math::vec3i &pos) const noexcept { register unsigned long index = (pos.x + pos.y*original.x + pos.z*original.y*original.y)*pitch; switch(fmt) { case TXFMT_LUMINANCE: return math::pixel(buffer[index],buffer[index],buffer[index],255); break; case TXFMT_LUMINANCE_ALPHA: return math::pixel(buffer[index],buffer[index],buffer[index],buffer[index+1]); break; case TXFMT_RGB: return math::pixel(buffer[index],buffer[index+1],buffer[index+2],255); break; case TXFMT_RGBA: return math::pixel(buffer[index],buffer[index+1],buffer[index+2],buffer[index+3]); break; //! float case TXFMT_LUMINANCE_32F: case TXFMT_LUMINANCE_ALPHA_32F: case TXFMT_RGB_32F: case TXFMT_RGBA_32F: return reinterpret_cast<std::uintptr_t>(&buffer[index]); break; } } TextureFormat texture3d::getFormat() const noexcept { return fmt; } /* ***************************************** */ void texture3d::setIdentifier(std::shared_ptr<identifier> &i) noexcept { gpu = i; } void texture3d::createIdentifier(context *cx) noexcept { gpu = cx->createTexture3d(this); } u8* texture3d::getBuffer() const noexcept { return buffer; } u32 texture3d::getBufferSize() const noexcept { return original.x*original.y*original.z*pitch; } std::shared_ptr<identifier> texture3d::getIdentifier() const noexcept { return gpu->getptr(); } /* ***************************************** */ texture3d* texture3d::clone() const noexcept { texture3d *tmp = new texture3d(original, fmt); memcpy(tmp->buffer, buffer, getBufferSize()); return tmp; } } }
30.558442
130
0.473013
Phirxian
f377694ce6e0ca0a046164f068bbf4b7baad05e7
11,803
cpp
C++
test/thread/source/TestThreadCondition.cpp
questor/eathread
5767f201c78b41002fee155c4e85c13d9d1adfe4
[ "BSD-3-Clause" ]
null
null
null
test/thread/source/TestThreadCondition.cpp
questor/eathread
5767f201c78b41002fee155c4e85c13d9d1adfe4
[ "BSD-3-Clause" ]
null
null
null
test/thread/source/TestThreadCondition.cpp
questor/eathread
5767f201c78b41002fee155c4e85c13d9d1adfe4
[ "BSD-3-Clause" ]
null
null
null
/////////////////////////////////////////////////////////////////////////////// // Copyright (c) Electronic Arts Inc. All rights reserved. /////////////////////////////////////////////////////////////////////////////// #include "TestThread.h" #include <EATest/EATest.h> #include <eathread/eathread_condition.h> #include <eathread/eathread_thread.h> #include <eathread/eathread_mutex.h> #include <eathread/eathread_list.h> #include <eathread/eathread_sync.h> #include <stdlib.h> #include <time.h> using namespace EA::Thread; /////////////////////////////////////////////////////////////////////////////// // EATHREAD_INTERPROCESS_CONDITION_SUPPORTED // #ifndef EATHREAD_INTERPROCESS_CONDITION_SUPPORTED #if defined(EA_PLATFORM_MICROSOFT) || defined(EA_PLATFORM_LINUX) #define EATHREAD_INTERPROCESS_CONDITION_SUPPORTED 1 #else #define EATHREAD_INTERPROCESS_CONDITION_SUPPORTED 0 #endif #endif const int kMaxConcurrentThreadCount = EATHREAD_MAX_CONCURRENT_THREAD_COUNT; struct TMWorkData { volatile bool mbProducersShouldQuit; volatile bool mbConsumersShouldQuit; EA::Thread::simple_list<int> mJobList; Condition mCondition; Mutex mMutex; int mnLastJobID; int mnConditionTimeout; AtomicInt32 mnTotalJobsCreated; AtomicInt32 mnTotalJobsCompleted; TMWorkData( const ConditionParameters* pCondParams ) : mbProducersShouldQuit(false), mbConsumersShouldQuit(false), mCondition( pCondParams ), mMutex(NULL, true), mnLastJobID(0), mnConditionTimeout(60000), mnTotalJobsCreated(0), mnTotalJobsCompleted(0) { // Empty } // define copy ctor and assignment operator // so the compiler does define them intrisically TMWorkData(const TMWorkData& rhs); // copy constructor TMWorkData& operator=(const TMWorkData& rhs); // assignment operator }; static intptr_t ProducerFunction(void* pvWorkData) { int nErrorCount = 0; TMWorkData* pWorkData = (TMWorkData*)pvWorkData; ThreadId threadId = GetThreadId(); EA::UnitTest::ReportVerbosity(1, "Condition producer test function created: %s\n", EAThreadThreadIdToString(threadId)); EAReadWriteBarrier(); while(!pWorkData->mbProducersShouldQuit) { EA::UnitTest::ThreadSleepRandom(100, 200); pWorkData->mMutex.Lock(); for(int i(0), iEnd(rand() % 3); i < iEnd; i++) { const int nJob(++pWorkData->mnLastJobID); pWorkData->mJobList.pushBack(nJob); ++pWorkData->mnTotalJobsCreated; EA::UnitTest::ReportVerbosity(1, "Job %d created by %s.\n", nJob, EAThreadThreadIdToString(threadId)); ThreadCooperativeYield(); // Used by cooperative threading platforms. } pWorkData->mMutex.Unlock(); pWorkData->mCondition.Signal(false); ThreadCooperativeYield(); // Used by cooperative threading platforms. } EA::UnitTest::ReportVerbosity(1, "Producer exiting: %s.\n", EAThreadThreadIdToString(threadId)); return nErrorCount; } static intptr_t ProducerFunction_DoesNotSignal(void* pvWorkData) { int nErrorCount = 0; TMWorkData* pWorkData = (TMWorkData*)pvWorkData; ThreadId threadId = GetThreadId(); EA_UNUSED(pWorkData); EA::UnitTest::ReportVerbosity(1, "Condition producer (does not signal) test function created: %s\n", EAThreadThreadIdToString(threadId)); // Intentionally do nothing here. We are testing the conditional variable time out code path by // ensuring we do not signal the Consumer that any work has been added into the queue for them // to consume therefor explicitly causing a condition variable timeout. EA::UnitTest::ReportVerbosity(1, "Producer (does not signal) exiting: %s.\n", EAThreadThreadIdToString(threadId)); return nErrorCount; } static intptr_t ConsumerFunction(void* pvWorkData) { int nErrorCount = 0; TMWorkData* pWorkData = (TMWorkData*)pvWorkData; ThreadId threadId = GetThreadId(); EA::UnitTest::ReportVerbosity(1, "Condition producer test function created: %s\n", EAThreadThreadIdToString(threadId)); pWorkData->mMutex.Lock(); do{ if(!pWorkData->mJobList.empty()) { const int nJob = pWorkData->mJobList.front(); pWorkData->mJobList.popFront(); pWorkData->mMutex.Unlock(); ThreadCooperativeYield(); // Used by cooperative threading platforms. // Here we would actually do the job, but printing 'job done' is enough in itself. ++pWorkData->mnTotalJobsCompleted; EA::UnitTest::ReportVerbosity(1, "Job %d done by %s.\n", nJob, EAThreadThreadIdToString(threadId)); pWorkData->mMutex.Lock(); } else { const ThreadTime timeoutAbsolute = GetThreadTime() + pWorkData->mnConditionTimeout; const Condition::Result result = pWorkData->mCondition.Wait(&pWorkData->mMutex, timeoutAbsolute); if((result != Condition::kResultOK) && pWorkData->mJobList.empty()) break; } }while(!pWorkData->mbConsumersShouldQuit || !pWorkData->mJobList.empty()); pWorkData->mMutex.Unlock(); EA::UnitTest::ReportVerbosity(1, "Consumer exiting: %s.\n", EAThreadThreadIdToString(threadId)); return nErrorCount; } int TestThreadCondition() { int nErrorCount(0); { // ctor tests // We test various combinations of Mutex ctor and ConditionParameters. // ConditionParameters(bool bIntraProcess = true, const char* pName = NULL); // Condition(const ConditionParameters* pConditionParameters = NULL, bool bDefaultParameters = true); ConditionParameters cp1(true, NULL); ConditionParameters cp2(true, "EATcp2"); #if EATHREAD_INTERPROCESS_CONDITION_SUPPORTED ConditionParameters cp3(false, NULL); ConditionParameters cp4(false, "EATcp4"); #else ConditionParameters cp3(true, NULL); ConditionParameters cp4(true, "EATcp4"); #endif // Create separate scopes below because some platforms are so // limited that they can't create all of them at once. { Condition cond1(&cp1, false); Condition cond2(&cp2, false); Condition cond3(&cp3, false); cond1.Signal(); cond2.Signal(); cond3.Signal(); } { Condition cond4(&cp4, false); Condition cond5(NULL, true); Condition cond6(NULL, false); cond6.Init(&cp1); cond4.Signal(); cond5.Signal(); cond6.Signal(); } } #if EA_THREADS_AVAILABLE { // test producer/consumer wait condition with intra-process condition { ConditionParameters exlusiveConditionParams( true, NULL ); TMWorkData workData( &exlusiveConditionParams ); Thread::Status status; int i; const int kThreadCount(kMaxConcurrentThreadCount - 1); Thread threadProducer[kThreadCount]; ThreadId threadIdProducer[kThreadCount]; Thread threadConsumer[kThreadCount]; ThreadId threadIdConsumer[kThreadCount]; // Create producers and consumers. for(i = 0; i < kThreadCount; i++) { threadIdProducer[i] = threadProducer[i].Begin(ProducerFunction, &workData); EATEST_VERIFY_MSG(threadIdProducer[i] != kThreadIdInvalid, "Condition/Thread failure: Thread creation failed."); threadIdConsumer[i] = threadConsumer[i].Begin(ConsumerFunction, &workData); EATEST_VERIFY_MSG(threadIdConsumer[i] != kThreadIdInvalid, "Condition/Thread failure: Thread creation failed."); } EA::UnitTest::ThreadSleepRandom(gTestLengthSeconds * 1000, gTestLengthSeconds * 1000); // Wait for producers to quit. workData.mbProducersShouldQuit = true; for(i = 0; i < kThreadCount; i++) { if(threadIdProducer[i] != kThreadIdInvalid) { status = threadProducer[i].WaitForEnd(GetThreadTime() + 30000); EATEST_VERIFY_MSG(status != Thread::kStatusRunning, "Condition/Thread failure: Wait for producer end failed."); } } EA::UnitTest::ThreadSleepRandom(2000, 2000); // Wait for consumers to quit. workData.mbConsumersShouldQuit = true; workData.mCondition.Signal(true); for(i = 0; i < kThreadCount; i++) { if(threadIdConsumer[i] != kThreadIdInvalid) { status = threadConsumer[i].WaitForEnd(GetThreadTime() + 30000); EATEST_VERIFY_MSG(status != Thread::kStatusRunning, "Condition/Thread failure: Wait for consumer end failed."); } } EATEST_VERIFY_MSG(workData.mnTotalJobsCreated == workData.mnTotalJobsCompleted, "Condition failure: Not all consumer work was processed."); } // test single producer/ single consumer wait condition with inter-process condition #if /*EATHREAD_INTERPROCESS_CONDITION_SUPPORTED*/ 0 // Disabled because this code fails on most platforms. { ConditionParameters sharedConditionParams( false, NULL ); TMWorkData workData( &sharedConditionParams ); // Inter-process. Thread::Status status; Thread threadProducer; Thread threadConsumer; ThreadId threadIdProducer = threadProducer.Begin(ProducerFunction, &workData); EATEST_VERIFY_MSG(threadIdProducer != kThreadIdInvalid, "Condition/Thread failure: Thread creation failed."); ThreadId threadIdConsumer = threadConsumer.Begin(ConsumerFunction, &workData); EATEST_VERIFY_MSG(threadIdConsumer != kThreadIdInvalid, "Condition/Thread failure: Thread creation failed."); EA::UnitTest::ThreadSleepRandom(gTestLengthSeconds * 1000, gTestLengthSeconds * 1000); // Wait for producer to quit. workData.mbProducersShouldQuit = true; if(threadIdProducer != kThreadIdInvalid) { status = threadProducer.WaitForEnd(GetThreadTime() + 30000); EATEST_VERIFY_MSG(status != Thread::kStatusRunning, "Condition/Thread failure: Wait for producer end failed."); } EA::UnitTest::ThreadSleepRandom(2000, 2000); // Wait for consumers to quit. workData.mbConsumersShouldQuit = true; workData.mCondition.Signal(true); if(threadIdConsumer != kThreadIdInvalid) { status = threadConsumer.WaitForEnd(GetThreadTime() + 30000); EATEST_VERIFY_MSG(status != Thread::kStatusRunning, "Condition/Thread failure: Wait for consumer end failed."); } EATEST_VERIFY_MSG(workData.mnTotalJobsCreated == workData.mnTotalJobsCompleted, "Condition failure: Not all consumer work was processed."); } #endif // Test conditional variable timeout explicitly by not sending a signal. { //::EA::EAMain::SetVerbosity(5); ConditionParameters sharedConditionParams( true, NULL ); TMWorkData workData( &sharedConditionParams ); // Inter-process. workData.mnConditionTimeout = 3000; // timeout value has to be less than thread timeout value below. Thread::Status status; Thread threadProducer; Thread threadConsumer; ThreadId threadIdProducer = threadProducer.Begin(ProducerFunction_DoesNotSignal, &workData); EATEST_VERIFY_MSG(threadIdProducer != kThreadIdInvalid, "Condition/Thread failure: Thread creation failed."); ThreadId threadIdConsumer = threadConsumer.Begin(ConsumerFunction, &workData); EATEST_VERIFY_MSG(threadIdConsumer != kThreadIdInvalid, "Condition/Thread failure: Thread creation failed."); EA::UnitTest::ThreadSleepRandom(gTestLengthSeconds * 1000, gTestLengthSeconds * 1000); // Wait for producer to quit. if(threadIdProducer != kThreadIdInvalid) { status = threadProducer.WaitForEnd(GetThreadTime() + 30000); EATEST_VERIFY_MSG(status != Thread::kStatusRunning, "Condition/Thread failure: Wait for producer end failed."); } EA::UnitTest::ThreadSleepRandom(2000, 2000); // Wait for consumers to quit. workData.mbConsumersShouldQuit = true; if(threadIdConsumer != kThreadIdInvalid) { status = threadConsumer.WaitForEnd(GetThreadTime() + 30000); EATEST_VERIFY_MSG(status != Thread::kStatusRunning, "Condition/Thread failure: Wait for consumer end failed."); } } } #endif return nErrorCount; }
35.127976
143
0.705499
questor
f37878b96cd4dd41a9a48f5e47d6fa124f1e09f5
605
cpp
C++
appcontext/src/get_current_time_as_string.cpp
gavinband/bingwa
d52e166b3bb6bc32cd32ba63bf8a4a147275eca1
[ "BSL-1.0" ]
3
2021-04-21T05:42:24.000Z
2022-01-26T14:59:43.000Z
appcontext/src/get_current_time_as_string.cpp
gavinband/bingwa
d52e166b3bb6bc32cd32ba63bf8a4a147275eca1
[ "BSL-1.0" ]
2
2020-04-09T16:11:04.000Z
2020-11-10T11:18:56.000Z
appcontext/src/get_current_time_as_string.cpp
gavinband/qctool
8d8adb45151c91f953fe4a9af00498073b1132ba
[ "BSL-1.0" ]
null
null
null
// Copyright Gavin Band 2008 - 2012. // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) #include <string> #include <ctime> #include "appcontext/get_current_time_as_string.hpp" namespace appcontext { std::string get_current_time_as_string() { time_t rawtime ; struct tm * timeinfo ; char buffer[30] ; std::time( &rawtime ) ; timeinfo = std::localtime( &rawtime ) ; std::strftime( buffer, 80, "%Y-%m-%d %H:%M:%S", timeinfo ) ; return std::string( buffer ) ; } }
27.5
62
0.669421
gavinband
f37c74d0f54ac5bc8628bb0f4cd2e4d763885437
245
cpp
C++
lab71arrayj.cpp
aizhansapina/lab7
afe2e08dea728f45a679c085ec05d7ca8a66817e
[ "MIT" ]
null
null
null
lab71arrayj.cpp
aizhansapina/lab7
afe2e08dea728f45a679c085ec05d7ca8a66817e
[ "MIT" ]
null
null
null
lab71arrayj.cpp
aizhansapina/lab7
afe2e08dea728f45a679c085ec05d7ca8a66817e
[ "MIT" ]
null
null
null
#include <iostream> using namespace std; int main () { int n; cin >> n; int a[n]; for (int i=0; i<n; i++){ cin >> a[i];} int mx = a[0]; for (int i=1; i<n; i++){ if (a[i]>mx) mx = a[i]; cout << a[i] << " ";} return 0; }
14.411765
26
0.444898
aizhansapina
3ce462dbd874bed265565e17c3455b403e4cb06e
9,321
cpp
C++
src/utils/registry.cpp
shravanAngadi/seafile-client
69f8e88e07f6960fd37fe1caa06649c613ea81d4
[ "Apache-2.0" ]
null
null
null
src/utils/registry.cpp
shravanAngadi/seafile-client
69f8e88e07f6960fd37fe1caa06649c613ea81d4
[ "Apache-2.0" ]
null
null
null
src/utils/registry.cpp
shravanAngadi/seafile-client
69f8e88e07f6960fd37fe1caa06649c613ea81d4
[ "Apache-2.0" ]
1
2021-11-02T18:40:14.000Z
2021-11-02T18:40:14.000Z
#include <windows.h> #include <shlwapi.h> #include <vector> #include "utils/stl.h" #include "registry.h" namespace { LONG openKey(HKEY root, const QString& path, HKEY *p_key, REGSAM samDesired = KEY_ALL_ACCESS) { LONG result; result = RegOpenKeyExW(root, path.toStdWString().c_str(), 0L, samDesired, p_key); return result; } } // namespace RegElement::RegElement(const HKEY& root, const QString& path, const QString& name, const QString& value, bool expand) : root_(root), path_(path), name_(name), string_value_(value), dword_value_(0), type_(expand ? REG_EXPAND_SZ : REG_SZ) { } RegElement::RegElement(const HKEY& root, const QString& path, const QString& name, DWORD value) : root_(root), path_(path), name_(name), string_value_(""), dword_value_(value), type_(REG_DWORD) { } int RegElement::openParentKey(HKEY *pKey) { DWORD disp; HRESULT result; result = RegCreateKeyExW (root_, path_.toStdWString().c_str(), 0, NULL, REG_OPTION_NON_VOLATILE, KEY_WRITE | KEY_WOW64_64KEY, NULL, pKey, &disp); if (result != ERROR_SUCCESS) { return -1; } return 0; } int RegElement::add() { HKEY parent_key; DWORD value_len; LONG result; if (openParentKey(&parent_key) < 0) { return -1; } if (type_ == REG_SZ || type_ == REG_EXPAND_SZ) { // See http://msdn.microsoft.com/en-us/library/windows/desktop/ms724923(v=vs.85).aspx value_len = sizeof(wchar_t) * (string_value_.toStdWString().length() + 1); result = RegSetValueExW (parent_key, name_.toStdWString().c_str(), 0, REG_SZ, (const BYTE *)(string_value_.toStdWString().c_str()), value_len); } else { value_len = sizeof(dword_value_); result = RegSetValueExW (parent_key, name_.toStdWString().c_str(), 0, REG_DWORD, (const BYTE *)&dword_value_, value_len); } if (result != ERROR_SUCCESS) { return -1; } return 0; } int RegElement::removeRegKey(HKEY root, const QString& path, const QString& subkey) { HKEY hKey; LONG result = RegOpenKeyExW(root, path.toStdWString().c_str(), 0L, KEY_ALL_ACCESS, &hKey); if (result != ERROR_SUCCESS) { return -1; } result = SHDeleteKeyW(hKey, subkey.toStdWString().c_str()); if (result != ERROR_SUCCESS) { return -1; } return 0; } bool RegElement::exists() { HKEY parent_key; LONG result = openKey(root_, path_, &parent_key, KEY_READ); if (result != ERROR_SUCCESS) { return false; } char buf[MAX_PATH] = {0}; DWORD len = sizeof(buf); result = RegQueryValueExW (parent_key, name_.toStdWString().c_str(), NULL, /* reserved */ NULL, /* output type */ (LPBYTE)buf, /* output data */ &len); /* output length */ RegCloseKey(parent_key); if (result != ERROR_SUCCESS) { return false; } return true; } void RegElement::read() { string_value_.clear(); dword_value_ = 0; HKEY parent_key; LONG result = openKey(root_, path_, &parent_key, KEY_READ); if (result != ERROR_SUCCESS) { return; } const std::wstring std_name = name_.toStdWString(); DWORD len; // get value size result = RegQueryValueExW (parent_key, std_name.c_str(), NULL, /* reserved */ &type_, /* output type */ NULL, /* output data */ &len); /* output length */ if (result != ERROR_SUCCESS) { RegCloseKey(parent_key); return; } // get value #ifndef UTILS_CXX11_MODE std::vector<wchar_t> buf; #else utils::WBufferArray buf; #endif buf.resize(len); result = RegQueryValueExW (parent_key, std_name.c_str(), NULL, /* reserved */ &type_, /* output type */ (LPBYTE)&buf[0], /* output data */ &len); /* output length */ buf.resize(len); if (result != ERROR_SUCCESS) { RegCloseKey(parent_key); return; } switch (type_) { case REG_EXPAND_SZ: case REG_SZ: { // expand environment strings wchar_t expanded_buf[MAX_PATH]; DWORD size = ExpandEnvironmentStringsW(&buf[0], expanded_buf, MAX_PATH); if (size == 0 || size > MAX_PATH) string_value_ = QString::fromWCharArray(&buf[0], buf.size()); else string_value_ = QString::fromWCharArray(expanded_buf, size); } break; case REG_NONE: case REG_BINARY: string_value_ = QString::fromWCharArray(&buf[0], buf.size() / 2); break; case REG_DWORD_BIG_ENDIAN: case REG_DWORD: if (buf.size() != sizeof(int)) return; memcpy((char*)&dword_value_, buf.data(), sizeof(int)); break; case REG_QWORD: { if (buf.size() != sizeof(int)) return; qint64 value; memcpy((char*)&value, buf.data(), sizeof(int)); dword_value_ = (int)value; break; } case REG_MULTI_SZ: default: break; } RegCloseKey(parent_key); // workaround with a bug string_value_ = QString::fromUtf8(string_value_.toUtf8()); return; } void RegElement::remove() { HKEY parent_key; LONG result = openKey(root_, path_, &parent_key, KEY_ALL_ACCESS); if (result != ERROR_SUCCESS) { return; } result = RegDeleteValueW (parent_key, name_.toStdWString().c_str()); RegCloseKey(parent_key); } QVariant RegElement::value() const { if (type_ == REG_SZ || type_ == REG_EXPAND_SZ || type_ == REG_NONE || type_ == REG_BINARY) { return string_value_; } else { return int(dword_value_); } } int RegElement::getIntValue(HKEY root, const QString& path, const QString& name, bool *exists, int default_val) { RegElement reg(root, path, name, ""); if (!reg.exists()) { if (exists) { *exists = false; } return default_val; } if (exists) { *exists = true; } reg.read(); if (!reg.stringValue().isEmpty()) return reg.stringValue().toInt(); return reg.dwordValue(); } int RegElement::getPreconfigureIntValue(const QString& name) { bool exists; int ret = getIntValue( HKEY_CURRENT_USER, "SOFTWARE\\Seafile", name, &exists); if (exists) { return ret; } return RegElement::getIntValue( HKEY_LOCAL_MACHINE, "SOFTWARE\\Seafile", name); } QString RegElement::getStringValue(HKEY root, const QString& path, const QString& name, bool *exists, QString default_val) { RegElement reg(root, path, name, ""); if (!reg.exists()) { if (exists) { *exists = false; } return default_val; } if (exists) { *exists = true; } reg.read(); return reg.stringValue(); } QString RegElement::getPreconfigureStringValue(const QString& name) { bool exists; QString ret = getStringValue( HKEY_CURRENT_USER, "SOFTWARE\\Seafile", name, &exists); if (exists) { return ret; } return RegElement::getStringValue( HKEY_LOCAL_MACHINE, "SOFTWARE\\Seafile", name); } QVariant RegElement::getPreconfigureValue(const QString& name) { QVariant v = getValue(HKEY_CURRENT_USER, "SOFTWARE\\Seafile", name); return v.isNull() ? getValue(HKEY_LOCAL_MACHINE, "SOFTWARE\\Seafile", name) : v; } QVariant RegElement::getValue(HKEY root, const QString& path, const QString& name) { RegElement reg(root, path, name, ""); if (!reg.exists()) { return QVariant(); } reg.read(); return reg.value(); }
27.174927
93
0.497586
shravanAngadi
3ce5d2ea45a5ca2d752e93bfc58ee6ba704f5aee
2,084
hpp
C++
include/oglplus/client_context.hpp
highfidelity/oglplus
c5fb7cc21869cb9555cfa2a7e28ea6bc6491d11e
[ "BSL-1.0" ]
2
2017-06-09T00:28:35.000Z
2017-06-09T00:28:43.000Z
include/oglplus/client_context.hpp
highfidelity/oglplus
c5fb7cc21869cb9555cfa2a7e28ea6bc6491d11e
[ "BSL-1.0" ]
null
null
null
include/oglplus/client_context.hpp
highfidelity/oglplus
c5fb7cc21869cb9555cfa2a7e28ea6bc6491d11e
[ "BSL-1.0" ]
8
2017-01-30T22:06:41.000Z
2020-01-14T17:24:36.000Z
/** * @file oglplus/client_context.hpp * @brief Client context. * * @author Matus Chochlik * * Copyright 2010-2014 Matus Chochlik. Distributed under the Boost * Software License, Version 1.0. (See accompanying file * LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) */ #pragma once #ifndef OGLPLUS_CLIENT_CONTEXT_1412071213_HPP #define OGLPLUS_CLIENT_CONTEXT_1412071213_HPP #include <oglplus/client/object_binding.hpp> #include <oglplus/client/capabilities.hpp> #include <oglplus/client/hints.hpp> #include <oglplus/client/depth_test.hpp> #include <oglplus/client/logical_ops.hpp> #include <oglplus/client/viewport.hpp> #include <oglplus/client/stencil_test.hpp> #include <oglplus/client/scissor_test.hpp> #include <oglplus/client/rasterization.hpp> #include <oglplus/client/pixel_ops.hpp> #include <oglplus/client/blending.hpp> #include <oglplus/client/buffer_clearing.hpp> #include <oglplus/client/buffer_masking.hpp> #include <oglplus/client/drawing.hpp> #include <oglplus/client/computing.hpp> #include <oglplus/client/synchronization.hpp> #include <oglplus/client/limit_queries.hpp> #include <oglplus/client/numeric_queries.hpp> #include <oglplus/client/string_queries.hpp> namespace oglplus { class ClientContext : public client::CurrentCapabilities , public client::ViewportState , public client::BufferMaskingState , public client::BufferClearingOps , public client::BufferClearingState , public client::RasterizationState , public client::RasterizationOps , public client::DrawingState , public client::DrawingOps , public client::ComputingOps , public client::DepthTest , public client::StencilTest , public client::ScissorTest , public client::LogicalOps , public client::PixelState , public client::PixelOps , public client::BlendingOps , public client::BlendingState , public client::Synchronization , public client::CurrentHints , public client::LimitQueries , public client::NumericQueries , public client::StringQueries , public client::CurrentObjects { }; } // namespace oglplus #endif // include guard
29.352113
68
0.784069
highfidelity
3cea1172e4ac7f3e5010ebf08a3586e04441bec0
1,306
hh
C++
include/ignition/gazebo/components/LevelBuffer.hh
mrushyendra/ign-gazebo
2f7f33d4fa34657badec81558d5953fe7643769f
[ "ECL-2.0", "Apache-2.0" ]
198
2020-04-15T16:56:09.000Z
2022-03-27T12:31:08.000Z
include/ignition/gazebo/components/LevelBuffer.hh
mrushyendra/ign-gazebo
2f7f33d4fa34657badec81558d5953fe7643769f
[ "ECL-2.0", "Apache-2.0" ]
1,220
2020-04-15T18:10:29.000Z
2022-03-31T22:37:06.000Z
include/ignition/gazebo/components/LevelBuffer.hh
mrushyendra/ign-gazebo
2f7f33d4fa34657badec81558d5953fe7643769f
[ "ECL-2.0", "Apache-2.0" ]
134
2020-04-15T16:59:57.000Z
2022-03-26T08:51:31.000Z
/* * Copyright (C) 2018 Open Source Robotics Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ #ifndef IGNITION_GAZEBO_COMPONENTS_LEVELBUFFER_HH_ #define IGNITION_GAZEBO_COMPONENTS_LEVELBUFFER_HH_ #include <ignition/gazebo/config.hh> #include <ignition/gazebo/Export.hh> #include "ignition/gazebo/components/Factory.hh" #include "ignition/gazebo/components/Component.hh" namespace ignition { namespace gazebo { // Inline bracket to help doxygen filtering. inline namespace IGNITION_GAZEBO_VERSION_NAMESPACE { namespace components { /// \brief A component that holds the buffer setting of a level's geometry using LevelBuffer = Component<double, class LevelBufferTag>; IGN_GAZEBO_REGISTER_COMPONENT("ign_gazebo_components.LevelBuffer", LevelBuffer) } } } } #endif
29.681818
76
0.774885
mrushyendra
3cecaefaf6aace984b23497e9d5569b3412c61e0
176
hpp
C++
runtime/src/aderite/scripting/internals/ScriptEntity.hpp
nfwGytautas/aderite
87a6a5c24a6dcaca80088cb7a4fca1f846a7f22c
[ "MIT" ]
null
null
null
runtime/src/aderite/scripting/internals/ScriptEntity.hpp
nfwGytautas/aderite
87a6a5c24a6dcaca80088cb7a4fca1f846a7f22c
[ "MIT" ]
null
null
null
runtime/src/aderite/scripting/internals/ScriptEntity.hpp
nfwGytautas/aderite
87a6a5c24a6dcaca80088cb7a4fca1f846a7f22c
[ "MIT" ]
null
null
null
#pragma once namespace aderite { namespace scripting { /** * @brief Links entity internal calls */ void entityInternals(); } // namespace scripting } // namespace aderite
13.538462
37
0.715909
nfwGytautas
3cece45eb27ca11c094add36bf3778f50d31330b
1,418
cpp
C++
Websites/Codeforces/158B.cpp
justaname94/Algorithms
4c9ec4119b0d92d5889f85b89fcb24f885a82373
[ "MIT" ]
null
null
null
Websites/Codeforces/158B.cpp
justaname94/Algorithms
4c9ec4119b0d92d5889f85b89fcb24f885a82373
[ "MIT" ]
null
null
null
Websites/Codeforces/158B.cpp
justaname94/Algorithms
4c9ec4119b0d92d5889f85b89fcb24f885a82373
[ "MIT" ]
null
null
null
#include <iostream> #include <vector> #include <algorithm> using namespace std; int main() { int groupsNum; cin >> groupsNum; vector<int> groups(groupsNum); for (int i = 0; i < groups.size(); i++) { cin >> groups[i]; } // Sort from biggest to smallest Num. sort(groups.rbegin(), groups.rend()); int taxis = 0; int taxiLimit = 4; int groupsInTaxi = 0; // This is used so the loop doesn't check from the very end // of the back of the array every time it checks elements from // the end. int groupsFromEnd = 0; int i = 0; while (groupsInTaxi < groupsNum) { int group = groups[i]; groupsInTaxi++; // A group can be added only if after adding a new member the // size is still lower or equal than the taxi limit. int nextGroup = (groups.size() - 1)-groupsFromEnd; bool canAddGroup = (group + groups[nextGroup]) <= taxiLimit; if (canAddGroup) { for (int j = nextGroup; j >= 0; j--) { if ((group + groups[j]) <= 4) { group += groups[j]; groupsInTaxi++; groupsFromEnd++; } if (group >= taxiLimit) { break; } } } taxis++; i++; } cout << taxis << endl; return 0; }
24.033898
69
0.49859
justaname94
3cedd63ae202687fc2e7fef7ed66082e6eb3546b
2,185
cpp
C++
Resources/Button.cpp
JTuthill01/Nightmare
e4b712e28c228c66a33664418cc176cf527c28c9
[ "MIT" ]
null
null
null
Resources/Button.cpp
JTuthill01/Nightmare
e4b712e28c228c66a33664418cc176cf527c28c9
[ "MIT" ]
null
null
null
Resources/Button.cpp
JTuthill01/Nightmare
e4b712e28c228c66a33664418cc176cf527c28c9
[ "MIT" ]
null
null
null
#include "stdafx.hpp" #include "Button.hpp" Button::Button(sf::Vector2f position, sf::Vector2f size, sf::Font * font, std::string text, unsigned character_size, sf::Color buttonColor, sf::Color idleButtonColor, sf::Color buttonHoverColor, sf::Color buttonActiveColor, sf::Color textColor) : mPosition(position), mSize(size), mFont(font), mbuttonColor(buttonColor), mIdleButtonColor(idleButtonColor), mHoverButtonColor(buttonHoverColor), mActiveButtonColor(buttonActiveColor) { this->mShape.setFillColor(buttonColor); this->mShape.setSize(size); this->mShape.setPosition(position); this->mShape.setOutlineColor(buttonColor); this->mShape.setOutlineThickness(1U); this->mText.setFont(*this->mFont); this->mText.setCharacterSize(character_size); this->mText.setString(text); this->mText.setFillColor(sf::Color::White); this->mText.setPosition(sf::Vector2f(this->mShape.getPosition().x + (this->mShape.getGlobalBounds().width / 2.f) - this->mText.getGlobalBounds().width / 2.f, this->mShape.getPosition().y + (this->mShape.getGlobalBounds().height / 2.2f) - this->mText.getGlobalBounds().height / 2.f)); } Button::~Button() = default; void Button::render(sf::RenderTarget & target) { target.draw(this->mShape); target.draw(this->mText); } void Button::update(const sf::Vector2f mousePosition) { this->mButtonState = BUTTON_IDLE; if (this->mShape.getGlobalBounds().contains(mousePosition)) { this->mButtonState = BUTTON_HOVER; if (sf::Mouse::isButtonPressed(sf::Mouse::Left)) this->mButtonState = BUTTON_ACTIVE; } switch (this->mButtonState) { case BUTTON_IDLE: this->mShape.setFillColor(this->mIdleButtonColor); this->mText.setFillColor(sf::Color::White); break; case BUTTON_HOVER: this->mShape.setFillColor(this->mHoverButtonColor); this->mText.setFillColor(sf::Color::White); break; case BUTTON_ACTIVE: this->mShape.setFillColor(this->mActiveButtonColor); this->mText.setFillColor(sf::Color::White); break; default: break; } } const bool Button::isPressed() const { if (this->mButtonState == BUTTON_ACTIVE) return true; return false; }
29.527027
190
0.715789
JTuthill01
3cefb28f682660b3fd19f2ef575daf4c4cfdda7d
11,934
cpp
C++
src/qt/qtbase/src/network/access/qnetworkcookiejar.cpp
zwollerob/PhantomJS_AMR6VL
71c126e98a8c32950158d04d0bd75823cd008b99
[ "BSD-3-Clause" ]
null
null
null
src/qt/qtbase/src/network/access/qnetworkcookiejar.cpp
zwollerob/PhantomJS_AMR6VL
71c126e98a8c32950158d04d0bd75823cd008b99
[ "BSD-3-Clause" ]
null
null
null
src/qt/qtbase/src/network/access/qnetworkcookiejar.cpp
zwollerob/PhantomJS_AMR6VL
71c126e98a8c32950158d04d0bd75823cd008b99
[ "BSD-3-Clause" ]
null
null
null
/**************************************************************************** ** ** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtNetwork module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL21$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms ** and conditions see http://www.qt.io/terms-conditions. For further ** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** As a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ ** ****************************************************************************/ #include "qnetworkcookiejar.h" #include "qnetworkcookiejar_p.h" #include "QtNetwork/qnetworkcookie.h" #include "QtCore/qurl.h" #include "QtCore/qdatetime.h" #include "private/qtldurl_p.h" QT_BEGIN_NAMESPACE /*! \class QNetworkCookieJar \since 4.4 \inmodule QtNetwork \brief The QNetworkCookieJar class implements a simple jar of QNetworkCookie objects Cookies are small bits of information that stateless protocols like HTTP use to maintain some persistent information across requests. A cookie is set by a remote server when it replies to a request and it expects the same cookie to be sent back when further requests are sent. The cookie jar is the object that holds all cookies set in previous requests. Web browsers save their cookie jars to disk in order to conserve permanent cookies across invocations of the application. QNetworkCookieJar does not implement permanent storage: it only keeps the cookies in memory. Once the QNetworkCookieJar object is deleted, all cookies it held will be discarded as well. If you want to save the cookies, you should derive from this class and implement the saving to disk to your own storage format. This class implements only the basic security recommended by the cookie specifications and does not implement any cookie acceptance policy (it accepts all cookies set by any requests). In order to override those rules, you should reimplement the cookiesForUrl() and setCookiesFromUrl() virtual functions. They are called by QNetworkReply and QNetworkAccessManager when they detect new cookies and when they require cookies. \sa QNetworkCookie, QNetworkAccessManager, QNetworkReply, QNetworkRequest, QNetworkAccessManager::setCookieJar() */ /*! Creates a QNetworkCookieJar object and sets the parent object to be \a parent. The cookie jar is initialized to empty. */ QNetworkCookieJar::QNetworkCookieJar(QObject *parent) : QObject(*new QNetworkCookieJarPrivate, parent) { } /*! Destroys this cookie jar object and discards all cookies stored in it. Cookies are not saved to disk in the QNetworkCookieJar default implementation. If you need to save the cookies to disk, you have to derive from QNetworkCookieJar and save the cookies to disk yourself. */ QNetworkCookieJar::~QNetworkCookieJar() { } /*! Returns all cookies stored in this cookie jar. This function is suitable for derived classes to save cookies to disk, as well as to implement cookie expiration and other policies. \sa setAllCookies(), cookiesForUrl() */ QList<QNetworkCookie> QNetworkCookieJar::allCookies() const { return d_func()->allCookies; } /*! Sets the internal list of cookies held by this cookie jar to be \a cookieList. This function is suitable for derived classes to implement loading cookies from permanent storage, or their own cookie acceptance policies by reimplementing setCookiesFromUrl(). \sa allCookies(), setCookiesFromUrl() */ void QNetworkCookieJar::setAllCookies(const QList<QNetworkCookie> &cookieList) { Q_D(QNetworkCookieJar); d->allCookies = cookieList; } static inline bool isParentPath(const QString &path, const QString &reference) { if (path.startsWith(reference)) { //The cookie-path and the request-path are identical. if (path.length() == reference.length()) return true; //The cookie-path is a prefix of the request-path, and the last //character of the cookie-path is %x2F ("/"). if (reference.endsWith('/')) return true; //The cookie-path is a prefix of the request-path, and the first //character of the request-path that is not included in the cookie- //path is a %x2F ("/") character. if (path.at(reference.length()) == '/') return true; } return false; } static inline bool isParentDomain(const QString &domain, const QString &reference) { if (!reference.startsWith(QLatin1Char('.'))) return domain == reference; return domain.endsWith(reference) || domain == reference.mid(1); } /*! Adds the cookies in the list \a cookieList to this cookie jar. Before being inserted cookies are normalized. Returns \c true if one or more cookies are set for \a url, otherwise false. If a cookie already exists in the cookie jar, it will be overridden by those in \a cookieList. The default QNetworkCookieJar class implements only a very basic security policy (it makes sure that the cookies' domain and path match the reply's). To enhance the security policy with your own algorithms, override setCookiesFromUrl(). Also, QNetworkCookieJar does not have a maximum cookie jar size. Reimplement this function to discard older cookies to create room for new ones. \sa cookiesForUrl(), QNetworkAccessManager::setCookieJar(), QNetworkCookie::normalize() */ bool QNetworkCookieJar::setCookiesFromUrl(const QList<QNetworkCookie> &cookieList, const QUrl &url) { bool added = false; foreach (QNetworkCookie cookie, cookieList) { cookie.normalize(url); if (validateCookie(cookie, url) && insertCookie(cookie)) added = true; } return added; } /*! Returns the cookies to be added to when a request is sent to \a url. This function is called by the default QNetworkAccessManager::createRequest(), which adds the cookies returned by this function to the request being sent. If more than one cookie with the same name is found, but with differing paths, the one with longer path is returned before the one with shorter path. In other words, this function returns cookies sorted decreasingly by path length. The default QNetworkCookieJar class implements only a very basic security policy (it makes sure that the cookies' domain and path match the reply's). To enhance the security policy with your own algorithms, override cookiesForUrl(). \sa setCookiesFromUrl(), QNetworkAccessManager::setCookieJar() */ QList<QNetworkCookie> QNetworkCookieJar::cookiesForUrl(const QUrl &url) const { // \b Warning! This is only a dumb implementation! // It does NOT follow all of the recommendations from // http://wp.netscape.com/newsref/std/cookie_spec.html // It does not implement a very good cross-domain verification yet. Q_D(const QNetworkCookieJar); QDateTime now = QDateTime::currentDateTime(); QList<QNetworkCookie> result; bool isEncrypted = url.scheme().toLower() == QLatin1String("https"); // scan our cookies for something that matches QList<QNetworkCookie>::ConstIterator it = d->allCookies.constBegin(), end = d->allCookies.constEnd(); for ( ; it != end; ++it) { if (!isParentDomain(url.host(), it->domain())) continue; if (!isParentPath(url.path(), it->path())) continue; if (!(*it).isSessionCookie() && (*it).expirationDate() < now) continue; if ((*it).isSecure() && !isEncrypted) continue; // insert this cookie into result, sorted by path QList<QNetworkCookie>::Iterator insertIt = result.begin(); while (insertIt != result.end()) { if (insertIt->path().length() < it->path().length()) { // insert here insertIt = result.insert(insertIt, *it); break; } else { ++insertIt; } } // this is the shortest path yet, just append if (insertIt == result.end()) result += *it; } return result; } /*! \since 5.0 Adds \a cookie to this cookie jar. Returns \c true if \a cookie was added, false otherwise. If a cookie with the same identifier already exists in the cookie jar, it will be overridden. */ bool QNetworkCookieJar::insertCookie(const QNetworkCookie &cookie) { Q_D(QNetworkCookieJar); QDateTime now = QDateTime::currentDateTime(); bool isDeletion = !cookie.isSessionCookie() && cookie.expirationDate() < now; deleteCookie(cookie); if (!isDeletion) { d->allCookies += cookie; return true; } return false; } /*! \since 5.0 If a cookie with the same identifier as \a cookie exists in this cookie jar it will be updated. This function uses insertCookie(). Returns \c true if \a cookie was updated, false if no cookie in the jar matches the identifier of \a cookie. \sa QNetworkCookie::hasSameIdentifier() */ bool QNetworkCookieJar::updateCookie(const QNetworkCookie &cookie) { if (deleteCookie(cookie)) return insertCookie(cookie); return false; } /*! \since 5.0 Deletes from cookie jar the cookie found to have the same identifier as \a cookie. Returns \c true if a cookie was deleted, false otherwise. \sa QNetworkCookie::hasSameIdentifier() */ bool QNetworkCookieJar::deleteCookie(const QNetworkCookie &cookie) { Q_D(QNetworkCookieJar); QList<QNetworkCookie>::Iterator it; for (it = d->allCookies.begin(); it != d->allCookies.end(); ++it) { if (it->hasSameIdentifier(cookie)) { d->allCookies.erase(it); return true; } } return false; } /*! \since 5.0 Returns \c true if the domain and path of \a cookie are valid, false otherwise. The \a url parameter is used to determine if the domain specified in the cookie is allowed. */ bool QNetworkCookieJar::validateCookie(const QNetworkCookie &cookie, const QUrl &url) const { QString domain = cookie.domain(); if (!(isParentDomain(domain, url.host()) || isParentDomain(url.host(), domain))) return false; // not accepted // the check for effective TLDs makes the "embedded dot" rule from RFC 2109 section 4.3.2 // redundant; the "leading dot" rule has been relaxed anyway, see QNetworkCookie::normalize() // we remove the leading dot for this check if it's present if (qIsEffectiveTLD(domain.startsWith('.') ? domain.remove(0, 1) : domain)) return false; // not accepted return true; } QT_END_NAMESPACE
34.997067
97
0.684263
zwollerob
3cf12203308d5157ac61d5cd20f775b77d386886
696
cpp
C++
src/kern_state.cpp
ammrat13/cuda-magnetic-pendulum
51c77a21d6fdec15add82aeb0895684a4bbda1ff
[ "MIT" ]
null
null
null
src/kern_state.cpp
ammrat13/cuda-magnetic-pendulum
51c77a21d6fdec15add82aeb0895684a4bbda1ff
[ "MIT" ]
null
null
null
src/kern_state.cpp
ammrat13/cuda-magnetic-pendulum
51c77a21d6fdec15add82aeb0895684a4bbda1ff
[ "MIT" ]
null
null
null
#include "kern.h" kern::State::State(size_t res): resolution{res} { this->data = std::make_unique<kern::State::StateElem[]>( this->resolution * this->resolution ); } void kern::State::check_bounds(size_t r, size_t c) const { if(r >= this->resolution || c >= this->resolution) { throw std::out_of_range("Out of Range error: kern::State"); } } kern::State::StateElem& kern::State::operator() (size_t r, size_t c) { this->check_bounds(r, c); return this->data[r * this->resolution + c]; } kern::State::StateElem const& kern::State::operator() (size_t r, size_t c) const { this->check_bounds(r, c); return this->data[r * this->resolution + c]; }
26.769231
82
0.632184
ammrat13
3cf251222232a74dba2586526ddeef2f57dd0856
20,971
cpp
C++
SPH_SM_monodomain/SPH_SM_monodomain.cpp
Hagen23/SPH-SM-Monodomain
9211cfa38cbc508a88495cecc1154e93ed414ae7
[ "MIT" ]
null
null
null
SPH_SM_monodomain/SPH_SM_monodomain.cpp
Hagen23/SPH-SM-Monodomain
9211cfa38cbc508a88495cecc1154e93ed414ae7
[ "MIT" ]
null
null
null
SPH_SM_monodomain/SPH_SM_monodomain.cpp
Hagen23/SPH-SM-Monodomain
9211cfa38cbc508a88495cecc1154e93ed414ae7
[ "MIT" ]
null
null
null
#ifndef __SPH_SM_monodomain_CPP__ #define __SPH_SM_monodomain_CPP__ #include <SPH_SM_monodomain.h> #include <stdio.h> #include <stdlib.h> #include <math.h> #include <string.h> #include <iostream> using namespace std; SPH_SM_monodomain::SPH_SM_monodomain() { float sigma_i = 0.893, sigma_e = 0.67; kernel = 0.04f; Max_Number_Paticles = 50000; total_time_steps = 0; Number_Particles = 0; Cm = 1.f; Beta = 50; isStimOn = false; sigma = sigma_i * sigma_e / ( sigma_i + sigma_e); //1.0f; stim_strength = 300.0f; World_Size = m3Vector(1.5f, 1.5f, 1.5f); Cell_Size = 0.04; Grid_Size = World_Size / Cell_Size; Grid_Size.x = (int)ceil(Grid_Size.x); Grid_Size.y = (int)ceil(Grid_Size.y); Grid_Size.z = (int)ceil(Grid_Size.z); Number_Cells = (int)Grid_Size.x * (int)Grid_Size.y * (int)Grid_Size.z; Gravity.set(0.0f, -9.8f, 0.0f); K = 0.5f; Stand_Density = 1112.0f; max_vel = m3Vector(3.0f, 3.0f, 3.0f); velocity_mixing = 1.0f; /// Time step is calculated as in 2016 - Divergence-Free SPH for Incompressible and Viscous Fluids. /// Then we adapt the time step size according to the Courant-Friedrich-Levy (CFL) condition [6] ∆t ≤ 0.4 * d / (||vmax||) Time_Delta = 0.4 * kernel / sqrt(max_vel.magnitudeSquared()); Wall_Hit = -1.0f; //0.05f; mu = 100.0f; Particles = new Particle[Max_Number_Paticles]; Cells = new Cell[Number_Cells]; Poly6_constant = 315.0f/(64.0f * m3Pi * pow(kernel, 9)); Spiky_constant = 45.0f/(m3Pi * pow(kernel, 6)); B_spline_constant = 1.0f / (m3Pi*kernel*kernel*kernel); // SM initializations bounds.min.zero(); bounds.max.set(1.5f, 1.5f, 1.5f); // Beta has to be larger than alfa alpha = 0.3f; beta = 0.4f; quadraticMatch = false; volumeConservation = true; allowFlip = false; cout<<"SPHSystem"<<endl; cout<<"Grid_Size_X : " << Grid_Size.x << endl; cout<<"Grid_Size_Y : " << Grid_Size.y << endl; cout<<"Grid_Size_Z : " << Grid_Size.y << endl; cout<<"Alpha :" << alpha << " Beta :" << beta << endl; cout<<"Volume conservation :" << volumeConservation << " Quadratic match : "<<quadraticMatch << endl; cout<<"Cell Number : "<<Number_Cells<<endl; cout<<"Time Delta : "<<Time_Delta<<endl; } SPH_SM_monodomain::~SPH_SM_monodomain() { delete[] Particles; delete[] Cells; } void SPH_SM_monodomain::add_viscosity(float value) { mu += (mu + value) >= 0 ? value : 0; // cout << "Viscosity: " << mu << endl; } void SPH_SM_monodomain::Init_Fluid(vector<m3Vector> positions) { for(m3Vector pos : positions) Init_Particle(pos, m3Vector(0.f, 0.f, 0.f)); cout<<"Number of Paticles : "<<Number_Particles<<endl; } void SPH_SM_monodomain::Init_Particle(m3Vector pos, m3Vector vel) { if(Number_Particles + 1 > Max_Number_Paticles) return; Particle *p = &(Particles[Number_Particles]); p->pos = pos; p->mOriginalPos = pos; p->mGoalPos = pos; p->mFixed = false; p->vel = vel; p->acc = m3Vector(0.0f, 0.0f, 0.0f); p->dens = Stand_Density; p->mass = 0.2f; p->Inter_Vm = 0.0f; p->Vm = 0.0f; p->Iion = 0.0f; p->stim = 0.0f; p->w = 0.0f; Number_Particles++; } m3Vector SPH_SM_monodomain::Calculate_Cell_Position(m3Vector pos) { m3Vector cellpos = pos / Cell_Size; cellpos.x = (int)cellpos.x; cellpos.y = (int)cellpos.y; cellpos.z = (int)cellpos.z; return cellpos; } int SPH_SM_monodomain::Calculate_Cell_Hash(m3Vector pos) { if((pos.x < 0)||(pos.x >= Grid_Size.x)||(pos.y < 0)||(pos.y >= Grid_Size.y)|| (pos.z < 0)||(pos.z >= Grid_Size.z)) return -1; int hash = pos.x + Grid_Size.x * (pos.y + Grid_Size.y * pos.z); if(hash > Number_Cells) cout<<"Error"; return hash; } /// For density computation float SPH_SM_monodomain::Poly6(float r2) { return (r2 >= 0 && r2 <= kernel*kernel) ? Poly6_constant * pow(kernel * kernel - r2, 3) : 0; } /// For force of pressure computation float SPH_SM_monodomain::Spiky(float r) { return (r >= 0 && r <= kernel ) ? -Spiky_constant * (kernel - r) * (kernel - r) : 0; } /// For viscosity computation float SPH_SM_monodomain::Visco(float r) { return (r >= 0 && r <= kernel ) ? Spiky_constant * (kernel - r) : 0; } m3Real SPH_SM_monodomain::B_spline(m3Real r) { m3Real q = r / kernel; if (q >= 0 && q < 1) return B_spline_constant * (1.0f - 1.5f * q * q + 0.75f * q * q * q); else if (q >= 1 && q < 2) return B_spline_constant * (0.25*pow(2 - q, 3)); else return 0; } m3Real SPH_SM_monodomain::B_spline_1(m3Real r) { m3Real q = r / kernel; if (q >= 0 && q < 1) return B_spline_constant * (-3.0f * q + 2.25f * q * q); else if (q >= 1 && q < 2) return B_spline_constant * (-0.75 * pow(2 - q, 2)); else return 0; } m3Real SPH_SM_monodomain::B_spline_2(m3Real r) { m3Real q = r / kernel; if (q >= 0 && q < 1) return B_spline_constant * (-3 + 4.5 * q); else if (q >= 1 && q < 2) return B_spline_constant * (1.5 * (2 - q)); else return 0; } void SPH_SM_monodomain::Find_neighbors() { int hash; Particle *p; for(int i = 0; i < Number_Cells; i++) Cells[i].contained_particles.clear(); for(int i = 0; i < Number_Particles; i ++) { p = &Particles[i]; hash = Calculate_Cell_Hash(Calculate_Cell_Position(p->pos)); Cells[hash].contained_particles.push_back(p); } } void SPH_SM_monodomain::apply_external_forces(m3Vector* forcesArray = NULL, int* indexArray = NULL, int size = 0) { /// External forces for (int i = 0; i < size; i++) { int j = indexArray[i]; if (Particles[j].mFixed) continue; Particles[j].predicted_vel += (forcesArray[i] * Time_Delta) / Particles[j].mass; } /// Gravity for (int i = 0; i < Number_Particles; i++) { if (Particles[i].mFixed) continue; Particles[i].predicted_vel = Particles[i].vel + (Gravity * Time_Delta) / Particles[i].mass; // Particles[i].mGoalPos = Particles[i].mOriginalPos; } } void SPH_SM_monodomain::projectPositions() { if (Number_Particles <= 1) return; int i, j, k; // center of mass m3Vector cm, originalCm; cm.zero(); originalCm.zero(); float mass = 0.0f; for (i = 0; i < Number_Particles; i++) { m3Real m = Particles[i].mass; if (Particles[i].mFixed) m *= 100.0f; mass += m; cm += Particles[i].pos * m; originalCm += Particles[i].mOriginalPos * m; } cm /= mass; originalCm /= mass; m3Vector p, q; m3Matrix Apq, Aqq; Apq.zero(); Aqq.zero(); for (i = 0; i < Number_Particles; i++) { p = Particles[i].pos - cm; q = Particles[i].mOriginalPos - originalCm; m3Real m = Particles[i].mass; Apq.r00 += m * p.x * q.x; Apq.r01 += m * p.x * q.y; Apq.r02 += m * p.x * q.z; Apq.r10 += m * p.y * q.x; Apq.r11 += m * p.y * q.y; Apq.r12 += m * p.y * q.z; Apq.r20 += m * p.z * q.x; Apq.r21 += m * p.z * q.y; Apq.r22 += m * p.z * q.z; Aqq.r00 += m * q.x * q.x; Aqq.r01 += m * q.x * q.y; Aqq.r02 += m * q.x * q.z; Aqq.r10 += m * q.y * q.x; Aqq.r11 += m * q.y * q.y; Aqq.r12 += m * q.y * q.z; Aqq.r20 += m * q.z * q.x; Aqq.r21 += m * q.z * q.y; Aqq.r22 += m * q.z * q.z; } if (!allowFlip && Apq.determinant() < 0.0f) { // prevent from flipping Apq.r01 = -Apq.r01; Apq.r11 = -Apq.r11; Apq.r22 = -Apq.r22; } m3Matrix R, S; m3Matrix::polarDecomposition(Apq, R, S); if (!quadraticMatch) { // --------- linear match m3Matrix A = Aqq; A.invert(); A.multiply(Apq, A); if (volumeConservation) { m3Real det = A.determinant(); if (det != 0.0f) { det = 1.0f / sqrt(fabs(det)); if (det > 2.0f) det = 2.0f; A *= det; } } m3Matrix T = R * (1.0f - beta) + A * beta; for (i = 0; i < Number_Particles; i++) { if (Particles[i].mFixed) continue; q = Particles[i].mOriginalPos - originalCm; Particles[i].mGoalPos = T.multiply(q) + cm; } } else { // -------------- quadratic match--------------------- m3Real A9pq[3][9]; for (int i = 0; i < 3; i++) for (int j = 0; j < 9; j++) A9pq[i][j] = 0.0f; m9Matrix A9qq; A9qq.zero(); for (int i = 0; i < Number_Particles; i++) { p = Particles[i].pos - cm; q = Particles[i].mOriginalPos - originalCm; m3Real q9[9]; q9[0] = q.x; q9[1] = q.y; q9[2] = q.z; q9[3] = q.x*q.x; q9[4] = q.y*q.y; q9[5] = q.z*q.z; q9[6] = q.x*q.y; q9[7] = q.y*q.z; q9[8] = q.z*q.x; m3Real m = Particles[i].mass; A9pq[0][0] += m * p.x * q9[0]; A9pq[0][1] += m * p.x * q9[1]; A9pq[0][2] += m * p.x * q9[2]; A9pq[0][3] += m * p.x * q9[3]; A9pq[0][4] += m * p.x * q9[4]; A9pq[0][5] += m * p.x * q9[5]; A9pq[0][6] += m * p.x * q9[6]; A9pq[0][7] += m * p.x * q9[7]; A9pq[0][8] += m * p.x * q9[8]; A9pq[1][0] += m * p.y * q9[0]; A9pq[1][1] += m * p.y * q9[1]; A9pq[1][2] += m * p.y * q9[2]; A9pq[1][3] += m * p.y * q9[3]; A9pq[1][4] += m * p.y * q9[4]; A9pq[1][5] += m * p.y * q9[5]; A9pq[1][6] += m * p.y * q9[6]; A9pq[1][7] += m * p.y * q9[7]; A9pq[1][8] += m * p.y * q9[8]; A9pq[2][0] += m * p.z * q9[0]; A9pq[2][1] += m * p.z * q9[1]; A9pq[2][2] += m * p.z * q9[2]; A9pq[2][3] += m * p.z * q9[3]; A9pq[2][4] += m * p.z * q9[4]; A9pq[2][5] += m * p.z * q9[5]; A9pq[2][6] += m * p.z * q9[6]; A9pq[2][7] += m * p.z * q9[7]; A9pq[2][8] += m * p.z * q9[8]; for (j = 0; j < 9; j++) for (k = 0; k < 9; k++) A9qq(j, k) += m * q9[j] * q9[k]; } A9qq.invert(); m3Real A9[3][9]; for (int i = 0; i < 3; i++) { for (int j = 0; j < 9; j++) { A9[i][j] = 0.0f; for (k = 0; k < 9; k++) A9[i][j] += A9pq[i][k] * A9qq(k, j); A9[i][j] *= beta; if (j < 3) A9[i][j] += (1.0f - beta) * R(i, j); } } m3Real det = A9[0][0] * (A9[1][1] * A9[2][2] - A9[2][1] * A9[1][2]) - A9[0][1] * (A9[1][0] * A9[2][2] - A9[2][0] * A9[1][2]) + A9[0][2] * (A9[1][0] * A9[2][1] - A9[1][1] * A9[2][0]); if (!allowFlip && det < 0.0f) { // prevent from flipping A9[0][1] = -A9[0][1]; A9[1][1] = -A9[1][1]; A9[2][2] = -A9[2][2]; } if (volumeConservation) { if (det != 0.0f) { det = 1.0f / sqrt(fabs(det)); if (det > 2.0f) det = 2.0f; for (int i = 0; i < 3; i++) for (int j = 0; j < 9; j++) A9[i][j] *= det; } } for (int i = 0; i < Number_Particles; i++) { if (Particles[i].mFixed) continue; q = Particles[i].mOriginalPos - originalCm; Particles[i].mGoalPos.x = A9[0][0] * q.x + A9[0][1] * q.y + A9[0][2] * q.z + A9[0][3] * q.x*q.x + A9[0][4] * q.y*q.y + A9[0][5] * q.z*q.z + A9[0][6] * q.x*q.y + A9[0][7] * q.y*q.z + A9[0][8] * q.z*q.x; Particles[i].mGoalPos.y = A9[1][0] * q.x + A9[1][1] * q.y + A9[1][2] * q.z + A9[1][3] * q.x*q.x + A9[1][4] * q.y*q.y + A9[1][5] * q.z*q.z + A9[1][6] * q.x*q.y + A9[1][7] * q.y*q.z + A9[1][8] * q.z*q.x; Particles[i].mGoalPos.z = A9[2][0] * q.x + A9[2][1] * q.y + A9[2][2] * q.z + A9[2][3] * q.x*q.x + A9[2][4] * q.y*q.y + A9[2][5] * q.z*q.z + A9[2][6] * q.x*q.y + A9[2][7] * q.y*q.z + A9[2][8] * q.z*q.x; Particles[i].mGoalPos += cm; } } } void SPH_SM_monodomain::Compute_Density_SingPressure() { Particle *p; m3Vector CellPos; m3Vector NeighborPos; int hash; for(int k = 0; k < Number_Particles; k++) { p = &Particles[k]; p->dens = 0; p->pres = 0; CellPos = Calculate_Cell_Position(p->pos); for(int k = -1; k <= 1; k++) for(int j = -1; j <= 1; j++) for(int i = -1; i <= 1; i++) { NeighborPos = CellPos + m3Vector(i, j, k); hash = Calculate_Cell_Hash(NeighborPos); if(hash == -1) continue; /// Calculates the density, Eq.3 for(Particle* np : Cells[hash].contained_particles) { m3Vector Distance; Distance = p->pos - np->pos; float dis2 = (float)Distance.magnitudeSquared(); // p->dens += np->mass * B_spline(Distance.magnitude()); p->dens += np->mass * Poly6(dis2); } } p->dens += p->mass * Poly6(0.0f); /// Calculates the pressure, Eq.12 p->pres = K * (p->dens - Stand_Density); /// Testing if voltage can be used as a pressure // if(isStimOn) // m3Real inter_pressure_voltage = (p->Vm * voltage_constant); p->pres -= (p->Vm * voltage_constant); if(p->stim > 0) { if(p->pres < -max_pressure) p->pres = -max_pressure; else if(p->pres > max_pressure) p->pres = max_pressure; } else { p->pres = -0.0f; } // p->pres = p->pres < 0.0f? 0.0f : p->pres; // if(p->pos.x > 0.5 && p->pos.y > 0.2 && p->pos.z > 0.5 ) // { // p->pres += 20.0 * Stand_Density; // cout << p->pres<< " " << p->Vm << " " << inter_pressure_voltage << endl; // } } } void SPH_SM_monodomain::Compute_Force() { Particle *p; m3Vector CellPos; m3Vector NeighborPos; int hash; for(int k = 0; k < Number_Particles; k++) { p = &Particles[k]; p->acc = m3Vector(0.0f, 0.0f, 0.0f); p->Inter_Vm = 0.0f; CellPos = Calculate_Cell_Position(p->pos); for(int k = -1; k <= 1; k++) for(int j = -1; j <= 1; j++) for(int i = -1; i <= 1; i++) { NeighborPos = CellPos + m3Vector(i, j, k); hash = Calculate_Cell_Hash(NeighborPos); if(hash == -1) continue; for(Particle* np : Cells[hash].contained_particles) { m3Vector Distance; Distance = p->pos - np->pos; float dis2 = (float)Distance.magnitudeSquared(); if(dis2 > INF) { float dis = sqrt(dis2); /// Calculates the force of pressure, Eq.10 float Volume = np->mass / np->dens; // float Force_pressure = Volume * (p->pres+np->pres)/2 * B_spline_1(dis); float Force_pressure = Volume * (p->pres+np->pres)/2 * Spiky(dis); p->acc -= Distance * Force_pressure / dis; /// Calculates the relative velocity (vj - vi), and then multiplies it to the mu, volume, and viscosity kernel. Eq.14 // m3Vector RelativeVel = np->corrected_vel - p->corrected_vel; m3Vector RelativeVel = np->inter_vel - p->inter_vel; float Force_viscosity = Volume * mu * Visco(dis); p->acc += RelativeVel * Force_viscosity; /// Calculates the intermediate voltage needed for the monodomain model p->Inter_Vm += (np->Vm - p->Vm) * Volume * B_spline_2(dis); } } } /// Sum of the forces that make up the fluid, Eq.8 p->acc = p->acc/p->dens; /// Adding the currents, and time integration for the intermediate voltage p->Inter_Vm += (sigma / (Beta * Cm)) * p->Inter_Vm - ((p->Iion - p->stim * Time_Delta / p->mass) / Cm); } } void SPH_SM_monodomain::calculate_cell_model() { Particle *p; m3Real denom = (FH_Vp - FH_Vr); m3Real asd = (FH_Vt - FH_Vr)/denom; m3Real u = 0.0; for(int k = 0; k < Number_Particles; k++) { p = &Particles[k]; u = (p->Vm - FH_Vr) / denom; p->Iion += Time_Delta * (C1*u*(u - asd)*(u - 1.0) + C2* p->w) / p->mass ; p->w += Time_Delta * C3*(u - C4*p->w) / p->mass; } } /// Time integration as in 2016 - Fluid simulation by the SPH Method, a survey. /// Eq.13 and Eq.14 void SPH_SM_monodomain::Update_Properties() { Particle *p; for(int i=0; i < Number_Particles; i++) { p = &Particles[i]; if(!p->mFixed) { p->vel = p->inter_vel + (p->acc*Time_Delta/p->mass); p->pos = p->pos + (p->vel*Time_Delta); } p->Vm += p->Inter_Vm * Time_Delta / p->mass; if(p->Vm > max_voltage) p->Vm = max_voltage; else if(p->Vm < -max_voltage) p->Vm = -max_voltage; if(p->pos.x < 0.0f) { p->vel.x = p->vel.x * Wall_Hit; p->pos.x = 0.0f; } if(p->pos.x >= World_Size.x) { p->vel.x = p->vel.x * Wall_Hit; p->pos.x = World_Size.x - 0.0001f; } if(p->pos.y < 0.0f) { p->vel.y = p->vel.y * Wall_Hit; p->pos.y = 0.0f; } if(p->pos.y >= World_Size.y) { p->vel.y = p->vel.y * Wall_Hit; p->pos.y = World_Size.y - 0.0001f; } if(p->pos.z < 0.0f) { p->vel.z = p->vel.z * Wall_Hit; p->pos.z = 0.0f; } if(p->pos.z >= World_Size.z) { p->vel.z = p->vel.z * Wall_Hit; p->pos.z = World_Size.z - 0.0001f; } bounds.clamp(Particles[i].pos); } } void SPH_SM_monodomain::calculate_corrected_velocity() { /// Computes predicted velocity from forces except viscoelastic and pressure apply_external_forces(); /// Calculates corrected velocity projectPositions(); m3Real time_delta_1 = 1.0f / Time_Delta; for (int i = 0; i < Number_Particles; i++) { Particles[i].corrected_vel = Particles[i].predicted_vel + (Particles[i].mGoalPos - Particles[i].pos) * time_delta_1 * alpha; } } void SPH_SM_monodomain::calculate_intermediate_velocity() { Particle *p; m3Vector CellPos; m3Vector NeighborPos; int hash; for(int k = 0; k < Number_Particles; k++) { p = &Particles[k]; CellPos = Calculate_Cell_Position(p->pos); m3Vector partial_velocity(0.0f, 0.0f, 0.0f); for(int k = -1; k <= 1; k++) for(int j = -1; j <= 1; j++) for(int i = -1; i <= 1; i++) { NeighborPos = CellPos + m3Vector(i, j, k); hash = Calculate_Cell_Hash(NeighborPos); if(hash == -1) continue; for(Particle* np : Cells[hash].contained_particles) { m3Vector Distance; Distance = p->pos - np->pos; float dis2 = (float)Distance.magnitudeSquared(); partial_velocity += (np->corrected_vel - p->corrected_vel) * Poly6(dis2) * (np->mass / np->dens); } } p->inter_vel = p->corrected_vel + partial_velocity * velocity_mixing; } } void SPH_SM_monodomain::set_stim(m3Vector center, m3Real radius, m3Real stim_strength) { Particle *p; isStimOn = true; for(int k = 0; k < Number_Particles; k++) { p = &Particles[k]; m3Vector position = p->pos; if (((position.x-center.x)*(position.x-center.x)+(position.y-center.y)*(position.y-center.y)+(position.z-center.z)*(position.z-center.z)) <= radius) { p->stim = stim_strength; } } } void SPH_SM_monodomain::turnOnStim_Cube(std::vector<m3Vector> positions) { m3Vector cm; Particle *p; for(m3Vector pos : positions) { cm += pos; if( (pos.x >= 0.45 && pos.x <= 0.48) || (pos.x > 1.0 && pos.z <= 1.05f) ) set_stim(pos, 0.001f, stim_strength); } cm /= Number_Particles; // set_stim(m3Vector(0.3,0.0,0.7), 0.001f, stim_strength); // set_stim(cm, 0.001f, stim_strength); for(int k = 0; k < Number_Particles; k++) { p = &Particles[k]; m3Vector position = p->pos; if ((position.y == 0.0f && position.x <= 0.48f) || (position.y == 0.0f && position.x >= 1.0)) p->mFixed = true; } // cout<<"Particles stimulated."<<endl; } void SPH_SM_monodomain::turnOnStim_Mesh(std::vector<m3Vector> positions) { m3Vector cm; Particle *p; for(m3Vector pos : positions) { // if( (pos.x >= 0.3 && pos.x <= 0.5) || (pos.x > 1.1f && pos.x <= 1.29f) ) set_stim(pos, 0.01f, stim_strength); } for(int k = 0; k < Number_Particles; k++) { p = &Particles[k]; if ((p->pos.x >= 0.0 && p->pos.x <= 0.07) || (p->pos.x >= 0.90 && p->pos.y >= 0.80)) p->mFixed = true; } } void SPH_SM_monodomain::turnOffStim() { Particle *p; isStimOn = false; for(int k = 0; k < Number_Particles; k++) { p = &Particles[k]; p->stim = -10000.0f; p->Vm = 0.0f; p->Inter_Vm = 0.0f; p->Iion = 0.0f; p->pres = -10000.0f; p->w = 0.0f; if(p->stim > 0.0f) { p->stim = 0.0f; } } } void SPH_SM_monodomain::print_report(double avg_fps, double avg_step_d) { // cout << "Avg FPS ; Avg Step Duration ; Time Steps ; Find neighbors ; Corrected Velocity ; Intermediate Velocity ; Density-Pressure ; Cell model ; Compute Force ; Update Properties ; K ; Alpha ; Beta ; Mu ; sigma ; Stim strength ; FH_VT ; FH_VP ; FH_VR ; C1 ; C2 ; C3 ; C4" << endl; cout << avg_fps << ";" << avg_step_d << ";" << total_time_steps << ";" << d_find_neighbors.count() / total_time_steps << ";" << d_corrected_velocity.count() / total_time_steps << ";" << d_intermediate_velocity.count() / total_time_steps << ";" << d_Density_SingPressure.count() / total_time_steps << ";" << d_cell_model.count() / total_time_steps << ";" << d_compute_Force.count() / total_time_steps << ";" << d_Update_Properties.count() / total_time_steps << ";"; cout << K << ";" << alpha << ";" << beta << ";" << mu << ";" << sigma << ";" << stim_strength << ";" << FH_Vt << ";" << FH_Vp << ";" << FH_Vr << ";" << C1 << ";" << C2 << ";" << C3 << ";" << C4 << endl; } void SPH_SM_monodomain::compute_SPH_SM_monodomain() { tpoint tstart = std::chrono::system_clock::now(); Find_neighbors(); d_find_neighbors += std::chrono::system_clock::now() - tstart; tstart = std::chrono::system_clock::now(); calculate_corrected_velocity(); d_corrected_velocity += std::chrono::system_clock::now() - tstart; tstart = std::chrono::system_clock::now(); calculate_intermediate_velocity(); d_intermediate_velocity += std::chrono::system_clock::now() - tstart; tstart = std::chrono::system_clock::now(); Compute_Density_SingPressure(); d_Density_SingPressure += std::chrono::system_clock::now() - tstart; tstart = std::chrono::system_clock::now(); calculate_cell_model(); d_cell_model += std::chrono::system_clock::now() - tstart; tstart = std::chrono::system_clock::now(); Compute_Force(); d_compute_Force += std::chrono::system_clock::now() - tstart; tstart = std::chrono::system_clock::now(); Update_Properties(); d_Update_Properties += std::chrono::system_clock::now() - tstart; total_time_steps++; } void SPH_SM_monodomain::Animation() { compute_SPH_SM_monodomain(); } #endif
25.205529
465
0.583425
Hagen23
3cf4c4ba4ceb68b48a6298f95bdb4b08d6dbf4a3
10,751
cpp
C++
src/xalanc/XSLT/ElemValueOf.cpp
kidaa/xalan-c
bb666d0ab3d0a192410823e6857c203d83c27b16
[ "Apache-2.0" ]
null
null
null
src/xalanc/XSLT/ElemValueOf.cpp
kidaa/xalan-c
bb666d0ab3d0a192410823e6857c203d83c27b16
[ "Apache-2.0" ]
1
2021-08-18T12:32:31.000Z
2021-08-18T12:32:31.000Z
src/xalanc/XSLT/ElemValueOf.cpp
AaronNGray/xalan
6741bbdcb64a9d33df8bd7e21b558d66bb4292ec
[ "Apache-2.0" ]
null
null
null
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "ElemValueOf.hpp" #include <xercesc/sax/AttributeList.hpp> #include <xalanc/PlatformSupport/DOMStringHelper.hpp> #include <xalanc/PlatformSupport/XalanMessageLoader.hpp> #include <xalanc/DOMSupport/DOMServices.hpp> #include <xalanc/XPath/XObjectFactory.hpp> #include <xalanc/XPath/XPath.hpp> #include "Constants.hpp" #include "SelectionEvent.hpp" #include "Stylesheet.hpp" #include "StylesheetConstructionContext.hpp" #include "StylesheetExecutionContext.hpp" #include "StylesheetRoot.hpp" XALAN_CPP_NAMESPACE_BEGIN ElemValueOf::ElemValueOf( StylesheetConstructionContext& constructionContext, Stylesheet& stylesheetTree, const AttributeListType& atts, XalanFileLoc lineNumber, XalanFileLoc columnNumber) : ElemTemplateElement( constructionContext, stylesheetTree, lineNumber, columnNumber, StylesheetConstructionContext::ELEMNAME_VALUE_OF), m_selectPattern(0) { bool isSelectCurrentNode = false; const XalanSize_t nAttrs = atts.getLength(); for (XalanSize_t i = 0; i < nAttrs; i++) { const XalanDOMChar* const aname = atts.getName(i); if (equals(aname, Constants::ATTRNAME_SELECT)) { const XalanDOMChar* const avalue = atts.getValue(i); assert(avalue != 0); if (avalue[0] == XalanUnicode::charFullStop && avalue[1] == 0) { isSelectCurrentNode = true; } else { m_selectPattern = constructionContext.createXPath( getLocator(), avalue, *this); } } else if (equals(aname, Constants::ATTRNAME_DISABLE_OUTPUT_ESCAPING)) { disableOutputEscaping( getStylesheet().getYesOrNo( aname, atts.getValue(i), constructionContext)); } else if (isAttrOK( aname, atts, i, constructionContext) == false && processSpaceAttr( Constants::ELEMNAME_VALUEOF_WITH_PREFIX_STRING.c_str(), aname, atts, i, constructionContext) == false) { error( constructionContext, XalanMessages::ElementHasIllegalAttribute_2Param, Constants::ELEMNAME_VALUEOF_WITH_PREFIX_STRING.c_str(), aname); } } if (isSelectCurrentNode == false && m_selectPattern == 0) { error( constructionContext, XalanMessages::ElementRequiresAttribute_2Param, Constants::ELEMNAME_VALUEOF_WITH_PREFIX_STRING, Constants::ATTRNAME_SELECT); } } ElemValueOf::~ElemValueOf() { } const XalanDOMString& ElemValueOf::getElementName() const { return Constants::ELEMNAME_VALUEOF_WITH_PREFIX_STRING; } class FormatterListenerAdapater : public FormatterListener { public: FormatterListenerAdapater(StylesheetExecutionContext& executionContext) : FormatterListener(OUTPUT_METHOD_NONE), m_executionContext(executionContext) { } ~FormatterListenerAdapater() { } void setDocumentLocator(const Locator* const /* locator */) { } void startDocument() { } void endDocument() { } void startElement( const XMLCh* const /* name */, AttributeListType& /* attrs */) { } void endElement(const XMLCh* const /* name */) { } void characters( const XMLCh* const chars, const size_type length) { m_executionContext.characters(chars, 0, length); } void charactersRaw( const XMLCh* const chars, const size_type length) { m_executionContext.charactersRaw(chars, 0, length); } void entityReference(const XMLCh* const /* name */) { } void ignorableWhitespace( const XMLCh* const /* chars */, const size_type /* length */) { } void processingInstruction( const XMLCh* const target, const XMLCh* const data) { m_executionContext.processingInstruction(target, data); } void resetDocument() { } void comment(const XMLCh* const data) { m_executionContext.comment(data); } void cdata( const XMLCh* const /* ch */, const size_type /* length */) { } private: StylesheetExecutionContext& m_executionContext; }; #if !defined(XALAN_RECURSIVE_STYLESHEET_EXECUTION) const ElemTemplateElement* ElemValueOf::startElement(StylesheetExecutionContext& executionContext) const { ElemTemplateElement::startElement(executionContext); XalanNode* const sourceNode = executionContext.getCurrentNode(); assert(sourceNode != 0); if (m_selectPattern == 0) { if (disableOutputEscaping() == false) { executionContext.characters(*sourceNode); } else { executionContext.charactersRaw(*sourceNode); } if (0 != executionContext.getTraceListeners()) { const StylesheetExecutionContext::GetCachedString theString(executionContext); DOMServices::getNodeData(*sourceNode, executionContext, theString.get()); fireSelectionEvent(executionContext, sourceNode, theString.get()); } } else { FormatterListenerAdapater theAdapter(executionContext); XPath::MemberFunctionPtr theFunction = disableOutputEscaping() == false ? &FormatterListener::characters : &FormatterListener::charactersRaw; m_selectPattern->execute(*this, executionContext, theAdapter, theFunction); if (0 != executionContext.getTraceListeners()) { const XObjectPtr value(m_selectPattern->execute(sourceNode, *this, executionContext)); if (value.null() == false) { fireSelectionEvent(executionContext, sourceNode, value); } } } return 0; } #endif #if defined(XALAN_RECURSIVE_STYLESHEET_EXECUTION) void ElemValueOf::execute(StylesheetExecutionContext& executionContext) const { ElemTemplateElement::execute(executionContext); XalanNode* const sourceNode = executionContext.getCurrentNode(); assert(sourceNode != 0); if (m_selectPattern == 0) { if (disableOutputEscaping() == false) { executionContext.characters(*sourceNode); } else { executionContext.charactersRaw(*sourceNode); } if (0 != executionContext.getTraceListeners()) { const StylesheetExecutionContext::GetCachedString theString(executionContext); DOMServices::getNodeData(*sourceNode, executionContext, theString.get()); fireSelectionEvent(executionContext, sourceNode, theString.get()); } } else { FormatterListenerAdapater theAdapter(executionContext); XPath::MemberFunctionPtr theFunction = disableOutputEscaping() == false ? &FormatterListener::characters : &FormatterListener::charactersRaw; m_selectPattern->execute(*this, executionContext, theAdapter, theFunction); if (0 != executionContext.getTraceListeners()) { const XObjectPtr value(m_selectPattern->execute(sourceNode, *this, executionContext)); if (value.null() == false) { fireSelectionEvent(executionContext, sourceNode, value); } } } } #endif const XPath* ElemValueOf::getXPath(XalanSize_t index) const { return index == 0 ? m_selectPattern : 0; } void ElemValueOf::fireSelectionEvent( StylesheetExecutionContext& executionContext, XalanNode* sourceNode, const XalanDOMString& theValue) const { const XObjectPtr value(executionContext.getXObjectFactory().createStringReference(theValue)); fireSelectionEvent(executionContext, sourceNode, value); } void ElemValueOf::fireSelectionEvent( StylesheetExecutionContext& executionContext, XalanNode* sourceNode, const XObjectPtr theValue) const { if (m_selectPattern != 0) { fireSelectionEvent( executionContext, sourceNode, theValue, m_selectPattern->getExpression().getCurrentPattern()); } else { const StylesheetExecutionContext::GetCachedString thePattern(executionContext); thePattern.get() = "."; fireSelectionEvent( executionContext, sourceNode, theValue, thePattern.get()); } } void ElemValueOf::fireSelectionEvent( StylesheetExecutionContext& executionContext, XalanNode* sourceNode, const XObjectPtr theValue, const XalanDOMString& thePattern) const { executionContext.fireSelectEvent( SelectionEvent( executionContext, sourceNode, *this, XalanDOMString("select", executionContext.getMemoryManager()), thePattern, theValue)); } XALAN_CPP_NAMESPACE_END
25.002326
101
0.597898
kidaa
3cf6bf02b24135d23e7a67e4f4a0e75ad5c1de31
14,231
cpp
C++
libless/src/value/NumberFunctions.cpp
Ti-R/clessc
c822dedd077ff82395890d6c58f213d9a574d96c
[ "MIT" ]
66
2015-02-07T09:08:30.000Z
2021-12-06T17:07:45.000Z
libless/src/value/NumberFunctions.cpp
Ti-R/clessc
c822dedd077ff82395890d6c58f213d9a574d96c
[ "MIT" ]
30
2015-01-18T07:05:48.000Z
2020-10-08T12:44:21.000Z
libless/src/value/NumberFunctions.cpp
Ti-R/clessc
c822dedd077ff82395890d6c58f213d9a574d96c
[ "MIT" ]
19
2015-10-19T12:59:19.000Z
2021-12-06T17:07:49.000Z
#include "less/value/NumberFunctions.h" #include "less/value/FunctionLibrary.h" #include "less/value/Value.h" #include "less/value/NumberValue.h" #include "less/value/UnitValue.h" void NumberFunctions::loadFunctions(FunctionLibrary& lib) { lib.push("unit", ".U?", &NumberFunctions::unit); lib.push("get-unit", ".", &NumberFunctions::get_unit); lib.push("isunit", "..", &NumberFunctions::is_unit); lib.push("ceil", ".", &NumberFunctions::ceil); lib.push("floor", ".", &NumberFunctions::floor); lib.push("percentage", "N", &NumberFunctions::percentage); lib.push("round", ".", &NumberFunctions::round); lib.push("sqrt", ".", &NumberFunctions::sqrt); lib.push("abs", ".", &NumberFunctions::abs); lib.push("sin", ".", &NumberFunctions::sin); lib.push("asin", "N", &NumberFunctions::asin); lib.push("cos", ".", &NumberFunctions::cos); lib.push("acos", "N", &NumberFunctions::acos); lib.push("tan", ".", &NumberFunctions::tan); lib.push("atan", "N", &NumberFunctions::atan); lib.push("pi", "", &NumberFunctions::pi); lib.push("pow", ".N", &NumberFunctions::pow); lib.push("mod", "..", &NumberFunctions::mod); lib.push("convert", "..", &NumberFunctions::convert); lib.push("min", "..+", &NumberFunctions::min); lib.push("max", "..+", &NumberFunctions::max); lib.push("isnumber", ".", &NumberFunctions::is_number); lib.push("isstring", ".", &NumberFunctions::is_string); lib.push("iscolor", ".", &NumberFunctions::is_color); lib.push("iskeyword", ".", &NumberFunctions::is_keyword); lib.push("isurl", ".", &NumberFunctions::is_url); lib.push("ispixel", ".", &NumberFunctions::is_pixel); lib.push("isem", ".", &NumberFunctions::is_em); lib.push("ispercentage", ".", &NumberFunctions::is_percentage); } // DIMENSION unit(DIMENSION, UNIT) Value* NumberFunctions::unit(const vector<const Value*>& arguments) { NumberValue* ret; if (arguments[0]->type == Value::NUMBER || arguments[0]->type == Value::DIMENSION) { ret = new NumberValue(((const NumberValue*)arguments[0])->getValue()); if (arguments.size() > 1) { ret->setUnit(((const UnitValue*)arguments[1])->getUnit()); } else ret->setUnit(""); return ret; } else throw new ValueException( "argument 1 has to be a number " "or dimension", *arguments[0]->getTokens()); } Value* NumberFunctions::get_unit(const vector<const Value*>& arguments) { Token t("", Token::IDENTIFIER, 0, 0, NULL); const NumberValue* val; if (arguments[0]->type == Value::NUMBER || arguments[0]->type == Value::DIMENSION) { val = (const NumberValue*)arguments[0]; t = val->getUnit(); t.setLocation(val->getTokens()->front()); } return new UnitValue(t); } Value* NumberFunctions::is_unit(const vector<const Value*>& arguments) { bool ret = false; if ((arguments[0]->type == Value::NUMBER || arguments[0]->type == Value::DIMENSION) && arguments[1]->type == Value::UNIT) { ret = (((const NumberValue*)arguments[0])->getUnit() == ((const UnitValue*)arguments[1])->getUnit()); } else if (arguments[0]->type == Value::PERCENTAGE && arguments[1]->type == Value::STRING) { ret = (((const StringValue*)arguments[1])->getString() == "%"); } return new BooleanValue(ret); } Value* NumberFunctions::ceil(const vector<const Value*>& args) { NumberValue* n; if (!NumberValue::isNumber(*args[0])) throw new ValueException( "ceil() only works on numeric " "values", *args[0]->getTokens()); n = new NumberValue(*static_cast<const NumberValue*>(args[0])); double val = n->getValue(); n->setValue(std::ceil(val)); return n; } Value* NumberFunctions::floor(const vector<const Value*>& args) { NumberValue* n; if (!NumberValue::isNumber(*args[0])) throw new ValueException( "floor() only works on numeric " "values", *args[0]->getTokens()); n = new NumberValue(*static_cast<const NumberValue*>(args[0])); double val = n->getValue(); n->setValue(std::floor(val)); return n; } Value* NumberFunctions::percentage(const vector<const Value*>& args) { const NumberValue* val = (const NumberValue*)args[0]; return new NumberValue(val->getValue() * 100, Token::PERCENTAGE, NULL); } Value* NumberFunctions::round(const vector<const Value*>& args) { if (!NumberValue::isNumber(*args[0])) throw new ValueException( "round() only works on numeric " "values", *args[0]->getTokens()); NumberValue* n = new NumberValue(*(const NumberValue*)args[0]); double val = n->getValue(); double decimalplaces = 0; if (args.size() > 1) decimalplaces = ((const NumberValue*)args[1])->getValue(); val = val * std::pow(10, decimalplaces); val = std::floor(val + 0.5); val = val / std::pow(10, decimalplaces); n->setValue(val); return n; } Value* NumberFunctions::sqrt(const vector<const Value*>& args) { if (!NumberValue::isNumber(*args[0])) throw new ValueException( "sqrt() only works on numeric " "values", *args[0]->getTokens()); NumberValue* n = new NumberValue(*(const NumberValue*)args[0]); n->setValue(std::sqrt(n->getValue())); return n; } Value* NumberFunctions::abs(const vector<const Value*>& args) { if (!NumberValue::isNumber(*args[0])) throw new ValueException( "abs() only works on numeric " "values", *args[0]->getTokens()); NumberValue* n = new NumberValue(*(const NumberValue*)args[0]); n->setValue(fabs(n->getValue())); return n; } Value* NumberFunctions::sin(const vector<const Value*>& args) { if (args[0]->type != Value::NUMBER && args[0]->type != Value::DIMENSION) { throw new ValueException( "sin() only works on numbers " "or dimensions", *args[0]->getTokens()); } NumberValue* n = new NumberValue(*(const NumberValue*)args[0]); double val = n->getValue(); std::string unit; if (n->type == Value::DIMENSION) { unit = n->getUnit(); if (unit.compare("rad") != 0 && unit.compare("deg") != 0 && unit.compare("grad") != 0 && unit.compare("turn") != 0) { throw new ValueException( "sin() requires rad, deg, " "grad or turn units.", *args[0]->getTokens()); } val = UnitValue::angleToRad(val, unit); } n->setValue(std::sin(val)); n->type = Value::NUMBER; n->setUnit(""); return n; } Value* NumberFunctions::asin(const vector<const Value*>& args) { NumberValue* n = new NumberValue(*(const NumberValue*)args[0]); n->setValue(std::asin(n->getValue())); n->setUnit("rad"); n->type = Value::DIMENSION; return n; } Value* NumberFunctions::cos(const vector<const Value*>& args) { if (args[0]->type != Value::NUMBER && args[0]->type != Value::DIMENSION) { throw new ValueException( "cos() only works on numbers " "or dimensions", *args[0]->getTokens()); } NumberValue* n = new NumberValue(*(const NumberValue*)args[0]); double val = n->getValue(); std::string unit; if (n->type == Value::DIMENSION) { unit = n->getUnit(); if (unit.compare("rad") != 0 && unit.compare("deg") != 0 && unit.compare("grad") != 0 && unit.compare("turn") != 0) { throw new ValueException( "cos() requires rad, deg, " "grad or turn units.", *args[0]->getTokens()); } val = UnitValue::angleToRad(val, unit); } n->setValue(std::cos(val)); n->type = Value::NUMBER; n->setUnit(""); return n; } Value* NumberFunctions::acos(const vector<const Value*>& args) { NumberValue* n = new NumberValue(*(const NumberValue*)args[0]); n->setValue(std::acos(n->getValue())); n->setUnit("rad"); n->type = Value::DIMENSION; return n; } Value* NumberFunctions::tan(const vector<const Value*>& args) { if (args[0]->type != Value::NUMBER && args[0]->type != Value::DIMENSION) { throw new ValueException( "tan() only works on numbers " "or dimensions", *args[0]->getTokens()); } NumberValue* n = new NumberValue(*(const NumberValue*)args[0]); double val = n->getValue(); std::string unit; if (n->type == Value::DIMENSION) { unit = n->getUnit(); if (unit.compare("rad") != 0 && unit.compare("deg") != 0 && unit.compare("grad") != 0 && unit.compare("turn") != 0) { throw new ValueException( "ta() requires rad, deg, " "grad or turn units.", *args[0]->getTokens()); } val = UnitValue::angleToRad(val, unit); } n->setValue(std::tan(val)); n->type = Value::NUMBER; n->setUnit(""); return n; } Value* NumberFunctions::atan(const vector<const Value*>& args) { NumberValue* n = new NumberValue(*(const NumberValue*)args[0]); n->setValue(std::atan(n->getValue())); n->setUnit("rad"); n->type = Value::DIMENSION; return n; } Value* NumberFunctions::pi(const vector<const Value*>& args) { (void)args; return new NumberValue(3.141592653589793); } Value* NumberFunctions::pow(const vector<const Value*>& args) { if (!NumberValue::isNumber(*args[0])) throw new ValueException("pow() only works on numeric values", *args[0]->getTokens()); NumberValue* n = new NumberValue(*(const NumberValue*)args[0]); double exp = ((const NumberValue*)args[1])->getValue(); n->setValue(std::pow(n->getValue(), exp)); return n; } Value* NumberFunctions::mod(const vector<const Value*>& args) { if (!NumberValue::isNumber(*args[0]) || !NumberValue::isNumber(*args[1])) throw new ValueException("mod() only works on numeric values", *args[0]->getTokens()); NumberValue* n = new NumberValue(*(const NumberValue*)args[0]); double val2 = ((NumberValue*)args[1])->getValue(); n->setValue(std::fmod(n->getValue(), val2)); return n; } Value* NumberFunctions::convert(const vector<const Value*>& args) { if (!NumberValue::isNumber(*args[0])) throw new ValueException("convert() only works on numeric values", *args[0]->getTokens()); if (args[1]->type != Value::STRING && args[1]->type != Value::UNIT) { throw new ValueException( "convert() requires a unit \ (or unit as a string)", *args[1]->getTokens()); } NumberValue* n = new NumberValue(*(const NumberValue*)args[0]); std::string unit; if (args[1]->type == Value::STRING) unit = ((const StringValue*)args[1])->getString(); else unit.append(((const UnitValue*)args[1])->getUnit()); n->setValue(n->convert(unit)); n->setUnit(unit); return n; } Value* NumberFunctions::min(const vector<const Value*>& arguments) { const NumberValue* min = NULL; vector<const Value *>::const_iterator it; for (it = arguments.begin(); it != arguments.end(); it++) { if (!NumberValue::isNumber(**it)) { throw new ValueException("arguments should be numbers", *(*it)->getTokens()); } else if (min == NULL) { min = (const NumberValue*)*it; } else { if (((const NumberValue*)*it)->convert(min->getUnit()) < min->getValue()) { min = (const NumberValue*)*it; } } } return new NumberValue(*min); } Value* NumberFunctions::max(const vector<const Value*>& arguments) { const NumberValue* max = NULL; vector<const Value *>::const_iterator it; for (it = arguments.begin(); it != arguments.end(); it++) { if (!NumberValue::isNumber(**it)) { throw new ValueException("arguments should be numbers", *(*it)->getTokens()); } else if (max == NULL) { max = (const NumberValue*)*it; } else { if (((const NumberValue*)*it)->convert(max->getUnit()) > max->getValue()) { max = (const NumberValue*)*it; } } } return new NumberValue(*max); } Value* NumberFunctions::is_number(const vector<const Value*>& arguments) { return new BooleanValue(NumberValue::isNumber(*arguments[0])); } Value* NumberFunctions::is_string(const vector<const Value*>& arguments) { return new BooleanValue(arguments[0]->type == Value::STRING && ((const StringValue*)arguments[0]) ->getQuotes() == true); } Value* NumberFunctions::is_color(const vector<const Value*>& arguments) { return new BooleanValue(arguments[0]->type == Value::COLOR); } Value* NumberFunctions::is_keyword(const vector<const Value*>& arguments) { return new BooleanValue(arguments[0]->type == Value::STRING && ((const StringValue*)arguments[0]) ->getQuotes() == false); } Value* NumberFunctions::is_url(const vector<const Value*>& arguments) { return new BooleanValue(arguments[0]->type == Value::URL); } Value* NumberFunctions::is_pixel(const vector<const Value*>& arguments) { return new BooleanValue(arguments[0]->type == Value::DIMENSION && ((const NumberValue*)arguments[0]) ->getUnit() == "px"); } Value* NumberFunctions::is_em(const vector<const Value*>& arguments) { return new BooleanValue(arguments[0]->type == Value::DIMENSION && ((const NumberValue*)arguments[0]) ->getUnit() == "em"); } Value* NumberFunctions::is_percentage(const vector<const Value*>& arguments) { return new BooleanValue(arguments[0]->type == Value::PERCENTAGE); }
34.625304
78
0.577612
Ti-R
3cf9215adfb996ab70f88fc8175b9281211047cb
1,485
cpp
C++
Tree/nodesNotHavingSiblings.cpp
harshallgarg/Diversified-Programming
7e6fb135c4639dbaa0651b85f98397f994a5b11d
[ "MIT" ]
2
2020-08-09T02:09:50.000Z
2020-08-09T07:07:47.000Z
Tree/nodesNotHavingSiblings.cpp
harshallgarg/Diversified-Programming
7e6fb135c4639dbaa0651b85f98397f994a5b11d
[ "MIT" ]
null
null
null
Tree/nodesNotHavingSiblings.cpp
harshallgarg/Diversified-Programming
7e6fb135c4639dbaa0651b85f98397f994a5b11d
[ "MIT" ]
5
2020-09-21T12:49:07.000Z
2020-09-29T16:13:09.000Z
// // Created by Anish Mookherjee on 27/05/20. // /* Tree node structure used in the program struct Node { int data; Node* left, *right; }; */ /* Prints the nodes having no siblings. */ vector<int> v; void pushVector(Node* root) { if(root==NULL) return; else if(!root->left&&root->right) v.push_back(root->right->data); else if(!root->right&&root->left) v.push_back(root->left->data); if(root->left) pushVector(root->left); if(root->right) pushVector(root->right); } void printSibling(Node* node) { pushVector(node); if(v.size()==0) { cout<<-1; } else { sort(v.begin(),v.end()); for(int i=0;i<v.size();i++) cout<<v[i]<<" "; } v.clear(); } // also accepted using set /* Tree node structure used in the program struct Node { int data; Node* left, *right; }; */ /* Prints the nodes having no siblings. */ set<int> s; void insertSet(Node* root) { if(root==NULL) return; else if(!root->left&&root->right) s.insert(root->right->data); else if(!root->right&&root->left) s.insert(root->left->data); if(root->left) insertSet(root->left); if(root->right) insertSet(root->right); } void printSibling(Node* node) { insertSet(node); if(s.size()==0) { cout<<-1; } else { for(auto i:s) cout<<i<<" "; } s.clear(); }
17.470588
43
0.531987
harshallgarg
3cfa57d0287b926ac690165484157b616e709dd9
14,036
cpp
C++
src/graphics/CSegmentArray.cpp
Yung-Quant/elec490
09314b1c3f4f061effa396c104f094f28a0aabff
[ "BSD-3-Clause" ]
null
null
null
src/graphics/CSegmentArray.cpp
Yung-Quant/elec490
09314b1c3f4f061effa396c104f094f28a0aabff
[ "BSD-3-Clause" ]
null
null
null
src/graphics/CSegmentArray.cpp
Yung-Quant/elec490
09314b1c3f4f061effa396c104f094f28a0aabff
[ "BSD-3-Clause" ]
null
null
null
//============================================================================== /* Software License Agreement (BSD License) Copyright (c) 2003-2016, CHAI3D. (www.chai3d.org) All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of CHAI3D 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 OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \author <http://www.chai3d.org> \author Francois Conti \version $MAJOR.$MINOR.$RELEASE $Rev: 2015 $ */ //============================================================================== //------------------------------------------------------------------------------ #include "graphics/CSegmentArray.h" //------------------------------------------------------------------------------ #include "collisions/CCollisionBasics.h" #include "world/CMultiSegment.h" //------------------------------------------------------------------------------ //------------------------------------------------------------------------------ namespace chai3d { //------------------------------------------------------------------------------ //============================================================================== /*! This method checks if the given line segment intersects a selected segment from this array.\n If a collision occurs, the collision point is reported through the collision recorder.\n \param a_elementIndex Segment index number. \param a_object Pointer to the object on which collision detection is being performed. \param a_segmentPointA Point from where collision ray starts (in local frame). \param a_segmentPointB Direction vector of collision ray (in local frame). \param a_recorder Stores collision events \param a_settings Collision detection settings. \return __true__ if a collision occurred, otherwise __false__. */ //============================================================================== bool cSegmentArray::computeCollision(const unsigned int a_elementIndex, cGenericObject* a_object, cVector3d& a_segmentPointA, cVector3d& a_segmentPointB, cCollisionRecorder& a_recorder, cCollisionSettings& a_settings) const { // verify that segment is active if (!m_allocated[a_elementIndex]) { return (false); } // temp variables bool hit = false; cVector3d collisionPoint; cVector3d collisionNormal; double collisionDistanceSq = C_LARGE; double collisionPointV01 = 0.0; // retrieve vertex positions cVector3d vertex0 = m_vertices->getLocalPos(getVertexIndex0(a_elementIndex)); cVector3d vertex1 = m_vertices->getLocalPos(getVertexIndex1(a_elementIndex)); // If m_collisionRadius == 0, no collision is possible. if (a_settings.m_collisionRadius == 0.0) { return (false); } // If m_collisionRadius > 0, we search for a possible intersection between // the segment AB and the segment described by its two vertices and m_collisionRadius. else { cVector3d t_collisionPoint, t_collisionNormal; double t_collisionDistanceSq, t_collisionPointV01; // check for collision between sphere located at vertex 0. cVector3d t_p, t_n; double t_c; if (cIntersectionSegmentSphere(a_segmentPointA, a_segmentPointB, vertex0, a_settings.m_collisionRadius, t_collisionPoint, t_collisionNormal, t_p, t_n) > 0) { hit = true; t_collisionDistanceSq = cDistanceSq(a_segmentPointA, t_collisionPoint); if (t_collisionDistanceSq <= collisionDistanceSq) { collisionPoint = t_collisionPoint; collisionNormal = t_collisionNormal; collisionDistanceSq = t_collisionDistanceSq; collisionPointV01 = 0.0; } } // check for collision between sphere located at vertex 1. if (cIntersectionSegmentSphere(a_segmentPointA, a_segmentPointB, vertex1, a_settings.m_collisionRadius, t_collisionPoint, t_collisionNormal, t_p, t_n) > 0) { hit = true; t_collisionDistanceSq = cDistanceSq(a_segmentPointA, t_collisionPoint); if (t_collisionDistanceSq <= collisionDistanceSq) { collisionPoint = t_collisionPoint; collisionNormal = t_collisionNormal; collisionDistanceSq = t_collisionDistanceSq; collisionPointV01 = 1.0; } } // check for collision along segment if (cIntersectionSegmentToplessCylinder(a_segmentPointA, a_segmentPointB, vertex0, vertex1, a_settings.m_collisionRadius, t_collisionPoint, t_collisionNormal, t_collisionPointV01, t_p, t_n, t_c) > 0) { hit = true; t_collisionDistanceSq = cDistanceSq(a_segmentPointA, t_collisionPoint); if (t_collisionDistanceSq <= collisionDistanceSq) { collisionPoint = t_collisionPoint; collisionNormal = t_collisionNormal; collisionDistanceSq = t_collisionDistanceSq; collisionPointV01 = t_collisionPointV01; } } } // report collision if (hit) { // we verify if a new collision needs to be created or if we simply // need to update the nearest collision. if (a_settings.m_checkForNearestCollisionOnly) { // no new collision event is create. We just check if we need // to update the nearest collision if(collisionDistanceSq <= a_recorder.m_nearestCollision.m_squareDistance) { // report basic collision data a_recorder.m_nearestCollision.m_type = C_COL_SEGMENT; a_recorder.m_nearestCollision.m_object = a_object; a_recorder.m_nearestCollision.m_segments = ((cMultiSegment*)(a_object))->m_segments; a_recorder.m_nearestCollision.m_index = a_elementIndex; a_recorder.m_nearestCollision.m_localPos = collisionPoint; a_recorder.m_nearestCollision.m_localNormal = collisionNormal; a_recorder.m_nearestCollision.m_squareDistance = collisionDistanceSq; a_recorder.m_nearestCollision.m_adjustedSegmentAPoint = a_segmentPointA; a_recorder.m_nearestCollision.m_posV01 = collisionPointV01; a_recorder.m_nearestCollision.m_posV02 = 0.0; // report advanced collision data if (!a_settings.m_returnMinimalCollisionData) { a_recorder.m_nearestCollision.m_globalPos = cAdd(a_object->getGlobalPos(), cMul(a_object->getGlobalRot(), a_recorder.m_nearestCollision.m_localPos)); a_recorder.m_nearestCollision.m_globalNormal = cMul(a_object->getGlobalRot(), a_recorder.m_nearestCollision.m_localNormal); } } } else { cCollisionEvent newCollisionEvent; // report basic collision data newCollisionEvent.m_type = C_COL_SEGMENT; newCollisionEvent.m_object = a_object; newCollisionEvent.m_segments = ((cMultiSegment*)(a_object))->m_segments; newCollisionEvent.m_index = a_elementIndex; newCollisionEvent.m_localPos = collisionPoint; newCollisionEvent.m_localNormal = collisionNormal; newCollisionEvent.m_squareDistance = collisionDistanceSq; newCollisionEvent.m_adjustedSegmentAPoint = a_segmentPointA; newCollisionEvent.m_posV01 = collisionPointV01; newCollisionEvent.m_posV02 = 0.0; // report advanced collision data if (!a_settings.m_returnMinimalCollisionData) { newCollisionEvent.m_globalPos = cAdd(a_object->getGlobalPos(), cMul(a_object->getGlobalRot(), newCollisionEvent.m_localPos)); newCollisionEvent.m_globalNormal = cMul(a_object->getGlobalRot(), newCollisionEvent.m_localNormal); } // add new collision even to collision list a_recorder.m_collisions.push_back(newCollisionEvent); // check if this new collision is a candidate for "nearest one" if(collisionDistanceSq <= a_recorder.m_nearestCollision.m_squareDistance) { a_recorder.m_nearestCollision = newCollisionEvent; } } } return (hit); } //============================================================================== /*! This method copies all allocated segments. Please note that this method does not copy segments that were previously deallocated. \return New segment array. */ //============================================================================== cSegmentArrayPtr cSegmentArray::copy() { // create new array of segments cSegmentArrayPtr segmentArray = cSegmentArray::create(m_vertices); // get number of allocated segments unsigned int numSegments = getNumElements(); // copy every allocated segments for (unsigned int i=0; i<numSegments; i++) { if (getAllocated(i)) { unsigned int index0 = getVertexIndex0(i); unsigned int index1 = getVertexIndex1(i); segmentArray->newSegment(index0, index1); } } // return new segment array return (segmentArray); } //============================================================================== /*! This method compresses the segment array by removing all non allocated segments. If many segments are unused, this method can effectively reduce the memory footprint allocated by the array.\n __IMPORTANT:__ \n After calling this method, it is important to immediately update any collision detector as the collision tree may try to access segments that no longer exist.\n */ //============================================================================== void cSegmentArray::compress() { // get number of allocated segments unsigned int numSegments = getNumElements(); // remove non allocated segments unsigned int j= (unsigned int)(-1); for (unsigned int i=0; i<numSegments; i++) { if (getAllocated(i)) { j++; if (i!=j) { unsigned int index0 = getVertexIndex0(i); unsigned int index1 = getVertexIndex1(i); m_allocated[j] = true; setVertices(j, index0, index1); } } } // resize arrays unsigned size = j+1; m_allocated.resize(size); m_indices.resize(2*size); } //------------------------------------------------------------------------------ } // namespace chai3d //------------------------------------------------------------------------------
42.662614
101
0.527216
Yung-Quant
a70266cfa6b87ad0f13235fbdab40f6b7920353a
3,709
cpp
C++
test/resqml2_test/WellboreTrajectoryRepresentationTest.cpp
cgodkin/fesapi
d25c5e30ccec537c471adc3bb036c48f2c51f2c9
[ "Apache-2.0" ]
null
null
null
test/resqml2_test/WellboreTrajectoryRepresentationTest.cpp
cgodkin/fesapi
d25c5e30ccec537c471adc3bb036c48f2c51f2c9
[ "Apache-2.0" ]
null
null
null
test/resqml2_test/WellboreTrajectoryRepresentationTest.cpp
cgodkin/fesapi
d25c5e30ccec537c471adc3bb036c48f2c51f2c9
[ "Apache-2.0" ]
null
null
null
/*----------------------------------------------------------------------- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"; you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. -----------------------------------------------------------------------*/ #include "resqml2_test/WellboreTrajectoryRepresentationTest.h" #include <stdexcept> #include "resqml2_test/WellboreInterpretationTest.h" #include "resqml2_test/MdDatumTest.h" #include "catch.hpp" #include "common/EpcDocument.h" #include "resqml2/WellboreInterpretation.h" #include "resqml2/MdDatum.h" #include "resqml2/WellboreTrajectoryRepresentation.h" using namespace std; using namespace resqml2_test; using namespace COMMON_NS; using namespace RESQML2_NS; const char* WellboreTrajectoryRepresentationTest::defaultUuid = "35e83350-5b68-4c1d-bfd8-21791a9c4c41"; const char* WellboreTrajectoryRepresentationTest::defaultTitle = "Wellbore Representation Test"; WellboreTrajectoryRepresentationTest::WellboreTrajectoryRepresentationTest(const string & repoPath) : commontest::AbstractObjectTest(repoPath) { } WellboreTrajectoryRepresentationTest::WellboreTrajectoryRepresentationTest(DataObjectRepository* repo, bool init) : commontest::AbstractObjectTest(repo) { if (init) initRepo(); else readRepo(); } void WellboreTrajectoryRepresentationTest::initRepoHandler() { // getting the local depth 3d crs WellboreInterpretationTest interpTest(repo, true); MdDatumTest mdDatumTest(repo, true); RESQML2_NS::WellboreInterpretation* interp = static_cast<RESQML2_NS::WellboreInterpretation*>(repo->getDataObjectByUuid(WellboreInterpretationTest::defaultUuid)); MdDatum* mdDatum = static_cast<MdDatum*>(repo->getDataObjectByUuid(MdDatumTest::defaultUuid)); // creating the representation RESQML2_NS::WellboreTrajectoryRepresentation* rep = repo->createWellboreTrajectoryRepresentation(interp, defaultUuid, defaultTitle, mdDatum); double controlPoints[12] = { 275, 75, 0, 275, 75, 325, 275, 75, 500, 275, 75, 1000 }; double trajectoryTangentVectors[12] = { 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1 }; double trajectoryMds[4] = { 0, 325, 500, 1000 }; rep->setGeometry(controlPoints, trajectoryTangentVectors, trajectoryMds, 4, 0, repo->getHdfProxySet()[0]); } void WellboreTrajectoryRepresentationTest::readRepoHandler() { // getting the TimeSeries RESQML2_NS::WellboreTrajectoryRepresentation* traj = static_cast<RESQML2_NS::WellboreTrajectoryRepresentation*>(repo->getDataObjectByUuid(defaultUuid)); REQUIRE(traj->getMdDatumDor().getUuid() == MdDatumTest::defaultUuid); REQUIRE(traj->getXyzPointCountOfAllPatches() == 4); REQUIRE(traj->getGeometryKind() == 0); double trajectoryMds[4]; traj->getMdValues(trajectoryMds); REQUIRE(trajectoryMds[0] == 0); REQUIRE(trajectoryMds[1] == 325); REQUIRE(trajectoryMds[2] == 500); REQUIRE(trajectoryMds[3] == 1000); double controlPoints[12]; traj->getXyzPointsOfAllPatchesInGlobalCrs(controlPoints); REQUIRE(controlPoints[0] == 275); REQUIRE(controlPoints[1] == 75); REQUIRE(controlPoints[2] == 0); REQUIRE(controlPoints[3] == 275); }
42.147727
163
0.760582
cgodkin
a7089fdafc2e3224ad4799430a572ed3e8be8167
964
cpp
C++
dlk/python/dlk/templates/src/func/sqrt.cpp
toohsk/blueoil
596922caa939db9c5ecbac3286fbf6f703865ee6
[ "Apache-2.0" ]
null
null
null
dlk/python/dlk/templates/src/func/sqrt.cpp
toohsk/blueoil
596922caa939db9c5ecbac3286fbf6f703865ee6
[ "Apache-2.0" ]
null
null
null
dlk/python/dlk/templates/src/func/sqrt.cpp
toohsk/blueoil
596922caa939db9c5ecbac3286fbf6f703865ee6
[ "Apache-2.0" ]
2
2019-02-08T10:03:34.000Z
2019-03-20T06:25:55.000Z
/* Copyright 2018 The Blueoil Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ==============================================================================*/ #include <cmath> #include "global.h" #include "func/sqrt.h" #include "time_measurement.h" void func_Sqrt(T_FLOAT input[], T_FLOAT output[], T_UINT out_depth) { Measurement::Start("sqrt"); for (T_UINT i = 0; i < out_depth; i++) output[i] = std::sqrt(input[i]); Measurement::Stop(); }
32.133333
80
0.68361
toohsk
a7110ec8f2e77e4efd6c5348589460fab4a0d357
7,940
cpp
C++
source/Irrlicht/CSkyDomeSceneNode.cpp
WieszKto/IrrlichtBAW
bcef8386c2ca7f06ff006b866c397035551a2351
[ "Apache-2.0" ]
null
null
null
source/Irrlicht/CSkyDomeSceneNode.cpp
WieszKto/IrrlichtBAW
bcef8386c2ca7f06ff006b866c397035551a2351
[ "Apache-2.0" ]
null
null
null
source/Irrlicht/CSkyDomeSceneNode.cpp
WieszKto/IrrlichtBAW
bcef8386c2ca7f06ff006b866c397035551a2351
[ "Apache-2.0" ]
null
null
null
// Copyright (C) 2002-2012 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h // Code for this scene node has been contributed by Anders la Cour-Harbo (alc) #include "CSkyDomeSceneNode.h" #include "ICameraSceneNode.h" #include "ISceneManager.h" namespace irr { namespace scene { /* horiRes and vertRes: Controls the number of faces along the horizontal axis (30 is a good value) and the number of faces along the vertical axis (8 is a good value). texturePercentage: Only the top texturePercentage of the image is used, e.g. 0.8 uses the top 80% of the image, 1.0 uses the entire image. This is useful as some landscape images have a small banner at the bottom that you don't want. spherePercentage: This controls how far around the sphere the sky dome goes. For value 1.0 you get exactly the upper hemisphere, for 1.1 you get slightly more, and for 2.0 you get a full sphere. It is sometimes useful to use a value slightly bigger than 1 to avoid a gap between some ground place and the sky. This parameters stretches the image to fit the chosen "sphere-size". */ CSkyDomeSceneNode::CSkyDomeSceneNode(core::smart_refctd_ptr<video::IVirtualTexture>&& texture, uint32_t horiRes, uint32_t vertRes, float texturePercentage, float spherePercentage, float radius, IDummyTransformationSceneNode* parent, ISceneManager* mgr, int32_t id) : ISceneNode(parent, mgr, id), Buffer(nullptr), HorizontalResolution(horiRes), VerticalResolution(vertRes), TexturePercentage(texturePercentage), SpherePercentage(spherePercentage), Radius(radius) { #ifdef _IRR_DEBUG setDebugName("CSkyDomeSceneNode"); #endif setAutomaticCulling(scene::EAC_OFF); Buffer = new video::IGPUMeshBuffer(); Buffer->getMaterial().ZBuffer = video::ECFN_NEVER; Buffer->getMaterial().BackfaceCulling = false; Buffer->getMaterial().ZWriteEnable = false; Buffer->getMaterial().setTexture(0, std::move(texture)); BoundingBox.MaxEdge.set(0,0,0); BoundingBox.MinEdge.set(0,0,0); // regenerate the mesh generateMesh(); } CSkyDomeSceneNode::CSkyDomeSceneNode(CSkyDomeSceneNode* other, IDummyTransformationSceneNode* parent, ISceneManager* mgr, int32_t id) : ISceneNode(parent, mgr, id), Buffer(0), HorizontalResolution(other->HorizontalResolution), VerticalResolution(other->VerticalResolution), TexturePercentage(other->TexturePercentage), SpherePercentage(other->SpherePercentage), Radius(other->Radius) { #ifdef _IRR_DEBUG setDebugName("CSkyDomeSceneNode"); #endif setAutomaticCulling(scene::EAC_OFF); Buffer = other->Buffer; Buffer->grab(); } CSkyDomeSceneNode::~CSkyDomeSceneNode() { if (Buffer) Buffer->drop(); } void CSkyDomeSceneNode::generateMesh() { float azimuth; uint32_t k; const float azimuth_step = (core::PI<float>() * 2.f) / float(HorizontalResolution); if (SpherePercentage < 0.f) SpherePercentage = -SpherePercentage; if (SpherePercentage > 2.f) SpherePercentage = 2.f; const float elevation_step = SpherePercentage * core::HALF_PI<float>() / float(VerticalResolution); size_t numOfIndices = 3 * (2*VerticalResolution - 1) * HorizontalResolution; uint16_t* indices = (uint16_t*)_IRR_ALIGNED_MALLOC(numOfIndices*2,_IRR_SIMD_ALIGNMENT); size_t numberOfVertices = (HorizontalResolution + 1) * (VerticalResolution + 1); float* vertices = (float*)_IRR_ALIGNED_MALLOC(4*numberOfVertices*(3+2),_IRR_SIMD_ALIGNMENT); const float tcV = TexturePercentage / VerticalResolution; size_t vxIx = 0; for (k = 0, azimuth = 0; k <= HorizontalResolution; ++k) { float elevation = core::HALF_PI<float>(); const float tcU = (float)k / (float)HorizontalResolution; const float sinA = sinf(azimuth); const float cosA = cosf(azimuth); for (uint32_t j = 0; j <= VerticalResolution; ++j) { const float cosEr = Radius * cosf(elevation); vertices[vxIx*(3+2)+0] = cosEr*sinA; vertices[vxIx*(3+2)+1] = Radius*sinf(elevation); vertices[vxIx*(3+2)+2] = cosEr*cosA; vertices[vxIx*(3+2)+3] = tcU; vertices[vxIx*(3+2)+4] = j*tcV; vxIx++; elevation -= elevation_step; } azimuth += azimuth_step; } size_t ixIx = 0; for (k = 0; k < HorizontalResolution; ++k) { indices[ixIx++] = VerticalResolution + 2 + (VerticalResolution + 1)*k; indices[ixIx++] = 1 + (VerticalResolution + 1)*k; indices[ixIx++] = 0 + (VerticalResolution + 1)*k; for (uint32_t j = 1; j < VerticalResolution; ++j) { indices[ixIx++] = VerticalResolution + 2 + (VerticalResolution + 1)*k + j; indices[ixIx++] = 1 + (VerticalResolution + 1)*k + j; indices[ixIx++] = 0 + (VerticalResolution + 1)*k + j; indices[ixIx++] = VerticalResolution + 1 + (VerticalResolution + 1)*k + j; indices[ixIx++] = VerticalResolution + 2 + (VerticalResolution + 1)*k + j; indices[ixIx++] = 0 + (VerticalResolution + 1)*k + j; } } auto vao = SceneManager->getVideoDriver()->createGPUMeshDataFormatDesc(); video::IDriverMemoryBacked::SDriverMemoryRequirements reqs; reqs.vulkanReqs.size = numOfIndices*sizeof(uint16_t); reqs.vulkanReqs.alignment = 2; reqs.vulkanReqs.memoryTypeBits = 0xffffffffu; reqs.memoryHeapLocation = video::IDriverMemoryAllocation::ESMT_DEVICE_LOCAL; reqs.mappingCapability = video::IDriverMemoryAllocation::EMCAF_NO_MAPPING_ACCESS; reqs.prefersDedicatedAllocation = true; reqs.requiresDedicatedAllocation = true; { auto indexBuf = core::smart_refctd_ptr<video::IGPUBuffer>(SceneManager->getVideoDriver()->createGPUBufferOnDedMem(reqs, true), core::dont_grab); indexBuf->updateSubRange(video::IDriverMemoryAllocation::MemoryRange(0, reqs.vulkanReqs.size), indices); _IRR_ALIGNED_FREE(indices); vao->setIndexBuffer(std::move(indexBuf)); Buffer->setIndexType(asset::EIT_16BIT); Buffer->setIndexCount(numOfIndices); } reqs.vulkanReqs.size = 4*numberOfVertices*(3+2); reqs.vulkanReqs.alignment = 4; { auto vAttr = core::smart_refctd_ptr<video::IGPUBuffer>(SceneManager->getVideoDriver()->createGPUBufferOnDedMem(reqs, true),core::dont_grab); vAttr->updateSubRange(video::IDriverMemoryAllocation::MemoryRange(0, reqs.vulkanReqs.size), vertices); _IRR_ALIGNED_FREE(vertices); vao->setVertexAttrBuffer(core::smart_refctd_ptr<video::IGPUBuffer>(vAttr), asset::EVAI_ATTR0, asset::EF_R32G32B32_SFLOAT, 4 * (3 + 2), 0); vao->setVertexAttrBuffer(core::smart_refctd_ptr<video::IGPUBuffer>(vAttr), asset::EVAI_ATTR2, asset::EF_R32G32_SFLOAT, 4 * (3 + 2), 4 * 3); } Buffer->setMeshDataAndFormat(std::move(vao)); } //! renders the node. void CSkyDomeSceneNode::render() { video::IVideoDriver* driver = SceneManager->getVideoDriver(); scene::ICameraSceneNode* camera = SceneManager->getActiveCamera(); if (!camera || !driver) return; if ( !camera->getProjectionMatrix().isOrthogonal() && canProceedPastFence() ) // check this actually works! { core::matrix4x3 mat(AbsoluteTransformation); mat.setTranslation(camera->getAbsolutePosition()); driver->setTransform(video::E4X3TS_WORLD, mat); driver->setMaterial(Buffer->getMaterial()); driver->drawMeshBuffer(Buffer); } // for debug purposes only: if ( DebugDataVisible ) { video::SGPUMaterial m; // show mesh if ( DebugDataVisible & scene::EDS_MESH_WIRE_OVERLAY ) { m.Wireframe = true; driver->setMaterial(m); driver->drawMeshBuffer(Buffer); } } } //! returns the axis aligned bounding box of this node const core::aabbox3d<float>& CSkyDomeSceneNode::getBoundingBox() { return BoundingBox; } void CSkyDomeSceneNode::OnRegisterSceneNode() { if (IsVisible) { SceneManager->registerNodeForRendering(this, ESNRP_SKY_BOX ); } ISceneNode::OnRegisterSceneNode(); } } // namespace scene } // namespace irr
33.644068
146
0.715365
WieszKto
a71b8c3974ad8afc505d74eba5973c2bf0d7e250
41,555
cpp
C++
DirectZobEngine/Rendering/Engine.cpp
zeralph/directZob
7682ec0b77b697659be157cce62413e3ee877ee4
[ "WTFPL" ]
2
2019-06-12T18:11:36.000Z
2022-01-19T00:26:00.000Z
DirectZobEngine/Rendering/Engine.cpp
zeralph/directZob
7682ec0b77b697659be157cce62413e3ee877ee4
[ "WTFPL" ]
null
null
null
DirectZobEngine/Rendering/Engine.cpp
zeralph/directZob
7682ec0b77b697659be157cce62413e3ee877ee4
[ "WTFPL" ]
1
2019-10-05T02:44:47.000Z
2019-10-05T02:44:47.000Z
#include "Engine.h" #include <algorithm> #include <thread> #ifdef LINUX #include <unistd.h> #elif MACOS #include <unistd.h> #elif WINDOWS #include <windows.h> #endif //LINUX #include <assert.h> #include <mutex> #include <condition_variable> #include "DirectZob.h" #include "Rasterizer.h" #include "../ZobObjects/Camera.h" #include <mutex> #include "Behaviors/ZobBehaviorMesh.h" #undef None #include "../../dependencies/optick/include/optick.h" #define MAX_TRIANGLES_PER_IMAGE 400000 #define MAX_RENDER_OPTIONS 1000 static ZobVector3 red(1, 0, 0); static ZobVector3 green(0, 1, 0); static ZobVector3 blue(0, 0, 1); static ZobVector3 black(0, 0, 0); static ZobVector3 yellow(1, 1, 0); std::condition_variable** m_conditionvariables; std::mutex** m_mutexes; Engine::Engine(int width, int height, Events* events) { m_started = false; m_wireFrame = false; m_rasterizerHeight = 0; m_showNormals = false; m_showGrid = false; m_drawGizmos = false; m_showBBoxes = false; m_doResize = false; m_drawPhysicsGizmos = false; m_lockFrustrum = false; m_drawZobObjectGizmos = true; m_drawCameraGizmos = false; m_showText = true; m_nbRasterizers = std::thread::hardware_concurrency(); m_EqualizeTriangleQueues = false; m_perspCorrection = true; m_nbBitsPerColorDepth = eBitsPerColor_full; // m_varExposer = new ZobVariablesExposer(0); m_dithering = false; while (height % m_nbRasterizers != 0 && m_nbRasterizers>1) { m_nbRasterizers--; } /* if (m_nbRasterizers % 2 == 1) { m_nbRasterizers--; } if (m_nbRasterizers < 2) { m_nbRasterizers = 1; } m_nbRasterizers = 4; */ m_nbRasterizers --; m_nbRasterizers = max(m_nbRasterizers, (uint)1); //m_nbRasterizers = 4; m_maxTrianglesQueueSize = 200000;// MAX_TRIANGLES_PER_IMAGE / m_nbRasterizers; m_maxLineQueueSize = 200000; m_events = events; m_currentFrame = 0; m_zNear = 0.11f; m_zFar = 1000.0f; m_currentBuffer = 0; m_buffer = (uint**)malloc(sizeof(uint*) * 2); m_zBuffer = (float**)malloc(sizeof(float*) * 2); for (int i = 0; i < 2; i++) { m_buffer[i] = (uint*)malloc(sizeof(uint) * width * height); m_zBuffer[i] = (float*)malloc(sizeof(float) * width * height); } m_bufferClearArray = (uint*)malloc(sizeof(uint) * width * height); m_zBufferClearArray = (float*)malloc(sizeof(float) * width * height); uint c = 0;// ZobColor(DirectZob::GetInstance()->GetLightManager()->GetClearColor()).GetRawValue();; for (int i = 0; i < width * height; i++) { m_bufferClearArray[i] = c; m_zBufferClearArray[i] = 100000.0f; } m_showZBuffer = false; m_nextWidth = width; m_nextHeight = height; m_bufferData.height = height; m_bufferData.width = width; m_bufferData.zNear = m_zNear; m_bufferData.zFar = m_zFar; m_bufferData.buffer = m_buffer[m_currentBuffer]; m_bufferData.zBuffer = m_zBuffer[m_currentBuffer]; m_bufferData.size = width * height; m_nbPixels = 0; m_rasterizers = (Rasterizer**)malloc(sizeof(Rasterizer) * m_nbRasterizers); m_conditionvariables = (std::condition_variable**)malloc(sizeof(std::condition_variable) * m_nbRasterizers); m_mutexes = (std::mutex**)malloc(sizeof(std::mutex) * m_nbRasterizers); m_renderOptions = (Triangle::RenderOptions*)malloc(sizeof(Triangle::RenderOptions) * MAX_RENDER_OPTIONS); m_rasterizerHeight = ceil((float)height / (float)m_nbRasterizers); int h0 = 0; int h1 = m_rasterizerHeight; int nbTrianglesPerRasterize = m_maxTrianglesQueueSize;// / m_nbRasterizers; for (int i = 0; i < m_nbRasterizers; i++) { Rasterizer* r = new Rasterizer(width, height, h0, h1, nbTrianglesPerRasterize, (i+1), &m_bufferData); m_rasterizers[i] = r; m_conditionvariables[i] = new std::condition_variable(); m_mutexes[i] = new std::mutex(); h0 += m_rasterizerHeight; h1 += m_rasterizerHeight; h1 = min(height, h1); } m_LineQueue = (Line3D*)malloc(sizeof(Line3D) * m_maxLineQueueSize); m_TrianglesQueue = (Triangle*)malloc(sizeof(Triangle) * m_maxTrianglesQueueSize); m_verticesData = (ZobVector3*)malloc(sizeof(ZobVector3) * m_maxTrianglesQueueSize * 10); // vertices plus normals plus ... m_uvData = (ZobVector2*)malloc(sizeof(ZobVector2) * m_maxTrianglesQueueSize * 3); m_colorData = (ZobColor*)malloc(sizeof(ZobColor) * m_maxTrianglesQueueSize * 3); ulong tot = sizeof(Triangle); tot = sizeof(Line3D)* m_maxLineQueueSize + sizeof(Triangle) * m_maxTrianglesQueueSize + sizeof(ZobVector3) * m_maxTrianglesQueueSize * 10 + sizeof(ZobVector2) * m_maxTrianglesQueueSize * 3; tot /= 1024*1024; int vertexIdx = 0; int uvIdx = 0; for (int i = 0; i < m_maxTrianglesQueueSize; i++) { m_TrianglesQueue[i].va = &m_verticesData[vertexIdx + 0]; m_TrianglesQueue[i].vb = &m_verticesData[vertexIdx + 1]; m_TrianglesQueue[i].vc = &m_verticesData[vertexIdx + 2]; m_TrianglesQueue[i].pa = &m_verticesData[vertexIdx + 3]; m_TrianglesQueue[i].pb = &m_verticesData[vertexIdx + 4]; m_TrianglesQueue[i].pc = &m_verticesData[vertexIdx + 5]; m_TrianglesQueue[i].na = &m_verticesData[vertexIdx + 6]; m_TrianglesQueue[i].nb = &m_verticesData[vertexIdx + 7]; m_TrianglesQueue[i].nc = &m_verticesData[vertexIdx + 8]; m_TrianglesQueue[i].n = &m_verticesData[vertexIdx + 9]; m_TrianglesQueue[i].ua = &m_uvData[uvIdx + 0]; m_TrianglesQueue[i].ub = &m_uvData[uvIdx + 1]; m_TrianglesQueue[i].uc = &m_uvData[uvIdx + 2]; m_TrianglesQueue[i].ca = &m_colorData[uvIdx + 0]; m_TrianglesQueue[i].cb = &m_colorData[uvIdx + 1]; m_TrianglesQueue[i].cc = &m_colorData[uvIdx + 2]; m_TrianglesQueue[i].options = NULL; m_TrianglesQueue[i].material = NULL; m_TrianglesQueue[i].zobObject = NULL; m_TrianglesQueue[i].draw = false; m_TrianglesQueue[i].area = 0; m_TrianglesQueue[i].verticeAIndex = 0; m_TrianglesQueue[i].verticeBIndex = 0; m_TrianglesQueue[i].verticeCIndex = 0; vertexIdx += 10; uvIdx += 3; } m_lineQueueSize = 0; m_LastTriangleQueueSize = 0; m_TriangleQueueSize = 0; for (int i = 0; i < m_nbRasterizers; i++) { m_rasterizers[i]->Init(m_conditionvariables[i], m_mutexes[i]); } eRenderMode rm[3] = { eRenderMode::eRenderMode_fullframe, eRenderMode::eRenderMode_interlaced, eRenderMode::eRenderMode_scanline }; const char* rmStr[3] = { "Fullframe", "Interlaced", "Scanline" }; m_varExposer->WrapEnum<eRenderMode>("Render mode", &m_renderMode, 3, rm, rmStr, NULL, false, true); eLightingPrecision lm[3] = { eLightingPrecision::eLightingPrecision_noLighting, eLightingPrecision::eLightingPrecision_vertex, eLightingPrecision::eLightingPrecision_pixel }; const char* lmStr[3] = { "No lighting", "Vertex", "Pixel" }; m_varExposer->WrapEnum<eLightingPrecision>("Lighting mode", &m_lightingPrecision, 3, lm, lmStr, NULL, false, true); eBitsPerColor bp[9] = { eBitsPerColor::eBitsPerColor_full, eBitsPerColor::eBitsPerColor_1, eBitsPerColor::eBitsPerColor_2, eBitsPerColor::eBitsPerColor_3, eBitsPerColor::eBitsPerColor_4, eBitsPerColor::eBitsPerColor_5, eBitsPerColor::eBitsPerColor_6, eBitsPerColor::eBitsPerColor_7, eBitsPerColor::eBitsPerColor_8,}; const char* bpStr[9] = { "Full", "1", "2", "3", "4", "5", "6", "7", "8"}; m_varExposer->WrapEnum<eBitsPerColor>("Bits per color", &m_nbBitsPerColorDepth, 9, bp, bpStr, NULL, false, true); m_varExposer->WrapVariable<bool>("Dithering", &m_dithering, NULL, false, true); m_varExposer->WrapVariable<float>("Z near", &m_zNear, NULL, false, true); m_varExposer->WrapVariable<float>("Z far", &m_zFar, NULL, false, true); m_varExposer->WrapVariable<bool>("Show Z Buffer", &m_showZBuffer, NULL, false, false); m_varExposer->WrapVariable<bool>("Wireframe", &m_wireFrame, NULL, false, false); m_varExposer->WrapVariable<bool>("Show Normals", &m_showNormals, NULL, false, false); m_varExposer->WrapVariable<bool>("Show grid", &m_showGrid, NULL, false, false); m_varExposer->WrapVariable<bool>("Draw gizmos", &m_drawGizmos, NULL, false, false); m_varExposer->WrapVariable<bool>("Draw physics gizmos", &m_drawPhysicsGizmos, NULL, false, false); m_varExposer->WrapVariable<bool>("Draw camera gizmos", &m_drawCameraGizmos, NULL, false, false); m_varExposer->WrapVariable<bool>("Draw object gizmos", &m_drawZobObjectGizmos, NULL, false, false); m_varExposer->WrapVariable<bool>("Show bounding boxes", &m_showBBoxes, NULL, false, false); m_varExposer->WrapVariable<bool>("Show text", &m_showText, NULL, false, false); m_varExposer->WrapVariable<bool>("Equalize triangle queues", &m_EqualizeTriangleQueues, NULL, false, true); m_varExposer->WrapVariable<bool>("Perspective Correction", &m_perspCorrection, NULL, false, true); m_varExposer->WrapVariable<int>("Rastyerizer height", &m_rasterizerHeight, NULL, true, false); m_varExposer->WrapVariable<uint>("Number of rasterizers", &m_nbRasterizers, NULL, true, false); m_varExposer->WrapVariable<uint>("Number of drawn triangles", &m_drawnTriangles, NULL, true, false); m_varExposer->Load(); std::string n = "Engine initialized with " + std::to_string(m_nbRasterizers) + " rasterizer(s) for " + std::to_string(m_maxTrianglesQueueSize) + " triangles per image"; DirectZob::LogWarning(n.c_str()); } uint Engine::GetObjectIdAtCoords(uint x, uint y) { size_t l = m_bufferData.width * y + x; if (l >= 0 && l < m_bufferData.width * m_bufferData.height) { // return m_bufferData.oBuffer[l]; } return 0; } Engine::~Engine() { StopRasterizers(); WaitForRasterizersEnd(); for (int i = 0; i < m_nbRasterizers; i++) { //m_mutexes[i]->unlock(); //m_conditionvariables[i]->notify_all(); delete m_rasterizers[i]; //delete m_conditionvariables[i]; //delete m_mutexes[i]; } free(m_TrianglesQueue); free(m_verticesData); free(m_uvData); free(m_colorData); free(m_rasterizers); free(m_conditionvariables); free(m_mutexes); free(m_renderOptions); m_events = NULL; } void Engine::Start() { DirectZob::GetInstance()->GetZobObjectManager()->Init(); m_varExposer->Load(); for (int i = 0; i < m_nbRasterizers; i++) m_started = true; } void Engine::Stop() { WaitForRasterizersEnd(); ClearRenderQueues(); for (int i = 0; i < m_nbRasterizers; i++) { m_rasterizers[i]->Clear(); } m_started = false; } bool Engine::Resize(int width, int height) { if (m_nextWidth != width || m_nextHeight != height) { m_nextWidth = width; m_nextHeight = height; m_doResize = true; //return ResizeInternal(); } return false; } bool Engine::ResizeInternal() { if (m_doResize) { m_doResize = false; for (int i = 0; i < 2; i++) { free(m_buffer[i]); free(m_zBuffer[i]); } free(m_buffer); free(m_zBuffer); m_buffer = NULL; m_zBuffer = NULL; m_buffer = (uint**)malloc(sizeof(uint*) * 2); m_zBuffer = (float**)malloc(sizeof(float*) * 2); for (int i = 0; i < 2; i++) { m_buffer[i] = (uint*)malloc(sizeof(uint) * m_nextWidth * m_nextHeight); m_zBuffer[i] = (float*)malloc(sizeof(float) * m_nextWidth * m_nextHeight); } m_bufferData.height = m_nextHeight; m_bufferData.width = m_nextWidth; m_bufferData.buffer = m_buffer[m_currentBuffer]; m_bufferData.zBuffer = m_zBuffer[m_currentBuffer]; //m_bufferData.zNear = m_zNear; //m_bufferData.zFar = m_zFar; m_bufferData.size = m_nextWidth * m_nextHeight; ZobColor c = ZobColor(DirectZob::GetInstance()->GetLightManager()->GetClearColor()); ClearBuffer(&c); m_rasterizerHeight = ceil((float)m_nextHeight / (float)m_nbRasterizers); for (int i = 0; i < m_nbRasterizers; i++) { m_rasterizers[i]->Resize(m_nextWidth, m_nextHeight); } return true; } return false; } void Engine::ClearBuffer(const ZobColor* color) { OPTICK_EVENT(); int oldBuffer = (m_currentBuffer + 1) % 2; uint v = color->GetRawValue(); //if (v != m_buffer[oldBuffer][0]) { for (int i = 0; i < m_bufferData.width * m_bufferData.height; i++) { m_buffer[oldBuffer][i] = v; } } if (m_renderMode == eRenderMode_fullframe ) { //memset(m_buffer[oldBuffer], 0, sizeof(uint) * m_bufferData.width * m_bufferData.height); memset(m_zBuffer[oldBuffer], 0, sizeof(float) * m_bufferData.width * m_bufferData.height); } else if (m_renderMode == eRenderMode_scanline) { uint c; for (int y = 0; y < m_bufferData.height; y ++) { if (y % 2) { c = v; } else { c = 0; } int s = m_bufferData.width * y; for (int i = 0; i < m_bufferData.width; i++) { m_zBuffer[oldBuffer][i + s] = 1.0f; m_buffer[oldBuffer][i + s] = c; } } } else { for (int y = (m_currentFrame) % 2; y < m_bufferData.height; y += 2) { int s = m_bufferData.width * y; for (int i = 0; i < m_bufferData.width; i++) { m_zBuffer[oldBuffer][i+s] = -1.0f; m_buffer[oldBuffer][i+s] = v; } } } m_drawnTriangles = 0; } int Engine::StartDrawingScene() { OPTICK_EVENT(); ResizeInternal(); const gainput::InputMap* inputMap = DirectZob::GetInstance()->GetInputManager()->GetMap(); if (inputMap->GetBoolIsNew(ZobInputManager::SwitchBuffers)) { ToggleZbufferOutput(); } if (inputMap->GetBoolIsNew(ZobInputManager::SwitchEqualizeTriangleQueues)) { m_EqualizeTriangleQueues = !m_EqualizeTriangleQueues; } if (inputMap->GetBoolIsNew(ZobInputManager::switchPerspectiveCorrection)) { m_perspCorrection = !m_perspCorrection; EnablePerspectiveCorrection(m_perspCorrection); } if (inputMap->GetBoolIsNew(ZobInputManager::switchColorDepth)) { eBitsPerColor i = (eBitsPerColor)(m_nbBitsPerColorDepth + 1); if (i == __eBitsPerColor_MAX__) { i = (eBitsPerColor)0; } } if (inputMap->GetBoolIsNew(ZobInputManager::NextLightMode)) { eLightingPrecision i = GetLightingPrecision(); i = (eLightingPrecision)(i+1); if (i == __eLightingPrecision_MAX__) { i = (eLightingPrecision)0; } SetLightingPrecision(i); } if (!m_started) { return 0; } for (int i = 0; i < m_nbRasterizers; i++) { m_rasterizers[i]->Start(); m_conditionvariables[i]->notify_one(); } return 0; } void Engine::SwapBuffers() { m_currentBuffer = (m_currentBuffer + 1) % 2; m_bufferData.buffer = m_buffer[m_currentBuffer]; m_bufferData.zBuffer = m_zBuffer[m_currentBuffer]; m_bufferData.curBuffer = m_currentBuffer; } int Engine::SetDisplayedBuffer() { if (m_showZBuffer) { uint c; for (int i = 0; i < m_bufferData.size; i++) { c = (uint)((1.0f / m_zBuffer[m_currentBuffer][i]) * 255.0f); c = (c << 16) + (c << 8) + c; m_buffer[m_currentBuffer][i] = c; } } int r = 0; //r = mfb_update(window, m_buffer); m_currentFrame++; m_nbPixels = 0; return r; } void Engine::ClearRenderQueues() { OPTICK_EVENT(); m_LastTriangleQueueSize = m_TriangleQueueSize; m_lineQueueSize = 0; m_TriangleQueueSize = 0; m_usedRenderOptions = 0; for (int i = 0; i < m_nbRasterizers; i++) { m_rasterizers[i]->Clear(); } } void Engine::StopRasterizers() { for (int i = 0; i < m_nbRasterizers; i++) { m_rasterizers[i]->End(); } } float Engine::WaitForRasterizersEnd() { OPTICK_CATEGORY("WaitForRasterizersEnd", Optick::Category::Wait); float t = 0.0f; for (int i = 0; i < m_nbRasterizers; i++) { if (m_rasterizers[i]) { std::unique_lock<std::mutex> g(*m_mutexes[i]); } } return t; } ZobObject* Engine::GetObjectAt2DCoords(float x, float y, bool editorObjectsOnly) { int idx = (int)((y / (float)m_bufferData.height) * m_nbRasterizers); if (idx < 0 || idx >= m_nbRasterizers) { return NULL; } ZobObject* z = NULL; float minZ = m_bufferData.zFar; for (idx = 0; idx < m_nbRasterizers; idx++) { Rasterizer* rast = m_rasterizers[idx]; ZobVector3 p = ZobVector3(x, y, 0); for (int i = 0; i < rast->GetNbTriangle(); i++) { const Triangle* t = rast->GetTriangle(i); if (!editorObjectsOnly || (t && t->zobObject && t->zobObject->IsEditorObject())) { if (t->PointInTriangle2D(&p) && t->zobObject && t->pa->z < minZ) { z = t->zobObject; minZ = t->pa->z; } } } } return z; /* Camera* c = DirectZob::GetInstance()->GetCameraManager()->GetCurrentCamera(); if (c) { Ray ray = c->From2DToWorld(x, y); int idx = (int)floor((y + 1.0f) / 2.0f * m_nbRasterizers); if (idx < 0 || idx >= m_nbRasterizers) { return NULL; } Rasterizer* rast = m_rasterizers[idx]; ZobVector3 inter; for (int i = 0; i < rast->GetNbTriangle(); i++) { const Triangle* t = rast->GetTriangle(i); if (this->LineTriangleIntersection(t, &ray.p, &ray.n, inter)) { return rast->GetTriangle(i)->zobObject; } } } return NULL; */ } void Engine::QueueSphere(const Camera* camera, const ZobMatrix4x4* mat, const float radius, const ZobColor* c, bool bold, bool noZ) { QueuePartialSphere(camera, mat, radius, c, bold, noZ, 0, M_PI); } void Engine::QueuePartialSphere(const Camera* camera, const ZobMatrix4x4* mat, const float radius, const ZobColor* c, bool bold, bool noZ, float from, float to) { static const int segs = 10; ZobVector3 v[segs+1][segs+1]; for (int i = 0; i <= segs; i++) { for (int j = 0; j <= segs; j++) { float lon = (float)i / (float)segs; float lat = (float)j / (float)segs; v[i][j].x = sin(from + (to - from) * lat) * cos(2*M_PI*lon) * radius; v[i][j].z = sin(from + (to - from) * lat) * sin(2*M_PI*lon) * radius; v[i][j].y = cos(from + (to - from) * lat) * radius; mat->Mul(&v[i][j]); } } for (int i = 0; i < segs; i++) { for (int j = 0; j < segs; j++) { QueueLine(camera, &v[i][j], &v[(i+1)%segs][j], c, bold, noZ); //if (j < segs - 1) { QueueLine(camera, &v[i][j], &v[i][j + 1], c, bold, noZ); } } } } void Engine::QueueCapsule(const Camera* camera, const ZobMatrix4x4* mat, float radius, float height, const ZobVector3* dir, const ZobColor* c, bool bold, bool noZ) { ZobMatrix4x4 m1; ZobMatrix4x4 m2; ZobVector3 zDir; m1 = ZobMatrix4x4(mat); m2 = ZobMatrix4x4(mat); zDir = dir; zDir.Mul(height/2.0f); m1.AddTranslation(zDir); zDir.Mul(-1.0f); m2.AddTranslation(zDir); QueuePartialSphere(camera, &m1, radius, c, bold, noZ, 0, M_PI / 2.0f); QueuePartialSphere(camera, &m2, radius, c, bold, noZ, M_PI/2.0f, M_PI); static const int segs = 10; ZobVector3 v1; ZobVector3 v2; for (int i = 0; i <= segs; i++) { float lon = (float)i / (float)segs; v1.x = cos(2 * M_PI * lon) * radius; v1.z = sin(2 * M_PI * lon) * radius; v1.y = 0.0f; v2.Copy(&v1); m1.Mul(&v1); m2.Mul(&v2); QueueLine(camera, &v1, &v2, c, bold, noZ); } } void Engine::QueueMesh(const Camera* camera, const ZobMatrix4x4* mat, ZobVector3* points, int width, int height, const ZobColor* c, bool bold) { } void Engine::QueueWorldBox(const Camera* camera, const Box* box, const ZobColor* c, bool bold, bool noZ) { ZobVector3 p0, p1, p2, p3, p4, p5, p6, p7; p0 = box->p0; p1 = box->p1; p2 = box->p2; p3 = box->p3; p4 = box->p4; p5 = box->p5; p6 = box->p6; p7 = box->p7; QueueLine(camera, &p0, &p1, c, bold, noZ); QueueLine(camera, &p1, &p2, c, bold, noZ); QueueLine(camera, &p2, &p3, c, bold, noZ); QueueLine(camera, &p3, &p0, c, bold, noZ); QueueLine(camera, &p4, &p5, c, bold, noZ); QueueLine(camera, &p5, &p6, c, bold, noZ); QueueLine(camera, &p6, &p7, c, bold, noZ); QueueLine(camera, &p7, &p4, c, bold, noZ); QueueLine(camera, &p1, &p5, c, bold, noZ); QueueLine(camera, &p2, &p6, c, bold, noZ); QueueLine(camera, &p3, &p7, c, bold, noZ); QueueLine(camera, &p0, &p4, c, bold, noZ); } void Engine::QueueBox(const Camera* camera, const ZobMatrix4x4* mat, const ZobVector3* halfExtends, const ZobVector3* pivot, const ZobColor* c, bool bold, bool noZ) { ZobVector3 v0 = ZobVector3(-halfExtends->x, -halfExtends->y, -halfExtends->z);// +pivot; ZobVector3 v1 = ZobVector3(-halfExtends->x, halfExtends->y, -halfExtends->z);// + pivot; ZobVector3 v2 = ZobVector3(halfExtends->x, halfExtends->y, -halfExtends->z);// + pivot; ZobVector3 v3 = ZobVector3(halfExtends->x, -halfExtends->y, -halfExtends->z);// + pivot; ZobVector3 v4 = ZobVector3(-halfExtends->x, -halfExtends->y, halfExtends->z);// + pivot; ZobVector3 v5 = ZobVector3(-halfExtends->x, halfExtends->y, halfExtends->z);// + pivot; ZobVector3 v6 = ZobVector3(halfExtends->x, halfExtends->y, halfExtends->z);// + pivot; ZobVector3 v7 = ZobVector3(halfExtends->x, -halfExtends->y, halfExtends->z);// + pivot; mat->Mul(&v0); mat->Mul(&v1); mat->Mul(&v2); mat->Mul(&v3); mat->Mul(&v4); mat->Mul(&v5); mat->Mul(&v6); mat->Mul(&v7); QueueLine(camera, &v0, &v1, c, bold, noZ); QueueLine(camera, &v1, &v2, c, bold, noZ); QueueLine(camera, &v2, &v3, c, bold, noZ); QueueLine(camera, &v3, &v0, c, bold, noZ); QueueLine(camera, &v4, &v5, c, bold, noZ); QueueLine(camera, &v5, &v6, c, bold, noZ); QueueLine(camera, &v6, &v7, c, bold, noZ); QueueLine(camera, &v7, &v4, c, bold, noZ); QueueLine(camera, &v1, &v5, c, bold, noZ); QueueLine(camera, &v2, &v6, c, bold, noZ); QueueLine(camera, &v3, &v7, c, bold, noZ); QueueLine(camera, &v0, &v4, c, bold, noZ); } void Engine::QueueEllipse(const Camera* camera, const ZobVector3* center, const ZobVector3* vectorUp, const float r1, const float r2, const ZobColor* c, bool bold, bool noZ) { int segs = 20; float r = 0.0f; float rot = (2.0f * M_PI) / (float)segs; ZobVector3 a; ZobMatrix4x4 m; ZobVector3 up = vectorUp; ZobVector3 baseUp = ZobVector3(0, 1, 0); ZobVector3 left = ZobVector3(1, 0, 0); ZobVector3 forward = ZobVector3(0, 0, 1); if (up != baseUp) { left = ZobVector3::Cross(&up, &baseUp); } //if (up != &left) { forward = ZobVector3::Cross(&left, &up); } left.Normalize(); up.Normalize(); forward.Normalize(); m.FromVectors(left, up, forward); a = ZobVector3(r1 * cos(r), 0, r2 * sin(r)); m.Mul(&a); a = a + center; ZobVector3 b = a; for(int i=1; i<=segs; i++) { r = rot * i; b = a; a = ZobVector3(r1 * cos(r), 0, r2 * sin(r)); m.Mul(&a); a = a + center; QueueLine(camera, &a, &b, c, bold, noZ); //QueueTriangle(camera, center, &a, &b, c, true, false); } } void Engine::QueueTriangle(const Camera* camera, const ZobVector3* v1, const ZobVector3* v2, const ZobVector3* v3, const ZobColor* c, bool transparent, bool noZ) { Triangle* t = &m_TrianglesQueue[m_TriangleQueueSize]; t->va->x = v1->x; t->va->y = v1->y; t->va->z = v1->z; t->va->w = 1; t->vb->x = v2->x; t->vb->y = v2->y; t->vb->z = v2->z; t->vb->w = 1; t->vc->x = v3->x; t->vc->y = v3->y; t->vc->z = v3->z; t->vc->w = 1; t->ca->Copy(c); t->cb->Copy(c); t->cc->Copy(c); t->material = NULL; t->clipMode = Triangle::eClip_3_in; Triangle::RenderOptions* r = &m_renderOptions[m_usedRenderOptions]; r->bTransparency = transparent; r->cullMode = Triangle::RenderOptions::eCullMode_None; r->zBuffered = !noZ; r->lightMode = Triangle::RenderOptions::eLightMode_none; t->options = r; m_usedRenderOptions++; RecomputeTriangleProj(camera, t); m_drawnTriangles += QueueTriangleInRasters(&m_TrianglesQueue[m_TriangleQueueSize], m_TriangleQueueSize); m_TriangleQueueSize++; } void Engine::QueueLine(const Camera* camera, const ZobVector3* v1, const ZobVector3* v2, const ZobColor* c, bool bold, bool noZ) { if (m_started) { ZobVector3 a = ZobVector3(0,0,0); ZobVector3 b = ZobVector3(0,0,0); a.Copy(v1); b.Copy(v2); float outP2factor = 0.0f; bool bClipped = camera->ClipSegmentToFrustrum(&a, &b, outP2factor); if (bClipped) { if (m_lineQueueSize < m_maxLineQueueSize) { Line3D* l = &m_LineQueue[m_lineQueueSize]; float za, zb = 0.0f; camera->GetViewMatrix()->Mul(&a); za = a.z; camera->GetProjectionMatrix()->Mul(&a); camera->GetViewMatrix()->Mul(&b); zb = b.z; camera->GetProjectionMatrix()->Mul(&b); a.x /= a.w; a.y /= a.w; a.z /= a.w; a.w = 1.0f; b.x /= b.w; b.y /= b.w; b.z /= b.w; b.w = 1.0f; a.x = (a.x + 1) * m_bufferData.width / 2.0f; a.y = (a.y + 1) * m_bufferData.height / 2.0f; b.x = (b.x + 1) * m_bufferData.width / 2.0f; b.y = (b.y + 1) * m_bufferData.height / 2.0f; l->xa = a.x; l->xb = b.x; l->ya = a.y; l->yb = b.y; l->za = za; l->zb = zb; l->c = c->GetRawValue(); l->bold = bold; l->noZ = noZ; int min = std::min<int>(a.y, b.y); int max = std::max<int>(a.y, b.y); min = CLAMP(min, 0, (int)m_bufferData.height - 1); max = CLAMP(max, 0, (int)m_bufferData.height - 1); min = min / m_rasterizerHeight; max = max / m_rasterizerHeight; QueueLineInRasters(l, m_lineQueueSize); m_lineQueueSize++; } } } } void Engine::CopyBuffer(uint* source, uint* dest) { int v, r, g, b; for (int i = 0; i < m_bufferData.size; i++) { v = source[i]; r = (int)(float)((v & 0xFF0000) >> 16); g = (int)(float)((v & 0x00FF00) >> 8); b = (int)(float)((v & 0x0000FF)); dest[i] = MFB_RGB(r, g, b); } } void Engine::QueueLineInRasters(const Line3D* l, int idx) const { int i = idx % m_nbRasterizers; assert(i >= 0); assert(i < m_nbRasterizers); m_rasterizers[i]->QueueLine(l); } int Engine::QueueTriangleInRasters(const Triangle* t, int idx) const { if (t->options->cullMode == Triangle::RenderOptions::eCullMode_CounterClockwiseFace && t->area >0 ) { return 0; } if (t->options->cullMode == Triangle::RenderOptions::eCullMode_ClockwiseFace && t->area < 0) { return 0; } if (m_TriangleQueueSize < m_maxTrianglesQueueSize) { if (UsePerspectiveCorrection()) { t->ua->x /= t->pa->z; t->ua->y /= t->pa->z; t->ub->x /= t->pb->z; t->ub->y /= t->pb->z; t->uc->x /= t->pc->z; t->uc->y /= t->pc->z; } if (!m_EqualizeTriangleQueues) { int min = (int)fmaxf(0, fminf(t->pa->y, fminf(t->pb->y, t->pc->y))); int max = (int)fminf(m_bufferData.height, fmaxf(t->pa->y, fmaxf(t->pb->y, t->pc->y))); min /= m_rasterizerHeight; max /= m_rasterizerHeight; min--; min = fmax(0, min); max = fmin(max, m_nbRasterizers-1); //min = max; for (int i = min; i <= max; i++) { m_rasterizers[i]->QueueTriangle(t); } } else { int i = (idx) % m_nbRasterizers; assert(i >= 0); assert(i < m_nbRasterizers); m_rasterizers[i]->QueueTriangle(t); } } return 1; } void Engine::QueueProjectedTriangle(const Camera* c, const Triangle* t) { if (m_TriangleQueueSize < m_maxTrianglesQueueSize) { Triangle::CopyTriangle(&m_TrianglesQueue[m_TriangleQueueSize], t); //TODO : adjust to frustrums m_drawnTriangles += QueueTriangleInRasters(&m_TrianglesQueue[m_TriangleQueueSize], m_TriangleQueueSize); m_TriangleQueueSize++; } } void Engine::QueueWorldTriangle(const Camera* c, const Triangle* t) { if (m_started) { if (m_TriangleQueueSize < m_maxTrianglesQueueSize) { if (t->clipMode > Triangle::eClip_0_in) { if (t->clipMode < Triangle::eClip_2_in) { if (t->clipMode == Triangle::eClip_A_in_BC_out) { Triangle::CopyTriangle(&m_TrianglesQueue[m_TriangleQueueSize], t); ClipTriangle(c, &m_TrianglesQueue[m_TriangleQueueSize]); m_drawnTriangles += QueueTriangleInRasters(&m_TrianglesQueue[m_TriangleQueueSize], m_TriangleQueueSize); m_TriangleQueueSize ++; } else if (t->clipMode == Triangle::eClip_B_in_AC_out) { Triangle::CopyTriangle(&m_TrianglesQueue[m_TriangleQueueSize], t); ClipTriangle(c, &m_TrianglesQueue[m_TriangleQueueSize]); m_drawnTriangles += QueueTriangleInRasters(&m_TrianglesQueue[m_TriangleQueueSize], m_TriangleQueueSize); m_TriangleQueueSize ++; } else if (t->clipMode == Triangle::eClip_C_in_AB_out) { Triangle::CopyTriangle(&m_TrianglesQueue[m_TriangleQueueSize], t); ClipTriangle(c, &m_TrianglesQueue[m_TriangleQueueSize]); m_drawnTriangles += QueueTriangleInRasters(&m_TrianglesQueue[m_TriangleQueueSize], m_TriangleQueueSize); m_TriangleQueueSize++; } } else if (t->clipMode < Triangle::eClip_3_in) { SubDivideClippedTriangle(c, t); } else { //memcpy(&m_TrianglesQueue[i][j], t, sizeof(Triangle)); Triangle::CopyTriangle(&m_TrianglesQueue[m_TriangleQueueSize], t); RecomputeTriangleProj(c, &m_TrianglesQueue[m_TriangleQueueSize]); m_drawnTriangles += QueueTriangleInRasters(&m_TrianglesQueue[m_TriangleQueueSize], m_TriangleQueueSize); m_TriangleQueueSize++; } } } } } uint Engine::ClipTriangle(const Camera* c, Triangle* t) { Triangle* nt = t;// &m_TrianglesQueue[m_TriangleQueueSize]; //Triangle::CopyTriangle(nt, t); float outP2factor = 0.0f; if (t->clipMode == Triangle::eClip_A_in_BC_out) { c->ClipSegmentToFrustrum(nt->va, nt->vb, outP2factor); RecomputeUv(nt->ua, nt->ub, outP2factor); RecomputeNormal(nt->na, nt->nb, outP2factor); RecomputeColor(nt->ca, nt->cb, outP2factor); c->ClipSegmentToFrustrum(nt->va, nt->vc, outP2factor); RecomputeUv(nt->ua, nt->uc, outP2factor); RecomputeNormal(nt->na, nt->nc, outP2factor); RecomputeColor(nt->ca, nt->cc, outP2factor); } else if (t->clipMode == Triangle::eClip_B_in_AC_out) { c->ClipSegmentToFrustrum(nt->vb, nt->va, outP2factor); RecomputeUv(nt->ub, nt->ua, outP2factor); RecomputeNormal(nt->nb, nt->na, outP2factor); RecomputeColor(nt->cb, nt->ca, outP2factor); c->ClipSegmentToFrustrum(nt->vb, nt->vc, outP2factor); RecomputeUv(nt->ub, nt->uc, outP2factor); RecomputeNormal(nt->nb, nt->nc, outP2factor); RecomputeColor(nt->cb, nt->cc, outP2factor); } else if (t->clipMode == Triangle::eClip_C_in_AB_out) { c->ClipSegmentToFrustrum(nt->vc, nt->va, outP2factor); RecomputeUv(nt->uc, nt->ua, outP2factor); RecomputeNormal(nt->nc, nt->na, outP2factor); RecomputeColor(nt->cc, nt->ca, outP2factor); c->ClipSegmentToFrustrum(nt->vc, nt->vb, outP2factor); RecomputeUv(nt->uc, nt->ub, outP2factor); RecomputeNormal(nt->nc, nt->nb, outP2factor); RecomputeColor(nt->cc, nt->cb, outP2factor); } else if (t->clipMode == Triangle::eClip_3_out_corner) { DirectZob::LogWarning("here"); } else { //?? int y = 0; y++; } RecomputeTriangleProj(c, nt); return 1; } uint Engine::SubDivideClippedTriangle(const Camera* c, const Triangle* t) { ZobVector3 pIn1; ZobVector2 pIn1Uv; ZobColor pIn1Cv; ZobVector3 pIn1n; ZobVector3 pIn2; ZobVector2 pIn2Uv; ZobColor pIn2Cv; ZobVector3 pIn2n; ZobVector3 pOut1; ZobVector2 pOut1Uv; ZobColor pOut1Cv; ZobVector3 pOut1n; ZobVector3 pOut2; ZobVector2 pOut2Uv; ZobColor pOut2Cv; ZobVector3 pOut2n; ZobVector3 pi; ZobVector2 piUv; if (t->clipMode == Triangle::eClip_AB_in_C_out) { pIn1 = t->va; pIn1Uv = t->ua; pIn1Cv = t->ca; pIn1n = t->na; pIn2 = t->vb; pIn2Uv = t->ub; pIn2Cv = t->cb; pIn2n = t->nb; pOut1 = t->vc; pOut1Uv = t->uc; pOut1Cv = t->cc; pOut1n = t->n; } else if (t->clipMode == Triangle::eClip_AC_in_B_out) { //return 0; pIn1 = t->vc; pIn1Uv = t->uc; pIn1Cv = t->cc; pIn1n = t->nc; pIn2 = t->va; pIn2Uv = t->ua; pIn2Cv = t->ca; pIn2n = t->na; pOut1 = t->vb; pOut1Uv = t->ub; pOut1Cv = t->cb; pOut1n = t->nb; } else if(Triangle::eClip_BC_in_A_out) { //return 0; pIn1 = t->vb; pIn1Uv = t->ub; pIn1Cv = t->cb; pIn1n = t->nb; pIn2 = t->vc; pIn2Uv = t->uc; pIn2Cv = t->cc; pIn2n = t->nc; pOut1 = t->va; pOut1Uv = t->ua; pOut1Cv = t->ca; pOut1n = t->na; } else { //? return 0; } pOut2 = pOut1; pOut2Uv = pOut1Uv; pOut2Cv = pOut1Cv; pOut2n = pOut1n; float outP2Factor = 0.0f; c->ClipSegmentToFrustrum(&pIn1, &pOut1, outP2Factor); RecomputeUv(&pIn1Uv, &pOut1Uv, outP2Factor); RecomputeColor(&pIn1Cv, &pOut1Cv, outP2Factor); RecomputeNormal(&pIn1n, &pOut1n, outP2Factor); c->ClipSegmentToFrustrum(&pIn2, &pOut2, outP2Factor); RecomputeUv(&pIn2Uv, &pOut2Uv, outP2Factor); RecomputeColor(&pIn2Cv, &pOut2Cv, outP2Factor); RecomputeNormal(&pIn2n, &pOut2n, outP2Factor); if (m_TriangleQueueSize < m_maxTrianglesQueueSize) { Triangle* nt = &m_TrianglesQueue[m_TriangleQueueSize]; Triangle::CopyTriangle(nt, t); nt->va->Copy(&pIn1); nt->ca->Copy(&pIn1Cv); nt->ua->Copy(&pIn1Uv); nt->na->Copy(&pIn1n); nt->vb->Copy(&pIn2); nt->cb->Copy(&pIn2Cv); nt->ub->Copy(&pIn2Uv); nt->nb->Copy(&pIn2n); nt->vc->Copy(&pOut1); nt->cc->Copy(&pOut1Cv); nt->uc->Copy(&pOut1Uv); nt->nc->Copy(&pOut1n); RecomputeTriangleProj(c, nt); m_drawnTriangles += QueueTriangleInRasters(&m_TrianglesQueue[m_TriangleQueueSize], m_TriangleQueueSize); m_TriangleQueueSize++; } if (m_TriangleQueueSize < m_maxTrianglesQueueSize) { Triangle* nt = &m_TrianglesQueue[m_TriangleQueueSize]; Triangle::CopyTriangle(nt, t); nt->va->Copy(&pIn2); nt->ca->Copy(&pIn2Cv); nt->ua->Copy(&pIn2Uv); nt->na->Copy(&pIn2n); nt->vb->Copy(&pOut2); nt->cb->Copy(&pOut2Cv); nt->ub->Copy(&pOut2Uv); nt->nb->Copy(&pOut2n); nt->vc->Copy(&pOut1); nt->cc->Copy(&pOut1Cv); nt->uc->Copy(&pOut1Uv); nt->nc->Copy(&pOut1n); RecomputeTriangleProj(c, nt); m_drawnTriangles += QueueTriangleInRasters(&m_TrianglesQueue[m_TriangleQueueSize], m_TriangleQueueSize); m_TriangleQueueSize++; } return 2; } void Engine::RecomputeTriangleProj(const Camera* c, Triangle* t) { t->draw = true; t->clipMode = Triangle::eClip_3_in; t->pa->x = t->va->x; t->pa->y = t->va->y; t->pa->z = t->va->z; t->pa->w = t->va->w; t->pb->x = t->vb->x; t->pb->y = t->vb->y; t->pb->z = t->vb->z; t->pb->w = t->vb->w; t->pc->x = t->vc->x; t->pc->y = t->vc->y; t->pc->z = t->vc->z; t->pc->w = t->vc->w; BufferData* bData = GetBufferData(); const ZobMatrix4x4* view = c->GetViewMatrix(); const ZobMatrix4x4* proj = c->GetProjectionMatrix(); float w = (float)bData->width / 2.0f; float h = (float)bData->height / 2.0f; view->Mul(t->pa); view->Mul(t->pb); view->Mul(t->pc); proj->Mul(t->pa); proj->Mul(t->pb); proj->Mul(t->pc); t->pa->x = (t->pa->x / t->pa->z + 1) * w; t->pa->y = (t->pa->y / t->pa->z + 1) * h; t->pb->x = (t->pb->x / t->pb->z + 1) * w; t->pb->y = (t->pb->y / t->pb->z + 1) * h; t->pc->x = (t->pc->x / t->pc->z + 1) * w; t->pc->y = (t->pc->y / t->pc->z + 1) * h; t->ComputeArea(); } void Engine::DrawHorizontalLine(const float x1, const float x2, const float y, const uint color) { int k; float alpha = 1; // Color::GetAlpha(color); if (alpha != 0 && y >= 0 && y < m_bufferData.height) { if (x1 != x2) { float a = fmin(x1, x2); float b = fmax(x1, x2); b++; a = (int)(a < 0.0f ? 0.0f : a); b = (int)(b > m_bufferData.width ? m_bufferData.width : b); for (int i = a; i < b; i++) { k = y * m_bufferData.width + i; uint g = m_bufferData.buffer[k]; m_bufferData.buffer[k] = color; } } } } bool Engine::GetProjectedCoords(ZobVector3* worldPos) { Camera* c = DirectZob::GetInstance()->GetCameraManager()->GetCurrentCamera(); if (c) { c->ProjectPointFromWorld(worldPos); return true; } return false; } float Engine::GetDistanceToCamera(ZobVector3* worldPos) { Camera* c = DirectZob::GetInstance()->GetCameraManager()->GetCurrentCamera(); if (c) { ZobVector3 v = c->GetWorldPosition(); v = v - worldPos; return v.sqrtLength(); } return 0.0f; } void Engine::ComputeBoundingBoxes(const ZobMatrix4x4* modelMatrix, const ZobVector3* minBounding, const ZobVector3* maxBounding, Box* obb, Box* aabb) const { ZobVector3 v0 = ZobVector3(minBounding->x, minBounding->y, minBounding->z); ZobVector3 v1 = ZobVector3(minBounding->x, maxBounding->y, minBounding->z); ZobVector3 v2 = ZobVector3(maxBounding->x, maxBounding->y, minBounding->z); ZobVector3 v3 = ZobVector3(maxBounding->x, minBounding->y, minBounding->z); ZobVector3 v4 = ZobVector3(minBounding->x, minBounding->y, maxBounding->z); ZobVector3 v5 = ZobVector3(minBounding->x, maxBounding->y, maxBounding->z); ZobVector3 v6 = ZobVector3(maxBounding->x, maxBounding->y, maxBounding->z); ZobVector3 v7 = ZobVector3(maxBounding->x, minBounding->y, maxBounding->z); obb->p0 = v0; obb->p1 = v1; obb->p2 = v2; obb->p3 = v3; obb->p4 = v4; obb->p5 = v5; obb->p6 = v6; obb->p7 = v7; modelMatrix->Mul(&obb->p0); modelMatrix->Mul(&obb->p1); modelMatrix->Mul(&obb->p2); modelMatrix->Mul(&obb->p3); modelMatrix->Mul(&obb->p4); modelMatrix->Mul(&obb->p5); modelMatrix->Mul(&obb->p6); modelMatrix->Mul(&obb->p7); ZobVector3 max; max.x = fmaxf(fmaxf(fmaxf(fmaxf(fmaxf(fmaxf(fmaxf(obb->p0.x, obb->p1.x), obb->p2.x), obb->p3.x), obb->p4.x), obb->p5.x), obb->p6.x), obb->p7.x); max.y = fmaxf(fmaxf(fmaxf(fmaxf(fmaxf(fmaxf(fmaxf(obb->p0.y, obb->p1.y), obb->p2.y), obb->p3.y), obb->p4.y), obb->p5.y), obb->p6.y), obb->p7.y); max.z = fmaxf(fmaxf(fmaxf(fmaxf(fmaxf(fmaxf(fmaxf(obb->p0.z, obb->p1.z), obb->p2.z), obb->p3.z), obb->p4.z), obb->p5.z), obb->p6.z), obb->p7.z); ZobVector3 min; min.x = fminf(fminf(fminf(fminf(fminf(fminf(fminf(obb->p0.x, obb->p1.x), obb->p2.x), obb->p3.x), obb->p4.x), obb->p5.x), obb->p6.x), obb->p7.x); min.y = fminf(fminf(fminf(fminf(fminf(fminf(fminf(obb->p0.y, obb->p1.y), obb->p2.y), obb->p3.y), obb->p4.y), obb->p5.y), obb->p6.y), obb->p7.y); min.z = fminf(fminf(fminf(fminf(fminf(fminf(fminf(obb->p0.z, obb->p1.z), obb->p2.z), obb->p3.z), obb->p4.z), obb->p5.z), obb->p6.z), obb->p7.z); ZobVector3 v = ZobVector3( (max.x - min.x) / 2.0f, (max.y - min.y) / 2.0f, (max.z - min.z) / 2.0f ); v0 = ZobVector3(min.x, min.y, min.z); v1 = ZobVector3(min.x, max.y, min.z); v2 = ZobVector3(max.x, max.y, min.z); v3 = ZobVector3(max.x, min.y, min.z); v4 = ZobVector3(min.x, min.y, max.z); v5 = ZobVector3(min.x, max.y, max.z); v6 = ZobVector3(max.x, max.y, max.z); v7 = ZobVector3(max.x, min.y, max.z); aabb->p0 = v0; aabb->p1 = v1; aabb->p2 = v2; aabb->p3 = v3; aabb->p4 = v4; aabb->p5 = v5; aabb->p6 = v6; aabb->p7 = v7; } BoudingBox2D Engine::Get2DBoundingBox(const ZobObject* z) const { bool bOk = false; float minX = 1000; float minY = 1000; float maxX = -1000; float maxY = -1000; if (z) { const Box* b = NULL; const std::vector<ZobBehavior*>* behaviors = z->GetBehaviors(); if (behaviors->size() > 0) { for (int i = 0; i < behaviors->size(); i++) { const ZobBehavior* zb = behaviors->at(i); if (zb->GetBehaviorType() == ZobBehavior::eBehavior_mesh) { const ZobBehaviorMesh* zbm = (const ZobBehaviorMesh*)zb; const Mesh* m = zbm->GetMesh(); b = m->GetOBB(); } } } Camera* c = DirectZob::GetInstance()->GetCameraManager()->GetCurrentCamera(); if (c && b) { ZobVector3 v; v = b->p0; c->ProjectPointFromWorld(&v); minX = fminf(minX, v.x); maxX = fmaxf(maxX, v.x); minY = fminf(minY, v.y); maxY = fmaxf(maxY, v.y); v = b->p1; c->ProjectPointFromWorld(&v); minX = fminf(minX, v.x); maxX = fmaxf(maxX, v.x); minY = fminf(minY, v.y); maxY = fmaxf(maxY, v.y); v = b->p2; c->ProjectPointFromWorld(&v); minX = fminf(minX, v.x); maxX = fmaxf(maxX, v.x); minY = fminf(minY, v.y); maxY = fmaxf(maxY, v.y); v = b->p3; c->ProjectPointFromWorld(&v); minX = fminf(minX, v.x); maxX = fmaxf(maxX, v.x); minY = fminf(minY, v.y); maxY = fmaxf(maxY, v.y); v = b->p4; c->ProjectPointFromWorld(&v); minX = fminf(minX, v.x); maxX = fmaxf(maxX, v.x); minY = fminf(minY, v.y); maxY = fmaxf(maxY, v.y); v = b->p5; c->ProjectPointFromWorld(&v); minX = fminf(minX, v.x); maxX = fmaxf(maxX, v.x); minY = fminf(minY, v.y); maxY = fmaxf(maxY, v.y); v = b->p6; c->ProjectPointFromWorld(&v); minX = fminf(minX, v.x); maxX = fmaxf(maxX, v.x); minY = fminf(minY, v.y); maxY = fmaxf(maxY, v.y); v = b->p7; c->ProjectPointFromWorld(&v); minX = fminf(minX, v.x); maxX = fmaxf(maxX, v.x); minY = fminf(minY, v.y); maxY = fmaxf(maxY, v.y); bOk = true; } } BoudingBox2D b2d; if (bOk) { b2d._minX = minX; b2d._minY = minY; b2d._maxX = maxX; b2d._maxY = maxY; b2d._minX = (b2d._minX + 1) * m_bufferData.width / 2.0f; b2d._maxX = (b2d._maxX + 1) * m_bufferData.height / 2.0f; b2d._minY = (b2d._minY + 1) * m_bufferData.width / 2.0f; b2d._maxY = (b2d._maxY + 1) * m_bufferData.height / 2.0f; } else { b2d._minX = 0; b2d._minY = 0; b2d._maxX = 0; b2d._maxY = 0; } return b2d; } bool Engine::IsInFrustrum(const Camera* c, const Box* aabb) const { ZobVector3 minaabb, maxaabb; maxaabb.x = fmaxf(fmaxf(fmaxf(fmaxf(fmaxf(fmaxf(fmaxf(aabb->p0.x, aabb->p1.x), aabb->p2.x), aabb->p3.x), aabb->p4.x), aabb->p5.x), aabb->p6.x), aabb->p7.x); maxaabb.y = fmaxf(fmaxf(fmaxf(fmaxf(fmaxf(fmaxf(fmaxf(aabb->p0.y, aabb->p1.y), aabb->p2.y), aabb->p3.y), aabb->p4.y), aabb->p5.y), aabb->p6.y), aabb->p7.y); maxaabb.z = fmaxf(fmaxf(fmaxf(fmaxf(fmaxf(fmaxf(fmaxf(aabb->p0.z, aabb->p1.z), aabb->p2.z), aabb->p3.z), aabb->p4.z), aabb->p5.z), aabb->p6.z), aabb->p7.z); ZobVector3 min; minaabb.x = fminf(fminf(fminf(fminf(fminf(fminf(fminf(aabb->p0.x, aabb->p1.x), aabb->p2.x), aabb->p3.x), aabb->p4.x), aabb->p5.x), aabb->p6.x), aabb->p7.x); minaabb.y = fminf(fminf(fminf(fminf(fminf(fminf(fminf(aabb->p0.y, aabb->p1.y), aabb->p2.y), aabb->p3.y), aabb->p4.y), aabb->p5.y), aabb->p6.y), aabb->p7.y); minaabb.z = fminf(fminf(fminf(fminf(fminf(fminf(fminf(aabb->p0.z, aabb->p1.z), aabb->p2.z), aabb->p3.z), aabb->p4.z), aabb->p5.z), aabb->p6.z), aabb->p7.z); return c->AABBIsInFrustrum(&minaabb, &maxaabb); } void Engine::UpdateEditorBitmapData() { //memcpy(m_editorBuffer, m_buffer[m_currentBuffer], m_bufferData.size * 4); } void Engine::PrintRasterizersInfos() { Text2D* dbgPrint = DirectZob::GetInstance()->GetDebugPrint(); int h = 40; for (int i = 0; i < m_nbRasterizers; i++) { dbgPrint->Print(10, h, ZobColor::Blue.GetRawValue(), " R %i : %i", i, m_rasterizers[i]->GetNbTriangle()); h += 10; } } void Engine::EnablePerspectiveCorrection(bool enable) { m_perspCorrection = enable; } void Engine::LoadFromNode(TiXmlElement* node) { if (node) { m_varExposer->ReadNode(node); } } void Engine::SaveUnderNode(TiXmlElement* node) { m_varExposer->SaveUnderNode(node); }
29.513494
190
0.657466
zeralph
a71d7957271f372b509b81c9b356e69aea0cb74e
175
cpp
C++
main/compilation/routine_call.cpp
amakuzaze/lizard
2e53bdd62fd7f0524c15f2787edd8c6ac1079115
[ "MIT" ]
null
null
null
main/compilation/routine_call.cpp
amakuzaze/lizard
2e53bdd62fd7f0524c15f2787edd8c6ac1079115
[ "MIT" ]
null
null
null
main/compilation/routine_call.cpp
amakuzaze/lizard
2e53bdd62fd7f0524c15f2787edd8c6ac1079115
[ "MIT" ]
1
2022-03-21T08:00:45.000Z
2022-03-21T08:00:45.000Z
#include "routine_call.h" RoutineCall::RoutineCall(const Routine_ptr routine) : routine(routine) { } bool RoutineCall::run() { this->routine->start(); return true; }
19.444444
72
0.702857
amakuzaze
a71d8700713cb112eaca7cb82e0d84d68ba48fcf
321
cpp
C++
qt-ts-csv/x2x/Xlsx2Ts.cpp
Stivvo/qt-ts-csv
5b262dbc1250fffd465c2114ffbb0a8e63c3c1ac
[ "MIT" ]
2
2019-08-07T10:02:20.000Z
2021-11-03T17:09:42.000Z
qt-ts-csv/x2x/Xlsx2Ts.cpp
Stivvo/qt-ts-csv
5b262dbc1250fffd465c2114ffbb0a8e63c3c1ac
[ "MIT" ]
null
null
null
qt-ts-csv/x2x/Xlsx2Ts.cpp
Stivvo/qt-ts-csv
5b262dbc1250fffd465c2114ffbb0a8e63c3c1ac
[ "MIT" ]
null
null
null
#include "Xlsx2Ts.hpp" #include "TsBuilder.hpp" #include "Writer.hpp" #include "XlsxParser.hpp" #include <sstream> void Xlsx2Ts::convert(std::string &&filename, std::string &&output) { Writer().write(TsBuilder().build(XlsxParser().parse(std::move(filename))), std::move(output)); }
22.928571
79
0.635514
Stivvo
a71e3fe91e4ede20886f6eeba0dd01101d89bef2
416
hpp
C++
4w_Arcade/src/globals.hpp
Bryanmarc/VEX-Robotics-3273
d4a0188bb705265a505488684e09aff7531fd080
[ "MIT" ]
1
2019-03-13T14:55:59.000Z
2019-03-13T14:55:59.000Z
4w_Arcade/src/globals.hpp
Bryanmarc/VEX-Robotics-3273
d4a0188bb705265a505488684e09aff7531fd080
[ "MIT" ]
null
null
null
4w_Arcade/src/globals.hpp
Bryanmarc/VEX-Robotics-3273
d4a0188bb705265a505488684e09aff7531fd080
[ "MIT" ]
null
null
null
#ifndef GLOBALS_H #define GLOBALS_H #include "main.h" extern int side_sel; extern int auton_sel; extern pros::Controller master; extern pros::Motor back_left_mtr; extern pros::Motor back_right_mtr; extern pros::Motor front_left_mtr; extern pros::Motor front_right_mtr; extern pros::Motor flywheel_mtr_one; extern pros::Motor flywheel_mtr_two; extern pros::Motor index_mtr; extern pros::Motor conveyor_mtr; #endif
21.894737
36
0.810096
Bryanmarc
a7208403aeb09b9fc80a0dee04aad5b5f33c480b
1,268
cpp
C++
iterator/cpp/self-made/iterator_pattern.cpp
LoLei/design-patterns-examples
213241ab94c8a5e74a3faa9c5f554d557e60b753
[ "MIT" ]
3
2020-02-11T20:37:13.000Z
2020-07-31T14:16:51.000Z
iterator/cpp/self-made/iterator_pattern.cpp
LoLei/design-patterns-examples
213241ab94c8a5e74a3faa9c5f554d557e60b753
[ "MIT" ]
null
null
null
iterator/cpp/self-made/iterator_pattern.cpp
LoLei/design-patterns-examples
213241ab94c8a5e74a3faa9c5f554d557e60b753
[ "MIT" ]
null
null
null
#include <iostream> #include <array> #include "arrayconcretecollection.h" #include "arrayconcreteiterator.h" #include "linkedlistconcretecollection.h" #include "linkedlistconcreteiterator.h" int main() { // Use custom array container std::cout << "#### Array container" << std::endl; ArrayConcreteCollection my_custom_array; int items_to_add[5] = {1, 2, 3, 4, 5}; my_custom_array.addItems(items_to_add); Iterator<int>* my_custom_array_iterator = my_custom_array.createIterator(); while(!my_custom_array_iterator->isDone()) { std::cout << my_custom_array_iterator->currentItem() << std::endl; my_custom_array_iterator->next(); } // Use custom linked list container std::cout << "#### Linked list container" << std::endl; LinkedListConcreteCollection my_custom_linked_list; my_custom_linked_list.insert(5); my_custom_linked_list.insert(4); my_custom_linked_list.insert(3); my_custom_linked_list.insert(2); my_custom_linked_list.insert(1); Iterator<int>* my_custom_linked_list_iterator = my_custom_linked_list.createIterator(); while(!my_custom_linked_list_iterator->isDone()) { std::cout << my_custom_linked_list_iterator->currentItem() << std::endl; my_custom_linked_list_iterator->next(); } return 0; }
30.926829
89
0.747634
LoLei
a722b3f98dfcc263bc4557df7f793dbf36dcf7ee
13,573
cpp
C++
duilib/Utils/WinImplBase.cpp
l619534951/monitor_helper_duilib
a0df2a0285bdd37b77a611fba080dee0e55bda4f
[ "BSD-2-Clause", "MIT" ]
null
null
null
duilib/Utils/WinImplBase.cpp
l619534951/monitor_helper_duilib
a0df2a0285bdd37b77a611fba080dee0e55bda4f
[ "BSD-2-Clause", "MIT" ]
null
null
null
duilib/Utils/WinImplBase.cpp
l619534951/monitor_helper_duilib
a0df2a0285bdd37b77a611fba080dee0e55bda4f
[ "BSD-2-Clause", "MIT" ]
null
null
null
#include "stdafx.h" namespace ui { WindowImplBase::WindowImplBase() { } WindowImplBase::~WindowImplBase() { } void WindowImplBase::OnFinalMessage( HWND hWnd ) { __super::OnFinalMessage(hWnd); ReapObjects(GetRoot()); delete this; } LONG WindowImplBase::GetStyle() { LONG styleValue = ::GetWindowLong(GetHWND(), GWL_STYLE); styleValue &= ~WS_CAPTION; return styleValue; } UINT WindowImplBase::GetClassStyle() const { return CS_DBLCLKS; } Control* WindowImplBase::CreateControl(const std::wstring& pstrClass) { return NULL; } LRESULT WindowImplBase::MessageHandler(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) { return FALSE; } LRESULT WindowImplBase::OnClose(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) { bHandled = FALSE; return 0; } LRESULT WindowImplBase::OnDestroy(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) { bHandled = FALSE; return 0; } LRESULT WindowImplBase::OnNcActivate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) { if( ::IsIconic(GetHWND()) ) bHandled = FALSE; return (wParam == 0) ? TRUE : FALSE; } LRESULT WindowImplBase::OnNcCalcSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) { return 0; } LRESULT WindowImplBase::OnWindowPosChanging(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) { bHandled = FALSE; if (IsZoomed(m_hWnd)) { LPWINDOWPOS lpPos = (LPWINDOWPOS)lParam; if (lpPos->flags & SWP_FRAMECHANGED) // 第一次最大化,而不是最大化之后所触发的WINDOWPOSCHANGE { POINT pt = { 0, 0 }; HMONITOR hMontorPrimary = MonitorFromPoint(pt, MONITOR_DEFAULTTOPRIMARY); HMONITOR hMonitorTo = MonitorFromWindow(m_hWnd, MONITOR_DEFAULTTOPRIMARY); // 先把窗口最大化,再最小化,然后恢复,此时MonitorFromWindow拿到的HMONITOR不准确 // 判断GetWindowRect的位置如果不正确(最小化时得到的位置信息是-38000),则改用normal状态下的位置,来获取HMONITOR RECT rc = { 0 }; GetWindowRect(m_hWnd, &rc); if (rc.left < -10000 && rc.top < -10000 && rc.right < -10000 && rc.right < -10000) { WINDOWPLACEMENT wp = { sizeof(WINDOWPLACEMENT) }; GetWindowPlacement(m_hWnd, &wp); hMonitorTo = MonitorFromRect(&wp.rcNormalPosition, MONITOR_DEFAULTTOPRIMARY); } if (hMonitorTo != hMontorPrimary) { // 解决无边框窗口在双屏下面(副屏分辨率大于主屏)时,最大化不正确的问题 MONITORINFO miTo = { sizeof(miTo), 0 }; GetMonitorInfo(hMonitorTo, &miTo); lpPos->x = miTo.rcWork.left; lpPos->y = miTo.rcWork.top; lpPos->cx = miTo.rcWork.right - miTo.rcWork.left; lpPos->cy = miTo.rcWork.bottom - miTo.rcWork.top; } } } return 0; } LRESULT WindowImplBase::OnNcPaint(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) { return 0; } LRESULT WindowImplBase::OnNcHitTest(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) { POINT pt; pt.x = GET_X_LPARAM(lParam); pt.y = GET_Y_LPARAM(lParam); ::ScreenToClient(GetHWND(), &pt); UiRect rcClient; ::GetClientRect(GetHWND(), &rcClient); rcClient.Deflate(m_shadow.GetShadowCorner()); if( !::IsZoomed(GetHWND()) ) { UiRect rcSizeBox = GetSizeBox(); if( pt.y < rcClient.top + rcSizeBox.top ) { if (pt.y >= rcClient.top) { if (pt.x < (rcClient.left + rcSizeBox.left) && pt.x >= rcClient.left) return HTTOPLEFT; else if (pt.x >(rcClient.right - rcSizeBox.right) && pt.x <= rcClient.right) return HTTOPRIGHT; else return HTTOP; } else return HTCLIENT; } else if( pt.y > rcClient.bottom - rcSizeBox.bottom ) { if (pt.y <= rcClient.bottom) { if (pt.x < (rcClient.left + rcSizeBox.left) && pt.x >= rcClient.left) return HTBOTTOMLEFT; else if (pt.x > (rcClient.right - rcSizeBox.right) && pt.x <= rcClient.right) return HTBOTTOMRIGHT; else return HTBOTTOM; } else return HTCLIENT; } if (pt.x < rcClient.left + rcSizeBox.left) { if (pt.x >= rcClient.left) return HTLEFT; else return HTCLIENT; } if (pt.x > rcClient.right - rcSizeBox.right) { if (pt.x <= rcClient.right) return HTRIGHT; else return HTCLIENT; } } UiRect rcCaption = GetCaptionRect(); if( pt.x >= rcClient.left + rcCaption.left && pt.x < rcClient.right - rcCaption.right \ && pt.y >= rcClient.top + rcCaption.top && pt.y < rcClient.top + rcCaption.bottom ) { Control* pControl = FindControl(pt); if( pControl ) { if (dynamic_cast<Button*>(pControl) || dynamic_cast<ButtonBox*>(pControl) || dynamic_cast<RichEdit*>(pControl) || dynamic_cast<Combo*>(pControl)) return HTCLIENT; else return HTCAPTION; } } return HTCLIENT; } LRESULT WindowImplBase::OnGetMinMaxInfo(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) { LPMINMAXINFO lpMMI = (LPMINMAXINFO) lParam; MONITORINFO oMonitor = {}; oMonitor.cbSize = sizeof(oMonitor); ::GetMonitorInfo(::MonitorFromWindow(GetHWND(), MONITOR_DEFAULTTONEAREST), &oMonitor); UiRect rcWork = oMonitor.rcWork; UiRect rcMonitor = oMonitor.rcMonitor; rcWork.Offset(-oMonitor.rcMonitor.left, -oMonitor.rcMonitor.top); UiRect rcMaximize = GetMaximizeInfo(); if (rcMaximize.GetWidth() > 0 && rcMaximize.GetHeight() > 0) { lpMMI->ptMaxPosition.x = rcWork.left + rcMaximize.left; lpMMI->ptMaxPosition.y = rcWork.top + rcMaximize.top; lpMMI->ptMaxSize.x = rcMaximize.GetWidth(); lpMMI->ptMaxSize.y = rcMaximize.GetHeight(); } else { // 计算最大化时,正确的原点坐标 lpMMI->ptMaxPosition.x = rcWork.left; lpMMI->ptMaxPosition.y = rcWork.top; lpMMI->ptMaxSize.x = rcWork.GetWidth(); lpMMI->ptMaxSize.y = rcWork.GetHeight(); } if (GetMaxInfo().cx != 0) { lpMMI->ptMaxTrackSize.x = GetMaxInfo(true).cx; } if (GetMaxInfo().cy != 0) { lpMMI->ptMaxTrackSize.y = GetMaxInfo(true).cy; } if (GetMinInfo().cx != 0) { lpMMI->ptMinTrackSize.x = GetMinInfo(true).cx; } if (GetMinInfo().cy != 0) { lpMMI->ptMinTrackSize.y = GetMinInfo(true).cy; } bHandled = FALSE; return 0; } LRESULT WindowImplBase::OnMouseWheel(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) { bHandled = FALSE; return 0; } LRESULT WindowImplBase::OnMouseHover(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) { bHandled = FALSE; return 0; } LRESULT WindowImplBase::OnSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) { CSize szRoundCorner = GetRoundCorner(); if( !::IsIconic(GetHWND()) && (szRoundCorner.cx != 0 || szRoundCorner.cy != 0) ) { UiRect rcWnd; ::GetWindowRect(GetHWND(), &rcWnd); rcWnd.Offset(-rcWnd.left, -rcWnd.top); rcWnd.right++; rcWnd.bottom++; HRGN hRgn = ::CreateRoundRectRgn(rcWnd.left, rcWnd.top, rcWnd.right, rcWnd.bottom, szRoundCorner.cx, szRoundCorner.cy); ::SetWindowRgn(GetHWND(), hRgn, TRUE); ::DeleteObject(hRgn); } bHandled = FALSE; return 0; } LRESULT WindowImplBase::OnChar(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) { bHandled = FALSE; return 0; } LRESULT WindowImplBase::OnSysCommand(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) { if (wParam == SC_CLOSE) { bHandled = TRUE; SendMessage(WM_CLOSE); return 0; } BOOL bZoomed = ::IsZoomed(GetHWND()); LRESULT lRes = Window::HandleMessage(uMsg, wParam, lParam); if( ::IsZoomed(GetHWND()) != bZoomed ) { } return lRes; } LRESULT WindowImplBase::OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) { ::SetWindowLong(this->GetHWND(), GWL_STYLE, GetStyle()); Init(m_hWnd); SetWindowResourcePath(GetSkinFolder()); WindowBuilder builder; std::wstring strSkinFile = GetWindowResourcePath() + GetSkinFile(); auto callback = nbase::Bind(&WindowImplBase::CreateControl, this, std::placeholders::_1); auto pRoot = (Box*)builder.Create(strSkinFile.c_str(), callback, this); ASSERT(pRoot && L"Faield to load xml file."); if (pRoot == NULL) { TCHAR szErrMsg[MAX_PATH] = { 0 }; _stprintf_s(szErrMsg, L"Failed to load xml file %s", strSkinFile.c_str()); MessageBox(NULL, szErrMsg, _T("Duilib"), MB_OK | MB_ICONERROR); return -1; } pRoot = m_shadow.AttachShadow(pRoot); AttachDialog(pRoot); InitWindow(); if (pRoot->GetFixedWidth() == DUI_LENGTH_AUTO || pRoot->GetFixedHeight() == DUI_LENGTH_AUTO) { CSize maxSize(99999, 99999); CSize needSize = pRoot->EstimateSize(maxSize); if( needSize.cx < pRoot->GetMinWidth() ) needSize.cx = pRoot->GetMinWidth(); if( pRoot->GetMaxWidth() >= 0 && needSize.cx > pRoot->GetMaxWidth() ) needSize.cx = pRoot->GetMaxWidth(); if( needSize.cy < pRoot->GetMinHeight() ) needSize.cy = pRoot->GetMinHeight(); if( needSize.cy > pRoot->GetMaxHeight() ) needSize.cy = pRoot->GetMaxHeight(); ::MoveWindow(m_hWnd, 0, 0, needSize.cx, needSize.cy, FALSE); } Control *pControl = (Control*)FindControl(L"closebtn"); if (pControl) { Button *pCloseBtn = dynamic_cast<Button*>(pControl); ASSERT(pCloseBtn); pCloseBtn->AttachClick(nbase::Bind(&WindowImplBase::OnButtonClick, this, std::placeholders::_1)); } pControl = (Control*)FindControl(L"minbtn"); if (pControl) { Button* pMinBtn = dynamic_cast<Button*>(pControl); ASSERT(pMinBtn); pMinBtn->AttachClick(nbase::Bind(&WindowImplBase::OnButtonClick, this, std::placeholders::_1)); } pControl = (Control*)FindControl(L"maxbtn"); if (pControl) { Button* pMaxBtn = dynamic_cast<Button*>(pControl); ASSERT(pMaxBtn); pMaxBtn->AttachClick(nbase::Bind(&WindowImplBase::OnButtonClick, this, std::placeholders::_1)); } pControl = (Control*)FindControl(L"restorebtn"); if (pControl) { Button* pRestoreBtn = dynamic_cast<Button*>(pControl); ASSERT(pRestoreBtn); pRestoreBtn->AttachClick(nbase::Bind(&WindowImplBase::OnButtonClick, this, std::placeholders::_1)); } return 0; } LRESULT WindowImplBase::OnKeyDown(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) { bHandled = FALSE; return 0; } LRESULT WindowImplBase::OnKillFocus(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) { bHandled = FALSE; return 0; } LRESULT WindowImplBase::OnSetFocus(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) { bHandled = FALSE; return 0; } LRESULT WindowImplBase::OnLButtonDown(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) { bHandled = FALSE; return 0; } LRESULT WindowImplBase::OnLButtonUp(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) { bHandled = FALSE; return 0; } LRESULT WindowImplBase::OnMouseMove(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) { bHandled = FALSE; return 0; } LRESULT WindowImplBase::HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam) { LRESULT lRes = 0; BOOL bHandled = TRUE; switch (uMsg) { case WM_CREATE: lRes = OnCreate(uMsg, wParam, lParam, bHandled); break; case WM_CLOSE: lRes = OnClose(uMsg, wParam, lParam, bHandled); break; case WM_DESTROY: lRes = OnDestroy(uMsg, wParam, lParam, bHandled); break; case WM_NCACTIVATE: lRes = OnNcActivate(uMsg, wParam, lParam, bHandled); break; case WM_NCCALCSIZE: lRes = OnNcCalcSize(uMsg, wParam, lParam, bHandled); break; case WM_WINDOWPOSCHANGING: lRes = OnWindowPosChanging(uMsg, wParam, lParam, bHandled); break; case WM_NCPAINT: lRes = OnNcPaint(uMsg, wParam, lParam, bHandled); break; case WM_NCHITTEST: lRes = OnNcHitTest(uMsg, wParam, lParam, bHandled); break; case WM_GETMINMAXINFO: lRes = OnGetMinMaxInfo(uMsg, wParam, lParam, bHandled); break; case WM_MOUSEWHEEL: lRes = OnMouseWheel(uMsg, wParam, lParam, bHandled); break; case WM_SIZE: lRes = OnSize(uMsg, wParam, lParam, bHandled); break; case WM_CHAR: lRes = OnChar(uMsg, wParam, lParam, bHandled); break; case WM_SYSCOMMAND: lRes = OnSysCommand(uMsg, wParam, lParam, bHandled); break; case WM_KEYDOWN: lRes = OnKeyDown(uMsg, wParam, lParam, bHandled); break; case WM_KILLFOCUS: lRes = OnKillFocus(uMsg, wParam, lParam, bHandled); break; case WM_SETFOCUS: lRes = OnSetFocus(uMsg, wParam, lParam, bHandled); break; case WM_LBUTTONUP: lRes = OnLButtonUp(uMsg, wParam, lParam, bHandled); break; case WM_LBUTTONDOWN: lRes = OnLButtonDown(uMsg, wParam, lParam, bHandled); break; case WM_MOUSEMOVE: lRes = OnMouseMove(uMsg, wParam, lParam, bHandled); break; case WM_MOUSEHOVER: lRes = OnMouseHover(uMsg, wParam, lParam, bHandled); break; default: bHandled = FALSE; break; } if (bHandled) return lRes; return Window::HandleMessage(uMsg, wParam, lParam); } bool WindowImplBase::OnButtonClick(EventArgs* msg) { std::wstring sCtrlName = msg->pSender->GetName(); if( sCtrlName == _T("closebtn") ) { Close(); } else if( sCtrlName == _T("minbtn")) { SendMessage(WM_SYSCOMMAND, SC_MINIMIZE, 0); } else if( sCtrlName == _T("maxbtn")) { Control* pMaxButton = (Control*)FindControl(L"maxbtn"); Control* pRestoreButton = (Control*)FindControl(L"restorebtn"); if (pMaxButton && pRestoreButton) { pMaxButton->SetVisible(false); pRestoreButton->SetVisible(true); } SendMessage(WM_SYSCOMMAND, SC_MAXIMIZE, 0); } else if( sCtrlName == _T("restorebtn")) { Control* pMaxButton = (Control*)FindControl(L"maxbtn"); Control* pRestoreButton = (Control*)FindControl(L"restorebtn"); if (pMaxButton && pRestoreButton) { pMaxButton->SetVisible(true); pRestoreButton->SetVisible(false); } SendMessage(WM_SYSCOMMAND, SC_RESTORE, 0); } return true; } void WindowImplBase::ActiveWindow() { if (::IsWindow(m_hWnd)) { if (::IsIconic(m_hWnd)) { ::ShowWindow(m_hWnd, SW_RESTORE); } else { if (!::IsWindowVisible(m_hWnd)) ::ShowWindow(m_hWnd, SW_SHOW); ::SetForegroundWindow(m_hWnd); } } } void WindowImplBase::SetTaskbarTitle(const std::wstring &title) { ::SetWindowTextW(m_hWnd, title.c_str()); } void WindowImplBase::ToTopMost(bool forever) { ASSERT(::IsWindow(m_hWnd)); ::SetWindowPos(m_hWnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); if (!forever) { ::SetWindowPos(m_hWnd, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); } } }
29.442516
121
0.709202
l619534951
a723372107c01170afc7642f452c1ff49c6468de
5,974
cpp
C++
test/lru_map_test.cpp
arunksaha/lru_map
83cb3db3ddd467250a35a4775485bdbd759ffbb9
[ "Apache-2.0" ]
null
null
null
test/lru_map_test.cpp
arunksaha/lru_map
83cb3db3ddd467250a35a4775485bdbd759ffbb9
[ "Apache-2.0" ]
null
null
null
test/lru_map_test.cpp
arunksaha/lru_map
83cb3db3ddd467250a35a4775485bdbd759ffbb9
[ "Apache-2.0" ]
null
null
null
#include <random> #include "lru_map.h" using namespace std; struct LruKey { explicit LruKey(int64_t k) : key(k) {} bool operator==(const LruKey& rhs) const { return key == rhs.key; } int64_t key; }; std::ostream& operator<<(std::ostream& os, const LruKey& lrukey) { os << lrukey.key; return os; } namespace std { template <> struct hash<LruKey> { size_t operator()(const LruKey& lrukey) const { return hash<int64_t>()(lrukey.key); } }; } struct LruValue { explicit LruValue(int32_t v) : value(v) {} int32_t value; }; std::ostream& operator<<(std::ostream& os, const LruValue& lruvalue) { os << lruvalue.value; return os; } // Generate an uniformly distributed random number between 0 and 1000. static int64_t RandomUniformNumber() { static std::default_random_engine generator; static std::uniform_int_distribution<int64_t> distribution{0, 1000}; return distribution(generator); } template <class LruMapType> class LruMapTest { public: explicit LruMapTest(int64_t capacity); ~LruMapTest() = default; void Test(); private: static LruValue KeyToValue(const LruKey& key); void MatchExpectations(int begin_index, int end_index, bool expectation); void Insert(const LruKey& key, const LruValue& value); private: const int64_t capacity_{0}; LruMapType cache_; }; template <class LruMapType> LruMapTest<LruMapType>::LruMapTest(const int64_t capacity) : capacity_{capacity}, cache_{capacity_} { } template <class LruMapType> void LruMapTest<LruMapType>::Test() { CHECK(cache_.Valid()); CHECK_EQ(cache_.Capacity(), capacity_); CHECK_EQ(cache_.Size(), 0); // Lookup of elements in range [0, N) is expected to fail. MatchExpectations(0, capacity_, false); // Insert N [0, N) elements. for (int idx = 0; idx != capacity_; ++idx) { const LruKey key{idx}; const LruValue value{KeyToValue(key)}; Insert(key, value); CHECK_EQ(cache_.Size(), idx + 1); } CHECK_EQ(cache_.Size(), capacity_); // Lookup of elements in range [0, N) is expected to succeed. MatchExpectations(0, capacity_, true); LOG(INFO) << cache_.ToString(); // Insert N [N, 2N) more elements. for (int idx = capacity_; idx != 2*capacity_; ++idx) { const LruKey key{idx}; const LruValue value{KeyToValue(key)}; Insert(key, value); CHECK_EQ(cache_.Size(), capacity_); } // Now, lookup of elements in range [0, N) is expected to fail. MatchExpectations(0, capacity_, false); // But, lookup of elements in range [N, 2*N) is expected to succeed. MatchExpectations(capacity_, 2*capacity_, true); LOG(INFO) << "Find and Erase"; usleep(RandomUniformNumber()); LOG(INFO) << "Original: " << cache_.ToString(); cache_.Valid(); const LruKey kx{2*capacity_ - 1}; // First, find and ensure that 'kx' exists. const LruValue *const vx = cache_.Find(kx); cache_.Valid(); CHECK(vx); // Then, erase 'kx'. cache_.Erase(kx); LOG(INFO) << "After Erase: " << cache_.ToString(); cache_.Valid(); // Finally, find and ensure that 'kx' does not exist anymore. const LruValue *const vx2 = cache_.Find(kx); cache_.Valid(); CHECK(!vx2); LOG(INFO) << "Overwrite Insert"; const LruKey kx3{2*capacity_ - 2}; Insert(kx3, LruValue(2016)); LOG(INFO) << "Stats: " << cache_.lru_map_stats().ToString(); } template <class LruMapType> void LruMapTest<LruMapType>::MatchExpectations( const int begin_index, const int end_index, const bool expectation) { CHECK_LE(begin_index, end_index); for (int idx = begin_index; idx != end_index; ++idx) { const LruKey key(idx); const bool found = cache_.Exists(key); CHECK_EQ(found, expectation); const LruValue *found_value = cache_.Find(key); if (expectation) { CHECK(found_value); CHECK_EQ(found_value->value, KeyToValue(key).value); } else { CHECK(!found_value); } CHECK(cache_.Valid()); } } template <class LruMapType> void LruMapTest<LruMapType>::Insert( const LruKey& key, const LruValue& value) { // Sleep a random amount of time to emulate passage of time. usleep(RandomUniformNumber()); LOG(INFO) << "Inserting key: " << key << ", value: " << value; cache_.Insert(key, value); LOG(INFO) << cache_.ToString(); CHECK(cache_.Valid()); } template <class LruMapType> LruValue LruMapTest<LruMapType>::KeyToValue(const LruKey& key) { return LruValue(5 * key.key); } // ---------------------------------------------------------------------------- static const int64_t kLruCapacity = 4; void Test1() { LOG(INFO) << "Testing with default policies"; typedef LruMap<LruKey, LruValue> MyLruMapType; LruMapTest<MyLruMapType> test{kLruCapacity}; test.Test(); } void Test2() { LOG(INFO) << "Testing with TimestampAll"; typedef LruMap<LruKey, LruValue, LockStorageNone, LockNone, TimestampAll> MyLruMapType; LruMapTest<MyLruMapType> test{kLruCapacity}; test.Test(); } void Test3() { LOG(INFO) << "Testing with TimestampAll + HitCountEnabled"; typedef LruMap<LruKey, LruValue, LockStorageNone, LockNone, TimestampAll, HitCountEnabled> MyLruMapType; LruMapTest<MyLruMapType> test{kLruCapacity}; test.Test(); } void Test4() { LOG(INFO) << "Testing with TimestampAll + HitCountEnabled" << " + LogEventOverflow"; typedef LruMap<LruKey, LruValue, LockStorageNone, LockNone, TimestampAll, HitCountEnabled, LogEventOverflow> MyLruMapType; LruMapTest<MyLruMapType> test{kLruCapacity}; test.Test(); } void Test5() { LOG(INFO) << "Testing with LockStorageStdMutex + LockExclusiveStd + " << "TimestampAll + HitCountEnabled + LogEventOverflow"; typedef LruMap<LruKey, LruValue, LockStorageStdMutex, LockExclusiveStd, TimestampAll, HitCountEnabled, LogEventAll> MyLruMapType; LruMapTest<MyLruMapType> test{kLruCapacity}; test.Test(); } int main(int argc, char *argv[]) { Test1(); Test2(); Test3(); Test4(); Test5(); LOG(INFO) << "All tests passed"; }
24.483607
79
0.677603
arunksaha
a726021589ae1509f57e8772723ea6a66fa18b66
1,444
cpp
C++
test/guitar_string_test.cpp
dsantosp12/Karplus-Strong-simulation
705cde9e720b0354e1123b44d30b93374e889840
[ "MIT" ]
2
2019-04-20T08:44:53.000Z
2021-04-07T00:29:44.000Z
test/guitar_string_test.cpp
dsantosp12/Karplus-Strong-simulation
705cde9e720b0354e1123b44d30b93374e889840
[ "MIT" ]
null
null
null
test/guitar_string_test.cpp
dsantosp12/Karplus-Strong-simulation
705cde9e720b0354e1123b44d30b93374e889840
[ "MIT" ]
null
null
null
/* Copyright 2015 Fred Martin, fredm@cs.uml.edu Wed Apr 1 09:43:12 2015 test file for GuitarString class compile with g++ -c GStest.cpp -lboost_unit_test_framework g++ GStest.o GuitarString.o RingBuffer.o -o GStest -lboost_unit_test_framework */ #define BOOST_TEST_DYN_LINK #define BOOST_TEST_MODULE Main #include <boost/test/unit_test.hpp> #include <vector> #include <exception> #include <stdexcept> #include "guitar_string_class.hpp" BOOST_AUTO_TEST_CASE(GS) { std::vector<sf::Int16> v; v.push_back(0); v.push_back(2000); v.push_back(4000); v.push_back(-10000); BOOST_REQUIRE_NO_THROW(GuitarHero::GuitarString gs1(v)); GuitarHero::GuitarString gs(v); // GS is 0 2000 4000 -10000 BOOST_REQUIRE(gs.sample() == 0); gs.tic(); // it's now 2000 4000 -10000 996 BOOST_REQUIRE(gs.sample() == 2000); gs.tic(); // it's now 4000 -10000 996 2988 BOOST_REQUIRE(gs.sample() == 4000); gs.tic(); // it's now -10000 996 2988 -2988 BOOST_REQUIRE(gs.sample() == -10000); gs.tic(); // it's now 996 2988 -2988 -4483 BOOST_REQUIRE(gs.sample() == 996); gs.tic(); // it's now 2988 -2988 -4483 1984 BOOST_REQUIRE(gs.sample() == 2988); gs.tic(); // it's now -2988 -4483 1984 0 BOOST_REQUIRE(gs.sample() == -2988); // a few more times gs.tic(); BOOST_REQUIRE(gs.sample() == -4483); gs.tic(); BOOST_REQUIRE(gs.sample() == 1984); gs.tic(); BOOST_REQUIRE(gs.sample() == 0); }
21.552239
80
0.666205
dsantosp12
a72e3575f7db4e6f76c9224b31b32bfe14b5adb2
6,569
hpp
C++
include/bsio/net/http/HttpService.hpp
OpenArkStudio/bsio
5ea4ec1c084b6b508a122188720538015f2f8bc5
[ "Apache-2.0" ]
4
2021-06-09T02:03:18.000Z
2022-01-20T01:22:12.000Z
include/bsio/net/http/HttpService.hpp
OpenArkStudio/bsio
5ea4ec1c084b6b508a122188720538015f2f8bc5
[ "Apache-2.0" ]
null
null
null
include/bsio/net/http/HttpService.hpp
OpenArkStudio/bsio
5ea4ec1c084b6b508a122188720538015f2f8bc5
[ "Apache-2.0" ]
null
null
null
#pragma once #include <asio.hpp> #include <bsio/net/TcpSession.hpp> #include <bsio/net/http/HttpParser.hpp> #include <bsio/net/http/WebSocketFormat.hpp> #include <memory> #include <thread> #include <utility> namespace bsio::net::http { class HttpService; class HttpSession : private asio::noncopyable { public: using Ptr = std::shared_ptr<HttpSession>; using EnterCallback = std::function<void(const HttpSession::Ptr&)>; using HttpParserCallback = std::function<void(const HTTPParser&, const HttpSession::Ptr&)>; using WsCallback = std::function<void(const HttpSession::Ptr&, WebSocketFormat::WebSocketFrameType opcode, const std::string& payload)>; using ClosedCallback = std::function<void(const HttpSession::Ptr&)>; using WsConnectedCallback = std::function<void(const HttpSession::Ptr&, const HTTPParser&)>; public: HttpSession( TcpSession::Ptr session, HttpParserCallback parserCallback, WsCallback wsCallback, WsConnectedCallback wsConnectedCallback, ClosedCallback closedCallback) : mSession(std::move(session)), mHttpRequestCallback(std::move(parserCallback)), mWSCallback(std::move(wsCallback)), mWSConnectedCallback(std::move(wsConnectedCallback)), mCloseCallback(std::move(closedCallback)) { } void setSession(TcpSession::Ptr session) { std::call_once(mOnce, [=]() { mSession = session; }); } void send(const char* packet, size_t len, TcpSession::SendCompletedCallback&& callback = nullptr) const { mSession->send(std::string(packet, len), std::forward<TcpSession::SendCompletedCallback>(callback)); } void send(std::string packet, TcpSession::SendCompletedCallback&& callback = nullptr) const { mSession->send(std::move(packet), std::forward<TcpSession::SendCompletedCallback>(callback)); } void shutdown(asio::ip::tcp::socket::shutdown_type type) const { mSession->shutdown(type); } void close() const { mSession->close(); } virtual ~HttpSession() = default; const TcpSession::Ptr& getSession() const { return mSession; } const HttpParserCallback& getHttpCallback() const { return mHttpRequestCallback; } const ClosedCallback& getCloseCallback() const { return mCloseCallback; } const WsCallback& getWSCallback() const { return mWSCallback; } const WsConnectedCallback& getWSConnectedCallback() const { return mWSConnectedCallback; } private: std::once_flag mOnce; TcpSession::Ptr mSession; HttpParserCallback mHttpRequestCallback; WsCallback mWSCallback; ClosedCallback mCloseCallback; WsConnectedCallback mWSConnectedCallback; friend class HttpService; }; class HttpService { public: static size_t ProcessWebSocket(const char* buffer, size_t len, const HTTPParser::Ptr& httpParser, const HttpSession::Ptr& httpSession) { size_t leftLen = len; const auto& wsCallback = httpSession->getWSCallback(); auto& cacheFrame = httpParser->getWSCacheFrame(); auto& parseString = httpParser->getWSParseString(); while (leftLen > 0) { parseString.clear(); auto opcode = WebSocketFormat::WebSocketFrameType::ERROR_FRAME; size_t frameSize = 0; bool isFin = false; if (!WebSocketFormat::wsFrameExtractBuffer(buffer, leftLen, parseString, opcode, frameSize, isFin)) { break; } if (!isFin || opcode == WebSocketFormat::WebSocketFrameType::CONTINUATION_FRAME) { cacheFrame += parseString; parseString.clear(); } if (!isFin && opcode != WebSocketFormat::WebSocketFrameType::CONTINUATION_FRAME) { httpParser->cacheWSFrameType(opcode); } leftLen -= frameSize; buffer += frameSize; if (!isFin) { continue; } if (opcode == WebSocketFormat::WebSocketFrameType::CONTINUATION_FRAME) { if (!cacheFrame.empty()) { parseString = std::move(cacheFrame); cacheFrame.clear(); } opcode = httpParser->getWSFrameType(); } if (wsCallback != nullptr) { wsCallback(httpSession, opcode, parseString); } } return (len - leftLen); } static size_t ProcessHttp(const char* buffer, size_t len, const HTTPParser::Ptr& httpParser, const HttpSession::Ptr& httpSession) { size_t retlen = len; if (!httpParser->isCompleted()) { retlen = httpParser->tryParse(buffer, len); if (!httpParser->isCompleted()) { return retlen; } } if (httpParser->isWebSocket()) { if (httpParser->hasKey("Sec-WebSocket-Key")) { auto response = WebSocketFormat::wsHandshake( httpParser->getValue("Sec-WebSocket-Key")); httpSession->send(response.c_str(), response.size()); } const auto& wsConnectedCallback = httpSession->getWSConnectedCallback(); if (wsConnectedCallback != nullptr) { wsConnectedCallback(httpSession, *httpParser); } } else { const auto& httpCallback = httpSession->getHttpCallback(); if (httpCallback != nullptr) { httpCallback(*httpParser, httpSession); } } return retlen; } }; }// namespace bsio::net::http
29.195556
108
0.537068
OpenArkStudio
a7307ea92b6df3fd79532901bf9caa03e53b8fd2
1,192
cpp
C++
src/main.cpp
saracen24/CameraStateMachine
9abef3383c3ce20be1d1b563fc4c26848215d8ce
[ "MIT" ]
null
null
null
src/main.cpp
saracen24/CameraStateMachine
9abef3383c3ce20be1d1b563fc4c26848215d8ce
[ "MIT" ]
null
null
null
src/main.cpp
saracen24/CameraStateMachine
9abef3383c3ce20be1d1b563fc4c26848215d8ce
[ "MIT" ]
null
null
null
#include <iostream> #include <memory> #include "camera.hpp" using namespace std; using namespace aiz; static const array<const char*, 4> kState{"OFF", "READY", "CAPTURE", "PAUSE"}; void showState(Camera::State state) { cout << "State: " << kState.at(state) << endl << endl; } int main() { cout << "[Initial state]" << endl; unique_ptr<Camera> camera = make_unique<Camera>(); showState(camera->state()); cout << "[Open]" << endl; camera->open(); showState(camera->state()); if (camera->state() != Camera::State::READY) { cout << "[ERROR] Camera is not ready." << endl; return EXIT_FAILURE; } cout << "[Start]" << endl; camera->start(); showState(camera->state()); if (camera->state() != Camera::State::CAPTURE) { cout << "[ERROR] Capture failed." << endl; return EXIT_FAILURE; } cout << "[Pause]" << endl; camera->pause(); showState(camera->state()); cout << "[Resume]" << endl; camera->resume(); showState(camera->state()); cout << "[Stop]" << endl; camera->stop(); showState(camera->state()); cout << "[Close]" << endl; camera->close(); showState(camera->state()); camera.reset(); return EXIT_SUCCESS; }
20.551724
78
0.60151
saracen24
a731b43b31aa7081590c0471a3ef69c7aaeb67a9
4,156
cpp
C++
library/string/palindromicTree.cpp
bluedawnstar/algorithm_library
4c7f64ec61fc2ba059b64ad7ba20fcb5b838ced6
[ "Unlicense" ]
40
2017-11-26T05:29:18.000Z
2020-11-13T00:29:26.000Z
library/string/palindromicTree.cpp
bluedawnstar/algorithm_library
4c7f64ec61fc2ba059b64ad7ba20fcb5b838ced6
[ "Unlicense" ]
101
2019-02-09T06:06:09.000Z
2021-12-25T16:55:37.000Z
library/string/palindromicTree.cpp
bluedawnstar/algorithm_library
4c7f64ec61fc2ba059b64ad7ba20fcb5b838ced6
[ "Unlicense" ]
6
2017-01-03T14:17:58.000Z
2021-01-22T10:37:04.000Z
#include <vector> #include <string> #include <algorithm> using namespace std; #include "palindromicTree.h" /////////// For Testing /////////////////////////////////////////////////////// #include <cassert> #include <iostream> #include "../common/iostreamhelper.h" #include "../common/rand.h" #include "palindromicSubstringDP.h" #include "palindromicSubstringLongest_manacher.h" static bool isPalindrome(const string& s, int L, int R) { while (L < R) { if (s[L++] != s[R--]) return false; } return true; } static vector<string> findSuffixPalindromes(const string& s, int R) { vector<string> res; for (int i = R; i >= 0; i--) { if (isPalindrome(s, i, R)) res.push_back(s.substr(i, R - i + 1)); } return res; } void testPalindromicTree() { return; //TODO: if you want to test, make this line a comment. cout << "--- Palindromic Tree ---" << endl; { vector<string> in{ "a", "aa", "aaa", "aba", "abc", "abcca", "abca" }; for (auto s : in) { PalindromicTree<> tree(10); int gt = PalindromicSubstringDP::countPalindromicSubstring(s); int ans = int(tree.count(s)); if (ans != gt) { cout << "gt = " << gt << ", ans = " << ans << endl; } assert(ans == gt); } for (int i = 0; i < 100; i++) { string s; for (int j = 0; j < 100; j++) s += 'a' + RandInt32::get() % 3; // the number of palindromic strings { vector<int> gt(int(s.length())); int prevN = 0; for (int i = 0; i < int(s.length()); i++) { int currN = PalindromicSubstringDP::countPalindromicSubstring(s.c_str(), i + 1); gt[i] = currN - prevN; prevN = currN; } PalindromicTree<> tree(int(s.length())); vector<int> ans = tree.countAll(s); if (ans != gt) { cout << s << endl; cout << "gt = " << gt << ", ans = " << ans << endl; } assert(ans == gt); } // lengths of palindromic strings { vector<int> gt = LongestPalindromicSubstring::getLongestPalindromesByEnd(s); PalindromicTree<> tree(int(s.length())); vector<int> ans; for (int i = 0; i < int(s.length()); i++) { tree.extend(s[i]); ans.push_back(tree.nodes[tree.lastSuffix].len); } if (ans != gt) { cout << s << endl; cout << "gt = " << gt << ", ans = " << ans << endl; } assert(ans == gt); } } } { const string s = "ababaacabd"; PalindromicTree<> tree(int(s.length())); for (int i = 0; i < int(s.length()); i++) { tree.extend(s[i]); vector<string> pals = tree.getLastSuffixPalindromes(); reverse(pals.begin(), pals.end()); vector<string> gt = findSuffixPalindromes(s, i); if (pals != gt) cout << "Mismatched at " << i << ": " << pals << endl; assert(pals == gt); assert(pals.size() == tree.nodes[tree.lastSuffix].count); } } { const string s = "aaaaaaaaaaaaaa"; PalindromicTree<> tree(int(s.length())); for (int i = 0; i < int(s.length()); i++) { tree.extend(s[i]); vector<string> pals = tree.getLastSuffixPalindromes(); reverse(pals.begin(), pals.end()); vector<string> gt = findSuffixPalindromes(s, i); if (pals != gt) cout << "Mismatched at " << i << ": " << pals << endl; assert(pals == gt); assert(pals.size() == tree.nodes[tree.lastSuffix].count); } } cout << "OK!" << endl; }
29.267606
100
0.44129
bluedawnstar
a7383554ccfe5a51103c86dce7c2bdd4252b8f18
336
cc
C++
below2.1/testdulu.cc
danzel-py/Kattis-Problem-Archive
bce1929d654b1bceb104f96d68c74349273dd1ff
[ "Apache-2.0" ]
null
null
null
below2.1/testdulu.cc
danzel-py/Kattis-Problem-Archive
bce1929d654b1bceb104f96d68c74349273dd1ff
[ "Apache-2.0" ]
null
null
null
below2.1/testdulu.cc
danzel-py/Kattis-Problem-Archive
bce1929d654b1bceb104f96d68c74349273dd1ff
[ "Apache-2.0" ]
null
null
null
#include <iostream> using namespace std; int main(){ int n; cin>>n; int arr[n]; for (int i = 0; i < n; i++) { cin>>arr[i]; } for (int i = 1; i < 9; i++) { for (int j = 0; j < n; j++) { cout<<arr[j]%i<<' '; } cout<<'\n'; } return 0; }
14.608696
35
0.342262
danzel-py
a73b6f48a998bca4aa97ab9dde4ff31945190afc
7,016
cpp
C++
Official Windows Platform Sample/Windows 8.1 desktop samples/[C++]-Windows 8.1 desktop samples/Input Method Editor (IME) sample/C++/SampleIME/RegKey.cpp
zzgchina888/msdn-code-gallery-microsoft
21cb9b6bc0da3b234c5854ecac449cb3bd261f29
[ "MIT" ]
8
2017-04-30T17:38:27.000Z
2021-11-29T00:59:03.000Z
Samples/IME/cpp/SampleIME/RegKey.cpp
TomeSq/Windows-classic-samples
96f883e4c900948e39660ec14a200a5164a3c7b7
[ "MIT" ]
1
2022-03-15T04:21:41.000Z
2022-03-15T04:21:41.000Z
Samples/IME/cpp/SampleIME/RegKey.cpp
TomeSq/Windows-classic-samples
96f883e4c900948e39660ec14a200a5164a3c7b7
[ "MIT" ]
2
2020-08-11T13:21:49.000Z
2021-09-01T10:41:51.000Z
// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF // ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO // THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A // PARTICULAR PURPOSE. // // Copyright (c) Microsoft Corporation. All rights reserved #include "Private.h" #include "RegKey.h" //--------------------------------------------------------------------- // // ctor // //--------------------------------------------------------------------- CRegKey::CRegKey() { _keyHandle = nullptr; } //--------------------------------------------------------------------- // // dtor // //--------------------------------------------------------------------- CRegKey::~CRegKey() { Close(); } //--------------------------------------------------------------------- // // operator // //--------------------------------------------------------------------- HKEY CRegKey::GetHKEY() { return _keyHandle; } //--------------------------------------------------------------------- // // Create // //--------------------------------------------------------------------- LONG CRegKey::Create(_In_ HKEY hKeyPresent, _In_ LPCWSTR pwszKeyName, _In_reads_opt_(255) LPWSTR pwszClass, DWORD dwOptions, REGSAM samDesired, _Inout_ LPSECURITY_ATTRIBUTES lpSecAttr, _Out_opt_ LPDWORD lpdwDisposition) { DWORD disposition = 0; HKEY keyHandle = nullptr; LONG res = RegCreateKeyEx(hKeyPresent, pwszKeyName, 0, pwszClass, dwOptions, samDesired, lpSecAttr, &keyHandle, &disposition); if (lpdwDisposition != nullptr) { *lpdwDisposition = disposition; } if (res == ERROR_SUCCESS) { Close(); _keyHandle = keyHandle; } return res; } //--------------------------------------------------------------------- // // Open // //--------------------------------------------------------------------- LONG CRegKey::Open(_In_ HKEY hKeyParent, _In_ LPCWSTR pwszKeyName, REGSAM samDesired) { HKEY keyHandle = nullptr; LONG res = RegOpenKeyEx(hKeyParent, pwszKeyName, 0, samDesired, &keyHandle); if (res == ERROR_SUCCESS) { Close(); _keyHandle = keyHandle; } return res; } //--------------------------------------------------------------------- // // Close // //--------------------------------------------------------------------- LONG CRegKey::Close() { LONG res = ERROR_SUCCESS; if (_keyHandle) { res = RegCloseKey(_keyHandle); _keyHandle = nullptr; } return res; } //--------------------------------------------------------------------- // // DeleteSubKey // RecurseDeleteKey // //--------------------------------------------------------------------- LONG CRegKey::DeleteSubKey(_In_ LPCWSTR pwszSubKey) { return RegDeleteKey(_keyHandle, pwszSubKey); } LONG CRegKey::RecurseDeleteKey(_In_ LPCWSTR pwszSubKey) { CRegKey key; LONG res = key.Open(_keyHandle, pwszSubKey, KEY_READ | KEY_WRITE); if (res != ERROR_SUCCESS) { return res; } FILETIME time; WCHAR subKeyName[256] = {'\0'}; DWORD subKeyNameSize = ARRAYSIZE(subKeyName); while (RegEnumKeyEx(key.GetHKEY(), 0, subKeyName, &subKeyNameSize, NULL, NULL, NULL, &time) == ERROR_SUCCESS) { subKeyName[ARRAYSIZE(subKeyName)-1] = L'\0'; res = key.RecurseDeleteKey(subKeyName); if (res != ERROR_SUCCESS) { return res; } subKeyNameSize = ARRAYSIZE(subKeyName); } key.Close(); return DeleteSubKey(pwszSubKey); } //--------------------------------------------------------------------- // // DeleteValue // //--------------------------------------------------------------------- LONG CRegKey::DeleteValue(_In_ LPCWSTR pwszValue) { return RegDeleteValue(_keyHandle, pwszValue); } //--------------------------------------------------------------------- // // QueryStingValue // SetStringValue // //--------------------------------------------------------------------- LONG CRegKey::QueryStringValue(_In_opt_ LPCWSTR pwszValueName, _Out_writes_opt_(*pnChars) LPWSTR pwszValue, _Inout_ ULONG *pnChars) { LONG res = 0; DWORD dataType = REG_NONE; ULONG pwszValueSize = 0; if (pnChars == nullptr) { return E_INVALIDARG; } pwszValueSize = (*pnChars)*sizeof(WCHAR); *pnChars = 0; res = RegQueryValueEx(_keyHandle, pwszValueName, NULL, &dataType, (LPBYTE)pwszValue, &pwszValueSize); if (res != ERROR_SUCCESS) { return res; } if ((dataType != REG_SZ) && (dataType != REG_EXPAND_SZ)) { return ERROR_INVALID_DATA; } *pnChars = pwszValueSize / sizeof(WCHAR); return ERROR_SUCCESS; } LONG CRegKey::SetStringValue(_In_opt_ LPCWSTR pwszValueName, _In_ LPCWSTR pwszValue, DWORD dwType) { size_t lenOfValue = 0; if (pwszValue == nullptr) { return ERROR_INVALID_PARAMETER; } if (StringCchLength(pwszValue, STRSAFE_MAX_CCH, &lenOfValue) != S_OK) { return ERROR_INVALID_PARAMETER; } DWORD len = static_cast<DWORD>(lenOfValue); return RegSetValueEx(_keyHandle, pwszValueName, NULL, dwType, (LPBYTE)pwszValue, (++len)*sizeof(WCHAR)); } //--------------------------------------------------------------------- // // QueryDWORDValue // SetDWORDValue // //--------------------------------------------------------------------- LONG CRegKey::QueryDWORDValue(_In_opt_ LPCWSTR pwszValueName, _Out_ DWORD &dwValue) { LONG res = 0; DWORD dataType = REG_NONE; ULONG pwszValueSize = 0; pwszValueSize = sizeof(DWORD); res = RegQueryValueEx(_keyHandle, pwszValueName, NULL, &dataType, (LPBYTE)(&dwValue), &pwszValueSize); if (res != ERROR_SUCCESS) { return res; } if (dataType != REG_DWORD) { return ERROR_INVALID_DATA; } return ERROR_SUCCESS; } LONG CRegKey::SetDWORDValue(_In_opt_ LPCWSTR pwszValueName, DWORD dwValue) { return RegSetValueEx(_keyHandle, pwszValueName, NULL, REG_DWORD, (LPBYTE)(&dwValue), sizeof(DWORD)); } //--------------------------------------------------------------------- // // QueryBinaryValue // SetBinaryValue // //--------------------------------------------------------------------- LONG CRegKey::QueryBinaryValue(_In_opt_ LPCWSTR pwszValueName, _Out_writes_opt_(cbData) BYTE* lpData, DWORD cbData) { LONG res = 0; DWORD dataType = REG_NONE; ULONG pwszValueSize = 0; pwszValueSize = cbData; res = RegQueryValueEx(_keyHandle, pwszValueName, NULL, &dataType, lpData, &pwszValueSize); if (res != ERROR_SUCCESS) { return res; } if (dataType != REG_BINARY) { return ERROR_INVALID_DATA; } if (pwszValueSize != cbData) { return ERROR_INVALID_DATA; } return ERROR_SUCCESS; } LONG CRegKey::SetBinaryValue(_In_opt_ LPCWSTR pwszValueName, _In_reads_(cbData) BYTE* lpData, DWORD cbData) { return RegSetValueEx(_keyHandle, pwszValueName, NULL, REG_BINARY, lpData, cbData); }
25.146953
219
0.515108
zzgchina888
a73b75d42ba76302564151254f8fea0ee74cd6c3
417
cpp
C++
binarysearch.io/easy/Z-Sum.cpp
wingkwong/competitive-programming
e8bf7aa32e87b3a020b63acac20e740728764649
[ "MIT" ]
18
2020-08-27T05:27:50.000Z
2022-03-08T02:56:48.000Z
binarysearch.io/easy/Z-Sum.cpp
wingkwong/competitive-programming
e8bf7aa32e87b3a020b63acac20e740728764649
[ "MIT" ]
null
null
null
binarysearch.io/easy/Z-Sum.cpp
wingkwong/competitive-programming
e8bf7aa32e87b3a020b63acac20e740728764649
[ "MIT" ]
1
2020-10-13T05:23:58.000Z
2020-10-13T05:23:58.000Z
#include "solution.hpp" using namespace std; class Solution { public: int solve(vector<vector<int>>& matrix) { int m=matrix.size(), ans=0; if(m==0) return ans; int n=matrix[0].size(); for(int i=0;i<n;i++) ans+=matrix[0][i]; for(int i=1,j=n-2;i<=m-2&&j>=1;i++,j--) ans+=matrix[i][j]; for(int i=0;i<n&&m>1;i++) ans+=matrix[m-1][i]; return ans; } };
24.529412
66
0.513189
wingkwong
a73c2f87ded93e673dd0047cb8111ca2582bb67c
18,802
cpp
C++
source/symbols/VariableSymbols.cpp
jankcorn/slang
2c697d8f16ef2449110d3094f8eeb6196d1fcabb
[ "MIT" ]
null
null
null
source/symbols/VariableSymbols.cpp
jankcorn/slang
2c697d8f16ef2449110d3094f8eeb6196d1fcabb
[ "MIT" ]
null
null
null
source/symbols/VariableSymbols.cpp
jankcorn/slang
2c697d8f16ef2449110d3094f8eeb6196d1fcabb
[ "MIT" ]
1
2021-11-15T05:37:12.000Z
2021-11-15T05:37:12.000Z
//------------------------------------------------------------------------------ // VariableSymbols.cpp // Contains variable-related symbol definitions // // File is under the MIT license; see LICENSE for details //------------------------------------------------------------------------------ #include "slang/symbols/VariableSymbols.h" #include "slang/binding/BindContext.h" #include "slang/binding/TimingControl.h" #include "slang/compilation/Compilation.h" #include "slang/diagnostics/DeclarationsDiags.h" #include "slang/diagnostics/ParserDiags.h" #include "slang/symbols/ASTSerializer.h" #include "slang/symbols/BlockSymbols.h" #include "slang/symbols/PortSymbols.h" #include "slang/symbols/Scope.h" #include "slang/symbols/SubroutineSymbols.h" #include "slang/syntax/AllSyntax.h" #include "slang/syntax/SyntaxFacts.h" #include "slang/types/NetType.h" #include "slang/types/Type.h" namespace slang { static string_view getPotentialNetTypeName(const DataTypeSyntax& syntax) { if (syntax.kind == SyntaxKind::NamedType) { auto& namedType = syntax.as<NamedTypeSyntax>(); if (namedType.name->kind == SyntaxKind::IdentifierName) return namedType.name->as<IdentifierNameSyntax>().identifier.valueText(); if (namedType.name->kind == SyntaxKind::ClassName) return namedType.name->as<ClassNameSyntax>().identifier.valueText(); } return ""; } static VariableLifetime getDefaultLifetime(const Scope& scope) { const Symbol& sym = scope.asSymbol(); switch (sym.kind) { case SymbolKind::StatementBlock: return sym.as<StatementBlockSymbol>().defaultLifetime; case SymbolKind::Subroutine: return sym.as<SubroutineSymbol>().defaultLifetime; case SymbolKind::MethodPrototype: return VariableLifetime::Automatic; default: return VariableLifetime::Static; } } void VariableSymbol::fromSyntax(Compilation& compilation, const DataDeclarationSyntax& syntax, const Scope& scope, SmallVector<const ValueSymbol*>& results) { // This might actually be a net declaration with a user defined net type. That can only // be true if the data type syntax is a simple identifier or a "class name", // so if we see that it is, perform a lookup and see what comes back. if (syntax.modifiers.empty()) { string_view simpleName = getPotentialNetTypeName(*syntax.type); if (!simpleName.empty()) { auto result = Lookup::unqualified(scope, simpleName); if (result && result->kind == SymbolKind::NetType) { const NetType& netType = result->as<NetType>(); netType.getAliasTarget(); // force resolution of target auto& declaredType = *netType.getDeclaredType(); for (auto declarator : syntax.declarators) { auto net = compilation.emplace<NetSymbol>(declarator->name.valueText(), declarator->name.location(), netType); net->getDeclaredType()->copyTypeFrom(declaredType); net->setFromDeclarator(*declarator); net->setAttributes(scope, syntax.attributes); results.append(net); } return; } } } bool isConst = false; bool inProceduralContext = scope.isProceduralContext(); optional<VariableLifetime> lifetime; for (Token mod : syntax.modifiers) { switch (mod.kind) { case TokenKind::VarKeyword: break; case TokenKind::ConstKeyword: isConst = true; break; case TokenKind::StaticKeyword: // Static lifetimes are allowed in all contexts. lifetime = VariableLifetime::Static; break; case TokenKind::AutomaticKeyword: // Automatic lifetimes are only allowed in procedural contexts. lifetime = VariableLifetime::Automatic; if (!inProceduralContext) { scope.addDiag(diag::AutomaticNotAllowed, mod.range()); lifetime = VariableLifetime::Static; } break; default: THROW_UNREACHABLE; } } // If no explicit lifetime is provided, find the default one for this scope. bool hasExplicitLifetime = lifetime.has_value(); if (!hasExplicitLifetime) lifetime = getDefaultLifetime(scope); for (auto declarator : syntax.declarators) { auto variable = compilation.emplace<VariableSymbol>(declarator->name.valueText(), declarator->name.location(), *lifetime); variable->isConstant = isConst; variable->setDeclaredType(*syntax.type); variable->setFromDeclarator(*declarator); variable->setAttributes(scope, syntax.attributes); results.append(variable); // If this is a static variable in a procedural context and it has an initializer, // the spec requires that the static keyword must be explicitly provided. if (*lifetime == VariableLifetime::Static && !hasExplicitLifetime && declarator->initializer && scope.isProceduralContext()) { scope.addDiag(diag::StaticInitializerMustBeExplicit, declarator->name.range()); } // Constants require an initializer. if (isConst && !declarator->initializer) scope.addDiag(diag::ConstVarNoInitializer, declarator->name.range()); } } VariableSymbol& VariableSymbol::fromSyntax(Compilation& compilation, const ForVariableDeclarationSyntax& syntax, const VariableSymbol* lastVar) { auto nameToken = syntax.declarator->name; auto var = compilation.emplace<VariableSymbol>(nameToken.valueText(), nameToken.location(), VariableLifetime::Automatic); if (syntax.type) var->setDeclaredType(*syntax.type); else { ASSERT(lastVar); var->getDeclaredType()->copyTypeFrom(*lastVar->getDeclaredType()); } var->setFromDeclarator(*syntax.declarator); return *var; } VariableSymbol::VariableSymbol(string_view name, SourceLocation loc, VariableLifetime lifetime) : VariableSymbol(SymbolKind::Variable, name, loc, lifetime) { } VariableSymbol::VariableSymbol(SymbolKind childKind, string_view name, SourceLocation loc, VariableLifetime lifetime) : ValueSymbol(childKind, name, loc), lifetime(lifetime) { if (lifetime == VariableLifetime::Automatic) getDeclaredType()->addFlags(DeclaredTypeFlags::AutomaticInitializer); } void VariableSymbol::serializeTo(ASTSerializer& serializer) const { serializer.write("lifetime", toString(lifetime)); serializer.write("isConstant", isConstant); serializer.write("isCompilerGenerated", isCompilerGenerated); } FormalArgumentSymbol::FormalArgumentSymbol(string_view name, SourceLocation loc, ArgumentDirection direction, VariableLifetime lifetime) : VariableSymbol(SymbolKind::FormalArgument, name, loc, lifetime), direction(direction) { } void FormalArgumentSymbol::fromSyntax(const Scope& scope, const PortDeclarationSyntax& syntax, SmallVector<const FormalArgumentSymbol*>& results) { if (syntax.header->kind != SyntaxKind::VariablePortHeader) { scope.addDiag(diag::ExpectedFunctionPort, syntax.header->sourceRange()); return; } auto& comp = scope.getCompilation(); auto& header = syntax.header->as<VariablePortHeaderSyntax>(); ArgumentDirection direction = SemanticFacts::getDirection(header.direction.kind); VariableLifetime lifetime = getDefaultLifetime(scope); bool isConst = false; if (header.constKeyword) { ASSERT(direction == ArgumentDirection::Ref); isConst = true; } for (auto declarator : syntax.declarators) { auto arg = comp.emplace<FormalArgumentSymbol>( declarator->name.valueText(), declarator->name.location(), direction, lifetime); arg->isConstant = isConst; arg->setDeclaredType(*header.dataType); arg->setFromDeclarator(*declarator); arg->setAttributes(scope, syntax.attributes); results.append(arg); } } bool FormalArgumentSymbol::mergeVariable(const VariableSymbol& variable) { // If we've already merged one variable already, we can't do any more. if (mergedVar) return false; auto scope = getParentScope(); auto syntax = getSyntax(); ASSERT(scope && syntax && syntax->parent); if (syntax->parent->kind != SyntaxKind::PortDeclaration) return false; auto& portDecl = syntax->parent->as<PortDeclarationSyntax>(); auto& header = portDecl.header->as<VariablePortHeaderSyntax>(); // If the port has a type declared this is already a full definition and // we shouldn't merge with any other variables (the caller will error for us). if (header.varKeyword || header.dataType->kind != SyntaxKind::ImplicitType) return false; // Save this variable reference; our DeclaredType will look into it later // when our type is fully resolved to merge in the variable's type info. getDeclaredType()->addFlags(DeclaredTypeFlags::FormalArgMergeVar); mergedVar = &variable; return true; } void FormalArgumentSymbol::serializeTo(ASTSerializer& serializer) const { VariableSymbol::serializeTo(serializer); serializer.write("direction", toString(direction)); } void FieldSymbol::serializeTo(ASTSerializer& serializer) const { VariableSymbol::serializeTo(serializer); serializer.write("offset", offset); } void NetSymbol::fromSyntax(const Scope& scope, const NetDeclarationSyntax& syntax, SmallVector<const NetSymbol*>& results) { auto& comp = scope.getCompilation(); const NetType& netType = comp.getNetType(syntax.netType.kind); ExpansionHint expansionHint = ExpansionHint::None; switch (syntax.expansionHint.kind) { case TokenKind::VectoredKeyword: expansionHint = ExpansionHint::Vectored; break; case TokenKind::ScalaredKeyword: expansionHint = ExpansionHint::Scalared; break; default: break; } for (auto declarator : syntax.declarators) { auto net = comp.emplace<NetSymbol>(declarator->name.valueText(), declarator->name.location(), netType); net->expansionHint = expansionHint; net->setDeclaredType(*syntax.type, declarator->dimensions); net->setFromDeclarator(*declarator); net->setAttributes(scope, syntax.attributes); results.append(net); } } void NetSymbol::fromSyntax(const Scope& scope, const UserDefinedNetDeclarationSyntax& syntax, LookupLocation location, SmallVector<const NetSymbol*>& results) { auto& comp = scope.getCompilation(); const NetType* netType; auto result = Lookup::unqualifiedAt(scope, syntax.netType.valueText(), location, syntax.netType.range()); if (result && result->kind != SymbolKind::NetType) { scope.addDiag(diag::VarDeclWithDelay, syntax.delay->sourceRange()); result = nullptr; } if (!result) netType = &comp.getNetType(TokenKind::Unknown); else netType = &result->as<NetType>(); netType->getAliasTarget(); // force resolution of target auto& declaredType = *netType->getDeclaredType(); for (auto declarator : syntax.declarators) { auto net = comp.emplace<NetSymbol>(declarator->name.valueText(), declarator->name.location(), *netType); net->getDeclaredType()->copyTypeFrom(declaredType); net->setFromDeclarator(*declarator); net->setAttributes(scope, syntax.attributes); results.append(net); } } const TimingControl* NetSymbol::getDelay() const { if (delay) return *delay; auto scope = getParentScope(); auto syntax = getSyntax(); if (!scope || !syntax || !syntax->parent) { delay = nullptr; return nullptr; } BindContext context(*scope, LookupLocation::before(*this), BindFlags::NonProcedural); auto& parent = *syntax->parent; if (parent.kind == SyntaxKind::NetDeclaration) { auto delaySyntax = parent.as<NetDeclarationSyntax>().delay; if (delaySyntax) { delay = &TimingControl::bind(*delaySyntax, context); return *delay; } } else if (parent.kind == SyntaxKind::DataDeclaration) { auto type = parent.as<DataDeclarationSyntax>().type; if (type->kind == SyntaxKind::NamedType) { auto& nt = type->as<NamedTypeSyntax>(); if (nt.name->kind == SyntaxKind::ClassName) { auto params = nt.name->as<ClassNameSyntax>().parameters; delay = &DelayControl::fromParams(scope->getCompilation(), *params, context); return *delay; } } } delay = nullptr; return nullptr; } void NetSymbol::checkInitializer() const { // Disallow initializers inside packages. Enforcing this check requires knowing // about user-defined nettypes, which is why we can't just do it in the parser. auto init = getInitializer(); auto parent = getParentScope(); if (init && parent && parent->asSymbol().kind == SymbolKind::Package) parent->addDiag(diag::PackageNetInit, init->sourceRange); } void NetSymbol::serializeTo(ASTSerializer& serializer) const { serializer.write("netType", netType); switch (expansionHint) { case Vectored: serializer.write("expansionHint", "vectored"sv); break; case Scalared: serializer.write("expansionHint", "scalared"sv); break; default: break; } if (auto delayCtrl = getDelay()) serializer.write("delay", *delayCtrl); } IteratorSymbol::IteratorSymbol(const Scope& scope, string_view name, SourceLocation loc, const Type& arrayType) : VariableSymbol(SymbolKind::Iterator, name, loc, VariableLifetime::Automatic), arrayType(arrayType) { isConstant = true; setParent(scope); const Type* elemType = arrayType.getArrayElementType(); if (!elemType) elemType = &scope.getCompilation().getErrorType(); setType(*elemType); } IteratorSymbol::IteratorSymbol(string_view name, SourceLocation loc, const Type& arrayType, const Type& indexType) : VariableSymbol(SymbolKind::Iterator, name, loc, VariableLifetime::Automatic), arrayType(arrayType) { isConstant = true; setType(indexType); } ClockVarSymbol::ClockVarSymbol(string_view name, SourceLocation loc, ArgumentDirection direction, ClockingSkew inputSkew, ClockingSkew outputSkew) : VariableSymbol(SymbolKind::ClockVar, name, loc, VariableLifetime::Static), direction(direction), inputSkew(inputSkew), outputSkew(outputSkew) { } void ClockVarSymbol::fromSyntax(const Scope& scope, const ClockingItemSyntax& syntax, SmallVector<const ClockVarSymbol*>& results) { // Lookups should happen in the parent of the clocking block, since other // clocking block members cannot reference each other. auto& comp = scope.getCompilation(); auto parent = scope.asSymbol().getParentScope(); ASSERT(parent); LookupLocation ll = LookupLocation::before(scope.asSymbol()); BindContext context(*parent, ll); ArgumentDirection dir; ClockingSkew inputSkew, outputSkew; if (syntax.direction->input.kind == TokenKind::InOutKeyword) { dir = ArgumentDirection::InOut; } else { if (syntax.direction->input) { dir = ArgumentDirection::In; if (syntax.direction->inputSkew) inputSkew = ClockingSkew::fromSyntax(*syntax.direction->inputSkew, context); } if (syntax.direction->output) { dir = syntax.direction->input ? ArgumentDirection::InOut : ArgumentDirection::Out; if (syntax.direction->outputSkew) outputSkew = ClockingSkew::fromSyntax(*syntax.direction->outputSkew, context); } } for (auto decl : syntax.decls) { auto name = decl->name; auto arg = comp.emplace<ClockVarSymbol>(name.valueText(), name.location(), dir, inputSkew, outputSkew); arg->setSyntax(*decl); arg->setAttributes(*parent, syntax.attributes); results.append(arg); // If there is an initializer expression we take our type from that. // Otherwise we need to lookup the signal in our parent scope and // take the type from that. if (decl->value) { auto& expr = Expression::bind(*decl->value->expr, context, BindFlags::NonProcedural); arg->setType(*expr.type); arg->setInitializer(expr); if (dir != ArgumentDirection::In) expr.verifyAssignable(context, decl->value->equals.location()); } else { auto sym = Lookup::unqualifiedAt(*parent, name.valueText(), ll, name.range()); if (sym && sym->kind != SymbolKind::Net && sym->kind != SymbolKind::Variable) { auto& diag = context.addDiag(diag::InvalidClockingSignal, name.range()); diag << name.valueText(); diag.addNote(diag::NoteDeclarationHere, sym->location); sym = nullptr; } if (sym) { auto sourceType = sym->getDeclaredType(); ASSERT(sourceType); arg->getDeclaredType()->copyTypeFrom(*sourceType); } } } } void ClockVarSymbol::serializeTo(ASTSerializer& serializer) const { VariableSymbol::serializeTo(serializer); serializer.write("direction", toString(direction)); if (inputSkew.hasValue()) { serializer.writeProperty("inputSkew"); serializer.startObject(); inputSkew.serializeTo(serializer); serializer.endObject(); } if (outputSkew.hasValue()) { serializer.writeProperty("outputSkew"); serializer.startObject(); outputSkew.serializeTo(serializer); serializer.endObject(); } } } // namespace slang
39.089397
100
0.63222
jankcorn
a740097b7643cbe1765e79298f31a10aab181bb5
796
cc
C++
clients/zukou/glm-helper.cc
Aki-7/zen
c3cfb95f554198427b4b102da55e4fab0cfc97ff
[ "Apache-2.0" ]
null
null
null
clients/zukou/glm-helper.cc
Aki-7/zen
c3cfb95f554198427b4b102da55e4fab0cfc97ff
[ "Apache-2.0" ]
null
null
null
clients/zukou/glm-helper.cc
Aki-7/zen
c3cfb95f554198427b4b102da55e4fab0cfc97ff
[ "Apache-2.0" ]
null
null
null
#include <string.h> #include <zukou.h> #include <glm/glm.hpp> namespace zukou { glm::vec3 glm_vec3_from_wl_array(struct wl_array *array) { float *data = (float *)array->data; return glm::vec3(data[0], data[1], data[2]); } void glm_vec3_to_wl_array(glm::vec3 v, struct wl_array *array) { size_t size = sizeof(float) * 3; float *data = (float *)wl_array_add(array, size); memcpy(data, &v, size); } void glm_vec4_to_wl_array(glm::vec4 v, struct wl_array *array) { size_t size = sizeof(float) * 4; float *data = (float *)wl_array_add(array, size); memcpy(data, &v, size); } void glm_mat4_to_wl_array(glm::mat4 m, struct wl_array *array) { size_t size = sizeof(float) * 16; float *data = (float *)wl_array_add(array, size); memcpy(data, &m, size); } } // namespace zukou
19.9
57
0.678392
Aki-7
a743ed092d46e9c0d7cd80f34e4289c40d31293a
515
cpp
C++
Chapter 9/twofile2.cpp
liu1322592019/Cpp-Primer
7f6daa7ff37d67456eb6a0dd6d0d1aa64fdc10ef
[ "MIT" ]
4
2020-12-26T03:17:45.000Z
2022-01-11T05:54:40.000Z
Chapter 9/twofile2.cpp
liu1322592019/Cpp-Primer
7f6daa7ff37d67456eb6a0dd6d0d1aa64fdc10ef
[ "MIT" ]
null
null
null
Chapter 9/twofile2.cpp
liu1322592019/Cpp-Primer
7f6daa7ff37d67456eb6a0dd6d0d1aa64fdc10ef
[ "MIT" ]
null
null
null
// twofile2.cpp -- variables with internal and external linkage #include <iostream> extern int tom; // tom defined elsewhere static int dick = 10; // overrides external dick int harry = 200; // external variable definition, // no conflict with twofile1 harry void remote_access() { using namespace std; cout << "remote_access() reports the following addresses:\n"; cout << &tom << " = &tom, " << &dick << " = &dick, "; cout << &harry << " = &harry\n"; }
32.1875
65
0.6
liu1322592019
a7454d5ba19451d225b1321c9a8c2784d6252a3e
100
cpp
C++
Untitled.cpp
ASAD-BE18/Cpp-Programs
d942015e3e21e8fb13d1fc86049d65ffb9555fe3
[ "MIT" ]
null
null
null
Untitled.cpp
ASAD-BE18/Cpp-Programs
d942015e3e21e8fb13d1fc86049d65ffb9555fe3
[ "MIT" ]
null
null
null
Untitled.cpp
ASAD-BE18/Cpp-Programs
d942015e3e21e8fb13d1fc86049d65ffb9555fe3
[ "MIT" ]
null
null
null
#include <iostream> using namespace std; int main () { int i; ++i; cout<<i; return 0; }
11.111111
21
0.56
ASAD-BE18
a74bb8a8e0f38012a09463cb5d42312612f4a679
22,583
hpp
C++
include/LIEF/MachO/Binary.hpp
ekilmer/LIEF
77328b0071c7254567d9e8383ea0f5f876f9da17
[ "Apache-2.0" ]
null
null
null
include/LIEF/MachO/Binary.hpp
ekilmer/LIEF
77328b0071c7254567d9e8383ea0f5f876f9da17
[ "Apache-2.0" ]
null
null
null
include/LIEF/MachO/Binary.hpp
ekilmer/LIEF
77328b0071c7254567d9e8383ea0f5f876f9da17
[ "Apache-2.0" ]
null
null
null
/* Copyright 2017 - 2022 R. Thomas * Copyright 2017 - 2022 Quarkslab * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef LIEF_MACHO_BINARY_H_ #define LIEF_MACHO_BINARY_H_ #include <vector> #include <map> #include "LIEF/types.hpp" #include "LIEF/visibility.h" #include "LIEF/Abstract/Binary.hpp" #include "LIEF/iterators.hpp" #include "LIEF/MachO/Header.hpp" #include "LIEF/errors.hpp" namespace LIEF { //! Namespace related to the LIEF's Mach-O module namespace MachO { class BinaryParser; class Builder; class DyldInfo; class BuildVersion; class EncryptionInfo; class DyldEnvironment; class SubFramework; class SegmentSplitInfo; class DataInCode; class CodeSignature; class RPathCommand; class ThreadCommand; class VersionMin; class SourceVersion; class FunctionStarts; class DynamicSymbolCommand; class MainCommand; class SymbolCommand; class Symbol; class UUIDCommand; class DylinkerCommand; class DylibCommand; class SegmentCommand; class LoadCommand; class Header; //! Class which represents a MachO binary class LIEF_API Binary : public LIEF::Binary { friend class BinaryParser; friend class Builder; friend class DyldInfo; public: using range_t = std::pair<uint64_t, uint64_t>; //! Internal container for storing Mach-O LoadCommand using commands_t = std::vector<std::unique_ptr<LoadCommand>>; //! Iterator that outputs LoadCommand& using it_commands = ref_iterator<commands_t&, LoadCommand*>; //! Iterator that outputs const LoadCommand& using it_const_commands = const_ref_iterator<const commands_t&, LoadCommand*>; //! Internal container for storing Mach-O Symbol using symbols_t = std::vector<std::unique_ptr<Symbol>>; //! Iterator that outputs Symbol& using it_symbols = ref_iterator<symbols_t&, Symbol*>; //! Iterator that outputs const Symbol& using it_const_symbols = const_ref_iterator<const symbols_t&, const Symbol*>; //! Iterator that outputs exported Symbol& using it_exported_symbols = filter_iterator<symbols_t&, Symbol*>; //! Iterator that outputs exported const Symbol& using it_const_exported_symbols = const_filter_iterator<const symbols_t&, const Symbol*>; //! Iterator that outputs imported Symbol& using it_imported_symbols = filter_iterator<symbols_t&, Symbol*>; //! Iterator that outputs imported const Symbol& using it_const_imported_symbols = const_filter_iterator<const symbols_t&, const Symbol*>; //! Internal container for caching Mach-O Section using sections_cache_t = std::vector<Section*>; //! Iterator that outputs Section& using it_sections = ref_iterator<sections_cache_t&>; //! Iterator that outputs const Section& using it_const_sections = const_ref_iterator<const sections_cache_t&>; //! Internal container for storing Mach-O SegmentCommand using segments_cache_t = std::vector<SegmentCommand*>; //! Iterator that outputs SegmentCommand& using it_segments = ref_iterator<segments_cache_t&>; //! Iterator that outputs const SegmentCommand& using it_const_segments = const_ref_iterator<const segments_cache_t&>; //! Internal container for storing Mach-O DylibCommand using libraries_cache_t = std::vector<DylibCommand*>; //! Iterator that outputs DylibCommand& using it_libraries = ref_iterator<libraries_cache_t&>; //! Iterator that outputs const DylibCommand& using it_const_libraries = const_ref_iterator<const libraries_cache_t&>; //! Internal container for storing Mach-O Fileset Binary using fileset_binaries_t = std::vector<std::unique_ptr<Binary>>; //! Iterator that outputs Binary& using it_fileset_binaries = ref_iterator<fileset_binaries_t&, Binary*>; //! Iterator that outputs const Binary& using it_const_fileset_binaries = const_ref_iterator<const fileset_binaries_t&, Binary*>; struct KeyCmp { bool operator() (const Relocation* lhs, const Relocation* rhs) const; }; //! Internal container that store all the relocations //! found in a Mach-O. The relocations are actually owned //! by Section & SegmentCommand and these references are used for convenience using relocations_t = std::set<Relocation*, KeyCmp>; //! Iterator which outputs Relocation& using it_relocations = ref_iterator<relocations_t&, Relocation*>; //! Iterator which outputs const Relocation& using it_const_relocations = const_ref_iterator<const relocations_t&, const Relocation*>; public: Binary(const Binary&) = delete; Binary& operator=(const Binary&) = delete; //! Return a reference to the MachO::Header Header& header(); const Header& header() const; //! Return an iterator over the MachO LoadCommand present //! in the binary it_commands commands(); it_const_commands commands() const; //! Return an iterator over the MachO::Binary associated //! with the LOAD_COMMAND_TYPES::LC_FILESET_ENTRY commands it_fileset_binaries filesets(); it_const_fileset_binaries filesets() const; //! Return binary's @link MachO::Symbol symbols @endlink it_symbols symbols(); it_const_symbols symbols() const; //! Check if a symbol with the given name exists bool has_symbol(const std::string& name) const; //! Return Symbol from the given name. If the symbol does not //! exists, it returns a null pointer const Symbol* get_symbol(const std::string& name) const; Symbol* get_symbol(const std::string& name); //! Check if the given symbol is exported static bool is_exported(const Symbol& symbol); //! Return binary's exported symbols (iterator over LIEF::MachO::Symbol) it_exported_symbols exported_symbols(); it_const_exported_symbols exported_symbols() const; //! Check if the given symbol is an imported one static bool is_imported(const Symbol& symbol); //! Return binary's imported symbols (iterator over LIEF::MachO::Symbol) it_imported_symbols imported_symbols(); it_const_imported_symbols imported_symbols() const; //! Return binary imported libraries (MachO::DylibCommand) it_libraries libraries(); it_const_libraries libraries() const; //! Return an iterator over the SegmentCommand it_segments segments(); it_const_segments segments() const; //! Return an iterator over the MachO::Section it_sections sections(); it_const_sections sections() const; //! Return an iterator over the MachO::Relocation it_relocations relocations(); it_const_relocations relocations() const; //! Reconstruct the binary object and write the result in the given `filename` //! //! @param filename Path to write the reconstructed binary void write(const std::string& filename) override; //! Reconstruct the binary object and return its content as bytes std::vector<uint8_t> raw(); //! Check if the current binary has the given MachO::LOAD_COMMAND_TYPES bool has(LOAD_COMMAND_TYPES type) const; //! Return the LoadCommand associated with the given LOAD_COMMAND_TYPES //! or a nullptr if the command can't be found. const LoadCommand* get(LOAD_COMMAND_TYPES type) const; LoadCommand* get(LOAD_COMMAND_TYPES type); //! Insert a new LoadCommand LoadCommand& add(const LoadCommand& command); //! Insert a new LoadCommand at the specified ``index`` LoadCommand& add(const LoadCommand& command, size_t index); //! Insert the given DylibCommand LoadCommand& add(const DylibCommand& library); //! Add a new LC_SEGMENT command from the given SegmentCommand LoadCommand& add(const SegmentCommand& segment); //! Insert a new shared library through a ``LC_LOAD_DYLIB`` command LoadCommand& add_library(const std::string& name); //! Add a new MachO::Section in the __TEXT segment Section* add_section(const Section& section); //! Add a section in the given MachO::SegmentCommand. //! //! @warning This method may corrupt the file if the segment is not the first one //! nor the last one Section* add_section(const SegmentCommand& segment, const Section& section); //! Remove the section with the name provided in the first parameter. //! //! @param name Name of the MachO::Section to remove //! @param clear If ``true`` clear the content of the section before removing void remove_section(const std::string& name, bool clear = false) override; //! Remove the given LoadCommand bool remove(const LoadCommand& command); //! Remove **all** LoadCommand with the given type (MachO::LOAD_COMMAND_TYPES) bool remove(LOAD_COMMAND_TYPES type); //! Remove the Load Command at the provided ``index`` bool remove_command(size_t index); //! Remove the LC_SIGNATURE command bool remove_signature(); //! Extend the **size** of the given LoadCommand bool extend(const LoadCommand& command, uint64_t size); //! Extend the **content** of the given SegmentCommand bool extend_segment(const SegmentCommand& segment, size_t size); //! Remove the ``PIE`` flag bool disable_pie(); //! Return the binary's imagebase. ``0`` if not relevant uint64_t imagebase() const override; //! Size of the binary in memory when mapped by the loader (``dyld``) uint64_t virtual_size() const; //! Return the binary's loader (e.g. ``/usr/lib/dyld``) or an //! empty string if the binary does not use a loader/linker std::string loader() const; //! Check if a section with the given name exists bool has_section(const std::string& name) const; //! Return the section from the given name of a nullptr //! if the section can't be found. Section* get_section(const std::string& name); //! Return the section from the given name or a nullptr //! if the section can't be found const Section* get_section(const std::string& name) const; //! Check if a segment with the given name exists bool has_segment(const std::string& name) const; //! Return the segment from the given name const SegmentCommand* get_segment(const std::string& name) const; //! Return the segment from the given name SegmentCommand* get_segment(const std::string& name); //! Remove the symbol with the given name bool remove_symbol(const std::string& name); //! Remove the given symbol bool remove(const Symbol& sym); //! Check if the given symbol can be safely removed. bool can_remove(const Symbol& sym) const; //! Check if the MachO::Symbol with the given name can be safely removed. bool can_remove_symbol(const std::string& name) const; //! Remove the given MachO::Symbol with the given name from the export table bool unexport(const std::string& name); //! Remove the given symbol from the export table bool unexport(const Symbol& sym); //! Return the MachO::Section that encompasses the provided offset. //! If a section can't be found, it returns a null pointer (``nullptr``) Section* section_from_offset(uint64_t offset); const Section* section_from_offset(uint64_t offset) const; //! Return the MachO::Section that encompasses the provided virtual address. //! If a section can't be found, it returns a null pointer (``nullptr``) Section* section_from_virtual_address(uint64_t virtual_address); const Section* section_from_virtual_address(uint64_t virtual_address) const; //! Convert a virtual address to an offset in the file uint64_t virtual_address_to_offset(uint64_t virtual_address) const; //! Convert the given offset into a virtual address. //! //! @param[in] offset The offset to convert. //! @param[in] slide If not 0, it will replace the default base address (if any) uint64_t offset_to_virtual_address(uint64_t offset, uint64_t slide = 0) const override; //! Return the binary's SegmentCommand that encompasses the provided offset //! //! If a SegmentCommand can't be found it returns a null pointer (``nullptr``). SegmentCommand* segment_from_offset(uint64_t offset); const SegmentCommand* segment_from_offset(uint64_t offset) const; //! Return the index of the given SegmentCommand size_t segment_index(const SegmentCommand& segment) const; //! Return binary's *fat offset*. ``0`` if not relevant. uint64_t fat_offset() const; //! Return the binary's SegmentCommand which encompasses the given virtual address SegmentCommand* segment_from_virtual_address(uint64_t virtual_address); const SegmentCommand* segment_from_virtual_address(uint64_t virtual_address) const; //! Return the range of virtual addresses range_t va_ranges() const; //! Return the range of offsets range_t off_ranges() const; //! Check if the given address is encompassed in the //! binary's virtual addresses range bool is_valid_addr(uint64_t address) const; //! Method so that the ``visitor`` can visit us void accept(LIEF::Visitor& visitor) const override; std::ostream& print(std::ostream& os) const override; //! Patch the content at virtual address @p address with @p patch_value //! //! @param[in] address Address to patch //! @param[in] patch_value Patch to apply //! @param[in] addr_type Specify if the address should be used as //! an absolute virtual address or an RVA void patch_address(uint64_t address, const std::vector<uint8_t>& patch_value, LIEF::Binary::VA_TYPES addr_type = LIEF::Binary::VA_TYPES::AUTO) override; //! Patch the address with the given value //! //! @param[in] address Address to patch //! @param[in] patch_value Patch to apply //! @param[in] size Size of the value in **bytes** (1, 2, ... 8) //! @param[in] addr_type Specify if the address should be used as //! an absolute virtual address or an RVA void patch_address(uint64_t address, uint64_t patch_value, size_t size = sizeof(uint64_t), LIEF::Binary::VA_TYPES addr_type = LIEF::Binary::VA_TYPES::AUTO) override; //! Return the content located at virtual address std::vector<uint8_t> get_content_from_virtual_address(uint64_t virtual_address, uint64_t size, LIEF::Binary::VA_TYPES addr_type = LIEF::Binary::VA_TYPES::AUTO) const override; //! The binary entrypoint uint64_t entrypoint() const override; //! Check if the binary is position independent bool is_pie() const override; //! Check if the binary uses ``NX`` protection bool has_nx() const override; //! ``true`` if the binary has an entrypoint. //! //! Basically for libraries it will return ``false`` bool has_entrypoint() const; //! ``true`` if the binary has a MachO::UUIDCommand command. bool has_uuid() const; //! Return the MachO::UUIDCommand if present, a nullptr otherwise. UUIDCommand* uuid(); const UUIDCommand* uuid() const; //! ``true`` if the binary has a MachO::MainCommand command. bool has_main_command() const; //! Return the MachO::MainCommand if present, a nullptr otherwise. MainCommand* main_command(); const MainCommand* main_command() const; //! ``true`` if the binary has a MachO::DylinkerCommand. bool has_dylinker() const; //! Return the MachO::DylinkerCommand if present, a nullptr otherwise. DylinkerCommand* dylinker(); const DylinkerCommand* dylinker() const; //! ``true`` if the binary has a MachO::DyldInfo command. bool has_dyld_info() const; //! Return the MachO::Dyld command if present, a nullptr otherwise. DyldInfo* dyld_info(); const DyldInfo* dyld_info() const; //! ``true`` if the binary has a MachO::FunctionStarts command. bool has_function_starts() const; //! Return the MachO::FunctionStarts command if present, a nullptr otherwise. FunctionStarts* function_starts(); const FunctionStarts* function_starts() const; //! ``true`` if the binary has a MachO::SourceVersion command. bool has_source_version() const; //! Return the MachO::SourceVersion command if present, a nullptr otherwise. SourceVersion* source_version(); const SourceVersion* source_version() const; //! ``true`` if the binary has a MachO::VersionMin command. bool has_version_min() const; //! Return the MachO::VersionMin command if present, a nullptr otherwise. VersionMin* version_min(); const VersionMin* version_min() const; //! ``true`` if the binary has a MachO::ThreadCommand command. bool has_thread_command() const; //! Return the MachO::ThreadCommand command if present, a nullptr otherwise. ThreadCommand* thread_command(); const ThreadCommand* thread_command() const; //! ``true`` if the binary has a MachO::RPathCommand command. bool has_rpath() const; //! Return the MachO::RPathCommand command if present, a nullptr otherwise. RPathCommand* rpath(); const RPathCommand* rpath() const; //! ``true`` if the binary has a MachO::SymbolCommand command. bool has_symbol_command() const; //! Return the MachO::SymbolCommand if present, a nullptr otherwise. SymbolCommand* symbol_command(); const SymbolCommand* symbol_command() const; //! ``true`` if the binary has a MachO::DynamicSymbolCommand command. bool has_dynamic_symbol_command() const; //! Return the MachO::SymbolCommand if present, a nullptr otherwise. DynamicSymbolCommand* dynamic_symbol_command(); const DynamicSymbolCommand* dynamic_symbol_command() const; //! ``true`` if the binary is signed with `LC_CODE_SIGNATURE` command bool has_code_signature() const; //! Return the MachO::CodeSignature if present, a nullptr otherwise. CodeSignature* code_signature(); const CodeSignature* code_signature() const; //! ``true`` if the binary is signed with the command `DYLIB_CODE_SIGN_DRS` bool has_code_signature_dir() const; //! Return the MachO::CodeSignature if present, a nullptr otherwise. CodeSignature* code_signature_dir(); const CodeSignature* code_signature_dir() const; //! ``true`` if the binary has a MachO::DataInCode command. bool has_data_in_code() const; //! Return the MachO::DataInCode if present, a nullptr otherwise. DataInCode* data_in_code(); const DataInCode* data_in_code() const; //! ``true`` if the binary has segment split info. bool has_segment_split_info() const; //! Return the MachO::SegmentSplitInfo if present, a nullptr otherwise. SegmentSplitInfo* segment_split_info(); const SegmentSplitInfo* segment_split_info() const; //! ``true`` if the binary has a sub framework command. bool has_sub_framework() const; //! ``true`` if the binary has Encryption Info. bool has_encryption_info() const; //! Return the MachO::DyldEnvironment if present, a nullptr otherwise. EncryptionInfo* encryption_info(); const EncryptionInfo* encryption_info() const; //! Return the MachO::SubFramework if present, a nullptr otherwise. SubFramework* sub_framework(); const SubFramework* sub_framework() const; //! ``true`` if the binary has Dyld envrionment variables. bool has_dyld_environment() const; //! Return the MachO::DyldEnvironment if present, a nullptr otherwise DyldEnvironment* dyld_environment(); const DyldEnvironment* dyld_environment() const; //! ``true`` if the binary has Build Version command. bool has_build_version() const; //! Return the MachO::BuildVersion if present, a nullptr otherwise. BuildVersion* build_version(); const BuildVersion* build_version() const; template<class T> LIEF_LOCAL bool has_command() const; template<class T> LIEF_LOCAL T* command(); template<class T> LIEF_LOCAL const T* command() const; template<class T> size_t count_commands() const; LoadCommand* operator[](LOAD_COMMAND_TYPES type); const LoadCommand* operator[](LOAD_COMMAND_TYPES type) const; //! Return the list of the MachO's constructors LIEF::Binary::functions_t ctor_functions() const override; //! Return all the functions found in this MachO LIEF::Binary::functions_t functions() const; //! Return the functions found in the ``__unwind_info`` section LIEF::Binary::functions_t unwind_functions() const; //! ``true`` if the binary has a LOAD_COMMAND_TYPES::LC_FILESET_ENTRY command bool has_filesets() const; ~Binary() override; private: //! Default constructor Binary(); // Shift content next to LC table void shift(size_t value); void shift_command(size_t width, size_t from_offset); //! Insert a Segment command in the cache field (segments_) //! and keep a consistent state of the indexes. size_t add_cached_segment(SegmentCommand& segment); template<class T> LIEF_LOCAL ok_error_t patch_relocation(Relocation& relocation, uint64_t from, uint64_t shift); LIEF::Header get_abstract_header() const override; LIEF::Binary::sections_t get_abstract_sections() override; LIEF::Binary::symbols_t get_abstract_symbols() override; LIEF::Binary::relocations_t get_abstract_relocations() override; LIEF::Binary::functions_t get_abstract_exported_functions() const override; LIEF::Binary::functions_t get_abstract_imported_functions() const override; std::vector<std::string> get_abstract_imported_libraries() const override; inline relocations_t& relocations_list() { return this->relocations_; } inline const relocations_t& relocations_list() const { return this->relocations_; } inline size_t pointer_size() const { return this->is64_ ? sizeof(uint64_t) : sizeof(uint32_t); } bool is64_ = true; Header header_; commands_t commands_; symbols_t symbols_; // Same purpose as sections_cache_t libraries_cache_t libraries_; // The sections are owned by the SegmentCommand object. // This attribute is a cache to speed-up the iteration sections_cache_t sections_; // Same purpose as sections_cache_t segments_cache_t segments_; fileset_binaries_t filesets_; // Cached relocations from segment / sections mutable relocations_t relocations_; int32_t available_command_space_ = 0; // This is used to improve performances of // offset_to_virtual_address std::map<uint64_t, SegmentCommand*> offset_seg_; protected: uint64_t fat_offset_ = 0; uint64_t fileset_offset_ = 0; }; } // namespace MachO } // namespace LIEF #endif
34.79661
108
0.733649
ekilmer
a751976982216d924f49b2d87703ae13480ee6ca
21,648
cpp
C++
src/comport/src/wepet_comport_linux.cpp
peterweissig/cpp_main
491ce299b98d24b3da3b43e1121d609f28f3ece0
[ "BSD-3-Clause" ]
null
null
null
src/comport/src/wepet_comport_linux.cpp
peterweissig/cpp_main
491ce299b98d24b3da3b43e1121d609f28f3ece0
[ "BSD-3-Clause" ]
null
null
null
src/comport/src/wepet_comport_linux.cpp
peterweissig/cpp_main
491ce299b98d24b3da3b43e1121d609f28f3ece0
[ "BSD-3-Clause" ]
null
null
null
/****************************************************************************** * * * wepet_comport_linux.cpp * * ======================= * * * * Version: 1.1.3 * * Date : 11.10.15 * * Author : Peter Weissig * * * * For help or bug report please visit: * * https://github.com/peterweissig/cpp_avr_downloader * ******************************************************************************/ // local headers #include "wepet_comport.h" // wepet headers // standard headers #include <fstream> // additional headers #include <sys/time.h> #include <fcntl.h> #include <termio.h> #include <linux/serial.h> #include <sys/ioctl.h> #include <unistd.h> namespace wepet { //**************************[cComPort]***************************************** cComPort::cComPort() { port_file = -1; port_baudrate = 57600; port_settings.c_iflag = 0; port_settings.c_iflag|= IGNBRK ; // ignore BREAK condition port_settings.c_iflag|= IGNPAR ; // ignore (discard) parity errors /* port_settings.c_iflag|= BRKINT ; // map BREAK to SIGINTR port_settings.c_iflag|= PARMRK ; // mark parity and framing errors port_settings.c_iflag|= INPCK ; // enable checking of parity errors port_settings.c_iflag|= ISTRIP ; // strip 8th bit off chars port_settings.c_iflag|= IGNCR ; // ignore CR port_settings.c_iflag|= INLCR ; // map NL into CR port_settings.c_iflag|= ICRNL ; // map CR to NL (ala CRMOD) port_settings.c_iflag|= IXON ; // enable output flow control port_settings.c_iflag|= IXOFF ; // enable input flow control port_settings.c_iflag|= IXANY ; // any char will restart after stop port_settings.c_iflag|= IMAXBEL; // ring bell on input queue full */ port_settings.c_oflag = 0; /* port_settings.c_oflag|= OPOST ; // enable following output processing port_settings.c_oflag|= ONLCR ; // map NL to CR-NL (ala CRMOD) port_settings.c_oflag|= OCRNL ; // map CR to NL port_settings.c_oflag|= TABDLY; // tab delay mask port_settings.c_oflag|= TAB0 ; // no tab delay and expansion port_settings.c_oflag|= TAB3 ; // expand tabs to spaces port_settings.c_oflag|= ONOEOT; // discard EOT's '^D' on output) port_settings.c_oflag|= ONOCR ; // do not transmit CRs on column 0 port_settings.c_oflag|= ONLRET; // on the terminal NL performs the CR function */ port_settings.c_cflag = 0; port_settings.c_cflag|= CS8 ; // 8 bits port_settings.c_cflag|= CSTOPB ; // send 2 stop bits port_settings.c_cflag|= CREAD ; // enable receiver port_settings.c_cflag|= CLOCAL ; // ignore modem status lines port_settings.c_cflag|= B38400 ; /* port_settings.c_cflag|= CSIZE ; // character size mask port_settings.c_cflag|= CS5 ; // 5 bits (pseudo) port_settings.c_cflag|= CS6 ; // 6 bits port_settings.c_cflag|= CS7 ; // 7 bits port_settings.c_cflag|= PARENB ; // parity enable port_settings.c_cflag|= PARODD ; // odd parity, else even port_settings.c_cflag|= PAREXT ; // Extended parity for mark and space parity port_settings.c_cflag|= HUPCL ; // hang up on last close port_settings.c_cflag|= CCTS_OFLOW; // CTS flow control of output port_settings.c_cflag|= CRTSCTS ; // same as CCTS_OFLOW port_settings.c_cflag|= CRTS_IFLOW; // RTS flow control of input port_settings.c_cflag|= MDMBUF ; // flow control output via Carrier */ port_settings.c_lflag = 0; /* port_settings.c_lflag|= ECHOKE ; // visual erase for line kill port_settings.c_lflag|= ECHOE ; // visually erase chars port_settings.c_lflag|= ECHO ; // enable echoing port_settings.c_lflag|= ECHONL ; // echo NL even if ECHO is off port_settings.c_lflag|= ECHOPRT ; // visual erase mode for hardcopy port_settings.c_lflag|= ECHOCTL ; // echo control chars as ^(Char) port_settings.c_lflag|= ISIG ; // enable signals INTR, QUIT, [D]SUSP port_settings.c_lflag|= ICANON ; // canonicalize input lines port_settings.c_lflag|= ALTWERASE ; // use alternate WERASE algorithm port_settings.c_lflag|= IEXTEN ; // enable DISCARD and LNEXT port_settings.c_lflag|= EXTPROC ; // external processing port_settings.c_lflag|= TOSTOP ; // stop background jobs from output port_settings.c_lflag|= FLUSHO ; // output being flushed (state) port_settings.c_lflag|= NOKERNINFO; // no kernel output from VSTATUS port_settings.c_lflag|= PENDIN ; // XXX retype pending input (state) port_settings.c_lflag|= NOFLSH ; // don't flush after interrupt */ port_settings.c_cc[VMIN ] = 0x00; port_settings.c_cc[VTIME ] = 0x00; /* port_settings.c_cc[VEOF ] = 0x00; port_settings.c_cc[VEOL ] = 0x00; port_settings.c_cc[VEOL2 ] = 0x00; port_settings.c_cc[VERASE ] = 0x00; port_settings.c_cc[VWERASE ] = 0x00; port_settings.c_cc[VKILL ] = 0x00; port_settings.c_cc[VREPRINT] = 0x00; port_settings.c_cc[VINTR ] = 0x00; port_settings.c_cc[VQUIT ] = 0x00; port_settings.c_cc[VSUSP ] = 0x00; port_settings.c_cc[VDSUSP ] = 0x00; port_settings.c_cc[VSTART ] = 0x00; port_settings.c_cc[VSTOP ] = 0x00; port_settings.c_cc[VLNEXT ] = 0x00; port_settings.c_cc[VDISCARD] = 0x00; port_settings.c_cc[VSTATUS ] = 0x00; */ } //**************************[~cComPort]**************************************** cComPort::~cComPort() { Close(); } //**************************[Open]********************************************* bool cComPort::Open(std::string port_name) { if (IsOpened()) { Close(); } port_file = open(port_name.data(), O_RDWR | O_NONBLOCK | O_NOCTTY); if (! IsOpened()) { return false; } if (tcgetattr(port_file,&port_settings_old) < 0) { Close(); return false; } if (tcsetattr(port_file,TCSANOW,&port_settings) < 0) { Close(); return false; } if (tcgetattr(port_file,&port_settings) < 0) { Close(); return false; } if (! SettingBaudRateSet(port_baudrate)) { Close(); return false; } return true; } //**************************[IsOpened]***************************************** bool cComPort::IsOpened() { return (port_file >= 0); } //**************************[Close]******************************************** void cComPort::Close() { if (! IsOpened()) { return; } tcsetattr(port_file,TCSANOW,&port_settings_old); close(port_file); port_file = -1; } //**************************[Transmit]***************************************** bool cComPort::Transmit(std::string text) { int count; if (! IsOpened()) { return false; } count = write(port_file, &(text[0]),text.size()); if (count != text.size()) { return false; } return true; } //**************************[Receive]****************************************** std::string cComPort::Receive() { int count_in; int count_out; std::string result; if (! IsOpened()) { return ""; } count_in = HWBufferInCountGet(); if (count_in < 1) { return ""; } result.resize(count_in); count_out = read(port_file, &(result[0]),count_in); if (count_out < 0) { return ""; } result.resize(count_out); return result; } //**************************[LineRtsSet]*************************************** bool cComPort::LineRtsSet(bool state) { int temp_status; if (! IsOpened()) { return false; } if (ioctl(port_file, TIOCMGET, &temp_status) == -1) { return false; } if (state) { temp_status|= TIOCM_RTS; } else{ temp_status&= ~TIOCM_RTS; } if (ioctl(port_file, TIOCMSET, &temp_status) == -1) { return false; } return true; } //**************************[LineDtrSet]*************************************** bool cComPort::LineDtrSet(bool state) { int temp_status; if (! IsOpened()) { return false; } if (ioctl(port_file, TIOCMGET, &temp_status) == -1) { return false; } if (state) { temp_status|= TIOCM_DTR; } else{ temp_status&= ~TIOCM_DTR; } if (ioctl(port_file, TIOCMSET, &temp_status) == -1) { return false; } return true; } //**************************[HWBufferInSizeGet]******************************** int cComPort::HWBufferInSizeGet() { // Dummy function - only working in windows return -1; } //**************************[HWBufferOutSizeGet]******************************* int cComPort::HWBufferOutSizeGet() { // Dummy function - only working in windows return -1; } //**************************[HWBufferSizeSet]********************************** bool cComPort::HWBufferSizeSet(int buffer_in_size, int buffer_out_size) { // Dummy function - only working in windows return true; } //**************************[HWBufferInCountGet]******************************* int cComPort::HWBufferInCountGet() { int in_count; if (! IsOpened()) { return -2; } if (ioctl(port_file, FIONREAD, &in_count) == -1) { return -1; } return in_count; } //**************************[HWBufferOutCountGet]****************************** int cComPort::HWBufferOutCountGet() { int out_count; if (! IsOpened()) { return -2; } #if defined(FIONWRITE) if (ioctl(port_file, FIONWRITE, &out_count) == -1) { return -1; } return out_count; #else // #if defined(FIONWRITE) return -3; #endif // #if defined(FIONWRITE) } //**************************[HWBufferFlush]************************************ bool cComPort::HWBufferFlush(bool buffer_in, bool buffer_out) { if (! IsOpened()) { return true; } if ((buffer_in == false) && (buffer_out == false)) { return true; } if (buffer_in) { if (buffer_out) { return (tcflush(port_file, TCIOFLUSH) != -1); } else { return (tcflush(port_file, TCIFLUSH) != -1); } } else { if (buffer_out) { return (tcflush(port_file, TCOFLUSH) != -1); } else { return true; } } } //**************************[SettingBaudRateGet]******************************* int cComPort::SettingBaudRateGet() { if (! IsOpened()) { return port_baudrate; } if (tcgetattr(port_file, &port_settings) == -1) { return -1; } switch (port_settings.c_cflag & (CBAUD | CBAUDEX)) { case ( B0) : return 0; case ( B50) : return 50; case ( B75) : return 75; case ( B110) : return 110; case ( B134) : return 134; case ( B150) : return 150; case ( B200) : return 200; case ( B300) : return 300; case ( B600) : return 600; case ( B1200) : return 1200; case ( B1800) : return 1800; case ( B2400) : return 2400; case ( B4800) : return 4800; case ( B9600) : return 9600; case ( B19200) : return 19200; case ( B38400) : serial_struct temp_serial; if (ioctl(port_file, TIOCGSERIAL,&temp_serial) == -1) { return 38400; } if ((temp_serial.flags & ASYNC_SPD_MASK) != ASYNC_SPD_CUST) { return 38400; } if (temp_serial.custom_divisor == 0) { return -3; } return temp_serial.baud_base / temp_serial.custom_divisor; case ( B57600) : return 57600; #if defined( B76800) case ( B76800) : return 76800; #endif #if defined(B115200) case (B115200) : return 115200; #endif #if defined(B153600) case (B153600) : return 153600; #endif #if defined(B230400) case (B230400) : return 230400; #endif #if defined(B307200) case (B307200) : return 307200; #endif #if defined(B460800) case (B460800) : return 460800; #endif default : return -2; } } //**************************[SettingByteSizeGet]******************************* eComPortByteSize cComPort::SettingByteSizeGet() { if (IsOpened()) { if (tcgetattr(port_file, &port_settings) == -1) { return (eComPortByteSize) -2; } } switch (port_settings.c_cflag & CSIZE) { case (CS5) : return kCpByteSize5; break; case (CS6) : return kCpByteSize6; break; case (CS7) : return kCpByteSize7; break; case (CS8) : return kCpByteSize8; break; default : return (eComPortByteSize) -1; break; } } //**************************[SettingStopBitsGet]******************************* eComPortStopBits cComPort::SettingStopBitsGet() { if (IsOpened()) { if (tcgetattr(port_file, &port_settings) == -1) { return (eComPortStopBits) -2; } } if (port_settings.c_cflag & CSTOPB) { return kCpStopBits2; } else { return kCpStopBits1; } } //**************************[SettingParityGet]********************************* eComPortParity cComPort::SettingParityGet() { if (IsOpened()) { if (tcgetattr(port_file, &port_settings) == -1) { return (eComPortParity) -2; } } if ((port_settings.c_cflag & PARENB) == 0) { return kCpParityNone; } #if defined(PAREXT) if (port_settings.c_cflag & PAREXT) { if (port_settings.c_cflag & PARODD) { return kCpParityOdd; } else { return kCpParityEven; } } else { if (port_settings.c_cflag & PARODD) { return kCpParityMark; } else { return kCpParitySpace; } } #else // if defined(PAREXT) if (port_settings.c_cflag & PARODD) { return kCpParityOdd; } else { return kCpParityEven; } #endif // if defined(PAREXT) } //**************************[SettingBaudRateSet]******************************* bool cComPort::SettingBaudRateSet(int baud_rate) { port_baudrate = baud_rate; if (! IsOpened()) { return true; } if (tcgetattr(port_file, &port_settings) == -1) { return false; } port_settings.c_cflag&= ~(CBAUD | CBAUDEX); switch (baud_rate) { case ( 0) : port_settings.c_cflag|= B0; break; case ( 50) : port_settings.c_cflag|= B50; break; case ( 75) : port_settings.c_cflag|= B75; break; case ( 110) : port_settings.c_cflag|= B110; break; case ( 134) : port_settings.c_cflag|= B134; break; case ( 150) : port_settings.c_cflag|= B150; break; case ( 200) : port_settings.c_cflag|= B200; break; case ( 300) : port_settings.c_cflag|= B300; break; case ( 600) : port_settings.c_cflag|= B600; break; case ( 1200) : port_settings.c_cflag|= B1200; break; case ( 1800) : port_settings.c_cflag|= B1800; break; case ( 2400) : port_settings.c_cflag|= B2400; break; case ( 4800) : port_settings.c_cflag|= B4800; break; case ( 9600) : port_settings.c_cflag|= B9600; break; case ( 19200) : port_settings.c_cflag|= B19200; break; case ( 38400) : port_settings.c_cflag|= B38400; break; case ( 57600) : port_settings.c_cflag|= B57600; break; #if defined( B76800) case ( 76800) : port_settings.c_cflag|= B76800; break; #endif #if defined(B115200) case (115200) : port_settings.c_cflag|= B115200; break; #endif #if defined(B153600) case (153600) : port_settings.c_cflag|= B153600; break; #endif #if defined(B230400) case (230400) : port_settings.c_cflag|= B230400; break; #endif #if defined(B307200) case (307200) : port_settings.c_cflag|= B307200; break; #endif #if defined(B460800) case (460800) : port_settings.c_cflag|= B460800; break; #endif default : port_settings.c_cflag|= B38400; break; } if (tcsetattr(port_file, TCSANOW, &port_settings) == -1) { return false; } if ((port_settings.c_cflag & (CBAUD | CBAUDEX)) != B38400) { return true; } serial_struct temp_serial; if (ioctl(port_file, TIOCGSERIAL,&temp_serial) == -1) { return true; } if (baud_rate == 38400) { if (temp_serial.flags & ASYNC_SPD_MASK) { temp_serial.flags&= ~ASYNC_SPD_MASK; if (ioctl(port_file, TIOCSSERIAL,&temp_serial) == -1) { return false; } } } else { temp_serial.flags&= ~ASYNC_SPD_MASK; temp_serial.flags|= ASYNC_SPD_CUST; temp_serial.custom_divisor = (temp_serial.baud_base + baud_rate / 2) / baud_rate; if (ioctl(port_file, TIOCSSERIAL,&temp_serial) == -1) { return false; } } return true; } //**************************[SettingByteSizeSet]******************************* bool cComPort::SettingByteSizeSet(eComPortByteSize byte_size) { if (IsOpened()) { if (tcgetattr(port_file, &port_settings) == -1) { return false; } } port_settings.c_cflag&= ~CSIZE; switch (byte_size) { case (kCpByteSize5) : port_settings.c_cflag|= CS5; break; case (kCpByteSize6) : port_settings.c_cflag|= CS6; break; case (kCpByteSize7) : port_settings.c_cflag|= CS7; break; default : port_settings.c_cflag|= CS8; break; } if (IsOpened()) { if (tcsetattr(port_file, TCSANOW, &port_settings) == -1) { return false; } } return true; } //**************************[SettingStopBitsSet]******************************* bool cComPort::SettingStopBitsSet(eComPortStopBits stop_bits) { if (IsOpened()) { if (tcgetattr(port_file, &port_settings) == -1) { return false; } } if (stop_bits == kCpStopBits1) { port_settings.c_cflag&= ~CSTOPB; } else { port_settings.c_cflag|= CSTOPB; } if (IsOpened()) { if (tcsetattr(port_file, TCSANOW, &port_settings) == -1) { return false; } } return true; } //**************************[SettingParitySet]********************************* bool cComPort::SettingParitySet(eComPortParity parity) { if (IsOpened()) { if (tcgetattr(port_file, &port_settings) == -1) { return false; } } #if defined(PAREXT) port_settings.c_cflag&= ~(PARENB | PARODD | PAREXT); #else // if defined(PAREXT) port_settings.c_cflag&= ~(PARENB | PARODD ); #endif // if defined(PAREXT) switch (parity) { case (kCpParityOdd) : port_settings.c_cflag|= PARENB | PARODD ; break; case (kCpParityEven) : port_settings.c_cflag|= PARENB ; break; #if defined(PAREXT) case (kCpParityMark) : port_settings.c_cflag|= PARENB | PARODD | PAREXT; break; case (kCpParitySpace) : port_settings.c_cflag|= PARENB | PAREXT; break; #endif // if defined(PAREXT) default : break; } if (IsOpened()) { if (tcsetattr(port_file, TCSANOW, &port_settings) == -1) { return false; } } return true; } //**************************[GetCurrentTime]*********************************** int64_t cComPortBuffer::GetCurrentTime() const { timespec time; if (clock_gettime(CLOCK_MONOTONIC, &time)) { return (uint64_t) -1; } return (int64_t) time.tv_sec * (int64_t) 1000 + (time.tv_nsec / 1000000); } //**************************[SleepOneMilliSecond]****************************** void cComPortBuffer::SleepOneMilliSecond() const { usleep(1000); } } // namespace wepet {
31.014327
85
0.501571
peterweissig
a7529d7ebb5ecb2740c03649b7b8dbb218211556
697
hpp
C++
fk/framework/Updatable.hpp
yotsuashi/franken
ddc2872b85e2a64ad5d6725bcef3a8659dd73556
[ "MIT" ]
null
null
null
fk/framework/Updatable.hpp
yotsuashi/franken
ddc2872b85e2a64ad5d6725bcef3a8659dd73556
[ "MIT" ]
null
null
null
fk/framework/Updatable.hpp
yotsuashi/franken
ddc2872b85e2a64ad5d6725bcef3a8659dd73556
[ "MIT" ]
null
null
null
/***********************************************************************//** @file ***************************************************************************/ #pragma once namespace fk { namespace framework { /***********************************************************************//** @brief ***************************************************************************/ class Updatable { public: Updatable() = default; virtual ~Updatable() = default; virtual void update(); protected: virtual void onUpdate() {} }; /***********************************************************************//** $Id$ ***************************************************************************/ } }
697
697
0.220947
yotsuashi
a75527152b9efa1fee5894a42ae8e1a671c203ea
4,037
cpp
C++
cell_based/src/cell/cycle/CellCycleTimesGenerator.cpp
DGermano8/ChasteDom
539a3a811698214c0938489b0cfdffd1abccf667
[ "Apache-2.0", "BSD-3-Clause" ]
null
null
null
cell_based/src/cell/cycle/CellCycleTimesGenerator.cpp
DGermano8/ChasteDom
539a3a811698214c0938489b0cfdffd1abccf667
[ "Apache-2.0", "BSD-3-Clause" ]
null
null
null
cell_based/src/cell/cycle/CellCycleTimesGenerator.cpp
DGermano8/ChasteDom
539a3a811698214c0938489b0cfdffd1abccf667
[ "Apache-2.0", "BSD-3-Clause" ]
null
null
null
/* Copyright (c) 2005-2018, 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 "Exception.hpp" #include "CellCycleTimesGenerator.hpp" CellCycleTimesGenerator* CellCycleTimesGenerator::mpInstance = NULL; CellCycleTimesGenerator::CellCycleTimesGenerator() : mRandomSeed(0u), mCurrentIndex(0u), mRate(1.0/2.0), mVectorCreated(false) { assert(mpInstance == NULL); // Ensure correct serialization } CellCycleTimesGenerator* CellCycleTimesGenerator::Instance() { if (mpInstance == NULL) { mpInstance = new CellCycleTimesGenerator(); } return mpInstance; } void CellCycleTimesGenerator::Destroy() { if (mpInstance) { delete mpInstance; mpInstance = NULL; } } void CellCycleTimesGenerator::SetRandomSeed(unsigned randomSeed) { mRandomSeed = randomSeed; } unsigned CellCycleTimesGenerator::GetRandomSeed() { return mRandomSeed; } void CellCycleTimesGenerator::GenerateCellCycleTimeSequence() { if (mVectorCreated) { EXCEPTION("Trying to generate the cell cycle times twice. Need to call CellCycleTimesGenerator::Destroy() first."); } else { unsigned number_stored_times = 15000u; mCellCycleTimes.reserve(number_stored_times); RandomNumberGenerator* p_random_number_generator = RandomNumberGenerator::Instance(); p_random_number_generator->Reseed(mRandomSeed); for (unsigned index = 0; index < 15000u; index++) { mCellCycleTimes.push_back( p_random_number_generator->ExponentialRandomDeviate(mRate) ); } mCurrentIndex = 0; mVectorCreated = true; } } void CellCycleTimesGenerator::SetRate(double rate) { if( mVectorCreated) { EXCEPTION("You cannot reset the rate after cell cycle times are created."); } else { mRate = rate; } } double CellCycleTimesGenerator::GetRate() { return mRate; } double CellCycleTimesGenerator::GetNextCellCycleTime() { if(!mVectorCreated) { EXCEPTION("When using FixedSequenceCellCycleModel one must call CellCycleTimesGenerator::Instance()->GenerateCellCycleTimeSequence()" " before the start of the simulation."); } else { double new_cell_cycle_time = mCellCycleTimes[mCurrentIndex]; mCurrentIndex += 1u; return new_cell_cycle_time; } }
30.126866
141
0.735199
DGermano8
a755a172ea90e8de918f5c0b0abbeb0ccc2395f9
1,812
cpp
C++
Modules/IGT/TrackingDevices/mitkUnspecifiedTrackingTypeInformation.cpp
zhaomengxiao/MITK
a09fd849a4328276806008bfa92487f83a9e2437
[ "BSD-3-Clause" ]
1
2022-03-03T12:03:32.000Z
2022-03-03T12:03:32.000Z
Modules/IGT/TrackingDevices/mitkUnspecifiedTrackingTypeInformation.cpp
zhaomengxiao/MITK
a09fd849a4328276806008bfa92487f83a9e2437
[ "BSD-3-Clause" ]
1
2021-12-22T10:19:02.000Z
2021-12-22T10:19:02.000Z
Modules/IGT/TrackingDevices/mitkUnspecifiedTrackingTypeInformation.cpp
zhaomengxiao/MITK_lancet
a09fd849a4328276806008bfa92487f83a9e2437
[ "BSD-3-Clause" ]
1
2020-11-27T09:41:18.000Z
2020-11-27T09:41:18.000Z
/*============================================================================ The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center (DKFZ) All rights reserved. Use of this source code is governed by a 3-clause BSD license that can be found in the LICENSE file. ============================================================================*/ #include "mitkUnspecifiedTrackingTypeInformation.h" #include "mitkIGTHardwareException.h" namespace mitk { std::string UnspecifiedTrackingTypeInformation::GetTrackingDeviceName() { return "Tracking System Not Specified"; } TrackingDeviceData UnspecifiedTrackingTypeInformation::GetDeviceDataUnspecified() { TrackingDeviceData data = { UnspecifiedTrackingTypeInformation::GetTrackingDeviceName(), "Unspecified System", "cube", "X" }; return data; } // Careful when changing the "invalid" device: The mitkTrackingTypeTest is using it's data. TrackingDeviceData UnspecifiedTrackingTypeInformation::GetDeviceDataInvalid() { TrackingDeviceData data = { UnspecifiedTrackingTypeInformation::GetTrackingDeviceName(), "Invalid Tracking System", "", "X" }; return data; } UnspecifiedTrackingTypeInformation::UnspecifiedTrackingTypeInformation() { m_DeviceName = UnspecifiedTrackingTypeInformation::GetTrackingDeviceName(); m_TrackingDeviceData.push_back(GetDeviceDataUnspecified()); m_TrackingDeviceData.push_back(GetDeviceDataInvalid()); } UnspecifiedTrackingTypeInformation::~UnspecifiedTrackingTypeInformation() { } mitk::TrackingDeviceSource::Pointer UnspecifiedTrackingTypeInformation::CreateTrackingDeviceSource( mitk::TrackingDevice::Pointer, mitk::NavigationToolStorage::Pointer, std::string*, std::vector<int>*) { return nullptr; } }
32.357143
130
0.710265
zhaomengxiao
a75719d75324f1dfad3493849f2fde60fe5deef4
502
hpp
C++
Helena/Util/Sleep.hpp
NIKEA-SOFT/HelenaFramework
4f443710e6a67242ddd4361f9c1a89e9d757c820
[ "MIT" ]
24
2020-08-17T21:49:38.000Z
2022-03-31T13:31:46.000Z
Helena/Util/Sleep.hpp
NIKEA-SOFT/HelenaFramework
4f443710e6a67242ddd4361f9c1a89e9d757c820
[ "MIT" ]
null
null
null
Helena/Util/Sleep.hpp
NIKEA-SOFT/HelenaFramework
4f443710e6a67242ddd4361f9c1a89e9d757c820
[ "MIT" ]
2
2021-04-21T09:27:03.000Z
2021-08-20T09:44:53.000Z
#ifndef HELENA_UTIL_SLEEP_HPP #define HELENA_UTIL_SLEEP_HPP #include <cstdint> #include <chrono> #include <thread> namespace Helena::Util { inline void Sleep(const std::uint64_t milliseconds) { std::this_thread::sleep_for(std::chrono::milliseconds(milliseconds)); } template <typename Rep, typename Period> void Sleep(const std::chrono::duration<Rep, Period>& time) { std::this_thread::sleep_for(time); } } #endif // HELENA_CORE_UTIL_SLEEP_HPP
25.1
78
0.691235
NIKEA-SOFT
a7590b2f07b5bd576a96cb6468c5749a219b0b1b
7,595
hpp
C++
Ponce/include_IDA6.8/auto.hpp
fcccode/Ponce
fc25268592027af0c71c898f87a347418c5ad475
[ "BSL-1.0" ]
1
2019-12-30T00:19:08.000Z
2019-12-30T00:19:08.000Z
Ponce/include_IDA6.8/auto.hpp
ZhuHuiBeiShaDiao/Ponce
fc25268592027af0c71c898f87a347418c5ad475
[ "BSL-1.0" ]
null
null
null
Ponce/include_IDA6.8/auto.hpp
ZhuHuiBeiShaDiao/Ponce
fc25268592027af0c71c898f87a347418c5ad475
[ "BSL-1.0" ]
null
null
null
/* * Interactive disassembler (IDA). * Copyright (c) 1990-2015 Hex-Rays * ALL RIGHTS RESERVED. * */ #ifndef _AUTO_HPP #define _AUTO_HPP #include <ida.hpp> #pragma pack(push, 1) /*! \file auto.hpp \brief Functions that work with the autoanalyzer queue. The autoanalyzer works when IDA is not busy processing the user keystrokes. It has several queues, each queue having its own priority. The analyzer stops when all queues are empty. A queue contains addresses or address ranges. The addresses are kept sorted by their values. The analyzer will process all addresses from the first queue, then switch to the second queue and so on. There are no limitations on the size of the queues. This file also contains functions that deal with the IDA status indicator and the autoanalysis indicator. You may use these functions to change the indicator value. */ typedef int atype_t; ///< identifies an autoanalysis queue - see \ref AU_ /// \defgroup AU_ Autoanalysis queues /// Names and priorities of the analyzer queues //@{ const atype_t AU_NONE = 00, ///< placeholder, not used AU_UNK = 10, ///< 0: convert to unexplored AU_CODE = 20, ///< 1: convert to instruction AU_WEAK = 25, ///< 2: convert to instruction (ida decision) AU_PROC = 30, ///< 3: convert to procedure start AU_TAIL = 35, ///< 4: add a procedure tail AU_TRSP = 38, ///< 5: trace stack pointer (not used yet) AU_USED = 40, ///< 6: reanalyze AU_TYPE = 50, ///< 7: apply type information AU_LIBF = 60, ///< 8: apply signature to address AU_LBF2 = 70, ///< 9: the same, second pass AU_LBF3 = 80, ///< 10: the same, third pass AU_CHLB = 90, ///< 11: load signature file (file name is kept separately) AU_FINAL=200; ///< 12: final pass //@} typedef int idastate_t; ///< IDA status indicator - see \ref st_ /// \defgroup st_ Status indicator states //@{ const idastate_t // meaning st_Ready = 0, ///< READY: IDA is doing nothing st_Think = 1, ///< THINKING: Autoanalysis on, the user may press keys st_Waiting= 2, ///< WAITING: Waiting for the user input st_Work = 3; ///< BUSY: IDA is busy //@} /// Enable/disable autoanalyzer. If not set, autoanalyzer will not work. idaman int ida_export_data autoEnabled; /// Current state of autoanalyzer. /// If auto_state == ::AU_NONE, IDA is currently not running the analysis /// (it could be temporarily interrupted to perform the user's requests, for example). idaman atype_t ida_export_data auto_state; /// See ::auto_display struct auto_display_t { atype_t type; ea_t ea; idastate_t state; }; /// Structure to hold the autoanalysis indicator contents idaman auto_display_t ida_export_data auto_display; /// Change autoanalysis indicator value. /// \param ea linear address being analyzed /// \param type autoanalysis type (see \ref AU_) inline void showAuto(ea_t ea, atype_t type=AU_NONE) { auto_display.type = type; auto_display.ea = ea; } /// Show an address on the autoanalysis indicator. /// The address is displayed in the form " @:12345678". /// \param ea - linear address to display inline void showAddr(ea_t ea) { showAuto(ea); } /// Change IDA status indicator value /// \param st - new indicator status /// \return old indicator status inline idastate_t setStat(idastate_t st) { idastate_t old = auto_display.state; auto_display.state = st; return old; } /// Is it allowed to create stack variables automatically?. /// This function should be used by IDP modules before creating stack vars. inline bool may_create_stkvars(void) { return should_create_stkvars() && auto_state == AU_USED; } /// Is it allowed to trace stack pointer automatically?. /// This function should be used by IDP modules before tracing sp. inline bool may_trace_sp(void) { return should_trace_sp() && (auto_state == AU_USED || auto_state == AU_TRSP); } /// Put range of addresses into a queue. /// 'start' may be higher than 'end', the kernel will swap them in this case. /// 'end' doesn't belong to the range. idaman void ida_export auto_mark_range(ea_t start,ea_t end,atype_t type); /// Put single address into a queue. Queues keep addresses sorted. inline void autoMark(ea_t ea, atype_t type) { if ( ea != BADADDR ) auto_mark_range(ea, ea+1, type); } /// Remove range of addresses from a queue. /// 'start' may be higher than 'end', the kernel will swap them in this case. /// 'end' doesn't belong to the range. idaman void ida_export autoUnmark(ea_t start,ea_t end,atype_t type); // Convenience functions /// Plan to perform reanalysis inline void noUsed(ea_t ea) { autoMark(ea,AU_USED); } /// Plan to perform reanalysis inline void noUsed(ea_t sEA,ea_t eEA) { auto_mark_range(sEA,eEA,AU_USED); } /// Plan to make code inline void auto_make_code(ea_t ea) { autoMark(ea,AU_CODE); } /// Plan to make code&function inline void auto_make_proc(ea_t ea) { auto_make_code(ea); autoMark(ea,AU_PROC); } /// Plan to reanalyze callers of the specified address. /// This function will add to ::AU_USED queue all instructions that /// call (not jump to) the specified address. /// \param ea linear address of callee /// \param noret !=0: the callee doesn't return, mark to undefine subsequent /// instructions in the caller. 0: do nothing. idaman void ida_export reanalyze_callers(ea_t ea, bool noret); /// Delete all analysis info that IDA generated for for the given range idaman void ida_export revert_ida_decisions(ea_t ea1, ea_t ea2); /// Plan to apply the callee's type to the calling point idaman void ida_export auto_apply_type(ea_t caller, ea_t callee); /// Analyze the specified area. /// Try to create instructions where possible. /// Make the final pass over the specified area. /// This function doesn't return until the area is analyzed. /// \retval 1 ok /// \retval 0 Ctrl-Break was pressed idaman int ida_export analyze_area(ea_t sEA,ea_t eEA); /// Process everything in the queues and return true. /// Return false if Ctrl-Break was pressed. idaman bool ida_export autoWait(void); /// Remove an address range (ea1..ea2) from queues ::AU_CODE, ::AU_PROC, ::AU_USED. /// To remove an address range from other queues use autoUnmark() function. /// 'ea1' may be higher than 'ea2', the kernel will swap them in this case. /// 'ea2' doesn't belong to the range. idaman void ida_export autoCancel(ea_t ea1,ea_t ea2); /// Are all queues empty? /// (i.e. has autoanalysis finished?). idaman bool ida_export autoIsOk(void); /// One step of autoanalyzer if 'autoEnabled' != 0. /// \return true if some address was removed from queues and was processed. idaman bool ida_export autoStep(void); /// Peek into a queue 'type' for an address not lower than 'low_ea'. /// Do not remove address from the queue. /// \return the address or #BADADDR idaman ea_t ida_export peek_auto_queue(ea_t low_ea, atype_t type); /// Retrieve an address from queues regarding their priority. /// Returns #BADADDR if no addresses not lower than 'lowEA' and less than /// 'highEA' are found in the queues. /// Otherwise *type will have queue type. idaman ea_t ida_export auto_get(ea_t lowEA, ea_t highEA, atype_t *type); /// Get two-character queue name to display on the indicator idaman const char *ida_export autoGetName(atype_t type); #pragma pack(pop) #endif // _AUTO_HPP
29.784314
88
0.695984
fcccode
a759ee205b2a15cfa075abf5f5e6bf9110ab555f
1,216
cpp
C++
cpp/src/lights/lighting.cpp
LawrenceRafferty/ray-tracer-challenge
f54dfd4eb717e44c9e313be4bd28f8fad00094d0
[ "MIT" ]
null
null
null
cpp/src/lights/lighting.cpp
LawrenceRafferty/ray-tracer-challenge
f54dfd4eb717e44c9e313be4bd28f8fad00094d0
[ "MIT" ]
null
null
null
cpp/src/lights/lighting.cpp
LawrenceRafferty/ray-tracer-challenge
f54dfd4eb717e44c9e313be4bd28f8fad00094d0
[ "MIT" ]
null
null
null
#pragma once #include "./lighting.h" #include <cmath> using data_structures::color; using data_structures::four_tuple; using shapes::shape; namespace lights { color lighting( const shape & shape, const point_light & light, const four_tuple & point, const four_tuple & eyev, const four_tuple & normalv, bool isShadowed) { auto effectiveColor = shape.getColorAtPoint(point) * light.getIntensity(); auto material = shape.getMaterial(); color ambient = effectiveColor * material.getAmbient(); if (isShadowed) return ambient; color diffuse; color specular; auto lightv = (light.getPosition() - point).getNormalized(); auto lightDotNormal = lightv.dot(normalv); if (lightDotNormal < 0) { diffuse = color(0, 0, 0); specular = color(0, 0, 0); } else { diffuse = effectiveColor * material.getDiffuse() * lightDotNormal; auto reflectv = (-lightv).getReflected(normalv); auto reflectDotEye = reflectv.dot(eyev); if (reflectDotEye <= 0) { specular = color(0, 0, 0); } else { float factor = pow(reflectDotEye, material.getShininess()); specular = light.getIntensity() * material.getSpecular() * factor; } } return ambient + diffuse + specular; } } // namespace lights
21.714286
75
0.705592
LawrenceRafferty
a75a5fccf9404e5f36b8769a9f3cee958130680b
2,873
cpp
C++
src/lldb/Bindings/SBLineEntryBinding.cpp
danielzfranklin/lldb-sys.rs
47c1673d131d4911b3cfdc8e6b2c7a300707314e
[ "Apache-2.0", "MIT" ]
null
null
null
src/lldb/Bindings/SBLineEntryBinding.cpp
danielzfranklin/lldb-sys.rs
47c1673d131d4911b3cfdc8e6b2c7a300707314e
[ "Apache-2.0", "MIT" ]
null
null
null
src/lldb/Bindings/SBLineEntryBinding.cpp
danielzfranklin/lldb-sys.rs
47c1673d131d4911b3cfdc8e6b2c7a300707314e
[ "Apache-2.0", "MIT" ]
null
null
null
//===-- SBLineEntryBinding.cpp ----------------------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// #include "lldb/Bindings/LLDBBinding.h" #include "lldb/API/LLDB.h" using namespace lldb; #ifdef __cplusplus extern "C" { #endif SBLineEntryRef CreateSBLineEntry() { return reinterpret_cast<SBLineEntryRef>(new SBLineEntry()); } SBLineEntryRef CloneSBLineEntry(SBLineEntryRef instance) { return reinterpret_cast<SBLineEntryRef>(new SBLineEntry(*reinterpret_cast<SBLineEntry *>(instance))); } void DisposeSBLineEntry(SBLineEntryRef instance) { delete reinterpret_cast<SBLineEntry *>(instance); } SBAddressRef SBLineEntryGetStartAddress(SBLineEntryRef instance) { SBLineEntry *unwrapped = reinterpret_cast<SBLineEntry *>(instance); return reinterpret_cast<SBAddressRef>(new SBAddress(unwrapped->GetStartAddress())); } SBAddressRef SBLineEntryGetEndAddress(SBLineEntryRef instance) { SBLineEntry *unwrapped = reinterpret_cast<SBLineEntry *>(instance); return reinterpret_cast<SBAddressRef>(new SBAddress(unwrapped->GetEndAddress())); } bool SBLineEntryIsValid(SBLineEntryRef instance) { SBLineEntry *unwrapped = reinterpret_cast<SBLineEntry *>(instance); return unwrapped->IsValid(); } SBFileSpecRef SBLineEntryGetFileSpec(SBLineEntryRef instance) { SBLineEntry *unwrapped = reinterpret_cast<SBLineEntry *>(instance); return reinterpret_cast<SBFileSpecRef>(new SBFileSpec(unwrapped->GetFileSpec())); } unsigned int SBLineEntryGetLine(SBLineEntryRef instance) { SBLineEntry *unwrapped = reinterpret_cast<SBLineEntry *>(instance); return unwrapped->GetLine(); } unsigned int SBLineEntryGetColumn(SBLineEntryRef instance) { SBLineEntry *unwrapped = reinterpret_cast<SBLineEntry *>(instance); return unwrapped->GetColumn(); } void SBLineEntrySetFileSpec(SBLineEntryRef instance, SBFileSpecRef filespec) { SBLineEntry *unwrapped = reinterpret_cast<SBLineEntry *>(instance); unwrapped->SetFileSpec(*reinterpret_cast<SBFileSpec *>(filespec)); } void SBLineEntrySetLine(SBLineEntryRef instance, uint32_t line) { SBLineEntry *unwrapped = reinterpret_cast<SBLineEntry *>(instance); unwrapped->SetLine(line); } void SBLineEntrySetColumn(SBLineEntryRef instance, uint32_t column) { SBLineEntry *unwrapped = reinterpret_cast<SBLineEntry *>(instance); unwrapped->SetColumn(column); } bool SBLineEntryGetDescription(SBLineEntryRef instance, SBStreamRef description) { SBLineEntry *unwrapped = reinterpret_cast<SBLineEntry *>(instance); return unwrapped->GetDescription(*reinterpret_cast<SBStream *>(description)); } #ifdef __cplusplus } #endif
26.118182
105
0.740341
danielzfranklin