blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 3 264 | content_id stringlengths 40 40 | detected_licenses listlengths 0 85 | license_type stringclasses 2
values | repo_name stringlengths 5 140 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringclasses 905
values | visit_date timestamp[us]date 2015-08-09 11:21:18 2023-09-06 10:45:07 | revision_date timestamp[us]date 1997-09-14 05:04:47 2023-09-17 19:19:19 | committer_date timestamp[us]date 1997-09-14 05:04:47 2023-09-06 06:22:19 | github_id int64 3.89k 681M ⌀ | star_events_count int64 0 209k | fork_events_count int64 0 110k | gha_license_id stringclasses 22
values | gha_event_created_at timestamp[us]date 2012-06-07 00:51:45 2023-09-14 21:58:39 ⌀ | gha_created_at timestamp[us]date 2008-03-27 23:40:48 2023-08-21 23:17:38 ⌀ | gha_language stringclasses 141
values | src_encoding stringclasses 34
values | language stringclasses 1
value | is_vendor bool 1
class | is_generated bool 2
classes | length_bytes int64 3 10.4M | extension stringclasses 115
values | content stringlengths 3 10.4M | authors listlengths 1 1 | author_id stringlengths 0 158 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
6cf265d5092a9189feeffea29e120af1788a4164 | 1bfd698b2c1f5760734dc42632fe54c65a286086 | /IfcPlusPlus/src/ifcpp/IFC4/include/IfcBoundaryFaceCondition.h | 04639c018fbbc8a8a289d1085079f0e5e3942f9c | [] | no_license | wartburgritter0/old_IfcPlusPlus | c0bd0b784396c100d0d96fc7af6146a0325a9e1b | d0f9d81462b295990d3eb83c9c406d520840330e | refs/heads/master | 2021-05-27T21:54:14.456425 | 2014-06-03T21:23:14 | 2014-06-03T21:23:14 | 19,681,159 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,475 | h | /* -*-c++-*- IfcPlusPlus - www.ifcplusplus.com - Copyright (C) 2011 Fabian Gerold
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
#pragma once
#include <vector>
#include <map>
#include <sstream>
#include <string>
#include "ifcpp/model/shared_ptr.h"
#include "ifcpp/model/IfcPPObject.h"
#include "IfcBoundaryCondition.h"
class IfcModulusOfSubgradeReactionSelect;
//ENTITY
class IfcBoundaryFaceCondition : public IfcBoundaryCondition
{
public:
IfcBoundaryFaceCondition();
IfcBoundaryFaceCondition( int id );
~IfcBoundaryFaceCondition();
// method setEntity takes over all attributes from another instance of the class
virtual void setEntity( shared_ptr<IfcPPEntity> other );
virtual void getStepLine( std::stringstream& stream ) const;
virtual void getStepParameter( std::stringstream& stream, bool is_select_type = false ) const;
virtual void readStepArguments( const std::vector<std::string>& args, const std::map<int,shared_ptr<IfcPPEntity> >& map );
virtual void setInverseCounterparts( shared_ptr<IfcPPEntity> ptr_self );
virtual void getAttributes( std::vector<std::pair<std::string, shared_ptr<IfcPPObject> > >& vec_attributes );
virtual void getAttributesInverse( std::vector<std::pair<std::string, shared_ptr<IfcPPObject> > >& vec_attributes );
virtual void unlinkSelf();
virtual const char* classname() const { return "IfcBoundaryFaceCondition"; }
// IfcBoundaryCondition -----------------------------------------------------------
// attributes:
// shared_ptr<IfcLabel> m_Name; //optional
// IfcBoundaryFaceCondition -----------------------------------------------------------
// attributes:
shared_ptr<IfcModulusOfSubgradeReactionSelect> m_TranslationalStiffnessByAreaX; //optional
shared_ptr<IfcModulusOfSubgradeReactionSelect> m_TranslationalStiffnessByAreaY; //optional
shared_ptr<IfcModulusOfSubgradeReactionSelect> m_TranslationalStiffnessByAreaZ; //optional
};
| [
"fabian.gerold@gmail.com@06f6d6f3-f2e0-f239-6e86-ba6a5d17d3a5"
] | fabian.gerold@gmail.com@06f6d6f3-f2e0-f239-6e86-ba6a5d17d3a5 |
425bdd058afa5cf5962727edb62a6847f5e68199 | 9ca652032da6dd477218213db5f7306ac056b1c9 | /last_modification_look_this/build-medicine-Desktop_Qt_5_0_2_GCC_32bit-Release/moc_colordiagram.cpp | 393a95f8c0664bb0ecd2b80126916b38bf0b66b8 | [] | no_license | sis34/msiu | 119fcaa7ca10ae547215e9a1878d4deb382d03a0 | ad9b420c4b04e63f087b0cad0540d6b9fcde8b1d | refs/heads/master | 2021-01-13T01:14:28.195415 | 2015-04-01T11:28:13 | 2015-04-01T11:28:13 | 25,873,249 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,385 | cpp | /****************************************************************************
** Meta object code from reading C++ file 'colordiagram.h'
**
** Created by: The Qt Meta Object Compiler version 67 (Qt 5.0.2)
**
** WARNING! All changes made in this file will be lost!
*****************************************************************************/
#include "../medicine/colordiagram.h"
#include <QtCore/qbytearray.h>
#include <QtCore/qmetatype.h>
#if !defined(Q_MOC_OUTPUT_REVISION)
#error "The header file 'colordiagram.h' doesn't include <QObject>."
#elif Q_MOC_OUTPUT_REVISION != 67
#error "This file was generated using the moc from 5.0.2. It"
#error "cannot be used with the include files from this version of Qt."
#error "(The moc has changed too much.)"
#endif
QT_BEGIN_MOC_NAMESPACE
struct qt_meta_stringdata_ColorDiagram_t {
QByteArrayData data[4];
char stringdata[56];
};
#define QT_MOC_LITERAL(idx, ofs, len) \
Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(len, \
offsetof(qt_meta_stringdata_ColorDiagram_t, stringdata) + ofs \
- idx * sizeof(QByteArrayData) \
)
static const qt_meta_stringdata_ColorDiagram_t qt_meta_stringdata_ColorDiagram = {
{
QT_MOC_LITERAL(0, 0, 12),
QT_MOC_LITERAL(1, 13, 31),
QT_MOC_LITERAL(2, 45, 0),
QT_MOC_LITERAL(3, 46, 8)
},
"ColorDiagram\0on_horizontalSlider_sliderMoved\0"
"\0position\0"
};
#undef QT_MOC_LITERAL
static const uint qt_meta_data_ColorDiagram[] = {
// content:
7, // revision
0, // classname
0, 0, // classinfo
1, 14, // methods
0, 0, // properties
0, 0, // enums/sets
0, 0, // constructors
0, // flags
0, // signalCount
// slots: name, argc, parameters, tag, flags
1, 1, 19, 2, 0x08,
// slots: parameters
QMetaType::Void, QMetaType::Int, 3,
0 // eod
};
void ColorDiagram::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a)
{
if (_c == QMetaObject::InvokeMetaMethod) {
ColorDiagram *_t = static_cast<ColorDiagram *>(_o);
switch (_id) {
case 0: _t->on_horizontalSlider_sliderMoved((*reinterpret_cast< int(*)>(_a[1]))); break;
default: ;
}
}
}
const QMetaObject ColorDiagram::staticMetaObject = {
{ &QMainWindow::staticMetaObject, qt_meta_stringdata_ColorDiagram.data,
qt_meta_data_ColorDiagram, qt_static_metacall, 0, 0}
};
const QMetaObject *ColorDiagram::metaObject() const
{
return QObject::d_ptr->metaObject ? QObject::d_ptr->dynamicMetaObject() : &staticMetaObject;
}
void *ColorDiagram::qt_metacast(const char *_clname)
{
if (!_clname) return 0;
if (!strcmp(_clname, qt_meta_stringdata_ColorDiagram.stringdata))
return static_cast<void*>(const_cast< ColorDiagram*>(this));
return QMainWindow::qt_metacast(_clname);
}
int ColorDiagram::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
_id = QMainWindow::qt_metacall(_c, _id, _a);
if (_id < 0)
return _id;
if (_c == QMetaObject::InvokeMetaMethod) {
if (_id < 1)
qt_static_metacall(this, _c, _id, _a);
_id -= 1;
} else if (_c == QMetaObject::RegisterMethodArgumentMetaType) {
if (_id < 1)
*reinterpret_cast<int*>(_a[0]) = -1;
_id -= 1;
}
return _id;
}
QT_END_MOC_NAMESPACE
| [
"sis34@gorynich13.msiu.ru"
] | sis34@gorynich13.msiu.ru |
814ba0d03843daac6822ae46fe0d315fd5601809 | 20d024bd04ace59987ba05f864d6d9dece72fbab | /LeetCode/15. 3Sum.cpp | 4af19a02f5b6189a30f8115413ae10f66a2c057d | [] | no_license | Yeluorag/ACM-ICPC-Code-Library | 8837688c23bf487d4374a76cf0656cb7adc751b0 | 77751c79549ea8ab6f790d55fac3738d5b615488 | refs/heads/master | 2021-01-20T20:18:43.366920 | 2016-08-12T08:08:38 | 2016-08-12T08:08:38 | 64,487,659 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,254 | cpp | #include <iostream>
#include <cstdio>
#include <vector>
#include <map>
using namespace std;
class Solution {
public:
vector<vector<int> > threeSum(vector<int>& nums) {
vector<vector<int> > ret;
map<string, int> unique;
int sz = nums.size();
sort(nums.begin(), nums.end());
for(int i = 0; i < sz; i ++) {
if(i && nums[i] == nums[i-1]) continue;
for(int j = i + 1, k = sz - 1; j < sz && k > j;) {
vector<int> vec;
int sum = nums[i] + nums[j] + nums[k];
if(sum == 0) {
vec.push_back(nums[i]);
vec.push_back(nums[j]);
vec.push_back(nums[k]);
ret.push_back(vec);
j ++, k --;
while(nums[j] == nums[j-1] && nums[k] == nums[k+1])
j++, k --;
} else if(sum < 0) {
j ++;
} else {
k --;
}
}
}
return ret;
}
};
#define LOCAL
int main() {
#ifdef LOCAL
freopen("/Users/apple/input.txt","r",stdin);
// freopen("/Users/apple/out.txt","w",stdout);
#endif
Solution cc;
vector<int> vec;
int n;
cin >> n;
int x;
for(int i = 0; i < n; i ++) {
cin >> x;
vec.push_back(x);
}
vector<vector<int> > ans = cc.threeSum(vec);
for(int i = 0; i < ans.size(); i ++) {
for(int j = 0; j < 3; j ++) {
printf("%d, ", ans[i][j]);
} puts("");
}
return 0;
} | [
"yeluorag@gmail.com"
] | yeluorag@gmail.com |
b5ea253774d0aee6daaa2a71391e54beb5b77719 | d5996e2609d03889a8296f8388cd65e645d52759 | /ray-tracing/ray-tracing.cpp | 233702d6c6998114db7565348c73dc5a0743a7d9 | [] | no_license | Penguin77jp/ray-tracing | 16c2ac5f09049a657e12968ddd485923e311f2d2 | 77e6aeb6da814c4777652c4803fc61855874f476 | refs/heads/master | 2020-04-13T09:23:59.941109 | 2018-12-26T22:41:04 | 2018-12-26T22:41:04 | 163,110,555 | 0 | 0 | null | 2018-12-26T22:41:05 | 2018-12-25T20:46:03 | C++ | UTF-8 | C++ | false | false | 487 | cpp | #include "output.h"
#include "render.h"
// #include "cpplinq/CppLinq/cpplinq.hpp"
int main()
{
const int w = 800;
const int h = 480;
Ray cameraRay = Ray(V(), V(0, 0, 1));
std::vector<Sphere> spheres = { Sphere(V(0, 0, 150), 100, ColorPix(0, 0, 255), ColorPix(0, 0, 0)), Sphere(V(0, 200, 150), 100, ColorPix(0, 0, 255), ColorPix(255, 255, 255)) };
Screen screen = Screen(w, h, cameraRay, spheres);
render(screen);
output(&screen);
// system("open result.ppm");
return 0;
} | [
"Koutei7penguin.jp@gmail.com"
] | Koutei7penguin.jp@gmail.com |
2501f3ad68965f57021ff6c11b676f8ee531979b | 398cd73c4278fa099f935513762a1717cae94c13 | /grid.cpp | ff0a841d26c5c213c766b8c29027d61944d35632 | [] | no_license | cahekm/umf1 | da3eb1da93fb88d7d347fc3d925334d9ce69e751 | f5d458fb47c332f3a88395c02ea33dc3e09b6514 | refs/heads/master | 2020-05-15T04:34:41.752251 | 2011-05-04T16:42:19 | 2011-05-04T16:42:19 | 1,701,785 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,406 | cpp | #include "grid.h"
Grid::Grid(const unsigned int &h1,
const unsigned int &w1,
const unsigned int &h2,
const unsigned int &w2,
const double &sh1,
const double &sh2,
const double &sw1,
const double &sw2,
const double &kh1,
const double &kh2,
const double &kw1,
const double &kw2)
: _h1(h1), _w1(w1), _h2(h2), _w2(w2),
_blocks(_h1+_h2-1),
_sizeSLAE(_h1*_w1 + _h2*_w1 + _h2*_w2 - _w1 - _h2),
_sh1(sh1), _sh2(sh2), _sw1(sw1), _sw2(sw2),
_kh1(kh1), _kh2(kh2), _kw1(kw1), _kw2(kw2) { }
Grid::~Grid() { }
void Grid::index(const unsigned int &ind,
zone::zone &which,
unsigned int &locali,
unsigned int &localj) const {
if(ind < (_h1)*_w1) {
which = zone::bottom;
locali = ind / _w1;
localj = ind % _w1;
} else {
locali = (ind - (_h1-1)*_w1) / (_w1 + _w2 - 1);
localj = (ind - (_h1-1)*_w1) % (_w1 + _w2 - 1);
which = (localj < _w1) ? zone::topleft : zone::topright;
localj -= (which == zone::topright) ? _w1-1 : 0;
//locali += (which == zone::topright) ? 0 : 1;
}
}
void Grid::print() const {
unsigned int locali, localj;
zone::zone which;
cout << "i\ti\tzone\tlocali\tlocalj\n";
for(int i = 0; i < _sizeSLAE; i++) {
index(i, which, locali, localj);
cout << i << "\t" << which << "\t" << locali << "\t" << localj << endl;
}
}
const unsigned int& Grid::blocks() const {
return _blocks;
}
const unsigned int& Grid::sizeSLAE() const {
return _sizeSLAE;
}
const unsigned int& Grid::w1() const {
return _w1;
}
const unsigned int& Grid::w2() const {
return _w2;
}
const unsigned int& Grid::h1() const {
return _h1;
}
const unsigned int& Grid::h2() const {
return _h2;
}
const double Grid::top(const unsigned int &point) const {
unsigned int i, j;
zone::zone which;
index(point, which, i, j);
double h0;
switch(which) {
case zone::bottom:
if(i == _h1 - 1) {
if(_kh2 == 1)
return _sh2/(_h2-1);
return _sh2 * (1 - _kh2) / (1 - pow(_kh2, (int)(_h2-1)));
}
if(_kh1 == 1)
return _sh1/(_h1-1);
h0 = _sh1 * (1 - _kh1) / (1 - pow(_kh1, (int)(_h1-1)));
return h0 * pow(_kh1, (int)i);
default:
if(i == (_h2-1))
return 0;
if(_kh2 == 1)
return _sh2/(_h2-1);
h0 = _sh2 * (1 - _kh2) / (1 - pow(_kh2, (int)(_h2-1)));
return h0 * pow(_kh2, (int)i);
}
}
const double Grid::bottom(const unsigned int &point) const {
unsigned int i, j;
zone::zone which;
index(point, which, i, j);
double h0;
switch(which) {
case zone::bottom:
if(i == 0)
return 0;
if(_kh1 == 1)
return _sh1/(_h1-1);
h0 = _sh1 * (1 - _kh1) / (1 - pow(_kh1, (int)(_h1-1)));
return h0 * pow(_kh1, (int)(i-1));
default:
if(i == 0)
return 0;
if(_kh2 == 1)
return _sh2/(_h2-1);
h0 = _sh2 * (1 - _kh2) / (1 - pow(_kh2, (int)(_h2-1)));
return h0 * pow(_kh2, (int)(i-1));
}
}
const double Grid::left(const unsigned int &point) const {
unsigned int i, j;
zone::zone which;
index(point, which, i, j);
double h0;
switch(which) {
case zone::topright:
if(_kw2 == 1)
return _sw2/(_w2-1);
h0 = _sw2 * (1 - _kw2) / (1 - pow(_kw2, (int)(_w2-1)));
return h0 * pow(_kw2, (int)(j-1));
default:
if(j == 0)
return 0;
if(_kw1 == 1)
return _sw1/(_w1-1);
h0 = _sw1 * (1 - _kw1) / (1 - pow(_kw1, (int)(_w1-1)));
return h0 * pow(_kw1, (int)(j-1));
}
}
const double Grid::right(const unsigned int &point) const {
unsigned int i, j;
zone::zone which;
index(point, which, i, j);
double h0;
switch(which) {
case zone::topright:
if(j == _w2-1)
return 0;
if(_kw2 == 1)
return _sw2/(_w2-1);
h0 = _sw2 * (1 - _kw2) / (1 - pow(_kw2, (int)(_w2-1)));
return h0 * pow(_kw2, (int)(j));
case zone::topleft:
if(j == _w1-1) {
if(_kw2 == 1)
return _sw2/(_w2-1);
return _sw2 * (1 - _kw2) / (1 - pow(_kw2, (int)(_w2-1)));
}
if(_kw1 == 1)
return _sw1/(_w1-1);
h0 = _sw1 * (1 - _kw1) / (1 - pow(_kw1, (int)(_w1-1)));
return h0 * pow(_kw1, (int)(j));
case zone::bottom:
if(j == _w1-1 && i == _h1-1) {
if(_kw2 == 1)
return _sw2/(_w2-1);
return _sw2 * (1 - _kw2) / (1 - pow(_kw2, (int)(_w2-1)));
}
if(j == _w1-1)
return 0;
if(_kw1 == 1)
return _sw1/(_w1-1);
h0 = _sw1 * (1 - _kw1) / (1 - pow(_kw1, (int)(_w1-1)));
return h0 * pow(_kw1, (int)(j));
}
} | [
"cahek-m@mail.ru"
] | cahek-m@mail.ru |
8ae6a83e5efb09bae42189b10864637c9702a339 | 4bd16eeaf3112ec176617d6f841d74b3c7ada879 | /win2/win2/win2.cpp | 483fab7fc7aa50ad5c8f21a078e217a44a1aeeee | [] | no_license | sowjanya1998/sowjanya | e751a54565c959b9b0852601d790cf007b3acca0 | 01e9ee139fb230982cc3d04d295f89114d416fb5 | refs/heads/master | 2020-04-21T16:46:55.960247 | 2019-03-18T15:15:55 | 2019-03-18T15:15:55 | 169,713,613 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 824 | cpp | // win2.cpp : This file contains the 'main' function. Program execution begins and ends there.
//
#include "pch.h"
#include <iostream>
int main()
{
std::cout << "Hello World!\n";
}
// Run program: Ctrl + F5 or Debug > Start Without Debugging menu
// Debug program: F5 or Debug > Start Debugging menu
// Tips for Getting Started:
// 1. Use the Solution Explorer window to add/manage files
// 2. Use the Team Explorer window to connect to source control
// 3. Use the Output window to see build output and other messages
// 4. Use the Error List window to view errors
// 5. Go to Project > Add New Item to create new code files, or Project > Add Existing Item to add existing code files to the project
// 6. In the future, to open this project again, go to File > Open > Project and select the .sln file
| [
"sowjanyadarna@gmail.com"
] | sowjanyadarna@gmail.com |
ef4dd02234910c404fdb526e936fba1359f246f7 | dd80a584130ef1a0333429ba76c1cee0eb40df73 | /external/chromium_org/content/common/input/synthetic_gesture_packet.h | e87205c82821d2f80cd0ab34d98604fdd4b1d349 | [
"MIT",
"BSD-3-Clause"
] | permissive | karunmatharu/Android-4.4-Pay-by-Data | 466f4e169ede13c5835424c78e8c30ce58f885c1 | fcb778e92d4aad525ef7a995660580f948d40bc9 | refs/heads/master | 2021-03-24T13:33:01.721868 | 2017-02-18T17:48:49 | 2017-02-18T17:48:49 | 81,847,777 | 0 | 2 | MIT | 2020-03-09T00:02:12 | 2017-02-13T16:47:00 | null | UTF-8 | C++ | false | false | 1,189 | h | // Copyright 2013 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 CONTENT_COMMON_INPUT_SYNTHETIC_GESTURE_PACKET_H_
#define CONTENT_COMMON_INPUT_SYNTHETIC_GESTURE_PACKET_H_
#include "base/memory/scoped_ptr.h"
#include "content/common/content_export.h"
#include "content/common/input/synthetic_gesture_params.h"
namespace content {
// Wraps an object of type SyntheticGestureParams (or one of its subclasses) for
// sending it over IPC.
class CONTENT_EXPORT SyntheticGesturePacket {
public:
SyntheticGesturePacket();
~SyntheticGesturePacket();
void set_gesture_params(scoped_ptr<SyntheticGestureParams> gesture_params) {
gesture_params_ = gesture_params.Pass();
}
const SyntheticGestureParams* gesture_params() const {
return gesture_params_.get();
}
scoped_ptr<SyntheticGestureParams> pass_gesture_params() {
return gesture_params_.Pass();
}
private:
scoped_ptr<SyntheticGestureParams> gesture_params_;
DISALLOW_COPY_AND_ASSIGN(SyntheticGesturePacket);
};
} // namespace content
#endif // CONTENT_COMMON_INPUT_SYNTHETIC_GESTURE_PACKET_H_
| [
"karun.matharu@gmail.com"
] | karun.matharu@gmail.com |
05f648e852061a55b0f73420ec00b36d75eaf1f8 | cf1f43771249bf7faf32dd8d3bedce73ea33b756 | /source/ui/nvenc_h264_handler.hpp | 43164513beec59333c02b9dd3ca72855eac6f973 | [
"MIT"
] | permissive | kryztoval/obs-ffmpeg-encoder | f8772d29ce8d51eb3f1a77699ce402794f7cc0c9 | 18024aaf12b919d0b3380faf1c555182858b05c1 | refs/heads/master | 2020-09-06T20:22:10.631092 | 2019-10-31T05:36:14 | 2019-10-31T07:13:42 | 220,524,736 | 0 | 0 | MIT | 2019-11-08T18:23:42 | 2019-11-08T18:23:41 | null | UTF-8 | C++ | false | false | 2,585 | hpp | // FFMPEG Video Encoder Integration for OBS Studio
// Copyright (c) 2019 Michael Fabian Dirks <info@xaymar.com>
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
#pragma once
#include "handler.hpp"
extern "C" {
#include <obs-properties.h>
#pragma warning(push)
#pragma warning(disable : 4244)
#include <libavcodec/avcodec.h>
#pragma warning(pop)
}
namespace obsffmpeg {
namespace ui {
class nvenc_h264_handler : public handler {
public:
virtual void override_visible_name(const AVCodec* codec, std::string& name) override;
virtual void override_lag_in_frames(size_t& lag, obs_data_t* settings, const AVCodec* codec,
AVCodecContext* context) override;
virtual void get_defaults(obs_data_t* settings, const AVCodec* codec, AVCodecContext* context,
bool hw_encode) override;
virtual void get_properties(obs_properties_t* props, const AVCodec* codec,
AVCodecContext* context, bool hw_encode) override;
virtual void update(obs_data_t* settings, const AVCodec* codec,
AVCodecContext* context) override;
virtual void log_options(obs_data_t* settings, const AVCodec* codec,
AVCodecContext* context) override;
private:
void get_encoder_properties(obs_properties_t* props, const AVCodec* codec);
void get_runtime_properties(obs_properties_t* props, const AVCodec* codec,
AVCodecContext* context);
};
} // namespace ui
} // namespace obsffmpeg
| [
"info@xaymar.com"
] | info@xaymar.com |
4294b0243b12b035c40ed5d4f545bb780497efe8 | 98f1ceadfc3772588eff0e7deced5592bfd22dcc | /Objects/bin/preproc/ctags_target_for_gcc_minus_e.cpp | 60a1e944e946b650e50a0b0dc7bdc801d4911f8e | [] | no_license | ccatanaoan/TempHumidityBasement | 923cc1bdbceec8d9832a77e774f0d7790946f761 | 836369e4424ad2e5736f4fbf193789c4a940a290 | refs/heads/master | 2021-06-03T11:01:17.191080 | 2021-05-11T12:08:51 | 2021-05-11T12:08:51 | 141,856,964 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 294 | cpp | # 1 "C:\\Users\\Cloyd\\Desktop\\HOMEAU~1\\BASEME~1\\Objects\\src\\src.ino"
# 2 "C:\\Users\\Cloyd\\Desktop\\HOMEAU~1\\BASEME~1\\Objects\\src\\src.ino" 2
void setup() {
b4r_main::initializeProcessGlobals();
b4r_main::_appstart();
}
void loop() {
while (true) {
B4R::scheduler.loop();
}
}
| [
"antimone2001@hotmail.com"
] | antimone2001@hotmail.com |
400adb6327b6bed7f665995d3fe05d8c91809317 | 81985fc94abfd774c22c5b6f71834d38ba027285 | /pinfo/pinfo-ProgramInfo.h | cc6a6aeea8a221422e0b1a82193c0d10e96a525f | [] | no_license | cornell-brg/xloops-bmarks | 3f2a961d6c995a556679734d60756754cfa18379 | 2f91a5aad168882672a8f150fc59158575ae5923 | refs/heads/master | 2021-05-24T00:56:13.769621 | 2020-07-11T19:27:46 | 2020-07-11T19:27:46 | 59,903,830 | 3 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 5,174 | h | //========================================================================
// pinfo-ProgramInfo.h : Program argument and module information repo
//========================================================================
// See 'pinfo-uguide.txt' for more information about using the program
// info subproject.
#ifndef PINFO_PROGRAM_INFO_H
#define PINFO_PROGRAM_INFO_H
#include <iostream>
#include <fstream>
#include <string>
#include <map>
namespace pinfo {
class ProgramInfo {
public:
//--------------------------------------------------------------------
// Constructors/Destructors
//--------------------------------------------------------------------
ProgramInfo();
~ProgramInfo();
//--------------------------------------------------------------------
// Specify module information and arguments
//--------------------------------------------------------------------
// Add a module to the list of known modules
void add_module( const char* name, const char* version );
// Add an arg to the list of possible args
void add_arg( const char* arg, const char* name, const char* def,
const char* comment = NULL );
// Change already parsed arg - return old value or NULL if not found
const char* set_value( const char* arg, const char* value );
//--------------------------------------------------------------------
// Parse arguments
//--------------------------------------------------------------------
// Parse the command line args, giving usage messages if necessary
int parse_args( int argc, char **argv );
//--------------------------------------------------------------------
// Extract arguments
//--------------------------------------------------------------------
// Get the string corresponding to an arg
const char* get_string( const char* arg );
// Interpret arg as a stream name and open that stream
std::ostream& get_logstream( const char* arg );
// Interpret arg as a hex or decimal long and return value
long get_long( const char* arg );
// Interpret arg as a hex or decimal unsigned long and return value
unsigned long get_ulong( const char* arg );
// Interpret arg as a binary value - "0" or "1"
int get_binary( const char* arg);
// Interpret an arg as a double precision floating point value
double get_double( const char* arg );
// Check for the presence of a flag arg (no value)
int get_flag( const char* arg );
//--------------------------------------------------------------------
// Get information about program and modules
//--------------------------------------------------------------------
// Show names and versions of all modules
void show_version();
// Show usage message including all registered args
void show_usage( int error );
// Return the program name (basename of argv[0])
const char* program_name();
//--------------------------------------------------------------------
// Error and warning streams
//--------------------------------------------------------------------
// Print an error message
std::ostream& error( const char* module = NULL );
// Print a warning message
std::ostream& warning( const char* module = NULL );
//--------------------------------------------------------------------
// Access global instance
//--------------------------------------------------------------------
static ProgramInfo& instance();
private:
//--------------------------------------------------------------------
// Private data
//--------------------------------------------------------------------
enum
{
MAX_MODULES = 20,
MAX_ARGS = 50,
MAX_POSARGS = 10,
MAX_LOGFILES = 10
};
enum
{
ARG_WIDTH = 10,
VAL_WIDTH = 20
};
// Structure for storing arg information
struct Arg
{
const char* arg; // Arg name
const char* name; // Name of arg for usage message
const char* def; // Default value
const char* value; // Actual value
const char* descrip; // Description
};
// Structure for storing module information
struct Module
{
const char* name; // Module name
const char* version; // Module version
};
// List of args we know about
Arg m_args[MAX_ARGS];
// Number of args we know about
int m_arg_count;
// List of modules
Module m_modules[MAX_MODULES];
// Number of modules
int m_module_count;
// List of files used to log data
std::ofstream* m_logfiles[MAX_LOGFILES];
// Count of log files
int m_logfile_count;
// Map from file name to ofstream for duplicate logfiles
std::map<std::string,std::ofstream*> m_logfile_map;
// Pointer to program name
const char* m_progname;
// Warning and error output
std::ostream* m_warn_out;
std::ostream* m_err_out;
int m_warn_max;
int m_err_max;
int m_warn_count;
int m_err_count;
};
}
#endif /* PINFO_PROGRAM_INFO_H */
| [
"shreesha@csl.cornell.edu"
] | shreesha@csl.cornell.edu |
7defbbb3173b63a24ac031dcff06dd64b499b3b7 | 754d8208d78f8b41f897f5291eaeb578ad5199b5 | /run/tutorials/simpleTests/cylinderInChannelPotentialScalarTransport/constant/transportProperties | 17e85cbc56535c553f6e50cae123b7296a148728 | [] | no_license | rubynuaa/OversetMesh | 39e6540e6b93088c839bbc0f608066d609de393b | 9e7fcab5d0593dce11721cb4823cd780c30d4302 | refs/heads/master | 2020-05-16T08:10:15.440127 | 2018-01-11T07:34:34 | 2018-01-11T07:38:50 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 944 | /*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | foam-extend: Open Source CFD |
| \\ / O peration | Version: 1.4 |
| \\ / A nd | Web: http://www.openfoam.org |
| \\/ M anipulation | For copyright notice see file Copyright |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object transportProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
DT DT [0 2 -1 0 0 0 0] 0.01;
DV DV [0 2 -1 0 0 0 0] 0.01;
// ************************************************************************* //
| [
"h.jasak@wikki.co.uk"
] | h.jasak@wikki.co.uk | |
fec2b70f4ebc21a012d0f308e2b6b2a6b81051c4 | fec796dac2b5ec277cb39f64acb22c04e6405042 | /CredentialProvider/Utilities.h | 5f8d7a167be5822f5ef4933a572e5562fe31b80c | [
"Apache-2.0"
] | permissive | ijat/privacyidea-credential-provider | 9ccfdabf416d8da5a94a79ec1685b1d1a343cfa0 | 2d01798e1b1d326dae4a6173d5a716b1381c298d | refs/heads/master | 2023-06-23T07:00:01.646645 | 2021-07-21T14:55:35 | 2021-07-21T14:55:35 | 288,379,555 | 0 | 0 | Apache-2.0 | 2021-01-11T16:32:42 | 2020-08-18T06:57:15 | null | UTF-8 | C++ | false | false | 3,127 | h | #pragma once
#include "Configuration.h"
#include "Logger.h"
#include <scenario.h>
#include <memory>
#include <Windows.h>
#include <wincred.h>
#define CLEAR_FIELDS_CRYPT 0
#define CLEAR_FIELDS_EDIT_AND_CRYPT 1
#define CLEAR_FIELDS_ALL 2
#define CLEAR_FIELDS_ALL_DESTROY 3
#define MAX_SIZE_DOMAIN 64
#define MAX_SIZE_USERNAME 512
enum class SCENARIO
{
NO_CHANGE = 0,
LOGON_BASE = 1,
UNLOCK_BASE = 2,
SECOND_STEP = 3,
LOGON_TWO_STEP = 4,
UNLOCK_TWO_STEP = 5,
CHANGE_PASSWORD = 6,
};
class Utilities
{
public:
Utilities(std::shared_ptr<Configuration> c) noexcept;
// Returns the text for the id in english or german, depending on GetUserDefaultUILanguage
static std::wstring GetTranslatedText(int text_id);
HRESULT KerberosLogon(
__out CREDENTIAL_PROVIDER_GET_SERIALIZATION_RESPONSE*& pcpgsr,
__out CREDENTIAL_PROVIDER_CREDENTIAL_SERIALIZATION*& pcpcs,
__in CREDENTIAL_PROVIDER_USAGE_SCENARIO cpus,
__in std::wstring username,
__in std::wstring password,
__in std::wstring domain
);
HRESULT KerberosChangePassword(
__out CREDENTIAL_PROVIDER_GET_SERIALIZATION_RESPONSE* pcpgsr,
__out CREDENTIAL_PROVIDER_CREDENTIAL_SERIALIZATION* pcpcs,
__in std::wstring username,
__in std::wstring password_old,
__in std::wstring password_new,
__in std::wstring domain
);
HRESULT CredPackAuthentication(
__out CREDENTIAL_PROVIDER_GET_SERIALIZATION_RESPONSE*& pcpgsr,
__out CREDENTIAL_PROVIDER_CREDENTIAL_SERIALIZATION*& pcpcs,
__in CREDENTIAL_PROVIDER_USAGE_SCENARIO cpus,
__in std::wstring username,
__in std::wstring password,
__in std::wstring domain
);
// Set all fields state depending on the scenario, then fill the fields depending on scenario and configuration
HRESULT SetScenario(
__in ICredentialProviderCredential* pCredential,
__in ICredentialProviderCredentialEvents* pCPCE,
__in SCENARIO scenario
);
HRESULT Clear(
wchar_t* (&field_strings)[FID_NUM_FIELDS],
CREDENTIAL_PROVIDER_FIELD_DESCRIPTOR(&pcpfd)[FID_NUM_FIELDS],
ICredentialProviderCredential* pcpc,
ICredentialProviderCredentialEvents* pcpce,
char clear
);
HRESULT SetFieldStatePairBatch(
__in ICredentialProviderCredential* self,
__in ICredentialProviderCredentialEvents* pCPCE,
__in const FIELD_STATE_PAIR* pFSP
);
HRESULT InitializeField(
LPWSTR* rgFieldStrings,
DWORD field_index
);
HRESULT ReadFieldValues();
static const FIELD_STATE_PAIR* GetFieldStatePairFor(CREDENTIAL_PROVIDER_USAGE_SCENARIO cpus, bool twoStepHideOTP);
HRESULT ResetScenario(ICredentialProviderCredential* pSelf, ICredentialProviderCredentialEvents* pCredProvCredentialEvents);
private:
std::shared_ptr<Configuration> _config;
HRESULT ReadUserField();
HRESULT ReadPasswordField();
HRESULT ReadOTPField();
HRESULT ReadPasswordChangeFields();
#define TEXT_USERNAME 0
#define TEXT_PASSWORD 1
#define TEXT_OLD_PASSWORD 2
#define TEXT_NEW_PASSWORD 3
#define TEXT_CONFIRM_PASSWORD 4
#define TEXT_DOMAIN_HINT 5
#define TEXT_OTP 6
#define TEXT_WRONG_OTP 7
#define TEXT_WRONG_PASSWORD 8
#define TEXT_DEFAULT_OTP_HINT 9
#define TEXT_RESET_LINK 10
const static std::wstring texts[11][2];
};
| [
"nils.behlen@netknights.it"
] | nils.behlen@netknights.it |
13b4bd46d24955a7c37f8505e921be63264296f7 | 447a02034735843e0eb1ffc4b049ef102f02c5a3 | /src/chronotext/sound/AudioLoop.cpp | 4f64c8152c2afc6ddf6069896e552b17958dfe77 | [] | no_license | arielm/old-chronotext-toolkit | 0898f5e32848621664fa2c2a3d6a25e8b5ea30d1 | 91e2adb7b589e2356f80cd1ebc5bdecb9892447f | refs/heads/master | 2021-01-21T07:31:24.045793 | 2013-09-25T23:15:38 | 2013-09-25T23:15:38 | 4,507,765 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 3,633 | cpp | #include "chronotext/sound/AudioLoop.h"
#if TARGET_OS_IPHONE
#define AUDIO_UNIT_COMPONENT_SUB_TYPE kAudioUnitSubType_RemoteIO
#else
#define AUDIO_UNIT_COMPONENT_SUB_TYPE kAudioUnitSubType_DefaultOutput
#endif
bool AudioLoop::init()
{
if (!initialized)
{
AudioComponentDescription defaultOutputDescription;
defaultOutputDescription.componentType = kAudioUnitType_Output;
defaultOutputDescription.componentSubType = AUDIO_UNIT_COMPONENT_SUB_TYPE;
defaultOutputDescription.componentManufacturer = kAudioUnitManufacturer_Apple;
defaultOutputDescription.componentFlags = 0;
defaultOutputDescription.componentFlagsMask = 0;
AudioComponent defaultOutput = AudioComponentFindNext(NULL, &defaultOutputDescription);
if (!defaultOutput)
{
printf("Can't find default output\n");
return false;
}
OSStatus err = AudioComponentInstanceNew(defaultOutput, &audioUnit);
if (err)
{
printf("AudioComponentInstanceNew ERROR: %d\n", (int)err);
return false;
}
AURenderCallbackStruct input;
input.inputProc = staticRenderCallback;
input.inputProcRefCon = this;
err = AudioUnitSetProperty(audioUnit,
kAudioUnitProperty_SetRenderCallback,
kAudioUnitScope_Input,
0,
&input,
sizeof(input));
if (err)
{
printf("AudioUnitSetProperty/kAudioUnitProperty_SetRenderCallback ERROR: %d\n", (int)err);
return false;
}
AudioStreamBasicDescription streamFormat;
streamFormat.mSampleRate = 44100;
streamFormat.mFormatID = kAudioFormatLinearPCM;
streamFormat.mFormatFlags = kAudioFormatFlagsNativeFloatPacked | kAudioFormatFlagIsNonInterleaved;
streamFormat.mBytesPerPacket = 4;
streamFormat.mFramesPerPacket = 1;
streamFormat.mBytesPerFrame = 4;
streamFormat.mChannelsPerFrame = 1;
streamFormat.mBitsPerChannel = 32;
err = AudioUnitSetProperty(audioUnit,
kAudioUnitProperty_StreamFormat,
kAudioUnitScope_Input,
0,
&streamFormat,
sizeof(AudioStreamBasicDescription));
if (err)
{
printf("AudioUnitSetProperty/kAudioUnitProperty_StreamFormat ERROR: %d\n", (int)err);
return false;
}
err = AudioUnitInitialize(audioUnit);
if (err)
{
printf("AudioUnitInitialize ERROR: %d\n", (int)err);
return false;
}
initialized = true;
}
return true;
}
void AudioLoop::shutdown()
{
if (initialized)
{
AudioOutputUnitStop(audioUnit);
AudioUnitUninitialize(audioUnit);
AudioComponentInstanceDispose(audioUnit);
audioUnit = NULL;
}
}
void AudioLoop::start()
{
if (initialized)
{
OSStatus err = AudioOutputUnitStart(audioUnit);
if (err) printf("AudioOutputUnitStart ERROR: %d\n", (int)err);
}
}
void AudioLoop::stop()
{
if (initialized)
{
OSStatus err = AudioOutputUnitStop(audioUnit);
if (err) printf("AudioOutputUnitStop ERROR: %d\n", (int)err);
}
}
/*
* TODO
*/
void AudioLoop::setVolume(float volume)
{
}
| [
"ariel@chronotext.org"
] | ariel@chronotext.org |
d52df164e0113e67e3dd2d166e9645f78abbc929 | 90c73f1d1fc7ddb4af830682b4a690373ff5b220 | /app/src/main/cpp/native-lib.cpp | d1c7c68f1cd75a0e38585bee50b39f62b122ff72 | [] | no_license | AvinashKanjiya/MyApplication2 | 4f9c0699573b2f5d7a68bf527c0cbc60037fa68d | fcc31b4d20532e55e808f38816eb0ac0cf459d78 | refs/heads/master | 2020-05-04T21:02:47.186230 | 2019-04-04T09:12:20 | 2019-04-04T09:12:20 | 179,459,759 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 277 | cpp | #include <jni.h>
#include <string>
extern "C" JNIEXPORT jstring
JNICALL
Java_c_theclassyhome_myapplication_MainActivity_stringFromJNI(
JNIEnv *env,
jobject /* this */) {
std::string hello = "Hello from C++";
return env->NewStringUTF(hello.c_str());
}
| [
"avikanjiya@gmail.com"
] | avikanjiya@gmail.com |
ca1f5830bab95d2baf4c7c9658ec9bb3884f2102 | d702c9e603c184a1d97640bb0cc5722dd16f0996 | /atcoder/edu_dp/longest_path.cpp | f9ae93fa00f129e8e83dc4d90b96cc5a624dee05 | [
"MIT"
] | permissive | udayan14/Competitive_Coding | 648220d442ed5d9d325268d71d8f14175f96db18 | 79e23fdeb909b4161a193d88697a4fe5f4fbbdce | refs/heads/master | 2023-05-08T17:44:35.001970 | 2021-05-20T04:43:43 | 2021-05-20T04:43:43 | 282,085,512 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,550 | cpp | #include <iostream>
#include <cassert>
#include <cstring>
#include <vector>
#include <algorithm>
using namespace std;
vector<vector<int>> adj;
vector<vector<int>> inc;
vector<short> visited;
vector<int> stk;
vector<int> dp;
void toposort(int v){
visited[v] = 1;
for(auto child : adj[v]){
if(!visited[child])
toposort(child);
}
stk.push_back(v);
}
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int t;
t = 1;
while(t--){
int n,m;
cin >> n >> m;
adj = vector<vector<int>> (n+1);
inc = vector<vector<int>> (n+1);
visited = vector<short> (n+1,0);
dp = vector<int> (n+1,0);
for(int i=0 ; i<m ; i++){
int x,y;
cin >> x >> y;
adj[x].push_back(y);
inc[y].push_back(x);
}
for(int i=1 ; i<=n ; i++){
if(!visited[i])
toposort(i);
}
reverse(stk.begin(),stk.end());
long long int output = 0;
for(auto i : stk){
int temp = 0;
if(inc[i].size()==0){
dp[i] = temp;
continue;
}
for(auto parent : inc[i]){
if(dp[parent] > temp)
temp = dp[parent];
}
dp[i] = temp+1;
if(dp[i] > output) output = dp[i];
}
/*for(int i=1 ; i<=n ; i++) cout << dp[i] << " ";*/
/*cout << "\n";*/
cout << output << "\n";
}
return 0;
}
| [
"14udayanjoshi@gmail.com"
] | 14udayanjoshi@gmail.com |
9ff99de9e3ffc9742fa0bf2ba8e0cc99899d2370 | 9e64d0c70210ba83084871721fd81e5056500868 | /base/simjson.h | 1cda87a6b63e0eba3fc01c51f09fe72bf4163b13 | [
"MIT"
] | permissive | jettyu/simcode | 60cf0af897f91eada170bc88f5cd08fef4818b9f | 5785ae5e8f7609abdce3cfbc0a0e13e71099fade | refs/heads/master | 2021-01-20T17:37:34.020763 | 2016-04-25T02:51:47 | 2016-04-25T02:51:47 | 43,938,793 | 1 | 1 | null | 2015-10-09T07:07:58 | 2015-10-09T07:07:58 | null | UTF-8 | C++ | false | false | 1,930 | h | #ifndef SIMJSON_H
#define SIMJSON_H
#include <string>
namespace simcode
{
enum SimJsonNodeType
{
SIMJSON_NODE = 1,
SIMJSON_ARRAY,
SIMJSON_EMPTY
};
class SimJson;
inline SimJson NewSimJson(const std::string& str, const int _errcode=0);
class SimJson
{
public:
static SimJson New(const std::string& str, const int _errcode=0);
static bool is_valid(const std::string& str)
{
return true;
}
const std::string& ToString()const
{
return m_str;
}
SimJson():m_type(SIMJSON_EMPTY) {}
SimJson(SimJsonNodeType t);
//is_transed标记是否转移,如果为false则表示需要转译
SimJson(const std::string& key, const std::string& value, bool is_transed = false);
SimJson(const std::string& key, const int value);
SimJson(const std::string& key, const SimJson& value);
SimJson& operator=(const SimJson& sj);
void reserve(const size_t n)
{
m_str.reserve(n);
}
size_t size(void)
{
return m_str.length();
}
size_t capacity(void)
{
return m_str.capacity();
}
void clear(void);
template<typename T>
int push_back(const std::string& key, const T& val, bool is_transed = false)
{
return push_back(SimJson(key, val));
}
int push_back(const std::string& key, const std::string& val, bool is_transed = false)
{
return push_back(SimJson(key, val, is_transed));
}
int push_back(const SimJson& sj);
//会自动转译字符串
SimJsonNodeType type(void)
{
return m_type;
}
private:
std::string& AddNode(std::string& node, const std::string& str);
private:
std::string m_str;
SimJsonNodeType m_type;
};//endof class
inline SimJson NewSimJson(const std::string& str)
{
return SimJson::New(str);
}
};//endof namespace
#endif
| [
"root@localhost.localdomain"
] | root@localhost.localdomain |
3d272b478c5acb1c8d2b1ab29d3a030451393e53 | 3da0b0276bc8c3d7d1bcdbabfb0e763a38d3a24c | /zju.finished/1856.cpp | ea7d6d29aa4d888d6c4b1e4cc25d684d98855813 | [] | no_license | usherfu/zoj | 4af6de9798bcb0ffa9dbb7f773b903f630e06617 | 8bb41d209b54292d6f596c5be55babd781610a52 | refs/heads/master | 2021-05-28T11:21:55.965737 | 2009-12-15T07:58:33 | 2009-12-15T07:58:33 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,279 | cpp | #include<iostream>
using namespace std;
enum {
SIZ = 50000,
};
struct Node {
unsigned s, n; // s is the product, n*(n-1) = s;
};
int num;
Node tree[SIZ];
unsigned p,q;
void init(){
unsigned n,t;
num = 0;
for(n=2, t=n*(n-1); n<=SIZ; ++n, t=n*(n-1)){
tree[num].s=t;
tree[num].n=n;
num++;
}
}
int find(unsigned v){
int l=0, h=num,m;
while(l < h){
m = (l+h)/2;
if(tree[m].s < v){
l = m + 1;
} else if(tree[m].s > v){
h = m;
} else {
return tree[m].n;
}
}
return -1;
}
void fun(){
if(p == 0){
printf("0 2\n");
return;
}
int i,k,r;
for(i=0; i<num; i++){
if(tree[i].s%q!=0) continue;
k = tree[i].s / q;
r = find(p*k);
if(r==-1) continue;
printf("%u %u\n", r, tree[i].n-r);
return;
}
printf("impossible\n");
}
unsigned gcd(unsigned a, unsigned b){
unsigned t;
while(b > 0){
t = a % b;
a = b;
b = t;
}
return a;
}
int main(){
unsigned v;
init();
scanf("%u%u",&p,&q);
while(p + q){
v = gcd(p, q);
p /= v;
q /= v;
fun();
scanf("%u%u",&p,&q);
}
return 0;
}
| [
"zhouweikuan@gmail.com"
] | zhouweikuan@gmail.com |
647c1e7716aba3b2fc71bf0cf731f22d445cf4d3 | f96186e83b0a345412a3105007874f382a56eb2f | /Project/Renderer.h | 76a72515a49d45a2bedf60f35ba482632d74fb97 | [] | no_license | Nihiss-dev/IgraphProject | 3ab7868e3316c54e43b4100f2f8ef88516631e68 | 6cad5b2b795f4c1b0bfe7df6e7d66c54e63a7226 | refs/heads/master | 2021-08-11T21:25:48.687085 | 2017-04-24T02:32:55 | 2017-04-24T02:32:55 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,145 | h | #ifndef RENDERER_H_
#define RENDERER_H_
#include <vector>
#include "ofMain.h"
#include "Primitive.h"
class Renderer
{
public:
explicit Renderer();
virtual ~Renderer();
void Setup();
void Update();
void Draw();
void DrawBlur();
void DrawGeometry();
void DrawNoise();
void AddObject(Object *);
void AddLight(ofLight *);
void EnableBlur();
void EnableGeometry();
void EnableNoise();
void DisableBlur();
void DisableGeometry();
void DisableNoise();
void DisableAll();
void LoadBlurShader();
void LoadGeometryShader();
void LoadNoiseShader();
inline std::vector<Object*> GetObjects() { return m_objects; }
inline std::vector<ofLight*> GetLights() { return m_lights; }
ofFbo fbo;
private:
std::vector<Object*> m_objects;
std::vector<ofLight*> m_lights;
ofEasyCam *m_cam;
// blur
ofShader shaderBlurX;
ofShader shaderBlurY;
ofFbo fboBlurOnePass;
ofFbo fboBlurTwoPass;
bool m_blurEnabled;
// geometry
ofShader shaderGeometry;
std::vector<ofPoint> points;
bool m_geometryEnabled;
// noise
ofShader shaderNoise;
ofPlanePrimitive plane;
ofImage noiseImage;
bool m_noiseEnabled;
};
#endif //RENDERER_H_ | [
"alexis.feldmar.1@ulaval.ca"
] | alexis.feldmar.1@ulaval.ca |
33e4d50966db452bfd19f81520ab4230acd5919e | 12b1306e93a471793e8d08af67cb2ed93818c24e | /Source/Settings/FirmwareDlg.h | ef1a97184c85c0f744b6a42c6f2ab67525d7f86b | [
"BSD-3-Clause"
] | permissive | cgibbard/TerpstraSysEx.2014 | 5e6675c6ffe26d3489792228526e398c51c81f65 | fadfae8f21f1e69ea6e639526c95bf8e226c4c64 | refs/heads/master | 2023-07-24T22:25:46.783023 | 2021-09-07T23:59:22 | 2021-09-07T23:59:22 | 404,155,536 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,249 | h | /*
==============================================================================
FirmwareDlg.h
Created: 5 Feb 2021 7:33:07pm
Author: Vincenzo
==============================================================================
*/
#pragma once
#include "../FileBrowserComponent.h"
#include "../FirmwareTransfer.h"
#include "../LumatoneController.h"
class FirmwareDlg : public Component,
protected Button::Listener,
protected PathBrowserComponent::Listener,
protected FirmwareTransfer::ProcessListener,
protected LumatoneController::FirmwareListener,
private Timer
{
public:
FirmwareDlg();
~FirmwareDlg();
void paint(Graphics& g) override;
void resized() override;
void buttonClicked(Button* btn) override;
void updateFirmwareVersionLabel();
void postMessage(String msgForLog);
//=========================================================================
// PathBrowserComponent::Listener Implementation
void fileChanged(PathBrowserComponent* source, File) override;
//=========================================================================
// FirmwareTransfer::Listener Implementation
void firmwareTransferUpdate(FirmwareTransfer::StatusCode statusCode, String msg) override;
//=========================================================================
// LumatoneController::FirmwareListener implementation
void firmwareRevisionReceived(FirmwareVersion version) override;
//=========================================================================
// juce::Timer Implementation
void timerCallback() override;
private:
bool updateIsAvailable = false;
bool firmwareUpdateInProgress = false;
File firmwareFileSelected;
//std::unique_ptr<TextButton> checkUpdateBtn;
std::unique_ptr<PathBrowserComponent> fileBrowser;
std::unique_ptr<TextButton> doUpdateBtn;
std::unique_ptr<TextEditor> infoBox;
std::unique_ptr<Label> firmwareStatusLabel;
String msgLog;
bool infoNeedsUpdate = false;
const int infoUpdateTimeoutMs = 100;
// Style helpers
int margin = 12;
int doubleMargin = margin * 2;
float buttonWidthScalar = 0.3f;
int buttonHeight = 30;
};
| [
"sicurella12@gmail.com"
] | sicurella12@gmail.com |
74ba59947770c99d3225267fce90476701e7a409 | e813fa969d780a51cf4cbebb32ec2b9dc229f78d | /IControls/DataSource/PageDataSource.h | e16b70ef2c524827f28c5d03d996ac0bb2e7bbf3 | [] | no_license | aocsa/mlearning_firstversion_ipad | 8e63bbfde908178ccdee70dede3af3ae107b93cd | 6c7b283e49f06e0794d7c29af73e59c16459d98f | refs/heads/master | 2020-12-31T05:10:25.817683 | 2016-04-24T20:10:11 | 2016-04-24T20:10:11 | 56,719,109 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,576 | h | #include "pch.h"
namespace IControls
{
namespace DataSource
{
public ref class PageDataSource sealed : public BindableBase
{
public:
PageDataSource();
#pragma region Properties
public:
property Platform::String^ Name
{
void set(Platform::String^ value){ this->_name = value; }
Platform::String^ get(){
return this->_name; PropertyChanged(this,
ref new Windows::UI::Xaml::Data::PropertyChangedEventArgs("Name"));
}
}
property Platform::String^ Description
{
void set(Platform::String^ value){ this->_description = value; }
Platform::String^ get(){ return this->_description; }
}
property Windows::UI::Xaml::Media::Imaging::BitmapImage ^ ImageContent
{
void set(Windows::UI::Xaml::Media::Imaging::BitmapImage ^value)
{
_imagecontent = value;
PropertyChanged(this,
ref new Windows::UI::Xaml::Data::PropertyChangedEventArgs("ImageSource"));
}
Windows::UI::Xaml::Media::Imaging::BitmapImage^ get(){ return _imagecontent; }
}
property Windows::UI::Color BorderColor
{
void set(Windows::UI::Color value){
_bordercolor = value;
PropertyChanged(this,
ref new Windows::UI::Xaml::Data::PropertyChangedEventArgs("BorderColor"));
}
Windows::UI::Color get(){ return _bordercolor; }
}
private:
Platform::String^ _name, ^ _description;
Windows::UI::Xaml::Media::Imaging::BitmapImage^ _imagecontent;
Windows::UI::Color _bordercolor;
#pragma endregion
};
}
} | [
"aocsa.cs@gmail.com"
] | aocsa.cs@gmail.com |
c3ad1a637d339ce54793ab15efbff3bdc0ff7198 | c24ee28d620c4c5c0082f1710a284954d52f4b62 | /CBM_Cart_On_Cart/src/outputmodules/outputcp.cpp | 6e1d91e37581db8a3c91fdbcae0f1798d25760e5 | [] | no_license | wenkeli/Cerebellum_simulation | 7604da8525e9254fc95205c08285428ad797fec3 | f0b22505113d62ebb24078ae24de2d6566666242 | refs/heads/master | 2020-12-24T02:55:36.955955 | 2020-01-31T03:34:34 | 2020-01-31T03:34:34 | 237,354,640 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,718 | cpp | /*
* outputcp.cpp
*
* Created on: May 27, 2011
* Author: mhauskn
*/
#include "../../includes/outputmodules/outputcp.h"
CPOutput::CPOutput(unsigned int numNC, float ts, float tsus) :
BaseOutput(numNC, ts, tsus)
{
gForceInc=0.1;
gForceIncDecay=exp(-(timeStepSize/5));
gForceDecay=exp(-(timeStepSize/gForceDecayT));
gForce=0;
gForceLeak=timeStepSize*tsUnitInS*gForceLeakConst;
vForce=eForceLeak;
}
CPOutput::CPOutput(ifstream &infile):BaseOutput(infile)
{
infile.read((char *)&gForceDecay, sizeof(float));
infile.read((char *)&gForce, sizeof(float));
infile.read((char *)&gForceLeak, sizeof(float));
infile.read((char *)&vForce, sizeof(float));
gForceInc=0.1;
gForceIncDecay=exp(-(timeStepSize/5));
gForceDecay=exp(-(timeStepSize/gForceDecayT));
gForce=0;
gForceLeak=timeStepSize*tsUnitInS*gForceLeakConst;
vForce=eForceLeak;
}
void CPOutput::exportState(ofstream &outfile)
{
BaseOutput::exportState(outfile);
outfile.write((char *)&gForceDecay, sizeof(float));
outfile.write((char *)&gForce, sizeof(float));
outfile.write((char *)&gForceLeak, sizeof(float));
outfile.write((char *)&vForce, sizeof(float));
}
void CPOutput::calcOutput()
{
float inputSum=0;
for(int i=0; i<numNCIn; i++)
{
inputSum+=apNCIn[i];
}
inputSum=inputSum/numNCIn;
//inputSum=inputSum*inputSum;
//inputSum *= 2;
// gForceInc=gForceInc-(gForceInc-0.1)*gForceIncDecay;
// gForceInc=gForceInc+inputSum*0.03;
// gForce=gForce*gForceDecay;
// gForce=gForce+inputSum*gForceInc;
gForce += inputSum * 0.05;
gForce *= .99;
output = gForce;
// vForce=vForce+gForce*(eForce-vForce)+gForceLeak*(eForceLeak-vForce);
// output=(vForce-eForceLeak)/(eForce-eForceLeak);
}
| [
"17211989+wenkeli@users.noreply.github.com"
] | 17211989+wenkeli@users.noreply.github.com |
362f894f3a49e6176325a4f8184edc032cbba894 | f6871790b6c438cfd2b0b4f45e247992ed2a1a0a | /third_party/libigl/include/igl/kkt_inverse.cpp | a3c3c8b574f73586da85636e20e15519abd42401 | [
"Apache-2.0",
"MPL-2.0"
] | permissive | rahulpowar/monster-mash | c202e5f117f101129cbc487f52e446bd74f50783 | 535167fb3178479e9fa6e2e04bf9b5232cfffac6 | refs/heads/main | 2023-03-11T19:13:29.367921 | 2021-02-28T16:54:40 | 2021-02-28T16:54:40 | 343,154,572 | 7 | 1 | Apache-2.0 | 2021-02-28T16:33:39 | 2021-02-28T16:33:39 | null | UTF-8 | C++ | false | false | 3,026 | cpp | // This file is part of libigl, a simple c++ geometry processing library.
//
// Copyright (C) 2013 Alec Jacobson <alecjacobson@gmail.com>
//
// This Source Code Form is subject to the terms of the Mozilla Public License
// v. 2.0. If a copy of the MPL was not distributed with this file, You can
// obtain one at http://mozilla.org/MPL/2.0/.
#include "kkt_inverse.h"
#include <Eigen/Core>
#include <Eigen/LU>
#include "EPS.h"
#include <cstdio>
template <typename T>
IGL_INLINE void igl::kkt_inverse(
const Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic>& A,
const Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic>& Aeq,
const bool use_lu_decomposition,
Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic>& S)
{
typedef Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic> Mat;
// This threshold seems to matter a lot but I'm not sure how to
// set it
const T treshold = igl::FLOAT_EPS;
//const T treshold = igl::DOUBLE_EPS;
const int n = A.rows();
assert(A.cols() == n);
const int m = Aeq.rows();
assert(Aeq.cols() == n);
// Lagrange multipliers method:
Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic> LM(n + m, n + m);
LM.block(0, 0, n, n) = A;
LM.block(0, n, n, m) = Aeq.transpose();
LM.block(n, 0, m, n) = Aeq;
LM.block(n, n, m, m).setZero();
Mat LMpinv;
if(use_lu_decomposition)
{
// if LM is close to singular, use at your own risk :)
LMpinv = LM.inverse();
}else
{
// use SVD
typedef Eigen::Matrix<T, Eigen::Dynamic, 1> Vec;
Vec singValues;
Eigen::JacobiSVD<Mat> svd;
svd.compute(LM, Eigen::ComputeFullU | Eigen::ComputeFullV );
const Mat& u = svd.matrixU();
const Mat& v = svd.matrixV();
const Vec& singVals = svd.singularValues();
Vec pi_singVals(n + m);
int zeroed = 0;
for (int i=0; i<n + m; i++)
{
T sv = singVals(i, 0);
assert(sv >= 0);
// printf("sv: %lg ? %lg\n",(double) sv,(double)treshold);
if (sv > treshold) pi_singVals(i, 0) = T(1) / sv;
else
{
pi_singVals(i, 0) = T(0);
zeroed++;
}
}
printf("kkt_inverse : %i singular values zeroed (threshold = %e)\n", zeroed, treshold);
Eigen::DiagonalMatrix<T, Eigen::Dynamic> pi_diag(pi_singVals);
LMpinv = v * pi_diag * u.transpose();
}
S = LMpinv.block(0, 0, n, n + m);
//// debug:
//mlinit(&g_pEngine);
//
//mlsetmatrix(&g_pEngine, "A", A);
//mlsetmatrix(&g_pEngine, "Aeq", Aeq);
//mlsetmatrix(&g_pEngine, "LM", LM);
//mlsetmatrix(&g_pEngine, "u", u);
//mlsetmatrix(&g_pEngine, "v", v);
//MatrixXd svMat = singVals;
//mlsetmatrix(&g_pEngine, "singVals", svMat);
//mlsetmatrix(&g_pEngine, "LMpinv", LMpinv);
//mlsetmatrix(&g_pEngine, "S", S);
//int hu = 1;
}
#ifdef IGL_STATIC_LIBRARY
// Explicit template instantiation
template void igl::kkt_inverse<double>(Eigen::Matrix<double, -1, -1, 0, -1, -1> const&, Eigen::Matrix<double, -1, -1, 0, -1, -1> const&, bool, Eigen::Matrix<double, -1, -1, 0, -1, -1>&);
#endif
| [
"dvoromar@google.com"
] | dvoromar@google.com |
6cd3d1369949242ab4da31d529a94fca425b17b7 | a23d9df9a83349b61139ca3aefda687a2bbd8f97 | /test/core/utility_macros/likely_unlikely.cpp | c9762186f45238ccb68b40b7da537ce70c6d06b7 | [] | no_license | respu/vrm_core | 46d657a95672e07870b4c6e3c8728227e34370a0 | d768d2e61938a986f807d4c595fe3297d17df99a | refs/heads/master | 2021-01-14T19:30:00.758367 | 2015-10-23T16:46:54 | 2015-10-23T16:46:54 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 328 | cpp | #include "../../utils/test_utils.hpp"
#include <vrm/core/utility_macros.hpp>
int main()
{
using namespace vrm::core;
volatile int x = 10;
volatile bool y = true;
if(VRM_CORE_LIKELY(x))
{
TEST_ASSERT(true);
}
if(VRM_CORE_UNLIKELY(y))
{
TEST_ASSERT(true);
}
return 0;
} | [
"vittorio.romeo@outlook.com"
] | vittorio.romeo@outlook.com |
74d255a76301889efcc03a6d0b8aec3f8761e322 | 10d97d25226c473acaecfaeef153f000481b7259 | /test_pid/calibrage/calibrage.ino | 0460d6c480fb3e0630399f59d32b689684708b35 | [] | no_license | taoufiq26/DroneProject | e37dbf264e8981fb26342e8d89e88af3193a87dd | 1a7946804653e2aeb50a50aad49fc7da99fcf0a9 | refs/heads/master | 2021-01-20T04:30:09.895938 | 2015-01-08T00:44:23 | 2015-01-08T00:44:23 | 28,640,933 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 632 | ino | #include <Servo.h>
#define MAX_SIGNAL 2000
#define MIN_SIGNAL 700
#define MOTOR_PIN 5
Servo motor;
void setup() {
Serial.begin(9600);
Serial.println("Program begin...");
Serial.println("This program will calibrate the ESC.");
motor.attach(MOTOR_PIN);
Serial.println("Now writing maximum output.");
Serial.println("Turn on power source, then wait 2 seconds and press any key.");
motor.writeMicroseconds(MAX_SIGNAL);
// Wait for input
while (!Serial.available());
Serial.read();
// Send min output
Serial.println("Sending minimum output");
motor.writeMicroseconds(MIN_SIGNAL);
}
void loop() {
}
| [
"taoufiq2006@gmail.com"
] | taoufiq2006@gmail.com |
cc21d294ebb975f00cff237b9867c096772b59e0 | e75ba9f6abb7ea98a026af5d0525873d6e526a9a | /C++/ITVDN/Starter/Cyclic/Source.cpp | ef64bf87de34267b4e8b862138e1c01e4d6fbffd | [] | no_license | NarekID/Independent_study | 64249d9955b9e15663420f17954e8824159c07e1 | 63d9aba28f1106a1dfd850f465adb3f8ba13c915 | refs/heads/master | 2020-09-15T06:52:58.600832 | 2020-01-01T20:27:29 | 2020-01-01T20:27:29 | 223,345,745 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,314 | cpp | #include <iostream>
using namespace std;
int main()
{
setlocale(LC_ALL, "rus");
cout << "Дополнительное задание\n" << endl;
cout << "\tВариант 1\n" << endl;
{
int width, height, i, j;
cout << "Введите длине: ";
cin >> width;
cout << "Введите ширину: ";
cin >> height;
for (i = 0; i < height; i++)
{
for (j = 0; j < width; j++)
{
cout << "*";
}
cout << endl;
}
cout << endl;
}
cout << "\n\tВариант 2\n" << endl;
{
int width, height, i, j;
cout << "Введите длине: ";
cin >> width;
cout << "Введите ширину: ";
cin >> height;
cout << endl;
for (i = 1; i <= height; i++)
{
for (j = 1; j <= width; j++)
{
if (i == 1 || i == height || j == 1 || j == width)
{
cout << "*";
}
else
{
cout << " ";
}
}
cout << endl;
}
cout << endl;
}
cout.width(100);
cout.fill('-');
cout << "\n";
cout << "\nЗадание 2\n" << endl;
{
int firstNum, secondNum, sum = 0, i;
cout << "Введите начальное число: ";
cin >> firstNum;
cout << endl << "Введите конечное число: ";
cin >> secondNum;
while (firstNum > secondNum)
{
cout << "Неверно! Второе число больше: ";
cin >> secondNum;
}
cout << endl << "Нечетные числа от " << firstNum << " до " << secondNum << ": ";
for (i= firstNum + 1; i < secondNum; i++)
{
sum += i;
if (i % 2 == 1)
{
cout << i << " ";
}
}
cout << "\nСумма всех чисел от " << firstNum << " до " << secondNum << " равна " <<sum << endl;
cout << endl;
}
cout.width(100);
cout.fill('-');
cout << "\n";
cout << "\nЗадание 3\n" << endl;
{
{
int a, b;
a = 10;
b = 30;
for (int i = 1; i <= a; i++)
{
for (int j = 1; j <= b; j++)
{
if (i == 1 || i == a || j == 1 || j == b)
{
cout << "*";
}
else
{
cout << " ";
}
}
cout << endl;
}
}
cout << "\n\n";
{
int z = 11;
for (int i = 1; i <= z; i++)
{
for (int j = 1; j <= i; j++)
{
if (i == j)
{
cout << "*";
}
else if (j == 1 || i == z)
{
cout << "*";
}
else
{
cout << " ";
}
}
cout << endl;
}
}
cout << "\n\n";
{
int k = 20, iIndex = 0, jIndex = 0, jIndex2 = 0, mid = (k >> 1);
for (int i = 1; i <= mid; i++)
{
for (int j = 1; j <= k; j++)
{
if (i == 1 && j == mid)
{
cout << "*";
iIndex = i + 1;
jIndex = j - 1;
jIndex2 = j + 1;
}
else if (i == iIndex && j == jIndex)
{
cout << "*";
jIndex--;
}
else if (i == iIndex && j == jIndex2)
{
cout << "*";
jIndex2++;
iIndex += 1;
}
else if (i == mid && j != k)
{
cout << "*";
}
else
{
cout << " ";
}
}
cout << endl;
}
}
cout << "\n\n";
{
int n = 11, i, j, mid = (n >> 1) + 1; //Для симметрии n должен быть НЕЧЕТНЫМ!!
for (i = 1; i <= n; i++)
{
for (j = 1; j <= n; j++)
{
if (i <= mid)
{
if (i + j == mid + 1 || j - i == mid - 1)
{
cout << "*";
}
else
{
cout << " ";
}
}
else
{
if (j <= mid)
{
if (i - j == mid - 1)
{
cout << "*";
}
else
{
cout << " ";
}
}
else
{
if (i + j == n + mid)
{
cout << "*";
}
else
{
cout << " ";
}
}
}
}
cout << endl;
}
}
}
cout.width(100);
cout.fill('-');
cout << "\n";
cout << "\nЗадание 4\n" << endl;
{
int f, factorial=1;
cout << "\nВведите количество клиентов: ";
cin >> f;
int f1 = f;
do
{
factorial *= f;
if (f == 0)
{
factorial = 1;
break;
}
f--;
} while (f > 0);
cout << "На одной машине для " << f1 << " клиентов длступно " << factorial << " вариантов доставки товара." << endl;
}
system("pause");
return 0;
} | [
"narek2011n@gmail.com"
] | narek2011n@gmail.com |
6de74204631178519726f4c691fa736988353fa8 | e4cf94694330f3f7fdbb6ecf932c19a8637e1878 | /moc_Book_chapter.cpp | a15c42b52cbad0a5f5a4e64711f3bda5dcc2d8e0 | [] | no_license | Reader6/ReadClient | 20a77f4ea6bf648aaab7a25c1bd51d28bd1eee9a | 78a0175956675cf3f5c8b5e2ef97d5be5544dfca | refs/heads/master | 2021-01-16T04:01:31.107972 | 2020-07-02T16:47:06 | 2020-07-02T16:47:06 | 242,971,016 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 6,929 | cpp | /****************************************************************************
** Meta object code from reading C++ file 'Book_chapter.h'
**
** Created by: The Qt Meta Object Compiler version 67 (Qt 5.14.0)
**
** WARNING! All changes made in this file will be lost!
*****************************************************************************/
#include <memory>
#include "Book_chapter.h"
#include <QtCore/qbytearray.h>
#include <QtCore/qmetatype.h>
#if !defined(Q_MOC_OUTPUT_REVISION)
#error "The header file 'Book_chapter.h' doesn't include <QObject>."
#elif Q_MOC_OUTPUT_REVISION != 67
#error "This file was generated using the moc from 5.14.0. It"
#error "cannot be used with the include files from this version of Qt."
#error "(The moc has changed too much.)"
#endif
QT_BEGIN_MOC_NAMESPACE
QT_WARNING_PUSH
QT_WARNING_DISABLE_DEPRECATED
struct qt_meta_stringdata_Book_chapter_t {
QByteArrayData data[8];
char stringdata0[67];
};
#define QT_MOC_LITERAL(idx, ofs, len) \
Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(len, \
qptrdiff(offsetof(qt_meta_stringdata_Book_chapter_t, stringdata0) + ofs \
- idx * sizeof(QByteArrayData)) \
)
static const qt_meta_stringdata_Book_chapter_t qt_meta_stringdata_Book_chapter = {
{
QT_MOC_LITERAL(0, 0, 12), // "Book_chapter"
QT_MOC_LITERAL(1, 13, 13), // "sourceChanged"
QT_MOC_LITERAL(2, 27, 0), // ""
QT_MOC_LITERAL(3, 28, 11), // "nameChanged"
QT_MOC_LITERAL(4, 40, 10), // "strChanged"
QT_MOC_LITERAL(5, 51, 6), // "source"
QT_MOC_LITERAL(6, 58, 4), // "name"
QT_MOC_LITERAL(7, 63, 3) // "str"
},
"Book_chapter\0sourceChanged\0\0nameChanged\0"
"strChanged\0source\0name\0str"
};
#undef QT_MOC_LITERAL
static const uint qt_meta_data_Book_chapter[] = {
// content:
8, // revision
0, // classname
0, 0, // classinfo
3, 14, // methods
3, 32, // properties
0, 0, // enums/sets
0, 0, // constructors
0, // flags
3, // signalCount
// signals: name, argc, parameters, tag, flags
1, 0, 29, 2, 0x06 /* Public */,
3, 0, 30, 2, 0x06 /* Public */,
4, 0, 31, 2, 0x06 /* Public */,
// signals: parameters
QMetaType::Void,
QMetaType::Void,
QMetaType::Void,
// properties: name, type, flags
5, QMetaType::QString, 0x00495103,
6, QMetaType::QString, 0x00495103,
7, QMetaType::QString, 0x00495103,
// properties: notify_signal_id
0,
1,
2,
0 // eod
};
void Book_chapter::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a)
{
if (_c == QMetaObject::InvokeMetaMethod) {
auto *_t = static_cast<Book_chapter *>(_o);
Q_UNUSED(_t)
switch (_id) {
case 0: _t->sourceChanged(); break;
case 1: _t->nameChanged(); break;
case 2: _t->strChanged(); break;
default: ;
}
} else if (_c == QMetaObject::IndexOfMethod) {
int *result = reinterpret_cast<int *>(_a[0]);
{
using _t = void (Book_chapter::*)();
if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&Book_chapter::sourceChanged)) {
*result = 0;
return;
}
}
{
using _t = void (Book_chapter::*)();
if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&Book_chapter::nameChanged)) {
*result = 1;
return;
}
}
{
using _t = void (Book_chapter::*)();
if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&Book_chapter::strChanged)) {
*result = 2;
return;
}
}
}
#ifndef QT_NO_PROPERTIES
else if (_c == QMetaObject::ReadProperty) {
auto *_t = static_cast<Book_chapter *>(_o);
Q_UNUSED(_t)
void *_v = _a[0];
switch (_id) {
case 0: *reinterpret_cast< QString*>(_v) = _t->source(); break;
case 1: *reinterpret_cast< QString*>(_v) = _t->name(); break;
case 2: *reinterpret_cast< QString*>(_v) = _t->str(); break;
default: break;
}
} else if (_c == QMetaObject::WriteProperty) {
auto *_t = static_cast<Book_chapter *>(_o);
Q_UNUSED(_t)
void *_v = _a[0];
switch (_id) {
case 0: _t->setSource(*reinterpret_cast< QString*>(_v)); break;
case 1: _t->setName(*reinterpret_cast< QString*>(_v)); break;
case 2: _t->setStr(*reinterpret_cast< QString*>(_v)); break;
default: break;
}
} else if (_c == QMetaObject::ResetProperty) {
}
#endif // QT_NO_PROPERTIES
Q_UNUSED(_a);
}
QT_INIT_METAOBJECT const QMetaObject Book_chapter::staticMetaObject = { {
QMetaObject::SuperData::link<QObject::staticMetaObject>(),
qt_meta_stringdata_Book_chapter.data,
qt_meta_data_Book_chapter,
qt_static_metacall,
nullptr,
nullptr
} };
const QMetaObject *Book_chapter::metaObject() const
{
return QObject::d_ptr->metaObject ? QObject::d_ptr->dynamicMetaObject() : &staticMetaObject;
}
void *Book_chapter::qt_metacast(const char *_clname)
{
if (!_clname) return nullptr;
if (!strcmp(_clname, qt_meta_stringdata_Book_chapter.stringdata0))
return static_cast<void*>(this);
return QObject::qt_metacast(_clname);
}
int Book_chapter::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
_id = QObject::qt_metacall(_c, _id, _a);
if (_id < 0)
return _id;
if (_c == QMetaObject::InvokeMetaMethod) {
if (_id < 3)
qt_static_metacall(this, _c, _id, _a);
_id -= 3;
} else if (_c == QMetaObject::RegisterMethodArgumentMetaType) {
if (_id < 3)
*reinterpret_cast<int*>(_a[0]) = -1;
_id -= 3;
}
#ifndef QT_NO_PROPERTIES
else if (_c == QMetaObject::ReadProperty || _c == QMetaObject::WriteProperty
|| _c == QMetaObject::ResetProperty || _c == QMetaObject::RegisterPropertyMetaType) {
qt_static_metacall(this, _c, _id, _a);
_id -= 3;
} else if (_c == QMetaObject::QueryPropertyDesignable) {
_id -= 3;
} else if (_c == QMetaObject::QueryPropertyScriptable) {
_id -= 3;
} else if (_c == QMetaObject::QueryPropertyStored) {
_id -= 3;
} else if (_c == QMetaObject::QueryPropertyEditable) {
_id -= 3;
} else if (_c == QMetaObject::QueryPropertyUser) {
_id -= 3;
}
#endif // QT_NO_PROPERTIES
return _id;
}
// SIGNAL 0
void Book_chapter::sourceChanged()
{
QMetaObject::activate(this, &staticMetaObject, 0, nullptr);
}
// SIGNAL 1
void Book_chapter::nameChanged()
{
QMetaObject::activate(this, &staticMetaObject, 1, nullptr);
}
// SIGNAL 2
void Book_chapter::strChanged()
{
QMetaObject::activate(this, &staticMetaObject, 2, nullptr);
}
QT_WARNING_POP
QT_END_MOC_NAMESPACE
| [
"1305665118@qq.com"
] | 1305665118@qq.com |
9e58380530e69b2270df9664aaeb6dbc53e39244 | 92e78fbc204a39931a2b1928606f12110ddd0829 | /inc/InputMgr.h | e06901f7ad56cbf31805299ab95ac57d3f43cd62 | [] | no_license | zachcooper/Blast-Commander_v3 | fd4225207973f0d9d090198cf4ea9e810b0a4f1d | 31828ff2ea43e80a7f3ba839896f1257ba14aedb | refs/heads/master | 2020-03-15T23:57:41.682014 | 2018-05-14T03:33:56 | 2018-05-14T03:33:56 | 132,404,491 | 0 | 1 | null | 2018-05-12T00:32:10 | 2018-05-07T03:53:00 | Makefile | UTF-8 | C++ | false | false | 1,197 | h | /*
* InputMgr.h
*
* Created on: Mar 4, 2018
* Author: sushil
*/
#ifndef INPUTMGR_H_
#define INPUTMGR_H_
#include <OISEvents.h>
#include <OISInputManager.h>
#include <OISKeyboard.h>
#include <OISMouse.h>
# include <SdkTrays.h>
# include <SdkCameraMan.h>
#include <Mgr.h>
class Engine;
class InputMgr:
public Mgr,
public OIS::KeyListener,
public OIS::MouseListener {
public:
InputMgr(Engine *engine);
virtual ~InputMgr();
virtual bool keyPressed(const OIS::KeyEvent& ke);
virtual bool keyReleased(const OIS::KeyEvent& ke);
virtual bool mouseMoved(const OIS::MouseEvent& me);
virtual bool mousePressed(const OIS::MouseEvent& me, OIS::MouseButtonID id);
virtual bool mouseReleased(const OIS::MouseEvent& me, OIS::MouseButtonID id);
OIS::InputManager* mInputMgr;
OIS::Keyboard* mKeyboard;
OIS::Mouse* mMouse;
bool isPlus;
void Init();
void Stop();
void Tick(float dt);
void LoadLevel();
float keyboardTimer;
const static float keyTime = 0.1f;
float deltaDesiredSpeed, deltaDesiredHeading;
void UpdateCamera(float dt);
void UpdateVelocityAndSelection(float dt);
bool mMovableFound;
Ogre::RaySceneQuery* mRaySceneQuery;
};
#endif /* INPUTMGR_H_ */
| [
"you@example.com"
] | you@example.com |
847a0ee4dfcd571460424c7560e65577b1d711c5 | a1d319f22634908f4fb31ac7c2a21f66225cc991 | /Shared/cpp/range-v3/include/range/v3/algorithm/aux_/sort_n_with_buffer.hpp | 7b23103df6cd45aa8820133f175a2b2e7daf40f4 | [] | no_license | sdl-research/sdl-externals | 2ee2ae43a5d641cc0e2c0a7c642f48d15f32fbeb | 56459e0124eadf38ff551494b81544cb678a71d7 | refs/heads/master | 2021-01-17T15:06:59.783100 | 2016-07-10T06:40:45 | 2016-07-10T06:40:45 | 28,290,682 | 4 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,731 | hpp | /// \file
// Range v3 library
//
// Copyright Eric Niebler 2014
//
// Use, modification and distribution is subject to 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)
//
// Project home: https://github.com/ericniebler/range-v3
//
// Copyright (c) 2009 Alexander Stepanov and Paul McJones
//
// 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. The authors make no
// representations about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
//
// Algorithms from
// Elements of Programming
// by Alexander Stepanov and Paul McJones
// Addison-Wesley Professional, 2009
#ifndef RANGES_V3_ALGORITHM_AUX_SORT_N_WITH_BUFFER_HPP
#define RANGES_V3_ALGORITHM_AUX_SORT_N_WITH_BUFFER_HPP
#include <tuple>
#include <range/v3/range_fwd.hpp>
#include <range/v3/utility/iterator.hpp>
#include <range/v3/utility/functional.hpp>
#include <range/v3/utility/iterator_concepts.hpp>
#include <range/v3/utility/iterator_traits.hpp>
#include <range/v3/algorithm/aux_/merge_n_with_buffer.hpp>
#include <range/v3/utility/static_const.hpp>
namespace ranges
{
inline namespace v3
{
namespace aux
{
struct sort_n_with_buffer_fn
{
template<typename I, typename B, typename C = ordered_less, typename P = ident,
typename VI = iterator_common_reference_t<I>,
typename VB = iterator_common_reference_t<B>,
CONCEPT_REQUIRES_(
Same<VI, VB>() &&
IndirectlyCopyable<I, B>() &&
Mergeable<B, I, I, C, P, P>()
)>
I operator()(I begin, iterator_difference_t<I> n, B buff, C r = C{}, P p = P{}) const
{
auto half = n / 2;
if(0 == half)
return next(begin, n);
I m = (*this)(begin, half, buff, r);
(*this)(m, n - half, buff, r);
return merge_n_with_buffer(begin, half, m, n - half, buff, r, p);
}
};
namespace
{
constexpr auto&& sort_n_with_buffer = static_const<sort_n_with_buffer_fn>::value;
}
} // namespace aux
} // namespace v3
} // namespace ranges
#endif // include guard
| [
"graehl@gmail.com"
] | graehl@gmail.com |
2e9489df3228f200942d713a73acce61dbb957c1 | 6c6d11d8ba7377ee90a57ce2b3e0405071d85c3d | /main.cpp | bfe4e6d55d4ee799df7e860cae9b1da33dae1cb5 | [] | no_license | Palmik/MazeMan | 42c97a4fadefb77f1f218cdf21b975fd14e32928 | 79e3929fd46621aee0289d075680d2a1a0aebab2 | refs/heads/master | 2016-09-10T10:07:51.123520 | 2011-01-08T22:23:22 | 2011-01-08T22:23:22 | 1,504,126 | 1 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 1,928 | cpp | ////////////////////////////////////////////////////////////////////////////
// //
// Copyright 2010 Petr Pilar //
// //
// This file is part of MazeMan. //
// //
// MazeMan 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. //
// //
// MazeMan 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 MazeMan. If not, see <http://www.gnu.org/licenses/>. //
// //
////////////////////////////////////////////////////////////////////////////
#include <QtGui/QApplication>
#include "gamewindow.h"
#include "core/svgtheme.h"
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
SvgTheme* myTheme = new SvgTheme(QString(":/resources/themes/default/sprite.svg"));
GameWindow game(myTheme);
QObject::connect(&game, SIGNAL(quitRequested()), &app, SLOT(quit()));
game.start();
return app.exec();
}
| [
"Palmik@PalmikPC.(none)"
] | Palmik@PalmikPC.(none) |
ddfe5f4a1f9b559d25d3f12ffc5d7c90b5ce10de | 5a4f810d0c1c5be6148c4e47d0149b6f08897145 | /main.cpp | 0043613287407a6365f9b3b2932d116dea6831c6 | [] | no_license | carogatica/Final-AyED | 6d682c4795be9eb991d6c6bd772871872ae39b9b | 75bfac89e7cf2e85439b55401fa0e1c1d37f4c88 | refs/heads/master | 2021-04-26T07:36:34.705937 | 2016-09-21T20:35:11 | 2016-09-21T20:35:11 | 68,853,455 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 8,158 | cpp | #include <iostream>
#include <math.h>
#include <iomanip>
#include <time.h>
#include <stdio.h>
#include <stdlib.h>
#include <fstream>
#include <sstream>
#include <string>
using namespace std;
#define N 100
#define ESQ 81
#define SEM 176
#include "Esquinas-Cola.cpp"
#include "HeapMinVehiculos.cpp"
#include "Semaforos-Lista.cpp"
#include "Grafo.cpp"
void play(Grafo*,int,int,int,Listasemaforos*); //Inicia el trafico en la ciudad.
void simulacion(Grafo*,Listasemaforos*,Vehiculo*); //Simula hasta que MiAuto llega a su posicion final.
void verde(Semaforo *,Listasemaforos *); //Se encarga de que N vehiculos crucen de semaforo a semaforo.
void recalculando(Grafo *, Vehiculo *);
int main(void){
Grafo *ciudad=new Grafo();
Listasemaforos *Semaforos=new Listasemaforos();
int posInAuto;
int posFinAuto;
int posAcAuto;
int nAutos,nAmbulancias,nPatrulleros;
cout<<" BIENVENIDO A LA SIMULACION DE TRAFICO "<<endl<<endl;
cout<<"Ingrese la posicion inicial de su auto: ";
cin>>posInAuto;
cout<<endl<<"Ingrese la posicion a la que desea llegar: ";
cin>>posFinAuto;
while(posInAuto<0||posInAuto>=ESQ||posFinAuto<0||posFinAuto>=ESQ)
{
cout<<endl<<"La posicion incial o la final no son validas. Por favor ingresar nuevos valores."<<endl;
cout<<"Ingrese desde donde desea que inicie su auto: ";
cin>>posInAuto;
cout<<endl<<"Ingrese el destino que pretende: ";
cin>>posFinAuto;
}
cout<<endl<<"Ingrese la cantidad de AUTOS a crear: ";
cin>>nAutos;
while (nAutos<0)
{
cout<<"Ingreso un numero de autos negativo."<<endl;
cout<<endl<<"Ingrese la cantidad de AUTOS a crear: ";
cin>>nAutos;
}
cout<<endl<<"Ingrese la cantidad de PATRULLEROS a crear: ";
cin>>nPatrulleros;
while (nPatrulleros<0)
{
cout<<"Ingreso un numero de patrulleros negativo."<<endl;
cout<<endl<<"Ingrese la cantidad de PATRULLEROS a crear: ";
cin>>nPatrulleros;
}
cout<<endl<<"Ingrese la cantidad de AMBULANCIAS a crear: ";
cin>>nAmbulancias;
while (nAmbulancias<0)
{
cout<<"Ingreso un numero de ambulancias negativo."<<endl;
cout<<endl<<"Ingrese la cantidad de AMBULANCIAS a crear: ";
cin>>nAmbulancias;
}
Vehiculo *miAuto = new Vehiculo(1000,posInAuto,posFinAuto);
ciudad->armarCiudad(Semaforos);
play(ciudad,nAutos,nPatrulleros,nAmbulancias,Semaforos);
simulacion(ciudad,Semaforos,miAuto);
return 0;
}
void play(Grafo *city, int nAutos, int nPatrulleros, int nAmbulancias,Listasemaforos* S)
{
Nodosemaforo *nodo;
Semaforo *semAux;
int capacidadCiudad=0;
nodo = S->get_czo();
while(nodo!=NULL){
semAux = nodo->get_dato();
capacidadCiudad+=semAux->get_capacidad_cola();
nodo = nodo->get_next();
}
cout<<endl<<"Cantidad de vehiculos que pueden circular por la ciudad: "<<capacidadCiudad<<endl;
cout<<"Cantidad de vehiculos que se quieren crear: "<<nAutos+nPatrulleros+nAmbulancias<<endl;
if(capacidadCiudad>nAutos+nPatrulleros+nAmbulancias) // Comprueba que los vehiculos a crear sean menos que la capacidad de la ciudad.
{
for(int i=0;i<nAutos;i++){
Vehiculo *a=new Vehiculo("Auto");
S->ubicarAleatorio(a);
a->set_camino(city->dijkstra(a->get_posInicial(),a->get_posFinal()));
}
for(int i=0;i<nPatrulleros;i++){
Vehiculo *p=new Vehiculo("Patrullero");
S->ubicarAleatorio(p);
p->set_camino(city->dijkstra(p->get_posInicial(),p->get_posFinal()));
}
for(int i=0;i<nAmbulancias;i++){
Vehiculo *am=new Vehiculo("Ambulancia");
S->ubicarAleatorio(am);
am->set_camino(city->dijkstra(am->get_posInicial(),am->get_posFinal()));
}
S->ordenar();
city->actualizarMA(S);
}
else {
cout<<endl<<"No se puede generar tantos vehiculos. Prube con una cantidad menor"<<endl;
cout<<" y vuelva a iniciar la simulacion."<<endl;
exit(1);
}
}
void simulacion(Grafo *ciudad,Listasemaforos *Semaforos,Vehiculo *miAuto)
{
Nodosemaforo *nodo;
Semaforo *semAux;
int iteracion=0;
string p;
Semaforos->ubicarMiAuto(miAuto);
miAuto->set_camino(ciudad->dijkstra(miAuto->get_posInicial(),miAuto->get_posFinal()));
Semaforos->ordenar();
cout<<endl<<"Estado inicial de miAuto:"<<endl;
miAuto->printMiAuto();
ostringstream os;
os << "Inicio de la simulacion"<<endl;
os << "------------------------Iteracion Nro: " << iteracion << "-------------------------------" << endl;
p = os.str();
Semaforos->toPrint(p,iteracion);
while(miAuto->get_posActual()!=miAuto->get_posFinal())
{
nodo = Semaforos->get_czo();
iteracion++;
while(nodo!=NULL){
semAux = nodo->get_dato();
verde(semAux,Semaforos);
nodo = nodo->get_next();
}
Semaforos->ordenar();
cout<<endl<<"------------------------Iteracion Nro: " << iteracion << "-------------------------------" << endl;
miAuto->printMiAuto();
os.str(""); os.clear();
os << endl<<endl<<"------------------------Iteracion Nro: " << iteracion << "-------------------------------" << endl;
p = os.str();
Semaforos->toPrint(p,iteracion);
if((iteracion%2)==0&&(miAuto->get_posActual()!=miAuto->get_posFinal())){ //Recalculo el recorrido de mi auto cada 2 iteraciones
// cout<<"Recalculando..."<<endl;
ciudad->actualizarMA(Semaforos);
recalculando(ciudad,miAuto);
}
}
Semaforos->toPrint("\n\nUltima Iteracion \n",iteracion);
}
void verde(Semaforo *semActual,Listasemaforos *S)
{
Vehiculo *vehiculo; //Puntero con el que se manejan los diferentes vehiculos
Semaforo *nextSemaforo; //Puntero al semaforo al que intenta dirigirse "vehiculo"
HeapMinVehiculos *colaSem; //Variable para almacenar un puntereo a la cola del Semaforo actual.
int nextEsq =-1; //Entero de referencia al proximo nodo del grafo al que quiero moverme
semActual->resetCont(); //Resetamos el contador del semaforo a 0.
semActual->desbloquear();
colaSem = semActual->get_ColaDelSemaforo();
if(colaSem->heap_vacio()||colaSem == NULL){ //Si la cola del semaforo no existe o esta vacia:
semActual->bloquear(); //el semaforo se bloquea para que la simulacion continue.
}
while((semActual->getContador())<N*(semActual->get_carriles())&&(!semActual->bloqueado()))
{
vehiculo=colaSem->first(); //Tomo el primer vehiculo de la cola del semaforo
if(vehiculo!=NULL && vehiculo->circulando()){
if(vehiculo->get_posActual()==vehiculo->get_posInicial()){ //Si todavia no se movio del origen: Primer movimiento
vehiculo->put_recorrido(vehiculo->get_siguiente()); //Cargo el primer elemento (cabeza) en la cola de vertices recorrido
vehiculo->borrar_cabeza(); //borro el primer cabeza para no perder una iteracion
}
if(vehiculo->get_posActual()==vehiculo->get_siguiente()){ //Si entra aca es porque recalculo dijkstra, y este devuelve la ruta completa, en vez de lo que le falta para destino.
vehiculo->borrar_cabeza();
}
nextEsq=vehiculo->get_siguiente();
if(nextEsq>=0) {
nextSemaforo=S->buscar(nextEsq,semActual->get_nroEsquina()); //S->buscar(esquina siguiente, nro de esquina del semaforo)
if(nextSemaforo!=NULL){
if(nextSemaforo->cruzar(vehiculo)){ //Si hay lugar en el siguiente semaforo se encola el vehiculo
vehiculo = colaSem->extraer(); //Extraigo el vehiculo del semaforo actual
vehiculo->set_posActual(nextSemaforo->get_nroEsquina());
vehiculo->put_recorrido(vehiculo->get_siguiente()); //Cargo el elemento en la cola de vertices recorridos
vehiculo->borrar_cabeza(); //Borro el salto que ya hizo el vehiculo en su camino.
semActual->incrementarCont();
}
else semActual->bloquear(); //El semaforo se bloquea porque rojo devolvio 'false'
}
else semActual->bloquear(); //El semaforo estaba lleno
}
else semActual->bloquear();
}
else {
semActual->bloquear(); //El vehiculo no existe o ya llego a destino
if(vehiculo != NULL) colaSem->extraer();
}
}
}
void recalculando(Grafo *city, Vehiculo *miAuto)
{
ColaEsquinas *nuevoCamino;
nuevoCamino = city->dijkstra(miAuto->get_posActual(),miAuto->get_posFinal());
cout<<"El nuevo camino es: ";
nuevoCamino->print();
cout<<endl;
miAuto->set_camino(nuevoCamino);
}
| [
"carogatica.59@gmail.com"
] | carogatica.59@gmail.com |
6dd9cbca09b22bd23646dcdfdb786fc4a4790463 | fed9f14edb87cd975ac946e01e063df492a9929a | /src/abc/054/B.cpp | c6779b672cacd21c0c207c2cb4cef913d755f35d | [] | no_license | n-inja/kyoupro | ba91dd582488b2a8c7222242801cf3115ed7fd10 | 44c5a888984764b98e105780ca57d522a47d832d | refs/heads/master | 2021-01-01T06:52:59.655419 | 2020-10-17T13:28:35 | 2020-10-17T13:28:35 | 97,537,227 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 753 | cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vll = vector<ll>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;
int main() {
cin.tie(nullptr);
ios::sync_with_stdio(false);
int n, m;
cin >> n >> m;
vector<string> ori(n), sma(m);
for (int i = 0; i < n; i++) cin >> ori[i];
for (int i = 0; i < m; i++) cin >> sma[i];
for (int i = 0; i <= n - m; i++)
for (int j = 0; j <= n - m; j++) {
bool ok = true;
for (int k = 0; k < m; k++)
for (int l = 0; l < m; l++) {
if (ori[i + k][j + l] != sma[k][l]) ok = false;
}
if (ok) {
cout << "Yes" << endl;
return 0;
}
}
cout << "No" << endl;
return 0;
}
| [
"mccreepertakumi@gmail.com"
] | mccreepertakumi@gmail.com |
5c9000c7481335d16da26c1d86969480e8225209 | 65b765d6394b7c81ce26e6a2f73bb0c4b161e22b | /src/privatesend-client.cpp | ddc3962bc4cab5a0b46b9ed59ad4a1d6f8f6e0f6 | [
"MIT"
] | permissive | VNETCore/vnetcore | 3fffd0fb1a92bcafc16029b300c4eb13e9d8c31c | 6024e40c77bf087737297988022e1d39417d7dfb | refs/heads/master | 2020-03-21T05:37:57.191282 | 2018-06-22T12:39:21 | 2018-06-22T12:39:21 | 138,170,099 | 2 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 60,173 | cpp | // Copyright (c) 2014-2017 The Dash Core developers
// Copyright (c) 2018 The VNet Core developers
// Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include "privatesend-client.h"
#include "coincontrol.h"
#include "consensus/validation.h"
#include "core_io.h"
#include "init.h"
#include "masternode-sync.h"
#include "masternodeman.h"
#include "script/sign.h"
#include "txmempool.h"
#include "util.h"
#include "utilmoneystr.h"
#include <memory>
CPrivateSendClient privateSendClient;
void CPrivateSendClient::ProcessMessage(CNode* pfrom, std::string& strCommand, CDataStream& vRecv, CConnman& connman)
{
if(fMasterNode) return;
if(fLiteMode) return; // ignore all VNet related functionality
if(!masternodeSync.IsBlockchainSynced()) return;
if(strCommand == NetMsgType::DSQUEUE) {
TRY_LOCK(cs_darksend, lockRecv);
if(!lockRecv) return;
if(pfrom->nVersion < MIN_PRIVATESEND_PEER_PROTO_VERSION) {
LogPrint("privatesend", "DSQUEUE -- incompatible version! nVersion: %d\n", pfrom->nVersion);
return;
}
CDarksendQueue dsq;
vRecv >> dsq;
// process every dsq only once
BOOST_FOREACH(CDarksendQueue q, vecDarksendQueue) {
if(q == dsq) {
// LogPrint("privatesend", "DSQUEUE -- %s seen\n", dsq.ToString());
return;
}
}
LogPrint("privatesend", "DSQUEUE -- %s new\n", dsq.ToString());
if(dsq.IsExpired()) return;
masternode_info_t infoMn;
if(!mnodeman.GetMasternodeInfo(dsq.vin.prevout, infoMn)) return;
if(!dsq.CheckSignature(infoMn.pubKeyMasternode)) {
// we probably have outdated info
mnodeman.AskForMN(pfrom, dsq.vin.prevout, connman);
return;
}
// if the queue is ready, submit if we can
if(dsq.fReady) {
if(!infoMixingMasternode.fInfoValid) return;
if(infoMixingMasternode.addr != infoMn.addr) {
LogPrintf("DSQUEUE -- message doesn't match current Masternode: infoMixingMasternode=%s, addr=%s\n", infoMixingMasternode.addr.ToString(), infoMn.addr.ToString());
return;
}
if(nState == POOL_STATE_QUEUE) {
LogPrint("privatesend", "DSQUEUE -- PrivateSend queue (%s) is ready on masternode %s\n", dsq.ToString(), infoMn.addr.ToString());
SubmitDenominate(connman);
}
} else {
BOOST_FOREACH(CDarksendQueue q, vecDarksendQueue) {
if(q.vin == dsq.vin) {
// no way same mn can send another "not yet ready" dsq this soon
LogPrint("privatesend", "DSQUEUE -- Masternode %s is sending WAY too many dsq messages\n", infoMn.addr.ToString());
return;
}
}
int nThreshold = infoMn.nLastDsq + mnodeman.CountEnabled(MIN_PRIVATESEND_PEER_PROTO_VERSION)/5;
LogPrint("privatesend", "DSQUEUE -- nLastDsq: %d threshold: %d nDsqCount: %d\n", infoMn.nLastDsq, nThreshold, mnodeman.nDsqCount);
//don't allow a few nodes to dominate the queuing process
if(infoMn.nLastDsq != 0 && nThreshold > mnodeman.nDsqCount) {
LogPrint("privatesend", "DSQUEUE -- Masternode %s is sending too many dsq messages\n", infoMn.addr.ToString());
return;
}
if(!mnodeman.AllowMixing(dsq.vin.prevout)) return;
LogPrint("privatesend", "DSQUEUE -- new PrivateSend queue (%s) from masternode %s\n", dsq.ToString(), infoMn.addr.ToString());
if(infoMixingMasternode.fInfoValid && infoMixingMasternode.vin.prevout == dsq.vin.prevout) {
dsq.fTried = true;
}
vecDarksendQueue.push_back(dsq);
dsq.Relay(connman);
}
} else if(strCommand == NetMsgType::DSSTATUSUPDATE) {
if(pfrom->nVersion < MIN_PRIVATESEND_PEER_PROTO_VERSION) {
LogPrintf("DSSTATUSUPDATE -- incompatible version! nVersion: %d\n", pfrom->nVersion);
return;
}
if(!infoMixingMasternode.fInfoValid) return;
if(infoMixingMasternode.addr != pfrom->addr) {
//LogPrintf("DSSTATUSUPDATE -- message doesn't match current Masternode: infoMixingMasternode %s addr %s\n", infoMixingMasternode.addr.ToString(), pfrom->addr.ToString());
return;
}
int nMsgSessionID;
int nMsgState;
int nMsgEntriesCount;
int nMsgStatusUpdate;
int nMsgMessageID;
vRecv >> nMsgSessionID >> nMsgState >> nMsgEntriesCount >> nMsgStatusUpdate >> nMsgMessageID;
LogPrint("privatesend", "DSSTATUSUPDATE -- nMsgSessionID %d nMsgState: %d nEntriesCount: %d nMsgStatusUpdate: %d nMsgMessageID %d\n",
nMsgSessionID, nMsgState, nEntriesCount, nMsgStatusUpdate, nMsgMessageID);
if(nMsgState < POOL_STATE_MIN || nMsgState > POOL_STATE_MAX) {
LogPrint("privatesend", "DSSTATUSUPDATE -- nMsgState is out of bounds: %d\n", nMsgState);
return;
}
if(nMsgStatusUpdate < STATUS_REJECTED || nMsgStatusUpdate > STATUS_ACCEPTED) {
LogPrint("privatesend", "DSSTATUSUPDATE -- nMsgStatusUpdate is out of bounds: %d\n", nMsgStatusUpdate);
return;
}
if(nMsgMessageID < MSG_POOL_MIN || nMsgMessageID > MSG_POOL_MAX) {
LogPrint("privatesend", "DSSTATUSUPDATE -- nMsgMessageID is out of bounds: %d\n", nMsgMessageID);
return;
}
LogPrint("privatesend", "DSSTATUSUPDATE -- GetMessageByID: %s\n", CPrivateSend::GetMessageByID(PoolMessage(nMsgMessageID)));
if(!CheckPoolStateUpdate(PoolState(nMsgState), nMsgEntriesCount, PoolStatusUpdate(nMsgStatusUpdate), PoolMessage(nMsgMessageID), nMsgSessionID)) {
LogPrint("privatesend", "DSSTATUSUPDATE -- CheckPoolStateUpdate failed\n");
}
} else if(strCommand == NetMsgType::DSFINALTX) {
if(pfrom->nVersion < MIN_PRIVATESEND_PEER_PROTO_VERSION) {
LogPrintf("DSFINALTX -- incompatible version! nVersion: %d\n", pfrom->nVersion);
return;
}
if(!infoMixingMasternode.fInfoValid) return;
if(infoMixingMasternode.addr != pfrom->addr) {
//LogPrintf("DSFINALTX -- message doesn't match current Masternode: infoMixingMasternode %s addr %s\n", infoMixingMasternode.addr.ToString(), pfrom->addr.ToString());
return;
}
int nMsgSessionID;
CTransaction txNew;
vRecv >> nMsgSessionID >> txNew;
if(nSessionID != nMsgSessionID) {
LogPrint("privatesend", "DSFINALTX -- message doesn't match current PrivateSend session: nSessionID: %d nMsgSessionID: %d\n", nSessionID, nMsgSessionID);
return;
}
LogPrint("privatesend", "DSFINALTX -- txNew %s", txNew.ToString());
//check to see if input is spent already? (and probably not confirmed)
SignFinalTransaction(txNew, pfrom, connman);
} else if(strCommand == NetMsgType::DSCOMPLETE) {
if(pfrom->nVersion < MIN_PRIVATESEND_PEER_PROTO_VERSION) {
LogPrintf("DSCOMPLETE -- incompatible version! nVersion: %d\n", pfrom->nVersion);
return;
}
if(!infoMixingMasternode.fInfoValid) return;
if(infoMixingMasternode.addr != pfrom->addr) {
LogPrint("privatesend", "DSCOMPLETE -- message doesn't match current Masternode: infoMixingMasternode=%s addr=%s\n", infoMixingMasternode.addr.ToString(), pfrom->addr.ToString());
return;
}
int nMsgSessionID;
int nMsgMessageID;
vRecv >> nMsgSessionID >> nMsgMessageID;
if(nMsgMessageID < MSG_POOL_MIN || nMsgMessageID > MSG_POOL_MAX) {
LogPrint("privatesend", "DSCOMPLETE -- nMsgMessageID is out of bounds: %d\n", nMsgMessageID);
return;
}
if(nSessionID != nMsgSessionID) {
LogPrint("privatesend", "DSCOMPLETE -- message doesn't match current PrivateSend session: nSessionID: %d nMsgSessionID: %d\n", nSessionID, nMsgSessionID);
return;
}
LogPrint("privatesend", "DSCOMPLETE -- nMsgSessionID %d nMsgMessageID %d (%s)\n", nMsgSessionID, nMsgMessageID, CPrivateSend::GetMessageByID(PoolMessage(nMsgMessageID)));
CompletedTransaction(PoolMessage(nMsgMessageID));
}
}
void CPrivateSendClient::ResetPool()
{
nCachedLastSuccessBlock = 0;
txMyCollateral = CMutableTransaction();
vecMasternodesUsed.clear();
UnlockCoins();
keyHolderStorage.ReturnAll();
SetNull();
}
void CPrivateSendClient::SetNull()
{
// Client side
nEntriesCount = 0;
fLastEntryAccepted = false;
infoMixingMasternode = masternode_info_t();
CPrivateSendBase::SetNull();
}
//
// Unlock coins after mixing fails or succeeds
//
void CPrivateSendClient::UnlockCoins()
{
while(true) {
TRY_LOCK(pwalletMain->cs_wallet, lockWallet);
if(!lockWallet) {MilliSleep(50); continue;}
BOOST_FOREACH(COutPoint outpoint, vecOutPointLocked)
pwalletMain->UnlockCoin(outpoint);
break;
}
vecOutPointLocked.clear();
}
std::string CPrivateSendClient::GetStatus()
{
static int nStatusMessageProgress = 0;
nStatusMessageProgress += 10;
std::string strSuffix = "";
if(WaitForAnotherBlock() || !masternodeSync.IsBlockchainSynced())
return strAutoDenomResult;
switch(nState) {
case POOL_STATE_IDLE:
return _("PrivateSend is idle.");
case POOL_STATE_QUEUE:
if( nStatusMessageProgress % 70 <= 30) strSuffix = ".";
else if(nStatusMessageProgress % 70 <= 50) strSuffix = "..";
else if(nStatusMessageProgress % 70 <= 70) strSuffix = "...";
return strprintf(_("Submitted to masternode, waiting in queue %s"), strSuffix);;
case POOL_STATE_ACCEPTING_ENTRIES:
if(nEntriesCount == 0) {
nStatusMessageProgress = 0;
return strAutoDenomResult;
} else if(fLastEntryAccepted) {
if(nStatusMessageProgress % 10 > 8) {
fLastEntryAccepted = false;
nStatusMessageProgress = 0;
}
return _("PrivateSend request complete:") + " " + _("Your transaction was accepted into the pool!");
} else {
if( nStatusMessageProgress % 70 <= 40) return strprintf(_("Submitted following entries to masternode: %u / %d"), nEntriesCount, CPrivateSend::GetMaxPoolTransactions());
else if(nStatusMessageProgress % 70 <= 50) strSuffix = ".";
else if(nStatusMessageProgress % 70 <= 60) strSuffix = "..";
else if(nStatusMessageProgress % 70 <= 70) strSuffix = "...";
return strprintf(_("Submitted to masternode, waiting for more entries ( %u / %d ) %s"), nEntriesCount, CPrivateSend::GetMaxPoolTransactions(), strSuffix);
}
case POOL_STATE_SIGNING:
if( nStatusMessageProgress % 70 <= 40) return _("Found enough users, signing ...");
else if(nStatusMessageProgress % 70 <= 50) strSuffix = ".";
else if(nStatusMessageProgress % 70 <= 60) strSuffix = "..";
else if(nStatusMessageProgress % 70 <= 70) strSuffix = "...";
return strprintf(_("Found enough users, signing ( waiting %s )"), strSuffix);
case POOL_STATE_ERROR:
return _("PrivateSend request incomplete:") + " " + strLastMessage + " " + _("Will retry...");
case POOL_STATE_SUCCESS:
return _("PrivateSend request complete:") + " " + strLastMessage;
default:
return strprintf(_("Unknown state: id = %u"), nState);
}
}
bool CPrivateSendClient::GetMixingMasternodeInfo(masternode_info_t& mnInfoRet)
{
mnInfoRet = infoMixingMasternode.fInfoValid ? infoMixingMasternode : masternode_info_t();
return infoMixingMasternode.fInfoValid;
}
bool CPrivateSendClient::IsMixingMasternode(const CNode* pnode)
{
return infoMixingMasternode.fInfoValid && pnode->addr == infoMixingMasternode.addr;
}
//
// Check the mixing progress and send client updates if a Masternode
//
void CPrivateSendClient::CheckPool()
{
// reset if we're here for 10 seconds
if((nState == POOL_STATE_ERROR || nState == POOL_STATE_SUCCESS) && GetTimeMillis() - nTimeLastSuccessfulStep >= 10000) {
LogPrint("privatesend", "CPrivateSendClient::CheckPool -- timeout, RESETTING\n");
UnlockCoins();
if (nState == POOL_STATE_ERROR) {
keyHolderStorage.ReturnAll();
} else {
keyHolderStorage.KeepAll();
}
SetNull();
}
}
//
// Check for various timeouts (queue objects, mixing, etc)
//
void CPrivateSendClient::CheckTimeout()
{
CheckQueue();
if(!fEnablePrivateSend && !fMasterNode) return;
// catching hanging sessions
if(!fMasterNode) {
switch(nState) {
case POOL_STATE_ERROR:
LogPrint("privatesend", "CPrivateSendClient::CheckTimeout -- Pool error -- Running CheckPool\n");
CheckPool();
break;
case POOL_STATE_SUCCESS:
LogPrint("privatesend", "CPrivateSendClient::CheckTimeout -- Pool success -- Running CheckPool\n");
CheckPool();
break;
default:
break;
}
}
int nLagTime = fMasterNode ? 0 : 10000; // if we're the client, give the server a few extra seconds before resetting.
int nTimeout = (nState == POOL_STATE_SIGNING) ? PRIVATESEND_SIGNING_TIMEOUT : PRIVATESEND_QUEUE_TIMEOUT;
bool fTimeout = GetTimeMillis() - nTimeLastSuccessfulStep >= nTimeout*1000 + nLagTime;
if(nState != POOL_STATE_IDLE && fTimeout) {
LogPrint("privatesend", "CPrivateSendClient::CheckTimeout -- %s timed out (%ds) -- restting\n",
(nState == POOL_STATE_SIGNING) ? "Signing" : "Session", nTimeout);
UnlockCoins();
keyHolderStorage.ReturnAll();
SetNull();
SetState(POOL_STATE_ERROR);
strLastMessage = _("Session timed out.");
}
}
//
// Execute a mixing denomination via a Masternode.
// This is only ran from clients
//
bool CPrivateSendClient::SendDenominate(const std::vector<CTxDSIn>& vecTxDSIn, const std::vector<CTxOut>& vecTxOut, CConnman& connman)
{
if(fMasterNode) {
LogPrintf("CPrivateSendClient::SendDenominate -- PrivateSend from a Masternode is not supported currently.\n");
return false;
}
if(txMyCollateral == CMutableTransaction()) {
LogPrintf("CPrivateSendClient:SendDenominate -- PrivateSend collateral not set\n");
return false;
}
// lock the funds we're going to use
BOOST_FOREACH(CTxIn txin, txMyCollateral.vin)
vecOutPointLocked.push_back(txin.prevout);
for (const auto& txdsin : vecTxDSIn)
vecOutPointLocked.push_back(txdsin.prevout);
// we should already be connected to a Masternode
if(!nSessionID) {
LogPrintf("CPrivateSendClient::SendDenominate -- No Masternode has been selected yet.\n");
UnlockCoins();
keyHolderStorage.ReturnAll();
SetNull();
return false;
}
if(!CheckDiskSpace()) {
UnlockCoins();
keyHolderStorage.ReturnAll();
SetNull();
fEnablePrivateSend = false;
LogPrintf("CPrivateSendClient::SendDenominate -- Not enough disk space, disabling PrivateSend.\n");
return false;
}
SetState(POOL_STATE_ACCEPTING_ENTRIES);
strLastMessage = "";
LogPrintf("CPrivateSendClient::SendDenominate -- Added transaction to pool.\n");
//check it against the memory pool to make sure it's valid
{
CValidationState validationState;
CMutableTransaction tx;
for (const auto& txdsin : vecTxDSIn) {
LogPrint("privatesend", "CPrivateSendClient::SendDenominate -- txdsin=%s\n", txdsin.ToString());
tx.vin.push_back(txdsin);
}
BOOST_FOREACH(const CTxOut& txout, vecTxOut) {
LogPrint("privatesend", "CPrivateSendClient::SendDenominate -- txout=%s\n", txout.ToString());
tx.vout.push_back(txout);
}
LogPrintf("CPrivateSendClient::SendDenominate -- Submitting partial tx %s", tx.ToString());
mempool.PrioritiseTransaction(tx.GetHash(), tx.GetHash().ToString(), 1000, 0.1*COIN);
TRY_LOCK(cs_main, lockMain);
if(!lockMain || !AcceptToMemoryPool(mempool, validationState, CTransaction(tx), false, NULL, false, true, true)) {
LogPrintf("CPrivateSendClient::SendDenominate -- AcceptToMemoryPool() failed! tx=%s", tx.ToString());
UnlockCoins();
keyHolderStorage.ReturnAll();
SetNull();
return false;
}
}
// store our entry for later use
CDarkSendEntry entry(vecTxDSIn, vecTxOut, txMyCollateral);
vecEntries.push_back(entry);
RelayIn(entry, connman);
nTimeLastSuccessfulStep = GetTimeMillis();
return true;
}
// Incoming message from Masternode updating the progress of mixing
bool CPrivateSendClient::CheckPoolStateUpdate(PoolState nStateNew, int nEntriesCountNew, PoolStatusUpdate nStatusUpdate, PoolMessage nMessageID, int nSessionIDNew)
{
if(fMasterNode) return false;
// do not update state when mixing client state is one of these
if(nState == POOL_STATE_IDLE || nState == POOL_STATE_ERROR || nState == POOL_STATE_SUCCESS) return false;
strAutoDenomResult = _("Masternode:") + " " + CPrivateSend::GetMessageByID(nMessageID);
// if rejected at any state
if(nStatusUpdate == STATUS_REJECTED) {
LogPrintf("CPrivateSendClient::CheckPoolStateUpdate -- entry is rejected by Masternode\n");
UnlockCoins();
keyHolderStorage.ReturnAll();
SetNull();
SetState(POOL_STATE_ERROR);
strLastMessage = CPrivateSend::GetMessageByID(nMessageID);
return true;
}
if(nStatusUpdate == STATUS_ACCEPTED && nState == nStateNew) {
if(nStateNew == POOL_STATE_QUEUE && nSessionID == 0 && nSessionIDNew != 0) {
// new session id should be set only in POOL_STATE_QUEUE state
nSessionID = nSessionIDNew;
nTimeLastSuccessfulStep = GetTimeMillis();
LogPrintf("CPrivateSendClient::CheckPoolStateUpdate -- set nSessionID to %d\n", nSessionID);
return true;
}
else if(nStateNew == POOL_STATE_ACCEPTING_ENTRIES && nEntriesCount != nEntriesCountNew) {
nEntriesCount = nEntriesCountNew;
nTimeLastSuccessfulStep = GetTimeMillis();
fLastEntryAccepted = true;
LogPrintf("CPrivateSendClient::CheckPoolStateUpdate -- new entry accepted!\n");
return true;
}
}
// only situations above are allowed, fail in any other case
return false;
}
//
// After we receive the finalized transaction from the Masternode, we must
// check it to make sure it's what we want, then sign it if we agree.
// If we refuse to sign, it's possible we'll be charged collateral
//
bool CPrivateSendClient::SignFinalTransaction(const CTransaction& finalTransactionNew, CNode* pnode, CConnman& connman)
{
if(fMasterNode || pnode == NULL) return false;
finalMutableTransaction = finalTransactionNew;
LogPrintf("CPrivateSendClient::SignFinalTransaction -- finalMutableTransaction=%s", finalMutableTransaction.ToString());
// Make sure it's BIP69 compliant
sort(finalMutableTransaction.vin.begin(), finalMutableTransaction.vin.end(), CompareInputBIP69());
sort(finalMutableTransaction.vout.begin(), finalMutableTransaction.vout.end(), CompareOutputBIP69());
if(finalMutableTransaction.GetHash() != finalTransactionNew.GetHash()) {
LogPrintf("CPrivateSendClient::SignFinalTransaction -- WARNING! Masternode %s is not BIP69 compliant!\n", infoMixingMasternode.vin.prevout.ToStringShort());
UnlockCoins();
keyHolderStorage.ReturnAll();
SetNull();
return false;
}
std::vector<CTxIn> sigs;
//make sure my inputs/outputs are present, otherwise refuse to sign
BOOST_FOREACH(const CDarkSendEntry entry, vecEntries) {
BOOST_FOREACH(const CTxDSIn txdsin, entry.vecTxDSIn) {
/* Sign my transaction and all outputs */
int nMyInputIndex = -1;
CScript prevPubKey = CScript();
CTxIn txin = CTxIn();
for(unsigned int i = 0; i < finalMutableTransaction.vin.size(); i++) {
if(finalMutableTransaction.vin[i] == txdsin) {
nMyInputIndex = i;
prevPubKey = txdsin.prevPubKey;
txin = txdsin;
}
}
if(nMyInputIndex >= 0) { //might have to do this one input at a time?
int nFoundOutputsCount = 0;
CAmount nValue1 = 0;
CAmount nValue2 = 0;
for (const auto& txoutFinal : finalMutableTransaction.vout) {
for (const auto& txout: entry.vecTxOut) {
if(txoutFinal == txout) {
nFoundOutputsCount++;
nValue1 += txoutFinal.nValue;
}
}
}
for (const auto& txout : entry.vecTxOut)
nValue2 += txout.nValue;
int nTargetOuputsCount = entry.vecTxOut.size();
if(nFoundOutputsCount < nTargetOuputsCount || nValue1 != nValue2) {
// in this case, something went wrong and we'll refuse to sign. It's possible we'll be charged collateral. But that's
// better then signing if the transaction doesn't look like what we wanted.
LogPrintf("CPrivateSendClient::SignFinalTransaction -- My entries are not correct! Refusing to sign: nFoundOutputsCount: %d, nTargetOuputsCount: %d\n", nFoundOutputsCount, nTargetOuputsCount);
UnlockCoins();
keyHolderStorage.ReturnAll();
SetNull();
return false;
}
const CKeyStore& keystore = *pwalletMain;
LogPrint("privatesend", "CPrivateSendClient::SignFinalTransaction -- Signing my input %i\n", nMyInputIndex);
if(!SignSignature(keystore, prevPubKey, finalMutableTransaction, nMyInputIndex, int(SIGHASH_ALL|SIGHASH_ANYONECANPAY))) { // changes scriptSig
LogPrint("privatesend", "CPrivateSendClient::SignFinalTransaction -- Unable to sign my own transaction!\n");
// not sure what to do here, it will timeout...?
}
sigs.push_back(finalMutableTransaction.vin[nMyInputIndex]);
LogPrint("privatesend", "CPrivateSendClient::SignFinalTransaction -- nMyInputIndex: %d, sigs.size(): %d, scriptSig=%s\n", nMyInputIndex, (int)sigs.size(), ScriptToAsmStr(finalMutableTransaction.vin[nMyInputIndex].scriptSig));
}
}
}
if(sigs.empty()) {
LogPrintf("CPrivateSendClient::SignFinalTransaction -- can't sign anything!\n");
UnlockCoins();
keyHolderStorage.ReturnAll();
SetNull();
return false;
}
// push all of our signatures to the Masternode
LogPrintf("CPrivateSendClient::SignFinalTransaction -- pushing sigs to the masternode, finalMutableTransaction=%s", finalMutableTransaction.ToString());
connman.PushMessage(pnode, NetMsgType::DSSIGNFINALTX, sigs);
SetState(POOL_STATE_SIGNING);
nTimeLastSuccessfulStep = GetTimeMillis();
return true;
}
// mixing transaction was completed (failed or successful)
void CPrivateSendClient::CompletedTransaction(PoolMessage nMessageID)
{
if(fMasterNode) return;
if(nMessageID == MSG_SUCCESS) {
LogPrintf("CompletedTransaction -- success\n");
nCachedLastSuccessBlock = nCachedBlockHeight;
keyHolderStorage.KeepAll();
} else {
LogPrintf("CompletedTransaction -- error\n");
keyHolderStorage.ReturnAll();
}
UnlockCoins();
SetNull();
strLastMessage = CPrivateSend::GetMessageByID(nMessageID);
}
bool CPrivateSendClient::WaitForAnotherBlock()
{
if(!masternodeSync.IsMasternodeListSynced())
return true;
if(fPrivateSendMultiSession)
return false;
return nCachedBlockHeight - nCachedLastSuccessBlock < nMinBlocksToWait;
}
bool CPrivateSendClient::CheckAutomaticBackup()
{
switch(nWalletBackups) {
case 0:
LogPrint("privatesend", "CPrivateSendClient::CheckAutomaticBackup -- Automatic backups disabled, no mixing available.\n");
strAutoDenomResult = _("Automatic backups disabled") + ", " + _("no mixing available.");
fEnablePrivateSend = false; // stop mixing
pwalletMain->nKeysLeftSinceAutoBackup = 0; // no backup, no "keys since last backup"
return false;
case -1:
// Automatic backup failed, nothing else we can do until user fixes the issue manually.
// There is no way to bring user attention in daemon mode so we just update status and
// keep spaming if debug is on.
LogPrint("privatesend", "CPrivateSendClient::CheckAutomaticBackup -- ERROR! Failed to create automatic backup.\n");
strAutoDenomResult = _("ERROR! Failed to create automatic backup") + ", " + _("see debug.log for details.");
return false;
case -2:
// We were able to create automatic backup but keypool was not replenished because wallet is locked.
// There is no way to bring user attention in daemon mode so we just update status and
// keep spaming if debug is on.
LogPrint("privatesend", "CPrivateSendClient::CheckAutomaticBackup -- WARNING! Failed to create replenish keypool, please unlock your wallet to do so.\n");
strAutoDenomResult = _("WARNING! Failed to replenish keypool, please unlock your wallet to do so.") + ", " + _("see debug.log for details.");
return false;
}
if(pwalletMain->nKeysLeftSinceAutoBackup < PRIVATESEND_KEYS_THRESHOLD_STOP) {
// We should never get here via mixing itself but probably smth else is still actively using keypool
LogPrint("privatesend", "CPrivateSendClient::CheckAutomaticBackup -- Very low number of keys left: %d, no mixing available.\n", pwalletMain->nKeysLeftSinceAutoBackup);
strAutoDenomResult = strprintf(_("Very low number of keys left: %d") + ", " + _("no mixing available."), pwalletMain->nKeysLeftSinceAutoBackup);
// It's getting really dangerous, stop mixing
fEnablePrivateSend = false;
return false;
} else if(pwalletMain->nKeysLeftSinceAutoBackup < PRIVATESEND_KEYS_THRESHOLD_WARNING) {
// Low number of keys left but it's still more or less safe to continue
LogPrint("privatesend", "CPrivateSendClient::CheckAutomaticBackup -- Very low number of keys left: %d\n", pwalletMain->nKeysLeftSinceAutoBackup);
strAutoDenomResult = strprintf(_("Very low number of keys left: %d"), pwalletMain->nKeysLeftSinceAutoBackup);
if(fCreateAutoBackups) {
LogPrint("privatesend", "CPrivateSendClient::CheckAutomaticBackup -- Trying to create new backup.\n");
std::string warningString;
std::string errorString;
if(!AutoBackupWallet(pwalletMain, "", warningString, errorString)) {
if(!warningString.empty()) {
// There were some issues saving backup but yet more or less safe to continue
LogPrintf("CPrivateSendClient::CheckAutomaticBackup -- WARNING! Something went wrong on automatic backup: %s\n", warningString);
}
if(!errorString.empty()) {
// Things are really broken
LogPrintf("CPrivateSendClient::CheckAutomaticBackup -- ERROR! Failed to create automatic backup: %s\n", errorString);
strAutoDenomResult = strprintf(_("ERROR! Failed to create automatic backup") + ": %s", errorString);
return false;
}
}
} else {
// Wait for smth else (e.g. GUI action) to create automatic backup for us
return false;
}
}
LogPrint("privatesend", "CPrivateSendClient::CheckAutomaticBackup -- Keys left since latest backup: %d\n", pwalletMain->nKeysLeftSinceAutoBackup);
return true;
}
//
// Passively run mixing in the background to anonymize funds based on the given configuration.
//
bool CPrivateSendClient::DoAutomaticDenominating(CConnman& connman, bool fDryRun)
{
if(fMasterNode) return false; // no client-side mixing on masternodes
if(!fEnablePrivateSend) return false;
if(!pwalletMain || pwalletMain->IsLocked(true)) return false;
if(nState != POOL_STATE_IDLE) return false;
if(!masternodeSync.IsMasternodeListSynced()) {
strAutoDenomResult = _("Can't mix while sync in progress.");
return false;
}
if(!CheckAutomaticBackup())
return false;
if(GetEntriesCount() > 0) {
strAutoDenomResult = _("Mixing in progress...");
return false;
}
TRY_LOCK(cs_darksend, lockDS);
if(!lockDS) {
strAutoDenomResult = _("Lock is already in place.");
return false;
}
if(!fDryRun && pwalletMain->IsLocked(true)) {
strAutoDenomResult = _("Wallet is locked.");
return false;
}
if(WaitForAnotherBlock()) {
LogPrintf("CPrivateSendClient::DoAutomaticDenominating -- Last successful PrivateSend action was too recent\n");
strAutoDenomResult = _("Last successful PrivateSend action was too recent.");
return false;
}
if(mnodeman.size() == 0) {
LogPrint("privatesend", "CPrivateSendClient::DoAutomaticDenominating -- No Masternodes detected\n");
strAutoDenomResult = _("No Masternodes detected.");
return false;
}
CAmount nValueMin = CPrivateSend::GetSmallestDenomination();
// if there are no confirmed DS collateral inputs yet
if(!pwalletMain->HasCollateralInputs()) {
// should have some additional amount for them
nValueMin += CPrivateSend::GetMaxCollateralAmount();
}
// including denoms but applying some restrictions
CAmount nBalanceNeedsAnonymized = pwalletMain->GetNeedsToBeAnonymizedBalance(nValueMin);
// anonymizable balance is way too small
if(nBalanceNeedsAnonymized < nValueMin) {
LogPrintf("CPrivateSendClient::DoAutomaticDenominating -- Not enough funds to anonymize\n");
strAutoDenomResult = _("Not enough funds to anonymize.");
return false;
}
// excluding denoms
CAmount nBalanceAnonimizableNonDenom = pwalletMain->GetAnonymizableBalance(true);
// denoms
CAmount nBalanceDenominatedConf = pwalletMain->GetDenominatedBalance();
CAmount nBalanceDenominatedUnconf = pwalletMain->GetDenominatedBalance(true);
CAmount nBalanceDenominated = nBalanceDenominatedConf + nBalanceDenominatedUnconf;
LogPrint("privatesend", "CPrivateSendClient::DoAutomaticDenominating -- nValueMin: %f, nBalanceNeedsAnonymized: %f, nBalanceAnonimizableNonDenom: %f, nBalanceDenominatedConf: %f, nBalanceDenominatedUnconf: %f, nBalanceDenominated: %f\n",
(float)nValueMin/COIN,
(float)nBalanceNeedsAnonymized/COIN,
(float)nBalanceAnonimizableNonDenom/COIN,
(float)nBalanceDenominatedConf/COIN,
(float)nBalanceDenominatedUnconf/COIN,
(float)nBalanceDenominated/COIN);
if(fDryRun) return true;
// Check if we have should create more denominated inputs i.e.
// there are funds to denominate and denominated balance does not exceed
// max amount to mix yet.
if(nBalanceAnonimizableNonDenom >= nValueMin + CPrivateSend::GetCollateralAmount() && nBalanceDenominated < nPrivateSendAmount*COIN)
return CreateDenominated(connman);
//check if we have the collateral sized inputs
if(!pwalletMain->HasCollateralInputs())
return !pwalletMain->HasCollateralInputs(false) && MakeCollateralAmounts(connman);
if(nSessionID) {
strAutoDenomResult = _("Mixing in progress...");
return false;
}
// Initial phase, find a Masternode
// Clean if there is anything left from previous session
UnlockCoins();
keyHolderStorage.ReturnAll();
SetNull();
// should be no unconfirmed denoms in non-multi-session mode
if(!fPrivateSendMultiSession && nBalanceDenominatedUnconf > 0) {
LogPrintf("CPrivateSendClient::DoAutomaticDenominating -- Found unconfirmed denominated outputs, will wait till they confirm to continue.\n");
strAutoDenomResult = _("Found unconfirmed denominated outputs, will wait till they confirm to continue.");
return false;
}
//check our collateral and create new if needed
std::string strReason;
if(txMyCollateral == CMutableTransaction()) {
if(!pwalletMain->CreateCollateralTransaction(txMyCollateral, strReason)) {
LogPrintf("CPrivateSendClient::DoAutomaticDenominating -- create collateral error:%s\n", strReason);
return false;
}
} else {
if(!CPrivateSend::IsCollateralValid(txMyCollateral)) {
LogPrintf("CPrivateSendClient::DoAutomaticDenominating -- invalid collateral, recreating...\n");
if(!pwalletMain->CreateCollateralTransaction(txMyCollateral, strReason)) {
LogPrintf("CPrivateSendClient::DoAutomaticDenominating -- create collateral error: %s\n", strReason);
return false;
}
}
}
int nMnCountEnabled = mnodeman.CountEnabled(MIN_PRIVATESEND_PEER_PROTO_VERSION);
// If we've used 90% of the Masternode list then drop the oldest first ~30%
int nThreshold_high = nMnCountEnabled * 0.9;
int nThreshold_low = nThreshold_high * 0.7;
LogPrint("privatesend", "Checking vecMasternodesUsed: size: %d, threshold: %d\n", (int)vecMasternodesUsed.size(), nThreshold_high);
if((int)vecMasternodesUsed.size() > nThreshold_high) {
vecMasternodesUsed.erase(vecMasternodesUsed.begin(), vecMasternodesUsed.begin() + vecMasternodesUsed.size() - nThreshold_low);
LogPrint("privatesend", " vecMasternodesUsed: new size: %d, threshold: %d\n", (int)vecMasternodesUsed.size(), nThreshold_high);
}
bool fUseQueue = GetRandInt(100) > 33;
// don't use the queues all of the time for mixing unless we are a liquidity provider
if((nLiquidityProvider || fUseQueue) && JoinExistingQueue(nBalanceNeedsAnonymized, connman))
return true;
// do not initiate queue if we are a liquidity provider to avoid useless inter-mixing
if(nLiquidityProvider) return false;
if(StartNewQueue(nValueMin, nBalanceNeedsAnonymized, connman))
return true;
strAutoDenomResult = _("No compatible Masternode found.");
return false;
}
bool CPrivateSendClient::JoinExistingQueue(CAmount nBalanceNeedsAnonymized, CConnman& connman)
{
std::vector<CAmount> vecStandardDenoms = CPrivateSend::GetStandardDenominations();
// Look through the queues and see if anything matches
BOOST_FOREACH(CDarksendQueue& dsq, vecDarksendQueue) {
// only try each queue once
if(dsq.fTried) continue;
dsq.fTried = true;
if(dsq.IsExpired()) continue;
masternode_info_t infoMn;
if(!mnodeman.GetMasternodeInfo(dsq.vin.prevout, infoMn)) {
LogPrintf("CPrivateSendClient::JoinExistingQueue -- dsq masternode is not in masternode list, masternode=%s\n", dsq.vin.prevout.ToStringShort());
continue;
}
if(infoMn.nProtocolVersion < MIN_PRIVATESEND_PEER_PROTO_VERSION) continue;
std::vector<int> vecBits;
if(!CPrivateSend::GetDenominationsBits(dsq.nDenom, vecBits)) {
// incompatible denom
continue;
}
// mixing rate limit i.e. nLastDsq check should already pass in DSQUEUE ProcessMessage
// in order for dsq to get into vecDarksendQueue, so we should be safe to mix already,
// no need for additional verification here
LogPrint("privatesend", "CPrivateSendClient::JoinExistingQueue -- found valid queue: %s\n", dsq.ToString());
CAmount nValueInTmp = 0;
std::vector<CTxDSIn> vecTxDSInTmp;
std::vector<COutput> vCoinsTmp;
// Try to match their denominations if possible, select at least 1 denominations
if(!pwalletMain->SelectCoinsByDenominations(dsq.nDenom, vecStandardDenoms[vecBits.front()], nBalanceNeedsAnonymized, vecTxDSInTmp, vCoinsTmp, nValueInTmp, 0, nPrivateSendRounds)) {
LogPrintf("CPrivateSendClient::JoinExistingQueue -- Couldn't match denominations %d %d (%s)\n", vecBits.front(), dsq.nDenom, CPrivateSend::GetDenominationsToString(dsq.nDenom));
continue;
}
vecMasternodesUsed.push_back(dsq.vin.prevout);
bool fSkip = false;
connman.ForNode(infoMn.addr, CConnman::AllNodes, [&fSkip](CNode* pnode) {
fSkip = pnode->fDisconnect || pnode->fMasternode;
return true;
});
if (fSkip) {
LogPrintf("CPrivateSendClient::JoinExistingQueue -- skipping masternode connection, addr=%s\n", infoMn.addr.ToString());
continue;
}
LogPrintf("CPrivateSendClient::JoinExistingQueue -- attempt to connect to masternode from queue, addr=%s\n", infoMn.addr.ToString());
// connect to Masternode and submit the queue request
CNode* pnode = connman.ConnectNode(CAddress(infoMn.addr, NODE_NETWORK), NULL, true);
if(pnode) {
infoMixingMasternode = infoMn;
nSessionDenom = dsq.nDenom;
connman.PushMessage(pnode, NetMsgType::DSACCEPT, nSessionDenom, txMyCollateral);
LogPrintf("CPrivateSendClient::JoinExistingQueue -- connected (from queue), sending DSACCEPT: nSessionDenom: %d (%s), addr=%s\n",
nSessionDenom, CPrivateSend::GetDenominationsToString(nSessionDenom), pnode->addr.ToString());
strAutoDenomResult = _("Mixing in progress...");
SetState(POOL_STATE_QUEUE);
nTimeLastSuccessfulStep = GetTimeMillis();
return true;
} else {
LogPrintf("CPrivateSendClient::JoinExistingQueue -- can't connect, addr=%s\n", infoMn.addr.ToString());
strAutoDenomResult = _("Error connecting to Masternode.");
continue;
}
}
return false;
}
bool CPrivateSendClient::StartNewQueue(CAmount nValueMin, CAmount nBalanceNeedsAnonymized, CConnman& connman)
{
int nTries = 0;
int nMnCountEnabled = mnodeman.CountEnabled(MIN_PRIVATESEND_PEER_PROTO_VERSION);
// ** find the coins we'll use
std::vector<CTxIn> vecTxIn;
CAmount nValueInTmp = 0;
if(!pwalletMain->SelectCoinsDark(nValueMin, nBalanceNeedsAnonymized, vecTxIn, nValueInTmp, 0, nPrivateSendRounds)) {
// this should never happen
LogPrintf("CPrivateSendClient::StartNewQueue -- Can't mix: no compatible inputs found!\n");
strAutoDenomResult = _("Can't mix: no compatible inputs found!");
return false;
}
// otherwise, try one randomly
while(nTries < 10) {
masternode_info_t infoMn = mnodeman.FindRandomNotInVec(vecMasternodesUsed, MIN_PRIVATESEND_PEER_PROTO_VERSION);
if(!infoMn.fInfoValid) {
LogPrintf("CPrivateSendClient::StartNewQueue -- Can't find random masternode!\n");
strAutoDenomResult = _("Can't find random Masternode.");
return false;
}
vecMasternodesUsed.push_back(infoMn.vin.prevout);
if(infoMn.nLastDsq != 0 && infoMn.nLastDsq + nMnCountEnabled/5 > mnodeman.nDsqCount) {
LogPrintf("CPrivateSendClient::StartNewQueue -- Too early to mix on this masternode!"
" masternode=%s addr=%s nLastDsq=%d CountEnabled/5=%d nDsqCount=%d\n",
infoMn.vin.prevout.ToStringShort(), infoMn.addr.ToString(), infoMn.nLastDsq,
nMnCountEnabled/5, mnodeman.nDsqCount);
nTries++;
continue;
}
bool fSkip = false;
connman.ForNode(infoMn.addr, CConnman::AllNodes, [&fSkip](CNode* pnode) {
fSkip = pnode->fDisconnect || pnode->fMasternode;
return true;
});
if (fSkip) {
LogPrintf("CPrivateSendClient::StartNewQueue -- skipping masternode connection, addr=%s\n", infoMn.addr.ToString());
nTries++;
continue;
}
LogPrintf("CPrivateSendClient::StartNewQueue -- attempt %d connection to Masternode %s\n", nTries, infoMn.addr.ToString());
CNode* pnode = connman.ConnectNode(CAddress(infoMn.addr, NODE_NETWORK), NULL, true);
if(pnode) {
LogPrintf("CPrivateSendClient::StartNewQueue -- connected, addr=%s\n", infoMn.addr.ToString());
infoMixingMasternode = infoMn;
std::vector<CAmount> vecAmounts;
pwalletMain->ConvertList(vecTxIn, vecAmounts);
// try to get a single random denom out of vecAmounts
while(nSessionDenom == 0) {
nSessionDenom = CPrivateSend::GetDenominationsByAmounts(vecAmounts);
}
connman.PushMessage(pnode, NetMsgType::DSACCEPT, nSessionDenom, txMyCollateral);
LogPrintf("CPrivateSendClient::StartNewQueue -- connected, sending DSACCEPT, nSessionDenom: %d (%s)\n",
nSessionDenom, CPrivateSend::GetDenominationsToString(nSessionDenom));
strAutoDenomResult = _("Mixing in progress...");
SetState(POOL_STATE_QUEUE);
nTimeLastSuccessfulStep = GetTimeMillis();
return true;
} else {
LogPrintf("CPrivateSendClient::StartNewQueue -- can't connect, addr=%s\n", infoMn.addr.ToString());
nTries++;
continue;
}
}
return false;
}
bool CPrivateSendClient::SubmitDenominate(CConnman& connman)
{
std::string strError;
std::vector<CTxDSIn> vecTxDSInRet;
std::vector<CTxOut> vecTxOutRet;
// Submit transaction to the pool if we get here
if (nLiquidityProvider) {
// Try to use only inputs with the same number of rounds starting from the lowest number of rounds possible
for(int i = 0; i< nPrivateSendRounds; i++) {
if(PrepareDenominate(i, i + 1, strError, vecTxDSInRet, vecTxOutRet)) {
LogPrintf("CPrivateSendClient::SubmitDenominate -- Running PrivateSend denominate for %d rounds, success\n", i);
return SendDenominate(vecTxDSInRet, vecTxOutRet, connman);
}
LogPrint("privatesend", "CPrivateSendClient::SubmitDenominate -- Running PrivateSend denominate for %d rounds, error: %s\n", i, strError);
}
} else {
// Try to use only inputs with the same number of rounds starting from the highest number of rounds possible
for(int i = nPrivateSendRounds; i > 0; i--) {
if(PrepareDenominate(i - 1, i, strError, vecTxDSInRet, vecTxOutRet)) {
LogPrintf("CPrivateSendClient::SubmitDenominate -- Running PrivateSend denominate for %d rounds, success\n", i);
return SendDenominate(vecTxDSInRet, vecTxOutRet, connman);
}
LogPrint("privatesend", "CPrivateSendClient::SubmitDenominate -- Running PrivateSend denominate for %d rounds, error: %s\n", i, strError);
}
}
// We failed? That's strange but let's just make final attempt and try to mix everything
if(PrepareDenominate(0, nPrivateSendRounds, strError, vecTxDSInRet, vecTxOutRet)) {
LogPrintf("CPrivateSendClient::SubmitDenominate -- Running PrivateSend denominate for all rounds, success\n");
return SendDenominate(vecTxDSInRet, vecTxOutRet, connman);
}
// Should never actually get here but just in case
LogPrintf("CPrivateSendClient::SubmitDenominate -- Running PrivateSend denominate for all rounds, error: %s\n", strError);
strAutoDenomResult = strError;
return false;
}
bool CPrivateSendClient::PrepareDenominate(int nMinRounds, int nMaxRounds, std::string& strErrorRet, std::vector<CTxDSIn>& vecTxDSInRet, std::vector<CTxOut>& vecTxOutRet)
{
if(!pwalletMain) {
strErrorRet = "Wallet is not initialized";
return false;
}
if (pwalletMain->IsLocked(true)) {
strErrorRet = "Wallet locked, unable to create transaction!";
return false;
}
if (GetEntriesCount() > 0) {
strErrorRet = "Already have pending entries in the PrivateSend pool";
return false;
}
// make sure returning vectors are empty before filling them up
vecTxDSInRet.clear();
vecTxOutRet.clear();
// ** find the coins we'll use
std::vector<CTxDSIn> vecTxDSIn;
std::vector<COutput> vCoins;
CAmount nValueIn = 0;
/*
Select the coins we'll use
if nMinRounds >= 0 it means only denominated inputs are going in and coming out
*/
std::vector<int> vecBits;
if (!CPrivateSend::GetDenominationsBits(nSessionDenom, vecBits)) {
strErrorRet = "Incorrect session denom";
return false;
}
std::vector<CAmount> vecStandardDenoms = CPrivateSend::GetStandardDenominations();
bool fSelected = pwalletMain->SelectCoinsByDenominations(nSessionDenom, vecStandardDenoms[vecBits.front()], CPrivateSend::GetMaxPoolAmount(), vecTxDSIn, vCoins, nValueIn, nMinRounds, nMaxRounds);
if (nMinRounds >= 0 && !fSelected) {
strErrorRet = "Can't select current denominated inputs";
return false;
}
LogPrintf("CPrivateSendClient::PrepareDenominate -- max value: %f\n", (double)nValueIn/COIN);
{
LOCK(pwalletMain->cs_wallet);
for (auto& txin : vecTxDSIn) {
pwalletMain->LockCoin(txin.prevout);
}
}
CAmount nValueLeft = nValueIn;
// Try to add every needed denomination, repeat up to 5-PRIVATESEND_ENTRY_MAX_SIZE times.
// NOTE: No need to randomize order of inputs because they were
// initially shuffled in CWallet::SelectCoinsByDenominations already.
int nStep = 0;
int nStepsMax = 5 + GetRandInt(PRIVATESEND_ENTRY_MAX_SIZE-5+1);
while (nStep < nStepsMax) {
BOOST_FOREACH(int nBit, vecBits) {
CAmount nValueDenom = vecStandardDenoms[nBit];
if (nValueLeft - nValueDenom < 0) continue;
// Note: this relies on a fact that both vectors MUST have same size
std::vector<CTxDSIn>::iterator it = vecTxDSIn.begin();
std::vector<COutput>::iterator it2 = vCoins.begin();
while (it2 != vCoins.end()) {
// we have matching inputs
if ((*it2).tx->vout[(*it2).i].nValue == nValueDenom) {
// add new input in resulting vector
vecTxDSInRet.push_back(*it);
// remove corresponting items from initial vectors
vecTxDSIn.erase(it);
vCoins.erase(it2);
CScript scriptDenom = keyHolderStorage.AddKey(pwalletMain);
// add new output
CTxOut txout(nValueDenom, scriptDenom);
vecTxOutRet.push_back(txout);
// subtract denomination amount
nValueLeft -= nValueDenom;
// step is complete
break;
}
++it;
++it2;
}
}
if(nValueLeft == 0) break;
nStep++;
}
{
// unlock unused coins
LOCK(pwalletMain->cs_wallet);
for (auto& txin : vecTxDSIn) {
pwalletMain->UnlockCoin(txin.prevout);
}
}
if (CPrivateSend::GetDenominations(vecTxOutRet) != nSessionDenom) {
// unlock used coins on failure
LOCK(pwalletMain->cs_wallet);
for (auto& txin : vecTxDSInRet) {
pwalletMain->UnlockCoin(txin.prevout);
}
keyHolderStorage.ReturnAll();
strErrorRet = "Can't make current denominated outputs";
return false;
}
// We also do not care about full amount as long as we have right denominations
return true;
}
// Create collaterals by looping through inputs grouped by addresses
bool CPrivateSendClient::MakeCollateralAmounts(CConnman& connman)
{
std::vector<CompactTallyItem> vecTally;
if(!pwalletMain->SelectCoinsGrouppedByAddresses(vecTally, false)) {
LogPrint("privatesend", "CPrivateSendClient::MakeCollateralAmounts -- SelectCoinsGrouppedByAddresses can't find any inputs!\n");
return false;
}
// First try to use only non-denominated funds
BOOST_FOREACH(CompactTallyItem& item, vecTally) {
if(!MakeCollateralAmounts(item, false, connman)) continue;
return true;
}
// There should be at least some denominated funds we should be able to break in pieces to continue mixing
BOOST_FOREACH(CompactTallyItem& item, vecTally) {
if(!MakeCollateralAmounts(item, true, connman)) continue;
return true;
}
// If we got here then smth is terribly broken actually
LogPrintf("CPrivateSendClient::MakeCollateralAmounts -- ERROR: Can't make collaterals!\n");
return false;
}
// Split up large inputs or create fee sized inputs
bool CPrivateSendClient::MakeCollateralAmounts(const CompactTallyItem& tallyItem, bool fTryDenominated, CConnman& connman)
{
LOCK2(cs_main, pwalletMain->cs_wallet);
// denominated input is always a single one, so we can check its amount directly and return early
if(!fTryDenominated && tallyItem.vecTxIn.size() == 1 && CPrivateSend::IsDenominatedAmount(tallyItem.nAmount))
return false;
CWalletTx wtx;
CAmount nFeeRet = 0;
int nChangePosRet = -1;
std::string strFail = "";
std::vector<CRecipient> vecSend;
// make our collateral address
CReserveKey reservekeyCollateral(pwalletMain);
// make our change address
CReserveKey reservekeyChange(pwalletMain);
CScript scriptCollateral;
CPubKey vchPubKey;
assert(reservekeyCollateral.GetReservedKey(vchPubKey, false)); // should never fail, as we just unlocked
scriptCollateral = GetScriptForDestination(vchPubKey.GetID());
vecSend.push_back((CRecipient){scriptCollateral, CPrivateSend::GetMaxCollateralAmount(), false});
// try to use non-denominated and not mn-like funds first, select them explicitly
CCoinControl coinControl;
coinControl.fAllowOtherInputs = false;
coinControl.fAllowWatchOnly = false;
// send change to the same address so that we were able create more denoms out of it later
coinControl.destChange = tallyItem.txdest;
BOOST_FOREACH(const CTxIn& txin, tallyItem.vecTxIn)
coinControl.Select(txin.prevout);
bool fSuccess = pwalletMain->CreateTransaction(vecSend, wtx, reservekeyChange,
nFeeRet, nChangePosRet, strFail, &coinControl, true, ONLY_NONDENOMINATED);
if(!fSuccess) {
LogPrintf("CPrivateSendClient::MakeCollateralAmounts -- ONLY_NONDENOMINATED: %s\n", strFail);
// If we failed then most likeky there are not enough funds on this address.
if(fTryDenominated) {
// Try to also use denominated coins (we can't mix denominated without collaterals anyway).
if(!pwalletMain->CreateTransaction(vecSend, wtx, reservekeyChange,
nFeeRet, nChangePosRet, strFail, &coinControl, true, ALL_COINS)) {
LogPrintf("CPrivateSendClient::MakeCollateralAmounts -- ALL_COINS Error: %s\n", strFail);
reservekeyCollateral.ReturnKey();
return false;
}
} else {
// Nothing else we can do.
reservekeyCollateral.ReturnKey();
return false;
}
}
reservekeyCollateral.KeepKey();
LogPrintf("CPrivateSendClient::MakeCollateralAmounts -- txid=%s\n", wtx.GetHash().GetHex());
// use the same nCachedLastSuccessBlock as for DS mixinx to prevent race
if(!pwalletMain->CommitTransaction(wtx, reservekeyChange, &connman)) {
LogPrintf("CPrivateSendClient::MakeCollateralAmounts -- CommitTransaction failed!\n");
return false;
}
nCachedLastSuccessBlock = nCachedBlockHeight;
return true;
}
// Create denominations by looping through inputs grouped by addresses
bool CPrivateSendClient::CreateDenominated(CConnman& connman)
{
LOCK2(cs_main, pwalletMain->cs_wallet);
std::vector<CompactTallyItem> vecTally;
if(!pwalletMain->SelectCoinsGrouppedByAddresses(vecTally)) {
LogPrint("privatesend", "CPrivateSendClient::CreateDenominated -- SelectCoinsGrouppedByAddresses can't find any inputs!\n");
return false;
}
bool fCreateMixingCollaterals = !pwalletMain->HasCollateralInputs();
BOOST_FOREACH(CompactTallyItem& item, vecTally) {
if(!CreateDenominated(item, fCreateMixingCollaterals, connman)) continue;
return true;
}
LogPrintf("CPrivateSendClient::CreateDenominated -- failed!\n");
return false;
}
// Create denominations
bool CPrivateSendClient::CreateDenominated(const CompactTallyItem& tallyItem, bool fCreateMixingCollaterals, CConnman& connman)
{
std::vector<CRecipient> vecSend;
CKeyHolderStorage keyHolderStorageDenom;
CAmount nValueLeft = tallyItem.nAmount;
nValueLeft -= CPrivateSend::GetCollateralAmount(); // leave some room for fees
LogPrintf("CreateDenominated0 nValueLeft: %f\n", (float)nValueLeft/COIN);
// ****** Add an output for mixing collaterals ************ /
if(fCreateMixingCollaterals) {
CScript scriptCollateral = keyHolderStorageDenom.AddKey(pwalletMain);
vecSend.push_back((CRecipient){ scriptCollateral, CPrivateSend::GetMaxCollateralAmount(), false });
nValueLeft -= CPrivateSend::GetMaxCollateralAmount();
}
// ****** Add outputs for denoms ************ /
// try few times - skipping smallest denoms first if there are too many of them already, if failed - use them too
int nOutputsTotal = 0;
bool fSkip = true;
do {
std::vector<CAmount> vecStandardDenoms = CPrivateSend::GetStandardDenominations();
BOOST_REVERSE_FOREACH(CAmount nDenomValue, vecStandardDenoms) {
if(fSkip) {
// Note: denoms are skipped if there are already DENOMS_COUNT_MAX of them
// and there are still larger denoms which can be used for mixing
// check skipped denoms
if(IsDenomSkipped(nDenomValue)) continue;
// find new denoms to skip if any (ignore the largest one)
if(nDenomValue != vecStandardDenoms.front() && pwalletMain->CountInputsWithAmount(nDenomValue) > DENOMS_COUNT_MAX) {
strAutoDenomResult = strprintf(_("Too many %f denominations, removing."), (float)nDenomValue/COIN);
LogPrintf("CPrivateSendClient::CreateDenominated -- %s\n", strAutoDenomResult);
vecDenominationsSkipped.push_back(nDenomValue);
continue;
}
}
int nOutputs = 0;
// add each output up to 11 times until it can't be added again
while(nValueLeft - nDenomValue >= 0 && nOutputs <= 10) {
CScript scriptDenom = keyHolderStorageDenom.AddKey(pwalletMain);
vecSend.push_back((CRecipient){ scriptDenom, nDenomValue, false });
//increment outputs and subtract denomination amount
nOutputs++;
nValueLeft -= nDenomValue;
LogPrintf("CreateDenominated1: totalOutputs: %d, nOutputsTotal: %d, nOutputs: %d, nValueLeft: %f\n", nOutputsTotal + nOutputs, nOutputsTotal, nOutputs, (float)nValueLeft/COIN);
}
nOutputsTotal += nOutputs;
if(nValueLeft == 0) break;
}
LogPrintf("CreateDenominated2: nOutputsTotal: %d, nValueLeft: %f\n", nOutputsTotal, (float)nValueLeft/COIN);
// if there were no outputs added, start over without skipping
fSkip = !fSkip;
} while (nOutputsTotal == 0 && !fSkip);
LogPrintf("CreateDenominated3: nOutputsTotal: %d, nValueLeft: %f\n", nOutputsTotal, (float)nValueLeft/COIN);
// if we have anything left over, it will be automatically send back as change - there is no need to send it manually
CCoinControl coinControl;
coinControl.fAllowOtherInputs = false;
coinControl.fAllowWatchOnly = false;
// send change to the same address so that we were able create more denoms out of it later
coinControl.destChange = tallyItem.txdest;
BOOST_FOREACH(const CTxIn& txin, tallyItem.vecTxIn)
coinControl.Select(txin.prevout);
CWalletTx wtx;
CAmount nFeeRet = 0;
int nChangePosRet = -1;
std::string strFail = "";
// make our change address
CReserveKey reservekeyChange(pwalletMain);
bool fSuccess = pwalletMain->CreateTransaction(vecSend, wtx, reservekeyChange,
nFeeRet, nChangePosRet, strFail, &coinControl, true, ONLY_NONDENOMINATED);
if(!fSuccess) {
LogPrintf("CPrivateSendClient::CreateDenominated -- Error: %s\n", strFail);
keyHolderStorageDenom.ReturnAll();
return false;
}
keyHolderStorageDenom.KeepAll();
if(!pwalletMain->CommitTransaction(wtx, reservekeyChange, &connman)) {
LogPrintf("CPrivateSendClient::CreateDenominated -- CommitTransaction failed!\n");
return false;
}
// use the same nCachedLastSuccessBlock as for DS mixing to prevent race
nCachedLastSuccessBlock = nCachedBlockHeight;
LogPrintf("CPrivateSendClient::CreateDenominated -- txid=%s\n", wtx.GetHash().GetHex());
return true;
}
void CPrivateSendClient::RelayIn(const CDarkSendEntry& entry, CConnman& connman)
{
if(!infoMixingMasternode.fInfoValid) return;
connman.ForNode(infoMixingMasternode.addr, [&entry, &connman](CNode* pnode) {
LogPrintf("CPrivateSendClient::RelayIn -- found master, relaying message to %s\n", pnode->addr.ToString());
connman.PushMessage(pnode, NetMsgType::DSVIN, entry);
return true;
});
}
void CPrivateSendClient::SetState(PoolState nStateNew)
{
LogPrintf("CPrivateSendClient::SetState -- nState: %d, nStateNew: %d\n", nState, nStateNew);
nState = nStateNew;
}
void CPrivateSendClient::UpdatedBlockTip(const CBlockIndex *pindex)
{
nCachedBlockHeight = pindex->nHeight;
LogPrint("privatesend", "CPrivateSendClient::UpdatedBlockTip -- nCachedBlockHeight: %d\n", nCachedBlockHeight);
}
//TODO: Rename/move to core
void ThreadCheckPrivateSendClient(CConnman& connman)
{
if(fLiteMode) return; // disable all VNet specific functionality
if(fMasterNode) return; // no client-side mixing on masternodes
static bool fOneThread;
if(fOneThread) return;
fOneThread = true;
// Make this thread recognisable as the PrivateSend thread
RenameThread("vnet-ps-client");
unsigned int nTick = 0;
unsigned int nDoAutoNextRun = nTick + PRIVATESEND_AUTO_TIMEOUT_MIN;
while (true)
{
MilliSleep(1000);
if(masternodeSync.IsBlockchainSynced() && !ShutdownRequested()) {
nTick++;
privateSendClient.CheckTimeout();
if(nDoAutoNextRun == nTick) {
privateSendClient.DoAutomaticDenominating(connman);
nDoAutoNextRun = nTick + PRIVATESEND_AUTO_TIMEOUT_MIN + GetRandInt(PRIVATESEND_AUTO_TIMEOUT_MAX - PRIVATESEND_AUTO_TIMEOUT_MIN);
}
}
}
}
| [
"lion_912@mail.ru"
] | lion_912@mail.ru |
883f6947e492ead9aaec5be32a9054871ae7310c | 36191af4439bcc5a200b3188ff83552dd47a49c3 | /dp/221_Maximal Square.cpp | 8d1e01a36e70cf8c321388f0bee337dcdbfab0e0 | [] | no_license | zjuAJW/leetcode | ff57fc1478ee5763fe28c7e5d53ef751979c7220 | b4af87f67241c263ad0ab52ae2813f34c83a3144 | refs/heads/master | 2021-05-08T06:37:57.342386 | 2018-02-02T06:24:09 | 2018-02-02T06:24:09 | 106,639,610 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,114 | cpp | /*
Given a 2D binary matrix filled with 0's and 1's, find the largest square containing only 1's and return its area.
For example, given the following matrix:
1 0 1 0 0
1 0 1 1 1
1 1 1 1 1
1 0 0 1 0
Return 4.
找一个矩阵中的最大正方形
递推式我是想出来了,确实是对的,但是我不知道为什么是这样,凭感觉的。。。
另外,如果不告诉我这道题是dp,我能想到用dp做?
*/
class Solution {
public:
int maximalSquare(vector<vector<char>>& matrix) {
int m = matrix.size();
if (m == 0) {
return 0;
}
int n = matrix[0].size();
int ret = 0;
vector<vector<int>> dp(m + 1, vector<int>(n + 1, 0));
for (int i = 1; i <= m; ++i) {
for (int j = 1; j <= n; ++j) {
if (matrix[i - 1][j - 1] == '1') {
dp[i][j] = min(dp[i - 1][j - 1], min(dp[i - 1][j], dp[i][j - 1])) + 1;
ret = max(dp[i][j], ret);
}
else
dp[i][j] = 0;
}
}
return ret * ret;
}
}; | [
"wja_1993@163.com"
] | wja_1993@163.com |
9d27d4c35bf76705ef68a2a4505eb9fa7faf8b81 | 7e8ac8cdda5705f3db41c218bb1ef323ababdd6d | /code/include/renderable.h | fa5bd6834c0d56e0689bff592f7e891e4f803175 | [] | no_license | doctorwk007/OpenGL-and-GDAL-Tutorials | 6e6d2a1b4427af275ba1f122c9de64689e6baba2 | 96a314a4a87504edd4558f8f304fb3fd327892fb | refs/heads/master | 2020-12-25T23:47:07.917897 | 2015-07-22T04:51:03 | 2015-07-22T04:51:03 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 987 | h | #include <renderer.h>
//#define GLM_FORCE_RADIANS
#include <glm/glm.hpp>
#include <glm/gtc/matrix_transform.hpp>
#include <glm/gtc/type_ptr.hpp>
#include <glm/gtx/rotate_vector.hpp>
#ifndef _RENDERABLE_H_
#define _RENDERABLE_H_
// A pure virtual interface class to make rendering things easierish.
class renderable
{
public:
//renderable()
//{};
// A nice generic interface function for rendereing things
virtual void render(glm::mat4& view, glm::mat4& projection) = 0;
// Need to include the mvp matrix here as well -- we need to update the world somehow
virtual void update(float dt) = 0;
// A function that muse be called after opengl has been initialized!!!!!
virtual void setup() = 0;
// May include a lighting phase and blend phase here :D when
// I reach differered rendering.
protected:
renderer Renderer;
// Leaving the buffer undefined to be handle by the person making the class
// everything needs some type of object space.
glm::mat4 model;
};
#endif
| [
"chasec2331@gmail.com"
] | chasec2331@gmail.com |
bc2395151bc90d976b2c435f0a8f848cf15fbe68 | 4b3f40290e0c90847e791a106b420afa92af9768 | /include/cn24/util/StatAggregator.h | 9cb5e86ad9b821e18f54e03086a7304346e4b6c0 | [
"BSD-3-Clause",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | cvjena/cn24-active | e6004271f0b4948f407d64afadbcaca23cb7cebc | 5f40b63aebd14c0658136b402e3df010e405de05 | refs/heads/master | 2020-04-22T04:58:38.389624 | 2019-02-11T14:31:15 | 2019-02-11T14:31:15 | 170,142,558 | 3 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 2,737 | h | /*
* This file is part of the CN24 semantic segmentation software,
* copyright (C) 2015 Clemens-Alexander Brust (ikosa dot de at gmail dot com).
*
* For licensing information, see the LICENSE file included with this project.
*/
/**
* @file StatAggregator.h
* @brief Collects data from various sources and aggregates them into a statistic
*
* @author Clemens-Alexander Brust (ikosa dot de at gmail dot com)
*/
#ifndef CONV_STATAGGREGATOR_H
#define CONV_STATAGGREGATOR_H
#include <functional>
#include <vector>
#include <string>
#include <chrono>
#include <climits>
#include "Config.h"
namespace Conv
{
// Forward declarations
class StatSink;
class Trainer;
class NetStatus;
// Hardcoded stats
struct HardcodedStats {
double seconds_elapsed = 0.0;
unsigned long iterations = 0UL;
unsigned long weights = 0UL;
unsigned long epoch = 0UL;
bool is_training = false;
std::string current_experiment = "unnamed";
std::string current_testing_dataset = "unnamed";
void Reset() {
seconds_elapsed = 0.0;
iterations = 0UL;
weights = 0UL;
}
};
struct Stat {
double value = 0.0;
bool is_null = false;
};
struct StatDescriptor {
bool nullable = false;
std::string description = "";
std::string unit = "";
// Lambdas for processing
std::function<void(Stat&)> init_function = [] (Stat& stat) {UNREFERENCED_PARAMETER(stat);};
std::function<void(Stat&,double)> update_function = [] (Stat& stat, double user_value) {UNREFERENCED_PARAMETER(stat); UNREFERENCED_PARAMETER(user_value);};
std::function<Stat(HardcodedStats&, Stat&)> output_function =
[] (HardcodedStats& hc_stats, Stat& stat) -> Stat {UNREFERENCED_PARAMETER(hc_stats); return stat;};
// For easy access
unsigned int stat_id = UINT_MAX;
};
class StatAggregator {
friend class Trainer;
friend class NetStatus;
public:
unsigned int RegisterStat(StatDescriptor* stat_descriptor);
unsigned int RegisterSink(StatSink* stat_sink);
void Initialize();
void Update(unsigned int stat_id, double user_value);
void Generate();
void StartRecording();
void StopRecording();
void Reset();
void Snapshot();
void SetCurrentExperiment(std::string current_experiment);
void SetCurrentTestingDataset(unsigned int current_testing_dataset);
HardcodedStats hardcoded_stats_;
private:
// State
enum StatAggregatorState {
STOPPED, RECORDING, INIT } state_ = INIT;
std::chrono::time_point<std::chrono::system_clock> start_time_;
// Stats
std::vector<Stat> stats_;
// Descriptors
std::vector<StatDescriptor*> stat_descriptors_;
unsigned int stat_descriptor_count_ = 0;
// Sinks
std::vector<StatSink*> stat_sinks_;
unsigned int stat_sink_count_ = 0;
};
}
#endif
| [
"clemens-alexander.brust@uni-jena.de"
] | clemens-alexander.brust@uni-jena.de |
3fa2ee9c7093daadf05d276d6abb47fa2a2fef5e | 2610e543db33721ece59741ec94c26e50158434b | /kernel/mem.h | 6d727e71d1a33de5a788fbf0e416a13abb31967d | [
"LicenseRef-scancode-other-copyleft",
"MIT",
"ISC",
"BSD-2-Clause"
] | permissive | zekungao/yosys | 769d3ac5ef235140b5079b42930b7aa03692c96b | aa971366d681e54cc7cd76ddda5066b4908f51f2 | refs/heads/master | 2023-06-21T04:31:04.888387 | 2021-07-15T08:21:15 | 2021-07-15T08:21:15 | 366,325,247 | 1 | 0 | ISC | 2021-07-20T02:46:00 | 2021-05-11T09:22:22 | C++ | UTF-8 | C++ | false | false | 2,184 | h | /*
* yosys -- Yosys Open SYnthesis Suite
*
* Copyright (C) 2020 Marcelina Kościelnicka <mwk@0x04.net>
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
*/
#ifndef MEM_H
#define MEM_H
#include "kernel/yosys.h"
YOSYS_NAMESPACE_BEGIN
struct MemRd {
dict<IdString, Const> attributes;
Cell *cell;
bool clk_enable, clk_polarity;
bool transparent;
SigSpec clk, en, addr, data;
MemRd() : cell(nullptr) {}
};
struct MemWr {
dict<IdString, Const> attributes;
Cell *cell;
bool clk_enable, clk_polarity;
SigSpec clk, en, addr, data;
MemWr() : cell(nullptr) {}
};
struct MemInit {
dict<IdString, Const> attributes;
Cell *cell;
Const addr;
Const data;
MemInit() : cell(nullptr) {}
};
struct Mem {
Module *module;
IdString memid;
dict<IdString, Const> attributes;
bool packed;
RTLIL::Memory *mem;
Cell *cell;
int width, start_offset, size;
std::vector<MemInit> inits;
std::vector<MemRd> rd_ports;
std::vector<MemWr> wr_ports;
void remove();
void emit();
void remove_wr_port(int idx);
void remove_rd_port(int idx);
void clear_inits();
Const get_init_data() const;
static std::vector<Mem> get_all_memories(Module *module);
static std::vector<Mem> get_selected_memories(Module *module);
Cell *extract_rdff(int idx);
Mem(Module *module, IdString memid, int width, int start_offset, int size) : module(module), memid(memid), packed(false), mem(nullptr), cell(nullptr), width(width), start_offset(start_offset), size(size) {}
};
YOSYS_NAMESPACE_END
#endif
| [
"mwk@0x04.net"
] | mwk@0x04.net |
875082a94ccc0795a2ba87a45cce6d3fd4ddba34 | 1a434daaeb001c5d8c54264805c953a5f4c33196 | /simulator.cc | 76947b1a28d90d109f886890ff11182261a63d7e | [] | no_license | tweekes1/Simple-OS-Simulator | 7a31b9adfb759ba6efe515c0280fe769625c76a8 | 970db747e95cb7ad090d68d548d0acc74ddb3c81 | refs/heads/master | 2020-09-04T00:09:19.378248 | 2019-11-04T23:11:39 | 2019-11-04T23:11:39 | 219,613,128 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,039 | cc | /**
* Main execution code for simulator. First initial prompt assumes
* perfect input (ONLY NUMBERS).
*
* This driver program takes the commands from the standard input and if
* the first piece of the input matches a particular criteria that needs a
* number i.e m <num> we take the second value place it into a stringstream
* and then push that stringstream into an integer value. If the command receives
* something that is not wanted the command is invalid and the user is informed.
*/
#include <iostream>
#include <string>
#include <sstream>
#include "helpers.h"
#include "operating_system.h"
using namespace std;
int main() {
stringstream s_stream;
long memory_{0};
int page_{0}, disk_{0};
while (true) {
cout << "Enter Memory Amount: ";
cin >> memory_;
cout << "Enter Page Size: ";
cin >> page_;
cout << "Enter Number of Disks: ";
cin >> disk_;
break;
}
string user_input, first, second, third;
OperatingSystem os{memory_, page_, disk_};
os.help();
while (first != "bsod") {
cout << "> ";
getline(cin, user_input);
stringstream s(user_input), stream;
s >> first;
if (first == "A") {
os.spawnProcess();
} else if (first == "Q") {
os.preemptProcess();
} else if (first == "fork") {
os.forkProcess();
} else if (first == "exit") {
os.exitProcess();
} else if (first == "wait") {
os.waitProcess();
} else if (first == "S") {
s >> second;
if (second == "i") {
os.snapshotIO();
} else if (second == "m") {
os.snapshotMemory();
} else if (second == "r") {
os.snapshotCPU();
} else {
cout << "Invalid command" << endl;
}
} else if (first == "d") {
s >> second;
if (isNumber(second)) {
stream << second;
int disk_num;
stream >> disk_num;
s >> third;
os.useDisk(disk_num, third);
} else {
cout << "Invalid command" << endl;
}
} else if (first == "D") {
s >> second;
if (isNumber(second)) {
stream << second;
int disk_num;
stream >> disk_num;
os.finishDiskUsage(disk_num);
} else {
cout << "Invalid command" << endl;
}
} else if (first == "m") {
s >> second;
if (isNumber(second)) {
stream << second;
int mem_address;
stream >> mem_address;
os.useMemory(mem_address);
} else if (first == "help") {
os.help();
} else {
cout << "Invalid command" << endl;
}
}
}
} | [
"tmweekes1@gmail.com"
] | tmweekes1@gmail.com |
1ce285d25dec4c55c0d4cc4eebb6e74a8c40fc47 | d40efadec5724c236f1ec681ac811466fcf848d8 | /branches/fs2_open_3_6_12/code/fs2netd/tcp_client.h | 5f5a2404cf8026a7913b05860d6d164df83da65c | [] | no_license | svn2github/fs2open | 0fcbe9345fb54d2abbe45e61ef44a41fa7e02e15 | c6d35120e8372c2c74270c85a9e7d88709086278 | refs/heads/master | 2020-05-17T17:37:03.969697 | 2015-01-08T15:24:21 | 2015-01-08T15:24:21 | 14,258,345 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,617 | h | // Client.h
// Client Functions for FS2Open PXO
// Derek Meek
// 2-14-2003
// ############## ATTENTION ##########
// Licensed under the Academic Free License version 2.0
// View License at http://www.opensource.org/licenses/afl-2.0.php
// ###################################
#if !defined(__pxo_client_h_)
#define __pxo_client_h_
#include "globalincs/pstypes.h"
#include "fs2netd/protocol.h"
#include "fs2netd/tcp_socket.h"
#include <string>
struct player;
struct netgame_info;
int FS2NetD_CheckSingleMission(const char *m_name, uint crc32, bool do_send);
int FS2NetD_SendPlayerData(const char *player_name, player *pl, bool do_send);
int FS2NetD_GetPlayerData(const char *player_name, player *pl, bool can_create, bool do_send);
int FS2NetD_GetBanList(SCP_vector<std::string> &mask_list, bool do_send);
int FS2NetD_GetMissionsList(SCP_vector<file_record> &m_list, bool do_send);
int FS2NetD_ValidateTableList(bool do_send);
int FS2NetD_Login(const char *username, const char *password, bool do_send);
int FS2NetD_CheckValidID();
void FS2NetD_CheckDuplicateLogin();
void FS2NetD_SendServerStart();
void FS2NetD_SendServerUpdate();
void FS2NetD_SendServerDisconnect();
void FS2NetD_RequestServerList();
void FS2NetD_GameCountUpdate(char *chan_name);
void FS2NetD_Ping();
void FS2NetD_Pong(int tstamp);
// Some easy to use macros for handling the packet data
#define BASE_PACKET_SIZE (int)(sizeof(ubyte) + sizeof(int))
#define PXO_ADD_DATA(d) do { Assert(buffer_size+sizeof(d) <= sizeof(buffer)); memcpy(buffer+buffer_size, &d, sizeof(d)); buffer_size += sizeof(d); } while (0)
#define PXO_ADD_SHORT(d) do { Assert(buffer_size+sizeof(short) <= sizeof(buffer)); short swap = INTEL_SHORT(d); memcpy(buffer+buffer_size, &swap, sizeof(short)); buffer_size += sizeof(short); } while (0)
#define PXO_ADD_USHORT(d) do { Assert(buffer_size+sizeof(ushort) <= sizeof(buffer)); ushort swap = INTEL_SHORT(d); memcpy(buffer+buffer_size, &swap, sizeof(ushort)); buffer_size += sizeof(ushort); } while (0)
#define PXO_ADD_INT(d) do { Assert(buffer_size+sizeof(int) <= sizeof(buffer)); int swap = INTEL_INT(d); memcpy(buffer+buffer_size, &swap, sizeof(int)); buffer_size += sizeof(int); } while (0)
#define PXO_ADD_UINT(d) do { Assert(buffer_size+sizeof(uint) <= sizeof(buffer)); uint swap = INTEL_INT(d); memcpy(buffer+buffer_size, &swap, sizeof(uint)); buffer_size += sizeof(uint); } while (0)
#define PXO_ADD_STRING(s) do { Assert(buffer_size+strlen(s)+sizeof(int) <= sizeof(buffer)); int len = strlen(s); PXO_ADD_INT(len); if (len > 0) { memcpy(buffer+buffer_size, s, len ); buffer_size += len; } } while(0)
#define PXO_GET_DATA(d) do { Assert(buffer_offset+sizeof(d) <= sizeof(buffer)); memcpy(&d, buffer+buffer_offset, sizeof(d) ); buffer_offset += sizeof(d); } while(0)
#define PXO_GET_SHORT(d) do { Assert(buffer_offset+sizeof(short) <= sizeof(buffer)); short swap; memcpy(&swap, buffer+buffer_offset, sizeof(short) ); d = INTEL_SHORT(swap); buffer_offset += sizeof(short); } while(0)
#define PXO_GET_USHORT(d) do { Assert(buffer_offset+sizeof(ushort) <= sizeof(buffer)); ushort swap; memcpy(&swap, buffer+buffer_offset, sizeof(ushort) ); d = INTEL_SHORT(swap); buffer_offset += sizeof(ushort); } while(0)
#define PXO_GET_INT(d) do { Assert(buffer_offset+sizeof(int) <= sizeof(buffer)); int swap; memcpy(&swap, buffer+buffer_offset, sizeof(int) ); d = INTEL_INT(swap); buffer_offset += sizeof(int); } while(0)
#define PXO_GET_UINT(d) do { Assert(buffer_offset+sizeof(uint) <= sizeof(buffer)); uint swap; memcpy(&swap, buffer+buffer_offset, sizeof(uint) ); d = INTEL_INT(swap); buffer_offset += sizeof(uint); } while(0)
#define PXO_GET_STRING(s) do { Assert(buffer_offset+sizeof(int) <= sizeof(buffer)); s[0] = '\0'; int len; memcpy(&len, buffer+buffer_offset, sizeof(int)); len = INTEL_INT(len); buffer_offset += sizeof(int); if (len > 0) { memcpy(s, buffer+buffer_offset, len); buffer_offset += len; s[len] = '\0'; } } while(0)
// initialize a packet
#define INIT_PACKET(x) { memset(buffer, 0, sizeof(buffer)); buffer_size = 0; ubyte pckt = (x); PXO_ADD_DATA(pckt); PXO_ADD_INT(buffer_size); }
// we are done with a new packet, so update the final packet size
#define DONE_PACKET() { int swap = INTEL_INT(buffer_size); memcpy(buffer+sizeof(ubyte), &swap, sizeof(buffer_size)); }
// verify received packet
#define VRFY_PACKET(x) { buffer_offset = 0; ubyte pckt; PXO_GET_DATA(pckt); if (pckt != (x)) break; my_packet = true; PXO_GET_INT(buffer_size); }
#define VRFY_PACKET2(x) { buffer_offset = 0; ubyte pckt; PXO_GET_DATA(pckt); if (pckt == (x)) my_packet = true; PXO_GET_INT(buffer_size); }
#endif
| [
"Goober5000@387891d4-d844-0410-90c0-e4c51a9137d3"
] | Goober5000@387891d4-d844-0410-90c0-e4c51a9137d3 |
cd4c3945e5a2454d1ea456b6664df73044707d01 | d9cf68794e4a6466ca0e9719e5684c8c969a76b0 | /code/audio/FaustExports/BasicKarplusStrong.cpp | 476978080bf4ac34b8afdbfbaa0602566fa9a987 | [] | no_license | thecoreyford/Undergrad-Internship | d7e3e625f078d45c8f0fd38cf9115fe08de810fc | 964af3d7fcb4e2d9f43ac03816177c719df5805d | refs/heads/master | 2020-03-25T08:27:21.177361 | 2018-08-05T14:07:54 | 2018-08-05T14:07:54 | 143,613,254 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 10,211 | cpp | /* ------------------------------------------------------------
name: "BasicKarplusStrong"
Code generated with Faust 2.5.34 (https://faust.grame.fr)
Compilation options: cpp, -scal -ftz 0
------------------------------------------------------------ */
#ifndef __BasicKarplusStrong_H__
#define __BasicKarplusStrong_H__
/**
* @file GENERATED FROM... audio_board.cpp
* @author Corey Ford
* @date 20/07/2018
* @version 1.0
*
* @brief The architecture file used to generate DSP classes for the audio development board.
* @section DESCRIPTION
*
* For more in depth and detailed usage @see README within the FAUST Export directory!
*/
/************************************************************************
IMPORTANT NOTE : this file contains two clearly delimited sections :
the ARCHITECTURE section (in two parts) and the USER section. Each section
is governed by its own copyright and license. Please check individually
each section for license and copyright information.
*************************************************************************/
/*******************BEGIN ARCHITECTURE SECTION (part 1/2)****************/
/************************************************************************
FAUST Architecture File
Copyright (C) 2003-2011 GRAME, Centre National de Creation Musicale
---------------------------------------------------------------------
This Architecture section 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/>.
EXCEPTION : As a special exception, you may create a larger work
that contains this FAUST architecture section and distribute
that work under terms of your choice, so long as this FAUST
architecture section is not modified.
************************************************************************
************************************************************************/
#include <stdlib.h> //TODO(corey2.ford@live.uwe.ac.uk): can likely strip some of these out down the line.
#include <stdio.h>
#include <string.h>
#include <limits.h>
#include <math.h>
#include <errno.h>
#include <time.h>
#include <ctype.h>
#include <vector>
#include <stack>
#include <string>
#include <map>
#include <iostream>
#include "faust/gui/console.h"
#include "faust/dsp/dsp.h"
#include "faust/misc.h"
#include "faust/audio/channels.h"
/******************************************************************************
*******************************************************************************
VECTOR INTRINSICS
*******************************************************************************
*******************************************************************************/
/********************END ARCHITECTURE SECTION (part 1/2)****************/
/**************************BEGIN USER SECTION **************************/
#ifndef FAUSTFLOAT
#define FAUSTFLOAT float
#endif
#include <cmath>
#include <math.h>
float BasicKarplusStrong_faustpower2_f(float value) {
return (value * value);
}
#ifndef FAUSTCLASS
#define FAUSTCLASS BasicKarplusStrong
#endif
#ifdef __APPLE__
#define exp10f __exp10f
#define exp10 __exp10
#endif
class BasicKarplusStrong : public dsp {
private:
FAUSTFLOAT fHslider0;
int fSamplingFreq;
float fConst0;
float fConst1;
FAUSTFLOAT fHslider1;
FAUSTFLOAT fHslider2;
float fRec1[3];
FAUSTFLOAT fButton0;
float fVec0[2];
int IOTA;
float fRec0[4096];
public:
void metadata(Meta* m) {
m->declare("analyzers.lib/name", "Faust Analyzer Library");
m->declare("analyzers.lib/version", "0.0");
m->declare("basics.lib/name", "Faust Basic Element Library");
m->declare("basics.lib/version", "0.0");
m->declare("compressors.lib/name", "Faust Compressor Effect Library");
m->declare("compressors.lib/version", "0.0");
m->declare("delays.lib/name", "Faust Delay Library");
m->declare("delays.lib/version", "0.0");
m->declare("envelopes.lib/author", "GRAME");
m->declare("envelopes.lib/copyright", "GRAME");
m->declare("envelopes.lib/license", "LGPL with exception");
m->declare("envelopes.lib/name", "Faust Envelope Library");
m->declare("envelopes.lib/version", "0.0");
m->declare("filename", "BasicKarplusStrong");
m->declare("filters.lib/name", "Faust Filters Library");
m->declare("filters.lib/version", "0.0");
m->declare("hoa.lib/author", "Pierre Guillot");
m->declare("hoa.lib/copyright", "2012-2013 Guillot, Paris, Colafrancesco, CICM labex art H2H, U. Paris 8");
m->declare("hoa.lib/name", "High Order Ambisonics library");
m->declare("maths.lib/author", "GRAME");
m->declare("maths.lib/copyright", "GRAME");
m->declare("maths.lib/license", "LGPL with exception");
m->declare("maths.lib/name", "Faust Math Library");
m->declare("maths.lib/version", "2.1");
m->declare("misceffects.lib/name", "Faust Math Library");
m->declare("misceffects.lib/version", "2.0");
m->declare("name", "BasicKarplusStrong");
m->declare("noises.lib/name", "Faust Noise Generator Library");
m->declare("noises.lib/version", "0.0");
m->declare("oscillators.lib/name", "Faust Oscillator Library");
m->declare("oscillators.lib/version", "0.0");
m->declare("phaflangers.lib/name", "Faust Phaser and Flanger Library");
m->declare("phaflangers.lib/version", "0.0");
m->declare("reverbs.lib/name", "Faust Reverb Library");
m->declare("reverbs.lib/version", "0.0");
m->declare("routes.lib/name", "Faust Signal Routing Library");
m->declare("routes.lib/version", "0.0");
m->declare("signals.lib/name", "Faust Signal Routing Library");
m->declare("signals.lib/version", "0.0");
m->declare("spats.lib/name", "Faust Spatialization Library");
m->declare("spats.lib/version", "0.0");
m->declare("synths.lib/name", "Faust Synthesizer Library");
m->declare("synths.lib/version", "0.0");
m->declare("vaeffects.lib/name", "Faust Virtual Analog Filter Effect Library");
m->declare("vaeffects.lib/version", "0.0");
}
virtual int getNumInputs() {
return 0;
}
virtual int getNumOutputs() {
return 2;
}
virtual int getInputRate(int channel) {
int rate;
switch (channel) {
default: {
rate = -1;
break;
}
}
return rate;
}
virtual int getOutputRate(int channel) {
int rate;
switch (channel) {
case 0: {
rate = 1;
break;
}
case 1: {
rate = 1;
break;
}
default: {
rate = -1;
break;
}
}
return rate;
}
static void classInit(int samplingFreq) {
}
virtual void instanceConstants(int samplingFreq) {
fSamplingFreq = samplingFreq;
fConst0 = min(192000.0f, max(1.0f, float(fSamplingFreq)));
fConst1 = (3.14159274f / fConst0);
}
virtual void instanceResetUserInterface() {
fHslider0 = FAUSTFLOAT(1.0f);
fHslider1 = FAUSTFLOAT(20.0f);
fHslider2 = FAUSTFLOAT(440.0f);
fButton0 = FAUSTFLOAT(0.0f);
}
virtual void instanceClear() {
for (int l0 = 0; (l0 < 3); l0 = (l0 + 1)) {
fRec1[l0] = 0.0f;
}
for (int l1 = 0; (l1 < 2); l1 = (l1 + 1)) {
fVec0[l1] = 0.0f;
}
IOTA = 0;
for (int l2 = 0; (l2 < 4096); l2 = (l2 + 1)) {
fRec0[l2] = 0.0f;
}
}
virtual void init(int samplingFreq) {
classInit(samplingFreq);
instanceInit(samplingFreq);
}
virtual void instanceInit(int samplingFreq) {
instanceConstants(samplingFreq);
instanceResetUserInterface();
instanceClear();
}
virtual BasicKarplusStrong* clone() {
return new BasicKarplusStrong();
}
virtual int getSampleRate() {
return fSamplingFreq;
}
virtual void buildUserInterface(UI* ui_interface) {
ui_interface->openVerticalBox("BasicKarplusStrong");
ui_interface->addHorizontalSlider("Absorbstion", &fHslider0, 1.0f, 0.0f, 1.0f, 0.00100000005f);
ui_interface->addHorizontalSlider("Cutoff", &fHslider1, 20.0f, 20.0f, 2000.0f, 1.0f);
ui_interface->addHorizontalSlider("Frequency", &fHslider2, 440.0f, 80.0f, 1200.0f, 1.0f);
ui_interface->addButton("gate", &fButton0);
ui_interface->closeBox();
}
virtual void compute(int count, FAUSTFLOAT** inputs, FAUSTFLOAT** outputs) {
FAUSTFLOAT* output0 = outputs[0];
FAUSTFLOAT* output1 = outputs[1];
float fSlow0 = tanf((fConst1 * float(fHslider1)));
float fSlow1 = (1.0f / fSlow0);
float fSlow2 = (((fSlow1 + 1.41421354f) / fSlow0) + 1.0f);
float fSlow3 = (float(fHslider0) / fSlow2);
float fSlow4 = (fConst0 / float(fHslider2));
float fSlow5 = floorf(fSlow4);
float fSlow6 = (fSlow5 + (1.0f - fSlow4));
int iSlow7 = int(fSlow4);
int iSlow8 = (min(65537, max(0, iSlow7)) + 1);
float fSlow9 = (fSlow4 - fSlow5);
int iSlow10 = (min(65537, max(0, (iSlow7 + 1))) + 1);
float fSlow11 = (1.0f / fSlow2);
float fSlow12 = (2.0f * (1.0f - (1.0f / BasicKarplusStrong_faustpower2_f(fSlow0))));
float fSlow13 = (((fSlow1 + -1.41421354f) / fSlow0) + 1.0f);
float fSlow14 = float(fButton0);
for (int i = 0; (i < count); i = (i + 1)) {
fRec1[0] = (((fSlow6 * fRec0[((IOTA - iSlow8) & 4095)]) + (fSlow9 * fRec0[((IOTA - iSlow10) & 4095)])) - (fSlow11 * ((fSlow12 * fRec1[1]) + (fSlow13 * fRec1[2]))));
fVec0[0] = fSlow14;
fRec0[(IOTA & 4095)] = ((fSlow3 * (fRec1[2] + (fRec1[0] + (2.0f * fRec1[1])))) + float(((fSlow14 - fVec0[1]) > 0.0f)));
output0[i] = FAUSTFLOAT(fRec0[((IOTA - 0) & 4095)]);
output1[i] = FAUSTFLOAT(fRec0[((IOTA - 0) & 4095)]);
fRec1[2] = fRec1[1];
fRec1[1] = fRec1[0];
fVec0[1] = fVec0[0];
IOTA = (IOTA + 1);
}
}
};
/***************************END USER SECTION ***************************/
/*******************BEGIN ARCHITECTURE SECTION (part 2/2)***************/
BasicKarplusStrong DSP; //declared global by faust
/********************END ARCHITECTURE SECTION (part 2/2)****************/
#endif
| [
"corey2.ford@live.uwe.ac.uk"
] | corey2.ford@live.uwe.ac.uk |
446f030b624b2674943afa78762de9c06a1fe118 | d85c52b1b28cf2aedaf925bdcf8876ead2d39d26 | /qt/include/QtGui/5.9.0/QtGui/qpa/qplatformwindow.h | 8af8791bb4a15be1f1023e1be3ae6c13dced52fc | [
"MIT"
] | permissive | nicholasammann/elba | 65c053c7d79bd67d09eb5df2356183605c9b9a18 | 8d7a8ae7c8b55b87ee7dcd02aaea1b175e6dd8ce | refs/heads/stable | 2021-04-27T03:53:35.753179 | 2019-08-08T01:56:53 | 2019-08-08T01:56:53 | 122,722,831 | 1 | 0 | MIT | 2019-08-08T01:56:54 | 2018-02-24T09:02:43 | C++ | UTF-8 | C++ | false | false | 5,824 | h | /****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 2.0 or (at your option) the GNU General
** Public license version 3 or any later version approved by the KDE Free
** Qt Foundation. The licenses are as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-2.0.html and
** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef QPLATFORMWINDOW_H
#define QPLATFORMWINDOW_H
//
// W A R N I N G
// -------------
//
// This file is part of the QPA API and is not meant to be used
// in applications. Usage of this API may make your code
// source and binary incompatible with future versions of Qt.
//
#include <QtGui/qtguiglobal.h>
#include <QtCore/qscopedpointer.h>
#include <QtCore/qrect.h>
#include <QtCore/qmargins.h>
#include <QtCore/qstring.h>
#include <QtGui/qwindowdefs.h>
#include <QtGui/qwindow.h>
#include <qpa/qplatformopenglcontext.h>
#include <qpa/qplatformsurface.h>
QT_BEGIN_NAMESPACE
class QPlatformScreen;
class QPlatformWindowPrivate;
class QWindow;
class QIcon;
class QRegion;
class Q_GUI_EXPORT QPlatformWindow : public QPlatformSurface
{
Q_DECLARE_PRIVATE(QPlatformWindow)
public:
explicit QPlatformWindow(QWindow *window);
virtual ~QPlatformWindow();
QWindow *window() const;
QPlatformWindow *parent() const;
QPlatformScreen *screen() const;
virtual QSurfaceFormat format() const Q_DECL_OVERRIDE;
virtual void setGeometry(const QRect &rect);
virtual QRect geometry() const;
virtual QRect normalGeometry() const;
virtual QMargins frameMargins() const;
virtual void setVisible(bool visible);
virtual void setWindowFlags(Qt::WindowFlags flags);
virtual void setWindowState(Qt::WindowState state);
virtual WId winId() const;
virtual void setParent(const QPlatformWindow *window);
virtual void setWindowTitle(const QString &title);
virtual void setWindowFilePath(const QString &title);
virtual void setWindowIcon(const QIcon &icon);
virtual void raise();
virtual void lower();
virtual bool isExposed() const;
virtual bool isActive() const;
virtual bool isAncestorOf(const QPlatformWindow *child) const;
virtual bool isEmbedded() const;
virtual bool isForeignWindow() const { return window()->type() == Qt::ForeignWindow; };
virtual QPoint mapToGlobal(const QPoint &pos) const;
virtual QPoint mapFromGlobal(const QPoint &pos) const;
virtual void propagateSizeHints();
virtual void setOpacity(qreal level);
virtual void setMask(const QRegion ®ion);
virtual void requestActivateWindow();
virtual void handleContentOrientationChange(Qt::ScreenOrientation orientation);
virtual qreal devicePixelRatio() const;
virtual bool setKeyboardGrabEnabled(bool grab);
virtual bool setMouseGrabEnabled(bool grab);
virtual bool setWindowModified(bool modified);
virtual void windowEvent(QEvent *event);
virtual bool startSystemResize(const QPoint &pos, Qt::Corner corner);
virtual void setFrameStrutEventsEnabled(bool enabled);
virtual bool frameStrutEventsEnabled() const;
virtual void setAlertState(bool enabled);
virtual bool isAlertState() const;
virtual void invalidateSurface();
static QRect initialGeometry(const QWindow *w,
const QRect &initialGeometry, int defaultWidth, int defaultHeight);
virtual void requestUpdate();
// Window property accessors. Platform plugins should use these
// instead of accessing QWindow directly.
QSize windowMinimumSize() const;
QSize windowMaximumSize() const;
QSize windowBaseSize() const;
QSize windowSizeIncrement() const;
QRect windowGeometry() const;
QRect windowFrameGeometry() const;
QRectF windowClosestAcceptableGeometry(const QRectF &nativeRect) const;
static QRectF closestAcceptableGeometry(const QWindow *w, const QRectF &nativeRect);
protected:
static QString formatWindowTitle(const QString &title, const QString &separator);
QPlatformScreen *screenForGeometry(const QRect &newGeometry) const;
static QSize constrainWindowSize(const QSize &size);
QScopedPointer<QPlatformWindowPrivate> d_ptr;
private:
Q_DISABLE_COPY(QPlatformWindow)
};
QT_END_NAMESPACE
#endif //QPLATFORMWINDOW_H
| [
"ammannnicholas@gmail.com"
] | ammannnicholas@gmail.com |
1c8f37c3ac70d527d695f88dd7ec5f1251cadf23 | 2a2c69f870c28ace2faef775438415815bbc8d40 | /softwareTimers.cpp | 3696a329998a4aa6e8ab6a37264e5e2870d1793e | [] | no_license | tr0lldermort/Capsense-Dimmer | 8ad8941563b942a63649eb2f4a9e4726e9c65160 | 762018f0495484cc08857d8c97061b6df9c67363 | refs/heads/master | 2020-04-29T13:01:57.321155 | 2019-03-24T18:27:37 | 2019-03-24T18:27:37 | 176,158,086 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 831 | cpp | /*
* Define & control software timers
* Author: dTb
* Date: 13/03/19
*/
#include "softwareTimers.h"
softwareTimer::softwareTimer()
{
Serial.print("Constructor Time... ");
Serial.println(millis());
return;
}
void softwareTimer::startTimer(uint8_t* timerId, unsigned int durationMillis)
{
static uint8_t myTimerId = 0; // tracks the number of software timers being used
if(myTimerId == 254) //TODO: microcontroller crashes if this rolls over wtf
myTimerId = 0;
myTimerId++; // increment the number
*timerId = myTimerId;
_timerEndings[myTimerId] = millis() + durationMillis; // TODO: millis will also rollover lolz
}
bool softwareTimer::checkTimer(uint8_t* timerId)
{
if (millis() < _timerEndings[*timerId])
return 0;
else
return 1; //timer has elapsed
} | [
"dtbeckett@gmail.com"
] | dtbeckett@gmail.com |
508fc4ac22408bd1a6eb868ab2ece9591ceff6c9 | 1856cc1e25af1920fef1989ee72857266581e84c | /Map.h | a14be10f9acf98e1e5afa16727272e21e888737c | [] | no_license | klawir/Snake | 90a502cce6b478bc83209e1649905adef7c6a396 | 9476c9ccfdf5073fb6b91bfb0daa5ec39c05f2fd | refs/heads/master | 2020-03-18T15:21:18.200143 | 2020-02-11T17:08:21 | 2020-02-11T17:08:21 | 134,902,414 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 176 | h | #pragma once
#include "libraries.h"
class Map
{
enum { HEIGHT = 15, WIDTH = 30 };
public:
string map[HEIGHT][WIDTH];
Map();
int GetWidth()const;
int GetHeight()const;
}; | [
"klawir1@o2.pl"
] | klawir1@o2.pl |
d2dca6d6cdc1fb5cf8f6474ceb04e1eb2cc302cc | 08ff3a43c02d8c05727e71aa5032f8a1efee7397 | /main.cpp | cd855ca81716a56a054b78f7d7d948ce3ba538d1 | [
"MIT"
] | permissive | ucarlos/Programming-Principles-Chapter11 | b41cc5b4780c17c2d61c7115db1aa3bb7f314bdf | f64065a15277eace12307fc4043b85eacba6a577 | refs/heads/master | 2023-03-08T10:53:56.585560 | 2021-02-23T19:31:37 | 2021-02-23T19:31:37 | 291,396,086 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,511 | cpp | #include "../std_lib_facilities.h"
// Test some stuff here:
void unset_stuff(void){
cin.unsetf(ios::hex);
cin.unsetf(ios::dec);
cin.unsetf(ios::oct);
}
void precision(){
double value = 123456.0;
cout << value << "\n" << fixed
<< value << "\n" << scientific
<< value << "\n";
}
void show_different_bases(void){
int birth_year = 1997;
cout << showbase
<< "Birth Year: " << birth_year << " (Decimal)\n" << hex
<< "Birth Year: " << birth_year << " (Hex)\n" << oct
<< "Birth Year: " << birth_year << " (Oct)\n" << endl;
}
void width_check(void){
int width_size = 25;
setw(width_size);
cout << "Name: " << setw(width_size) << "Email: " << setw(width_size) << "Phone" << "\n"
<< "Ulysses Carlos " << setw(width_size + 8) << "ucarlos1@student.gsu.edu"
<< setw(width_size / 2 + 5) << "(000) 000-0000" << "\n";
}
void test_seek(void){
fstream fs {"../test.txt", ios_base::in};
cout << "H e l l o W o r l d !" << endl;
cout <<"0 1 2 3 4 5 6 7 8 9 10 11" << endl;
if (!fs) error("Cannot open test.txt. Aborting.");
//fs.seekg(4); // Considers white space as well:
cout << "Please input a numerical value (0 - 11):";
int value;
cin >> value;
if (!(0 <= value && value <= 11)) exit(EXIT_FAILURE);
char ch;
fs.seekg(value);
fs >> ch;
cout << ch << endl;
}
int main(void){
//precision();
//show_different_bases();
//unset_stuff();
//width_check();
test_seek();
}
| [
"ulycarlos@gmail.com"
] | ulycarlos@gmail.com |
12e2b1a19c5361b4e2da5765f44a7c3c7aefe1bb | ab06066e4d6a8523c21db8bfa12ca4451acdda8d | /sketch-1.6.7/sketch-backend/src/SketchSolver/InputParser/NodesToSolver.h | d12d1995e194735174094519e73b884f75719df0 | [] | no_license | Mestway/Queries | 94fc8f950345a5ece8312434fa0b97e3321bebba | 8e575c8d727123521a3dd70d8ec7b087dd67c4a1 | refs/heads/master | 2020-12-13T21:52:42.970285 | 2016-05-10T04:46:50 | 2016-05-10T04:46:50 | 44,147,059 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 5,606 | h | #ifndef __NODESTOSOLVER_H
#define __NODESTOSOLVER_H
#include "BooleanDAG.h"
#include "BooleanToCNF.h"
#include "Tvalue.h"
#ifndef INTEGERBOUND
# define INTEGERBOUND 8192*6
#endif
// #define Dout( msg ) msg
// Visitor for conversion of DAG to SAT.
class NodesToSolver : public NodeVisitor {
const string &outname;
map<bool_node *, int> &node_values; // -1=false, 1=true, 0=unknown
void addToVals(map<pair<int, int>, int>& vals, vector<guardedVal>::iterator it, int idx, int gval);
int compareRange(vector<guardedVal>& mv, int mstart, int mend, vector<guardedVal>& fv, int fstart, int fend);
template<typename COMP> void compareArrays (bool_node& node, Tvalue& tmval, Tvalue& tfval);
template<typename THEOP> void processArith (bool_node &node);
template<typename THEOP> int doArithExpr (int quant1, int quant2,
int id1, int id2, THEOP comp);
template<typename COMP> void processComparissons (bool_node &node, bool revFval);
void processLT (LT_node& node);
vector<int> lgv;
Tvalue tvYES;
Tvalue tvOne;
Tvalue tvOneSigned;
const int YES;
bool stopAddingClauses;
bool shortcut;
protected:
SolverHelper &dir;
vector<Tvalue> &node_ids;
vector<vector<Tvalue>*> tpl_store;
/* Return the value indexed by given node, or a default value (of given type). */
inline Tvalue &tval_lookup (bool_node *node, valtype_t default_type = TVAL_BVECT,
int quant = 1) {
if (node){
return node_ids[node->id];
}
switch (default_type) {
case TVAL_BVECT:
return tvYES;
case TVAL_SPARSE:
return tvOne;
default:
assert (0); /* Can't get here. */
}
return tvYES;
}
vector<int> scratchpad;
vector<int> tmprange;
vector<int> unirange;
Tvalue intBvectComputeSum (Tvalue &, Tvalue &);
Tvalue intBvectAdd (Tvalue &, int, Tvalue &, int);
void intBvectPlus (arith_node &);
void intBvectMult (arith_node &);
void intBvectEq (arith_node &);
void intBvectLt (arith_node &);
void intBvectLe (arith_node &);
void intBvectGt (arith_node &);
void intBvectGe (arith_node &);
void boolNodeUpdate (bool_node &, Tvalue &);
public:
string errorMsg;
bool stoppedPrematurely(){
return this->stopAddingClauses;
}
/*
* p_mng is the wrapper for the sat solver.
* p_dir is a SAT solver wrapper that provides a few additiona services for the SAT solver.
* p_outname is a name for this translation. It is used, for example, to name any output files produced.
* p_node_values contains values for either input or output nodes.
*
*/
NodesToSolver (
SolverHelper& p_dir,
const string& p_outname,
map<bool_node*, int>& p_node_values,
vector<Tvalue>& p_node_ids
) :
dir(p_dir), outname(p_outname), node_values(p_node_values),
node_ids(p_node_ids), YES(p_dir.YES),
scratchpad(100),tmprange(2), unirange(1), tvYES( p_dir.YES), tvOne (TVAL_SPARSE, p_dir.YES, 1)
{
tmprange[0] = 0;
tmprange[1] = 1;
unirange[0] = 1;
/* Initialize the default "one" integer. */
tvOne.num_ranges.push_back (guardedVal(p_dir.YES, 1));
tpl_store.push_back(NULL);
};
int lastGoodVal(int id){
if(id > lgv.size()){
return 0;
}else{
return lgv[id-1];
}
}
virtual void visit (AND_node &node);
virtual void visit (OR_node &node);
virtual void visit (XOR_node &node);
virtual void visit (SRC_node &node);
virtual void visit (DST_node &node);
virtual void visit (NOT_node &node);
virtual void visit (CTRL_node &node);
virtual void visit (PLUS_node &node);
virtual void visit (TIMES_node &node);
virtual void visit (ARRACC_node &node);
virtual void visit (UFUN_node &node);
virtual void visit (DIV_node &node);
virtual void visit (NEG_node &node);
virtual void visit (MOD_node &node);
virtual void visit( CONST_node& node );
virtual void visit (LT_node &node);
virtual void visit (EQ_node &node);
virtual void visit (ARRASS_node &node);
virtual void visit (ACTRL_node &node);
virtual void visit( ARR_R_node &node);
virtual void visit( ARR_W_node &node);
virtual void visit( ARR_CREATE_node &node);
virtual void visit( TUPLE_R_node &node);
virtual void visit( TUPLE_CREATE_node &node);
virtual void visit (ASSERT_node &node);
void process(BooleanDAG& bdag);
virtual void mergeTvalues(int guard, const vector<guardedVal>& nr0, int nr0Start, int nr0End, const vector<guardedVal>& nr1, int nr1Start, int nr1End, vector<guardedVal>& out, int idx=-1);
virtual void mergeTvalues(int guard, Tvalue& mid0, Tvalue& mid1, Tvalue& output, int& flag);
virtual bool checkParentsChanged (bool_node &node, bool more);
void doArrArrAcc(Tvalue& mval, vector<Tvalue>& choices, Tvalue& output);
void doNonBoolArrAcc (Tvalue& mval, vector<Tvalue>& choices, Tvalue& output);
void muxTValues(ARRACC_node* node, Tvalue& omv, vector<Tvalue>& choices, Tvalue& out, bool isBoolean, bool isArray);
void computeMaxOrMin(vector<guardedVal>& mv, vector<guardedVal>& fv, vector<guardedVal>& out, bool doMax);
void arrRTvalue(bool isInt, Tvalue& index, Tvalue& inarr, Tvalue& out);
void arrWTvalue(Tvalue& index, Tvalue& inarr, Tvalue& newval, Tvalue& nvar);
static bool createConstraints(BooleanDAG& dag, SolverHelper& dir, map<bool_node*, int>& node_values, vector<Tvalue>& node_ids);
};
#endif /* __NODESTOSOLVER_H */
| [
"clwang@raloi.dyn.cs.washington.edu"
] | clwang@raloi.dyn.cs.washington.edu |
d1f7816e13dfe5f8c25c03c7c73511fec6b536c6 | 138a353006eb1376668037fcdfbafc05450aa413 | /source/ogre/OgreNewt/boost/mpl/aux_/inserter_algorithm.hpp | 526e3427d4aa7b7db8e761c03cf998ede85293c2 | [] | no_license | sonicma7/choreopower | 107ed0a5f2eb5fa9e47378702469b77554e44746 | 1480a8f9512531665695b46dcfdde3f689888053 | refs/heads/master | 2020-05-16T20:53:11.590126 | 2009-11-18T03:10:12 | 2009-11-18T03:10:12 | 32,246,184 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 5,078 | hpp |
#ifndef BOOST_MPL_AUX_INSERTER_ALGORITHM_HPP_INCLUDED
#define BOOST_MPL_AUX_INSERTER_ALGORITHM_HPP_INCLUDED
// Copyright Aleksey Gurtovoy 2003-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.
// $Source: /cvsroot/ogre/ogreaddons/ogrenewt/OgreNewt_Main/inc/boost/mpl/aux_/inserter_algorithm.hpp,v $
// $Date: 2006/04/17 23:47:07 $
// $Revision: 1.1 $
#include <boost/mpl/back_inserter.hpp>
#include <boost/mpl/front_inserter.hpp>
#include <boost/mpl/push_back.hpp>
#include <boost/mpl/push_front.hpp>
#include <boost/mpl/back_inserter.hpp>
#include <boost/mpl/front_inserter.hpp>
#include <boost/mpl/clear.hpp>
#include <boost/mpl/eval_if.hpp>
#include <boost/mpl/if.hpp>
#include <boost/mpl/aux_/na.hpp>
#include <boost/mpl/aux_/common_name_wknd.hpp>
#include <boost/mpl/aux_/na_spec.hpp>
#include <boost/mpl/aux_/preprocessor/params.hpp>
#include <boost/mpl/aux_/preprocessor/default_params.hpp>
#include <boost/mpl/aux_/config/ctps.hpp>
#include <boost/preprocessor/arithmetic/dec.hpp>
#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
# define BOOST_MPL_AUX_INSERTER_ALGORITHM_DEF(arity, name) \
BOOST_MPL_AUX_COMMON_NAME_WKND(name) \
template< \
BOOST_MPL_PP_DEFAULT_PARAMS(arity, typename P, na) \
> \
struct name \
: aux::name##_impl<BOOST_MPL_PP_PARAMS(arity, P)> \
{ \
}; \
\
template< \
BOOST_MPL_PP_PARAMS(BOOST_PP_DEC(arity), typename P) \
> \
struct name< BOOST_MPL_PP_PARAMS(BOOST_PP_DEC(arity), P),na > \
: if_< has_push_back<P1> \
, aux::name##_impl< \
BOOST_MPL_PP_PARAMS(BOOST_PP_DEC(arity), P) \
, back_inserter< typename clear<P1>::type > \
> \
, aux::reverse_##name##_impl< \
BOOST_MPL_PP_PARAMS(BOOST_PP_DEC(arity), P) \
, front_inserter< typename clear<P1>::type > \
> \
>::type \
{ \
}; \
\
template< \
BOOST_MPL_PP_DEFAULT_PARAMS(arity, typename P, na) \
> \
struct reverse_##name \
: aux::reverse_##name##_impl<BOOST_MPL_PP_PARAMS(arity, P)> \
{ \
}; \
\
template< \
BOOST_MPL_PP_PARAMS(BOOST_PP_DEC(arity), typename P) \
> \
struct reverse_##name< BOOST_MPL_PP_PARAMS(BOOST_PP_DEC(arity), P),na > \
: if_< has_push_back<P1> \
, aux::reverse_##name##_impl< \
BOOST_MPL_PP_PARAMS(BOOST_PP_DEC(arity), P) \
, back_inserter< typename clear<P1>::type > \
> \
, aux::name##_impl< \
BOOST_MPL_PP_PARAMS(BOOST_PP_DEC(arity), P) \
, front_inserter< typename clear<P1>::type > \
> \
>::type \
{ \
}; \
BOOST_MPL_AUX_NA_SPEC(arity, name) \
BOOST_MPL_AUX_NA_SPEC(arity, reverse_##name) \
/**/
#else
# define BOOST_MPL_AUX_INSERTER_ALGORITHM_DEF(arity, name) \
BOOST_MPL_AUX_COMMON_NAME_WKND(name) \
template< \
BOOST_MPL_PP_PARAMS(BOOST_PP_DEC(arity), typename P) \
> \
struct def_##name##_impl \
: if_< has_push_back<P1> \
, aux::name##_impl< \
BOOST_MPL_PP_PARAMS(BOOST_PP_DEC(arity), P) \
, back_inserter< typename clear<P1>::type > \
> \
, aux::reverse_##name##_impl< \
BOOST_MPL_PP_PARAMS(BOOST_PP_DEC(arity), P) \
, front_inserter< typename clear<P1>::type > \
> \
>::type \
{ \
}; \
\
template< \
BOOST_MPL_PP_DEFAULT_PARAMS(arity, typename P, na) \
> \
struct name \
{ \
typedef typename eval_if< \
is_na<BOOST_PP_CAT(P, arity)> \
, def_##name##_impl<BOOST_MPL_PP_PARAMS(BOOST_PP_DEC(arity), P)> \
, aux::name##_impl<BOOST_MPL_PP_PARAMS(arity, P)> \
>::type type; \
}; \
\
template< \
BOOST_MPL_PP_PARAMS(BOOST_PP_DEC(arity), typename P) \
> \
struct def_reverse_##name##_impl \
: if_< has_push_back<P1> \
, aux::reverse_##name##_impl< \
BOOST_MPL_PP_PARAMS(BOOST_PP_DEC(arity), P) \
, back_inserter< typename clear<P1>::type > \
> \
, aux::name##_impl< \
BOOST_MPL_PP_PARAMS(BOOST_PP_DEC(arity), P) \
, front_inserter< typename clear<P1>::type > \
> \
>::type \
{ \
}; \
template< \
BOOST_MPL_PP_DEFAULT_PARAMS(arity, typename P, na) \
> \
struct reverse_##name \
{ \
typedef typename eval_if< \
is_na<BOOST_PP_CAT(P, arity)> \
, def_reverse_##name##_impl<BOOST_MPL_PP_PARAMS(BOOST_PP_DEC(arity), P)> \
, aux::reverse_##name##_impl<BOOST_MPL_PP_PARAMS(arity, P)> \
>::type type; \
}; \
BOOST_MPL_AUX_NA_SPEC(arity, name) \
BOOST_MPL_AUX_NA_SPEC(arity, reverse_##name) \
/**/
#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
#endif // BOOST_MPL_AUX_INSERTER_ALGORITHM_HPP_INCLUDED
| [
"Sonicma7@0822fb10-d3c0-11de-a505-35228575a32e"
] | Sonicma7@0822fb10-d3c0-11de-a505-35228575a32e |
2f85819e4c82368301b8466f36ff4e9513e44da0 | a06a9ae73af6690fabb1f7ec99298018dd549bb7 | /_Library/_Include/boost/units/physical_dimensions/area.hpp | 01d9f8dfab849c0594e3925b9501ac9e578b695a | [] | no_license | longstl/mus12 | f76de65cca55e675392eac162dcc961531980f9f | 9e1be111f505ac23695f7675fb9cefbd6fa876e9 | refs/heads/master | 2021-05-18T08:20:40.821655 | 2020-03-29T17:38:13 | 2020-03-29T17:38:13 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,090 | hpp | ////////////////////////////////////////////////////////////////////////////////
// area.hpp
// Boost.Units - A C++ library for zero-overhead dimensional analysis and
// unit/quantity manipulation and conversion
//
// Copyright (C) 2003-2008 Matthias Christian Schabel
// Copyright (C) 2008 Steven Watanabe
//
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#ifndef BOOST_UNITS_AREA_DERIVED_DIMENSION_HPP
#define BOOST_UNITS_AREA_DERIVED_DIMENSION_HPP
#include <boost/units/derived_dimension.hpp>
#include <boost/units/physical_dimensions/length.hpp>
namespace boost {
namespace units {
/// derived dimension for area : L^2
typedef derived_dimension<length_base_dimension,2>::type area_dimension;
} // namespace units
} // namespace boost
#endif // BOOST_UNITS_AREA_DERIVED_DIMENSION_HPP
/////////////////////////////////////////////////
// vnDev.Games - Trong.LIVE - DAO VAN TRONG //
////////////////////////////////////////////////////////////////////////////////
| [
"adm.fael.hs@gmail.com"
] | adm.fael.hs@gmail.com |
c46fc304c35867c7ca9e89c792fc8c901dae7df1 | 34c374b3117751b08adc9acf128be47a6f9ee679 | /src/QueryServer.cpp | ada0402ba1caf4b2fab75f6da3d5f280f96a8078 | [] | no_license | ymelon7/TextCorrection | 88667484d495e7000e1bbb46ba60038f7c2c6046 | 65b025792fd88965411e72c730287397adf2c77e | refs/heads/master | 2021-01-01T06:33:04.216631 | 2014-11-19T03:31:49 | 2014-11-19T03:31:49 | 25,899,949 | 3 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 1,243 | cpp | #include "QueryServer.h"
#include <muduo/base/Logging.h>
using namespace muduo;
using namespace muduo::net;
using namespace std::placeholders;
QueryServer::QueryServer(const std::string &enDict,
const std::string &chDict,
const std::string &redisHost,
uint16_t port,
EventLoop *loop,
const InetAddress &addr)
:query_(enDict, chDict, redisHost, port),
server_(loop, addr, "QueryServer")
{
server_.setMessageCallback(std::bind(&QueryServer::onMessage, this, _1, _2, _3));
}
void QueryServer::onMessage(const TcpConnectionPtr &conn,
Buffer *buf,
Timestamp t)
{
string s(buf->retrieveAllAsString());
LOG_INFO << "receive php msg: " << s;
std::string s2(s.c_str());
pool_.run(
std::bind(
&QueryServer::queryWord, this, s2, conn));
}
//把单词的查询和结果的回发交给线程池
void QueryServer::queryWord(const std::string &word,
const TcpConnectionPtr &conn)
{
std::string result = query_.queryWord(word);
conn->send(result.c_str(), result.size());
}
| [
"ymelon7@gmail.com"
] | ymelon7@gmail.com |
ab37e1de9cd7c44930ab9fa17b81e1b9d6741798 | bbbd999dae0467430cc479ec3c58760ed430cae9 | /node_modules/msnodesqlv8/src/OpenOperation.cpp | 3a9862d233ed38115b22e54160029372a3f6c15e | [
"Apache-2.0"
] | permissive | Cathy517/reptiles_InsertSql | 329b35d8cb9db507ab1e34730dee2d424f2923c9 | 3d949f35c3150fabcac32edd4f5ff343cbf895e2 | refs/heads/master | 2020-03-17T13:42:08.487391 | 2018-05-16T09:29:34 | 2018-05-16T09:29:34 | 133,641,540 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 782 | cpp | #include "stdafx.h"
#include <OdbcConnection.h>
#include <OpenOperation.h>
namespace mssql
{
OpenOperation::OpenOperation(const shared_ptr<OdbcConnection> &connection, const wstring& connection_string, const int timeout, const Handle<Object> callback,
const Handle<Object> backpointer)
: OdbcOperation(connection, callback),
connectionString(connection_string),
backpointer(Isolate::GetCurrent(), backpointer),
timeout(timeout)
{
}
OpenOperation::~OpenOperation()
{
backpointer.Reset();
}
bool OpenOperation::TryInvokeOdbc()
{
return _connection->try_open(connectionString, timeout);
}
Local<Value> OpenOperation::CreateCompletionArg()
{
nodeTypeFactory fact;
const auto o = fact.newObject(backpointer);
return o;
}
}
| [
"v-wacho@microsoft.com"
] | v-wacho@microsoft.com |
309aa482137d9222075a7ef6810a140c973feda3 | 189f52bf5454e724d5acc97a2fa000ea54d0e102 | /ras/fluidisedBed/1.81/T.air | 88dcc0b474e7ba055a5a6a2dbab01681b29eba7d | [] | no_license | pyotr777/openfoam_samples | 5399721dd2ef57545ffce68215d09c49ebfe749d | 79c70ac5795decff086dd16637d2d063fde6ed0d | refs/heads/master | 2021-01-12T16:52:18.126648 | 2016-11-05T08:30:29 | 2016-11-05T08:30:29 | 71,456,654 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 45,412 | air | /*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v1606+ |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
location "1.81";
object T.air;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 0 0 1 0 0 0];
internalField nonuniform List<scalar>
6000
(
521.361
526.98
530.997
534.333
538.272
539.973
539.742
537.228
532.099
527.663
524.686
521.26
519.855
518.876
516.936
516.487
517.413
522.716
529.965
534.697
537.861
540.669
541.356
541.519
540.52
538.516
537.905
535.217
529.223
525.135
588.074
588.956
591.611
592.742
593.82
595.007
595.729
595.528
594.228
589.819
577.771
575.083
576.016
575.01
573.539
574.098
580.919
589.313
593.138
594.41
595.027
595.553
595.74
595.691
595.305
594.393
593.186
591.445
589.58
588.887
597.393
596.9
598.778
599.205
599.401
599.603
599.709
599.699
599.533
598.261
591.424
585.391
585.896
584.914
583.838
587.943
595.173
598.514
599.382
599.555
599.624
599.681
599.706
599.701
599.633
599.279
598.38
597.659
597.069
597.782
599.173
598.835
599.581
599.85
599.917
599.941
599.945
599.934
599.9
599.668
597.518
592.352
589.779
588.337
587.705
593.657
598.482
599.626
599.814
599.89
599.922
599.932
599.934
599.93
599.906
599.791
599.538
599.441
599.251
599.465
599.809
599.709
599.847
599.93
599.949
599.94
599.915
599.881
599.837
599.801
599.322
597.444
594.358
591.695
590.681
595.315
598.656
599.4
599.676
599.83
599.902
599.917
599.911
599.91
599.923
599.924
599.902
599.883
599.802
599.867
599.948
599.937
599.942
599.934
599.906
599.837
599.762
599.718
599.669
599.677
599.612
598.781
596.528
594.288
593.846
596.277
598.191
598.951
599.43
599.735
599.864
599.857
599.845
599.842
599.862
599.901
599.933
599.948
599.945
599.955
599.926
599.923
599.895
599.838
599.768
599.702
599.653
599.613
599.563
599.543
599.555
599.204
597.339
595.578
595.034
596.275
597.8
598.638
599.245
599.695
599.817
599.807
599.798
599.796
599.813
599.853
599.9
599.943
599.958
599.962
599.82
599.824
599.793
599.75
599.704
599.66
599.617
599.571
599.522
599.476
599.466
599.362
598.3
596.406
595.531
596.045
597.394
598.349
599.216
599.721
599.774
599.766
599.759
599.757
599.778
599.825
599.876
599.928
599.953
599.96
599.772
599.773
599.757
599.727
599.688
599.647
599.602
599.553
599.502
599.422
599.395
599.345
598.945
597.259
595.88
595.92
596.832
598.146
599.295
599.684
599.728
599.719
599.712
599.711
599.742
599.798
599.856
599.914
599.941
599.947
599.765
599.761
599.747
599.721
599.684
599.644
599.598
599.548
599.489
599.379
599.315
599.263
599.047
597.904
596.086
595.867
596.414
598.017
599.401
599.637
599.67
599.665
599.658
599.66
599.714
599.784
599.842
599.895
599.931
599.937
599.769
599.758
599.745
599.723
599.694
599.658
599.614
599.563
599.492
599.362
599.257
599.183
598.987
598.202
596.392
595.912
596.388
598.061
599.338
599.543
599.597
599.608
599.605
599.614
599.7
599.778
599.837
599.884
599.919
599.93
599.779
599.767
599.754
599.738
599.716
599.69
599.656
599.612
599.551
599.403
599.232
599.14
598.977
598.436
596.983
596.182
596.511
598.112
599.094
599.31
599.45
599.525
599.539
599.576
599.706
599.788
599.841
599.884
599.916
599.929
599.794
599.781
599.77
599.758
599.742
599.724
599.704
599.68
599.639
599.513
599.321
599.185
599.043
598.674
597.629
596.613
596.671
598.129
598.876
599.094
599.222
599.349
599.39
599.533
599.719
599.807
599.858
599.9
599.926
599.932
599.817
599.804
599.798
599.788
599.775
599.76
599.745
599.732
599.709
599.639
599.488
599.329
599.209
598.949
598.188
597.072
596.876
598.221
598.837
599.017
599.103
599.184
599.255
599.521
599.763
599.856
599.905
599.93
599.937
599.94
599.836
599.827
599.828
599.826
599.82
599.812
599.799
599.787
599.772
599.737
599.621
599.503
599.396
599.221
598.675
597.583
597.185
598.352
598.862
599.019
599.095
599.158
599.251
599.532
599.827
599.92
599.938
599.943
599.946
599.948
599.848
599.843
599.848
599.852
599.852
599.85
599.845
599.837
599.827
599.799
599.713
599.631
599.544
599.424
599.06
598.121
597.754
598.394
598.915
599.067
599.154
599.218
599.339
599.584
599.832
599.928
599.946
599.949
599.951
599.952
599.862
599.857
599.86
599.865
599.867
599.867
599.865
599.862
599.856
599.837
599.781
599.716
599.648
599.559
599.296
598.607
598.41
598.561
598.97
599.179
599.284
599.379
599.499
599.639
599.807
599.923
599.951
599.954
599.955
599.956
599.874
599.869
599.873
599.878
599.881
599.881
599.88
599.877
599.874
599.861
599.824
599.771
599.719
599.644
599.324
598.917
598.864
598.969
599.015
599.293
599.414
599.518
599.613
599.688
599.793
599.914
599.953
599.959
599.96
599.959
599.887
599.884
599.886
599.891
599.894
599.895
599.895
599.893
599.89
599.88
599.852
599.807
599.768
599.695
599.305
599.135
599.134
599.178
599.216
599.278
599.515
599.609
599.678
599.721
599.786
599.899
599.954
599.963
599.963
599.962
599.902
599.898
599.899
599.903
599.906
599.908
599.907
599.906
599.904
599.898
599.876
599.837
599.801
599.715
599.348
599.279
599.258
599.264
599.285
599.321
599.424
599.655
599.719
599.76
599.808
599.885
599.954
599.966
599.966
599.965
599.915
599.913
599.914
599.916
599.918
599.921
599.921
599.92
599.918
599.913
599.898
599.863
599.812
599.537
599.386
599.337
599.314
599.31
599.327
599.357
599.41
599.602
599.741
599.786
599.824
599.876
599.947
599.967
599.969
599.968
599.928
599.927
599.927
599.929
599.931
599.933
599.933
599.933
599.931
599.927
599.913
599.879
599.798
599.489
599.416
599.376
599.347
599.34
599.36
599.392
599.433
599.497
599.683
599.796
599.837
599.873
599.93
599.966
599.971
599.971
599.938
599.939
599.94
599.941
599.943
599.944
599.945
599.944
599.942
599.938
599.923
599.862
599.61
599.509
599.454
599.409
599.365
599.348
599.387
599.427
599.47
599.518
599.584
599.693
599.825
599.876
599.914
599.959
599.972
599.974
599.943
599.948
599.95
599.952
599.954
599.955
599.955
599.954
599.951
599.945
599.909
599.714
599.616
599.552
599.5
599.444
599.33
599.244
599.396
599.461
599.508
599.555
599.608
599.667
599.74
599.845
599.905
599.947
599.972
599.976
599.948
599.954
599.959
599.961
599.963
599.963
599.963
599.962
599.959
599.945
599.82
599.733
599.664
599.604
599.554
599.481
599.101
598.826
599.277
599.479
599.543
599.591
599.643
599.694
599.743
599.798
599.876
599.937
599.973
599.977
599.955
599.961
599.965
599.968
599.97
599.97
599.97
599.968
599.966
599.953
599.866
599.785
599.725
599.674
599.691
599.571
599.005
598.63
598.962
599.456
599.569
599.628
599.681
599.728
599.769
599.808
599.848
599.927
599.974
599.977
599.967
599.968
599.971
599.973
599.975
599.976
599.975
599.973
599.971
599.965
599.938
599.863
599.808
599.836
599.79
599.609
599.075
598.709
598.922
599.377
599.605
599.675
599.734
599.767
599.801
599.831
599.86
599.916
599.973
599.977
599.985
599.978
599.977
599.978
599.979
599.98
599.979
599.976
599.974
599.97
599.962
599.943
599.925
599.882
599.82
599.693
599.349
599.129
599.217
599.552
599.81
599.864
599.866
599.819
599.836
599.86
599.886
599.921
599.968
599.976
599.995
599.991
599.985
599.983
599.983
599.983
599.982
599.98
599.977
599.972
599.966
599.959
599.947
599.912
599.873
599.804
599.679
599.616
599.681
599.836
599.91
599.933
599.946
599.943
599.879
599.892
599.912
599.937
599.966
599.976
599.997
599.998
599.993
599.99
599.987
599.986
599.985
599.984
599.981
599.976
599.967
599.964
599.962
599.948
599.929
599.901
599.87
599.867
599.898
599.93
599.949
599.959
599.966
599.97
599.95
599.926
599.937
599.954
599.97
599.977
599.997
599.998
599.998
599.997
599.993
599.989
599.989
599.988
599.986
599.983
599.975
599.972
599.97
599.965
599.958
599.95
599.944
599.946
599.953
599.961
599.968
599.972
599.975
599.978
599.975
599.96
599.959
599.968
599.976
599.983
599.998
599.998
599.998
599.998
599.997
599.993
599.992
599.992
599.991
599.982
599.977
599.976
599.976
599.975
599.973
599.971
599.97
599.971
599.972
599.975
599.977
599.979
599.981
599.983
599.984
599.978
599.975
599.979
599.986
599.992
599.998
599.998
599.998
599.998
599.998
599.997
599.995
599.995
599.991
599.983
599.98
599.98
599.981
599.981
599.98
599.98
599.98
599.98
599.981
599.982
599.982
599.983
599.984
599.986
599.988
599.988
599.987
599.991
599.992
599.993
599.998
599.998
599.998
599.998
599.998
599.998
599.997
599.996
599.991
599.983
599.982
599.983
599.983
599.984
599.984
599.984
599.984
599.984
599.985
599.985
599.985
599.985
599.986
599.988
599.989
599.991
599.991
599.992
599.993
599.993
599.998
599.998
599.998
599.998
599.998
599.998
599.997
599.996
599.991
599.984
599.984
599.985
599.985
599.985
599.985
599.986
599.986
599.986
599.987
599.987
599.987
599.987
599.988
599.989
599.99
599.991
599.992
599.992
599.993
599.993
599.998
599.998
599.998
599.998
599.998
599.998
599.998
599.996
599.992
599.985
599.985
599.986
599.986
599.986
599.987
599.987
599.988
599.988
599.988
599.988
599.989
599.989
599.989
599.99
599.991
599.991
599.992
599.992
599.993
599.993
599.998
599.998
599.998
599.998
599.998
599.998
599.997
599.997
599.993
599.985
599.985
599.987
599.987
599.987
599.988
599.988
599.989
599.989
599.99
599.99
599.99
599.99
599.99
599.991
599.992
599.992
599.992
599.993
599.993
599.993
599.998
599.998
599.998
599.998
599.998
599.998
599.997
599.997
599.993
599.986
599.986
599.987
599.988
599.988
599.989
599.989
599.99
599.99
599.991
599.991
599.991
599.991
599.991
599.992
599.992
599.992
599.993
599.993
599.993
599.993
599.998
599.998
599.998
599.997
599.997
599.997
599.997
599.997
599.994
599.987
599.986
599.987
599.988
599.989
599.989
599.99
599.991
599.991
599.991
599.992
599.992
599.992
599.992
599.993
599.993
599.993
599.993
599.993
599.993
599.993
599.997
599.997
599.998
599.997
599.997
599.997
599.997
599.997
599.994
599.987
599.986
599.987
599.989
599.989
599.99
599.99
599.991
599.991
599.992
599.992
599.992
599.993
599.993
599.993
599.993
599.993
599.994
599.994
599.994
599.994
599.997
599.997
599.998
599.997
599.997
599.997
599.997
599.997
599.994
599.988
599.985
599.987
599.988
599.989
599.989
599.99
599.991
599.991
599.992
599.992
599.993
599.993
599.993
599.993
599.994
599.994
599.994
599.994
599.994
599.994
599.997
599.997
599.997
599.997
599.997
599.997
599.997
599.996
599.994
599.988
599.985
599.986
599.987
599.988
599.989
599.989
599.99
599.99
599.991
599.992
599.993
599.993
599.994
599.994
599.994
599.994
599.994
599.994
599.994
599.994
599.997
599.997
599.997
599.997
599.996
599.996
599.996
599.996
599.994
599.988
599.983
599.984
599.986
599.987
599.988
599.988
599.989
599.99
599.991
599.992
599.993
599.993
599.994
599.994
599.994
599.994
599.994
599.995
599.994
599.994
599.997
599.997
599.996
599.996
599.996
599.996
599.997
599.996
599.993
599.987
599.982
599.982
599.984
599.985
599.987
599.988
599.989
599.99
599.991
599.992
599.993
599.994
599.994
599.994
599.995
599.995
599.995
599.995
599.995
599.995
599.997
599.997
599.997
599.996
599.997
599.997
599.996
599.995
599.992
599.986
599.981
599.98
599.982
599.984
599.987
599.99
599.992
599.992
599.993
599.993
599.994
599.994
599.994
599.995
599.995
599.995
599.997
599.995
599.995
599.995
599.998
599.997
599.997
599.998
599.998
599.997
599.995
599.994
599.99
599.984
599.979
599.978
599.98
599.984
599.989
599.991
599.993
599.993
599.994
599.994
599.994
599.994
599.995
599.995
599.995
599.997
599.995
599.995
599.996
599.995
599.996
599.996
599.998
599.998
599.997
599.996
599.993
599.991
599.988
599.983
599.979
599.977
599.979
599.985
599.99
599.992
599.993
599.994
599.994
599.994
599.994
599.995
599.995
599.995
599.996
599.995
599.995
599.995
599.996
599.996
599.997
600.006
599.999
599.997
599.994
599.992
599.991
599.989
599.985
599.981
599.977
599.976
599.979
599.985
599.99
599.992
599.993
599.994
599.995
599.994
599.995
599.995
599.995
599.996
599.996
599.995
599.995
599.995
599.996
599.996
599.997
599.995
599.998
599.995
599.991
599.988
599.988
599.987
599.984
599.98
599.977
599.976
599.979
599.984
599.989
599.991
599.992
599.993
599.994
599.995
599.995
599.995
599.996
599.996
599.996
599.996
599.995
599.996
599.996
599.996
599.997
599.994
599.998
599.996
599.993
599.987
599.986
599.985
599.983
599.979
599.976
599.976
599.978
599.983
599.987
599.99
599.991
599.992
599.993
599.994
599.995
599.996
599.996
599.996
599.996
599.996
599.996
599.996
599.996
599.997
599.998
599.992
599.998
599.997
599.995
599.993
599.986
599.985
599.983
599.979
599.976
599.976
599.978
599.982
599.986
599.989
599.99
599.991
599.992
599.993
599.995
599.996
599.997
599.996
599.997
599.997
599.997
599.996
599.996
599.996
599.998
599.994
599.998
599.998
599.997
599.995
599.991
599.986
599.983
599.98
599.978
599.977
599.979
599.982
599.986
599.989
599.991
599.992
599.992
599.993
599.995
599.997
599.997
599.997
599.997
599.997
599.997
599.997
599.997
599.997
599.998
599.998
599.999
599.998
599.997
599.996
599.994
599.989
599.986
599.982
599.98
599.979
599.981
599.984
599.987
599.99
599.992
599.993
599.993
599.993
599.995
599.995
599.997
599.998
599.997
599.997
599.997
599.998
600.01
599.998
599.998
599.998
599.998
599.999
599.998
599.997
599.996
599.991
599.988
599.986
599.984
599.983
599.984
599.986
599.989
599.991
599.993
599.994
599.993
599.993
599.994
599.996
599.997
599.997
599.998
599.998
599.998
599.998
599.995
599.997
599.998
599.998
599.998
599.998
599.998
599.998
599.997
599.993
599.992
599.991
599.989
599.989
599.989
599.99
599.992
599.994
599.995
599.995
599.994
599.994
599.994
599.996
599.996
599.997
599.998
599.998
599.998
599.998
599.995
600
599.998
599.998
599.998
599.998
599.998
599.999
599.999
599.996
599.995
599.995
599.994
599.994
599.994
599.995
599.996
599.996
599.997
599.996
599.995
599.995
599.995
599.995
599.991
599.99
599.996
599.998
599.998
599.998
599.993
599.999
599.998
599.997
599.998
599.998
599.996
599.998
600
599.999
599.998
599.998
599.999
599.999
599.999
599.999
599.999
599.998
599.997
599.997
599.996
599.995
599.994
599.986
599.977
599.981
599.993
599.997
599.998
599.999
599.996
599.999
599.996
599.996
599.998
599.996
599.99
599.994
599.996
599.998
599.999
599.999
600
600
600
600
600
599.999
599.997
599.996
599.995
599.991
599.981
599.971
599.97
599.979
599.988
599.996
599.998
599.999
599.998
599.999
599.996
599.995
599.995
599.992
599.983
599.981
599.992
599.995
599.997
599.999
599.999
599.999
599.999
599.998
599.998
599.997
599.996
599.991
599.984
599.974
599.967
599.968
599.973
599.98
599.985
599.991
599.997
599.998
599.999
599.999
599.997
599.996
599.996
599.993
599.983
599.974
599.977
599.983
599.986
599.988
599.99
599.991
599.991
599.991
599.99
599.986
599.981
599.974
599.968
599.966
599.968
599.972
599.977
599.981
599.983
599.987
599.995
599.998
599.999
599.999
599.999
599.998
599.998
599.995
599.987
599.98
599.977
599.979
599.98
599.98
599.98
599.98
599.979
599.978
599.975
599.971
599.968
599.967
599.967
599.97
599.974
599.977
599.98
599.982
599.983
599.986
599.995
599.998
599.999
599.999
599.998
599.998
599.998
599.995
599.989
599.983
599.982
599.983
599.983
599.983
599.981
599.979
599.977
599.974
599.972
599.97
599.97
599.971
599.973
599.975
599.978
599.98
599.981
599.982
599.984
599.988
599.996
599.998
599.999
599.999
599.998
599.998
599.997
599.995
599.989
599.986
599.986
599.987
599.987
599.987
599.986
599.984
599.981
599.979
599.977
599.976
599.976
599.976
599.977
599.979
599.98
599.981
599.982
599.982
599.984
599.988
599.996
599.999
600.001
599.999
599.998
599.997
599.997
599.995
599.99
599.987
599.987
599.988
599.989
599.989
599.988
599.987
599.984
599.982
599.98
599.979
599.979
599.979
599.98
599.98
599.981
599.981
599.982
599.982
599.983
599.986
599.995
599.999
600.006
599.999
599.998
599.997
599.997
599.995
599.989
599.987
599.987
599.989
599.99
599.99
599.99
599.988
599.986
599.984
599.982
599.981
599.981
599.981
599.981
599.981
599.981
599.981
599.981
599.981
599.981
599.984
599.992
599.998
599.996
599.998
599.998
599.997
599.997
599.995
599.989
599.987
599.987
599.989
599.991
599.991
599.99
599.988
599.986
599.984
599.982
599.982
599.981
599.981
599.981
599.98
599.98
599.98
599.981
599.981
599.981
599.983
599.991
599.998
599.995
599.998
599.999
599.998
599.998
599.995
599.988
599.986
599.987
599.99
599.992
599.992
599.991
599.988
599.985
599.983
599.982
599.981
599.981
599.98
599.98
599.98
599.98
599.98
599.98
599.98
599.981
599.984
599.992
599.998
599.995
599.997
599.998
599.998
599.998
599.993
599.987
599.985
599.988
599.99
599.993
599.993
599.991
599.987
599.984
599.982
599.981
599.98
599.98
599.98
599.979
599.979
599.979
599.979
599.98
599.98
599.981
599.985
599.993
599.998
599.995
599.998
599.999
599.998
599.998
599.991
599.985
599.985
599.988
599.992
599.994
599.994
599.99
599.985
599.983
599.981
599.98
599.979
599.979
599.979
599.979
599.979
599.979
599.979
599.98
599.981
599.982
599.986
599.994
599.998
599.996
599.998
599.999
599.998
599.998
599.989
599.984
599.986
599.99
599.994
599.996
599.993
599.988
599.984
599.981
599.98
599.979
599.979
599.978
599.978
599.978
599.978
599.978
599.979
599.98
599.981
599.982
599.986
599.994
599.998
599.998
599.998
599.996
599.999
599.998
599.988
599.985
599.989
599.993
599.997
599.996
599.991
599.986
599.982
599.98
599.979
599.978
599.978
599.978
599.977
599.977
599.978
599.978
599.979
599.98
599.981
599.982
599.986
599.993
599.998
599.998
599.998
599.998
599.998
599.996
599.989
599.989
599.992
599.996
599.998
599.994
599.988
599.983
599.98
599.979
599.978
599.977
599.977
599.977
599.977
599.977
599.978
599.978
599.979
599.98
599.982
599.983
599.985
599.991
599.997
599.998
599.998
599.998
599.997
599.994
599.99
599.992
599.996
599.998
599.996
599.991
599.985
599.981
599.979
599.978
599.977
599.977
599.977
599.976
599.977
599.977
599.977
599.978
599.979
599.981
599.982
599.983
599.985
599.991
599.997
599.998
599.998
599.998
599.996
599.992
599.992
599.995
599.999
599.997
599.993
599.987
599.983
599.98
599.978
599.977
599.976
599.976
599.976
599.976
599.976
599.977
599.978
599.978
599.979
599.981
599.983
599.984
599.986
599.991
599.997
599.998
599.998
599.998
599.996
599.993
599.995
599.998
599.998
599.994
599.99
599.985
599.982
599.979
599.977
599.976
599.976
599.976
599.976
599.976
599.976
599.977
599.978
599.978
599.98
599.981
599.983
599.985
599.988
599.993
599.997
599.998
599.998
599.998
599.996
599.995
599.996
599.997
599.995
599.991
599.988
599.986
599.982
599.979
599.977
599.976
599.976
599.976
599.976
599.976
599.976
599.977
599.978
599.979
599.98
599.981
599.984
599.986
599.99
599.995
599.997
599.997
599.998
599.997
599.997
599.995
599.995
599.994
599.992
599.99
599.99
599.988
599.983
599.979
599.977
599.976
599.976
599.976
599.976
599.976
599.977
599.977
599.978
599.979
599.98
599.982
599.984
599.987
599.991
599.996
599.998
599.997
599.998
599.998
599.998
599.995
599.992
599.99
599.99
599.991
599.993
599.99
599.984
599.979
599.976
599.975
599.975
599.975
599.976
599.976
599.977
599.977
599.978
599.979
599.98
599.982
599.984
599.988
599.992
599.996
599.997
599.997
599.998
599.998
599.998
599.995
599.993
599.991
599.991
599.993
599.995
599.991
599.984
599.978
599.976
599.975
599.975
599.975
599.976
599.976
599.977
599.978
599.978
599.979
599.98
599.982
599.984
599.988
599.993
599.997
599.998
599.997
599.998
599.998
599.997
599.996
599.995
599.994
599.994
599.996
599.996
599.991
599.983
599.977
599.975
599.975
599.975
599.975
599.976
599.977
599.977
599.978
599.979
599.979
599.98
599.982
599.984
599.988
599.994
599.997
599.998
599.997
599.998
599.997
599.997
599.997
599.997
599.997
599.997
599.998
599.996
599.99
599.982
599.976
599.974
599.974
599.975
599.976
599.976
599.977
599.977
599.978
599.979
599.98
599.98
599.981
599.984
599.988
599.994
599.997
599.998
599.998
599.998
599.997
599.998
599.997
599.998
599.998
599.999
599.998
599.995
599.988
599.98
599.975
599.973
599.974
599.975
599.976
599.976
599.977
599.978
599.978
599.979
599.98
599.98
599.981
599.984
599.988
599.995
599.998
599.998
599.998
599.998
599.997
599.998
599.997
599.998
599.999
600
599.998
599.994
599.986
599.979
599.975
599.973
599.974
599.976
599.976
599.977
599.978
599.978
599.979
599.979
599.98
599.981
599.981
599.983
599.988
599.996
599.998
599.997
599.997
599.998
599.998
599.998
599.998
599.998
600
599.999
599.997
599.992
599.985
599.979
599.975
599.974
599.975
599.977
599.977
599.978
599.978
599.979
599.979
599.98
599.98
599.981
599.982
599.984
599.988
599.996
599.998
599.997
599.997
599.997
599.998
599.998
599.998
599.999
599.999
599.998
599.996
599.992
599.987
599.981
599.978
599.976
599.977
599.978
599.979
599.979
599.98
599.98
599.981
599.981
599.981
599.982
599.982
599.984
599.988
599.997
599.999
599.997
599.998
599.997
599.998
599.999
599.997
599.998
599.999
599.998
599.996
599.993
599.989
599.984
599.981
599.979
599.979
599.98
599.98
599.981
599.981
599.982
599.982
599.983
599.983
599.983
599.984
599.985
599.988
599.997
600
599.998
599.997
599.998
599.998
599.998
599.999
599.998
599.998
599.998
599.996
599.995
599.992
599.988
599.984
599.982
599.981
599.982
599.982
599.983
599.983
599.984
599.984
599.985
599.985
599.985
599.985
599.986
599.989
599.996
600
599.998
599.998
599.998
599.998
599.998
599.998
599.998
599.998
599.998
599.997
599.996
599.995
599.991
599.988
599.985
599.984
599.984
599.985
599.985
599.986
599.986
599.987
599.987
599.988
599.988
599.988
599.988
599.99
599.996
600
599.998
599.999
599.998
599.998
599.998
599.998
599.998
599.998
599.998
599.999
599.998
599.997
599.994
599.991
599.988
599.987
599.986
599.987
599.987
599.988
599.989
599.989
599.99
599.99
599.991
599.99
599.99
599.991
599.996
600
599.999
599.998
599.998
599.998
599.998
599.998
599.999
599.999
599.999
599.999
600
599.999
599.997
599.994
599.991
599.989
599.989
599.989
599.99
599.991
599.991
599.992
599.993
599.993
599.993
599.993
599.993
599.993
599.996
599.999
599.998
599.998
599.999
599.998
599.999
599.999
599.999
599.999
599.999
600
600
600
599.999
599.997
599.994
599.992
599.992
599.992
599.992
599.993
599.994
599.995
599.995
599.996
599.996
599.996
599.995
599.996
599.997
599.998
599.998
599.998
599.998
599.999
599.999
599.999
599.999
599.999
599.999
599.999
600
600.001
600.001
600
599.997
599.995
599.995
599.995
599.995
599.996
599.997
599.997
599.998
599.998
599.998
599.998
599.998
599.998
599.999
599.999
599.998
599.998
599.998
599.999
599.999
599.999
599.999
599.999
599.999
599.999
599.999
600
600.001
600.002
600.001
599.998
599.998
599.998
599.998
599.999
599.999
600
600
600
600
600
600
600.001
600.001
600.001
600
599.999
599.998
600
600
599.999
599.999
600
599.999
599.999
599.999
600
600
600.001
600.002
600.001
600
600
600.001
600.001
600.001
600.001
600
600
600
600.001
600.001
600.001
600.001
600.001
600
599.999
599.999
600
599.999
600
600
600
599.999
599.999
599.999
600
600
600
600.001
600.001
600.001
600.001
600.001
600.001
600.001
600.001
600
600
600
600
600
600.001
600.001
600.001
600
600
599.999
600
599.999
600
600
600
600
600
600
600
600
600
600
600.001
600.001
600.001
600.001
600.001
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600.001
600
600
600
600
600
600
600
600
600
600
600
600.001
600.001
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600.001
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600.001
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600.001
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600.001
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600.002
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
599.999
600
600.001
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600.001
600.003
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600.001
600.001
599.998
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
599.999
599.999
600.001
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
599.999
600
600.001
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600.001
600
600
600
600
600
600
600
600
600
600
600
600
600.001
600.001
600.001
600.001
600.001
600.001
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
599.999
600
600
600
600
600
600.001
600.001
600.001
600.001
600.001
600.001
600.001
600.001
600.001
600.001
600
600
600
600
600
600
600
600
599.999
600
600
600
600
600
600
600
600
600
600
600.001
600.001
600.001
600
600.001
600.001
600.001
600.001
600
600.001
600.001
600.001
600
600
600
600
600
600
600
599.999
600
600
600
600
600
600
600
600
600
600.001
600.001
600.001
599.999
600.002
600.001
600
600
600
600
600
600
600.001
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600.001
600.001
600.001
599.999
600.003
600.001
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600.001
600
600
600
600.001
600.001
600.001
600
600.002
600.001
600
599.999
600
600
600
600
600
599.999
600
600
600
600
600
600
600
600
600
600.001
600
600.001
600.001
600.001
600.001
600.001
600.001
600.001
600.001
600.001
600.001
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600.001
600.001
600.001
600.001
600.001
600.001
600.002
600.001
600.001
600.001
600.001
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600.001
600.001
600.001
600.002
600.002
600.002
600.002
600.001
600.001
600.001
600.001
600
600
600.001
600.001
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600.001
600
600
600.001
600.002
600.002
600.001
600.001
600.001
600.001
600.001
600.001
600.001
600.001
600.001
600.001
600
600
599.999
599.999
600
600
600
600
600
600
600
600
600
600
600
600.001
600
600.001
600.002
600.002
600.001
600.001
600.001
600.001
600.001
600.001
600.001
600.001
600.001
600.001
600.001
600
599.999
599.999
599.999
599.999
599.999
599.999
599.999
599.999
600
600
600
600
600.001
600.001
600.001
600.001
600.002
600.002
600.001
600.001
600.001
600.001
600.001
600.001
600.001
600.001
600.001
600.001
600.001
600
600
599.999
599.999
600
600
600
599.999
599.999
600
600
600
600
600.001
600.001
600.001
600.002
600.002
600.002
600.001
600.001
600.001
600.001
600.001
600.001
600.001
600.001
600.001
600.001
600.001
600
600
600.001
600
599.999
599.999
599.999
599.999
599.999
599.999
600
600
600
600.001
600.002
600.002
600.002
600.002
600.002
600.001
600.001
600.001
600.001
600.001
600.001
600.001
600.001
600.001
600.001
600.001
600
600.001
600.001
600.001
600.001
599.999
599.999
599.999
599.999
599.999
600
600
600
600.001
600.001
600.002
600.002
600.002
600.002
600.001
600.001
600.001
600.001
600.001
600.001
600.001
600.001
600.001
600.001
600.001
600.001
600.001
600.001
600.001
600.001
600.001
600.001
599.999
600
600
600
600
600
600.001
600.001
600.002
600.002
600.002
600.002
600.002
600.001
600.002
600.002
600.002
600.002
600.001
600.002
600.003
600.001
600.003
600.001
600.001
600.001
600.001
600.001
600.001
600.002
600.001
600.001
600
600
600
600
600.002
600.002
600.002
600.002
600.002
600.002
600.002
600.002
600.002
600.002
600.002
600.002
600.001
600
600.001
600.001
600.001
600.001
600.001
600.001
600.001
600.001
600.001
600.001
600.002
600.002
600.001
600
600
600
600.002
600.002
600.002
600.002
600.002
600.002
600.002
600.002
600.002
600.002
600.002
600.002
600.001
600.002
600
600.001
600
600.002
600.001
600
600.001
600.001
600.001
600.001
600.001
600.002
600.002
600.001
600
600
600.002
600.002
600.002
600.002
600.002
600.002
600.002
600.002
600.002
600.002
600.002
600.002
600.002
600.002
600.002
600.001
600.001
600.002
600.001
600.001
600
600.002
600.001
600.001
600.001
600.001
600.002
600.001
600.001
600
600.002
600.002
600.002
600.002
600.002
600.002
600.002
600.002
600.003
600.003
600.003
600.003
600.002
600.002
600.002
600.002
600.002
600.002
600.002
600.002
600.001
600.001
600.002
600.001
600.001
600.001
600.001
600.002
600.001
600
600.003
600.002
600.002
600.002
600.002
600.002
600.003
600.003
600.003
600.003
600.003
600.003
600.003
600.002
600.002
600.002
600
600.004
600.003
600.002
600.002
600.002
600.002
600.002
600.002
600.001
600.001
600.001
600.002
600
599.999
600.004
600.004
600.003
600.002
600.002
600.003
600.003
600.003
600.003
600.003
600.003
600.003
600.003
600.003
600.002
600.004
600.002
600.003
600.003
600.003
600.003
600.003
600.003
600.002
600.001
600.001
600.001
600.002
600.017
599.931
599.981
599.999
599.997
600.001
600.002
600.002
600.002
600.001
599.999
600
600.001
600.002
600.003
600.003
600.003
600.003
600.002
600.003
600.004
600.004
600.003
599.998
599.997
600.002
600.002
600.001
600.001
600.003
599.996
599.892
599.927
599.944
599.95
599.982
599.994
599.995
599.992
599.984
599.965
599.966
599.974
599.983
599.989
599.993
599.995
599.999
600.001
600
599.996
599.988
599.976
599.965
599.967
599.989
600.001
600.001
600.001
600.002
599.996
600.047
600.039
600.001
599.956
599.932
599.948
599.953
599.949
599.929
599.901
599.898
599.907
599.919
599.932
599.945
599.961
599.973
599.981
599.976
599.968
599.96
599.957
599.959
599.952
599.97
599.996
600.001
600.001
600.001
600.001
600.208
600.164
600.106
600.046
599.985
599.956
599.945
599.94
599.939
599.943
599.946
599.947
599.95
599.958
599.971
599.988
600
600.014
600.024
600.032
600.036
600.034
600.02
599.994
599.972
599.992
600.001
600.001
600.001
600.002
600.266
600.228
600.185
600.138
600.088
600.054
600.036
600.029
600.03
600.036
600.04
600.042
600.044
600.051
600.061
600.074
600.086
600.097
600.105
600.11
600.108
600.098
600.077
600.04
599.993
599.987
600
600.001
600.002
599.998
600.278
600.255
600.228
600.2
600.169
600.145
600.13
600.122
600.121
600.123
600.125
600.126
600.128
600.132
600.138
600.145
600.153
600.159
600.163
600.162
600.156
600.143
600.121
600.087
600.04
599.998
599.996
600.002
600
600.023
600.274
600.261
600.247
600.232
600.216
600.202
600.192
600.186
600.183
600.182
600.182
600.182
600.183
600.184
600.186
600.189
600.192
600.193
600.193
600.189
600.181
600.168
600.149
600.124
600.096
600.07
600.054
600.045
600.058
600.114
600.26
600.255
600.25
600.244
600.238
600.231
600.226
600.222
600.219
600.217
600.216
600.215
600.214
600.213
600.212
600.211
600.21
600.207
600.203
600.197
600.188
600.176
600.161
600.144
600.129
600.119
600.12
600.134
600.165
600.2
600.24
600.241
600.243
600.243
600.242
600.241
600.239
600.237
600.235
600.233
600.231
600.229
600.227
600.224
600.221
600.217
600.213
600.207
600.201
600.193
600.183
600.171
600.159
600.147
600.138
600.135
600.144
600.161
600.182
600.211
600.217
600.223
600.228
600.232
600.235
600.238
600.238
600.238
600.237
600.235
600.233
600.23
600.227
600.223
600.218
600.212
600.206
600.198
600.189
600.179
600.168
600.157
600.145
600.135
600.128
600.127
600.136
600.15
600.163
600.185
600.193
600.201
600.208
600.215
600.221
600.226
600.228
600.229
600.229
600.227
600.225
600.222
600.218
600.213
600.206
600.199
600.191
600.181
600.17
600.159
600.147
600.134
600.123
600.113
600.105
600.103
600.107
600.115
600.125
600.15
600.167
600.177
600.186
600.193
600.201
600.207
600.211
600.212
600.213
600.211
600.209
600.206
600.201
600.196
600.188
600.18
600.17
600.159
600.147
600.134
600.12
600.107
600.094
600.083
600.075
600.07
600.069
600.072
600.078
600.097
600.142
600.153
600.161
600.17
600.177
600.184
600.188
600.191
600.191
600.19
600.187
600.184
600.18
600.174
600.166
600.156
600.146
600.134
600.12
600.106
600.091
600.076
600.063
600.05
600.04
600.033
600.028
600.027
600.027
600.035
600.118
600.128
600.137
600.145
600.152
600.159
600.163
600.165
600.166
600.165
600.162
600.159
600.155
600.149
600.14
600.13
600.119
600.106
600.091
600.076
600.06
600.044
600.029
600.016
600.004
599.994
599.987
599.983
599.98
599.982
600.094
600.103
600.112
600.119
600.126
600.132
600.136
600.138
600.139
600.137
600.135
600.132
600.128
600.121
600.113
600.102
600.09
600.076
600.061
600.045
600.028
600.011
599.995
599.981
599.968
599.957
599.948
599.941
599.936
599.935
600.071
600.079
600.087
600.094
600.1
600.105
600.109
600.11
600.11
600.109
600.107
600.104
600.1
600.093
600.084
600.073
600.06
600.046
600.03
600.014
599.996
599.978
599.962
599.947
599.934
599.922
599.912
599.903
599.897
599.894
600.048
600.056
600.063
600.068
600.074
600.078
600.081
600.082
600.081
600.08
600.078
600.075
600.07
600.064
600.055
600.043
600.03
600.016
600
599.982
599.964
599.947
599.93
599.915
599.901
599.889
599.878
599.869
599.862
599.858
600.027
600.034
600.039
600.044
600.048
600.051
600.053
600.054
600.053
600.051
600.049
600.046
600.041
600.034
600.025
600.014
600.001
599.986
599.969
599.952
599.934
599.916
599.899
599.885
599.871
599.858
599.847
599.839
599.832
599.828
600.007
600.013
600.017
600.02
600.023
600.026
600.027
600.026
600.024
600.022
600.02
600.017
600.012
600.005
599.996
599.985
599.971
599.956
599.94
599.923
599.905
599.887
599.871
599.856
599.843
599.831
599.82
599.812
599.806
599.803
599.988
599.992
599.995
599.998
600
600.001
600.001
599.999
599.997
599.995
599.992
599.989
599.984
599.977
599.967
599.956
599.943
599.928
599.911
599.894
599.877
599.859
599.843
599.83
599.817
599.805
599.795
599.788
599.783
599.782
599.97
599.973
599.975
599.976
599.977
599.977
599.976
599.973
599.97
599.967
599.965
599.961
599.956
599.949
599.939
599.928
599.915
599.9
599.884
599.867
599.85
599.833
599.818
599.805
599.793
599.782
599.773
599.766
599.762
599.763
599.954
599.955
599.955
599.955
599.955
599.954
599.951
599.948
599.944
599.941
599.938
599.935
599.929
599.921
599.912
599.9
599.887
599.873
599.857
599.841
599.824
599.808
599.793
599.781
599.771
599.761
599.752
599.746
599.743
599.746
599.938
599.937
599.937
599.935
599.934
599.931
599.927
599.923
599.918
599.915
599.912
599.908
599.902
599.894
599.885
599.873
599.86
599.846
599.831
599.815
599.799
599.784
599.77
599.759
599.749
599.74
599.733
599.727
599.725
599.728
599.923
599.921
599.919
599.916
599.913
599.909
599.904
599.898
599.893
599.89
599.887
599.882
599.876
599.868
599.858
599.847
599.834
599.82
599.805
599.79
599.774
599.76
599.747
599.736
599.728
599.721
599.714
599.709
599.707
599.711
599.908
599.905
599.901
599.897
599.892
599.887
599.88
599.873
599.868
599.865
599.861
599.856
599.849
599.841
599.831
599.82
599.808
599.794
599.779
599.764
599.75
599.736
599.723
599.714
599.707
599.701
599.696
599.692
599.69
599.694
599.895
599.889
599.883
599.878
599.871
599.864
599.855
599.848
599.843
599.839
599.834
599.829
599.822
599.814
599.804
599.793
599.78
599.767
599.753
599.738
599.724
599.711
599.7
599.691
599.686
599.682
599.678
599.675
599.673
599.677
599.881
599.873
599.865
599.857
599.849
599.84
599.829
599.821
599.816
599.811
599.806
599.8
599.793
599.785
599.775
599.764
599.752
599.739
599.725
599.711
599.698
599.685
599.675
599.667
599.664
599.661
599.659
599.657
599.657
599.66
599.866
599.855
599.845
599.836
599.825
599.813
599.801
599.792
599.786
599.781
599.776
599.769
599.762
599.753
599.744
599.733
599.721
599.708
599.695
599.681
599.669
599.657
599.648
599.642
599.639
599.639
599.639
599.639
599.64
599.644
599.851
599.836
599.823
599.811
599.797
599.782
599.768
599.758
599.753
599.747
599.741
599.735
599.727
599.718
599.708
599.697
599.686
599.673
599.661
599.648
599.636
599.626
599.618
599.613
599.612
599.614
599.617
599.62
599.622
599.627
599.833
599.814
599.797
599.781
599.763
599.745
599.728
599.719
599.713
599.707
599.7
599.693
599.686
599.677
599.667
599.657
599.646
599.634
599.622
599.61
599.6
599.591
599.584
599.581
599.582
599.587
599.592
599.598
599.604
599.611
599.811
599.786
599.765
599.744
599.721
599.698
599.68
599.67
599.664
599.657
599.651
599.644
599.636
599.627
599.618
599.608
599.598
599.587
599.576
599.566
599.557
599.549
599.545
599.543
599.547
599.555
599.564
599.574
599.583
599.594
599.782
599.751
599.723
599.695
599.667
599.639
599.619
599.609
599.602
599.595
599.588
599.581
599.574
599.566
599.558
599.549
599.54
599.53
599.521
599.513
599.506
599.501
599.498
599.5
599.506
599.518
599.532
599.546
599.56
599.576
599.745
599.704
599.667
599.631
599.594
599.56
599.54
599.529
599.521
599.514
599.508
599.502
599.495
599.489
599.482
599.475
599.468
599.461
599.454
599.448
599.444
599.442
599.443
599.448
599.458
599.474
599.493
599.513
599.534
599.557
599.694
599.639
599.591
599.543
599.497
599.456
599.434
599.423
599.415
599.408
599.403
599.398
599.394
599.39
599.385
599.381
599.377
599.374
599.371
599.369
599.369
599.372
599.377
599.386
599.401
599.422
599.448
599.475
599.502
599.535
599.623
599.55
599.485
599.423
599.364
599.316
599.293
599.281
599.273
599.268
599.265
599.263
599.262
599.262
599.262
599.262
599.263
599.265
599.268
599.272
599.277
599.286
599.297
599.313
599.333
599.36
599.394
599.429
599.466
599.509
599.523
599.425
599.338
599.257
599.182
599.128
599.103
599.091
599.084
599.081
599.082
599.085
599.09
599.096
599.103
599.111
599.119
599.128
599.139
599.151
599.165
599.181
599.201
599.224
599.252
599.287
599.329
599.374
599.422
599.479
599.38
599.248
599.133
599.026
598.931
598.871
598.845
598.833
598.829
598.832
598.84
598.851
598.865
598.881
598.898
598.917
598.936
598.956
598.978
599.001
599.026
599.053
599.083
599.117
599.156
599.2
599.251
599.309
599.37
599.444
599.177
598.999
598.845
598.705
598.587
598.522
598.495
598.486
598.488
598.5
598.519
598.543
598.571
598.602
598.635
598.669
598.704
598.74
598.777
598.815
598.855
598.897
598.942
598.989
599.04
599.096
599.159
599.23
599.307
599.401
598.886
598.647
598.442
598.26
598.114
598.045
598.02
598.017
598.031
598.058
598.095
598.139
598.189
598.242
598.297
598.353
598.41
598.468
598.526
598.586
598.646
598.707
598.77
598.835
598.902
598.974
599.05
599.135
599.23
599.348
598.472
598.151
597.877
597.641
597.47
597.399
597.38
597.389
597.423
597.474
597.539
597.613
597.694
597.779
597.866
597.953
598.041
598.129
598.216
598.303
598.39
598.476
598.563
598.651
598.739
598.829
598.923
599.023
599.136
599.28
597.883
597.45
597.088
596.786
596.595
596.527
596.519
596.552
596.618
596.707
596.814
596.932
597.058
597.188
597.319
597.45
597.58
597.708
597.833
597.957
598.078
598.197
598.315
598.431
598.545
598.659
598.773
598.892
599.024
599.193
597.043
596.464
595.986
595.61
595.41
595.352
595.371
595.444
595.56
595.707
595.875
596.057
596.246
596.438
596.63
596.82
597.006
597.188
597.364
597.535
597.701
597.862
598.018
598.169
598.316
598.46
598.601
598.742
598.892
599.083
595.846
595.074
594.453
594
593.808
593.781
593.849
593.99
594.184
594.415
594.671
594.941
595.218
595.496
595.77
596.039
596.299
596.55
596.792
597.024
597.246
597.46
597.664
597.86
598.048
598.228
598.401
598.57
598.746
598.962
594.133
593.115
592.326
591.818
591.662
591.697
591.853
592.099
592.409
592.762
593.142
593.534
593.931
594.323
594.706
595.077
595.434
595.774
596.099
596.409
596.702
596.981
597.245
597.496
597.733
597.958
598.171
598.376
598.585
598.836
591.667
590.349
589.388
588.888
588.815
588.963
589.262
589.668
590.147
590.672
591.221
591.779
592.334
592.877
593.402
593.905
594.384
594.839
595.269
595.674
596.056
596.415
596.753
597.07
597.367
597.645
597.907
598.156
598.406
598.702
588.084
586.442
585.359
584.982
585.073
585.42
585.943
586.583
587.3
588.061
588.839
589.616
590.377
591.115
591.82
592.491
593.125
593.721
594.281
594.805
595.294
595.751
596.177
596.573
596.942
597.285
597.604
597.906
598.206
598.558
582.807
580.928
579.911
579.831
580.224
580.896
581.751
582.725
583.769
584.844
585.923
586.983
588.01
588.993
589.926
590.805
591.629
592.399
593.117
593.784
594.402
594.976
595.507
595.999
596.452
596.871
597.259
597.622
597.982
598.4
574.911
573.207
572.701
573.162
574.06
575.22
576.549
577.979
579.457
580.944
582.408
583.826
585.185
586.472
587.684
588.817
589.873
590.852
591.759
592.597
593.369
594.081
594.736
595.338
595.891
596.398
596.865
597.301
597.729
598.226
563.013
562.66
563.384
564.739
566.393
568.243
570.215
572.246
574.285
576.292
578.237
580.099
581.863
583.52
585.068
586.506
587.837
589.064
590.194
591.231
592.183
593.055
593.854
594.584
595.251
595.86
596.419
596.938
597.446
598.031
545.977
549.091
551.774
554.407
557.101
559.868
562.67
565.461
568.198
570.845
573.376
575.771
578.02
580.117
582.061
583.856
585.507
587.022
588.41
589.678
590.836
591.892
592.854
593.73
594.527
595.253
595.915
596.529
597.128
597.815
525.497
533.032
537.969
542.171
546.162
550.063
553.885
557.6
561.178
564.59
567.814
570.836
573.651
576.257
578.658
580.863
582.881
584.724
586.404
587.933
589.323
590.586
591.732
592.772
593.715
594.571
595.35
596.07
596.771
597.574
504.209
515.064
522.213
528.157
533.645
538.876
543.896
548.697
553.256
557.554
561.577
565.318
568.777
571.959
574.876
577.54
579.968
582.176
584.181
585.999
587.646
589.137
590.487
591.707
592.811
593.811
594.719
595.557
596.373
597.306
481.714
495.448
504.771
512.555
519.694
526.424
532.808
538.843
544.517
549.816
554.735
559.277
563.449
567.268
570.75
573.918
576.793
579.398
581.756
583.887
585.813
587.551
589.121
590.537
591.816
592.971
594.02
594.988
595.929
597.004
458.338
474.53
485.915
495.584
504.498
512.883
520.785
528.196
535.105
541.506
547.404
552.815
557.757
562.259
566.346
570.05
573.401
576.427
579.159
581.622
583.842
585.842
587.644
589.268
590.732
592.053
593.253
594.359
595.439
596.676
434.67
452.662
465.89
477.458
488.272
498.474
508.054
516.976
525.227
532.813
539.754
546.081
551.831
557.043
561.759
566.017
569.858
573.319
576.436
579.241
581.763
584.033
586.074
587.912
589.567
591.061
592.418
593.671
594.896
596.297
411.035
429.997
444.789
458.321
471.234
483.469
494.906
505.476
515.163
523.992
532.011
539.275
545.843
551.771
557.116
561.929
566.26
570.153
573.653
576.798
579.622
582.159
584.439
586.49
588.336
590.004
591.52
592.925
594.305
595.905
387.538
406.482
422.507
438.207
453.593
468.199
481.727
494.078
505.269
515.367
524.463
532.649
540.013
546.634
552.583
557.928
562.727
567.035
570.901
574.369
577.482
580.275
582.783
585.037
587.066
588.9
590.571
592.123
593.656
595.423
364.23
381.977
398.829
417.19
435.684
453.135
469.031
483.284
496
507.341
517.463
526.511
534.61
541.864
548.365
554.193
559.416
564.099
568.297
572.059
575.432
578.455
581.168
583.605
585.798
587.781
589.591
591.281
592.968
594.982
341.221
356.476
373.558
395.664
418.239
439.09
457.572
473.755
487.929
500.4
511.43
521.224
529.951
537.742
544.708
550.941
556.522
561.519
565.994
570.002
573.592
576.808
579.69
582.276
584.6
586.7
588.618
590.415
592.222
594.346
318.69
330.462
346.594
374.902
402.801
427.43
448.45
466.355
481.745
495.118
506.847
517.207
526.403
534.593
541.904
548.437
554.28
559.509
564.189
568.377
572.125
575.48
578.482
581.171
583.583
585.755
587.731
589.583
591.481
593.916
300.955
306.34
317.528
358.272
392.37
420.264
443.113
462.122
478.243
492.136
504.26
514.935
524.39
532.799
540.298
546.995
552.983
558.338
563.129
567.415
571.248
574.675
577.739
580.478
582.926
585.119
587.095
588.911
590.702
592.937
)
;
boundaryField
{
inlet
{
type fixedValue;
value uniform 300;
}
outlet
{
type inletOutlet;
phi phi.air;
inletValue uniform 300;
value nonuniform List<scalar>
30
(
300
300
300
358.272
392.37
420.264
443.112
462.122
478.242
492.136
504.26
514.934
524.389
532.799
540.298
546.995
552.982
558.338
563.129
567.415
571.248
574.675
577.739
580.478
582.926
585.119
587.095
588.91
590.702
592.937
)
;
}
walls
{
type zeroGradient;
}
frontAndBackPlanes
{
type empty;
}
}
// ************************************************************************* //
| [
"peterbryz@yahoo.com"
] | peterbryz@yahoo.com |
eebf816bc51bc5c3804346dcd6a12bfab49bf970 | 66f5b22473d1e3608ec923d2fa15506b412d9ede | /PhaethonAsm/AssemblerListNode.h | 5df19e99d0eab2e34d4ff15d317349f801df0417 | [] | no_license | BenConAu/VerilogDesign | 26ddffe9ae3cffccf0d7ae8d85f8ec2d9222db86 | 9425a215b71541049e0510bc6e70d42c0d312eef | refs/heads/master | 2021-05-02T13:14:17.855822 | 2017-12-11T20:16:07 | 2017-12-11T20:16:07 | 48,672,699 | 1 | 0 | null | 2017-12-03T08:10:11 | 2015-12-28T03:52:33 | C | UTF-8 | C++ | false | false | 1,028 | h | #pragma once
#include "AssemblerNode.h"
#include <vector>
template<typename DefType, typename ChildDefType>
class AssemblerListNode : public AssemblerNode
{
public:
static DefType* Construct(ChildDefType* pFirstItem)
{
DefType* pNewList = AssemblerNode::Construct<DefType>();
if (pFirstItem != nullptr)
{
pNewList->AddMember(pFirstItem);
}
return pNewList;
}
void AddMember(ChildDefType* newMember)
{
members.insert(members.begin(), newMember);
OnAddMember();
}
virtual void OnAddMember()
{
}
int Find(int memberSymIndex)
{
for (size_t j = 0; j < members.size(); j++)
{
if (DefType::Match(members[j], memberSymIndex))
{
return j;
}
}
return -1;
}
ChildDefType* GetItem(int item) { return members[item]; }
int GetItemCount() const { return members.size(); }
protected:
std::vector<ChildDefType*> members;
};
| [
"bencon@gmail.com"
] | bencon@gmail.com |
a6f9baf4f223b788b8804cf6e17931ede3f6412c | ecd7d2120a0e99c17defdb11ffabc8b237df576c | /zjb397.cpp | f8d8bc81c4363bae9e3c95565ed23ec7c1a9b706 | [] | no_license | emanlaicepsa/codes | 246735d9b04945ba3511f2bb2f20581abb405ddc | da2fdee786433708251cc8c4fc472e21354a6bc4 | refs/heads/master | 2021-05-20T08:51:38.902467 | 2020-04-01T14:58:51 | 2020-04-01T14:58:51 | 252,206,207 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,908 | cpp | #include <bits/stdc++.h>
#define IOS ios::sync_with_stdio(false);cin.tie(0);
#define rep(k,n) for(int k=0;k<(n);k++)
#define rep1(k,n) for(int k=1;k<=(n);k++)
#define fi first
#define se second
#define reset(n,k) memset((n),k,sizeof(n))
#define all(n) (n).begin(),(n).end()
#define pb emplace_back
using namespace std;
using ll=long long;
using pii=pair<int,int>;
ll dp[35][35];
vector<string> ans[35][35];
string a,b;
int siza,sizb;
int main(){
IOS
int t;
int kas=0;
cin>>t;
while(t--){
reset(dp,0);
rep(i,35){
rep(j,35){
ans[i][j].clear();
}
}
cin>>a>>b;
siza=a.size();
sizb=b.size();
rep1(i,siza){
rep1(j,sizb){
//cout<<i<<j<<'\n';
if(a[i-1]==b[j-1]){
dp[i][j]=1+dp[(i-1)][j-1];
if(!dp[(i-1)][j-1]){
string s="";
s+=a[i-1];
ans[i][j].pb(s);
}
else{
for(auto &str:ans[(i-1)][j-1]){
ans[i][j].pb(str+a[i-1]);
}
}
}
else {
dp[i][j]=max(dp[(i-1)][j],dp[i][j-1]);
if(dp[i][j]==0)continue;
if(dp[i][j]==dp[i-1][j]&&dp[i][j]==dp[i][j-1]){
ans[i][j].resize(ans[i-1][j].size()+ans[i][j-1].size());
//cout<<1<<'\n';
//for(auto it:ans[i-1][j])cout<<it<<'\n';
//for(auto it:ans[i][j-1])cout<<it<<'\n';
merge(all(ans[i-1][j]),all(ans[i][j-1]),ans[i][j].begin());
//sort(all(ans[i][j]));
ans[i][j].resize(unique(all(ans[i][j]))-ans[i][j].begin());
//for(auto it:ans[i][j])cout<<it<<'\n';
}
else if(dp[i][j]==dp[i-1][j]){
ans[i][j]=ans[i-1][j];
}
else{
ans[i][j]=ans[i][j-1];
}
}
}
}
//cout<<dp[a.size()-1][b.size()-1]<<'\n';
cout<<"Case #"<<++kas<<": ";
if(dp[siza][sizb]==0){
cout<<1<<'\n';
}
else{
cout<<ans[siza][sizb].size()<<'\n';
//sort(ans[siza][sizb].begin(),ans[siza][sizb].end());
for(auto i:ans[siza][sizb])cout<<i<<'\n';
}
}
}
| [
"kevin118033@gmail.com"
] | kevin118033@gmail.com |
1466c262e1eb76165fd5e10e00c07ca4c34a1480 | 9791a7a24160c3acacb1d0bb1b5b4453361b2151 | /WinDDK/7600.16385.1/src/print/XPSDrvSmpl/src/filters/color/wcsapiconv.h | 2ee1fd1314be9e26ff7ac8fcf994880839edeb46 | [] | no_license | kcrazy/winekit | fedc7bfa3fa702423f93447a8a19e2a4d358241e | 7948f5f42a60225d9f94930be539f0a1d6202dbc | refs/heads/master | 2021-01-10T08:18:48.598427 | 2017-02-17T05:34:15 | 2017-02-17T05:34:15 | 50,400,541 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 9,061 | h | /*++
Copyright (c) 2005 Microsoft Corporation
All rights reserved.
THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
PARTICULAR PURPOSE.
File Name:
wcsapiconv.h
Abstract:
Provides a wrapper to the WCS API's
--*/
#pragma once
class CWCSApiConv;
extern CWCSApiConv g_WCSApiConv;
typedef BOOL (CALLBACK* WCSASSOCIATECOLORPROFILEWITHDEVICE)(WCS_PROFILE_MANAGEMENT_SCOPE, PCWSTR, PCWSTR);
typedef BOOL (CALLBACK* WCSDISASSOCIATECOLORPROFILEFROMDEVICE)(WCS_PROFILE_MANAGEMENT_SCOPE, PCWSTR, PCWSTR);
typedef BOOL (CALLBACK* WCSENUMCOLORPROFILESSIZE)(WCS_PROFILE_MANAGEMENT_SCOPE, PENUMTYPEW, PDWORD);
typedef BOOL (CALLBACK* WCSGETDEFAULTCOLORPROFILESIZE)(WCS_PROFILE_MANAGEMENT_SCOPE, PCWSTR, COLORPROFILETYPE, COLORPROFILESUBTYPE, DWORD, PDWORD);
typedef BOOL (CALLBACK* WCSGETDEFAULTCOLORPROFILE)(WCS_PROFILE_MANAGEMENT_SCOPE, PCWSTR, COLORPROFILETYPE, COLORPROFILESUBTYPE, DWORD, DWORD, LPWSTR);
typedef BOOL (CALLBACK* WCSSETDEFAULTCOLORPROFILE)(WCS_PROFILE_MANAGEMENT_SCOPE, PCWSTR, COLORPROFILETYPE, COLORPROFILESUBTYPE, DWORD, LPCWSTR);
typedef BOOL (CALLBACK* WCSSETDEFAULTRENDERINGINTENT)(WCS_PROFILE_MANAGEMENT_SCOPE, DWORD);
typedef BOOL (CALLBACK* WCSGETUSEPERUSERPROFILES)(LPCWSTR, DWORD, PBOOL);
typedef BOOL (CALLBACK* WCSSETUSEPERUSERPROFILES)(LPCWSTR, DWORD, BOOL);
typedef BOOL (CALLBACK* WCSTRANSLATECOLORS)(HTRANSFORM, DWORD, DWORD, COLORDATATYPE, DWORD, PVOID, DWORD, COLORDATATYPE, DWORD, PVOID);
typedef BOOL (CALLBACK* WCSCHECKCOLORS)(HTRANSFORM, DWORD, DWORD, COLORDATATYPE, DWORD, PVOID, PBYTE);
typedef HPROFILE (CALLBACK* WCSOPENCOLORPROFILE)(PPROFILE, PPROFILE, PPROFILE, DWORD, DWORD, DWORD, DWORD);
typedef HPROFILE (CALLBACK* WCSCREATEICCPROFILE)(HPROFILE, DWORD);
#define WcsAssociateColorProfileWithDeviceXD g_WCSApiConv.WcsAssociateColorProfileWithDevice
#define WcsDisassociateColorProfileFromDeviceXD g_WCSApiConv.WcsDisassociateColorProfileFromDevice
#define WcsEnumColorProfilesSizeXD g_WCSApiConv.WcsEnumColorProfilesSize
#define WcsGetDefaultColorProfileSizeXD g_WCSApiConv.WcsGetDefaultColorProfileSize
#define WcsGetDefaultColorProfileXD g_WCSApiConv.WcsGetDefaultColorProfile
#define WcsSetDefaultColorProfileXD g_WCSApiConv.WcsSetDefaultColorProfile
#define WcsSetDefaultRenderingIntentXD g_WCSApiConv.WcsSetDefaultRenderingIntent
#define WcsGetUsePerUserProfilesXD g_WCSApiConv.WcsGetUsePerUserProfiles
#define WcsSetUsePerUserProfilesXD g_WCSApiConv.WcsSetUsePerUserProfiles
#define WcsTranslateColorsXD g_WCSApiConv.WcsTranslateColors
#define WCSCheckColorsXD g_WCSApiConv.WCSCheckColors
#define WcsOpenColorProfileWXD g_WCSApiConv.WcsOpenColorProfileW
#define WcsOpenColorProfileAXD g_WCSApiConv.WcsOpenColorProfileA
#define WcsCreateIccProfileXD g_WCSApiConv.WcsCreateIccProfile
#ifdef _UNICODE
#define WcsOpenColorProfileXD WcsOpenColorProfileWXD
#else
#define WcsOpenColorProfileXD WcsOpenColorProfileAXD
#endif
template <typename _T>
class CEncodedFuncPtr
{
public:
CEncodedFuncPtr() :
m_pFunc(NULL)
{
}
~CEncodedFuncPtr(){}
CEncodedFuncPtr<_T>&
operator=(
__in FARPROC pFunc
)
{
m_pFunc = EncodePointer(pFunc);
return *this;
}
BOOL
operator==(
__in_opt PVOID pv
) const
{
return m_pFunc == pv;
}
BOOL
operator!=(
__in_opt PVOID pv
) const
{
return !operator==(pv);
}
_T
GetFunc(
VOID
)
{
return reinterpret_cast<_T>(DecodePointer(m_pFunc));
}
private:
__field_encoded_pointer PVOID m_pFunc;
};
class CWCSApiConv
{
public:
CWCSApiConv();
~CWCSApiConv();
BOOL
WcsAssociateColorProfileWithDevice(
__in WCS_PROFILE_MANAGEMENT_SCOPE scope,
__in PCWSTR pProfileName,
__in PCWSTR pDeviceName
);
BOOL
WcsDisassociateColorProfileFromDevice(
__in WCS_PROFILE_MANAGEMENT_SCOPE scope,
__in PCWSTR pProfileName,
__in PCWSTR pDeviceName
);
BOOL
WcsEnumColorProfilesSize(
__in WCS_PROFILE_MANAGEMENT_SCOPE scope,
__in PENUMTYPEW pEnumRecord,
__out PDWORD pdwSize
);
BOOL
WcsGetDefaultColorProfileSize(
__in WCS_PROFILE_MANAGEMENT_SCOPE scope,
__in_opt PCWSTR pDeviceName,
__in COLORPROFILETYPE cptColorProfileType,
__in COLORPROFILESUBTYPE cpstColorProfileSubType,
__in DWORD dwProfileID,
__out PDWORD pcbProfileName
);
BOOL
WcsGetDefaultColorProfile(
__in WCS_PROFILE_MANAGEMENT_SCOPE scope,
__in_opt PCWSTR pDeviceName,
__in COLORPROFILETYPE cptColorProfileType,
__in COLORPROFILESUBTYPE cpstColorProfileSubType,
__in DWORD dwProfileID,
__in DWORD cbProfileName,
__out_bcount(cbProfileName) LPWSTR pProfileName
);
BOOL
WcsSetDefaultColorProfile(
__in WCS_PROFILE_MANAGEMENT_SCOPE scope,
__in_opt PCWSTR pDeviceName,
__in COLORPROFILETYPE cptColorProfileType,
__in COLORPROFILESUBTYPE cpstColorProfileSubType,
__in DWORD dwProfileID,
__in_opt LPCWSTR pProfileName
);
BOOL
WcsSetDefaultRenderingIntent(
__in WCS_PROFILE_MANAGEMENT_SCOPE scope,
__in DWORD dwRenderingIntent
);
BOOL
WcsGetUsePerUserProfiles(
__in LPCWSTR pDeviceName,
__in DWORD dwDeviceClass,
__out PBOOL pUsePerUserProfiles
);
BOOL
WcsSetUsePerUserProfiles(
__in LPCWSTR pDeviceName,
__in DWORD dwDeviceClass,
__in BOOL usePerUserProfiles
);
BOOL
WcsTranslateColors(
__in HTRANSFORM hColorTransform,
__in DWORD nColors,
__in DWORD nInputChannels,
__in COLORDATATYPE cdtInput,
__in DWORD cbInput,
__in_bcount(cbInput) PVOID pInputData,
__in DWORD nOutputChannels,
__in COLORDATATYPE cdtOutput,
__in DWORD cbOutput,
__out_bcount(cbOutput)PVOID pOutputData
);
BOOL
WCSCheckColors(
__in HTRANSFORM hColorTransform,
__in DWORD nColors,
__in DWORD nInputChannels,
__in COLORDATATYPE cdtInput,
__in DWORD cbInput,
__in_bcount(cbInput) PVOID pInputData,
__out_bcount(nColors)PBYTE pResult
);
HPROFILE WINAPI
WcsOpenColorProfileA(
__in PPROFILE pCDMPProfile,
__in_opt PPROFILE pCAMPProfile,
__in_opt PPROFILE pGMMPProfile,
__in DWORD dwDesireAccess,
__in DWORD dwShareMode,
__in DWORD dwCreationMode,
__in DWORD dwFlags
);
HPROFILE WINAPI
WcsOpenColorProfileW(
__in PPROFILE pCDMPProfile,
__in_opt PPROFILE pCAMPProfile,
__in_opt PPROFILE pGMMPProfile,
__in DWORD dwDesireAccess,
__in DWORD dwShareMode,
__in DWORD dwCreationMode,
__in DWORD dwFlags
);
HPROFILE
WcsCreateIccProfile(
__in HPROFILE hWcsProfile,
__in DWORD dwOptions
);
private:
HINSTANCE m_dllHandle;
//
// WCS API
//
CEncodedFuncPtr<WCSASSOCIATECOLORPROFILEWITHDEVICE> m_WcsAssociateColorProfileWithDevice;
CEncodedFuncPtr<WCSDISASSOCIATECOLORPROFILEFROMDEVICE> m_WcsDisassociateColorProfileFromDevice;
CEncodedFuncPtr<WCSENUMCOLORPROFILESSIZE> m_WcsEnumColorProfilesSize;
CEncodedFuncPtr<WCSGETDEFAULTCOLORPROFILESIZE> m_WcsGetDefaultColorProfileSize;
CEncodedFuncPtr<WCSGETDEFAULTCOLORPROFILE> m_WcsGetDefaultColorProfile;
CEncodedFuncPtr<WCSSETDEFAULTCOLORPROFILE> m_WcsSetDefaultColorProfile;
CEncodedFuncPtr<WCSSETDEFAULTRENDERINGINTENT> m_WcsSetDefaultRenderingIntent;
CEncodedFuncPtr<WCSGETUSEPERUSERPROFILES> m_WcsGetUsePerUserProfiles;
CEncodedFuncPtr<WCSSETUSEPERUSERPROFILES> m_WcsSetUsePerUserProfiles;
CEncodedFuncPtr<WCSTRANSLATECOLORS> m_WcsTranslateColors;
CEncodedFuncPtr<WCSCHECKCOLORS> m_WcsCheckColors;
CEncodedFuncPtr<WCSOPENCOLORPROFILE> m_WcsOpenColorProfileA;
CEncodedFuncPtr<WCSOPENCOLORPROFILE> m_WcsOpenColorProfileW;
CEncodedFuncPtr<WCSCREATEICCPROFILE> m_WcsCreateIccProfile;
};
| [
"thekcrazy@gmail.com"
] | thekcrazy@gmail.com |
b3032cbd06fed22c09d6ddf727a0a5dd28db54d2 | b290ec58c6c1be6dbb24f398f838abb94560430a | /TutorialsVSB/Viewer/demo8.h | 4ae11abe4dfd692085cb3a5d8340d59a83206891 | [] | no_license | PavelDrabek/VSB_PG2 | bc8c76bf3d274d7abe5a5386396a739caa57dfe1 | 31a7971f484c275cbe2af9cd712e5bbd01d40613 | refs/heads/master | 2021-01-13T06:55:51.257344 | 2017-04-30T20:48:56 | 2017-04-30T20:48:56 | 81,315,216 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 503 | h | #ifndef __DEMO8_H_
#define __DEMO8_H_
#include <sceneInitializer.h>
class Demo8 : public SceneInitializer
{
private:
void initShaders();
void initModels();
void initTextures();
void initMaterials();
void initVAOs();
void initInfoEntities();
void initSceneEntities();
GLuint createTexture(const char *resourceFileName, int wrap, int filter);
int texWidth = 200;
int texHeight = 200;
GLubyte* buffer;
public:
Demo8(SceneData *sdPtr) : SceneInitializer(sdPtr) {}
void render();
};
#endif | [
"dra0042@PCFEIB213LE.msad.vsb.cz"
] | dra0042@PCFEIB213LE.msad.vsb.cz |
803e4f45f9b96fcf88f6ee03ba9db51c9b82e3a4 | 28061e4783188a665bfa471f218a48d277f88c39 | /Source/csav/csav.cpp | 6543f51984d9b072fdb67426d7096b15444047c1 | [
"MIT"
] | permissive | SnakeSkinPlayer/CyberpunkSaveEditor | 79e74ea7e05cf3edf24031699d5c1a1dae0a362f | 34ef7e80fe6ecc3c881c2c72770b05e69e2b13ac | refs/heads/main | 2023-02-16T23:21:37.487454 | 2021-01-07T15:16:28 | 2021-01-07T15:16:28 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 10,555 | cpp | #include "csav.hpp"
#include <inttypes.h>
#include "serializers.hpp"
bool csav::load_stree(std::filesystem::path path)
{
uint32_t chunkdescs_start = 0;
uint32_t nodedescs_start = 0;
uint32_t magic = 0;
uint32_t i = 0;
std::vector<compressed_chunk_desc> chunk_descs;
std::vector<char>& nodedata = stree.nodedata;
filepath = path;
std::ifstream ifs;
ifs.open(path, ifs.in | ifs.binary);
if (ifs.fail())
{
std::string err = strerror(errno);
std::cerr << "Error: " << err;
return false;
}
// --------------------------------------------------------
// HEADER (magic, version..)
// --------------------------------------------------------
ifs >> cbytes_ref(magic);
if (magic != 'CSAV' && magic != 'SAVE')
return false;
ifs >> cbytes_ref(ver.v1);
ifs >> cbytes_ref(ver.v2);
// DISABLED VERSION TEST
//if (v1 > 193 or v2 > 9 or v1 < 125)
// return false;
ifs >> cp_plstring_ref(suk);
// there is a weird if v1 >= 5 check, but previous if already ensured it
ifs >> cbytes_ref(uk0);
ifs >> cbytes_ref(uk1);
if (ver.v1 <= 168 and ver.v2 == 4)
return false;
ver.v3 = 192;
if (ver.v1 >= 83)
{
ifs.read((char*)&ver.v3, 4);
if (ver.v3 > 195) // will change soon i guess
return false;
}
chunkdescs_start = (uint32_t)ifs.tellg();
// --------------------------------------------------------
// FOOTER (offset of 'NODE', 'DONE' tag)
// --------------------------------------------------------
// end stuff
ifs.seekg(-8, ifs.end);
uint64_t footer_start = (uint64_t)ifs.tellg();
ifs >> cbytes_ref(nodedescs_start);
ifs >> cbytes_ref(magic);
if (magic != 'DONE')
return false;
// --------------------------------------------------------
// NODE DESCRIPTORS
// --------------------------------------------------------
// check node start tag
ifs.seekg(nodedescs_start);
ifs >> cbytes_ref(magic);
if (magic != 'NODE')
return false;
// now read node descs
size_t nd_cnt = 0;
ifs >> cp_packedint_ref((int64_t&)nd_cnt);
stree.descs.resize(nd_cnt);
for (size_t i = 0; i < nd_cnt; ++i)
{
ifs >> stree.descs[i];
}
if ((size_t)ifs.tellg() != footer_start)
return false;
// --------------------------------------------------------
// COMPRESSED CHUNKS
// --------------------------------------------------------
// descriptors (padded with 0 until actual first chunk)
ifs.seekg(chunkdescs_start, ifs.beg);
ifs >> cbytes_ref(magic);
if (magic != 'CLZF')
return false;
uint32_t cd_cnt = 0;
ifs.read((char*)&cd_cnt, 4);
chunk_descs.resize(cd_cnt);
for (uint32_t i = 0; i < cd_cnt; ++i)
{
ifs >> chunk_descs[i];
}
// actual chunks
std::sort(chunk_descs.begin(), chunk_descs.end(),
[](auto& a, auto& b){return a.offset < b.offset; });
uint64_t nodedata_size = 0;
uint32_t chunks_start = 0;
if (chunk_descs.size())
{
chunks_start = chunk_descs[0].offset;
uint32_t data_offset = chunks_start; // that's how they do, minimal offset in file..
for (int i = 0; i < chunk_descs.size(); ++i)
{
auto& cd = chunk_descs[i];
cd.data_offset = data_offset;
data_offset += cd.data_size;
}
nodedata_size = data_offset;
}
// --------------------------------------------------------
// DECOMPRESSION from compressed chunks to nodedata
// --------------------------------------------------------
// we are not concerned by ram nor time, let's decompress the whole node
std::vector<char> tmp;
tmp.resize(XLZ4_CHUNK_SIZE);
nodedata.clear();
nodedata.resize(nodedata_size);
bool is_ps4 = false;
for (int i = 0; i < chunk_descs.size(); ++i)
{
auto& cd = chunk_descs[i];
ifs.seekg(cd.offset, ifs.beg);
ifs >> cbytes_ref(magic);
if (magic != 'XLZ4')
{
if (i > 0)
return false;
is_ps4 = true;
break;
}
uint32_t data_size = 0;
ifs >> cbytes_ref(data_size);
if (data_size != cd.data_size)
return false;
size_t csize = cd.size-8;
if (csize > tmp.size())
tmp.resize(csize);
ifs.read(tmp.data(), csize);
int res = LZ4_decompress_safe(tmp.data(), nodedata.data() + cd.data_offset, (int)csize, cd.data_size);
if (res != cd.data_size)
return false;
}
if (is_ps4)
{
size_t offset = chunk_descs[0].offset;
ifs.seekg(offset, ifs.beg);
ifs.read(nodedata.data() + offset, nodedata_size - offset);
}
if (ifs.fail())
return false;
ifs.close();
// --------------------------------------------------------
// UNFLATTENING of node tree
// --------------------------------------------------------
root_node = stree.to_node(chunks_start);
if (!root_node)
return false;
const uint32_t data_size = (uint32_t)nodedata.size() - chunks_start;
auto tree_size = root_node->calcsize();
if (tree_size != data_size) // check that the unflattening worked
return false;
return true;
}
bool csav::save_stree(std::filesystem::path path, bool dump_decompressed_data, bool ps4_weird_format)
{
if (!root_node)
return false;
uint32_t chunkdescs_start = 0;
uint32_t chunks_start = 0;
uint32_t nodedescs_start = 0;
uint32_t magic = 0;
uint32_t i = 0;
std::vector<compressed_chunk_desc> chunk_descs;
// make a backup (when there isn't one, oldest wins for safety reasons)
if (std::filesystem::exists(path))
{
std::filesystem::path oldpath = path;
oldpath.replace_extension(L".old");
if (!std::filesystem::exists(oldpath))
std::filesystem::copy(path, oldpath);
}
filepath = path;
std::ofstream ofs;
ofs.open(path, ofs.out | ofs.binary | ofs.trunc);
if (ofs.fail())
{
std::string err = strerror(errno);
std::cerr << "Error: " << err;
return false;
}
// --------------------------------------------------------
// HEADER (magic, version..)
// --------------------------------------------------------
magic = 'CSAV';
ofs << cbytes_ref(magic);
ofs << cbytes_ref(ver.v1);
ofs << cbytes_ref(ver.v2);
ofs << cp_plstring_ref(suk);
ofs << cbytes_ref(uk0);
ofs << cbytes_ref(uk1);
if (ver.v1 >= 83)
ofs << cbytes_ref(ver.v3);
// --------------------------------------------------------
// WEIRD PREP
// --------------------------------------------------------
chunkdescs_start = (uint32_t)ofs.tellp();
uint32_t expected_raw_size = (uint32_t)root_node->calcsize();
size_t max_chunkcnt = LZ4_compressBound(expected_raw_size) / XLZ4_CHUNK_SIZE + 2; // tbl should fit in 1 extra XLZ4_CHUNK_SIZE
size_t chunktbl_maxsize = max_chunkcnt * compressed_chunk_desc::serialized_size + 8;
std::vector<char> tmp;
tmp.resize(XLZ4_CHUNK_SIZE);
// allocate tbl
ofs.write(tmp.data(), std::max(chunktbl_maxsize, 0xC21 - (size_t)chunkdescs_start));
chunks_start = (uint32_t)ofs.tellp();
// --------------------------------------------------------
// FLATTENING of node tree
// --------------------------------------------------------
if (!stree.from_node(root_node, chunks_start))
return false;
// --------------------------------------------------------
// COMPRESSION from nodedata to compressed chunks
// --------------------------------------------------------
// chunks
char* const ptmp = tmp.data();
char* const prealbeg = stree.nodedata.data();
char* const pbeg = prealbeg + chunks_start; // compression starts at min_offset!
char* const pend = prealbeg + stree.nodedata.size();
char* pcur = pbeg;
i = 1;
while (pcur < pend)
{
auto& chunk_desc = chunk_descs.emplace_back();
chunk_desc.data_offset = (uint32_t)(pcur - prealbeg);
chunk_desc.offset = (uint32_t)ofs.tellp();
int srcsize = (int)(pend - pcur);
if (ps4_weird_format)
{
srcsize = std::min(srcsize, XLZ4_CHUNK_SIZE);
// write decompressed chunk
ofs.write(pcur, srcsize);
chunk_desc.size = srcsize;
}
else
{
int csize = LZ4_compress_destSize(pcur, ptmp, &srcsize, XLZ4_CHUNK_SIZE);
if (csize < 0)
return false;
// write magic
magic = 'XLZ4';
ofs << cbytes_ref(magic);
// write decompressed size
uint32_t data_size = 0;
ofs << cbytes_ref(srcsize);
// write compressed chunk
ofs.write(ptmp, csize);
chunk_desc.size = csize+8;
}
chunk_desc.data_size = srcsize;
pcur += srcsize;
}
if (pcur > pend)
return false;
nodedescs_start = (uint32_t)ofs.tellp();
// descriptors
ofs.seekp(chunkdescs_start);
magic = 'CLZF';
ofs << cbytes_ref(magic);
uint32_t cd_cnt = (uint32_t)chunk_descs.size();
ofs << cbytes_ref(cd_cnt);
for (uint32_t i = 0; i < cd_cnt; ++i)
{
ofs << chunk_descs[i];
}
// --------------------------------------------------------
// NODE DESCRIPTORS
// --------------------------------------------------------
ofs.seekp(nodedescs_start);
// experiment: would the game accept big forged file ?
// std::vector<char> zerobuf(0x1000000);
// ofs.write(zerobuf.data(), zerobuf.size());
// nodedescs_start = ofs.tellp();
magic = 'NODE';
ofs << cbytes_ref(magic);
// now write node descs
const uint32_t node_cnt = (uint32_t)stree.descs.size();
int64_t node_cnt_i64 = (int64_t)node_cnt;
ofs << cp_packedint_ref(node_cnt_i64);
for (uint32_t i = 0; i < node_cnt; ++i)
{
ofs << stree.descs[i];
}
// --------------------------------------------------------
// FOOTER (offset of 'NODE', 'DONE' tag)
// --------------------------------------------------------
// end stuff
ofs << cbytes_ref(nodedescs_start);
magic = 'DONE';
ofs << cbytes_ref(magic);
if (ofs.fail())
return false;
ofs.close();
// --------------------------------------------------------
// save decompressed blob (request)
// --------------------------------------------------------
if (dump_decompressed_data)
{
auto dump_path = path;
dump_path.replace_filename(L"decompressed_blob.bin");
ofs.open(dump_path, ofs.binary | ofs.trunc);
ofs.write(stree.nodedata.data(), stree.nodedata.size());
ofs.close();
}
return true;
}
| [
"thispawn@gmail.com"
] | thispawn@gmail.com |
7a14a28f9e76c4e9b82a1bdbbcdbfaa4c7d645e0 | da30b1e74459f6365653759b3ec1eab39ea5d8a1 | /Kattis/Thesaurus.cpp | 1c0287798d8c49d7692f5133f1f3f54d6dc38f3f | [] | no_license | Xue-Chenyang/Competitive-Programming | 9fe8776be9442a26a37c44e923f4d81750667bae | 3c94666dbac51d3f5d1b7b32cb8b283ee950f7bf | refs/heads/master | 2023-02-11T04:15:14.379426 | 2021-01-08T20:07:52 | 2021-01-08T20:07:52 | 319,704,322 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,340 | cpp | #include <bits/stdc++.h>
#define MAXN 10005
using namespace std;
typedef vector<vector<int>> vv;
unordered_map<string, int> rmp;
int sz = 0;
int d[MAXN], sm[MAXN];
bool vis[MAXN];
vector<string> wd;
vv adj;
void bfs(int src) {
queue<int> q;
vector<int> comp;
vis[src] = true;
int mlen = (int)(wd[src].length());
q.push(src);
while (!q.empty()) {
int u = q.front();
comp.push_back(u);
q.pop();
for (int &i : adj[u]) {
if (!vis[i]) {
vis[i] = true;
mlen = min(mlen, (int)(wd[i].size()));
q.push(i);
}
}
}
for (int &i : comp) sm[i] = mlen;
}
int main() {
int n,m; cin >> n >> m;
vector<string> v(n);
for (string &i : v) {
cin >> i;
if (!rmp.count(i)) rmp[i] = sz++, adj.emplace_back(), wd.push_back(i);
}
for (int i = 0; i < m; i++) {
string a,b; cin >> a >> b;
if (!rmp.count(a)) rmp[a] = sz++, adj.emplace_back(), wd.push_back(a);
if (!rmp.count(b)) rmp[b] = sz++, adj.emplace_back(), wd.push_back(b);
adj[rmp[a]].push_back(rmp[b]);
adj[rmp[b]].push_back(rmp[a]);
}
for (int i = 0; i < sz; i++) {
if (!vis[i]) bfs(i);
}
int ans = 0;
for (string &i : v) ans += sm[rmp[i]];
cout << ans;
} | [
"xue.chenyang@u.nus.edu"
] | xue.chenyang@u.nus.edu |
3c237c1f84dd83981262a4ab3bc62d4cdfa7af52 | cbbef8580d0571c84ab4ce5a559e0fb9d660f485 | /data/submissions/601426.cpp | 37df40a220363791fbfd95600a95e37c6cd257e3 | [] | no_license | yuantailing/tsinsen | efb4c0297e096b8fa64a3390d6bde3cbaaddb217 | a92759dc965ed58a33536e8c6faaa19b0931afbc | refs/heads/main | 2023-07-08T11:44:32.294152 | 2021-08-09T19:34:07 | 2021-08-09T19:34:07 | 394,414,206 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 332 | cpp | int findKth(int *s, int n, int K)
{
int p=n/2;
int l=0;
int r=n-1;
int t;
int sp=s[p];
do
{
while (s[l]<sp||(s[l]==sp&&l<p)) l++;
while (s[r]>sp||(s[r]==sp&&r>p)) r--;
t=s[r];
s[r]=s[l];
s[l]=t;
}while (l<r);
if (p==K-1) return s[p];
else if (p<K-1) return findKth(s+p,n-p,K-p);
else return findKth(s,n-p,K);
}
| [
"yuantailing@gmail.com"
] | yuantailing@gmail.com |
a3e9a08fecc675b89b67831004814ac75abd1d7d | 4f2174ffe63cbd3b4e8daca465e6c62c6a8fd9b8 | /Problem-105/Problem-105.cpp | 1a782ff352b4a432e05e4756313cee541244a741 | [] | no_license | DHRUV-EDDI/DailyCodingProblem | 5e680bcd4c00698e91d55955ecf087302214e3dc | 82410cb245f4d4d5a50bc02a939f1286ca6ceb6e | refs/heads/master | 2022-12-10T12:33:52.706714 | 2020-08-23T07:33:38 | 2020-08-23T07:33:38 | 260,503,585 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 387 | cpp | #include<bits/stdc++.h>
using namespace std;
using ll = long long;
int main()
{
string s;
getline(cin,s);
ll i,strt = 0;
for(i=0;i<s.length();i++)
{
if(s[i] == ' '){
reverse(s.begin()+strt,s.begin()+i);
strt = i+1;
}
}
reverse(s.begin()+strt,s.begin()+i);
reverse(s.begin(),s.end());
cout << s;
return 0;
} | [
"37928896+DHRUV-EDDI@users.noreply.github.com"
] | 37928896+DHRUV-EDDI@users.noreply.github.com |
351a38fc86a6422b1f6f078eb87c5f9b29589f3f | 772405dd6b80ce5dd8a5bd80f0c8e2289d5c75b9 | /TipPop/stdafx.cpp | 7b6f281b42739d0cace5276515817baa02cd9a44 | [] | no_license | osoft/tippop | 92c1b9fcd0e5d0388a0625174c4a009bd44f3bf3 | e04dd2910af15e0cb51a4834a98bc0a836191e72 | refs/heads/master | 2021-01-10T06:02:43.793701 | 2008-12-12T15:32:20 | 2008-12-12T15:32:20 | 45,257,933 | 0 | 0 | null | null | null | null | GB18030 | C++ | false | false | 264 | cpp | // stdafx.cpp : 只包括标准包含文件的源文件
// TipPop.pch 将作为预编译头
// stdafx.obj 将包含预编译类型信息
#include "stdafx.h"
// TODO: 在 STDAFX.H 中
// 引用任何所需的附加头文件,而不是在此文件中引用
| [
"xiuyuanshang@b34755a6-b97f-11dd-a503-ed2d4bea8bb5"
] | xiuyuanshang@b34755a6-b97f-11dd-a503-ed2d4bea8bb5 |
43d7dff58c616755704b1dc0bd0da7a1a13455fe | 4ef2b8547ef502a0fa8875ccaff5327fcb57632c | /src/perif.cpp | 215d672ef47aa5b7b6022331c846ac79b346e859 | [] | no_license | StarrLucky/TDA7439_CSR8645_NodeMCU_Preamplifier_Board | 558977085fb681b80860ccec45aaee72f96d9cb5 | b22df43ecb646c754e95c4bcd0e2a3202bec57f2 | refs/heads/master | 2022-12-25T12:15:57.258390 | 2020-09-29T15:03:41 | 2020-09-29T15:03:41 | 165,244,717 | 3 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,549 | cpp | #include <Arduino.h>
#include <perif.h>
PERIF::PERIF(){
EnableLed(1);
}
void PERIF::BlinkLed(int lednumber, int times, int delaybetween, int delayafter, int stateafter) // need interrupts for this ofc :/
{
for (int i = 1; i<times; i++)
{
switch (lednumber) {
case 1:
if (digitalRead(LED_PIN == HIGH)) { pinMode(LED_PIN, INPUT);} else {pinMode(LED_PIN, OUTPUT); digitalWrite(LED_PIN, HIGH);}
case 2:
if (digitalRead(LED_PIN == LOW)) { pinMode(LED_PIN, INPUT);} else {pinMode(LED_PIN, OUTPUT); digitalWrite(LED_PIN, LOW);}
}
delay(delaybetween);
}
switch (lednumber) {
case 1:
if (stateafter == 0) { pinMode(LED_PIN, INPUT);} else {pinMode(LED_PIN, OUTPUT); digitalWrite(LED_PIN, HIGH);}
case 2:
if (stateafter == 0) { pinMode(LED_PIN, INPUT);} else {pinMode(LED_PIN, OUTPUT); digitalWrite(LED_PIN, LOW);}
}
delay(delayafter);
}
void PERIF::EnableLed(int lednumber) {
pinMode(LED_PIN, OUTPUT);
switch (lednumber) {
case 1:
digitalWrite(LED_PIN, HIGH);
case 2:
digitalWrite(LED_PIN, LOW);
}
}
void PERIF::DisableLeds() {
pinMode(LED_PIN, INPUT);
}
void ChangeState(int lednumber) {
pinMode(LED_PIN, OUTPUT);
switch (lednumber) {
case 1:
if (digitalRead(LED_PIN == HIGH)) { pinMode(LED_PIN, INPUT);} else {pinMode(LED_PIN, OUTPUT); digitalWrite(LED_PIN, HIGH);}
case 2:
if (digitalRead(LED_PIN == LOW)) { pinMode(LED_PIN, INPUT);} else {pinMode(LED_PIN, OUTPUT); digitalWrite(LED_PIN, LOW);}
}
}
| [
"fxndstrs@gmail.com"
] | fxndstrs@gmail.com |
cb2e693e4731b1c5f9faa6c14ce8ee7161394950 | 02d37c19a3dfafdecc87f699c6488ec21f1aab66 | /src/fmtcavs/Primaries.cpp | 9ebc615da58ec5367e7d8033850e8cc511d61a71 | [
"WTFPL"
] | permissive | shssoichiro/fmtconv | c47f873653be255f22c494410fe3bc31d2cdac70 | 9a08254ee1065faa874e8c7426edfd460d82db2f | refs/heads/master | 2023-07-13T04:28:47.922363 | 2021-08-24T07:46:36 | 2021-08-24T07:46:36 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 6,595 | cpp | /*****************************************************************************
Primaries.cpp
Author: Laurent de Soras, 2021
--- Legal stuff ---
This program is free software. It comes without any warranty, to
the extent permitted by applicable law. You can redistribute it
and/or modify it under the terms of the Do What The Fuck You Want
To Public License, Version 2, as published by Sam Hocevar. See
http://www.wtfpl.net/ for more details.
*Tab=3***********************************************************************/
#if defined (_MSC_VER)
#pragma warning (1 : 4130 4223 4705 4706)
#pragma warning (4 : 4355 4786 4800)
#endif
/*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
#include "avsutl/CsPlane.h"
#include "fmtcavs/CpuOpt.h"
#include "fmtcavs/fnc.h"
#include "fmtcavs/function_names.h"
#include "fmtcavs/Primaries.h"
#include "fmtcl/fnc.h"
#include "fmtcl/PrimUtil.h"
#include "fstb/fnc.h"
#include <array>
#include <cassert>
namespace fmtcavs
{
/*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
Primaries::Primaries (::IScriptEnvironment &env, const ::AVSValue &args)
: Inherited (env, args [Param_CLIP_SRC].AsClip ())
, _clip_src_sptr (args [Param_CLIP_SRC].AsClip ())
, _vi_src (vi)
{
const CpuOpt cpu_opt (args [Param_CPUOPT]);
_sse_flag = cpu_opt.has_sse ();
_sse2_flag = cpu_opt.has_sse2 ();
_avx_flag = cpu_opt.has_avx ();
_avx2_flag = cpu_opt.has_avx2 ();
_proc_uptr = std::unique_ptr <fmtcl::MatrixProc> (new fmtcl::MatrixProc (
_sse_flag, _sse2_flag, _avx_flag, _avx2_flag
));
// Checks the input clip
const FmtAvs fmt_src (vi);
if (! fmt_src.is_planar ())
{
env.ThrowError (fmtcavs_PRIMARIES ": input must be planar.");
}
const auto col_fam = fmt_src.get_col_fam ();
if (col_fam != fmtcl::ColorFamily_RGB)
{
env.ThrowError (
fmtcavs_PRIMARIES ": colorspace must be RGB (assumed linear)."
);
}
const auto res = fmt_src.get_bitdepth ();
const bool flt_flag = fmt_src.is_float ();
if ( (! flt_flag && res != 16)
|| ( flt_flag && res != 32))
{
env.ThrowError (fmtcavs_PRIMARIES
": pixel bitdepth not supported, "
"clip must be 16-bit integer or 32-bit float."
);
}
assert (fmt_src.get_subspl_h () == 0 && fmt_src.get_subspl_v () == 0);
assert (fmt_src.get_nbr_comp_non_alpha () == _nbr_planes_proc);
// Destination format
const auto fmt_dst = fmt_src;
// Alpha plane processing, if any
_proc_alpha_uptr = std::make_unique <fmtcavs::ProcAlpha> (
fmt_dst, fmt_src, vi.width, vi.height, cpu_opt
);
// Primaries
init (_prim_s, env, args, Param_PRIMS);
init (_prim_s, env, args, Param_RS, Param_GS, Param_BS, Param_WS);
if (! _prim_s.is_ready ())
{
env.ThrowError (fmtcavs_PRIMARIES ": input primaries not set.");
}
_prim_d = _prim_s;
init (_prim_d, env, args, Param_PRIMD);
init (_prim_d, env, args, Param_RD, Param_GD, Param_BD, Param_WD);
assert (_prim_d.is_ready ());
const fmtcl::Mat3 mat_conv =
fmtcl::PrimUtil::compute_conversion_matrix (_prim_s, _prim_d);
_mat_main.insert3 (mat_conv);
_mat_main.clean3 (1);
prepare_matrix_coef (
env, *_proc_uptr, _mat_main,
fmt_dst, true,
fmt_src, true,
fmtcl::ColorSpaceH265_RGB, -1
);
}
::PVideoFrame __stdcall Primaries::GetFrame (int n, ::IScriptEnvironment *env_ptr)
{
::PVideoFrame src_sptr = _clip_src_sptr->GetFrame (n, env_ptr);
::PVideoFrame dst_sptr = build_new_frame (*env_ptr, vi, &src_sptr);
const auto pa { build_mat_proc (vi, dst_sptr, _vi_src, src_sptr) };
_proc_uptr->process (pa);
// Alpha plane now
_proc_alpha_uptr->process_plane (dst_sptr, src_sptr);
// Frame properties
if (supports_props ())
{
::AVSMap * props_ptr = env_ptr->getFramePropsRW (dst_sptr);
const fmtcl::PrimariesPreset preset_d = _prim_d._preset;
if (preset_d >= 0 && preset_d < fmtcl::PrimariesPreset_NBR_ELT)
{
env_ptr->propSetInt (
props_ptr, "_Primaries", int (preset_d), ::PROPAPPENDMODE_REPLACE
);
}
else
{
env_ptr->propDeleteKey (props_ptr, "_Primaries");
}
}
return dst_sptr;
}
/*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
/*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
constexpr int Primaries::_nbr_planes_proc;
void Primaries::init (fmtcl::RgbSystem &prim, ::IScriptEnvironment &env, const ::AVSValue &args, Param preset)
{
assert (preset >= 0);
assert (preset < Param_NBR_ELT);
std::string preset_str = args [preset].AsString ("");
fstb::conv_to_lower_case (preset_str);
prim._preset = fmtcl::PrimUtil::conv_string_to_primaries (preset_str);
if (prim._preset == fmtcl::PrimariesPreset_INVALID)
{
env.ThrowError (fmtcavs_PRIMARIES ": invalid preset name.");
}
else if (prim._preset >= 0)
{
prim.set (prim._preset);
}
}
void Primaries::init (fmtcl::RgbSystem &prim, ::IScriptEnvironment &env, const ::AVSValue &args, Param pr, Param pg, Param pb, Param pw)
{
assert (pr >= 0);
assert (pr < Param_NBR_ELT);
assert (pg >= 0);
assert (pg < Param_NBR_ELT);
assert (pb >= 0);
assert (pb < Param_NBR_ELT);
assert (pw >= 0);
assert (pw < Param_NBR_ELT);
const bool ready_old_flag = prim.is_ready ();
std::array <fmtcl::RgbSystem::Vec2, _nbr_planes_proc> rgb_old = prim._rgb;
fmtcl::RgbSystem::Vec2 w_old = prim._white;
const std::array <Param, _nbr_planes_proc> param_arr { pr, pg, pb };
for (int k = 0; k < _nbr_planes_proc; ++k)
{
prim._init_flag_arr [k] |=
read_coord_tuple (prim._rgb [k], env, args, param_arr [k]);
}
prim._init_flag_arr [_nbr_planes_proc] |=
read_coord_tuple (prim._white, env, args, pw);
if ( ready_old_flag && prim.is_ready ()
&& (rgb_old != prim._rgb || w_old != prim._white))
{
prim._preset = fmtcl::PrimariesPreset_UNDEF;
}
}
bool Primaries::read_coord_tuple (fmtcl::RgbSystem::Vec2 &c, ::IScriptEnvironment &env, const ::AVSValue &args, Param p)
{
bool set_flag = false;
auto c_v = extract_array_f (env, args [p], fmtcavs_PRIMARIES);
if (! c_v.empty ())
{
if (c_v.size () != c.size ())
{
env.ThrowError (fmtcavs_PRIMARIES
": wrong number of coordinates (expected x and y)."
);
}
double sum = 0;
for (size_t k = 0; k < c_v.size (); ++k)
{
sum += c_v [k];
c [k] = c_v [k];
}
if (c [1] == 0)
{
env.ThrowError (
fmtcavs_PRIMARIES ": y coordinate cannot be 0."
);
}
set_flag = true;
}
return set_flag;
}
} // namespace fmtcavs
/*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
| [
"fuck@fuck.fuck"
] | fuck@fuck.fuck |
8dc4f9c1c70436e39c0fab6f9479b0726ff8a602 | 0d0575fe8d138cdec19252604e8b2882d5174cc2 | /JFEngine/src/JF/Core/Log.cpp | c5f3a99293291402eef806cd3e1cbab28c17a329 | [] | no_license | WangYiTao0/JF | 1f132628251f3aad3f65ab13b5a353d7fa3e82f8 | 58680f4a29481f17e2ee2890a90fc95f8fb32b6b | refs/heads/master | 2022-12-27T15:04:57.897410 | 2020-07-19T13:07:43 | 2020-07-19T13:07:50 | 272,173,790 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,017 | cpp | #include "jfpch.h"
#include "JF/Core/Log.h"
#include <spdlog/sinks/stdout_color_sinks.h>
#include <spdlog/sinks/basic_file_sink.h>
namespace JF {
Ref<spdlog::logger> Log::s_CoreLogger;
Ref<spdlog::logger> Log::s_ClientLogger;
void Log::Init()
{
std::vector<spdlog::sink_ptr> logSinks;
logSinks.emplace_back(CreateRef<spdlog::sinks::stdout_color_sink_mt>());
logSinks.emplace_back(CreateRef<spdlog::sinks::basic_file_sink_mt>("JF.log", true));
logSinks[0]->set_pattern("%^[%T] %n: %v%$");
logSinks[1]->set_pattern("[%T] [%l] %n: %v");
s_CoreLogger = CreateRef<spdlog::logger>("JFEngine", begin(logSinks), end(logSinks));
spdlog::register_logger(s_CoreLogger);
s_CoreLogger->set_level(spdlog::level::trace);
s_CoreLogger->flush_on(spdlog::level::trace);
s_ClientLogger = CreateRef<spdlog::logger>("APP", begin(logSinks), end(logSinks));
spdlog::register_logger(s_ClientLogger);
s_ClientLogger->set_level(spdlog::level::trace);
s_ClientLogger->flush_on(spdlog::level::trace);
}
}
| [
"as5818956@gmail.com"
] | as5818956@gmail.com |
e4997f61e5cd62089fffe7213df25044b48a63af | 9be143a314f58bad3ca607e8c322415e6d05a30f | /doc/PedestrianOpenCV/code/PedestrianOpenCV.cpp | b1078caf05f1d45d9c8d9ab948abeab160843441 | [] | no_license | zibb03/Face-Emotion-Recognition | baec3b7d57636642641e52afd73f1ef5436a51d6 | fd5b04fc34fc8cfa9415ae7ab5fa85316c3be6d4 | refs/heads/main | 2023-06-18T15:49:40.905788 | 2021-07-19T15:05:00 | 2021-07-19T15:05:00 | 355,542,615 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 7,796 | cpp | ///////////////////////////////////////////////////////////////////////////
// OpenCV pedestrian detection examples.
// Written by darkpgmr (http://darkpgmr.tistory.com), 2013
#include "stdafx.h"
#include <iostream>
#include <windows.h>
#include "use_opencv.h"
using namespace std;
void detect_hog_inria(VideoCapture *vc);
void detect_hog_daimler(VideoCapture *vc);
void detect_hogcascades(VideoCapture *vc);
void detect_haarcascades(VideoCapture *vc);
int _tmain(int argc, _TCHAR* argv[])
{
//select image source
char data_src;
cout << " 1. camera input (640 x 480)\n"
<< " 2. camera input (320 x 240)\n"
<< " 3. video file input (*.avi)\n";
cout << "select video source[1-3]: ";
cin >> data_src;
VideoCapture *vc = NULL;
if(data_src=='1')
{
//camera (vga)
vc = new VideoCapture(0);
if (!vc->isOpened())
{
cout << "can't open camera" << endl;
return 0;
}
vc->set(CV_CAP_PROP_FRAME_WIDTH, 640);
vc->set(CV_CAP_PROP_FRAME_HEIGHT, 480);
}
else if(data_src=='2')
{
//camera (qvga)
vc = new VideoCapture(0);
if (!vc->isOpened())
{
cout << "can't open camera" << endl;
return 0;
}
vc->set(CV_CAP_PROP_FRAME_WIDTH, 320);
vc->set(CV_CAP_PROP_FRAME_HEIGHT, 240);
}
else if(data_src=='3')
{
char cur_path[255];
::GetCurrentDirectory(255, cur_path);
//video (avi)
OPENFILENAME ofn; // common dialog box structure
char szFile[MAX_PATH] = ""; // buffer for file name
ZeroMemory(&ofn, sizeof(OPENFILENAME));
ofn.lStructSize = sizeof(OPENFILENAME);
ofn.hwndOwner = NULL;
ofn.lpstrFile = szFile;
ofn.nMaxFile = sizeof(szFile);
ofn.lpstrFilter = _T("Avi Files(*.avi)\0*.avi\0All Files (*.*)\0*.*\0");
ofn.nFilterIndex = 1;
ofn.lpstrFileTitle = NULL;
ofn.nMaxFileTitle = 0;
ofn.lpstrInitialDir = NULL;
ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST;
if(::GetOpenFileName(&ofn)==false) return 0;
::SetCurrentDirectory(cur_path);
vc = new VideoCapture(ofn.lpstrFile);
if (!vc->isOpened())
{
cout << "can't open video file" << endl;
return 0;
}
}
else
return 0;
//select pedestrian detection method
char method;
cout << endl;
cout << " 1. HOG (INRIA)\n"
<< " 2. HOG (Daimler)\n"
<< " 3. hogcascades\n"
<< " 4. haarcascades\n";
cout << "select detection method[1-4]: ";
cin >> method;
if(vc)
{
if(method=='1') detect_hog_inria(vc);
if(method=='2') detect_hog_daimler(vc);
if(method=='3') detect_hogcascades(vc);
if(method=='4') detect_haarcascades(vc);
}
if(vc) delete vc;
destroyAllWindows();
return 0;
}
void detect_hog_inria(VideoCapture *vc)
{
// detector (64x128 template)
HOGDescriptor hog;
hog.setSVMDetector(HOGDescriptor::getDefaultPeopleDetector());
// parameters
double hit_thr = 0;
double gr_thr = 2;
Mat frame;
__int64 freq,start,finish;
::QueryPerformanceFrequency((_LARGE_INTEGER*)&freq);
while(1)
{
// input image
*vc >> frame;
if(frame.empty()) break;
::QueryPerformanceCounter((_LARGE_INTEGER*)&start);
// detect
vector<Rect> found;
hog.detectMultiScale(frame, found, hit_thr, Size(8,8), Size(32,32), 1.05, gr_thr);
// processing time (fps)
::QueryPerformanceCounter((_LARGE_INTEGER*)&finish);
double fps = freq / double(finish - start + 1);
char fps_str[20];
sprintf_s(fps_str, 20, "FPS: %.1lf", fps);
putText(frame, fps_str, Point(5, 35), FONT_HERSHEY_SIMPLEX, 1., Scalar(0,255,0), 2);
// draw results (bounding boxes)
for(int i=0; i<(int)found.size(); i++)
rectangle(frame, found[i], Scalar(0,255,0), 2);
// display
imshow("darkpgmr", frame);
char ch = waitKey(10);
if( ch == 27 ) break; // ESC Key
else if(ch == 32 ) // SPACE Key
{
while((ch = waitKey(10)) != 32 && ch != 27);
if(ch == 27) break;
}
}
}
void detect_hog_daimler(VideoCapture *vc)
{
// detector (48x96 template)
HOGDescriptor hog(Size(48,96), Size(16,16), Size(8,8), Size(8,8), 9);
hog.setSVMDetector(HOGDescriptor::getDaimlerPeopleDetector());
// parameters
double hit_thr = 1.2;
double gr_thr = 6;
// run
Mat frame;
__int64 freq,start,finish;
::QueryPerformanceFrequency((_LARGE_INTEGER*)&freq);
while(1)
{
// input image
*vc >> frame;
if(frame.empty()) break;
::QueryPerformanceCounter((_LARGE_INTEGER*)&start);
// detect
vector<Rect> found;
hog.detectMultiScale(frame, found, hit_thr, Size(8,8), Size(32,32), 1.05, gr_thr);
// processing time (fps)
::QueryPerformanceCounter((_LARGE_INTEGER*)&finish);
double fps = freq / double(finish - start + 1);
char fps_str[20];
sprintf_s(fps_str, 20, "FPS: %.1lf", fps);
putText(frame, fps_str, Point(5, 35), FONT_HERSHEY_SIMPLEX, 1., Scalar(0,255,0), 2);
// draw results (bounding boxes)
for(int i=0; i<(int)found.size(); i++)
rectangle(frame, found[i], Scalar(0,255,0), 2);
// display
imshow("darkpgmr", frame);
char ch = waitKey(10);
if( ch == 27 ) break; // ESC Key
else if(ch == 32 ) // SPACE Key
{
while((ch = waitKey(10)) != 32 && ch != 27);
if(ch == 27) break;
}
}
}
void detect_hogcascades(VideoCapture *vc)
{
// detector (48x96 template)
string cascadeName = "hogcascade_pedestrians.xml";
CascadeClassifier detector;
if( !detector.load( cascadeName ) )
{
cerr << "ERROR: Could not load classifier cascade" << endl;
return;
}
// parameters
int gr_thr = 6;
double scale_step = 1.1;
Size min_obj_sz(48,96);
Size max_obj_sz(100,200);
// run
Mat frame;
__int64 freq,start,finish;
::QueryPerformanceFrequency((_LARGE_INTEGER*)&freq);
while(1)
{
// input image
*vc >> frame;
if(frame.empty()) break;
::QueryPerformanceCounter((_LARGE_INTEGER*)&start);
// detect
vector<Rect> found;
detector.detectMultiScale(frame, found, scale_step, gr_thr, 0, min_obj_sz, max_obj_sz);
// processing time (fps)
::QueryPerformanceCounter((_LARGE_INTEGER*)&finish);
double fps = freq / double(finish - start + 1);
char fps_str[20];
sprintf_s(fps_str, 20, "FPS: %.1lf", fps);
putText(frame, fps_str, Point(5, 35), FONT_HERSHEY_SIMPLEX, 1., Scalar(0,255,0), 2);
// draw results (bounding boxes)
for(int i=0; i<(int)found.size(); i++)
rectangle(frame, found[i], Scalar(0,255,0), 2);
// display
imshow("darkpgmr", frame);
char ch = waitKey(10);
if( ch == 27 ) break; // ESC Key
else if(ch == 32 ) // SPACE Key
{
while((ch = waitKey(10)) != 32 && ch != 27);
if(ch == 27) break;
}
}
}
void detect_haarcascades(VideoCapture *vc)
{
// detector (14x28 template)
string cascadeName = "haarcascade_fullbody.xml";
CascadeClassifier detector;
if( !detector.load( cascadeName ) )
{
cerr << "ERROR: Could not load classifier cascade" << endl;
return;
}
// parameters
int gr_thr = 4;
double scale_step = 1.1;
Size min_obj_sz(48,96);
Size max_obj_sz(100,200);
// run
Mat frame;
__int64 freq,start,finish;
::QueryPerformanceFrequency((_LARGE_INTEGER*)&freq);
while(1)
{
// input image
*vc >> frame;
if(frame.empty()) break;
::QueryPerformanceCounter((_LARGE_INTEGER*)&start);
// detect
vector<Rect> found;
detector.detectMultiScale(frame, found, scale_step, gr_thr, 0, min_obj_sz, max_obj_sz);
// processing time (fps)
::QueryPerformanceCounter((_LARGE_INTEGER*)&finish);
double fps = freq / double(finish - start + 1);
char fps_str[20];
sprintf_s(fps_str, 20, "FPS: %.1lf", fps);
putText(frame, fps_str, Point(5, 35), FONT_HERSHEY_SIMPLEX, 1., Scalar(0,255,0), 2);
// draw results (bounding boxes)
for(int i=0; i<(int)found.size(); i++)
rectangle(frame, found[i], Scalar(0,255,0), 2);
// display
imshow("darkpgmr", frame);
char ch = waitKey(10);
if( ch == 27 ) break; // ESC Key
else if(ch == 32 ) // SPACE Key
{
while((ch = waitKey(10)) != 32 && ch != 27);
if(ch == 27) break;
}
}
}
| [
"64014435+zibb03@users.noreply.github.com"
] | 64014435+zibb03@users.noreply.github.com |
1ae7665633e0be6d09f1bbec37deeb7fc929e38d | f7a4e2b350b0ed7901682a13e42995773e41fb92 | /ceng334/hw2/monitor.h | 481e0087352293cc3f88adbdd7d1eb8b2e5ef3ed | [] | no_license | yalpul/ceng | b670547d07fa4869b6711c88d4907267ec5fc687 | 86269f8eda8c9f45b70ffb4b4684df7637045575 | refs/heads/master | 2021-07-09T07:25:53.855170 | 2020-07-25T19:47:26 | 2020-07-25T19:47:26 | 157,917,310 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,437 | h | #ifndef __MONITOR_H
#define __MONITOR_H
#include<pthread.h>
//! A base class to help deriving monitor like classes
class Monitor {
pthread_mutex_t mut; // this will protect the monitor
public:
Monitor() {
pthread_mutex_init(&mut, NULL);
}
class Condition {
Monitor *owner;
pthread_cond_t cond;
public:
Condition(Monitor *o) { // we need monitor ptr to access the mutex
owner = o;
pthread_cond_init(&cond, NULL) ;
}
~Condition() {
pthread_cond_destroy(&cond);
}
void wait() { pthread_cond_wait(&cond, &owner->mut);}
void timedwait(int micro) {
struct timespec ts;
clock_gettime(CLOCK_REALTIME, &ts);
ts.tv_nsec += micro*1000;
ts.tv_sec += ts.tv_nsec / 1000000000;
ts.tv_nsec %= 1000000000;
pthread_cond_timedwait(&cond, &owner->mut, &ts);
};
void notify() { pthread_cond_signal(&cond);}
void notifyAll() { pthread_cond_broadcast(&cond);}
};
class Lock {
Monitor *owner;
public:
Lock(Monitor *o) { // we need monitor ptr to access the mutex
owner = o;
pthread_mutex_lock(&owner->mut); // lock on creation
}
~Lock() {
pthread_mutex_unlock(&owner->mut); // unlock on destruct
}
void lock() { pthread_mutex_lock(&owner->mut);}
void unlock() { pthread_mutex_unlock(&owner->mut);}
};
};
// when following is used as a local variable the
// method becomes a monitor method. On constructor
// lock is acquired, when function returns, automatically
// called desctructor unlocks it
#define __synchronized__ Lock mutex(this);
/* USAGE:
class A: public Monitor { // inherit from Monitor
Condition cv1, cv2; // condition varibles
...
public:
A() : cv1(this), cv2(this) { // pass "this" to cv constructors
...
}
void method1() {
__synchronized__;
// implement your monitor method. lock is already acquired
// thanks to macro call above.
while ( ...) { // I need to wait for an event
cv1.wait();
}
...
cv2.notify();
} // no need to unlock here, destructor of macro variable does it
void method2() {
__synchronized__;
// method1() // !!!! you should not do that.
}
};
*/
#endif
| [
"yalpul@gmail.com"
] | yalpul@gmail.com |
22a2c35a7365c5053d4e61db1637c6d7f85a7e01 | bf0b1aaf30159bfb1a1795b0969c7f9ae66cbab4 | /CXX/inline/A.h | 50dbef8ba56fe7c7b995bc4ece9e4492b4f33e92 | [] | no_license | raytroop/CodeSnippt | a078c21c8a460c9271c4daa809483675d8c56b97 | f7a6a1d0bc07584322058c88a97a4e9c2eb2a87a | refs/heads/master | 2018-09-19T13:49:36.517733 | 2018-09-03T13:15:33 | 2018-09-03T13:15:33 | 119,517,815 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 99 | h | // A.h
class A
{
private:
int a;
int b;
public:
A(int aa, int bb):a(aa), b(bb){}
int max();
}; | [
"raytroop@gmail.com"
] | raytroop@gmail.com |
9d550428aded44b66c688d244ce2230b15f6c5b9 | 1a70a4271632ba87d3d0bb5ca007ceaf25b694e5 | /TestProjOpenGl/Display.cpp | da6e8997638229b379d2576c1573bc086f630e5b | [] | no_license | HagglundJonatan/TestProjOpenGL | 17f6201a68c1bb6f2f123e23723babc94335790e | ddf9cc6565ae51e4fc43d63bc2fb39006d56c5f9 | refs/heads/master | 2020-03-21T23:41:09.617659 | 2018-06-29T22:23:31 | 2018-06-29T22:23:31 | 139,201,442 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,183 | cpp | #include "stdafx.h"
#include "Display.h"
#include "GL/glew.h"
#include <iostream>
Display::Display(int width, int height, const std::string& title)
{
SDL_Init(SDL_INIT_EVERYTHING);
SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 8);
SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 8);
SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 8);
SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE, 8);
SDL_GL_SetAttribute(SDL_GL_BUFFER_SIZE, 8);
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 8);
m_window = SDL_CreateWindow(title.c_str(), SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, width, height, SDL_WINDOW_OPENGL);
m_glContext = SDL_GL_CreateContext(m_window);
GLenum status = glewInit();
if (status != GLEW_OK)
{
std::cerr << "Glew failed to initialize!" << std::endl;
}
}
Display::~Display()
{
SDL_GL_DeleteContext(m_glContext);
SDL_DestroyWindow(m_window);
SDL_Quit();
}
void Display::update()
{
SDL_GL_SwapWindow(m_window);
SDL_Event e;
while (SDL_PollEvent(&e))
{
if (e.type == SDL_QUIT)
{
m_isClosed = true;
}
}
}
void Display::clear(float r, float g, float b, float a)
{
glClearColor(r, r, b, a);
glClear(GL_COLOR_BUFFER_BIT);
}
bool Display::isClosed()
{
return m_isClosed;
}
| [
"hagglund.jonatan@gmail.com"
] | hagglund.jonatan@gmail.com |
9e56e407aabc9aef96ec5d440db5bbe91b9e91db | 45a26f28a29ab6dd9d3bcf315117d814f50808b1 | /src/AppleOnboardAudio/AppleOnboardAudio-200.2.26/AppleOnboardAudio/K2Platform.h | b24ed5640cb80b849e9a9cc505e4e1a7167dd582 | [] | no_license | zeborrego/opensource.apple.com | 0eb9161029ce8440dbdc4b5157b3927a6e381f8d | 88cbaab4a42e97cbbfe6b660f2f0945536821be6 | refs/heads/master | 2021-07-06T17:16:28.241638 | 2017-10-02T11:58:56 | 2017-10-02T11:58:56 | null | 0 | 0 | null | null | null | null | WINDOWS-1252 | C++ | false | false | 18,750 | h | /*
* K2Platform.h
*
*
* Created by Aram Lindahl on Mon Mar 10 2003.
* Copyright (c) 2003 AppleComputer. All rights reserved.
*
*/
#include "PlatformInterface.h"
#include "AudioHardwareCommon.h"
#include "AppleOnboardAudioUserClient.h"
#include <IOKit/i2c/PPCI2CInterface.h>
#include <IOKit/IOInterruptEventSource.h>
#include <IOKit/IOFilterInterruptEventSource.h>
#include <IOKit/IOWorkLoop.h>
#include <IOKit/IORegistryEntry.h>
#include <IOKit/IOCommandGate.h>
#include <IOKit/ppc/IODBDMA.h>
#ifndef _APPLEI2S_H
#define _APPLEI2S_H
#include <IOKit/IOService.h>
//#define kBUILD_FOR_DIRECT_I2SCellEnable_HW_ACCESS /* WORKS */
//#define kBUILD_FOR_DIRECT_I2SEnable_HW_ACCESS /* WORKS */
//#define kBUILD_FOR_DIRECT_I2SClockEnable_HW_ACCESS /* TESTING - NOT WORKING */
//#define kBUILD_FOR_DIRECT_I2SswReset_HW_ACCESS /* WORKS */
//#define kBUILD_FOR_DIRECT_GPIO_HW_ACCESS /* WORKS */
//#define kBUILD_FOR_DIRECT_I2S_HW_ACCESS /* WORKS */
#ifdef DLOG
#undef DLOG
#endif
// Uncomment to enable debug output
//#define APPLEI2S_DEBUG 1
#ifdef APPLEI2S_DEBUG
#define DLOG(fmt, args...) kprintf(fmt, ## args)
#else
#define DLOG(fmt, args...)
#endif
class AppleI2S : public IOService
{
OSDeclareDefaultStructors(AppleI2S)
private:
// key largo gives us register access
IOService *keyLargoDrv;
// i2s register space offset relative to key largo base address
UInt32 i2sBaseAddress;
// child publishing methods
void publishBelow(IOService *provider);
public:
virtual bool init(OSDictionary *dict);
virtual void free(void);
virtual IOService *probe(IOService *provider, SInt32 *score);
virtual bool start(IOService *provider);
virtual void stop(IOService *provider);
// AppleI2S reads and writes are services through the callPlatformFunction
virtual IOReturn callPlatformFunction( const char *functionName,
bool waitForFunction,
void *param1, void *param2,
void *param3, void *param4 );
virtual IOReturn callPlatformFunction( const OSSymbol *functionName,
bool waitForFunction,
void *param1, void *param2,
void *param3, void *param4 );
};
/* --- this is the i2s device nub class that i2s-a or i2s-b drivers attach to --- */
//class AppleI2SDevice : public IOService
//{
// OSDeclareDefaultStructors(AppleI2SDevice)
// virtual bool compareName(OSString *name, OSString **matched) const;
//
//};
// callPlatformFunction symbols to access key largo or K2 registers
#define kSafeWriteRegUInt32 "keyLargo_safeWriteRegUInt32"
#define kSafeReadRegUInt32 "keyLargo_safeReadRegUInt32"
// K2 register write is always passed noMask for mask value
#define noMask 0xFFFFFFFF
// callPlatformFunction symbols for AppleI2S
#define kI2SGetIntCtlReg "I2SGetIntCtlReg"
#define kI2SSetIntCtlReg "I2SSetIntCtlReg"
#define kI2SGetSerialFormatReg "I2SGetSerialFormatReg"
#define kI2SSetSerialFormatReg "I2SSetSerialFormatReg"
#define kI2SGetCodecMsgOutReg "I2SGetCodecMsgOutReg"
#define kI2SSetCodecMsgOutReg "I2SSetCodecMsgOutReg"
#define kI2SGetCodecMsgInReg "I2SGetCodecMsgInReg"
#define kI2SSetCodecMsgInReg "I2SSetCodecMsgInReg"
#define kI2SGetFrameCountReg "I2SGetFrameCountReg"
#define kI2SSetFrameCountReg "I2SSetFrameCountReg"
#define kI2SGetFrameMatchReg "I2SGetFrameMatchReg"
#define kI2SSetFrameMatchReg "I2SSetFrameMatchReg"
#define kI2SGetDataWordSizesReg "I2SGetDataWordSizesReg"
#define kI2SSetDataWordSizesReg "I2SSetDataWordSizesReg"
#define kI2SGetPeakLevelSelReg "I2SGetPeakLevelSelReg"
#define kI2SSetPeakLevelSelReg "I2SSetPeakLevelSelReg"
#define kI2SGetPeakLevelIn0Reg "I2SGetPeakLevelIn0Reg"
#define kI2SSetPeakLevelIn0Reg "I2SSetPeakLevelIn0Reg"
#define kI2SGetPeakLevelIn1Reg "I2SGetPeakLevelIn1Reg"
#define kI2SSetPeakLevelIn1Reg "I2SSetPeakLevelIn1Reg"
// I2S Register offsets within keyLargo or K2
#define kI2SIntCtlOffset 0x0000
#define kI2SSerialFormatOffset 0x0010
#define kI2SCodecMsgOutOffset 0x0020
#define kI2SCodecMsgInOffset 0x0030
#define kI2SFrameCountOffset 0x0040
#define kI2SFrameMatchOffset 0x0050
#define kI2SDataWordSizesOffset 0x0060
#define kI2SPeakLevelSelOffset 0x0070
#define kI2SPeakLevelIn0Offset 0x0080
#define kI2SPeakLevelIn1Offset 0x0090
// The following is actually read from the "reg" property in the tree.
#define kI2SBaseOffset 0x10000
#define kIOPFInterruptRegister "IOPFInterruptRegister"
#define kIOPFInterruptUnRegister "IOPFInterruptUnRegister"
#define kIOPFInterruptEnable "IOPFInterruptEnable"
#define kIOPFInterruptDisable "IOPFInterruptDisable"
#endif /* ! _APPLEI2S_H */
#ifndef __K2_PLATFORM
#define __K2_PLATFORM
#define kIODMAInputOffset 0x00000100 /* offset from I2S 0 Tx DMA channel registers to Rx DMA channel registers */
#define kGPIO_DATA_WR_PIN_LEVEL_H 0x07
#define kGPIO_DATA_WR_PIN_LEVEL_L 0x04
#define kAUDIO_MAC_IO_BASE_ADDRESS 0x80000000
#define kAUDIO_MAC_IO_SIZE 256
#define kAUDIO_I2S_BASE_ADDRESS 0x80010000
#define kAUDIO_I2S_SIZE 4096
#define kAUDIO_MAC_IO_FCR1 0x0000003C
#define kAUDIO_MAC_IO_FCR3 0x00000044
#define kAUDIO_I2S_SERIAL_FORMAT 0x00000010
#define kAUDIO_I2S_INTERRUPT_CONTROL 0x00000000
#define kAUDIO_I2S_DATA_WORD_SIZES 0x00000060
#define kAUDIO_I2S_FRAME_COUNTER 0x00000040
#define kAUDIO_GPIO_INPUT_DATA_MUX_SELECT 0x0000005B
#define kAUDIO_GPIO_LINE_IN_SENSE 0x0000005C
#define kAUDIO_GPIO_CODEC_ERROR_IRQ 0x0000005D
#define kAUDIO_GPIO_DIGITAL_CODEC_RESET 0x00000064
#define kAUDIO_GPIO_LINE_OUT_SENSE 0x00000066
#define kAUDIO_GPIO_HEADPHONE_SENSE 0x00000067
#define kAUDIO_GPIO_CODEC_IRQ 0x00000068
#define kAUDIO_GPIO_HEADPHONE_MUTE 0x0000006F
#define kAUDIO_GPIO_AMPLIFIER_MUTE 0x00000070
#define kAUDIO_GPIO_ANALOG_CODEC_RESET 0x00000074
#define kAUDIO_GPIO_LINE_OUT_MUTE 0x00000075
#define kAUDIO_GPIO_CLOCK_MUX_SELECT 0x00000076
typedef enum {
kK2I2SClockSource_45MHz = 0, // compatible with K2 driver
kK2I2SClockSource_49MHz = 1, // compatible with K2 driver
kK2I2SClockSource_18MHz = 2 // compatible with K2 driver
} K2I2SClockSource;
class K2Platform : public PlatformInterface {
OSDeclareDefaultStructors(K2Platform);
public:
virtual bool init (IOService* device, AppleOnboardAudio* provider, UInt32 inDBDMADeviceIndex);
virtual void free();
//
// Codec Methods
//
virtual bool readCodecRegister(UInt8 address, UInt8 subAddress, UInt8 *data, UInt16 len, BusMode mode);
virtual bool writeCodecRegister(UInt8 address, UInt8 subAddress, UInt8 *data, UInt16 len, BusMode mode);
virtual IOReturn setCodecReset ( CODEC_RESET target, GpioAttributes reset );
virtual GpioAttributes getCodecReset ( CODEC_RESET target );
//
// I2S Methods: FCR3
//
virtual IOReturn requestI2SClockSource(I2SClockFrequency inFrequency);
virtual IOReturn releaseI2SClockSource(I2SClockFrequency inFrequency);
//
// I2S Methods: FCR1
//
virtual IOReturn setI2SEnable(bool enable);
virtual bool getI2SEnable();
virtual IOReturn setI2SClockEnable(bool enable);
virtual bool getI2SClockEnable();
virtual IOReturn setI2SCellEnable(bool enable);
virtual bool getI2SCellEnable();
virtual IOReturn setI2SSWReset(bool enable);
virtual bool getI2SSWReset();
//
// I2S Methods: IOM Control
//
virtual IOReturn setSerialFormatRegister(UInt32 serialFormat);
virtual UInt32 getSerialFormatRegister();
virtual IOReturn setDataWordSizes(UInt32 dataWordSizes);
virtual UInt32 getDataWordSizes();
virtual IOReturn setFrameCount(UInt32 value);
virtual UInt32 getFrameCount();
virtual IOReturn setI2SIOMIntControl(UInt32 intCntrl);
virtual UInt32 getI2SIOMIntControl();
//
// GPIO Methods
//
virtual GpioAttributes getComboInJackTypeConnected();
virtual GpioAttributes getComboOutJackTypeConnected();
virtual GpioAttributes getDigitalInConnected();
virtual GpioAttributes getDigitalOutConnected();
virtual GpioAttributes getLineInConnected();
virtual GpioAttributes getLineOutConnected();
virtual GpioAttributes getHeadphoneConnected();
virtual GpioAttributes getSpeakerConnected();
virtual GpioAttributes getCodecInterrupt();
virtual GpioAttributes getCodecErrorInterrupt();
virtual IOReturn setHeadphoneMuteState(GpioAttributes muteState);
virtual GpioAttributes getHeadphoneMuteState();
virtual IOReturn setInputDataMux(GpioAttributes muxState);
virtual GpioAttributes getInputDataMux();
virtual IOReturn setLineOutMuteState(GpioAttributes muteState);
virtual GpioAttributes getLineOutMuteState();
virtual IOReturn setSpeakerMuteState(GpioAttributes muteState);
virtual GpioAttributes getSpeakerMuteState();
virtual IOReturn setClockMux(GpioAttributes muxState);
virtual GpioAttributes getClockMux();
// virtual bool getInternalSpeakerID();
//
// Set Interrupt Handler Methods
//
virtual IOReturn disableInterrupt ( PlatformInterruptSource source );
virtual IOReturn enableInterrupt ( PlatformInterruptSource source );
virtual IOReturn registerInterruptHandler (IOService * theDevice, void * interruptHandler, PlatformInterruptSource source );
virtual IOReturn unregisterInterruptHandler (IOService * theDevice, void * interruptHandler, PlatformInterruptSource source );
inline const OSSymbol* makeFunctionSymbolName(const char * name,UInt32 pHandle);
//
// DBDMA Memory Address Acquisition Methods
//
virtual IODBDMAChannelRegisters * GetInputChannelRegistersVirtualAddress ( IOService * dbdmaProvider );
virtual IODBDMAChannelRegisters * GetOutputChannelRegistersVirtualAddress ( IOService * dbdmaProvider );
virtual void LogDBDMAChannelRegisters ( void );
//
// User Client Support
//
virtual IOReturn getPlatformState ( PlatformStateStructPtr outState );
virtual IOReturn setPlatformState ( PlatformStateStructPtr inState );
private:
IOService * mK2Service;
UInt32 mI2SCell;
IORegistryEntry *mI2S;
UInt32 mI2SPHandle;
UInt32 mI2SOffset;
UInt32 mMacIOPHandle;
UInt32 mMacIOOffset;
IODBDMAChannelRegisters * mIOBaseDMAInput;
IODBDMAChannelRegisters * mIOBaseDMAOutput;
static const char * kAppleK2pHandle;
static const char * kAppleI2S0pHandle;
static const char * kAppleGPIOpHandle;
static const char * kAppleI2S_Enable;
static const char * kAppleI2S_Disable;
static const char * kAppleI2S_ClockEnable;
static const char * kAppleI2S_ClockDisable;
static const char * kAppleI2S_Reset;
static const char * kAppleI2S_Run;
static const char * kAppleI2S_CellEnable;
static const char * kAppleI2S_CellDisable;
static const char * kAppleI2S_GetEnable;
static const char * kAppleI2S_GetClockEnable;
static const char * kAppleI2S_GetReset;
static const char * kAppleI2S_GetCellEnable;
static const char * kAppleI2S_SetIntCtrl;
static const char * kAppleI2S_SetSerialFormat;
static const char * kAppleI2S_SetCodecMessageOut;
static const char * kAppleI2S_SetCodecMessageIn;
static const char * kAppleI2S_SetFrameCount;
static const char * kAppleI2S_SetFrameCountToMatch;
static const char * kAppleI2S_SetDataWordSizes;
static const char * kAppleI2S_SetPeakLevelSFSelect;
static const char * kAppleI2S_SetPeakLevelIn0;
static const char * kAppleI2S_SetPeakLevelIn1;
static const char * kAppleI2S_GetIntCtrl;
static const char * kAppleI2S_GetSerialFormat;
static const char * kAppleI2S_GetCodecMessageOut;
static const char * kAppleI2S_GetCodecMessageIn;
static const char * kAppleI2S_GetFrameCount;
static const char * kAppleI2S_GetFrameCountToMatch;
static const char * kAppleI2S_GetDataWordSizes;
static const char * kAppleI2S_GetPeakLevelSFSelect;
static const char * kAppleI2S_GetPeakLevelIn0;
static const char * kAppleI2S_GetPeakLevelIn1;
// ¥ GPIO
static const char * kAppleGPIO_DisableSpeakerDetect;
static const char * kAppleGPIO_EnableSpeakerDetect;
static const char * kAppleGPIO_GetSpeakerDetect;
static const char * kAppleGPIO_RegisterSpeakerDetect;
static const char * kAppleGPIO_UnregisterSpeakerDetect;
static const char * kAppleGPIO_DisableDigitalInDetect;
static const char * kAppleGPIO_EnableDigitalInDetect;
static const char * kAppleGPIO_GetDigitalInDetect;
static const char * kAppleGPIO_RegisterDigitalInDetect;
static const char * kAppleGPIO_UnregisterDigitalInDetect;
static const char * kAppleGPIO_GetComboInJackType;
static const char * kAppleGPIO_GetComboOutJackType;
static const char * kAppleGPIO_DisableDigitalOutDetect;
static const char * kAppleGPIO_EnableDigitalOutDetect;
static const char * kAppleGPIO_GetDigitalOutDetect;
static const char * kAppleGPIO_RegisterDigitalOutDetect;
static const char * kAppleGPIO_UnregisterDigitalOutDetect;
static const char * kAppleGPIO_DisableLineInDetect;
static const char * kAppleGPIO_EnableLineInDetect;
static const char * kAppleGPIO_GetLineInDetect;
static const char * kAppleGPIO_RegisterLineInDetect;
static const char * kAppleGPIO_UnregisterLineInDetect;
static const char * kAppleGPIO_DisableLineOutDetect;
static const char * kAppleGPIO_EnableLineOutDetect;
static const char * kAppleGPIO_GetLineOutDetect;
static const char * kAppleGPIO_RegisterLineOutDetect;
static const char * kAppleGPIO_UnregisterLineOutDetect;
static const char * kAppleGPIO_DisableHeadphoneDetect;
static const char * kAppleGPIO_EnableHeadphoneDetect;
static const char * kAppleGPIO_GetHeadphoneDetect;
static const char * kAppleGPIO_RegisterHeadphoneDetect;
static const char * kAppleGPIO_UnregisterHeadphoneDetect;
static const char * kAppleGPIO_SetHeadphoneMute;
static const char * kAppleGPIO_GetHeadphoneMute;
static const char * kAppleGPIO_SetAmpMute;
static const char * kAppleGPIO_GetAmpMute;
static const char * kAppleGPIO_SetAudioHwReset;
static const char * kAppleGPIO_GetAudioHwReset;
static const char * kAppleGPIO_SetAudioDigHwReset;
static const char * kAppleGPIO_GetAudioDigHwReset;
static const char * kAppleGPIO_SetLineOutMute;
static const char * kAppleGPIO_GetLineOutMute;
static const char * kAppleGPIO_DisableCodecIRQ;
static const char * kAppleGPIO_EnableCodecIRQ;
static const char * kAppleGPIO_GetCodecIRQ;
static const char * kAppleGPIO_RegisterCodecIRQ;
static const char * kAppleGPIO_UnregisterCodecIRQ;
static const char * kAppleGPIO_EnableCodecErrorIRQ;
static const char * kAppleGPIO_DisableCodecErrorIRQ;
static const char * kAppleGPIO_GetCodecErrorIRQ;
static const char * kAppleGPIO_RegisterCodecErrorIRQ;
static const char * kAppleGPIO_UnregisterCodecErrorIRQ;
static const char * kAppleGPIO_SetCodecClockMux;
static const char * kAppleGPIO_GetCodecClockMux;
static const char * kAppleGPIO_SetCodecInputDataMux;
static const char * kAppleGPIO_GetCodecInputDataMux;
static const char * kAppleGPIO_GetInternalSpeakerID;
bool mAppleI2S_Enable;
bool mAppleI2S_ClockEnable;
bool mAppleI2S_Reset;
bool mAppleI2S_CellEnable;
GpioAttributes mAppleGPIO_AmpMute;
GpioAttributes mAppleGPIO_AnalogCodecReset;
GpioAttributes mAppleGPIO_CodecClockMux;
GpioAttributes mAppleGPIO_CodecInputDataMux;
GpioAttributes mAppleGPIO_DigitalCodecReset;
GpioAttributes mAppleGPIO_HeadphoneMute;
GpioAttributes mAppleGPIO_LineOutMute;
GpioAttributes mAppleGPIO_InternalSpeakerID;
GpioAttributes mAppleGPIO_SpeakerID;
//
// I2C
//
bool findAndAttachI2C();
bool detachFromI2C();
bool openI2C();
void closeI2C();
UInt32 mI2CPort;
PPCI2CInterface* mI2CInterface;
bool mI2C_lastTransactionResult;
//
// I2S
//
typedef enum i2sReference {
kUseI2SCell0 = 0,
kUseI2SCell1 = 1,
kNoI2SCell = 0xFFFFFFFF
} I2SCell;
I2SCell mI2SInterfaceNumber;
IOReturn initI2S(IOMemoryMap* map);
// Sound Formats:
typedef enum SoundFormat
{
kSndIOFormatI2SSony,
kSndIOFormatI2S64x,
kSndIOFormatI2S32x,
// This says "we never decided for a sound format before"
kSndIOFormatUnknown
} SoundFormat;
#ifndef kBUILD_FOR_DIRECT_I2S_HW_ACCESS
bool findAndAttachI2S();
bool detachFromI2S();
bool openI2S();
void closeI2S();
AppleI2S * mI2SInterface;
#endif
GpioAttributes GetCachedAttribute ( GPIOSelector selector, GpioAttributes defaultResult );
static void gpioTimerCallback ( OSObject *target, IOAudioDevice *device );
bool interruptUsesTimerPolling( PlatformInterruptSource source );
void poll ( void );
void pollGpioInterrupts ( void );
GpioAttributes readGpioState ( GPIOSelector selector );
IOReturn writeGpioState ( GPIOSelector selector, GpioAttributes gpioState );
IOReturn translateGpioAttributeToGpioState ( GPIOType gpioType, GpioAttributes gpioAttribute, UInt32 * valuePtr );
volatile UInt8 * mHwPtr;
volatile UInt8 * mHwI2SPtr;
IOReturn setupI2SClockSource( UInt32 cell, bool requestClock, UInt32 clockSource );
public:
void LogFCR ( void );
void LogI2S ( void );
void LogGPIO ( void );
void LogInterruptGPIO ( void );
private:
volatile UInt32 * mFcr1;
volatile UInt32 * mFcr3;
volatile UInt32 * mSerialFormat;
volatile UInt32 * mI2SIntCtrl;
volatile UInt32 * mDataWordSize;
volatile UInt32 * mFrameCounter;
IOTimerEventSource * mGpioPollTimer;
volatile UInt8 * mGPIO_analogCodecReset;
volatile UInt8 * mGPIO_mclkMuxSelect;
volatile UInt8 * mGPIO_digitalCodecErrorIrq;
volatile UInt8 * mGPIO_digitalCodecReset;
volatile UInt8 * mGPIO_digitalCodecIrq;
volatile UInt8 * mGPIO_headphoneSense;
volatile UInt8 * mGPIO_headphoneMute;
volatile UInt8 * mGPIO_inputDataMuxSelect;
volatile UInt8 * mGPIO_internalSpeakerID;
volatile UInt8 * mGPIO_lineInSense;
volatile UInt8 * mGPIO_lineOutSense;
volatile UInt8 * mGPIO_lineOutMute;
volatile UInt8 * mGPIO_speakerMute;
void * mCodecInterruptHandler;
void * mCodecErrorInterruptHandler;
void * mDigitalInDetectInterruptHandler;
void * mDigitalOutDetectInterruptHandler;
void * mHeadphoneDetectInterruptHandler;
void * mLineInputDetectInterruptHandler;
void * mLineOutputDetectInterruptHandler;
void * mSpeakerDetectInterruptHandler;
bool mCodecInterruptEnable;
bool mCodecErrorInterruptEnable;
bool mDigitalInDetectInterruptEnable;
bool mDigitalOutDetectInterruptEnable;
bool mHeadphoneDetectInterruptEnable;
bool mLineInputDetectInterruptEnable;
bool mLineOutputDetectInterruptEnable;
bool mSpeakerDetectInterruptEnable;
};
#endif
| [
"mattl@cnuk.org"
] | mattl@cnuk.org |
8bdf5eb81f6f4c3fab82a007c7622d1aeecac1b0 | 9357bed2ab063ec0d62774a22112bec3dd655ffd | /source/StoreState.cpp | 7db8192d2008152aa29876fbb7539c00e92299a5 | [
"MIT"
] | permissive | taparkins/Galaxulon | 25cfb8a277f61dc128f87959b386565a7c09707d | 6613e92861799eb16db42cb9cdc8f88179841c19 | refs/heads/master | 2023-03-20T20:17:38.883400 | 2012-04-26T08:19:12 | 2012-04-26T08:19:12 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,657 | cpp | // StoreState.cpp
//
// Authors: Daniel Setser, David Setser
// Date created: April 13, 2012
//
// -------
// Contains implementation for the StoreState class
//
#include "tonc_core.h"
#include "tonc_input.h"
#include "TextManager.h"
#include "GameStateManager.h"
#include "globals.h"
#include "TitleScreenState.h"
#include "PauseState.h"
#include "Player.h"
#include "assert2.h"
#include "StoreState.h"
#define EXTRA_LIFE 0
#define EXTRA_BOMB 1
#define UPGRADE_LIGHT 2
#define UPGRADE_HEAVY 3
#define ADD_SHIELD 4
StoreState::StoreState(GameStateManager* _gameStateMan) : GameState(_gameStateMan)
{
spriteCount = 5;
selected = EXTRA_LIFE;
}
void StoreState::init()
{
// update end-of-stage globals
g_playerHitThisStage = false;
g_playerStageBulletsHit = 0;
g_playerStageBulletsTotal = 0;
// Draw a black background
memset32(&se_mem[24], 0x00000000, (SBB_SIZE/4));
spriteObjs = g_oamMan->allocSprites(SPRITE_NUM);
write("Upgrades:", Vec2(10, 1));
player.useImg(SELECTOR_SPRITE_POS);
player.setPos(0,SELECTOR_Y_SPAWN);
player.setPalette(SELECTOR_BASE_PALETTE);
player.setTileIndex(g_playerSpriteTilesPos);
player.setSize(SELECTOR_SPRITE_SIZE);
player.setVisible(true);
for(int i = 0; i < spriteCount; i++)
{
sprites[i].useImg(UPGRADE_SPRITE_POS+i);
sprites[i].setVisible(true);
sprites[i].setSize(UPGRADE_SPRITE_SIZE);
sprites[i].setPos(UPGRADE_X_POS + UPGRADE_X_INCREMENT, UPGRADE_Y_POS + UPGRADE_Y_INCREMENT*i);
sprites[i].setPalette(4);
}
sprites[0].setTileIndex(g_extraLife_TilesPos);
sprites[1].setTileIndex(g_extraBomb_TilesPos);
sprites[2].setTileIndex(g_primaryFireUp_TilesPos);
sprites[3].setTileIndex(g_secondFireUp_TilesPos);
sprites[4].setTileIndex(g_shield_TilesPos);
// Fourth upgrade has it's own subpalette
sprites[3].setPalette(5);
selected = EXTRA_LIFE;
//Life, bomb, light fire upgrade, heavy fire upgrade, shield
write("Extra life", Vec2(7, 4));
write("Extra Bomb", Vec2(7, 7));
write("Upgrade Light Fire", Vec2(7, 10));
write("Upgrade Heavy Fire", Vec2(7, 13));
write("Shield", Vec2(7, 16));
}
void StoreState::update()
{
assert2(playerPointer != 0, "The store's player pointer is null.");
if (key_hit(KEY_UP))
{
if(player.Y() != SELECTOR_Y_SPAWN)
{
player.moveBy(0, -1*UPGRADE_Y_INCREMENT);
selected--; //Moves this to the appropriate value as described in the .h
}
}
if (key_hit(KEY_DOWN))
{
if(player.Y() != (SELECTOR_Y_SPAWN + (4*UPGRADE_Y_INCREMENT)))
{
player.moveBy(0, UPGRADE_Y_INCREMENT);
selected++; //Moves this to the appropriate value as described in the .h
}
}
if (key_hit(KEY_A) || key_hit(KEY_START))
{
switch(selected)
{
case EXTRA_LIFE:
{
playerPointer->addLife();
break;
}
case EXTRA_BOMB:
{
playerPointer->addBomb();
break;
}
case UPGRADE_LIGHT:
{
playerPointer->upgradeLightFire();
break;
}
case UPGRADE_HEAVY:
{
playerPointer->upgradeHeavyFire();
break;
}
case ADD_SHIELD:
{
playerPointer->addShield();
break;
}
}
gameStateMan->popState();
}
}
void StoreState::destroy()
{
clearText();
for(int i = 0; i < spriteCount; i++)
{
sprites[i].unuseImg();
}
player.unuseImg();
g_oamMan->deallocSprites(spriteObjs, SPRITE_NUM);
}
void StoreState::refreshed()
{
init();
}
void StoreState::suspend()
{
clearText();
for(int i = 0; i < spriteCount; i++)
{
sprites[i].unuseImg();
}
player.unuseImg();
g_oamMan->deallocSprites(spriteObjs, SPRITE_NUM);
} | [
"spencer.phippen@gmail.com"
] | spencer.phippen@gmail.com |
b1d8ed993acc7810996443662149f8d1fc682381 | 4678d1bc1c5bd51d3467928913a92e5c434121c5 | /binary/generic/cpp/bst.hpp | 559b20ae03372fbe2a07b80dd9208c34b4b6c3e4 | [
"LicenseRef-scancode-warranty-disclaimer"
] | no_license | bmoscon/trees | a6fb37e0ba743ade9a3a97fa3d4c655ee5bc6304 | c322792cd31e83417169af6537921ad85e0f3ab6 | refs/heads/master | 2020-04-06T06:40:21.577921 | 2013-08-03T20:01:31 | 2013-08-03T20:01:31 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 5,082 | hpp | /*
* bst.hpp
*
* Generic Binary Search Tree
*
*
*
* Copyright (C) 2013 Bryant Moscon - bmoscon@gmail.com
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
* deal in the Software without restriction, including without limitation the
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
* sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions, and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution, and in the same
* place and form as other copyright, license and disclaimer information.
*
* 3. The end-user documentation included with the redistribution, if any, must
* include the following acknowledgment: "This product includes software
* developed by Bryant Moscon (http://www.bryantmoscon.org/)", in the same
* place and form as other third-party acknowledgments. Alternately, this
* acknowledgment may appear in the software itself, in the same form and
* location as other such third-party acknowledgments.
*
* 4. Except as contained in this notice, the name of the author, Bryant Moscon,
* shall not be used in advertising or otherwise to promote the sale, use or
* other dealings in this Software without prior written authorization from
* the author.
*
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
*/
#include <iostream>
#include <queue>
#include <algorithm>
template <class K, class D>
class BSTree {
public:
BSTree() : root(NULL) {}
~BSTree()
{
freeTree(root);
}
template <class S, class T>
struct Node {
Node() : key(NULL), data(NULL), left(NULL), right(NULL) {}
Node(const S &k, const T &d) : key(k), data(d), left(NULL), right(NULL) {}
Node(const S &k, const T &d, Node<S,T> *l, Node<S,T> *r) : key(k), data(d), left(l), right(r) {}
S key;
T data;
Node<S,T> *left;
Node<S,T> *right;
};
void insert(K &key, D &data)
{
if (!root) {
root = new Node<K,D>(key, data);
return;
}
Node<K,D> *head = root;
Node<K,D> *prev = NULL;
while (head) {
prev = head;
if (key < head->key) {
head = head->left;
} else {
head = head->right;
}
}
if (key < prev->key) {
prev->left = new Node<K,D>(key, data);
} else {
prev->right = new Node<K,D>(key, data);
}
}
void inOrderTraversal() const
{
inOrder(root);
std::cout << std::endl;
}
void preOrderTraversal() const
{
preOrder(root);
std::cout << std::endl;
}
void postOrderTraversal() const
{
postOrder(root);
std::cout << std::endl;
}
void levelOrderTraversal() const
{
levelOrder(root);
std::cout << std::endl;
}
const Node<K,D>* leastCommonAncestor(const K &k1, const K &k2) const
{
if (!root || root->key == k1 || root->key == k2) {
return (NULL);
}
return(LCA(root, k1, k2));
}
private:
void inOrder(const Node<K,D> *n) const
{
if (n) {
inOrder(n->left);
std::cout << n->key << ", ";
inOrder(n->right);
}
}
void preOrder(const Node<K,D> *n) const
{
if (n) {
std::cout << n->key << ", ";
preOrder(n->left);
preOrder(n->right);
}
}
void postOrder(const Node<K,D> *n) const
{
if (n) {
postOrder(n->left);
postOrder(n->right);
std::cout << n->key << ", ";
}
}
void levelOrder(const Node<K,D> *n) const
{
std::queue<const Node<K,D> *> q;
q.push(n);
while (!q.empty()) {
n = q.front();
q.pop();
std::cout << n->key << ", ";
if (n->left) {
q.push(n->left);
}
if (n->right) {
q.push(n->right);
}
}
}
const Node<K,D>* LCA(const Node<K,D> *n, const K &k1, const K &k2) const
{
if (!n) {
return (NULL);
}
if (std::max(k1, k2) < n->key) {
return (LCA(n->left, k1, k2));
} else if (std::min(k1, k2) > n->key) {
return (LCA(n->right, k1, k2));
} else {
return (n);
}
}
void freeTree(Node<K,D> *n)
{
if (n) {
freeTree(n->left);
freeTree(n->right);
delete n;
}
}
Node<K,D> *root;
};
| [
"bmoscon@gmail.com"
] | bmoscon@gmail.com |
f2cf1fef50a69cad2926588263260dbc90d123aa | 5af3fdca9b7ee52f2efef90ccff93399d3980fa8 | /3DTank/Tank.cpp | 1f74823fa1b2e53c4e1e5b58ec6d2be89b787b78 | [] | no_license | wwwwwwbin/3DGame_Tank | 0c58bb74229ad02079cb3fd0db75bea1cbcd2aa8 | 8eb8119ef602e1e47348baf772f5ac6325703369 | refs/heads/master | 2020-05-23T16:42:28.170103 | 2013-09-13T08:44:05 | 2013-09-13T08:44:05 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 5,244 | cpp | #include "StdAfx.h"
#include "Tank.h"
#include "EngineDefine.h"
#include "GraphicsEngine.h"
#include "3DModelFactory.h"
#include "MessageMgr.h"
#include "SceneMgr.h"
CTank::CTank(float fX,float fY,float fZ)
{
m_fMoveSpeed = 3.f;
m_pTopModel = new C3DModel();
m_pBottomModel = new C3DModel();
C3DModelFactory::GetInstance()->GetModel(m_pTopModel,C3DModelFactory::GM_TANKTOP);
C3DModelFactory::GetInstance()->GetModel(m_pBottomModel,C3DModelFactory::GM_TANKBOTTOM);
m_vPosition.x = fX;
m_vPosition.y = fY;
m_vPosition.z = fZ;
m_vDirectionMove.x = -1.f;
m_vDirectionMove.y = 0.f;
m_vDirectionMove.z = 0.f;
m_vDirectionLook = m_vDirectionMove;
m_fAngleMove = 0.f;
m_fAngleLook = 0.f;
//m_bHasInit = false;
SetPosition(fX,fY,fZ);
}
CTank::~CTank(void)
{
delete m_pTopModel;
delete m_pBottomModel;
}
int CTank::Updata( void )
{
int nResult = false;
int nRetCode = false;
CGraphicsEngine* pEngine = NULL;
pEngine = CGraphicsEngine::GetInstance();
LOG_FAILD_JUMP(pEngine);
if(pEngine->m_pDXInput->ReadKeyboard()){
if(pEngine->m_pDXInput->IsKeyPressed(DIK_A)){
ChangeDirectionMove(-0.02f);
pEngine->CameraPointRotate(m_vPosition,-0.02f);
}
if(pEngine->m_pDXInput->IsKeyPressed(DIK_D)){
ChangeDirectionMove(0.02f);
pEngine->CameraPointRotate(GetPosition(),0.02f);
}
if(pEngine->m_pDXInput->IsKeyPressed(DIK_W)){
D3DXVECTOR3 vDelta = m_vDirectionMove*m_fMoveSpeed;
ChangePosition(vDelta.x,vDelta.y,vDelta.z);
pEngine->ChangeCameraPosition(vDelta.x,vDelta.y,vDelta.z);
}
if(pEngine->m_pDXInput->IsKeyPressed(DIK_S)){
D3DXVECTOR3 vDelta = -m_vDirectionMove*m_fMoveSpeed;
ChangePosition(vDelta.x,vDelta.y,vDelta.z);
pEngine->ChangeCameraPosition(vDelta.x,vDelta.y,vDelta.z);
}
if(pEngine->m_pDXInput->IsKeyPressed(DIK_U)){
ChangeDirectionLook(-0.02f);
pEngine->CameraPointRotate(m_vPosition,-0.02f);
}
if(pEngine->m_pDXInput->IsKeyPressed(DIK_O)){
ChangeDirectionLook(0.02f);
pEngine->CameraPointRotate(m_vPosition,0.02f);
}
if (pEngine->m_pDXInput->IsKeyPressed(DIK_SPACE))
{
static float fLastFireTime = pEngine->m_pTimer->GetGamePlayTime();
float fPostTime = pEngine->m_pTimer->GetGamePlayTime();
if (fPostTime - fLastFireTime > (10 - m_fMoveSpeed)*50)
{
fLastFireTime = fPostTime;
Fire();
D3DXVECTOR3 vFirePosition;
vFirePosition = m_vPosition + (m_vDirectionLook * 20);
vFirePosition.y += 8;
CParticle* pParticle = NULL;
int nTextureID = 0;
nRetCode = TextureMgr::GetInstance()->LoadTexture("cricle.png", nTextureID);
LOG_FAILD_JUMP(nRetCode);
pParticle = pEngine->m_pParticleMgr->CreateParticle(500, nTextureID);
if (pParticle)
{
//pParticle->Explode(vFirePosition);
//pParticle->Shoot(vFirePosition, m_vDirectionLook);
pParticle->Fire(vFirePosition, m_vDirectionLook);
}
}
}
}
nResult = true;
Exit0:
return nResult;
}
void CTank::Render( void )
{
CGraphicsEngine::GetInstance()->AddModel(m_pTopModel);
CGraphicsEngine::GetInstance()->AddModel(m_pBottomModel);
}
void CTank::Fire( void )
{
CMessageMgr* pMsgMgr =NULL;
FireParameter* pParameter = NULL;
pMsgMgr = CMessageMgr::GetInstance();
pParameter = new FireParameter();
pParameter->vPosition = m_vPosition + m_vDirectionLook*20.f;
pParameter->vDirection = m_vDirectionLook;
pParameter->fAngle = m_fAngleLook + m_fAngleMove;
pMsgMgr->AddMessage(CMessageMgr::MSG_FIRE, (DWORD)pParameter, NULL);
}
void CTank::Move( float nUnits )
{
m_vPosition += m_vDirectionMove*nUnits;
SetMatrix();
}
void CTank::ChangePosition( float fX,float fY,float fZ )
{
m_vPosition.x += fX;
m_vPosition.y += fY;
m_vPosition.z += fZ;
SetMatrix();
}
void CTank::ChangeDirectionMove( float fAngle )
{
m_fAngleMove += fAngle;
D3DXMATRIX tmpMatrix;
D3DXMatrixRotationY(&tmpMatrix,fAngle);
D3DXVec3TransformCoord(&m_vDirectionMove,&m_vDirectionMove,&tmpMatrix);
D3DXVec3Normalize(&m_vDirectionMove,&m_vDirectionMove);
D3DXVec3TransformCoord(&m_vDirectionLook,&m_vDirectionLook,&tmpMatrix);
D3DXVec3Normalize(&m_vDirectionLook,&m_vDirectionLook);
//cprintf("%f,%f,%f\n",m_vDirection.x,m_vDirection.y,m_vDirection.z);
SetMatrix();
}
void CTank::SetMatrix( void )
{
D3DXMATRIX tmpMatrix;
D3DXMatrixRotationY(&m_pTopModel->m_mtrWorldMatrix,m_fAngleMove+m_fAngleLook);
D3DXMatrixTranslation(&tmpMatrix,m_vPosition.x,m_vPosition.y,m_vPosition.z);
m_pTopModel->m_mtrWorldMatrix *= tmpMatrix;
D3DXMatrixRotationY(&m_pBottomModel->m_mtrWorldMatrix,m_fAngleMove);
D3DXMatrixTranslation(&tmpMatrix,m_vPosition.x,m_vPosition.y,m_vPosition.z);
m_pBottomModel->m_mtrWorldMatrix *= tmpMatrix;
}
void CTank::SetPosition( float fX,float fY,float fZ )
{
m_vPosition.x = fX;
m_vPosition.y = fY;
m_vPosition.z = fZ;
SetMatrix();
}
void CTank::SetDirectionMove( float fAngle )
{
m_fAngleMove = fAngle;
SetMatrix();
}
void CTank::SetDirectionLook( float fAngle )
{
m_fAngleLook = fAngle;
SetMatrix();
}
void CTank::ChangeDirectionLook( float fAngle )
{
m_fAngleLook += fAngle;
D3DXMATRIX tmpMatrix;
D3DXMatrixRotationY(&tmpMatrix,fAngle);
D3DXVec3TransformCoord(&m_vDirectionLook,&m_vDirectionLook,&tmpMatrix);
D3DXVec3Normalize(&m_vDirectionLook,&m_vDirectionLook);
SetMatrix();
}
| [
"bin@cppapp.com"
] | bin@cppapp.com |
4975128f7425aab7b9d269267eab4e69cf3a2537 | a0370090e044e2817842b90a9559be41282072c5 | /DevExpress VCL/ExpressBars 7/Demos/CBuilder/InPlaceEditorsDemo/InPlaceEditorsDemoImage.cpp | 0566d8b822cdda9f9a4f6ea71cad943ea288c042 | [] | no_license | bravesoftdz/MyVCL-7 | 600a1c1be2ea71b198859b39b6da53c6b65601b3 | 197c1e284f9ac0791c15376bcf12c243400e7bcd | refs/heads/master | 2022-01-11T17:18:00.430191 | 2018-12-20T08:23:02 | 2018-12-20T08:23:02 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 862 | cpp | //---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "InPlaceEditorsDemoImage.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma link "cxContainer"
#pragma link "cxControls"
#pragma link "cxEdit"
#pragma link "cxImage"
#pragma resource "*.dfm"
TfrmImageEditors *frmImageEditors;
//---------------------------------------------------------------------------
__fastcall TfrmImageEditors::TfrmImageEditors(TComponent* Owner)
: TEditorDemoBaseFrame(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TfrmImageEditors::SetParameters(TStream* AStream)
{
if (AStream != NULL)
cxImage1->Picture->Bitmap->LoadFromStream(AStream);
else
cxImage1->Picture->Bitmap = 0;
}
| [
"karaim@mail.ru"
] | karaim@mail.ru |
caf3d5ab0d81e8c7754222dab75006c427627717 | 92efaedf9416a4196549ee06b4baaff6b3878d6c | /algorithm/stack/队列的最大值.hpp | 7b93e9f28879b00d1e1907396fcf9bc844d0e4e7 | [] | no_license | Heihuang/view | c21a2184dd4914d008b3a1454499c70e4435defe | ec84fa143c0c577cc8854e48822a122f19d47147 | refs/heads/master | 2023-01-06T22:48:44.113773 | 2020-11-11T13:48:50 | 2020-11-11T13:48:50 | 275,503,860 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,110 | hpp | /*
题目:请定义一个队列并实现函数 max_value 得到队列里的最大值,要求函数max_value、push_back 和 pop_front 的均摊时间复杂度都是O(1)。
若队列为空,pop_front 和 max_value 需要返回 -1
解法:从队列尾部插入元素时,我们可以提前取出队列中所有比这个元素小的元素,使得队列中只保留对结果有影响的数字。这样的方法等价于要求维持队列单
调递减,即要保证每个元素的前面都没有比它小的元素。
*/
class MaxQueue {
queue<int> q;
deque<int> d;
public:
MaxQueue() {
}
int max_value() {
if (d.empty())
return -1;
return d.front();
}
void push_back(int value) {
while (!d.empty() && d.back() < value) {
d.pop_back();
}
d.push_back(value);
q.push(value);
}
int pop_front() {
if (q.empty())
return -1;
int ans = q.front();
if (ans == d.front()) {
d.pop_front();
}
q.pop();
return ans;
}
};
| [
"zhoubing@zuoyebang.com"
] | zhoubing@zuoyebang.com |
b0bceb825f6cc6bb535714338b4f787f388d949e | e62a2a06c2ca139347a15ddeed93a19bf3da747e | /src/main.cpp | 8840fb4ceedfebbea92bab215edc1dccd69f844a | [] | no_license | SebastianLindmark/the-frame | ce06984be5bad0dc285ee8626d7a768c198164aa | 4bebae6062dcd1f336ef8e3c8f125aed486ca8fb | refs/heads/master | 2020-04-19T03:41:23.965782 | 2019-01-28T10:27:26 | 2019-01-28T10:27:26 | 167,941,417 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 10,274 | cpp | /* ESP8266/32 Audio Spectrum Analyser on an SSD1306/SH1106 Display
* The MIT License (MIT) Copyright (c) 2017 by David Bird.
* The formulation and display of an AUdio Spectrum using an ESp8266 or ESP32 and SSD1306 or SH1106 OLED Display using a Fast Fourier Transform
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files
* (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge,
* publish, distribute, but not to use it commercially for profit making or to sub-license and/or to sell copies of the Software or to
* permit persons to whom the Software is furnished to do so, subject to the following conditions:
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
* See more at http://dsbird.org.uk
*/
#include <Arduino.h>
#include <Wire.h>
#include "arduinoFFT.h" // Standard Arduino FFT library
#include "credentials.h"
#include <ESP8266WiFi.h>
#include <PubSubClient.h>
#include <FastLED.h> //include the FastLED Library
// https://github.com/kosme/arduinoFFT, in IDE, Sketch, Include Library, Manage Library, then search for FFT
arduinoFFT FFT = arduinoFFT();
#include <math.h> //include library for mathematic funcions
#define DATA_PIN D2 //DATA PIN WHERE YOUR LEDS ARE CONNECTED
#define COLS 7
#define ROWS 7
#define NUM_LEDS COLS * ROWS //amount of LEDs in your matrix
#define SECOND 60
CRGB leds[NUM_LEDS];
//#include "SSD1306.h" // https://github.com/squix78/esp8266-oled-ssd1306
//SSD1306 display(0x3c, D3,D4); // 0.96" OLED display object definition (address, SDA, SCL) Connect OLED SDA , SCL pins to ESP SDA, SCL pins
/////////////////////////////////////////////////////////////////////////
// Initialize the OLED display using SPI
// D5 -> CLK
// D7 -> MOSI (DOUT)
// D0 -> RES
// D2 -> DC
// D8 -> CS
#include "SSD1306Spi.h"
// #include "SH1106SPi.h"
SSD1306Spi display(D3, D1, D8);
// or
// SH1106Spi display(D0, D2);
#define SAMPLES 256 //Must be a power of 2
#define SAMPLING_FREQUENCY 10000 //Hz, must be 10000 or less due to ADC conversion time. Determines maximum frequency that can be analysed by the FFT.
#define amplitude 50
void displayBand(int band, int dsize);
void drawBand(int band, int size);
void drawBand(int band, int size, CRGB color);
void drawPixel(int x, int y, CRGB color);
void displayBoth(int dsize,int band);
long map2(long x, long in_min, long in_max, long out_min, long out_max);
void clearLights();
bool setup_wifi();
boolean setup_mqtt();
boolean poweron = true;
int dimlevel = 180;
unsigned int sampling_period_us;
unsigned long microseconds;
byte peak[] = {0,0,0,0,0,0,0};
byte peak2[]= {0,0,0,0,0,0,0};
double freqBoost[]= {0.6,0.7,1.2,1.8,2.2,1.9,1.9};
double vReal[SAMPLES];
double vImag[SAMPLES];
unsigned long newTime, oldTime;
char ssid[] = SSIDNAME;
char password[] = PASSWORD;
WiFiClient espClient;
IPAddress mqttServer(192, 168, 1, 200);
void mqttCallback(char* topic, byte* payload, unsigned int length);
PubSubClient mqttClient(mqttServer, 1883, mqttCallback, espClient);
/////////////////////////////////////////////////////////////////////////
void setup() {
Serial.begin(9600);
//Wire.begin(5,4); // SDA, SCL
setup_wifi();
FastLED.addLeds<WS2812B, DATA_PIN, GRB> (leds, NUM_LEDS);
display.init();
display.setFont(ArialMT_Plain_10);
display.flipScreenVertically(); // Adjust to suit or remove
sampling_period_us = round(1000000 * (1.0 / SAMPLING_FREQUENCY));
}
void loop() {
if (!mqttClient.connected()) {
setup_mqtt();
}
else {
// Client connected
mqttClient.loop();
}
if(poweron){
display.clear();
display.drawString(0,0,"0.1 0.2 0.5 1K 2K 4K 8K");
clearLights();
for (int i = 0; i < SAMPLES; i++) {
newTime = micros()-oldTime;
oldTime = newTime;
vReal[i] = analogRead(A0); // A conversion takes about 1mS on an ESP8266
vImag[i] = 0;
while (micros() < (newTime + sampling_period_us)) { /* do nothing to wait */ }
}
FFT.Windowing(vReal, SAMPLES, FFT_WIN_TYP_HAMMING, FFT_FORWARD);
FFT.Compute(vReal, vImag, SAMPLES, FFT_FORWARD);
FFT.ComplexToMagnitude(vReal, vImag, SAMPLES);
for (int i = 2; i < (SAMPLES/2); i++){
if (vReal[i] > 200) {
if (i<=5 ) displayBoth(0,(int)vReal[i]/amplitude); // 125Hz
if (i >5 && i<=12 ) displayBoth(1,(int)vReal[i]/amplitude); // 250Hz
if (i >12 && i<=32 ) displayBoth(2,(int)vReal[i]/amplitude); // 500Hz
if (i >32 && i<=62 ) displayBoth(3,(int)vReal[i]/amplitude); // 1000Hz
if (i >62 && i<=105 ) displayBoth(4,(int)vReal[i]/amplitude); // 2000Hz
if (i >105 && i<=120 ) displayBoth(5,(int)vReal[i]/amplitude); // 4000Hz
if (i >120 && i<=146 ) displayBoth(6,(int)vReal[i]/amplitude); // 8000Hz
//Serial.println(i);
}
for (byte band = 0; band <= 6; band++) display.drawHorizontalLine(18*band,64-peak[band],14);
}
//Each 4th milli
//Used to slowly decay the peaks
if (millis()%4 == 0) {
for (byte band = 0; band <= 6; band++) {if (peak[band] > 0) peak[band] -= 1;}
for (byte band = 0; band <= 6; band++) {if (peak2[band] > 0) peak2[band] -= 1;}
}
display.display();
FastLED.show();
}
}
void displayBoth(int band, int size){
displayBand(band,size);
int val = map2(size * freqBoost[band],0,35,0,ROWS);
if (val > peak2[band]) {peak2[band] = val;}
CRGB barColor = CHSV(band * 35,200,dimlevel);
CRGB peakColor = CHSV(band * 35,200,dimlevel);
drawBand(band,val,barColor);
//drawPixel(band,peak2[band],peakColor);
}
long map2(long x, long in_min, long in_max, long out_min, long out_max)
{
if(x < in_min){
x = in_min;
} else if (x> in_max){
x = in_max;
}
return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;
}
//flip x,y -> y,x for portrait
//flip y,x -> x,y for landscape
void drawPixel(int y, int x, CRGB color){
int pixelIndex = 0;
int fullCols = x * ROWS;
pixelIndex += fullCols;
if(x % 2 == 0){
pixelIndex += y;
}else{
pixelIndex += ROWS - y - 1;
}
if(pixelIndex >= NUM_LEDS){
pixelIndex = NUM_LEDS - 1;
}
leds[pixelIndex] = color;
}
void clearLights(){
for(int i= 0; i < COLS; i++){
drawBand(i,ROWS,CRGB::Black);
}
}
void flashLights(){
CRGB c[] = {CRGB::DarkBlue, CRGB::DarkCyan, CRGB::DarkGoldenrod, CRGB::DarkGreen, CRGB::DarkMagenta, CRGB::DarkOrange, CRGB::DarkViolet};
for(int i= 0; i < COLS; i++){
drawBand(i,ROWS,c[i]);
}
}
void drawBand(int band, int size, CRGB color){
for(int i = 0; i < ROWS; i++){
if(i < size){
drawPixel(ROWS - band - 1,i,color); //mirror the bands. Bass frequencies to the left
}else{
drawPixel(ROWS - band - 1,i,CRGB::Black);
}
}
}
void drawBand(int band, int size){
drawBand(band,size,CHSV(band * 35,200,200));
}
void displayBand(int band, int dsize){
int dmax = 50;
if (dsize > dmax) dsize = dmax;
for (int s = 0; s <= dsize; s=s+2){display.drawHorizontalLine(18*band,64-s, 14);}
if (dsize > peak[band]) {peak[band] = dsize;}
}
bool setup_wifi() {
delay(10);
// We start by connecting to a WiFi network
Serial.println();
Serial.print("Connecting to ");
Serial.println(SSIDNAME);
WiFi.mode(WIFI_STA);
WiFi.begin(ssid, password);
int attempt = 30;
while(attempt){
if(WiFi.status() == WL_CONNECTED){
Serial.println("WiFi connected");
Serial.println("IP address: ");
Serial.println(WiFi.localIP());
return true;
}
delay(500);
attempt--;
}
return false;
}
boolean setup_mqtt(){
char clientName[50];
snprintf (clientName, 50, "%ld", system_get_chip_id());
if (mqttClient.connect(clientName, MQTTUSER, MQTTPASSWORD)) {
char str[30];
strcpy(str, "The Frame is connected to MQTT ");
mqttClient.publish("stat/frame/hello", str);
mqttClient.subscribe("cmnd/frame/power");
mqttClient.subscribe("cmnd/frame/state");
} else {
delay(1000);
Serial.println("Connecting to MQTT server ...");
}
return mqttClient.connected();
}
//Enables support for voice control of 'The Frame' through Google Home
void mqttCallback(char* topic, byte* payload, unsigned int length) {
// handle message arrived
// Internally, the mqtt client uses the same buffer for both inbound and outbound
// messages. The application should create its own copy of the values if they
// are required beyond this.
char t[50], p[50], buffer[50];
snprintf (t, 50, "%s", topic);
snprintf (p, 50, "%s",payload);
Serial.println(t);
Serial.println(p);
Serial.println(length);
p[length] = '\n';
if(strcmp(t, "cmnd/frame/power") == 0){
if(strncmp(p, "ON",length) == 0){
poweron = true;
flashLights();
FastLED.show();
delay(300);
clearLights();
FastLED.show();
Serial.println("OK Turning ON");
} else if(strncmp(p, "OFF",length) == 0) {
poweron = false;
flashLights();
FastLED.show();
delay(300);
clearLights();
FastLED.show();
Serial.println("OK Turning OFF");
} else if(strstr(p, ",") != NULL) {
Serial.println("OK Changing color");
}
else {
char dest[length];
dimlevel = map2(atoi(strncpy(dest, p, length)), 0, 100, 0, 255);
Serial.println("OK Dimming it to ");
Serial.println(dimlevel);
}
} else if (strcmp(t, "cmnd/frame/state") == 0) {
mqttClient.publish("stat/frame/state", "Status", true);
}
}
| [
"sebli821@student.liu.se"
] | sebli821@student.liu.se |
f3d1a70bdc59a5d19a8ca0ee70ed9702af2cab6b | 52b760f122b90ce43fdfce1ed39e2edf4324619e | /src/drawing/Point3D.h | b283f45c3dd24326def618dcb26b4ef6ac242494 | [] | no_license | danyalejandro/ogre3d-cloth-simulation | 76afbc01dad81126fc8b4ae07ba12f733940b31c | fa390211bcd4a35ec5fda7335f779b10537b62d9 | refs/heads/master | 2021-08-19T04:33:58.625674 | 2017-11-24T19:52:12 | 2017-11-24T19:52:12 | 111,949,124 | 3 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 249 | h | #ifndef OGRECAM_POINT3D_H
#define OGRECAM_POINT3D_H
#include <Ogre.h>
using namespace Ogre;
class Point3D {
public:
Vector3 p;
ManualObject* manual;
SceneNode* node;
Point3D(SceneManager* scnMgr, Vector3 p);
};
#endif //OGRECAM_POINT3D_H
| [
"dcabrera@uvic.ca"
] | dcabrera@uvic.ca |
8aa93e84ec6d215d147454d921e453d8d07fe0c6 | 96ae90c1b6cb02f22362a38cbac9f469ff5bbc19 | /std_thread.cpp | 9b8a09ccc86a41491880f63b8e4c1a989e24b1d9 | [] | no_license | zdevt/cpp_code | 67bd106b2cec02376e75937fcd335fed30284a85 | 979cd226e3f45ebfe39cb018df90da8ca7262e60 | refs/heads/master | 2021-06-04T00:14:14.731552 | 2020-12-26T06:58:54 | 2020-12-26T06:58:54 | 131,384,756 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 993 | cpp | /*
* =====================================================================================
*
* Filename: Thread2.cpp
*
* Description:
*
* Version: 1.0
* Created: 2016年09月22日 22时25分28秒
* Last Modified: 2017-12-28 14:46:26
* Revision: none
* Compiler: gcc
*
* Author: zt (),
* Organization:
*
* =====================================================================================
*/
#include <unistd.h>
#include <iostream>
#include <atomic>
#include <thread>
#include <vector>
#include <sys/prctl.h>
class Test5
{
public:
Test5()
{
std::thread ( &Test5::output, this ).detach();
}
void output()
{
prctl ( PR_SET_NAME, "adfadf" );
while ( 1 )
{
std::cout << "asdf \n";
sleep ( 1 );
}
}
};
int main ( int argc, char* argv[] )
{
( void ) argc;
( void ) argv;
Test5 test5;
while ( 1 )
{
sleep ( 1 );
}
return 0;
}
| [
"zhangtao.hawk@qq.com"
] | zhangtao.hawk@qq.com |
786dfe0d64f3ca4c7cb8e4733cff2d031e75410e | ce3ee09f7b7aec107d8406e6ff6a22994751ca99 | /assignments/P03-Queues/11988/11988.cpp | d69069af3360226452bfbe66378d2bb0a199e296 | [] | no_license | paigechampagne/4883-Programming_Techniques-Champagne | 160d9798eaa7685e6f47de873409acb78f0d7c42 | 4ba1bf8fbf6dd9d7e555b7ff999e07ef68a2cd0f | refs/heads/master | 2023-01-28T04:41:14.503199 | 2020-12-08T09:12:58 | 2020-12-08T09:12:58 | 290,540,371 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,051 | cpp | ///////////////////////////////////////////////////////////////////////////////
//
// Author: Paige Champagne
// Email: paigechamp@gmail.com
// Label: 11988 - broken keyboard
// Course: CMPS 4883
// Semester: Fall 2020
//
// Description:
// solves 11988 (see attached files for more info)
//
// Usage:
// run with input file
//
// Files: 127.cpp
// input
/////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
//
// Author: Paige Champagne
// Email: paigechamp@gmail.com
// Label: 11988 - broken keyboard
// Course: CMPS 4883
// Semester: Fall 2020
//
// Description:
// solves 11988 (see attached files for more info)
//
// Usage:
// run with input file
//
// Files: 127.cpp
// input
/////////////////////////////////////////////////////////////////////////////////
#include <iostream>
#include <list>
#include <iterator>
using namespace std;
int main() {
char a;
string s;
while(getline(cin, s)){
list <char> list, parenthesis;
string hold;
int j = 0;
for(int i = 0; i < s.length(); i++){
//if regular letters
if((s[i] >= 'a' && s[i] <= 'z') || (s[i] >= 'A' && s[i] <= 'Z') || (s[i] == '_')){
if(parenthesis.empty()){ //if there is no beiju
list.push_back(s[i]);
}else{// if there's [] on the list and s[i] isn't a [], put beiju in holder
hold += s[i];
}
}else if(s[i] =='['){
parenthesis.push_back('[');
}else if(s[i] == ']'){
parenthesis.pop_front();
}
}
//cout << hold[0] <<endl;
if(hold.size() > 0){
for(int i = hold.size(); i >= 0; i--){
list.push_front(hold[i]);
}
}
int k = list.size();
for(int i = 0; i < k; i++){
cout << list.front();
list.pop_front();
}
cout << "\n";
}
}
| [
"paigechamp@gmail.com"
] | paigechamp@gmail.com |
e12553d614cd1725b1258f650538e577750bd8ed | 1d91a77cf3f0f1c1c9e886a4a1f1f51026e11613 | /examples/Simple_one_by_one_led/Simple_one_by_one_led.ino | a1e43d70093e520f449ce58f1ad86ede941ef8fa | [
"MIT"
] | permissive | otuk/DMD795x2 | 1d560e3c168c89dcbbb7f01af83dd48ef27dd49c | 37c50000660653acac8be96ca6b203447b743114 | refs/heads/master | 2021-08-28T11:38:13.641603 | 2021-08-25T10:50:10 | 2021-08-25T10:50:10 | 45,749,678 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 988 | ino | #include <DMD795x2.h>
void update_the_game(){
static int i, j;
unsigned short one_led = DMD_getpins(i,j);
DMD_reset_display_data();
DMD_add_display_data(&one_led, 1);
j++;
if (j==8){
i++;
j=0;
if(i==8)
i=0;
}
}
void setup() {
// put your setup code here, to run once:
/*
Set pin connections to 74HC595 so you can control the shift register
eg latchPin 8 on Arduino is connected to the pin12 of the 74HC595
Arduino latchPin 8 => RCLK pin , pin12 on 74HC595
Arduino clockPin 12 => SRCLK-serial clock of 595 -pin 11 on 74HC595
Arduino dataPin 11 => //SER -serial input pin of 595 - pin14 on 74HC595
*/
DMD_setup_ctl_pins(8, 12, 11); //You need to call this as part of you
}
void loop() {
// put your main code here, to run repeatedly:
update_the_game();
DMD_render_matrix();
DMD_fps(5); //change this value from 1 to 1200 see what happens
}
| [
"tolga.temel@gmail.com"
] | tolga.temel@gmail.com |
b16e8fe331b653a9d9dfb5363113c95b245c55ec | 90b0a4dac42a961523abb106100805b133e1476d | /Lecture/14 Big-O/Sample Code/For Loop/main.cpp | 80e44f92595adf475e037013b3c745a9fc4b3b2a | [] | no_license | sebCarabali/Problem-Solving-and-Programming-II | 09e3ee11b471814d8017e96e6334a8ffa60b9b52 | 482f67412576c52eae274c57d9028db1e5e92c0f | refs/heads/master | 2021-01-21T20:24:08.676273 | 2013-07-30T15:08:05 | 2013-07-30T15:08:05 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 815 | cpp | #include <iostream>
#include <string>
using namespace std;
// O(1)
void OutputData( const string& data )
{
cout << data << endl;
}
// O(n)
int ForLoop( int begin, int end )
{
int sum = 0;
for ( int i = begin; i < end; i++ )
{
sum += i;
cout << sum << endl;
}
return sum;
}
// O(n)
int ForLoops( int begin, int end )
{
int sum = 0;
for ( int i = begin; i < end; i++ )
{
sum += i;
cout << sum << endl;
}
for ( int i = begin; i < end; i++ )
{
sum += i;
cout << sum << endl;
}
return sum;
}
// O(n^2)
int TwoForLoops( int begin, int end )
{
int sum = 0;
for ( int i = begin; i < end; i++ )
{
for ( int j = begin; j < end; j++ )
{
sum += i*j;
cout << sum << endl;
}
}
return sum;
}
int main()
{
int result = TwoForLoops( 0, 10 );
cout << result << endl;
return 0;
}
| [
"racheljmorris@gmail.com"
] | racheljmorris@gmail.com |
e145937428b50d484c4c44ac868c9a0dded1c053 | 40e1cee550b1c615dac3adf8807ffd39789d601b | /22/main.cpp | 948d0c5a997a4e194c2f4d28d3ac554b8b576fbd | [] | no_license | mkhrystunov/euler | c8e744140cb6245860c447cd7729cf8ad490a039 | 52c71ae72ef5889e5f38f1d479cc1cc9db35c589 | refs/heads/master | 2016-09-05T13:41:27.670971 | 2014-05-23T10:02:29 | 2014-05-23T10:02:29 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,115 | cpp | #include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <errno.h>
#include <sys/types.h>
#include <unistd.h>
#include <string>
#define BUF_SIZE 8192
using namespace std;
int main(int argc, char* argv[])
{
int input_fd; // input file descriptor
ssize_t ret_in; // number of bytes returned by read()
char buff; // character buffer
int amount = 0;
if(argc != 2)
{
printf("Error input\n");
return 1;
}
input_fd = open(argv[1], O_RDONLY);
if(input_fd == -1)
{
perror("open");
return 2;
}
while((ret_in = read(input_fd, &buff, 1)) > 0)
{
if(buff == ',')
amount += 1;
}
printf("\033[1;33mtotal: %d\n\033[0m", amount);
string names[amount];
lseek(input_fd, 0, SEEK_SET); // change file offset to the start
int n = 0;
while((ret_in = read(input_fd, &buff, 1)) > 0)
{
if(buff == ',')
{
n++;
printf("%d ", n);
continue;
}
if(buff != '"')
{
names[n] += buff;
}
}
for(int i=0; i<amount; i++)
printf("%s ", names[i].c_str());
printf("\n\n");
close(input_fd);
return 0;
} | [
"m.khrystunov@partner.samsung.com"
] | m.khrystunov@partner.samsung.com |
891e751ec5b2c7c91ab3e702010315ab3c3d455b | 3da0b0276bc8c3d7d1bcdbabfb0e763a38d3a24c | /zju.finished/2970.cpp | 3d2b36a17ea4ab8ce417331803068037bb3f6c98 | [] | no_license | usherfu/zoj | 4af6de9798bcb0ffa9dbb7f773b903f630e06617 | 8bb41d209b54292d6f596c5be55babd781610a52 | refs/heads/master | 2021-05-28T11:21:55.965737 | 2009-12-15T07:58:33 | 2009-12-15T07:58:33 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 809 | cpp | #include<iostream>
#include<cstring>
using namespace std;
char buf[20];
int Minest(){
int n;
int a, b;
scanf("%d ", &n);
for (int i=0; i<n; i++){
scanf("%d ", &b);
if ( i==0){
a = b;
} else {
a = min(a, b);
}
}
return a;
}
int Maxest(){
int n;
int a, b;
scanf("%d ", &n);
for (int i=0; i<n; i++){
scanf("%d ", &b);
if ( i==0){
a = b;
} else {
a = max(a, b);
}
}
return a;
}
int main(){
int n;
scanf("%d ", &n);
while(n--){
scanf("%s", buf);
int t;
if (strcmp(buf, "Faster")==0){
t = Minest();
} else {
t = Maxest();
}
printf("%d\n", t);
}
return 0;
}
| [
"zhouweikuan@gmail.com"
] | zhouweikuan@gmail.com |
207ad154f485fb61f4ac2512a6b5babd1dd49afe | d61d05748a59a1a73bbf3c39dd2c1a52d649d6e3 | /chromium/media/learning/common/learning_task.cc | 07cc4079005e9514e2625a90325b791a26331720 | [
"BSD-3-Clause"
] | permissive | Csineneo/Vivaldi | 4eaad20fc0ff306ca60b400cd5fad930a9082087 | d92465f71fb8e4345e27bd889532339204b26f1e | refs/heads/master | 2022-11-23T17:11:50.714160 | 2019-05-25T11:45:11 | 2019-05-25T11:45:11 | 144,489,531 | 5 | 4 | BSD-3-Clause | 2022-11-04T05:55:33 | 2018-08-12T18:04:37 | null | UTF-8 | C++ | false | false | 769 | cc | // Copyright 2018 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 "media/learning/common/learning_task.h"
namespace media {
namespace learning {
LearningTask::LearningTask() = default;
LearningTask::LearningTask(
const std::string& name,
Model model,
std::initializer_list<ValueDescription> feature_init_list,
ValueDescription target_description)
: name(name),
model(model),
feature_descriptions(std::move(feature_init_list)),
target_description(target_description) {}
LearningTask::LearningTask(const LearningTask&) = default;
LearningTask::~LearningTask() = default;
} // namespace learning
} // namespace media
| [
"csineneo@gmail.com"
] | csineneo@gmail.com |
d6e665647b8ea7facf86b9c437e437d1c4513022 | c7161d63b6893d052268cea9a05de5d910c0f322 | /mapmodel/way.cpp | 45b5b3079cbe50c5c8df46fe433ad48431bffb69 | [] | no_license | ryfx/opencitymap | 2d124b6f1b81468ee7556c5428bb27f7283c0bbc | 28294c01d9082f3d261a241d0bdff763c67607b7 | refs/heads/master | 2021-01-18T19:28:40.849463 | 2008-06-20T22:38:55 | 2008-06-20T22:38:55 | 41,011,200 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 802 | cpp | #include "way.h"
// Constructors/Destructors
//
Way::Way()
{
//qDebug() <<"Created new Way";
}
Way::~Way()
{
}
Way::Way( QList<Node*> nodes)
{
//qDebug() <<"Created new Way with "<< nodes.size()<< " Nodes";
m_nodes = nodes;
}
// Private attribute accessor methods
//
const QString
Way::getTagValue( QString key) const
{
for (int i=0; i < m_tags.size( ); ++i)
{
if (m_tags[i]->getKey() == key)
{
return m_tags[i]->getValue();
}
}
return 0;
}
/**
* Set the value of timestamp
* @param time the new value of timestamp
*/
void
Way::setTimestamp ( QString time )
{
m_timestamp = time;
}
/**
* Set the value of nodes
* @param nodes the new value of nodes
*/
void
Way::setNodes ( QList<Node*> nodes )
{
m_nodes = nodes;
}
| [
"mickey.leroy@7c92a9e6-f44e-0410-9ddb-d5c751b320e7"
] | mickey.leroy@7c92a9e6-f44e-0410-9ddb-d5c751b320e7 |
57355d612ac33969851f3b12407e5712601df7d2 | 256a439099395ef4739248a53943ed3f3c9a8c5b | /lib/TSThread.h | b4e49d4bbc0abbc380ee9018f63a1755d63b6559 | [
"MIT"
] | permissive | timkerchmar/tsintegration | 3ee3629e0e65e2c8920c73b31cd8a0f7454ca868 | cbe207942facff17e5cdcef7533d703bcefc9897 | refs/heads/master | 2020-03-13T15:54:56.610339 | 2018-05-06T15:48:22 | 2018-05-06T15:48:22 | 131,186,844 | 7 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 717 | h | #ifndef TSTHREAD_H
#define TSTHREAD_H
#include <string>
#include <sys/types.h>
#ifdef WIN32
#include <Windows.h>
#else
#include <pthread.h>
#endif
class TSMutex
{
public:
TSMutex();
#ifdef WIN32
CRITICAL_SECTION handle;
#else
pthread_mutex_t handle;
#endif
void lock();
void unlock();
};
class TSConditionVariable
{
public:
TSConditionVariable();
#ifdef WIN32
CONDITION_VARIABLE handle;
#else
pthread_cond_t handle;
#endif
void wait(TSMutex &mutex);
void notify();
};
class TSThread
{
public:
void start();
virtual void run() = 0;
virtual std::string name() = 0;
#ifdef WIN32
HANDLE handle;
#else
pthread_t handle;
#endif
};
#endif //TSTHREAD_H
| [
"ptymn1447@hotmail.com"
] | ptymn1447@hotmail.com |
68c72d2450b88a1d951f6e4f0abdaf2edce49a3d | 5ce02d5440c35192aa81498b5bcbce1cd97549b2 | /LIBRARY777/borrowbookwin.h | 36ceb69ed4e584ebe6f0f3c0c606abbfee9d2710 | [] | no_license | tyj1997/Library201706 | 96b79c4fdb0bf1065eb6282dfffde7252be3c654 | 12d8888ff742b7d6fd60373d0e53bab120aab6dd | refs/heads/master | 2021-07-02T02:36:57.771052 | 2017-09-22T03:00:31 | 2017-09-22T03:00:31 | 104,423,860 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 365 | h | #ifndef BORROWBOOK_H
#define BORROWBOOK_H
#include <QDialog>
#include "data.h"
namespace Ui {
class BorrowBookWin;
}
class BorrowBookWin : public QDialog
{
Q_OBJECT
public:
explicit BorrowBookWin(QWidget *parent = 0);
~BorrowBookWin();
private slots:
void on_pushButton_clicked();
private:
Ui::BorrowBookWin *ui;
};
#endif // BORROWBOOK_H
| [
"305099672@qq.com"
] | 305099672@qq.com |
a008e400a348dacc58d4b1fe1447f95cb2a1c1e0 | 33fd5786ddde55a705d74ce2ce909017e2535065 | /build/iOS/Release/src/iphod.Versical.cpp | d958e99e6a88410fe5b92c1a9f2a8a52882f33a2 | [] | no_license | frpaulas/iphodfuse | 04cee30add8b50ea134eb5a83e355dce886a5d5a | e8886638c4466b3b0c6299da24156d4ee81c9112 | refs/heads/master | 2021-01-23T00:48:31.195577 | 2017-06-01T12:33:13 | 2017-06-01T12:33:13 | 92,842,106 | 3 | 3 | null | 2017-05-30T17:43:28 | 2017-05-30T14:33:26 | C++ | UTF-8 | C++ | false | false | 15,452 | cpp | // This file was generated based on '.uno/ux11/iphod.Versical.g.uno'.
// WARNING: Changes might be lost if you edit this file directly.
#include <_root.iphod_accessor_-39b8af92.h>
#include <_root.iphod_accessor_-678428fe.h>
#include <_root.iphod_FuseContr-3d8d18a9.h>
#include <_root.iphod_iphodVers-3b51c231.h>
#include <_root.iphod_iphodVers-42b6503b.h>
#include <Fuse.Controls.TextControl.h>
#include <Fuse.Elements.Element.h>
#include <Fuse.Reactive.BindingMode.h>
#include <Fuse.Reactive.Constan-264ec80.h>
#include <Fuse.Reactive.DataBinding.h>
#include <Fuse.Reactive.IExpression.h>
#include <Fuse.Reactive.Property.h>
#include <Fuse.Reactive.This.h>
#include <Fuse.Visual.h>
#include <iphod.Italic.h>
#include <iphod.Regular.h>
#include <iphod.Versical.h>
#include <Uno.Bool.h>
#include <Uno.Float.h>
#include <Uno.Float4.h>
#include <Uno.Object.h>
#include <Uno.String.h>
#include <Uno.UX.NameTable.h>
#include <Uno.UX.Property.h>
#include <Uno.UX.Property-1.h>
#include <Uno.UX.PropertyAccessor.h>
#include <Uno.UX.PropertyObject.h>
#include <Uno.UX.Selector.h>
static uString* STRINGS[5];
static uType* TYPES[4];
namespace g{
namespace iphod{
// public partial sealed class Versical :4
// {
// static Versical() :43
static void Versical__cctor_4_fn(uType* __type)
{
Versical::__g_static_nametable1_ = uArray::Init<uString*>(::TYPES[0/*string[]*/], 0);
Versical::__selector0_ = ::g::Uno::UX::Selector__op_Implicit(::STRINGS[0/*"Value"*/]);
Versical::__selector1_ = ::g::Uno::UX::Selector__op_Implicit(::STRINGS[1/*"Speaker"*/]);
Versical::__selector2_ = ::g::Uno::UX::Selector__op_Implicit(::STRINGS[2/*"Text"*/]);
}
static void Versical_build(uType* type)
{
::STRINGS[0] = uString::Const("Value");
::STRINGS[1] = uString::Const("Speaker");
::STRINGS[2] = uString::Const("Text");
::STRINGS[3] = uString::Const("auto");
::STRINGS[4] = uString::Const("70, 290");
::TYPES[0] = ::g::Uno::String_typeof()->Array();
::TYPES[1] = ::g::Uno::Collections::ICollection_typeof()->MakeType(::g::Fuse::Binding_typeof(), NULL);
::TYPES[2] = ::g::Uno::Collections::ICollection_typeof()->MakeType(::g::Uno::UX::Property_typeof(), NULL);
::TYPES[3] = ::g::Uno::Collections::ICollection_typeof()->MakeType(::g::Fuse::Node_typeof(), NULL);
type->SetInterfaces(
::g::Uno::Collections::IList_typeof()->MakeType(::g::Fuse::Binding_typeof(), NULL), offsetof(::g::Fuse::Controls::Control_type, interface0),
::g::Fuse::Scripting::IScriptObject_typeof(), offsetof(::g::Fuse::Controls::Control_type, interface1),
::g::Fuse::IProperties_typeof(), offsetof(::g::Fuse::Controls::Control_type, interface2),
::g::Fuse::INotifyUnrooted_typeof(), offsetof(::g::Fuse::Controls::Control_type, interface3),
::TYPES[1/*Uno.Collections.ICollection<Fuse.Binding>*/], offsetof(::g::Fuse::Controls::Control_type, interface4),
::g::Uno::Collections::IEnumerable_typeof()->MakeType(::g::Fuse::Binding_typeof(), NULL), offsetof(::g::Fuse::Controls::Control_type, interface5),
::g::Uno::Collections::IList_typeof()->MakeType(::g::Fuse::Node_typeof(), NULL), offsetof(::g::Fuse::Controls::Control_type, interface6),
::g::Uno::UX::IPropertyListener_typeof(), offsetof(::g::Fuse::Controls::Control_type, interface7),
::TYPES[3/*Uno.Collections.ICollection<Fuse.Node>*/], offsetof(::g::Fuse::Controls::Control_type, interface8),
::g::Uno::Collections::IEnumerable_typeof()->MakeType(::g::Fuse::Node_typeof(), NULL), offsetof(::g::Fuse::Controls::Control_type, interface9),
::g::Fuse::Triggers::Actions::IShow_typeof(), offsetof(::g::Fuse::Controls::Control_type, interface10),
::g::Fuse::Triggers::Actions::IHide_typeof(), offsetof(::g::Fuse::Controls::Control_type, interface11),
::g::Fuse::Triggers::Actions::ICollapse_typeof(), offsetof(::g::Fuse::Controls::Control_type, interface12),
::g::Fuse::IActualPlacement_typeof(), offsetof(::g::Fuse::Controls::Control_type, interface13),
::g::Fuse::Animations::IResize_typeof(), offsetof(::g::Fuse::Controls::Control_type, interface14));
type->SetFields(99,
::g::Uno::UX::NameTable_typeof(), offsetof(::g::iphod::Versical, __g_nametable1), 0,
::g::Uno::String_typeof(), offsetof(::g::iphod::Versical, _field_Speaker), 0,
::g::Uno::String_typeof(), offsetof(::g::iphod::Versical, _field_Text), 0,
::g::Uno::UX::Property1_typeof()->MakeType(::g::Uno::String_typeof(), NULL), offsetof(::g::iphod::Versical, temp_Value_inst), 0,
::g::Uno::UX::Property1_typeof()->MakeType(::g::Uno::String_typeof(), NULL), offsetof(::g::iphod::Versical, temp1_Value_inst), 0,
::g::Uno::UX::Property1_typeof()->MakeType(::g::Uno::String_typeof(), NULL), offsetof(::g::iphod::Versical, this_Speaker_inst), 0,
::g::Uno::UX::Property1_typeof()->MakeType(::g::Uno::String_typeof(), NULL), offsetof(::g::iphod::Versical, this_Text_inst), 0,
::TYPES[0/*string[]*/], (uintptr_t)&::g::iphod::Versical::__g_static_nametable1_, uFieldFlagsStatic,
::g::Uno::UX::Selector_typeof(), (uintptr_t)&::g::iphod::Versical::__selector0_, uFieldFlagsStatic,
::g::Uno::UX::Selector_typeof(), (uintptr_t)&::g::iphod::Versical::__selector1_, uFieldFlagsStatic,
::g::Uno::UX::Selector_typeof(), (uintptr_t)&::g::iphod::Versical::__selector2_, uFieldFlagsStatic);
}
::g::Fuse::Controls::Control_type* Versical_typeof()
{
static uSStrong< ::g::Fuse::Controls::Control_type*> type;
if (type != NULL) return type;
uTypeOptions options;
options.BaseDefinition = ::g::Fuse::Controls::Grid_typeof();
options.FieldCount = 110;
options.InterfaceCount = 15;
options.ObjectSize = sizeof(Versical);
options.TypeSize = sizeof(::g::Fuse::Controls::Control_type);
type = (::g::Fuse::Controls::Control_type*)uClassType::New("iphod.Versical", options);
type->fp_build_ = Versical_build;
type->fp_ctor_ = (void*)Versical__New5_fn;
type->fp_cctor_ = Versical__cctor_4_fn;
type->interface10.fp_Show = (void(*)(uObject*))::g::Fuse::Elements::Element__FuseTriggersActionsIShowShow_fn;
type->interface12.fp_Collapse = (void(*)(uObject*))::g::Fuse::Elements::Element__FuseTriggersActionsICollapseCollapse_fn;
type->interface11.fp_Hide = (void(*)(uObject*))::g::Fuse::Elements::Element__FuseTriggersActionsIHideHide_fn;
type->interface14.fp_SetSize = (void(*)(uObject*, ::g::Uno::Float2*))::g::Fuse::Elements::Element__FuseAnimationsIResizeSetSize_fn;
type->interface13.fp_get_ActualSize = (void(*)(uObject*, ::g::Uno::Float3*))::g::Fuse::Elements::Element__FuseIActualPlacementget_ActualSize_fn;
type->interface13.fp_add_Placed = (void(*)(uObject*, uDelegate*))::g::Fuse::Elements::Element__add_Placed_fn;
type->interface13.fp_remove_Placed = (void(*)(uObject*, uDelegate*))::g::Fuse::Elements::Element__remove_Placed_fn;
type->interface8.fp_Clear = (void(*)(uObject*))::g::Fuse::Visual__UnoCollectionsICollectionFuseNodeClear_fn;
type->interface8.fp_Contains = (void(*)(uObject*, void*, bool*))::g::Fuse::Visual__UnoCollectionsICollectionFuseNodeContains_fn;
type->interface6.fp_RemoveAt = (void(*)(uObject*, int*))::g::Fuse::Visual__UnoCollectionsIListFuseNodeRemoveAt_fn;
type->interface9.fp_GetEnumerator = (void(*)(uObject*, uObject**))::g::Fuse::Visual__UnoCollectionsIEnumerableFuseNodeGetEnumerator_fn;
type->interface8.fp_get_Count = (void(*)(uObject*, int*))::g::Fuse::Visual__UnoCollectionsICollectionFuseNodeget_Count_fn;
type->interface6.fp_get_Item = (void(*)(uObject*, int*, uTRef))::g::Fuse::Visual__UnoCollectionsIListFuseNodeget_Item_fn;
type->interface6.fp_Insert = (void(*)(uObject*, int*, void*))::g::Fuse::Visual__Insert1_fn;
type->interface7.fp_OnPropertyChanged = (void(*)(uObject*, ::g::Uno::UX::PropertyObject*, ::g::Uno::UX::Selector*))::g::Fuse::Controls::Control__OnPropertyChanged2_fn;
type->interface8.fp_Add = (void(*)(uObject*, void*))::g::Fuse::Visual__Add1_fn;
type->interface8.fp_Remove = (void(*)(uObject*, void*, bool*))::g::Fuse::Visual__Remove1_fn;
type->interface4.fp_Clear = (void(*)(uObject*))::g::Fuse::Node__UnoCollectionsICollectionFuseBindingClear_fn;
type->interface4.fp_Contains = (void(*)(uObject*, void*, bool*))::g::Fuse::Node__UnoCollectionsICollectionFuseBindingContains_fn;
type->interface0.fp_RemoveAt = (void(*)(uObject*, int*))::g::Fuse::Node__UnoCollectionsIListFuseBindingRemoveAt_fn;
type->interface5.fp_GetEnumerator = (void(*)(uObject*, uObject**))::g::Fuse::Node__UnoCollectionsIEnumerableFuseBindingGetEnumerator_fn;
type->interface1.fp_SetScriptObject = (void(*)(uObject*, uObject*, ::g::Fuse::Scripting::Context*))::g::Fuse::Node__FuseScriptingIScriptObjectSetScriptObject_fn;
type->interface4.fp_get_Count = (void(*)(uObject*, int*))::g::Fuse::Node__UnoCollectionsICollectionFuseBindingget_Count_fn;
type->interface0.fp_get_Item = (void(*)(uObject*, int*, uTRef))::g::Fuse::Node__UnoCollectionsIListFuseBindingget_Item_fn;
type->interface1.fp_get_ScriptObject = (void(*)(uObject*, uObject**))::g::Fuse::Node__FuseScriptingIScriptObjectget_ScriptObject_fn;
type->interface1.fp_get_ScriptContext = (void(*)(uObject*, ::g::Fuse::Scripting::Context**))::g::Fuse::Node__FuseScriptingIScriptObjectget_ScriptContext_fn;
type->interface3.fp_add_Unrooted = (void(*)(uObject*, uDelegate*))::g::Fuse::Node__FuseINotifyUnrootedadd_Unrooted_fn;
type->interface3.fp_remove_Unrooted = (void(*)(uObject*, uDelegate*))::g::Fuse::Node__FuseINotifyUnrootedremove_Unrooted_fn;
type->interface0.fp_Insert = (void(*)(uObject*, int*, void*))::g::Fuse::Node__Insert_fn;
type->interface2.fp_get_Properties = (void(*)(uObject*, ::g::Fuse::Properties**))::g::Fuse::Node__get_Properties_fn;
type->interface4.fp_Add = (void(*)(uObject*, void*))::g::Fuse::Node__Add_fn;
type->interface4.fp_Remove = (void(*)(uObject*, void*, bool*))::g::Fuse::Node__Remove_fn;
return type;
}
// public Versical() :47
void Versical__ctor_8_fn(Versical* __this)
{
__this->ctor_8();
}
// private void InitializeUX() :51
void Versical__InitializeUX_fn(Versical* __this)
{
__this->InitializeUX();
}
// public Versical New() :47
void Versical__New5_fn(Versical** __retval)
{
*__retval = Versical::New5();
}
// public void SetSpeaker(string value, Uno.UX.IPropertyListener origin) :13
void Versical__SetSpeaker_fn(Versical* __this, uString* value, uObject* origin)
{
__this->SetSpeaker(value, origin);
}
// public void SetText(string value, Uno.UX.IPropertyListener origin) :28
void Versical__SetText_fn(Versical* __this, uString* value, uObject* origin)
{
__this->SetText(value, origin);
}
// public string get_Speaker() :10
void Versical__get_Speaker_fn(Versical* __this, uString** __retval)
{
*__retval = __this->Speaker();
}
// public void set_Speaker(string value) :11
void Versical__set_Speaker_fn(Versical* __this, uString* value)
{
__this->Speaker(value);
}
// public string get_Text() :25
void Versical__get_Text_fn(Versical* __this, uString** __retval)
{
*__retval = __this->Text();
}
// public void set_Text(string value) :26
void Versical__set_Text_fn(Versical* __this, uString* value)
{
__this->Text(value);
}
uSStrong<uArray*> Versical::__g_static_nametable1_;
::g::Uno::UX::Selector Versical::__selector0_;
::g::Uno::UX::Selector Versical::__selector1_;
::g::Uno::UX::Selector Versical::__selector2_;
// public Versical() [instance] :47
void Versical::ctor_8()
{
ctor_7();
InitializeUX();
}
// private void InitializeUX() [instance] :51
void Versical::InitializeUX()
{
::g::Fuse::Reactive::This* temp2 = ::g::Fuse::Reactive::This::New1();
::g::iphod::Italic* temp = ::g::iphod::Italic::New5();
temp_Value_inst = ::g::iphod_FuseControlsTextControl_Value_Property::New1(temp, Versical::__selector0());
::g::Fuse::Reactive::Property* temp3 = ::g::Fuse::Reactive::Property::New1(temp2, ::g::iphod_accessor_iphod_Versical_Speaker::Singleton());
this_Speaker_inst = ::g::iphod_iphodVersical_Speaker_Property::New1(this, Versical::__selector1());
this_Text_inst = ::g::iphod_iphodVersical_Text_Property::New1(this, Versical::__selector2());
__g_nametable1 = ::g::Uno::UX::NameTable::New1(NULL, Versical::__g_static_nametable1());
::g::Fuse::Reactive::This* temp4 = ::g::Fuse::Reactive::This::New1();
::g::iphod::Regular* temp1 = ::g::iphod::Regular::New5();
temp1_Value_inst = ::g::iphod_FuseControlsTextControl_Value_Property::New1(temp1, Versical::__selector0());
::g::Fuse::Reactive::Property* temp5 = ::g::Fuse::Reactive::Property::New1(temp4, ::g::iphod_accessor_iphod_Versical_Text::Singleton());
::g::Fuse::Reactive::DataBinding* temp6 = ::g::Fuse::Reactive::DataBinding::New1(temp_Value_inst, (uObject*)temp3, __g_nametable1, 1);
::g::Fuse::Reactive::DataBinding* temp7 = ::g::Fuse::Reactive::DataBinding::New1(temp1_Value_inst, (uObject*)temp5, __g_nametable1, 1);
DefaultRow(::STRINGS[3/*"auto"*/]);
Columns(::STRINGS[4/*"70, 290"*/]);
Margin(::g::Uno::Float4__New2(5.0f, 0.0f, 5.0f, 0.0f));
::g::Uno::Collections::ICollection::Add_ex(uInterface(uPtr(temp->Bindings()), ::TYPES[1/*Uno.Collections.ICollection<Fuse.Binding>*/]), temp6);
::g::Uno::Collections::ICollection::Add_ex(uInterface(uPtr(temp1->Bindings()), ::TYPES[1/*Uno.Collections.ICollection<Fuse.Binding>*/]), temp7);
uPtr(__g_nametable1)->This(this);
::g::Uno::Collections::ICollection::Add_ex(uInterface(uPtr(uPtr(__g_nametable1)->Properties()), ::TYPES[2/*Uno.Collections.ICollection<Uno.UX.Property>*/]), this_Speaker_inst);
::g::Uno::Collections::ICollection::Add_ex(uInterface(uPtr(uPtr(__g_nametable1)->Properties()), ::TYPES[2/*Uno.Collections.ICollection<Uno.UX.Property>*/]), this_Text_inst);
::g::Uno::Collections::ICollection::Add_ex(uInterface(uPtr(Children()), ::TYPES[3/*Uno.Collections.ICollection<Fuse.Node>*/]), temp);
::g::Uno::Collections::ICollection::Add_ex(uInterface(uPtr(Children()), ::TYPES[3/*Uno.Collections.ICollection<Fuse.Node>*/]), temp1);
}
// public void SetSpeaker(string value, Uno.UX.IPropertyListener origin) [instance] :13
void Versical::SetSpeaker(uString* value, uObject* origin)
{
if (::g::Uno::String::op_Inequality(value, _field_Speaker))
{
_field_Speaker = value;
OnPropertyChanged1(::g::Uno::UX::Selector__op_Implicit(::STRINGS[1/*"Speaker"*/]), origin);
}
}
// public void SetText(string value, Uno.UX.IPropertyListener origin) [instance] :28
void Versical::SetText(uString* value, uObject* origin)
{
if (::g::Uno::String::op_Inequality(value, _field_Text))
{
_field_Text = value;
OnPropertyChanged1(::g::Uno::UX::Selector__op_Implicit(::STRINGS[2/*"Text"*/]), origin);
}
}
// public string get_Speaker() [instance] :10
uString* Versical::Speaker()
{
return _field_Speaker;
}
// public void set_Speaker(string value) [instance] :11
void Versical::Speaker(uString* value)
{
SetSpeaker(value, NULL);
}
// public string get_Text() [instance] :25
uString* Versical::Text()
{
return _field_Text;
}
// public void set_Text(string value) [instance] :26
void Versical::Text(uString* value)
{
SetText(value, NULL);
}
// public Versical New() [static] :47
Versical* Versical::New5()
{
Versical* obj1 = (Versical*)uNew(Versical_typeof());
obj1->ctor_8();
return obj1;
}
// }
}} // ::g::iphod
| [
"frpaulas@gmail.com"
] | frpaulas@gmail.com |
1e18901b55bb6d0f06c3474cb3fce627ab828a1d | 3e79056f6c3ab04fd84806737c324a16562870c2 | /baekjoon/15589.cpp | 8866f2d98490f14f5e2c3930e725ba09ff3e55a5 | [] | no_license | seunghyukcho/algorithm-problems-solved | ce52f11a12b532c51547fd215e53e1f60915f52a | 04e78a4b41a8b13c1d00e231dd79114fb8360c9a | refs/heads/master | 2023-07-14T11:37:33.763943 | 2021-08-20T15:09:50 | 2021-08-20T15:09:50 | 125,701,552 | 6 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,540 | cpp | #include<iostream>
#include<algorithm>
using namespace std;
int top, ans, N, mn = 1e9;
struct LG {
int start, end, cover, idx;
} cow[100002];
LG st[100002];
bool comp(LG l1, LG l2) { return l1.end < l2.end; }
int main(){
ios::sync_with_stdio(false);
cin >> N;
for(int i = 0; i < N; i++) {
cin >> cow[i].start >> cow[i].end;
cow[i].cover = cow[i].end - cow[i].start;
}
sort(cow, cow + N, comp);
for(int i = 0; i < N; i++) cow[i].idx = i;
for(int i = 0; i < N; i++) {
while(top && st[top - 1].start >= cow[i].start) {
if(top == 1 || st[top - 2].end < st[top - 1].start) ans -= st[top - 1].cover;
else ans -= st[top - 1].end - st[top - 2].end;
cow[st[top - 1].idx].cover = 0;
mn = 0;
top--;
}
if(!top) {
st[top++] = cow[i];
ans += cow[i].cover;
mn = min(mn, cow[i].cover);
} else {
if(st[top - 1].end > cow[i].start) {
int diff = st[top - 1].end - cow[i].start;
ans = ans - diff + cow[i].cover;
cow[st[top - 1].idx].cover = max(0, cow[st[top - 1].idx].cover - diff);
cow[i].cover -= diff;
mn = min(mn, min(cow[st[top - 1].idx].cover, cow[i].cover));
} else {
mn = min(mn, cow[i].cover);
ans += cow[i].cover;
}
st[top++] = cow[i];
}
}
cout << ans - mn << '\n';
return 0;
}
| [
"choseunghyek@gmail.com"
] | choseunghyek@gmail.com |
a9bdf2977ab468c2a867cc6c09b5d82b383cace9 | 67dfb56a4d1ba36462d52bdfdc5492a8ac586b94 | /api-cpp/src/TimeUnit.cpp | 29731b57394bda27d1826bc93eb9df13fda0a8f7 | [
"LicenseRef-scancode-warranty-disclaimer",
"Apache-2.0"
] | permissive | fisherab/r-gma | 7c0f5657fcec88c7713d7e66e5610982b5d2d7d3 | 7ba2ad42c3332b39ab07eb9a9bb25ef1b4afe3ad | refs/heads/master | 2016-09-03T00:34:34.017547 | 2011-08-27T02:15:26 | 2011-08-27T02:15:26 | 32,185,595 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,160 | cpp | /*
* Copyright (c) 2004 on behalf of the EU EGEE Project:
* The European Organization for Nuclear Research (CERN),
* Istituto Nazionale di Fisica Nucleare (INFN), Italy
* Datamat Spa, Italy
* Centre National de la Recherche Scientifique (CNRS), France
* CS Systeme d'Information (CSSI), France
* Royal Institute of Technology, Center for Parallel Computers (KTH-PDC), Sweden
* Universiteit van Amsterdam (UvA), Netherlands
* University of Helsinki (UH.HIP), Finland
* University of Bergen (UiB), Norway
* Council for the Central Laboratory of the Research Councils (CCLRC), United Kingdom
*/
#include "rgma/TimeUnit.h"
#include <sstream>
#include <string>
namespace glite {
namespace rgma {
const TimeUnit TimeUnit::SECONDS("SECONDS", 1);
const TimeUnit TimeUnit::MINUTES("MINUTES", 60);
const TimeUnit TimeUnit::HOURS("HOURS", 3600);
const TimeUnit TimeUnit::DAYS("DAYS", 86400);
TimeUnit::TimeUnit(std::string name, int ratio) :
m_name(name), m_ratio(ratio) {
}
int TimeUnit::getSecs() const {
return m_ratio;
}
std::ostream& operator<<(std::ostream& stream, const TimeUnit & tu) {
return stream << tu.m_name;
}
}
}
| [
"dr.s.m.fisher@gmail.com@9fd00241-c8d1-a2cc-6176-14b799de2eb9"
] | dr.s.m.fisher@gmail.com@9fd00241-c8d1-a2cc-6176-14b799de2eb9 |
5010353261cee3887e3256e1a4643293bac1fdbf | 4d418c7e7d3b64a71f1dad31f568197921d75526 | /Src/qtwebengine/src/core/renderer/web_channel_ipc_transport.cpp | e508e85f1053164babea422b1ec75a20df9aafa5 | [] | no_license | dalamber/qt-5.7.0-patch | 5e9538f0c24aed4717e8a4a7644922198c553caf | 9099b1e9f973d0f62b31175cb91c9938599cedb1 | refs/heads/master | 2021-01-20T19:39:48.758569 | 2016-08-03T10:19:25 | 2016-08-03T10:19:25 | 64,714,310 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 9,998 | cpp | /****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the QtWebEngine module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 2.0 or (at your option) the GNU General
** Public license version 3 or any later version approved by the KDE Free
** Qt Foundation. The licenses are as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-2.0.html and
** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "renderer/web_channel_ipc_transport.h"
#include "common/qt_messages.h"
#include "content/public/renderer/render_view.h"
#include "gin/arguments.h"
#include "gin/handle.h"
#include "gin/object_template_builder.h"
#include "gin/wrappable.h"
#include "third_party/WebKit/public/web/WebLocalFrame.h"
#include "third_party/WebKit/public/web/WebView.h"
#include "v8/include/v8.h"
#include <QJsonDocument>
namespace QtWebEngineCore {
class WebChannelTransport : public gin::Wrappable<WebChannelTransport> {
public:
static gin::WrapperInfo kWrapperInfo;
static void Install(blink::WebFrame *frame, uint worldId);
static void Uninstall(blink::WebFrame *frame, uint worldId);
private:
content::RenderView *GetRenderView(v8::Isolate *isolate);
WebChannelTransport() { }
virtual gin::ObjectTemplateBuilder GetObjectTemplateBuilder(v8::Isolate *isolate) override;
void NativeQtSendMessage(gin::Arguments *args)
{
content::RenderView *renderView = GetRenderView(args->isolate());
if (!renderView || args->Length() != 1)
return;
v8::Handle<v8::Value> val;
args->GetNext(&val);
if (!val->IsString() && !val->IsStringObject())
return;
v8::String::Utf8Value utf8(val->ToString());
QByteArray valueData(*utf8, utf8.length());
QJsonParseError error;
QJsonDocument doc = QJsonDocument::fromJson(valueData, &error);
if (error.error != QJsonParseError::NoError)
qWarning("%s %d: Parsing error: %s",__FILE__, __LINE__, qPrintable(error.errorString()));
int size = 0;
const char *rawData = doc.rawData(&size);
renderView->Send(new WebChannelIPCTransportHost_SendMessage(renderView->GetRoutingID(), std::vector<char>(rawData, rawData + size)));
}
DISALLOW_COPY_AND_ASSIGN(WebChannelTransport);
};
gin::WrapperInfo WebChannelTransport::kWrapperInfo = { gin::kEmbedderNativeGin };
void WebChannelTransport::Install(blink::WebFrame *frame, uint worldId)
{
v8::Isolate *isolate = v8::Isolate::GetCurrent();
v8::HandleScope handleScope(isolate);
v8::Handle<v8::Context> context;
if (worldId == 0)
context = frame->mainWorldScriptContext();
else
context = frame->toWebLocalFrame()->isolatedWorldScriptContext(worldId, 0);
v8::Context::Scope contextScope(context);
gin::Handle<WebChannelTransport> transport = gin::CreateHandle(isolate, new WebChannelTransport);
v8::Handle<v8::Object> global = context->Global();
v8::Handle<v8::Object> qt = global->Get(gin::StringToV8(isolate, "qt"))->ToObject();
if (qt.IsEmpty()) {
qt = v8::Object::New(isolate);
global->Set(gin::StringToV8(isolate, "qt"), qt);
}
qt->Set(gin::StringToV8(isolate, "webChannelTransport"), transport.ToV8());
}
void WebChannelTransport::Uninstall(blink::WebFrame *frame, uint worldId)
{
v8::Isolate *isolate = v8::Isolate::GetCurrent();
v8::HandleScope handleScope(isolate);
v8::Handle<v8::Context> context;
if (worldId == 0)
context = frame->mainWorldScriptContext();
else
context = frame->toWebLocalFrame()->isolatedWorldScriptContext(worldId, 0);
v8::Context::Scope contextScope(context);
v8::Handle<v8::Object> global(context->Global());
v8::Handle<v8::Object> qt = global->Get(gin::StringToV8(isolate, "qt"))->ToObject();
if (qt.IsEmpty())
return;
qt->Delete(gin::StringToV8(isolate, "webChannelTransport"));
}
gin::ObjectTemplateBuilder WebChannelTransport::GetObjectTemplateBuilder(v8::Isolate *isolate)
{
return gin::Wrappable<WebChannelTransport>::GetObjectTemplateBuilder(isolate).SetMethod("send", &WebChannelTransport::NativeQtSendMessage);
}
content::RenderView *WebChannelTransport::GetRenderView(v8::Isolate *isolate)
{
blink::WebLocalFrame *webframe = blink::WebLocalFrame::frameForContext(isolate->GetCurrentContext());
DCHECK(webframe) << "There should be an active frame since we just got a native function called.";
if (!webframe)
return 0;
blink::WebView *webview = webframe->view();
if (!webview)
return 0; // can happen during closing
return content::RenderView::FromWebView(webview);
}
WebChannelIPCTransport::WebChannelIPCTransport(content::RenderView *renderView)
: content::RenderViewObserver(renderView)
, m_installed(false)
, m_installedWorldId(0)
{
}
void WebChannelIPCTransport::installWebChannel(uint worldId)
{
blink::WebView *webView = render_view()->GetWebView();
if (!webView)
return;
WebChannelTransport::Install(webView->mainFrame(), worldId);
m_installed = true;
m_installedWorldId = worldId;
}
void WebChannelIPCTransport::uninstallWebChannel(uint worldId)
{
blink::WebView *webView = render_view()->GetWebView();
if (!webView)
return;
WebChannelTransport::Uninstall(webView->mainFrame(), worldId);
m_installedWorldId = 0;
}
void WebChannelIPCTransport::dispatchWebChannelMessage(const std::vector<char> &binaryJSON, uint worldId)
{
blink::WebView *webView = render_view()->GetWebView();
if (!webView)
return;
QJsonDocument doc = QJsonDocument::fromRawData(binaryJSON.data(), binaryJSON.size(), QJsonDocument::BypassValidation);
Q_ASSERT(doc.isObject());
QByteArray json = doc.toJson(QJsonDocument::Compact);
v8::Isolate *isolate = v8::Isolate::GetCurrent();
v8::HandleScope handleScope(isolate);
blink::WebFrame *frame = webView->mainFrame();
v8::Handle<v8::Context> context;
if (worldId == 0)
context = frame->mainWorldScriptContext();
else
context = frame->toWebLocalFrame()->isolatedWorldScriptContext(worldId, 0);
v8::Context::Scope contextScope(context);
v8::Handle<v8::Object> global(context->Global());
v8::Handle<v8::Value> qtObjectValue(global->Get(gin::StringToV8(isolate, "qt")));
if (!qtObjectValue->IsObject())
return;
v8::Handle<v8::Value> webChannelObjectValue(qtObjectValue->ToObject()->Get(gin::StringToV8(isolate, "webChannelTransport")));
if (!webChannelObjectValue->IsObject())
return;
v8::Handle<v8::Value> onmessageCallbackValue(webChannelObjectValue->ToObject()->Get(gin::StringToV8(isolate, "onmessage")));
if (!onmessageCallbackValue->IsFunction()) {
qWarning("onmessage is not a callable property of qt.webChannelTransport. Some things might not work as expected.");
return;
}
v8::Handle<v8::Object> messageObject(v8::Object::New(isolate));
messageObject->ForceSet(v8::String::NewFromUtf8(isolate, "data")
, v8::String::NewFromUtf8(isolate, json.constData(), v8::String::kNormalString, json.size())
, v8::PropertyAttribute(v8::ReadOnly | v8::DontDelete));
v8::Handle<v8::Function> callback = v8::Handle<v8::Function>::Cast(onmessageCallbackValue);
const int argc = 1;
v8::Handle<v8::Value> argv[argc];
argv[0] = messageObject;
frame->callFunctionEvenIfScriptDisabled(callback, webChannelObjectValue->ToObject(), argc, argv);
}
void WebChannelIPCTransport::DidCreateDocumentElement(blink::WebLocalFrame *frame)
{
blink::WebFrame* main_frame = render_view()->GetWebView()->mainFrame();
if (m_installed && frame == main_frame)
WebChannelTransport::Install(frame, m_installedWorldId);
}
bool WebChannelIPCTransport::OnMessageReceived(const IPC::Message &message)
{
bool handled = true;
IPC_BEGIN_MESSAGE_MAP(WebChannelIPCTransport, message)
IPC_MESSAGE_HANDLER(WebChannelIPCTransport_Install, installWebChannel)
IPC_MESSAGE_HANDLER(WebChannelIPCTransport_Uninstall, uninstallWebChannel)
IPC_MESSAGE_HANDLER(WebChannelIPCTransport_Message, dispatchWebChannelMessage)
IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP()
return handled;
}
} // namespace
| [
"saa@tomsksoft.com"
] | saa@tomsksoft.com |
a41ff8d4b8f253da1fc6ce6c385e6f7c496ffea3 | d27843dea590175180bd89a5bdc1fcdf01b1a588 | /Arduino Libraries/RFID/examples/pruebaLibreriaRFID/pruebaLibreriaRFID.ino | f277eb6243211f5bb6f89e42c9e2194837872465 | [] | no_license | osoyoo/Osoyoo-development-kits | f746534d61c95da4038d969d73ed723d1317fe33 | 421dc2aa738a58cc72925fd2f93e70b3db95d3ee | refs/heads/master | 2021-12-03T20:55:36.622057 | 2021-11-30T01:37:58 | 2021-11-30T01:37:58 | 94,987,331 | 20 | 21 | null | 2021-07-24T21:31:57 | 2017-06-21T09:30:47 | C | UTF-8 | C++ | false | false | 839 | ino | //整理者:极客工坊bg1lsy (lsy@sogou.com)
//整理时间:2013.05.25
#include <SPI.h>
#include <RFID.h>
RFID rfid(10,5); //D10--读卡器MOSI引脚、D5--读卡器RST引脚
void setup()
{
Serial.begin(9600);
SPI.begin();
rfid.init();
}
void loop()
{
//找卡
if (rfid.isCard()) {
Serial.println("Find the card!");
//读取卡序列号
if (rfid.readCardSerial()) {
Serial.print("The card's number is : ");
Serial.print(rfid.serNum[0],HEX);
Serial.print(rfid.serNum[1],HEX);
Serial.print(rfid.serNum[2],HEX);
Serial.print(rfid.serNum[3],HEX);
Serial.print(rfid.serNum[4],HEX);
Serial.println(" ");
}
//选卡,可返回卡容量(锁定卡片,防止多数读取),去掉本行将连续读卡
rfid.selectTag(rfid.serNum);
}
rfid.halt();
}
| [
"yujian_ca@hotmail.com"
] | yujian_ca@hotmail.com |
71700c9f4e8b522a91fb2099bb163126d5dd54fc | 91a882547e393d4c4946a6c2c99186b5f72122dd | /Source/XPSP1/NT/net/config/netcfg/engine/ienum.cpp | 664d7e15241c9e2e8eea6dd54d0622009c392b8a | [] | 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 | 15,401 | cpp | //+---------------------------------------------------------------------------
//
// Microsoft Windows
// Copyright (C) Microsoft Corporation, 1999.
//
// File: I E N U M . C P P
//
// Contents: Implements the IEnumNetCfgBindingInterface,
// IEnumNetCfgBindingPath, and IEnumNetCfgComponent COM
// interfaces.
//
// Notes:
//
// Author: shaunco 15 Jan 1999
//
//----------------------------------------------------------------------------
#include <pch.h>
#pragma hdrstop
#include "ibind.h"
#include "ienum.h"
#include "ncatl.h"
#include "netcfg.h"
/*
A helper function for finishing up the semantics of a IEnumXXX::Next or
IEnumXXX::Skip. Return S_OK if no error passed in and celt == celtFetched.
Return S_FALSE if no error passed in and celt != celtFetched. If returning
an error, release celt IUnknowns from rgelt.
Returns: S_OK, S_FALSE, or an error code
Author: shaunco 13 Jan 1999
*/
HRESULT
HrFinishNextOrSkipContract (
IN HRESULT hr,
IN ULONG celtFetched,
IN ULONG celt,
IN OUT IUnknown** rgelt,
OUT ULONG* pceltFetched)
{
if (S_OK == hr)
{
if (pceltFetched)
{
*pceltFetched = celtFetched;
}
hr = (celtFetched == celt) ? S_OK : S_FALSE;
}
else
{
// For any failures, we need to release what we were about to return.
// Set any output parameters to NULL.
//
if (rgelt)
{
for (ULONG ulIndex = 0; ulIndex < celt; ulIndex++)
{
ReleaseObj (rgelt[ulIndex]);
rgelt[ulIndex] = NULL;
}
}
if (pceltFetched)
{
*pceltFetched = 0;
}
}
return hr;
}
//+---------------------------------------------------------------------------
// CImplIEnumNetCfgBindingInterface -
//
/*
Create an instance of a binding interface enumerator.
Returns: S_OK or an error code
Author: shaunco 13 Jan 1999
*/
// static
HRESULT
CImplIEnumNetCfgBindingInterface::HrCreateInstance (
IN CImplINetCfg* pINetCfg,
IN CImplINetCfgBindingPath* pIPath,
OUT IEnumNetCfgBindingInterface** ppIEnum)
{
HRESULT hr = E_OUTOFMEMORY;
CImplIEnumNetCfgBindingInterface* pObj;
pObj = new CComObject <CImplIEnumNetCfgBindingInterface>;
if (pObj)
{
hr = S_OK;
// Initialize our members.
//
pObj->m_pIPath = pIPath;
// Do the standard CComCreator::CreateInstance stuff.
//
pObj->SetVoid (NULL);
pObj->InternalFinalConstructAddRef ();
hr = pObj->FinalConstruct ();
pObj->InternalFinalConstructRelease ();
// The last thing we do is addref any interfaces we hold.
// We only do this if we are returning success.
//
if (S_OK == hr)
{
hr = pObj->QueryInterface (IID_IEnumNetCfgBindingInterface,
(VOID**)ppIEnum);
// The last thing we do is addref any interfaces we hold.
// We only do this if we are returning success.
//
if (S_OK == hr)
{
AddRefObj (pIPath->GetUnknown());
pObj->HoldINetCfg (pINetCfg);
}
}
if (S_OK != hr)
{
delete pObj;
}
}
TraceHr (ttidError, FAL, hr, FALSE,
"CImplIEnumNetCfgBindingInterface::HrCreateInstance");
return hr;
}
VOID
CImplIEnumNetCfgBindingInterface::FinalRelease ()
{
AssertH (m_pIPath);
ReleaseObj (m_pIPath->GetUnknown());
CImplINetCfgHolder::FinalRelease();
}
HRESULT
CImplIEnumNetCfgBindingInterface::HrNextOrSkip (
IN ULONG celt,
OUT INetCfgBindingInterface** rgelt,
OUT ULONG* pceltFetched)
{
HRESULT hr;
Assert (m_unIndex >= 1);
// Important to initialize rgelt so that in case we fail, we can
// release only what we put in rgelt.
//
if (rgelt)
{
ZeroMemory (rgelt, sizeof (*rgelt) * celt);
}
hr = HrLockAndTestForValidInterface (IF_DEFAULT);
if (S_OK == hr)
{
// Enumerate the requested number of elements or stop short
// if we don't have that many left to enumerate.
//
ULONG celtFetched = 0;
while ((S_OK == hr)
&& (celtFetched < celt)
&& (m_unIndex < m_pIPath->m_cpIComp))
{
if (rgelt)
{
hr = CImplINetCfgBindingInterface::HrCreateInstance (
m_pINetCfg,
(CImplINetCfgComponent*)m_pIPath->
m_papIComp[m_unIndex-1],
(CImplINetCfgComponent*)m_pIPath->
m_papIComp[m_unIndex],
rgelt + celtFetched);
}
celtFetched++;
m_unIndex++;
}
Unlock();
hr = HrFinishNextOrSkipContract (hr, celtFetched, celt,
reinterpret_cast<IUnknown**>(rgelt), pceltFetched);
}
TraceHr (ttidError, FAL, hr, S_FALSE == hr,
"CImplIEnumNetCfgBindingInterface::HrNextOrSkip");
return hr;
}
STDMETHODIMP
CImplIEnumNetCfgBindingInterface::Next (
IN ULONG celt,
OUT INetCfgBindingInterface** rgelt,
OUT ULONG* pceltFetched)
{
HRESULT hr;
// Validate parameters.
//
if (!rgelt || (!pceltFetched && (1 != celt)))
{
hr = E_POINTER;
}
else if (rgelt && IsBadWritePtr(rgelt, celt * sizeof(*rgelt)))
{
hr = E_INVALIDARG;
}
else
{
hr = HrNextOrSkip (celt, rgelt, pceltFetched);
}
TraceHr (ttidError, FAL, hr, S_FALSE == hr,
"CImplIEnumNetCfgBindingInterface::Next");
return hr;
}
STDMETHODIMP
CImplIEnumNetCfgBindingInterface::Skip (
IN ULONG celt)
{
HRESULT hr = HrNextOrSkip (celt, NULL, NULL);
TraceHr (ttidError, FAL, hr, S_FALSE == hr,
"CImplIEnumNetCfgBindingInterface::Skip");
return hr;
}
STDMETHODIMP
CImplIEnumNetCfgBindingInterface::Reset ()
{
Lock();
Assert (m_pIPath);
m_unIndex = 1;
Unlock();
return S_OK;
}
STDMETHODIMP
CImplIEnumNetCfgBindingInterface::Clone (
OUT IEnumNetCfgBindingInterface** ppIEnum)
{
return E_NOTIMPL;
}
//+---------------------------------------------------------------------------
// CImplIEnumNetCfgBindingPath -
//
// static
HRESULT
CImplIEnumNetCfgBindingPath::HrCreateInstance (
IN CImplINetCfg* pINetCfg,
IN const CBindingSet* pBindSet OPTIONAL,
IN DWORD dwFlags,
OUT CImplIEnumNetCfgBindingPath** ppIEnum)
{
HRESULT hr = E_OUTOFMEMORY;
Assert (dwFlags);
if (pBindSet)
{
pINetCfg->m_pNetConfig->Core.DbgVerifyBindingSet (pBindSet);
}
CImplIEnumNetCfgBindingPath* pObj;
pObj = new CComObject <CImplIEnumNetCfgBindingPath>;
if (pObj)
{
hr = S_OK;
// Initialize our members.
//
if (dwFlags & EBPC_TAKE_OWNERSHIP)
{
Assert (pBindSet);
pObj->m_pBindSet = pBindSet;
pObj->m_iter = pBindSet->begin();
}
else if (dwFlags & EBPC_COPY_BINDSET)
{
Assert (pBindSet);
hr = pObj->m_InternalBindSet.HrCopyBindingSet(pBindSet);
pObj->m_pBindSet = &pObj->m_InternalBindSet;
pObj->m_iter = pObj->m_InternalBindSet.begin();
}
else
{
Assert (dwFlags & EBPC_CREATE_EMPTY);
pObj->m_pBindSet = &pObj->m_InternalBindSet;
pObj->m_iter = pObj->m_InternalBindSet.begin();
}
if (S_OK == hr)
{
// Do the standard CComCreator::CreateInstance stuff.
//
pObj->SetVoid (NULL);
pObj->InternalFinalConstructAddRef ();
hr = pObj->FinalConstruct ();
pObj->InternalFinalConstructRelease ();
// The last thing we do is addref any interfaces we hold.
// We only do this if we are returning success.
//
if (S_OK == hr)
{
pObj->HoldINetCfg (pINetCfg);
AddRefObj (pObj->GetUnknown());
*ppIEnum = pObj;
}
}
if (S_OK != hr)
{
delete pObj;
}
}
if ((S_OK != hr) && (dwFlags & EBPC_TAKE_OWNERSHIP))
{
delete pBindSet;
}
TraceHr (ttidError, FAL, hr, FALSE,
"CImplIEnumNetCfgBindingPath::HrCreateInstance");
return hr;
}
HRESULT
CImplIEnumNetCfgBindingPath::HrNextOrSkip (
IN ULONG celt,
OUT INetCfgBindingPath** rgelt,
OUT ULONG* pceltFetched)
{
HRESULT hr;
Assert(m_iter >= m_pBindSet->begin());
// Important to initialize rgelt so that in case we fail, we can
// release only what we put in rgelt.
//
if (rgelt)
{
ZeroMemory (rgelt, sizeof (*rgelt) * celt);
}
hr = HrLockAndTestForValidInterface (IF_DEFAULT);
if (S_OK == hr)
{
// Enumerate the requested number of elements or stop short
// if we don't have that many left to enumerate.
//
ULONG celtFetched = 0;
while ((S_OK == hr)
&& (celtFetched < celt)
&& (m_iter != m_pBindSet->end()))
{
// Don't return interfaces to bindpaths that contain
// components that have had problem loading.
//
if (m_iter->FAllComponentsLoadedOkayIfLoadedAtAll())
{
if (rgelt)
{
hr = CImplINetCfgBindingPath::HrCreateInstance (
m_pINetCfg,
m_iter,
rgelt + celtFetched);
}
celtFetched++;
}
m_iter++;
}
Unlock();
hr = HrFinishNextOrSkipContract (hr, celtFetched, celt,
reinterpret_cast<IUnknown**>(rgelt), pceltFetched);
}
TraceHr (ttidError, FAL, hr, S_FALSE == hr,
"CImplIEnumNetCfgBindingPath::HrNextOrSkip");
return hr;
}
STDMETHODIMP
CImplIEnumNetCfgBindingPath::Next (
IN ULONG celt,
OUT INetCfgBindingPath** rgelt,
OUT ULONG* pceltFetched)
{
HRESULT hr;
// Validate parameters.
//
if (!rgelt || (!pceltFetched && (1 != celt)))
{
hr = E_POINTER;
}
else if (rgelt && IsBadWritePtr(rgelt, celt * sizeof(*rgelt)))
{
hr = E_INVALIDARG;
}
else
{
hr = HrNextOrSkip (celt, rgelt, pceltFetched);
}
TraceHr (ttidError, FAL, hr, S_FALSE == hr,
"CImplIEnumNetCfgBindingPath::Next");
return hr;
}
STDMETHODIMP
CImplIEnumNetCfgBindingPath::Skip (
IN ULONG celt)
{
HRESULT hr = HrNextOrSkip (celt, NULL, NULL);
TraceHr (ttidError, FAL, hr, S_FALSE == hr,
"CImplIEnumNetCfgBindingPath::Skip");
return hr;
}
STDMETHODIMP
CImplIEnumNetCfgBindingPath::Reset ()
{
Lock();
Assert (m_pBindSet);
m_iter = m_pBindSet->begin();
Unlock();
return S_OK;
}
STDMETHODIMP
CImplIEnumNetCfgBindingPath::Clone (
OUT IEnumNetCfgBindingPath** ppIEnum)
{
return E_NOTIMPL;
}
//+---------------------------------------------------------------------------
// CImplIEnumNetCfgComponent -
//
// static
HRESULT
CImplIEnumNetCfgComponent::HrCreateInstance (
IN CImplINetCfg* pINetCfg,
IN NETCLASS Class,
OUT IEnumNetCfgComponent** ppIEnum)
{
HRESULT hr = E_OUTOFMEMORY;
CImplIEnumNetCfgComponent* pObj;
pObj = new CComObject <CImplIEnumNetCfgComponent>;
if (pObj)
{
// Initialize our members.
//
pObj->m_unIndex = 0;
pObj->m_Class = Class;
// Do the standard CComCreator::CreateInstance stuff.
//
pObj->SetVoid (NULL);
pObj->InternalFinalConstructAddRef ();
hr = pObj->FinalConstruct ();
pObj->InternalFinalConstructRelease ();
if (S_OK == hr)
{
hr = pObj->QueryInterface (IID_IEnumNetCfgComponent,
(VOID**)ppIEnum);
// The last thing we do is addref any interfaces we hold.
// We only do this if we are returning success.
//
if (S_OK == hr)
{
pObj->HoldINetCfg (pINetCfg);
}
}
if (S_OK != hr)
{
delete pObj;
}
}
TraceHr (ttidError, FAL, hr, FALSE,
"CImplIEnumNetCfgComponent::HrCreateInstance");
return hr;
}
HRESULT
CImplIEnumNetCfgComponent::HrNextOrSkip (
IN ULONG celt,
OUT INetCfgComponent** rgelt,
OUT ULONG* pceltFetched)
{
HRESULT hr;
// Important to initialize rgelt so that in case we fail, we can
// release only what we put in rgelt.
//
if (rgelt)
{
ZeroMemory (rgelt, sizeof (*rgelt) * celt);
}
hr = HrLockAndTestForValidInterface (IF_DEFAULT);
if (S_OK == hr)
{
CComponentList* pComponents;
CComponent* pComponent;
pComponents = &m_pINetCfg->m_pNetConfig->Core.Components;
// Enumerate the requested number of elements or stop short
// if we don't have that many left to enumerate.
//
ULONG celtFetched = 0;
while ((S_OK == hr)
&& (celtFetched < celt)
&& (NULL != (pComponent = pComponents->PGetComponentAtIndex(
m_unIndex))))
{
// Don't return interfaces to components that have had
// problem loading.
//
if (((NC_INVALID == m_Class) ||
(m_Class == pComponent->Class())) &&
pComponent->Ext.FLoadedOkayIfLoadedAtAll())
{
if (rgelt)
{
hr = pComponent->HrGetINetCfgComponentInterface(
m_pINetCfg, rgelt + celtFetched);
}
celtFetched++;
}
m_unIndex++;
}
Unlock();
hr = HrFinishNextOrSkipContract (hr, celtFetched, celt,
reinterpret_cast<IUnknown**>(rgelt), pceltFetched);
}
TraceHr (ttidError, FAL, hr, S_FALSE == hr,
"CImplIEnumNetCfgComponent::HrNextOrSkip");
return hr;
}
STDMETHODIMP
CImplIEnumNetCfgComponent::Next (
IN ULONG celt,
OUT INetCfgComponent** rgelt,
OUT ULONG* pceltFetched)
{
HRESULT hr;
// Validate parameters.
//
if (!rgelt || (!pceltFetched && (1 != celt)))
{
hr = E_POINTER;
}
else if (rgelt && IsBadWritePtr(rgelt, celt * sizeof(*rgelt)))
{
hr = E_INVALIDARG;
}
else
{
hr = HrNextOrSkip (celt, rgelt, pceltFetched);
}
TraceHr (ttidError, FAL, hr, S_FALSE == hr,
"CImplIEnumNetCfgComponent::Next");
return hr;
}
STDMETHODIMP
CImplIEnumNetCfgComponent::Skip (
IN ULONG celt)
{
HRESULT hr = HrNextOrSkip (celt, NULL, NULL);
TraceHr (ttidError, FAL, hr, S_FALSE == hr,
"CImplIEnumNetCfgComponent::Skip");
return hr;
}
STDMETHODIMP
CImplIEnumNetCfgComponent::Reset ()
{
Lock();
m_unIndex = 0;
Unlock();
return S_OK;
}
STDMETHODIMP
CImplIEnumNetCfgComponent::Clone (
OUT IEnumNetCfgComponent** ppIEnum)
{
return E_NOTIMPL;
}
| [
"support@cryptoalgo.cf"
] | support@cryptoalgo.cf |
ccf1f9187200145dd4942809dc376d671923a2e6 | d4240a19b3a97e8c4a39a7925e8046ead6642d19 | /2016/Enceladus/Temp/StagingArea/Data/il2cppOutput/TextMeshPro_TMPro_TMP_Dropdown_DropdownItem1251916390.h | aef7285854bb034ab6d2d3cd0a0d9dea8103d86a | [] | no_license | mgoadric/csci370 | 05561a24a8a6c3ace4d9ab673b20c03fc40686e9 | 9ffd5d0e373c8a415cd23799fc29a6f6d83c08af | refs/heads/master | 2023-03-17T18:51:45.095212 | 2023-03-13T19:45:59 | 2023-03-13T19:45:59 | 81,270,581 | 2 | 3 | null | null | null | null | UTF-8 | C++ | false | false | 2,995 | h | #pragma once
#include "il2cpp-config.h"
#ifndef _MSC_VER
# include <alloca.h>
#else
# include <malloc.h>
#endif
#include <stdint.h>
// TMPro.TMP_Text
struct TMP_Text_t1920000777;
// UnityEngine.UI.Image
struct Image_t2042527209;
// UnityEngine.RectTransform
struct RectTransform_t3349966182;
// UnityEngine.UI.Toggle
struct Toggle_t3976754468;
#include "UnityEngine_UnityEngine_MonoBehaviour1158329972.h"
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// TMPro.TMP_Dropdown/DropdownItem
struct DropdownItem_t1251916390 : public MonoBehaviour_t1158329972
{
public:
// TMPro.TMP_Text TMPro.TMP_Dropdown/DropdownItem::m_Text
TMP_Text_t1920000777 * ___m_Text_2;
// UnityEngine.UI.Image TMPro.TMP_Dropdown/DropdownItem::m_Image
Image_t2042527209 * ___m_Image_3;
// UnityEngine.RectTransform TMPro.TMP_Dropdown/DropdownItem::m_RectTransform
RectTransform_t3349966182 * ___m_RectTransform_4;
// UnityEngine.UI.Toggle TMPro.TMP_Dropdown/DropdownItem::m_Toggle
Toggle_t3976754468 * ___m_Toggle_5;
public:
inline static int32_t get_offset_of_m_Text_2() { return static_cast<int32_t>(offsetof(DropdownItem_t1251916390, ___m_Text_2)); }
inline TMP_Text_t1920000777 * get_m_Text_2() const { return ___m_Text_2; }
inline TMP_Text_t1920000777 ** get_address_of_m_Text_2() { return &___m_Text_2; }
inline void set_m_Text_2(TMP_Text_t1920000777 * value)
{
___m_Text_2 = value;
Il2CppCodeGenWriteBarrier(&___m_Text_2, value);
}
inline static int32_t get_offset_of_m_Image_3() { return static_cast<int32_t>(offsetof(DropdownItem_t1251916390, ___m_Image_3)); }
inline Image_t2042527209 * get_m_Image_3() const { return ___m_Image_3; }
inline Image_t2042527209 ** get_address_of_m_Image_3() { return &___m_Image_3; }
inline void set_m_Image_3(Image_t2042527209 * value)
{
___m_Image_3 = value;
Il2CppCodeGenWriteBarrier(&___m_Image_3, value);
}
inline static int32_t get_offset_of_m_RectTransform_4() { return static_cast<int32_t>(offsetof(DropdownItem_t1251916390, ___m_RectTransform_4)); }
inline RectTransform_t3349966182 * get_m_RectTransform_4() const { return ___m_RectTransform_4; }
inline RectTransform_t3349966182 ** get_address_of_m_RectTransform_4() { return &___m_RectTransform_4; }
inline void set_m_RectTransform_4(RectTransform_t3349966182 * value)
{
___m_RectTransform_4 = value;
Il2CppCodeGenWriteBarrier(&___m_RectTransform_4, value);
}
inline static int32_t get_offset_of_m_Toggle_5() { return static_cast<int32_t>(offsetof(DropdownItem_t1251916390, ___m_Toggle_5)); }
inline Toggle_t3976754468 * get_m_Toggle_5() const { return ___m_Toggle_5; }
inline Toggle_t3976754468 ** get_address_of_m_Toggle_5() { return &___m_Toggle_5; }
inline void set_m_Toggle_5(Toggle_t3976754468 * value)
{
___m_Toggle_5 = value;
Il2CppCodeGenWriteBarrier(&___m_Toggle_5, value);
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
| [
"goadrich@hendrix.edu"
] | goadrich@hendrix.edu |
9d427b2baba152b06c1a82929f94303edff3ae64 | dc928692a22d51d41e92dbf8514e34561ea609ea | /src/ThreadPoolManager.cpp | 38c7a358c88d03b90c58565cdd72f89aab900cef | [] | no_license | tarunk/ThreadPool | 41b9bc29bc8c808ba9002048412dd06b73983789 | abd8cea2eaffb4232d3e07b1cee7bc3de22e0f31 | refs/heads/master | 2020-08-29T19:06:09.581943 | 2019-12-08T07:48:16 | 2019-12-08T07:48:16 | 218,141,157 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,696 | cpp | #include <iostream>
#include "ThreadPool.h"
using namespace std;
void testFunIntArg(int id, int n) {
std::cout << "hello from " << n << ", function\n";
}
void testFunStringArg(int id, const std::string & s) {
std::cout << __FUNCTION__ << ": " << s << '\n';
}
typedef struct TestObject {
TestObject(int v) {
this->v = v;
std::cout << "TestObject ctor " << this->v << '\n';
}
TestObject(TestObject && c) {
this->v = c.v; std::cout<<"TestObject move ctor\n";
}
TestObject(const TestObject& c) {
this->v = c.v;
std::cout<<"TestObject copy ctor\n";
}
~TestObject() {
std::cout << "TestObject dtor\n";
}
int v;
}TestObject;
void testFunObjectArg(int id, TestObject& t) {
std::cout << __FUNCTION__ << ": " << t.v << endl;
}
int main() {
std::cout << "Hello Thread Pool" << endl;
unsigned const thread_count = std::thread::hardware_concurrency();
ThreadPool tp(thread_count);
tp.submit(&testFunIntArg, 10);
tp.submit(&testFunStringArg, "Hello Test Fun String Arg");
TestObject obj(120);
tp.submit(testFunObjectArg, std::ref(obj));
tp.submit(testFunObjectArg, obj);
tp.submit(testFunObjectArg, std::move(obj));
std::string ret1 = "result success";
auto fun1 = tp.submit([ret1](int) {
return ret1;
});
std::cout << "returned: " << fun1.get() << '\n';
auto fun2 = tp.submit([](int) {
throw std::exception();
});
try {
fun2.get();
} catch (std::exception& e) {
std::cout << "caught exception\n";
}
tp.join();
return 0;
}
| [
"bing.tome@yahoo.co.in"
] | bing.tome@yahoo.co.in |
241c347a1da91d55e6ac3447943ce35b7df9f39c | 63786bfaf8280645147f720a9145da391b9cd3bb | /Sample Codes/Visual C++ 6.0/GetATR/GetATRDlg.cpp | c1e71e9917fc23657effe039f467e3b9f2ce886a | [] | no_license | liucoldstar/ACR122-SDK | 2f54a106142ff9c0295a6ebe78f4b3bf69cc1484 | e50bafa64accbf86469330c89d7b90e2fc4772f5 | refs/heads/master | 2021-12-14T22:11:30.326705 | 2017-06-15T07:11:37 | 2017-06-15T07:11:37 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 9,641 | cpp | // Copyright(C): Advanced Card Systems Ltd
//
//
// Description: This sample program outlines on how
// to get the ATR of a card
//
// Author: Wazer Emmanuel R. Benal
//
// Date: November 11, 2009
//
//
//======================================================================
#include "stdafx.h"
#include "GetATR.h"
#include "GetATRDlg.h"
#include "acr122.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
//Defines
#define BLACK RGB(0, 0, 0)
#define RED RGB(255, 0, 0)
#define GREEN RGB(0, 0x99, 0)
//Global Variables
int retCode;
HANDLE hReader;
CGetATRDlg *pThis = NULL;
BYTE SendBuff[255];
BYTE RecvBuff[255];
DWORD SendLen, RecvLen;
//Function Prototypes
void ClearBuffers();
void DisplayOut( CString str, COLORREF color );
int SendAPDU();
void Init()
{
pThis->btnConnect.EnableWindow( true );
pThis->btnGetATR.EnableWindow( false );
pThis->cbPort.SetCurSel( 0 );
}
//Sets SendBuff and RecvBuff to zero
void ClearBuffers()
{
memset( SendBuff, 0x00, 255 );
memset( RecvBuff, 0x00, 255 );
}
//Displays the message in the rich edit box with the respective color
void DisplayOut( CString str, COLORREF color )
{
int nOldLines = 0,
nNewLines = 0,
nScroll = 0;
long nInsertPoint = 0;
CHARFORMAT cf;
//Save number of lines before insertion of new text
nOldLines = pThis->mMsg.GetLineCount();
//Initialize character format structure
cf.cbSize = sizeof( CHARFORMAT );
cf.dwMask = CFM_COLOR;
cf.dwEffects = 0; // To disable CFE_AUTOCOLOR
cf.crTextColor = color;
//Set insertion point to end of text
nInsertPoint = pThis->mMsg.GetWindowTextLength();
pThis->mMsg.SetSel( nInsertPoint, -1 );
//Set the character format
pThis->mMsg.SetSelectionCharFormat( cf );
//Insert string at the current caret poisiton
pThis->mMsg.ReplaceSel( str );
nNewLines = pThis->mMsg.GetLineCount();
nScroll = nNewLines - nOldLines;
pThis->mMsg.LineScroll( 1 );
}
//Sends APDU through ACR122_DirectTransmit() command
int SendAPDU()
{
UINT i;
char tempstr[255];
sprintf( tempstr, "< " );
for( i = 0; i < SendLen; i++ )
{
sprintf( tempstr, "%s %02X", tempstr, SendBuff[i] );
}
sprintf( tempstr, "%s\n", tempstr );
DisplayOut( tempstr, BLACK );
retCode = ACR122_DirectTransmit( hReader, SendBuff, SendLen, RecvBuff, &RecvLen );
if( retCode != 0 )
{
return retCode;
}
sprintf( tempstr, "> " );
for( i = 0; i < RecvLen; i++ )
{
sprintf( tempstr, "%s %02X", tempstr, RecvBuff[i] );
}
sprintf( tempstr, "%s\n", tempstr );
DisplayOut( tempstr, BLACK );
return retCode;
}
/////////////////////////////////////////////////////////////////////////////
// CAboutDlg dialog used for App About
class CAboutDlg : public CDialog
{
public:
CAboutDlg();
// Dialog Data
//{{AFX_DATA(CAboutDlg)
enum { IDD = IDD_ABOUTBOX };
//}}AFX_DATA
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CAboutDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
//{{AFX_MSG(CAboutDlg)
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
{
//{{AFX_DATA_INIT(CAboutDlg)
//}}AFX_DATA_INIT
}
void CAboutDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CAboutDlg)
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
//{{AFX_MSG_MAP(CAboutDlg)
// No message handlers
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CGetATRDlg dialog
CGetATRDlg::CGetATRDlg(CWnd* pParent /*=NULL*/)
: CDialog(CGetATRDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CGetATRDlg)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
m_hIconBig = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
m_hIconSmall = AfxGetApp()->LoadIcon(IDR_SMALLICON);
}
void CGetATRDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CGetATRDlg)
DDX_Control(pDX, IDC_BUTTON5, btnQuit);
DDX_Control(pDX, IDC_BUTTON4, btnReset);
DDX_Control(pDX, IDC_BUTTON3, btnClear);
DDX_Control(pDX, IDC_BUTTON2, btnGetATR);
DDX_Control(pDX, IDC_RICHEDIT1, mMsg);
DDX_Control(pDX, IDC_BUTTON1, btnConnect);
DDX_Control(pDX, IDC_COMBO1, cbPort);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CGetATRDlg, CDialog)
//{{AFX_MSG_MAP(CGetATRDlg)
ON_WM_SYSCOMMAND()
ON_WM_PAINT()
ON_WM_QUERYDRAGICON()
ON_BN_CLICKED(IDC_BUTTON1, OnConnect)
ON_BN_CLICKED(IDC_BUTTON2, OnGetATR)
ON_BN_CLICKED(IDC_BUTTON3, OnClear)
ON_BN_CLICKED(IDC_BUTTON4, OnReset)
ON_BN_CLICKED(IDC_BUTTON5, OnQuit)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CGetATRDlg message handlers
BOOL CGetATRDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// Add "About..." menu item to system menu.
// IDM_ABOUTBOX must be in the system command range.
ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
ASSERT(IDM_ABOUTBOX < 0xF000);
CMenu* pSysMenu = GetSystemMenu(FALSE);
if (pSysMenu != NULL)
{
CString strAboutMenu;
strAboutMenu.LoadString(IDS_ABOUTBOX);
if (!strAboutMenu.IsEmpty())
{
pSysMenu->AppendMenu(MF_SEPARATOR);
pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
}
}
// Set the icon for this dialog. The framework does this automatically
// when the application's main window is not a dialog
SetIcon(m_hIconBig, TRUE); // Set big icon
SetIcon(m_hIconSmall, FALSE); // Set small icon
// TODO: Add extra initialization here
for( int i = 1; i < 10; i++ )
{
CString tempstr;
tempstr.Format( "COM%d", i );
cbPort.AddString( tempstr );
}
pThis = this;
try
{
DisplayOut( "Program Started\n", GREEN );
}
catch( char *str )
{
AfxMessageBox( str );
}
Init();
return TRUE; // return TRUE unless you set the focus to a control
}
void CGetATRDlg::OnSysCommand(UINT nID, LPARAM lParam)
{
if ((nID & 0xFFF0) == IDM_ABOUTBOX)
{
CAboutDlg dlgAbout;
dlgAbout.DoModal();
}
else
{
CDialog::OnSysCommand(nID, lParam);
}
}
// If you add a minimize button to your dialog, you will need the code below
// to draw the icon. For MFC applications using the document/view model,
// this is automatically done for you by the framework.
void CGetATRDlg::OnPaint()
{
if (IsIconic())
{
CPaintDC dc(this); // device context for painting
SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);
// Center icon in client rectangle
int cxIcon = GetSystemMetrics(SM_CXICON);
int cyIcon = GetSystemMetrics(SM_CYICON);
CRect rect;
GetClientRect(&rect);
int x = (rect.Width() - cxIcon + 1) / 2;
int y = (rect.Height() - cyIcon + 1) / 2;
// Draw the icon
dc.DrawIcon(x, y, m_hIconSmall);
}
else
{
CDialog::OnPaint();
}
}
// The system calls this to obtain the cursor to display while the user drags
// the minimized window.
HCURSOR CGetATRDlg::OnQueryDragIcon()
{
return (HCURSOR) m_hIconSmall;
}
void CGetATRDlg::OnConnect()
{
char tempstr[10], port[10];
DWORD FWLEN = 255;
sprintf( port, "" );
cbPort.GetWindowText( port, 5 );
retCode = ACR122_OpenA( port, &hReader );
if( retCode != 0 )
{
try
{
sprintf( tempstr, "Connection to %s failed\n", port );
DisplayOut( tempstr, RED );
return;
}
catch( char *str )
{
AfxMessageBox( str );
return;
}
}
else
{
sprintf( tempstr, "Connection to %s success\n", port );
DisplayOut( tempstr, GREEN );
}
sprintf( tempstr, "" );
retCode = ACR122_GetFirmwareVersion( hReader, 0, tempstr, &FWLEN );
if( retCode != 0 )
{
DisplayOut( "Unable to obtain Firmware version\n", RED );
return;
}
else
{
DisplayOut( "Firmware Version: ", BLACK );
DisplayOut( tempstr, BLACK );
DisplayOut( "\n", BLACK );
}
pThis->btnConnect.EnableWindow( false );
pThis->btnGetATR.EnableWindow( true );
}
void CGetATRDlg::OnGetATR()
{
BYTE CardType;
CString tempstr;
ClearBuffers();
SendBuff[0] = 0xD4;
SendBuff[1] = 0x60;
SendBuff[2] = 0x01;
SendBuff[3] = 0x01;
SendBuff[4] = 0x20;
SendBuff[5] = 0x23;
SendBuff[6] = 0x11;
SendBuff[7] = 0x04;
SendBuff[8] = 0x10;
SendLen = 9;
RecvLen = 255;
retCode = SendAPDU();
if( retCode != 0 )
{
DisplayOut( "Get ATR failed\n", RED );
return;
}
else
{
if( RecvLen > 3 )
{
CardType = RecvBuff[8];
switch( CardType )
{
case 0x18:
tempstr = "Mifare 4K ";
break;
case 0x00:
tempstr = "Mifare Ultralight ";
break;
case 0x28:
tempstr = "ISO 14443-4 Type A ";
break;
case 0x08:
tempstr = "Mifare 1K ";
break;
case 0x09:
tempstr = "Mifare Mini ";
break;
case 0x20:
tempstr = "Mifare DesFire ";
break;
case 0x98:
tempstr = "Gemplus MPCOS ";
break;
default:
CardType = RecvBuff[3];
switch( CardType )
{
case 0x23:
tempstr = "ISO 14443-4 Type B ";
break;
case 0x11:
tempstr = "FeliCa 212K ";
break;
case 0x04:
tempstr = "Topaz ";
break;
default:
tempstr = "Unknown contactless card ";
break;
}
}
}
else
{
tempstr = "No contactless card ";
}
tempstr = tempstr + "detected\n";
DisplayOut( tempstr, GREEN );
}
}
void CGetATRDlg::OnClear()
{
mMsg.SetWindowText( "" );
}
void CGetATRDlg::OnReset()
{
pThis->OnClear();
DisplayOut( "Program Started\n", GREEN );
Init();
ACR122_Close( hReader );
}
void CGetATRDlg::OnQuit()
{
ACR122_Close( hReader );
CDialog::OnCancel();
}
| [
"chanuka.weer@gmail.com"
] | chanuka.weer@gmail.com |
96748e5e2caf657068cc4af802153636bab948c4 | d2249116413e870d8bf6cd133ae135bc52021208 | /Advanced MFC Programming/Chap6/6.8-1/Db/DBDlg.cpp | cda20460d40f071fa9b9017a582c10b6e912ece4 | [] | no_license | Unknow-man/mfc-4 | ecbdd79cc1836767ab4b4ca72734bc4fe9f5a0b5 | b58abf9eb4c6d90ef01b9f1203b174471293dfba | refs/heads/master | 2023-02-17T18:22:09.276673 | 2021-01-20T07:46:14 | 2021-01-20T07:46:14 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 5,113 | cpp | #include "stdafx.h"
#include "DB.h"
#include "DBDlg.h"
#include <afxpriv.h>
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
class CAboutDlg : public CDialog
{
public:
CAboutDlg();
//{{AFX_DATA(CAboutDlg)
enum { IDD = IDD_ABOUTBOX };
//}}AFX_DATA
//{{AFX_VIRTUAL(CAboutDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX);
//}}AFX_VIRTUAL
protected:
//{{AFX_MSG(CAboutDlg)
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
{
//{{AFX_DATA_INIT(CAboutDlg)
//}}AFX_DATA_INIT
}
void CAboutDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CAboutDlg)
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
//{{AFX_MSG_MAP(CAboutDlg)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
static UINT indicators[] =
{
AFX_IDS_IDLEMESSAGE,
IDS_MESSAGE
};
CDBDlg::CDBDlg(CWnd* pParent /*=NULL*/)
: CDialog(CDBDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CDBDlg)
//}}AFX_DATA_INIT
m_hIcon=AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}
void CDBDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CDBDlg)
//}}AFX_DATA_MAP
}
IMPLEMENT_DYNAMIC(CDBDlg, CDialog)
BEGIN_MESSAGE_MAP(CDBDlg, CDialog)
//{{AFX_MSG_MAP(CDBDlg)
ON_WM_SYSCOMMAND()
ON_WM_PAINT()
ON_WM_QUERYDRAGICON()
//}}AFX_MSG_MAP
ON_NOTIFY_EX(TTN_NEEDTEXT, 0, OnToolTipText)
ON_MESSAGE(WM_SETMESSAGESTRING, OnSetMessageString)
ON_MESSAGE(WM_POPMESSAGESTRING, OnPopMessageString)
END_MESSAGE_MAP()
BOOL CDBDlg::OnInitDialog()
{
CDialog::OnInitDialog();
ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
ASSERT(IDM_ABOUTBOX < 0xF000);
CMenu* pSysMenu = GetSystemMenu(FALSE);
if (pSysMenu != NULL)
{
CString strAboutMenu;
strAboutMenu.LoadString(IDS_ABOUTBOX);
if (!strAboutMenu.IsEmpty())
{
pSysMenu->AppendMenu(MF_SEPARATOR);
pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
}
}
SetIcon(m_hIcon, TRUE);
SetIcon(m_hIcon, FALSE);
CRect rectOld;
CRect rectNew;
CRect rect;
CPoint ptOffset;
CWnd *pWndCtrl;
GetClientRect(rectOld);
if
(
!m_wndToolBar.Create(this) ||
!m_wndToolBar.LoadToolBar(IDD)
)
{
TRACE0("Failed to create toolbar\n");
return -1;
}
if
(
!m_wndStatusBar.Create(this) ||
!m_wndStatusBar.SetIndicators
(
indicators,
sizeof(indicators)/sizeof(UINT)
)
)
{
TRACE0("Failed to create status bar\n");
return -1;
}
m_wndStatusBar.SetPaneInfo
(
0,
m_wndStatusBar.GetItemID(0),
SBPS_STRETCH,
NULL
);
m_wndToolBar.SetBarStyle
(
m_wndToolBar.GetBarStyle() |
CBRS_TOOLTIPS | CBRS_FLYBY
);
RepositionBars
(
AFX_IDW_CONTROLBAR_FIRST,
AFX_IDW_CONTROLBAR_LAST,
0,
CWnd::reposQuery,
rectNew
);
ptOffset.x=rectNew.left-rectOld.left;
ptOffset.y=rectNew.top-rectOld.top;
pWndCtrl=GetWindow(GW_CHILD);
while(pWndCtrl)
{
pWndCtrl->GetWindowRect(rect);
ScreenToClient(rect);
rect.OffsetRect(ptOffset);
pWndCtrl->MoveWindow(rect, FALSE);
pWndCtrl=pWndCtrl->GetNextWindow();
}
GetWindowRect(rect);
rect.right+=rectOld.Width()-rectNew.Width();
rect.bottom+=rectOld.Height()-rectNew.Height();
MoveWindow(rect);
RepositionBars
(
AFX_IDW_CONTROLBAR_FIRST,
AFX_IDW_CONTROLBAR_LAST,
0
);
return TRUE;
}
void CDBDlg::OnSysCommand(UINT nID, LPARAM lParam)
{
if ((nID & 0xFFF0) == IDM_ABOUTBOX)
{
CAboutDlg dlgAbout;
dlgAbout.DoModal();
}
else
{
CDialog::OnSysCommand(nID, lParam);
}
}
void CDBDlg::OnPaint()
{
if (IsIconic())
{
CPaintDC dc(this);
SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);
int cxIcon = GetSystemMetrics(SM_CXICON);
int cyIcon = GetSystemMetrics(SM_CYICON);
CRect rect;
GetClientRect(&rect);
int x = (rect.Width() - cxIcon + 1) / 2;
int y = (rect.Height() - cyIcon + 1) / 2;
dc.DrawIcon(x, y, m_hIcon);
}
else
{
CDialog::OnPaint();
}
}
HCURSOR CDBDlg::OnQueryDragIcon()
{
return (HCURSOR) m_hIcon;
}
BOOL CDBDlg::OnToolTipText(UINT, NMHDR *pNMHDR, LRESULT *pResult)
{
TOOLTIPTEXT* pTTT=(TOOLTIPTEXT*)pNMHDR;
CString szTip;
UINT nID=pNMHDR->idFrom;
if(pNMHDR->code == TTN_NEEDTEXT && (pTTT->uFlags & TTF_IDISHWND))
{
nID=((UINT)(WORD)::GetDlgCtrlID((HWND)nID));
}
if(nID != 0)
{
szTip.LoadString(nID);
szTip=szTip.Right(szTip.GetLength()-szTip.Find('\n')-1);
lstrcpy(pTTT->szText, szTip);
*pResult = 0;
return TRUE;
}
*pResult=-1;
return FALSE;
}
LRESULT CDBDlg::OnSetMessageString(WPARAM wParam, LPARAM lParam)
{
UINT nIDMsg=(UINT)wParam;
CString strMsg;
if(nIDMsg)
{
if(strMsg.LoadString(nIDMsg) != 0)m_wndStatusBar.SetPaneText(0, strMsg);
}
return nIDMsg;
}
LRESULT CDBDlg::OnPopMessageString(WPARAM wParam, LPARAM lParam)
{
if(m_nFlags & WF_NOPOPMSG)return 0;
return SendMessage(WM_SETMESSAGESTRING, wParam, lParam);
}
| [
"chenchao0632@163.com"
] | chenchao0632@163.com |
ab8249b6453500cd841487cfe799e767a568adc7 | 7910ee578a82b51fa72b1b9b98c7fb0262cee795 | /TRekt_3D/source/SplashScreen.h | a89696a3ad048c4becd33127bbf3c3f0b4d7bfe0 | [] | no_license | ihaveamac/TRekt_3D | 7c6400715c8e04090b1e947a5237d3f4c4dd7bf3 | 5eedbd815616ffb14d9d7fbd8591fade7409b50a | refs/heads/master | 2021-01-20T10:51:23.916921 | 2017-08-27T10:49:04 | 2017-08-27T10:49:04 | 101,653,887 | 2 | 0 | null | 2017-08-28T14:51:32 | 2017-08-28T14:51:32 | null | ISO-8859-2 | C++ | false | false | 1,449 | h | /* This file is part of T-Rekt 3D!
Copyright (C) 2017 Manuel Rodríguez Matesanz
> 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/>.
> See LICENSE for information.
*/
#pragma once
#ifndef _SPLASH_SCREEN_H_
#define _SPLASH_SCREEN_H_
#include <sftd.h>
#include <sf2d.h>
#include <sfil.h>
#include "Settings.h"
#include "sound.h"
#include "scene.h"
#include "SceneManager.h"
class SplashScreen: public Scene
{
public:
enum SPLASH_STATE { OPENING, STAY, ENDING };
SplashScreen(); // Constructor
~SplashScreen();
void Start() override;
void Draw() override;
void CheckInputs() override;
void Update() override;
void GoToGame();
private:
int m_splashOpacity, m_scTimer;
bool m_sfxSplash, m_goToGame;
sound * m_SFX;
sf2d_texture * m_bgTop, *m_bgBot;
SPLASH_STATE m_splashOpeningState;
};
#endif | [
"manurocker95@gmail.com"
] | manurocker95@gmail.com |
c060c56091847260ce8a0d2c105b0f4d5ba22af2 | fed3ea2d8f4289feb97f9b1abc6233f29257ec02 | /C-example/DoubleList/MyList.cpp | 988640428b17752684b21327c08b2702b64e6143 | [] | no_license | Aves-LH/A-rookie | 88b3f0de39ff466b88dc65d21cfaba40aca73c4f | 86613fa3d238f2224fa19fcc877dc72cb982d5e4 | refs/heads/master | 2023-02-19T02:20:30.516144 | 2023-02-10T02:52:12 | 2023-02-10T02:52:12 | 225,284,693 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,798 | cpp | #include "pch.h"
#include "MyList.h"
NODE* CreateNode()
{
NODE *pNew = new NODE;
if (NULL != pNew)
{
cout << "Input : ";
cin >> pNew->m_nNum;
pNew->pPrev = NULL;
pNew->pNext = NULL;
}
return pNew;
}
NODE* Create()
{
return CreateNode();
}
int Add(NODE *pHead)
{
if (NULL == pHead)
{
return -1;
}
NODE *pNew = CreateNode();
if (NULL == pNew)
{
return -2;
}
NODE *pTemp = pHead;
while (NULL != pTemp->pNext)
{
pTemp = pTemp->pNext;
}
pTemp->pNext = pNew;
pNew->pPrev = pTemp;
return 0;
}
int Insert(NODE **ppHead, NODE *pPos, MODE mode)
{
if (NULL == *ppHead || NULL == ppHead)
{
return -1;
}
if (NULL == pPos)
{
return -3;
}
NODE *pNew = CreateNode();
if (NULL == pNew)
{
return -1;
}
if (mode == front)
{
if (pPos == *ppHead)
{
*ppHead = pNew;
pNew->pNext = pPos;
pPos->pPrev = pNew;
}
else
{
pPos->pPrev->pNext = pNew;
pNew->pPrev = pPos->pPrev;
pPos->pPrev = pNew;
pNew->pNext = pPos;
}
}
else
{
if (NULL == pPos->pNext)
{
pPos->pNext = pNew;
pNew->pPrev = pPos;
}
else
{
pPos->pNext->pPrev = pNew;
pNew->pNext = pPos->pNext;
pNew->pPrev = pPos;
pPos->pNext = pNew;
}
}
return 0;
}
NODE* Find(NODE *pHead, int nFind)
{
NODE *pTemp = NULL;
if (NULL != pHead)
{
pTemp = pHead;
while (NULL != pTemp)
{
if (nFind == pTemp->m_nNum)
{
break;
}
pTemp = pTemp->pNext;
}
}
return pTemp;
}
int Delete(NODE **ppHead, NODE *pPos)
{
if (NULL == *ppHead || NULL == ppHead)
{
return -1;
}
if (NULL == pPos)
{
return -3;
}
if (pPos == *ppHead)
{
*ppHead = pPos->pNext;
if (NULL != (*ppHead))
{
(*ppHead)->pPrev = NULL;
}
}
else
{
if (NULL == pPos->pNext)
{
pPos->pPrev->pNext = NULL;
}
else
{
pPos->pPrev->pNext = pPos->pNext;
pPos->pNext->pPrev = pPos->pPrev;
}
}
return 0;
}
int Clear(NODE **ppHead)
{
if (NULL == *ppHead || NULL == ppHead)
{
return -1;
}
NODE *pTemp = *ppHead;
while (NULL != pTemp)
{
(*ppHead) = pTemp->pNext;
delete pTemp;
pTemp = *ppHead;
}
return 0;
}
int Modify(NODE *pHead)
{
if (NULL == pHead)
{
return -1;
}
int nPos = 0;
int nChange = 0;
cout << "Where you want to modify: ";
cin >> nPos;
cout << "What to modify: ";
cin >> nChange;
NODE *pTemp = Find(pHead, nPos);
pTemp->m_nNum = nChange;
return 0;
}
int Show(NODE *pHead)
{
if (NULL == pHead)
{
return -1;
}
NODE *pTemp = pHead;
while (NULL != pTemp)
{
cout << "Data: " << pTemp->m_nNum << endl;
pTemp = pTemp->pNext;
}
return 0;
}
| [
"1063767838@qq.com"
] | 1063767838@qq.com |
8daf5c9722279983c7cb46806a71456206a81e36 | dee9e7a5b9b0ecf3b9a8ddf7f30f972045217a45 | /gdem_client/pointmark.h | ac81112c25ea7b42c9ca6961891817c43168ba43 | [] | no_license | shengzhe8688/QGlobe | 3e2d5c86ad6a2bff89f3773385fa8fd84d4ddf57 | 8e13b894fc1d89a18869c979740fefe47a161eeb | refs/heads/master | 2022-11-12T12:19:06.046336 | 2020-07-05T14:04:59 | 2020-07-05T14:04:59 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 407 | h | #ifndef POINTMARK_H
#define POINTMARK_H
#include "gdemclientbase.h"
// 2009.11.27 Modified by ChaKI
class RenderFrame;
class PointMark
{
public:
PointMark(RenderFrame *render);
~PointMark();
void SetPosition(CursorState *event);
void PaintEvent(QPainter *painter);
protected:
RenderFrame *m_renderFrm;
QImage m_img;
int m_x;
int m_y;
};
#endif // POINTMARK_H
| [
"wugis3@yahoo.com"
] | wugis3@yahoo.com |
515c129970b97e6e52d97a547b355e7d5c4b2ce3 | 081f0d0253c2f9ba1a9c8c5910d132cf10cf62c9 | /PaSpyRouter2016MFC/MemoMAC.cpp | 22f5debb20af82b38e65095fd03299b97b1d4892 | [] | no_license | asm32cn/PaSpyRouter2016 | 9b2f1ef9b400f97596a45fc761c6fd848fbe6542 | 8bb25da52f96adab671e1612e6f04f59f9548149 | refs/heads/master | 2020-03-16T03:50:10.474539 | 2018-05-07T18:02:01 | 2018-05-07T18:02:01 | 132,497,209 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 697 | cpp | // MemoMAC.cpp: implementation of the CMemoMAC class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "PaSpyRouter2016MFC.h"
#include "MemoMAC.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
CMemoMAC::CMemoMAC()
{
}
CMemoMAC::~CMemoMAC()
{
}
void CMemoMAC::Init(INT nID, CString strMacAddress, CString strMemo)
{
m_nID = nID;
m_strID.Format("%d", m_nID);
m_strMacAddress = strMacAddress;
m_strMemo = strMemo;
}
| [
"asm32@qq.com"
] | asm32@qq.com |
5cd08916fe4303b107836e642e3dedf5aa4c84d5 | 63a7c91b15122745c36aa1c8955e25beee2a7cd0 | /shibarides/auth/ShibaRidesAuthInterfaces.h | 7d3ea2330b345833e03cd684506a9522593c1e8f | [] | no_license | titosilva/shibarides | 7a20f074be9544559304fc7981343d9b009c86c9 | 2d0163ba1fc51b0879b1561697f903fceb9eea78 | refs/heads/master | 2020-07-22T21:03:58.563066 | 2019-11-14T21:01:58 | 2019-11-14T21:01:58 | 207,326,198 | 1 | 0 | null | 2019-09-26T23:22:34 | 2019-09-09T14:15:53 | C++ | UTF-8 | C++ | false | false | 988 | h | #ifndef SHIBA_AUTH_INTERFACES_H__
#define SHIBA_AUTH_INTERFACES_H__
#include <stdexcept>
#include "../domains/ShibaRidesDomains.hpp"
using namespace std;
using namespace shibarides;
// Interfaces do subsistema de autenticaçao
// Interfaces
// Interface da camada de aplicação
class IAuthView;
// Interface da camada de serviço
class IAuthServ;
class IAuthView{
// Métodos abstratos puros que serão sorbeescritos pelas classes controladoras
public:
// Mostra tela de login e realiza login
virtual bool login(Email &email) throw (runtime_error) = 0;
// Seta a controladora
virtual void setServiceController(IAuthServ *) = 0;
// Metodo virtual destrutor
virtual ~IAuthView(){};
};
class IAuthServ{
// Métodos abstratos puros que serão sorbeescritos pelas classes controladoras
public:
// Realiza a autenticação de um usuario
virtual bool authenticate(Email email, Senha senha) throw (runtime_error)=0;
};
#endif // SHIBA_AUTH_INTERFACES_H__
| [
"jt.mat@hotmail.com"
] | jt.mat@hotmail.com |
42ea8490b71d9b99b6b969b4d2a88f89035d7123 | 474ca3fbc2b3513d92ed9531a9a99a2248ec7f63 | /ThirdParty/boost_1_63_0/libs/hana/test/map/cnstr.copy.cpp | e59f27437907fc32c2c79ef67faa6e5f458f19f2 | [
"BSL-1.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | LazyPlanet/MX-Architecture | 17b7b2e6c730409b22b7f38633e7b1f16359d250 | 732a867a5db3ba0c716752bffaeb675ebdc13a60 | refs/heads/master | 2020-12-30T15:41:18.664826 | 2018-03-02T00:59:12 | 2018-03-02T00:59:12 | 91,156,170 | 4 | 0 | null | 2018-02-04T03:29:46 | 2017-05-13T07:05:52 | C++ | UTF-8 | C++ | false | false | 2,172 | cpp | // Copyright Louis Dionne 2013-2016
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
#include <boost/hana/assert.hpp>
#include <boost/hana/equal.hpp>
#include <boost/hana/integral_constant.hpp>
#include <boost/hana/map.hpp>
#include <boost/hana/type.hpp>
#include <string>
namespace hana = boost::hana;
int main() {
{
auto t0 = hana::make_map();
auto t_implicit = t0;
auto t_explicit(t0);
(void)t_explicit;
(void)t_implicit;
}
{
auto t0 = hana::make_map(hana::make_pair(hana::int_c<2>, hana::int_c<20>));
auto t_implicit = t0;
auto t_explicit(t0);
(void)t_implicit;
(void)t_explicit;
}
{
auto t0 = hana::make_map(hana::make_pair(hana::int_c<2>, hana::int_c<20>),
hana::make_pair(hana::int_c<3>, hana::int_c<30>));
auto t_implicit = t0;
auto t_explicit(t0);
(void)t_implicit;
(void)t_explicit;
}
{
auto t0 = hana::make_map(hana::make_pair(hana::int_c<2>, hana::int_c<20>),
hana::make_pair(hana::int_c<3>, hana::int_c<30>),
hana::make_pair(hana::type_c<void>, hana::type_c<void*>));
auto t_implicit = t0;
auto t_explicit(t0);
(void)t_implicit;
(void)t_explicit;
}
{
constexpr auto t0 = hana::make_map(
hana::make_pair(hana::int_c<2>, hana::int_c<20>),
hana::make_pair(hana::int_c<3>, hana::int_c<30>),
hana::make_pair(hana::type_c<void>, hana::type_c<void*>));
constexpr auto t_implicit = t0;
constexpr auto t_explicit(t0);
(void)t_implicit;
(void)t_explicit;
}
{
auto t0 = hana::make_map(hana::make_pair(hana::int_c<2>, std::string{"abcdef"}));
auto copy = t0;
BOOST_HANA_RUNTIME_CHECK(
copy == hana::make_map(hana::make_pair(hana::int_c<2>, std::string{"abcdef"}))
);
}
}
| [
"1211618464@qq.com"
] | 1211618464@qq.com |
73533d950679d0b4233a5a7ef972e9a607c4c312 | 32b0e91dfe2249503856f45b0e05d94a7cafbe0b | /GRT/DataStructures/RegressionSample.h | 638674a03c78a1153fbb5a684572f5a9ec07a548 | [] | no_license | eboix/Myo-Gesture | 7729f93a636fb959e646cf4edaef7607a2e813dd | 3f54efa3aeb893823dfdd876284e1abbc048257c | refs/heads/master | 2021-01-10T12:30:21.718019 | 2018-06-10T19:09:06 | 2018-06-10T19:09:06 | 46,208,290 | 2 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 2,647 | h | /**
@file
@author Nicholas Gillian <ngillian@media.mit.edu>
@version 1.0
@brief This class stores the input vector and target vector for a single labelled regression instance.
*/
/**
GRT MIT License
Copyright (c) <2012> <Nicholas Gillian, Media Lab, MIT>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software
and associated documentation files (the "Software"), to deal in the Software without restriction,
including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial
portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef GRT_REGRESSION_SAMPLE_HEADER
#define GRT_REGRESSION_SAMPLE_HEADER
#include "../Util/GRTCommon.h"
namespace GRT{
class RegressionSample{
public:
RegressionSample();
RegressionSample(const VectorDouble &inputVector,const VectorDouble &targetVector);
RegressionSample(const RegressionSample &rhs);
~RegressionSample();
RegressionSample& operator= (const RegressionSample &rhs){
if( this != &rhs){
this->inputVector = rhs.inputVector;
this->targetVector = rhs.targetVector;
}
return *this;
}
static bool sortByInputVectorAscending(const RegressionSample &a,const RegressionSample &b){
return a.inputVector < b.inputVector;
}
static bool sortByInputVectorDescending(const RegressionSample &a,const RegressionSample &b){
return a.inputVector > b.inputVector;
}
void clear();
void set(const VectorDouble &inputVector,const VectorDouble &targetVector);
UINT getNumInputDimensions() const;
UINT getNumTargetDimensions() const;
double getInputVectorValue(const UINT index) const;
double getTargetVectorValue(const UINT index) const;
const VectorDouble& getInputVector() const;
const VectorDouble& getTargetVector() const;
private:
VectorDouble inputVector;
VectorDouble targetVector;
};
} //End of namespace GRT
#endif //GRT_REGRESSION_SAMPLE_HEADER
| [
"eboix@users.noreply.github.com"
] | eboix@users.noreply.github.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.