blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 4 201 | content_id stringlengths 40 40 | detected_licenses listlengths 0 85 | license_type stringclasses 2
values | repo_name stringlengths 7 100 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringclasses 260
values | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 11.4k 681M ⌀ | star_events_count int64 0 209k | fork_events_count int64 0 110k | gha_license_id stringclasses 17
values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 80
values | src_encoding stringclasses 28
values | language stringclasses 1
value | is_vendor bool 1
class | is_generated bool 2
classes | length_bytes int64 8 9.86M | extension stringclasses 52
values | content stringlengths 8 9.86M | authors listlengths 1 1 | author stringlengths 0 119 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
d7f1fbfd0083553fff4d943b798bf634819bf998 | 279e8b225d53aa9a1c85ee2a4ee7bfb9446591e0 | /src/gbkfit/driver/native/gbkfit_cuda/include/gbkfit/cuda/objective.hpp | c85b78f5a61ad452f661cb2339b11aa31ec7fb06 | [
"BSD-3-Clause"
] | permissive | bek0s/gbkfit | 1e7c6ee16a925d7bd5cc664b3f66c16edf35fe00 | 644c2af4f2ee90270111fae557ee958494bb9079 | refs/heads/master | 2023-03-07T15:47:29.693515 | 2023-02-14T11:21:37 | 2023-02-28T05:51:45 | 237,968,729 | 14 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 402 | hpp | #pragma once
#include "gbkfit/cuda/common.hpp"
namespace gbkfit::cuda {
template<typename T>
struct Objective
{
void
count_pixels(Ptr data1, Ptr data2, int size, T epsilon, Ptr counts) const;
void
residual(
Ptr obs_d, Ptr obs_e, Ptr obs_m,
Ptr mdl_d, Ptr mdl_w, Ptr mdl_m,
int size, T weight, Ptr residual) const;
};
} // namespace gbkfit::cuda
| [
"geobekiaris@gmail.com"
] | geobekiaris@gmail.com |
b8d723fe52f9e7401f4c481290a7816a4e30d2e1 | 7d748f2cee2285dfaf75a8d2f62548c54b963906 | /ElfCopy-b96ad6369c8a978a253675b0454d3aa74e8a0635/Classes/Constants.cpp | 7a1d2fee8ce886ef5a0cb858acb54234d2e03be6 | [] | no_license | 73153/VideoPlayer | 73371cd888c64fe7e2bb1598ecc4f4b3683e5c52 | 1c6f0df92b3148bc38ea676fae5b6d12ae0d48b1 | refs/heads/master | 2021-01-18T10:41:07.788418 | 2015-03-26T07:11:49 | 2015-03-26T07:11:49 | 32,909,470 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 211 | cpp | //
// Constants.cpp
// ElfCopy
//
// Created by Ange Zhao on 14-5-20.
//
//
#include "Constants.h"
//全局变量
//选择头像次号
int m_intHead = 0;
bool selectOrPick = false;//true拍照,false相册
| [
"vivek2061990@gmail.com"
] | vivek2061990@gmail.com |
649b918be4ce84a1a16a9642e73b2730ca8136c0 | 8baa00a8c04f64e983532fa4a420c68f490bdaa8 | /devel/.private/pal_interaction_msgs/include/pal_interaction_msgs/ASRFileGoal.h | f6dbfdb9e721d78324c25876d90b148cf1a3c246 | [] | no_license | samuel-cavalcanti/TIAGo | e52c778f40ba8e03af21ba275b45b7faac5625b3 | 575533f713338b28ee5709279a874c9e374d77bd | refs/heads/master | 2021-04-06T01:32:09.090002 | 2018-03-10T23:51:45 | 2018-03-10T23:51:45 | 124,707,936 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 6,635 | h | // Generated by gencpp from file pal_interaction_msgs/ASRFileGoal.msg
// DO NOT EDIT!
#ifndef PAL_INTERACTION_MSGS_MESSAGE_ASRFILEGOAL_H
#define PAL_INTERACTION_MSGS_MESSAGE_ASRFILEGOAL_H
#include <string>
#include <vector>
#include <map>
#include <ros/types.h>
#include <ros/serialization.h>
#include <ros/builtin_message_traits.h>
#include <ros/message_operations.h>
namespace pal_interaction_msgs
{
template <class ContainerAllocator>
struct ASRFileGoal_
{
typedef ASRFileGoal_<ContainerAllocator> Type;
ASRFileGoal_()
: file()
, lang_id()
, grammar() {
}
ASRFileGoal_(const ContainerAllocator& _alloc)
: file(_alloc)
, lang_id(_alloc)
, grammar(_alloc) {
(void)_alloc;
}
typedef std::basic_string<char, std::char_traits<char>, typename ContainerAllocator::template rebind<char>::other > _file_type;
_file_type file;
typedef std::basic_string<char, std::char_traits<char>, typename ContainerAllocator::template rebind<char>::other > _lang_id_type;
_lang_id_type lang_id;
typedef std::basic_string<char, std::char_traits<char>, typename ContainerAllocator::template rebind<char>::other > _grammar_type;
_grammar_type grammar;
typedef boost::shared_ptr< ::pal_interaction_msgs::ASRFileGoal_<ContainerAllocator> > Ptr;
typedef boost::shared_ptr< ::pal_interaction_msgs::ASRFileGoal_<ContainerAllocator> const> ConstPtr;
}; // struct ASRFileGoal_
typedef ::pal_interaction_msgs::ASRFileGoal_<std::allocator<void> > ASRFileGoal;
typedef boost::shared_ptr< ::pal_interaction_msgs::ASRFileGoal > ASRFileGoalPtr;
typedef boost::shared_ptr< ::pal_interaction_msgs::ASRFileGoal const> ASRFileGoalConstPtr;
// constants requiring out of line definition
template<typename ContainerAllocator>
std::ostream& operator<<(std::ostream& s, const ::pal_interaction_msgs::ASRFileGoal_<ContainerAllocator> & v)
{
ros::message_operations::Printer< ::pal_interaction_msgs::ASRFileGoal_<ContainerAllocator> >::stream(s, "", v);
return s;
}
} // namespace pal_interaction_msgs
namespace ros
{
namespace message_traits
{
// BOOLTRAITS {'IsFixedSize': False, 'IsMessage': True, 'HasHeader': False}
// {'actionlib_msgs': ['/opt/ros/indigo/share/actionlib_msgs/cmake/../msg'], 'pal_interaction_msgs': ['/home/samuel/tiago_public_ws/src/pal_msgs/pal_interaction_msgs/msg', '/home/samuel/tiago_public_ws/devel/.private/pal_interaction_msgs/share/pal_interaction_msgs/msg'], 'std_msgs': ['/opt/ros/indigo/share/std_msgs/cmake/../msg']}
// !!!!!!!!!!! ['__class__', '__delattr__', '__dict__', '__doc__', '__eq__', '__format__', '__getattribute__', '__hash__', '__init__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', '_parsed_fields', 'constants', 'fields', 'full_name', 'has_header', 'header_present', 'names', 'package', 'parsed_fields', 'short_name', 'text', 'types']
template <class ContainerAllocator>
struct IsFixedSize< ::pal_interaction_msgs::ASRFileGoal_<ContainerAllocator> >
: FalseType
{ };
template <class ContainerAllocator>
struct IsFixedSize< ::pal_interaction_msgs::ASRFileGoal_<ContainerAllocator> const>
: FalseType
{ };
template <class ContainerAllocator>
struct IsMessage< ::pal_interaction_msgs::ASRFileGoal_<ContainerAllocator> >
: TrueType
{ };
template <class ContainerAllocator>
struct IsMessage< ::pal_interaction_msgs::ASRFileGoal_<ContainerAllocator> const>
: TrueType
{ };
template <class ContainerAllocator>
struct HasHeader< ::pal_interaction_msgs::ASRFileGoal_<ContainerAllocator> >
: FalseType
{ };
template <class ContainerAllocator>
struct HasHeader< ::pal_interaction_msgs::ASRFileGoal_<ContainerAllocator> const>
: FalseType
{ };
template<class ContainerAllocator>
struct MD5Sum< ::pal_interaction_msgs::ASRFileGoal_<ContainerAllocator> >
{
static const char* value()
{
return "31bee1dbb9e7542a0b7c4085dead9edf";
}
static const char* value(const ::pal_interaction_msgs::ASRFileGoal_<ContainerAllocator>&) { return value(); }
static const uint64_t static_value1 = 0x31bee1dbb9e7542aULL;
static const uint64_t static_value2 = 0x0b7c4085dead9edfULL;
};
template<class ContainerAllocator>
struct DataType< ::pal_interaction_msgs::ASRFileGoal_<ContainerAllocator> >
{
static const char* value()
{
return "pal_interaction_msgs/ASRFileGoal";
}
static const char* value(const ::pal_interaction_msgs::ASRFileGoal_<ContainerAllocator>&) { return value(); }
};
template<class ContainerAllocator>
struct Definition< ::pal_interaction_msgs::ASRFileGoal_<ContainerAllocator> >
{
static const char* value()
{
return "# ====== DO NOT MODIFY! AUTOGENERATED FROM AN ACTION DEFINITION ======\n\
##goal definition\n\
# absolute path to the file to be recognised.\n\
# format has to be PCM 16 bits signed integer\n\
string file\n\
# language id. (i.e., en_US, es_ES, ...)\n\
string lang_id\n\
# grammar name\n\
string grammar\n\
";
}
static const char* value(const ::pal_interaction_msgs::ASRFileGoal_<ContainerAllocator>&) { return value(); }
};
} // namespace message_traits
} // namespace ros
namespace ros
{
namespace serialization
{
template<class ContainerAllocator> struct Serializer< ::pal_interaction_msgs::ASRFileGoal_<ContainerAllocator> >
{
template<typename Stream, typename T> inline static void allInOne(Stream& stream, T m)
{
stream.next(m.file);
stream.next(m.lang_id);
stream.next(m.grammar);
}
ROS_DECLARE_ALLINONE_SERIALIZER
}; // struct ASRFileGoal_
} // namespace serialization
} // namespace ros
namespace ros
{
namespace message_operations
{
template<class ContainerAllocator>
struct Printer< ::pal_interaction_msgs::ASRFileGoal_<ContainerAllocator> >
{
template<typename Stream> static void stream(Stream& s, const std::string& indent, const ::pal_interaction_msgs::ASRFileGoal_<ContainerAllocator>& v)
{
s << indent << "file: ";
Printer<std::basic_string<char, std::char_traits<char>, typename ContainerAllocator::template rebind<char>::other > >::stream(s, indent + " ", v.file);
s << indent << "lang_id: ";
Printer<std::basic_string<char, std::char_traits<char>, typename ContainerAllocator::template rebind<char>::other > >::stream(s, indent + " ", v.lang_id);
s << indent << "grammar: ";
Printer<std::basic_string<char, std::char_traits<char>, typename ContainerAllocator::template rebind<char>::other > >::stream(s, indent + " ", v.grammar);
}
};
} // namespace message_operations
} // namespace ros
#endif // PAL_INTERACTION_MSGS_MESSAGE_ASRFILEGOAL_H
| [
"scavalcanti111@gmail.com"
] | scavalcanti111@gmail.com |
5485550de341199750eece5c6ce327856f58bd4d | c168dba60b712070b096f34624b95fe5199c129d | /SourceCode/Font.h | d8f9d04329bc96ddf4b7a345b51b2e19954111dd | [] | no_license | Ochi89/GameUproadTest | 491bbf3bc9357651762e426e06a1dda2cd4c9945 | b801069dd5f767d8a844aef50861e378ea4ebe45 | refs/heads/master | 2020-05-21T13:25:25.973179 | 2019-05-11T07:31:19 | 2019-05-11T07:31:19 | 186,071,196 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,025 | h |
//=============================================================================
// @file Font.h
// @brief フォント
// @autor Takuya Ochi
// @date 2018/12/30
//=============================================================================
//-----------------------------------------------------------------------------
// @brief プリプロセッサ
//-----------------------------------------------------------------------------
#pragma once
//-----------------------------------------------------------------------------
// @brief インクルード
//-----------------------------------------------------------------------------
#include "DxLib.h"
#include "Common.h"
//-----------------------------------------------------------------------------
// @brief フォントクラス
//-----------------------------------------------------------------------------
class Font final
{
public:
//===================== 関数 ======================//
// デストラクタ
~Font();
// インスタンスの作成
static void CreateInstance();
// インスタンスの削除
static void DeleteInstance();
// インスタンスの取得
static Font* GetInstance();
// 作成処理
void Create();
// 描画処理
void Draw(int x, int y, char* string);
private:
//================== シングルトン ==================//
// コンストラクタ
Font();
//================== 内部処理関数 ==================//
// 画像のセット
void _SetGraph(int xNum, int yNum, const char* fileName);
// 文字の割り当て
void _ReMap(const char* reMap);
//=================== メンバ変数 ===================//
static Font* s_instance; // インスタンス
int m_widht; // 1文字分の横の大きさ
int m_height; // 1文字分の縦の大きさ
int m_textImg[CommonConstant::FONT_NUM]; // 1文字分の画像ハンドル
int m_textMap[CommonConstant::FONT_NUM]; // 画像ハンドルへの添え字
};
#define FONT Font::GetInstance() | [
"gau.ochi23@gmail.com"
] | gau.ochi23@gmail.com |
1760930a541dd77642ad509493914122af3eb272 | 00a5fe452a9d0690e67f43d5500671a11c3d3876 | /Binary tree/biTree_levelWiseLL.cpp | d4e7ca19a2b57fd2ebce6752936bad5f003192eb | [] | no_license | DCYPHERR/vsCPP | c1ccf1010a9eb8fa78838749cc7cb1ada7903a9e | 5c8ce1965556d0978e370ac63636004b8977a454 | refs/heads/master | 2023-05-17T12:53:44.392856 | 2021-06-14T05:51:41 | 2021-06-14T05:51:41 | 376,711,875 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,926 | cpp | #include <iostream>
#include <queue>
#include <vector>
using namespace std;
template <typename T>
class BinaryTreeNode
{
public:
T data;
BinaryTreeNode<int> *left;
BinaryTreeNode<int> *right;
BinaryTreeNode(T data)
{
this->data = data;
left = right = NULL;
}
~BinaryTreeNode()
{
delete left;
delete right;
}
};
template <typename T>
class Node
{
public:
T data;
Node *next;
Node(T data)
{
this->data = data;
next = NULL;
}
};
BinaryTreeNode<int> *takeInput()
{
int rootData;
cout << "Enter root : ";
cin >> rootData;
if(rootData == -1)
{
return NULL;
}
BinaryTreeNode<int> *root = new BinaryTreeNode<int>(rootData);
queue<BinaryTreeNode<int> *> pendingBinaryNode;
pendingBinaryNode.push(root);
while(pendingBinaryNode.size() != 0)
{
BinaryTreeNode<int> *front = pendingBinaryNode.front();
pendingBinaryNode.pop();
int leftChildData;
cout <<"Enter left child of : " << front->data << " : ";
cin >> leftChildData;
if(leftChildData != -1)
{
BinaryTreeNode<int> *child = new BinaryTreeNode<int>(leftChildData);
front->left = child;
pendingBinaryNode.push(child);
}
int rightChildData;
cout <<"Enter right child of : " << front->data << " : ";
cin >> rightChildData;
if(rightChildData != -1)
{
BinaryTreeNode<int> *child = new BinaryTreeNode<int>(rightChildData);
front->right = child;
pendingBinaryNode.push(child);
}
}
cout << endl;
return root;
}
void print(BinaryTreeNode<int> *root)
{
if(root == NULL)
{
return;
}
queue<BinaryTreeNode<int> *> check;
check.push(root);
while(check.size() != 0)
{
BinaryTreeNode<int> *front = check.front();
cout << front->data << " : ";
check.pop();
if(root->left != NULL)
{
cout << "L : " << front->left->data << " , ";
check.push(root->left);
}
else
{
cout << "L : " << "-1 " << " , ";
}
if(root->right != NULL)
{
cout << "R : " << front->right->data << " , ";
check.push(front->right);
}
else
{
cout << "R : " << "-1 " << " , ";
}
cout << endl;
root = check.front();
}
}
vector<Node<int> *> createLLforEachlvl(BinaryTreeNode<int> *root)
{
queue<BinaryTreeNode<int> *> poke;
poke.push(root);
int currLvlRemaining = 1;
int nextLvlCount = 0;
vector<Node<int> *> output;
Node<int> *currLvlHead;
Node<int> *currLvlTail;
currLvlHead = currLvlTail = NULL;
while(poke.size() != 0)
{
BinaryTreeNode<int> *front = poke.front();
poke.pop();
Node<int> *newN = new Node<int>(front->data);
if(currLvlHead == NULL)
{
currLvlHead = newN;
currLvlTail = newN;
}
else
{
currLvlTail->next = newN;
currLvlTail = newN;
}
if(front->left != NULL)
{
poke.push(front->left);
nextLvlCount++;
}
if(front->right != NULL)
{
poke.push(front->right);
nextLvlCount++;
}
currLvlRemaining--;
if(currLvlRemaining == 0)
{
output.push_back(currLvlHead);
currLvlHead = NULL;
currLvlTail = NULL;
currLvlRemaining = nextLvlCount;
nextLvlCount = 0;
}
}
return output;
}
int main()
{
BinaryTreeNode<int> *root = takeInput();
cout << endl;
print(root);
cout << endl;
createLLforEachlvl(root);
cout << endl;
delete root;
return 0;
} | [
"harkiratsinghmkkar@yahoo.com"
] | harkiratsinghmkkar@yahoo.com |
d35e68c436695855baf586e5da4333490380b98b | b219519f94e6c6782f641a5a9d2dcf22537fac3b | /normal/indeed2016/2016_07_09/D.cpp | 508060855849c0d0d5544506d08f52c0c9305154 | [] | no_license | liangsheng/ACM | 71a37a85b13aa7680a095cf0710c50acb5457641 | 0e80385b51e622b2b97431ac650b8121ecd56e51 | refs/heads/master | 2023-06-01T06:37:51.727779 | 2023-05-14T03:16:18 | 2023-05-14T03:16:18 | 9,337,661 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,643 | cpp | #include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <cmath>
#define eps 1e-8
#define zero(x) (((x)>0?(x):-(x))<eps)
#define pause cout << " press ansy key to continue...", cin >> chh
#define file_r(x) freopen(x, "r", stdin)
#define file_w(x) freopen(x, "w", stdout)
#define lowbit(x) ((x) & (-x))
#define repit(i, c) for (__typeof__((c).begin()) i = (c).begin(); i != (c).end(); i++)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repe(i, u) for (int i = head[u]; i != -1; i = nxt[i])
#define repd(i, n) for (int i = (n - 1); i >= 0; i--)
#define FOR(i, n, m) for (int i = (n); i <= (m); i++)
#define FORD(i, n, m) for (int i = (n); i >= (m); i--)
#define pb push_back
#define X first
#define Y second
#define ins insert
#define rb rbegin
#define be begin
#define er erase
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define SZ(c) (c).size()
#define ALL(c) (c).begin(), (c).end()
#define sqr(r) ((LL) (r) * (r))
#define dis(x1, y1, x2, y2) (((x1) - (x2)) * ((x1) - (x2)) + ((y1) - (y2)) * ((y1) - (y2)))
#define FASTIO ios::sync_with_stdio(false);cin.tie(0)
#define sc(x) cout << #x" = " << x << endl, system("pause")
#define sc2(x, y) cout << #x" = " << x << " " << #y" = " << y << endl, system("pause")
#define sc3(x, y, z) cout << #x" = " << x << " " << #y" = " << y << " " << #z" = " << z << endl, system("pause")
#define sc4(x, y, z, w) cout << #x" = " << x << " " << #y" = " << y << " " << #z" = " << z << " " << #w" = " << w << endl, system("pause")
#define in(n) scanf("%d", &n)
#define in2(n, m) scanf("%d %d", &n, &m)
#define in3(x, y, z) scanf("%d %d %d", &x, &y, &z)
using namespace std;
int chh;
typedef vector<int> vi;
typedef set<int> si;
typedef map<int, int> mii;
typedef pair<int, int> pii;
typedef pair<int, pii> pi3;
typedef vector< pair<int, int> > vpii;
typedef long long LL;
const int N = 300005;
LL n;
char g[N];
LL c[N], L[N], R[N], s[N];
int main() {
LL ans, e;
while (cin >> n) {
cin >> g;
rep (i, n + 1) cin >> c[i];
L[0] = c[0];
FOR (i, 1, n) L[i] = min(L[i - 1], c[i]);
R[n] = c[n];
FORD (i, n - 1, 0) R[i] = min(R[i + 1], c[i]);
ans = 0, e = 0;
rep (i, n) {
if (g[i] == '(') s[e++] = i;
else {
if (e > 0) e--;
else {
ans += L[i];
}
}
}
rep (i, e) {
ans += R[s[i] + 1];
}
cout << ans << '\n';
}
return 0;
}
| [
"904491908@qq.com"
] | 904491908@qq.com |
140d00aebce21493b4ce32770f7d5d531411ffa3 | 78918391a7809832dc486f68b90455c72e95cdda | /boost_lib/boost/mpl/set/set30.hpp | 92c0fda232fc7d37776fb1855af7d28056e602ea | [
"MIT"
] | permissive | kyx0r/FA_Patcher | 50681e3e8bb04745bba44a71b5fd04e1004c3845 | 3f539686955249004b4483001a9e49e63c4856ff | refs/heads/master | 2022-03-28T10:03:28.419352 | 2020-01-02T09:16:30 | 2020-01-02T09:16:30 | 141,066,396 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,079 | hpp |
#ifndef BOOST_MPL_SET_SET30_HPP_INCLUDED
#define BOOST_MPL_SET_SET30_HPP_INCLUDED
// Copyright Aleksey Gurtovoy 2000-2004
// Copyright David Abrahams 2003-2004
//
// 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)
//
// See http://www.boost.org/libs/mpl for documentation.
// $Id$
// $Date$
// $Revision$
#if !defined(BOOST_MPL_PREPROCESSING_MODE)
# include <boost/mpl/set/set20.hpp>
#endif
#include <boost/mpl/aux_/config/use_preprocessed.hpp>
#if !defined(BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS) \
&& !defined(BOOST_MPL_PREPROCESSING_MODE)
# define BOOST_MPL_PREPROCESSED_HEADER set30.hpp
# include <boost/mpl/set/aux_/include_preprocessed.hpp>
#else
# include <boost/preprocessor/iterate.hpp>
namespace boost
{
namespace mpl
{
# define BOOST_PP_ITERATION_PARAMS_1 \
(3,(21, 30, <boost/mpl/set/aux_/numbered.hpp>))
# include BOOST_PP_ITERATE()
}
}
#endif // BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS
#endif // BOOST_MPL_SET_SET30_HPP_INCLUDED
| [
"k.melekhin@gmail.com"
] | k.melekhin@gmail.com |
5a1ab5d03aae730f278a104cf0d1cb8205999d53 | c124ebdd41bf145ec6e9b97a4fd3068359f7e589 | /src/TDensityCluster.cxx | ce0e61e820442ba7e5a8b69cff909abca2e6a851 | [] | no_license | captain-col/captRecon | fc764bf5e2c114567df380bc919e043f2c891d7d | 71bba82827a4c2830027511018ddd241559e6271 | refs/heads/master | 2021-01-23T06:15:18.625000 | 2019-03-21T20:11:13 | 2019-03-21T20:11:13 | 102,495,440 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,683 | cxx | #include "TDensityCluster.hxx"
#include "HitUtilities.hxx"
#include "TPositionDensityCluster.hxx"
#include "CreateCluster.hxx"
#include <THandle.hxx>
#include <TReconCluster.hxx>
#include <TCaptLog.hxx>
#include <HEPUnits.hxx>
#include <TRuntimeParameters.hxx>
#include <memory>
#include <cmath>
CP::TDensityCluster::TDensityCluster()
: TAlgorithm("TDensityCluster", "Find Simply Connected Hits") {
fMinPoints = CP::TRuntimeParameters::Get().GetParameterI(
"captRecon.densityCluster.minPoints");
fMaxDist = CP::TRuntimeParameters::Get().GetParameterD(
"captRecon.densityCluster.maxDistance");
}
CP::TDensityCluster::~TDensityCluster() { }
CP::THandle<CP::TAlgorithmResult>
CP::TDensityCluster::Process(const CP::TAlgorithmResult& input,
const CP::TAlgorithmResult&,
const CP::TAlgorithmResult&) {
CP::THandle<CP::THitSelection> inputHits = input.GetHits();
if (!inputHits) {
CaptError("No input hits");
return CP::THandle<CP::TAlgorithmResult>();
}
CaptLog("TDensityCluster Process "
<< GetEvent().GetContext()
<< " w/ " << inputHits->size() << " hits");
CP::THandle<CP::TAlgorithmResult> result = CreateResult();
std::unique_ptr<CP::TReconObjectContainer>
final(new CP::TReconObjectContainer("final"));
std::unique_ptr<CP::THitSelection> used(new CP::THitSelection("used"));
// This is the (dramatically) faster clustering algorithm for hits.
typedef CP::TPositionDensityCluster< CP::THandle<CP::THit> >
ClusterAlgorithm;
std::unique_ptr<ClusterAlgorithm>
clusterAlgorithm(new ClusterAlgorithm(fMinPoints,fMaxDist));
clusterAlgorithm->Cluster(inputHits->begin(), inputHits->end());
int nClusters = clusterAlgorithm->GetClusterCount();
for (int i=0; i<nClusters; ++i) {
const ClusterAlgorithm::Points& points
= clusterAlgorithm->GetCluster(i);
CP::THandle<CP::TReconCluster> cluster
= CreateCluster("TDensityCluster",points.begin(),points.end());
CaptLog(" Cluster with " << cluster->GetHits()->size() << " hits");
final->push_back(cluster);
}
// Copy all of the hits that got added to a reconstruction object into the
// used hit selection.
CP::THandle<CP::THitSelection> hits
= CP::hits::ReconHits(final->begin(), final->end());
if (hits) {
used->reserve(hits->size());
std::copy(hits->begin(), hits->end(), std::back_inserter(*used));
}
result->AddHits(used.release());
result->AddResultsContainer(final.release());
return result;
}
| [
"clark.mcgrew@stonybrook.edu"
] | clark.mcgrew@stonybrook.edu |
f302d1da2a13fddb2c90117de76b88426be793f7 | e1d6417b995823e507a1e53ff81504e4bc795c8f | /gbk/client/ClientLib/Tools/MrSmith/MrSmith/PacketHandle/GCCharMoveHandler.cpp | ae600a07c0a15bbb77bd06beb1e235aa7dd520be | [] | no_license | cjmxp/pap_full | f05d9e3f9390c2820a1e51d9ad4b38fe044e05a6 | 1963a8a7bda5156a772ccb3c3e35219a644a1566 | refs/heads/master | 2020-12-02T22:50:41.786682 | 2013-11-15T08:02:30 | 2013-11-15T08:02:30 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 165 | cpp | #include "StdAfx.h"
#include "GCCharMove.h"
using namespace Packets;
UINT GCCharMoveHandler::Execute(GCCharMove* pPacket, Player*)
{
return PACKET_EXE_CONTINUE;
}
| [
"viticm@126.com"
] | viticm@126.com |
ea295cac4e601076bc0c4aaac115d3614bb7674d | bd1fea86d862456a2ec9f56d57f8948456d55ee6 | /000/115/397/CWE762_Mismatched_Memory_Management_Routines__new_array_delete_struct_72b.cpp | 13ee49c945159406fddc74775e737194f812d272 | [] | 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 | 1,760 | cpp | /* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE762_Mismatched_Memory_Management_Routines__new_array_delete_struct_72b.cpp
Label Definition File: CWE762_Mismatched_Memory_Management_Routines__new_array_delete.label.xml
Template File: sources-sinks-72b.tmpl.cpp
*/
/*
* @description
* CWE: 762 Mismatched Memory Management Routines
* BadSource: Allocate data using new []
* GoodSource: Allocate data using new
* Sinks:
* GoodSink: Deallocate data using delete []
* BadSink : Deallocate data using delete
* Flow Variant: 72 Data flow: data passed in a vector from one function to another in different source files
*
* */
#include "std_testcase.h"
#include <vector>
using namespace std;
namespace CWE762_Mismatched_Memory_Management_Routines__new_array_delete_struct_72
{
#ifndef OMITBAD
void badSink(vector<twoIntsStruct *> dataVector)
{
/* copy data out of dataVector */
twoIntsStruct * data = dataVector[2];
/* POTENTIAL FLAW: Deallocate memory using delete - the source memory allocation function may
* require a call to delete [] to deallocate the memory */
delete data;
}
#endif /* OMITBAD */
#ifndef OMITGOOD
/* goodG2B uses the GoodSource with the BadSink */
void goodG2BSink(vector<twoIntsStruct *> dataVector)
{
twoIntsStruct * data = dataVector[2];
/* POTENTIAL FLAW: Deallocate memory using delete - the source memory allocation function may
* require a call to delete [] to deallocate the memory */
delete data;
}
/* goodB2G uses the BadSource with the GoodSink */
void goodB2GSink(vector<twoIntsStruct *> dataVector)
{
twoIntsStruct * data = dataVector[2];
/* FIX: Deallocate the memory using delete [] */
delete [] data;
}
#endif /* OMITGOOD */
} /* close namespace */
| [
"frank@fischer.com.mt"
] | frank@fischer.com.mt |
53f1627d868662872701e9699a30710008138447 | ffcd4c0368bc9ab3dd27d63909cbf7c66a402222 | /lib/wam_smptbl.cc | 99a87366cc211b562eb119ec919de9e9cd2c5a1b | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | alavrik/wamquery | 3dd85244fe6f6087df5906f89d66dc3ef48bd5c3 | d772b10adb5ff7979212b0b2d6197c06c4553478 | refs/heads/main | 2023-07-05T02:45:23.313896 | 2021-08-17T14:42:26 | 2021-08-17T14:52:33 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,895 | cc | /*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* 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 "wam.h"
#include "wam_smptbl.h"
#define MAX(a, b) (((a) > (b)) ? (a): (b))
typedef uint64_t hash_t;
typedef int key_t; /* NOTE: unused */
/*
* we store stratified sample rates in a hashtable. to simplify design, we store
* hash as key, similar to wam_strtbl. if there's collision we pick the max and
* print warning message.
*
* one more trick we do is when there is collision, we resolve collision by picking
* the larger value stored, while log some warning. or we can try different hash value
* when using different hc until there is no collision. but that involves
* http://myeyesareblind.com/2017/02/06/Combine-hash-values/ has several ideas how to
* combine hashes.
*/
typedef
struct __attribute__ ((__packed__)) item {
struct item *next;
hash_t hash;
float value;
} item_t;
static inline
int get_item_size(item_t *item)
{
return sizeof(struct item);
}
static inline
int get_new_item_size(int key_len, int value_len)
{
return sizeof(struct item) + value_len;
}
static inline
void init_new_item(item_t *item, key_t key, int key_len, int value_len)
{
}
static inline
bool is_item_key_equal(item_t *item, hash_t hash, key_t key, int key_len)
{
return (item->hash == hash);
}
#include "wam_hashtbl2.h"
static wam_hashtbl_t hashtbl;
void wam_smptbl_init(void)
{
wam_hashtbl_init(&hashtbl);
}
float *wam_smptbl_find(uint64_t hash)
{
item_t *item = wam_hashtbl_find_item(&hashtbl, hash, 0 /* = key */, 0 /* = key_len */);
if (!item) return NULL; /* not found */
return &item->value;
}
float wam_smptbl_get(uint64_t hash, float default_val)
{
item_t *item = wam_hashtbl_find_item(&hashtbl, hash, 0 /* = key */, 0 /* = key_len */);
if (!item) return default_val;
return item->value;
}
/* insert and merge */
float *wam_smptbl_insert(uint64_t hash, float value)
{
bool is_new_item;
item_t *item = wam_hashtbl_find_or_alloc_item(&hashtbl, hash, 0 /* = key */, 0 /* = key_len */, 0 /* = value_len */, &is_new_item);
if (is_new_item) {
item->value = value;
} else {
LOG("hash collision in wam_smptbl_insert hash: %ld (%f, %f). hicked larger value\n", hash, item->value, value);
item->value = MAX(value, item->value);
}
return &item->value;
}
| [
"alavrik@whatsapp.com"
] | alavrik@whatsapp.com |
1c01774c85a656efbe5f191d2b84195a500c0697 | 3da52a12f80fc6d4a58ba5578a6bfa7794930a15 | /source/Engine/System/System.h | c02c9f60e4222c04e6962815773beecb5d488a04 | [] | no_license | Epiphane/NCW | db11a5130bc0f07458905e898b26d957dd4ce4f5 | 531a88e03e42450152d91f82925a420ef0b9ee2c | refs/heads/master | 2021-06-06T21:05:28.739882 | 2021-06-05T06:14:22 | 2021-06-05T06:14:22 | 136,872,412 | 2 | 0 | null | 2020-02-02T05:03:13 | 2018-06-11T03:57:13 | C++ | UTF-8 | C++ | false | false | 1,802 | h | // By Thomas Steinke
#pragma once
#include <string>
#include "../Core/Config.h"
#include "../Entity/EntityManager.h"
#include "../Event/EventManager.h"
namespace CubeWorld
{
namespace Engine
{
class SystemManager;
class BaseSystem
{
public:
typedef size_t Family;
virtual ~BaseSystem() {}
// Called once all the systems are added to the manager.
// Typically used for setting up event handlers.
virtual void Configure(EntityManager& /*entities*/, EventManager& /*events*/) {}
// Apply system behavior, called once per game step.
virtual void Update(EntityManager& entities, EventManager& events, TIMEDELTA dt) = 0;
// Returns whether the system is active.
bool IsActive() const { return mIsActive; }
// Change the activation state of the system.
void SetActive(bool isActive) { mIsActive = isActive; }
// This gets incremented with each unique call to System<C>::GetFamily();
static Family sNumFamilies;
private:
bool mIsActive = true;
};
/**
* Actual base class for implementing systems.
*
* struct MySystem : public System<MySystem> {
* void Update(EntityManager& entities, EventManager& events, TIMEDELTA dt)
* {
* ...
* }
* }
*/
template<typename Derived>
class System : public BaseSystem {
public:
virtual ~System() {}
private:
friend class SystemManager;
// Used internally for registration.
// Defined here, because this is part of the template declaration,
// so the compiler will consider it a different function for each component type.
// That way each system class gets a different family.
static Family GetFamily()
{
static Family family = sNumFamilies++;
assert(family < MAX_COMPONENTS);
return family;
}
};
}; // namespace Engine
}; // namespace CubeWorld
| [
"exyphnos@gmail.com"
] | exyphnos@gmail.com |
ddcc2b1fb7135c194360b3488947e92c55ade716 | 4547754a529d1ff9c1d1ee871a8f0fc10132c0a4 | /app/src/main/jni/zzn.h | 79545f4e7cbe35a61a5713c90efdb216b0375471 | [] | no_license | xime123/nizk | 6dec0995ee351253234caedc075f16b02d8867c6 | 2205d41539f7519b0289ed20046fcee41ad014cd | refs/heads/master | 2021-08-30T19:27:23.440638 | 2017-12-19T06:00:19 | 2017-12-19T06:00:19 | 114,723,434 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 7,863 | h |
/***************************************************************************
*
Copyright 2013 CertiVox UK Ltd. *
*
This file is part of CertiVox MIRACL Crypto SDK. *
*
The CertiVox MIRACL Crypto SDK provides developers with an *
extensive and efficient set of cryptographic functions. *
For further information about its features and functionalities please *
refer to http://www.certivox.com *
*
* The CertiVox MIRACL Crypto SDK is free software: you can *
redistribute it and/or modify it under the terms of the *
GNU Affero General Public License as published by the *
Free Software Foundation, either version 3 of the License, *
or (at your option) any later version. *
*
* The CertiVox MIRACL Crypto SDK 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 Affero General Public License for more details. *
*
* You should have received a copy of the GNU Affero General Public *
License along with CertiVox MIRACL Crypto SDK. *
If not, see <http://www.gnu.org/licenses/>. *
*
You can be released from the requirements of the license by purchasing *
a commercial license. Buying such a license is mandatory as soon as you *
develop commercial activities involving the CertiVox MIRACL Crypto SDK *
without disclosing the source code of your own applications, or shipping *
the CertiVox MIRACL Crypto SDK with a closed source product. *
*
***************************************************************************/
/*
*
* MIRACL C++ Header file zzn.h
*
* AUTHOR : M. Scott
*
* PURPOSE : Definition of class ZZn (Arithmetic mod n), using
* Montgomery's Method for modular multiplication
* NOTE : Must be used in conjunction with zzn.cpp
* The modulus n is always set dynamically (via the modulo()
* routine) - so beware the pitfalls implicit in declaring
* static or global ZZn's (which are initialised before n is
* set!). Uninitialised data is OK
*/
#ifndef ZZN_H
#define ZZN_H
#include "big.h"
/*
#ifdef ZZNS
#define MR_INIT_ZZN memset(mem,0,mr_big_reserve(1,ZZNS)); fn=(big)mirvar_mem_variable(mem,0,ZZNS);
#define MR_CLONE_ZZN(x) fn->len=x->len; for (int i=0;i<ZZNS;i++) fn->w[i]=x->w[i];
#define MR_ZERO_ZZN {fn->len=0; for (int i=0;i<ZZNS;i++) fn->w[i]=0;}
#else
#define MR_INIT_ZZN mem=(char *)memalloc(1); fn=(big)mirvar_mem(mem,0);
#define MR_CLONE_ZZN(x) copy(x,fn);
#define MR_ZERO_ZZN zero(fn);
#endif
*/
#ifdef ZZNS
#ifdef MR_COMBA
#define UZZNS ZZNS
#else
#define UZZNS ZZNS+1 // one extra required in case of carry overflow in addition
#endif
#endif
#ifdef ZZNS
#define MR_INIT_ZZN fn=&b; b.w=a; b.len=UZZNS;
#define MR_CLONE_ZZN(x) b.len=x->len; for (int i=0;i<UZZNS;i++) a[i]=x->w[i];
#define MR_ZERO_ZZN {b.len=0; for (int i=0;i<UZZNS;i++) a[i]=0;}
#else
#define MR_INIT_ZZN fn=mirvar(0);
#define MR_CLONE_ZZN(x) copy(x,fn);
#define MR_ZERO_ZZN zero(fn);
#endif
class ZZn
{
big fn;
#ifdef ZZNS
mr_small a[UZZNS];
bigtype b;
#endif
/*
#ifdef ZZNS
char mem[mr_big_reserve(1,ZZNS)];
#else
char *mem;
#endif
*/
public:
ZZn() {MR_INIT_ZZN MR_ZERO_ZZN}
ZZn(int i) {MR_INIT_ZZN if (i==0) MR_ZERO_ZZN else {convert(i,fn); nres(fn,fn);} }
ZZn(const Big& c) {MR_INIT_ZZN nres(c.getbig(),fn); } /* Big -> ZZn */
ZZn(big& c) {MR_INIT_ZZN MR_CLONE_ZZN(c);}
ZZn(const ZZn& c) {MR_INIT_ZZN MR_CLONE_ZZN(c.fn);}
ZZn(char* s) {MR_INIT_ZZN cinstr(fn,s); nres(fn,fn);}
ZZn& operator=(const ZZn& c) {MR_CLONE_ZZN(c.fn) return *this;}
ZZn& operator=(big c) {MR_CLONE_ZZN(c) return *this; }
ZZn& operator=(int i) {if (i==0) MR_ZERO_ZZN else {convert(i,fn); nres(fn,fn);} return *this;}
ZZn& operator=(char* s){cinstr(fn,s); nres(fn,fn); return *this;}
/* Use fast in-line code */
ZZn& operator++()
{nres_modadd(fn,get_mip()->one,fn);return *this;}
ZZn& operator--()
{nres_modsub(fn,get_mip()->one,fn);return *this;}
ZZn& operator+=(int i)
{ZZn inc=i; nres_modadd(fn,inc.fn,fn);return *this;}
ZZn& operator-=(int i)
{ZZn dec=i; nres_modsub(fn,dec.fn,fn); return *this;}
ZZn& operator+=(const ZZn& b)
{nres_modadd(fn,b.fn,fn); return *this;}
ZZn& operator-=(const ZZn& b)
{nres_modsub(fn,b.fn,fn); return *this;}
ZZn& operator*=(const ZZn& b)
{nres_modmult(fn,b.fn,fn); return *this;}
ZZn& operator*=(int i)
{nres_premult(fn,i,fn); return *this;}
ZZn& negate()
{nres_negate(fn,fn); return *this;}
BOOL iszero() const;
operator Big() {Big c; redc(fn,c.getbig()); return c;} /* ZZn -> Big */
friend big getbig(ZZn& z) {return z.fn;}
ZZn& operator/=(const ZZn& b) {nres_moddiv(fn,b.fn,fn); return *this;}
ZZn& operator/=(int);
friend ZZn operator-(const ZZn&);
friend ZZn operator+(const ZZn&,int);
friend ZZn operator+(int, const ZZn&);
friend ZZn operator+(const ZZn&, const ZZn&);
friend ZZn operator-(const ZZn&, int);
friend ZZn operator-(int, const ZZn&);
friend ZZn operator-(const ZZn&, const ZZn&);
friend ZZn operator*(const ZZn&,int);
friend ZZn operator*(int, const ZZn&);
friend ZZn operator*(const ZZn&, const ZZn&);
friend ZZn operator/(const ZZn&, int);
friend ZZn operator/(int, const ZZn&);
friend ZZn operator/(const ZZn&, const ZZn&);
friend BOOL operator==(const ZZn& b1,const ZZn& b2)
{ if (mr_compare(b1.fn,b2.fn)==0) return TRUE; else return FALSE;}
friend BOOL operator!=(const ZZn& b1,const ZZn& b2)
{ if (mr_compare(b1.fn,b2.fn)!=0) return TRUE; else return FALSE;}
friend ZZn one(void);
friend ZZn pow( const ZZn&, const Big&);
friend ZZn pow( const ZZn&,int);
friend ZZn powl(const ZZn&, const Big&);
friend ZZn pow( const ZZn&, const Big&, const ZZn&, const Big&);
friend ZZn pow( int,ZZn *,Big *);
friend int jacobi(const ZZn&);
#ifndef MR_NO_RAND
friend ZZn randn(void); // random number < modulus
#endif
friend BOOL qr(const ZZn&); // test for quadratic residue
friend BOOL qnr(const ZZn&); // test for quadratic non-residue
friend ZZn getA(void); // get A parameter of elliptic curve
friend ZZn getB(void); // get B parameter of elliptic curve
friend ZZn sqrt(const ZZn&); // only works if modulus is prime
friend ZZn luc( const ZZn&, const Big&, ZZn*);
big getzzn(void) const;
#ifndef MR_NO_STANDARD_IO
friend ostream& operator<<(ostream&,const ZZn&);
#endif
~ZZn()
{
// MR_ZERO_ZZN // slower but safer
#ifndef ZZNS
mr_free(fn);
#endif
}
};
#ifndef MR_NO_RAND
extern ZZn randn(void);
#endif
extern ZZn getA(void);
extern ZZn getB(void);
extern ZZn one(void);
#endif
| [
"xumin@juzix.io"
] | xumin@juzix.io |
7b44ae84a029cbcf2e108aa00ae8cfb528a1e8a0 | c9f50125ea03d2a052a807d6cd6b7ed59e308edc | /FrameDirectX12/Engine/Code/Line.cpp | bba85cc59f1fe64173e53a67a45ae3fe1148f6a8 | [] | no_license | MinSyeoni/yodel-guardian | bbd270ecdce1971b40b2302ba2ac5fc8efce280c | 7c94e278c081fc265a8cf43ef37b564e1df7aa90 | refs/heads/master | 2023-05-07T08:42:35.273341 | 2020-11-19T12:13:30 | 2020-11-19T12:13:30 | 207,113,614 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,449 | cpp | #include "Line.h"
#include "GraphicDevice.h"
USING(Engine)
CLine::CLine()
{
ZeroMemory(m_vPoint, sizeof(_vec2)*POINT_END);
}
HRESULT CLine::Ready_Line(const _vec2 * pPointA, const _vec2 * pPointB)
{
m_vPoint[POINT_START] = *pPointA;
m_vPoint[POINT_FINISH] = *pPointB;
m_vDirection = m_vPoint[POINT_FINISH] - m_vPoint[POINT_START];
m_vNormal = _vec2(m_vDirection.y * -1.f, m_vDirection.x);
m_vNormal.Normalize();
return S_OK;
}
CLine::COMPARE CLine::Compare(const _vec2* pEndPos)
{
_vec2 vEndPos = *pEndPos;
_vec2 vDest = vEndPos - m_vPoint[POINT_START];
vDest.Normalize();
_float fResult = m_vNormal.Dot(vDest);
if (0.f <= fResult)
return COMPARE_LEFT;
else
return COMPARE_RIGHT;
}
_vec2 CLine::Point_Meet(_vec2 * OutPut, _vec2 * pDir)
{
_float x1 = OutPut->x;
_float y1 = OutPut->y;
_float m1;
if (pDir->x == 0.f)
m1 = 0.f;
else
m1 = pDir->y / pDir->x;
_float b1 = -(m1 * x1) + y1;
_float x2 = m_vPoint[POINT_FINISH].x;
_float y2 = m_vPoint[POINT_FINISH].y;
_float m2;
if (m_vDirection.x == 0.f)
m2 = 0.f;
else
m2 = m_vDirection.y / m_vDirection.x;
_float b2 = -(m2 * x2) + y2;
return _vec2{ (b2 - b1) / (m1 - m2) ,m1 * ((b2 - b1) / (m1 - m2)) + b1 };
}
CLine * CLine::Create(const _vec2 * pPointA, const _vec2 * pPointB)
{
CLine* pInstance = new CLine();
if (FAILED(pInstance->Ready_Line(pPointA, pPointB)))
Safe_Release(pInstance);
return pInstance;
}
void CLine::Free(void)
{
}
| [
"55053318+xhdrkawk1@users.noreply.github.com"
] | 55053318+xhdrkawk1@users.noreply.github.com |
4caba3f1fd0a64e29b794b1636ac42e76fa313b0 | e497dcf9e0ba58106624d611d5f614c18937f3a4 | /CppDay5/2_typename.cpp | 4d0b2bec6a2f0ca2a51e761e9a419fdb81e913ff | [] | no_license | pfepark/Cpp11_14 | 5f58e3657e46872b1b8efc829511f641f639a7f9 | ad84cf1644d07675ee3c861fa34c5a48558ec3e7 | refs/heads/master | 2020-06-22T16:28:11.383940 | 2017-03-30T15:10:00 | 2017-03-30T15:10:00 | 74,586,930 | 0 | 0 | null | null | null | null | UHC | C++ | false | false | 622 | cpp | // typename
class AAA
{
public:
//static int DWORD = 10;
typedef int DWORD;
};
int p = 0;
// template 안에 typedef 된 타입을 꺼내 사용할때는 반드시 typename이 필요하다.
template<typename T> typename T::DWORD foo(T a)
{
typename T::DWORD * p; // 이 한줄을 해석하시오.
// 1. DWORD는 static 맴버 data인데 , 곱하기 p하고 있다. (표준에서는 이것으로 본다.)
// 2. DWORD는 typedef되어 있는데 포인터 변수 p를 선언하고 있다. (선언에서 typename을 붙여아한다)
return 0;
}
int main()
{
AAA aaa;
foo(aaa);
} | [
"noreply@github.com"
] | noreply@github.com |
1a853f932829ea8e5289ce2e4a62cc93f2ca71df | 6532f6193ae5f15bbb205514ab3bbe0079c2e03b | /Polynomial.cpp | 9aae7888f3db8a34e6fbf2a9d2b56d6cbe821391 | [] | no_license | ayeshaAK/OOP | 22a1ece71eef81dadc9ad667d391ee5aa10dbe82 | 37921030700375d85db9288b8d4402be5415169c | refs/heads/master | 2022-07-04T13:09:22.436331 | 2020-05-17T20:18:26 | 2020-05-17T20:18:26 | 264,749,182 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,202 | cpp | /*
* Polynomial.cpp
*
* Created on: Apr 4, 2019
* Author: lab
*/
#include "Polynomial.h"
#include <string>
#include<sstream>
#include<cmath>
//Default constructor;
Polynomial::Polynomial()
{
x = 0;
y = 0;
z = 0;
}
//Parameterized Constructor;
Polynomial::Polynomial(int a, int b, int c)
{
x = a;
y = b;
z = c;
}
//Copy Constructor;
Polynomial::Polynomial(const Polynomial &toCopy)
{
x = toCopy.x;
y = toCopy.y;
z = toCopy.z;
}
//Getters and Setters;
int Polynomial::getX() const {
return x;
}
void Polynomial::setX(int a) {
this->x = a;
}
int Polynomial::getY() const {
return y;
}
void Polynomial::setY(int b) {
this->y = b;
}
int Polynomial::getZ() const {
return z;
}
void Polynomial::setZ(int c) {
this->z = c;
}
//Operator Overloading;
Polynomial Polynomial::operator =(const Polynomial &rhs)
{
this->x = rhs.x;
this->y = rhs.y;
this->z = rhs.z;
return *this;
}
bool Polynomial::operator ==(const Polynomial &rhs)
{
if((this->x == rhs.x) && (this->y == rhs.y) && (this->z == rhs.z))
{
return true;
}
else
{
return false;
}
}
Polynomial Polynomial::operator +(const Polynomial &rhs)
{
x = x + rhs.x;
y = y + rhs.y;
z = z + rhs.z;
return *this;
}
Polynomial Polynomial::operator += (const Polynomial &rhs)
{
*this = *this + rhs;
return *this;
}
Polynomial Polynomial::operator-(const Polynomial &rhs)
{
x = x - rhs.x;
y = y - rhs.y;
z = z - rhs.z;
return *this;
}
Polynomial Polynomial::operator -= (const Polynomial &rhs)
{
*this = *this - rhs;
return *this;
}
Polynomial Polynomial::operator *(double d)
{
this->x = x * d;
this->y = y * d;
this->z = z * d;
return *this;
}
Polynomial Polynomial::operator *= (double d)
{
*this = *this * d;
return *this;
}
Polynomial::operator string() const
{
string a,b,c;
stringstream x2, x1, cons;
if(x>=0)
{
x2 << x;
a = "+(" + x2.str() + ")x^2";
}
else
{
x2 << -x;
a = "-(" + x2.str() + ")x^2";
}
if(y>=0)
{
x1 << y;
b = "+(" + x1.str() + ")x";
}
else
{
x1 << -y;
b = "-(" + x1.str() + ")x";
}
if(z>=0)
{
cons << z;
c = "+(" + cons.str() + ")";
}
else
{
cons << -z;
c = "-(" + cons.str() + ")";
}
return a+b+c;
}
double Polynomial::evaluate (int value)
{
double temp = 0.0;
temp = x*(pow(value,2)) + y*value + z;
return temp;
}
//Finding Roots;
void Polynomial::roots(Complex &c1,Complex &c2)
{
int disc = pow(y,2) - 4*x*z;
int root1 = (-y + sqrt(disc)) / (2*x);
int root2 = (-y - sqrt(disc)) / (2*x);
if(disc < 0)
{
c1.setImaginary(root1);
c2.setImaginary(root2);
c1.setReal(0);
c2.setReal(0);
}
else
{
c1.setImaginary(0);
c2.setImaginary(0);
c1.setReal(root1);
c2.setReal(root2);
}
}
//Destructor;
Polynomial::~Polynomial()
{
// TODO Auto-generated destructor stub
}
ostream & operator << (ostream &input, Polynomial &pol)
{
cout << "Your Polynomial: ";
cout << string(pol) << endl;
return input;
}
istream & operator >> (istream &output,Polynomial &pol)
{
int a, b, c;
cout << "Enter co-efficient of x^2 : ";
cin >> a;
cout << "Enter co-efficient of x : ";
cin >> b;
cout << "Enter co-efficient of constant : ";
cin >> c;
pol.setX(a);
pol.setY(b);
pol.setZ(c);
return output;
}
| [
"noreply@github.com"
] | noreply@github.com |
e658b7713208ded667a91ef5abbdc3a5251b8ac9 | 91a882547e393d4c4946a6c2c99186b5f72122dd | /Source/XPSP1/NT/inetsrv/iis/svcs/cmp/webdav/inc/ex/refhandle.h | 81d1f7b17601c331f0b94c76effb39571cee6232 | [] | no_license | IAmAnubhavSaini/cryptoAlgorithm-nt5src | 94f9b46f101b983954ac6e453d0cf8d02aa76fc7 | d9e1cdeec650b9d6d3ce63f9f0abe50dabfaf9e2 | refs/heads/master | 2023-09-02T10:14:14.795579 | 2021-11-20T13:47:06 | 2021-11-20T13:47:06 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 6,469 | h | #ifndef _REFHANDLE_H_
#define _REFHANDLE_H_
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//
// REFHANDLE.H
//
// Copyright 1999 Microsoft Corporation, All Rights Reserved
//
#include <ex\refcnt.h>
#include <ex\autoptr.h>
// ========================================================================
//
// CLASS IRefHandle
//
// Implements a refcounted handle. AddRef() and Release() replace the
// much slower in-process DuplicateHandle() calls.
//
// The reason for the interface is that handles may come from many sources
// and it is not always clear what we should do once we are done with one
// when the last ref goes away. In the most common case (where we own the
// raw handle) we just want to call CloseHandle(). But we don't always own
// the raw handle. When someone else owns the raw handle, we must use
// their mechanisms to indicate when we are done using it. CIFSHandle in
// davex\exifs.cpp is one such instance.
//
class IRefHandle : public CRefCountedObject
{
// NOT IMPLEMENTED
//
IRefHandle( const IRefHandle& );
IRefHandle& operator=( const IRefHandle& );
protected:
// CREATORS
// Only create this object through it's descendents!
//
IRefHandle()
{
//
// Start the ref count at 1. The expectation is that we will
// typically use constructs like this
//
// auto_ref_handle hf;
// hf.take_ownership(new CFooRefHandle());
//
// or this
//
// auto_ref_ptr<IRefHandle> pRefHandle;
// pRefHandle.take_ownership(new CFooRefHandle());
//
// when creating these objects.
//
m_cRef = 1;
}
public:
// CREATORS
//
virtual ~IRefHandle() = 0 {}
// ACCESSORS
//
virtual HANDLE Handle() const = 0;
};
// ========================================================================
//
// CLASS CRefHandle
//
// By far the most common form of a refcounted handle -- the one where we
// own the raw HANDLE and must call CloseHandle() on it when we are done.
//
// This is implemented as a simple refcounted auto_handle.
//
class CRefHandle : public IRefHandle
{
//
// The handle
//
auto_handle<HANDLE> m_h;
// NOT IMPLEMENTED
//
CRefHandle( const CRefHandle& );
CRefHandle& operator=( const CRefHandle& );
public:
// CREATORS
//
CRefHandle(auto_handle<HANDLE>& h)
{
// Take ownership of the passed-in auto_handle
//
*m_h.load() = h.relinquish();
}
// ACCESSORS
//
HANDLE Handle() const
{
return m_h;
}
};
// ========================================================================
//
// CLASS auto_ref_handle
//
// Implements automatic refcounting on IRefHandle objects. The idea is
// that an auto_ref_handle can be used in most cases to replace a raw
// HANDLE. The main difference is that copying a raw HANDLE introduces
// an issue of ownership, but copying an auto_ref_handle does not.
// Typically, a raw handle is copied with an expensive DuplicateHandle()
// call. Copying an auto_ref_handle just does a cheap AddRef().
//
class auto_ref_handle
{
auto_ref_ptr<IRefHandle> m_pRefHandle;
public:
// CREATORS
//
auto_ref_handle() {}
auto_ref_handle(const auto_ref_handle& rhs)
{
m_pRefHandle = rhs.m_pRefHandle;
}
// ACCESSORS
//
HANDLE get() const
{
return m_pRefHandle.get() ? m_pRefHandle->Handle() : NULL;
}
// MANIPULATORS
//
auto_ref_handle& operator=(const auto_ref_handle& rhs)
{
if ( m_pRefHandle.get() != rhs.m_pRefHandle.get() )
m_pRefHandle = rhs.m_pRefHandle;
return *this;
}
VOID take_ownership(IRefHandle * pRefHandle)
{
Assert( !m_pRefHandle.get() );
m_pRefHandle.take_ownership(pRefHandle);
}
// ------------------------------------------------------------------------
//
// auto_ref_handle::FCreate()
//
// This function serves to simplify the very specific -- but very common --
// case of having an auto_ref_handle take ownership of a raw HANDLE.
// Without this function, callers would essentially need to go through all
// of the same steps that we do here. The number of different objects
// required to get to the final auto_ref_handle (a temporary auto_handle,
// a CRefHandle, and an auto_ref_ptr to hold it) and how to assemble them
// correctly would be confusing enough to be bug prone. It is far better
// to keep things simple from the caller's perspective.
//
// Returns:
// TRUE if the auto_ref_handle successfully takes ownership of the
// specified valid handle.
// FALSE if the specified handle is NULL or invalid or if there is
// some other failure in the function. In the latter case
// the function also CLOSES THE RAW HANDLE.
//
// !!! IMPORTANT !!!
// This function is designed to be called with the direct return value
// from any API that creates a raw HANDLE. If this call fails
// (i.e. returns FALSE) then it will close the raw HANDLE passed in!
// The whole point of the auto_ref_handle class is to replace usage of
// the raw HANDLE.
//
BOOL FCreate(HANDLE h)
{
Assert( !m_pRefHandle.get() );
// Don't even bother with NULL or invalid handles.
//
if (NULL == h || INVALID_HANDLE_VALUE == h)
return FALSE;
// Put the raw handle into an auto_handle so that we clean up properly
// (i.e. close the handle) if instantiating the CRefHandle below fails
// by throwing an exception (as it would with a throwing allocator).
//
auto_handle<HANDLE> hTemp(h);
// Preserve the last error from our caller. Our caller could have passed
// in a raw HANDLE from a CreateFile() call and may need to check the last
// error even in the success case -- to determine whether the file already
// existed, for example.
//
DWORD dw = GetLastError();
// Create a new refcounted handle object to control the lifetime
// of the handle that we are taking ownership of.
//
// Note: the reason we preserved the last error above is that the
// allocator clears the last error when we create the CRefHandle
// here if the allocation succeeds.
//
m_pRefHandle.take_ownership(new CRefHandle(hTemp));
if (!m_pRefHandle.get())
{
// Return a failure. Note that we don't restore the last
// error here -- callers should expect the last error to
// be set to a value appropriate for the last call that
// failed which is us.
//
return FALSE;
}
// Restore our caller's last error before returning.
//
SetLastError(dw);
// We now own the handle.
//
return TRUE;
}
VOID clear()
{
m_pRefHandle = NULL;
}
};
#endif // !defined(_REFHANDLE_H_)
| [
"support@cryptoalgo.cf"
] | support@cryptoalgo.cf |
cfd480063dc854ab1e236ecf076e606b22fa06f7 | 5f345f3063e1099a982671db5e214a464eaf5fd8 | /Engine/src/Fjord/core/Time.h | 9a6dbf712cf89519cff3cc295608074a55f91d06 | [
"Apache-2.0"
] | permissive | BarbedCrow/Fjord | 94909a24454135dc152ff919389219c0fcaeaa1b | fdcbf3a44ee3dc2e2f2ff65169f219b214e6674e | refs/heads/main | 2023-07-06T19:45:06.968417 | 2021-08-16T18:22:00 | 2021-08-16T18:22:00 | 389,767,696 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 391 | h | #pragma once
#include <GLFW/glfw3.h>
namespace Fjord
{
class Time
{
friend class Application;
public:
static float GetTime() { return glfwGetTime(); }
static float GetDeltaTime() { return glfwGetTime() - s_Time; }
private:
static float s_Time;
static float s_DeltaTime;
static void SetTime(float time)
{
s_DeltaTime = time - s_Time;
s_Time = time;
}
};
}
| [
"barbedcrow@gmail.com"
] | barbedcrow@gmail.com |
781cb11fbe1f89731e713a20b980cc03da504c9e | d25f34c7c2feedc72bcc6c7af2b624e1c1605eee | /modules/prediction/predictor/free_move/free_move_predictor.cc | 13d345c316df2c040a3962f30fd09fe20dc7003d | [
"Apache-2.0"
] | permissive | wangzhongchuan1973/2020-w1 | aefecada26376f49cc88b652378920647ae3af78 | f9fb019d6b5ebbba4b4e9cf5e98544fa9bc3c7a6 | refs/heads/master | 2022-12-11T14:06:04.564465 | 2020-03-08T07:11:25 | 2020-03-08T07:11:25 | 245,765,118 | 0 | 0 | Apache-2.0 | 2022-12-07T02:18:33 | 2020-03-08T06:37:00 | C++ | UTF-8 | C++ | false | false | 4,185 | cc | /******************************************************************************
* Copyright 2017 The Apollo Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*****************************************************************************/
#include "modules/prediction/predictor/free_move/free_move_predictor.h"
#include <cmath>
#include <limits>
#include <utility>
#include <vector>
#include "Eigen/Dense"
#include "modules/common/log.h"
#include "modules/common/math/math_utils.h"
#include "modules/prediction/common/prediction_gflags.h"
#include "modules/prediction/common/prediction_util.h"
namespace apollo {
namespace prediction {
using apollo::common::PathPoint;
using apollo::common::TrajectoryPoint;
using apollo::common::math::KalmanFilter;
void FreeMovePredictor::Predict(Obstacle* obstacle) {
Clear();
CHECK_NOTNULL(obstacle);
CHECK_GT(obstacle->history_size(), 0);
const Feature& feature = obstacle->latest_feature();
if (feature.is_still()) {
ADEBUG << "Obstacle [" << obstacle->id() << "] is still.";
return;
}
if (!feature.has_position() || !feature.has_velocity() ||
!feature.position().has_x() || !feature.position().has_y()) {
AERROR << "Obstacle [" << obstacle->id()
<< " is missing position or velocity";
return;
}
Eigen::Vector2d position(feature.position().x(), feature.position().y());
Eigen::Vector2d velocity(feature.velocity().x(), feature.velocity().y());
Eigen::Vector2d acc(feature.acceleration().x(), feature.acceleration().y());
double theta = feature.velocity_heading();
if (FLAGS_enable_kf_tracking) {
position(0) = feature.t_position().x();
position(1) = feature.t_position().y();
velocity(0) = feature.t_velocity().x();
velocity(1) = feature.t_velocity().y();
acc(0) = feature.t_acceleration().x();
acc(1) = feature.t_acceleration().y();
}
std::vector<TrajectoryPoint> points(0);
DrawFreeMoveTrajectoryPoints(
position, velocity, acc, theta, obstacle->kf_motion_tracker(),
FLAGS_prediction_duration, FLAGS_prediction_period, &points);
Trajectory trajectory = GenerateTrajectory(points);
int start_index = 0;
trajectories_.push_back(std::move(trajectory));
SetEqualProbability(1.0, start_index);
ADEBUG << "Obstacle [" << obstacle->id() << "] has " << trajectories_.size()
<< " trajectories.";
}
void FreeMovePredictor::DrawFreeMoveTrajectoryPoints(
const Eigen::Vector2d& position, const Eigen::Vector2d& velocity,
const Eigen::Vector2d& acc, double theta,
const KalmanFilter<double, 6, 2, 0>& kf,
double total_time, double period, std::vector<TrajectoryPoint>* points) {
Eigen::Matrix<double, 6, 1> state(kf.GetStateEstimate());
state(0, 0) = 0.0;
state(1, 0) = 0.0;
state(2, 0) = velocity(0);
state(3, 0) = velocity(1);
state(4, 0) = common::math::Clamp(acc(0), FLAGS_min_acc, FLAGS_max_acc);
state(5, 0) = common::math::Clamp(acc(1), FLAGS_min_acc, FLAGS_max_acc);
Eigen::Matrix<double, 6, 6> transition(kf.GetTransitionMatrix());
transition(0, 2) = period;
transition(0, 4) = 0.5 * period * period;
transition(1, 3) = period;
transition(1, 5) = 0.5 * period * period;
transition(2, 4) = period;
transition(3, 5) = period;
size_t num = static_cast<size_t>(total_time / period);
::apollo::prediction::predictor_util::GenerateFreeMoveTrajectoryPoints(
&state, transition, theta, num, period, points);
for (size_t i = 0; i < points->size(); ++i) {
::apollo::prediction::predictor_util::TranslatePoint(
position[0], position[1], &(points->operator[](i)));
}
}
} // namespace prediction
} // namespace apollo
| [
"wzc1973@163.com"
] | wzc1973@163.com |
09a39fecd7d0da441ae9d4bead0388ef3b2f2710 | 01a42b69633daf62a2eb3bb70c5b1b6e2639aa5f | /SCUM_BP_AK47_RemoveMagInsertMagChamber_classes.hpp | caf795d502cc79fb358fbc4c14864277ed1013df | [] | no_license | Kehczar/scum_sdk | 45db80e46dac736cc7370912ed671fa77fcb95cf | 8d1770b44321a9d0b277e4029551f39b11f15111 | refs/heads/master | 2022-07-25T10:06:20.892750 | 2020-05-21T11:45:36 | 2020-05-21T11:45:36 | 265,826,541 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,350 | hpp | #pragma once
// Scum 3.79.22573 (UE 4.24)
#ifdef _MSC_VER
#pragma pack(push, 0x8)
#endif
namespace Classes
{
//---------------------------------------------------------------------------
//Classes
//---------------------------------------------------------------------------
// BlueprintGeneratedClass BP_AK47_RemoveMagInsertMagChamber.BP_AK47_RemoveMagInsertMagChamber_C
// 0x0000 (0x0088 - 0x0088)
class UBP_AK47_RemoveMagInsertMagChamber_C : public URemoveMagazineInsertMagazine
{
public:
static UClass* StaticClass()
{
static auto ptr = UObject::FindClass("BlueprintGeneratedClass BP_AK47_RemoveMagInsertMagChamber.BP_AK47_RemoveMagInsertMagChamber_C");
return ptr;
}
void SetNextMontageSectionFromPrevious(struct FName* previousSection, struct FName* NextSection);
void SetNextMontageSection(struct FName* NextSection);
void OnMontageEnded(class UAnimMontage** Montage, bool* interrupted);
void OnMontageBlendingOutStarted(class UAnimMontage** Montage, bool* interrupted);
struct FWeaponReloadData GetReloadData();
class UAnimMontage* GetActiveAnimationWeapon();
class UAnimMontage* GetActiveAnimationBody();
float ExecuteUsingData(struct FWeaponReloadData* Data);
void End(bool* Regular);
bool CanInterrupt();
bool CanExecuteUsingData(struct FWeaponReloadData* Data);
};
}
#ifdef _MSC_VER
#pragma pack(pop)
#endif
| [
"65712402+Kehczar@users.noreply.github.com"
] | 65712402+Kehczar@users.noreply.github.com |
3cdab4e880405377e0e4e1c7500e6c16fbcd8b28 | c776476e9d06b3779d744641e758ac3a2c15cddc | /examples/litmus/c/run-scripts/tmp_5/MP+dmb.sy+fri-rfi-ctrl-rfi.c.cbmc.cpp | 361c6c54029a51ab6cdd569d9b0190b447045398 | [] | no_license | ashutosh0gupta/llvm_bmc | aaac7961c723ba6f7ffd77a39559e0e52432eade | 0287c4fb180244e6b3c599a9902507f05c8a7234 | refs/heads/master | 2023-08-02T17:14:06.178723 | 2023-07-31T10:46:53 | 2023-07-31T10:46:53 | 143,100,825 | 3 | 4 | null | 2023-05-25T05:50:55 | 2018-08-01T03:47:00 | C++ | UTF-8 | C++ | false | false | 42,103 | cpp | // Global variabls:
// 2:atom_1_X0_1:1
// 0:vars:2
// 3:atom_1_X3_2:1
// 4:atom_1_X6_1:1
// Local global variabls:
// 0:thr0:1
// 1:thr1:1
#define ADDRSIZE 5
#define LOCALADDRSIZE 2
#define NTHREAD 3
#define NCONTEXT 5
#define ASSUME(stmt) __CPROVER_assume(stmt)
#define ASSERT(stmt) __CPROVER_assert(stmt, "error")
#define max(a,b) (a>b?a:b)
char __get_rng();
char get_rng( char from, char to ) {
char ret = __get_rng();
ASSUME(ret >= from && ret <= to);
return ret;
}
char get_rng_th( char from, char to ) {
char ret = __get_rng();
ASSUME(ret >= from && ret <= to);
return ret;
}
int main(int argc, char **argv) {
// Declare arrays for intial value version in contexts
int local_mem[LOCALADDRSIZE];
// Dumping initializations
local_mem[0+0] = 0;
local_mem[1+0] = 0;
int cstart[NTHREAD];
int creturn[NTHREAD];
// declare arrays for contexts activity
int active[NCONTEXT];
int ctx_used[NCONTEXT];
// declare arrays for intial value version in contexts
int meminit_[ADDRSIZE*NCONTEXT];
#define meminit(x,k) meminit_[(x)*NCONTEXT+k]
int coinit_[ADDRSIZE*NCONTEXT];
#define coinit(x,k) coinit_[(x)*NCONTEXT+k]
int deltainit_[ADDRSIZE*NCONTEXT];
#define deltainit(x,k) deltainit_[(x)*NCONTEXT+k]
// declare arrays for running value version in contexts
int mem_[ADDRSIZE*NCONTEXT];
#define mem(x,k) mem_[(x)*NCONTEXT+k]
int co_[ADDRSIZE*NCONTEXT];
#define co(x,k) co_[(x)*NCONTEXT+k]
int delta_[ADDRSIZE*NCONTEXT];
#define delta(x,k) delta_[(x)*NCONTEXT+k]
// declare arrays for local buffer and observed writes
int buff_[NTHREAD*ADDRSIZE];
#define buff(x,k) buff_[(x)*ADDRSIZE+k]
int pw_[NTHREAD*ADDRSIZE];
#define pw(x,k) pw_[(x)*ADDRSIZE+k]
// declare arrays for context stamps
char cr_[NTHREAD*ADDRSIZE];
#define cr(x,k) cr_[(x)*ADDRSIZE+k]
char iw_[NTHREAD*ADDRSIZE];
#define iw(x,k) iw_[(x)*ADDRSIZE+k]
char cw_[NTHREAD*ADDRSIZE];
#define cw(x,k) cw_[(x)*ADDRSIZE+k]
char cx_[NTHREAD*ADDRSIZE];
#define cx(x,k) cx_[(x)*ADDRSIZE+k]
char is_[NTHREAD*ADDRSIZE];
#define is(x,k) is_[(x)*ADDRSIZE+k]
char cs_[NTHREAD*ADDRSIZE];
#define cs(x,k) cs_[(x)*ADDRSIZE+k]
char crmax_[NTHREAD*ADDRSIZE];
#define crmax(x,k) crmax_[(x)*ADDRSIZE+k]
char sforbid_[ADDRSIZE*NCONTEXT];
#define sforbid(x,k) sforbid_[(x)*NCONTEXT+k]
// declare arrays for synchronizations
int cl[NTHREAD];
int cdy[NTHREAD];
int cds[NTHREAD];
int cdl[NTHREAD];
int cisb[NTHREAD];
int caddr[NTHREAD];
int cctrl[NTHREAD];
__LOCALS__
buff(0,0) = 0;
pw(0,0) = 0;
cr(0,0) = 0;
iw(0,0) = 0;
cw(0,0) = 0;
cx(0,0) = 0;
is(0,0) = 0;
cs(0,0) = 0;
crmax(0,0) = 0;
buff(0,1) = 0;
pw(0,1) = 0;
cr(0,1) = 0;
iw(0,1) = 0;
cw(0,1) = 0;
cx(0,1) = 0;
is(0,1) = 0;
cs(0,1) = 0;
crmax(0,1) = 0;
buff(0,2) = 0;
pw(0,2) = 0;
cr(0,2) = 0;
iw(0,2) = 0;
cw(0,2) = 0;
cx(0,2) = 0;
is(0,2) = 0;
cs(0,2) = 0;
crmax(0,2) = 0;
buff(0,3) = 0;
pw(0,3) = 0;
cr(0,3) = 0;
iw(0,3) = 0;
cw(0,3) = 0;
cx(0,3) = 0;
is(0,3) = 0;
cs(0,3) = 0;
crmax(0,3) = 0;
buff(0,4) = 0;
pw(0,4) = 0;
cr(0,4) = 0;
iw(0,4) = 0;
cw(0,4) = 0;
cx(0,4) = 0;
is(0,4) = 0;
cs(0,4) = 0;
crmax(0,4) = 0;
cl[0] = 0;
cdy[0] = 0;
cds[0] = 0;
cdl[0] = 0;
cisb[0] = 0;
caddr[0] = 0;
cctrl[0] = 0;
cstart[0] = get_rng(0,NCONTEXT-1);
creturn[0] = get_rng(0,NCONTEXT-1);
buff(1,0) = 0;
pw(1,0) = 0;
cr(1,0) = 0;
iw(1,0) = 0;
cw(1,0) = 0;
cx(1,0) = 0;
is(1,0) = 0;
cs(1,0) = 0;
crmax(1,0) = 0;
buff(1,1) = 0;
pw(1,1) = 0;
cr(1,1) = 0;
iw(1,1) = 0;
cw(1,1) = 0;
cx(1,1) = 0;
is(1,1) = 0;
cs(1,1) = 0;
crmax(1,1) = 0;
buff(1,2) = 0;
pw(1,2) = 0;
cr(1,2) = 0;
iw(1,2) = 0;
cw(1,2) = 0;
cx(1,2) = 0;
is(1,2) = 0;
cs(1,2) = 0;
crmax(1,2) = 0;
buff(1,3) = 0;
pw(1,3) = 0;
cr(1,3) = 0;
iw(1,3) = 0;
cw(1,3) = 0;
cx(1,3) = 0;
is(1,3) = 0;
cs(1,3) = 0;
crmax(1,3) = 0;
buff(1,4) = 0;
pw(1,4) = 0;
cr(1,4) = 0;
iw(1,4) = 0;
cw(1,4) = 0;
cx(1,4) = 0;
is(1,4) = 0;
cs(1,4) = 0;
crmax(1,4) = 0;
cl[1] = 0;
cdy[1] = 0;
cds[1] = 0;
cdl[1] = 0;
cisb[1] = 0;
caddr[1] = 0;
cctrl[1] = 0;
cstart[1] = get_rng(0,NCONTEXT-1);
creturn[1] = get_rng(0,NCONTEXT-1);
buff(2,0) = 0;
pw(2,0) = 0;
cr(2,0) = 0;
iw(2,0) = 0;
cw(2,0) = 0;
cx(2,0) = 0;
is(2,0) = 0;
cs(2,0) = 0;
crmax(2,0) = 0;
buff(2,1) = 0;
pw(2,1) = 0;
cr(2,1) = 0;
iw(2,1) = 0;
cw(2,1) = 0;
cx(2,1) = 0;
is(2,1) = 0;
cs(2,1) = 0;
crmax(2,1) = 0;
buff(2,2) = 0;
pw(2,2) = 0;
cr(2,2) = 0;
iw(2,2) = 0;
cw(2,2) = 0;
cx(2,2) = 0;
is(2,2) = 0;
cs(2,2) = 0;
crmax(2,2) = 0;
buff(2,3) = 0;
pw(2,3) = 0;
cr(2,3) = 0;
iw(2,3) = 0;
cw(2,3) = 0;
cx(2,3) = 0;
is(2,3) = 0;
cs(2,3) = 0;
crmax(2,3) = 0;
buff(2,4) = 0;
pw(2,4) = 0;
cr(2,4) = 0;
iw(2,4) = 0;
cw(2,4) = 0;
cx(2,4) = 0;
is(2,4) = 0;
cs(2,4) = 0;
crmax(2,4) = 0;
cl[2] = 0;
cdy[2] = 0;
cds[2] = 0;
cdl[2] = 0;
cisb[2] = 0;
caddr[2] = 0;
cctrl[2] = 0;
cstart[2] = get_rng(0,NCONTEXT-1);
creturn[2] = get_rng(0,NCONTEXT-1);
// Dumping initializations
mem(2+0,0) = 0;
mem(0+0,0) = 0;
mem(0+1,0) = 0;
mem(3+0,0) = 0;
mem(4+0,0) = 0;
// Dumping context matching equalities
co(0,0) = 0;
delta(0,0) = -1;
mem(0,1) = meminit(0,1);
co(0,1) = coinit(0,1);
delta(0,1) = deltainit(0,1);
mem(0,2) = meminit(0,2);
co(0,2) = coinit(0,2);
delta(0,2) = deltainit(0,2);
mem(0,3) = meminit(0,3);
co(0,3) = coinit(0,3);
delta(0,3) = deltainit(0,3);
mem(0,4) = meminit(0,4);
co(0,4) = coinit(0,4);
delta(0,4) = deltainit(0,4);
co(1,0) = 0;
delta(1,0) = -1;
mem(1,1) = meminit(1,1);
co(1,1) = coinit(1,1);
delta(1,1) = deltainit(1,1);
mem(1,2) = meminit(1,2);
co(1,2) = coinit(1,2);
delta(1,2) = deltainit(1,2);
mem(1,3) = meminit(1,3);
co(1,3) = coinit(1,3);
delta(1,3) = deltainit(1,3);
mem(1,4) = meminit(1,4);
co(1,4) = coinit(1,4);
delta(1,4) = deltainit(1,4);
co(2,0) = 0;
delta(2,0) = -1;
mem(2,1) = meminit(2,1);
co(2,1) = coinit(2,1);
delta(2,1) = deltainit(2,1);
mem(2,2) = meminit(2,2);
co(2,2) = coinit(2,2);
delta(2,2) = deltainit(2,2);
mem(2,3) = meminit(2,3);
co(2,3) = coinit(2,3);
delta(2,3) = deltainit(2,3);
mem(2,4) = meminit(2,4);
co(2,4) = coinit(2,4);
delta(2,4) = deltainit(2,4);
co(3,0) = 0;
delta(3,0) = -1;
mem(3,1) = meminit(3,1);
co(3,1) = coinit(3,1);
delta(3,1) = deltainit(3,1);
mem(3,2) = meminit(3,2);
co(3,2) = coinit(3,2);
delta(3,2) = deltainit(3,2);
mem(3,3) = meminit(3,3);
co(3,3) = coinit(3,3);
delta(3,3) = deltainit(3,3);
mem(3,4) = meminit(3,4);
co(3,4) = coinit(3,4);
delta(3,4) = deltainit(3,4);
co(4,0) = 0;
delta(4,0) = -1;
mem(4,1) = meminit(4,1);
co(4,1) = coinit(4,1);
delta(4,1) = deltainit(4,1);
mem(4,2) = meminit(4,2);
co(4,2) = coinit(4,2);
delta(4,2) = deltainit(4,2);
mem(4,3) = meminit(4,3);
co(4,3) = coinit(4,3);
delta(4,3) = deltainit(4,3);
mem(4,4) = meminit(4,4);
co(4,4) = coinit(4,4);
delta(4,4) = deltainit(4,4);
// Dumping thread 1
int ret_thread_1 = 0;
cdy[1] = get_rng(0,NCONTEXT-1);
ASSUME(cdy[1] >= cstart[1]);
T1BLOCK0:
// call void @llvm.dbg.value(metadata i8* %arg, metadata !38, metadata !DIExpression()), !dbg !47
// br label %label_1, !dbg !48
goto T1BLOCK1;
T1BLOCK1:
// call void @llvm.dbg.label(metadata !46), !dbg !49
// call void @llvm.dbg.value(metadata i64* getelementptr inbounds ([2 x i64], [2 x i64]* @vars, i64 0, i64 0), metadata !39, metadata !DIExpression()), !dbg !50
// call void @llvm.dbg.value(metadata i64 2, metadata !42, metadata !DIExpression()), !dbg !50
// store atomic i64 2, i64* getelementptr inbounds ([2 x i64], [2 x i64]* @vars, i64 0, i64 0) monotonic, align 8, !dbg !51
// ST: Guess
iw(1,0) = get_rng(0,NCONTEXT-1);// 1 ASSIGN STIW _l21_c3
old_cw = cw(1,0);
cw(1,0) = get_rng(0,NCONTEXT-1);// 1 ASSIGN STCOM _l21_c3
// Check
ASSUME(active[iw(1,0)] == 1);
ASSUME(active[cw(1,0)] == 1);
ASSUME(sforbid(0,cw(1,0))== 0);
ASSUME(iw(1,0) >= 0);
ASSUME(iw(1,0) >= 0);
ASSUME(cw(1,0) >= iw(1,0));
ASSUME(cw(1,0) >= old_cw);
ASSUME(cw(1,0) >= cr(1,0));
ASSUME(cw(1,0) >= cl[1]);
ASSUME(cw(1,0) >= cisb[1]);
ASSUME(cw(1,0) >= cdy[1]);
ASSUME(cw(1,0) >= cdl[1]);
ASSUME(cw(1,0) >= cds[1]);
ASSUME(cw(1,0) >= cctrl[1]);
ASSUME(cw(1,0) >= caddr[1]);
// Update
caddr[1] = max(caddr[1],0);
buff(1,0) = 2;
mem(0,cw(1,0)) = 2;
co(0,cw(1,0))+=1;
delta(0,cw(1,0)) = -1;
ASSUME(creturn[1] >= cw(1,0));
// call void (...) @dmbsy(), !dbg !52
// dumbsy: Guess
old_cdy = cdy[1];
cdy[1] = get_rng(0,NCONTEXT-1);
// Check
ASSUME(cdy[1] >= old_cdy);
ASSUME(cdy[1] >= cisb[1]);
ASSUME(cdy[1] >= cdl[1]);
ASSUME(cdy[1] >= cds[1]);
ASSUME(cdy[1] >= cctrl[1]);
ASSUME(cdy[1] >= cw(1,2+0));
ASSUME(cdy[1] >= cw(1,0+0));
ASSUME(cdy[1] >= cw(1,0+1));
ASSUME(cdy[1] >= cw(1,3+0));
ASSUME(cdy[1] >= cw(1,4+0));
ASSUME(cdy[1] >= cr(1,2+0));
ASSUME(cdy[1] >= cr(1,0+0));
ASSUME(cdy[1] >= cr(1,0+1));
ASSUME(cdy[1] >= cr(1,3+0));
ASSUME(cdy[1] >= cr(1,4+0));
ASSUME(creturn[1] >= cdy[1]);
// call void @llvm.dbg.value(metadata i64* getelementptr inbounds ([2 x i64], [2 x i64]* @vars, i64 0, i64 1), metadata !43, metadata !DIExpression()), !dbg !53
// call void @llvm.dbg.value(metadata i64 1, metadata !45, metadata !DIExpression()), !dbg !53
// store atomic i64 1, i64* getelementptr inbounds ([2 x i64], [2 x i64]* @vars, i64 0, i64 1) monotonic, align 8, !dbg !54
// ST: Guess
iw(1,0+1*1) = get_rng(0,NCONTEXT-1);// 1 ASSIGN STIW _l23_c3
old_cw = cw(1,0+1*1);
cw(1,0+1*1) = get_rng(0,NCONTEXT-1);// 1 ASSIGN STCOM _l23_c3
// Check
ASSUME(active[iw(1,0+1*1)] == 1);
ASSUME(active[cw(1,0+1*1)] == 1);
ASSUME(sforbid(0+1*1,cw(1,0+1*1))== 0);
ASSUME(iw(1,0+1*1) >= 0);
ASSUME(iw(1,0+1*1) >= 0);
ASSUME(cw(1,0+1*1) >= iw(1,0+1*1));
ASSUME(cw(1,0+1*1) >= old_cw);
ASSUME(cw(1,0+1*1) >= cr(1,0+1*1));
ASSUME(cw(1,0+1*1) >= cl[1]);
ASSUME(cw(1,0+1*1) >= cisb[1]);
ASSUME(cw(1,0+1*1) >= cdy[1]);
ASSUME(cw(1,0+1*1) >= cdl[1]);
ASSUME(cw(1,0+1*1) >= cds[1]);
ASSUME(cw(1,0+1*1) >= cctrl[1]);
ASSUME(cw(1,0+1*1) >= caddr[1]);
// Update
caddr[1] = max(caddr[1],0);
buff(1,0+1*1) = 1;
mem(0+1*1,cw(1,0+1*1)) = 1;
co(0+1*1,cw(1,0+1*1))+=1;
delta(0+1*1,cw(1,0+1*1)) = -1;
ASSUME(creturn[1] >= cw(1,0+1*1));
// ret i8* null, !dbg !55
ret_thread_1 = (- 1);
goto T1BLOCK_END;
T1BLOCK_END:
// Dumping thread 2
int ret_thread_2 = 0;
cdy[2] = get_rng(0,NCONTEXT-1);
ASSUME(cdy[2] >= cstart[2]);
T2BLOCK0:
// call void @llvm.dbg.value(metadata i8* %arg, metadata !58, metadata !DIExpression()), !dbg !82
// br label %label_2, !dbg !64
goto T2BLOCK1;
T2BLOCK1:
// call void @llvm.dbg.label(metadata !80), !dbg !84
// call void @llvm.dbg.value(metadata i64* getelementptr inbounds ([2 x i64], [2 x i64]* @vars, i64 0, i64 1), metadata !60, metadata !DIExpression()), !dbg !85
// %0 = load atomic i64, i64* getelementptr inbounds ([2 x i64], [2 x i64]* @vars, i64 0, i64 1) monotonic, align 8, !dbg !67
// LD: Guess
old_cr = cr(2,0+1*1);
cr(2,0+1*1) = get_rng(0,NCONTEXT-1);// 2 ASSIGN LDCOM _l29_c15
// Check
ASSUME(active[cr(2,0+1*1)] == 2);
ASSUME(cr(2,0+1*1) >= iw(2,0+1*1));
ASSUME(cr(2,0+1*1) >= 0);
ASSUME(cr(2,0+1*1) >= cdy[2]);
ASSUME(cr(2,0+1*1) >= cisb[2]);
ASSUME(cr(2,0+1*1) >= cdl[2]);
ASSUME(cr(2,0+1*1) >= cl[2]);
// Update
creg_r0 = cr(2,0+1*1);
crmax(2,0+1*1) = max(crmax(2,0+1*1),cr(2,0+1*1));
caddr[2] = max(caddr[2],0);
if(cr(2,0+1*1) < cw(2,0+1*1)) {
r0 = buff(2,0+1*1);
ASSUME((!(( (cw(2,0+1*1) < 1) && (1 < crmax(2,0+1*1)) )))||(sforbid(0+1*1,1)> 0));
ASSUME((!(( (cw(2,0+1*1) < 2) && (2 < crmax(2,0+1*1)) )))||(sforbid(0+1*1,2)> 0));
ASSUME((!(( (cw(2,0+1*1) < 3) && (3 < crmax(2,0+1*1)) )))||(sforbid(0+1*1,3)> 0));
ASSUME((!(( (cw(2,0+1*1) < 4) && (4 < crmax(2,0+1*1)) )))||(sforbid(0+1*1,4)> 0));
} else {
if(pw(2,0+1*1) != co(0+1*1,cr(2,0+1*1))) {
ASSUME(cr(2,0+1*1) >= old_cr);
}
pw(2,0+1*1) = co(0+1*1,cr(2,0+1*1));
r0 = mem(0+1*1,cr(2,0+1*1));
}
ASSUME(creturn[2] >= cr(2,0+1*1));
// call void @llvm.dbg.value(metadata i64 %0, metadata !62, metadata !DIExpression()), !dbg !85
// %conv = trunc i64 %0 to i32, !dbg !68
// call void @llvm.dbg.value(metadata i32 %conv, metadata !59, metadata !DIExpression()), !dbg !82
// call void @llvm.dbg.value(metadata i64* getelementptr inbounds ([2 x i64], [2 x i64]* @vars, i64 0, i64 1), metadata !63, metadata !DIExpression()), !dbg !88
// call void @llvm.dbg.value(metadata i64 2, metadata !65, metadata !DIExpression()), !dbg !88
// store atomic i64 2, i64* getelementptr inbounds ([2 x i64], [2 x i64]* @vars, i64 0, i64 1) monotonic, align 8, !dbg !70
// ST: Guess
iw(2,0+1*1) = get_rng(0,NCONTEXT-1);// 2 ASSIGN STIW _l30_c3
old_cw = cw(2,0+1*1);
cw(2,0+1*1) = get_rng(0,NCONTEXT-1);// 2 ASSIGN STCOM _l30_c3
// Check
ASSUME(active[iw(2,0+1*1)] == 2);
ASSUME(active[cw(2,0+1*1)] == 2);
ASSUME(sforbid(0+1*1,cw(2,0+1*1))== 0);
ASSUME(iw(2,0+1*1) >= 0);
ASSUME(iw(2,0+1*1) >= 0);
ASSUME(cw(2,0+1*1) >= iw(2,0+1*1));
ASSUME(cw(2,0+1*1) >= old_cw);
ASSUME(cw(2,0+1*1) >= cr(2,0+1*1));
ASSUME(cw(2,0+1*1) >= cl[2]);
ASSUME(cw(2,0+1*1) >= cisb[2]);
ASSUME(cw(2,0+1*1) >= cdy[2]);
ASSUME(cw(2,0+1*1) >= cdl[2]);
ASSUME(cw(2,0+1*1) >= cds[2]);
ASSUME(cw(2,0+1*1) >= cctrl[2]);
ASSUME(cw(2,0+1*1) >= caddr[2]);
// Update
caddr[2] = max(caddr[2],0);
buff(2,0+1*1) = 2;
mem(0+1*1,cw(2,0+1*1)) = 2;
co(0+1*1,cw(2,0+1*1))+=1;
delta(0+1*1,cw(2,0+1*1)) = -1;
ASSUME(creturn[2] >= cw(2,0+1*1));
// call void @llvm.dbg.value(metadata i64* getelementptr inbounds ([2 x i64], [2 x i64]* @vars, i64 0, i64 1), metadata !67, metadata !DIExpression()), !dbg !90
// %1 = load atomic i64, i64* getelementptr inbounds ([2 x i64], [2 x i64]* @vars, i64 0, i64 1) monotonic, align 8, !dbg !72
// LD: Guess
old_cr = cr(2,0+1*1);
cr(2,0+1*1) = get_rng(0,NCONTEXT-1);// 2 ASSIGN LDCOM _l31_c15
// Check
ASSUME(active[cr(2,0+1*1)] == 2);
ASSUME(cr(2,0+1*1) >= iw(2,0+1*1));
ASSUME(cr(2,0+1*1) >= 0);
ASSUME(cr(2,0+1*1) >= cdy[2]);
ASSUME(cr(2,0+1*1) >= cisb[2]);
ASSUME(cr(2,0+1*1) >= cdl[2]);
ASSUME(cr(2,0+1*1) >= cl[2]);
// Update
creg_r1 = cr(2,0+1*1);
crmax(2,0+1*1) = max(crmax(2,0+1*1),cr(2,0+1*1));
caddr[2] = max(caddr[2],0);
if(cr(2,0+1*1) < cw(2,0+1*1)) {
r1 = buff(2,0+1*1);
ASSUME((!(( (cw(2,0+1*1) < 1) && (1 < crmax(2,0+1*1)) )))||(sforbid(0+1*1,1)> 0));
ASSUME((!(( (cw(2,0+1*1) < 2) && (2 < crmax(2,0+1*1)) )))||(sforbid(0+1*1,2)> 0));
ASSUME((!(( (cw(2,0+1*1) < 3) && (3 < crmax(2,0+1*1)) )))||(sforbid(0+1*1,3)> 0));
ASSUME((!(( (cw(2,0+1*1) < 4) && (4 < crmax(2,0+1*1)) )))||(sforbid(0+1*1,4)> 0));
} else {
if(pw(2,0+1*1) != co(0+1*1,cr(2,0+1*1))) {
ASSUME(cr(2,0+1*1) >= old_cr);
}
pw(2,0+1*1) = co(0+1*1,cr(2,0+1*1));
r1 = mem(0+1*1,cr(2,0+1*1));
}
ASSUME(creturn[2] >= cr(2,0+1*1));
// call void @llvm.dbg.value(metadata i64 %1, metadata !69, metadata !DIExpression()), !dbg !90
// %conv4 = trunc i64 %1 to i32, !dbg !73
// call void @llvm.dbg.value(metadata i32 %conv4, metadata !66, metadata !DIExpression()), !dbg !82
// %tobool = icmp ne i32 %conv4, 0, !dbg !74
creg__r1__0_ = max(0,creg_r1);
// br i1 %tobool, label %if.then, label %if.else, !dbg !76
old_cctrl = cctrl[2];
cctrl[2] = get_rng(0,NCONTEXT-1);
ASSUME(cctrl[2] >= old_cctrl);
ASSUME(cctrl[2] >= creg__r1__0_);
if((r1!=0)) {
goto T2BLOCK2;
} else {
goto T2BLOCK3;
}
T2BLOCK2:
// br label %lbl_LC00, !dbg !77
goto T2BLOCK4;
T2BLOCK3:
// br label %lbl_LC00, !dbg !78
goto T2BLOCK4;
T2BLOCK4:
// call void @llvm.dbg.label(metadata !81), !dbg !98
// call void @llvm.dbg.value(metadata i64* getelementptr inbounds ([2 x i64], [2 x i64]* @vars, i64 0, i64 0), metadata !70, metadata !DIExpression()), !dbg !99
// call void @llvm.dbg.value(metadata i64 1, metadata !72, metadata !DIExpression()), !dbg !99
// store atomic i64 1, i64* getelementptr inbounds ([2 x i64], [2 x i64]* @vars, i64 0, i64 0) monotonic, align 8, !dbg !81
// ST: Guess
iw(2,0) = get_rng(0,NCONTEXT-1);// 2 ASSIGN STIW _l34_c3
old_cw = cw(2,0);
cw(2,0) = get_rng(0,NCONTEXT-1);// 2 ASSIGN STCOM _l34_c3
// Check
ASSUME(active[iw(2,0)] == 2);
ASSUME(active[cw(2,0)] == 2);
ASSUME(sforbid(0,cw(2,0))== 0);
ASSUME(iw(2,0) >= 0);
ASSUME(iw(2,0) >= 0);
ASSUME(cw(2,0) >= iw(2,0));
ASSUME(cw(2,0) >= old_cw);
ASSUME(cw(2,0) >= cr(2,0));
ASSUME(cw(2,0) >= cl[2]);
ASSUME(cw(2,0) >= cisb[2]);
ASSUME(cw(2,0) >= cdy[2]);
ASSUME(cw(2,0) >= cdl[2]);
ASSUME(cw(2,0) >= cds[2]);
ASSUME(cw(2,0) >= cctrl[2]);
ASSUME(cw(2,0) >= caddr[2]);
// Update
caddr[2] = max(caddr[2],0);
buff(2,0) = 1;
mem(0,cw(2,0)) = 1;
co(0,cw(2,0))+=1;
delta(0,cw(2,0)) = -1;
ASSUME(creturn[2] >= cw(2,0));
// call void @llvm.dbg.value(metadata i64* getelementptr inbounds ([2 x i64], [2 x i64]* @vars, i64 0, i64 0), metadata !74, metadata !DIExpression()), !dbg !101
// %2 = load atomic i64, i64* getelementptr inbounds ([2 x i64], [2 x i64]* @vars, i64 0, i64 0) monotonic, align 8, !dbg !83
// LD: Guess
old_cr = cr(2,0);
cr(2,0) = get_rng(0,NCONTEXT-1);// 2 ASSIGN LDCOM _l35_c15
// Check
ASSUME(active[cr(2,0)] == 2);
ASSUME(cr(2,0) >= iw(2,0));
ASSUME(cr(2,0) >= 0);
ASSUME(cr(2,0) >= cdy[2]);
ASSUME(cr(2,0) >= cisb[2]);
ASSUME(cr(2,0) >= cdl[2]);
ASSUME(cr(2,0) >= cl[2]);
// Update
creg_r2 = cr(2,0);
crmax(2,0) = max(crmax(2,0),cr(2,0));
caddr[2] = max(caddr[2],0);
if(cr(2,0) < cw(2,0)) {
r2 = buff(2,0);
ASSUME((!(( (cw(2,0) < 1) && (1 < crmax(2,0)) )))||(sforbid(0,1)> 0));
ASSUME((!(( (cw(2,0) < 2) && (2 < crmax(2,0)) )))||(sforbid(0,2)> 0));
ASSUME((!(( (cw(2,0) < 3) && (3 < crmax(2,0)) )))||(sforbid(0,3)> 0));
ASSUME((!(( (cw(2,0) < 4) && (4 < crmax(2,0)) )))||(sforbid(0,4)> 0));
} else {
if(pw(2,0) != co(0,cr(2,0))) {
ASSUME(cr(2,0) >= old_cr);
}
pw(2,0) = co(0,cr(2,0));
r2 = mem(0,cr(2,0));
}
ASSUME(creturn[2] >= cr(2,0));
// call void @llvm.dbg.value(metadata i64 %2, metadata !76, metadata !DIExpression()), !dbg !101
// %conv10 = trunc i64 %2 to i32, !dbg !84
// call void @llvm.dbg.value(metadata i32 %conv10, metadata !73, metadata !DIExpression()), !dbg !82
// %cmp = icmp eq i32 %conv, 1, !dbg !85
creg__r0__1_ = max(0,creg_r0);
// %conv11 = zext i1 %cmp to i32, !dbg !85
// call void @llvm.dbg.value(metadata i32 %conv11, metadata !77, metadata !DIExpression()), !dbg !82
// store i32 %conv11, i32* @atom_1_X0_1, align 4, !dbg !86, !tbaa !87
// ST: Guess
iw(2,2) = get_rng(0,NCONTEXT-1);// 2 ASSIGN STIW _l37_c15
old_cw = cw(2,2);
cw(2,2) = get_rng(0,NCONTEXT-1);// 2 ASSIGN STCOM _l37_c15
// Check
ASSUME(active[iw(2,2)] == 2);
ASSUME(active[cw(2,2)] == 2);
ASSUME(sforbid(2,cw(2,2))== 0);
ASSUME(iw(2,2) >= creg__r0__1_);
ASSUME(iw(2,2) >= 0);
ASSUME(cw(2,2) >= iw(2,2));
ASSUME(cw(2,2) >= old_cw);
ASSUME(cw(2,2) >= cr(2,2));
ASSUME(cw(2,2) >= cl[2]);
ASSUME(cw(2,2) >= cisb[2]);
ASSUME(cw(2,2) >= cdy[2]);
ASSUME(cw(2,2) >= cdl[2]);
ASSUME(cw(2,2) >= cds[2]);
ASSUME(cw(2,2) >= cctrl[2]);
ASSUME(cw(2,2) >= caddr[2]);
// Update
caddr[2] = max(caddr[2],0);
buff(2,2) = (r0==1);
mem(2,cw(2,2)) = (r0==1);
co(2,cw(2,2))+=1;
delta(2,cw(2,2)) = -1;
ASSUME(creturn[2] >= cw(2,2));
// %cmp12 = icmp eq i32 %conv4, 2, !dbg !91
creg__r1__2_ = max(0,creg_r1);
// %conv13 = zext i1 %cmp12 to i32, !dbg !91
// call void @llvm.dbg.value(metadata i32 %conv13, metadata !78, metadata !DIExpression()), !dbg !82
// store i32 %conv13, i32* @atom_1_X3_2, align 4, !dbg !92, !tbaa !87
// ST: Guess
iw(2,3) = get_rng(0,NCONTEXT-1);// 2 ASSIGN STIW _l39_c15
old_cw = cw(2,3);
cw(2,3) = get_rng(0,NCONTEXT-1);// 2 ASSIGN STCOM _l39_c15
// Check
ASSUME(active[iw(2,3)] == 2);
ASSUME(active[cw(2,3)] == 2);
ASSUME(sforbid(3,cw(2,3))== 0);
ASSUME(iw(2,3) >= creg__r1__2_);
ASSUME(iw(2,3) >= 0);
ASSUME(cw(2,3) >= iw(2,3));
ASSUME(cw(2,3) >= old_cw);
ASSUME(cw(2,3) >= cr(2,3));
ASSUME(cw(2,3) >= cl[2]);
ASSUME(cw(2,3) >= cisb[2]);
ASSUME(cw(2,3) >= cdy[2]);
ASSUME(cw(2,3) >= cdl[2]);
ASSUME(cw(2,3) >= cds[2]);
ASSUME(cw(2,3) >= cctrl[2]);
ASSUME(cw(2,3) >= caddr[2]);
// Update
caddr[2] = max(caddr[2],0);
buff(2,3) = (r1==2);
mem(3,cw(2,3)) = (r1==2);
co(3,cw(2,3))+=1;
delta(3,cw(2,3)) = -1;
ASSUME(creturn[2] >= cw(2,3));
// %cmp14 = icmp eq i32 %conv10, 1, !dbg !93
creg__r2__1_ = max(0,creg_r2);
// %conv15 = zext i1 %cmp14 to i32, !dbg !93
// call void @llvm.dbg.value(metadata i32 %conv15, metadata !79, metadata !DIExpression()), !dbg !82
// store i32 %conv15, i32* @atom_1_X6_1, align 4, !dbg !94, !tbaa !87
// ST: Guess
iw(2,4) = get_rng(0,NCONTEXT-1);// 2 ASSIGN STIW _l41_c15
old_cw = cw(2,4);
cw(2,4) = get_rng(0,NCONTEXT-1);// 2 ASSIGN STCOM _l41_c15
// Check
ASSUME(active[iw(2,4)] == 2);
ASSUME(active[cw(2,4)] == 2);
ASSUME(sforbid(4,cw(2,4))== 0);
ASSUME(iw(2,4) >= creg__r2__1_);
ASSUME(iw(2,4) >= 0);
ASSUME(cw(2,4) >= iw(2,4));
ASSUME(cw(2,4) >= old_cw);
ASSUME(cw(2,4) >= cr(2,4));
ASSUME(cw(2,4) >= cl[2]);
ASSUME(cw(2,4) >= cisb[2]);
ASSUME(cw(2,4) >= cdy[2]);
ASSUME(cw(2,4) >= cdl[2]);
ASSUME(cw(2,4) >= cds[2]);
ASSUME(cw(2,4) >= cctrl[2]);
ASSUME(cw(2,4) >= caddr[2]);
// Update
caddr[2] = max(caddr[2],0);
buff(2,4) = (r2==1);
mem(4,cw(2,4)) = (r2==1);
co(4,cw(2,4))+=1;
delta(4,cw(2,4)) = -1;
ASSUME(creturn[2] >= cw(2,4));
// ret i8* null, !dbg !95
ret_thread_2 = (- 1);
goto T2BLOCK_END;
T2BLOCK_END:
// Dumping thread 0
int ret_thread_0 = 0;
cdy[0] = get_rng(0,NCONTEXT-1);
ASSUME(cdy[0] >= cstart[0]);
T0BLOCK0:
// %thr0 = alloca i64, align 8
// %thr1 = alloca i64, align 8
// call void @llvm.dbg.value(metadata i32 %argc, metadata !122, metadata !DIExpression()), !dbg !152
// call void @llvm.dbg.value(metadata i8** %argv, metadata !123, metadata !DIExpression()), !dbg !152
// %0 = bitcast i64* %thr0 to i8*, !dbg !73
// call void @llvm.lifetime.start.p0i8(i64 8, i8* %0) #7, !dbg !73
// call void @llvm.dbg.declare(metadata i64* %thr0, metadata !124, metadata !DIExpression()), !dbg !154
// %1 = bitcast i64* %thr1 to i8*, !dbg !75
// call void @llvm.lifetime.start.p0i8(i64 8, i8* %1) #7, !dbg !75
// call void @llvm.dbg.declare(metadata i64* %thr1, metadata !128, metadata !DIExpression()), !dbg !156
// call void @llvm.dbg.value(metadata i64* getelementptr inbounds ([2 x i64], [2 x i64]* @vars, i64 0, i64 1), metadata !129, metadata !DIExpression()), !dbg !157
// call void @llvm.dbg.value(metadata i64 0, metadata !131, metadata !DIExpression()), !dbg !157
// store atomic i64 0, i64* getelementptr inbounds ([2 x i64], [2 x i64]* @vars, i64 0, i64 1) monotonic, align 8, !dbg !78
// ST: Guess
iw(0,0+1*1) = get_rng(0,NCONTEXT-1);// 0 ASSIGN STIW _l49_c3
old_cw = cw(0,0+1*1);
cw(0,0+1*1) = get_rng(0,NCONTEXT-1);// 0 ASSIGN STCOM _l49_c3
// Check
ASSUME(active[iw(0,0+1*1)] == 0);
ASSUME(active[cw(0,0+1*1)] == 0);
ASSUME(sforbid(0+1*1,cw(0,0+1*1))== 0);
ASSUME(iw(0,0+1*1) >= 0);
ASSUME(iw(0,0+1*1) >= 0);
ASSUME(cw(0,0+1*1) >= iw(0,0+1*1));
ASSUME(cw(0,0+1*1) >= old_cw);
ASSUME(cw(0,0+1*1) >= cr(0,0+1*1));
ASSUME(cw(0,0+1*1) >= cl[0]);
ASSUME(cw(0,0+1*1) >= cisb[0]);
ASSUME(cw(0,0+1*1) >= cdy[0]);
ASSUME(cw(0,0+1*1) >= cdl[0]);
ASSUME(cw(0,0+1*1) >= cds[0]);
ASSUME(cw(0,0+1*1) >= cctrl[0]);
ASSUME(cw(0,0+1*1) >= caddr[0]);
// Update
caddr[0] = max(caddr[0],0);
buff(0,0+1*1) = 0;
mem(0+1*1,cw(0,0+1*1)) = 0;
co(0+1*1,cw(0,0+1*1))+=1;
delta(0+1*1,cw(0,0+1*1)) = -1;
ASSUME(creturn[0] >= cw(0,0+1*1));
// call void @llvm.dbg.value(metadata i64* getelementptr inbounds ([2 x i64], [2 x i64]* @vars, i64 0, i64 0), metadata !132, metadata !DIExpression()), !dbg !159
// call void @llvm.dbg.value(metadata i64 0, metadata !134, metadata !DIExpression()), !dbg !159
// store atomic i64 0, i64* getelementptr inbounds ([2 x i64], [2 x i64]* @vars, i64 0, i64 0) monotonic, align 8, !dbg !80
// ST: Guess
iw(0,0) = get_rng(0,NCONTEXT-1);// 0 ASSIGN STIW _l50_c3
old_cw = cw(0,0);
cw(0,0) = get_rng(0,NCONTEXT-1);// 0 ASSIGN STCOM _l50_c3
// Check
ASSUME(active[iw(0,0)] == 0);
ASSUME(active[cw(0,0)] == 0);
ASSUME(sforbid(0,cw(0,0))== 0);
ASSUME(iw(0,0) >= 0);
ASSUME(iw(0,0) >= 0);
ASSUME(cw(0,0) >= iw(0,0));
ASSUME(cw(0,0) >= old_cw);
ASSUME(cw(0,0) >= cr(0,0));
ASSUME(cw(0,0) >= cl[0]);
ASSUME(cw(0,0) >= cisb[0]);
ASSUME(cw(0,0) >= cdy[0]);
ASSUME(cw(0,0) >= cdl[0]);
ASSUME(cw(0,0) >= cds[0]);
ASSUME(cw(0,0) >= cctrl[0]);
ASSUME(cw(0,0) >= caddr[0]);
// Update
caddr[0] = max(caddr[0],0);
buff(0,0) = 0;
mem(0,cw(0,0)) = 0;
co(0,cw(0,0))+=1;
delta(0,cw(0,0)) = -1;
ASSUME(creturn[0] >= cw(0,0));
// store i32 0, i32* @atom_1_X0_1, align 4, !dbg !81, !tbaa !82
// ST: Guess
iw(0,2) = get_rng(0,NCONTEXT-1);// 0 ASSIGN STIW _l51_c15
old_cw = cw(0,2);
cw(0,2) = get_rng(0,NCONTEXT-1);// 0 ASSIGN STCOM _l51_c15
// Check
ASSUME(active[iw(0,2)] == 0);
ASSUME(active[cw(0,2)] == 0);
ASSUME(sforbid(2,cw(0,2))== 0);
ASSUME(iw(0,2) >= 0);
ASSUME(iw(0,2) >= 0);
ASSUME(cw(0,2) >= iw(0,2));
ASSUME(cw(0,2) >= old_cw);
ASSUME(cw(0,2) >= cr(0,2));
ASSUME(cw(0,2) >= cl[0]);
ASSUME(cw(0,2) >= cisb[0]);
ASSUME(cw(0,2) >= cdy[0]);
ASSUME(cw(0,2) >= cdl[0]);
ASSUME(cw(0,2) >= cds[0]);
ASSUME(cw(0,2) >= cctrl[0]);
ASSUME(cw(0,2) >= caddr[0]);
// Update
caddr[0] = max(caddr[0],0);
buff(0,2) = 0;
mem(2,cw(0,2)) = 0;
co(2,cw(0,2))+=1;
delta(2,cw(0,2)) = -1;
ASSUME(creturn[0] >= cw(0,2));
// store i32 0, i32* @atom_1_X3_2, align 4, !dbg !86, !tbaa !82
// ST: Guess
iw(0,3) = get_rng(0,NCONTEXT-1);// 0 ASSIGN STIW _l52_c15
old_cw = cw(0,3);
cw(0,3) = get_rng(0,NCONTEXT-1);// 0 ASSIGN STCOM _l52_c15
// Check
ASSUME(active[iw(0,3)] == 0);
ASSUME(active[cw(0,3)] == 0);
ASSUME(sforbid(3,cw(0,3))== 0);
ASSUME(iw(0,3) >= 0);
ASSUME(iw(0,3) >= 0);
ASSUME(cw(0,3) >= iw(0,3));
ASSUME(cw(0,3) >= old_cw);
ASSUME(cw(0,3) >= cr(0,3));
ASSUME(cw(0,3) >= cl[0]);
ASSUME(cw(0,3) >= cisb[0]);
ASSUME(cw(0,3) >= cdy[0]);
ASSUME(cw(0,3) >= cdl[0]);
ASSUME(cw(0,3) >= cds[0]);
ASSUME(cw(0,3) >= cctrl[0]);
ASSUME(cw(0,3) >= caddr[0]);
// Update
caddr[0] = max(caddr[0],0);
buff(0,3) = 0;
mem(3,cw(0,3)) = 0;
co(3,cw(0,3))+=1;
delta(3,cw(0,3)) = -1;
ASSUME(creturn[0] >= cw(0,3));
// store i32 0, i32* @atom_1_X6_1, align 4, !dbg !87, !tbaa !82
// ST: Guess
iw(0,4) = get_rng(0,NCONTEXT-1);// 0 ASSIGN STIW _l53_c15
old_cw = cw(0,4);
cw(0,4) = get_rng(0,NCONTEXT-1);// 0 ASSIGN STCOM _l53_c15
// Check
ASSUME(active[iw(0,4)] == 0);
ASSUME(active[cw(0,4)] == 0);
ASSUME(sforbid(4,cw(0,4))== 0);
ASSUME(iw(0,4) >= 0);
ASSUME(iw(0,4) >= 0);
ASSUME(cw(0,4) >= iw(0,4));
ASSUME(cw(0,4) >= old_cw);
ASSUME(cw(0,4) >= cr(0,4));
ASSUME(cw(0,4) >= cl[0]);
ASSUME(cw(0,4) >= cisb[0]);
ASSUME(cw(0,4) >= cdy[0]);
ASSUME(cw(0,4) >= cdl[0]);
ASSUME(cw(0,4) >= cds[0]);
ASSUME(cw(0,4) >= cctrl[0]);
ASSUME(cw(0,4) >= caddr[0]);
// Update
caddr[0] = max(caddr[0],0);
buff(0,4) = 0;
mem(4,cw(0,4)) = 0;
co(4,cw(0,4))+=1;
delta(4,cw(0,4)) = -1;
ASSUME(creturn[0] >= cw(0,4));
// %call = call i32 @pthread_create(i64* noundef %thr0, %union.pthread_attr_t* noundef null, i8* (i8*)* noundef @t0, i8* noundef null) #7, !dbg !88
// dumbsy: Guess
old_cdy = cdy[0];
cdy[0] = get_rng(0,NCONTEXT-1);
// Check
ASSUME(cdy[0] >= old_cdy);
ASSUME(cdy[0] >= cisb[0]);
ASSUME(cdy[0] >= cdl[0]);
ASSUME(cdy[0] >= cds[0]);
ASSUME(cdy[0] >= cctrl[0]);
ASSUME(cdy[0] >= cw(0,2+0));
ASSUME(cdy[0] >= cw(0,0+0));
ASSUME(cdy[0] >= cw(0,0+1));
ASSUME(cdy[0] >= cw(0,3+0));
ASSUME(cdy[0] >= cw(0,4+0));
ASSUME(cdy[0] >= cr(0,2+0));
ASSUME(cdy[0] >= cr(0,0+0));
ASSUME(cdy[0] >= cr(0,0+1));
ASSUME(cdy[0] >= cr(0,3+0));
ASSUME(cdy[0] >= cr(0,4+0));
ASSUME(creturn[0] >= cdy[0]);
ASSUME(cstart[1] >= cdy[0]);
// %call3 = call i32 @pthread_create(i64* noundef %thr1, %union.pthread_attr_t* noundef null, i8* (i8*)* noundef @t1, i8* noundef null) #7, !dbg !89
// dumbsy: Guess
old_cdy = cdy[0];
cdy[0] = get_rng(0,NCONTEXT-1);
// Check
ASSUME(cdy[0] >= old_cdy);
ASSUME(cdy[0] >= cisb[0]);
ASSUME(cdy[0] >= cdl[0]);
ASSUME(cdy[0] >= cds[0]);
ASSUME(cdy[0] >= cctrl[0]);
ASSUME(cdy[0] >= cw(0,2+0));
ASSUME(cdy[0] >= cw(0,0+0));
ASSUME(cdy[0] >= cw(0,0+1));
ASSUME(cdy[0] >= cw(0,3+0));
ASSUME(cdy[0] >= cw(0,4+0));
ASSUME(cdy[0] >= cr(0,2+0));
ASSUME(cdy[0] >= cr(0,0+0));
ASSUME(cdy[0] >= cr(0,0+1));
ASSUME(cdy[0] >= cr(0,3+0));
ASSUME(cdy[0] >= cr(0,4+0));
ASSUME(creturn[0] >= cdy[0]);
ASSUME(cstart[2] >= cdy[0]);
// %2 = load i64, i64* %thr0, align 8, !dbg !90, !tbaa !91
r4 = local_mem[0];
// %call4 = call i32 @pthread_join(i64 noundef %2, i8** noundef null), !dbg !93
// dumbsy: Guess
old_cdy = cdy[0];
cdy[0] = get_rng(0,NCONTEXT-1);
// Check
ASSUME(cdy[0] >= old_cdy);
ASSUME(cdy[0] >= cisb[0]);
ASSUME(cdy[0] >= cdl[0]);
ASSUME(cdy[0] >= cds[0]);
ASSUME(cdy[0] >= cctrl[0]);
ASSUME(cdy[0] >= cw(0,2+0));
ASSUME(cdy[0] >= cw(0,0+0));
ASSUME(cdy[0] >= cw(0,0+1));
ASSUME(cdy[0] >= cw(0,3+0));
ASSUME(cdy[0] >= cw(0,4+0));
ASSUME(cdy[0] >= cr(0,2+0));
ASSUME(cdy[0] >= cr(0,0+0));
ASSUME(cdy[0] >= cr(0,0+1));
ASSUME(cdy[0] >= cr(0,3+0));
ASSUME(cdy[0] >= cr(0,4+0));
ASSUME(creturn[0] >= cdy[0]);
ASSUME(cdy[0] >= creturn[1]);
// %3 = load i64, i64* %thr1, align 8, !dbg !94, !tbaa !91
r5 = local_mem[1];
// %call5 = call i32 @pthread_join(i64 noundef %3, i8** noundef null), !dbg !95
// dumbsy: Guess
old_cdy = cdy[0];
cdy[0] = get_rng(0,NCONTEXT-1);
// Check
ASSUME(cdy[0] >= old_cdy);
ASSUME(cdy[0] >= cisb[0]);
ASSUME(cdy[0] >= cdl[0]);
ASSUME(cdy[0] >= cds[0]);
ASSUME(cdy[0] >= cctrl[0]);
ASSUME(cdy[0] >= cw(0,2+0));
ASSUME(cdy[0] >= cw(0,0+0));
ASSUME(cdy[0] >= cw(0,0+1));
ASSUME(cdy[0] >= cw(0,3+0));
ASSUME(cdy[0] >= cw(0,4+0));
ASSUME(cdy[0] >= cr(0,2+0));
ASSUME(cdy[0] >= cr(0,0+0));
ASSUME(cdy[0] >= cr(0,0+1));
ASSUME(cdy[0] >= cr(0,3+0));
ASSUME(cdy[0] >= cr(0,4+0));
ASSUME(creturn[0] >= cdy[0]);
ASSUME(cdy[0] >= creturn[2]);
// call void @llvm.dbg.value(metadata i64* getelementptr inbounds ([2 x i64], [2 x i64]* @vars, i64 0, i64 0), metadata !136, metadata !DIExpression()), !dbg !172
// %4 = load atomic i64, i64* getelementptr inbounds ([2 x i64], [2 x i64]* @vars, i64 0, i64 0) monotonic, align 8, !dbg !97
// LD: Guess
old_cr = cr(0,0);
cr(0,0) = get_rng(0,NCONTEXT-1);// 0 ASSIGN LDCOM _l61_c13
// Check
ASSUME(active[cr(0,0)] == 0);
ASSUME(cr(0,0) >= iw(0,0));
ASSUME(cr(0,0) >= 0);
ASSUME(cr(0,0) >= cdy[0]);
ASSUME(cr(0,0) >= cisb[0]);
ASSUME(cr(0,0) >= cdl[0]);
ASSUME(cr(0,0) >= cl[0]);
// Update
creg_r6 = cr(0,0);
crmax(0,0) = max(crmax(0,0),cr(0,0));
caddr[0] = max(caddr[0],0);
if(cr(0,0) < cw(0,0)) {
r6 = buff(0,0);
ASSUME((!(( (cw(0,0) < 1) && (1 < crmax(0,0)) )))||(sforbid(0,1)> 0));
ASSUME((!(( (cw(0,0) < 2) && (2 < crmax(0,0)) )))||(sforbid(0,2)> 0));
ASSUME((!(( (cw(0,0) < 3) && (3 < crmax(0,0)) )))||(sforbid(0,3)> 0));
ASSUME((!(( (cw(0,0) < 4) && (4 < crmax(0,0)) )))||(sforbid(0,4)> 0));
} else {
if(pw(0,0) != co(0,cr(0,0))) {
ASSUME(cr(0,0) >= old_cr);
}
pw(0,0) = co(0,cr(0,0));
r6 = mem(0,cr(0,0));
}
ASSUME(creturn[0] >= cr(0,0));
// call void @llvm.dbg.value(metadata i64 %4, metadata !138, metadata !DIExpression()), !dbg !172
// %conv = trunc i64 %4 to i32, !dbg !98
// call void @llvm.dbg.value(metadata i32 %conv, metadata !135, metadata !DIExpression()), !dbg !152
// %cmp = icmp eq i32 %conv, 2, !dbg !99
creg__r6__2_ = max(0,creg_r6);
// %conv6 = zext i1 %cmp to i32, !dbg !99
// call void @llvm.dbg.value(metadata i32 %conv6, metadata !139, metadata !DIExpression()), !dbg !152
// call void @llvm.dbg.value(metadata i64* getelementptr inbounds ([2 x i64], [2 x i64]* @vars, i64 0, i64 1), metadata !141, metadata !DIExpression()), !dbg !176
// %5 = load atomic i64, i64* getelementptr inbounds ([2 x i64], [2 x i64]* @vars, i64 0, i64 1) monotonic, align 8, !dbg !101
// LD: Guess
old_cr = cr(0,0+1*1);
cr(0,0+1*1) = get_rng(0,NCONTEXT-1);// 0 ASSIGN LDCOM _l63_c13
// Check
ASSUME(active[cr(0,0+1*1)] == 0);
ASSUME(cr(0,0+1*1) >= iw(0,0+1*1));
ASSUME(cr(0,0+1*1) >= 0);
ASSUME(cr(0,0+1*1) >= cdy[0]);
ASSUME(cr(0,0+1*1) >= cisb[0]);
ASSUME(cr(0,0+1*1) >= cdl[0]);
ASSUME(cr(0,0+1*1) >= cl[0]);
// Update
creg_r7 = cr(0,0+1*1);
crmax(0,0+1*1) = max(crmax(0,0+1*1),cr(0,0+1*1));
caddr[0] = max(caddr[0],0);
if(cr(0,0+1*1) < cw(0,0+1*1)) {
r7 = buff(0,0+1*1);
ASSUME((!(( (cw(0,0+1*1) < 1) && (1 < crmax(0,0+1*1)) )))||(sforbid(0+1*1,1)> 0));
ASSUME((!(( (cw(0,0+1*1) < 2) && (2 < crmax(0,0+1*1)) )))||(sforbid(0+1*1,2)> 0));
ASSUME((!(( (cw(0,0+1*1) < 3) && (3 < crmax(0,0+1*1)) )))||(sforbid(0+1*1,3)> 0));
ASSUME((!(( (cw(0,0+1*1) < 4) && (4 < crmax(0,0+1*1)) )))||(sforbid(0+1*1,4)> 0));
} else {
if(pw(0,0+1*1) != co(0+1*1,cr(0,0+1*1))) {
ASSUME(cr(0,0+1*1) >= old_cr);
}
pw(0,0+1*1) = co(0+1*1,cr(0,0+1*1));
r7 = mem(0+1*1,cr(0,0+1*1));
}
ASSUME(creturn[0] >= cr(0,0+1*1));
// call void @llvm.dbg.value(metadata i64 %5, metadata !143, metadata !DIExpression()), !dbg !176
// %conv10 = trunc i64 %5 to i32, !dbg !102
// call void @llvm.dbg.value(metadata i32 %conv10, metadata !140, metadata !DIExpression()), !dbg !152
// %cmp11 = icmp eq i32 %conv10, 2, !dbg !103
creg__r7__2_ = max(0,creg_r7);
// %conv12 = zext i1 %cmp11 to i32, !dbg !103
// call void @llvm.dbg.value(metadata i32 %conv12, metadata !144, metadata !DIExpression()), !dbg !152
// %6 = load i32, i32* @atom_1_X0_1, align 4, !dbg !104, !tbaa !82
// LD: Guess
old_cr = cr(0,2);
cr(0,2) = get_rng(0,NCONTEXT-1);// 0 ASSIGN LDCOM _l65_c13
// Check
ASSUME(active[cr(0,2)] == 0);
ASSUME(cr(0,2) >= iw(0,2));
ASSUME(cr(0,2) >= 0);
ASSUME(cr(0,2) >= cdy[0]);
ASSUME(cr(0,2) >= cisb[0]);
ASSUME(cr(0,2) >= cdl[0]);
ASSUME(cr(0,2) >= cl[0]);
// Update
creg_r8 = cr(0,2);
crmax(0,2) = max(crmax(0,2),cr(0,2));
caddr[0] = max(caddr[0],0);
if(cr(0,2) < cw(0,2)) {
r8 = buff(0,2);
ASSUME((!(( (cw(0,2) < 1) && (1 < crmax(0,2)) )))||(sforbid(2,1)> 0));
ASSUME((!(( (cw(0,2) < 2) && (2 < crmax(0,2)) )))||(sforbid(2,2)> 0));
ASSUME((!(( (cw(0,2) < 3) && (3 < crmax(0,2)) )))||(sforbid(2,3)> 0));
ASSUME((!(( (cw(0,2) < 4) && (4 < crmax(0,2)) )))||(sforbid(2,4)> 0));
} else {
if(pw(0,2) != co(2,cr(0,2))) {
ASSUME(cr(0,2) >= old_cr);
}
pw(0,2) = co(2,cr(0,2));
r8 = mem(2,cr(0,2));
}
ASSUME(creturn[0] >= cr(0,2));
// call void @llvm.dbg.value(metadata i32 %6, metadata !145, metadata !DIExpression()), !dbg !152
// %7 = load i32, i32* @atom_1_X3_2, align 4, !dbg !105, !tbaa !82
// LD: Guess
old_cr = cr(0,3);
cr(0,3) = get_rng(0,NCONTEXT-1);// 0 ASSIGN LDCOM _l66_c13
// Check
ASSUME(active[cr(0,3)] == 0);
ASSUME(cr(0,3) >= iw(0,3));
ASSUME(cr(0,3) >= 0);
ASSUME(cr(0,3) >= cdy[0]);
ASSUME(cr(0,3) >= cisb[0]);
ASSUME(cr(0,3) >= cdl[0]);
ASSUME(cr(0,3) >= cl[0]);
// Update
creg_r9 = cr(0,3);
crmax(0,3) = max(crmax(0,3),cr(0,3));
caddr[0] = max(caddr[0],0);
if(cr(0,3) < cw(0,3)) {
r9 = buff(0,3);
ASSUME((!(( (cw(0,3) < 1) && (1 < crmax(0,3)) )))||(sforbid(3,1)> 0));
ASSUME((!(( (cw(0,3) < 2) && (2 < crmax(0,3)) )))||(sforbid(3,2)> 0));
ASSUME((!(( (cw(0,3) < 3) && (3 < crmax(0,3)) )))||(sforbid(3,3)> 0));
ASSUME((!(( (cw(0,3) < 4) && (4 < crmax(0,3)) )))||(sforbid(3,4)> 0));
} else {
if(pw(0,3) != co(3,cr(0,3))) {
ASSUME(cr(0,3) >= old_cr);
}
pw(0,3) = co(3,cr(0,3));
r9 = mem(3,cr(0,3));
}
ASSUME(creturn[0] >= cr(0,3));
// call void @llvm.dbg.value(metadata i32 %7, metadata !146, metadata !DIExpression()), !dbg !152
// %8 = load i32, i32* @atom_1_X6_1, align 4, !dbg !106, !tbaa !82
// LD: Guess
old_cr = cr(0,4);
cr(0,4) = get_rng(0,NCONTEXT-1);// 0 ASSIGN LDCOM _l67_c13
// Check
ASSUME(active[cr(0,4)] == 0);
ASSUME(cr(0,4) >= iw(0,4));
ASSUME(cr(0,4) >= 0);
ASSUME(cr(0,4) >= cdy[0]);
ASSUME(cr(0,4) >= cisb[0]);
ASSUME(cr(0,4) >= cdl[0]);
ASSUME(cr(0,4) >= cl[0]);
// Update
creg_r10 = cr(0,4);
crmax(0,4) = max(crmax(0,4),cr(0,4));
caddr[0] = max(caddr[0],0);
if(cr(0,4) < cw(0,4)) {
r10 = buff(0,4);
ASSUME((!(( (cw(0,4) < 1) && (1 < crmax(0,4)) )))||(sforbid(4,1)> 0));
ASSUME((!(( (cw(0,4) < 2) && (2 < crmax(0,4)) )))||(sforbid(4,2)> 0));
ASSUME((!(( (cw(0,4) < 3) && (3 < crmax(0,4)) )))||(sforbid(4,3)> 0));
ASSUME((!(( (cw(0,4) < 4) && (4 < crmax(0,4)) )))||(sforbid(4,4)> 0));
} else {
if(pw(0,4) != co(4,cr(0,4))) {
ASSUME(cr(0,4) >= old_cr);
}
pw(0,4) = co(4,cr(0,4));
r10 = mem(4,cr(0,4));
}
ASSUME(creturn[0] >= cr(0,4));
// call void @llvm.dbg.value(metadata i32 %8, metadata !147, metadata !DIExpression()), !dbg !152
// %and = and i32 %7, %8, !dbg !107
creg_r11 = max(creg_r10,creg_r9);
r11 = r9 & r10;
// call void @llvm.dbg.value(metadata i32 %and, metadata !148, metadata !DIExpression()), !dbg !152
// %and13 = and i32 %6, %and, !dbg !108
creg_r12 = max(creg_r11,creg_r8);
r12 = r8 & r11;
// call void @llvm.dbg.value(metadata i32 %and13, metadata !149, metadata !DIExpression()), !dbg !152
// %and14 = and i32 %conv12, %and13, !dbg !109
creg_r13 = max(creg__r7__2_,creg_r12);
r13 = (r7==2) & r12;
// call void @llvm.dbg.value(metadata i32 %and14, metadata !150, metadata !DIExpression()), !dbg !152
// %and15 = and i32 %conv6, %and14, !dbg !110
creg_r14 = max(creg__r6__2_,creg_r13);
r14 = (r6==2) & r13;
// call void @llvm.dbg.value(metadata i32 %and15, metadata !151, metadata !DIExpression()), !dbg !152
// %cmp16 = icmp eq i32 %and15, 1, !dbg !111
creg__r14__1_ = max(0,creg_r14);
// br i1 %cmp16, label %if.then, label %if.end, !dbg !113
old_cctrl = cctrl[0];
cctrl[0] = get_rng(0,NCONTEXT-1);
ASSUME(cctrl[0] >= old_cctrl);
ASSUME(cctrl[0] >= creg__r14__1_);
if((r14==1)) {
goto T0BLOCK1;
} else {
goto T0BLOCK2;
}
T0BLOCK1:
// call void @__assert_fail(i8* noundef getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8* noundef getelementptr inbounds ([111 x i8], [111 x i8]* @.str.1, i64 0, i64 0), i32 noundef 72, i8* noundef getelementptr inbounds ([23 x i8], [23 x i8]* @__PRETTY_FUNCTION__.main, i64 0, i64 0)) #8, !dbg !114
// unreachable, !dbg !114
r15 = 1;
goto T0BLOCK_END;
T0BLOCK2:
// %9 = bitcast i64* %thr1 to i8*, !dbg !117
// call void @llvm.lifetime.end.p0i8(i64 8, i8* %9) #7, !dbg !117
// %10 = bitcast i64* %thr0 to i8*, !dbg !117
// call void @llvm.lifetime.end.p0i8(i64 8, i8* %10) #7, !dbg !117
// ret i32 0, !dbg !118
ret_thread_0 = 0;
goto T0BLOCK_END;
T0BLOCK_END:
ASSUME(meminit(0,1) == mem(0,0));
ASSUME(coinit(0,1) == co(0,0));
ASSUME(deltainit(0,1) == delta(0,0));
ASSUME(meminit(0,2) == mem(0,1));
ASSUME(coinit(0,2) == co(0,1));
ASSUME(deltainit(0,2) == delta(0,1));
ASSUME(meminit(0,3) == mem(0,2));
ASSUME(coinit(0,3) == co(0,2));
ASSUME(deltainit(0,3) == delta(0,2));
ASSUME(meminit(0,4) == mem(0,3));
ASSUME(coinit(0,4) == co(0,3));
ASSUME(deltainit(0,4) == delta(0,3));
ASSUME(meminit(1,1) == mem(1,0));
ASSUME(coinit(1,1) == co(1,0));
ASSUME(deltainit(1,1) == delta(1,0));
ASSUME(meminit(1,2) == mem(1,1));
ASSUME(coinit(1,2) == co(1,1));
ASSUME(deltainit(1,2) == delta(1,1));
ASSUME(meminit(1,3) == mem(1,2));
ASSUME(coinit(1,3) == co(1,2));
ASSUME(deltainit(1,3) == delta(1,2));
ASSUME(meminit(1,4) == mem(1,3));
ASSUME(coinit(1,4) == co(1,3));
ASSUME(deltainit(1,4) == delta(1,3));
ASSUME(meminit(2,1) == mem(2,0));
ASSUME(coinit(2,1) == co(2,0));
ASSUME(deltainit(2,1) == delta(2,0));
ASSUME(meminit(2,2) == mem(2,1));
ASSUME(coinit(2,2) == co(2,1));
ASSUME(deltainit(2,2) == delta(2,1));
ASSUME(meminit(2,3) == mem(2,2));
ASSUME(coinit(2,3) == co(2,2));
ASSUME(deltainit(2,3) == delta(2,2));
ASSUME(meminit(2,4) == mem(2,3));
ASSUME(coinit(2,4) == co(2,3));
ASSUME(deltainit(2,4) == delta(2,3));
ASSUME(meminit(3,1) == mem(3,0));
ASSUME(coinit(3,1) == co(3,0));
ASSUME(deltainit(3,1) == delta(3,0));
ASSUME(meminit(3,2) == mem(3,1));
ASSUME(coinit(3,2) == co(3,1));
ASSUME(deltainit(3,2) == delta(3,1));
ASSUME(meminit(3,3) == mem(3,2));
ASSUME(coinit(3,3) == co(3,2));
ASSUME(deltainit(3,3) == delta(3,2));
ASSUME(meminit(3,4) == mem(3,3));
ASSUME(coinit(3,4) == co(3,3));
ASSUME(deltainit(3,4) == delta(3,3));
ASSUME(meminit(4,1) == mem(4,0));
ASSUME(coinit(4,1) == co(4,0));
ASSUME(deltainit(4,1) == delta(4,0));
ASSUME(meminit(4,2) == mem(4,1));
ASSUME(coinit(4,2) == co(4,1));
ASSUME(deltainit(4,2) == delta(4,1));
ASSUME(meminit(4,3) == mem(4,2));
ASSUME(coinit(4,3) == co(4,2));
ASSUME(deltainit(4,3) == delta(4,2));
ASSUME(meminit(4,4) == mem(4,3));
ASSUME(coinit(4,4) == co(4,3));
ASSUME(deltainit(4,4) == delta(4,3));
ASSERT(r15== 0);
}
| [
"tuan-phong.ngo@it.uu.se"
] | tuan-phong.ngo@it.uu.se |
e87258ce6dbfb5d2946dffe8688aa2e46eab0a54 | 3b43e2a3fdb990664d186609acd4c871638b289d | /Lab3/main.cpp | 7208faeb1e4ece5a36ca03dcf6b417dc4d0e31aa | [] | no_license | nick434434/AM-ANT | 484d4887d7ad497dddc2837d9739a37f6215ca59 | 4a6b68e80da2ca067ca67c00b68f3c732d2360fe | refs/heads/master | 2021-01-18T03:39:12.480287 | 2017-09-16T20:50:45 | 2017-09-16T20:50:45 | 85,800,869 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,101 | cpp | #include <iostream>
#include <NTL/ZZ.h>
#include <iomanip>
#include <fstream>
#include "getCPUTime.h"
using namespace NTL;
using std::cout;
using std::endl;
void makeFile(std::ostream& output, int n) {
double start, end;
output << "Length" <<";" << "Prime" << ";" << "GenPrimeTime" << ";" << "ProbTestOnPrimeTime" << ";" << "TestOnCompTime" << endl;
for (size_t i = 10; i <= n; i += 20) {
ZZ tmp;
output << i << ";";
start = getCPUTime();
tmp = GenPrime_ZZ(i + 1);
end = getCPUTime();
output << tmp << ";" << std::setprecision(10) << std::fixed << end - start << ";";
start = getCPUTime();
ProbPrime(tmp);
end = getCPUTime();
output << end - start << ";";
start = getCPUTime();
ProbPrime(tmp + 1);
end = getCPUTime();
output << end - start << endl;
}
}
int main() {
ZZ p = GenPrime_ZZ(25);
cout << p << endl;
std::cin >> p;
cout << ProbPrime(p) << endl;
//std::ofstream fout("out10000.csv");
//makeFile(fout, 10000);
return 0;
} | [
"nick434434@yandex.ru"
] | nick434434@yandex.ru |
e51765bd0e833f3ffd8437421ade601e2462468e | 0f101a2d9fc62600c38e1272d2a90552e293d0ff | /cocos/scripting/js-bindings/manual/jsb_creator_manual.cpp | eca3767859ac7a5f8194c88aaea257c3c4c28344 | [
"MIT"
] | permissive | 276361270/cocos2d-x-lite | 59de243106064307fe08d2117b7dc3fa85fb8374 | 413135a3b1282d2f6192ebff31ac37c4ea7e5c99 | refs/heads/develop | 2021-01-19T13:36:11.862566 | 2017-08-18T08:22:51 | 2017-08-18T08:22:51 | 100,843,773 | 0 | 0 | null | 2017-08-20T06:48:07 | 2017-08-20T06:48:07 | null | UTF-8 | C++ | false | false | 11,780 | cpp | #include "jsb_creator_manual.hpp"
#include "cocos/scripting/js-bindings/jswrapper/SeApi.h"
#include "cocos/scripting/js-bindings/manual/jsb_conversions.hpp"
#include "cocos/scripting/js-bindings/manual/jsb_global.h"
#include "cocos/scripting/js-bindings/manual/jsb_box2d_manual.hpp"
#include "cocos/scripting/js-bindings/auto/jsb_creator_auto.hpp"
#include "cocos/scripting/js-bindings/auto/jsb_box2d_auto.hpp"
#include "editor-support/creator/physics/CCPhysicsContactListener.h"
#include "editor-support/creator/physics/CCPhysicsUtils.h"
#include "editor-support/creator/physics/CCPhysicsAABBQueryCallback.h"
#include "editor-support/creator/physics/CCPhysicsRayCastCallback.h"
#include "editor-support/creator/physics/CCPhysicsContactImpulse.h"
static bool js_creator_PhysicsContactListener_setPreSolve(se::State& s)
{
creator::PhysicsContactListener* cobj = (creator::PhysicsContactListener*)s.nativeThisObject();
SE_PRECONDITION2(cobj, false, "Invalid Native Object");
const auto& args = s.args();
size_t argc = args.size();
CC_UNUSED bool ok = true;
if (argc == 1) {
std::function<void (b2Contact *)> arg0;
do {
if (args[0].isObject() && args[0].toObject()->isFunction())
{
se::Value jsThis(s.thisObject());
se::Value jsFunc(args[0]);
jsThis.toObject()->attachChild(jsFunc.toObject());
auto lambda = [=](b2Contact* larg0) -> void {
se::ScriptEngine::getInstance()->clearException();
se::AutoHandleScope hs;
CC_UNUSED bool ok = true;
se::ValueArray args;
args.resize(1);
bool fromCache = false;
ok &= native_ptr_to_rooted_seval<b2Contact>(larg0, __jsb_b2Contact_class, &args[0], &fromCache);
se::Value rval;
se::Object* thisObj = jsThis.isObject() ? jsThis.toObject() : nullptr;
se::Object* funcObj = jsFunc.toObject();
bool succeed = funcObj->call(args, thisObj, &rval);
if (!succeed) {
se::ScriptEngine::getInstance()->clearException();
}
};
arg0 = lambda;
}
else
{
arg0 = nullptr;
}
} while(false);
SE_PRECONDITION2(ok, false, "Error processing arguments");
cobj->setPreSolve(arg0);
return true;
}
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1);
return false;
}
SE_BIND_FUNC(js_creator_PhysicsContactListener_setPreSolve)
static bool js_creator_PhysicsContactListener_setPostSolve(se::State& s)
{
creator::PhysicsContactListener* cobj = (creator::PhysicsContactListener*)s.nativeThisObject();
SE_PRECONDITION2(cobj, false, "Invalid Native Object");
const auto& args = s.args();
size_t argc = args.size();
CC_UNUSED bool ok = true;
if (argc == 1) {
std::function<void (b2Contact *, const creator::PhysicsContactImpulse *)> arg0;
do {
if (args[0].isObject() && args[0].toObject()->isFunction())
{
se::Value jsThis(s.thisObject());
se::Value jsFunc(args[0]);
jsThis.toObject()->attachChild(jsFunc.toObject());
auto lambda = [=](b2Contact* larg0, const creator::PhysicsContactImpulse* larg1) -> void {
se::ScriptEngine::getInstance()->clearException();
se::AutoHandleScope hs;
CC_UNUSED bool ok = true;
se::ValueArray args;
args.resize(2);
bool fromCache = false;
ok &= native_ptr_to_rooted_seval<b2Contact>(larg0, __jsb_b2Contact_class, &args[0]);
ok &= native_ptr_to_seval<creator::PhysicsContactImpulse>((creator::PhysicsContactImpulse*)larg1, __jsb_creator_PhysicsContactImpulse_class, &args[1], &fromCache);
if (!fromCache)
{
jsThis.toObject()->attachChild(args[1].toObject());
}
se::Value rval;
se::Object* thisObj = jsThis.isObject() ? jsThis.toObject() : nullptr;
se::Object* funcObj = jsFunc.toObject();
bool succeed = funcObj->call(args, thisObj, &rval);
if (!succeed) {
se::ScriptEngine::getInstance()->clearException();
}
};
arg0 = lambda;
}
else
{
arg0 = nullptr;
}
} while(false);
SE_PRECONDITION2(ok, false, "Error processing arguments");
cobj->setPostSolve(arg0);
return true;
}
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1);
return false;
}
SE_BIND_FUNC(js_creator_PhysicsContactListener_setPostSolve)
static bool js_creator_PhysicsContactListener_setBeginContact(se::State& s)
{
creator::PhysicsContactListener* cobj = (creator::PhysicsContactListener*)s.nativeThisObject();
SE_PRECONDITION2(cobj, false, "Invalid Native Object");
const auto& args = s.args();
size_t argc = args.size();
CC_UNUSED bool ok = true;
if (argc == 1) {
std::function<void (b2Contact *)> arg0;
do {
if (args[0].isObject() && args[0].toObject()->isFunction())
{
se::Value jsThis(s.thisObject());
se::Value jsFunc(args[0]);
jsThis.toObject()->attachChild(jsFunc.toObject());
auto lambda = [=](b2Contact* larg0) -> void {
se::ScriptEngine::getInstance()->clearException();
se::AutoHandleScope hs;
CC_UNUSED bool ok = true;
se::ValueArray args;
args.resize(1);
/*
The order of callback is:
* setBeginContact
* setPreSolve
* setPostSolve
* setEndContact
*/
ok &= native_ptr_to_rooted_seval<b2Contact>(larg0, __jsb_b2Contact_class, &args[0]);
se::Value rval;
se::Object* thisObj = jsThis.isObject() ? jsThis.toObject() : nullptr;
se::Object* funcObj = jsFunc.toObject();
bool succeed = funcObj->call(args, thisObj, &rval);
if (!succeed) {
se::ScriptEngine::getInstance()->clearException();
}
};
arg0 = lambda;
}
else
{
arg0 = nullptr;
}
} while(false);
SE_PRECONDITION2(ok, false, "Error processing arguments");
cobj->setBeginContact(arg0);
return true;
}
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1);
return false;
}
SE_BIND_FUNC(js_creator_PhysicsContactListener_setBeginContact)
static bool js_creator_PhysicsContactListener_setEndContact(se::State& s)
{
creator::PhysicsContactListener* cobj = (creator::PhysicsContactListener*)s.nativeThisObject();
SE_PRECONDITION2(cobj, false, "Invalid Native Object");
const auto& args = s.args();
size_t argc = args.size();
CC_UNUSED bool ok = true;
if (argc == 1) {
std::function<void (b2Contact *)> arg0;
do {
if (args[0].isObject() && args[0].toObject()->isFunction())
{
se::Value jsThis(s.thisObject());
se::Value jsFunc(args[0]);
jsThis.toObject()->attachChild(jsFunc.toObject());
auto lambda = [=](b2Contact* larg0) -> void {
se::ScriptEngine::getInstance()->clearException();
se::AutoHandleScope hs;
CC_UNUSED bool ok = true;
se::ValueArray args;
args.resize(1);
ok &= native_ptr_to_rooted_seval<b2Contact>(larg0, __jsb_b2Contact_class, &args[0]);
se::Value rval;
se::Object* thisObj = jsThis.isObject() ? jsThis.toObject() : nullptr;
se::Object* funcObj = jsFunc.toObject();
bool succeed = funcObj->call(args, thisObj, &rval);
if (!succeed) {
se::ScriptEngine::getInstance()->clearException();
}
};
arg0 = lambda;
}
else
{
arg0 = nullptr;
}
} while(false);
SE_PRECONDITION2(ok, false, "Error processing arguments");
cobj->setEndContact(arg0);
return true;
}
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1);
return false;
}
SE_BIND_FUNC(js_creator_PhysicsContactListener_setEndContact)
static bool js_creator_PhysicsAABBQueryCallback_getFixtures(se::State& s)
{
creator::PhysicsAABBQueryCallback* cobj = (creator::PhysicsAABBQueryCallback *)s.nativeThisObject();
const auto& ret = cobj->getFixtures();
array_of_b2Fixture_to_seval(ret, &s.rval());
return true;
}
SE_BIND_FUNC(js_creator_PhysicsAABBQueryCallback_getFixtures)
static bool js_creator_PhysicsRayCastCallback_getFixtures(se::State& s)
{
creator::PhysicsRayCastCallback* cobj = (creator::PhysicsRayCastCallback *)s.nativeThisObject();
const auto& ret = cobj->getFixtures();
array_of_b2Fixture_to_seval(ret, &s.rval());
return true;
}
SE_BIND_FUNC(js_creator_PhysicsRayCastCallback_getFixtures)
static bool js_creator_PhysicsRayCastCallback_getPoints(se::State& s)
{
creator::PhysicsRayCastCallback* cobj = (creator::PhysicsRayCastCallback *)s.nativeThisObject();
const auto& ret = cobj->getPoints();
array_of_b2Vec2_to_seval(ret, &s.rval());
return true;
}
SE_BIND_FUNC(js_creator_PhysicsRayCastCallback_getPoints)
static bool js_creator_PhysicsRayCastCallback_getNormals(se::State& s)
{
creator::PhysicsRayCastCallback* cobj = (creator::PhysicsRayCastCallback *)s.nativeThisObject();
const auto& ret = cobj->getNormals();
array_of_b2Vec2_to_seval(ret, &s.rval());
return true;
}
SE_BIND_FUNC(js_creator_PhysicsRayCastCallback_getNormals)
bool register_all_creator_manual(se::Object* obj)
{
__jsb_creator_PhysicsContactListener_proto->defineFunction("setPreSolve", _SE(js_creator_PhysicsContactListener_setPreSolve));
__jsb_creator_PhysicsContactListener_proto->defineFunction("setPostSolve", _SE(js_creator_PhysicsContactListener_setPostSolve));
__jsb_creator_PhysicsContactListener_proto->defineFunction("setBeginContact", _SE(js_creator_PhysicsContactListener_setBeginContact));
__jsb_creator_PhysicsContactListener_proto->defineFunction("setEndContact", _SE(js_creator_PhysicsContactListener_setEndContact));
__jsb_creator_PhysicsAABBQueryCallback_proto->defineFunction("getFixtures", _SE(js_creator_PhysicsAABBQueryCallback_getFixtures));
__jsb_creator_PhysicsRayCastCallback_proto->defineFunction("getFixtures", _SE(js_creator_PhysicsRayCastCallback_getFixtures));
__jsb_creator_PhysicsRayCastCallback_proto->defineFunction("getPoints", _SE(js_creator_PhysicsRayCastCallback_getPoints));
__jsb_creator_PhysicsRayCastCallback_proto->defineFunction("getNormals", _SE(js_creator_PhysicsRayCastCallback_getNormals));
se::ScriptEngine::getInstance()->clearException();
return true;
}
| [
"jianhua.chen@cocos2d-x.org"
] | jianhua.chen@cocos2d-x.org |
edc4cace13dda93c04a252ab5714ee3c166e9234 | 4c8fcd6c4953af89a7c71f4744824a5b6364ac56 | /sources/calculs.cpp | 11bbb53baac7e3abfec94187da721fbb60bf163a | [] | no_license | PierreVerbe/Verbey | 7198e7f606ecb04a204a15800dabc5300e99c69c | 13ac7757c2658cc72276550c52c33e55b78366e4 | refs/heads/master | 2021-07-04T08:40:24.498750 | 2020-09-08T20:40:46 | 2020-09-08T20:40:46 | 168,708,200 | 0 | 0 | null | 2020-09-08T20:48:12 | 2019-02-01T14:19:05 | C | UTF-8 | C++ | false | false | 814 | cpp | // code source des fct de calculs du mode PVP
// prepros
#include <math.h>
#include "../en-tetes/vs/calculs.h"
// fonctions
double ca_norme(MonVecteur* pvecteur)
{
// decla
double norme = 0;
// corps prg
norme = sqrt((pvecteur->x * pvecteur->x) + (pvecteur->y * pvecteur->y));
return norme;
}
//------------------------------------------------------------------------
void ca_plus(MonVecteur* pvecteur, MonVecteur* pajout)
{
pvecteur->x = pvecteur->x + pajout->x;
pvecteur->y = pvecteur->y + pajout->y;
}
//------------------------------------------------------------------------
void ca_moins(MonVecteur* pvecteur, MonVecteur* pajout)
{
pvecteur->x = pvecteur->x - pajout->x;
pvecteur->y = pvecteur->y - pajout->y;
}
//------------------------------------------------------------------------
| [
"pierre.verbe@free.fr"
] | pierre.verbe@free.fr |
b308034cb3ad83ea0ba6668f523cce6c1a97a016 | f94e29ea70d80c7fbd153109cf0d161deddc1ad4 | /ePaper_barometer_2023.ino | 1983f11b35b2c9c19aa3852ab04a8e1eba7ed2fa | [] | no_license | Romashka360/arduino | 2050cdb1acddb38eb7879853d4315f14b3b8df11 | 3b91046ed589331623d6c10301d9dd83ae25d35a | refs/heads/master | 2023-08-03T15:23:37.308446 | 2023-07-27T03:03:55 | 2023-07-27T03:03:55 | 248,678,108 | 1 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 3,509 | ino | #include <Wire.h>
#include <SPI.h>
#include <Adafruit_Sensor.h>
#include "SparkFunBME280.h"
#include <GxEPD2_BW.h>
#include <GxEPD2_3C.h>
#include <Fonts/Org_01.h>
#include <Fonts/FreeMonoBold12pt7b.h>
#define GxEPD2_DRIVER_CLASS GxEPD2_270
#define MAX_DISPLAY_BUFFER_SIZE 32768ul // e.g., up to 96k
#define MAX_HEIGHT(EPD) (EPD::HEIGHT <= MAX_DISPLAY_BUFFER_SIZE / (EPD::WIDTH / 8) ? EPD::HEIGHT : MAX_DISPLAY_BUFFER_SIZE / (EPD::WIDTH / 8))
GxEPD2_BW<GxEPD2_270, MAX_HEIGHT(GxEPD2_270)> display(GxEPD2_270(/*CS=*/ 10, /*DC=*/ 11, /*RST=*/ 12, /*BUSY=*/ 13)); // GDEW027W3 176x264, EK79652 (IL91874)
BME280 mySensorB;
unsigned long mytime_start, mytime_now, mytime_tot_start;
void setup()
{
display.init();
display.setTextColor(GxEPD_BLACK);
helloWorld();
Wire.begin();
mySensorB.setI2CAddress(0x76);
mySensorB.beginI2C();
mytime_start = millis()+60;
mytime_tot_start = millis();
}
void loop()
{
mytime_now = millis();
double s2 = (mytime_now - mytime_start)/1000.0;
if (s2 > 5)
{
mytime_start = mytime_now;
double mytime_tot = (millis() - mytime_tot_start) / 1000.0;
double Tem = mySensorB.readTempC();
double Tem100 = Tem*100.0;
double Pre = mySensorB.readFloatPressure()/101325.0144354*760.0;
double Pre100 = Pre*100.0;
double Hum = mySensorB.readFloatHumidity();
double Hum100 = Hum*100.0;
char time_string1[] = {'T', '=', '0', '0', '.', '0', '0', 'C','\0'};
time_string1[2] = int(Tem) / 10 %10 + '0';
time_string1[3] = int(Tem) / 1 %10 + '0';
time_string1[5] = int(Tem100) / 10 %10 + '0';
time_string1[6] = int(Tem100) / 1 %10 + '0';
char time_string2[] = {'H', '=', '0', '0', '.', '0', '%','\0'};
time_string2[2] = int(Hum) / 10 %10 + '0';
time_string2[3] = int(Hum) / 1 %10 + '0';
time_string2[5] = int(Hum100) / 10 %10 + '0';
char time_string3[] = {'P', '=', '0', '0', '0', '.', '0', 'm', 'm', 'H', 'g', ' ', '\0'};
time_string3[2] = int(Pre) / 100 %10 + '0';
time_string3[3] = int(Pre) / 10 %10 + '0';
time_string3[4] = int(Pre) / 1 %10 + '0';
time_string3[6] = int(Pre100) / 10 %10 + '0';
char time_string[] = {'0', '0', '0', '0', ':', '0', '0', ':', '0', '0', '\0'};
int th = floor(mytime_tot/3600.0);
int tmin = floor((mytime_tot - th*3600.0)/60.0);
int tsec = floor(mytime_tot - th*3600.0 - tmin*60.0);
time_string[0] = th / 1000 %10 + '0';
time_string[1] = th / 100 %10 + '0';
time_string[2] = th / 10 %10 + '0';
time_string[3] = th / 1 %10 + '0';
time_string[5] = tmin / 10 %10 + '0';
time_string[6] = tmin / 1 %10 + '0';
time_string[8] = tsec / 10 %10 + '0';
time_string[9] = tsec / 1 %10 + '0';
display.setPartialWindow(50, 30, 190, 140); // x,y,width,height
display.firstPage();
do
{
display.fillScreen(GxEPD_WHITE);
display.setCursor(50, 60);
display.println(time_string1);
display.setCursor(50, 90);
display.println(time_string3);
display.setCursor(50, 120);
display.println(time_string2);
display.setCursor(50, 150);
display.println(time_string);
}
while (display.nextPage());
}
}
void helloWorld()
{
display.setFullWindow();
display.setRotation(3);
display.setFont(&FreeMonoBold12pt7b);
display.setTextColor(GxEPD_BLACK);
display.firstPage();
do
{
display.fillScreen(GxEPD_WHITE);
display.setCursor(1, 15);
display.println(F("BME280"));
}
while (display.nextPage());
}
| [
"noreply@github.com"
] | noreply@github.com |
9024517a6a7c7ae1cbc291ea7ee31053f47fbd28 | 6ea79cea02973f309386a6a4f7931c21aa5f4966 | /leetcode/LeetCode/131.cpp | c20bfb91b532b2c9e3caa042b9eff5d1dde9b337 | [] | no_license | chaitanchun/person | 118739ac2a4f249afefd1b33919b2c9a2168c6b1 | 70f806081058bd1aad7aa9f3526f2114590505b7 | refs/heads/master | 2020-05-07T19:25:45.116858 | 2015-04-06T12:25:59 | 2015-04-06T12:25:59 | 18,963,530 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 206 | cpp | #include <iostream>
#include <vector>
#include <string>
using namespace std;
class Solution {
public:
vector<vector<string>> partition(string s)
{
}
};
int main()
{
return 0;
} | [
"chaitanchun@gmail.com"
] | chaitanchun@gmail.com |
f05add2f874386a3700aa151e39e81042aeadbf9 | bd1fea86d862456a2ec9f56d57f8948456d55ee6 | /000/241/954/CWE762_Mismatched_Memory_Management_Routines__delete_array_int64_t_malloc_16.cpp | d955b602eca3d3ec004c8d13a1fb0743f5f829c3 | [] | 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 | 3,266 | cpp | /* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE762_Mismatched_Memory_Management_Routines__delete_array_int64_t_malloc_16.cpp
Label Definition File: CWE762_Mismatched_Memory_Management_Routines__delete_array.label.xml
Template File: sources-sinks-16.tmpl.cpp
*/
/*
* @description
* CWE: 762 Mismatched Memory Management Routines
* BadSource: malloc Allocate data using malloc()
* GoodSource: Allocate data using new []
* Sinks:
* GoodSink: Deallocate data using free()
* BadSink : Deallocate data using delete []
* Flow Variant: 16 Control flow: while(1)
* */
#include "std_testcase.h"
namespace CWE762_Mismatched_Memory_Management_Routines__delete_array_int64_t_malloc_16
{
#ifndef OMITBAD
void bad()
{
int64_t * data;
/* Initialize data*/
data = NULL;
while(1)
{
/* POTENTIAL FLAW: Allocate memory with a function that requires free() to free the memory */
data = (int64_t *)malloc(100*sizeof(int64_t));
if (data == NULL) {exit(-1);}
break;
}
while(1)
{
/* POTENTIAL FLAW: Deallocate memory using delete [] - the source memory allocation function may
* require a call to free() to deallocate the memory */
delete [] data;
break;
}
}
#endif /* OMITBAD */
#ifndef OMITGOOD
/* goodB2G() - use badsource and goodsink by changing the sinks in the second while statement */
static void goodB2G()
{
int64_t * data;
/* Initialize data*/
data = NULL;
while(1)
{
/* POTENTIAL FLAW: Allocate memory with a function that requires free() to free the memory */
data = (int64_t *)malloc(100*sizeof(int64_t));
if (data == NULL) {exit(-1);}
break;
}
while(1)
{
/* FIX: Free memory using free() */
free(data);
break;
}
}
/* goodG2B() - use goodsource and badsink by changing the sources in the first while statement */
static void goodG2B()
{
int64_t * data;
/* Initialize data*/
data = NULL;
while(1)
{
/* FIX: Allocate memory using new [] */
data = new int64_t[100];
break;
}
while(1)
{
/* POTENTIAL FLAW: Deallocate memory using delete [] - the source memory allocation function may
* require a call to free() to deallocate the memory */
delete [] data;
break;
}
}
void good()
{
goodB2G();
goodG2B();
}
#endif /* OMITGOOD */
} /* close namespace */
/* Below is the main(). It is only used when building this testcase on
its own for testing or for building a binary to use in testing binary
analysis tools. It is not used when compiling all the testcases as one
application, which is how source code analysis tools are tested. */
#ifdef INCLUDEMAIN
using namespace CWE762_Mismatched_Memory_Management_Routines__delete_array_int64_t_malloc_16; /* 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
| [
"frank@fischer.com.mt"
] | frank@fischer.com.mt |
8f62b04551beb53909dcc58fa22b364c3ad92f67 | bec96028ff3184d61bb08b79fcde54ae11052838 | /models/gen_models/opcuacnc_cncaxistype.h | 8bb14755953741bd37d9e4cc1bd285e5fcb57aaa | [] | no_license | impulze/thesiscode | 2b8d9bc31721746359de67b904533d5704be0689 | e5502db149aeaa436867ea4454c05d7958de0f78 | refs/heads/master | 2020-12-24T14:01:14.851387 | 2016-08-24T04:13:52 | 2016-08-24T04:13:52 | 65,730,896 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,834 | h | /******************************************************************************
** opcuacnc_cncaxistype.h
**
** **************************** auto-generated ****************************
** This code was generated by a tool: UaModeler
** Runtime Version: 1.5.0, using C++ OPC UA SDK 1.5.0 template (version 4)
**
** This is a template file that was generated for your convenience.
** This file will not be overwritten when generating code again.
** ADD YOUR IMPLEMTATION HERE!
** **************************** auto-generated ****************************
**
** Copyright (c) 2006-2016 Unified Automation GmbH. All rights reserved.
**
** Software License Agreement ("SLA") Version 2.5
**
** Unless explicitly acquired and licensed from Licensor under another
** license, the contents of this file are subject to the Software License
** Agreement ("SLA") Version 2.5, or subsequent versions
** as allowed by the SLA, and You may not copy or use this file in either
** source code or executable form, except in compliance with the terms and
** conditions of the SLA.
**
** All software distributed under the SLA is provided strictly on an
** "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED,
** AND LICENSOR HEREBY DISCLAIMS ALL SUCH WARRANTIES, INCLUDING WITHOUT
** LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
** PURPOSE, QUIET ENJOYMENT, OR NON-INFRINGEMENT. See the SLA for specific
** language governing rights and limitations under the SLA.
**
** The complete license agreement can be found here:
** http://unifiedautomation.com/License/SLA/2.5/
**
** Project: C++ OPC Server SDK information model for namespace http://opcfoundation.org/UA/CNC/
**
** Description: OPC Unified Architecture Software Development Kit.
**
** Created: 19.08.2016
**
******************************************************************************/
#ifndef __OPCUACNC_CNCAXISTYPE_H__
#define __OPCUACNC_CNCAXISTYPE_H__
#include "opcuacnc_cncaxistypebase.h"
// Namespace for the UA information model http://opcfoundation.org/UA/CNC/
namespace OpcUaCnc {
/** @brief Class implementing the UaObject interface for the CncAxisType.
*
* OPC UA Objects are used to represent systems, system components, real-world objects and software
* objects. They have the NodeClass Object. The detailed description of Objects and their attributes
* can be found in the general description of the Object node class.
*
* **Variable members of the CncAxisType:**
*
* Browse Name | DataType | TypeDefinition | Modelling Rule | See Also
* -------------|-----------------|-------------------------|----------------|-----------------------------------------------------------------------------------------------------------------
* ActStatus | CncAxisStatus | DataItemType | Mandatory | \ref CncAxisTypeBase::getActStatus "getActStatus", \ref CncAxisTypeBase::setActStatus "setActStatus"
* IsReferenced | Boolean | DataItemType | Mandatory | \ref CncAxisTypeBase::getIsReferenced "getIsReferenced", \ref CncAxisTypeBase::setIsReferenced "setIsReferenced"
* IsRotational | Boolean | DataItemType | Mandatory | \ref CncAxisTypeBase::getIsRotational "getIsRotational", \ref CncAxisTypeBase::setIsRotational "setIsRotational"
* PosDirect | CncPositionType | CncPositionVariableType | Mandatory | \ref CncAxisTypeBase::getPosDirect "getPosDirect", \ref CncAxisTypeBase::setPosDirect "setPosDirect"
* PosIndirect | CncPositionType | CncPositionVariableType | Mandatory | \ref CncAxisTypeBase::getPosIndirect "getPosIndirect", \ref CncAxisTypeBase::setPosIndirect "setPosIndirect"
* ZeroOffset | Boolean | AnalogItemType | Mandatory | \ref CncAxisTypeBase::getZeroOffset "getZeroOffset", \ref CncAxisTypeBase::setZeroOffset "setZeroOffset"
*
*/
class UAMODELS_EXPORT CncAxisType:
public CncAxisTypeBase
{
UA_DISABLE_COPY(CncAxisType);
protected:
// destruction
virtual ~CncAxisType();
public:
// construction
CncAxisType(const UaNodeId& nodeId, UaObject* pInstanceDeclarationObject, NodeManagerConfig* pNodeConfig, UaMutexRefCounted* pSharedMutex = NULL);
CncAxisType(const UaNodeId& nodeId, const UaString& name, OpcUa_UInt16 browseNameNameSpaceIndex, NodeManagerConfig* pNodeConfig, UaMutexRefCounted* pSharedMutex = NULL);
CncAxisType(
UaBase::Object* pBaseNode,
XmlUaNodeFactoryManager* pFactory,
NodeManagerConfig* pNodeConfig,
UaMutexRefCounted* pSharedMutex = NULL);
static void createTypes();
static void clearStaticMembers();
protected:
private:
};
} // End namespace for the UA information model http://opcfoundation.org/UA/CNC/
#endif // #ifndef __OPCUACNCCNCAXISTYPE_H__
| [
"daniel.b.mierswa@student.hs-rm.de"
] | daniel.b.mierswa@student.hs-rm.de |
60b2cb4748738ab339a1a3d8c716c5ab86788b8f | f77629f02559c80e6a8020712263986109079963 | /src/femodel/RigidPoroInterfaceElementModel.h | bfc40a34f128ce0788e06af106637ef9f807a94c | [] | no_license | ritukeshbharali/ofeFRAC | 85b2456245695837f79d1171f5897adffd143dc3 | c50de298551dd01f1ab0305cd008c8c2cc242500 | refs/heads/master | 2022-12-27T06:24:17.220057 | 2020-10-13T08:50:10 | 2020-10-13T08:50:10 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 10,165 | h | /*
*
* Copyright (C) 2016 Monash University. All rights reserved.
*
* This class implements a model of two dimensional poro-cohesive interface elements.
* To be used with the HygroMechanicalModel for the bulk (fully saturated medium)
*
* - bottom and upper faces: displacement and pore pressure dofs.
* - mid-plane: fracutring fluid pressure
* The so-called triple-noded interface elements.
*
* Before damage, nodes are constrained to avoid large dummy stiffness.
*
* Author: V.P. Nguyen, phu.nguyen@monash.edu
* Date: 27 October 2016
*
*
*/
#ifndef RG_PORO_INTERFACE_ELEMENT_MODEL_H
#define RG_PORO_INTERFACE_ELEMENT_MODEL_H
#include <vector>
#include <jem/base/Array.h>
#include <jem/util/Flex.h>
#include <jem/util/ArrayBuffer.h>
#include <jem/util/SparseArray.h>
#include <jive/util/Assignable.h>
#include <jive/util/utilities.h>
#include <jive/util/XTable.h>
#include <jive/model/Model.h>
#include <jive/fem/NodeSet.h>
#include <jive/fem/ElementGroup.h>
#include <jive/util/Constraints.h>
namespace jem
{
namespace util
{
class Properties;
}
}
namespace jive
{
namespace util
{
class XDofSpace;
}
}
namespace jive
{
namespace algebra
{
class MatrixBuilder;
}
}
namespace jive
{
namespace fem
{
class Globdat;
}
}
namespace jive
{
namespace geom
{
class InterfaceShape;
class InternalShape;
class BoundaryShape;
}
}
class XCohesiveMat;
#include "FemModels.h"
#include "util/utilities.h"
using jem::Array;
using jem::util::Properties;
using jem::util::ArrayBuffer;
using jem::util::Flex;
using jem::util::SparseArray;
using jive::Vector;
using jive::IdxVector;
using jive::util::XDofSpace;
using jive::util::XTable;
using jive::util::Assignable;
using jive::util::Constraints;
using jive::algebra::MatrixBuilder;
using jive::model::Model;
using jive::geom::FShape;
using jive::geom::IShape;
using jive::fem::Globdat;
using jive::fem::NodeSet;
using jive::fem::ElementSet;
using jive::fem::ElementGroup;
using jive::IntMatrix;
//=======================================================================
// typedefs
//=======================================================================
typedef ElementSet ElemSet;
//=======================================================================
// class RigidPoroInterfaceElementModel
//=======================================================================
class RGPoroInterfaceElementModel : public Model
{
public:
typedef RGPoroInterfaceElementModel Self;
typedef Model Super;
// static data
static const char* SHAPE_PROP;
static const char* MATERIAL_PROP;
static const char* MESH_PROP;
static const char* THICKNESS_PROP;
static const char* DISP_NODES_PROP;
static const char* DIRICHLET_NODES_PROP;
static const char* BIOT_COEF_PROP;
static const char* VISCOSITY_PROP;
static const char* DTIME_PROP;
// Constructor
RGPoroInterfaceElementModel
( const String& name,
const Properties& conf,
const Properties& props,
const Properties& globdat );
// Configure itself by reading data from properties file
virtual void configure
( const Properties& props,
const Properties& globdat );
virtual void getConfig
( const Properties& conf ) const;
virtual bool takeAction
( const String& action,
const Properties& params,
const Properties& globdat );
protected:
virtual ~RGPoroInterfaceElementModel ();
private:
// getMatrix_: compute the tangent stiffness and internal force vector
// Compute K and fint for the updated displacement disp
void getIntForce_
( const Vector& force,
const Vector& disp0,
const Vector& disp );
void getMatrix_
( MatrixBuilder& mbuilder,
const Vector& force,
const Vector& disp0,
const Vector& disp );
void getTransformationMatrix_
( const Matrix& Q,
const Matrix& coord );
void initPressureConstraints_ ( );
void zeroPressure_ ( );
void initDisplacementConstraints_ ( );
void removeDisplacementConstraints_
( int ie );
void constraintDirichletNodes_ ( );
void updateBcConstraints_ ( );
inline void addConstraint_
( int xdof, int ydof,
int xdofM, int ydofM );
void checkCommit_
( const Properties& globdat,
const Properties& params,
const Vector& disp );
void initializeIPMPMap_ ( );
void computeForceForInjection_
( const Vector& force );
void writeNodalOutput_
( const Properties& globdat );
void writeWellboreOutput_
( const Properties& globdat );
double evalElementFailure_
( int ie ,
int& ig ,
const Vector& disp,
const Properties& globdat,
const Matrix& tractions );
private:
Assignable<ElementGroup> egroup_;
Assignable<ElemSet> allElems_; // all elements
Assignable<ElementSet> elems_; // interface elements
Assignable<NodeSet> nodes_;
int rank_;
int ielemCount_; // num of total elements
int nodeCountF_; // no.of. all nodes per element = const
int nodeCount_; // no.of. solid nodes per element = const
int nodeCount2_; // no.of.nodes per element = const
int dofCount_; // no.of.dofs per element
int ipCount_; // num of GP per element
// to compute averaged stress to check failure
IntMatrix ibulkElems_; // indices of bulk elements
Ref<IShape> ishape_; // shape functions of volumetric elements
int inodeCount_;
int idofCount_;
int checkInterval_;
IdxVector belemMatMap_; // elem material map for bulk elems
ShapeGradsFunc getShapeGrads_;
IdxVector damagedElems_; // 1: damaged
Ref<FShape> shape_;
Ref<IShape> sshape_;
Ref<XDofSpace> dofs_;
Ref<Constraints> cons_;
Array<Ref<XCohesiveMat> >
materials_; // multi materials
IdxVector aaDofTypes_; // displacement dof types
IdxVector pwDofTypes_; // pore pressure dof types
IdxVector pfDofTypes_; // fracturing fluid pressure dof types
IdxVector dispNodes_; // indices of nodes with prescribed disp
IdxVector diriNodes_; // indices of nodes with dirichlet Bcs
IdxVector ielems_; // connectivity of group interface elements
SparseArray <int, 1> elemMatMap_; // hold the mat index for all elements
SparseArray <int, 2> ipMpMap_; // mapping between integration point and
std::vector<std::vector<int> >
dupNodes_;
double thickness_; // thickness for plane stress problems
double loc2Glob_;
bool initConsDone1_;
bool initConsDone2_;
FShapeFunc getFShapeFuncs_;
bool isPrsConstraint_; // true: enforce pressure continuity
bool isDspConstraint_; // true: enforce displacements before damage
bool isConstant_; // constant longitudianl permeability
double w0_; // initial aperture
double permea_; // longitudial (constant) permeability
double kt_; // transversal (constant) permeability, k_b=k_t
double alpha_;
double wf_;
double dtime_;
double mu_; // 1/(12*\mu_f)
double Q0_; // injection rate [m3/s]
int q0Node_; // node where injection rate is applied
// for writing pressure fields to file
// for upper nodes, lower nodes and mid nodes
IdxVector inodesA_;
IdxVector inodesB_;
IdxVector inodesM_;
String fileName_;
int interval_;
bool resolve_;
bool tractionFree_;
bool write_;
bool writeWellbore_;
IdxVector wellboreNodes_; // nodes at the wellbore
IdxVector wellboreUDofA_; // nodes at the wellbore
IdxVector wellborePDofA_; // nodes at the wellbore
IdxVector wellboreUDofB_; // nodes at the wellbore
IdxVector wellborePDofB_; // nodes at the wellbore
IdxVector wellborePDofM_; // nodes at the wellbore
Ref<PrintWriter> wellboreOut_;
Matrix coords1D_;
IntMatrix ipStatus_; // elastic or damaged, ipStatus(elemId,ipId)={0,1}
};
// =========================================================
// implementation of inline functions
// =========================================================
inline void RGPoroInterfaceElementModel::addConstraint_
( int xdof, int ydof,
int xdofM, int ydofM )
{
cons_->addConstraint ( xdof, xdofM, 1.0 );
cons_->addConstraint ( ydof, ydofM, 1.0 );
}
#endif
| [
"phu.nguyen@monash.edu"
] | phu.nguyen@monash.edu |
575b6579db167e8d5d3f434012c00c4da11ef862 | de374898513dab686d9bfc18037fdb2fb27d3387 | /src/main.cpp | 0971d9b85e6e80fe2b3140e32bfd93c439ce6fd4 | [] | no_license | winwinzu/m5camera | 87b24f854f5048cf5280bfd65a556a69d0c25f7a | a110af2775e0c2205788f0dd655ca6ac5840c3fa | refs/heads/master | 2023-04-17T12:18:43.783648 | 2021-04-16T13:27:49 | 2021-04-16T13:27:49 | 358,607,317 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,053 | cpp | #include <Arduino.h>
#include <esp_camera.h>
#include <WiFi.h>
#include <esp_log.h>
WiFiServer server(80);
const char ssid[] = "ESP32-WiFi";
const char pass[] = "esp32wifi";
const IPAddress ip(192, 168, 20, 2);
const IPAddress subnet(255, 255, 255, 0);
void startCameraServer();
void setup()
{
Serial.begin(115200);
camera_config_t config;
config.pin_sscb_scl = 23;
config.pin_sscb_sda = 22;
config.pin_xclk = 27;
config.pin_vsync = 25;
config.pin_href = 26;
config.pin_pclk = 21;
config.pin_d0 = 32;
config.pin_d1 = 35;
config.pin_d2 = 34;
config.pin_d3 = 5;
config.pin_d4 = 39;
config.pin_d5 = 18;
config.pin_d6 = 36;
config.pin_d7 = 19;
config.pin_reset = 15;
config.pin_pwdn = -1;
config.xclk_freq_hz = 20000000;
config.ledc_timer = LEDC_TIMER_0;
config.ledc_channel = LEDC_CHANNEL_0;
config.pixel_format = PIXFORMAT_GRAYSCALE;
config.frame_size = FRAMESIZE_QQVGA;
// config.pixel_format = PIXFORMAT_RGB888;
// config.frame_size = FRAMESIZE_QQVGA;
// config.jpeg_quality = 50;
config.fb_count = 1;
esp_err_t err = esp_camera_init(&config);
if(err != ESP_OK)
{
Serial.println("Error");
}
}
void loop() {
WiFiClient client = server.available();
/*
if(client)
{
Serial.println("success");
client.println("FUCKOFF");
client.println("<html>");
client.println("<head>");
client.println("<title>ESP32 Web Server HTML</title>");
client.println("</head>");
client.println("<body>");
client.println("<h1>ESP32 Web Server HTML</h>");
client.println("<p><a href=\"/H\"><button>LED:ON</button></a></p>");
client.println("<p><a href=\"/L\"><button>LED:OFF</button></a></p>");
client.println("</body>");
client.println("</html>");
}
else
{
// Serial.println("cant open");
}
// put your main code here, to run repeatedly:
*/
camera_fb_t *fb = NULL;
esp_err_t res = ESP_OK;
fb = esp_camera_fb_get();
if(!fb)
{
Serial.println("holy shit");
}
Serial.println(fb -> len);
// fb -> len is size of picture?
}
| [
"ftakuabai5000@gmail.com"
] | ftakuabai5000@gmail.com |
ffa0c3b263537d634ffc124851950e910094dbf1 | 4d209d683e5fcd03f7ffeff999ee47adb3b8fcc3 | /WarpTPS/DibView.cpp | ccf070f782043b058f9048ede551a1603e685800 | [] | no_license | yuzhuqingyun/pheonixrt | 6aebed75b78f4ac5db162429955901d963b5de49 | 6d5f2229362cedef111eea5ffea85c5022565f9b | refs/heads/master | 2016-09-05T10:05:06.204029 | 2014-10-24T04:21:55 | 2014-10-24T04:21:55 | 32,519,414 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 6,364 | cpp | // DibView.cpp : implementation file
//
#include "stdafx.h"
#include "DibView.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CDibView
CDibView::CDibView()
: m_pDoc(NULL),
m_pDib(NULL),
m_pTransform(NULL),
m_pInverseTransform(NULL),
m_nDataSet(-1),
m_nDraggingLandmark(-1),
m_bDrawMarks(TRUE)
{
}
CDibView::~CDibView()
{
}
// sets the document that is being displayed by this CDibView
void CDibView::SetDocument(CDocument *pDoc)
{
m_pDoc = pDoc;
}
// sets the DIB to be displayed
void CDibView::SetDib(CDib *pDib)
{
m_pDib = pDib;
}
// sets the transform to be managed
void CDibView::SetTransform(CTPSTransform *pForwardTransform, CTPSTransform *pInverseTransform, int nDataSet)
{
m_pTransform = pForwardTransform;
m_pInverseTransform = pInverseTransform;
m_nDataSet = nDataSet;
}
BEGIN_MESSAGE_MAP(CDibView, CWnd)
//{{AFX_MSG_MAP(CDibView)
ON_WM_PAINT()
ON_WM_MOUSEMOVE()
ON_WM_LBUTTONDOWN()
ON_WM_LBUTTONUP()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CDibView message handlers
static COLORREF g_arrColors[] =
{
RGB(255, 128, 255),
RGB(255, 0, 255),
RGB(255, 255, 0),
RGB( 0, 255, 255),
RGB(255, 0, 0),
RGB( 0, 255, 0),
RGB( 0, 0, 255),
RGB(128, 255, 128),
};
void CDibView::OnPaint()
{
CPaintDC dc(this); // device context for painting
if (m_pDib)
{
CRect rectSrc(0, 0, m_pDib->GetSize().cx, m_pDib->GetSize().cy);
CRect rectDst = GetDstRect();
// draw the image
m_pDib->Draw(dc, &rectDst, &rectSrc,
FALSE, /*bUseDrawDib*/
NULL,
FALSE /*bForeground*/
);
// draw the landmarks
if (m_nDataSet >= 0 && m_bDrawMarks)
{
CBrush *pOldBrush = (CBrush *) dc.SelectStockObject(HOLLOW_BRUSH);
for (int nAt = 0; nAt < m_pTransform->GetLandmarkCount(); nAt++)
{
int nColorCount = sizeof(g_arrColors) / sizeof(COLORREF);
CPen pen(PS_SOLID, 1, g_arrColors[nAt % nColorCount]);
CPen *pOldPen = (CPen *) dc.SelectObject(&pen);
CPoint pt =
Image2Client(m_pTransform->GetLandmark(m_nDataSet, nAt));
// dc.Ellipse(pt.x - 5, pt.y - 5, pt.x + 6, pt.y + 6);
dc.MoveTo(pt.x - 5, pt.y);
dc.LineTo(pt.x + 6, pt.y);
dc.MoveTo(pt.x, pt.y - 5);
dc.LineTo(pt.x, pt.y + 6);
dc.SelectObject(pOldPen);
}
dc.SelectObject(pOldBrush);
}
}
// Do not call CWnd::OnPaint() for painting messages
}
void CDibView::OnLButtonDown(UINT nFlags, CPoint point)
{
if (NULL != m_pTransform)
{
// find the landmark that we are dragging
for (int nAt = 0; nAt < m_pTransform->GetLandmarkCount(); nAt++)
{
CSize size = point
- Image2Client(m_pTransform->GetLandmark(m_nDataSet, nAt));
if (-5 < size.cx && size.cx < 5
&& -5 < size.cy && size.cy < 5)
{
m_nDraggingLandmark = nAt;
}
}
// create a new point
if (-1 == m_nDraggingLandmark)
{
int nOldSize = m_pTransform->GetLandmarkCount();
m_nDraggingLandmark = m_pTransform->AddLandmark(Client2Image(point));
int nNewSize = m_pTransform->GetLandmarkCount();
ASSERT(nOldSize+1 == nNewSize);
// add the inverse landmark
int inverseLandmark = m_pInverseTransform->AddLandmark(Client2Image(point));
// check that the inverse landmark is at the same position
ASSERT(m_nDraggingLandmark == inverseLandmark);
// redraw the segment the warping
Invalidate(FALSE);
}
// store the mouse point
m_ptPrev = point;
}
CWnd::OnLButtonDown(nFlags, point);
}
void CDibView::OnMouseMove(UINT nFlags, CPoint point)
{
if (-1 != m_nDraggingLandmark)
{
m_pTransform->SetLandmark(m_nDataSet, m_nDraggingLandmark,
m_pTransform->GetLandmark(m_nDataSet, m_nDraggingLandmark)
+ Client2Image(point) - Client2Image(m_ptPrev));
// TODO: shouldn't this be reversed
m_pInverseTransform->SetLandmark(1-m_nDataSet, m_nDraggingLandmark,
m_pInverseTransform->GetLandmark(1-m_nDataSet, m_nDraggingLandmark)
+ Client2Image(point) - Client2Image(m_ptPrev));
Invalidate(FALSE);
// store the mouse point
m_ptPrev = point;
}
CWnd::OnMouseMove(nFlags, point);
}
void CDibView::OnLButtonUp(UINT nFlags, CPoint point)
{
m_nDraggingLandmark = -1;
// Check if both inverse and forward are consistent
ASSERT(m_pTransform->CheckInverse(m_pInverseTransform));
ASSERT(m_pInverseTransform->CheckInverse(m_pTransform));
if (m_pDoc)
{
m_pDoc->UpdateAllViews(NULL);
}
CWnd::OnLButtonUp(nFlags, point);
}
CVectorD<3> CDibView::Client2Image(const CPoint &ptClient)
{
// source (DIB) image size
CRect rectSrc(0, 0, m_pDib->GetSize().cx, m_pDib->GetSize().cy);
// destination (window) image size
CRect rectDst = GetDstRect();
// ratio of source / destination heights
REAL ratio = (REAL) rectSrc.Height() / (REAL) rectDst.Height();
// offset to center and scale
CVectorD<3> vImage(ptClient);
vImage -= CVectorD<3>(rectDst.CenterPoint());
vImage *= ratio;
vImage += CVectorD<3>(rectSrc.CenterPoint());
return vImage;
}
CPoint CDibView::Image2Client(const CVectorD<3>&vImage)
{
// source (DIB) image size
CRect rectSrc(0, 0, m_pDib->GetSize().cx, m_pDib->GetSize().cy);
// destination (window) image size
CRect rectDst = GetDstRect();
// ratio of destination / source heights
REAL ratio = (REAL) rectDst.Height() / (REAL) rectSrc.Height();
// offset to center and scale
CPoint ptClient(vImage - CVectorD<3>(rectSrc.CenterPoint()));
ptClient.x = (int)(ratio * (REAL) ptClient.x);
ptClient.y = (int)(ratio * (REAL) ptClient.y);
ptClient += rectDst.CenterPoint();
return ptClient;
}
CRect CDibView::GetDstRect()
{
CRect rectDst;
GetClientRect(&rectDst);
CRect rectSrc(0, 0, m_pDib->GetSize().cx, m_pDib->GetSize().cy);
// set the client rectangle to the same aspect ratio
int nClientWidth = rectDst.Height() * rectSrc.Width()
/ rectSrc.Height();
CPoint ptCenter = rectDst.CenterPoint();
rectDst.left = ptCenter.x - nClientWidth / 2;
rectDst.right = ptCenter.x + nClientWidth / 2;
return rectDst;
}
| [
"dglane001@gmail.com@5160d9da-b3a6-11de-af8f-1f60b1e8fe01"
] | dglane001@gmail.com@5160d9da-b3a6-11de-af8f-1f60b1e8fe01 |
9a2265d90f160a63b424bc0af20f4d16d344fa0b | 92947e9833b94814612d14a65d1e3772bda10553 | /DeepSee_Stars/DeepSee_Stars/SceneManager/Scene/TitleScene/TitleScene.h | adf2d94a2b781bb7fa93429b95e44908605208b7 | [] | no_license | human-osaka-game-2018/DeepSee-Stars | db68ee2f834e8f187fed653ea45177f2cc12b85b | 6e4c65ee0f328a7489850304c936f80616780f65 | refs/heads/master | 2020-04-30T21:34:03.248483 | 2019-05-31T10:52:07 | 2019-05-31T10:57:05 | 177,096,457 | 0 | 0 | null | 2019-06-12T05:27:01 | 2019-03-22T07:57:06 | C++ | UTF-8 | C++ | false | false | 659 | h | #ifndef TITLE_SCENE_H_
#define TITLE_SCENE_H_
#include "../Scene.h"
#include "BackGround/TitleBackGround.h"
#include "Logo/TitleLogo.h"
#include "Menu/TitleMenu.h"
#include "Bubbles/Bubbles.h"
namespace deepseestars
{
/// <summary>
/// タイトルシーンクラス
/// </summary>
class TitleScene :public Scene
{
public:
TitleScene()
{
m_objects.Register(static_cast<GameObject*>(new TitleBackGround()));
m_objects.Register(static_cast<GameObject*>(new Bubbles()));
m_objects.Register(static_cast<GameObject*>(new TitleLogo()));
m_objects.Register(static_cast<GameObject*>(new TitleMenu()));
}
};
}
#endif // !TITLE_SCENE_H_
| [
"41816343+Kinoshita-Tatsuya@users.noreply.github.com"
] | 41816343+Kinoshita-Tatsuya@users.noreply.github.com |
e5d35484dc03d94b99a0d805c82c517711947c5c | c4e1b2fad57e164b1ec250d7ef58ca6b325be916 | /contests/caspercomp/pB.cpp | 5fed47b6f0b0a6bec7b9055305a87e425e3dc63c | [] | no_license | xSeanliux/CompetitiveProgramming | ab8030fdb0dc9c4e29e4cc8c52e020e6eb564372 | 011c7ad152d7090fa3e9143a27119a2192d68144 | refs/heads/master | 2023-06-08T11:00:48.826892 | 2023-05-25T22:58:43 | 2023-05-25T22:58:43 | 158,057,461 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 90 | cpp | #include <iostream>
#include <vector>
using namespace std;
int n, m, p;
int main(){
}
| [
"zhxnliu@gmail.com"
] | zhxnliu@gmail.com |
db01181a66e93191f0d58de25efa4dcf59897782 | 24fe7848250ca0890db81383f240c83308f7a79f | /ch09/_52.cpp | 3301850a67afeeeb6cffb9d90b91da01d38132e0 | [] | no_license | zzczzczzc/CppPrimer | aac6cb722f00e6e5ce9de557d2188e02eb8509ca | a4ee8b20148fdd34f7257fe1ef8a8480b0783f0a | refs/heads/master | 2020-05-02T12:12:23.594973 | 2019-03-28T04:42:36 | 2019-03-28T04:42:36 | 177,951,921 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 877 | cpp | #include <iostream>
#include <string>
#include <stack>
#include <cctype>
using namespace std;
string calc(string l, string r, string op) {
string s;
if (op == "-")
s = to_string(stoi(l) - stoi(r));
else if (op == "+")
s = to_string(stoi(l) + stoi(r));
return s;
}
int main() {
string s("1+2*(7-4)");
stack<string> stack;
for (auto iter = s.begin(); iter != s.end();) {
if (*iter == '(') {
stack.push(string(1, *iter));
++iter;
while (*iter != ')') {
stack.push(string(1, *iter));
++iter;
}
}
else if (*iter == ')') {
string r = stack.top(); stack.pop();
string op = stack.top(); stack.pop();
string l = stack.top(); stack.pop();
stack.pop();
stack.push(calc(l, r, op));
++iter;
}
else {
++iter;
}
}
while (!stack.empty()) {
cout << stack.top() << endl;
stack.pop();
}
system("pause");
return 0;
} | [
"32061523+zzczzczzc@users.noreply.github.com"
] | 32061523+zzczzczzc@users.noreply.github.com |
89e83ffd638d857f535c4a0692e87a56a5eb5c2d | d938080f013c8fe332ce293ff41699652b318775 | /zoneList.hpp | d01af35f41dd4aacdb36fdeb4c048a8198eba696 | [] | no_license | TacBF/tb_rhs_tanoa_jungle_fever.tanoa | 4101e2413e93dd3250f41b24849e6d4de00a405d | 9507289580a5a3029e5693e4c69e7c314b9fda2c | refs/heads/master | 2021-01-19T20:33:10.187645 | 2017-04-17T14:47:45 | 2017-04-17T14:47:45 | 88,518,057 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,835 | hpp | #include "tb_defines.hpp"
zoneList[] =
{
//ID and PROFILE = not used
//LINK = zones capturable after this one
//DEPEND = auto-capture/enable upon these zones being held
//DEPQTY = quantity of zones required for DEPEND i.e. can have only 2 of the 3 zones in DEPEND required
//SYNC = required zones for progression
//ID TEAM SPAWNTYPE LINK SYNC PROFILE DEPEND DEPQTY ZONE_DESC
{ 0, 0 , 0 , {} , {} , 1 , {} , 0 },
{ 1, TEAM_BLUE, SPAWN_XRAY, {3} , {} , 1 , {} , 0 , "%3" },
{ 2, TEAM_RED, SPAWN_XRAY, {12} , {} , 1 , {} , 0 , "%3" },
{ 3, TEAM_BLUE, SPAWN_NEVER, {1,4} , {} , 1 , {} , 0 , "%1" },
{ 4, TEAM_BLUE, SPAWN_NEVER, {3,5} , {} , 1 , {} , 0 , "%1" },
{ 5, TEAM_NEUTRAL, SPAWN_NEVER, {4,6} , {} , 1 , {} , 0 , "%1" },
{ 6, TEAM_NEUTRAL, SPAWN_NEVER, {5,7} , {} , 1 , {} , 0 , "%1" },
{ 7, TEAM_NEUTRAL, SPAWN_NEVER, {6,8} , {} , 1 , {} , 0 , "%1" },
{ 8, TEAM_NEUTRAL, SPAWN_NEVER, {7,9} , {} , 1 , {} , 0 , "%1" },
{ 9, TEAM_NEUTRAL, SPAWN_NEVER, {8,10} , {} , 1 , {} , 0 , "%1" },//new and not set in editor
{ 10, TEAM_NEUTRAL, SPAWN_NEVER, {9,11} , {} , 1 , {} , 0 , "%1" },//new and not set in editor
{ 11, TEAM_RED, SPAWN_NEVER, {10,12} , {} , 1 , {} , 0 , "%1" },
{ 12, TEAM_RED, SPAWN_NEVER, {11,2} , {} , 1 , {} , 0 , "%1" },
{ 13,TEAM_BLUE, SPAWN_INSTANT, {} , {} , 1 , {1,3} , 2 , "%4 %1" },
{ 14,TEAM_RED, SPAWN_INSTANT, {} , {} , 1 , {2,12} , 2 , "%4 %1" }
}; | [
"ballista.milsim@gmail.com"
] | ballista.milsim@gmail.com |
b6d7fd02bcae3fbc29520daa76170026fed7a650 | d96349b211a135bc63e828f186e3560c0d383197 | /Cp5/5-1-2_exercise.cpp | 014281959b88d5c0b0a9e67cf96f4df160d261a4 | [] | no_license | masa-k0101/Self-Study_Cpp | 116904e7a45d8d211e85b3e20cfbfc602dd866f4 | 1fdd3b0637274934e7730ca87a400bf2c97daf8f | refs/heads/master | 2022-12-14T01:59:20.763522 | 2020-09-15T13:20:08 | 2020-09-15T13:20:08 | 263,053,847 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,284 | cpp | #include<iostream>
#include<time.h>
namespace A
{
class stopwatch
{
double begin,end;
public:
stopwatch(); //コンストラクタ
stopwatch(clock_t t);
~stopwatch(); //デストラクタ
void start();
void stop();
void show();
};
stopwatch::stopwatch()
{
begin = end = 0;
}
stopwatch::stopwatch(clock_t t)
{
begin = (double) t / CLK_TCK;
end = 0.0;
}
stopwatch::~stopwatch()
{
std::cout << "Stopwatch object being destroyed.. \n";
show();
}
void stopwatch::start()
{
begin = (double)clock() / CLK_TCK;
}
void stopwatch::stop()
{
end = (double)clock() / CLK_TCK;
}
void stopwatch::show()
{
std::cout << "Elapsed time : " << end - begin << "\n";
}
}
main()
{
A::stopwatch watch;
long i;
watch.start();
for(i=0; i<320000; i++) ; // time a for loop
watch.stop();
watch.show();
A::stopwatch s2(clock());
for(i=0; i<250000; i++) ; // time a for loop
s2.stop();
s2.show();
return 0;
} | [
"noreply@github.com"
] | noreply@github.com |
83484e0c2fd2511420ef74a76198ff9c419b4acb | 920b7c4c26411bef7194cf32b2491deb2aed9df3 | /caffe/src/caffe/layers/sigmoid_cross_entropy_loss_layer.cpp | 6a48099ae8bef69faf4968219f5c2cbf83d291de | [
"MIT",
"BSD-2-Clause",
"LicenseRef-scancode-generic-cla"
] | permissive | samin91/dec | ca52fb89954951e40a7400771f6eac11087b9bbe | 4c001e3343e726d59936529c701b73f1bcb5994c | refs/heads/master | 2022-11-06T21:54:54.844898 | 2020-07-02T12:54:02 | 2020-07-02T12:54:02 | 255,551,768 | 0 | 0 | MIT | 2020-04-14T08:24:12 | 2020-04-14T08:24:11 | null | UTF-8 | C++ | false | false | 2,816 | cpp | #include <algorithm>
#include <cfloat>
#include <vector>
#include "caffe/layer.hpp"
#include "caffe/util/math_functions.hpp"
#include "caffe/vision_layers.hpp"
namespace caffe {
template <typename Dtype>
void SigmoidCrossEntropyLossLayer<Dtype>::LayerSetUp(
const vector<Blob<Dtype>*>& bottom, vector<Blob<Dtype>*>* top) {
LossLayer<Dtype>::LayerSetUp(bottom, top);
sigmoid_bottom_vec_.clear();
sigmoid_bottom_vec_.push_back(bottom[0]);
sigmoid_top_vec_.clear();
sigmoid_top_vec_.push_back(sigmoid_output_.get());
sigmoid_layer_->SetUp(sigmoid_bottom_vec_, &sigmoid_top_vec_);
}
template <typename Dtype>
void SigmoidCrossEntropyLossLayer<Dtype>::Reshape(
const vector<Blob<Dtype>*>& bottom, vector<Blob<Dtype>*>* top) {
LossLayer<Dtype>::Reshape(bottom, top);
CHECK_EQ(bottom[0]->count(), bottom[1]->count()) <<
"SIGMOID_CROSS_ENTROPY_LOSS layer inputs must have the same count.";
sigmoid_layer_->Reshape(sigmoid_bottom_vec_, &sigmoid_top_vec_);
}
template <typename Dtype>
void SigmoidCrossEntropyLossLayer<Dtype>::Forward_cpu(
const vector<Blob<Dtype>*>& bottom, vector<Blob<Dtype>*>* top) {
// The forward pass computes the sigmoid outputs.
sigmoid_bottom_vec_[0] = bottom[0];
sigmoid_layer_->Forward(sigmoid_bottom_vec_, &sigmoid_top_vec_);
// Compute the loss (negative log likelihood)
const int count = bottom[0]->count();
const int num = bottom[0]->num();
// Stable version of loss computation from input data
const Dtype* input_data = bottom[0]->cpu_data();
const Dtype* target = bottom[1]->cpu_data();
Dtype loss = 0;
for (int i = 0; i < count; ++i) {
loss -= input_data[i] * (target[i] - (input_data[i] >= 0)) -
log(1 + exp(input_data[i] - 2 * input_data[i] * (input_data[i] >= 0)));
}
(*top)[0]->mutable_cpu_data()[0] = loss / num;
}
template <typename Dtype>
void SigmoidCrossEntropyLossLayer<Dtype>::Backward_cpu(
const vector<Blob<Dtype>*>& top, const vector<bool>& propagate_down,
vector<Blob<Dtype>*>* bottom) {
if (propagate_down[1]) {
LOG(FATAL) << this->type_name()
<< " Layer cannot backpropagate to label inputs.";
}
if (propagate_down[0]) {
// First, compute the diff
const int count = (*bottom)[0]->count();
const int num = (*bottom)[0]->num();
const Dtype* sigmoid_output_data = sigmoid_output_->cpu_data();
const Dtype* target = (*bottom)[1]->cpu_data();
Dtype* bottom_diff = (*bottom)[0]->mutable_cpu_diff();
caffe_sub(count, sigmoid_output_data, target, bottom_diff);
// Scale down gradient
const Dtype loss_weight = top[0]->cpu_diff()[0];
caffe_scal(count, loss_weight / num, bottom_diff);
}
}
#ifdef CPU_ONLY
STUB_GPU(SigmoidCrossEntropyLossLayer);
#endif
INSTANTIATE_CLASS(SigmoidCrossEntropyLossLayer);
} // namespace caffe
| [
"eric.jy.xie@gmail.com"
] | eric.jy.xie@gmail.com |
8c90d63d0ee065e2317e657fd0e4aacb33c758b5 | 2cad5651833ef60679d037bc02f0a45cf8caa917 | /cli.cpp | 1a730087bbd374580aba3209b05d45191543c719 | [] | no_license | raboserg/ovpnclient | 21f58ca7382a64425f4578f30951ea23dfe2aace | 4693487f8eb7e01a50f07003cc7a42db7158af1d | refs/heads/master | 2020-09-25T23:22:45.439540 | 2019-12-05T15:46:17 | 2019-12-05T15:46:17 | 226,111,755 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 37,804 | cpp | // OpenVPN -- An application to securely tunnel IP networks
// over a single port, with support for SSL/TLS-based
// session authentication and key exchange,
// packet encryption, packet authentication, and
// packet compression.
//
// Copyright (C) 2012-2017 OpenVPN Inc.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License Version 3
// as published by the Free Software Foundation.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program in the COPYING file.
// If not, see <http://www.gnu.org/licenses/>.
// OpenVPN 3 test client
#include <stdlib.h> // for atoi
#include <iostream>
#include <memory>
#include <mutex>
#include <string>
#include <thread>
#include <openvpn/common/platform.hpp>
#ifdef OPENVPN_PLATFORM_MAC
#include <ApplicationServices/ApplicationServices.h>
#include <CoreFoundation/CFBundle.h>
#endif
// If enabled, don't direct ovpn3 core logging to
// ClientAPI::OpenVPNClient::log() virtual method.
// Instead, logging will go to LogBaseSimple::log().
// In this case, make sure to define:
// LogBaseSimple log;
// at the top of your main() function to receive
// log messages from all threads.
// Also, note that the OPENVPN_LOG_GLOBAL setting
// MUST be consistent across all compilation units.
#ifdef OPENVPN_USE_LOG_BASE_SIMPLE
#define OPENVPN_LOG_GLOBAL // use global rather than thread-local log object
// pointer
#include <openvpn/log/logbasesimple.hpp>
#endif
// don't export core symbols
#define OPENVPN_CORE_API_VISIBILITY_HIDDEN
// should be included before other openvpn includes,
// with the exception of openvpn/log includes
#include <client/ovpncli.cpp>
#include <openvpn/common/cleanup.hpp>
#include <openvpn/common/exception.hpp>
#include <openvpn/common/file.hpp>
#include <openvpn/common/getopt.hpp>
#include <openvpn/common/getpw.hpp>
#include <openvpn/common/signal.hpp>
#include <openvpn/common/string.hpp>
#include <openvpn/ssl/peerinfo.hpp>
#include <openvpn/ssl/sslchoose.hpp>
#include <openvpn/time/timestr.hpp>
#ifdef OPENVPN_REMOTE_OVERRIDE
#include <openvpn/common/process.hpp>
#endif
#if defined(USE_MBEDTLS)
#include <openvpn/mbedtls/util/pkcs1.hpp>
#endif
#if defined(OPENVPN_PLATFORM_WIN)
#include <openvpn/win/console.hpp>
#include <shellapi.h>
#endif
#ifdef USE_NETCFG
#include "client/core-client-netcfg.hpp"
#endif
#if defined(OPENVPN_PLATFORM_LINUX)
// use SITNL by default
#ifndef OPENVPN_USE_IPROUTE2
#define OPENVPN_USE_SITNL
#endif
#include <openvpn/tun/linux/client/tuncli.hpp>
// we use a static polymorphism and define a
// platform-specific TunSetup class, responsible
// for setting up tun device
#define TUN_CLASS_SETUP TunLinuxSetup::Setup<TUN_LINUX>
#elif defined(OPENVPN_PLATFORM_MAC)
#include <openvpn/tun/mac/client/tuncli.hpp>
#define TUN_CLASS_SETUP TunMac::Setup
#endif
using namespace openvpn;
namespace {
OPENVPN_SIMPLE_EXCEPTION(usage);
}
#ifdef USE_TUN_BUILDER
class ClientBase : public ClientAPI::OpenVPNClient {
public:
bool tun_builder_new() override {
tbc.tun_builder_set_mtu(1500);
return true;
}
int tun_builder_establish() override {
if (!tun) {
tun.reset(new TUN_CLASS_SETUP());
}
TUN_CLASS_SETUP::Config config;
config.layer = Layer(Layer::Type::OSI_LAYER_3);
// no need to add bypass routes on establish since we do it on
// socket_protect
config.add_bypass_routes_on_establish = false;
return tun->establish(tbc, &config, nullptr, std::cout);
}
bool tun_builder_add_address(const std::string &address, int prefix_length,
const std::string &gateway, // optional
bool ipv6, bool net30) override {
return tbc.tun_builder_add_address(address, prefix_length, gateway, ipv6,
net30);
}
bool tun_builder_add_route(const std::string &address, int prefix_length,
int metric, bool ipv6) override {
return tbc.tun_builder_add_route(address, prefix_length, metric, ipv6);
}
bool tun_builder_reroute_gw(bool ipv4, bool ipv6,
unsigned int flags) override {
return tbc.tun_builder_reroute_gw(ipv4, ipv6, flags);
}
bool tun_builder_set_remote_address(const std::string &address,
bool ipv6) override {
return tbc.tun_builder_set_remote_address(address, ipv6);
}
bool tun_builder_set_session_name(const std::string &name) override {
return tbc.tun_builder_set_session_name(name);
}
bool tun_builder_add_dns_server(const std::string &address,
bool ipv6) override {
return tbc.tun_builder_add_dns_server(address, ipv6);
}
void tun_builder_teardown(bool disconnect) override {
std::ostringstream os;
auto os_print = Cleanup([&os]() { OPENVPN_LOG_STRING(os.str()); });
tun->destroy(os);
}
bool socket_protect(int socket, std::string remote, bool ipv6) override {
(void)socket;
std::ostringstream os;
auto os_print = Cleanup([&os]() { OPENVPN_LOG_STRING(os.str()); });
return tun->add_bypass_route(remote, ipv6, os);
}
private:
TUN_CLASS_SETUP::Ptr tun = new TUN_CLASS_SETUP();
TunBuilderCapture tbc;
};
#else // USE_TUN_BUILDER
class ClientBase : public ClientAPI::OpenVPNClient {
public:
bool socket_protect(int socket, std::string remote, bool ipv6) override {
std::cout << "NOT IMPLEMENTED: *** socket_protect " << socket << " "
<< remote << std::endl;
return true;
}
};
#endif
class Client : public ClientBase {
public:
enum ClockTickAction {
CT_UNDEF,
CT_STOP,
CT_RECONNECT,
CT_PAUSE,
CT_RESUME,
CT_STATS,
};
bool is_dynamic_challenge() const { return !dc_cookie.empty(); }
std::string dynamic_challenge_cookie() { return dc_cookie; }
std::string epki_ca;
std::string epki_cert;
#if defined(USE_MBEDTLS)
MbedTLSPKI::PKContext epki_ctx; // external PKI context
#endif
void set_clock_tick_action(const ClockTickAction action) {
clock_tick_action = action;
}
void print_stats() {
const int n = stats_n();
std::vector<long long> stats = stats_bundle();
std::cout << "STATS:" << std::endl;
for (int i = 0; i < n; ++i) {
const long long value = stats[i];
if (value)
std::cout << " " << stats_name(i) << " : " << value << std::endl;
}
}
#ifdef OPENVPN_REMOTE_OVERRIDE
void set_remote_override_cmd(const std::string &cmd) {
remote_override_cmd = cmd;
}
#endif
private:
virtual void event(const ClientAPI::Event &ev) override {
std::cout << date_time() << " EVENT: " << ev.name;
if (!ev.info.empty())
std::cout << ' ' << ev.info;
if (ev.fatal)
std::cout << " [FATAL-ERR]";
else if (ev.error)
std::cout << " [ERR]";
std::cout << std::endl;
if (ev.name == "DYNAMIC_CHALLENGE") {
dc_cookie = ev.info;
ClientAPI::DynamicChallenge dc;
if (ClientAPI::OpenVPNClient::parse_dynamic_challenge(ev.info, dc)) {
std::cout << "DYNAMIC CHALLENGE" << std::endl;
std::cout << "challenge: " << dc.challenge << std::endl;
std::cout << "echo: " << dc.echo << std::endl;
std::cout << "responseRequired: " << dc.responseRequired << std::endl;
std::cout << "stateID: " << dc.stateID << std::endl;
}
} else if (ev.name == "INFO" &&
(string::starts_with(ev.info, "OPEN_URL:http://") ||
string::starts_with(ev.info, "OPEN_URL:https://"))) {
// launch URL
const std::string url_str = ev.info.substr(9);
#ifdef OPENVPN_PLATFORM_MAC
std::thread thr([url_str]() {
CFURLRef url =
CFURLCreateWithBytes(NULL, // allocator
(UInt8 *)url_str.c_str(), // URLBytes
url_str.length(), // length
kCFStringEncodingUTF8, // encoding
NULL // baseURL
);
LSOpenCFURLRef(url, 0);
CFRelease(url);
});
thr.detach();
#else
std::cout << "No implementation to launch " << url_str << std::endl;
#endif
}
}
virtual void log(const ClientAPI::LogInfo &log) override {
std::lock_guard<std::mutex> lock(log_mutex);
std::cout << date_time() << ' ' << log.text << std::flush;
}
virtual void clock_tick() override {
const ClockTickAction action = clock_tick_action;
clock_tick_action = CT_UNDEF;
switch (action) {
case CT_STOP:
std::cout << "signal: CT_STOP" << std::endl;
stop();
break;
case CT_RECONNECT:
std::cout << "signal: CT_RECONNECT" << std::endl;
reconnect(0);
break;
case CT_PAUSE:
std::cout << "signal: CT_PAUSE" << std::endl;
pause("clock-tick pause");
break;
case CT_RESUME:
std::cout << "signal: CT_RESUME" << std::endl;
resume();
break;
case CT_STATS:
std::cout << "signal: CT_STATS" << std::endl;
print_stats();
break;
default:
break;
}
}
virtual void external_pki_cert_request(
ClientAPI::ExternalPKICertRequest &certreq) override {
if (!epki_cert.empty()) {
certreq.cert = epki_cert;
certreq.supportingChain = epki_ca;
} else {
certreq.error = true;
certreq.errorText = "external_pki_cert_request not implemented";
}
}
virtual void external_pki_sign_request(
ClientAPI::ExternalPKISignRequest &signreq) override {
#if defined(USE_MBEDTLS)
if (epki_ctx.defined()) {
try {
// decode base64 sign request
BufferAllocated signdata(256, BufferAllocated::GROW);
base64->decode(signdata, signreq.data);
// get MD alg
const mbedtls_md_type_t md_alg =
PKCS1::DigestPrefix::MbedTLSParse().alg_from_prefix(signdata);
// log info
OPENVPN_LOG("SIGN["
<< PKCS1::DigestPrefix::MbedTLSParse::to_string(md_alg)
<< ',' << signdata.size()
<< "]: " << render_hex_generic(signdata));
// allocate buffer for signature
BufferAllocated sig(mbedtls_pk_get_len(epki_ctx.get()),
BufferAllocated::ARRAY);
// sign it
size_t sig_size = 0;
const int status = mbedtls_pk_sign(
epki_ctx.get(), md_alg, signdata.c_data(), signdata.size(),
sig.data(), &sig_size, rng_callback, this);
if (status != 0)
throw Exception("mbedtls_pk_sign failed, err=" +
openvpn::to_string(status));
if (sig.size() != sig_size)
throw Exception("unexpected signature size");
// encode base64 signature
signreq.sig = base64->encode(sig);
OPENVPN_LOG("SIGNATURE[" << sig_size << "]: " << signreq.sig);
} catch (const std::exception &e) {
signreq.error = true;
signreq.errorText =
std::string("external_pki_sign_request: ") + e.what();
}
} else
#endif
{
signreq.error = true;
signreq.errorText = "external_pki_sign_request not implemented";
}
}
// RNG callback
static int rng_callback(void *arg, unsigned char *data, size_t len) {
Client *self = (Client *)arg;
if (!self->rng) {
self->rng.reset(new SSLLib::RandomAPI(false));
self->rng->assert_crypto();
}
return self->rng->rand_bytes_noexcept(data, len)
? 0
: -1; // using -1 as a general-purpose mbed TLS error code
}
virtual bool pause_on_connection_timeout() override { return false; }
#ifdef OPENVPN_REMOTE_OVERRIDE
virtual bool remote_override_enabled() override {
return !remote_override_cmd.empty();
}
virtual void remote_override(ClientAPI::RemoteOverride &ro) {
RedirectPipe::InOut pio;
Argv argv;
argv.emplace_back(remote_override_cmd);
OPENVPN_LOG(argv.to_string());
const int status = system_cmd(remote_override_cmd, argv, nullptr, pio,
RedirectPipe::IGNORE_ERR);
if (!status) {
const std::string out = string::first_line(pio.out);
OPENVPN_LOG("REMOTE OVERRIDE: " << out);
auto svec = string::split(out, ',');
if (svec.size() == 4) {
ro.host = svec[0];
ro.ip = svec[1];
ro.port = svec[2];
ro.proto = svec[3];
} else
ro.error = "cannot parse remote-override, expecting host,ip,port,proto "
"(at least one or both of host and ip must be defined)";
} else
ro.error = "status=" + std::to_string(status);
}
#endif
std::mutex log_mutex;
std::string dc_cookie;
RandomAPI::Ptr rng; // random data source for epki
volatile ClockTickAction clock_tick_action = CT_UNDEF;
#ifdef OPENVPN_REMOTE_OVERRIDE
std::string remote_override_cmd;
#endif
};
static Client *the_client = nullptr; // GLOBAL
static void worker_thread() {
#if !defined(OPENVPN_OVPNCLI_SINGLE_THREAD)
openvpn_io::detail::signal_blocker
signal_blocker; // signals should be handled by parent thread
#endif
try {
std::cout << "Thread starting..." << std::endl;
ClientAPI::Status connect_status = the_client->connect();
if (connect_status.error) {
std::cout << "connect error: ";
if (!connect_status.status.empty())
std::cout << connect_status.status << ": ";
std::cout << connect_status.message << std::endl;
}
} catch (const std::exception &e) {
std::cout << "Connect thread exception: " << e.what() << std::endl;
}
std::cout << "Thread finished" << std::endl;
}
static std::string read_profile(const char *fn,
const std::string *profile_content) {
if (!string::strcasecmp(fn, "http") && profile_content &&
!profile_content->empty())
return *profile_content;
else {
ProfileMerge pm(fn, "ovpn", "", ProfileMerge::FOLLOW_FULL,
ProfileParseLimits::MAX_LINE_SIZE,
ProfileParseLimits::MAX_PROFILE_SIZE);
if (pm.status() != ProfileMerge::MERGE_SUCCESS)
OPENVPN_THROW_EXCEPTION("merge config error: " << pm.status_string()
<< " : " << pm.error());
return pm.profile_content();
}
}
#if defined(OPENVPN_PLATFORM_WIN)
static void start_thread(Client &client) {
// Set Windows title bar
const std::string title_text = "F2:Stats F3:Reconnect F4:Stop F5:Pause";
Win::Console::Title title(ClientAPI::OpenVPNClient::platform() + " " +
title_text);
Win::Console::Input console;
// start connect thread
std::unique_ptr<std::thread> thread;
volatile bool thread_exit = false;
the_client = &client;
thread.reset(new std::thread([&thread_exit]() {
worker_thread();
thread_exit = true;
}));
// wait for connect thread to exit, also check for keypresses
while (!thread_exit) {
while (true) {
const unsigned int c = console.get();
if (!c)
break;
else if (c == 0x3C) // F2
the_client->print_stats();
else if (c == 0x3D) // F3
the_client->reconnect(0);
else if (c == 0x3E) // F4
the_client->stop();
else if (c == 0x3F) // F5
the_client->pause("user-pause");
}
Sleep(1000);
}
// wait for connect thread to exit
thread->join();
the_client = nullptr;
}
#elif defined(OPENVPN_OVPNCLI_SINGLE_THREAD)
static void handler(int signum) {
switch (signum) {
case SIGTERM:
case SIGINT:
if (the_client)
the_client->set_clock_tick_action(Client::CT_STOP);
break;
case SIGHUP:
if (the_client)
the_client->set_clock_tick_action(Client::CT_RECONNECT);
break;
case SIGUSR1:
if (the_client)
the_client->set_clock_tick_action(Client::CT_STATS);
break;
case SIGUSR2: {
// toggle pause/resume
static bool hup = false;
if (the_client) {
if (hup)
the_client->set_clock_tick_action(Client::CT_RESUME);
else
the_client->set_clock_tick_action(Client::CT_PAUSE);
hup = !hup;
}
} break;
default:
break;
}
}
static void start_thread(Client &client) {
the_client = &client;
// capture signals that might occur while we're in worker_thread
Signal signal(handler, Signal::F_SIGINT | Signal::F_SIGTERM |
Signal::F_SIGHUP | Signal::F_SIGUSR1 |
Signal::F_SIGUSR2);
// run the client
worker_thread();
the_client = nullptr;
}
#else
static void handler(int signum) {
switch (signum) {
case SIGTERM:
case SIGINT:
std::cout << "received stop signal " << signum << std::endl;
if (the_client)
the_client->stop();
break;
case SIGHUP:
std::cout << "received reconnect signal " << signum << std::endl;
if (the_client)
the_client->reconnect(0);
break;
case SIGUSR1:
if (the_client)
the_client->print_stats();
break;
case SIGUSR2: {
// toggle pause/resume
static bool hup = false;
std::cout << "received pause/resume toggle signal " << signum << std::endl;
if (the_client) {
if (hup)
the_client->resume();
else
the_client->pause("pause-resume-signal");
hup = !hup;
}
} break;
default:
std::cout << "received unknown signal " << signum << std::endl;
break;
}
}
static void start_thread(Client &client) {
std::unique_ptr<std::thread> thread;
// start connect thread
the_client = &client;
thread.reset(new std::thread([]() { worker_thread(); }));
{
// catch signals that might occur while we're in join()
Signal signal(handler, Signal::F_SIGINT | Signal::F_SIGTERM |
Signal::F_SIGHUP | Signal::F_SIGUSR1 |
Signal::F_SIGUSR2);
// wait for connect thread to exit
thread->join();
}
the_client = nullptr;
}
#endif
int openvpn_client(int argc, char *argv[], const std::string *profile_content) {
static const struct option longopts[] = {
{"username", required_argument, nullptr, 'u'},
{"password", required_argument, nullptr, 'p'},
{"response", required_argument, nullptr, 'r'},
{"dc", required_argument, nullptr, 'D'},
{"proto", required_argument, nullptr, 'P'},
{"ipv6", required_argument, nullptr, '6'},
{"server", required_argument, nullptr, 's'},
{"port", required_argument, nullptr, 'R'},
{"timeout", required_argument, nullptr, 't'},
{"compress", required_argument, nullptr, 'c'},
{"pk-password", required_argument, nullptr, 'z'},
{"tvm-override", required_argument, nullptr, 'M'},
{"proxy-host", required_argument, nullptr, 'h'},
{"proxy-port", required_argument, nullptr, 'q'},
{"proxy-username", required_argument, nullptr, 'U'},
{"proxy-password", required_argument, nullptr, 'W'},
{"peer-info", required_argument, nullptr, 'I'},
{"gremlin", required_argument, nullptr, 'G'},
{"proxy-basic", no_argument, nullptr, 'B'},
{"alt-proxy", no_argument, nullptr, 'A'},
{"dco", no_argument, nullptr, 'd'},
{"eval", no_argument, nullptr, 'e'},
{"self-test", no_argument, nullptr, 'T'},
{"cache-password", no_argument, nullptr, 'C'},
{"no-cert", no_argument, nullptr, 'x'},
{"force-aes-cbc", no_argument, nullptr, 'f'},
{"google-dns", no_argument, nullptr, 'g'},
{"persist-tun", no_argument, nullptr, 'j'},
{"wintun", no_argument, nullptr, 'w'},
{"def-keydir", required_argument, nullptr, 'k'},
{"merge", no_argument, nullptr, 'm'},
{"version", no_argument, nullptr, 'v'},
{"auto-sess", no_argument, nullptr, 'a'},
{"auth-retry", no_argument, nullptr, 'Y'},
{"tcprof-override", required_argument, nullptr, 'X'},
{"ssl-debug", required_argument, nullptr, 1},
{"epki-cert", required_argument, nullptr, 2},
{"epki-ca", required_argument, nullptr, 3},
{"epki-key", required_argument, nullptr, 4},
#ifdef OPENVPN_REMOTE_OVERRIDE
{"remote-override", required_argument, nullptr, 5},
#endif
{nullptr, 0, nullptr, 0}};
int ret = 0;
auto cleanup = Cleanup([]() { the_client = nullptr; });
try {
if (argc >= 2) {
std::string username;
std::string password;
std::string response;
std::string dynamicChallengeCookie;
std::string proto;
std::string ipv6;
std::string server;
std::string port;
int timeout = 0;
std::string compress;
std::string privateKeyPassword;
std::string tlsVersionMinOverride;
std::string tlsCertProfileOverride;
std::string proxyHost;
std::string proxyPort;
std::string proxyUsername;
std::string proxyPassword;
std::string peer_info;
std::string gremlin;
bool eval = false;
bool self_test = false;
bool cachePassword = false;
bool disableClientCert = false;
bool proxyAllowCleartextAuth = false;
int defaultKeyDirection = -1;
bool forceAesCbcCiphersuites = false;
int sslDebugLevel = 0;
bool googleDnsFallback = false;
bool autologinSessions = false;
bool retryOnAuthFailed = false;
bool tunPersist = false;
bool wintun = false;
bool merge = false;
bool version = false;
bool altProxy = false;
bool dco = false;
std::string epki_cert_fn;
std::string epki_ca_fn;
std::string epki_key_fn;
#ifdef OPENVPN_REMOTE_OVERRIDE
std::string remote_override_cmd;
#endif
int ch;
optind = 1;
while ((ch = getopt_long(
argc, argv,
"BAdeTCxfgjwmvaYu:p:r:D:P:6:s:t:c:z:M:h:q:U:W:I:G:k:X:R:",
longopts, nullptr)) != -1) {
switch (ch) {
case 1: // ssl-debug
sslDebugLevel = ::atoi(optarg);
break;
case 2: // --epki-cert
epki_cert_fn = optarg;
break;
case 3: // --epki-ca
epki_ca_fn = optarg;
break;
case 4: // --epki-key
epki_key_fn = optarg;
break;
#ifdef OPENVPN_REMOTE_OVERRIDE
case 5: // --remote-override
remote_override_cmd = optarg;
break;
#endif
case 'e':
eval = true;
break;
case 'T':
self_test = true;
break;
case 'C':
cachePassword = true;
break;
case 'x':
disableClientCert = true;
break;
case 'u':
username = optarg;
break;
case 'p':
password = optarg;
break;
case 'r':
response = optarg;
break;
case 'P':
proto = optarg;
break;
case '6':
ipv6 = optarg;
break;
case 's':
server = optarg;
break;
case 'R':
port = optarg;
break;
case 't':
timeout = ::atoi(optarg);
break;
case 'c':
compress = optarg;
break;
case 'z':
privateKeyPassword = optarg;
break;
case 'M':
tlsVersionMinOverride = optarg;
break;
case 'X':
tlsCertProfileOverride = optarg;
break;
case 'h':
proxyHost = optarg;
break;
case 'q':
proxyPort = optarg;
break;
case 'U':
proxyUsername = optarg;
break;
case 'W':
proxyPassword = optarg;
break;
case 'B':
proxyAllowCleartextAuth = true;
break;
case 'A':
altProxy = true;
break;
case 'd':
dco = true;
break;
case 'f':
forceAesCbcCiphersuites = true;
break;
case 'g':
googleDnsFallback = true;
break;
case 'a':
autologinSessions = true;
break;
case 'Y':
retryOnAuthFailed = true;
break;
case 'j':
tunPersist = true;
break;
case 'w':
wintun = true;
break;
case 'm':
merge = true;
break;
case 'v':
version = true;
break;
case 'k': {
const std::string arg = optarg;
if (arg == "bi" || arg == "bidirectional")
defaultKeyDirection = -1;
else if (arg == "0")
defaultKeyDirection = 0;
else if (arg == "1")
defaultKeyDirection = 1;
else
OPENVPN_THROW_EXCEPTION("bad default key-direction: " << arg);
} break;
case 'D':
dynamicChallengeCookie = optarg;
break;
case 'I':
peer_info = optarg;
break;
case 'G':
gremlin = optarg;
break;
default:
throw usage();
}
}
argc -= optind;
argv += optind;
if (version) {
std::cout << "OpenVPN cli 1.0" << std::endl;
std::cout << ClientAPI::OpenVPNClient::platform() << std::endl;
std::cout << ClientAPI::OpenVPNClient::copyright() << std::endl;
} else if (self_test) {
std::cout << ClientAPI::OpenVPNClient::crypto_self_test();
} else if (merge) {
if (argc != 1)
throw usage();
std::cout << read_profile(argv[0], profile_content);
} else {
if (argc < 1)
throw usage();
bool retry;
do {
retry = false;
ClientAPI::Config config;
config.guiVersion = "cli 1.0";
#if defined(OPENVPN_PLATFORM_WIN)
int nargs = 0;
auto argvw = CommandLineToArgvW(GetCommandLineW(), &nargs);
UTF8 utf8(Win::utf8(argvw[nargs - 1]));
config.content = read_profile(utf8.get(), profile_content);
#else
config.content = read_profile(argv[0], profile_content);
#endif
for (int i = 1; i < argc; ++i) {
config.content += argv[i];
config.content += '\n';
}
config.serverOverride = server;
config.portOverride = port;
config.protoOverride = proto;
config.connTimeout = timeout;
config.compressionMode = compress;
config.ipv6 = ipv6;
config.privateKeyPassword = privateKeyPassword;
config.tlsVersionMinOverride = tlsVersionMinOverride;
config.tlsCertProfileOverride = tlsCertProfileOverride;
config.disableClientCert = disableClientCert;
config.proxyHost = proxyHost;
config.proxyPort = proxyPort;
config.proxyUsername = proxyUsername;
config.proxyPassword = proxyPassword;
config.proxyAllowCleartextAuth = proxyAllowCleartextAuth;
config.altProxy = altProxy;
config.dco = dco;
config.defaultKeyDirection = defaultKeyDirection;
config.forceAesCbcCiphersuites = forceAesCbcCiphersuites;
config.sslDebugLevel = sslDebugLevel;
config.googleDnsFallback = googleDnsFallback;
config.autologinSessions = autologinSessions;
config.retryOnAuthFailed = retryOnAuthFailed;
config.tunPersist = tunPersist;
config.gremlinConfig = gremlin;
config.info = true;
config.wintun = wintun;
config.ssoMethods = "openurl";
#if defined(OPENVPN_OVPNCLI_SINGLE_THREAD)
config.clockTickMS = 250;
#endif
if (!epki_cert_fn.empty())
config.externalPkiAlias = "epki"; // dummy string
PeerInfo::Set::parse_csv(peer_info, config.peerInfo);
// allow -s server override to reference a friendly name
// in the config.
// setenv SERVER <HOST>/<FRIENDLY_NAME>
if (!config.serverOverride.empty()) {
const ClientAPI::EvalConfig eval =
ClientAPI::OpenVPNClient::eval_config_static(config);
for (auto &se : eval.serverList) {
if (config.serverOverride == se.friendlyName) {
config.serverOverride = se.server;
break;
}
}
}
if (eval) {
const ClientAPI::EvalConfig eval =
ClientAPI::OpenVPNClient::eval_config_static(config);
std::cout << "EVAL PROFILE" << std::endl;
std::cout << "error=" << eval.error << std::endl;
std::cout << "message=" << eval.message << std::endl;
std::cout << "userlockedUsername=" << eval.userlockedUsername
<< std::endl;
std::cout << "profileName=" << eval.profileName << std::endl;
std::cout << "friendlyName=" << eval.friendlyName << std::endl;
std::cout << "autologin=" << eval.autologin << std::endl;
std::cout << "externalPki=" << eval.externalPki << std::endl;
std::cout << "staticChallenge=" << eval.staticChallenge
<< std::endl;
std::cout << "staticChallengeEcho=" << eval.staticChallengeEcho
<< std::endl;
std::cout << "privateKeyPasswordRequired="
<< eval.privateKeyPasswordRequired << std::endl;
std::cout << "allowPasswordSave=" << eval.allowPasswordSave
<< std::endl;
if (!config.serverOverride.empty())
std::cout << "server=" << config.serverOverride << std::endl;
for (size_t i = 0; i < eval.serverList.size(); ++i) {
const ClientAPI::ServerEntry &se = eval.serverList[i];
std::cout << '[' << i << "] " << se.server << '/'
<< se.friendlyName << std::endl;
}
} else {
#if defined(USE_NETCFG)
DBus conn(G_BUS_TYPE_SYSTEM);
conn.Connect();
NetCfgTunBuilder<Client> client(conn.GetConnection());
#else
Client client;
#endif
const ClientAPI::EvalConfig eval = client.eval_config(config);
if (eval.error)
OPENVPN_THROW_EXCEPTION("eval config error: " << eval.message);
if (eval.autologin) {
if (!username.empty() || !password.empty())
std::cout << "NOTE: creds were not needed" << std::endl;
} else {
if (username.empty())
OPENVPN_THROW_EXCEPTION("need creds");
ClientAPI::ProvideCreds creds;
if (password.empty() && dynamicChallengeCookie.empty())
password = get_password("Password:");
creds.username = username;
creds.password = password;
creds.response = response;
creds.dynamicChallengeCookie = dynamicChallengeCookie;
creds.replacePasswordWithSessionID = true;
creds.cachePassword = cachePassword;
ClientAPI::Status creds_status = client.provide_creds(creds);
if (creds_status.error)
OPENVPN_THROW_EXCEPTION(
"creds error: " << creds_status.message);
}
// external PKI
if (!epki_cert_fn.empty()) {
client.epki_cert = read_text_utf8(epki_cert_fn);
if (!epki_ca_fn.empty())
client.epki_ca = read_text_utf8(epki_ca_fn);
#if defined(USE_MBEDTLS)
if (!epki_key_fn.empty()) {
const std::string epki_key_txt = read_text_utf8(epki_key_fn);
client.epki_ctx.parse(epki_key_txt, "EPKI", privateKeyPassword);
} else
OPENVPN_THROW_EXCEPTION("--epki-key must be specified");
#endif
}
#ifdef OPENVPN_REMOTE_OVERRIDE
client.set_remote_override_cmd(remote_override_cmd);
#endif
std::cout << "CONNECTING..." << std::endl;
// start the client thread
start_thread(client);
// Get dynamic challenge response
if (client.is_dynamic_challenge()) {
std::cout << "ENTER RESPONSE" << std::endl;
std::getline(std::cin, response);
if (!response.empty()) {
dynamicChallengeCookie = client.dynamic_challenge_cookie();
retry = true;
}
} else {
// print closing stats
client.print_stats();
}
}
} while (retry);
}
} else
throw usage();
} catch (const usage &) {
std::cout << "OpenVPN Client (ovpncli)" << std::endl;
std::cout
<< "usage: cli [options] <config-file> [extra-config-directives...]"
<< std::endl;
std::cout << "--version, -v : show version info" << std::endl;
std::cout << "--eval, -e : evaluate profile only (standalone)"
<< std::endl;
std::cout << "--merge, -m : merge profile into unified format "
"(standalone)"
<< std::endl;
std::cout << "--username, -u : username" << std::endl;
std::cout << "--password, -p : password" << std::endl;
std::cout << "--response, -r : static response" << std::endl;
std::cout << "--dc, -D : dynamic challenge/response cookie"
<< std::endl;
std::cout << "--proto, -P : protocol override (udp|tcp)"
<< std::endl;
std::cout << "--server, -s : server override" << std::endl;
std::cout << "--port, -R : port override" << std::endl;
#ifdef OPENVPN_REMOTE_OVERRIDE
std::cout << "--remote-override : command to run to generate next "
"remote (returning host,ip,port,proto)"
<< std::endl;
#endif
std::cout << "--ipv6, -6 : IPv6 (yes|no|default)" << std::endl;
std::cout << "--timeout, -t : timeout" << std::endl;
std::cout << "--compress, -c : compression mode (yes|no|asym)"
<< std::endl;
std::cout << "--pk-password, -z : private key password" << std::endl;
std::cout << "--tvm-override, -M : tls-version-min override (disabled, "
"default, tls_1_x)"
<< std::endl;
std::cout << "--tcprof-override, -X : tls-cert-profile override ("
<<
#ifdef OPENVPN_USE_TLS_MD5
"insecure, "
<<
#endif
"legacy, preferred, etc.)" << std::endl;
std::cout << "--proxy-host, -h : HTTP proxy hostname/IP" << std::endl;
std::cout << "--proxy-port, -q : HTTP proxy port" << std::endl;
std::cout << "--proxy-username, -U : HTTP proxy username" << std::endl;
std::cout << "--proxy-password, -W : HTTP proxy password" << std::endl;
std::cout << "--proxy-basic, -B : allow HTTP basic auth" << std::endl;
std::cout << "--alt-proxy, -A : enable alternative proxy module"
<< std::endl;
std::cout << "--dco, -d : enable data channel offload"
<< std::endl;
std::cout << "--cache-password, -C : cache password" << std::endl;
std::cout << "--no-cert, -x : disable client certificate"
<< std::endl;
std::cout
<< "--def-keydir, -k : default key direction ('bi', '0', or '1')"
<< std::endl;
std::cout << "--force-aes-cbc, -f : force AES-CBC ciphersuites"
<< std::endl;
std::cout << "--ssl-debug : SSL debug level" << std::endl;
std::cout << "--google-dns, -g : enable Google DNS fallback"
<< std::endl;
std::cout << "--auto-sess, -a : request autologin session"
<< std::endl;
std::cout << "--auth-retry, -Y : retry connection on auth failure"
<< std::endl;
std::cout
<< "--persist-tun, -j : keep TUN interface open across reconnects"
<< std::endl;
std::cout << "--wintun, -w : use WinTun instead of TAP-Windows6 "
"on Windows"
<< std::endl;
std::cout << "--peer-info, -I : peer info key/value list in the form "
"K1=V1,K2=V2,..."
<< std::endl;
std::cout << "--gremlin, -G : gremlin info (send_delay_ms, "
"recv_delay_ms, send_drop_prob, recv_drop_prob)"
<< std::endl;
std::cout << "--epki-ca : simulate external PKI cert "
"supporting intermediate/root certs"
<< std::endl;
std::cout << "--epki-cert : simulate external PKI cert"
<< std::endl;
std::cout << "--epki-key : simulate external PKI private key"
<< std::endl;
ret = 2;
}
return ret;
}
#ifndef OPENVPN_OVPNCLI_OMIT_MAIN
int main(int argc, char *argv[]) {
int ret = 0;
#ifdef OPENVPN_LOG_LOGBASE_H
LogBaseSimple log;
#endif
#if defined(OPENVPN_PLATFORM_WIN)
SetConsoleOutputCP(CP_UTF8);
#endif
try {
Client::init_process();
ret = openvpn_client(argc, argv, nullptr);
} catch (const std::exception &e) {
std::cout << "Main thread exception: " << e.what() << std::endl;
ret = 1;
}
Client::uninit_process();
return ret;
}
#endif
| [
"raboserg@gmail.com"
] | raboserg@gmail.com |
1c1e165d151d4d76b5edbfeda9ab1390a5de80ed | d3b28ec0645456bd076400f8d922c50a68f7bec1 | /Tasks/№20.cpp | 0633299d6b4fb22ca6968b18407a6906d1d13e2c | [] | no_license | musaelyan-arina/Zadachi | a6551ae18fc05996c2a9a7f5350013687a27b2e4 | 71054bcf0542119de7c5ea55c05a337da387f9b5 | refs/heads/master | 2020-12-13T09:31:46.110078 | 2020-01-26T15:01:23 | 2020-01-26T15:01:23 | 211,136,268 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,280 | cpp | ~~~c++
// 20.cpp : Этот фай+л содержит функцию "main". Здесь начинается и заканчивается выполнение программы.
//
#include <iostream>
#include <cstdlib>
using namespace std;
void bubble(int size, int a[]) {
for (int i = 0; i < size; i++) {
for (int j = 0; j < size-(i+1); j++) {
if (a[j] >a[j + 1]) {
swap(a[j], a[j + 1]);
}//меняем местами значения переменных в массиве
}
}
}// сортировка "пузырек"
void print(int a[], int size)
{
for (int i = 0; i < size; i++)
{
cout << a[i] << " ";
}
}
int main() {
setlocale(LC_ALL, "rus");
int size;
cout << "Введите размер массива: " << endl;
cin >> size;
int* a = new int[size];//выделение памяти под массив
```
cout << "Введите числа для заполнения массива: " << endl;
for (int i = 0; i < size; i++) {
cin >> a[i]; // вводим элементы
}
bubble(size, a);//вызов функции
cout << "Массив в отсортированном виде: ";
print(a, size);
delete[] a;//освоюождение памяти
return 0;
```
}
~~~
| [
"noreply@github.com"
] | noreply@github.com |
9e7c72295830fea30357a7fa263227d1806d6635 | 499f6f039f7770118f68f3bee07e26c7522fb431 | /Extras/C++/Basics/Basics3.cpp | 86c332a9c14557f24636b7b2238d19d1f958ec62 | [] | no_license | Lhayes32/School-Dayz | a67fb3fd8ca29ba04698c969f4cf4099cfc76e5c | c73b57664f6d21c9af7eb1ca3473cd0ce6e2b237 | refs/heads/master | 2023-06-13T08:42:30.956903 | 2021-07-11T03:58:38 | 2021-07-11T03:58:38 | 314,426,758 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 502 | cpp | #include <iostream>
using namespace std;
int main() {
int fn, sn;
char op;
cout << "Enter first number: ";
cin >> fn;
cout << "Enter second number: ";
cin >> sn;
cout << "Enter the operator to apply: ";
cin >> op;
switch (op) {
case '+':
cout << fn + sn << endl;
break;
case '-':
cout << fn - sn << endl;
break;
case '*':
cout << fn * sn << endl;
break;
case '/':
cout << fn / sn << endl;
break;
case '%':
cout << fn % sn << endl;
break;
default:
break;
}
} | [
"lhnetwork542@gmail.com"
] | lhnetwork542@gmail.com |
88ef6e8a537542c0c7cdab75d86888be53634da3 | 3597f2d3e4aa06d2497514664810f94ea6a1b853 | /chap3_libraryTypes/exe3.7.cpp | e8b2afe438763eb188244e48a50f8c6f23ee248f | [] | no_license | shubham-chandra/Cplusplus | ea2b88ab350ae2c88d27654cf2f714e69dab210b | ccdcde46386c9d32192d571900899b44f0ac98bf | refs/heads/master | 2022-12-15T18:29:59.866401 | 2020-09-20T17:03:36 | 2020-09-20T17:03:36 | 291,029,396 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 941 | cpp | #include <iostream>
#include <string>
using std::string;
using std::cin;
using std::cout;
using std::endl;
/*
Read two string and compare them and their lengths and report them.
*/
int main(){
string s1;
string s2;
cin >> s1 >> s2;
if(s1 > s2){
cout << "The string " << s1 << " is greater than " << s2 << endl;
}
else if(s2 > s1){
cout << "The string " << s2 << " is greater than " << s1 << endl;
}
else{
cout << "The string " << s1 << " and string " << s2 << "are equal." << endl;
}
cout << "In terms of length :" << endl;
string::size_type s1_len;
string::size_type s2_len;
s1_len = s1.size();
s2_len = s2.size();
if(s1_len > s2_len){
cout << "The string " << s1 << " is greater than " << s2 << endl;
}
else if(s2_len > s1_len){
cout << "The string " << s2 << " is greater than " << s1 << endl;
}
else{
cout << "The string " << s1 << " and string " << s2 << " are equal." << endl;
}
return 0;
} | [
"shubhamchandra317@gmail.com"
] | shubhamchandra317@gmail.com |
909872451f2a47a6313de168e88ce431cf10ba1c | 975e8dd45368c8ce95c4c020845c64564bebb1cb | /FMSSteering/src/Steering/SteeringFactory.cpp | 43293180b2ac73264d0700cb6238fd85504f4937 | [] | no_license | Bifido/IAProgramming | 8706d8f70ade16138fe16de1bba4c478791cb5e2 | 368e541244497e29c09d052a9bb7feaef12afd99 | refs/heads/master | 2021-01-10T22:28:29.601992 | 2015-11-15T21:40:57 | 2015-11-15T21:40:57 | 33,869,900 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 780 | cpp | #include "Steering\SteeringFactory.h"
#include "Steering\Seek.h"
#include "Steering\Evade.h"
#include "Steering\Arrive.h"
#include "Steering\Pursue.h"
#include "Steering\Wander.h"
Steering* SteeringFactory::BuildSteering(SteeringType _steeringType)
{
switch (_steeringType)
{
case Seek:
return new ::Seek("SeekTarget");
break;
case Evade:
return new ::Evade("EvadeTarget");
break;
case Arrive:
return new ::Arrive("ArriveTarget");
break;
case Pursue:
return new ::Pursue("PusueTarget");
break;
case Wander:
return new ::Wander("Wandering");
break;
default:
break;
}
}
void SteeringFactory::ReleaseSteering(Steering*& _steeringToRelease)
{
if (_steeringToRelease != nullptr)
{
delete _steeringToRelease;
}
_steeringToRelease = nullptr;
} | [
"ricky.stucchi@gmail.com"
] | ricky.stucchi@gmail.com |
79fbd9f90d05d7d21cd3577e5f8139ab117f9aac | c8cf973af91404a716d08d6ac12f6cc8601421d4 | /2181/5627448_AC_79MS_696K.cpp | 3174e8d2b73d22f7699afa35e006be7b48a5e81c | [
"MIT"
] | permissive | Xuhui-Wang/poj-solutions | f1cd7009fcc37672d3a2ca81851ac3b3cc64ca02 | 4895764ab800e8c2c4b2334a562dec2f07fa243e | refs/heads/master | 2021-05-05T00:14:35.384333 | 2015-08-19T21:57:31 | 2015-08-19T21:57:31 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 511 | cpp | #include<cstdio>
const int POTION_NUM_MAX=150000;
int strength[POTION_NUM_MAX+1];
int main(){
int potionNum;
scanf("%d",&potionNum);
for(int i=0;i<potionNum;i++)
scanf("%d",strength+i);
strength[potionNum]=0;
int sign=1,sum=0;
for(int i=0;i<potionNum;i++)
if(sign==1){
if(strength[i+1]<strength[i]){
sum+=strength[i];
sign=-sign;
}
}
else{
if(strength[i+1]>strength[i]){
sum-=strength[i];
sign=-sign;
}
}
printf("%d\n",sum);
return 0;
} | [
"pinepara@gmail.com"
] | pinepara@gmail.com |
896d9d382809fafb5b89ceb60e58ccbf83ba3ef3 | 019e68497ab9bf864b0c96bd4fd4fbba4e0d9b29 | /src/Background/Backgrounds.h | 7cfecec8306a4a96c54ab002b03225057a90894c | [] | no_license | erik65536/ClockPlus | f27562f80a7b9662ba8cf77b392dc9dcfcfb2b62 | 3a40edef0f3b7ea8e228c75744db63c8f5ff013a | refs/heads/master | 2020-12-30T10:37:34.899022 | 2017-07-31T08:03:09 | 2017-07-31T08:03:09 | 97,165,379 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,334 | h | #pragma once
#include "Period.h"
#include "Background.h"
#include "Filter.h"
#include <unordered_set>
#include <map>
namespace ClockPlus::Background {
class Backgrounds {
public:
using Id = std::string;
using IdVec = std::vector<Id>;
using IdSet = std::unordered_set<Id>;
using BackgroundVec = std::vector<Background>;
using FilterMap = std::multimap<Filter::Priority, Filter, std::greater<>>;
using FilterMapIt = FilterMap::const_iterator;
public:
Period::Minutes getPeriod() const noexcept;
void setPeriod(Period::Minutes minutes) noexcept;
std::tuple<Background&, size_t> addBackground(const Id& id);
const BackgroundVec& getBackgrounds() const noexcept;
Filter& addFilter(Filter::Priority priority);
void clear();
bool match(const DateTimeProvider& date, std::string& message, IdVec& ids) const;
private:
std::tuple<FilterMapIt, bool> matchPriority(
const DateTimeProvider& date,
FilterMapIt iterator,
FilterMapIt end,
std::string& message,
IdSet& matches) const;
bool matchFilter(
const DateTimeProvider& date,
const Filter& filter,
std::string& message,
IdSet& matches) const;
static bool equalSet(const IdSet& set1, const IdVec& set2);
private:
Period m_period;
BackgroundVec m_backgrounds;
FilterMap m_filters;
};
} | [
"erik65536@gmail.com"
] | erik65536@gmail.com |
dadb4361093cec55a84efb4ac66603c44f296335 | 51fe9b47359afdb3ca776a196c59ec06d119a5f4 | /74. Search a 2D Matrix/74. Search a 2D Matrix.cpp | e4aa92497ecd565b3fec40fb13f3f4d3116a31a2 | [] | no_license | YanLi26/leetcode | 4ef039641c122137948615cc5fa5d7faad5c249f | c46e331bbd29f9b831ccbfe9b1e976ca9369b081 | refs/heads/master | 2021-01-18T17:38:46.787222 | 2017-05-03T17:53:33 | 2017-05-03T17:53:33 | 71,950,928 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 806 | cpp | class Solution {
public:
bool searchMatrix(vector<vector<int>>& matrix, int target) {
if(matrix.empty() || matrix[0].empty()) return false;
for(int i = 0; i < matrix.size(); i++) {
if(target == matrix[i][0]) return true;
else if((i < matrix.size()-1 && target > matrix[i][0] && target < matrix[i+1][0])
|| i == matrix.size()-1) {
int left = 0, right = matrix[i].size()-1;
while(left <= right) {
int mid = (left + right)/2;
if(target > matrix[i][mid]) left = mid + 1;
else if (target < matrix[i][mid]) right = mid - 1;
else return true;
}
return false;
}
}
return false;
}
}; | [
"yali2241@colorado.edu"
] | yali2241@colorado.edu |
13348092d46fb58b3ccfeaf1146a07b45911ba02 | 6de9dc1cd719893d12bc3e5bbe3c5419667bec7e | /LinkedList/LeetCode 142. Linked List Cycle II(solve1).cpp | df346b0f85fc765ddfe51ee4c32d1ec7c43366ba | [] | no_license | ideask/CodeTraining | 1208192fa1ecc9967e869cac19b9d3df40d25002 | 030e2a975ceb9fb675b064ae92f367d08fab9d00 | refs/heads/master | 2020-06-16T14:15:54.627148 | 2019-10-11T16:05:53 | 2019-10-11T16:05:53 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 739 | cpp | #include <iostream>
#include <set>
using namespace std;
struct LinkNode{
int val;
LinkNode *next;
LinkNode(int x): val(x), next(NULL){};
};
class solution{
public:
LinkNode *detectCycle(LinkNode *head){
set<LinkNode *>LinkSet;
while(head){
if(LinkSet.find(head) != LinkSet.end()){
return head;
}
LinkSet.insert(head);
head = head->next;
}
return NULL;
}
};
int main(){
LinkNode a(1);
LinkNode b(2);
LinkNode c(3);
LinkNode d(4);
LinkNode e(5);
LinkNode f(6);
a.next = &b;
b.next = &c;
c.next = &d;
d.next = &e;
e.next = &f;
f.next = &c;
solution solve;
LinkNode *node = solve.detectCycle(&a);
if (node){
printf("%d\n", node->val);
}
else{
printf("NULL\n");
}
return 0;
}
| [
"9982733@qq.com"
] | 9982733@qq.com |
e3cd5bafc0a735b5221a62f63e6a5c0f80dcffe3 | d2bd6ef3114504ac8e3ab87e585e08ed7c2f3bad | /7-Draw/TextFigure.h | e3806577d52b11969ceab133292d2687d4b93f9b | [] | no_license | lgwest/mfc2qt | 95a28070cd706b320eec831bc864c448ddd1ba34 | ad561ebdf9ec25f55a7ccea77870c6d680b9bc6e | refs/heads/master | 2023-07-11T18:46:05.431557 | 2021-08-30T11:42:24 | 2021-08-30T11:42:24 | 262,108,430 | 2 | 2 | null | null | null | null | UTF-8 | C++ | false | false | 1,297 | h | typedef CArray<int> IntArray;
enum KeyboardState {KS_INSERT, KS_OVERWRITE};
class TextFigure: public Figure
{
public:
TextFigure();
TextFigure(const Color& color, const CPoint& ptMouse,
const Font& font, CDC* pDC);
TextFigure(const TextFigure& text);
Figure* Copy() const;
void Serialize(CArchive& archive);
BOOL Click(const CPoint& ptMouse);
BOOL DoubleClick(const CPoint& ptMouse);
BOOL Inside(const CRect& rcInside) const;
void MoveOrModify(const CSize& szDistance);
void Move(const CSize& szDistance);
BOOL KeyDown(UINT uChar, CDC* pDC);
void CharDown(UINT uChar, CDC* pDC,
KeyboardState eKeyboardState);
void SetPreviousText(CDC* pDC);
void Draw(CDC* pDC) const;
CRect GetArea() const;
Font* GetFont() {return &m_font;}
void SetFont(const Font& font, CDC* pDC);
private:
void GenerateCaretArray(CDC* pDC);
public:
CRect GetCaretArea(KeyboardState eKeyboardState);
HCURSOR GetCursor() const;
private:
enum {CREATE_TEXT, MOVE_TEXT, EDIT_TEXT, NONE_TEXT}
m_eDragMode;
CPoint m_ptText;
CSize m_szText;
CString m_stText, m_stPreviousText;
int m_iAverageWidth;
Font m_font;
int m_iEditIndex;
IntArray m_caretArray;
};
| [
"lars-gunnar.west@saabgroup.com"
] | lars-gunnar.west@saabgroup.com |
fc04a4f875c140f276c7248d2e41f339d2f3b6e6 | 67b170ffb345a63403ff5dc66130eaa24bfaf161 | /include/ANurbs/Algorithm/PolygonIntegrationPoints.h | 10cf61bf774d979679161cfd814bc5216063c40b | [
"MIT"
] | permissive | deepblueparticle/ANurbs | eecc9cb51ed6325a1af29bfa993196b7bc2c308d | 3fd34f5c74f96cc50d1d6db53d39ac08b88bd1ba | refs/heads/master | 2020-08-20T21:47:44.435441 | 2019-10-18T14:47:17 | 2019-10-18T14:47:17 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,197 | h | #pragma once
#include "../Define.h"
#include "IntegrationPoints.h"
#include "PolygonTessellation.h"
#include "../Geometry/Interval.h"
#include "../Geometry/Polygon.h"
#include <stdexcept>
#include <vector>
namespace ANurbs {
class PolygonIntegrationPoints
{
public: // static methods
static IntegrationPointList<2> get(const Index degree, const Polygon& polygon)
{
using Vector2d = linear_algebra::Vector<2>;
IntegrationPointList<2> integration_points;
PolygonTessellation tessellation;
tessellation.compute(polygon);
const auto& xiao_gimbutas = IntegrationPoints::xiao_gimbutas(degree);
const Index nb_integration_points = tessellation.nb_triangles() *
static_cast<Index>(xiao_gimbutas.size());
integration_points.resize(nb_integration_points);
Index j = 0;
for (Index i = 0; i < tessellation.nb_triangles(); i++) {
const auto [a, b, c] = tessellation.triangle(i);
const Vector2d vertex_a = polygon.vertex(a);
const Vector2d vertex_b = polygon.vertex(b);
const Vector2d vertex_c = polygon.vertex(c);
const Vector2d ab = vertex_b - vertex_a;
const Vector2d ac = vertex_c - vertex_a;
const double area = 0.5 * norm(cross(ab, ac));
for (const auto& norm_point : xiao_gimbutas) {
const auto uv = vertex_a * std::get<0>(norm_point) +
vertex_b * std::get<1>(norm_point) +
vertex_c * std::get<2>(norm_point);
integration_points[j++] = IntegrationPoint<2>(uv[0], uv[1],
area * std::get<3>(norm_point));
}
}
return integration_points;
}
public: // python
static void register_python(pybind11::module& m)
{
using namespace pybind11::literals;
namespace py = pybind11;
using Type = PolygonIntegrationPoints;
m.def("integration_points", [](const Index degree, const Polygon& polygon)
{ return Type::get(degree, polygon); }, "degree"_a, "polygon"_a);
}
};
} // namespace ANurbs
| [
"thomas.oberbichler@gmail.com"
] | thomas.oberbichler@gmail.com |
e055fc0fb4a411402af9eaff33767af14ea0383b | b04e71b13e659929815c64282e1a56928e2b355b | /Black/first_week/part_H/routes_database.h | 899f10210402ea8c6b4dfcca2987fc44aa27025c | [] | no_license | momsspaghettti/coursera-c-plus-plus-modern-development | 98f0ef39dcec90cc96b3178d1fec492fe87be1c7 | f38464dc422e2e6891972dff5a0e576d7a41bc9f | refs/heads/master | 2020-05-26T03:00:58.262528 | 2019-11-06T18:51:04 | 2019-11-06T18:51:04 | 188,082,349 | 86 | 70 | null | null | null | null | UTF-8 | C++ | false | false | 2,872 | h | #pragma once
#include "stops_database.h"
#include <vector>
#include <optional>
#include <utility>
#include <unordered_map>
#include <unordered_set>
#include <memory>
#include <cstdint>
#include "navigation_database.h"
#include <set>
struct RouteStats
{
RouteStats()
{
stops_on_route = unique_stops = 0;
route_length = 0;
direct_distance = curvature = 0;
}
int stops_on_route;
int unique_stops;
uint64_t route_length;
double direct_distance;
double curvature;
};
class IRouteInfo
{
public:
IRouteInfo()
{
stops_.reserve(100);
route_stats_ = RouteStats();
}
void AddStop(const std::string& stop);
void Build(const std::shared_ptr<BusStopsDataBase>& stops_database,
const std::shared_ptr<NavigationDataBase>&, const std::string& route_name);
virtual void RecomputeStatsInChildClass(const std::shared_ptr<BusStopsDataBase>&,
const std::shared_ptr<NavigationDataBase>&, const std::string&) = 0;
[[nodiscard]] const RouteStats& GetRouteStats() const;
virtual const std::vector<std::string>& GetStops() const = 0;
virtual std::vector<std::string> GetEndStops() const = 0;
virtual ~IRouteInfo() = default;
private:
RouteStats route_stats_;
std::vector<std::string> stops_;
std::unordered_set<std::string> unique_stops_;
friend class DirectRoute;
friend class RoundRoute;
};
class DirectRoute : public IRouteInfo
{
public:
void RecomputeStatsInChildClass(const std::shared_ptr<BusStopsDataBase>&,
const std::shared_ptr<NavigationDataBase>&, const std::string&) override;
const std::vector<std::string>& GetStops() const override;
std::vector<std::string> GetEndStops() const override;
private:
std::vector<std::string> all_stops_;
};
class RoundRoute : public IRouteInfo
{
public:
void RecomputeStatsInChildClass(const std::shared_ptr<BusStopsDataBase>&,
const std::shared_ptr<NavigationDataBase>&, const std::string&) override;
const std::vector<std::string>& GetStops() const override;
std::vector<std::string> GetEndStops() const override;
};
class RoutesDataBase
{
public:
RoutesDataBase()
{
routes_.reserve(2000);
}
void AddRoute(const std::string& bus_name, const std::shared_ptr<IRouteInfo>&);
using RouteResponse = std::pair<std::string,
std::optional<RouteStats>>;
void BuildAllRoutes(
const std::shared_ptr<BusStopsDataBase>& stops_database, const std::shared_ptr<NavigationDataBase>&);
[[nodiscard]] RouteResponse GetRouteStats(const std::string& bus) const;
[[nodiscard]] const std::set<std::string>& GetRouteNames() const {
return route_names_;
}
[[nodiscard]] const std::shared_ptr<IRouteInfo>& GetRouteInfo(const std::string& name) const {
return routes_.at(name);
}
private:
std::unordered_map<std::string,
std::shared_ptr<IRouteInfo>> routes_;
std::set<std::string> route_names_;
}; | [
"ivan.samoilov.1999@yandex.ru"
] | ivan.samoilov.1999@yandex.ru |
b0fd7a4c77c20c7c0a62ad2fe90c152c8dc26b3a | 0675bbde0d712eb537a73e314c3c602924edc03b | /main.cpp | 6e62768f50debdde18e2a027e39614d674cc514c | [] | no_license | BluOcean/Critical_path | bfe4b9a38a9b8efc6feed966918ae0f8148d5404 | 220921d49799f2b09c2a0757c848f00ab5439825 | refs/heads/master | 2020-03-20T21:02:37.161007 | 2018-06-19T09:29:55 | 2018-06-19T09:29:55 | 137,720,542 | 0 | 0 | null | null | null | null | GB18030 | C++ | false | false | 349 | cpp | #include "TopologicalSort.h"
stack<int> s;
stack<int> t;
int ve[MAX_VERTEX_NUM];
int main()
{
ALGraph G;
BuildALGraph(G);
printALGraph(G); //打印邻接表
if(CriticalPath(G)){
cout<<'\n'<<"关键路径输出成功"<<endl;
}
else{
cout<<'\n'<<"关键路径输出失败"<<endl;
}
return 0;
}
| [
"1799232844@qq.com"
] | 1799232844@qq.com |
8559d6d96e60abd6687d335b219ae383f6ac4a7b | a2c55e0ad2d5576cf0eb2881b031143b6110eee5 | /chm/CoreDebug.cpp | fe9145b84da92f8937972668f0236021d7f87e85 | [] | no_license | michalk-git/chm | a50485f2df68f6a1f743d657fa1fa905695381b3 | 959e99d577d9e407f6a3f9663427105155583962 | refs/heads/master | 2022-11-27T06:23:29.059389 | 2019-12-12T08:30:20 | 2019-12-12T08:30:20 | 226,061,102 | 0 | 1 | null | 2022-10-21T17:13:11 | 2019-12-05T09:10:55 | C++ | UTF-8 | C++ | false | false | 25 | cpp | #include "CoreDebug.h"
| [
"MICHALKAL@D-2-235-STUD-WW"
] | MICHALKAL@D-2-235-STUD-WW |
03b63c8478b673ac0f379e85c3b83fcb1e7305fa | a13a4dfcf577632bee9bfbc430ce469c1afe6652 | /libraries/ros_lib/stdr_msgs/DeleteRobotResult.h | 5dd62658c370987ab1a95d0c7de44695c80ff626 | [] | no_license | kirancps/ROS_Arduino | 5cb8abeea6f87c2a8fa332ea9ebedc325ae5a0fb | 537b45aa9c200e8f5be9a8f4625e045c6a7a8509 | refs/heads/master | 2021-01-10T18:52:58.914367 | 2016-04-17T11:23:07 | 2016-04-17T11:23:07 | 56,432,459 | 2 | 4 | null | null | null | null | UTF-8 | C++ | false | false | 1,180 | h | #ifndef _ROS_stdr_msgs_DeleteRobotResult_h
#define _ROS_stdr_msgs_DeleteRobotResult_h
#include <stdint.h>
#include <string.h>
#include <stdlib.h>
#include "ros/msg.h"
namespace stdr_msgs
{
class DeleteRobotResult : public ros::Msg
{
public:
bool success;
DeleteRobotResult():
success(0)
{
}
virtual int serialize(unsigned char *outbuffer) const
{
int offset = 0;
union {
bool real;
uint8_t base;
} u_success;
u_success.real = this->success;
*(outbuffer + offset + 0) = (u_success.base >> (8 * 0)) & 0xFF;
offset += sizeof(this->success);
return offset;
}
virtual int deserialize(unsigned char *inbuffer)
{
int offset = 0;
union {
bool real;
uint8_t base;
} u_success;
u_success.base = 0;
u_success.base |= ((uint8_t) (*(inbuffer + offset + 0))) << (8 * 0);
this->success = u_success.real;
offset += sizeof(this->success);
return offset;
}
const char * getType(){ return "stdr_msgs/DeleteRobotResult"; };
const char * getMD5(){ return "358e233cde0c8a8bcfea4ce193f8fc15"; };
};
}
#endif | [
"scikiran@gmail.com"
] | scikiran@gmail.com |
23c14ddf70085e3ba59b61a71ecca5201afffad0 | 9ff69f2638fe679b9fbb3ac682d356b59c50b068 | /code archive/CF/1041D.cpp | 463b2de96cf6f18d72f5f07f28f44f08fa92bc24 | [
"MIT"
] | permissive | brianbbsu/program | 7f7c3d4aacea32ada7f74cf5caffa9931be280c4 | c4505f2b8c0b91010e157db914a63c49638516bc | refs/heads/master | 2021-05-23T04:53:49.618057 | 2020-04-18T15:21:10 | 2020-04-18T15:21:10 | 81,056,684 | 4 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 2,014 | cpp | //{
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double lf;
typedef pair<ll,ll> ii;
#define REP(i,n) for(ll i=0;i<n;i++)
#define REP1(i,n) for(ll i=1;i<=n;i++)
#define FILL(i,n) memset(i,n,sizeof i)
#define X first
#define Y second
#define SZ(_a) (int)_a.size()
#define ALL(_a) _a.begin(),_a.end()
#define pb push_back
#ifdef brian
#define debug(...) do{\
fprintf(stderr,"%s - %d (%s) = ",__PRETTY_FUNCTION__,__LINE__,#__VA_ARGS__);\
_do(__VA_ARGS__);\
}while(0)
template<typename T>void _do(T &&_x){cerr<<_x<<endl;}
template<typename T,typename ...S> void _do(T &&_x,S &&..._t){cerr<<_x<<" ,";_do(_t...);}
template<typename _a,typename _b> ostream& operator << (ostream &_s,const pair<_a,_b> &_p){return _s<<"("<<_p.X<<","<<_p.Y<<")";}
template<typename It> ostream& _OUTC(ostream &_s,It _ita,It _itb)
{
_s<<"{";
for(It _it=_ita;_it!=_itb;_it++)
{
_s<<(_it==_ita?"":",")<<*_it;
}
_s<<"}";
return _s;
}
template<typename _a> ostream &operator << (ostream &_s,vector<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a> ostream &operator << (ostream &_s,set<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a,typename _b> ostream &operator << (ostream &_s,map<_a,_b> &_c){return _OUTC(_s,ALL(_c));}
template<typename _t> void pary(_t _a,_t _b){_OUTC(cerr,_a,_b);cerr<<endl;}
#define IOS()
#else
#define debug(...)
#define pary(...)
#define endl '\n'
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0);
#endif // brian
//}
const ll MAXn=2e5+5,MAXlg=__lg(MAXn)+2;
const ll MOD=1000000007;
const ll INF=ll(1e15);
ll l[MAXn],r[MAXn];
int main()
{
IOS();
ll n,h;
cin>>n>>h;
REP(i,n)cin>>l[i]>>r[i];
ll mx = 0,tt = 0,it = 0;
REP(i,n)
{
while(1)
{
if(l[i] + h - 1 + tt < l[it] || it == n)break;
else
{
tt += r[it] - l[it];
it++;
}
}
mx=max(mx,tt + h);
debug(i,it,tt,mx);
tt -= r[i] - l[i];
}
cout<<mx<<endl;
}
| [
"brianbb.su@gmail.com"
] | brianbb.su@gmail.com |
d68d5576eb43ab9416dbe7b4c9463d40fb343aad | 0f1294e9b340a1114d92f1f88b5f35fe60a8e29c | /src/utils/File.cpp | 89d1b7fe4c0433eb06e5988fc20bf0757d7b9253 | [] | no_license | XzekyeX/War-of-the-Kings | 9768485994da8b56c1457b2ca40651bbf7041157 | 0874656ee23f8dae9ea1788aa136329e3bced05c | refs/heads/master | 2020-04-08T01:02:33.744209 | 2018-11-23T21:16:40 | 2018-11-23T21:16:40 | 158,878,758 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,181 | cpp | #include "File.h"
/**
*
* @author Mikko Tekoniemi
*
*/
FileShader File::loadShaders(const char* path) {
std::ifstream file(path);
std::string line;
std::stringstream result[2];
int type = -1;
while(getline(file, line)) {
if(line.find("#shader") != std::string::npos) {
if(line.find("vertex") != std::string::npos) {
type = 0;
} else if(line.find("fragment") != std::string::npos) {
type = 1;
} else {
type = -1;
}
} else {
if(type >= 0) result[type] << line << "\n";
else std::cout << "Failed to read shader file!" << std::endl;
}
}
return{result[0].str(),result[1].str()};
}
std::string File::readFile(const char * path) {
FILE* file;
fopen_s(&file, path, "rt");
fseek(file, 0, SEEK_END);
unsigned long length = ftell(file);
char* data = new char[length + 1];
memset(data, 0, length + 1);
fseek(file, 0, SEEK_SET);
fread(data, 1, length, file);
fclose(file);
std::string result(data);
delete[] data;
return result;
}
std::string File::loadShader(const char* path) {
std::ifstream file(path);
std::string line;
std::stringstream result;
while(getline(file, line)) {
result << line << '\n';
}
return result.str();
}
| [
"Zekye@live.fi"
] | Zekye@live.fi |
09405691456fa09637651f12a5cf71a4125f6843 | 9f05f2253da8a773688ebb74b1c17289e3846944 | /include/adt/containers/adt_constraint_list.hpp | 69833ced2b81cb906a905f6bf2c2a8ceae8ecb77 | [] | no_license | afcarl/adt_opt | 0169de5e4650feee4d0a3500cc0a40896f9b5be9 | d51c087609536f247bd331700679ab1354dd0b3a | refs/heads/master | 2020-03-18T14:59:07.373828 | 2018-03-21T21:41:13 | 2018-03-21T21:41:13 | 134,879,434 | 1 | 0 | null | 2018-05-25T16:17:40 | 2018-05-25T16:17:40 | null | UTF-8 | C++ | false | false | 581 | hpp | #ifndef ADT_CONSTRAINT_LIST_H
#define ADT_CONSTRAINT_LIST_H
#include <adt/hard_constraints/adt_constraint_main.hpp>
#include <vector>
#include <string>
class Constraint_List{
public:
Constraint_List();
~Constraint_List();
void append_constraint(Constraint_Function* constraint);
void get_constraint_list_copy(std::vector<Constraint_Function*>& constraint_list_out);
int get_size();
int get_num_constraint_funcs();
Constraint_Function* get_constraint(int index);
private:
std::vector<Constraint_Function*> constraint_list;
int num_constraint_funcs = 0;
};
#endif | [
"stevenjensj@gmail.com"
] | stevenjensj@gmail.com |
40cc14819d01b2c4a464ff2a0328f92c4b1cf203 | 547018e2fb9b178aacfe2ceabcab4313647ffb79 | /test_cases/general/array/of/embed/cpp/test_generate/jsoncpp.cpp | 2d15e2128056fa28b21624c88f280743462ca614 | [
"MIT"
] | permissive | Parquery/mapry | 2eb22862494342f71ca4254e7b2b53df84bd666f | 93515307f9eba8447fe64b0ac7cc68b2d07205a7 | refs/heads/master | 2021-06-11T09:57:17.764387 | 2021-06-02T14:19:52 | 2021-06-02T14:19:52 | 165,482,780 | 11 | 3 | MIT | 2021-06-02T14:19:53 | 2019-01-13T08:31:08 | C++ | UTF-8 | C++ | false | false | 4,327 | cpp | // File automatically generated by mapry. DO NOT EDIT OR APPEND!
#include "jsoncpp.h"
#include "parse.h"
#include "types.h"
#include <cstring>
#include <memory>
#include <sstream>
#include <stdexcept>
#include <string>
#include <utility>
namespace some {
namespace graph {
namespace jsoncpp {
/**
* generates an error message.
*
* @param cc char array as the description part of the message
* @param cc_size size of the char array
* @param s string as the detail part of the message
* @return concatenated string
*/
std::string message(const char* cc, size_t cc_size, std::string s) {
std::string result;
result.reserve(cc_size + s.size());
result.append(cc, cc_size);
result.append(s);
return result;
}
/**
* converts a JSON value type to a human-readable string representation.
*
* @param value_type to be converted
* @return string representation of the JSON value type
*/
std::string value_type_to_string(Json::ValueType value_type) {
switch (value_type) {
case Json::ValueType::nullValue: return "null";
case Json::ValueType::intValue: return "int";
case Json::ValueType::uintValue: return "uint";
case Json::ValueType::realValue: return "real";
case Json::ValueType::stringValue: return "string";
case Json::ValueType::booleanValue: return "bool";
case Json::ValueType::arrayValue: return "array";
case Json::ValueType::objectValue: return "object";
default:
std::stringstream ss;
ss << "Unhandled value type in value_to_string: "
<< value_type;
throw std::domain_error(ss.str());
}
}
void some_graph_from(
const Json::Value& value,
std::string ref,
SomeGraph* target,
parse::Errors* errors) {
if (errors == nullptr) {
throw std::invalid_argument("Unexpected null errors");
}
if (!errors->empty()) {
throw std::invalid_argument("Unexpected non-empty errors");
}
if (!value.isObject()) {
constexpr auto expected_but_got(
"Expected an object, but got: ");
errors->add(
ref,
message(
expected_but_got,
strlen(expected_but_got),
value_type_to_string(
value.type())));
return;
}
////
// Parse array_of_embeds
////
if (!value.isMember("array_of_embeds")) {
errors->add(
ref,
"Property is missing: array_of_embeds");
} else {
const Json::Value& value_0 = value["array_of_embeds"];
if (!value_0.isArray()) {
constexpr auto expected_but_got(
"Expected an array, but got: ");
errors->add(
std::string(ref)
.append("/array_of_embeds"),
message(
expected_but_got,
strlen(expected_but_got),
value_type_to_string(
value_0.type())));
} else {
std::vector<Empty>& target_0 = target->array_of_embeds;
target_0.resize(value_0.size());
size_t i_0 = 0;
for (const Json::Value& item_0 : value_0) {
empty_from(
item_0,
std::string(ref)
.append("/array_of_embeds")
.append("/")
.append(std::to_string(i_0)),
&target_0.at(i_0),
errors);
++i_0;
if (errors->full()) {
break;
}
}
}
}
if (errors->full()) {
return;
}
}
void empty_from(
const Json::Value& value,
std::string ref,
Empty* target,
parse::Errors* errors) {
if (!value.isObject()) {
constexpr auto expected_but_got(
"Expected an object, but got: ");
errors->add(
ref,
message(
expected_but_got,
strlen(expected_but_got),
value_type_to_string(
value.type())));
return;
}
}
Json::Value serialize_empty(
const Empty& empty) {
return Json::objectValue;
}
Json::Value serialize_some_graph(
const SomeGraph& some_graph) {
Json::Value some_graph_as_value;
Json::Value target_0(Json::arrayValue);
const auto& vector_0 = some_graph.array_of_embeds;
for (int i_0 = 0;
i_0 < vector_0.size();
++i_0) {
target_0[i_0] = serialize_empty(vector_0[i_0]);
}
some_graph_as_value["array_of_embeds"] = std::move(target_0);
return some_graph_as_value;
}
} // namespace jsoncpp
} // namespace graph
} // namespace some
// File automatically generated by mapry. DO NOT EDIT OR APPEND!
| [
"noreply@github.com"
] | noreply@github.com |
0e0e89c2cea867e6a7d6a9f25e8a0b21a48140d5 | be3167504c0e32d7708e7d13725c2dbc9232f2cb | /mame/src/emu/cpu/m68000/68340dma.h | 5c085d094962f8cb36aa1d553ddcac4ae493274d | [] | no_license | sysfce2/MAME-Plus-Plus-Kaillera | 83b52085dda65045d9f5e8a0b6f3977d75179e78 | 9692743849af5a808e217470abc46e813c9068a5 | refs/heads/master | 2023-08-10T06:12:47.451039 | 2016-08-01T09:44:21 | 2016-08-01T09:44:21 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 146 | h |
READ32_HANDLER( m68340_internal_dma_r );
WRITE32_HANDLER( m68340_internal_dma_w );
class m68340_dma
{
public:
void reset(void);
};
| [
"mameppk@199a702f-54f1-4ac0-8451-560dfe28270b"
] | mameppk@199a702f-54f1-4ac0-8451-560dfe28270b |
41926dbeea5d592ef3f611dbaf66e14f58079702 | 38de511cee50503e4aad809aeb6211470bfba63d | /Linked List 1/Delete node.cpp | d19ee2b76ae6e9975a8144537b71287f159d90a3 | [] | no_license | Ir0Nick/Coding-Ninjas | 9dcef94418b38bdc75b23ce0a9a7c70f6b439a43 | 24a952d2393337be35f306576b9e35ce480a68e9 | refs/heads/master | 2022-10-27T05:27:03.876427 | 2020-06-13T05:44:18 | 2020-06-13T05:44:18 | 271,807,541 | 2 | 2 | null | null | null | null | UTF-8 | C++ | false | false | 476 | cpp | #include<iostream>
using namespace std;
/**********
* Following is the Node class that is already written.
class Node{
public:
int data;
Node *next;
Node(int data){
this -> data = data;
this -> next = NULL;
}
};
*********/
Node* deleteNode(Node *head, int i) {
Node *t=head,*prev=NULL;
int in=0;
while(head!=NULL&&i!=in)
{ prev=head;
head=head->next;
in++;
}
if(in==i&&head!=NULL)
prev->next=head->next;
return t;
}
| [
"noreply@github.com"
] | noreply@github.com |
e8a8d84709d51fbf155743a0a5d2a01da32272f1 | ef9b143b7fb9829c635be7b42598a06ab51806d5 | /mugunghwa/Library/Il2cppBuildCache/Android/armeabi-v7a/il2cppOutput/UnityEngine.AudioModule.cpp | 178787774237c03c3a5bbfb39a5d9af8b7f1c3c8 | [] | no_license | leejaepyeong/Mugunghwa | ad468f2c06781f427b438f00be65a0d7edb37516 | 4d97ce2fcdfc8cbac62cccb0885cdad4a682348b | refs/heads/main | 2023-08-27T14:12:02.603857 | 2021-10-18T07:44:06 | 2021-10-18T07:44:06 | 389,311,294 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 84,508 | cpp | #include "pch-cpp.hpp"
#ifndef _MSC_VER
# include <alloca.h>
#else
# include <malloc.h>
#endif
#include <limits>
#include <stdint.h>
struct VirtualActionInvoker0
{
typedef void (*Action)(void*, const RuntimeMethod*);
static inline void Invoke (Il2CppMethodSlot slot, RuntimeObject* obj)
{
const VirtualInvokeData& invokeData = il2cpp_codegen_get_virtual_invoke_data(slot, obj);
((Action)invokeData.methodPtr)(obj, invokeData.method);
}
};
template <typename T1>
struct VirtualActionInvoker1
{
typedef void (*Action)(void*, T1, const RuntimeMethod*);
static inline void Invoke (Il2CppMethodSlot slot, RuntimeObject* obj, T1 p1)
{
const VirtualInvokeData& invokeData = il2cpp_codegen_get_virtual_invoke_data(slot, obj);
((Action)invokeData.methodPtr)(obj, p1, invokeData.method);
}
};
struct GenericVirtualActionInvoker0
{
typedef void (*Action)(void*, const RuntimeMethod*);
static inline void Invoke (const RuntimeMethod* method, RuntimeObject* obj)
{
VirtualInvokeData invokeData;
il2cpp_codegen_get_generic_virtual_invoke_data(method, obj, &invokeData);
((Action)invokeData.methodPtr)(obj, invokeData.method);
}
};
template <typename T1>
struct GenericVirtualActionInvoker1
{
typedef void (*Action)(void*, T1, const RuntimeMethod*);
static inline void Invoke (const RuntimeMethod* method, RuntimeObject* obj, T1 p1)
{
VirtualInvokeData invokeData;
il2cpp_codegen_get_generic_virtual_invoke_data(method, obj, &invokeData);
((Action)invokeData.methodPtr)(obj, p1, invokeData.method);
}
};
struct InterfaceActionInvoker0
{
typedef void (*Action)(void*, const RuntimeMethod*);
static inline void Invoke (Il2CppMethodSlot slot, RuntimeClass* declaringInterface, RuntimeObject* obj)
{
const VirtualInvokeData& invokeData = il2cpp_codegen_get_interface_invoke_data(slot, obj, declaringInterface);
((Action)invokeData.methodPtr)(obj, invokeData.method);
}
};
template <typename T1>
struct InterfaceActionInvoker1
{
typedef void (*Action)(void*, T1, const RuntimeMethod*);
static inline void Invoke (Il2CppMethodSlot slot, RuntimeClass* declaringInterface, RuntimeObject* obj, T1 p1)
{
const VirtualInvokeData& invokeData = il2cpp_codegen_get_interface_invoke_data(slot, obj, declaringInterface);
((Action)invokeData.methodPtr)(obj, p1, invokeData.method);
}
};
struct GenericInterfaceActionInvoker0
{
typedef void (*Action)(void*, const RuntimeMethod*);
static inline void Invoke (const RuntimeMethod* method, RuntimeObject* obj)
{
VirtualInvokeData invokeData;
il2cpp_codegen_get_generic_interface_invoke_data(method, obj, &invokeData);
((Action)invokeData.methodPtr)(obj, invokeData.method);
}
};
template <typename T1>
struct GenericInterfaceActionInvoker1
{
typedef void (*Action)(void*, T1, const RuntimeMethod*);
static inline void Invoke (const RuntimeMethod* method, RuntimeObject* obj, T1 p1)
{
VirtualInvokeData invokeData;
il2cpp_codegen_get_generic_interface_invoke_data(method, obj, &invokeData);
((Action)invokeData.methodPtr)(obj, p1, invokeData.method);
}
};
// System.Action`1<System.Boolean>
struct Action_1_tCE2D770918A65CAD277C08C4E8C05385EA267E83;
// System.Delegate[]
struct DelegateU5BU5D_t677D8FE08A5F99E8EE49150B73966CD6E9BF7DB8;
// System.Single[]
struct SingleU5BU5D_t47E8DBF5B597C122478D1FFBD9DD57399A0650FA;
// UnityEngine.AudioClip
struct AudioClip_t16D2E573E7CC1C5118D8EE0F0692D46866A1C0EE;
// UnityEngine.Experimental.Audio.AudioSampleProvider
struct AudioSampleProvider_tD8B613D55D09D6CE86B851A5D8F33560FFCC705B;
// System.Delegate
struct Delegate_t;
// System.DelegateData
struct DelegateData_t17DD30660E330C49381DAA99F934BE75CB11F288;
// System.Reflection.MethodInfo
struct MethodInfo_t;
// System.String
struct String_t;
// System.Void
struct Void_t700C6383A2A510C2CF4DD86DABD5CA9FF70ADAC5;
// UnityEngine.AudioClip/PCMReaderCallback
struct PCMReaderCallback_t9CA1437D36509A9FAC5EDD8FF2BC3259C24D0E0B;
// UnityEngine.AudioClip/PCMSetPositionCallback
struct PCMSetPositionCallback_tBDD99E7C0697687F1E7B06CDD5DE444A3709CF4C;
// UnityEngine.Experimental.Audio.AudioSampleProvider/SampleFramesHandler
struct SampleFramesHandler_tCF0215103F7BD1AD5397731D86079D6E68AC9487;
// UnityEngine.AudioSettings/AudioConfigurationChangeHandler
struct AudioConfigurationChangeHandler_t1A997C51DF7B553A94DAD358F8D968308994774A;
IL2CPP_EXTERN_C RuntimeClass* AudioSettings_t1941E7DE9FEF65F7742713EB862D3025244FCB08_il2cpp_TypeInfo_var;
IL2CPP_EXTERN_C RuntimeClass* Mobile_t9F8A04EF1ADC739B4107A38F0103CB72ECD23F5E_il2cpp_TypeInfo_var;
IL2CPP_EXTERN_C RuntimeClass* PlayableHandle_t50DCD240B0400DDAD0822C13E5DBC7AD64DC027A_il2cpp_TypeInfo_var;
IL2CPP_EXTERN_C const RuntimeMethod* Action_1_Invoke_m94B1D693386EA0BD3C636939BDCE375EDEF91A04_RuntimeMethod_var;
struct Delegate_t_marshaled_com;
struct Delegate_t_marshaled_pinvoke;
struct DelegateU5BU5D_t677D8FE08A5F99E8EE49150B73966CD6E9BF7DB8;
struct SingleU5BU5D_t47E8DBF5B597C122478D1FFBD9DD57399A0650FA;
IL2CPP_EXTERN_C_BEGIN
IL2CPP_EXTERN_C_END
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// <Module>
struct U3CModuleU3E_t6975E9BBACF02877D569BBF09DC44C44D3C346CB
{
public:
public:
};
// System.Object
struct Il2CppArrayBounds;
// System.Array
// UnityEngine.Experimental.Audio.AudioSampleProvider
struct AudioSampleProvider_tD8B613D55D09D6CE86B851A5D8F33560FFCC705B : public RuntimeObject
{
public:
// UnityEngine.Experimental.Audio.AudioSampleProvider/SampleFramesHandler UnityEngine.Experimental.Audio.AudioSampleProvider::sampleFramesAvailable
SampleFramesHandler_tCF0215103F7BD1AD5397731D86079D6E68AC9487 * ___sampleFramesAvailable_0;
// UnityEngine.Experimental.Audio.AudioSampleProvider/SampleFramesHandler UnityEngine.Experimental.Audio.AudioSampleProvider::sampleFramesOverflow
SampleFramesHandler_tCF0215103F7BD1AD5397731D86079D6E68AC9487 * ___sampleFramesOverflow_1;
public:
inline static int32_t get_offset_of_sampleFramesAvailable_0() { return static_cast<int32_t>(offsetof(AudioSampleProvider_tD8B613D55D09D6CE86B851A5D8F33560FFCC705B, ___sampleFramesAvailable_0)); }
inline SampleFramesHandler_tCF0215103F7BD1AD5397731D86079D6E68AC9487 * get_sampleFramesAvailable_0() const { return ___sampleFramesAvailable_0; }
inline SampleFramesHandler_tCF0215103F7BD1AD5397731D86079D6E68AC9487 ** get_address_of_sampleFramesAvailable_0() { return &___sampleFramesAvailable_0; }
inline void set_sampleFramesAvailable_0(SampleFramesHandler_tCF0215103F7BD1AD5397731D86079D6E68AC9487 * value)
{
___sampleFramesAvailable_0 = value;
Il2CppCodeGenWriteBarrier((void**)(&___sampleFramesAvailable_0), (void*)value);
}
inline static int32_t get_offset_of_sampleFramesOverflow_1() { return static_cast<int32_t>(offsetof(AudioSampleProvider_tD8B613D55D09D6CE86B851A5D8F33560FFCC705B, ___sampleFramesOverflow_1)); }
inline SampleFramesHandler_tCF0215103F7BD1AD5397731D86079D6E68AC9487 * get_sampleFramesOverflow_1() const { return ___sampleFramesOverflow_1; }
inline SampleFramesHandler_tCF0215103F7BD1AD5397731D86079D6E68AC9487 ** get_address_of_sampleFramesOverflow_1() { return &___sampleFramesOverflow_1; }
inline void set_sampleFramesOverflow_1(SampleFramesHandler_tCF0215103F7BD1AD5397731D86079D6E68AC9487 * value)
{
___sampleFramesOverflow_1 = value;
Il2CppCodeGenWriteBarrier((void**)(&___sampleFramesOverflow_1), (void*)value);
}
};
// UnityEngine.AudioSettings
struct AudioSettings_t1941E7DE9FEF65F7742713EB862D3025244FCB08 : public RuntimeObject
{
public:
public:
};
struct AudioSettings_t1941E7DE9FEF65F7742713EB862D3025244FCB08_StaticFields
{
public:
// UnityEngine.AudioSettings/AudioConfigurationChangeHandler UnityEngine.AudioSettings::OnAudioConfigurationChanged
AudioConfigurationChangeHandler_t1A997C51DF7B553A94DAD358F8D968308994774A * ___OnAudioConfigurationChanged_0;
public:
inline static int32_t get_offset_of_OnAudioConfigurationChanged_0() { return static_cast<int32_t>(offsetof(AudioSettings_t1941E7DE9FEF65F7742713EB862D3025244FCB08_StaticFields, ___OnAudioConfigurationChanged_0)); }
inline AudioConfigurationChangeHandler_t1A997C51DF7B553A94DAD358F8D968308994774A * get_OnAudioConfigurationChanged_0() const { return ___OnAudioConfigurationChanged_0; }
inline AudioConfigurationChangeHandler_t1A997C51DF7B553A94DAD358F8D968308994774A ** get_address_of_OnAudioConfigurationChanged_0() { return &___OnAudioConfigurationChanged_0; }
inline void set_OnAudioConfigurationChanged_0(AudioConfigurationChangeHandler_t1A997C51DF7B553A94DAD358F8D968308994774A * value)
{
___OnAudioConfigurationChanged_0 = value;
Il2CppCodeGenWriteBarrier((void**)(&___OnAudioConfigurationChanged_0), (void*)value);
}
};
// System.ValueType
struct ValueType_tDBF999C1B75C48C68621878250DBF6CDBCF51E52 : public RuntimeObject
{
public:
public:
};
// Native definition for P/Invoke marshalling of System.ValueType
struct ValueType_tDBF999C1B75C48C68621878250DBF6CDBCF51E52_marshaled_pinvoke
{
};
// Native definition for COM marshalling of System.ValueType
struct ValueType_tDBF999C1B75C48C68621878250DBF6CDBCF51E52_marshaled_com
{
};
// UnityEngine.AudioSettings/Mobile
struct Mobile_t9F8A04EF1ADC739B4107A38F0103CB72ECD23F5E : public RuntimeObject
{
public:
public:
};
struct Mobile_t9F8A04EF1ADC739B4107A38F0103CB72ECD23F5E_StaticFields
{
public:
// System.Boolean UnityEngine.AudioSettings/Mobile::<muteState>k__BackingField
bool ___U3CmuteStateU3Ek__BackingField_0;
// System.Boolean UnityEngine.AudioSettings/Mobile::_stopAudioOutputOnMute
bool ____stopAudioOutputOnMute_1;
// System.Action`1<System.Boolean> UnityEngine.AudioSettings/Mobile::OnMuteStateChanged
Action_1_tCE2D770918A65CAD277C08C4E8C05385EA267E83 * ___OnMuteStateChanged_2;
public:
inline static int32_t get_offset_of_U3CmuteStateU3Ek__BackingField_0() { return static_cast<int32_t>(offsetof(Mobile_t9F8A04EF1ADC739B4107A38F0103CB72ECD23F5E_StaticFields, ___U3CmuteStateU3Ek__BackingField_0)); }
inline bool get_U3CmuteStateU3Ek__BackingField_0() const { return ___U3CmuteStateU3Ek__BackingField_0; }
inline bool* get_address_of_U3CmuteStateU3Ek__BackingField_0() { return &___U3CmuteStateU3Ek__BackingField_0; }
inline void set_U3CmuteStateU3Ek__BackingField_0(bool value)
{
___U3CmuteStateU3Ek__BackingField_0 = value;
}
inline static int32_t get_offset_of__stopAudioOutputOnMute_1() { return static_cast<int32_t>(offsetof(Mobile_t9F8A04EF1ADC739B4107A38F0103CB72ECD23F5E_StaticFields, ____stopAudioOutputOnMute_1)); }
inline bool get__stopAudioOutputOnMute_1() const { return ____stopAudioOutputOnMute_1; }
inline bool* get_address_of__stopAudioOutputOnMute_1() { return &____stopAudioOutputOnMute_1; }
inline void set__stopAudioOutputOnMute_1(bool value)
{
____stopAudioOutputOnMute_1 = value;
}
inline static int32_t get_offset_of_OnMuteStateChanged_2() { return static_cast<int32_t>(offsetof(Mobile_t9F8A04EF1ADC739B4107A38F0103CB72ECD23F5E_StaticFields, ___OnMuteStateChanged_2)); }
inline Action_1_tCE2D770918A65CAD277C08C4E8C05385EA267E83 * get_OnMuteStateChanged_2() const { return ___OnMuteStateChanged_2; }
inline Action_1_tCE2D770918A65CAD277C08C4E8C05385EA267E83 ** get_address_of_OnMuteStateChanged_2() { return &___OnMuteStateChanged_2; }
inline void set_OnMuteStateChanged_2(Action_1_tCE2D770918A65CAD277C08C4E8C05385EA267E83 * value)
{
___OnMuteStateChanged_2 = value;
Il2CppCodeGenWriteBarrier((void**)(&___OnMuteStateChanged_2), (void*)value);
}
};
// System.Boolean
struct Boolean_t07D1E3F34E4813023D64F584DFF7B34C9D922F37
{
public:
// System.Boolean System.Boolean::m_value
bool ___m_value_0;
public:
inline static int32_t get_offset_of_m_value_0() { return static_cast<int32_t>(offsetof(Boolean_t07D1E3F34E4813023D64F584DFF7B34C9D922F37, ___m_value_0)); }
inline bool get_m_value_0() const { return ___m_value_0; }
inline bool* get_address_of_m_value_0() { return &___m_value_0; }
inline void set_m_value_0(bool value)
{
___m_value_0 = value;
}
};
struct Boolean_t07D1E3F34E4813023D64F584DFF7B34C9D922F37_StaticFields
{
public:
// System.String System.Boolean::TrueString
String_t* ___TrueString_5;
// System.String System.Boolean::FalseString
String_t* ___FalseString_6;
public:
inline static int32_t get_offset_of_TrueString_5() { return static_cast<int32_t>(offsetof(Boolean_t07D1E3F34E4813023D64F584DFF7B34C9D922F37_StaticFields, ___TrueString_5)); }
inline String_t* get_TrueString_5() const { return ___TrueString_5; }
inline String_t** get_address_of_TrueString_5() { return &___TrueString_5; }
inline void set_TrueString_5(String_t* value)
{
___TrueString_5 = value;
Il2CppCodeGenWriteBarrier((void**)(&___TrueString_5), (void*)value);
}
inline static int32_t get_offset_of_FalseString_6() { return static_cast<int32_t>(offsetof(Boolean_t07D1E3F34E4813023D64F584DFF7B34C9D922F37_StaticFields, ___FalseString_6)); }
inline String_t* get_FalseString_6() const { return ___FalseString_6; }
inline String_t** get_address_of_FalseString_6() { return &___FalseString_6; }
inline void set_FalseString_6(String_t* value)
{
___FalseString_6 = value;
Il2CppCodeGenWriteBarrier((void**)(&___FalseString_6), (void*)value);
}
};
// System.Int32
struct Int32_tFDE5F8CD43D10453F6A2E0C77FE48C6CC7009046
{
public:
// System.Int32 System.Int32::m_value
int32_t ___m_value_0;
public:
inline static int32_t get_offset_of_m_value_0() { return static_cast<int32_t>(offsetof(Int32_tFDE5F8CD43D10453F6A2E0C77FE48C6CC7009046, ___m_value_0)); }
inline int32_t get_m_value_0() const { return ___m_value_0; }
inline int32_t* get_address_of_m_value_0() { return &___m_value_0; }
inline void set_m_value_0(int32_t value)
{
___m_value_0 = value;
}
};
// System.IntPtr
struct IntPtr_t
{
public:
// System.Void* System.IntPtr::m_value
void* ___m_value_0;
public:
inline static int32_t get_offset_of_m_value_0() { return static_cast<int32_t>(offsetof(IntPtr_t, ___m_value_0)); }
inline void* get_m_value_0() const { return ___m_value_0; }
inline void** get_address_of_m_value_0() { return &___m_value_0; }
inline void set_m_value_0(void* value)
{
___m_value_0 = value;
}
};
struct IntPtr_t_StaticFields
{
public:
// System.IntPtr System.IntPtr::Zero
intptr_t ___Zero_1;
public:
inline static int32_t get_offset_of_Zero_1() { return static_cast<int32_t>(offsetof(IntPtr_t_StaticFields, ___Zero_1)); }
inline intptr_t get_Zero_1() const { return ___Zero_1; }
inline intptr_t* get_address_of_Zero_1() { return &___Zero_1; }
inline void set_Zero_1(intptr_t value)
{
___Zero_1 = value;
}
};
// System.Single
struct Single_tE07797BA3C98D4CA9B5A19413C19A76688AB899E
{
public:
// System.Single System.Single::m_value
float ___m_value_0;
public:
inline static int32_t get_offset_of_m_value_0() { return static_cast<int32_t>(offsetof(Single_tE07797BA3C98D4CA9B5A19413C19A76688AB899E, ___m_value_0)); }
inline float get_m_value_0() const { return ___m_value_0; }
inline float* get_address_of_m_value_0() { return &___m_value_0; }
inline void set_m_value_0(float value)
{
___m_value_0 = value;
}
};
// System.UInt32
struct UInt32_tE60352A06233E4E69DD198BCC67142159F686B15
{
public:
// System.UInt32 System.UInt32::m_value
uint32_t ___m_value_0;
public:
inline static int32_t get_offset_of_m_value_0() { return static_cast<int32_t>(offsetof(UInt32_tE60352A06233E4E69DD198BCC67142159F686B15, ___m_value_0)); }
inline uint32_t get_m_value_0() const { return ___m_value_0; }
inline uint32_t* get_address_of_m_value_0() { return &___m_value_0; }
inline void set_m_value_0(uint32_t value)
{
___m_value_0 = value;
}
};
// System.Void
struct Void_t700C6383A2A510C2CF4DD86DABD5CA9FF70ADAC5
{
public:
union
{
struct
{
};
uint8_t Void_t700C6383A2A510C2CF4DD86DABD5CA9FF70ADAC5__padding[1];
};
public:
};
// System.Delegate
struct Delegate_t : public RuntimeObject
{
public:
// System.IntPtr System.Delegate::method_ptr
Il2CppMethodPointer ___method_ptr_0;
// System.IntPtr System.Delegate::invoke_impl
intptr_t ___invoke_impl_1;
// System.Object System.Delegate::m_target
RuntimeObject * ___m_target_2;
// System.IntPtr System.Delegate::method
intptr_t ___method_3;
// System.IntPtr System.Delegate::delegate_trampoline
intptr_t ___delegate_trampoline_4;
// System.IntPtr System.Delegate::extra_arg
intptr_t ___extra_arg_5;
// System.IntPtr System.Delegate::method_code
intptr_t ___method_code_6;
// System.Reflection.MethodInfo System.Delegate::method_info
MethodInfo_t * ___method_info_7;
// System.Reflection.MethodInfo System.Delegate::original_method_info
MethodInfo_t * ___original_method_info_8;
// System.DelegateData System.Delegate::data
DelegateData_t17DD30660E330C49381DAA99F934BE75CB11F288 * ___data_9;
// System.Boolean System.Delegate::method_is_virtual
bool ___method_is_virtual_10;
public:
inline static int32_t get_offset_of_method_ptr_0() { return static_cast<int32_t>(offsetof(Delegate_t, ___method_ptr_0)); }
inline Il2CppMethodPointer get_method_ptr_0() const { return ___method_ptr_0; }
inline Il2CppMethodPointer* get_address_of_method_ptr_0() { return &___method_ptr_0; }
inline void set_method_ptr_0(Il2CppMethodPointer value)
{
___method_ptr_0 = value;
}
inline static int32_t get_offset_of_invoke_impl_1() { return static_cast<int32_t>(offsetof(Delegate_t, ___invoke_impl_1)); }
inline intptr_t get_invoke_impl_1() const { return ___invoke_impl_1; }
inline intptr_t* get_address_of_invoke_impl_1() { return &___invoke_impl_1; }
inline void set_invoke_impl_1(intptr_t value)
{
___invoke_impl_1 = value;
}
inline static int32_t get_offset_of_m_target_2() { return static_cast<int32_t>(offsetof(Delegate_t, ___m_target_2)); }
inline RuntimeObject * get_m_target_2() const { return ___m_target_2; }
inline RuntimeObject ** get_address_of_m_target_2() { return &___m_target_2; }
inline void set_m_target_2(RuntimeObject * value)
{
___m_target_2 = value;
Il2CppCodeGenWriteBarrier((void**)(&___m_target_2), (void*)value);
}
inline static int32_t get_offset_of_method_3() { return static_cast<int32_t>(offsetof(Delegate_t, ___method_3)); }
inline intptr_t get_method_3() const { return ___method_3; }
inline intptr_t* get_address_of_method_3() { return &___method_3; }
inline void set_method_3(intptr_t value)
{
___method_3 = value;
}
inline static int32_t get_offset_of_delegate_trampoline_4() { return static_cast<int32_t>(offsetof(Delegate_t, ___delegate_trampoline_4)); }
inline intptr_t get_delegate_trampoline_4() const { return ___delegate_trampoline_4; }
inline intptr_t* get_address_of_delegate_trampoline_4() { return &___delegate_trampoline_4; }
inline void set_delegate_trampoline_4(intptr_t value)
{
___delegate_trampoline_4 = value;
}
inline static int32_t get_offset_of_extra_arg_5() { return static_cast<int32_t>(offsetof(Delegate_t, ___extra_arg_5)); }
inline intptr_t get_extra_arg_5() const { return ___extra_arg_5; }
inline intptr_t* get_address_of_extra_arg_5() { return &___extra_arg_5; }
inline void set_extra_arg_5(intptr_t value)
{
___extra_arg_5 = value;
}
inline static int32_t get_offset_of_method_code_6() { return static_cast<int32_t>(offsetof(Delegate_t, ___method_code_6)); }
inline intptr_t get_method_code_6() const { return ___method_code_6; }
inline intptr_t* get_address_of_method_code_6() { return &___method_code_6; }
inline void set_method_code_6(intptr_t value)
{
___method_code_6 = value;
}
inline static int32_t get_offset_of_method_info_7() { return static_cast<int32_t>(offsetof(Delegate_t, ___method_info_7)); }
inline MethodInfo_t * get_method_info_7() const { return ___method_info_7; }
inline MethodInfo_t ** get_address_of_method_info_7() { return &___method_info_7; }
inline void set_method_info_7(MethodInfo_t * value)
{
___method_info_7 = value;
Il2CppCodeGenWriteBarrier((void**)(&___method_info_7), (void*)value);
}
inline static int32_t get_offset_of_original_method_info_8() { return static_cast<int32_t>(offsetof(Delegate_t, ___original_method_info_8)); }
inline MethodInfo_t * get_original_method_info_8() const { return ___original_method_info_8; }
inline MethodInfo_t ** get_address_of_original_method_info_8() { return &___original_method_info_8; }
inline void set_original_method_info_8(MethodInfo_t * value)
{
___original_method_info_8 = value;
Il2CppCodeGenWriteBarrier((void**)(&___original_method_info_8), (void*)value);
}
inline static int32_t get_offset_of_data_9() { return static_cast<int32_t>(offsetof(Delegate_t, ___data_9)); }
inline DelegateData_t17DD30660E330C49381DAA99F934BE75CB11F288 * get_data_9() const { return ___data_9; }
inline DelegateData_t17DD30660E330C49381DAA99F934BE75CB11F288 ** get_address_of_data_9() { return &___data_9; }
inline void set_data_9(DelegateData_t17DD30660E330C49381DAA99F934BE75CB11F288 * value)
{
___data_9 = value;
Il2CppCodeGenWriteBarrier((void**)(&___data_9), (void*)value);
}
inline static int32_t get_offset_of_method_is_virtual_10() { return static_cast<int32_t>(offsetof(Delegate_t, ___method_is_virtual_10)); }
inline bool get_method_is_virtual_10() const { return ___method_is_virtual_10; }
inline bool* get_address_of_method_is_virtual_10() { return &___method_is_virtual_10; }
inline void set_method_is_virtual_10(bool value)
{
___method_is_virtual_10 = value;
}
};
// Native definition for P/Invoke marshalling of System.Delegate
struct Delegate_t_marshaled_pinvoke
{
intptr_t ___method_ptr_0;
intptr_t ___invoke_impl_1;
Il2CppIUnknown* ___m_target_2;
intptr_t ___method_3;
intptr_t ___delegate_trampoline_4;
intptr_t ___extra_arg_5;
intptr_t ___method_code_6;
MethodInfo_t * ___method_info_7;
MethodInfo_t * ___original_method_info_8;
DelegateData_t17DD30660E330C49381DAA99F934BE75CB11F288 * ___data_9;
int32_t ___method_is_virtual_10;
};
// Native definition for COM marshalling of System.Delegate
struct Delegate_t_marshaled_com
{
intptr_t ___method_ptr_0;
intptr_t ___invoke_impl_1;
Il2CppIUnknown* ___m_target_2;
intptr_t ___method_3;
intptr_t ___delegate_trampoline_4;
intptr_t ___extra_arg_5;
intptr_t ___method_code_6;
MethodInfo_t * ___method_info_7;
MethodInfo_t * ___original_method_info_8;
DelegateData_t17DD30660E330C49381DAA99F934BE75CB11F288 * ___data_9;
int32_t ___method_is_virtual_10;
};
// UnityEngine.Object
struct Object_tF2F3778131EFF286AF62B7B013A170F95A91571A : public RuntimeObject
{
public:
// System.IntPtr UnityEngine.Object::m_CachedPtr
intptr_t ___m_CachedPtr_0;
public:
inline static int32_t get_offset_of_m_CachedPtr_0() { return static_cast<int32_t>(offsetof(Object_tF2F3778131EFF286AF62B7B013A170F95A91571A, ___m_CachedPtr_0)); }
inline intptr_t get_m_CachedPtr_0() const { return ___m_CachedPtr_0; }
inline intptr_t* get_address_of_m_CachedPtr_0() { return &___m_CachedPtr_0; }
inline void set_m_CachedPtr_0(intptr_t value)
{
___m_CachedPtr_0 = value;
}
};
struct Object_tF2F3778131EFF286AF62B7B013A170F95A91571A_StaticFields
{
public:
// System.Int32 UnityEngine.Object::OffsetOfInstanceIDInCPlusPlusObject
int32_t ___OffsetOfInstanceIDInCPlusPlusObject_1;
public:
inline static int32_t get_offset_of_OffsetOfInstanceIDInCPlusPlusObject_1() { return static_cast<int32_t>(offsetof(Object_tF2F3778131EFF286AF62B7B013A170F95A91571A_StaticFields, ___OffsetOfInstanceIDInCPlusPlusObject_1)); }
inline int32_t get_OffsetOfInstanceIDInCPlusPlusObject_1() const { return ___OffsetOfInstanceIDInCPlusPlusObject_1; }
inline int32_t* get_address_of_OffsetOfInstanceIDInCPlusPlusObject_1() { return &___OffsetOfInstanceIDInCPlusPlusObject_1; }
inline void set_OffsetOfInstanceIDInCPlusPlusObject_1(int32_t value)
{
___OffsetOfInstanceIDInCPlusPlusObject_1 = value;
}
};
// Native definition for P/Invoke marshalling of UnityEngine.Object
struct Object_tF2F3778131EFF286AF62B7B013A170F95A91571A_marshaled_pinvoke
{
intptr_t ___m_CachedPtr_0;
};
// Native definition for COM marshalling of UnityEngine.Object
struct Object_tF2F3778131EFF286AF62B7B013A170F95A91571A_marshaled_com
{
intptr_t ___m_CachedPtr_0;
};
// UnityEngine.Playables.PlayableHandle
struct PlayableHandle_t50DCD240B0400DDAD0822C13E5DBC7AD64DC027A
{
public:
// System.IntPtr UnityEngine.Playables.PlayableHandle::m_Handle
intptr_t ___m_Handle_0;
// System.UInt32 UnityEngine.Playables.PlayableHandle::m_Version
uint32_t ___m_Version_1;
public:
inline static int32_t get_offset_of_m_Handle_0() { return static_cast<int32_t>(offsetof(PlayableHandle_t50DCD240B0400DDAD0822C13E5DBC7AD64DC027A, ___m_Handle_0)); }
inline intptr_t get_m_Handle_0() const { return ___m_Handle_0; }
inline intptr_t* get_address_of_m_Handle_0() { return &___m_Handle_0; }
inline void set_m_Handle_0(intptr_t value)
{
___m_Handle_0 = value;
}
inline static int32_t get_offset_of_m_Version_1() { return static_cast<int32_t>(offsetof(PlayableHandle_t50DCD240B0400DDAD0822C13E5DBC7AD64DC027A, ___m_Version_1)); }
inline uint32_t get_m_Version_1() const { return ___m_Version_1; }
inline uint32_t* get_address_of_m_Version_1() { return &___m_Version_1; }
inline void set_m_Version_1(uint32_t value)
{
___m_Version_1 = value;
}
};
struct PlayableHandle_t50DCD240B0400DDAD0822C13E5DBC7AD64DC027A_StaticFields
{
public:
// UnityEngine.Playables.PlayableHandle UnityEngine.Playables.PlayableHandle::m_Null
PlayableHandle_t50DCD240B0400DDAD0822C13E5DBC7AD64DC027A ___m_Null_2;
public:
inline static int32_t get_offset_of_m_Null_2() { return static_cast<int32_t>(offsetof(PlayableHandle_t50DCD240B0400DDAD0822C13E5DBC7AD64DC027A_StaticFields, ___m_Null_2)); }
inline PlayableHandle_t50DCD240B0400DDAD0822C13E5DBC7AD64DC027A get_m_Null_2() const { return ___m_Null_2; }
inline PlayableHandle_t50DCD240B0400DDAD0822C13E5DBC7AD64DC027A * get_address_of_m_Null_2() { return &___m_Null_2; }
inline void set_m_Null_2(PlayableHandle_t50DCD240B0400DDAD0822C13E5DBC7AD64DC027A value)
{
___m_Null_2 = value;
}
};
// UnityEngine.Playables.PlayableOutputHandle
struct PlayableOutputHandle_t8C84BCDB2AECFEDBCF0E7CC7CDBADD517D148CD1
{
public:
// System.IntPtr UnityEngine.Playables.PlayableOutputHandle::m_Handle
intptr_t ___m_Handle_0;
// System.UInt32 UnityEngine.Playables.PlayableOutputHandle::m_Version
uint32_t ___m_Version_1;
public:
inline static int32_t get_offset_of_m_Handle_0() { return static_cast<int32_t>(offsetof(PlayableOutputHandle_t8C84BCDB2AECFEDBCF0E7CC7CDBADD517D148CD1, ___m_Handle_0)); }
inline intptr_t get_m_Handle_0() const { return ___m_Handle_0; }
inline intptr_t* get_address_of_m_Handle_0() { return &___m_Handle_0; }
inline void set_m_Handle_0(intptr_t value)
{
___m_Handle_0 = value;
}
inline static int32_t get_offset_of_m_Version_1() { return static_cast<int32_t>(offsetof(PlayableOutputHandle_t8C84BCDB2AECFEDBCF0E7CC7CDBADD517D148CD1, ___m_Version_1)); }
inline uint32_t get_m_Version_1() const { return ___m_Version_1; }
inline uint32_t* get_address_of_m_Version_1() { return &___m_Version_1; }
inline void set_m_Version_1(uint32_t value)
{
___m_Version_1 = value;
}
};
struct PlayableOutputHandle_t8C84BCDB2AECFEDBCF0E7CC7CDBADD517D148CD1_StaticFields
{
public:
// UnityEngine.Playables.PlayableOutputHandle UnityEngine.Playables.PlayableOutputHandle::m_Null
PlayableOutputHandle_t8C84BCDB2AECFEDBCF0E7CC7CDBADD517D148CD1 ___m_Null_2;
public:
inline static int32_t get_offset_of_m_Null_2() { return static_cast<int32_t>(offsetof(PlayableOutputHandle_t8C84BCDB2AECFEDBCF0E7CC7CDBADD517D148CD1_StaticFields, ___m_Null_2)); }
inline PlayableOutputHandle_t8C84BCDB2AECFEDBCF0E7CC7CDBADD517D148CD1 get_m_Null_2() const { return ___m_Null_2; }
inline PlayableOutputHandle_t8C84BCDB2AECFEDBCF0E7CC7CDBADD517D148CD1 * get_address_of_m_Null_2() { return &___m_Null_2; }
inline void set_m_Null_2(PlayableOutputHandle_t8C84BCDB2AECFEDBCF0E7CC7CDBADD517D148CD1 value)
{
___m_Null_2 = value;
}
};
// UnityEngine.AudioClip
struct AudioClip_t16D2E573E7CC1C5118D8EE0F0692D46866A1C0EE : public Object_tF2F3778131EFF286AF62B7B013A170F95A91571A
{
public:
// UnityEngine.AudioClip/PCMReaderCallback UnityEngine.AudioClip::m_PCMReaderCallback
PCMReaderCallback_t9CA1437D36509A9FAC5EDD8FF2BC3259C24D0E0B * ___m_PCMReaderCallback_4;
// UnityEngine.AudioClip/PCMSetPositionCallback UnityEngine.AudioClip::m_PCMSetPositionCallback
PCMSetPositionCallback_tBDD99E7C0697687F1E7B06CDD5DE444A3709CF4C * ___m_PCMSetPositionCallback_5;
public:
inline static int32_t get_offset_of_m_PCMReaderCallback_4() { return static_cast<int32_t>(offsetof(AudioClip_t16D2E573E7CC1C5118D8EE0F0692D46866A1C0EE, ___m_PCMReaderCallback_4)); }
inline PCMReaderCallback_t9CA1437D36509A9FAC5EDD8FF2BC3259C24D0E0B * get_m_PCMReaderCallback_4() const { return ___m_PCMReaderCallback_4; }
inline PCMReaderCallback_t9CA1437D36509A9FAC5EDD8FF2BC3259C24D0E0B ** get_address_of_m_PCMReaderCallback_4() { return &___m_PCMReaderCallback_4; }
inline void set_m_PCMReaderCallback_4(PCMReaderCallback_t9CA1437D36509A9FAC5EDD8FF2BC3259C24D0E0B * value)
{
___m_PCMReaderCallback_4 = value;
Il2CppCodeGenWriteBarrier((void**)(&___m_PCMReaderCallback_4), (void*)value);
}
inline static int32_t get_offset_of_m_PCMSetPositionCallback_5() { return static_cast<int32_t>(offsetof(AudioClip_t16D2E573E7CC1C5118D8EE0F0692D46866A1C0EE, ___m_PCMSetPositionCallback_5)); }
inline PCMSetPositionCallback_tBDD99E7C0697687F1E7B06CDD5DE444A3709CF4C * get_m_PCMSetPositionCallback_5() const { return ___m_PCMSetPositionCallback_5; }
inline PCMSetPositionCallback_tBDD99E7C0697687F1E7B06CDD5DE444A3709CF4C ** get_address_of_m_PCMSetPositionCallback_5() { return &___m_PCMSetPositionCallback_5; }
inline void set_m_PCMSetPositionCallback_5(PCMSetPositionCallback_tBDD99E7C0697687F1E7B06CDD5DE444A3709CF4C * value)
{
___m_PCMSetPositionCallback_5 = value;
Il2CppCodeGenWriteBarrier((void**)(&___m_PCMSetPositionCallback_5), (void*)value);
}
};
// UnityEngine.Audio.AudioClipPlayable
struct AudioClipPlayable_t3574B22284CE09FDEAD15BD18D66C4A21D59FA5F
{
public:
// UnityEngine.Playables.PlayableHandle UnityEngine.Audio.AudioClipPlayable::m_Handle
PlayableHandle_t50DCD240B0400DDAD0822C13E5DBC7AD64DC027A ___m_Handle_0;
public:
inline static int32_t get_offset_of_m_Handle_0() { return static_cast<int32_t>(offsetof(AudioClipPlayable_t3574B22284CE09FDEAD15BD18D66C4A21D59FA5F, ___m_Handle_0)); }
inline PlayableHandle_t50DCD240B0400DDAD0822C13E5DBC7AD64DC027A get_m_Handle_0() const { return ___m_Handle_0; }
inline PlayableHandle_t50DCD240B0400DDAD0822C13E5DBC7AD64DC027A * get_address_of_m_Handle_0() { return &___m_Handle_0; }
inline void set_m_Handle_0(PlayableHandle_t50DCD240B0400DDAD0822C13E5DBC7AD64DC027A value)
{
___m_Handle_0 = value;
}
};
// UnityEngine.Audio.AudioMixerPlayable
struct AudioMixerPlayable_t80531461F1E238E237D7BB2BAE7E031ABDE95C4A
{
public:
// UnityEngine.Playables.PlayableHandle UnityEngine.Audio.AudioMixerPlayable::m_Handle
PlayableHandle_t50DCD240B0400DDAD0822C13E5DBC7AD64DC027A ___m_Handle_0;
public:
inline static int32_t get_offset_of_m_Handle_0() { return static_cast<int32_t>(offsetof(AudioMixerPlayable_t80531461F1E238E237D7BB2BAE7E031ABDE95C4A, ___m_Handle_0)); }
inline PlayableHandle_t50DCD240B0400DDAD0822C13E5DBC7AD64DC027A get_m_Handle_0() const { return ___m_Handle_0; }
inline PlayableHandle_t50DCD240B0400DDAD0822C13E5DBC7AD64DC027A * get_address_of_m_Handle_0() { return &___m_Handle_0; }
inline void set_m_Handle_0(PlayableHandle_t50DCD240B0400DDAD0822C13E5DBC7AD64DC027A value)
{
___m_Handle_0 = value;
}
};
// UnityEngine.Audio.AudioPlayableOutput
struct AudioPlayableOutput_t9809407FDE5B55DD34088A665C8C53346AC76EE8
{
public:
// UnityEngine.Playables.PlayableOutputHandle UnityEngine.Audio.AudioPlayableOutput::m_Handle
PlayableOutputHandle_t8C84BCDB2AECFEDBCF0E7CC7CDBADD517D148CD1 ___m_Handle_0;
public:
inline static int32_t get_offset_of_m_Handle_0() { return static_cast<int32_t>(offsetof(AudioPlayableOutput_t9809407FDE5B55DD34088A665C8C53346AC76EE8, ___m_Handle_0)); }
inline PlayableOutputHandle_t8C84BCDB2AECFEDBCF0E7CC7CDBADD517D148CD1 get_m_Handle_0() const { return ___m_Handle_0; }
inline PlayableOutputHandle_t8C84BCDB2AECFEDBCF0E7CC7CDBADD517D148CD1 * get_address_of_m_Handle_0() { return &___m_Handle_0; }
inline void set_m_Handle_0(PlayableOutputHandle_t8C84BCDB2AECFEDBCF0E7CC7CDBADD517D148CD1 value)
{
___m_Handle_0 = value;
}
};
// UnityEngine.Component
struct Component_t62FBC8D2420DA4BE9037AFE430740F6B3EECA684 : public Object_tF2F3778131EFF286AF62B7B013A170F95A91571A
{
public:
public:
};
// System.MulticastDelegate
struct MulticastDelegate_t : public Delegate_t
{
public:
// System.Delegate[] System.MulticastDelegate::delegates
DelegateU5BU5D_t677D8FE08A5F99E8EE49150B73966CD6E9BF7DB8* ___delegates_11;
public:
inline static int32_t get_offset_of_delegates_11() { return static_cast<int32_t>(offsetof(MulticastDelegate_t, ___delegates_11)); }
inline DelegateU5BU5D_t677D8FE08A5F99E8EE49150B73966CD6E9BF7DB8* get_delegates_11() const { return ___delegates_11; }
inline DelegateU5BU5D_t677D8FE08A5F99E8EE49150B73966CD6E9BF7DB8** get_address_of_delegates_11() { return &___delegates_11; }
inline void set_delegates_11(DelegateU5BU5D_t677D8FE08A5F99E8EE49150B73966CD6E9BF7DB8* value)
{
___delegates_11 = value;
Il2CppCodeGenWriteBarrier((void**)(&___delegates_11), (void*)value);
}
};
// Native definition for P/Invoke marshalling of System.MulticastDelegate
struct MulticastDelegate_t_marshaled_pinvoke : public Delegate_t_marshaled_pinvoke
{
Delegate_t_marshaled_pinvoke** ___delegates_11;
};
// Native definition for COM marshalling of System.MulticastDelegate
struct MulticastDelegate_t_marshaled_com : public Delegate_t_marshaled_com
{
Delegate_t_marshaled_com** ___delegates_11;
};
// System.Action`1<System.Boolean>
struct Action_1_tCE2D770918A65CAD277C08C4E8C05385EA267E83 : public MulticastDelegate_t
{
public:
public:
};
// UnityEngine.Behaviour
struct Behaviour_t1A3DDDCF73B4627928FBFE02ED52B7251777DBD9 : public Component_t62FBC8D2420DA4BE9037AFE430740F6B3EECA684
{
public:
public:
};
// UnityEngine.AudioClip/PCMReaderCallback
struct PCMReaderCallback_t9CA1437D36509A9FAC5EDD8FF2BC3259C24D0E0B : public MulticastDelegate_t
{
public:
public:
};
// UnityEngine.AudioClip/PCMSetPositionCallback
struct PCMSetPositionCallback_tBDD99E7C0697687F1E7B06CDD5DE444A3709CF4C : public MulticastDelegate_t
{
public:
public:
};
// UnityEngine.Experimental.Audio.AudioSampleProvider/SampleFramesHandler
struct SampleFramesHandler_tCF0215103F7BD1AD5397731D86079D6E68AC9487 : public MulticastDelegate_t
{
public:
public:
};
// UnityEngine.AudioSettings/AudioConfigurationChangeHandler
struct AudioConfigurationChangeHandler_t1A997C51DF7B553A94DAD358F8D968308994774A : public MulticastDelegate_t
{
public:
public:
};
// UnityEngine.AudioBehaviour
struct AudioBehaviour_tB44966D47AD43C50C7294AEE9B57574E55AACA4A : public Behaviour_t1A3DDDCF73B4627928FBFE02ED52B7251777DBD9
{
public:
public:
};
// UnityEngine.AudioListener
struct AudioListener_t03B51B434A263F9AFD07AC8AA5CB4FE6402252A3 : public AudioBehaviour_tB44966D47AD43C50C7294AEE9B57574E55AACA4A
{
public:
public:
};
// UnityEngine.AudioSource
struct AudioSource_tC4BF65AF8CDCAA63724BB3CA59A7A29249269E6B : public AudioBehaviour_tB44966D47AD43C50C7294AEE9B57574E55AACA4A
{
public:
public:
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
// System.Single[]
struct SingleU5BU5D_t47E8DBF5B597C122478D1FFBD9DD57399A0650FA : public RuntimeArray
{
public:
ALIGN_FIELD (8) float m_Items[1];
public:
inline float GetAt(il2cpp_array_size_t index) const
{
IL2CPP_ARRAY_BOUNDS_CHECK(index, (uint32_t)(this)->max_length);
return m_Items[index];
}
inline float* GetAddressAt(il2cpp_array_size_t index)
{
IL2CPP_ARRAY_BOUNDS_CHECK(index, (uint32_t)(this)->max_length);
return m_Items + index;
}
inline void SetAt(il2cpp_array_size_t index, float value)
{
IL2CPP_ARRAY_BOUNDS_CHECK(index, (uint32_t)(this)->max_length);
m_Items[index] = value;
}
inline float GetAtUnchecked(il2cpp_array_size_t index) const
{
return m_Items[index];
}
inline float* GetAddressAtUnchecked(il2cpp_array_size_t index)
{
return m_Items + index;
}
inline void SetAtUnchecked(il2cpp_array_size_t index, float value)
{
m_Items[index] = value;
}
};
// System.Delegate[]
struct DelegateU5BU5D_t677D8FE08A5F99E8EE49150B73966CD6E9BF7DB8 : public RuntimeArray
{
public:
ALIGN_FIELD (8) Delegate_t * m_Items[1];
public:
inline Delegate_t * GetAt(il2cpp_array_size_t index) const
{
IL2CPP_ARRAY_BOUNDS_CHECK(index, (uint32_t)(this)->max_length);
return m_Items[index];
}
inline Delegate_t ** GetAddressAt(il2cpp_array_size_t index)
{
IL2CPP_ARRAY_BOUNDS_CHECK(index, (uint32_t)(this)->max_length);
return m_Items + index;
}
inline void SetAt(il2cpp_array_size_t index, Delegate_t * value)
{
IL2CPP_ARRAY_BOUNDS_CHECK(index, (uint32_t)(this)->max_length);
m_Items[index] = value;
Il2CppCodeGenWriteBarrier((void**)m_Items + index, (void*)value);
}
inline Delegate_t * GetAtUnchecked(il2cpp_array_size_t index) const
{
return m_Items[index];
}
inline Delegate_t ** GetAddressAtUnchecked(il2cpp_array_size_t index)
{
return m_Items + index;
}
inline void SetAtUnchecked(il2cpp_array_size_t index, Delegate_t * value)
{
m_Items[index] = value;
Il2CppCodeGenWriteBarrier((void**)m_Items + index, (void*)value);
}
};
// System.Void System.Action`1<System.Boolean>::Invoke(!0)
IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR void Action_1_Invoke_m94B1D693386EA0BD3C636939BDCE375EDEF91A04_gshared (Action_1_tCE2D770918A65CAD277C08C4E8C05385EA267E83 * __this, bool ___obj0, const RuntimeMethod* method);
// System.Void UnityEngine.AudioClip/PCMReaderCallback::Invoke(System.Single[])
IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR void PCMReaderCallback_Invoke_mE5E7A777A52B9627F9A6A57A140E5C4AAB5A1387 (PCMReaderCallback_t9CA1437D36509A9FAC5EDD8FF2BC3259C24D0E0B * __this, SingleU5BU5D_t47E8DBF5B597C122478D1FFBD9DD57399A0650FA* ___data0, const RuntimeMethod* method);
// System.Void UnityEngine.AudioClip/PCMSetPositionCallback::Invoke(System.Int32)
IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR void PCMSetPositionCallback_Invoke_m1FBFFA5FC15B57601D6D13F4A574F7CAD2A93B7E (PCMSetPositionCallback_tBDD99E7C0697687F1E7B06CDD5DE444A3709CF4C * __this, int32_t ___position0, const RuntimeMethod* method);
// UnityEngine.Playables.PlayableHandle UnityEngine.Audio.AudioClipPlayable::GetHandle()
IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR PlayableHandle_t50DCD240B0400DDAD0822C13E5DBC7AD64DC027A AudioClipPlayable_GetHandle_mBEB846B088961170B6DB961951B511C11B98E0B8 (AudioClipPlayable_t3574B22284CE09FDEAD15BD18D66C4A21D59FA5F * __this, const RuntimeMethod* method);
// System.Boolean UnityEngine.Playables.PlayableHandle::op_Equality(UnityEngine.Playables.PlayableHandle,UnityEngine.Playables.PlayableHandle)
IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR bool PlayableHandle_op_Equality_mFD26CFA8ECF2B622B1A3D4117066CAE965C9F704 (PlayableHandle_t50DCD240B0400DDAD0822C13E5DBC7AD64DC027A ___x0, PlayableHandle_t50DCD240B0400DDAD0822C13E5DBC7AD64DC027A ___y1, const RuntimeMethod* method);
// System.Boolean UnityEngine.Audio.AudioClipPlayable::Equals(UnityEngine.Audio.AudioClipPlayable)
IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR bool AudioClipPlayable_Equals_m52ECDD49AE6BD8AB4C0AC83C417A0C1B23E3E55E (AudioClipPlayable_t3574B22284CE09FDEAD15BD18D66C4A21D59FA5F * __this, AudioClipPlayable_t3574B22284CE09FDEAD15BD18D66C4A21D59FA5F ___other0, const RuntimeMethod* method);
// UnityEngine.Playables.PlayableHandle UnityEngine.Audio.AudioMixerPlayable::GetHandle()
IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR PlayableHandle_t50DCD240B0400DDAD0822C13E5DBC7AD64DC027A AudioMixerPlayable_GetHandle_m76EFC486A7639C4842F590F544B60988CF27BB17 (AudioMixerPlayable_t80531461F1E238E237D7BB2BAE7E031ABDE95C4A * __this, const RuntimeMethod* method);
// System.Boolean UnityEngine.Audio.AudioMixerPlayable::Equals(UnityEngine.Audio.AudioMixerPlayable)
IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR bool AudioMixerPlayable_Equals_mB55D2602ACCD196F61AF3D1AE90B81930A9AB7E8 (AudioMixerPlayable_t80531461F1E238E237D7BB2BAE7E031ABDE95C4A * __this, AudioMixerPlayable_t80531461F1E238E237D7BB2BAE7E031ABDE95C4A ___other0, const RuntimeMethod* method);
// System.Void UnityEngine.Experimental.Audio.AudioSampleProvider/SampleFramesHandler::Invoke(UnityEngine.Experimental.Audio.AudioSampleProvider,System.UInt32)
IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR void SampleFramesHandler_Invoke_mCB6172CE3EF20C5E12A697A5CE5EEDED9A3B5779 (SampleFramesHandler_tCF0215103F7BD1AD5397731D86079D6E68AC9487 * __this, AudioSampleProvider_tD8B613D55D09D6CE86B851A5D8F33560FFCC705B * ___provider0, uint32_t ___sampleFrameCount1, const RuntimeMethod* method);
// System.Void UnityEngine.AudioSettings/AudioConfigurationChangeHandler::Invoke(System.Boolean)
IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR void AudioConfigurationChangeHandler_Invoke_mDC001A19067B6A02B0DE21A4D66FC8D82529F911 (AudioConfigurationChangeHandler_t1A997C51DF7B553A94DAD358F8D968308994774A * __this, bool ___deviceWasChanged0, const RuntimeMethod* method);
// System.Boolean UnityEngine.AudioSettings/Mobile::get_muteState()
IL2CPP_MANAGED_FORCE_INLINE IL2CPP_METHOD_ATTR bool Mobile_get_muteState_m692B429F6C1592C72DCCDCD2A00BF126BC51F6EF_inline (const RuntimeMethod* method);
// System.Void UnityEngine.AudioSettings/Mobile::set_muteState(System.Boolean)
IL2CPP_MANAGED_FORCE_INLINE IL2CPP_METHOD_ATTR void Mobile_set_muteState_mA43DEFC30F87157C7E0030B009DD8C8D0CC422F6_inline (bool ___value0, const RuntimeMethod* method);
// System.Boolean UnityEngine.AudioSettings/Mobile::get_stopAudioOutputOnMute()
IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR bool Mobile_get_stopAudioOutputOnMute_m0FCE9C6EF6597B73D4C36AB361403093A4A2CC23 (const RuntimeMethod* method);
// System.Void UnityEngine.AudioSettings/Mobile::StopAudioOutput()
IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR void Mobile_StopAudioOutput_m724EB5F22195200EA75828AAA436CE13A1B9989E (const RuntimeMethod* method);
// System.Void UnityEngine.AudioSettings/Mobile::StartAudioOutput()
IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR void Mobile_StartAudioOutput_m3F2C349725ED8D6AA8C8223651658814D312FE09 (const RuntimeMethod* method);
// System.Void System.Action`1<System.Boolean>::Invoke(!0)
inline void Action_1_Invoke_m94B1D693386EA0BD3C636939BDCE375EDEF91A04 (Action_1_tCE2D770918A65CAD277C08C4E8C05385EA267E83 * __this, bool ___obj0, const RuntimeMethod* method)
{
(( void (*) (Action_1_tCE2D770918A65CAD277C08C4E8C05385EA267E83 *, bool, const RuntimeMethod*))Action_1_Invoke_m94B1D693386EA0BD3C636939BDCE375EDEF91A04_gshared)(__this, ___obj0, method);
}
// System.Boolean UnityEngine.AudioSettings::StartAudioOutput()
IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR bool AudioSettings_StartAudioOutput_m372FC1B86734F04E2AAE161E2A70F3E5E8FCE583 (const RuntimeMethod* method);
// System.Boolean UnityEngine.AudioSettings::StopAudioOutput()
IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR bool AudioSettings_StopAudioOutput_m5012E0AC92B63A7E23C7EBFE9A0F0EA3FA03C5A6 (const RuntimeMethod* method);
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// System.Void UnityEngine.AudioClip::InvokePCMReaderCallback_Internal(System.Single[])
IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR void AudioClip_InvokePCMReaderCallback_Internal_m9CB2976CDC2C73A92479F8C11C30B17FAA05751F (AudioClip_t16D2E573E7CC1C5118D8EE0F0692D46866A1C0EE * __this, SingleU5BU5D_t47E8DBF5B597C122478D1FFBD9DD57399A0650FA* ___data0, const RuntimeMethod* method)
{
bool V_0 = false;
{
PCMReaderCallback_t9CA1437D36509A9FAC5EDD8FF2BC3259C24D0E0B * L_0 = __this->get_m_PCMReaderCallback_4();
V_0 = (bool)((!(((RuntimeObject*)(PCMReaderCallback_t9CA1437D36509A9FAC5EDD8FF2BC3259C24D0E0B *)L_0) <= ((RuntimeObject*)(RuntimeObject *)NULL)))? 1 : 0);
bool L_1 = V_0;
if (!L_1)
{
goto IL_001b;
}
}
{
PCMReaderCallback_t9CA1437D36509A9FAC5EDD8FF2BC3259C24D0E0B * L_2 = __this->get_m_PCMReaderCallback_4();
SingleU5BU5D_t47E8DBF5B597C122478D1FFBD9DD57399A0650FA* L_3 = ___data0;
NullCheck(L_2);
PCMReaderCallback_Invoke_mE5E7A777A52B9627F9A6A57A140E5C4AAB5A1387(L_2, L_3, /*hidden argument*/NULL);
}
IL_001b:
{
return;
}
}
// System.Void UnityEngine.AudioClip::InvokePCMSetPositionCallback_Internal(System.Int32)
IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR void AudioClip_InvokePCMSetPositionCallback_Internal_m9F3ACF3A244349568C0D0D1D40EE72EF013FB45D (AudioClip_t16D2E573E7CC1C5118D8EE0F0692D46866A1C0EE * __this, int32_t ___position0, const RuntimeMethod* method)
{
bool V_0 = false;
{
PCMSetPositionCallback_tBDD99E7C0697687F1E7B06CDD5DE444A3709CF4C * L_0 = __this->get_m_PCMSetPositionCallback_5();
V_0 = (bool)((!(((RuntimeObject*)(PCMSetPositionCallback_tBDD99E7C0697687F1E7B06CDD5DE444A3709CF4C *)L_0) <= ((RuntimeObject*)(RuntimeObject *)NULL)))? 1 : 0);
bool L_1 = V_0;
if (!L_1)
{
goto IL_001b;
}
}
{
PCMSetPositionCallback_tBDD99E7C0697687F1E7B06CDD5DE444A3709CF4C * L_2 = __this->get_m_PCMSetPositionCallback_5();
int32_t L_3 = ___position0;
NullCheck(L_2);
PCMSetPositionCallback_Invoke_m1FBFFA5FC15B57601D6D13F4A574F7CAD2A93B7E(L_2, L_3, /*hidden argument*/NULL);
}
IL_001b:
{
return;
}
}
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.Playables.PlayableHandle UnityEngine.Audio.AudioClipPlayable::GetHandle()
IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR PlayableHandle_t50DCD240B0400DDAD0822C13E5DBC7AD64DC027A AudioClipPlayable_GetHandle_mBEB846B088961170B6DB961951B511C11B98E0B8 (AudioClipPlayable_t3574B22284CE09FDEAD15BD18D66C4A21D59FA5F * __this, const RuntimeMethod* method)
{
PlayableHandle_t50DCD240B0400DDAD0822C13E5DBC7AD64DC027A V_0;
memset((&V_0), 0, sizeof(V_0));
{
PlayableHandle_t50DCD240B0400DDAD0822C13E5DBC7AD64DC027A L_0 = __this->get_m_Handle_0();
V_0 = L_0;
goto IL_000a;
}
IL_000a:
{
PlayableHandle_t50DCD240B0400DDAD0822C13E5DBC7AD64DC027A L_1 = V_0;
return L_1;
}
}
IL2CPP_EXTERN_C PlayableHandle_t50DCD240B0400DDAD0822C13E5DBC7AD64DC027A AudioClipPlayable_GetHandle_mBEB846B088961170B6DB961951B511C11B98E0B8_AdjustorThunk (RuntimeObject * __this, const RuntimeMethod* method)
{
AudioClipPlayable_t3574B22284CE09FDEAD15BD18D66C4A21D59FA5F * _thisAdjusted;
int32_t _offset = 1;
_thisAdjusted = reinterpret_cast<AudioClipPlayable_t3574B22284CE09FDEAD15BD18D66C4A21D59FA5F *>(__this + _offset);
PlayableHandle_t50DCD240B0400DDAD0822C13E5DBC7AD64DC027A _returnValue;
_returnValue = AudioClipPlayable_GetHandle_mBEB846B088961170B6DB961951B511C11B98E0B8(_thisAdjusted, method);
return _returnValue;
}
// System.Boolean UnityEngine.Audio.AudioClipPlayable::Equals(UnityEngine.Audio.AudioClipPlayable)
IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR bool AudioClipPlayable_Equals_m52ECDD49AE6BD8AB4C0AC83C417A0C1B23E3E55E (AudioClipPlayable_t3574B22284CE09FDEAD15BD18D66C4A21D59FA5F * __this, AudioClipPlayable_t3574B22284CE09FDEAD15BD18D66C4A21D59FA5F ___other0, const RuntimeMethod* method)
{
static bool s_Il2CppMethodInitialized;
if (!s_Il2CppMethodInitialized)
{
il2cpp_codegen_initialize_runtime_metadata((uintptr_t*)&PlayableHandle_t50DCD240B0400DDAD0822C13E5DBC7AD64DC027A_il2cpp_TypeInfo_var);
s_Il2CppMethodInitialized = true;
}
bool V_0 = false;
{
PlayableHandle_t50DCD240B0400DDAD0822C13E5DBC7AD64DC027A L_0;
L_0 = AudioClipPlayable_GetHandle_mBEB846B088961170B6DB961951B511C11B98E0B8((AudioClipPlayable_t3574B22284CE09FDEAD15BD18D66C4A21D59FA5F *)__this, /*hidden argument*/NULL);
PlayableHandle_t50DCD240B0400DDAD0822C13E5DBC7AD64DC027A L_1;
L_1 = AudioClipPlayable_GetHandle_mBEB846B088961170B6DB961951B511C11B98E0B8((AudioClipPlayable_t3574B22284CE09FDEAD15BD18D66C4A21D59FA5F *)(&___other0), /*hidden argument*/NULL);
IL2CPP_RUNTIME_CLASS_INIT(PlayableHandle_t50DCD240B0400DDAD0822C13E5DBC7AD64DC027A_il2cpp_TypeInfo_var);
bool L_2;
L_2 = PlayableHandle_op_Equality_mFD26CFA8ECF2B622B1A3D4117066CAE965C9F704(L_0, L_1, /*hidden argument*/NULL);
V_0 = L_2;
goto IL_0016;
}
IL_0016:
{
bool L_3 = V_0;
return L_3;
}
}
IL2CPP_EXTERN_C bool AudioClipPlayable_Equals_m52ECDD49AE6BD8AB4C0AC83C417A0C1B23E3E55E_AdjustorThunk (RuntimeObject * __this, AudioClipPlayable_t3574B22284CE09FDEAD15BD18D66C4A21D59FA5F ___other0, const RuntimeMethod* method)
{
AudioClipPlayable_t3574B22284CE09FDEAD15BD18D66C4A21D59FA5F * _thisAdjusted;
int32_t _offset = 1;
_thisAdjusted = reinterpret_cast<AudioClipPlayable_t3574B22284CE09FDEAD15BD18D66C4A21D59FA5F *>(__this + _offset);
bool _returnValue;
_returnValue = AudioClipPlayable_Equals_m52ECDD49AE6BD8AB4C0AC83C417A0C1B23E3E55E(_thisAdjusted, ___other0, method);
return _returnValue;
}
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.Playables.PlayableHandle UnityEngine.Audio.AudioMixerPlayable::GetHandle()
IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR PlayableHandle_t50DCD240B0400DDAD0822C13E5DBC7AD64DC027A AudioMixerPlayable_GetHandle_m76EFC486A7639C4842F590F544B60988CF27BB17 (AudioMixerPlayable_t80531461F1E238E237D7BB2BAE7E031ABDE95C4A * __this, const RuntimeMethod* method)
{
PlayableHandle_t50DCD240B0400DDAD0822C13E5DBC7AD64DC027A V_0;
memset((&V_0), 0, sizeof(V_0));
{
PlayableHandle_t50DCD240B0400DDAD0822C13E5DBC7AD64DC027A L_0 = __this->get_m_Handle_0();
V_0 = L_0;
goto IL_000a;
}
IL_000a:
{
PlayableHandle_t50DCD240B0400DDAD0822C13E5DBC7AD64DC027A L_1 = V_0;
return L_1;
}
}
IL2CPP_EXTERN_C PlayableHandle_t50DCD240B0400DDAD0822C13E5DBC7AD64DC027A AudioMixerPlayable_GetHandle_m76EFC486A7639C4842F590F544B60988CF27BB17_AdjustorThunk (RuntimeObject * __this, const RuntimeMethod* method)
{
AudioMixerPlayable_t80531461F1E238E237D7BB2BAE7E031ABDE95C4A * _thisAdjusted;
int32_t _offset = 1;
_thisAdjusted = reinterpret_cast<AudioMixerPlayable_t80531461F1E238E237D7BB2BAE7E031ABDE95C4A *>(__this + _offset);
PlayableHandle_t50DCD240B0400DDAD0822C13E5DBC7AD64DC027A _returnValue;
_returnValue = AudioMixerPlayable_GetHandle_m76EFC486A7639C4842F590F544B60988CF27BB17(_thisAdjusted, method);
return _returnValue;
}
// System.Boolean UnityEngine.Audio.AudioMixerPlayable::Equals(UnityEngine.Audio.AudioMixerPlayable)
IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR bool AudioMixerPlayable_Equals_mB55D2602ACCD196F61AF3D1AE90B81930A9AB7E8 (AudioMixerPlayable_t80531461F1E238E237D7BB2BAE7E031ABDE95C4A * __this, AudioMixerPlayable_t80531461F1E238E237D7BB2BAE7E031ABDE95C4A ___other0, const RuntimeMethod* method)
{
static bool s_Il2CppMethodInitialized;
if (!s_Il2CppMethodInitialized)
{
il2cpp_codegen_initialize_runtime_metadata((uintptr_t*)&PlayableHandle_t50DCD240B0400DDAD0822C13E5DBC7AD64DC027A_il2cpp_TypeInfo_var);
s_Il2CppMethodInitialized = true;
}
bool V_0 = false;
{
PlayableHandle_t50DCD240B0400DDAD0822C13E5DBC7AD64DC027A L_0;
L_0 = AudioMixerPlayable_GetHandle_m76EFC486A7639C4842F590F544B60988CF27BB17((AudioMixerPlayable_t80531461F1E238E237D7BB2BAE7E031ABDE95C4A *)__this, /*hidden argument*/NULL);
PlayableHandle_t50DCD240B0400DDAD0822C13E5DBC7AD64DC027A L_1;
L_1 = AudioMixerPlayable_GetHandle_m76EFC486A7639C4842F590F544B60988CF27BB17((AudioMixerPlayable_t80531461F1E238E237D7BB2BAE7E031ABDE95C4A *)(&___other0), /*hidden argument*/NULL);
IL2CPP_RUNTIME_CLASS_INIT(PlayableHandle_t50DCD240B0400DDAD0822C13E5DBC7AD64DC027A_il2cpp_TypeInfo_var);
bool L_2;
L_2 = PlayableHandle_op_Equality_mFD26CFA8ECF2B622B1A3D4117066CAE965C9F704(L_0, L_1, /*hidden argument*/NULL);
V_0 = L_2;
goto IL_0016;
}
IL_0016:
{
bool L_3 = V_0;
return L_3;
}
}
IL2CPP_EXTERN_C bool AudioMixerPlayable_Equals_mB55D2602ACCD196F61AF3D1AE90B81930A9AB7E8_AdjustorThunk (RuntimeObject * __this, AudioMixerPlayable_t80531461F1E238E237D7BB2BAE7E031ABDE95C4A ___other0, const RuntimeMethod* method)
{
AudioMixerPlayable_t80531461F1E238E237D7BB2BAE7E031ABDE95C4A * _thisAdjusted;
int32_t _offset = 1;
_thisAdjusted = reinterpret_cast<AudioMixerPlayable_t80531461F1E238E237D7BB2BAE7E031ABDE95C4A *>(__this + _offset);
bool _returnValue;
_returnValue = AudioMixerPlayable_Equals_mB55D2602ACCD196F61AF3D1AE90B81930A9AB7E8(_thisAdjusted, ___other0, method);
return _returnValue;
}
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// System.Void UnityEngine.Experimental.Audio.AudioSampleProvider::InvokeSampleFramesAvailable(System.Int32)
IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR void AudioSampleProvider_InvokeSampleFramesAvailable_mE6689CFA13C0621F305F389FEEE4D543B71BF236 (AudioSampleProvider_tD8B613D55D09D6CE86B851A5D8F33560FFCC705B * __this, int32_t ___sampleFrameCount0, const RuntimeMethod* method)
{
bool V_0 = false;
{
SampleFramesHandler_tCF0215103F7BD1AD5397731D86079D6E68AC9487 * L_0 = __this->get_sampleFramesAvailable_0();
V_0 = (bool)((!(((RuntimeObject*)(SampleFramesHandler_tCF0215103F7BD1AD5397731D86079D6E68AC9487 *)L_0) <= ((RuntimeObject*)(RuntimeObject *)NULL)))? 1 : 0);
bool L_1 = V_0;
if (!L_1)
{
goto IL_001c;
}
}
{
SampleFramesHandler_tCF0215103F7BD1AD5397731D86079D6E68AC9487 * L_2 = __this->get_sampleFramesAvailable_0();
int32_t L_3 = ___sampleFrameCount0;
NullCheck(L_2);
SampleFramesHandler_Invoke_mCB6172CE3EF20C5E12A697A5CE5EEDED9A3B5779(L_2, __this, L_3, /*hidden argument*/NULL);
}
IL_001c:
{
return;
}
}
// System.Void UnityEngine.Experimental.Audio.AudioSampleProvider::InvokeSampleFramesOverflow(System.Int32)
IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR void AudioSampleProvider_InvokeSampleFramesOverflow_m998BEADD2A2B4BEF0906A31108B6DC486411CC78 (AudioSampleProvider_tD8B613D55D09D6CE86B851A5D8F33560FFCC705B * __this, int32_t ___droppedSampleFrameCount0, const RuntimeMethod* method)
{
bool V_0 = false;
{
SampleFramesHandler_tCF0215103F7BD1AD5397731D86079D6E68AC9487 * L_0 = __this->get_sampleFramesOverflow_1();
V_0 = (bool)((!(((RuntimeObject*)(SampleFramesHandler_tCF0215103F7BD1AD5397731D86079D6E68AC9487 *)L_0) <= ((RuntimeObject*)(RuntimeObject *)NULL)))? 1 : 0);
bool L_1 = V_0;
if (!L_1)
{
goto IL_001c;
}
}
{
SampleFramesHandler_tCF0215103F7BD1AD5397731D86079D6E68AC9487 * L_2 = __this->get_sampleFramesOverflow_1();
int32_t L_3 = ___droppedSampleFrameCount0;
NullCheck(L_2);
SampleFramesHandler_Invoke_mCB6172CE3EF20C5E12A697A5CE5EEDED9A3B5779(L_2, __this, L_3, /*hidden argument*/NULL);
}
IL_001c:
{
return;
}
}
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// System.Void UnityEngine.AudioSettings::InvokeOnAudioConfigurationChanged(System.Boolean)
IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR void AudioSettings_InvokeOnAudioConfigurationChanged_m2CBD1FC39E7AE46E07E777990310D1DC40FB980E (bool ___deviceWasChanged0, const RuntimeMethod* method)
{
static bool s_Il2CppMethodInitialized;
if (!s_Il2CppMethodInitialized)
{
il2cpp_codegen_initialize_runtime_metadata((uintptr_t*)&AudioSettings_t1941E7DE9FEF65F7742713EB862D3025244FCB08_il2cpp_TypeInfo_var);
s_Il2CppMethodInitialized = true;
}
bool V_0 = false;
{
AudioConfigurationChangeHandler_t1A997C51DF7B553A94DAD358F8D968308994774A * L_0 = ((AudioSettings_t1941E7DE9FEF65F7742713EB862D3025244FCB08_StaticFields*)il2cpp_codegen_static_fields_for(AudioSettings_t1941E7DE9FEF65F7742713EB862D3025244FCB08_il2cpp_TypeInfo_var))->get_OnAudioConfigurationChanged_0();
V_0 = (bool)((!(((RuntimeObject*)(AudioConfigurationChangeHandler_t1A997C51DF7B553A94DAD358F8D968308994774A *)L_0) <= ((RuntimeObject*)(RuntimeObject *)NULL)))? 1 : 0);
bool L_1 = V_0;
if (!L_1)
{
goto IL_0019;
}
}
{
AudioConfigurationChangeHandler_t1A997C51DF7B553A94DAD358F8D968308994774A * L_2 = ((AudioSettings_t1941E7DE9FEF65F7742713EB862D3025244FCB08_StaticFields*)il2cpp_codegen_static_fields_for(AudioSettings_t1941E7DE9FEF65F7742713EB862D3025244FCB08_il2cpp_TypeInfo_var))->get_OnAudioConfigurationChanged_0();
bool L_3 = ___deviceWasChanged0;
NullCheck(L_2);
AudioConfigurationChangeHandler_Invoke_mDC001A19067B6A02B0DE21A4D66FC8D82529F911(L_2, L_3, /*hidden argument*/NULL);
}
IL_0019:
{
return;
}
}
// System.Boolean UnityEngine.AudioSettings::StartAudioOutput()
IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR bool AudioSettings_StartAudioOutput_m372FC1B86734F04E2AAE161E2A70F3E5E8FCE583 (const RuntimeMethod* method)
{
typedef bool (*AudioSettings_StartAudioOutput_m372FC1B86734F04E2AAE161E2A70F3E5E8FCE583_ftn) ();
static AudioSettings_StartAudioOutput_m372FC1B86734F04E2AAE161E2A70F3E5E8FCE583_ftn _il2cpp_icall_func;
if (!_il2cpp_icall_func)
_il2cpp_icall_func = (AudioSettings_StartAudioOutput_m372FC1B86734F04E2AAE161E2A70F3E5E8FCE583_ftn)il2cpp_codegen_resolve_icall ("UnityEngine.AudioSettings::StartAudioOutput()");
bool icallRetVal = _il2cpp_icall_func();
return icallRetVal;
}
// System.Boolean UnityEngine.AudioSettings::StopAudioOutput()
IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR bool AudioSettings_StopAudioOutput_m5012E0AC92B63A7E23C7EBFE9A0F0EA3FA03C5A6 (const RuntimeMethod* method)
{
typedef bool (*AudioSettings_StopAudioOutput_m5012E0AC92B63A7E23C7EBFE9A0F0EA3FA03C5A6_ftn) ();
static AudioSettings_StopAudioOutput_m5012E0AC92B63A7E23C7EBFE9A0F0EA3FA03C5A6_ftn _il2cpp_icall_func;
if (!_il2cpp_icall_func)
_il2cpp_icall_func = (AudioSettings_StopAudioOutput_m5012E0AC92B63A7E23C7EBFE9A0F0EA3FA03C5A6_ftn)il2cpp_codegen_resolve_icall ("UnityEngine.AudioSettings::StopAudioOutput()");
bool icallRetVal = _il2cpp_icall_func();
return icallRetVal;
}
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
IL2CPP_EXTERN_C void DelegatePInvokeWrapper_PCMReaderCallback_t9CA1437D36509A9FAC5EDD8FF2BC3259C24D0E0B (PCMReaderCallback_t9CA1437D36509A9FAC5EDD8FF2BC3259C24D0E0B * __this, SingleU5BU5D_t47E8DBF5B597C122478D1FFBD9DD57399A0650FA* ___data0, const RuntimeMethod* method)
{
typedef void (DEFAULT_CALL *PInvokeFunc)(float*);
PInvokeFunc il2cppPInvokeFunc = reinterpret_cast<PInvokeFunc>(((RuntimeDelegate*)__this)->method->nativeFunction);
// Marshaling of parameter '___data0' to native representation
float* ____data0_marshaled = NULL;
if (___data0 != NULL)
{
____data0_marshaled = reinterpret_cast<float*>((___data0)->GetAddressAtUnchecked(0));
}
// Native function invocation
il2cppPInvokeFunc(____data0_marshaled);
}
// System.Void UnityEngine.AudioClip/PCMReaderCallback::.ctor(System.Object,System.IntPtr)
IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR void PCMReaderCallback__ctor_mCA9CC5271DE0E4083B85759CA74EED1C1CD219F7 (PCMReaderCallback_t9CA1437D36509A9FAC5EDD8FF2BC3259C24D0E0B * __this, RuntimeObject * ___object0, intptr_t ___method1, const RuntimeMethod* method)
{
__this->set_method_ptr_0(il2cpp_codegen_get_method_pointer((RuntimeMethod*)___method1));
__this->set_method_3(___method1);
__this->set_m_target_2(___object0);
}
// System.Void UnityEngine.AudioClip/PCMReaderCallback::Invoke(System.Single[])
IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR void PCMReaderCallback_Invoke_mE5E7A777A52B9627F9A6A57A140E5C4AAB5A1387 (PCMReaderCallback_t9CA1437D36509A9FAC5EDD8FF2BC3259C24D0E0B * __this, SingleU5BU5D_t47E8DBF5B597C122478D1FFBD9DD57399A0650FA* ___data0, const RuntimeMethod* method)
{
DelegateU5BU5D_t677D8FE08A5F99E8EE49150B73966CD6E9BF7DB8* delegateArrayToInvoke = __this->get_delegates_11();
Delegate_t** delegatesToInvoke;
il2cpp_array_size_t length;
if (delegateArrayToInvoke != NULL)
{
length = delegateArrayToInvoke->max_length;
delegatesToInvoke = reinterpret_cast<Delegate_t**>(delegateArrayToInvoke->GetAddressAtUnchecked(0));
}
else
{
length = 1;
delegatesToInvoke = reinterpret_cast<Delegate_t**>(&__this);
}
for (il2cpp_array_size_t i = 0; i < length; i++)
{
Delegate_t* currentDelegate = delegatesToInvoke[i];
Il2CppMethodPointer targetMethodPointer = currentDelegate->get_method_ptr_0();
RuntimeObject* targetThis = currentDelegate->get_m_target_2();
RuntimeMethod* targetMethod = (RuntimeMethod*)(currentDelegate->get_method_3());
if (!currentDelegate->get_method_is_virtual_10())
{
il2cpp_codegen_raise_execution_engine_exception_if_method_is_not_found(targetMethod);
}
bool ___methodIsStatic = MethodIsStatic(targetMethod);
int ___parameterCount = il2cpp_codegen_method_parameter_count(targetMethod);
if (___methodIsStatic)
{
if (___parameterCount == 1)
{
// open
typedef void (*FunctionPointerType) (SingleU5BU5D_t47E8DBF5B597C122478D1FFBD9DD57399A0650FA*, const RuntimeMethod*);
((FunctionPointerType)targetMethodPointer)(___data0, targetMethod);
}
else
{
// closed
typedef void (*FunctionPointerType) (void*, SingleU5BU5D_t47E8DBF5B597C122478D1FFBD9DD57399A0650FA*, const RuntimeMethod*);
((FunctionPointerType)targetMethodPointer)(targetThis, ___data0, targetMethod);
}
}
else if (___parameterCount != 1)
{
// open
if (currentDelegate->get_method_is_virtual_10())
{
if (il2cpp_codegen_method_is_generic_instance(targetMethod))
{
if (il2cpp_codegen_method_is_interface_method(targetMethod))
GenericInterfaceActionInvoker0::Invoke(targetMethod, ___data0);
else
GenericVirtualActionInvoker0::Invoke(targetMethod, ___data0);
}
else
{
if (il2cpp_codegen_method_is_interface_method(targetMethod))
InterfaceActionInvoker0::Invoke(il2cpp_codegen_method_get_slot(targetMethod), il2cpp_codegen_method_get_declaring_type(targetMethod), ___data0);
else
VirtualActionInvoker0::Invoke(il2cpp_codegen_method_get_slot(targetMethod), ___data0);
}
}
else
{
typedef void (*FunctionPointerType) (SingleU5BU5D_t47E8DBF5B597C122478D1FFBD9DD57399A0650FA*, const RuntimeMethod*);
((FunctionPointerType)targetMethodPointer)(___data0, targetMethod);
}
}
else
{
// closed
if (targetThis == NULL)
{
typedef void (*FunctionPointerType) (SingleU5BU5D_t47E8DBF5B597C122478D1FFBD9DD57399A0650FA*, const RuntimeMethod*);
((FunctionPointerType)targetMethodPointer)(___data0, targetMethod);
}
else
{
typedef void (*FunctionPointerType) (void*, SingleU5BU5D_t47E8DBF5B597C122478D1FFBD9DD57399A0650FA*, const RuntimeMethod*);
((FunctionPointerType)targetMethodPointer)(targetThis, ___data0, targetMethod);
}
}
}
}
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
IL2CPP_EXTERN_C void DelegatePInvokeWrapper_PCMSetPositionCallback_tBDD99E7C0697687F1E7B06CDD5DE444A3709CF4C (PCMSetPositionCallback_tBDD99E7C0697687F1E7B06CDD5DE444A3709CF4C * __this, int32_t ___position0, const RuntimeMethod* method)
{
typedef void (DEFAULT_CALL *PInvokeFunc)(int32_t);
PInvokeFunc il2cppPInvokeFunc = reinterpret_cast<PInvokeFunc>(((RuntimeDelegate*)__this)->method->nativeFunction);
// Native function invocation
il2cppPInvokeFunc(___position0);
}
// System.Void UnityEngine.AudioClip/PCMSetPositionCallback::.ctor(System.Object,System.IntPtr)
IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR void PCMSetPositionCallback__ctor_m0204C8557D7FB9E95F33168EDFD64182D9342002 (PCMSetPositionCallback_tBDD99E7C0697687F1E7B06CDD5DE444A3709CF4C * __this, RuntimeObject * ___object0, intptr_t ___method1, const RuntimeMethod* method)
{
__this->set_method_ptr_0(il2cpp_codegen_get_method_pointer((RuntimeMethod*)___method1));
__this->set_method_3(___method1);
__this->set_m_target_2(___object0);
}
// System.Void UnityEngine.AudioClip/PCMSetPositionCallback::Invoke(System.Int32)
IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR void PCMSetPositionCallback_Invoke_m1FBFFA5FC15B57601D6D13F4A574F7CAD2A93B7E (PCMSetPositionCallback_tBDD99E7C0697687F1E7B06CDD5DE444A3709CF4C * __this, int32_t ___position0, const RuntimeMethod* method)
{
DelegateU5BU5D_t677D8FE08A5F99E8EE49150B73966CD6E9BF7DB8* delegateArrayToInvoke = __this->get_delegates_11();
Delegate_t** delegatesToInvoke;
il2cpp_array_size_t length;
if (delegateArrayToInvoke != NULL)
{
length = delegateArrayToInvoke->max_length;
delegatesToInvoke = reinterpret_cast<Delegate_t**>(delegateArrayToInvoke->GetAddressAtUnchecked(0));
}
else
{
length = 1;
delegatesToInvoke = reinterpret_cast<Delegate_t**>(&__this);
}
for (il2cpp_array_size_t i = 0; i < length; i++)
{
Delegate_t* currentDelegate = delegatesToInvoke[i];
Il2CppMethodPointer targetMethodPointer = currentDelegate->get_method_ptr_0();
RuntimeObject* targetThis = currentDelegate->get_m_target_2();
RuntimeMethod* targetMethod = (RuntimeMethod*)(currentDelegate->get_method_3());
if (!currentDelegate->get_method_is_virtual_10())
{
il2cpp_codegen_raise_execution_engine_exception_if_method_is_not_found(targetMethod);
}
bool ___methodIsStatic = MethodIsStatic(targetMethod);
int ___parameterCount = il2cpp_codegen_method_parameter_count(targetMethod);
if (___methodIsStatic)
{
if (___parameterCount == 1)
{
// open
typedef void (*FunctionPointerType) (int32_t, const RuntimeMethod*);
((FunctionPointerType)targetMethodPointer)(___position0, targetMethod);
}
else
{
// closed
typedef void (*FunctionPointerType) (void*, int32_t, const RuntimeMethod*);
((FunctionPointerType)targetMethodPointer)(targetThis, ___position0, targetMethod);
}
}
else
{
// closed
typedef void (*FunctionPointerType) (void*, int32_t, const RuntimeMethod*);
((FunctionPointerType)targetMethodPointer)(targetThis, ___position0, targetMethod);
}
}
}
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// System.Void UnityEngine.Experimental.Audio.AudioSampleProvider/SampleFramesHandler::.ctor(System.Object,System.IntPtr)
IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR void SampleFramesHandler__ctor_m389B32B949592BFD1BA53D0C0983CA6B5BA6AAC7 (SampleFramesHandler_tCF0215103F7BD1AD5397731D86079D6E68AC9487 * __this, RuntimeObject * ___object0, intptr_t ___method1, const RuntimeMethod* method)
{
__this->set_method_ptr_0(il2cpp_codegen_get_method_pointer((RuntimeMethod*)___method1));
__this->set_method_3(___method1);
__this->set_m_target_2(___object0);
}
// System.Void UnityEngine.Experimental.Audio.AudioSampleProvider/SampleFramesHandler::Invoke(UnityEngine.Experimental.Audio.AudioSampleProvider,System.UInt32)
IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR void SampleFramesHandler_Invoke_mCB6172CE3EF20C5E12A697A5CE5EEDED9A3B5779 (SampleFramesHandler_tCF0215103F7BD1AD5397731D86079D6E68AC9487 * __this, AudioSampleProvider_tD8B613D55D09D6CE86B851A5D8F33560FFCC705B * ___provider0, uint32_t ___sampleFrameCount1, const RuntimeMethod* method)
{
DelegateU5BU5D_t677D8FE08A5F99E8EE49150B73966CD6E9BF7DB8* delegateArrayToInvoke = __this->get_delegates_11();
Delegate_t** delegatesToInvoke;
il2cpp_array_size_t length;
if (delegateArrayToInvoke != NULL)
{
length = delegateArrayToInvoke->max_length;
delegatesToInvoke = reinterpret_cast<Delegate_t**>(delegateArrayToInvoke->GetAddressAtUnchecked(0));
}
else
{
length = 1;
delegatesToInvoke = reinterpret_cast<Delegate_t**>(&__this);
}
for (il2cpp_array_size_t i = 0; i < length; i++)
{
Delegate_t* currentDelegate = delegatesToInvoke[i];
Il2CppMethodPointer targetMethodPointer = currentDelegate->get_method_ptr_0();
RuntimeObject* targetThis = currentDelegate->get_m_target_2();
RuntimeMethod* targetMethod = (RuntimeMethod*)(currentDelegate->get_method_3());
if (!currentDelegate->get_method_is_virtual_10())
{
il2cpp_codegen_raise_execution_engine_exception_if_method_is_not_found(targetMethod);
}
bool ___methodIsStatic = MethodIsStatic(targetMethod);
int ___parameterCount = il2cpp_codegen_method_parameter_count(targetMethod);
if (___methodIsStatic)
{
if (___parameterCount == 2)
{
// open
typedef void (*FunctionPointerType) (AudioSampleProvider_tD8B613D55D09D6CE86B851A5D8F33560FFCC705B *, uint32_t, const RuntimeMethod*);
((FunctionPointerType)targetMethodPointer)(___provider0, ___sampleFrameCount1, targetMethod);
}
else
{
// closed
typedef void (*FunctionPointerType) (void*, AudioSampleProvider_tD8B613D55D09D6CE86B851A5D8F33560FFCC705B *, uint32_t, const RuntimeMethod*);
((FunctionPointerType)targetMethodPointer)(targetThis, ___provider0, ___sampleFrameCount1, targetMethod);
}
}
else if (___parameterCount != 2)
{
// open
if (currentDelegate->get_method_is_virtual_10())
{
if (il2cpp_codegen_method_is_generic_instance(targetMethod))
{
if (il2cpp_codegen_method_is_interface_method(targetMethod))
GenericInterfaceActionInvoker1< uint32_t >::Invoke(targetMethod, ___provider0, ___sampleFrameCount1);
else
GenericVirtualActionInvoker1< uint32_t >::Invoke(targetMethod, ___provider0, ___sampleFrameCount1);
}
else
{
if (il2cpp_codegen_method_is_interface_method(targetMethod))
InterfaceActionInvoker1< uint32_t >::Invoke(il2cpp_codegen_method_get_slot(targetMethod), il2cpp_codegen_method_get_declaring_type(targetMethod), ___provider0, ___sampleFrameCount1);
else
VirtualActionInvoker1< uint32_t >::Invoke(il2cpp_codegen_method_get_slot(targetMethod), ___provider0, ___sampleFrameCount1);
}
}
else
{
typedef void (*FunctionPointerType) (AudioSampleProvider_tD8B613D55D09D6CE86B851A5D8F33560FFCC705B *, uint32_t, const RuntimeMethod*);
((FunctionPointerType)targetMethodPointer)(___provider0, ___sampleFrameCount1, targetMethod);
}
}
else
{
// closed
if (targetThis == NULL)
{
typedef void (*FunctionPointerType) (AudioSampleProvider_tD8B613D55D09D6CE86B851A5D8F33560FFCC705B *, uint32_t, const RuntimeMethod*);
((FunctionPointerType)targetMethodPointer)(___provider0, ___sampleFrameCount1, targetMethod);
}
else
{
typedef void (*FunctionPointerType) (void*, AudioSampleProvider_tD8B613D55D09D6CE86B851A5D8F33560FFCC705B *, uint32_t, const RuntimeMethod*);
((FunctionPointerType)targetMethodPointer)(targetThis, ___provider0, ___sampleFrameCount1, targetMethod);
}
}
}
}
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
IL2CPP_EXTERN_C void DelegatePInvokeWrapper_AudioConfigurationChangeHandler_t1A997C51DF7B553A94DAD358F8D968308994774A (AudioConfigurationChangeHandler_t1A997C51DF7B553A94DAD358F8D968308994774A * __this, bool ___deviceWasChanged0, const RuntimeMethod* method)
{
typedef void (DEFAULT_CALL *PInvokeFunc)(int32_t);
PInvokeFunc il2cppPInvokeFunc = reinterpret_cast<PInvokeFunc>(((RuntimeDelegate*)__this)->method->nativeFunction);
// Native function invocation
il2cppPInvokeFunc(static_cast<int32_t>(___deviceWasChanged0));
}
// System.Void UnityEngine.AudioSettings/AudioConfigurationChangeHandler::.ctor(System.Object,System.IntPtr)
IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR void AudioConfigurationChangeHandler__ctor_mB63AFBABA4712DF64F06A65CC7CE3C9E8C58080B (AudioConfigurationChangeHandler_t1A997C51DF7B553A94DAD358F8D968308994774A * __this, RuntimeObject * ___object0, intptr_t ___method1, const RuntimeMethod* method)
{
__this->set_method_ptr_0(il2cpp_codegen_get_method_pointer((RuntimeMethod*)___method1));
__this->set_method_3(___method1);
__this->set_m_target_2(___object0);
}
// System.Void UnityEngine.AudioSettings/AudioConfigurationChangeHandler::Invoke(System.Boolean)
IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR void AudioConfigurationChangeHandler_Invoke_mDC001A19067B6A02B0DE21A4D66FC8D82529F911 (AudioConfigurationChangeHandler_t1A997C51DF7B553A94DAD358F8D968308994774A * __this, bool ___deviceWasChanged0, const RuntimeMethod* method)
{
DelegateU5BU5D_t677D8FE08A5F99E8EE49150B73966CD6E9BF7DB8* delegateArrayToInvoke = __this->get_delegates_11();
Delegate_t** delegatesToInvoke;
il2cpp_array_size_t length;
if (delegateArrayToInvoke != NULL)
{
length = delegateArrayToInvoke->max_length;
delegatesToInvoke = reinterpret_cast<Delegate_t**>(delegateArrayToInvoke->GetAddressAtUnchecked(0));
}
else
{
length = 1;
delegatesToInvoke = reinterpret_cast<Delegate_t**>(&__this);
}
for (il2cpp_array_size_t i = 0; i < length; i++)
{
Delegate_t* currentDelegate = delegatesToInvoke[i];
Il2CppMethodPointer targetMethodPointer = currentDelegate->get_method_ptr_0();
RuntimeObject* targetThis = currentDelegate->get_m_target_2();
RuntimeMethod* targetMethod = (RuntimeMethod*)(currentDelegate->get_method_3());
if (!currentDelegate->get_method_is_virtual_10())
{
il2cpp_codegen_raise_execution_engine_exception_if_method_is_not_found(targetMethod);
}
bool ___methodIsStatic = MethodIsStatic(targetMethod);
int ___parameterCount = il2cpp_codegen_method_parameter_count(targetMethod);
if (___methodIsStatic)
{
if (___parameterCount == 1)
{
// open
typedef void (*FunctionPointerType) (bool, const RuntimeMethod*);
((FunctionPointerType)targetMethodPointer)(___deviceWasChanged0, targetMethod);
}
else
{
// closed
typedef void (*FunctionPointerType) (void*, bool, const RuntimeMethod*);
((FunctionPointerType)targetMethodPointer)(targetThis, ___deviceWasChanged0, targetMethod);
}
}
else
{
// closed
typedef void (*FunctionPointerType) (void*, bool, const RuntimeMethod*);
((FunctionPointerType)targetMethodPointer)(targetThis, ___deviceWasChanged0, targetMethod);
}
}
}
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// System.Boolean UnityEngine.AudioSettings/Mobile::get_muteState()
IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR bool Mobile_get_muteState_m692B429F6C1592C72DCCDCD2A00BF126BC51F6EF (const RuntimeMethod* method)
{
static bool s_Il2CppMethodInitialized;
if (!s_Il2CppMethodInitialized)
{
il2cpp_codegen_initialize_runtime_metadata((uintptr_t*)&Mobile_t9F8A04EF1ADC739B4107A38F0103CB72ECD23F5E_il2cpp_TypeInfo_var);
s_Il2CppMethodInitialized = true;
}
{
IL2CPP_RUNTIME_CLASS_INIT(Mobile_t9F8A04EF1ADC739B4107A38F0103CB72ECD23F5E_il2cpp_TypeInfo_var);
bool L_0 = ((Mobile_t9F8A04EF1ADC739B4107A38F0103CB72ECD23F5E_StaticFields*)il2cpp_codegen_static_fields_for(Mobile_t9F8A04EF1ADC739B4107A38F0103CB72ECD23F5E_il2cpp_TypeInfo_var))->get_U3CmuteStateU3Ek__BackingField_0();
return L_0;
}
}
// System.Void UnityEngine.AudioSettings/Mobile::set_muteState(System.Boolean)
IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR void Mobile_set_muteState_mA43DEFC30F87157C7E0030B009DD8C8D0CC422F6 (bool ___value0, const RuntimeMethod* method)
{
static bool s_Il2CppMethodInitialized;
if (!s_Il2CppMethodInitialized)
{
il2cpp_codegen_initialize_runtime_metadata((uintptr_t*)&Mobile_t9F8A04EF1ADC739B4107A38F0103CB72ECD23F5E_il2cpp_TypeInfo_var);
s_Il2CppMethodInitialized = true;
}
{
bool L_0 = ___value0;
IL2CPP_RUNTIME_CLASS_INIT(Mobile_t9F8A04EF1ADC739B4107A38F0103CB72ECD23F5E_il2cpp_TypeInfo_var);
((Mobile_t9F8A04EF1ADC739B4107A38F0103CB72ECD23F5E_StaticFields*)il2cpp_codegen_static_fields_for(Mobile_t9F8A04EF1ADC739B4107A38F0103CB72ECD23F5E_il2cpp_TypeInfo_var))->set_U3CmuteStateU3Ek__BackingField_0(L_0);
return;
}
}
// System.Boolean UnityEngine.AudioSettings/Mobile::get_stopAudioOutputOnMute()
IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR bool Mobile_get_stopAudioOutputOnMute_m0FCE9C6EF6597B73D4C36AB361403093A4A2CC23 (const RuntimeMethod* method)
{
static bool s_Il2CppMethodInitialized;
if (!s_Il2CppMethodInitialized)
{
il2cpp_codegen_initialize_runtime_metadata((uintptr_t*)&Mobile_t9F8A04EF1ADC739B4107A38F0103CB72ECD23F5E_il2cpp_TypeInfo_var);
s_Il2CppMethodInitialized = true;
}
bool V_0 = false;
{
IL2CPP_RUNTIME_CLASS_INIT(Mobile_t9F8A04EF1ADC739B4107A38F0103CB72ECD23F5E_il2cpp_TypeInfo_var);
bool L_0 = ((Mobile_t9F8A04EF1ADC739B4107A38F0103CB72ECD23F5E_StaticFields*)il2cpp_codegen_static_fields_for(Mobile_t9F8A04EF1ADC739B4107A38F0103CB72ECD23F5E_il2cpp_TypeInfo_var))->get__stopAudioOutputOnMute_1();
V_0 = L_0;
goto IL_0009;
}
IL_0009:
{
bool L_1 = V_0;
return L_1;
}
}
// System.Void UnityEngine.AudioSettings/Mobile::InvokeOnMuteStateChanged(System.Boolean)
IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR void Mobile_InvokeOnMuteStateChanged_m89C9E4AE29FB7A0140E6F73F1A00B54351548664 (bool ___mute0, const RuntimeMethod* method)
{
static bool s_Il2CppMethodInitialized;
if (!s_Il2CppMethodInitialized)
{
il2cpp_codegen_initialize_runtime_metadata((uintptr_t*)&Action_1_Invoke_m94B1D693386EA0BD3C636939BDCE375EDEF91A04_RuntimeMethod_var);
il2cpp_codegen_initialize_runtime_metadata((uintptr_t*)&Mobile_t9F8A04EF1ADC739B4107A38F0103CB72ECD23F5E_il2cpp_TypeInfo_var);
s_Il2CppMethodInitialized = true;
}
bool V_0 = false;
bool V_1 = false;
bool V_2 = false;
bool V_3 = false;
{
bool L_0 = ___mute0;
IL2CPP_RUNTIME_CLASS_INIT(Mobile_t9F8A04EF1ADC739B4107A38F0103CB72ECD23F5E_il2cpp_TypeInfo_var);
bool L_1;
L_1 = Mobile_get_muteState_m692B429F6C1592C72DCCDCD2A00BF126BC51F6EF_inline(/*hidden argument*/NULL);
V_0 = (bool)((((int32_t)((((int32_t)L_0) == ((int32_t)L_1))? 1 : 0)) == ((int32_t)0))? 1 : 0);
bool L_2 = V_0;
if (!L_2)
{
goto IL_0053;
}
}
{
bool L_3 = ___mute0;
IL2CPP_RUNTIME_CLASS_INIT(Mobile_t9F8A04EF1ADC739B4107A38F0103CB72ECD23F5E_il2cpp_TypeInfo_var);
Mobile_set_muteState_mA43DEFC30F87157C7E0030B009DD8C8D0CC422F6_inline(L_3, /*hidden argument*/NULL);
bool L_4;
L_4 = Mobile_get_stopAudioOutputOnMute_m0FCE9C6EF6597B73D4C36AB361403093A4A2CC23(/*hidden argument*/NULL);
V_1 = L_4;
bool L_5 = V_1;
if (!L_5)
{
goto IL_003a;
}
}
{
IL2CPP_RUNTIME_CLASS_INIT(Mobile_t9F8A04EF1ADC739B4107A38F0103CB72ECD23F5E_il2cpp_TypeInfo_var);
bool L_6;
L_6 = Mobile_get_muteState_m692B429F6C1592C72DCCDCD2A00BF126BC51F6EF_inline(/*hidden argument*/NULL);
V_2 = L_6;
bool L_7 = V_2;
if (!L_7)
{
goto IL_0033;
}
}
{
IL2CPP_RUNTIME_CLASS_INIT(Mobile_t9F8A04EF1ADC739B4107A38F0103CB72ECD23F5E_il2cpp_TypeInfo_var);
Mobile_StopAudioOutput_m724EB5F22195200EA75828AAA436CE13A1B9989E(/*hidden argument*/NULL);
goto IL_0039;
}
IL_0033:
{
IL2CPP_RUNTIME_CLASS_INIT(Mobile_t9F8A04EF1ADC739B4107A38F0103CB72ECD23F5E_il2cpp_TypeInfo_var);
Mobile_StartAudioOutput_m3F2C349725ED8D6AA8C8223651658814D312FE09(/*hidden argument*/NULL);
}
IL_0039:
{
}
IL_003a:
{
IL2CPP_RUNTIME_CLASS_INIT(Mobile_t9F8A04EF1ADC739B4107A38F0103CB72ECD23F5E_il2cpp_TypeInfo_var);
Action_1_tCE2D770918A65CAD277C08C4E8C05385EA267E83 * L_8 = ((Mobile_t9F8A04EF1ADC739B4107A38F0103CB72ECD23F5E_StaticFields*)il2cpp_codegen_static_fields_for(Mobile_t9F8A04EF1ADC739B4107A38F0103CB72ECD23F5E_il2cpp_TypeInfo_var))->get_OnMuteStateChanged_2();
V_3 = (bool)((!(((RuntimeObject*)(Action_1_tCE2D770918A65CAD277C08C4E8C05385EA267E83 *)L_8) <= ((RuntimeObject*)(RuntimeObject *)NULL)))? 1 : 0);
bool L_9 = V_3;
if (!L_9)
{
goto IL_0052;
}
}
{
IL2CPP_RUNTIME_CLASS_INIT(Mobile_t9F8A04EF1ADC739B4107A38F0103CB72ECD23F5E_il2cpp_TypeInfo_var);
Action_1_tCE2D770918A65CAD277C08C4E8C05385EA267E83 * L_10 = ((Mobile_t9F8A04EF1ADC739B4107A38F0103CB72ECD23F5E_StaticFields*)il2cpp_codegen_static_fields_for(Mobile_t9F8A04EF1ADC739B4107A38F0103CB72ECD23F5E_il2cpp_TypeInfo_var))->get_OnMuteStateChanged_2();
bool L_11 = ___mute0;
NullCheck(L_10);
Action_1_Invoke_m94B1D693386EA0BD3C636939BDCE375EDEF91A04(L_10, L_11, /*hidden argument*/Action_1_Invoke_m94B1D693386EA0BD3C636939BDCE375EDEF91A04_RuntimeMethod_var);
}
IL_0052:
{
}
IL_0053:
{
return;
}
}
// System.Void UnityEngine.AudioSettings/Mobile::StartAudioOutput()
IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR void Mobile_StartAudioOutput_m3F2C349725ED8D6AA8C8223651658814D312FE09 (const RuntimeMethod* method)
{
{
bool L_0;
L_0 = AudioSettings_StartAudioOutput_m372FC1B86734F04E2AAE161E2A70F3E5E8FCE583(/*hidden argument*/NULL);
return;
}
}
// System.Void UnityEngine.AudioSettings/Mobile::StopAudioOutput()
IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR void Mobile_StopAudioOutput_m724EB5F22195200EA75828AAA436CE13A1B9989E (const RuntimeMethod* method)
{
{
bool L_0;
L_0 = AudioSettings_StopAudioOutput_m5012E0AC92B63A7E23C7EBFE9A0F0EA3FA03C5A6(/*hidden argument*/NULL);
return;
}
}
// System.Void UnityEngine.AudioSettings/Mobile::.cctor()
IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR void Mobile__cctor_m1431158D3DD6F1D3453E5A545C25C8218315C315 (const RuntimeMethod* method)
{
static bool s_Il2CppMethodInitialized;
if (!s_Il2CppMethodInitialized)
{
il2cpp_codegen_initialize_runtime_metadata((uintptr_t*)&Mobile_t9F8A04EF1ADC739B4107A38F0103CB72ECD23F5E_il2cpp_TypeInfo_var);
s_Il2CppMethodInitialized = true;
}
{
((Mobile_t9F8A04EF1ADC739B4107A38F0103CB72ECD23F5E_StaticFields*)il2cpp_codegen_static_fields_for(Mobile_t9F8A04EF1ADC739B4107A38F0103CB72ECD23F5E_il2cpp_TypeInfo_var))->set_U3CmuteStateU3Ek__BackingField_0((bool)0);
((Mobile_t9F8A04EF1ADC739B4107A38F0103CB72ECD23F5E_StaticFields*)il2cpp_codegen_static_fields_for(Mobile_t9F8A04EF1ADC739B4107A38F0103CB72ECD23F5E_il2cpp_TypeInfo_var))->set__stopAudioOutputOnMute_1((bool)0);
return;
}
}
#ifdef __clang__
#pragma clang diagnostic pop
#endif
IL2CPP_MANAGED_FORCE_INLINE IL2CPP_METHOD_ATTR bool Mobile_get_muteState_m692B429F6C1592C72DCCDCD2A00BF126BC51F6EF_inline (const RuntimeMethod* method)
{
static bool s_Il2CppMethodInitialized;
if (!s_Il2CppMethodInitialized)
{
il2cpp_codegen_initialize_runtime_metadata((uintptr_t*)&Mobile_t9F8A04EF1ADC739B4107A38F0103CB72ECD23F5E_il2cpp_TypeInfo_var);
s_Il2CppMethodInitialized = true;
}
{
IL2CPP_RUNTIME_CLASS_INIT(Mobile_t9F8A04EF1ADC739B4107A38F0103CB72ECD23F5E_il2cpp_TypeInfo_var);
bool L_0 = ((Mobile_t9F8A04EF1ADC739B4107A38F0103CB72ECD23F5E_StaticFields*)il2cpp_codegen_static_fields_for(Mobile_t9F8A04EF1ADC739B4107A38F0103CB72ECD23F5E_il2cpp_TypeInfo_var))->get_U3CmuteStateU3Ek__BackingField_0();
return L_0;
}
}
IL2CPP_MANAGED_FORCE_INLINE IL2CPP_METHOD_ATTR void Mobile_set_muteState_mA43DEFC30F87157C7E0030B009DD8C8D0CC422F6_inline (bool ___value0, const RuntimeMethod* method)
{
static bool s_Il2CppMethodInitialized;
if (!s_Il2CppMethodInitialized)
{
il2cpp_codegen_initialize_runtime_metadata((uintptr_t*)&Mobile_t9F8A04EF1ADC739B4107A38F0103CB72ECD23F5E_il2cpp_TypeInfo_var);
s_Il2CppMethodInitialized = true;
}
{
bool L_0 = ___value0;
IL2CPP_RUNTIME_CLASS_INIT(Mobile_t9F8A04EF1ADC739B4107A38F0103CB72ECD23F5E_il2cpp_TypeInfo_var);
((Mobile_t9F8A04EF1ADC739B4107A38F0103CB72ECD23F5E_StaticFields*)il2cpp_codegen_static_fields_for(Mobile_t9F8A04EF1ADC739B4107A38F0103CB72ECD23F5E_il2cpp_TypeInfo_var))->set_U3CmuteStateU3Ek__BackingField_0(L_0);
return;
}
}
| [
"clpc12@naver.com"
] | clpc12@naver.com |
bfebf42f29623282ac8a661e4606feafc5c4361c | e1a4acf1d41b152a0f811e82c27ad261315399cc | /algorithms/kernel/neural_networks/layers/pooling2d_layer/forward/average_pooling2d_layer_forward_dense_default_batch_fpt_dispatcher.cpp | 9740797f40e6d926a21487dcbf483534c31686de | [
"Apache-2.0",
"Intel"
] | permissive | ValeryiE/daal | e7572f16e692785db1e17bed23b6ab709db4e705 | d326bdc5291612bc9e090d95da65aa579588b81e | refs/heads/master | 2020-08-29T11:37:16.157315 | 2019-10-25T13:11:01 | 2019-10-25T13:11:01 | 218,020,419 | 0 | 0 | Apache-2.0 | 2019-10-28T10:22:19 | 2019-10-28T10:22:19 | null | UTF-8 | C++ | false | false | 1,320 | cpp | /* file: average_pooling2d_layer_forward_dense_default_batch_fpt_dispatcher.cpp */
/*******************************************************************************
* Copyright 2014-2019 Intel Corporation
*
* 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.
*******************************************************************************/
//++
// Implementation of forward pooling layer container.
//--
#include "average_pooling2d_layer_forward_batch_container.h"
namespace daal
{
namespace algorithms
{
namespace neural_networks
{
namespace layers
{
namespace forward
{
__DAAL_INSTANTIATE_DISPATCH_LAYER_CONTAINER_FORWARD(neural_networks::layers::average_pooling2d::forward::interface1::BatchContainer, DAAL_FPTYPE,
neural_networks::layers::average_pooling2d::defaultDense)
}
}
}
}
}
| [
"nikolay.a.petrov@intel.com"
] | nikolay.a.petrov@intel.com |
be0b43e8f62317217e6cc610f2c8cedb888a3a65 | 5863ce4e04261618a35567d0b81cc2eb12e22725 | /palindrome_anagram2/words.cpp | 64d28dde4f9bef06ddfe46e3cfb6300b2d851883 | [] | no_license | elrob/Cpp_practice_tests | 5f809789b52d273e7a2d93bbfe34e3f5118b3805 | 5f4f5a53056846c31dfa249d2f43cea5f2bff38b | refs/heads/master | 2020-04-10T16:20:47.541008 | 2013-12-08T22:02:44 | 2013-12-08T22:02:44 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,688 | cpp | #include <cctype>
#include <cstring>
using namespace std;
#include "words.h"
void reverse(const char *str1, char *str2) {
char const * const str1_start = str1;
while( *str1 != '\0') //str1 points to null character
++str1;
--str1; //str1 points to character before null
while (str1 >= str1_start)
*str2++ = *str1--;
*str2 = '\0';
}
bool compare(const char *str1, const char *str2) {
if ( *str1 != '\0' && !isalpha(*str1) )
return compare(++str1,str2);
else if ( *str2 != '\0' && !isalpha(*str2) )
return compare(str1,++str2);
else if ( *str1 == '\0' && *str2 == '\0' )
return true;
else if ( toupper(*str1) == toupper(*str2) )
return compare(++str1,++str2);
else
return false;
}
bool palindrome(const char *string) {
char reversed_string[512];
reverse(string,reversed_string);
return compare(string,reversed_string);
}
int find_min_index(char *sorted) {
int min_index = 0;
int index = 0;
while (sorted[index] != '\0') {
if (tolower(sorted[index]) < tolower(sorted[min_index]))
min_index = index;
++index;
}
return min_index;
}
void recursive_sort(char *sorted) {
if (*sorted != '\0') {
int min_index = find_min_index(sorted);
char temp = *sorted;
*sorted = sorted[min_index];
sorted[min_index] = temp;
return recursive_sort(++sorted);
}
}
void string_sort(const char *string, char *sorted) {
strcpy(sorted,string);
recursive_sort(sorted);
}
bool anagram(const char *str1, const char *str2) {
char str1sorted[512];
char str2sorted[512];
string_sort(str1,str1sorted);
string_sort(str2,str2sorted);
return compare(str1sorted,str2sorted);
}
| [
"robs_fake_email@me.fake"
] | robs_fake_email@me.fake |
8d006a4bee10f9c576db5efbe7399ea2088ae019 | 373283dd44343a99564d2cebcafd3bbc274b3c85 | /dev/Cadabolg/prolix/common/include/cUrl.h | d2bef4cf99ff5cefa5e34b19147ec3eea6c7e468 | [] | no_license | k39chen/Cadabolg | 89dd46fa91a77c2e8364f18171fbe645b46eb9e6 | 26255a431269c48e847e953e7f093443901cdeee | refs/heads/master | 2020-04-21T07:54:44.411606 | 2013-11-17T06:20:43 | 2013-11-17T06:20:43 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,208 | h | //====================================================================================
// @Title: URL
//------------------------------------------------------------------------------------
// @Location: /prolix/common/include/cUrl.h
// @Author: Kevin Chen
// @Rights: Copyright(c) 2011 Visionary Games
//------------------------------------------------------------------------------------
// @Description:
//
// Stores a relative file path and aliased file path for simple storing and reference.
//
//====================================================================================
#ifndef __PROLIX_COMMON_FILEPATH_H__
#define __PROLIX_COMMON_FILEPATH_H__
#include <string>
// alias cUrlId type
typedef std::string cUrlId;
//====================================================================================
// cUrl
//====================================================================================
struct cUrl
{
cUrlId alias; // alias of the filepath
std::string path; // relative path of the file
// Constructor
cUrl(std::string path);
};
#endif | [
"kchen@tagged.com"
] | kchen@tagged.com |
86c000de014486ae8cb0479395905868ba7fb2c5 | 4cc34c297e0f85eb43c99fd0be1cc696707d49c5 | /src/pnumpy/getitem.cpp | b708352e62cb36c256a416bc7c23863a45c4967a | [
"MIT"
] | permissive | Quansight/pnumpy | 426318ddf8e7f86ed9258196c7c836022d9bf46e | 59d430f74168539a0710321c4eecb53d25db4833 | refs/heads/main | 2023-03-05T23:01:01.302077 | 2021-02-04T19:07:26 | 2021-02-04T19:07:26 | 292,356,377 | 34 | 2 | MIT | 2021-02-04T19:07:27 | 2020-09-02T17:59:34 | C++ | UTF-8 | C++ | false | false | 47,489 | cpp | // If this is not included, calling PY_ARRAY functions will have a null value
#define PY_ARRAY_UNIQUE_SYMBOL sharedata_ARRAY_API
#define NO_IMPORT_ARRAY
#include "common.h"
#include "../atop/atop.h"
#include "../atop/threads.h"
#define LOGGING(...)
/**
* Count the number of 'True' (nonzero) 1-byte bool values in an array,
* using an AVX2-based implementation.
*
* @param pData Array of 1-byte bool values.
* @param length The number of elements in the array.
* @return The number of nonzero 1-byte bool values in the array.
*/
// TODO: When we support runtime CPU detection/dispatching, bring back the original popcnt-based implementation
// of this function for systems that don't support AVX2. Also consider implementing an SSE-based version
// of this function for the same reason (logic will be very similar, just using __m128i instead).
// TODO: Consider changing `length` to uint64_t here so it agrees better with the result of sizeof().
int64_t SumBooleanMask(const int8_t* const pData, const int64_t length, const int64_t strideBoolean) {
// Basic input validation.
if (!pData)
{
return 0;
}
else if (length < 0)
{
return 0;
}
// Holds the accumulated result value.
int64_t result = 0;
if (strideBoolean == 1) {
// Now that we know length is >= 0, it's safe to convert it to unsigned so it agrees with
// the sizeof() math in the logic below.
// Make sure to use this instead of 'length' in the code below to avoid signed/unsigned
// arithmetic warnings.
const size_t ulength = length;
// YMM (32-byte) vector packed with 32 byte values, each set to 1.
// NOTE: The obvious thing here would be to use _mm256_set1_epi8(1),
// but many compilers (e.g. MSVC) store the data for this vector
// then load it here, which unnecessarily wastes cache space we could be
// using for something else.
// Generate the constants using a few intrinsics, it's faster than even an L1 cache hit anyway.
const auto zeros_ = _mm256_setzero_si256();
// compare 0 to 0 returns 0xFF; treated as an int8_t, 0xFF = -1, so abs(-1) = 1.
const auto ones = _mm256_abs_epi8(_mm256_cmpeq_epi8(zeros_, zeros_));
//
// Convert each byte in the input to a 0 or 1 byte according to C-style boolean semantics.
//
// This first loop does the bulk of the processing for large vectors -- it doesn't use popcount
// instructions and instead relies on the fact we can sum 0/1 values to acheive the same result,
// up to CHAR_MAX. This allows us to use very inexpensive instructions for most of the accumulation
// so we're primarily limited by memory bandwidth.
const size_t vector_length = ulength / sizeof(__m256i);
const auto pVectorData = (__m256i*)pData;
for (size_t i = 0; i < vector_length;)
{
// Determine how much we can process in _this_ iteration of the loop.
// The maximum number of "inner" iterations here is CHAR_MAX (255),
// because otherwise our byte-sized counters would overflow.
auto inner_loop_iters = vector_length - i;
if (inner_loop_iters > 255) inner_loop_iters = 255;
// Holds the current per-vector-lane (i.e. per-byte-within-vector) popcount.
// PERF: If necessary, the loop below can be manually unrolled to ensure we saturate memory bandwidth.
auto byte_popcounts = _mm256_setzero_si256();
for (size_t j = 0; j < inner_loop_iters; j++)
{
// Use an unaligned load to grab a chunk of data;
// then call _mm256_min_epu8 where one operand is the register we set
// earlier containing packed byte-sized 1 values (e.g. 0x01010101...).
// This effectively converts each byte in the input to a 0 or 1 byte value.
const auto cstyle_bools = _mm256_min_epu8(ones, _mm256_loadu_si256(&pVectorData[i + j]));
// Since each byte in the converted vector now contains either a 0 or 1,
// we can simply add it to the running per-byte sum to simulate a popcount.
byte_popcounts = _mm256_add_epi8(byte_popcounts, cstyle_bools);
}
// Sum the per-byte-lane popcounts, then add them to the overall result.
// For the vectorized partial sums, it's important the 'zeros' argument is used as the second operand
// so that the zeros are 'unpacked' into the high byte(s) of each packed element in the result.
const auto zeros = _mm256_setzero_si256();
// Sum 32x 1-byte counts -> 16x 2-byte counts
const auto byte_popcounts_8a = _mm256_unpacklo_epi8(byte_popcounts, zeros);
const auto byte_popcounts_8b = _mm256_unpackhi_epi8(byte_popcounts, zeros);
const auto byte_popcounts_16 = _mm256_add_epi16(byte_popcounts_8a, byte_popcounts_8b);
// Sum 16x 2-byte counts -> 8x 4-byte counts
const auto byte_popcounts_16a = _mm256_unpacklo_epi16(byte_popcounts_16, zeros);
const auto byte_popcounts_16b = _mm256_unpackhi_epi16(byte_popcounts_16, zeros);
const auto byte_popcounts_32 = _mm256_add_epi32(byte_popcounts_16a, byte_popcounts_16b);
// Sum 8x 4-byte counts -> 4x 8-byte counts
const auto byte_popcounts_32a = _mm256_unpacklo_epi32(byte_popcounts_32, zeros);
const auto byte_popcounts_32b = _mm256_unpackhi_epi32(byte_popcounts_32, zeros);
const auto byte_popcounts_64 = _mm256_add_epi64(byte_popcounts_32a, byte_popcounts_32b);
// perform the operation horizontally in m0
union {
volatile int64_t horizontal[4];
__m256i mathreg[1];
};
mathreg[0] = byte_popcounts_64;
for (int j = 0; j < 4; j++) {
result += horizontal[j];
}
// Increment the outer loop counter by the number of inner iterations we performed.
i += inner_loop_iters;
}
// Handle the last few bytes, if any, that couldn't be handled with the vectorized loop.
const size_t vectorized_length = vector_length * sizeof(__m256i);
for (size_t i = vectorized_length; i < ulength; i++)
{
if (pData[i])
{
result++;
}
}
}
else {
for (int64_t i = 0; i < length; i++)
{
if (pData[i * strideBoolean])
{
result++;
}
}
LOGGING("sum bool %p len:%I64d vs true:%I64d stride:%I64d\n", pData, length, result, strideBoolean);
}
return result;
}
//===================================================
// Input: boolean array
// Output: chunk count and ppChunkCount
// NOTE: CALLER MUST FREE pChunkCount
//
int64_t BooleanCount(PyArrayObject* aIndex, int64_t** ppChunkCount) {
// Pass one, count the values
// Eight at a time
const int64_t lengthBool = ArrayLength(aIndex);
const int8_t* const pBooleanMask = (int8_t*)PyArray_BYTES(aIndex);
// Count the number of chunks (of boolean elements).
// It's important we handle the case of an empty array (zero length) when determining the number
// of per-chunk counts to return; the behavior of malloc'ing zero bytes is undefined, and the code
// below assumes there's always at least one entry in the count-per-chunk array. If we don't handle
// the empty array case we'll allocate an empty count-per-chunk array and end up doing an
// out-of-bounds write.
const int64_t chunkSize = THREADER->WORK_ITEM_CHUNK;
int64_t chunks = lengthBool > 1 ? lengthBool : 1;
chunks = (chunks + (chunkSize - 1)) / chunkSize;
// TOOD: try to allocate on stack when possible
int64_t* const pChunkCount = (int64_t*)WORKSPACE_ALLOC(chunks * sizeof(int64_t));
if (pChunkCount) {
// MT callback
struct BSCallbackStruct {
int64_t* pChunkCount;
const int8_t* pBooleanMask;
int64_t strideBoolean;
};
// This is the routine that will be called back from multiple threads
// t64_t(*MTCHUNK_CALLBACK)(void* callbackArg, int core, int64_t start, int64_t length);
auto lambdaBSCallback = [](void* callbackArgT, int core, int64_t start, int64_t length) -> int64_t {
BSCallbackStruct* callbackArg = (BSCallbackStruct*)callbackArgT;
const int8_t* pBooleanMask = callbackArg->pBooleanMask;
int64_t* pChunkCount = callbackArg->pChunkCount;
// Use the single-threaded implementation to sum the number of
// 1-byte boolean TRUE values in the current chunk.
// This means the current function is just responsible for parallelizing over the chunks
// but doesn't do any real "math" itself.
int64_t strides = callbackArg->strideBoolean;
int64_t total = SumBooleanMask(&pBooleanMask[start * strides], length, strides);
pChunkCount[start / THREADER->WORK_ITEM_CHUNK] = total;
return TRUE;
};
BSCallbackStruct stBSCallback;
stBSCallback.pChunkCount = pChunkCount;
stBSCallback.pBooleanMask = pBooleanMask;
stBSCallback.strideBoolean = PyArray_STRIDE(aIndex, 0);
BOOL didMtWork = THREADER->DoMultiThreadedChunkWork(lengthBool, lambdaBSCallback, &stBSCallback);
*ppChunkCount = pChunkCount;
// if multithreading turned off...
return didMtWork ? chunks : 1;
}
// out of memory
return 0;
}
//---------------------------------------------------------------------------
// Input:
// Arg1: numpy array aValues (can be any array)
// Arg2: numpy array aIndex (must be BOOL)
//
PyObject*
BooleanIndexInternal(
PyArrayObject* aValues,
PyArrayObject* aIndex) {
if (PyArray_TYPE(aIndex) != NPY_BOOL) {
PyErr_Format(PyExc_ValueError, "Second argument must be a boolean array");
return NULL;
}
// This logic is not quite correct, if the strides on all dimensions are the same, we can use this routine
if (PyArray_NDIM(aIndex) != 1 && !PyArray_ISCONTIGUOUS(aIndex)) {
PyErr_Format(PyExc_ValueError, "Dont know how to handle multidimensional boolean array.");
return NULL;
}
if (PyArray_NDIM(aValues) != 1 && !PyArray_ISCONTIGUOUS(aValues)) {
PyErr_Format(PyExc_ValueError, "Dont know how to handle multidimensional array to be indexed.");
return NULL;
}
// Pass one, count the values
// Eight at a time
int64_t lengthBool = ArrayLength(aIndex);
int64_t lengthValue = ArrayLength(aValues);
if (lengthBool != lengthValue) {
PyErr_Format(PyExc_ValueError, "Array lengths must match %lld vs %lld", lengthBool, lengthValue);
return NULL;
}
int64_t* pChunkCount = NULL;
int64_t chunks = BooleanCount(aIndex, &pChunkCount);
if (chunks == 0) {
PyErr_Format(PyExc_ValueError, "Out of memory");
return NULL;
}
int64_t totalTrue = 0;
// Store the offset
for (int64_t i = 0; i < chunks; i++) {
int64_t temp = totalTrue;
totalTrue += pChunkCount[i];
// reassign to the cumulative sum so we know the offset
pChunkCount[i] = temp;
}
LOGGING("boolean index total: %I64d length: %I64d type:%d chunks:%I64d\n", totalTrue, lengthBool, PyArray_TYPE(aValues), chunks);
int8_t* pBooleanMask = (int8_t*)PyArray_BYTES(aIndex);
// Now we know per chunk how many true there are... we can allocate the new array
PyArrayObject* pReturnArray = AllocateLikeResize(aValues, totalTrue);
if (pReturnArray) {
// If the resulting array is empty there is no work to do
if (totalTrue > 0) {
// MT callback
struct BICallbackStruct {
int64_t* pChunkCount;
int8_t* pBooleanMask;
int64_t strideBoolean;
char* pValuesIn;
int64_t strideValues;
char* pValuesOut;
int64_t itemSize;
};
//-----------------------------------------------
//-----------------------------------------------
// This is the routine that will be called back from multiple threads
auto lambdaBICallback2 = [](void* callbackArgT, int core, int64_t start, int64_t length) -> int64_t {
BICallbackStruct* callbackArg = (BICallbackStruct*)callbackArgT;
int8_t* pBooleanMask = callbackArg->pBooleanMask;
int64_t chunkCount = callbackArg->pChunkCount[start / THREADER->WORK_ITEM_CHUNK];
int64_t itemSize = callbackArg->itemSize;
int64_t strideBoolean = callbackArg->strideBoolean;
int64_t* pData = (int64_t*)&pBooleanMask[start * strideBoolean];
int64_t strideValues = callbackArg->strideValues;
char* pValuesIn = &callbackArg->pValuesIn[start * strideValues];
// output is assumed contiguous
char* pValuesOut = &callbackArg->pValuesOut[chunkCount * itemSize];
// process 8 booleans at a time in the loop
int64_t blength = length / 8;
if (strideBoolean == 1) {
switch (itemSize) {
case 1:
{
// NOTE: This routine can be improved further by
// Loading 32 booleans at time in math register
// Storing the result in a math register (shifting over new values) until full
int8_t* pVOut = (int8_t*)pValuesOut;
int8_t* pVIn = (int8_t*)pValuesIn;
for (int64_t i = 0; i < blength; i++) {
uint64_t bitmask = *(uint64_t*)pData;
// NOTE: the below can be optimized with vector intrinsics
// little endian, so the first value is low bit (not high bit)
if (bitmask != 0) {
for (int j = 0; j < 8; j++) {
if (bitmask & 0xff) { *pVOut++ = *pVIn; } pVIn += strideValues; bitmask >>= 8;
}
}
else {
pVIn += 8 * strideValues;
}
pData++;
}
// Get last
pBooleanMask = (int8_t*)pData;
blength = length & 7;
for (int64_t i = 0; i < blength; i++) {
if (*pBooleanMask++) {
*pVOut++ = *pVIn;
}
pVIn += strideValues;
}
}
break;
case 2:
{
int16_t* pVOut = (int16_t*)pValuesOut;
int16_t* pVIn = (int16_t*)pValuesIn;
for (int64_t i = 0; i < blength; i++) {
uint64_t bitmask = *(uint64_t*)pData;
uint64_t mask = 0xff;
// little endian, so the first value is low bit (not high bit)
if (bitmask != 0) {
for (int j = 0; j < 8; j++) {
if (bitmask & 0xff) { *pVOut++ = *pVIn; } pVIn = STRIDE_NEXT(int16_t, pVIn, strideValues); bitmask >>= 8;
}
}
else {
pVIn = STRIDE_NEXT(int16_t, pVIn, 8*strideValues);
}
pData++;
}
// Get last
pBooleanMask = (int8_t*)pData;
blength = length & 7;
for (int64_t i = 0; i < blength; i++) {
if (*pBooleanMask++) {
*pVOut++ = *pVIn;
}
pVIn = STRIDE_NEXT(int16_t, pVIn, strideValues);
}
}
break;
case 4:
{
int32_t* pVOut = (int32_t*)pValuesOut;
int32_t* pVIn = (int32_t*)pValuesIn;
for (int64_t i = 0; i < blength; i++) {
// little endian, so the first value is low bit (not high bit)
uint64_t bitmask = *(uint64_t*)pData;
if (bitmask != 0) {
for (int j = 0; j < 8; j++) {
if (bitmask & 0xff) { *pVOut++ = *pVIn; } pVIn = STRIDE_NEXT(int32_t, pVIn, strideValues); bitmask >>= 8;
}
}
else {
pVIn = STRIDE_NEXT(int32_t, pVIn, 8 * strideValues);
}
pData++;
}
// Get last
pBooleanMask = (int8_t*)pData;
blength = length & 7;
for (int64_t i = 0; i < blength; i++) {
if (*pBooleanMask++) {
*pVOut++ = *pVIn;
}
pVIn = STRIDE_NEXT(int32_t, pVIn, strideValues);
}
}
break;
case 8:
{
int64_t* pVOut = (int64_t*)pValuesOut;
int64_t* pVIn = (int64_t*)pValuesIn;
for (int64_t i = 0; i < blength; i++) {
// little endian, so the first value is low bit (not high bit)
uint64_t bitmask = *(uint64_t*)pData;
if (bitmask != 0) {
for (int j = 0; j < 8; j++) {
if (bitmask & 0xff) { *pVOut++ = *pVIn; } pVIn = STRIDE_NEXT(int64_t, pVIn, strideValues); bitmask >>= 8;
}
}
else {
pVIn = STRIDE_NEXT(int64_t, pVIn, 8 * strideValues);
}
pData++;
}
// Get last
pBooleanMask = (int8_t*)pData;
blength = length & 7;
for (int64_t i = 0; i < blength; i++) {
if (*pBooleanMask++) {
*pVOut++ = *pVIn;
}
pVIn = STRIDE_NEXT(int64_t, pVIn, strideValues);
}
}
break;
default:
{
for (int64_t i = 0; i < blength; i++) {
// little endian, so the first value is low bit (not high bit)
uint64_t bitmask = *(uint64_t*)pData;
if (bitmask != 0) {
int counter = 8;
while (counter--) {
if (bitmask & 0xff) {
memcpy(pValuesOut, pValuesIn, itemSize);
pValuesOut += itemSize;
}
pValuesIn += strideValues;
bitmask >>= 8;
}
}
else {
pValuesIn += (strideValues * 8);
}
pData++;
}
// Get last
pBooleanMask = (int8_t*)pData;
blength = length & 7;
for (int64_t i = 0; i < blength; i++) {
if (*pBooleanMask++) {
memcpy(pValuesOut, pValuesIn, itemSize);
pValuesOut += strideValues;
}
pValuesIn += strideValues;
}
}
break;
}
} else {
// The boolean mask is strided
// FUTURE OPTIMIZATION: We can use the gather command to speed this path
int8_t* pBool = (int8_t*)pData;
switch (itemSize) {
case 1:
{
int8_t* pVOut = (int8_t*)pValuesOut;
int8_t* pVIn = (int8_t*)pValuesIn;
for (int64_t i = 0; i < length; i++) {
if (*pBool) {
*pVOut++ = *pVIn;
}
pBool += strideBoolean;
pVIn += strideValues;
}
}
break;
case 2:
{
int16_t* pVOut = (int16_t*)pValuesOut;
int16_t* pVIn = (int16_t*)pValuesIn;
for (int64_t i = 0; i < length; i++) {
if (*pBool) {
*pVOut++ = *pVIn;
}
pBool += strideBoolean;
pVIn = STRIDE_NEXT(int16_t,pVIn,strideValues);
}
}
break;
case 4:
{
int32_t* pVOut = (int32_t*)pValuesOut;
int32_t* pVIn = (int32_t*)pValuesIn;
for (int64_t i = 0; i < length; i++) {
if (*pBool) {
*pVOut++ = *pVIn;
}
pBool += strideBoolean;
pVIn = STRIDE_NEXT(int32_t, pVIn, strideValues);
}
}
break;
case 8:
{
int64_t* pVOut = (int64_t*)pValuesOut;
int64_t* pVIn = (int64_t*)pValuesIn;
for (int64_t i = 0; i < length; i++) {
if (*pBool) {
*pVOut++ = *pVIn;
}
pBool += strideBoolean;
pVIn = STRIDE_NEXT(int64_t, pVIn, strideValues);
}
}
break;
default:
{
char* pVOut = (char*)pValuesOut;
char* pVIn = (char*)pValuesIn;
for (int64_t i = 0; i < length; i++) {
if (*pBool) {
memcpy(pVOut, pVIn, itemSize);
pVOut+=itemSize;
}
pBool += strideBoolean;
pVIn += strideValues;
}
}
break;
}
}
return TRUE;
};
BICallbackStruct stBICallback;
stBICallback.pChunkCount = pChunkCount;
stBICallback.pBooleanMask = pBooleanMask;
stBICallback.pValuesIn = (char*)PyArray_BYTES(aValues);
stBICallback.pValuesOut = (char*)PyArray_BYTES(pReturnArray);
stBICallback.itemSize = PyArray_ITEMSIZE(aValues);
stBICallback.strideBoolean = PyArray_STRIDE(aIndex, 0);
stBICallback.strideValues = PyArray_STRIDE(aValues, 0);
THREADER->DoMultiThreadedChunkWork(lengthBool, lambdaBICallback2, &stBICallback);
}
} else {
// ran out of memory
PyErr_Format(PyExc_ValueError, "Out of memory");
}
WORKSPACE_FREE(pChunkCount);
return (PyObject*)pReturnArray;
}
//---------------------------------------------------------------------------
// Input:
// Arg1: numpy array aValues (can be anything)
// Arg2: numpy array aIndex (must be BOOL)
//
PyObject*
BooleanIndex(PyObject* self, PyObject* args)
{
PyArrayObject* aValues = NULL;
PyArrayObject* aIndex = NULL;
if (!PyArg_ParseTuple(
args, "O!O!:BooleanIndex",
&PyArray_Type, &aValues,
&PyArray_Type, &aIndex
)) {
return NULL;
}
return BooleanIndexInternal(aValues, aIndex);
}
//----------------------------------------------------
// Consider: C=A[B] where A is a value array
// C must be the same type as A (and is also a value array)
// B is an integer that indexes into A
// The length of B is the length of the output C
// valSize is the length of A
// aValues : remains constant (pointer to A)
// aIndex : incremented each call (pIndex) traverses B
// aDataOut : incremented each call (pDataOut) traverses C
// NOTE: The output CANNOT be strided
template<typename VALUE, typename INDEX>
static void GetItemInt(void* aValues, void* aIndex, void* aDataOut, int64_t valLength, int64_t itemSize, int64_t len, int64_t strideIndex, int64_t strideValue, void* pDefault) {
const VALUE* pValues = (VALUE*)aValues;
const INDEX* pIndex = (INDEX*)aIndex;
VALUE* pDataOut = (VALUE*)aDataOut;
VALUE defaultVal = *(VALUE*)pDefault;
LOGGING("getitem sizes %lld len: %lld def: %I64d or %lf\n", valLength, len, (int64_t)defaultVal, (double)defaultVal);
LOGGING("**V %p I %p O %p %llu \n", pValues, pIndex, pDataOut, valLength);
VALUE* pDataOutEnd = pDataOut + len;
if (sizeof(VALUE) == strideValue && sizeof(INDEX) == strideIndex) {
while (pDataOut != pDataOutEnd) {
const INDEX index = *pIndex;
*pDataOut =
// Make sure the item is in range; if the index is negative -- but otherwise
// still in range -- mimic Python's negative-indexing support.
index >= -valLength && index < valLength
? pValues[index >= 0 ? index : index + valLength]
// Index is out of range -- assign the invalid value.
: defaultVal;
pIndex++;
pDataOut++;
}
}
else {
// Either A or B or both are strided
while (pDataOut != pDataOutEnd) {
const INDEX index = *pIndex;
// Make sure the item is in range; if the index is negative -- but otherwise
// still in range -- mimic Python's negative-indexing support.
if (index >= -valLength && index < valLength) {
int64_t newindex = index >= 0 ? index : index + valLength;
newindex *= strideValue;
*pDataOut = *(VALUE*)((char*)pValues + newindex);
}
else {
// Index is out of range -- assign the invalid value.
*pDataOut = defaultVal;
}
pIndex = STRIDE_NEXT(const INDEX, pIndex, strideIndex);
pDataOut++;
}
}
}
//----------------------------------------------------
// Consider: C=A[B] where A is a value array
// C must be the same type as A (and is also a value array)
// B is an integer that indexes into A
// The length of B is the length of the output C
// valSize is the length of A
// aValues : remains constant (pointer to A)
// aIndex : incremented each call (pIndex) traverses B
// aDataOut : incremented each call (pDataOut) traverses C
// NOTE: The output CANNOT be strided
template<typename VALUE, typename INDEX>
static void GetItemUInt(void* aValues, void* aIndex, void* aDataOut, int64_t valLength, int64_t itemSize, int64_t len, int64_t strideIndex, int64_t strideValue, void* pDefault) {
const VALUE* pValues = (VALUE*)aValues;
const INDEX* pIndex = (INDEX*)aIndex;
VALUE* pDataOut = (VALUE*)aDataOut;
VALUE defaultVal = *(VALUE*)pDefault;
LOGGING("getitem sizes %lld len: %lld def: %I64d or %lf\n", valLength, len, (int64_t)defaultVal, (double)defaultVal);
LOGGING("**V %p I %p O %p %llu \n", pValues, pIndex, pDataOut, valLength);
VALUE* pDataOutEnd = pDataOut + len;
if (sizeof(VALUE) == strideValue && sizeof(INDEX) == strideIndex) {
while (pDataOut != pDataOutEnd) {
const INDEX index = *pIndex;
*pDataOut =
// Make sure the item is in range
index < valLength
? pValues[index]
: defaultVal;
pIndex++;
pDataOut++;
}
}
else {
// Either A or B or both are strided
while (pDataOut != pDataOutEnd) {
const INDEX index = *pIndex;
// Make sure the item is in range; if the index is negative -- but otherwise
// still in range -- mimic Python's negative-indexing support.
if (index < valLength) {
*pDataOut = *(VALUE*)((char*)pValues + (strideValue * index));
}
else {
// Index is out of range -- assign the invalid value.
*pDataOut = defaultVal;
}
pIndex = STRIDE_NEXT(const INDEX, pIndex, strideIndex);
pDataOut++;
}
}
}
//----------------------------------------------------
// This routine is for strings or NPY_VOID (variable length)
// Consider: C=A[B] where A is a value array
// C must be the same type as A (and is also a value array)
// B is an integer that indexes into A
// The length of B is the length of the output C
// valSize is the length of A
template<typename INDEX>
static void GetItemIntVariable(void* aValues, void* aIndex, void* aDataOut, int64_t valLength, int64_t itemSize, int64_t len, int64_t strideIndex, int64_t strideValue, void* pDefault) {
const char* pValues = (char*)aValues;
const INDEX* pIndex = (INDEX*)aIndex;
char* pDataOut = (char*)aDataOut;
LOGGING("getitem sizes %I64d len: %I64d itemsize:%I64d\n", valLength, len, itemSize);
LOGGING("**V %p I %p O %p %llu \n", pValues, pIndex, pDataOut, valLength);
char* pDataOutEnd = pDataOut + (len * itemSize);
if (itemSize == strideValue && sizeof(INDEX) == strideIndex) {
while (pDataOut != pDataOutEnd) {
const INDEX index = *pIndex;
const char* pSrc;
if (index >= -valLength && index < valLength) {
int64_t newindex = index >= 0 ? index : index + valLength;
newindex *= itemSize;
pSrc = pValues + newindex;
}
else {
pSrc = (const char*)pDefault;
}
char* pEnd = pDataOut + itemSize;
while (pDataOut < (pEnd - 8)) {
*(int64_t*)pDataOut = *(int64_t*)pSrc;
pDataOut += 8;
pSrc += 8;
}
while (pDataOut < pEnd) {
*pDataOut++ = *pSrc++;
}
// memcpy(pDataOut, pSrc, itemSize);
pIndex++;
}
}
else {
// Either A or B or both are strided
while (pDataOut != pDataOutEnd) {
const INDEX index = *pIndex;
const char* pSrc;
if (index >= -valLength && index < valLength) {
int64_t newindex = index >= 0 ? index : index + valLength;
newindex *= strideValue;
pSrc = pValues + newindex;
}
else {
pSrc = (const char*)pDefault;
}
char* pEnd = pDataOut + itemSize;
while (pDataOut < (pEnd - 8)) {
*(int64_t*)pDataOut = *(int64_t*)pSrc;
pDataOut += 8;
pSrc += 8;
}
while (pDataOut < pEnd) {
*pDataOut++ = *pSrc++;
}
pIndex = STRIDE_NEXT(const INDEX, pIndex, strideIndex);
}
}
}
template<typename INDEX>
static void GetItemUIntVariable(void* aValues, void* aIndex, void* aDataOut, int64_t valLength, int64_t itemSize, int64_t len, int64_t strideIndex, int64_t strideValue, void* pDefault) {
const char* pValues = (char*)aValues;
const INDEX* pIndex = (INDEX*)aIndex;
char* pDataOut = (char*)aDataOut;
LOGGING("getitem sizes %I64d len: %I64d itemsize:%I64d\n", valLength, len, itemSize);
LOGGING("**V %p I %p O %p %llu \n", pValues, pIndex, pDataOut, valLength);
char* pDataOutEnd = pDataOut + (len * itemSize);
if (itemSize == strideValue && sizeof(INDEX) == strideIndex) {
while (pDataOut != pDataOutEnd) {
const INDEX index = *pIndex;
const char* pSrc;
if (index < valLength) {
pSrc = pValues + (itemSize * index);
}
else {
pSrc = (const char*)pDefault;
}
char* pEnd = pDataOut + itemSize;
while (pDataOut < (pEnd - 8)) {
*(int64_t*)pDataOut = *(int64_t*)pSrc;
pDataOut += 8;
pSrc += 8;
}
while (pDataOut < pEnd) {
*pDataOut++ = *pSrc++;
}
// memcpy(pDataOut, pSrc, itemSize);
pIndex++;
pDataOut += itemSize;
}
}
else {
// Either A or B or both are strided
while (pDataOut != pDataOutEnd) {
const INDEX index = *pIndex;
const char* pSrc;
if (index < valLength) {
pSrc = pValues + (strideValue * index);
}
else {
pSrc = (const char*)pDefault;
}
char* pEnd = pDataOut + itemSize;
while (pDataOut < (pEnd - 8)) {
*(int64_t*)pDataOut = *(int64_t*)pSrc;
pDataOut += 8;
pSrc += 8;
}
while (pDataOut < pEnd) {
*pDataOut++ = *pSrc++;
}
pIndex = STRIDE_NEXT(const INDEX, pIndex, strideIndex);
pDataOut += itemSize;
}
}
}
typedef void(*GETITEM_FUNC)(void* pDataIn, void* pDataIn2, void* pDataOut, int64_t valLength, int64_t itemSize, int64_t len, int64_t strideIndex, int64_t strideValue, void* pDefault);
struct MBGET_CALLBACK {
GETITEM_FUNC GetItemCallback;
void* pValues; // value array or A in the equation C=A[B]
void* pIndex; // index array or B in the equation C=A[B]
void* pDataOut; // output array or C in the equation C=A[B]
int64_t aValueLength;
int64_t aIndexLength;
int64_t aValueItemSize;
int64_t aIndexItemSize;
int64_t strideValue;
int64_t strideIndex;
void* pDefault;
} stMBGCallback;
//---------------------------------------------------------
// Used by GetItem
// Concurrent callback from multiple threads
static int64_t GetItemCallback(struct stMATH_WORKER_ITEM* pstWorkerItem, int core, int64_t workIndex) {
int64_t didSomeWork = 0;
MBGET_CALLBACK* Callback = &stMBGCallback; // (MBGET_CALLBACK*)&pstWorkerItem->WorkCallbackArg;
char* aValues = (char*)Callback->pValues;
char* aIndex = (char*)Callback->pIndex;
int64_t valueItemSize = Callback->aValueItemSize;
int64_t strideValue = Callback->strideValue;
int64_t strideIndex = Callback->strideIndex;
LOGGING("check2 ** %lld %lld\n", typeSizeValues, typeSizeIndex);
int64_t lenX;
int64_t workBlock;
// As long as there is work to do
while ((lenX = pstWorkerItem->GetNextWorkBlock(&workBlock)) > 0) {
// Do NOT move aValues
// Move aIndex
// Move pDataOut (same type as Values)
// move starting position
// Calculate how much to adjust the pointers to get to the data for this work block
int64_t blockStart = workBlock * pstWorkerItem->BlockSize;
int64_t valueAdj = blockStart * strideValue;
int64_t indexAdj = blockStart * strideIndex;
LOGGING("%d : workBlock %lld blocksize: %lld lenx: %lld %lld %lld %lld %lld\n", core, workBlock, pstWorkerItem->BlockSize, lenX, typeSizeValues, typeSizeIndex, valueAdj, indexAdj);
Callback->GetItemCallback(aValues, aIndex + indexAdj, (char*)Callback->pDataOut + valueAdj, Callback->aValueLength, valueItemSize, lenX, strideIndex, strideValue, Callback->pDefault);
// Indicate we completed a block
didSomeWork++;
// tell others we completed this work block
pstWorkerItem->CompleteWorkBlock(core);
}
return didSomeWork;
}
//------------------------------------------------------------
// itemSize is Values itemSize
// indexType is Index type
static GETITEM_FUNC GetItemFunction(int64_t itemSize, int indexType) {
switch (indexType) {
case NPY_INT8:
switch (itemSize) {
case 1: return GetItemInt<int8_t, int8_t>;
case 2: return GetItemInt<int16_t, int8_t>;
case 4: return GetItemInt<int32_t, int8_t>;
case 8: return GetItemInt<int64_t, int8_t>;
case 16: return GetItemInt<__m128, int8_t>;
default: return GetItemIntVariable<int8_t>;
}
break;
case NPY_UINT8:
switch (itemSize) {
case 1: return GetItemUInt<int8_t, int8_t>;
case 2: return GetItemUInt<int16_t, int8_t>;
case 4: return GetItemUInt<int32_t, int8_t>;
case 8: return GetItemUInt<int64_t, int8_t>;
case 16: return GetItemUInt<__m128, int8_t>;
default: return GetItemUIntVariable<int8_t>;
}
break;
case NPY_INT16:
switch (itemSize) {
case 1: return GetItemInt<int8_t, int16_t>;
case 2: return GetItemInt<int16_t, int16_t>;
case 4: return GetItemInt<int32_t, int16_t>;
case 8: return GetItemInt<int64_t, int16_t>;
case 16: return GetItemInt<__m128, int16_t>;
default: return GetItemIntVariable<int16_t>;
}
break;
case NPY_UINT16:
switch (itemSize) {
case 1: return GetItemUInt<int8_t, int16_t>;
case 2: return GetItemUInt<int16_t, int16_t>;
case 4: return GetItemUInt<int32_t, int16_t>;
case 8: return GetItemUInt<int64_t, int16_t>;
case 16: return GetItemUInt<__m128, int16_t>;
default: return GetItemUIntVariable<int16_t>;
}
break;
CASE_NPY_INT32:
switch (itemSize) {
case 1: return GetItemInt<int8_t, int32_t>;
case 2: return GetItemInt<int16_t, int32_t>;
case 4: return GetItemInt<int32_t, int32_t>;
case 8: return GetItemInt<int64_t, int32_t>;
case 16: return GetItemInt<__m128, int32_t>;
default: return GetItemIntVariable<int32_t>;
}
break;
CASE_NPY_UINT32:
switch (itemSize) {
case 1: return GetItemUInt<int8_t, int32_t>;
case 2: return GetItemUInt<int16_t, int32_t>;
case 4: return GetItemUInt<int32_t, int32_t>;
case 8: return GetItemUInt<int64_t, int32_t>;
case 16: return GetItemUInt<__m128, int32_t>;
default: return GetItemUIntVariable<int32_t>;
}
break;
CASE_NPY_INT64:
switch (itemSize) {
case 1: return GetItemInt<int8_t, int64_t>;
case 2: return GetItemInt<int16_t, int64_t>;
case 4: return GetItemInt<int32_t, int64_t>;
case 8: return GetItemInt<int64_t, int64_t>;
case 16: return GetItemInt<__m128, int64_t>;
default: return GetItemIntVariable<int64_t>;
}
break;
CASE_NPY_UINT64:
switch (itemSize) {
case 1: return GetItemUInt<int8_t, int64_t>;
case 2: return GetItemUInt<int16_t, int64_t>;
case 4: return GetItemUInt<int32_t, int64_t>;
case 8: return GetItemUInt<int64_t, int64_t>;
case 16: return GetItemUInt<__m128, int64_t>;
default: return GetItemUIntVariable<int64_t>;
}
break;
}
return NULL;
}
//---------------------------------------------------------------------------
// Input:
// Arg1: numpy array aValues (can be anything)
// Arg2: numpy array aIndex (must be int8_t/int16_t/int32_t or int64_t)
// Arg3: default value
//
//def fixMbget(aValues, aIndex, result, default) :
// """
// A proto routine.
// """
// N = aIndex.shape[0]
// valSize = aValues.shape[0]
// for i in range(N) :
// if (aIndex[i] >= 0 and aIndex[i] < valSize) :
// result[i] = aValues[aIndex[i]]
// else :
// result[i] = default (OR RETURN ERROR)
extern "C" PyObject*
getitem(PyObject* self, PyObject* args)
{
PyArrayObject* aValues = NULL;
PyArrayObject* aIndex = NULL;
PyObject* defaultValue = NULL;
if (PyTuple_Size(args) == 2) {
if (!PyArg_ParseTuple(
args, "O!O!:getitem",
pPyArray_Type, &aValues,
pPyArray_Type, &aIndex
)) {
return NULL;
}
defaultValue = Py_None;
}
else
if (!PyArg_ParseTuple(
args, "O!O!O:getitem",
pPyArray_Type, &aValues,
pPyArray_Type, &aIndex,
&defaultValue)) {
return NULL;
}
int32_t numpyValuesType = PyArray_TYPE(aValues);
int32_t numpyIndexType = PyArray_TYPE(aIndex);
// TODO: For boolean call
if (numpyIndexType > NPY_LONGDOUBLE) {
PyErr_Format(PyExc_ValueError, "Dont know how to convert these types %d using index dtype: %d", numpyValuesType, numpyIndexType);
return NULL;
}
if (numpyIndexType == NPY_BOOL) {
// special path for boolean
return BooleanIndexInternal(aValues, aIndex);
}
int ndimValue;
int ndimIndex;
int64_t strideValue = 0;
int64_t strideIndex = 0;
int result1 = GetStridesAndContig(aValues, ndimValue, strideValue);
int result2 = GetStridesAndContig(aIndex, ndimIndex, strideIndex);
// This logic is not quite correct, if the strides on all dimensions are the same, we can use this routine
if (result1 != 0) {
if (!PyArray_ISCONTIGUOUS(aValues)) {
PyErr_Format(PyExc_ValueError, "Dont know how to handle multidimensional array %d using index dtype: %d", numpyValuesType, numpyIndexType);
return NULL;
}
}
if (result2 != 0) {
if (!PyArray_ISCONTIGUOUS(aIndex)) {
PyErr_Format(PyExc_ValueError, "Dont know how to handle multidimensional array %d using index dtype: %d", numpyValuesType, numpyIndexType);
return NULL;
}
}
//printf("numpy types %d %d\n", numpyValuesType, numpyIndexType);
void* pValues = PyArray_BYTES(aValues);
void* pIndex = PyArray_BYTES(aIndex);
int64_t aValueLength = ArrayLength(aValues);
int64_t aValueItemSize = PyArray_ITEMSIZE(aValues);
// Get the proper function to call
GETITEM_FUNC pFunction = GetItemFunction(aValueItemSize, numpyIndexType);
if (pFunction != NULL) {
PyArrayObject* outArray = (PyArrayObject*)Py_None;
int64_t aIndexLength = ArrayLength(aIndex);
// Allocate the size of aIndex but the type is the value
outArray = AllocateLikeResize(aValues, aIndexLength);
if (outArray) {
void* pDataOut = PyArray_BYTES(outArray);
void* pDefault = GetDefaultForType(numpyValuesType);
// reserve a full 16 bytes for default in case we have oneS
char tempDefault[128];
// Check if a default value was passed in as third parameter
if (defaultValue != Py_None) {
BOOL result;
int64_t itemSize;
void* pTempData = NULL;
// Try to convert the scalar
result = ConvertScalarObject(defaultValue, &tempDefault, numpyValuesType, &pTempData, &itemSize);
if (result) {
// Assign the new default for out of range indexes
pDefault = &tempDefault;
}
}
stMATH_WORKER_ITEM* pWorkItem = THREADER ? THREADER->GetWorkItem(aIndexLength) : NULL;
if (pWorkItem == NULL) {
// Threading not allowed for this work item, call it directly from main thread
//typedef void(*GETITEM_FUNC)(void* pDataIn, void* pDataIn2, void* pDataOut, int64_t valSize, int64_t itemSize, int64_t len, int64_t strideIndex, int64_t strideValue, void* pDefault);
pFunction(pValues, pIndex, pDataOut, aValueLength, aValueItemSize, aIndexLength, strideIndex, strideValue, pDefault);
}
else {
// Each thread will call this routine with the callbackArg
// typedef int64_t(*DOWORK_CALLBACK)(struct stMATH_WORKER_ITEM* pstWorkerItem, int core, int64_t workIndex);
pWorkItem->DoWorkCallback = GetItemCallback;
pWorkItem->WorkCallbackArg = &stMBGCallback;
stMBGCallback.GetItemCallback = pFunction;
stMBGCallback.pValues = pValues;
stMBGCallback.pIndex = pIndex;
stMBGCallback.pDataOut = pDataOut;
// arraylength of values input array -- used to check array bounds
stMBGCallback.aValueLength = aValueLength;
stMBGCallback.aIndexLength = aIndexLength;
stMBGCallback.pDefault = pDefault;
//
stMBGCallback.aValueItemSize = aValueItemSize;
stMBGCallback.aIndexItemSize = PyArray_ITEMSIZE(aIndex);
stMBGCallback.strideIndex = strideIndex;
stMBGCallback.strideValue = strideValue;
//printf("**check %p %p %p %lld %lld\n", pValues, pIndex, pDataOut, stMBGCallback.TypeSizeValues, stMBGCallback.TypeSizeIndex);
// This will notify the worker threads of a new work item
THREADER->WorkMain(pWorkItem, aIndexLength, 0);
//g_cMathWorker->WorkMain(pWorkItem, aIndexLength);
}
return (PyObject*)outArray;
}
PyErr_Format(PyExc_ValueError, "GetItem ran out of memory %d %d", numpyValuesType, numpyIndexType);
return NULL;
}
PyErr_Format(PyExc_ValueError, "Dont know how to convert these types %d %d", numpyValuesType, numpyIndexType);
return NULL;
}
| [
"thomasdimitri@gmail.com"
] | thomasdimitri@gmail.com |
68d07b846e464ca1d777cab83d67c15d077b4202 | 398c669cca38f0fda18024d8a36b8fe770932b59 | /interviewbit/arrays/Min_Steps_in_Infinite_Grid.cpp | e3a664c071678a598e07cd136524856c81abc485 | [] | no_license | anand13sethi/algorithms | 98a5be819219d43007820b0a35500d46532d485a | ea270c21af16671fe1cbc8d9d4ee208e0ca76a6a | refs/heads/master | 2020-08-04T01:05:20.209078 | 2019-09-30T20:14:19 | 2019-09-30T20:14:19 | 211,946,816 | 0 | 1 | null | 2019-09-30T20:08:40 | 2019-09-30T20:08:39 | null | UTF-8 | C++ | false | false | 1,009 | cpp | /*
You are in an infinite 2D grid where you can move in any of the 8 directions :
(x,y) to
(x+1, y),
(x - 1, y),
(x, y+1),
(x, y-1),
(x-1, y-1),
(x+1,y+1),
(x-1,y+1),
(x+1,y-1)
You are given a sequence of points and the order in which you need to cover the points.
Give the minimum number of steps in which you can achieve it. You start from the first point.
Input :
Given two integer arrays A and B, where A[i] is x coordinate and B[i] is y coordinate of ith point respectively.
Output :
Return an Integer, i.e minimum number of steps.
Example :
Input : [(0, 0), (1, 1), (1, 2)]
Output : 2
It takes 1 step to move from (0, 0) to (1, 1). It takes one more step to move from (1, 1) to (1, 2).
*/
int Solution::coverPoints(vector<int> &A, vector<int> &B) {
int res = 0, n = A.size();
for(int i = 1; i < n; i++) {
int x = abs(A[i-1]-A[i]);
int y = abs(B[i-1]-B[i]);
int d = max(x, y);
res += d;
}
return res;
} | [
"aishwary.dewangan@gmail.com"
] | aishwary.dewangan@gmail.com |
360649de21ffc60b72021600ba9635056eb1216f | 5af68d43b182694e6955be8de0a84ecea20c078d | /BlackCat.Physics/Physics/Body/bcRigidStatic.h | ee3cba8409815a4d31d281f65145e3bd82cce9ab | [] | no_license | coder965/BlackCat-Engine | 1ed5c3d33c67c537eaa1ae7d1afe40192296e03f | a692f95d5c5f0c86ababa0c5ecc06531f569f500 | refs/heads/master | 2020-03-18T21:41:31.035603 | 2017-04-15T16:53:26 | 2017-04-15T16:53:26 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 919 | h | // [12/01/2016 MRB]
#pragma once
#include "Physics/bcPhysicsApi.h"
#include "Physics/Body/bcRigidBody.h"
namespace black_cat
{
namespace physics
{
template< bc_physics_api TApi >
struct bc_platform_rigid_static_pack
{
};
template< bc_physics_api TApi >
class bc_platform_rigid_static : public bc_platform_rigid_body< TApi >
{
public:
using platform_pack = bc_platform_rigid_static_pack< TApi >;
public:
bc_platform_rigid_static();
bc_platform_rigid_static(const bc_platform_rigid_static&) noexcept;
~bc_platform_rigid_static();
bc_platform_rigid_static& operator=(const bc_platform_rigid_static&) noexcept;
platform_pack& get_platform_pack()
{
return m_pack;
}
protected:
private:
platform_pack m_pack;
};
using bc_rigid_static = bc_platform_rigid_static< g_current_physics_api >;
using bc_rigid_static_ref = bc_physics_ref<bc_rigid_static>;
}
} | [
"mohammad.r.barzegar@gmail.com"
] | mohammad.r.barzegar@gmail.com |
05c97803137d3427836a5b92558968952875c2e1 | f2cac9043a23c41ba7821e2aab3b152acfff8b83 | /二叉树层平均数.cpp | 771a2870598a159b52d55856c4fae215755f795f | [] | no_license | Amanda21088/code1 | 99ba54f6917a55ef1d89ec1add0a01edfd7b1a75 | 70c5ffaa3b95334e584a01db6d034ca98fd70501 | refs/heads/master | 2020-04-04T18:54:55.165708 | 2019-11-05T15:49:53 | 2019-11-05T15:49:53 | 156,184,888 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 595 | cpp | #define _CRT_SECURE_NO_WARNINGS 1
class Solution {
public:
vector<double> averageOfLevels(TreeNode* root) {
vector<double> vd;
queue<TreeNode*> q;
q.push(root);
while (!q.empty())
{
vector<int> v;
int size = q.size();
while (size--)
{
TreeNode* t = q.front();
v.push_back(q.front()->val);
q.pop();
if (t->left)
q.push(t->left);
if (t->right)
q.push(t->right);
}
double sum = 0;
for (int i = 0; i < v.size(); i++)
{
sum += v[i];
}
double tmp = sum / v.size();
vd.push_back(tmp);
v.clear();
}
return vd;
}
};
| [
"1663478999@qq.com"
] | 1663478999@qq.com |
95c6abfa22e4b572f0fee71e0018ca421500d859 | 2b38f61f8febf0f72113dad7e45d0c71af900b06 | /trunk/BTrackerCore/algorithms/PCADistance.h | ac9287e9e836daa684978cd6e839cb9895eb7454 | [] | no_license | BGCX067/facetracking-svn-to-git | 211b89eef02f60bbfc1dfb3d2eb57fcdc3281b4c | 201e46e2e897822c1439093430462f6c54313fa7 | refs/heads/master | 2016-09-01T08:55:25.777412 | 2015-12-28T14:23:42 | 2015-12-28T14:23:42 | 48,837,861 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 506 | h | /*
* PCADistance.h
* FT2
*
* Created by Andre Cohen on 1/21/09.
* Copyright 2009 Rutgers University. All rights reserved.
*
*/
#ifndef _PCA_DISTANCE_H_
#define _PCA_DISTANCE_H_
#include "Analyzer.h"
#include "PCA.h"
class PCADistance : public Analyzer {
public:
virtual double evaluate(shared_ptr<Sample>, shared_ptr<Sample>);
virtual void end(shared_ptr<Sample>);
protected:
double evaluateWithBasis(shared_ptr<Sample>, shared_ptr<Sample>, MatrixXf &);
private:
PCA pca;
};
#endif
| [
"you@example.com"
] | you@example.com |
3abe17b16292aaeaf0ba332a0a37748621ed148c | af158a8305d0fb3285ab6d91791ecba6530e6e0f | /Core/include/ShadyApp.h | bc1592ace4df22591ade9a9392bd6634ff594b5c | [] | no_license | achirinus/Shady | 6097277eb7f0249569d5f91f314237c487d64000 | 030edff1862735311564947d9d508c3406fb1824 | refs/heads/master | 2020-11-30T05:02:47.926133 | 2018-06-03T10:29:19 | 2018-06-03T10:29:19 | 96,609,940 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,791 | h | #ifndef SHADY_APP_H
#define SHADY_APP_H
#include "Window.h"
#include "Commons.h"
#include "ShMouse.h"
#include "ShFile.h"
#include "StringUtils.h"
#include "ShKeyboard.h"
#include "FileChangeObserver.h"
#include "Sprite.h"
#include "ShClock.h"
#include "Camera2D.h"
#include "Renderer2D.h"
#include "ShFont.h"
#include "Line2D.h"
#include "Shader.h"
#include "Texture.h"
#include "ShMath.h"
#include "Graphics.h"
#include "InputManager.h"
#include "TimerManager.h"
#include "Cube.h"
#include "Renderer3D.h"
#include "ShBitset.h"
#include "ShSArray.h"
#include "Console.h"
namespace Shady
{
class ShadyApp : public Object
{
private:
static ShadyApp* sInstance;
ShadyApp():mMainWindow(0), mMouse(0), mKeyboard(0), mFpsLimit(0),
mUpdateLimit(0), mFps(0), mUps(0), mFrameCount(0),
mFrameClock(), mUpdateClock(), mUdt(0.0f), mFdt(0.0f) {}
void initGameState();
public:
Window* mMainWindow;
Mouse* mMouse;
Keyboard* mKeyboard;
InputManager* mInputManager;
FileChangeObserver* mFileObserver;
TimerManager* mTimerManager;
Console* mConsole;
Clock mFrameClock;
Clock mUpdateClock;
u32 mFpsLimit;
u32 mUpdateLimit; //This is expressed in updates/s too
f32 mUdt;
f32 mFdt;
u32 mFps;
u32 mUps;
u32 mFrameCount;
//Gamestate stuff
Camera2D* camera2d;
Renderer2D* renderer2d;
Camera3D* camera3d;
Renderer3D* renderer3d;
Font* currentFont;
Sprite* testSprite;
static ShadyApp* GetInstance();
void start();
void MainLoop();
void update(f32 dt);
void render(f32 dt);
void limit(f32 time, u32 freq);
void setFpsLimit(u32 fps);
void setUpdateFreq(u32 ups);
void countFps(f32 dt);
void countUps(f32 dt);
s32 getWindowClientWidth();
s32 getWindowClientHeight();
//test stuff
Cube* cube;
};
}
#endif | [
"chirinus.alin@gmail.com"
] | chirinus.alin@gmail.com |
66a073e8d6f34b8ce352ebbf6e27c86842d18718 | bc01d89e3b77b9b60afd6f5f8fcad5675b813f8e | /natfw/natfwunsaf_protocols/tsrc/ut_unsaf_codec/src/ut_cnatfwunsafmessage.cpp | 74ce196334d4f2107e7a36d2b800faeac67b7911 | [] | no_license | SymbianSource/oss.FCL.sf.mw.ipappsrv | fce862742655303fcfa05b9e77788734aa66724e | 65c20a5a6e85f048aa40eb91066941f2f508a4d2 | refs/heads/master | 2021-01-12T15:40:59.380107 | 2010-09-17T05:32:38 | 2010-09-17T05:32:38 | 71,849,396 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 25,523 | cpp | /*
* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
* which accompanies this distribution, and is available
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
* Initial Contributors:
* Nokia Corporation - initial contribution.
*
* Contributors:
*
* Description:
*
*/
// CLASS HEADER
#include "UT_CNATFWUNSAFMessage.h"
// EXTERNAL INCLUDES
#include <digia/eunit/eunitmacros.h>
#include <in_sock.h>
#include <hash.h>
// INTERNAL INCLUDES
#include "natfwunsafcommontestdefs.h"
#include "natfwunsafbindingrequest.h"
#include "natfwunsafmappedaddressattribute.h"
#include "natfwunsafresponseaddressattribute.h"
#include "natfwunsafchangedaddressattribute.h"
#include "natfwunsaferrorcodeattribute.h"
#include "natfwunsafunknownattributesattribute.h"
#include "natfwunsafxormappedAddressattribute.h"
// CONSTRUCTION
UT_CNATFWUNSAFMessage* UT_CNATFWUNSAFMessage::NewL()
{
UT_CNATFWUNSAFMessage* self = UT_CNATFWUNSAFMessage::NewLC();
CleanupStack::Pop();
return self;
}
UT_CNATFWUNSAFMessage* UT_CNATFWUNSAFMessage::NewLC()
{
UT_CNATFWUNSAFMessage* self = new( ELeave ) UT_CNATFWUNSAFMessage();
CleanupStack::PushL( self );
self->ConstructL();
return self;
}
// Destructor (virtual by CBase)
UT_CNATFWUNSAFMessage::~UT_CNATFWUNSAFMessage()
{
}
// Default constructor
UT_CNATFWUNSAFMessage::UT_CNATFWUNSAFMessage()
{
}
// Second phase construct
void UT_CNATFWUNSAFMessage::ConstructL()
{
// The ConstructL from the base class CEUnitTestSuiteClass must be called.
// It generates the test case table.
CEUnitTestSuiteClass::ConstructL();
}
// METHODS
void UT_CNATFWUNSAFMessage::SetupL ()
{
//Fill TransactionID with dummy values
_LIT8(KTaId, "............");
iTaID = KTaId;
for (TInt i=0; i < KMaxNATFWUNSAFTransactionIdLength; ++i)
{
iTaID[i] = i;
}
iMsg = CNATFWUNSAFBindingRequest::NewL(iTaID);
TInetAddr addr(0x10203040, 5060);
iAttr = CNATFWUNSAFMappedAddressAttribute::NewL(addr);
}
void UT_CNATFWUNSAFMessage::Teardown()
{
delete iMsg;
iMsg = NULL;
delete iAttr;
iAttr = NULL;
}
void UT_CNATFWUNSAFMessage::TestTransactionIDL()
{
TNATFWUNSAFTransactionID taID = iMsg->TransactionID();
EUNIT_ASSERT(taID == iTaID);
}
void UT_CNATFWUNSAFMessage::TestTransactionID2L()
{
TNATFWUNSAFTransactionID taID = iMsg->TransactionID();
iTaID[10] = 0x55;
EUNIT_ASSERT(!(taID == iTaID));
}
void UT_CNATFWUNSAFMessage::TestTypeL()
{
EUNIT_ASSERT(CNATFWUNSAFMessage::EBindingRequest == iMsg->Type());
}
void UT_CNATFWUNSAFMessage::TestAttributeL()
{
EUNIT_ASSERT(!iMsg->Attribute(CNATFWUNSAFAttribute::EMappedAddress));
EUNIT_ASSERT(!iMsg->Attribute(CNATFWUNSAFAttribute::EResponseAddress));
}
void UT_CNATFWUNSAFMessage::TestAttribute2L()
{
iMsg->AddAttributeL(iAttr);
iAttr = NULL;
EUNIT_ASSERT(!iMsg->Attribute(CNATFWUNSAFAttribute::EResponseAddress));
EUNIT_ASSERT(iMsg->Attribute(CNATFWUNSAFAttribute::EMappedAddress) != NULL);
}
void UT_CNATFWUNSAFMessage::TestAttribute3L()
{
iMsg->AddAttributeL(iAttr);
iAttr = NULL;
CNATFWUNSAFAttribute *attr = iMsg->Attribute(CNATFWUNSAFAttribute::EMappedAddress);
iMsg->DetachAttribute(attr);
CleanupStack::PushL(attr);
EUNIT_ASSERT(!iMsg->Attribute(CNATFWUNSAFAttribute::EMappedAddress));
CleanupStack::PopAndDestroy(attr);
}
void UT_CNATFWUNSAFMessage::TestAttribute4L()
{
TInetAddr addr(0x1002009988, 1020);
CNATFWUNSAFResponseAddressAttribute* ra =
CNATFWUNSAFResponseAddressAttribute::NewLC(addr);
iMsg->AddAttributeL(ra);
CleanupStack::Pop(ra);
iMsg->AddAttributeL(iAttr);
iAttr = NULL;
EUNIT_ASSERT(iMsg->Attribute(CNATFWUNSAFAttribute::EResponseAddress) != NULL);
EUNIT_ASSERT(iMsg->Attribute(CNATFWUNSAFAttribute::EMappedAddress) != NULL);
//Detach one attribute
CNATFWUNSAFAttribute *attr = iMsg->Attribute(CNATFWUNSAFAttribute::EResponseAddress);
iMsg->DetachAttribute(attr);
CleanupStack::PushL(attr);
EUNIT_ASSERT(!iMsg->Attribute(CNATFWUNSAFAttribute::EResponseAddress));
EUNIT_ASSERT(iMsg->Attribute(CNATFWUNSAFAttribute::EMappedAddress) != NULL);
CleanupStack::PopAndDestroy(attr);
//Detach second attribute
attr = iMsg->Attribute(CNATFWUNSAFAttribute::EMappedAddress);
iMsg->DetachAttribute(attr);
delete attr;
EUNIT_ASSERT(!iMsg->Attribute(CNATFWUNSAFAttribute::EResponseAddress));
EUNIT_ASSERT(!iMsg->Attribute(CNATFWUNSAFAttribute::EMappedAddress));
}
void UT_CNATFWUNSAFMessage::TestAddAttributeL()
{
EUNIT_ASSERT(iMsg->iAttributes.Count() == 0);
iMsg->AddAttributeL(iAttr);
CNATFWUNSAFAttribute* attr = iAttr;
iAttr = NULL;
EUNIT_ASSERT(iMsg->iAttributes.Count() == 1);
//Pointers much match
EUNIT_ASSERT(iMsg->iAttributes[0] == attr);
}
void UT_CNATFWUNSAFMessage::TestDetachAttributeL()
{
iMsg->AddAttributeL(iAttr);
EUNIT_ASSERT(iMsg->iAttributes.Count() == 1);
CNATFWUNSAFAttribute* attr = iAttr;
iAttr = NULL;
iMsg->DetachAttribute(attr);
CleanupStack::PushL(attr);
EUNIT_ASSERT(iMsg->iAttributes.Count() == 0);
CleanupStack::PopAndDestroy(attr);
}
//Try to detach a non-existing attribute
void UT_CNATFWUNSAFMessage::TestDetachAttribute2L()
{
iMsg->AddAttributeL(iAttr);
EUNIT_ASSERT(iMsg->iAttributes.Count() == 1);
iAttr = NULL;
iMsg->DetachAttribute(NULL);
EUNIT_ASSERT(iMsg->iAttributes.Count() == 1);
}
//Try to delete attribute that doesn't exist in the message
void UT_CNATFWUNSAFMessage::TestDeleteAttributeL()
{
iMsg->AddAttributeL(iAttr);
iAttr = NULL;
EUNIT_ASSERT(iMsg->iAttributes.Count() == 1);
iMsg->DeleteAttribute(CNATFWUNSAFAttribute::EMessageIntegrity);
EUNIT_ASSERT(iMsg->iAttributes.Count() == 1);
iMsg->DeleteAttribute(CNATFWUNSAFAttribute::EUsername);
EUNIT_ASSERT(iMsg->iAttributes.Count() == 1);
}
//Delete one attribute from the message
void UT_CNATFWUNSAFMessage::TestDeleteAttribute2L()
{
TInetAddr addr(0x1002009988, 1020);
CNATFWUNSAFResponseAddressAttribute* ra =
CNATFWUNSAFResponseAddressAttribute::NewLC(addr);
iMsg->AddAttributeL(ra);
CleanupStack::Pop(ra);
iMsg->AddAttributeL(iAttr);
iAttr = NULL;
EUNIT_ASSERT(iMsg->iAttributes.Count() == 2);
iMsg->DeleteAttribute(CNATFWUNSAFAttribute::EMappedAddress);
EUNIT_ASSERT(iMsg->iAttributes.Count() == 1);
EUNIT_ASSERT(iMsg->HasAttribute(CNATFWUNSAFAttribute::EResponseAddress));
}
//Delete two attributes having the same type, from the message
void UT_CNATFWUNSAFMessage::TestDeleteAttribute3L()
{
TInetAddr addr(0x1002009988, 1020);
CNATFWUNSAFMappedAddressAttribute* ma =
CNATFWUNSAFMappedAddressAttribute::NewLC(addr);
iMsg->AddAttributeL(ma);
CleanupStack::Pop(ma);
iMsg->AddAttributeL(iAttr);
iAttr = NULL;
EUNIT_ASSERT(iMsg->iAttributes.Count() == 2);
iMsg->DeleteAttribute(CNATFWUNSAFAttribute::EMappedAddress);
EUNIT_ASSERT(iMsg->iAttributes.Count() == 0);
EUNIT_ASSERT(!iMsg->HasAttribute(CNATFWUNSAFAttribute::EMappedAddress));
}
//Delete several attributes, one by one, from the message
void UT_CNATFWUNSAFMessage::TestDeleteAttribute4L()
{
TInetAddr addr(0x1002009988, 1020);
CNATFWUNSAFChangedAddressAttribute* ca =
CNATFWUNSAFChangedAddressAttribute::NewLC(addr);
iMsg->AddAttributeL(ca);
CleanupStack::Pop(ca);
CNATFWUNSAFResponseAddressAttribute* ra =
CNATFWUNSAFResponseAddressAttribute::NewLC(addr);
iMsg->AddAttributeL(ra);
CleanupStack::Pop(ra);
iMsg->AddAttributeL(iAttr);
iAttr = NULL;
EUNIT_ASSERT(iMsg->iAttributes.Count() == 3);
iMsg->DeleteAttribute(CNATFWUNSAFAttribute::EResponseAddress);
EUNIT_ASSERT(iMsg->iAttributes.Count() == 2);
EUNIT_ASSERT(iMsg->HasAttribute(CNATFWUNSAFAttribute::EChangedAddress));
EUNIT_ASSERT(iMsg->HasAttribute(CNATFWUNSAFAttribute::EMappedAddress));
iMsg->DeleteAttribute(CNATFWUNSAFAttribute::EMappedAddress);
EUNIT_ASSERT(iMsg->iAttributes.Count() == 1);
EUNIT_ASSERT(iMsg->HasAttribute(CNATFWUNSAFAttribute::EChangedAddress));
//Try to delete MAPPED-ADDRESS again
iMsg->DeleteAttribute(CNATFWUNSAFAttribute::EMappedAddress);
EUNIT_ASSERT(iMsg->iAttributes.Count() == 1);
EUNIT_ASSERT(iMsg->HasAttribute(CNATFWUNSAFAttribute::EChangedAddress));
iMsg->DeleteAttribute(CNATFWUNSAFAttribute::EChangedAddress);
EUNIT_ASSERT(iMsg->iAttributes.Count() == 0);
EUNIT_ASSERT(!iMsg->HasAttribute(CNATFWUNSAFAttribute::EChangedAddress));
}
//Encode UNSAF message without any attributes
void UT_CNATFWUNSAFMessage::TestEncodeL()
{
const TUint8 KExpectedResult[] =
{
0, 1, //UNSAF message type: Binding Request
0, 0, //Message length
0x21, 0x12, 0xa4, 0x42, //Magic cookie
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0xa, 0xb //TransactionID
};
CBufBase* msg = iMsg->EncodeL();
CleanupStack::PushL(msg);
EUNIT_ASSERT(CNATFWUNSAFMessage::EHeaderSize == msg->Size());
CompareEncodedUNSAFMessageL(KExpectedResult, *msg);
CleanupStack::PopAndDestroy(msg);
}
//Encode UNSAF message with one attribute
void UT_CNATFWUNSAFMessage::TestEncode2L()
{
const TUint8 KExpectedResult[] =
{
0, 1, //UNSAF message type: Binding Request
0, 0x18, //Message length (one MAPPED-ADDRESS attribute)
0x21, 0x12, 0xa4, 0x42, //Magic cookie
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0xa, 0xb, //TransactionID
//MAPPED-ADDRESS attribute
0, 1, //type
0, 0x14, //length of value element
0, //undefined
2, //family IPv6
0x00, 0x00, //port
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00 //address
};
TInetAddr addr(0x00000000, 0x0000);
CNATFWUNSAFMappedAddressAttribute* attr =
CNATFWUNSAFMappedAddressAttribute::NewLC(addr);
iMsg->AddAttributeL(attr);
CleanupStack::Pop(attr);
CBufBase* msg = iMsg->EncodeL();
CleanupStack::PushL(msg);
EUNIT_ASSERT(CNATFWUNSAFMessage::EHeaderSize + 24 == msg->Size());
CompareEncodedUNSAFMessageL(KExpectedResult, *msg);
CleanupStack::PopAndDestroy(msg);
}
//Encode UNSAF message with two attributes
void UT_CNATFWUNSAFMessage::TestEncode3L()
{
const TUint8 KExpectedResult[] =
{
0, 1, //UNSAF message type: Binding Request
0, 24, //Message length
0x21, 0x12, 0xa4, 0x42, //Magic cookie
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0xa, 0xb, //TransactionID
//RESPONSE-ADDRESS attribute
0, 2, //type
0, 8, //length of value element
0, //undefined
1, //family
0xab, 0xcd, //port
5, 6, 7, 8, //address
//MAPPED-ADDRESS attribute
0, 1, //type
0, 8, //length of value element
0, //undefined
1, //family
0x12, 0x34, //port
0x50, 0x40, 0xff, 0xaa //address
};
TInetAddr addr(INET_ADDR(5,6,7,8), 0xabcd);
CNATFWUNSAFAttribute* attr =
CNATFWUNSAFResponseAddressAttribute::NewLC(addr);
iMsg->AddAttributeL(attr);
CleanupStack::Pop(attr);
attr = NULL;
TInetAddr addr2(0x5040ffaa, 0x1234);
attr = CNATFWUNSAFMappedAddressAttribute::NewLC(addr2);
iMsg->AddAttributeL(attr);
CleanupStack::Pop(attr);
CBufBase* msg = iMsg->EncodeL();
CleanupStack::PushL(msg);
EUNIT_ASSERT(CNATFWUNSAFMessage::EHeaderSize + 24 == msg->Size());
CompareEncodedUNSAFMessageL(KExpectedResult, *msg);
CleanupStack::PopAndDestroy(msg);
}
//Encode UNSAF message with two attributes
void UT_CNATFWUNSAFMessage::TestEncode4L()
{
const TUint8 KExpectedResult[] =
{
0, 1, //UNSAF message type: Binding Request
0, 36, //Message length
0x21, 0x12, 0xa4, 0x42, //Magic cookie
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0xa, 0xb, //TransactionID
//ERROR-CODE attribute
0, 9, //type
0, 20, //length of value element
0, 0, //zero
2, //class
25, //number
'E', 'r', 'r', 'o', //Reason Phrase
'r', ' ', 'r', 'e',
's', 'u', 'l', 't',
' ', 'n', 'o', 'w',
//UNKNOWN-ATTRIBUTES attribute
0, 0xa, //type
0, 8, //length of value element
0x12, 0x34, //first unknown attribute
0xab, 0x0c,
0xff, 0x90,
0x12, 0x34 //repeated attribute
};
_LIT8(KReason, "Error result now");
TInt responseCode = 225;
CNATFWUNSAFAttribute* attr =
CNATFWUNSAFErrorCodeAttribute::NewLC(responseCode, KReason);
iMsg->AddAttributeL(attr);
CleanupStack::Pop(attr);
attr = NULL;
TUint attrType = 0x1234;
TUint attrType2 = 0xab0c;
TUint attrType3 = 0xff90;
CNATFWUNSAFUnknownAttributesAttribute* uaAttr =
CNATFWUNSAFUnknownAttributesAttribute::NewLC();
uaAttr->AddContainedAttributeL(attrType);
uaAttr->AddContainedAttributeL(attrType2);
uaAttr->AddContainedAttributeL(attrType3);
iMsg->AddAttributeL(uaAttr);
CleanupStack::Pop(uaAttr);
CBufBase* msg = iMsg->EncodeL();
CleanupStack::PushL(msg);
EUNIT_ASSERT(CNATFWUNSAFMessage::EHeaderSize + 36 == msg->Size());
CompareEncodedUNSAFMessageL(KExpectedResult, *msg);
CleanupStack::PopAndDestroy(msg);
}
void UT_CNATFWUNSAFMessage::TestEncodeWithHashL()
{
const TUint8 KExpectedResult[] =
{
0, 1, //UNSAF message type: Binding Request
0, 36, //Message length
0x21, 0x12, 0xa4, 0x42, //Magic cookie
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0xa, 0xb, //TransactionID
//RESPONSE-ADDRESS attribute
0, 2, //type
0, 8, //length of value element
0, //undefined
1, //family
0xab, 0xcd, //port
5, 6, 7, 8, //address
//MESSAGE-INTEGRITY attribute
0, 8, //type
0, SHA1_HASH //length of value element
//???? //HMAC: To be found out how to verify HMAC correctness
};
TInetAddr addr(INET_ADDR(5,6,7,8), 0xabcd);
CNATFWUNSAFAttribute* attr =
CNATFWUNSAFResponseAddressAttribute::NewLC(addr);
iMsg->AddAttributeL(attr);
CleanupStack::Pop(attr);
attr = NULL;
CBufBase* msg = iMsg->EncodeL(_L8("password"));
CleanupStack::PushL(msg);
EUNIT_ASSERT(CNATFWUNSAFMessage::EHeaderSize + 36 == msg->Size());
//Compare up to the beginning of HMAC
CompareEncodedUNSAFMessageL(KExpectedResult, *msg,
CNATFWUNSAFMessage::EHeaderSize + 16);
CleanupStack::PopAndDestroy(msg);
}
//Check that XOR-MAPPED-ADDRESS is encoded correctly.
void UT_CNATFWUNSAFMessage::TestEncodeMessageWithXorMappedAddrAttrL()
{
const TInt KMessageLength =
2 * CNATFWUNSAFAttribute::EValueOffset +
CNATFWUNSAFXorMappedAddressAttribute::EAttributeValueSizeIPv4 +
CNATFWUNSAFXorMappedAddressAttribute::EAttributeValueSizeIPv6;
const TUint8 KExpectedResult[] =
{
0, 1, //UNSAF message type: Binding Request
0, KMessageLength, //Message length (one XOR-MAPPED-ADDRESS attribute)
0x21, 0x12, 0xa4, 0x42, //Magic cookie
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0xa, 0xb, //TransactionID
//XOR-MAPPED-ADDRESS attribute with IPv4 address
0, 0x20, //type
//length of value element
0, CNATFWUNSAFXorMappedAddressAttribute::EAttributeValueSizeIPv4,
0, //undefined
CNATFWUNSAFAddressAttribute::KAddressFamilyIPv4, //family
0x31, 0x0f, //x-port
0x2b, 0x46, 0x23, 0xb3, //x-address
//XOR-MAPPED-ADDRESS attribute with IPv6 address
0, 0x20, //type
//length of value element
0, CNATFWUNSAFXorMappedAddressAttribute::EAttributeValueSizeIPv6,
0, //undefined
CNATFWUNSAFAddressAttribute::KAddressFamilyIPv6, //family
0x32, 0xd6, //x-port
0x8b, 0xa3, 0xaa, 0x32, //x-address
0x60, 0x62, 0x28, 0x9b,
0xff, 0x66, 0x67, 0x58,
0x65, 0x7b, 0x85, 0x07
};
//Add first attribute
_LIT(KAddr, "10.84.135.241");
_LIT8(KTransactionId, "abcdefghijkl");
TInetAddr addr;
User::LeaveIfError(addr.Input(KAddr));
addr.SetPort(4125);
TNATFWUNSAFTransactionID taID(KTransactionId);
CNATFWUNSAFAttribute* attr =
CNATFWUNSAFXorMappedAddressAttribute::NewLC(addr, taID);
iMsg->AddAttributeL(attr);
CleanupStack::Pop(attr);
attr = NULL;
//Add second attribute
TIp6Addr ip6addr;
ip6addr.u.iAddr8[0] = 0xaa;
ip6addr.u.iAddr8[1] = 0xb1;
ip6addr.u.iAddr8[2] = 0x0e;
ip6addr.u.iAddr8[3] = 0x70;
ip6addr.u.iAddr8[4] = 0x01;
ip6addr.u.iAddr8[5] = 0x00;
ip6addr.u.iAddr8[6] = 0x4b;
ip6addr.u.iAddr8[7] = 0xff;
ip6addr.u.iAddr8[8] = 0x9a;
ip6addr.u.iAddr8[9] = 0x00;
ip6addr.u.iAddr8[10] = 0x00;
ip6addr.u.iAddr8[11] = 0x30;
ip6addr.u.iAddr8[12] = 0x0c;
ip6addr.u.iAddr8[13] = 0x11;
ip6addr.u.iAddr8[14] = 0xee;
ip6addr.u.iAddr8[15] = 0x6b;
TInetAddr addrIPv6;
addrIPv6.SetAddress(ip6addr);
addrIPv6.SetPort(5060);
attr = CNATFWUNSAFXorMappedAddressAttribute::NewLC(addrIPv6, taID);
iMsg->AddAttributeL(attr);
CleanupStack::Pop(attr);
attr = NULL;
//Create encoded message
CBufBase* msg = iMsg->EncodeL();
CleanupStack::PushL(msg);
EUNIT_ASSERT(CNATFWUNSAFMessage::EHeaderSize + KMessageLength ==
msg->Size());
CompareEncodedUNSAFMessageL(KExpectedResult, *msg);
CleanupStack::PopAndDestroy(msg);
}
void UT_CNATFWUNSAFMessage::TestSetMessageLengthL()
{
//UNSAF message, no attributes
CBufBase* msg = iMsg->EncodeL();
CleanupStack::PushL(msg);
iMsg->SetMessageLength(*msg);
TInt expected = 0; //just the header
TInt actual =
BigEndian::Get16(&msg->Ptr(CNATFWUNSAFMessage::EMessageLengthOffset)[0]);
EUNIT_ASSERT(expected == actual);
CleanupStack::PopAndDestroy(msg);
}
void UT_CNATFWUNSAFMessage::TestSetMessageLength2L()
{
//UNSAF message, one attribute
TInetAddr addr(0x5040ffaa, 0x1234);
CNATFWUNSAFMappedAddressAttribute* attr =
CNATFWUNSAFMappedAddressAttribute::NewLC(addr);
iMsg->AddAttributeL(attr);
CleanupStack::Pop(attr);
CBufBase* msg = iMsg->EncodeL();
CleanupStack::PushL(msg);
iMsg->SetMessageLength(*msg);
TInt expected = 4 + CNATFWUNSAFAddressAttribute::EAttributeValueSizeIPv4;
TInt actual =
BigEndian::Get16(&msg->Ptr(CNATFWUNSAFMessage::EMessageLengthOffset)[0]);
EUNIT_ASSERT(expected == actual);
CleanupStack::PopAndDestroy(msg);
}
void UT_CNATFWUNSAFMessage::TestSetMessageLength3L()
{
const TInt KGranularity = 50;
_LIT8(KBufferContents,
"some stuff to put into the buffer and then check the length is computed correctly");
CBufBase* msg = CBufFlat::NewL(KGranularity);
CleanupStack::PushL(msg);
msg->InsertL(0, KBufferContents);
iMsg->SetMessageLength(*msg);
TInt expected = KBufferContents().Length() - CNATFWUNSAFMessage::EHeaderSize;
TInt actual =
BigEndian::Get16(&msg->Ptr(CNATFWUNSAFMessage::EMessageLengthOffset)[0]);
EUNIT_ASSERT(expected == actual);
CleanupStack::PopAndDestroy(msg);
}
//Using setter/getter functions
void UT_CNATFWUNSAFMessage::TestUnknownMandatoryAttributesL()
{
EUNIT_ASSERT(!iMsg->HasUnknownMandatoryAttributes());
EUNIT_ASSERT(!iMsg->iUnknownMandatoryAttributes);
iMsg->UnknownMandatoryAttributeFound();
EUNIT_ASSERT(iMsg->HasUnknownMandatoryAttributes());
EUNIT_ASSERT(iMsg->iUnknownMandatoryAttributes);
iMsg->UnknownMandatoryAttributeFound();
EUNIT_ASSERT(iMsg->HasUnknownMandatoryAttributes());
}
void UT_CNATFWUNSAFMessage::CompareEncodedUNSAFMessageL(
const TUint8* aExpectedResult,
CBufBase& aUNSAFMessage,
TUint aMaxBytesToCompare)
{
TUint diffPos = 0;
TUint8 expected = 0;
TUint8 actual = 0;
if (!CompareEncodedUNSAFMessage(aExpectedResult,
aUNSAFMessage,
aMaxBytesToCompare,
diffPos,
expected,
actual))
{
EUNIT_ASSERT(expected == actual);
}
}
TBool UT_CNATFWUNSAFMessage::CompareEncodedUNSAFMessage(
const TUint8* aExpectedResult,
CBufBase& aUNSAFMessage,
TUint aMaxBytesToCompare,
TUint& aFirstDifference,
TUint8& aExpected,
TUint8& aActual)
{
TPtr8 unsafMessage = aUNSAFMessage.Ptr(0);
for (TInt i=0; i < aUNSAFMessage.Size() && i < aMaxBytesToCompare; ++i)
{
if (aExpectedResult[i] != unsafMessage[i])
{
aFirstDifference = i;
aExpected = aExpectedResult[i];
aActual = unsafMessage[i];
return EFalse;
}
}
return ETrue;
}
// TEST TABLE
EUNIT_BEGIN_TEST_TABLE(
UT_CNATFWUNSAFMessage,
"Add test suite description here.",
"UNIT" )
EUNIT_TEST(
"TestTransactionIDL - test ",
"CNATFWUNSAFMessage",
"TestEncodeL",
"FUNCTIONALITY",
SetupL, TestTransactionIDL, Teardown)
EUNIT_TEST(
"TestTransactionIDLL - test ",
"CNATFWUNSAFMessage",
"TestTransactionIDL2",
"FUNCTIONALITY",
SetupL, TestTransactionID2L, Teardown)
EUNIT_TEST(
"TestTypeL - test ",
"CNATFWUNSAFMessage",
"TestTypeL",
"FUNCTIONALITY",
SetupL, TestTypeL, Teardown)
EUNIT_TEST(
"TestAttributeL - test ",
"CNATFWUNSAFMessage",
"TestAttributeL",
"FUNCTIONALITY",
SetupL, TestAttributeL, Teardown)
EUNIT_TEST(
"TestAttribute2L - test ",
"CNATFWUNSAFMessage",
"TestAttribute2L",
"FUNCTIONALITY",
SetupL, TestAttribute2L, Teardown)
EUNIT_TEST(
"TestAttribute3L - test ",
"CNATFWUNSAFMessage",
"TestAttribute3L",
"FUNCTIONALITY",
SetupL, TestAttribute3L, Teardown)
EUNIT_TEST(
"TestAttribute4L - test ",
"CNATFWUNSAFMessage",
"TestAttribute4L",
"FUNCTIONALITY",
SetupL, TestAttribute4L, Teardown)
EUNIT_TEST(
"TestAddAttributeL - test ",
"CNATFWUNSAFMessage",
"TestAddAttributeL",
"FUNCTIONALITY",
SetupL, TestAddAttributeL, Teardown)
EUNIT_TEST(
"TestDetachAttributeL - test ",
"CNATFWUNSAFMessage",
"TestDetachAttributeL",
"FUNCTIONALITY",
SetupL, TestDetachAttributeL, Teardown)
EUNIT_TEST(
"TestDetachAttribute2L - test ",
"CNATFWUNSAFMessage",
"TestDetachAttribute2L",
"FUNCTIONALITY",
SetupL, TestDetachAttribute2L, Teardown)
EUNIT_TEST(
"TestDeleteAttributeL - test ",
"CNATFWUNSAFMessage",
"TestDeleteAttributeL",
"FUNCTIONALITY",
SetupL, TestDeleteAttributeL, Teardown)
EUNIT_TEST(
"TestDeleteAttribute2L - test ",
"CNATFWUNSAFMessage",
"TestDeleteAttribute2L",
"FUNCTIONALITY",
SetupL, TestDeleteAttribute2L, Teardown)
EUNIT_TEST(
"TestDeleteAttribute3L - test ",
"CNATFWUNSAFMessage",
"TestDeleteAttribute3L",
"FUNCTIONALITY",
SetupL, TestDeleteAttribute3L, Teardown)
EUNIT_TEST(
"TestDeleteAttribute4L - test ",
"CNATFWUNSAFMessage",
"TestDeleteAttributeL4",
"FUNCTIONALITY",
SetupL, TestDeleteAttribute4L, Teardown)
EUNIT_TEST(
"TestEncodeL - test ",
"CNATFWUNSAFMessage",
"TestEncodeL",
"FUNCTIONALITY",
SetupL, TestEncodeL, Teardown)
EUNIT_TEST(
"TestEncode2L - test ",
"CNATFWUNSAFMessage",
"TestEncode2L",
"FUNCTIONALITY",
SetupL, TestEncode2L, Teardown)
EUNIT_TEST(
"TestEncode3L - test ",
"CNATFWUNSAFMessage",
"TestEncode3L",
"FUNCTIONALITY",
SetupL, TestEncode3L, Teardown)
EUNIT_TEST(
"TestEncode4L - test ",
"CNATFWUNSAFMessage",
"TestEncode4L",
"FUNCTIONALITY",
SetupL, TestEncode4L, Teardown)
EUNIT_TEST(
"TestEncodeWithHashL - test ",
"CNATFWUNSAFMessage",
"TestEncodeWithHashL",
"FUNCTIONALITY",
SetupL, TestEncodeWithHashL, Teardown)
EUNIT_TEST(
"TestEncodeMessageWithXorMappedAddrAttrL - test ",
"CNATFWUNSAFMessage",
"TestEncodeMessageWithXorMappedAddrAttrL",
"FUNCTIONALITY",
SetupL, TestEncodeMessageWithXorMappedAddrAttrL, Teardown)
EUNIT_TEST(
"TestSetMessageLengthL - test ",
"CNATFWUNSAFMessage",
"TestSetMessageLengthL",
"FUNCTIONALITY",
SetupL, TestSetMessageLengthL, Teardown)
EUNIT_TEST(
"TestSetMessageLength2L - test ",
"CNATFWUNSAFMessage",
"TestSetMessageLength2L",
"FUNCTIONALITY",
SetupL, TestSetMessageLength2L, Teardown)
EUNIT_TEST(
"TestSetMessageLength3L - test ",
"CNATFWUNSAFMessage",
"TestSetMessageLength3L",
"FUNCTIONALITY",
SetupL, TestSetMessageLength3L, Teardown)
EUNIT_TEST(
"TestUnknownMandatoryAttributesL - test ",
"CNATFWUNSAFMessage",
"TestUnknownMandatoryAttributesL",
"FUNCTIONALITY",
SetupL, TestUnknownMandatoryAttributesL, Teardown)
EUNIT_END_TEST_TABLE
// END OF FILE
| [
"kirill.dremov@nokia.com"
] | kirill.dremov@nokia.com |
46ae7100d38dbca1886fbc92d277ab684410f523 | ab97a8915347c76d05d6690dbdbcaf23d7f0d1fd | /pdf/pdfium/pdfium_engine_unittest.cc | 66452b447c617e740dbc4ff8279550965c47e8bf | [
"BSD-3-Clause"
] | permissive | laien529/chromium | c9eb243957faabf1b477939e3b681df77f083a9a | 3f767cdd5c82e9c78b910b022ffacddcb04d775a | refs/heads/master | 2022-11-28T00:28:58.669067 | 2020-08-20T08:37:31 | 2020-08-20T08:37:31 | 288,961,699 | 1 | 0 | BSD-3-Clause | 2020-08-20T09:21:57 | 2020-08-20T09:21:56 | null | UTF-8 | C++ | false | false | 36,275 | cc | // Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "pdf/pdfium/pdfium_engine.h"
#include <stdint.h>
#include "base/hash/md5.h"
#include "base/strings/utf_string_conversions.h"
#include "base/test/scoped_feature_list.h"
#include "base/test/task_environment.h"
#include "pdf/document_attachment_info.h"
#include "pdf/document_layout.h"
#include "pdf/document_metadata.h"
#include "pdf/pdf_features.h"
#include "pdf/pdfium/pdfium_page.h"
#include "pdf/pdfium/pdfium_test_base.h"
#include "pdf/test/test_client.h"
#include "pdf/test/test_document_loader.h"
#include "pdf/test/test_utils.h"
#include "ppapi/c/ppb_input_event.h"
#include "ppapi/cpp/size.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/gfx/geometry/size.h"
namespace chrome_pdf {
namespace {
using ::testing::InSequence;
using ::testing::Invoke;
using ::testing::IsEmpty;
using ::testing::NiceMock;
using ::testing::Return;
using ::testing::StrictMock;
MATCHER_P2(LayoutWithSize, width, height, "") {
return arg.size() == gfx::Size(width, height);
}
MATCHER_P(LayoutWithOptions, options, "") {
return arg.options() == options;
}
class MockTestClient : public TestClient {
public:
MockTestClient() {
ON_CALL(*this, ProposeDocumentLayout)
.WillByDefault([this](const DocumentLayout& layout) {
TestClient::ProposeDocumentLayout(layout);
});
}
MOCK_METHOD(void,
ProposeDocumentLayout,
(const DocumentLayout& layout),
(override));
MOCK_METHOD(void, ScrollToPage, (int page), (override));
};
} // namespace
class PDFiumEngineTest : public PDFiumTestBase {
protected:
void ExpectPageRect(const PDFiumEngine& engine,
size_t page_index,
const pp::Rect& expected_rect) {
const PDFiumPage& page = GetPDFiumPageForTest(engine, page_index);
CompareRect(expected_rect, page.rect());
}
// Tries to load a PDF incrementally, returning `true` if the PDF actually was
// loaded incrementally. Note that this function will return `false` if
// incremental loading fails, but also if incremental loading is disabled.
bool TryLoadIncrementally() {
NiceMock<MockTestClient> client;
InitializeEngineResult initialize_result = InitializeEngineWithoutLoading(
&client, FILE_PATH_LITERAL("linearized.pdf"));
if (!initialize_result.engine) {
ADD_FAILURE();
return false;
}
PDFiumEngine& engine = *initialize_result.engine;
// Load enough for the document to become partially available.
initialize_result.document_loader->SimulateLoadData(8192);
bool loaded_incrementally;
if (engine.GetNumberOfPages() == 0) {
// This is not necessarily a test failure; it just indicates incremental
// loading is not occurring.
loaded_incrementally = false;
} else {
// Note: Plugin size chosen so all pages of the document are visible. The
// engine only updates availability incrementally for visible pages.
EXPECT_EQ(0, CountAvailablePages(engine));
engine.PluginSizeUpdated({1024, 4096});
int available_pages = CountAvailablePages(engine);
loaded_incrementally =
0 < available_pages && available_pages < engine.GetNumberOfPages();
}
// Verify that loading can finish.
while (initialize_result.document_loader->SimulateLoadData(UINT32_MAX))
continue;
EXPECT_EQ(engine.GetNumberOfPages(), CountAvailablePages(engine));
return loaded_incrementally;
}
private:
// Counts the number of available pages. Returns `int` instead of `size_t` for
// consistency with `PDFiumEngine::GetNumberOfPages()`.
int CountAvailablePages(const PDFiumEngine& engine) {
int available_pages = 0;
for (int i = 0; i < engine.GetNumberOfPages(); ++i) {
if (GetPDFiumPageForTest(engine, i).available())
++available_pages;
}
return available_pages;
}
};
TEST_F(PDFiumEngineTest, InitializeWithRectanglesMultiPagesPdf) {
NiceMock<MockTestClient> client;
// ProposeDocumentLayout() gets called twice during loading because
// PDFiumEngine::ContinueLoadingDocument() calls LoadBody() (which eventually
// triggers a layout proposal), and then calls FinishLoadingDocument() (since
// the document is complete), which calls LoadBody() again. Coalescing these
// proposals is not correct unless we address the issue covered by
// PDFiumEngineTest.ProposeDocumentLayoutWithOverlap.
EXPECT_CALL(client, ProposeDocumentLayout(LayoutWithSize(343, 1664)))
.Times(2);
std::unique_ptr<PDFiumEngine> engine = InitializeEngine(
&client, FILE_PATH_LITERAL("rectangles_multi_pages.pdf"));
ASSERT_TRUE(engine);
ASSERT_EQ(5, engine->GetNumberOfPages());
ExpectPageRect(*engine, 0, {38, 3, 266, 333});
ExpectPageRect(*engine, 1, {5, 350, 333, 266});
ExpectPageRect(*engine, 2, {38, 630, 266, 333});
ExpectPageRect(*engine, 3, {38, 977, 266, 333});
ExpectPageRect(*engine, 4, {38, 1324, 266, 333});
}
TEST_F(PDFiumEngineTest, InitializeWithRectanglesMultiPagesPdfInTwoUpView) {
NiceMock<MockTestClient> client;
std::unique_ptr<PDFiumEngine> engine = InitializeEngine(
&client, FILE_PATH_LITERAL("rectangles_multi_pages.pdf"));
ASSERT_TRUE(engine);
DocumentLayout::Options options;
options.set_two_up_view_enabled(true);
EXPECT_CALL(client, ProposeDocumentLayout(LayoutWithOptions(options)))
.WillOnce(Return());
engine->SetTwoUpView(true);
engine->ApplyDocumentLayout(options);
ASSERT_EQ(5, engine->GetNumberOfPages());
ExpectPageRect(*engine, 0, {72, 3, 266, 333});
ExpectPageRect(*engine, 1, {340, 3, 333, 266});
ExpectPageRect(*engine, 2, {72, 346, 266, 333});
ExpectPageRect(*engine, 3, {340, 346, 266, 333});
ExpectPageRect(*engine, 4, {68, 689, 266, 333});
}
TEST_F(PDFiumEngineTest, AppendBlankPagesWithFewerPages) {
NiceMock<MockTestClient> client;
{
InSequence normal_then_append;
EXPECT_CALL(client, ProposeDocumentLayout(LayoutWithSize(343, 1664)))
.Times(2);
EXPECT_CALL(client, ProposeDocumentLayout(LayoutWithSize(276, 1037)));
}
std::unique_ptr<PDFiumEngine> engine = InitializeEngine(
&client, FILE_PATH_LITERAL("rectangles_multi_pages.pdf"));
ASSERT_TRUE(engine);
engine->AppendBlankPages(3);
ASSERT_EQ(3, engine->GetNumberOfPages());
ExpectPageRect(*engine, 0, {5, 3, 266, 333});
ExpectPageRect(*engine, 1, {5, 350, 266, 333});
ExpectPageRect(*engine, 2, {5, 697, 266, 333});
}
TEST_F(PDFiumEngineTest, AppendBlankPagesWithMorePages) {
NiceMock<MockTestClient> client;
{
InSequence normal_then_append;
EXPECT_CALL(client, ProposeDocumentLayout(LayoutWithSize(343, 1664)))
.Times(2);
EXPECT_CALL(client, ProposeDocumentLayout(LayoutWithSize(276, 2425)));
}
std::unique_ptr<PDFiumEngine> engine = InitializeEngine(
&client, FILE_PATH_LITERAL("rectangles_multi_pages.pdf"));
ASSERT_TRUE(engine);
engine->AppendBlankPages(7);
ASSERT_EQ(7, engine->GetNumberOfPages());
ExpectPageRect(*engine, 0, {5, 3, 266, 333});
ExpectPageRect(*engine, 1, {5, 350, 266, 333});
ExpectPageRect(*engine, 2, {5, 697, 266, 333});
ExpectPageRect(*engine, 3, {5, 1044, 266, 333});
ExpectPageRect(*engine, 4, {5, 1391, 266, 333});
ExpectPageRect(*engine, 5, {5, 1738, 266, 333});
ExpectPageRect(*engine, 6, {5, 2085, 266, 333});
}
TEST_F(PDFiumEngineTest, ProposeDocumentLayoutWithOverlap) {
NiceMock<MockTestClient> client;
std::unique_ptr<PDFiumEngine> engine = InitializeEngine(
&client, FILE_PATH_LITERAL("rectangles_multi_pages.pdf"));
ASSERT_TRUE(engine);
EXPECT_CALL(client, ProposeDocumentLayout(LayoutWithSize(343, 1463)))
.WillOnce(Return());
engine->RotateClockwise();
EXPECT_CALL(client, ProposeDocumentLayout(LayoutWithSize(343, 1664)))
.WillOnce(Return());
engine->RotateCounterclockwise();
}
TEST_F(PDFiumEngineTest, ApplyDocumentLayoutAvoidsInfiniteLoop) {
NiceMock<MockTestClient> client;
std::unique_ptr<PDFiumEngine> engine = InitializeEngine(
&client, FILE_PATH_LITERAL("rectangles_multi_pages.pdf"));
ASSERT_TRUE(engine);
DocumentLayout::Options options;
EXPECT_CALL(client, ScrollToPage(-1)).Times(0);
EXPECT_EQ(gfx::Size(343, 1664), engine->ApplyDocumentLayout(options));
options.RotatePagesClockwise();
EXPECT_CALL(client, ScrollToPage(-1)).Times(1);
EXPECT_EQ(gfx::Size(343, 1463), engine->ApplyDocumentLayout(options));
EXPECT_EQ(gfx::Size(343, 1463), engine->ApplyDocumentLayout(options));
}
TEST_F(PDFiumEngineTest, GetDocumentAttachments) {
NiceMock<MockTestClient> client;
std::unique_ptr<PDFiumEngine> engine =
InitializeEngine(&client, FILE_PATH_LITERAL("embedded_attachments.pdf"));
ASSERT_TRUE(engine);
const std::vector<DocumentAttachmentInfo>& attachments =
engine->GetDocumentAttachmentInfoList();
ASSERT_EQ(3u, attachments.size());
{
const DocumentAttachmentInfo& attachment = attachments[0];
EXPECT_EQ("1.txt", base::UTF16ToUTF8(attachment.name));
EXPECT_TRUE(attachment.is_readable);
EXPECT_EQ(4u, attachment.size_bytes);
EXPECT_EQ("D:20170712214438-07'00'",
base::UTF16ToUTF8(attachment.creation_date));
EXPECT_EQ("D:20160115091400", base::UTF16ToUTF8(attachment.modified_date));
std::vector<uint8_t> content = engine->GetAttachmentData(0);
ASSERT_EQ(attachment.size_bytes, content.size());
std::string content_str(content.begin(), content.end());
EXPECT_EQ("test", content_str);
}
{
static constexpr char kCheckSum[] = "72afcddedf554dda63c0c88e06f1ce18";
const DocumentAttachmentInfo& attachment = attachments[1];
EXPECT_EQ("attached.pdf", base::UTF16ToUTF8(attachment.name));
EXPECT_TRUE(attachment.is_readable);
EXPECT_EQ(5869u, attachment.size_bytes);
EXPECT_EQ("D:20170712214443-07'00'",
base::UTF16ToUTF8(attachment.creation_date));
EXPECT_EQ("D:20170712214410", base::UTF16ToUTF8(attachment.modified_date));
std::vector<uint8_t> content = engine->GetAttachmentData(1);
ASSERT_EQ(attachment.size_bytes, content.size());
// The whole attachment content is too long to do string comparison.
// Instead, we only verify the checksum value here.
base::MD5Digest hash;
base::MD5Sum(content.data(), content.size(), &hash);
EXPECT_EQ(kCheckSum, base::MD5DigestToBase16(hash));
}
{
// Test attachments with no creation date or last modified date.
const DocumentAttachmentInfo& attachment = attachments[2];
EXPECT_EQ("附錄.txt", base::UTF16ToUTF8(attachment.name));
EXPECT_TRUE(attachment.is_readable);
EXPECT_EQ(5u, attachment.size_bytes);
EXPECT_THAT(attachment.creation_date, IsEmpty());
EXPECT_THAT(attachment.modified_date, IsEmpty());
std::vector<uint8_t> content = engine->GetAttachmentData(2);
ASSERT_EQ(attachment.size_bytes, content.size());
std::string content_str(content.begin(), content.end());
EXPECT_EQ("test\n", content_str);
}
}
TEST_F(PDFiumEngineTest, DocumentWithInvalidAttachment) {
NiceMock<MockTestClient> client;
std::unique_ptr<PDFiumEngine> engine = InitializeEngine(
&client, FILE_PATH_LITERAL("embedded_attachments_invalid_data.pdf"));
ASSERT_TRUE(engine);
const std::vector<DocumentAttachmentInfo>& attachments =
engine->GetDocumentAttachmentInfoList();
ASSERT_EQ(1u, attachments.size());
// Test on an attachment which FPDFAttachment_GetFile() fails to retrieve data
// from.
const DocumentAttachmentInfo& attachment = attachments[0];
EXPECT_EQ("1.txt", base::UTF16ToUTF8(attachment.name));
EXPECT_FALSE(attachment.is_readable);
EXPECT_EQ(0u, attachment.size_bytes);
EXPECT_THAT(attachment.creation_date, IsEmpty());
EXPECT_THAT(attachment.modified_date, IsEmpty());
}
TEST_F(PDFiumEngineTest, NoDocumentAttachmentInfo) {
NiceMock<MockTestClient> client;
std::unique_ptr<PDFiumEngine> engine =
InitializeEngine(&client, FILE_PATH_LITERAL("hello_world2.pdf"));
ASSERT_TRUE(engine);
EXPECT_EQ(0u, engine->GetDocumentAttachmentInfoList().size());
}
TEST_F(PDFiumEngineTest, GetDocumentMetadata) {
NiceMock<MockTestClient> client;
std::unique_ptr<PDFiumEngine> engine =
InitializeEngine(&client, FILE_PATH_LITERAL("document_info.pdf"));
ASSERT_TRUE(engine);
const DocumentMetadata& doc_metadata = engine->GetDocumentMetadata();
EXPECT_EQ(PdfVersion::k1_7, doc_metadata.version);
EXPECT_EQ("Sample PDF Document Info", doc_metadata.title);
EXPECT_EQ("Chromium Authors", doc_metadata.author);
EXPECT_EQ("Testing", doc_metadata.subject);
EXPECT_EQ("Your Preferred Text Editor", doc_metadata.creator);
EXPECT_EQ("fixup_pdf_template.py", doc_metadata.producer);
}
TEST_F(PDFiumEngineTest, GetEmptyDocumentMetadata) {
NiceMock<MockTestClient> client;
std::unique_ptr<PDFiumEngine> engine =
InitializeEngine(&client, FILE_PATH_LITERAL("hello_world2.pdf"));
ASSERT_TRUE(engine);
const DocumentMetadata& doc_metadata = engine->GetDocumentMetadata();
EXPECT_EQ(PdfVersion::k1_7, doc_metadata.version);
EXPECT_THAT(doc_metadata.title, IsEmpty());
EXPECT_THAT(doc_metadata.author, IsEmpty());
EXPECT_THAT(doc_metadata.subject, IsEmpty());
EXPECT_THAT(doc_metadata.creator, IsEmpty());
EXPECT_THAT(doc_metadata.producer, IsEmpty());
}
TEST_F(PDFiumEngineTest, GetBadPdfVersion) {
NiceMock<MockTestClient> client;
std::unique_ptr<PDFiumEngine> engine =
InitializeEngine(&client, FILE_PATH_LITERAL("bad_version.pdf"));
ASSERT_TRUE(engine);
const DocumentMetadata& doc_metadata = engine->GetDocumentMetadata();
EXPECT_EQ(PdfVersion::kUnknown, doc_metadata.version);
}
TEST_F(PDFiumEngineTest, IncrementalLoadingFeatureDefault) {
EXPECT_TRUE(TryLoadIncrementally());
}
TEST_F(PDFiumEngineTest, IncrementalLoadingFeatureEnabled) {
base::test::ScopedFeatureList scoped_feature_list;
scoped_feature_list.InitAndEnableFeature(features::kPdfIncrementalLoading);
EXPECT_TRUE(TryLoadIncrementally());
}
TEST_F(PDFiumEngineTest, IncrementalLoadingFeatureDisabled) {
base::test::ScopedFeatureList scoped_feature_list;
scoped_feature_list.InitAndDisableFeature(features::kPdfIncrementalLoading);
EXPECT_FALSE(TryLoadIncrementally());
}
class TabbingTestClient : public TestClient {
public:
TabbingTestClient() = default;
~TabbingTestClient() override = default;
TabbingTestClient(const TabbingTestClient&) = delete;
TabbingTestClient& operator=(const TabbingTestClient&) = delete;
// Mock PDFEngine::Client methods.
MOCK_METHOD(void, DocumentFocusChanged, (bool), (override));
};
class PDFiumEngineTabbingTest : public PDFiumTestBase {
public:
PDFiumEngineTabbingTest() = default;
~PDFiumEngineTabbingTest() override = default;
PDFiumEngineTabbingTest(const PDFiumEngineTabbingTest&) = delete;
PDFiumEngineTabbingTest& operator=(const PDFiumEngineTabbingTest&) = delete;
bool HandleTabEvent(PDFiumEngine* engine, uint32_t modifiers) {
return engine->HandleTabEvent(modifiers);
}
PDFiumEngine::FocusElementType GetFocusedElementType(PDFiumEngine* engine) {
return engine->focus_item_type_;
}
int GetLastFocusedPage(PDFiumEngine* engine) {
return engine->last_focused_page_;
}
PDFiumEngine::FocusElementType GetLastFocusedElementType(
PDFiumEngine* engine) {
return engine->last_focused_item_type_;
}
int GetLastFocusedAnnotationIndex(PDFiumEngine* engine) {
return engine->last_focused_annot_index_;
}
bool IsInFormTextArea(PDFiumEngine* engine) {
return engine->in_form_text_area_;
}
size_t GetSelectionSize(PDFiumEngine* engine) {
return engine->selection_.size();
}
const std::string& GetLinkUnderCursor(PDFiumEngine* engine) {
return engine->link_under_cursor_;
}
void ScrollFocusedAnnotationIntoView(PDFiumEngine* engine) {
engine->ScrollFocusedAnnotationIntoView();
}
protected:
base::test::TaskEnvironment task_environment_{
base::test::TaskEnvironment::TimeSource::MOCK_TIME};
};
TEST_F(PDFiumEngineTabbingTest, LinkUnderCursorTest) {
/*
* Document structure
* Document
* ++ Page 1
* ++++ Widget annotation
* ++++ Widget annotation
* ++++ Highlight annotation
* ++++ Link annotation
*/
// Enable feature flag.
base::test::ScopedFeatureList scoped_feature_list;
scoped_feature_list.InitAndEnableFeature(
chrome_pdf::features::kTabAcrossPDFAnnotations);
TestClient client;
std::unique_ptr<PDFiumEngine> engine =
InitializeEngine(&client, FILE_PATH_LITERAL("annots.pdf"));
ASSERT_TRUE(engine);
// Initial value of link under cursor.
EXPECT_EQ("", GetLinkUnderCursor(engine.get()));
// Tab through non-link annotations and validate link under cursor.
for (int i = 0; i < 4; i++) {
ASSERT_TRUE(HandleTabEvent(engine.get(), 0));
EXPECT_EQ("", GetLinkUnderCursor(engine.get()));
}
// Tab to Link annotation.
ASSERT_TRUE(HandleTabEvent(engine.get(), 0));
EXPECT_EQ("https://www.google.com/", GetLinkUnderCursor(engine.get()));
// Tab to previous annotation.
ASSERT_TRUE(HandleTabEvent(engine.get(), PP_INPUTEVENT_MODIFIER_SHIFTKEY));
EXPECT_EQ("", GetLinkUnderCursor(engine.get()));
}
TEST_F(PDFiumEngineTabbingTest, TabbingSupportedAnnots) {
/*
* Document structure
* Document
* ++ Page 1
* ++++ Widget annotation
* ++++ Widget annotation
* ++++ Highlight annotation
* ++++ Link annotation
*/
// Enable feature flag.
base::test::ScopedFeatureList scoped_feature_list;
scoped_feature_list.InitAndEnableFeature(
chrome_pdf::features::kTabAcrossPDFAnnotations);
TestClient client;
std::unique_ptr<PDFiumEngine> engine =
InitializeEngine(&client, FILE_PATH_LITERAL("annots.pdf"));
ASSERT_TRUE(engine);
ASSERT_EQ(1, engine->GetNumberOfPages());
ASSERT_EQ(PDFiumEngine::FocusElementType::kNone,
GetFocusedElementType(engine.get()));
EXPECT_EQ(-1, GetLastFocusedPage(engine.get()));
ASSERT_TRUE(HandleTabEvent(engine.get(), 0));
EXPECT_EQ(PDFiumEngine::FocusElementType::kDocument,
GetFocusedElementType(engine.get()));
ASSERT_TRUE(HandleTabEvent(engine.get(), 0));
EXPECT_EQ(PDFiumEngine::FocusElementType::kPage,
GetFocusedElementType(engine.get()));
EXPECT_EQ(0, GetLastFocusedPage(engine.get()));
ASSERT_TRUE(HandleTabEvent(engine.get(), 0));
EXPECT_EQ(PDFiumEngine::FocusElementType::kPage,
GetFocusedElementType(engine.get()));
EXPECT_EQ(0, GetLastFocusedPage(engine.get()));
ASSERT_TRUE(HandleTabEvent(engine.get(), 0));
EXPECT_EQ(PDFiumEngine::FocusElementType::kPage,
GetFocusedElementType(engine.get()));
EXPECT_EQ(0, GetLastFocusedPage(engine.get()));
ASSERT_TRUE(HandleTabEvent(engine.get(), 0));
EXPECT_EQ(PDFiumEngine::FocusElementType::kPage,
GetFocusedElementType(engine.get()));
EXPECT_EQ(0, GetLastFocusedPage(engine.get()));
ASSERT_FALSE(HandleTabEvent(engine.get(), 0));
EXPECT_EQ(PDFiumEngine::FocusElementType::kNone,
GetFocusedElementType(engine.get()));
}
TEST_F(PDFiumEngineTabbingTest, TabbingForwardTest) {
/*
* Document structure
* Document
* ++ Page 1
* ++++ Annotation
* ++++ Annotation
* ++ Page 2
* ++++ Annotation
*/
TabbingTestClient client;
std::unique_ptr<PDFiumEngine> engine = InitializeEngine(
&client, FILE_PATH_LITERAL("annotation_form_fields.pdf"));
ASSERT_TRUE(engine);
ASSERT_EQ(2, engine->GetNumberOfPages());
static constexpr bool kExpectedFocusState[] = {true, false};
{
InSequence sequence;
for (auto focused : kExpectedFocusState)
EXPECT_CALL(client, DocumentFocusChanged(focused));
}
ASSERT_EQ(PDFiumEngine::FocusElementType::kNone,
GetFocusedElementType(engine.get()));
EXPECT_EQ(-1, GetLastFocusedPage(engine.get()));
ASSERT_TRUE(HandleTabEvent(engine.get(), 0));
EXPECT_EQ(PDFiumEngine::FocusElementType::kDocument,
GetFocusedElementType(engine.get()));
ASSERT_TRUE(HandleTabEvent(engine.get(), 0));
EXPECT_EQ(PDFiumEngine::FocusElementType::kPage,
GetFocusedElementType(engine.get()));
EXPECT_EQ(0, GetLastFocusedPage(engine.get()));
ASSERT_TRUE(HandleTabEvent(engine.get(), 0));
EXPECT_EQ(PDFiumEngine::FocusElementType::kPage,
GetFocusedElementType(engine.get()));
EXPECT_EQ(0, GetLastFocusedPage(engine.get()));
ASSERT_TRUE(HandleTabEvent(engine.get(), 0));
EXPECT_EQ(PDFiumEngine::FocusElementType::kPage,
GetFocusedElementType(engine.get()));
EXPECT_EQ(1, GetLastFocusedPage(engine.get()));
ASSERT_FALSE(HandleTabEvent(engine.get(), 0));
EXPECT_EQ(PDFiumEngine::FocusElementType::kNone,
GetFocusedElementType(engine.get()));
}
TEST_F(PDFiumEngineTabbingTest, TabbingBackwardTest) {
/*
* Document structure
* Document
* ++ Page 1
* ++++ Annotation
* ++++ Annotation
* ++ Page 2
* ++++ Annotation
*/
TabbingTestClient client;
std::unique_ptr<PDFiumEngine> engine = InitializeEngine(
&client, FILE_PATH_LITERAL("annotation_form_fields.pdf"));
ASSERT_TRUE(engine);
ASSERT_EQ(2, engine->GetNumberOfPages());
static constexpr bool kExpectedFocusState[] = {true, false};
{
InSequence sequence;
for (auto focused : kExpectedFocusState)
EXPECT_CALL(client, DocumentFocusChanged(focused));
}
ASSERT_EQ(PDFiumEngine::FocusElementType::kNone,
GetFocusedElementType(engine.get()));
EXPECT_EQ(-1, GetLastFocusedPage(engine.get()));
ASSERT_TRUE(HandleTabEvent(engine.get(), PP_INPUTEVENT_MODIFIER_SHIFTKEY));
EXPECT_EQ(PDFiumEngine::FocusElementType::kPage,
GetFocusedElementType(engine.get()));
EXPECT_EQ(1, GetLastFocusedPage(engine.get()));
ASSERT_TRUE(HandleTabEvent(engine.get(), PP_INPUTEVENT_MODIFIER_SHIFTKEY));
EXPECT_EQ(PDFiumEngine::FocusElementType::kPage,
GetFocusedElementType(engine.get()));
EXPECT_EQ(0, GetLastFocusedPage(engine.get()));
ASSERT_TRUE(HandleTabEvent(engine.get(), PP_INPUTEVENT_MODIFIER_SHIFTKEY));
EXPECT_EQ(PDFiumEngine::FocusElementType::kPage,
GetFocusedElementType(engine.get()));
EXPECT_EQ(0, GetLastFocusedPage(engine.get()));
ASSERT_TRUE(HandleTabEvent(engine.get(), PP_INPUTEVENT_MODIFIER_SHIFTKEY));
EXPECT_EQ(PDFiumEngine::FocusElementType::kDocument,
GetFocusedElementType(engine.get()));
ASSERT_FALSE(HandleTabEvent(engine.get(), PP_INPUTEVENT_MODIFIER_SHIFTKEY));
EXPECT_EQ(PDFiumEngine::FocusElementType::kNone,
GetFocusedElementType(engine.get()));
}
TEST_F(PDFiumEngineTabbingTest, TabbingWithModifiers) {
/*
* Document structure
* Document
* ++ Page 1
* ++++ Annotation
* ++++ Annotation
* ++ Page 2
* ++++ Annotation
*/
TestClient client;
std::unique_ptr<PDFiumEngine> engine = InitializeEngine(
&client, FILE_PATH_LITERAL("annotation_form_fields.pdf"));
ASSERT_TRUE(engine);
ASSERT_EQ(2, engine->GetNumberOfPages());
ASSERT_EQ(PDFiumEngine::FocusElementType::kNone,
GetFocusedElementType(engine.get()));
EXPECT_EQ(-1, GetLastFocusedPage(engine.get()));
// Tabbing with ctrl modifier.
ASSERT_FALSE(HandleTabEvent(engine.get(), PP_INPUTEVENT_MODIFIER_CONTROLKEY));
// Tabbing with alt modifier.
ASSERT_FALSE(HandleTabEvent(engine.get(), PP_INPUTEVENT_MODIFIER_ALTKEY));
// Tab to bring document into focus.
ASSERT_TRUE(HandleTabEvent(engine.get(), 0));
EXPECT_EQ(PDFiumEngine::FocusElementType::kDocument,
GetFocusedElementType(engine.get()));
// Tabbing with ctrl modifier.
ASSERT_FALSE(HandleTabEvent(engine.get(), PP_INPUTEVENT_MODIFIER_CONTROLKEY));
// Tabbing with alt modifier.
ASSERT_FALSE(HandleTabEvent(engine.get(), PP_INPUTEVENT_MODIFIER_ALTKEY));
// Tab to bring first page into focus.
ASSERT_TRUE(HandleTabEvent(engine.get(), 0));
EXPECT_EQ(PDFiumEngine::FocusElementType::kPage,
GetFocusedElementType(engine.get()));
// Tabbing with ctrl modifier.
ASSERT_FALSE(HandleTabEvent(engine.get(), PP_INPUTEVENT_MODIFIER_CONTROLKEY));
// Tabbing with alt modifier.
ASSERT_FALSE(HandleTabEvent(engine.get(), PP_INPUTEVENT_MODIFIER_ALTKEY));
}
TEST_F(PDFiumEngineTabbingTest, NoFocusableItemTabbingTest) {
/*
* Document structure
* Document
* ++ Page 1
* ++ Page 2
*/
TabbingTestClient client;
std::unique_ptr<PDFiumEngine> engine =
InitializeEngine(&client, FILE_PATH_LITERAL("hello_world2.pdf"));
ASSERT_TRUE(engine);
ASSERT_EQ(2, engine->GetNumberOfPages());
static constexpr bool kExpectedFocusState[] = {true, false, true, false};
{
InSequence sequence;
for (auto focused : kExpectedFocusState)
EXPECT_CALL(client, DocumentFocusChanged(focused));
}
ASSERT_EQ(PDFiumEngine::FocusElementType::kNone,
GetFocusedElementType(engine.get()));
EXPECT_EQ(-1, GetLastFocusedPage(engine.get()));
// Tabbing forward.
ASSERT_TRUE(HandleTabEvent(engine.get(), 0));
EXPECT_EQ(PDFiumEngine::FocusElementType::kDocument,
GetFocusedElementType(engine.get()));
ASSERT_FALSE(HandleTabEvent(engine.get(), 0));
EXPECT_EQ(PDFiumEngine::FocusElementType::kNone,
GetFocusedElementType(engine.get()));
// Tabbing backward.
ASSERT_TRUE(HandleTabEvent(engine.get(), PP_INPUTEVENT_MODIFIER_SHIFTKEY));
EXPECT_EQ(PDFiumEngine::FocusElementType::kDocument,
GetFocusedElementType(engine.get()));
ASSERT_FALSE(HandleTabEvent(engine.get(), PP_INPUTEVENT_MODIFIER_SHIFTKEY));
EXPECT_EQ(PDFiumEngine::FocusElementType::kNone,
GetFocusedElementType(engine.get()));
}
TEST_F(PDFiumEngineTabbingTest, RestoringDocumentFocusTest) {
/*
* Document structure
* Document
* ++ Page 1
* ++++ Annotation
* ++++ Annotation
* ++ Page 2
* ++++ Annotation
*/
TabbingTestClient client;
std::unique_ptr<PDFiumEngine> engine = InitializeEngine(
&client, FILE_PATH_LITERAL("annotation_form_fields.pdf"));
ASSERT_TRUE(engine);
ASSERT_EQ(2, engine->GetNumberOfPages());
static constexpr bool kExpectedFocusState[] = {true, false, true};
{
InSequence sequence;
for (auto focused : kExpectedFocusState)
EXPECT_CALL(client, DocumentFocusChanged(focused));
}
EXPECT_EQ(PDFiumEngine::FocusElementType::kNone,
GetFocusedElementType(engine.get()));
EXPECT_EQ(-1, GetLastFocusedPage(engine.get()));
// Tabbing to bring the document into focus.
ASSERT_TRUE(HandleTabEvent(engine.get(), 0));
EXPECT_EQ(PDFiumEngine::FocusElementType::kDocument,
GetFocusedElementType(engine.get()));
engine->UpdateFocus(/*has_focus=*/false);
EXPECT_EQ(PDFiumEngine::FocusElementType::kNone,
GetFocusedElementType(engine.get()));
EXPECT_EQ(PDFiumEngine::FocusElementType::kDocument,
GetLastFocusedElementType(engine.get()));
EXPECT_EQ(-1, GetLastFocusedAnnotationIndex(engine.get()));
engine->UpdateFocus(/*has_focus=*/true);
EXPECT_EQ(PDFiumEngine::FocusElementType::kDocument,
GetFocusedElementType(engine.get()));
}
TEST_F(PDFiumEngineTabbingTest, RestoringAnnotFocusTest) {
/*
* Document structure
* Document
* ++ Page 1
* ++++ Annotation
* ++++ Annotation
* ++ Page 2
* ++++ Annotation
*/
TabbingTestClient client;
std::unique_ptr<PDFiumEngine> engine = InitializeEngine(
&client, FILE_PATH_LITERAL("annotation_form_fields.pdf"));
ASSERT_TRUE(engine);
ASSERT_EQ(2, engine->GetNumberOfPages());
static constexpr bool kExpectedFocusState[] = {true, false};
{
InSequence sequence;
for (auto focused : kExpectedFocusState)
EXPECT_CALL(client, DocumentFocusChanged(focused));
}
EXPECT_EQ(PDFiumEngine::FocusElementType::kNone,
GetFocusedElementType(engine.get()));
EXPECT_EQ(-1, GetLastFocusedPage(engine.get()));
// Tabbing to bring last annotation of page 0 into focus.
ASSERT_TRUE(HandleTabEvent(engine.get(), 0));
ASSERT_TRUE(HandleTabEvent(engine.get(), 0));
ASSERT_TRUE(HandleTabEvent(engine.get(), 0));
engine->UpdateFocus(/*has_focus=*/false);
EXPECT_EQ(PDFiumEngine::FocusElementType::kPage,
GetLastFocusedElementType(engine.get()));
EXPECT_EQ(0, GetLastFocusedPage(engine.get()));
EXPECT_EQ(PDFiumEngine::FocusElementType::kPage,
GetFocusedElementType(engine.get()));
EXPECT_EQ(0, GetLastFocusedAnnotationIndex(engine.get()));
engine->UpdateFocus(/*has_focus=*/true);
EXPECT_EQ(PDFiumEngine::FocusElementType::kPage,
GetFocusedElementType(engine.get()));
EXPECT_EQ(0, GetLastFocusedPage(engine.get()));
// Tabbing now should bring the second page's annotation to focus.
ASSERT_TRUE(HandleTabEvent(engine.get(), 0));
EXPECT_EQ(PDFiumEngine::FocusElementType::kPage,
GetFocusedElementType(engine.get()));
EXPECT_EQ(1, GetLastFocusedPage(engine.get()));
}
TEST_F(PDFiumEngineTabbingTest, VerifyFormFieldStatesOnTabbing) {
/*
* Document structure
* Document
* ++ Page 1
* ++++ Annotation (Text Field)
* ++++ Annotation (Radio Button)
*/
TestClient client;
std::unique_ptr<PDFiumEngine> engine =
InitializeEngine(&client, FILE_PATH_LITERAL("annots.pdf"));
ASSERT_TRUE(engine);
ASSERT_EQ(1, engine->GetNumberOfPages());
ASSERT_TRUE(HandleTabEvent(engine.get(), 0));
EXPECT_EQ(PDFiumEngine::FocusElementType::kDocument,
GetFocusedElementType(engine.get()));
// Bring focus to the text field.
ASSERT_TRUE(HandleTabEvent(engine.get(), 0));
EXPECT_EQ(PDFiumEngine::FocusElementType::kPage,
GetFocusedElementType(engine.get()));
EXPECT_EQ(0, GetLastFocusedPage(engine.get()));
EXPECT_TRUE(IsInFormTextArea(engine.get()));
EXPECT_TRUE(engine->CanEditText());
// Bring focus to the button.
ASSERT_TRUE(HandleTabEvent(engine.get(), 0));
EXPECT_EQ(PDFiumEngine::FocusElementType::kPage,
GetFocusedElementType(engine.get()));
EXPECT_EQ(0, GetLastFocusedPage(engine.get()));
EXPECT_FALSE(IsInFormTextArea(engine.get()));
EXPECT_FALSE(engine->CanEditText());
}
TEST_F(PDFiumEngineTabbingTest, ClearSelectionOnFocusInFormTextArea) {
TestClient client;
std::unique_ptr<PDFiumEngine> engine =
InitializeEngine(&client, FILE_PATH_LITERAL("form_text_fields.pdf"));
ASSERT_TRUE(engine);
ASSERT_EQ(1, engine->GetNumberOfPages());
EXPECT_EQ(PDFiumEngine::FocusElementType::kNone,
GetFocusedElementType(engine.get()));
EXPECT_EQ(-1, GetLastFocusedPage(engine.get()));
// Select all text.
engine->SelectAll();
EXPECT_EQ(1u, GetSelectionSize(engine.get()));
// Tab to bring focus to a form text area annotation.
ASSERT_TRUE(HandleTabEvent(engine.get(), 0));
ASSERT_TRUE(HandleTabEvent(engine.get(), 0));
EXPECT_EQ(PDFiumEngine::FocusElementType::kPage,
GetFocusedElementType(engine.get()));
EXPECT_EQ(0, GetLastFocusedPage(engine.get()));
EXPECT_EQ(0u, GetSelectionSize(engine.get()));
}
TEST_F(PDFiumEngineTabbingTest, RetainSelectionOnFocusNotInFormTextArea) {
TestClient client;
std::unique_ptr<PDFiumEngine> engine =
InitializeEngine(&client, FILE_PATH_LITERAL("annots.pdf"));
ASSERT_TRUE(engine);
ASSERT_EQ(1, engine->GetNumberOfPages());
EXPECT_EQ(PDFiumEngine::FocusElementType::kNone,
GetFocusedElementType(engine.get()));
EXPECT_EQ(-1, GetLastFocusedPage(engine.get()));
// Select all text.
engine->SelectAll();
EXPECT_EQ(1u, GetSelectionSize(engine.get()));
// Tab to bring focus to a non form text area annotation (Button).
ASSERT_TRUE(HandleTabEvent(engine.get(), PP_INPUTEVENT_MODIFIER_SHIFTKEY));
EXPECT_EQ(PDFiumEngine::FocusElementType::kPage,
GetFocusedElementType(engine.get()));
EXPECT_EQ(0, GetLastFocusedPage(engine.get()));
EXPECT_EQ(1u, GetSelectionSize(engine.get()));
}
class ScrollingTestClient : public TestClient {
public:
ScrollingTestClient() = default;
~ScrollingTestClient() override = default;
ScrollingTestClient(const ScrollingTestClient&) = delete;
ScrollingTestClient& operator=(const ScrollingTestClient&) = delete;
// Mock PDFEngine::Client methods.
MOCK_METHOD(void, ScrollToX, (int), (override));
MOCK_METHOD(void, ScrollToY, (int, bool), (override));
};
TEST_F(PDFiumEngineTabbingTest, MaintainViewportWhenFocusIsUpdated) {
StrictMock<ScrollingTestClient> client;
std::unique_ptr<PDFiumEngine> engine = InitializeEngine(
&client, FILE_PATH_LITERAL("annotation_form_fields.pdf"));
ASSERT_TRUE(engine);
ASSERT_EQ(2, engine->GetNumberOfPages());
engine->PluginSizeUpdated(gfx::Size(60, 40));
{
InSequence sequence;
static constexpr PP_Point kScrollValue = {510, 478};
EXPECT_CALL(client, ScrollToY(kScrollValue.y, false))
.WillOnce(Invoke(
[&engine]() { engine->ScrolledToYPosition(kScrollValue.y); }));
EXPECT_CALL(client, ScrollToX(kScrollValue.x)).WillOnce(Invoke([&engine]() {
engine->ScrolledToXPosition(kScrollValue.x);
}));
}
EXPECT_EQ(PDFiumEngine::FocusElementType::kNone,
GetFocusedElementType(engine.get()));
EXPECT_EQ(-1, GetLastFocusedPage(engine.get()));
// Tabbing to bring the document into focus.
ASSERT_TRUE(HandleTabEvent(engine.get(), 0));
EXPECT_EQ(PDFiumEngine::FocusElementType::kDocument,
GetFocusedElementType(engine.get()));
// Tab to an annotation.
ASSERT_TRUE(HandleTabEvent(engine.get(), 0));
EXPECT_EQ(PDFiumEngine::FocusElementType::kPage,
GetFocusedElementType(engine.get()));
// Scroll focused annotation out of viewport.
static constexpr PP_Point kScrollPosition = {242, 746};
engine->ScrolledToXPosition(kScrollPosition.x);
engine->ScrolledToYPosition(kScrollPosition.y);
engine->UpdateFocus(/*has_focus=*/false);
EXPECT_EQ(PDFiumEngine::FocusElementType::kPage,
GetLastFocusedElementType(engine.get()));
EXPECT_EQ(0, GetLastFocusedPage(engine.get()));
EXPECT_EQ(PDFiumEngine::FocusElementType::kPage,
GetFocusedElementType(engine.get()));
EXPECT_EQ(1, GetLastFocusedAnnotationIndex(engine.get()));
// Restore focus, we shouldn't have any calls to scroll viewport.
engine->UpdateFocus(/*has_focus=*/true);
EXPECT_EQ(PDFiumEngine::FocusElementType::kPage,
GetFocusedElementType(engine.get()));
EXPECT_EQ(0, GetLastFocusedPage(engine.get()));
}
TEST_F(PDFiumEngineTabbingTest, ScrollFocusedAnnotationIntoView) {
StrictMock<ScrollingTestClient> client;
std::unique_ptr<PDFiumEngine> engine = InitializeEngine(
&client, FILE_PATH_LITERAL("annotation_form_fields.pdf"));
ASSERT_TRUE(engine);
ASSERT_EQ(2, engine->GetNumberOfPages());
engine->PluginSizeUpdated(gfx::Size(60, 40));
{
InSequence sequence;
static constexpr PP_Point kScrollValues[] = {{510, 478}, {510, 478}};
for (const auto& scroll_value : kScrollValues) {
EXPECT_CALL(client, ScrollToY(scroll_value.y, false))
.WillOnce(Invoke([&engine, &scroll_value]() {
engine->ScrolledToYPosition(scroll_value.y);
}));
EXPECT_CALL(client, ScrollToX(scroll_value.x))
.WillOnce(Invoke([&engine, &scroll_value]() {
engine->ScrolledToXPosition(scroll_value.x);
}));
}
}
EXPECT_EQ(PDFiumEngine::FocusElementType::kNone,
GetFocusedElementType(engine.get()));
EXPECT_EQ(-1, GetLastFocusedPage(engine.get()));
// Tabbing to bring the document into focus.
ASSERT_TRUE(HandleTabEvent(engine.get(), 0));
EXPECT_EQ(PDFiumEngine::FocusElementType::kDocument,
GetFocusedElementType(engine.get()));
// Tab to an annotation.
ASSERT_TRUE(HandleTabEvent(engine.get(), 0));
EXPECT_EQ(PDFiumEngine::FocusElementType::kPage,
GetFocusedElementType(engine.get()));
// Scroll focused annotation out of viewport.
static constexpr PP_Point kScrollPosition = {242, 746};
engine->ScrolledToXPosition(kScrollPosition.x);
engine->ScrolledToYPosition(kScrollPosition.y);
// Scroll the focused annotation into view.
ScrollFocusedAnnotationIntoView(engine.get());
}
} // namespace chrome_pdf
| [
"commit-bot@chromium.org"
] | commit-bot@chromium.org |
efb45884e09a89c6e3b3613dabd9ec56e8440c11 | 39cd8b4643b1a3b2cbfda2e9776fd1148ded3ba0 | /TA_stuff/removal.cpp | f59eed90b654888ec49123df9df4ff18c564049d | [
"Apache-2.0",
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | onexmaster/cp | 816b98f6a6ea75e018ccb5251f35b64a1bfac542 | b78b0f1e586d6977d86c97b32f48fed33f1469af | refs/heads/master | 2023-03-04T23:20:27.179578 | 2021-02-15T19:40:04 | 2021-02-15T19:40:04 | 289,799,995 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,193 | cpp |
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <ctype.h>
int main(void)
{
#ifndef ONLINE_JUDGE
freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout);
#endif
char orig[101];
scanf("%s", orig);
int num;
int i, j;
int lenOfString;
scanf("%d", &num);
// char forbid[num];
// for (i = 0; i < num; i++)
// {
// scanf(" ");
// scanf("%c", &forbid[i]);
// }
scanf(" ");
char buffer[250];
scanf("%[^\n]",buffer);
char forbid[num];
int index=0;
int bfrsz=strlen(buffer);
for(int i=0;i<bfrsz;i++)
{
if(!isspace(buffer[i]))
{
forbid[index]=buffer[i];
index++;
}
}
lenOfString = strlen(orig);
for (i = 0; i < lenOfString; i++)
{
int okay = 1;
for (j = 0; j < num; j++)
{
if (orig[i] == forbid[j])
{
okay = 0;
}
}
if (okay == 1)
{
printf("%c", orig[i]);
}
}
printf("\n");
}
| [
"tanujjain244@yahoo.com"
] | tanujjain244@yahoo.com |
bed76f8eb3f4e9007e6844606c283dbfc5837943 | 50837398a069185c6c94970460cd6a75af2e6b8e | /selectionSort.cpp | b601b7e8177bb17a0dae9f6a6c558d0ed77d6268 | [] | no_license | AbdullahAlshuaibi/CS111 | 1b8aee1152810ddba2173ef5c83b61ee75dc5f26 | dc85cbb9783695fe09f90c01a00792f51fbd8081 | refs/heads/master | 2022-11-18T11:43:36.620657 | 2020-07-11T06:33:33 | 2020-07-11T06:33:33 | 278,803,143 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,303 | cpp | #include <iostream>
#include <cstdlib>
using namespace std;
void selectionSort(int array[], int N);
int main()
{
srand(time(0));
const int SIZE = 10;
//declare an array using SIZE
int ar[SIZE];
for(int i=0; i<10; i++) //fill the array with 10 random numbers between 0 and 100
{
ar[i]= rand()%100+1;
cout << ar[i]<< " ";
}
cout<< endl;
selectionSort(ar, SIZE); //call selectionSort
for(int i=0; i<SIZE; i++)
{
cout <<ar[i]<< " ";
} //print the array
cout<<endl;
return 0;
}
//change this function so it will sort the numbers in decending order: largest down to smallest
void selectionSort(int array[], int N)
{
int smalIndx; //the index of the largest value
int temp; //temporary variable that holds the largest value
// last is the last index in unsorted portion
for(int last=N-1; last>=1; last--)
{
smalIndx = 0; //assume the first item is the largest
//find the largest in unsorted portion ([0..last])
for(int i = 1; i<= last; i++)
{
if(array[i] < array[smalIndx]) //The current item is larger
smalIndx = i;
}
//swap the largest with the last item in the unsorted portion
temp = array[smalIndx];
array[smalIndx] = array[last];
array[last] = temp;
}
}
| [
"noreply@github.com"
] | noreply@github.com |
cc25835cac5fe05305bea4babf36a4c6dfbe2dab | 722f7f64bac942a88205b2b1fbe0e5a8fe5c164c | /src/bamUtil/src/SplitBam.cpp | ce238da1c63dba6585a76119b1530ef2bca0a8aa | [] | no_license | narisu/gotcloud | 7d891edf0fe7af8ad98851a4ff4c8bc2d48937d8 | a654789396528a8b01897fd689f550b7b1be4ae5 | refs/heads/master | 2021-01-18T09:23:03.290763 | 2013-09-20T13:56:53 | 2013-09-20T13:56:53 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 9,323 | cpp | /*
* Copyright (C) 2010 Hyun Min Kang
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <iostream>
#include <fstream>
#include <sstream>
#include <map>
#include <vector>
#include <string>
#include <cstdlib>
#include <unistd.h>
#include <getopt.h>
#include "SplitBam.h"
#include "SamFile.h"
#include "Logger.h"
#include "BgzfFileType.h"
////////////////////////////////////////////////////////////////////////
// SplitBam :
// Split a BAM file into multiple BAM files based on ReadGroup
//
// Copyright (c) 2010 Hyun Min Kang
// Last modified Jun 10, 2010
// Modified 1/16/2012 by Mary Kate Trost to put into bamUtil.
//
// SplitBam splits a BAM file into multiple BAM files based on
// ReadGroup according to the following details.
// (1) Creates multiple output files named [outprefix].[RGID].bam, for
// each ReadGroup ID (RGID) existing in the bam file
// (2) Headers are a copy of the original file, removing @RG and @PG
// headers where IDs match with the other ReadGroup IDs.
// (3) Copy each of the original file's BAM record to one of the output
// file where the ReadGroup ID matches
//
// Usage : bam splitBam [-v] [-i inputBAMFile] [-o outPrefix] [-L logFile]
// Required arguments:
// -i inputBAMFile : Original BAM file containing readGroup info
// -o outprefix : prefix of output bam files of [outprefix].[RGID].bam
// Optional arguments:
// -L logFile : log file name. default is listFile.log
// -v : turn on verbose mode
///////////////////////////////////////////////////////////////////////
void SplitBam::splitBamDescription()
{
std::cerr << " splitBam - Split a BAM file into multiple BAM files based on ReadGroup" << std::endl;
}
void SplitBam::description()
{
splitBamDescription();
}
// print Usage
void SplitBam::usage()
{
BamExecutable::usage();
std::cerr << "\t ./bam splitBam [-v] -i <inputBAMFile> -o <outPrefix> [-L logFile]" << std::endl;
std::cerr << "splitBam splits a BAM file into multiple BAM files based on" << std::endl;
std::cerr << "ReadGroup according to the following details." << std::endl;
std::cerr << "\t(1) Creates multiple output files named [outprefix].[RGID].bam, for" << std::endl;
std::cerr << "\teach ReadGroup ID (RGID) in the BAM record" << std::endl;
std::cerr << "\t(2) Headers are a copy of the original file, removing @RG and @PG" << std::endl;
std::cerr << "\theaders where IDs match with the other ReadGroup IDs." << std::endl;
std::cerr << "\t(3) Copy each of the original file's BAM record to one of the output" << std::endl;
std::cerr << "file where the ReadGroup ID matches" << std::endl;
std::cerr << "Required arguments:" << std::endl;
std::cerr << "-i/--in [inputBAMFile] : Original BAM file containing readGroup info" << std::endl;
std::cerr << "-o/--out [outPrefix] : prefix of output bam files of [outprefix].[RGID].bam" << std::endl;
std::cerr << "Optional arguments:" << std::endl;
std::cerr << "-L/--log [logFile] : log file name. default is listFile.log" << std::endl;
std::cerr << "-v/--verbose : turn on verbose mode" << std::endl;
std::cerr << "-n/--noeof : turn on verbose mode" << std::endl;
}
// main function
int SplitBam::execute(int argc, char ** argv)
{
static struct option getopt_long_options[] =
{
// Input options
{ "in", required_argument, NULL, 'i'},
{ "out", required_argument, NULL, 'o'},
{ "verbose", no_argument, NULL, 'v'},
{ "noeof", no_argument, NULL, 'n'},
{ "log", required_argument, NULL, 'L'},
{ NULL, 0, NULL, 0 },
};
int n_option_index = 0;
char c;
bool b_verbose = false;
bool noeof = false;
std::string s_in, s_out, s_logger;
while ( ( c = getopt_long(argc-1, &(argv[1]), "i:o:vLn:", getopt_long_options, &n_option_index) ) != -1 ) {
switch(c) {
case 'i':
s_in = optarg;
break;
case 'o':
s_out = optarg;
break;
case 'v':
b_verbose = true;
break;
case 'n':
noeof = true;
break;
case 'L':
s_logger = optarg;
break;
default:
fprintf(stderr,"Unrecognized option %s",getopt_long_options[n_option_index].name);
abort();
}
}
if ( s_logger.empty() ) {
s_logger = s_out + ".log";
}
if(noeof)
{
// Set that the eof block is not required.
BgzfFileType::setRequireEofBlock(false);
}
// create a logger object, now possible to write logs/warnings/errors
Logger::gLogger = new Logger(s_logger.c_str(), b_verbose);
// every argument must correspond to an option
if ( optind < (argc-1) ) {
usage();
Logger::gLogger->error("non-option argument exist");
}
// check the required arguments are nonempty
if ( s_in.empty() || s_out.empty() ) {
usage();
Logger::gLogger->error("At least one of the required argument is missing");
}
Logger::gLogger->writeLog("Input BAM file : %s",s_in.c_str());
Logger::gLogger->writeLog("Output BAM prefix : %s",s_out.c_str());
Logger::gLogger->writeLog("Output log file : %s",s_logger.c_str());
Logger::gLogger->writeLog("Verbose mode : %s",b_verbose ? "On" : "Off");
Logger::gLogger->writeLog("BGFZ EOF indicator : %s",noeof ? "Off" : "On");
SamFile inBam;
SamFileHeader inHeader;
std::map<std::string,uint32_t> msRGidx;
std::vector<std::string> vsRGIDs;
std::vector<SamFile*> vpOutBams;
std::vector<SamFileHeader*> vpOutHeaders;
if ( ! (inBam.OpenForRead(s_in.c_str())) ) {
Logger::gLogger->error("Cannot open BAM file %s for reading - %s",s_in.c_str(), SamStatus::getStatusString(inBam.GetStatus()) );
}
inBam.ReadHeader(inHeader);
SamHeaderRecord* pSamHeaderRecord;
while( (pSamHeaderRecord = inHeader.getNextHeaderRecord()) != NULL ) {
SamHeaderRecord::SamHeaderRecordType sHeaderRecordType(pSamHeaderRecord->getType());
if ( sHeaderRecordType == SamHeaderRecord::RG) {
std::string sRGID = pSamHeaderRecord->getTagValue("ID");
if ( sRGID.empty() ) {
Logger::gLogger->error("Readgroup ID is empty");
}
vsRGIDs.push_back(sRGID);
uint32_t idx = msRGidx.size();
msRGidx[sRGID] = idx;
SamFile* pNewFile = new SamFile;
vpOutBams.push_back(pNewFile);
std::string outFileName = s_out + "." + sRGID + ".bam";
if ( !pNewFile->OpenForWrite(outFileName.c_str()) ) {
Logger::gLogger->error("Cannot open BAM file %s for writing",outFileName.c_str());
}
SamFileHeader* pNewHeader = new SamFileHeader(inHeader);
vpOutHeaders.push_back(pNewHeader);
}
}
Logger::gLogger->writeLog("The following ReadGroup IDs are identified. Splitting into %u BAM files..",vsRGIDs.size());
for(uint32_t i=0; i < vsRGIDs.size(); ++i) {
Logger::gLogger->writeLog("\t%d: %s",i+1,vsRGIDs[i].c_str());
}
if ( vsRGIDs.size() == 0 ) {
Logger::gLogger->error("Only %u readGroups are observed",vsRGIDs.size());
}
else if ( vsRGIDs.size() ==1 ) {
Logger::gLogger->warning("Only %u readGroups are observed",vsRGIDs.size());
}
// remove non-relevant readGroups
for(uint32_t i=0; i < vsRGIDs.size(); ++i) {
for(uint32_t j=0; j < vsRGIDs.size(); ++j) {
if ( i != j ) {
vpOutHeaders[i]->removeRG(vsRGIDs[j].c_str());
vpOutHeaders[i]->removePG(vsRGIDs[j].c_str());
}
}
}
// write headers to the output file
for(uint32_t i=0; i < vsRGIDs.size(); ++i) {
vpOutBams[i]->WriteHeader(*vpOutHeaders[i]);
}
SamRecord record;
while( inBam.ReadRecord(inHeader, record) == true ) {
char tag[3];
char vtype;
void* value;
bool found = false;
while( record.getNextSamTag(tag, vtype, &value) != false ) {
if ( strcmp(tag,"RG") == 0 ) {
found = true;
if ( vtype == 'Z' ) {
std::string sValue = ((String)*(String*)value).c_str();
if ( msRGidx.find(sValue) != msRGidx.end() ) {
uint32_t idx = msRGidx[sValue];
if ( (idx >= 0 ) && ( idx < vsRGIDs.size () ) ) {
vpOutBams[idx]->WriteRecord(inHeader, record);
}
else {
Logger::gLogger->error("ReadGroup Index Lookup Failure");
}
}
else {
Logger::gLogger->error("ReadGroup ID %s cannot be found",sValue.c_str());
}
}
else {
Logger::gLogger->error("vtype of RG tag must be 'Z'");
}
break;
}
}
if ( found == false ) {
Logger::gLogger->error("Cannot find RG tag for readName %s",record.getReadName());
}
}
for(uint32_t i=0; i < vsRGIDs.size(); ++i) {
Logger::gLogger->writeLog("Successfully wrote %d record for readGroup %s",vpOutBams[i]->GetCurrentRecordCount(), vsRGIDs[i].c_str());
vpOutBams[i]->Close();
delete vpOutBams[i];
delete vpOutHeaders[i];
}
delete Logger::gLogger;
return 0;
}
| [
"mktrost@umich.edu"
] | mktrost@umich.edu |
c8de7df8e17e93418175e3a03e0fe5c0d4d45291 | 1fcdb2bc2c7f75f6aed466119a4b1c53777f0b7a | /holly_inletwfine_LRR_RSM_noturbulence2/1/nut | 41cd8fd0fb40a4419328a656073b504dd83b878e | [] | no_license | bshambaugh/openfoam-experiments3 | b32549e80836eee9fc6062873fc737155168f919 | 4bd90a951845a4bc5dda7063e91f6cc0ba730e48 | refs/heads/master | 2020-04-15T08:17:15.156512 | 2019-01-15T04:31:23 | 2019-01-15T04:31:23 | 164,518,405 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,011 | /*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 4.1 |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
location "1";
object nut;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 2 -1 0 0 0 0];
internalField uniform 1.85252e-05;
boundaryField
{
inletFace
{
type calculated;
value uniform 1.85252e-05;
}
inlet
{
type calculated;
value uniform 1.85252e-05;
}
inletWalls
{
type nutkWallFunction;
Cmu 0.09;
kappa 0.41;
E 9.8;
value nonuniform List<scalar>
30
(
0.0262429
0.0262432
0.0262401
0.0262428
0.0262433
0.02624
0.0262428
0.0262433
0.02624
0.0262428
0.0262433
0.02624
0.0262428
0.0262433
0.02624
0.0262428
0.0262433
0.02624
0.0262428
0.0262433
0.02624
0.0262428
0.0262433
0.02624
0.0262428
0.0262433
0.02624
0.0262429
0.0262432
0.0262401
)
;
}
outletInlet
{
type cyclicAMI;
value nonuniform List<scalar>
15
(
1.85252e-05
1.85252e-05
1.85252e-05
1.85252e-05
1.85252e-05
1.85252e-05
1.85252e-05
1.85252e-05
1.85252e-05
1.85252e-05
1.85252e-05
1.85252e-05
1.85252e-05
1.85252e-05
1.85252e-05
)
;
}
fineSymmetryWall
{
type symmetryPlane;
}
fineWalls
{
type nutkWallFunction;
Cmu 0.09;
kappa 0.41;
E 9.8;
value nonuniform List<scalar>
160
(
0.152567
0.239264
0.239257
0.152567
0.239257
0.152567
0.239257
0.239264
0.152567
0.239264
0.239257
0.152567
0.239257
0.152567
0.239257
0.239264
0.152567
0.239264
0.152567
0.239264
0.239257
0.152567
0.239257
0.239264
0.152567
0.239264
0.152567
0.239264
0.239257
0.152567
0.239257
0.152567
0.239257
0.239264
0.152567
0.239264
0.239257
0.152567
0.239257
0.152567
0.239257
0.239264
0.152567
0.239264
0.152567
0.239264
0.239257
0.152567
0.239257
0.239264
0.152567
0.239264
0.152567
0.239264
0.239257
0.152567
0.239257
0.152567
0.239257
0.239264
0.152567
0.239264
0.239257
0.152567
0.239257
0.152567
0.239257
0.239264
0.152567
0.239264
0.152567
0.239264
0.239257
0.152567
0.239257
0.239264
0.152567
0.239257
0.152567
0.239257
0.152567
0.261857
0.152567
0.152567
0.152567
0.261857
0.152567
0.152567
0.152567
0.261857
0.152567
0.152567
0.261857
0.152567
0.152567
0.152567
0.261857
0.152567
0.152567
0.261857
0.152567
0.152567
0.152567
0.261857
0.152567
0.152567
0.152567
0.261857
0.152567
0.152567
0.261857
0.152567
0.152567
0.152567
0.261857
0.152567
0.152567
0.261857
0.152567
0.152567
0.152567
0.261857
0.152567
0.152567
0.152567
0.261857
0.152567
0.152567
0.261857
0.152567
0.152567
0.152567
0.261857
0.152567
0.152567
0.152567
0.261857
0.152567
0.152567
0.261857
0.152567
0.152567
0.152567
0.261857
0.152567
0.152567
0.261857
0.152567
0.152567
0.152567
0.261857
0.152567
0.152567
0.152567
0.261857
0.152567
0.152567
0.261857
0.152567
0.152567
)
;
}
fineCyclicBoundary
{
type calculated;
value uniform 1.85252e-05;
}
fineplug
{
type cyclicAMI;
value uniform 1.85252e-05;
}
faceFine
{
type calculated;
value uniform 1.85252e-05;
}
}
// ************************************************************************* //
| [
"brent.shambaugh@gmail.com"
] | brent.shambaugh@gmail.com | |
bca4ce1e3f2ea36a679219c1c3efa53bf59c5f3e | 7dc95de30c66996726d357f01ce32ad2d5cc4aca | /HIH6131.cpp | d536f833a26080e3b0ea56076d8f6c741addb067 | [] | no_license | eraticus/HIH6131_arduino_library | 39d7919eda9dd9fd5cfed93853e377cf5ed0cc24 | b6b5a7f011d53e4b83962e761790dce7757be4b5 | refs/heads/master | 2021-01-14T08:10:48.364728 | 2017-02-15T09:12:28 | 2017-02-15T09:12:28 | 82,005,170 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 154 | cpp | #include "HIH6131.h"
int HIH6131::begin()
{
return 0;
}
float HIH6131::getTemperature()
{
return 1.9;
}
float HIH6131::getHumidity()
{
return 2.3;
} | [
"eraticus@gmail.com"
] | eraticus@gmail.com |
cff8a73c2c3b4b6e62e3d1e3441f20af3bcbb3ca | 5a6f8361dd4b6d7add57940dccca4c5729be6922 | /DailyManagement/countdownPage.h | a93dc730877771ce11892751ee34d7822516c06e | [] | no_license | YuJieROOT/DailyManagement | 4d5a70953f62e4a6282b097236f0fe713d354587 | 44978b6fce43a5dd29224da5900547239fb4cf5d | refs/heads/master | 2023-03-04T05:04:55.007406 | 2021-01-16T14:43:42 | 2021-01-16T14:43:42 | 326,620,428 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 766 | h | #ifndef COUNTDOWNPAGE_H
#define COUNTDOWNPAGE_H
#include <QMainWindow>
#include "calendarPage.h"
#include "dustbinPage.h"
#include "logPage.h"
#include "searchPage.h"
#include "settingPage.h"
#include "todoPage.h"
#include "userPage.h"
namespace Ui {
class countDownPage;
}
class countDownPage : public QMainWindow
{
Q_OBJECT
public:
explicit countDownPage(QWidget *parent = nullptr);
~countDownPage();
private slots:
void on_user_button_clicked();
void on_todo_button_clicked();
void on_calendar_button_clicked();
void on_dustbin_button_clicked();
void on_search_button_clicked();
void on_log_button_clicked();
void on_setting_button_clicked();
private:
Ui::countDownPage *ui;
};
#endif // COUNTDOWNPAGE_H
| [
"2665000101@qq.com"
] | 2665000101@qq.com |
3b59ef736cd5e5447fcfa98eb038c6d00e575a37 | b3808ef958fdc8d650dc38a0016f2fea9c439415 | /190426_44keypad_2/190426_44keypad_2.ino | da59230690fbaf5c92adeb62c02e15b10c814174 | [] | no_license | insung0306/rtos_avr | 40350d166f9a0c60eb554a0a2b2d32f62154164b | 65402fbd48217753dfd52256d53b5b017585e992 | refs/heads/master | 2020-05-31T20:33:30.705624 | 2019-06-29T06:33:59 | 2019-06-29T06:33:59 | 190,478,303 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,828 | ino | #define BTN_NUM 4
int flag[BTN_NUM][BTN_NUM] = {0,};
int a=0;
int b=0;
int c=0;
int d=0;
int btn_num[BTN_NUM] = {1,2,3,4};
void setup() {
Serial.begin(9600);
//Row 1
pinMode(2,INPUT);
pinMode(3,INPUT);
pinMode(4,INPUT);
pinMode(5,INPUT);
//Colum
pinMode(6,OUTPUT);
pinMode(7,OUTPUT);
pinMode(8,OUTPUT);
pinMode(9,OUTPUT);
}
void loop() {
for(int i =0; i<BTN_NUM; i++){
//Col 1 high
digitalWrite(6,0);
digitalWrite(7,0);
digitalWrite(8,0);
digitalWrite(9,0);
digitalWrite(6+i,1);
//Check Row State
a = digitalRead(2);
if(a == 1){
if(flag[i] == 1){ //
Serial.println("HIGH" + String(btn_num[i])); //
flag[i] = 0; //
}
}
else{
if(flag[i] == 0){//
Serial.println("Low" + String(btn_num[i]));//
flag[i] = 1; //
}
}
//Check Row State
b = digitalRead(3);
if(b == 1){
if(flag[i] == 1){ //
Serial.println("HIGH" + String(btn_num[i])); //
flag[i] = 0; //
}
}
else{
if(flag[i] == 0){//
Serial.println("Low" + String(btn_num[i]));//
flag[i] = 1; //
}
}
//Check Row State
c = digitalRead(4);
if(c == 1){
if(flag[i] == 1){ //
Serial.println("HIGH" + String(btn_num[i])); //
flag[i] = 0; //
}
}
else{
if(flag[i] == 0){//
Serial.println("Low" + String(btn_num[i]));//
flag[i] = 1; //
}
}
//Check Row State
d = digitalRead(5);
if(d == 1){
if(flag[i] == 1){ //
Serial.println("HIGH" + String(btn_num[i])); //
flag[i] = 0; //
}
}
else{
if(flag[i] == 0){//
Serial.println("Low" + String(btn_num[i]));//
flag[i] = 1; //
}
}
delay(10);
}
}
| [
"jis020306@gmail.com"
] | jis020306@gmail.com |
56e36be3f34ebd6066e2244a4cf4a00e318e821b | 72d9009d19e92b721d5cc0e8f8045e1145921130 | /teachingApps/inst/testfiles/dlbisa/dlbisa_DeepState_TestHarness.cpp | d1c381bf54c3b1cb8b9cc79ba55077cb82d19eb0 | [] | no_license | akhikolla/TestedPackages-NoIssues | be46c49c0836b3f0cf60e247087089868adf7a62 | eb8d498cc132def615c090941bc172e17fdce267 | refs/heads/master | 2023-03-01T09:10:17.227119 | 2021-01-25T19:44:44 | 2021-01-25T19:44:44 | 332,027,727 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,143 | cpp | // AUTOMATICALLY GENERATED BY RCPPDEEPSTATE PLEASE DO NOT EDIT BY HAND, INSTEAD EDIT
// dlbisa_DeepState_TestHarness_generation.cpp and dlbisa_DeepState_TestHarness_checks.cpp
#include <fstream>
#include <RInside.h>
#include <iostream>
#include <RcppDeepState.h>
#include <qs.h>
#include <DeepState.hpp>
NumericVector dlbisa(NumericVector z, const double shape);
TEST(teachingApps_deepstate_test,dlbisa_test){
RInside R;
std::cout << "input starts" << std::endl;
NumericVector z = RcppDeepState_NumericVector();
qs::c_qsave(z,"/home/akhila/fuzzer_packages/fuzzedpackages/teachingApps/inst/testfiles/dlbisa/inputs/z.qs",
"high", "zstd", 1, 15, true, 1);
std::cout << "z values: "<< z << std::endl;
NumericVector shape(1);
shape[0] = RcppDeepState_double();
qs::c_qsave(shape,"/home/akhila/fuzzer_packages/fuzzedpackages/teachingApps/inst/testfiles/dlbisa/inputs/shape.qs",
"high", "zstd", 1, 15, true, 1);
std::cout << "shape values: "<< shape << std::endl;
std::cout << "input ends" << std::endl;
try{
dlbisa(z,shape[0]);
}
catch(Rcpp::exception& e){
std::cout<<"Exception Handled"<<std::endl;
}
}
| [
"akhilakollasrinu424jf@gmail.com"
] | akhilakollasrinu424jf@gmail.com |
e6498c119e81e88313ea43da479783eacb086ec2 | e39cdf2d8bd9af9c6fb1d8cb436b24275a18f288 | /細談資料結構/ch7/cpp/7-7HeapSort.cpp | 5149352efbbdc69dce8c7f1bb6a779bb0ef54365 | [] | no_license | IRON-HAN/learn_c | 5977d32355b694f3196d1bcf6457aa74381aa64e | 0d17f80944dd81a106d2d9425707419b122c4e36 | refs/heads/master | 2021-05-30T03:49:19.717917 | 2015-08-09T08:18:16 | 2015-08-09T08:18:16 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,996 | cpp | /*=========================================================
7-7節 堆積排序法
Heap_Sort() 堆積排序法函式
Construct_by_Adjust() 將陣列調整成堆積
Down_Heap() 調整堆積,以符合特性
a[ARR_NUM] 欲排序之資料
ARR_NUM 欲排序之資料數目(陣列大小)
=========================================================
*/
#include <iostream.h>
#define ARR_NUM 9
void Heap_Sort(int [], int);
void Construct_by_Adjust(int [], int);
void Down_Heap(int [], int, int);
void main(void) {
int a[ARR_NUM] = {37, 41, 19, 81, 41, 25, 56, 61, 49}, i;
cout << "排序前 ( before sorting ):" << endl;
for (i = 0; i < ARR_NUM; i++) {
cout << " " << a[i];
}
Heap_Sort(a, ARR_NUM);
cout << endl << "排序後 ( after sorting ):" << endl;
for (i = 0; i < ARR_NUM; i++) {
cout << " " << a[i];
}
cout << endl;
}
void Heap_Sort(int a[], int n) {
int temp;
Construct_by_Adjust(a, n); /*建立堆積*/
while (n > 1) {
temp = a[n - 1]; /*樹根跟最後一個元素交換*/
a[n - 1] = a[0];
a[0] = temp;
n--;
Down_Heap(a, n, 0); /*調整成heap*/
}
}
/*用調整的方式建立堆積 a[n]*/
void Construct_by_Adjust(int a[], int n) {
int k;
for (k = n / 2 - 1; k >= 0; k--) {
Down_Heap(a, n, k);
}
}
/*將a[k]往下調整,以符合heap特性*/
void Down_Heap(int a[], int n, int k) {
int j, up;
up = a[k];
while (k < n / 2) { /*a[k]必須有子節點*/
j = 2 * k + 1; /*a[k]之左兒子a[j]*/
if (j + 1 < n && a[j] < a[j + 1]) {
j++; /*若右兒子較大且存在;a[j]為a[k]之右兒子*/
}
if (up >= a[j]) {
break; /*大於大兒子*/
}
a[k] = a[j]; /*大兒子上來*/
k = j;
}
a[k] = up;
}
| [
"jason_yao@htc.com"
] | jason_yao@htc.com |
d3aa0e863480517d2f75b8b08a40e8bdedefe291 | 0a4d0659d1012a0faacf0acfdad9d2dccb67ced1 | /superKnopka/superKnopka.ino | 1e65f12f397b508f6d6ea9297bb7965ac4d0a57d | [] | no_license | gingerNata/Arduino-Sketchs | 6ebdba2ce450ab1d67f17623153bbe8554dd9c62 | 00a0314000669ff9d56c2ac03ae1967ef45e8489 | refs/heads/master | 2020-03-28T19:24:21.879363 | 2018-09-16T07:21:52 | 2018-09-16T07:21:52 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 336 | ino | /*
TEST CODE FOR PROXIMITY SENSOR
Metal Detection with 3 wire sensor
*/
int monitoring;
int metalDetection = 8;
void setup(){
Serial.begin(9600);
}
void loop(){
monitoring = digitalRead(metalDetection);
if(monitoring == HIGH)
{
Serial.println(monitoring);
}
else
{
Serial.println("LOW");
}
delay(500);
}
| [
"youremail@domain.com"
] | youremail@domain.com |
c35d3af9914a1f1fa1afef4488e60b2b793ee613 | ab1c643f224197ca8c44ebd562953f0984df321e | /wmi/wbem/winmgmt/provsubsys/decoupledclient/maindll.cpp | 3e8d3f5997c4adfc1a1e155f9200ad883537199a | [] | no_license | KernelPanic-OpenSource/Win2K3_NT_admin | e162e0452fb2067f0675745f2273d5c569798709 | d36e522f16bd866384bec440517f954a1a5c4a4d | refs/heads/master | 2023-04-12T13:25:45.807158 | 2021-04-13T16:33:59 | 2021-04-13T16:33:59 | 357,613,696 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 9,454 | cpp | /*++
Copyright (C) 1996-2001 Microsoft Corporation
Module Name:
MainDll.cpp
Abstract:
History:
--*/
#include "PreComp.h"
#include <wbemint.h>
#include <comdef.h>
#include <stdio.h>
#include "Globals.h"
#include "ClassFac.h"
#include "Guids.h"
#include "ProvRegistrar.h"
#include "ProvEvents.h"
#include <lockst.h>
/******************************************************************************
*
* Name:
*
*
* Description:
*
*
*****************************************************************************/
HINSTANCE g_ModuleInstance=NULL;
CriticalSection s_CriticalSection(NOTHROW_LOCK) ;
/******************************************************************************
*
* Name:
*
*
* Description:
*
*
*****************************************************************************/
BOOL APIENTRY DllMain (
HINSTANCE a_ModuleInstance,
ULONG a_Reason ,
LPVOID a_Reserved
)
{
g_ModuleInstance = a_ModuleInstance ;
BOOL t_Status = TRUE ;
if ( DLL_PROCESS_DETACH == a_Reason )
{
HRESULT t_Result = DecoupledProviderSubSystem_Globals :: Global_Shutdown () ;
if ( SUCCEEDED ( t_Result ) )
{
t_Status = TRUE ;
}
else
{
t_Status = FALSE ;
}
WmiHelper :: DeleteCriticalSection ( & s_CriticalSection ) ;
t_Status = TRUE ;
}
else if ( DLL_PROCESS_ATTACH == a_Reason )
{
WmiStatusCode t_StatusCode = WmiHelper :: InitializeCriticalSection ( & s_CriticalSection ) ;
if ( t_StatusCode == e_StatusCode_Success )
{
HRESULT t_Result = DecoupledProviderSubSystem_Globals :: Global_Startup () ;
if ( SUCCEEDED ( t_Result ) )
{
t_Status = TRUE ;
}
else
{
t_Status = FALSE ;
}
}
else
{
t_Status = FALSE ;
}
DisableThreadLibraryCalls ( a_ModuleInstance ) ;
}
else if ( DLL_THREAD_DETACH == a_Reason )
{
t_Status = TRUE ;
}
else if ( DLL_THREAD_ATTACH == a_Reason )
{
t_Status = TRUE ;
}
return t_Status ;
}
/******************************************************************************
*
* Name:
*
*
* Description:
*
*
*****************************************************************************/
STDAPI DllGetClassObject (
REFCLSID a_Clsid ,
REFIID a_Riid ,
void **a_Void
)
{
HRESULT t_Result = S_OK ;
if ( a_Clsid == CLSID_WbemDecoupledRegistrar )
{
CServerClassFactory <CServerObject_ProviderRegistrar,CServerObject_ProviderRegistrar> *t_Unknown = new CServerClassFactory <CServerObject_ProviderRegistrar,CServerObject_ProviderRegistrar> ;
if ( t_Unknown == NULL )
{
t_Result = E_OUTOFMEMORY ;
}
else
{
t_Result = t_Unknown->QueryInterface ( a_Riid , a_Void ) ;
if ( FAILED ( t_Result ) )
{
delete t_Unknown ;
}
else
{
}
}
}
else if ( a_Clsid == CLSID_WbemDecoupledBasicEventProvider )
{
CServerClassFactory <CServerObject_ProviderEvents,CServerObject_ProviderEvents> *t_Unknown = new CServerClassFactory <CServerObject_ProviderEvents,CServerObject_ProviderEvents> ;
if ( t_Unknown == NULL )
{
t_Result = E_OUTOFMEMORY ;
}
else
{
t_Result = t_Unknown->QueryInterface ( a_Riid , a_Void ) ;
if ( FAILED ( t_Result ) )
{
delete t_Unknown ;
}
else
{
}
}
}
else
{
t_Result = CLASS_E_CLASSNOTAVAILABLE ;
}
return t_Result ;
}
/******************************************************************************
*
* Name:
*
*
* Description:
*
*
*****************************************************************************/
STDAPI DllCanUnloadNow ()
{
/*
* Place code in critical section
*/
WmiStatusCode t_StatusCode = WmiHelper :: EnterCriticalSection ( & s_CriticalSection , FALSE ) ;
if ( t_StatusCode == e_StatusCode_Success )
{
BOOL t_Unload = (
DecoupledProviderSubSystem_Globals :: s_LocksInProgress || DecoupledProviderSubSystem_Globals :: s_ObjectsInProgress
) ;
t_Unload = ! t_Unload ;
WmiHelper :: LeaveCriticalSection ( & s_CriticalSection ) ;
return t_Unload ? ResultFromScode ( S_OK ) : ResultFromScode ( S_FALSE ) ;
}
else
{
return FALSE ;
}
}
/******************************************************************************
*
* Name:
*
*
* Description:
*
*
*****************************************************************************/
//Strings used during self registeration
#define REG_FORMAT_STR L"%s\\%s"
#define NOT_INSERT_STR L"NotInsertable"
#define INPROC32_STR L"InprocServer32"
#define LOCALSERVER32_STR L"LocalServer32"
#define THREADING_MODULE_STR L"ThreadingModel"
#define APARTMENT_STR L"Both"
#define APPID_VALUE_STR L"APPID"
#define APPID_STR L"APPID\\"
#define CLSID_STR L"CLSID\\"
#define WMI_PROVIDER_DECOUPLED_REGISTRAR __TEXT("Microsoft WMI Provider Subsystem Decoupled Registrar")
#define WMI_PROVIDER_DECOUPLED_BASIC_EVENT_PROVIDER __TEXT("Microsoft WMI Provider Subsystem Decoupled Basic Event Provider")
/******************************************************************************
*
* Name:
*
*
* Description:
*
*
*****************************************************************************/
BOOL SetKeyAndValue ( wchar_t *pszKey , wchar_t *pszSubkey , wchar_t *pszValueName , wchar_t *pszValue )
{
HKEY hKey;
wchar_t szKey[256];
HRESULT t_Result = StringCchCopyW ( szKey , sizeof ( szKey ) / sizeof ( wchar_t ) , pszKey ) ;
if ( FAILED ( t_Result ) )
{
return FALSE ;
}
if ( NULL != pszSubkey )
{
t_Result = StringCchCatW ( szKey , sizeof ( szKey ) / sizeof ( wchar_t ) , L"\\" ) ;
if ( FAILED ( t_Result ) )
{
return FALSE ;
}
t_Result = StringCchCatW ( szKey , sizeof ( szKey ) / sizeof ( wchar_t ) , pszSubkey ) ;
if ( FAILED ( t_Result ) )
{
return FALSE ;
}
}
if ( ERROR_SUCCESS != RegCreateKeyEx (
HKEY_CLASSES_ROOT ,
szKey ,
0,
NULL,
REG_OPTION_NON_VOLATILE ,
KEY_ALL_ACCESS,
NULL,
&hKey,
NULL
)
)
{
return FALSE ;
}
if ( NULL != pszValue )
{
if ( ERROR_SUCCESS != RegSetValueEx (
hKey,
pszValueName,
0,
REG_SZ,
(BYTE *) pszValue ,
(lstrlen(pszValue)+1)*sizeof(wchar_t)
)
)
{
return FALSE;
}
}
RegCloseKey ( hKey ) ;
return TRUE;
}
/******************************************************************************
*
* Name:
*
*
* Description:
*
*
*****************************************************************************/
STDAPI RegisterServer ( GUID a_ProviderClassId , wchar_t *a_ProviderName )
{
wchar_t szModule[512];
GetModuleFileName(g_ModuleInstance,(wchar_t*)szModule, sizeof(szModule)/sizeof(wchar_t));
wchar_t szProviderClassID[128];
wchar_t szProviderCLSIDClassID[128];
int iRet = StringFromGUID2(a_ProviderClassId,szProviderClassID, 128);
StringCchCopyW(szProviderCLSIDClassID,sizeof(szProviderCLSIDClassID)/sizeof(wchar_t),CLSID_STR);
StringCchCatW(szProviderCLSIDClassID,sizeof(szProviderCLSIDClassID)/sizeof(wchar_t),szProviderClassID);
//Create entries under CLSID
if (FALSE ==SetKeyAndValue(szProviderCLSIDClassID, NULL, NULL, a_ProviderName ))
return SELFREG_E_CLASS;
if (FALSE ==SetKeyAndValue(szProviderCLSIDClassID, NOT_INSERT_STR, NULL, NULL))
return SELFREG_E_CLASS;
if (FALSE ==SetKeyAndValue(szProviderCLSIDClassID, INPROC32_STR, NULL,szModule))
return SELFREG_E_CLASS;
if (FALSE ==SetKeyAndValue(szProviderCLSIDClassID, INPROC32_STR,THREADING_MODULE_STR, APARTMENT_STR))
return SELFREG_E_CLASS;
return S_OK;
}
/******************************************************************************
*
* Name:
*
*
* Description:
*
*
*****************************************************************************/
STDAPI UnregisterServer( GUID a_ProviderClassId )
{
wchar_t szTemp[128];
wchar_t szProviderClassID[128];
wchar_t szProviderCLSIDClassID[128];
int iRet = StringFromGUID2(a_ProviderClassId ,szProviderClassID, 128);
StringCchCopyW (szProviderCLSIDClassID,sizeof(szProviderCLSIDClassID)/sizeof(wchar_t),CLSID_STR);
StringCchCatW (szProviderCLSIDClassID,sizeof(szProviderCLSIDClassID)/sizeof(wchar_t),szProviderClassID);
//Delete entries under CLSID
StringCchPrintfW(szTemp, sizeof(szTemp)/sizeof(wchar_t),REG_FORMAT_STR, szProviderCLSIDClassID, NOT_INSERT_STR);
RegDeleteKey(HKEY_CLASSES_ROOT, szTemp);
StringCchPrintfW(szTemp, sizeof(szTemp)/sizeof(wchar_t),REG_FORMAT_STR,szProviderCLSIDClassID, INPROC32_STR);
RegDeleteKey(HKEY_CLASSES_ROOT, szTemp);
RegDeleteKey(HKEY_CLASSES_ROOT, szProviderCLSIDClassID);
return S_OK;
}
/******************************************************************************
*
* Name:
*
*
* Description:
*
*
*****************************************************************************/
STDAPI DllRegisterServer ()
{
HRESULT t_Result ;
t_Result = RegisterServer ( CLSID_WbemDecoupledRegistrar , WMI_PROVIDER_DECOUPLED_REGISTRAR ) ;
t_Result = RegisterServer ( CLSID_WbemDecoupledBasicEventProvider , WMI_PROVIDER_DECOUPLED_BASIC_EVENT_PROVIDER ) ;
return t_Result ;
}
/******************************************************************************
*
* Name:
*
*
* Description:
*
*
*****************************************************************************/
STDAPI DllUnregisterServer ()
{
HRESULT t_Result ;
t_Result = UnregisterServer ( CLSID_WbemDecoupledRegistrar ) ;
t_Result = UnregisterServer ( CLSID_WbemDecoupledBasicEventProvider ) ;
return t_Result ;
}
| [
"polarisdp@gmail.com"
] | polarisdp@gmail.com |
204a6d07d73ea25c2e388e07b01a609328cae057 | d0fb46aecc3b69983e7f6244331a81dff42d9595 | /tag/include/alibabacloud/tag/model/DeleteTagRequest.h | 1fbd43d5634377a628e5ca941791c56842a19078 | [
"Apache-2.0"
] | permissive | aliyun/aliyun-openapi-cpp-sdk | 3d8d051d44ad00753a429817dd03957614c0c66a | e862bd03c844bcb7ccaa90571bceaa2802c7f135 | refs/heads/master | 2023-08-29T11:54:00.525102 | 2023-08-29T03:32:48 | 2023-08-29T03:32:48 | 115,379,460 | 104 | 82 | NOASSERTION | 2023-09-14T06:13:33 | 2017-12-26T02:53:27 | C++ | UTF-8 | C++ | false | false | 1,869 | h | /*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef ALIBABACLOUD_TAG_MODEL_DELETETAGREQUEST_H_
#define ALIBABACLOUD_TAG_MODEL_DELETETAGREQUEST_H_
#include <alibabacloud/tag/TagExport.h>
#include <alibabacloud/core/RpcServiceRequest.h>
#include <string>
#include <vector>
#include <map>
namespace AlibabaCloud {
namespace Tag {
namespace Model {
class ALIBABACLOUD_TAG_EXPORT DeleteTagRequest : public RpcServiceRequest {
public:
DeleteTagRequest();
~DeleteTagRequest();
std::string getRegionId() const;
void setRegionId(const std::string ®ionId);
std::string getValue() const;
void setValue(const std::string &value);
std::string getKey() const;
void setKey(const std::string &key);
std::string getResourceOwnerAccount() const;
void setResourceOwnerAccount(const std::string &resourceOwnerAccount);
std::string getOwnerAccount() const;
void setOwnerAccount(const std::string &ownerAccount);
long getOwnerId() const;
void setOwnerId(long ownerId);
private:
std::string regionId_;
std::string value_;
std::string key_;
std::string resourceOwnerAccount_;
std::string ownerAccount_;
long ownerId_;
};
} // namespace Model
} // namespace Tag
} // namespace AlibabaCloud
#endif // !ALIBABACLOUD_TAG_MODEL_DELETETAGREQUEST_H_
| [
"sdk-team@alibabacloud.com"
] | sdk-team@alibabacloud.com |
19ef9dd00fbb033d23792a96d1701c7bd8edb66a | 92ef3ab9f5aa4f8dc7dce5b54aa2ecfe9bb2b79a | /ACM/LG/LG-1880-WA.cpp | 19f92b48b0de0900982fdb0117dea30016a049ae | [] | no_license | Fyy10/ENIAC | 4c845c04d571a888ddd6630fd196a5baab1e3139 | ce034918cb575ec6bb71c07901b66f6f0f8cda7f | refs/heads/master | 2020-03-25T09:53:14.517682 | 2019-08-19T03:24:04 | 2019-08-19T03:24:04 | 143,677,951 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,045 | cpp | #include<stdio.h>
#include<string.h>
int dpmin[101][101];
int dpmax[101][101];
int min(int a,int b){return a<b?a:b;}
int max(int a,int b){return a>b?a:b;}
int main()
{
int n,maxans=0,minans=0x3f;
int a[201],sum[201];
scanf("%d",&n);
sum[0]=0;
for(int i=1;i<=n;i++)
{
scanf("%d",&a[i]);
a[i+n]=a[i];
}
for(int i=1;i<=2*n;i++)
sum[i]=sum[i-1]+a[i];
for(int bias=0;bias<n;bias++)
{
memset(dpmin,0x3f,sizeof(dpmin));
memset(dpmax,0,sizeof(dpmax));
for(int i=1;i<=n;i++)
dpmax[i][i]=dpmin[i][i]=0;
for(int len=2;len<=n;len++)
{
for(int i=1+bias;i<=n-len+1+bias;i++)
{
int j=i+len-1;
for(int k=i;k<j;k++)
{
dpmin[i-bias][j-bias]=min(dpmin[i-bias][j-bias],dpmin[i-bias][k-bias]+dpmin[k+1-bias][j-bias]+sum[j]-sum[i-1]);
dpmax[i-bias][j-bias]=max(dpmax[i-bias][j-bias],dpmax[i-bias][k-bias]+dpmax[k+1-bias][j-bias]+sum[j]-sum[i-1]);
}
}
}
if(dpmin[1][n]<minans)
minans=dpmin[1][n];
if(dpmax[1][n]>maxans)
maxans=dpmax[1][n];
}
printf("%d\n%d",minans,maxans);
return 0;
}
| [
"1093928135@qq.com"
] | 1093928135@qq.com |
95dfde73bead2b397c6742da3212b3b5f4d9cfe4 | 9c7d20467b93a2b37c31dbae13b18ecadf68f94c | /src/qt/addresstablemodel.h | 0cd52ad5962ced70db966b91b8a66fbd487cce4b | [
"MIT"
] | permissive | MistCoinTeam/mistcoin | dfbdd4ad399342782524a165133c1d1114e9045e | e2d440df50af290629bd119c33a8e0671b4b0751 | refs/heads/master | 2016-09-05T15:26:13.646764 | 2014-10-27T12:29:33 | 2014-10-27T12:29:33 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,086 | h | #ifndef ADDRESSTABLEMODEL_H
#define ADDRESSTABLEMODEL_H
#include <QAbstractTableModel>
#include <QStringList>
class AddressTablePriv;
class CWallet;
class WalletModel;
/**
Qt model of the address book in the core. This allows views to access and modify the address book.
*/
class AddressTableModel : public QAbstractTableModel
{
Q_OBJECT
public:
explicit AddressTableModel(CWallet *wallet, WalletModel *parent = 0);
~AddressTableModel();
enum ColumnIndex {
Label = 0, /**< User specified label */
Address = 1 /**< mistcoin address */
};
enum RoleIndex {
TypeRole = Qt::UserRole /**< Type of address (#Send or #Receive) */
};
/** Return status of edit/insert operation */
enum EditStatus {
OK, /**< Everything ok */
NO_CHANGES, /**< No changes were made during edit operation */
INVALID_ADDRESS, /**< Unparseable address */
DUPLICATE_ADDRESS, /**< Address already in address book */
WALLET_UNLOCK_FAILURE, /**< Wallet could not be unlocked to create new receiving address */
KEY_GENERATION_FAILURE /**< Generating a new public key for a receiving address failed */
};
static const QString Send; /**< Specifies send address */
static const QString Receive; /**< Specifies receive address */
/** @name Methods overridden from QAbstractTableModel
@{*/
int rowCount(const QModelIndex &parent) const;
int columnCount(const QModelIndex &parent) const;
QVariant data(const QModelIndex &index, int role) const;
bool setData(const QModelIndex &index, const QVariant &value, int role);
QVariant headerData(int section, Qt::Orientation orientation, int role) const;
QModelIndex index(int row, int column, const QModelIndex &parent) const;
bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex());
Qt::ItemFlags flags(const QModelIndex &index) const;
/*@}*/
/* Add an address to the model.
Returns the added address on success, and an empty string otherwise.
*/
QString addRow(const QString &type, const QString &label, const QString &address);
/* Look up label for address in address book, if not found return empty string.
*/
QString labelForAddress(const QString &address) const;
/* Look up row index of an address in the model.
Return -1 if not found.
*/
int lookupAddress(const QString &address) const;
EditStatus getEditStatus() const { return editStatus; }
private:
WalletModel *walletModel;
CWallet *wallet;
AddressTablePriv *priv;
QStringList columns;
EditStatus editStatus;
/** Notify listeners that data changed. */
void emitDataChanged(int index);
signals:
void defaultAddressChanged(const QString &address);
public slots:
/* Update address list from core.
*/
void updateEntry(const QString &address, const QString &label, bool isMine, int status);
friend class AddressTablePriv;
};
#endif // ADDRESSTABLEMODEL_H
| [
"mistcointeam@gmail.com"
] | mistcointeam@gmail.com |
46eb3f2e849f94d508f814c7f3cdb8eb11092c24 | bd349c39bf95e58e4f5ea63efebd36d62eb5b349 | /include/seastar/coroutine/as_future.hh | de325c09327c9b24c0e93a549a6a35f1cefbf417 | [
"Apache-2.0",
"BSD-3-Clause"
] | permissive | scylladb/seastar | 588bd4ed833837e50e92912282264b631816b6fe | 4f8c225d48565f5df4f034dcb55f5b5d2038c362 | refs/heads/master | 2023-09-05T22:07:13.027241 | 2023-09-05T05:55:54 | 2023-09-05T07:58:00 | 23,061,798 | 7,641 | 1,676 | Apache-2.0 | 2023-09-13T17:56:34 | 2014-08-18T07:01:07 | C++ | UTF-8 | C++ | false | false | 3,621 | hh | /*
* This file is open source software, licensed to you under the terms
* of the Apache License, Version 2.0 (the "License"). See the NOTICE file
* distributed with this work for additional information regarding copyright
* ownership. You may not use this file except in compliance with the License.
*
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/*
* Copyright (C) 2022-present ScyllaDB
*/
#pragma once
#include <seastar/core/coroutine.hh>
namespace seastar {
namespace internal {
template <bool CheckPreempt, typename T>
class [[nodiscard]] as_future_awaiter {
seastar::future<T> _future;
public:
explicit as_future_awaiter(seastar::future<T>&& f) noexcept : _future(std::move(f)) {}
as_future_awaiter(const as_future_awaiter&) = delete;
as_future_awaiter(as_future_awaiter&&) = delete;
bool await_ready() const noexcept {
return _future.available() && (!CheckPreempt || !need_preempt());
}
template<typename U>
void await_suspend(std::coroutine_handle<U> hndl) noexcept {
if (!CheckPreempt || !_future.available()) {
_future.set_coroutine(hndl.promise());
} else {
schedule(&hndl.promise());
}
}
seastar::future<T> await_resume() {
return std::move(_future);
}
};
} // namespace seastar::internal
namespace coroutine {
/// \brief co_await:s a \ref future, returning it as result.
///
/// Similar to \ref seastar::future::then_wrapped, `coroutine::as_future`
/// waits for the \ref future to resolve either to a ready future
/// or to an exceptional one. It then returns it as the co_await result.
///
/// For example:
/// ```
/// static future<bool> did_future_fail(future<> fut) {
/// auto f = co_await coroutine::as_future(std::move(fut));
/// if (f.failed()) {
/// mylog.warn("Future failed: {}", f.get_exception());
/// co_return true;
/// } else {
/// co_return false;
/// }
/// }
/// ```
///
/// Note that by default, `as_future` checks for if the task quota is depleted,
/// which means that it will yield if the future is ready and \ref seastar::need_preempt()
/// returns true. Use \ref coroutine::as_future_without_preemption_check
/// to disable preemption checking.
template<typename T = void>
class [[nodiscard]] as_future : public seastar::internal::as_future_awaiter<true, T> {
public:
explicit as_future(seastar::future<T>&& f) noexcept : seastar::internal::as_future_awaiter<true, T>(std::move(f)) {}
};
/// \brief co_await:s a \ref future, returning it as result, without
/// checking if preemption is needed.
///
/// Like \ref coroutine::as_future, co_await-ing as_future_without_preemption_check
/// returns the input `future` as the co_await result.
/// However, it bypasses checking if the task quota is depleted, which means that
/// a ready `future` will be handled immediately.
template<typename T = void>
class [[nodiscard]] as_future_without_preemption_check : public seastar::internal::as_future_awaiter<false, T> {
public:
explicit as_future_without_preemption_check(seastar::future<T>&& f) noexcept : seastar::internal::as_future_awaiter<false, T>(std::move(f)) {}
};
} // namespace seastar::coroutine
} // namespace seastar
| [
"avi@scylladb.com"
] | avi@scylladb.com |
0dd465a5b9aaa5c6668502296a21e93c177ce0b2 | b3024fd02bd1180a9268e24dbb7519238adf09e9 | /src/cuBERT/op_bert/BertEmbeddings.cpp | 74fa38e3dd4e43305762b6ebf72a1132aa982010 | [
"MIT"
] | permissive | yutaoxxx/cuBERT | 6a6fcf84144b6a5f70284beaca5b69eec1b4ba92 | 6e3d6e6b536a95483cb25d468b22fae264ac7fbd | refs/heads/master | 2022-12-26T02:49:56.922326 | 2020-10-13T06:27:46 | 2020-10-13T06:27:46 | 293,769,014 | 0 | 0 | MIT | 2020-09-08T09:52:41 | 2020-09-08T09:52:40 | null | UTF-8 | C++ | false | false | 3,211 | cpp | #include "cuBERT/common.h"
#include "BertEmbeddings.h"
namespace cuBERT {
const static float ONE = 1.f;
template <typename T>
BertEmbeddings<T>::BertEmbeddings(void* handle,
const std::unordered_map<std::string, T *> &var,
size_t max_batch_size,
size_t vocab_size, size_t type_vocab_size, size_t hidden_size, size_t seq_length) {
this->handle = handle;
this->seq_length = seq_length;
this->hidden_size = hidden_size;
this->algo = gemm_algo<T>("GEMM_ALGO_EMBEDDINGS");
this->word_embeddings = new Embedding<int, T>(vocab_size, hidden_size,
var.at("bert/embeddings/word_embeddings"));
this->token_type_embeddings = new Embedding<int8_t, T>(type_vocab_size, hidden_size,
var.at("bert/embeddings/token_type_embeddings"));
this->layer_norm = new LayerNorm<T>(max_batch_size * seq_length, hidden_size,
var.at("bert/embeddings/LayerNorm/beta"),
var.at("bert/embeddings/LayerNorm/gamma"));
T *full_position_embeddings = var.at("bert/embeddings/position_embeddings");
this->position_embeddings = static_cast<T *>(cuBERT::malloc(sizeof(T) * seq_length * hidden_size));
cuBERT::memcpy(position_embeddings, full_position_embeddings, sizeof(T) * seq_length * hidden_size, 1);
this->ones = static_cast<T *>(cuBERT::malloc(sizeof(T) * max_batch_size));
T one; T2T(&ONE, &one, 1);
cuBERT::fill_n<T>(ones, max_batch_size, one);
this->token_type_embeddings_out = static_cast<T *>(cuBERT::malloc(sizeof(T) * max_batch_size * seq_length * hidden_size));
}
template <typename T>
BertEmbeddings<T>::~BertEmbeddings() {
cuBERT::free(this->token_type_embeddings_out);
cuBERT::free(this->ones);
cuBERT::free(this->position_embeddings);
delete layer_norm;
delete token_type_embeddings;
delete word_embeddings;
}
template <typename T>
void BertEmbeddings<T>::compute(size_t batch_size, int *input_ids_gpu, int8_t *token_type_ids_gpu, T *out_gpu) {
void *stream = cuBERT::blas_get_stream(handle);
word_embeddings->compute(input_ids_gpu, batch_size * seq_length, out_gpu, stream);
token_type_embeddings->compute(token_type_ids_gpu, batch_size * seq_length, token_type_embeddings_out, stream);
cuBERT::blas_gemm(handle, false, false,
seq_length * hidden_size, batch_size, 1,
1.f,
position_embeddings, seq_length * hidden_size,
ones, 1,
1.f,
out_gpu, seq_length * hidden_size,
algo);
layer_norm->compute_(batch_size * seq_length, token_type_embeddings_out, out_gpu, stream);
}
template class BertEmbeddings<float>;
#ifdef HAVE_CUDA
template class BertEmbeddings<half>;
#endif
}
| [
"fanliwen@zhihu.com"
] | fanliwen@zhihu.com |
e6f25cf100d207a19439192358697b576acd71e1 | d9c10d2da7c64e82aa85a6fabe56cdeb8adfe323 | /Tardes02/solutions/d-winnie.cpp | c8f73b369e512549abbe7c8e8d9c95fd6cec68b0 | [] | no_license | soyantonio/glass-battle | 905cc6c1388c82fb2cb7cf8f066b1d2824e47674 | 4d20d79e0fdd6643d3f2ab52ff711fc3fc3d3a70 | refs/heads/master | 2022-12-25T05:20:30.787140 | 2020-10-04T16:06:51 | 2020-10-04T16:06:51 | 296,974,488 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 509 | cpp | #include <fstream>
using namespace std;
int main(){
uint16_t jars, k, weight, piglet = 0;
ifstream finputs("input.txt");
if(finputs.is_open()){
finputs >> jars >> k;
for(uint16_t i = 0; i < jars; ++i){
finputs >> weight;
uint16_t j = 0;
while (true){
if(weight < k || j == 3){
piglet += weight;
break;
}
j++;
weight -= k;
}
}
}
ofstream file("output.txt");
file << piglet;
file.close();
return 0;
} | [
"antonio@almavios.com"
] | antonio@almavios.com |
c8f67ce9ca1023fe23abb80780086fe662c3bbe4 | 305b9d7e4bc8ba731164fb10e53fb1e0a8d53775 | /libspindle/adt/BucketSorter/ArrayBucketSorter.h | 6a7d2a4182f292cab53c6ff3559d817ea4bfab4e | [
"LicenseRef-scancode-other-permissive",
"LicenseRef-scancode-mit-old-style"
] | permissive | skn123/Spindle | 33b2bed84de866bb87e69bbfb2eca06e780b3dcb | d5f2cab92c86c547efbf09fb30be9d478da04332 | refs/heads/master | 2021-05-26T12:50:00.410427 | 2012-11-14T01:23:01 | 2012-11-14T01:23:01 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 9,367 | h | //
// ArrayBucketSorter.h
//
// $Id: ArrayBucketSorter.h,v 1.2 2000/02/18 01:31:44 kumfert Exp $
//
// Gary Kumfert, Old Dominion University
// Copyright(c) 1997, Old Dominion University. All rights reserved.
//
// Permission to use, copy, modify, distribute and sell this software and
// its documentation for any purpose is hereby granted without fee,
// provided that the above copyright notice appear in all copies and
// that both that copyright notice and this permission notice appear
// in supporting documentation. Old Dominion University makes no
// representations about the suitability of this software for any
// purpose. It is provided "as is" without express or implied warranty.
//
//=====================================================================
//
// This bucket sorter can sort `nItemsMax' items into `nBucketsMax' buckets
// using a key which is hashed into the buckets (usually modulo nBucketsMax).
// Each Item must be unique, but the key (obviously) may not.
//
// Each bucket contains a circular doubly linked list. Inserts are made
// at the front or back of each list. The bracket operator `[Key]' returns
// the Item at the top of that bucket, or -1 if the bucket is empty.
//
// Items can be removed from anywhere in the ArrayBucketSorter in O(1). This was
// a design constraint since this object is used in a Multiple Minimum Degree
// code. This is also a reason why the Items must be unique.
//
// The user can query what the original key was, since the key is not
// necessarily equal to the bucket number.
#ifndef SPINDLE_ARRAY_BUCKET_SORTER_H_
#define SPINDLE_ARRAY_BUCKET_SORTER_H_
#ifndef SPINDLE_SYSTEM_H_
#include "spindle/SpindleSystem.h"
#endif
#ifndef SPINDLE_PERSISTANT_H_
#include "spindle/SpindlePersistant.h"
#endif
SPINDLE_BEGIN_NAMESPACE
/**
* @memo sorts 'nItemsMax' items with 'nBucketsMax' unique keys.
* @type class
*
* @author Gary Kumfert
*/
class ArrayBucketSorter : public SpindlePersistant {
SPINDLE_DECLARE_PERSISTANT( ArrayBucketSorter )
protected:
enum{ FLAG = -1 }; // C++ enum hack for a constant flag
/// number of unique keys
int nBucketsMax;
/// number of unique item ID numbers
int nItemsMax;
int isInsertFront;
/// Simple counter of number Items in ArrayBucketSorter
int nInserted;
/// array of heads for each list length==(nBucketsMax)
int *bucket;
/// array of forward pointers length==(nItemsMax)
int *next;
/// array of back pointers length==(nItemsMax)
int *prev;
/// array mapping each vertex in structure to its bucket
int *key;
// length==(nItemsMax)
public:
/**
* default constructor
*/
ArrayBucketSorter();
/**
* constructor
*/
ArrayBucketSorter(const int nBuckets, const int nItems);
/**
* destructor
*/
virtual ~ArrayBucketSorter();
/**
*
*/
virtual void validate();
/**
*
*/
virtual bool isValid() const;
/**
* pretty prints the bucket structure
*/
virtual void dump( FILE * stream ) const;
/**
* pretty prints the bucket structure
*/
void dump() const;
/**
* @return true if there are no more Items to be removed
*/
bool isEmpty() const;
/**
* get the number inserted
*/
int size() const;
/**
* @return the minimum key of a non-empty bucket, -1 if none.
*/
int queryMinBucket() const;
/**
* @return minimum key of next non-empty bucket, -1 if none.
*/
int queryNextBucket(const int Bucket) const;
/**
* @return the first item in the requested bucket,
* -1 if out of range or bucket is empty
*/
int queryFirstItem(const int Bucket) const;
/**
* @return the next item in the same bucket
* -1 if out of range or Item is last in bucket
*/
int queryNextItem(const int Item) const;
/**
* @return prev item in same bucket
* -1 if out of range or Item is first in bucket
*/
int queryPrevItem(const int Item) const;
/**
* @return the key of an item
*/
int queryKey( const int Item );
/**
* @return the bucket an item is in
*/
int queryBucket( const int Item );
/**
* @return the number of items inserted into the bucketsorter
*/
int queryNInserted() const;
/**
* @return true if insert was successful,
* false if item was already in some bucket
*/
bool insert(const int Key, const int Item);
/**
* make all inserts occur to the front of the bucket
*/
void setInsertFront();
/**
* make all inserts occur in the back of a bucket
*/
void setInsertBack();
/**
* @return true if item is found and removed,
* false if item is not found
*/
bool remove(const int Item);
/**
* resets the ArrayBucketSorter to its initial (empty) state
*/
bool reset();
/**
* print out complete internal state
*/
void printDebug(FILE * fp) const;
/**
* print out complete internal state
*/
void printDebug() const;
protected:
/**
* insert 'Item' with 'Key' into the front of bucket 'bucketID'
* all arguments are assumed in range
* @return true if insert succeeds, false otherwise
*/
bool insertFront(const int Key, const int Item, const int bucketID);
/**
* insert 'Item' with 'Key' into the back of bucket 'bucketID'
* all arguments are assumed in range
* @return true if insert succeeds, false otherwise
*/
bool insertBack(const int Key, const int Item, const int bucketID);
/**
* remove an 'Item' (assumed to be in range)
* @return true if insert succeeds, false otherwise
*/
bool removeItem(const int Item);
/**
* @return next item if it exists, -1 otherwise
*/
int nextItem(const int Item) const;
/**
* @return next item if it exists, -1 otherwise
*/
int prevItem(const int Item) const;
};
inline ArrayBucketSorter::ArrayBucketSorter()
: nBucketsMax(0), nItemsMax(0){
currentState = EMPTY;
}
inline ArrayBucketSorter::ArrayBucketSorter(const int nBucketsMax_, const int nItems)
: nBucketsMax(nBucketsMax_), nItemsMax(nItems) {
incrementInstanceCount( ArrayBucketSorter::MetaData );
bucket = new int[nBucketsMax];
next = new int[nItemsMax];
prev = new int[nItemsMax];
key = new int[nItemsMax];
reset();
}
inline bool
ArrayBucketSorter::isValid() const {
return (currentState == VALID);
}
inline void
ArrayBucketSorter::setInsertFront() {
isInsertFront = true;
}
inline void
ArrayBucketSorter::setInsertBack() {
isInsertFront = false;
}
inline bool
ArrayBucketSorter::insert(const int Key, const int Item) {
if ((Item < 0) || (Item >= nItemsMax)) { return false; } // out of range
if ( key[Item] != FLAG ) { return false; } // already inserted
int bucketID = ( Key < nBucketsMax ) ? Key : Key % nBucketsMax ;
bool insertSucceeded = (isInsertFront) ? insertFront(Key,Item,bucketID) : insertBack(Key,Item,bucketID);
if (insertSucceeded) { ++nInserted; }
return insertSucceeded;
}
// returns true if item is found and removed, false if item is not found
inline bool
ArrayBucketSorter::remove(const int Item){
bool removeSucceeded = ((Item < 0) || (Item >= nItemsMax)) ? false : removeItem(Item);
if (removeSucceeded) { --nInserted; }
return removeSucceeded;
}
inline bool
ArrayBucketSorter::isEmpty() const {
return (nInserted == 0);
}
inline int
ArrayBucketSorter::queryKey( const int Item ) {
if ( (Item<0) || (Item>nItemsMax) ) {
return FLAG;
} else {
return key[Item];
}
}
inline int
ArrayBucketSorter::queryBucket( const int Item ) {
if ( (Item<0) || (Item>nItemsMax) ) {
return FLAG;
} else {
return key[Item] % nBucketsMax ;
}
}
inline int
ArrayBucketSorter::queryNInserted() const {
return nInserted;
}
inline int
ArrayBucketSorter::queryMinBucket() const {
if (isEmpty()) return FLAG;
int i=0;
while ((i<nBucketsMax) && (bucket[i] == FLAG)) ++i;
return ( i == nBucketsMax ) ? FLAG : i;
}
// returns the minimum non-empty bucket, -1 if empty
#define __FUNC__ "Array ArrayBucketSorter::queryNextBucket(const int Bucket) const"
inline int
ArrayBucketSorter::queryNextBucket(const int Bucket) const {
FENTER;
if (isEmpty()) FRETURN( FLAG );
ASSERT( Bucket>=0 , "Requested Bucket %d is invalid, must be positive", Bucket );
ASSERT( Bucket<nBucketsMax, "Requested Bucket %d is invalid, number of Buckets=%d", Bucket,nBucketsMax);
int i=Bucket;
while ((i<nBucketsMax) && (bucket[i] == FLAG)) ++i;
FRETURN( ( i == nBucketsMax ) ? FLAG : i );
}
#undef __FUNC__
inline int
ArrayBucketSorter::queryFirstItem(const int Key) const {
return ( (Key >= 0) && ( Key < nBucketsMax) ) ? bucket[Key] : FLAG ;
}
inline int
ArrayBucketSorter::queryNextItem(const int Item) const {
return ((Item<0) || (Item>=nItemsMax)) ? FLAG : nextItem(Item) ;
}
inline int
ArrayBucketSorter::queryPrevItem(const int Item) const {
return ((Item<0) || (Item>=nItemsMax)) ? FLAG : prevItem(Item) ;
}
inline void
ArrayBucketSorter::dump() const{
dump( stdout );
}
inline int
ArrayBucketSorter::size() const {
return nInserted;
}
inline void
ArrayBucketSorter::printDebug() const {
printDebug( stdout );
}
SPINDLE_END_NAMESPACE
#endif
| [
"gary@quiphon.com"
] | gary@quiphon.com |
326ff4cf92f6b00b9b03595b0fbe84011422fa0e | bb6ebff7a7f6140903d37905c350954ff6599091 | /chrome/browser/guest_view/guest_view_constants.h | a32d0397a2b5f81f69bae56d3b51533bad988d13 | [
"BSD-3-Clause"
] | permissive | PDi-Communication-Systems-Inc/lollipop_external_chromium_org | faa6602bd6bfd9b9b6277ce3cd16df0bd26e7f2f | ccadf4e63dd34be157281f53fe213d09a8c66d2c | refs/heads/master | 2022-12-23T18:07:04.568931 | 2016-04-11T16:03:36 | 2016-04-11T16:03:36 | 53,677,925 | 0 | 1 | BSD-3-Clause | 2022-12-09T23:46:46 | 2016-03-11T15:49:07 | C++ | UTF-8 | C++ | false | false | 793 | h | // Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Constants used for the WebView API.
#ifndef CHROME_BROWSER_GUEST_VIEW_GUEST_VIEW_CONSTANTS_H_
#define CHROME_BROWSER_GUEST_VIEW_GUEST_VIEW_CONSTANTS_H_
namespace guestview {
// Parameters/properties on events.
extern const char kIsTopLevel[];
extern const char kReason[];
extern const char kUrl[];
extern const char kUserGesture[];
// Initialization parameters.
extern const char kParameterApi[];
extern const char kParameterInstanceId[];
// Other.
extern const char kGuestViewManagerKeyName[];
extern const int kInstanceIDNone;
} // namespace guestview
#endif // CHROME_BROWSER_GUEST_VIEW_GUEST_VIEW_CONSTANTS_H_
| [
"mrobbeloth@pdiarm.com"
] | mrobbeloth@pdiarm.com |
4f4c980160c716126f2de9b90eea282be1b7f14f | d1aa6e7d5631d7806531660febbd1f856eaeece7 | /paddle/fluid/inference/tensorrt/plugin_arg_mapping_context.h | 1a483626dcea3e90fae7e6b4f16b5e39288e698f | [
"Apache-2.0"
] | permissive | gongweibao/Paddle | 510cd4bc0ef89bc6ccee7b6b8eca52c00e014b77 | 60f9c60cd8196c66c391d79c35d341e9072f8838 | refs/heads/develop | 2023-03-13T17:43:35.675875 | 2022-09-20T08:46:15 | 2022-09-20T08:46:15 | 82,279,237 | 3 | 2 | Apache-2.0 | 2021-05-26T06:17:43 | 2017-02-17T09:16:16 | Python | UTF-8 | C++ | false | false | 2,045 | h | // Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#pragma once
#include <string>
#include "paddle/fluid/framework/op_desc.h"
#include "paddle/phi/core/compat/arg_map_context.h"
namespace paddle {
namespace inference {
namespace tensorrt {
class PluginArgumentMappingContext : public ::phi::ArgumentMappingContext {
public:
explicit PluginArgumentMappingContext(framework::OpDesc* op_desc_ptr)
: op_desc_ptr_(op_desc_ptr) {}
bool HasInput(const std::string& name) const override;
bool HasOutput(const std::string& name) const override;
bool HasAttr(const std::string& name) const override;
paddle::any Attr(const std::string& attr_name) const override;
size_t InputSize(const std::string& name) const override;
size_t OutputSize(const std::string& name) const override;
bool IsDenseTensorInput(const std::string& name) const override;
bool IsDenseTensorInputs(const std::string& name) const override;
bool IsSelectedRowsInput(const std::string& name) const override;
bool IsSelectedRowsInputs(const std::string& name) const override;
bool IsDenseTensorVectorInput(const std::string& name) const override;
bool IsDenseTensorOutput(const std::string& name) const override;
bool IsSelectedRowsOutput(const std::string& name) const override;
bool IsForInferShape() const override { return false; }
private:
framework::OpDesc* op_desc_ptr_;
};
} // namespace tensorrt
} // namespace inference
} // namespace paddle
| [
"noreply@github.com"
] | noreply@github.com |
2fe73142d569aa15db7bd5cb47eeffe1746d2ac4 | 14635b76a0ca31e41cd2389e16888eaac70d46fd | /src/play_audio_speex/src/play_audio_speex.cpp | 22688ed6b84780f89e0cff462f1a554624211075 | [] | no_license | Kalmend/thesis | 1801f5eee041dcb8b096db1b51f61496e63b4d7a | 6871cd5561558d1620868dcda6ea06ec44e63087 | refs/heads/master | 2020-03-17T11:51:34.687318 | 2018-05-15T19:44:31 | 2018-05-15T19:44:31 | 133,566,390 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 5,208 | cpp | #include <gst/gst.h>
#include <gst/app/gstappsrc.h>
#include <ros/ros.h>
#include <signal.h>
#include <boost/thread.hpp>
#include "audio_common_msgs/AudioData.h"
#include "capture_vad_speex/GetSinkCapabilities.h"
using namespace std;
class SpeechRecognitionSimple
{
public:
SpeechRecognitionSimple()
{
parseArguments();
sub_ = nh_.subscribe("audio", 10, &SpeechRecognitionSimple::onAudio, this);
loop_ = g_main_loop_new(NULL, false);
setupPipeline();
gst_element_set_state(GST_ELEMENT(pipeline_), GST_STATE_PLAYING);
gst_thread_ = boost::thread( boost::bind(g_main_loop_run, loop_) );
paused_ = false;
}
~SpeechRecognitionSimple()
{
g_main_loop_quit(loop_);
gst_element_set_state(pipeline_, GST_STATE_NULL);
gst_object_unref(pipeline_);
g_main_loop_unref(loop_);
}
private:
static void onNeedData (GstElement *appsrc,
guint unused_size,
gpointer user_data)
{
ROS_WARN("need-data signal emitted! Pausing the pipeline");
SpeechRecognitionSimple *client = reinterpret_cast<SpeechRecognitionSimple*>(user_data);
gst_element_set_state(GST_ELEMENT(client->pipeline_), GST_STATE_PAUSED);
client->paused_ = true;
}
void onAudio(const audio_common_msgs::AudioDataConstPtr &msg)
{
if(paused_)
{
ROS_INFO("Got first audio after pause, resuming.");
gst_element_set_state(GST_ELEMENT(pipeline_), GST_STATE_PLAYING);
paused_ = false;
}
GstBuffer *buffer = gst_buffer_new_and_alloc(msg->data.size());
gst_buffer_fill(buffer, 0, &msg->data[0], msg->data.size());
GstFlowReturn ret = gst_app_src_push_buffer(GST_APP_SRC(source_),buffer);
}
static gboolean onBusMessage(GstBus* bus, GstMessage* msg, gpointer userData)
{
SpeechRecognitionSimple *server = reinterpret_cast<SpeechRecognitionSimple*>(userData);
switch (GST_MESSAGE_TYPE(msg))
{
case GST_MESSAGE_EOS:
{
ROS_INFO("End-of-stream");
}
case GST_MESSAGE_ERROR:
{
gchar* debug;
GError* err;
gst_message_parse_error(msg, &err, &debug);
g_free(debug);
ROS_ERROR("ERROR: %s", err->message);
g_error_free(err);
server->exitOnMainThread(err->code);
break;
}
default:
break;
}
return true;
}
void exitOnMainThread(int code)
{
exit(code);
}
void parseArguments()
{
ros::param::param<string>("~dst", destination_type_, "alsasink");
ros::param::param<bool>("~enh", perceptual_enhancement_, false);
ROS_INFO("Perceptual enhancement: %d.", perceptual_enhancement_);
}
GstCaps* getSinkCapabilities()
{
serviceClient_ = nh_.serviceClient<capture_vad_speex::GetSinkCapabilities>("/capture_vad_speex/get_sink_capabilities");
serviceClient_.waitForExistence();
capture_vad_speex::GetSinkCapabilitiesRequest req;
capture_vad_speex::GetSinkCapabilitiesResponse resp;
if(!serviceClient_.call(req, resp))
{
ROS_ERROR("Failed GetSinkCapabilities call!");
exitOnMainThread(-1);
}
ROS_INFO("Got caps for appsrc!");
return gst_caps_from_string(resp.capabilties.c_str());
}
void setupPipeline()
{
pipeline_ = gst_pipeline_new("app_pipeline");
source_ = gst_element_factory_make("appsrc", "app_source");
g_object_set (G_OBJECT (source_),
"stream-type", 0,
"format", GST_FORMAT_TIME, NULL);
gst_bin_add( GST_BIN(pipeline_), source_);
g_signal_connect(source_, "need-data", G_CALLBACK(onNeedData),this);
if (destination_type_ == "alsasink")
{
//tell appsrc speexenc capabilities
GstCaps* caps = getSinkCapabilities();
gst_app_src_set_caps(GST_APP_SRC(source_),caps);
gst_caps_unref(caps);
decoder_ = gst_element_factory_make("speexdec", "speex_decoder");
g_object_set( G_OBJECT(decoder_), "enh", perceptual_enhancement_, NULL);
convert_ = gst_element_factory_make("audioconvert", "convert");
sink_ = gst_element_factory_make("autoaudiosink", "sink");
gst_bin_add_many(GST_BIN(pipeline_), decoder_, convert_, sink_, NULL);
if(!gst_element_link_many(source_, decoder_, convert_, sink_, NULL))
{
ROS_ERROR("Failed to link pipeline");
exitOnMainThread(-1);
}
} else {
sink_ = gst_element_factory_make("filesink", "sink");
g_object_set( G_OBJECT(sink_), "location", destination_type_.c_str(), NULL);
gst_bin_add(GST_BIN(pipeline_), sink_);
gst_element_link(source_, sink_);
}
GstBus* bus = gst_pipeline_get_bus(GST_PIPELINE(pipeline_));
gst_bus_add_watch(bus, onBusMessage, this);
gst_object_unref(bus);
}
//arguments
string destination_type_;
bool perceptual_enhancement_;
//ROS stuff
ros::NodeHandle nh_;
ros::Subscriber sub_;
ros::ServiceClient serviceClient_;
//pipeline elements
GstElement *pipeline_, *source_, *sink_, *decoder_, *resample_, *convert_;
boost::thread gst_thread_;
GMainLoop *loop_;
bool paused_;
};
void SigIntHandler(int sig)
{
// Do some custom action.
// For example, publish a stop message to some other nodes.
// All the default sigint handler does is call shutdown()
ROS_INFO("play_audio_speex sigint handler");
ros::shutdown();
}
int main (int argc, char **argv)
{
ros::init(argc, argv, "play_audio_speex", ros::init_options::NoSigintHandler);
gst_init(&argc, &argv);
SpeechRecognitionSimple client;
ros::spin();
return 0;
}
| [
"kalmendoliver@gmail.com"
] | kalmendoliver@gmail.com |
843c2ad14f15842b48c5598e0760fe40e60255f5 | ceac59f034f560602da63f8f93eff80476ce4d37 | /third_party/asio/include/asio/detail/winrt_async_manager.hpp | 8334d149c981b091ae650aca0dd3150e1f102831 | [
"BSL-1.0"
] | permissive | ludocosmo/wrtc-client | ade5e183db3ed0d5f86e79f06fe54cb7dad9ff4d | 0efa2c6c79b865c9128b0eecf85ec133862b8cf6 | refs/heads/master | 2021-05-05T14:11:03.523903 | 2018-01-22T02:30:11 | 2018-01-22T02:30:11 | 118,438,078 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 8,658 | hpp | //
// detail/winrt_async_manager.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2016 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//
#ifndef ASIO_DETAIL_WINRT_ASYNC_MANAGER_HPP
#define ASIO_DETAIL_WINRT_ASYNC_MANAGER_HPP
#if defined(_MSC_VER) && (_MSC_VER >= 1200)
# pragma once
#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
#include "asio/detail/config.hpp"
#if defined(ASIO_WINDOWS_RUNTIME)
#include <future>
#include "asio/detail/atomic_count.hpp"
#include "asio/detail/winrt_async_op.hpp"
#include "asio/error.hpp"
#include "asio/io_context.hpp"
#include "asio/detail/push_options.hpp"
namespace asio {
namespace detail {
class winrt_async_manager
: public asio::detail::service_base<winrt_async_manager>
{
public:
// Constructor.
winrt_async_manager(asio::io_context& io_context)
: asio::detail::service_base<winrt_async_manager>(io_context),
io_context_(use_service<io_context_impl>(io_context)),
outstanding_ops_(1)
{
}
// Destructor.
~winrt_async_manager()
{
}
// Destroy all user-defined handler objects owned by the service.
void shutdown()
{
if (--outstanding_ops_ > 0)
{
// Block until last operation is complete.
std::future<void> f = promise_.get_future();
f.wait();
}
}
void sync(Windows::Foundation::IAsyncAction^ action,
asio::error_code& ec)
{
using namespace Windows::Foundation;
using Windows::Foundation::AsyncStatus;
auto promise = std::make_shared<std::promise<asio::error_code>>();
auto future = promise->get_future();
action->Completed = ref new AsyncActionCompletedHandler(
[promise](IAsyncAction^ action, AsyncStatus status)
{
switch (status)
{
case AsyncStatus::Canceled:
promise->set_value(asio::error::operation_aborted);
break;
case AsyncStatus::Error:
case AsyncStatus::Completed:
default:
asio::error_code ec(
action->ErrorCode.Value,
asio::system_category());
promise->set_value(ec);
break;
}
});
ec = future.get();
}
template <typename TResult>
TResult sync(Windows::Foundation::IAsyncOperation<TResult>^ operation,
asio::error_code& ec)
{
using namespace Windows::Foundation;
using Windows::Foundation::AsyncStatus;
auto promise = std::make_shared<std::promise<asio::error_code>>();
auto future = promise->get_future();
operation->Completed = ref new AsyncOperationCompletedHandler<TResult>(
[promise](IAsyncOperation<TResult>^ operation, AsyncStatus status)
{
switch (status)
{
case AsyncStatus::Canceled:
promise->set_value(asio::error::operation_aborted);
break;
case AsyncStatus::Error:
case AsyncStatus::Completed:
default:
asio::error_code ec(
operation->ErrorCode.Value,
asio::system_category());
promise->set_value(ec);
break;
}
});
ec = future.get();
return operation->GetResults();
}
template <typename TResult, typename TProgress>
TResult sync(
Windows::Foundation::IAsyncOperationWithProgress<
TResult, TProgress>^ operation,
asio::error_code& ec)
{
using namespace Windows::Foundation;
using Windows::Foundation::AsyncStatus;
auto promise = std::make_shared<std::promise<asio::error_code>>();
auto future = promise->get_future();
operation->Completed
= ref new AsyncOperationWithProgressCompletedHandler<TResult, TProgress>(
[promise](IAsyncOperationWithProgress<TResult, TProgress>^ operation,
AsyncStatus status)
{
switch (status)
{
case AsyncStatus::Canceled:
promise->set_value(asio::error::operation_aborted);
break;
case AsyncStatus::Started:
break;
case AsyncStatus::Error:
case AsyncStatus::Completed:
default:
asio::error_code ec(
operation->ErrorCode.Value,
asio::system_category());
promise->set_value(ec);
break;
}
});
ec = future.get();
return operation->GetResults();
}
void async(Windows::Foundation::IAsyncAction^ action,
winrt_async_op<void>* handler)
{
using namespace Windows::Foundation;
using Windows::Foundation::AsyncStatus;
auto on_completed = ref new AsyncActionCompletedHandler(
[this, handler](IAsyncAction^ action, AsyncStatus status)
{
switch (status)
{
case AsyncStatus::Canceled:
handler->ec_ = asio::error::operation_aborted;
break;
case AsyncStatus::Started:
return;
case AsyncStatus::Completed:
case AsyncStatus::Error:
default:
handler->ec_ = asio::error_code(
action->ErrorCode.Value,
asio::system_category());
break;
}
io_context_.post_deferred_completion(handler);
if (--outstanding_ops_ == 0)
promise_.set_value();
});
io_context_.work_started();
++outstanding_ops_;
action->Completed = on_completed;
}
template <typename TResult>
void async(Windows::Foundation::IAsyncOperation<TResult>^ operation,
winrt_async_op<TResult>* handler)
{
using namespace Windows::Foundation;
using Windows::Foundation::AsyncStatus;
auto on_completed = ref new AsyncOperationCompletedHandler<TResult>(
[this, handler](IAsyncOperation<TResult>^ operation, AsyncStatus status)
{
switch (status)
{
case AsyncStatus::Canceled:
handler->ec_ = asio::error::operation_aborted;
break;
case AsyncStatus::Started:
return;
case AsyncStatus::Completed:
handler->result_ = operation->GetResults();
// Fall through.
case AsyncStatus::Error:
default:
handler->ec_ = asio::error_code(
operation->ErrorCode.Value,
asio::system_category());
break;
}
io_context_.post_deferred_completion(handler);
if (--outstanding_ops_ == 0)
promise_.set_value();
});
io_context_.work_started();
++outstanding_ops_;
operation->Completed = on_completed;
}
template <typename TResult, typename TProgress>
void async(
Windows::Foundation::IAsyncOperationWithProgress<
TResult, TProgress>^ operation,
winrt_async_op<TResult>* handler)
{
using namespace Windows::Foundation;
using Windows::Foundation::AsyncStatus;
auto on_completed
= ref new AsyncOperationWithProgressCompletedHandler<TResult, TProgress>(
[this, handler](IAsyncOperationWithProgress<
TResult, TProgress>^ operation, AsyncStatus status)
{
switch (status)
{
case AsyncStatus::Canceled:
handler->ec_ = asio::error::operation_aborted;
break;
case AsyncStatus::Started:
return;
case AsyncStatus::Completed:
handler->result_ = operation->GetResults();
// Fall through.
case AsyncStatus::Error:
default:
handler->ec_ = asio::error_code(
operation->ErrorCode.Value,
asio::system_category());
break;
}
io_context_.post_deferred_completion(handler);
if (--outstanding_ops_ == 0)
promise_.set_value();
});
io_context_.work_started();
++outstanding_ops_;
operation->Completed = on_completed;
}
private:
// The io_context implementation used to post completed handlers.
io_context_impl& io_context_;
// Count of outstanding operations.
atomic_count outstanding_ops_;
// Used to keep wait for outstanding operations to complete.
std::promise<void> promise_;
};
} // namespace detail
} // namespace asio
#include "asio/detail/pop_options.hpp"
#endif // defined(ASIO_WINDOWS_RUNTIME)
#endif // ASIO_DETAIL_WINRT_ASYNC_MANAGER_HPP
| [
"ludovic.roux@cosmosoftware.io"
] | ludovic.roux@cosmosoftware.io |
0d7058b657fd9334065cd71fc6e4c139caa8afff | 403c072db5a50dfe1e1f5599f612bb10708a7794 | /Codigo/src/Obj.h | d25b6e6a40b792a8640b5716053bf9151d9228cb | [] | no_license | fuhranku/ProyectoIII_Grafica | 71a6ec4ed94e7c40105feff90151b22944075e97 | 08881fae18aabe133bd5ecc3b438a59ddad163fb | refs/heads/master | 2020-04-20T01:00:35.968726 | 2019-01-31T15:31:16 | 2019-01-31T15:31:16 | 168,533,932 | 1 | 0 | null | 2019-02-27T07:01:38 | 2019-01-31T13:58:18 | C | UTF-8 | C++ | false | false | 232 | h |
#include "Model.h"
#include <iostream>
#include <fstream>
using std::fstream;
using namespace std;
class CObj : public CModel
{
public:
CObj();
~CObj();
bool load(string path);
private:
bool checkValidToken(string token);
};
| [
"frankponte95@gmail.com"
] | frankponte95@gmail.com |
dfa084382e0343cbbc4c51e128928be44ab33a5b | b6e8052dc3beaf389aeba24c83a36a8b1c21bd8f | /sake/core/introspection/private/builtin_has_operator_minus.hpp | baf2623cfafffa44239961aebc0a65eb0126e885 | [
"BSL-1.0"
] | permissive | jhellrung/sake | dbc0bab1580ca4e47d32284015e086eb7711d9b6 | 96b82fa747388477a55ac142369000519e5a4771 | refs/heads/master | 2021-01-20T10:06:10.354701 | 2012-09-09T06:21:22 | 2012-09-09T06:21:22 | 2,326,641 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,683 | hpp | /*******************************************************************************
* sake/core/introspection/private/builtin_has_operator_minus.hpp
*
* Copyright 2012, Jeffrey Hellrung.
* Distributed under the Boost Software License, Version 1.0. (See accompanying
* file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
******************************************************************************/
#ifndef SAKE_CORE_INTROSPECTION_PRIVATE_BUILTIN_HAS_OPERATOR_MINUS_HPP
#define SAKE_CORE_INTROSPECTION_PRIVATE_BUILTIN_HAS_OPERATOR_MINUS_HPP
#include <cstddef>
#include <boost/mpl/apply.hpp>
#include <boost/type_traits/integral_constant.hpp>
#include <boost/type_traits/is_object.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/type_traits/remove_cv.hpp>
#include <sake/boost_ext/mpl/and.hpp>
#include <sake/boost_ext/type_traits/is_integral_or_enum.hpp>
#include <sake/boost_ext/type_traits/is_convertible.hpp>
#include <sake/boost_ext/type_traits/remove_qualifiers.hpp>
#include <sake/core/introspection/private/builtin_has_operator_arithmetic.hpp>
#include <boost/static_assert.hpp>
#include <boost/type_traits/is_same.hpp>
#include <sake/boost_ext/mpl/curry_quote.hpp>
#include <sake/core/expr_traits/apply.hpp>
#include <sake/core/utility/declval.hpp>
namespace sake
{
namespace introspection_private
{
template< class T, class U, class Result, class ResultPred >
struct builtin_has_operator_minus_dispatch
: builtin_has_operator_arithmetic_impl< T, U, Result, ResultPred >
{ };
template< class T, class U, class Result, class ResultPred >
struct builtin_has_operator_minus_dispatch< T*, U, Result, ResultPred >
: boost_ext::mpl::and4<
boost::is_object<T>,
boost_ext::is_integral_or_enum<U>,
boost_ext::is_convertible< T*, Result >,
boost::mpl::apply1< ResultPred, T* >
>
{ };
template< class T, class U, class Result, class ResultPred >
struct builtin_has_operator_minus_dispatch< T, U*, Result, ResultPred >
: boost::false_type
{ };
template< class T, class U, class Result, class ResultPred >
struct builtin_has_operator_minus_dispatch< T*, U*, Result, ResultPred >
: boost_ext::mpl::and4<
boost::is_same<
typename boost::remove_cv<T>::type,
typename boost::remove_cv<U>::type
>,
boost::is_object<T>,
boost_ext::is_convertible< std::ptrdiff_t, Result >,
boost::mpl::apply1< ResultPred, std::ptrdiff_t >
>
{ };
template< class T, class U, class Result, class ResultPred >
struct builtin_has_operator_minus
: builtin_has_operator_minus_dispatch<
typename boost_ext::remove_qualifiers<T>::type,
typename boost_ext::remove_qualifiers<U>::type,
Result,
ResultPred
>
{ };
namespace
{
#define test( T, U ) \
BOOST_STATIC_ASSERT( SAKE_EXPR_APPLY( \
boost_ext::mpl::curry_quote2< boost::is_same >::apply< T* >::type, \
sake::declval< T* >() - sake::declval<U>() \
) );
test( int*, bool )
test( int*, int )
test( int*, unsigned int )
test( int const *, bool )
test( int const *, int )
test( int const *, unsigned int )
#undef test
#define test( T, U ) \
BOOST_STATIC_ASSERT( SAKE_EXPR_APPLY( \
boost_ext::mpl::curry_quote2< boost::is_same >::apply< std::ptrdiff_t >::type, \
sake::declval< T* >() - sake::declval< U* >() \
) );
test( int, int )
test( int, int const )
test( int const, int )
test( int const, int const )
#undef test
} // namespace
} // namespace introspection_private
} // namespace sake
#endif // #ifndef SAKE_CORE_INTROSPECTION_PRIVATE_BUILTIN_HAS_OPERATOR_MINUS_HPP
| [
"jeffrey.hellrung@gmail.com"
] | jeffrey.hellrung@gmail.com |
7862e1380fac25c36a7d42522cb25fb33b3a5705 | b24b4c5d15818ba85e64245d9108f30266ad3f67 | /main.cpp | 9e284ae20e6aed82c0d0b6ffbdbbdb4d4cc2bd99 | [] | no_license | demon314159/eyeball | 5496717b27f57ae8f5611a23b13b3d2523cb62e7 | ba0bf67cdf0090ce548cf26a2dd6117687b78b82 | refs/heads/master | 2022-12-01T21:28:31.569070 | 2020-08-22T17:36:53 | 2020-08-22T17:36:53 | 287,838,728 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 182 | cpp | #include "eyeball.h"
#include <QApplication>
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
Eyeball eyeball;
eyeball.show();
return app.exec();
}
| [
"demon314159@gmail.com"
] | demon314159@gmail.com |
f3e6e88507c3e75df627f41738767a3bccd92a73 | 6b90d9f8762f9f44a23b1dd6a93bb528f015abab | /libqnapi/src/subconvert/subtitleconverter.h | 71879b3c370ab6a8b3e4a9fc93db110fa0f84677 | [] | no_license | psokol/qnapi | e61956c76f84b8a7ffcd41d88efcc837dc87aec8 | 73ac207ca2b4975b0417508c12d6d31f7734cc47 | refs/heads/master | 2021-01-18T17:25:56.369622 | 2017-03-31T17:05:19 | 2017-03-31T17:05:19 | 86,797,681 | 1 | 0 | null | 2017-03-31T08:41:27 | 2017-03-31T08:41:27 | null | UTF-8 | C++ | false | false | 2,262 | h | /*****************************************************************************
** QNapi
** Copyright (C) 2008-2015 Piotr Krzemiński <pio.krzeminski@gmail.com>
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
*****************************************************************************/
#ifndef SUBTITLECONVERTER_H
#define SUBTITLECONVERTER_H
#include "movieinfo/movieinfoprovider.h"
#include <QString>
#include <QStringList>
#include <functional>
#include <QSharedPointer>
class SubtitleConverter
{
public:
SubtitleConverter(QSharedPointer<const MovieInfoProvider> movieInfoProvider);
QString detectFormat(const QString &subtitleFile);
QString detectFormat(const QStringList &subtitleLines);
bool convertSubtitles(QString subtitleFile,
QString targetFormatName,
QString targetFileName,
double movieFPS,
double fpsRatio,
double delayOffset);
bool convertSubtitles(QString subtitleFile,
QString targetFormatName,
QString targetFileName,
QString movieFile);
bool convertSubtitles(QString subtitleFile,
QString targetFormatName,
QString targetFileName,
std::function<double ()> determineFPS,
double fpsRatio = 1.0,
double delayOffset = 0.0);
private:
QSharedPointer<const MovieInfoProvider> movieInfoProvider;
long ts2frame(long ts, double frameRate);
long frame2ts(long frame, double frameRate);
QStringList readFile(const QString & filename, QString encoding, long atMostLines = 0);
bool writeFile(const QString & filename, QString encoding, const QStringList & lines);
};
#endif // SUBTITLECONVERTER_H
| [
"pio.krzeminski@gmail.com"
] | pio.krzeminski@gmail.com |
87dc1cdafb8e0709d1803c18b84980a973a39e91 | 452be58b4c62e6522724740cac332ed0fe446bb8 | /src/base/memory/shared_memory_handle.h | 832982939577e2451aeb1902871e7e33b230d9d7 | [] | no_license | blockspacer/cobalt-clone-cab7770533804d582eaa66c713a1582f361182d3 | b6e802f4182adbf6a7451a5d48dc4e158b395107 | 0b72f93b07285f3af3c8452ae2ceaf5860ca7c72 | refs/heads/master | 2020-08-18T11:32:21.458963 | 2019-10-17T13:09:35 | 2019-10-17T13:09:35 | 215,783,613 | 1 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 9,738 | h | // Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef BASE_MEMORY_SHARED_MEMORY_HANDLE_H_
#define BASE_MEMORY_SHARED_MEMORY_HANDLE_H_
// Starboard doesn't curretly support multiple processes or shared memory.
#if !defined(STARBOARD)
#include "base/unguessable_token.h"
#include "build/build_config.h"
#if defined(OS_WIN)
#include "base/process/process_handle.h"
#include "base/win/windows_types.h"
#elif defined(OS_MACOSX) && !defined(OS_IOS)
#include <mach/mach.h>
#include "base/base_export.h"
#include "base/file_descriptor_posix.h"
#include "base/macros.h"
#include "base/process/process_handle.h"
#elif defined(OS_POSIX)
#include <sys/types.h>
#include "base/file_descriptor_posix.h"
#elif defined(OS_FUCHSIA)
#include <zircon/types.h>
#include "starboard/types.h"
#endif
namespace base {
// SharedMemoryHandle is the smallest possible IPC-transportable "reference" to
// a shared memory OS resource. A "reference" can be consumed exactly once [by
// base::SharedMemory] to map the shared memory OS resource into the virtual
// address space of the current process.
// TODO(erikchen): This class should have strong ownership semantics to prevent
// leaks of the underlying OS resource. https://crbug.com/640840.
class BASE_EXPORT SharedMemoryHandle {
public:
// The default constructor returns an invalid SharedMemoryHandle.
SharedMemoryHandle();
// Standard copy constructor. The new instance shares the underlying OS
// primitives.
SharedMemoryHandle(const SharedMemoryHandle& handle);
// Standard assignment operator. The updated instance shares the underlying
// OS primitives.
SharedMemoryHandle& operator=(const SharedMemoryHandle& handle);
// Closes the underlying OS resource.
// The fact that this method needs to be "const" is an artifact of the
// original interface for base::SharedMemory::CloseHandle.
// TODO(erikchen): This doesn't clear the underlying reference, which seems
// like a bug, but is how this class has always worked. Fix this:
// https://crbug.com/716072.
void Close() const;
// Whether ownership of the underlying OS resource is implicitly passed to
// the IPC subsystem during serialization.
void SetOwnershipPassesToIPC(bool ownership_passes);
bool OwnershipPassesToIPC() const;
// Whether the underlying OS resource is valid.
bool IsValid() const;
// Duplicates the underlying OS resource. Using the return value as a
// parameter to an IPC message will cause the IPC subsystem to consume the OS
// resource.
SharedMemoryHandle Duplicate() const;
// Uniques identifies the shared memory region that the underlying OS resource
// points to. Multiple SharedMemoryHandles that point to the same shared
// memory region will have the same GUID. Preserved across IPC.
base::UnguessableToken GetGUID() const;
// Returns the size of the memory region that SharedMemoryHandle points to.
size_t GetSize() const;
#if defined(OS_WIN)
// Takes implicit ownership of |h|.
// |guid| uniquely identifies the shared memory region pointed to by the
// underlying OS resource. If the HANDLE is associated with another
// SharedMemoryHandle, the caller must pass the |guid| of that
// SharedMemoryHandle. Otherwise, the caller should generate a new
// UnguessableToken.
// Passing the wrong |size| has no immediate consequence, but may cause errors
// when trying to map the SharedMemoryHandle at a later point in time.
SharedMemoryHandle(HANDLE h, size_t size, const base::UnguessableToken& guid);
HANDLE GetHandle() const;
#elif defined(OS_FUCHSIA)
// Takes implicit ownership of |h|.
// |guid| uniquely identifies the shared memory region pointed to by the
// underlying OS resource. If the zx_handle_t is associated with another
// SharedMemoryHandle, the caller must pass the |guid| of that
// SharedMemoryHandle. Otherwise, the caller should generate a new
// UnguessableToken.
// Passing the wrong |size| has no immediate consequence, but may cause errors
// when trying to map the SharedMemoryHandle at a later point in time.
SharedMemoryHandle(zx_handle_t h,
size_t size,
const base::UnguessableToken& guid);
zx_handle_t GetHandle() const;
#elif defined(OS_MACOSX) && !defined(OS_IOS)
enum Type {
// The SharedMemoryHandle is backed by a POSIX fd.
POSIX,
// The SharedMemoryHandle is backed by the Mach primitive "memory object".
MACH,
};
// Makes a Mach-based SharedMemoryHandle of the given size. On error,
// subsequent calls to IsValid() return false.
// Passing the wrong |size| has no immediate consequence, but may cause errors
// when trying to map the SharedMemoryHandle at a later point in time.
SharedMemoryHandle(mach_vm_size_t size, const base::UnguessableToken& guid);
// Makes a Mach-based SharedMemoryHandle from |memory_object|, a named entry
// in the current task. The memory region has size |size|.
// Passing the wrong |size| has no immediate consequence, but may cause errors
// when trying to map the SharedMemoryHandle at a later point in time.
SharedMemoryHandle(mach_port_t memory_object,
mach_vm_size_t size,
const base::UnguessableToken& guid);
Type GetType() const { return type_; }
// Exposed so that the SharedMemoryHandle can be transported between
// processes.
mach_port_t GetMemoryObject() const;
// The SharedMemoryHandle must be valid.
// Returns whether the SharedMemoryHandle was successfully mapped into memory.
// On success, |memory| is an output variable that contains the start of the
// mapped memory.
bool MapAt(off_t offset, size_t bytes, void** memory, bool read_only);
#elif defined(OS_POSIX)
// Creates a SharedMemoryHandle from an |fd| supplied from an external
// service.
// Passing the wrong |size| has no immediate consequence, but may cause errors
// when trying to map the SharedMemoryHandle at a later point in time.
static SharedMemoryHandle ImportHandle(int fd, size_t size);
// Returns the underlying OS resource.
int GetHandle() const;
// Invalidates [but doesn't close] the underlying OS resource. This will leak
// unless the caller is careful.
int Release();
#endif
#if defined(OS_ANDROID)
// Marks the current file descriptor as read-only, for the purpose of
// mapping. This is independent of the region's read-only status.
void SetReadOnly() { read_only_ = true; }
// Returns true iff the descriptor is to be used for read-only
// mappings.
bool IsReadOnly() const { return read_only_; }
// Returns true iff the corresponding region is read-only.
bool IsRegionReadOnly() const;
// Try to set the region read-only. This will fail any future attempt
// at read-write mapping.
bool SetRegionReadOnly() const;
#endif
#if defined(OS_POSIX)
// Constructs a SharedMemoryHandle backed by a FileDescriptor. The newly
// created instance has the same ownership semantics as base::FileDescriptor.
// This typically means that the SharedMemoryHandle takes ownership of the
// |fd| if |auto_close| is true. Unfortunately, it's common for existing code
// to make shallow copies of SharedMemoryHandle, and the one that is finally
// passed into a base::SharedMemory is the one that "consumes" the fd.
//
// |guid| uniquely identifies the shared memory region pointed to by the
// underlying OS resource. If |file_descriptor| is associated with another
// SharedMemoryHandle, the caller must pass the |guid| of that
// SharedMemoryHandle. Otherwise, the caller should generate a new
// UnguessableToken.
// Passing the wrong |size| has no immediate consequence, but may cause errors
// when trying to map the SharedMemoryHandle at a later point in time.
SharedMemoryHandle(const base::FileDescriptor& file_descriptor,
size_t size,
const base::UnguessableToken& guid);
#endif
private:
#if defined(OS_WIN)
HANDLE handle_ = nullptr;
// Whether passing this object as a parameter to an IPC message passes
// ownership of |handle_| to the IPC stack. This is meant to mimic the
// behavior of the |auto_close| parameter of FileDescriptor. This member only
// affects attachment-brokered SharedMemoryHandles.
// Defaults to |false|.
bool ownership_passes_to_ipc_ = false;
#elif defined(OS_FUCHSIA)
zx_handle_t handle_ = ZX_HANDLE_INVALID;
bool ownership_passes_to_ipc_ = false;
#elif defined(OS_MACOSX) && !defined(OS_IOS)
friend class SharedMemory;
friend bool CheckReadOnlySharedMemoryHandleForTesting(
SharedMemoryHandle handle);
Type type_ = MACH;
// Each instance of a SharedMemoryHandle is backed either by a POSIX fd or a
// mach port. |type_| determines the backing member.
union {
FileDescriptor file_descriptor_;
struct {
mach_port_t memory_object_ = MACH_PORT_NULL;
// Whether passing this object as a parameter to an IPC message passes
// ownership of |memory_object_| to the IPC stack. This is meant to mimic
// the behavior of the |auto_close| parameter of FileDescriptor.
// Defaults to |false|.
bool ownership_passes_to_ipc_ = false;
};
};
#elif defined(OS_ANDROID)
friend class SharedMemory;
FileDescriptor file_descriptor_;
bool read_only_ = false;
#elif defined(OS_POSIX)
FileDescriptor file_descriptor_;
#endif
base::UnguessableToken guid_;
// The size of the region referenced by the SharedMemoryHandle.
size_t size_ = 0;
};
} // namespace base
#endif // !defined(STARBOARD)
#endif // BASE_MEMORY_SHARED_MEMORY_HANDLE_H_
| [
"trofimov_d_a@magnit.ru"
] | trofimov_d_a@magnit.ru |
84b2866d24e438832dd725044c5308ca7603202d | 45c84e64a486a3c48bd41a78e28252acbc0cc1b0 | /src/chrome/browser/chromeos/eol_notification.cc | 1e6d2d6c031e0f42ce1bc108a1fa0bd278b4a297 | [
"BSD-3-Clause",
"MIT"
] | permissive | stanleywxc/chromium-noupdator | 47f9cccc6256b1e5b0cb22c598b7a86f5453eb42 | 637f32e9bf9079f31430c9aa9c64a75247993a71 | refs/heads/master | 2022-12-03T22:00:20.940455 | 2019-10-04T16:29:31 | 2019-10-04T16:29:31 | 212,851,250 | 1 | 2 | MIT | 2022-11-17T09:51:04 | 2019-10-04T15:49:33 | null | UTF-8 | C++ | false | false | 5,643 | cc | // Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/chromeos/eol_notification.h"
#include "ash/public/cpp/notification_utils.h"
#include "base/bind.h"
#include "chrome/app/vector_icons/vector_icons.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h"
#include "chrome/browser/notifications/notification_display_service.h"
#include "chrome/browser/notifications/notification_display_service_factory.h"
#include "chrome/browser/ui/browser_navigator.h"
#include "chrome/browser/ui/browser_navigator_params.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/url_constants.h"
#include "chrome/grit/generated_resources.h"
#include "chromeos/dbus/dbus_thread_manager.h"
#include "chromeos/dbus/update_engine_client.h"
#include "components/prefs/pref_service.h"
#include "components/strings/grit/components_strings.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/chromeos/devicetype_utils.h"
#include "ui/gfx/color_palette.h"
#include "ui/gfx/paint_vector_icon.h"
#include "ui/message_center/public/cpp/notification.h"
using l10n_util::GetStringUTF16;
namespace chromeos {
namespace {
const char kEolNotificationId[] = "chrome://product_eol";
// Buttons that appear in notifications.
enum ButtonIndex {
BUTTON_MORE_INFO = 0,
BUTTON_DISMISS,
BUTTON_SIZE = BUTTON_DISMISS
};
class EolNotificationDelegate : public message_center::NotificationDelegate {
public:
explicit EolNotificationDelegate(Profile* profile) : profile_(profile) {}
private:
~EolNotificationDelegate() override = default;
// NotificationDelegate overrides:
void Click(const base::Optional<int>& button_index,
const base::Optional<base::string16>& reply) override {
if (!button_index)
return;
switch (*button_index) {
case BUTTON_MORE_INFO: {
// show eol link
NavigateParams params(profile_, GURL(chrome::kEolNotificationURL),
ui::PAGE_TRANSITION_LINK);
params.disposition = WindowOpenDisposition::NEW_FOREGROUND_TAB;
params.window_action = NavigateParams::SHOW_WINDOW;
Navigate(¶ms);
break;
}
case BUTTON_DISMISS:
// set dismiss pref.
profile_->GetPrefs()->SetBoolean(prefs::kEolNotificationDismissed,
true);
break;
}
NotificationDisplayServiceFactory::GetForProfile(profile_)->Close(
NotificationHandler::Type::TRANSIENT, kEolNotificationId);
}
Profile* const profile_;
DISALLOW_COPY_AND_ASSIGN(EolNotificationDelegate);
};
} // namespace
// static
bool EolNotification::ShouldShowEolNotification() {
// Do not show end of life notification if this device is managed by
// enterprise user.
if (g_browser_process->platform_part()
->browser_policy_connector_chromeos()
->IsEnterpriseManaged()) {
return false;
}
return true;
}
EolNotification::EolNotification(Profile* profile)
: profile_(profile), status_(update_engine::EndOfLifeStatus::kSupported) {}
EolNotification::~EolNotification() {}
void EolNotification::CheckEolStatus() {
UpdateEngineClient* update_engine_client =
DBusThreadManager::Get()->GetUpdateEngineClient();
// Request the Eol Status.
update_engine_client->GetEolStatus(base::BindOnce(
&EolNotification::OnEolStatus, weak_factory_.GetWeakPtr()));
}
void EolNotification::OnEolStatus(update_engine::EndOfLifeStatus status) {
status_ = status;
const int pre_eol_status =
profile_->GetPrefs()->GetInteger(prefs::kEolStatus);
profile_->GetPrefs()->SetInteger(prefs::kEolStatus, status_);
// Security only state is no longer supported.
if (status_ == update_engine::EndOfLifeStatus::kSupported ||
status_ == update_engine::EndOfLifeStatus::kSecurityOnly) {
return;
}
if (pre_eol_status != status_) {
// If Eol status has changed, we should reset
// kEolNotificationDismissed and show notification.
profile_->GetPrefs()->SetBoolean(prefs::kEolNotificationDismissed, false);
}
bool user_dismissed_eol_notification =
profile_->GetPrefs()->GetBoolean(prefs::kEolNotificationDismissed);
if (user_dismissed_eol_notification)
return;
Update();
}
void EolNotification::Update() {
message_center::RichNotificationData data;
DCHECK_EQ(BUTTON_MORE_INFO, data.buttons.size());
data.buttons.emplace_back(GetStringUTF16(IDS_LEARN_MORE));
DCHECK_EQ(BUTTON_DISMISS, data.buttons.size());
data.buttons.emplace_back(GetStringUTF16(IDS_EOL_DISMISS_BUTTON));
std::unique_ptr<message_center::Notification> notification =
ash::CreateSystemNotification(
message_center::NOTIFICATION_TYPE_SIMPLE, kEolNotificationId,
GetStringUTF16(IDS_EOL_NOTIFICATION_TITLE),
l10n_util::GetStringFUTF16(IDS_EOL_NOTIFICATION_EOL,
ui::GetChromeOSDeviceName()),
base::string16() /* display_source */, GURL(kEolNotificationId),
message_center::NotifierId(
message_center::NotifierType::SYSTEM_COMPONENT,
kEolNotificationId),
data, new EolNotificationDelegate(profile_),
kNotificationEndOfSupportIcon,
message_center::SystemNotificationWarningLevel::NORMAL);
NotificationDisplayServiceFactory::GetForProfile(profile_)->Display(
NotificationHandler::Type::TRANSIENT, *notification,
/*metadata=*/nullptr);
}
} // namespace chromeos
| [
"stanley@moon.lan"
] | stanley@moon.lan |
94b1b848854d9ac38afc63e5cde17caf93409408 | f8959d663bba888709824a7890a62768f80c116a | /src/Application.h | 4e2df67326ebeed013948f75b79fa593f6d82fe5 | [
"LicenseRef-scancode-public-domain"
] | permissive | dqshen/cwdsim | 620dd0e8b7283634d2d0c7d54aad760171d324b0 | b773300c980ff5a9680c3b3e73fd4a2a1821446f | refs/heads/master | 2021-01-22T17:14:26.017585 | 2013-07-30T07:45:29 | 2013-07-30T07:45:29 | 11,733,912 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 491 | h | #ifndef APPLICATION_H_
#define APPLICATION_H_
#include <QApplication>
#include "Logger.h"
class Application : public QApplication
{
public:
static const QString APPLICATION_NAME;
Application(int& argc, char** argv, Logger* logger);
virtual ~Application();
QString getName();
private:
Logger* logger;
void displayMessageBox(QString text, QString informativeText);
};
#endif /* APPLICATION_H_ */
| [
"dqshenfiw@gmail.com"
] | dqshenfiw@gmail.com |
50f9aa80396178237b246c8c242bac0648563d64 | 2e9ca33d4904bb5a6c8c8152abb9db8028155c33 | /src/functions/unrecognized_expr.cpp | c211bec93f5e718c5dd455ef01d6901e9c65c641 | [
"MIT"
] | permissive | mokerjoke/circa | cbe1e1803bc9ae2ed2a4d10be1de8f6d6b8c55d8 | 7decd3f4403d4c267a1cfc2d4e72786c3b377da8 | refs/heads/master | 2020-12-24T20:11:00.198382 | 2012-08-29T03:49:59 | 2012-08-31T04:48:41 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 558 | cpp | // Copyright (c) Andrew Fischer. See LICENSE file for license terms.
#include "circa/internal/for_hosted_funcs.h"
namespace circa {
namespace unrecognized_expr_function {
void formatSource(caValue* source, Term* term)
{
append_phrase(source, term->stringProp("originalText",""), term, name_None);
}
void setup(Branch* kernel)
{
FUNCS.unrecognized_expression = import_function(kernel, NULL, "unrecognized_expr(any :multiple)");
as_function(FUNCS.unrecognized_expression)->formatSource = formatSource;
}
}
}
| [
"paul.hodge.email@gmail.com"
] | paul.hodge.email@gmail.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.