blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 3 264 | content_id stringlengths 40 40 | detected_licenses listlengths 0 85 | license_type stringclasses 2
values | repo_name stringlengths 5 140 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringclasses 986
values | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 3.89k 681M ⌀ | star_events_count int64 0 209k | fork_events_count int64 0 110k | gha_license_id stringclasses 23
values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 145
values | src_encoding stringclasses 34
values | language stringclasses 1
value | is_vendor bool 1
class | is_generated bool 2
classes | length_bytes int64 3 10.4M | extension stringclasses 122
values | content stringlengths 3 10.4M | authors listlengths 1 1 | author_id stringlengths 0 158 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
2c2c06b8206159499c576d585b7ffd1fcd635df8 | 0f8594c7fadedb0c9f1e447d3d19a2f3276b4975 | /Client/Classes/Net/pk_pet.h | af8ee26ea16f75a5407ba8a450d10106e58029f9 | [] | no_license | SmallRaindrop/LocatorApp | 37c427dd1e4cb7376cd5688ab7921b9f1490ac45 | 8212b1ec32b964e61e886bbbea8d26392e2b25d8 | refs/heads/master | 2021-01-09T22:49:02.586485 | 2015-10-14T04:55:44 | 2015-10-14T04:55:44 | 42,594,771 | 1 | 2 | null | 2015-09-16T15:19:42 | 2015-09-16T15:08:22 | null | UTF-8 | C++ | false | false | 2,546 | h |
#pragma once
#include <vector>
#include "NetMsg.h"
class IOSocket;
using namespace std;
namespace pk{
struct GS2C_PET_EXP_UPDATE
{
int32 exp;
};
void WriteGS2C_PET_EXP_UPDATE(stNetMsg& msg,GS2C_PET_EXP_UPDATE& value);
bool OnGS2C_PET_EXP_UPDATE(GS2C_PET_EXP_UPDATE* value);
void ReadGS2C_PET_EXP_UPDATE(stNetMsg& msg,GS2C_PET_EXP_UPDATE& value);
struct C2GS_CALL_PET_Req
{
int64 id;
void Send(IOSocket* pIOSock);
};
void WriteC2GS_CALL_PET_Req(stNetMsg& msg,C2GS_CALL_PET_Req& value);
void ReadC2GS_CALL_PET_Req(stNetMsg& msg,C2GS_CALL_PET_Req& value);
struct GS2C_CALL_PET_Ret
{
int64 call_id;
int64 call_back_id;
};
void WriteGS2C_CALL_PET_Ret(stNetMsg& msg,GS2C_CALL_PET_Ret& value);
bool OnGS2C_CALL_PET_Ret(GS2C_CALL_PET_Ret* value);
void ReadGS2C_CALL_PET_Ret(stNetMsg& msg,GS2C_CALL_PET_Ret& value);
struct C2GS_CALL_BACK_PET_Req
{
int64 id;
void Send(IOSocket* pIOSock);
};
void WriteC2GS_CALL_BACK_PET_Req(stNetMsg& msg,C2GS_CALL_BACK_PET_Req& value);
void ReadC2GS_CALL_BACK_PET_Req(stNetMsg& msg,C2GS_CALL_BACK_PET_Req& value);
struct GS2C_CALL_BACK_PET_Ret
{
int64 id;
};
void WriteGS2C_CALL_BACK_PET_Ret(stNetMsg& msg,GS2C_CALL_BACK_PET_Ret& value);
bool OnGS2C_CALL_BACK_PET_Ret(GS2C_CALL_BACK_PET_Ret* value);
void ReadGS2C_CALL_BACK_PET_Ret(stNetMsg& msg,GS2C_CALL_BACK_PET_Ret& value);
struct GS2C_PET_MAP_UPDATE
{
int64 id;
int16 level;
int32 hp;
int32 mp;
int32 hp_max;
int32 mp_max;
};
void WriteGS2C_PET_MAP_UPDATE(stNetMsg& msg,GS2C_PET_MAP_UPDATE& value);
bool OnGS2C_PET_MAP_UPDATE(GS2C_PET_MAP_UPDATE* value);
void ReadGS2C_PET_MAP_UPDATE(stNetMsg& msg,GS2C_PET_MAP_UPDATE& value);
struct C2GS_PET_STRENG_Req
{
int64 id;
void Send(IOSocket* pIOSock);
};
void WriteC2GS_PET_STRENG_Req(stNetMsg& msg,C2GS_PET_STRENG_Req& value);
void ReadC2GS_PET_STRENG_Req(stNetMsg& msg,C2GS_PET_STRENG_Req& value);
struct GS2C_PET_STRENG_Ret
{
int8 retCode;
};
void WriteGS2C_PET_STRENG_Ret(stNetMsg& msg,GS2C_PET_STRENG_Ret& value);
bool OnGS2C_PET_STRENG_Ret(GS2C_PET_STRENG_Ret* value);
void ReadGS2C_PET_STRENG_Ret(stNetMsg& msg,GS2C_PET_STRENG_Ret& value);
struct C2GS_PET_FEED_Req
{
void Send(IOSocket* pIOSock);
};
void WriteC2GS_PET_FEED_Req(stNetMsg& msg,C2GS_PET_FEED_Req& value);
void ReadC2GS_PET_FEED_Req(stNetMsg& msg,C2GS_PET_FEED_Req& value);
struct GS2C_PET_FEED_Ret
{
int8 retCode;
};
void WriteGS2C_PET_FEED_Ret(stNetMsg& msg,GS2C_PET_FEED_Ret& value);
bool OnGS2C_PET_FEED_Ret(GS2C_PET_FEED_Ret* value);
void ReadGS2C_PET_FEED_Ret(stNetMsg& msg,GS2C_PET_FEED_Ret& value);
};
| [
"191511706@qq.com"
] | 191511706@qq.com |
4f75b1941d12f169867ebf66022e77417e768239 | 7c9136d87b8895ac6532ef2af58edf3ecc29d175 | /OrderNumDlg.cpp | 2d44edac61270708887e995b11b7ed059f933ea4 | [] | no_license | khhubb/csda-new-ssb | 038d75858cba1e029f4f1315d6ebba95e5d9fb91 | 96eaf896ba6c91914f69671171f5488cf0fb5d3f | refs/heads/master | 2020-07-01T03:36:45.777439 | 2016-08-17T22:00:09 | 2016-08-17T22:00:09 | 74,102,071 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,202 | cpp | // OrderNumDlg.cpp : implementation file
//
#include "stdafx.h"
#include "csda.h"
#include "OrderNumDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
#include "Snapshot.h"
#include "SpecMgr.h"
/////////////////////////////////////////////////////////////////////////////
// COrderNumDlg dialog
//
// Okay, this is a case of sheer laziness.
// Originally, designed to allow the user to enter a mill order# and verify
// that it exists.
// Later extended to allow the user to enter a spec# and verify that it exists.
//
// Usage: (order#)
//
// COrderNumDlg dlg;
//
// dlg.m_type = COrderNumDlg::TYPE_ORDER_NUM;
// dlg.m_caption = "Please enter MILL_ORDER_NUM for new order:";
//
// if ( dlg.DoModal() == IDOK ) {
// // dlg.m_pOrder has a pointer to the selected COrder
// }
//
//
// Usage: (spec)
//
// COrderNumDlg dlg;
//
// dlg.m_type = COrderNumDlg::TYPE_LOT_SPEC;
// dlg.m_casterNum = m_casterNum;
// dlg.m_caption = "Please enter lot spec for new order:";
//
// if ( dlg.DoModal() == IDOK ) {
// // dlg.m_spec has the spec# (a string)
// }
//
///////////////////////////////////////////////////////////////////////////////
COrderNumDlg::COrderNumDlg(CWnd* pParent /*=NULL*/)
: CDialog(COrderNumDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(COrderNumDlg)
m_orderNum = _T("");
m_caption = _T("");
//}}AFX_DATA_INIT
m_type = TYPE_UNSPECIFIED;
}
void COrderNumDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(COrderNumDlg)
DDX_Text(pDX, IDC_EDIT_ORDER_NUM, m_orderNum);
DDV_MaxChars(pDX, m_orderNum, 7);
DDX_Text(pDX, IDC_STATIC_ORDER_NUM, m_caption);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(COrderNumDlg, CDialog)
//{{AFX_MSG_MAP(COrderNumDlg)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// COrderNumDlg message handlers
void COrderNumDlg::OnOK()
{
UpdateData(TRUE);
switch ( m_type ) {
case TYPE_ORDER_NUM:
{
vector<COrder*>& orders = TheSnapshot.Orders();
// FP change
//long orderNum = atol(m_orderNum);
m_pOrder = COrder::FindOrder(m_orderNum,orders);
if ( m_pOrder == 0 ) {
MessageBox("No such order.");
return;
}
}
break;
case TYPE_LOT_SPEC:
CSpec* pSpec = TheSnapshot.SpecMgr().FindSpecMaybe(m_orderNum,
m_casterNum);
if ( pSpec == 0 ) {
MessageBox("No such spec.");
return;
}
m_spec = m_orderNum;
break;
}
CDialog::OnOK();
}
BOOL COrderNumDlg::OnInitDialog()
{
CDialog::OnInitDialog();
assert ( m_type != TYPE_UNSPECIFIED );
assert ( m_type != TYPE_LOT_SPEC
||
( 1 <= m_casterNum && m_casterNum <= 3 ));
m_pOrder = 0;
m_spec = "";
switch ( m_type ) {
case TYPE_ORDER_NUM:
SetWindowText("Enter order number");
break;
case TYPE_LOT_SPEC:
SetWindowText("Enter spec");
break;
}
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
| [
"dmiller2718@gmail.com"
] | dmiller2718@gmail.com |
9abbeb98c7239777a53913ef51d4d194397a7f79 | 1c9d2c8488dd76250e39e6875429edbbf24de784 | /groups/bsl/bsls/bsls_deprecate.h | 4f4ac89197aafbdb74ecd65ca93e169c0d05b9f5 | [
"Apache-2.0"
] | permissive | villevoutilainen/bde | 9cc68889c1fac9beca068c9ca732c36fd81b33e9 | b0f71ac6e3187ce752d2e8906c4562e3ec48b398 | refs/heads/master | 2020-05-15T03:43:36.725050 | 2019-10-03T12:28:54 | 2019-10-03T12:28:54 | 182,071,409 | 1 | 1 | Apache-2.0 | 2019-10-03T12:28:55 | 2019-04-18T10:59:27 | C++ | UTF-8 | C++ | false | false | 35,210 | h | // bsls_deprecate.h -*-C++-*-
#ifndef INCLUDED_BSLS_DEPRECATE
#define INCLUDED_BSLS_DEPRECATE
//@PURPOSE: Provide machinery to deprecate interfaces on a per-version basis.
//
//@MACROS:
// BSLS_DEPRECATE: tag an interface as deprecated
// BSLS_DEPRECATE_IS_ACTIVE: conditionally activate deprecation by UOR version
// BSLS_DEPRECATE_MAKE_VER: render UOR version for deprecation threshold
//
//@DESCRIPTION: This component defines a suite of macros to control (on a
// per-version, per-UOR basis) the deprecation of functions, user-defined
// types, and 'typedef's, and the conditional compilation of enumerators and
// preprocessor macros. The 'bsls_deprecate' facility operates by triggering
// compiler warnings when types or interfaces are used that have been tagged
// with deprecation macros defined by this component. Unlike previous
// deprecation facilities based exclusively on the use of '#ifndef' with global
// macros (such as 'BDE_OMIT_DEPRECATED' and 'BDE_OMIT_INTERNAL_DEPRECATED'),
// supported use of the 'bsls_deprecate' facility does *not* affect a UOR's
// ABI. It is therefore safe to link applications based on libraries built
// with different deprecation policies.
//
///Overview: Common Uses
///---------------------
//
///Applying a Deprecation Tag to an Interface
/// - - - - - - - - - - - - - - - - - - - - -
// UOR owners who wish to mark an interface as deprecated can do so by tagging
// the declaration of that interface with the 'BSLS_DEPRECATE' macro, wrapped
// in a '#if' block to apply 'BSLS_DEPRECATE' only when
// 'BSLS_DEPRECATE_IS_ACTIVE(UOR, M, N)' evaluates to true for a given version
// 'M.N' of the specified 'UOR':
//..
// #if BSLS_DEPRECATE_IS_ACTIVE(BDE, 3, 2)
// BSLS_DEPRECATE
// #endif
// int foo(const char *bar);
// // !DEPRECATED!: Use 'newFoo' instead.
//..
// The above application of 'BSLS_DEPRECATE_IS_ACTIVE' indicates that 'foo' is
// deprecated starting with 'bde' version 3.2. Once the deprecation threshold
// for 'bde' advances to version 3.2, code calling 'foo' will generate a
// deprecation warning with compilers that support deprecation attributes.
// (See {Version Control Macros for Library Authors} for information on
// defining a deprecation threshold for a UOR.) Note that in the absence of an
// explicit deprecation threshold ('BDE_VERSION_DEPRECATION_THRESHOLD', in this
// case), code calling 'foo' would begin generating deprecation warnings in the
// very next minor or major release of 'bde' (3.3 or 4.0, whichever applies).
//
// If an interface has several entities being deprecated at the same time,
// clients can define a new deprecation macro within that header to avoid
// repeated use of 'BSLS_DEPRECATE_IS_ACTIVE':
//..
// // bdexyz_component.h -*-C++-*-
//
// #if BSLS_DEPRECATE_IS_ACTIVE(BDE, 3, 2)
// #define BDEXYZ_COMPONENT_DEPRECATED_3_2 BSLS_DEPRECATE
// #else
// #define BDEXYZ_COMPONENT_DEPRECATED_3_2
// #endif
//
// // ...
//
// BDEXYZ_COMPONENT_DEPRECATED_3_2
// int foo();
//
// BDEXYZ_COMPONENT_DEPRECATED_3_2
// int bar();
//
// // ...
//
// #undef BDEXYZ_COMPONENT_DEPRECATED_3_2
//..
//
///Keeping Your Code Free of Calls to Deprecated Interfaces
/// - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// When an interface is tagged with 'BSLS_DEPRECATE' as shown above, the
// deprecation is initially _not_ _enforced_ by default. That is, a normal
// build of code calling the deprecated interface will not emit a deprecation
// warning.
//
// Downstream developers who wish to make sure that their code uses no
// deprecated interfaces can do so by defining the symbol
// 'BB_WARN_ALL_DEPRECATIONS_FOR_TESTING_ONLY' in their build system.
//..
// $ CXXFLAGS=-DBB_WARN_ALL_DEPRECATIONS_FOR_TESTING_ONLY make my_application
// # A compiler that supports 'BSLS_DEPRECATE' will emit a warning if any
// # deprecated interfaces are used in 'my_application', even if those
// # deprecations are scheduled to take effect in a future release.
//..
// *NEVER* define 'BB_WARN_ALL_DEPRECATIONS_FOR_TESTING_ONLY' in a
// *PRODUCTION* *BUILD* *CONFIGURATION*. If you do so, all libraries that you
// depend on will be prevented from deprecating more code in future versions.
//
///Preventing New Uses of Already-Deprecated Interfaces
/// - - - - - - - - - - - - - - - - - - - - - - - - - -
// At some point after an interface has been tagged with 'BSLS_DEPRECATE', the
// library owner can make new uses of that interface generate warnings by
// defining a deprecation threshold for the UOR that contains the deprecated
// interface (or by adjusting the deprecation threshold for the UOR if it
// already exists). Defining a deprecation threshold _enforces_ deprecations
// made in all versions up to and including the threshold. If the version
// number of the deprecation threshold is greater than or equal to the version
// number specified in the 'BSLS_DEPRECATE_IS_ACTIVE(UOR, M, N)' macro, then
// the 'BSLS_DEPRECATE' macro will be enabled and generate a warning.
//
// This is the recommended way to define a deprecation threshold (see {Version
// Control Macros for Library Authors}):
//..
// // bdescm_versiontag.h
//
// // ...
//
// #define BDE_VERSION_DEPRECATION_THRESHOLD BSLS_DEPRECATE_MAKE_VER(3, 2)
//
// // All 'bde' deprecations tied to release 3.2 or earlier will trigger
// // compiler warnings.
//..
//
///Background
///----------
// Prior to the availability of this component, when a developer wanted to
// deprecate an API they might either apply an attribute to the API that would
// generate a warning, or they would use '#ifdef' to remove deprecated code
// when it is built with appropriate options. These solutions have a practical
// shortcoming in a production environment like Bloomberg's, where code changes
// in lower-level libraries cannot be checked in if they break the build of
// (higher-level) client libraries. In such a system, well-meaning clients
// might build their libraries using '-Werror' (to turn compilation warnings
// into errors) or with appropriate '#ifdef's to ensure their code does not use
// deprecated APIs, but in so doing they hinder the introduction of any new
// deprecations. In addition, the use of '#ifdef' results in ABI compatibility
// issues, as some clients may build with deprecated code removed, and others
// may not.
//
// This deprecation facility is based around two concepts that attempt to
// address these shortcomings:
//
//: 1 This facility is designed to provide ABI compatibility.
//: 'BSLS_DEPRECATE_*' macros are used to trigger *compilation* *warnings*
//: on platforms that support deprecation attributes, instead of *removing*
//: *code* from the codebase.
//:
//: 2 Typically, use of this facility will not immediately generate a warning
//: in client code. The use of the 'BSLS_DEPRECATE' macro is generally
//: guarded by a version check using 'BSLS_DEPRECATE_IS_ACTIVE'. In an
//: environment where compiler warnings are considered to be build failures,
//: it is possible (and encouraged) to tag a C++ entity with a deprecation
//: macro in one release cycle, and not have that deprecation affect any
//: clients by default until a later release cycle. During the intervening
//: period, clients have an opportunity to proactively check their code for
//: uses of newly-deprecated code.
//
// Notice that the cost for maintaining ABI compatibility is that clients
// cannot check whether they are using deprecated interfaces unless they build
// their software on certain platforms with warnings activated. For this
// facility to be effective across an enterprise, it is required that such
// warning-enabled builds be part of the standard process for checking in code
// in the enterprise.
//
///Mechanics
///---------
// This component stipulates two sets of macros. One set of deprecation
// macros, defined in this component, are used to identify a C++ entity as
// being deprecated in a given version of a given UOR. A second set of control
// macros, defined by clients of this component, dictates which deprecation
// macros are enforced at any point in the code during compilation.
//
///Deprecation Macros
/// - - - - - - - - -
//: 'BSLS_DEPRECATE':
//: Expands to a particular deprecation attribute with compilers that have
//: such support; otherwise, 'BSLS_DEPRECATE' expands to nothing.
//: 'BSLS_DEPRECATE' can be applied to 'class' or 'struct' definitions,
//: function declarations, and 'typedef's.
//:
//: 'BSLS_DEPRECATE_IS_ACTIVE(UOR, M, N)':
//: Expands to 1 if deprecations are enforced for the specified version 'M.N'
//: of the specified 'UOR', and to 0 otherwise.
//
// These two macros are intended to be placed together in a preprocessor '#if'
// block in front of a function, type, or 'typedef' declaration, with
// 'BSLS_DEPRECATE_IS_ACTIVE(UOR, M, N)' controlling whether or not
// 'BSLS_DEPRECATE' is applied to the declaration. The exact placement of the
// block should match the requirements of the C++14 '[[deprecated]]' attribute.
//
// Examples:
//..
// class
// #if BSLS_DEPRECATE_IS_ACTIVE(ABC, 1, 2)
// BSLS_DEPRECATE
// #endif
// SomeType {
// // ...
// };
//
// struct SomeUtil {
// #if BSLS_DEPRECATE_IS_ACTIVE(ABC, 1, 2)
// BSLS_DEPRECATE
// #endif
// static int someFunction();
// };
//
// #if BSLS_DEPRECATE_IS_ACTIVE(ABC, 1, 2)
// BSLS_DEPRECATE
// #endif
// typedef SupportedType DeprecatedType;
//..
// At present, the underlying compiler intrinsics represented by
// 'BSLS_DEPRECATE' cannot be applied uniformly to some C++ constructs, most
// notably variables, enumerators, and preprocessor macros. Fortunately, these
// constructs can often be removed from a library without otherwise affecting
// ABI, so '!BSLS_DEPRECATE_IS_ACTIVE(UOR, M, N)' can be used with a '#if'
// directive to entirely remove blocks of code containing those C++ constructs.
//
// Example:
//..
// #if !BSLS_DEPRECATE_IS_ACTIVE(ABC, 1, 2)
//
// #define MY_DEPRECATED_MACRO
// // Macro definitions can be removed with 'BSLS_DEPRECATE_IS_ACTIVE'.
//
// #endif // !BSLS_DEPRECATE_IS_ACTIVE(ABC, 1, 2)
//
// namespace grppkg {
//
// #if !BSLS_DEPRECATE_IS_ACTIVE(ABC, 1, 3)
//
// SomeType myDeprecatedGlobalVariable;
// // Variables at 'namespace' or global scope can be removed with
// // 'BSLS_DEPRECATE_IS_ACTIVE'.
//
// #endif // !BSLS_DEPRECATE_IS_ACTIVE(ABC, 1, 3)
//
// // ...
//
// } // close namespace 'grppkg'
//..
// Note the use of the '!' operator: deprecated code is compiled only if
// deprecations are *not* enforced for the specified UOR version.
//
// Particular care must be taken to ensure that deprecating one or more
// enumerators does not (inadvertently) change the values of other enumerators
// in the same 'enum':
//..
// enum MyEnum {
// e_FIRST,
// e_SECOND,
// e_THIRD,
// #if !BSLS_DEPRECATE_IS_ACTIVE(ABC, 1, 2)
// // These legacy enumerators can be deprecated because their removal
// // does not affect the values of any other enumerators.
//
// FIRST = e_FIRST,
// SECOND = e_SECOND,
// THIRD = e_THIRD
// #endif
// };
//..
//
///Version Control Macros for Library Authors
/// - - - - - - - - - - - - - - - - - - - - -
// A UOR-specific deprecation threshold can be (and typically *should* be)
// specified by the authors of a UOR to govern which of their deprecations are
// active by default:
//: '<UOR>_VERSION_DEPRECATION_THRESHOLD':
//: This macro should be defined in '<uor>scm_versiontag.h' alongside
//: '<UOR>_VERSION_MAJOR' and '<UOR>_VERSION_MINOR' to indicate the greatest
//: version of the unit of release 'UOR' for which deprecations are enforced
//: by default.
//
// Example:
//..
// // abcscm_versiontag.h
//
// #define ABC_VERSION_MAJOR 1
// #define ABC_VERSION_MINOR 4
//
// #define ABC_VERSION_DEPRECATION_THRESHOLD BSLS_DEPRECATE_MAKE_VER(1, 2)
//..
// In this example, 'BSLS_DEPRECATE_IS_ACTIVE(ABC, M, N)' will expand to 1 for
// all versions 'M.N' of 'ABC' up to and including version 1.2. For 'M.N'
// later than 1.2 (e.g., 1.3 or 2.0), 'BSLS_DEPRECATE_IS_ACTIVE(ABC, M, N)'
// will expand to 1 only if the 'BB_WARN_ALL_DEPRECATIONS_FOR_TESTING_ONLY'
// macro is defined by the user (see {Build Control Macros for Clients}).
//
// Note that if a deprecation threshold is *not* explicitly defined for a UOR
// that defines '<UOR>_VERSION_MAJOR' and '<UOR>_VERSION_MINOR', then
// 'BSLS_DEPRECATE_IS_ACTIVE(UOR, M, N)' will expand to 1 once the version
// indicated by '<UOR>_VERSION_MAJOR' and '<UOR>_VERSION_MINOR' becomes greater
// than 'M.N'. For example, 'BSLS_DEPRECATE_IS_ACTIVE(ABC, 1, 4)' will expand
// to 1 in version 1.5 of 'ABC' (or 2.0 if there is no release 1.5) if
// 'ABC_VERSION_DEPRECATION_THRESHOLD' is not defined. For this reason, it is
// highly recommended that UOR authors explicitly define a deprecation
// threshold to avoid unexpected build failures when a new release is issued,
// especially in environments where warnings are considered fatal.
//
// A second UOR-specific macro is available to the authors of a UOR that must,
// for whatever reason, continue to use interfaces that are deprecated in their
// own library:
//: 'BB_SILENCE_DEPRECATIONS_FOR_BUILDING_UOR_<UOR>':
//: This macro prevents 'bsls_deprecate' from enforcing deprecations for all
//: versions of 'UOR'. This macro must be defined in each '.cpp' file of
//: 'UOR' that either uses a deprecated interface from the *same* UOR that
//: has reached the deprecation threshold for 'UOR', or includes a header
//: file of 'UOR' that uses such an interface in inline code. This macro
//: must be defined before the first '#include' of a header from 'UOR'.
//
// Example:
//..
// // abcxyz_somecomponent.cpp
//
// #define BB_SILENCE_DEPRECATIONS_FOR_BUILDING_UOR_ABC
//
// #include <abcxyz_somecomponent.h>
//
// // ...
//..
//
///Build Control Macros for Clients
/// - - - - - - - - - - - - - - - -
// The following two macros are intended for client use during builds, either
// to *enable* *all* deprecations or to *suppress* *selected* deprecations:
//: 'BB_WARN_ALL_DEPRECATIONS_FOR_TESTING_ONLY':
//: This macro should be defined as a '-D' parameter during test builds of
//: components that are intended to be deprecation-clean. When this macro is
//: defined, deprecations will be enforced for all versions of all UORs,
//: except as overridden by 'BB_SILENCE_DEPRECATIONS_FOR_BUILDING_UOR_<UOR>'
//: (see {Version Control Macros for Library Authors} or
//: 'BB_SILENCE_DEPRECATIONS_<UOR>_<M>_<N>' (see below). This macro must
//: *never* appear in source code, and must *never* be defined for any
//: production or check-in build configuration.
//:
//: 'BB_SILENCE_DEPRECATIONS_<UOR>_<M>_<N>':
//: This macro should be defined by clients of 'UOR' who still need to use an
//: interface that was deprecated in version 'M.N' after the deprecation
//: threshold for 'UOR' has reached (or exceeded) 'M.N'. This macro should
//: be defined *before* the first '#include' of a header from 'UOR'. This
//: macro must *never* be defined in a header file.
//
// Example:
//..
// // grppkg_fooutil.cpp
//
// #define BB_SILENCE_DEPRECATIONS_ABC_1_2
// // 'BB_SILENCE_DEPRECATIONS_ABC_1_2' must be defined before the
// // component's own '#include' directive in case 'grppkg_fooutil.h'
// // includes headers from 'abc' (directly or transitively).
//
// #include <grppkg_fooutil.h>
//
// // Interfaces from 'abcxyz_someutil' deprecated in version 1.2 of 'abc'
// // will not trigger compiler warnings when used in 'grppkg_fooutil.cpp'.
//
// #include <abcxyz_someutil.h>
// ...
//
// namespace grppkg {
//
// void FooUtil::foo()
// {
// int result = abcxyz::SomeUtil::someFunction();
// // ...
// }
//
// } // close package namespace
//..
//
///Supporting Compilers
///--------------------
// 'BSLS_DEPRECATE' will produce a warning with the following compilers:
//: o gcc 4.3+
//: o clang 3.4+
//: o Xcode 4.4+
//: o Microsoft Visual Studio 2010 or later
//
// Additionally, 'BSLS_DEPRECATE' will produce a warning with any compiler that
// provides the C++14 'deprecated' attribute.
//
///Suggested Process for Deprecating Code (the Deprecation/Deletion Tango)
///-----------------------------------------------------------------------
// Deprecation is a negotiation process between code authors and code consumers
// to allow old code to be removed from the codebase. This component supports
// a deprecation model where code moves through four steps from being fully
// supported, to optionally deprecated, to fully deprecated, and finally to
// being deleted. At each step, responsibility for moving the process forward
// is passed back and forth between library authors and library users.
//
// When the owners of a library want to deprecate an interface, they start by
// adding appropriate deprecation macros, specifying their UOR and the version
// of their next release. For example, suppose package group 'abc' is
// currently at version 1.1. If the owners of 'abc' want to deprecate a
// function 'abcxyz::SomeUtil::someFunction', they could add the deprecation
// macros 'BSLS_DEPRECATE' and 'BSLS_DEPRECATE_IS_ACTIVE(ABC, 1, 2)' in front
// of the declaration of 'someFunction':
//..
// // abcxyz_someutil.h
//
// ...
//
// struct SomeUtil {
//
// ...
//
// #if BSLS_DEPRECATE_IS_ACTIVE(ABC, 1, 2)
// BSLS_DEPRECATE
// #endif
// static int someFunction();
// // DEPRECATED: use 'abcdef::OtherUtil::otherFunction' instead.
//
// ...
//
// };
//..
// At this point deprecations are not enforced by default for version 1.2 of
// 'abc', so the deprecation macro alone will not have any affect on clients.
// A client building their code normally will trigger no compiler warnings due
// to this new deprecation:
//..
// $ make grppkg_fooutil
// ... dependencies: abc version 1.2 ...
// ... no warnings ...
//..
// If the owners of a client library or application want to check that their
// code uses no deprecated interfaces, they can define the
// 'BB_WARN_ALL_DEPRECATIONS_FOR_TESTING_ONLY' flag in their *test* build
// process. A compiler that supports deprecation attributes will then trigger
// compiler warnings:
//..
// $ CXXFLAGS=-DBB_WARN_ALL_DEPRECATIONS_FOR_TESTING_ONLY make grppkg_fooutil
// ... dependencies: abc version 1.2 ...
// grppkg_fooutil.cpp:43: warning: function 'abcxyz::SomeUtil::someFunction'
// is explicitly deprecated.
//..
// !WARNING!: Clients at Bloomberg *must* *not* define
// 'BB_WARN_ALL_DEPRECATIONS_FOR_TESTING_ONLY' in a production build. This
// flag should be used for development builds only.
//
// Now the owners have the opportunity to fix their code by removing the
// dependency on 'abcxyz::SomeUtil::someFunction'.
//
// At some point in the future, possibly on release of 'abc' version 1.3, the
// owners of 'abc' will make deprecations enforced by default for version 1.2
// of 'abc', by setting the deprecation threshold for 'abc' in their version
// control headers:
//..
// // abcscm_versiontag.h
//
// #define ABC_VERSION_MAJOR 1
// #define ABC_VERSION_MINOR 3
//
// ...
//
// #define ABC_VERSION_DEPRECATION_THRESHOLD BSLS_DEPRECATE_MAKE_VER(1, 2)
//..
// If the owners of 'grp' have cleaned up their code, normal builds will
// trigger no compiler warnings. However, any new development by any clients
// will trigger warnings if they add a new use of
// 'abcxyz::SomeUtil::someFunction':
//..
// $ make foobar_bazutil
// ... dependencies: abc version 1.3 ...
// foobar_bazutil.cpp:177: warning: function 'abcxyz::SomeUtil::someFunction'
// is explicitly deprecated.
//..
// But what if the owners of 'grp' will not, or for some reason cannot, clean
// up their code in the near term? Moving the threshold for 'abc' to version
// 1.2 will of course trigger warnings when the owners of 'grp' next try to
// build 'grppkg_fooutil'. In a development context requiring that all
// production builds remain warning-free, we would be at an impasse: either the
// owners of 'grp' must clean up their code immediately, or the owners of 'abc'
// will not be able to enforce deprecations by default for version 1.2.
//
// This impasse can be resolved by allowing the owners of 'grp' to locally
// silence warnings caused by deprecations for version 1.2 of 'abc'. This is
// done by adding a definition of 'BB_SILENCE_DEPRECATIONS_ABC_1_2' to any
// '.cpp' files that use 'abcxyz::SomeUtil::someFunction':
//..
// // grppkg_fooutil.cpp
// #define BB_SILENCE_DEPRECATIONS_ABC_1_2
//
// ...
//..
// Now the entire codebase can build warning-free again.
//
// Managers can easily detect 'BB_SILENCE_DEPRECATIONS_<UOR>_<M>_<N>' macros in
// the codebase, and put pressure on teams to remove such remnant uses of
// deprecated code. When all remnant uses have been removed, then the
// deprecated function can be deleted entirely:
//..
// // abcxyz_someutil.h
//
// ...
//
// struct SomeUtil {
//
// ...
//
// // RIP: The function formerly known as 'someFunction'.
//
// ...
//
// };
//..
//
///Usage
///-----
// This section illustrates intended use of this component.
//
///Example 1: Tagging a Function as Deprecated
///- - - - - - - - - - - - - - - - - - - - - -
// When one piece of code has been superseded by another, we would like to get
// users to adopt the new code and stop using the old code. Being able to
// inform clients that they need to clean up existing uses of the old code, and
// also to prevent *new* uses of that code, makes it easier to get to the point
// where old code actually has zero uses and can be deleted. The deprecation
// macros 'BSLS_DEPRECATE' and 'BSLS_DEPRECATE_IS_ACTIVE', and their associated
// control macros, can be used to gradually reduce the number of uses of
// deprecated code, so that it can be removed eventually.
//
// Suppose we own package group 'xxx' that is currently at version 7.6. One of
// our components contains a function 'foo' that has been superseded by another
// function 'bar'.
//..
// int foo(int *coefficient, int n);
// // Load into the specified 'coefficient' the (positive) Winkelbaum
// // Coefficient of the specified 'n'. Return 0 on success, and a
// // negative number if there is no coefficient corresponding to 'n'.
// // Note that every integer divisible by the Winkelbaum Modulus (17) has
// // a corresponding Winkelbaum Coefficient.
//
// // ...
//
// int bar(int n);
// // Return the (positive) Winkelbaum Coefficient of the specified 'n'.
// // The behavior is undefined unless 'n' is divisible by 17 (the
// // Winkelbaum Modulus).
//..
// First, we add a deprecation tag to the declaration of 'foo', showing that it
// will be deprecated starting with version 7.7, and update the documentation
// accordingly:
//..
// #if BSLS_DEPRECATE_IS_ACTIVE(XXX, 7, 7)
// BSLS_DEPRECATE
// #endif
// int foo(int *coefficient, int n);
// // !DEPRECATED!: Use 'bar' instead.
// //
// // Load into the specified 'coefficient' the (positive) Winkelbaum
// // Coefficient of the specified 'n'. Return 0 on success, and a
// // negative number if there is no coefficient corresponding to 'n'.
// // Note that every integer divisible by the Winkelbaum Modulus (17) has
// // a corresponding Winkelbaum Coefficient.
//
// // ...
//
// int bar(int n);
// // Return the (positive) Winkelbaum Coefficient of the specified 'n'.
// // The behavior is undefined unless 'n' is divisible by 17 (the
// // Winkelbaum Modulus).
//..
// When we release version 7.7, the added deprecation tag will not immediately
// affect any of the users of 'foo'. However if any of those users do a test
// build of their code with '-DBB_WARN_ALL_DEPRECATIONS_FOR_TESTING_ONLY', they
// will see a warning that 'foo' has been deprecated.
//
// Finally, when enough time has passed to allow all users of 'foo' to switch
// over to using 'bar', probably on or after the release of 'xxx' version 7.8,
// we can enforce the deprecation of 'foo' by moving the deprecation threshold
// for 'xxx' to version 7.7, to indicate that all interfaces deprecated for
// version 7.7 are disallowed by default:
//..
// // xxxscm_versiontag.h
//
// #define XXX_VERSION_MAJOR 7
// #define XXX_VERSION_MINOR 8
//
// // ...
//
// #define XXX_VERSION_DEPRECATION_THRESHOLD BSLS_DEPRECATE_MAKE_VER(7, 7)
//..
// ==============
// BSLS_DEPRECATE
// ==============
// First, try to determine if the C++14 'deprecated' attribute is supported,
// using standard feature-detection facilities.
#if defined(__has_cpp_attribute)
# if __has_cpp_attribute(deprecated)
# define BSLS_DEPRECATE [[deprecated]]
# if defined(__clang__) && __cplusplus < 201402L
// Clang issues a warning when the C++14 attribute is used before C++14,
// where it is offered as an extension rather than a feature.
# undef BSLS_DEPRECATE
# endif
# if defined(__GNUC__) && __GNUC__ <= 5 && __cplusplus < 201103L
// G++ version 5 passes the '__has_cpp_attribute(deprecated)' test, but
// still produces an error when '[[deprecated]]' is used in non-C++11 mode.
# undef BSLS_DEPRECATE
# endif
# endif
#endif
// Then, try to determine if a GCC-style deprecation attribute is supported,
// using semi-standard feature-detection facilities.
#ifndef BSLS_DEPRECATE
# if defined(__has_attribute)
# if __has_attribute(deprecated)
# define BSLS_DEPRECATE __attribute__ ((deprecated))
# endif
# endif
#endif
// Next, define non-standard attributes for platforms known to support them.
#ifndef BSLS_DEPRECATE
# if defined(__GNUC__)
// All compilers in the GNUC interface family (g++ and clang) provide the
// simple gcc extension attribute.
# define BSLS_DEPRECATE __attribute__ ((deprecated))
# elif defined (_MSC_VER)
// MSVC supports a 'deprecated' declaration specifier starting with Visual
// Studio 2010.
# if 1600 <= _MSC_VER
# define BSLS_DEPRECATE __declspec(deprecated)
# endif
# endif
#endif
// Finally, record whether the current compiler supports some form of
// deprecation attribute.
#ifdef BSLS_DEPRECATE
# define BSLS_DEPRECATE_COMPILER_SUPPORT 1
#else
# define BSLS_DEPRECATE_COMPILER_SUPPORT 0
// Provide a fallback empty definition when the compiler does not support
// deprecation attributes.
# define BSLS_DEPRECATE
#endif
// ============================================================================
// INTERNAL MACHINERY
// ============================================================================
// ==================
// BSLS_DEPRECATE_CAT
// ==================
#define BSLS_DEPRECATE_CAT(X, Y) BSLS_DEPRECATE_CAT_A(X, Y)
// Expand to the expansion of the specified 'X', joined to the expansion of
// the specified 'Y'.
#define BSLS_DEPRECATE_CAT_A(X, Y) BSLS_DEPRECATE_CAT_B(X, Y)
#define BSLS_DEPRECATE_CAT_B(X, Y) X ## Y
// Internal implementation machinery for 'BSLS_DEPRECATE_CAT'.
// ========================
// BSLS_DEPRECATE_ISDEFINED
// ========================
#define BSLS_DEPRECATE_ISDEFINED(...) BSLS_DEPRECATE_ISDEFINED_A(__VA_ARGS__)
// Expand to an expression evaluating to 'true' in a preprocessor context
// if the deprecation control macro symbol supplied as an argument has been
// '#define'd as nil, 0, or 1, and expand to an expression evaluating to
// 'false' otherwise. The behavior is undefined unless this macro is
// evaluated with a single argument having the form of a deprecation
// control macro symbol, and that symbol has either not been '#define'd at
// all or has been '#define'd as nil, 0, or 1.
#define BSLS_DEPRECATE_ISDEFINED_A(...) ((__VA_ARGS__ ## 1L) != 0)
// Internal implementation machinery for 'BSLS_DEPRECATE_ISDEFINED'.
// ========================
// BSLS_DEPRECATE_ISNONZERO
// ========================
#define BSLS_DEPRECATE_ISNONZERO(...) BSLS_DEPRECATE_ISNONZERO_A(__VA_ARGS__)
// Expand to an expression evaluating to 'true' in a preprocessor context
// if the deprecation control macro symbol supplied as an argument has been
// '#define'd as an expression that evaluates to a non-zero value, and
// expand to an expression evaluating to 'false' otherwise. The behavior
// is undefined unless this macro is evaluated with a single argument
// having the form of a deprecation control macro symbol, and that symbol
// has either not been '#define'd at all, or has been '#define'd as nil or
// an arithmetic expression.
#define BSLS_DEPRECATE_ISNONZERO_A(...) (__VA_ARGS__ + 1 != 1)
// Internal implementation machinery for 'BSLS_DEPRECATE_ISNONZERO'.
// =======================
// BSLS_DEPRECATE_MAKE_VER
// =======================
#define BSLS_DEPRECATE_MAKE_VER(M, N) ((M) * 1000 + (N))
// Expand to an opaque sequence of symbols encoding a UOR version where
// the specified 'M' is the major version number and the specified 'N' is
// the minor version number.
// ==============================
// BSLS_DEPRECATE_ISPASTTHRESHOLD
// ==============================
#define BSLS_DEPRECATE_ISPASTTHRESHOLD(U, M, N) \
( ( BSLS_DEPRECATE_ISNONZERO(BSLS_DEPRECATE_ISPASTTHRESHOLD_A(U)) \
&& BSLS_DEPRECATE_MAKE_VER(M, N) \
<= BSLS_DEPRECATE_ISPASTTHRESHOLD_A(U)) \
|| ( !BSLS_DEPRECATE_ISNONZERO(BSLS_DEPRECATE_ISPASTTHRESHOLD_A(U)) \
&& BSLS_DEPRECATE_MAKE_VER(M, N) \
<= BSLS_DEPRECATE_MAKE_VER( \
BSLS_DEPRECATE_CAT(U, _VERSION_MAJOR), \
BSLS_DEPRECATE_CAT(U, _VERSION_MINOR)) - 1))
// Expand to an expression evaluating to 'true' in a preprocessor context
// if the specified version 'M.N' of the specified UOR 'U' is past the
// deprecation threshold for 'U', and expand to an expression evaluating to
// 'false' otherwise. Version 'M.N' of 'U' is past the deprecation
// threshold for 'U' if:
//: o An explicit deprecation threshold has been defined for UOR 'U' and
//: that threshold is greater than or equal to version 'M.N', or
//:
//: o An explicit deprecation threshold has *not* been defined for UOR 'U',
//: the versioning package for UOR 'U' defines '<U>_VERSION_MAJOR' and
//: '<U>_VERSION_MINOR', and the version so designated is greater than
//: version 'M.N'.
#define BSLS_DEPRECATE_ISPASTTHRESHOLD_A(U) \
BSLS_DEPRECATE_CAT(U, _VERSION_DEPRECATION_THRESHOLD)
// Internal implementation machinery for 'BSLS_DEPRECATE_ISPASTTHRESHOLD'.
// =========================
// BSLS_DEPRECATE_ISRETAINED
// =========================
#define BSLS_DEPRECATE_ISRETAINED(U, M, N) BSLS_DEPRECATE_ISRETAINED_A(U, M, N)
// Expand to an expression evaluating to 'true' in a preprocessor context
// if deprecations in the specified version 'M.N' of the specified UOR 'U'
// have been deactivated in this build by defining either the corresponding
// 'BB_SILENCE_DEPRECATIONS_<U>_<M>_<N>' macro or the corresponding
// 'BB_SILENCE_DEPRECATIONS_FOR_BUILDING_UOR_<U>' macro, and expand to an
// expression evaluating to 'false' otherwise.
#define BSLS_DEPRECATE_ISRETAINED_A(U, M, N) \
BSLS_DEPRECATE_ISRETAINED_B(U, M, N)
#define BSLS_DEPRECATE_ISRETAINED_B(U, M, N) \
(BSLS_DEPRECATE_ISDEFINED(BB_SILENCE_DEPRECATIONS_## U ##_## M ##_## N) \
|| BSLS_DEPRECATE_ISDEFINED(BB_SILENCE_DEPRECATIONS_FOR_BUILDING_UOR_ ## U))
// Internal implementation machinery for 'BSLS_DEPRECATE_ISRETAINED'.
// ============================================================================
// PUBLIC MACROS
// ============================================================================
// ========================
// BSLS_DEPRECATE_IS_ACTIVE
// ========================
#define BSLS_DEPRECATE_IS_ACTIVE(U, M, N) \
( !BSLS_DEPRECATE_ISRETAINED(U, M, N) \
&& ( BSLS_DEPRECATE_ISDEFINED(BB_WARN_ALL_DEPRECATIONS_FOR_TESTING_ONLY)\
|| BSLS_DEPRECATE_ISPASTTHRESHOLD(U, M, N)))
// Expand to an expression evaluating to 'true' in a preprocessor context
// if deprecations are being enforced for the specified version 'M.N' of
// the specified UOR 'U', and expand to an expression evaluating to 'false'
// otherwise. Deprecations will be enforced for version 'M.N' of UOR 'U'
// if:
//: o 'BB_SILENCE_DEPRECATIONS_<U>_<M>_<N>' has not been defined in this
//: translation unit, and
//:
//: o 'BB_SILENCE_DEPRECATIONS_FOR_BUILDING_UOR_<U>' has not been defined
//: in this translation unit, and
//:
//: o One of the following holds true:
//: o 'BB_WARN_ALL_DEPRECATIONS_FOR_TESTING_ONLY' has been defined, or
//:
//: o An explicit deprecation threshold has been defined for UOR 'U' and
//: that threshold is greater than or equal to version 'M.N', or
//:
//: o An explicit deprecation threshold has *not* been defined for UOR
//: 'U', the versioning package for UOR 'U' defines '<U>_VERSION_MAJOR'
//: and '<U>_VERSION_MINOR', and the version so designated is greater
//: than version 'M.N'.
#endif // INCLUDED_BSLS_DEPRECATE
// ----------------------------------------------------------------------------
// Copyright 2017 Bloomberg Finance L.P.
//
// 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.
// ----------------------------- END-OF-FILE ----------------------------------
| [
"osubbotin@bloomberg.net"
] | osubbotin@bloomberg.net |
c62ed9fe30844db1df9aba5f599315d1ec5fd826 | 7f69b6734aecc5481896989eae9b39503eb43f74 | /map.cpp | b052b03740c0e172417265f67617213a03ca9720 | [] | no_license | xor123x/Eac-Bypass | 56df0c17ec91593f617be64441634fd5d6f4dd8f | 1b9b9e66b61f0fc935ccad364af0c49b928ce210 | refs/heads/master | 2023-04-07T17:54:34.392869 | 2021-04-14T15:48:13 | 2021-04-14T15:48:13 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 6,477 | cpp | #include "stdafx.h"
// CBA to make this cleaner
namespace Map {
PIMAGE_SECTION_HEADER TranslateRawSection(PIMAGE_NT_HEADERS nt, DWORD rva) {
auto section = IMAGE_FIRST_SECTION(nt);
for (auto i = 0; i < nt->FileHeader.NumberOfSections; ++i, ++section) {
if (rva >= section->VirtualAddress && rva < section->VirtualAddress + section->Misc.VirtualSize) {
return section;
}
}
return NULL;
}
PVOID TranslateRaw(PBYTE base, PIMAGE_NT_HEADERS nt, DWORD rva) {
auto section = TranslateRawSection(nt, rva);
if (!section) {
return NULL;
}
return base + section->PointerToRawData + (rva - section->VirtualAddress);
}
BOOLEAN ResolveImports(Comm::Process& process, PBYTE base, PIMAGE_NT_HEADERS nt) {
auto rva = nt->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_IMPORT].VirtualAddress;
if (!rva) {
return TRUE;
}
auto importDescriptor = reinterpret_cast<PIMAGE_IMPORT_DESCRIPTOR>(TranslateRaw(base, nt, rva));
if (!importDescriptor) {
return TRUE;
}
for (; importDescriptor->FirstThunk; ++importDescriptor) {
auto moduleName = reinterpret_cast<PCHAR>(TranslateRaw(base, nt, importDescriptor->Name));
if (!moduleName) {
break;
}
auto module = LoadLibraryA(moduleName);
if (!module) {
//errorf("failed to load module: %s\n", moduleName);
return FALSE;
}
PBYTE processModuleBase = NULL;
DWORD processModuleSize = 0;
if (process.Module(StrToWStr(moduleName), &processModuleBase, &processModuleSize) != ERROR_SUCCESS) {
//errorf("target process does not have %s loaded\n", moduleName);
return FALSE;
}
for (auto thunk = reinterpret_cast<PIMAGE_THUNK_DATA>(TranslateRaw(base, nt, importDescriptor->FirstThunk)); thunk->u1.AddressOfData; ++thunk) {
auto importByName = reinterpret_cast<PIMAGE_IMPORT_BY_NAME>(TranslateRaw(base, nt, static_cast<DWORD>(thunk->u1.AddressOfData)));
thunk->u1.Function = reinterpret_cast<UINT_PTR>(processModuleBase + (reinterpret_cast<PBYTE>(GetProcAddress(module, importByName->Name)) - reinterpret_cast<PBYTE>(module)));
}
}
return TRUE;
}
VOID ResolveRelocations(PBYTE base, PIMAGE_NT_HEADERS nt, PBYTE mapped) {
auto& baseRelocDir = nt->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_BASERELOC];
if (!baseRelocDir.VirtualAddress) {
return;
}
auto reloc = reinterpret_cast<PIMAGE_BASE_RELOCATION>(TranslateRaw(base, nt, baseRelocDir.VirtualAddress));
if (!reloc) {
return;
}
for (auto currentSize = 0UL; currentSize < baseRelocDir.Size; ) {
auto relocCount = (reloc->SizeOfBlock - sizeof(IMAGE_BASE_RELOCATION)) / sizeof(WORD);
auto relocData = reinterpret_cast<PWORD>(reinterpret_cast<PBYTE>(reloc) + sizeof(IMAGE_BASE_RELOCATION));
auto relocBase = reinterpret_cast<PBYTE>(TranslateRaw(base, nt, reloc->VirtualAddress));
for (auto i = 0UL; i < relocCount; ++i, ++relocData) {
auto data = *relocData;
auto type = data >> 12;
auto offset = data & 0xFFF;
if (type == IMAGE_REL_BASED_DIR64) {
*reinterpret_cast<PBYTE*>(relocBase + offset) += (mapped - reinterpret_cast<PBYTE>(nt->OptionalHeader.ImageBase));
}
}
currentSize += reloc->SizeOfBlock;
reloc = reinterpret_cast<PIMAGE_BASE_RELOCATION>(relocData);
}
}
BOOLEAN MapHeaders(Comm::Process& process, PBYTE base, PIMAGE_NT_HEADERS nt, PBYTE mapped) {
return process.Write(mapped, base, sizeof(nt->Signature) + sizeof(nt->FileHeader) + nt->FileHeader.SizeOfOptionalHeader) == ERROR_SUCCESS;
}
BOOLEAN MapSections(Comm::Process& process, PBYTE base, PIMAGE_NT_HEADERS nt, PBYTE mapped) {
auto section = IMAGE_FIRST_SECTION(nt);
for (auto i = 0; i < nt->FileHeader.NumberOfSections; ++i, ++section) {
auto sectionSize = min(section->SizeOfRawData, section->Misc.VirtualSize);
if (!sectionSize) {
continue;
}
auto mappedSection = mapped + section->VirtualAddress;
if (process.Write(mappedSection, base + section->PointerToRawData, sectionSize) != ERROR_SUCCESS) {
//errorf("failed to map section %s at %p (%x)\n", section->Name, mappedSection, sectionSize);
return FALSE;
}
}
return TRUE;
}
PBYTE ExtendModule(Comm::Process& process, PIMAGE_NT_HEADERS nt, LPCWSTR module) {
PBYTE moduleBase = NULL;
DWORD moduleSize = 0;
//printf("[-] extending %ws\n", module);
auto status = process.Module(module, &moduleBase, &moduleSize);
if (status != ERROR_SUCCESS || !moduleBase) {
//errorf("failed to find module %ws (%X)\n", module, status);
return NULL;
}
status = process.Extend(module, nt->OptionalHeader.SizeOfImage);
if (status != ERROR_SUCCESS) {
//errorf("module %ws does not having enough free trailing memory (%X)\n", module, status);
return NULL;
}
//printf("[+] extended %ws to %x\n", module, moduleSize + nt->OptionalHeader.SizeOfImage);
return moduleBase + moduleSize;
}
PVOID ExtendMap(Comm::Process& process, PBYTE base, LPCWSTR module) {
auto dos = reinterpret_cast<PIMAGE_DOS_HEADER>(base);
if (dos->e_magic != IMAGE_DOS_SIGNATURE) {
//errorf("invalid DOS signature\n");
return NULL;
}
auto nt = reinterpret_cast<PIMAGE_NT_HEADERS>(base + dos->e_lfanew);
if (nt->Signature != IMAGE_NT_SIGNATURE) {
//errorf("invalid NT signature\n");
return NULL;
}
nt->Signature = dos->e_magic = 0;
auto mapped = ExtendModule(process, nt, module);
if (!mapped) {
return NULL;
}
//printf("[+] mapped base: %p\n", mapped);
if (!ResolveImports(process, base, nt)) {
return NULL;
}
ResolveRelocations(base, nt, mapped);
if (!MapHeaders(process, base, nt, mapped)) {
//errorf("failed to map headers\n");
return NULL;
}
if (!MapSections(process, base, nt, mapped)) {
return NULL;
}
return mapped + nt->OptionalHeader.AddressOfEntryPoint;
}
PVOID ExtendMap(Comm::Process& process, LPCWSTR filePath, LPCWSTR module) {
std::ifstream file(filePath, std::ios::ate | std::ios::binary);
if (!file) {
//errorf("failed to open file: \"%ws\"\n", filePath);
return NULL;
}
auto size = file.tellg();
auto buffer = new BYTE[size];
file.seekg(0, std::ios::beg);
file.read(reinterpret_cast<PCHAR>(buffer), size);
file.close();
auto entryPoint = ExtendMap(process, buffer, module);
delete[] buffer;
return entryPoint;
}
} | [
"noreply@github.com"
] | xor123x.noreply@github.com |
6f2c68fafce223d30ef9fedecdf0b322f54d9e84 | 068bcb8c2d7a3ac61e782d7f25d9cd9da556ad0a | /mra_ros_control/ros_controllers/joint_trajectory_controller/include/joint_trajectory_controller/init_joint_trajectory.h | 0c3b3fdca68e51c222db5a368b33df188d7a995e | [] | no_license | WanderROS/my_ros_ws | 87bc72daab723a329fc5ebd558832c007b54deda | 4e2d9bdcdf3db6817d5df4dbc4ee337610feb496 | refs/heads/master | 2020-03-23T19:14:13.452488 | 2018-07-23T12:31:49 | 2018-07-23T12:31:49 | 141,962,251 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 18,036 | h | ///////////////////////////////////////////////////////////////////////////////
// Copyright (C) 2013, PAL Robotics S.L.
//
// 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 PAL Robotics S.L. 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 Adolfo Rodriguez Tsouroukdissian
#ifndef JOINT_TRAJECTORY_CONTROLLER_INIT_JOINT_TRAJECTORY_H
#define JOINT_TRAJECTORY_CONTROLLER_INIT_JOINT_TRAJECTORY_H
// C++ standard
#include <algorithm>
#include <iomanip>
#include <sstream>
#include <stdexcept>
#include <vector>
// Boost
#include <boost/shared_ptr.hpp>
// ROS messages
#include <control_msgs/FollowJointTrajectoryAction.h>
#include <trajectory_msgs/JointTrajectoryPoint.h>
// ros_controls
#include <realtime_tools/realtime_server_goal_handle.h>
// Project
#include <joint_trajectory_controller/joint_trajectory_msg_utils.h>
#include <joint_trajectory_controller/joint_trajectory_segment.h>
namespace joint_trajectory_controller
{
namespace internal
{
/**
* \return The permutation vector between two containers.
* If \p t1 is <tt>"{A, B, C, D}"</tt> and \p t2 is <tt>"{B, D, A, C}"</tt>, the associated permutation vector is
* <tt>"{2, 0, 3, 1}"</tt>.
*/
template <class T>
inline std::vector<unsigned int> permutation(const T& t1, const T& t2)
{
typedef unsigned int SizeType;
// Arguments must have the same size
if (t1.size() != t2.size()) {return std::vector<SizeType>();}
std::vector<SizeType> permutation_vector(t1.size()); // Return value
for (typename T::const_iterator t1_it = t1.begin(); t1_it != t1.end(); ++t1_it)
{
typename T::const_iterator t2_it = std::find(t2.begin(), t2.end(), *t1_it);
if (t2.end() == t2_it) {return std::vector<SizeType>();}
else
{
const SizeType t1_dist = std::distance(t1.begin(), t1_it);
const SizeType t2_dist = std::distance(t2.begin(), t2_it);
permutation_vector[t1_dist] = t2_dist;
}
}
return permutation_vector;
}
} // namespace
/**
* \brief Options used when initializing a joint trajectory from ROS message data.
* \sa initJointTrajectory
*/
template <class Trajectory>
struct InitJointTrajectoryOptions
{
typedef realtime_tools::RealtimeServerGoalHandle<control_msgs::FollowJointTrajectoryAction> RealtimeGoalHandle;
typedef boost::shared_ptr<RealtimeGoalHandle> RealtimeGoalHandlePtr;
typedef typename Trajectory::value_type::Scalar Scalar;
InitJointTrajectoryOptions()
: current_trajectory(0),
joint_names(0),
angle_wraparound(0),
rt_goal_handle(),
default_tolerances(0),
other_time_base(0)
{}
Trajectory* current_trajectory;
std::vector<std::string>* joint_names;
std::vector<bool>* angle_wraparound;
RealtimeGoalHandlePtr rt_goal_handle;
SegmentTolerances<Scalar>* default_tolerances;
ros::Time* other_time_base;
};
/**
* \brief Initialize a joint trajectory from ROS message data.
*
* \param msg Trajectory message.
*
* \param time Time from which data is to be extracted. All trajectory points in \p msg occurring \b after
* \p time will be extracted; or put otherwise, all points occurring at a time <b>less or equal</b> than \p time
* will be discarded. Set this value to zero to process all points in \p msg.
*
* \param options Options that change how the trajectory gets initialized.
*
* The \ref InitJointTrajectoryOptions "options" parameter is optional. The meaning of its different members follows:
* - \b current_trajectory Currently executed trajectory. Use this parameter if you want to update an existing
* trajectory with the data in \p msg; that is, keep the useful parts of \p current_trajectory and \p msg.
* If specified, the output trajectory will not only contain data in \p msg occurring \b after \p time, but will also
* contain data from \p current_trajectory \b between \p time and the start time of \p msg
* (which might not be equal to \p time).
*
* - \b joint_names Joints expected to be found in \p msg. If specified, this function will return an empty trajectory
* when \p msg contains joints that differ in number or names to \p joint_names. If \p msg contains the same joints as
* \p joint_names, but in a different order, the resulting trajectory will be ordered according to \p joint_names
* (and not \p msg). If unspecified (empty), no checks will be performed against expected joints, and the resulting
* trajectory will preserve the joint ordering of \p msg.
*
* - \b angle_wraparound Vector of booleans where true values correspond to joints that wrap around (ie. are continuous).
* If specified, combining \p current_trajectory with \p msg will not result in joints performing multiple turns at the
* transition. This parameter \b requires \p current_trajectory to also be specified, otherwise it is ignored.
*
* - \b rt_goal_handle Action goal handle associated to the new trajectory. If specified, newly added segments will have
* a pointer to it, and to the trajectory tolerances it contains (if any).
*
* - \b default_tolerances Default trajectory tolerances. This option is only used when \p rt_goal_handle is also
* specified. It contains the default tolernaces to check when executing an action goal. If the action goal specifies
* tolerances (totally or partially), these values will take precedence over the defaults.
*
* - \b other_time_base When initializing a new trajectory, it might be the case that we desire the result expressed in
* a \b different time base than that contained in \p msg. If specified, the value of this variable should be the
* equivalent of the \p time parameter, but expressed in the desired time base.
* If the \p current_trajectory option is also specified, it must be expressed in \p other_time_base.
* The typical usecase for this variable is when the \p current_trajectory option is specified, and contains data in
* a different time base (eg. monotonically increasing) than \p msg (eg. system-clock synchronized).
*
* \return Trajectory container.
*
* \tparam Trajectory Trajectory type. Should be a \e sequence container \e sorted by segment start time.
* Additionally, the contained segment type must implement a constructor with the following signature:
* \code
* Segment(const ros::Time& traj_start_time,
* const trajectory_msgs::JointTrajectoryPoint& start_point,
* const trajectory_msgs::JointTrajectoryPoint& end_point,
* const std::vector<unsigned int>& permutation,
* const std::vector<Scalar>& position_offset)
* \endcode
* The following function must also be defined to properly handle continuous joints:
* \code
* std::vector<Scalar> wraparoundOffset(const typename Segment::State& prev_state,
* const typename Segment::State& next_state,
* const std::vector<bool>& angle_wraparound)
* \endcode
*
* \note This function does not throw any exceptions by itself, but the segment constructor might.
* In such a case, this method should be wrapped inside a \p try block.
*/
// TODO: Return useful bits of current trajectory if input msg is useless?
template <class Trajectory>
Trajectory initJointTrajectory(const trajectory_msgs::JointTrajectory& msg,
const ros::Time& time,
const InitJointTrajectoryOptions<Trajectory>& options =
InitJointTrajectoryOptions<Trajectory>())
{
typedef typename Trajectory::value_type Segment;
typedef typename Segment::Scalar Scalar;
const unsigned int n_joints = msg.joint_names.size();
const ros::Time msg_start_time = internal::startTime(msg, time); // Message start time
ROS_DEBUG_STREAM("Figuring out new trajectory starting at time "
<< std::fixed << std::setprecision(3) << msg_start_time.toSec());
//Empty trajectory
if (msg.points.empty())
{
ROS_DEBUG("Trajectory message contains empty trajectory. Nothing to convert.");
return Trajectory();
}
// Validate options
const bool has_current_trajectory = options.current_trajectory && !options.current_trajectory->empty();
const bool has_joint_names = options.joint_names && !options.joint_names->empty();
const bool has_angle_wraparound = options.angle_wraparound && !options.angle_wraparound->empty();
const bool has_rt_goal_handle = options.rt_goal_handle;
const bool has_other_time_base = options.other_time_base;
const bool has_default_tolerances = options.default_tolerances;
if (!has_current_trajectory && has_angle_wraparound)
{
ROS_WARN("Vector specifying whether joints wrap around will not be used because no current trajectory was given.");
}
// Compute trajectory start time and data extraction time associated to the 'other' time base, if it applies
// The o_ prefix indicates that time values are represented in this 'other' time base.
ros::Time o_time;
ros::Time o_msg_start_time;
if (has_other_time_base)
{
ros::Duration msg_start_duration = msg_start_time - time;
o_time = *options.other_time_base;
o_msg_start_time = o_time + msg_start_duration;
ROS_DEBUG_STREAM("Using alternate time base. In it, the new trajectory starts at time "
<< std::fixed << std::setprecision(3) << o_msg_start_time.toSec());
}
else
{
o_time = time;
o_msg_start_time = msg_start_time;
}
// Permutation vector mapping the expected joint order to the message joint order
// If unspecified, a trivial map (no permutation) is computed
const std::vector<std::string> joint_names = has_joint_names ? *(options.joint_names) : msg.joint_names;
std::vector<unsigned int> permutation_vector = internal::permutation(joint_names, msg.joint_names);
if (permutation_vector.empty())
{
ROS_ERROR("Cannot create trajectory from message. It does not contain the expected joints.");
return Trajectory();
}
// Tolerances to be used in all new segments
SegmentTolerances<Scalar> tolerances = has_default_tolerances ?
*(options.default_tolerances) : SegmentTolerances<Scalar>(n_joints);
if (has_rt_goal_handle && options.rt_goal_handle->gh_.getGoal())
{
updateSegmentTolerances<Scalar>(*(options.rt_goal_handle->gh_.getGoal()), joint_names, tolerances);
}
// Find first point of new trajectory occurring after current time
// This point is used later on in this function, but is computed here, in advance because if the trajectory message
// contains a trajectory in the past, we can quickly return without spending additional computational resources
std::vector<trajectory_msgs::JointTrajectoryPoint>::const_iterator
it = findPoint(msg, time); // Points to last point occurring before current time (NOTE: Using time, not o_time)
if (it == msg.points.end())
{
it = msg.points.begin(); // Entire trajectory is after current time
}
else
{
++it; // Points to first point after current time OR sequence end
if (it == msg.points.end())
{
ros::Duration last_point_dur = time - (msg_start_time + (--it)->time_from_start);
ROS_WARN_STREAM("Dropping all " << msg.points.size() <<
" trajectory point(s), as they occur before the current time.\n" <<
"Last point is " << std::fixed << std::setprecision(3) << last_point_dur.toSec() <<
"s in the past.");
return Trajectory();
}
else
{
ros::Duration next_point_dur = msg_start_time + it->time_from_start - time;
ROS_WARN_STREAM("Dropping first " << std::distance(msg.points.begin(), it) <<
" trajectory point(s) out of " << msg.points.size() <<
", as they occur before the current time.\n" <<
"First valid point will be reached in " << std::fixed << std::setprecision(3) <<
next_point_dur.toSec() << "s.");
}
}
// Initialize result trajectory: combination of:
// - Useful segments of currently followed trajectory
// - Useful segments of new trajectory (contained in ROS message)
Trajectory result_traj; // Currently empty
// Initialize offsets due to wrapping joints to zero
std::vector<Scalar> position_offset(n_joints, 0.0);
// Bridge current trajectory to new one
if (has_current_trajectory)
{
const Trajectory& curr_traj = *(options.current_trajectory);
// Get the last time and state that will be executed from the current trajectory
const typename Segment::Time last_curr_time = std::max(o_msg_start_time.toSec(), o_time.toSec()); // Important!
typename Segment::State last_curr_state;
sample(curr_traj, last_curr_time, last_curr_state);
// Get the first time and state that will be executed from the new trajectory
const typename Segment::Time first_new_time = o_msg_start_time.toSec() + (it->time_from_start).toSec();
typename Segment::State first_new_state(*it, permutation_vector); // Here offsets are not yet applied
// Compute offsets due to wrapping joints
if (has_angle_wraparound)
{
position_offset = wraparoundOffset(last_curr_state.position,
first_new_state.position,
*(options.angle_wraparound));
if (position_offset.empty())
{
ROS_ERROR("Cannot create trajectory from message. "
"Vector specifying whether joints wrap around has an invalid size.");
return Trajectory();
}
}
// Apply offset to first state that will be executed from the new trajectory
first_new_state = typename Segment::State(*it, permutation_vector, position_offset); // Now offsets are applied
// Add useful segments of current trajectory to result
{
typedef typename Trajectory::const_iterator TrajIter;
TrajIter first = findSegment(curr_traj, o_time.toSec()); // Currently active segment
TrajIter last = findSegment(curr_traj, last_curr_time); // Segment active when new trajectory starts
if (first == curr_traj.end() || last == curr_traj.end())
{
ROS_ERROR("Unexpected error: Could not find segments in current trajectory. Please contact the package maintainer.");
return Trajectory();
}
result_traj.insert(result_traj.begin(), first, ++last); // Range [first,last) will still be executed
}
// Add segment bridging current and new trajectories to result
Segment bridge_seg(last_curr_time, last_curr_state,
first_new_time, first_new_state);
bridge_seg.setGoalHandle(options.rt_goal_handle);
if (has_rt_goal_handle) {bridge_seg.setTolerances(tolerances);}
result_traj.push_back(bridge_seg);
}
// Constants used in log statement at the end
const unsigned int num_old_segments = result_traj.size() -1;
const unsigned int num_new_segments = std::distance(it, msg.points.end()) -1;
// Add useful segments of new trajectory to result
// - Construct all trajectory segments occurring after current time
// - As long as there remain two trajectory points we can construct the next trajectory segment
while (std::distance(it, msg.points.end()) >= 2)
{
std::vector<trajectory_msgs::JointTrajectoryPoint>::const_iterator next_it = it; ++next_it;
Segment segment(o_msg_start_time, *it, *next_it, permutation_vector, position_offset);
segment.setGoalHandle(options.rt_goal_handle);
if (has_rt_goal_handle) {segment.setTolerances(tolerances);}
result_traj.push_back(segment);
++it;
}
// Useful debug info
std::stringstream log_str;
log_str << "Trajectory has " << result_traj.size() << " segments";
if (has_current_trajectory)
{
log_str << ":";
log_str << "\n- " << num_old_segments << " segment(s) will still be executed from previous trajectory.";
log_str << "\n- 1 segment added for transitioning between the current trajectory and first point of the input message.";
if (num_new_segments > 0) {log_str << "\n- " << num_new_segments << " new segments (" << (num_new_segments + 1) <<
" points) taken from the input trajectory.";}
}
else {log_str << ".";}
ROS_DEBUG_STREAM(log_str.str());
return result_traj;
}
} // namespace
#endif // header guard
| [
"1194409532@qq.com"
] | 1194409532@qq.com |
52402764cd90622358983149c97559670347adcb | 8e76195f708d7bb715600d3ee6b995bef542660d | /ae.h | 942350670464b52a7a864b7568589bef6b620866 | [] | no_license | DsSysWay/epoll | d0608f83580ed5b4f2c90b0cbd252a5dd87aac6c | 700b56675e873f40332a5c2afcc8faff8978a658 | refs/heads/master | 2020-07-30T19:03:12.413285 | 2016-11-13T15:15:10 | 2016-11-13T15:15:10 | 73,623,506 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,088 | h | #ifndef _AE_H_
#define _AE_H_
/*
* =====================================================================================
*
* Filename: ae.cpp
*
* Description:
*
*
* Version: 1.0
* Created: 11/09/2016 08:17:15 AM
* Revision: none
* Compiler: gcc
*
* Author: chriswei
* Organization: 洪兴锐创网络科技
*
* =====================================================================================
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <netinet/in.h>
#include <sys/socket.h>
#include <arpa/inet.h>
#include <sys/epoll.h>
#include <unistd.h>
#include <sys/types.h>
#include "comm.h"
using namespace std;
#define MAXFDSIZE 10240
typedef class epollData{
public:
int epollfd;
struct epoll_event events[EPOLLEVENTS];
}epollData;
class eventLoop;
typedef void aeFdReadProc(eventLoop *eventLoop, int fd, char*buf, int maxSize);
typedef int aeFdWriteProc(eventLoop *eventLoop, int fd, char*buf, int maxSize);
typedef class aeFileEvent{
public:
int fd;
aeFdReadProc *rproc;
aeFdWriteProc *wproc;
int mask;
//int ip; //对端ip
//int port;//对端port
}aeFileEvent;
typedef class eventLoop{
public:
eventLoop(int setsize);
~eventLoop();
//处理poll ,调用读写函数
int aePoll();
//主动连接
int aeAddNewFd(int fd, int mask,(aeFdReadProc *) rproc, (aeFdWriteProc *)wproc);
private:
int handle_events(int num, int listenfd, char *buf);
int do_read(int fd, char* buf);
int do_write(int fd, char* buf);
//被动连接
int handle_accept(int listenfd);
int add_event(int fd, int mask);
int del_event(int fd, int mask);
int mod_event(int fd, int mask);
public:
bool bIsStop;
private:
map<int,aeFileEvent> fdEventMap;
map< pair<int, int >, int> ipFdMap;
void* pollData;
int m_setsize;
}eventLoop;
#endif
| [
"linuxserverlover@gmail.com"
] | linuxserverlover@gmail.com |
f66c4653bcd64fdd35b424424b7338cc8ea29464 | 2cd6edd02450849015bf535eb473a750dace67a8 | /final-project/repositories/Deep_Learning_Inference_Accelerator_with_CNNIOT/MSOC_final-main/finalpool_hls/channel_pip/syn/systemc/pool_write_3.cpp | 7352e70d096af2f1d0e46eeb8fb8acb2bdd741b4 | [
"MIT"
] | permissive | prajwaltr/MSoC-HLS | fde436f7031cc7477a93f079a1b3407558988e07 | d876b6bdfe45caba63811b16b273a9723e9baf65 | refs/heads/main | 2023-06-05T00:52:40.419332 | 2021-06-15T02:30:37 | 2021-06-15T02:30:37 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 241,305 | cpp | #include "pool_write.h"
#include "AESL_pkg.h"
using namespace std;
namespace ap_rtl {
void pool_write::thread_and_ln189_10_fu_3460_p2() {
and_ln189_10_fu_3460_p2 = (or_ln189_10_fu_3452_p2.read() & or_ln189_11_fu_3456_p2.read());
}
void pool_write::thread_and_ln189_11_fu_3466_p2() {
and_ln189_11_fu_3466_p2 = (and_ln189_10_fu_3460_p2.read() & grp_fu_1470_p2.read());
}
void pool_write::thread_and_ln189_12_fu_3500_p2() {
and_ln189_12_fu_3500_p2 = (or_ln189_12_fu_3492_p2.read() & or_ln189_13_fu_3496_p2.read());
}
void pool_write::thread_and_ln189_13_fu_3506_p2() {
and_ln189_13_fu_3506_p2 = (and_ln189_12_fu_3500_p2.read() & grp_fu_1482_p2.read());
}
void pool_write::thread_and_ln189_14_fu_3540_p2() {
and_ln189_14_fu_3540_p2 = (or_ln189_14_fu_3532_p2.read() & or_ln189_15_fu_3536_p2.read());
}
void pool_write::thread_and_ln189_15_fu_3546_p2() {
and_ln189_15_fu_3546_p2 = (and_ln189_14_fu_3540_p2.read() & grp_fu_1494_p2.read());
}
void pool_write::thread_and_ln189_16_fu_3580_p2() {
and_ln189_16_fu_3580_p2 = (or_ln189_16_fu_3572_p2.read() & or_ln189_17_fu_3576_p2.read());
}
void pool_write::thread_and_ln189_17_fu_3586_p2() {
and_ln189_17_fu_3586_p2 = (and_ln189_16_fu_3580_p2.read() & grp_fu_1506_p2.read());
}
void pool_write::thread_and_ln189_18_fu_3620_p2() {
and_ln189_18_fu_3620_p2 = (or_ln189_18_fu_3612_p2.read() & or_ln189_19_fu_3616_p2.read());
}
void pool_write::thread_and_ln189_19_fu_3626_p2() {
and_ln189_19_fu_3626_p2 = (and_ln189_18_fu_3620_p2.read() & grp_fu_1518_p2.read());
}
void pool_write::thread_and_ln189_1_fu_3266_p2() {
and_ln189_1_fu_3266_p2 = (and_ln189_fu_3260_p2.read() & grp_fu_1410_p2.read());
}
void pool_write::thread_and_ln189_20_fu_3660_p2() {
and_ln189_20_fu_3660_p2 = (or_ln189_20_fu_3652_p2.read() & or_ln189_21_fu_3656_p2.read());
}
void pool_write::thread_and_ln189_21_fu_3666_p2() {
and_ln189_21_fu_3666_p2 = (and_ln189_20_fu_3660_p2.read() & grp_fu_1530_p2.read());
}
void pool_write::thread_and_ln189_22_fu_3700_p2() {
and_ln189_22_fu_3700_p2 = (or_ln189_22_fu_3692_p2.read() & or_ln189_23_fu_3696_p2.read());
}
void pool_write::thread_and_ln189_23_fu_3706_p2() {
and_ln189_23_fu_3706_p2 = (and_ln189_22_fu_3700_p2.read() & grp_fu_1542_p2.read());
}
void pool_write::thread_and_ln189_24_fu_4468_p2() {
and_ln189_24_fu_4468_p2 = (or_ln189_24_fu_4460_p2.read() & or_ln189_25_fu_4464_p2.read());
}
void pool_write::thread_and_ln189_25_fu_4474_p2() {
and_ln189_25_fu_4474_p2 = (and_ln189_24_fu_4468_p2.read() & grp_fu_1410_p2.read());
}
void pool_write::thread_and_ln189_26_fu_4508_p2() {
and_ln189_26_fu_4508_p2 = (or_ln189_26_fu_4500_p2.read() & or_ln189_27_fu_4504_p2.read());
}
void pool_write::thread_and_ln189_27_fu_4514_p2() {
and_ln189_27_fu_4514_p2 = (and_ln189_26_fu_4508_p2.read() & grp_fu_1422_p2.read());
}
void pool_write::thread_and_ln189_28_fu_4548_p2() {
and_ln189_28_fu_4548_p2 = (or_ln189_28_fu_4540_p2.read() & or_ln189_29_fu_4544_p2.read());
}
void pool_write::thread_and_ln189_29_fu_4554_p2() {
and_ln189_29_fu_4554_p2 = (and_ln189_28_fu_4548_p2.read() & grp_fu_1434_p2.read());
}
void pool_write::thread_and_ln189_2_fu_3300_p2() {
and_ln189_2_fu_3300_p2 = (or_ln189_2_fu_3292_p2.read() & or_ln189_3_fu_3296_p2.read());
}
void pool_write::thread_and_ln189_30_fu_4588_p2() {
and_ln189_30_fu_4588_p2 = (or_ln189_30_fu_4580_p2.read() & or_ln189_31_fu_4584_p2.read());
}
void pool_write::thread_and_ln189_31_fu_4594_p2() {
and_ln189_31_fu_4594_p2 = (and_ln189_30_fu_4588_p2.read() & grp_fu_1446_p2.read());
}
void pool_write::thread_and_ln189_3_fu_3306_p2() {
and_ln189_3_fu_3306_p2 = (and_ln189_2_fu_3300_p2.read() & grp_fu_1422_p2.read());
}
void pool_write::thread_and_ln189_4_fu_3340_p2() {
and_ln189_4_fu_3340_p2 = (or_ln189_4_fu_3332_p2.read() & or_ln189_5_fu_3336_p2.read());
}
void pool_write::thread_and_ln189_5_fu_3346_p2() {
and_ln189_5_fu_3346_p2 = (and_ln189_4_fu_3340_p2.read() & grp_fu_1434_p2.read());
}
void pool_write::thread_and_ln189_6_fu_3380_p2() {
and_ln189_6_fu_3380_p2 = (or_ln189_6_fu_3372_p2.read() & or_ln189_7_fu_3376_p2.read());
}
void pool_write::thread_and_ln189_7_fu_3386_p2() {
and_ln189_7_fu_3386_p2 = (and_ln189_6_fu_3380_p2.read() & grp_fu_1446_p2.read());
}
void pool_write::thread_and_ln189_8_fu_3420_p2() {
and_ln189_8_fu_3420_p2 = (or_ln189_8_fu_3412_p2.read() & or_ln189_9_fu_3416_p2.read());
}
void pool_write::thread_and_ln189_9_fu_3426_p2() {
and_ln189_9_fu_3426_p2 = (and_ln189_8_fu_3420_p2.read() & grp_fu_1458_p2.read());
}
void pool_write::thread_and_ln189_fu_3260_p2() {
and_ln189_fu_3260_p2 = (or_ln189_fu_3252_p2.read() & or_ln189_1_fu_3256_p2.read());
}
void pool_write::thread_and_ln190_10_fu_3480_p2() {
and_ln190_10_fu_3480_p2 = (or_ln190_10_fu_3472_p2.read() & or_ln190_11_fu_3476_p2.read());
}
void pool_write::thread_and_ln190_11_fu_3486_p2() {
and_ln190_11_fu_3486_p2 = (and_ln190_10_fu_3480_p2.read() & grp_fu_1476_p2.read());
}
void pool_write::thread_and_ln190_12_fu_3520_p2() {
and_ln190_12_fu_3520_p2 = (or_ln190_12_fu_3512_p2.read() & or_ln190_13_fu_3516_p2.read());
}
void pool_write::thread_and_ln190_13_fu_3526_p2() {
and_ln190_13_fu_3526_p2 = (and_ln190_12_fu_3520_p2.read() & grp_fu_1488_p2.read());
}
void pool_write::thread_and_ln190_14_fu_3560_p2() {
and_ln190_14_fu_3560_p2 = (or_ln190_14_fu_3552_p2.read() & or_ln190_15_fu_3556_p2.read());
}
void pool_write::thread_and_ln190_15_fu_3566_p2() {
and_ln190_15_fu_3566_p2 = (and_ln190_14_fu_3560_p2.read() & grp_fu_1500_p2.read());
}
void pool_write::thread_and_ln190_16_fu_3600_p2() {
and_ln190_16_fu_3600_p2 = (or_ln190_16_fu_3592_p2.read() & or_ln190_17_fu_3596_p2.read());
}
void pool_write::thread_and_ln190_17_fu_3606_p2() {
and_ln190_17_fu_3606_p2 = (and_ln190_16_fu_3600_p2.read() & grp_fu_1512_p2.read());
}
void pool_write::thread_and_ln190_18_fu_3640_p2() {
and_ln190_18_fu_3640_p2 = (or_ln190_18_fu_3632_p2.read() & or_ln190_19_fu_3636_p2.read());
}
void pool_write::thread_and_ln190_19_fu_3646_p2() {
and_ln190_19_fu_3646_p2 = (and_ln190_18_fu_3640_p2.read() & grp_fu_1524_p2.read());
}
void pool_write::thread_and_ln190_1_fu_3286_p2() {
and_ln190_1_fu_3286_p2 = (and_ln190_fu_3280_p2.read() & grp_fu_1416_p2.read());
}
void pool_write::thread_and_ln190_20_fu_3680_p2() {
and_ln190_20_fu_3680_p2 = (or_ln190_20_fu_3672_p2.read() & or_ln190_21_fu_3676_p2.read());
}
void pool_write::thread_and_ln190_21_fu_3686_p2() {
and_ln190_21_fu_3686_p2 = (and_ln190_20_fu_3680_p2.read() & grp_fu_1536_p2.read());
}
void pool_write::thread_and_ln190_22_fu_3720_p2() {
and_ln190_22_fu_3720_p2 = (or_ln190_22_fu_3712_p2.read() & or_ln190_23_fu_3716_p2.read());
}
void pool_write::thread_and_ln190_23_fu_3726_p2() {
and_ln190_23_fu_3726_p2 = (and_ln190_22_fu_3720_p2.read() & grp_fu_1548_p2.read());
}
void pool_write::thread_and_ln190_24_fu_4488_p2() {
and_ln190_24_fu_4488_p2 = (or_ln190_24_fu_4480_p2.read() & or_ln190_25_fu_4484_p2.read());
}
void pool_write::thread_and_ln190_25_fu_4494_p2() {
and_ln190_25_fu_4494_p2 = (and_ln190_24_fu_4488_p2.read() & grp_fu_1416_p2.read());
}
void pool_write::thread_and_ln190_26_fu_4528_p2() {
and_ln190_26_fu_4528_p2 = (or_ln190_26_fu_4520_p2.read() & or_ln190_27_fu_4524_p2.read());
}
void pool_write::thread_and_ln190_27_fu_4534_p2() {
and_ln190_27_fu_4534_p2 = (and_ln190_26_fu_4528_p2.read() & grp_fu_1428_p2.read());
}
void pool_write::thread_and_ln190_28_fu_4568_p2() {
and_ln190_28_fu_4568_p2 = (or_ln190_28_fu_4560_p2.read() & or_ln190_29_fu_4564_p2.read());
}
void pool_write::thread_and_ln190_29_fu_4574_p2() {
and_ln190_29_fu_4574_p2 = (and_ln190_28_fu_4568_p2.read() & grp_fu_1440_p2.read());
}
void pool_write::thread_and_ln190_2_fu_3320_p2() {
and_ln190_2_fu_3320_p2 = (or_ln190_2_fu_3312_p2.read() & or_ln190_3_fu_3316_p2.read());
}
void pool_write::thread_and_ln190_30_fu_4608_p2() {
and_ln190_30_fu_4608_p2 = (or_ln190_30_fu_4600_p2.read() & or_ln190_31_fu_4604_p2.read());
}
void pool_write::thread_and_ln190_31_fu_4614_p2() {
and_ln190_31_fu_4614_p2 = (and_ln190_30_fu_4608_p2.read() & grp_fu_1452_p2.read());
}
void pool_write::thread_and_ln190_3_fu_3326_p2() {
and_ln190_3_fu_3326_p2 = (and_ln190_2_fu_3320_p2.read() & grp_fu_1428_p2.read());
}
void pool_write::thread_and_ln190_4_fu_3360_p2() {
and_ln190_4_fu_3360_p2 = (or_ln190_4_fu_3352_p2.read() & or_ln190_5_fu_3356_p2.read());
}
void pool_write::thread_and_ln190_5_fu_3366_p2() {
and_ln190_5_fu_3366_p2 = (and_ln190_4_fu_3360_p2.read() & grp_fu_1440_p2.read());
}
void pool_write::thread_and_ln190_6_fu_3400_p2() {
and_ln190_6_fu_3400_p2 = (or_ln190_6_fu_3392_p2.read() & or_ln190_7_fu_3396_p2.read());
}
void pool_write::thread_and_ln190_7_fu_3406_p2() {
and_ln190_7_fu_3406_p2 = (and_ln190_6_fu_3400_p2.read() & grp_fu_1452_p2.read());
}
void pool_write::thread_and_ln190_8_fu_3440_p2() {
and_ln190_8_fu_3440_p2 = (or_ln190_8_fu_3432_p2.read() & or_ln190_9_fu_3436_p2.read());
}
void pool_write::thread_and_ln190_9_fu_3446_p2() {
and_ln190_9_fu_3446_p2 = (and_ln190_8_fu_3440_p2.read() & grp_fu_1464_p2.read());
}
void pool_write::thread_and_ln190_fu_3280_p2() {
and_ln190_fu_3280_p2 = (or_ln190_fu_3272_p2.read() & or_ln190_1_fu_3276_p2.read());
}
void pool_write::thread_and_ln191_10_fu_5152_p2() {
and_ln191_10_fu_5152_p2 = (or_ln191_10_fu_5128_p2.read() & or_ln191_11_fu_5146_p2.read());
}
void pool_write::thread_and_ln191_11_fu_5158_p2() {
and_ln191_11_fu_5158_p2 = (and_ln191_10_fu_5152_p2.read() & grp_fu_1488_p2.read());
}
void pool_write::thread_and_ln191_12_fu_5244_p2() {
and_ln191_12_fu_5244_p2 = (or_ln191_12_fu_5220_p2.read() & or_ln191_13_fu_5238_p2.read());
}
void pool_write::thread_and_ln191_13_fu_5250_p2() {
and_ln191_13_fu_5250_p2 = (and_ln191_12_fu_5244_p2.read() & grp_fu_1494_p2.read());
}
void pool_write::thread_and_ln191_14_fu_5336_p2() {
and_ln191_14_fu_5336_p2 = (or_ln191_14_fu_5312_p2.read() & or_ln191_15_fu_5330_p2.read());
}
void pool_write::thread_and_ln191_15_fu_5342_p2() {
and_ln191_15_fu_5342_p2 = (and_ln191_14_fu_5336_p2.read() & grp_fu_1500_p2.read());
}
void pool_write::thread_and_ln191_16_fu_5428_p2() {
and_ln191_16_fu_5428_p2 = (or_ln191_16_fu_5404_p2.read() & or_ln191_17_fu_5422_p2.read());
}
void pool_write::thread_and_ln191_17_fu_5434_p2() {
and_ln191_17_fu_5434_p2 = (and_ln191_16_fu_5428_p2.read() & grp_fu_1506_p2.read());
}
void pool_write::thread_and_ln191_18_fu_5520_p2() {
and_ln191_18_fu_5520_p2 = (or_ln191_18_fu_5496_p2.read() & or_ln191_19_fu_5514_p2.read());
}
void pool_write::thread_and_ln191_19_fu_5526_p2() {
and_ln191_19_fu_5526_p2 = (and_ln191_18_fu_5520_p2.read() & grp_fu_1512_p2.read());
}
void pool_write::thread_and_ln191_1_fu_4698_p2() {
and_ln191_1_fu_4698_p2 = (and_ln191_fu_4692_p2.read() & grp_fu_1458_p2.read());
}
void pool_write::thread_and_ln191_20_fu_5612_p2() {
and_ln191_20_fu_5612_p2 = (or_ln191_20_fu_5588_p2.read() & or_ln191_21_fu_5606_p2.read());
}
void pool_write::thread_and_ln191_21_fu_5618_p2() {
and_ln191_21_fu_5618_p2 = (and_ln191_20_fu_5612_p2.read() & grp_fu_1518_p2.read());
}
void pool_write::thread_and_ln191_22_fu_5704_p2() {
and_ln191_22_fu_5704_p2 = (or_ln191_22_fu_5680_p2.read() & or_ln191_23_fu_5698_p2.read());
}
void pool_write::thread_and_ln191_23_fu_5710_p2() {
and_ln191_23_fu_5710_p2 = (and_ln191_22_fu_5704_p2.read() & grp_fu_1524_p2.read());
}
void pool_write::thread_and_ln191_24_fu_5882_p2() {
and_ln191_24_fu_5882_p2 = (or_ln191_24_fu_5858_p2.read() & or_ln191_25_fu_5876_p2.read());
}
void pool_write::thread_and_ln191_25_fu_5888_p2() {
and_ln191_25_fu_5888_p2 = (and_ln191_24_fu_5882_p2.read() & grp_fu_1530_p2.read());
}
void pool_write::thread_and_ln191_26_fu_5970_p2() {
and_ln191_26_fu_5970_p2 = (or_ln191_26_fu_5946_p2.read() & or_ln191_27_fu_5964_p2.read());
}
void pool_write::thread_and_ln191_27_fu_5976_p2() {
and_ln191_27_fu_5976_p2 = (and_ln191_26_fu_5970_p2.read() & grp_fu_1536_p2.read());
}
void pool_write::thread_and_ln191_28_fu_6058_p2() {
and_ln191_28_fu_6058_p2 = (or_ln191_28_fu_6034_p2.read() & or_ln191_29_fu_6052_p2.read());
}
void pool_write::thread_and_ln191_29_fu_6064_p2() {
and_ln191_29_fu_6064_p2 = (and_ln191_28_fu_6058_p2.read() & grp_fu_1542_p2.read());
}
void pool_write::thread_and_ln191_2_fu_4784_p2() {
and_ln191_2_fu_4784_p2 = (or_ln191_2_fu_4760_p2.read() & or_ln191_3_fu_4778_p2.read());
}
void pool_write::thread_and_ln191_30_fu_6146_p2() {
and_ln191_30_fu_6146_p2 = (or_ln191_30_fu_6122_p2.read() & or_ln191_31_fu_6140_p2.read());
}
void pool_write::thread_and_ln191_31_fu_6152_p2() {
and_ln191_31_fu_6152_p2 = (and_ln191_30_fu_6146_p2.read() & grp_fu_1548_p2.read());
}
void pool_write::thread_and_ln191_3_fu_4790_p2() {
and_ln191_3_fu_4790_p2 = (and_ln191_2_fu_4784_p2.read() & grp_fu_1464_p2.read());
}
void pool_write::thread_and_ln191_4_fu_4876_p2() {
and_ln191_4_fu_4876_p2 = (or_ln191_4_fu_4852_p2.read() & or_ln191_5_fu_4870_p2.read());
}
void pool_write::thread_and_ln191_5_fu_4882_p2() {
and_ln191_5_fu_4882_p2 = (and_ln191_4_fu_4876_p2.read() & grp_fu_1470_p2.read());
}
void pool_write::thread_and_ln191_6_fu_4968_p2() {
and_ln191_6_fu_4968_p2 = (or_ln191_6_fu_4944_p2.read() & or_ln191_7_fu_4962_p2.read());
}
void pool_write::thread_and_ln191_7_fu_4974_p2() {
and_ln191_7_fu_4974_p2 = (and_ln191_6_fu_4968_p2.read() & grp_fu_1476_p2.read());
}
void pool_write::thread_and_ln191_8_fu_5060_p2() {
and_ln191_8_fu_5060_p2 = (or_ln191_8_fu_5036_p2.read() & or_ln191_9_fu_5054_p2.read());
}
void pool_write::thread_and_ln191_9_fu_5066_p2() {
and_ln191_9_fu_5066_p2 = (and_ln191_8_fu_5060_p2.read() & grp_fu_1482_p2.read());
}
void pool_write::thread_and_ln191_fu_4692_p2() {
and_ln191_fu_4692_p2 = (or_ln191_fu_4668_p2.read() & or_ln191_1_fu_4686_p2.read());
}
void pool_write::thread_ap_CS_fsm_pp0_stage0() {
ap_CS_fsm_pp0_stage0 = ap_CS_fsm.read()[1];
}
void pool_write::thread_ap_CS_fsm_pp0_stage1() {
ap_CS_fsm_pp0_stage1 = ap_CS_fsm.read()[2];
}
void pool_write::thread_ap_CS_fsm_state1() {
ap_CS_fsm_state1 = ap_CS_fsm.read()[0];
}
void pool_write::thread_ap_CS_fsm_state11() {
ap_CS_fsm_state11 = ap_CS_fsm.read()[3];
}
void pool_write::thread_ap_block_pp0_stage0() {
ap_block_pp0_stage0 = !esl_seteq<1,1,1>(ap_const_boolean_1, ap_const_boolean_1);
}
void pool_write::thread_ap_block_pp0_stage0_00001() {
ap_block_pp0_stage0_00001 = !esl_seteq<1,1,1>(ap_const_boolean_1, ap_const_boolean_1);
}
void pool_write::thread_ap_block_pp0_stage0_11001() {
ap_block_pp0_stage0_11001 = !esl_seteq<1,1,1>(ap_const_boolean_1, ap_const_boolean_1);
}
void pool_write::thread_ap_block_pp0_stage0_subdone() {
ap_block_pp0_stage0_subdone = !esl_seteq<1,1,1>(ap_const_boolean_1, ap_const_boolean_1);
}
void pool_write::thread_ap_block_pp0_stage1() {
ap_block_pp0_stage1 = !esl_seteq<1,1,1>(ap_const_boolean_1, ap_const_boolean_1);
}
void pool_write::thread_ap_block_pp0_stage1_00001() {
ap_block_pp0_stage1_00001 = !esl_seteq<1,1,1>(ap_const_boolean_1, ap_const_boolean_1);
}
void pool_write::thread_ap_block_pp0_stage1_11001() {
ap_block_pp0_stage1_11001 = !esl_seteq<1,1,1>(ap_const_boolean_1, ap_const_boolean_1);
}
void pool_write::thread_ap_block_pp0_stage1_subdone() {
ap_block_pp0_stage1_subdone = !esl_seteq<1,1,1>(ap_const_boolean_1, ap_const_boolean_1);
}
void pool_write::thread_ap_block_state10_pp0_stage0_iter4() {
ap_block_state10_pp0_stage0_iter4 = !esl_seteq<1,1,1>(ap_const_boolean_1, ap_const_boolean_1);
}
void pool_write::thread_ap_block_state2_pp0_stage0_iter0() {
ap_block_state2_pp0_stage0_iter0 = !esl_seteq<1,1,1>(ap_const_boolean_1, ap_const_boolean_1);
}
void pool_write::thread_ap_block_state3_pp0_stage1_iter0() {
ap_block_state3_pp0_stage1_iter0 = !esl_seteq<1,1,1>(ap_const_boolean_1, ap_const_boolean_1);
}
void pool_write::thread_ap_block_state4_pp0_stage0_iter1() {
ap_block_state4_pp0_stage0_iter1 = !esl_seteq<1,1,1>(ap_const_boolean_1, ap_const_boolean_1);
}
void pool_write::thread_ap_block_state5_pp0_stage1_iter1() {
ap_block_state5_pp0_stage1_iter1 = !esl_seteq<1,1,1>(ap_const_boolean_1, ap_const_boolean_1);
}
void pool_write::thread_ap_block_state6_pp0_stage0_iter2() {
ap_block_state6_pp0_stage0_iter2 = !esl_seteq<1,1,1>(ap_const_boolean_1, ap_const_boolean_1);
}
void pool_write::thread_ap_block_state7_pp0_stage1_iter2() {
ap_block_state7_pp0_stage1_iter2 = !esl_seteq<1,1,1>(ap_const_boolean_1, ap_const_boolean_1);
}
void pool_write::thread_ap_block_state8_pp0_stage0_iter3() {
ap_block_state8_pp0_stage0_iter3 = !esl_seteq<1,1,1>(ap_const_boolean_1, ap_const_boolean_1);
}
void pool_write::thread_ap_block_state9_pp0_stage1_iter3() {
ap_block_state9_pp0_stage1_iter3 = !esl_seteq<1,1,1>(ap_const_boolean_1, ap_const_boolean_1);
}
void pool_write::thread_ap_condition_pp0_exit_iter0_state2() {
if (esl_seteq<1,1,1>(icmp_ln179_fu_1728_p2.read(), ap_const_lv1_1)) {
ap_condition_pp0_exit_iter0_state2 = ap_const_logic_1;
} else {
ap_condition_pp0_exit_iter0_state2 = ap_const_logic_0;
}
}
void pool_write::thread_ap_done() {
if (((esl_seteq<1,1,1>(ap_const_logic_0, ap_start.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_state1.read())) ||
esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_state11.read()))) {
ap_done = ap_const_logic_1;
} else {
ap_done = ap_const_logic_0;
}
}
void pool_write::thread_ap_enable_pp0() {
ap_enable_pp0 = (ap_idle_pp0.read() ^ ap_const_logic_1);
}
void pool_write::thread_ap_idle() {
if ((esl_seteq<1,1,1>(ap_const_logic_0, ap_start.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_state1.read()))) {
ap_idle = ap_const_logic_1;
} else {
ap_idle = ap_const_logic_0;
}
}
void pool_write::thread_ap_idle_pp0() {
if ((esl_seteq<1,1,1>(ap_const_logic_0, ap_enable_reg_pp0_iter0.read()) &&
esl_seteq<1,1,1>(ap_const_logic_0, ap_enable_reg_pp0_iter1.read()) &&
esl_seteq<1,1,1>(ap_const_logic_0, ap_enable_reg_pp0_iter2.read()) &&
esl_seteq<1,1,1>(ap_const_logic_0, ap_enable_reg_pp0_iter3.read()) &&
esl_seteq<1,1,1>(ap_const_logic_0, ap_enable_reg_pp0_iter4.read()))) {
ap_idle_pp0 = ap_const_logic_1;
} else {
ap_idle_pp0 = ap_const_logic_0;
}
}
void pool_write::thread_ap_phi_mux_col_0_phi_fu_1402_p4() {
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(icmp_ln179_reg_6164.read(), ap_const_lv1_0) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter1.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0.read(), ap_const_boolean_0))) {
ap_phi_mux_col_0_phi_fu_1402_p4 = col_reg_6168.read();
} else {
ap_phi_mux_col_0_phi_fu_1402_p4 = col_0_reg_1398.read();
}
}
void pool_write::thread_ap_ready() {
if (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_state11.read())) {
ap_ready = ap_const_logic_1;
} else {
ap_ready = ap_const_logic_0;
}
}
void pool_write::thread_bitcast_ln189_10_fu_2412_p1() {
bitcast_ln189_10_fu_2412_p1 = ifm_buff0_5_q0.read();
}
void pool_write::thread_bitcast_ln189_11_fu_2430_p1() {
bitcast_ln189_11_fu_2430_p1 = ifm_buff0_5_q1.read();
}
void pool_write::thread_bitcast_ln189_12_fu_2532_p1() {
bitcast_ln189_12_fu_2532_p1 = ifm_buff0_6_q0.read();
}
void pool_write::thread_bitcast_ln189_13_fu_2550_p1() {
bitcast_ln189_13_fu_2550_p1 = ifm_buff0_6_q1.read();
}
void pool_write::thread_bitcast_ln189_14_fu_2652_p1() {
bitcast_ln189_14_fu_2652_p1 = ifm_buff0_7_q0.read();
}
void pool_write::thread_bitcast_ln189_15_fu_2670_p1() {
bitcast_ln189_15_fu_2670_p1 = ifm_buff0_7_q1.read();
}
void pool_write::thread_bitcast_ln189_16_fu_2772_p1() {
bitcast_ln189_16_fu_2772_p1 = ifm_buff0_8_q0.read();
}
void pool_write::thread_bitcast_ln189_17_fu_2790_p1() {
bitcast_ln189_17_fu_2790_p1 = ifm_buff0_8_q1.read();
}
void pool_write::thread_bitcast_ln189_18_fu_2892_p1() {
bitcast_ln189_18_fu_2892_p1 = ifm_buff0_9_q0.read();
}
void pool_write::thread_bitcast_ln189_19_fu_2910_p1() {
bitcast_ln189_19_fu_2910_p1 = ifm_buff0_9_q1.read();
}
void pool_write::thread_bitcast_ln189_1_fu_1830_p1() {
bitcast_ln189_1_fu_1830_p1 = ifm_buff0_0_q1.read();
}
void pool_write::thread_bitcast_ln189_20_fu_3012_p1() {
bitcast_ln189_20_fu_3012_p1 = ifm_buff0_10_q0.read();
}
void pool_write::thread_bitcast_ln189_21_fu_3030_p1() {
bitcast_ln189_21_fu_3030_p1 = ifm_buff0_10_q1.read();
}
void pool_write::thread_bitcast_ln189_22_fu_3132_p1() {
bitcast_ln189_22_fu_3132_p1 = ifm_buff0_11_q0.read();
}
void pool_write::thread_bitcast_ln189_23_fu_3150_p1() {
bitcast_ln189_23_fu_3150_p1 = ifm_buff0_11_q1.read();
}
void pool_write::thread_bitcast_ln189_24_fu_3732_p1() {
bitcast_ln189_24_fu_3732_p1 = ifm_buff0_12_load_reg_7145.read();
}
void pool_write::thread_bitcast_ln189_25_fu_3749_p1() {
bitcast_ln189_25_fu_3749_p1 = ifm_buff0_12_load_1_reg_7151.read();
}
void pool_write::thread_bitcast_ln189_26_fu_3848_p1() {
bitcast_ln189_26_fu_3848_p1 = ifm_buff0_13_load_reg_7169.read();
}
void pool_write::thread_bitcast_ln189_27_fu_3865_p1() {
bitcast_ln189_27_fu_3865_p1 = ifm_buff0_13_load_1_reg_7175.read();
}
void pool_write::thread_bitcast_ln189_28_fu_3964_p1() {
bitcast_ln189_28_fu_3964_p1 = ifm_buff0_14_load_reg_7193.read();
}
void pool_write::thread_bitcast_ln189_29_fu_3981_p1() {
bitcast_ln189_29_fu_3981_p1 = ifm_buff0_14_load_1_reg_7199.read();
}
void pool_write::thread_bitcast_ln189_2_fu_1932_p1() {
bitcast_ln189_2_fu_1932_p1 = ifm_buff0_1_q0.read();
}
void pool_write::thread_bitcast_ln189_30_fu_4080_p1() {
bitcast_ln189_30_fu_4080_p1 = ifm_buff0_15_load_reg_7217.read();
}
void pool_write::thread_bitcast_ln189_31_fu_4097_p1() {
bitcast_ln189_31_fu_4097_p1 = ifm_buff0_15_load_1_reg_7223.read();
}
void pool_write::thread_bitcast_ln189_3_fu_1950_p1() {
bitcast_ln189_3_fu_1950_p1 = ifm_buff0_1_q1.read();
}
void pool_write::thread_bitcast_ln189_4_fu_2052_p1() {
bitcast_ln189_4_fu_2052_p1 = ifm_buff0_2_q0.read();
}
void pool_write::thread_bitcast_ln189_5_fu_2070_p1() {
bitcast_ln189_5_fu_2070_p1 = ifm_buff0_2_q1.read();
}
void pool_write::thread_bitcast_ln189_6_fu_2172_p1() {
bitcast_ln189_6_fu_2172_p1 = ifm_buff0_3_q0.read();
}
void pool_write::thread_bitcast_ln189_7_fu_2190_p1() {
bitcast_ln189_7_fu_2190_p1 = ifm_buff0_3_q1.read();
}
void pool_write::thread_bitcast_ln189_8_fu_2292_p1() {
bitcast_ln189_8_fu_2292_p1 = ifm_buff0_4_q0.read();
}
void pool_write::thread_bitcast_ln189_9_fu_2310_p1() {
bitcast_ln189_9_fu_2310_p1 = ifm_buff0_4_q1.read();
}
void pool_write::thread_bitcast_ln189_fu_1812_p1() {
bitcast_ln189_fu_1812_p1 = ifm_buff0_0_q0.read();
}
void pool_write::thread_bitcast_ln190_10_fu_2472_p1() {
bitcast_ln190_10_fu_2472_p1 = ifm_buff1_5_q0.read();
}
void pool_write::thread_bitcast_ln190_11_fu_2490_p1() {
bitcast_ln190_11_fu_2490_p1 = ifm_buff1_5_q1.read();
}
void pool_write::thread_bitcast_ln190_12_fu_2592_p1() {
bitcast_ln190_12_fu_2592_p1 = ifm_buff1_6_q0.read();
}
void pool_write::thread_bitcast_ln190_13_fu_2610_p1() {
bitcast_ln190_13_fu_2610_p1 = ifm_buff1_6_q1.read();
}
void pool_write::thread_bitcast_ln190_14_fu_2712_p1() {
bitcast_ln190_14_fu_2712_p1 = ifm_buff1_7_q0.read();
}
void pool_write::thread_bitcast_ln190_15_fu_2730_p1() {
bitcast_ln190_15_fu_2730_p1 = ifm_buff1_7_q1.read();
}
void pool_write::thread_bitcast_ln190_16_fu_2832_p1() {
bitcast_ln190_16_fu_2832_p1 = ifm_buff1_8_q0.read();
}
void pool_write::thread_bitcast_ln190_17_fu_2850_p1() {
bitcast_ln190_17_fu_2850_p1 = ifm_buff1_8_q1.read();
}
void pool_write::thread_bitcast_ln190_18_fu_2952_p1() {
bitcast_ln190_18_fu_2952_p1 = ifm_buff1_9_q0.read();
}
void pool_write::thread_bitcast_ln190_19_fu_2970_p1() {
bitcast_ln190_19_fu_2970_p1 = ifm_buff1_9_q1.read();
}
void pool_write::thread_bitcast_ln190_1_fu_1890_p1() {
bitcast_ln190_1_fu_1890_p1 = ifm_buff1_0_q1.read();
}
void pool_write::thread_bitcast_ln190_20_fu_3072_p1() {
bitcast_ln190_20_fu_3072_p1 = ifm_buff1_10_q0.read();
}
void pool_write::thread_bitcast_ln190_21_fu_3090_p1() {
bitcast_ln190_21_fu_3090_p1 = ifm_buff1_10_q1.read();
}
void pool_write::thread_bitcast_ln190_22_fu_3192_p1() {
bitcast_ln190_22_fu_3192_p1 = ifm_buff1_11_q0.read();
}
void pool_write::thread_bitcast_ln190_23_fu_3210_p1() {
bitcast_ln190_23_fu_3210_p1 = ifm_buff1_11_q1.read();
}
void pool_write::thread_bitcast_ln190_24_fu_3790_p1() {
bitcast_ln190_24_fu_3790_p1 = ifm_buff1_12_load_reg_7157.read();
}
void pool_write::thread_bitcast_ln190_25_fu_3807_p1() {
bitcast_ln190_25_fu_3807_p1 = ifm_buff1_12_load_1_reg_7163.read();
}
void pool_write::thread_bitcast_ln190_26_fu_3906_p1() {
bitcast_ln190_26_fu_3906_p1 = ifm_buff1_13_load_reg_7181.read();
}
void pool_write::thread_bitcast_ln190_27_fu_3923_p1() {
bitcast_ln190_27_fu_3923_p1 = ifm_buff1_13_load_1_reg_7187.read();
}
void pool_write::thread_bitcast_ln190_28_fu_4022_p1() {
bitcast_ln190_28_fu_4022_p1 = ifm_buff1_14_load_reg_7205.read();
}
void pool_write::thread_bitcast_ln190_29_fu_4039_p1() {
bitcast_ln190_29_fu_4039_p1 = ifm_buff1_14_load_1_reg_7211.read();
}
void pool_write::thread_bitcast_ln190_2_fu_1992_p1() {
bitcast_ln190_2_fu_1992_p1 = ifm_buff1_1_q0.read();
}
void pool_write::thread_bitcast_ln190_30_fu_4138_p1() {
bitcast_ln190_30_fu_4138_p1 = ifm_buff1_15_load_reg_7229.read();
}
void pool_write::thread_bitcast_ln190_31_fu_4155_p1() {
bitcast_ln190_31_fu_4155_p1 = ifm_buff1_15_load_1_reg_7235.read();
}
void pool_write::thread_bitcast_ln190_3_fu_2010_p1() {
bitcast_ln190_3_fu_2010_p1 = ifm_buff1_1_q1.read();
}
void pool_write::thread_bitcast_ln190_4_fu_2112_p1() {
bitcast_ln190_4_fu_2112_p1 = ifm_buff1_2_q0.read();
}
void pool_write::thread_bitcast_ln190_5_fu_2130_p1() {
bitcast_ln190_5_fu_2130_p1 = ifm_buff1_2_q1.read();
}
void pool_write::thread_bitcast_ln190_6_fu_2232_p1() {
bitcast_ln190_6_fu_2232_p1 = ifm_buff1_3_q0.read();
}
void pool_write::thread_bitcast_ln190_7_fu_2250_p1() {
bitcast_ln190_7_fu_2250_p1 = ifm_buff1_3_q1.read();
}
void pool_write::thread_bitcast_ln190_8_fu_2352_p1() {
bitcast_ln190_8_fu_2352_p1 = ifm_buff1_4_q0.read();
}
void pool_write::thread_bitcast_ln190_9_fu_2370_p1() {
bitcast_ln190_9_fu_2370_p1 = ifm_buff1_4_q1.read();
}
void pool_write::thread_bitcast_ln190_fu_1872_p1() {
bitcast_ln190_fu_1872_p1 = ifm_buff1_0_q0.read();
}
void pool_write::thread_bitcast_ln191_10_fu_5080_p1() {
bitcast_ln191_10_fu_5080_p1 = reg_1645.read();
}
void pool_write::thread_bitcast_ln191_11_fu_5098_p1() {
bitcast_ln191_11_fu_5098_p1 = reg_1651.read();
}
void pool_write::thread_bitcast_ln191_12_fu_5172_p1() {
bitcast_ln191_12_fu_5172_p1 = reg_1657.read();
}
void pool_write::thread_bitcast_ln191_13_fu_5190_p1() {
bitcast_ln191_13_fu_5190_p1 = reg_1663.read();
}
void pool_write::thread_bitcast_ln191_14_fu_5264_p1() {
bitcast_ln191_14_fu_5264_p1 = reg_1669.read();
}
void pool_write::thread_bitcast_ln191_15_fu_5282_p1() {
bitcast_ln191_15_fu_5282_p1 = reg_1675.read();
}
void pool_write::thread_bitcast_ln191_16_fu_5356_p1() {
bitcast_ln191_16_fu_5356_p1 = reg_1681.read();
}
void pool_write::thread_bitcast_ln191_17_fu_5374_p1() {
bitcast_ln191_17_fu_5374_p1 = reg_1686.read();
}
void pool_write::thread_bitcast_ln191_18_fu_5448_p1() {
bitcast_ln191_18_fu_5448_p1 = reg_1692.read();
}
void pool_write::thread_bitcast_ln191_19_fu_5466_p1() {
bitcast_ln191_19_fu_5466_p1 = reg_1698.read();
}
void pool_write::thread_bitcast_ln191_1_fu_4638_p1() {
bitcast_ln191_1_fu_4638_p1 = reg_1591.read();
}
void pool_write::thread_bitcast_ln191_20_fu_5540_p1() {
bitcast_ln191_20_fu_5540_p1 = reg_1704.read();
}
void pool_write::thread_bitcast_ln191_21_fu_5558_p1() {
bitcast_ln191_21_fu_5558_p1 = reg_1710.read();
}
void pool_write::thread_bitcast_ln191_22_fu_5632_p1() {
bitcast_ln191_22_fu_5632_p1 = reg_1716.read();
}
void pool_write::thread_bitcast_ln191_23_fu_5650_p1() {
bitcast_ln191_23_fu_5650_p1 = reg_1722.read();
}
void pool_write::thread_bitcast_ln191_24_fu_5812_p1() {
bitcast_ln191_24_fu_5812_p1 = ifm_buff0_12_load_2_reg_7781.read();
}
void pool_write::thread_bitcast_ln191_25_fu_5829_p1() {
bitcast_ln191_25_fu_5829_p1 = ifm_buff1_12_load_2_reg_7788.read();
}
void pool_write::thread_bitcast_ln191_26_fu_5900_p1() {
bitcast_ln191_26_fu_5900_p1 = ifm_buff0_13_load_2_reg_7795.read();
}
void pool_write::thread_bitcast_ln191_27_fu_5917_p1() {
bitcast_ln191_27_fu_5917_p1 = ifm_buff1_13_load_2_reg_7802.read();
}
void pool_write::thread_bitcast_ln191_28_fu_5988_p1() {
bitcast_ln191_28_fu_5988_p1 = ifm_buff0_14_load_2_reg_7809.read();
}
void pool_write::thread_bitcast_ln191_29_fu_6005_p1() {
bitcast_ln191_29_fu_6005_p1 = ifm_buff1_14_load_2_reg_7816.read();
}
void pool_write::thread_bitcast_ln191_2_fu_4712_p1() {
bitcast_ln191_2_fu_4712_p1 = reg_1597.read();
}
void pool_write::thread_bitcast_ln191_30_fu_6076_p1() {
bitcast_ln191_30_fu_6076_p1 = ifm_buff0_15_load_2_reg_7823.read();
}
void pool_write::thread_bitcast_ln191_31_fu_6093_p1() {
bitcast_ln191_31_fu_6093_p1 = ifm_buff1_15_load_2_reg_7830.read();
}
void pool_write::thread_bitcast_ln191_3_fu_4730_p1() {
bitcast_ln191_3_fu_4730_p1 = reg_1603.read();
}
void pool_write::thread_bitcast_ln191_4_fu_4804_p1() {
bitcast_ln191_4_fu_4804_p1 = reg_1609.read();
}
void pool_write::thread_bitcast_ln191_5_fu_4822_p1() {
bitcast_ln191_5_fu_4822_p1 = reg_1615.read();
}
void pool_write::thread_bitcast_ln191_6_fu_4896_p1() {
bitcast_ln191_6_fu_4896_p1 = reg_1621.read();
}
void pool_write::thread_bitcast_ln191_7_fu_4914_p1() {
bitcast_ln191_7_fu_4914_p1 = reg_1627.read();
}
void pool_write::thread_bitcast_ln191_8_fu_4988_p1() {
bitcast_ln191_8_fu_4988_p1 = reg_1633.read();
}
void pool_write::thread_bitcast_ln191_9_fu_5006_p1() {
bitcast_ln191_9_fu_5006_p1 = reg_1639.read();
}
void pool_write::thread_bitcast_ln191_fu_4620_p1() {
bitcast_ln191_fu_4620_p1 = reg_1585.read();
}
void pool_write::thread_col_fu_1734_p2() {
col_fu_1734_p2 = (!ap_phi_mux_col_0_phi_fu_1402_p4.read().is_01() || !ap_const_lv6_1.is_01())? sc_lv<6>(): (sc_biguint<6>(ap_phi_mux_col_0_phi_fu_1402_p4.read()) + sc_biguint<6>(ap_const_lv6_1));
}
void pool_write::thread_grp_fu_1410_p0() {
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter1.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0.read(), ap_const_boolean_0))) {
grp_fu_1410_p0 = ifm_buff0_12_load_reg_7145.read();
} else if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage1.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage1.read(), ap_const_boolean_0))) {
grp_fu_1410_p0 = ifm_buff0_0_q0.read();
} else {
grp_fu_1410_p0 = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
}
}
void pool_write::thread_grp_fu_1410_p1() {
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter1.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0.read(), ap_const_boolean_0))) {
grp_fu_1410_p1 = ifm_buff0_12_load_1_reg_7151.read();
} else if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage1.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage1.read(), ap_const_boolean_0))) {
grp_fu_1410_p1 = ifm_buff0_0_q1.read();
} else {
grp_fu_1410_p1 = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
}
}
void pool_write::thread_grp_fu_1416_p0() {
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter1.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0.read(), ap_const_boolean_0))) {
grp_fu_1416_p0 = ifm_buff1_12_load_reg_7157.read();
} else if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage1.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage1.read(), ap_const_boolean_0))) {
grp_fu_1416_p0 = ifm_buff1_0_q0.read();
} else {
grp_fu_1416_p0 = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
}
}
void pool_write::thread_grp_fu_1416_p1() {
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter1.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0.read(), ap_const_boolean_0))) {
grp_fu_1416_p1 = ifm_buff1_12_load_1_reg_7163.read();
} else if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage1.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage1.read(), ap_const_boolean_0))) {
grp_fu_1416_p1 = ifm_buff1_0_q1.read();
} else {
grp_fu_1416_p1 = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
}
}
void pool_write::thread_grp_fu_1422_p0() {
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter1.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0.read(), ap_const_boolean_0))) {
grp_fu_1422_p0 = ifm_buff0_13_load_reg_7169.read();
} else if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage1.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage1.read(), ap_const_boolean_0))) {
grp_fu_1422_p0 = ifm_buff0_1_q0.read();
} else {
grp_fu_1422_p0 = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
}
}
void pool_write::thread_grp_fu_1422_p1() {
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter1.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0.read(), ap_const_boolean_0))) {
grp_fu_1422_p1 = ifm_buff0_13_load_1_reg_7175.read();
} else if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage1.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage1.read(), ap_const_boolean_0))) {
grp_fu_1422_p1 = ifm_buff0_1_q1.read();
} else {
grp_fu_1422_p1 = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
}
}
void pool_write::thread_grp_fu_1428_p0() {
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter1.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0.read(), ap_const_boolean_0))) {
grp_fu_1428_p0 = ifm_buff1_13_load_reg_7181.read();
} else if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage1.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage1.read(), ap_const_boolean_0))) {
grp_fu_1428_p0 = ifm_buff1_1_q0.read();
} else {
grp_fu_1428_p0 = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
}
}
void pool_write::thread_grp_fu_1428_p1() {
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter1.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0.read(), ap_const_boolean_0))) {
grp_fu_1428_p1 = ifm_buff1_13_load_1_reg_7187.read();
} else if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage1.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage1.read(), ap_const_boolean_0))) {
grp_fu_1428_p1 = ifm_buff1_1_q1.read();
} else {
grp_fu_1428_p1 = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
}
}
void pool_write::thread_grp_fu_1434_p0() {
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter1.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0.read(), ap_const_boolean_0))) {
grp_fu_1434_p0 = ifm_buff0_14_load_reg_7193.read();
} else if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage1.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage1.read(), ap_const_boolean_0))) {
grp_fu_1434_p0 = ifm_buff0_2_q0.read();
} else {
grp_fu_1434_p0 = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
}
}
void pool_write::thread_grp_fu_1434_p1() {
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter1.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0.read(), ap_const_boolean_0))) {
grp_fu_1434_p1 = ifm_buff0_14_load_1_reg_7199.read();
} else if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage1.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage1.read(), ap_const_boolean_0))) {
grp_fu_1434_p1 = ifm_buff0_2_q1.read();
} else {
grp_fu_1434_p1 = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
}
}
void pool_write::thread_grp_fu_1440_p0() {
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter1.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0.read(), ap_const_boolean_0))) {
grp_fu_1440_p0 = ifm_buff1_14_load_reg_7205.read();
} else if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage1.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage1.read(), ap_const_boolean_0))) {
grp_fu_1440_p0 = ifm_buff1_2_q0.read();
} else {
grp_fu_1440_p0 = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
}
}
void pool_write::thread_grp_fu_1440_p1() {
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter1.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0.read(), ap_const_boolean_0))) {
grp_fu_1440_p1 = ifm_buff1_14_load_1_reg_7211.read();
} else if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage1.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage1.read(), ap_const_boolean_0))) {
grp_fu_1440_p1 = ifm_buff1_2_q1.read();
} else {
grp_fu_1440_p1 = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
}
}
void pool_write::thread_grp_fu_1446_p0() {
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter1.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0.read(), ap_const_boolean_0))) {
grp_fu_1446_p0 = ifm_buff0_15_load_reg_7217.read();
} else if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage1.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage1.read(), ap_const_boolean_0))) {
grp_fu_1446_p0 = ifm_buff0_3_q0.read();
} else {
grp_fu_1446_p0 = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
}
}
void pool_write::thread_grp_fu_1446_p1() {
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter1.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0.read(), ap_const_boolean_0))) {
grp_fu_1446_p1 = ifm_buff0_15_load_1_reg_7223.read();
} else if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage1.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage1.read(), ap_const_boolean_0))) {
grp_fu_1446_p1 = ifm_buff0_3_q1.read();
} else {
grp_fu_1446_p1 = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
}
}
void pool_write::thread_grp_fu_1452_p0() {
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter1.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0.read(), ap_const_boolean_0))) {
grp_fu_1452_p0 = ifm_buff1_15_load_reg_7229.read();
} else if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage1.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage1.read(), ap_const_boolean_0))) {
grp_fu_1452_p0 = ifm_buff1_3_q0.read();
} else {
grp_fu_1452_p0 = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
}
}
void pool_write::thread_grp_fu_1452_p1() {
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter1.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0.read(), ap_const_boolean_0))) {
grp_fu_1452_p1 = ifm_buff1_15_load_1_reg_7235.read();
} else if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage1.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage1.read(), ap_const_boolean_0))) {
grp_fu_1452_p1 = ifm_buff1_3_q1.read();
} else {
grp_fu_1452_p1 = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
}
}
void pool_write::thread_grp_fu_1458_p0() {
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter2.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0.read(), ap_const_boolean_0))) {
grp_fu_1458_p0 = ifm_buff0_0_q0.read();
} else if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage1.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage1.read(), ap_const_boolean_0))) {
grp_fu_1458_p0 = ifm_buff0_4_q0.read();
} else {
grp_fu_1458_p0 = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
}
}
void pool_write::thread_grp_fu_1458_p1() {
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter2.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0.read(), ap_const_boolean_0))) {
grp_fu_1458_p1 = ifm_buff1_0_q0.read();
} else if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage1.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage1.read(), ap_const_boolean_0))) {
grp_fu_1458_p1 = ifm_buff0_4_q1.read();
} else {
grp_fu_1458_p1 = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
}
}
void pool_write::thread_grp_fu_1464_p0() {
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter2.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0.read(), ap_const_boolean_0))) {
grp_fu_1464_p0 = ifm_buff0_1_q0.read();
} else if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage1.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage1.read(), ap_const_boolean_0))) {
grp_fu_1464_p0 = ifm_buff1_4_q0.read();
} else {
grp_fu_1464_p0 = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
}
}
void pool_write::thread_grp_fu_1464_p1() {
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter2.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0.read(), ap_const_boolean_0))) {
grp_fu_1464_p1 = ifm_buff1_1_q0.read();
} else if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage1.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage1.read(), ap_const_boolean_0))) {
grp_fu_1464_p1 = ifm_buff1_4_q1.read();
} else {
grp_fu_1464_p1 = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
}
}
void pool_write::thread_grp_fu_1470_p0() {
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter2.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0.read(), ap_const_boolean_0))) {
grp_fu_1470_p0 = ifm_buff0_2_q0.read();
} else if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage1.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage1.read(), ap_const_boolean_0))) {
grp_fu_1470_p0 = ifm_buff0_5_q0.read();
} else {
grp_fu_1470_p0 = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
}
}
void pool_write::thread_grp_fu_1470_p1() {
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter2.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0.read(), ap_const_boolean_0))) {
grp_fu_1470_p1 = ifm_buff1_2_q0.read();
} else if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage1.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage1.read(), ap_const_boolean_0))) {
grp_fu_1470_p1 = ifm_buff0_5_q1.read();
} else {
grp_fu_1470_p1 = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
}
}
void pool_write::thread_grp_fu_1476_p0() {
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter2.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0.read(), ap_const_boolean_0))) {
grp_fu_1476_p0 = ifm_buff0_3_q0.read();
} else if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage1.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage1.read(), ap_const_boolean_0))) {
grp_fu_1476_p0 = ifm_buff1_5_q0.read();
} else {
grp_fu_1476_p0 = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
}
}
void pool_write::thread_grp_fu_1476_p1() {
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter2.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0.read(), ap_const_boolean_0))) {
grp_fu_1476_p1 = ifm_buff1_3_q0.read();
} else if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage1.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage1.read(), ap_const_boolean_0))) {
grp_fu_1476_p1 = ifm_buff1_5_q1.read();
} else {
grp_fu_1476_p1 = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
}
}
void pool_write::thread_grp_fu_1482_p0() {
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter2.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0.read(), ap_const_boolean_0))) {
grp_fu_1482_p0 = ifm_buff0_4_q0.read();
} else if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage1.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage1.read(), ap_const_boolean_0))) {
grp_fu_1482_p0 = ifm_buff0_6_q0.read();
} else {
grp_fu_1482_p0 = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
}
}
void pool_write::thread_grp_fu_1482_p1() {
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter2.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0.read(), ap_const_boolean_0))) {
grp_fu_1482_p1 = ifm_buff1_4_q0.read();
} else if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage1.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage1.read(), ap_const_boolean_0))) {
grp_fu_1482_p1 = ifm_buff0_6_q1.read();
} else {
grp_fu_1482_p1 = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
}
}
void pool_write::thread_grp_fu_1488_p0() {
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter2.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0.read(), ap_const_boolean_0))) {
grp_fu_1488_p0 = ifm_buff0_5_q0.read();
} else if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage1.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage1.read(), ap_const_boolean_0))) {
grp_fu_1488_p0 = ifm_buff1_6_q0.read();
} else {
grp_fu_1488_p0 = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
}
}
void pool_write::thread_grp_fu_1488_p1() {
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter2.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0.read(), ap_const_boolean_0))) {
grp_fu_1488_p1 = ifm_buff1_5_q0.read();
} else if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage1.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage1.read(), ap_const_boolean_0))) {
grp_fu_1488_p1 = ifm_buff1_6_q1.read();
} else {
grp_fu_1488_p1 = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
}
}
void pool_write::thread_grp_fu_1494_p0() {
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter2.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0.read(), ap_const_boolean_0))) {
grp_fu_1494_p0 = ifm_buff0_6_q0.read();
} else if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage1.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage1.read(), ap_const_boolean_0))) {
grp_fu_1494_p0 = ifm_buff0_7_q0.read();
} else {
grp_fu_1494_p0 = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
}
}
void pool_write::thread_grp_fu_1494_p1() {
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter2.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0.read(), ap_const_boolean_0))) {
grp_fu_1494_p1 = ifm_buff1_6_q0.read();
} else if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage1.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage1.read(), ap_const_boolean_0))) {
grp_fu_1494_p1 = ifm_buff0_7_q1.read();
} else {
grp_fu_1494_p1 = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
}
}
void pool_write::thread_grp_fu_1500_p0() {
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter2.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0.read(), ap_const_boolean_0))) {
grp_fu_1500_p0 = ifm_buff0_7_q0.read();
} else if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage1.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage1.read(), ap_const_boolean_0))) {
grp_fu_1500_p0 = ifm_buff1_7_q0.read();
} else {
grp_fu_1500_p0 = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
}
}
void pool_write::thread_grp_fu_1500_p1() {
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter2.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0.read(), ap_const_boolean_0))) {
grp_fu_1500_p1 = ifm_buff1_7_q0.read();
} else if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage1.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage1.read(), ap_const_boolean_0))) {
grp_fu_1500_p1 = ifm_buff1_7_q1.read();
} else {
grp_fu_1500_p1 = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
}
}
void pool_write::thread_grp_fu_1506_p1() {
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter2.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0.read(), ap_const_boolean_0))) {
grp_fu_1506_p1 = ifm_buff1_8_q0.read();
} else if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage1.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage1.read(), ap_const_boolean_0))) {
grp_fu_1506_p1 = ifm_buff0_8_q1.read();
} else {
grp_fu_1506_p1 = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
}
}
void pool_write::thread_grp_fu_1512_p0() {
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter2.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0.read(), ap_const_boolean_0))) {
grp_fu_1512_p0 = ifm_buff0_9_q0.read();
} else if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage1.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage1.read(), ap_const_boolean_0))) {
grp_fu_1512_p0 = ifm_buff1_8_q0.read();
} else {
grp_fu_1512_p0 = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
}
}
void pool_write::thread_grp_fu_1512_p1() {
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter2.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0.read(), ap_const_boolean_0))) {
grp_fu_1512_p1 = ifm_buff1_9_q0.read();
} else if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage1.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage1.read(), ap_const_boolean_0))) {
grp_fu_1512_p1 = ifm_buff1_8_q1.read();
} else {
grp_fu_1512_p1 = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
}
}
void pool_write::thread_grp_fu_1518_p0() {
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter2.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0.read(), ap_const_boolean_0))) {
grp_fu_1518_p0 = ifm_buff0_10_q0.read();
} else if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage1.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage1.read(), ap_const_boolean_0))) {
grp_fu_1518_p0 = ifm_buff0_9_q0.read();
} else {
grp_fu_1518_p0 = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
}
}
void pool_write::thread_grp_fu_1518_p1() {
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter2.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0.read(), ap_const_boolean_0))) {
grp_fu_1518_p1 = ifm_buff1_10_q0.read();
} else if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage1.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage1.read(), ap_const_boolean_0))) {
grp_fu_1518_p1 = ifm_buff0_9_q1.read();
} else {
grp_fu_1518_p1 = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
}
}
void pool_write::thread_grp_fu_1524_p0() {
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter2.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0.read(), ap_const_boolean_0))) {
grp_fu_1524_p0 = ifm_buff0_11_q0.read();
} else if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage1.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage1.read(), ap_const_boolean_0))) {
grp_fu_1524_p0 = ifm_buff1_9_q0.read();
} else {
grp_fu_1524_p0 = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
}
}
void pool_write::thread_grp_fu_1524_p1() {
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter2.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0.read(), ap_const_boolean_0))) {
grp_fu_1524_p1 = ifm_buff1_11_q0.read();
} else if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage1.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage1.read(), ap_const_boolean_0))) {
grp_fu_1524_p1 = ifm_buff1_9_q1.read();
} else {
grp_fu_1524_p1 = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
}
}
void pool_write::thread_grp_fu_1530_p0() {
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter3.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0.read(), ap_const_boolean_0))) {
grp_fu_1530_p0 = ifm_buff0_12_q0.read();
} else if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage1.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage1.read(), ap_const_boolean_0))) {
grp_fu_1530_p0 = ifm_buff0_10_q0.read();
} else {
grp_fu_1530_p0 = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
}
}
void pool_write::thread_grp_fu_1530_p1() {
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter3.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0.read(), ap_const_boolean_0))) {
grp_fu_1530_p1 = ifm_buff1_12_q0.read();
} else if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage1.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage1.read(), ap_const_boolean_0))) {
grp_fu_1530_p1 = ifm_buff0_10_q1.read();
} else {
grp_fu_1530_p1 = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
}
}
void pool_write::thread_grp_fu_1536_p0() {
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter3.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0.read(), ap_const_boolean_0))) {
grp_fu_1536_p0 = ifm_buff0_13_q0.read();
} else if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage1.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage1.read(), ap_const_boolean_0))) {
grp_fu_1536_p0 = ifm_buff1_10_q0.read();
} else {
grp_fu_1536_p0 = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
}
}
void pool_write::thread_grp_fu_1536_p1() {
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter3.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0.read(), ap_const_boolean_0))) {
grp_fu_1536_p1 = ifm_buff1_13_q0.read();
} else if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage1.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage1.read(), ap_const_boolean_0))) {
grp_fu_1536_p1 = ifm_buff1_10_q1.read();
} else {
grp_fu_1536_p1 = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
}
}
void pool_write::thread_grp_fu_1542_p0() {
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter3.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0.read(), ap_const_boolean_0))) {
grp_fu_1542_p0 = ifm_buff0_14_q0.read();
} else if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage1.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage1.read(), ap_const_boolean_0))) {
grp_fu_1542_p0 = ifm_buff0_11_q0.read();
} else {
grp_fu_1542_p0 = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
}
}
void pool_write::thread_grp_fu_1542_p1() {
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter3.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0.read(), ap_const_boolean_0))) {
grp_fu_1542_p1 = ifm_buff1_14_q0.read();
} else if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage1.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage1.read(), ap_const_boolean_0))) {
grp_fu_1542_p1 = ifm_buff0_11_q1.read();
} else {
grp_fu_1542_p1 = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
}
}
void pool_write::thread_grp_fu_1548_p0() {
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter3.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0.read(), ap_const_boolean_0))) {
grp_fu_1548_p0 = ifm_buff0_15_q0.read();
} else if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage1.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage1.read(), ap_const_boolean_0))) {
grp_fu_1548_p0 = ifm_buff1_11_q0.read();
} else {
grp_fu_1548_p0 = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
}
}
void pool_write::thread_grp_fu_1548_p1() {
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter3.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0.read(), ap_const_boolean_0))) {
grp_fu_1548_p1 = ifm_buff1_15_q0.read();
} else if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage1.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage1.read(), ap_const_boolean_0))) {
grp_fu_1548_p1 = ifm_buff1_11_q1.read();
} else {
grp_fu_1548_p1 = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
}
}
void pool_write::thread_icmp_ln179_fu_1728_p2() {
icmp_ln179_fu_1728_p2 = (!ap_phi_mux_col_0_phi_fu_1402_p4.read().is_01() || !ap_const_lv6_38.is_01())? sc_lv<1>(): sc_lv<1>(ap_phi_mux_col_0_phi_fu_1402_p4.read() == ap_const_lv6_38);
}
void pool_write::thread_icmp_ln189_10_fu_2100_p2() {
icmp_ln189_10_fu_2100_p2 = (!tmp_19_fu_2074_p4.read().is_01() || !ap_const_lv8_FF.is_01())? sc_lv<1>(): sc_lv<1>(tmp_19_fu_2074_p4.read() != ap_const_lv8_FF);
}
void pool_write::thread_icmp_ln189_11_fu_2106_p2() {
icmp_ln189_11_fu_2106_p2 = (!trunc_ln189_5_fu_2084_p1.read().is_01() || !ap_const_lv23_0.is_01())? sc_lv<1>(): sc_lv<1>(trunc_ln189_5_fu_2084_p1.read() == ap_const_lv23_0);
}
void pool_write::thread_icmp_ln189_12_fu_2208_p2() {
icmp_ln189_12_fu_2208_p2 = (!tmp_27_fu_2176_p4.read().is_01() || !ap_const_lv8_FF.is_01())? sc_lv<1>(): sc_lv<1>(tmp_27_fu_2176_p4.read() != ap_const_lv8_FF);
}
void pool_write::thread_icmp_ln189_13_fu_2214_p2() {
icmp_ln189_13_fu_2214_p2 = (!trunc_ln189_6_fu_2186_p1.read().is_01() || !ap_const_lv23_0.is_01())? sc_lv<1>(): sc_lv<1>(trunc_ln189_6_fu_2186_p1.read() == ap_const_lv23_0);
}
void pool_write::thread_icmp_ln189_14_fu_2220_p2() {
icmp_ln189_14_fu_2220_p2 = (!tmp_28_fu_2194_p4.read().is_01() || !ap_const_lv8_FF.is_01())? sc_lv<1>(): sc_lv<1>(tmp_28_fu_2194_p4.read() != ap_const_lv8_FF);
}
void pool_write::thread_icmp_ln189_15_fu_2226_p2() {
icmp_ln189_15_fu_2226_p2 = (!trunc_ln189_7_fu_2204_p1.read().is_01() || !ap_const_lv23_0.is_01())? sc_lv<1>(): sc_lv<1>(trunc_ln189_7_fu_2204_p1.read() == ap_const_lv23_0);
}
void pool_write::thread_icmp_ln189_16_fu_2328_p2() {
icmp_ln189_16_fu_2328_p2 = (!tmp_36_fu_2296_p4.read().is_01() || !ap_const_lv8_FF.is_01())? sc_lv<1>(): sc_lv<1>(tmp_36_fu_2296_p4.read() != ap_const_lv8_FF);
}
void pool_write::thread_icmp_ln189_17_fu_2334_p2() {
icmp_ln189_17_fu_2334_p2 = (!trunc_ln189_8_fu_2306_p1.read().is_01() || !ap_const_lv23_0.is_01())? sc_lv<1>(): sc_lv<1>(trunc_ln189_8_fu_2306_p1.read() == ap_const_lv23_0);
}
void pool_write::thread_icmp_ln189_18_fu_2340_p2() {
icmp_ln189_18_fu_2340_p2 = (!tmp_37_fu_2314_p4.read().is_01() || !ap_const_lv8_FF.is_01())? sc_lv<1>(): sc_lv<1>(tmp_37_fu_2314_p4.read() != ap_const_lv8_FF);
}
void pool_write::thread_icmp_ln189_19_fu_2346_p2() {
icmp_ln189_19_fu_2346_p2 = (!trunc_ln189_9_fu_2324_p1.read().is_01() || !ap_const_lv23_0.is_01())? sc_lv<1>(): sc_lv<1>(trunc_ln189_9_fu_2324_p1.read() == ap_const_lv23_0);
}
void pool_write::thread_icmp_ln189_1_fu_1854_p2() {
icmp_ln189_1_fu_1854_p2 = (!trunc_ln189_fu_1826_p1.read().is_01() || !ap_const_lv23_0.is_01())? sc_lv<1>(): sc_lv<1>(trunc_ln189_fu_1826_p1.read() == ap_const_lv23_0);
}
void pool_write::thread_icmp_ln189_20_fu_2448_p2() {
icmp_ln189_20_fu_2448_p2 = (!tmp_45_fu_2416_p4.read().is_01() || !ap_const_lv8_FF.is_01())? sc_lv<1>(): sc_lv<1>(tmp_45_fu_2416_p4.read() != ap_const_lv8_FF);
}
void pool_write::thread_icmp_ln189_21_fu_2454_p2() {
icmp_ln189_21_fu_2454_p2 = (!trunc_ln189_10_fu_2426_p1.read().is_01() || !ap_const_lv23_0.is_01())? sc_lv<1>(): sc_lv<1>(trunc_ln189_10_fu_2426_p1.read() == ap_const_lv23_0);
}
void pool_write::thread_icmp_ln189_22_fu_2460_p2() {
icmp_ln189_22_fu_2460_p2 = (!tmp_46_fu_2434_p4.read().is_01() || !ap_const_lv8_FF.is_01())? sc_lv<1>(): sc_lv<1>(tmp_46_fu_2434_p4.read() != ap_const_lv8_FF);
}
void pool_write::thread_icmp_ln189_23_fu_2466_p2() {
icmp_ln189_23_fu_2466_p2 = (!trunc_ln189_11_fu_2444_p1.read().is_01() || !ap_const_lv23_0.is_01())? sc_lv<1>(): sc_lv<1>(trunc_ln189_11_fu_2444_p1.read() == ap_const_lv23_0);
}
void pool_write::thread_icmp_ln189_24_fu_2568_p2() {
icmp_ln189_24_fu_2568_p2 = (!tmp_54_fu_2536_p4.read().is_01() || !ap_const_lv8_FF.is_01())? sc_lv<1>(): sc_lv<1>(tmp_54_fu_2536_p4.read() != ap_const_lv8_FF);
}
void pool_write::thread_icmp_ln189_25_fu_2574_p2() {
icmp_ln189_25_fu_2574_p2 = (!trunc_ln189_12_fu_2546_p1.read().is_01() || !ap_const_lv23_0.is_01())? sc_lv<1>(): sc_lv<1>(trunc_ln189_12_fu_2546_p1.read() == ap_const_lv23_0);
}
void pool_write::thread_icmp_ln189_26_fu_2580_p2() {
icmp_ln189_26_fu_2580_p2 = (!tmp_55_fu_2554_p4.read().is_01() || !ap_const_lv8_FF.is_01())? sc_lv<1>(): sc_lv<1>(tmp_55_fu_2554_p4.read() != ap_const_lv8_FF);
}
void pool_write::thread_icmp_ln189_27_fu_2586_p2() {
icmp_ln189_27_fu_2586_p2 = (!trunc_ln189_13_fu_2564_p1.read().is_01() || !ap_const_lv23_0.is_01())? sc_lv<1>(): sc_lv<1>(trunc_ln189_13_fu_2564_p1.read() == ap_const_lv23_0);
}
void pool_write::thread_icmp_ln189_28_fu_2688_p2() {
icmp_ln189_28_fu_2688_p2 = (!tmp_63_fu_2656_p4.read().is_01() || !ap_const_lv8_FF.is_01())? sc_lv<1>(): sc_lv<1>(tmp_63_fu_2656_p4.read() != ap_const_lv8_FF);
}
void pool_write::thread_icmp_ln189_29_fu_2694_p2() {
icmp_ln189_29_fu_2694_p2 = (!trunc_ln189_14_fu_2666_p1.read().is_01() || !ap_const_lv23_0.is_01())? sc_lv<1>(): sc_lv<1>(trunc_ln189_14_fu_2666_p1.read() == ap_const_lv23_0);
}
void pool_write::thread_icmp_ln189_2_fu_1860_p2() {
icmp_ln189_2_fu_1860_p2 = (!tmp_2_fu_1834_p4.read().is_01() || !ap_const_lv8_FF.is_01())? sc_lv<1>(): sc_lv<1>(tmp_2_fu_1834_p4.read() != ap_const_lv8_FF);
}
void pool_write::thread_icmp_ln189_30_fu_2700_p2() {
icmp_ln189_30_fu_2700_p2 = (!tmp_64_fu_2674_p4.read().is_01() || !ap_const_lv8_FF.is_01())? sc_lv<1>(): sc_lv<1>(tmp_64_fu_2674_p4.read() != ap_const_lv8_FF);
}
void pool_write::thread_icmp_ln189_31_fu_2706_p2() {
icmp_ln189_31_fu_2706_p2 = (!trunc_ln189_15_fu_2684_p1.read().is_01() || !ap_const_lv23_0.is_01())? sc_lv<1>(): sc_lv<1>(trunc_ln189_15_fu_2684_p1.read() == ap_const_lv23_0);
}
void pool_write::thread_icmp_ln189_32_fu_2808_p2() {
icmp_ln189_32_fu_2808_p2 = (!tmp_72_fu_2776_p4.read().is_01() || !ap_const_lv8_FF.is_01())? sc_lv<1>(): sc_lv<1>(tmp_72_fu_2776_p4.read() != ap_const_lv8_FF);
}
void pool_write::thread_icmp_ln189_33_fu_2814_p2() {
icmp_ln189_33_fu_2814_p2 = (!trunc_ln189_16_fu_2786_p1.read().is_01() || !ap_const_lv23_0.is_01())? sc_lv<1>(): sc_lv<1>(trunc_ln189_16_fu_2786_p1.read() == ap_const_lv23_0);
}
void pool_write::thread_icmp_ln189_34_fu_2820_p2() {
icmp_ln189_34_fu_2820_p2 = (!tmp_73_fu_2794_p4.read().is_01() || !ap_const_lv8_FF.is_01())? sc_lv<1>(): sc_lv<1>(tmp_73_fu_2794_p4.read() != ap_const_lv8_FF);
}
void pool_write::thread_icmp_ln189_35_fu_2826_p2() {
icmp_ln189_35_fu_2826_p2 = (!trunc_ln189_17_fu_2804_p1.read().is_01() || !ap_const_lv23_0.is_01())? sc_lv<1>(): sc_lv<1>(trunc_ln189_17_fu_2804_p1.read() == ap_const_lv23_0);
}
void pool_write::thread_icmp_ln189_36_fu_2928_p2() {
icmp_ln189_36_fu_2928_p2 = (!tmp_81_fu_2896_p4.read().is_01() || !ap_const_lv8_FF.is_01())? sc_lv<1>(): sc_lv<1>(tmp_81_fu_2896_p4.read() != ap_const_lv8_FF);
}
void pool_write::thread_icmp_ln189_37_fu_2934_p2() {
icmp_ln189_37_fu_2934_p2 = (!trunc_ln189_18_fu_2906_p1.read().is_01() || !ap_const_lv23_0.is_01())? sc_lv<1>(): sc_lv<1>(trunc_ln189_18_fu_2906_p1.read() == ap_const_lv23_0);
}
void pool_write::thread_icmp_ln189_38_fu_2940_p2() {
icmp_ln189_38_fu_2940_p2 = (!tmp_82_fu_2914_p4.read().is_01() || !ap_const_lv8_FF.is_01())? sc_lv<1>(): sc_lv<1>(tmp_82_fu_2914_p4.read() != ap_const_lv8_FF);
}
void pool_write::thread_icmp_ln189_39_fu_2946_p2() {
icmp_ln189_39_fu_2946_p2 = (!trunc_ln189_19_fu_2924_p1.read().is_01() || !ap_const_lv23_0.is_01())? sc_lv<1>(): sc_lv<1>(trunc_ln189_19_fu_2924_p1.read() == ap_const_lv23_0);
}
void pool_write::thread_icmp_ln189_3_fu_1866_p2() {
icmp_ln189_3_fu_1866_p2 = (!trunc_ln189_1_fu_1844_p1.read().is_01() || !ap_const_lv23_0.is_01())? sc_lv<1>(): sc_lv<1>(trunc_ln189_1_fu_1844_p1.read() == ap_const_lv23_0);
}
void pool_write::thread_icmp_ln189_40_fu_3048_p2() {
icmp_ln189_40_fu_3048_p2 = (!tmp_90_fu_3016_p4.read().is_01() || !ap_const_lv8_FF.is_01())? sc_lv<1>(): sc_lv<1>(tmp_90_fu_3016_p4.read() != ap_const_lv8_FF);
}
void pool_write::thread_icmp_ln189_41_fu_3054_p2() {
icmp_ln189_41_fu_3054_p2 = (!trunc_ln189_20_fu_3026_p1.read().is_01() || !ap_const_lv23_0.is_01())? sc_lv<1>(): sc_lv<1>(trunc_ln189_20_fu_3026_p1.read() == ap_const_lv23_0);
}
void pool_write::thread_icmp_ln189_42_fu_3060_p2() {
icmp_ln189_42_fu_3060_p2 = (!tmp_91_fu_3034_p4.read().is_01() || !ap_const_lv8_FF.is_01())? sc_lv<1>(): sc_lv<1>(tmp_91_fu_3034_p4.read() != ap_const_lv8_FF);
}
void pool_write::thread_icmp_ln189_43_fu_3066_p2() {
icmp_ln189_43_fu_3066_p2 = (!trunc_ln189_21_fu_3044_p1.read().is_01() || !ap_const_lv23_0.is_01())? sc_lv<1>(): sc_lv<1>(trunc_ln189_21_fu_3044_p1.read() == ap_const_lv23_0);
}
void pool_write::thread_icmp_ln189_44_fu_3168_p2() {
icmp_ln189_44_fu_3168_p2 = (!tmp_99_fu_3136_p4.read().is_01() || !ap_const_lv8_FF.is_01())? sc_lv<1>(): sc_lv<1>(tmp_99_fu_3136_p4.read() != ap_const_lv8_FF);
}
void pool_write::thread_icmp_ln189_45_fu_3174_p2() {
icmp_ln189_45_fu_3174_p2 = (!trunc_ln189_22_fu_3146_p1.read().is_01() || !ap_const_lv23_0.is_01())? sc_lv<1>(): sc_lv<1>(trunc_ln189_22_fu_3146_p1.read() == ap_const_lv23_0);
}
void pool_write::thread_icmp_ln189_46_fu_3180_p2() {
icmp_ln189_46_fu_3180_p2 = (!tmp_100_fu_3154_p4.read().is_01() || !ap_const_lv8_FF.is_01())? sc_lv<1>(): sc_lv<1>(tmp_100_fu_3154_p4.read() != ap_const_lv8_FF);
}
void pool_write::thread_icmp_ln189_47_fu_3186_p2() {
icmp_ln189_47_fu_3186_p2 = (!trunc_ln189_23_fu_3164_p1.read().is_01() || !ap_const_lv23_0.is_01())? sc_lv<1>(): sc_lv<1>(trunc_ln189_23_fu_3164_p1.read() == ap_const_lv23_0);
}
void pool_write::thread_icmp_ln189_48_fu_3766_p2() {
icmp_ln189_48_fu_3766_p2 = (!tmp_108_fu_3735_p4.read().is_01() || !ap_const_lv8_FF.is_01())? sc_lv<1>(): sc_lv<1>(tmp_108_fu_3735_p4.read() != ap_const_lv8_FF);
}
void pool_write::thread_icmp_ln189_49_fu_3772_p2() {
icmp_ln189_49_fu_3772_p2 = (!trunc_ln189_24_fu_3745_p1.read().is_01() || !ap_const_lv23_0.is_01())? sc_lv<1>(): sc_lv<1>(trunc_ln189_24_fu_3745_p1.read() == ap_const_lv23_0);
}
void pool_write::thread_icmp_ln189_4_fu_1968_p2() {
icmp_ln189_4_fu_1968_p2 = (!tmp_s_fu_1936_p4.read().is_01() || !ap_const_lv8_FF.is_01())? sc_lv<1>(): sc_lv<1>(tmp_s_fu_1936_p4.read() != ap_const_lv8_FF);
}
void pool_write::thread_icmp_ln189_50_fu_3778_p2() {
icmp_ln189_50_fu_3778_p2 = (!tmp_109_fu_3752_p4.read().is_01() || !ap_const_lv8_FF.is_01())? sc_lv<1>(): sc_lv<1>(tmp_109_fu_3752_p4.read() != ap_const_lv8_FF);
}
void pool_write::thread_icmp_ln189_51_fu_3784_p2() {
icmp_ln189_51_fu_3784_p2 = (!trunc_ln189_25_fu_3762_p1.read().is_01() || !ap_const_lv23_0.is_01())? sc_lv<1>(): sc_lv<1>(trunc_ln189_25_fu_3762_p1.read() == ap_const_lv23_0);
}
void pool_write::thread_icmp_ln189_52_fu_3882_p2() {
icmp_ln189_52_fu_3882_p2 = (!tmp_117_fu_3851_p4.read().is_01() || !ap_const_lv8_FF.is_01())? sc_lv<1>(): sc_lv<1>(tmp_117_fu_3851_p4.read() != ap_const_lv8_FF);
}
void pool_write::thread_icmp_ln189_53_fu_3888_p2() {
icmp_ln189_53_fu_3888_p2 = (!trunc_ln189_26_fu_3861_p1.read().is_01() || !ap_const_lv23_0.is_01())? sc_lv<1>(): sc_lv<1>(trunc_ln189_26_fu_3861_p1.read() == ap_const_lv23_0);
}
void pool_write::thread_icmp_ln189_54_fu_3894_p2() {
icmp_ln189_54_fu_3894_p2 = (!tmp_118_fu_3868_p4.read().is_01() || !ap_const_lv8_FF.is_01())? sc_lv<1>(): sc_lv<1>(tmp_118_fu_3868_p4.read() != ap_const_lv8_FF);
}
void pool_write::thread_icmp_ln189_55_fu_3900_p2() {
icmp_ln189_55_fu_3900_p2 = (!trunc_ln189_27_fu_3878_p1.read().is_01() || !ap_const_lv23_0.is_01())? sc_lv<1>(): sc_lv<1>(trunc_ln189_27_fu_3878_p1.read() == ap_const_lv23_0);
}
void pool_write::thread_icmp_ln189_56_fu_3998_p2() {
icmp_ln189_56_fu_3998_p2 = (!tmp_126_fu_3967_p4.read().is_01() || !ap_const_lv8_FF.is_01())? sc_lv<1>(): sc_lv<1>(tmp_126_fu_3967_p4.read() != ap_const_lv8_FF);
}
void pool_write::thread_icmp_ln189_57_fu_4004_p2() {
icmp_ln189_57_fu_4004_p2 = (!trunc_ln189_28_fu_3977_p1.read().is_01() || !ap_const_lv23_0.is_01())? sc_lv<1>(): sc_lv<1>(trunc_ln189_28_fu_3977_p1.read() == ap_const_lv23_0);
}
void pool_write::thread_icmp_ln189_58_fu_4010_p2() {
icmp_ln189_58_fu_4010_p2 = (!tmp_127_fu_3984_p4.read().is_01() || !ap_const_lv8_FF.is_01())? sc_lv<1>(): sc_lv<1>(tmp_127_fu_3984_p4.read() != ap_const_lv8_FF);
}
void pool_write::thread_icmp_ln189_59_fu_4016_p2() {
icmp_ln189_59_fu_4016_p2 = (!trunc_ln189_29_fu_3994_p1.read().is_01() || !ap_const_lv23_0.is_01())? sc_lv<1>(): sc_lv<1>(trunc_ln189_29_fu_3994_p1.read() == ap_const_lv23_0);
}
void pool_write::thread_icmp_ln189_5_fu_1974_p2() {
icmp_ln189_5_fu_1974_p2 = (!trunc_ln189_2_fu_1946_p1.read().is_01() || !ap_const_lv23_0.is_01())? sc_lv<1>(): sc_lv<1>(trunc_ln189_2_fu_1946_p1.read() == ap_const_lv23_0);
}
void pool_write::thread_icmp_ln189_60_fu_4114_p2() {
icmp_ln189_60_fu_4114_p2 = (!tmp_135_fu_4083_p4.read().is_01() || !ap_const_lv8_FF.is_01())? sc_lv<1>(): sc_lv<1>(tmp_135_fu_4083_p4.read() != ap_const_lv8_FF);
}
void pool_write::thread_icmp_ln189_61_fu_4120_p2() {
icmp_ln189_61_fu_4120_p2 = (!trunc_ln189_30_fu_4093_p1.read().is_01() || !ap_const_lv23_0.is_01())? sc_lv<1>(): sc_lv<1>(trunc_ln189_30_fu_4093_p1.read() == ap_const_lv23_0);
}
void pool_write::thread_icmp_ln189_62_fu_4126_p2() {
icmp_ln189_62_fu_4126_p2 = (!tmp_136_fu_4100_p4.read().is_01() || !ap_const_lv8_FF.is_01())? sc_lv<1>(): sc_lv<1>(tmp_136_fu_4100_p4.read() != ap_const_lv8_FF);
}
void pool_write::thread_icmp_ln189_63_fu_4132_p2() {
icmp_ln189_63_fu_4132_p2 = (!trunc_ln189_31_fu_4110_p1.read().is_01() || !ap_const_lv23_0.is_01())? sc_lv<1>(): sc_lv<1>(trunc_ln189_31_fu_4110_p1.read() == ap_const_lv23_0);
}
void pool_write::thread_icmp_ln189_6_fu_1980_p2() {
icmp_ln189_6_fu_1980_p2 = (!tmp_10_fu_1954_p4.read().is_01() || !ap_const_lv8_FF.is_01())? sc_lv<1>(): sc_lv<1>(tmp_10_fu_1954_p4.read() != ap_const_lv8_FF);
}
void pool_write::thread_icmp_ln189_7_fu_1986_p2() {
icmp_ln189_7_fu_1986_p2 = (!trunc_ln189_3_fu_1964_p1.read().is_01() || !ap_const_lv23_0.is_01())? sc_lv<1>(): sc_lv<1>(trunc_ln189_3_fu_1964_p1.read() == ap_const_lv23_0);
}
void pool_write::thread_icmp_ln189_8_fu_2088_p2() {
icmp_ln189_8_fu_2088_p2 = (!tmp_18_fu_2056_p4.read().is_01() || !ap_const_lv8_FF.is_01())? sc_lv<1>(): sc_lv<1>(tmp_18_fu_2056_p4.read() != ap_const_lv8_FF);
}
void pool_write::thread_icmp_ln189_9_fu_2094_p2() {
icmp_ln189_9_fu_2094_p2 = (!trunc_ln189_4_fu_2066_p1.read().is_01() || !ap_const_lv23_0.is_01())? sc_lv<1>(): sc_lv<1>(trunc_ln189_4_fu_2066_p1.read() == ap_const_lv23_0);
}
void pool_write::thread_icmp_ln189_fu_1848_p2() {
icmp_ln189_fu_1848_p2 = (!tmp_1_fu_1816_p4.read().is_01() || !ap_const_lv8_FF.is_01())? sc_lv<1>(): sc_lv<1>(tmp_1_fu_1816_p4.read() != ap_const_lv8_FF);
}
void pool_write::thread_icmp_ln190_10_fu_2160_p2() {
icmp_ln190_10_fu_2160_p2 = (!tmp_22_fu_2134_p4.read().is_01() || !ap_const_lv8_FF.is_01())? sc_lv<1>(): sc_lv<1>(tmp_22_fu_2134_p4.read() != ap_const_lv8_FF);
}
void pool_write::thread_icmp_ln190_11_fu_2166_p2() {
icmp_ln190_11_fu_2166_p2 = (!trunc_ln190_5_fu_2144_p1.read().is_01() || !ap_const_lv23_0.is_01())? sc_lv<1>(): sc_lv<1>(trunc_ln190_5_fu_2144_p1.read() == ap_const_lv23_0);
}
void pool_write::thread_icmp_ln190_12_fu_2268_p2() {
icmp_ln190_12_fu_2268_p2 = (!tmp_30_fu_2236_p4.read().is_01() || !ap_const_lv8_FF.is_01())? sc_lv<1>(): sc_lv<1>(tmp_30_fu_2236_p4.read() != ap_const_lv8_FF);
}
void pool_write::thread_icmp_ln190_13_fu_2274_p2() {
icmp_ln190_13_fu_2274_p2 = (!trunc_ln190_6_fu_2246_p1.read().is_01() || !ap_const_lv23_0.is_01())? sc_lv<1>(): sc_lv<1>(trunc_ln190_6_fu_2246_p1.read() == ap_const_lv23_0);
}
void pool_write::thread_icmp_ln190_14_fu_2280_p2() {
icmp_ln190_14_fu_2280_p2 = (!tmp_31_fu_2254_p4.read().is_01() || !ap_const_lv8_FF.is_01())? sc_lv<1>(): sc_lv<1>(tmp_31_fu_2254_p4.read() != ap_const_lv8_FF);
}
void pool_write::thread_icmp_ln190_15_fu_2286_p2() {
icmp_ln190_15_fu_2286_p2 = (!trunc_ln190_7_fu_2264_p1.read().is_01() || !ap_const_lv23_0.is_01())? sc_lv<1>(): sc_lv<1>(trunc_ln190_7_fu_2264_p1.read() == ap_const_lv23_0);
}
void pool_write::thread_icmp_ln190_16_fu_2388_p2() {
icmp_ln190_16_fu_2388_p2 = (!tmp_39_fu_2356_p4.read().is_01() || !ap_const_lv8_FF.is_01())? sc_lv<1>(): sc_lv<1>(tmp_39_fu_2356_p4.read() != ap_const_lv8_FF);
}
void pool_write::thread_icmp_ln190_17_fu_2394_p2() {
icmp_ln190_17_fu_2394_p2 = (!trunc_ln190_8_fu_2366_p1.read().is_01() || !ap_const_lv23_0.is_01())? sc_lv<1>(): sc_lv<1>(trunc_ln190_8_fu_2366_p1.read() == ap_const_lv23_0);
}
void pool_write::thread_icmp_ln190_18_fu_2400_p2() {
icmp_ln190_18_fu_2400_p2 = (!tmp_40_fu_2374_p4.read().is_01() || !ap_const_lv8_FF.is_01())? sc_lv<1>(): sc_lv<1>(tmp_40_fu_2374_p4.read() != ap_const_lv8_FF);
}
void pool_write::thread_icmp_ln190_19_fu_2406_p2() {
icmp_ln190_19_fu_2406_p2 = (!trunc_ln190_9_fu_2384_p1.read().is_01() || !ap_const_lv23_0.is_01())? sc_lv<1>(): sc_lv<1>(trunc_ln190_9_fu_2384_p1.read() == ap_const_lv23_0);
}
void pool_write::thread_icmp_ln190_1_fu_1914_p2() {
icmp_ln190_1_fu_1914_p2 = (!trunc_ln190_fu_1886_p1.read().is_01() || !ap_const_lv23_0.is_01())? sc_lv<1>(): sc_lv<1>(trunc_ln190_fu_1886_p1.read() == ap_const_lv23_0);
}
void pool_write::thread_icmp_ln190_20_fu_2508_p2() {
icmp_ln190_20_fu_2508_p2 = (!tmp_48_fu_2476_p4.read().is_01() || !ap_const_lv8_FF.is_01())? sc_lv<1>(): sc_lv<1>(tmp_48_fu_2476_p4.read() != ap_const_lv8_FF);
}
void pool_write::thread_icmp_ln190_21_fu_2514_p2() {
icmp_ln190_21_fu_2514_p2 = (!trunc_ln190_10_fu_2486_p1.read().is_01() || !ap_const_lv23_0.is_01())? sc_lv<1>(): sc_lv<1>(trunc_ln190_10_fu_2486_p1.read() == ap_const_lv23_0);
}
void pool_write::thread_icmp_ln190_22_fu_2520_p2() {
icmp_ln190_22_fu_2520_p2 = (!tmp_49_fu_2494_p4.read().is_01() || !ap_const_lv8_FF.is_01())? sc_lv<1>(): sc_lv<1>(tmp_49_fu_2494_p4.read() != ap_const_lv8_FF);
}
void pool_write::thread_icmp_ln190_23_fu_2526_p2() {
icmp_ln190_23_fu_2526_p2 = (!trunc_ln190_11_fu_2504_p1.read().is_01() || !ap_const_lv23_0.is_01())? sc_lv<1>(): sc_lv<1>(trunc_ln190_11_fu_2504_p1.read() == ap_const_lv23_0);
}
void pool_write::thread_icmp_ln190_24_fu_2628_p2() {
icmp_ln190_24_fu_2628_p2 = (!tmp_57_fu_2596_p4.read().is_01() || !ap_const_lv8_FF.is_01())? sc_lv<1>(): sc_lv<1>(tmp_57_fu_2596_p4.read() != ap_const_lv8_FF);
}
void pool_write::thread_icmp_ln190_25_fu_2634_p2() {
icmp_ln190_25_fu_2634_p2 = (!trunc_ln190_12_fu_2606_p1.read().is_01() || !ap_const_lv23_0.is_01())? sc_lv<1>(): sc_lv<1>(trunc_ln190_12_fu_2606_p1.read() == ap_const_lv23_0);
}
void pool_write::thread_icmp_ln190_26_fu_2640_p2() {
icmp_ln190_26_fu_2640_p2 = (!tmp_58_fu_2614_p4.read().is_01() || !ap_const_lv8_FF.is_01())? sc_lv<1>(): sc_lv<1>(tmp_58_fu_2614_p4.read() != ap_const_lv8_FF);
}
void pool_write::thread_icmp_ln190_27_fu_2646_p2() {
icmp_ln190_27_fu_2646_p2 = (!trunc_ln190_13_fu_2624_p1.read().is_01() || !ap_const_lv23_0.is_01())? sc_lv<1>(): sc_lv<1>(trunc_ln190_13_fu_2624_p1.read() == ap_const_lv23_0);
}
void pool_write::thread_icmp_ln190_28_fu_2748_p2() {
icmp_ln190_28_fu_2748_p2 = (!tmp_66_fu_2716_p4.read().is_01() || !ap_const_lv8_FF.is_01())? sc_lv<1>(): sc_lv<1>(tmp_66_fu_2716_p4.read() != ap_const_lv8_FF);
}
void pool_write::thread_icmp_ln190_29_fu_2754_p2() {
icmp_ln190_29_fu_2754_p2 = (!trunc_ln190_14_fu_2726_p1.read().is_01() || !ap_const_lv23_0.is_01())? sc_lv<1>(): sc_lv<1>(trunc_ln190_14_fu_2726_p1.read() == ap_const_lv23_0);
}
void pool_write::thread_icmp_ln190_2_fu_1920_p2() {
icmp_ln190_2_fu_1920_p2 = (!tmp_5_fu_1894_p4.read().is_01() || !ap_const_lv8_FF.is_01())? sc_lv<1>(): sc_lv<1>(tmp_5_fu_1894_p4.read() != ap_const_lv8_FF);
}
void pool_write::thread_icmp_ln190_30_fu_2760_p2() {
icmp_ln190_30_fu_2760_p2 = (!tmp_67_fu_2734_p4.read().is_01() || !ap_const_lv8_FF.is_01())? sc_lv<1>(): sc_lv<1>(tmp_67_fu_2734_p4.read() != ap_const_lv8_FF);
}
void pool_write::thread_icmp_ln190_31_fu_2766_p2() {
icmp_ln190_31_fu_2766_p2 = (!trunc_ln190_15_fu_2744_p1.read().is_01() || !ap_const_lv23_0.is_01())? sc_lv<1>(): sc_lv<1>(trunc_ln190_15_fu_2744_p1.read() == ap_const_lv23_0);
}
void pool_write::thread_icmp_ln190_32_fu_2868_p2() {
icmp_ln190_32_fu_2868_p2 = (!tmp_75_fu_2836_p4.read().is_01() || !ap_const_lv8_FF.is_01())? sc_lv<1>(): sc_lv<1>(tmp_75_fu_2836_p4.read() != ap_const_lv8_FF);
}
void pool_write::thread_icmp_ln190_33_fu_2874_p2() {
icmp_ln190_33_fu_2874_p2 = (!trunc_ln190_16_fu_2846_p1.read().is_01() || !ap_const_lv23_0.is_01())? sc_lv<1>(): sc_lv<1>(trunc_ln190_16_fu_2846_p1.read() == ap_const_lv23_0);
}
void pool_write::thread_icmp_ln190_34_fu_2880_p2() {
icmp_ln190_34_fu_2880_p2 = (!tmp_76_fu_2854_p4.read().is_01() || !ap_const_lv8_FF.is_01())? sc_lv<1>(): sc_lv<1>(tmp_76_fu_2854_p4.read() != ap_const_lv8_FF);
}
void pool_write::thread_icmp_ln190_35_fu_2886_p2() {
icmp_ln190_35_fu_2886_p2 = (!trunc_ln190_17_fu_2864_p1.read().is_01() || !ap_const_lv23_0.is_01())? sc_lv<1>(): sc_lv<1>(trunc_ln190_17_fu_2864_p1.read() == ap_const_lv23_0);
}
void pool_write::thread_icmp_ln190_36_fu_2988_p2() {
icmp_ln190_36_fu_2988_p2 = (!tmp_84_fu_2956_p4.read().is_01() || !ap_const_lv8_FF.is_01())? sc_lv<1>(): sc_lv<1>(tmp_84_fu_2956_p4.read() != ap_const_lv8_FF);
}
void pool_write::thread_icmp_ln190_37_fu_2994_p2() {
icmp_ln190_37_fu_2994_p2 = (!trunc_ln190_18_fu_2966_p1.read().is_01() || !ap_const_lv23_0.is_01())? sc_lv<1>(): sc_lv<1>(trunc_ln190_18_fu_2966_p1.read() == ap_const_lv23_0);
}
void pool_write::thread_icmp_ln190_38_fu_3000_p2() {
icmp_ln190_38_fu_3000_p2 = (!tmp_85_fu_2974_p4.read().is_01() || !ap_const_lv8_FF.is_01())? sc_lv<1>(): sc_lv<1>(tmp_85_fu_2974_p4.read() != ap_const_lv8_FF);
}
void pool_write::thread_icmp_ln190_39_fu_3006_p2() {
icmp_ln190_39_fu_3006_p2 = (!trunc_ln190_19_fu_2984_p1.read().is_01() || !ap_const_lv23_0.is_01())? sc_lv<1>(): sc_lv<1>(trunc_ln190_19_fu_2984_p1.read() == ap_const_lv23_0);
}
void pool_write::thread_icmp_ln190_3_fu_1926_p2() {
icmp_ln190_3_fu_1926_p2 = (!trunc_ln190_1_fu_1904_p1.read().is_01() || !ap_const_lv23_0.is_01())? sc_lv<1>(): sc_lv<1>(trunc_ln190_1_fu_1904_p1.read() == ap_const_lv23_0);
}
void pool_write::thread_icmp_ln190_40_fu_3108_p2() {
icmp_ln190_40_fu_3108_p2 = (!tmp_93_fu_3076_p4.read().is_01() || !ap_const_lv8_FF.is_01())? sc_lv<1>(): sc_lv<1>(tmp_93_fu_3076_p4.read() != ap_const_lv8_FF);
}
void pool_write::thread_icmp_ln190_41_fu_3114_p2() {
icmp_ln190_41_fu_3114_p2 = (!trunc_ln190_20_fu_3086_p1.read().is_01() || !ap_const_lv23_0.is_01())? sc_lv<1>(): sc_lv<1>(trunc_ln190_20_fu_3086_p1.read() == ap_const_lv23_0);
}
void pool_write::thread_icmp_ln190_42_fu_3120_p2() {
icmp_ln190_42_fu_3120_p2 = (!tmp_94_fu_3094_p4.read().is_01() || !ap_const_lv8_FF.is_01())? sc_lv<1>(): sc_lv<1>(tmp_94_fu_3094_p4.read() != ap_const_lv8_FF);
}
void pool_write::thread_icmp_ln190_43_fu_3126_p2() {
icmp_ln190_43_fu_3126_p2 = (!trunc_ln190_21_fu_3104_p1.read().is_01() || !ap_const_lv23_0.is_01())? sc_lv<1>(): sc_lv<1>(trunc_ln190_21_fu_3104_p1.read() == ap_const_lv23_0);
}
void pool_write::thread_icmp_ln190_44_fu_3228_p2() {
icmp_ln190_44_fu_3228_p2 = (!tmp_102_fu_3196_p4.read().is_01() || !ap_const_lv8_FF.is_01())? sc_lv<1>(): sc_lv<1>(tmp_102_fu_3196_p4.read() != ap_const_lv8_FF);
}
void pool_write::thread_icmp_ln190_45_fu_3234_p2() {
icmp_ln190_45_fu_3234_p2 = (!trunc_ln190_22_fu_3206_p1.read().is_01() || !ap_const_lv23_0.is_01())? sc_lv<1>(): sc_lv<1>(trunc_ln190_22_fu_3206_p1.read() == ap_const_lv23_0);
}
void pool_write::thread_icmp_ln190_46_fu_3240_p2() {
icmp_ln190_46_fu_3240_p2 = (!tmp_103_fu_3214_p4.read().is_01() || !ap_const_lv8_FF.is_01())? sc_lv<1>(): sc_lv<1>(tmp_103_fu_3214_p4.read() != ap_const_lv8_FF);
}
void pool_write::thread_icmp_ln190_47_fu_3246_p2() {
icmp_ln190_47_fu_3246_p2 = (!trunc_ln190_23_fu_3224_p1.read().is_01() || !ap_const_lv23_0.is_01())? sc_lv<1>(): sc_lv<1>(trunc_ln190_23_fu_3224_p1.read() == ap_const_lv23_0);
}
void pool_write::thread_icmp_ln190_48_fu_3824_p2() {
icmp_ln190_48_fu_3824_p2 = (!tmp_111_fu_3793_p4.read().is_01() || !ap_const_lv8_FF.is_01())? sc_lv<1>(): sc_lv<1>(tmp_111_fu_3793_p4.read() != ap_const_lv8_FF);
}
void pool_write::thread_icmp_ln190_49_fu_3830_p2() {
icmp_ln190_49_fu_3830_p2 = (!trunc_ln190_24_fu_3803_p1.read().is_01() || !ap_const_lv23_0.is_01())? sc_lv<1>(): sc_lv<1>(trunc_ln190_24_fu_3803_p1.read() == ap_const_lv23_0);
}
void pool_write::thread_icmp_ln190_4_fu_2028_p2() {
icmp_ln190_4_fu_2028_p2 = (!tmp_12_fu_1996_p4.read().is_01() || !ap_const_lv8_FF.is_01())? sc_lv<1>(): sc_lv<1>(tmp_12_fu_1996_p4.read() != ap_const_lv8_FF);
}
void pool_write::thread_icmp_ln190_50_fu_3836_p2() {
icmp_ln190_50_fu_3836_p2 = (!tmp_112_fu_3810_p4.read().is_01() || !ap_const_lv8_FF.is_01())? sc_lv<1>(): sc_lv<1>(tmp_112_fu_3810_p4.read() != ap_const_lv8_FF);
}
void pool_write::thread_icmp_ln190_51_fu_3842_p2() {
icmp_ln190_51_fu_3842_p2 = (!trunc_ln190_25_fu_3820_p1.read().is_01() || !ap_const_lv23_0.is_01())? sc_lv<1>(): sc_lv<1>(trunc_ln190_25_fu_3820_p1.read() == ap_const_lv23_0);
}
void pool_write::thread_icmp_ln190_52_fu_3940_p2() {
icmp_ln190_52_fu_3940_p2 = (!tmp_120_fu_3909_p4.read().is_01() || !ap_const_lv8_FF.is_01())? sc_lv<1>(): sc_lv<1>(tmp_120_fu_3909_p4.read() != ap_const_lv8_FF);
}
void pool_write::thread_icmp_ln190_53_fu_3946_p2() {
icmp_ln190_53_fu_3946_p2 = (!trunc_ln190_26_fu_3919_p1.read().is_01() || !ap_const_lv23_0.is_01())? sc_lv<1>(): sc_lv<1>(trunc_ln190_26_fu_3919_p1.read() == ap_const_lv23_0);
}
void pool_write::thread_icmp_ln190_54_fu_3952_p2() {
icmp_ln190_54_fu_3952_p2 = (!tmp_121_fu_3926_p4.read().is_01() || !ap_const_lv8_FF.is_01())? sc_lv<1>(): sc_lv<1>(tmp_121_fu_3926_p4.read() != ap_const_lv8_FF);
}
void pool_write::thread_icmp_ln190_55_fu_3958_p2() {
icmp_ln190_55_fu_3958_p2 = (!trunc_ln190_27_fu_3936_p1.read().is_01() || !ap_const_lv23_0.is_01())? sc_lv<1>(): sc_lv<1>(trunc_ln190_27_fu_3936_p1.read() == ap_const_lv23_0);
}
void pool_write::thread_icmp_ln190_56_fu_4056_p2() {
icmp_ln190_56_fu_4056_p2 = (!tmp_129_fu_4025_p4.read().is_01() || !ap_const_lv8_FF.is_01())? sc_lv<1>(): sc_lv<1>(tmp_129_fu_4025_p4.read() != ap_const_lv8_FF);
}
void pool_write::thread_icmp_ln190_57_fu_4062_p2() {
icmp_ln190_57_fu_4062_p2 = (!trunc_ln190_28_fu_4035_p1.read().is_01() || !ap_const_lv23_0.is_01())? sc_lv<1>(): sc_lv<1>(trunc_ln190_28_fu_4035_p1.read() == ap_const_lv23_0);
}
void pool_write::thread_icmp_ln190_58_fu_4068_p2() {
icmp_ln190_58_fu_4068_p2 = (!tmp_130_fu_4042_p4.read().is_01() || !ap_const_lv8_FF.is_01())? sc_lv<1>(): sc_lv<1>(tmp_130_fu_4042_p4.read() != ap_const_lv8_FF);
}
void pool_write::thread_icmp_ln190_59_fu_4074_p2() {
icmp_ln190_59_fu_4074_p2 = (!trunc_ln190_29_fu_4052_p1.read().is_01() || !ap_const_lv23_0.is_01())? sc_lv<1>(): sc_lv<1>(trunc_ln190_29_fu_4052_p1.read() == ap_const_lv23_0);
}
void pool_write::thread_icmp_ln190_5_fu_2034_p2() {
icmp_ln190_5_fu_2034_p2 = (!trunc_ln190_2_fu_2006_p1.read().is_01() || !ap_const_lv23_0.is_01())? sc_lv<1>(): sc_lv<1>(trunc_ln190_2_fu_2006_p1.read() == ap_const_lv23_0);
}
void pool_write::thread_icmp_ln190_60_fu_4172_p2() {
icmp_ln190_60_fu_4172_p2 = (!tmp_138_fu_4141_p4.read().is_01() || !ap_const_lv8_FF.is_01())? sc_lv<1>(): sc_lv<1>(tmp_138_fu_4141_p4.read() != ap_const_lv8_FF);
}
void pool_write::thread_icmp_ln190_61_fu_4178_p2() {
icmp_ln190_61_fu_4178_p2 = (!trunc_ln190_30_fu_4151_p1.read().is_01() || !ap_const_lv23_0.is_01())? sc_lv<1>(): sc_lv<1>(trunc_ln190_30_fu_4151_p1.read() == ap_const_lv23_0);
}
void pool_write::thread_icmp_ln190_62_fu_4184_p2() {
icmp_ln190_62_fu_4184_p2 = (!tmp_139_fu_4158_p4.read().is_01() || !ap_const_lv8_FF.is_01())? sc_lv<1>(): sc_lv<1>(tmp_139_fu_4158_p4.read() != ap_const_lv8_FF);
}
void pool_write::thread_icmp_ln190_63_fu_4190_p2() {
icmp_ln190_63_fu_4190_p2 = (!trunc_ln190_31_fu_4168_p1.read().is_01() || !ap_const_lv23_0.is_01())? sc_lv<1>(): sc_lv<1>(trunc_ln190_31_fu_4168_p1.read() == ap_const_lv23_0);
}
void pool_write::thread_icmp_ln190_6_fu_2040_p2() {
icmp_ln190_6_fu_2040_p2 = (!tmp_13_fu_2014_p4.read().is_01() || !ap_const_lv8_FF.is_01())? sc_lv<1>(): sc_lv<1>(tmp_13_fu_2014_p4.read() != ap_const_lv8_FF);
}
void pool_write::thread_icmp_ln190_7_fu_2046_p2() {
icmp_ln190_7_fu_2046_p2 = (!trunc_ln190_3_fu_2024_p1.read().is_01() || !ap_const_lv23_0.is_01())? sc_lv<1>(): sc_lv<1>(trunc_ln190_3_fu_2024_p1.read() == ap_const_lv23_0);
}
void pool_write::thread_icmp_ln190_8_fu_2148_p2() {
icmp_ln190_8_fu_2148_p2 = (!tmp_21_fu_2116_p4.read().is_01() || !ap_const_lv8_FF.is_01())? sc_lv<1>(): sc_lv<1>(tmp_21_fu_2116_p4.read() != ap_const_lv8_FF);
}
void pool_write::thread_icmp_ln190_9_fu_2154_p2() {
icmp_ln190_9_fu_2154_p2 = (!trunc_ln190_4_fu_2126_p1.read().is_01() || !ap_const_lv23_0.is_01())? sc_lv<1>(): sc_lv<1>(trunc_ln190_4_fu_2126_p1.read() == ap_const_lv23_0);
}
void pool_write::thread_icmp_ln190_fu_1908_p2() {
icmp_ln190_fu_1908_p2 = (!tmp_4_fu_1876_p4.read().is_01() || !ap_const_lv8_FF.is_01())? sc_lv<1>(): sc_lv<1>(tmp_4_fu_1876_p4.read() != ap_const_lv8_FF);
}
void pool_write::thread_icmp_ln191_10_fu_4858_p2() {
icmp_ln191_10_fu_4858_p2 = (!tmp_25_fu_4826_p4.read().is_01() || !ap_const_lv8_FF.is_01())? sc_lv<1>(): sc_lv<1>(tmp_25_fu_4826_p4.read() != ap_const_lv8_FF);
}
void pool_write::thread_icmp_ln191_11_fu_4864_p2() {
icmp_ln191_11_fu_4864_p2 = (!trunc_ln191_5_fu_4836_p1.read().is_01() || !ap_const_lv23_0.is_01())? sc_lv<1>(): sc_lv<1>(trunc_ln191_5_fu_4836_p1.read() == ap_const_lv23_0);
}
void pool_write::thread_icmp_ln191_12_fu_4932_p2() {
icmp_ln191_12_fu_4932_p2 = (!tmp_33_fu_4900_p4.read().is_01() || !ap_const_lv8_FF.is_01())? sc_lv<1>(): sc_lv<1>(tmp_33_fu_4900_p4.read() != ap_const_lv8_FF);
}
void pool_write::thread_icmp_ln191_13_fu_4938_p2() {
icmp_ln191_13_fu_4938_p2 = (!trunc_ln191_6_fu_4910_p1.read().is_01() || !ap_const_lv23_0.is_01())? sc_lv<1>(): sc_lv<1>(trunc_ln191_6_fu_4910_p1.read() == ap_const_lv23_0);
}
void pool_write::thread_icmp_ln191_14_fu_4950_p2() {
icmp_ln191_14_fu_4950_p2 = (!tmp_34_fu_4918_p4.read().is_01() || !ap_const_lv8_FF.is_01())? sc_lv<1>(): sc_lv<1>(tmp_34_fu_4918_p4.read() != ap_const_lv8_FF);
}
void pool_write::thread_icmp_ln191_15_fu_4956_p2() {
icmp_ln191_15_fu_4956_p2 = (!trunc_ln191_7_fu_4928_p1.read().is_01() || !ap_const_lv23_0.is_01())? sc_lv<1>(): sc_lv<1>(trunc_ln191_7_fu_4928_p1.read() == ap_const_lv23_0);
}
void pool_write::thread_icmp_ln191_16_fu_5024_p2() {
icmp_ln191_16_fu_5024_p2 = (!tmp_42_fu_4992_p4.read().is_01() || !ap_const_lv8_FF.is_01())? sc_lv<1>(): sc_lv<1>(tmp_42_fu_4992_p4.read() != ap_const_lv8_FF);
}
void pool_write::thread_icmp_ln191_17_fu_5030_p2() {
icmp_ln191_17_fu_5030_p2 = (!trunc_ln191_8_fu_5002_p1.read().is_01() || !ap_const_lv23_0.is_01())? sc_lv<1>(): sc_lv<1>(trunc_ln191_8_fu_5002_p1.read() == ap_const_lv23_0);
}
void pool_write::thread_icmp_ln191_18_fu_5042_p2() {
icmp_ln191_18_fu_5042_p2 = (!tmp_43_fu_5010_p4.read().is_01() || !ap_const_lv8_FF.is_01())? sc_lv<1>(): sc_lv<1>(tmp_43_fu_5010_p4.read() != ap_const_lv8_FF);
}
void pool_write::thread_icmp_ln191_19_fu_5048_p2() {
icmp_ln191_19_fu_5048_p2 = (!trunc_ln191_9_fu_5020_p1.read().is_01() || !ap_const_lv23_0.is_01())? sc_lv<1>(): sc_lv<1>(trunc_ln191_9_fu_5020_p1.read() == ap_const_lv23_0);
}
void pool_write::thread_icmp_ln191_1_fu_4662_p2() {
icmp_ln191_1_fu_4662_p2 = (!trunc_ln191_fu_4634_p1.read().is_01() || !ap_const_lv23_0.is_01())? sc_lv<1>(): sc_lv<1>(trunc_ln191_fu_4634_p1.read() == ap_const_lv23_0);
}
void pool_write::thread_icmp_ln191_20_fu_5116_p2() {
icmp_ln191_20_fu_5116_p2 = (!tmp_51_fu_5084_p4.read().is_01() || !ap_const_lv8_FF.is_01())? sc_lv<1>(): sc_lv<1>(tmp_51_fu_5084_p4.read() != ap_const_lv8_FF);
}
void pool_write::thread_icmp_ln191_21_fu_5122_p2() {
icmp_ln191_21_fu_5122_p2 = (!trunc_ln191_10_fu_5094_p1.read().is_01() || !ap_const_lv23_0.is_01())? sc_lv<1>(): sc_lv<1>(trunc_ln191_10_fu_5094_p1.read() == ap_const_lv23_0);
}
void pool_write::thread_icmp_ln191_22_fu_5134_p2() {
icmp_ln191_22_fu_5134_p2 = (!tmp_52_fu_5102_p4.read().is_01() || !ap_const_lv8_FF.is_01())? sc_lv<1>(): sc_lv<1>(tmp_52_fu_5102_p4.read() != ap_const_lv8_FF);
}
void pool_write::thread_icmp_ln191_23_fu_5140_p2() {
icmp_ln191_23_fu_5140_p2 = (!trunc_ln191_11_fu_5112_p1.read().is_01() || !ap_const_lv23_0.is_01())? sc_lv<1>(): sc_lv<1>(trunc_ln191_11_fu_5112_p1.read() == ap_const_lv23_0);
}
void pool_write::thread_icmp_ln191_24_fu_5208_p2() {
icmp_ln191_24_fu_5208_p2 = (!tmp_60_fu_5176_p4.read().is_01() || !ap_const_lv8_FF.is_01())? sc_lv<1>(): sc_lv<1>(tmp_60_fu_5176_p4.read() != ap_const_lv8_FF);
}
void pool_write::thread_icmp_ln191_25_fu_5214_p2() {
icmp_ln191_25_fu_5214_p2 = (!trunc_ln191_12_fu_5186_p1.read().is_01() || !ap_const_lv23_0.is_01())? sc_lv<1>(): sc_lv<1>(trunc_ln191_12_fu_5186_p1.read() == ap_const_lv23_0);
}
void pool_write::thread_icmp_ln191_26_fu_5226_p2() {
icmp_ln191_26_fu_5226_p2 = (!tmp_61_fu_5194_p4.read().is_01() || !ap_const_lv8_FF.is_01())? sc_lv<1>(): sc_lv<1>(tmp_61_fu_5194_p4.read() != ap_const_lv8_FF);
}
void pool_write::thread_icmp_ln191_27_fu_5232_p2() {
icmp_ln191_27_fu_5232_p2 = (!trunc_ln191_13_fu_5204_p1.read().is_01() || !ap_const_lv23_0.is_01())? sc_lv<1>(): sc_lv<1>(trunc_ln191_13_fu_5204_p1.read() == ap_const_lv23_0);
}
void pool_write::thread_icmp_ln191_28_fu_5300_p2() {
icmp_ln191_28_fu_5300_p2 = (!tmp_69_fu_5268_p4.read().is_01() || !ap_const_lv8_FF.is_01())? sc_lv<1>(): sc_lv<1>(tmp_69_fu_5268_p4.read() != ap_const_lv8_FF);
}
void pool_write::thread_icmp_ln191_29_fu_5306_p2() {
icmp_ln191_29_fu_5306_p2 = (!trunc_ln191_14_fu_5278_p1.read().is_01() || !ap_const_lv23_0.is_01())? sc_lv<1>(): sc_lv<1>(trunc_ln191_14_fu_5278_p1.read() == ap_const_lv23_0);
}
void pool_write::thread_icmp_ln191_2_fu_4674_p2() {
icmp_ln191_2_fu_4674_p2 = (!tmp_8_fu_4642_p4.read().is_01() || !ap_const_lv8_FF.is_01())? sc_lv<1>(): sc_lv<1>(tmp_8_fu_4642_p4.read() != ap_const_lv8_FF);
}
void pool_write::thread_icmp_ln191_30_fu_5318_p2() {
icmp_ln191_30_fu_5318_p2 = (!tmp_70_fu_5286_p4.read().is_01() || !ap_const_lv8_FF.is_01())? sc_lv<1>(): sc_lv<1>(tmp_70_fu_5286_p4.read() != ap_const_lv8_FF);
}
void pool_write::thread_icmp_ln191_31_fu_5324_p2() {
icmp_ln191_31_fu_5324_p2 = (!trunc_ln191_15_fu_5296_p1.read().is_01() || !ap_const_lv23_0.is_01())? sc_lv<1>(): sc_lv<1>(trunc_ln191_15_fu_5296_p1.read() == ap_const_lv23_0);
}
void pool_write::thread_icmp_ln191_32_fu_5392_p2() {
icmp_ln191_32_fu_5392_p2 = (!tmp_78_fu_5360_p4.read().is_01() || !ap_const_lv8_FF.is_01())? sc_lv<1>(): sc_lv<1>(tmp_78_fu_5360_p4.read() != ap_const_lv8_FF);
}
void pool_write::thread_icmp_ln191_33_fu_5398_p2() {
icmp_ln191_33_fu_5398_p2 = (!trunc_ln191_16_fu_5370_p1.read().is_01() || !ap_const_lv23_0.is_01())? sc_lv<1>(): sc_lv<1>(trunc_ln191_16_fu_5370_p1.read() == ap_const_lv23_0);
}
void pool_write::thread_icmp_ln191_34_fu_5410_p2() {
icmp_ln191_34_fu_5410_p2 = (!tmp_79_fu_5378_p4.read().is_01() || !ap_const_lv8_FF.is_01())? sc_lv<1>(): sc_lv<1>(tmp_79_fu_5378_p4.read() != ap_const_lv8_FF);
}
void pool_write::thread_icmp_ln191_35_fu_5416_p2() {
icmp_ln191_35_fu_5416_p2 = (!trunc_ln191_17_fu_5388_p1.read().is_01() || !ap_const_lv23_0.is_01())? sc_lv<1>(): sc_lv<1>(trunc_ln191_17_fu_5388_p1.read() == ap_const_lv23_0);
}
void pool_write::thread_icmp_ln191_36_fu_5484_p2() {
icmp_ln191_36_fu_5484_p2 = (!tmp_87_fu_5452_p4.read().is_01() || !ap_const_lv8_FF.is_01())? sc_lv<1>(): sc_lv<1>(tmp_87_fu_5452_p4.read() != ap_const_lv8_FF);
}
void pool_write::thread_icmp_ln191_37_fu_5490_p2() {
icmp_ln191_37_fu_5490_p2 = (!trunc_ln191_18_fu_5462_p1.read().is_01() || !ap_const_lv23_0.is_01())? sc_lv<1>(): sc_lv<1>(trunc_ln191_18_fu_5462_p1.read() == ap_const_lv23_0);
}
void pool_write::thread_icmp_ln191_38_fu_5502_p2() {
icmp_ln191_38_fu_5502_p2 = (!tmp_88_fu_5470_p4.read().is_01() || !ap_const_lv8_FF.is_01())? sc_lv<1>(): sc_lv<1>(tmp_88_fu_5470_p4.read() != ap_const_lv8_FF);
}
void pool_write::thread_icmp_ln191_39_fu_5508_p2() {
icmp_ln191_39_fu_5508_p2 = (!trunc_ln191_19_fu_5480_p1.read().is_01() || !ap_const_lv23_0.is_01())? sc_lv<1>(): sc_lv<1>(trunc_ln191_19_fu_5480_p1.read() == ap_const_lv23_0);
}
void pool_write::thread_icmp_ln191_3_fu_4680_p2() {
icmp_ln191_3_fu_4680_p2 = (!trunc_ln191_1_fu_4652_p1.read().is_01() || !ap_const_lv23_0.is_01())? sc_lv<1>(): sc_lv<1>(trunc_ln191_1_fu_4652_p1.read() == ap_const_lv23_0);
}
void pool_write::thread_icmp_ln191_40_fu_5576_p2() {
icmp_ln191_40_fu_5576_p2 = (!tmp_96_fu_5544_p4.read().is_01() || !ap_const_lv8_FF.is_01())? sc_lv<1>(): sc_lv<1>(tmp_96_fu_5544_p4.read() != ap_const_lv8_FF);
}
void pool_write::thread_icmp_ln191_41_fu_5582_p2() {
icmp_ln191_41_fu_5582_p2 = (!trunc_ln191_20_fu_5554_p1.read().is_01() || !ap_const_lv23_0.is_01())? sc_lv<1>(): sc_lv<1>(trunc_ln191_20_fu_5554_p1.read() == ap_const_lv23_0);
}
void pool_write::thread_icmp_ln191_42_fu_5594_p2() {
icmp_ln191_42_fu_5594_p2 = (!tmp_97_fu_5562_p4.read().is_01() || !ap_const_lv8_FF.is_01())? sc_lv<1>(): sc_lv<1>(tmp_97_fu_5562_p4.read() != ap_const_lv8_FF);
}
void pool_write::thread_icmp_ln191_43_fu_5600_p2() {
icmp_ln191_43_fu_5600_p2 = (!trunc_ln191_21_fu_5572_p1.read().is_01() || !ap_const_lv23_0.is_01())? sc_lv<1>(): sc_lv<1>(trunc_ln191_21_fu_5572_p1.read() == ap_const_lv23_0);
}
void pool_write::thread_icmp_ln191_44_fu_5668_p2() {
icmp_ln191_44_fu_5668_p2 = (!tmp_105_fu_5636_p4.read().is_01() || !ap_const_lv8_FF.is_01())? sc_lv<1>(): sc_lv<1>(tmp_105_fu_5636_p4.read() != ap_const_lv8_FF);
}
void pool_write::thread_icmp_ln191_45_fu_5674_p2() {
icmp_ln191_45_fu_5674_p2 = (!trunc_ln191_22_fu_5646_p1.read().is_01() || !ap_const_lv23_0.is_01())? sc_lv<1>(): sc_lv<1>(trunc_ln191_22_fu_5646_p1.read() == ap_const_lv23_0);
}
void pool_write::thread_icmp_ln191_46_fu_5686_p2() {
icmp_ln191_46_fu_5686_p2 = (!tmp_106_fu_5654_p4.read().is_01() || !ap_const_lv8_FF.is_01())? sc_lv<1>(): sc_lv<1>(tmp_106_fu_5654_p4.read() != ap_const_lv8_FF);
}
void pool_write::thread_icmp_ln191_47_fu_5692_p2() {
icmp_ln191_47_fu_5692_p2 = (!trunc_ln191_23_fu_5664_p1.read().is_01() || !ap_const_lv23_0.is_01())? sc_lv<1>(): sc_lv<1>(trunc_ln191_23_fu_5664_p1.read() == ap_const_lv23_0);
}
void pool_write::thread_icmp_ln191_48_fu_5846_p2() {
icmp_ln191_48_fu_5846_p2 = (!tmp_114_fu_5815_p4.read().is_01() || !ap_const_lv8_FF.is_01())? sc_lv<1>(): sc_lv<1>(tmp_114_fu_5815_p4.read() != ap_const_lv8_FF);
}
void pool_write::thread_icmp_ln191_49_fu_5852_p2() {
icmp_ln191_49_fu_5852_p2 = (!trunc_ln191_24_fu_5825_p1.read().is_01() || !ap_const_lv23_0.is_01())? sc_lv<1>(): sc_lv<1>(trunc_ln191_24_fu_5825_p1.read() == ap_const_lv23_0);
}
void pool_write::thread_icmp_ln191_4_fu_4748_p2() {
icmp_ln191_4_fu_4748_p2 = (!tmp_15_fu_4716_p4.read().is_01() || !ap_const_lv8_FF.is_01())? sc_lv<1>(): sc_lv<1>(tmp_15_fu_4716_p4.read() != ap_const_lv8_FF);
}
void pool_write::thread_icmp_ln191_50_fu_5864_p2() {
icmp_ln191_50_fu_5864_p2 = (!tmp_115_fu_5832_p4.read().is_01() || !ap_const_lv8_FF.is_01())? sc_lv<1>(): sc_lv<1>(tmp_115_fu_5832_p4.read() != ap_const_lv8_FF);
}
void pool_write::thread_icmp_ln191_51_fu_5870_p2() {
icmp_ln191_51_fu_5870_p2 = (!trunc_ln191_25_fu_5842_p1.read().is_01() || !ap_const_lv23_0.is_01())? sc_lv<1>(): sc_lv<1>(trunc_ln191_25_fu_5842_p1.read() == ap_const_lv23_0);
}
void pool_write::thread_icmp_ln191_52_fu_5934_p2() {
icmp_ln191_52_fu_5934_p2 = (!tmp_123_fu_5903_p4.read().is_01() || !ap_const_lv8_FF.is_01())? sc_lv<1>(): sc_lv<1>(tmp_123_fu_5903_p4.read() != ap_const_lv8_FF);
}
void pool_write::thread_icmp_ln191_53_fu_5940_p2() {
icmp_ln191_53_fu_5940_p2 = (!trunc_ln191_26_fu_5913_p1.read().is_01() || !ap_const_lv23_0.is_01())? sc_lv<1>(): sc_lv<1>(trunc_ln191_26_fu_5913_p1.read() == ap_const_lv23_0);
}
void pool_write::thread_icmp_ln191_54_fu_5952_p2() {
icmp_ln191_54_fu_5952_p2 = (!tmp_124_fu_5920_p4.read().is_01() || !ap_const_lv8_FF.is_01())? sc_lv<1>(): sc_lv<1>(tmp_124_fu_5920_p4.read() != ap_const_lv8_FF);
}
void pool_write::thread_icmp_ln191_55_fu_5958_p2() {
icmp_ln191_55_fu_5958_p2 = (!trunc_ln191_27_fu_5930_p1.read().is_01() || !ap_const_lv23_0.is_01())? sc_lv<1>(): sc_lv<1>(trunc_ln191_27_fu_5930_p1.read() == ap_const_lv23_0);
}
void pool_write::thread_icmp_ln191_56_fu_6022_p2() {
icmp_ln191_56_fu_6022_p2 = (!tmp_132_fu_5991_p4.read().is_01() || !ap_const_lv8_FF.is_01())? sc_lv<1>(): sc_lv<1>(tmp_132_fu_5991_p4.read() != ap_const_lv8_FF);
}
void pool_write::thread_icmp_ln191_57_fu_6028_p2() {
icmp_ln191_57_fu_6028_p2 = (!trunc_ln191_28_fu_6001_p1.read().is_01() || !ap_const_lv23_0.is_01())? sc_lv<1>(): sc_lv<1>(trunc_ln191_28_fu_6001_p1.read() == ap_const_lv23_0);
}
void pool_write::thread_icmp_ln191_58_fu_6040_p2() {
icmp_ln191_58_fu_6040_p2 = (!tmp_133_fu_6008_p4.read().is_01() || !ap_const_lv8_FF.is_01())? sc_lv<1>(): sc_lv<1>(tmp_133_fu_6008_p4.read() != ap_const_lv8_FF);
}
void pool_write::thread_icmp_ln191_59_fu_6046_p2() {
icmp_ln191_59_fu_6046_p2 = (!trunc_ln191_29_fu_6018_p1.read().is_01() || !ap_const_lv23_0.is_01())? sc_lv<1>(): sc_lv<1>(trunc_ln191_29_fu_6018_p1.read() == ap_const_lv23_0);
}
void pool_write::thread_icmp_ln191_5_fu_4754_p2() {
icmp_ln191_5_fu_4754_p2 = (!trunc_ln191_2_fu_4726_p1.read().is_01() || !ap_const_lv23_0.is_01())? sc_lv<1>(): sc_lv<1>(trunc_ln191_2_fu_4726_p1.read() == ap_const_lv23_0);
}
void pool_write::thread_icmp_ln191_60_fu_6110_p2() {
icmp_ln191_60_fu_6110_p2 = (!tmp_141_fu_6079_p4.read().is_01() || !ap_const_lv8_FF.is_01())? sc_lv<1>(): sc_lv<1>(tmp_141_fu_6079_p4.read() != ap_const_lv8_FF);
}
void pool_write::thread_icmp_ln191_61_fu_6116_p2() {
icmp_ln191_61_fu_6116_p2 = (!trunc_ln191_30_fu_6089_p1.read().is_01() || !ap_const_lv23_0.is_01())? sc_lv<1>(): sc_lv<1>(trunc_ln191_30_fu_6089_p1.read() == ap_const_lv23_0);
}
void pool_write::thread_icmp_ln191_62_fu_6128_p2() {
icmp_ln191_62_fu_6128_p2 = (!tmp_142_fu_6096_p4.read().is_01() || !ap_const_lv8_FF.is_01())? sc_lv<1>(): sc_lv<1>(tmp_142_fu_6096_p4.read() != ap_const_lv8_FF);
}
void pool_write::thread_icmp_ln191_63_fu_6134_p2() {
icmp_ln191_63_fu_6134_p2 = (!trunc_ln191_31_fu_6106_p1.read().is_01() || !ap_const_lv23_0.is_01())? sc_lv<1>(): sc_lv<1>(trunc_ln191_31_fu_6106_p1.read() == ap_const_lv23_0);
}
void pool_write::thread_icmp_ln191_6_fu_4766_p2() {
icmp_ln191_6_fu_4766_p2 = (!tmp_16_fu_4734_p4.read().is_01() || !ap_const_lv8_FF.is_01())? sc_lv<1>(): sc_lv<1>(tmp_16_fu_4734_p4.read() != ap_const_lv8_FF);
}
void pool_write::thread_icmp_ln191_7_fu_4772_p2() {
icmp_ln191_7_fu_4772_p2 = (!trunc_ln191_3_fu_4744_p1.read().is_01() || !ap_const_lv23_0.is_01())? sc_lv<1>(): sc_lv<1>(trunc_ln191_3_fu_4744_p1.read() == ap_const_lv23_0);
}
void pool_write::thread_icmp_ln191_8_fu_4840_p2() {
icmp_ln191_8_fu_4840_p2 = (!tmp_24_fu_4808_p4.read().is_01() || !ap_const_lv8_FF.is_01())? sc_lv<1>(): sc_lv<1>(tmp_24_fu_4808_p4.read() != ap_const_lv8_FF);
}
void pool_write::thread_icmp_ln191_9_fu_4846_p2() {
icmp_ln191_9_fu_4846_p2 = (!trunc_ln191_4_fu_4818_p1.read().is_01() || !ap_const_lv23_0.is_01())? sc_lv<1>(): sc_lv<1>(trunc_ln191_4_fu_4818_p1.read() == ap_const_lv23_0);
}
void pool_write::thread_icmp_ln191_fu_4656_p2() {
icmp_ln191_fu_4656_p2 = (!tmp_7_fu_4624_p4.read().is_01() || !ap_const_lv8_FF.is_01())? sc_lv<1>(): sc_lv<1>(tmp_7_fu_4624_p4.read() != ap_const_lv8_FF);
}
void pool_write::thread_ifm_buff0_0_address0() {
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage1.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter1.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage1.read(), ap_const_boolean_0))) {
ifm_buff0_0_address0 = (sc_lv<6>) (zext_ln189_2_fu_4202_p1.read());
} else if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0.read(), ap_const_boolean_0))) {
ifm_buff0_0_address0 = (sc_lv<6>) (zext_ln189_fu_1740_p1.read());
} else {
ifm_buff0_0_address0 = (sc_lv<6>) ("XXXXXX");
}
}
void pool_write::thread_ifm_buff0_0_address1() {
ifm_buff0_0_address1 = (sc_lv<6>) (zext_ln189_1_fu_1776_p1.read());
}
void pool_write::thread_ifm_buff0_0_ce0() {
if (((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0_11001.read(), ap_const_boolean_0) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter0.read())) ||
(esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage1.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage1_11001.read(), ap_const_boolean_0) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter1.read())))) {
ifm_buff0_0_ce0 = ap_const_logic_1;
} else {
ifm_buff0_0_ce0 = ap_const_logic_0;
}
}
void pool_write::thread_ifm_buff0_0_ce1() {
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0_11001.read(), ap_const_boolean_0) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter0.read()))) {
ifm_buff0_0_ce1 = ap_const_logic_1;
} else {
ifm_buff0_0_ce1 = ap_const_logic_0;
}
}
void pool_write::thread_ifm_buff0_10_address0() {
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage1.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter1.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage1.read(), ap_const_boolean_0))) {
ifm_buff0_10_address0 = (sc_lv<6>) (zext_ln189_12_fu_4422_p1.read());
} else if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0.read(), ap_const_boolean_0))) {
ifm_buff0_10_address0 = (sc_lv<6>) (zext_ln189_fu_1740_p1.read());
} else {
ifm_buff0_10_address0 = (sc_lv<6>) ("XXXXXX");
}
}
void pool_write::thread_ifm_buff0_10_address1() {
ifm_buff0_10_address1 = (sc_lv<6>) (zext_ln189_1_fu_1776_p1.read());
}
void pool_write::thread_ifm_buff0_10_ce0() {
if (((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0_11001.read(), ap_const_boolean_0) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter0.read())) ||
(esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage1.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage1_11001.read(), ap_const_boolean_0) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter1.read())))) {
ifm_buff0_10_ce0 = ap_const_logic_1;
} else {
ifm_buff0_10_ce0 = ap_const_logic_0;
}
}
void pool_write::thread_ifm_buff0_10_ce1() {
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0_11001.read(), ap_const_boolean_0) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter0.read()))) {
ifm_buff0_10_ce1 = ap_const_logic_1;
} else {
ifm_buff0_10_ce1 = ap_const_logic_0;
}
}
void pool_write::thread_ifm_buff0_11_address0() {
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage1.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter1.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage1.read(), ap_const_boolean_0))) {
ifm_buff0_11_address0 = (sc_lv<6>) (zext_ln189_13_fu_4444_p1.read());
} else if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0.read(), ap_const_boolean_0))) {
ifm_buff0_11_address0 = (sc_lv<6>) (zext_ln189_fu_1740_p1.read());
} else {
ifm_buff0_11_address0 = (sc_lv<6>) ("XXXXXX");
}
}
void pool_write::thread_ifm_buff0_11_address1() {
ifm_buff0_11_address1 = (sc_lv<6>) (zext_ln189_1_fu_1776_p1.read());
}
void pool_write::thread_ifm_buff0_11_ce0() {
if (((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0_11001.read(), ap_const_boolean_0) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter0.read())) ||
(esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage1.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage1_11001.read(), ap_const_boolean_0) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter1.read())))) {
ifm_buff0_11_ce0 = ap_const_logic_1;
} else {
ifm_buff0_11_ce0 = ap_const_logic_0;
}
}
void pool_write::thread_ifm_buff0_11_ce1() {
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0_11001.read(), ap_const_boolean_0) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter0.read()))) {
ifm_buff0_11_ce1 = ap_const_logic_1;
} else {
ifm_buff0_11_ce1 = ap_const_logic_0;
}
}
void pool_write::thread_ifm_buff0_12_address0() {
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage1.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter2.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage1.read(), ap_const_boolean_0))) {
ifm_buff0_12_address0 = (sc_lv<6>) (zext_ln189_14_fu_5730_p1.read());
} else if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0.read(), ap_const_boolean_0))) {
ifm_buff0_12_address0 = (sc_lv<6>) (zext_ln189_fu_1740_p1.read());
} else {
ifm_buff0_12_address0 = (sc_lv<6>) ("XXXXXX");
}
}
void pool_write::thread_ifm_buff0_12_address1() {
ifm_buff0_12_address1 = (sc_lv<6>) (zext_ln189_1_fu_1776_p1.read());
}
void pool_write::thread_ifm_buff0_12_ce0() {
if (((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0_11001.read(), ap_const_boolean_0) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter0.read())) ||
(esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage1.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage1_11001.read(), ap_const_boolean_0) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter2.read())))) {
ifm_buff0_12_ce0 = ap_const_logic_1;
} else {
ifm_buff0_12_ce0 = ap_const_logic_0;
}
}
void pool_write::thread_ifm_buff0_12_ce1() {
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0_11001.read(), ap_const_boolean_0) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter0.read()))) {
ifm_buff0_12_ce1 = ap_const_logic_1;
} else {
ifm_buff0_12_ce1 = ap_const_logic_0;
}
}
void pool_write::thread_ifm_buff0_13_address0() {
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage1.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter2.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage1.read(), ap_const_boolean_0))) {
ifm_buff0_13_address0 = (sc_lv<6>) (zext_ln189_15_fu_5752_p1.read());
} else if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0.read(), ap_const_boolean_0))) {
ifm_buff0_13_address0 = (sc_lv<6>) (zext_ln189_fu_1740_p1.read());
} else {
ifm_buff0_13_address0 = (sc_lv<6>) ("XXXXXX");
}
}
void pool_write::thread_ifm_buff0_13_address1() {
ifm_buff0_13_address1 = (sc_lv<6>) (zext_ln189_1_fu_1776_p1.read());
}
void pool_write::thread_ifm_buff0_13_ce0() {
if (((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0_11001.read(), ap_const_boolean_0) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter0.read())) ||
(esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage1.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage1_11001.read(), ap_const_boolean_0) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter2.read())))) {
ifm_buff0_13_ce0 = ap_const_logic_1;
} else {
ifm_buff0_13_ce0 = ap_const_logic_0;
}
}
void pool_write::thread_ifm_buff0_13_ce1() {
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0_11001.read(), ap_const_boolean_0) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter0.read()))) {
ifm_buff0_13_ce1 = ap_const_logic_1;
} else {
ifm_buff0_13_ce1 = ap_const_logic_0;
}
}
void pool_write::thread_ifm_buff0_14_address0() {
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage1.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter2.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage1.read(), ap_const_boolean_0))) {
ifm_buff0_14_address0 = (sc_lv<6>) (zext_ln189_16_fu_5774_p1.read());
} else if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0.read(), ap_const_boolean_0))) {
ifm_buff0_14_address0 = (sc_lv<6>) (zext_ln189_fu_1740_p1.read());
} else {
ifm_buff0_14_address0 = (sc_lv<6>) ("XXXXXX");
}
}
void pool_write::thread_ifm_buff0_14_address1() {
ifm_buff0_14_address1 = (sc_lv<6>) (zext_ln189_1_fu_1776_p1.read());
}
void pool_write::thread_ifm_buff0_14_ce0() {
if (((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0_11001.read(), ap_const_boolean_0) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter0.read())) ||
(esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage1.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage1_11001.read(), ap_const_boolean_0) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter2.read())))) {
ifm_buff0_14_ce0 = ap_const_logic_1;
} else {
ifm_buff0_14_ce0 = ap_const_logic_0;
}
}
void pool_write::thread_ifm_buff0_14_ce1() {
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0_11001.read(), ap_const_boolean_0) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter0.read()))) {
ifm_buff0_14_ce1 = ap_const_logic_1;
} else {
ifm_buff0_14_ce1 = ap_const_logic_0;
}
}
void pool_write::thread_ifm_buff0_15_address0() {
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage1.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter2.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage1.read(), ap_const_boolean_0))) {
ifm_buff0_15_address0 = (sc_lv<6>) (zext_ln189_17_fu_5796_p1.read());
} else if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0.read(), ap_const_boolean_0))) {
ifm_buff0_15_address0 = (sc_lv<6>) (zext_ln189_fu_1740_p1.read());
} else {
ifm_buff0_15_address0 = (sc_lv<6>) ("XXXXXX");
}
}
void pool_write::thread_ifm_buff0_15_address1() {
ifm_buff0_15_address1 = (sc_lv<6>) (zext_ln189_1_fu_1776_p1.read());
}
void pool_write::thread_ifm_buff0_15_ce0() {
if (((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0_11001.read(), ap_const_boolean_0) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter0.read())) ||
(esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage1.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage1_11001.read(), ap_const_boolean_0) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter2.read())))) {
ifm_buff0_15_ce0 = ap_const_logic_1;
} else {
ifm_buff0_15_ce0 = ap_const_logic_0;
}
}
void pool_write::thread_ifm_buff0_15_ce1() {
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0_11001.read(), ap_const_boolean_0) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter0.read()))) {
ifm_buff0_15_ce1 = ap_const_logic_1;
} else {
ifm_buff0_15_ce1 = ap_const_logic_0;
}
}
void pool_write::thread_ifm_buff0_1_address0() {
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage1.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter1.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage1.read(), ap_const_boolean_0))) {
ifm_buff0_1_address0 = (sc_lv<6>) (zext_ln189_3_fu_4224_p1.read());
} else if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0.read(), ap_const_boolean_0))) {
ifm_buff0_1_address0 = (sc_lv<6>) (zext_ln189_fu_1740_p1.read());
} else {
ifm_buff0_1_address0 = (sc_lv<6>) ("XXXXXX");
}
}
void pool_write::thread_ifm_buff0_1_address1() {
ifm_buff0_1_address1 = (sc_lv<6>) (zext_ln189_1_fu_1776_p1.read());
}
void pool_write::thread_ifm_buff0_1_ce0() {
if (((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0_11001.read(), ap_const_boolean_0) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter0.read())) ||
(esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage1.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage1_11001.read(), ap_const_boolean_0) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter1.read())))) {
ifm_buff0_1_ce0 = ap_const_logic_1;
} else {
ifm_buff0_1_ce0 = ap_const_logic_0;
}
}
void pool_write::thread_ifm_buff0_1_ce1() {
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0_11001.read(), ap_const_boolean_0) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter0.read()))) {
ifm_buff0_1_ce1 = ap_const_logic_1;
} else {
ifm_buff0_1_ce1 = ap_const_logic_0;
}
}
void pool_write::thread_ifm_buff0_2_address0() {
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage1.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter1.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage1.read(), ap_const_boolean_0))) {
ifm_buff0_2_address0 = (sc_lv<6>) (zext_ln189_4_fu_4246_p1.read());
} else if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0.read(), ap_const_boolean_0))) {
ifm_buff0_2_address0 = (sc_lv<6>) (zext_ln189_fu_1740_p1.read());
} else {
ifm_buff0_2_address0 = (sc_lv<6>) ("XXXXXX");
}
}
void pool_write::thread_ifm_buff0_2_address1() {
ifm_buff0_2_address1 = (sc_lv<6>) (zext_ln189_1_fu_1776_p1.read());
}
void pool_write::thread_ifm_buff0_2_ce0() {
if (((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0_11001.read(), ap_const_boolean_0) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter0.read())) ||
(esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage1.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage1_11001.read(), ap_const_boolean_0) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter1.read())))) {
ifm_buff0_2_ce0 = ap_const_logic_1;
} else {
ifm_buff0_2_ce0 = ap_const_logic_0;
}
}
void pool_write::thread_ifm_buff0_2_ce1() {
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0_11001.read(), ap_const_boolean_0) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter0.read()))) {
ifm_buff0_2_ce1 = ap_const_logic_1;
} else {
ifm_buff0_2_ce1 = ap_const_logic_0;
}
}
void pool_write::thread_ifm_buff0_3_address0() {
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage1.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter1.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage1.read(), ap_const_boolean_0))) {
ifm_buff0_3_address0 = (sc_lv<6>) (zext_ln189_5_fu_4268_p1.read());
} else if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0.read(), ap_const_boolean_0))) {
ifm_buff0_3_address0 = (sc_lv<6>) (zext_ln189_fu_1740_p1.read());
} else {
ifm_buff0_3_address0 = (sc_lv<6>) ("XXXXXX");
}
}
void pool_write::thread_ifm_buff0_3_address1() {
ifm_buff0_3_address1 = (sc_lv<6>) (zext_ln189_1_fu_1776_p1.read());
}
void pool_write::thread_ifm_buff0_3_ce0() {
if (((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0_11001.read(), ap_const_boolean_0) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter0.read())) ||
(esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage1.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage1_11001.read(), ap_const_boolean_0) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter1.read())))) {
ifm_buff0_3_ce0 = ap_const_logic_1;
} else {
ifm_buff0_3_ce0 = ap_const_logic_0;
}
}
void pool_write::thread_ifm_buff0_3_ce1() {
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0_11001.read(), ap_const_boolean_0) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter0.read()))) {
ifm_buff0_3_ce1 = ap_const_logic_1;
} else {
ifm_buff0_3_ce1 = ap_const_logic_0;
}
}
void pool_write::thread_ifm_buff0_4_address0() {
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage1.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter1.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage1.read(), ap_const_boolean_0))) {
ifm_buff0_4_address0 = (sc_lv<6>) (zext_ln189_6_fu_4290_p1.read());
} else if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0.read(), ap_const_boolean_0))) {
ifm_buff0_4_address0 = (sc_lv<6>) (zext_ln189_fu_1740_p1.read());
} else {
ifm_buff0_4_address0 = (sc_lv<6>) ("XXXXXX");
}
}
void pool_write::thread_ifm_buff0_4_address1() {
ifm_buff0_4_address1 = (sc_lv<6>) (zext_ln189_1_fu_1776_p1.read());
}
void pool_write::thread_ifm_buff0_4_ce0() {
if (((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0_11001.read(), ap_const_boolean_0) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter0.read())) ||
(esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage1.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage1_11001.read(), ap_const_boolean_0) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter1.read())))) {
ifm_buff0_4_ce0 = ap_const_logic_1;
} else {
ifm_buff0_4_ce0 = ap_const_logic_0;
}
}
void pool_write::thread_ifm_buff0_4_ce1() {
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0_11001.read(), ap_const_boolean_0) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter0.read()))) {
ifm_buff0_4_ce1 = ap_const_logic_1;
} else {
ifm_buff0_4_ce1 = ap_const_logic_0;
}
}
void pool_write::thread_ifm_buff0_5_address0() {
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage1.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter1.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage1.read(), ap_const_boolean_0))) {
ifm_buff0_5_address0 = (sc_lv<6>) (zext_ln189_7_fu_4312_p1.read());
} else if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0.read(), ap_const_boolean_0))) {
ifm_buff0_5_address0 = (sc_lv<6>) (zext_ln189_fu_1740_p1.read());
} else {
ifm_buff0_5_address0 = (sc_lv<6>) ("XXXXXX");
}
}
void pool_write::thread_ifm_buff0_5_address1() {
ifm_buff0_5_address1 = (sc_lv<6>) (zext_ln189_1_fu_1776_p1.read());
}
void pool_write::thread_ifm_buff0_5_ce0() {
if (((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0_11001.read(), ap_const_boolean_0) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter0.read())) ||
(esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage1.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage1_11001.read(), ap_const_boolean_0) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter1.read())))) {
ifm_buff0_5_ce0 = ap_const_logic_1;
} else {
ifm_buff0_5_ce0 = ap_const_logic_0;
}
}
void pool_write::thread_ifm_buff0_5_ce1() {
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0_11001.read(), ap_const_boolean_0) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter0.read()))) {
ifm_buff0_5_ce1 = ap_const_logic_1;
} else {
ifm_buff0_5_ce1 = ap_const_logic_0;
}
}
void pool_write::thread_ifm_buff0_6_address0() {
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage1.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter1.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage1.read(), ap_const_boolean_0))) {
ifm_buff0_6_address0 = (sc_lv<6>) (zext_ln189_8_fu_4334_p1.read());
} else if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0.read(), ap_const_boolean_0))) {
ifm_buff0_6_address0 = (sc_lv<6>) (zext_ln189_fu_1740_p1.read());
} else {
ifm_buff0_6_address0 = (sc_lv<6>) ("XXXXXX");
}
}
void pool_write::thread_ifm_buff0_6_address1() {
ifm_buff0_6_address1 = (sc_lv<6>) (zext_ln189_1_fu_1776_p1.read());
}
void pool_write::thread_ifm_buff0_6_ce0() {
if (((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0_11001.read(), ap_const_boolean_0) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter0.read())) ||
(esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage1.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage1_11001.read(), ap_const_boolean_0) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter1.read())))) {
ifm_buff0_6_ce0 = ap_const_logic_1;
} else {
ifm_buff0_6_ce0 = ap_const_logic_0;
}
}
void pool_write::thread_ifm_buff0_6_ce1() {
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0_11001.read(), ap_const_boolean_0) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter0.read()))) {
ifm_buff0_6_ce1 = ap_const_logic_1;
} else {
ifm_buff0_6_ce1 = ap_const_logic_0;
}
}
void pool_write::thread_ifm_buff0_7_address0() {
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage1.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter1.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage1.read(), ap_const_boolean_0))) {
ifm_buff0_7_address0 = (sc_lv<6>) (zext_ln189_9_fu_4356_p1.read());
} else if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0.read(), ap_const_boolean_0))) {
ifm_buff0_7_address0 = (sc_lv<6>) (zext_ln189_fu_1740_p1.read());
} else {
ifm_buff0_7_address0 = (sc_lv<6>) ("XXXXXX");
}
}
void pool_write::thread_ifm_buff0_7_address1() {
ifm_buff0_7_address1 = (sc_lv<6>) (zext_ln189_1_fu_1776_p1.read());
}
void pool_write::thread_ifm_buff0_7_ce0() {
if (((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0_11001.read(), ap_const_boolean_0) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter0.read())) ||
(esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage1.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage1_11001.read(), ap_const_boolean_0) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter1.read())))) {
ifm_buff0_7_ce0 = ap_const_logic_1;
} else {
ifm_buff0_7_ce0 = ap_const_logic_0;
}
}
void pool_write::thread_ifm_buff0_7_ce1() {
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0_11001.read(), ap_const_boolean_0) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter0.read()))) {
ifm_buff0_7_ce1 = ap_const_logic_1;
} else {
ifm_buff0_7_ce1 = ap_const_logic_0;
}
}
void pool_write::thread_ifm_buff0_8_address0() {
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage1.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter1.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage1.read(), ap_const_boolean_0))) {
ifm_buff0_8_address0 = (sc_lv<6>) (zext_ln189_10_fu_4378_p1.read());
} else if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0.read(), ap_const_boolean_0))) {
ifm_buff0_8_address0 = (sc_lv<6>) (zext_ln189_fu_1740_p1.read());
} else {
ifm_buff0_8_address0 = (sc_lv<6>) ("XXXXXX");
}
}
void pool_write::thread_ifm_buff0_8_address1() {
ifm_buff0_8_address1 = (sc_lv<6>) (zext_ln189_1_fu_1776_p1.read());
}
void pool_write::thread_ifm_buff0_8_ce0() {
if (((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0_11001.read(), ap_const_boolean_0) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter0.read())) ||
(esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage1.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage1_11001.read(), ap_const_boolean_0) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter1.read())))) {
ifm_buff0_8_ce0 = ap_const_logic_1;
} else {
ifm_buff0_8_ce0 = ap_const_logic_0;
}
}
void pool_write::thread_ifm_buff0_8_ce1() {
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0_11001.read(), ap_const_boolean_0) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter0.read()))) {
ifm_buff0_8_ce1 = ap_const_logic_1;
} else {
ifm_buff0_8_ce1 = ap_const_logic_0;
}
}
void pool_write::thread_ifm_buff0_9_address0() {
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage1.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter1.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage1.read(), ap_const_boolean_0))) {
ifm_buff0_9_address0 = (sc_lv<6>) (zext_ln189_11_fu_4400_p1.read());
} else if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0.read(), ap_const_boolean_0))) {
ifm_buff0_9_address0 = (sc_lv<6>) (zext_ln189_fu_1740_p1.read());
} else {
ifm_buff0_9_address0 = (sc_lv<6>) ("XXXXXX");
}
}
void pool_write::thread_ifm_buff0_9_address1() {
ifm_buff0_9_address1 = (sc_lv<6>) (zext_ln189_1_fu_1776_p1.read());
}
void pool_write::thread_ifm_buff0_9_ce0() {
if (((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0_11001.read(), ap_const_boolean_0) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter0.read())) ||
(esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage1.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage1_11001.read(), ap_const_boolean_0) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter1.read())))) {
ifm_buff0_9_ce0 = ap_const_logic_1;
} else {
ifm_buff0_9_ce0 = ap_const_logic_0;
}
}
void pool_write::thread_ifm_buff0_9_ce1() {
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0_11001.read(), ap_const_boolean_0) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter0.read()))) {
ifm_buff0_9_ce1 = ap_const_logic_1;
} else {
ifm_buff0_9_ce1 = ap_const_logic_0;
}
}
void pool_write::thread_ifm_buff1_0_address0() {
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage1.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter1.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage1.read(), ap_const_boolean_0))) {
ifm_buff1_0_address0 = (sc_lv<6>) (zext_ln190_fu_4213_p1.read());
} else if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0.read(), ap_const_boolean_0))) {
ifm_buff1_0_address0 = (sc_lv<6>) (zext_ln189_fu_1740_p1.read());
} else {
ifm_buff1_0_address0 = (sc_lv<6>) ("XXXXXX");
}
}
void pool_write::thread_ifm_buff1_0_address1() {
ifm_buff1_0_address1 = (sc_lv<6>) (zext_ln189_1_fu_1776_p1.read());
}
void pool_write::thread_ifm_buff1_0_ce0() {
if (((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0_11001.read(), ap_const_boolean_0) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter0.read())) ||
(esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage1.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage1_11001.read(), ap_const_boolean_0) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter1.read())))) {
ifm_buff1_0_ce0 = ap_const_logic_1;
} else {
ifm_buff1_0_ce0 = ap_const_logic_0;
}
}
void pool_write::thread_ifm_buff1_0_ce1() {
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0_11001.read(), ap_const_boolean_0) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter0.read()))) {
ifm_buff1_0_ce1 = ap_const_logic_1;
} else {
ifm_buff1_0_ce1 = ap_const_logic_0;
}
}
void pool_write::thread_ifm_buff1_10_address0() {
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage1.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter1.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage1.read(), ap_const_boolean_0))) {
ifm_buff1_10_address0 = (sc_lv<6>) (zext_ln190_10_fu_4433_p1.read());
} else if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0.read(), ap_const_boolean_0))) {
ifm_buff1_10_address0 = (sc_lv<6>) (zext_ln189_fu_1740_p1.read());
} else {
ifm_buff1_10_address0 = (sc_lv<6>) ("XXXXXX");
}
}
void pool_write::thread_ifm_buff1_10_address1() {
ifm_buff1_10_address1 = (sc_lv<6>) (zext_ln189_1_fu_1776_p1.read());
}
void pool_write::thread_ifm_buff1_10_ce0() {
if (((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0_11001.read(), ap_const_boolean_0) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter0.read())) ||
(esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage1.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage1_11001.read(), ap_const_boolean_0) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter1.read())))) {
ifm_buff1_10_ce0 = ap_const_logic_1;
} else {
ifm_buff1_10_ce0 = ap_const_logic_0;
}
}
void pool_write::thread_ifm_buff1_10_ce1() {
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0_11001.read(), ap_const_boolean_0) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter0.read()))) {
ifm_buff1_10_ce1 = ap_const_logic_1;
} else {
ifm_buff1_10_ce1 = ap_const_logic_0;
}
}
void pool_write::thread_ifm_buff1_11_address0() {
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage1.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter1.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage1.read(), ap_const_boolean_0))) {
ifm_buff1_11_address0 = (sc_lv<6>) (zext_ln190_11_fu_4455_p1.read());
} else if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0.read(), ap_const_boolean_0))) {
ifm_buff1_11_address0 = (sc_lv<6>) (zext_ln189_fu_1740_p1.read());
} else {
ifm_buff1_11_address0 = (sc_lv<6>) ("XXXXXX");
}
}
void pool_write::thread_ifm_buff1_11_address1() {
ifm_buff1_11_address1 = (sc_lv<6>) (zext_ln189_1_fu_1776_p1.read());
}
void pool_write::thread_ifm_buff1_11_ce0() {
if (((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0_11001.read(), ap_const_boolean_0) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter0.read())) ||
(esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage1.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage1_11001.read(), ap_const_boolean_0) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter1.read())))) {
ifm_buff1_11_ce0 = ap_const_logic_1;
} else {
ifm_buff1_11_ce0 = ap_const_logic_0;
}
}
void pool_write::thread_ifm_buff1_11_ce1() {
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0_11001.read(), ap_const_boolean_0) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter0.read()))) {
ifm_buff1_11_ce1 = ap_const_logic_1;
} else {
ifm_buff1_11_ce1 = ap_const_logic_0;
}
}
void pool_write::thread_ifm_buff1_12_address0() {
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage1.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter2.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage1.read(), ap_const_boolean_0))) {
ifm_buff1_12_address0 = (sc_lv<6>) (zext_ln190_12_fu_5741_p1.read());
} else if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0.read(), ap_const_boolean_0))) {
ifm_buff1_12_address0 = (sc_lv<6>) (zext_ln189_fu_1740_p1.read());
} else {
ifm_buff1_12_address0 = (sc_lv<6>) ("XXXXXX");
}
}
void pool_write::thread_ifm_buff1_12_address1() {
ifm_buff1_12_address1 = (sc_lv<6>) (zext_ln189_1_fu_1776_p1.read());
}
void pool_write::thread_ifm_buff1_12_ce0() {
if (((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0_11001.read(), ap_const_boolean_0) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter0.read())) ||
(esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage1.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage1_11001.read(), ap_const_boolean_0) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter2.read())))) {
ifm_buff1_12_ce0 = ap_const_logic_1;
} else {
ifm_buff1_12_ce0 = ap_const_logic_0;
}
}
void pool_write::thread_ifm_buff1_12_ce1() {
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0_11001.read(), ap_const_boolean_0) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter0.read()))) {
ifm_buff1_12_ce1 = ap_const_logic_1;
} else {
ifm_buff1_12_ce1 = ap_const_logic_0;
}
}
void pool_write::thread_ifm_buff1_13_address0() {
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage1.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter2.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage1.read(), ap_const_boolean_0))) {
ifm_buff1_13_address0 = (sc_lv<6>) (zext_ln190_13_fu_5763_p1.read());
} else if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0.read(), ap_const_boolean_0))) {
ifm_buff1_13_address0 = (sc_lv<6>) (zext_ln189_fu_1740_p1.read());
} else {
ifm_buff1_13_address0 = (sc_lv<6>) ("XXXXXX");
}
}
void pool_write::thread_ifm_buff1_13_address1() {
ifm_buff1_13_address1 = (sc_lv<6>) (zext_ln189_1_fu_1776_p1.read());
}
void pool_write::thread_ifm_buff1_13_ce0() {
if (((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0_11001.read(), ap_const_boolean_0) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter0.read())) ||
(esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage1.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage1_11001.read(), ap_const_boolean_0) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter2.read())))) {
ifm_buff1_13_ce0 = ap_const_logic_1;
} else {
ifm_buff1_13_ce0 = ap_const_logic_0;
}
}
void pool_write::thread_ifm_buff1_13_ce1() {
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0_11001.read(), ap_const_boolean_0) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter0.read()))) {
ifm_buff1_13_ce1 = ap_const_logic_1;
} else {
ifm_buff1_13_ce1 = ap_const_logic_0;
}
}
void pool_write::thread_ifm_buff1_14_address0() {
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage1.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter2.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage1.read(), ap_const_boolean_0))) {
ifm_buff1_14_address0 = (sc_lv<6>) (zext_ln190_14_fu_5785_p1.read());
} else if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0.read(), ap_const_boolean_0))) {
ifm_buff1_14_address0 = (sc_lv<6>) (zext_ln189_fu_1740_p1.read());
} else {
ifm_buff1_14_address0 = (sc_lv<6>) ("XXXXXX");
}
}
void pool_write::thread_ifm_buff1_14_address1() {
ifm_buff1_14_address1 = (sc_lv<6>) (zext_ln189_1_fu_1776_p1.read());
}
void pool_write::thread_ifm_buff1_14_ce0() {
if (((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0_11001.read(), ap_const_boolean_0) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter0.read())) ||
(esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage1.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage1_11001.read(), ap_const_boolean_0) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter2.read())))) {
ifm_buff1_14_ce0 = ap_const_logic_1;
} else {
ifm_buff1_14_ce0 = ap_const_logic_0;
}
}
void pool_write::thread_ifm_buff1_14_ce1() {
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0_11001.read(), ap_const_boolean_0) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter0.read()))) {
ifm_buff1_14_ce1 = ap_const_logic_1;
} else {
ifm_buff1_14_ce1 = ap_const_logic_0;
}
}
void pool_write::thread_ifm_buff1_15_address0() {
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage1.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter2.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage1.read(), ap_const_boolean_0))) {
ifm_buff1_15_address0 = (sc_lv<6>) (zext_ln190_15_fu_5807_p1.read());
} else if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0.read(), ap_const_boolean_0))) {
ifm_buff1_15_address0 = (sc_lv<6>) (zext_ln189_fu_1740_p1.read());
} else {
ifm_buff1_15_address0 = (sc_lv<6>) ("XXXXXX");
}
}
void pool_write::thread_ifm_buff1_15_address1() {
ifm_buff1_15_address1 = (sc_lv<6>) (zext_ln189_1_fu_1776_p1.read());
}
void pool_write::thread_ifm_buff1_15_ce0() {
if (((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0_11001.read(), ap_const_boolean_0) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter0.read())) ||
(esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage1.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage1_11001.read(), ap_const_boolean_0) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter2.read())))) {
ifm_buff1_15_ce0 = ap_const_logic_1;
} else {
ifm_buff1_15_ce0 = ap_const_logic_0;
}
}
void pool_write::thread_ifm_buff1_15_ce1() {
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0_11001.read(), ap_const_boolean_0) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter0.read()))) {
ifm_buff1_15_ce1 = ap_const_logic_1;
} else {
ifm_buff1_15_ce1 = ap_const_logic_0;
}
}
void pool_write::thread_ifm_buff1_1_address0() {
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage1.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter1.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage1.read(), ap_const_boolean_0))) {
ifm_buff1_1_address0 = (sc_lv<6>) (zext_ln190_1_fu_4235_p1.read());
} else if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0.read(), ap_const_boolean_0))) {
ifm_buff1_1_address0 = (sc_lv<6>) (zext_ln189_fu_1740_p1.read());
} else {
ifm_buff1_1_address0 = (sc_lv<6>) ("XXXXXX");
}
}
void pool_write::thread_ifm_buff1_1_address1() {
ifm_buff1_1_address1 = (sc_lv<6>) (zext_ln189_1_fu_1776_p1.read());
}
void pool_write::thread_ifm_buff1_1_ce0() {
if (((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0_11001.read(), ap_const_boolean_0) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter0.read())) ||
(esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage1.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage1_11001.read(), ap_const_boolean_0) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter1.read())))) {
ifm_buff1_1_ce0 = ap_const_logic_1;
} else {
ifm_buff1_1_ce0 = ap_const_logic_0;
}
}
void pool_write::thread_ifm_buff1_1_ce1() {
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0_11001.read(), ap_const_boolean_0) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter0.read()))) {
ifm_buff1_1_ce1 = ap_const_logic_1;
} else {
ifm_buff1_1_ce1 = ap_const_logic_0;
}
}
void pool_write::thread_ifm_buff1_2_address0() {
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage1.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter1.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage1.read(), ap_const_boolean_0))) {
ifm_buff1_2_address0 = (sc_lv<6>) (zext_ln190_2_fu_4257_p1.read());
} else if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0.read(), ap_const_boolean_0))) {
ifm_buff1_2_address0 = (sc_lv<6>) (zext_ln189_fu_1740_p1.read());
} else {
ifm_buff1_2_address0 = (sc_lv<6>) ("XXXXXX");
}
}
void pool_write::thread_ifm_buff1_2_address1() {
ifm_buff1_2_address1 = (sc_lv<6>) (zext_ln189_1_fu_1776_p1.read());
}
void pool_write::thread_ifm_buff1_2_ce0() {
if (((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0_11001.read(), ap_const_boolean_0) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter0.read())) ||
(esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage1.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage1_11001.read(), ap_const_boolean_0) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter1.read())))) {
ifm_buff1_2_ce0 = ap_const_logic_1;
} else {
ifm_buff1_2_ce0 = ap_const_logic_0;
}
}
void pool_write::thread_ifm_buff1_2_ce1() {
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0_11001.read(), ap_const_boolean_0) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter0.read()))) {
ifm_buff1_2_ce1 = ap_const_logic_1;
} else {
ifm_buff1_2_ce1 = ap_const_logic_0;
}
}
void pool_write::thread_ifm_buff1_3_address0() {
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage1.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter1.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage1.read(), ap_const_boolean_0))) {
ifm_buff1_3_address0 = (sc_lv<6>) (zext_ln190_3_fu_4279_p1.read());
} else if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0.read(), ap_const_boolean_0))) {
ifm_buff1_3_address0 = (sc_lv<6>) (zext_ln189_fu_1740_p1.read());
} else {
ifm_buff1_3_address0 = (sc_lv<6>) ("XXXXXX");
}
}
void pool_write::thread_ifm_buff1_3_address1() {
ifm_buff1_3_address1 = (sc_lv<6>) (zext_ln189_1_fu_1776_p1.read());
}
void pool_write::thread_ifm_buff1_3_ce0() {
if (((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0_11001.read(), ap_const_boolean_0) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter0.read())) ||
(esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage1.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage1_11001.read(), ap_const_boolean_0) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter1.read())))) {
ifm_buff1_3_ce0 = ap_const_logic_1;
} else {
ifm_buff1_3_ce0 = ap_const_logic_0;
}
}
void pool_write::thread_ifm_buff1_3_ce1() {
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0_11001.read(), ap_const_boolean_0) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter0.read()))) {
ifm_buff1_3_ce1 = ap_const_logic_1;
} else {
ifm_buff1_3_ce1 = ap_const_logic_0;
}
}
void pool_write::thread_ifm_buff1_4_address0() {
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage1.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter1.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage1.read(), ap_const_boolean_0))) {
ifm_buff1_4_address0 = (sc_lv<6>) (zext_ln190_4_fu_4301_p1.read());
} else if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0.read(), ap_const_boolean_0))) {
ifm_buff1_4_address0 = (sc_lv<6>) (zext_ln189_fu_1740_p1.read());
} else {
ifm_buff1_4_address0 = (sc_lv<6>) ("XXXXXX");
}
}
void pool_write::thread_ifm_buff1_4_address1() {
ifm_buff1_4_address1 = (sc_lv<6>) (zext_ln189_1_fu_1776_p1.read());
}
void pool_write::thread_ifm_buff1_4_ce0() {
if (((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0_11001.read(), ap_const_boolean_0) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter0.read())) ||
(esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage1.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage1_11001.read(), ap_const_boolean_0) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter1.read())))) {
ifm_buff1_4_ce0 = ap_const_logic_1;
} else {
ifm_buff1_4_ce0 = ap_const_logic_0;
}
}
void pool_write::thread_ifm_buff1_4_ce1() {
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0_11001.read(), ap_const_boolean_0) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter0.read()))) {
ifm_buff1_4_ce1 = ap_const_logic_1;
} else {
ifm_buff1_4_ce1 = ap_const_logic_0;
}
}
void pool_write::thread_ifm_buff1_5_address0() {
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage1.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter1.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage1.read(), ap_const_boolean_0))) {
ifm_buff1_5_address0 = (sc_lv<6>) (zext_ln190_5_fu_4323_p1.read());
} else if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0.read(), ap_const_boolean_0))) {
ifm_buff1_5_address0 = (sc_lv<6>) (zext_ln189_fu_1740_p1.read());
} else {
ifm_buff1_5_address0 = (sc_lv<6>) ("XXXXXX");
}
}
void pool_write::thread_ifm_buff1_5_address1() {
ifm_buff1_5_address1 = (sc_lv<6>) (zext_ln189_1_fu_1776_p1.read());
}
void pool_write::thread_ifm_buff1_5_ce0() {
if (((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0_11001.read(), ap_const_boolean_0) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter0.read())) ||
(esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage1.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage1_11001.read(), ap_const_boolean_0) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter1.read())))) {
ifm_buff1_5_ce0 = ap_const_logic_1;
} else {
ifm_buff1_5_ce0 = ap_const_logic_0;
}
}
void pool_write::thread_ifm_buff1_5_ce1() {
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0_11001.read(), ap_const_boolean_0) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter0.read()))) {
ifm_buff1_5_ce1 = ap_const_logic_1;
} else {
ifm_buff1_5_ce1 = ap_const_logic_0;
}
}
void pool_write::thread_ifm_buff1_6_address0() {
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage1.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter1.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage1.read(), ap_const_boolean_0))) {
ifm_buff1_6_address0 = (sc_lv<6>) (zext_ln190_6_fu_4345_p1.read());
} else if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0.read(), ap_const_boolean_0))) {
ifm_buff1_6_address0 = (sc_lv<6>) (zext_ln189_fu_1740_p1.read());
} else {
ifm_buff1_6_address0 = (sc_lv<6>) ("XXXXXX");
}
}
void pool_write::thread_ifm_buff1_6_address1() {
ifm_buff1_6_address1 = (sc_lv<6>) (zext_ln189_1_fu_1776_p1.read());
}
void pool_write::thread_ifm_buff1_6_ce0() {
if (((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0_11001.read(), ap_const_boolean_0) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter0.read())) ||
(esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage1.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage1_11001.read(), ap_const_boolean_0) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter1.read())))) {
ifm_buff1_6_ce0 = ap_const_logic_1;
} else {
ifm_buff1_6_ce0 = ap_const_logic_0;
}
}
void pool_write::thread_ifm_buff1_6_ce1() {
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0_11001.read(), ap_const_boolean_0) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter0.read()))) {
ifm_buff1_6_ce1 = ap_const_logic_1;
} else {
ifm_buff1_6_ce1 = ap_const_logic_0;
}
}
void pool_write::thread_ifm_buff1_7_address0() {
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage1.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter1.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage1.read(), ap_const_boolean_0))) {
ifm_buff1_7_address0 = (sc_lv<6>) (zext_ln190_7_fu_4367_p1.read());
} else if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0.read(), ap_const_boolean_0))) {
ifm_buff1_7_address0 = (sc_lv<6>) (zext_ln189_fu_1740_p1.read());
} else {
ifm_buff1_7_address0 = (sc_lv<6>) ("XXXXXX");
}
}
void pool_write::thread_ifm_buff1_7_address1() {
ifm_buff1_7_address1 = (sc_lv<6>) (zext_ln189_1_fu_1776_p1.read());
}
void pool_write::thread_ifm_buff1_7_ce0() {
if (((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0_11001.read(), ap_const_boolean_0) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter0.read())) ||
(esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage1.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage1_11001.read(), ap_const_boolean_0) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter1.read())))) {
ifm_buff1_7_ce0 = ap_const_logic_1;
} else {
ifm_buff1_7_ce0 = ap_const_logic_0;
}
}
void pool_write::thread_ifm_buff1_7_ce1() {
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0_11001.read(), ap_const_boolean_0) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter0.read()))) {
ifm_buff1_7_ce1 = ap_const_logic_1;
} else {
ifm_buff1_7_ce1 = ap_const_logic_0;
}
}
void pool_write::thread_ifm_buff1_8_address0() {
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage1.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter1.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage1.read(), ap_const_boolean_0))) {
ifm_buff1_8_address0 = (sc_lv<6>) (zext_ln190_8_fu_4389_p1.read());
} else if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0.read(), ap_const_boolean_0))) {
ifm_buff1_8_address0 = (sc_lv<6>) (zext_ln189_fu_1740_p1.read());
} else {
ifm_buff1_8_address0 = (sc_lv<6>) ("XXXXXX");
}
}
void pool_write::thread_ifm_buff1_8_address1() {
ifm_buff1_8_address1 = (sc_lv<6>) (zext_ln189_1_fu_1776_p1.read());
}
void pool_write::thread_ifm_buff1_8_ce0() {
if (((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0_11001.read(), ap_const_boolean_0) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter0.read())) ||
(esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage1.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage1_11001.read(), ap_const_boolean_0) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter1.read())))) {
ifm_buff1_8_ce0 = ap_const_logic_1;
} else {
ifm_buff1_8_ce0 = ap_const_logic_0;
}
}
void pool_write::thread_ifm_buff1_8_ce1() {
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0_11001.read(), ap_const_boolean_0) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter0.read()))) {
ifm_buff1_8_ce1 = ap_const_logic_1;
} else {
ifm_buff1_8_ce1 = ap_const_logic_0;
}
}
void pool_write::thread_ifm_buff1_9_address0() {
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage1.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter1.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage1.read(), ap_const_boolean_0))) {
ifm_buff1_9_address0 = (sc_lv<6>) (zext_ln190_9_fu_4411_p1.read());
} else if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0.read(), ap_const_boolean_0))) {
ifm_buff1_9_address0 = (sc_lv<6>) (zext_ln189_fu_1740_p1.read());
} else {
ifm_buff1_9_address0 = (sc_lv<6>) ("XXXXXX");
}
}
void pool_write::thread_ifm_buff1_9_address1() {
ifm_buff1_9_address1 = (sc_lv<6>) (zext_ln189_1_fu_1776_p1.read());
}
void pool_write::thread_ifm_buff1_9_ce0() {
if (((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0_11001.read(), ap_const_boolean_0) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter0.read())) ||
(esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage1.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage1_11001.read(), ap_const_boolean_0) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter1.read())))) {
ifm_buff1_9_ce0 = ap_const_logic_1;
} else {
ifm_buff1_9_ce0 = ap_const_logic_0;
}
}
void pool_write::thread_ifm_buff1_9_ce1() {
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0_11001.read(), ap_const_boolean_0) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter0.read()))) {
ifm_buff1_9_ce1 = ap_const_logic_1;
} else {
ifm_buff1_9_ce1 = ap_const_logic_0;
}
}
void pool_write::thread_ofm_buff0_0_address0() {
ofm_buff0_0_address0 = (sc_lv<6>) (zext_ln189_reg_6205_pp0_iter2_reg.read());
}
void pool_write::thread_ofm_buff0_0_ce0() {
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0_11001.read(), ap_const_boolean_0) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter3.read()))) {
ofm_buff0_0_ce0 = ap_const_logic_1;
} else {
ofm_buff0_0_ce0 = ap_const_logic_0;
}
}
void pool_write::thread_ofm_buff0_0_d0() {
ofm_buff0_0_d0 = select_ln191_reg_7681.read();
}
void pool_write::thread_ofm_buff0_0_we0() {
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0_11001.read(), ap_const_boolean_0) &&
esl_seteq<1,1,1>(ap_const_lv1_0, icmp_ln179_reg_6164_pp0_iter2_reg.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter3.read()))) {
ofm_buff0_0_we0 = ap_const_logic_1;
} else {
ofm_buff0_0_we0 = ap_const_logic_0;
}
}
void pool_write::thread_ofm_buff0_10_address0() {
ofm_buff0_10_address0 = (sc_lv<6>) (zext_ln189_reg_6205_pp0_iter2_reg.read());
}
void pool_write::thread_ofm_buff0_10_ce0() {
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0_11001.read(), ap_const_boolean_0) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter3.read()))) {
ofm_buff0_10_ce0 = ap_const_logic_1;
} else {
ofm_buff0_10_ce0 = ap_const_logic_0;
}
}
void pool_write::thread_ofm_buff0_10_d0() {
ofm_buff0_10_d0 = select_ln191_10_reg_7731.read();
}
void pool_write::thread_ofm_buff0_10_we0() {
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0_11001.read(), ap_const_boolean_0) &&
esl_seteq<1,1,1>(ap_const_lv1_0, icmp_ln179_reg_6164_pp0_iter2_reg.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter3.read()))) {
ofm_buff0_10_we0 = ap_const_logic_1;
} else {
ofm_buff0_10_we0 = ap_const_logic_0;
}
}
void pool_write::thread_ofm_buff0_11_address0() {
ofm_buff0_11_address0 = (sc_lv<6>) (zext_ln189_reg_6205_pp0_iter2_reg.read());
}
void pool_write::thread_ofm_buff0_11_ce0() {
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0_11001.read(), ap_const_boolean_0) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter3.read()))) {
ofm_buff0_11_ce0 = ap_const_logic_1;
} else {
ofm_buff0_11_ce0 = ap_const_logic_0;
}
}
void pool_write::thread_ofm_buff0_11_d0() {
ofm_buff0_11_d0 = select_ln191_11_reg_7736.read();
}
void pool_write::thread_ofm_buff0_11_we0() {
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0_11001.read(), ap_const_boolean_0) &&
esl_seteq<1,1,1>(ap_const_lv1_0, icmp_ln179_reg_6164_pp0_iter2_reg.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter3.read()))) {
ofm_buff0_11_we0 = ap_const_logic_1;
} else {
ofm_buff0_11_we0 = ap_const_logic_0;
}
}
void pool_write::thread_ofm_buff0_12_address0() {
ofm_buff0_12_address0 = (sc_lv<6>) (zext_ln189_reg_6205_pp0_iter3_reg.read());
}
void pool_write::thread_ofm_buff0_12_ce0() {
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0_11001.read(), ap_const_boolean_0) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter4.read()))) {
ofm_buff0_12_ce0 = ap_const_logic_1;
} else {
ofm_buff0_12_ce0 = ap_const_logic_0;
}
}
void pool_write::thread_ofm_buff0_12_d0() {
ofm_buff0_12_d0 = select_ln191_12_reg_7837.read();
}
void pool_write::thread_ofm_buff0_12_we0() {
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0_11001.read(), ap_const_boolean_0) &&
esl_seteq<1,1,1>(ap_const_lv1_0, icmp_ln179_reg_6164_pp0_iter3_reg.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter4.read()))) {
ofm_buff0_12_we0 = ap_const_logic_1;
} else {
ofm_buff0_12_we0 = ap_const_logic_0;
}
}
void pool_write::thread_ofm_buff0_13_address0() {
ofm_buff0_13_address0 = (sc_lv<6>) (zext_ln189_reg_6205_pp0_iter3_reg.read());
}
void pool_write::thread_ofm_buff0_13_ce0() {
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0_11001.read(), ap_const_boolean_0) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter4.read()))) {
ofm_buff0_13_ce0 = ap_const_logic_1;
} else {
ofm_buff0_13_ce0 = ap_const_logic_0;
}
}
void pool_write::thread_ofm_buff0_13_d0() {
ofm_buff0_13_d0 = select_ln191_13_reg_7842.read();
}
void pool_write::thread_ofm_buff0_13_we0() {
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0_11001.read(), ap_const_boolean_0) &&
esl_seteq<1,1,1>(ap_const_lv1_0, icmp_ln179_reg_6164_pp0_iter3_reg.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter4.read()))) {
ofm_buff0_13_we0 = ap_const_logic_1;
} else {
ofm_buff0_13_we0 = ap_const_logic_0;
}
}
void pool_write::thread_ofm_buff0_14_address0() {
ofm_buff0_14_address0 = (sc_lv<6>) (zext_ln189_reg_6205_pp0_iter3_reg.read());
}
void pool_write::thread_ofm_buff0_14_ce0() {
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0_11001.read(), ap_const_boolean_0) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter4.read()))) {
ofm_buff0_14_ce0 = ap_const_logic_1;
} else {
ofm_buff0_14_ce0 = ap_const_logic_0;
}
}
void pool_write::thread_ofm_buff0_14_d0() {
ofm_buff0_14_d0 = select_ln191_14_reg_7847.read();
}
void pool_write::thread_ofm_buff0_14_we0() {
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0_11001.read(), ap_const_boolean_0) &&
esl_seteq<1,1,1>(ap_const_lv1_0, icmp_ln179_reg_6164_pp0_iter3_reg.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter4.read()))) {
ofm_buff0_14_we0 = ap_const_logic_1;
} else {
ofm_buff0_14_we0 = ap_const_logic_0;
}
}
void pool_write::thread_ofm_buff0_15_address0() {
ofm_buff0_15_address0 = (sc_lv<6>) (zext_ln189_reg_6205_pp0_iter3_reg.read());
}
void pool_write::thread_ofm_buff0_15_ce0() {
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0_11001.read(), ap_const_boolean_0) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter4.read()))) {
ofm_buff0_15_ce0 = ap_const_logic_1;
} else {
ofm_buff0_15_ce0 = ap_const_logic_0;
}
}
void pool_write::thread_ofm_buff0_15_d0() {
ofm_buff0_15_d0 = select_ln191_15_reg_7852.read();
}
void pool_write::thread_ofm_buff0_15_we0() {
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0_11001.read(), ap_const_boolean_0) &&
esl_seteq<1,1,1>(ap_const_lv1_0, icmp_ln179_reg_6164_pp0_iter3_reg.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter4.read()))) {
ofm_buff0_15_we0 = ap_const_logic_1;
} else {
ofm_buff0_15_we0 = ap_const_logic_0;
}
}
void pool_write::thread_ofm_buff0_1_address0() {
ofm_buff0_1_address0 = (sc_lv<6>) (zext_ln189_reg_6205_pp0_iter2_reg.read());
}
void pool_write::thread_ofm_buff0_1_ce0() {
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0_11001.read(), ap_const_boolean_0) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter3.read()))) {
ofm_buff0_1_ce0 = ap_const_logic_1;
} else {
ofm_buff0_1_ce0 = ap_const_logic_0;
}
}
void pool_write::thread_ofm_buff0_1_d0() {
ofm_buff0_1_d0 = select_ln191_1_reg_7686.read();
}
void pool_write::thread_ofm_buff0_1_we0() {
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0_11001.read(), ap_const_boolean_0) &&
esl_seteq<1,1,1>(ap_const_lv1_0, icmp_ln179_reg_6164_pp0_iter2_reg.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter3.read()))) {
ofm_buff0_1_we0 = ap_const_logic_1;
} else {
ofm_buff0_1_we0 = ap_const_logic_0;
}
}
void pool_write::thread_ofm_buff0_2_address0() {
ofm_buff0_2_address0 = (sc_lv<6>) (zext_ln189_reg_6205_pp0_iter2_reg.read());
}
void pool_write::thread_ofm_buff0_2_ce0() {
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0_11001.read(), ap_const_boolean_0) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter3.read()))) {
ofm_buff0_2_ce0 = ap_const_logic_1;
} else {
ofm_buff0_2_ce0 = ap_const_logic_0;
}
}
void pool_write::thread_ofm_buff0_2_d0() {
ofm_buff0_2_d0 = select_ln191_2_reg_7691.read();
}
void pool_write::thread_ofm_buff0_2_we0() {
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0_11001.read(), ap_const_boolean_0) &&
esl_seteq<1,1,1>(ap_const_lv1_0, icmp_ln179_reg_6164_pp0_iter2_reg.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter3.read()))) {
ofm_buff0_2_we0 = ap_const_logic_1;
} else {
ofm_buff0_2_we0 = ap_const_logic_0;
}
}
void pool_write::thread_ofm_buff0_3_address0() {
ofm_buff0_3_address0 = (sc_lv<6>) (zext_ln189_reg_6205_pp0_iter2_reg.read());
}
void pool_write::thread_ofm_buff0_3_ce0() {
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0_11001.read(), ap_const_boolean_0) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter3.read()))) {
ofm_buff0_3_ce0 = ap_const_logic_1;
} else {
ofm_buff0_3_ce0 = ap_const_logic_0;
}
}
void pool_write::thread_ofm_buff0_3_d0() {
ofm_buff0_3_d0 = select_ln191_3_reg_7696.read();
}
void pool_write::thread_ofm_buff0_3_we0() {
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0_11001.read(), ap_const_boolean_0) &&
esl_seteq<1,1,1>(ap_const_lv1_0, icmp_ln179_reg_6164_pp0_iter2_reg.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter3.read()))) {
ofm_buff0_3_we0 = ap_const_logic_1;
} else {
ofm_buff0_3_we0 = ap_const_logic_0;
}
}
void pool_write::thread_ofm_buff0_4_address0() {
ofm_buff0_4_address0 = (sc_lv<6>) (zext_ln189_reg_6205_pp0_iter2_reg.read());
}
void pool_write::thread_ofm_buff0_4_ce0() {
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0_11001.read(), ap_const_boolean_0) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter3.read()))) {
ofm_buff0_4_ce0 = ap_const_logic_1;
} else {
ofm_buff0_4_ce0 = ap_const_logic_0;
}
}
void pool_write::thread_ofm_buff0_4_d0() {
ofm_buff0_4_d0 = select_ln191_4_reg_7701.read();
}
void pool_write::thread_ofm_buff0_4_we0() {
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0_11001.read(), ap_const_boolean_0) &&
esl_seteq<1,1,1>(ap_const_lv1_0, icmp_ln179_reg_6164_pp0_iter2_reg.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter3.read()))) {
ofm_buff0_4_we0 = ap_const_logic_1;
} else {
ofm_buff0_4_we0 = ap_const_logic_0;
}
}
void pool_write::thread_ofm_buff0_5_address0() {
ofm_buff0_5_address0 = (sc_lv<6>) (zext_ln189_reg_6205_pp0_iter2_reg.read());
}
void pool_write::thread_ofm_buff0_5_ce0() {
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0_11001.read(), ap_const_boolean_0) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter3.read()))) {
ofm_buff0_5_ce0 = ap_const_logic_1;
} else {
ofm_buff0_5_ce0 = ap_const_logic_0;
}
}
void pool_write::thread_ofm_buff0_5_d0() {
ofm_buff0_5_d0 = select_ln191_5_reg_7706.read();
}
void pool_write::thread_ofm_buff0_5_we0() {
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0_11001.read(), ap_const_boolean_0) &&
esl_seteq<1,1,1>(ap_const_lv1_0, icmp_ln179_reg_6164_pp0_iter2_reg.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter3.read()))) {
ofm_buff0_5_we0 = ap_const_logic_1;
} else {
ofm_buff0_5_we0 = ap_const_logic_0;
}
}
void pool_write::thread_ofm_buff0_6_address0() {
ofm_buff0_6_address0 = (sc_lv<6>) (zext_ln189_reg_6205_pp0_iter2_reg.read());
}
void pool_write::thread_ofm_buff0_6_ce0() {
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0_11001.read(), ap_const_boolean_0) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter3.read()))) {
ofm_buff0_6_ce0 = ap_const_logic_1;
} else {
ofm_buff0_6_ce0 = ap_const_logic_0;
}
}
void pool_write::thread_ofm_buff0_6_d0() {
ofm_buff0_6_d0 = select_ln191_6_reg_7711.read();
}
void pool_write::thread_ofm_buff0_6_we0() {
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0_11001.read(), ap_const_boolean_0) &&
esl_seteq<1,1,1>(ap_const_lv1_0, icmp_ln179_reg_6164_pp0_iter2_reg.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter3.read()))) {
ofm_buff0_6_we0 = ap_const_logic_1;
} else {
ofm_buff0_6_we0 = ap_const_logic_0;
}
}
void pool_write::thread_ofm_buff0_7_address0() {
ofm_buff0_7_address0 = (sc_lv<6>) (zext_ln189_reg_6205_pp0_iter2_reg.read());
}
void pool_write::thread_ofm_buff0_7_ce0() {
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0_11001.read(), ap_const_boolean_0) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter3.read()))) {
ofm_buff0_7_ce0 = ap_const_logic_1;
} else {
ofm_buff0_7_ce0 = ap_const_logic_0;
}
}
void pool_write::thread_ofm_buff0_7_d0() {
ofm_buff0_7_d0 = select_ln191_7_reg_7716.read();
}
void pool_write::thread_ofm_buff0_7_we0() {
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0_11001.read(), ap_const_boolean_0) &&
esl_seteq<1,1,1>(ap_const_lv1_0, icmp_ln179_reg_6164_pp0_iter2_reg.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter3.read()))) {
ofm_buff0_7_we0 = ap_const_logic_1;
} else {
ofm_buff0_7_we0 = ap_const_logic_0;
}
}
void pool_write::thread_ofm_buff0_8_address0() {
ofm_buff0_8_address0 = (sc_lv<6>) (zext_ln189_reg_6205_pp0_iter2_reg.read());
}
void pool_write::thread_ofm_buff0_8_ce0() {
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0_11001.read(), ap_const_boolean_0) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter3.read()))) {
ofm_buff0_8_ce0 = ap_const_logic_1;
} else {
ofm_buff0_8_ce0 = ap_const_logic_0;
}
}
void pool_write::thread_ofm_buff0_8_d0() {
ofm_buff0_8_d0 = select_ln191_8_reg_7721.read();
}
void pool_write::thread_ofm_buff0_8_we0() {
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0_11001.read(), ap_const_boolean_0) &&
esl_seteq<1,1,1>(ap_const_lv1_0, icmp_ln179_reg_6164_pp0_iter2_reg.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter3.read()))) {
ofm_buff0_8_we0 = ap_const_logic_1;
} else {
ofm_buff0_8_we0 = ap_const_logic_0;
}
}
void pool_write::thread_ofm_buff0_9_address0() {
ofm_buff0_9_address0 = (sc_lv<6>) (zext_ln189_reg_6205_pp0_iter2_reg.read());
}
void pool_write::thread_ofm_buff0_9_ce0() {
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0_11001.read(), ap_const_boolean_0) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter3.read()))) {
ofm_buff0_9_ce0 = ap_const_logic_1;
} else {
ofm_buff0_9_ce0 = ap_const_logic_0;
}
}
void pool_write::thread_ofm_buff0_9_d0() {
ofm_buff0_9_d0 = select_ln191_9_reg_7726.read();
}
void pool_write::thread_ofm_buff0_9_we0() {
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_pp0_stage0.read()) &&
esl_seteq<1,1,1>(ap_block_pp0_stage0_11001.read(), ap_const_boolean_0) &&
esl_seteq<1,1,1>(ap_const_lv1_0, icmp_ln179_reg_6164_pp0_iter2_reg.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_enable_reg_pp0_iter3.read()))) {
ofm_buff0_9_we0 = ap_const_logic_1;
} else {
ofm_buff0_9_we0 = ap_const_logic_0;
}
}
void pool_write::thread_or_ln189_10_fu_3452_p2() {
or_ln189_10_fu_3452_p2 = (icmp_ln189_21_reg_6805.read() | icmp_ln189_20_reg_6800.read());
}
void pool_write::thread_or_ln189_11_fu_3456_p2() {
or_ln189_11_fu_3456_p2 = (icmp_ln189_23_reg_6815.read() | icmp_ln189_22_reg_6810.read());
}
void pool_write::thread_or_ln189_12_fu_3492_p2() {
or_ln189_12_fu_3492_p2 = (icmp_ln189_25_reg_6855.read() | icmp_ln189_24_reg_6850.read());
}
void pool_write::thread_or_ln189_13_fu_3496_p2() {
or_ln189_13_fu_3496_p2 = (icmp_ln189_27_reg_6865.read() | icmp_ln189_26_reg_6860.read());
}
void pool_write::thread_or_ln189_14_fu_3532_p2() {
or_ln189_14_fu_3532_p2 = (icmp_ln189_29_reg_6905.read() | icmp_ln189_28_reg_6900.read());
}
void pool_write::thread_or_ln189_15_fu_3536_p2() {
or_ln189_15_fu_3536_p2 = (icmp_ln189_31_reg_6915.read() | icmp_ln189_30_reg_6910.read());
}
void pool_write::thread_or_ln189_16_fu_3572_p2() {
or_ln189_16_fu_3572_p2 = (icmp_ln189_33_reg_6955.read() | icmp_ln189_32_reg_6950.read());
}
void pool_write::thread_or_ln189_17_fu_3576_p2() {
or_ln189_17_fu_3576_p2 = (icmp_ln189_35_reg_6965.read() | icmp_ln189_34_reg_6960.read());
}
void pool_write::thread_or_ln189_18_fu_3612_p2() {
or_ln189_18_fu_3612_p2 = (icmp_ln189_37_reg_7005.read() | icmp_ln189_36_reg_7000.read());
}
void pool_write::thread_or_ln189_19_fu_3616_p2() {
or_ln189_19_fu_3616_p2 = (icmp_ln189_39_reg_7015.read() | icmp_ln189_38_reg_7010.read());
}
void pool_write::thread_or_ln189_1_fu_3256_p2() {
or_ln189_1_fu_3256_p2 = (icmp_ln189_3_reg_6565.read() | icmp_ln189_2_reg_6560.read());
}
void pool_write::thread_or_ln189_20_fu_3652_p2() {
or_ln189_20_fu_3652_p2 = (icmp_ln189_41_reg_7055.read() | icmp_ln189_40_reg_7050.read());
}
void pool_write::thread_or_ln189_21_fu_3656_p2() {
or_ln189_21_fu_3656_p2 = (icmp_ln189_43_reg_7065.read() | icmp_ln189_42_reg_7060.read());
}
void pool_write::thread_or_ln189_22_fu_3692_p2() {
or_ln189_22_fu_3692_p2 = (icmp_ln189_45_reg_7105.read() | icmp_ln189_44_reg_7100.read());
}
void pool_write::thread_or_ln189_23_fu_3696_p2() {
or_ln189_23_fu_3696_p2 = (icmp_ln189_47_reg_7115.read() | icmp_ln189_46_reg_7110.read());
}
void pool_write::thread_or_ln189_24_fu_4460_p2() {
or_ln189_24_fu_4460_p2 = (icmp_ln189_49_reg_7366.read() | icmp_ln189_48_reg_7361.read());
}
void pool_write::thread_or_ln189_25_fu_4464_p2() {
or_ln189_25_fu_4464_p2 = (icmp_ln189_51_reg_7376.read() | icmp_ln189_50_reg_7371.read());
}
void pool_write::thread_or_ln189_26_fu_4500_p2() {
or_ln189_26_fu_4500_p2 = (icmp_ln189_53_reg_7406.read() | icmp_ln189_52_reg_7401.read());
}
void pool_write::thread_or_ln189_27_fu_4504_p2() {
or_ln189_27_fu_4504_p2 = (icmp_ln189_55_reg_7416.read() | icmp_ln189_54_reg_7411.read());
}
void pool_write::thread_or_ln189_28_fu_4540_p2() {
or_ln189_28_fu_4540_p2 = (icmp_ln189_57_reg_7446.read() | icmp_ln189_56_reg_7441.read());
}
void pool_write::thread_or_ln189_29_fu_4544_p2() {
or_ln189_29_fu_4544_p2 = (icmp_ln189_59_reg_7456.read() | icmp_ln189_58_reg_7451.read());
}
void pool_write::thread_or_ln189_2_fu_3292_p2() {
or_ln189_2_fu_3292_p2 = (icmp_ln189_5_reg_6605.read() | icmp_ln189_4_reg_6600.read());
}
void pool_write::thread_or_ln189_30_fu_4580_p2() {
or_ln189_30_fu_4580_p2 = (icmp_ln189_61_reg_7486.read() | icmp_ln189_60_reg_7481.read());
}
void pool_write::thread_or_ln189_31_fu_4584_p2() {
or_ln189_31_fu_4584_p2 = (icmp_ln189_63_reg_7496.read() | icmp_ln189_62_reg_7491.read());
}
void pool_write::thread_or_ln189_3_fu_3296_p2() {
or_ln189_3_fu_3296_p2 = (icmp_ln189_7_reg_6615.read() | icmp_ln189_6_reg_6610.read());
}
void pool_write::thread_or_ln189_4_fu_3332_p2() {
or_ln189_4_fu_3332_p2 = (icmp_ln189_9_reg_6655.read() | icmp_ln189_8_reg_6650.read());
}
void pool_write::thread_or_ln189_5_fu_3336_p2() {
or_ln189_5_fu_3336_p2 = (icmp_ln189_11_reg_6665.read() | icmp_ln189_10_reg_6660.read());
}
void pool_write::thread_or_ln189_6_fu_3372_p2() {
or_ln189_6_fu_3372_p2 = (icmp_ln189_13_reg_6705.read() | icmp_ln189_12_reg_6700.read());
}
void pool_write::thread_or_ln189_7_fu_3376_p2() {
or_ln189_7_fu_3376_p2 = (icmp_ln189_15_reg_6715.read() | icmp_ln189_14_reg_6710.read());
}
void pool_write::thread_or_ln189_8_fu_3412_p2() {
or_ln189_8_fu_3412_p2 = (icmp_ln189_17_reg_6755.read() | icmp_ln189_16_reg_6750.read());
}
void pool_write::thread_or_ln189_9_fu_3416_p2() {
or_ln189_9_fu_3416_p2 = (icmp_ln189_19_reg_6765.read() | icmp_ln189_18_reg_6760.read());
}
void pool_write::thread_or_ln189_fu_3252_p2() {
or_ln189_fu_3252_p2 = (icmp_ln189_1_reg_6555.read() | icmp_ln189_reg_6550.read());
}
void pool_write::thread_or_ln190_10_fu_3472_p2() {
or_ln190_10_fu_3472_p2 = (icmp_ln190_21_reg_6830.read() | icmp_ln190_20_reg_6825.read());
}
void pool_write::thread_or_ln190_11_fu_3476_p2() {
or_ln190_11_fu_3476_p2 = (icmp_ln190_23_reg_6840.read() | icmp_ln190_22_reg_6835.read());
}
void pool_write::thread_or_ln190_12_fu_3512_p2() {
or_ln190_12_fu_3512_p2 = (icmp_ln190_25_reg_6880.read() | icmp_ln190_24_reg_6875.read());
}
void pool_write::thread_or_ln190_13_fu_3516_p2() {
or_ln190_13_fu_3516_p2 = (icmp_ln190_27_reg_6890.read() | icmp_ln190_26_reg_6885.read());
}
void pool_write::thread_or_ln190_14_fu_3552_p2() {
or_ln190_14_fu_3552_p2 = (icmp_ln190_29_reg_6930.read() | icmp_ln190_28_reg_6925.read());
}
void pool_write::thread_or_ln190_15_fu_3556_p2() {
or_ln190_15_fu_3556_p2 = (icmp_ln190_31_reg_6940.read() | icmp_ln190_30_reg_6935.read());
}
void pool_write::thread_or_ln190_16_fu_3592_p2() {
or_ln190_16_fu_3592_p2 = (icmp_ln190_33_reg_6980.read() | icmp_ln190_32_reg_6975.read());
}
void pool_write::thread_or_ln190_17_fu_3596_p2() {
or_ln190_17_fu_3596_p2 = (icmp_ln190_35_reg_6990.read() | icmp_ln190_34_reg_6985.read());
}
void pool_write::thread_or_ln190_18_fu_3632_p2() {
or_ln190_18_fu_3632_p2 = (icmp_ln190_37_reg_7030.read() | icmp_ln190_36_reg_7025.read());
}
void pool_write::thread_or_ln190_19_fu_3636_p2() {
or_ln190_19_fu_3636_p2 = (icmp_ln190_39_reg_7040.read() | icmp_ln190_38_reg_7035.read());
}
void pool_write::thread_or_ln190_1_fu_3276_p2() {
or_ln190_1_fu_3276_p2 = (icmp_ln190_3_reg_6590.read() | icmp_ln190_2_reg_6585.read());
}
void pool_write::thread_or_ln190_20_fu_3672_p2() {
or_ln190_20_fu_3672_p2 = (icmp_ln190_41_reg_7080.read() | icmp_ln190_40_reg_7075.read());
}
void pool_write::thread_or_ln190_21_fu_3676_p2() {
or_ln190_21_fu_3676_p2 = (icmp_ln190_43_reg_7090.read() | icmp_ln190_42_reg_7085.read());
}
void pool_write::thread_or_ln190_22_fu_3712_p2() {
or_ln190_22_fu_3712_p2 = (icmp_ln190_45_reg_7130.read() | icmp_ln190_44_reg_7125.read());
}
void pool_write::thread_or_ln190_23_fu_3716_p2() {
or_ln190_23_fu_3716_p2 = (icmp_ln190_47_reg_7140.read() | icmp_ln190_46_reg_7135.read());
}
void pool_write::thread_or_ln190_24_fu_4480_p2() {
or_ln190_24_fu_4480_p2 = (icmp_ln190_49_reg_7386.read() | icmp_ln190_48_reg_7381.read());
}
void pool_write::thread_or_ln190_25_fu_4484_p2() {
or_ln190_25_fu_4484_p2 = (icmp_ln190_51_reg_7396.read() | icmp_ln190_50_reg_7391.read());
}
void pool_write::thread_or_ln190_26_fu_4520_p2() {
or_ln190_26_fu_4520_p2 = (icmp_ln190_53_reg_7426.read() | icmp_ln190_52_reg_7421.read());
}
void pool_write::thread_or_ln190_27_fu_4524_p2() {
or_ln190_27_fu_4524_p2 = (icmp_ln190_55_reg_7436.read() | icmp_ln190_54_reg_7431.read());
}
void pool_write::thread_or_ln190_28_fu_4560_p2() {
or_ln190_28_fu_4560_p2 = (icmp_ln190_57_reg_7466.read() | icmp_ln190_56_reg_7461.read());
}
void pool_write::thread_or_ln190_29_fu_4564_p2() {
or_ln190_29_fu_4564_p2 = (icmp_ln190_59_reg_7476.read() | icmp_ln190_58_reg_7471.read());
}
void pool_write::thread_or_ln190_2_fu_3312_p2() {
or_ln190_2_fu_3312_p2 = (icmp_ln190_5_reg_6630.read() | icmp_ln190_4_reg_6625.read());
}
void pool_write::thread_or_ln190_30_fu_4600_p2() {
or_ln190_30_fu_4600_p2 = (icmp_ln190_61_reg_7506.read() | icmp_ln190_60_reg_7501.read());
}
void pool_write::thread_or_ln190_31_fu_4604_p2() {
or_ln190_31_fu_4604_p2 = (icmp_ln190_63_reg_7516.read() | icmp_ln190_62_reg_7511.read());
}
void pool_write::thread_or_ln190_3_fu_3316_p2() {
or_ln190_3_fu_3316_p2 = (icmp_ln190_7_reg_6640.read() | icmp_ln190_6_reg_6635.read());
}
void pool_write::thread_or_ln190_4_fu_3352_p2() {
or_ln190_4_fu_3352_p2 = (icmp_ln190_9_reg_6680.read() | icmp_ln190_8_reg_6675.read());
}
void pool_write::thread_or_ln190_5_fu_3356_p2() {
or_ln190_5_fu_3356_p2 = (icmp_ln190_11_reg_6690.read() | icmp_ln190_10_reg_6685.read());
}
void pool_write::thread_or_ln190_6_fu_3392_p2() {
or_ln190_6_fu_3392_p2 = (icmp_ln190_13_reg_6730.read() | icmp_ln190_12_reg_6725.read());
}
void pool_write::thread_or_ln190_7_fu_3396_p2() {
or_ln190_7_fu_3396_p2 = (icmp_ln190_15_reg_6740.read() | icmp_ln190_14_reg_6735.read());
}
void pool_write::thread_or_ln190_8_fu_3432_p2() {
or_ln190_8_fu_3432_p2 = (icmp_ln190_17_reg_6780.read() | icmp_ln190_16_reg_6775.read());
}
void pool_write::thread_or_ln190_9_fu_3436_p2() {
or_ln190_9_fu_3436_p2 = (icmp_ln190_19_reg_6790.read() | icmp_ln190_18_reg_6785.read());
}
void pool_write::thread_or_ln190_fu_3272_p2() {
or_ln190_fu_3272_p2 = (icmp_ln190_1_reg_6580.read() | icmp_ln190_reg_6575.read());
}
void pool_write::thread_or_ln191_10_fu_5128_p2() {
or_ln191_10_fu_5128_p2 = (icmp_ln191_21_fu_5122_p2.read() | icmp_ln191_20_fu_5116_p2.read());
}
void pool_write::thread_or_ln191_11_fu_5146_p2() {
or_ln191_11_fu_5146_p2 = (icmp_ln191_23_fu_5140_p2.read() | icmp_ln191_22_fu_5134_p2.read());
}
void pool_write::thread_or_ln191_12_fu_5220_p2() {
or_ln191_12_fu_5220_p2 = (icmp_ln191_25_fu_5214_p2.read() | icmp_ln191_24_fu_5208_p2.read());
}
void pool_write::thread_or_ln191_13_fu_5238_p2() {
or_ln191_13_fu_5238_p2 = (icmp_ln191_27_fu_5232_p2.read() | icmp_ln191_26_fu_5226_p2.read());
}
void pool_write::thread_or_ln191_14_fu_5312_p2() {
or_ln191_14_fu_5312_p2 = (icmp_ln191_29_fu_5306_p2.read() | icmp_ln191_28_fu_5300_p2.read());
}
void pool_write::thread_or_ln191_15_fu_5330_p2() {
or_ln191_15_fu_5330_p2 = (icmp_ln191_31_fu_5324_p2.read() | icmp_ln191_30_fu_5318_p2.read());
}
void pool_write::thread_or_ln191_16_fu_5404_p2() {
or_ln191_16_fu_5404_p2 = (icmp_ln191_33_fu_5398_p2.read() | icmp_ln191_32_fu_5392_p2.read());
}
void pool_write::thread_or_ln191_17_fu_5422_p2() {
or_ln191_17_fu_5422_p2 = (icmp_ln191_35_fu_5416_p2.read() | icmp_ln191_34_fu_5410_p2.read());
}
void pool_write::thread_or_ln191_18_fu_5496_p2() {
or_ln191_18_fu_5496_p2 = (icmp_ln191_37_fu_5490_p2.read() | icmp_ln191_36_fu_5484_p2.read());
}
void pool_write::thread_or_ln191_19_fu_5514_p2() {
or_ln191_19_fu_5514_p2 = (icmp_ln191_39_fu_5508_p2.read() | icmp_ln191_38_fu_5502_p2.read());
}
void pool_write::thread_or_ln191_1_fu_4686_p2() {
or_ln191_1_fu_4686_p2 = (icmp_ln191_3_fu_4680_p2.read() | icmp_ln191_2_fu_4674_p2.read());
}
void pool_write::thread_or_ln191_20_fu_5588_p2() {
or_ln191_20_fu_5588_p2 = (icmp_ln191_41_fu_5582_p2.read() | icmp_ln191_40_fu_5576_p2.read());
}
void pool_write::thread_or_ln191_21_fu_5606_p2() {
or_ln191_21_fu_5606_p2 = (icmp_ln191_43_fu_5600_p2.read() | icmp_ln191_42_fu_5594_p2.read());
}
void pool_write::thread_or_ln191_22_fu_5680_p2() {
or_ln191_22_fu_5680_p2 = (icmp_ln191_45_fu_5674_p2.read() | icmp_ln191_44_fu_5668_p2.read());
}
void pool_write::thread_or_ln191_23_fu_5698_p2() {
or_ln191_23_fu_5698_p2 = (icmp_ln191_47_fu_5692_p2.read() | icmp_ln191_46_fu_5686_p2.read());
}
void pool_write::thread_or_ln191_24_fu_5858_p2() {
or_ln191_24_fu_5858_p2 = (icmp_ln191_49_fu_5852_p2.read() | icmp_ln191_48_fu_5846_p2.read());
}
void pool_write::thread_or_ln191_25_fu_5876_p2() {
or_ln191_25_fu_5876_p2 = (icmp_ln191_51_fu_5870_p2.read() | icmp_ln191_50_fu_5864_p2.read());
}
void pool_write::thread_or_ln191_26_fu_5946_p2() {
or_ln191_26_fu_5946_p2 = (icmp_ln191_53_fu_5940_p2.read() | icmp_ln191_52_fu_5934_p2.read());
}
void pool_write::thread_or_ln191_27_fu_5964_p2() {
or_ln191_27_fu_5964_p2 = (icmp_ln191_55_fu_5958_p2.read() | icmp_ln191_54_fu_5952_p2.read());
}
void pool_write::thread_or_ln191_28_fu_6034_p2() {
or_ln191_28_fu_6034_p2 = (icmp_ln191_57_fu_6028_p2.read() | icmp_ln191_56_fu_6022_p2.read());
}
void pool_write::thread_or_ln191_29_fu_6052_p2() {
or_ln191_29_fu_6052_p2 = (icmp_ln191_59_fu_6046_p2.read() | icmp_ln191_58_fu_6040_p2.read());
}
void pool_write::thread_or_ln191_2_fu_4760_p2() {
or_ln191_2_fu_4760_p2 = (icmp_ln191_5_fu_4754_p2.read() | icmp_ln191_4_fu_4748_p2.read());
}
void pool_write::thread_or_ln191_30_fu_6122_p2() {
or_ln191_30_fu_6122_p2 = (icmp_ln191_61_fu_6116_p2.read() | icmp_ln191_60_fu_6110_p2.read());
}
void pool_write::thread_or_ln191_31_fu_6140_p2() {
or_ln191_31_fu_6140_p2 = (icmp_ln191_63_fu_6134_p2.read() | icmp_ln191_62_fu_6128_p2.read());
}
void pool_write::thread_or_ln191_3_fu_4778_p2() {
or_ln191_3_fu_4778_p2 = (icmp_ln191_7_fu_4772_p2.read() | icmp_ln191_6_fu_4766_p2.read());
}
void pool_write::thread_or_ln191_4_fu_4852_p2() {
or_ln191_4_fu_4852_p2 = (icmp_ln191_9_fu_4846_p2.read() | icmp_ln191_8_fu_4840_p2.read());
}
void pool_write::thread_or_ln191_5_fu_4870_p2() {
or_ln191_5_fu_4870_p2 = (icmp_ln191_11_fu_4864_p2.read() | icmp_ln191_10_fu_4858_p2.read());
}
void pool_write::thread_or_ln191_6_fu_4944_p2() {
or_ln191_6_fu_4944_p2 = (icmp_ln191_13_fu_4938_p2.read() | icmp_ln191_12_fu_4932_p2.read());
}
void pool_write::thread_or_ln191_7_fu_4962_p2() {
or_ln191_7_fu_4962_p2 = (icmp_ln191_15_fu_4956_p2.read() | icmp_ln191_14_fu_4950_p2.read());
}
void pool_write::thread_or_ln191_8_fu_5036_p2() {
or_ln191_8_fu_5036_p2 = (icmp_ln191_17_fu_5030_p2.read() | icmp_ln191_16_fu_5024_p2.read());
}
void pool_write::thread_or_ln191_9_fu_5054_p2() {
or_ln191_9_fu_5054_p2 = (icmp_ln191_19_fu_5048_p2.read() | icmp_ln191_18_fu_5042_p2.read());
}
void pool_write::thread_or_ln191_fu_4668_p2() {
or_ln191_fu_4668_p2 = (icmp_ln191_1_fu_4662_p2.read() | icmp_ln191_fu_4656_p2.read());
}
void pool_write::thread_select_ln189_10_fu_4416_p3() {
select_ln189_10_fu_4416_p3 = (!and_ln189_21_reg_7341.read()[0].is_01())? sc_lv<6>(): ((and_ln189_21_reg_7341.read()[0].to_bool())? col_0_reg_1398_pp0_iter1_reg.read(): col_reg_6168_pp0_iter1_reg.read());
}
void pool_write::thread_select_ln189_11_fu_4438_p3() {
select_ln189_11_fu_4438_p3 = (!and_ln189_23_reg_7351.read()[0].is_01())? sc_lv<6>(): ((and_ln189_23_reg_7351.read()[0].to_bool())? col_0_reg_1398_pp0_iter1_reg.read(): col_reg_6168_pp0_iter1_reg.read());
}
void pool_write::thread_select_ln189_12_fu_5724_p3() {
select_ln189_12_fu_5724_p3 = (!and_ln189_25_reg_7641.read()[0].is_01())? sc_lv<6>(): ((and_ln189_25_reg_7641.read()[0].to_bool())? col_0_reg_1398_pp0_iter2_reg.read(): col_reg_6168_pp0_iter2_reg.read());
}
void pool_write::thread_select_ln189_13_fu_5746_p3() {
select_ln189_13_fu_5746_p3 = (!and_ln189_27_reg_7651.read()[0].is_01())? sc_lv<6>(): ((and_ln189_27_reg_7651.read()[0].to_bool())? col_0_reg_1398_pp0_iter2_reg.read(): col_reg_6168_pp0_iter2_reg.read());
}
void pool_write::thread_select_ln189_14_fu_5768_p3() {
select_ln189_14_fu_5768_p3 = (!and_ln189_29_reg_7661.read()[0].is_01())? sc_lv<6>(): ((and_ln189_29_reg_7661.read()[0].to_bool())? col_0_reg_1398_pp0_iter2_reg.read(): col_reg_6168_pp0_iter2_reg.read());
}
void pool_write::thread_select_ln189_15_fu_5790_p3() {
select_ln189_15_fu_5790_p3 = (!and_ln189_31_reg_7671.read()[0].is_01())? sc_lv<6>(): ((and_ln189_31_reg_7671.read()[0].to_bool())? col_0_reg_1398_pp0_iter2_reg.read(): col_reg_6168_pp0_iter2_reg.read());
}
void pool_write::thread_select_ln189_1_fu_4218_p3() {
select_ln189_1_fu_4218_p3 = (!and_ln189_3_reg_7251.read()[0].is_01())? sc_lv<6>(): ((and_ln189_3_reg_7251.read()[0].to_bool())? col_0_reg_1398_pp0_iter1_reg.read(): col_reg_6168_pp0_iter1_reg.read());
}
void pool_write::thread_select_ln189_2_fu_4240_p3() {
select_ln189_2_fu_4240_p3 = (!and_ln189_5_reg_7261.read()[0].is_01())? sc_lv<6>(): ((and_ln189_5_reg_7261.read()[0].to_bool())? col_0_reg_1398_pp0_iter1_reg.read(): col_reg_6168_pp0_iter1_reg.read());
}
void pool_write::thread_select_ln189_3_fu_4262_p3() {
select_ln189_3_fu_4262_p3 = (!and_ln189_7_reg_7271.read()[0].is_01())? sc_lv<6>(): ((and_ln189_7_reg_7271.read()[0].to_bool())? col_0_reg_1398_pp0_iter1_reg.read(): col_reg_6168_pp0_iter1_reg.read());
}
void pool_write::thread_select_ln189_4_fu_4284_p3() {
select_ln189_4_fu_4284_p3 = (!and_ln189_9_reg_7281.read()[0].is_01())? sc_lv<6>(): ((and_ln189_9_reg_7281.read()[0].to_bool())? col_0_reg_1398_pp0_iter1_reg.read(): col_reg_6168_pp0_iter1_reg.read());
}
void pool_write::thread_select_ln189_5_fu_4306_p3() {
select_ln189_5_fu_4306_p3 = (!and_ln189_11_reg_7291.read()[0].is_01())? sc_lv<6>(): ((and_ln189_11_reg_7291.read()[0].to_bool())? col_0_reg_1398_pp0_iter1_reg.read(): col_reg_6168_pp0_iter1_reg.read());
}
void pool_write::thread_select_ln189_6_fu_4328_p3() {
select_ln189_6_fu_4328_p3 = (!and_ln189_13_reg_7301.read()[0].is_01())? sc_lv<6>(): ((and_ln189_13_reg_7301.read()[0].to_bool())? col_0_reg_1398_pp0_iter1_reg.read(): col_reg_6168_pp0_iter1_reg.read());
}
void pool_write::thread_select_ln189_7_fu_4350_p3() {
select_ln189_7_fu_4350_p3 = (!and_ln189_15_reg_7311.read()[0].is_01())? sc_lv<6>(): ((and_ln189_15_reg_7311.read()[0].to_bool())? col_0_reg_1398_pp0_iter1_reg.read(): col_reg_6168_pp0_iter1_reg.read());
}
void pool_write::thread_select_ln189_8_fu_4372_p3() {
select_ln189_8_fu_4372_p3 = (!and_ln189_17_reg_7321.read()[0].is_01())? sc_lv<6>(): ((and_ln189_17_reg_7321.read()[0].to_bool())? col_0_reg_1398_pp0_iter1_reg.read(): col_reg_6168_pp0_iter1_reg.read());
}
void pool_write::thread_select_ln189_9_fu_4394_p3() {
select_ln189_9_fu_4394_p3 = (!and_ln189_19_reg_7331.read()[0].is_01())? sc_lv<6>(): ((and_ln189_19_reg_7331.read()[0].to_bool())? col_0_reg_1398_pp0_iter1_reg.read(): col_reg_6168_pp0_iter1_reg.read());
}
void pool_write::thread_select_ln189_fu_4196_p3() {
select_ln189_fu_4196_p3 = (!and_ln189_1_reg_7241.read()[0].is_01())? sc_lv<6>(): ((and_ln189_1_reg_7241.read()[0].to_bool())? col_0_reg_1398_pp0_iter1_reg.read(): col_reg_6168_pp0_iter1_reg.read());
}
void pool_write::thread_select_ln190_10_fu_4427_p3() {
select_ln190_10_fu_4427_p3 = (!and_ln190_21_reg_7346.read()[0].is_01())? sc_lv<6>(): ((and_ln190_21_reg_7346.read()[0].to_bool())? col_0_reg_1398_pp0_iter1_reg.read(): col_reg_6168_pp0_iter1_reg.read());
}
void pool_write::thread_select_ln190_11_fu_4449_p3() {
select_ln190_11_fu_4449_p3 = (!and_ln190_23_reg_7356.read()[0].is_01())? sc_lv<6>(): ((and_ln190_23_reg_7356.read()[0].to_bool())? col_0_reg_1398_pp0_iter1_reg.read(): col_reg_6168_pp0_iter1_reg.read());
}
void pool_write::thread_select_ln190_12_fu_5735_p3() {
select_ln190_12_fu_5735_p3 = (!and_ln190_25_reg_7646.read()[0].is_01())? sc_lv<6>(): ((and_ln190_25_reg_7646.read()[0].to_bool())? col_0_reg_1398_pp0_iter2_reg.read(): col_reg_6168_pp0_iter2_reg.read());
}
void pool_write::thread_select_ln190_13_fu_5757_p3() {
select_ln190_13_fu_5757_p3 = (!and_ln190_27_reg_7656.read()[0].is_01())? sc_lv<6>(): ((and_ln190_27_reg_7656.read()[0].to_bool())? col_0_reg_1398_pp0_iter2_reg.read(): col_reg_6168_pp0_iter2_reg.read());
}
void pool_write::thread_select_ln190_14_fu_5779_p3() {
select_ln190_14_fu_5779_p3 = (!and_ln190_29_reg_7666.read()[0].is_01())? sc_lv<6>(): ((and_ln190_29_reg_7666.read()[0].to_bool())? col_0_reg_1398_pp0_iter2_reg.read(): col_reg_6168_pp0_iter2_reg.read());
}
void pool_write::thread_select_ln190_15_fu_5801_p3() {
select_ln190_15_fu_5801_p3 = (!and_ln190_31_reg_7676.read()[0].is_01())? sc_lv<6>(): ((and_ln190_31_reg_7676.read()[0].to_bool())? col_0_reg_1398_pp0_iter2_reg.read(): col_reg_6168_pp0_iter2_reg.read());
}
void pool_write::thread_select_ln190_1_fu_4229_p3() {
select_ln190_1_fu_4229_p3 = (!and_ln190_3_reg_7256.read()[0].is_01())? sc_lv<6>(): ((and_ln190_3_reg_7256.read()[0].to_bool())? col_0_reg_1398_pp0_iter1_reg.read(): col_reg_6168_pp0_iter1_reg.read());
}
void pool_write::thread_select_ln190_2_fu_4251_p3() {
select_ln190_2_fu_4251_p3 = (!and_ln190_5_reg_7266.read()[0].is_01())? sc_lv<6>(): ((and_ln190_5_reg_7266.read()[0].to_bool())? col_0_reg_1398_pp0_iter1_reg.read(): col_reg_6168_pp0_iter1_reg.read());
}
void pool_write::thread_select_ln190_3_fu_4273_p3() {
select_ln190_3_fu_4273_p3 = (!and_ln190_7_reg_7276.read()[0].is_01())? sc_lv<6>(): ((and_ln190_7_reg_7276.read()[0].to_bool())? col_0_reg_1398_pp0_iter1_reg.read(): col_reg_6168_pp0_iter1_reg.read());
}
void pool_write::thread_select_ln190_4_fu_4295_p3() {
select_ln190_4_fu_4295_p3 = (!and_ln190_9_reg_7286.read()[0].is_01())? sc_lv<6>(): ((and_ln190_9_reg_7286.read()[0].to_bool())? col_0_reg_1398_pp0_iter1_reg.read(): col_reg_6168_pp0_iter1_reg.read());
}
void pool_write::thread_select_ln190_5_fu_4317_p3() {
select_ln190_5_fu_4317_p3 = (!and_ln190_11_reg_7296.read()[0].is_01())? sc_lv<6>(): ((and_ln190_11_reg_7296.read()[0].to_bool())? col_0_reg_1398_pp0_iter1_reg.read(): col_reg_6168_pp0_iter1_reg.read());
}
void pool_write::thread_select_ln190_6_fu_4339_p3() {
select_ln190_6_fu_4339_p3 = (!and_ln190_13_reg_7306.read()[0].is_01())? sc_lv<6>(): ((and_ln190_13_reg_7306.read()[0].to_bool())? col_0_reg_1398_pp0_iter1_reg.read(): col_reg_6168_pp0_iter1_reg.read());
}
void pool_write::thread_select_ln190_7_fu_4361_p3() {
select_ln190_7_fu_4361_p3 = (!and_ln190_15_reg_7316.read()[0].is_01())? sc_lv<6>(): ((and_ln190_15_reg_7316.read()[0].to_bool())? col_0_reg_1398_pp0_iter1_reg.read(): col_reg_6168_pp0_iter1_reg.read());
}
void pool_write::thread_select_ln190_8_fu_4383_p3() {
select_ln190_8_fu_4383_p3 = (!and_ln190_17_reg_7326.read()[0].is_01())? sc_lv<6>(): ((and_ln190_17_reg_7326.read()[0].to_bool())? col_0_reg_1398_pp0_iter1_reg.read(): col_reg_6168_pp0_iter1_reg.read());
}
void pool_write::thread_select_ln190_9_fu_4405_p3() {
select_ln190_9_fu_4405_p3 = (!and_ln190_19_reg_7336.read()[0].is_01())? sc_lv<6>(): ((and_ln190_19_reg_7336.read()[0].to_bool())? col_0_reg_1398_pp0_iter1_reg.read(): col_reg_6168_pp0_iter1_reg.read());
}
void pool_write::thread_select_ln190_fu_4207_p3() {
select_ln190_fu_4207_p3 = (!and_ln190_1_reg_7246.read()[0].is_01())? sc_lv<6>(): ((and_ln190_1_reg_7246.read()[0].to_bool())? col_0_reg_1398_pp0_iter1_reg.read(): col_reg_6168_pp0_iter1_reg.read());
}
void pool_write::thread_select_ln191_10_fu_5624_p3() {
select_ln191_10_fu_5624_p3 = (!and_ln191_21_fu_5618_p2.read()[0].is_01())? sc_lv<32>(): ((and_ln191_21_fu_5618_p2.read()[0].to_bool())? reg_1704.read(): reg_1710.read());
}
void pool_write::thread_select_ln191_11_fu_5716_p3() {
select_ln191_11_fu_5716_p3 = (!and_ln191_23_fu_5710_p2.read()[0].is_01())? sc_lv<32>(): ((and_ln191_23_fu_5710_p2.read()[0].to_bool())? reg_1716.read(): reg_1722.read());
}
void pool_write::thread_select_ln191_12_fu_5894_p3() {
select_ln191_12_fu_5894_p3 = (!and_ln191_25_fu_5888_p2.read()[0].is_01())? sc_lv<32>(): ((and_ln191_25_fu_5888_p2.read()[0].to_bool())? ifm_buff0_12_load_2_reg_7781.read(): ifm_buff1_12_load_2_reg_7788.read());
}
void pool_write::thread_select_ln191_13_fu_5982_p3() {
select_ln191_13_fu_5982_p3 = (!and_ln191_27_fu_5976_p2.read()[0].is_01())? sc_lv<32>(): ((and_ln191_27_fu_5976_p2.read()[0].to_bool())? ifm_buff0_13_load_2_reg_7795.read(): ifm_buff1_13_load_2_reg_7802.read());
}
void pool_write::thread_select_ln191_14_fu_6070_p3() {
select_ln191_14_fu_6070_p3 = (!and_ln191_29_fu_6064_p2.read()[0].is_01())? sc_lv<32>(): ((and_ln191_29_fu_6064_p2.read()[0].to_bool())? ifm_buff0_14_load_2_reg_7809.read(): ifm_buff1_14_load_2_reg_7816.read());
}
void pool_write::thread_select_ln191_15_fu_6158_p3() {
select_ln191_15_fu_6158_p3 = (!and_ln191_31_fu_6152_p2.read()[0].is_01())? sc_lv<32>(): ((and_ln191_31_fu_6152_p2.read()[0].to_bool())? ifm_buff0_15_load_2_reg_7823.read(): ifm_buff1_15_load_2_reg_7830.read());
}
void pool_write::thread_select_ln191_1_fu_4796_p3() {
select_ln191_1_fu_4796_p3 = (!and_ln191_3_fu_4790_p2.read()[0].is_01())? sc_lv<32>(): ((and_ln191_3_fu_4790_p2.read()[0].to_bool())? reg_1597.read(): reg_1603.read());
}
void pool_write::thread_select_ln191_2_fu_4888_p3() {
select_ln191_2_fu_4888_p3 = (!and_ln191_5_fu_4882_p2.read()[0].is_01())? sc_lv<32>(): ((and_ln191_5_fu_4882_p2.read()[0].to_bool())? reg_1609.read(): reg_1615.read());
}
void pool_write::thread_select_ln191_3_fu_4980_p3() {
select_ln191_3_fu_4980_p3 = (!and_ln191_7_fu_4974_p2.read()[0].is_01())? sc_lv<32>(): ((and_ln191_7_fu_4974_p2.read()[0].to_bool())? reg_1621.read(): reg_1627.read());
}
void pool_write::thread_select_ln191_4_fu_5072_p3() {
select_ln191_4_fu_5072_p3 = (!and_ln191_9_fu_5066_p2.read()[0].is_01())? sc_lv<32>(): ((and_ln191_9_fu_5066_p2.read()[0].to_bool())? reg_1633.read(): reg_1639.read());
}
void pool_write::thread_select_ln191_5_fu_5164_p3() {
select_ln191_5_fu_5164_p3 = (!and_ln191_11_fu_5158_p2.read()[0].is_01())? sc_lv<32>(): ((and_ln191_11_fu_5158_p2.read()[0].to_bool())? reg_1645.read(): reg_1651.read());
}
void pool_write::thread_select_ln191_6_fu_5256_p3() {
select_ln191_6_fu_5256_p3 = (!and_ln191_13_fu_5250_p2.read()[0].is_01())? sc_lv<32>(): ((and_ln191_13_fu_5250_p2.read()[0].to_bool())? reg_1657.read(): reg_1663.read());
}
void pool_write::thread_select_ln191_7_fu_5348_p3() {
select_ln191_7_fu_5348_p3 = (!and_ln191_15_fu_5342_p2.read()[0].is_01())? sc_lv<32>(): ((and_ln191_15_fu_5342_p2.read()[0].to_bool())? reg_1669.read(): reg_1675.read());
}
void pool_write::thread_select_ln191_8_fu_5440_p3() {
select_ln191_8_fu_5440_p3 = (!and_ln191_17_fu_5434_p2.read()[0].is_01())? sc_lv<32>(): ((and_ln191_17_fu_5434_p2.read()[0].to_bool())? reg_1681.read(): reg_1686.read());
}
void pool_write::thread_select_ln191_9_fu_5532_p3() {
select_ln191_9_fu_5532_p3 = (!and_ln191_19_fu_5526_p2.read()[0].is_01())? sc_lv<32>(): ((and_ln191_19_fu_5526_p2.read()[0].to_bool())? reg_1692.read(): reg_1698.read());
}
void pool_write::thread_select_ln191_fu_4704_p3() {
select_ln191_fu_4704_p3 = (!and_ln191_1_fu_4698_p2.read()[0].is_01())? sc_lv<32>(): ((and_ln191_1_fu_4698_p2.read()[0].to_bool())? reg_1585.read(): reg_1591.read());
}
void pool_write::thread_tmp_100_fu_3154_p4() {
tmp_100_fu_3154_p4 = bitcast_ln189_23_fu_3150_p1.read().range(30, 23);
}
void pool_write::thread_tmp_102_fu_3196_p4() {
tmp_102_fu_3196_p4 = bitcast_ln190_22_fu_3192_p1.read().range(30, 23);
}
void pool_write::thread_tmp_103_fu_3214_p4() {
tmp_103_fu_3214_p4 = bitcast_ln190_23_fu_3210_p1.read().range(30, 23);
}
void pool_write::thread_tmp_105_fu_5636_p4() {
tmp_105_fu_5636_p4 = bitcast_ln191_22_fu_5632_p1.read().range(30, 23);
}
void pool_write::thread_tmp_106_fu_5654_p4() {
tmp_106_fu_5654_p4 = bitcast_ln191_23_fu_5650_p1.read().range(30, 23);
}
void pool_write::thread_tmp_108_fu_3735_p4() {
tmp_108_fu_3735_p4 = bitcast_ln189_24_fu_3732_p1.read().range(30, 23);
}
void pool_write::thread_tmp_109_fu_3752_p4() {
tmp_109_fu_3752_p4 = bitcast_ln189_25_fu_3749_p1.read().range(30, 23);
}
void pool_write::thread_tmp_10_fu_1954_p4() {
tmp_10_fu_1954_p4 = bitcast_ln189_3_fu_1950_p1.read().range(30, 23);
}
void pool_write::thread_tmp_111_fu_3793_p4() {
tmp_111_fu_3793_p4 = bitcast_ln190_24_fu_3790_p1.read().range(30, 23);
}
void pool_write::thread_tmp_112_fu_3810_p4() {
tmp_112_fu_3810_p4 = bitcast_ln190_25_fu_3807_p1.read().range(30, 23);
}
void pool_write::thread_tmp_114_fu_5815_p4() {
tmp_114_fu_5815_p4 = bitcast_ln191_24_fu_5812_p1.read().range(30, 23);
}
void pool_write::thread_tmp_115_fu_5832_p4() {
tmp_115_fu_5832_p4 = bitcast_ln191_25_fu_5829_p1.read().range(30, 23);
}
void pool_write::thread_tmp_117_fu_3851_p4() {
tmp_117_fu_3851_p4 = bitcast_ln189_26_fu_3848_p1.read().range(30, 23);
}
void pool_write::thread_tmp_118_fu_3868_p4() {
tmp_118_fu_3868_p4 = bitcast_ln189_27_fu_3865_p1.read().range(30, 23);
}
void pool_write::thread_tmp_120_fu_3909_p4() {
tmp_120_fu_3909_p4 = bitcast_ln190_26_fu_3906_p1.read().range(30, 23);
}
void pool_write::thread_tmp_121_fu_3926_p4() {
tmp_121_fu_3926_p4 = bitcast_ln190_27_fu_3923_p1.read().range(30, 23);
}
void pool_write::thread_tmp_123_fu_5903_p4() {
tmp_123_fu_5903_p4 = bitcast_ln191_26_fu_5900_p1.read().range(30, 23);
}
void pool_write::thread_tmp_124_fu_5920_p4() {
tmp_124_fu_5920_p4 = bitcast_ln191_27_fu_5917_p1.read().range(30, 23);
}
void pool_write::thread_tmp_126_fu_3967_p4() {
tmp_126_fu_3967_p4 = bitcast_ln189_28_fu_3964_p1.read().range(30, 23);
}
void pool_write::thread_tmp_127_fu_3984_p4() {
tmp_127_fu_3984_p4 = bitcast_ln189_29_fu_3981_p1.read().range(30, 23);
}
void pool_write::thread_tmp_129_fu_4025_p4() {
tmp_129_fu_4025_p4 = bitcast_ln190_28_fu_4022_p1.read().range(30, 23);
}
void pool_write::thread_tmp_12_fu_1996_p4() {
tmp_12_fu_1996_p4 = bitcast_ln190_2_fu_1992_p1.read().range(30, 23);
}
void pool_write::thread_tmp_130_fu_4042_p4() {
tmp_130_fu_4042_p4 = bitcast_ln190_29_fu_4039_p1.read().range(30, 23);
}
void pool_write::thread_tmp_132_fu_5991_p4() {
tmp_132_fu_5991_p4 = bitcast_ln191_28_fu_5988_p1.read().range(30, 23);
}
void pool_write::thread_tmp_133_fu_6008_p4() {
tmp_133_fu_6008_p4 = bitcast_ln191_29_fu_6005_p1.read().range(30, 23);
}
void pool_write::thread_tmp_135_fu_4083_p4() {
tmp_135_fu_4083_p4 = bitcast_ln189_30_fu_4080_p1.read().range(30, 23);
}
void pool_write::thread_tmp_136_fu_4100_p4() {
tmp_136_fu_4100_p4 = bitcast_ln189_31_fu_4097_p1.read().range(30, 23);
}
void pool_write::thread_tmp_138_fu_4141_p4() {
tmp_138_fu_4141_p4 = bitcast_ln190_30_fu_4138_p1.read().range(30, 23);
}
void pool_write::thread_tmp_139_fu_4158_p4() {
tmp_139_fu_4158_p4 = bitcast_ln190_31_fu_4155_p1.read().range(30, 23);
}
void pool_write::thread_tmp_13_fu_2014_p4() {
tmp_13_fu_2014_p4 = bitcast_ln190_3_fu_2010_p1.read().range(30, 23);
}
void pool_write::thread_tmp_141_fu_6079_p4() {
tmp_141_fu_6079_p4 = bitcast_ln191_30_fu_6076_p1.read().range(30, 23);
}
void pool_write::thread_tmp_142_fu_6096_p4() {
tmp_142_fu_6096_p4 = bitcast_ln191_31_fu_6093_p1.read().range(30, 23);
}
void pool_write::thread_tmp_15_fu_4716_p4() {
tmp_15_fu_4716_p4 = bitcast_ln191_2_fu_4712_p1.read().range(30, 23);
}
void pool_write::thread_tmp_16_fu_4734_p4() {
tmp_16_fu_4734_p4 = bitcast_ln191_3_fu_4730_p1.read().range(30, 23);
}
void pool_write::thread_tmp_18_fu_2056_p4() {
tmp_18_fu_2056_p4 = bitcast_ln189_4_fu_2052_p1.read().range(30, 23);
}
void pool_write::thread_tmp_19_fu_2074_p4() {
tmp_19_fu_2074_p4 = bitcast_ln189_5_fu_2070_p1.read().range(30, 23);
}
void pool_write::thread_tmp_1_fu_1816_p4() {
tmp_1_fu_1816_p4 = bitcast_ln189_fu_1812_p1.read().range(30, 23);
}
void pool_write::thread_tmp_21_fu_2116_p4() {
tmp_21_fu_2116_p4 = bitcast_ln190_4_fu_2112_p1.read().range(30, 23);
}
void pool_write::thread_tmp_22_fu_2134_p4() {
tmp_22_fu_2134_p4 = bitcast_ln190_5_fu_2130_p1.read().range(30, 23);
}
void pool_write::thread_tmp_24_fu_4808_p4() {
tmp_24_fu_4808_p4 = bitcast_ln191_4_fu_4804_p1.read().range(30, 23);
}
void pool_write::thread_tmp_25_fu_4826_p4() {
tmp_25_fu_4826_p4 = bitcast_ln191_5_fu_4822_p1.read().range(30, 23);
}
void pool_write::thread_tmp_27_fu_2176_p4() {
tmp_27_fu_2176_p4 = bitcast_ln189_6_fu_2172_p1.read().range(30, 23);
}
void pool_write::thread_tmp_28_fu_2194_p4() {
tmp_28_fu_2194_p4 = bitcast_ln189_7_fu_2190_p1.read().range(30, 23);
}
void pool_write::thread_tmp_2_fu_1834_p4() {
tmp_2_fu_1834_p4 = bitcast_ln189_1_fu_1830_p1.read().range(30, 23);
}
void pool_write::thread_tmp_30_fu_2236_p4() {
tmp_30_fu_2236_p4 = bitcast_ln190_6_fu_2232_p1.read().range(30, 23);
}
void pool_write::thread_tmp_31_fu_2254_p4() {
tmp_31_fu_2254_p4 = bitcast_ln190_7_fu_2250_p1.read().range(30, 23);
}
void pool_write::thread_tmp_33_fu_4900_p4() {
tmp_33_fu_4900_p4 = bitcast_ln191_6_fu_4896_p1.read().range(30, 23);
}
void pool_write::thread_tmp_34_fu_4918_p4() {
tmp_34_fu_4918_p4 = bitcast_ln191_7_fu_4914_p1.read().range(30, 23);
}
void pool_write::thread_tmp_36_fu_2296_p4() {
tmp_36_fu_2296_p4 = bitcast_ln189_8_fu_2292_p1.read().range(30, 23);
}
void pool_write::thread_tmp_37_fu_2314_p4() {
tmp_37_fu_2314_p4 = bitcast_ln189_9_fu_2310_p1.read().range(30, 23);
}
void pool_write::thread_tmp_39_fu_2356_p4() {
tmp_39_fu_2356_p4 = bitcast_ln190_8_fu_2352_p1.read().range(30, 23);
}
void pool_write::thread_tmp_40_fu_2374_p4() {
tmp_40_fu_2374_p4 = bitcast_ln190_9_fu_2370_p1.read().range(30, 23);
}
void pool_write::thread_tmp_42_fu_4992_p4() {
tmp_42_fu_4992_p4 = bitcast_ln191_8_fu_4988_p1.read().range(30, 23);
}
void pool_write::thread_tmp_43_fu_5010_p4() {
tmp_43_fu_5010_p4 = bitcast_ln191_9_fu_5006_p1.read().range(30, 23);
}
void pool_write::thread_tmp_45_fu_2416_p4() {
tmp_45_fu_2416_p4 = bitcast_ln189_10_fu_2412_p1.read().range(30, 23);
}
void pool_write::thread_tmp_46_fu_2434_p4() {
tmp_46_fu_2434_p4 = bitcast_ln189_11_fu_2430_p1.read().range(30, 23);
}
void pool_write::thread_tmp_48_fu_2476_p4() {
tmp_48_fu_2476_p4 = bitcast_ln190_10_fu_2472_p1.read().range(30, 23);
}
void pool_write::thread_tmp_49_fu_2494_p4() {
tmp_49_fu_2494_p4 = bitcast_ln190_11_fu_2490_p1.read().range(30, 23);
}
void pool_write::thread_tmp_4_fu_1876_p4() {
tmp_4_fu_1876_p4 = bitcast_ln190_fu_1872_p1.read().range(30, 23);
}
void pool_write::thread_tmp_51_fu_5084_p4() {
tmp_51_fu_5084_p4 = bitcast_ln191_10_fu_5080_p1.read().range(30, 23);
}
void pool_write::thread_tmp_52_fu_5102_p4() {
tmp_52_fu_5102_p4 = bitcast_ln191_11_fu_5098_p1.read().range(30, 23);
}
void pool_write::thread_tmp_54_fu_2536_p4() {
tmp_54_fu_2536_p4 = bitcast_ln189_12_fu_2532_p1.read().range(30, 23);
}
void pool_write::thread_tmp_55_fu_2554_p4() {
tmp_55_fu_2554_p4 = bitcast_ln189_13_fu_2550_p1.read().range(30, 23);
}
void pool_write::thread_tmp_57_fu_2596_p4() {
tmp_57_fu_2596_p4 = bitcast_ln190_12_fu_2592_p1.read().range(30, 23);
}
void pool_write::thread_tmp_58_fu_2614_p4() {
tmp_58_fu_2614_p4 = bitcast_ln190_13_fu_2610_p1.read().range(30, 23);
}
void pool_write::thread_tmp_5_fu_1894_p4() {
tmp_5_fu_1894_p4 = bitcast_ln190_1_fu_1890_p1.read().range(30, 23);
}
void pool_write::thread_tmp_60_fu_5176_p4() {
tmp_60_fu_5176_p4 = bitcast_ln191_12_fu_5172_p1.read().range(30, 23);
}
void pool_write::thread_tmp_61_fu_5194_p4() {
tmp_61_fu_5194_p4 = bitcast_ln191_13_fu_5190_p1.read().range(30, 23);
}
void pool_write::thread_tmp_63_fu_2656_p4() {
tmp_63_fu_2656_p4 = bitcast_ln189_14_fu_2652_p1.read().range(30, 23);
}
void pool_write::thread_tmp_64_fu_2674_p4() {
tmp_64_fu_2674_p4 = bitcast_ln189_15_fu_2670_p1.read().range(30, 23);
}
void pool_write::thread_tmp_66_fu_2716_p4() {
tmp_66_fu_2716_p4 = bitcast_ln190_14_fu_2712_p1.read().range(30, 23);
}
void pool_write::thread_tmp_67_fu_2734_p4() {
tmp_67_fu_2734_p4 = bitcast_ln190_15_fu_2730_p1.read().range(30, 23);
}
void pool_write::thread_tmp_69_fu_5268_p4() {
tmp_69_fu_5268_p4 = bitcast_ln191_14_fu_5264_p1.read().range(30, 23);
}
void pool_write::thread_tmp_70_fu_5286_p4() {
tmp_70_fu_5286_p4 = bitcast_ln191_15_fu_5282_p1.read().range(30, 23);
}
void pool_write::thread_tmp_72_fu_2776_p4() {
tmp_72_fu_2776_p4 = bitcast_ln189_16_fu_2772_p1.read().range(30, 23);
}
void pool_write::thread_tmp_73_fu_2794_p4() {
tmp_73_fu_2794_p4 = bitcast_ln189_17_fu_2790_p1.read().range(30, 23);
}
void pool_write::thread_tmp_75_fu_2836_p4() {
tmp_75_fu_2836_p4 = bitcast_ln190_16_fu_2832_p1.read().range(30, 23);
}
void pool_write::thread_tmp_76_fu_2854_p4() {
tmp_76_fu_2854_p4 = bitcast_ln190_17_fu_2850_p1.read().range(30, 23);
}
void pool_write::thread_tmp_78_fu_5360_p4() {
tmp_78_fu_5360_p4 = bitcast_ln191_16_fu_5356_p1.read().range(30, 23);
}
void pool_write::thread_tmp_79_fu_5378_p4() {
tmp_79_fu_5378_p4 = bitcast_ln191_17_fu_5374_p1.read().range(30, 23);
}
void pool_write::thread_tmp_7_fu_4624_p4() {
tmp_7_fu_4624_p4 = bitcast_ln191_fu_4620_p1.read().range(30, 23);
}
void pool_write::thread_tmp_81_fu_2896_p4() {
tmp_81_fu_2896_p4 = bitcast_ln189_18_fu_2892_p1.read().range(30, 23);
}
void pool_write::thread_tmp_82_fu_2914_p4() {
tmp_82_fu_2914_p4 = bitcast_ln189_19_fu_2910_p1.read().range(30, 23);
}
void pool_write::thread_tmp_84_fu_2956_p4() {
tmp_84_fu_2956_p4 = bitcast_ln190_18_fu_2952_p1.read().range(30, 23);
}
void pool_write::thread_tmp_85_fu_2974_p4() {
tmp_85_fu_2974_p4 = bitcast_ln190_19_fu_2970_p1.read().range(30, 23);
}
void pool_write::thread_tmp_87_fu_5452_p4() {
tmp_87_fu_5452_p4 = bitcast_ln191_18_fu_5448_p1.read().range(30, 23);
}
void pool_write::thread_tmp_88_fu_5470_p4() {
tmp_88_fu_5470_p4 = bitcast_ln191_19_fu_5466_p1.read().range(30, 23);
}
void pool_write::thread_tmp_8_fu_4642_p4() {
tmp_8_fu_4642_p4 = bitcast_ln191_1_fu_4638_p1.read().range(30, 23);
}
void pool_write::thread_tmp_90_fu_3016_p4() {
tmp_90_fu_3016_p4 = bitcast_ln189_20_fu_3012_p1.read().range(30, 23);
}
void pool_write::thread_tmp_91_fu_3034_p4() {
tmp_91_fu_3034_p4 = bitcast_ln189_21_fu_3030_p1.read().range(30, 23);
}
void pool_write::thread_tmp_93_fu_3076_p4() {
tmp_93_fu_3076_p4 = bitcast_ln190_20_fu_3072_p1.read().range(30, 23);
}
void pool_write::thread_tmp_94_fu_3094_p4() {
tmp_94_fu_3094_p4 = bitcast_ln190_21_fu_3090_p1.read().range(30, 23);
}
void pool_write::thread_tmp_96_fu_5544_p4() {
tmp_96_fu_5544_p4 = bitcast_ln191_20_fu_5540_p1.read().range(30, 23);
}
void pool_write::thread_tmp_97_fu_5562_p4() {
tmp_97_fu_5562_p4 = bitcast_ln191_21_fu_5558_p1.read().range(30, 23);
}
void pool_write::thread_tmp_99_fu_3136_p4() {
tmp_99_fu_3136_p4 = bitcast_ln189_22_fu_3132_p1.read().range(30, 23);
}
void pool_write::thread_tmp_s_fu_1936_p4() {
tmp_s_fu_1936_p4 = bitcast_ln189_2_fu_1932_p1.read().range(30, 23);
}
void pool_write::thread_trunc_ln189_10_fu_2426_p1() {
trunc_ln189_10_fu_2426_p1 = bitcast_ln189_10_fu_2412_p1.read().range(23-1, 0);
}
void pool_write::thread_trunc_ln189_11_fu_2444_p1() {
trunc_ln189_11_fu_2444_p1 = bitcast_ln189_11_fu_2430_p1.read().range(23-1, 0);
}
void pool_write::thread_trunc_ln189_12_fu_2546_p1() {
trunc_ln189_12_fu_2546_p1 = bitcast_ln189_12_fu_2532_p1.read().range(23-1, 0);
}
void pool_write::thread_trunc_ln189_13_fu_2564_p1() {
trunc_ln189_13_fu_2564_p1 = bitcast_ln189_13_fu_2550_p1.read().range(23-1, 0);
}
void pool_write::thread_trunc_ln189_14_fu_2666_p1() {
trunc_ln189_14_fu_2666_p1 = bitcast_ln189_14_fu_2652_p1.read().range(23-1, 0);
}
void pool_write::thread_trunc_ln189_15_fu_2684_p1() {
trunc_ln189_15_fu_2684_p1 = bitcast_ln189_15_fu_2670_p1.read().range(23-1, 0);
}
void pool_write::thread_trunc_ln189_16_fu_2786_p1() {
trunc_ln189_16_fu_2786_p1 = bitcast_ln189_16_fu_2772_p1.read().range(23-1, 0);
}
void pool_write::thread_trunc_ln189_17_fu_2804_p1() {
trunc_ln189_17_fu_2804_p1 = bitcast_ln189_17_fu_2790_p1.read().range(23-1, 0);
}
void pool_write::thread_trunc_ln189_18_fu_2906_p1() {
trunc_ln189_18_fu_2906_p1 = bitcast_ln189_18_fu_2892_p1.read().range(23-1, 0);
}
void pool_write::thread_trunc_ln189_19_fu_2924_p1() {
trunc_ln189_19_fu_2924_p1 = bitcast_ln189_19_fu_2910_p1.read().range(23-1, 0);
}
void pool_write::thread_trunc_ln189_1_fu_1844_p1() {
trunc_ln189_1_fu_1844_p1 = bitcast_ln189_1_fu_1830_p1.read().range(23-1, 0);
}
void pool_write::thread_trunc_ln189_20_fu_3026_p1() {
trunc_ln189_20_fu_3026_p1 = bitcast_ln189_20_fu_3012_p1.read().range(23-1, 0);
}
void pool_write::thread_trunc_ln189_21_fu_3044_p1() {
trunc_ln189_21_fu_3044_p1 = bitcast_ln189_21_fu_3030_p1.read().range(23-1, 0);
}
void pool_write::thread_trunc_ln189_22_fu_3146_p1() {
trunc_ln189_22_fu_3146_p1 = bitcast_ln189_22_fu_3132_p1.read().range(23-1, 0);
}
void pool_write::thread_trunc_ln189_23_fu_3164_p1() {
trunc_ln189_23_fu_3164_p1 = bitcast_ln189_23_fu_3150_p1.read().range(23-1, 0);
}
void pool_write::thread_trunc_ln189_24_fu_3745_p1() {
trunc_ln189_24_fu_3745_p1 = bitcast_ln189_24_fu_3732_p1.read().range(23-1, 0);
}
void pool_write::thread_trunc_ln189_25_fu_3762_p1() {
trunc_ln189_25_fu_3762_p1 = bitcast_ln189_25_fu_3749_p1.read().range(23-1, 0);
}
void pool_write::thread_trunc_ln189_26_fu_3861_p1() {
trunc_ln189_26_fu_3861_p1 = bitcast_ln189_26_fu_3848_p1.read().range(23-1, 0);
}
void pool_write::thread_trunc_ln189_27_fu_3878_p1() {
trunc_ln189_27_fu_3878_p1 = bitcast_ln189_27_fu_3865_p1.read().range(23-1, 0);
}
void pool_write::thread_trunc_ln189_28_fu_3977_p1() {
trunc_ln189_28_fu_3977_p1 = bitcast_ln189_28_fu_3964_p1.read().range(23-1, 0);
}
void pool_write::thread_trunc_ln189_29_fu_3994_p1() {
trunc_ln189_29_fu_3994_p1 = bitcast_ln189_29_fu_3981_p1.read().range(23-1, 0);
}
void pool_write::thread_trunc_ln189_2_fu_1946_p1() {
trunc_ln189_2_fu_1946_p1 = bitcast_ln189_2_fu_1932_p1.read().range(23-1, 0);
}
void pool_write::thread_trunc_ln189_30_fu_4093_p1() {
trunc_ln189_30_fu_4093_p1 = bitcast_ln189_30_fu_4080_p1.read().range(23-1, 0);
}
void pool_write::thread_trunc_ln189_31_fu_4110_p1() {
trunc_ln189_31_fu_4110_p1 = bitcast_ln189_31_fu_4097_p1.read().range(23-1, 0);
}
void pool_write::thread_trunc_ln189_3_fu_1964_p1() {
trunc_ln189_3_fu_1964_p1 = bitcast_ln189_3_fu_1950_p1.read().range(23-1, 0);
}
void pool_write::thread_trunc_ln189_4_fu_2066_p1() {
trunc_ln189_4_fu_2066_p1 = bitcast_ln189_4_fu_2052_p1.read().range(23-1, 0);
}
void pool_write::thread_trunc_ln189_5_fu_2084_p1() {
trunc_ln189_5_fu_2084_p1 = bitcast_ln189_5_fu_2070_p1.read().range(23-1, 0);
}
void pool_write::thread_trunc_ln189_6_fu_2186_p1() {
trunc_ln189_6_fu_2186_p1 = bitcast_ln189_6_fu_2172_p1.read().range(23-1, 0);
}
void pool_write::thread_trunc_ln189_7_fu_2204_p1() {
trunc_ln189_7_fu_2204_p1 = bitcast_ln189_7_fu_2190_p1.read().range(23-1, 0);
}
void pool_write::thread_trunc_ln189_8_fu_2306_p1() {
trunc_ln189_8_fu_2306_p1 = bitcast_ln189_8_fu_2292_p1.read().range(23-1, 0);
}
void pool_write::thread_trunc_ln189_9_fu_2324_p1() {
trunc_ln189_9_fu_2324_p1 = bitcast_ln189_9_fu_2310_p1.read().range(23-1, 0);
}
void pool_write::thread_trunc_ln189_fu_1826_p1() {
trunc_ln189_fu_1826_p1 = bitcast_ln189_fu_1812_p1.read().range(23-1, 0);
}
void pool_write::thread_trunc_ln190_10_fu_2486_p1() {
trunc_ln190_10_fu_2486_p1 = bitcast_ln190_10_fu_2472_p1.read().range(23-1, 0);
}
void pool_write::thread_trunc_ln190_11_fu_2504_p1() {
trunc_ln190_11_fu_2504_p1 = bitcast_ln190_11_fu_2490_p1.read().range(23-1, 0);
}
void pool_write::thread_trunc_ln190_12_fu_2606_p1() {
trunc_ln190_12_fu_2606_p1 = bitcast_ln190_12_fu_2592_p1.read().range(23-1, 0);
}
void pool_write::thread_trunc_ln190_13_fu_2624_p1() {
trunc_ln190_13_fu_2624_p1 = bitcast_ln190_13_fu_2610_p1.read().range(23-1, 0);
}
void pool_write::thread_trunc_ln190_14_fu_2726_p1() {
trunc_ln190_14_fu_2726_p1 = bitcast_ln190_14_fu_2712_p1.read().range(23-1, 0);
}
void pool_write::thread_trunc_ln190_15_fu_2744_p1() {
trunc_ln190_15_fu_2744_p1 = bitcast_ln190_15_fu_2730_p1.read().range(23-1, 0);
}
void pool_write::thread_trunc_ln190_16_fu_2846_p1() {
trunc_ln190_16_fu_2846_p1 = bitcast_ln190_16_fu_2832_p1.read().range(23-1, 0);
}
void pool_write::thread_trunc_ln190_17_fu_2864_p1() {
trunc_ln190_17_fu_2864_p1 = bitcast_ln190_17_fu_2850_p1.read().range(23-1, 0);
}
void pool_write::thread_trunc_ln190_18_fu_2966_p1() {
trunc_ln190_18_fu_2966_p1 = bitcast_ln190_18_fu_2952_p1.read().range(23-1, 0);
}
void pool_write::thread_trunc_ln190_19_fu_2984_p1() {
trunc_ln190_19_fu_2984_p1 = bitcast_ln190_19_fu_2970_p1.read().range(23-1, 0);
}
void pool_write::thread_trunc_ln190_1_fu_1904_p1() {
trunc_ln190_1_fu_1904_p1 = bitcast_ln190_1_fu_1890_p1.read().range(23-1, 0);
}
void pool_write::thread_trunc_ln190_20_fu_3086_p1() {
trunc_ln190_20_fu_3086_p1 = bitcast_ln190_20_fu_3072_p1.read().range(23-1, 0);
}
void pool_write::thread_trunc_ln190_21_fu_3104_p1() {
trunc_ln190_21_fu_3104_p1 = bitcast_ln190_21_fu_3090_p1.read().range(23-1, 0);
}
void pool_write::thread_trunc_ln190_22_fu_3206_p1() {
trunc_ln190_22_fu_3206_p1 = bitcast_ln190_22_fu_3192_p1.read().range(23-1, 0);
}
void pool_write::thread_trunc_ln190_23_fu_3224_p1() {
trunc_ln190_23_fu_3224_p1 = bitcast_ln190_23_fu_3210_p1.read().range(23-1, 0);
}
void pool_write::thread_trunc_ln190_24_fu_3803_p1() {
trunc_ln190_24_fu_3803_p1 = bitcast_ln190_24_fu_3790_p1.read().range(23-1, 0);
}
void pool_write::thread_trunc_ln190_25_fu_3820_p1() {
trunc_ln190_25_fu_3820_p1 = bitcast_ln190_25_fu_3807_p1.read().range(23-1, 0);
}
void pool_write::thread_trunc_ln190_26_fu_3919_p1() {
trunc_ln190_26_fu_3919_p1 = bitcast_ln190_26_fu_3906_p1.read().range(23-1, 0);
}
void pool_write::thread_trunc_ln190_27_fu_3936_p1() {
trunc_ln190_27_fu_3936_p1 = bitcast_ln190_27_fu_3923_p1.read().range(23-1, 0);
}
void pool_write::thread_trunc_ln190_28_fu_4035_p1() {
trunc_ln190_28_fu_4035_p1 = bitcast_ln190_28_fu_4022_p1.read().range(23-1, 0);
}
void pool_write::thread_trunc_ln190_29_fu_4052_p1() {
trunc_ln190_29_fu_4052_p1 = bitcast_ln190_29_fu_4039_p1.read().range(23-1, 0);
}
void pool_write::thread_trunc_ln190_2_fu_2006_p1() {
trunc_ln190_2_fu_2006_p1 = bitcast_ln190_2_fu_1992_p1.read().range(23-1, 0);
}
void pool_write::thread_trunc_ln190_30_fu_4151_p1() {
trunc_ln190_30_fu_4151_p1 = bitcast_ln190_30_fu_4138_p1.read().range(23-1, 0);
}
void pool_write::thread_trunc_ln190_31_fu_4168_p1() {
trunc_ln190_31_fu_4168_p1 = bitcast_ln190_31_fu_4155_p1.read().range(23-1, 0);
}
void pool_write::thread_trunc_ln190_3_fu_2024_p1() {
trunc_ln190_3_fu_2024_p1 = bitcast_ln190_3_fu_2010_p1.read().range(23-1, 0);
}
void pool_write::thread_trunc_ln190_4_fu_2126_p1() {
trunc_ln190_4_fu_2126_p1 = bitcast_ln190_4_fu_2112_p1.read().range(23-1, 0);
}
void pool_write::thread_trunc_ln190_5_fu_2144_p1() {
trunc_ln190_5_fu_2144_p1 = bitcast_ln190_5_fu_2130_p1.read().range(23-1, 0);
}
void pool_write::thread_trunc_ln190_6_fu_2246_p1() {
trunc_ln190_6_fu_2246_p1 = bitcast_ln190_6_fu_2232_p1.read().range(23-1, 0);
}
void pool_write::thread_trunc_ln190_7_fu_2264_p1() {
trunc_ln190_7_fu_2264_p1 = bitcast_ln190_7_fu_2250_p1.read().range(23-1, 0);
}
void pool_write::thread_trunc_ln190_8_fu_2366_p1() {
trunc_ln190_8_fu_2366_p1 = bitcast_ln190_8_fu_2352_p1.read().range(23-1, 0);
}
void pool_write::thread_trunc_ln190_9_fu_2384_p1() {
trunc_ln190_9_fu_2384_p1 = bitcast_ln190_9_fu_2370_p1.read().range(23-1, 0);
}
void pool_write::thread_trunc_ln190_fu_1886_p1() {
trunc_ln190_fu_1886_p1 = bitcast_ln190_fu_1872_p1.read().range(23-1, 0);
}
void pool_write::thread_trunc_ln191_10_fu_5094_p1() {
trunc_ln191_10_fu_5094_p1 = bitcast_ln191_10_fu_5080_p1.read().range(23-1, 0);
}
void pool_write::thread_trunc_ln191_11_fu_5112_p1() {
trunc_ln191_11_fu_5112_p1 = bitcast_ln191_11_fu_5098_p1.read().range(23-1, 0);
}
void pool_write::thread_trunc_ln191_12_fu_5186_p1() {
trunc_ln191_12_fu_5186_p1 = bitcast_ln191_12_fu_5172_p1.read().range(23-1, 0);
}
void pool_write::thread_trunc_ln191_13_fu_5204_p1() {
trunc_ln191_13_fu_5204_p1 = bitcast_ln191_13_fu_5190_p1.read().range(23-1, 0);
}
void pool_write::thread_trunc_ln191_14_fu_5278_p1() {
trunc_ln191_14_fu_5278_p1 = bitcast_ln191_14_fu_5264_p1.read().range(23-1, 0);
}
void pool_write::thread_trunc_ln191_15_fu_5296_p1() {
trunc_ln191_15_fu_5296_p1 = bitcast_ln191_15_fu_5282_p1.read().range(23-1, 0);
}
void pool_write::thread_trunc_ln191_16_fu_5370_p1() {
trunc_ln191_16_fu_5370_p1 = bitcast_ln191_16_fu_5356_p1.read().range(23-1, 0);
}
void pool_write::thread_trunc_ln191_17_fu_5388_p1() {
trunc_ln191_17_fu_5388_p1 = bitcast_ln191_17_fu_5374_p1.read().range(23-1, 0);
}
void pool_write::thread_trunc_ln191_18_fu_5462_p1() {
trunc_ln191_18_fu_5462_p1 = bitcast_ln191_18_fu_5448_p1.read().range(23-1, 0);
}
void pool_write::thread_trunc_ln191_19_fu_5480_p1() {
trunc_ln191_19_fu_5480_p1 = bitcast_ln191_19_fu_5466_p1.read().range(23-1, 0);
}
void pool_write::thread_trunc_ln191_1_fu_4652_p1() {
trunc_ln191_1_fu_4652_p1 = bitcast_ln191_1_fu_4638_p1.read().range(23-1, 0);
}
void pool_write::thread_trunc_ln191_20_fu_5554_p1() {
trunc_ln191_20_fu_5554_p1 = bitcast_ln191_20_fu_5540_p1.read().range(23-1, 0);
}
void pool_write::thread_trunc_ln191_21_fu_5572_p1() {
trunc_ln191_21_fu_5572_p1 = bitcast_ln191_21_fu_5558_p1.read().range(23-1, 0);
}
void pool_write::thread_trunc_ln191_22_fu_5646_p1() {
trunc_ln191_22_fu_5646_p1 = bitcast_ln191_22_fu_5632_p1.read().range(23-1, 0);
}
void pool_write::thread_trunc_ln191_23_fu_5664_p1() {
trunc_ln191_23_fu_5664_p1 = bitcast_ln191_23_fu_5650_p1.read().range(23-1, 0);
}
void pool_write::thread_trunc_ln191_24_fu_5825_p1() {
trunc_ln191_24_fu_5825_p1 = bitcast_ln191_24_fu_5812_p1.read().range(23-1, 0);
}
void pool_write::thread_trunc_ln191_25_fu_5842_p1() {
trunc_ln191_25_fu_5842_p1 = bitcast_ln191_25_fu_5829_p1.read().range(23-1, 0);
}
void pool_write::thread_trunc_ln191_26_fu_5913_p1() {
trunc_ln191_26_fu_5913_p1 = bitcast_ln191_26_fu_5900_p1.read().range(23-1, 0);
}
void pool_write::thread_trunc_ln191_27_fu_5930_p1() {
trunc_ln191_27_fu_5930_p1 = bitcast_ln191_27_fu_5917_p1.read().range(23-1, 0);
}
void pool_write::thread_trunc_ln191_28_fu_6001_p1() {
trunc_ln191_28_fu_6001_p1 = bitcast_ln191_28_fu_5988_p1.read().range(23-1, 0);
}
void pool_write::thread_trunc_ln191_29_fu_6018_p1() {
trunc_ln191_29_fu_6018_p1 = bitcast_ln191_29_fu_6005_p1.read().range(23-1, 0);
}
void pool_write::thread_trunc_ln191_2_fu_4726_p1() {
trunc_ln191_2_fu_4726_p1 = bitcast_ln191_2_fu_4712_p1.read().range(23-1, 0);
}
void pool_write::thread_trunc_ln191_30_fu_6089_p1() {
trunc_ln191_30_fu_6089_p1 = bitcast_ln191_30_fu_6076_p1.read().range(23-1, 0);
}
void pool_write::thread_trunc_ln191_31_fu_6106_p1() {
trunc_ln191_31_fu_6106_p1 = bitcast_ln191_31_fu_6093_p1.read().range(23-1, 0);
}
void pool_write::thread_trunc_ln191_3_fu_4744_p1() {
trunc_ln191_3_fu_4744_p1 = bitcast_ln191_3_fu_4730_p1.read().range(23-1, 0);
}
void pool_write::thread_trunc_ln191_4_fu_4818_p1() {
trunc_ln191_4_fu_4818_p1 = bitcast_ln191_4_fu_4804_p1.read().range(23-1, 0);
}
void pool_write::thread_trunc_ln191_5_fu_4836_p1() {
trunc_ln191_5_fu_4836_p1 = bitcast_ln191_5_fu_4822_p1.read().range(23-1, 0);
}
void pool_write::thread_trunc_ln191_6_fu_4910_p1() {
trunc_ln191_6_fu_4910_p1 = bitcast_ln191_6_fu_4896_p1.read().range(23-1, 0);
}
void pool_write::thread_trunc_ln191_7_fu_4928_p1() {
trunc_ln191_7_fu_4928_p1 = bitcast_ln191_7_fu_4914_p1.read().range(23-1, 0);
}
void pool_write::thread_trunc_ln191_8_fu_5002_p1() {
trunc_ln191_8_fu_5002_p1 = bitcast_ln191_8_fu_4988_p1.read().range(23-1, 0);
}
void pool_write::thread_trunc_ln191_9_fu_5020_p1() {
trunc_ln191_9_fu_5020_p1 = bitcast_ln191_9_fu_5006_p1.read().range(23-1, 0);
}
void pool_write::thread_trunc_ln191_fu_4634_p1() {
trunc_ln191_fu_4634_p1 = bitcast_ln191_fu_4620_p1.read().range(23-1, 0);
}
void pool_write::thread_zext_ln189_10_fu_4378_p1() {
zext_ln189_10_fu_4378_p1 = esl_zext<64,6>(select_ln189_8_fu_4372_p3.read());
}
void pool_write::thread_zext_ln189_11_fu_4400_p1() {
zext_ln189_11_fu_4400_p1 = esl_zext<64,6>(select_ln189_9_fu_4394_p3.read());
}
void pool_write::thread_zext_ln189_12_fu_4422_p1() {
zext_ln189_12_fu_4422_p1 = esl_zext<64,6>(select_ln189_10_fu_4416_p3.read());
}
void pool_write::thread_zext_ln189_13_fu_4444_p1() {
zext_ln189_13_fu_4444_p1 = esl_zext<64,6>(select_ln189_11_fu_4438_p3.read());
}
void pool_write::thread_zext_ln189_14_fu_5730_p1() {
zext_ln189_14_fu_5730_p1 = esl_zext<64,6>(select_ln189_12_fu_5724_p3.read());
}
void pool_write::thread_zext_ln189_15_fu_5752_p1() {
zext_ln189_15_fu_5752_p1 = esl_zext<64,6>(select_ln189_13_fu_5746_p3.read());
}
void pool_write::thread_zext_ln189_16_fu_5774_p1() {
zext_ln189_16_fu_5774_p1 = esl_zext<64,6>(select_ln189_14_fu_5768_p3.read());
}
void pool_write::thread_zext_ln189_17_fu_5796_p1() {
zext_ln189_17_fu_5796_p1 = esl_zext<64,6>(select_ln189_15_fu_5790_p3.read());
}
void pool_write::thread_zext_ln189_1_fu_1776_p1() {
zext_ln189_1_fu_1776_p1 = esl_zext<64,6>(col_fu_1734_p2.read());
}
void pool_write::thread_zext_ln189_2_fu_4202_p1() {
zext_ln189_2_fu_4202_p1 = esl_zext<64,6>(select_ln189_fu_4196_p3.read());
}
void pool_write::thread_zext_ln189_3_fu_4224_p1() {
zext_ln189_3_fu_4224_p1 = esl_zext<64,6>(select_ln189_1_fu_4218_p3.read());
}
}
| [
"es921088@gmail.com"
] | es921088@gmail.com |
e1ce1eb53be24609bf65f48899d5e2f97a233138 | 2ba94892764a44d9c07f0f549f79f9f9dc272151 | /Engine/Source/Programs/SymbolDebugger/Private/SSymbolDebugger.cpp | cf660cfcb5750b104098359019c5ee848c1d39f8 | [
"BSD-2-Clause",
"LicenseRef-scancode-proprietary-license"
] | permissive | PopCap/GameIdea | 934769eeb91f9637f5bf205d88b13ff1fc9ae8fd | 201e1df50b2bc99afc079ce326aa0a44b178a391 | refs/heads/master | 2021-01-25T00:11:38.709772 | 2018-09-11T03:38:56 | 2018-09-11T03:38:56 | 37,818,708 | 0 | 0 | BSD-2-Clause | 2018-09-11T03:39:05 | 2015-06-21T17:36:44 | null | UTF-8 | C++ | false | false | 13,416 | cpp | // Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.
#include "SymbolDebuggerApp.h"
#include "SSymbolDebugger.h"
#include "SThrobber.h"
TSharedRef<SWidget> SSymbolDebugger::GenerateActionButton(ESymbolDebuggerActions InAction)
{
FText ActionName;
switch (InAction)
{
case DebugAction_Inspect:
ActionName = NSLOCTEXT("SymbolDebugger", "InspectActionName", "Inspect");
break;
case DebugAction_Sync:
ActionName = NSLOCTEXT("SymbolDebugger", "SyncActionName", "Sync");
break;
case DebugAction_Debug:
ActionName = NSLOCTEXT("SymbolDebugger", "DebugActionName", "Debug");
break;
}
return
SNew(SButton)
.Text(ActionName)
.IsEnabled(this, &SSymbolDebugger::IsActionEnabled, InAction)
.OnClicked(this, &SSymbolDebugger::OnActionClicked, InAction);
}
TSharedRef<SWidget> SSymbolDebugger::GenerateActionButtons()
{
return
SNew(SHorizontalBox)
+ SHorizontalBox::Slot()
.AutoWidth()
.Padding(2)
[
GenerateActionButton(DebugAction_Inspect)
]
+ SHorizontalBox::Slot()
.AutoWidth()
.Padding(2)
[
GenerateActionButton(DebugAction_Sync)
]
+ SHorizontalBox::Slot()
.AutoWidth()
.Padding(2)
[
GenerateActionButton(DebugAction_Debug)
];
}
TSharedRef<SWidget> SSymbolDebugger::GenerateLabelTextBoxPair(ESymbolDebuggerTextFields InTextField)
{
FText LabelText;
switch (InTextField)
{
case TextField_CrashDump:
LabelText = NSLOCTEXT("SymbolDebugger", "CrashDumpLabel", "Crash Dump:");
break;
case TextField_ChangeList:
LabelText = NSLOCTEXT("SymbolDebugger", "ChangelistLabel", "Changelist #:");
break;
case TextField_Label:
LabelText = NSLOCTEXT("SymbolDebugger", "Label", "Label:");
break;
case TextField_Platform:
LabelText = NSLOCTEXT("SymbolDebugger", "PlatformLabel", "Platform:");
break;
case TextField_EngineVersion:
LabelText = NSLOCTEXT("SymbolDebugger", "EngineVersionLabel", "Engine Ver:");
break;
case TextField_SymbolStore:
LabelText = NSLOCTEXT("SymbolDebugger", "SymbolStoreLabel", "Symbol Store:");
break;
case TextField_RemoteDebugIP:
LabelText = NSLOCTEXT("SymbolDebugger", "RemoteIPLabel", "Remote IP:");
break;
case TextField_SourceControlDepot:
LabelText = NSLOCTEXT("SymbolDebugger", "DepotNameLabel", "Depot Name:");
break;
default:
break;
}
check( !LabelText.IsEmpty() );
return
SNew(SHorizontalBox)
+ SHorizontalBox::Slot()
.HAlign(HAlign_Right)
.Padding(2)
.FillWidth(.3)
[
SNew(STextBlock)
.Text(LabelText)
.Visibility(this, &SSymbolDebugger::IsTextVisible, InTextField)
]
+ SHorizontalBox::Slot()
.Padding(2)
.FillWidth(.7)
[
SNew(SEditableTextBox)
.Text(this, &SSymbolDebugger::OnGetText, InTextField)
.OnTextCommitted(this, &SSymbolDebugger::OnTextCommited, InTextField)
.IsEnabled(this, &SSymbolDebugger::IsTextEnabled, InTextField)
.Visibility(this, &SSymbolDebugger::IsTextVisible, InTextField)
];
}
TSharedRef<SWidget> SSymbolDebugger::GenerateMethodButton(const FText& InMethodName, ESymbolDebuggerMethods InMethod)
{
return
SNew(SCheckBox)
.Style(FCoreStyle::Get(), "RadioButton")
.IsChecked(this, &SSymbolDebugger::IsMethodChecked, InMethod)
.OnCheckStateChanged(this, &SSymbolDebugger::OnMethodChanged, InMethod)
[
SNew(STextBlock).Text(InMethodName)
];
}
TSharedRef<SWidget> SSymbolDebugger::GenerateMethodButtons()
{
return
SNew(SHorizontalBox)
+ SHorizontalBox::Slot()
.AutoWidth()
.Padding(2)
[
GenerateMethodButton(NSLOCTEXT("SymbolDebugger", "CrashDumpButton", "CrashDump"), DebugMethod_CrashDump)
]
+ SHorizontalBox::Slot()
.AutoWidth()
.Padding(2)
[
GenerateMethodButton(NSLOCTEXT("SymbolDebugger", "EngineVersionButton", "EngineVersion"), DebugMethod_EngineVersion)
]
+ SHorizontalBox::Slot()
.AutoWidth()
.Padding(2)
[
GenerateMethodButton(NSLOCTEXT("SymbolDebugger", "ChangelistButton", "Changelist"), DebugMethod_ChangeList)
]
+ SHorizontalBox::Slot()
.AutoWidth()
.Padding(2)
[
GenerateMethodButton(NSLOCTEXT("SymbolDebugger", "SourceLabelButton", "SourceLabel"), DebugMethod_SourceControlLabel)
];
}
TSharedRef<SWidget> SSymbolDebugger::GenerateMethodInputWidgets()
{
return
SNew(SHorizontalBox)
+ SHorizontalBox::Slot()
.Padding(2)
.FillWidth(1)
[
SNew(SEditableTextBox)
.Text(this, &SSymbolDebugger::OnGetMethodText)
.OnTextCommitted(this, &SSymbolDebugger::OnMethodTextCommited)
]
+ SHorizontalBox::Slot()
.AutoWidth()
.Padding(2)
[
SNew(SButton)
.Text(NSLOCTEXT("SymbolDebugger", "OpenFileButtonLabel", "..."))
.Visibility(this, &SSymbolDebugger::IsFileOpenVisible)
.OnClicked(this, &SSymbolDebugger::FileOpenClicked)
];
}
TSharedRef<SWidget> SSymbolDebugger::GenerateStatusWidgets()
{
return
SNew(SHorizontalBox)
+SHorizontalBox::Slot()
.FillWidth(.25)
.HAlign(HAlign_Right)
[
SNew(SCircularThrobber)
.Visibility( this, &SSymbolDebugger::AreStatusWidgetsVisible)
]
+ SHorizontalBox::Slot()
.Padding(2)
.FillWidth(.75)
[
SNew(SEditableTextBox)
.Text(this, &SSymbolDebugger::OnGetStatusText)
.IsEnabled(this, &SSymbolDebugger::IsStatusTextEnabled)
.Visibility(this, &SSymbolDebugger::AreStatusWidgetsVisible)
];
}
void SSymbolDebugger::Construct(const FArguments& InArgs)
{
// Default to crash dump
Delegate_OnGetCurrentMethod = InArgs._OnGetCurrentMethod;
Delegate_OnSetCurrentMethod = InArgs._OnSetCurrentMethod;
Delegate_OnFileOpen = InArgs._OnFileOpen;
Delegate_OnGetTextField = InArgs._OnGetTextField;
Delegate_OnSetTextField = InArgs._OnSetTextField;
Delegate_OnGetMethodText = InArgs._OnGetMethodText;
Delegate_OnSetMethodText = InArgs._OnSetMethodText;
Delegate_OnGetCurrentAction = InArgs._OnGetCurrentAction;
Delegate_IsActionEnabled = InArgs._IsActionEnabled;
Delegate_OnAction = InArgs._OnAction;
Delegate_OnGetStatusText = InArgs._OnGetStatusText;
Delegate_HasActionCompleted = InArgs._HasActionCompleted;
// All of these delegates are required for proper operation...
checkf(Delegate_OnGetCurrentMethod.IsBound(), TEXT("OnGetCurrentMethod must be bound!"));
checkf(Delegate_OnSetCurrentMethod.IsBound(), TEXT("OnSetCurrentMethod must be bound!"));
checkf(Delegate_OnFileOpen.IsBound(), TEXT("OnFileOpen must be bound!"));
checkf(Delegate_OnGetTextField.IsBound(), TEXT("OnGetTextField must be bound!"));
checkf(Delegate_OnSetTextField.IsBound(), TEXT("OnSetTextField must be bound!"));
checkf(Delegate_OnGetMethodText.IsBound(), TEXT("OnGetMethodText must be bound!"));
checkf(Delegate_OnSetMethodText.IsBound(), TEXT("OnSetMethodText must be bound!"));
checkf(Delegate_OnGetCurrentAction.IsBound(), TEXT("OnGetCurrentAction must be bound!"));
checkf(Delegate_IsActionEnabled.IsBound(), TEXT("IsActionEnabled must be bound!"));
checkf(Delegate_OnAction.IsBound(), TEXT("OnAction must be bound!"));
checkf(Delegate_OnGetStatusText.IsBound(), TEXT("OnGetStatusText must be bound!"));
checkf(Delegate_HasActionCompleted.IsBound(), TEXT("HasActionCompleted must be bound!"));
ChildSlot
[
SNew(SBorder)
.BorderImage(FCoreStyle::Get().GetBrush("ToolPanel.GroupBorder"))
[
SNew(SVerticalBox)
+ SVerticalBox::Slot()
.AutoHeight()
.Padding(2)
[
GenerateMethodButtons()
]
+ SVerticalBox::Slot()
.AutoHeight()
.Padding(2)
[
GenerateMethodInputWidgets()
]
+ SVerticalBox::Slot()
.AutoHeight()
.Padding(2)
[
GenerateLabelTextBoxPair(TextField_SymbolStore)
]
+ SVerticalBox::Slot()
.AutoHeight()
.Padding(2)
[
GenerateLabelTextBoxPair(TextField_SourceControlDepot)
]
+ SVerticalBox::Slot()
.AutoHeight()
.Padding(2)
[
GenerateLabelTextBoxPair(TextField_RemoteDebugIP)
]
+ SVerticalBox::Slot()
.AutoHeight()
.Padding(2)
[
GenerateLabelTextBoxPair(TextField_Platform)
]
+ SVerticalBox::Slot()
.AutoHeight()
.Padding(2)
[
GenerateLabelTextBoxPair(TextField_EngineVersion)
]
+ SVerticalBox::Slot()
.AutoHeight()
.Padding(2)
[
GenerateLabelTextBoxPair(TextField_ChangeList)
]
+ SVerticalBox::Slot()
.AutoHeight()
.Padding(2)
[
GenerateLabelTextBoxPair(TextField_Label)
]
+ SVerticalBox::Slot()
.AutoHeight()
.Padding(2)
.HAlign(HAlign_Center)
[
GenerateActionButtons()
]
+ SVerticalBox::Slot()
.AutoHeight()
.Padding(4)
.HAlign(HAlign_Center)
[
GenerateStatusWidgets()
]
]
];
}
SSymbolDebugger::ESymbolDebuggerMethods SSymbolDebugger::GetSymbolDebuggertMethod() const
{
return Delegate_OnGetCurrentMethod.Execute();
}
SSymbolDebugger::ESymbolDebuggerActions SSymbolDebugger::GetSymbolDebuggerAction() const
{
return Delegate_OnGetCurrentAction.Execute();
}
EVisibility SSymbolDebugger::IsFileOpenVisible() const
{
if (GetSymbolDebuggertMethod() == DebugMethod_CrashDump)
{
return EVisibility::Visible;
}
return EVisibility::Collapsed;
}
FReply SSymbolDebugger::FileOpenClicked()
{
if (Delegate_OnFileOpen.Execute(AsShared()) == true)
{
return FReply::Handled();
}
return FReply::Unhandled();
}
ECheckBoxState SSymbolDebugger::IsMethodChecked(ESymbolDebuggerMethods InMethod) const
{
if (GetSymbolDebuggertMethod() == InMethod)
{
return ECheckBoxState::Checked;
}
return ECheckBoxState::Unchecked;
}
void SSymbolDebugger::OnMethodChanged(ECheckBoxState InNewRadioState, ESymbolDebuggerMethods InMethodThatChanged)
{
if (InNewRadioState == ECheckBoxState::Checked)
{
Delegate_OnSetCurrentMethod.Execute(InMethodThatChanged);
}
}
bool SSymbolDebugger::IsTextEnabled(ESymbolDebuggerTextFields InTextField) const
{
bool bIsEnabled = false;
switch (InTextField)
{
case SSymbolDebugger::TextField_CrashDump:
case SSymbolDebugger::TextField_SymbolStore:
case SSymbolDebugger::TextField_Label:
case SSymbolDebugger::TextField_ChangeList:
case SSymbolDebugger::TextField_EngineVersion:
// Never enabled
break;
case SSymbolDebugger::TextField_SourceControlDepot:
case SSymbolDebugger::TextField_RemoteDebugIP:
// Always enabled
bIsEnabled = true;
break;
case SSymbolDebugger::TextField_Platform:
{
// Only enabled for EngineVersion, Changelist, and Label
if (GetSymbolDebuggertMethod() != SSymbolDebugger::DebugMethod_CrashDump)
{
bIsEnabled = true;
}
}
break;
}
return bIsEnabled;
}
EVisibility SSymbolDebugger::IsTextVisible(ESymbolDebuggerTextFields InTextField) const
{
// For now, just hide the remote IP.
if (InTextField == TextField_RemoteDebugIP)
{
return EVisibility::Collapsed;
}
return EVisibility::Visible;
}
FText SSymbolDebugger::OnGetText(ESymbolDebuggerTextFields InTextField) const
{
return FText::FromString( Delegate_OnGetTextField.Execute(InTextField) );
}
void SSymbolDebugger::OnTextCommited(const FText& InNewString, ETextCommit::Type /*InCommitInfo*/, ESymbolDebuggerTextFields InTextField)
{
Delegate_OnSetTextField.Execute(InTextField, InNewString.ToString());
}
FText SSymbolDebugger::OnGetMethodText() const
{
return FText::FromString( Delegate_OnGetMethodText.Execute() );
}
void SSymbolDebugger::OnMethodTextCommited(const FText& InNewString, ETextCommit::Type InCommitInfo)
{
Delegate_OnSetMethodText.Execute(InNewString.ToString());
}
bool SSymbolDebugger::IsActionEnabled(ESymbolDebuggerActions InAction) const
{
return Delegate_IsActionEnabled.Execute(InAction);
}
FReply SSymbolDebugger::OnActionClicked(ESymbolDebuggerActions InAction)
{
if (Delegate_OnAction.Execute(InAction) == true)
{
return FReply::Handled();
}
return FReply::Unhandled();
}
FReply SSymbolDebugger::OnDragOver(const FGeometry& MyGeometry, const FDragDropEvent& DragDropEvent)
{
if (GetSymbolDebuggerAction() == DebugAction_None)
{
TSharedPtr<FExternalDragOperation> DragDropOp = DragDropEvent.GetOperationAs<FExternalDragOperation>();
if (DragDropOp.IsValid())
{
if (DragDropOp->HasFiles())
{
if (DragDropOp->GetFiles().Num() == 1)
{
return FReply::Handled();
}
}
}
}
return FReply::Unhandled();
}
FReply SSymbolDebugger::OnDrop(const FGeometry& MyGeometry, const FDragDropEvent& DragDropEvent)
{
if (GetSymbolDebuggerAction() == DebugAction_None)
{
// Handle drag drop for import
TSharedPtr<FExternalDragOperation> DragDropOp = DragDropEvent.GetOperationAs<FExternalDragOperation>();
if (DragDropOp.IsValid())
{
if (DragDropOp->HasFiles())
{
// Set the current method to CrashDump as that is the only thing we support dropping for
Delegate_OnSetCurrentMethod.Execute(DebugMethod_CrashDump);
// Get the file
const TArray<FString>& DroppedFiles = DragDropOp->GetFiles();
// For now, only allow a single file.
for (int32 FileIdx = 0; FileIdx < 1/*DroppedFiles.Num()*/; FileIdx++)
{
FString DroppedFile = DroppedFiles[FileIdx];
// Set the crash dump name
Delegate_OnSetMethodText.Execute(DroppedFile);
// Launch the process action
if (Delegate_OnAction.Execute(DebugAction_Process) == true)
{
return FReply::Handled();
}
}
}
}
}
return FReply::Unhandled();
}
EVisibility SSymbolDebugger::AreStatusWidgetsVisible() const
{
if (GetSymbolDebuggerAction() != DebugAction_None)
{
return EVisibility::Visible;
}
return EVisibility::Hidden;
}
FText SSymbolDebugger::OnGetStatusText() const
{
return FText::FromString( *Delegate_OnGetStatusText.Execute() );
}
bool SSymbolDebugger::IsStatusTextEnabled() const
{
return false;
}
| [
"dkroell@acm.org"
] | dkroell@acm.org |
046ba30136ec12f296a16758564f56d01ae3dd14 | bdb2c1cc4f18c541a2b556ed61b9c09320a27329 | /CodeChef_Beginner/October/Simple_Factorial.cpp | af8d3c7fc24617bae950630d3774ed7bf41a1b6f | [] | no_license | ajoel24/CPwithCPP | 81c18c301248d5542cd75ca4c03440e8896676a9 | fd98fb9d98a0fe516234328672a39df8414e59f3 | refs/heads/master | 2022-03-06T08:19:50.559876 | 2019-11-14T14:32:12 | 2019-11-14T14:32:12 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 360 | cpp | /*
Link for this problem:
https://www.codechef.com/problems/FCTRL2
*/
#include<bits\stdc++.h>
using namespace std;
double fact(double n) {
return ((n == 0 || n == 1) ? 1 : (n * fact(n - 1)));
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
double n, a;
cin >> n;
while(n--) {
cin >> a;
printf("%.0f\n", fact(a));
}
return 0;
}
| [
"drew.devops@gmail.com"
] | drew.devops@gmail.com |
398054295159a1fdf5764deeca6d9dfddf2dd28e | a4a2afa8a2f355714d2498a6c67b067edcf18c2b | /Button.cpp | f5130ec5020dd83f921690975319be6db5f892ac | [] | no_license | michaelslec/Minesweeper | 64dd3ccf892e50a2cd4ee290f93332bdc71506b9 | 342544246096f36722431bc63875a510f9c7453e | refs/heads/main | 2023-02-16T04:05:30.240053 | 2020-12-23T21:30:38 | 2020-12-23T21:30:38 | 324,004,256 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 590 | cpp | #include "Button.h"
Button::Button(float xOffset, sf::Texture& texture)
{
// texture, position, size
this->setTexture(&texture);
this->setPosition(xOffset * 32, this->height);
this->setSize(sf::Vector2f(this->size, this->size));
this->calcCoords(xOffset);
}
void Button::calcCoords(float xOffset) {
this->xMin = static_cast<int>(xOffset * 32.0f);
this->xMax = this->xMin + this->size;
this->yMin = this->height;
this->yMax = this->yMin + this->size;
}
bool Button::isClicked(int x, int y)
{
return x >= xMin && x < xMax && y > yMin && y <= yMax;
} | [
"michaelslec98@gmail.com"
] | michaelslec98@gmail.com |
17ee1be319b5c4a58034547a826988cff0b8239c | 90babff107bb2668750ea695ad7e6573c8cddfda | /B3/container.hpp | 7952211dd7e089e6daf613da0a46af42392cc7cd | [] | no_license | sodafago/Programming-technology-labs | 175006cdcd0466481830d196cb7d1ebcea46d3a7 | b973460e5014689f643bbea1255f33468162e7a4 | refs/heads/main | 2023-08-03T14:27:32.760923 | 2021-09-22T09:00:44 | 2021-09-22T09:00:44 | 409,130,702 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,003 | hpp | #ifndef __CONTAINER_HPP__
#define __CONTAINER_HPP__
#include <iterator>
class Container
{
public:
class Iterator;
static Iterator begin() noexcept;
static Iterator end() noexcept;
private:
static size_t BEGIN_VAL;
static size_t END_VAL;
};
class Container::Iterator : public std::iterator<std::bidirectional_iterator_tag, size_t>
{
public:
size_t& operator*() const noexcept;
size_t* operator->() const noexcept;
Iterator& operator++() noexcept;
Iterator operator++(int) & noexcept;
Iterator& operator--() noexcept;
Iterator operator--(int) & noexcept;
bool operator==(const Iterator& right) const noexcept;
bool operator!=(const Iterator& right) const noexcept;
private:
friend Iterator Container::begin() noexcept;
friend Iterator Container::end() noexcept;
size_t nFactNow_;
size_t valFactNow_;
explicit Iterator(size_t nFact) noexcept;
Iterator(size_t nFactNow, size_t valFactNow);
static size_t getFact_(size_t nFact) noexcept;
};
#endif
| [
"78441035+sodafago@users.noreply.github.com"
] | 78441035+sodafago@users.noreply.github.com |
e3c7e21ff1e3d0a2a1c2b45f9d34e976ecedbb7b | 0315e5e5cd83a74d665ea718b0420f56d344fe98 | /src/qt/rpcconsole.cpp | 7a571f393500e5652c2304fd37a50ac547787fab | [
"MIT"
] | permissive | botanik26rus/donatecoin | 5de5c2eec9b7961166a73445bd5d556d22ea1c47 | 51232688c04b6c284c6aae8380bfeafacb85d7f6 | refs/heads/master | 2021-08-31T09:15:59.155061 | 2017-12-20T22:02:07 | 2017-12-20T22:02:07 | 114,866,116 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 10,288 | cpp | #include "rpcconsole.h"
#include "ui_rpcconsole.h"
#include "clientmodel.h"
#include "bitcoinrpc.h"
#include "guiutil.h"
#include <QTime>
#include <QTimer>
#include <QThread>
#include <QTextEdit>
#include <QKeyEvent>
#include <QUrl>
#include <QScrollBar>
#include <boost/tokenizer.hpp>
#include <openssl/crypto.h>
// TODO: make it possible to filter out categories (esp debug messages when implemented)
// TODO: receive errors and debug messages through ClientModel
const int CONSOLE_SCROLLBACK = 50;
const int CONSOLE_HISTORY = 50;
const QSize ICON_SIZE(24, 24);
const struct {
const char *url;
const char *source;
} ICON_MAPPING[] = {
{"cmd-request", ":/icons/tx_input"},
{"cmd-reply", ":/icons/tx_output"},
{"cmd-error", ":/icons/tx_output"},
{"misc", ":/icons/tx_inout"},
{NULL, NULL}
};
/* Object for executing console RPC commands in a separate thread.
*/
class RPCExecutor: public QObject
{
Q_OBJECT
public slots:
void start();
void request(const QString &command);
signals:
void reply(int category, const QString &command);
};
#include "rpcconsole.moc"
void RPCExecutor::start()
{
// Nothing to do
}
void RPCExecutor::request(const QString &command)
{
// Parse shell-like command line into separate arguments
std::string strMethod;
std::vector<std::string> strParams;
try {
boost::escaped_list_separator<char> els('\\',' ','\"');
std::string strCommand = command.toStdString();
boost::tokenizer<boost::escaped_list_separator<char> > tok(strCommand, els);
int n = 0;
for(boost::tokenizer<boost::escaped_list_separator<char> >::iterator beg=tok.begin(); beg!=tok.end();++beg,++n)
{
if(n == 0) // First parameter is the command
strMethod = *beg;
else
strParams.push_back(*beg);
}
}
catch(boost::escaped_list_error &e)
{
emit reply(RPCConsole::CMD_ERROR, QString("Parse error"));
return;
}
try {
std::string strPrint;
json_spirit::Value result = tableRPC.execute(strMethod, RPCConvertValues(strMethod, strParams));
// Format result reply
if (result.type() == json_spirit::null_type)
strPrint = "";
else if (result.type() == json_spirit::str_type)
strPrint = result.get_str();
else
strPrint = write_string(result, true);
emit reply(RPCConsole::CMD_REPLY, QString::fromStdString(strPrint));
}
catch (json_spirit::Object& objError)
{
emit reply(RPCConsole::CMD_ERROR, QString::fromStdString(write_string(json_spirit::Value(objError), false)));
}
catch (std::exception& e)
{
emit reply(RPCConsole::CMD_ERROR, QString("Error: ") + QString::fromStdString(e.what()));
}
}
RPCConsole::RPCConsole(QWidget *parent) :
QDialog(parent),
ui(new Ui::RPCConsole),
historyPtr(0)
{
ui->setupUi(this);
#ifndef Q_WS_MAC
ui->openDebugLogfileButton->setIcon(QIcon(":/icons/export"));
ui->showCLOptionsButton->setIcon(QIcon(":/icons/options"));
#endif
// Install event filter for up and down arrow
ui->lineEdit->installEventFilter(this);
connect(ui->clearButton, SIGNAL(clicked()), this, SLOT(clear()));
// set OpenSSL version label
ui->openSSLVersion->setText(SSLeay_version(SSLEAY_VERSION));
startExecutor();
clear();
}
RPCConsole::~RPCConsole()
{
emit stopExecutor();
delete ui;
}
bool RPCConsole::eventFilter(QObject* obj, QEvent *event)
{
if(obj == ui->lineEdit)
{
if(event->type() == QEvent::KeyPress)
{
QKeyEvent *key = static_cast<QKeyEvent*>(event);
switch(key->key())
{
case Qt::Key_Up: browseHistory(-1); return true;
case Qt::Key_Down: browseHistory(1); return true;
}
}
}
return QDialog::eventFilter(obj, event);
}
void RPCConsole::setClientModel(ClientModel *model)
{
this->clientModel = model;
if(model)
{
// Subscribe to information, replies, messages, errors
connect(model, SIGNAL(numConnectionsChanged(int)), this, SLOT(setNumConnections(int)));
connect(model, SIGNAL(numBlocksChanged(int,int)), this, SLOT(setNumBlocks(int,int)));
// Provide initial values
ui->clientVersion->setText(model->formatFullVersion());
ui->clientName->setText(model->clientName());
ui->buildDate->setText(model->formatBuildDate());
ui->startupTime->setText(model->formatClientStartupTime());
setNumConnections(model->getNumConnections());
ui->isTestNet->setChecked(model->isTestNet());
setNumBlocks(model->getNumBlocks(), model->getNumBlocksOfPeers());
}
}
static QString categoryClass(int category)
{
switch(category)
{
case RPCConsole::CMD_REQUEST: return "cmd-request"; break;
case RPCConsole::CMD_REPLY: return "cmd-reply"; break;
case RPCConsole::CMD_ERROR: return "cmd-error"; break;
default: return "misc";
}
}
void RPCConsole::clear()
{
ui->messagesWidget->clear();
ui->lineEdit->clear();
ui->lineEdit->setFocus();
// Add smoothly scaled icon images.
// (when using width/height on an img, Qt uses nearest instead of linear interpolation)
for(int i=0; ICON_MAPPING[i].url; ++i)
{
ui->messagesWidget->document()->addResource(
QTextDocument::ImageResource,
QUrl(ICON_MAPPING[i].url),
QImage(ICON_MAPPING[i].source).scaled(ICON_SIZE, Qt::IgnoreAspectRatio, Qt::SmoothTransformation));
}
// Set default style sheet
ui->messagesWidget->document()->setDefaultStyleSheet(
"table { }"
"td.time { color: #808080; padding-top: 3px; } "
"td.message { font-family: Monospace; font-size: 12px; } "
"td.cmd-request { color: #006060; } "
"td.cmd-error { color: red; } "
"b { color: #006060; } "
);
message(CMD_REPLY, (tr("Welcome to the DonateCoin RPC console.") + "<br>" +
tr("Use up and down arrows to navigate history, and <b>Ctrl-L</b> to clear screen.") + "<br>" +
tr("Type <b>help</b> for an overview of available commands.")), true);
}
void RPCConsole::message(int category, const QString &message, bool html)
{
QTime time = QTime::currentTime();
QString timeString = time.toString();
QString out;
out += "<table><tr><td class=\"time\" width=\"65\">" + timeString + "</td>";
out += "<td class=\"icon\" width=\"32\"><img src=\"" + categoryClass(category) + "\"></td>";
out += "<td class=\"message " + categoryClass(category) + "\" valign=\"middle\">";
if(html)
out += message;
else
out += GUIUtil::HtmlEscape(message, true);
out += "</td></tr></table>";
ui->messagesWidget->append(out);
}
void RPCConsole::setNumConnections(int count)
{
ui->numberOfConnections->setText(QString::number(count));
}
void RPCConsole::setNumBlocks(int count, int countOfPeers)
{
ui->numberOfBlocks->setText(QString::number(count));
ui->totalBlocks->setText(QString::number(countOfPeers));
if(clientModel)
{
// If there is no current number available display N/A instead of 0, which can't ever be true
ui->totalBlocks->setText(clientModel->getNumBlocksOfPeers() == 0 ? tr("N/A") : QString::number(clientModel->getNumBlocksOfPeers()));
ui->lastBlockTime->setText(clientModel->getLastBlockDate().toString());
}
}
void RPCConsole::on_lineEdit_returnPressed()
{
QString cmd = ui->lineEdit->text();
ui->lineEdit->clear();
if(!cmd.isEmpty())
{
message(CMD_REQUEST, cmd);
emit cmdRequest(cmd);
// Truncate history from current position
history.erase(history.begin() + historyPtr, history.end());
// Append command to history
history.append(cmd);
// Enforce maximum history size
while(history.size() > CONSOLE_HISTORY)
history.removeFirst();
// Set pointer to end of history
historyPtr = history.size();
// Scroll console view to end
scrollToEnd();
}
}
void RPCConsole::browseHistory(int offset)
{
historyPtr += offset;
if(historyPtr < 0)
historyPtr = 0;
if(historyPtr > history.size())
historyPtr = history.size();
QString cmd;
if(historyPtr < history.size())
cmd = history.at(historyPtr);
ui->lineEdit->setText(cmd);
}
void RPCConsole::startExecutor()
{
QThread* thread = new QThread;
RPCExecutor *executor = new RPCExecutor();
executor->moveToThread(thread);
// Notify executor when thread started (in executor thread)
connect(thread, SIGNAL(started()), executor, SLOT(start()));
// Replies from executor object must go to this object
connect(executor, SIGNAL(reply(int,QString)), this, SLOT(message(int,QString)));
// Requests from this object must go to executor
connect(this, SIGNAL(cmdRequest(QString)), executor, SLOT(request(QString)));
// On stopExecutor signal
// - queue executor for deletion (in execution thread)
// - quit the Qt event loop in the execution thread
connect(this, SIGNAL(stopExecutor()), executor, SLOT(deleteLater()));
connect(this, SIGNAL(stopExecutor()), thread, SLOT(quit()));
// Queue the thread for deletion (in this thread) when it is finished
connect(thread, SIGNAL(finished()), thread, SLOT(deleteLater()));
// Default implementation of QThread::run() simply spins up an event loop in the thread,
// which is what we want.
thread->start();
}
void RPCConsole::on_tabWidget_currentChanged(int index)
{
if(ui->tabWidget->widget(index) == ui->tab_console)
{
ui->lineEdit->setFocus();
}
}
void RPCConsole::on_openDebugLogfileButton_clicked()
{
GUIUtil::openDebugLogfile();
}
void RPCConsole::scrollToEnd()
{
QScrollBar *scrollbar = ui->messagesWidget->verticalScrollBar();
scrollbar->setValue(scrollbar->maximum());
}
void RPCConsole::on_showCLOptionsButton_clicked()
{
GUIUtil::HelpMessageBox help;
help.exec();
}
| [
"botanik@antilam.ru"
] | botanik@antilam.ru |
aadb30703f21db0658bbdedd0c13bcb54bf36f5d | fe413f8747ddddc011f4dd6783cc084881da870a | /Code/application/Model/.svn/text-base/FileDescriptorImp.h.svn-base | 382d30ed511d1635c7ae2f10c2ced54f17450e3c | [] | no_license | GRSEB9S/opticks-cmake | f070b7ee32e5fff03de673c178cd6894113bc50b | 497f89ccbcbf50c83304606eb586302eec3e6651 | refs/heads/master | 2021-05-27T08:16:26.027755 | 2011-08-13T06:03:04 | 2011-08-13T06:03:04 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,657 | /*
* The information in this file is
* Copyright(c) 2007 Ball Aerospace & Technologies Corporation
* and is subject to the terms and conditions of the
* GNU Lesser General Public License Version 2.1
* The license text is available from
* http://www.gnu.org/licenses/lgpl.html
*/
#ifndef FILEDESCRIPTORIMP_H
#define FILEDESCRIPTORIMP_H
#include "FilenameImp.h"
#include "SerializableImp.h"
#include "SubjectImp.h"
#include "TypesFile.h"
#include "xmlreader.h"
#include "xmlwriter.h"
#include <string>
class FileDescriptorImp : public SubjectImp, public Serializable
{
public:
FileDescriptorImp();
virtual ~FileDescriptorImp();
FileDescriptorImp& operator =(const FileDescriptorImp& descriptor);
void setFilename(const std::string& filename);
void setFilename(const Filename& filename);
const Filename& getFilename() const;
void setDatasetLocation(const std::string& datasetLocation);
const std::string& getDatasetLocation() const;
void setEndian(EndianType endian);
EndianType getEndian() const;
virtual void addToMessageLog(Message* pMessage) const;
virtual bool toXml(XMLWriter* pXml) const;
virtual bool fromXml(DOMNode* pDocument, unsigned int version);
const std::string& getObjectType() const;
bool isKindOf(const std::string& className) const;
static void getFileDescriptorTypes(std::vector<std::string>& classList);
static bool isKindOfFileDescriptor(const std::string& className);
private:
FilenameImp mFilename;
std::string mDatasetLocation;
EndianType mEndian;
};
#define FILEDESCRIPTORADAPTEREXTENSION_CLASSES \
SUBJECTADAPTEREXTENSION_CLASSES \
SERIALIZABLEADAPTEREXTENSION_CLASSES
#define FILEDESCRIPTORADAPTER_METHODS(impClass) \
SUBJECTADAPTER_METHODS(impClass) \
SERIALIZABLEADAPTER_METHODS(impClass) \
void setFilename(const std::string& filename) \
{ \
impClass::setFilename(filename); \
} \
void setFilename(const Filename& filename) \
{ \
impClass::setFilename(filename); \
} \
const Filename& getFilename() const \
{ \
return impClass::getFilename(); \
} \
void setDatasetLocation(const std::string& datasetLocation) \
{ \
impClass::setDatasetLocation(datasetLocation); \
} \
const std::string& getDatasetLocation() const \
{ \
return impClass::getDatasetLocation(); \
} \
void setEndian(EndianType endian) \
{ \
impClass::setEndian(endian); \
} \
EndianType getEndian() const \
{ \
return impClass::getEndian(); \
} \
void addToMessageLog(Message* pMessage) const \
{ \
impClass::addToMessageLog(pMessage); \
}
#endif
| [
"wzssyqa@gmail.com"
] | wzssyqa@gmail.com | |
a3f0c340ed0a39e60c728d7fef468623ddcbba68 | a33aac97878b2cb15677be26e308cbc46e2862d2 | /program_data/PKU_raw/69/332.c | 1311b718ded853e522c4322246a9ac704534c1e2 | [] | no_license | GabeOchieng/ggnn.tensorflow | f5d7d0bca52258336fc12c9de6ae38223f28f786 | 7c62c0e8427bea6c8bec2cebf157b6f1ea70a213 | refs/heads/master | 2022-05-30T11:17:42.278048 | 2020-05-02T11:33:31 | 2020-05-02T11:33:31 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 574 | c |
int main()
{
char a1[251],a2[251];
int b1[251],b2[251];
memset(b1,0,sizeof(b1));
memset(b2,0,sizeof(b2));
cin.getline(a1,251);
cin.getline(a2,251);
int l1=strlen(a1),l2=strlen(a2);
int i,j;
for(i=0,j=l1-1;j>=0;i++,j--)
b1[i]=a1[j]-'0';
for(i=0,j=l2-1;j>=0;i++,j--)
b2[i]=a2[j]-'0';
for(i=0;i<=250;i++)
{
b1[i]+=b2[i];
if(b1[i]>=10)
{
b1[i]=b1[i]%10;
b1[i+1]++;
}
}
i=250;
while(b1[i]==0)
{
i--;
if(i==0)
break;
}
for(;i>=0;i--)
cout << b1[i];
cout << endl;
return 0;
}
| [
"bdqnghi@gmail.com"
] | bdqnghi@gmail.com |
27d1f136963b2c350078f15234655cbd3cae975f | 4de6a4972a4da9b5bc3d0d776c529047423f3dab | /Common/src/MapController.cpp | bbef9d829eb6ceb89f79ff5dd2d90a59fdafce6e | [] | no_license | YaskOne/R-Type | ad6a3ac331b8391521521bbe6f2c873f61a434a4 | 7eb873203d350207e5d2efacc3dd81033f374caf | refs/heads/master | 2020-12-24T19:37:13.678440 | 2016-04-12T15:53:33 | 2016-04-12T15:53:33 | 56,076,831 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,733 | cpp | #include <iostream>
#include <algorithm>
#include "MapController.hh"
#include "ObjectInfo.hpp"
#include "Alien.hh"
#include "Player.hh"
unsigned int _maxId;
MapController::MapController()
: _deserializedMap(new std::vector<IServerPacket<ServerUDPResponse>*>)
{
_alienCount = 0;
}
MapController::~MapController()
{
delete _deserializedMap;
}
void MapController::generatePacketsMap(IObject* player)
{
for (std::vector<IObject*>::iterator it = _map.begin(); it != _map.end(); ++it)
{
if (*it == player)
continue ;
switch ((*it)->getObjType())
{
case ObjectInfo::PLAYER :
_deserializedMap->push_back(new CrePlayPacket(CRE_PLAY, 0, (*it)->getId(), (*it)->getPos().x + (*it)->getSize().x, (*it)->getPos().y));
break ;
case ObjectInfo::SHOT :
if (static_cast<Projectile*>(*it)->getRealType() == ObjectInfo::PLAYERREGULAR)
{
_deserializedMap->push_back(new CreObjPacket(CRE_OBJ, 0, (*it)->getId(), (*it)->getPos().x, (*it)->getPos().y, (*it)->getSpeed().x, (*it)->getSpeed().y, ObjectInfo::PLAYERREGULAR));
}
else
{
_deserializedMap->push_back(new CreObjPacket(CRE_OBJ, 0, (*it)->getId(), (*it)->getPos().x, (*it)->getPos().y, (*it)->getSpeed().x, (*it)->getSpeed().y, ObjectInfo::ALIENREGULAR));
}
break ;
case ObjectInfo::BYDO || ObjectInfo::GLAM || ObjectInfo::DOKAN || ObjectInfo::KAYBEROS || ObjectInfo::RIOS || ObjectInfo::SCANT || ObjectInfo::SHELL || ObjectInfo::YORK || ObjectInfo::XELF16 :
_deserializedMap->push_back(new CreIAPacket(CRE_IA, 0, (*it)->getId(), (*it)->getPos().x, (*it)->getPos().y, (*it)->getSpeed().x, static_cast<Alien*>((*it))->getCoeff(), static_cast<Alien*>((*it))->getRealType()));
break ;
default :
break ;
}
}
}
std::vector<IServerPacket<ServerUDPResponse>*>* MapController::getMap() const
{
return _deserializedMap;
}
void MapController::addObject(IObject* obj)
{
_map.push_back(obj);
}
void MapController::addAlien(IObject* obj)
{
if (static_cast<Alien*>(obj)->getRealType() != ObjectInfo::OBSTACLE)
{
if (_alienCount == -1)
_alienCount = 1;
else
_alienCount += 1;
}
_map.push_back(obj);
}
void MapController::resetClockPlayer()
{
for (auto it = _map.begin(); it != _map.end(); ++it)
if ((*it)->getObjType() == ObjectInfo::PLAYER)
static_cast<Player*>(*it)->resetLoopTime();
}
void MapController::updateMap(sf::Clock const& clock)
{
auto it = _map.begin();
_toAppend.clear();
_deserializedMap->clear();
while (it != _map.end())
{
(*it)->update(clock, _map);
++it;
}
it = _map.begin();
while (it != _map.end())
{
checkNewObj(it, (*it));
if (it == _map.end())
break;
++it;
}
_map.insert(std::end(_map), std::begin(_toAppend), std::end(_toAppend));
}
void MapController::checkNewObj(std::vector<IObject*>::iterator& it, IObject* obj)
{
if (obj->isShooting())
{
obj->setShooting(false);
if (obj->getObjType() == ObjectInfo::PLAYER)
{
std::vector<IObject*> *shots = static_cast<Player*>(obj)->MultiShoot();
IObject* shot;
while (!shots->empty())
{
shot = shots->back();
shots->pop_back();
_toAppend.push_back(shot);
_deserializedMap->push_back(new CreObjPacket(CRE_OBJ, 0, _maxId - 1, shot->getPos().x, shot->getPos().y, shot->getSpeed().x, shot->getSpeed().y, ObjectInfo::PLAYERREGULAR));
}
delete shots;
}
if (obj->getObjType() == ObjectInfo::ALIEN)
{
IObject* shot = static_cast<Alien*>(obj)->BasicShoot();
_toAppend.push_back(shot);
_deserializedMap->push_back(new CreObjPacket(CRE_OBJ, 0, _maxId - 1, shot->getPos().x, shot->getPos().y, shot->getSpeed().x, shot->getSpeed().y, ObjectInfo::ALIENREGULAR));
}
}
if (!obj->isAlive())
{
if (obj->getObjType() == ObjectInfo::ALIEN
&& static_cast<Alien*>(obj)->getRealType() != ObjectInfo::OBSTACLE)
_alienCount -= 1;
_deserializedMap->push_back(new DelItemPacket(DEL_ITEM, 0, obj->getId()));
this->deletePlayer(obj->getId());
}
}
void MapController::updatePlayer(IObject* player, sf::Clock const& clock)
{
player->update(clock, _map);
}
IObject* MapController::getPlayer(int id)
{
if (id == -1)
return NULL;
for (std::vector<IObject*>::iterator it = _map.begin(); it != _map.end(); ++it)
{
if ((*it)->getId() == id)
return (*it);
}
return NULL;
}
void MapController::deletePlayer(int id)
{
IObject* player = this->getPlayer(id);
if (player == NULL)
return ;
_map.erase(std::find(_map.begin(), _map.end(), player));
delete (player);
}
int MapController::getAlienCount() const
{
return _alienCount;
}
| [
"ngo-va_a@epitech.eu"
] | ngo-va_a@epitech.eu |
5d6730aa63583805f7a495439f9cc3a8d3946950 | 99293a5098087565587e5b6904c240837f1aa33a | /17-8-13/1.cpp | 38e15b7e70bfe8324d2081ad17429d8e6bb35a70 | [] | no_license | 3013216006/ACM | 1a97b571a0d464c27733ed6660438e55c7085d6a | bd37587e9a079a0ade0c6fc29b8d522eb39f8973 | refs/heads/master | 2020-05-21T14:32:43.810301 | 2017-08-24T13:23:03 | 2017-08-24T13:23:03 | 84,624,689 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 583 | cpp | #include <iostream>
#include <stdio.h>
using namespace std;
long long mod=1000000007ll;
long long a[1010],inv[1010];
long long getpow(long long x,long long k){
long long ret=1;
while(k){
if(k&1) ret=ret*x%mod;
x=x*x%mod;
k>>=1;
}
return ret;
}
void init(){
a[0]=1;
inv[0]=1;
for(int i=1;i<=1000;i++){
a[i]=a[i-1]*i;
a[i]%=mod;
inv[i]=getpow(a[i],mod-2);
}
}
int main(){
init();
int T;
int n,m;
scanf("%d",&T);
while(T--){
scanf("%d%d",&n,&m);
if(n<m) swap(n,m);
long long ans=a[n];
ans=ans*inv[m]%mod*inv[n-m]%mod;
printf("%lld\n",ans);
}
}
| [
"fuxuzhoude@126.com"
] | fuxuzhoude@126.com |
21aa0a0a967a01e15dd9291b71d6bd992d51843d | 1ab7b3f2aa63de8488ce7c466a67d367771aa1f2 | /Ricardo_OS/Ricardo_OS/lib/ArduinoJson-6.x/extras/tests/Numbers/parseInteger.cpp | fb2ed3db658bb319636f72c406cb42ecc6b8a67d | [
"MIT"
] | permissive | icl-rocketry/Avionics | 9d39aeb11aba11115826fd73357b415026a7adad | 95b7a061eabd6f2b607fba79e007186030f02720 | refs/heads/master | 2022-07-30T07:54:10.642930 | 2022-07-10T12:19:10 | 2022-07-10T12:19:10 | 216,184,670 | 9 | 1 | MIT | 2022-06-27T10:17:06 | 2019-10-19T09:57:07 | C++ | UTF-8 | C++ | false | false | 2,101 | cpp | // ArduinoJson - arduinojson.org
// Copyright Benoit Blanchon 2014-2021
// MIT License
#include <stdint.h>
#include <ArduinoJson/Numbers/parseNumber.hpp>
#include <ArduinoJson/Variant/VariantImpl.hpp>
#include <catch.hpp>
using namespace ARDUINOJSON_NAMESPACE;
template <typename T>
void checkInteger(const char* input, T expected) {
CAPTURE(input);
T actual = parseNumber<T>(input);
REQUIRE(expected == actual);
}
TEST_CASE("parseNumber<int8_t>()") {
checkInteger<int8_t>("-128", -128);
checkInteger<int8_t>("127", 127);
checkInteger<int8_t>("+127", 127);
checkInteger<int8_t>("3.14", 3);
checkInteger<int8_t>("x42", 0);
checkInteger<int8_t>("128", 0); // overflow
checkInteger<int8_t>("-129", 0); // overflow
}
TEST_CASE("parseNumber<int16_t>()") {
checkInteger<int16_t>("-32768", -32768);
checkInteger<int16_t>("32767", 32767);
checkInteger<int16_t>("+32767", 32767);
checkInteger<int16_t>("3.14", 3);
checkInteger<int16_t>("x42", 0);
checkInteger<int16_t>("-32769", 0); // overflow
checkInteger<int16_t>("32768", 0); // overflow
}
TEST_CASE("parseNumber<int32_t>()") {
checkInteger<int32_t>("-2147483648", (-2147483647 - 1));
checkInteger<int32_t>("2147483647", 2147483647);
checkInteger<int32_t>("+2147483647", 2147483647);
checkInteger<int32_t>("3.14", 3);
checkInteger<int32_t>("x42", 0);
checkInteger<int32_t>("-2147483649", 0); // overflow
checkInteger<int32_t>("2147483648", 0); // overflow
}
TEST_CASE("parseNumber<uint8_t>()") {
checkInteger<uint8_t>("0", 0);
checkInteger<uint8_t>("255", 255);
checkInteger<uint8_t>("+255", 255);
checkInteger<uint8_t>("3.14", 3);
checkInteger<uint8_t>("x42", 0);
checkInteger<uint8_t>("-1", 0);
checkInteger<uint8_t>("256", 0);
}
TEST_CASE("parseNumber<uint16_t>()") {
checkInteger<uint16_t>("0", 0);
checkInteger<uint16_t>("65535", 65535);
checkInteger<uint16_t>("+65535", 65535);
checkInteger<uint16_t>("3.14", 3);
// checkInteger<uint16_t>(" 42", 0);
checkInteger<uint16_t>("x42", 0);
checkInteger<uint16_t>("-1", 0);
checkInteger<uint16_t>("65536", 0);
}
| [
"kiran@MacBook-Pro-3.local"
] | kiran@MacBook-Pro-3.local |
78f5c463c662473cc5cb9b6e3d885d3d8f1b4a61 | d282643600d8c1b1e72b130991786d299000458b | /src/environment.cpp | 54ab03647dfeb5590b419ce3b74e75ec6f8667b1 | [] | no_license | dzz/nldproc | d5b6b4bb2dc66713bb0905f49dbcdb7fe2383734 | 58526bdc65d13c29846dd5881a4beb26601e48eb | refs/heads/master | 2021-01-22T22:21:07.756500 | 2017-04-21T23:44:59 | 2017-04-21T23:44:59 | 85,534,934 | 0 | 1 | null | 2017-04-25T22:30:05 | 2017-03-20T04:21:38 | C++ | UTF-8 | C++ | false | false | 3,873 | cpp | #include "environment.h"
#include <fstream>
#include <chrono>
#include <iostream>
#include <vector>
#include <algorithm>
#include "processor.h"
using namespace std::chrono;
namespace nldproc {
const unsigned int CALIBRATION_SECS = 1;
static std::vector<processor*> calibration_reqs;
static high_resolution_clock::time_point implicit_time_start;
static high_resolution_clock::time_point implicit_time_end;
static double test_environment_length;
static os_factor active_oversampling = 1;
static samplerate active_base_samplerate = 44100;
static buffer_chunksize active_base_chunksize = 44100 * 2;
void environment::enter_implicit_time() {
implicit_time_start = std::chrono::high_resolution_clock::now();
}
void environment::register_calibration_req( deferred_processor instance ) {
std::cout<<"REGISTERING :"<<instance<<"\n";
calibration_reqs.push_back( (processor*)instance );
}
void environment::calibrate_processors() {
std::cout<<" [ calibrating ... ]\n";
std::for_each( calibration_reqs.begin(),
calibration_reqs.end(),
[]( auto processor ) {
std::cout<<" ->"<<processor<<"\n";
processor->calibrate();
});
}
void environment::exit_implicit_time() {
implicit_time_end = std::chrono::high_resolution_clock::now();
}
void environment::calibrate() {
buffer_chunksize tmp = active_base_chunksize;
active_base_chunksize = active_base_samplerate * CALIBRATION_SECS;
environment::calibrate_processors();
active_base_chunksize = tmp;
}
void environment::configure_test_environment(int_frequency samplerate, buffer_chunksize length ) {
active_base_samplerate = samplerate;
active_base_chunksize = length;
test_environment_length = (double)length/(double)samplerate;
}
samplerate environment::get_base_samplerate() {
return active_base_samplerate;
}
samplerate environment::get_samplerate() {
return environment::get_base_samplerate() * active_oversampling;
}
buffer_chunksize environment::get_base_buffer_chunksize() {
return active_base_chunksize;
}
buffer_chunksize environment::get_buffer_chunksize() {
return environment::get_base_buffer_chunksize() * active_oversampling;
}
void environment::write_filename_to_file( filename name, filename output_file ) {
std::ofstream file( output_file );
file << name;
file.close();
}
void environment::write_samplerate_to_file( filename output_file ) {
std::ofstream file( output_file );
file << environment::get_samplerate();
file.close();
}
void environment::write_to_file( filename output_file ) {
std::ofstream file( output_file );
file << environment::get_samplerate();
file.close();
}
void environment::write_fft_limits_to_file( filename name, double min, double max ) {
std::ofstream file( name );
file << min << "\n" << max << "\n";
file.close();
}
void environment::write_implicit_time_to_file( filename name ) {
duration<double> time_span = duration_cast<duration<double>>(implicit_time_end - implicit_time_start);
std::cout << "It took me " << time_span.count() << " seconds." << std::endl;
std::ofstream file( name );
file << time_span.count() <<" "<<test_environment_length;
file.close();
}
void environment::set_oversampling(os_factor amount) {
active_oversampling = amount;
}
os_factor environment::get_oversampling() {
return active_oversampling;
}
}
| [
"devon.zachary@gmail.com"
] | devon.zachary@gmail.com |
9b3bf9eea83745046caee98eb04be6dc2b769cfd | 5d03cff841c4168edd300f800b77d385811ae9f2 | /GDESAddFunc/GDESAddFunc_DllMain.cpp | b0a53d1ccc0a9a0d901791e7d7e2036487a56d57 | [] | no_license | isliulin/GDES | d08e0ae0d8c85e9acac6cc6b297b5d4f366a3f10 | 0fa2e36c4b50a71fa778bd4f706ab3a0a4805d0d | refs/heads/master | 2023-03-18T05:14:31.476205 | 2015-11-04T09:06:34 | 2015-11-04T09:06:34 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,405 | cpp | // (C) Copyright 2002-2007 by Autodesk, Inc.
//
// Permission to use, copy, modify, and distribute this software in
// object code form for any purpose and without fee is hereby granted,
// provided that the above copyright notice appears in all copies and
// that both that copyright notice and the limited warranty and
// restricted rights notice below appear in all supporting
// documentation.
//
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
// UNINTERRUPTED OR ERROR FREE.
//
// Use, duplication, or disclosure by the U.S. Government is subject to
// restrictions set forth in FAR 52.227-19 (Commercial Computer
// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
// (Rights in Technical Data and Computer Software), as applicable.
//
//-----------------------------------------------------------------------------
//- GDESAddFunc.cpp : Initialization functions
//-----------------------------------------------------------------------------
#include "StdAfx.h"
#include "resource.h"
#include <afxdllx.h>
//-----------------------------------------------------------------------------
//- Define the sole extension module object.
AC_IMPLEMENT_EXTENSION_MODULE(GDESAddFuncDLL)
//- Please do not remove the 3 following lines. These are here to make .NET MFC Wizards
//- running properly. The object will not compile but is require by .NET to recognize
//- this project as being an MFC project
#ifdef NEVER
AFX_EXTENSION_MODULE GDESAddFuncExtDLL ={ NULL, NULL } ;
#endif
//- Now you can use the CAcModuleResourceOverride class in
//- your application to switch to the correct resource instance.
//- Please see the ObjectARX Documentation for more details
//-----------------------------------------------------------------------------
//- DLL Entry Point
extern "C"
BOOL WINAPI DllMain (HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved) {
//- Remove this if you use lpReserved
UNREFERENCED_PARAMETER(lpReserved) ;
if ( dwReason == DLL_PROCESS_ATTACH ) {
_hdllInstance =hInstance ;
GDESAddFuncDLL.AttachInstance (hInstance) ;
InitAcUiDLL () ;
} else if ( dwReason == DLL_PROCESS_DETACH ) {
GDESAddFuncDLL.DetachInstance () ;
}
return (TRUE) ;
}
| [
"hunanhd@163.com"
] | hunanhd@163.com |
7f531d8740000349aa5ca06f09b5c2603d50d633 | dd80a584130ef1a0333429ba76c1cee0eb40df73 | /external/clang/include/clang/AST/PrettyPrinter.h | adfd1ac936b9f2da4b2aff671b1134753bf02d75 | [
"MIT",
"NCSA"
] | permissive | karunmatharu/Android-4.4-Pay-by-Data | 466f4e169ede13c5835424c78e8c30ce58f885c1 | fcb778e92d4aad525ef7a995660580f948d40bc9 | refs/heads/master | 2021-03-24T13:33:01.721868 | 2017-02-18T17:48:49 | 2017-02-18T17:48:49 | 81,847,777 | 0 | 2 | MIT | 2020-03-09T00:02:12 | 2017-02-13T16:47:00 | null | UTF-8 | C++ | false | false | 5,190 | h | //===--- PrettyPrinter.h - Classes for aiding with AST printing -*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file defines the PrinterHelper interface.
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_CLANG_AST_PRETTY_PRINTER_H
#define LLVM_CLANG_AST_PRETTY_PRINTER_H
#include "clang/Basic/LLVM.h"
#include "clang/Basic/LangOptions.h"
namespace clang {
class LangOptions;
class SourceManager;
class Stmt;
class TagDecl;
class PrinterHelper {
public:
virtual ~PrinterHelper();
virtual bool handledStmt(Stmt* E, raw_ostream& OS) = 0;
};
/// \brief Describes how types, statements, expressions, and
/// declarations should be printed.
struct PrintingPolicy {
/// \brief Create a default printing policy for C.
PrintingPolicy(const LangOptions &LO)
: LangOpts(LO), Indentation(2), SuppressSpecifiers(false),
SuppressTagKeyword(false), SuppressTag(false), SuppressScope(false),
SuppressUnwrittenScope(false), SuppressInitializers(false),
ConstantArraySizeAsWritten(false), AnonymousTagLocations(true),
SuppressStrongLifetime(false), Bool(LO.Bool),
TerseOutput(false), PolishForDeclaration(false),
MSWChar(LO.MicrosoftExt && !LO.WChar) { }
/// \brief What language we're printing.
LangOptions LangOpts;
/// \brief The number of spaces to use to indent each line.
unsigned Indentation : 8;
/// \brief Whether we should suppress printing of the actual specifiers for
/// the given type or declaration.
///
/// This flag is only used when we are printing declarators beyond
/// the first declarator within a declaration group. For example, given:
///
/// \code
/// const int *x, *y;
/// \endcode
///
/// SuppressSpecifiers will be false when printing the
/// declaration for "x", so that we will print "int *x"; it will be
/// \c true when we print "y", so that we suppress printing the
/// "const int" type specifier and instead only print the "*y".
bool SuppressSpecifiers : 1;
/// \brief Whether type printing should skip printing the tag keyword.
///
/// This is used when printing the inner type of elaborated types,
/// (as the tag keyword is part of the elaborated type):
///
/// \code
/// struct Geometry::Point;
/// \endcode
bool SuppressTagKeyword : 1;
/// \brief Whether type printing should skip printing the actual tag type.
///
/// This is used when the caller needs to print a tag definition in front
/// of the type, as in constructs like the following:
///
/// \code
/// typedef struct { int x, y; } Point;
/// \endcode
bool SuppressTag : 1;
/// \brief Suppresses printing of scope specifiers.
bool SuppressScope : 1;
/// \brief Suppress printing parts of scope specifiers that don't need
/// to be written, e.g., for inline or anonymous namespaces.
bool SuppressUnwrittenScope : 1;
/// \brief Suppress printing of variable initializers.
///
/// This flag is used when printing the loop variable in a for-range
/// statement. For example, given:
///
/// \code
/// for (auto x : coll)
/// \endcode
///
/// SuppressInitializers will be true when printing "auto x", so that the
/// internal initializer constructed for x will not be printed.
bool SuppressInitializers : 1;
/// \brief Whether we should print the sizes of constant array expressions
/// as written in the sources.
///
/// This flag is determines whether arrays types declared as
///
/// \code
/// int a[4+10*10];
/// char a[] = "A string";
/// \endcode
///
/// will be printed as written or as follows:
///
/// \code
/// int a[104];
/// char a[9] = "A string";
/// \endcode
bool ConstantArraySizeAsWritten : 1;
/// \brief When printing an anonymous tag name, also print the location of
/// that entity (e.g., "enum <anonymous at t.h:10:5>"). Otherwise, just
/// prints "<anonymous>" for the name.
bool AnonymousTagLocations : 1;
/// \brief When true, suppress printing of the __strong lifetime qualifier in
/// ARC.
unsigned SuppressStrongLifetime : 1;
/// \brief Whether we can use 'bool' rather than '_Bool', even if the language
/// doesn't actually have 'bool' (because, e.g., it is defined as a macro).
unsigned Bool : 1;
/// \brief Provide a 'terse' output.
///
/// For example, in this mode we don't print function bodies, class members,
/// declarations inside namespaces etc. Effectively, this should print
/// only the requested declaration.
unsigned TerseOutput : 1;
/// \brief When true, do certain refinement needed for producing proper
/// declaration tag; such as, do not print attributes attached to the declaration.
///
unsigned PolishForDeclaration : 1;
/// \brief When true, print the built-in wchar_t type as __wchar_t. For use in
/// Microsoft mode when wchar_t is not available.
unsigned MSWChar : 1;
};
} // end namespace clang
#endif
| [
"karun.matharu@gmail.com"
] | karun.matharu@gmail.com |
1863dd3967627ae8489c933d1815afe80082d0ac | f957ee9980e26e0feec548c205893359facc651b | /backend/fpga_input_device.cpp | dcd9a94f1a510cd2087c3739f11c50965947e47e | [
"MIT"
] | permissive | llandis/DESim | 11c74d69a8ac130403f9ca23cac67bd9745e8442 | c6718b81147bb7f48568d94cecf478c9608da418 | refs/heads/main | 2023-06-11T23:56:20.344056 | 2021-06-29T02:24:46 | 2021-06-29T02:24:46 | 381,216,810 | 0 | 0 | MIT | 2021-06-29T02:32:37 | 2021-06-29T02:32:36 | null | UTF-8 | C++ | false | false | 2,490 | cpp | // Copyright (c) 2020 FPGAcademy
// Please see license at https://github.com/fpgacademy/DESim
#include "fpga_input_device.h"
fpga_input_device::fpga_input_device(int device_num, PLI_INT32 value_format, const char *initial_value,
vpiHandle device_handle) {
if (device_num <= 0) {
std::cerr << "error: number of device should be greater than 0" << std::endl;
std::exit(1);
}
this->device_num = device_num;
this->value_format = value_format;
this->device_vals = static_cast<char *>(malloc(sizeof(char) * (device_num + 1)));
// malloc failed
if (!this->device_vals) {
std::cerr << "error: malloc" << std::endl;
std::exit(1);
}
strncpy(this->device_vals, initial_value, device_num + 1);
this->device_vals[device_num] = 0;
this->device_handle = device_handle;
}
void fpga_input_device::SetInitialValue() {
s_vpi_value init_val = {
.format = this->value_format,
.value = {
.str = this->device_vals
}
};
vpi_put_value(this->device_handle, &init_val, NULL, vpiNoDelay);
}
int fpga_input_device::UpdateValue(char *tokens) {
int index, val;
int rc = sscanf(tokens, "%d %d", &index, &val);
if (rc < 2 || index < 0 || index >= this->device_num) {
return 1;
}
// e.g. SW[0] is the last bit of SW[9:0]
index = (this->device_num - 1) - index;
this->device_vals[index] = (val) ? '1' : '0';
s_vpi_value new_vals = {
.format = this->value_format,
.value = {this->device_vals}
};
vpi_put_value(this->device_handle, &new_vals, NULL, vpiNoDelay);
return 0;
}
fpga_input_device::~fpga_input_device() {
if (this->device_vals) {
free(this->device_vals);
}
}
bool fpga_input_device::operator = (fpga_input_device const &other){
if(this->device_num != other.device_num) return false;
if(this->value_format != other.value_format) return false;
// compare pointer here since one device should have only one value
if(this->device_vals != other.device_vals) return false;
return this->device_handle == other.device_handle;
}
fpga_input_device::fpga_input_device(fpga_input_device const &other){
this->device_num = other.device_num;
this->value_format = other.value_format;
this->device_vals = static_cast<char *>(malloc(sizeof(char) * (other.device_num + 1)));
// malloc failed
if (!this->device_vals) {
std::cerr << "error: malloc" << std::endl;
std::exit(1);
}
strncpy(this->device_vals, other.device_vals, other.device_num + 1);
this->device_vals[other.device_num] = 0;
this->device_handle = other.device_handle;
}
| [
"74740408+fpgacademy@users.noreply.github.com"
] | 74740408+fpgacademy@users.noreply.github.com |
7cba13ccbd72cd7dda82aab173fad6e25e88f3b9 | e7be2ee48f952308f5672240c2c833d718d9d431 | /Juliet_Test_Suite_v1.3_for_C_Cpp/C/testcases/CWE789_Uncontrolled_Mem_Alloc/s02/CWE789_Uncontrolled_Mem_Alloc__new_char_listen_socket_44.cpp | c7cd4c14813ee48df92fac0bd78c5d0ed2e4521b | [] | no_license | buihuynhduc/tooltest | 5146c44cd1b7bc36b3b2912232ff8a881269f998 | b3bb7a6436b3ab7170078860d6bcb7d386762b5e | refs/heads/master | 2020-08-27T20:46:53.725182 | 2019-10-25T05:42:36 | 2019-10-25T05:42:36 | 217,485,049 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 9,458 | cpp | /* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE789_Uncontrolled_Mem_Alloc__new_char_listen_socket_44.cpp
Label Definition File: CWE789_Uncontrolled_Mem_Alloc__new.label.xml
Template File: sources-sinks-44.tmpl.cpp
*/
/*
* @description
* CWE: 789 Uncontrolled Memory Allocation
* BadSource: listen_socket Read data using a listen socket (server side)
* GoodSource: Small number greater than zero
* Sinks:
* GoodSink: Allocate memory with new [] and check the size of the memory to be allocated
* BadSink : Allocate memory with new [], but incorrectly check the size of the memory to be allocated
* Flow Variant: 44 Data/control flow: data passed as an argument from one function to a function in the same source file called via a function pointer
*
* */
#include "std_testcase.h"
#ifndef _WIN32
#include <wchar.h>
#endif
#ifdef _WIN32
#include <winsock2.h>
#include <windows.h>
#include <direct.h>
#pragma comment(lib, "ws2_32") /* include ws2_32.lib when linking */
#define CLOSE_SOCKET closesocket
#else
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <unistd.h>
#define INVALID_SOCKET -1
#define SOCKET_ERROR -1
#define CLOSE_SOCKET close
#define SOCKET int
#endif
#define TCP_PORT 27015
#define LISTEN_BACKLOG 5
#define CHAR_ARRAY_SIZE (3 * sizeof(data) + 2)
#define HELLO_STRING "hello"
namespace CWE789_Uncontrolled_Mem_Alloc__new_char_listen_socket_44
{
#ifndef OMITBAD
static void badSink(size_t data)
{
{
char * myString;
/* POTENTIAL FLAW: No MAXIMUM limitation for memory allocation, but ensure data is large enough
* for the strcpy() function to not cause a buffer overflow */
/* INCIDENTAL FLAW: The source could cause a type overrun in data or in the memory allocation */
if (data > strlen(HELLO_STRING))
{
myString = new char[data];
/* Copy a small string into myString */
strcpy(myString, HELLO_STRING);
printLine(myString);
delete [] myString;
}
else
{
printLine("Input is less than the length of the source string");
}
}
}
void bad()
{
size_t data;
/* define a function pointer */
void (*funcPtr) (size_t) = badSink;
/* Initialize data */
data = 0;
{
#ifdef _WIN32
WSADATA wsaData;
int wsaDataInit = 0;
#endif
int recvResult;
struct sockaddr_in service;
SOCKET listenSocket = INVALID_SOCKET;
SOCKET acceptSocket = INVALID_SOCKET;
char inputBuffer[CHAR_ARRAY_SIZE];
do
{
#ifdef _WIN32
if (WSAStartup(MAKEWORD(2,2), &wsaData) != NO_ERROR)
{
break;
}
wsaDataInit = 1;
#endif
/* POTENTIAL FLAW: Read data using a listen socket */
listenSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
if (listenSocket == INVALID_SOCKET)
{
break;
}
memset(&service, 0, sizeof(service));
service.sin_family = AF_INET;
service.sin_addr.s_addr = INADDR_ANY;
service.sin_port = htons(TCP_PORT);
if (bind(listenSocket, (struct sockaddr*)&service, sizeof(service)) == SOCKET_ERROR)
{
break;
}
if (listen(listenSocket, LISTEN_BACKLOG) == SOCKET_ERROR)
{
break;
}
acceptSocket = accept(listenSocket, NULL, NULL);
if (acceptSocket == SOCKET_ERROR)
{
break;
}
/* Abort on error or the connection was closed */
recvResult = recv(acceptSocket, inputBuffer, CHAR_ARRAY_SIZE - 1, 0);
if (recvResult == SOCKET_ERROR || recvResult == 0)
{
break;
}
/* NUL-terminate the string */
inputBuffer[recvResult] = '\0';
/* Convert to unsigned int */
data = strtoul(inputBuffer, NULL, 0);
}
while (0);
if (listenSocket != INVALID_SOCKET)
{
CLOSE_SOCKET(listenSocket);
}
if (acceptSocket != INVALID_SOCKET)
{
CLOSE_SOCKET(acceptSocket);
}
#ifdef _WIN32
if (wsaDataInit)
{
WSACleanup();
}
#endif
}
/* use the function pointer */
funcPtr(data);
}
#endif /* OMITBAD */
#ifndef OMITGOOD
/* goodG2B() uses the GoodSource with the BadSink */
static void goodG2BSink(size_t data)
{
{
char * myString;
/* POTENTIAL FLAW: No MAXIMUM limitation for memory allocation, but ensure data is large enough
* for the strcpy() function to not cause a buffer overflow */
/* INCIDENTAL FLAW: The source could cause a type overrun in data or in the memory allocation */
if (data > strlen(HELLO_STRING))
{
myString = new char[data];
/* Copy a small string into myString */
strcpy(myString, HELLO_STRING);
printLine(myString);
delete [] myString;
}
else
{
printLine("Input is less than the length of the source string");
}
}
}
static void goodG2B()
{
size_t data;
void (*funcPtr) (size_t) = goodG2BSink;
/* Initialize data */
data = 0;
/* FIX: Use a relatively small number for memory allocation */
data = 20;
funcPtr(data);
}
/* goodB2G() uses the BadSource with the GoodSink */
static void goodB2GSink(size_t data)
{
{
char * myString;
/* FIX: Include a MAXIMUM limitation for memory allocation and a check to ensure data is large enough
* for the strcpy() function to not cause a buffer overflow */
/* INCIDENTAL FLAW: The source could cause a type overrun in data or in the memory allocation */
if (data > strlen(HELLO_STRING) && data < 100)
{
myString = new char[data];
/* Copy a small string into myString */
strcpy(myString, HELLO_STRING);
printLine(myString);
delete [] myString;
}
else
{
printLine("Input is less than the length of the source string or too large");
}
}
}
static void goodB2G()
{
size_t data;
void (*funcPtr) (size_t) = goodB2GSink;
/* Initialize data */
data = 0;
{
#ifdef _WIN32
WSADATA wsaData;
int wsaDataInit = 0;
#endif
int recvResult;
struct sockaddr_in service;
SOCKET listenSocket = INVALID_SOCKET;
SOCKET acceptSocket = INVALID_SOCKET;
char inputBuffer[CHAR_ARRAY_SIZE];
do
{
#ifdef _WIN32
if (WSAStartup(MAKEWORD(2,2), &wsaData) != NO_ERROR)
{
break;
}
wsaDataInit = 1;
#endif
/* POTENTIAL FLAW: Read data using a listen socket */
listenSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
if (listenSocket == INVALID_SOCKET)
{
break;
}
memset(&service, 0, sizeof(service));
service.sin_family = AF_INET;
service.sin_addr.s_addr = INADDR_ANY;
service.sin_port = htons(TCP_PORT);
if (bind(listenSocket, (struct sockaddr*)&service, sizeof(service)) == SOCKET_ERROR)
{
break;
}
if (listen(listenSocket, LISTEN_BACKLOG) == SOCKET_ERROR)
{
break;
}
acceptSocket = accept(listenSocket, NULL, NULL);
if (acceptSocket == SOCKET_ERROR)
{
break;
}
/* Abort on error or the connection was closed */
recvResult = recv(acceptSocket, inputBuffer, CHAR_ARRAY_SIZE - 1, 0);
if (recvResult == SOCKET_ERROR || recvResult == 0)
{
break;
}
/* NUL-terminate the string */
inputBuffer[recvResult] = '\0';
/* Convert to unsigned int */
data = strtoul(inputBuffer, NULL, 0);
}
while (0);
if (listenSocket != INVALID_SOCKET)
{
CLOSE_SOCKET(listenSocket);
}
if (acceptSocket != INVALID_SOCKET)
{
CLOSE_SOCKET(acceptSocket);
}
#ifdef _WIN32
if (wsaDataInit)
{
WSACleanup();
}
#endif
}
funcPtr(data);
}
void good()
{
goodG2B();
goodB2G();
}
#endif /* OMITGOOD */
} /* close namespace */
/* Below is the main(). It is only used when building this testcase on
its own for testing or for building a binary to use in testing binary
analysis tools. It is not used when compiling all the testcases as one
application, which is how source code analysis tools are tested. */
#ifdef INCLUDEMAIN
using namespace CWE789_Uncontrolled_Mem_Alloc__new_char_listen_socket_44; /* so that we can use good and bad easily */
int main(int argc, char * argv[])
{
/* seed randomness */
srand( (unsigned)time(NULL) );
#ifndef OMITGOOD
printLine("Calling good()...");
good();
printLine("Finished good()");
#endif /* OMITGOOD */
#ifndef OMITBAD
printLine("Calling bad()...");
bad();
printLine("Finished bad()");
#endif /* OMITBAD */
return 0;
}
#endif
| [
"43197106+buihuynhduc@users.noreply.github.com"
] | 43197106+buihuynhduc@users.noreply.github.com |
bf1acbb0659183b545148e8f6b082ec73d01a26c | 06a2922bdb918f49607e42cca9cb39a848c0ba8d | /P7/CuentaCheques.cpp | 861f9b217f9953fb67468ba42f47a77c8eb9ea17 | [] | no_license | Tenkoni/OOP-FI-Course | b88dedee7e62db73ec784ca190d03218fc0e3303 | eb8bca92fd86c1527801ce5785e1f6876b791bb0 | refs/heads/master | 2021-04-12T12:30:09.431210 | 2018-04-07T01:17:07 | 2018-04-07T01:17:07 | 126,423,632 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,846 | cpp | #include "CuentaCheques.hpp"
/**
* @brief Construye la clase CuentaCheques con dos argumentos
*
* @param[in] _cantidad El saldo con el que se creará la cuenta
* @param[in] _cuota La cuota que se le cobrará por transacción
*/
CuentaCheques::CuentaCheques (double _cantidad, double _cuota) :
Cuenta{_cantidad}, cuota{_cuota}
{
std::cout<<"Constructor cuenta cheques"<<std::endl;
}
/**
* @brief Destructor de la clase CuentaCheques.
*/
CuentaCheques::~CuentaCheques()
{
std::cout<<"Destructor de cuenta cheques"<<std::endl;
}
/**
* @brief Construye la clase por copia.
*
* @param[in] rhs El objeto que queremos copiar
*/
CuentaCheques::CuentaCheques (const CuentaCheques &rhs)
{
SetSaldo(rhs.GetSaldo());
this->cuota = rhs.cuota;
}
/**
* @brief Se sobrecarga el operador '=' para dos clases CuentaCheques
*
* @param[in] rhs The right hand side
*/
void CuentaCheques::operator= (const CuentaCheques &rhs)
{
SetSaldo(rhs.GetSaldo());
this->cuota = rhs.cuota;
}
/**
* @brief Obtiene el valor de la cuota.
*
* @return El valor double de la cuota
*/
double CuentaCheques::GetCuota ()
{
return (this->cuota);
}
/**
* @brief Se retira una cantidad del saldo de la cuenta
*
* @param[in] _cantidad La cantidad que se desea retirar
*
* @return Regresa True si se pudo efectuar el retiro, en caso contrario false.
*/
bool CuentaCheques::Cargar (double _cantidad)
{
if (_cantidad + this->cuota > GetSaldo())
return false;
else{
SetSaldo(GetSaldo() - _cantidad);
return true;
}
}
/**
* @brief Efectuo el cobro de cuota
* @param[in] _cantidad el valor de la cuota.
*/
void CuentaCheques::Abonar (double _cantidad)
{
SetSaldo(GetSaldo() - _cantidad);
}
| [
"noreply@github.com"
] | Tenkoni.noreply@github.com |
19f9fb26471395bdb4574d31d0e3195925f91033 | bb7874f3251cdf25d911995edffff832ae888130 | /Exam practice/ScreenWriting/mainwindow.h | 7df2a34b2f50ae6ec230ded28af2ca8386740eed | [] | no_license | teodoraalexandra/Object-Oriented-Programming | 35b11ba915c88c513ce85ba1d498892444b90a56 | fcb4e93bd0eed7751fcbc23773c5ce38995367c0 | refs/heads/master | 2021-05-20T20:43:28.320959 | 2020-04-02T10:05:48 | 2020-04-02T10:05:48 | 252,410,240 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 328 | h | #ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include <QAbstractTableModel>
namespace Ui {
class MainWindow;
}
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
explicit MainWindow(QWidget *parent = nullptr);
~MainWindow();
private:
Ui::MainWindow *ui;
};
#endif // MAINWINDOW_H
| [
"33027937+teodoraalexanra@users.noreply.github.com"
] | 33027937+teodoraalexanra@users.noreply.github.com |
d9f91d338b4c150c85e9eb76953faf204800df37 | 1b7aaacfc9c1dde638cdb4c3de64da38d03edcad | /polynomial/main.cpp | 7622bce08de4f6024d71e1e97147bff29f5029ca | [] | no_license | khanhle10/Program-Methodology | 4b2b852ee2ee4dba92b5f26c0ab3e270d30f45d8 | a757ba46f445f61b0ae31002572ab869c6aaa114 | refs/heads/master | 2021-01-10T20:04:47.475818 | 2015-03-30T21:46:30 | 2015-03-30T21:46:30 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 7,306 | cpp | /*
Khanh Le
CSC 340
HW#4 Polynomial
Create a Polynomial by prompting the USer to input
Use separate compilation to implement a polynomial ADT that manipulates polynomials
in a single variable x (e.g., p = 4 x5
+ 7 x 3 – x2
+ 9 ). For this problem, consider only
polynomials whose exponents are nonnegative integers. You are required to identify a
proper data representation schema to store such polynomials and hide such data from
external users of this ADT. Additionally, your ADT will at least include the following
member functions:
! One default constructor.
! One method allowing one to get an entire polynomial by interacting with the user
to obtain the degree and coefficient of each term in a polynomial.
! degree() // Returns the degree of a polynomial, which is the highest power
// of a term with a nonzero coefficient. E.g., p.degree()=5
! coefficient(power) // Returns the coefficient of the x p o w e r term.
! changeCoefficient(newCoefficient, power) // Replaces the coefficient of
// the x p o w e r term with newCoefficient.
! A method that multiplies a polynomial by a scalar variable
! A method that adds two polynomials.
! A method that prints out a polynomial.
! Overload the division operator (/) as a member function to multiple divide a
polynomial by a scalar variable.
! Overload the negation operator (-) as a member function to negate a polynomial
! Overload the “put” operator (<<) to output a polynomial on an output stream.
*/
#include "polynomialADT.h"
#include "polynomialADT.cpp"
#include <iostream>
#include <cstdlib>
#include <vector>
using namespace std;
void actions(polynomialADT &poly1);
void createPoly(polynomialADT &poly);
int main()
{
cout << "Hello world!" << endl;
polynomialADT poly; // create object function
createPoly(poly); // call function to prompt user input
actions(poly); // call function to begin implemeting options
return EXIT_SUCCESS; // exiting program
}
/*
Pass by reference polynomialADT
Function: prompt user to input polynomial size and input coefficient
*/
void createPoly(polynomialADT &poly){
int power, check = -1, length;
double value;
cout << "Enter Number of Degree For Polynomial (5): "; // user input the length of
while(cin >> length){
if( length > 0){
break;
} // check to obtain the length of polynomial
cout << "Error! Please Enter A Positive Value For Polynomial Length: ";
} // check of the imput is an int
while (length != 0){
cout << "Please Enter Powers In Increasing Order\n";
cout << "Enter the Power: x^";
while(cin >>power){
if (power > check){ // if statement to check if the power input is in increasing order of power
check = power;
break; // break out of loop if power value is greater than previous
}
cout << "Error!\nPlease Enter the Power In Increasing Order: x^";
} // continue loop if power is less than
cout<< "Enter Coefficient for x^"<<power<<": "; // prompt coefficient
while(!(cin >> value)){
cout << "Error! Please Enter Coefficient For x^"<<power<<": ";
} // check if value is an doule
poly.changeCoefficient(value, power);// pass value and power to member function to update initial polynomial
length--; // decrement polynomial length
}
poly.setDegree(power); // highest power assign to degree
}
/*
Pass by reference object of polynomialADT
Function: Prompt usering to add, multiply, print, or scalar multiply polynomial
*/
void actions(polynomialADT &poly)
{
polynomialADT poly2;
polynomialADT result;
int choice = 0, value;
do{
// prompt
cout<<"***********************************\n";
cout << "1\tAdd"<<endl;
cout << "2\tMultiply Scalar"<<endl;
cout << "3\tPrint"<<endl;
cout << "4\tOverloading Scalar Operation"<< endl;
cout << "5\tNegation Operation"<<endl;
cout << "6\tQuit"<<endl;
cout<<"***********************************\n";
cout <<"Enter Choice: ";
while(cin >> choice){
if ( choice <= 6 && choice > 0){
break;
} // loop to check valid input between the expected condition break if so
cout << "Error!\n Please Enter Again:";
}//
value = 0;
switch(choice){ // switch statement for options
case 1:
cout << "Adding Two Polynomial\n";
cout << "First Polynomial:\n"<<poly << endl; // overloading operator to print polynomial
cout << "Set Second Polynomial:\n";
createPoly(poly2); // prompt user to input second polynomial
cout << "First Polynomial:\n"<<poly << endl; // overloading operator to print polynomial
cout << "Second Polynomial:\n"<<poly2 <<endl; // overloading operator to print second polynomial
result = poly.addPoly(poly2); // object function to add two polynomial
cout << "Result: "<<result <<endl; // overload operator to print polynomial result
break; // break out of switch statement
case 2:
cout << "Multiply Scalar\n";
cout << "Please Enter A Scalar Value: ";
while( !(cin >> value)){ // prompt user to input a value as scalar
cout<< "Error!\n Please Enter A Value: ";
}
cout << "First Polynomial:\n"<<(poly) << endl; // overload operator print polynomial
result = poly.multPoly(value); // object member function all to multiply scalar
cout << "Result: "<<result<< endl; // overload operator to print result from multiplying scalar
break; // break out of switch statement
case 3:
cout << "Print Polynomial:\n";
poly.print(); // print by object member function all
break; // break out of switch statement
case 4:
cout <<"Scalar Multiplication Overloading"<<endl;
cout << "Please Enter A Scalar Value: ";
while( !(cin >> value)){ // prompt user to input scalar value
cout<< "Error!\n Please Enter A Value: ";
}
result = poly.operator*(value); // overloading scalar multiple
cout << "Scalar Overload Result: "<<(result) << endl; // overloading operator to print
break; // break out of switch statement
case 5:
cout << "Negation Overloading"<<endl;
result = poly.operator-(); // overload operator negation function
cout << "Negative Overload Result: "<<(result) <<endl; // overloading operator to print result
break; // break out od switch statement
case 6:
cout << "End Program."<<endl;
default:
cout<< choice <<" is Invalid."<<endl; // message default
}
}while (choice != 6); // break out of loop to
}
| [
"khanhle10@hotmail.com"
] | khanhle10@hotmail.com |
89009a12d9fd111ecdeeff942788e9d3e0fd4a93 | 2974c9c1df66ddf36b6d98c48cc7b1bc942ac203 | /generic_min/generic_min/version_1/src/driver_min.cpp | f4006c1d6bcb0bca9bfadab152c982dd4e5c7e44 | [] | no_license | luizfilipesm/test1-PL1 | dab1d13efa1dde325689fa3756347919d6765b2f | a62300e655569ec1fd85c5e8e8775eef07003565 | refs/heads/master | 2020-03-29T18:58:46.933122 | 2018-09-23T22:16:14 | 2018-09-23T22:16:14 | 150,241,602 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 6,492 | cpp | /*!
* \file driver_min.cpp
* This is the second version.
*/
#include <iostream>
#include <iterator>
#include <iomanip>
#include <sstream>
//=== New type
enum food_t : int { NATURAL=0, PROCESSED=1 };
/// Represents a food
struct Food {
// Nutrition facts per 100g.
food_t type;
std::string name;
int calories; // per 100g
float sugar; // per 100g
float fiber;
};
/// Overloading extractor operator to support the Food type. Return a string representation for a food.
std::ostream& operator<<( std::ostream& os, const Food & f )
{
os << std::left << "<\"" << std::setw(12) << f.name << "\""
<< ", cal=" << std::setw(4) << f.calories
<< ", sug=" << std::setw(6) << std::fixed << std::setprecision(1) << f.sugar
<< ", fib=" << f.fiber
<< ">";
return os;
}
//=== Function prototypes ===
std::string print_int( const int*, const int* );
std::string print_food( const Food*, const Food* );
const int *min_int( const int*, const int* );
const Food *min_food_calories( const Food*, const Food* );
const Food *min_food_fiber( const Food*, const Food* );
const Food *min_food_sugar( const Food*, const Food* );
/// Extracting the array information to a stream.
std::string print_int( const int* first, const int* last )
{
std::ostringstream oss;
while( first != last )
oss << *first++ << " ";
return oss.str();
}
/// Extracting the array information to a stream.
std::string print_food( const Food* first, const Food* last )
{
std::ostringstream oss;
while( first != last )
oss << *first++ << "\n";
return oss.str();
}
/// Find and return the first occurrence of the samllest element in the range [first;last).
const int *min_int( const int* first, const int* last )
{
// This pointer traverses the range.
const int *it = first;
// Loop Invariant: this pointer should always point to the smallest element throughout the execution.
const int *smallest = first++; // The first is the smallest so far.
// Traverse the range
while( it != last )
{
// Check whether the current element is smaller than the smallest so far.
if ( *it < *smallest )
smallest = it; // update pointer to smallest element so far.
it++; // Advance to the next element in the range.
}
return smallest;
}
/// Find and return the first occurrence of the least caloric food in the range [first;last).
const Food *min_food_calories( const Food* first, const Food* last )
{
// This pointer traverses the range.
const Food *it = first;
// Loop Invariant: this pointer should always point to the smallest element throughout the execution.
const Food *smallest = first++; // The first is the smallest so far.
// Traverse the range
while( it != last )
{
// Check whether the current element is smaller than the smallest so far.
if ( it->calories < smallest->calories )
smallest = it; // update pointer to smallest element so far.
it++; // Advance to the next element in the range.
}
return smallest;
}
/// Find and return the first occurrence of the food with the smallest content of fiber in the range [first;last).
const Food *min_food_fiber( const Food* first, const Food* last )
{
// This pointer traverses the range.
const Food *it = first;
// Loop Invariant: this pointer should always point to the smallest element throughout the execution.
const Food *smallest = first++; // The first is the smallest so far.
// Traverse the range
while( it != last )
{
// Check whether the current element is smaller than the smallest so far.
if ( it->fiber < smallest->fiber )
smallest = it; // update pointer to smallest element so far.
it++; // Advance to the next element in the range.
}
return smallest;
}
/// Find and return the first occurrence of the food with the smallest content of sugar in the range [first;last).
const Food *min_food_sugar( const Food* first, const Food* last )
{
// This pointer traverses the range.
const Food *it = first;
// Loop Invariant: this pointer should always point to the smallest element throughout the execution.
const Food *smallest = first++; // The first is the smallest so far.
// Traverse the range
while( it != last )
{
// Check whether the current element is smaller than the smallest so far.
if ( it->sugar < smallest->sugar )
smallest = it; // update pointer to smallest element so far.
it++; // Advance to the next element in the range.
}
return smallest;
}
int main( void )
{
// A simple array of integers.
int A[] { 5, 6, 2, 1, 3, 7, 4 };
Food bag[] {
{ food_t::NATURAL, "orange", 47, 9.f, 2.4f },
{ food_t::NATURAL, "orange juice", 45, 8.f, 0.2f },
{ food_t::PROCESSED, "regular coke", 139, 10.9f, 0.f },
{ food_t::PROCESSED, "fried egg", 196, 1.1f, 0.f },
{ food_t::NATURAL, "banana", 89, 12.f, 2.6f },
{ food_t::PROCESSED, "white bread", 256, 5.f, 2.7f }
};
// Prints out the integer array.
std::cout << ">>> A = [" << print_int(std::begin(A), std::end(A)) << "]" << std::endl;
// Find the smallest element.
auto result = min_int( std::begin(A), std::end(A) );
// Print the smallest found.
std::cout << ">>> The smallest element in A is \"" << *result << "\"" << std::endl;
std::cout << std::endl << std::endl;
// Just prints out the list of food in the bag.
std::cout << ">>> Bag: \n" << print_food(std::begin(bag), std::end(bag)) << std::endl;
// Find the smallest element.
auto result2 = min_food_calories( std::begin(bag), std::end(bag) );
// Print the smallest found.
std::cout << ">>> The least caloric food in the bag is \"" << *result2 << "\"" << std::endl;
// Find the smallest element.
auto result3 = min_food_sugar( std::begin(bag), std::end(bag) );
// Print the smallest found.
std::cout << ">>> The food lowest in sugar in the bag is \"" << *result3 << "\"" << std::endl;
// Find the smallest element.
auto result4 = min_food_fiber( std::begin(bag), std::end(bag) );
// Print the smallest found.
std::cout << ">>> The food with the least amount of fiber in the bag is \"" << *result4 << "\"" << std::endl;
return EXIT_SUCCESS;
}
| [
"lfsmariz@gmail.com"
] | lfsmariz@gmail.com |
da1f4a957728340934a380947ce03f9dbb4847b8 | a0ee991a897eb0ffdf214410e8eed698625fa199 | /page216IntListModel/intListModel.cpp | a3751837bb472726f527370b16097d8f151cd74a | [] | no_license | glazatkina/qt_Labs | a6d7f1dd79bededcc3e64c7e7b2fa3b0b71ef112 | 41a0499535121983268f90de51326b73111e88e3 | refs/heads/master | 2021-01-20T20:18:04.006736 | 2016-07-21T07:54:04 | 2016-07-21T07:54:04 | 62,678,781 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,209 | cpp | #include <QtWidgets>
#include "intListModel.h"
IntListModel::IntListModel(const QList<int>& list, QObject* pobj /*=0*/) : QAbstractListModel(pobj), m_list(list) {}
QVariant IntListModel::data(const QModelIndex& index, int nRole) const {
if (!index.isValid()) {
return QVariant();
}
return (nRole == Qt::DisplayRole || nRole == Qt::EditRole) ? m_list.at(index.row()) : QVariant();
}
bool IntListModel::setData(const QModelIndex& index, const QVariant& value, int nRole) {
if (index.isValid() && nRole == Qt::EditRole) {
m_list.replace(index.row(), value.toInt());
emit dataChanged(index, index);
return true;
}
return false;
}
int IntListModel::rowCount(const QModelIndex& parent /*= QModelIndex()*/) const {
return m_list.size();
}
QVariant IntListModel::headerData(int nSection, Qt::Orientation orientation, int nRole /*= Qt::DisplayRole*/) const {
if (nRole != Qt::DisplayRole) {
return QVariant();
}
return (orientation == Qt::Horizontal) ? QString("Number") : QString::number(nSection);
}
Qt::ItemFlags IntListModel::flags(const QModelIndex& index) const {
Qt::ItemFlags flags = QAbstractListModel::flags(index);
return index.isValid() ? (flags | Qt::ItemIsEditable) : flags;
} | [
"glazatkina@gmail.com"
] | glazatkina@gmail.com |
a0ca60239e137fbb12cb3fd600238ba3b1a28d7d | 4fe701e816975bef92a7f454cc4b69f7c20049e2 | /Graphics/NURBSMesh.h | 531116fe81818b30d67925f6c2894f2e9541115a | [] | no_license | sjgg555/NURBS_exploration | 407afdce9f0354eb99b6d44d2fddebd654f8e39d | 4356a56adbd46e30f21105972dc7a406389dedd0 | refs/heads/master | 2023-01-06T05:51:12.329264 | 2020-10-11T01:21:27 | 2020-10-11T01:21:27 | 300,918,916 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 686 | h | #pragma once
#include "Cube.h"
#include "tinysplinecpp.h"
using namespace tinyspline;
class NURBSMesh :
public Cube
{
public:
NURBSMesh(int resolution, int controlPointNum, int degree);
~NURBSMesh();
void SetControlPoint(int index, Vector3 newPos);
Vector3 GetControlPoint(int index);
int GetControlPointCount(void);
void SetResolution(int newResolution);
int GetResolution(void);
private:
void ConstructVertices(void);
void ConstructIndices(void);
void ConstructControlPoints(void);
float m_size;
BSpline m_edgeSpline;
const int CONTROL_POINT_COUNT = 3;
const int DIMENSIONS = 3;
const int DEGREE = 3;
const int VERTICES_PER_LAYER = 4;
int m_layerCount;
};
| [
"sjgg555@gmail.com"
] | sjgg555@gmail.com |
f3c0aaa29940c9561c5105380f1741a11fbde5ee | 7f5920a044b8f0f858558305b3da693182037245 | /lbf-pbrt/src/materials/glass.cpp | 9c38654447f96451cf6e993907c106d50aea0a5e | [] | no_license | jehutymax/lbf-mitsuba | 5f43b5fdae322f73b9eddd1bad11095b2c4f6b3d | 8d891f616a1c77d453e8ff3aa5d6bdab5267aba6 | refs/heads/master | 2021-01-10T09:01:56.206525 | 2015-12-09T21:47:51 | 2015-12-09T21:47:51 | 47,661,605 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,021 | cpp |
/*
pbrt source code Copyright(c) 1998-2012 Matt Pharr and Greg Humphreys.
This file is part of pbrt.
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.
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.
*/
// materials/glass.cpp*
#include "stdafx.h"
#include "materials/glass.h"
#include "spectrum.h"
#include "reflection.h"
#include "paramset.h"
#include "texture.h"
#include "../FeatureSampler/FeatureSampler.h"
// GlassMaterial Method Definitions
BSDF *GlassMaterial::GetBSDF(const DifferentialGeometry &dgGeom, const DifferentialGeometry &dgShading, MemoryArena &arena, int bounceNum, bool isSpecularBounce, bool saveTexture2, float rWeight, float gWeight, float bWeight) const {
DifferentialGeometry dgs;
if (bumpMap)
Bump(bumpMap, dgGeom, dgShading, &dgs);
else
dgs = dgShading;
float ior = index->Evaluate(dgs);
BSDF *bsdf = BSDF_ALLOC(arena, BSDF)(dgs, dgGeom.nn, ior);
Spectrum R = Kr->Evaluate(dgs).Clamp();
Spectrum T = Kt->Evaluate(dgs).Clamp();
if (!R.IsBlack())
bsdf->Add(BSDF_ALLOC(arena, SpecularReflection)(R,
BSDF_ALLOC(arena, FresnelDielectric)(1., ior)));
if (!T.IsBlack())
bsdf->Add(BSDF_ALLOC(arena, SpecularTransmission)(T, 1., ior));
return bsdf;
}
GlassMaterial *CreateGlassMaterial(const Transform &xform,
const TextureParams &mp) {
Reference<Texture<Spectrum> > Kr = mp.GetSpectrumTexture("Kr", Spectrum(1.f));
Reference<Texture<Spectrum> > Kt = mp.GetSpectrumTexture("Kt", Spectrum(1.f));
Reference<Texture<float> > index = mp.GetFloatTexture("index", 1.5f);
Reference<Texture<float> > bumpMap = mp.GetFloatTextureOrNull("bumpmap");
float prob = mp.FindFloat("reflectanceProb", 0.5f);
return new GlassMaterial(Kr, Kt, index, bumpMap, prob);
}
| [
"rafaelcdn@gmail.com"
] | rafaelcdn@gmail.com |
5bef76e34ca36466e0a118a747b82f8687d24ffc | ebea47001f94eda15662c9f1209574b02d83e23f | /OsiInterface/GameDefinitions/Osiris.h | e45f17ea766ca70e51444b79341bdfbaa1449501 | [
"MIT"
] | permissive | FelipeRenault/ositools | b76614e02e1ea9a8dd55cd20036229411de90745 | 0010ff6faa44d3dc41bcd4c92c10f9a708d817b9 | refs/heads/master | 2020-08-27T14:59:44.190985 | 2020-04-25T17:40:03 | 2020-04-25T17:40:03 | 217,412,365 | 0 | 0 | null | 2019-10-24T23:26:38 | 2019-10-24T23:26:38 | null | UTF-8 | C++ | false | false | 24,622 | h | #pragma once
#include <cstdint>
#include <array>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <cassert>
#include <glm/vec3.hpp>
#include <GameDefinitions/BaseTypes.h>
namespace dse
{
#pragma pack(push, 1)
enum class ValueType : uint8_t
{
None = 0,
Integer = 1,
Integer64 = 2,
Real = 3,
String = 4,
GuidString = 5,
CharacterGuid = 6,
ItemGuid = 7,
TriggerGuid = 8,
SplineGuid = 9,
LevelTemplateGuid = 10,
Undefined = 0x7f
};
struct OsiArgumentValue
{
ValueType TypeId;
uint8_t __Padding[7];
union {
char const * String;
int32_t Int32;
int64_t Int64;
float Float;
};
inline OsiArgumentValue()
: TypeId(ValueType::None)
{}
inline OsiArgumentValue(ValueType type, char const * str)
: TypeId(type), String(const_cast<char *>(str))
{}
inline OsiArgumentValue(float flt)
: TypeId(ValueType::Real), Float(flt)
{}
inline OsiArgumentValue(int32_t i32)
: TypeId(ValueType::Integer), Int32(i32)
{}
inline OsiArgumentValue(int64_t i64)
: TypeId(ValueType::Integer64), Int64(i64)
{}
inline OsiArgumentValue(OsiArgumentValue const & v)
{
*this = v;
}
inline OsiArgumentValue & operator = (OsiArgumentValue const & v)
{
TypeId = v.TypeId;
switch (v.TypeId) {
case ValueType::None:
break;
case ValueType::Integer:
Int32 = v.Int32;
break;
case ValueType::Integer64:
Int64 = v.Int64;
break;
case ValueType::Real:
Float = v.Float;
break;
case ValueType::String:
case ValueType::GuidString:
default:
String = v.String;
break;
}
return *this;
}
void Set(int32_t value);
void Set(int64_t value);
void Set(float value);
void Set(char const * value);
std::string ToString() const
{
switch (TypeId)
{
case ValueType::None:
return "(Untyped)";
case ValueType::Integer:
return std::to_string(Int32);
case ValueType::Integer64:
return std::to_string(Int64);
case ValueType::Real:
return std::to_string(Float);
case ValueType::String:
case ValueType::GuidString:
case ValueType::CharacterGuid:
case ValueType::ItemGuid:
case ValueType::TriggerGuid:
return String ? String : "";
default:
return "(Unknown)";
}
}
};
struct OsiArgumentDesc
{
OsiArgumentValue Value;
OsiArgumentDesc * NextParam;
OsiArgumentDesc()
: NextParam(nullptr)
{}
~OsiArgumentDesc()
{
if (NextParam != nullptr) {
delete NextParam;
}
}
static OsiArgumentDesc * Create(OsiArgumentValue const & v)
{
auto desc = new OsiArgumentDesc();
desc->Value = v;
return desc;
}
inline void Add(OsiArgumentValue const & v)
{
if (NextParam == nullptr)
{
NextParam = OsiArgumentDesc::Create(v);
}
else
{
NextParam->Add(v);
}
}
inline uint32_t Count() const
{
uint32_t num = 0;
auto next = this;
while (next != nullptr) {
num++;
next = next->NextParam;
}
return num;
}
inline OsiArgumentValue const & Get(uint32_t index) const
{
auto next = this;
while (index--) {
next = next->NextParam;
}
return next->Value;
}
inline OsiArgumentValue & Get(uint32_t index)
{
auto next = this;
while (index--) {
next = next->NextParam;
}
return next->Value;
}
inline OsiArgumentValue const & operator [] (uint32_t index) const
{
auto next = this;
while (index--) {
next = next->NextParam;
}
return next->Value;
}
inline OsiArgumentValue & operator [] (uint32_t index)
{
auto next = this;
while (index--) {
next = next->NextParam;
}
return next->Value;
}
inline glm::vec3 GetVector(uint32_t index) const
{
auto next = this;
while (index--) {
next = next->NextParam;
}
glm::vec3 vec;
vec.x = next->Value.Float;
vec.y = next->NextParam->Value.Float;
vec.z = next->NextParam->NextParam->Value.Float;
return vec;
}
inline void SetVector(uint32_t index, glm::vec3 const & vec)
{
auto next = this;
while (index--) {
next = next->NextParam;
}
next->Value.Float = vec.x;
next->NextParam->Value.Float = vec.y;
next->NextParam->NextParam->Value.Float = vec.z;
}
};
enum class EoCFunctionArgumentType : uint32_t
{
InParam = 1,
OutParam = 2
};
struct EoCFunctionArgument
{
char const * Name;
ValueType Type;
uint8_t __Padding[3];
EoCFunctionArgumentType ArgType;
};
struct EoCCallParam
{
EoCFunctionArgument * Argument;
union {
char * String;
int32_t Int;
float Float;
} Value;
};
struct DivFunctions
{
typedef bool (* CallProc)(uint32_t FunctionId, OsiArgumentDesc * Params);
typedef bool (* CallProc)(uint32_t FunctionId, OsiArgumentDesc * Params);
typedef void (* ErrorMessageProc)(char const * Message);
typedef void (* AssertProc)(bool Successful, char const * Message, bool Unknown2);
void * Unknown0;
CallProc Call;
CallProc Query;
ErrorMessageProc ErrorMessage;
AssertProc Assert;
};
struct BufferPool : public ProtectedGameObject<BufferPool>
{
void * VMT;
uint8_t Unknown;
uint8_t __Padding[3];
uint32_t MaxSize;
uint32_t GrowCount;
uint32_t Unknown3;
uint32_t Capacity;
uint8_t __Padding2[4];
void * PoolMemoryVMT;
void * PoolMemory;
uint32_t CurrentSize;
uint32_t SomeCounter;
uint32_t Unknown4;
uint32_t CurrentPos;
uint32_t Unknown5;
uint32_t Unknown6;
char const * Name;
};
template <typename T>
struct BaseArray
{
void * VMT;
T * Buffer;
uint32_t Capacity;
uint32_t Size;
uint32_t Free;
};
struct OsirisInterface;
struct OsirisManager;
enum class FunctionArgumentDirection : uint32_t
{
In = 1,
Out = 2
};
struct FunctionArgument
{
char const * Name;
ValueType Type;
uint8_t __Padding[3];
FunctionArgumentDirection Direction;
};
struct OsirisFunctionHandle
{
uint32_t Handle;
OsirisFunctionHandle() : Handle(0) {}
OsirisFunctionHandle(uint32_t InHandle) : Handle(InHandle) {}
OsirisFunctionHandle(uint32_t Part1, uint32_t Part2, uint32_t Part3, uint32_t Part4)
: Handle((Part1 & 7) | ((Part2 & 0x1FFFF) << 3)
| ((Part3 & 0x3FF) << 20) | (Part4 << 30))
{}
inline uint8_t GetPart1() const
{
return Handle & 7;
}
inline uint32_t GetPart2() const
{
return (Handle >> 3) & 0x1FFFF;
}
inline uint16_t GetFunctionId() const
{
return (Handle >> 20) & 0x3FF;
}
inline uint32_t GetPart4() const
{
return Handle >> 30;
}
};
struct OsirisFunction : public ProtectedGameObject<OsirisFunction>
{
void * VMT;
char const * Name;
FunctionArgument * Arguments;
uint32_t NumArguments;
uint8_t __Padding[4];
uint64_t ArgumentSize;
OsirisFunctionHandle Handle;
uint8_t __Padding2[4];
OsirisManager * Manager;
uint32_t Unknown;
uint8_t __Padding3[4];
void * StoryImplementation;
void * HandlerProc;
uint64_t Unknown2;
};
struct TypeInfo : public ProtectedGameObject<TypeInfo>
{
char const * Name;
ValueType Type;
uint8_t __Padding[1];
uint16_t Alias;
uint32_t Unknown;
uint64_t SizeInBytes;
uint64_t Unknown2;
void * TypeFunc1;
void * TypeFunc2;
};
struct FixedStringMap
{
uint32_t Capacity;
uint32_t Unknown;
void ** Buffer;
uint32_t Size;
};
struct OsirisManager : public ProtectedGameObject<OsirisManager>
{
void * Allocator;
OsirisInterface * Interface;
void * Osiris;
BaseArray<OsirisFunction *> Functions;
uint32_t CallbackBufIncrement;
BaseArray<void *> Objects;
uint32_t Unknown1;
FixedStringMap StringMap;
uint32_t Unknown2;
std::array<TypeInfo, 16> BuiltinTypes;
uint32_t Unknown3[2];
uint64_t Unknown4[3];
uint64_t NotificationBufferSize;
BaseArray<char *> NotificationBuffer;
uint32_t Unknown5;
uint32_t NotificationBufferClampedSize;
uint32_t NotificationBufferTotalSize;
uint64_t Unknown6[3];
};
struct OsirisInterface : public ProtectedGameObject<OsirisInterface>
{
void * Osiris;
OsirisManager * Manager;
BufferPool ParamBufferPool;
BufferPool ExecutionContextPool;
void * Unknown1;
void * Unknown2;
void * Unknown3;
};
struct VariableItem
{
void * ptr;
uint64_t unused;
};
struct VariableItem2
{
uint32_t a, b;
void * strptr;
uint64_t strpad, str1, str2;
};
struct VariableDb : public ProtectedGameObject<VariableDb>
{
VariableItem vars[256];
uint32_t NumVariables;
uint8_t __Padding[4];
uint16_t b;
uint8_t padding[6];
VariableItem2 * VarsStart;
VariableItem2 * VarsPtr;
VariableItem2 * VarsEnd;
};
template <class T>
struct TArray
{
uint32_t Size;
uint32_t __Padding;
T * Start, *End, *BufEnd;
};
template <class T>
struct Vector
{
T * Start, * End, * BufEnd;
};
template <class T>
struct ListNode
{
ListNode<T> * Next{ nullptr }, * Head{ nullptr };
T Item;
ListNode() {}
ListNode(T const & item)
: Item(item)
{}
};
template <class T>
struct List
{
ListNode<T> * Head{ nullptr };
uint64_t Size{ 0 };
void Init()
{
auto head = new ListNode<T>();
Init(head);
}
void Init(ListNode<T> * head)
{
Head = head;
Head->Next = head;
Head->Head = head;
Size = 0;
}
void Insert(T const & value, ListNode<T> * item, ListNode<T> * prev)
{
item->Item = value;
item->Head = Head;
item->Next = prev->Next;
prev->Next = item;
Size++;
}
ListNode<T> * Insert(T const & value, ListNode<T> * prev)
{
auto item = new ListNode<T>(value);
item->Head = Head;
item->Next = prev->Next;
prev->Next = item;
Size++;
return item;
}
void Insert(ListNode<T> * item, ListNode<T> * prev)
{
item->Head = Head;
item->Next = prev->Next;
prev->Next = item;
Size++;
}
ListNode<T> * Insert(ListNode<T> * prev)
{
auto item = new ListNode<T>();
Insert(item, prev);
return item;
}
};
template <class T, unsigned TPad>
struct Padded
{
uint8_t _Pad[TPad];
T Value;
};
template <class T>
struct Padded<T, 0>
{
T Value;
};
template <typename TKey, typename TVal, unsigned TKeyPad, unsigned TValPad>
struct TMapNode
{
TMapNode<TKey, TVal, TKeyPad, TValPad> * Left;
TMapNode<TKey, TVal, TKeyPad, TValPad> * Root;
TMapNode<TKey, TVal, TKeyPad, TValPad> * Right;
bool Color;
bool IsRoot;
Padded<TKey, TKeyPad> Key;
Padded<TVal, TValPad> Value;
};
template <typename TKey, typename TVal, unsigned TKeyPad, unsigned TValPad, class Pred = std::less<TKey>>
struct TMap
{
TMapNode<TKey, TVal, TKeyPad, TValPad> * Root;
TVal * Find(TKey const & key)
{
auto finalTreeNode = Root;
auto currentTreeNode = Root->Root;
while (!currentTreeNode->IsRoot)
{
if (Pred()(currentTreeNode->Key.Value, key)) {
currentTreeNode = currentTreeNode->Right;
} else {
finalTreeNode = currentTreeNode;
currentTreeNode = currentTreeNode->Left;
}
}
if (finalTreeNode == Root || Pred()(key, finalTreeNode->Key.Value))
return nullptr;
else
return &finalTreeNode->Value.Value;
}
template <class Visitor>
void Iterate(Visitor visitor)
{
Iterate(Root->Root, visitor);
}
template <class Visitor>
void Iterate(TMapNode<TKey, TVal, TKeyPad, TValPad> * node, Visitor visitor)
{
if (!node->IsRoot) {
visitor(node->Key.Value, node->Value.Value);
Iterate(node->Left, visitor);
Iterate(node->Right, visitor);
}
}
};
struct TypeDbLess
{
bool operator ()(STDString const & a, STDString const & b) const
{
return _stricmp(a.c_str(), b.c_str()) < 0;
}
};
template <class TValue>
struct TypeDb : public ProtectedGameObject<TypeDb<TValue>>
{
struct HashSlot
{
TMap<STDString, TValue, 6, 0, TypeDbLess> NodeMap;
void * Unknown;
};
TValue * Find(uint32_t hash, STDString const & key)
{
auto & bucket = Hash[hash % 0x3FF];
return bucket.NodeMap.Find(key);
}
template <class Visitor>
void Iterate(Visitor visitor)
{
for (uint32_t i = 0; i < 0x3FF; i++) {
HashSlot & bucket = Hash[i];
bucket.NodeMap.Iterate(visitor);
}
}
HashSlot Hash[1023];
uint32_t NumItems;
uint32_t _Pad;
uint64_t b, c, d;
};
struct SomeDbItem
{
uint64_t Unknown;
SomeDbItem * Next;
};
union Value
{
int64_t Int64;
float Float;
int32_t Int32;
char * String;
};
struct String
{
union {
char Buf[16];
char * Ptr;
};
uint64_t Length;
uint64_t BufferLength;
inline String()
: Ptr(nullptr), Length(0), BufferLength(15)
{}
};
struct TValue
{
Value Val;
uint32_t Unknown{ 0 };
uint32_t __Padding;
String Str;
};
class TypedValue
{
public:
/*virtual bool Serialize(void * SmartBuf);
virtual ~TypedValue() {};
virtual bool SetType(ValueType type);
virtual ValueType GetType();
virtual bool IsValid();
virtual void DebugDump(char * log);
virtual void SetValue(TValue * value);
virtual TValue * GetValue();
virtual bool IsVariable();
virtual void SetOutParam(bool OutParam);
virtual void SetOutParam2(bool OutParam);
virtual bool IsOutParam();
virtual uint8_t Index();
virtual bool IsUnused();
virtual bool IsAdapted();*/
void * VMT{ nullptr };
uint32_t TypeId{ 0 };
uint32_t __Padding;
TValue Value;
};
struct DatabaseParam
{
uint64_t A;
uint64_t B;
};
struct TypedValueList
{
uint64_t Size;
TypedValue Values[1];
};
class TupleVec
{
public:
virtual ~TupleVec() {};
// Ptr to (&TypedValueList->Values)
TypedValue * Values;
uint8_t Size;
uint8_t __Padding[7];
uint32_t Unknown;
};
struct TuplePtrLL
{
void * VMT;
List<TypedValue *> Items;
};
struct TupleLL
{
struct Item
{
uint8_t Index;
uint8_t __Padding[7];
TypedValue Value;
};
List<Item> Items;
};
class VirtTupleLL
{
public:
virtual ~VirtTupleLL() {}
TupleLL Data;
};
struct Database : public ProtectedGameObject<Database>
{
uint32_t DatabaseId;
uint32_t __Padding;
uint64_t B;
SomeDbItem Items[16];
uint64_t C;
void * FactsVMT;
List<TupleVec> Facts;
Vector<uint32_t> ParamTypes;
uint8_t NumParams;
uint8_t __Padding2[7];
Vector<DatabaseParam> OrderedFacts;
};
class RuleActionArguments
{
public:
void * VMT;
List<TypedValue *> Args;
};
class RuleActionNode
{
public:
const char * FunctionName;
RuleActionArguments * Arguments;
bool Not;
uint8_t __Padding[3];
int32_t GoalIdOrDebugHook;
};
class RuleActionList
{
public:
virtual ~RuleActionList() = 0;
List<RuleActionNode *> Actions;
};
struct Goal : public ProtectedGameObject<Goal>
{
RuleActionList * InitCalls;
RuleActionList * ExitCalls;
uint32_t Id;
uint32_t __Padding1;
char const * Name;
uint32_t SubGoalCombination;
uint32_t __Padding2;
TArray<uint32_t> ParentGoals;
TArray<uint32_t> SubGoals;
uint8_t Flags;
uint8_t __Padding3[7];
};
struct GoalDb
{
void * Unknown[2047];
uint32_t Count;
uint32_t __Padding;
TMap<uint32_t, Goal *, 6, 4> Goals;
};
template <class T>
struct TypedDb
{
TArray<T *> Db;
};
class VirtTupleLL;
class Node;
struct Adapter : public ProtectedGameObject<Adapter>
{
uint32_t Id;
uint32_t __Padding;
TypedDb<Adapter> * Db;
TMap<uint8_t, uint8_t, 0, 0> VarToColumnMaps;
uint64_t VarToColumnMapCount;
Vector<int8_t> ColumnToVarMaps;
VirtTupleLL Constants;
};
using DatabaseDb = TypedDb<Database>;
using AdapterDb = TypedDb<Adapter>;
using NodeDb = TypedDb<Node>;
template <typename T>
struct Ref
{
uint32_t Id;
uint32_t __Padding;
TypedDb<T> * Manager;
T * Get() const
{
if (Id == 0 || Manager == nullptr) {
return nullptr;
}
return Manager->Db.Start[Id - 1];
}
};
typedef Ref<Database> DatabaseRef;
typedef Ref<Adapter> AdapterRef;
typedef Ref<Node> NodeRef;
enum class EntryPoint : uint32_t
{
None = 0,
Left = 1,
Right = 2
};
class NodeEntryRef
{
public:
virtual void write() {}; // TODO
virtual void read() {}; // TODO
NodeRef Node;
EntryPoint EntryPoint;
uint32_t GoalId;
};
struct FunctionParamDesc
{
uint32_t Type;
uint32_t Unknown;
};
struct FunctionParamList
{
void * VMT;
List<FunctionParamDesc> Params;
};
inline int Popcnt8(uint8_t b)
{
b = b - ((b >> 1) & 0x55);
b = (b & 0x33) + ((b >> 2) & 0x33);
return (((b + (b >> 4)) & 0x0F) * 0x01);
}
struct FuncSigOutParamList
{
uint8_t * Params;
// Number of param bytes
uint32_t Count;
inline uint32_t numOutParams() const
{
uint32_t numParams = 0;
for (uint32_t i = 0; i < Count; i++) {
numParams += Popcnt8(Params[i]);
}
return numParams;
}
inline bool isOutParam(unsigned i) const
{
assert(i < Count*8);
return ((Params[i >> 3] << (i & 7)) & 0x80) == 0x80;
}
};
struct FunctionSignature
{
void * VMT;
const char * Name;
FunctionParamList * Params;
FuncSigOutParamList OutParamList;
uint32_t Unknown;
};
enum class FunctionType : uint32_t
{
Unknown = 0,
Event = 1,
Query = 2,
Call = 3,
Database = 4,
Proc = 5,
SysQuery = 6,
SysCall = 7,
UserQuery = 8
};
struct Function : public ProtectedGameObject<Function>
{
void * VMT;
uint32_t Line;
uint32_t Unknown1;
uint32_t Unknown2;
uint32_t __Padding;
FunctionSignature * Signature;
NodeRef Node;
FunctionType Type;
uint32_t Key[4];
uint32_t Unknown3;
inline uint32_t GetHandle() const
{
return OsirisFunctionHandle(Key[0], Key[1], Key[2], Key[3]).Handle;
}
};
// Osiris -> EoCApp function mapping info
struct MappingInfo
{
const char * Name;
uint32_t Id;
uint32_t NumParams;
};
struct NodeVMT
{
using DestroyProc = void (*)(Node * self, bool free);
using GetDatabaseRefProc = DatabaseRef * (*)(Node * self, DatabaseRef * ref);
using IsDataNodeProc = bool (*)(Node * self);
using IsValidProc = bool(*)(Node * self, VirtTupleLL * Values, AdapterRef * Adapter);
using IsProcProc = bool(*)(Node * self);
using IsPartOfAProcProc = bool(*)(Node * self);
using GetParentProc = NodeRef * (*)(Node * self, NodeRef * ref);
using SetNextNodeProc = void (*)(Node * self, NodeEntryRef * ref);
using GetAdapterProc = Adapter * (*)(Node * self, EntryPoint which);
using InsertTupleProc = void (*)(Node * self, TuplePtrLL * tuple);
using PushDownTupleProc = void(*)(Node * self, VirtTupleLL * tuple, AdapterRef * adapter, EntryPoint entryPoint);
using TriggerInsertEventProc = void (*)(Node * self, TupleVec * tuple);
using GetLowDatabaseRefProc = NodeRef * (*)(Node * self, NodeRef * ref);
using GetLowDatabaseProc = NodeEntryRef * (*)(Node * self, NodeEntryRef * ref);
using GetLowDatabaseIndirectionProc = int (*)(Node * self);
using SaveProc = bool (*)(Node * self, void * buf);
using DebugDumpProc = char * (*)(Node * self, char * buf);
using SetLineNumberProc = void (*)(Node * self, unsigned int line);
using CallQueryProc = bool (*)(Node * self, OsiArgumentDesc * args);
using GetQueryNameProc = const char * (*)(Node * self);
DestroyProc Destroy; // 0
GetDatabaseRefProc GetDatabaseRef; // 8
GetDatabaseRefProc GetDatabaseRef2; // 10
IsDataNodeProc IsDataNode; // 18
IsValidProc IsValid; // 20
IsProcProc IsProc; // 28
IsPartOfAProcProc IsPartOfAProc; // 30
GetParentProc GetParent; // 38
SetNextNodeProc SetNextNode; // 40
GetAdapterProc GetAdapter; // 48
InsertTupleProc InsertTuple; // 50
PushDownTupleProc PushDownTuple; // 58
InsertTupleProc DeleteTuple; // 60
PushDownTupleProc PushDownTupleDelete; // 68
TriggerInsertEventProc TriggerInsertEvent; // 70
TriggerInsertEventProc TriggerDeleteEvent; // 78
GetLowDatabaseRefProc GetLowDatabaseRef; // 80
GetLowDatabaseProc GetLowDatabase; // 88
GetLowDatabaseIndirectionProc GetLowDatabaseFlags; // 90
SaveProc Save; // 98
DebugDumpProc DebugDump; // A0
DebugDumpProc DebugDump2; // A8
SetLineNumberProc SetLineNumber; // B0
union { // B8
void * RelUnused;
CallQueryProc CallQuery;
};
GetQueryNameProc GetQueryName; // C0
};
class Node : public Noncopyable<Node>
{
public:
virtual ~Node() = 0;
virtual DatabaseRef * GetDatabaseRef(DatabaseRef * Db) = 0;
virtual DatabaseRef * GetDatabaseRef2(DatabaseRef * Db) = 0;
virtual bool IsDataNode() = 0;
virtual bool IsValid(VirtTupleLL * Tuple, AdapterRef * Adapter) = 0;
virtual bool IsProc() = 0;
virtual bool IsPartOfAProc() = 0;
virtual NodeRef * GetParent(NodeRef * Node) = 0;
virtual void SetNextNode(NodeEntryRef * Node) = 0;
virtual Adapter * GetAdapter(EntryPoint Which) = 0;
virtual void InsertTuple(TuplePtrLL * Tuple) = 0;
virtual void PushDownTuple(VirtTupleLL * Tuple, AdapterRef * Adapter, EntryPoint Which, NodeRef Ref) = 0;
virtual void DeleteTuple(TuplePtrLL * Tuple) = 0;
virtual void PushDownTupleDelete(VirtTupleLL * Tuple, AdapterRef * Adapter, EntryPoint Which, NodeRef Ref) = 0;
virtual void TriggerInsertEvent(TupleVec * Tuple) = 0;
virtual void TriggerInsertEvent2(TupleVec * Tuple) = 0;
virtual NodeRef * GetLowDatabaseRef(NodeRef * Node) = 0;
virtual NodeEntryRef * GetLowDatabase(NodeEntryRef * Node) = 0;
virtual uint8_t GetLowDatabaseIndirection() = 0;
virtual bool Save(void * SmartBuf) = 0;
virtual char * DebugDump(char * Buffer) = 0;
virtual char * DebugDump2(char * Buffer) = 0;
virtual void SetLineNumber(int Line) = 0;
uint32_t Id;
uint32_t __Padding0;
NodeDb * NodeDb;
Function * Function;
DatabaseRef Database;
};
class TreeNode : public Node
{
public:
NodeEntryRef Next;
};
class RelNode : public TreeNode
{
public:
NodeRef Parent;
AdapterRef Adapter;
NodeRef RelDatabaseRef;
NodeEntryRef RelDatabase;
uint8_t RelDatabaseIndirection;
uint8_t __Padding[7];
};
class RelOpNode : public RelNode
{
public:
uint8_t LeftValueIndex;
uint8_t RightValueIndex;
uint8_t __Padding2[6];
TypedValue LeftValue;
TypedValue RightValue;
uint32_t RelOp;
uint32_t __Padding3;
static inline void HookVMTs(NodeVMT * vmt) {}
};
class RuleNode : public RelNode
{
public:
uint32_t Line;
bool IsQuery;
uint8_t __Padding2[3];
void * Variables;
RuleActionList * Calls;
static inline void HookVMTs(NodeVMT * vmt) {}
};
class JoinNode : public TreeNode
{
public:
NodeRef Left;
NodeRef Right;
AdapterRef LeftAdapter;
AdapterRef RightAdapter;
uint64_t Unknown;
NodeRef LeftDatabaseRef;
NodeEntryRef LeftDatabase;
uint8_t LeftDatabaseIndirection;
uint8_t __Padding1[7];
NodeRef RightDatabaseRef;
NodeEntryRef RightDatabase;
uint8_t RightDatabaseIndirection;
uint8_t __Padding2[7];
};
class AndNode : public JoinNode
{
public:
static inline void HookVMTs(NodeVMT * vmt) {}
};
class NotAndNode : public JoinNode
{
public:
static inline void HookVMTs(NodeVMT * vmt) {}
};
struct DataNodeRef
{
DataNodeRef * Head;
DataNodeRef * Prev;
NodeEntryRef Reference;
};
struct DataNodeReferenceList
{
DataNodeRef * Head;
uint64_t Count;
};
class DataNode : public Node
{
public:
uint32_t UsedBy;
};
class ProcNode : public DataNode
{
public:
uint32_t UsedBy;
};
class DatabaseNode : public DataNode
{
public:
uint32_t UsedBy;
};
class QueryNode : public Node
{
};
class UserQueryNode : public QueryNode
{
};
class DivQueryNode : public QueryNode
{
};
class InternalQueryNode : public QueryNode
{
};
#pragma pack(pop)
// Used by COsiris::Event()
enum class ReturnCode
{
EventProcessed = 0,
FunctionUndefined = 1,
EventIgnored = 2
};
enum class NodeType
{
None = 0,
Database = 1,
Proc = 2,
DivQuery = 3,
And = 4,
NotAnd = 5,
RelOp = 6,
Rule = 7,
InternalQuery = 8,
UserQuery = 9,
Max = UserQuery
};
enum DebugFlag
{
DF_FunctionList = 1 << 16,
DF_NodeList = 1 << 17,
DF_CompileTrace = 1 << 18,
DF_DebugTrace = 1 << 19,
DF_DebugFacts = 1 << 20,
DF_LogRuleFailures = 1 << 21,
DF_ListOrphans = 1 << 22,
DF_SuppressInitLog = 1 << 23,
DF_LogFactFailures = 1 << 24,
DF_LogSuccessfulFacts = 1 << 25,
DF_LogFailedFacts = 1 << 26,
DF_SuppressRuleVariables = 1 << 27,
DF_SuppressParentGoals = 1 << 28,
DF_SuppressUnknown = 1 << 29,
DF_SuppressQueryResults = 1 << 30,
DF_DumpDatabases = 1 << 31
};
typedef void (* COsirisOpenLogFileProc)(void * Osiris, wchar_t const * Path, wchar_t const * Mode);
typedef void (* COsirisCloseLogFileProc)(void * Osiris);
typedef bool (* COsirisCompileProc)(void * Osiris, wchar_t const * path, wchar_t const * mode);
typedef int (* COsirisInitGameProc)(void * Osiris);
typedef int (* COsirisLoadProc)(void * Osiris, void * Buf);
typedef bool (* COsirisMergeProc)(void * Osiris, wchar_t * Src);
typedef bool(* COsirisGetFunctionMappingsProc)(void * Osiris, MappingInfo ** mappings, uint32_t * mappingCount);
typedef int (* COsirisDeleteAllDataProc)(void * Osiris, bool DeleteTypes);
typedef int (* COsirisReadHeaderProc)(void * Osiris, void * OsiSmartBuf, unsigned __int8 * MajorVersion, unsigned __int8 * MinorVersion, unsigned __int8 * BigEndian, unsigned __int8 * Unused, char * StoryFileVersion, unsigned int * DebugFlags);
typedef void (* RuleActionCallProc)(RuleActionNode * Action, void * a1, void * a2, void * a3, void * a4);
using OsiTypeDb = TypeDb<TypeInfo *>;
using FunctionDb = TypeDb<Function *>;
using ObjectDb = TypeDb<void *>;
struct OsirisStaticGlobals
{
VariableDb ** Variables{ nullptr };
OsiTypeDb ** Types{ nullptr };
FunctionDb ** Functions{ nullptr };
ObjectDb ** Objects{ nullptr };
GoalDb ** Goals{ nullptr };
AdapterDb ** Adapters{ nullptr };
DatabaseDb ** Databases{ nullptr };
NodeDb ** Nodes{ nullptr };
DebugFlag * DebugFlags{ nullptr };
void * TypedValueVMT{ nullptr };
};
struct OsirisDynamicGlobals
{
void * OsirisObject{ nullptr };
OsirisManager * Manager{ nullptr };
};
}
| [
"infernorb@gmail.com"
] | infernorb@gmail.com |
31adabdd062313e9e6cad65e26cdd9b90212a95c | ad40bdafbbe6a68ccf41c212e07f40c70c971242 | /Encoder.h | 6f5f4db31b835184a8521049ba8db859f7c3c101 | [] | no_license | tdurrer5/cnc_ctrlv1_timer | f0699cf046b2f817a8fc1dd41c4e5318c0510d9e | a57a113eadf73e81fd5b4cbd997b01d378336089 | refs/heads/main | 2023-04-24T17:24:24.669499 | 2021-05-12T20:50:10 | 2021-05-12T20:50:10 | 366,847,983 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 27,731 | h | /* Encoder Library, for measuring quadrature encoded signals
* http://www.pjrc.com/teensy/td_libs_Encoder.html
* Copyright (c) 2011,2013 PJRC.COM, LLC - Paul Stoffregen <paul@pjrc.com>
*
* Version 1.2 - fix -2 bug in C-only code
* Version 1.1 - expand to support boards with up to 60 interrupts
* Version 1.0 - initial release
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#ifndef Encoder_h_
#define Encoder_h_
#if defined(ARDUINO) && ARDUINO >= 100
#include "Arduino.h"
#elif defined(WIRING)
#include "Wiring.h"
#else
//#include "WProgram.h"
//#include "pins_arduino.h"
#endif
#if defined(ENCODER_USE_INTERRUPTS) || !defined(ENCODER_DO_NOT_USE_INTERRUPTS)
#define ENCODER_USE_INTERRUPTS
#define ENCODER_ARGLIST_SIZE CORE_NUM_INTERRUPT
#include "utility/interrupt_pins.h"
#ifdef ENCODER_OPTIMIZE_INTERRUPTS
#include "utility/interrupt_config.h"
#endif
#else
#define ENCODER_ARGLIST_SIZE 0
#endif
// All the data needed by interrupts is consolidated into this ugly struct
// to facilitate assembly language optimizing of the speed critical update.
// The assembly code uses auto-incrementing addressing modes, so the struct
// must remain in exactly this order.
typedef struct {
volatile IO_REG_TYPE * pin1_register;
volatile IO_REG_TYPE * pin2_register;
IO_REG_TYPE pin1_bitmask;
IO_REG_TYPE pin2_bitmask;
uint8_t state;
int32_t position;
int32_t elapsedTime;
int32_t lastTime;
} Encoder_internal_state_t;
class Encoder
{
public:
void setup(uint8_t pin1, uint8_t pin2) {
#ifdef INPUT_PULLUP
pinMode(pin1, INPUT_PULLUP);
pinMode(pin2, INPUT_PULLUP);
#else
pinMode(pin1, INPUT);
digitalWrite(pin1, HIGH);
pinMode(pin2, INPUT);
digitalWrite(pin2, HIGH);
#endif
encoder.pin1_register = PIN_TO_BASEREG(pin1);
encoder.pin1_bitmask = PIN_TO_BITMASK(pin1);
encoder.pin2_register = PIN_TO_BASEREG(pin2);
encoder.pin2_bitmask = PIN_TO_BITMASK(pin2);
encoder.position = 0;
// allow time for a passive R-C filter to charge
// through the pullup resistors, before reading
// the initial state
delayMicroseconds(2000);
uint8_t s = 0;
if (DIRECT_PIN_READ(encoder.pin1_register, encoder.pin1_bitmask)) s |= 1;
if (DIRECT_PIN_READ(encoder.pin2_register, encoder.pin2_bitmask)) s |= 2;
encoder.state = s;
#ifdef ENCODER_USE_INTERRUPTS
interrupts_in_use = attach_interrupt(pin1, &encoder);
interrupts_in_use += attach_interrupt(pin2, &encoder);
#endif
//update_finishup(); // to force linker to include the code (does not work)
}
#ifdef ENCODER_USE_INTERRUPTS
inline int32_t read() {
if (interrupts_in_use < 2) {
noInterrupts();
update(&encoder);
} else {
noInterrupts();
}
int32_t ret = encoder.position;
interrupts();
return ret;
}
inline int32_t elapsedTime() {
if (interrupts_in_use < 2) {
noInterrupts();
update(&encoder);
} else {
noInterrupts();
}
int32_t ret = encoder.elapsedTime;
interrupts();
return ret;
}
inline int32_t lastStepTime() {
if (interrupts_in_use < 2) {
noInterrupts();
update(&encoder);
} else {
noInterrupts();
}
int32_t ret = encoder.lastTime;
interrupts();
return ret;
}
inline void write(int32_t p) {
noInterrupts();
encoder.position = p;
interrupts();
}
#else
inline int32_t read() {
update(&encoder);
return encoder.position;
}
inline void write(int32_t p) {
encoder.position = p;
}
#endif
private:
Encoder_internal_state_t encoder;
#ifdef ENCODER_USE_INTERRUPTS
uint8_t interrupts_in_use;
#endif
public:
static Encoder_internal_state_t * interruptArgs[ENCODER_ARGLIST_SIZE];
// _______ _______
// Pin1 ______| |_______| |______ Pin1
// negative <--- _______ _______ __ --> positive
// Pin2 __| |_______| |_______| Pin2
// new new old old
// pin2 pin1 pin2 pin1 Result
// ---- ---- ---- ---- ------
// 0 0 0 0 no movement
// 0 0 0 1 +1
// 0 0 1 0 -1
// 0 0 1 1 +2 (assume pin1 edges only)
// 0 1 0 0 -1
// 0 1 0 1 no movement
// 0 1 1 0 -2 (assume pin1 edges only)
// 0 1 1 1 +1
// 1 0 0 0 +1
// 1 0 0 1 -2 (assume pin1 edges only)
// 1 0 1 0 no movement
// 1 0 1 1 -1
// 1 1 0 0 +2 (assume pin1 edges only)
// 1 1 0 1 -1
// 1 1 1 0 +1
// 1 1 1 1 no movement
/*
// Simple, easy-to-read "documentation" version :-)
//
void update(void) {
uint8_t s = state & 3;
if (digitalRead(pin1)) s |= 4;
if (digitalRead(pin2)) s |= 8;
switch (s) {
case 0: case 5: case 10: case 15:
break;
case 1: case 7: case 8: case 14:
position++; break;
case 2: case 4: case 11: case 13:
position--; break;
case 3: case 12:
position += 2; break;
default:
position -= 2; break;
}
state = (s >> 2);
}
*/
private:
static void update(Encoder_internal_state_t *arg) {
#if defined(__AVR_DISABLED__)
// Changed from __AVR__ to force C code below, until someone has
// the chance to write the elapsedTime feature into assembly
// code. The time difference between the two options is
// minimal at best.
// The compiler believes this is just 1 line of code, so
// it will inline this function into each interrupt
// handler. That's a tiny bit faster, but grows the code.
// Especially when used with ENCODER_OPTIMIZE_INTERRUPTS,
// the inline nature allows the ISR prologue and epilogue
// to only save/restore necessary registers, for very nice
// speed increase.
asm volatile (
"ld r30, X+" "\n\t"
"ld r31, X+" "\n\t"
"ld r24, Z" "\n\t" // r24 = pin1 input
"ld r30, X+" "\n\t"
"ld r31, X+" "\n\t"
"ld r25, Z" "\n\t" // r25 = pin2 input
"ld r30, X+" "\n\t" // r30 = pin1 mask
"ld r31, X+" "\n\t" // r31 = pin2 mask
"ld r22, X" "\n\t" // r22 = state
"andi r22, 3" "\n\t"
"and r24, r30" "\n\t"
"breq L%=1" "\n\t" // if (pin1)
"ori r22, 4" "\n\t" // state |= 4
"L%=1:" "and r25, r31" "\n\t"
"breq L%=2" "\n\t" // if (pin2)
"ori r22, 8" "\n\t" // state |= 8
"L%=2:" "ldi r30, lo8(pm(L%=table))" "\n\t"
"ldi r31, hi8(pm(L%=table))" "\n\t"
"add r30, r22" "\n\t"
"adc r31, __zero_reg__" "\n\t"
"asr r22" "\n\t"
"asr r22" "\n\t"
"st X+, r22" "\n\t" // store new state
"ld r22, X+" "\n\t"
"ld r23, X+" "\n\t"
"ld r24, X+" "\n\t"
"ld r25, X+" "\n\t"
"ijmp" "\n\t" // jumps to update_finishup()
// TODO move this table to another static function,
// so it doesn't get needlessly duplicated. Easier
// said than done, due to linker issues and inlining
"L%=table:" "\n\t"
"rjmp L%=end" "\n\t" // 0
"rjmp L%=plus1" "\n\t" // 1
"rjmp L%=minus1" "\n\t" // 2
"rjmp L%=plus2" "\n\t" // 3
"rjmp L%=minus1" "\n\t" // 4
"rjmp L%=end" "\n\t" // 5
"rjmp L%=minus2" "\n\t" // 6
"rjmp L%=plus1" "\n\t" // 7
"rjmp L%=plus1" "\n\t" // 8
"rjmp L%=minus2" "\n\t" // 9
"rjmp L%=end" "\n\t" // 10
"rjmp L%=minus1" "\n\t" // 11
"rjmp L%=plus2" "\n\t" // 12
"rjmp L%=minus1" "\n\t" // 13
"rjmp L%=plus1" "\n\t" // 14
"rjmp L%=end" "\n\t" // 15
"L%=minus2:" "\n\t"
"subi r22, 2" "\n\t"
"sbci r23, 0" "\n\t"
"sbci r24, 0" "\n\t"
"sbci r25, 0" "\n\t"
"rjmp L%=store" "\n\t"
"L%=minus1:" "\n\t"
"subi r22, 1" "\n\t"
"sbci r23, 0" "\n\t"
"sbci r24, 0" "\n\t"
"sbci r25, 0" "\n\t"
"rjmp L%=store" "\n\t"
"L%=plus2:" "\n\t"
"subi r22, 254" "\n\t"
"rjmp L%=z" "\n\t"
"L%=plus1:" "\n\t"
"subi r22, 255" "\n\t"
"L%=z:" "sbci r23, 255" "\n\t"
"sbci r24, 255" "\n\t"
"sbci r25, 255" "\n\t"
"L%=store:" "\n\t"
"st -X, r25" "\n\t"
"st -X, r24" "\n\t"
"st -X, r23" "\n\t"
"st -X, r22" "\n\t"
"L%=end:" "\n"
: : "x" (arg) : "r22", "r23", "r24", "r25", "r30", "r31");
#else
uint8_t p1val = DIRECT_PIN_READ(arg->pin1_register, arg->pin1_bitmask);
uint8_t p2val = DIRECT_PIN_READ(arg->pin2_register, arg->pin2_bitmask);
uint8_t state = arg->state & 3;
if (p1val) state |= 4;
if (p2val) state |= 8;
arg->state = (state >> 2);
switch (state) {
case 1: case 7: case 8: case 14:
arg->position++;
arg->elapsedTime = (micros() - arg->lastTime);
arg->lastTime = micros();
return;
case 2: case 4: case 11: case 13:
arg->position--;
arg->elapsedTime = (arg->lastTime - micros());
arg->lastTime = micros();
return;
case 3: case 12:
arg->position += 2;
arg->elapsedTime = (micros() - arg->lastTime) >> 1;
arg->lastTime = micros();
return;
case 6: case 9:
arg->position -= 2;
arg->elapsedTime = (arg->lastTime - micros()) >> 1;
arg->lastTime = micros();
return;
}
#endif
}
/*
#if defined(__AVR__)
// TODO: this must be a no inline function
// even noinline does not seem to solve difficult
// problems with this. Oh well, it was only meant
// to shrink code size - there's no performance
// improvement in this, only code size reduction.
__attribute__((noinline)) void update_finishup(void) {
asm volatile (
"ldi r30, lo8(pm(Ltable))" "\n\t"
"ldi r31, hi8(pm(Ltable))" "\n\t"
"Ltable:" "\n\t"
"rjmp L%=end" "\n\t" // 0
"rjmp L%=plus1" "\n\t" // 1
"rjmp L%=minus1" "\n\t" // 2
"rjmp L%=plus2" "\n\t" // 3
"rjmp L%=minus1" "\n\t" // 4
"rjmp L%=end" "\n\t" // 5
"rjmp L%=minus2" "\n\t" // 6
"rjmp L%=plus1" "\n\t" // 7
"rjmp L%=plus1" "\n\t" // 8
"rjmp L%=minus2" "\n\t" // 9
"rjmp L%=end" "\n\t" // 10
"rjmp L%=minus1" "\n\t" // 11
"rjmp L%=plus2" "\n\t" // 12
"rjmp L%=minus1" "\n\t" // 13
"rjmp L%=plus1" "\n\t" // 14
"rjmp L%=end" "\n\t" // 15
"L%=minus2:" "\n\t"
"subi r22, 2" "\n\t"
"sbci r23, 0" "\n\t"
"sbci r24, 0" "\n\t"
"sbci r25, 0" "\n\t"
"rjmp L%=store" "\n\t"
"L%=minus1:" "\n\t"
"subi r22, 1" "\n\t"
"sbci r23, 0" "\n\t"
"sbci r24, 0" "\n\t"
"sbci r25, 0" "\n\t"
"rjmp L%=store" "\n\t"
"L%=plus2:" "\n\t"
"subi r22, 254" "\n\t"
"rjmp L%=z" "\n\t"
"L%=plus1:" "\n\t"
"subi r22, 255" "\n\t"
"L%=z:" "sbci r23, 255" "\n\t"
"sbci r24, 255" "\n\t"
"sbci r25, 255" "\n\t"
"L%=store:" "\n\t"
"st -X, r25" "\n\t"
"st -X, r24" "\n\t"
"st -X, r23" "\n\t"
"st -X, r22" "\n\t"
"L%=end:" "\n"
: : : "r22", "r23", "r24", "r25", "r30", "r31");
}
#endif
*/
#ifdef ENCODER_USE_INTERRUPTS
// this giant function is an unfortunate consequence of Arduino's
// attachInterrupt function not supporting any way to pass a pointer
// or other context to the attached function.
static uint8_t attach_interrupt(uint8_t pin, Encoder_internal_state_t *state) {
switch (pin) {
#ifdef CORE_INT0_PIN
case CORE_INT0_PIN:
interruptArgs[0] = state;
attachInterrupt(0, isr0, CHANGE);
break;
#endif
#ifdef CORE_INT1_PIN
case CORE_INT1_PIN:
interruptArgs[1] = state;
attachInterrupt(1, isr1, CHANGE);
break;
#endif
#ifdef CORE_INT2_PIN
case CORE_INT2_PIN:
interruptArgs[2] = state;
attachInterrupt(2, isr2, CHANGE);
break;
#endif
#ifdef CORE_INT3_PIN
case CORE_INT3_PIN:
interruptArgs[3] = state;
attachInterrupt(3, isr3, CHANGE);
break;
#endif
#ifdef CORE_INT4_PIN
case CORE_INT4_PIN:
interruptArgs[4] = state;
attachInterrupt(4, isr4, CHANGE);
break;
#endif
#ifdef CORE_INT5_PIN
case CORE_INT5_PIN:
interruptArgs[5] = state;
attachInterrupt(5, isr5, CHANGE);
break;
#endif
#ifdef CORE_INT6_PIN
case CORE_INT6_PIN:
interruptArgs[6] = state;
attachInterrupt(6, isr6, CHANGE);
break;
#endif
#ifdef CORE_INT7_PIN
case CORE_INT7_PIN:
interruptArgs[7] = state;
attachInterrupt(7, isr7, CHANGE);
break;
#endif
#ifdef CORE_INT8_PIN
case CORE_INT8_PIN:
interruptArgs[8] = state;
attachInterrupt(8, isr8, CHANGE);
break;
#endif
#ifdef CORE_INT9_PIN
case CORE_INT9_PIN:
interruptArgs[9] = state;
attachInterrupt(9, isr9, CHANGE);
break;
#endif
#ifdef CORE_INT10_PIN
case CORE_INT10_PIN:
interruptArgs[10] = state;
attachInterrupt(10, isr10, CHANGE);
break;
#endif
#ifdef CORE_INT11_PIN
case CORE_INT11_PIN:
interruptArgs[11] = state;
attachInterrupt(11, isr11, CHANGE);
break;
#endif
#ifdef CORE_INT12_PIN
case CORE_INT12_PIN:
interruptArgs[12] = state;
attachInterrupt(12, isr12, CHANGE);
break;
#endif
#ifdef CORE_INT13_PIN
case CORE_INT13_PIN:
interruptArgs[13] = state;
attachInterrupt(13, isr13, CHANGE);
break;
#endif
#ifdef CORE_INT14_PIN
case CORE_INT14_PIN:
interruptArgs[14] = state;
attachInterrupt(14, isr14, CHANGE);
break;
#endif
#ifdef CORE_INT15_PIN
case CORE_INT15_PIN:
interruptArgs[15] = state;
attachInterrupt(15, isr15, CHANGE);
break;
#endif
#ifdef CORE_INT16_PIN
case CORE_INT16_PIN:
interruptArgs[16] = state;
attachInterrupt(16, isr16, CHANGE);
break;
#endif
#ifdef CORE_INT17_PIN
case CORE_INT17_PIN:
interruptArgs[17] = state;
attachInterrupt(17, isr17, CHANGE);
break;
#endif
#ifdef CORE_INT18_PIN
case CORE_INT18_PIN:
interruptArgs[18] = state;
attachInterrupt(18, isr18, CHANGE);
break;
#endif
#ifdef CORE_INT19_PIN
case CORE_INT19_PIN:
interruptArgs[19] = state;
attachInterrupt(19, isr19, CHANGE);
break;
#endif
#ifdef CORE_INT20_PIN
case CORE_INT20_PIN:
interruptArgs[20] = state;
attachInterrupt(20, isr20, CHANGE);
break;
#endif
#ifdef CORE_INT21_PIN
case CORE_INT21_PIN:
interruptArgs[21] = state;
attachInterrupt(21, isr21, CHANGE);
break;
#endif
#ifdef CORE_INT22_PIN
case CORE_INT22_PIN:
interruptArgs[22] = state;
attachInterrupt(22, isr22, CHANGE);
break;
#endif
#ifdef CORE_INT23_PIN
case CORE_INT23_PIN:
interruptArgs[23] = state;
attachInterrupt(23, isr23, CHANGE);
break;
#endif
#ifdef CORE_INT24_PIN
case CORE_INT24_PIN:
interruptArgs[24] = state;
attachInterrupt(24, isr24, CHANGE);
break;
#endif
#ifdef CORE_INT25_PIN
case CORE_INT25_PIN:
interruptArgs[25] = state;
attachInterrupt(25, isr25, CHANGE);
break;
#endif
#ifdef CORE_INT26_PIN
case CORE_INT26_PIN:
interruptArgs[26] = state;
attachInterrupt(26, isr26, CHANGE);
break;
#endif
#ifdef CORE_INT27_PIN
case CORE_INT27_PIN:
interruptArgs[27] = state;
attachInterrupt(27, isr27, CHANGE);
break;
#endif
#ifdef CORE_INT28_PIN
case CORE_INT28_PIN:
interruptArgs[28] = state;
attachInterrupt(28, isr28, CHANGE);
break;
#endif
#ifdef CORE_INT29_PIN
case CORE_INT29_PIN:
interruptArgs[29] = state;
attachInterrupt(29, isr29, CHANGE);
break;
#endif
#ifdef CORE_INT30_PIN
case CORE_INT30_PIN:
interruptArgs[30] = state;
attachInterrupt(30, isr30, CHANGE);
break;
#endif
#ifdef CORE_INT31_PIN
case CORE_INT31_PIN:
interruptArgs[31] = state;
attachInterrupt(31, isr31, CHANGE);
break;
#endif
#ifdef CORE_INT32_PIN
case CORE_INT32_PIN:
interruptArgs[32] = state;
attachInterrupt(32, isr32, CHANGE);
break;
#endif
#ifdef CORE_INT33_PIN
case CORE_INT33_PIN:
interruptArgs[33] = state;
attachInterrupt(33, isr33, CHANGE);
break;
#endif
#ifdef CORE_INT34_PIN
case CORE_INT34_PIN:
interruptArgs[34] = state;
attachInterrupt(34, isr34, CHANGE);
break;
#endif
#ifdef CORE_INT35_PIN
case CORE_INT35_PIN:
interruptArgs[35] = state;
attachInterrupt(35, isr35, CHANGE);
break;
#endif
#ifdef CORE_INT36_PIN
case CORE_INT36_PIN:
interruptArgs[36] = state;
attachInterrupt(36, isr36, CHANGE);
break;
#endif
#ifdef CORE_INT37_PIN
case CORE_INT37_PIN:
interruptArgs[37] = state;
attachInterrupt(37, isr37, CHANGE);
break;
#endif
#ifdef CORE_INT38_PIN
case CORE_INT38_PIN:
interruptArgs[38] = state;
attachInterrupt(38, isr38, CHANGE);
break;
#endif
#ifdef CORE_INT39_PIN
case CORE_INT39_PIN:
interruptArgs[39] = state;
attachInterrupt(39, isr39, CHANGE);
break;
#endif
#ifdef CORE_INT40_PIN
case CORE_INT40_PIN:
interruptArgs[40] = state;
attachInterrupt(40, isr40, CHANGE);
break;
#endif
#ifdef CORE_INT41_PIN
case CORE_INT41_PIN:
interruptArgs[41] = state;
attachInterrupt(41, isr41, CHANGE);
break;
#endif
#ifdef CORE_INT42_PIN
case CORE_INT42_PIN:
interruptArgs[42] = state;
attachInterrupt(42, isr42, CHANGE);
break;
#endif
#ifdef CORE_INT43_PIN
case CORE_INT43_PIN:
interruptArgs[43] = state;
attachInterrupt(43, isr43, CHANGE);
break;
#endif
#ifdef CORE_INT44_PIN
case CORE_INT44_PIN:
interruptArgs[44] = state;
attachInterrupt(44, isr44, CHANGE);
break;
#endif
#ifdef CORE_INT45_PIN
case CORE_INT45_PIN:
interruptArgs[45] = state;
attachInterrupt(45, isr45, CHANGE);
break;
#endif
#ifdef CORE_INT46_PIN
case CORE_INT46_PIN:
interruptArgs[46] = state;
attachInterrupt(46, isr46, CHANGE);
break;
#endif
#ifdef CORE_INT47_PIN
case CORE_INT47_PIN:
interruptArgs[47] = state;
attachInterrupt(47, isr47, CHANGE);
break;
#endif
#ifdef CORE_INT48_PIN
case CORE_INT48_PIN:
interruptArgs[48] = state;
attachInterrupt(48, isr48, CHANGE);
break;
#endif
#ifdef CORE_INT49_PIN
case CORE_INT49_PIN:
interruptArgs[49] = state;
attachInterrupt(49, isr49, CHANGE);
break;
#endif
#ifdef CORE_INT50_PIN
case CORE_INT50_PIN:
interruptArgs[50] = state;
attachInterrupt(50, isr50, CHANGE);
break;
#endif
#ifdef CORE_INT51_PIN
case CORE_INT51_PIN:
interruptArgs[51] = state;
attachInterrupt(51, isr51, CHANGE);
break;
#endif
#ifdef CORE_INT52_PIN
case CORE_INT52_PIN:
interruptArgs[52] = state;
attachInterrupt(52, isr52, CHANGE);
break;
#endif
#ifdef CORE_INT53_PIN
case CORE_INT53_PIN:
interruptArgs[53] = state;
attachInterrupt(53, isr53, CHANGE);
break;
#endif
#ifdef CORE_INT54_PIN
case CORE_INT54_PIN:
interruptArgs[54] = state;
attachInterrupt(54, isr54, CHANGE);
break;
#endif
#ifdef CORE_INT55_PIN
case CORE_INT55_PIN:
interruptArgs[55] = state;
attachInterrupt(55, isr55, CHANGE);
break;
#endif
#ifdef CORE_INT56_PIN
case CORE_INT56_PIN:
interruptArgs[56] = state;
attachInterrupt(56, isr56, CHANGE);
break;
#endif
#ifdef CORE_INT57_PIN
case CORE_INT57_PIN:
interruptArgs[57] = state;
attachInterrupt(57, isr57, CHANGE);
break;
#endif
#ifdef CORE_INT58_PIN
case CORE_INT58_PIN:
interruptArgs[58] = state;
attachInterrupt(58, isr58, CHANGE);
break;
#endif
#ifdef CORE_INT59_PIN
case CORE_INT59_PIN:
interruptArgs[59] = state;
attachInterrupt(59, isr59, CHANGE);
break;
#endif
default:
return 0;
}
return 1;
}
#endif // ENCODER_USE_INTERRUPTS
#if defined(ENCODER_USE_INTERRUPTS) && !defined(ENCODER_OPTIMIZE_INTERRUPTS)
#ifdef CORE_INT0_PIN
static void isr0(void) { update(interruptArgs[0]); }
#endif
#ifdef CORE_INT1_PIN
static void isr1(void) { update(interruptArgs[1]); }
#endif
#ifdef CORE_INT2_PIN
static void isr2(void) { update(interruptArgs[2]); }
#endif
#ifdef CORE_INT3_PIN
static void isr3(void) { update(interruptArgs[3]); }
#endif
#ifdef CORE_INT4_PIN
static void isr4(void) { update(interruptArgs[4]); }
#endif
#ifdef CORE_INT5_PIN
static void isr5(void) { update(interruptArgs[5]); }
#endif
#ifdef CORE_INT6_PIN
static void isr6(void) { update(interruptArgs[6]); }
#endif
#ifdef CORE_INT7_PIN
static void isr7(void) { update(interruptArgs[7]); }
#endif
#ifdef CORE_INT8_PIN
static void isr8(void) { update(interruptArgs[8]); }
#endif
#ifdef CORE_INT9_PIN
static void isr9(void) { update(interruptArgs[9]); }
#endif
#ifdef CORE_INT10_PIN
static void isr10(void) { update(interruptArgs[10]); }
#endif
#ifdef CORE_INT11_PIN
static void isr11(void) { update(interruptArgs[11]); }
#endif
#ifdef CORE_INT12_PIN
static void isr12(void) { update(interruptArgs[12]); }
#endif
#ifdef CORE_INT13_PIN
static void isr13(void) { update(interruptArgs[13]); }
#endif
#ifdef CORE_INT14_PIN
static void isr14(void) { update(interruptArgs[14]); }
#endif
#ifdef CORE_INT15_PIN
static void isr15(void) { update(interruptArgs[15]); }
#endif
#ifdef CORE_INT16_PIN
static void isr16(void) { update(interruptArgs[16]); }
#endif
#ifdef CORE_INT17_PIN
static void isr17(void) { update(interruptArgs[17]); }
#endif
#ifdef CORE_INT18_PIN
static void isr18(void) { update(interruptArgs[18]); }
#endif
#ifdef CORE_INT19_PIN
static void isr19(void) { update(interruptArgs[19]); }
#endif
#ifdef CORE_INT20_PIN
static void isr20(void) { update(interruptArgs[20]); }
#endif
#ifdef CORE_INT21_PIN
static void isr21(void) { update(interruptArgs[21]); }
#endif
#ifdef CORE_INT22_PIN
static void isr22(void) { update(interruptArgs[22]); }
#endif
#ifdef CORE_INT23_PIN
static void isr23(void) { update(interruptArgs[23]); }
#endif
#ifdef CORE_INT24_PIN
static void isr24(void) { update(interruptArgs[24]); }
#endif
#ifdef CORE_INT25_PIN
static void isr25(void) { update(interruptArgs[25]); }
#endif
#ifdef CORE_INT26_PIN
static void isr26(void) { update(interruptArgs[26]); }
#endif
#ifdef CORE_INT27_PIN
static void isr27(void) { update(interruptArgs[27]); }
#endif
#ifdef CORE_INT28_PIN
static void isr28(void) { update(interruptArgs[28]); }
#endif
#ifdef CORE_INT29_PIN
static void isr29(void) { update(interruptArgs[29]); }
#endif
#ifdef CORE_INT30_PIN
static void isr30(void) { update(interruptArgs[30]); }
#endif
#ifdef CORE_INT31_PIN
static void isr31(void) { update(interruptArgs[31]); }
#endif
#ifdef CORE_INT32_PIN
static void isr32(void) { update(interruptArgs[32]); }
#endif
#ifdef CORE_INT33_PIN
static void isr33(void) { update(interruptArgs[33]); }
#endif
#ifdef CORE_INT34_PIN
static void isr34(void) { update(interruptArgs[34]); }
#endif
#ifdef CORE_INT35_PIN
static void isr35(void) { update(interruptArgs[35]); }
#endif
#ifdef CORE_INT36_PIN
static void isr36(void) { update(interruptArgs[36]); }
#endif
#ifdef CORE_INT37_PIN
static void isr37(void) { update(interruptArgs[37]); }
#endif
#ifdef CORE_INT38_PIN
static void isr38(void) { update(interruptArgs[38]); }
#endif
#ifdef CORE_INT39_PIN
static void isr39(void) { update(interruptArgs[39]); }
#endif
#ifdef CORE_INT40_PIN
static void isr40(void) { update(interruptArgs[40]); }
#endif
#ifdef CORE_INT41_PIN
static void isr41(void) { update(interruptArgs[41]); }
#endif
#ifdef CORE_INT42_PIN
static void isr42(void) { update(interruptArgs[42]); }
#endif
#ifdef CORE_INT43_PIN
static void isr43(void) { update(interruptArgs[43]); }
#endif
#ifdef CORE_INT44_PIN
static void isr44(void) { update(interruptArgs[44]); }
#endif
#ifdef CORE_INT45_PIN
static void isr45(void) { update(interruptArgs[45]); }
#endif
#ifdef CORE_INT46_PIN
static void isr46(void) { update(interruptArgs[46]); }
#endif
#ifdef CORE_INT47_PIN
static void isr47(void) { update(interruptArgs[47]); }
#endif
#ifdef CORE_INT48_PIN
static void isr48(void) { update(interruptArgs[48]); }
#endif
#ifdef CORE_INT49_PIN
static void isr49(void) { update(interruptArgs[49]); }
#endif
#ifdef CORE_INT50_PIN
static void isr50(void) { update(interruptArgs[50]); }
#endif
#ifdef CORE_INT51_PIN
static void isr51(void) { update(interruptArgs[51]); }
#endif
#ifdef CORE_INT52_PIN
static void isr52(void) { update(interruptArgs[52]); }
#endif
#ifdef CORE_INT53_PIN
static void isr53(void) { update(interruptArgs[53]); }
#endif
#ifdef CORE_INT54_PIN
static void isr54(void) { update(interruptArgs[54]); }
#endif
#ifdef CORE_INT55_PIN
static void isr55(void) { update(interruptArgs[55]); }
#endif
#ifdef CORE_INT56_PIN
static void isr56(void) { update(interruptArgs[56]); }
#endif
#ifdef CORE_INT57_PIN
static void isr57(void) { update(interruptArgs[57]); }
#endif
#ifdef CORE_INT58_PIN
static void isr58(void) { update(interruptArgs[58]); }
#endif
#ifdef CORE_INT59_PIN
static void isr59(void) { update(interruptArgs[59]); }
#endif
#endif
};
#if defined(ENCODER_USE_INTERRUPTS) && defined(ENCODER_OPTIMIZE_INTERRUPTS)
#if defined(__AVR__)
#if defined(INT0_vect) && CORE_NUM_INTERRUPT > 0
ISR(INT0_vect) { Encoder::update(Encoder::interruptArgs[SCRAMBLE_INT_ORDER(0)]); }
#endif
#if defined(INT1_vect) && CORE_NUM_INTERRUPT > 1
ISR(INT1_vect) { Encoder::update(Encoder::interruptArgs[SCRAMBLE_INT_ORDER(1)]); }
#endif
#if defined(INT2_vect) && CORE_NUM_INTERRUPT > 2
ISR(INT2_vect) { Encoder::update(Encoder::interruptArgs[SCRAMBLE_INT_ORDER(2)]); }
#endif
#if defined(INT3_vect) && CORE_NUM_INTERRUPT > 3
ISR(INT3_vect) { Encoder::update(Encoder::interruptArgs[SCRAMBLE_INT_ORDER(3)]); }
#endif
#if defined(INT4_vect) && CORE_NUM_INTERRUPT > 4
ISR(INT4_vect) { Encoder::update(Encoder::interruptArgs[SCRAMBLE_INT_ORDER(4)]); }
#endif
#if defined(INT5_vect) && CORE_NUM_INTERRUPT > 5
ISR(INT5_vect) { Encoder::update(Encoder::interruptArgs[SCRAMBLE_INT_ORDER(5)]); }
#endif
#if defined(INT6_vect) && CORE_NUM_INTERRUPT > 6
ISR(INT6_vect) { Encoder::update(Encoder::interruptArgs[SCRAMBLE_INT_ORDER(6)]); }
#endif
#if defined(INT7_vect) && CORE_NUM_INTERRUPT > 7
ISR(INT7_vect) { Encoder::update(Encoder::interruptArgs[SCRAMBLE_INT_ORDER(7)]); }
#endif
#endif // AVR
#endif // ENCODER_OPTIMIZE_INTERRUPTS
#endif
| [
"noreply@github.com"
] | tdurrer5.noreply@github.com |
6ca50a33a0d78161332dda28dfd8d75625e56dda | b32f8982cfe1cd4e2cb661cc6718d6949e71885e | /include/cool/ng/async/task.h | 13bac48681afa0d2366971c2ab972b5e1fc07e12 | [
"Apache-2.0"
] | permissive | digiverse/cool.ng | efe0489a16c1702e01f4e8f793c9abc832a7bc3a | 44f282fa488c7dfe44b2f4b4801f1306291bd76a | refs/heads/master | 2021-06-26T13:19:56.396144 | 2020-11-17T11:50:18 | 2020-11-17T11:50:18 | 160,184,227 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 43,579 | h | /*
* Copyright (c) 2017 Leon Mlakar.
* Copyright (c) 2017 Digiverse d.o.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. The
* license should be included in the source distribution of the Software;
* if not, you may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* The above copyright notice and licensing terms shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
* IN THE SOFTWARE.
*/
#if !defined(cool_ng_f36abcb0_dda1_4ce1_b25a_943f5951523a)
#define cool_ng_f36abcb0_dda1_4ce1_b25a_943f5951523a
#include <string>
#include <functional>
#include <iostream>
#include "cool/ng/impl/platform.h"
#include "cool/ng/exception.h"
#include "cool/ng/traits.h"
#include "cool/ng/async/runner.h"
#include "cool/ng/impl/async/task.h"
namespace cool { namespace ng {
namespace async {
/**
* Tags marking the task kinds.
*/
struct tag
{
/**
* Simple task tag.
*
* Simple task contains a user's @em Callable and is associated with a
* specific @ref runner, which will, when requested, schedule and execute the
* @em Callable. A simple task may accept one input parameter and may or may
* not return a value. Both the input parameter and the return value of the
* simple task are determined by inspecting the user @em Callable, as follows:
* * the input paramter of the simple task is the second parameter of the
* @em Callable. If the @em Callable does not have the second parameter the
* simple task will accept no input parameter
* * the return value of the simple task is the return value of the user supplied
* @em Callable. If the @em Callable does not return value the simple task
* will not return value either.
*
* The user @em Callable may be a function pointer, lambda closure,
* @c std::function, or any other functor object as long as it provides a
* single overload of the function call operator '<tt>()</tt>' with the
* following signature:
* * the first parameter must be a <tt>std::shared_ptr</tt>, or a <tt>const</tt>
* @em lvalue reference to one, to the @ref runner type the simple task is
* associated with
* * The optional second parameter of any type; if present it willl determine
* the input paramer of the simple task.
*
* Whe the @em Callable is executed its first argument will be set to the @ref
* runner executing the simple task and the second parameter, if present, will
* be se to either the value passed to the task's @c run() method
* or to the value determined by the rules of the compound task, if executed as
* a part of a compound task.
*
* <b>Member Types And Requirements</b>@n
*
* When created with a call to:
* @code
* ...
* auto task = factory::create(runner, callable);
* ...
* @endcode
* the resulting task type of object @c task exposes the following public type
* declarations:
*
* <table><tr><th>Member type <th>Declared as
* <tr><td><tt>this_type</tt> <td><tt>decltype(@em task)</tt>
* <tr><td><tt>input_type</tt> <td>type of the second arg to @em Callable, @c void if none
* <tr><td><tt>result_type</tt> <td>return type of @em Callable
* </table>
*
* The following requirements are imposed on the user @em callable:
* - the first input parameter to @em Callable must be of type <tt>const std::shared_ptr<decltype(@em runner)>&</tt>.
* - the user @em Callable may accept one or two input parameters
*
* <b>Examples</b>@n
*
* The following code fragment will create a simple task which accepts a
* parameter of type @c double and returns result of type @c bool:
* @code
* #include <cool/ng/async.h>
* using cool::ng::async::runner;
* using cool::ng::async::factory;
*
* runnner run;
* auto t = factory::create(run,
* [] (const std::shared_ptr<runner>& r, double arg)
* {
* return arg < 0;
* });
* @endcode
* When run, the task @c t would require a parameter of type @c double, or
* a type convertible to @c double:
* @code
* t.run(3.14);
* @endcode
*
* The following code fragment will create a simple task with no input parameter
* and which returns no result:
* @code
* class my_runner : public runner {
* ....
* };
* ....
* my_runner run;
* auto t2 = factory::create(run,
* [] (const std::shared_ptr<runner>& r)
* {
* r->do_something();
* });
* @endcode
* When run, the task @c t2 requires no input parameter:
* @code
* t2.run();
* @endcode
*
* @note Objects created by <tt>std::bind</tt> usually provide several overloads
* of operator '<tt>()</tt>' and cannot be directly used to create simple tasks.
* Convert them to an appropriate <tt>std::function</tt> object first.
*/
using simple = detail::tag::simple;
/**
* Sequential compound task tag.
*
* Sequential tasks are compound tasks that consist of two or more subtasks. The
* order of the subtasks is determined at the sequential task creation and is
* the same as they are provided to the call to @ref factory::sequence factory
* method.
* <br>
* The input parameter of the sequential compund task is the input parameter of
* its first subtask. The result value and the type of the result of the
* sequential compound task is the result of of its last subtask. All subtasks
* in a sequential compound tasks must be chained, meaning that the type of the
* result of the preceding subtask must match the type of the input of the next
* subtask. During the execution the sequential task will, in the same order as
* they were provided at creation, schedule each subtask for execution, wait for
* its execution to complete, and fetch its result and pass it as an input parameter
* into the next subtask.
*
* <b>Member Types And Requirements</b>@n
*
* When created with a call to:
* @code
* ...
* auto task = factory::sequence(task_1, task_2, .... , task_n);
* ...
* @endcode
* the resulting task type of object @c task exposes the following public type
* declarations:
*
* <table><tr><th>Member type <th>Declared as
* <tr><td><tt>this_type</tt> <td><tt>decltype(@em task)</tt>
* <tr><td><tt>input_type</tt> <td>decltype(@em task_1)::%input_type
* <tr><td><tt>result_type</tt> <td>decltype(@em task_n)::%result_type
* </table>
*
* The following requirements are imposed on the subtasks of the sequential task:
* - sequential task must have at least two subtasks
* - for every @em i in range 1–(<i>n</i>-1):
* <tt>std::is_same<decltype(task_<i>i</i>)::%result_type, decltype(task_<i>(i+1)</i>)::%input_type>::%value</tt> must yield @c true
*
* <b>Exception Handling</b>@n
*
* If any of he subtasks in sequence, when run, throws an uncontained exception,
* the sequential task will terminate the sequence and propagate this exception as
* its own exception. The subtasks that follow the subtasks that threw the
* uncontained exception will not be scheduled to run.
*
* <b> Examples</b>@n
*
* The following code fragmet will create a @em sequential compound task consisting
* of three simple sub-tasks:
* @code
* #include <cool/ng/async.h>
* using cool::ng::async::runner;
* using cool::ng::async::factory;
* class my_runner_class_1 : public runner { };
* class my_runner_class_2 : public runner { };
* ...
* auto r1 = std::make_shared<my_runner_class_1>();
* auto r2 = std::make_shared<my_runner_class_2>();
*
* auto t1 = factory::create(r1,
* [] (const std::shared_ptr<runner>& r, double input) -> int
* {
* ...
* return some_integer;
* });
* auto t2 = factory::create(r2,
* [] (const std::shared_ptr<runner>& r, int input) -> my_class
* {
* ...
* return my_class;
* });
* auto t3 = factory::create(r1,
* [] (const std::shared_ptr<runner>& r, const my_class& input) -> void
* {
* ...
* });
*
* auto sequence = factory::sequential(t1, t2, t3);
* @endcode
* From the functional perspective, running the sequential task @c sequence:
* @code
* sequence.run(42.0);
* @endcode
* would functionally correspond to the following synchronous code:
* @code
* int t1(double input)
* {
* ...
* return some_integer;
* }
* my_class t2(int input)
* {
* ...
* return my_class;
* }
* void t3(const my_class& input)
* {
* ...
* }
*
* t3( t2( t1( 42.0 ) ) );
* @endcode
* The only difference is that tasks @c t1 and @c t3 would run in the context
* of @ref runner @c r1 and task @c t2 would run in the context of @ref runner
* @c r2, thus serializing the access to the data grouped around these runners.
*/
using sequential = detail::tag::sequential;
//using detail::tag::parallel;
/**
* Conditional compound task.
*
* Conditional task is a compund that consists of a predicate task which returns
* a boolean value, a task which is scheduled for execution when the predicate
* task returns @c true, and an optionl third task whcih, if present, is
* scheduled for execution when the predicate task returns @c false. The following
* are the constrains imposed on subtasks that constitute the conditional compound
* task (see the next section for more formal expression of the requirements):
* - the predicate task must return value of @c bool type
* - the predicate task, the second, @em if task, and the optional third, @em else
* task must all accept the input parameter of the same type (which can be
* @c void if none is desired).
* - if the @em else task is not present the result type of the @em if task
* must be @c void
* - if the @em else task is present the result types of both @em if and
* @em else tasks must be the same
*
* When run, the conditional compund task first schedules the predicate subtask
* for execution. When the predicate task is complete and reports the result,
* it schedules the @em if subtask for execution, if the result of the predicate
* subtask was @c true. If it was @c false and the @em else subtask is present,
* it schedules the @em else subtask for execution. If the result of the predicate
* subtask was @c false and the @em else subtask is not present, no further
* action is taken and the conditional compound task terminates.
*
* <b>Member Types And Requirements</b>@n
*
* When created with a call to:
* @code
* ...
* auto task = factory::conditional(predicate, if_task); // (1)
* auto task = factory::conditional(predicate, if_task, else_task); // (2)
* ...
* @endcode
* the resulting task type of object @c task exposes the following public type
* declarations:
*
* <table><tr><th>Member type <th>Declared as
* <tr><td><tt>this_type</tt> <td><tt>decltype(@em task)</tt>
* <tr><td><tt>runner_type</tt> <td><tt>detail::default_runner_type</tt>
* <tr><td><tt>tag</tt> <td><tt>tag::conditional</tt>
* <tr><td><tt>input_type</tt> <td><tt>decltype(@em predicate)::&input_type</tt>
* <tr><td><tt>result_type</tt> <td>if (1): @c void<br>if (2): <tt>decltype(if_task)::%result_type</tt>
* </table>
* Note that sequential task, as all compound tasks, is not associated with any
* runner and uses @c detail::default_runner_type as a filler type.
*
* The following are the requirements for use (1):
* - <tt>std::is_same<decltype(predicate)::result_type, bool>::value</tt> must yield @c true
* - <tt>std::is_same<decltype(predicate)::input_type, decltype(if_task)::input_type>::value</tt> must yield @c true
* - <tt>std::is_same<decltype(if_task)::result_type, void>::value</tt> must yield @c true
*
* The following are the requirements for use (2):
* - <tt>std::is_same<decltype(predicate)::result_type, bool>::value</tt> must yield @c true
* - <tt>std::is_same<decltype(predicate)::input_type, decltype(if_task)::input_type>::value</tt> must yield @c true
* - <tt>std::is_same<decltype(if_task)::input_type, decltype(else_task)::input_type>::value</tt> must yield @c true
* - <tt>std::is_same<decltype(if_task)::result_type, decltype(else_task)::result_type>::value</tt> must yield @c true
*
* <b>Exception Handling</b>@n
*
* If the predicate subtask, when run, throws an uncontained exception,
* the conditional task will terminate immediately and propagate this exception as
* its own exception. Neither @em if_task nor @em else_task, if present, will be
* scheduled for execution. If either @em if_task or @em else_task, when run,
* throw and exception, the conditional task will propagate this exception as its
* own exception.
*
* <b>Example</b>@n
*
* The following code fragment will create a conditional compound task consisting
* of the predicate task, the @em if_task and the @em else_task:
* @code
* #include <cool/ng/async.h>
* using cool::ng::async::runner;
* using cool::ng::async::factory;
* class my_runner_class_1 : public runner { };
* class my_runner_class_2 : public runner { };
* ...
* auto r1 = std::make_shared<my_runner_class_1>();
* auto r2 = std::make_shared<my_runner_class_2>();
*
* auto predicate = factory::create(r1,
* [] (const std::shared_ptr<my_runner_class_1>& r, double input) -> bool
* {
* ...
* });
* auto if_task = factory::create(r2,
* [] (const std::shared_ptr<my_runner_class_2>& r, double input) -> int
* {
* ...
* });
* auto else_task = factory::create(r1,
* [] (const std::shared_ptr<my_runner_class_1>& r, double input) -> int
* {
* ...
* });
*
* auto task = factory::conditional(predicate, if_task, else_task);
* task.run(3.14);
* @endcode
*
* From the functional perspective this would correspond to the following
* @c if statement (assuming methods instead of tasks):
* @code
* int result;
* if (predicate(3.14))
* result = if_task(3.14);
* else
* result = else_task(3.14);
* @endcode
*/
using conditional = detail::tag::conditional;
/**
* Loop compound task tag.
*
* The loop task is a compound task that consits of the predicate task and an
* optional body task and iterativelly schedules them for the execution
* until the predicate task returns @c false. When run, the loop task will first
* schedule the predicate task, wait for its completion and evaluate the result
* of the predicate task. If @c true, and if the body task is present,
* it will schedule the body task for execution, wait for its completion and
* schedule the predicate task again, using the result of the body task as an
* input to the predicate task. If the predicate task returs @c true but the body
* task is not present, it will immediatelly schedule the predicate task again.
* The loop will terminate if the predicate task return @c false and, if @em
* body_task was present, return the return value of its last iteration as
* the return value of the loop task.
*
* If the body task is present and returns a value, and if the body task is
* never run (that is if the predicate returns @c false the first time), the
* return value of the loop compound task is equal to its input. Otherwise the
* return value of the loop compound task is equal to the last return value of
* the body task.
*
* <b>Member Types And Requirements</b>@n
*
* When created with a call to:
* @code
* ...
* auto task = factory::loop(predicate); // (1)
* auto task = factory::loop(predicate, body_task); // (2)
* ...
* @endcode
* the resulting task type of object @c task exposes the following public type
* declarations:
*
* <table><tr><th>Member type <th>Declared as
* <tr><td><tt>this_type</tt> <td><tt>decltype(@em task)</tt>
* <tr><td><tt>runner_type</tt> <td><tt>detail::default_runner_type</tt>
* <tr><td><tt>tag</tt> <td><tt>tag::loop</tt>
* <tr><td><tt>input_type</tt> <td>if (1): @c void<br>if (2):<tt>decltype(<i>predicate</i>)::%input_type</tt>
* <tr><td><tt>result_type</tt> <td>if (1): @c void<br>if (2):<tt>decltype(<i>body_task</i>)::%result_type</tt>
* </table>
* Note that loop task, as all compound tasks, is not associated with any
* runner and uses @c detail::default_runner_type as a filler type.
*
* The following are the requirements for use (1):
* - <tt>std::is_same<decltype(predicate)::result_type, bool>::value</tt> must yield @c true
* - <tt>std::is_same<decltype(predicate)::input_type, void>::value</tt> must yield @c true
*
* The following are the requirements for use (2):
* - <tt>std::is_same<decltype(predicate)::result_type, bool>::value</tt> must yield @c true
* - <tt>std::is_same<decltype(predicate)::input_type, decltype(body_task)::input_type>::value</tt> must yield @c true
* - <tt>std::is_same<decltype(predicate)::input_type, decltype(body_task)::result_type>::value</tt> must yield @c true
*
* <b>Exception Handling</b>@n
*
* If the predicate subtask, when run, throws an uncontained exception,
* the loop task will terminate immediately and propagate this exception as
* its own exception. The @em body_task will not be
* scheduled for execution. If the @em body_task subtask, when run,
* throws and exception, the loop task will terminate and propagate
* this exception as its own exception.
*
* <b>Example</b>@n
*
* The following code fragment will create a loop compound task consisting
* of the predicate subtask and the @em body subttask:
* @code
* #include <cool/ng/async.h>
* using cool::ng::async::runner;
* using cool::ng::async::factory;
* class my_runner_class_1 : public runner { };
* class my_runner_class_2 : public runner { };
* ...
* auto r1 = std::make_shared<my_runner_class_1>();
* auto r2 = std::make_shared<my_runner_class_2>();
*
* auto predicate = factory::create(r1,
* [] (const std::shared_ptr<my_runner_class_1>& r, double input) -> bool
* {
* ...
* });
* auto body = factory::create(r2,
* [] (const std::shared_ptr<my_runner_class_2>& r, double input) -> double
* {
* ...
* });
*
* auto task = factory::loop(predicate, body;
* task.run(3.14);
* @endcode
*
* From the functional perspective this would correspond to the following
* @c if statement (assuming methods instead of tasks):
* @code
* double result = 3.14;
* while (predicate(result))
* result = body(result);
* @endcode
*/
using loop = detail::tag::loop;
/**
* Repeat compound task tag.
*
* The repeat task is a compound task that repeatedly schedules its subtask for
* execution. The number of repetitions is specified as the parameter to the
* @c run() call. When run, the repeat compound task will schedule its subtask for
* execution, wait for its completion and schedule it again, repeating this cycle
* the number of times specified to the @c run() call. The subtask will receive
* the iteration number as its input parameter, in range <i>0–(num_repetitions-1)</i>.
* The return value, if any, of the repeat compound task is the last return
* value of its subtask. If the subtask was never run, the return value is a
* default constructed instance of the return value type.
*
* <b>Member Types And Requirements</b>@n
*
* When created with a call to:
* @code
* ...
* auto task = factory::repeat(subtask);
* ...
* @endcode
* the resulting task type of object @c task exposes the following public type
* declarations:
*
* <table><tr><th>Member type <th>Declared as
* <tr><td><tt>this_type</tt> <td><tt>decltype(@em task)</tt>
* <tr><td><tt>runner_type</tt> <td><tt>detail::default_runner_type</tt>
* <tr><td><tt>tag</tt> <td><tt>tag::repeat</tt>
* <tr><td><tt>input_type</tt> <td><tt>std::size_t</tt>
* <tr><td><tt>result_type</tt> <td><tt>decltype(@em subtask)::%result_type)</tt>
* </table>
* Note that repeat task, as all compound tasks, is not associated with any
* runner and uses @c detail::default_runner_type as a filler type.
*
* The following are the requirements for the @em subtask:
* - <tt>std::is_same<decltype(subtask)::input_type, std::size_t>::value</tt> must yield @c true
* - <tt>decltype(subtask)::%result_type</tt> most be default constructible or @c void
*
* <b>Exception Handling</b>@n
*
* If the subtask, when run at any iteration, throws an uncontained exception,
* the repeat task will terminate immediately and propagate this exception as
* its own exception. The @em subtask will not be scheduled to run again regardless
* of the state of the internal iteration counter.
*
* <b>Example</b>@n
*
* @code
* #include <cool/ng/async.h>
* using cool::ng::async::runner;
* using cool::ng::async::factory;
* class my_runner_class : public runner { ... class content ... };
* ...
* auto r = std::make_shared<my_runner_class>();
*
* auto t1 = factory::create(r,
* [] (const std::shared_ptr<my_runner_class>& r, std::size_t counter) -> void
* {
* ...
* });
* auto task = factory::repeat(t1);
* ...
* task.run(100); // execute task t1 100 times
* @endcode
*
* Functionally, the repeat compound task corresponds to the <tt>for</tt>
* loop in the synchronous programming. Thus the above example functionally
* corresponds to the following synchronous pattern:
* @code
* void t1(std::size_t counter)
* {
* ...
* }
*
* ...
*
* for (std::size_t i = 0; i < 100; ++i)
* t1(i);
* @endcode
*
*/
using repeat = detail::tag::repeat;
/**
* Intercept compound task.
*
* An intercept task is a compound task that handles the exceptions that may
* be thrown in its subtask. The intercept tasks consists of:
* - the @em main subtask (a @em try task) that is expected to throw exception(s)
* that must be handled
* - one or more exception handling subtasks (the @em catch tasks) that will
* only be scheduled to run if the @em try task throws an exception of the
* appropriate type. The try tasks mustv accept an input parameter.
*
* When an intercept task is run, it immediatelly schedules its @em try task
* for execution. Should the @em try task throws an exception, the intercept
* compound task will @em catch the thrown exception and inspect the @em catch
* tasks in the same order as they were specified to the @em factory::intercept
* call. The first @em catch task that accepts the input parameter of the same
* type, or of the base type of the thrown exception object, will be scheduled
* to run and will receive the thrown exception object as its input. If no
* mathing @em catch task is found, the exception object is propagated out of
* the intercept compound task.
*
* The @em catch task with the input parameter of type @c std::exception_ptr has
* has a special meaning - it acts as a catch-all entity and will intercept
* an exception object of any type.
*
* <b>Member Types And Requirements</b>@n
*
* When created with a call to:
* @code
* ...
* auto task = factory::intercept(try, catch_1, catch_2, ... catch_n, catch_all);
* ...
* @endcode
* the resulting task type of object @c task exposes the following public type
* declarations:
*
* <table><tr><th>Member type <th>Declared as
* <tr><td><tt>this_type</tt> <td><tt>decltype(@em task)</tt>
* <tr><td><tt>runner_type</tt> <td><tt>detail::default_runner_type</tt>
* <tr><td><tt>tag</tt> <td><tt>tag::intercept</tt>
* <tr><td><tt>input_type</tt> <td><tt>decltype(@em try)::%input_type</tt>
* <tr><td><tt>result_type</tt> <td><tt>decltype(@em try)::%result_type</tt>
* </table>
* Note that intercept task, as all compound tasks, is not associated with any
* runner and uses @c detail::default_runner_type as a filler type.
*
* The following are the requirements for the subtasks of the intercept task:
* - for each @em i in range 1–<i>n</i>: <tt>std::is_same<decltype(try)::%result_type, std::is_same<decltype(catch_<i>i</i>)::%result_type>::%value</tt> must yield @c true
* - <tt>std::is_same<decltype(try)::%result_type, std::is_same<decltype(catch_all)::%result_type>::%value</tt> must yield @c true
* - for each @em i in range 1–<i>n</i>: <tt>std::is_same<decltype(catch_<i>i</i>)::%input_type, void>::%value</tt> must yield @c false
* - <tt>std::is_same<decltype(catch_all)::%input_type, std::exception_ptr>::%value</tt> must yield @c true
*
* <b>Exception Handling</b>@n
*
* If the @em try subtask, when run, throws an uncontained exception,
* the intercept task will examine the @em catch_i subtasks in the creation order
* to find one that would handle the exception. If such @em catch subtask is found,
* the intercept will schedule it to run and will pass the exception object as an
* input parameter. The result value of this subtask, if any, will be returned as
* the result of the intercept compound task. If no handling @em catch subtask
* is found, the intercept compund task will propagate the exception as its
* own exception and terminate immediatelly. No @em catch subtasks will be run
* in this case.
*
* If the handling subtask, when run, throws an uncontained exception, the intercept
* task will propagate the exception as its own and terminate. No result value
* is produced.
*
* <b>Example</b>@n
*
* @code
* #include <cool/ng/async.h>
* using cool::ng::async::runner;
* using cool::ng::async::factory;
* class my_runner_class_1 : public runner { ... class content ... } };
* class my_runner_class_2 : public runner { ... class content ... } };
* ...
* auto r1 = std::make_shared<my_runner_class_1>();
* auto r2 = std::make_shared<my_runner_class_2>();
*
* auto t1 = factory::create(r1,
* [] (const std::shared_ptr<my_runner_class_1>& r, double input) -> int
* {
* ...
* });
* auto t2 = factory::create(r2,
* [] (const std::shared_ptr<my_runner_class_2>& r, const std::runtime_error& e) -> int
* {
* ...
* });
* auto t3 = factory::create(r1,
* [] (const std::shared_ptr<my_runner_class_1>& r, const std::exception_ptr& e) -> int
* {
* ...
* });
*
* auto task = factory::try_catch(t1, t2, t3);
* @endcode
* When task @c task is run, it will immediatelly schedule the @em try task @c t1
* for execution. If this task, during its run, throws an exception, the intercept
* compound task @c task will catch the exception and examine @em catch tasks
* @c t1 and @c t2, in this order. Should the exception object be of type
* @c std::runtime_error, or should this be one of its base types, the intercept
* compound task @c task will schedule the @em catch task @c t2 for execution on
* its associated runner @c r1. If the exception was of any other type, it will
* schedule the @em catch task @c t3 (since it acts as a catch-all @em catch
* task due to its input parameter) for execution on its associated runner @c r2.
* The @c int result returned by either @c t2 or @c t3 Em catch task would then
* represent the result of the intercept compound task @c task.
* <br>
* Functionally, the intercept compound task corresponds to the <tt>try-catch</tt>
* block in the synchronous programming. Thus the above example functionally
* corresponds to the following synchronous pattern:
* @code
* try
* {
* // code of try task t1 that may throw
* }
* catch (const std::runtime_error& e)
* {
* // code of catch task t2
* }
* catch (...)
* {
* // code of catch task t3
* }
* @endcode
* @note Except for catch-all @em catch task, the exception object is re-thrown
* and re-caught at each @em catch task to test whether this @em catch task
* should intercept it or not. This may incurr certain processing overhead
* should the intercept compound task have a long string of @em catch tasks.
*/
using intercept = detail::tag::intercept;
};
struct factory;
/**
* A class template representing the objects that can be scheduled for
* execution by one of the @ref runner "runners".
*
* A task can be either a <em>simple task</em> which contains a @em Callable and
* is associated with a specific @ref runner or a <em>compound task</em> which
* contains other tasks organized and exceuted in a specific way. Compound tasks
* themselves are not associated with @ref runner "runners" as they do not contain
* executable code.
*
* <b>Task Properties</b>@n
* Each task may accept at most one input parameter. The type of the input parameter
* can be inspected using @c task::input_type public type. If @c void the task does
* not accept input parameter. The input parameter can be specified explicitly
* when the task is scheduled for execution via @ref task::run() "run()" method,
* or is specified implicitly by the execution context of the compound task, if
* the task is an element of a compound task and is scheduled to run as a part
* of the compound task execution.
*
* The task may return a result of any data type. The type of the result of a
* simple task is determined by the return value of its @em Callable. Teh type
* of the result of the compound task is determined by the rules governing each
* particular kind of the compound task. Since the tasks are executed asynchronously,
* the results cannot be reported back into the user code, and if the result is
* not picked up by the execution context of the compund task it is irrevocably
* lost.
*
* Formally, each tasks exposes the following public member types:
* - @c this_type, the type of this task type
* - @c runner_type, the type of the @ref runner, associated with this task type
* - @c tag, the @ref tag type associated with this task type - the tag type
* determines the kind of this task (e.g. simple, sequential, loop, ...)
* - @c input_type, the type of the input for this task type. Input type
* @c void denotes no input.
* - @c result_type, the type of the result value of this task type. Result type
* @c void denotes that this task type has no result value.
* - @c impl_type, the type that will store the static information about this
* task type.
*
* <b>Simple Tasks</b>@n
* Simple tasks are the cornerstone of asynchronous execution paradigm and the only
* type of tasks that contain the user code. The user code is provided in a form
* of @em Callable object, passed to one of the @ref factory::create() "create"
* methods of the @ref factory class. When a simple task is scheduled for
* execution, the @ref runner environment will pass a shared pointer of the
* correct type as the first argument to the user provided @em Callable. This
* feature can be seeen as a sort of "shared this" substitute for @c this
* pointer, common in synchronous programming.
*
* <b>Composed Tasks</b>@n
*
* Composed tasks are tasks that combine one or more tasks into a single task. The
* composed tasks are one of the following:
* - @em sequential
* - @em parallel
* - @em conditional
* - @em loop
* - @em repeat
* - @em intercept
*
* See @ref tag for more details on ech kind of tasks.
*/
template <typename ResultT, typename... InputT>
class x_task
{
public:
private:
using impl_type = detail::x_taskinfo<ResultT, InputT...>;
};
template <typename InputT, typename ResultT>
class task
{
public:
using this_type = task;
using input_type = InputT;
using result_type = ResultT;
using impl_type = detail::base::taskinfo<input_type, result_type>;
public:
task() { /* noop */ }
/**
* Predicate to check whether the task is empty.
*/
explicit operator bool () const
{
return !!m_impl;
}
/**
* Schedule task for execution.
*/
template <typename T = InputT>
void run(const typename std::decay<typename std::enable_if<
!std::is_same<T, void>::value && !std::is_rvalue_reference<T>::value
, T>::type>::type& arg_) const
{
m_impl->run(m_impl, arg_);
}
// rvalue reference
template <typename T = InputT>
void run(typename std::enable_if<
!std::is_same<T, void>::value && std::is_rvalue_reference<T>::value
, T>::type arg_) const
{
m_impl->run(m_impl, std::move(arg_));
}
/**
* Schedule task for execution.
*/
template <typename T = InputT>
typename std::enable_if<std::is_same<T, void>::value, void>::type run() const
{
m_impl->run(m_impl);
}
private:
friend struct factory;
task(const std::shared_ptr<impl_type> impl_) : m_impl(impl_)
{ /* noop */ }
private:
std::shared_ptr<impl_type> m_impl;
};
/**
* Task factory
*/
struct factory {
public:
//--- ------------------------------------------------------------------------
//--- Simple tasks factory methods
//--- ------------------------------------------------------------------------
/**
* Factory method to create @ref tag::simple "simple" tasks.
*
* @param r_ @ref runner to use for task execution
* @param f_ user Callable runner should invoke during task execution
*
* @see @ref tag::simple "simple" task
*/
template <typename RunnerT, typename CallableT>
inline static task<
typename traits::arg_type<1, CallableT>::type
, typename traits::functional<CallableT>::result_type
> create(const std::weak_ptr<RunnerT>& r_, const CallableT& f_)
{
using result_type = typename traits::functional<CallableT>::result_type;
using input_type = typename traits::arg_type<1, CallableT>::type;
using task_type = task<input_type, result_type>;
using taskinfo_type = detail::taskinfo<tag::simple, RunnerT, input_type, result_type>;
// Make diagnostics a bit more user friendly - do some compile time checks
// user callable must accept one or two parameters ...
static_assert(
traits::functional<CallableT>::arity::value > 0 && traits::functional<CallableT>::arity::value < 3
, "The user supplied callable must accept one or two parameters");
// ... the first paramer must be shared_ptr to runner type ...
static_assert(
std::is_same<
std::shared_ptr<RunnerT>
, typename traits::functional<CallableT>::template arg<0>::info::naked_type
>::value
, "The user Callable must accept std::shared_ptr<runner-type> as the first parameter");
// ... but neither passed as rvalue reference ...
static_assert(
!traits::functional<CallableT>::template arg<0>::info::is_rref::value
, "The first parameter to user Callable must not be rvalue reference");
// ... nor as non-const lvalue reference
static_assert(
!traits::functional<CallableT>::template arg<0>::info::is_lref::value
|| (traits::functional<CallableT>::template arg<0>::info::is_lref::value
&& traits::functional<CallableT>::template arg<0>::info::is_const::value)
, "The first parameter to user Callable must either be by value or const lvalue reference");
return task_type(std::shared_ptr<typename task_type::impl_type>(new taskinfo_type(r_, f_)));
}
template <typename RunnerT, typename CallableT>
inline static task<
typename traits::arg_type<1, CallableT>::type
, typename traits::functional<CallableT>::result_type
> create(const std::shared_ptr<RunnerT>& r_, const CallableT& f_)
{
return factory::create(std::weak_ptr<RunnerT>(r_), f_);
}
// IMPLEMENTATION_NOTE:
// Compound tasks do not need a runner of their own hence the
// default_runner_type is used as a type constant for all compounds.
//--- -----------------------------------------------------------------------
//--- Sequential tasks factory methods
//--- -----------------------------------------------------------------------
/**
* Factory method for creating @ref tag::sequential "sequential" compound tasks.
*
* @param t_ two or more tasks to run in sequence
*
* @see @ref tag::sequential "sequential" compound task
*/
template <typename... TaskT>
inline static task<
typename detail::traits::get_first<TaskT...>::type::input_type
, typename detail::traits::get_sequence_result_type<TaskT...>::type
> sequence(const TaskT&... t_)
{
static_assert(
sizeof...(t_) > 1
, "It takes at least two tasks to create a sequential compound task");
static_assert(
detail::traits::is_chain<typename std::decay<TaskT>::type...>::result::value
, "The type of the parameter of each task in the sequence must match the return type of the preceding task.");
using result_type = typename detail::traits::get_sequence_result_type<TaskT...>::type;
using input_type = typename detail::traits::get_first<TaskT...>::type::input_type;
using task_type = task<input_type, result_type>;
using taskinfo_type = detail::taskinfo<tag::sequential, detail::default_runner_type, input_type, result_type>;
return task_type(std::shared_ptr<typename task_type::impl_type>(new taskinfo_type(t_.m_impl...)));
}
/**
* Factory method for creating @ref tag::intercept "intercept" compound tasks.
*
* @param t_ task to execute (@em try task)
* @param c_ one or more exeception handling (@em catch) tasks
*
* @see @ref tag::intercept "intercept" compound task
*/
template <typename TryT, typename... CatchT>
inline static task<
typename TryT::input_type
, typename TryT::result_type
> try_catch(const TryT& t_, const CatchT&... c_)
{
static_assert(
sizeof...(c_) > 0
, "It takes at least one catch task to create a try_catch (intercept) compound task");
#if defined(WINDOWS_TARGET)
#if (_MSC_VER > 1800)
static_assert(
detail::traits::is_same<typename TryT::result_type, typename CatchT::result_type...>::value
, "TryT task and CatchT tasks must have the same result type");
#endif
#endif
using result_type = typename TryT::result_type;
using input_type = typename TryT::input_type;
using task_type = task<input_type, result_type>;
using taskinfo_type = detail::taskinfo<tag::intercept, detail::default_runner_type, input_type, result_type>;
return task_type(std::shared_ptr<typename task_type::impl_type>(new taskinfo_type(t_.m_impl, c_.m_impl...)));
}
template <typename PredicateT, typename IfT, typename ElseT>
inline static task<
typename PredicateT::input_type
, typename IfT::result_type
> conditional(const PredicateT& p_, const IfT& if_, const ElseT& else_)
{
static_assert(
std::is_same<typename PredicateT::result_type, bool>::value
, "The predicate task must return result of type bool");
static_assert(
detail::traits::is_same<typename PredicateT::input_type, typename IfT::input_type, typename ElseT::input_type>::value
, "All tasks must accept the input parameter of the same type");
static_assert(
std::is_same<typename IfT::result_type, typename ElseT::result_type>::value
, "If and Else part tasks must return result of the same type");
using result_type = typename IfT::result_type;
using input_type = typename PredicateT::input_type;
using task_type = task<input_type, result_type>;
using taskinfo_type = detail::taskinfo<tag::conditional, detail::default_runner_type, input_type, result_type>;
return task_type(std::shared_ptr<typename task_type::impl_type>(new taskinfo_type(p_.m_impl, if_.m_impl, else_.m_impl)));
}
template <typename PredicateT, typename IfT>
inline static task<
typename PredicateT::input_type
, typename IfT::result_type
> conditional(const PredicateT& p_, const IfT& if_)
{
static_assert(
std::is_same<typename IfT::result_type, void>::value
, "The IfT part in a conditional without ElseT part must not return value");
static_assert(
std::is_same<typename PredicateT::result_type, bool>::value
, "The predicate task must return result of type bool");
static_assert(
detail::traits::is_same<typename PredicateT::input_type, typename IfT::input_type>::value
, "All tasks must accept the input parameter of the same type");
using result_type = typename IfT::result_type;
using input_type = typename PredicateT::input_type;
using task_type = task<input_type, result_type>;
using taskinfo_type = detail::taskinfo<tag::conditional, detail::default_runner_type, input_type, result_type>;
return task_type(std::shared_ptr<typename task_type::impl_type>(new taskinfo_type(p_.m_impl, if_.m_impl)));
}
template <typename TaskT>
inline static task<
std::size_t
, typename TaskT::result_type
> repeat( const TaskT t_)
{
using result_type = typename TaskT::result_type;
using input_type = std::size_t;
using task_type = task<input_type, result_type>;
using taskinfo_type = detail::taskinfo<tag::repeat, detail::default_runner_type, input_type, result_type>;
static_assert(
std::is_same<typename TaskT::input_type, std::size_t>::value
, "The task to be repeated must have input_type std::size_t.");
return task_type(std::shared_ptr<typename task_type::impl_type>(new taskinfo_type(t_.m_impl)));
}
template <typename PredicateT, typename BodyT>
inline static task<
typename PredicateT::input_type
, typename BodyT::result_type
> loop(const PredicateT& p_, const BodyT& body_)
{
static_assert(
std::is_same<typename PredicateT::result_type, bool>::value
, "The predicate task must return bool value");
static_assert(
std::is_same<typename PredicateT::input_type, typename BodyT::input_type>::value
, "The predicate and body tasks must accept parameter of the same type.");
static_assert(
detail::traits::is_same<typename PredicateT::input_type, typename BodyT::result_type>::value
, "The return value type of body task must match input parameter of predicate.");
using result_type = typename BodyT::result_type;
using input_type = typename PredicateT::input_type;
using task_type = task<input_type, result_type>;
using taskinfo_type = detail::taskinfo<tag::loop, detail::default_runner_type, input_type, result_type>;
return task_type(std::shared_ptr<typename task_type::impl_type>(new taskinfo_type(p_.m_impl, body_.m_impl)));
}
template <typename PredicateT>
inline static task<
void
, void
> loop(const PredicateT& p_)
{
static_assert(
std::is_same<typename PredicateT::result_type, bool>::value
, "The predicate task must return bool value");
static_assert(
std::is_same<typename PredicateT::input_type, void>::value
, "The predicate cannot have input parameter.");
using result_type = void;
using input_type = void;
using task_type = task<input_type, result_type>;
using taskinfo_type = detail::taskinfo<tag::loop, detail::default_runner_type, input_type, result_type>;
return task_type(std::shared_ptr<typename task_type::impl_type>(new taskinfo_type(p_.m_impl)));
}
};
} } } // namespace
#endif
| [
"leon@digiverse.si"
] | leon@digiverse.si |
1619394517f21677918f481b204f5639e92556ce | 0ca50389f4b300fa318452128ab5437ecc97da65 | /src/color/copyright.hpp | 656ef5809d8dd1f3c8653c8871b39ea5ad795223 | [
"Apache-2.0"
] | permissive | dmilos/color | 5981a07d85632d5c959747dac646ac9976f1c238 | 84dc0512cb5fcf6536d79f0bee2530e678c01b03 | refs/heads/master | 2022-09-03T05:13:16.959970 | 2022-08-20T09:22:24 | 2022-08-22T06:03:32 | 47,105,546 | 160 | 25 | Apache-2.0 | 2021-09-29T07:11:04 | 2015-11-30T08:37:43 | C++ | UTF-8 | C++ | false | false | 712 | hpp | /*
Copyright 2016 Dejan D. M. Milosavljevic
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.
*/
/*
Project Name: Color
Description: Handle and play with color(s)
Source: http://github.com/dmilos/color
*/ | [
"dmilos@gmail.com"
] | dmilos@gmail.com |
fcc335dc97ea087f7d6229fc5d85b66463335a57 | b7c3af550f7662873436f9ed16df793198d36781 | /src/100-199/101.[E]Symmetric-Tree.cpp | efcdc01c34f1f6685fd0e92a37f98df548ae81a1 | [] | no_license | ideawu/leetcode | a50bd2eeada92f8864dda8af33a56d3b6f107e6b | 021746486503203f052f6caf8c24d81032092500 | refs/heads/master | 2020-12-14T12:56:43.382062 | 2020-07-19T04:02:46 | 2020-07-19T04:02:46 | 234,750,758 | 5 | 3 | null | null | null | null | UTF-8 | C++ | false | false | 3,293 | cpp | #include <stdio.h>
#include <string>
#include <list>
#include "../include/all.h"
using namespace std;
/***********************************************************
# 解题思路
* 递归
***********************************************************/
bool helper(TreeNode *left, TreeNode *right){
if(!left && !right){
return true;
}
if(!left || !right){
return false;
}
if(left->val != right->val){
return false;
}
return helper(left->left, right->right) && helper(left->right, right->left);
}
bool isSymmetric(TreeNode* root) {
return helper(root->left, root->right);
}
/***********************************************************
# 解题思路
* 迭代, 不用递归. 那就是广度遍历, 然后判断列表是否对称.
* 用 sep 来做层的分隔.
***********************************************************/
bool list_is_symmetric(list<TreeNode*> &q){
if(q.size() == 0){
return true;
}
auto s = q.begin();
auto e = q.end();
while(1){
e --;
if(s == e){
return true;
}
TreeNode *n1 = *s;
TreeNode *n2 = *e;
if(n1 && n2){
// s->val 并不正确! 因为 s = &T, 其实就是 &(TreeNode*), 是双重指针了.
// (*s) 才是容器内元素的内容.
if(n1->val != n2->val){
return false;
}
}else if(!n1 && !n2){
//
}else if(!n1 || !n2){
return false;
}
s ++;
if(s == e){
return true;
}
}
return false;
}
bool isSymmetric2(TreeNode* root) {
TreeNode *sep = new TreeNode(-1);
list<TreeNode*> q;
q.push_back(sep);
q.push_back(root);
while(1){
TreeNode *node = q.front();
q.pop_front();
if(node == sep){
if(q.empty()){
return true;
}
if(!list_is_symmetric(q)){
return false;
}
q.push_back(sep);
}else{
if(node != NULL){
q.push_back(node->left);
q.push_back(node->right);
}
}
}
}
/***********************************************************
# 解题思路
* 每次都将需要对比的两个节点加入队列中, 一次对比两个节点, 然后继续递归.
***********************************************************/
bool isSymmetric3(TreeNode* root) {
list<TreeNode*> q;
q.push_back(root);
q.push_back(root);
while(!q.empty()){
TreeNode *n1 = q.front();
q.pop_front();
TreeNode *n2 = q.front();
q.pop_front();
if(!n1 && !n2){
continue;
}
if(!n1 || !n2){
return false;
}
if(n1->val != n2->val){
return false;
}
q.push_back(n1->left);
q.push_back(n2->right);
q.push_back(n1->right);
q.push_back(n2->left);
}
return true;
}
int main(int argc, char **argv){
TreeNode *root;
root = build_tree({1,2,2,3,4,4,3});
print_tree(root);
printf("%d\n", isSymmetric(root));
printf("%d\n", isSymmetric2(root));
printf("%d\n", isSymmetric3(root));
root = build_tree({1,2,2,0,3,0,3});
print_tree(root);
printf("%d\n", isSymmetric(root));
printf("%d\n", isSymmetric2(root));
printf("%d\n", isSymmetric3(root));
return 0;
}
/*
Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center).
For example, this binary tree [1,2,2,3,4,4,3] is symmetric:
1
/ \
2 2
/ \ / \
3 4 4 3
But the following [1,2,2,null,3,null,3] is not:
1
/ \
2 2
\ \
3 3
Note:
Bonus points if you could solve it both recursively and iteratively.
*/
| [
"3202758+ideawu@users.noreply.github.com"
] | 3202758+ideawu@users.noreply.github.com |
4e6bc5263de4423b6cd51a45a614854a36bc2298 | d4c91c87550cd0c17a37dbe53a6d4a515af91b50 | /ceilingfanoffcommand.cpp | 677ebce0a0c79eaadbb52e4ab1b8999fc6ae4a17 | [] | no_license | r1N44Ainc/command | a4df7efc4720172a5b2df346cafb7beb757639ec | ee9efab6bae0f6ef48b051884f6423544ddff4f7 | refs/heads/master | 2023-01-31T17:10:10.651689 | 2020-12-10T06:24:05 | 2020-12-10T06:24:05 | 320,169,327 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 252 | cpp | #include "ceilingfanoffcommand.h"
CeilingFanOffCommand::CeilingFanOffCommand(CeilingFan *fan) {
this->ceilingFan = fan;
this->name = "CeilingFanOffCommand on" + fan->location;
}
void CeilingFanOffCommand::execute() {
ceilingFan->off();
}
| [
"danilr1nch@gmail.com"
] | danilr1nch@gmail.com |
9833e194188fccc2abac66dd4f8b7ae4cf934dbe | 8b717ba5c1f8717ca188c5e2266894b9491d5e96 | /Usuario.cpp | 6591d7887d72350485cd19659807dcc1f51bfa24 | [
"MIT"
] | permissive | carlosverduzco/Red_Social | c5e814c005c55ac03ecdee06f40db5df8308ce0f | 9543503e37170de2d775df2133a6c0042d781ffa | refs/heads/master | 2023-05-12T03:10:56.440511 | 2021-06-04T22:15:41 | 2021-06-04T22:15:41 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 362 | cpp | #include "Usuario.h"
Usuario::Usuario(string nombre, string contrasenia, string correo, unsigned int edad, unsigned int area)
{
strcpy(this->nombre, nombre.c_str());
strcpy(this->contrasenia, contrasenia.c_str());
strcpy(this->correo, correo.c_str());
this->edad=edad;
this->area_de_formacion=area;
}
Usuario::Usuario()
{
}
| [
"carloseverduzco@hotmail.com"
] | carloseverduzco@hotmail.com |
06702f6396c1b885954cdd95517597052e77a602 | c1802c1f24d7124144d3139c74aff313bd8c7460 | /lucida/djinntonic/kaldiasr/src/fstext/determinize-lattice-inl.h | b41deb980ee87fe590def8c1e5b7c2cff6369560 | [
"BSD-3-Clause"
] | permissive | jaskon139/jaskon139sirius | 3de80b76bc0571d7905ffc2bcfffa4c570a2a2c4 | d21fa72c2ecaa1326633a146551ed13a815ca5fb | refs/heads/master | 2023-01-07T04:17:36.994426 | 2016-08-09T07:49:22 | 2016-08-09T07:49:22 | 64,655,160 | 1 | 0 | NOASSERTION | 2022-12-26T20:15:31 | 2016-08-01T09:42:20 | C++ | UTF-8 | C++ | false | false | 53,960 | h | // fstext/determinize-lattice-inl.h
// Copyright 2009-2012 Microsoft Corporation
// 2012-2013 Johns Hopkins University (Author: Daniel Povey)
// See ../../COPYING for clarification regarding multiple authors
//
// 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
//
// THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
// WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
// MERCHANTABLITY OR NON-INFRINGEMENT.
// See the Apache 2 License for the specific language governing permissions and
// limitations under the License.
#ifndef KALDI_FSTEXT_DETERMINIZE_LATTICE_INL_H_
#define KALDI_FSTEXT_DETERMINIZE_LATTICE_INL_H_
// Do not include this file directly. It is included by determinize-lattice.h
#include <vector>
#include <climits>
namespace fst {
// This class maps back and forth from/to integer id's to sequences of strings.
// used in determinization algorithm. It is constructed in such a way that
// finding the string-id of the successor of (string, next-label) has constant time.
// Note: class IntType, typically int32, is the type of the element in the
// string (typically a template argument of the CompactLatticeWeightTpl).
template<class IntType> class LatticeStringRepository {
public:
struct Entry {
const Entry *parent; // NULL for empty string.
IntType i;
inline bool operator == (const Entry &other) const {
return (parent == other.parent && i == other.i);
}
Entry() { }
Entry(const Entry &e): parent(e.parent), i(e.i) {}
};
// Note: all Entry* pointers returned in function calls are
// owned by the repository itself, not by the caller!
// Interface guarantees empty string is NULL.
inline const Entry *EmptyString() { return NULL; }
// Returns string of "parent" with i appended. Pointer
// owned by repository
const Entry *Successor(const Entry *parent, IntType i) {
new_entry_->parent = parent;
new_entry_->i = i;
std::pair<typename SetType::iterator, bool> pr = set_.insert(new_entry_);
if (pr.second) { // Was successfully inserted (was not there). We need to
// replace the element we inserted, which resides on the
// stack, with one from the heap.
const Entry *ans = new_entry_;
new_entry_ = new Entry();
return ans;
} else { // Was not inserted because an equivalent Entry already
// existed.
return *pr.first;
}
}
const Entry *Concatenate (const Entry *a, const Entry *b) {
if (a == NULL) return b;
else if (b == NULL) return a;
vector<IntType> v;
ConvertToVector(b, &v);
const Entry *ans = a;
for(size_t i = 0; i < v.size(); i++)
ans = Successor(ans, v[i]);
return ans;
}
const Entry *CommonPrefix (const Entry *a, const Entry *b) {
vector<IntType> a_vec, b_vec;
ConvertToVector(a, &a_vec);
ConvertToVector(b, &b_vec);
const Entry *ans = NULL;
for(size_t i = 0; i < a_vec.size() && i < b_vec.size() &&
a_vec[i] == b_vec[i]; i++)
ans = Successor(ans, a_vec[i]);
return ans;
}
// removes any elements from b that are not part of
// a common prefix with a.
void ReduceToCommonPrefix(const Entry *a,
vector<IntType> *b) {
size_t a_size = Size(a), b_size = b->size();
while (a_size> b_size) {
a = a->parent;
a_size--;
}
if (b_size > a_size)
b_size = a_size;
typename vector<IntType>::iterator b_begin = b->begin();
while (a_size != 0) {
if (a->i != *(b_begin + a_size - 1))
b_size = a_size - 1;
a = a->parent;
a_size--;
}
if (b_size != b->size())
b->resize(b_size);
}
// removes the first n elements of a.
const Entry *RemovePrefix(const Entry *a, size_t n) {
if (n==0) return a;
vector<IntType> a_vec;
ConvertToVector(a, &a_vec);
assert(a_vec.size() >= n);
const Entry *ans = NULL;
for(size_t i = n; i < a_vec.size(); i++)
ans = Successor(ans, a_vec[i]);
return ans;
}
// Returns true if a is a prefix of b. If a is prefix of b,
// time taken is |b| - |a|. Else, time taken is |b|.
bool IsPrefixOf(const Entry *a, const Entry *b) const {
if(a == NULL) return true; // empty string prefix of all.
if (a == b) return true;
if (b == NULL) return false;
return IsPrefixOf(a, b->parent);
}
inline size_t Size(const Entry *entry) const {
size_t ans = 0;
while (entry != NULL) {
ans++;
entry = entry->parent;
}
return ans;
}
void ConvertToVector(const Entry *entry, vector<IntType> *out) const {
size_t length = Size(entry);
out->resize(length);
if (entry != NULL) {
typename vector<IntType>::reverse_iterator iter = out->rbegin();
while (entry != NULL) {
*iter = entry->i;
entry = entry->parent;
++iter;
}
}
}
const Entry *ConvertFromVector(const vector<IntType> &vec) {
const Entry *e = NULL;
for(size_t i = 0; i < vec.size(); i++)
e = Successor(e, vec[i]);
return e;
}
LatticeStringRepository() { new_entry_ = new Entry; }
void Destroy() {
for (typename SetType::iterator iter = set_.begin();
iter != set_.end();
++iter)
delete *iter;
SetType tmp;
tmp.swap(set_);
if (new_entry_) {
delete new_entry_;
new_entry_ = NULL;
}
}
// Rebuild will rebuild this object, guaranteeing only
// to preserve the Entry values that are in the vector pointed
// to (this list does not have to be unique). The point of
// this is to save memory.
void Rebuild(const std::vector<const Entry*> &to_keep) {
SetType tmp_set;
for (typename std::vector<const Entry*>::const_iterator
iter = to_keep.begin();
iter != to_keep.end(); ++iter)
RebuildHelper(*iter, &tmp_set);
// Now delete all elems not in tmp_set.
for (typename SetType::iterator iter = set_.begin();
iter != set_.end(); ++iter) {
if (tmp_set.count(*iter) == 0)
delete (*iter); // delete the Entry; not needed.
}
set_.swap(tmp_set);
}
~LatticeStringRepository() { Destroy(); }
int32 MemSize() const {
return set_.size() * sizeof(Entry) * 2; // this is a lower bound
// on the size this structure might take.
}
private:
class EntryKey { // Hash function object.
public:
inline size_t operator()(const Entry *entry) const {
size_t prime = 49109;
return static_cast<size_t>(entry->i)
+ prime * reinterpret_cast<size_t>(entry->parent);
}
};
class EntryEqual {
public:
inline bool operator()(const Entry *e1, const Entry *e2) const {
return (*e1 == *e2);
}
};
typedef unordered_set<const Entry*, EntryKey, EntryEqual> SetType;
void RebuildHelper(const Entry *to_add, SetType *tmp_set) {
while(true) {
if (to_add == NULL) return;
typename SetType::iterator iter = tmp_set->find(to_add);
if (iter == tmp_set->end()) { // not in tmp_set.
tmp_set->insert(to_add);
to_add = to_add->parent; // and loop.
} else {
return;
}
}
}
DISALLOW_COPY_AND_ASSIGN(LatticeStringRepository);
Entry *new_entry_; // We always have a pre-allocated Entry ready to use,
// to avoid unnecessary news and deletes.
SetType set_;
};
// class LatticeDeterminizer is templated on the same types that
// CompactLatticeWeight is templated on: the base weight (Weight), typically
// LatticeWeightTpl<float> etc. but could also be e.g. TropicalWeight, and the
// IntType, typically int32, used for the output symbols in the compact
// representation of strings [note: the output symbols would usually be
// p.d.f. id's in the anticipated use of this code] It has a special requirement
// on the Weight type: that there should be a Compare function on the weights
// such that Compare(w1, w2) returns -1 if w1 < w2, 0 if w1 == w2, and +1 if w1 >
// w2. This requires that there be a total order on the weights.
template<class Weight, class IntType> class LatticeDeterminizer {
public:
// Output to Gallic acceptor (so the strings go on weights, and there is a 1-1 correspondence
// between our states and the states in ofst. If destroy == true, release memory as we go
// (but we cannot output again).
typedef CompactLatticeWeightTpl<Weight, IntType> CompactWeight;
typedef ArcTpl<CompactWeight> CompactArc; // arc in compact, acceptor form of lattice
typedef ArcTpl<Weight> Arc; // arc in non-compact version of lattice
// Output to standard FST with CompactWeightTpl<Weight> as its weight type (the
// weight stores the original output-symbol strings). If destroy == true,
// release memory as we go (but we cannot output again).
void Output(MutableFst<CompactArc> *ofst, bool destroy = true) {
assert(determinized_);
typedef typename Arc::StateId StateId;
StateId nStates = static_cast<StateId>(output_arcs_.size());
if (destroy)
FreeMostMemory();
ofst->DeleteStates();
ofst->SetStart(kNoStateId);
if (nStates == 0) {
return;
}
for (StateId s = 0;s < nStates;s++) {
OutputStateId news = ofst->AddState();
assert(news == s);
}
ofst->SetStart(0);
// now process transitions.
for (StateId this_state = 0; this_state < nStates; this_state++) {
vector<TempArc> &this_vec(output_arcs_[this_state]);
typename vector<TempArc>::const_iterator iter = this_vec.begin(), end = this_vec.end();
for (;iter != end; ++iter) {
const TempArc &temp_arc(*iter);
CompactArc new_arc;
vector<Label> seq;
repository_.ConvertToVector(temp_arc.string, &seq);
CompactWeight weight(temp_arc.weight, seq);
if (temp_arc.nextstate == kNoStateId) { // is really final weight.
ofst->SetFinal(this_state, weight);
} else { // is really an arc.
new_arc.nextstate = temp_arc.nextstate;
new_arc.ilabel = temp_arc.ilabel;
new_arc.olabel = temp_arc.ilabel; // acceptor. input == output.
new_arc.weight = weight; // includes string and weight.
ofst->AddArc(this_state, new_arc);
}
}
// Free up memory. Do this inside the loop as ofst is also allocating memory
if (destroy) { vector<TempArc> temp; std::swap(temp, this_vec); }
}
if (destroy) { vector<vector<TempArc> > temp; std::swap(temp, output_arcs_); }
}
// Output to standard FST with Weight as its weight type. We will create extra
// states to handle sequences of symbols on the output. If destroy == true,
// release memory as we go (but we cannot output again).
void Output(MutableFst<Arc> *ofst, bool destroy = true) {
// Outputs to standard fst.
OutputStateId nStates = static_cast<OutputStateId>(output_arcs_.size());
ofst->DeleteStates();
if (nStates == 0) {
ofst->SetStart(kNoStateId);
return;
}
if (destroy)
FreeMostMemory();
// Add basic states-- but we will add extra ones to account for strings on output.
for (OutputStateId s = 0;s < nStates;s++) {
OutputStateId news = ofst->AddState();
assert(news == s);
}
ofst->SetStart(0);
for (OutputStateId this_state = 0; this_state < nStates; this_state++) {
vector<TempArc> &this_vec(output_arcs_[this_state]);
typename vector<TempArc>::const_iterator iter = this_vec.begin(), end = this_vec.end();
for (; iter != end; ++iter) {
const TempArc &temp_arc(*iter);
vector<Label> seq;
repository_.ConvertToVector(temp_arc.string, &seq);
if (temp_arc.nextstate == kNoStateId) { // Really a final weight.
// Make a sequence of states going to a final state, with the strings
// as labels. Put the weight on the first arc.
OutputStateId cur_state = this_state;
for (size_t i = 0; i < seq.size(); i++) {
OutputStateId next_state = ofst->AddState();
Arc arc;
arc.nextstate = next_state;
arc.weight = (i == 0 ? temp_arc.weight : Weight::One());
arc.ilabel = 0; // epsilon.
arc.olabel = seq[i];
ofst->AddArc(cur_state, arc);
cur_state = next_state;
}
ofst->SetFinal(cur_state, (seq.size() == 0 ? temp_arc.weight : Weight::One()));
} else { // Really an arc.
OutputStateId cur_state = this_state;
// Have to be careful with this integer comparison (i+1 < seq.size()) because unsigned.
// i < seq.size()-1 could fail for zero-length sequences.
for (size_t i = 0; i+1 < seq.size();i++) {
// for all but the last element of seq, create new state.
OutputStateId next_state = ofst->AddState();
Arc arc;
arc.nextstate = next_state;
arc.weight = (i == 0 ? temp_arc.weight : Weight::One());
arc.ilabel = (i == 0 ? temp_arc.ilabel : 0); // put ilabel on first element of seq.
arc.olabel = seq[i];
ofst->AddArc(cur_state, arc);
cur_state = next_state;
}
// Add the final arc in the sequence.
Arc arc;
arc.nextstate = temp_arc.nextstate;
arc.weight = (seq.size() <= 1 ? temp_arc.weight : Weight::One());
arc.ilabel = (seq.size() <= 1 ? temp_arc.ilabel : 0);
arc.olabel = (seq.size() > 0 ? seq.back() : 0);
ofst->AddArc(cur_state, arc);
}
}
// Free up memory. Do this inside the loop as ofst is also allocating memory
if (destroy) {
vector<TempArc> temp; temp.swap(this_vec);
}
}
if (destroy) {
vector<vector<TempArc> > temp;
temp.swap(output_arcs_);
repository_.Destroy();
}
}
// Initializer. After initializing the object you will typically
// call Determinize() and then call one of the Output functions.
// Note: ifst.Copy() will generally do a
// shallow copy. We do it like this for memory safety, rather than
// keeping a reference or pointer to ifst_.
LatticeDeterminizer(const Fst<Arc> &ifst,
DeterminizeLatticeOptions opts):
num_arcs_(0), num_elems_(0), ifst_(ifst.Copy()), opts_(opts),
equal_(opts_.delta), determinized_(false),
minimal_hash_(3, hasher_, equal_), initial_hash_(3, hasher_, equal_) {
KALDI_ASSERT(Weight::Properties() & kIdempotent); // this algorithm won't
// work correctly otherwise.
}
// frees all except output_arcs_, which contains the important info
// we need to output the FST.
void FreeMostMemory() {
if (ifst_) {
delete ifst_;
ifst_ = NULL;
}
for (typename MinimalSubsetHash::iterator iter = minimal_hash_.begin();
iter != minimal_hash_.end(); ++iter)
delete iter->first;
{ MinimalSubsetHash tmp; tmp.swap(minimal_hash_); }
for (typename InitialSubsetHash::iterator iter = initial_hash_.begin();
iter != initial_hash_.end(); ++iter)
delete iter->first;
{ InitialSubsetHash tmp; tmp.swap(initial_hash_); }
{ vector<vector<Element>* > output_states_tmp;
output_states_tmp.swap(output_states_); }
{ vector<char> tmp; tmp.swap(isymbol_or_final_); }
{ vector<OutputStateId> tmp; tmp.swap(queue_); }
{ vector<pair<Label, Element> > tmp; tmp.swap(all_elems_tmp_); }
}
~LatticeDeterminizer() {
FreeMostMemory(); // rest is deleted by destructors.
}
void RebuildRepository() { // rebuild the string repository,
// freeing stuff we don't need.. we call this when memory usage
// passes a supplied threshold. We need to accumulate all the
// strings we need the repository to "remember", then tell it
// to clean the repository.
std::vector<StringId> needed_strings;
for (size_t i = 0; i < output_arcs_.size(); i++)
for (size_t j = 0; j < output_arcs_[i].size(); j++)
needed_strings.push_back(output_arcs_[i][j].string);
// the following loop covers strings present in minimal_hash_
// which are also accessible via output_states_.
for (size_t i = 0; i < output_states_.size(); i++)
for (size_t j = 0; j < output_states_[i]->size(); j++)
needed_strings.push_back((*(output_states_[i]))[j].string);
// the following loop covers strings present in initial_hash_.
for (typename InitialSubsetHash::const_iterator
iter = initial_hash_.begin();
iter != initial_hash_.end(); ++iter) {
const vector<Element> &vec = *(iter->first);
Element elem = iter->second;
for (size_t i = 0; i < vec.size(); i++)
needed_strings.push_back(vec[i].string);
needed_strings.push_back(elem.string);
}
std::sort(needed_strings.begin(), needed_strings.end());
needed_strings.erase(std::unique(needed_strings.begin(),
needed_strings.end()),
needed_strings.end()); // uniq the strings.
repository_.Rebuild(needed_strings);
}
bool CheckMemoryUsage() {
int32 repo_size = repository_.MemSize(),
arcs_size = num_arcs_ * sizeof(TempArc),
elems_size = num_elems_ * sizeof(Element),
total_size = repo_size + arcs_size + elems_size;
if (opts_.max_mem > 0 && total_size > opts_.max_mem) { // We passed the memory threshold.
// This is usually due to the repository getting large, so we
// clean this out.
RebuildRepository();
int32 new_repo_size = repository_.MemSize(),
new_total_size = new_repo_size + arcs_size + elems_size;
KALDI_VLOG(2) << "Rebuilt repository in determinize-lattice: repository shrank from "
<< repo_size << " to " << new_repo_size << " bytes (approximately)";
if (new_total_size > static_cast<int32>(opts_.max_mem * 0.8)) {
// Rebuilding didn't help enough-- we need a margin to stop
// having to rebuild too often.
KALDI_WARN << "Failure in determinize-lattice: size exceeds maximum "
<< opts_.max_mem << " bytes; (repo,arcs,elems) = ("
<< repo_size << "," << arcs_size << "," << elems_size
<< "), after rebuilding, repo size was " << new_repo_size;
return false;
}
}
return true;
}
// Returns true on success. Can fail for out-of-memory
// or max-states related reasons.
bool Determinize(bool *debug_ptr) {
assert(!determinized_);
// This determinizes the input fst but leaves it in the "special format"
// in "output_arcs_". Must be called after Initialize(). To get the
// output, call one of the Output routines.
try {
InitializeDeterminization(); // some start-up tasks.
while (!queue_.empty()) {
OutputStateId out_state = queue_.back();
queue_.pop_back();
ProcessState(out_state);
if (debug_ptr && *debug_ptr) Debug(); // will exit.
if (!CheckMemoryUsage()) return false;
}
return (determinized_ = true);
} catch (std::bad_alloc) {
int32 repo_size = repository_.MemSize(),
arcs_size = num_arcs_ * sizeof(TempArc),
elems_size = num_elems_ * sizeof(Element),
total_size = repo_size + arcs_size + elems_size;
KALDI_WARN << "Memory allocation error doing lattice determinization; using "
<< total_size << " bytes (max = " << opts_.max_mem
<< " (repo,arcs,elems) = ("
<< repo_size << "," << arcs_size << "," << elems_size << ")";
return (determinized_ = false);
} catch (std::runtime_error) {
std::cerr << "Caught exception doing lattice determinization\n";
return (determinized_ = false);
}
}
private:
typedef typename Arc::Label Label;
typedef typename Arc::StateId StateId; // use this when we don't know if it's input or output.
typedef typename Arc::StateId InputStateId; // state in the input FST.
typedef typename Arc::StateId OutputStateId; // same as above but distinguish
// states in output Fst.
typedef LatticeStringRepository<IntType> StringRepositoryType;
typedef const typename StringRepositoryType::Entry* StringId;
// Element of a subset [of original states]
struct Element {
StateId state; // use StateId as this is usually InputStateId but in one case
// OutputStateId.
StringId string;
Weight weight;
bool operator != (const Element &other) const {
return (state != other.state || string != other.string ||
weight != other.weight);
}
};
// Arcs in the format we temporarily create in this class (a representation, essentially of
// a Gallic Fst).
struct TempArc {
Label ilabel;
StringId string; // Look it up in the StringRepository, it's a sequence of Labels.
OutputStateId nextstate; // or kNoState for final weights.
Weight weight;
};
// Hashing function used in hash of subsets.
// A subset is a pointer to vector<Element>.
// The Elements are in sorted order on state id, and without repeated states.
// Because the order of Elements is fixed, we can use a hashing function that is
// order-dependent. However the weights are not included in the hashing function--
// we hash subsets that differ only in weight to the same key. This is not optimal
// in terms of the O(N) performance but typically if we have a lot of determinized
// states that differ only in weight then the input probably was pathological in some way,
// or even non-determinizable.
// We don't quantize the weights, in order to avoid inexactness in simple cases.
// Instead we apply the delta when comparing subsets for equality, and allow a small
// difference.
class SubsetKey {
public:
size_t operator ()(const vector<Element> * subset) const { // hashes only the state and string.
size_t hash = 0, factor = 1;
for (typename vector<Element>::const_iterator iter= subset->begin(); iter != subset->end(); ++iter) {
hash *= factor;
hash += iter->state + reinterpret_cast<size_t>(iter->string);
factor *= 23531; // these numbers are primes.
}
return hash;
}
};
// This is the equality operator on subsets. It checks for exact match on state-id
// and string, and approximate match on weights.
class SubsetEqual {
public:
bool operator ()(const vector<Element> * s1, const vector<Element> * s2) const {
size_t sz = s1->size();
assert(sz>=0);
if (sz != s2->size()) return false;
typename vector<Element>::const_iterator iter1 = s1->begin(),
iter1_end = s1->end(), iter2=s2->begin();
for (; iter1 < iter1_end; ++iter1, ++iter2) {
if (iter1->state != iter2->state ||
iter1->string != iter2->string ||
! ApproxEqual(iter1->weight, iter2->weight, delta_)) return false;
}
return true;
}
float delta_;
SubsetEqual(float delta): delta_(delta) {}
SubsetEqual(): delta_(kDelta) {}
};
// Operator that says whether two Elements have the same states.
// Used only for debug.
class SubsetEqualStates {
public:
bool operator ()(const vector<Element> * s1, const vector<Element> * s2) const {
size_t sz = s1->size();
assert(sz>=0);
if (sz != s2->size()) return false;
typename vector<Element>::const_iterator iter1 = s1->begin(),
iter1_end = s1->end(), iter2=s2->begin();
for (; iter1 < iter1_end; ++iter1, ++iter2) {
if (iter1->state != iter2->state) return false;
}
return true;
}
};
// Define the hash type we use to map subsets (in minimal
// representation) to OutputStateId.
typedef unordered_map<const vector<Element>*, OutputStateId,
SubsetKey, SubsetEqual> MinimalSubsetHash;
// Define the hash type we use to map subsets (in initial
// representation) to OutputStateId, together with an
// extra weight. [note: we interpret the Element.state in here
// as an OutputStateId even though it's declared as InputStateId;
// these types are the same anyway].
typedef unordered_map<const vector<Element>*, Element,
SubsetKey, SubsetEqual> InitialSubsetHash;
// converts the representation of the subset from canonical (all states) to
// minimal (only states with output symbols on arcs leaving them, and final
// states). Output is not necessarily normalized, even if input_subset was.
void ConvertToMinimal(vector<Element> *subset) {
assert(!subset->empty());
typename vector<Element>::iterator cur_in = subset->begin(),
cur_out = subset->begin(), end = subset->end();
while (cur_in != end) {
if(IsIsymbolOrFinal(cur_in->state)) { // keep it...
*cur_out = *cur_in;
cur_out++;
}
cur_in++;
}
subset->resize(cur_out - subset->begin());
}
// Takes a minimal, normalized subset, and converts it to an OutputStateId.
// Involves a hash lookup, and possibly adding a new OutputStateId.
// If it creates a new OutputStateId, it adds it to the queue.
OutputStateId MinimalToStateId(const vector<Element> &subset) {
typename MinimalSubsetHash::const_iterator iter
= minimal_hash_.find(&subset);
if (iter != minimal_hash_.end()) // Found a matching subset.
return iter->second;
OutputStateId ans = static_cast<OutputStateId>(output_arcs_.size());
vector<Element> *subset_ptr = new vector<Element>(subset);
output_states_.push_back(subset_ptr);
num_elems_ += subset_ptr->size();
output_arcs_.push_back(vector<TempArc>());
minimal_hash_[subset_ptr] = ans;
queue_.push_back(ans);
return ans;
}
// Given a normalized initial subset of elements (i.e. before epsilon closure),
// compute the corresponding output-state.
OutputStateId InitialToStateId(const vector<Element> &subset_in,
Weight *remaining_weight,
StringId *common_prefix) {
typename InitialSubsetHash::const_iterator iter
= initial_hash_.find(&subset_in);
if (iter != initial_hash_.end()) { // Found a matching subset.
const Element &elem = iter->second;
*remaining_weight = elem.weight;
*common_prefix = elem.string;
if (elem.weight == Weight::Zero())
std::cerr << "Zero weight!\n"; // TEMP
return elem.state;
}
// else no matching subset-- have to work it out.
vector<Element> subset(subset_in);
// Follow through epsilons. Will add no duplicate states. note: after
// EpsilonClosure, it is the same as "canonical" subset, except not
// normalized (actually we never compute the normalized canonical subset,
// only the normalized minimal one).
EpsilonClosure(&subset); // follow epsilons.
ConvertToMinimal(&subset); // remove all but emitting and final states.
Element elem; // will be used to store remaining weight and string, and
// OutputStateId, in initial_hash_;
NormalizeSubset(&subset, &elem.weight, &elem.string); // normalize subset; put
// common string and weight in "elem". The subset is now a minimal,
// normalized subset.
OutputStateId ans = MinimalToStateId(subset);
*remaining_weight = elem.weight;
*common_prefix = elem.string;
if (elem.weight == Weight::Zero())
std::cerr << "Zero weight!\n"; // TEMP
// Before returning "ans", add the initial subset to the hash,
// so that we can bypass the epsilon-closure etc., next time
// we process the same initial subset.
vector<Element> *initial_subset_ptr = new vector<Element>(subset_in);
elem.state = ans;
initial_hash_[initial_subset_ptr] = elem;
num_elems_ += initial_subset_ptr->size(); // keep track of memory usage.
return ans;
}
// returns the Compare value (-1 if a < b, 0 if a == b, 1 if a > b) according
// to the ordering we defined on strings for the CompactLatticeWeightTpl.
// see function
// inline int Compare (const CompactLatticeWeightTpl<WeightType,IntType> &w1,
// const CompactLatticeWeightTpl<WeightType,IntType> &w2)
// in lattice-weight.h.
// this is the same as that, but optimized for our data structures.
inline int Compare(const Weight &a_w, StringId a_str,
const Weight &b_w, StringId b_str) const {
int weight_comp = fst::Compare(a_w, b_w);
if (weight_comp != 0) return weight_comp;
// now comparing strings.
if (a_str == b_str) return 0;
vector<IntType> a_vec, b_vec;
repository_.ConvertToVector(a_str, &a_vec);
repository_.ConvertToVector(b_str, &b_vec);
// First compare their lengths.
int a_len = a_vec.size(), b_len = b_vec.size();
// use opposite order on the string lengths (c.f. Compare in
// lattice-weight.h)
if (a_len > b_len) return -1;
else if (a_len < b_len) return 1;
for(int i = 0; i < a_len; i++) {
if (a_vec[i] < b_vec[i]) return -1;
else if (a_vec[i] > b_vec[i]) return 1;
}
assert(0); // because we checked if a_str == b_str above, shouldn't reach here
return 0;
}
// This function computes epsilon closure of subset of states by following epsilon links.
// Called by InitialToStateId and Initialize.
// Has no side effects except on the string repository. The "output_subset" is not
// necessarily normalized (in the sense of there being no common substring), unless
// input_subset was.
void EpsilonClosure(vector<Element> *subset) {
// at input, subset must have only one example of each StateId. [will still
// be so at output]. This function follows input-epsilons, and augments the
// subset accordingly.
unordered_map<InputStateId, Element> cur_subset;
typedef typename unordered_map<InputStateId, Element>::iterator MapIter;
{
MapIter iter = cur_subset.end();
for (size_t i = 0;i < subset->size();i++) {
std::pair<const InputStateId, Element> pr((*subset)[i].state, (*subset)[i]);
#if __GNUC__ == 4 && __GNUC_MINOR__ == 0
iter = cur_subset.insert(iter, pr).first;
#else
iter = cur_subset.insert(iter, pr);
#endif
// By providing iterator where we inserted last one, we make insertion more efficient since
// input subset was already in sorted order.
}
}
// find whether input fst is known to be sorted on input label.
bool sorted = ((ifst_->Properties(kILabelSorted, false) & kILabelSorted) != 0);
std::deque<Element> queue;
for (typename vector<Element>::const_iterator iter = subset->begin();
iter != subset->end();
++iter) queue.push_back(*iter);
bool replaced_elems = false; // relates to an optimization, see below.
int counter = 0; // stops infinite loops here for non-lattice-determinizable input;
// useful in testing.
while (queue.size() != 0) {
Element elem = queue.front();
queue.pop_front();
// The next if-statement is a kind of optimization. It's to prevent us
// unnecessarily repeating the processing of a state. "cur_subset" always
// contains only one Element with a particular state. The issue is that
// whenever we modify the Element corresponding to that state in "cur_subset",
// both the new (optimal) and old (less-optimal) Element will still be in
// "queue". The next if-statement stops us from wasting compute by
// processing the old Element.
if (replaced_elems && cur_subset[elem.state] != elem)
continue;
if (opts_.max_loop > 0 && counter++ > opts_.max_loop) {
KALDI_ERR << "Lattice determinization aborted since looped more than "
<< opts_.max_loop << " times during epsilon closure.\n";
throw std::runtime_error("looped more than max-arcs times in lattice determinization");
}
for (ArcIterator<Fst<Arc> > aiter(*ifst_, elem.state); !aiter.Done(); aiter.Next()) {
const Arc &arc = aiter.Value();
if (sorted && arc.ilabel != 0) break; // Break from the loop: due to sorting there will be no
// more transitions with epsilons as input labels.
if (arc.ilabel == 0
&& arc.weight != Weight::Zero()) { // Epsilon transition.
Element next_elem;
next_elem.state = arc.nextstate;
next_elem.weight = Times(elem.weight, arc.weight);
// now must append strings
if (arc.olabel == 0)
next_elem.string = elem.string;
else
next_elem.string = repository_.Successor(elem.string, arc.olabel);
typename unordered_map<InputStateId, Element>::iterator
iter = cur_subset.find(next_elem.state);
if (iter == cur_subset.end()) {
// was no such StateId: insert and add to queue.
cur_subset[next_elem.state] = next_elem;
queue.push_back(next_elem);
} else {
// was not inserted because one already there. In normal determinization we'd
// add the weights. Here, we find which one has the better weight, and
// keep its corresponding string.
int comp = Compare(next_elem.weight, next_elem.string,
iter->second.weight, iter->second.string);
if(comp == 1) { // next_elem is better, so use its (weight, string)
iter->second.string = next_elem.string;
iter->second.weight = next_elem.weight;
queue.push_back(next_elem);
replaced_elems = true;
}
// else it is the same or worse, so use original one.
}
}
}
}
{ // copy cur_subset to subset.
// sorted order is automatic.
subset->clear();
subset->reserve(cur_subset.size());
MapIter iter = cur_subset.begin(), end = cur_subset.end();
for (; iter != end; ++iter) subset->push_back(iter->second);
}
}
// This function works out the final-weight of the determinized state.
// called by ProcessSubset.
// Has no side effects except on the variable repository_, and output_arcs_.
void ProcessFinal(OutputStateId output_state) {
const vector<Element> &minimal_subset = *(output_states_[output_state]);
// processes final-weights for this subset.
// minimal_subset may be empty if the graphs is not connected/trimmed, I think,
// do don't check that it's nonempty.
bool is_final = false;
StringId final_string = NULL; // = NULL to keep compiler happy.
Weight final_weight = Weight::Zero();
typename vector<Element>::const_iterator iter = minimal_subset.begin(), end = minimal_subset.end();
for (; iter != end; ++iter) {
const Element &elem = *iter;
Weight this_final_weight = Times(elem.weight, ifst_->Final(elem.state));
StringId this_final_string = elem.string;
if (this_final_weight != Weight::Zero() &&
(!is_final || Compare(this_final_weight, this_final_string,
final_weight, final_string) == 1)) { // the new
// (weight, string) pair is more in semiring than our current
// one.
is_final = true;
final_weight = this_final_weight;
final_string = this_final_string;
}
}
if (is_final) {
// store final weights in TempArc structure, just like a transition.
TempArc temp_arc;
temp_arc.ilabel = 0;
temp_arc.nextstate = kNoStateId; // special marker meaning "final weight".
temp_arc.string = final_string;
temp_arc.weight = final_weight;
output_arcs_[output_state].push_back(temp_arc);
num_arcs_++;
}
}
// NormalizeSubset normalizes the subset "elems" by
// removing any common string prefix (putting it in common_str),
// and dividing by the total weight (putting it in tot_weight).
void NormalizeSubset(vector<Element> *elems,
Weight *tot_weight,
StringId *common_str) {
if(elems->empty()) { // just set common_str, tot_weight
std::cerr << "[empty subset]\n"; // TEMP
// to defaults and return...
*common_str = repository_.EmptyString();
*tot_weight = Weight::Zero();
return;
}
size_t size = elems->size();
vector<IntType> common_prefix;
repository_.ConvertToVector((*elems)[0].string, &common_prefix);
Weight weight = (*elems)[0].weight;
for(size_t i = 1; i < size; i++) {
weight = Plus(weight, (*elems)[i].weight);
repository_.ReduceToCommonPrefix((*elems)[i].string, &common_prefix);
}
assert(weight != Weight::Zero()); // we made sure to ignore arcs with zero
// weights on them, so we shouldn't have zero here.
size_t prefix_len = common_prefix.size();
for(size_t i = 0; i < size; i++) {
(*elems)[i].weight = Divide((*elems)[i].weight, weight, DIVIDE_LEFT);
(*elems)[i].string =
repository_.RemovePrefix((*elems)[i].string, prefix_len);
}
*common_str = repository_.ConvertFromVector(common_prefix);
*tot_weight = weight;
}
// Take a subset of Elements that is sorted on state, and
// merge any Elements that have the same state (taking the best
// (weight, string) pair in the semiring).
void MakeSubsetUnique(vector<Element> *subset) {
typedef typename vector<Element>::iterator IterType;
// This assert is designed to fail (usually) if the subset is not sorted on
// state.
assert(subset->size() < 2 || (*subset)[0].state <= (*subset)[1].state);
IterType cur_in = subset->begin(), cur_out = cur_in, end = subset->end();
size_t num_out = 0;
// Merge elements with same state-id
while (cur_in != end) { // while we have more elements to process.
// At this point, cur_out points to location of next place we want to put an element,
// cur_in points to location of next element we want to process.
if (cur_in != cur_out) *cur_out = *cur_in;
cur_in++;
while (cur_in != end && cur_in->state == cur_out->state) {
if (Compare(cur_in->weight, cur_in->string,
cur_out->weight, cur_out->string) == 1) {
// if *cur_in > *cur_out in semiring, then take *cur_in.
cur_out->string = cur_in->string;
cur_out->weight = cur_in->weight;
}
cur_in++;
}
cur_out++;
num_out++;
}
subset->resize(num_out);
}
// ProcessTransition is called from "ProcessTransitions". Broken out for
// clarity. Processes a transition from state "state". The set of Elements
// represents a set of next-states with associated weights and strings, each
// one arising from an arc from some state in a determinized-state; the
// next-states are not necessarily unique (i.e. there may be >1 entry
// associated with each), and any such sets of Elements have to be merged
// within this routine (we take the [weight, string] pair that's better in the
// semiring).
void ProcessTransition(OutputStateId state, Label ilabel, vector<Element> *subset) {
MakeSubsetUnique(subset); // remove duplicates with the same state.
StringId common_str;
Weight tot_weight;
NormalizeSubset(subset, &tot_weight, &common_str);
OutputStateId nextstate;
{
Weight next_tot_weight;
StringId next_common_str;
nextstate = InitialToStateId(*subset,
&next_tot_weight,
&next_common_str);
common_str = repository_.Concatenate(common_str, next_common_str);
tot_weight = Times(tot_weight, next_tot_weight);
}
// Now add an arc to the next state (would have been created if necessary by
// InitialToStateId).
TempArc temp_arc;
temp_arc.ilabel = ilabel;
temp_arc.nextstate = nextstate;
temp_arc.string = common_str;
temp_arc.weight = tot_weight;
output_arcs_[state].push_back(temp_arc); // record the arc.
num_arcs_++;
}
// "less than" operator for pair<Label, Element>. Used in ProcessTransitions.
// Lexicographical order, which only compares the state when ordering the
// "Element" member of the pair.
class PairComparator {
public:
inline bool operator () (const pair<Label, Element> &p1, const pair<Label, Element> &p2) {
if (p1.first < p2.first) return true;
else if (p1.first > p2.first) return false;
else {
return p1.second.state < p2.second.state;
}
}
};
// ProcessTransitions processes emitting transitions (transitions
// with ilabels) out of this subset of states.
// Does not consider final states. Breaks the emitting transitions up by ilabel,
// and creates a new transition in the determinized FST for each unique ilabel.
// Does this by creating a big vector of pairs <Label, Element> and then sorting them
// using a lexicographical ordering, and calling ProcessTransition for each range
// with the same ilabel.
// Side effects on repository, and (via ProcessTransition) on Q_, hash_,
// and output_arcs_.
void ProcessTransitions(OutputStateId output_state) {
const vector<Element> &minimal_subset = *(output_states_[output_state]);
// it's possible that minimal_subset could be empty if there are
// unreachable parts of the graph, so don't check that it's nonempty.
vector<pair<Label, Element> > &all_elems(all_elems_tmp_); // use class member
// to avoid memory allocation/deallocation.
{
// Push back into "all_elems", elements corresponding to all
// non-epsilon-input transitions out of all states in "minimal_subset".
typename vector<Element>::const_iterator iter = minimal_subset.begin(), end = minimal_subset.end();
for (;iter != end; ++iter) {
const Element &elem = *iter;
for (ArcIterator<Fst<Arc> > aiter(*ifst_, elem.state); ! aiter.Done(); aiter.Next()) {
const Arc &arc = aiter.Value();
if (arc.ilabel != 0
&& arc.weight != Weight::Zero()) { // Non-epsilon transition -- ignore epsilons here.
pair<Label, Element> this_pr;
this_pr.first = arc.ilabel;
Element &next_elem(this_pr.second);
next_elem.state = arc.nextstate;
next_elem.weight = Times(elem.weight, arc.weight);
if (arc.olabel == 0) // output epsilon
next_elem.string = elem.string;
else
next_elem.string = repository_.Successor(elem.string, arc.olabel);
all_elems.push_back(this_pr);
}
}
}
}
PairComparator pc;
std::sort(all_elems.begin(), all_elems.end(), pc);
// now sorted first on input label, then on state.
typedef typename vector<pair<Label, Element> >::const_iterator PairIter;
PairIter cur = all_elems.begin(), end = all_elems.end();
vector<Element> this_subset;
while (cur != end) {
// Process ranges that share the same input symbol.
Label ilabel = cur->first;
this_subset.clear();
while (cur != end && cur->first == ilabel) {
this_subset.push_back(cur->second);
cur++;
}
// We now have a subset for this ilabel.
assert(!this_subset.empty()); // temp.
ProcessTransition(output_state, ilabel, &this_subset);
}
all_elems.clear(); // as it's a class variable-- want it to stay
// emtpy.
}
// ProcessState does the processing of a determinized state, i.e. it creates
// transitions out of it and the final-probability if any.
void ProcessState(OutputStateId output_state) {
ProcessFinal(output_state);
ProcessTransitions(output_state);
}
void Debug() { // this function called if you send a signal
// SIGUSR1 to the process (and it's caught by the handler in
// fstdeterminizestar). It prints out some traceback
// info and exits.
std::cerr << "Debug function called (probably SIGUSR1 caught).\n";
// free up memory from the hash as we need a little memory
{ MinimalSubsetHash hash_tmp; hash_tmp.swap(minimal_hash_); }
if (output_arcs_.size() <= 2) {
std::cerr << "Nothing to trace back";
exit(1);
}
size_t max_state = output_arcs_.size() - 2; // don't take the last
// one as we might be halfway into constructing it.
vector<OutputStateId> predecessor(max_state+1, kNoStateId);
for (size_t i = 0; i < max_state; i++) {
for (size_t j = 0; j < output_arcs_[i].size(); j++) {
OutputStateId nextstate = output_arcs_[i][j].nextstate;
// always find an earlier-numbered prececessor; this
// is always possible because of the way the algorithm
// works.
if (nextstate <= max_state && nextstate > i)
predecessor[nextstate] = i;
}
}
vector<pair<Label, StringId> > traceback;
// traceback is a pair of (ilabel, olabel-seq).
OutputStateId cur_state = max_state; // a recently constructed state.
while (cur_state != 0 && cur_state != kNoStateId) {
OutputStateId last_state = predecessor[cur_state];
pair<Label, StringId> p;
size_t i;
for (i = 0; i < output_arcs_[last_state].size(); i++) {
if (output_arcs_[last_state][i].nextstate == cur_state) {
p.first = output_arcs_[last_state][i].ilabel;
p.second = output_arcs_[last_state][i].string;
traceback.push_back(p);
break;
}
}
assert(i != output_arcs_[last_state].size()); // or fell off loop.
cur_state = last_state;
}
if (cur_state == kNoStateId)
std::cerr << "Traceback did not reach start state (possibly debug-code error)";
std::cerr << "Traceback below (or on standard error) in format ilabel (olabel olabel) ilabel (olabel) ...\n";
for (ssize_t i = traceback.size() - 1; i >= 0; i--) {
std::cerr << traceback[i].first << ' ' << "( ";
vector<Label> seq;
repository_.ConvertToVector(traceback[i].second, &seq);
for (size_t j = 0; j < seq.size(); j++)
std::cerr << seq[j] << ' ';
std::cerr << ") ";
}
std::cerr << '\n';
exit(1);
}
bool IsIsymbolOrFinal(InputStateId state) { // returns true if this state
// of the input FST either is final or has an osymbol on an arc out of it.
// Uses the vector isymbol_or_final_ as a cache for this info.
assert(state >= 0);
if (isymbol_or_final_.size() <= state)
isymbol_or_final_.resize(state+1, static_cast<char>(OSF_UNKNOWN));
if (isymbol_or_final_[state] == static_cast<char>(OSF_NO))
return false;
else if (isymbol_or_final_[state] == static_cast<char>(OSF_YES))
return true;
// else work it out...
isymbol_or_final_[state] = static_cast<char>(OSF_NO);
if (ifst_->Final(state) != Weight::Zero())
isymbol_or_final_[state] = static_cast<char>(OSF_YES);
for (ArcIterator<Fst<Arc> > aiter(*ifst_, state);
!aiter.Done();
aiter.Next()) {
const Arc &arc = aiter.Value();
if (arc.ilabel != 0 && arc.weight != Weight::Zero()) {
isymbol_or_final_[state] = static_cast<char>(OSF_YES);
return true;
}
}
return IsIsymbolOrFinal(state); // will only recurse once.
}
void InitializeDeterminization() {
if(ifst_->Properties(kExpanded, false) != 0) { // if we know the number of
// states in ifst_, it might be a bit more efficient
// to pre-size the hashes so we're not constantly rebuilding them.
#if !(__GNUC__ == 4 && __GNUC_MINOR__ == 0)
StateId num_states =
down_cast<const ExpandedFst<Arc>*, const Fst<Arc> >(ifst_)->NumStates();
minimal_hash_.rehash(num_states/2 + 3);
initial_hash_.rehash(num_states/2 + 3);
#endif
}
InputStateId start_id = ifst_->Start();
if (start_id != kNoStateId) {
/* Insert determinized-state corresponding to the start state into hash and
queue. Unlike all the other states, we don't "normalize" the representation
of this determinized-state before we put it into minimal_hash_. This is actually
what we want, as otherwise we'd have problems dealing with any extra weight
and string and might have to create a "super-initial" state which would make
the output nondeterministic. Normalization is only needed to make the
determinized output more minimal anyway, it's not needed for correctness.
Note, we don't put anything in the initial_hash_. The initial_hash_ is only
a lookaside buffer anyway, so this isn't a problem-- it will get populated
later if it needs to be.
*/
Element elem;
elem.state = start_id;
elem.weight = Weight::One();
elem.string = repository_.EmptyString(); // Id of empty sequence.
vector<Element> subset;
subset.push_back(elem);
EpsilonClosure(&subset); // follow through epsilon-inputs links
ConvertToMinimal(&subset); // remove all but final states and
// states with input-labels on arcs out of them.
vector<Element> *subset_ptr = new vector<Element>(subset);
assert(output_arcs_.empty() && output_states_.empty());
// add the new state...
output_states_.push_back(subset_ptr);
output_arcs_.push_back(vector<TempArc>());
OutputStateId initial_state = 0;
minimal_hash_[subset_ptr] = initial_state;
queue_.push_back(initial_state);
}
}
DISALLOW_COPY_AND_ASSIGN(LatticeDeterminizer);
vector<vector<Element>* > output_states_; // maps from output state to
// minimal representation [normalized].
// View pointers as owned in
// minimal_hash_.
vector<vector<TempArc> > output_arcs_; // essentially an FST in our format.
int num_arcs_; // keep track of memory usage: number of arcs in output_arcs_
int num_elems_; // keep track of memory usage: number of elems in output_states_
const Fst<Arc> *ifst_;
DeterminizeLatticeOptions opts_;
SubsetKey hasher_; // object that computes keys-- has no data members.
SubsetEqual equal_; // object that compares subsets-- only data member is delta_.
bool determinized_; // set to true when user called Determinize(); used to make
// sure this object is used correctly.
MinimalSubsetHash minimal_hash_; // hash from Subset to OutputStateId. Subset is "minimal
// representation" (only include final and states and states with
// nonzero ilabel on arc out of them. Owns the pointers
// in its keys.
InitialSubsetHash initial_hash_; // hash from Subset to Element, which
// represents the OutputStateId together
// with an extra weight and string. Subset
// is "initial representation". The extra
// weight and string is needed because after
// we convert to minimal representation and
// normalize, there may be an extra weight
// and string. Owns the pointers
// in its keys.
vector<OutputStateId> queue_; // Queue of output-states to process. Starts with
// state 0, and increases and then (hopefully) decreases in length during
// determinization. LIFO queue (queue discipline doesn't really matter).
vector<pair<Label, Element> > all_elems_tmp_; // temporary vector used in ProcessTransitions.
enum IsymbolOrFinal { OSF_UNKNOWN = 0, OSF_NO = 1, OSF_YES = 2 };
vector<char> isymbol_or_final_; // A kind of cache; it says whether
// each state is (emitting or final) where emitting means it has at least one
// non-epsilon output arc. Only accessed by IsIsymbolOrFinal()
LatticeStringRepository<IntType> repository_; // defines a compact and fast way of
// storing sequences of labels.
};
// normally Weight would be LatticeWeight<float> (which has two floats),
// or possibly TropicalWeightTpl<float>, and IntType would be int32.
template<class Weight, class IntType>
bool DeterminizeLattice(const Fst<ArcTpl<Weight> > &ifst,
MutableFst<ArcTpl<Weight> > *ofst,
DeterminizeLatticeOptions opts,
bool *debug_ptr) {
ofst->SetInputSymbols(ifst.InputSymbols());
ofst->SetOutputSymbols(ifst.OutputSymbols());
LatticeDeterminizer<Weight, IntType> det(ifst, opts);
if (!det.Determinize(debug_ptr))
return false;
det.Output(ofst);
return true;
}
// normally Weight would be LatticeWeight<float> (which has two floats),
// or possibly TropicalWeightTpl<float>, and IntType would be int32.
template<class Weight, class IntType>
bool DeterminizeLattice(const Fst<ArcTpl<Weight> >&ifst,
MutableFst<ArcTpl<CompactLatticeWeightTpl<Weight, IntType> > >*ofst,
DeterminizeLatticeOptions opts,
bool *debug_ptr) {
ofst->SetInputSymbols(ifst.InputSymbols());
ofst->SetOutputSymbols(ifst.OutputSymbols());
LatticeDeterminizer<Weight, IntType> det(ifst, opts);
if (!det.Determinize(debug_ptr))
return false;
det.Output(ofst);
return true;
}
}
#endif
| [
"56ed13112d5271e87f00018a@ex-std-node835.prod.rhcloud.com"
] | 56ed13112d5271e87f00018a@ex-std-node835.prod.rhcloud.com |
07f2193d00da11f43d05c04375e13fd4cbc070dc | 762302ac00a54f3560c674e8c76949d7b34555c8 | /clock.h | cc4417adcd29bb884748b271aa59868bb23e03f5 | [] | no_license | ives560/InverterController | 2a0da93d2064e7f92557b3f0da4d33e41393d1e3 | c328f1ee1240a8f2c42133359951bb294ee3550d | refs/heads/master | 2021-08-20T08:34:29.002426 | 2017-11-28T15:51:47 | 2017-11-28T15:51:47 | 112,356,089 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 319 | h | #ifndef CLOCK_H
#define CLOCK_H
#include <QWidget>
#include <QDate>
#include <QTime>
#include "ui_clock.h"
class Clock : public QWidget
{
Q_OBJECT
public:
Clock(QWidget *parent = 0);
~Clock();
private:
Ui::Clock ui;
private:
void timerEvent(QTimerEvent *);
};
#endif // CLOCK_H
| [
"ives@ives-laptop.(none)"
] | ives@ives-laptop.(none) |
024140bb96635caf8cf534601d3e09d036916414 | 94a78cedf3d9fadf3c15385406ff43848e96e72d | /src/accumulatorcheckpoints.json.h | c8b008b56c3b9d1290eedd1898b55d8caeb4a18e | [
"MIT"
] | permissive | BitCoinONE1/BTCONE-Blockchain | 02bfbfb4f096232299e01f85d5f6e28111805791 | bccc7e28878b2572f8cafa6c0e4e896745b33a27 | refs/heads/master | 2020-04-13T23:57:55.114465 | 2019-01-16T19:26:32 | 2019-01-16T19:26:32 | 163,520,721 | 4 | 4 | MIT | 2019-01-16T13:06:36 | 2018-12-29T15:20:56 | C++ | UTF-8 | C++ | false | false | 10,344 | h | // Copyright (c) 2018 The PIVX developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#ifndef BTCONE_ACCUMULATORCHECKPOINTS_JSON_H
#define BTCONE_ACCUMULATORCHECKPOINTS_JSON_H
#include <string>
std::string GetMainCheckpoints() {
std::string strMainCheckpoints = "[\n"
" {\n"
" \"height\": 500,\n"
" \"1\": \"bdcc903b5fac1637f082566e382ea01ae5b1f5afeabcebdc1ff9e233c82d63c7f8af349aa8a17e10c1d5ddca847d3fb089aaff06cd35487870a64ec21197e60ea9ec826060f030edc12293857c1f40ce667c0107980e961aff7305dfeaa4fecf4ddc8e8f5c0bf197a7052046a2c142cc4096de8eb4b2c9e739e9ee289772b4edab12d01980ecccdf7b2562c8164e9e61240c18e9e40bcdb3366fe2bb665b5e5c49b388d9a7486fb749be80b76cc94d67057f6c44fa964d47de54bce958e4ea1dc452ad53bdd382dae6b195e33070c4bf525ad9439ab14542d79b5985446964b1acea4edd446c0d10cc3f3522a0125cd4b49bca8d78586ec94a9af4514e6f9c11\",\n"
" \"5\": \"91ccb914eacbb2fba0611c6b36f834e01753b639e4ecd24e22e447131248bc600cac932ca098ca1131c1154130f95bfe144ee431e314a4dc465442e74e3dfc223e71d9172f29bbd5fa3a2520940741aafe2ab15c10ea74b2d8a80edba6e75170d10a9d59fda16de02bc4550fbe0c9f9d9ed448aa9e833ff5260639e8bbd3f8acb23d6aec3174e9d0cde70560ff952ba582570744525cc9a2a256cb23e88eadf2e60e4bbca91ce5d68fccfaf0246cab95e44a7023115d80735d42cf2ff622a1c51d391305cd1a81521a20b253337a8c7bb84ffc55693aa6cf82c74f153dd770d37c0d7c02e53c7c20cc074771e2015b5ab6d99b6bcb117a9bfe5255beb0bec681\",\n"
" \"10\": \"647eb362586f9bdc8dc3e2acd36714fa646c41f62ccbfb4e4aa5bea1454fde35d0e3a8b6fd89fe9ef675a6f0c834c62cf3a6cff4d08591267be51f271375b261a2cb42b57bbd501a98cda6f9667e04d98e324c90f4c149199bd0eeb85b873654387c52e2dd3f6e92155e7e16ef83dc01399a4cbd72279cfec2a35dc8202c06c401563b90ac2a010065a6f446b7b1332e96b53d9c2da6d76a8d6344ae09d68c767c74231881373e01eadd7d7c90c9b984bc273f6d328f026fb736abf3136c662c98a34c22e111ff339ef3289b49faab7879451a3d8a9477297e55e53a3030553b9d71bdc176d493fb678d3e3f0e96321a5b9f913fac2b135cb5ea0e6915878bf3\",\n"
" \"50\": \"1439ebb3c6afbf7a507c0f6040b74ad83deb0c2577f49d9e548856965d0995840ffe98ab40c2e9d4d752a96bdd2622a071313d4573c05c2c3a788f4f6e464c09f98b071a04737ece9b4280ae294ae1b572ea370fa3f542f5e60edb350e574038d0e56fb41a04b99d54d346b3891d290dc556da1d4074213f06b03578edc7d264759c63399a107660539883bffa2ec7744c7bb2cfd5a355ba4a9fc22e1f54b37a941b36a3317ec7ccd00f7a6c0af14431a84a5e4e6f154050aa699f7cad084b77f93e4ed6cd5e3f7259cb7b786bbd3d850d6bb623078691f01d893c37ecc8d913b083a1a235c3f745299b1bcbba8a1642dd9b0453a793e0717f79d22fd8f14782\",\n"
" \"100\": \"e0508af69f6284d37e54f290ccaf6eea03ea6b141c06218d2a758ee1f1ed0be091ee2516b69542d558bd84cc00cc0c48300e5bd227a54e2a06d4b0ac2e69a9b8863da2736506ce4bb9ec940eaad01df8db79f34ec29b3ad6f279bb94d3b7fc693ec1e4eadc3efd7f14dbf5df148b10d35ad4ec975903f73844becd773c4d94a0d193b9ceda04c20964457317097d0f6f30766abdf7ce80d321acd21025bfe6f55b1945d83e4a11df4aeb9afccad3ae99a4ec29dd801a951f3d17c271373ed0083f1e349f72c895c6ea2598b8cd66284015d9d19894ee4064cfc77712a498a2164efab767dae7ef654d22c210d0865658f6378dc7a95f0c26c0c7f3edf228212\",\n"
" \"500\": \"33e3f97fd53a76d2e97af7292f60acc576bb1e267cd7450a8acc4fea55b0e769d2492ab9077517c036e29e2b247b89c3fba56a87c187b61c27442b6891e13e09b0c01f859afd8b250c66e01eab5c844b97e61661e1953e69294e503a01cfe5e246a804e99962afab6094905bb304b1dee416dd70170e0f17dd1228408de43ee35a6e71c885150a9eb79901cfd63b7fba61617b357ac4c7adf12c95b56996e0dad52c2e2e19f0ddb190cbba5dd9cdc5c15b9cfae58ebcc55dd5070006aa234649a5ee2d83c1342d2c9f2c3b6a5a1e56adadd4961216631b6204f1f13c705e1581c08b528e2779e7a9af4b667044c60d092e23189deed27b543283c863fec13df7\",\n"
" \"1000\": \"7469408168d54a861ef31f4f4c1d2b1556e2a3cef42e51dec846c3fb843461e625c4a980c36c0412438fa2a767d5c1111c962763cf188ee827bb88364c0f64fb88c5a272b61b5e065a41258502cbefa7700c963c36564470fc534806e9bce6b6fc2dd606a86bae9047daea3610ddc5bd6deb2310d49cb415e6b318fa5387301605cb2167d1a6184c9e3cb80fcdb2b531fba757a44ce322841bc3369459e77f20b84c960b8b54fc34a1165fa9d86b6cde51af9d18ce7644d80a3cda5f47a56a12486c89a7c509f250ce5a63ee27c09c36fab18059900ec6263d916e6f1ee9d69af7e8ad426258649ee41b46d561f2964f641333d5cbd504ed39f450fdb2438cb5\",\n"
" \"5000\": \"612a7e9b9d08b03c5718c06c4a90b33232bac2f3f10b0ae8b8193b59bb0563f7b7fe34ef5a72f9c35f0fa5baeb33dbcfab8a04970e5a0c288e9ab2359c5f6984907e490a208e54009b3a8ddf757ba910872b92db2f7bab489f736f97ab642e89e55af60273344387204781435ff5a91922047056640368ef1209e5bb197a9eb13e6c1b46be44b230022eae7d83133d417b5e0c66e0897eee673bfec8bf70783a8b1482bd26ec9aefd3f8f7fa4129572ef5844da60b2b43c12111de0ef8945d046ee591e9f1678a270d86b1ec48bcdad2b9726e1226ddf2e5498e3b398f14c99aced8128905700c406d44fbb6f66c9fe0f48ade956266f977fb37abc5dfccd419\"\n"
" },\n"
" {\n"
" \"height\": 1000,\n"
" \"1\": \"fed91f690b478f2a3bb52a06cd39e7322fcd55ab430c6d0a86de118435d29848519a0c074b94443c23b74b11184106e3a1a6a24f81faaa7eef59d87a1996648ff362e48e69be5662a834876839b34efe4959875b4f609fca6328182c9ef6a5c1cc97a23e9b715ae9933295d93c2fb87a70f37a3e5afc6c4de207b874c81004fc1b4154ff57fb5d527a7798648cf604e1b6e03e133d5ecda0bd1974491fdb579d6265598cab8954a34861e5831e45363e219855fbfa572cd6c587a0149fc266e34fb9138c1cb065413d2cedc4edb98a4ba47a13f5629a7eef1d486cf18a7f32afbc6dde6d5692c9cadc1ce4d80bc09a0bc0d3bad1586422e6b3ea2bf6ee6e7c3\",\n"
" \"5\": \"18d874aa0c2537f9f03932a582802c47c14f229b53ec06c31fc6a86e5494dc79ff0a9d13755438d2a478e8cd273abb6d81e34989290ad4996657ec09b63eee11ae47c420b023a8303bf376c49671dac4950e68ae3abca8b3fe722e5b2128fa63ada69cbd6fd8fd19b7e54a2e7138d7189bab3292ada2542ac7c6abcdbc44922995bb8f3b3e56cdd61718b970aa2727e94b36a0732c29857c7d25ece016529a68f4827d0d89fb3221a044d9a2c99f33f17ee1b22cfa812f1dd62f580c3167339460cd39145a7f534d700596c5496e77cfb63aad49f21f6bb44a81e02ce8c8566897225c40c91d214cedd7410f7f4937327d43027538d62ad9984cf5121a66109\",\n"
" \"10\": \"4a12f2529f12b812c61f1dae100565cf87807f200c3b5ca67d6aa95de1cc7b8d37a61b89c6d4a744c007d376cd14b4a17d0dc6a5803c7db3321457d009b9439d68c725d3ba435e2df503a28d083fc010a079a3608e683705486b5fc758ed7c788837cac76b6fdd44489a90a72af125ddd68aabc100b3015e42cfd98c1df208c94d6a5c4bad916d09ccb81ccf117d44012ee643b2de55bede46bdc7d624a93995e23608d922a137053a0b81d3046503eec3e93d4169df8fbdd209ca0fd25e0e9056710b2843baa59a86dcd5f2d17c8af0a7f30ae49a06cc152e7a7361e0e26b421484db590fcfe69052b4fb69fd45587232d0f1dd91c7b6e3a8927b864cbb17a4\",\n"
" \"50\": \"32ab9c5bc51f595bd55a3e8a69a021d953db7072ca8279c1a94de36dc9b3b5d136fde1ea5291643a83b2095ce9560933a46499ee78328ae5c38b3c1e81db09b10f18082327db9ec56607c1b8e16c0d95f800ca23083f89174beb4e0e8f2854428eca687a7f658fc225bf6ff024989ad381b0ff1929134034cd5e80d4348d0f34f57b8c032e4d6790de83eb1d379969f2c034f89d981993961c940655f28a93829177f1e135ee42a499ef66ad69a18454b48484740ec3410798cdd0d5972403090e6d4ab1fd43893eb73537d244a0f0f20cf1a4d022727c8043aefea378c6ff11e6a19850e69c656f5dddeebd2230be1490c69b71f3691acb248f01286f34d7f1\",\n"
" \"100\": \"548745e6700db0f50c2f15fea626ea7c073eb3567a23ee4a2f575952da9d8811d32ab1456b12a06a9928bc342822a3613139af33cc54d78c33de3bd8976517291b8fc160dea9febcfff7ce284a1026d7e5bdc879330cb6c82d0885b56f14daf0239b0c5d22fb4cd9db8919fd2ccbe1c3fc8e44d6afb25a9671a2b6d3d0b2905ebf33199c63609629af3b00724fbc6ac4238d7df0bb1150bb9a29436f0aff9e5f1bce9113ea5e66709feb887127e04f51ea4d286fcb61dd6ec995de6d2a0d83b52bec3f923c535044194a614257f344a5ddb908f66a73ff6e561eda508cec604c0d8bd4a98577cdbdebfb9fbb5963461d57a22cd014985afe1c61b7641c5195b2\",\n"
" \"500\": \"ba4ed6a4a73be0ba3b445e71554599d4194838baed5dc7d6f91ef5ea779733c35453d498e05434468ad0cbb03b2842dc5a700b3f574b7e9786bbddfb274a2f5ceda78f9464f4291d0ade307e89145e974e06484c14c01f1cdd56ba32b58c875861be383d0ce4d9d6212767c47cb39598fc661f11a2d3a91f643075fde3f87f2f2311e3367b1b1a056c1fc3d668d4d2c68badc247ab495c2500317e3978827e42ddc922baa2c066d8ecaeb606e0afb55b4e088b45e44c2031cb82c8b96d6847fc277b411ce6f6b27efd55346a2db26e8730b1def42a0a8cc7fc20dc2a15b839a5f0ae1b1a97161e2f85ccc12f4b20d6a32d5744330b16db5aa2bd8fe009036bb7\",\n"
" \"1000\": \"7469408168d54a861ef31f4f4c1d2b1556e2a3cef42e51dec846c3fb843461e625c4a980c36c0412438fa2a767d5c1111c962763cf188ee827bb88364c0f64fb88c5a272b61b5e065a41258502cbefa7700c963c36564470fc534806e9bce6b6fc2dd606a86bae9047daea3610ddc5bd6deb2310d49cb415e6b318fa5387301605cb2167d1a6184c9e3cb80fcdb2b531fba757a44ce322841bc3369459e77f20b84c960b8b54fc34a1165fa9d86b6cde51af9d18ce7644d80a3cda5f47a56a12486c89a7c509f250ce5a63ee27c09c36fab18059900ec6263d916e6f1ee9d69af7e8ad426258649ee41b46d561f2964f641333d5cbd504ed39f450fdb2438cb5\",\n"
" \"5000\": \"612a7e9b9d08b03c5718c06c4a90b33232bac2f3f10b0ae8b8193b59bb0563f7b7fe34ef5a72f9c35f0fa5baeb33dbcfab8a04970e5a0c288e9ab2359c5f6984907e490a208e54009b3a8ddf757ba910872b92db2f7bab489f736f97ab642e89e55af60273344387204781435ff5a91922047056640368ef1209e5bb197a9eb13e6c1b46be44b230022eae7d83133d417b5e0c66e0897eee673bfec8bf70783a8b1482bd26ec9aefd3f8f7fa4129572ef5844da60b2b43c12111de0ef8945d046ee591e9f1678a270d86b1ec48bcdad2b9726e1226ddf2e5498e3b398f14c99aced8128905700c406d44fbb6f66c9fe0f48ade956266f977fb37abc5dfccd419\"\n"
" }\n"
"]";
return strMainCheckpoints;
}
std::string GetTestCheckpoints() {
std::string strTestCheckpoints = "[\n"
" {\n"
" \"height\": 0,\n"
" \"1\": \"0\",\n"
" \"5\": \"0\",\n"
" \"10\": \"0\",\n"
" \"50\": \"0\",\n"
" \"100\": \"0\",\n"
" \"500\": \"0\",\n"
" \"1000\": \"0\",\n"
" \"5000\": \"0\"\n"
" }\n"
"]";
return strTestCheckpoints;
}
std::string GetRegTestCheckpoints() {
std::string strRegTestCheckpoints = "[\n"
" {\n"
" \"height\": 0,\n"
" \"1\": \"0\",\n"
" \"5\": \"0\",\n"
" \"10\": \"0\",\n"
" \"50\": \"0\",\n"
" \"100\": \"0\",\n"
" \"500\": \"0\",\n"
" \"1000\": \"0\",\n"
" \"5000\": \"0\"\n"
" }\n"
"]";
return strRegTestCheckpoints;
}
#endif //BTCONE_ACCUMULATORCHECKPOINTS_JSON_H
| [
"contact@bitcoinone.io"
] | contact@bitcoinone.io |
1574a5ce1f640cda8ce5d9bc1c4ac1f7da538e70 | a39b242d3a07b4611c8ca2b050f9ddd51496d2c8 | /757A - Gotta Catch Em' All! solution (testing qSort).cpp | ef88037859f4919e239014c5412a6a844738009e | [] | no_license | abdullahalrifat/contest | 28b14c92894d5f388fe7182426980a5dc84795a8 | 063fda623cb9f5f020cc1ac7195e63344497e33f | refs/heads/master | 2020-12-20T16:41:16.049119 | 2019-06-26T11:51:12 | 2019-06-26T11:51:12 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 450 | cpp | #include<cstdio>
#include<string>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<vector>
#include<cstdlib>
using namespace std;
int main(){
string s;
string targetedStr = "Bulbasaur";
int targetedStrSize = targetedStr.length();
int targerStrSizeCount = 0;
int totalWordCount = 0;
int repeatCounter = 0;
cin >> s;
//qsort(s.begin(),s.end());
cout << totalWordCount << endl;
return 0;
}
| [
"mimtiaze@gmail.com"
] | mimtiaze@gmail.com |
4a5732b90ce9494baa63bbbfcbde52e9944f1e01 | bfc88535fa1495c64672f048a5559e8bb6de1ae1 | /SPOJ/STPAR.cpp | 7ef412f4ea8e729c0b4157c66e04860ecf1e29c2 | [] | no_license | famus2310/CP | 59839ffe23cf74019e2f655f49af224390846776 | d8a77572830fb3927de92f1e913ee729d04865e1 | refs/heads/master | 2021-07-05T00:23:31.113026 | 2020-08-07T22:28:24 | 2020-08-07T22:28:24 | 144,426,214 | 1 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 589 | cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
while (cin >> n && n) {
int now = 1;
queue<int> q;
for (int i = 0; i < n; i++) {
int a;
scanf("%d", &a);
q.push(a);
}
stack<int> st;
while (!q.empty()) {
while (!st.empty() && st.top() == now) {
st.pop();
now++;
}
if (now != q.front()) {
st.push(q.front());
} else {
now++;
}
q.pop();
}
while (!st.empty()) {
if (st.top() != now)
break;
st.pop();
now++;
}
if (now == n + 1)
cout << "yes" << endl;
else cout << "no" << endl;
}
return 0;
} | [
"fadhilmusaad@gmail.com"
] | fadhilmusaad@gmail.com |
9cd6c26ac39a70703626a5cd83f9c7a308937cfe | 6b1f091e56d73df2469543924639efea1b56719f | /src/fusion/util/AffxTime.cpp | f45ae4eb00e23a0b8b6cf5a5547a251ec4c4b39f | [] | no_license | HenrikBengtsson/affxparser | 8e76d9a47328997bb2801b5705db307e92f718bc | 2e8b03ccd597b179bc7772a14c31a85e0f3cc1a0 | refs/heads/master | 2023-04-29T09:55:48.546772 | 2023-04-26T19:57:03 | 2023-04-26T19:57:03 | 24,388,437 | 5 | 3 | null | 2022-03-23T21:17:23 | 2014-09-23T20:37:35 | C++ | UTF-8 | C++ | false | false | 16,890 | cpp | ////////////////////////////////////////////////////////////////
//
// Copyright (C) 2005 Affymetrix, Inc.
//
// This library is free software; you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License
// (version 2.1) as published by the Free Software Foundation.
//
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
// for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this library; if not, write to the Free Software Foundation, Inc.,
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
////////////////////////////////////////////////////////////////
//
#include "util/AffxTime.h"
//
#include <cmath>
#include <cstdio>
#include <cstring>
#include <stdio.h>
#include <string>
#ifdef _MSC_VER
// dont warn about some funcs...
#define _CRT_SECURE_NO_WARNINGS
#endif
#define MIN_DATE (-657434L) // about year 100
#define MAX_DATE 2958465L // about year 9999
// Half a second, expressed in days
#define HALF_SECOND (1.0/172800.0)
// One-based array of days in year at month start
static int rgMonthDays[13] =
{0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365};
long AffxTime::m_lStartTime = 0;
long AffxTime::m_lStopTime = 0;
AffxTime::AffxTime()
{empty();}
AffxTime::AffxTime(const AffxTime& timeSrc)
{ m_time = timeSrc.m_time;}
AffxTimeSpan::AffxTimeSpan()
{ }
/////////////////////////////////////////////////////////////////////////////
// AffxTime - absolute time
AffxTime::AffxTime(time_t time)
{
double dtSrc = (double)time / 24.0 / 60.0 / 60.0;
tm tm;
memset((void*)&tm, 0, sizeof(tm)); tm.tm_isdst = -1;
// The legal range does not actually span year 0 to 9999.
if (dtSrc > MAX_DATE || dtSrc < MIN_DATE) // about year 100 to about 9999
return;
int nDays; // Number of days since Dec. 30, 1899
int nDaysAbsolute; // Number of days since 1/1/0
int nSecsInDay; // Time in seconds since midnight
int nMinutesInDay; // Minutes in day
int n400Years; // Number of 400 year increments since 1/1/0
int n400Century; // Century within 400 year block (0,1,2 or 3)
int n4Years; // Number of 4 year increments since 1/1/0
int n4Day; // Day within 4 year block
// (0 is 1/1/yr1, 1460 is 12/31/yr4)
int n4Yr; // Year within 4 year block (0,1,2 or 3)
bool bLeap4 = true; // TRUE if 4 year block includes leap year
double dblDate = dtSrc; // tempory serial date
// If a valid date, then this conversion should not overflow
nDays = (int)dblDate;
// Round to the second
dblDate += ((dtSrc > 0.0) ? HALF_SECOND : -HALF_SECOND);
nDaysAbsolute = (int)dblDate + 693959L; // Add days from 1/1/0 to 12/30/1899
dblDate = fabs(dblDate);
nSecsInDay = (int)((dblDate - floor(dblDate)) * 86400.);
// Calculate the day of week (sun=1, mon=2...)
// -1 because 1/1/0 is Sat. +1 because we want 1-based
tm.tm_wday = (int)((nDaysAbsolute - 1) % 7L) + 1;
// Leap years every 4 yrs except centuries not multiples of 400.
n400Years = (int)(nDaysAbsolute / 146097L);
// Set nDaysAbsolute to day within 400-year block
nDaysAbsolute %= 146097L;
// -1 because first century has extra day
n400Century = (int)((nDaysAbsolute - 1) / 36524L);
// Non-leap century
if (n400Century != 0)
{
// Set nDaysAbsolute to day within century
nDaysAbsolute = (nDaysAbsolute - 1) % 36524L;
// +1 because 1st 4 year increment has 1460 days
n4Years = (int)((nDaysAbsolute + 1) / 1461L);
if (n4Years != 0)
n4Day = (int)((nDaysAbsolute + 1) % 1461L);
else
{
bLeap4 = false;
n4Day = (int)nDaysAbsolute;
}
}
else
{
// Leap century - not special case!
n4Years = (int)(nDaysAbsolute / 1461L);
n4Day = (int)(nDaysAbsolute % 1461L);
}
if (bLeap4)
{
// -1 because first year has 366 days
n4Yr = (n4Day - 1) / 365;
if (n4Yr != 0)
n4Day = (n4Day - 1) % 365;
}
else
{
n4Yr = n4Day / 365;
n4Day %= 365;
}
// n4Day is now 0-based day of year. Save 1-based day of year, year number
tm.tm_yday = (int)n4Day + 1;
tm.tm_year = n400Years * 400 + n400Century * 100 + n4Years * 4 + n4Yr;
// Handle leap year: before, on, and after Feb. 29.
if (n4Yr == 0 && bLeap4)
{
// Leap Year
if (n4Day == 59)
{
/* Feb. 29 */
tm.tm_mon = 2;
tm.tm_mday = 29;
goto DoTime;
}
// Pretend it's not a leap year for month/day comp.
if (n4Day >= 60)
--n4Day;
}
// Make n4DaY a 1-based day of non-leap year and compute
// month/day for everything but Feb. 29.
++n4Day;
// Month number always >= n/32, so save some loop time */
for (tm.tm_mon = (n4Day >> 5) + 1;
n4Day > rgMonthDays[tm.tm_mon]; tm.tm_mon++);
tm.tm_mday = (int)(n4Day - rgMonthDays[tm.tm_mon-1]);
DoTime:
if (nSecsInDay == 0)
tm.tm_hour = tm.tm_min = tm.tm_sec = 0;
else
{
tm.tm_sec = (int)nSecsInDay % 60L;
nMinutesInDay = nSecsInDay / 60L;
tm.tm_min = (int)nMinutesInDay % 60;
tm.tm_hour = (int)nMinutesInDay / 60;
}
m_time = tm;
}
AffxTime::AffxTime(int nYear, int nMonth, int nDay, int nHour, int nMin, int nSec, int nDST)
{
struct tm atm;
memset((void*)&atm, 0, sizeof(tm)); atm.tm_isdst = -1;
atm.tm_sec = nSec;
atm.tm_min = nMin;
atm.tm_hour = nHour;
if (nDay < 1 && nDay > 31) {Err::errAbort("AffxTime, invalid day value.");}
atm.tm_mday = nDay;
// _ASSERTE(nMonth >= 1 && nMonth <= 12);
atm.tm_mon = nMonth;
atm.tm_year = nYear;
atm.tm_isdst = nDST;
m_time = atm;
// _ASSERTE(m_time != -1); // indicates an illegal input time
}
AffxTime AffxTime::getCurrentTime()
// return the current system time
{
AffxTime time;
tm tm;
time_t lTime = ::time(NULL);
tm = *localtime(&lTime);
time.m_time = tm;
// Do not free(ptm) as subsequent calls to this function will then fail.
time.m_time.tm_mon++;
if (time.m_time.tm_year < 50)
time.m_time.tm_year = time.m_time.tm_year + 2000;
else if (time.m_time.tm_year < 100)
time.m_time.tm_year = time.m_time.tm_year + 1900;
else if (time.m_time.tm_year > 100)
time.m_time.tm_year = time.m_time.tm_year -100 + 2000;
return time;
}
// return runtime string -- timeElapsed = clock() - lStart
AffxString AffxTime::getRuntime(AffxString strAction, double timeElapsed)
{
double milliElapsed = timeElapsed / CLOCKS_PER_SEC * 1000;
double MILLISECONDS_PER_HOUR = 60 * 60 * 1000;
double MILLISECONDS_PER_MINUTE = 60 * 1000;
double MILLISECONDS_PER_SECOND = 1000;
AffxString strTime;
if (timeElapsed > MILLISECONDS_PER_HOUR)
{
strTime.sprintf("%.1lf hours", milliElapsed / MILLISECONDS_PER_HOUR);
}
else if (timeElapsed > MILLISECONDS_PER_MINUTE)
{
strTime.sprintf("%.1lf minutes", milliElapsed / MILLISECONDS_PER_MINUTE);
}
else
{
strTime.sprintf("%.1lf seconds", milliElapsed / MILLISECONDS_PER_SECOND);
}
return (strAction + " = " + strTime);
}
void AffxTime::startTime()
{
#ifdef WIN32
m_lStartTime = clock();
#else
m_lStartTime = time(NULL);
#endif
}
AffxString AffxTime::getRuntime(AffxString strAction)
{
#ifdef WIN32
m_lStopTime = clock();
return AffxTime::getRuntime(strAction, m_lStopTime - m_lStartTime);
#else
m_lStopTime = time(NULL);
double timeElapsed = m_lStopTime - m_lStartTime;
double SECONDS_PER_HOUR = 60 * 60;
double SECONDS_PER_MINUTE = 60;
AffxString strTime;
if (timeElapsed > SECONDS_PER_HOUR)
{
strTime.sprintf("%.1lf hours", timeElapsed / SECONDS_PER_HOUR);
}
else if (timeElapsed > SECONDS_PER_MINUTE)
{
strTime.sprintf("%.1lf minutes", timeElapsed / SECONDS_PER_MINUTE);
}
else
{
strTime.sprintf("%.1lf seconds", timeElapsed);
}
return (strAction + " = " + strTime);
#endif
}
/////////////////////////////////////////////////////////////////////////////
// AffxTimeSpan - relative time
/////////////////////////////////////////////////////////////////////////////
// String formatting
#define maxTimeBufferSize 128
// Verifies will fail if the needed buffer size is too large
AffxString AffxTimeSpan::format(char* pFormat) const
// formatting timespans is a little trickier than formatting AffxTimes
// * we are only interested in relative time formats, ie. it is illegal
// to format anything dealing with absolute time (i.e. years, months,
// day of week, day of year, timezones, ...)
// * the only valid formats:
// %D - # of days -- NEW !!!
// %H - hour in 24 hour format
// %M - minute (0-59)
// %S - seconds (0-59)
// %% - percent sign
{
char szBuffer[maxTimeBufferSize];
char ch;
char* pch = szBuffer;
while ((ch = *pFormat++) != '\0')
{
if (ch == '%')
{
switch (ch = *pFormat++)
{
default:
Err::errAbort("AffxTimeSpan, Bad format character."); // probably a bad format character
case '%':
*pch++ = ch;
break;
case 'D':
pch += sprintf(pch, "%d", getDays());
break;
case 'H':
pch += sprintf(pch, "%02d", getHours());
break;
case 'M':
pch += sprintf(pch, "%02d", getMinutes());
break;
case 'S':
pch += sprintf(pch, "%02d", getSeconds());
break;
}
}
else
{
*pch++ = ch;
}
}
*pch = '\0';
return szBuffer;
}
void AffxTime::empty()
{
struct tm atm;
memset((void*)&atm, 0, sizeof(tm)); atm.tm_isdst = -1;
m_time = atm;
}
void AffxTimeSpan::empty()
{
m_timeSpan = 0;
}
// Calculate the DATE value.
AffxTimeSpan::AffxTimeSpan(double dt)
{
// Convert from days to total seconds.
m_timeSpan = (int)(dt * 24 * 60 * 60);
}
// Calculate the DATE value.
double AffxTimeSpan::getDATE(void)
{
double dt = 0;
int lDays = getDays();
int nHours = getHours();
int nMinutes = getMinutes();
int nSeconds = getSeconds();
// Set date span by breaking into fractional days (all input ranges valid)
dt = lDays + ((double)nHours)/24 + ((double)nMinutes)/(24*60) +
((double)nSeconds)/(24*60*60);
return dt;
}
// Calculate the DATE value.
double AffxTime::getDATE(void)
{
double dt = 0;
int wYear = getYear();
int wMonth = getMonth();
int wDay = getDay();
int wHour = getHour();
int wMinute = getMinute();
int wSecond = getSecond();
// Validate year and month (ignore day of week and milliseconds)
if (wYear > 9999 || wMonth < 1 || wMonth > 12)
return 0;
// Check for leap year and set the number of days in the month
bool bLeapYear = ((wYear & 3) == 0) &&
((wYear % 100) != 0 || (wYear % 400) == 0);
int nDaysInMonth =
rgMonthDays[wMonth] - rgMonthDays[wMonth-1] +
((bLeapYear && wDay == 29 && wMonth == 2) ? 1 : 0);
// Finish validating the date
if (wDay < 1 || wDay > nDaysInMonth ||
wHour > 23 || wMinute > 59 ||
wSecond > 59)
{
return 0;
}
// Cache the date in days and time in fractional days
int nDate;
double dblTime;
//It is a valid date; make Jan 1, 1AD be 1
nDate = wYear*365L + wYear/4 - wYear/100 + wYear/400 +
rgMonthDays[wMonth-1] + wDay;
// If leap year and it's before March, subtract 1:
if (wMonth <= 2 && bLeapYear)
--nDate;
// Offset so that 12/30/1899 is 0
nDate -= 693959L;
dblTime = (((int)wHour * 3600L) + // hrs in seconds
((int)wMinute * 60L) + // mins in seconds
((int)wSecond)) / 86400.;
dt = (double) nDate + ((nDate >= 0) ? dblTime : -dblTime);
return dt;
}
// Constructor for DATE.
AffxTime::AffxTime(double dtSrc)
{
tm tm;
memset((void*)&tm, 0, sizeof(tm)); tm.tm_isdst = -1;
// The legal range does not actually span year 0 to 9999.
if (dtSrc > MAX_DATE || dtSrc < MIN_DATE) // about year 100 to about 9999
return;
int nDays; // Number of days since Dec. 30, 1899
int nDaysAbsolute; // Number of days since 1/1/0
int nSecsInDay; // Time in seconds since midnight
int nMinutesInDay; // Minutes in day
int n400Years; // Number of 400 year increments since 1/1/0
int n400Century; // Century within 400 year block (0,1,2 or 3)
int n4Years; // Number of 4 year increments since 1/1/0
int n4Day; // Day within 4 year block
// (0 is 1/1/yr1, 1460 is 12/31/yr4)
int n4Yr; // Year within 4 year block (0,1,2 or 3)
bool bLeap4 = true; // TRUE if 4 year block includes leap year
double dblDate = dtSrc; // tempory serial date
// If a valid date, then this conversion should not overflow
nDays = (int)dblDate;
// Round to the second
dblDate += ((dtSrc > 0.0) ? HALF_SECOND : -HALF_SECOND);
nDaysAbsolute = (int)dblDate + 693959L; // Add days from 1/1/0 to 12/30/1899
dblDate = fabs(dblDate);
nSecsInDay = (int)((dblDate - floor(dblDate)) * 86400.);
// Calculate the day of week (sun=1, mon=2...)
// -1 because 1/1/0 is Sat. +1 because we want 1-based
tm.tm_wday = (int)((nDaysAbsolute - 1) % 7L) + 1;
// Leap years every 4 yrs except centuries not multiples of 400.
n400Years = (int)(nDaysAbsolute / 146097L);
// Set nDaysAbsolute to day within 400-year block
nDaysAbsolute %= 146097L;
// -1 because first century has extra day
n400Century = (int)((nDaysAbsolute - 1) / 36524L);
// Non-leap century
if (n400Century != 0)
{
// Set nDaysAbsolute to day within century
nDaysAbsolute = (nDaysAbsolute - 1) % 36524L;
// +1 because 1st 4 year increment has 1460 days
n4Years = (int)((nDaysAbsolute + 1) / 1461L);
if (n4Years != 0)
n4Day = (int)((nDaysAbsolute + 1) % 1461L);
else
{
bLeap4 = false;
n4Day = (int)nDaysAbsolute;
}
}
else
{
// Leap century - not special case!
n4Years = (int)(nDaysAbsolute / 1461L);
n4Day = (int)(nDaysAbsolute % 1461L);
}
if (bLeap4)
{
// -1 because first year has 366 days
n4Yr = (n4Day - 1) / 365;
if (n4Yr != 0)
n4Day = (n4Day - 1) % 365;
}
else
{
n4Yr = n4Day / 365;
n4Day %= 365;
}
// n4Day is now 0-based day of year. Save 1-based day of year, year number
tm.tm_yday = (int)n4Day + 1;
tm.tm_year = n400Years * 400 + n400Century * 100 + n4Years * 4 + n4Yr;
// Handle leap year: before, on, and after Feb. 29.
if (n4Yr == 0 && bLeap4)
{
// Leap Year
if (n4Day == 59)
{
/* Feb. 29 */
tm.tm_mon = 2;
tm.tm_mday = 29;
goto DoTime;
}
// Pretend it's not a leap year for month/day comp.
if (n4Day >= 60)
--n4Day;
}
// Make n4DaY a 1-based day of non-leap year and compute
// month/day for everything but Feb. 29.
++n4Day;
// Month number always >= n/32, so save some loop time */
for (tm.tm_mon = (n4Day >> 5) + 1;
n4Day > rgMonthDays[tm.tm_mon]; tm.tm_mon++);
tm.tm_mday = (int)(n4Day - rgMonthDays[tm.tm_mon-1]);
DoTime:
if (nSecsInDay == 0)
tm.tm_hour = tm.tm_min = tm.tm_sec = 0;
else
{
tm.tm_sec = (int)nSecsInDay % 60L;
nMinutesInDay = nSecsInDay / 60L;
tm.tm_min = (int)nMinutesInDay % 60;
tm.tm_hour = (int)nMinutesInDay / 60;
}
m_time = tm;
}
// Format the date into a string.
AffxString AffxTime::getTimeStampString(void)
{
AffxString str;
if (!isEmpty())
{
int iMonth = getMonth();
int iDay = getDay();
int iYear = getYear();
int iHour = getHour();
int iMinute = getMinute();
int iSecond = getSecond();
char szBuffer[64];
sprintf(szBuffer, "%02d/%02d/%d %02d:%02d:%02d", iMonth, iDay, iYear, iHour, iMinute, iSecond);
str = szBuffer;
}
return str;
}
// Format the date into a string.
AffxString AffxTime::getDateString(void)
{
AffxString str;
if (!isEmpty())
{
int iMonth = getMonth();
int iDay = getDay();
int iYear = getYear();
char szBuffer[64];
sprintf(szBuffer, "%d/%d/%d", iMonth, iDay, iYear);
str = szBuffer;
}
return str;
}
// Format the time into a string.
AffxString AffxTime::getHourMinuteString(void)
{
AffxString str;
char szBuffer[64];
AffxString strAmPm = " AM";
if (!isEmpty())
{
int iHour = getHour();
int iMinute = getMinute();
if (iHour >= 12) //pjo 13-Jan-97 equals sign added
strAmPm = " PM";
if (iHour >= 13) //pjo 13-Jan-97 hour adjusted at 1 PM
iHour -= 12;
if (iHour == 0)
iHour = 12;
sprintf(szBuffer, "%d:", iHour);
str = szBuffer;
sprintf(szBuffer, "%2d", iMinute);
if (szBuffer[0] == ' ')
szBuffer[0] = '0';
str += szBuffer;
str += strAmPm;
return str;
}
return str;
}
| [
"khansen@stat.Berkeley.edu"
] | khansen@stat.Berkeley.edu |
bdbd30bf4e86ae8954f738ad41c6154f66e3b79c | 3f5bc33d9149bdb99276b87bd3c6fe18a4b1b667 | /BiankaDudaProjektMES/GlobalData.h | 95741a84845905ae5948c51feee399ade15fa85f | [] | no_license | piankabianka/MES | c3001a8a2b922fdf4e4109f24f2b594c057f86ea | 2f1d9b409df378916d3981a6849f3847112cd46d | refs/heads/master | 2022-04-05T08:41:57.134901 | 2020-01-30T20:51:31 | 2020-01-30T20:51:31 | 229,355,477 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 360 | h | #pragma once
#include "stdafx.h"
#include <iostream>
#include <fstream>
using namespace std;
struct GlobalData {
double H; //height
double W; //width
int nodesNumberH; //number of nodes upright
int nodesNumberW; //number of nodes horizontally
int totalNodesNumber;
int totalElementNumber;
double dx;
double dy;
GlobalData();
void showData();
};
| [
"bianka.duda98@gmail.com"
] | bianka.duda98@gmail.com |
9a5424c73521468119bd1a6007022af0ee018411 | 5fb4d392fb452c07ec8dd96ad02dbb9ff68e9118 | /util/config.hpp | 0f93ca732252857e11fdc9425c50a2f4841a818c | [
"MIT"
] | permissive | Rapptz/Shinobi | e758882e9cc6273bd7ea72dabe3958b88dd94d22 | dae846bbd22ca7a58537c91b17440df204394a3c | refs/heads/master | 2016-09-05T22:48:13.632015 | 2013-11-02T07:32:04 | 2013-11-02T07:32:04 | 12,841,537 | 2 | 3 | null | null | null | null | UTF-8 | C++ | false | false | 515 | hpp | #ifndef SHINOBI_UTIL_CONFIG_HPP
#define SHINOBI_UTIL_CONFIG_HPP
#define SHINOBI_VERSION_MAJOR 0
#define SHINOBI_VERSION_MINOR 9
#define SHINOBI_VERSION_PATCH 1
#define SHINOBI_VERSION "0.9.1"
#if defined(_WIN32) || defined(__WIN32__)
#define SHINOBI_WINDOWS
#elif defined(linux) || defined(__linux)
#define SHINOBI_LINUX
#elif defined(__APPLE__) || defined(MACOSX) || defined(macintosh) || defined(Macintosh)
#define SHINOBI_MACOS
#endif // System-specific
#endif // SHINOBI_UTIL_CONFIG_HPP | [
"rapptz@gmail.com"
] | rapptz@gmail.com |
cc9cbf7bee48a809284b4a9be60183ecd635b4d9 | 6821508183ce31ee9f46edb846030ab6e6fa4720 | /opencv/example.cpp | 9d9ea38882d8e4eb2a67439cf35d51f8ae8c5ade | [] | no_license | Svedrin/misc | 1d211a3eaa1e93dc23e2ead0c674c6390893971f | 07ab089d29c8d9a9ca4fc948b2bdc90e23b4261b | refs/heads/master | 2023-07-09T17:48:35.337812 | 2023-05-22T09:05:49 | 2023-05-22T09:05:49 | 209,077,261 | 0 | 0 | null | 2023-06-21T22:55:09 | 2019-09-17T14:31:39 | Python | UTF-8 | C++ | false | false | 1,288 | cpp | #include "cv.h"
#include "highgui.h"
using namespace cv;
int main(int, char**)
{
VideoCapture cap(0);
if(!cap.isOpened()) return -1;
vector<vector<Point> > contours;
vector<Vec4i> hierarchy;
Mat frame, edges;
namedWindow("edges",1);
int thresh = 96;
createTrackbar( " Canny thresh:", "edges", &thresh, 255, NULL );
int deziSigma = 15;
createTrackbar( " GaussianBlur:", "edges", &deziSigma, 100, NULL );
while(true){
cap >> frame;
cvtColor(frame, edges, CV_BGR2GRAY);
GaussianBlur(edges, edges, Size(7,7), deziSigma / 10., deziSigma / 10.);
Canny(edges, edges, thresh, thresh * 2, 3);
findContours( edges, contours, hierarchy, CV_RETR_TREE, CV_CHAIN_APPROX_SIMPLE, Point(0, 0) );
Mat drawing = Mat::zeros( edges.size(), CV_8UC3 );
printf("Found %d contours:", contours.size());
// Draw contours
for( int i = 0; i < contours.size(); i++ ){
printf( "-- % 5d ", contours[i].size() );
Scalar color = Scalar( 255, 0, 255 );
drawContours( drawing, contours, i, color, 2, 8, hierarchy, 0, Point() );
}
printf("\n");
imshow("edges", drawing);
if(waitKey(30) >= 0)
break;
}
return 0;
}
| [
"diese-addy@funzt-halt.net"
] | diese-addy@funzt-halt.net |
f81013af2f7af8fdf1f3f71dec6f0ba4b9c8e959 | 6093441c9a8e3a7c811241a9e28f2855e62f5985 | /src/compiler/main.cpp | 6547703f931317b53e5c550f5f1ee09219838791 | [] | no_license | jbw3/compiler | ba5b9b2a29b85f37d6a481fc7306917e63206d2f | 7b758192a9aa3d6428a8224f0aa2c2332bb76b4b | refs/heads/master | 2022-07-02T10:00:15.029100 | 2022-04-02T16:06:59 | 2022-04-02T16:06:59 | 173,978,605 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 310 | cpp | #include "Compiler.h"
#include "Config.h"
int main(int argc, const char* const argv[])
{
Config config;
bool help = false;
bool ok = config.ParseArgs(argc, argv, help);
if (ok && !help)
{
Compiler compiler(config);
ok = compiler.Compile();
}
return ok ? 0 : 1;
}
| [
"jwilkes0011@gmail.com"
] | jwilkes0011@gmail.com |
9dcf928958c77e74060775129a4116635f62521f | cbaf03b608f2410abfac46354f069436fdf5fa73 | /src/graphics/display/drivers/vim-display/vim-display-test.cc | e6b2f3f968752d2097139265b48a7c20017d2c9d | [
"BSD-2-Clause"
] | permissive | carbonatedcaffeine/zircon-rpi | d58f302bcd0bee9394c306133fd3b20156343844 | b09b1eb3aa7a127c65568229fe10edd251869283 | refs/heads/master | 2023-03-01T19:42:04.300854 | 2021-02-13T02:24:09 | 2021-02-13T02:24:09 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,670 | cc | // Copyright 2019 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "vim-display.h"
#include <fuchsia/hardware/display/controller/c/banjo.h>
#include <fuchsia/sysmem/llcpp/fidl.h>
#include <lib/async-loop/cpp/loop.h>
#include <lib/async-loop/default.h>
#include <lib/fidl-async/cpp/bind.h>
#include <lib/mock-sysmem/mock-buffer-collection.h>
#include <zxtest/zxtest.h>
namespace sysmem = llcpp::fuchsia::sysmem;
namespace {
// Use a stub buffer collection instead of the real sysmem since some tests may
// require things (like protected memory) that aren't available on the current
// system.
class MockBufferCollection : public mock_sysmem::MockBufferCollection {
public:
void SetConstraints(bool has_constraints, sysmem::BufferCollectionConstraints constraints,
SetConstraintsCompleter::Sync& _completer) override {
EXPECT_FALSE(constraints.buffer_memory_constraints.inaccessible_domain_supported);
EXPECT_FALSE(constraints.buffer_memory_constraints.cpu_domain_supported);
set_constraints_called_ = true;
}
void WaitForBuffersAllocated(WaitForBuffersAllocatedCompleter::Sync& _completer) override {
sysmem::BufferCollectionInfo_2 info;
info.settings.has_image_format_constraints = true;
info.buffer_count = 1;
ASSERT_OK(zx::vmo::create(4096, 0, &info.buffers[0].vmo));
sysmem::ImageFormatConstraints& constraints = info.settings.image_format_constraints;
constraints.pixel_format.type = sysmem::PixelFormatType::BGRA32;
constraints.pixel_format.has_format_modifier = true;
constraints.pixel_format.format_modifier.value = sysmem::FORMAT_MODIFIER_LINEAR;
constraints.max_coded_width = 1000;
constraints.max_bytes_per_row = 4000;
constraints.bytes_per_row_divisor = 1;
_completer.Reply(ZX_OK, std::move(info));
}
bool set_constraints_called() const { return set_constraints_called_; }
private:
bool set_constraints_called_ = false;
};
static zx_status_t stub_canvas_config(void* ctx, zx_handle_t vmo, size_t offset,
const canvas_info_t* info, uint8_t* out_canvas_idx) {
*out_canvas_idx = 1;
return ZX_OK;
}
static zx_status_t stub_canvas_free(void* ctx, uint8_t canvas_idx) { return ZX_OK; }
static amlogic_canvas_protocol_ops_t canvas_proto_ops = {
.config = stub_canvas_config,
.free = stub_canvas_free,
};
TEST(VimDisplay, ImportVmo) {
vim2_display display;
display.canvas.ops = &canvas_proto_ops;
list_initialize(&display.imported_images);
mtx_init(&display.display_lock, mtx_plain);
mtx_init(&display.image_lock, mtx_plain);
mtx_init(&display.i2c_lock, mtx_plain);
display_controller_impl_protocol_t protocol;
ASSERT_OK(display_get_protocol(&display, ZX_PROTOCOL_DISPLAY_CONTROLLER_IMPL, &protocol));
zx::channel server_channel, client_channel;
ASSERT_OK(zx::channel::create(0u, &server_channel, &client_channel));
MockBufferCollection collection;
async::Loop loop(&kAsyncLoopConfigAttachToCurrentThread);
image_t image = {};
image.pixel_format = ZX_PIXEL_FORMAT_RGB_x888;
image.width = 4;
image.height = 4;
ASSERT_OK(
fidl::BindSingleInFlightOnly(loop.dispatcher(), std::move(server_channel), &collection));
loop.StartThread();
EXPECT_OK(
protocol.ops->set_buffer_collection_constraints(protocol.ctx, &image, client_channel.get()));
EXPECT_OK(protocol.ops->import_image(protocol.ctx, &image, client_channel.get(), 0));
protocol.ops->release_image(protocol.ctx, &image);
EXPECT_TRUE(collection.set_constraints_called());
}
} // namespace
| [
"commit-bot@chromium.org"
] | commit-bot@chromium.org |
aeac942f99a9d7da19d8f6dcceae6c1e1201da49 | 6ae0b247bee94bd1f1f2831dbb13a62421155bc9 | /main.cpp | b18903f7cbb8d1e140fdb0d930bce1df777ece49 | [] | no_license | daniel1302/electrical-circuit-simulator | 87a0a09248e48425fbe9f8fb65e72a42b26981c3 | 2f7ec95119ddb39cde47a21fcf700c8eddd4f6fe | refs/heads/master | 2021-03-24T13:06:05.426466 | 2018-01-14T22:17:13 | 2018-01-14T22:17:13 | 111,435,545 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,006 | cpp | #include <iostream>
#include <memory>
#include <Math/Matrix.h>
#include <Circuit/PowerSupply.h>
#include <Circuit/ResistorElement.h>
#define TEST
#ifdef TEST
#include <Tests/Matrix.cpp>
#include <Tests/GaussianElimination.cpp>
#endif
void testCircuit()
{
Circuit circuit;
std::cout<<circuit.print();
PowerSupply current1(0, 1, 0.001);
ResistorElement r1(1, 2, 10000);
ResistorElement r2(2, 0, 20000);
ResistorElement r3(2, 3, 16000);
ResistorElement r4(3, 0, 4000);
circuit.insertElement((Element*)¤t1);
circuit.insertElement((Element*)&r1);
circuit.insertElement((Element*)&r2);
circuit.insertElement((Element*)&r3);
circuit.insertElement((Element*)&r4);
circuit.ground(0);
Matrix<double> results;
circuit.calculate(&results);
std::cout<<circuit.print();
std::cout<<"Result: "<<std::endl<<results.print();
}
int main() {
// matrixTest();
// gaussianEliminationTest();
testCircuit();
return 0;
}
| [
"daniel.1302@gmail.com"
] | daniel.1302@gmail.com |
d2bdc3717e891e3f3d0b6d3389d47adbc19f0eb8 | 30e1dc84fe8c54d26ef4a1aff000a83af6f612be | /src/external/boost/boost_1_68_0/boost/metaparse/v1/alphanum.hpp | db84ae94ea5d78b291c3c49fe7a7a9daa6757456 | [
"BSL-1.0",
"BSD-3-Clause"
] | permissive | Sitispeaks/turicreate | 0bda7c21ee97f5ae7dc09502f6a72abcb729536d | d42280b16cb466a608e7e723d8edfbe5977253b6 | refs/heads/main | 2023-05-19T17:55:21.938724 | 2021-06-14T17:53:17 | 2021-06-14T17:53:17 | 385,034,849 | 1 | 0 | BSD-3-Clause | 2021-07-11T19:23:21 | 2021-07-11T19:23:20 | null | UTF-8 | C++ | false | false | 568 | hpp | #ifndef BOOST_METAPARSE_V1_ALPHANUM_HPP
#define BOOST_METAPARSE_V1_ALPHANUM_HPP
// Copyright Abel Sinkovics (abel@sinkovics.hu) 2009 - 2010.
// 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 <boost/metaparse/v1/one_of.hpp>
#include <boost/metaparse/v1/digit.hpp>
#include <boost/metaparse/v1/letter.hpp>
namespace boost
{
namespace metaparse
{
namespace v1
{
typedef one_of<letter, digit> alphanum;
}
}
}
#endif
| [
"znation@apple.com"
] | znation@apple.com |
7464c996332e9ea0092a7a05f74bee7d791cceaa | 5ac4199d968f301e01ef741fe7d1d162c4f82921 | /Samples/Imagics/GpuGaussianBlur2/GpuGaussianBlur2Window2.cpp | 9a6e423944b4c51cfa5243f78f1dcf24138f805c | [
"LicenseRef-scancode-unknown-license-reference",
"BSL-1.0"
] | permissive | kabukunz/GeometricTools | 9eada1b0d8b1447398e8739c9684e5ed14d4cf96 | bbc55cdef89a877f06310fdb6c6248205eae704b | refs/heads/master | 2020-11-25T11:54:23.772441 | 2019-12-17T16:11:32 | 2019-12-17T16:11:32 | 228,645,271 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 6,565 | cpp | // David Eberly, Geometric Tools, Redmond WA 98052
// Copyright (c) 1998-2019
// Distributed under the Boost Software License, Version 1.0.
// https://www.boost.org/LICENSE_1_0.txt
// https://www.geometrictools.com/License/Boost/LICENSE_1_0.txt
// Version: 4.0.2019.08.13
#include "GpuGaussianBlur2Window2.h"
GpuGaussianBlur2Window2::GpuGaussianBlur2Window2(Parameters& parameters)
:
Window2(parameters),
mNumXThreads(8),
mNumYThreads(8),
mNumXGroups(mXSize / mNumXThreads),
mNumYGroups(mYSize / mNumYThreads),
mUseDirichlet(parameters.useDirichlet)
{
if (!SetEnvironment() || !CreateImages() || !CreateShaders())
{
parameters.created = false;
return;
}
// Create an overlay that covers the entire window. The blurred image
// is drawn by the overlay effect.
mOverlay = std::make_shared<OverlayEffect>(mProgramFactory, mXSize,
mYSize, mXSize, mYSize, SamplerState::MIN_P_MAG_P_MIP_P,
SamplerState::CLAMP, SamplerState::CLAMP, false);
mOverlay->SetTexture(mImage[0]);
}
void GpuGaussianBlur2Window2::OnIdle()
{
mTimer.Measure();
mEngine->Execute(mGaussianBlurProgram, mNumXGroups, mNumYGroups, 1);
if (mUseDirichlet)
{
mEngine->Execute(mBoundaryDirichletProgram, mNumXGroups, mNumYGroups, 1);
}
else
{
mEngine->Execute(mBoundaryNeumannProgram, mNumXGroups, mNumYGroups, 1);
}
mEngine->Draw(mOverlay);
mEngine->Draw(8, mYSize - 8, { 1.0f, 1.0f, 0.0f, 1.0f }, mTimer.GetFPS());
mEngine->DisplayColorBuffer(0);
mTimer.UpdateFrameCount();
}
bool GpuGaussianBlur2Window2::SetEnvironment()
{
std::string path = GetGTEPath();
if (path == "")
{
return false;
}
mEnvironment.Insert(path + "/Samples/Imagics/GpuGaussianBlur2/Shaders/");
mEnvironment.Insert(path + "/Samples/Data/");
std::vector<std::string> inputs =
{
"Head_U16_X256_Y256.binary",
mEngine->GetShaderName("BoundaryDirichlet.cs"),
mEngine->GetShaderName("BoundaryNeumann.cs"),
mEngine->GetShaderName("GaussianBlur.cs")
};
for (auto const& input : inputs)
{
if (mEnvironment.GetPath(input) == "")
{
LogError("Cannot find file " + input);
return false;
}
}
return true;
}
bool GpuGaussianBlur2Window2::CreateImages()
{
for (int i = 0; i < 2; ++i)
{
mImage[i] = std::make_shared<Texture2>(DF_R32_FLOAT, mXSize, mYSize);
mImage[i]->SetUsage(Resource::SHADER_OUTPUT);
}
std::string path = mEnvironment.GetPath("Head_U16_X256_Y256.binary");
std::vector<uint16_t> original(mXSize * mYSize);
std::ifstream input(path, std::ios::binary);
input.read((char*)original.data(), original.size() * sizeof(uint16_t));
input.close();
// The head image is known to store 10 bits per pixel. Scale the
// texture image to have values in [0,1).
float const divisor = 1024.0f;
auto* target = mImage[0]->Get<float>();
for (int i = 0; i < mXSize * mYSize; ++i)
{
target[i] = static_cast<float>(original[i]) / divisor;
}
// Create the mask texture for BoundaryDirichlet and the offset
// texture for BoundaryNeumann.
mMaskTexture = std::make_shared<Texture2>(DF_R32_FLOAT, mXSize, mYSize);
auto* mask = mMaskTexture->Get<float>();
mOffsetTexture = std::make_shared<Texture2>(DF_R32G32_SINT, mXSize, mYSize);
auto* offset = mOffsetTexture->Get<std::array<int, 2>>();
int xSizeM1 = mXSize - 1, ySizeM1 = mYSize - 1, index;
// Interior.
for (int y = 1; y < ySizeM1; ++y)
{
for (int x = 1; x < xSizeM1; ++x)
{
index = x + mXSize * y;
mask[index] = 1.0f;
offset[index] = { 0, 0 };
}
}
// Edge-interior.
for (int x = 1; x < xSizeM1; ++x)
{
mask[x] = 0.0f;
offset[x] = { 0, 1 };
index = x + mXSize * ySizeM1;
mask[index] = 0.0f;
offset[index] = { 0, -1 };
}
for (int y = 1; y < ySizeM1; ++y)
{
index = mXSize * y;
mask[index] = 0.0f;
offset[index] = { 1, 0 };
index += xSizeM1;
mask[index] = 0.0f;
offset[index] = { -1, 0 };
}
// Corners.
mask[0] = 0.0f;
offset[0] = { 1, 1 };
mask[xSizeM1] = 0.0f;
offset[xSizeM1] = { -1, 1 };
index = mXSize * ySizeM1;
mask[index] = 0.0f;
offset[index] = { 1, -1 };
index += xSizeM1;
mask[index] = 0.0f;
offset[index] = { -1, -1 };
mWeightBuffer = std::make_shared<ConstantBuffer>(sizeof(Vector4<float>), false);
auto& weight = *mWeightBuffer->Get<Vector4<float>>();
weight[0] = 0.01f; // = kappa*DeltaT/DeltaX^2
weight[1] = 0.01f; // = kappa*DeltaT/DeltaY^2
weight[2] = 1.0f - 2.0f * weight[0] - 2.0f * weight[1]; // positive value
weight[3] = 0.0f; // unused
return true;
}
bool GpuGaussianBlur2Window2::CreateShaders()
{
mProgramFactory->defines.Set("NUM_X_THREADS", mNumXThreads);
mProgramFactory->defines.Set("NUM_Y_THREADS", mNumYThreads);
std::string csPath = mEnvironment.GetPath(mEngine->GetShaderName("GaussianBlur.cs"));
mGaussianBlurProgram = mProgramFactory->CreateFromFile(csPath);
if (!mGaussianBlurProgram)
{
return false;
}
csPath = mEnvironment.GetPath(mEngine->GetShaderName("BoundaryDirichlet.cs"));
mBoundaryDirichletProgram = mProgramFactory->CreateFromFile(csPath);
if (!mBoundaryDirichletProgram)
{
return false;
}
csPath = mEnvironment.GetPath(mEngine->GetShaderName("BoundaryNeumann.cs"));
mBoundaryNeumannProgram = mProgramFactory->CreateFromFile(csPath);
if (!mBoundaryNeumannProgram)
{
return false;
}
auto cshader = mGaussianBlurProgram->GetComputeShader();
cshader->Set("inImage", mImage[0]);
cshader->Set("outImage", mImage[1]);
cshader->Set("Weight", mWeightBuffer);
cshader = mBoundaryDirichletProgram->GetComputeShader();
cshader->Set("inImage", mImage[1]);
cshader->Set("outImage", mImage[0]);
cshader->Set("inMask", mMaskTexture);
cshader = mBoundaryNeumannProgram->GetComputeShader();
cshader->Set("inImage", mImage[1]);
cshader->Set("outImage", mImage[0]);
cshader->Set("inOffset", mOffsetTexture);
return true;
}
| [
"kabukunz@gmail.com"
] | kabukunz@gmail.com |
db45dc83c2d6769edef8073190749b48bd69b276 | 925184d03530d1933cfe51e4be98b4cffc526da8 | /Shaders/Program.cpp | e2d62324f30438bf6b328a3fd2ae71715949dc92 | [] | no_license | bploeckelman/KinectedActing | 852938e4a5c9cf7cee71633e7920cb4a88e940c3 | be89dd53940ea2503d16b4b95f3d3b7dfc64bee9 | refs/heads/master | 2020-05-28T00:46:41.861216 | 2013-12-19T03:14:52 | 2013-12-19T03:14:52 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 7,871 | cpp | /*
tdogl::Program
Copyright 2012 Thomas Dalling - http://tomdalling.com/
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 "Program.h"
#include <stdexcept>
#include <iostream>
#include <glm/gtc/type_ptr.hpp>
using namespace tdogl;
Program::Program(const std::vector<Shader>& shaders) :
_object(0)
{
if(shaders.size() <= 0)
throw std::runtime_error("No shaders were provided to create the program");
//create the program object
_object = glCreateProgram();
if(_object == 0)
throw std::runtime_error("glCreateProgram failed");
//attach all the shaders
for(unsigned i = 0; i < shaders.size(); ++i)
glAttachShader(_object, shaders[i].object());
//link the shaders together
glLinkProgram(_object);
//detach all the shaders
for(unsigned i = 0; i < shaders.size(); ++i)
glDetachShader(_object, shaders[i].object());
//throw exception if linking failed
GLint status;
glGetProgramiv(_object, GL_LINK_STATUS, &status);
if (status == GL_FALSE) {
std::string msg("Program linking failure: ");
GLint infoLogLength;
glGetProgramiv(_object, GL_INFO_LOG_LENGTH, &infoLogLength);
char* strInfoLog = new char[infoLogLength + 1];
glGetProgramInfoLog(_object, infoLogLength, NULL, strInfoLog);
msg += strInfoLog;
delete[] strInfoLog;
glDeleteProgram(_object); _object = 0;
throw std::runtime_error(msg);
} else {
std::cout << "Shader program linked.\n";
}
}
Program::~Program() {
//might be 0 if ctor fails by throwing exception
if(_object != 0) glDeleteProgram(_object);
}
GLuint Program::object() const {
return _object;
}
void Program::use() const {
glUseProgram(_object);
}
bool Program::isInUse() const {
GLint currentProgram = 0;
glGetIntegerv(GL_CURRENT_PROGRAM, ¤tProgram);
return (currentProgram == (GLint)_object);
}
void Program::stopUsing() const {
//assert(isInUse());
glUseProgram(0);
}
GLint Program::attrib(const GLchar* attribName) const {
if(!attribName)
throw std::runtime_error("attribName was NULL");
GLint attrib = glGetAttribLocation(_object, attribName);
if(attrib == -1)
throw std::runtime_error(std::string("Program attribute not found: ") + attribName);
return attrib;
}
GLint Program::uniform(const GLchar* uniformName) const {
if(!uniformName)
throw std::runtime_error("uniformName was NULL");
GLint uniform = glGetUniformLocation(_object, uniformName);
if(uniform == -1)
throw std::runtime_error(std::string("Program uniform not found: ") + uniformName);
return uniform;
}
#define ATTRIB_N_UNIFORM_SETTERS(OGL_TYPE, TYPE_PREFIX, TYPE_SUFFIX) \
\
void Program::setAttrib(const GLchar* name, OGL_TYPE v0) \
{ assert(isInUse()); glVertexAttrib ## TYPE_PREFIX ## 1 ## TYPE_SUFFIX (attrib(name), v0); } \
void Program::setAttrib(const GLchar* name, OGL_TYPE v0, OGL_TYPE v1) \
{ assert(isInUse()); glVertexAttrib ## TYPE_PREFIX ## 2 ## TYPE_SUFFIX (attrib(name), v0, v1); } \
void Program::setAttrib(const GLchar* name, OGL_TYPE v0, OGL_TYPE v1, OGL_TYPE v2) \
{ assert(isInUse()); glVertexAttrib ## TYPE_PREFIX ## 3 ## TYPE_SUFFIX (attrib(name), v0, v1, v2); } \
void Program::setAttrib(const GLchar* name, OGL_TYPE v0, OGL_TYPE v1, OGL_TYPE v2, OGL_TYPE v3) \
{ assert(isInUse()); glVertexAttrib ## TYPE_PREFIX ## 4 ## TYPE_SUFFIX (attrib(name), v0, v1, v2, v3); } \
\
void Program::setAttrib1v(const GLchar* name, const OGL_TYPE* v) \
{ assert(isInUse()); glVertexAttrib ## TYPE_PREFIX ## 1 ## TYPE_SUFFIX ## v (attrib(name), v); } \
void Program::setAttrib2v(const GLchar* name, const OGL_TYPE* v) \
{ assert(isInUse()); glVertexAttrib ## TYPE_PREFIX ## 2 ## TYPE_SUFFIX ## v (attrib(name), v); } \
void Program::setAttrib3v(const GLchar* name, const OGL_TYPE* v) \
{ assert(isInUse()); glVertexAttrib ## TYPE_PREFIX ## 3 ## TYPE_SUFFIX ## v (attrib(name), v); } \
void Program::setAttrib4v(const GLchar* name, const OGL_TYPE* v) \
{ assert(isInUse()); glVertexAttrib ## TYPE_PREFIX ## 4 ## TYPE_SUFFIX ## v (attrib(name), v); } \
\
void Program::setUniform(const GLchar* name, OGL_TYPE v0) \
{ assert(isInUse()); glUniform1 ## TYPE_SUFFIX (uniform(name), v0); } \
void Program::setUniform(const GLchar* name, OGL_TYPE v0, OGL_TYPE v1) \
{ assert(isInUse()); glUniform2 ## TYPE_SUFFIX (uniform(name), v0, v1); } \
void Program::setUniform(const GLchar* name, OGL_TYPE v0, OGL_TYPE v1, OGL_TYPE v2) \
{ assert(isInUse()); glUniform3 ## TYPE_SUFFIX (uniform(name), v0, v1, v2); } \
void Program::setUniform(const GLchar* name, OGL_TYPE v0, OGL_TYPE v1, OGL_TYPE v2, OGL_TYPE v3) \
{ assert(isInUse()); glUniform4 ## TYPE_SUFFIX (uniform(name), v0, v1, v2, v3); } \
\
void Program::setUniform1v(const GLchar* name, const OGL_TYPE* v, GLsizei count) \
{ assert(isInUse()); glUniform1 ## TYPE_SUFFIX ## v (uniform(name), count, v); } \
void Program::setUniform2v(const GLchar* name, const OGL_TYPE* v, GLsizei count) \
{ assert(isInUse()); glUniform2 ## TYPE_SUFFIX ## v (uniform(name), count, v); } \
void Program::setUniform3v(const GLchar* name, const OGL_TYPE* v, GLsizei count) \
{ assert(isInUse()); glUniform3 ## TYPE_SUFFIX ## v (uniform(name), count, v); } \
void Program::setUniform4v(const GLchar* name, const OGL_TYPE* v, GLsizei count) \
{ assert(isInUse()); glUniform4 ## TYPE_SUFFIX ## v (uniform(name), count, v); }
ATTRIB_N_UNIFORM_SETTERS(GLfloat, , f);
ATTRIB_N_UNIFORM_SETTERS(GLdouble, , d);
ATTRIB_N_UNIFORM_SETTERS(GLint, I, i);
ATTRIB_N_UNIFORM_SETTERS(GLuint, I, ui);
void Program::setUniformMatrix2(const GLchar* name, const GLfloat* v, GLsizei count, GLboolean transpose) {
assert(isInUse());
glUniformMatrix2fv(uniform(name), count, transpose, v);
}
void Program::setUniformMatrix3(const GLchar* name, const GLfloat* v, GLsizei count, GLboolean transpose) {
assert(isInUse());
glUniformMatrix3fv(uniform(name), count, transpose, v);
}
void Program::setUniformMatrix4(const GLchar* name, const GLfloat* v, GLsizei count, GLboolean transpose) {
assert(isInUse());
glUniformMatrix4fv(uniform(name), count, transpose, v);
}
void Program::setUniform(const GLchar* name, const glm::mat2& m, GLboolean transpose) {
assert(isInUse());
glUniformMatrix2fv(uniform(name), 1, transpose, glm::value_ptr(m));
}
void Program::setUniform(const GLchar* name, const glm::mat3& m, GLboolean transpose) {
assert(isInUse());
glUniformMatrix3fv(uniform(name), 1, transpose, glm::value_ptr(m));
}
void Program::setUniform(const GLchar* name, const glm::mat4& m, GLboolean transpose) {
assert(isInUse());
glUniformMatrix4fv(uniform(name), 1, transpose, glm::value_ptr(m));
}
void Program::setUniform(const GLchar* uniformName, const glm::vec2& v) {
setUniform2v(uniformName, glm::value_ptr(v));
}
void Program::setUniform(const GLchar* uniformName, const glm::vec3& v) {
setUniform3v(uniformName, glm::value_ptr(v));
}
void Program::setUniform(const GLchar* uniformName, const glm::vec4& v) {
setUniform4v(uniformName, glm::value_ptr(v));
}
| [
"brian.ploeckelman@gmail.com"
] | brian.ploeckelman@gmail.com |
3dc41c29457cddc8ebcb071374ba1669a28bc564 | 931ebc740f66bf8eb8c253a65b457954db7d176f | /Node/PowerWheelsControl.ino | 03cec84447c1e80045442f6bd079abb7dbd54499 | [] | no_license | theshoe1029/Power-Wheels-Team | a359aba3a9de46af64ef83837f6d7935f391a1df | f58f40ee3243d3deb6b605b9a185932dbb11c035 | refs/heads/master | 2020-11-29T21:09:34.911582 | 2017-08-09T01:55:30 | 2017-08-09T01:55:30 | 96,586,992 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 436 | ino | #include <Servo.h>
Servo steeringServo;
Servo throttleServo;
void setup()
{
Serial.begin(115200);
steeringServo.attach(9);
throttleServo.attach(10);
}
void loop()
{
if(Serial.available())
{
char ch;
int num;
String input = Serial.readStringUntil('\n');
sscanf((const char*)input.c_str(), "%c%d", &ch, &num);
if(ch=='S'){steeringServo.write(num);}
if(ch=='T'){throttleServo.write(num);}
}
}
| [
"billy.zelsnack@gmail.com"
] | billy.zelsnack@gmail.com |
7e53d31fc7f28b303fa946c0849d777ebe602de5 | bd1fea86d862456a2ec9f56d57f8948456d55ee6 | /000/094/241/CWE319_Cleartext_Tx_Sensitive_Info__w32_wchar_t_connect_socket_84_goodB2G.cpp | 954cc4de1e0f2aa745e8224038f2d49424ef4d2c | [] | no_license | CU-0xff/juliet-cpp | d62b8485104d8a9160f29213368324c946f38274 | d8586a217bc94cbcfeeec5d39b12d02e9c6045a2 | refs/heads/master | 2021-03-07T15:44:19.446957 | 2020-03-10T12:45:40 | 2020-03-10T12:45:40 | 246,275,244 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 6,384 | cpp | /* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE319_Cleartext_Tx_Sensitive_Info__w32_wchar_t_connect_socket_84_goodB2G.cpp
Label Definition File: CWE319_Cleartext_Tx_Sensitive_Info__w32.label.xml
Template File: sources-sinks-84_goodB2G.tmpl.cpp
*/
/*
* @description
* CWE: 319 Cleartext Transmission of Sensitive Information
* BadSource: connect_socket Read the password using a connect socket (client side)
* GoodSource: Use a hardcoded password (one that was not sent over the network)
* Sinks:
* GoodSink: Decrypt the password before using it in an authentication API call to show that it was transferred as ciphertext
* BadSink : Use the password directly from the source in an authentication API call to show that it was transferred as plaintext
* Flow Variant: 84 Data flow: data passed to class constructor and destructor by declaring the class object on the heap and deleting it after use
*
* */
#ifndef OMITGOOD
#include "std_testcase.h"
#include "CWE319_Cleartext_Tx_Sensitive_Info__w32_wchar_t_connect_socket_84.h"
#include <winsock2.h>
#include <windows.h>
#include <direct.h>
#pragma comment(lib, "ws2_32") /* include ws2_32.lib when linking */
#define TCP_PORT 27015
#define IP_ADDRESS "127.0.0.1"
#pragma comment(lib, "advapi32.lib")
#define HASH_INPUT "ABCDEFG123456" /* INCIDENTAL: Hardcoded crypto */
namespace CWE319_Cleartext_Tx_Sensitive_Info__w32_wchar_t_connect_socket_84
{
CWE319_Cleartext_Tx_Sensitive_Info__w32_wchar_t_connect_socket_84_goodB2G::CWE319_Cleartext_Tx_Sensitive_Info__w32_wchar_t_connect_socket_84_goodB2G(wchar_t * passwordCopy)
{
password = passwordCopy;
{
WSADATA wsaData;
int wsaDataInit = 0;
int recvResult;
struct sockaddr_in service;
wchar_t *replace;
SOCKET connectSocket = INVALID_SOCKET;
size_t passwordLen = wcslen(password);
do
{
if (WSAStartup(MAKEWORD(2,2), &wsaData) != NO_ERROR)
{
break;
}
wsaDataInit = 1;
connectSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
if (connectSocket == INVALID_SOCKET)
{
break;
}
memset(&service, 0, sizeof(service));
service.sin_family = AF_INET;
service.sin_addr.s_addr = inet_addr(IP_ADDRESS);
service.sin_port = htons(TCP_PORT);
if (connect(connectSocket, (struct sockaddr*)&service, sizeof(service)) == SOCKET_ERROR)
{
break;
}
/* Abort on error or the connection was closed, make sure to recv one
* less char than is in the recv_buf in order to append a terminator */
/* POTENTIAL FLAW: Reading sensitive data from the network */
recvResult = recv(connectSocket, (char*)(password + passwordLen), (100 - passwordLen - 1) * sizeof(wchar_t), 0);
if (recvResult == SOCKET_ERROR || recvResult == 0)
{
break;
}
/* Append null terminator */
password[passwordLen + recvResult / sizeof(wchar_t)] = L'\0';
/* Eliminate CRLF */
replace = wcschr(password, L'\r');
if (replace)
{
*replace = L'\0';
}
replace = wcschr(password, L'\n');
if (replace)
{
*replace = L'\0';
}
}
while (0);
if (connectSocket != INVALID_SOCKET)
{
closesocket(connectSocket);
}
if (wsaDataInit)
{
WSACleanup();
}
}
}
CWE319_Cleartext_Tx_Sensitive_Info__w32_wchar_t_connect_socket_84_goodB2G::~CWE319_Cleartext_Tx_Sensitive_Info__w32_wchar_t_connect_socket_84_goodB2G()
{
{
HCRYPTPROV hCryptProv = 0;
HCRYPTHASH hHash = 0;
HCRYPTKEY hKey = 0;
char hashData[100] = HASH_INPUT;
HANDLE pHandle;
wchar_t * username = L"User";
wchar_t * domain = L"Domain";
do
{
BYTE payload[(100 - 1) * sizeof(wchar_t)]; /* same size as password except for NUL terminator */
DWORD payloadBytes;
/* Hex-decode the input string into raw bytes */
payloadBytes = decodeHexWChars(payload, sizeof(payload), password);
/* Wipe the hex string, to prevent it from being given to LogonUserW if
* any of the crypto calls fail. */
SecureZeroMemory(password, 100 * sizeof(wchar_t));
/* Aquire a Context */
if(!CryptAcquireContext(&hCryptProv, NULL, MS_ENH_RSA_AES_PROV, PROV_RSA_AES, 0))
{
break;
}
/* Create hash handle */
if(!CryptCreateHash(hCryptProv, CALG_SHA_256, 0, 0, &hHash))
{
break;
}
/* Hash the input string */
if(!CryptHashData(hHash, (BYTE*)hashData, strlen(hashData), 0))
{
break;
}
/* Derive an AES key from the hash */
if(!CryptDeriveKey(hCryptProv, CALG_AES_256, hHash, 0, &hKey))
{
break;
}
/* FIX: Decrypt the password */
if(!CryptDecrypt(hKey, 0, 1, 0, payload, &payloadBytes))
{
break;
}
/* Copy back into password and NUL-terminate */
memcpy(password, payload, payloadBytes);
password[payloadBytes / sizeof(wchar_t)] = L'\0';
}
while (0);
if (hKey)
{
CryptDestroyKey(hKey);
}
if (hHash)
{
CryptDestroyHash(hHash);
}
if (hCryptProv)
{
CryptReleaseContext(hCryptProv, 0);
}
/* Use the password in LogonUser() to establish that it is "sensitive" */
if (LogonUserW(
username,
domain,
password,
LOGON32_LOGON_NETWORK,
LOGON32_PROVIDER_DEFAULT,
&pHandle) != 0)
{
printLine("User logged in successfully.");
CloseHandle(pHandle);
}
else
{
printLine("Unable to login.");
}
}
}
}
#endif /* OMITGOOD */
| [
"frank@fischer.com.mt"
] | frank@fischer.com.mt |
2fcce50e09823d044d8f7cd631f15da6ec03d0ff | 8ca117ac2aab1980c1977bf4717f49cf5cecbbf7 | /header/Car.hpp | 974785a7b862c765d5431ae65718dae1a28b3752 | [] | no_license | bendem/SchoolCars | 06df70e0e670a7a9bbe5a17101b3b7056a46e116 | 5144065bef06246a82305499e47c7176b79f219b | refs/heads/master | 2021-01-01T16:31:12.895666 | 2015-01-23T07:21:22 | 2015-01-23T07:21:22 | 27,227,914 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,244 | hpp | #ifndef CAR_HPP
#define CAR_HPP
#include <iostream>
#include <fstream>
#include <string>
#include "Model.hpp"
#include "Option.hpp"
#include "exceptions/ElementNotFoundException.hpp"
#include "exceptions/IOException.hpp"
#include "exceptions/NotEnoughSpaceException.hpp"
#include "utils/ArrayUtils.hpp"
#include "utils/Comparable.hpp"
#include "utils/FileUtils.hpp"
using namespace std;
#define MAX_OPTION_COUNT 10
class Car : public Comparable<Car> {
private:
String name;
Model model;
Option** options;
public:
Car(String = "", const Model& = Model());
Car(const Car&);
~Car();
void display() const;
void addOption(const Option&);
void removeOption(const String&);
Option& getOption(const String&);
List<Option> getOptions() const;
float getPrice() const;
String getName() const;
void setName(String);
const Model& getModel() const;
void setModel(const Model&);
void save() const;
void load(const String&);
Car& operator=(Car);
Car operator+(const Option&) const;
Car operator-(const Option&) const;
Car operator-(const String&) const;
int compareTo(const Car&) const;
friend ostream& operator<<(ostream&, const Car&);
};
#endif
| [
"online@bendem.be"
] | online@bendem.be |
a8c1a63bdbe1fd9d871532832f418a6fac5e082e | 2232c179ab4aafbac2e53475447a5494b26aa3fb | /src/mesh/iterators/CellTopologyIteratorFilter.hpp | 5c8b67b4741516b5d775639e11935a426eb44014 | [] | no_license | martinv/pdekit | 689986d252d13fb3ed0aa52a0f8f6edd8eef943c | 37e127c81702f62f744c11cc2483869d8079f43e | refs/heads/master | 2020-03-31T09:24:32.541648 | 2018-10-08T15:23:43 | 2018-10-08T15:23:43 | 152,095,058 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,380 | hpp | #ifndef PDEKIT_Mesh_Iterators_Cell_Topology_Iterator_Filter_hpp
#define PDEKIT_Mesh_Iterators_Cell_Topology_Iterator_Filter_hpp
#include "mesh/EntityStatus.hpp"
#include "mesh/std_region/PointSetTag.hpp"
namespace pdekit
{
namespace mesh
{
// ----------------------------------------------------------------------------
// Default filter - accepts TopologyCell as a view of any entry in TriaCells
// ----------------------------------------------------------------------------
class CellTopologyIterFilterDefault
{
public:
CellTopologyIterFilterDefault() = default;
~CellTopologyIterFilterDefault() = default;
template <typename ViewType>
inline constexpr bool filter_pass(const ViewType &view) const
{
return true;
}
};
// ----------------------------------------------------------------------------
// Filter based on types of standard regions
// ----------------------------------------------------------------------------
class CellTopologyIterFilterActive
{
public:
CellTopologyIterFilterActive() = default;
CellTopologyIterFilterActive(const CellTopologyIterFilterActive &other_filter) = default;
~CellTopologyIterFilterActive() = default;
CellTopologyIterFilterActive &operator=(const CellTopologyIterFilterActive &other_filter) =
default;
template <typename TopoCellType>
inline const bool filter_pass(const TopoCellType &cell) const
{
return (cell.status() == EntityStatus::Active);
}
};
// ----------------------------------------------------------------------------
// Filter based on types of standard regions
// ----------------------------------------------------------------------------
class CellTopologyIterFilterTyped
{
public:
CellTopologyIterFilterTyped();
CellTopologyIterFilterTyped(const PointSetTag std_reg_tag);
CellTopologyIterFilterTyped(const CellTopologyIterFilterTyped &other_filter) = default;
~CellTopologyIterFilterTyped() = default;
CellTopologyIterFilterTyped &operator=(const CellTopologyIterFilterTyped &other_filter) = default;
template <typename ViewType>
inline const bool filter_pass(const ViewType &view) const
{
return (view.cell_type().std_region_id() == m_cell_type);
}
private:
PointSetTag m_cell_type;
};
// ----------------------------------------------------------------------------
} // namespace mesh
} // namespace pdekit
#endif
| [
"martin.vymazal@gmail.com"
] | martin.vymazal@gmail.com |
cfc505e1724d5a6f4dd2e36013fdc270661afecd | 4dbb45758447dcfa13c0be21e4749d62588aab70 | /iOS/Classes/Native/mscorlib_System_Runtime_ConstrainedExecution_Consi3698611150.h | 1ad3577f2976bdfb5901c865ed3c2356a323a734 | [
"MIT"
] | permissive | mopsicus/unity-share-plugin-ios-android | 6dd6ccd2fa05c73f0bf5e480a6f2baecb7e7a710 | 3ee99aef36034a1e4d7b156172953f9b4dfa696f | refs/heads/master | 2020-12-25T14:38:03.861759 | 2016-07-19T10:06:04 | 2016-07-19T10:06:04 | 63,676,983 | 12 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,014 | h | #pragma once
#include "il2cpp-config.h"
#ifndef _MSC_VER
# include <alloca.h>
#else
# include <malloc.h>
#endif
#include <stdint.h>
#include "mscorlib_System_Enum2862688501.h"
#include "mscorlib_System_Runtime_ConstrainedExecution_Consi3698611150.h"
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// System.Runtime.ConstrainedExecution.Consistency
struct Consistency_t3698611150
{
public:
// System.Int32 System.Runtime.ConstrainedExecution.Consistency::value__
int32_t ___value___1;
public:
inline static int32_t get_offset_of_value___1() { return static_cast<int32_t>(offsetof(Consistency_t3698611150, ___value___1)); }
inline int32_t get_value___1() const { return ___value___1; }
inline int32_t* get_address_of_value___1() { return &___value___1; }
inline void set_value___1(int32_t value)
{
___value___1 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
| [
"lii@rstgames.com"
] | lii@rstgames.com |
48a3ff0ecd1b21498705c50dfb933044780b58f5 | 16ae65be9fdbb0e5af6339781b6680ace16c238f | /CaesarCipher/FileIOCaeserCipherV2.cpp | 60317bb336936249a4235c023dfaf9ca953e428b | [] | no_license | mansi-patel8/CaesarCipher | 817f973ff4b5148e6481e9ab4c31d050bbe3cffc | bee3292778b87d9e1de1c345c96f46cfe2a97a07 | refs/heads/master | 2023-04-18T12:11:13.793100 | 2021-05-02T20:50:39 | 2021-05-02T20:50:39 | 363,747,866 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 6,626 | cpp | /*
* Name: Mansi Patel
* Purpose: The purpose of this program is to do the caesarcipher for specified input and output files/streams using the IO redirection.
- Ex.: $ ./caesar -e 1 3 in.txt output.txt
* Pseducode/ Program outline logic:
- user input in cmd for shift and input/output file and error check on it
- decrypt the message for [A-Z,A-z,0-9]
- logic is in place if you put the decrypted message with correct shift, program will return original message
*/
#include <iostream>
#include <string>
#include <fstream>
using namespace std;
int main(int argc, char* argv[])
{
string line;
char cipheredLetter;
int shiftLetter, shiftDigit, choice;
string cipheredArg, shiftLetterArg, shiftDigitArg, inputFileArg, outputFileArg; //vars for cmd input
if (argc < 6 || argc > 6)
{
cout << "Please enter valid commands to run the program properly." << endl;
}
if (argc == 6)
{
//taking cmd line arguments and setting the varibles
for (int counter = 0; counter < argc; counter++)
{
cipheredArg = argv[1];
shiftLetterArg = argv[2];
shiftDigitArg = argv[3];
inputFileArg = argv[4];
outputFileArg = argv[5];
}
//seeting shiftLetter var from cmd input
int m = stoi(shiftLetterArg); //string to int
if (m <= 26 && m >= -26) //shiftLetter should be <= 26 and >= -26
{
shiftLetter = m;
}
else
{
cout << "Invalid shiftLetter. Please try again." << endl;
return -2;
}
//setting shiftDigot var from cmd input
int n = stoi(shiftDigitArg); //string to int
if (n <= 10 && n >= -10) //shiftLetter should be <= 26 and >= -26
{
shiftDigit = n;
}
else
{
cout << "Invalid shiftLetter. Please try again." << endl;
return -2;
}
//seeting encryption/decryption choice from cmd input
if (cipheredArg == "-e")
{
choice = 1;
}
else if (cipheredArg == "-d")
{
choice = 2;
}
else
{
cout << "Not valid command." << endl;
}
//Encryption
if (choice == 1)
{
//normal text input file
ifstream inputEncryptedFile(inputFileArg); //text.txt
//encrypted output file
ofstream outputDecryptedFile(outputFileArg); //encrypted.text
//input file is open and it is not empty
if (inputEncryptedFile.is_open() && !(inputEncryptedFile.peek() == ifstream::traits_type::eof()))
{
cout << "successfully opened " << inputFileArg << " for decryption" << endl;
//output file is open
if (!outputDecryptedFile.fail())
{
cout << "successfully opened " << outputFileArg << " for writing." << endl;
//this for loop will go through all the lines in the file
for (int lineno = 1; getline(inputEncryptedFile, line); lineno++)
{
//this for loop will go through all the characters in the line
for (int letter = 0; letter < line.size() && line[letter] != '\0'; letter++)
{
cipheredLetter = line[letter];
//check for capital letters and spaces
if ((line[letter] >= 'A' && line[letter] <= 'Z') && (line[letter] != ' '))
{
//encrypt the message for 'A' to 'z'
cipheredLetter = cipheredLetter + shiftLetter;
if (cipheredLetter > 'Z')
{
cipheredLetter = cipheredLetter - 'Z' + 'A' - 1;
}
outputDecryptedFile << cipheredLetter;
}
else if ((line[letter] >= 'a' && line[letter] <= 'z') && (line[letter] != ' '))
{
//encrypt the message for 'a' to 'z'
cipheredLetter = cipheredLetter + shiftLetter;
if (cipheredLetter > 'z')
{
cipheredLetter = cipheredLetter - 'z' + 'a' - 1;
}
outputDecryptedFile << cipheredLetter;
}
else
{
//encrypt the message for digits
cipheredLetter = cipheredLetter + shiftDigit;
outputDecryptedFile << cipheredLetter;
}
}
outputDecryptedFile << endl;
}
}
else
{
cerr << "error opening " << outputFileArg << " for writing." << endl;
}
inputEncryptedFile.close(); //close input filestream
outputDecryptedFile.close(); //close output filestream
}
else
{
cerr << "error opening " << inputFileArg << " for writing. \n Please check whether your file has data for encryption." << endl;
}
}
else if (choice == 2) //Decryption
{
//encrypted input file
ifstream inputTxtFile(inputFileArg); //encrypted.text
//decrypted output file
ofstream outputEncryptedFile(outputFileArg); //
//input file is open and it is not empty
if (inputTxtFile.is_open() && !(inputTxtFile.peek() == ifstream::traits_type::eof()))
{
cout << "successfully opened" << inputFileArg << "for reading" << endl;
//output file is open
if (!outputEncryptedFile.fail())
{
cout << "successfully opened " << outputFileArg << " for writing." << endl;
//this for loop will go through all the lines in the file
for (int lineno = 1; getline(inputTxtFile, line); lineno++)
{
//this for loop will go through all the characters in the line
for (int letter = 0; letter < line.size() && line[letter] != '\0'; letter++)
{
cipheredLetter = line[letter];
//check for capital letters and spaces
if ((line[letter] >= 'A' && line[letter] <= 'Z') && (line[letter] != ' '))
{
//decrypt the message for 'A' to 'Z'
cipheredLetter = cipheredLetter - shiftLetter;
if (cipheredLetter < 'A')
{
cipheredLetter = cipheredLetter + 'Z' - 'A' + 1;
}
outputEncryptedFile << cipheredLetter;
}
else if ((line[letter] >= 'a' && line[letter] <= 'z') && (line[letter] != ' '))
{
//decrypt the message for 'a' to 'z'
cipheredLetter = cipheredLetter - shiftLetter;
if (cipheredLetter > 'z')
{
cipheredLetter = cipheredLetter + 'z' - 'a' + 1;
}
outputEncryptedFile << cipheredLetter;
}
else
{
//decrypt the message for digits
cipheredLetter = cipheredLetter - shiftDigit;
outputEncryptedFile << cipheredLetter;
}
}
outputEncryptedFile << endl;
}
}
else
{
cerr << "error opening " << outputFileArg << " for writing." << endl;
}
inputTxtFile.close(); //close input filestream
outputEncryptedFile.close(); //close output filestream
}
else
{
cerr << "error opening " << inputFileArg << " for writing. \n Please check whether your file has data for decryption.\n";
}
}
else
{
cout << "Invalid command. \n Please try again.\n";
}
}
return 0;
}
| [
"61858706+mansi-patel8@users.noreply.github.com"
] | 61858706+mansi-patel8@users.noreply.github.com |
35ca05a0748d8fbf0f0a495523e0a9f24e7f1f6b | 67d31e57444a4a08aed83bbe215e674d6b56f3b1 | /livedata/LineEditNotify.h | 21a9a4348aaa8221a2c88f4b190b8f2cb29cf0fa | [] | no_license | SammyEnigma/QtLifecycleDemo | 2b93653231a5f7d2f859804090b88f5b866366f1 | 3c0f7f34f1bc30b23e281af3d220a6588d7b0e55 | refs/heads/master | 2023-04-12T18:18:57.048550 | 2021-04-19T06:33:44 | 2021-04-19T06:33:44 | 322,219,658 | 0 | 0 | null | 2021-04-19T09:28:49 | 2020-12-17T07:47:45 | C++ | UTF-8 | C++ | false | false | 1,074 | h | #pragma once
#include "LiveData.h"
#include "LiveDataDefaultConverter.h"
#include <qlineedit.h>
static QLineEdit* castLineEditWithCheck(QWidget* widget) {
auto lineEdit = dynamic_cast<QLineEdit*>(widget);
Q_ASSERT_X(lineEdit != nullptr, "lineEditnotify", "cannot cast widget");
return lineEdit;
}
template<typename T>
static void lineEdit_editingFinished(QWidget* widget, LiveData<T>* liveData) {
auto lineEdit = castLineEditWithCheck(widget);
QObject::connect(lineEdit, &QLineEdit::editingFinished, [=] {
liveData->setData(lineEdit->text());
});
}
template<typename T>
static void lineEdit_textChanged(QWidget* widget, LiveData<T>* liveData) {
QObject::connect(castLineEditWithCheck(widget), &QLineEdit::textChanged, [=] (const QString& text) {
liveData->setData(text);
});
}
template<typename T>
static void lineEdit_textEdited(QWidget* widget, LiveData<T>* liveData) {
QObject::connect(castLineEditWithCheck(widget), &QLineEdit::textEdited, [=](const QString& text) {
liveData->setData(text);
});
} | [
"1286772338@qq.com"
] | 1286772338@qq.com |
738673dfe7eeb9e13af4994780b44f5ce8c12d09 | ae716f70009a8e1433f11c07ffbc7f9578eaaf81 | /include/cpgf/gmetaextendtype.h | 97f4ad490c6f89dfbfd23cb53f610c5792f8cd0f | [
"Apache-2.0"
] | permissive | michalslonina/cpgf | b4aefab1fd3371ef41593be87bae37b0c8ecf779 | 5231b3e650af4b2b0bb63bdeb0a7f25dd82cdaf3 | refs/heads/develop | 2021-01-18T05:30:33.465421 | 2015-11-29T09:59:19 | 2015-11-29T09:59:19 | 47,057,611 | 0 | 0 | null | 2015-11-29T09:29:26 | 2015-11-29T09:29:26 | null | UTF-8 | C++ | false | false | 4,864 | h | #ifndef CPGF_GMETAEXTENDTYPE_H
#define CPGF_GMETAEXTENDTYPE_H
#include "cpgf/gstdint.h"
#include "cpgf/gclassutil.h"
#include "cpgf/gifelse.h"
#include "cpgf/gtypetraits.h"
#include "cpgf/gmetamodule.h"
#include "cpgf/metatraits/gmetatraitsparam.h"
#include "cpgf/metatraits/gmetaconverter.h"
#include "cpgf/metatraits/gmetaserializer.h"
#include "cpgf/metatraits/gmetascriptwrapper.h"
#include "cpgf/metatraits/gmetasharedptrtraits.h"
#include "cpgf/metatraits/gmetaobjectlifemanager.h"
#include <string.h>
namespace cpgf {
class GMetaItem;
const uint32_t GExtendTypeCreateFlag_Converter = 1 << 0;
const uint32_t GExtendTypeCreateFlag_Serializer = 1 << 1;
const uint32_t GExtendTypeCreateFlag_ScriptWrapper = 1 << 2;
const uint32_t GExtendTypeCreateFlag_SharedPointerTraits = 1 << 3;
const uint32_t GExtendTypeCreateFlag_ObjectLifeManager = 1 << 4;
#pragma pack(push, 1)
#pragma pack(1)
struct GMetaExtendTypeData
{
uint32_t arraySize;
IMetaConverter * converter;
IMetaSerializer * serializer;
IMetaScriptWrapper * scriptWrapper;
IMetaSharedPointerTraits * sharedPointerTraits;
IMetaObjectLifeManager * objectLifeManager;
};
#pragma pack(pop)
namespace meta_internal {
template <typename T>
struct WrapRawExtendType
{
private:
typedef typename ExtractRawType<T>::Result Raw;
public:
typedef typename GIfElse<IsVoid<Raw>::Result, int, Raw>::Result Result;
};
template <typename T>
struct WrapExtendType
{
private:
typedef typename RemoveReference<T>::Result U;
public:
typedef typename GIfElse<IsVoid<U>::Result, int, U>::Result Result;
};
template <typename T>
void deduceMetaExtendTypeData(GMetaExtendTypeData * data, uint32_t createFlags, const GMetaModule * module)
{
data->arraySize = ArraySize<T>::Result;
if((createFlags & GExtendTypeCreateFlag_Converter) != 0) {
GMetaTraitsParam param;
param.module = module;
typename WrapExtendType<T>::Result * p = 0;
data->converter = createConverterFromMetaTraits(param, p);
}
else {
data->converter = NULL;
}
if((createFlags & GExtendTypeCreateFlag_Serializer) != 0) {
GMetaTraitsParam param;
param.module = module;
typename WrapRawExtendType<T>::Result * p = 0;
data->serializer = createSerializerFromMetaTraits(param, p);
}
else {
data->serializer = NULL;
}
if((createFlags & GExtendTypeCreateFlag_ScriptWrapper) != 0) {
GMetaTraitsParam param;
param.module = module;
typename WrapExtendType<T>::Result * p = 0;
data->scriptWrapper = metaTraitsCreateScriptWrapper<typename WrapExtendType<T>::Result>(param, p);
}
else {
data->scriptWrapper = NULL;
}
if((createFlags & GExtendTypeCreateFlag_SharedPointerTraits) != 0) {
GMetaTraitsParam param;
param.module = module;
typename WrapExtendType<T>::Result * p = 0;
data->sharedPointerTraits = createSharedPointerTraitsFromMetaTraits(param, p);
}
else {
data->sharedPointerTraits = NULL;
}
if((createFlags & GExtendTypeCreateFlag_ObjectLifeManager) != 0) {
GMetaTraitsParam param;
param.module = module;
typename WrapRawExtendType<T>::Result * p = 0;
data->objectLifeManager = createObjectLifeManagerFromMetaTraits(param, p);
}
else {
data->objectLifeManager = NULL;
}
}
} // namespace meta_internal
GMAKE_FINAL(GMetaExtendType)
class GMetaExtendType : GFINAL_BASE(GMetaExtendType)
{
public:
GMetaExtendType();
explicit GMetaExtendType(const GMetaExtendTypeData & data);
GMetaExtendType(const GMetaExtendType & other);
~GMetaExtendType();
GMetaExtendType & operator = (GMetaExtendType other);
void swap(GMetaExtendType & other);
uint32_t getArraySize() const;
IMetaConverter * getConverter() const;
IMetaSerializer * getSerializer() const;
IMetaScriptWrapper * getScriptWrapper() const;
IMetaSharedPointerTraits * getSharedPointerTraits() const;
IMetaObjectLifeManager * getObjectLifeManager() const;
const GMetaExtendTypeData & refData() const;
GMetaExtendTypeData & refData();
GMetaExtendTypeData takeData();
private:
GMetaExtendTypeData data;
};
template <typename T>
GMetaExtendType createMetaExtendType(uint32_t createFlags, const GMetaItem * metaItem)
{
GMetaExtendType type;
meta_internal::deduceMetaExtendTypeData<T>(&type.refData(), createFlags, getItemModule(metaItem));
return type;
}
template <typename T>
GMetaExtendType createMetaExtendType(uint32_t createFlags, const GMetaModule * module)
{
GMetaExtendType type;
meta_internal::deduceMetaExtendTypeData<T>(&type.refData(), createFlags, module);
return type;
}
template <typename T>
GMetaExtendType createMetaExtendType(uint32_t createFlags)
{
return createMetaExtendType<T>(createFlags, (const GMetaItem *)NULL);
}
template <typename T>
GMetaExtendType createMetaExtendType()
{
return createMetaExtendType<T>(0);
}
void retainExtendTypeData(GMetaExtendTypeData * data);
void releaseExtendTypeData(GMetaExtendTypeData * data);
} // namespace cpgf
#endif
| [
"wqking@outlook.com"
] | wqking@outlook.com |
acefb595eb826f7196801e835ec58d065f680e4d | 576d77b4b09b63148c09c850fdfb97f1efee7496 | /star.h | 8ddd72f037a868934972d21127672ce66fb26202 | [] | no_license | WilliamDyball/3D_Rendering-and-lighting | 6e1f69ba53970f312545312905a583f9da050b7b | 131b338fe7be137ea6f7c3e4c056a74794edfbef | refs/heads/master | 2021-01-01T02:30:14.250140 | 2020-02-08T16:00:16 | 2020-02-08T16:00:16 | 239,142,051 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 614 | h |
#pragma once
#include <GL/glew/glew.h>
#include <GL/freeglut.h>
#include "shader_setup.h"
#include <CoreStructures\GUVector4.h>
#include <CoreStructures\GUMatrix4.h>
class star {
// star instance variables
CoreStructures::GUVector4 pos;
CoreStructures::GUMatrix4 orientation;
public:
//
// class method interface
//
static void initStar(void);
//
// instance method interface
//
// constructors
star();
star(float x, float y, float z);
star(float x, float y, float z, float rx, float ry, float rz);
// drawing methods
void render(const CoreStructures::GUMatrix4& cameraTransform);
}; | [
"WilliamDyball@users.noreply.github.com"
] | WilliamDyball@users.noreply.github.com |
caf0f9ac3c4a8f2a583a09a2139bd9e1cc3f707d | 8e34fbb8bd20c84fbd920222b395c7cdb9e94b7d | /libs/ma_handler_storage/include/ma/handler_storage.hpp | b2943898352c3a322c154fa61c42d677b2e1572e | [
"BSL-1.0"
] | permissive | oudream/asio_samples | aa7bcabe6f18a8f8de2d0a53f0bcccb96bd10dfc | 11a051a43bcdc9e07b8bdf53e5f8d526428957c1 | refs/heads/master | 2020-05-23T13:30:11.812525 | 2019-05-15T08:09:08 | 2019-05-15T08:09:08 | 186,779,336 | 0 | 0 | NOASSERTION | 2019-05-15T08:06:07 | 2019-05-15T08:06:07 | null | UTF-8 | C++ | false | false | 11,630 | hpp | //
// Copyright (c) 2010-2015 Marat Abrarov (abrarov@gmail.com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE or copy at http://www.boost.org/LICENSE_1_0.txt)
//
#ifndef MA_HANDLER_STORAGE_HPP
#define MA_HANDLER_STORAGE_HPP
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
#pragma once
#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
#include <boost/asio.hpp>
#include <boost/noncopyable.hpp>
#include <ma/config.hpp>
#include <ma/detail/type_traits.hpp>
#include <ma/handler_storage_service.hpp>
#include <ma/detail/utility.hpp>
namespace ma {
/// Provides storage for handlers.
/**
* The handler_storage class provides the storage for handlers:
* http://www.boost.org/doc/libs/release/doc/html/boost_asio/reference/Handler.html
* It supports Boost.Asio custom memory allocation:
* http://www.boost.org/doc/libs/release/doc/html/boost_asio/overview/core/allocation.html
*
* A value h of a stored handler class should work correctly
* in the expression h(arg) where arg is an lvalue of type const Arg.
*
* Stored handler must have nothrow copy-constructor.
* This restriction is predicted by asio custom memory allocation.
*
* Every instance of handler_storage class is tied to
* some instance of boost::asio::io_service class.
*
* The stored handler can't be invoked (and must not be invoked) directly.
* It can be only destroyed or posted (with immediate stored value
* destruction) to the io_service object to which the handler_storage object
* is tied by usage of boost::asio::io_service::post method.
*
* The handler_storage class instances are automatically cleaned up
* during destruction of the tied io_service (those handler_storage class
* instances that are alive to that moment).
* That clean up is done by destruction of the stored value (handler) -
* not the handler_storage instance itself.
* Because of the automatic clean up, users of handler_storage must remember
* that the stored value (handler) may be destroyed without explicit
* user activity. Also this implies to the thread safety.
* The handler_storage instances must not outlive the tied io_service object.
* A handler_storage object can store a value (handler) that is
* the owner of the handler_storage object itself.
* This is one of the reasons of automatic clean up.
*
* handler_storage is like boost::function, except:
*
* @li boost::function is more flexible and general,
* @li handler_storage supports Boost.Asio custom memory allocation,
* @li handler_storage is automatically cleaned up during io_service
* destruction,
* @li handler_storage is noncopyable.
*
* @par Thread Safety
* @e Distinct @e objects: Safe until boost::asio::io_service::~io_service().@n
* @e Shared @e objects: Unsafe.
*
* At the point of execution of io_service::~io_service() access to all members
* of any handler_storage instance may be done only within context
* of the thread executing io_service::~io_service().
*
* From the start point of io_service::~io_service() it is not guaranted that
* store(handler) can store handler. If underlying service was shut down then
* store(handler) won't do anything at all.
*/
template <typename Arg, typename Target = void>
class handler_storage : private boost::noncopyable
{
private:
typedef handler_storage<Arg, Target> this_type;
public:
typedef handler_storage_service service_type;
typedef typename service_type::implementation_type implementation_type;
typedef typename detail::decay<Arg>::type arg_type;
typedef typename detail::decay<Target>::type target_type;
explicit handler_storage(boost::asio::io_service& io_service);
~handler_storage();
#if defined(MA_HAS_RVALUE_REFS)
handler_storage(this_type&& other);
#endif
boost::asio::io_service& get_io_service();
/// Get pointer to the stored handler.
/**
* Because of type erasure it's "pointer to void" so "reinterpret_cast"
* should be used. See usage example at "nmea_client" project.
* If storage doesn't contain any handler then returns null pointer.
*/
target_type* target();
/// Get pointer to the stored handler. Const version.
const target_type* target() const;
/// Check if handler storage is empty (doesn't contain any handler).
/**
* It doesn't clear handler storage. See frequent STL-related errors
* at PVS-Studio site 8) - it's not an advertisement but really interesting
* reading.
*/
bool empty() const;
/// Check if handler storage contains handler.
bool has_target() const;
/// Clear stored handler if it exists.
void clear();
/// Store handler in this handler storage.
/**
* Really, "store" means "try to store, if can't (io_service's destructor is
* already called) then do nothing".
* For test of was "store" successful or not, "has_target" can be used
* (called right after "store").
*/
template <typename Handler>
void store(MA_FWD_REF(Handler) handler);
/// Post the stored handler to storage related io_service instance.
/**
* Attention!
* Always check if handler storage has any handler stored in it.
* Use "has_target". Always - even if you already have called "store" method.
* Really, "store" means "try to store, if can't (io_service's destructor is
* already called) then do nothing".
*/
void post(const arg_type& arg);
private:
service_type& service_;
implementation_type impl_;
}; // class handler_storage
template <typename Target>
class handler_storage<void, Target> : private boost::noncopyable
{
private:
typedef handler_storage<void, Target> this_type;
public:
typedef handler_storage_service service_type;
typedef typename service_type::implementation_type implementation_type;
typedef void arg_type;
typedef typename detail::decay<Target>::type target_type;
explicit handler_storage(boost::asio::io_service& io_service);
~handler_storage();
#if defined(MA_HAS_RVALUE_REFS)
handler_storage(this_type&& other);
#endif
boost::asio::io_service& get_io_service();
/// Get pointer to the stored handler.
/**
* Because of type erasure it's "pointer to void" so "reinterpret_cast"
* should be used. See usage example at "nmea_client" project.
* If storage doesn't contain any handler then returns null pointer.
*/
target_type* target();
/// Get pointer to the stored handler. Const version.
const target_type* target() const;
/// Check if handler storage is empty (doesn't contain any handler).
/**
* It doesn't clear handler storage. See frequent STL-related errors
* at PVS-Studio site 8) - it's not an advertisement but really interesting
* reading.
*/
bool empty() const;
/// Check if handler storage contains handler.
bool has_target() const;
/// Clear stored handler if it exists.
void clear();
/// Store handler in this handler storage.
/**
* Really, "store" means "try to store, if can't (io_service's destructor is
* already called) then do nothing".
* For test of was "store" successful or not, "has_target" can be used
* (called right after "store").
*/
template <typename Handler>
void store(MA_FWD_REF(Handler) handler);
/// Post the stored handler to storage related io_service instance.
/**
* Attention!
* Alwasy check if handler storage has any handler stored in it.
* Use "has_target". Always - even if you already have called "store" method.
* Really, "store" means "try to store, if can't (io_service's destructor is
* already called) then do nothing".
*/
void post();
private:
service_type& service_;
implementation_type impl_;
}; // class handler_storage
template <typename Arg, typename Target>
handler_storage<Arg, Target>::handler_storage(
boost::asio::io_service& io_service)
: service_(boost::asio::use_service<service_type>(io_service))
{
service_.construct(impl_);
}
template <typename Arg, typename Target>
handler_storage<Arg, Target>::~handler_storage()
{
service_.destroy(impl_);
}
#if defined(MA_HAS_RVALUE_REFS)
template <typename Arg, typename Target>
handler_storage<Arg, Target>::handler_storage(this_type&& other)
: service_(other.service_)
{
service_.move_construct(impl_, other.impl_);
}
#endif // defined(MA_HAS_RVALUE_REFS)
template <typename Arg, typename Target>
boost::asio::io_service& handler_storage<Arg, Target>::get_io_service()
{
return service_.get_io_service();
}
template <typename Arg, typename Target>
typename handler_storage<Arg, Target>::target_type*
handler_storage<Arg, Target>::target()
{
return service_.target<arg_type, target_type>(impl_);
}
template <typename Arg, typename Target>
const typename handler_storage<Arg, Target>::target_type*
handler_storage<Arg, Target>::target() const
{
return service_.target<arg_type, target_type>(impl_);
}
template <typename Arg, typename Target>
bool handler_storage<Arg, Target>::empty() const
{
return service_.empty(impl_);
}
template <typename Arg, typename Target>
bool handler_storage<Arg, Target>::has_target() const
{
return service_.has_target(impl_);
}
template <typename Arg, typename Target>
void handler_storage<Arg, Target>::clear()
{
service_.clear(impl_);
}
template <typename Arg, typename Target>
template <typename Handler>
void handler_storage<Arg, Target>::store(MA_FWD_REF(Handler) handler)
{
typedef typename detail::decay<Handler>::type handler_type;
service_.store<handler_type, arg_type, target_type>(
impl_, detail::forward<Handler>(handler));
}
template <typename Arg, typename Target>
void handler_storage<Arg, Target>::post(const arg_type& arg)
{
service_.post<arg_type, target_type>(impl_, arg);
}
template <typename Target>
handler_storage<void, Target>::handler_storage(
boost::asio::io_service& io_service)
: service_(boost::asio::use_service<service_type>(io_service))
{
service_.construct(impl_);
}
template <typename Target>
handler_storage<void, Target>::~handler_storage()
{
service_.destroy(impl_);
}
#if defined(MA_HAS_RVALUE_REFS)
template <typename Target>
handler_storage<void, Target>::handler_storage(this_type&& other)
: service_(other.service_)
{
service_.move_construct(impl_, other.impl_);
}
#endif // defined(MA_HAS_RVALUE_REFS)
template <typename Target>
boost::asio::io_service& handler_storage<void, Target>::get_io_service()
{
return service_.get_io_service();
}
template <typename Target>
typename handler_storage<void, Target>::target_type*
handler_storage<void, Target>::target()
{
return service_.target<void, target_type>(impl_);
}
template <typename Target>
const typename handler_storage<void, Target>::target_type*
handler_storage<void, Target>::target() const
{
return service_.target<void, target_type>(impl_);
}
template <typename Target>
bool handler_storage<void, Target>::empty() const
{
return service_.empty(impl_);
}
template <typename Target>
bool handler_storage<void, Target>::has_target() const
{
return service_.has_target(impl_);
}
template <typename Target>
void handler_storage<void, Target>::clear()
{
service_.clear(impl_);
}
template <typename Target>
template <typename Handler>
void handler_storage<void, Target>::store(MA_FWD_REF(Handler) handler)
{
typedef typename detail::decay<Handler>::type handler_type;
service_.store<handler_type, void, target_type>(
impl_, detail::forward<Handler>(handler));
}
template <typename Target>
void handler_storage<void, Target>::post()
{
service_.post<target_type>(impl_);
}
} // namespace ma
#endif // MA_HANDLER_STORAGE_HPP
| [
"abrarov@gmail.com"
] | abrarov@gmail.com |
71287668e225f4bfa4bcc9163b13006b7d4c233d | 3728db88d8f8268ded2af24c4240eec9f9dc9068 | /mln/morpho/elementary/like_ero_set.hh | aaa8bbbec8a712fda48d154003f8e5d0e0d7c1a1 | [] | no_license | KDE/kolena | ca01613a49b7d37f0f74953916a49aceb162daf8 | 0e0eff22f44e3834e8ebaf2c226eaba602b1ebf6 | refs/heads/master | 2021-01-19T06:40:53.365100 | 2011-03-29T11:53:16 | 2011-03-29T11:53:16 | 42,732,429 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 5,219 | hh | // Copyright (C) 2008, 2009 EPITA Research and Development Laboratory (LRDE)
//
// This file is part of Olena.
//
// Olena is free software: you can redistribute it and/or modify it under
// the terms of the GNU General Public License as published by the Free
// Software Foundation, version 2 of the License.
//
// Olena is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Olena. If not, see <http://www.gnu.org/licenses/>.
//
// As a special exception, you may use this file as part of a free
// software project without restriction. Specifically, if other files
// instantiate templates or use macros or inline functions from this
// file, or you compile this file and link it with other files to produce
// an executable, this file does not by itself cause the resulting
// executable to be covered by the GNU General Public License. This
// exception does not however invalidate any other reasons why the
// executable file might be covered by the GNU General Public License.
#ifndef MLN_MORPHO_ELEMENTARY_LIKE_ERO_SET_HH
# define MLN_MORPHO_ELEMENTARY_LIKE_ERO_SET_HH
/// \file
///
/// \todo Add a choice between adjust_fill and adjust_duplicate.
# include <mln/morpho/includes.hh>
namespace mln
{
namespace morpho
{
namespace elementary
{
template <typename I, typename N>
mln_concrete(I)
like_ero_set(bool val[5],
const Image<I>& input, const Neighborhood<N>& nbh);
# ifndef MLN_INCLUDE_ONLY
namespace impl
{
namespace generic
{
template <typename I, typename N>
mln_concrete(I)
like_ero_set(bool val[5],
const Image<I>& input_, const Neighborhood<N>& nbh_)
{
trace::entering("morpho::elementary::impl::generic::like_ero_set");
bool
ext_value = val[0],
do_duplicate = val[1],
on_input_p = val[2],
on_input_n = val[3],
output_p = val[4];
const I& input = exact(input_);
const N& nbh = exact(nbh_);
extension::adjust_fill(input, nbh, ext_value);
mln_concrete(I) output;
if (do_duplicate)
output = duplicate(input);
else
{
initialize(output, input);
data::fill(output, false);
}
mln_piter(I) p(input.domain());
mln_niter(N) n(nbh, p);
for_all(p)
if (input(p) == on_input_p)
for_all(n)
if (input.has(n) && input(n) == on_input_n)
output(p) = output_p;
trace::exiting("morpho::elementary::impl::generic::like_ero_set");
return output;
}
} // end of namespace mln::morpho::elementary::impl::generic
template <typename I, typename N>
mln_concrete(I)
like_ero_set_fastest(bool val[5],
const Image<I>& input_, const Neighborhood<N>& nbh_)
{
trace::entering("morpho::elementary::impl::like_ero_set_fastest");
bool
ext_value = val[0],
do_duplicate = val[1],
on_input_p = val[2],
on_input_n = val[3],
output_p = val[4];
const I& input = exact(input_);
const N& nbh = exact(nbh_);
extension::adjust_fill(input, nbh, ext_value);
mln_concrete(I) output;
if (do_duplicate)
output = duplicate(input);
else
{
initialize(output, input);
data::fill(output, false);
}
mln_pixter(const I) p_in(input);
mln_pixter(I) p_out(output);
mln_nixter(const I, N) n(p_in, nbh);
for_all_2(p_in, p_out)
if (p_in.val() == on_input_p)
for_all(n)
if (n.val() == on_input_n)
p_out.val() = output_p;
trace::exiting("morpho::elementary::impl::like_ero_set_fastest");
return output;
}
} // end of namespace mln::morpho::elementary::impl
namespace internal
{
template <typename I, typename N>
mln_concrete(I)
like_ero_set_dispatch(metal::false_,
bool val[5],
const I& input, const N& nbh)
{
return impl::generic::like_ero_set(val, input, nbh);
}
template <typename I, typename N>
mln_concrete(I)
like_ero_set_dispatch(metal::true_,
bool val[5],
const I& input, const N& nbh)
{
return impl::like_ero_set_fastest(val, input, nbh);
}
template <typename I, typename N>
mln_concrete(I)
like_ero_set_dispatch(bool val[5],
const I& input, const N& nbh)
{
typedef mlc_equal(mln_trait_image_speed(I),
trait::image::speed::fastest) I_fastest;
typedef mln_window(N) W;
typedef mln_is_simple_window(W) N_simple;
return like_ero_set_dispatch(mlc_and(I_fastest, N_simple)(),
val, input, nbh);
}
} // end of namespace mln::morpho::elementary::internal
// Facade.
template <typename I, typename N>
mln_concrete(I)
like_ero_set(bool val[5],
const Image<I>& input, const Neighborhood<N>& nbh)
{
return internal::like_ero_set_dispatch(val, exact(input), exact(nbh));
}
# endif // ! MLN_INCLUDE_ONLY
} // end of namespace mln::morpho::elementary
} // end of namespace mln::morpho
} // end of namespace mln
#endif // ! MLN_MORPHO_ELEMENTARY_LIKE_ERO_SET_HH
| [
"trueg@kde.org"
] | trueg@kde.org |
4d349e02facef9e4e80e5564473413469f7dc353 | 9c890bf6be520da12216b26de4302ae3b0453f06 | /SimulationGroupDesktop/src/data/rule/voteaction.cpp | 34878f81a816cb3c08c0f85d3298dad4ac2e6fac | [] | no_license | drawepen/SimulationGroupDesktop | e323ce6c0176a09a011144782bcc0d47cf4af04a | 62fd8261e83aeb043f561ca66bcaf12115b2fd58 | refs/heads/main | 2023-06-11T18:57:08.906151 | 2021-07-01T13:19:03 | 2021-07-01T13:19:03 | 351,313,434 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 307 | cpp | #include "voteaction.h"
#include <cstdlib>
VoteAction::VoteAction()
{
}
void VoteAction::execute(Cell &cell,int nowTime){
int count=0;
for(Cell *nc:cell.neighbors){
if(nc->getState()==1){
++count;
}
}
cell.update( (rand()%cell.neighbors.size())<count?1:0 );
}
| [
"1924019307@qq.com"
] | 1924019307@qq.com |
e325ae39f5e7ddfffc5d287c45fbb4e74b8ff86d | 788da62dce9041878fd098e5347408fbf0679ace | /qcom/proprietary/wfd/wfdsm/src/UIBCAdaptor.cpp | 7f057323174939242f0c6088a5b7cfb980903479 | [] | no_license | Snapdragon-Computer-Vision-Engine-Team/msm8974-sources2 | e7daa0bf3096e09286fd6e9f3a4e078774e49565 | 8e8a1d7b8b840a7c93e39634d61614665974acb1 | refs/heads/master | 2021-12-15T03:28:26.619350 | 2017-07-25T06:50:38 | 2017-07-25T06:50:38 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,055 | cpp | /*==============================================================================
* @file UIBCAdaptor.cpp
*
* @par DESCRIPTION:
* Interface with Session Manager and UIBC service
*
*
* Copyright (c) 2012 - 2013 by Qualcomm Technologies, Inc. All Rights Reserved.
* Qualcomm Technologies Proprietary and Confidential.
==============================================================================*/
#include "UIBCAdaptor.h"
uibcDeviceType convSMtoUIBCDevtype(DeviceType dType)
{
switch (dType)
{
case SOURCE:
return UIBC_SOURCE;
case PRIMARY_SINK:
return UIBC_PRIMARY_SINK;
case SECONDARY_SINK:
return UIBC_SECONDARY_SINK;
case SOURCE_PRIMARY_SINK:
return UIBC_UNKNOWN;
default:
return UIBC_UNKNOWN;
}
}
DeviceType UIBCAdaptor::myDeviceType;
UIBCInterface* UIBCAdaptor::pUibcInterface;
wfd_uibc_attach_cb UIBCAdaptor::AttachVM;
wfd_uibc_send_event_cb UIBCAdaptor::SendEvent;
wfd_uibc_hid_event_cb UIBCAdaptor::sendHIDEvent;
bool UIBCAdaptor::bUIBCSessionValid;
wfd_uibc_capability_change_cb UIBCAdaptor::capChangeCB;
UIBCAdaptor::UIBCAdaptor()
{
bUIBCSessionValid = false;
//Do Nothing for now
}
UIBCAdaptor::~UIBCAdaptor()
{
//Do Nothing for now
}
void UIBCAdaptor::setDeviceType (DeviceType devType)
{
myDeviceType = devType;
}
void UIBCAdaptor::registerUIBCCallbacks (wfd_uibc_attach_cb Attach ,
wfd_uibc_send_event_cb Send,
wfd_uibc_hid_event_cb sendHID)
{
AttachVM = Attach;
SendEvent = Send;
sendHIDEvent = sendHID;
}
void UIBCAdaptor::createUibcInterface()
{
pUibcInterface = UIBCInterface::createInstance(convSMtoUIBCDevtype(myDeviceType));
}
void UIBCAdaptor::destroyUibcInterface()
{
if (pUibcInterface != NULL)
{
delete pUibcInterface;
pUibcInterface = NULL;
}
}
bool UIBCAdaptor::updateLocalUIBCCapability(WFD_uibc_capability_t* pUibcCapability)
{
if (pUibcInterface)
{
pUibcInterface->getUibcCapability(pUibcCapability);
return true;
}
return false;
}
bool UIBCAdaptor::getNegotiatedCapability(WFD_uibc_capability_t* pLocalUIBCCapability,
WFD_uibc_capability_t* pPeerUIBCCapability,
WFD_uibc_capability_t* pNegotiatedUIBCCapability)
{
if (pUibcInterface && pLocalUIBCCapability && pPeerUIBCCapability && pNegotiatedUIBCCapability)
{
if (pUibcInterface->getNegotiatedCapability(&(pLocalUIBCCapability->config),
&(pPeerUIBCCapability->config),
&(pNegotiatedUIBCCapability->config))
)
return true;
}
return false;
}
bool UIBCAdaptor::createSession(WFD_uibc_capability_t* pUibcCapability)
{
if (pUibcInterface)
{
if (pUibcInterface->createUIBCSession())
{
pUibcInterface->setUibcCapability(pUibcCapability, capChangeCB);
pUibcInterface->registerUibcCallback(AttachVM,SendEvent,sendHIDEvent);
bUIBCSessionValid = true;
return true;
}
}
return false;
}
bool UIBCAdaptor::destroySession()
{
if (pUibcInterface && bUIBCSessionValid)
{
bUIBCSessionValid = false;
if (pUibcInterface->destroyUIBCSession())
{
return true;
}
}
return false;
}
/**
* Function to start UIBC data path
*
* @return bool
*/
bool UIBCAdaptor::startUIBC()
{
//LOGD("UIBCAdaptor::startUIBC");
bool ret = false;
if (pUibcInterface)
{
ret = pUibcInterface->Enable();
return ret;
}
return ret;
}
/**
* Function to stop UIBC
*
* @return bool
*/
bool UIBCAdaptor::stopUIBC()
{
bool ret = false;
if (pUibcInterface)
{
ret = pUibcInterface->Disable();
return ret;
}
return ret;
}
bool UIBCAdaptor::sendUIBCEvent (WFD_uibc_event_t* event)
{
bool ret = false;
if (pUibcInterface)
{
ret = pUibcInterface->sendUIBCEvent(event);
}
return ret;
}
| [
"xinhe.jiang@itel-mobile.com"
] | xinhe.jiang@itel-mobile.com |
398eb53965a22cc9ab8c108bfbab5ee3e877ad09 | ad0eaeee6a89e87e23bc452f5bf1e36781dd08b2 | /image_signal/simple_image_signal_structures.h | ad577782676e11706902ec686e0c9f55df663240 | [] | no_license | DevJohan/SerialMon | dac6e5c8ba75f7c22a40aa277aa906bcd918519f | 4e38f9c5581c770fed0d39d45711d48518e302cf | refs/heads/master | 2021-01-16T18:56:44.352772 | 2015-09-12T23:28:39 | 2015-09-12T23:28:39 | 42,376,909 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,210 | h | /*
* simple_image_signalStructures.h
*
* Created on: 15 okt 2010
* Author: Johan
*/
#ifndef IMAGE_SIGNAL_STRUCTURES_H_
#define IMAGE_SIGNAL_STRUCTURES_H_
namespace _basic_image_signal {
template <typename T, bool is_const>
struct conditional_const{
typedef T type;
};
template <typename T>
struct conditional_const<T,true>{
typedef const T type;
};
template< typename T>
struct point2D{
typedef T data_type;
union{
T coords[2];
struct{
T x,y;
};
};
constexpr point2D( const data_type& _v ):x(_v),y(_v){}
constexpr point2D( const data_type& _x, const data_type& _y ):x(_x),y(_y){}
};
template < typename Ta, typename Tb >
auto operator+( const point2D<Ta>& p2d_a, const point2D<Tb>& p2d_b) -> point2D<decltype(p2d_a.x+p2d_b.x)>{
return { p2d_a.x + p2d_b.x, p2d_a.y + p2d_b.y };
}
template < typename Ta, typename Tb >
auto operator-( const point2D<Ta>& p2d_a, const point2D<Tb>& p2d_b) -> point2D<decltype(p2d_a.x-p2d_b.x)>{
return { p2d_a.x - p2d_b.x, p2d_a.y - p2d_b.y };
}
template < typename Ta, typename Ts >
auto operator*( const point2D<Ta>& p2d_a, const Ts& s) -> point2D<decltype( p2d_a.x * s )>{
return { p2d_a.x * s, p2d_a.y * s };
}
template < typename Ta, typename Ts >
auto operator*( const Ts& s, const point2D<Ta>& p2d_a) -> decltype( p2d_a * s ){
return p2d_a * s;
}
template < typename Tr, typename Ta >
point2D<Tr> round( const point2D<Ta>& p2d){
return point2D<Tr>( round(p2d.x), round(p2d.y) );
}
template <typename T>
class range{
public:
T min, max;
range(const T& mi, const T& ma):min(mi),max(ma){}
T lower_bound() const { return min; }
T upper_bound() const { return max; }
};
template <typename T>
inline std::ostream& operator << (std::ostream& os, range<T> r ){
return (os << "[" << r.min << "," << r.max << "]" );
}
struct image_area{
typedef int size_type;
typedef double position_type;
typedef range<position_type> range_type;
range_type range_x;
range_type range_y;
};
inline std::ostream& operator << (std::ostream& os, image_area ia ){
return (os << ia.range_x << ia.range_y );
}
}
#endif /* IMAGE_SIGNAL_STRUCTURES_H_ */
| [
"johankristensen@gmail.com"
] | johankristensen@gmail.com |
c9fad53494f644ffc4ccf1af96b41b66b64354c5 | 8b80ceec5e880059dedbb1b3f6a3c493aa2a4ac2 | /scene_logic_test/LoadTextureDlg.h | 071dded5651286f0f6a1f067a529b5a21f5bc3a0 | [] | no_license | maciejmroz/LiquidReality | ea4d98eeb1f80154aa9716bf7d82eb8979928921 | 941b85a90a8b4edf5a2bed58359be511e037c3cb | refs/heads/master | 2021-01-10T19:25:15.338520 | 2013-12-27T21:34:53 | 2013-12-27T21:34:53 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 565 | h | #pragma once
#include "afxwin.h"
// CLoadTextureDlg dialog
class CLoadTextureDlg : public CDialog
{
DECLARE_DYNAMIC(CLoadTextureDlg)
public:
CLoadTextureDlg(CWnd* pParent = NULL); // standard constructor
virtual ~CLoadTextureDlg();
// Dialog Data
enum { IDD = IDD_LOAD_TEXTURE_DIALOG };
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
DECLARE_MESSAGE_MAP()
public:
CString m_cstrTextureName;
CListBox m_ctrlTextureList;
virtual BOOL OnInitDialog();
protected:
virtual void OnOK();
};
| [
"maciej.mroz@gmail.com"
] | maciej.mroz@gmail.com |
af19b79276ef0ec0edf0bac3acc4137fd7b36fc5 | 3348c85d60f8aa01b77d46d0f6a938d102bd2132 | /bno055/IMU.h | 820e3c90ceb8cb298aa5c47b0be344b2be0ecc36 | [] | no_license | elektrowolle/imu | 6fe0fa636e5d89a3dec729ae435381dbdee2583f | fc0b23342b9967f5b5a35052a847021098e861f9 | refs/heads/master | 2021-01-11T00:05:11.751742 | 2019-04-03T14:19:45 | 2019-04-03T14:19:45 | 70,571,618 | 1 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 35,727 | h | //
// Created by Benjamin Skirlo on 29.09.16.
//
#ifndef IMU_IMU_H
#define IMU_IMU_H
/****************************************************************************
* Copyright (C) 2011 - 2014 Bosch Sensortec GmbH
*
* NAxisMotion.h
* Date: 2015/02/10
* Revision: 3.0 $
*
* Usage: Header file of the C++ Wrapper for the BNO055 Sensor API
*
****************************************************************************
*
* Added Arduino M0/M0 Pro support
*
* Date: 07/27/2015
*
* Modified by: Arduino.org development Team.
*
****************************************************************************
/***************************************************************************
* License:
*
* 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 copyright holder nor the names of the
* 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 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
*
* The information provided is believed to be accurate and reliable.
* The copyright holder assumes no responsibility for the consequences of use
* of such information nor for any infringement of patents or
* other rights of third parties which may result from its use.
* No license is granted by implication or otherwise under any patent or
* patent rights of the copyright holder.
*/
#ifndef __NAXISMOTION_H__
#define __NAXISMOTION_H__
//extern "C" {
#include <BNO055_driver/bno055.h>
//}
#include "mbed.h"
typedef char byte;
//Custom Data structures
//Structure to hold the calibration status
struct bno055_calib_stat_t {
uint8_t accel; //Calibration Status of the accelerometer
uint8_t mag; //Calibration Status of the magnetometer
uint8_t gyro; //Calibration Status of the gyroscope
uint8_t system; //Calibration Status of the overall system
};
//Structure to hold the accelerometer configurations
struct bno055_accel_stat_t {
uint8_t range; //Range: 2G - 16G
uint8_t bandwidth; //Bandwidth: 7.81Hz - 1000Hz
uint8_t powerMode; //Power mode: Normal - Deep suspend
};
typedef unsigned int u_32;
class NAxisMotion {
private:
///Constants
//GPIO pins used for controlling the Sensor
const static PinName RESET_PIN = D4; //GPIO to reset the BNO055 (RESET pin has to be HIGH for the BNO055 to operate)
const static PinName INT_PIN = D2;
InterruptIn intPin;
DigitalOut resetPin;
///Values
bool dataUpdateMode; //Variable to store the mode of updating data
struct bno055_t myBNO; //Structure that stores the device information
struct bno055_accel_t accelData; //Structure that holds the accelerometer data
struct bno055_accel_float_t accelDataF; //Structure that holds the accelerometer data
struct bno055_mag_float_t magData; //Structure that holds the magnetometer data
struct bno055_gyro_float_t gyroData; //Structure that holds the gyroscope data
struct bno055_quaternion_t quatData; //Structure that holds the quaternion data
struct bno055_euler_float_t eulerData; //Structure that holds the euler data
struct bno055_linear_accel_float_t linearAccelData; //Structure that holds the linear acceleration data
struct bno055_gravity_float_t gravAccelData; //Structure that holds the gravity acceleration data
struct bno055_calib_stat_t calibStatus; //Structure to hold the calibration status
struct bno055_accel_stat_t accelStatus; //Structure to hold the status of the accelerometer configurations
public:
///Constants
const static int ENABLE = 1; //For use in function parameters
const static int DISABLE = 0; //For use in function parameters
const static int NO_MOTION = 1; //Enables the no motion interrupt
const static int SLOW_MOTION = 0; //Enables the slow motion interrupt
const static int ANDROID = 1; //To set the Output Data Format to Android style
const static int INIT_PERIOD = 600; //Initialization period set to 600ms
const static int RESET_PERIOD = 300; //Reset period set to 300ms
const static int POST_INIT_PERIOD = 50; //Post initialization delay of 50ms
const static int MANUAL = 1; //To manually call the update data functions
const static int AUTO = 0; //To automatically call the update data functions
static I2C * i2c;
//Function Declarations
/*******************************************************************************************
*Description: Constructor of the class with the default initialization
*Input Parameters: None
*Return Parameter: None
*******************************************************************************************/
// NAxisMotion();
NAxisMotion(
I2C _i2C,
PinName _resetPin = RESET_PIN,
InterruptIn _intPin = INT_PIN
);
/*******************************************************************************************
*Description: Function with the bare minimum initialization
*Input Parameters: None
*Return Parameter: None
*******************************************************************************************/
void initSensor(unsigned int address = 0x28 << 1);
/*******************************************************************************************
*Description: This function is used to reset the BNO055
*Input Parameters: None
*Return Parameter: None
*******************************************************************************************/
void resetSensor(unsigned int address);
/*******************************************************************************************
*Description: This function is used to set the operation mode of the BNO055
*Input Parameters:
* byte operationMode: To assign which operation mode the device has to
* ---------------------------------------------------
* Constant Definition Constant Value Comment
* ---------------------------------------------------
* OPERATION_MODE_CONFIG 0x00 Configuration Mode
* (Transient Mode)
* OPERATION_MODE_ACCONLY 0x01 Accelerometer only
* OPERATION_MODE_MAGONLY 0x02 Magnetometer only
* OPERATION_MODE_GYRONLY 0x03 Gyroscope only
* OPERATION_MODE_ACCMAG 0x04 Accelerometer and Magnetometer only
* OPERATION_MODE_ACCGYRO 0x05 Accelerometer and Gyroscope only
* OPERATION_MODE_MAGGYRO 0x06 Magnetometer and Gyroscope only
* OPERATION_MODE_AMG 0x07 Accelerometer, Magnetometer and
* Gyroscope (without fusion)
* OPERATION_MODE_IMUPLUS 0x08 Inertial Measurement Unit
* (Accelerometer and Gyroscope
* Sensor Fusion Mode)
* OPERATION_MODE_COMPASS 0x09 Tilt Compensated Compass
* (Accelerometer and Magnetometer
* Sensor Fusion Mode)
* OPERATION_MODE_M4G 0x0A Magnetometer and Accelerometer Sensor
* Fusion Mode
* OPERATION_MODE_NDOF_FMC_OFF 0x0B 9 Degrees of Freedom Sensor Fusion
* with Fast Magnetometer Calibration Off
* OPERATION_MODE_NDOF 0x0C 9 Degrees of Freedom Sensor Fusion
*Return Parameter: None
*******************************************************************************************/
void setOperationMode(byte operationMode);
/*******************************************************************************************
*Description: This function is used to set the power mode
*Input Parameters:
* byte powerMode: To assign the power mode the device has to switch to
* --------------------------------------
* Constant Definition Constant Value
* --------------------------------------
* POWER_MODE_NORMAL 0x00
* POWER_MODE_LOWPOWER 0x01
* POWER_MODE_SUSPEND 0x02
*Return Parameter:
*******************************************************************************************/
void setPowerMode(byte powerMode);
/*******************************************************************************************
*Description: This function is used to update the accelerometer data in m/s2
*Input Parameters: None
*Return Parameter: None
*******************************************************************************************/
void updateAccel(void);
/*******************************************************************************************
*Description: This function is used to update the magnetometer data in microTesla
*Input Parameters: None
*Return Parameter: None
*******************************************************************************************/
void updateMag(void);
/*******************************************************************************************
*Description: This function is used to update the gyroscope data in deg/s
*Input Parameters: None
*Return Parameter: None
*******************************************************************************************/
void updateGyro(void);
/*******************************************************************************************
*Description: This function is used to update the quaternion data
*Input Parameters: None
*Return Parameter: None
*******************************************************************************************/
void updateQuat(void);
/*******************************************************************************************
*Description: This function is used to update the euler data
*Input Parameters: None
*Return Parameter: None
*******************************************************************************************/
void updateEuler(void);
/*******************************************************************************************
*Description: This function is used to update the linear acceleration data in m/s2
*Input Parameters: None
*Return Parameter: None
*******************************************************************************************/
void updateLinearAccel(void);
/*******************************************************************************************
*Description: This function is used to update the gravity acceleration data in m/s2
*Input Parameters: None
*Return Parameter: None
*******************************************************************************************/
void updateGravAccel(void);
/*******************************************************************************************
*Description: This function is used to update the calibration status
*Input Parameters: None
*Return Parameter: None
*******************************************************************************************/
void updateCalibStatus(void);
/*******************************************************************************************
*Description: This function is used to write the accelerometer configurations
*Input Parameters:
* uint8_t range: To assign the range of the accelerometer
* --------------------------------------
* Constant Definition Constant Value
* --------------------------------------
* ACCEL_RANGE_2G 0X00
* ACCEL_RANGE_4G 0X01
* ACCEL_RANGE_8G 0X02
* ACCEL_RANGE_16G 0X03
* uint8_t bandwidth: To assign the filter bandwidth of the accelerometer
* --------------------------------------
* Constant Definition Constant Value
* --------------------------------------
* ACCEL_BW_7_81HZ 0x00
* ACCEL_BW_15_63HZ 0x01
* ACCEL_BW_31_25HZ 0x02
* ACCEL_BW_62_5HZ 0X03
* ACCEL_BW_125HZ 0X04
* ACCEL_BW_250HZ 0X05
* ACCEL_BW_500HZ 0X06
* ACCEL_BW_1000HZ 0X07
* uint8_t powerMode: To assign the power mode of the accelerometer
* --------------------------------------
* Constant Definition Constant Value
* --------------------------------------
* ACCEL_NORMAL 0X00
* ACCEL_SUSPEND 0X01
* ACCEL_LOWPOWER_1 0X02
* ACCEL_STANDBY 0X03
* ACCEL_LOWPOWER_2 0X04
* ACCEL_DEEPSUSPEND 0X05
*Return Parameter: None
*******************************************************************************************/
void writeAccelConfig(uint8_t range, uint8_t bandwidth, uint8_t powerMode);
/*******************************************************************************************
*Description: This function is used to update the accelerometer configurations
*Input Parameters: None
*Return Parameter: None
*******************************************************************************************/
void updateAccelConfig(void);
/*******************************************************************************************
*Description: This function is used to control which axis of the accelerometer triggers the
* interrupt
*Input Parameters:
* bool xStatus: To know whether the x axis has to trigger the interrupt
* ---------------------------------------------------
* Constant Definition Constant Value Comment
* ---------------------------------------------------
* ENABLE 1 Enables interrupts from that axis
* DISABLE 0 Disables interrupts from that axis
* bool yStatus: To know whether the x axis has to trigger the interrupt
* ---------------------------------------------------
* Constant Definition Constant Value Comment
* ---------------------------------------------------
* ENABLE 1 Enables interrupts from that axis
* DISABLE 0 Disables interrupts from that axis
* bool zStatus: To know whether the x axis has to trigger the interrupt
* ---------------------------------------------------
* Constant Definition Constant Value Comment
* ---------------------------------------------------
* ENABLE 1 Enables interrupts from that axis
* DISABLE 0 Disables interrupts from that axis
*Return Parameter: None
*******************************************************************************************/
void accelInterrupts(bool xStatus, bool yStatus, bool zStatus);
/*******************************************************************************************
*Description: This function is used to reset the interrupt line
*Input Parameters: None
*Return Parameter: None
*******************************************************************************************/
void resetInterrupt(void);
/*******************************************************************************************
*Description: This function is used to enable the any motion interrupt based on the
* accelerometer
*Input Parameters:
* uint8_t threshold: The threshold that triggers the any motion interrupt
* The threshold should be entered as an integer. The corresponding value of
* the threshold depends on the range that has been set on the
* accelerometer. Below is a table showing the value of 1LSB in
* corresponding units.
* Resolution:
* ACCEL_RANGE_2G, 1LSB = 3.91mg = ~0.03835m/s2
* ACCEL_RANGE_4G, 1LSB = 7.81mg = ~0.07661m/s2
* ACCEL_RANGE_8G, 1LSB = 15.6mg = ~0.15303m/s2
* ACCEL_RANGE_16G, 1LSB = 31.3mg = ~0.30705m/s2
* Maximum:
* ACCEL_RANGE_2G, 1LSB = 996mg = ~9.77076m/s2,
* ACCEL_RANGE_4G, 1LSB = 1.99g = ~19.5219m/s2
* ACCEL_RANGE_8G, 1LSB = 3.98g = ~39.0438m/s2
* ACCEL_RANGE_16G, 1LSB = 7.97g = ~97.1857m/s2
* uint8_t duration: The duration for which the desired threshold exist
* The time difference between the successive acceleration signals depends
* on the selected bandwidth and equates to 1/(2*bandwidth).
* In order to suppress false triggers, the interrupt is only generated (cleared)
* if a certain number N of consecutive slope data points is larger (smaller)
* than the slope 'threshold'. This number is set by the 'duration'.
* It is N = duration + 1.
* Resolution:
* ACCEL_BW_7_81HZ, 1LSB = 64ms
* ACCEL_BW_15_63HZ, 1LSB = 32ms
* ACCEL_BW_31_25HZ, 1LSB = 16ms
* ACCEL_BW_62_5HZ, 1LSB = 8ms
* ACCEL_BW_125HZ, 1LSB = 4ms
* ACCEL_BW_250HZ, 1LSB = 2ms
* ACCEL_BW_500HZ, 1LSB = 1ms
* ACCEL_BW_1000HZ, 1LSB = 0.5ms
*Return Parameter: None
*******************************************************************************************/
void enableAnyMotion(uint8_t threshold, uint8_t duration);
/*******************************************************************************************
*Description: This function is used to disable the any motion interrupt
*Input Parameters: None
*Return Parameter: None
*******************************************************************************************/
void disableAnyMotion(void);
/*******************************************************************************************
*Description: This function is used to enable the slow or no motion interrupt based on the
* accelerometer
*Input Parameters:
* uint8_t threshold: The threshold that triggers the no motion interrupt
* The threshold should be entered as an integer. The corresponding value of
* the threshold depends on the range that has been set on the
* accelerometer. Below is a table showing the value of 1LSB in
* corresponding units.
* Resolution:
* ACCEL_RANGE_2G, 1LSB = 3.91mg = ~0.03835m/s2
* ACCEL_RANGE_4G, 1LSB = 7.81mg = ~0.07661m/s2
* ACCEL_RANGE_8G, 1LSB = 15.6mg = ~0.15303m/s2
* ACCEL_RANGE_16G, 1LSB = 31.3mg = ~0.30705m/s2
* Maximum:
* ACCEL_RANGE_2G, 1LSB = 996mg = ~9.77076m/s2,
* ACCEL_RANGE_4G, 1LSB = 1.99g = ~19.5219m/s2
* ACCEL_RANGE_8G, 1LSB = 3.98g = ~39.0438m/s2
* ACCEL_RANGE_16G, 1LSB = 7.97g = ~97.1857m/s2
* uint8_t duration: The duration for which the desired threshold should be surpassed
* The time difference between the successive acceleration signals depends
* on the selected bandwidth and equates to 1/(2*bandwidth).
* In order to suppress false triggers, the interrupt is only generated (cleared)
* if a certain number N of consecutive slope data points is larger (smaller)
* than the slope 'threshold'. This number is set by the 'duration'.
* It is N = duration + 1.
* Resolution:
* ACCEL_BW_7_81HZ, 1LSB = 64ms
* ACCEL_BW_15_63HZ, 1LSB = 32ms
* ACCEL_BW_31_25HZ, 1LSB = 16ms
* ACCEL_BW_62_5HZ, 1LSB = 8ms
* ACCEL_BW_125HZ, 1LSB = 4ms
* ACCEL_BW_250HZ, 1LSB = 2ms
* ACCEL_BW_500HZ, 1LSB = 1ms
* ACCEL_BW_1000HZ, 1LSB = 0.5ms
* bool motion: To trigger either a Slow motion or a No motion interrupt
* ---------------------------------------------------
* Constant Definition Constant Value Comment
* ---------------------------------------------------
* NO_MOTION 1 Enables the no motion interrupt
* SLOW_MOTION 0 Enables the slow motion interrupt
*Return Parameter: None
*******************************************************************************************/
void enableSlowNoMotion(uint8_t threshold, uint8_t duration, bool motion);
/*******************************************************************************************
*Description: This function is used to disable the slow or no motion interrupt
*Input Parameters: None
*Return Parameter: None
*******************************************************************************************/
void disableSlowNoMotion(void);
/*******************************************************************************************
*Description: This function is used to change the mode of updating the local data
*Input Parameters: None
*Return Parameter: None
*******************************************************************************************/
void setUpdateMode(bool updateMode);
/*******************************************************************************************
*Description: This function is used to return the x-axis of the accelerometer data
*Input Parameters: None
*Return Parameter:
* float: X-axis accelerometer data in m/s2
*******************************************************************************************/
float readAccelX(void);
/*******************************************************************************************
*Description: This function is used to return the y-axis of the accelerometer data
*Input Parameters: None
*Return Parameter:
* float: Y-axis accelerometer data in m/s2
*******************************************************************************************/
float readAccelY(void);
/*******************************************************************************************
*Description: This function is used to return the z-axis of the accelerometer data
*Input Parameters: None
*Return Parameter:
* float: Z-axis accelerometer data in m/s2
*******************************************************************************************/
float readAccelZ(void);
/*******************************************************************************************
*Description: This function is used to return the x-axis of the gyroscope data
*Input Parameters: None
*Return Parameter:
* float: X-axis gyroscope data in deg/s
*******************************************************************************************/
float readGyroX(void);
/*******************************************************************************************
*Description: This function is used to return the y-axis of the gyroscope data
*Input Parameters: None
*Return Parameter:
* float: Y-axis gyroscope data in deg/s
*******************************************************************************************/
float readGyroY(void);
/*******************************************************************************************
*Description: This function is used to return the z-axis of the gyroscope data
*Input Parameters: None
*Return Parameter:
* float: Z-axis gyroscope data in deg/s
*******************************************************************************************/
float readGyroZ(void);
/*******************************************************************************************
*Description: This function is used to return the x-axis of the magnetometer data
*Input Parameters: None
*Return Parameter:
* float: X-axis magnetometer data in �T
*******************************************************************************************/
float readMagX(void);
/*******************************************************************************************
*Description: This function is used to return the y-axis of the magnetometer data
*Input Parameters: None
*Return Parameter:
* float: Y-axis magnetometer data in �T
*******************************************************************************************/
float readMagY(void);
/*******************************************************************************************
*Description: This function is used to return the z-axis of the magnetometer data
*Input Parameters: None
*Return Parameter:
* float: Z-axis magnetometer data in �T
*******************************************************************************************/
float readMagZ(void);
/*******************************************************************************************
*Description: This function is used to return the w-axis of the quaternion data
*Input Parameters: None
*Return Parameter:
* int16_t: W-axis quaternion data multiplied by 1000 (for 3 decimal places accuracy)
*******************************************************************************************/
int16_t readQuatW(void);
/*******************************************************************************************
*Description: This function is used to return the x-axis of the quaternion data
*Input Parameters: None
*Return Parameter:
* int16_t: X-axis quaternion data multiplied by 1000 (for 3 decimal places accuracy)
*******************************************************************************************/
int16_t readQuatX(void);
/*******************************************************************************************
*Description: This function is used to return the y-axis of the quaternion data
*Input Parameters: None
*Return Parameter:
* int16_t: Y-axis quaternion data multiplied by 1000 (for 3 decimal places accuracy)
*******************************************************************************************/
int16_t readQuatY(void);
/*******************************************************************************************
*Description: This function is used to return the z-axis of the quaternion data
*Input Parameters: None
*Return Parameter:
* int16_t: Z-axis quaternion data multiplied by 1000 (for 3 decimal places accuracy)
*******************************************************************************************/
int16_t readQuatZ(void);
/*******************************************************************************************
*Description: This function is used to return the heading(yaw) of the euler data
*Input Parameters: None
*Return Parameter:
* float: Heading of the euler data
*******************************************************************************************/
float readEulerHeading(void);
/*******************************************************************************************
*Description: This function is used to return the roll of the euler data
*Input Parameters: None
*Return Parameter:
* float: Roll of the euler data
*******************************************************************************************/
float readEulerRoll(void);
/*******************************************************************************************
*Description: This function is used to return the pitch of the euler data
*Input Parameters: None
*Return Parameter:
* float: Pitch of the euler data
*******************************************************************************************/
float readEulerPitch(void);
/*******************************************************************************************
*Description: This function is used to return the x-axis of the linear acceleration data
* (accelerometer data without the gravity vector)
*Input Parameters: None
*Return Parameter:
* float: X-axis Linear Acceleration data in m/s2
*******************************************************************************************/
float readLinearAccelX(void);
/*******************************************************************************************
*Description: This function is used to return the y-axis of the linear acceleration data
* (accelerometer data without the gravity vector)
*Input Parameters: None
*Return Parameter:
* float: Y-axis Linear Acceleration data in m/s2
*******************************************************************************************/
float readLinearAccelY(void);
/*******************************************************************************************
*Description: This function is used to return the z-axis of the linear acceleration data
* (accelerometer data without the gravity vector)
*Input Parameters: None
*Return Parameter:
* float: Z-axis Linear Acceleration data in m/s2
*******************************************************************************************/
float readLinearAccelZ(void);
/*******************************************************************************************
*Description: This function is used to return the x-axis of the gravity acceleration data
* (accelerometer data with only the gravity vector)
*Input Parameters: None
*Return Parameter:
* float: X-axis Gravity Acceleration data in m/s2
*******************************************************************************************/
float readGravAccelX(void);
/*******************************************************************************************
*Description: This function is used to return the y-axis of the gravity acceleration data
* (accelerometer data with only the gravity vector)
*Input Parameters: None
*Return Parameter:
* float: Y-axis Gravity Acceleration data in m/s2
*******************************************************************************************/
float readGravAccelY(void);
/*******************************************************************************************
*Description: This function is used to return the z-axis of the gravity acceleration data
* (accelerometer data with only the gravity vector)
*Input Parameters: None
*Return Parameter:
* float: Z-axis Gravity Acceleration data in m/s2
*******************************************************************************************/
float readGravAccelZ(void);
/*******************************************************************************************
*Description: This function is used to return the accelerometer calibration status
*Input Parameters: None
*Return Parameter:
* uint8_t: Accelerometer calibration status, 0-3 (0 - low, 3 - high)
*******************************************************************************************/
uint8_t readAccelCalibStatus(void);
/*******************************************************************************************
*Description: This function is used to return the gyroscope calibration status
*Input Parameters: None
*Return Parameter:
* uint8_t: Gyroscope calibration status, 0-3 (0 - low, 3 - high)
*******************************************************************************************/
uint8_t readGyroCalibStatus(void);
/*******************************************************************************************
*Description: This function is used to return the magnetometer calibration status
*Input Parameters: None
*Return Parameter:
* uint8_t: Magnetometer calibration status, 0-3 (0 - low, 3 - high)
*******************************************************************************************/
uint8_t readMagCalibStatus(void);
/*******************************************************************************************
*Description: This function is used to return the system calibration status
*Input Parameters: None
*Return Parameter:
* uint8_t: System calibration status, 0-3 (0 - low, 3 - high)
*******************************************************************************************/
uint8_t readSystemCalibStatus(void);
/*******************************************************************************************
*Description: This function is used to return the accelerometer range
*Input Parameters: None
*Return Parameter:
* uint8_t range: Range of the accelerometer
* --------------------------------------
* Constant Definition Constant Value
* --------------------------------------
* ACCEL_RANGE_2G 0X00
* ACCEL_RANGE_4G 0X01
* ACCEL_RANGE_8G 0X02
* ACCEL_RANGE_16G 0X03
*******************************************************************************************/
uint8_t readAccelRange(void);
/*******************************************************************************************
*Description: This function is used to return the accelerometer bandwidth
*Input Parameters: None
*Return Parameter:
* uint8_t bandwidth: Bandwidth of the accelerometer
* --------------------------------------
* Constant Definition Constant Value
* --------------------------------------
* ACCEL_BW_7_81HZ 0x00
* ACCEL_BW_15_63HZ 0x01
* ACCEL_BW_31_25HZ 0x02
* ACCEL_BW_62_5HZ 0X03
* ACCEL_BW_125HZ 0X04
* ACCEL_BW_250HZ 0X05
* ACCEL_BW_500HZ 0X06
* ACCEL_BW_1000HZ 0X07
*******************************************************************************************/
uint8_t readAccelBandwidth(void);
/*******************************************************************************************
*Description: This function is used to return the accelerometer power mode
*Input Parameters: None
*Return Parameter:
* uint8_t powerMode: Power mode of the accelerometer
* --------------------------------------
* Constant Definition Constant Value
* --------------------------------------
* ACCEL_NORMAL 0X00
* ACCEL_SUSPEND 0X01
* ACCEL_LOWPOWER_1 0X02
* ACCEL_STANDBY 0X03
* ACCEL_LOWPOWER_2 0X04
* ACCEL_DEEPSUSPEND 0X05
*******************************************************************************************/
uint8_t readAccelPowerMode(void);
};
/******************** Bridge Functions for the Sensor API to control the Arduino Hardware******************************************/
int BNO055_I2C_bus_writechar(int address, char location, char value);
int BNO055_I2C_bus_setpage(int address, char value);
signed char BNO055_I2C_bus_read(unsigned char,unsigned char, unsigned char*, unsigned char);
signed char BNO055_I2C_bus_write(unsigned char ,unsigned char , unsigned char* , unsigned char );
void _delay(u_32);
#endif __NAXISMOTION_H__
#endif //IMU_IMU_H
| [
"benjamin.skirlo@ixds.com"
] | benjamin.skirlo@ixds.com |
6543d1ae8052ff2435db9ead4a28e5de6bef2d8a | 61af69c5902cb4a8fd08390ca8718af79d2da58d | /include/storage/seep.h | 0a95f0cf10e666be532f544d4e1a0110031700b8 | [
"MIT"
] | permissive | IOsonata/IOsonata | 8f2e0b86a76915a33a11db0a7df7fdb46d8ce55a | e0a599e1a5a186b7295b29484d45988177927983 | refs/heads/master | 2023-08-18T05:32:31.240144 | 2023-08-18T04:38:31 | 2023-08-18T04:38:31 | 199,128,085 | 61 | 20 | MIT | 2020-11-16T08:09:54 | 2019-07-27T06:50:46 | C | UTF-8 | C++ | false | false | 10,526 | h | /**-------------------------------------------------------------------------
@file seep.h
@brief Generic implementation of Serial EEPROM device
This implementation supports most Serial EEPROM.
- Automatic memory block selections
- Multi-bytes memory address length
There is no need to write code for each type of EEPROM. Just fill EEPROM
information in the SEEP_CFG data structure then pass it to the init function.
Example of defining EEPROM info :
-----
CAT24C32 : 32Kbits, 2 byte address length, 32 bytes per page, Write delays 5 ms
static const SEEP_CFG s_CAT24C02EepCfg = {
0x50, // Device address
2, // Address length
32, // Page size
32 * 1024 / 8, // Total size in bytes
5, // Twr : 5 ms
};
-----
CAT24C02 : 2Kbits, 1 byte address length, 16 bytes per page, Write delays 5 ms
static const SEEP_CFG s_CAT24C02EepCfg = {
0x50, // Device address
1, // Address length
16, // Page size
2048 / 8, // Total size in bytes
5, // Twr : 5 ms
};
-----
M24C64S : 64Kbits, 2 bytes address length, 32 bytes per page, Write delays 5 ms
static const SEEP_CFG s_M24C64SEepCfg = {
0x50, // Device address
2, // Address length
32, // Page size
64 * 1024 / 8, // Total size in bytes
5, // Twr : 5 ms
};
-----
AT24CS08 : 8Kbits, 1 byte address length, 16 bytes per page, write delays 5 ms
static const SEEP_CFG s_AT24CS08EepCfg = {
0x50, // Device address
1, // Address length
16, // Page size
1024, // Total size in bytes
5, // Twr : 5 ms
};
-----
24AA08/24LC08B : 8Kbits, 1 byte address length, 16 bytes per page, write delays 3 ms
static const SEEP_CFG s_AT24CS08EepCfg = {
0x50, // Device address
1, // Address length
16, // Page size
1024, // Total size in bytes
3, // Twr : 3 ms
};
----
Usage in C++ :
// I2C interface instance to be used. Assuming it is already initialized.
I2C g_I2C;
// Declare instance
Seep g_Seep;
// Initialize
g_Seep.Init(s_AT24CS08EepCfg, &g_I2C);
// Read/Write
uint8_t buff[40];
g_Seep.Write(0x100, buff, 40); // Write 40 bytes at address 0x100
g_Seep.Read(0x10, buff, 40); // Read 40 bytes from address 0x10
-----
Usage in C :
// I2C interface instance to be used. Assuming it is already initialized.
I2CDEV g_I2CDev;
// Declare instance
SEEPDEV g_SeepDev;
// Initialize
SeepInit(&g_SeepDev, &s_AT24CS08EepCfg, &g_I2CDev->DevIntrf);
// Read/Write
uint8_t buff[40];
SeepWrite(&g_SeepDev, 0x100, buff, 40); // Write 40 bytes at address 0x100
SeepRead(&g_SeepDev, 0x10, buff, 40); // Read 40 bytes from address 0x10
@author Hoang Nguyen Hoan
@date Sep. 15, 2011
@license
MIT license
Copyright (c) 2011, I-SYST, all rights reserved
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
----------------------------------------------------------------------------*/
#ifndef __SEEP_H__
#define __SEEP_H__
#include <stdbool.h>
#include "device_intrf.h"
#include "coredev/iopincfg.h"
/** @addtogroup Storage
* @{
*/
#pragma pack(push,4)
/**
* @brief SEEP callback function
*
* This is a general callback function hook for special purpose defined in SEEP_CFG
*
* @param DevAddr : Device address.
* @param pInterf : Pointer to physical interface connected to the device
*
* @return true - success
*/
typedef bool (*SEEPCB)(int DevAddr, DevIntrf_t * const pInterf);
/// Structure defining Serial EEPROM device
typedef struct __Seep_Config {
uint8_t DevAddr; //<! Device address
uint8_t AddrLen; //<! Serial EEPROM memory address length in bytes
uint16_t PageSize; //<! Wrap around page size in bytes
uint32_t Size; //<! Total EEPROM size in bytes
uint32_t WrDelay; //<! Write delay time in msec
IOPinCfg_t WrProtPin; //<! if Write protect pin is not used, set {-1, -1, }
//<! This pin is assumed active high,
//<! ie. Set to 1 to enable Write Protect
SEEPCB pInitCB; //<! For custom initialization. Set to NULL if not used
SEEPCB pWaitCB; //<! If provided, this is called when there are long delays
//<! for a device to complete its write cycle
//<! This is to allow application to perform other tasks
//<! while waiting. Set to NULL is not used
} SeepCfg_t;
typedef SeepCfg_t EpromCfg_t;
/// @brief Device internal data.
///
/// Pointer to this structure serve as handle to the implementation function
typedef struct __Seep_Device {
uint8_t DevAddr; //<! Device address
uint8_t AddrLen; //<! Serial EEPROM memory address length in bytes
uint16_t PageSize; //<! Wrap around page size
uint32_t Size; //<! Total EEPROM size in bytes
uint32_t WrDelay; //<! Write delay in usec
IOPinCfg_t WrProtPin; //<! Write protect I/O pin
DevIntrf_t *pInterf; //<! Device interface
SEEPCB pWaitCB; //<! If provided, this is called when there are long delays
//<! for a device to complete its write cycle
//<! This is to allow application to perform other tasks
//<! while waiting. Set to NULL is not used
} SeepDev_t;
typedef SeepDev_t EpromDev_t;
#pragma pack(pop)
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief Initialize Serial EEPROM driver.
*
* @param pDev : Pointer to driver data to be initialized
* @param pCfgData : Pointer to serial EEPROM configuration data
* @param pInterf : Pointer to the interface device on which the SEEPROM
* is connected to
*
* @return true - initialization successful
*/
bool SeepInit(SeepDev_t * const pDev, const SeepCfg_t *pCfgData, DevIntrf_t * const pInterf);
/**
* @brief Get EEPROM size.
*
* @param pDev : Pointer to driver data
*
* @return Total size in bytes
*/
static inline uint32_t SeepGetSize(SeepDev_t * const pDev) {
return pDev ? pDev->Size : 0;
}
/**
* @brief Get EEPROM page size.
*
* @param pDev : Pointer to driver data
*
* @return Page size in bytes
*/
static inline uint16_t SeepGetPageSize(SeepDev_t * const pDev) {
return pDev? pDev->PageSize : 0;
}
/**
* @brief Read Serial EEPROM data.
*
* @param pDev : Pointer to driver data
* @param Address : Memory address to read
* @param pBuff : Pointer to buffer to receive data
* @param Len : Size of the buffer in bytes
*
* @return Number of bytes read
*/
int SeepRead(SeepDev_t * const pDev, uint32_t Addr, uint8_t *pBuff, int Len);
/**
* @brief Write to data to Serial EEPROM.
*
* @param pDev : Pointer to driver data
* @param Address : Memory address to write
* @param pData : Pointer to data to write
* @param Len : Number of bytes to write
*
* @return Number of bytes written
*/
int SeepWrite(SeepDev_t * const pDev, uint32_t Addr, uint8_t *pData, int Len);
/**
* @brief Set the write protect pin.
*
* @param pDev : Pointer to driver data
* @param bVal : true - Enable write protect
* false - Disable write protect
*/
void SeepSetWriteProt(SeepDev_t * const pDev, bool bVal);
#ifdef __cplusplus
}
/// @brief Generic Serial EEPROM implementation class
///
/// The thing to know about an EEPROM is its device address and its page size
/// Set those parameters in the SEEP_CFG data structure to initialize this class
class Seep {
public:
Seep();
virtual ~Seep();
Seep(Seep&); // copy ctor not allowed
/**
* @brief Initialize Serial EEPROM driver.
*
* @param pCfgData : Pointer to serial EEPROM configuration data
* @param pInterf : Pointer to the interface device on which the SEEPROM
* is connected to
*
* @return true - initialization successful
*/
virtual bool Init(const SeepCfg_t &Cfg, DeviceIntrf * const pInterf) {
return SeepInit(&vDevData, &Cfg, *pInterf);
}
/**
* @brief Read Serial EEPROM data.
*
* @param Address : Memory address to read
* @param pBuff : Pointer to buffer to receive data
* @param Len : Size of the buffer in bytes
*
* @return Number of bytes read
*/
virtual int Read(uint32_t Addr, uint8_t *pBuff, int Len) { return SeepRead(&vDevData, Addr, pBuff, Len); }
/**
* @brief Write to data to Serial EEPROM.
*
* @param Address : Memory address to write
* @param pData : Pointer to data to write
* @param Len : Number of bytes to write
*
* @return Number of bytes written
*/
virtual int Write(uint32_t Addr, uint8_t *pData, int Len) { return SeepWrite(&vDevData, Addr, pData, Len); }
/**
* @brief Get EEPROM size.
*
* @return Total size in bytes
*/
uint32_t GetSize() { return vDevData.Size; }
/**
* @brief Get EEPROM page size
*
* @return Page size in bytes
*/
uint16_t GetPageSize() { return vDevData.PageSize; }
/**
* @brief Conversion to SEEPDEV operator.
*
* This operator convert SEEP class to SEEPDEV to be used in C function calls
*
* @return Pointer to internal SEEPDEV data.
*/
operator SeepDev_t* const () { return &vDevData; }
protected:
SeepDev_t vDevData; //!< Device address.
};
#endif
/** @} End of group Storage */
#endif // __SEEP_H__
| [
"hnhoan@i-syst.com"
] | hnhoan@i-syst.com |
d6e8961c65674cccc83ce429d57c6bc6f483bd42 | fe73b179108ab6c0b5eed9c7decee2817a237f5f | /include/tpf/vtk/tpf_grid.inl | 99a5cde16a3603848a879e8a0c7ff7d926941c2d | [
"MIT"
] | permissive | UniStuttgart-VISUS/tpf | d9c7f275e7b1e1a7609afb5ee69b8b48e779b450 | 7563000f1f7abca2156b3b1f6393f2db3c1c1f3d | refs/heads/master | 2023-08-03T17:36:30.897646 | 2023-07-24T18:35:34 | 2023-07-24T18:35:34 | 159,207,802 | 0 | 3 | MIT | 2023-05-17T16:46:24 | 2018-11-26T17:31:02 | C++ | UTF-8 | C++ | false | false | 10,957 | inl | #include "tpf_grid.h"
#include "tpf_data.h"
#include "../data/tpf_data_information.h"
#include "../data/tpf_grid.h"
#include "../data/tpf_grid_information.h"
#include "../log/tpf_log.h"
#include "vtkDataArray.h"
#include "vtkDoubleArray.h"
#include "vtkFloatArray.h"
#include "vtkRectilinearGrid.h"
#include "vtkSmartPointer.h"
#include <exception>
#include <stdexcept>
#include <string>
#include <utility>
#include <vector>
namespace tpf
{
namespace vtk
{
template <typename point_t>
inline void get_grid_information(vtkRectilinearGrid* grid, const data::topology_t data_type, typename data::grid_information<point_t>::array_type& cell_coordinates,
typename data::grid_information<point_t>::array_type& node_coordinates, typename data::grid_information<point_t>::array_type& cell_sizes, data::extent_t& extent)
{
if (grid == nullptr)
{
throw std::runtime_error(__tpf_error_message("No input grid."));
}
try
{
// Clear arrays
extent.clear();
node_coordinates.clear();
cell_coordinates.clear();
cell_sizes.clear();
extent.reserve(3);
node_coordinates.reserve(3);
cell_coordinates.reserve(3);
cell_sizes.reserve(3);
// Set extent
int extent_temp[6];
grid->GetExtent(extent_temp);
extent.push_back(std::make_pair(static_cast<std::size_t>(extent_temp[0]), static_cast<std::size_t>(extent_temp[1])));
extent.push_back(std::make_pair(static_cast<std::size_t>(extent_temp[2]), static_cast<std::size_t>(extent_temp[3])));
extent.push_back(std::make_pair(static_cast<std::size_t>(extent_temp[4]), static_cast<std::size_t>(extent_temp[5])));
if (data_type == data::topology_t::CELL_DATA)
{
// Set node coordinates
node_coordinates.push_back(get_data<point_t, vtkFloatArray>(grid->GetXCoordinates(), std::string("X coordinates")));
node_coordinates.push_back(get_data<point_t, vtkFloatArray>(grid->GetYCoordinates(), std::string("Y coordinates")));
node_coordinates.push_back(get_data<point_t, vtkFloatArray>(grid->GetZCoordinates(), std::string("Z coordinates")));
// Calculate cell coordinates
for (std::size_t c = 0; c < 3; ++c)
{
cell_coordinates.push_back(std::vector<point_t>(node_coordinates[c].size() - 1));
cell_coordinates[c].clear();
for (std::size_t i = 0; i < node_coordinates[c].size() - 1; ++i)
{
cell_coordinates[c].push_back(static_cast<point_t>(0.5L) * (node_coordinates[c][i] + node_coordinates[c][i + 1]));
}
}
--(extent[0].second);
--(extent[1].second);
--(extent[2].second);
}
else
{
// Set cell coordinates
cell_coordinates.push_back(get_data<point_t, vtkFloatArray>(grid->GetXCoordinates(), std::string("X coordinates")));
cell_coordinates.push_back(get_data<point_t, vtkFloatArray>(grid->GetYCoordinates(), std::string("Y coordinates")));
cell_coordinates.push_back(get_data<point_t, vtkFloatArray>(grid->GetZCoordinates(), std::string("Z coordinates")));
// Calculate node coordinates
for (std::size_t c = 0; c < 3; ++c)
{
node_coordinates.push_back(std::vector<point_t>(cell_coordinates[c].size() + 1));
node_coordinates[c].clear();
node_coordinates[c].push_back(static_cast<point_t>(0.0L));
for (std::size_t i = 1; i < cell_coordinates[c].size() + 1; ++i)
{
node_coordinates[c].push_back(static_cast<point_t>(2.0L) * cell_coordinates[c][i - 1] - node_coordinates[c][i - 1]);
}
}
}
// Calculate cell sizes
for (std::size_t c = 0; c < 3; ++c)
{
cell_sizes.push_back(std::vector<point_t>(cell_coordinates[c].size()));
cell_sizes[c].clear();
for (std::size_t i = 0; i < cell_coordinates[c].size(); ++i)
{
cell_sizes[c].push_back(node_coordinates[c][i + 1] - node_coordinates[c][i]);
}
}
}
catch (const std::exception& ex)
{
throw std::runtime_error(__tpf_nested_error_message(ex.what(), "Error getting information."));
}
catch (...)
{
throw std::runtime_error(__tpf_error_message("Error getting information."));
}
}
template <typename point_t>
inline void set_grid_information(vtkRectilinearGrid* grid, const typename data::grid_information<point_t>::array_type& node_coordinates, const data::extent_t& extent)
{
// Set extent
int vtk_extent[6];
vtk_extent[0] = static_cast<int>(extent[0].first);
vtk_extent[1] = static_cast<int>(extent[0].second + 1);
vtk_extent[2] = static_cast<int>(extent[1].first);
vtk_extent[3] = static_cast<int>(extent[1].second + 1);
vtk_extent[4] = static_cast<int>(extent[2].first);
vtk_extent[5] = static_cast<int>(extent[2].second + 1);
grid->SetExtent(vtk_extent);
// Set node coordinates
auto x_coordinates = vtkSmartPointer<vtkDoubleArray>::New();
auto y_coordinates = vtkSmartPointer<vtkDoubleArray>::New();
auto z_coordinates = vtkSmartPointer<vtkDoubleArray>::New();
set_data<point_t, vtkDoubleArray>(x_coordinates.GetPointer(), node_coordinates[0], 1);
set_data<point_t, vtkDoubleArray>(y_coordinates.GetPointer(), node_coordinates[1], 1);
set_data<point_t, vtkDoubleArray>(z_coordinates.GetPointer(), node_coordinates[2], 1);
grid->SetXCoordinates(x_coordinates);
grid->SetYCoordinates(y_coordinates);
grid->SetZCoordinates(z_coordinates);
}
template <typename data_t, typename point_t, std::size_t dimensions, std::size_t rows, std::size_t columns>
inline data::grid<data_t, point_t, dimensions, rows, columns> get_grid(vtkRectilinearGrid* grid, const data::topology_t data_type, std::string data_name)
{
if (grid == nullptr)
{
throw std::runtime_error(__tpf_error_message("No input grid."));
}
// Get data
if (!has_array(grid, data_type, data_name))
{
// Try to find an array whose name includes the given name
if (data_type == data::topology_t::CELL_DATA)
{
for (int i = 0; i < grid->GetCellData()->GetNumberOfArrays(); ++i)
{
const auto array = grid->GetCellData()->GetAbstractArray(i);
if (data_name.find(array->GetName()) != std::string::npos)
{
data_name = array->GetName();
break;
}
}
}
else
{
for (int i = 0; i < grid->GetPointData()->GetNumberOfArrays(); ++i)
{
const auto array = grid->GetPointData()->GetAbstractArray(i);
if (data_name.find(array->GetName()) != std::string::npos)
{
data_name = array->GetName();
break;
}
}
}
if (!has_array(grid, data_type, data_name))
{
throw std::runtime_error(__tpf_error_message("Error getting data array. Array with given name not found."));
}
}
auto data = get_data<data_t>(grid, data_type, data_name);
// Get grid information
typename data::grid_information<point_t>::array_type cell_coordinates, node_coordinates, cell_sizes;
data::extent_t extent;
get_grid_information<point_t>(grid, data::topology_t::CELL_DATA, cell_coordinates, node_coordinates, cell_sizes, extent);
// Create grid
data::grid<data_t, point_t, dimensions, rows, columns> output_grid(data_name, extent, std::move(data));
output_grid.set_grid_information(std::move(cell_coordinates), std::move(node_coordinates), std::move(cell_sizes));
return output_grid;
}
template <typename data_t, typename point_t, std::size_t dimensions, std::size_t rows, std::size_t columns>
inline data::grid<data_t, point_t, dimensions, rows, columns> get_grid(vtkRectilinearGrid* grid, const data::topology_t data_type, vtkDataArray* data_array)
{
if (data_array == nullptr)
{
throw std::runtime_error(__tpf_error_message("Input array not found."));
}
return get_grid<data_t, point_t, dimensions, rows, columns>(grid, data_type, data_array->GetName());
}
template <typename data_t, typename point_t, std::size_t dimensions, std::size_t rows, std::size_t columns>
inline data::grid<data_t, point_t, dimensions, rows, columns> get_grid(vtkRectilinearGrid* grid, const data::topology_t data_type, const std::vector<std::string>& data_names)
{
if (grid == nullptr)
{
throw std::runtime_error(__tpf_error_message("No input grid."));
}
// Try to return the grid with the first name
std::string last_error;
for (const auto& data_name : data_names)
{
try
{
return get_grid<data_t, point_t, dimensions, rows, columns>(grid, data_type, data_name);
}
catch (const std::exception& ex)
{
last_error = ex.what();
}
catch (...)
{
}
}
throw std::runtime_error(__tpf_nested_error_message(last_error, "Error getting data array. Array with given names not found."));
}
}
}
| [
"alexander.straub@visus.uni-stuttgart.de"
] | alexander.straub@visus.uni-stuttgart.de |
aeb6700a6a8263c487a18863fd10aade63f854d6 | 36184239a2d964ed5f587ad8e83f66355edb17aa | /.history/hw3/ElectoralMap_20211019202531.cpp | aa8692f874f61ce651daaa8dcf3c9f559aa24cc8 | [] | no_license | xich4932/csci3010 | 89c342dc445f5ec15ac7885cd7b7c26a225dae3e | 23f0124a99c4e8e44a28ff31ededc42d9f326ccc | refs/heads/master | 2023-08-24T04:03:12.748713 | 2021-10-22T08:22:58 | 2021-10-22T08:22:58 | 415,140,207 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 8,581 | cpp | #include<iostream>
#include<map>
#include<set>
#include<random>
#include<time.h>
#include<stdlib.h>
#include"ElectoralMap.h"
#define num_district 3
#define num_enum 4
//int Candidate::id = 0;
int ElectoralMap::count_district = 0;
int Election::ids = 0;
std::vector<int> Election::party_one_active = {};
std::vector<int> Election::party_two_active = {};
std::vector<int> Election::party_three_active = {};
//std::vector<int> Election::stored_idx_each;
int Candidate::party_one_candidate = 0;
int Candidate::party_two_candidate = 0;
int Candidate::party_three_candidate = 0;
int Election::active_party[3] = {0};
Candidate::Candidate(){
;
}
void Candidate::plus_vote(int count){
vote += count;
}
Candidate::Candidate(int given_id, party party_name, std::string candidate_name){
id_candidate = given_id;
party_affiliation = party_name;
name = candidate_name;
}
int Candidate::get_ids(){
return id_candidate;
}
District::District(){
for(enum party temp = party::one; temp <= party::none ; temp = (party)(temp + 1)){
map_party.insert(std::pair<party,int>(temp, 0));
//map_party.insert(std::pair<party,int>(temp, range_random(engine)));
}
//std::uniform_int_distribution<unsigned> range_random1(5,29);
square_mile = 0;
id = 0;
}
District::District(int given_id){
// std::default_random_engine engine;
// std::uniform_int_distribution<unsigned> range_random(0,9);
for(enum party temp = party::one; temp <= party::none ; temp = (party)(temp + 1)){
map_party.insert(std::pair<party,int>(temp, rand()%9));
//map_party.insert(std::pair<party,int>(temp, range_random(engine)));
}
// std::uniform_int_distribution<unsigned> range_random1(5,29);
square_mile = rand()%25+5;
id = given_id;
}
party District::get_max(){
enum party ret;
int max = 0;
int old_ = max;
for(auto i = map_party.begin(); i != map_party.end(); i++){
max = std::max(max, i->second);
if(old_ != max){
old_ = max;
ret = i->first;
}
}
return ret;
}
int District::get_sum_constitutent(){
int sum = 0;
for(enum party temp = party::one; temp <= party::none; temp = (party)(temp + 1)){
if(map_party[temp] != party::none)
sum += map_party[temp];
}
return sum;
}
void District::change_party(party increase_party, party decrease_party, int num){
//debug: assume changing number is always smaller than the actual number
if(num > map_party[decrease_party]){
map_party[increase_party] += map_party[decrease_party];
map_party[decrease_party] = 0;
}else{
map_party[increase_party] += num;
map_party[decrease_party] -= num;
}
};
ElectoralMap::ElectoralMap(){
for(int i = 0; i < num_district; i++){
District *temp = new District(count_district+1);
map.insert(std::pair<int, District>(count_district+1, *temp));
count_district ++;
}
}
std::string stringifyEnum(party one){
const std::string str[4] = {"party one", "party two", "party three", "party none"};
for(enum party temp = party::one; temp <= party::none; temp = (party)(temp+1)){
if(temp == one) return str[(int)temp];
}
return "";
}
std::ostream & operator<<(std::ostream& os, District print_district){
std::cout << "district: "<< print_district.id <<":"<< std::endl;
std::cout << "area: "<< print_district.square_mile << std::endl;
for(enum party print_enum = party::one; print_enum <= party::none; print_enum = (party)(print_enum+1)){
std::cout << stringifyEnum(print_enum) <<": "<< print_district.map_party[print_enum] <<" ";
}
std::cout << std::endl;
return os;
}
std::ostream & operator<<(std::ostream& os, ElectoralMap print_map){
for(auto i = print_map.map.begin(); i != print_map.map.end(); i++){
std::cout << i->second << std::endl;
}
return os;
}
void ask_name(std::string &name){
std::cout << "What is their name?"<<std::endl;
getline(std::cin, name);
}
Election::Election(){
register_candidate();
}
void Election::register_candidate(){
std::string choice;
for(enum party party_name; party_name <= party::none; party_name = (party)(party_name+1)){
while(1){
std::cout <<"Do you want to register a candidate for "<< stringifyEnum(party_name) <<" (y or n)?"<<std::endl;
getline(std::cin, choice);
if(choice == "y"){
std::string candidate_name;
ask_name(candidate_name);
Candidate temp(ids+1, party_name, candidate_name);
candidate_.push_back(temp);
ids ++;
if(party_name == 0){
party_one_active.push_back(ids);
}else if(party_name == 1){
party_two_active.push_back(ids);
}else if(party_name == 2){
party_three_active.push_back(ids);
}
active_party[party_name] ++;
continue;
}
if(choice == "n") break;
//continue; //when user input other choice, keep asking
}
}
}
Candidate* Election::go_campaigning(){
std::string choice;
while ((1))
{
std::cout << "Which candidate is campaigning (id) (0 to stop) ?" <<std::endl;
getline(std::cin, choice);
if(choice == "0") break;
if(stoi(choice) >= ids) std::cout << "index out of range"<< std::endl;
break; //jump out of loop if id is availble
}
int campaign_id = stoi(choice);
std::cout << ElectoralMap::getInstance << std::endl;
while ((1))
{
std::cout << "Where is this candidate campaigning (id) (0 to stop) ?" <<std::endl;
getline(std::cin, choice);
if(choice == "0") break;
if(stoi(choice) >= num_district) std::cout << "index out of range"<< std::endl;
break; //jump out of loop if id is availble
}
int campaign_district = stoi(choice);
std::cout << candidate_[campaign_id].get_name() << " is campaigning in district "<< campaign_district << std::endl;
}
void Election::voting(){
std::map<party, int> sum_each_party;
sum_each_party.insert(std::pair<party, int> (party::one, 0));
sum_each_party.insert(std::pair<party, int> (party::two, 0));
sum_each_party.insert(std::pair<party, int> (party::three,0));
std::vector<std::vector<int>> store_id_each = {party_one_active, party_two_active, party_three_active};
ElectoralMap vote_map = ElectoralMap::getInstance();
std::map<int, District> vote_district = vote_map.get_map();
for(int d = 0; d < num_district; d++){
for(enum party party_name = party::one; party_name <= party::none; party_name = (party)(party_name+1)){
if(active_party[party_name]){
int get_voted = rand()%store_id_each[party_name].size();
candidate_[party_one_active[get_voted]].plus_vote(vote_district[d+1].get_constituent(party_name));
//sum_each_party[party_name] += vote_district[d].get_constituent(party_name);
}else if(party_name == party::none){
party none_cantitutent = vote_district[d+1].get_max();
//if none constitutent is 9, should i count them as one or do random choice for each person
if(party_name == party::none){ //the majority constituent is still none
;
}else if(!active_party[none_cantitutent] || (!active_party[party_name] && party_name != party::none)){ // when the majority constituent has no candidate
int sum = 0;
for(int i = 0; i < 3; i++) sum += active_party[i];
int get_voted = rand()%sum;
candidate_[get_voted].plus_vote(vote_district[d+1].get_constituent(party_name));
}
}else{
int sum = 0;
for(int i = 0; i < 3; i++) sum += active_party[i];
int get_voted = rand()%sum;
candidate_[get_voted].plus_vote(vote_district[d+1].get_constituent(party_name));
}
}
}
}
void Election::converting(District * campaign_district, Candidate * this_candidate){
int sum_constituent = campaign_district->get_constituent(this_candidate->get_party());
int sum_residents = campaign_district->get_sum_constitutent();
p_success = std::min(100, (sum_constituent+1)*2/sum_residents)
}
void RepresentativeELection::voting(){
}
| [
"70279863+xich4932@users.noreply.github.com"
] | 70279863+xich4932@users.noreply.github.com |
84b5deb59f3aa43ade911dcaac92685488477146 | cefd6c17774b5c94240d57adccef57d9bba4a2e9 | /v8/src/full-codegen.h | d9090a8dc830137448b9bb4e6ac38f1240316909 | [
"BSL-1.0",
"BSD-3-Clause",
"bzip2-1.0.6"
] | permissive | adzhou/oragle | 9c054c25b24ff0a65cb9639bafd02aac2bcdce8b | 5442d418b87d0da161429ffa5cb83777e9b38e4d | refs/heads/master | 2022-11-01T05:04:59.368831 | 2014-03-12T15:50:08 | 2014-03-12T15:50:08 | 17,238,063 | 0 | 1 | BSL-1.0 | 2022-10-18T04:23:53 | 2014-02-27T05:39:44 | C++ | UTF-8 | C++ | false | false | 34,503 | h | // Copyright 2012 the V8 project authors. 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 Google Inc. 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.
#ifndef V8_FULL_CODEGEN_H_
#define V8_FULL_CODEGEN_H_
#include "v8.h"
#include "allocation.h"
#include "assert-scope.h"
#include "ast.h"
#include "code-stubs.h"
#include "codegen.h"
#include "compiler.h"
#include "data-flow.h"
#include "globals.h"
#include "objects.h"
namespace v8 {
namespace internal {
// Forward declarations.
class JumpPatchSite;
// AST node visitor which can tell whether a given statement will be breakable
// when the code is compiled by the full compiler in the debugger. This means
// that there will be an IC (load/store/call) in the code generated for the
// debugger to piggybag on.
class BreakableStatementChecker: public AstVisitor {
public:
explicit BreakableStatementChecker(Zone* zone) : is_breakable_(false) {
InitializeAstVisitor(zone);
}
void Check(Statement* stmt);
void Check(Expression* stmt);
bool is_breakable() { return is_breakable_; }
private:
// AST node visit functions.
#define DECLARE_VISIT(type) virtual void Visit##type(type* node);
AST_NODE_LIST(DECLARE_VISIT)
#undef DECLARE_VISIT
bool is_breakable_;
DEFINE_AST_VISITOR_SUBCLASS_MEMBERS();
DISALLOW_COPY_AND_ASSIGN(BreakableStatementChecker);
};
// -----------------------------------------------------------------------------
// Full code generator.
class FullCodeGenerator: public AstVisitor {
public:
enum State {
NO_REGISTERS,
TOS_REG
};
FullCodeGenerator(MacroAssembler* masm, CompilationInfo* info)
: masm_(masm),
info_(info),
scope_(info->scope()),
nesting_stack_(NULL),
loop_depth_(0),
globals_(NULL),
context_(NULL),
bailout_entries_(info->HasDeoptimizationSupport()
? info->function()->ast_node_count() : 0,
info->zone()),
back_edges_(2, info->zone()),
ic_total_count_(0) {
Initialize();
}
void Initialize();
static bool MakeCode(CompilationInfo* info);
// Encode state and pc-offset as a BitField<type, start, size>.
// Only use 30 bits because we encode the result as a smi.
class StateField : public BitField<State, 0, 1> { };
class PcField : public BitField<unsigned, 1, 30-1> { };
static const char* State2String(State state) {
switch (state) {
case NO_REGISTERS: return "NO_REGISTERS";
case TOS_REG: return "TOS_REG";
}
UNREACHABLE();
return NULL;
}
static const int kMaxBackEdgeWeight = 127;
// Platform-specific code size multiplier.
#if V8_TARGET_ARCH_IA32
static const int kCodeSizeMultiplier = 100;
#elif V8_TARGET_ARCH_X64
static const int kCodeSizeMultiplier = 162;
#elif V8_TARGET_ARCH_ARM
static const int kCodeSizeMultiplier = 142;
#elif V8_TARGET_ARCH_A64
// TODO(all): Copied ARM value. Check this is sensible for A64.
static const int kCodeSizeMultiplier = 142;
#elif V8_TARGET_ARCH_MIPS
static const int kCodeSizeMultiplier = 142;
#else
#error Unsupported target architecture.
#endif
private:
class Breakable;
class Iteration;
class TestContext;
class NestedStatement BASE_EMBEDDED {
public:
explicit NestedStatement(FullCodeGenerator* codegen) : codegen_(codegen) {
// Link into codegen's nesting stack.
previous_ = codegen->nesting_stack_;
codegen->nesting_stack_ = this;
}
virtual ~NestedStatement() {
// Unlink from codegen's nesting stack.
ASSERT_EQ(this, codegen_->nesting_stack_);
codegen_->nesting_stack_ = previous_;
}
virtual Breakable* AsBreakable() { return NULL; }
virtual Iteration* AsIteration() { return NULL; }
virtual bool IsContinueTarget(Statement* target) { return false; }
virtual bool IsBreakTarget(Statement* target) { return false; }
// Notify the statement that we are exiting it via break, continue, or
// return and give it a chance to generate cleanup code. Return the
// next outer statement in the nesting stack. We accumulate in
// *stack_depth the amount to drop the stack and in *context_length the
// number of context chain links to unwind as we traverse the nesting
// stack from an exit to its target.
virtual NestedStatement* Exit(int* stack_depth, int* context_length) {
return previous_;
}
protected:
MacroAssembler* masm() { return codegen_->masm(); }
FullCodeGenerator* codegen_;
NestedStatement* previous_;
private:
DISALLOW_COPY_AND_ASSIGN(NestedStatement);
};
// A breakable statement such as a block.
class Breakable : public NestedStatement {
public:
Breakable(FullCodeGenerator* codegen, BreakableStatement* statement)
: NestedStatement(codegen), statement_(statement) {
}
virtual ~Breakable() {}
virtual Breakable* AsBreakable() { return this; }
virtual bool IsBreakTarget(Statement* target) {
return statement() == target;
}
BreakableStatement* statement() { return statement_; }
Label* break_label() { return &break_label_; }
private:
BreakableStatement* statement_;
Label break_label_;
};
// An iteration statement such as a while, for, or do loop.
class Iteration : public Breakable {
public:
Iteration(FullCodeGenerator* codegen, IterationStatement* statement)
: Breakable(codegen, statement) {
}
virtual ~Iteration() {}
virtual Iteration* AsIteration() { return this; }
virtual bool IsContinueTarget(Statement* target) {
return statement() == target;
}
Label* continue_label() { return &continue_label_; }
private:
Label continue_label_;
};
// A nested block statement.
class NestedBlock : public Breakable {
public:
NestedBlock(FullCodeGenerator* codegen, Block* block)
: Breakable(codegen, block) {
}
virtual ~NestedBlock() {}
virtual NestedStatement* Exit(int* stack_depth, int* context_length) {
if (statement()->AsBlock()->scope() != NULL) {
++(*context_length);
}
return previous_;
};
};
// The try block of a try/catch statement.
class TryCatch : public NestedStatement {
public:
explicit TryCatch(FullCodeGenerator* codegen) : NestedStatement(codegen) {
}
virtual ~TryCatch() {}
virtual NestedStatement* Exit(int* stack_depth, int* context_length);
};
// The try block of a try/finally statement.
class TryFinally : public NestedStatement {
public:
TryFinally(FullCodeGenerator* codegen, Label* finally_entry)
: NestedStatement(codegen), finally_entry_(finally_entry) {
}
virtual ~TryFinally() {}
virtual NestedStatement* Exit(int* stack_depth, int* context_length);
private:
Label* finally_entry_;
};
// The finally block of a try/finally statement.
class Finally : public NestedStatement {
public:
static const int kElementCount = 5;
explicit Finally(FullCodeGenerator* codegen) : NestedStatement(codegen) { }
virtual ~Finally() {}
virtual NestedStatement* Exit(int* stack_depth, int* context_length) {
*stack_depth += kElementCount;
return previous_;
}
};
// The body of a for/in loop.
class ForIn : public Iteration {
public:
static const int kElementCount = 5;
ForIn(FullCodeGenerator* codegen, ForInStatement* statement)
: Iteration(codegen, statement) {
}
virtual ~ForIn() {}
virtual NestedStatement* Exit(int* stack_depth, int* context_length) {
*stack_depth += kElementCount;
return previous_;
}
};
// The body of a with or catch.
class WithOrCatch : public NestedStatement {
public:
explicit WithOrCatch(FullCodeGenerator* codegen)
: NestedStatement(codegen) {
}
virtual ~WithOrCatch() {}
virtual NestedStatement* Exit(int* stack_depth, int* context_length) {
++(*context_length);
return previous_;
}
};
// Type of a member function that generates inline code for a native function.
typedef void (FullCodeGenerator::*InlineFunctionGenerator)(CallRuntime* expr);
static const InlineFunctionGenerator kInlineFunctionGenerators[];
// A platform-specific utility to overwrite the accumulator register
// with a GC-safe value.
void ClearAccumulator();
// Determine whether or not to inline the smi case for the given
// operation.
bool ShouldInlineSmiCase(Token::Value op);
// Helper function to convert a pure value into a test context. The value
// is expected on the stack or the accumulator, depending on the platform.
// See the platform-specific implementation for details.
void DoTest(Expression* condition,
Label* if_true,
Label* if_false,
Label* fall_through);
void DoTest(const TestContext* context);
// Helper function to split control flow and avoid a branch to the
// fall-through label if it is set up.
#if V8_TARGET_ARCH_MIPS
void Split(Condition cc,
Register lhs,
const Operand& rhs,
Label* if_true,
Label* if_false,
Label* fall_through);
#else // All non-mips arch.
void Split(Condition cc,
Label* if_true,
Label* if_false,
Label* fall_through);
#endif // V8_TARGET_ARCH_MIPS
// Load the value of a known (PARAMETER, LOCAL, or CONTEXT) variable into
// a register. Emits a context chain walk if if necessary (so does
// SetVar) so avoid calling both on the same variable.
void GetVar(Register destination, Variable* var);
// Assign to a known (PARAMETER, LOCAL, or CONTEXT) variable. If it's in
// the context, the write barrier will be emitted and source, scratch0,
// scratch1 will be clobbered. Emits a context chain walk if if necessary
// (so does GetVar) so avoid calling both on the same variable.
void SetVar(Variable* var,
Register source,
Register scratch0,
Register scratch1);
// An operand used to read/write a stack-allocated (PARAMETER or LOCAL)
// variable. Writing does not need the write barrier.
MemOperand StackOperand(Variable* var);
// An operand used to read/write a known (PARAMETER, LOCAL, or CONTEXT)
// variable. May emit code to traverse the context chain, loading the
// found context into the scratch register. Writing to this operand will
// need the write barrier if location is CONTEXT.
MemOperand VarOperand(Variable* var, Register scratch);
void VisitForEffect(Expression* expr) {
EffectContext context(this);
Visit(expr);
PrepareForBailout(expr, NO_REGISTERS);
}
void VisitForAccumulatorValue(Expression* expr) {
AccumulatorValueContext context(this);
Visit(expr);
PrepareForBailout(expr, TOS_REG);
}
void VisitForStackValue(Expression* expr) {
StackValueContext context(this);
Visit(expr);
PrepareForBailout(expr, NO_REGISTERS);
}
void VisitForControl(Expression* expr,
Label* if_true,
Label* if_false,
Label* fall_through) {
TestContext context(this, expr, if_true, if_false, fall_through);
Visit(expr);
// For test contexts, we prepare for bailout before branching, not at
// the end of the entire expression. This happens as part of visiting
// the expression.
}
void VisitInDuplicateContext(Expression* expr);
void VisitDeclarations(ZoneList<Declaration*>* declarations);
void DeclareModules(Handle<FixedArray> descriptions);
void DeclareGlobals(Handle<FixedArray> pairs);
int DeclareGlobalsFlags();
// Generate code to allocate all (including nested) modules and contexts.
// Because of recursive linking and the presence of module alias declarations,
// this has to be a separate pass _before_ populating or executing any module.
void AllocateModules(ZoneList<Declaration*>* declarations);
// Generate code to create an iterator result object. The "value" property is
// set to a value popped from the stack, and "done" is set according to the
// argument. The result object is left in the result register.
void EmitCreateIteratorResult(bool done);
// Try to perform a comparison as a fast inlined literal compare if
// the operands allow it. Returns true if the compare operations
// has been matched and all code generated; false otherwise.
bool TryLiteralCompare(CompareOperation* compare);
// Platform-specific code for comparing the type of a value with
// a given literal string.
void EmitLiteralCompareTypeof(Expression* expr,
Expression* sub_expr,
Handle<String> check);
// Platform-specific code for equality comparison with a nil-like value.
void EmitLiteralCompareNil(CompareOperation* expr,
Expression* sub_expr,
NilValue nil);
// Bailout support.
void PrepareForBailout(Expression* node, State state);
void PrepareForBailoutForId(BailoutId id, State state);
// Feedback slot support. The feedback vector will be cleared during gc and
// collected by the type-feedback oracle.
Handle<FixedArray> FeedbackVector() {
return feedback_vector_;
}
void StoreFeedbackVectorSlot(int slot, Handle<Object> object) {
feedback_vector_->set(slot, *object);
}
void InitializeFeedbackVector();
// Record a call's return site offset, used to rebuild the frame if the
// called function was inlined at the site.
void RecordJSReturnSite(Call* call);
// Prepare for bailout before a test (or compare) and branch. If
// should_normalize, then the following comparison will not handle the
// canonical JS true value so we will insert a (dead) test against true at
// the actual bailout target from the optimized code. If not
// should_normalize, the true and false labels are ignored.
void PrepareForBailoutBeforeSplit(Expression* expr,
bool should_normalize,
Label* if_true,
Label* if_false);
// If enabled, emit debug code for checking that the current context is
// neither a with nor a catch context.
void EmitDebugCheckDeclarationContext(Variable* variable);
// This is meant to be called at loop back edges, |back_edge_target| is
// the jump target of the back edge and is used to approximate the amount
// of code inside the loop.
void EmitBackEdgeBookkeeping(IterationStatement* stmt,
Label* back_edge_target);
// Record the OSR AST id corresponding to a back edge in the code.
void RecordBackEdge(BailoutId osr_ast_id);
// Emit a table of back edge ids, pcs and loop depths into the code stream.
// Return the offset of the start of the table.
unsigned EmitBackEdgeTable();
void EmitProfilingCounterDecrement(int delta);
void EmitProfilingCounterReset();
// Emit code to pop values from the stack associated with nested statements
// like try/catch, try/finally, etc, running the finallies and unwinding the
// handlers as needed.
void EmitUnwindBeforeReturn();
// Platform-specific return sequence
void EmitReturnSequence();
// Platform-specific code sequences for calls
void EmitCallWithStub(Call* expr);
void EmitCallWithIC(Call* expr);
void EmitKeyedCallWithIC(Call* expr, Expression* key);
// Platform-specific code for inline runtime calls.
InlineFunctionGenerator FindInlineFunctionGenerator(Runtime::FunctionId id);
void EmitInlineRuntimeCall(CallRuntime* expr);
#define EMIT_INLINE_RUNTIME_CALL(name, x, y) \
void Emit##name(CallRuntime* expr);
INLINE_FUNCTION_LIST(EMIT_INLINE_RUNTIME_CALL)
INLINE_RUNTIME_FUNCTION_LIST(EMIT_INLINE_RUNTIME_CALL)
#undef EMIT_INLINE_RUNTIME_CALL
// Platform-specific code for resuming generators.
void EmitGeneratorResume(Expression *generator,
Expression *value,
JSGeneratorObject::ResumeMode resume_mode);
// Platform-specific code for loading variables.
void EmitLoadGlobalCheckExtensions(Variable* var,
TypeofState typeof_state,
Label* slow);
MemOperand ContextSlotOperandCheckExtensions(Variable* var, Label* slow);
void EmitDynamicLookupFastCase(Variable* var,
TypeofState typeof_state,
Label* slow,
Label* done);
void EmitVariableLoad(VariableProxy* proxy);
void EmitAccessor(Expression* expression);
// Expects the arguments and the function already pushed.
void EmitResolvePossiblyDirectEval(int arg_count);
// Platform-specific support for allocating a new closure based on
// the given function info.
void EmitNewClosure(Handle<SharedFunctionInfo> info, bool pretenure);
// Platform-specific support for compiling assignments.
// Load a value from a named property.
// The receiver is left on the stack by the IC.
void EmitNamedPropertyLoad(Property* expr);
// Load a value from a keyed property.
// The receiver and the key is left on the stack by the IC.
void EmitKeyedPropertyLoad(Property* expr);
// Apply the compound assignment operator. Expects the left operand on top
// of the stack and the right one in the accumulator.
void EmitBinaryOp(BinaryOperation* expr,
Token::Value op,
OverwriteMode mode);
// Helper functions for generating inlined smi code for certain
// binary operations.
void EmitInlineSmiBinaryOp(BinaryOperation* expr,
Token::Value op,
OverwriteMode mode,
Expression* left,
Expression* right);
// Assign to the given expression as if via '='. The right-hand-side value
// is expected in the accumulator.
void EmitAssignment(Expression* expr);
// Complete a variable assignment. The right-hand-side value is expected
// in the accumulator.
void EmitVariableAssignment(Variable* var,
Token::Value op);
// Helper functions to EmitVariableAssignment
void EmitStoreToStackLocalOrContextSlot(Variable* var,
MemOperand location);
void EmitCallStoreContextSlot(Handle<String> name, LanguageMode mode);
// Complete a named property assignment. The receiver is expected on top
// of the stack and the right-hand-side value in the accumulator.
void EmitNamedPropertyAssignment(Assignment* expr);
// Complete a keyed property assignment. The receiver and key are
// expected on top of the stack and the right-hand-side value in the
// accumulator.
void EmitKeyedPropertyAssignment(Assignment* expr);
void CallIC(Handle<Code> code,
TypeFeedbackId id = TypeFeedbackId::None());
void CallLoadIC(ContextualMode mode,
TypeFeedbackId id = TypeFeedbackId::None());
void CallStoreIC(TypeFeedbackId id = TypeFeedbackId::None());
void SetFunctionPosition(FunctionLiteral* fun);
void SetReturnPosition(FunctionLiteral* fun);
void SetStatementPosition(Statement* stmt);
void SetExpressionPosition(Expression* expr);
void SetStatementPosition(int pos);
void SetSourcePosition(int pos);
// Non-local control flow support.
void EnterFinallyBlock();
void ExitFinallyBlock();
// Loop nesting counter.
int loop_depth() { return loop_depth_; }
void increment_loop_depth() { loop_depth_++; }
void decrement_loop_depth() {
ASSERT(loop_depth_ > 0);
loop_depth_--;
}
MacroAssembler* masm() { return masm_; }
class ExpressionContext;
const ExpressionContext* context() { return context_; }
void set_new_context(const ExpressionContext* context) { context_ = context; }
Handle<Script> script() { return info_->script(); }
bool is_eval() { return info_->is_eval(); }
bool is_native() { return info_->is_native(); }
bool is_classic_mode() { return language_mode() == CLASSIC_MODE; }
StrictModeFlag strict_mode() {
return is_classic_mode() ? kNonStrictMode : kStrictMode;
}
LanguageMode language_mode() { return function()->language_mode(); }
FunctionLiteral* function() { return info_->function(); }
Scope* scope() { return scope_; }
static Register result_register();
static Register context_register();
// Set fields in the stack frame. Offsets are the frame pointer relative
// offsets defined in, e.g., StandardFrameConstants.
void StoreToFrameField(int frame_offset, Register value);
// Load a value from the current context. Indices are defined as an enum
// in v8::internal::Context.
void LoadContextField(Register dst, int context_index);
// Push the function argument for the runtime functions PushWithContext
// and PushCatchContext.
void PushFunctionArgumentForContextAllocation();
// AST node visit functions.
#define DECLARE_VISIT(type) virtual void Visit##type(type* node);
AST_NODE_LIST(DECLARE_VISIT)
#undef DECLARE_VISIT
void VisitComma(BinaryOperation* expr);
void VisitLogicalExpression(BinaryOperation* expr);
void VisitArithmeticExpression(BinaryOperation* expr);
void VisitForTypeofValue(Expression* expr);
void Generate();
void PopulateDeoptimizationData(Handle<Code> code);
void PopulateTypeFeedbackInfo(Handle<Code> code);
Handle<FixedArray> handler_table() { return handler_table_; }
struct BailoutEntry {
BailoutId id;
unsigned pc_and_state;
};
struct BackEdgeEntry {
BailoutId id;
unsigned pc;
uint32_t loop_depth;
};
class ExpressionContext BASE_EMBEDDED {
public:
explicit ExpressionContext(FullCodeGenerator* codegen)
: masm_(codegen->masm()), old_(codegen->context()), codegen_(codegen) {
codegen->set_new_context(this);
}
virtual ~ExpressionContext() {
codegen_->set_new_context(old_);
}
Isolate* isolate() const { return codegen_->isolate(); }
// Convert constant control flow (true or false) to the result expected for
// this expression context.
virtual void Plug(bool flag) const = 0;
// Emit code to convert a pure value (in a register, known variable
// location, as a literal, or on top of the stack) into the result
// expected according to this expression context.
virtual void Plug(Register reg) const = 0;
virtual void Plug(Variable* var) const = 0;
virtual void Plug(Handle<Object> lit) const = 0;
virtual void Plug(Heap::RootListIndex index) const = 0;
virtual void PlugTOS() const = 0;
// Emit code to convert pure control flow to a pair of unbound labels into
// the result expected according to this expression context. The
// implementation will bind both labels unless it's a TestContext, which
// won't bind them at this point.
virtual void Plug(Label* materialize_true,
Label* materialize_false) const = 0;
// Emit code to discard count elements from the top of stack, then convert
// a pure value into the result expected according to this expression
// context.
virtual void DropAndPlug(int count, Register reg) const = 0;
// Set up branch labels for a test expression. The three Label** parameters
// are output parameters.
virtual void PrepareTest(Label* materialize_true,
Label* materialize_false,
Label** if_true,
Label** if_false,
Label** fall_through) const = 0;
// Returns true if we are evaluating only for side effects (i.e. if the
// result will be discarded).
virtual bool IsEffect() const { return false; }
// Returns true if we are evaluating for the value (in accu/on stack).
virtual bool IsAccumulatorValue() const { return false; }
virtual bool IsStackValue() const { return false; }
// Returns true if we are branching on the value rather than materializing
// it. Only used for asserts.
virtual bool IsTest() const { return false; }
protected:
FullCodeGenerator* codegen() const { return codegen_; }
MacroAssembler* masm() const { return masm_; }
MacroAssembler* masm_;
private:
const ExpressionContext* old_;
FullCodeGenerator* codegen_;
};
class AccumulatorValueContext : public ExpressionContext {
public:
explicit AccumulatorValueContext(FullCodeGenerator* codegen)
: ExpressionContext(codegen) { }
virtual void Plug(bool flag) const;
virtual void Plug(Register reg) const;
virtual void Plug(Label* materialize_true, Label* materialize_false) const;
virtual void Plug(Variable* var) const;
virtual void Plug(Handle<Object> lit) const;
virtual void Plug(Heap::RootListIndex) const;
virtual void PlugTOS() const;
virtual void DropAndPlug(int count, Register reg) const;
virtual void PrepareTest(Label* materialize_true,
Label* materialize_false,
Label** if_true,
Label** if_false,
Label** fall_through) const;
virtual bool IsAccumulatorValue() const { return true; }
};
class StackValueContext : public ExpressionContext {
public:
explicit StackValueContext(FullCodeGenerator* codegen)
: ExpressionContext(codegen) { }
virtual void Plug(bool flag) const;
virtual void Plug(Register reg) const;
virtual void Plug(Label* materialize_true, Label* materialize_false) const;
virtual void Plug(Variable* var) const;
virtual void Plug(Handle<Object> lit) const;
virtual void Plug(Heap::RootListIndex) const;
virtual void PlugTOS() const;
virtual void DropAndPlug(int count, Register reg) const;
virtual void PrepareTest(Label* materialize_true,
Label* materialize_false,
Label** if_true,
Label** if_false,
Label** fall_through) const;
virtual bool IsStackValue() const { return true; }
};
class TestContext : public ExpressionContext {
public:
TestContext(FullCodeGenerator* codegen,
Expression* condition,
Label* true_label,
Label* false_label,
Label* fall_through)
: ExpressionContext(codegen),
condition_(condition),
true_label_(true_label),
false_label_(false_label),
fall_through_(fall_through) { }
static const TestContext* cast(const ExpressionContext* context) {
ASSERT(context->IsTest());
return reinterpret_cast<const TestContext*>(context);
}
Expression* condition() const { return condition_; }
Label* true_label() const { return true_label_; }
Label* false_label() const { return false_label_; }
Label* fall_through() const { return fall_through_; }
virtual void Plug(bool flag) const;
virtual void Plug(Register reg) const;
virtual void Plug(Label* materialize_true, Label* materialize_false) const;
virtual void Plug(Variable* var) const;
virtual void Plug(Handle<Object> lit) const;
virtual void Plug(Heap::RootListIndex) const;
virtual void PlugTOS() const;
virtual void DropAndPlug(int count, Register reg) const;
virtual void PrepareTest(Label* materialize_true,
Label* materialize_false,
Label** if_true,
Label** if_false,
Label** fall_through) const;
virtual bool IsTest() const { return true; }
private:
Expression* condition_;
Label* true_label_;
Label* false_label_;
Label* fall_through_;
};
class EffectContext : public ExpressionContext {
public:
explicit EffectContext(FullCodeGenerator* codegen)
: ExpressionContext(codegen) { }
virtual void Plug(bool flag) const;
virtual void Plug(Register reg) const;
virtual void Plug(Label* materialize_true, Label* materialize_false) const;
virtual void Plug(Variable* var) const;
virtual void Plug(Handle<Object> lit) const;
virtual void Plug(Heap::RootListIndex) const;
virtual void PlugTOS() const;
virtual void DropAndPlug(int count, Register reg) const;
virtual void PrepareTest(Label* materialize_true,
Label* materialize_false,
Label** if_true,
Label** if_false,
Label** fall_through) const;
virtual bool IsEffect() const { return true; }
};
MacroAssembler* masm_;
CompilationInfo* info_;
Scope* scope_;
Label return_label_;
NestedStatement* nesting_stack_;
int loop_depth_;
ZoneList<Handle<Object> >* globals_;
Handle<FixedArray> modules_;
int module_index_;
const ExpressionContext* context_;
ZoneList<BailoutEntry> bailout_entries_;
GrowableBitVector prepared_bailout_ids_;
ZoneList<BackEdgeEntry> back_edges_;
int ic_total_count_;
Handle<FixedArray> handler_table_;
Handle<FixedArray> feedback_vector_;
Handle<Cell> profiling_counter_;
bool generate_debug_code_;
friend class NestedStatement;
DEFINE_AST_VISITOR_SUBCLASS_MEMBERS();
DISALLOW_COPY_AND_ASSIGN(FullCodeGenerator);
};
// A map from property names to getter/setter pairs allocated in the zone.
class AccessorTable: public TemplateHashMap<Literal,
ObjectLiteral::Accessors,
ZoneAllocationPolicy> {
public:
explicit AccessorTable(Zone* zone) :
TemplateHashMap<Literal, ObjectLiteral::Accessors,
ZoneAllocationPolicy>(Literal::Match,
ZoneAllocationPolicy(zone)),
zone_(zone) { }
Iterator lookup(Literal* literal) {
Iterator it = find(literal, true, ZoneAllocationPolicy(zone_));
if (it->second == NULL) it->second = new(zone_) ObjectLiteral::Accessors();
return it;
}
private:
Zone* zone_;
};
class BackEdgeTable {
public:
BackEdgeTable(Code* code, DisallowHeapAllocation* required) {
ASSERT(code->kind() == Code::FUNCTION);
instruction_start_ = code->instruction_start();
Address table_address = instruction_start_ + code->back_edge_table_offset();
length_ = Memory::uint32_at(table_address);
start_ = table_address + kTableLengthSize;
}
uint32_t length() { return length_; }
BailoutId ast_id(uint32_t index) {
return BailoutId(static_cast<int>(
Memory::uint32_at(entry_at(index) + kAstIdOffset)));
}
uint32_t loop_depth(uint32_t index) {
return Memory::uint32_at(entry_at(index) + kLoopDepthOffset);
}
uint32_t pc_offset(uint32_t index) {
return Memory::uint32_at(entry_at(index) + kPcOffsetOffset);
}
Address pc(uint32_t index) {
return instruction_start_ + pc_offset(index);
}
enum BackEdgeState {
INTERRUPT,
ON_STACK_REPLACEMENT,
OSR_AFTER_STACK_CHECK
};
// Patch all interrupts with allowed loop depth in the unoptimized code to
// unconditionally call replacement_code.
static void Patch(Isolate* isolate,
Code* unoptimized_code);
// Patch the back edge to the target state, provided the correct callee.
static void PatchAt(Code* unoptimized_code,
Address pc,
BackEdgeState target_state,
Code* replacement_code);
// Change all patched back edges back to normal interrupts.
static void Revert(Isolate* isolate,
Code* unoptimized_code);
// Change a back edge patched for on-stack replacement to perform a
// stack check first.
static void AddStackCheck(Handle<Code> code, uint32_t pc_offset);
// Revert the patch by AddStackCheck.
static void RemoveStackCheck(Handle<Code> code, uint32_t pc_offset);
// Return the current patch state of the back edge.
static BackEdgeState GetBackEdgeState(Isolate* isolate,
Code* unoptimized_code,
Address pc_after);
#ifdef DEBUG
// Verify that all back edges of a certain loop depth are patched.
static bool Verify(Isolate* isolate,
Code* unoptimized_code,
int loop_nesting_level);
#endif // DEBUG
private:
Address entry_at(uint32_t index) {
ASSERT(index < length_);
return start_ + index * kEntrySize;
}
static const int kTableLengthSize = kIntSize;
static const int kAstIdOffset = 0 * kIntSize;
static const int kPcOffsetOffset = 1 * kIntSize;
static const int kLoopDepthOffset = 2 * kIntSize;
static const int kEntrySize = 3 * kIntSize;
Address start_;
Address instruction_start_;
uint32_t length_;
};
} } // namespace v8::internal
#endif // V8_FULL_CODEGEN_H_
| [
"adzhou@hp.com"
] | adzhou@hp.com |
6adf26fe543744e394e039e6ef7e89c917cd09b5 | 5729497447afcccdde7eaf3e944d7c25ddeb1335 | /Introductory Problems/gray_code.cpp | a09ea9253b428248ea45ef7d4bf4a6d6fce5bb68 | [] | no_license | kalashshah/CSES-Solutions | bef19c0ffc9075b2299eb2cdead4aca05b1e5bb5 | 0ef039fb2522b33b734ae1c5c5ed45f8c3a0eb46 | refs/heads/main | 2023-07-08T04:16:36.130700 | 2021-08-10T06:22:06 | 2021-08-10T06:22:06 | 394,545,486 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 408 | cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
void grayCode(int n){
for (int i = 0; i < (1 << n); i++){
int val = (i ^ (i >> 1));
bitset<32> r(val);
string s = r.to_string();
cout << s.substr(32 - n) << "\n";
}
}
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n; cin >> n;
grayCode(n);
}
| [
"noreply@github.com"
] | kalashshah.noreply@github.com |
ea74006a02fb627350da58abdb811bedae8f0efa | 46b020aa85b2ffbc8a47721c3fb774bfc7d81d64 | /CannyDetector/CannyDetector/StartingParameters.h | 3204ccf1d95242e37c4ecca3216ebe8c73b304a9 | [
"MIT"
] | permissive | TeodorKawecki/CUDA-Canny-edge-detector | ec3ce02da1c169951fac58924627739cdd63452c | 2a54fed6ba26931f1cd795c6fc1bf0958269e679 | refs/heads/master | 2020-06-23T16:56:36.703077 | 2019-07-24T16:22:42 | 2019-07-24T17:57:56 | 198,688,014 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 301 | h | #pragma once
#include <string>
struct StartingParameters
{
std::string inputRelativeFilePath = "";
std::string outputRelativeFilePath = "default.pbm";
size_t lowHistBand = 50;
size_t highHistBand = 100;
bool cudaMode = false;
size_t repeatOperation = 1;
bool surpressWritingImage = false;
};
| [
"teodorkawecki@interia.pl"
] | teodorkawecki@interia.pl |
cc663b0a480cf3e17bfdfcf409c022a775e0b77f | d64d9c52f78d2b332791217a9e91bab7e8fa2599 | /tests/unit/lcos/local_promise_allocator.cpp | 2d5cbaea2519cc06bbbc48749790e8c74d576843 | [
"LicenseRef-scancode-free-unknown",
"BSL-1.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | Jakub-Golinowski/hpx | a81c7cdbd8e1daf530d93d2dbafb69d899229efa | 7c762ea235d5d7cde0d2686c84902016c33f2bec | refs/heads/master | 2021-04-26T23:19:08.776815 | 2018-05-04T12:36:48 | 2018-05-04T12:36:48 | 123,970,854 | 1 | 0 | BSL-1.0 | 2018-03-05T19:53:11 | 2018-03-05T19:53:11 | null | UTF-8 | C++ | false | false | 1,479 | cpp | // Copyright (c) 2007-2017 Hartmut Kaiser
// Copyright (C) 2011 Vicente J. Botet Escriba
//
// 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 <hpx/hpx_main.hpp>
#include <hpx/include/lcos.hpp>
#include <hpx/util/lightweight_test.hpp>
#include <memory>
#include "test_allocator.hpp"
int main()
{
HPX_TEST_EQ(test_alloc_base::count, 0);
{
hpx::lcos::local::promise<int> p(
std::allocator_arg, test_allocator<int>());
HPX_TEST_EQ(test_alloc_base::count, 1);
hpx::future<int> f = p.get_future();
HPX_TEST_EQ(test_alloc_base::count, 1);
HPX_TEST(f.valid());
}
HPX_TEST_EQ(test_alloc_base::count, 0);
{
hpx::lcos::local::promise<int&> p(
std::allocator_arg, test_allocator<int>());
HPX_TEST_EQ(test_alloc_base::count, 1);
hpx::future<int&> f = p.get_future();
HPX_TEST_EQ(test_alloc_base::count, 1);
HPX_TEST(f.valid());
}
HPX_TEST_EQ(test_alloc_base::count, 0);
{
hpx::lcos::local::promise<void> p(
std::allocator_arg, test_allocator<void>());
HPX_TEST_EQ(test_alloc_base::count, 1);
hpx::future<void> f = p.get_future();
HPX_TEST_EQ(test_alloc_base::count, 1);
HPX_TEST(f.valid());
}
HPX_TEST_EQ(test_alloc_base::count, 0);
return hpx::util::report_errors();
}
| [
"hartmut.kaiser@gmail.com"
] | hartmut.kaiser@gmail.com |
c81334d80ebe743585efea6c5fadb9707316f8d9 | e2d79a237d5da3a580828e310856a26af29d54d7 | /AMO_lab6/AMO_lab6_vania/Splain.cpp | e48f9fb57726135148576c0dbb707dfe21837698 | [] | no_license | IvanSakhnik/AMO | 3ce6817413dc0aff4eaaca6e2add5080e9604083 | f8cc530cc7f547e0ca23a3aeacae969292576e24 | refs/heads/master | 2021-01-23T07:44:41.561700 | 2017-03-28T09:33:37 | 2017-03-28T09:33:37 | 86,441,301 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,191 | cpp | #include "header.h"
double a = 2;
double b = 9;
double function(double x){
return 0.2*pow(M_E, pow(x, (1.0/3)))*log(x)*sin(3 * x);
}
double *Seidel(double **matrix, int N, double eps){
double *PrevEquation = new double[N];
double *SRoot = new double[N];
double tmp = 0, q = 0, max = 0, M_norma;
int k;
for (int i = 0; i < N; i++){
tmp = matrix[i][i];
for (int j = 0; j <N + 1; j++)
matrix[i][j] = matrix[i][j] / tmp;
}
for (int i = 0; i < N; i++)
SRoot[i] = matrix[i][N];
q = 0;
for (int i = 0; i < N; i++){
max = 0;
for (int j = 0; j < N; j++)
if (i != j)
max += fabs(matrix[i][j]);
if (max > q)
q = max;
}
k = 1;
do{
for (int i = 0; i < N; i++)
PrevEquation[i] = SRoot[i];
for (int i = 0; i < N; i++){
SRoot[i] = matrix[i][N];
for (int j = 0; j < N; j++)
if (i != j)
SRoot[i] -= matrix[i][j] * SRoot[j];
}
for (int i = 0; i < N; i++)
PrevEquation[i] = SRoot[i] - PrevEquation[i];
M_norma = fabs(PrevEquation[0]);
for (int i = 1; i < N; i++)
if (fabs(PrevEquation[i])>M_norma)
M_norma = fabs(PrevEquation[i]);
for (int i = 0; i < N; i++)
PrevEquation[i] = SRoot[i];
k++;
} while (M_norma> eps*((1 - q) / q));
return SRoot;
}
double* vector_A(int N){
double* A = new double[N];
double x = a, h = (b - a) / N;
for (int i = 0; i < N; i++) {
A[i] = function(x);
x += h;
}
return A;
}
double **Matrix_C(int N){
double **matrix = new double*[N];
for (int i = 0; i < N; i++)
matrix[i] = new double[N+1];
for (int i = 0; i < N ; i++)
for (int j = 0; j < N + 1; j++)
matrix[i][j] = 0;
double h = (b - a) / N;
for (int i = 0; i < N; i++){
if (i>0)
matrix[i][i - 1] = h;
if (i < N-1)
matrix[i][i + 1] = h;
matrix[i][i] = 4 * h;
matrix[i][N] = 6 * (function(a + h * (i - 1)) - 2 * function(a + h * i) + function(a + h * (i + 1))) / h;
}
return matrix;
}
double* vector_D(double* C, int N){
double* D = new double[N];
double h = (b - a) / N;
D[0] = C[0];
for (int i = 1; i < N; ++i)
D[i] = (C[i] - C[i - 1]) / h;
return D;
}
double* vector_B(double* C, double* D, int N){
double* B = new double[N];
double h = (b - a) / N;
B[0] = 0;
for (int i = 1; i < N; ++i)
B[i] = (h * C[i] / 2) - (h * h * D[i] / 2) + (function(a + h*i) - function(a + h*(i - 1))) / h;
return B;
}
void Spline(int N){
double* A;
double* C;
double* D;
double* B;
double **matrix = new double*[N];
for (int i = 0; i < N; i++)
matrix[i] = new double[N + 1];
A = vector_A(N);
matrix = Matrix_C(N);
C = Seidel(matrix, N, 1e-2);
D = vector_D(C, N);
B = vector_B(C, D, N);
double h = (b - a) / N;
int k = (b - a) * 10;
double step = (b - a) /(double)k;
double x = a, y, xj;
ofstream fout("res.txt");
for (int i = 0; i <= k; i++){
int j = 0;
while (x >= (a + j * h))
j++;
j--;
xj = a + h * j;
y = A[j] + B[j] * (x - xj) + C[j] * (x - xj) * (x - xj) / 2 + D[j] * (x - xj) * (x - xj) * (x - xj) / 6;
fout << x;
fout << " ; ";
fout << y;
fout << endl;
x += step;
}
fout.close();
return;
} | [
"ivansakhnik1997@gmail.com"
] | ivansakhnik1997@gmail.com |
2fa30ca7cb7a54154e2a2ad72b613645c63a71aa | b0fd22f0634309180d8c6767595384691f08baa4 | /StateMachine/include/Troll.h | 9a1e93aeb48b0bd0a44ac7a1594074686567e5e1 | [] | no_license | A11v1r15/IA | 6b2ff8f03f78f8644bdd827d7e0c03e3444b5dbc | 140599bc9fd4025d7109dfe7fad76fb54b571ee9 | refs/heads/master | 2020-07-14T01:06:26.703997 | 2019-10-17T19:48:26 | 2019-10-17T19:49:13 | 205,197,139 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 490 | h | #ifndef TROLL_H
#define TROLL_H
#include "State.h"
//class State;
class Troll{
public:
Troll(State<Troll>* initialState);
virtual ~Troll();
void Update();
void ChangeState(State<Troll>* state);
bool IsAlive();
int GetVida();
int GetFome();
void SetVida(int);
void SetFome(int);
protected:
private:
State<Troll>* currentState;
int fome, vida;
bool isAlive;
};
#endif // TROLL_H
| [
"aluno"
] | aluno |
08e6a8269937e20a049501ef54c9bf980115e38a | fe78a904d6f44a0a47e466606ec20e8321d0b21a | /ch5_drill.cpp | c714da9a7f20a99711306e202f53bfd124a41550 | [] | no_license | matravolgyiadrian/bevprog | 64a013ce7da2feb313a35c3047d00834e121b26c | 8383c9485139f6e889db245d58851e6eaff97ec7 | refs/heads/master | 2020-03-29T14:25:23.053173 | 2018-11-22T10:06:45 | 2018-11-22T10:06:45 | 150,016,142 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,804 | cpp | #include "std_lib_facilities.h"
int main()
try {
//cout << "Success!\n";
//cout << "Success!\n";
//cout << "Success" << "!\n";
//cout <<"success "<< '\n';
//string res = "seven"; vector<string> v(10); v[5] = res; cout << "Success!\n";
//vector<int> v(10); v[5] = 7; if (v[5]=7) cout << "Success!\n";
//if (true) cout << "Success!\n"; else cout << "Fail!\n";
//bool c = true; if (c) cout << "Success!\n"; else cout << "Fail!\n";
//string s = "apple"; bool c = "ape"<s; if (c) cout << "Success!\n";
//string s = "ape"; if (s=="ape") cout << "Success!\n";
//string s = "fool"; if (s=="fool") cout << "Success!\n";
//string s = "ape"; if (s<"fool") cout << "Success!\n";
//vector<char> v(5); for (int i=0; i<v.size(); ++i) ; cout << "Success!\n";
//vector<char> v(5); for (int i=0; i<=v.size()-1; ++i) ; cout << "Success!\n";
//string s = "Success!\n"; for (int i=0; i<6; ++i) cout << s;
//if (true) cout << "Success!\n"; else cout << "Fail!\n";
//int x = 2000; int c = x; if (c==2000) cout << "Success!\n";
//string s = "Success!\n"; for (int i=0; i<10; ++i) cout << s;
//vector<int> v(5); for (int i=0; i<v.size(); ++i) ; cout << "Success!\n";
//int i=0; int j = 9; while (i<10) ++i; if (j<i) cout << "Success!\n";
//int x = 3; double d = 5/(x-0.5); if (d==2*x-4) cout << "Success!\n";
//string s = "Success!\n"; for (int i=0; i<=10; ++i) cout << s ;
//int j=9; int i=0; while (i<=10) ++i; if (j<i) cout << "Success!\n";
//int x = 3; double d = 5/(x-2); if (d==2*x-1) cout << "Success!\n";
cout << "Success!\n";
keep_window_open();
return 0;
}
catch (exception& e) {
cerr << "error: " << e.what() << '\n';
keep_window_open();
return 1;
}
catch (...) {
cerr << "Oops: unknown exception!\n";
keep_window_open();
return 2;
}
| [
"noreply@github.com"
] | matravolgyiadrian.noreply@github.com |
102c5bd09bc9d00a2b097035b1a7b40df7c0e2c9 | b84f9565361ff7093a1d822f163aa7dfbbf9cddc | /C_C++/DailyCodeProplem/prolem26.cpp | c184a69da88497fbcf9ccf8032fc2c5874b88580 | [] | no_license | phamtiennam/MyCodeDojo | 75f64e381c079a0acd921c6a04445c3f1cae95c5 | 17f2d8dcb5356bfcb467e2771209dc9b98cb5258 | refs/heads/master | 2021-07-12T08:34:59.588121 | 2020-08-26T14:44:32 | 2020-08-26T14:44:32 | 75,037,551 | 1 | 1 | null | 2018-06-16T15:19:07 | 2016-11-29T03:05:17 | C++ | UTF-8 | C++ | false | false | 1,398 | cpp | /*
This problem was asked by Google.
Given a singly linked list and an integer k, remove the kth last element from the list. k is guaranteed to be smaller than the length of the list.
The list is very long, so making more than one pass is prohibitively expensive.
Do this in constant space and in one pass.
*/
#include <iostream>
#include "MyDefine.h"
using namespace std;
void removeElementFromList(LinkedList list,int k)
{
Node *fast;
Node *slow;
fast=list.head;
slow=list.head;
//move pointer *fast to the k position first
while(k>0)
{
fast=fast->next;
--k;
}
//now move pointer *slow and *fast to gether,
// *fast will reach the end of list
// *slow will reach the N-k postion.N is lengh of list
// *pre save the previous position of *slow
Node *pre;
while(fast)
{
fast=fast->next;
pre=slow;
slow=slow->next;
}
//Now *slow point to the K position.Remove it
pre->next=slow->next;
list.printAll();
}
int main(int argc, char const *argv[])
{
/* code */
int k=3;
LinkedList list;
list.addValue(1);
list.addValue(2);
list.addValue(3);
list.addValue(4);
list.addValue(5);
list.addValue(6);
list.printAll();
cout<<"Remove the last "<<k<<"th element in LinkedList"<<endl;
removeElementFromList(list,k);
return 0;
} | [
"nampt282@gmail.com"
] | nampt282@gmail.com |
06c4664f69f0b9b4ffc926100a2cd8a0745c745d | edd6612caf27ef3dee6c54a0374e99a1f2baf812 | /Sequential/benchmark/3d/2000.cpp | 1f61a70280cb66a93fc331b30f00d333a43b04b3 | [
"MIT"
] | permissive | w00zie/mean_shift | 92dd860c5519d7f4d0f84ce4cb3d8c436152896b | 603e50ce37a74d7ed28d97f7bf6ac152323fa6b0 | refs/heads/main | 2023-03-12T15:27:19.149218 | 2021-02-24T18:40:24 | 2021-02-24T18:40:24 | 338,558,901 | 3 | 3 | null | null | null | null | UTF-8 | C++ | false | false | 1,576 | cpp | #include <cassert>
#include <chrono>
#include "../../include/meanshift.h"
#include "../../include/container_io.h"
#include "constants_3d.h"
#include <thread>
// Hyperparameters
constexpr auto bandwidth = constants::case_2000::bandwidth;
constexpr auto radius = constants::case_2000::radius;
constexpr auto min_distance = constants::case_2000::min_distance;
constexpr auto niter = constants::niter;
constexpr auto num_trials = constants::num_trials;
// I/O
constexpr auto num_points = constants::case_2000::num_points;
constexpr auto dim = constants::dim;
constexpr auto num_centroids = constants::num_centroids;
const auto data_path = constants::case_2000::data_path;
const auto out_file = constants::case_2000::out_file;
double run_once() {
mean_shift::mat<float, num_points, dim> data = mean_shift::io::load_csv<float, num_points, dim>(data_path, ',');
auto start = std::chrono::high_resolution_clock::now();
const std::vector<mean_shift::vec<float, dim>> centroids = mean_shift::seq::cluster_points<float, num_points, dim>(data, niter, bandwidth, radius, min_distance);
auto end = std::chrono::high_resolution_clock::now();
auto duration = std::chrono::duration_cast<std::chrono::milliseconds>(end - start).count();
return duration;
}
int main(){
mean_shift::vec<double, num_trials> exec_times;
for (size_t i = 0; i < num_trials; ++i) {
exec_times[i] = run_once();
}
std::this_thread::sleep_for (std::chrono::seconds(1));
mean_shift::io::write_csv<double, num_trials>(exec_times, out_file);
return 0;
} | [
"giovanni.bindi@stud.unifi.it"
] | giovanni.bindi@stud.unifi.it |
9ea50cfc96faff22fba02ffb9333aa17520e7272 | 65224f3c4494a5a6493bf6a496cd09323a06c5e6 | /apps-src/apps/studio/mkbootimg.cpp | 70b951055a5565052260d4c4433b523392bcbdd9 | [
"Zlib"
] | permissive | ElderOrb/Rose | 44b4103a5818921fffd67354a118cf921f305d70 | 4834cf5492cac41acd7854c8040d750131add81a | refs/heads/master | 2020-03-23T20:19:01.477902 | 2018-07-23T15:51:13 | 2018-07-23T15:51:13 | 142,034,637 | 0 | 0 | null | 2018-07-23T15:37:05 | 2018-07-23T15:37:05 | null | UTF-8 | C++ | false | false | 7,743 | cpp | /* tools/mkbootimg/mkbootimg.c
**
** Copyright 2007, The Android Open Source Project
**
** 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 <stdio.h>
#include <stdlib.h>
#include <string.h>
// #include <unistd.h>
#include <fcntl.h>
#include <errno.h>
#include "filesystem.hpp"
#include "wml_exception.hpp"
#include "serialization/string_utils.hpp"
// #include "mincrypt/sha.h"
#include <openssl/sha.h>
#include "bootimg.hpp"
/*
static void *load_file(const char *fn, unsigned *_sz)
{
char *data;
int sz;
int fd;
data = 0;
fd = open(fn, O_RDONLY);
if(fd < 0) return 0;
sz = lseek(fd, 0, SEEK_END);
if(sz < 0) goto oops;
if(lseek(fd, 0, SEEK_SET) != 0) goto oops;
data = (char*) malloc(sz);
if(data == 0) goto oops;
if(read(fd, data, sz) != sz) goto oops;
close(fd);
if(_sz) *_sz = sz;
return data;
oops:
close(fd);
if(data != 0) free(data);
return 0;
}
*/
static tfile* load_file(const char *fn, unsigned *_sz)
{
tfile* fp = new tfile(fn, GENERIC_READ, OPEN_EXISTING);
int64_t fsize = fp->read_2_data();
VALIDATE(fsize > 0, null_str);
*_sz = fsize;
return fp;
}
int usage(void)
{
fprintf(stderr,"usage: mkbootimg\n"
" --kernel <filename>\n"
" --ramdisk <filename>\n"
" [ --second <2ndbootloader-filename> ]\n"
" [ --cmdline <kernel-commandline> ]\n"
" [ --board <boardname> ]\n"
" [ --base <address> ]\n"
" [ --pagesize <pagesize> ]\n"
" -o|--output <filename>\n"
);
return 1;
}
static unsigned char padding[16384] = { 0, };
int write_padding(posix_file_t fd, unsigned pagesize, unsigned itemsize)
{
unsigned pagemask = pagesize - 1;
size_t count;
if ((itemsize & pagemask) == 0) {
return 0;
}
count = pagesize - (itemsize & pagemask);
if (posix_fwrite(fd, padding, count) != count) {
return -1;
} else {
return 0;
}
}
bool mkbootimg(const std::string& kernel_fn, const std::string& ramdisk_fn, const std::string& bootimg)
{
VALIDATE(!kernel_fn.empty() && !ramdisk_fn.empty() && !bootimg.empty(), null_str);
boot_img_hdr hdr;
void *kernel_data = 0;
void *ramdisk_data = 0;
char *second_fn = 0;
void *second_data = 0;
std::unique_ptr<tfile> kernel_fp;
std::unique_ptr<tfile> ramdisk_fp;
std::unique_ptr<tfile> second_fp;
char *cmdline = "";
char *board = "";
unsigned pagesize = 2048;
SHA_CTX ctx;
uint8_t sha[SHA_DIGEST_LENGTH];
unsigned base = 0x10000000;
unsigned kernel_offset = 0x00008000;
unsigned ramdisk_offset = 0x01000000;
unsigned second_offset = 0x00f00000;
unsigned tags_offset = 0x00000100;
size_t cmdlen;
memset(&hdr, 0, sizeof(hdr));
/*
while(argc > 0){
char *arg = argv[0];
char *val = argv[1];
if(argc < 2) {
return usage();
}
argc -= 2;
argv += 2;
if(!strcmp(arg, "--output") || !strcmp(arg, "-o")) {
bootimg = val;
} else if(!strcmp(arg, "--second")) {
second_fn = val;
} else if(!strcmp(arg, "--cmdline")) {
cmdline = val;
} else if(!strcmp(arg, "--base")) {
base = strtoul(val, 0, 16);
} else if(!strcmp(arg, "--kernel_offset")) {
kernel_offset = strtoul(val, 0, 16);
} else if(!strcmp(arg, "--ramdisk_offset")) {
ramdisk_offset = strtoul(val, 0, 16);
} else if(!strcmp(arg, "--second_offset")) {
second_offset = strtoul(val, 0, 16);
} else if(!strcmp(arg, "--tags_offset")) {
tags_offset = strtoul(val, 0, 16);
} else if(!strcmp(arg, "--board")) {
board = val;
} else if(!strcmp(arg,"--pagesize")) {
pagesize = strtoul(val, 0, 10);
if ((pagesize != 2048) && (pagesize != 4096)
&& (pagesize != 8192) && (pagesize != 16384)) {
fprintf(stderr,"error: unsupported page size %d\n", pagesize);
return -1;
}
} else {
return usage();
}
}
*/
hdr.page_size = pagesize;
hdr.kernel_addr = base + kernel_offset;
hdr.ramdisk_addr = base + ramdisk_offset;
hdr.second_addr = base + second_offset;
hdr.tags_addr = base + tags_offset;
if(strlen(board) >= BOOT_NAME_SIZE) {
fprintf(stderr,"error: board name too large\n");
return false;
}
strcpy((char *) hdr.name, board);
memcpy(hdr.magic, BOOT_MAGIC, BOOT_MAGIC_SIZE);
cmdlen = strlen(cmdline);
if(cmdlen > (BOOT_ARGS_SIZE + BOOT_EXTRA_ARGS_SIZE - 2)) {
fprintf(stderr,"error: kernel commandline too large\n");
return false;
}
/* Even if we need to use the supplemental field, ensure we
* are still NULL-terminated */
strncpy((char *)hdr.cmdline, cmdline, BOOT_ARGS_SIZE - 1);
hdr.cmdline[BOOT_ARGS_SIZE - 1] = '\0';
if (cmdlen >= (BOOT_ARGS_SIZE - 1)) {
cmdline += (BOOT_ARGS_SIZE - 1);
strncpy((char *)hdr.extra_cmdline, cmdline, BOOT_EXTRA_ARGS_SIZE);
}
kernel_fp.reset(load_file(kernel_fn.c_str(), &hdr.kernel_size));
kernel_data = kernel_fp.get()->data;
ramdisk_fp.reset(load_file(ramdisk_fn.c_str(), &hdr.ramdisk_size));
ramdisk_data = ramdisk_fp.get()->data;
if (second_fn) {
second_fp.reset(load_file(second_fn, &hdr.second_size));
second_data = second_fp.get()->data;
if(second_data == 0) {
fprintf(stderr,"error: could not load secondstage '%s'\n", second_fn);
return false;
}
}
/* put a hash of the contents in the header so boot images can be
* differentiated based on their first 2k.
*/
SHA1_Init(&ctx);
SHA1_Update(&ctx, kernel_data, hdr.kernel_size);
SHA1_Update(&ctx, &hdr.kernel_size, sizeof(hdr.kernel_size));
SHA1_Update(&ctx, ramdisk_data, hdr.ramdisk_size);
SHA1_Update(&ctx, &hdr.ramdisk_size, sizeof(hdr.ramdisk_size));
SHA1_Update(&ctx, second_data, hdr.second_size);
SHA1_Update(&ctx, &hdr.second_size, sizeof(hdr.second_size));
SHA1_Final(sha, &ctx);
memcpy(hdr.id, sha,
SHA_DIGEST_LENGTH > sizeof(hdr.id) ? sizeof(hdr.id) : SHA_DIGEST_LENGTH);
tfile fd(bootimg, GENERIC_WRITE, CREATE_ALWAYS);
VALIDATE(fd.valid(), null_str);
if (posix_fwrite(fd.fp, &hdr, sizeof(hdr)) != sizeof(hdr)) {
goto fail;
}
if (write_padding(fd.fp, pagesize, sizeof(hdr))) {
goto fail;
}
if (posix_fwrite(fd.fp, kernel_data, hdr.kernel_size) != (size_t) hdr.kernel_size) {
goto fail;
}
if (write_padding(fd.fp, pagesize, hdr.kernel_size)) {
goto fail;
}
if (posix_fwrite(fd.fp, ramdisk_data, hdr.ramdisk_size) != (size_t) hdr.ramdisk_size) {
goto fail;
}
if (write_padding(fd.fp, pagesize, hdr.ramdisk_size)) {
goto fail;
}
if (second_data) {
if(posix_fwrite(fd.fp, second_data, hdr.second_size) != (size_t) hdr.second_size) {
goto fail;
}
if(write_padding(fd.fp, pagesize, hdr.second_size)) {
goto fail;
}
}
return true;
fail:
return false;
}
| [
"ancientcc@gmail.com"
] | ancientcc@gmail.com |
7a7ffb2ec3c813ad92a0480f8b6f6347bb59831c | f1fff1ec58708a7770bdd5491ff54349587530e9 | /cpp_playground/ex085/string_view2.cpp | e01f9d1748553f0541e6fadbf47e47d00bfd5540 | [
"MIT"
] | permissive | chgogos/oop | a7077e7c3bfab63de03eb02b64f77e097484589f | 8f8e9d7f2abd58acf48c2adce6550971c91cfcf7 | refs/heads/master | 2022-06-28T03:44:37.732713 | 2022-06-06T11:41:15 | 2022-06-06T11:41:15 | 171,113,310 | 16 | 11 | null | null | null | null | UTF-8 | C++ | false | false | 537 | cpp | #include <iostream>
#include <string>
using namespace std;
int main()
{
string s{"ABCDEF"}; // γίνεται αντιγραφή του C-string στο string
string_view sv1{s}; // δεν γίνεται αντιγραφή του C-string στο string_view
string_view sv2{s}; // δεν γίνεται αντιγραφή του C-string στο string_view
cout << s << " " << sv1 << " " << sv2 << endl;
s[0]='*';
cout << s << " " << sv1 << " " << sv2 << endl;
return 0;
}
/*
ABCDEF ABCDEF
*BCDEF *BCDEF
*/ | [
"chgogos@gmail.com"
] | chgogos@gmail.com |
46d91734eaa40e1df2b6d2e612e4abc6453e73f4 | 390f1a646be5d72e395d9b179f2090966db1ec78 | /src/bthread/work_stealing_queue.h | b7cc2e5f6938ec0ab779b3381f164bbeba1fe19b | [
"Apache-2.0"
] | permissive | eesly/brpc | 558f859edf2791c4aa960a7e1bd13b722206773d | 99ce6d2d7b3868bcf485d1a8a3b54e71899be866 | refs/heads/master | 2021-07-05T06:39:41.206746 | 2017-09-29T11:53:44 | 2017-09-29T11:53:44 | 105,291,579 | 3 | 2 | null | 2017-09-29T16:02:25 | 2017-09-29T16:02:25 | null | UTF-8 | C++ | false | false | 5,107 | h | // bthread - A M:N threading library to make applications more concurrent.
// Copyright (c) 2012 Baidu, 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.
// Author: Ge,Jun (gejun@baidu.com)
// Date: Tue Jul 10 17:40:58 CST 2012
#ifndef BAIDU_BTHREAD_WORK_STEALING_QUEUE_H
#define BAIDU_BTHREAD_WORK_STEALING_QUEUE_H
#include "butil/macros.h"
#include "butil/atomicops.h"
#include "butil/logging.h"
namespace bthread {
template <typename T>
class WorkStealingQueue {
public:
WorkStealingQueue()
: _bottom(1)
, _capacity(0)
, _buffer(NULL)
, _top(1) {
}
~WorkStealingQueue() {
delete [] _buffer;
_buffer = NULL;
}
int init(size_t capacity) {
if (_capacity != 0) {
LOG(ERROR) << "Already initialized";
return -1;
}
if (capacity == 0) {
LOG(ERROR) << "Invalid capacity=" << capacity;
return -1;
}
if (capacity & (capacity - 1)) {
LOG(ERROR) << "Invalid capacity=" << capacity
<< " which must be power of 2";
return -1;
}
_buffer = new(std::nothrow) T[capacity];
if (NULL == _buffer) {
return -1;
}
_capacity = capacity;
return 0;
}
// Push an item into the queue.
// Returns true on pushed.
// May run in parallel with steal().
// Never run in parallel with pop() or another push().
bool push(const T& x) {
const size_t b = _bottom.load(butil::memory_order_relaxed);
const size_t t = _top.load(butil::memory_order_acquire);
if (b >= t + _capacity) { // Full queue.
return false;
}
_buffer[b & (_capacity - 1)] = x;
_bottom.store(b + 1, butil::memory_order_release);
return true;
}
// Pop an item from the queue.
// Returns true on popped and the item is written to `val'.
// May run in parallel with steal().
// Never run in parallel with push() or another pop().
bool pop(T* val) {
const size_t b = _bottom.load(butil::memory_order_relaxed);
size_t t = _top.load(butil::memory_order_relaxed);
if (t >= b) {
// fast check since we call pop() in each sched.
// Stale _top which is smaller should not enter this branch.
return false;
}
const size_t newb = b - 1;
_bottom.store(newb, butil::memory_order_relaxed);
butil::atomic_thread_fence(butil::memory_order_seq_cst);
t = _top.load(butil::memory_order_relaxed);
if (t > newb) {
_bottom.store(b, butil::memory_order_relaxed);
return false;
}
*val = _buffer[newb & (_capacity - 1)];
if (t != newb) {
return true;
}
// Single last element, compete with steal()
const bool popped = _top.compare_exchange_strong(
t, t + 1, butil::memory_order_seq_cst, butil::memory_order_relaxed);
_bottom.store(b, butil::memory_order_relaxed);
return popped;
}
// Steal one item from the queue.
// Returns true on stolen.
// May run in parallel with push() pop() or another steal().
bool steal(T* val) {
size_t t = _top.load(butil::memory_order_acquire);
size_t b = _bottom.load(butil::memory_order_acquire);
if (t >= b) {
// Permit false negative for performance considerations.
return false;
}
do {
butil::atomic_thread_fence(butil::memory_order_seq_cst);
b = _bottom.load(butil::memory_order_acquire);
if (t >= b) {
return false;
}
*val = _buffer[t & (_capacity - 1)];
} while (!_top.compare_exchange_strong(t, t + 1,
butil::memory_order_seq_cst,
butil::memory_order_relaxed));
return true;
}
size_t volatile_size() const {
const size_t b = _bottom.load(butil::memory_order_relaxed);
const size_t t = _top.load(butil::memory_order_relaxed);
return (b <= t ? 0 : (b - t));
}
size_t capacity() const { return _capacity; }
private:
// Copying a concurrent structure makes no sense.
DISALLOW_COPY_AND_ASSIGN(WorkStealingQueue);
butil::atomic<size_t> _bottom;
size_t _capacity;
T* _buffer;
butil::atomic<size_t> BAIDU_CACHELINE_ALIGNMENT _top;
};
} // namespace bthread
#endif // BAIDU_BTHREAD_WORK_STEALING_QUEUE_H
| [
"gejun@baidu.com"
] | gejun@baidu.com |
1c538a309e6f65e0c1905dbf91f66dabee43d8d8 | c7c2d1b63d4e5c721f34eca6cfd1398db5bf5e64 | /PBL_Engine/game-states.hpp | 35a332fce2159f0c1fbed63abe571a56a5269a85 | [] | no_license | AdamJozwiak/PBL_Endless_Project | 365ed80ce724a9a1f844212de26eb8d4718a72ef | 96fba2d2d78f745df98160e470d28f7d4c050633 | refs/heads/master | 2021-07-22T17:05:20.737893 | 2020-06-29T19:41:39 | 2020-06-29T19:56:28 | 245,690,594 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 277 | hpp | #pragma once
enum GameState {
GAME_LAUNCH_FADE_IN,
MENU,
CHANGE_MENU_TYPE_TO_MAIN,
CHANGE_MENU_TYPE_TO_PAUSE,
MENU_TO_GAME_FADE_OUT,
NEW_GAME_SETUP,
GAME_FADE_IN,
GAME,
DEATH_RESULTS,
RESULTS_TO_GAME_FADE_OUT,
GAME_EXIT_FADE_OUT
};
| [
"TomaszMWitczak@gmail.com"
] | TomaszMWitczak@gmail.com |
fdbda2b6a6a4ef61053cdf89e64e34bec71b1b72 | b991b3822572e13c1a0e17f037564326d4932ff6 | /available-captures-for-rook/Accepted/3-12-2021, 11_54_30 AM/Solution.cpp | 0956005bc908863c3ce0257cd15655e25f47f287 | [] | no_license | isaigm/leetcode | 8f1188a824e78f11b8223302fe625e9a8bf9262a | e53b04a9f627ff95aaae9f8e5315f5f688c6b9e2 | refs/heads/master | 2023-01-06T02:07:41.118942 | 2022-12-31T23:13:20 | 2022-12-31T23:13:20 | 248,679,884 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,696 | cpp | // https://leetcode.com/problems/available-captures-for-rook
class Solution {
public:
int numRookCaptures(vector<vector<char>>& board) {
int rook_row = -1;
int rook_col = -1;
int ans = 0;
for(int i = 0; i < 8; i++)
{
for(int j = 0; j < 8; j++)
{
if(board[i][j] == 'R')
{
rook_row = i;
rook_col = j;
break;
}
}
if(rook_row != -1 && rook_col != -1)
{
break;
}
}
for(int i = rook_col; i < 8; i++)
{
if(board[rook_row][i] == 'B') {
break;
}else if(board[rook_row][i] == 'p')
{
ans++;
break;
}
}
for(int i = rook_col; i >= 0; i--)
{
if(board[rook_row][i] == 'B') {
break;
}else if(board[rook_row][i] == 'p')
{
ans++;
break;
}
}
for(int i = rook_row; i < 8; i++)
{
if(board[i][rook_col] == 'B') {
break;
}else if(board[i][rook_col] == 'p')
{
ans++;
break;
}
}
for(int i = rook_row; i >= 0; i--)
{
if(board[i][rook_col] == 'B') {
break;
}else if(board[i][rook_col] == 'p')
{
ans++;
break;
}
}
return ans;
}
}; | [
"isaigm23@gmail.com"
] | isaigm23@gmail.com |
93440ab6408de4bf0c01bb3d3f3f52542e13ccb6 | 1468b015f5ce882dbd39dc75c9a6560179a936fb | /card/M39308.cpp | 9ae96c4f8cea356228086f1d898de4896acb4977 | [] | no_license | Escobaj/HearthstoneResolver | cbfc682993435c01f8b75d4409c99fb4870b9bb3 | c93b693ef318fc9f43d35e81931371f626147083 | refs/heads/master | 2021-04-30T22:31:01.247134 | 2017-01-31T00:05:32 | 2017-01-31T00:05:32 | 74,474,216 | 8 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 397 | cpp | //
// Created by Jo on 19/12/2016.
//
#include "M39308.h"
M39308::M39308(const EventHandler &e) : Minion(e) {
this->set_id(39308);
this->set_attackMax(0);
this->set_defaultCost(2);
this->set_name("Bouclier animé");
this->set_membership(Class::NEUTRAL);
this->set_type(CardType::GENERAL);
this->set_attackMax(0);
this->set_maxHealth(5);
}
void M39308::init() {
} | [
"joffrey.ecobar@epitech.eu"
] | joffrey.ecobar@epitech.eu |
8e5f595423b720c04abcc9bbe41b6f0d94c47001 | 94e5a9e157d3520374d95c43fe6fec97f1fc3c9b | /UVA/10139.cpp | 234a30dd5f7194ca9f4fa0a4948663685e416da4 | [
"MIT"
] | permissive | dipta007/Competitive-Programming | 0127c550ad523884a84eb3ea333d08de8b4ba528 | 998d47f08984703c5b415b98365ddbc84ad289c4 | refs/heads/master | 2021-01-21T14:06:40.082553 | 2020-07-06T17:40:46 | 2020-07-06T17:40:46 | 54,851,014 | 8 | 4 | null | 2020-05-02T13:14:41 | 2016-03-27T22:30:02 | C++ | UTF-8 | C++ | false | false | 5,085 | cpp | #pragma comment(linker, "/stack:640000000")
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <fstream>
#include <iostream>
#include <iomanip>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using namespace std;
const double EPS = 1e-9;
const int INF = 0x7f7f7f7f;
const double PI=acos(-1.0);
#define READ(f) freopen(f, "r", stdin)
#define WRITE(f) freopen(f, "w", stdout)
#define MP(x, y) make_pair(x, y)
#define SZ(c) (int)c.size()
#define PB(x) push_back(x)
#define rep(i,n) for(i=1;i<=n;i++)
#define repI(i,n) for(i=0;i<n;i++)
#define F(i,L,R) for (int i = L; i < R; i++)
#define FF(i,L,R) for (int i = L; i <= R; i++)
#define FR(i,L,R) for (int i = L; i > R; i--)
#define FRF(i,L,R) for (int i = L; i >= R; i--)
#define FOREACH(i,t) for (typeof(t.begin()) i=t.begin(); i!=t.end(); i++)
#define ALL(p) p.begin(),p.end()
#define ALLR(p) p.rbegin(),p.rend()
#define SET(p) memset(p, -1, sizeof(p))
#define CLR(p) memset(p, 0, sizeof(p))
#define MEM(p, v) memset(p, v, sizeof(p))
#define CPY(d, s) memcpy(d, s, sizeof(s))
#define getI(a) scanf("%d", &a)
#define getII(a,b) scanf("%d%d", &a, &b)
#define getIII(a,b,c) scanf("%d%d%d", &a, &b, &c)
#define getL(a) scanf("%lld",&a)
#define getLL(a,b) scanf("%lld%lld",&a,&b)
#define getLLL(a,b,c) scanf("%lld%lld%lld",&a,&b,&c)
#define getC(n) scanf("%c",&n)
#define getF(n) scanf("%lf",&n)
#define getS(n) scanf("%s",n)
#define vi vector < int >
#define vii vector < vector < int > >
#define pii pair< int, int >
#define psi pair< string, int >
#define ff first
#define ss second
#define ll long long
#define ull unsigned long long
#define ui unsigned int
#define us unsigned short
#define ld long double
template< class T > inline T _abs(T n)
{
return ((n) < 0 ? -(n) : (n));
}
template< class T > inline T _max(T a, T b)
{
return (!((a)<(b))?(a):(b));
}
template< class T > inline T _min(T a, T b)
{
return (((a)<(b))?(a):(b));
}
template< class T > inline T _swap(T &a, T &b)
{
a=a^b;
b=a^b;
a=a^b;
}
template< class T > inline T gcd(T a, T b)
{
return (b) == 0 ? (a) : gcd((b), ((a) % (b)));
}
template< class T > inline T lcm(T a, T b)
{
return ((a) / gcd((a), (b)) * (b));
}
//******************DELETE****************
#define shubhashis
#ifdef shubhashis
#define debug(args...) {cerr<<"Debug: "; dbg,args; cerr<<endl;}
#else
#define debug(args...) // Just strip off all debug tokens
#endif
struct debugger
{
template<typename T> debugger& operator, (const T& v)
{
cerr<<v<<" ";
return *this;
}
} dbg;
int bitOn(int N,int pos)
{
return N=N | (1<<pos);
}
int bitOff(int N,int pos)
{
return N=N & ~(1<<pos);
}
bool bitCheck(int N,int pos)
{
return (bool)(N & (1<<pos));
}
#define M 1000000
bool marked[M];
vector <int> primes;
void sieve(int n)
{
primes.push_back(2);
int sqrtn = sqrt(n);
for (ll i = 3; i <= sqrtn; i += 2)
{
if (marked[i] == 0)
{
primes.push_back(i);
for (ll j = i * i; j <= sqrtn; j += i + i)
{
marked[j] = 1;
}
}
}
}
// prime number sob serially "primes" vector e save hobe
// like primes[0]=2,primes[1]=3 and so on
vector<int>factors,power;
void factorize( int n )
{
int sqrtn = sqrt ( n );
for ( int i = 0; i < primes.size() && primes[i] <= sqrtn; i++ )
{
if ( n % primes[i] == 0 )
{
//debug(n,primes[i])
int cnt=0;
while ( n % primes[i] == 0 )
{
n /= primes[i];
cnt++;
}
power.PB(cnt);
factors.push_back(primes[i]);
//debug(n)
sqrtn = sqrt ( n );
}
}
if ( n != 1 )
{
power.PB(1);
factors.push_back(n);
}
}
int main()
{
//READ("in.txt");
//WRITE("out.txt");
sieve(2147483647);
int a,b;
while(~getII(a,b))
{
factors.clear();
power.clear();
factorize(b);
int flg=1;
for(int i=0;i<factors.size();i++)
{
int k = factors[i];
int x =a;
int cnt=0;
while(x/k)
{
cnt += x/=k;
}
if(power[i]>cnt)
{
flg=0;
break;
}
}
if(flg) printf("%d divides %d!\n",b,a);
else printf("%d does not divide %d!\n",b,a);
}
return 0;
}
| [
"iamdipta@gmail.com"
] | iamdipta@gmail.com |
d703f17d2e83585de15d3730bf6e20a61799e11f | db6472f1fb7f91aabf3dbc070ca102cd62819232 | /02cpp/02cpp/02cpp/03.cpp | d3f8a24bd93a03491d8c7181748b9e0c0f5dad8c | [] | no_license | Jiwangreal/learn_cpp_with_me | 4d73c6948ab661a25e679fb28aa2fe23846a021b | 2aaf71899fbd1e1ea4bdc472133f7df41e8ab63b | refs/heads/main | 2023-05-05T22:46:13.528739 | 2021-05-30T10:49:31 | 2021-05-30T10:49:31 | 311,383,491 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 267 | cpp | #include <iostream>
using namespace std;
#define STR(a) #a
#define CAT(a,b) a##b
int main(void)
{
int xy = 100;
cout<<STR(ABCD)<<endl; //#ABCD <=> "ABCD" 转换为字符串,输出为ABCD
cout<<CAT(x, y)<<endl; //x##y <=> xy 输出为100
return 0;
} | [
"jiwangreal@163.com"
] | jiwangreal@163.com |
a367bb53732b50f31340bba138c5189b9bfe74e0 | 2105d799e68c94297d65e924c7f45a1dbd796977 | /src/Core/QScheduler_p.h | 8560a18f7196726cce0f4f9748e93b9364d8e14e | [
"MIT"
] | permissive | ericzh86/qt-toolkit | 1136ec79fd3e76dd40e2323872a86849e6b1146e | 63ec071f8989d6efcc4afa30fa98ede695edba27 | refs/heads/master | 2020-12-05T21:48:21.419112 | 2020-01-10T03:05:23 | 2020-01-10T03:05:23 | 232,256,283 | 4 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 543 | h | #ifndef QSCHEDULER_P_H
#define QSCHEDULER_P_H
#include <QHash>
#include "QScheduler.h"
class QSchedulerPrivate
{
Q_DECLARE_PUBLIC(QScheduler)
public:
QSchedulerPrivate();
virtual ~QSchedulerPrivate();
protected:
QScheduler *q_ptr;
public:
static bool initialized;
public:
static QScheduler *createScheduler();
protected:
static QScheduler *instance;
static QSettings *settings;
protected:
typedef std::function<bool()> Functor;
QHash<QString, Functor> routeFunctors;
};
#endif // QSCHEDULER_P_H
| [
"ericzh@qtower.com"
] | ericzh@qtower.com |
8a422c0282917d5812f5724ed601d600ec413e7f | 8c881345865a01b5c63a5bb076f126403716420c | /FeatureReuse3/FeatureReuse/trimesh/include/ICP.h | f058cfb69652b8e2b43adee0249e80a803ed426b | [] | no_license | Asher-1/C_Plus_Plus-projects | f758df626de074a5a5071c6bf1ae08cfb5c4d2e3 | 56941f1a76cf1645df5cc0fcb5529eddc64643f2 | refs/heads/master | 2022-01-28T13:03:24.493838 | 2019-05-30T13:06:35 | 2019-05-30T13:06:35 | 160,189,947 | 3 | 2 | null | null | null | null | GB18030 | C++ | false | false | 1,641 | h | #ifndef ICP_H
#define ICP_H
/*
Szymon Rusinkiewicz
Princeton University
ICP.h
Routines for doing ICP.
*/
#ifdef _DEBUG // 内存泄漏检测支持。
#define _CRTDBG_MAP_ALLOC
#include <stdlib.h>
#include <malloc.h> // 解决 malloc.h 与 crtdbg.h 顺序导致的 Debug Assertion Failed, "Corrupted pointer passed to _freea" 。
#include <crtdbg.h>
#ifndef DBG_NEW
#define DBG_NEW new ( _NORMAL_BLOCK , __FILE__ , __LINE__ )
#define new DBG_NEW
#endif
#endif // _DEBUG
#include "TriMesh.h"
#include "XForm.h"
#include "KDtree.h"
namespace trimesh {
// Determine which points on s1 and s2 overlap the other, filling in o1 and o2
// Also fills in maxdist, if it is <= 0 on input
extern void compute_overlaps(TriMesh *s1, TriMesh *s2,
const xform &xf1, const xform &xf2,
const KDtree *kd1, const KDtree *kd2,
::std::vector<float> &o1, ::std::vector<float> &o2,
float &maxdist, int verbose);
// Do ICP. Aligns mesh s2 to s1, updating xf2 with the new transform.
// Returns alignment error, or -1 on failure.
// Pass in 0 for maxdist to figure it out...
// Pass in vector<float>() for weights to figure it out...
extern float ICP(TriMesh *s1, TriMesh *s2,
const xform &xf1, xform &xf2,
const KDtree *kd1, const KDtree *kd2,
::std::vector<float> &weights1, ::std::vector<float> &weights2,
float maxdist = 0.0f, int verbose = 0,
bool do_scale = false, bool do_affine = false);
// Easier-to-use interface to ICP
extern float ICP(TriMesh *s1, TriMesh *s2, const xform &xf1, xform &xf2,
int verbose = 0,
bool do_scale = false, bool do_affine = false);
}; // namespace trimesh
#endif
| [
"ludahai19@163.com"
] | ludahai19@163.com |
7d2160d3e2fb63d4f74fe1b0f8ccf0d2951f3c24 | c0afc76666468811ed4a269e880b64a4b01658d2 | /Project(winapi)/winmain.cpp | e36cb9f86ed985f9f1f6d8b47d0dcbdc7fd58878 | [] | no_license | lhj1230/lee-hyun-ju | 1e1b696c9cd5f3691f44c0691689f9a7fa24b535 | fe850180c5a1bd348f0cb300c2a93516753bffd5 | refs/heads/master | 2022-12-22T18:16:26.955841 | 2020-09-29T11:57:15 | 2020-09-29T11:57:15 | null | 0 | 0 | null | null | null | null | UHC | C++ | false | false | 3,321 | cpp | #include<windows.h>
LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
HINSTANCE g_hInst;//글로벌 인스턴스핸들값
LPCTSTR lpszClass = TEXT("Circle"); //창이름
int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPervlnstance, LPSTR lpszCmdParam, int nCmdShow)
{
HWND hWnd;
MSG Message;
WNDCLASS WndClass;
g_hInst = hInstance;
//WndClass는 기본 윈도우환경을 만드는 구조체다. 맴버변수는 밑에와 같다.
WndClass.cbClsExtra = 0; //예약영역
WndClass.cbWndExtra = 0; //예약영역 (신경x)
WndClass.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH); //배경색
WndClass.hCursor = LoadCursor(NULL, IDC_ARROW); //커서
WndClass.hIcon = LoadIcon(NULL, IDI_APPLICATION); //아이콘 모양
WndClass.hInstance = hInstance;//(프로그램 핸들값(번호)등록)
WndClass.lpfnWndProc = WndProc; //프로세스 함수 호출
WndClass.lpszClassName = lpszClass; //클레스 이름
WndClass.lpszMenuName = NULL;
WndClass.style = CS_HREDRAW | CS_VREDRAW;//윈도우의 수직과 수평이 변경 시 다시 그린다.
RegisterClass(&WndClass); //만들어진 WidClass를 등록
hWnd = CreateWindow(lpszClass, lpszClass, WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, NULL, (HMENU)NULL, hInstance, NULL);
ShowWindow(hWnd, nCmdShow);
while (GetMessage(&Message, NULL, 0, 0))//사용자에게 메시지를 받아오는 함수(WM_QUIT 메시지 받을 시 종료)
{
TranslateMessage(&Message); // 키보드 입력 메시지 처리함수
DispatchMessage(&Message); //받은 메시지를 WndProc에 전달하는 함수
}
return (int)Message.wParam;
}
LRESULT CALLBACK WndProc(HWND hWnd, UINT iMessage, WPARAM wParam, LPARAM lParam)
{
HDC hdc;
int radius = 21;
PAINTSTRUCT ps;
int a = 20;
int b = 40;
switch (iMessage)
{
case WM_DESTROY:// 윈도우가 파괴되었다는 메세지
PostQuitMessage(0); //GetMessage함수에 WM_QUIT 메시지를 보낸다.
return 0; //WndProc의 Switch는 break 대신 return 0; 를 쓴다.
case WM_LBUTTONDOWN:
hdc = GetDC(hWnd);
SetTextAlign(hdc, TA_TOP | TA_RIGHT);
TextOut(hdc, 100, 100, TEXT("Beautiful Korea"), 15);
ReleaseDC(hWnd, hdc);
return 0;
case WM_RBUTTONDOWN:
hdc = GetDC(hWnd);
SetTextAlign(hdc, TA_BOTTOM | TA_LEFT);
TextOut(hdc, 100, 100, TEXT("Beautiful Korea"), 15);
ReleaseDC(hWnd, hdc);
return 0;
case WM_PAINT:
hdc = BeginPaint(hWnd, &ps);
//원 공식 : r * r == (x - r)^ + (y - r)^->삼각함수로 수정
for (int x = 0; x <= radius * 2; x++)//x, y 반지름 * 2 == 지름만큼
for (int y = 0; y <= radius * 2; y++)
if (radius * radius > (x - radius) * (x - radius) + (y - radius) * (y - radius))//해당 공식의 범위값 안에서 점을 그림
SetPixel(hdc, 120 + x, y, RGB(0, 0, 0));
//타원 공식 : x^ / a^ + y^ / b^ = 1
//x^ + y^ * a^ / b^ = a^
//x^ * b^ + y^ * a^ = a^ * b^
for (int x = -a; x <= a; x++)
for (int y = -b; y <= b; y++)
if (a * a * b * b > x * x * b * b + y * y * a * a)
SetPixel(hdc, 120 + x, 100 + y, RGB(0, 0, 0));
//Ellipse(hdc, 100, 100, 200, 200);
//Ellipse(hdc, 220, 100, 400, 200);
EndPaint(hWnd, &ps);
return 0;
}
return(DefWindowProc(hWnd, iMessage, wParam, lParam)); // case에 있는 메시지를 제외한 나머지 메시지를 처리한다.
} | [
"hjl971230@gmail.com"
] | hjl971230@gmail.com |
e166837c8879ecf6976d8d11350b8676a190f279 | 54fc0bf1e2418d8ca039eee36824b499d3b7859e | /include/QCAR/VideoBackgroundConfig.h | 2deec2bee5dd4ab7abc370180a36cb1c3ad2f4c7 | [] | no_license | skucher/Scanner3D | e1396dc6ba05ef559ea357ecd1992538d7e3fb07 | e582c0de62b99adcf7a5dade1a5a2e88495ef0ac | refs/heads/master | 2020-12-24T17:36:15.708384 | 2013-01-04T13:45:51 | 2013-01-04T13:45:51 | 3,010,463 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,773 | h | /*==============================================================================
Copyright (c) 2010-2011 QUALCOMM Austria Research Center GmbH .
All Rights Reserved.
Qualcomm Confidential and Proprietary
@file
VideoBackgroundConfig.h
@brief
Header file for VideoBackgroundConfig struct.
==============================================================================*/
#ifndef _QCAR_VIDEOBACKGROUNDCONFIG_H_
#define _QCAR_VIDEOBACKGROUNDCONFIG_H_
// Include files
#include <QCAR/Vectors.h>
namespace QCAR
{
/// Video background configuration
struct VideoBackgroundConfig
{
/// Enables/disables rendering of the video background.
bool mEnabled;
/// Enables/disables synchronization of video background and tracking data.
/**
* Depending on the video background rendering mode this may not always be
* possible. If deactivated the video background always shows the latest
* camera image.
*/
bool mSynchronous;
/// Relative position of the video background in the render target in
/// pixels.
/**
* Describes the offset of the center of video background to the
* center of the screen (viewport) in pixels. A value of (0,0) centers the
* video background, whereas a value of (-10,15) moves the video background
* 10 pixels to the left and 15 pixels upwards.
*/
Vec2I mPosition;
/// Width and height of the video background in pixels
/**
* Using the device's screen size for this parameter scales the image to
* fullscreen. Notice that if the camera's aspect ratio is different than
* the screen's aspect ratio this will create a non-uniform stretched
* image.
*/
Vec2I mSize;
};
} // namespace QCAR
#endif //_QCAR_RENDERER_H_
| [
"sergeyku4er@gmail.com"
] | sergeyku4er@gmail.com |
ea60e9f16c879cf9ed6862efc3782932a6933ad1 | 595f3608b6563f5cf162159704d7175326bb576f | /Src/AmrTask/rts_impls/upcxx/PerillaRts.cpp | f39bf87ac34335a2ff158d437099704b58186010 | [
"BSD-2-Clause"
] | permissive | ChrisDeGrendele/amrex | b89ca9f5a3b475ee730ed5371f318eae2841e8b5 | 586ea4491d9920d4bb0b925cf3809cb1de1df493 | refs/heads/master | 2020-06-02T18:17:16.998018 | 2019-05-31T20:50:55 | 2019-05-31T20:50:55 | 191,254,393 | 0 | 0 | NOASSERTION | 2019-06-10T22:29:00 | 2019-06-10T22:28:59 | null | UTF-8 | C++ | false | false | 5,248 | cpp | //Question? email tannguyen@lbl.gov
//Created 07-19-2017
//Last modification 08-14-2017
#include <mpi.h>
#include <sched.h>
#include <sys/syscall.h>
#include <unistd.h>
#include <mylock.h>
#include <pthread.h>
#include "PerillaRts.H"
#include <iostream>
#include <queue>
using namespace std;
#include <cassert>
using namespace perilla;
#ifdef PERILLA_DEBUG
#include <PerillaMemCheck.H>
PerillaMemCheck memcheck;
#endif
namespace perilla{
Amr* amrptr;
struct RtsDomain{
pthread_t *_threads;
int _size;
MyLock _lock;
RtsDomain():_threads(NULL), _size(0){};
~RtsDomain(){
free(_threads);
}
};
int numa_nodes;
RtsDomain *dom;
MyLock _l;
volatile char startSignal=0;
pthread_mutex_t startLock= PTHREAD_MUTEX_INITIALIZER;
int RTS::ProcCount(){
return _nProcs;
}
int RTS::MyProc(){
return _rank;
}
int RTS::WorkerThreadCount(){
return _nWrks;
}
int RTS::MyWorkerThread(){
return 0;
}
struct argT {
int numaID;
int tid;
int g_tid;
int nThreads;
int nTotalThreads;
int max_step;
Real stop_time;
RTS* thisRTS;
};
void RTS::runAMR(Amr* amr, int max_step, Real stop_time){
while (amr->okToContinue() &&
(amr->levelSteps(0) < max_step || max_step < 0) &&
(amr->cumTime() < stop_time || stop_time < 0.0) )
{
// Do a coarse timestep, which calls one or multiple timestep updates (i.e. timeStep()) at each AMR level
amr->coarseTimeStep(stop_time);
}
}
#ifdef USE_PERILLA_PTHREADS
void run(void* threadInfo){
argT *args= (argT*)threadInfo;
int numaID= args->numaID;
int tid= args->tid;
int g_tid= args->g_tid;
int nThreads= args->nThreads;
int nTotalThreads= args->nTotalThreads;
int max_step= args->max_step;
Real stop_time= args->stop_time;
RTS* rts= args->thisRTS;
Perilla::registerId(g_tid);
//done with thread id setup, now wait for the start signal from master
pthread_mutex_lock(&startLock);
startSignal++;
pthread_mutex_unlock(&startLock);
while(startSignal!= nTotalThreads){}
rts->runAMR(amrptr, max_step, stop_time);
}
#endif
void InitializeMPI(){
int provided;
MPI_Init_thread(0, 0, MPI_THREAD_FUNNELED, &provided);
if(provided == MPI_THREAD_SINGLE){//with this MPI, process can't spawn threads
cerr << "Spawning threads is not allowed by the MPI implementation" << std::endl;;
}
}
void RTS::RTS_Init(){
amrptr= NULL;
}
void RTS::Init(){
InitializeMPI();
MPI_Comm_rank(MPI_COMM_WORLD, &_rank);
MPI_Comm_size(MPI_COMM_WORLD, &_nProcs);
RTS_Init();
}
void RTS::Init(int rank, int nProcs){
_rank= rank;
_nProcs= nProcs;
RTS_Init();
}
void RTS::Finalize(){
#ifdef PERILLA_DEBUG
memcheck.report();
#endif
}
void RTS::Iterate(void* amrGraph, int max_step, Real stop_time){
assert(amrGraph);
Perilla::max_step= max_step;
amrptr= (Amr*)amrGraph;
WorkerThread::init();
#ifndef USE_PERILLA_PTHREADS
runAMR(amrptr, max_step, stop_time);
#else
int numa_nodes= perilla::NUM_THREAD_TEAMS;
int worker_per_numa = perilla::NUM_THREADS_PER_TEAM;
int _nWrks= numa_nodes*worker_per_numa;
int base=0;
int localID=-1;
//create a list of persistent threads for each NUMA node
cpu_set_t cpuset;
pthread_attr_t attr;
pthread_attr_init(&attr);
dom= new RtsDomain[numa_nodes];
for(int i=0; i<numa_nodes; i++){
dom[i]._threads= new pthread_t[worker_per_numa];
}
for(int i=0, domNo=-1; i<_nWrks; i++){
localID++;
if(localID==0){
domNo++;
}
CPU_ZERO(&cpuset);
CPU_SET(base+localID, &cpuset);
if(! (localID==0 && domNo==0)){
pthread_attr_setaffinity_np(&attr, sizeof(cpu_set_t), &cpuset);
argT* arg= new argT;
arg->numaID= domNo;
arg->tid= localID;
arg->g_tid= domNo*worker_per_numa+localID;
arg->nThreads= worker_per_numa;
arg->nTotalThreads= _nWrks;
arg->thisRTS= this;
arg->max_step= max_step;
arg->stop_time= stop_time;
int err = pthread_create(&(dom[domNo]._threads[localID]), &attr, (void*(*)(void*))run, arg);
}else{ //master thread
dom[domNo]._threads[localID]= pthread_self();
Perilla::registerId(0);
//enable worker threads to start computing
pthread_mutex_lock(&startLock);
startSignal++;
pthread_mutex_unlock(&startLock);
}
dom[domNo]._size++;
if(localID == (worker_per_numa-1)){
localID=-1;
base+= worker_per_numa;
}
}
while(startSignal!= _nWrks){}//wait until all threads have done the setup phase
runAMR(amrptr, max_step, stop_time);
for(int i=1; i<_nWrks; i++) pthread_join(dom[i/worker_per_numa]._threads[i%worker_per_numa], NULL);
#endif
}
#if 0
const double kMicro = 1.0e-6;
double RTS::Time()
{
struct timeval TV;
const int RC = gettimeofday(&TV, NULL);
if(RC == -1)
{
printf("ERROR: Bad call to gettimeofday\n");
return(-1);
}
return( ((double)TV.tv_sec) + kMicro * ((double)TV.tv_usec) );
}
#endif
void RTS::Barrier(){
//nothing
}
}//end namespace
| [
"tannguyen@lbl.gov"
] | tannguyen@lbl.gov |
5cc8ac5f9f8245b987848e62b75773eee02d2866 | 5753c2ea3d8991325f54bff8b5b8ef3d73131913 | /src/Window/GLFWWindow.cpp | 91cc3c6110f1a53c2f9d4b74ae466def67f9c894 | [
"MIT"
] | permissive | JacobNeal/cyberRenderer | d9f34db2e76b076515a029d98935d4a92daa12f9 | 76a4c5d935198a82ff092805ff69b7ceb80a58cf | refs/heads/master | 2020-03-26T10:05:12.309064 | 2018-08-29T14:44:24 | 2018-08-29T14:44:24 | 144,780,532 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 7,538 | cpp | ////////////////////////////////////////////////////////////
//
// cyberEngine
// The MIT License (MIT)
// Copyright (c) 2018 Jacob Neal
//
// 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.
//
//////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////
// Headers
//////////////////////////////////////////////////////////////
#include "Window/GLFWWindow.hpp"
namespace ce
{
//////////////////////////////////////////////////////////////
GLFWWindow::GLFWWindow(const char * title, const GLuint & width, const GLuint & height)
: Window(width, height)
{
//////////////////////////////////////////////
// Set up GLFW
//////////////////////////////////////////////
glfwInit();
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
#if __APPLE__
glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);
#endif
glfwWindowHint(GLFW_RESIZABLE, GL_FALSE);
//////////////////////////////////////////////
// Create the GLFW window for rendering.
//////////////////////////////////////////////
m_window = glfwCreateWindow(width, height, title, nullptr, nullptr);
if (m_window == nullptr)
{
LOG("Failed to create the GLFW framework window.");
glfwTerminate();
}
//////////////////////////////////////////////
// Tell GLFW to make the context of our window
// the main context on the current thread.
//////////////////////////////////////////////
glfwMakeContextCurrent(m_window);
//////////////////////////////////////////////
// Set up GL3W to initialize OpenGL
//////////////////////////////////////////////
if (gl3wInit())
LOG("Failed to initialize GL3W.");
if (!gl3wIsSupported(3, 3))
LOG("OpenGL 3.3 is not supported.");
LOG("OpenGL " + std::string((char *)glGetString(GL_VERSION)) + ", " +
"GLSL " + std::string((char *)glGetString(GL_SHADING_LANGUAGE_VERSION)));
//////////////////////////////////////////////
// Tell OpenGL the size of the rendering window.
//////////////////////////////////////////////
glViewport(0, 0, width, height);
glEnable(GL_DEPTH_TEST);
GLenum err;
while((err = glGetError()) != GL_NO_ERROR) LOG("OpenGL Error: " + std::to_string(int(err)));
int windowXPos, windowYPos;
glfwGetWindowPos(m_window, &windowXPos, &windowYPos);
glfwSetWindowPos(m_window, windowXPos + 1, windowYPos);
//////////////////////////////////////////////
// Set the GLFW key callback for the window.
//////////////////////////////////////////////
glfwSetWindowUserPointer(m_window, this);
glfwSetKeyCallback(m_window, windowKeyCallback);
//////////////////////////////////////////////
// Set the GLFW mouse move callback for the window.
//////////////////////////////////////////////
glfwSetCursorPosCallback(m_window, windowMouseMoveCallback);
// Set all controls to a default state of released.
for (bool & control : m_controls) control = false;
while((err = glGetError()) != GL_NO_ERROR) LOG("OpenGL Error: " + std::to_string(int(err)));
ce::EventLocator::initialize();
}
//////////////////////////////////////////////////////////////
GLFWWindow::~GLFWWindow()
{
glfwTerminate();
}
//////////////////////////////////////////////////////////////
bool GLFWWindow::isDone()
{
//assert(glGetError() == GL_NO_ERROR);
return glfwWindowShouldClose(m_window) > 0;
}
//////////////////////////////////////////////////////////////
GLfloat GLFWWindow::getElapsedTime()
{
/////////////////////////////////////////////////
// Update the elapsed time since the last frame
/////////////////////////////////////////////////
GLfloat currentFrameTime = glfwGetTime();
m_elapsedTime = currentFrameTime - m_lastFrameTime;
m_lastFrameTime = currentFrameTime;
return m_elapsedTime;
}
//////////////////////////////////////////////////////////////
void GLFWWindow::begin()
{
glfwPollEvents();
glClearColor(0.5f, 0.5f, 0.5f, 0.0f);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
}
//////////////////////////////////////////////////////////////
void GLFWWindow::end()
{
glfwSwapBuffers(m_window);
}
//////////////////////////////////////////////////////////////
void GLFWWindow::windowKeyCallback(GLFWwindow * window, int key, int scanCode, int action, int mode)
{
GLFWWindow * ceWindow = static_cast<GLFWWindow *>(glfwGetWindowUserPointer(window));
ceWindow->keyCallback(action, key);
}
//////////////////////////////////////////////////////////////
void GLFWWindow::keyCallback(int action, int key)
{
if (action == GLFW_PRESS || action == GLFW_RELEASE)
{
bool pressed = action == GLFW_PRESS;
if (m_controls[key] != pressed)
{
std::string eventType;
switch (key)
{
case GLFW_KEY_UP:
eventType = "Up";
break;
case GLFW_KEY_DOWN:
eventType = "Down";
break;
case GLFW_KEY_LEFT:
eventType = "Left";
break;
case GLFW_KEY_RIGHT:
eventType = "Right";
break;
default:
eventType = std::string(1, char(key));
}
Event event(eventType);
event.eventBool = pressed;
EventLocator::getEventQueue()->addEvent(event);
m_controls[key] = pressed;
}
}
}
//////////////////////////////////////////////////////////////
void GLFWWindow::windowMouseMoveCallback(GLFWwindow * window, double xPos, double yPos)
{
GLFWWindow * ceWindow = static_cast<GLFWWindow *>(glfwGetWindowUserPointer(window));
ceWindow->mouseMoveCallback(xPos, yPos);
}
//////////////////////////////////////////////////////////////
void GLFWWindow::mouseMoveCallback(double xPos, double yPos)
{
m_mousePosition.x = xPos;
m_mousePosition.y = m_height - yPos;
}
//////////////////////////////////////////////
void GLFWWindow::windowMouseButtonCallback(GLFWwindow * window, int button, int action, int mods)
{
}
//////////////////////////////////////////////
void GLFWWindow::mouseButtonCallback(int button, int action)
{
}
} // namespace ce | [
"eragonneal@gmail.com"
] | eragonneal@gmail.com |
fb1725405eb7ae89b856f8ed1a23dcf9dffa5e8d | 73e889b6ed0630a71788e819d10c917a2065faca | /Qt5-core-beginners/qtcb-10-3/main.cpp | a3f84495ea70659d790fb143bc48a11f43756974 | [] | no_license | tenevincent/Qt-Learning-for-beginners | 39d4844b418176443c28e9a1ea004af61a9066dd | 0b289b690007e65c066f76a452f08598bc9aeeee | refs/heads/main | 2023-04-02T23:14:36.280457 | 2021-04-14T22:02:38 | 2021-04-14T22:02:38 | 352,951,819 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 407 | cpp | #include <QCoreApplication>
#include <QDebug>
#include "test.h"
#include "watcher.h"
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
Test tester;
Watcher destination;
QObject::connect(&tester, &Test::messageChanged, &destination, &Watcher::messageChanged);
tester.setProperty("message", "testing");
//tester.setMessage("testing");
return a.exec();
}
| [
"vincent.tene@gmail.com"
] | vincent.tene@gmail.com |
f84f3019a2ffd30ab5e1c7e53a8151fcd35390a7 | cce7b2e87b518fda39f53c37d61d217e9f1d9e42 | /pure_puzzles/output_patterns/patterns1/patterns1.cpp | bec9645b1a20fd70c07502df221d0baa57a301f4 | [] | no_license | ashleylaswell/think-like-a-programmer | a745279a38e094567153c96902512484813418c8 | 0f51910cb614e828ad0e1cd67a9477c1dc7d39c5 | refs/heads/master | 2022-12-23T08:17:10.818147 | 2020-09-21T21:11:00 | 2020-09-21T21:11:00 | 293,101,022 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 220 | cpp | #include <iostream>
using namespace std;
int main(){
for (int row = 1; row <= 5; row++){
for (int hashNum = 1; hashNum <= 6 - row; hashNum++){
cout << "#";
}
cout << "\n";
}
} | [
"lswl9898@gmail.com"
] | lswl9898@gmail.com |
a570dd01cc267b3fe39585346da3c07a32a6825d | aed730f6de153c7f4afe7ad096805ab9a6441723 | /Constant Speed in Games/src/main.cpp | e453750da35a6aba1a511060991145d361d0a6ed | [] | no_license | HiteshGarg-Coder/Partical-Motion | f9629934525c21c0b92be7191510ee43996fc6e8 | 39c803543fb545ea42964a5ea83163d54a26b769 | refs/heads/main | 2023-03-07T23:59:35.691691 | 2021-02-14T17:19:42 | 2021-02-14T17:19:42 | 330,205,987 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,201 | cpp | #include <iostream>
#include <SDL.h>
#include <math.h>
#include "Screen.h"
#include <stdlib.h>
#include <time.h>
#include "Swarm.h"
using namespace std;
using namespace caveofprogramming;
int main() {
srand(time(NULL));
Screen screen;
if (screen.init() == false) {
cout << "Error initialising SDL." << endl;
}
Swarm swarm;
while (true) {
// Update particles
// Draw particles
int elapsed = SDL_GetTicks();
screen.clear();
swarm.update(elapsed);
unsigned char green =
(unsigned char) ((1 + sin(elapsed * 0.0001)) * 128);
unsigned char red = (unsigned char) ((1 + sin(elapsed * 0.0002)) * 128);
unsigned char blue = (unsigned char) ((1 + sin(elapsed * 0.0003)) * 128);
const Particle * const pParticles = swarm.getParticles();
for (int i = 0; i < Swarm::NPARTICLES; i++) {
Particle particle = pParticles[i];
int x = (particle.m_x + 1) * Screen::SCREEN_WIDTH / 2;
int y = particle.m_y * Screen::SCREEN_WIDTH / 2 + Screen::SCREEN_HEIGHT/2;
screen.setPixel(x, y, red, green, blue);
}
// Draw the screen
screen.update();
// Check for messages/events
if (screen.processEvents() == false) {
break;
}
}
screen.close();
return 0;
}
| [
"noreply@github.com"
] | HiteshGarg-Coder.noreply@github.com |
132697e82bf96464f67ad94367cf8dcbc4aed662 | 08b8cf38e1936e8cec27f84af0d3727321cec9c4 | /data/crawl/make/new_hunk_446.cpp | e1595768e3c15bdc259a064a4883c094b11e4794 | [] | no_license | ccdxc/logSurvey | eaf28e9c2d6307140b17986d5c05106d1fd8e943 | 6b80226e1667c1e0760ab39160893ee19b0e9fb1 | refs/heads/master | 2022-01-07T21:31:55.446839 | 2018-04-21T14:12:43 | 2018-04-21T14:12:43 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 527 | cpp | else
nargv = argv;
if (directories != 0 && directories->idx > 0)
{
int bad = 1;
if (directory_before_chdir != 0)
{
if (chdir (directory_before_chdir) < 0)
perror_with_name ("chdir", "");
else
bad = 0;
}
if (bad)
fatal (NILF, _("Couldn't change back to original directory."));
}
++restarts;
| [
"993273596@qq.com"
] | 993273596@qq.com |
54a91a0a8219686badf5a088c5632b44b33cbbe7 | 4371f22802cad34ce3d5b1f14c772acaf278f26c | /src/event.hpp | 6dddec5ae19f786a80dc2be3bce4a55207e60a69 | [] | no_license | bartfrenk/particle-simulation | 7084c7796a075caaec29bb97ae0ef9002d019426 | 20676022b20770bf21bf6e603a7e965c606a181a | refs/heads/master | 2021-01-10T13:22:27.384195 | 2015-10-08T15:49:55 | 2015-10-08T15:49:55 | 43,070,756 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 946 | hpp | #ifndef EVENT_H
#define EVENT_H
#include <cstdlib>
#include "share.hpp"
enum EventType {UPDATE_POSITION,
PARTICLE_COLLISION,
WALL_COLLISION};
struct Event {
const tick_t time;
Event(const tick_t time) : time(time) {}
virtual ~Event() {};
virtual EventType get_type() const = 0;
};
struct UpdatePosition : Event {
UpdatePosition(const tick_t time) : Event(time) {}
virtual ~UpdatePosition() {};
virtual EventType get_type() const { return UPDATE_POSITION; }
};
struct WallCollision : Event {
const dim_t wall;
const size_t p_index;
const unsigned int p_count;
WallCollision(const tick_t time, const dim_t wall, const size_t p_index,
const unsigned int p_count)
: Event(time), wall(wall), p_index(p_index), p_count(p_count) {}
virtual ~WallCollision() {};
virtual EventType get_type() const { return WALL_COLLISION; }
};
#endif
| [
"bart.frenk@gmail.com"
] | bart.frenk@gmail.com |
709eb99bf3c3d8ba65a640e4a656b02ac97df4d5 | 07e88c109af86db6aa3194cbb71c41d449f1a805 | /Code/m3alpsshaping/robot.cpp | b26321510ac758a15779040926070b5b5c27c2f1 | [] | no_license | jbongard/ISCS | 2a7fe528140aa24631022807c5af34d7442a122d | a7f7196a2a729564bd033abc13cdf4acb172edfb | refs/heads/master | 2016-09-05T08:44:10.630025 | 2011-08-17T15:31:58 | 2011-08-17T15:31:58 | 2,222,304 | 1 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 17,671 | cpp | #include "stdio.h"
#ifndef _ROBOT_CPP
#define _ROBOT_CPP
#include "robot.h"
#include "matrix.h"
extern int ROBOT_STARFISH;
extern int SHAPE_CYLINDER;
extern int SHAPE_RECTANGLE;
extern double ROBOT_STARFISH_BODY_LENGTH;
extern double ROBOT_STARFISH_BODY_WIDTH;
extern double ROBOT_STARFISH_BODY_HEIGHT;
extern double ROBOT_STARFISH_LEG_RADIUS;
extern double ROBOT_STARFISH_LEG_LENGTH;
extern double ROBOT_STARFISH_JOINT_RANGE;
extern double WORST_FITNESS;
ROBOT::ROBOT(ENVIRONMENT *cE, int robotType) {
containerEnvironment = cE;
if ( robotType == ROBOT_STARFISH )
Create_Starfish();
for (int i=0; i<numObjects; i++)
if ( objects[i] )
objects[i]->containerRobot = this;
for (int j=0; j<numJoints; j++)
if ( joints[j] )
joints[j]->containerRobot = this;
hidden = false;
physicalized = false;
neuralNetwork = NULL;
sensorDifferences = 0.0;
}
ROBOT::ROBOT(ROBOT *other) {
containerEnvironment = other->containerEnvironment;
Initialize(other);
}
ROBOT::ROBOT(ENVIRONMENT *cE, ROBOT *other) {
containerEnvironment = cE;
Initialize(other);
}
ROBOT::ROBOT(ENVIRONMENT *cE, ifstream *inFile) {
containerEnvironment = cE;
Initialize(inFile);
}
ROBOT::~ROBOT(void) {
if ( containerEnvironment )
containerEnvironment = NULL;
if ( objects ) {
for (int i=0; i<numObjects; i++) {
if ( objects[i] ) {
delete objects[i];
objects[i] = NULL;
}
}
delete[] objects;
objects = NULL;
}
if ( joints ) {
for (int j=0; j<numJoints; j++) {
if ( joints[j] ) {
delete joints[j];
joints[j] = NULL;
}
}
delete[] joints;
joints = NULL;
}
if ( neuralNetwork ) {
delete neuralNetwork;
neuralNetwork = NULL;
}
}
void ROBOT::Activate(void) {
for (int i=0; i<numObjects; i++)
if ( objects[i] )
objects[i]->Activate();
}
void ROBOT::Deactivate(void) {
for (int i=0; i<numObjects; i++)
if ( objects[i] )
objects[i]->Deactivate();
}
void ROBOT::Draw(void) {
if ( hidden )
return;
for (int i=0; i<numObjects; i++)
if ( objects[i] )
objects[i]->Draw();
}
double ROBOT::Fitness_Get(ROBOT *targetRobot) {
/*
// if ( neuralNetwork->inAFixedAttractor )
// return( WORST_FITNESS );
double fitness = 0.0;
double diff = Sensors_Get_Total_Differences(targetRobot);
//double diff = Sensors_Get_Largest_Difference(targetRobot);
fitness = -diff;
// fitness = Sensors_Get_Total();
return( fitness );
*/
return( -sensorDifferences );
}
int ROBOT::Has_Stopped(void) {
if ( !neuralNetwork )
return( true );
return( neuralNetwork->inAFixedAttractor );
}
void ROBOT::Hide(void) {
hidden = true;
for (int i=0; i<numObjects; i++)
if ( objects[i] )
objects[i]->Hide();
}
int ROBOT::In_Simulator(void) {
return( physicalized );
}
void ROBOT::Label(NEURAL_NETWORK *genome, int environmentIndex) {
if ( neuralNetwork )
delete neuralNetwork;
neuralNetwork = new NEURAL_NETWORK(genome);
}
void ROBOT::Make_Incorporeal(void) {
for (int i=0; i<numObjects; i++)
if ( objects[i] )
objects[i]->Make_Incorporeal();
for (int j=0; j<numJoints; j++)
if ( joints[j] )
joints[j]->Make_Incorporeal();
physicalized = false;
}
void ROBOT::Make_Physical(dWorldID world, dSpaceID space) {
// Add the robot to the physical simulator.
if ( physicalized )
return;
physicalized = true;
for (int i=0; i<numObjects; i++)
if ( objects[i] )
objects[i]->Make_Physical(world,space);
for (int j=0; j<numJoints; j++)
if ( joints[j] )
joints[j]->Make_Physical(world);
}
int ROBOT::Motors_Number_Of(void) {
return( numJoints );
// Assumes all joints are motorized.
}
void ROBOT::Move(int timeStep) {
// The robot is moving itself.
// The robot cannot move itself it is not physical.
if ( !physicalized )
return;
// if ( timeStep==0 )
Neural_Network_Set_Sensors();
Neural_Network_Update(timeStep);
Actuate_Motors();
Sensors_Touch_Clear();
}
void ROBOT::Move(double x, double y, double z) {
// The robot is being moved by the user.
for (int i=0; i<numObjects; i++)
if ( objects[i] )
objects[i]->Move(x,y,z);
for (int j=0; j<numJoints; j++)
if ( joints[j] )
joints[j]->Move(x,y,z);
}
void ROBOT::Save(ofstream *outFile) {
(*outFile) << numObjects << "\n";
for (int i=0; i<numObjects; i++)
if ( objects[i] )
objects[i]->Save(outFile);
(*outFile) << numJoints << "\n";
for (int j=0; j<numJoints; j++)
if ( joints[j] )
joints[j]->Save(outFile);
}
double ROBOT::Sensor_Sum(void) {
return( Sensors_Get_Total() );
}
void ROBOT::Sensors_Add_Difference(ROBOT *other) {
sensorDifferences = sensorDifferences +
Sensors_In_Objects_Total_Differences(other);
}
int ROBOT::Sensors_Number_Of(void) {
int numSensors = 0;
for (int i=0; i<numObjects; i++)
if ( objects[i] )
numSensors = numSensors +
objects[i]->Sensors_Number_Of();
for (int j=0; j<numJoints; j++)
if ( joints[j] )
numSensors = numSensors +
joints[j]->Sensors_Number_Of();
return( numSensors );
}
void ROBOT::Sensors_Update(void) {
// Light sensors already updated during the
// last drawing of the robot.
for (int i=0; i<numObjects; i++)
if ( objects[i] )
objects[i]->Sensors_Update();
// Touch sensors updated by nearCallback function.
// Update all of the proprioceptive sensors.
for (int j=0; j<numJoints; j++)
if ( joints[j] )
joints[j]->Sensors_Update();
}
void ROBOT::Sensors_Write(void) {
Sensors_In_Objects_Write();
Sensors_In_Joints_Write();
printf("\n");
}
void ROBOT::Set_Color(double r, double g, double b) {
for (int i=0; i<numObjects; i++)
if ( objects[i] )
objects[i]->Set_Color(r,g,b);
}
void ROBOT::Unhide(void) {
hidden = false;
for (int i=0; i<numObjects; i++)
if ( objects[i] )
objects[i]->Unhide();
}
// --------------------- Private methods ------------------------
void ROBOT::Actuate_Motors(void) {
for (int j=0; j<numJoints; j++) {
double motorNeuronValue =
neuralNetwork->Get_Motor_Neuron_Value(j);
if ( joints[j] )
joints[j]->Move(motorNeuronValue);
}
}
void ROBOT::Create_Starfish(void) {
Create_Starfish_Objects();
Create_Starfish_Joints();
}
void ROBOT::Create_Starfish_Joints(void) {
// Four joints connecting each lower and upper leg, and
// four joints connecting each leg to the main body.
numJoints = 4 + 4;
joints = new JOINT * [numJoints];
for (int j=0; j<numJoints; j++)
joints[j] = NULL;
// Attach the left upper and lower legs.
joints[0] = new JOINT(this,1,5,
-ROBOT_STARFISH_BODY_LENGTH/2.0
-ROBOT_STARFISH_LEG_LENGTH,
0,
ROBOT_STARFISH_LEG_LENGTH
+ROBOT_STARFISH_LEG_RADIUS,
0,1,0,
-ROBOT_STARFISH_JOINT_RANGE,+ROBOT_STARFISH_JOINT_RANGE);
// Attach the right upper and lower legs.
joints[1] = new JOINT(this,2,6,
+ROBOT_STARFISH_BODY_LENGTH/2.0
+ROBOT_STARFISH_LEG_LENGTH,
0,
ROBOT_STARFISH_LEG_LENGTH
+ROBOT_STARFISH_LEG_RADIUS,
0,-1,0,
-ROBOT_STARFISH_JOINT_RANGE,+ROBOT_STARFISH_JOINT_RANGE);
// Attach the forward upper and lower legs.
joints[2] = new JOINT(this,3,7,
0,
+ROBOT_STARFISH_BODY_LENGTH/2.0
+ROBOT_STARFISH_LEG_LENGTH,
ROBOT_STARFISH_LEG_LENGTH
+ROBOT_STARFISH_LEG_RADIUS,
1,0,0,
-ROBOT_STARFISH_JOINT_RANGE,+ROBOT_STARFISH_JOINT_RANGE);
// Attach the back upper and lower legs.
joints[3] = new JOINT(this,4,8,
0,
-ROBOT_STARFISH_BODY_LENGTH/2.0
-ROBOT_STARFISH_LEG_LENGTH,
ROBOT_STARFISH_LEG_LENGTH
+ROBOT_STARFISH_LEG_RADIUS,
-1,0,0,
-ROBOT_STARFISH_JOINT_RANGE,+ROBOT_STARFISH_JOINT_RANGE);
// Attach main body and the left upper leg.
joints[4] = new JOINT(this,0,1,
-ROBOT_STARFISH_BODY_LENGTH/2.0,
0,
ROBOT_STARFISH_LEG_LENGTH
+ROBOT_STARFISH_LEG_RADIUS,
0,1,0,
-ROBOT_STARFISH_JOINT_RANGE,+ROBOT_STARFISH_JOINT_RANGE);
// Attach main body and the right upper leg.
joints[5] = new JOINT(this,0,2,
+ROBOT_STARFISH_BODY_LENGTH/2.0,
0,
ROBOT_STARFISH_LEG_LENGTH
+ROBOT_STARFISH_LEG_RADIUS,
0,-1,0,
-ROBOT_STARFISH_JOINT_RANGE,+ROBOT_STARFISH_JOINT_RANGE);
// Attach main body and the forward upper leg.
joints[6] = new JOINT(this,0,3,
0,
+ROBOT_STARFISH_BODY_LENGTH/2.0,
ROBOT_STARFISH_LEG_LENGTH
+ROBOT_STARFISH_LEG_RADIUS,
1,0,0,
-ROBOT_STARFISH_JOINT_RANGE,+ROBOT_STARFISH_JOINT_RANGE);
// Attach main body and the back upper leg.
joints[7] = new JOINT(this,0,4,
0,
-ROBOT_STARFISH_BODY_LENGTH/2.0,
ROBOT_STARFISH_LEG_LENGTH
+ROBOT_STARFISH_LEG_RADIUS,
-1,0,0,
-ROBOT_STARFISH_JOINT_RANGE,+ROBOT_STARFISH_JOINT_RANGE);
for (int j=0;j<numJoints;j++)
joints[j]->Sensor_Proprioceptive_Add();
}
void ROBOT::Create_Starfish_Objects(void) {
// One main body, four upper legs and four lower legs
numObjects = 1 + 4 + 4;
objects = new OBJECT * [numObjects];
for (int i=0; i<numObjects; i++)
objects[i] = NULL;
// Main body
objects[0] = new OBJECT(SHAPE_RECTANGLE,
ROBOT_STARFISH_BODY_LENGTH,
ROBOT_STARFISH_BODY_WIDTH,
ROBOT_STARFISH_BODY_HEIGHT,
0,
0,
ROBOT_STARFISH_LEG_LENGTH
+ROBOT_STARFISH_LEG_RADIUS,
0,0,1);
// Left upper leg
objects[1] = new OBJECT(SHAPE_CYLINDER,
ROBOT_STARFISH_LEG_RADIUS,
ROBOT_STARFISH_LEG_LENGTH,
-ROBOT_STARFISH_BODY_LENGTH/2.0
-ROBOT_STARFISH_LEG_LENGTH/2.0,
0,
ROBOT_STARFISH_LEG_LENGTH
+ROBOT_STARFISH_LEG_RADIUS,
-1,0,0);
// Right upper leg
objects[2] = new OBJECT(SHAPE_CYLINDER,
ROBOT_STARFISH_LEG_RADIUS,
ROBOT_STARFISH_LEG_LENGTH,
+ROBOT_STARFISH_BODY_LENGTH/2.0
+ROBOT_STARFISH_LEG_LENGTH/2.0,
0,
ROBOT_STARFISH_LEG_LENGTH
+ROBOT_STARFISH_LEG_RADIUS,
+1,0,0);
// Forward upper leg
objects[3] = new OBJECT(SHAPE_CYLINDER,
ROBOT_STARFISH_LEG_RADIUS,
ROBOT_STARFISH_LEG_LENGTH,
0,
+ROBOT_STARFISH_BODY_LENGTH/2.0
+ROBOT_STARFISH_LEG_LENGTH/2.0,
ROBOT_STARFISH_LEG_LENGTH
+ROBOT_STARFISH_LEG_RADIUS,
0,+1,0);
// Back upper leg
objects[4] = new OBJECT(SHAPE_CYLINDER,
ROBOT_STARFISH_LEG_RADIUS,
ROBOT_STARFISH_LEG_LENGTH,
0,
-ROBOT_STARFISH_BODY_LENGTH/2.0
-ROBOT_STARFISH_LEG_LENGTH/2.0,
ROBOT_STARFISH_LEG_LENGTH
+ROBOT_STARFISH_LEG_RADIUS,
0,-1,0);
// Left lower leg
objects[5] = new OBJECT(SHAPE_CYLINDER,
ROBOT_STARFISH_LEG_RADIUS,
ROBOT_STARFISH_LEG_LENGTH,
-ROBOT_STARFISH_BODY_LENGTH/2.0
-ROBOT_STARFISH_LEG_LENGTH,
0,
ROBOT_STARFISH_LEG_LENGTH/2.0
+ROBOT_STARFISH_LEG_RADIUS,
0,0,+1);
// Right lower leg
objects[6] = new OBJECT(SHAPE_CYLINDER,
ROBOT_STARFISH_LEG_RADIUS,
ROBOT_STARFISH_LEG_LENGTH,
+ROBOT_STARFISH_BODY_LENGTH/2.0
+ROBOT_STARFISH_LEG_LENGTH,
0,
ROBOT_STARFISH_LEG_LENGTH/2.0
+ROBOT_STARFISH_LEG_RADIUS,
0,0,+1);
// Forward lower leg
objects[7] = new OBJECT(SHAPE_CYLINDER,
ROBOT_STARFISH_LEG_RADIUS,
ROBOT_STARFISH_LEG_LENGTH,
0,
+ROBOT_STARFISH_BODY_LENGTH/2.0
+ROBOT_STARFISH_LEG_LENGTH,
ROBOT_STARFISH_LEG_LENGTH/2.0
+ROBOT_STARFISH_LEG_RADIUS,
0,0,+1);
// Back lower leg
objects[8] = new OBJECT(SHAPE_CYLINDER,
ROBOT_STARFISH_LEG_RADIUS,
ROBOT_STARFISH_LEG_LENGTH,
0,
-ROBOT_STARFISH_BODY_LENGTH/2.0
-ROBOT_STARFISH_LEG_LENGTH,
ROBOT_STARFISH_LEG_LENGTH/2.0
+ROBOT_STARFISH_LEG_RADIUS,
0,0,+1);
for (int i=0;i<numObjects;i++)
objects[i]->Sensor_Light_Add();
objects[5]->Sensor_Touch_Add();
objects[6]->Sensor_Touch_Add();
objects[7]->Sensor_Touch_Add();
objects[8]->Sensor_Touch_Add();
}
bool ROBOT::File_Exists(char *fileName) {
ifstream ifile(fileName);
return ifile;
}
int ROBOT::File_Index_Next_Available(void) {
int fileIndex = 0;
char fileName[100];
sprintf(fileName,"SavedFiles/robot%d.dat",fileIndex);
while ( File_Exists(fileName) ) {
fileIndex++;
sprintf(fileName,"SavedFiles/robot%d.dat",fileIndex);
}
return( fileIndex );
}
void ROBOT::Initialize(ifstream *inFile) {
(*inFile) >> numObjects;
objects = new OBJECT * [numObjects];
for (int i=0; i<numObjects; i++)
objects[i] = new OBJECT(this,inFile);
(*inFile) >> numJoints;
joints = new JOINT * [numJoints];
for (int j=0; j<numJoints; j++)
joints[j] = new JOINT(this,inFile);
hidden = false;
physicalized = false;
neuralNetwork = NULL;
sensorDifferences = 0.0;
}
void ROBOT::Initialize(ROBOT *other) {
numObjects = other->numObjects;
objects = new OBJECT * [numObjects];
for (int i=0; i<numObjects; i++)
objects[i] = new OBJECT(this,other->objects[i]);
numJoints = other->numJoints;
joints = new JOINT * [numJoints];
for (int j=0; j<numJoints; j++)
joints[j] = new JOINT(this,other->joints[j]);
hidden = false;
physicalized = false;
if ( other->neuralNetwork )
neuralNetwork = new NEURAL_NETWORK(other->neuralNetwork);
else
neuralNetwork = NULL;
sensorDifferences = 0.0;
}
void ROBOT::Neural_Network_Set_Sensors(void) {
int sensorIndex = 0;
double sensorValue = 0.0;
for (int i=0; i<numObjects; i++)
if ( objects[i] ) {
if ( objects[i]->lightSensor ) {
sensorValue = objects[i]->lightSensor->Get_Value();
neuralNetwork->Sensor_Set(sensorIndex,sensorValue);
sensorIndex++;
}
if ( objects[i]->touchSensor ) {
sensorValue = objects[i]->touchSensor->Get_Value();
//sensorValue = 0.0;
neuralNetwork->Sensor_Set(sensorIndex,sensorValue);
sensorIndex++;
}
}
for (int j=0; j<numJoints; j++)
if ( joints[j] ) {
if ( joints[j]->proprioceptiveSensor ) {
sensorValue = joints[j]->proprioceptiveSensor->Get_Value();
//sensorValue = 0.0;
neuralNetwork->Sensor_Set(sensorIndex,sensorValue);
sensorIndex++;
}
}
}
void ROBOT::Neural_Network_Update(int timeStep) {
if ( !neuralNetwork )
return;
neuralNetwork->Update(timeStep);
}
void ROBOT::Sensors_Touch_Print(void) {
for (int i=0; i<numObjects; i++)
if ( objects[i] )
objects[i]->Sensor_Touch_Print();
printf("\n");
}
double ROBOT::Sensors_Get_Largest_Difference(ROBOT *other) {
double largestDifferenceInJoints =
Sensors_In_Joints_Largest_Difference(other);
double largestDifferenceInObjects =
Sensors_In_Objects_Largest_Difference(other);
if ( largestDifferenceInJoints > largestDifferenceInObjects )
return( largestDifferenceInJoints );
else
return( largestDifferenceInObjects );
}
double ROBOT::Sensors_Get_Total_Differences(ROBOT *other) {
// return( Sensors_In_Joints_Total_Differences(other) +
// Sensors_In_Objects_Total_Differences(other) );
return( Sensors_In_Objects_Total_Differences(other) );
}
double ROBOT::Sensors_Get_Total(void) {
double sum = 0.0;
for (int i=0; i<numObjects; i++)
if ( objects[i] )
if ( objects[i]->lightSensor ) {
sum = sum +
objects[i]->lightSensor->Get_Value();
}
return( sum );
}
double ROBOT::Sensors_In_Joints_Largest_Difference(ROBOT *other) {
double diff = -1000.0;
for (int j=0; j<numJoints; j++)
if ( joints[j] )
if ( joints[j]->proprioceptiveSensor ) {
/*
PROP_SENSOR *otherSensor =
other->joints[j]->proprioceptiveSensor;
if ( otherSensor ) {
double currDiff =
joints[j]->proprioceptiveSensor->
Difference(otherSensor);
if ( currDiff > diff )
diff = currDiff;
otherSensor = NULL;
}
*/
}
return( diff );
}
double ROBOT::Sensors_In_Joints_Total_Differences(ROBOT *other) {
double diff = 0.0;
double num = 1.0;
for (int j=0; j<numJoints; j++)
if ( joints[j] &&
joints[j]->proprioceptiveSensor &&
other->joints[j] &&
other->joints[j]->proprioceptiveSensor ) {
double myVal = joints[j]->proprioceptiveSensor->Get_Value();
double otherVal = other->joints[j]->proprioceptiveSensor->Get_Value();;
diff = diff + fabs(myVal - otherVal);
num++;
}
return( diff/num );
}
void ROBOT::Sensors_In_Joints_Write(void) {
for (int j=0; j<numJoints; j++)
if ( joints[j] )
if ( joints[j]->proprioceptiveSensor )
joints[j]->proprioceptiveSensor->Write();
}
double ROBOT::Sensors_In_Objects_Largest_Difference(ROBOT *other) {
double diff = -1000.0;
for (int i=0; i<numObjects; i++)
if ( objects[i] ) {
if ( objects[i]->lightSensor ) {
LIGHT_SENSOR *otherSensor =
other->objects[i]->lightSensor;
if ( otherSensor ) {
double currDiff =
objects[i]->lightSensor->
Difference(otherSensor);
if ( currDiff > diff )
diff = currDiff;
otherSensor = NULL;
}
}
/*
if ( objects[i]->touchSensor ) {
TOUCH_SENSOR *otherSensor =
other->objects[i]->touchSensor;
if ( otherSensor ) {
double currDiff =
objects[i]->touchSensor->
Difference(otherSensor);
if ( currDiff > diff )
diff = currDiff;
otherSensor = NULL;
}
}
*/
}
return( diff );
}
double ROBOT::Sensors_In_Objects_Total_Differences(ROBOT *other) {
double diff = 0.0;
double num = 1.0;
for (int i=0; i<numObjects; i++)
if ( objects[i] &&
objects[i]->lightSensor &&
other->objects[i] &&
other->objects[i]->lightSensor ) {
double myVal = objects[i]->lightSensor->Get_Value();
double otherVal = other->objects[i]->lightSensor->Get_Value();
diff = diff + fabs(myVal - otherVal);
num++;
}
return( diff/num );
}
void ROBOT::Sensors_In_Objects_Write(void) {
for (int i=0; i<numObjects; i++)
if ( objects[i] )
if ( objects[i]->lightSensor )
objects[i]->lightSensor->Write();
}
void ROBOT::Sensors_Touch_Clear(void) {
for (int i=0; i<numObjects; i++)
if ( objects[i] )
objects[i]->Sensor_Touch_Clear();
}
#endif
| [
"josh.bongard@uvm.edu"
] | josh.bongard@uvm.edu |
2153f9c8d9756d06da3f757e6aa8e1e06c7287df | 046b675cb8529d1585a688f21563eb0209c94f19 | /src/Control2012/libreoffice/com/sun/star/container/XUniqueIDAccess.hpp | 0f7c530d5a04757655c0d6f5654835caeb56098b | [] | no_license | yoshi5534/schorsch-the-robot | a2a4bd35668600451e53bd8d7f879df90dcb9994 | 77eb8dcabaad5da3908d6b4b78a05985323f9ba4 | refs/heads/master | 2021-03-12T19:41:35.524173 | 2013-04-17T20:00:29 | 2013-04-17T20:00:29 | 32,867,962 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,623 | hpp | #ifndef INCLUDED_COM_SUN_STAR_CONTAINER_XUNIQUEIDACCESS_HPP
#define INCLUDED_COM_SUN_STAR_CONTAINER_XUNIQUEIDACCESS_HPP
#include "sal/config.h"
#include "com/sun/star/container/XUniqueIDAccess.hdl"
#include "com/sun/star/uno/XInterface.hpp"
#include "com/sun/star/uno/RuntimeException.hpp"
#include "com/sun/star/container/NoSuchElementException.hpp"
#include "com/sun/star/uno/Any.hxx"
#include "com/sun/star/uno/Reference.hxx"
#include "com/sun/star/uno/Type.hxx"
#include "cppu/unotype.hxx"
#include "osl/mutex.hxx"
#include "rtl/ustring.hxx"
namespace com { namespace sun { namespace star { namespace container {
inline ::com::sun::star::uno::Type const & cppu_detail_getUnoType(::com::sun::star::container::XUniqueIDAccess const *) {
static typelib_TypeDescriptionReference * the_type = 0;
if ( !the_type )
{
typelib_static_mi_interface_type_init( &the_type, "com.sun.star.container.XUniqueIDAccess", 0, 0 );
}
return * reinterpret_cast< ::com::sun::star::uno::Type * >( &the_type );
}
} } } }
inline ::com::sun::star::uno::Type const & SAL_CALL getCppuType(::com::sun::star::uno::Reference< ::com::sun::star::container::XUniqueIDAccess > const *) SAL_THROW(()) {
return ::cppu::UnoType< ::com::sun::star::uno::Reference< ::com::sun::star::container::XUniqueIDAccess > >::get();
}
::com::sun::star::uno::Type const & ::com::sun::star::container::XUniqueIDAccess::static_type(void *) {
return ::getCppuType(static_cast< ::com::sun::star::uno::Reference< ::com::sun::star::container::XUniqueIDAccess > * >(0));
}
#endif // INCLUDED_COM_SUN_STAR_CONTAINER_XUNIQUEIDACCESS_HPP
| [
"schorsch@localhost"
] | schorsch@localhost |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.