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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
5b2f0bc2e22b04fcd71984272718521ac249ab05 | 111063199c8d3a61ae22a0c1753b6565e802d516 | /shopping mall/projevol2/Book.cpp | d5e7279e8a02eb10f617ab64e8965a14a82178fe | [] | no_license | imperio/ShoppingMall | 20d274ca8ef24255a4d363590fe51e900f4b1c3f | 061a822f6cc20d6f33e84e3e134c62f453f85f8d | refs/heads/master | 2021-01-22T21:00:14.639989 | 2013-07-14T23:57:08 | 2013-07-14T23:57:08 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,227 | cpp | #include "Book.h"
Book::Book(){}
Book::Book(string name,int id,int storeid,double price,string author,string publisher){
setName(name);
setId(id);
setStoreId(storeid);
setPrice(price);
setAuthor(author);
setPublisher(publisher);
}
void Book::printProperties(){
cout<<"Book's"<<endl
<<"name: "<<getName()<<endl
<<"id: "<<getId()<<endl
<<"store id: "<<getStoreId()<<endl
<<"price: "<<getPrice()<<endl
<<"type: "<<getType()<<endl
<<"author: "<<getAuthor()<<endl
<<"publisher: "<<getPublisher()<<endl;
}
void Book::setName(string name){
this->name=name;}
void Book::setAuthor(string author){
this->author=author;}
void Book::setId(int id){
this->id=id;}
void Book::setPublisher(string publisher){
this->publisher=publisher;}
void Book::setPrice(double price){
this->price=price;}
void Book::setStoreId(int storeId){
this->storeId=storeId;}
void Book::setType(string type){
this->type=type;}
string Book::getType(){
return type;}
string Book::getName(){
return name;}
int Book::getId(){
return id;}
double Book::getPrice(){
return price;}
int Book::getStoreId(){
return storeId;}
string Book::getAuthor(){
return author;}
string Book::getPublisher(){
return publisher;}
| [
"nymph_tuuche@hotmail.com"
] | nymph_tuuche@hotmail.com |
8eed1f25b1c1aafa6e7478b697b7a37ba9127f0f | 6e245b4c2fb0e2ffc94d4ecbb5ee3db3156453a1 | /Output/UWP/Il2CppOutputProject/Source/lumpedcpp/Lump_libil2cpp_gc.cpp | bec656967fcecac5ed7daf42014e99fa128acc2f | [
"MIT"
] | permissive | MohaElder/SelfReliance | 5f9d40f8ed8a1513ed94e2cb303e68daf1f0dfbd | f5a08914ca033ba334987db5c9e5b3a0abb38cb3 | refs/heads/master | 2020-06-26T15:59:57.805074 | 2020-02-22T12:22:41 | 2020-02-22T12:22:41 | 199,678,060 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 602 | cpp | #include "il2cpp-config.h"
#include "E:\Self-Reliance\Output\UWP\Il2CppOutputProject\IL2CPP\libil2cpp\gc\BoehmGC.cpp"
#include "E:\Self-Reliance\Output\UWP\Il2CppOutputProject\IL2CPP\libil2cpp\gc\GCHandle.cpp"
#include "E:\Self-Reliance\Output\UWP\Il2CppOutputProject\IL2CPP\libil2cpp\gc\GarbageCollector.cpp"
#include "E:\Self-Reliance\Output\UWP\Il2CppOutputProject\IL2CPP\libil2cpp\gc\NullGC.cpp"
#include "E:\Self-Reliance\Output\UWP\Il2CppOutputProject\IL2CPP\libil2cpp\gc\WriteBarrier.cpp"
#include "E:\Self-Reliance\Output\UWP\Il2CppOutputProject\IL2CPP\libil2cpp\gc\WriteBarrierValidation.cpp"
| [
"calen0909@hotmail.com"
] | calen0909@hotmail.com |
e3f4e957caffbeb1186b97d0436f689df9f78e99 | 3841f7991232e02c850b7e2ff6e02712e9128b17 | /小浪底泥沙三维/EV_Xld/jni/src/EV_Spatial_2DProxy_CSharp/wrapper/spatial2dproxy_config_wrapper.cpp | af5ad7dd514b9427d31de32a1b3746a63bab7f84 | [] | no_license | 15831944/BeijingEVProjects | 62bf734f1cb0a8be6fed42cf6b207f9dbdf99e71 | 3b5fa4c4889557008529958fc7cb51927259f66e | refs/heads/master | 2021-07-22T14:12:15.106616 | 2017-10-15T11:33:06 | 2017-10-15T11:33:06 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 158 | cpp | /* This file is produced by the P/Invoke AutoWrapper Utility
Copyright (c) 2012 by EarthView Image Inc */
#include "spatial2dproxy/spatial2dproxy_config.h"
| [
"yanguanqi@aliyun.com"
] | yanguanqi@aliyun.com |
15e632eca0767f7345d0292e8e7eaf21e7907b36 | f3230ff5cb23370c422f325496e898ecd8cfc740 | /Core/AssetSystem/PrefabSystem.cpp | 6f92b47a8eb8219bb49e7d8ba9b28ebcfe66b4b6 | [
"MIT"
] | permissive | overkillstudios/ok-1 | 40ae605a1c8e27f5f1168d28f7317b640858943b | c716adfca34744c5085680c826812c42d1ce3f48 | refs/heads/master | 2021-09-20T15:22:44.162355 | 2018-08-11T08:02:46 | 2018-08-11T08:02:46 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 43 | cpp | #include "Core/AssetSystem/PrefabSystem.h"
| [
"jonasjso.work@protonmail.com"
] | jonasjso.work@protonmail.com |
f215ed3ae117a4dfde8fd8ef4594c989341e9aa3 | c79aa367b21408235f704516a2f363b8bdafa58f | /test.txt | de44ecc4af48e9fcb8799c8bb04028ccee066e8c | [] | no_license | ichbinwilly/ChungliCheng | 523f2fb7d9e3ae76e44039b24e56bdd31afbe4db | f342c48668becdb63af50b8d87af65f4a3cde779 | refs/heads/master | 2018-09-19T01:05:23.366824 | 2018-06-06T05:56:13 | 2018-06-06T05:56:13 | 104,844,393 | 0 | 1 | null | 2017-09-26T06:39:39 | 2017-09-26T06:23:45 | null | UTF-8 | C++ | false | false | 709 | txt | /*
Blink
Turns on an LED on for one second, then off for one second, repeatedly.
This example code is in the public domain.
*/
// Pin 13 has an LED connected on most Arduino boards.
// give it a name:
int led = 13;
// the setup routine runs once when you press reset:
void setup() {
// initialize the digital pin as an output.
pinMode(led, OUTPUT);
}
// the loop routine runs over and over again forever:
void loop() {
digitalWrite(led, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(led, LOW); // turn the LED off by making the voltage LOW
delay(2000); // wait for a second
} | [
"WILLY.HSU@delta.corp"
] | WILLY.HSU@delta.corp |
b15a5b4ab0e305981f6ad6f1caa92a4adb4a7dbf | 09f3c007597e0cbc38761e0d85a31214c6cac7c6 | /ChanVeseIos/PathprobabilityEstimation.h | b39add5fd75b0e80f9fdbee05d13512cc9144511 | [] | no_license | z3383672/ChanVaseRandomWalk | 965a7539c127c7156ff57a1a2eb7bce58644e8d9 | 92cfb15aa30b5a59a7adf0d116d26f7522630836 | refs/heads/master | 2016-09-06T09:09:28.853569 | 2014-07-30T00:55:40 | 2014-07-30T00:55:40 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,330 | h | //
// PathProbabilityCalculation.h
// ChanVeseIos
//
// Created by Mohammadreza Hosseini on 27/05/2014.
// Copyright (c) 2014 Mohammadreza Hosseini. All rights reserved.
//
#include <iostream>
#include <opencv2/opencv.hpp>
#include "Eigen/Sparse"
#include "Eigen/Sparse"
typedef Eigen::SparseMatrix<double> SpMat; // declares a column-major sparse matrix type of double
typedef Eigen::Triplet<double> T;
class PathprobabilityEstimation
{
public:
void removerepetitivecoordinates(NSMutableArray *coordinates,cv::Mat);
void createseeds();
double makeweights(NSInteger,NSInteger);
double ** Laplacian();
NSMutableArray *ClickedCoordinates=[[NSMutableArray alloc] init];
NSMutableArray *OutCoordinates=[[NSMutableArray alloc] init];
NSMutableArray *edges=[[NSMutableArray alloc] init];
NSMutableArray *weights=[[NSMutableArray alloc] init];
int *boundary;
void set(cv::Mat, double,double);
double *LU1D;
double *BTranspose1D;
void buildProblem(std::vector<T>& coefficients, int n);
void insertCoefficient(int id, int i, int j, std::vector<T>& coeffs,int n);
void calcLaplacian();
cv::Mat phi;
private:
cv::Mat img;
double lowerthreshold;
double upperthreshold;
double sumoverrow;
NSInteger numberofClickedin;
NSInteger numberofTest;
};
| [
"Kyle@isidorey.com"
] | Kyle@isidorey.com |
fecc86b07ae23e3780f561cc62291271ede93b25 | 9cbe09d92c128b1a522aa28f9174df3f6996b176 | /src/test/test_simplicity.cpp | 0dc05ba18094547e3c14742a0e660f4d10a5a2b8 | [
"MIT",
"OpenSSL"
] | permissive | andreydiveev/Simplicity | 9482839111c3817eb2696af95393e6e422e788d0 | 1c36ff29b33cd7d552818d0228d02ee263eb9f47 | refs/heads/master | 2021-04-15T17:52:58.868403 | 2018-03-22T10:37:29 | 2018-03-22T10:37:29 | 126,319,442 | 0 | 0 | MIT | 2018-03-22T10:35:33 | 2018-03-22T10:35:33 | null | UTF-8 | C++ | false | false | 2,436 | cpp | // Copyright (c) 2011-2013 The Bitcoin Core developers
// Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#define BOOST_TEST_MODULE Simplicity Test Suite
#include "main.h"
#include "random.h"
#include "txdb.h"
#include "ui_interface.h"
#include "util.h"
#ifdef ENABLE_WALLET
#include "db.h"
#include "wallet.h"
#endif
#include <boost/filesystem.hpp>
#include <boost/test/unit_test.hpp>
#include <boost/thread.hpp>
CClientUIInterface uiInterface;
CWallet* pwalletMain;
extern bool fPrintToConsole;
extern void noui_connect();
struct TestingSetup {
CCoinsViewDB *pcoinsdbview;
boost::filesystem::path pathTemp;
boost::thread_group threadGroup;
TestingSetup() {
SetupEnvironment();
fPrintToDebugLog = false; // don't want to write to debug.log file
fCheckBlockIndex = true;
SelectParams(CBaseChainParams::UNITTEST);
noui_connect();
#ifdef ENABLE_WALLET
bitdb.MakeMock();
#endif
pathTemp = GetTempPath() / strprintf("test_simplicity_%lu_%i", (unsigned long)GetTime(), (int)(GetRand(100000)));
boost::filesystem::create_directories(pathTemp);
mapArgs["-datadir"] = pathTemp.string();
pblocktree = new CBlockTreeDB(1 << 20, true);
pcoinsdbview = new CCoinsViewDB(1 << 23, true);
pcoinsTip = new CCoinsViewCache(pcoinsdbview);
InitBlockIndex();
#ifdef ENABLE_WALLET
bool fFirstRun;
pwalletMain = new CWallet("wallet.dat");
pwalletMain->LoadWallet(fFirstRun);
RegisterValidationInterface(pwalletMain);
#endif
nScriptCheckThreads = 3;
for (int i=0; i < nScriptCheckThreads-1; i++)
threadGroup.create_thread(&ThreadScriptCheck);
RegisterNodeSignals(GetNodeSignals());
}
~TestingSetup()
{
threadGroup.interrupt_all();
threadGroup.join_all();
UnregisterNodeSignals(GetNodeSignals());
#ifdef ENABLE_WALLET
delete pwalletMain;
pwalletMain = NULL;
#endif
delete pcoinsTip;
delete pcoinsdbview;
delete pblocktree;
#ifdef ENABLE_WALLET
bitdb.Flush(true);
#endif
boost::filesystem::remove_all(pathTemp);
}
};
BOOST_GLOBAL_FIXTURE(TestingSetup);
void Shutdown(void* parg)
{
exit(0);
}
void StartShutdown()
{
exit(0);
}
bool ShutdownRequested()
{
return false;
}
| [
"36132447+SimplicityDev2018@users.noreply.github.com"
] | 36132447+SimplicityDev2018@users.noreply.github.com |
ef8ef43103117c1f55e0ad4259daf4a74d5888f2 | 6b232cd740b68bc3ab9cd86177b5e25309475a3b | /attic/eiconman_1_1/Vector.h | b2913946d6c0cb46f101d4f8773e3c90641c926e | [] | no_license | edeproject/svn | 956ebc9a8fd89e914bbef159a9e01b9340161921 | 64c8013b1543a856e1ab76e14bc1c818772f89bc | refs/heads/master | 2021-01-20T20:03:36.084431 | 2016-06-16T12:19:52 | 2016-06-16T12:19:52 | 61,290,259 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,504 | h | #ifndef __VECTOR_H__
#define __VECTOR_H__
/*
* Herb Sutter said:
* "Reuse code specially standard library code instead of handcrafting your own.
* It's faster, easier, and safer."
*
* I say:
* "Yea right. This is more fun!"
*/
#include <stddef.h>
#include <string.h> // memcpy, memmove
#include <assert.h>
inline void* operator new(size_t s, void* p)
{
return p;
}
#define __IT_ASSERT(it) assert(it != NULL && "Iterator have NULL value")
template <typename T>
inline void __Construct(T* p)
{
new (p) T;
}
template <typename T>
inline void __Construct(T* p, const T& val)
{
new (p) T(val);
}
template <typename T>
inline void __Destruct(T* p)
{
p->~T();
}
template <typename T>
class Vector
{
private:
T* ptr_;
size_t size_;
size_t alloc_;
Vector(const Vector<T>&);
void operator=(const Vector<T>&);
void append(size_t v);
void __Realloc(size_t s);
public:
typedef size_t size_type;
typedef T* iterator;
typedef const T* const_iterator;
Vector() : ptr_(0), size_(0), alloc_(0) { }
Vector(size_t n) : ptr_(0), size_(0), alloc_(0) { append(n); }
Vector(size_t n, const T& value) : ptr_(0), size_(0), alloc_(0) { insert(ptr_+size_, n, value); }
~Vector();
iterator begin() { return ptr_; }
const_iterator begin() const { return ptr_; }
iterator end() { return ptr_ + size_; }
const_iterator end() const { return ptr_ + size_; }
size_type capacity(void) const { return alloc_; }
size_type size(void) { return size_; }
void clear(void) { erase(begin(), end()); }
T& operator[](size_t i) { return ptr_[i]; }
const T& operator[](size_t i) const { return ptr_[i]; }
iterator erase(const_iterator b, const_iterator e);
void reserve(size_t s) { if(alloc_ < s) __Realloc(s); }
void insert(const_iterator pos, size_t s, const T& value);
void push_back(const T& t);
bool empty(void) { return (size_ == 0); }
};
template<typename T>
void Vector<T>::append(size_t s)
{
reserve(size_ + s);
while(s-- > 0)
{
__Construct(ptr_ + size_);
size_++;
}
}
template<typename T>
T* Vector<T>::erase(const T* first, const T* last)
{
if(first == last)
return (T*) first;
__IT_ASSERT(first); __IT_ASSERT(last);
// bounds check
int bounds = size_;
for(const_iterator p = first; p != last && bounds >= 0; ++p, --bounds)
__Destruct(p);
// now rellocate data if needed
if(last != ptr_ + size_)
memmove((T*)first, last, sizeof(T) * ((ptr_ + size_) - last));
size_ -= last - first;
return (T*) first;
}
template<typename T>
Vector<T>::~Vector()
{
if(!ptr_)
return;
erase(begin(), end());
::operator delete((void*)ptr_);
}
template<typename T>
void Vector<T>::__Realloc(size_t sz)
{
printf("Request %i size: %i\n", alloc_, sz);
size_t newsz = alloc_ * 2;
if(sz > newsz)
newsz += sz;
void* p = ::operator new(newsz * sizeof(T));
alloc_ = newsz;
if(ptr_)
{
memcpy(p, ptr_, size_ * sizeof(T));
::operator delete((void*)ptr_);
}
ptr_ = (T*) p;
}
template<typename T>
void Vector<T>::push_back(const T& val)
{
reserve(size_ + 1);
__Construct(ptr_ + size_, val);
size_++;
}
template<typename T>
void Vector<T>::insert(const T* pos, size_t s, const T& value)
{
__IT_ASSERT(pos);
size_t i = pos - ptr_;
reserve(size_ + s);
if(i != size_)
memmove(i + ptr_ + s, ptr_ + i, (size_ - i) * sizeof(T));
for(T* pp = ptr_ + i; s-- > 0; ++pp)
{
__Construct(pp, value);
size_++;
}
}
#define vector Vector
#endif
| [
"karijes@users.sf.net"
] | karijes@users.sf.net |
0d731d80de346482a97c2e4fc80f7395fe0c0a65 | 16e21287e52f91485098ab3416d53ebd9b992226 | /HomeStudy/dxTest/dxTest.cpp | f0af0a11bfc76af4f0d1dde1a34cb8d0fdd4201d | [] | no_license | LeeMyeungJun/INHAstudy | e4ab14d897b23de10531072d231e3e01055ec65b | 0be8d4bf597b413dcd99d93dbbf15a45983cf325 | refs/heads/master | 2023-04-02T22:16:36.785554 | 2020-10-15T08:37:45 | 2020-10-15T08:37:45 | 283,198,221 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,857 | cpp | // dxTest.cpp : Defines the entry point for the application.
//
#include "stdafx.h"
#include "dxTest.h"
#define MAX_LOADSTRING 100
// Global Variables:
HWND g_hWnd;
HINSTANCE hInst; // current instance
WCHAR szTitle[MAX_LOADSTRING]; // The title bar text
WCHAR szWindowClass[MAX_LOADSTRING]; // the main window class name
// Forward declarations of functions included in this code module:
ATOM MyRegisterClass(HINSTANCE hInstance);
BOOL InitInstance(HINSTANCE, int);
LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
INT_PTR CALLBACK About(HWND, UINT, WPARAM, LPARAM);
int APIENTRY wWinMain(_In_ HINSTANCE hInstance,
_In_opt_ HINSTANCE hPrevInstance,
_In_ LPWSTR lpCmdLine,
_In_ int nCmdShow)
{
UNREFERENCED_PARAMETER(hPrevInstance);
UNREFERENCED_PARAMETER(lpCmdLine);
// TODO: Place code here.
// Initialize global strings
LoadStringW(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING);
LoadStringW(hInstance, IDC_DXTEST, szWindowClass, MAX_LOADSTRING);
MyRegisterClass(hInstance);
// Perform application initialization:
if (!InitInstance (hInstance, nCmdShow))
{
return FALSE;
}
HACCEL hAccelTable = LoadAccelerators(hInstance, MAKEINTRESOURCE(IDC_DXTEST));
MSG msg;
// Main message loop:
while (GetMessage(&msg, nullptr, 0, 0))
{
if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
return (int) msg.wParam;
}
//
// FUNCTION: MyRegisterClass()
//
// PURPOSE: Registers the window class.
//
ATOM MyRegisterClass(HINSTANCE hInstance)
{
WNDCLASSEXW wcex;
wcex.cbSize = sizeof(WNDCLASSEX);
wcex.style = CS_HREDRAW | CS_VREDRAW;
wcex.lpfnWndProc = WndProc;
wcex.cbClsExtra = 0;
wcex.cbWndExtra = 0;
wcex.hInstance = hInstance;
wcex.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_DXTEST));
wcex.hCursor = LoadCursor(nullptr, IDC_ARROW);
wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
wcex.lpszMenuName = MAKEINTRESOURCEW(IDC_DXTEST);
wcex.lpszClassName = szWindowClass;
wcex.hIconSm = LoadIcon(wcex.hInstance, MAKEINTRESOURCE(IDI_SMALL));
return RegisterClassExW(&wcex);
}
//
// FUNCTION: InitInstance(HINSTANCE, int)
//
// PURPOSE: Saves instance handle and creates main window
//
// COMMENTS:
//
// In this function, we save the instance handle in a global variable and
// create and display the main program window.
//
BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
{
hInst = hInstance; // Store instance handle in our global variable
HWND hWnd = CreateWindowW(szWindowClass, szTitle, WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, nullptr, nullptr, hInstance, nullptr);
if (!hWnd)
{
return FALSE;
}
g_hWnd = hWnd;
ShowWindow(hWnd, nCmdShow);
UpdateWindow(hWnd);
return TRUE;
}
//
// FUNCTION: WndProc(HWND, UINT, WPARAM, LPARAM)
//
// PURPOSE: Processes messages for the main window.
//
// WM_COMMAND - process the application menu
// WM_PAINT - Paint the main window
// WM_DESTROY - post a quit message and return
//
//
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message)
{
case WM_COMMAND:
{
int wmId = LOWORD(wParam);
// Parse the menu selections:
switch (wmId)
{
case IDM_ABOUT:
DialogBox(hInst, MAKEINTRESOURCE(IDD_ABOUTBOX), hWnd, About);
break;
case IDM_EXIT:
DestroyWindow(hWnd);
break;
default:
return DefWindowProc(hWnd, message, wParam, lParam);
}
}
break;
case WM_PAINT:
{
PAINTSTRUCT ps;
HDC hdc = BeginPaint(hWnd, &ps);
// TODO: Add any drawing code that uses hdc here...
EndPaint(hWnd, &ps);
}
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
default:
return DefWindowProc(hWnd, message, wParam, lParam);
}
return 0;
}
// Message handler for about box.
INT_PTR CALLBACK About(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
UNREFERENCED_PARAMETER(lParam);
switch (message)
{
case WM_INITDIALOG:
return (INT_PTR)TRUE;
case WM_COMMAND:
if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL)
{
EndDialog(hDlg, LOWORD(wParam));
return (INT_PTR)TRUE;
}
break;
}
return (INT_PTR)FALSE;
}
| [
"mong356@naver.com"
] | mong356@naver.com |
82902980fdeaab5baff1706ea49831a258c2776b | 47483a8e90ccf1e50d23f851496a8ab7d2944bd2 | /include/tango-gl/material.h | c0dd2aa9bfd58caca4112b9ea5bd7a9c74328838 | [
"Beerware"
] | permissive | sjfricke/tango_gl | 1e81b596d64e5331b26f4da487970e1f696a246b | b087f3e3c8894641d90cb8c4e3ae9b7a61f5a988 | refs/heads/master | 2021-01-19T10:34:51.423249 | 2017-02-26T12:53:21 | 2017-02-26T12:53:21 | 82,193,230 | 1 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 5,181 | h | /*
* Copyright 2014 Google Inc. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef TANGO_GL_MATERIAL_H_
#define TANGO_GL_MATERIAL_H_
#include <unordered_map>
#include "tango-gl/bounding_box.h"
#include "tango-gl/drawable_object.h"
#include "tango-gl/tango-gl.h"
#include "tango-gl/camera.h"
#include "tango-gl/transform.h"
#include "tango-gl/util.h"
#include "tango-gl/segment.h"
#include "tango-gl/texture.h"
namespace tango_gl {
// Describes how to draw a mesh.
//
// It is expected that SetShader and SetParam will be called a bunch
// of times when one of these is first created and then rarely at
// runtime.
class Material {
public:
// Create a new material using the fallback shader.
Material();
// Destroy a material, destroying the underlying shader as well.
~Material();
Material(const Material &) = delete;
void operator=(const Material &) = delete;
// Set a new shader for this material. Returns if the shader
// properly compiled.
bool SetShader(const char *vertex_shader, const char *pixel_shader);
// Set a float parameter for this material. Returns if the
// parameter was found and set.
bool SetParam(const char *uniform_name, float val);
// Set a vector parameter for this material. Returns if the
// parameter was found and set.
bool SetParam(const char *uniform_name, const glm::vec4 &vals);
// Set a texture parameter for this material.
bool SetParam(const char *uniform_name, Texture *texture);
// Bind all parameters for this material to GL state.
void BindParams() const;
// Get the underlying GL shader program for this material.
GLuint GetShaderProgram() const { return shader_program_; }
// Get the shader program's vertex attribute index.
GLint GetAttribVertices() const { return attrib_vertices_; }
// Get the shader program's normal attribute index.
GLint GetAttribNormals() const { return attrib_normals_; }
// Get the shader program's color attribute index.
GLint GetAttribColors() const { return attrib_colors_; }
// Get the UVs coords attribute of the texture
GLint GetAttribUVs() const { return attrib_uv_; }
// Get the shader program's Model-View-Projection matrix uniform index.
GLint GetUniformModelViewProjMatrix() const { return uniform_mvp_mat_; }
// Get the shader program's Model-View matrix uniform index.
GLint GetUniformModelViewMatrix() const { return uniform_mv_mat_; }
// Get the shader program's Model matrix uniform index.
GLint GetUniformModelMatrix() const { return uniform_m_mat_; }
// Get the shader program's Normal matrix uniform index.
GLint GetUniformNormalMatrix() const { return uniform_normal_mat_; }
private:
// Set the shader for this material to the fallback shader. This
// will never fail.
void SetFallbackShader();
// Set the shader for this material to the specified GL shader
// program. This will fail if required attributes and uniforms can
// not be found.
bool SetShaderInternal(GLuint program);
// The fallback shader program. Never cleaned up.
static GLuint fallback_shader_program_;
// Current shader program.
GLuint shader_program_;
// Current shader program's vertex position attribute index.
GLint attrib_vertices_;
// Current shader program's vertex normal attribute index.
GLint attrib_normals_;
// Current shader program's vertex color attribute index.
GLint attrib_colors_;
// Current shader program's texture coords attribute index.
GLint attrib_uv_;
// Current shader program's Model-View-Projection matrix uniform
// index.
GLint uniform_mvp_mat_;
// Current shader program's Model-View matrix uniform index.
GLint uniform_mv_mat_;
// Current shader program's Model matrix uniform index.
GLint uniform_m_mat_;
// Current shader program's Normal matrix uniform index.
GLint uniform_normal_mat_;
// A hash table of float parameters.
std::unordered_map<GLint, float> params_float_;
// A hash table of vec4 parameters.
std::unordered_map <GLint, glm::vec4> params_vec4_;
// A hash table of Texture pointers parameters.
std::unordered_map<GLint, Texture *> params_texture_;
};
} // namespace tango_gl
#endif // TANGO_GL_MATERIAL_H_
| [
"sjfricke@wisc.edu"
] | sjfricke@wisc.edu |
ae1d17fd42174cd8d4eb993ebc60aaafeb2f2c07 | aeef4d7bab4ca441fbecc2823815e9f94cb4563b | /src/ui/src/taceng/te_map.cpp | 534ed3b1fa2d1f20bd7dc653d2c55b77283b99f1 | [
"BSD-2-Clause"
] | permissive | FreeFalcon/freefalcon-central | 8fc80b6d82eab44ce314a39860e6ee8e6f5ee71a | c28d807183ab447ef6a801068aa3769527d55deb | refs/heads/develop | 2021-01-23T20:49:45.844619 | 2014-10-30T18:32:35 | 2014-10-30T18:32:35 | 7,615,342 | 133 | 90 | null | 2014-10-30T18:32:35 | 2013-01-15T00:02:23 | C++ | UTF-8 | C++ | false | false | 32,067 | cpp | ///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
//
// Tactical Engagement - Robin Heydon
//
// Implements the user interface for the tactical engagement section
// of FreeFalcon
//
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
#include "falclib.h"
#include "vu2.h"
#include "chandler.h"
#include "ui95_ext.h"
#include "uicomms.h"
#include "userids.h"
#include "textids.h"
#include "unit.h"
#include "team.h"
#include "CmpGlobl.h"
#include "CampCell.h"
#include "CampTerr.h"
#include "find.h"
#include "division.h"
#include "battalion.h"
#include "cmap.h"
#include "flight.h"
#include "campwp.h"
#include "cmpclass.h"
#include "Listadt.h"
#include "objectiv.h"
#include "Campaign.h"
#include "classtbl.h"
#include "falcsess.h"
#include "tac_class.h"
#include "te_defs.h"
#include "teamdata.h"
#include "gps.h"
#include "urefresh.h"
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
extern C_Map
*gMapMgr;
extern GlobalPositioningSystem
*gGps;
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
extern long
gLastUpdateGround,
gLastUpdateAir;
extern GridIndex
MapX, MapY;
float SimMapX, SimMapY;
C_Base *CurMapTool = NULL;
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
void tactical_draw_map(long ID, short hittype, C_Base *control);
static void tactical_maximize_map(long ID, short hittype, C_Base *control);
static void tactical_minimize_map(long ID, short hittype, C_Base *control);
static void gMapMgr_mover(long ID, short hittype, C_Base *control);
static void gMapMgr_zoom_in(long ID, short hittype, C_Base *control);
static void gMapMgr_zoom_out(long ID, short hittype, C_Base *control);
void gMapMgr_menu(long ID, short hittype, C_Base *control);
void tactical_objective_menu(long ID, short hittype, C_Base *control);
void tactical_airbase_menu(long ID, short hittype, C_Base *control);
void SelectToolTypeCB(long ID, short hittype, C_Base *control);
void OpenCrossSectionCB(long ID, short hittype, C_Base *control);
void tactical_add_victory_condition(VU_ID id, C_Base *caller);
void tactical_add_squadron(VU_ID id);
extern void tactical_add_flight(VU_ID ID, C_Base *caller);
extern void tactical_add_package(VU_ID ID, C_Base *caller);
extern void tactical_add_battalion(VU_ID ID, C_Base *control);
static void update_gMapMgr(void);
void PickTeamCB(long ID, short hittype, C_Base *control);
void UnitCB(long ID, short hittype, C_Base *ctrl);
void SelectVCTargetCB(long ID, short hittype, C_Base *control);
void FitFlightPlanCB(long ID, short hittype, C_Base *control);
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
void ClearMapToolStates(long ID)
{
C_Window *win;
C_Button *ctrl;
win = gMainHandler->FindWindow(ID);
if (win)
{
ctrl = (C_Button *) win->FindControl(ADD_FLIGHT);
if (ctrl)
{
ctrl->SetState(0);
}
ctrl = (C_Button *) win->FindControl(ADD_PACKAGE);
if (ctrl)
{
ctrl->SetState(0);
}
ctrl = (C_Button *) win->FindControl(ADD_BATTALION);
if (ctrl)
{
ctrl->SetState(0);
}
ctrl = (C_Button *) win->FindControl(ADD_NAVAL);
if (ctrl)
{
ctrl->SetState(0);
}
ctrl = (C_Button *) win->FindControl(ADD_SQUADRON);
if (ctrl)
{
ctrl->SetState(0);
}
ctrl = (C_Button *) win->FindControl(COPY_UNIT);
if (ctrl)
{
ctrl->SetState(0);
}
ctrl = (C_Button *) win->FindControl(DELETE_UNIT);
if (ctrl)
{
ctrl->SetState(0);
}
ctrl = (C_Button *) win->FindControl(EDIT_UNIT);
if (ctrl)
{
ctrl->SetState(0);
}
}
}
void hookup_map_windows(C_Window *win)
{
C_Button
*ctrl;
gMainHandler->AddUserCallback(update_gMapMgr);
ctrl = (C_Button *) win->FindControl(MAP_MAXIMIZE);
if (ctrl)
{
ctrl->SetCallback(tactical_maximize_map);
}
ctrl = (C_Button *) win->FindControl(MAP_MINIMIZE);
if (ctrl)
{
ctrl->SetCallback(tactical_minimize_map);
}
ctrl = (C_Button *) win->FindControl(TAC_ZOOM_IN);
if (ctrl)
{
ctrl->SetCallback(gMapMgr_zoom_in);
}
ctrl = (C_Button *) win->FindControl(TAC_ZOOM_OUT);
if (ctrl)
{
ctrl->SetCallback(gMapMgr_zoom_out);
}
ctrl = (C_Button *)win->FindControl(BI_LIN_CTRL);
if (ctrl)
ctrl->SetCallback(OpenCrossSectionCB);
ctrl = (C_Button *)win->FindControl(BI_LOG_CTRL);
if (ctrl)
ctrl->SetCallback(OpenCrossSectionCB);
ctrl = (C_Button *)win->FindControl(BI_FIT_CTRL);
if (ctrl)
ctrl->SetCallback(FitFlightPlanCB);
ctrl = (C_Button *) win->FindControl(ADD_FLIGHT);
if (ctrl)
{
ctrl->SetCallback(SelectToolTypeCB);
}
ctrl = (C_Button *) win->FindControl(ADD_PACKAGE);
if (ctrl)
{
ctrl->SetCallback(SelectToolTypeCB);
}
ctrl = (C_Button *) win->FindControl(ADD_BATTALION);
if (ctrl)
{
ctrl->SetCallback(SelectToolTypeCB);
}
ctrl = (C_Button *) win->FindControl(ADD_NAVAL);
if (ctrl)
{
ctrl->SetCallback(SelectToolTypeCB);
}
ctrl = (C_Button *) win->FindControl(ADD_SQUADRON);
if (ctrl)
{
ctrl->SetCallback(SelectToolTypeCB);
}
ctrl = (C_Button *) win->FindControl(COPY_UNIT);
if (ctrl)
{
ctrl->SetCallback(SelectToolTypeCB);
}
ctrl = (C_Button *) win->FindControl(DELETE_UNIT);
if (ctrl)
{
ctrl->SetCallback(SelectToolTypeCB);
}
ctrl = (C_Button *) win->FindControl(EDIT_UNIT);
if (ctrl)
{
ctrl->SetCallback(SelectToolTypeCB);
}
ctrl = (C_Button *) win->FindControl(TEAM_SELECTOR);
if (ctrl)
{
ctrl->SetCallback(PickTeamCB);
}
}
static void AddSquadronToAirbaseCB(long ID, short hittype, C_Base *ctrl)
{
C_MapIcon *icon;
UI_Refresher *urec;
VU_ID id;
if (hittype not_eq C_TYPE_LMOUSEUP)
return;
icon = (C_MapIcon*)ctrl;
if (ctrl)
{
ID = icon->GetIconID();
urec = (UI_Refresher*)gGps->Find(ID);
if (urec)
tactical_add_squadron(urec->GetID());
}
}
void SelectTargetCB(long ID, short hittype, C_Base *ctrl)
{
C_MapIcon *icon;
UI_Refresher *urec;
VU_ID id;
if (hittype not_eq C_TYPE_LMOUSEUP)
{
// We're either dragging or mouse down - check to see if we should drag a unit
UnitCB(ID, hittype, ctrl);
return;
}
icon = (C_MapIcon*)ctrl;
if (ctrl)
{
ID = icon->GetIconID();
urec = (UI_Refresher*)gGps->Find(ID);
if (urec)
{
switch (CurMapTool->GetID())
{
case ADD_FLIGHT: // Click anywhere on the map to add a flight
tactical_add_flight(urec->GetID(), ctrl);
break;
case ADD_PACKAGE: // Click anywhere on the map to add a package?
tactical_add_package(urec->GetID(), ctrl);
break;
case ADD_BATTALION: // Click anywhere on the map to add a unit
tactical_add_battalion(urec->GetID(), ctrl);
break;
case ADD_SQUADRON: // Click on an airbase to add a squadron
tactical_add_squadron(urec->GetID());
break;
/* case ADD_TASKFORCE: // Click on an airbase to add a squadron
tactical_add_taskforce(urec->GetID(),ctrl);
break;
*/
default:
break;
}
}
}
}
static void SetToolbarDirections(long textid)
{
C_Window *win;
C_Text *txt;
win = gMainHandler->FindWindow(TAC_FULLMAP_WIN);
if (win)
{
txt = (C_Text*)win->FindControl(HELP_MESSAGE);
if (txt)
{
txt->Refresh();
txt->SetText(textid);
txt->Refresh();
}
}
win = gMainHandler->FindWindow(TAC_EDIT_WIN);
if (win)
{
txt = (C_Text*)win->FindControl(HELP_MESSAGE);
if (txt)
{
txt->Refresh();
txt->SetText(textid);
txt->Refresh();
}
}
win = gMainHandler->FindWindow(TAC_VC_WIN);
if (win)
{
txt = (C_Text*)win->FindControl(VC_HELP_MESSAGE);
if (txt)
{
txt->Refresh();
txt->SetText(textid);
txt->Refresh();
}
}
}
void SelectToolTypeCB(long, short hittype, C_Base *control)
{
if (hittype not_eq C_TYPE_LMOUSEUP)
return;
gMapMgr->SetAllObjCallbacks(NULL);
gMapMgr->SetAllAirUnitCallbacks(UnitCB);
gMapMgr->SetAllGroundUnitCallbacks(UnitCB);
gMapMgr->SetAllNavalUnitCallbacks(UnitCB);
if (CurMapTool and CurMapTool == control)
{
CurMapTool->SetState(0);
CurMapTool->Refresh();
CurMapTool = NULL;
SetToolbarDirections(TXT_SPACE);
}
else if ( not control)
{
if (CurMapTool)
{
CurMapTool->SetState(0);
CurMapTool->Refresh();
CurMapTool = NULL;
}
SetToolbarDirections(TXT_SPACE);
}
else
{
CurMapTool = control;
switch (CurMapTool->GetID())
{
case ADD_FLIGHT:
if (TheCampaign.Flags bitand CAMP_TACTICAL_EDIT)
{
gMapMgr->SetAllObjCallbacks(SelectTargetCB);
gMapMgr->SetAllAirUnitCallbacks(SelectTargetCB);
gMapMgr->SetAllGroundUnitCallbacks(SelectTargetCB);
gMapMgr->SetAllNavalUnitCallbacks(SelectTargetCB);
SetToolbarDirections(control->GetUserNumber(1));
}
break;
case ADD_PACKAGE:
gMapMgr->SetAllObjCallbacks(SelectTargetCB);
gMapMgr->SetAllAirUnitCallbacks(SelectTargetCB);
gMapMgr->SetAllGroundUnitCallbacks(SelectTargetCB);
gMapMgr->SetAllNavalUnitCallbacks(SelectTargetCB);
SetToolbarDirections(control->GetUserNumber(1));
break;
case ADD_BATTALION: // Click anywhere on the map to add a unit
if (TheCampaign.Flags bitand CAMP_TACTICAL_EDIT)
{
gMapMgr->SetAllObjCallbacks(SelectTargetCB);
SetToolbarDirections(control->GetUserNumber(1));
}
break;
case ADD_NAVAL: // Click anywhere on the map to add a unit
if (TheCampaign.Flags bitand CAMP_TACTICAL_EDIT)
{
gMapMgr->SetAllObjCallbacks(SelectTargetCB);
SetToolbarDirections(control->GetUserNumber(1));
}
break;
case ADD_SQUADRON: // Click on an airbase to add a squadron
if (TheCampaign.Flags bitand CAMP_TACTICAL_EDIT)
{
gMapMgr->SetAllObjCallbacks(SelectTargetCB);
SetToolbarDirections(control->GetUserNumber(1));
gMapMgr->SetObjCallbacks(1, AddSquadronToAirbaseCB);
}
break;
case COPY_UNIT: // Pick a unit to copy
if (TheCampaign.Flags bitand CAMP_TACTICAL_EDIT)
{
SetToolbarDirections(control->GetUserNumber(1));
}
break;
case DELETE_UNIT: // Pick a unit to delete
if (TheCampaign.Flags bitand CAMP_TACTICAL_EDIT)
{
SetToolbarDirections(control->GetUserNumber(1));
}
break;
case EDIT_UNIT: // Pick a unit to edit
if (TheCampaign.Flags bitand CAMP_TACTICAL_EDIT)
{
SetToolbarDirections(control->GetUserNumber(1));
}
break;
case TARGET_VC:
gMapMgr->SetAllObjCallbacks(SelectVCTargetCB);
gMapMgr->SetAllAirUnitCallbacks(SelectVCTargetCB);
gMapMgr->SetAllGroundUnitCallbacks(SelectVCTargetCB);
gMapMgr->SetAllNavalUnitCallbacks(SelectVCTargetCB);
SetToolbarDirections(control->GetUserNumber(1));
break;
}
}
}
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
void tactical_draw_map(long, short, C_Base *)
{
// gMapMgr->SetFlags(I_NEED_TO_DRAW_MAP);
if (gMapMgr)
{
gMapMgr->DrawMap();
}
}
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
static void tactical_maximize_map(long, short hittype, C_Base *control)
{
C_Window
*win;
if (hittype not_eq C_TYPE_LMOUSEUP)
{
return;
}
win = gMainHandler->FindWindow(TAC_FULLMAP_WIN);
if (win not_eq NULL)
{
gMapMgr->SetWindow(win);
gMapMgr->DrawMap();
}
win = gMainHandler->FindWindow(TAC_PUA_MAP);
if (win not_eq NULL)
{
gMainHandler->HideWindow(win);
}
gMainHandler->EnableWindowGroup(control->GetGroup());
}
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
static void tactical_minimize_map(long, short hittype, C_Base *control)
{
C_Window
*win;
if (hittype not_eq C_TYPE_LMOUSEUP)
{
return;
}
win = gMainHandler->FindWindow(TAC_PUA_MAP);
//MonoPrint ("Minimize %d %08x\n", control->GetGroup (), win);
if (win not_eq NULL)
{
gMapMgr->SetWindow(win);
gMapMgr->DrawMap();
}
win = gMainHandler->FindWindow(TAC_PUA_MAP);
if (win not_eq NULL)
{
gMainHandler->ShowWindow(win);
}
gMainHandler->DisableWindowGroup(control->GetGroup());
}
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
// callback for map events
void gMapMgr_TACmover(long, short hittype, C_Base *control)
{
C_MapMover
*mm;
float mx, my, scale, maxy;
short x = 0, y = 0;
mm = (C_MapMover *) control;
switch (hittype)
{
case (C_TYPE_MOUSEMOVE):
{
if (gMapMgr)
{
// JPO - this was null once...
gMapMgr->MoveCenter(-((C_MapMover *)control)->GetHRange(), -((C_MapMover *)control)->GetVRange());
}
if (control)
{
control->Parent_->RefreshClient(0);
}
break;
}
case (C_TYPE_LMOUSEUP):
{
if (CurMapTool)
{
if (control->_GetCType_() == _CNTL_POPUPLIST_)
{
gPopupMgr->GetCurrentXY(&x, &y);
gMapMgr->GetMapRelativeXY(&x, &y);
}
else if (control->_GetCType_() == _CNTL_MAP_MOVER_)
{
x = static_cast<short>(((C_MapMover*)control)->GetRelX() + control->GetX() + control->Parent_->GetX());
y = static_cast<short>(((C_MapMover*)control)->GetRelY() + control->GetY() + control->Parent_->GetY());
gMapMgr->GetMapRelativeXY(&x, &y);
}
scale = gMapMgr->GetMapScale();
maxy = gMapMgr->GetMaxY();
mx = x / scale;
my = maxy - y / scale;
SimMapX = my;
SimMapY = mx;
MapX = SimToGrid(mx);
MapY = SimToGrid(my);
switch (CurMapTool->GetID())
{
case ADD_FLIGHT: // Click anywhere on the map to add a flight
tactical_add_flight(FalconNullId, control);
break;
case ADD_PACKAGE: // Click anywhere on the map to add a package?
tactical_add_package(FalconNullId, control);
break;
case ADD_BATTALION: // Click anywhere on the map to add a unit
tactical_add_battalion(FalconNullId, control);
break;
case ADD_NAVAL: // Click anywhere on the map to add a unit
break;
case ADD_SQUADRON: // Click on an airbase to add a squadron
break;
case COPY_UNIT: // Pick a unit to copy
break;
case DELETE_UNIT: // Pick a unit to delete
break;
case EDIT_UNIT: // Pick a unit to edit
break;
}
}
break;
}
case (C_TYPE_MOUSEWHEEL):
{
if ( not control->IsControl())
{
break;
}
C_Control *c = static_cast<C_Control*>(control);
if (c->GetIncrement() > 0)
{
gMapMgr->ZoomOut();
}
else
{
gMapMgr->ZoomIn();
}
break;
}
}
}
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
static void gMapMgr_zoom_in(long, short hittype, C_Base *ctrl)
{
F4CSECTIONHANDLE *Leave;
if ((hittype not_eq C_TYPE_LMOUSEUP) and (hittype not_eq C_TYPE_REPEAT))
return;
Leave = UI_Enter(ctrl->Parent_);
gMapMgr->ZoomIn();
gMapMgr->DrawMap();
UI_Leave(Leave);
}
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
static void gMapMgr_zoom_out(long, short hittype, C_Base *ctrl)
{
F4CSECTIONHANDLE *Leave;
if ((hittype not_eq C_TYPE_LMOUSEUP) and (hittype not_eq C_TYPE_REPEAT))
return;
Leave = UI_Enter(ctrl->Parent_);
gMapMgr->ZoomOut();
gMapMgr->DrawMap();
UI_Leave(Leave);
}
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
void gMapMgr_menu(long ID, short hittype, C_Base *control)
{
int
objective = -1,
zoom;
if (hittype not_eq C_TYPE_LMOUSEUP)
{
return;
}
switch (ID)
{
case MID_RECON:
{
MonoPrint("Map Menu Recon\n");
gPopupMgr->CloseMenu();
break;
}
case MID_ADD_BATTALION:
{
tactical_add_battalion(FalconNullId, control);
gPopupMgr->CloseMenu();
break;
}
case MID_ADD_PACKAGE:
{
tactical_add_package(FalconNullId, control);
gPopupMgr->CloseMenu();
break;
}
case MID_ZOOM_IN:
{
zoom = gMapMgr->GetZoomLevel();
if (zoom >= 64) // MAX_ZOOM_LEVEL
{
return;
}
zoom *= 2;
//MonoPrint ("Zoom In %d\n", zoom);
gMapMgr->SetZoomLevel(static_cast<short>(zoom));
gMapMgr->DrawMap();
gPopupMgr->CloseMenu();
break;
}
case MID_ZOOM_OUT:
{
zoom = gMapMgr->GetZoomLevel();
if (zoom <= 1) // MAX_ZOOM_LEVEL
{
return;
}
zoom /= 2;
//MonoPrint ("Zoom In %d\n", zoom);
gMapMgr->SetZoomLevel(static_cast<short>(zoom));
gMapMgr->DrawMap();
gPopupMgr->CloseMenu();
break;
}
case MID_INST_AF:
objective = _OBTV_AIR_FIELDS;
break;
case MID_INST_AD:
objective = _OBTV_AIR_DEFENSE;
break;
case MID_INST_ARMY:
objective = _OBTV_ARMY;
break;
case MID_INST_CCC:
objective = _OBTV_CCC;
break;
case MID_INST_POLITICAL:
objective = _OBTV_POLITICAL;
break;
case MID_INST_INFRA:
objective = _OBTV_INFRASTRUCTURE;
break;
case MID_INST_LOG:
objective = _OBTV_LOGISTICS;
break;
case MID_INST_WARPROD:
objective = _OBTV_WAR_PRODUCTION;
break;
case MID_INST_NAV:
objective = _OBTV_NAVIGATION;
break;
case MID_INST_OTHER:
objective = _OBTV_OTHER;
break;
case MID_INST_NAVAL:
objective = _OBTV_NAVAL;
break;
break;
case MID_UNITS_COMBAT:
{
gMapMgr->SetUnitLevel(2);
if (((C_PopupList *)control)->GetItemState(ID))
gMapMgr->ShowUnitType(_UNIT_COMBAT);
else
gMapMgr->HideUnitType(_UNIT_COMBAT);
gMapMgr->DrawMap();
break;
}
case MID_UNITS_AD:
{
gMapMgr->SetUnitLevel(2);
if (((C_PopupList *)control)->GetItemState(ID))
gMapMgr->ShowUnitType(_UNIT_AIR_DEFENSE);
else
gMapMgr->HideUnitType(_UNIT_AIR_DEFENSE);
gMapMgr->DrawMap();
break;
}
case MID_UNITS_SUPPORT:
{
gMapMgr->SetUnitLevel(2);
if (((C_PopupList *)control)->GetItemState(ID))
gMapMgr->ShowUnitType(_UNIT_SUPPORT);
else
gMapMgr->HideUnitType(_UNIT_SUPPORT);
gMapMgr->DrawMap();
break;
}
case MID_UNITS_SQUAD_FIGHTER:
{
if (((C_PopupList *)control)->GetItemState(ID))
gMapMgr->ShowAirUnitType(_UNIT_FIGHTER);
else
gMapMgr->HideAirUnitType(_UNIT_FIGHTER);
gMapMgr->DrawMap();
break;
}
case MID_UNITS_SQUAD_ATTACK:
{
if (((C_PopupList *)control)->GetItemState(ID))
gMapMgr->ShowAirUnitType(_UNIT_ATTACK);
else
gMapMgr->HideAirUnitType(_UNIT_ATTACK);
gMapMgr->DrawMap();
break;
}
case MID_UNITS_SQUAD_BOMBER:
{
if (((C_PopupList *)control)->GetItemState(ID))
gMapMgr->ShowAirUnitType(_UNIT_BOMBER);
else
gMapMgr->HideAirUnitType(_UNIT_BOMBER);
gMapMgr->DrawMap();
break;
}
case MID_UNITS_SQUAD_SUPPORT:
{
if (((C_PopupList *)control)->GetItemState(ID))
gMapMgr->ShowAirUnitType(_UNIT_SUPPORT);
else
gMapMgr->HideAirUnitType(_UNIT_SUPPORT);
gMapMgr->DrawMap();
break;
}
case MID_UNITS_SQUAD_HELI:
{
if (((C_PopupList *)control)->GetItemState(ID))
gMapMgr->ShowAirUnitType(_UNIT_HELICOPTER);
else
gMapMgr->HideAirUnitType(_UNIT_HELICOPTER);
gMapMgr->DrawMap();
break;
}
case MID_LEG_NAMES:
{
if (((C_PopupList *)control)->GetItemState(ID))
{
gMapMgr->TurnOnNames();
}
else
{
gMapMgr->TurnOffNames();
}
gMapMgr->DrawMap();
return;
}
default:
{
//MonoPrint ("Map Menu %d %08x\n", ID, control);
gMapMgr->DrawMap();
gPopupMgr->CloseMenu();
break;
}
}
switch (ID)
{
case MID_INST_AF:
case MID_INST_AD:
case MID_INST_ARMY:
case MID_INST_CCC:
case MID_INST_POLITICAL:
case MID_INST_INFRA:
case MID_INST_LOG:
case MID_INST_WARPROD:
case MID_INST_NAV:
case MID_INST_OTHER:
case MID_INST_NAVAL:
{
if (((C_PopupList *)control)->GetItemState(ID))
{
gMapMgr->ShowObjectiveType(objective);
}
else
{
gMapMgr->HideObjectiveType(objective);
}
gMapMgr->DrawMap();
return;
}
}
}
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
void tactical_objective_menu(long ID, short, C_Base *)
{
C_Base
*caller;
C_MapIcon
*icon;
C_DrawList
*piggy;
C_TreeList
*tree;
long
iconid;
TREELIST
*item;
UI_Refresher
*urec;
urec = NULL;
caller = gPopupMgr->GetCallingControl();
if (caller == NULL)
{
return;
}
if (caller->_GetCType_() == _CNTL_MAPICON_)
{
icon = (C_MapIcon *) caller;
iconid = icon->GetIconID();
urec = (UI_Refresher *) gGps->Find(iconid);
}
else if (caller->_GetCType_() == _CNTL_DRAWLIST_)
{
piggy = (C_DrawList *) caller;
iconid = piggy->GetIconID();
urec = (UI_Refresher *) gGps->Find(iconid);
}
else if (caller->_GetCType_() == _CNTL_TREELIST_)
{
tree = (C_TreeList *) caller;
item = tree->GetLastItem();
if (item)
{
urec = (UI_Refresher *) gGps->Find(item->ID_);
}
}
switch (ID)
{
case MID_RECON:
{
//MonoPrint ("Recon\n");
gPopupMgr->CloseMenu();
break;
}
case MID_ADD_PACKAGE:
{
tactical_add_package(urec->GetID(), caller);
gPopupMgr->CloseMenu();
break;
}
case MID_ADD_VC:
{
tactical_add_victory_condition(urec->GetID(), NULL);
gPopupMgr->CloseMenu();
break;
}
case MID_SET_OWNER:
{
//MonoPrint ("Set Owner\n");
break;
}
case MID_SQUADRONS:
{
//MonoPrint ("Squadrons\n");
break;
}
case MID_ALTERNATE_FIELD:
{
//MonoPrint ("Alternate Field %d\n", ((C_PopupList *)control)->GetItemState(ID));
break;
}
default:
{
//MonoPrint ("Unknown Object Menu Item\n");
gPopupMgr->CloseMenu();
break;
}
}
}
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
void tactical_airbase_menu(long ID, short, C_Base *control)
{
C_Base
*caller;
long
iconid;
C_MapIcon
*icon;
C_DrawList
*piggy;
C_TreeList
*tree;
TREELIST
*item;
UI_Refresher
*urec;
urec = NULL;
caller = gPopupMgr->GetCallingControl();
if (caller == NULL)
{
return;
}
if (caller->_GetCType_() == _CNTL_MAPICON_)
{
icon = (C_MapIcon *) caller;
iconid = icon->GetIconID();
urec = (UI_Refresher *) gGps->Find(iconid);
}
else if (caller->_GetCType_() == _CNTL_DRAWLIST_)
{
piggy = (C_DrawList *) caller;
iconid = piggy->GetIconID();
urec = (UI_Refresher *) gGps->Find(iconid);
}
else if (caller->_GetCType_() == _CNTL_TREELIST_)
{
tree = (C_TreeList *) caller;
item = tree->GetLastItem();
if (item)
{
urec = (UI_Refresher *) gGps->Find(item->ID_);
}
}
switch (ID)
{
case MID_RECON:
{
//MonoPrint ("Recon\n");
gPopupMgr->CloseMenu();
break;
}
case MID_ADD_PACKAGE:
{
tactical_add_package(urec->GetID(), control);
gPopupMgr->CloseMenu();
break;
}
case MID_ADD_VC:
{
tactical_add_victory_condition(urec->GetID(), NULL);
gPopupMgr->CloseMenu();
break;
}
case MID_SET_OWNER:
{
//MonoPrint ("Set Owner\n");
gPopupMgr->CloseMenu();
break;
}
case MID_ADD_SQUADRON:
{
tactical_add_squadron(urec->GetID());
gPopupMgr->CloseMenu();
break;
}
case MID_ALTERNATE_FIELD:
{
//MonoPrint ("Alternate Field %d\n", ((C_PopupList *)control)->GetItemState(ID));
break;
}
default:
{
//MonoPrint ("Unknown Object Menu Item\n");
gPopupMgr->CloseMenu();
break;
}
}
}
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
static void update_gMapMgr(void)
{
// This is NOW handled by the GPS
}
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
void tactical_update_campaign_entities(void)
{
// This is NOW handled by the GPS
}
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
| [
"dannycoh@gmail.com"
] | dannycoh@gmail.com |
6590432ad4231809bab74c8023a5aa913c833250 | 3e28b483b598616a43c197821ce5cb1b6b53239d | /include/utexas_planning/models/grid_model.h | 387042e0dba457bd4dc035b47e8784d65e4ae337 | [] | no_license | asimay/utexas_planning | 6c5b5a28f39eca081a9108484612b0467d918617 | 0207b32be3009ca8319c5a9edc0b05e7b96105eb | refs/heads/master | 2020-12-02T16:30:35.370204 | 2016-03-28T07:25:35 | 2016-03-28T07:25:35 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,760 | h | #ifndef UTEXAS_PLANNING_GRID_MODEL_H_
#define UTEXAS_PLANNING_GRID_MODEL_H_
#include <boost/lexical_cast.hpp>
#include <boost/serialization/export.hpp>
#include <utexas_planning/common/constants.h>
#include <utexas_planning/common/params.h>
#include <utexas_planning/common/rng.h>
#include <utexas_planning/core/declarative_model.h>
namespace utexas_planning {
enum GridActionType {
UP = 0,
DOWN = 1,
LEFT = 2,
RIGHT = 3,
NUM_ACTIONS = 4
};
class GridModelRewardMetrics : public RewardMetrics {
public:
typedef boost::shared_ptr<GridModelRewardMetrics> Ptr;
typedef boost::shared_ptr<const GridModelRewardMetrics> ConstPtr;
bool halfway_reached;
float halfway_reward;
virtual std::map<std::string, std::string> asMap() const {
std::map<std::string, std::string> metric_map;
metric_map["halfway_reward"] = boost::lexical_cast<std::string>(halfway_reward);
return metric_map;
}
};
class GridAction : public Action {
public:
GridActionType type;
bool operator<(const Action& other_base) const;
void serialize(std::ostream& stream) const;
private:
friend class boost::serialization::access;
template <typename Archive> void serialize(Archive& ar, const unsigned int version) {
ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP(Action);
ar & BOOST_SERIALIZATION_NVP(type);
}
};
} /* utexas_planning */
BOOST_CLASS_EXPORT_KEY(utexas_planning::GridAction);
namespace utexas_planning {
class GridState : public State {
public:
int x;
int y;
bool operator<(const State& other_base) const;
void serialize(std::ostream& stream) const;
std::map<std::string, std::string> asMap() const;
private:
State::Ptr cloneImpl() const;
friend class boost::serialization::access;
template <typename Archive> void serialize(Archive& ar, const unsigned int version) {
ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP(State);
ar & BOOST_SERIALIZATION_NVP(x);
ar & BOOST_SERIALIZATION_NVP(y);
}
};
} /* utexas_planning */
BOOST_CLASS_EXPORT_KEY(utexas_planning::GridState);
namespace utexas_planning {
class GridModel : public DeclarativeModel {
public:
#define PARAMS(_) \
_(int,start_x,start_x,-1) \
_(int,start_y,start_y,-1) \
_(int,grid_size,grid_size,10) \
_(float,goal_reward,goal_reward,0.0f) \
_(std::string,terminal_states,terminal_states,"") \
_(bool,toroidal,toroidal,true) \
_(float,nondeterminism,nondeterminism,0.1f) \
_(float,initial_planning_time,initial_planning_time,NO_TIMEOUT) \
_(float,per_step_planning_time,per_step_planning_time,NO_TIMEOUT) \
Params_STRUCT(PARAMS)
#undef PARAMS
virtual void init(const YAML::Node& params,
const std::string& output_directory,
const boost::shared_ptr<RNG>& rng);
virtual bool isTerminalState(const State::ConstPtr& state_base) const;
virtual void getActionsAtState(const State::ConstPtr& state,
std::vector<Action::ConstPtr>& actions) const;
virtual std::vector<State::ConstPtr> getStateVector() const;
virtual void getTransitionDynamics(const State::ConstPtr& state_base,
const Action::ConstPtr& action_base,
std::vector<State::ConstPtr>& next_states,
std::vector<float>& rewards,
std::vector<float>& probabilities) const;
virtual void takeAction(const State::ConstPtr& state,
const Action::ConstPtr& action,
float& reward,
const RewardMetrics::Ptr& reward_metrics,
State::ConstPtr& next_state,
int& depth_count,
float& post_action_timeout,
boost::shared_ptr<RNG> rng) const;
virtual State::ConstPtr getStartState(long seed) const;
virtual float getInitialTimeout() const;
virtual std::map<std::string, std::string> getParamsAsMap() const;
virtual RewardMetrics::Ptr getRewardMetricsAtEpisodeStart() const;
virtual std::string getName() const;
protected:
bool halfway_reached_;
std::vector<State::ConstPtr> complete_state_vector_;
std::map<State::ConstPtr, float, State::PtrComparator> terminal_states_to_reward_map_;
std::vector<Action::ConstPtr> default_action_list_;
Params params_;
};
} /* utexas_planning */
#endif /* end of include guard: UTEXAS_PLANNING_GRID_MODEL_H_ */
| [
"piyushk@gmail.com"
] | piyushk@gmail.com |
0bc04e8355af4e6dc4abee95e42fbbe72c546f64 | d23b31f5c3193d70c9c06e74b63bfb72a4e57b10 | /V4.0/Src/BlueUI/Project.cpp | 7ca495d3b362a2a7234b1ab74dc126ee064088bd | [] | no_license | iHaD/Script.NET | c9c24ed840a690bddf7b5c96ea744f56ee839a0b | f35354b160cdc2129bd72b01b288bb11e49aad9d | refs/heads/master | 2020-12-28T19:56:58.417873 | 2014-10-14T17:04:50 | 2014-10-14T17:04:50 | null | 0 | 0 | null | null | null | null | GB18030 | C++ | false | false | 15,557 | cpp | ////////////////////////////////////////////////////////////////////////////
// File: Project.cpp
// Version: 1.0.0.0
// Created: 2008-10-20
//
// Author: blueant
// E-mail: script.net@gmail.com
//
// Project operate
////////////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "BlueUI.h"
#include "MainFrm.h"
#include "PlugIn.h"
#include "TreePropertySheet.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
////////////////////////////////////////////////////////////////////////////
// Project operate
// 判断是否有打开的工程
BOOL CBlueUIApp::IsProjectOpen()
{
if(m_pIProject == NULL)
{
return FALSE;
}
CString strActiveProject;
if(m_pIProject->GetActiveProject(strActiveProject) != trpOk)
{
return FALSE;
}
return TRUE;
}
//////////////////////////////////////////////////////////////////////
// 保存最近打开的工程信息到注册表
//////////////////////////////////////////////////////////////////////
void CBlueUIApp::SaveRecentProject(CString strProjectFile)
{
CStringArray asRecentProject;
for(int i=0; i<MAX_RECENT_PROJECT; i++)
{
CString strPrjName;
strPrjName.Format("%s%d", REG_RECENT_PROJECT, i+1);
CString strPrjPath = AfxGetApp()->GetProfileString(REG_RECENTPRJ_SUBKEY, strPrjName, "");
if(strPrjPath != "")
{
asRecentProject.Add(strPrjPath);
}
}
BOOL bFind = FALSE;
int nCount = asRecentProject.GetSize();
for(int i=0; i<nCount; i++)
{
if(strProjectFile.CompareNoCase(asRecentProject[i]) == 0)
{
asRecentProject.RemoveAt(i);
asRecentProject.InsertAt(0, strProjectFile);
bFind = TRUE;
break;
}
}
if(!bFind)
{
asRecentProject.InsertAt(0, strProjectFile);
}
nCount = asRecentProject.GetSize();
for(int i=0; i<MAX_RECENT_PROJECT; i++)
{
CString strPrjName;
strPrjName.Format("%s%d", REG_RECENT_PROJECT, i+1);
if(i < nCount)
{
AfxGetApp()->WriteProfileString(REG_RECENTPRJ_SUBKEY, strPrjName, asRecentProject[i]);
}else
{
AfxGetApp()->WriteProfileString(REG_RECENTPRJ_SUBKEY, strPrjName, "");
}
}
}
/////////////////////////////////////////////////////////////////////////////
// 执行工程脚本操作
/////////////////////////////////////////////////////////////////////////////
void CBlueUIApp::ExecProjectScript(CString strMenuAction)
{
// TODO: Add your command handler code here
CString strProjectPlugInId = theApp.GetPlugInIdByInstancePtr(m_pIProject);
if(strProjectPlugInId == "")
{
return;
}
CString strPlugInPath = GetPlatRootPath() + "Plugins\\" + strProjectPlugInId;
CString strXmlFile = strPlugInPath;
if(LANGUAGE_PAGE_CHINESE == m_curLanguage)
{
strXmlFile += "\\plugin_cn.xml";
// 如果不存在中文的配置文件,就用缺省的
if(GetFileAttributes(strXmlFile) == 0xFFFFFFFF)
{
strXmlFile = strPlugInPath + "\\plugin.xml";
}
}else
{
strXmlFile += "\\plugin.xml";
}
CXmlParser parser;
if(parser.Open(strXmlFile))
{
OUTPUT(COLOR_ERROR, "Load %s fail!\r\n", strXmlFile);
return;
}
CString strXmlNodeName = _T("menu-action\\") + strMenuAction;
CString strInterp = parser.GetNodeText(strXmlNodeName + "\\Interp");
CString strInterpInstance = parser.GetNodeAttribute(strXmlNodeName + "\\Interp" , "Name");
CString strScriptFile = parser.GetNodeText(strXmlNodeName + "\\script");
ProcessPath(strScriptFile, strProjectPlugInId);
if(strInterp == VCIID_HTMLVIEW)
{
COM_CMD(VCIID_HTMLVIEW, OC_VIEWHTMLPAGE, (WPARAM)(LPCTSTR)strScriptFile, 0);
return;
}
//ProcessPath(strScriptFile);
IInterp* pInterp = (IInterp*)CreateVciObject(strInterp, strInterpInstance);
if(pInterp)
{
if(!pInterp->RunScriptFile(strScriptFile))
{
AfxMessageBox(pInterp->GetResult());
}
ReleaseObject(pInterp);
}
}
/////////////////////////////////////////////////////////////////////////////
// 打开工程
/////////////////////////////////////////////////////////////////////////////
BOOL CBlueUIApp::OpenProjectFile(CPlugIn* pPlugIn, CString strProjectFile)
{
if(IsProjectOpen())
{
return FALSE;
}
if(pPlugIn == NULL)
{
// 如果插件指针为空,则根据后缀查找插件
CString strFileName = strProjectFile;
strFileName.MakeLower();
int nPos = strFileName.ReverseFind('.');
if(nPos != -1)
{
CString strFileExt = strFileName;
strFileExt.Delete(0, nPos+1);
for(int i=0; i<m_aPlugIns.GetSize(); i++)
{
if(m_aPlugIns[i].m_strType != "project")
continue;
for(int j=0; j<m_aPlugIns[i].m_arDocExtend.GetSize(); j++)
{
for(int k=0; k<m_aPlugIns[i].m_arDocExtend[j].m_arDocExt.GetSize(); k++)
{
if(strFileExt == m_aPlugIns[i].m_arDocExtend[j].m_arDocExt[k])
{
pPlugIn = &(m_aPlugIns[i]);
}
}
}
}
}
if(pPlugIn == NULL)
{
// 未找到能打开工程的插件
return FALSE;
}
}
// 注意要释放
IProject* pIProject = pPlugIn->CreateProjectObject("###project###");
if(pIProject)
{
PLAT_LOADSTRING(strInfoOpenProject, IDS_INFO_OPEN_PROJECT); // 打开工程 %s\r\n
OUTPUT(COLOR_NORMAL, strInfoOpenProject, strProjectFile);
if(pIProject->OpenProject(strProjectFile) == trpOk)
{
m_pIProject = pIProject;
SaveRecentProject(strProjectFile);
// 加载工程Pane
pPlugIn->LoadDockingPane(-1, TRUE);
// 执行工程打开脚本
ExecProjectScript("project\\open");
// 加载代码定义库
pIProject->LoadCodeDefineLibrary("");
return TRUE;
}
}
return FALSE;
}
/////////////////////////////////////////////////////////////////////////////
// 新建工程
/////////////////////////////////////////////////////////////////////////////
void CBlueUIApp::OnProjectNew()
{
// TODO: Add your command handler code here
PLAT_LOADSTRING(strInfoNewProject, IDS_INFO_NEW_PROJECT); // 新建工程\r\n
OUTPUT(COLOR_NORMAL, strInfoNewProject);
if(m_pIProjectManager == NULL)
{
m_pIProjectManager = (IProjectManager*)(CreateVciObject(VCIID_PROJECTMANAGER, "###projectmanager"));
}
if(m_pIProjectManager != NULL)
{
CString strPrjVci;
CString strPrjFile;
if(m_pIProjectManager->NewProjectWizard(strPrjVci, strPrjFile))
{
// 创建工程成功,打开工程
CPlugIn* pPlugIn = FindPlugIn(strPrjVci);
if(pPlugIn)
{
OpenProjectFile(pPlugIn, strPrjFile);
}
}
}
/*
if(ExecMenuScript("project\\newproject") == "success")
{
m_pIProject = (IProject*)(theApp.GetObjectByInstanceName("###project###"));
ExecProjectScript("project\\new");
}*/
}
void CBlueUIApp::OnUpdateProjectNew(CCmdUI* pCmdUI)
{
// TODO: Add your command update UI handler code here
pCmdUI->Enable(!IsProjectOpen());
}
/////////////////////////////////////////////////////////////////////////////
// 打开工程
/////////////////////////////////////////////////////////////////////////////
void CBlueUIApp::OnProjectOpen()
{
// TODO: Add your command handler code here
CString strFilter;
CString strTemp;
CString strDefaultExt = GetProfileString(REG_PROJECT_SUBKEY, REG_PROJECT_DEFFILEEXT, "");
strDefaultExt.MakeLower();
BOOL bFoundDefaultExt = FALSE;
// 挨个工程插件查找扩展点,看哪个工程插件可以打开此文档
for(int i=0; i<m_aPlugIns.GetSize(); i++)
{
CPlugIn* pPlugIn = &(m_aPlugIns[i]);
if(pPlugIn->m_strType != "project")
continue;
for(int j=0; j<pPlugIn->m_arDocExtend.GetSize(); j++)
{
BOOL bDefaultExt = FALSE;
CString strTemp1;
for(int k=0; k<pPlugIn->m_arDocExtend[j].m_arDocExt.GetSize(); k++)
{
strTemp1 += "*.";
strTemp1 += pPlugIn->m_arDocExtend[j].m_arDocExt[k];
if(k != (pPlugIn->m_arDocExtend[j].m_arDocExt.GetSize()-1))
{
strTemp1 += ";";
}
CString strDocExt = pPlugIn->m_arDocExtend[j].m_arDocExt[k];
strDocExt.MakeLower();
if(strDefaultExt == strDocExt)
{
// 是上次保存的后缀名
bDefaultExt = TRUE;
}
}
strTemp.Format("%s (%s)|%s|", pPlugIn->m_arDocExtend[j].m_strDocName, strTemp1, strTemp1);
if(bDefaultExt && !bFoundDefaultExt)
{
strFilter = strTemp + strFilter;
bFoundDefaultExt = TRUE;
}else
{
strFilter += strTemp;
}
}
}
strFilter += "All files(*.*)|*.*||";
CFileDialog dlg(TRUE, NULL, NULL, OFN_HIDEREADONLY | OFN_FILEMUSTEXIST, strFilter);
if (dlg.DoModal() == IDOK)
{
CString strExt = dlg.GetFileExt();
WriteProfileString(REG_PROJECT_SUBKEY, REG_PROJECT_DEFFILEEXT, strExt);
for(int i=0; i<m_aPlugIns.GetSize(); i++)
{
CPlugIn* pPlugIn = &(m_aPlugIns[i]);
if(pPlugIn->m_strType != "project")
continue;
for(int j=0; j<pPlugIn->m_arDocExtend.GetSize(); j++)
{
for(int k=0; k<pPlugIn->m_arDocExtend[j].m_arDocExt.GetSize(); k++)
{
if(pPlugIn->m_arDocExtend[j].m_arDocExt[k].CompareNoCase(strExt) == 0)
{
OpenProjectFile(pPlugIn, dlg.GetPathName());
return;
}
}
}
}
}
}
void CBlueUIApp::OnUpdateProjectOpen(CCmdUI* pCmdUI)
{
// TODO: Add your command update UI handler code here
pCmdUI->Enable(!IsProjectOpen());
}
/////////////////////////////////////////////////////////////////////////////
// 保存工程
/////////////////////////////////////////////////////////////////////////////
void CBlueUIApp::OnProjectSave()
{
// TODO: Add your command handler code here
PLAT_LOADSTRING(strInfoSaveProject, IDS_INFO_SAVE_PROJECT); // 保存工程\r\n
OUTPUT(COLOR_NORMAL, strInfoSaveProject);
m_pIProject->SaveProject();
ExecProjectScript("project\\save");
}
void CBlueUIApp::OnUpdateProjectSave(CCmdUI* pCmdUI)
{
// TODO: Add your command update UI handler code here
pCmdUI->Enable(IsProjectOpen());
}
/////////////////////////////////////////////////////////////////////////////
// 执行工程
/////////////////////////////////////////////////////////////////////////////
void CBlueUIApp::OnProjectRun()
{
// TODO: Add your command handler code here
PLAT_LOADSTRING(strInfoRunProject, IDS_INFO_RUN_PROJECT); // 运行工程\r\n
OUTPUT(COLOR_NORMAL, strInfoRunProject);
m_pIProject->RunProject();
ExecProjectScript("project\\run");
}
void CBlueUIApp::OnUpdateProjectRun(CCmdUI* pCmdUI)
{
// TODO: Add your command update UI handler code here
pCmdUI->Enable(IsProjectOpen());
}
/////////////////////////////////////////////////////////////////////////////
// 关闭工程
/////////////////////////////////////////////////////////////////////////////
void CBlueUIApp::OnProjectClose()
{
// TODO: Add your command handler code here
if(!IsProjectOpen())
{
return;
}
PLAT_LOADSTRING(strInfoCloseProject, IDS_INFO_CLOSE_PROJECT); // 关闭工程\r\n
OUTPUT(COLOR_NORMAL, strInfoCloseProject);
if(m_pIProject->CloseProject(FALSE) != trpOk)
{
return;
}
ExecProjectScript("project\\close");
// 释放工程对象
for(int i=0; i<theApp.m_aPlugIns.GetSize(); i++)
{
if(m_aPlugIns[i].ReleaseProjectObject(m_pIProject, TRUE))
{
m_pIProject = NULL;
return;
}
}
}
void CBlueUIApp::OnUpdateProjectClose(CCmdUI* pCmdUI)
{
// TODO: Add your command update UI handler code here
pCmdUI->Enable(IsProjectOpen());
}
/////////////////////////////////////////////////////////////////////////////
// 编译工程
/////////////////////////////////////////////////////////////////////////////
void CBlueUIApp::OnProjectBuild()
{
// TODO: Add your command handler code here
PLAT_LOADSTRING(strInfoBuildProject, IDS_INFO_BUILD_PROJECT); // 编译工程\r\n
OUTPUT(COLOR_NORMAL, strInfoBuildProject);
m_pIProject->BuildProject();
ExecProjectScript("project\\build");
}
void CBlueUIApp::OnUpdateProjectBuild(CCmdUI* pCmdUI)
{
// TODO: Add your command update UI handler code here
pCmdUI->Enable(IsProjectOpen());
}
/////////////////////////////////////////////////////////////////////////////
// 重新编译工程
/////////////////////////////////////////////////////////////////////////////
void CBlueUIApp::OnProjectRebuild()
{
// TODO: Add your command handler code here
PLAT_LOADSTRING(strInfoRebuildProject, IDS_INFO_REBUILD_PROJECT); // 重新编译工程\r\n
OUTPUT(COLOR_NORMAL, strInfoRebuildProject);
m_pIProject->RebuildProject();
ExecProjectScript("project\\rebuild");
}
void CBlueUIApp::OnUpdateProjectRebuild(CCmdUI* pCmdUI)
{
// TODO: Add your command update UI handler code here
pCmdUI->Enable(IsProjectOpen());
}
/////////////////////////////////////////////////////////////////////////////
// 清除工程编译信息
/////////////////////////////////////////////////////////////////////////////
void CBlueUIApp::OnProjectClean()
{
// TODO: Add your command handler code here
PLAT_LOADSTRING(strInfoCleanProject, IDS_INFO_CLEAN_PROJECT); // 清除工程编译信息\r\n
OUTPUT(COLOR_NORMAL, strInfoCleanProject);
m_pIProject->CleanProject();
ExecProjectScript("project\\clean");
}
void CBlueUIApp::OnUpdateProjectClean(CCmdUI* pCmdUI)
{
// TODO: Add your command update UI handler code here
pCmdUI->Enable(IsProjectOpen());
}
/////////////////////////////////////////////////////////////////////////////
// 工程信息
/////////////////////////////////////////////////////////////////////////////
void CBlueUIApp::OnProjectInfo()
{
// TODO: Add your command handler code here
m_pIProject->ProjectInformation();
ExecProjectScript("project\\information");
}
void CBlueUIApp::OnUpdateProjectInfo(CCmdUI* pCmdUI)
{
// TODO: Add your command update UI handler code here
pCmdUI->Enable(IsProjectOpen());
}
/////////////////////////////////////////////////////////////////////////////
// 工程设置
/////////////////////////////////////////////////////////////////////////////
void CBlueUIApp::OnProjectProperty()
{
// TODO: Add your command handler code here
CVciPropertyPageArray aPropertyPage;
//ExecProjectScript("project\\property");
CTreePropertySheet tps(150);
PLAT_LOADSTRING(strTitle, IDS_TITLE_TREEPROPSHEET_PROJECTCFG); // 工程设置
tps.m_strWinTitle = strTitle;
// 从License组件中获取平台关于对话框
CDialog* pLicenseTpsPlatform = NULL;
CString strLicensePlugin = theApp.m_xmlPlat.GetNodeText("application\\LicensePlugin");
CPlugIn* pLicensePlugIn = theApp.FindPlugIn(strLicensePlugin);
if(pLicensePlugIn)
{
if(!(pLicensePlugIn->HasLoad()))
{
pLicensePlugIn->LoadPlugIn(TRUE);
}
CVciPropertyPageArray aLicensePropertyPage;
pLicensePlugIn->RegisterPropertyPage(aLicensePropertyPage);
if(aLicensePropertyPage.GetSize() > 0)
{
pLicenseTpsPlatform = (CDialog*)(aLicensePropertyPage[0].pPage);
}
}
// 工程设置
if(pLicenseTpsPlatform)
{
tps.AddPage(strTitle,tps_item_branch,-1,"",pLicenseTpsPlatform,OPT_PLATFORM,TRUE);
}else
{
tps.AddPage(strTitle,tps_item_branch,IDD_TPS_PLATFORM,"",NULL,OPT_PLATFORM);
}
m_pIProject->ProjectPropertyPage(aPropertyPage);
int count = aPropertyPage.GetSize();
for(int i=0; i<count; i++)
{
CString strNode = aPropertyPage[i].strNode;
CString strDesc = aPropertyPage[i].strDesc;
CDialog* pDialog = (CDialog*)(aPropertyPage[i].pPage);
int nType;
if(count == 1)
nType = tps_item_node;
else
{
nType = tps_item_node;
//if(i == 0)
// nType = tps_item_branch;
//if(i+1 == count)
// nType = tps_item_endbranch;
}
tps.AddPage(strNode,nType,-1,strDesc,pDialog,OPT_NODE,TRUE);
}
tps.SetLastPageType(tps_item_endbranch);
tps.SetFancy(FALSE);
// 执行属性设置对话框
tps.DoModal();
// 释放资源,防止因下面的操作而引起析构函数出错
tps.RemoveResource();
}
void CBlueUIApp::OnUpdateProjectProperty(CCmdUI* pCmdUI)
{
// TODO: Add your command update UI handler code here
pCmdUI->Enable(IsProjectOpen());
}
| [
"script.net@gmail.com"
] | script.net@gmail.com |
9612c6e9a34d496b44635b07afd2428a78fadd72 | b32fd383295327abf53952a92a80270f93010acb | /A1/NeuralNetwork.h | d26e398a124a1a0d3406ecd7101d122e4b820fb9 | [] | no_license | SangJun-GitHub/OOP345 | fe11ae1aafc3b4c4e5f802330a9572564a87ae38 | a2a8076e891fd8eadd865c0ac8db30dcc6f47d2a | refs/heads/master | 2020-03-25T01:15:44.900449 | 2018-08-21T03:40:12 | 2018-08-21T03:40:12 | 143,228,609 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,094 | h | /**********************************
| Subject : Milestone 1 |
| Name : Sang Jun Park |
| Student number : 112293170 |
| Date : 2018.7.26 |
**********************************/
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <iomanip>
#include <iostream>
#include <numeric>
#include <vector>
#ifndef NEURALNETWORK_HEADER
#define NEURALNETWORK_HEADER
using namespace std;
namespace m1 {
class NeuralNetwork {
public:
vector<double> values;
NeuralNetwork() {
srand(1);
values.resize(3);
for (auto& value : values)
value = 2. * rand() / double(RAND_MAX) - 1;
};
double _sgim(double);
double _sgim_deriv(double);
void train(vector<vector<double>>&, vector<double>&, int);
void think(vector<double>&, vector<vector<double>>&);
double think(vector<double>&);
};
void display(vector<double>& list);
void display(vector<vector<double>>& list);
void transpose(vector<vector<double>>& y, vector<vector<double>>& x);
void multiply(vector<double>& y, vector<vector<double>>& m, vector<double>& x);
}
#endif | [
"sjpark24@myseneca.ca"
] | sjpark24@myseneca.ca |
c2a3cbe7ea87c140d1be579f9bbc9d0b965bf55e | aa0874b5dcb9d7213d623f3dbf4700b79131f942 | /BearDescription/BearFrameBufferDescription.cpp | df77878ac437ca852840c204586f026543e7826e | [
"MIT"
] | permissive | q4a/BearGraphics | 0ffde7099a2c142c8b4af332a20fa7fafa69ed78 | 17c6c5a973dcf504ddda0576ff165ac1b91b1315 | refs/heads/master | 2023-03-30T05:58:21.011947 | 2021-04-04T04:33:30 | 2021-04-04T04:33:30 | 327,419,928 | 0 | 0 | MIT | 2021-04-04T07:49:10 | 2021-01-06T20:15:39 | null | UTF-8 | C++ | false | false | 509 | cpp | #include "BearGraphics.hpp"
void BearFrameBufferDescription::Copy(const BearFrameBufferDescription& Right)
{
for (bsize i = 0; i < 8; i++)
{
RenderTargets[i] = Right.RenderTargets[i];
}
DepthStencil = Right.DepthStencil;
RenderPass = Right.RenderPass;
}
void BearFrameBufferDescription::Swap(BearFrameBufferDescription& Right)
{
for (bsize i = 0; i < 8; i++)
{
RenderTargets[i] .swap( Right.RenderTargets[i]);
}
DepthStencil.swap( Right.DepthStencil);
RenderPass.swap(Right.RenderPass);
}
| [
"i-sobolevskiy@mail.ru"
] | i-sobolevskiy@mail.ru |
74b18016c1bf3e5a783cbfc18ff73e8aecea5536 | 760067a4a99d45464433eb6845ebda337bf4588b | /AVSYS w5fixed_FM_angles_pointREcorder/simpleMetronome/src/testApp.cpp | 47cc42be101a128b9d94306dcb3ac6dcd8530d1b | [] | no_license | imclab/AVSYS2012 | 2fea77f0f862d8142c573b8e7af7dca44436ecf9 | eda706cb5885bfc0e6d98dc7be5bd40b072f7475 | refs/heads/master | 2021-01-17T08:33:45.608750 | 2013-02-14T00:29:35 | 2013-02-14T00:29:35 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,632 | cpp | #include "testApp.h"
//--------------------------------------------------------------
void testApp::setup(){
ofSetFrameRate(60);
ofSetVerticalSync(true);
ofBackground(90, 90, 90);
currentTime = ofGetElapsedTimeMillis();
intervalTime = 1000;
bTick = false;
nTicks = 0;
}
//--------------------------------------------------------------
void testApp::update(){
if (ofGetElapsedTimeMillis() - intervalTime > currentTime) {
currentTime = ofGetElapsedTimeMillis();
bTick = true;
nTicks ++;
} else {
bTick = false;
}
}
//--------------------------------------------------------------
void testApp::draw(){
ofSetColor(200, 200, 200);
ofDrawBitmapString("Tick = "+ ofToString(bTick) +"\nTicks" + ofToString(nTicks), ofPoint(50,50));
}
//--------------------------------------------------------------
void testApp::keyPressed(int key){
}
//--------------------------------------------------------------
void testApp::keyReleased(int key){
}
//--------------------------------------------------------------
void testApp::mouseMoved(int x, int y ){
}
//--------------------------------------------------------------
void testApp::mouseDragged(int x, int y, int button){
}
//--------------------------------------------------------------
void testApp::mousePressed(int x, int y, int button){
}
//--------------------------------------------------------------
void testApp::mouseReleased(int x, int y, int button){
}
//--------------------------------------------------------------
void testApp::windowResized(int w, int h){
}
| [
"litchirhythm@gmail.com"
] | litchirhythm@gmail.com |
549e9b736dab1652b8d6ab9688dc17c74d59ac65 | 7e686824108f22f095a89860b235cc1267e6d32f | /src/qt/sendcoinsdialog.cpp | 373a76b3a46dc4fe10020bb6c9d976f27225f0cf | [
"MIT"
] | permissive | alleck/Splendid | 2aace2cf675233c3c435c4eab4aedf8b32f23347 | 8ea29bda381628f954d1699a38a70c3ae3506ed9 | refs/heads/main | 2023-03-20T11:20:13.567687 | 2021-02-22T21:56:34 | 2021-02-22T21:56:34 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 39,453 | cpp | // Copyright (c) 2011-2016 The Bitcoin Core developers
// Copyright (c) 2017-2019 The Splendid Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include "sendcoinsdialog.h"
#include "ui_sendcoinsdialog.h"
#include "addresstablemodel.h"
#include "splendidunits.h"
#include "clientmodel.h"
#include "coincontroldialog.h"
#include "guiutil.h"
#include "optionsmodel.h"
#include "platformstyle.h"
#include "sendcoinsentry.h"
#include "walletmodel.h"
#include "guiconstants.h"
#include "base58.h"
#include "chainparams.h"
#include "wallet/coincontrol.h"
#include "validation.h" // mempool and minRelayTxFee
#include "ui_interface.h"
#include "txmempool.h"
#include "policy/fees.h"
#include "wallet/fees.h"
#include <QGraphicsDropShadowEffect>
#include <QFontMetrics>
#include <QMessageBox>
#include <QScrollBar>
#include <QSettings>
#include <QTextDocument>
#include <QTimer>
#if QT_VERSION < QT_VERSION_CHECK(5, 11, 0)
#define QTversionPreFiveEleven
#endif
SendCoinsDialog::SendCoinsDialog(const PlatformStyle *_platformStyle, QWidget *parent) :
QDialog(parent),
ui(new Ui::SendCoinsDialog),
clientModel(0),
model(0),
fNewRecipientAllowed(true),
fFeeMinimized(true),
platformStyle(_platformStyle)
{
ui->setupUi(this);
if (!_platformStyle->getImagesOnButtons()) {
ui->addButton->setIcon(QIcon());
ui->clearButton->setIcon(QIcon());
ui->sendButton->setIcon(QIcon());
} else {
ui->addButton->setIcon(_platformStyle->SingleColorIcon(":/icons/add"));
ui->clearButton->setIcon(_platformStyle->SingleColorIcon(":/icons/remove"));
ui->sendButton->setIcon(_platformStyle->SingleColorIcon(":/icons/send"));
}
GUIUtil::setupAddressWidget(ui->lineEditCoinControlChange, this);
addEntry();
connect(ui->addButton, SIGNAL(clicked()), this, SLOT(addEntry()));
connect(ui->clearButton, SIGNAL(clicked()), this, SLOT(clear()));
// Coin Control
connect(ui->pushButtonCoinControl, SIGNAL(clicked()), this, SLOT(coinControlButtonClicked()));
connect(ui->checkBoxCoinControlChange, SIGNAL(stateChanged(int)), this, SLOT(coinControlChangeChecked(int)));
connect(ui->lineEditCoinControlChange, SIGNAL(textEdited(const QString &)), this, SLOT(coinControlChangeEdited(const QString &)));
// Coin Control: clipboard actions
QAction *clipboardQuantityAction = new QAction(tr("Copy quantity"), this);
QAction *clipboardAmountAction = new QAction(tr("Copy amount"), this);
QAction *clipboardFeeAction = new QAction(tr("Copy fee"), this);
QAction *clipboardAfterFeeAction = new QAction(tr("Copy after fee"), this);
QAction *clipboardBytesAction = new QAction(tr("Copy bytes"), this);
QAction *clipboardLowOutputAction = new QAction(tr("Copy dust"), this);
QAction *clipboardChangeAction = new QAction(tr("Copy change"), this);
connect(clipboardQuantityAction, SIGNAL(triggered()), this, SLOT(coinControlClipboardQuantity()));
connect(clipboardAmountAction, SIGNAL(triggered()), this, SLOT(coinControlClipboardAmount()));
connect(clipboardFeeAction, SIGNAL(triggered()), this, SLOT(coinControlClipboardFee()));
connect(clipboardAfterFeeAction, SIGNAL(triggered()), this, SLOT(coinControlClipboardAfterFee()));
connect(clipboardBytesAction, SIGNAL(triggered()), this, SLOT(coinControlClipboardBytes()));
connect(clipboardLowOutputAction, SIGNAL(triggered()), this, SLOT(coinControlClipboardLowOutput()));
connect(clipboardChangeAction, SIGNAL(triggered()), this, SLOT(coinControlClipboardChange()));
ui->labelCoinControlQuantity->addAction(clipboardQuantityAction);
ui->labelCoinControlAmount->addAction(clipboardAmountAction);
ui->labelCoinControlFee->addAction(clipboardFeeAction);
ui->labelCoinControlAfterFee->addAction(clipboardAfterFeeAction);
ui->labelCoinControlBytes->addAction(clipboardBytesAction);
ui->labelCoinControlLowOutput->addAction(clipboardLowOutputAction);
ui->labelCoinControlChange->addAction(clipboardChangeAction);
// init transaction fee section
QSettings settings;
if (!settings.contains("fFeeSectionMinimized"))
settings.setValue("fFeeSectionMinimized", true);
if (!settings.contains("nFeeRadio") && settings.contains("nTransactionFee") && settings.value("nTransactionFee").toLongLong() > 0) // compatibility
settings.setValue("nFeeRadio", 1); // custom
if (!settings.contains("nFeeRadio"))
settings.setValue("nFeeRadio", 0); // recommended
if (!settings.contains("nSmartFeeSliderPosition"))
settings.setValue("nSmartFeeSliderPosition", 0);
if (!settings.contains("nTransactionFee"))
settings.setValue("nTransactionFee", (qint64)DEFAULT_TRANSACTION_FEE);
if (!settings.contains("fPayOnlyMinFee"))
settings.setValue("fPayOnlyMinFee", false);
ui->groupFee->setId(ui->radioSmartFee, 0);
ui->groupFee->setId(ui->radioCustomFee, 1);
ui->groupFee->button((int)std::max(0, std::min(1, settings.value("nFeeRadio").toInt())))->setChecked(true);
ui->customFee->setValue(settings.value("nTransactionFee").toLongLong());
ui->checkBoxMinimumFee->setChecked(settings.value("fPayOnlyMinFee").toBool());
minimizeFeeSection(settings.value("fFeeSectionMinimized").toBool());
// Setup the coin control visuals and labels
setupCoinControl(platformStyle);
setupScrollView(platformStyle);
setupFeeControl(platformStyle);
}
void SendCoinsDialog::setClientModel(ClientModel *_clientModel)
{
this->clientModel = _clientModel;
if (_clientModel) {
connect(_clientModel, SIGNAL(numBlocksChanged(int,QDateTime,double,bool)), this, SLOT(updateSmartFeeLabel()));
}
}
void SendCoinsDialog::setModel(WalletModel *_model)
{
this->model = _model;
if(_model && _model->getOptionsModel())
{
for(int i = 0; i < ui->entries->count(); ++i)
{
SendCoinsEntry *entry = qobject_cast<SendCoinsEntry*>(ui->entries->itemAt(i)->widget());
if(entry)
{
entry->setModel(_model);
}
}
setBalance(_model->getBalance(), _model->getUnconfirmedBalance(), _model->getImmatureBalance(),
_model->getWatchBalance(), _model->getWatchUnconfirmedBalance(), _model->getWatchImmatureBalance());
connect(_model, SIGNAL(balanceChanged(CAmount,CAmount,CAmount,CAmount,CAmount,CAmount)), this, SLOT(setBalance(CAmount,CAmount,CAmount,CAmount,CAmount,CAmount)));
connect(_model->getOptionsModel(), SIGNAL(displayUnitChanged(int)), this, SLOT(updateDisplayUnit()));
updateDisplayUnit();
// Coin Control
connect(_model->getOptionsModel(), SIGNAL(displayUnitChanged(int)), this, SLOT(coinControlUpdateLabels()));
connect(_model->getOptionsModel(), SIGNAL(coinControlFeaturesChanged(bool)), this, SLOT(coinControlFeatureChanged(bool)));
ui->frameCoinControl->setVisible(_model->getOptionsModel()->getCoinControlFeatures());
coinControlUpdateLabels();
// fee section
for (const int &n : confTargets) {
ui->confTargetSelector->addItem(tr("%1 (%2 blocks)").arg(GUIUtil::formatNiceTimeOffset(n * GetParams().GetConsensus().nPowTargetSpacing)).arg(n));
}
connect(ui->confTargetSelector, SIGNAL(currentIndexChanged(int)), this, SLOT(updateSmartFeeLabel()));
connect(ui->confTargetSelector, SIGNAL(currentIndexChanged(int)), this, SLOT(coinControlUpdateLabels()));
connect(ui->groupFee, SIGNAL(buttonClicked(int)), this, SLOT(updateFeeSectionControls()));
connect(ui->groupFee, SIGNAL(buttonClicked(int)), this, SLOT(coinControlUpdateLabels()));
connect(ui->customFee, SIGNAL(valueChanged()), this, SLOT(coinControlUpdateLabels()));
connect(ui->checkBoxMinimumFee, SIGNAL(stateChanged(int)), this, SLOT(setMinimumFee()));
connect(ui->checkBoxMinimumFee, SIGNAL(stateChanged(int)), this, SLOT(updateFeeSectionControls()));
connect(ui->checkBoxMinimumFee, SIGNAL(stateChanged(int)), this, SLOT(coinControlUpdateLabels()));
// connect(ui->optInRBF, SIGNAL(stateChanged(int)), this, SLOT(updateSmartFeeLabel()));
// connect(ui->optInRBF, SIGNAL(stateChanged(int)), this, SLOT(coinControlUpdateLabels()));
ui->customFee->setSingleStep(GetRequiredFee(1000));
updateFeeSectionControls();
updateMinFeeLabel();
updateSmartFeeLabel();
// set default rbf checkbox state
// ui->optInRBF->setCheckState(model->getDefaultWalletRbf() ? Qt::Checked : Qt::Unchecked);
ui->optInRBF->hide();
// set the smartfee-sliders default value (wallets default conf.target or last stored value)
QSettings settings;
if (settings.value("nSmartFeeSliderPosition").toInt() != 0) {
// migrate nSmartFeeSliderPosition to nConfTarget
// nConfTarget is available since 0.15 (replaced nSmartFeeSliderPosition)
int nConfirmTarget = 25 - settings.value("nSmartFeeSliderPosition").toInt(); // 25 == old slider range
settings.setValue("nConfTarget", nConfirmTarget);
settings.remove("nSmartFeeSliderPosition");
}
if (settings.value("nConfTarget").toInt() == 0)
ui->confTargetSelector->setCurrentIndex(getIndexForConfTarget(model->getDefaultConfirmTarget()));
else
ui->confTargetSelector->setCurrentIndex(getIndexForConfTarget(settings.value("nConfTarget").toInt()));
}
}
SendCoinsDialog::~SendCoinsDialog()
{
QSettings settings;
settings.setValue("fFeeSectionMinimized", fFeeMinimized);
settings.setValue("nFeeRadio", ui->groupFee->checkedId());
settings.setValue("nConfTarget", getConfTargetForIndex(ui->confTargetSelector->currentIndex()));
settings.setValue("nTransactionFee", (qint64)ui->customFee->value());
settings.setValue("fPayOnlyMinFee", ui->checkBoxMinimumFee->isChecked());
delete ui;
}
void SendCoinsDialog::setupCoinControl(const PlatformStyle *platformStyle)
{
/** Update the coincontrol frame */
ui->frameCoinControl->setStyleSheet(QString(".QFrame {background-color: %1; padding-top: 10px; padding-right: 5px; border: none;}").arg(platformStyle->WidgetBackGroundColor().name()));
ui->widgetCoinControl->setStyleSheet(".QWidget {background-color: transparent;}");
/** Create the shadow effects on the frames */
ui->frameCoinControl->setGraphicsEffect(GUIUtil::getShadowEffect());
ui->labelCoinControlFeatures->setStyleSheet(STRING_LABEL_COLOR);
ui->labelCoinControlFeatures->setFont(GUIUtil::getTopLabelFont());
ui->labelCoinControlQuantityText->setStyleSheet(STRING_LABEL_COLOR);
ui->labelCoinControlQuantityText->setFont(GUIUtil::getSubLabelFont());
ui->labelCoinControlAmountText->setStyleSheet(STRING_LABEL_COLOR);
ui->labelCoinControlAmountText->setFont(GUIUtil::getSubLabelFont());
ui->labelCoinControlFeeText->setStyleSheet(STRING_LABEL_COLOR);
ui->labelCoinControlFeeText->setFont(GUIUtil::getSubLabelFont());
ui->labelCoinControlAfterFeeText->setStyleSheet(STRING_LABEL_COLOR);
ui->labelCoinControlAfterFeeText->setFont(GUIUtil::getSubLabelFont());
ui->labelCoinControlBytesText->setStyleSheet(STRING_LABEL_COLOR);
ui->labelCoinControlBytesText->setFont(GUIUtil::getSubLabelFont());
ui->labelCoinControlLowOutputText->setStyleSheet(STRING_LABEL_COLOR);
ui->labelCoinControlLowOutputText->setFont(GUIUtil::getSubLabelFont());
ui->labelCoinControlChangeText->setStyleSheet(STRING_LABEL_COLOR);
ui->labelCoinControlChangeText->setFont(GUIUtil::getSubLabelFont());
// Align the other labels next to the input buttons to the text in the same height
ui->labelCoinControlAutomaticallySelected->setStyleSheet(STRING_LABEL_COLOR);
// Align the Custom change address checkbox
ui->checkBoxCoinControlChange->setStyleSheet(STRING_LABEL_COLOR);
ui->labelCoinControlQuantity->setFont(GUIUtil::getSubLabelFont());
ui->labelCoinControlAmount->setFont(GUIUtil::getSubLabelFont());
ui->labelCoinControlFee->setFont(GUIUtil::getSubLabelFont());
ui->labelCoinControlAfterFee->setFont(GUIUtil::getSubLabelFont());
ui->labelCoinControlBytes->setFont(GUIUtil::getSubLabelFont());
ui->labelCoinControlLowOutput->setFont(GUIUtil::getSubLabelFont());
ui->labelCoinControlChange->setFont(GUIUtil::getSubLabelFont());
ui->checkBoxCoinControlChange->setFont(GUIUtil::getSubLabelFont());
ui->lineEditCoinControlChange->setFont(GUIUtil::getSubLabelFont());
ui->labelCoinControlInsuffFunds->setFont(GUIUtil::getSubLabelFont());
ui->labelCoinControlAutomaticallySelected->setFont(GUIUtil::getSubLabelFont());
ui->labelCoinControlChangeLabel->setFont(GUIUtil::getSubLabelFontBolded());
}
void SendCoinsDialog::setupScrollView(const PlatformStyle *platformStyle)
{
/** Update the scrollview*/
ui->scrollArea->setStyleSheet(QString(".QScrollArea{background-color: %1; border: none}").arg(platformStyle->WidgetBackGroundColor().name()));
ui->scrollArea->setGraphicsEffect(GUIUtil::getShadowEffect());
// Add some spacing so we can see the whole card
ui->entries->setContentsMargins(10,10,20,0);
ui->scrollAreaWidgetContents->setStyleSheet(QString(".QWidget{ background-color: %1;}").arg(platformStyle->WidgetBackGroundColor().name()));
}
void SendCoinsDialog::setupFeeControl(const PlatformStyle *platformStyle)
{
/** Update the coincontrol frame */
ui->frameFee->setStyleSheet(QString(".QFrame {background-color: %1; padding-top: 10px; padding-right: 5px; border: none;}").arg(platformStyle->WidgetBackGroundColor().name()));
/** Create the shadow effects on the frames */
ui->frameFee->setGraphicsEffect(GUIUtil::getShadowEffect());
ui->labelFeeHeadline->setStyleSheet(STRING_LABEL_COLOR);
ui->labelFeeHeadline->setFont(GUIUtil::getSubLabelFont());
ui->labelSmartFee3->setStyleSheet(STRING_LABEL_COLOR);
ui->labelCustomPerKilobyte->setStyleSheet(STRING_LABEL_COLOR);
ui->radioSmartFee->setStyleSheet(STRING_LABEL_COLOR);
ui->radioCustomFee->setStyleSheet(STRING_LABEL_COLOR);
ui->checkBoxMinimumFee->setStyleSheet(STRING_LABEL_COLOR);
ui->buttonChooseFee->setFont(GUIUtil::getSubLabelFont());
ui->fallbackFeeWarningLabel->setFont(GUIUtil::getSubLabelFont());
ui->buttonMinimizeFee->setFont(GUIUtil::getSubLabelFont());
ui->radioSmartFee->setFont(GUIUtil::getSubLabelFont());
ui->labelSmartFee2->setFont(GUIUtil::getSubLabelFont());
ui->labelSmartFee3->setFont(GUIUtil::getSubLabelFont());
ui->confTargetSelector->setFont(GUIUtil::getSubLabelFont());
ui->radioCustomFee->setFont(GUIUtil::getSubLabelFont());
ui->labelCustomPerKilobyte->setFont(GUIUtil::getSubLabelFont());
ui->customFee->setFont(GUIUtil::getSubLabelFont());
ui->labelMinFeeWarning->setFont(GUIUtil::getSubLabelFont());
ui->optInRBF->setFont(GUIUtil::getSubLabelFont());
ui->sendButton->setFont(GUIUtil::getSubLabelFont());
ui->clearButton->setFont(GUIUtil::getSubLabelFont());
ui->addButton->setFont(GUIUtil::getSubLabelFont());
ui->labelSmartFee->setFont(GUIUtil::getSubLabelFont());
ui->labelFeeEstimation->setFont(GUIUtil::getSubLabelFont());
ui->labelFeeMinimized->setFont(GUIUtil::getSubLabelFont());
}
void SendCoinsDialog::on_sendButton_clicked()
{
if(!model || !model->getOptionsModel())
return;
QList<SendCoinsRecipient> recipients;
bool valid = true;
for(int i = 0; i < ui->entries->count(); ++i)
{
SendCoinsEntry *entry = qobject_cast<SendCoinsEntry*>(ui->entries->itemAt(i)->widget());
if(entry)
{
if(entry->validate())
{
recipients.append(entry->getValue());
}
else
{
valid = false;
}
}
}
if(!valid || recipients.isEmpty())
{
return;
}
fNewRecipientAllowed = false;
WalletModel::UnlockContext ctx(model->requestUnlock());
if(!ctx.isValid())
{
// Unlock wallet was cancelled
fNewRecipientAllowed = true;
return;
}
// prepare transaction for getting txFee earlier
WalletModelTransaction currentTransaction(recipients);
WalletModel::SendCoinsReturn prepareStatus;
// Always use a CCoinControl instance, use the CoinControlDialog instance if CoinControl has been enabled
CCoinControl ctrl;
if (model->getOptionsModel()->getCoinControlFeatures())
ctrl = *CoinControlDialog::coinControl;
updateCoinControlState(ctrl);
if (IsInitialBlockDownload()) {
GUIUtil::SyncWarningMessage syncWarning(this);
bool sendTransaction = syncWarning.showTransactionSyncWarningMessage();
if (!sendTransaction)
return;
}
prepareStatus = model->prepareTransaction(currentTransaction, ctrl);
// process prepareStatus and on error generate message shown to user
processSendCoinsReturn(prepareStatus,
SplendidUnits::formatWithUnit(model->getOptionsModel()->getDisplayUnit(), currentTransaction.getTransactionFee()));
if(prepareStatus.status != WalletModel::OK) {
fNewRecipientAllowed = true;
return;
}
CAmount txFee = currentTransaction.getTransactionFee();
// Format confirmation message
QStringList formatted;
for (const SendCoinsRecipient &rcp : currentTransaction.getRecipients())
{
// generate bold amount string
QString amount = "<b>" + SplendidUnits::formatHtmlWithUnit(model->getOptionsModel()->getDisplayUnit(), rcp.amount);
amount.append("</b>");
// generate monospace address string
QString address = "<span style='font-family: monospace;'>" + rcp.address;
address.append("</span>");
QString recipientElement;
if (!rcp.paymentRequest.IsInitialized()) // normal payment
{
if(rcp.label.length() > 0) // label with address
{
recipientElement = tr("%1 to %2").arg(amount, GUIUtil::HtmlEscape(rcp.label));
recipientElement.append(QString(" (%1)").arg(address));
}
else // just address
{
recipientElement = tr("%1 to %2").arg(amount, address);
}
}
else if(!rcp.authenticatedMerchant.isEmpty()) // authenticated payment request
{
recipientElement = tr("%1 to %2").arg(amount, GUIUtil::HtmlEscape(rcp.authenticatedMerchant));
}
else // unauthenticated payment request
{
recipientElement = tr("%1 to %2").arg(amount, address);
}
formatted.append(recipientElement);
}
QString questionString = tr("Are you sure you want to send?");
questionString.append("<br /><br />%1");
if(txFee > 0)
{
// append fee string if a fee is required
questionString.append("<hr /><span style='color:#aa0000;'>");
questionString.append(SplendidUnits::formatHtmlWithUnit(model->getOptionsModel()->getDisplayUnit(), txFee));
questionString.append("</span> ");
questionString.append(tr("added as transaction fee"));
// append transaction size
questionString.append(" (" + QString::number((double)currentTransaction.getTransactionSize() / 1000) + " kB)");
}
// add total amount in all subdivision units
questionString.append("<hr />");
CAmount totalAmount = currentTransaction.getTotalTransactionAmount() + txFee;
QStringList alternativeUnits;
for (SplendidUnits::Unit u : SplendidUnits::availableUnits())
{
if(u != model->getOptionsModel()->getDisplayUnit())
alternativeUnits.append(SplendidUnits::formatHtmlWithUnit(u, totalAmount));
}
questionString.append(tr("Total Amount %1")
.arg(SplendidUnits::formatHtmlWithUnit(model->getOptionsModel()->getDisplayUnit(), totalAmount)));
questionString.append(QString("<span style='font-size:10pt;font-weight:normal;'><br />(=%2)</span>")
.arg(alternativeUnits.join(" " + tr("or") + "<br />")));
// if (ui->optInRBF->isChecked())
// {
// questionString.append("<hr /><span>");
// questionString.append(tr("This transaction signals replaceability (optin-RBF)."));
// questionString.append("</span>");
// }
SendConfirmationDialog confirmationDialog(tr("Confirm send coins"),
questionString.arg(formatted.join("<br />")), SEND_CONFIRM_DELAY, this);
confirmationDialog.exec();
QMessageBox::StandardButton retval = (QMessageBox::StandardButton)confirmationDialog.result();
if(retval != QMessageBox::Yes)
{
fNewRecipientAllowed = true;
return;
}
// now send the prepared transaction
WalletModel::SendCoinsReturn sendStatus = model->sendCoins(currentTransaction);
// process sendStatus and on error generate message shown to user
processSendCoinsReturn(sendStatus);
if (sendStatus.status == WalletModel::OK)
{
accept();
CoinControlDialog::coinControl->UnSelectAll();
coinControlUpdateLabels();
}
fNewRecipientAllowed = true;
}
void SendCoinsDialog::clear()
{
// Remove entries until only one left
while(ui->entries->count())
{
ui->entries->takeAt(0)->widget()->deleteLater();
}
addEntry();
updateTabsAndLabels();
}
void SendCoinsDialog::reject()
{
clear();
}
void SendCoinsDialog::accept()
{
clear();
}
SendCoinsEntry *SendCoinsDialog::addEntry()
{
SendCoinsEntry *entry = new SendCoinsEntry(platformStyle, this);
entry->setModel(model);
ui->entries->addWidget(entry);
connect(entry, SIGNAL(removeEntry(SendCoinsEntry*)), this, SLOT(removeEntry(SendCoinsEntry*)));
connect(entry, SIGNAL(payAmountChanged()), this, SLOT(coinControlUpdateLabels()));
connect(entry, SIGNAL(subtractFeeFromAmountChanged()), this, SLOT(coinControlUpdateLabels()));
// Focus the field, so that entry can start immediately
entry->clear();
entry->setFocus();
ui->scrollAreaWidgetContents->resize(ui->scrollAreaWidgetContents->sizeHint());
qApp->processEvents();
QScrollBar* bar = ui->scrollArea->verticalScrollBar();
if(bar)
bar->setSliderPosition(bar->maximum());
updateTabsAndLabels();
return entry;
}
void SendCoinsDialog::updateTabsAndLabels()
{
setupTabChain(0);
coinControlUpdateLabels();
}
void SendCoinsDialog::removeEntry(SendCoinsEntry* entry)
{
entry->hide();
// If the last entry is about to be removed add an empty one
if (ui->entries->count() == 1)
addEntry();
entry->deleteLater();
updateTabsAndLabels();
}
QWidget *SendCoinsDialog::setupTabChain(QWidget *prev)
{
for(int i = 0; i < ui->entries->count(); ++i)
{
SendCoinsEntry *entry = qobject_cast<SendCoinsEntry*>(ui->entries->itemAt(i)->widget());
if(entry)
{
prev = entry->setupTabChain(prev);
}
}
QWidget::setTabOrder(prev, ui->sendButton);
QWidget::setTabOrder(ui->sendButton, ui->clearButton);
QWidget::setTabOrder(ui->clearButton, ui->addButton);
return ui->addButton;
}
void SendCoinsDialog::setAddress(const QString &address)
{
SendCoinsEntry *entry = 0;
// Replace the first entry if it is still unused
if(ui->entries->count() == 1)
{
SendCoinsEntry *first = qobject_cast<SendCoinsEntry*>(ui->entries->itemAt(0)->widget());
if(first->isClear())
{
entry = first;
}
}
if(!entry)
{
entry = addEntry();
}
entry->setAddress(address);
}
void SendCoinsDialog::pasteEntry(const SendCoinsRecipient &rv)
{
if(!fNewRecipientAllowed)
return;
SendCoinsEntry *entry = 0;
// Replace the first entry if it is still unused
if(ui->entries->count() == 1)
{
SendCoinsEntry *first = qobject_cast<SendCoinsEntry*>(ui->entries->itemAt(0)->widget());
if(first->isClear())
{
entry = first;
}
}
if(!entry)
{
entry = addEntry();
}
entry->setValue(rv);
updateTabsAndLabels();
}
bool SendCoinsDialog::handlePaymentRequest(const SendCoinsRecipient &rv)
{
// Just paste the entry, all pre-checks
// are done in paymentserver.cpp.
pasteEntry(rv);
return true;
}
void SendCoinsDialog::setBalance(const CAmount& balance, const CAmount& unconfirmedBalance, const CAmount& immatureBalance,
const CAmount& watchBalance, const CAmount& watchUnconfirmedBalance, const CAmount& watchImmatureBalance)
{
Q_UNUSED(unconfirmedBalance);
Q_UNUSED(immatureBalance);
Q_UNUSED(watchBalance);
Q_UNUSED(watchUnconfirmedBalance);
Q_UNUSED(watchImmatureBalance);
ui->labelBalance->setFont(GUIUtil::getSubLabelFont());
ui->label->setFont(GUIUtil::getSubLabelFont());
if(model && model->getOptionsModel())
{
ui->labelBalance->setText(SplendidUnits::formatWithUnit(model->getOptionsModel()->getDisplayUnit(), balance));
}
}
void SendCoinsDialog::updateDisplayUnit()
{
setBalance(model->getBalance(), 0, 0, 0, 0, 0);
ui->customFee->setDisplayUnit(model->getOptionsModel()->getDisplayUnit());
updateMinFeeLabel();
updateSmartFeeLabel();
}
void SendCoinsDialog::processSendCoinsReturn(const WalletModel::SendCoinsReturn &sendCoinsReturn, const QString &msgArg)
{
QPair<QString, CClientUIInterface::MessageBoxFlags> msgParams;
// Default to a warning message, override if error message is needed
msgParams.second = CClientUIInterface::MSG_WARNING;
// This comment is specific to SendCoinsDialog usage of WalletModel::SendCoinsReturn.
// WalletModel::TransactionCommitFailed is used only in WalletModel::sendCoins()
// all others are used only in WalletModel::prepareTransaction()
switch(sendCoinsReturn.status)
{
case WalletModel::InvalidAddress:
msgParams.first = tr("The recipient address is not valid. Please recheck.");
break;
case WalletModel::InvalidAmount:
msgParams.first = tr("The amount to pay must be larger than 0.");
break;
case WalletModel::AmountExceedsBalance:
msgParams.first = tr("The amount exceeds your balance.");
break;
case WalletModel::AmountWithFeeExceedsBalance:
msgParams.first = tr("The total exceeds your balance when the %1 transaction fee is included.").arg(msgArg);
break;
case WalletModel::DuplicateAddress:
msgParams.first = tr("Duplicate address found: addresses should only be used once each.");
break;
case WalletModel::TransactionCreationFailed:
msgParams.first = tr("Transaction creation failed!");
msgParams.second = CClientUIInterface::MSG_ERROR;
break;
case WalletModel::TransactionCommitFailed:
msgParams.first = tr("The transaction was rejected with the following reason: %1").arg(sendCoinsReturn.reasonCommitFailed);
msgParams.second = CClientUIInterface::MSG_ERROR;
break;
case WalletModel::AbsurdFee:
msgParams.first = tr("A fee higher than %1 is considered an absurdly high fee.").arg(SplendidUnits::formatWithUnit(model->getOptionsModel()->getDisplayUnit(), maxTxFee));
break;
case WalletModel::PaymentRequestExpired:
msgParams.first = tr("Payment request expired.");
msgParams.second = CClientUIInterface::MSG_ERROR;
break;
// included to prevent a compiler warning.
case WalletModel::OK:
default:
return;
}
Q_EMIT message(tr("Send Coins"), msgParams.first, msgParams.second);
}
void SendCoinsDialog::minimizeFeeSection(bool fMinimize)
{
ui->labelFeeMinimized->setVisible(fMinimize);
ui->buttonChooseFee ->setVisible(fMinimize);
ui->buttonMinimizeFee->setVisible(!fMinimize);
ui->frameFeeSelection->setVisible(!fMinimize);
ui->horizontalLayoutSmartFee->setContentsMargins(0, (fMinimize ? 0 : 6), 0, 0);
fFeeMinimized = fMinimize;
}
void SendCoinsDialog::on_buttonChooseFee_clicked()
{
minimizeFeeSection(false);
}
void SendCoinsDialog::on_buttonMinimizeFee_clicked()
{
updateFeeMinimizedLabel();
minimizeFeeSection(true);
}
void SendCoinsDialog::setMinimumFee()
{
ui->customFee->setValue(GetRequiredFee(1000));
}
void SendCoinsDialog::updateFeeSectionControls()
{
ui->confTargetSelector ->setEnabled(ui->radioSmartFee->isChecked());
ui->labelSmartFee ->setEnabled(ui->radioSmartFee->isChecked());
ui->labelSmartFee2 ->setEnabled(ui->radioSmartFee->isChecked());
ui->labelSmartFee3 ->setEnabled(ui->radioSmartFee->isChecked());
ui->labelFeeEstimation ->setEnabled(ui->radioSmartFee->isChecked());
ui->checkBoxMinimumFee ->setEnabled(ui->radioCustomFee->isChecked());
ui->labelMinFeeWarning ->setEnabled(ui->radioCustomFee->isChecked());
ui->labelCustomPerKilobyte ->setEnabled(ui->radioCustomFee->isChecked() && !ui->checkBoxMinimumFee->isChecked());
ui->customFee ->setEnabled(ui->radioCustomFee->isChecked() && !ui->checkBoxMinimumFee->isChecked());
}
void SendCoinsDialog::updateFeeMinimizedLabel()
{
if(!model || !model->getOptionsModel())
return;
if (ui->radioSmartFee->isChecked())
ui->labelFeeMinimized->setText(ui->labelSmartFee->text());
else {
ui->labelFeeMinimized->setText(SplendidUnits::formatWithUnit(model->getOptionsModel()->getDisplayUnit(), ui->customFee->value()) + "/kB");
}
}
void SendCoinsDialog::updateMinFeeLabel()
{
if (model && model->getOptionsModel())
ui->checkBoxMinimumFee->setText(tr("Pay only the required fee of %1").arg(
SplendidUnits::formatWithUnit(model->getOptionsModel()->getDisplayUnit(), GetRequiredFee(1000)) + "/kB")
);
}
void SendCoinsDialog::updateCoinControlState(CCoinControl& ctrl)
{
if (ui->radioCustomFee->isChecked()) {
ctrl.m_feerate = CFeeRate(ui->customFee->value());
} else {
ctrl.m_feerate.reset();
}
// Avoid using global defaults when sending money from the GUI
// Either custom fee will be used or if not selected, the confirmation target from dropdown box
ctrl.m_confirm_target = getConfTargetForIndex(ui->confTargetSelector->currentIndex());
// ctrl.signalRbf = ui->optInRBF->isChecked();
}
void SendCoinsDialog::updateSmartFeeLabel()
{
if(!model || !model->getOptionsModel())
return;
CCoinControl coin_control;
updateCoinControlState(coin_control);
coin_control.m_feerate.reset(); // Explicitly use only fee estimation rate for smart fee labels
FeeCalculation feeCalc;
CFeeRate feeRate = CFeeRate(GetMinimumFee(1000, coin_control, ::mempool, ::feeEstimator, &feeCalc));
ui->labelSmartFee->setText(SplendidUnits::formatWithUnit(model->getOptionsModel()->getDisplayUnit(), feeRate.GetFeePerK()) + "/kB");
if (feeCalc.reason == FeeReason::FALLBACK) {
ui->labelSmartFee2->show(); // (Smart fee not initialized yet. This usually takes a few blocks...)
ui->labelFeeEstimation->setText("");
ui->fallbackFeeWarningLabel->setVisible(true);
int lightness = ui->fallbackFeeWarningLabel->palette().color(QPalette::WindowText).lightness();
QColor warning_colour(255 - (lightness / 5), 176 - (lightness / 3), 48 - (lightness / 14));
ui->fallbackFeeWarningLabel->setStyleSheet("QLabel { color: " + warning_colour.name() + "; }");
#ifndef QTversionPreFiveEleven
ui->fallbackFeeWarningLabel->setIndent(QFontMetrics(ui->fallbackFeeWarningLabel->font()).horizontalAdvance("x"));
#else
ui->fallbackFeeWarningLabel->setIndent(QFontMetrics(ui->fallbackFeeWarningLabel->font()).width("x"));
#endif
}
else
{
ui->labelSmartFee2->hide();
ui->labelFeeEstimation->setText(tr("Estimated to begin confirmation within %n block(s).", "", feeCalc.returnedTarget));
ui->fallbackFeeWarningLabel->setVisible(false);
}
updateFeeMinimizedLabel();
}
// Coin Control: copy label "Quantity" to clipboard
void SendCoinsDialog::coinControlClipboardQuantity()
{
GUIUtil::setClipboard(ui->labelCoinControlQuantity->text());
}
// Coin Control: copy label "Amount" to clipboard
void SendCoinsDialog::coinControlClipboardAmount()
{
GUIUtil::setClipboard(ui->labelCoinControlAmount->text().left(ui->labelCoinControlAmount->text().indexOf(" ")));
}
// Coin Control: copy label "Fee" to clipboard
void SendCoinsDialog::coinControlClipboardFee()
{
GUIUtil::setClipboard(ui->labelCoinControlFee->text().left(ui->labelCoinControlFee->text().indexOf(" ")).replace(ASYMP_UTF8, ""));
}
// Coin Control: copy label "After fee" to clipboard
void SendCoinsDialog::coinControlClipboardAfterFee()
{
GUIUtil::setClipboard(ui->labelCoinControlAfterFee->text().left(ui->labelCoinControlAfterFee->text().indexOf(" ")).replace(ASYMP_UTF8, ""));
}
// Coin Control: copy label "Bytes" to clipboard
void SendCoinsDialog::coinControlClipboardBytes()
{
GUIUtil::setClipboard(ui->labelCoinControlBytes->text().replace(ASYMP_UTF8, ""));
}
// Coin Control: copy label "Dust" to clipboard
void SendCoinsDialog::coinControlClipboardLowOutput()
{
GUIUtil::setClipboard(ui->labelCoinControlLowOutput->text());
}
// Coin Control: copy label "Change" to clipboard
void SendCoinsDialog::coinControlClipboardChange()
{
GUIUtil::setClipboard(ui->labelCoinControlChange->text().left(ui->labelCoinControlChange->text().indexOf(" ")).replace(ASYMP_UTF8, ""));
}
// Coin Control: settings menu - coin control enabled/disabled by user
void SendCoinsDialog::coinControlFeatureChanged(bool checked)
{
ui->frameCoinControl->setVisible(checked);
if (!checked && model) // coin control features disabled
CoinControlDialog::coinControl->SetNull();
coinControlUpdateLabels();
}
// Coin Control: button inputs -> show actual coin control dialog
void SendCoinsDialog::coinControlButtonClicked()
{
CoinControlDialog dlg(platformStyle);
dlg.setModel(model);
dlg.exec();
coinControlUpdateLabels();
}
// Coin Control: checkbox custom change address
void SendCoinsDialog::coinControlChangeChecked(int state)
{
if (state == Qt::Unchecked)
{
CoinControlDialog::coinControl->destChange = CNoDestination();
ui->labelCoinControlChangeLabel->clear();
}
else
// use this to re-validate an already entered address
coinControlChangeEdited(ui->lineEditCoinControlChange->text());
ui->lineEditCoinControlChange->setEnabled((state == Qt::Checked));
}
// Coin Control: custom change address changed
void SendCoinsDialog::coinControlChangeEdited(const QString& text)
{
if (model && model->getAddressTableModel())
{
// Default to no change address until verified
CoinControlDialog::coinControl->destChange = CNoDestination();
ui->labelCoinControlChangeLabel->setStyleSheet("QLabel{color:red;}");
const CTxDestination dest = DecodeDestination(text.toStdString());
if (text.isEmpty()) // Nothing entered
{
ui->labelCoinControlChangeLabel->setText("");
}
else if (!IsValidDestination(dest)) // Invalid address
{
ui->labelCoinControlChangeLabel->setText(tr("Warning: Invalid Splendid address"));
}
else // Valid address
{
if (!model->IsSpendable(dest)) {
ui->labelCoinControlChangeLabel->setText(tr("Warning: Unknown change address"));
// confirmation dialog
QMessageBox::StandardButton btnRetVal = QMessageBox::question(this, tr("Confirm custom change address"), tr("The address you selected for change is not part of this wallet. Any or all funds in your wallet may be sent to this address. Are you sure?"),
QMessageBox::Yes | QMessageBox::Cancel, QMessageBox::Cancel);
if(btnRetVal == QMessageBox::Yes)
CoinControlDialog::coinControl->destChange = dest;
else
{
ui->lineEditCoinControlChange->setText("");
ui->labelCoinControlChangeLabel->setStyleSheet("QLabel{color:black;}");
ui->labelCoinControlChangeLabel->setText("");
}
}
else // Known change address
{
ui->labelCoinControlChangeLabel->setStyleSheet("QLabel{color:black;}");
// Query label
QString associatedLabel = model->getAddressTableModel()->labelForAddress(text);
if (!associatedLabel.isEmpty())
ui->labelCoinControlChangeLabel->setText(associatedLabel);
else
ui->labelCoinControlChangeLabel->setText(tr("(no label)"));
CoinControlDialog::coinControl->destChange = dest;
}
}
}
}
// Coin Control: update labels
void SendCoinsDialog::coinControlUpdateLabels()
{
if (!model || !model->getOptionsModel())
return;
updateCoinControlState(*CoinControlDialog::coinControl);
// set pay amounts
CoinControlDialog::payAmounts.clear();
CoinControlDialog::fSubtractFeeFromAmount = false;
for(int i = 0; i < ui->entries->count(); ++i)
{
SendCoinsEntry *entry = qobject_cast<SendCoinsEntry*>(ui->entries->itemAt(i)->widget());
if(entry && !entry->isHidden())
{
SendCoinsRecipient rcp = entry->getValue();
CoinControlDialog::payAmounts.append(rcp.amount);
if (rcp.fSubtractFeeFromAmount)
CoinControlDialog::fSubtractFeeFromAmount = true;
}
}
if (CoinControlDialog::coinControl->HasSelected())
{
// actual coin control calculation
CoinControlDialog::updateLabels(model, this);
// show coin control stats
ui->labelCoinControlAutomaticallySelected->hide();
ui->widgetCoinControl->show();
}
else
{
// hide coin control stats
ui->labelCoinControlAutomaticallySelected->show();
ui->widgetCoinControl->hide();
ui->labelCoinControlInsuffFunds->hide();
}
}
SendConfirmationDialog::SendConfirmationDialog(const QString &title, const QString &text, int _secDelay,
QWidget *parent) :
QMessageBox(QMessageBox::Question, title, text, QMessageBox::Yes | QMessageBox::Cancel, parent), secDelay(_secDelay)
{
setDefaultButton(QMessageBox::Cancel);
yesButton = button(QMessageBox::Yes);
updateYesButton();
connect(&countDownTimer, SIGNAL(timeout()), this, SLOT(countDown()));
}
int SendConfirmationDialog::exec()
{
updateYesButton();
countDownTimer.start(1000);
return QMessageBox::exec();
}
void SendConfirmationDialog::countDown()
{
secDelay--;
updateYesButton();
if(secDelay <= 0)
{
countDownTimer.stop();
}
}
void SendConfirmationDialog::updateYesButton()
{
if(secDelay > 0)
{
yesButton->setEnabled(false);
yesButton->setText(tr("Yes") + " (" + QString::number(secDelay) + ")");
}
else
{
yesButton->setEnabled(true);
yesButton->setText(tr("Yes"));
}
}
| [
"79376856+SplendidProject@users.noreply.github.com"
] | 79376856+SplendidProject@users.noreply.github.com |
d12f259f81220e89ac6bccfb3814c3f631c0195c | 652c1119a1b40474ec89caeed062a3345b7be3b1 | /OpenCVDefault/Traitement.h | c3c74d7f64e159579ee949cd8754dfe227504a6d | [] | no_license | patbaron/lab3_vision | 8c91b74f1b9dfc62eb321c5724424e4e776ba560 | 7165d50434f74eae6591ecb660af2ef1b0fa82dc | refs/heads/master | 2021-01-25T12:20:51.516553 | 2015-03-13T18:59:39 | 2015-03-13T18:59:39 | 32,175,138 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 867 | h | #pragma once
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/types_c.h>
#include <opencv2/imgproc/imgproc.hpp>
#include <list>
#include <vector>
using namespace std;
using namespace cv;
class CTraitement
{
public:
static int seuilAutomatique(Mat mat,int* positionSommet1, int* positionSommet2);
static bool inspectionFils(Mat image, Point point);
static bool detectionCercle(Mat image);
static Mat binariser(Mat image, int seuil);
static Mat etirerHistogramme(Mat);
static Mat lissage(Mat image, bool typeMedian, int grosseur);
static void passeHaut();
static void HistogrammeCouleur();
static Mat ConvertisTonGris(Mat image);
static int seuilAutomatiqueLigne(Mat mat, Point point);
static void DessineDiagramme(Mat);
static Mat calculerTonsGris(Mat image);
static Mat filtrePasseHaut(Mat image);
};
| [
"="
] | = |
ee116cae387e0bba40354b38f2df6793602a16b5 | d7d17131a5e7bf990599e29751ab038c957ceb75 | /veni_vidi_vici.cpp | e78651bf9cdb252a55b648425119d2e158159eb3 | [] | no_license | ksmail13/Algorithm | a3b76c651b125e4bd69353673b92e3edf04fec90 | 1a9970b0cd4395a4e29c042f49ed6af7e89c51d3 | refs/heads/master | 2021-01-16T00:28:30.366247 | 2018-09-04T17:24:25 | 2018-09-04T17:24:25 | 21,740,346 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 591 | cpp | #include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
int main() {
int n;
char buf[11000];
cin >> n;
getchar();
//cin.getline(buf, 11000);
fgets(buf, 11000, stdin);
int len = strlen(buf);
for (int i=0;i<len;i+=2) {
char a=buf[i],b = buf[i+1];
if(a==' '){
printf(" ");
i++;
a = buf[i];
b = buf[i+1];
}
//cout << b;
if('a'<=b && b<='z') {
char temp = (a-'a')+(b-'a')-n;
if(temp <0) temp += 26;
printf("%c", ((temp)%26)+'a');
}
else if(b==' '){
printf(" ");
}
}
cout << endl;
return 0;
}
| [
"ksmail13@gmail.com"
] | ksmail13@gmail.com |
6b6d01d43276bef97a6c2c011373a6112b504e92 | f65af559fedd173ffff478d0fc614903b8ca6a4e | /YDDemo/WordManagerWnd.cpp | 3bd0121425ae9c09909c542b512b3766b8f5c35f | [
"MIT",
"BSD-2-Clause"
] | permissive | lineCode/cef3-duilib-YDDemo | 786d2bb3740c2e8275a8cf4024ca9904b711bc12 | ff0bce50fae62671d3d812f9cbdc4d3b1e4141ba | refs/heads/master | 2021-01-13T16:49:33.049317 | 2017-06-09T17:16:04 | 2017-06-09T17:16:04 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,646 | cpp | #include"StdAfx.h"
#include "WordManagerWnd.h"
CWordManagerWnd::CWordManagerWnd()
: m_strTransSelect(_T(""))
{
}
CWordManagerWnd::~CWordManagerWnd()
{
}
UILIB_RESOURCETYPE CWordManagerWnd::GetResourceType() const
{
return UILIB_FILE;
}
LPCTSTR CWordManagerWnd::GetWindowClassName() const
{
return _T("YDWordManagerWnd");
}
void CWordManagerWnd::OnFinalMessage(HWND hWnd)
{
WindowImplBase::OnFinalMessage(hWnd);
delete this;
}
void CWordManagerWnd::InitWindow()
{
}
CDuiString CWordManagerWnd::GetSkinFile()
{
TCHAR szBuf[MAX_PATH] = _T("ydres\\YDWordManagerWnd.xml");
return szBuf;
}
CDuiString CWordManagerWnd::GetSkinFolder()
{
return _T("");
}
CControlUI* CWordManagerWnd::CreateControl(LPCTSTR pstrClass)
{
return NULL;
}
LRESULT CWordManagerWnd::HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch (uMsg)
{
case WM_KILLFOCUS:
::ShowWindow(this->m_hWnd, SW_HIDE);
break;
default:
break;
}
return __super::HandleMessage(uMsg, wParam, lParam);
}
LRESULT CWordManagerWnd::HandleCustomMessage(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
return 0;
}
void CWordManagerWnd::Notify(TNotifyUI& msg)
{
if (_tcsicmp(msg.sType, _T("click")) == 0)
{
OnClick(msg.pSender);
}
}
void CWordManagerWnd::OnClick(CControlUI* pSender)
{
::ShowWindow(this->m_hWnd,SW_HIDE);
}
void CWordManagerWnd::OnPrepare(TNotifyUI& msg)
{
}
void CWordManagerWnd::OnExit(TNotifyUI& msg)
{
Close();
}
void CWordManagerWnd::OnTimer(TNotifyUI& msg)
{
}
void CWordManagerWnd::SetMainWnd(HWND hWnd)
{
m_hMianWnd = hWnd;
}
void CWordManagerWnd::HideWindow()
{
::ShowWindow(this->m_hWnd,SW_HIDE);
} | [
"1160113606@qq.com"
] | 1160113606@qq.com |
ddc27545a61aea7d5d50c5e1303b5c6ae2888a41 | e96d0fd0951b2d128f76692f258f7383ef39264f | /notebook/String Processing/Suffix Array (n log n).cpp | b25969c00d2f45dbd5b1c1796cc5791fab351078 | [] | no_license | ZunaedSifat/acm | 2d0d58066530c2cfaa57f35af145d43eebc9e19c | 542bbbc9219f046444d7a6bcd587ca0e51e68fe1 | refs/heads/master | 2021-04-23T18:00:01.227191 | 2020-03-25T11:23:21 | 2020-03-25T11:23:21 | 240,124,919 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,433 | cpp | /**
Suffix Array implementation with count sort.
Source: E-MAXX
Running time:
Suffix Array Construction: O(NlogN)
LCP Array Construction: O(NlogN)
Suffix LCP: O(logN)
**/
#include<bits/stdc++.h>
using namespace std;
typedef pair<int, int> PII;
typedef vector<int> VI;
/// Equivalence Class INFO
vector<VI> c;
VI sort_cyclic_shifts(const string &s)
{
int n = s.size();
const int alphabet = 256;
VI p(n), cnt(alphabet, 0);
c.clear();
c.emplace_back();
c[0].resize(n);
for (int i=0; i<n; i++) cnt[s[i]]++;
for (int i=1; i<alphabet; i++) cnt[i] += cnt[i-1];
for (int i=0; i<n; i++) p[--cnt[s[i]]] = i;
c[0][p[0]] = 0;
int classes = 1;
for (int i=1; i<n; i++) {
if (s[p[i]] != s[p[i-1]]) classes++;
c[0][p[i]] = classes - 1;
}
VI pn(n), cn(n);
cnt.resize(n);
for (int h=0; (1<<h) < n; h++) {
for (int i=0; i<n; i++) {
pn[i] = p[i] - (1<<h);
if (pn[i] < 0) pn[i] += n;
}
fill(cnt.begin(), cnt.end(), 0);
/// radix sort
for (int i = 0; i < n; i++) cnt[c[h][pn[i]]]++;
for (int i = 1; i < classes; i++) cnt[i] += cnt[i-1];
for (int i = n-1; i >= 0; i--) p[--cnt[c[h][pn[i]]]] = pn[i];
cn[p[0]] = 0;
classes = 1;
for (int i=1; i<n; i++) {
PII cur = {c[h][p[i]], c[h][(p[i] + (1<<h))%n]};
PII prev = {c[h][p[i-1]], c[h][(p[i-1] + (1<<h))%n]};
if (cur != prev) ++classes;
cn[p[i]] = classes - 1;
}
c.push_back(cn);
}
return p;
}
VI suffix_array_construction(string s)
{
s += "!";
VI sorted_shifts = sort_cyclic_shifts(s);
sorted_shifts.erase(sorted_shifts.begin());
return sorted_shifts;
}
/// LCP between the ith and jth (i != j) suffix of the STRING
int suffixLCP(int i, int j)
{
assert(i != j);
int log_n = c.size()-1;
int ans = 0;
for (int k = log_n; k >= 0; k--) {
if (c[k][i] == c[k][j]) {
ans += 1 << k;
i += 1 << k;
j += 1 << k;
}
}
return ans;
}
VI lcp_construction(const string &s, const VI &sa)
{
int n = s.size();
VI rank(n, 0);
VI lcp(n-1, 0);
for (int i=0; i<n; i++)
rank[sa[i]] = i;
for (int i=0, k=0; i < n; i++) {
if (rank[i] == n - 1) {
k = 0;
continue;
}
int j = sa[rank[i] + 1];
while (i + k < n && j + k < n && s[i+k] == s[j+k]) k++;
lcp[rank[i]] = k;
if (k) k--;
}
return lcp;
}
const int MX = 1e6+7, K = 20;
int lg[MX];
void pre()
{
lg[1] = 0;
for (int i=2; i<MX; i++)
lg[i] = lg[i/2]+1;
}
struct RMQ{
int N;
VI v[K];
RMQ(const VI &a) {
N = a.size();
v[0] = a;
for (int k = 0; (1<<(k+1)) <= N; k++) {
v[k+1].resize(N);
for (int i = 0; i-1+(1<<(k+1)) < N; i++) {
v[k+1][i] = min(v[k][i], v[k][i+(1<<k)]);
}
}
}
int findMin(int i, int j) {
int k = lg[j-i+1];
return min(v[k][i], v[k][j+1-(1<<k)]);
}
};
/// Solves SPOJ-SARRAY. Given a string, find its suffix array
int main()
{
ios::sync_with_stdio(0);
cin.tie(0);
string s;
cin>>s;
vector<int> sa = suffix_array_construction(s);
for (int i: sa)
cout<<i<<"\n";
}
| [
"zunaed.sifat@gmail.com"
] | zunaed.sifat@gmail.com |
a92cdb5851282d4d55252dfc88076483ff300414 | 9970406fc9e594f2d3bff167bd741cbc797b9c40 | /STL - List/main.cpp | 7648e1f433f0099ef7c969085b9f08b669893009 | [] | no_license | Peter-Moldenhauer/CPP-Projects-Built-For-Fun | 275ad7bc2be2f09ecccb6d677e0918fff409fb0e | d2fbb451333b03b2cc9dd96c5a0277391df48c39 | refs/heads/master | 2020-05-21T19:44:58.168895 | 2016-12-09T05:34:28 | 2016-12-09T05:34:28 | 63,444,339 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,938 | cpp | /*****************************************************************************************************
** Name: Peter Moldenhauer
** Date: 11/22/16
** Description: This program demonstrates the use of the list container in the Standard Template
** Library (STL). A list is a sequence container. A list is a doubly linked list with each item inside
** of the list has one pointer pointing to the item in the front and another pointer pointing to the
** item behind. A key attribute of a list is that you have fast insert and removal of items from any
** place inside the list, not just in the front or in the back (as in vector or deque)
** Note: there is no random access with lists, no [] operator
******************************************************************************************************/
#include <iostream>
#include <list>
#include <algorithm>
using namespace std; // Everything using the STL library uses namespace std
int main()
{
// CONTAINER
list<int> myList = {5, 2, 9};
myList.push_back(6); //myList: {5, 2, 9, 6} - puts an item at the end
myList.push_front(4); // myList: {4, 5, 2, 9, 6} - puts an item at the beginning
// ALGORITHM - use algorithm function to find the item of 2, now itr (the iterator) is pointing to 2
list<int>::iterator itr = find(myList.begin(), myList.end(), 2); // itr -> 2
// Insert an element of 8 in front of itr (in front of 2)
myList.insert(itr, 8); // myList: {4, 5, 8, 2, 9, 6} - faster than vector or deque
// Increment itr, so itr now points to 9 (9 is the next element after 2)
itr++; // itr -> 9
// Erase the itr, so now 9 is erased (because itr was pointing to 9)
myList.erase(itr); // myList: {4, 8, 5, 2, 6}
// Use splice to cut the range of data in myList2 and put it into myList1 - none of the other containers can do this (splice)
//myList1.splice(itr, myList2, itr_a, itr_b);
return 0;
}
| [
"molde003@gmail.com"
] | molde003@gmail.com |
bae66abba7687a79f57133ccc1776d7e88709473 | cf5ad825a088c09b3af25f337684aa6619193e26 | /SettingManager.cpp | 1fd3352778dd4eb0902aaeac1e7123256a57420f | [] | no_license | counterm/MyFirstMeetingInitializer | a5647b877e64b7129525bb971b00686155ff48a3 | db61be8d4b4e522a22d7f17dee65c3dafb577bc9 | refs/heads/master | 2021-01-19T02:01:12.535191 | 2015-08-11T07:39:20 | 2015-08-11T07:39:20 | 40,514,083 | 0 | 0 | null | null | null | null | GB18030 | C++ | false | false | 11,574 | cpp | #include "stdafx.h"
#include "MeetingSystemSetting.h"
#include "SettingManager.h"
#include "FormDeploy.h"
#include "CovertString.h"
#include <vector>
#include "CProperties.h"
#include "MySqlHelper.h"
#include <fstream>
extern DBHELPER *dbHelper;
SettingItem::SettingItem(){
this->state = 0;
lstrcpy(this->titleName, L"");
this->iddPage = 0;
this->idcName = 0;
lstrcpy(this->name, L"");
lstrcpy(this->keyName, L"");
lstrcpy(this->var, L"");
}
void
SettingItem::toString()
{
wstring tmp;
tmp.append(L"titleName:");
tmp.append(this->titleName);
tmp.append(L"\n");
tmp.append(L"name:");
tmp.append(this->name);
tmp.append(L"\n");
tmp.append(L"keyName:");
tmp.append(this->keyName);
tmp.append(L"\n");
tmp.append(L"var:");
tmp.append(this->var);
tmp.append(L"\n");
OutputDebugString(tmp.c_str());
}
SettingManager::SettingManager(void)
{
for(int i = 0, j = sizeof(itemsTitle)/sizeof(itemsTitle[0]); i < j ;i++){
lstrcpy(itemsTitle[i], 0);
}
for(int i = 0, j = sizeof(items)/sizeof(items[0]); i < j ;i++){
items[i] = NULL;
}
}
SettingManager::~SettingManager(void)
{
for(int i = 0, j = sizeof(items)/sizeof(items[0]); i < j ;i++){
if (items[i] != NULL){
memset(items[i], 0, sizeof(items[i]));
delete items[i];
}
items[i] = NULL;
}
}
void
SettingManager::init(HWND hWnd[])
{
int len = sizeof(itemsTitle[0]);
int i = 0, j = 0, k = 0;
int iddPage[10] = {0};
int idcPage[10][10] = {{0},{0}};
TCHAR name[10][10][SETTING_LENGTH] = {{0},{0},{0}};
TCHAR pageName[50][SETTING_LENGTH] = {{0},{0}};
TCHAR keyNames[10][10][SETTING_LENGTH] = {{0},{0},{0}};
// PAGE 1
{
j = 0;
iddPage[i] = IDD_TAB_PAGE1;
lstrcpy(pageName[i], L"系统配置");
int IDC_PAGE0[] = {IDC_EDIT_SET1_1, IDC_EDIT_SET1_2, IDC_EDIT_SET1_3, IDC_EDIT_SET1_4, IDC_EDIT_SET1_5};
lstrcpy(keyNames[i][j], L"syncService");j++;
lstrcpy(keyNames[i][j], L"autoMeetingStart");j++;
lstrcpy(keyNames[i][j], L"autoBackup");j++;
lstrcpy(keyNames[i][j], L"autoBackupDateTime");j++;
lstrcpy(keyNames[i][j], L"autoTempDelete");j++;
j = 0;
lstrcpy(name[i][j], L"客户端服务地址");j++;
lstrcpy(name[i][j], L"后台到时自动开始会议");j++;
lstrcpy(name[i][j], L"自动备份数据库");j++;
lstrcpy(name[i][j], L"自动备份时间设置");j++;
lstrcpy(name[i][j], L"自动清除临时文档");j++;
memcpy(idcPage[i], IDC_PAGE0, sizeof(IDC_PAGE0));
i++;
}
// PAGE 2 客户端
{
j = 0;
iddPage[i] = IDD_TAB_PAGE2;
lstrcpy(pageName[i], L"客户端配置");
int IDC_PAGE0[] = {0, IDC_EDIT_SET2_1, IDC_EDIT_SET2_2, IDC_EDIT_SET2_3};
lstrcpy(keyNames[i][j], L"functionVersion");j++;
lstrcpy(keyNames[i][j], L"androidFunctionVersion");j++;
lstrcpy(keyNames[i][j], L"iosFunctionVersion");j++;
lstrcpy(keyNames[i][j], L"iosid");j++;
j = 0;
lstrcpy(name[i][j], L"功能配置");j++;
lstrcpy(name[i][j], L"android功能配置");j++;
lstrcpy(name[i][j], L"iOS应用编号");j++;
lstrcpy(name[i][j], L"iOS功能配置");j++;
memcpy(idcPage[i], IDC_PAGE0, sizeof(IDC_PAGE0));
i++;
}
// PAGE 3 目录
{
j = 0;
iddPage[i] = IDD_TAB_PAGE3;
lstrcpy(pageName[i], L"目录配置");
int IDC_PAGE0[] = {IDC_EDIT_SET3_1, IDC_EDIT_SET3_2, IDC_EDIT_SET3_3,
IDC_EDIT_SET3_4, IDC_EDIT_SET3_5, IDC_EDIT_SET3_6,IDC_EDIT_SET3_7, 0};
lstrcpy(keyNames[i][j],L"backupPath");j++;
lstrcpy(keyNames[i][j],L"uploadPath");j++;
lstrcpy(keyNames[i][j],L"uploadAlbum");j++;
lstrcpy(keyNames[i][j],L"videoPath");j++;
lstrcpy(keyNames[i][j],L"meetingPath");j++;
lstrcpy(keyNames[i][j],L"tempPath");j++;
lstrcpy(keyNames[i][j],L"nameplateStylePath");j++;
lstrcpy(keyNames[i][j],L"uploadSpaceLimit");j++;
j = 0;
lstrcpy(name[i][j],L"备份目录");j++;
lstrcpy(name[i][j],L"会议资料目录");j++;
lstrcpy(name[i][j],L"相册目录");j++;
lstrcpy(name[i][j],L"视频目录");j++;
lstrcpy(name[i][j],L"其它会议资料");j++;
lstrcpy(name[i][j],L"临时路径");j++;
lstrcpy(name[i][j],L"铭牌样式图片");j++;
lstrcpy(name[i][j],L"容量警告大小");j++;
memcpy(idcPage[i], IDC_PAGE0, sizeof(IDC_PAGE0));
i++;
}
// PAGE 4 二维码
{
j = 0;
iddPage[i] = IDD_TAB_PAGE4;
lstrcpy(pageName[i], L"二维码配置");
int IDC_PAGE0[] = {IDC_EDIT_SET4_1, IDC_EDIT_SET4_2, IDC_EDIT_SET4_3};
lstrcpy(keyNames[i][j], L"qrcodeExpire");j++;
lstrcpy(keyNames[i][j], L"loginAutoClassAExpire");j++;
lstrcpy(keyNames[i][j], L"qrcodeImageSize");j++;
j = 0;
lstrcpy(name[i][j], L"会议二维码超时(分)");j++;
lstrcpy(name[i][j], L"与会人员登录超时(秒)");j++;
lstrcpy(name[i][j], L"二维码大小");j++;
memcpy(idcPage[i], IDC_PAGE0, sizeof(IDC_PAGE0));
i++;
}
// PAGE 5 铭牌
{
j = 0;
iddPage[i] = IDD_TAB_PAGE5;
lstrcpy(pageName[i], L"铭牌配置");
int IDC_PAGE0[] = {IDC_EDIT_SET5_1, IDC_EDIT_SET5_2, IDC_EDIT_SET5_3,
IDC_EDIT_SET5_4, IDC_EDIT_SET5_5, IDC_EDIT_SET5_6};
lstrcpy(keyNames[i][j],L"deviceStatusExpire");j++;
lstrcpy(keyNames[i][j],L"fontPath");j++;
lstrcpy(keyNames[i][j],L"fontName");j++;
lstrcpy(keyNames[i][j],L"fontFile");j++;
lstrcpy(keyNames[i][j],L"screenStyle0");j++;
lstrcpy(keyNames[i][j],L"screenStyle1");j++;
j = 0;
lstrcpy(name[i][j],L"连接超时(秒)");j++;
lstrcpy(name[i][j],L"字体目录");j++;
lstrcpy(name[i][j],L"字体显示名(逗号隔开)");j++;
lstrcpy(name[i][j],L"字体文件名(逗号隔开)");j++;
lstrcpy(name[i][j],L"文字颜色");j++;
lstrcpy(name[i][j],L"背景颜色");j++;
memcpy(idcPage[i], IDC_PAGE0, sizeof(IDC_PAGE0));
i++;
}
// PAGE 6 移动安全
{
j = 0;
iddPage[i] = IDD_TAB_PAGE6;
lstrcpy(pageName[i], L"铭牌配置");
int IDC_PAGE0[] = {IDC_EDIT_SET6_1, IDC_EDIT_SET6_2};
lstrcpy(keyNames[i][j],L"gatewayPath");j++;
lstrcpy(keyNames[i][j],L"appID");j++;
j = 0;
lstrcpy(name[i][j],L"网关地址");j++;
lstrcpy(name[i][j],L"应用系统编号");j++;
memcpy(idcPage[i], IDC_PAGE0, sizeof(IDC_PAGE0));
i++;
}
// PAGE 7 高级
{
j = 0;
iddPage[i] = IDD_TAB_PAGE7;
lstrcpy(pageName[i], L"高级配置");
int IDC_PAGE0[] = {IDC_EDIT_SET7_1, IDC_EDIT_SET7_2, IDC_EDIT_SET7_3,
IDC_EDIT_SET7_4, IDC_EDIT_SET7_5, IDC_EDIT_SET7_6};
lstrcpy(keyNames[i][j],L"outputImageSize");j++;
lstrcpy(keyNames[i][j],L"outputImageQuality");j++;
lstrcpy(keyNames[i][j],L"md5Password");j++;
lstrcpy(keyNames[i][j],L"remoteAOPSwitch");j++;
lstrcpy(keyNames[i][j],L"devicePermission");j++;
lstrcpy(keyNames[i][j],L"login");j++;
j = 0;
lstrcpy(name[i][j],L"资料生成图片宽高");j++;
lstrcpy(name[i][j],L"资料生成图片质量(0-100)");j++;
lstrcpy(name[i][j],L"使用密文保存密码(0/1)");j++;
lstrcpy(name[i][j],L"使用接口验证(0/1)");j++;
lstrcpy(name[i][j],L"使用铭牌权限(true/false)");j++;
lstrcpy(name[i][j],L"使用登录验证(true/false)");j++;
memcpy(idcPage[i], IDC_PAGE0, sizeof(IDC_PAGE0));
i++;
}
memcpy(itemsTitle, pageName, 10*SETTING_LENGTH*sizeof(TCHAR));
//int iddPage[10] = {0};
//int idcPage[10][10] = {{0},{0}};
//TCHAR name[10][10][128] = {{0},{0},{0}};
//TCHAR pageName[10][128] = {{0},{0}};
TCHAR tmpStr[128] = {0};
i = 0;
//SettingItem *tmp;
while(iddPage[i] != 0){
j = 0;
while (keyNames[i][j][0] != 0){
items[k] = new SettingItem();//{hWnd, iddPage[i], idcPage[i][j], {0}, {0}, 0};
//tmp = items[k];
items[k]->titleName[0] = 0;
if (j==0){
lstrcpy(items[k]->titleName, pageName[i]);
}
items[k]->hwndParnet = hWnd[i];
items[k]->iddPage = iddPage[i];
items[k]->idcName = idcPage[i][j];
items[k]->type = 0;
items[k]->var[0] = 0;
lstrcpy(items[k]->keyName, keyNames[i][j]);
//lstrcpy(tmp.name, name[i][j]); // 属性中文名
lstrcpy(items[k]->name, name[i][j]);
// OutputDebugString(items[k]->name);
//items[k] = tmp; // 写入数组
k++;
j++;
}
i++;
}
items[10]->toString();
//logStr(items[10]->iddPage);
SettingItem* si = this->findItem(L"uploadSpaceLimit");
si->state = 2;
si = this->findItem(L"screenStyle0");
si->state = 12;
si = this->findItem(L"screenStyle1");
si->state = 12;
si = this->findItem(L"functionVersion");
si->state = 2;
}
SettingItem* SettingManager::findItem(const TCHAR* keyName)
{
for(int i = 0, j = sizeof(items)/sizeof(items[0]); i < j ;i++)
{
if (items[i] == NULL){
break;
}
if (lstrcmp(items[i]->keyName, keyName) == 0)
{
return items[i];
}
}
return NULL;
}
// 设置值与控件之间的传递,toControl=TRUE,则是值到控件
void SettingManager::dataSet(bool toControl)
{
if (toControl == TRUE){
for(int i = 0, j = sizeof(items)/sizeof(items[0]); i < j ;i++)
{
if (items[i] == NULL){
break;
}
if (items[i]->type == 0 && (items[i]->state & 2) == 0 && items[i]->idcName != 0){
SetDlgItemText(items[i]->hwndParnet, items[i]->idcName, items[i]->var);
}
}
}else{
TCHAR *tmp = (TCHAR*)calloc(SETTING_LENGTH, sizeof(TCHAR));
for(int i = 0, j = sizeof(items)/sizeof(items[0]); i < j ;i++)
{
if (items[i] == NULL){
break;
}
if (items[i]->type == 0 && (items[i]->state & 2) == 0 && items[i]->idcName != 0){
GetDlgItemText(items[i]->hwndParnet, items[i]->idcName, tmp, 128);
lstrcpy(items[i]->var, tmp);
}
}
}
}
// 保存配置文件
void SettingManager::fileSet()
{
ofstream outStream;
outStream.open(this->filePath);
wstring tmp;
for(int i = 0, j = sizeof(items)/sizeof(items[0]); i < j ;i++)
{
if (items[i] == NULL){
break;
}
tmp.clear();
if (items[i]->titleName[0] != 0){
tmp.append(L"\n\n#<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n# ");
tmp.append(items[i]->titleName);
tmp.append(L"\n#<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n");
}
if ((items[i]->state & 8) == 0){
tmp.append(L"# ");
tmp.append(items[i]->name);
tmp.append(L"\n");
tmp.append(items[i]->keyName);
tmp.append(L"=");
tmp.append(items[i]->var);
}else{
if (lstrcmp(items[i]->keyName, L"screenStyle0") == 0){
{
SettingItem *itm = this->findItem(L"screenStyle1");
tmp.append(L"# ");
tmp.append(items[i]->name);
tmp.append(L", ");
tmp.append(itm->name);
tmp.append(L"\n");
tmp.append(L"screenStyle=");
tmp.append(items[i]->var);
tmp.append(L",");
tmp.append(itm->var);
}
}
}
outStream << ws2utf8(tmp);
outStream << '\n';
}
outStream.close();
}
// 读取配置文件
void SettingManager::fileGet(const TCHAR* path)
{
lstrcpy(this->filePath, path);
CProperties *cps = new CProperties();
CProperty *cp = NULL;
wstring tmp;
cps->loadFrom(dbHelper->getPath(SETTING_FILE), L"UTF8");
for(int i = 0, j = sizeof(items)/sizeof(items[0]); i < j ;i++){
if (items[i] == NULL){
break;
}
if ((items[i]->state & 4) == 0){
cp = cps->getProperty(this->items[i]->keyName);
//if (cp == NULL){
// logStr(this->items[i]->keyName);
//}
tmp.clear();
tmp = cp->getString();
lstrcpy(this->items[i]->var,tmp.c_str());
}else{
// 屏幕合并获取
if (lstrcmp(items[i]->keyName, L"screenStyle0") == 0){
cp = cps->getProperty(L"screenStyle");
tmp.clear();
tmp.append(cp->getString());
{
int index = tmp.find(L",");
lstrcpy(this->items[i]->var, tmp.substr(0, index).c_str());
SettingItem *itm = this->findItem(L"screenStyle1");
if (itm != NULL){
lstrcpy(itm->var,tmp.substr(index+1).c_str());
}
}
}
}
if (cp != NULL){
memset(cp, 0, sizeof(cp));
cp = NULL;
}
}
cp = NULL;
delete cps;
//SettingItem* si = this->findItem(L"functionVersion");
//si->toString();
}
| [
"64436097@qq.com"
] | 64436097@qq.com |
8ebbc1fa23cfb0969ea13759c181dad07eac1f83 | 29739cac274b681566c34bcf309a058d0622dfb8 | /net_message_exchange/net_message_exchange.cpp | a360021f1485b3bbc587370813d92d1f6138d939 | [] | no_license | nkyriazis/net_message_exchange | 7139200e054d49408c41a55c1a91c9b756fd4fdd | e63077a4bc0a8c7f1b6291e2fee6804be9d81cd0 | refs/heads/master | 2021-03-24T09:29:37.686458 | 2009-06-30T21:59:04 | 2009-06-30T21:59:04 | 78,957,143 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 5,079 | cpp | /********************************************************************
created: 2009/06/30
created: 30:6:2009 0:25
filename: c:\Current Projects\net_message_exchange\net_message_exchange\net_message_exchange.cpp
file path: c:\Current Projects\net_message_exchange\net_message_exchange
file base: net_message_exchange
file ext: cpp
author: Nick Kyriazis
purpose: Implementation
*********************************************************************/
#include "net_message_exchange.h"
#include <boost/asio.hpp>
#include <boost/archive/binary_iarchive.hpp>
#include <boost/archive/binary_oarchive.hpp>
#include <boost/serialization/serialization.hpp>
#include <boost/serialization/shared_ptr.hpp>
#include <boost/serialization/export.hpp>
#include <iostream>
#include <sstream>
#include <fstream>
// for xml serialization the next line should be commented
#define make_nvp(a,b) (b)
using namespace std;
using namespace boost;
using namespace archive;
using namespace serialization;
using namespace asio;
//////////////////////////////////////////////////////////////////////////
static io_service g_ioService;
static const char *g_port = "12345";
//////////////////////////////////////////////////////////////////////////
size_t port_from_string(const std::string &str)
{
istringstream stream(str.c_str());
size_t ret;
stream >> ret;
return ret;
}
//////////////////////////////////////////////////////////////////////////
// Handle serialization of data
namespace boost
{
namespace serialization
{
using namespace net_message_exchange;
template < class Archive >
void serialize(Archive &ar, message_base &msg, const size_t version)
{
}
template < class Archive >
void serialize(Archive &ar, message_name &msg, const size_t version)
{
ar
& make_nvp("base", base_object<message_base>(msg))
& make_nvp("name", msg.name)
;
}
template < class Archive >
void serialize(Archive &ar, message_time &msg, const size_t version)
{
ar
& make_nvp("base", base_object<message_base>(msg))
& make_nvp("seconds", msg.seconds)
& make_nvp("minutes", msg.minutes)
& make_nvp("hours", msg.hours)
;
}
}
}
// For each class direct instantiation of template
// code and appropriate registration is required
BOOST_CLASS_EXPORT_GUID(net_message_exchange::message_name, "message_name")
BOOST_CLASS_EXPORT_GUID(net_message_exchange::message_time, "message_time")
namespace net_message_exchange
{
//////////////////////////////////////////////////////////////////////////
message_base::~message_base()
{
}
//////////////////////////////////////////////////////////////////////////
bool message_name::accept( message_visitor &vis )
{
return vis.visit(*this);
}
bool message_name::accept( message_const_visitor &vis ) const
{
return vis.visit(*this);
}
//////////////////////////////////////////////////////////////////////////
bool message_time::accept( message_visitor &vis )
{
return vis.visit(*this);
}
bool message_time::accept( message_const_visitor &vis ) const
{
return vis.visit(*this);
}
//////////////////////////////////////////////////////////////////////////
message_visitor::~message_visitor()
{
}
message_const_visitor::~message_const_visitor()
{
}
//////////////////////////////////////////////////////////////////////////
struct message_stream_private_data_base :
public message_stream::private_data,
public ip::tcp::iostream
{
message_stream_private_data_base() {}
message_stream_private_data_base(const string &server):
ip::tcp::iostream(server, g_port) {}
};
struct server_private_data :
public message_stream_private_data_base
{
server_private_data():
endpoint(ip::tcp::v4(), port_from_string(g_port)),
acceptor(g_ioService, endpoint)
{
acceptor.accept(*rdbuf());
}
ip::tcp::endpoint endpoint;
ip::tcp::acceptor acceptor;
};
struct client_private_data :
public message_stream_private_data_base
{
client_private_data(const string &server):
message_stream_private_data_base(server)
{
}
};
//////////////////////////////////////////////////////////////////////////
message_stream::private_data::~private_data()
{
}
message_stream::message_stream()
{
m_privateData.reset(new server_private_data);
}
message_stream::message_stream( const string &server )
{
m_privateData.reset(new client_private_data(server));
}
void message_stream::send_message( const message_base::ptr &msg )
{
binary_oarchive ar(*dynamic_cast<message_stream_private_data_base*>(m_privateData.get()), no_header | no_codecvt);
ar & make_nvp("message", msg);
}
message_base::ptr message_stream::receive_message()
{
binary_iarchive ar(*dynamic_cast<message_stream_private_data_base*>(m_privateData.get()), no_header | no_codecvt);
message_base::ptr msg;
ar & make_nvp("message", msg);
return msg;
}
} | [
"kyriazis@0508e60b-1d6a-8a4c-990d-504edc3ad7b7"
] | kyriazis@0508e60b-1d6a-8a4c-990d-504edc3ad7b7 |
613f62103b1b5bba2cbb732cbb6745a43281d3e7 | 0aa7a6faae665230c7196fce88a1adcdccf86f0e | /tensorflow/compiler/xla/experimental/auto_sharding/auto_sharding_util.cc | 9cbe925c564b43152b2d14b6b77386719ac1a117 | [
"Apache-2.0",
"LicenseRef-scancode-generic-cla",
"BSD-2-Clause"
] | permissive | teddyphotos/tensorflow | fc78260b23ae7bb6d5688d4ee03f8f8af8a733e3 | c32273784c085a0117afdb72ac75e37a3c587849 | refs/heads/master | 2022-10-13T11:35:47.894262 | 2022-10-02T09:01:32 | 2022-10-02T09:08:10 | 245,518,211 | 0 | 0 | null | 2020-03-06T21:16:35 | 2020-03-06T21:16:34 | null | UTF-8 | C++ | false | false | 89,565 | cc | /* Copyright 2022 The TensorFlow Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/
#include "tensorflow/compiler/xla/experimental/auto_sharding/auto_sharding_util.h"
#include <algorithm>
#include <cstdint>
#include <functional>
#include <iterator>
#include <memory>
#include <numeric>
#include <optional>
#include <ostream>
#include <string>
#include <tuple>
#include <utility>
#include <vector>
#include "absl/algorithm/container.h"
#include "absl/status/status.h"
#include "absl/status/statusor.h"
#include "absl/strings/match.h"
#include "absl/strings/str_cat.h"
#include "absl/strings/str_join.h"
#include "absl/strings/string_view.h"
#include "tensorflow/compiler/xla/array.h"
#include "tensorflow/compiler/xla/experimental/auto_sharding/auto_sharding_cost_graph.h"
#include "tensorflow/compiler/xla/experimental/auto_sharding/auto_sharding_strategy.h"
#include "tensorflow/compiler/xla/index_util.h"
#include "tensorflow/compiler/xla/service/hlo_sharding_util.h"
#include "tensorflow/compiler/xla/shape_util.h"
namespace xla {
namespace spmd {
inline const HloInstruction* PassThroughCustomCallMarkerGetSource(
const HloInstruction* ins);
inline HloInstruction* PassThroughCustomCallMarkerUser(
HloInstruction* raw_user, const HloInstruction* inst);
// Return whether a reshape instruction is a special reshape that switches
// the batch dim of a dot.
bool IsBatchDimSwitchReshape(const HloInstruction* inst) {
if (inst->opcode() != HloOpcode::kReshape) {
return false;
}
if (inst->users().size() != 1) {
return false;
}
const HloInstruction* operand = inst->operand(0);
const HloInstruction* user = inst->users().front();
if (operand->opcode() != HloOpcode::kDot) {
return false;
}
int batch_dims = operand->dot_dimension_numbers().lhs_batch_dimensions_size();
if (batch_dims <= 0) {
return false;
}
if (user->opcode() != HloOpcode::kTranspose) {
return false;
}
return true;
}
// Return whether the instruction is followed by a broadcast.
bool IsFollowedByBroadcast(const HloInstruction* ins) {
const int max_depth = 6;
for (int i = 0; i < max_depth; ++i) {
if (ins->users().empty()) {
return false;
}
ins = PassThroughCustomCallMarkerUser(ins->users().front(), ins);
if (ins->opcode() == HloOpcode::kBroadcast) {
return true;
}
if (ins->opcode() == HloOpcode::kReshape) {
i--;
}
}
return false;
}
// Return whether the instruction is followed by a reduce.
bool IsFollowedByReduce(const HloInstruction* ins) {
int max_depth = 1;
bool found = false;
std::function<void(const HloInstruction*, int)> dfs;
dfs = [&](const HloInstruction* cur, int depth) {
if (found) {
return;
}
if (cur->opcode() == HloOpcode::kReduce) {
found = true;
return;
}
if (cur->opcode() == HloOpcode::kGetTupleElement) {
depth -= 1;
}
if (depth < max_depth) {
for (auto user : cur->users()) {
dfs(PassThroughCustomCallMarkerUser(user, cur), depth + 1);
}
}
};
dfs(ins, 0);
return found;
}
// Return whether the instruction is an activation from another pipeline stage.
bool IsActivationFromAnotherStage(const HloInstruction* ins,
const InstructionBatchDimMap& batch_dim_map) {
if (!(ins->opcode() == HloOpcode::kParameter &&
batch_dim_map.contains(GetBatchDimMapKey(ins)))) {
return false;
}
for (const HloInstruction* user : ins->users()) {
if (!(user->opcode() == HloOpcode::kTuple && user->users().size() == 1 &&
user->users().front()->IsCustomCall(kPipelineMarker) &&
absl::StrContains(user->users().front()->metadata().op_type(),
"start"))) {
return false;
}
}
return true;
}
// Propagate sharding for broadcast.
// The output will be tiled along the broadcasted dimension the same way
// as the input for the broadcast while the other dimensions are kept
// non-tiled.
HloSharding BroadcastSharding(const HloSharding& input_spec,
const Shape& new_shape,
absl::Span<const int64_t> dimensions) {
if (input_spec.IsReplicated()) {
return input_spec;
}
CHECK(new_shape.IsArray());
std::vector<int64_t> target_tile_assignment_dimensions;
for (int64_t i = 0; i < new_shape.rank(); ++i) {
auto it = absl::c_find(dimensions, i);
if (it == dimensions.end()) {
target_tile_assignment_dimensions.push_back(1);
} else {
const int64_t source_dim = std::distance(dimensions.begin(), it);
target_tile_assignment_dimensions.push_back(
input_spec.tile_assignment().dim(source_dim));
}
}
if (input_spec.ReplicateOnLastTileDim()) {
target_tile_assignment_dimensions.push_back(
input_spec.tile_assignment().dimensions().back());
}
Array<int64_t> new_tile_assignment = input_spec.tile_assignment();
new_tile_assignment.Reshape(target_tile_assignment_dimensions);
return input_spec.ReplicateOnLastTileDim()
? HloSharding::PartialTile(new_tile_assignment)
: HloSharding::Tile(new_tile_assignment);
}
// Propagate sharding for dim-wise operations (e.g., slice, pad) which works
// independently on each dimension.
// The sharding can successfully propagate if the operation only happens
// on tensor dimensions that are not tiled.
std::optional<HloSharding> PropagateDimwiseSharding(
const HloSharding& input_spec, const Shape& old_shape,
const Shape& new_shape) {
if (input_spec.IsReplicated()) {
return input_spec;
}
CHECK(old_shape.IsArray());
const auto& tile_assignment = input_spec.tile_assignment();
for (int64_t i = 0; i < old_shape.rank(); ++i) {
if (tile_assignment.dim(i) > 1 &&
new_shape.dimensions(i) != old_shape.dimensions(i)) {
return std::nullopt;
}
}
return input_spec;
}
// Propagate sharding for ReduceWindow-like operations.
// The sharding can successfully propagate if the window operation only happens
// on tensor dimensions that are not tiled.
std::optional<HloSharding> PropagateReduceWindowSharding(
const HloSharding& input_spec, const Shape& old_shape,
const Window& window) {
if (input_spec.IsReplicated()) {
return input_spec;
}
CHECK(!input_spec.IsTuple());
const auto& tile_assignment = input_spec.tile_assignment();
for (int64_t i = 0; i < old_shape.rank(); ++i) {
if (tile_assignment.dim(i) > 1 && window.dimensions(i).size() != 1) {
return std::nullopt;
}
}
return input_spec;
}
// Pass through the custom call marker and get the source instruction
inline const HloInstruction* PassThroughCustomCallMarkerGetSource(
const HloInstruction* ins) {
while (ins->opcode() == HloOpcode::kGetTupleElement &&
IsCustomCallMarker(ins->operand(0))) {
const HloInstruction* custom_call = ins->operand(0);
const HloInstruction* tuple = custom_call->operand(0);
while (IsCustomCallMarker(tuple)) {
tuple = tuple->operand(0);
}
ins = tuple->operand(ins->tuple_index());
}
return ins;
}
// Depth analysis (breadth first search).
// We also assign a much larger distance to heavy operators (e.g., dot,
// convolution).
InstructionDepthMap BuildInstructionDepthMap(
const HloInstructionSequence& sequence,
const InstructionBatchDimMap& batch_dim_map) {
const std::vector<HloInstruction*>& instructions = sequence.instructions();
InstructionDepthMap depth_map;
StableHashMap<const HloInstruction*, size_t> degree_dict;
// Init frontier
size_t collected = 0;
std::vector<const HloInstruction*> current_frontier;
for (const HloInstruction* inst : instructions) {
degree_dict[inst] = inst->unique_operands().size();
if (degree_dict[inst] == 0) {
depth_map[inst] = 0;
// Add some initial depth for activations from other pipeline stages.
if (IsActivationFromAnotherStage(inst, batch_dim_map)) {
depth_map[inst] = 20;
}
current_frontier.push_back(inst);
collected++;
}
}
// Push forward
std::vector<const HloInstruction*> next_frontier;
while (collected < instructions.size()) {
CHECK(!current_frontier.empty());
next_frontier.clear();
for (const HloInstruction* inst : current_frontier) {
for (const HloInstruction* node : inst->users()) {
int now_degree = --degree_dict[node];
if (now_degree == 0) {
int64_t delta = 0;
bool reset = false;
// Heavy operators have more weight (distance).
switch (node->opcode()) {
case HloOpcode::kDot:
case HloOpcode::kConvolution:
delta = 1000;
break;
// A temporary hack here: reduce ops will generate replicated
// sharding. We do not want the later broadcast and elementwise ops
// to follow it. So we give reduce ops some penalty and let the
// elementwise ops to follow other operands.
// TODO(zhuohan): remove this hack by correctly registering
// strategies for broadcast.
case HloOpcode::kReduce:
reset = true;
break;
// For similar reasons mentioned above, we give some penalty to
// broadcast.
case HloOpcode::kBroadcast:
delta = -5;
break;
case HloOpcode::kReshape:
delta = 0;
break;
default:
delta = 1;
break;
}
if (reset) {
depth_map[node] = 0;
} else if (node->opcode() == HloOpcode::kGetTupleElement &&
IsCustomCallMarker(node->operand(0))) {
depth_map[node] =
depth_map.at(PassThroughCustomCallMarkerGetSource(node));
} else {
int64_t max_depth = depth_map.at(inst) + delta;
for (const HloInstruction* operand : node->operands()) {
max_depth = std::max(max_depth, depth_map.at(operand) + delta);
}
depth_map[node] = max_depth;
}
next_frontier.push_back(node);
collected += 1;
}
}
}
std::swap(current_frontier, next_frontier);
}
return depth_map;
}
std::string GetBatchDimMapKey(const HloInstruction* ins, int64_t idx) {
if (idx >= 0) {
return ins->name() + "/" + std::to_string(idx);
}
return ins->name();
}
void BatchDimMapForward(const std::vector<HloInstruction*>& instructions,
InstructionBatchDimMap& batch_map) {
for (const HloInstruction* ins : instructions) {
switch (ins->opcode()) {
case HloOpcode::kParameter:
case HloOpcode::kConstant:
case HloOpcode::kIota:
case HloOpcode::kRngGetAndUpdateState:
case HloOpcode::kRng:
case HloOpcode::kRngBitGenerator:
case HloOpcode::kGather:
// TODO(b/220935014) Shard kGather properly.
break;
case HloOpcode::kBroadcast: {
const HloInstruction* operand = ins->operand(0);
const auto& dimensions = ins->dimensions();
if (batch_map.contains(GetBatchDimMapKey(operand))) {
int value = batch_map[GetBatchDimMapKey(operand)];
int old_dim = -1;
for (int i = 0; i < ins->shape().rank(); ++i) {
if (absl::c_linear_search(dimensions, i)) {
old_dim++;
}
if (old_dim == value) {
batch_map[GetBatchDimMapKey(ins)] = i;
break;
}
}
}
break;
}
case HloOpcode::kReshape: {
const HloInstruction* operand = ins->operand(0);
if (batch_map.contains(GetBatchDimMapKey(operand))) {
int value = batch_map[GetBatchDimMapKey(operand)];
bool match = true;
for (int i = 0; i < value; ++i) {
if (operand->shape().dimensions(i) != ins->shape().dimensions(i)) {
match = false;
break;
}
}
if (match) {
batch_map[GetBatchDimMapKey(ins)] = value;
}
}
break;
}
case HloOpcode::kTranspose: {
const HloInstruction* operand = ins->operand(0);
const auto& dimensions = ins->dimensions();
if (batch_map.contains(GetBatchDimMapKey(operand))) {
int value = batch_map[GetBatchDimMapKey(operand)];
auto it = absl::c_find(dimensions, value);
batch_map[GetBatchDimMapKey(ins)] = it - dimensions.begin();
}
break;
}
case HloOpcode::kReverse:
case HloOpcode::kPad:
case HloOpcode::kSlice:
case HloOpcode::kConcatenate:
case HloOpcode::kDynamicSlice:
case HloOpcode::kDynamicUpdateSlice:
case HloOpcode::kReduceWindow:
case HloOpcode::kSelectAndScatter:
// Unary elementwise operations.
case HloOpcode::kAbs:
case HloOpcode::kRoundNearestAfz:
case HloOpcode::kRoundNearestEven:
case HloOpcode::kCeil:
case HloOpcode::kClz:
case HloOpcode::kConvert:
case HloOpcode::kBitcastConvert:
case HloOpcode::kCopy:
case HloOpcode::kCos:
case HloOpcode::kExp:
case HloOpcode::kExpm1:
case HloOpcode::kFloor:
case HloOpcode::kImag:
case HloOpcode::kIsFinite:
case HloOpcode::kLog:
case HloOpcode::kLog1p:
case HloOpcode::kNot:
case HloOpcode::kNegate:
case HloOpcode::kPopulationCount:
case HloOpcode::kReal:
case HloOpcode::kReducePrecision:
case HloOpcode::kRsqrt:
case HloOpcode::kLogistic:
case HloOpcode::kSign:
case HloOpcode::kSin:
case HloOpcode::kSqrt:
case HloOpcode::kCbrt:
case HloOpcode::kTanh:
// Binary elementwise operations
case HloOpcode::kAdd:
case HloOpcode::kAtan2:
case HloOpcode::kCompare:
case HloOpcode::kComplex:
case HloOpcode::kDivide:
case HloOpcode::kMaximum:
case HloOpcode::kMinimum:
case HloOpcode::kMultiply:
case HloOpcode::kPower:
case HloOpcode::kRemainder:
case HloOpcode::kSubtract:
case HloOpcode::kAnd:
case HloOpcode::kOr:
case HloOpcode::kXor:
case HloOpcode::kShiftLeft:
case HloOpcode::kShiftRightArithmetic:
case HloOpcode::kShiftRightLogical:
// Ternary elementwise operations.
case HloOpcode::kSelect:
case HloOpcode::kClamp: {
for (const HloInstruction* operand : ins->unique_operands()) {
if (batch_map.contains(GetBatchDimMapKey(operand))) {
batch_map[GetBatchDimMapKey(ins)] =
batch_map[GetBatchDimMapKey(operand)];
break;
}
}
break;
}
case HloOpcode::kReduce: {
const HloInstruction* operand = ins->operand(0);
const auto& dimensions = ins->dimensions();
if (batch_map.contains(GetBatchDimMapKey(operand))) {
int value = batch_map[GetBatchDimMapKey(operand)];
if (value == 0 && !absl::c_linear_search(dimensions, value)) {
batch_map[GetBatchDimMapKey(ins)] = value;
}
}
break;
}
case HloOpcode::kDot: {
const HloInstruction* lhs = ins->operand(0);
const HloInstruction* rhs = ins->operand(1);
const auto& dot_dnums = ins->dot_dimension_numbers();
int64_t space_base_dim = dot_dnums.lhs_batch_dimensions_size();
const auto& lhs_batch_dims =
ins->dot_dimension_numbers().lhs_batch_dimensions();
const auto& rhs_batch_dims =
ins->dot_dimension_numbers().rhs_batch_dimensions();
std::vector<int64_t> lhs_space_dims, rhs_space_dims;
std::tie(lhs_space_dims, rhs_space_dims) =
GetSpaceDims(lhs->shape(), rhs->shape(), dot_dnums);
// This part assumes that the dot has been through the dot decomposer,
// which assumes it only includes only one contracting dimension and
// one non-contracting dimension for both lhs and rhs. Given this
// assumption, the batch dimension of the dot operator can be determined
// as in the following cases:
// C[b, i, j] += A[b, i, k] * B[b, k, j]
// where the batch dimension b is the batch dimension.
// C[b, j] += A[b, k] * B[k, j]
// where the batch dimension is the non-contracting dimension of A
// C[i, b] += A[i, k] * B[k, b]
// where the batch dimension is the non-contracting dimension of B
if (batch_map.contains(GetBatchDimMapKey(lhs))) {
int value = batch_map[GetBatchDimMapKey(lhs)];
for (int i = 0; i < lhs_batch_dims.size(); ++i) {
if (value == lhs_batch_dims[i]) {
batch_map[GetBatchDimMapKey(ins)] = i;
break;
}
}
if (value == lhs_space_dims[0]) {
batch_map[GetBatchDimMapKey(ins)] = space_base_dim;
}
}
if (batch_map.contains(GetBatchDimMapKey(rhs))) {
int value = batch_map[GetBatchDimMapKey(rhs)];
for (int i = 0; i < rhs_batch_dims.size(); ++i) {
if (value == rhs_batch_dims[i]) {
batch_map[GetBatchDimMapKey(ins)] = i;
break;
}
}
if (value == rhs_space_dims[0]) {
batch_map[GetBatchDimMapKey(ins)] = space_base_dim + 1;
}
}
break;
}
case HloOpcode::kConvolution: {
const HloInstruction* lhs = ins->operand(0);
const HloInstruction* rhs = ins->operand(1);
const auto& conv_dnums = ins->convolution_dimension_numbers();
// TODO (zhuohan): Spatial dimension of the convolution may also be
// batch dimension.
// Follow similar logic with Dot, where the input batch dimension or
// the kernel output feature dimension may be the batch dimension.
if (batch_map.contains(GetBatchDimMapKey(lhs))) {
int value = batch_map[GetBatchDimMapKey(lhs)];
if (value == conv_dnums.input_batch_dimension()) {
batch_map[GetBatchDimMapKey(ins)] =
conv_dnums.output_batch_dimension();
}
}
if (batch_map.contains(GetBatchDimMapKey(rhs))) {
int value = batch_map[GetBatchDimMapKey(rhs)];
if (value == conv_dnums.kernel_output_feature_dimension()) {
batch_map[GetBatchDimMapKey(ins)] =
conv_dnums.output_feature_dimension();
}
}
break;
}
case HloOpcode::kGetTupleElement: {
const HloInstruction* op = ins->operand(0);
if (batch_map.contains(GetBatchDimMapKey(op, ins->tuple_index()))) {
batch_map[GetBatchDimMapKey(ins)] =
batch_map[GetBatchDimMapKey(op, ins->tuple_index())];
}
break;
}
case HloOpcode::kTuple:
for (size_t i = 0; i < ins->operand_count(); ++i) {
const HloInstruction* op = ins->operand(i);
if (batch_map.contains(GetBatchDimMapKey(op))) {
batch_map[GetBatchDimMapKey(ins, i)] =
batch_map[GetBatchDimMapKey(op)];
}
}
break;
case HloOpcode::kWhile: {
const HloInstruction* op = ins->operand(0);
for (size_t i = 0; i < op->shape().tuple_shapes_size(); ++i) {
if (batch_map.contains(GetBatchDimMapKey(op, i))) {
batch_map[GetBatchDimMapKey(ins, i)] =
batch_map[GetBatchDimMapKey(op, i)];
batch_map[GetBatchDimMapKey(ins->while_body()->root_instruction(),
i)] =
batch_map[GetBatchDimMapKey(op, i)];
batch_map[GetBatchDimMapKey(
ins->while_body()->parameter_instruction(0), i)] =
batch_map[GetBatchDimMapKey(op, i)];
batch_map[GetBatchDimMapKey(
ins->while_condition()->parameter_instruction(0), i)] =
batch_map[GetBatchDimMapKey(op, i)];
}
}
break;
}
case HloOpcode::kCustomCall:
break;
default:
LOG(FATAL) << "Unhandled instruction: " << ins->ToString();
}
}
}
void BatchDimMapBackward(const std::vector<HloInstruction*>& instructions,
InstructionBatchDimMap& batch_map) {
for (int64_t i = instructions.size() - 1; i >= 0; i--) {
const HloInstruction* ins = instructions[i];
switch (ins->opcode()) {
case HloOpcode::kBroadcast: {
const HloInstruction* operand = ins->operand(0);
const auto& dimensions = ins->dimensions();
if (batch_map.contains(GetBatchDimMapKey(ins)) &&
!batch_map.contains(GetBatchDimMapKey(operand))) {
int value = batch_map[GetBatchDimMapKey(ins)];
int old_dim = -1;
for (int i = 0; i < ins->shape().rank(); ++i) {
if (absl::c_linear_search(dimensions, i)) {
old_dim++;
}
if (i == value && old_dim >= 0) {
batch_map[GetBatchDimMapKey(operand)] = old_dim;
break;
}
}
}
break;
}
case HloOpcode::kReshape: {
const HloInstruction* operand = ins->operand(0);
if (batch_map.contains(GetBatchDimMapKey(ins)) &&
!batch_map.contains(GetBatchDimMapKey(operand))) {
int value = batch_map[GetBatchDimMapKey(ins)];
bool match = true;
for (int i = 0; i < value; ++i) {
if (operand->shape().dimensions(i) != ins->shape().dimensions(i)) {
match = false;
break;
}
}
if (match) {
batch_map[GetBatchDimMapKey(operand)] = value;
}
}
break;
}
case HloOpcode::kTranspose: {
const HloInstruction* operand = ins->operand(0);
const auto& dimensions = ins->dimensions();
if (batch_map.contains(GetBatchDimMapKey(ins)) &&
!batch_map.contains(GetBatchDimMapKey(operand))) {
batch_map[GetBatchDimMapKey(operand)] =
dimensions[batch_map[GetBatchDimMapKey(ins)]];
}
break;
}
case HloOpcode::kReverse:
case HloOpcode::kPad:
case HloOpcode::kSlice:
case HloOpcode::kConcatenate:
case HloOpcode::kDynamicSlice:
case HloOpcode::kDynamicUpdateSlice:
case HloOpcode::kReduceWindow:
case HloOpcode::kSelectAndScatter:
// TODO(zhuohan): support these
break;
// Unary elementwise operations.
case HloOpcode::kAbs:
case HloOpcode::kRoundNearestAfz:
case HloOpcode::kRoundNearestEven:
case HloOpcode::kCeil:
case HloOpcode::kClz:
case HloOpcode::kConvert:
case HloOpcode::kBitcastConvert:
case HloOpcode::kCopy:
case HloOpcode::kCos:
case HloOpcode::kExp:
case HloOpcode::kExpm1:
case HloOpcode::kFloor:
case HloOpcode::kImag:
case HloOpcode::kIsFinite:
case HloOpcode::kLog:
case HloOpcode::kLog1p:
case HloOpcode::kNot:
case HloOpcode::kNegate:
case HloOpcode::kPopulationCount:
case HloOpcode::kReal:
case HloOpcode::kReducePrecision:
case HloOpcode::kRsqrt:
case HloOpcode::kLogistic:
case HloOpcode::kSign:
case HloOpcode::kSin:
case HloOpcode::kSqrt:
case HloOpcode::kCbrt:
case HloOpcode::kTanh:
// Binary elementwise operations
case HloOpcode::kAdd:
case HloOpcode::kAtan2:
case HloOpcode::kCompare:
case HloOpcode::kComplex:
case HloOpcode::kDivide:
case HloOpcode::kMaximum:
case HloOpcode::kMinimum:
case HloOpcode::kMultiply:
case HloOpcode::kPower:
case HloOpcode::kRemainder:
case HloOpcode::kSubtract:
case HloOpcode::kAnd:
case HloOpcode::kOr:
case HloOpcode::kXor:
case HloOpcode::kShiftLeft:
case HloOpcode::kShiftRightArithmetic:
case HloOpcode::kShiftRightLogical:
// Ternary elementwise operations.
case HloOpcode::kSelect:
case HloOpcode::kClamp: {
if (batch_map.contains(GetBatchDimMapKey(ins))) {
int value = batch_map[GetBatchDimMapKey(ins)];
for (const HloInstruction* operand : ins->unique_operands()) {
if (!batch_map.contains(GetBatchDimMapKey(operand))) {
batch_map[GetBatchDimMapKey(operand)] = value;
}
}
}
break;
}
case HloOpcode::kReduce: {
const HloInstruction* operand = ins->operand(0);
const auto& dimensions = ins->dimensions();
if (batch_map.contains(GetBatchDimMapKey(ins)) &&
!batch_map.contains(GetBatchDimMapKey(operand))) {
int value = batch_map[GetBatchDimMapKey(ins)];
if (value == 0 && !absl::c_linear_search(dimensions, value)) {
batch_map[GetBatchDimMapKey(operand)] = value;
}
}
break;
}
case HloOpcode::kDot: {
const HloInstruction* lhs = ins->operand(0);
const HloInstruction* rhs = ins->operand(1);
const auto& dot_dnums = ins->dot_dimension_numbers();
int64_t space_base_dim = dot_dnums.lhs_batch_dimensions_size();
const auto& lhs_batch_dims =
ins->dot_dimension_numbers().lhs_batch_dimensions();
const auto& rhs_batch_dims =
ins->dot_dimension_numbers().rhs_batch_dimensions();
std::vector<int64_t> lhs_space_dims, rhs_space_dims;
std::tie(lhs_space_dims, rhs_space_dims) =
GetSpaceDims(lhs->shape(), rhs->shape(), dot_dnums);
if (batch_map.contains(GetBatchDimMapKey(ins))) {
int value = batch_map[GetBatchDimMapKey(ins)];
if (!batch_map.contains(GetBatchDimMapKey(lhs))) {
for (int i = 0; i < lhs_batch_dims.size(); ++i) {
if (value == i) {
batch_map[GetBatchDimMapKey(lhs)] = lhs_batch_dims[i];
break;
}
}
if (value == space_base_dim) {
batch_map[GetBatchDimMapKey(lhs)] = lhs_space_dims[0];
}
}
if (!batch_map.contains(GetBatchDimMapKey(rhs))) {
for (int i = 0; i < rhs_batch_dims.size(); ++i) {
if (value == i) {
batch_map[GetBatchDimMapKey(rhs)] = rhs_batch_dims[i];
break;
}
}
if (value == space_base_dim + 1) {
batch_map[GetBatchDimMapKey(rhs)] = rhs_space_dims[0];
}
}
}
break;
}
case HloOpcode::kConvolution: {
const HloInstruction* lhs = ins->operand(0);
const HloInstruction* rhs = ins->operand(1);
const auto& conv_dnums = ins->convolution_dimension_numbers();
if (batch_map.contains(GetBatchDimMapKey(ins))) {
int value = batch_map[GetBatchDimMapKey(ins)];
if (value == conv_dnums.output_batch_dimension() &&
!batch_map.contains(GetBatchDimMapKey(lhs))) {
batch_map[GetBatchDimMapKey(lhs)] =
conv_dnums.input_batch_dimension();
}
if (value == conv_dnums.output_feature_dimension() &&
!batch_map.contains(GetBatchDimMapKey(rhs))) {
batch_map[GetBatchDimMapKey(rhs)] =
conv_dnums.kernel_output_feature_dimension();
}
}
break;
}
case HloOpcode::kGetTupleElement: {
const HloInstruction* op = ins->operand(0);
if (batch_map.contains(GetBatchDimMapKey(ins, ins->tuple_index()))) {
batch_map[GetBatchDimMapKey(op)] =
batch_map[GetBatchDimMapKey(ins, ins->tuple_index())];
}
break;
}
case HloOpcode::kTuple:
for (size_t i = 0; i < ins->operand_count(); ++i) {
const HloInstruction* op = ins->operand(i);
if (batch_map.contains(GetBatchDimMapKey(ins, i))) {
batch_map[GetBatchDimMapKey(op)] =
batch_map[GetBatchDimMapKey(ins, i)];
}
}
break;
case HloOpcode::kWhile: {
const HloInstruction* op = ins->operand(0);
for (size_t i = 0; i < op->shape().tuple_shapes_size(); ++i) {
if (batch_map.contains(GetBatchDimMapKey(ins, i))) {
batch_map[GetBatchDimMapKey(op, i)] =
batch_map[GetBatchDimMapKey(ins, i)];
batch_map[GetBatchDimMapKey(ins->while_body()->root_instruction(),
i)] =
batch_map[GetBatchDimMapKey(ins, i)];
batch_map[GetBatchDimMapKey(
ins->while_body()->parameter_instruction(0), i)] =
batch_map[GetBatchDimMapKey(ins, i)];
batch_map[GetBatchDimMapKey(
ins->while_condition()->parameter_instruction(0), i)] =
batch_map[GetBatchDimMapKey(ins, i)];
}
}
break;
}
case HloOpcode::kCustomCall:
break;
default:
break;
}
}
}
// This function was unable to thoroughly propagate batch dim to all
// instructions. It only propagates to 14 other instructions in the 8b model.
// Batch dimension analysis that finds the batch dimension of each instruction.
InstructionBatchDimMap BuildInstructionBatchDimMap(
const HloInstructionSequence& sequence) {
InstructionBatchDimMap batch_map;
const std::vector<HloInstruction*>& instructions = sequence.instructions();
// We use the first dot or convolution as the source to start batch dim
// propagation. Assume the first dim of the first dot is the batch dim.
int batch_dim_of_source = 0;
// Find the source of batch_dim propagation
bool set_the_next_dot_conv = true;
for (const HloInstruction* ins : instructions) {
if (ins->opcode() == HloOpcode::kDot ||
ins->opcode() == HloOpcode::kConvolution) {
if (set_the_next_dot_conv) {
set_the_next_dot_conv = false;
batch_map[ins->name()] = batch_dim_of_source;
}
}
if (ins->IsCustomCall(kPipelineMarker) &&
absl::StrContains(ins->metadata().op_type(), "start")) {
// Reset the status after meet a new pipeline marker.
set_the_next_dot_conv = true;
}
}
int64_t previous_cnt = 0;
while (true) {
// Forward propagation: propagate from operand
BatchDimMapForward(instructions, batch_map);
// Backward propagation: propagate to operands
BatchDimMapBackward(instructions, batch_map);
LOG(INFO) << "batch_map size: " << batch_map.size();
if (batch_map.size() == previous_cnt) {
break;
}
previous_cnt = batch_map.size();
}
return batch_map;
}
// Remove duplicated strategies with the same output sharding spec.
// If duplicates strategies have different costs, an arbitrary one will be
// chosen. A exception is replicated strategy. Only *real* replicated strategies
// are preserved, which are generated with name "R" or starting with "R
// (allreduce". Unintended replicated strategies are removed, which are ones
// that were not intended to be replicated when being generating, but ending up
// being replicated, which could happen when, for example, generating 2D
// sharding for a 1D mesh shape.
void RemoveDuplicatedStrategy(std::unique_ptr<StrategyVector>& strategies) {
if (strategies->is_tuple) {
for (auto& child : strategies->childs) {
RemoveDuplicatedStrategy(child);
}
} else {
std::vector<ShardingStrategy> new_vector;
absl::flat_hash_set<HloSharding> added;
int32_t replicated_index = -1;
for (size_t i = 0; i < strategies->leaf_vector.size(); ++i) {
if (strategies->leaf_vector[i].output_sharding.IsReplicated() &&
!(strategies->leaf_vector[i].name == "R" ||
absl::StrContains(strategies->leaf_vector[i].name,
"R (allreduce"))) {
continue;
}
if (strategies->leaf_vector[i].output_sharding.IsReplicated()) {
replicated_index = i;
continue;
}
if (!added.count(strategies->leaf_vector[i].output_sharding)) {
added.insert(strategies->leaf_vector[i].output_sharding);
new_vector.push_back(std::move(strategies->leaf_vector[i]));
}
}
// Keeps replicated strategy as the last one.
if (replicated_index >= 0) {
new_vector.push_back(
std::move(strategies->leaf_vector[replicated_index]));
}
strategies->leaf_vector = std::move(new_vector);
}
}
// Filter strategies according to the solver_option.force_batch_dim_to_mesh_dim.
// This can be used to forcibly generate data-parallel strategies.
Status FilterStrategy(const HloInstruction* ins, const Shape& shape,
std::unique_ptr<StrategyVector>& strategies,
const ClusterEnvironment& cluster_env,
const InstructionBatchDimMap& batch_map,
const AutoShardingSolverOption& solver_option) {
int mesh_dim = solver_option.force_batch_dim_to_mesh_dim;
int batch_dim = batch_map.at(GetBatchDimMapKey(ins));
const Array<int64_t>& device_mesh = cluster_env.device_mesh_;
if (shape.dimensions(batch_dim) % device_mesh.dim(mesh_dim) != 0) {
return tensorflow::errors::InvalidArgument(
"The length of batch dimension is "
"not divisible by the number of devices");
}
std::vector<ShardingStrategy> new_leaf_vector;
for (auto& stra : strategies->leaf_vector) {
std::vector<int64_t> tensor_dim_to_mesh_dim =
cluster_env.GetTensorDimToMeshDimWrapper(shape, stra.output_sharding);
if (device_mesh.dim(mesh_dim) > 1) {
// If the mesh dim is not one, the output tensor must be
// tiled along the mesh dim.
if (tensor_dim_to_mesh_dim[batch_dim] == mesh_dim) {
new_leaf_vector.push_back(std::move(stra));
}
} else {
// If the mesh dim is one, the output tensor must be replicated
// on the mesh dim.
if (tensor_dim_to_mesh_dim[batch_dim] == -1) {
new_leaf_vector.push_back(std::move(stra));
}
}
}
CHECK(!new_leaf_vector.empty())
<< ins->ToString() << " does not have any valid strategies";
strategies->leaf_vector = std::move(new_leaf_vector);
return OkStatus();
}
inline std::pair<int, int> ParseMeshDims(const std::string& strategy_name) {
if (absl::StrContains(strategy_name, "{0,1}")) {
return {0, 1};
}
return {1, 0};
}
// Return whether the tensor shape is divisible by
// the number of devices along multiple dimensions.
bool IsDivisible(const HloInstruction* ins, const Array<int64_t>& device_mesh,
absl::Span<const int64_t> tensor_dims,
absl::Span<const int64_t> mesh_dims) {
CHECK_EQ(tensor_dims.size(), mesh_dims.size());
for (int64_t i = 0; i < tensor_dims.size(); ++i) {
if (ins->shape().dimensions(tensor_dims[i]) %
device_mesh.dim(mesh_dims[i]) !=
0) {
return false;
}
}
return true;
}
// Return the output sharding of the reduce-scatter variant of a given strategy.
HloSharding GetReduceScatterOutput(const HloInstruction* ins,
const ShardingStrategy& strategy,
const ClusterEnvironment& cluster_env) {
const Array<int64_t>& device_mesh = cluster_env.device_mesh_;
const Array<int64_t>& device_mesh_1d = cluster_env.device_mesh_1d_;
if (ins->opcode() == HloOpcode::kDot) {
const DotDimensionNumbers& dot_dnums = ins->dot_dimension_numbers();
int64_t space_base_dim = dot_dnums.lhs_batch_dimensions_size();
if (absl::StartsWith(strategy.name, "SR = SS x SR") ||
absl::StartsWith(strategy.name, "RS = RS x SS")) {
int mesh_dim0, mesh_dim1;
std::tie(mesh_dim0, mesh_dim1) = ParseMeshDims(strategy.name);
if (!IsDivisible(ins, device_mesh, {space_base_dim, space_base_dim + 1},
{mesh_dim0, mesh_dim1})) {
// XLA supports uneven partitioning by adding padding.
// However, the ShardingSpec in Jax does not support uneven
// partitioning.
return Undefined();
}
return Tile(ins->shape(), {space_base_dim, space_base_dim + 1},
{mesh_dim0, mesh_dim1}, device_mesh);
}
if (absl::StartsWith(strategy.name, "SbR = SbSk x SbSk")) {
int mesh_dim0, mesh_dim1;
std::tie(mesh_dim0, mesh_dim1) = ParseMeshDims(strategy.name);
if (!IsDivisible(ins, device_mesh, {0, space_base_dim},
{mesh_dim0, mesh_dim1})) {
// XLA supports uneven partitioning by adding padding.
// However, the ShardingSpec in Jax does not support uneven
// partitioning.
return Undefined();
}
return Tile(ins->shape(), {0, space_base_dim}, {mesh_dim0, mesh_dim1},
device_mesh);
}
if (absl::StartsWith(strategy.name, "RR = RS x SR")) {
int mesh_dim = absl::StrContains(strategy.name, "{0}") ? 0 : 1;
if (!IsDivisible(ins, device_mesh, {space_base_dim}, {mesh_dim})) {
return Undefined();
}
return Tile(ins->shape(), {space_base_dim}, {mesh_dim}, device_mesh);
}
if (absl::StartsWith(strategy.name, "R = Sk x Sk")) {
int mesh_dim = 0;
if (!IsDivisible(ins, device_mesh_1d, {space_base_dim}, {mesh_dim})) {
return Undefined();
}
return Tile(ins->shape(), {space_base_dim}, {mesh_dim}, device_mesh_1d);
}
} else if (ins->opcode() == HloOpcode::kConvolution) {
const ConvolutionDimensionNumbers& conv_dnums =
ins->convolution_dimension_numbers();
int out_batch_dim = conv_dnums.output_batch_dimension();
int out_out_channel_dim = conv_dnums.output_feature_dimension();
if (absl::StartsWith(strategy.name, "SR = SS x SR") ||
absl::StartsWith(strategy.name, "RS = RS x SS")) {
int mesh_dim0, mesh_dim1;
std::tie(mesh_dim0, mesh_dim1) = ParseMeshDims(strategy.name);
if (!IsDivisible(ins, device_mesh, {out_batch_dim, out_out_channel_dim},
{mesh_dim0, mesh_dim1})) {
return Undefined();
}
return Tile(ins->shape(), {out_batch_dim, out_out_channel_dim},
{mesh_dim0, mesh_dim1}, device_mesh);
}
if (absl::StartsWith(strategy.name, "R = Sk x Sk")) {
int mesh_dim = 0;
if (!IsDivisible(ins, device_mesh_1d, {out_batch_dim}, {mesh_dim})) {
return Undefined();
}
return Tile(ins->shape(), {out_batch_dim}, {mesh_dim}, device_mesh_1d);
}
} else if (ins->opcode() == HloOpcode::kReduce) {
// TODO(zhuohan): support more cases.
CHECK_EQ(ins->shape().rank(), 1);
int mesh_dim;
if (absl::StrContains(strategy.name, "allreduce @ [0]")) {
mesh_dim = 0;
} else {
mesh_dim = 1;
}
if (strategy.output_sharding.IsReplicated()) {
if (absl::StrContains(strategy.name, "1d")) {
if (!IsDivisible(ins, device_mesh_1d, {0}, {mesh_dim})) {
return Undefined();
}
return Tile(ins->shape(), {0}, {mesh_dim}, device_mesh_1d);
}
if (!IsDivisible(ins, device_mesh, {0}, {mesh_dim})) {
return Undefined();
}
return Tile(ins->shape(), {0}, {mesh_dim}, device_mesh);
}
if (!IsDivisible(ins, device_mesh_1d, {0}, {0})) {
return Undefined();
}
Array<int64_t> tile_assignment = strategy.output_sharding.tile_assignment();
tile_assignment.Reshape({cluster_env.total_devices_});
return HloSharding::Tile(std::move(tile_assignment));
} else {
LOG(FATAL) << "Invalid instruction: " << ins->ToString();
}
return Undefined();
}
// Return whether an instruction has the opportunity to generate reduce-scatter.
bool HasReduceScatterOpportunity(
const HloInstruction* inst, const StrategyMap& strategy_map,
const CostGraph& cost_graph, absl::Span<const int64_t> s_val,
const StableHashSet<const HloInstruction*>& modified) {
// If the operand is already modified by other ops, skip this instruction to
// avoid conflicts.
for (const HloInstruction* operand : inst->operands()) {
if (modified.contains(operand)) {
return false;
}
}
if (modified.contains(inst)) {
return false;
}
if (inst->opcode() == HloOpcode::kReduce && inst->shape().rank() == 1) {
return true;
}
if (inst->opcode() == HloOpcode::kDot) {
if (GetShardingStrategy(inst->operand(0), strategy_map, cost_graph, s_val)
.output_sharding.IsReplicated() &&
GetShardingStrategy(inst->operand(1), strategy_map, cost_graph, s_val)
.output_sharding.IsReplicated()) {
// This dot is replicated on all devices. Do not split it.
// TODO(zhuohan): improve this condition.
return false;
}
return true;
}
if (inst->opcode() == HloOpcode::kConvolution) {
return true;
}
return false;
}
// Return whether all users of an instruction is reduce.
bool AllUsersAreReduce(const HloInstruction* inst) {
for (const HloInstruction* user : inst->users()) {
if (user->opcode() != HloOpcode::kReduce) {
return false;
}
}
return true;
}
// Set sharding, and apply transpose if necessary.
void SetSharding(HloInstruction* to_split, const HloSharding& output_spec,
const HloInstruction* ref_inst,
const HloInstruction* shape_inst,
StableHashSet<const HloInstruction*>& modified) {
modified.insert(to_split);
if (DimensionsEqual(to_split->shape(), ref_inst->shape())) {
to_split->set_sharding(output_spec);
} else {
CHECK(shape_inst != nullptr);
CHECK_EQ(shape_inst->opcode(), HloOpcode::kTranspose);
to_split->set_sharding(hlo_sharding_util::TransposeSharding(
output_spec, shape_inst->dimensions()));
}
}
// Return whether the instruction is always replicated.
// (e.g., constant, broadcasted constant, scalar)
bool IsAlwaysReplicated(const HloInstruction* inst) {
if (inst->opcode() == HloOpcode::kConstant) {
return true;
}
if (inst->shape().rank() == 0) {
return true;
}
if (inst->opcode() == HloOpcode::kBroadcast) {
return IsAlwaysReplicated(inst->operand(0));
}
return false;
}
// Return whether this instruction is a convert on a parameter.
bool IsParameterConvert(const HloInstruction* inst) {
if (inst->opcode() == HloOpcode::kConvert &&
inst->operand(0)->opcode() == HloOpcode::kParameter) {
return true;
}
return false;
}
// Pass through the custom call marker and get the acutal operand.
inline HloInstruction* PassThroughCustomCallMarkerOperand(
HloInstruction* raw_operand, const HloInstruction* inst) {
if (!IsCustomCallMarker(raw_operand)) {
return raw_operand;
}
CHECK_EQ(inst->opcode(), HloOpcode::kGetTupleElement);
int index = inst->tuple_index();
return raw_operand->mutable_operand(0)->mutable_operand(index);
}
// Return whether the tuple is only used by a custom call marker.
inline bool IsCustomCallMarkerTuple(const HloInstruction* inst) {
return inst->opcode() == HloOpcode::kTuple && inst->users().size() == 1 &&
IsCustomCallMarker(inst->users().front());
}
// Pass through the custom call marker and get the actual user.
inline HloInstruction* PassThroughCustomCallMarkerUser(
HloInstruction* raw_user, const HloInstruction* inst) {
if (!IsCustomCallMarkerTuple(raw_user)) {
return raw_user;
}
const HloInstruction* custom_call = raw_user->users().front();
int index = -1;
for (int i = 0; i < raw_user->operand_count(); i++) {
if (raw_user->operand(i) == inst) {
index = i;
break;
}
}
CHECK_NE(index, -1);
HloInstruction* ret = nullptr;
for (HloInstruction* user : custom_call->users()) {
CHECK_EQ(user->opcode(), HloOpcode::kGetTupleElement);
if (user->tuple_index() == index) {
CHECK_EQ(ret, nullptr);
ret = user;
}
}
return ret == nullptr ? raw_user : ret;
}
// Return the users of an instruction and its alias,
// excluding the final output tuple.
inline StableHashSet<HloInstruction*> UsersWithAlias(
const HloInstruction* inst, const AliasMap& alias_map,
const HloInstruction* output) {
StableHashSet<HloInstruction*> users;
for (HloInstruction* user : inst->users()) {
users.insert(PassThroughCustomCallMarkerUser(user, inst));
}
auto iter = alias_map.find(inst);
if (iter != alias_map.end()) {
for (HloInstruction* user : iter->second->users()) {
users.insert(PassThroughCustomCallMarkerUser(user, iter->second));
}
}
users.erase(output);
return users;
}
// DFS to find the replicated set starting from cur instruction.
void FindReplicateSet(
HloInstruction* cur, const AliasMap& alias_map, const CostGraph& cost_graph,
absl::Span<const int64_t> s_val, const StrategyMap& strategy_map,
const ShardingStrategy& strategy, const HloInstruction* output,
bool do_all_gather_after_backward, HloInstruction*& transpose_inst,
StableHashSet<HloInstruction*>& replicated_set,
StableHashSet<HloInstruction*>& boundary_set,
StableHashSet<HloInstruction*>& consumer_set,
StableHashSet<const HloInstruction*>& visited) {
visited.insert(cur);
// Check whether the node is a boundary node.
StableHashSet<HloInstruction*> users = UsersWithAlias(cur, alias_map, output);
for (HloInstruction* consumer : users) {
const HloInstruction* shape_inst = cur;
// Allow at most one transpose
if (consumer->opcode() == HloOpcode::kTranspose &&
(transpose_inst == nullptr ||
DimensionsEqual(transpose_inst->shape(), consumer->shape()))) {
shape_inst = consumer;
transpose_inst = consumer;
// TODO(zhuohan): fix output_sharding comparison.
}
if (consumer->opcode() == HloOpcode::kTuple ||
(do_all_gather_after_backward && IsParameterConvert(consumer)) ||
GetShardingStrategy(consumer, strategy_map, cost_graph, s_val)
.output_sharding != strategy.output_sharding ||
!DimensionsEqual(consumer->shape(), shape_inst->shape())) {
boundary_set.insert(cur);
return;
}
}
// If this node is not a boundary node, propagate from this node.
replicated_set.insert(cur);
for (HloInstruction* consumer : users) {
if (!visited.contains(consumer)) {
consumer_set.insert(consumer);
FindReplicateSet(consumer, alias_map, cost_graph, s_val, strategy_map,
strategy, output, do_all_gather_after_backward,
transpose_inst, replicated_set, boundary_set,
consumer_set, visited);
}
}
for (size_t i = 0; i < cur->operand_count(); ++i) {
HloInstruction* operand = cur->mutable_operand(i);
operand = PassThroughCustomCallMarkerOperand(operand, cur);
if (!visited.contains(operand) && !IsAlwaysReplicated(operand) &&
GetShardingStrategy(operand, strategy_map, cost_graph, s_val)
.output_sharding == strategy.output_sharding &&
DimensionsEqual(operand->shape(), cur->shape())) {
FindReplicateSet(operand, alias_map, cost_graph, s_val, strategy_map,
strategy, output, do_all_gather_after_backward,
transpose_inst, replicated_set, boundary_set,
consumer_set, visited);
}
}
}
// Try to reduce the boundary set to its common ancestor
void TryReduceWithCommonAncestor(StableHashSet<HloInstruction*>& replicated_set,
StableHashSet<HloInstruction*>& boundary_set,
StableHashSet<HloInstruction*>& consumer_set,
const AliasMap& alias_map) {
if (boundary_set.size() != 2) {
return;
}
HloInstruction* ancestor = nullptr;
StableHashSet<HloInstruction*> path;
for (HloInstruction* node : boundary_set) {
HloInstruction* cur = node;
while (cur->operand_count() == 1) {
HloInstruction* operand =
PassThroughCustomCallMarkerOperand(cur->mutable_operand(0), cur);
if (replicated_set.contains(operand)) {
path.insert(cur);
}
cur = operand;
}
if (ancestor == nullptr) {
ancestor = cur;
} else {
if (ancestor != cur) {
// The nodes in boundary set do not have a common ancestor.
// This reduction fails.
return;
}
}
}
if (ancestor == nullptr) {
return;
}
// Find a common ancestor, reduce the boundary set
boundary_set.clear();
boundary_set.insert(ancestor);
for (auto x : path) {
replicated_set.erase(x);
}
consumer_set.insert(ancestor);
}
void UseAllReduceForGradAcc(StableHashSet<HloInstruction*>& replicated_set,
const HloInstruction* inst) {
if (inst->users().size() != 1) {
return;
}
// Find the add instruction for grad accumulation, skip the identity marker
// for remat and other elementwise ops.
const HloInstruction* add =
PassThroughCustomCallMarkerUser(inst->users().front(), inst);
if (add->opcode() == HloOpcode::kGetTupleElement ||
add->opcode() == HloOpcode::kTranspose) {
if (add->users().size() != 1) {
return;
}
add = add->users().front();
}
if (add->opcode() == HloOpcode::kAdd) {
// Skip multiple adds introduced by AllReduceReassociate.
while (add->users().size() == 1 &&
add->users().front()->opcode() == HloOpcode::kAdd) {
add = add->users().front();
}
CHECK_EQ(add->users().size(), 1);
// Skip the end marker of backward computation
add = PassThroughCustomCallMarkerUser(add->users().front(), add);
// Do not partition the dot, add and parameter, so we can generate
// all-reduce for grad accumulation.
std::function<void(const HloInstruction*)> dfs_remove;
dfs_remove = [&](const HloInstruction* cur) {
if (!replicated_set.contains(cur)) {
return;
}
replicated_set.erase(cur);
for (auto x : cur->operands()) {
dfs_remove(PassThroughCustomCallMarkerOperand(x, cur));
}
};
dfs_remove(add);
}
}
// Substitute all-reduce strategies with their reduce-scatter variants.
void GenerateReduceScatter(const HloInstructionSequence& sequence,
const AliasMap& alias_map,
const InstructionDepthMap& depth_map,
const StrategyMap& strategy_map,
const CostGraph& cost_graph,
absl::Span<const int64_t> s_val,
const ClusterEnvironment& cluster_env,
const AutoShardingSolverOption& solver_option) {
const std::vector<HloInstruction*>& instructions = sequence.instructions();
// Propagation ends at output
const HloInstruction* output = instructions.back();
if (IsCustomCallMarker(output)) {
output = output->operand(0);
}
// A debug option: whether to do all-gather after backward pass.
// This controls the location of all-gather.
// If true, all-gather happens after backward pass, which is desired for
// gradient accumulation. If false, all-gather happens before forward pass,
// which can partitions more tensors.
bool do_all_gather_after_backward = true;
// If true, do not actually generate reduce-scatter + all-gather,
// but generate all-reduce + all-gather instead.
// This saves less memory but is more friendly to gradient accumulation.
// This is a temporary workaround due to implementation difficulty.
// Ideally, we should be able to generate a gradient-accumulation-friendly
// reduce-scatter + all-gather, but for now it is not easy to implement this
// in our current system. So we generate a gradient-accumulation-friendly
// all-reduce + all-gather, which has the same memory consumption but with 50%
// communication overhead.
bool use_all_reduce_for_grad_acc =
solver_option.reduce_scatter_grad_acc_friendly;
std::vector<HloInstruction*> insert_all_gather;
StableHashSet<const HloInstruction*> modified;
for (HloInstruction* inst : instructions) {
if (!HasReduceScatterOpportunity(inst, strategy_map, cost_graph, s_val,
modified)) {
continue;
}
const ShardingStrategy& strategy =
GetShardingStrategy(inst, strategy_map, cost_graph, s_val);
if (!absl::StrContains(strategy.name, "allreduce")) {
continue;
}
StableHashSet<HloInstruction*> replicated_set;
StableHashSet<HloInstruction*> boundary_set;
StableHashSet<HloInstruction*> consumer_set;
StableHashSet<const HloInstruction*> visited;
// We allow at most one transpose in the path of replication analysis.
HloInstruction* transpose_inst = nullptr;
// Find the replicated set starting from the all-reduce instruction.
visited.insert(output);
FindReplicateSet(inst, alias_map, cost_graph, s_val, strategy_map, strategy,
output, do_all_gather_after_backward, transpose_inst,
replicated_set, boundary_set, consumer_set, visited);
// Try to reduce the boundary set to its common ancestor
TryReduceWithCommonAncestor(replicated_set, boundary_set, consumer_set,
alias_map);
// Analyze the instructions after which all-gather should be inserted.
std::vector<HloInstruction*> need_all_gather;
for (HloInstruction* node : boundary_set) {
if (consumer_set.contains(node)) {
if (AllUsersAreReduce(node)) {
// If users are reduce, the all-gather cost after this instruction
// should be small, so we ignore all-gather cost of these
// instructions.
replicated_set.insert(node);
} else {
need_all_gather.push_back(node);
}
}
}
// If we do all-gather on some parameters, move this all-gather after
// backward.
if (do_all_gather_after_backward && need_all_gather.size() == 1) {
HloInstruction* point = need_all_gather.front();
std::vector<HloInstruction*> path;
HloInstruction* root = point;
while (true) {
path.push_back(root);
if (root->opcode() == HloOpcode::kGetTupleElement) {
root = PassThroughCustomCallMarkerOperand(root->mutable_operand(0),
root);
} else {
break;
}
}
if (root->opcode() == HloOpcode::kParameter) {
for (auto x : path) {
replicated_set.erase(x);
boundary_set.erase(x);
}
need_all_gather.clear();
for (auto x : replicated_set) {
auto iter = alias_map.find(x);
if (iter != alias_map.end() && iter->second == root) {
boundary_set.insert(x);
need_all_gather.push_back(x);
break;
}
}
}
}
// Analyze how many parameters can be partitioned if we do this
// transformation.
int num_replicated_parameters = 0;
for (const HloInstruction* node : replicated_set) {
if (node->opcode() == HloOpcode::kParameter) {
num_replicated_parameters++;
}
}
for (const HloInstruction* to_split : need_all_gather) {
if (to_split->users().size() == 1 &&
to_split->users().front() == output && alias_map.contains(to_split)) {
// Move the all-gather to its alias parameter.
num_replicated_parameters++;
}
}
// Print replicated set and boundary set for debugging.
VLOG(10) << inst->ToString(HloPrintOptions::ShortParsable()) << "\n";
VLOG(10) << "replicated set (#parameter: " << num_replicated_parameters
<< "):\n";
for (auto x : replicated_set) {
VLOG(10) << " " << x->ToString(HloPrintOptions::ShortParsable()) << "\n";
}
VLOG(10) << "boundary set (#incompatible: " << need_all_gather.size()
<< "):\n";
for (auto x : boundary_set) {
VLOG(10) << " " << x->ToString(HloPrintOptions::ShortParsable()) << " "
<< absl::c_linear_search(need_all_gather, x) << "\n";
}
// If applicable, replace all-reduce with reduce-scatter by
// setting instructions' sharding.
if (num_replicated_parameters >= 1 && need_all_gather.size() <= 1 &&
replicated_set.size() >= 5) {
HloSharding output_spec =
GetReduceScatterOutput(inst, strategy, cluster_env);
if (IsUndefined(output_spec)) {
continue;
}
VLOG(10) << "SET: " << output_spec.ToString();
if (absl::StartsWith(strategy.name, "RR = RS x SR")) {
// If set the sharding for this dot instruction, the SPMD
// partitioner will generate bad fallback code.
replicated_set.erase(inst);
}
if (use_all_reduce_for_grad_acc) {
UseAllReduceForGradAcc(replicated_set, inst);
}
for (HloInstruction* to_split : replicated_set) {
SetSharding(to_split, output_spec, inst, transpose_inst, modified);
}
if (!solver_option.reduce_scatter_aggressive_partition) {
// The normal case
for (HloInstruction* to_split : need_all_gather) {
SetSharding(to_split, output_spec, inst, transpose_inst, modified);
if (!do_all_gather_after_backward && to_split->users().size() == 1 &&
to_split->users().front() == output &&
alias_map.contains(to_split)) {
// Move the all-gather to its alias parameter.
// This partitions more tensors but introduces communication
// in the forward pass, which is not desired in gradient
// accumulation.
SetSharding(alias_map.at(to_split), output_spec, inst,
transpose_inst, modified);
insert_all_gather.push_back(alias_map.at(to_split));
} else {
insert_all_gather.push_back(to_split);
if (to_split->opcode() == HloOpcode::kGetTupleElement &&
IsCustomCallMarker(to_split->operand(0)) &&
to_split->users().size() == 1 &&
to_split->users().front() == output) {
insert_all_gather.push_back(PassThroughCustomCallMarkerOperand(
to_split->mutable_operand(0), to_split));
}
}
}
} else {
// Aggressively partition more parameter tensors.
// This can result in a strategy similar to ZeRO stage 3.
// NOTE: The combination of this branch with pipeline parallel is not
// tested.
for (HloInstruction* to_split : need_all_gather) {
SetSharding(to_split, output_spec, inst, transpose_inst, modified);
if (to_split->users().size() == 1 &&
to_split->users().front() == output &&
alias_map.contains(to_split)) {
// Move the all-gather to its alias parameter.
HloInstruction* param = alias_map.at(to_split);
// Find the branching point (i.e., skip elementwise ops like
// convert)
HloInstruction* cur = param;
while (cur->users().size() == 1) {
// TODO(zhuohan): handle tuple.
CHECK(cur->shape().IsArray());
SetSharding(cur, output_spec, inst, transpose_inst, modified);
cur = cur->users().front();
}
SetSharding(cur, output_spec, inst, transpose_inst, modified);
CHECK(!cur->users().empty());
// Find the first user
HloInstruction* first_user = nullptr;
int64_t min_depth = ((int64_t)1) << 50;
for (const auto& x : cur->users()) {
auto iter = depth_map.find(x);
if (iter == depth_map.end()) {
LOG(FATAL) << "ERROR: " << x->ToString();
}
if (x->opcode() != HloOpcode::kConvolution &&
x->opcode() != HloOpcode::kDot) {
// Only apply this aggressive optimization for dot and conv
continue;
}
if (iter->second < min_depth) {
first_user = x;
min_depth = iter->second;
}
}
if (first_user != nullptr) {
// Insert an identity to prevent CSE of all-gather
HloInstruction* identity = inst->parent()->AddInstruction(
HloInstruction::CreateCustomCall(cur->shape(), {cur},
kIdentityMarker));
SetSharding(identity, output_spec, inst, transpose_inst,
modified);
ReplaceOperand(first_user, cur, identity);
}
}
}
}
}
VLOG(10) << "-----------------------done\n";
}
// Insert all-gather on the output of boundary nodes by setting
// their shardings. This also works as CSE of all-gather.
for (HloInstruction* inst : insert_all_gather) {
HloInstruction* replace_with = inst->parent()->AddInstruction(
HloInstruction::CreateReshape(inst->shape(), inst));
replace_with->set_sharding(
GetShardingStrategy(inst, strategy_map, cost_graph, s_val)
.output_sharding);
TF_CHECK_OK(inst->ReplaceAllUsesWith(replace_with));
}
}
void RemoveCustomCallMarker(HloModule* module) {
HloComputation* entry_computation = module->entry_computation();
std::vector<HloInstruction*> get_tuple_ins;
std::vector<HloInstruction*> marker_ins;
for (HloInstruction* ins : entry_computation->instructions()) {
if (ins->opcode() == HloOpcode::kGetTupleElement &&
IsCustomCallMarker(ins->operand(0))) {
get_tuple_ins.push_back(ins);
marker_ins.push_back(ins->mutable_operand(0));
}
}
for (HloInstruction* raw_ins : get_tuple_ins) {
HloInstruction* ins = raw_ins;
while (ins->opcode() == HloOpcode::kGetTupleElement) {
HloInstruction* custom_call = ins->mutable_operand(0);
CHECK(IsCustomCallMarker(custom_call));
HloInstruction* tuple = custom_call->mutable_operand(0);
ins = tuple->mutable_operand(ins->tuple_index());
}
TF_CHECK_OK(raw_ins->ReplaceAllUsesWith(ins));
}
for (HloInstruction* ins : get_tuple_ins) {
TF_CHECK_OK(entry_computation->RemoveInstruction(ins));
}
StableHashSet<const HloInstruction*> removed;
for (HloInstruction* ins : marker_ins) {
if (!removed.contains(ins)) {
HloInstruction* tmp = ins->mutable_operand(0);
TF_CHECK_OK(entry_computation->RemoveInstruction(ins));
TF_CHECK_OK(entry_computation->RemoveInstruction(tmp));
removed.insert(ins);
}
}
}
// Gets values in |array| along |dim| while keeping indices at other
// dimensions at 0, e.g., array is 2D and dim = 1, this returns array[0, 1],
// array[1, 1], array [2, 1], ....
// Returns error status if dim >= array.num_dimensions().
StatusOr<std::vector<int64_t>> GetValuesAlongOneDim(const Array<int64_t>& array,
int dim) {
if (dim >= array.num_dimensions()) {
return tensorflow::errors::OutOfRange(absl::StrCat(
"Input dim (", dim,
") should be smaller than the number of dimensions of array (",
array.num_dimensions(), ")."));
}
std::vector<int64_t> ret;
std::vector<int64_t> indices(array.num_dimensions(), 0);
for (int i = 0; i < array.dim(dim); ++i) {
indices[dim] = i;
ret.push_back(array(indices));
}
return ret;
}
// Check whether a sequence is an arithmetic sequence.
StatusOr<int64_t> CheckArithmeticSequence(absl::Span<const int64_t> sequence) {
if (sequence.size() < 2) {
return tensorflow::errors::OutOfRange(
"Invalid device id assignment: sequence.size() < 2");
}
int64_t delta = sequence[1] - sequence[0];
for (int i = 2; i < sequence.size(); ++i) {
if (sequence[i] - sequence[i - 1] != delta) {
return tensorflow::errors::OutOfRange(
"Invalid device id assignment: sequence[i] - sequence[i - 1] != "
"delta");
}
}
return delta;
}
bool IsValidTileAssignment(const HloSharding& spec) {
if (IsUndefined(spec)) {
return false;
}
if (spec.IsReplicated()) {
return true;
}
// Check all tile dims
const Array<int64_t>& tile_assignment = spec.tile_assignment();
for (int i = 0; i < tile_assignment.num_dimensions(); i++) {
if (tile_assignment.dim(i) != 1) {
std::vector<int64_t> device_ids =
GetValuesAlongOneDim(tile_assignment, i).value();
auto status_or_delta = CheckArithmeticSequence(device_ids);
if (!status_or_delta.ok()) {
return false;
}
}
}
return true;
}
int64_t NumTileDimensions(const HloSharding& spec) {
if (spec.IsReplicated()) {
return -1;
}
int64_t num_tile_dims = 0;
for (int i = 0; i < spec.tile_assignment().num_dimensions(); i++) {
if (spec.tile_assignment().dim(i) != 1) {
num_tile_dims++;
}
}
return num_tile_dims;
}
bool TileAssignmentMatchesMesh(const HloSharding& spec,
const Array<int64_t>& mesh) {
int sharded_dims = 0;
for (int i = 0; i < spec.tile_assignment().num_dimensions(); ++i) {
if (spec.tile_assignment().dim(i) > 1) {
sharded_dims++;
}
}
for (int i = 0; i < mesh.num_dimensions(); ++i) {
if (mesh.dim(i) > 1) {
sharded_dims--;
}
}
return sharded_dims <= 0;
}
std::vector<int64_t> GetTensorDimToMeshDim(const int64_t tensor_shape_rank,
const HloSharding& spec,
const Array<int64_t>& device_mesh) {
if (spec.IsReplicated()) {
return std::vector<int64_t>(tensor_shape_rank, -1);
}
// Check the compatibility of tensor_shape_rank and spec
CHECK_EQ(tensor_shape_rank, spec.TiledDataRank());
Array<int64_t> mesh = device_mesh;
// Permute the dimensions (or axes in numpy term), find the transform that
// makes tile_assignment == device_mesh.
std::vector<int64_t> axes(mesh.num_dimensions());
absl::c_iota(axes, 0);
bool found = false;
do {
auto transposed_mesh = Transpose(mesh, axes);
if (std::equal(transposed_mesh.begin(), transposed_mesh.end(),
spec.tile_assignment().begin())) {
found = true;
break;
}
} while (absl::c_next_permutation(axes));
if (!found) {
LOG(FATAL) << "Could not find mapping for " << spec.ToString()
<< " with device mesh " << device_mesh.ToString();
}
if (!TileAssignmentMatchesMesh(spec, mesh)) {
LOG(FATAL) << "Device mesh and tile assignment need to have the same "
"number of sharded dims.";
}
// Transform tile_assignment_dimensions using found transformation (axes).
std::vector<int64_t> tensor_dim_to_device_dim(tensor_shape_rank, -1);
int mesh_index = 0;
for (int i = 0; i < tensor_shape_rank; ++i) {
if (spec.tile_assignment().dim(i) != 1) {
while (mesh.dim(axes[mesh_index]) == 1) {
mesh_index++;
}
tensor_dim_to_device_dim[i] = axes[mesh_index];
mesh_index++;
}
}
return tensor_dim_to_device_dim;
}
void FixMixedMeshShapeResharding(HloInstruction* inst, int operand_num,
const HloSharding& dst_sharding,
const Array<int64_t>& device_mesh,
ReshardingCache* resharding_cache) {
HloInstruction* operand = inst->mutable_operand(operand_num);
if (operand->sharding() == dst_sharding) {
return;
}
const HloSharding& src_sharding = operand->sharding();
const Shape& shape = operand->shape();
int64_t src_n_dim = NumTileDimensions(src_sharding);
int64_t dst_n_dim = NumTileDimensions(dst_sharding);
HloInstruction* replace_with = nullptr;
// Query cache first
std::vector<std::pair<HloSharding, HloInstruction*>>* cache_vector = nullptr;
if (resharding_cache != nullptr) {
cache_vector = &((*resharding_cache)[operand]);
for (auto& entry : *cache_vector) {
if (entry.first == dst_sharding) {
replace_with = entry.second;
}
}
}
if (replace_with != nullptr) {
// Do nothing
} else if (src_n_dim != dst_n_dim && src_n_dim != -1 && dst_n_dim != -1) {
const HloSharding* sharding_1d;
if (src_n_dim == 1) {
sharding_1d = &src_sharding;
} else {
sharding_1d = &dst_sharding;
}
// Find an intermediate shape
std::vector<int64_t> inter_shape_dims;
for (size_t i = 0; i < shape.rank(); ++i) {
if (sharding_1d->tile_assignment().dim(i) == 1) {
inter_shape_dims.push_back(shape.dimensions(i));
} else {
CHECK(shape.dimensions(i) % device_mesh.dim(0) == 0)
<< "Only support even partition";
inter_shape_dims.push_back(device_mesh.dim(0));
inter_shape_dims.push_back(shape.dimensions(i) / device_mesh.dim(0));
}
}
Shape inter_shape =
ShapeUtil::MakeShape(shape.element_type(), inter_shape_dims);
std::optional<HloSharding> src_inter_sharding =
hlo_sharding_util::ReshapeSharding(shape, inter_shape, src_sharding);
std::optional<HloSharding> dst_inter_sharding =
hlo_sharding_util::ReshapeSharding(shape, inter_shape, dst_sharding);
if (!src_inter_sharding.has_value() || !dst_inter_sharding.has_value()) {
src_inter_sharding = HloSharding::Replicate();
dst_inter_sharding = HloSharding::Replicate();
LOG(WARNING) << "Invalid mixed mesh shape resharding.";
}
HloInstruction* src_inter = inst->parent()->AddInstruction(
HloInstruction::CreateReshape(inter_shape, operand));
src_inter->set_sharding(*src_inter_sharding);
HloInstruction* dst_inter = inst->parent()->AddInstruction(
HloInstruction::CreateReshape(inter_shape, src_inter));
dst_inter->set_sharding(*dst_inter_sharding);
replace_with = inst->parent()->AddInstruction(
HloInstruction::CreateReshape(shape, dst_inter));
replace_with->set_sharding(dst_sharding);
if (cache_vector != nullptr) {
cache_vector->push_back({dst_sharding, replace_with});
}
} else {
replace_with = inst->parent()->AddInstruction(
HloInstruction::CreateReshape(operand->shape(), operand));
replace_with->set_sharding(dst_sharding);
if (cache_vector != nullptr) {
cache_vector->push_back({dst_sharding, replace_with});
}
}
TF_CHECK_OK(inst->ReplaceOperandWith(operand_num, replace_with));
}
template <typename T>
inline std::vector<int> Argsort(const std::vector<T>& scores) {
std::vector<int> index;
index.reserve(scores.size());
for (size_t i = 0; i < scores.size(); ++i) {
index.push_back(i);
}
auto cmp = [&scores](int l, int r) { return scores[l] > scores[r]; };
std::sort(index.begin(), index.end(), cmp);
return index;
}
void AnnotateShardingWithSimpleHeuristic(
HloModule* module, const std::string& heuristic, const AliasMap& alias_map,
const ClusterEnvironment& cluster_env) {
const Array<int64_t>& device_mesh = cluster_env.device_mesh_;
const Array<int64_t>& device_mesh_1d = cluster_env.device_mesh_1d_;
int64_t num_devices = device_mesh.num_elements();
// Count the non-one mesh dimension.
size_t mesh_nn_dims = 0;
for (int dim : device_mesh.dimensions()) {
if (dim > 1) {
mesh_nn_dims++;
}
}
// Shard instructions
HloComputation* entry_computation = module->entry_computation();
for (HloInstruction* inst : entry_computation->instructions()) {
if (inst->opcode() == HloOpcode::kParameter) {
HloSharding output_spec = HloSharding::Replicate();
inst->set_sharding(output_spec);
if (heuristic == "shard-largest") {
std::vector<int64_t> lengths;
for (int64_t i = 0; i < inst->shape().rank(); ++i) {
lengths.push_back(inst->shape().dimensions(i));
}
std::vector<int> indices = Argsort(lengths);
int common_dims = std::min(mesh_nn_dims, indices.size());
if (common_dims < 1) {
continue;
}
if (common_dims == 1) {
int dim = indices[0];
int length = lengths[dim];
if (length % num_devices == 0) {
output_spec = Tile(inst->shape(), {dim}, {0}, device_mesh_1d);
}
} else {
int dim1 = indices[0];
int length1 = lengths[dim1];
int dim0 = indices[1];
int length0 = lengths[dim0];
if (length0 % device_mesh.dim(0) == 0 &&
length1 % device_mesh.dim(1) == 0) {
output_spec =
Tile(inst->shape(), {dim0, dim1}, {0, 1}, device_mesh);
}
}
} else if (heuristic == "shard-first") {
if (inst->shape().rank() > 0 &&
inst->shape().dimensions(0) % num_devices == 0) {
output_spec = Tile(inst->shape(), {0}, {0}, device_mesh_1d);
}
} else if (heuristic == "shard-last") {
int64_t last_dim = inst->shape().rank() - 1;
if (inst->shape().rank() > 0 &&
inst->shape().dimensions(last_dim) % num_devices == 0) {
output_spec = Tile(inst->shape(), {last_dim}, {0}, device_mesh_1d);
}
} else {
LOG(FATAL) << "Invalid heuristic: " << heuristic;
}
inst->set_sharding(output_spec);
// std::cerr << "ins: " << inst->ToString() << ", spec: " <<
// output_spec.ToString() << std::endl;
} else if (inst->opcode() == HloOpcode::kDot) {
const HloInstruction* lhs = inst->operand(0);
const HloInstruction* rhs = inst->operand(1);
const DotDimensionNumbers& dot_dnums = inst->dot_dimension_numbers();
// const auto& lhs_con_dims = dot_dnums.lhs_contracting_dimensions();
// const auto& rhs_con_dims = dot_dnums.rhs_contracting_dimensions();
std::vector<int64_t> lhs_space_dims, rhs_space_dims;
std::tie(lhs_space_dims, rhs_space_dims) =
GetSpaceDims(lhs->shape(), rhs->shape(), dot_dnums);
}
}
// Meet the alias requirement for the output tuple.
HloInstruction* output = entry_computation->root_instruction();
const Shape& out_shape = output->shape();
ShapeTree<HloSharding> tuple_sharding(out_shape, HloSharding::Replicate());
std::vector<HloSharding> flattened_shardings;
std::function<void(HloInstruction*)> get_flattened_shardings;
get_flattened_shardings = [&](HloInstruction* cur) {
for (int64_t i = 0; i < cur->operand_count(); ++i) {
HloInstruction* operand = cur->mutable_operand(i);
if (operand->shape().IsTuple()) {
get_flattened_shardings(operand);
} else {
if (alias_map.contains(operand)) {
operand = alias_map.at(operand);
}
if (!operand->has_sharding()) {
operand->set_sharding(HloSharding::Replicate());
}
CHECK(operand->has_sharding());
flattened_shardings.push_back(operand->sharding());
}
}
};
get_flattened_shardings(output);
int i = 0;
for (auto& leaf : tuple_sharding.leaves()) {
leaf.second = flattened_shardings[i++];
}
CHECK_EQ(i, flattened_shardings.size());
output->set_sharding(HloSharding::Tuple(tuple_sharding));
}
std::vector<int64_t> GetDimensionMapping(
const absl::Span<const int64_t> reduced_dimensions,
const int64_t op_count) {
std::vector<int64_t> mapping;
mapping.reserve(op_count);
int64_t dim_to_counter = 0;
for (int64_t op_dim = 0; op_dim < op_count; ++op_dim) {
if (absl::c_find(reduced_dimensions, op_dim) != reduced_dimensions.end()) {
// If op_dim is in reduce_dimensions, it means this op_dim is reduced
// (gone) in output dimensions.
mapping.push_back(-1);
} else {
// Otherwise create the mapping in order.
mapping.push_back(dim_to_counter);
dim_to_counter += 1;
}
}
return mapping;
}
bool IsDivisible(int64_t denominator, int64_t numerator) {
return (denominator % numerator == 0);
}
std::vector<std::vector<int64_t>> GetReplicaGroupsAlongOneDimension(
const Array<int64_t>& device_mesh, int32_t communication_dim) {
CHECK_LT(communication_dim, device_mesh.num_dimensions());
std::vector<int64_t> indices(device_mesh.num_dimensions(), 0);
std::vector<std::vector<int64_t>> replica_groups;
device_mesh.Each([&](absl::Span<const int64_t> indices, int64_t device) {
std::vector<int64_t> group;
group.reserve(device_mesh.dim(communication_dim));
if (indices[communication_dim] != 0) {
return;
}
for (size_t i = 0; i < device_mesh.dim(communication_dim); ++i) {
std::vector<int64_t> mutable_indices(indices.begin(), indices.end());
mutable_indices[communication_dim] = i;
group.push_back(device_mesh(mutable_indices));
}
replica_groups.push_back(std::move(group));
});
return replica_groups;
}
// Create a HloSharding that tiles some tensor dims on some device mesh dims.
HloSharding Tile(const Shape& tensor_shape,
absl::Span<const int64_t> tensor_dims,
absl::Span<const int64_t> mesh_dims,
const Array<int64_t>& device_mesh) {
CHECK_EQ(tensor_dims.size(), mesh_dims.size());
CHECK(tensor_shape.IsArray());
std::vector<int64_t> tile_assignment_dimensions(tensor_shape.rank(), 1);
// Split on certain mesh dimensions
int64_t split_prod = 1;
for (size_t i = 0; i < tensor_dims.size(); ++i) {
tile_assignment_dimensions[tensor_dims[i]] = device_mesh.dim(mesh_dims[i]);
split_prod *= device_mesh.dim(mesh_dims[i]);
}
// Replicate on remaining mesh dimensions
bool replicate_on_last_tile_dim = false;
if (split_prod < device_mesh.num_elements()) {
tile_assignment_dimensions.push_back(device_mesh.num_elements() /
split_prod);
replicate_on_last_tile_dim = true;
}
// Map device ids from device_mesh to tile_assignment_devices
std::vector<int64_t> tile_assignment_devices;
tile_assignment_devices.reserve(device_mesh.num_elements());
std::vector<int64_t> tmp_indices(device_mesh.num_dimensions(), 0);
std::function<void(int64_t, std::vector<int64_t>)>
generate_tile_assignment_devices;
generate_tile_assignment_devices = [&](int64_t tensor_dim,
std::vector<int64_t> mesh_indices) {
if (tensor_dim == tensor_shape.rank() - 1) {
AppendFlattenElements(&tile_assignment_devices, device_mesh, mesh_indices,
-1, tmp_indices);
} else {
int64_t next_tensor_dim = tensor_dim + 1;
int64_t next_mesh_dim = -1;
int64_t index = GetIndex(tensor_dims, next_tensor_dim);
if (index >= 0) {
next_mesh_dim = mesh_dims[index];
}
for (int64_t i = 0; i < tile_assignment_dimensions[next_tensor_dim];
++i) {
if (next_mesh_dim != -1) {
mesh_indices[next_mesh_dim] = i;
}
generate_tile_assignment_devices(next_tensor_dim, mesh_indices);
}
}
};
std::vector<int64_t> mesh_indices(device_mesh.num_dimensions(), -1);
generate_tile_assignment_devices(-1, mesh_indices);
// Make HloSharding
Array<int64_t> tile_assignment(tile_assignment_dimensions);
VLOG(9) << "shape: " << tensor_shape.ToString();
VLOG(9) << "tensor dims: " << ToString(tensor_dims);
VLOG(9) << "mesh dims: " << ToString(mesh_dims);
VLOG(9) << "tile_assignment: " << ToString(tile_assignment.dimensions());
tile_assignment.SetValues(tile_assignment_devices);
return replicate_on_last_tile_dim
? HloSharding::PartialTile(std::move(tile_assignment))
: HloSharding::Tile(std::move(tile_assignment));
}
AliasMap BuildAliasMap(const HloModule* module) {
AliasMap alias_map;
const HloInputOutputAliasConfig& alias_config =
module->input_output_alias_config();
HloComputation* entry = module->entry_computation();
const std::vector<HloInstruction*>& parameter_instructions =
entry->parameter_instructions();
const HloInstruction* output_tuple = entry->root_instruction();
if (IsCustomCallMarker(output_tuple)) {
output_tuple = output_tuple->operand(0);
}
alias_config.ForEachAlias([&](const ShapeIndex& output_index,
const HloInputOutputAliasConfig::Alias& alias) {
CHECK_LT(alias.parameter_index.size(), 2)
<< "Do not support alias parameter index that is larger than 1D: "
<< alias.ToString();
CHECK_EQ(output_index.size(), 1)
<< "Do not support alias with output_index that is larger than 1D: "
<< output_index.ToString();
const HloInstruction* dst_ins = output_tuple->operand(output_index.front());
HloInstruction* src_ins;
if (alias.parameter_index.empty()) {
src_ins = parameter_instructions[alias.parameter_number];
} else {
// alias.parameter_index.size() == 1 per the CHECK_LT statement.
src_ins = parameter_instructions[alias.parameter_number]->users().at(
alias.parameter_index.front());
}
alias_map[dst_ins] = src_ins;
});
return alias_map;
}
AliasSet BuildAliasSet(const HloModule* module,
const StrategyMap& strategy_map) {
// Adjust the edge cost for aliases (donated buffer).
// Typically, old weights and new weights are aliases, so we should
// let them have the same sharding spec.
const HloInputOutputAliasConfig& alias_config =
module->input_output_alias_config();
HloComputation* entry = module->entry_computation();
const std::vector<HloInstruction*>& parameter_instructions =
entry->parameter_instructions();
const HloInstruction* output_tuple = entry->root_instruction();
AliasSet alias_set;
std::function<void(const StrategyVector*, const StrategyVector*)>
traverse_tuple_alias;
traverse_tuple_alias = [&](const StrategyVector* src_strategies,
const StrategyVector* dst_strategies) {
if (src_strategies->is_tuple) {
CHECK(dst_strategies->is_tuple);
CHECK_EQ(src_strategies->childs.size(), dst_strategies->childs.size());
for (size_t i = 0; i < src_strategies->childs.size(); ++i) {
traverse_tuple_alias(src_strategies->childs[i].get(),
dst_strategies->childs[i].get());
}
} else {
alias_set.insert(std::make_pair(src_strategies->id, dst_strategies->id));
}
};
alias_config.ForEachAlias([&](const ShapeIndex& output_index,
const HloInputOutputAliasConfig::Alias& alias) {
CHECK_LT(alias.parameter_index.size(), 2)
<< "Do not support alias parameter index that is larger than 1D: "
<< alias.ToString();
CHECK_EQ(output_index.size(), 1)
<< "Do not support alias with output_index that is larger than 1D: "
<< output_index.ToString();
HloInstruction* param_ins = parameter_instructions[alias.parameter_number];
if (alias.parameter_index.empty()) {
traverse_tuple_alias(
strategy_map.at(param_ins).get(),
strategy_map.at(output_tuple)->childs[output_index.front()].get());
} else {
// parameter_instructions[alias.parameter_number] is a tuple.
// alias.parameter_index.size() == 1 per the CHECK_LT statement.
traverse_tuple_alias(
strategy_map.at(param_ins)
->childs[alias.parameter_index.front()]
.get(),
strategy_map.at(output_tuple)->childs[output_index.front()].get());
}
});
// Uses the same sharding spec for while loop related instructions.
for (const HloComputation* computation : module->computations()) {
for (const HloInstruction* instruction : computation->instructions()) {
if (instruction->opcode() == HloOpcode::kWhile) {
traverse_tuple_alias(
strategy_map.at(instruction).get(),
strategy_map.at(instruction->while_body()->root_instruction())
.get());
traverse_tuple_alias(
strategy_map.at(instruction).get(),
strategy_map.at(instruction->while_body()->parameter_instruction(0))
.get());
traverse_tuple_alias(
strategy_map.at(instruction).get(),
strategy_map
.at(instruction->while_condition()->parameter_instruction(0))
.get());
}
}
}
return alias_set;
}
void CheckAliasSetCompatibility(const AliasSet& alias_set,
const LeafStrategies& leaf_strategies,
const HloInstructionSequence& sequence) {
const std::vector<HloInstruction*>& instructions = sequence.instructions();
// Checks the compatibility
for (const auto& pair : alias_set) {
const StrategyVector* src_strategies = leaf_strategies[pair.first];
const StrategyVector* dst_strategies = leaf_strategies[pair.second];
size_t compatible_cnt = 0;
bool replicated = false;
for (size_t i = 0; i < src_strategies->leaf_vector.size(); ++i) {
for (size_t j = 0; j < dst_strategies->leaf_vector.size(); ++j) {
if (src_strategies->leaf_vector[i].output_sharding ==
dst_strategies->leaf_vector[j].output_sharding) {
compatible_cnt += 1;
if (src_strategies->leaf_vector[i].output_sharding.IsReplicated()) {
replicated = true;
}
}
}
}
if (compatible_cnt == 1 &&
(replicated && (src_strategies->leaf_vector.size() > 1 ||
dst_strategies->leaf_vector.size() > 1))) {
LOG(WARNING) << "Alias pair has only replicated strategy in common. This "
"will result in choosing replicated strategy for these "
"tensors and may result in large memory consumption: "
<< "("
<< instructions.at(src_strategies->instruction_id)->name()
<< ", "
<< instructions.at(dst_strategies->instruction_id)->name()
<< ")"
<< "\n"
<< "(" << src_strategies->id << ", " << dst_strategies->id
<< ")\n"
<< src_strategies->ToString() << "\n"
<< dst_strategies->ToString();
}
CHECK(compatible_cnt > 0)
<< "Alias pair does not have any sharding strategy in common: "
<< "(" << instructions.at(src_strategies->instruction_id)->name()
<< ", " << instructions.at(dst_strategies->instruction_id)->name()
<< ")"
<< "\n"
<< "(" << src_strategies->id << ", " << dst_strategies->id << ")\n"
<< src_strategies->ToString() << "\n"
<< dst_strategies->ToString();
}
}
size_t VectorGreaterThanOneElementCount(const std::vector<int64_t>& vector,
bool omit_last_dim) {
return VectorGreaterThanOneElementIndices(vector, omit_last_dim).size();
}
std::vector<int64_t> VectorGreaterThanOneElementIndices(
const std::vector<int64_t>& vector, bool omit_last_dim) {
std::vector<int64_t> result;
for (size_t i = 0; i < vector.size(); i++) {
if (i == vector.size() - 1 && omit_last_dim) {
continue;
}
if (vector.at(i) > 1) {
result.push_back(i);
}
}
return result;
}
int64_t GetInstructionSize(const Shape& shape) {
if (shape.IsTuple()) {
int64_t size = 0;
for (const Shape& subshape : shape.tuple_shapes()) {
size += GetInstructionSize(subshape);
}
return size;
}
return GetBytes(shape);
}
int64_t GetShardedInstructionSize(const Shape& shape, int64_t num_devices,
std::optional<HloSharding> sharding) {
if (shape.IsTuple()) {
int64_t size = 0;
for (size_t i = 0; i < shape.tuple_shapes_size(); i++) {
Shape subshape = shape.tuple_shapes().at(i);
size += GetShardedInstructionSize(
subshape,
sharding.has_value()
? sharding
->GetSubSharding(shape, ShapeIndex{static_cast<int64_t>(i)})
.NumTiles()
: num_devices);
}
return size;
}
bool shardable = false;
for (const auto dim : shape.dimensions()) {
if (dim >= num_devices) {
shardable = true;
break;
}
}
if (shardable) {
return GetBytes(shape) / num_devices;
}
return GetBytes(shape);
}
HloInstruction* FindInstruction(
const std::vector<HloInstruction*>& instructions, absl::string_view name) {
auto it = absl::c_find_if(
instructions, [&](HloInstruction* i) { return i->name() == name; });
if (it != instructions.end()) {
return *it;
}
return nullptr;
}
} // namespace spmd
} // namespace xla
| [
"gardener@tensorflow.org"
] | gardener@tensorflow.org |
efde61101ca0cf0498d08bd5315f9c48a6acfadc | 442db39f9bc0d1b8e2378cce0143c5d3840b62cc | /menoh/composite_backend/backend/generic/operator/mul.hpp | 986fd70c4b0d074feac8924c969764c7cfe2b846 | [
"MIT"
] | permissive | pfnet-research/menoh | 85426e685222c4727337cb8f2870e51e50b3aecc | 521633db4a4924724e96f346aca4bfd909ff2598 | refs/heads/master | 2023-08-21T22:28:02.919612 | 2021-01-02T15:39:28 | 2021-01-02T15:39:28 | 138,105,757 | 289 | 35 | MIT | 2021-01-02T15:39:29 | 2018-06-21T01:48:20 | C++ | UTF-8 | C++ | false | false | 2,056 | hpp | #ifndef MENOH_IMPL_COMPOSITE_BACKEND_BACKEND_GENERIC_OPERATOR_MUL_HPP
#define MENOH_IMPL_COMPOSITE_BACKEND_BACKEND_GENERIC_OPERATOR_MUL_HPP
#include <menoh/array.hpp>
#include <menoh/graph.hpp> // for dimension_mismatch error
#include <menoh/composite_backend/procedure.hpp>
namespace menoh_impl {
namespace composite_backend {
namespace generic_backend {
inline procedure make_mul(node const& node,
std::vector<array> const& input_list,
std::vector<array> const& output_list) {
assert(input_list.size() == 2);
assert(output_list.size() == 1);
for(auto const& input : input_list) {
if(input.dtype() != dtype_t::float_) {
throw invalid_dtype(
std::to_string(static_cast<int>(input.dtype())));
}
}
if(total_size(input_list.at(0)) !=
total_size(input_list.at(1))) {
throw dimension_mismatch(
node.op_type, node.output_name_list.front(),
"total size is invalid. broadcast is not supported yet",
std::to_string(total_size(input_list.at(0))),
std::to_string(total_size(input_list.at(1))));
}
auto procedure = [input_a = input_list.at(0),
input_b = input_list.at(1),
output = output_list.at(0)]() {
for(decltype(total_size(input_a)) i = 0;
i < total_size(input_a); ++i) {
fat(output, i) = fat(input_a, i) * fat(input_b, i);
}
};
return procedure;
}
} // namespace generic_backend
} // namespace composite_backend
} // namespace menoh_impl
#endif // MENOH_IMPL_COMPOSITE_BACKEND_BACKEND_GENERIC_OPERATOR_MUL_HPP
| [
"kokuzen@gmail.com"
] | kokuzen@gmail.com |
1876678215f9044c291ea4d758f751b4d7f7157d | 8d7e65347ab7c38c30db4f7f07b0e69073e4efc1 | /CPUEmulator/SparcV9Emulator/Instruction_SUBU.h | 8a42a2c19fe76fcf1832bf8bdf936a89b1fe6583 | [] | no_license | mjsmith707/InterpretedCPU | 34cde478b48f22e4344fe06b6117fc954a73ad63 | 624d8902ad0a47dad851015bb9a69e62b0a4d8eb | refs/heads/master | 2016-08-04T08:35:40.768809 | 2015-03-06T19:46:57 | 2015-03-06T19:46:57 | 31,784,683 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 563 | h | //
// Instruction_SUBU.h
// CPUEmulator
//
// Created by Matt Smith on 11/17/14.
// Copyright (c) 2014 Matt Smith. All rights reserved.
//
#ifndef __CPUEmulator__Instruction_SUBU__
#define __CPUEmulator__Instruction_SUBU__
#include "Instruction.h"
#include "InstructionContext.h"
class Instruction_SUBU: public Instruction {
public:
Instruction_SUBU(unsigned char, std::string, std::string);
void execute(InstructionContext*&);
std::string getName();
std::string getDescriptor();
};
#endif /* defined(__CPUEmulator__Instruction_SUBU__) */
| [
"mjsmith@sonic.net"
] | mjsmith@sonic.net |
c51390b492b8bae4f99cb88df7b3b9af0c904f03 | b5430b06bf0b59f5015e3cc7ad2d94fc045eb29f | /crawler/crawler/dedup/dom_extractor/content_collector.cc | c418216e96ce0a80808ed692d10c6464342c53ea | [] | no_license | pengdan01/spider | 9250007be3c7c422d916c370a1389ce434948442 | 67f57c26673606b2a215d6ef9e9340e027990c4c | refs/heads/master | 2021-08-24T13:35:02.645038 | 2017-12-10T01:50:59 | 2017-12-10T01:50:59 | 112,009,041 | 1 | 2 | null | null | null | null | UTF-8 | C++ | false | false | 28,646 | cc | #include "crawler/dedup/dom_extractor/content_collector.h"
#include <iostream>
#include <string>
#include <vector>
#include <stack>
#include <map>
#include "base/common/base.h"
#include "base/common/slice.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_char_iterator.h"
#include "nlp/common/nlp_util.h"
#include "base/strings/utf_string_conversions.h"
#include "web/html/api/parser.h"
#include "crawler/dedup/dom_extractor/node_extras.h"
#include "crawler/dedup/dom_extractor/node_cluster.h"
DEFINE_int32(max_node_num, 50000, "the maximum number of nodes");
DEFINE_int32(max_depth, 1000, "maximum depth of the tree");
DEFINE_int32(max_node_cluster_num_, 5000, "the maximum number of node clusters");
DEFINE_int32(indent, 20, "dump indent");
DEFINE_double(body_ratio_thresh, 0.5, "body ratio thresh");
namespace dom_extractor {
ContentCollector::ContentCollector() {
max_node_num_ = FLAGS_max_node_num;
max_depth_ = FLAGS_max_depth;
max_node_cluster_num_ = FLAGS_max_node_cluster_num_;
node_num_ = 0;
depth_ = 0;
node_cluster_num_ = 0;
node_extras_ = new NodeExtras[max_node_num_];
node_clusters_ = new NodeCluster[max_node_cluster_num_];
path_clusters_.resize(max_depth_);
body_ = NULL;
head_ = NULL;
}
ContentCollector::~ContentCollector() {
delete []node_extras_;
delete []node_clusters_;
body_ = NULL;
head_ = NULL;
}
void ContentCollector::Clear() {
node_cluster_num_ = 0;
node_num_ = 0;
depth_ = 0;
body_ = NULL;
head_ = NULL;
for (int id = 0; id < max_node_cluster_num_; ++id) {
node_clusters_[id].Clear();
}
for (int id = 0; id < max_node_num_; ++id) {
node_extras_[id].Clear();
}
for (int id = 0; id < max_depth_; ++id) {
path_clusters_[id].clear();
}
}
bool ContentCollector::ExtractMainContent(
const std::string &page_utf8,
const std::string &url,
std::string *title,
std::string *content) {
// LOG(ERROR) << "begin maincontent";
Clear();
title->clear();
content->clear();
// LOG(ERROR) << "Clear ok";
web::HTMLTree tree;
web::HTMLParser parser;
uint32 parse_mode = web::HTMLParser::kParseInternalCSS;
// if (parser_.ParseString(page_utf8.c_str(), parse_mode, &tree_) == web::HTMLParser::kParserFail) {
if (parser.ParseString(page_utf8.c_str(), parse_mode, &tree) != 0u) {
LOG(ERROR) << "Parse tree from string failed:\t" << url;
return false;
}
// LOG(ERROR) << "ParseString ok";
head_ = tree.head();
if (head_ == NULL) {
LOG(ERROR) << "NULL head:\t" << url;
return false;
}
std::string raw_title = tree.title_value().as_string();
// base::TrimString(raw_title, "\n\t\r ", title);
*title = raw_title;
body_ = tree.body();
if (body_ == NULL) {
LOG(ERROR) << "NULL body:\t" << url;
return false;
}
if (!SetNodeExtras(body_)) {
LOG(ERROR) << "SetNodeExtras failed for url:\t" << url;
return false;
}
if (!RemoveNontextTopDown(body_)) {
LOG(ERROR) << "RemoveNontextTopDown failed:\t" << url;
return false;
}
if (!RemoveNontextBottomUp(body_)) {
LOG(ERROR) << "Body has no text:\t" << url;
return true;
}
// DumpTree(*body_);
if (!ConstructNodeCluster(body_)) {
LOG(ERROR) << "ConstructNodeCluster failed for url:\t" << url;
return false;
}
if (!ConstructNodeClusterTree()) {
LOG(ERROR) << "ConstructNodeClusterTree failed for url:\t" << url;
return false;
}
// DumpNodeClusterTree(node_clusters_[0]);
// DumpTree(*body_);
for (int id = 0; id < node_cluster_num_; ++id) {
if (node_clusters_[id].first_child_ == NULL) {
node_clusters_[id].CalcNodePerplexity();
node_clusters_[id].CalcCharPerplexity();
}
}
RemoveByCharPerplexity();
if (!CollectNodeStatistic(body_)) {
LOG(ERROR) << "CollectNodeStatistic failed for url:\t" << url;
return false;
}
if (!UpdateBodyRatio(body_)) {
LOG(ERROR) << "UpdateBodyRatio failed for url:\t" << url;
return false;
}
for (int id = 0; id < node_cluster_num_; ++id) {
node_clusters_[id].CalcClusterFeature();
node_clusters_[id].CalcNonlinkCharBodyRatio(node_clusters_[0].nonlink_char_num);
}
// DumpNodeClusterTree(node_clusters_[0]);
is_identified = false;
if (!FindDominantNodeCluster2(node_clusters_ + 0)) {
LOG(ERROR) << "FindDominantNodeCluster failed" << url;
return false;
}
if (!CollectMainContent(*body_, content)) {
LOG(ERROR) << "CollectMainContent failed for url:\t" << url;
return false;
}
/*
if (!CollectMainContent(*(node_clusters_ + 0), content)) {
LOG(ERROR) << "CollectMainContent failed for url:\t" << url;
return false;
}
*/
/*
if (!LargestNodeClusterText(*(node_clusters_ + 0), content)) {
LOG(ERROR) << "LargestNodeClusterText failed for url:\t" << url;
return false;
}
*/
nlp::util::NormalizeLineInPlaceS(content);
return true;
}
void ContentCollector::DumpNodeClusterTree(const NodeCluster &node_cluster) {
NodeCluster *child = node_cluster.first_child_;
if (node_cluster.is_main_content && !child && node_cluster.nonlink_char_num) {
std::cout << node_cluster.path_
<< "\t" << node_cluster.is_main_content
// << "\t" << node_cluster.nonlink_char_body_ratio
<< "\t" << node_cluster.nonlink_char_num
// << "\t" << node_cluster.dom_tree_nodes_.size()
// << "\t" << node_cluster.distinct_node_num
<< "\t" << node_cluster.node_perplexity
// << "\t" << node_cluster.distinct_char_num
<< "\t" << node_cluster.char_perplexity
<< std::endl;
if (!child) {
std::cout << node_cluster.NodeClusterText();
}
}
if (child) {
while (child) {
DumpNodeClusterTree(*child);
child = child->next_sibling_;
}
}
}
void ContentCollector::DumpTree(const web::HTMLNode &node) {
const NodeExtras *p_node_extras = static_cast<const NodeExtras*>(node.extras());
if (p_node_extras->has_text
// && node.first_child() == NULL
&& p_node_extras->indent < FLAGS_indent
) {
std::cout << p_node_extras->node_id.path;
std::cout
// << "\t" << p_node_extras->nonlink_char_body_ratio
// << "\t" << p_node_extras->nonlink_char_num
// << "\t" << p_node_extras->link_char_num
// << "\t" << p_node_extras->punctuation_num
<< "\t" << p_node_extras->text;
std::cout << std::endl;
}
web::HTMLNode *child = node.first_child();
while (child) {
DumpTree(*child);
child = child->next_sibling();
}
}
bool ContentCollector::SetNodeExtras(web::HTMLNode *node) {
web::HTMLNode *parent = node->parent();
const NodeExtras *p_parent_extras = static_cast<const NodeExtras*>(parent->extras());
NodeExtras *p_node_extras = node_extras_ + node_num_;
p_node_extras->node_id.tag_type = node->TagType();
p_node_extras->node_id.tag_name = node->TagName();
p_node_extras->node_id.id_name = node->AttrValue(web::HTMLAttr::AttrType::kId);
p_node_extras->node_id.class_name = node->AttrValue(web::HTMLAttr::AttrType::kClass);
// p_node_extras->node_id.full_name = p_node_extras->node_id.tag_name;
p_node_extras->node_id.full_name = p_node_extras->node_id.tag_name
+ "_" + p_node_extras->node_id.class_name;
if (p_parent_extras == NULL) {
p_node_extras->indent = 0;
p_node_extras->node_id.path = p_node_extras->node_id.full_name;
} else {
p_node_extras->indent = p_parent_extras->indent + 1;
p_node_extras->node_id.path = p_parent_extras->node_id.path + "/" + p_node_extras->node_id.full_name;
}
if (p_node_extras->indent + 1 > depth_) {
depth_ = p_node_extras->indent + 1;
}
if (depth_ >= max_depth_) {
LOG(ERROR) << "Tree depth exceeds " << "\t" << depth_ << "\t" << max_depth_;
return false;
}
node->set_extras(static_cast<void*>(p_node_extras));
node_num_++;
if (node_num_ >= max_node_num_) {
LOG(ERROR) << "Node number exceeds " << "\t" << node_num_ << "\t" << max_node_num_;
return false;
}
web::HTMLNode *child = node->first_child();
while (child) {
if (!SetNodeExtras(child)) {
return false;
}
child = child->next_sibling();
}
return true;
}
bool ContentCollector::RemoveNontextTopDown(web::HTMLNode *node) {
web::HTMLNode *parent = node->parent();
const NodeExtras *p_parent_extras = static_cast<const NodeExtras*>(parent->extras());
NodeExtras *p_node_extras = const_cast<NodeExtras*>(static_cast<const NodeExtras*>(node->extras()));
if (p_parent_extras == NULL) {
p_node_extras->has_text = true;
} else {
if (!p_parent_extras->has_text) {
p_node_extras->has_text = false;
} else {
if (DroppableNode(*node)) {
p_node_extras->has_text = false;
} else {
p_node_extras->has_text = true;
}
}
}
web::HTMLNode *child = node->first_child();
while (child) {
if (!RemoveNontextTopDown(child)) {
return false;
}
child = child->next_sibling();
}
return true;
}
bool ContentCollector::RemoveNontextBottomUp(web::HTMLNode *node) {
NodeExtras *p_node_extras = const_cast<NodeExtras*>(static_cast<const NodeExtras*>(node->extras()));
if (!p_node_extras->has_text) {
return false;
}
web::HTMLNode *child = node->first_child();
if (child) {
bool has_valid_child = false;
while (child) {
if (RemoveNontextBottomUp(child)) {
has_valid_child = true;
}
child = child->next_sibling();
}
if (has_valid_child) {
p_node_extras->has_text = true;
} else {
p_node_extras->has_text = false;
}
} else {
if (node->TagType() == web::HTMLTag::kPureText) {
std::string text = node->value().as_string();
if (!TextStatistic(text, p_node_extras)) {
LOG(ERROR) << "TextStatistic failed:\t" << text;
return false;
}
if (p_node_extras->char_num != 0) {
p_node_extras->has_text = true;
} else {
p_node_extras->has_text = false;
}
} else {
p_node_extras->has_text = false;
}
}
return p_node_extras->has_text;
}
bool ContentCollector::CollectNodeStatistic(web::HTMLNode *node) {
NodeExtras *p_node_extras = const_cast<NodeExtras*>(static_cast<const NodeExtras*>(node->extras()));
if (p_node_extras == NULL) {
LOG(ERROR) << "NULL node extras";
return false;
}
if (node->first_child()) {
p_node_extras->SetCounterZero();
web::HTMLNode *child = node->first_child();
while (child) {
if (!CollectNodeStatistic(child)) {
return false;
}
NodeExtras *p_child_extras = const_cast<NodeExtras*>(static_cast<const NodeExtras*>(child->extras()));
CHECK_NOTNULL(p_child_extras);
if (p_child_extras->has_text) {
p_node_extras->AddChild(*p_child_extras);
}
child = child->next_sibling();
}
if (!CollectNonleafStatistic(node)) {
return false;
}
} else {
if (!CollectLeafStatistic(node)) {
return false;
}
}
return true;
}
bool ContentCollector::UpdateBodyRatio(web::HTMLNode *node) {
const NodeExtras *p_body_extras = static_cast<const NodeExtras*>(body_->extras());
NodeExtras *p_node_extras = const_cast<NodeExtras*>(static_cast<const NodeExtras*>(node->extras()));
p_node_extras->nonlink_char_body_ratio
= p_node_extras->nonlink_char_num / (p_body_extras->nonlink_char_num + 1.0);
if (node->first_child()) {
web::HTMLNode *child = node->first_child();
while (child) {
if (!UpdateBodyRatio(child)) {
return false;
}
child = child->next_sibling();
}
}
return true;
}
bool ContentCollector::ConstructNodeCluster(web::HTMLNode *node) {
const NodeExtras *p_node_extras = static_cast<const NodeExtras*>(node->extras());
if (p_node_extras->has_text) {
int indent = p_node_extras->indent;
std::map<std::string, int32>::iterator path_cluster_it
= path_clusters_[indent].find(p_node_extras->node_id.path);
if (path_cluster_it == path_clusters_[indent].end()) {
// 新发现路径
path_clusters_[indent].insert(std::make_pair(p_node_extras->node_id.path, node_cluster_num_));
node_clusters_[node_cluster_num_].dom_tree_nodes_.push_back(node);
node_clusters_[node_cluster_num_].path_ = p_node_extras->node_id.path;
node_cluster_num_++;
if (node_cluster_num_ >= max_node_cluster_num_) {
LOG(ERROR) << "node_cluster_num_ >= max_node_cluster_num_";
return false;
}
} else {
node_clusters_[path_cluster_it->second].dom_tree_nodes_.push_back(node);
}
}
web::HTMLNode *child = node->first_child();
while (child) {
NodeExtras *p_child_extras = const_cast<NodeExtras*>(static_cast<const NodeExtras*>(child->extras()));
if (p_child_extras->has_text) {
if (!ConstructNodeCluster(child)) {
return false;
}
}
child = child->next_sibling();
}
return true;
}
bool ContentCollector::ConstructNodeClusterTree() {
// id = 0 是根节点
node_clusters_[0].indent_ = 0;
for (int id = 1; id < node_cluster_num_; ++id) {
web::HTMLNode *node = node_clusters_[id].dom_tree_nodes_[0];
const NodeExtras *node_extras = static_cast<const NodeExtras*>(node->extras());
std::string node_path = node_extras->node_id.path;
int32 node_indent = node_extras->indent;
std::string parent_path = node_path.substr(0, node_path.find_last_of('/'));
std::map<std::string, int32>::iterator path_cluster_it
= path_clusters_[node_indent - 1].find(parent_path);
if (path_cluster_it == path_clusters_[node_indent - 1].end()) {
LOG(ERROR) << "Can not find parent node cluster";
return false;
}
int parent_node_cluster = path_cluster_it->second;
NodeCluster *parent = node_clusters_ + parent_node_cluster;
node_clusters_[id].parent_ = parent;
node_clusters_[id].indent_ = parent->indent_ + 1;
NodeCluster *child = parent->first_child_;
if (child == NULL) {
parent->first_child_ = node_clusters_ + id;
} else {
while (child->next_sibling_) {
child = child->next_sibling_;
}
child->next_sibling_ = node_clusters_ + id;
}
}
return true;
}
bool ContentCollector::RemoveByCharPerplexity() {
for (int id = 0; id < node_cluster_num_; ++id) {
// if (node_clusters_[id].first_child_ == NULL && node_clusters_[id].is_main_content) {
if (node_clusters_[id].first_child_ == NULL) {
if (node_clusters_[id].node_perplexity < 0.2
|| (node_clusters_[id].distinct_char_num < 50 && node_clusters_[id].char_perplexity < 0.2)) {
// node_clusters_[id].is_main_content = false;
for (int i = 0; i < (int)node_clusters_[id].dom_tree_nodes_.size(); ++i) {
NodeExtras *node_extras
= const_cast<NodeExtras*>
(static_cast<const NodeExtras*>(node_clusters_[id].dom_tree_nodes_[i]->extras()));
node_extras->has_text = false;
}
/*
std::cout << "perplexity rule:\t" << node_clusters_[id].path_
<< "\t" << node_clusters_[id].distinct_node_num
<< "\t" << node_clusters_[id].node_perplexity
<< "\t" << node_clusters_[id].distinct_char_num
<< "\t" << node_clusters_[id].text_length
<< "\t" << node_clusters_[id].char_perplexity
<< std::endl;
std::cout << node_clusters_[id].NodeClusterText();
*/
}
}
}
return true;
}
bool ContentCollector::SetNodeMainContent(const bool &is_main_content_in, NodeCluster *node_cluster) {
node_cluster->is_main_content = is_main_content_in;
for (int id = 0; id < (int)node_cluster->dom_tree_nodes_.size(); ++id) {
NodeExtras *node_extras
= const_cast<NodeExtras*>(static_cast<const NodeExtras*>(node_cluster->dom_tree_nodes_[id]->extras()));
node_extras->is_main_content = node_cluster->is_main_content;
}
return true;
}
bool ContentCollector::SetMainContent(const bool &is_main_content_in, NodeCluster *node_cluster) {
if (!SetNodeMainContent(is_main_content_in, node_cluster)) {
return false;
}
NodeCluster *child = node_cluster->first_child_;
while (child) {
if (!SetMainContent(is_main_content_in, child)) {
return false;
}
child = child->next_sibling_;
}
return true;
}
bool ContentCollector::FindDominantNodeCluster(NodeCluster *node_cluster) {
node_cluster->is_main_content = true;
SetNodeMainContent(true, node_cluster);
NodeCluster *child = node_cluster->first_child_;
if (child) {
double nonlink_char_body_ratio_sum = 0;
double best_nonlink_char_body_ratio = 0;
NodeCluster *best_child = NULL;
while (child) {
nonlink_char_body_ratio_sum += child->nonlink_char_body_ratio;
if (child->nonlink_char_body_ratio > best_nonlink_char_body_ratio) {
best_nonlink_char_body_ratio = child->nonlink_char_body_ratio;
best_child = child;
}
child = child->next_sibling_;
}
if (nonlink_char_body_ratio_sum > 0 &&
best_nonlink_char_body_ratio / nonlink_char_body_ratio_sum > FLAGS_body_ratio_thresh) {
// 发现某分支占优
NodeCluster *child = node_cluster->first_child_;
while (child) {
if (child == best_child) {
// DLOG(ERROR) << "dominant:\t" << child->nonlink_char_body_ratio << "\t" << child->path_;
/*
std::cout << "dominant:\t" << child->nonlink_char_body_ratio << "\t" << child->path_;
std::cout << "\t" << child->NodeClusterText();
std::cout <<std::endl;
*/
if (!FindDominantNodeCluster(child)) {
return false;
}
} else {
if (!SetMainContent(false, child)) {
return false;
}
// DLOG(ERROR) << "delete:\t" << child->nonlink_char_body_ratio << "\t" << child->path_;
/*
std::cout << "delete:\t" << child->nonlink_char_body_ratio << "\t" << child->path_;
std::cout << "\t" << child->NodeClusterText();
std::cout << std::endl;
*/
}
child = child->next_sibling_;
}
} else {
// 不存在某分支占优
// DLOG(ERROR) << "stop finding dominant";
NodeCluster *child = node_cluster->first_child_;
while (child) {
if (!SetMainContent(true, child)) {
return false;
}
child = child->next_sibling_;
}
}
}
return true;
}
bool ContentCollector::FindDominantNodeCluster2(NodeCluster *node_cluster) {
node_cluster->is_main_content = true;
SetNodeMainContent(true, node_cluster);
NodeCluster *child = node_cluster->first_child_;
if (child) {
double best_nonlink_char_body_ratio = 0;
NodeCluster *best_child = NULL;
while (child) {
if (child->nonlink_char_body_ratio > best_nonlink_char_body_ratio) {
best_nonlink_char_body_ratio = child->nonlink_char_body_ratio;
best_child = child;
}
child = child->next_sibling_;
}
if (best_nonlink_char_body_ratio > FLAGS_body_ratio_thresh) {
// 发现某分支占优
NodeCluster *child = node_cluster->first_child_;
while (child) {
if (child == best_child) {
if (!FindDominantNodeCluster(child)) {
return false;
}
} else {
if (!SetMainContent(false, child)) {
return false;
}
}
child = child->next_sibling_;
}
} else {
// 不存在某分支占优
NodeCluster *child = node_cluster->first_child_;
while (child) {
if (!SetMainContent(true, child)) {
return false;
}
child = child->next_sibling_;
}
}
}
return true;
}
bool ContentCollector::CollectNonleafStatistic(web::HTMLNode *node) {
NodeExtras *p_node_extras = const_cast<NodeExtras*>(static_cast<const NodeExtras*>(node->extras()));
if (CountTag(*node)) {
p_node_extras->tag_num++;
}
if (node->TagType() == web::HTMLTag::kP) {
p_node_extras->tag_p_num++;
}
if (node->TagType() == web::HTMLTag::kH1
|| node->TagType() == web::HTMLTag::kH2
|| node->TagType() == web::HTMLTag::kH3
|| node->TagType() == web::HTMLTag::kH4
|| node->TagType() == web::HTMLTag::kH5
|| node->TagType() == web::HTMLTag::kH6) {
p_node_extras->tag_h_num++;
}
// if the node is a hyperlink, update the link_tag_num and link_char_num
if (node->TagType() == web::HTMLTag::kA && p_node_extras->has_text) {
p_node_extras->link_tag_num++;
// NOTE(yuanjinhui): the pure text of its children should be counted as the link char
p_node_extras->link_char_num += p_node_extras->char_num;
}
p_node_extras->nonlink_char_num = p_node_extras->char_num - p_node_extras->link_char_num;
p_node_extras->UpdateDensity();
return true;
}
bool ContentCollector::TextStatistic(const std::string &text, NodeExtras *node_extras) {
CHECK_NOTNULL(node_extras);
base::UTF8CharIterator iter(&text);
node_extras->text = "";
std::string utf_char = "";
wchar_t wchar;
for (; !iter.end(); iter.Advance()) {
int codepoint = iter.get();
// NODE(yuanjinhui): 不包括阿拉伯数字, 可能会丢失一些数字信息
if ((codepoint >= 0x4E00 && codepoint <= 0x9FBF) || // All Chinese characters.
(codepoint >= 0x0041 && codepoint <= 0x005A) || // All uppercase English characters.
(codepoint >= 0x0061 && codepoint <= 0x007A) ||
(codepoint >= 0xFF21 && codepoint <= 0xFF3A) ||
(codepoint >= 0xFF41 && codepoint <= 0xFF5A)) { // All lowercase English characters.
node_extras->char_num++;
wchar = (wchar_t)codepoint;
base::WideToUTF8(&wchar, 1, &utf_char);
node_extras->text.append(utf_char);
} else if ((codepoint >= 0x0021 && codepoint <= 0x002F) ||
(codepoint >= 0x003A && codepoint <= 0x0040) ||
(codepoint >= 0x007B && codepoint <= 0x007E) ||
(codepoint >= 0x2010 && codepoint <= 0x2027) ||
(codepoint >= 0x3001 && codepoint <= 0x303F) ||
(codepoint >= 0xFF01 && codepoint <= 0xFF0F) ||
(codepoint >= 0xFF1A && codepoint <= 0xFF20) ||
(codepoint >= 0xFF3B && codepoint <= 0xFF40) ||
(codepoint >= 0xFF5B && codepoint <= 0xFF65) ||
(codepoint >= 0xFFDA && codepoint <= 0xFFEE)) {
node_extras->punctuation_num++;
wchar = (wchar_t)codepoint;
base::WideToUTF8(&wchar, 1, &utf_char);
node_extras->text.append(utf_char);
}
}
return true;
}
bool ContentCollector::CollectLeafStatistic(web::HTMLNode *node) {
NodeExtras *p_node_extras = const_cast<NodeExtras*>(static_cast<const NodeExtras*>(node->extras()));
if (node->TagType() == web::HTMLTag::kPureText) {
// pure text leaf node
if (!p_node_extras->has_text) {
// 在 RemoveNontextBottomUp 函数已处理
p_node_extras->SetCounterZero();
}
} else {
// non-text leaf node, abnormal
p_node_extras->SetCounterZero();
if (CountTag(*node)) {
p_node_extras->tag_num = 1;
}
if (node->TagType() == web::HTMLTag::kA) {
p_node_extras->link_tag_num = 1;
}
if (node->TagType() == web::HTMLTag::kP) {
p_node_extras->tag_p_num = 1;
}
if (node->TagType() == web::HTMLTag::kH1
|| node->TagType() == web::HTMLTag::kH2
|| node->TagType() == web::HTMLTag::kH3
|| node->TagType() == web::HTMLTag::kH4
|| node->TagType() == web::HTMLTag::kH5
|| node->TagType() == web::HTMLTag::kH6) {
p_node_extras->tag_h_num = 1;
}
}
p_node_extras->nonlink_char_num = p_node_extras->char_num - p_node_extras->link_char_num;
p_node_extras->UpdateDensity();
return true;
}
bool ContentCollector::CollectMainContent(const web::HTMLNode &node, std::string *content) {
web::HTMLNode *child = node.first_child();
if (child) {
while (child) {
NodeExtras *p_child_extras = const_cast<NodeExtras*>(static_cast<const NodeExtras*>(child->extras()));
if (p_child_extras->is_main_content) {
std::string child_text;
if (!CollectMainContent(*child, &child_text)) {
return false;
}
content->append(" " + child_text);
}
child = child->next_sibling();
}
} else {
const NodeExtras *p_node_extras = static_cast<const NodeExtras*>(node.extras());
if (p_node_extras->has_text &&
p_node_extras->is_main_content &&
node.TagType() == web::HTMLTag::kPureText) {
std::string node_text = " " + p_node_extras->text;
content->append(node_text);
}
}
return true;
}
bool ContentCollector::LargestNodeClusterText(const NodeCluster &node_cluster, std::string *content) {
NodeCluster *child = node_cluster.first_child_;
if (node_cluster.is_main_content && !child && node_cluster.nonlink_char_num) {
std::string node_text = node_cluster.NodeClusterText();
if (node_text.length() > content->length()) {
*content = node_text;
}
}
if (child) {
while (child) {
LargestNodeClusterText(*child, content);
child = child->next_sibling_;
}
}
return true;
}
bool ContentCollector::CollectMainContent(const NodeCluster &node_cluster, std::string *content) {
NodeCluster *child = node_cluster.first_child_;
if (child) {
while (child) {
if (child->is_main_content) {
std::string child_text;
if (!CollectMainContent(*child, &child_text)) {
return false;
}
content->append(" " + child_text);
}
child = child->next_sibling_;
}
} else {
if (node_cluster.is_main_content) {
content->append(node_cluster.NodeClusterText());
}
}
return true;
}
bool ContentCollector::CountTag(const web::HTMLNode &node) {
if (node.TagType() == web::HTMLTag::kPureText
|| node.TagType() == web::HTMLTag::kUnknown
|| node.TagType() == web::HTMLTag::kScript
|| node.TagType() == web::HTMLTag::kComment
|| node.TagType() == web::HTMLTag::kComment2
|| node.TagType() == web::HTMLTag::kNoscript
|| node.TagType() == web::HTMLTag::kIframe) {
return false;
} else {
return true;
}
}
bool ContentCollector::EmptyPureTextNode(const web::HTMLNode &node) {
if (node.TagType() == web::HTMLTag::kPureText) {
std::string text = node.value().as_string();
std::string trim_text;
base::TrimString(text, "\t\n\r ", &trim_text);
if (!trim_text.empty()) {
return false;
} else {
return true;
}
} else {
return false;
}
}
bool ContentCollector::UnVisibleNode(const web::HTMLNode &node) {
const web::HTMLStyle *style = node.html_style();
// special rule for baidu baike
if (node.AttrValue(web::HTMLAttr::AttrType::kClass) == "polysemy-item-cnt clearfix") {
return false;
}
// special rule for gome
/*
std::string id_name = node.AttrValue(web::HTMLAttr::AttrType::kId);
if (node.AttrValue(web::HTMLAttr::AttrType::kClass) == "tabBox"
&& base::StartsWith(id_name, "tab_c", true)
&& !style->visible()) {
std::cout << node.TagName() << "\t" << id_name << std::endl;
return false;
}
*/
if (style == NULL) {
return false;
} else {
return !style->visible();
}
}
bool ContentCollector::DroppableNode(const web::HTMLNode &node) {
return
node.TagType() == web::HTMLTag::kComment
|| node.TagType() == web::HTMLTag::kComment2
|| node.TagType() == web::HTMLTag::kHr
|| node.TagType() == web::HTMLTag::kBr
// control
|| node.TagType() == web::HTMLTag::kInput
|| node.TagType() == web::HTMLTag::kSelect
|| node.TagType() == web::HTMLTag::kTextarea
|| node.TagType() == web::HTMLTag::kMenu
|| node.TagType() == web::HTMLTag::kApplet
|| node.TagType() == web::HTMLTag::kButton
|| node.TagType() == web::HTMLTag::kObject
|| node.TagType() == web::HTMLTag::kNav
|| node.TagType() == web::HTMLTag::kFooter
|| node.TagType() == web::HTMLTag::kHeader
|| node.TagType() == web::HTMLTag::kIframe
|| node.TagType() == web::HTMLTag::kSound
|| node.TagType() == web::HTMLTag::kDatagrid
|| node.TagType() == web::HTMLTag::kLink
|| node.TagType() == web::HTMLTag::kImg
|| node.TagType() == web::HTMLTag::kStyle
|| node.TagType() == web::HTMLTag::kScript
|| node.TagType() == web::HTMLTag::kNoscript
|| node.TagType() == web::HTMLTag::kMarquee
|| node.TagType() == web::HTMLTag::kA
|| EmptyPureTextNode(node)
|| UnVisibleNode(node);
}
}
| [
"pengdan.pd@alibaba-inc.com"
] | pengdan.pd@alibaba-inc.com |
9b3be194004e50faa099520b67646927ac54fdf4 | 73ee941896043f9b3e2ab40028d24ddd202f695f | /external/chromium_org/chrome/browser/chromeos/drive/file_system/open_file_operation_unittest.cc | 36281669ed0c25da7030825989650f5e28c96fbc | [
"BSD-3-Clause"
] | permissive | CyFI-Lab-Public/RetroScope | d441ea28b33aceeb9888c330a54b033cd7d48b05 | 276b5b03d63f49235db74f2c501057abb9e79d89 | refs/heads/master | 2022-04-08T23:11:44.482107 | 2016-09-22T20:15:43 | 2016-09-22T20:15:43 | 58,890,600 | 5 | 3 | null | null | null | null | UTF-8 | C++ | false | false | 7,872 | cc | // 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.
#include "chrome/browser/chromeos/drive/file_system/open_file_operation.h"
#include <map>
#include "base/file_util.h"
#include "base/files/file_path.h"
#include "base/memory/scoped_ptr.h"
#include "chrome/browser/chromeos/drive/drive.pb.h"
#include "chrome/browser/chromeos/drive/file_errors.h"
#include "chrome/browser/chromeos/drive/file_system/operation_test_base.h"
#include "chrome/browser/google_apis/test_util.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace drive {
namespace file_system {
class OpenFileOperationTest : public OperationTestBase {
protected:
virtual void SetUp() {
OperationTestBase::SetUp();
operation_.reset(new OpenFileOperation(
blocking_task_runner(), observer(), scheduler(), metadata(), cache(),
temp_dir()));
}
scoped_ptr<OpenFileOperation> operation_;
};
TEST_F(OpenFileOperationTest, OpenExistingFile) {
const base::FilePath file_in_root(
FILE_PATH_LITERAL("drive/root/File 1.txt"));
ResourceEntry src_entry;
ASSERT_EQ(FILE_ERROR_OK, GetLocalResourceEntry(file_in_root, &src_entry));
const int64 file_size = src_entry.file_info().size();
FileError error = FILE_ERROR_FAILED;
base::FilePath file_path;
base::Closure close_callback;
operation_->OpenFile(
file_in_root,
OPEN_FILE,
google_apis::test_util::CreateCopyResultCallback(
&error, &file_path, &close_callback));
test_util::RunBlockingPoolTask();
EXPECT_EQ(FILE_ERROR_OK, error);
ASSERT_TRUE(base::PathExists(file_path));
int64 local_file_size;
ASSERT_TRUE(file_util::GetFileSize(file_path, &local_file_size));
EXPECT_EQ(file_size, local_file_size);
ASSERT_FALSE(close_callback.is_null());
close_callback.Run();
EXPECT_EQ(
1U,
observer()->upload_needed_resource_ids().count(src_entry.resource_id()));
}
TEST_F(OpenFileOperationTest, OpenNonExistingFile) {
const base::FilePath file_in_root(
FILE_PATH_LITERAL("drive/root/not-exist.txt"));
FileError error = FILE_ERROR_FAILED;
base::FilePath file_path;
base::Closure close_callback;
operation_->OpenFile(
file_in_root,
OPEN_FILE,
google_apis::test_util::CreateCopyResultCallback(
&error, &file_path, &close_callback));
test_util::RunBlockingPoolTask();
EXPECT_EQ(FILE_ERROR_NOT_FOUND, error);
EXPECT_TRUE(close_callback.is_null());
}
TEST_F(OpenFileOperationTest, CreateExistingFile) {
const base::FilePath file_in_root(
FILE_PATH_LITERAL("drive/root/File 1.txt"));
ResourceEntry src_entry;
ASSERT_EQ(FILE_ERROR_OK, GetLocalResourceEntry(file_in_root, &src_entry));
FileError error = FILE_ERROR_FAILED;
base::FilePath file_path;
base::Closure close_callback;
operation_->OpenFile(
file_in_root,
CREATE_FILE,
google_apis::test_util::CreateCopyResultCallback(
&error, &file_path, &close_callback));
test_util::RunBlockingPoolTask();
EXPECT_EQ(FILE_ERROR_EXISTS, error);
EXPECT_TRUE(close_callback.is_null());
}
TEST_F(OpenFileOperationTest, CreateNonExistingFile) {
const base::FilePath file_in_root(
FILE_PATH_LITERAL("drive/root/not-exist.txt"));
FileError error = FILE_ERROR_FAILED;
base::FilePath file_path;
base::Closure close_callback;
operation_->OpenFile(
file_in_root,
CREATE_FILE,
google_apis::test_util::CreateCopyResultCallback(
&error, &file_path, &close_callback));
test_util::RunBlockingPoolTask();
EXPECT_EQ(FILE_ERROR_OK, error);
ASSERT_TRUE(base::PathExists(file_path));
int64 local_file_size;
ASSERT_TRUE(file_util::GetFileSize(file_path, &local_file_size));
EXPECT_EQ(0, local_file_size); // Should be an empty file.
ASSERT_FALSE(close_callback.is_null());
close_callback.Run();
// Here we don't know about the resource id, so just make sure
// OnCacheFileUploadNeededByOperation is called actually.
EXPECT_EQ(1U, observer()->upload_needed_resource_ids().size());
}
TEST_F(OpenFileOperationTest, OpenOrCreateExistingFile) {
const base::FilePath file_in_root(
FILE_PATH_LITERAL("drive/root/File 1.txt"));
ResourceEntry src_entry;
ASSERT_EQ(FILE_ERROR_OK, GetLocalResourceEntry(file_in_root, &src_entry));
const int64 file_size = src_entry.file_info().size();
FileError error = FILE_ERROR_FAILED;
base::FilePath file_path;
base::Closure close_callback;
operation_->OpenFile(
file_in_root,
OPEN_OR_CREATE_FILE,
google_apis::test_util::CreateCopyResultCallback(
&error, &file_path, &close_callback));
test_util::RunBlockingPoolTask();
EXPECT_EQ(FILE_ERROR_OK, error);
ASSERT_TRUE(base::PathExists(file_path));
int64 local_file_size;
ASSERT_TRUE(file_util::GetFileSize(file_path, &local_file_size));
EXPECT_EQ(file_size, local_file_size);
ASSERT_FALSE(close_callback.is_null());
close_callback.Run();
EXPECT_EQ(
1U,
observer()->upload_needed_resource_ids().count(src_entry.resource_id()));
}
TEST_F(OpenFileOperationTest, OpenOrCreateNonExistingFile) {
const base::FilePath file_in_root(
FILE_PATH_LITERAL("drive/root/not-exist.txt"));
FileError error = FILE_ERROR_FAILED;
base::FilePath file_path;
base::Closure close_callback;
operation_->OpenFile(
file_in_root,
OPEN_OR_CREATE_FILE,
google_apis::test_util::CreateCopyResultCallback(
&error, &file_path, &close_callback));
test_util::RunBlockingPoolTask();
EXPECT_EQ(FILE_ERROR_OK, error);
ASSERT_TRUE(base::PathExists(file_path));
int64 local_file_size;
ASSERT_TRUE(file_util::GetFileSize(file_path, &local_file_size));
EXPECT_EQ(0, local_file_size); // Should be an empty file.
ASSERT_FALSE(close_callback.is_null());
close_callback.Run();
// Here we don't know about the resource id, so just make sure
// OnCacheFileUploadNeededByOperation is called actually.
EXPECT_EQ(1U, observer()->upload_needed_resource_ids().size());
}
TEST_F(OpenFileOperationTest, OpenFileTwice) {
const base::FilePath file_in_root(
FILE_PATH_LITERAL("drive/root/File 1.txt"));
ResourceEntry src_entry;
ASSERT_EQ(FILE_ERROR_OK, GetLocalResourceEntry(file_in_root, &src_entry));
const int64 file_size = src_entry.file_info().size();
FileError error = FILE_ERROR_FAILED;
base::FilePath file_path;
base::Closure close_callback;
operation_->OpenFile(
file_in_root,
OPEN_FILE,
google_apis::test_util::CreateCopyResultCallback(
&error, &file_path, &close_callback));
test_util::RunBlockingPoolTask();
EXPECT_EQ(FILE_ERROR_OK, error);
ASSERT_TRUE(base::PathExists(file_path));
int64 local_file_size;
ASSERT_TRUE(file_util::GetFileSize(file_path, &local_file_size));
EXPECT_EQ(file_size, local_file_size);
// Open again.
error = FILE_ERROR_FAILED;
base::Closure close_callback2;
operation_->OpenFile(
file_in_root,
OPEN_FILE,
google_apis::test_util::CreateCopyResultCallback(
&error, &file_path, &close_callback2));
test_util::RunBlockingPoolTask();
EXPECT_EQ(FILE_ERROR_OK, error);
ASSERT_TRUE(base::PathExists(file_path));
ASSERT_TRUE(file_util::GetFileSize(file_path, &local_file_size));
EXPECT_EQ(file_size, local_file_size);
ASSERT_FALSE(close_callback.is_null());
ASSERT_FALSE(close_callback2.is_null());
close_callback.Run();
// There still remains a client opening the file, so it shouldn't be
// uploaded yet.
EXPECT_TRUE(observer()->upload_needed_resource_ids().empty());
close_callback2.Run();
// Here, all the clients close the file, so it should be uploaded then.
EXPECT_EQ(
1U,
observer()->upload_needed_resource_ids().count(src_entry.resource_id()));
}
} // namespace file_system
} // namespace drive
| [
"ProjectRetroScope@gmail.com"
] | ProjectRetroScope@gmail.com |
90536ff7b19d7adb7b5e2c89cdb62d2a49194e97 | e104892af303d85c5e661d099b500dc1e35b882d | /Sample17_10/app/src/main/cpp/bndev/ThreadTask.cpp | 1d86185f3f0e450d71076b1e742ca666a3bf113b | [
"Unlicense"
] | permissive | siwangqishiq/Vulkan_Develpment_Samples | 624900dabaca75c9ad21ef5a1ee5af6709dcc9a8 | 409c973e0b37086c854cde07b1e620c3d8d9f15d | refs/heads/master | 2023-08-16T04:13:54.777841 | 2021-10-14T06:53:11 | 2021-10-14T06:53:11 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,481 | cpp | #include "ThreadTask.h"
#include "MyVulkanManager.h"
#include "ShaderQueueSuit_PreProcess.h"
void ThreadTask::doTask()
{
MyVulkanManager::init_vulkan_instance();
MyVulkanManager::enumerate_vulkan_phy_devices();
MyVulkanManager::create_vulkan_devices();
MyVulkanManager::create_vulkan_CommandBuffer();
MyVulkanManager::init_queue();
MyVulkanManager::create_vulkan_swapChain();
MyVulkanManager::create_vulkan_DepthBuffer();
MyVulkanManager::create_vulkan_SelfColorBuffer();
MyVulkanManager::create_render_pass();
MyVulkanManager::create_frame_buffer();
MyVulkanManager::init_texture();
MyVulkanManager::createDrawableObject();
MyVulkanManager::initPipeline();
MyVulkanManager::createFence();
MyVulkanManager::initPresentInfo();
MyVulkanManager::initMatrixAndLight();
MyVulkanManager::drawObject();
MyVulkanManager::destroyFence();
MyVulkanManager::destroyPipeline();
MyVulkanManager::destroyDrawableObject();
MyVulkanManager::destroy_textures();
MyVulkanManager::destroy_vulkan_SelfColorBuffer();
MyVulkanManager::destroy_frame_buffer();
MyVulkanManager::destroy_render_pass();
MyVulkanManager::destroy_vulkan_DepthBuffer();
MyVulkanManager::destroy_vulkan_swapChain();
MyVulkanManager::destroy_vulkan_CommandBuffer();
MyVulkanManager::destroy_vulkan_devices();
MyVulkanManager::destroy_vulkan_instance();
}
ThreadTask::ThreadTask()
{
}
ThreadTask:: ~ThreadTask()
{
} | [
"709165253@qq.com"
] | 709165253@qq.com |
15921d8b84fd244d38f16f9a2a526e41b4049837 | dd656493066344e70123776c2cc31dd13f31c1d8 | /MITK/Utilities/Poco/Foundation/include/Poco/EventArgs.h | 9c26dda52ef0b3517c33304881877a16d4a365f3 | [
"BSL-1.0"
] | permissive | david-guerrero/MITK | e9832b830cbcdd94030d2969aaed45da841ffc8c | e5fbc9993f7a7032fc936f29bc59ca296b4945ce | refs/heads/master | 2020-04-24T19:08:37.405353 | 2011-11-13T22:25:21 | 2011-11-13T22:25:21 | 2,372,730 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 2,083 | h | //
// EventArgs.h
//
// $Id$
//
// Library: Foundation
// Package: Events
// Module: EventArgs
//
// Definition of EventArgs.
//
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
// and Contributors.
//
// Permission is hereby granted, free of charge, to any person or organization
// obtaining a copy of the software and accompanying documentation covered by
// this license (the "Software") to use, reproduce, display, distribute,
// execute, and transmit the Software, and to prepare derivative works of the
// Software, and to permit third-parties to whom the Software is furnished to
// do so, all subject to the following:
//
// The copyright notices in the Software and this entire statement, including
// the above license grant, this restriction and the following disclaimer,
// must be included in all copies of the Software, in whole or in part, and
// all derivative works of the Software, unless such copies or derivative
// works are solely in the form of machine-executable object code generated by
// a source language processor.
//
// 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, TITLE AND NON-INFRINGEMENT. IN NO EVENT
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//
#ifndef Foundation_EventArgs_INCLUDED
#define Foundation_EventArgs_INCLUDED
#include "Poco/Foundation.h"
namespace Poco {
class Foundation_API EventArgs
/// The purpose of the EventArgs class is to be used as parameter
/// when one doesn't want to send any data.
/// One can use EventArgs as a super-class for one's own event arguments
/// but with the arguments being a template parameter this is not
/// necessary.
{
public:
EventArgs();
virtual ~EventArgs();
};
} // namespace Poco
#endif
| [
"dav@live.ca"
] | dav@live.ca |
1e95a8f76d0b86511c5158c1b29bb86f0fdc03a1 | dcc54530b7c7b380803029295ffe71585af525b3 | /Handy2D/src/TextboxSprite.cpp | 5a8ddaaf46e0a2f62c606c129d4946de3992d088 | [
"MIT"
] | permissive | HadaHector/Handy2D | 17683faf0fc62cb9b4bafd3f0fc9b5f65e0e328e | 265b427e02879fef01d1e29338e5049b7dfe5cbe | refs/heads/master | 2020-04-13T08:50:01.931888 | 2020-01-04T12:22:19 | 2020-01-04T12:22:19 | 147,951,469 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 7,131 | cpp | #include <string>
#include "TextboxSprite.h"
#include <algorithm>
#include "sdlmanager.h"
#include "Sprite.h"
#include "Font.h"
std::wstring UTF8toUnicode(const std::string& s)
{
std::wstring ws;
wchar_t wc;
for (unsigned int i = 0; i < s.length(); )
{
char c = s[i];
if ((c & 0x80) == 0)
{
wc = c;
++i;
}
else if ((c & 0xE0) == 0xC0)
{
wc = (s[i] & 0x1F) << 6;
wc |= (s[i + 1] & 0x3F);
i += 2;
}
else if ((c & 0xF0) == 0xE0)
{
wc = (s[i] & 0xF) << 12;
wc |= (s[i + 1] & 0x3F) << 6;
wc |= (s[i + 2] & 0x3F);
i += 3;
}
else if ((c & 0xF8) == 0xF0)
{
wc = (s[i] & 0x7) << 18;
wc |= (s[i + 1] & 0x3F) << 12;
wc |= (s[i + 2] & 0x3F) << 6;
wc |= (s[i + 3] & 0x3F);
i += 4;
}
else if ((c & 0xFC) == 0xF8)
{
wc = (s[i] & 0x3) << 24;
wc |= (s[i] & 0x3F) << 18;
wc |= (s[i] & 0x3F) << 12;
wc |= (s[i] & 0x3F) << 6;
wc |= (s[i] & 0x3F);
i += 5;
}
else if ((c & 0xFE) == 0xFC)
{
wc = (s[i] & 0x1) << 30;
wc |= (s[i] & 0x3F) << 24;
wc |= (s[i] & 0x3F) << 18;
wc |= (s[i] & 0x3F) << 12;
wc |= (s[i] & 0x3F) << 6;
wc |= (s[i] & 0x3F);
i += 6;
}
ws += wc;
}
return ws;
}
FontDesc* STextBlock::GetFont()
{
if (pFont) return pFont;
pFont = FontCache::Instance.GetFont(sFont, nFontSize);
return pFont;
}
void STextBlock::SetText(const std::string& sText)
{
this->sText = sText;
sWText = UTF8toUnicode(sText);
}
void STextBlock::SetFont(const std::string& sFont)
{
this->sFont = sFont;
}
void STextBlock::SetFontSize(int nSize)
{
this->nFontSize = nSize;
}
void STextBlock::SetColor(Color color)
{
this->color = color;
}
void CTextboxSprite::Render(const CRenderLayer& Layer, Vec vOffset)
{
if (!m_Size) return;
if (!m_bGenerated)
{
//first we collect the rects to render, then deal with line height, line break, align etc
std::vector<LetterDesc*> aLetters;
std::vector<Color> aColors;
for (unsigned int i = 0; i < m_aBlocks.size(); ++i)
{
for (unsigned int c = 0; c < m_aBlocks[i].sWText.size(); ++c)
{
LetterDesc* desc;
desc = m_aBlocks[i].GetFont()->GetLetter(m_aBlocks[i].sWText[c]);
aLetters.push_back(desc);
aColors.push_back(m_aBlocks[i].color);
}
}
m_aGlyphs.clear();
m_aGlyphs.reserve(aLetters.size());
{
int nWordStart = 0;
int nLine = 0;
int nX = 0;
bool bFullLine = true;
for (unsigned int i = 0; i < aLetters.size(); ++i)
{
LetterDesc* letter = aLetters[i];
renderglyph Glyph;
Glyph.pSurface = letter->pSurface;
Glyph.pTexture = letter->pTexture;
Glyph.color = aColors[i];
if (letter->character == '\n')
{
Glyph.line = nLine;
nLine++;
nX = 0;
}
else
{
if (letter->character == ' ')
{
Glyph.line = nLine;
nWordStart = i + 1;
bFullLine = false;
if (nX + letter->advance >= m_Size.x)
{
nLine++;
nX = 0;
}
else if (nX > 0)
{
nX += letter->advance;
}
}
else
if (nX + letter->advance >= m_Size.x)
{
if (!bFullLine)
{
nLine++;
nX = 0;
for (unsigned int j = nWordStart; j < i; ++j)
{
m_aGlyphs[j].line = nLine;
m_aGlyphs[j].x = nX;
nX += aLetters[j]->advance;
}
Glyph.line = nLine;
Glyph.x = nX;
nX += letter->advance;
}
else //fulline - no space in row, too long word, must be broke
{
nLine++;
nWordStart = i;
Glyph.line = nLine;
Glyph.x = 0;
nX = letter->advance;
}
}
else
{
Glyph.line = nLine;
Glyph.x = nX;
nX += letter->advance;
}
}
m_aGlyphs.push_back(Glyph);
}
}
{
int nLine = 0;
int nLineStart = 0;
int nLineY = 0;
int nLineMaxAscend = 0;
int nLineMaxSkip = 0;
int nMaxVertical = 0;
for (unsigned int i = 0; i < aLetters.size(); ++i)
{
LetterDesc* letter = aLetters[i];
renderglyph Glyph = m_aGlyphs[i];
if (nLine != Glyph.line || i == aLetters.size() - 1)
{
if (i == aLetters.size() - 1) i++; //hack for the last character
int nOffset = (int) (m_fHorizontalAlign * (m_Size.x - m_aGlyphs[i - 1].x));
for (unsigned int j = nLineStart; j < i; ++j)
{
m_aGlyphs[j].y = nLineY + nLineMaxAscend - aLetters[j]->pFont->m_nAscend;
m_aGlyphs[j].x += nOffset;
nMaxVertical = std::max(nMaxVertical, m_aGlyphs[j].y + letter->pFont->m_nDescend);
}
nLineY += nLineMaxSkip;
nLineStart = i;
nLineMaxAscend = 0, nLineMaxSkip = 0;
nLine++;
}
nLineMaxAscend = std::max(nLineMaxAscend, letter->pFont->m_nAscend);
nLineMaxSkip = std::max(nLineMaxSkip, letter->pFont->m_nLineSkip);
}
int nOffset = (int) (m_fVerticalAlign * ( m_Size.y - nMaxVertical));
for (unsigned int i = 0; i < m_aGlyphs.size(); ++i)
{
m_aGlyphs[i].y += nOffset;
}
}
m_bGenerated = true;
}
if (m_bDynamic)
{
for (unsigned int i = 0; i < m_aGlyphs.size(); ++i)
{
//special characters may not have surface, for example \n
if (!m_aGlyphs[i].pSurface || !m_aGlyphs[i].pTexture) continue;
SDL_Rect Rect2;
Rect2 = m_aGlyphs[i].pSurface->clip_rect;
Rect2.x += (int) m_Position.x + m_aGlyphs[i].x;
Rect2.y += (int) m_Position.y + m_aGlyphs[i].y;
Color& c = m_aGlyphs[i].color;
int ret = SDL_SetTextureColorMod(m_aGlyphs[i].pTexture, c.r, c.g, c.b);
//todo clip the overflowing stuff
SDL_RenderCopy(SDLManager::Instance.GetRenderer(), m_aGlyphs[i].pTexture, nullptr, &Rect2);
}
}
else
{
SDL_Surface* pTarget = SDL_CreateRGBSurface(0, (int) m_Size.x, (int) m_Size.y, 32, 0xff000000, 0x00ff0000, 0x0000ff00, 0x000000ff);
for (unsigned int i = 0; i < m_aGlyphs.size(); ++i)
{
//special characters may not have surface, for example \n
if (!m_aGlyphs[i].pSurface) continue;
SDL_Rect Rect2;
Rect2 = m_aGlyphs[i].pSurface->clip_rect;
Rect2.x += m_aGlyphs[i].x;
Rect2.y += m_aGlyphs[i].y;
//todo not necessary to multiply if the color is white
SDL_SetSurfaceBlendMode(pTarget, SDL_BLENDMODE_NONE);
Uint32 col = m_aGlyphs[i].color.forSurface(pTarget);
col &= 0xffffff00;
SDL_FillRect(pTarget, &Rect2, col);
SDL_SetSurfaceBlendMode(pTarget, SDL_BLENDMODE_MOD);
SDL_BlitSurface(m_aGlyphs[i].pSurface, NULL, pTarget, &Rect2);
}
if (m_pTextTexture)
{
SDL_DestroyTexture(m_pTextTexture);
}
m_pTextTexture = SDL_CreateTextureFromSurface(SDLManager::Instance.GetRenderer(), pTarget);
SDL_FreeSurface(pTarget);
SDL_Rect Rect;
Rect.x = (int) m_Position.x;
Rect.y = (int) m_Position.y;
Rect.w = (int) m_Size.x;
Rect.h = (int) m_Size.y;
SDL_RenderCopy(SDLManager::Instance.GetRenderer(), m_pTextTexture, nullptr, &Rect);
}
SDLManager::drawnum++;
}
void CTextboxSprite::SetHAlign(float fAlign)
{
if (m_fHorizontalAlign != fAlign)
{
m_fHorizontalAlign = fAlign;
m_bGenerated = false;
}
}
void CTextboxSprite::SetVAlign(float fAlign)
{
if (m_fVerticalAlign != fAlign)
{
m_fVerticalAlign = fAlign;
m_bGenerated = false;
}
} | [
"hada.adam@gmail.com"
] | hada.adam@gmail.com |
d72ccca80dbeef76c460bd216c809b8d74a48cd9 | e417cdec35d79628b12eba11fd77c19571ccdc56 | /src/qt/guiutil.cpp | ce9d90243a85e459209263677b12029c34d5ce88 | [
"MIT"
] | permissive | bitspill/knavecoin | 4daa71e195280ce9366835048df5f06395da8937 | 4f7757616176491e7e4d8fa092fac897503fd361 | refs/heads/master | 2021-03-24T11:53:19.860931 | 2014-04-29T08:28:20 | 2014-04-29T08:28:20 | 59,814,983 | 0 | 0 | null | 2016-05-27T07:36:41 | 2016-05-27T07:36:41 | null | UTF-8 | C++ | false | false | 16,815 | cpp | #include <QApplication>
#include "guiutil.h"
#include "bitcoinaddressvalidator.h"
#include "walletmodel.h"
#include "bitcoinunits.h"
#include "util.h"
#include "init.h"
#include <QDateTime>
#include <QDoubleValidator>
#include <QFont>
#include <QLineEdit>
#if QT_VERSION >= 0x050000
#include <QUrlQuery>
#else
#include <QUrl>
#endif
#include <QTextDocument> // for Qt::mightBeRichText
#include <QAbstractItemView>
#include <QClipboard>
#include <QFileDialog>
#include <QDesktopServices>
#include <QThread>
#include <boost/filesystem.hpp>
#include <boost/filesystem/fstream.hpp>
#ifdef WIN32
#ifdef _WIN32_WINNT
#undef _WIN32_WINNT
#endif
#define _WIN32_WINNT 0x0501
#ifdef _WIN32_IE
#undef _WIN32_IE
#endif
#define _WIN32_IE 0x0501
#define WIN32_LEAN_AND_MEAN 1
#ifndef NOMINMAX
#define NOMINMAX
#endif
#include "shlwapi.h"
#include "shlobj.h"
#include "shellapi.h"
#endif
namespace GUIUtil {
QString dateTimeStr(const QDateTime &date)
{
return date.date().toString(Qt::SystemLocaleShortDate) + QString(" ") + date.toString("hh:mm");
}
QString dateTimeStr(qint64 nTime)
{
return dateTimeStr(QDateTime::fromTime_t((qint32)nTime));
}
QFont bitcoinAddressFont()
{
QFont font("Monospace");
font.setStyleHint(QFont::TypeWriter);
return font;
}
void setupAddressWidget(QLineEdit *widget, QWidget *parent)
{
widget->setMaxLength(BitcoinAddressValidator::MaxAddressLength);
widget->setValidator(new BitcoinAddressValidator(parent));
widget->setFont(bitcoinAddressFont());
}
void setupAmountWidget(QLineEdit *widget, QWidget *parent)
{
QDoubleValidator *amountValidator = new QDoubleValidator(parent);
amountValidator->setDecimals(8);
amountValidator->setBottom(0.0);
widget->setValidator(amountValidator);
widget->setAlignment(Qt::AlignRight|Qt::AlignVCenter);
}
bool parseBitcoinURI(const QUrl &uri, SendCoinsRecipient *out)
{
// return if URI is not valid or is no bitcoin URI
if(!uri.isValid() || uri.scheme() != QString("knavecoin"))
return false;
SendCoinsRecipient rv;
rv.address = uri.path();
rv.amount = 0;
#if QT_VERSION < 0x050000
QList<QPair<QString, QString> > items = uri.queryItems();
#else
QUrlQuery uriQuery(uri);
QList<QPair<QString, QString> > items = uriQuery.queryItems();
#endif
for (QList<QPair<QString, QString> >::iterator i = items.begin(); i != items.end(); i++)
{
bool fShouldReturnFalse = false;
if (i->first.startsWith("req-"))
{
i->first.remove(0, 4);
fShouldReturnFalse = true;
}
if (i->first == "label")
{
rv.label = i->second;
fShouldReturnFalse = false;
}
else if (i->first == "amount")
{
if(!i->second.isEmpty())
{
if(!BitcoinUnits::parse(BitcoinUnits::BTC, i->second, &rv.amount))
{
return false;
}
}
fShouldReturnFalse = false;
}
if (fShouldReturnFalse)
return false;
}
if(out)
{
*out = rv;
}
return true;
}
bool parseBitcoinURI(QString uri, SendCoinsRecipient *out)
{
// Convert bitcoin:// to bitcoin:
//
// Cannot handle this later, because bitcoin:// will cause Qt to see the part after // as host,
// which will lower-case it (and thus invalidate the address).
if(uri.startsWith("knavecoin://"))
{
uri.replace(0, 12, "knavecoin:");
}
QUrl uriInstance(uri);
return parseBitcoinURI(uriInstance, out);
}
QString HtmlEscape(const QString& str, bool fMultiLine)
{
#if QT_VERSION < 0x050000
QString escaped = Qt::escape(str);
#else
QString escaped = str.toHtmlEscaped();
#endif
if(fMultiLine)
{
escaped = escaped.replace("\n", "<br>\n");
}
return escaped;
}
QString HtmlEscape(const std::string& str, bool fMultiLine)
{
return HtmlEscape(QString::fromStdString(str), fMultiLine);
}
void copyEntryData(QAbstractItemView *view, int column, int role)
{
if(!view || !view->selectionModel())
return;
QModelIndexList selection = view->selectionModel()->selectedRows(column);
if(!selection.isEmpty())
{
// Copy first item (global clipboard)
QApplication::clipboard()->setText(selection.at(0).data(role).toString(), QClipboard::Clipboard);
// Copy first item (global mouse selection for e.g. X11 - NOP on Windows)
QApplication::clipboard()->setText(selection.at(0).data(role).toString(), QClipboard::Selection);
}
}
void setClipboard(const QString& str)
{
QApplication::clipboard()->setText(str, QClipboard::Clipboard);
QApplication::clipboard()->setText(str, QClipboard::Selection);
}
QString getSaveFileName(QWidget *parent, const QString &caption,
const QString &dir,
const QString &filter,
QString *selectedSuffixOut)
{
QString selectedFilter;
QString myDir;
if(dir.isEmpty()) // Default to user documents location
{
#if QT_VERSION < 0x050000
myDir = QDesktopServices::storageLocation(QDesktopServices::DocumentsLocation);
#else
myDir = QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation);
#endif
}
else
{
myDir = dir;
}
QString result = QFileDialog::getSaveFileName(parent, caption, myDir, filter, &selectedFilter);
/* Extract first suffix from filter pattern "Description (*.foo)" or "Description (*.foo *.bar ...) */
QRegExp filter_re(".* \\(\\*\\.(.*)[ \\)]");
QString selectedSuffix;
if(filter_re.exactMatch(selectedFilter))
{
selectedSuffix = filter_re.cap(1);
}
/* Add suffix if needed */
QFileInfo info(result);
if(!result.isEmpty())
{
if(info.suffix().isEmpty() && !selectedSuffix.isEmpty())
{
/* No suffix specified, add selected suffix */
if(!result.endsWith("."))
result.append(".");
result.append(selectedSuffix);
}
}
/* Return selected suffix if asked to */
if(selectedSuffixOut)
{
*selectedSuffixOut = selectedSuffix;
}
return result;
}
Qt::ConnectionType blockingGUIThreadConnection()
{
if(QThread::currentThread() != qApp->thread())
{
return Qt::BlockingQueuedConnection;
}
else
{
return Qt::DirectConnection;
}
}
bool checkPoint(const QPoint &p, const QWidget *w)
{
QWidget *atW = QApplication::widgetAt(w->mapToGlobal(p));
if (!atW) return false;
return atW->topLevelWidget() == w;
}
bool isObscured(QWidget *w)
{
return !(checkPoint(QPoint(0, 0), w)
&& checkPoint(QPoint(w->width() - 1, 0), w)
&& checkPoint(QPoint(0, w->height() - 1), w)
&& checkPoint(QPoint(w->width() - 1, w->height() - 1), w)
&& checkPoint(QPoint(w->width() / 2, w->height() / 2), w));
}
void openDebugLogfile()
{
boost::filesystem::path pathDebug = GetDataDir() / "debug.log";
/* Open debug.log with the associated application */
if (boost::filesystem::exists(pathDebug))
QDesktopServices::openUrl(QUrl::fromLocalFile(QString::fromStdString(pathDebug.string())));
}
ToolTipToRichTextFilter::ToolTipToRichTextFilter(int size_threshold, QObject *parent) :
QObject(parent), size_threshold(size_threshold)
{
}
bool ToolTipToRichTextFilter::eventFilter(QObject *obj, QEvent *evt)
{
if(evt->type() == QEvent::ToolTipChange)
{
QWidget *widget = static_cast<QWidget*>(obj);
QString tooltip = widget->toolTip();
if(tooltip.size() > size_threshold && !tooltip.startsWith("<qt/>") && !Qt::mightBeRichText(tooltip))
{
// Prefix <qt/> to make sure Qt detects this as rich text
// Escape the current message as HTML and replace \n by <br>
tooltip = "<qt/>" + HtmlEscape(tooltip, true);
widget->setToolTip(tooltip);
return true;
}
}
return QObject::eventFilter(obj, evt);
}
#ifdef WIN32
boost::filesystem::path static StartupShortcutPath()
{
return GetSpecialFolderPath(CSIDL_STARTUP) / "Knavecoin.lnk";
}
bool GetStartOnSystemStartup()
{
// check for Bitcoin.lnk
return boost::filesystem::exists(StartupShortcutPath());
}
bool SetStartOnSystemStartup(bool fAutoStart)
{
// If the shortcut exists already, remove it for updating
boost::filesystem::remove(StartupShortcutPath());
if (fAutoStart)
{
CoInitialize(NULL);
// Get a pointer to the IShellLink interface.
IShellLink* psl = NULL;
HRESULT hres = CoCreateInstance(CLSID_ShellLink, NULL,
CLSCTX_INPROC_SERVER, IID_IShellLink,
reinterpret_cast<void**>(&psl));
if (SUCCEEDED(hres))
{
// Get the current executable path
TCHAR pszExePath[MAX_PATH];
GetModuleFileName(NULL, pszExePath, sizeof(pszExePath));
TCHAR pszArgs[5] = TEXT("-min");
// Set the path to the shortcut target
psl->SetPath(pszExePath);
PathRemoveFileSpec(pszExePath);
psl->SetWorkingDirectory(pszExePath);
psl->SetShowCmd(SW_SHOWMINNOACTIVE);
psl->SetArguments(pszArgs);
// Query IShellLink for the IPersistFile interface for
// saving the shortcut in persistent storage.
IPersistFile* ppf = NULL;
hres = psl->QueryInterface(IID_IPersistFile,
reinterpret_cast<void**>(&ppf));
if (SUCCEEDED(hres))
{
WCHAR pwsz[MAX_PATH];
// Ensure that the string is ANSI.
MultiByteToWideChar(CP_ACP, 0, StartupShortcutPath().string().c_str(), -1, pwsz, MAX_PATH);
// Save the link by calling IPersistFile::Save.
hres = ppf->Save(pwsz, TRUE);
ppf->Release();
psl->Release();
CoUninitialize();
return true;
}
psl->Release();
}
CoUninitialize();
return false;
}
return true;
}
#elif defined(LINUX)
// Follow the Desktop Application Autostart Spec:
// http://standards.freedesktop.org/autostart-spec/autostart-spec-latest.html
boost::filesystem::path static GetAutostartDir()
{
namespace fs = boost::filesystem;
char* pszConfigHome = getenv("XDG_CONFIG_HOME");
if (pszConfigHome) return fs::path(pszConfigHome) / "autostart";
char* pszHome = getenv("HOME");
if (pszHome) return fs::path(pszHome) / ".config" / "autostart";
return fs::path();
}
boost::filesystem::path static GetAutostartFilePath()
{
return GetAutostartDir() / "knavecoin.desktop";
}
bool GetStartOnSystemStartup()
{
boost::filesystem::ifstream optionFile(GetAutostartFilePath());
if (!optionFile.good())
return false;
// Scan through file for "Hidden=true":
std::string line;
while (!optionFile.eof())
{
getline(optionFile, line);
if (line.find("Hidden") != std::string::npos &&
line.find("true") != std::string::npos)
return false;
}
optionFile.close();
return true;
}
bool SetStartOnSystemStartup(bool fAutoStart)
{
if (!fAutoStart)
boost::filesystem::remove(GetAutostartFilePath());
else
{
char pszExePath[MAX_PATH+1];
memset(pszExePath, 0, sizeof(pszExePath));
if (readlink("/proc/self/exe", pszExePath, sizeof(pszExePath)-1) == -1)
return false;
boost::filesystem::create_directories(GetAutostartDir());
boost::filesystem::ofstream optionFile(GetAutostartFilePath(), std::ios_base::out|std::ios_base::trunc);
if (!optionFile.good())
return false;
// Write a bitcoin.desktop file to the autostart directory:
optionFile << "[Desktop Entry]\n";
optionFile << "Type=Application\n";
optionFile << "Name=Knavecoin\n";
optionFile << "Exec=" << pszExePath << " -min\n";
optionFile << "Terminal=false\n";
optionFile << "Hidden=false\n";
optionFile.close();
}
return true;
}
#elif defined(Q_OS_MAC)
// based on: https://github.com/Mozketo/LaunchAtLoginController/blob/master/LaunchAtLoginController.m
#include <CoreFoundation/CoreFoundation.h>
#include <CoreServices/CoreServices.h>
LSSharedFileListItemRef findStartupItemInList(LSSharedFileListRef list, CFURLRef findUrl);
LSSharedFileListItemRef findStartupItemInList(LSSharedFileListRef list, CFURLRef findUrl)
{
// loop through the list of startup items and try to find the bitcoin app
CFArrayRef listSnapshot = LSSharedFileListCopySnapshot(list, NULL);
for(int i = 0; i < CFArrayGetCount(listSnapshot); i++) {
LSSharedFileListItemRef item = (LSSharedFileListItemRef)CFArrayGetValueAtIndex(listSnapshot, i);
UInt32 resolutionFlags = kLSSharedFileListNoUserInteraction | kLSSharedFileListDoNotMountVolumes;
CFURLRef currentItemURL = NULL;
LSSharedFileListItemResolve(item, resolutionFlags, ¤tItemURL, NULL);
if(currentItemURL && CFEqual(currentItemURL, findUrl)) {
// found
CFRelease(currentItemURL);
return item;
}
if(currentItemURL) {
CFRelease(currentItemURL);
}
}
return NULL;
}
bool GetStartOnSystemStartup()
{
CFURLRef bitcoinAppUrl = CFBundleCopyBundleURL(CFBundleGetMainBundle());
LSSharedFileListRef loginItems = LSSharedFileListCreate(NULL, kLSSharedFileListSessionLoginItems, NULL);
LSSharedFileListItemRef foundItem = findStartupItemInList(loginItems, bitcoinAppUrl);
return !!foundItem; // return boolified object
}
bool SetStartOnSystemStartup(bool fAutoStart)
{
CFURLRef bitcoinAppUrl = CFBundleCopyBundleURL(CFBundleGetMainBundle());
LSSharedFileListRef loginItems = LSSharedFileListCreate(NULL, kLSSharedFileListSessionLoginItems, NULL);
LSSharedFileListItemRef foundItem = findStartupItemInList(loginItems, bitcoinAppUrl);
if(fAutoStart && !foundItem) {
// add bitcoin app to startup item list
LSSharedFileListInsertItemURL(loginItems, kLSSharedFileListItemBeforeFirst, NULL, NULL, bitcoinAppUrl, NULL, NULL);
}
else if(!fAutoStart && foundItem) {
// remove item
LSSharedFileListItemRemove(loginItems, foundItem);
}
return true;
}
#else
bool GetStartOnSystemStartup() { return false; }
bool SetStartOnSystemStartup(bool fAutoStart) { return false; }
#endif
HelpMessageBox::HelpMessageBox(QWidget *parent) :
QMessageBox(parent)
{
header = tr("Knavecoin-Qt") + " " + tr("version") + " " +
QString::fromStdString(FormatFullVersion()) + "\n\n" +
tr("Usage:") + "\n" +
" knavecoin-qt [" + tr("command-line options") + "] " + "\n";
coreOptions = QString::fromStdString(HelpMessage());
uiOptions = tr("UI options") + ":\n" +
" -lang=<lang> " + tr("Set language, for example \"de_DE\" (default: system locale)") + "\n" +
" -min " + tr("Start minimized") + "\n" +
" -splash " + tr("Show splash screen on startup (default: 1)") + "\n";
setWindowTitle(tr("Knavecoin-Qt"));
setTextFormat(Qt::PlainText);
// setMinimumWidth is ignored for QMessageBox so put in non-breaking spaces to make it wider.
setText(header + QString(QChar(0x2003)).repeated(50));
setDetailedText(coreOptions + "\n" + uiOptions);
}
void HelpMessageBox::printToConsole()
{
// On other operating systems, the expected action is to print the message to the console.
QString strUsage = header + "\n" + coreOptions + "\n" + uiOptions;
fprintf(stdout, "%s", strUsage.toStdString().c_str());
}
void HelpMessageBox::showOrPrint()
{
#if defined(WIN32)
// On Windows, show a message box, as there is no stderr/stdout in windowed applications
exec();
#else
// On other operating systems, print help text to console
printToConsole();
#endif
}
} // namespace GUIUtil
| [
"jr.white@yandex.ru"
] | jr.white@yandex.ru |
17cc2c08931cbb9d52fd9fdbbf5667ba64d408c0 | 6af6b0f70a6730d5fdfe9d18f87b580e80c7150f | /RLogin/RLoginDoc.h | 57f71a40d7539e62e5bc22e2ec3df8bd50f8c44a | [
"MIT"
] | permissive | santhosh-v/RLogin | 1d5550ac7aa8e0eef6705b2417b8faf980223b1a | f3ab15b265e5d3025ba04116d66e4ee7ce4f055a | refs/heads/master | 2021-01-07T20:55:23.401071 | 2020-01-20T07:10:18 | 2020-01-20T07:10:18 | null | 0 | 0 | null | null | null | null | SHIFT_JIS | C++ | false | false | 7,707 | h | // RLoginDoc.h : CRLoginDoc クラスの宣言およびインターフェイスの定義をします。
//
/////////////////////////////////////////////////////////////////////////////
#if !defined(AFX_RLOGINDOC_H__E9C04D5B_EA6E_4FFB_8827_C5263E3D30E6__INCLUDED_)
#define AFX_RLOGINDOC_H__E9C04D5B_EA6E_4FFB_8827_C5263E3D30E6__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include "TextRam.h"
#include "ExtSocket.h"
#include "BPlus.h"
#include "ZModem.h"
#include "Kermit.h"
#include "Data.h"
#define DOCUMENT_MAX 200
#define DOCTYPE_NONE (-1)
#define DOCTYPE_REGISTORY 0
#define DOCTYPE_ENTRYFILE 1
#define DOCTYPE_MULTIFILE 2
#define DOCTYPE_SESSION 3
#define UPDATE_INVALIDATE 0
#define UPDATE_TEXTRECT 1
#define UPDATE_GOTOXY 2
#define UPDATE_CLIPERA 3
#define UPDATE_INITPARA 4
#define UPDATE_VISUALBELL 5
#define UPDATE_INITSIZE 6
#define UPDATE_SETCURSOR 7
#define UPDATE_TYPECARET 8
#define UPDATE_TEKFLUSH 9
#define UPDATE_RESIZE 10
#define UPDATE_CANCELBTN 11
#define UPDATE_DISPINDEX 12
#define UPDATE_WAKEUP 13
#define UPDATE_SCROLLOUT 14
#define UPDATE_UPDATEWINDOW 15
#define UPDATE_CLIPCLAER 16
#define UPDATE_DISPMSG 17
#define CARET_MOVE 0
#define CARET_CREATE 1
#define CARET_DESTROY 2
#define PROTO_DIRECT 0
#define PROTO_LOGIN 1
#define PROTO_TELNET 2
#define PROTO_SSH 3
#define PROTO_COMPORT 4
#define PROTO_PIPE 5
#define DELAY_ECHO_MSEC 1000
#define DELAY_CLOSE_SOCKET 3000
#define LOGDEBUG_NONE 0
#define LOGDEBUG_RECV 1
#define LOGDEBUG_SEND 2
#define LOGDEBUG_INSIDE 3
#define LOGDEBUG_FLASH 4
class CRLoginDoc : public CDocument
{
DECLARE_DYNCREATE(CRLoginDoc)
protected: // シリアライズ機能のみから作成します。
CRLoginDoc();
public:
virtual ~CRLoginDoc();
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif
// オペレーション
public:
CExtSocket *m_pSock;
CTextRam m_TextRam;
CKeyNodeTab m_KeyTab;
CKeyMacTab m_KeyMac;
CParamTab m_ParamTab;
CServerEntry m_ServerEntry;
CFileExt *m_pLogFile;
CBPlus *m_pBPlus;
CZModem *m_pZModem;
CKermit *m_pKermit;
int m_DelayFlag;
CBuffer m_DelayBuf;
BOOL m_bDelayPast;
CMainFrame *m_pMainWnd;
CString m_SockStatus;
CStrScript *m_pStrScript;
CString m_ErrorPrompt;
CString m_SearchStr;
CStringA m_WorkMbs;
CString m_WorkStr;
class CScript *m_pScript;
BOOL m_InPane;
int m_AfterId;
CString m_CmdsPath;
int m_LogSendRecv;
CString m_ScriptFile;
BOOL m_bReqDlg;
CString m_CmdLine;
CString m_TitleName;
BOOL m_bCastLock;
BOOL m_bExitPause;
time_t m_ConnectTime;
time_t m_CloseTime;
class CStatusDlg *m_pStatusWnd;
class CStatusDlg *m_pMediaCopyWnd;
CWordArray m_OptFixCheck;
static void LoadOption(CServerEntry &ServerEntry, CTextRam &TextRam, CKeyNodeTab &KeyTab, CKeyMacTab &KeyMac, CParamTab &ParamTab);
static void SaveOption(CServerEntry &ServerEntry, CTextRam &TextRam, CKeyNodeTab &KeyTab, CKeyMacTab &KeyMac, CParamTab &ParamTab);
static void LoadIndex(CServerEntry &ServerEntry, CTextRam &TextRam, CKeyNodeTab &KeyTab, CKeyMacTab &KeyMac, CParamTab &ParamTab, CStringIndex &index);
static void SaveIndex(CServerEntry &ServerEntry, CTextRam &TextRam, CKeyNodeTab &KeyTab, CKeyMacTab &KeyMac, CParamTab &ParamTab, CStringIndex &index);
static void DiffIndex(CServerEntry &ServerEntry, CTextRam &TextRam, CKeyNodeTab &KeyTab, CKeyMacTab &KeyMac, CParamTab &ParamTab, CServerEntry &OrigEntry, CStringIndex &index);
static void LoadInitOption(CTextRam &TextRam, CKeyNodeTab &KeyTab, CKeyMacTab &KeyMac, CParamTab &ParamTab);
static void LoadDefOption(CTextRam &TextRam, CKeyNodeTab &KeyTab, CKeyMacTab &KeyMac, CParamTab &ParamTab);
static void SaveDefOption(CTextRam &TextRam, CKeyNodeTab &KeyTab, CKeyMacTab &KeyMac, CParamTab &ParamTab);
inline void SetIndex(int mode, CStringIndex &index) { if ( mode ) SaveIndex(m_ServerEntry, m_TextRam, m_KeyTab, m_KeyMac, m_ParamTab, index); else LoadIndex(m_ServerEntry, m_TextRam, m_KeyTab, m_KeyMac, m_ParamTab, index); }
void SetMenu(CMenu *pMenu);
BOOL InitDocument();
static void EnvironText(CString &env, CString &str);
static void EnvironPath(CString &path);
BOOL EntryText(CString &name, LPCWSTR match = NULL);
BOOL ScriptInit();
void SendBuffer(CBuffer &buf, BOOL macflag = TRUE);
void SendScript(LPCWSTR str, LPCWSTR match);
void OnReceiveChar(DWORD ch, int pos);
void OnSendBuffer(CBuffer &buf);
int DelaySend();
void OnDelayReceive(int ch);
void InitOptFixCheck(int Uid);
BOOL SetOptFixEntry(LPCTSTR entryName);
int SocketOpen();
void SocketClose();
int SocketReceive(void *lpBuf, int nBufLen);
void SocketSend(void *lpBuf, int nBufLen, BOOL delaySend = FALSE);
LPCSTR Utf8Str(LPCTSTR str);
LPCSTR RemoteStr(LPCTSTR str);
LPCTSTR LocalStr(LPCSTR str);
void OnSocketConnect();
void OnSocketError(int err);
void OnSocketClose();
int OnSocketReceive(LPBYTE lpBuf, int nBufLen, int nFlags);
void SetDocTitle();
inline void SetStatus(LPCTSTR str) { m_SockStatus = str; SetDocTitle(); }
inline void SetEntryProBuffer() { SaveOption(m_ServerEntry, m_TextRam, m_KeyTab, m_KeyMac, m_ParamTab); }
void SetCmdInfo(CCommandLineInfoEx *pCmdInfo);
void DoDropFile();
CWnd *GetAciveView();
int GetViewCount();
BOOL IsCanExit();
BOOL LogOpen(LPCTSTR filename);
BOOL LogClose();
void LogWrite(LPBYTE lpBuf, int nBufLen, int SendRecv);
void LogDebug(LPCSTR str, ...);
void LogDump(LPBYTE lpBuf, int nBufLen);
void LogInit();
void ScriptInit(int cmds, int shift, class CScriptValue &value);
void ScriptValue(int cmds, class CScriptValue &value, int mode);
void OnIdle();
//オーバーライド
protected:
virtual void Serialize(CArchive& ar);
virtual void DeleteContents();
virtual BOOL OnNewDocument();
virtual BOOL OnOpenDocument(LPCTSTR lpszPathName);
public:
virtual BOOL DoFileSave();
// インプリメンテーション
protected:
DECLARE_MESSAGE_MAP()
afx_msg void OnFileClose();
afx_msg void OnCancelBtn();
afx_msg void OnLogOpen();
afx_msg void OnUpdateLogOpen(CCmdUI* pCmdUI);
afx_msg void OnChatStop();
afx_msg void OnUpdateChatStop(CCmdUI *pCmdUI);
afx_msg void OnSftp();
afx_msg void OnUpdateSftp(CCmdUI* pCmdUI);
afx_msg void OnKanjiCodeSet(UINT nID);
afx_msg void OnUpdateKanjiCodeSet(CCmdUI* pCmdUI);
afx_msg void OnXYZModem(UINT nID);
afx_msg void OnUpdateXYZModem(CCmdUI* pCmdUI);
afx_msg void OnSendBreak();
afx_msg void OnUpdateSendBreak(CCmdUI *pCmdUI);
afx_msg void OnTekdisp();
afx_msg void OnUpdateTekdisp(CCmdUI *pCmdUI);
afx_msg void OnSocketstatus();
afx_msg void OnUpdateSocketstatus(CCmdUI *pCmdUI);
afx_msg void OnScript();
afx_msg void OnUpdateScript(CCmdUI *pCmdUI);
afx_msg void OnImagedisp();
afx_msg void OnUpdateImagedisp(CCmdUI *pCmdUI);
afx_msg void OnSockReOpen();
afx_msg void OnTracedisp();
afx_msg void OnUpdateTracedisp(CCmdUI *pCmdUI);
afx_msg void OnCommoniter();
afx_msg void OnUpdateCommoniter(CCmdUI *pCmdUI);
afx_msg void OnLoadDefault();
afx_msg void OnSaveDefault();
afx_msg void OnSetOption();
afx_msg void OnScreenReset(UINT nID);
afx_msg void OnUpdateResetSize(CCmdUI *pCmdUI);
afx_msg void OnScriptMenu(UINT nID);
afx_msg void OnTitleedit();
};
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ は前行の直前に追加の宣言を挿入します。
#endif // !defined(AFX_RLOGINDOC_H__E9C04D5B_EA6E_4FFB_8827_C5263E3D30E6__INCLUDED_)
| [
"kmiya@gem.or.jp"
] | kmiya@gem.or.jp |
9a532df484995fe88a2e2d549881aff9671760a7 | a78ff598ae74b412a4fc93a5f84e2cd9882f4026 | /Numbers/change.cpp | 5bfadc11fcb69c6933f5a29ae68005fa3c0cf001 | [] | no_license | alexako/Projects | 4868543238d3dbcfb23fdc3151cdbf46c5f91c11 | 69533fa1eb648c421bcfbfc8d2841bee5e785bf9 | refs/heads/master | 2021-01-16T00:17:22.592209 | 2016-01-04T14:17:20 | 2016-01-04T14:17:20 | 11,689,381 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 1,381 | cpp | #include <iostream>
#include <iomanip>
#include <cmath>
using namespace std;
int main() {
int dollars,
quarters,
dimes,
nickels,
pennies;
double cost,
payment,
change;
cout << showpoint << fixed << setprecision(2);
cout << "Enter cost of item: $";
cin >> cost;
cout << "Enter amount tendered: $";
cin >> payment;
while (cost > payment) {
cerr << "Ask customer for $" << change << " more." << endl;
cout << "Enter amount tendered: $";
cin >> payment;
}
change = payment - cost;
dollars = change;
quarters = fmod(change, 1.0) / 0.25;
dimes = fmod(change, 0.25) / 0.10;
nickels = fmod(fmod(change, 0.25), 0.10) / 0.05;
pennies = fmod(fmod(fmod(change, 0.25), 0.10), 0.05) / 0.01;
cout << endl << "Breakdown: " << endl
<< "Dollars: " << dollars << "\t = " << dollars * 1.00 << endl
<< "Quarters: " << quarters << "\t = " << quarters * 0.25 << endl
<< "Dimes: " << dimes << "\t = " << dimes * 0.10 << endl
<< "Nickels: " << nickels << "\t = " << nickels * 0.05 << endl
<< "Pennies: " << pennies << "\t = " << pennies * 0.01 << endl;
for (int i = 0; i < 30; i++) {
cout << "_";
}
cout << endl
<< "Total amount due: \t$" << change << endl;
return 0;
}
| [
"akosialexpo@gmail.com"
] | akosialexpo@gmail.com |
15b79a15ba2199c644effaf0ea95916c7acd75e4 | 7e5e5e2f195b1e1b6204988adcaae7a20611b696 | /lkg/2014-12-26/ImgDat.h | 8d1590bceb36ece5bd0bdb1d8514cb682b1bfab0 | [] | no_license | Preppy/PalMod | 08194536fab486f3562666f9eba8de908cb208c2 | 6b8b57db3f4ec90965a4ef73a0f90b8096dcd4ee | refs/heads/master | 2023-08-24T20:34:27.611939 | 2023-08-22T04:37:53 | 2023-08-22T04:37:53 | 239,400,781 | 31 | 23 | null | 2023-09-01T17:50:29 | 2020-02-10T01:05:30 | C++ | UTF-8 | C++ | false | false | 1,016 | h | #pragma once
#define MAX_GAMES 4
#define MAX_IMAGE 16
struct sImgDef
{
UINT16 uImgWidth;
UINT16 uImgHeight;
UINT8 bCompressed;
UINT32 uDataSize;
UINT32 uThisImgLoc;
UINT8 * pImgData;
};
class CImgDat
{
private:
sImgDef *** ppImgData;
sImgDef * pLastImg[MAX_IMAGE];
int nLastImgCt;
UINT8 uCurrUnitAmt;
UINT8 uCurrImgAmt;
UINT8 uReadGameFlag, uReadBPP;
UINT16 uReadNumImgs;
UINT32 uNextImgLoc;
int nCurrGFlag;
void PrepImageBuffer(UINT8 uUnitAmt, UINT8 uImgAmt);
CFile ImgDatFile;
BOOL bOnTheFly;
public:
CImgDat(void);
~CImgDat(void);
BOOL LoadImage(CHAR * lpszLoadFile, UINT8 uGameFlag, UINT8 uUnitAmt, UINT16 uImgAmt = MAX_IMAGE, BOOL bLoadAll = TRUE);
sImgDef * GetImageDef(UINT8 uUnitId, UINT8 uImgId);
void FlushImageBuffer();
UINT8 * DecodeImg(UINT8 * pSrcImgData, UINT32 uiDataSz, UINT16 uiImgWidth, UINT16 uiImgHeight, UINT8 uiBPP);
int GetCurrGFlag(){return nCurrGFlag;};
UINT8 * GetImgData(sImgDef * pCurrImg);
void CloseImgFile();
void FlushLastImg();
};
| [
"meandyouftw@gmail.com"
] | meandyouftw@gmail.com |
80a312ec026c51e6b5b7718ebce19afa628b1ff1 | 317f2542cd92aa527c2e17af5ef609887a298766 | /tools/target_10_2_0_1155/qnx6/usr/include/qt4/QtSensors/qlightsensor.h | 35f4960b4df62a6e15815cbd22216a950211deb1 | [] | no_license | sborpo/bb10qnx | ec77f2a96546631dc38b8cc4680c78a1ee09b2a8 | 33a4b75a3f56806f804c7462d5803b8ab11080f4 | refs/heads/master | 2020-07-05T06:53:13.352611 | 2014-12-12T07:39:35 | 2014-12-12T07:39:35 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,933 | h | /****************************************************************************
**
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the Qt Mobility Components.
**
** $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 Digia. For licensing terms and
** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met: http://www.gnu.org/copyleft/gpl.html.
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef QLIGHTSENSOR_H
#define QLIGHTSENSOR_H
#include <qsensor.h>
QTM_BEGIN_NAMESPACE
class QLightReadingPrivate;
class Q_SENSORS_EXPORT QLightReading : public QSensorReading
{
Q_OBJECT
Q_PROPERTY(qreal lux READ lux)
DECLARE_READING(QLightReading)
public:
qreal lux() const;
void setLux(qreal lux);
};
class Q_SENSORS_EXPORT QLightFilter : public QSensorFilter
{
public:
virtual bool filter(QLightReading *reading) = 0;
private:
bool filter(QSensorReading *reading) { return filter(static_cast<QLightReading*>(reading)); }
};
class Q_SENSORS_EXPORT QLightSensor : public QSensor
{
Q_OBJECT
#ifdef Q_QDOC
Q_PROPERTY(qreal fieldOfView)
#endif
public:
explicit QLightSensor(QObject *parent = 0) : QSensor(QLightSensor::type, parent) {}
virtual ~QLightSensor() {}
QLightReading *reading() const { return static_cast<QLightReading*>(QSensor::reading()); }
static char const * const type;
};
QTM_END_NAMESPACE
#endif
| [
"dev@dclark.us"
] | dev@dclark.us |
f6bc5f1a0dd8d9547d90213d67cbf480069fb13b | 25f4591f2b323f562e2fc8d6b1cbb816c49dc919 | /filesystem.cpp | f21a7fffbfe7a188718100927848195555aed4c6 | [] | no_license | sashabritov/FileSystem | 1d5392361e90dae28cfc7570b43d73efaab34b47 | 3e2a8d58520156b2373196319ca0ea8ad2e3104d | refs/heads/master | 2020-03-15T05:58:42.294761 | 2018-05-08T17:12:27 | 2018-05-08T17:12:27 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,764 | cpp | #include "filesystem.h"
#include <math.h>
#include <fstream>
#include <array>
const char* DATA_FILE = "d:\\data.fs";
const int SIZE = 200;
FileSystem::FileSystem()
{
index = 0;
Format();
InitFs();
NewFile("/", "");
NewFile("111", "txt");
NewFile("222", "fff");
NewFile("3333", "data");
SaveFs();
//LoadFs();
}
void FileSystem::Format()
{
for (unsigned int i = 0; i < VOLUME_SIZE_IN_CLUSTERS; i++)
{
fileTable[i] = 0;
}
fileArray.clear();
index = 0;
for (int i = 0; i < VOLUME_SIZE_IN_CLUSTERS; i++)
{
dataTable[i] = new Cluster();
}
InitFs();
}
void FileSystem::NewFile(QString name, QString ext)
{
File* newFile = new File(name, ext, GetNextFreeIndex());
fileArray.push_back(newFile);
//select by file size
//int cluster_count = (int) ceil(newFile->GetSize() / CLUSTER_SIZE) + 1;
/*for (int i=0; i<cluster_count; i++)
{
fileTable[index] = ++index;
}*/
/*Cluster* cluster = getFreeCluster();
if(cluster)
{
}*/
//fileTable[index] = 0xFFFF;
}
void FileSystem::CopyFile(File* oldFile, QString newName, QString newExt)
{
File* newFile = new File(newName, newExt, index);
fileArray.push_back(newFile);
int cluster_count = (int) ceil(oldFile->GetSize() / CLUSTER_SIZE) + 1;
for (int i=0; i<cluster_count; i++)
{
int nextIndex = GetNextFreeIndex();
fileTable[index] = nextIndex;
index = nextIndex;
}
fileTable[index] = 0xFFFF;
}
void FileSystem::RemoveFile(File* file)
{
int fileIndex = file->indexCluster;
int nextIndex = fileIndex;
while (fileTable[fileIndex] != 0xFFFF);
{
nextIndex = fileTable[fileIndex];
fileTable[fileIndex] = 0x0;
fileIndex = nextIndex;
}
fileTable[nextIndex] = 0x0;
fileArray.erase(std::remove(fileArray.begin(), fileArray.end(), file), fileArray.end());
}
void FileSystem::MoveFile(QString newName)
{
// TODO
}
std::vector<QString> FileSystem::GetFiles()
{
std::vector<QString> resVector;
std::vector<File*>::iterator it;
for(it = fileArray.begin(); it != fileArray.end(); it++)
{
resVector.push_back((*it)->name + "." + (*it)->extension);
}
return resVector;
}
int FileSystem::GetNextFreeIndex()
{
// TODO - check size.
for (int i = 0; i < VOLUME_SIZE_IN_CLUSTERS; i++)
{
if (!fileTable[i])
{
//fileTable[index] = i;
fileTable[i] = 0xFFFF;
return i;
}
}
return NULL;
}
void FileSystem::LoadFs()
{
std::ifstream inFile(DATA_FILE, std::ifstream::binary);
int countFiles;
inFile >> countFiles;
// infile.seekg (0,infile.end);
// long size = infile.tellg();
// char* buffer = new char[size];
// inFile.seekg (0);
for (int i = 0; i < VOLUME_SIZE_IN_CLUSTERS; i++)
{
inFile >> fileTable[i];
}
File* f;
char buffer[32];
for (int i = 0; i < countFiles; i++)
{
//inFile >> f;
//fileArray.push_back(f);
//inFile.read(buffer, 32);
//fileArray.push_back(new File(buffer));
}
inFile.close();
}
void FileSystem::InitFs()
{
std::ofstream outfile(DATA_FILE, std::ofstream::binary);
long size=1024*1024; // 1MB
char* buffer = new char[size];
for (int i = 0; i < SIZE; i++)
{
outfile.write(buffer,size);
}
delete[] buffer;
outfile.close();
}
void FileSystem::SaveFs()
{
std::ofstream outFile(DATA_FILE, std::ofstream::binary);
outFile << fileArray.size();
// file table section
char* t_str = new char;
for(int i = 0; i < VOLUME_SIZE_IN_CLUSTERS; i++)
{
itoa(fileTable[i], t_str, 10);
outFile.write(t_str, sizeof(int));
}
// file array section
std::vector<File*>::iterator it;
for(it = fileArray.begin(); it != fileArray.end(); it++)
{
std::string data = (*it)->GetByteArray();
outFile.write(data.c_str(), 32);
}
// data storage section
for(int i = 0; i < VOLUME_SIZE_IN_CLUSTERS; i++)
//for(int i = 0; i < 1024; i++)
{
outFile.write(dataTable[i]->data, CLUSTER_SIZE);
}
outFile.close();
}
void FileSystem::NewFolder(QString name)
{
File* newFolder = new File(name, "", GetNextFreeIndex());
newFolder->attr = '1';
fileArray.push_back(newFolder);
}
/*void FileSystem::loadFolder(File *file)
{
}*/
/*Cluster* FileSystem::getFreeCluster()
{
for(int i = 0; i < VOLUME_SIZE_IN_CLUSTERS; i++)
{
if(!dataTable[i]->isBusy)
{
return dataTable[i];
}
}
return NULL;
}*/
void FileSystem::editFile(File *f)
{
}
void FileSystem::editFolder(File *f)
{
}
| [
"britov333@gmail.com"
] | britov333@gmail.com |
f42689fd52fa7f7a74db4318bdf619a6d608b52d | d596933965dce8ddaff0f0e4b00b4ef7b67358f8 | /cocos2dx/include/ccTypes.h | 9fd46566dda2358f0faeffa494648525649da2a0 | [
"MIT"
] | permissive | Blavtes/cocos2d-x | 79f4f02b6d672325783b2acd4491f14d36d3f361 | e7159a70dedc809cd9d0474c77e8cddd54f7a7fe | refs/heads/master | 2021-01-01T18:23:22.600349 | 2013-12-18T06:33:54 | 2013-12-18T06:33:54 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 10,326 | h | /****************************************************************************
Copyright (c) 2010-2012 cocos2d-x.org
Copyright (c) 2008-2010 Ricardo Quesada
Copyright (c) 2011 Zynga Inc.
http://www.cocos2d-x.org
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 __CCTYPES_H__
#define __CCTYPES_H__
#include <string>
#include "cocoa/CCGeometry.h"
#include "CCGL.h"
NS_CC_BEGIN
/** RGB color composed of bytes 3 bytes
@since v0.8
*/
typedef struct _ccColor3B
{
GLubyte r;
GLubyte g;
GLubyte b;
} ccColor3B;
//! helper macro that creates an ccColor3B type
static inline ccColor3B
ccc3(const GLubyte r, const GLubyte g, const GLubyte b)
{
ccColor3B c = {r, g, b};
return c;
}
/** returns true if both ccColor3B are equal. Otherwise it returns false.
*/
static inline bool ccc3BEqual(const ccColor3B &col1, const ccColor3B &col2)
{
return col1.r == col2.r && col1.g == col2.g && col1.b == col2.b;
}
//ccColor3B predefined colors
//! White color (255,255,255)
static const ccColor3B ccWHITE={255,255,255};
//! Yellow color (255,255,0)
static const ccColor3B ccYELLOW={255,255,0};
//! Blue color (0,0,255)
static const ccColor3B ccBLUE={0,0,255};
//! Green Color (0,255,0)
static const ccColor3B ccGREEN={0,255,0};
//! Red Color (255,0,0,)
static const ccColor3B ccRED={255,0,0};
//! Magenta Color (255,0,255)
static const ccColor3B ccMAGENTA={255,0,255};
//! Black Color (0,0,0)
static const ccColor3B ccBLACK={0,0,0};
//! Orange Color (255,127,0)
static const ccColor3B ccORANGE={255,127,0};
//! Gray Color (166,166,166)
static const ccColor3B ccGRAY={166,166,166};
/** RGBA color composed of 4 bytes
@since v0.8
*/
typedef struct _ccColor4B
{
GLubyte r;
GLubyte g;
GLubyte b;
GLubyte a;
} ccColor4B;
//! helper macro that creates an ccColor4B type
static inline ccColor4B
ccc4(const GLubyte r, const GLubyte g, const GLubyte b, const GLubyte o)
{
ccColor4B c = {r, g, b, o};
return c;
}
/** RGBA color composed of 4 floats
@since v0.8
*/
typedef struct _ccColor4F {
GLfloat r;
GLfloat g;
GLfloat b;
GLfloat a;
} ccColor4F;
/** Returns a ccColor4F from a ccColor3B. Alpha will be 1.
@since v0.99.1
*/
static inline ccColor4F ccc4FFromccc3B(ccColor3B c)
{
ccColor4F c4 = {c.r/255.f, c.g/255.f, c.b/255.f, 1.f};
return c4;
}
//! helper that creates a ccColor4f type
static inline ccColor4F
ccc4f(const GLfloat r, const GLfloat g, const GLfloat b, const GLfloat a)
{
ccColor4F c4 = {r, g, b, a};
return c4;
}
/** Returns a ccColor4F from a ccColor4B.
@since v0.99.1
*/
static inline ccColor4F ccc4FFromccc4B(ccColor4B c)
{
ccColor4F c4 = {c.r/255.f, c.g/255.f, c.b/255.f, c.a/255.f};
return c4;
}
static inline ccColor4B ccc4BFromccc4F(ccColor4F c)
{
ccColor4B ret = {(GLubyte)(c.r*255), (GLubyte)(c.g*255), (GLubyte)(c.b*255), (GLubyte)(c.a*255)};
return ret;
}
/** returns YES if both ccColor4F are equal. Otherwise it returns NO.
@since v0.99.1
*/
static inline bool ccc4FEqual(ccColor4F a, ccColor4F b)
{
return a.r == b.r && a.g == b.g && a.b == b.b && a.a == b.a;
}
/** A vertex composed of 2 floats: x, y
@since v0.8
*/
typedef struct _ccVertex2F
{
GLfloat x;
GLfloat y;
} ccVertex2F;
static inline ccVertex2F vertex2(const float x, const float y)
{
ccVertex2F c = {x, y};
return c;
}
/** A vertex composed of 2 floats: x, y
@since v0.8
*/
typedef struct _ccVertex3F
{
GLfloat x;
GLfloat y;
GLfloat z;
} ccVertex3F;
static inline ccVertex3F vertex3(const float x, const float y, const float z)
{
ccVertex3F c = {x, y, z};
return c;
}
/** A texcoord composed of 2 floats: u, y
@since v0.8
*/
typedef struct _ccTex2F {
GLfloat u;
GLfloat v;
} ccTex2F;
static inline ccTex2F tex2(const float u, const float v)
{
ccTex2F t = {u , v};
return t;
}
//! Point Sprite component
typedef struct _ccPointSprite
{
ccVertex2F pos; // 8 bytes
ccColor4B color; // 4 bytes
GLfloat size; // 4 bytes
} ccPointSprite;
//! A 2D Quad. 4 * 2 floats
typedef struct _ccQuad2 {
ccVertex2F tl;
ccVertex2F tr;
ccVertex2F bl;
ccVertex2F br;
} ccQuad2;
//! A 3D Quad. 4 * 3 floats
typedef struct _ccQuad3 {
ccVertex3F bl;
ccVertex3F br;
ccVertex3F tl;
ccVertex3F tr;
} ccQuad3;
//! a Point with a vertex point, a tex coord point and a color 4B
typedef struct _ccV2F_C4B_T2F
{
//! vertices (2F)
ccVertex2F vertices;
//! colors (4B)
ccColor4B colors;
//! tex coords (2F)
ccTex2F texCoords;
} ccV2F_C4B_T2F;
//! a Point with a vertex point, a tex coord point and a color 4F
typedef struct _ccV2F_C4F_T2F
{
//! vertices (2F)
ccVertex2F vertices;
//! colors (4F)
ccColor4F colors;
//! tex coords (2F)
ccTex2F texCoords;
} ccV2F_C4F_T2F;
//! a Point with a vertex point, a tex coord point and a color 4B
typedef struct _ccV3F_C4B_T2F
{
//! vertices (3F)
ccVertex3F vertices; // 12 bytes
// char __padding__[4];
//! colors (4B)
ccColor4B colors; // 4 bytes
// char __padding2__[4];
// tex coords (2F)
ccTex2F texCoords; // 8 bytes
} ccV3F_C4B_T2F;
//! A Triangle of ccV2F_C4B_T2F
typedef struct _ccV2F_C4B_T2F_Triangle
{
//! Point A
ccV2F_C4B_T2F a;
//! Point B
ccV2F_C4B_T2F b;
//! Point B
ccV2F_C4B_T2F c;
} ccV2F_C4B_T2F_Triangle;
//! A Quad of ccV2F_C4B_T2F
typedef struct _ccV2F_C4B_T2F_Quad
{
//! bottom left
ccV2F_C4B_T2F bl;
//! bottom right
ccV2F_C4B_T2F br;
//! top left
ccV2F_C4B_T2F tl;
//! top right
ccV2F_C4B_T2F tr;
} ccV2F_C4B_T2F_Quad;
//! 4 ccVertex3FTex2FColor4B
typedef struct _ccV3F_C4B_T2F_Quad
{
//! top left
ccV3F_C4B_T2F tl;
//! bottom left
ccV3F_C4B_T2F bl;
//! top right
ccV3F_C4B_T2F tr;
//! bottom right
ccV3F_C4B_T2F br;
} ccV3F_C4B_T2F_Quad;
//! 4 ccVertex2FTex2FColor4F Quad
typedef struct _ccV2F_C4F_T2F_Quad
{
//! bottom left
ccV2F_C4F_T2F bl;
//! bottom right
ccV2F_C4F_T2F br;
//! top left
ccV2F_C4F_T2F tl;
//! top right
ccV2F_C4F_T2F tr;
} ccV2F_C4F_T2F_Quad;
//! Blend Function used for textures
typedef struct _ccBlendFunc
{
//! source blend function
GLenum src;
//! destination blend function
GLenum dst;
} ccBlendFunc;
static const ccBlendFunc kCCBlendFuncDisable = {GL_ONE, GL_ZERO};
// XXX: If any of these enums are edited and/or reordered, update CCTexture2D.m
//! Vertical text alignment type
typedef enum
{
kCCVerticalTextAlignmentTop,
kCCVerticalTextAlignmentCenter,
kCCVerticalTextAlignmentBottom,
} CCVerticalTextAlignment;
// XXX: If any of these enums are edited and/or reordered, update CCTexture2D.m
//! Horizontal text alignment type
typedef enum
{
kCCTextAlignmentLeft,
kCCTextAlignmentCenter,
kCCTextAlignmentRight,
} CCTextAlignment;
// types for animation in particle systems
// texture coordinates for a quad
typedef struct _ccT2F_Quad
{
//! bottom left
ccTex2F bl;
//! bottom right
ccTex2F br;
//! top left
ccTex2F tl;
//! top right
ccTex2F tr;
} ccT2F_Quad;
// struct that holds the size in pixels, texture coordinates and delays for animated CCParticleSystemQuad
typedef struct
{
ccT2F_Quad texCoords;
float delay;
CCSize size;
} ccAnimationFrameData;
/**
types used for defining fonts properties (i.e. font name, size, stroke or shadow)
*/
// shadow attributes
typedef struct _ccFontShadow
{
public:
// shadow is not enabled by default
_ccFontShadow(): m_shadowEnabled(false) {}
// true if shadow enabled
bool m_shadowEnabled;
// shadow x and y offset
CCSize m_shadowOffset;
// shadow blurrines
float m_shadowBlur;
// shadow opacity
float m_shadowOpacity;
// shadow color
ccColor3B m_shadowColor;
} ccFontShadow;
// stroke attributes
typedef struct _ccFontStroke
{
public:
// stroke is disabled by default
_ccFontStroke(): m_strokeEnabled(false) {}
// true if stroke enabled
bool m_strokeEnabled;
// stroke color
ccColor3B m_strokeColor;
// stroke size
float m_strokeSize;
} ccFontStroke;
// font attributes
/**
* @js NA
* @lua NA
*/
typedef struct _ccFontDefinition
{
public:
_ccFontDefinition(): m_alignment(kCCTextAlignmentCenter),
m_vertAlignment(kCCVerticalTextAlignmentTop),
m_fontFillColor(ccWHITE)
{ m_dimensions = CCSizeMake(0,0); }
// font name
std::string m_fontName;
// font size
int m_fontSize;
// horizontal alignment
CCTextAlignment m_alignment;
// vertical alignment
CCVerticalTextAlignment m_vertAlignment;
// renering box
CCSize m_dimensions;
// font color
ccColor3B m_fontFillColor;
// font shadow
ccFontShadow m_shadow;
// font stroke
ccFontStroke m_stroke;
} ccFontDefinition;
NS_CC_END
#endif //__CCTYPES_H__
| [
"yangyongios@163.com"
] | yangyongios@163.com |
4b6c605e6e7a5c46fe900cf1a55abcf297d79d71 | b7f3edb5b7c62174bed808079c3b21fb9ea51d52 | /third_party/blink/renderer/controller/oom_intervention_impl.h | a35e642c097443b225a095a57c2ad63eaf72a712 | [
"LGPL-2.0-or-later",
"GPL-1.0-or-later",
"MIT",
"Apache-2.0",
"LicenseRef-scancode-warranty-disclaimer",
"LGPL-2.1-only",
"GPL-2.0-only",
"LGPL-2.0-only",
"BSD-2-Clause",
"LicenseRef-scancode-other-copyleft",
"BSD-3-Clause"
] | permissive | otcshare/chromium-src | 26a7372773b53b236784c51677c566dc0ad839e4 | 64bee65c921db7e78e25d08f1e98da2668b57be5 | refs/heads/webml | 2023-03-21T03:20:15.377034 | 2020-11-16T01:40:14 | 2020-11-16T01:40:14 | 209,262,645 | 18 | 21 | BSD-3-Clause | 2023-03-23T06:20:07 | 2019-09-18T08:52:07 | null | UTF-8 | C++ | false | false | 2,899 | h | // Copyright 2017 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 THIRD_PARTY_BLINK_RENDERER_CONTROLLER_OOM_INTERVENTION_IMPL_H_
#define THIRD_PARTY_BLINK_RENDERER_CONTROLLER_OOM_INTERVENTION_IMPL_H_
#include <memory>
#include "mojo/public/cpp/bindings/pending_receiver.h"
#include "mojo/public/cpp/bindings/pending_remote.h"
#include "mojo/public/cpp/bindings/remote.h"
#include "third_party/blink/public/common/oom_intervention/oom_intervention_types.h"
#include "third_party/blink/public/mojom/oom_intervention/oom_intervention.mojom-blink.h"
#include "third_party/blink/renderer/controller/controller_export.h"
#include "third_party/blink/renderer/controller/memory_usage_monitor.h"
#include "third_party/blink/renderer/core/page/scoped_page_pauser.h"
#include "third_party/blink/renderer/platform/timer.h"
namespace blink {
class OomInterventionImplTest;
// Implementation of OOM intervention. This pauses all pages by using
// ScopedPagePauser when near-OOM situation is detected.
class CONTROLLER_EXPORT OomInterventionImpl
: public mojom::blink::OomIntervention,
public MemoryUsageMonitor::Observer {
public:
static void Create(
mojo::PendingReceiver<mojom::blink::OomIntervention> receiver);
OomInterventionImpl();
~OomInterventionImpl() override;
// mojom::blink::OomIntervention:
void StartDetection(
mojo::PendingRemote<mojom::blink::OomInterventionHost> host,
mojom::blink::DetectionArgsPtr detection_args,
bool renderer_pause_enabled,
bool navigate_ads_enabled,
bool purge_v8_memory_enabled) override;
// MemoryUsageMonitor::Observer:
void OnMemoryPing(MemoryUsage) override;
private:
FRIEND_TEST_ALL_PREFIXES(OomInterventionImplTest, DetectedAndDeclined);
FRIEND_TEST_ALL_PREFIXES(OomInterventionImplTest, StopWatchingAfterDetection);
FRIEND_TEST_ALL_PREFIXES(OomInterventionImplTest,
ContinueWatchingWithoutDetection);
FRIEND_TEST_ALL_PREFIXES(OomInterventionImplTest, V1DetectionAdsNavigation);
// Overridden by test.
virtual MemoryUsageMonitor& MemoryUsageMonitorInstance();
void Check(MemoryUsage);
void ReportMemoryStats(OomInterventionMetrics& current_memory);
void TimerFiredUMAReport(TimerBase*);
static void TriggerGC();
mojom::blink::DetectionArgsPtr detection_args_;
mojo::Remote<mojom::blink::OomInterventionHost> host_;
bool renderer_pause_enabled_ = false;
bool navigate_ads_enabled_ = false;
bool purge_v8_memory_enabled_ = false;
std::unique_ptr<ScopedPagePauser> pauser_;
OomInterventionMetrics metrics_at_intervention_;
int number_of_report_needed_ = 0;
TaskRunnerTimer<OomInterventionImpl> delayed_report_timer_;
};
} // namespace blink
#endif // THIRD_PARTY_BLINK_RENDERER_CONTROLLER_OOM_INTERVENTION_IMPL_H_
| [
"commit-bot@chromium.org"
] | commit-bot@chromium.org |
51c044fe79e5436e67955d69dedb0acd9957b14f | 3c6e121403d8ac51ed8fb49531edd27a0a837e5e | /framework/referencerenderer/rrMultisamplePixelBufferAccess.hpp | 51d4d1be88bc043d08a543203bc5b494971a948e | [
"Apache-2.0"
] | permissive | asimiklit/deqp | 024bac1d3846475ee31b355ead2bb617cc15fb60 | 016d98ac91022d7d1a9cd858b6c4ea6c4344b5bd | refs/heads/gbm | 2020-04-22T04:07:22.007712 | 2015-06-18T19:34:38 | 2015-06-18T19:34:38 | 170,111,899 | 0 | 0 | NOASSERTION | 2019-02-11T10:44:20 | 2019-02-11T10:44:18 | null | UTF-8 | C++ | false | false | 4,394 | hpp | #ifndef _RRMULTISAMPLEPIXELBUFFERACCESS_HPP
#define _RRMULTISAMPLEPIXELBUFFERACCESS_HPP
/*-------------------------------------------------------------------------
* drawElements Quality Program Reference Renderer
* -----------------------------------------------
*
* Copyright 2014 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*//*!
* \file
* \brief Multisampled pixel buffer access
*//*--------------------------------------------------------------------*/
#include "rrDefs.hpp"
#include "tcuTexture.hpp"
namespace rr
{
/*--------------------------------------------------------------------*//*!
* \brief Read-write pixel data access to multisampled buffers.
*
* Multisampled data access follows the multisampled indexing convention.
*
* Prevents accidental usage of non-multisampled buffer as multisampled
* with PixelBufferAccess.
*//*--------------------------------------------------------------------*/
class MultisamplePixelBufferAccess
{
MultisamplePixelBufferAccess (const tcu::PixelBufferAccess& rawAccess);
public:
MultisamplePixelBufferAccess (void);
inline const tcu::PixelBufferAccess& raw (void) const { return m_access; }
inline int getNumSamples (void) const { return raw().getWidth(); }
const tcu::PixelBufferAccess toSinglesampleAccess (void) const;
static MultisamplePixelBufferAccess fromSinglesampleAccess (const tcu::PixelBufferAccess& singlesampledAccess);
static MultisamplePixelBufferAccess fromMultisampleAccess (const tcu::PixelBufferAccess& multisampledAccess);
private:
tcu::PixelBufferAccess m_access;
};
/*--------------------------------------------------------------------*//*!
* \brief Read-only pixel data access to multisampled buffers.
*
* Multisampled data access follows the multisampled indexing convention.
*
* Prevents accidental usage of non-multisampled buffer as multisampled
* with PixelBufferAccess.
*//*--------------------------------------------------------------------*/
class MultisampleConstPixelBufferAccess
{
MultisampleConstPixelBufferAccess (const tcu::ConstPixelBufferAccess& rawAccess);
public:
MultisampleConstPixelBufferAccess (const rr::MultisamplePixelBufferAccess& msAccess);
MultisampleConstPixelBufferAccess (void);
inline const tcu::ConstPixelBufferAccess& raw (void) const { return m_access; }
inline int getNumSamples (void) const { return raw().getWidth(); }
const tcu::ConstPixelBufferAccess toSinglesampleAccess (void) const;
static MultisampleConstPixelBufferAccess fromSinglesampleAccess (const tcu::ConstPixelBufferAccess& singlesampledAccess);
static MultisampleConstPixelBufferAccess fromMultisampleAccess (const tcu::ConstPixelBufferAccess& multisampledAccess);
private:
tcu::ConstPixelBufferAccess m_access;
};
// Multisampled versions of tcu-utils
MultisamplePixelBufferAccess getSubregion (const MultisamplePixelBufferAccess& access, int x, int y, int width, int height);
MultisampleConstPixelBufferAccess getSubregion (const MultisampleConstPixelBufferAccess& access, int x, int y, int width, int height);
void resolveMultisampleColorBuffer (const tcu::PixelBufferAccess& dst, const MultisampleConstPixelBufferAccess& src);
tcu::Vec4 resolveMultisamplePixel (const MultisampleConstPixelBufferAccess& access, int x, int y);
void clear (const MultisamplePixelBufferAccess& access, const tcu::Vec4& color);
void clear (const MultisamplePixelBufferAccess& access, const tcu::IVec4& color);
void clearDepth (const MultisamplePixelBufferAccess& access, float depth);
void clearStencil (const MultisamplePixelBufferAccess& access, int stencil);
} // rr
#endif // _RRMULTISAMPLEPIXELBUFFERACCESS_HPP
| [
"jpoyry@google.com"
] | jpoyry@google.com |
61fed3e326c971b8ed171ed297cb10db5188ecfb | 19af2e1dfe389afc71e26bebaadf7008251e04e2 | /android_test/tensorflow-master/tensorflow/compiler/tf2tensorrt/plugin/trt_plugin_factory_test.cc | 99a144b1737d7974d4da5b92434dafadcf63ff22 | [
"Apache-2.0"
] | permissive | simi48/Ef-If_Jassen | 6c4975216bb4ae4514fe94a8395a5da5c8e8fb2d | 6076839492bff591cf9b457e949999e9167903e6 | refs/heads/master | 2022-10-15T15:36:35.023506 | 2020-12-02T10:38:13 | 2020-12-02T10:38:13 | 173,759,247 | 4 | 0 | Apache-2.0 | 2022-10-04T23:51:35 | 2019-03-04T14:22:28 | PureBasic | UTF-8 | C++ | false | false | 3,923 | cc | /* Copyright 2018 The TensorFlow Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/
#include "tensorflow/compiler/tf2tensorrt/plugin/trt_plugin_factory.h"
#include "tensorflow/compiler/tf2tensorrt/plugin/trt_plugin.h"
#include "tensorflow/core/lib/core/errors.h"
#include "tensorflow/core/lib/core/status.h"
#include "tensorflow/core/platform/test.h"
#include "tensorflow/core/platform/types.h"
#if GOOGLE_CUDA
#if GOOGLE_TENSORRT
#include "third_party/tensorrt/NvInfer.h"
namespace tensorflow {
namespace tensorrt {
namespace test {
class StubPlugin : public PluginTensorRT {
public:
static const char* kPluginName;
StubPlugin() : plugin_name_(kPluginName) {}
StubPlugin(const void* serialized_data, size_t length)
: PluginTensorRT(serialized_data, length) {}
const string& GetPluginName() const override { return plugin_name_; }
bool Finalize() override { return true; }
bool SetAttribute(const string& key, const void* ptr,
const size_t size) override {
return true;
}
bool GetAttribute(const string& key, const void** ptr,
size_t* size) const override {
return true;
}
int getNbOutputs() const override { return 1; }
nvinfer1::Dims getOutputDimensions(int index, const nvinfer1::Dims* inputs,
int nbInputDims) override {
return inputs[0];
}
int initialize() override { return 0; }
void terminate() override {}
size_t getWorkspaceSize(int maxBatchSize) const override { return 0; }
int enqueue(int batch_size, const void* const* inputs, void** outputs,
void* workspace, cudaStream_t stream) override {
return 0;
}
private:
const string plugin_name_;
};
const char* StubPlugin::kPluginName = "StubPlugin";
StubPlugin* CreateStubPlugin() { return new StubPlugin(); }
StubPlugin* CreateStubPluginDeserialize(const void* serialized_data,
size_t length) {
return new StubPlugin(serialized_data, length);
}
class TrtPluginFactoryTest : public ::testing::Test {
public:
bool RegisterStubPlugin() {
if (PluginFactoryTensorRT::GetInstance()->IsPlugin(
StubPlugin::kPluginName)) {
return true;
}
return PluginFactoryTensorRT::GetInstance()->RegisterPlugin(
StubPlugin::kPluginName, CreateStubPluginDeserialize, CreateStubPlugin);
}
};
TEST_F(TrtPluginFactoryTest, Registration) {
EXPECT_FALSE(
PluginFactoryTensorRT::GetInstance()->IsPlugin(StubPlugin::kPluginName));
EXPECT_TRUE(RegisterStubPlugin());
ASSERT_TRUE(
PluginFactoryTensorRT::GetInstance()->IsPlugin(StubPlugin::kPluginName));
}
TEST_F(TrtPluginFactoryTest, CreationDeletion) {
EXPECT_TRUE(RegisterStubPlugin());
ASSERT_TRUE(
PluginFactoryTensorRT::GetInstance()->IsPlugin(StubPlugin::kPluginName));
PluginFactoryTensorRT::GetInstance()->DestroyPlugins();
ASSERT_TRUE(PluginFactoryTensorRT::GetInstance()->CreatePlugin(
StubPlugin::kPluginName));
ASSERT_EQ(1, PluginFactoryTensorRT::GetInstance()->CountOwnedPlugins());
PluginFactoryTensorRT::GetInstance()->DestroyPlugins();
ASSERT_EQ(0, PluginFactoryTensorRT::GetInstance()->CountOwnedPlugins());
}
} // namespace test
} // namespace tensorrt
} // namespace tensorflow
#endif // GOOGLE_TENSORRT
#endif // GOOGLE_CUDA
| [
"TheSiebi@users.noreply.github.com"
] | TheSiebi@users.noreply.github.com |
4dc4a2fa83a4dab616e745d67732fbd013b6970e | 9685364bec1542c9291356de36fa517752244fab | /opencv3_example/ch2/002-opticalFlow.cpp | 91e1d59c92f1eaaf449bb8b89a9d956a26d947cc | [] | no_license | YujieShui/Learn_OpenCV | cfdf23a0631aa1425dd840cdaf1405a91b478b89 | a64ede227da6335808a05ab1865741a632cf76a6 | refs/heads/master | 2020-06-09T22:27:39.220462 | 2019-09-23T08:15:16 | 2019-09-23T08:15:16 | 193,518,478 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 6,241 | cpp | //--------------------------------------【程序说明】-------------------------------------------
// 程序说明:《OpenCV3编程入门》OpenCV3版书本配套示例程序09
// 程序描述:来自OpenCV安装目录下Samples文件夹中的官方示例程序-利用光流法进行运动目标检测
// 测试所用操作系统: Windows 7 64bit
// 测试所用IDE版本:Visual Studio 2010
// 测试所用OpenCV版本: 3.0 beta
// 2014年11月 Revised by @浅墨_毛星云
//------------------------------------------------------------------------------------------------
/************************************************************************
* Copyright(c) 2011 Yang Xian
* All rights reserved.
*
* File: opticalFlow.cpp
* Brief: lk光流法做运动目标检测
* Version: 1.0
* Author: Yang Xian
* Email: xyang2011@sinano.ac.cn
* Date: 2011/11/18
* History:
************************************************************************/
//---------------------------------【头文件、命名空间包含部分】----------------------------
// 描述:包含程序所使用的头文件和命名空间
//-------------------------------------------------------------------------------------------------
#include <opencv2/video/video.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/core/core.hpp>
#include <iostream>
#include <cstdio>
using namespace std;
using namespace cv;
//-----------------------------------【全局函数声明】-----------------------------------------
// 描述:声明全局函数
//-------------------------------------------------------------------------------------------------
void tracking(Mat &frame, Mat &output);
bool addNewPoints();
bool acceptTrackedPoint(int i);
//-----------------------------------【全局变量声明】-----------------------------------------
// 描述:声明全局变量
//-------------------------------------------------------------------------------------------------
string window_name = "optical flow tracking";
Mat gray; // 当前图片
Mat gray_prev; // 预测图片
vector<Point2f> points[2]; // point0为特征点的原来位置,point1为特征点的新位置
vector<Point2f> initial; // 初始化跟踪点的位置
vector<Point2f> features; // 检测的特征
int maxCount = 500; // 检测的最大特征数
double qLevel = 0.01; // 特征检测的等级
double minDist = 10.0; // 两特征点之间的最小距离
vector<uchar> status; // 跟踪特征的状态,特征的流发现为1,否则为0
vector<float> err;
//--------------------------------【help( )函数】----------------------------------------------
// 描述:输出帮助信息
//-------------------------------------------------------------------------------------------------
static void help()
{
//输出欢迎信息和OpenCV版本
cout <<"\n\n\t\t\t非常感谢购买《OpenCV3编程入门》一书!\n"
<<"\n\n\t\t\t此为本书OpenCV3版的第9个配套示例程序\n"
<< "\n\n\t\t\t 当前使用的OpenCV版本为:" << CV_VERSION
<<"\n\n ----------------------------------------------------------------------------" ;
}
//-----------------------------------【main( )函数】--------------------------------------------
// 描述:控制台应用程序的入口函数,我们的程序从这里开始
//-------------------------------------------------------------------------------------------------
int main()
{
Mat frame;
Mat result;
VideoCapture capture("images/2.avi");
help();
if(capture.isOpened()) // 摄像头读取文件开关
{
while(true)
{
capture >> frame;
if(!frame.empty())
{
tracking(frame, result);
}
else
{
printf(" --(!) No captured frame -- Break!");
break;
}
int c = waitKey(50);
if( (char)c == 27 )
{
break;
}
}
}
return 0;
}
//-------------------------------------------------------------------------------------------------
// function: tracking
// brief: 跟踪
// parameter: frame 输入的视频帧
// output 有跟踪结果的视频帧
// return: void
//-------------------------------------------------------------------------------------------------
void tracking(Mat &frame, Mat &output)
{
//此句代码的OpenCV3版为:
cvtColor(frame, gray, COLOR_BGR2GRAY);
//此句代码的OpenCV2版为:
//cvtColor(frame, gray, CV_BGR2GRAY);
frame.copyTo(output);
// 添加特征点
if (addNewPoints())
{
goodFeaturesToTrack(gray, features, maxCount, qLevel, minDist);
points[0].insert(points[0].end(), features.begin(), features.end());
initial.insert(initial.end(), features.begin(), features.end());
}
if (gray_prev.empty())
{
gray.copyTo(gray_prev);
}
// l-k光流法运动估计
calcOpticalFlowPyrLK(gray_prev, gray, points[0], points[1], status, err);
// 去掉一些不好的特征点
int k = 0;
for (size_t i=0; i<points[1].size(); i++)
{
if (acceptTrackedPoint(i))
{
initial[k] = initial[i];
points[1][k++] = points[1][i];
}
}
points[1].resize(k);
initial.resize(k);
// 显示特征点和运动轨迹
for (size_t i=0; i<points[1].size(); i++)
{
line(output, initial[i], points[1][i], Scalar(0, 0, 255));
circle(output, points[1][i], 3, Scalar(0, 255, 0), -1);
}
// 把当前跟踪结果作为下一此参考
swap(points[1], points[0]);
swap(gray_prev, gray);
imshow(window_name, output);
}
//-------------------------------------------------------------------------------------------------
// function: addNewPoints
// brief: 检测新点是否应该被添加
// parameter:
// return: 是否被添加标志
//-------------------------------------------------------------------------------------------------
bool addNewPoints()
{
return points[0].size() <= 10;
}
//-------------------------------------------------------------------------------------------------
// function: acceptTrackedPoint
// brief: 决定哪些跟踪点被接受
// parameter:
// return:
//-------------------------------------------------------------------------------------------------
bool acceptTrackedPoint(int i)
{
return status[i] && ((abs(points[0][i].x - points[1][i].x) + abs(points[0][i].y - points[1][i].y)) > 2);
} | [
"shuiyujie.cn@gmail.com"
] | shuiyujie.cn@gmail.com |
cedf6004bb51ba74ec7cf9879f23a15d52bbb2fd | 270f6259756f29cd26dd75e46682ff0dfa9ddeb8 | /AthenaBaseComps/AthenaBaseComps/AthAlgTool.h | 2efc542a4eb8ae6a7800cc139894dfa11b91786a | [] | no_license | atlas-control/control | 79066de6c24dc754808d5cecc11e679520957e00 | 8631c6b8edb576caf247c459c34e158c1b531f50 | refs/heads/master | 2016-08-12T03:03:51.372028 | 2016-02-28T22:29:15 | 2016-02-28T22:29:15 | 52,747,234 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 5,180 | h | ///////////////////////// -*- C++ -*- /////////////////////////////
// AthAlgTool.h
// Header file for class AthAlgTool
// Author: S.Binet<binet@cern.ch>
///////////////////////////////////////////////////////////////////
#ifndef ATHENABASECOMPS_ATHALGTOOL_H
#define ATHENABASECOMPS_ATHALGTOOL_H 1
// STL includes
#include <string>
// FrameWork includes
#include "GaudiKernel/AlgTool.h"
#include "GaudiKernel/MsgStream.h"
#include "GaudiKernel/ServiceHandle.h"
#include "AthenaBaseComps/AthMemMacros.h"
#include "AthenaBaseComps/AthMsgStreamMacros.h"
#include "AthenaBaseComps/AthCheckMacros.h"
#include "AthenaBaseComps/AthMessaging.h"
#include "StoreGate/StoreGateSvc.h"
#include "StoreGate/ReadHandle.h"
#include "StoreGate/UpdateHandle.h"
#include "StoreGate/WriteHandle.h"
#include "StoreGate/VarHandleProperty.h"
#include "AthenaKernel/IUserDataSvc.h"
class AthAlgTool :
public ::AlgTool,
public ::AthMessaging
{
///////////////////////////////////////////////////////////////////
// Public methods:
///////////////////////////////////////////////////////////////////
public:
// fwd compat w/ gaudi-21
using AthMessaging::msg;
// Copy constructor:
/// Constructor with parameters:
AthAlgTool( const std::string& type,
const std::string& name,
const IInterface* parent );
/// Destructor:
virtual ~AthAlgTool();
///////////////////////////////////////////////////////////////////
// Const methods:
///////////////////////////////////////////////////////////////////
/** @brief The standard @c StoreGateSvc (event store)
* Returns (kind of) a pointer to the @c StoreGateSvc
*/
ServiceHandle<StoreGateSvc>& evtStore() const;
/** @brief The standard @c StoreGateSvc/DetectorStore
* Returns (kind of) a pointer to the @c StoreGateSvc
*/
ServiceHandle<StoreGateSvc>& detStore() const;
/** @brief The standard @c UserDataSvc
* Returns (kind of) a pointer to the @c UserDataSvc
*/
ServiceHandle<IUserDataSvc>& userStore() const;
#ifdef ATHENAHIVE
/////////////////////////////////////////////////////////////////
//
//// For automatic registration of Handle data products
//
public:
using AlgTool::declareProperty;
template <class T>
Property* declareProperty(const std::string& name,
SG::ReadHandle<T>& hndl,
const std::string& doc="none") const {
AthAlgTool* aa = const_cast<AthAlgTool*>(this);
aa->declareInput(&hndl);
hndl.setOwner(aa);
return AlgTool::getPropertyMgr()->declareProperty(name,hndl,doc);
}
template <class T>
Property* declareProperty(const std::string& name,
SG::WriteHandle<T>& hndl,
const std::string& doc="none") const {
AthAlgTool* aa = const_cast<AthAlgTool*>(this);
aa->declareOutput(&hndl);
hndl.setOwner(aa);
return AlgTool::getPropertyMgr()->declareProperty(name,hndl,doc);
}
template <class T>
Property* declareProperty(const std::string& name,
SG::UpdateHandle<T>& hndl,
const std::string& doc="none") const {
AthAlgTool* aa = const_cast<AthAlgTool*>(this);
aa->declareInput(&hndl);
aa->declareOutput(&hndl);
hndl.setOwner(aa);
// std::cout << "---> declareProperty<UpdateHandle> " << hndl.name()
// << " fullKey: " << hndl.fullKey() << std::endl;
return AlgTool::getPropertyMgr()->declareProperty(name,hndl,doc);
}
#endif
///////////////////////////////////////////////////////////////////
// Non-const methods:
///////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////
// Protected methods:
///////////////////////////////////////////////////////////////////
protected:
/// callback for output level property
void msg_update_handler(Property& outputLevel);
///////////////////////////////////////////////////////////////////
// Private data:
///////////////////////////////////////////////////////////////////
private:
/// Default constructor:
AthAlgTool(); //> not implemented
AthAlgTool (const AthAlgTool&); //> not implemented
AthAlgTool& operator= (const AthAlgTool&); //> not implemented
typedef ServiceHandle<StoreGateSvc> StoreGateSvc_t;
/// Pointer to StoreGate (event store by default)
mutable StoreGateSvc_t m_evtStore;
/// Pointer to StoreGate (detector store by default)
mutable StoreGateSvc_t m_detStore;
typedef ServiceHandle<IUserDataSvc> UserDataSvc_t;
/// Pointer to IUserDataSvc
mutable UserDataSvc_t m_userStore;
};
///////////////////////////////////////////////////////////////////
// Inline methods:
///////////////////////////////////////////////////////////////////
inline
ServiceHandle<StoreGateSvc>& AthAlgTool::evtStore() const
{ return m_evtStore; }
inline
ServiceHandle<StoreGateSvc>& AthAlgTool::detStore() const
{ return m_detStore; }
inline
ServiceHandle<IUserDataSvc>& AthAlgTool::userStore() const
{ return m_userStore; }
#endif //> ATHENABASECOMPS_ATHALGTOOL_H
| [
"dguest@cern.ch"
] | dguest@cern.ch |
92ea9561003e07cf00e46bb477dd9fadcb32b0a1 | e4e5983a118cc1a89e688a18bf5a3a58c7eb7e79 | /AlgorithmicProblem/Solved/Books/Strategies/Strategies1/11_CombinatorialOptimization/Kakuro_11_7.cpp | 31c00b98e2140b457eb022518d938b01c2a1e2ad | [] | no_license | JaykayChoi/AlgorithmicProblem | 5c2375b48b49e13f9a82897510d2e1ee838b4a46 | a1a21bf95a4d7e8744887217c9e62378eb2f7a0e | refs/heads/master | 2021-09-06T02:13:02.549990 | 2018-02-01T15:50:05 | 2018-02-01T15:50:05 | 103,219,073 | 0 | 0 | null | null | null | null | UHC | C++ | false | false | 5,492 | cpp | #include "Utils.h"
using namespace std;
using namespace Utils;
#define FOR(i,a,b) for(int i = (a); i < (b); ++i)
#define REP(i,n) FOR(i,0,n)
#define FORE(it,x) for(typeof(x.begin()) it=x.begin();it!=x.end();++it)
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define CLEAR(x,with) memset(x,with,sizeof(x))
#define sz size()
typedef long long ll;
//https://algospot.com/judge/problem/read/KAKURO2
const int INF = 987654321;
const int WHITE = 1;
const int BLACK = 0;
const int MAXN = 55;
class Kakuro_11_7
{
public:
private:
int maskSum[1024], maskLen[1024];
void calcMasks() {
memset(maskSum, 0, sizeof(maskSum));
memset(maskLen, 0, sizeof(maskLen));
for (int mask = 0; mask < 1024; mask++) {
for (int i = 0; i < 10; i++)
if (mask & (1 << i)) {
maskSum[mask] += i;
maskLen[mask]++;
}
}
}
// mask 에 속한 원소들의 개수를 반환한다
int setSize(int mask) { return maskLen[mask]; }
// mask 에 속한 원소들의 합을 반환한다
int setSum(int mask) { return maskSum[mask]; }
// len 칸의 합이 sum 이고, 이 칸들에 이미 쓰인 수의 집합이 known 일 때
// 나머지 칸에 들어갈 수 있는 숫자의 집합을 반환한다
int getCandidates(int len, int sum, int known) {
int allSets = 0;
// 1~9 의 부분집합을 모두 생성하고, 그 중
for (int set = 0; set < 1024; set += 2)
// known 을 포함하고, 크기가 len 이며, 합이 sum 인 집합을 모두 찾는다
if ((set & known) == known && setSize(set) == len && setSum(set) == sum)
allSets |= set;
// known 에 이미 속한 숫자들은 답에서 제외한다
return allSets & ~known;
}
// candidates[len][sum][known] = getCandidates(len, sum, known)
int candidates[10][46][1024];
// candidates[][][] 를 미리 계산해 둔다
void generateCandidates() {
// 우선 전부 0 으로 초기화
memset(candidates, 0, sizeof(candidates));
// 1~9 의 부분집합을 전부 생성한다
for (int set = 0; set < 1024; set += 2) {
// 집합의 크기와 원소의 합을 계산해 둔다
int l = setSize(set), s = setSum(set);
// set 의 모든 부분집합에 대해 candidates[][][] 를 업데이트한다
int subset = set;
while (true) {
// 숫자 l 개의 합이 s 이고, 이미 subset 숫자가 쓰여 있을 때
// 전체 숫자의 집합이 set 이 되도록 나머지 숫자를 채워넣을 수 있다
candidates[l][s][subset] |= (set & ~subset);
if (subset == 0) break;
subset = (subset - 1) & set;
}
}
}
// 게임판의 정보
// color: 각 칸의 색깔 (0 = 검은 칸 혹은 힌트 칸, 1 = 흰 칸)
// value: 각 흰 칸에 쓴 숫자 (아직 쓰지 않은 칸은 0)
// hint: 각 칸에 해당하는 두 힌트의 번호
int n, color[MAXN][MAXN], value[MAXN][MAXN], hint[MAXN][MAXN][2];
// 각 힌트의 정보
// sum: 힌트 칸에 쓰인 숫자
// length: 힌트 칸에 해당하는 흰 칸의 수
// known: 힌트 칸에 해당하는 흰 칸에 쓰인 숫자들의 집합
int q, sum[MAXN*MAXN], length[MAXN*MAXN], known[MAXN*MAXN];
// (y,x) 에 val 을 쓴다
void put(int y, int x, int val) {
for (int h = 0; h < 2; h++)
known[hint[y][x][h]] += (1 << val);
value[y][x] = val;
}
// (y,x) 에 쓴 val 을 지운다
void remove(int y, int x, int val) {
for (int h = 0; h < 2; h++)
known[hint[y][x][h]] -= (1 << val);
value[y][x] = 0;
}
// 힌트 번호가 주어질 때 후보의 집합을 반환한다
int getCandHint(int hint) {
return candidates[length[hint]][sum[hint]][known[hint]];
}
// 좌표가 주어질 때 해당 칸에 들어갈 수 있는 후보의 집합을 반환한다
int getCandCoord(int y, int x) {
return getCandHint(hint[y][x][0]) & getCandHint(hint[y][x][1]);
}
void printSolution() {
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++)
printf("%s%d", (j ? " " : ""), value[i][j]);
printf("\n");
}
}
bool search() {
// 들어갈 수 있는 수의 종류가 최소인 칸을 찾아보자
int y = -1, x = -1, minCands = 1023;
for (int i = 0; i < n; i++)
for (int j = 0; j < n; j++)
if (color[i][j] == WHITE && value[i][j] == 0) {
int cands = getCandCoord(i, j);
if (setSize(minCands) > setSize(cands)) {
minCands = cands;
y = i; x = j;
}
}
// 이 칸에 들어갈 숫자가 없으면 실패!
if (minCands == 0) return false;
// 모든 칸이 채워졌으면 출력하고 종료한다
if (y == -1) {
printSolution();
return true;
}
// 숫자를 하나씩 채워보자
for (int val = 1; val <= 9; ++val)
if (minCands & (1 << val)) {
put(y, x, val);
if (search()) return true;
remove(y, x, val);
}
return false;
}
void read() {
cin >> n;
for (int i = 0; i < n; i++)
for (int j = 0; j < n; j++)
cin >> color[i][j];
memset(hint, -1, sizeof(hint));
cin >> q;
int dy[2] = { 0, 1 };
int dx[2] = { 1, 0 };
for (int i = 0; i < q; i++) {
int y, x, direction;
cin >> y >> x >> direction >> sum[i];
--y; --x;
length[i] = 0;
while (true) {
y += dy[direction]; x += dx[direction];
if (y >= n || x >= n || color[y][x] == BLACK) break;
hint[y][x][direction] = i;
length[i]++;
}
}
memset(known, 0, sizeof(known));
}
int CInput() {
calcMasks();
generateCandidates();
int cases;
cin >> cases;
for (int cc = 0; cc < cases; ++cc) {
read();
memset(value, 0, sizeof(value));
assert(search());
}
}
};
| [
"jaykay@xlgames.com"
] | jaykay@xlgames.com |
7e0cc66139ad3c835a2440a4393712709eecb279 | 0eff74b05b60098333ad66cf801bdd93becc9ea4 | /second/download/httpd/gumtree/httpd_old_hunk_7133.cpp | 87c08bc96e0576a1057fa1b2fe8889f7ddc4514e | [] | no_license | niuxu18/logTracker-old | 97543445ea7e414ed40bdc681239365d33418975 | f2b060f13a0295387fe02187543db124916eb446 | refs/heads/master | 2021-09-13T21:39:37.686481 | 2017-12-11T03:36:34 | 2017-12-11T03:36:34 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 637 | cpp | }
else {
ap_rputs(anchor, r);
}
}
static void output_directories(struct ent **ar, int n,
autoindex_config_rec * d, request_rec *r,
int autoindex_opts, char keyid, char direction)
{
int x, len;
char *name = r->uri;
char *tp;
int static_columns = (autoindex_opts & SUPPRESS_COLSORT);
pool *scratch = ap_make_sub_pool(r->pool);
if (name[0] == '\0')
name = "/";
if (autoindex_opts & FANCY_INDEXING) {
ap_rputs("<PRE>", r);
if ((tp = find_default_icon(d, "^^BLANKICON^^"))) {
ap_rvputs(r, "<IMG SRC=\"", ap_escape_html(scratch, tp),
"\" ALT=\" \"", NULL);
| [
"993273596@qq.com"
] | 993273596@qq.com |
af818ca529c692bebdf82b40e55e50ac3eee0731 | 6de8c4f56453c2b110b737a752ecd6def7259d0d | /src/webserver.hpp | cf3ce427c41e27146f17f967cc78f48b09efe1af | [
"MIT"
] | permissive | hklausing/ESP8266DS18B20 | 35f5a1eff1e9f0e5b727c6808f94396b5d7bfd1c | 79075dbce90b904b12b8e85943145a450a5d11b0 | refs/heads/master | 2022-12-25T08:56:51.833598 | 2020-10-05T16:16:11 | 2020-10-05T16:16:11 | 301,451,505 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,864 | hpp | /*
* File src/webserver.hpp
* Author Heiko Klausing (h dot klausing at gmx do de)
* Created 2020-09-21
* Description Handling of the web server part of this project.
*/
#pragma once
#include <WiFiServer.h>
/*
* declare here the web pages;
* declared outside of the class PrjWebServer, in case of easier handling.
*/
uint32_t sendPage_Index(WiFiClient *client);
void page_Index(WiFiClient &wifi_client);
uint32_t sendPage_Info(WiFiClient *client);
void page_Info(WiFiClient &wifi_client);
uint32_t sendPage_Graph(WiFiClient *client);
void page_Graph(WiFiClient &wifi_client);
uint32_t sendPage_MeasValue(WiFiClient *client);
void page_MeasValue(WiFiClient &wifi_client);
uint32_t sendPage_Unknown(WiFiClient *client);
void page_Unknown(WiFiClient &wifi_client);
uint32_t sendPage_Restart(WiFiClient *client);
void page_Restart(WiFiClient &wifi_client);
// Request values
enum class Request_t
{
NO_REQUEST=0, // no request found
REQUEST_INDEX, // request for page index ("/")
REQUEST_INFO, // handle page info
REQUEST_GRAPH, // handle page graph ("/graph")
REQUEST_MEASVAL_JS, // get a json list with all measurement values ("/measval.js")
REQUEST_RESTART, // restart temperature logger, clears the measurement queue ("/restart")
REQUEST_UNKNOWN // request for unknown page
};
class PrjWebServer
{
private:
WiFiServer *m_wifi_server;
public:
PrjWebServer(WiFiServer *wifi_server);
~PrjWebServer();
void processClient(void);
/**
* @brief Get the Page Request object
*
* @param wifi_client
* @return Request_t
*/
Request_t getPageRequest(WiFiClient &wifi_client);
/**
* @brief Increment page requoired counter
*
*/
void incrementPageRequestCounter(void);
/**
* @brief Get the Page Request Counter object
*
* @return int
*/
int getRequestedPages(void);
private:
String m_request_path = ""; // input request from client
String m_request_parameter = "";
uint32_t m_page_request_counter = 0;
// Web function pointer for page handling
typedef void (*pageHandler_t)(WiFiClient &);
typedef struct
{
Request_t req_id;
char req_page[32];
pageHandler_t pageHandler;
} req_pages_t;
const req_pages_t req_pages[6] = {
{Request_t::REQUEST_INDEX, "/", &page_Index},
{Request_t::REQUEST_INFO, "/info", &page_Info},
{Request_t::REQUEST_GRAPH, "/graph", &page_Graph},
{Request_t::REQUEST_MEASVAL_JS, "/measval.js", &page_MeasValue},
{Request_t::REQUEST_RESTART, "/restart", &page_Restart},
{Request_t::REQUEST_UNKNOWN, "", &page_Unknown},
};
const size_t req_pages_size = sizeof(req_pages) / sizeof(req_pages[0]);
};
extern PrjWebServer g_prj_web_server;
| [
"h.klausing@gmx.de"
] | h.klausing@gmx.de |
cc71aa05465548da89851b7f7a25b8cc20855b73 | a75d0418b2143d6f59635a8833bff49bc903df5e | /DofusMessages/GameActionFightPointsVariationMessage.cpp | b8cf70ecf08bd0b8c6cd15bb58e8deee83e9e17d | [] | no_license | Arkwell9112/dofus_bot | 30b80850ba41b6a2b562705ec8aa1a6c87cfb8f8 | fc1b805b70c0ed43cbc585322806ece89d057585 | refs/heads/master | 2023-01-16T01:08:06.710649 | 2020-11-23T20:53:00 | 2020-11-23T20:53:00 | 314,084,045 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 666 | cpp | #include "GameActionFightPointsVariationMessage.h"
#include "AbstractGameActionMessage.h"
#include "../BotCoreAPI/BotCoreAPI.h"
void GameActionFightPointsVariationMessage::deserialize(CustomDataInput *input) {
AbstractGameActionMessage::deserialize(input);
this->_targetIdFunc(input);
this->_deltaFunc(input);
}
void GameActionFightPointsVariationMessage::_targetIdFunc(CustomDataInput *input) {
this->targetId = input->readDouble();
if (this->targetId < -9007199254740990 || this->targetId > 9007199254740990) {
}
}
void GameActionFightPointsVariationMessage::_deltaFunc(CustomDataInput *input) {
this->delta = input->readShort();
}
| [
"arkwell9112@github.com"
] | arkwell9112@github.com |
03bbe151c76072164037d8edaf2414f41d6ebfdd | b9021c1c92bd6d59fe937356469848a0eb4fa688 | /lib/MotorSupport/src/PWMMotor.hpp | b73bedc30ac6cd0a604036c905cc0ec783157f03 | [] | no_license | shenghaoyang/srg_wcr | 0a5f6dbd56d43cc028db824528ae635f65afd60b | af4a25d9527dc59238a44fb7d52e10fbbd512e53 | refs/heads/master | 2021-05-11T18:51:03.276537 | 2018-01-21T05:09:13 | 2018-01-21T05:09:13 | 117,844,600 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 333 | hpp | /*
* PWMMotor.hpp
*
* Created on: 12 Jan 2018
* Author: shenghao
*/
#ifndef LIB_MOTORSUPPORT_SRC_PWMMOTOR_HPP_
#define LIB_MOTORSUPPORT_SRC_PWMMOTOR_HPP_
#include <BaseMotor.hpp>
#include <BasePWMMotor.hpp>
class PWMMotor : public BaseMotor, public BasePWMMotor {
};
#endif /* LIB_MOTORSUPPORT_SRC_PWMMOTOR_HPP_ */
| [
"shenghao@shenghao-crbook15"
] | shenghao@shenghao-crbook15 |
3f8b42f5f256f5e2dfc6fe30eda66e1c5cb518f8 | 91ba0c0c42b3fcdbc2a7778e4a4684ab1942714b | /Cpp/SDK/AD_ThirdPerson_PlayerPirate_Male_Thin_classes.h | 452a1cde4ab058a1b2f2368df99b1d6fb6a04312 | [] | no_license | zH4x/SoT-SDK-2.1.1 | 0f8c1ec3ad8821de82df3f75a0356642b581b8c6 | 35144dfc629aeddf96c1741e9e27e5113a2b1bb3 | refs/heads/main | 2023-05-12T09:03:32.050860 | 2021-06-05T01:54:15 | 2021-06-05T01:54:15 | 373,997,263 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 854 | h | #pragma once
// Name: SoT, Version: 2.1.1
/*!!DEFINE!!*/
/*!!HELPER_DEF!!*/
/*!!HELPER_INC!!*/
#ifdef _MSC_VER
#pragma pack(push, 0x01)
#endif
namespace CG
{
//---------------------------------------------------------------------------
// Classes
//---------------------------------------------------------------------------
// BlueprintGeneratedClass AD_ThirdPerson_PlayerPirate_Male_Thin.AD_ThirdPerson_PlayerPirate_Male_Thin_C
// 0x0000 (FullSize[0x0750] - InheritedSize[0x0750])
class UAD_ThirdPerson_PlayerPirate_Male_Thin_C : public UAD_ThirdPerson_PlayerPirate_Male_Default_C
{
public:
static UClass* StaticClass()
{
static auto ptr = UObject::FindClass("BlueprintGeneratedClass AD_ThirdPerson_PlayerPirate_Male_Thin.AD_ThirdPerson_PlayerPirate_Male_Thin_C");
return ptr;
}
};
}
#ifdef _MSC_VER
#pragma pack(pop)
#endif
| [
"Massimo.linker@gmail.com"
] | Massimo.linker@gmail.com |
193472294e1c67ca81d616f73c9ada79b9967fe0 | 67d1eba373b9afe9cd1f6bc8a52fde774207e6c7 | /UVA/10050 - Hartals.cpp | f4c217d845deede9388d314b6a4e33a820522f12 | [] | no_license | evan-hossain/competitive-programming | 879b8952df587baf906298a609b471971bdfd421 | 561ce1a6b4a4a6958260206a5d0252cc9ea80c75 | refs/heads/master | 2021-06-01T13:54:04.351848 | 2018-01-19T14:18:35 | 2018-01-19T14:18:35 | 93,148,046 | 2 | 3 | null | 2020-10-01T13:29:54 | 2017-06-02T09:04:50 | C++ | UTF-8 | C++ | false | false | 685 | cpp | #include <iostream>
using namespace std;
int main()
{
char days[3655];
int t, n, p, i, j, k, l, cnt;
cin >> t;
while(t--)
{
cnt = 0;
cin >> n;
for(j = 1; j <= n; j++)
days[j] = 0;
cin >> p;
while(p--)
{
cin >> i;
for(j = i; j <= n; j += i)
{
if(j % 7 == 0 || (j + 1) % 7 == 0)
continue;
else if(days[j] == 0)
{
days[j] = 1;
cnt++;
}
}
}
cout << cnt << endl;
}
return 0;
}
| [
"evan.hossain@ipay.com.bd"
] | evan.hossain@ipay.com.bd |
70f37143aca37bcab55eff282d648daf52d7b7a2 | 3aa9a68026ab10ced85dec559b6b4dfcb74ae251 | /CodeChef/SHUFFLE.cpp | 8a10404d7c758119d7167eef3a07e394f70fd496 | [] | no_license | kushuu/competitive_programming_all | 10eee29c3ca0656a2ffa37b142df680c3a022f1b | 5edaec66d2179a012832698035bdfb0957dbd806 | refs/heads/master | 2023-08-17T15:09:48.492816 | 2021-10-04T20:09:37 | 2021-10-04T20:09:37 | 334,891,360 | 3 | 2 | null | null | null | null | UTF-8 | C++ | false | false | 366 | cpp | #include <bits/stdc++.h>
//shorts
#define ll long long int
#define sll stack<long long int>
#define fastIO \
ios_base::sync_with_stdio(false); \
cin.tie(NULL);
#define MOD 1000000007
//program specific shorts (if any)
//
using namespace std;
int main()
{
fastIO;
ll T;
cin >> T;
while (T--)
{
}
return 0;
} | [
"sonikushu007@gmail.com"
] | sonikushu007@gmail.com |
8356a7a4588ec39b97bca3b0c62f818de840787b | f15c059a0bf9aae18c1407f55c5a1e2b147ee6c4 | /microcontrollers/ESP32/HukamESP32LoraBoard/HukamEsp32LoraBoard.ino | 2b597b5acab1c3748d9eecf4d0f06e62eab4f42f | [] | no_license | sinny777/hukam | cbb2ef5389159ddd5ecc2c0f48de67a92585f5f7 | 9b0462b469b84e028cab452dab95a9fc35e68ac8 | refs/heads/master | 2023-02-08T09:07:34.259173 | 2020-12-14T06:07:30 | 2020-12-14T06:07:30 | 80,711,056 | 0 | 1 | null | 2023-01-23T18:25:03 | 2017-02-02T09:35:42 | C++ | UTF-8 | C++ | false | false | 14,817 | ino | #include <stdlib.h>
#include <SPI.h>
#include <Wire.h>
#include "Adafruit_BME280.h"
#include <LoRa.h>
#include <WiFi.h>
#include <PubSubClient.h>
#include "EEPROM.h"
//#include "soc/soc.h"
//#include "soc/rtc_cntl_reg.h"
//void setup(){
//WRITE_PERI_REG(RTC_CNTL_BROWN_OUT_REG, 0); //disable brownout detecto
#ifdef __cplusplus
extern "C" {
#endif
uint8_t temprature_sens_read();
#ifdef __cplusplus
}
#endif
uint8_t temprature_sens_read();
static int taskCore = 0;
String sensorsData = "";
bool enableLora = true;
bool enableWiFi = false;
bool enableEEPROM = true;
bool enableSensors = false;
unsigned long interval = 1000; // the time we need to wait
unsigned long previousMillis = 0;
// WIFI_LoRa_32 ports
// GPIO5 -- SX1278's SCK
// GPIO19 -- SX1278's MISO
// GPIO27 -- SX1278's MOSI
// GPIO18 -- SX1278's CS
// GPIO14 -- SX1278's RESET
// GPIO26 -- SX1278's IRQ(Interrupt Request)
//
// ---- LORA Pins ----
byte localAddress = 0xBB; // address of this device
byte destination = 0xFF; // destination to send to
int sw1Address = 0;
int sw2Address = 1;
int sw3Address = 2;
int sw4Address = 3;
int EEPROM_SIZE = 64;
#define BAND 433E6
#define SCK 5
#define MISO 19
#define MOSI 27
#define CS 18
#define SS 18
#define RST 14
#define DI0 26
// -----------------
String receivedText;
bool loraAvailable = false;
bool bmeAvailable = false;
bool eepromAvailable = false;
int wifiTryCount = 0;
int mqttTryCount = 0;
int wifiStatus = WL_IDLE_STATUS;
#define ORG "rqeofj"
#define BOARD_TYPE "HB_ESP32"
#define TOKEN "1SatnamW"
//#define HEARTBEAT_LED 32
bool hbLedState = false;
// #define DHTPin 35
#define ldrSensorPin 25
#define I2C_SCL 21
#define I2C_SDA 22
#define SEALEVELPRESSURE_HPA (1005)
#define BME280_ADD 0x76
#define TOUCH1PIN 4
#define TOUCH2PIN 2
#define TOUCH3PIN 13
#define TOUCH4PIN 15
unsigned long previousTouchMillis = 0;
int touchThreshold = 40;
int touchIndex = 0;
#define SW1 17
#define SW2 16
#define SW3 12
#define SW4 23
int sw1Val = 0;
int sw2Val = 0;
int sw3Val = 0;
int sw4Val = 0;
char server[] = ORG ".messaging.internetofthings.ibmcloud.com";
char topic[] = "iot-2/evt/espboard/fmt/json";
char authMethod[] = "use-token-auth";
char token[] = "P@ssw0rd"; // Auth token of Device registered on Watson IoT Platform
String BOARD_ID;
WiFiClient wifiClient;
PubSubClient client(server, 1883, NULL, wifiClient);
const char* ssid = "GurvinderNet";
const char* password = "1SatnamW";
// -----------------------------
int hallData = 0;
int boardTemp = 0;
float temperature = 0.0f;
float humidity = 0.0f;
float pressure = 0.0f;
float altitude = 0.0f;
float lightVal = 0.0f;
Adafruit_BME280 bme(I2C_SDA, I2C_SCL);
// --------------------
/**
* Scan WiFi Networks
*/
static void scanWiFi(){
int n = WiFi.scanNetworks();
if (n == 0) {
Serial.println("Searching networks.");
} else {
Serial.println("Networks found: ");
for (int i = 0; i < n; ++i) {
// Print SSID for each network found
char currentSSID[64];
WiFi.SSID(i).toCharArray(currentSSID, 64);
Serial.println(currentSSID);
}
}
// Wait a bit before scanning again
delay(5000);
}
/**
* Connect to a given WiFi Network
*/
static void connectWiFi(){
while(wifiStatus != WL_CONNECTED && wifiTryCount < 5){
Serial.print("Attempting to connect to WEP network, SSID: ");
Serial.println(ssid);
wifiStatus = WiFi.begin(ssid, password);
wifiTryCount++;
delay(10000);
}
wifiTryCount = 0;
if(wifiStatus == WL_CONNECTED){
Serial.println("WiFi Connected..");
}else{
Serial.println("Failed to Connect WiFi");
}
}
/**
* Connect to MQTT Server
*/
static void connectMQTT() {
// Serial.print("IN connecting MQTT client...");
if(BOARD_ID == ""){
char chipid[20];
sprintf(chipid, "%" PRIu64, ESP.getEfuseMac());
BOARD_ID = "HB_"+String(chipid);
}
String clientId = "d:" ORG ":" BOARD_TYPE ":" +BOARD_ID;
if (!!!client.connected()) {
Serial.print("Reconnecting MQTT client to ");
Serial.println(server);
while (!!!client.connect((char*) clientId.c_str(), authMethod, token)) {
Serial.print("Connecting: ");
Serial.println(BOARD_ID);
delay(500);
}
// Serial.println();
}
Serial.print("MQTT Connected...");
}
/**
* Get all sensors data and save it in a variable
*/
static void getSensorsData(){
hallData = hallRead();
boardTemp = (temprature_sens_read() - 32) / 1.8;
lightVal = analogRead(ldrSensorPin);
if(enableSensors){
temperature = bme.readTemperature();
humidity = bme.readHumidity();
pressure = (bme.readPressure() / 100.0F);
altitude = bme.readAltitude(SEALEVELPRESSURE_HPA); // Approx Altitude in meters
}
/*
if (isnan(temperature) || isnan(humidity)) {
// Serial.println("Failed to read from BME280 sensor!");
strcpy(celsiusTemp,"-0");
strcpy(humidityTemp, "-0");
} else{
// Computes temperature values in Celsius + Fahrenheit and Humidity
float hic = dht.computeHeatIndex(temperature, humidity, false);
dtostrf(hic, 6, 2, celsiusTemp);
dtostrf(humidity, 6, 2, humidityTemp);
}
*/
// sensorsData = "{\"type\":\"" BOARD_TYPE "\", \"uniqueId\":\"" +BOARD_ID+ "\", \"BOARD_TEMP\":" +String(boardTemp)+", \"HALL_DATA\":" +String(hallData)+", \"TEMP\":" +String(temperature)+", \"HUM\":" +String(humidity)+", \"PRESSURE\":" +String(pressure)+", \"ALT\":" +String(altitude)+", \"LIGHT\":" +String(lightVal)+"}";
sensorsData = "{\"type\":\"" BOARD_TYPE "\", \"uniqueId\":\"" +BOARD_ID+ "\", \"d\": {\"type\":\"" BOARD_TYPE "\", \"uniqueId\":\"" +BOARD_ID+ "\", \"BOARD_TEMP\":" +String(boardTemp)+", \"HALL_DATA\":" +String(hallData)+", \"TEMP\":" +String(temperature)+", \"HUM\":" +String(humidity)+", \"PRESSURE\":" +String(pressure)+", \"ALT\":" +String(altitude)+", \"LIGHT\":" +String(lightVal)+"}}";
}
void gotTouch1(){
touchIndex = 1;
}
void gotTouch2(){
touchIndex = 2;
}
void gotTouch3(){
touchIndex = 3;
}
void gotTouch4(){
touchIndex = 4;
}
void publishData(String data){
Serial.print("Publish data:>> ");
Serial.println(data);
/*
if (client.publish(topic, (char*) payload.c_str())) {
// Serial.print("Published payload: ");
// Serial.println(payload);
} else {
// Serial.println("Publish failed: ");
// Serial.println(payload);
}
*/
if(loraAvailable){
LoRa.beginPacket();
// LoRa.write(destination); // add destination address
// LoRa.write(localAddress);
LoRa.print(data);
LoRa.print("\n");
LoRa.endPacket();
// LoRa.receive();
delay(1);
LoRa.flush();
}else{
Serial.print("Lora Not Working: >> ");
Serial.println(data);
}
}
// tocuhValue > threshold = Release Event
// touchValue < threshold = Touch Event
void checkTouchDetected(){
if(touchIndex > 0){
unsigned long currentTouchMillis = millis();
if ((unsigned long)(currentTouchMillis - previousTouchMillis) >= 600) {
previousTouchMillis = millis();
// printf(touchIndex);
switch (touchIndex){
case 1: {
int touchVal = touchRead(TOUCH1PIN);
if(touchVal > 1 && touchVal <= touchThreshold){
if(sw1Val == 1){
sw1Val = 0;
}else{
sw1Val = 1;
}
digitalWrite(SW1, sw1Val);
String payload = "{\"type\":\"" BOARD_TYPE "\", \"uniqueId\":\"" +BOARD_ID+"\", \"deviceIndex\":1, \"deviceValue\": " +String(sw1Val)+"}";
publishData(payload);
if(eepromAvailable){
EEPROM.writeInt(sw1Address, sw1Val);
// Serial.printf("sw1Val: %d \n", EEPROM.readInt(sw1Address));
}
}
break;
}
case 2: {
int touchVal = touchRead(TOUCH2PIN);
if(touchVal > 1 && touchVal <= touchThreshold){
if(sw2Val == 1){
sw2Val = 0;
}else{
sw2Val = 1;
}
digitalWrite(SW2, sw2Val);
String payload = "{\"type\":\"" BOARD_TYPE "\", \"uniqueId\":\"" +BOARD_ID+"\", \"deviceIndex\":2, \"deviceValue\": " +String(sw2Val)+"}";
publishData(payload);
if(eepromAvailable){
EEPROM.writeInt(sw2Address, sw2Val);
// Serial.printf("sw2Val: %d \n", EEPROM.readInt(sw2Address));
}
}
break;
}
case 3: {
int touchVal = touchRead(TOUCH3PIN);
if(touchVal > 1 && touchVal <= touchThreshold){
if(sw3Val == 1){
sw3Val = 0;
}else{
sw3Val = 1;
}
digitalWrite(SW3, HIGH);
String payload = "{\"type\":\"" BOARD_TYPE "\", \"uniqueId\":\"" +BOARD_ID+"\", \"deviceIndex\":3, \"deviceValue\": " +String(sw3Val)+"}";
publishData(payload);
if(eepromAvailable){
EEPROM.writeInt(sw3Address, sw3Val);
// Serial.printf("sw3Val: %d \n", EEPROM.readInt(sw3Address));
}
}
break;
}
case 4: {
int touchVal = touchRead(TOUCH4PIN);
if(touchVal > 1 && touchVal <= touchThreshold){
if(sw4Val == 1){
sw4Val = 0;
}else{
sw4Val = 1;
}
digitalWrite(SW4, sw4Val);
String payload = "{\"type\":\"" BOARD_TYPE "\", \"uniqueId\":\"" +BOARD_ID+"\", \"deviceIndex\":4, \"deviceValue\": " +String(sw4Val)+"}";
publishData(payload);
if(eepromAvailable){
EEPROM.writeInt(sw4Address, sw4Val);
// Serial.printf("sw4Val: %d \n", EEPROM.readInt(sw4Address));
}
}
break;
}
}
// delay(1);
if(eepromAvailable){
// EEPROM.commit();
}
touchIndex = 0;
// delay(1);
}
}
}
void checkDataOnLora(){
// try to parse packet
int packetSize = LoRa.parsePacket();
if (packetSize) {
// received a packet
// Serial.print("Received packet '");
// read packet
while (LoRa.available()) {
receivedText = (char)LoRa.read();
Serial.print(receivedText);
}
// print RSSI of packet
// Serial.print("' with RSSI ");
// Serial.println(LoRa.packetRssi());
}
}
void initSwitches(){
if(eepromAvailable){
sw1Val = EEPROM.readInt(sw1Address);
sw2Val = EEPROM.readInt(sw2Address);
sw3Val = EEPROM.readInt(sw3Address);
sw4Val = EEPROM.readInt(sw4Address);
}
if(sw1Val < 0){
sw1Val = 0;
}
if(sw2Val < 0){
sw2Val = 0;
}
if(sw3Val < 0){
sw3Val = 0;
}
if(sw4Val < 0){
sw4Val = 0;
}
if(sw1Val > 1){
sw1Val = 1;
}
if(sw2Val > 1){
sw2Val = 1;
}
if(sw3Val > 1){
sw3Val = 1;
}
if(sw4Val > 1){
sw4Val = 1;
}
digitalWrite (SW1, sw1Val);
digitalWrite (SW2, sw2Val);
digitalWrite (SW3, sw3Val);
digitalWrite (SW4, sw4Val);
// Serial.printf("Switch 1: %d, Switch 2: %d, Switch 3: %d, Switch 4: %d\n\n", sw1Val, sw2Val, sw3Val, sw4Val);
}
// the setup function runs once when you press reset or power the board
void setup() {
delay(1000);
// pinMode(HEARTBEAT_LED, OUTPUT);
pinMode(SW1, OUTPUT);
pinMode(SW2, OUTPUT);
pinMode(SW3, OUTPUT);
pinMode(SW4, OUTPUT);
if(enableSensors){
// Init BME280 Sensor
int bmeTryCount = 0;
do{
bmeAvailable = bme.begin(BME280_ADD);
bmeTryCount++;
if(!bmeAvailable){
// Serial.printf("Could not find a valid BME280 sensor, check wiring!, Try Count: %d\n", bmeTryCount);
delay(2000);
}
} while(!bmeAvailable && bmeTryCount < 2);
}
// Init Lora
if(enableLora){
SPI.begin(SCK, MISO, MOSI, CS);
LoRa.setPins(SS, RST, DI0);
delay(1000);
}
Serial.begin(115200);
while (!Serial);
delay(1000);
char chipid[20];
sprintf(chipid, "%" PRIu64, ESP.getEfuseMac());
BOARD_ID = "HB_"+String(chipid);
// Serial.println(BOARD_ID);
delay(100);
if(enableEEPROM){
int eepromTryCount = 0;
do{
eepromAvailable = EEPROM.begin(EEPROM_SIZE);
eepromTryCount++;
if(!eepromAvailable){
Serial.printf("Failed to initialise EEPROM, Try Count: %d\n", eepromTryCount);
delay(2000);
}else{
Serial.println("EEPROM Initialized Successfully...");
}
}while(!eepromAvailable && eepromTryCount > 3);
}
// Serial.println("LoRa Initializing...");
if(enableLora){
int loraTryCount = 0;
do{
loraAvailable = LoRa.begin(BAND);
loraTryCount++;
if(!loraAvailable){
Serial.printf("Starting LoRa failed!, Try Count: %d\n", loraTryCount);
delay(3000);
}else{
Serial.println("LoRa Initialized Successfully...");
}
}while(!loraAvailable && loraTryCount < 3);
}
if(enableWiFi){
// Set WiFi to station mode and disconnect from an AP if it was previously connected
// WiFi.mode(WIFI_STA);
// WiFi.disconnect();
delay(100);
// scanWiFi();
connectWiFi();
if(wifiStatus == WL_CONNECTED){
connectMQTT();
}
}
touchAttachInterrupt(TOUCH1PIN, gotTouch1, touchThreshold);
touchAttachInterrupt(TOUCH2PIN, gotTouch2, touchThreshold);
touchAttachInterrupt(TOUCH3PIN, gotTouch3, touchThreshold);
touchAttachInterrupt(TOUCH4PIN, gotTouch4, touchThreshold);
initSwitches();
}
// the loop function runs over and over again forever
void loop() {
unsigned long currentMillis = millis();
checkDataOnLora();
checkTouchDetected();
if ((unsigned long)(currentMillis - previousMillis) >= (interval * 15)) {
hbLedState = !hbLedState;
if(hbLedState){
// digitalWrite(HEARTBEAT_LED, 1);
Serial.println("...");
}else{
// digitalWrite(HEARTBEAT_LED, 0);
Serial.println(BOARD_ID);
}
getSensorsData();
publishData(sensorsData);
previousMillis = millis();
}
// scanWiFi();
// Serial.println(BOARD_ID);
}
| [
"sinny777@gmail.com"
] | sinny777@gmail.com |
efef84fe91de7a951adbef8932b5fa7613745dbc | 22e8bc51bd750080657131a884d8851da09aa11f | /Model/element.cpp | b73ca79079c0e412a1667a10cbc48e9fd5dea4ec | [] | no_license | Laetan/Zelda | f3002dd26e05b569ed8ee05cb10e51bf0f798d2b | d3f9313f1ef06076b8449429b13a0007e8e04b67 | refs/heads/master | 2016-09-10T22:11:45.472350 | 2014-11-04T12:11:40 | 2014-11-04T12:11:40 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,535 | cpp | #include "element.h"
#include <QPixmap>
#include <QtDebug>
#include <QList>
#include "gamescene.h"
Element::Element()
{
QGraphicsPixmapItem();
}
Element::Element(QString n): QGraphicsPixmapItem(), name(n)
{
}
Element::Element(QString picturePath, QString n): QGraphicsPixmapItem(QPixmap(picturePath)),name(n)
{
}
Element::Element(QString picturePath,int x,int y,QString n): QGraphicsPixmapItem(QPixmap(picturePath)),name(n)
{
this->setPos(x,y);
}
void Element::update()
{
move();
int env = checkCollideWithEnv();
if( env==1 && (name=="pewpew" || name=="arrow"))
((GameScene*)scene())->remove(this);
else if(env==1)
move(true);
}
void Element::move(bool collide)
{
if(collide) speed*=-1;
if(dir == "z")
this->moveBy(0,-1*speed);
else if(dir == "q")
this->moveBy(-1*speed,0);
else if(dir == "s")
this->moveBy(0,1*speed);
else if(dir == "d")
this->moveBy(1*speed,0);
if(collide) speed*=-1;
}
int Element::checkCollideWithEnv(){
int x(pos().x()),y(pos().y()),w(pixmap().size().width()),h(pixmap().size().height());
int a(collideWithEnv(x,y)),b(collideWithEnv(x,y+h)),c(collideWithEnv(x+w,y)),d(collideWithEnv(x+w,y+h));
if(a==1 || b==1 || c==1 || d==1)
return 1;
else
return qMax(qMax(a,b),qMax(c,d));
}
int Element::collideWithEnv(int x, int y)
{
QList<QList<int> > data = ((GameScene*)this->scene())->getEnvData();
if(data[(int)x/32][(int)y/32]>100 && data[(int)x/32][(int)y/32]<201 || data[(int)x/32][(int)y/32]==0){
return 1;
}
else if(data[(int)x/32][(int)y/32]>200){
return data[(int)x/32][(int)y/32];
}
else
return 0;
}
void Element::eventEnv(int env)
{
switch(env){
case 201:
((GameScene*)scene())->changeStage("U");
break;
case 202:
((GameScene*)scene())->changeStage("D");
break;
case 203:
((GameScene*)scene())->changeStage("N");
break;
case 204:
((GameScene*)scene())->changeStage("S");
break;
case 205:
((GameScene*)scene())->changeStage("E");
break;
case 206:
((GameScene*)scene())->changeStage("W");
break;
default:
break;
}
}
QString Element::getName() const
{
return name;
}
QString Element::getDir() const
{
return currentDir;
}
QString Element::getCurrentDir() const
{
return currentDir;
}
void Element::setCurrentDir(const QString &value)
{
currentDir = value;
}
| [
"nathanael.julien@icloud.com"
] | nathanael.julien@icloud.com |
bed16796b825d919bc24170d3862ff13755699ea | 536656cd89e4fa3a92b5dcab28657d60d1d244bd | /chromecast/browser/exo/wayland_server_controller.cc | 422207e455993dc1e8162ca1956be5033a02592a | [
"BSD-3-Clause"
] | permissive | ECS-251-W2020/chromium | 79caebf50443f297557d9510620bf8d44a68399a | ac814e85cb870a6b569e184c7a60a70ff3cb19f9 | refs/heads/master | 2022-08-19T17:42:46.887573 | 2020-03-18T06:08:44 | 2020-03-18T06:08:44 | 248,141,336 | 7 | 8 | BSD-3-Clause | 2022-07-06T20:32:48 | 2020-03-18T04:52:18 | null | UTF-8 | C++ | false | false | 1,397 | 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 "chromecast/browser/exo/wayland_server_controller.h"
#include "chromecast/browser/exo/cast_wm_helper.h"
#include "chromecast/graphics/cast_screen.h"
#include "components/exo/display.h"
#include "components/exo/wayland/server.h"
#include "components/exo/wayland/wayland_watcher.h"
#include "components/exo/wm_helper.h"
namespace chromecast {
WaylandServerController::WaylandServerController(
CastWindowManagerAura* window_manager) {
wm_helper_ = std::make_unique<exo::CastWMHelper>(
window_manager, static_cast<CastScreen*>(CastScreen::GetScreen()));
exo::WMHelper::SetInstance(wm_helper_.get());
display_ = std::make_unique<exo::Display>();
wayland_server_ = exo::wayland::Server::Create(display_.get());
// Wayland server creation can fail if XDG_RUNTIME_DIR is not set correctly.
if (wayland_server_) {
wayland_watcher_ =
std::make_unique<exo::wayland::WaylandWatcher>(wayland_server_.get());
} else {
LOG(ERROR) << "Wayland server creation failed";
}
}
WaylandServerController::~WaylandServerController() {
wayland_watcher_.reset();
wayland_server_.reset();
display_.reset();
exo::WMHelper::SetInstance(nullptr);
wm_helper_.reset();
}
} // namespace chromecast
| [
"pcding@ucdavis.edu"
] | pcding@ucdavis.edu |
11521910da7e856108910538838fee957258c380 | d44b555d3cccb428eb0a5d348207fd5095245f58 | /src/netaddress.h | a087889930c7cb14b252b062ed4ed6838b49f288 | [
"MIT"
] | permissive | zeusthealmighty/Yeah | 6c423a21c3bab336b911b2dae6b16d21120791f6 | 8b057854f4c7603f09932747b54d47cdda914400 | refs/heads/master | 2020-03-08T22:18:32.405702 | 2018-04-06T18:25:42 | 2018-04-06T18:25:42 | 128,427,269 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 6,192 | h | // Copyright (c) 2009-2015 The Bitcoin Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#ifndef BITCOIN_NETADDRESS_H
#define BITCOIN_NETADDRESS_H
#if defined(HAVE_CONFIG_H)
#include "config/GoSuperSayayinCoin-config.h"
#endif
#include "compat.h"
#include "serialize.h"
#include <stdint.h>
#include <string>
#include <vector>
enum Network
{
NET_UNROUTABLE = 0,
NET_IPV4,
NET_IPV6,
NET_TOR,
NET_MAX,
};
/** IP address (IPv6, or IPv4 using mapped IPv6 range (::FFFF:0:0/96)) */
class CNetAddr
{
protected:
unsigned char ip[16]; // in network byte order
public:
CNetAddr();
CNetAddr(const struct in_addr& ipv4Addr);
void Init();
void SetIP(const CNetAddr& ip);
/**
* Set raw IPv4 or IPv6 address (in network byte order)
* @note Only NET_IPV4 and NET_IPV6 are allowed for network.
*/
void SetRaw(Network network, const uint8_t *data);
bool SetSpecial(const std::string &strName); // for Tor addresses
bool IsIPv4() const; // IPv4 mapped address (::FFFF:0:0/96, 0.0.0.0/0)
bool IsIPv6() const; // IPv6 address (not mapped IPv4, not Tor)
bool IsRFC1918() const; // IPv4 private networks (10.0.0.0/8, 192.168.0.0/16, 172.16.0.0/12)
bool IsRFC2544() const; // IPv4 inter-network communcations (192.18.0.0/15)
bool IsRFC6598() const; // IPv4 ISP-level NAT (100.64.0.0/10)
bool IsRFC5737() const; // IPv4 documentation addresses (192.0.2.0/24, 198.51.100.0/24, 203.0.113.0/24)
bool IsRFC3849() const; // IPv6 documentation address (2001:0DB8::/32)
bool IsRFC3927() const; // IPv4 autoconfig (169.254.0.0/16)
bool IsRFC3964() const; // IPv6 6to4 tunnelling (2002::/16)
bool IsRFC4193() const; // IPv6 unique local (FC00::/7)
bool IsRFC4380() const; // IPv6 Teredo tunnelling (2001::/32)
bool IsRFC4843() const; // IPv6 ORCHID (2001:10::/28)
bool IsRFC4862() const; // IPv6 autoconfig (FE80::/64)
bool IsRFC6052() const; // IPv6 well-known prefix (64:FF9B::/96)
bool IsRFC6145() const; // IPv6 IPv4-translated address (::FFFF:0:0:0/96)
bool IsTor() const;
bool IsLocal() const;
bool IsRoutable() const;
bool IsValid() const;
bool IsMulticast() const;
enum Network GetNetwork() const;
std::string ToString() const;
std::string ToStringIP(bool fUseGetnameinfo = true) const;
unsigned int GetByte(int n) const;
uint64_t GetHash() const;
bool GetInAddr(struct in_addr* pipv4Addr) const;
std::vector<unsigned char> GetGroup() const;
int GetReachabilityFrom(const CNetAddr *paddrPartner = NULL) const;
CNetAddr(const struct in6_addr& pipv6Addr);
bool GetIn6Addr(struct in6_addr* pipv6Addr) const;
friend bool operator==(const CNetAddr& a, const CNetAddr& b);
friend bool operator!=(const CNetAddr& a, const CNetAddr& b);
friend bool operator<(const CNetAddr& a, const CNetAddr& b);
ADD_SERIALIZE_METHODS;
template <typename Stream, typename Operation>
inline void SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) {
READWRITE(FLATDATA(ip));
}
friend class CSubNet;
};
class CSubNet
{
protected:
/// Network (base) address
CNetAddr network;
/// Netmask, in network byte order
uint8_t netmask[16];
/// Is this value valid? (only used to signal parse errors)
bool valid;
public:
CSubNet();
CSubNet(const CNetAddr &addr, int32_t mask);
CSubNet(const CNetAddr &addr, const CNetAddr &mask);
//constructor for single ip subnet (<ipv4>/32 or <ipv6>/128)
explicit CSubNet(const CNetAddr &addr);
bool Match(const CNetAddr &addr) const;
std::string ToString() const;
bool IsValid() const;
friend bool operator==(const CSubNet& a, const CSubNet& b);
friend bool operator!=(const CSubNet& a, const CSubNet& b);
friend bool operator<(const CSubNet& a, const CSubNet& b);
ADD_SERIALIZE_METHODS;
template <typename Stream, typename Operation>
inline void SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) {
READWRITE(network);
READWRITE(FLATDATA(netmask));
READWRITE(FLATDATA(valid));
}
};
/** A combination of a network address (CNetAddr) and a (TCP) port */
class CService : public CNetAddr
{
protected:
unsigned short port; // host order
public:
CService();
CService(const CNetAddr& ip, unsigned short port);
CService(const struct in_addr& ipv4Addr, unsigned short port);
CService(const struct sockaddr_in& addr);
void Init();
void SetPort(unsigned short portIn);
unsigned short GetPort() const;
bool GetSockAddr(struct sockaddr* paddr, socklen_t *addrlen) const;
bool SetSockAddr(const struct sockaddr* paddr);
friend bool operator==(const CService& a, const CService& b);
friend bool operator!=(const CService& a, const CService& b);
friend bool operator<(const CService& a, const CService& b);
std::vector<unsigned char> GetKey() const;
std::string ToString(bool fUseGetnameinfo = true) const;
std::string ToStringPort() const;
std::string ToStringIPPort(bool fUseGetnameinfo = true) const;
CService(const struct in6_addr& ipv6Addr, unsigned short port);
CService(const struct sockaddr_in6& addr);
ADD_SERIALIZE_METHODS;
template <typename Stream, typename Operation>
inline void SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) {
READWRITE(FLATDATA(ip));
unsigned short portN = htons(port);
READWRITE(FLATDATA(portN));
if (ser_action.ForRead())
port = ntohs(portN);
}
};
#endif // BITCOIN_NETADDRESS_H
| [
"admin@polispay.org"
] | admin@polispay.org |
2ddbc35fc8b5e84e9e0f17a065a3acbf44b9393d | 97aab27d4410969e589ae408b2724d0faa5039e2 | /SDK/EXES/INSTALL VISUAL 6 SDK/LEGACY/MSDN/SMPL/SMPL/MSDN/techart/3203/easygdoc.h | 81574177e84174a58a4a7c8e9478f640351d591a | [] | no_license | FutureWang123/dreamcast-docs | 82e4226cb1915f8772418373d5cb517713f858e2 | 58027aeb669a80aa783a6d2cdcd2d161fd50d359 | refs/heads/master | 2021-10-26T00:04:25.414629 | 2018-08-10T21:20:37 | 2018-08-10T21:20:37 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,025 | h | // easygdoc.h : interface of the CEasyglDoc class
//
/////////////////////////////////////////////////////////////////////////////
class CEasyglDoc : public CDocument
{
protected: // create from serialization only
CEasyglDoc();
DECLARE_DYNCREATE(CEasyglDoc)
// Attributes
public:
// Operations
public:
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CEasyglDoc)
public:
virtual BOOL OnNewDocument();
//}}AFX_VIRTUAL
// Implementation
public:
virtual ~CEasyglDoc();
virtual void Serialize(CArchive& ar); // overridden for document i/o
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif
protected:
// Generated message map functions
protected:
//{{AFX_MSG(CEasyglDoc)
// NOTE - the ClassWizard will add and remove member functions here.
// DO NOT EDIT what you see in these blocks of generated code !
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
/////////////////////////////////////////////////////////////////////////////
| [
"david.koch@9online.fr"
] | david.koch@9online.fr |
ae11a1bc62234a2fb9434147b0318a8fc87dd54e | a9b96afa96bcaef96e95432df0b6a4da41ed4969 | /sudoku/MXNet/DigitRecognition.h | e98a44395a1e8ba70de46ac01fd54114449c8799 | [] | no_license | VladimirVasilijevic/Sudoku-Solver | 096ffa3e005cc84a04a68acbcb4e69269a0b9e25 | 722d9cefb9f488fac96da31f602e38dcfbe4699c | refs/heads/master | 2021-01-23T04:34:36.058722 | 2017-06-01T10:29:35 | 2017-06-01T10:29:35 | 93,048,326 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 579 | h | #pragma once
#include <string>
#include "mxnet/c_predict_api.h"
#include <opencv2/opencv.hpp>
class DigitRecognition {
public:
DigitRecognition(std::string json_file, std::string param_file);
~DigitRecognition();
int PredictNumber(cv::Mat image_of_number);
private:
// Convert the input image to feed the network
cv::Mat Preprocess(const cv::Mat& img, int num_channels, cv::Size input_geometry);
void InitPredictor(PredictorHandle &predictor);
int MaxInArray(const float *array);
PredictorHandle m_predictor;
std::string m_json_file;
std::string m_param_file;
}; | [
"Vladimir Vasilijevic"
] | Vladimir Vasilijevic |
50455c4c0612c01109c828a717ac8e111730eaf9 | 5dac09dd5f5d919d27b8c9bab95c7eee456b744e | /src/robo_slam/test/robo_loopping_node.cpp | 1fb0b77c0d88e8166b0fa5b07b9cbe728c22ba1b | [] | no_license | 82473468/wenchi-map | 61916f77f50757009b5dd677cc6b52c3c8241e34 | 938d69e97f830be32ae619aab6ba2922fcc87d43 | refs/heads/master | 2021-07-04T18:23:44.679842 | 2017-09-26T03:14:46 | 2017-09-26T03:14:46 | 104,829,068 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 376 | cpp | //
// Created by zyy on 17-7-11.
//
#include "robo_loopping.h"
int main(int argc, char** argv)
{
ros::init(argc,argv,"robo_loopping");
ros::NodeHandle node;
ros::NodeHandle private_nh("~");
Robosense::robo_loop loopping(node,private_nh);
ros::Rate rate(100);
while(ros::ok()){
ros::spinOnce();
rate.sleep();
}
return 0;
}
| [
"wenchi31415@126.com"
] | wenchi31415@126.com |
9d7ca8f2dfbf2cc4abe24a7741f611fe6e5e8445 | 08b8cf38e1936e8cec27f84af0d3727321cec9c4 | /data/crawl/squid/hunk_2409.cpp | d9328da7d898faf7ca41dfa1d3b4ac63bbdb3c42 | [] | no_license | ccdxc/logSurvey | eaf28e9c2d6307140b17986d5c05106d1fd8e943 | 6b80226e1667c1e0760ab39160893ee19b0e9fb1 | refs/heads/master | 2022-01-07T21:31:55.446839 | 2018-04-21T14:12:43 | 2018-04-21T14:12:43 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 377 | cpp | S_IRUSR | S_IWUSR);
if (theFD < 0) {
debugs(54, 5, HERE << "shm_open " << theName << ": " << xstrerror());
- fatal("Ipc::Mem::Segment::create failed to shm_open");
+ fatalf("Ipc::Mem::Segment::create failed to shm_open(%s): %s\n",
+ theName.termedBuf(), xstrerror());
}
if (ftruncate(theFD, aSize)) {
| [
"993273596@qq.com"
] | 993273596@qq.com |
4237045e2ece29c9e13d2d4cb5d8741d7f431ac5 | 4b0a5965c46d2bf82d191868b3aaed684b3404c4 | /NightEngine2/thirdparty/taocpp_json/taocpp_json/include/tao/json/events/debug.hpp | a5e5be9bbccc21c1388c01e53b0e452cecd28562 | [
"MIT"
] | permissive | anu-prakash-dev/NightEngine2 | e5522ceb091b67f4d74128608a3471c48c6539a6 | 14004b48d1708736373010a3fe47d05d876e0baa | refs/heads/master | 2023-02-04T23:50:55.704056 | 2020-12-02T04:47:37 | 2020-12-02T04:47:37 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,158 | hpp | // Copyright (c) 2016-2018 Dr. Colin Hirsch and Daniel Frey
// Please see LICENSE for license or visit https://github.com/taocpp/json/
#ifndef TAO_JSON_EVENTS_DEBUG_HPP
#define TAO_JSON_EVENTS_DEBUG_HPP
#include <cmath>
#include <cstddef>
#include <cstdint>
#include <ostream>
#include <string>
#include "../binary_view.hpp"
#include "../local_date.hpp"
#include "../local_date_time.hpp"
#include "../local_time.hpp"
#include "../offset_date_time.hpp"
#include "../external/double.hpp"
#include "../internal/escape.hpp"
#include "../internal/hexdump.hpp"
namespace tao
{
namespace json
{
namespace events
{
// Events consumer that writes the events to a stream for debug purposes.
class debug
{
private:
std::ostream& os;
public:
explicit debug( std::ostream& in_os ) noexcept
: os( in_os )
{
}
void null()
{
os << "null\n";
}
void boolean( const bool v )
{
if( v ) {
os << "boolean: true\n";
}
else {
os << "boolean: false\n";
}
}
void number( const std::int64_t v )
{
os << "std::int64_t: " << v << '\n';
}
void number( const std::uint64_t v )
{
os << "std::uint64_t: " << v << '\n';
}
void number( const double v )
{
os << "double: ";
if( !std::isfinite( v ) ) {
os << v;
}
else {
json_double_conversion::Dtostr( os, v );
}
os << '\n';
}
void string( const tao::string_view v )
{
os << "string: \"";
internal::escape( os, v );
os << "\"\n";
}
void binary( const tao::binary_view v )
{
os << "binary: ";
internal::hexdump( os, v );
os << '\n';
}
void local_date( const json::local_date v )
{
os << "local_date: " << v << '\n';
}
void local_time( const json::local_time v )
{
os << "local_time: " << v << '\n';
}
void local_date_time( const json::local_date_time v )
{
os << "local_date_time: " << v << '\n';
}
void offset_date_time( const json::offset_date_time v )
{
os << "offset_date_time: " << v << '\n';
}
void begin_array()
{
os << "begin array\n";
}
void begin_array( const std::size_t size )
{
os << "begin array " << size << '\n';
}
void element()
{
os << "element\n";
}
void end_array()
{
os << "end array\n";
}
void end_array( const std::size_t size )
{
os << "end array " << size << '\n';
}
void begin_object()
{
os << "begin object\n";
}
void begin_object( const std::size_t size )
{
os << "begin object " << size << '\n';
}
void key( const tao::string_view v )
{
os << "key: \"";
internal::escape( os, v );
os << "\"\n";
}
void member()
{
os << "member\n";
}
void end_object()
{
os << "end object\n";
}
void end_object( const std::size_t size )
{
os << "end object " << size << '\n';
}
};
} // namespace events
} // namespace json
} // namespace tao
#endif
| [
"gun_rittikorn@hotmail.com"
] | gun_rittikorn@hotmail.com |
c5b650f9edbe2d07db6360c39477d38d0e16d202 | 6dca36583e233c8285027644eeb748c830502098 | /datStructures/hashing/practicalUsage/HashTableExamples/HashSet.cpp | 13f13e0ca8dc3bdb45cd473df9f5b7f8d28fb7a7 | [] | no_license | warnrbh13/MasteringCpp | 75784345cc21b4ce8b87245bbcd494a289323f5f | 2dc343c2f42dee19017990e922accb1fc7e419cb | refs/heads/master | 2023-02-24T17:54:19.513362 | 2021-01-29T05:49:43 | 2021-01-29T05:49:43 | 294,865,707 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 405 | cpp | #include "HashSet.h"
#include <iostream>
#include <unordered_set>
int main()
{
std::unordered_set<int> hashset;
hashset.insert(1);
hashset.insert(2);
hashset.insert(3);
hashset.insert(4);
hashset.insert(5);
for (std::unordered_set<int>::iterator i = hashset.begin(); i != hashset.end(); ++i)
{
std::cout << i.operator*() << std::endl;
}
hashset.find(2);
return false;
} | [
"benjamin.barbosahernandez@honeywell.com"
] | benjamin.barbosahernandez@honeywell.com |
e83b1f683163d2f8e38f2b1bdd80f46055e4e9b6 | 286da8d59fe0c3102e053294bc59ddf23b8ed322 | /source/SCGenerator.h | 90a4e54e0389c174b90da60ded3a8f2ecb339d5d | [] | no_license | BenDrews/Procedural-Tree-Generation | 2946995be93349b68bf9c75f93b02fa98a2b29db | 4aa4fbbba69f0162b60fd59d371720671e8d14ed | refs/heads/master | 2021-01-12T09:36:58.958360 | 2016-12-11T22:19:30 | 2016-12-11T22:19:30 | 76,197,648 | 5 | 2 | null | null | null | null | UTF-8 | C++ | false | false | 2,132 | h | /**
\file SCGenerator.h
*/
#pragma once
#include <G3D/G3DAll.h>
#include "App.h"
#include "Mesh.h"
#include "BranchDimensions.h"
#include "Tree.h"
#include "FruitDimensions.h"
#include "SCGenerator.h"
#include <cmath>
#include <map>
#include <tuple>
#include <stdlib.h>
/** \brief Logic to generate trees using the Space Colonization algorithm */
class SCGenerator {
protected:
void generateAnchorPoints(Array<Point3>& anchorPoints, int count, float height, float radius, std::function<float(float)> radiusCurve);
void addIntermediateAnchors(Array<Point3>& anchorPoints, int& anchorPointsCount, float height, float radius, float discountRate, std::function<float(float)> envelopePerimeter);
void findClosestNodes(Array<Point3>& anchorPoints, Array<shared_ptr<Tree>>& growingNodes, std::map<shared_ptr<Tree>, Vector3>& growthDirections, shared_ptr<Tree>& result, float attractionRadius);
void growTreeNodes(Array<Point3>& anchorPoints, std::map<shared_ptr<Tree>, Vector3>& growthDirections, float nodeDistance);
void killAnchors(Array<Point3>& anchorPoints, shared_ptr<Tree>& result, float nodeDistance, float killDistance);
void addCylindricSection(Mesh& mesh, const int& parentIndex, const int& currentIndex, const int& pts, const CoordinateFrame& origin, const float& radius) const;
void addLeaf(Mesh& leafMesh, float& length, const CoordinateFrame& initial) const;
void addFruits(Array<Point3>& fruitLocations, const CoordinateFrame& fruitFrame);
public:
shared_ptr<Tree> makeSCTreeSkeleton(int anchorPoints, std::function<float(float)> envelopePerimeter, float height, float radius, float killDistance, float nodeDistance, float attractionRadius, float discountRate, Point3 initTreeNode);
void skeletonToMeshSC(int circlePoints, float initRadius, float radiusGrowth, float leafiness, String filename, shared_ptr<Tree>& skeleton, Array<Point3>& fruitLocations);
static float sphericalEnvelope(float y);
static float cylindricEnvelope(float y);
static float conicalEnvelope(float y);
static float bulbEnvelope(float y);
}; | [
"bfd2@williams.edu"
] | bfd2@williams.edu |
8882e1327e6f1ccbb4bca58892328ced257c7860 | a5f25c85a8a7a35ce649db4fb12eec5713b63004 | /clove/src/page.h | e590c85769258960a791566dc7d779de5e064fef | [
"MIT"
] | permissive | msmania/procjack | 08b7a558e6e3b108cc251793c3867447b67dba3e | a8e7a48208d776235c2808f5f60ff1bd754c1279 | refs/heads/master | 2021-08-28T15:57:08.257577 | 2020-03-03T05:17:24 | 2020-03-03T05:17:24 | 33,330,814 | 17 | 6 | null | null | null | null | UTF-8 | C++ | false | false | 749 | h | struct CodeTemplate;
class ExecutablePages final {
struct Slot final {
Slot *next_;
uint8_t *start_;
Slot(Slot *next, uint8_t *start);
~Slot();
};
struct ExecutablePage final {
ExecutablePage *next_;
uint32_t capacity_;
uint8_t *base_;
uint8_t *empty_head_;
std::unique_ptr<Slot> active_slots_;
ExecutablePage(uint32_t capacity, void *buffer);
~ExecutablePage();
void *Push(const CodeTemplate &code);
const void *TryPush(const CodeTemplate &code) const;
bool Revert(const void *last_pushed);
};
std::unique_ptr<ExecutablePage> active_head_;
public:
void *Push(const CodeTemplate &code, const void *source);
bool Revert(const void *last_pushed);
};
| [
"k.toshihito@yahoo.de"
] | k.toshihito@yahoo.de |
d4febbadd64986dcd893946eb294850e65478090 | 4d98f7d68f5efbc0c9aace6481b04c5b24708e04 | /ACM/区域赛/广州2014/hdu5135.cpp | def1ff89a293a11e3fcdf9bcab191435c006442a | [] | no_license | matrix889/note | 93821ffd78527573e668dd4f106c1f454c819152 | 855b6a08d03a53015f8dec34d5108b21822fa6d9 | refs/heads/master | 2020-05-18T20:06:19.581753 | 2015-07-02T13:14:23 | 2015-07-02T13:14:23 | 34,161,219 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,545 | cpp | #include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <cmath>
using namespace std;
const int MAXN = 15;
vector<int> g[MAXN];
int len[MAXN], n;
double ans;
double getArea(int a, int b, int c){
double p = 1.0 * (a + b + c) / 2.0;
return sqrt(p * (p-a) * (p-b) * (p-c));
}
void init(){
for (int i = 0; i < MAXN; ++i)
g[i].clear();
ans = 0.0;
}
void solve(int x, int max_edge, double sum){
if (x == n){
ans = max(ans, sum);
return;
}
double tmp_sum;
int tmp_max_edge;
//if (max_edge != -1 && max_edge <= len[x]) return;
for (int i = 0; i <= n / 3; ++i){
tmp_sum = sum;
//tmp_max_edge = max_edge;
if (i == 0){
solve(x + 1, max_edge, sum);
continue;
}
if (i > 1 && g[i-1].size() == 0) break;
if (g[i].size() == 3) continue;
if (g[i].size() == 2){
if (g[i][0] + g[i][1] <= len[x])
continue;
}
g[i].push_back(len[x]);
if (g[i].size() == 3)
tmp_sum += getArea(g[i][0], g[i][1], g[i][2]);
if (g[i].size() == 2)
tmp_max_edge = max(max_edge, g[i][0] + g[i][1]);
solve(x + 1, tmp_max_edge, tmp_sum);
g[i].pop_back();
}
}
int main(){
while (scanf("%d", &n) != EOF && n){
for (int i = 0; i < n; ++i)
scanf("%d", &len[i]);
init();
sort(len, len + n);
solve(0, -1, 0.0);
printf("%.2f\n", ans);
}
return 0;
}
| [
"mydearqueen@foxmail.com"
] | mydearqueen@foxmail.com |
35a1cbb3f587fa48173ff2fdf2f343ee155992d4 | 30b901e842831cb8bdf2768f1ba86d0b807fe869 | /PA09/src/texture.cpp | 2d8fef219faf5d5d9383fd92f7a9b54f57e241bb | [] | no_license | csorkin09/CS-480 | 39892591eafde024b5b63ef583e9e62e2aa3856d | bf094cb9b14f095defbba45e8eb9747d4bd3dcb9 | refs/heads/master | 2020-04-09T23:56:15.701319 | 2013-11-04T09:34:21 | 2013-11-04T09:34:21 | 12,443,207 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,700 | cpp | /*
Copyright 2011 Etay Meiri
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <iostream>
#include "texture.h"
Texture::Texture(GLenum TextureTarget, const std::string& FileName)
{
m_textureTarget = TextureTarget;
m_fileName = FileName;
m_pImage = NULL;
}
bool Texture::Load()
{
try {
m_pImage = new Magick::Image(m_fileName);
m_pImage->write(&m_blob, "RGBA");
}
catch (Magick::Error& Error) {
std::cout << "Error loading texture '" << m_fileName << "': " << Error.what() << std::endl;
return false;
}
glGenTextures(1, &m_textureObj);
glBindTexture(m_textureTarget, m_textureObj);
glTexImage2D(m_textureTarget, 0, GL_RGB, m_pImage->columns(), m_pImage->rows(), 0, GL_RGBA, GL_UNSIGNED_BYTE, m_blob.data());
glTexParameterf(m_textureTarget, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameterf(m_textureTarget, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
return true;
}
void Texture::Bind(GLenum TextureUnit)
{
glActiveTexture(TextureUnit);
glBindTexture(m_textureTarget, m_textureObj);
}
| [
"csorkin09@gmail.com"
] | csorkin09@gmail.com |
93a78cd0e927c21fb6c7990b77c9856ca02f3690 | 301455e9f9187f9a9e313837e48f57756dc51fcf | /llvm-project/llvm/lib/Support/YAMLTraits.cpp | a4b782db0a96e6c071093a0b392b991e065be8ba | [
"Spencer-94",
"BSD-3-Clause",
"NCSA",
"LLVM-exception",
"Apache-2.0"
] | permissive | djolertrk/call-site-params-stats | 0832a24d52ac8ea5edd63ffc71446203cb5d6c3d | a88d560f57111fcaf7318c041808be6f6d2612bf | refs/heads/master | 2022-06-30T18:31:29.253782 | 2020-05-15T13:35:10 | 2020-05-15T13:35:10 | 263,873,406 | 3 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 29,285 | cpp | //===- lib/Support/YAMLTraits.cpp -----------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#include "llvm/Support/YAMLTraits.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/Twine.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/Errc.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/Format.h"
#include "llvm/Support/LineIterator.h"
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/Unicode.h"
#include "llvm/Support/YAMLParser.h"
#include "llvm/Support/raw_ostream.h"
#include <algorithm>
#include <cassert>
#include <cstdint>
#include <cstdlib>
#include <cstring>
#include <string>
#include <vector>
using namespace llvm;
using namespace yaml;
//===----------------------------------------------------------------------===//
// IO
//===----------------------------------------------------------------------===//
IO::IO(void *Context) : Ctxt(Context) {}
IO::~IO() = default;
void *IO::getContext() const {
return Ctxt;
}
void IO::setContext(void *Context) {
Ctxt = Context;
}
//===----------------------------------------------------------------------===//
// Input
//===----------------------------------------------------------------------===//
Input::Input(StringRef InputContent, void *Ctxt,
SourceMgr::DiagHandlerTy DiagHandler, void *DiagHandlerCtxt)
: IO(Ctxt), Strm(new Stream(InputContent, SrcMgr, false, &EC)) {
if (DiagHandler)
SrcMgr.setDiagHandler(DiagHandler, DiagHandlerCtxt);
DocIterator = Strm->begin();
}
Input::Input(MemoryBufferRef Input, void *Ctxt,
SourceMgr::DiagHandlerTy DiagHandler, void *DiagHandlerCtxt)
: IO(Ctxt), Strm(new Stream(Input, SrcMgr, false, &EC)) {
if (DiagHandler)
SrcMgr.setDiagHandler(DiagHandler, DiagHandlerCtxt);
DocIterator = Strm->begin();
}
Input::~Input() = default;
std::error_code Input::error() { return EC; }
// Pin the vtables to this file.
void Input::HNode::anchor() {}
void Input::EmptyHNode::anchor() {}
void Input::ScalarHNode::anchor() {}
void Input::MapHNode::anchor() {}
void Input::SequenceHNode::anchor() {}
bool Input::outputting() const {
return false;
}
bool Input::setCurrentDocument() {
if (DocIterator != Strm->end()) {
Node *N = DocIterator->getRoot();
if (!N) {
EC = make_error_code(errc::invalid_argument);
return false;
}
if (isa<NullNode>(N)) {
// Empty files are allowed and ignored
++DocIterator;
return setCurrentDocument();
}
TopNode = createHNodes(N);
CurrentNode = TopNode.get();
return true;
}
return false;
}
bool Input::nextDocument() {
return ++DocIterator != Strm->end();
}
const Node *Input::getCurrentNode() const {
return CurrentNode ? CurrentNode->_node : nullptr;
}
bool Input::mapTag(StringRef Tag, bool Default) {
// CurrentNode can be null if setCurrentDocument() was unable to
// parse the document because it was invalid or empty.
if (!CurrentNode)
return false;
std::string foundTag = CurrentNode->_node->getVerbatimTag();
if (foundTag.empty()) {
// If no tag found and 'Tag' is the default, say it was found.
return Default;
}
// Return true iff found tag matches supplied tag.
return Tag.equals(foundTag);
}
void Input::beginMapping() {
if (EC)
return;
// CurrentNode can be null if the document is empty.
MapHNode *MN = dyn_cast_or_null<MapHNode>(CurrentNode);
if (MN) {
MN->ValidKeys.clear();
}
}
std::vector<StringRef> Input::keys() {
MapHNode *MN = dyn_cast<MapHNode>(CurrentNode);
std::vector<StringRef> Ret;
if (!MN) {
setError(CurrentNode, "not a mapping");
return Ret;
}
for (auto &P : MN->Mapping)
Ret.push_back(P.first());
return Ret;
}
bool Input::preflightKey(const char *Key, bool Required, bool, bool &UseDefault,
void *&SaveInfo) {
UseDefault = false;
if (EC)
return false;
// CurrentNode is null for empty documents, which is an error in case required
// nodes are present.
if (!CurrentNode) {
if (Required)
EC = make_error_code(errc::invalid_argument);
return false;
}
MapHNode *MN = dyn_cast<MapHNode>(CurrentNode);
if (!MN) {
if (Required || !isa<EmptyHNode>(CurrentNode))
setError(CurrentNode, "not a mapping");
return false;
}
MN->ValidKeys.push_back(Key);
HNode *Value = MN->Mapping[Key].get();
if (!Value) {
if (Required)
setError(CurrentNode, Twine("missing required key '") + Key + "'");
else
UseDefault = true;
return false;
}
SaveInfo = CurrentNode;
CurrentNode = Value;
return true;
}
void Input::postflightKey(void *saveInfo) {
CurrentNode = reinterpret_cast<HNode *>(saveInfo);
}
void Input::endMapping() {
if (EC)
return;
// CurrentNode can be null if the document is empty.
MapHNode *MN = dyn_cast_or_null<MapHNode>(CurrentNode);
if (!MN)
return;
for (const auto &NN : MN->Mapping) {
if (!is_contained(MN->ValidKeys, NN.first())) {
setError(NN.second.get(), Twine("unknown key '") + NN.first() + "'");
break;
}
}
}
void Input::beginFlowMapping() { beginMapping(); }
void Input::endFlowMapping() { endMapping(); }
unsigned Input::beginSequence() {
if (SequenceHNode *SQ = dyn_cast<SequenceHNode>(CurrentNode))
return SQ->Entries.size();
if (isa<EmptyHNode>(CurrentNode))
return 0;
// Treat case where there's a scalar "null" value as an empty sequence.
if (ScalarHNode *SN = dyn_cast<ScalarHNode>(CurrentNode)) {
if (isNull(SN->value()))
return 0;
}
// Any other type of HNode is an error.
setError(CurrentNode, "not a sequence");
return 0;
}
void Input::endSequence() {
}
bool Input::preflightElement(unsigned Index, void *&SaveInfo) {
if (EC)
return false;
if (SequenceHNode *SQ = dyn_cast<SequenceHNode>(CurrentNode)) {
SaveInfo = CurrentNode;
CurrentNode = SQ->Entries[Index].get();
return true;
}
return false;
}
void Input::postflightElement(void *SaveInfo) {
CurrentNode = reinterpret_cast<HNode *>(SaveInfo);
}
unsigned Input::beginFlowSequence() { return beginSequence(); }
bool Input::preflightFlowElement(unsigned index, void *&SaveInfo) {
if (EC)
return false;
if (SequenceHNode *SQ = dyn_cast<SequenceHNode>(CurrentNode)) {
SaveInfo = CurrentNode;
CurrentNode = SQ->Entries[index].get();
return true;
}
return false;
}
void Input::postflightFlowElement(void *SaveInfo) {
CurrentNode = reinterpret_cast<HNode *>(SaveInfo);
}
void Input::endFlowSequence() {
}
void Input::beginEnumScalar() {
ScalarMatchFound = false;
}
bool Input::matchEnumScalar(const char *Str, bool) {
if (ScalarMatchFound)
return false;
if (ScalarHNode *SN = dyn_cast<ScalarHNode>(CurrentNode)) {
if (SN->value().equals(Str)) {
ScalarMatchFound = true;
return true;
}
}
return false;
}
bool Input::matchEnumFallback() {
if (ScalarMatchFound)
return false;
ScalarMatchFound = true;
return true;
}
void Input::endEnumScalar() {
if (!ScalarMatchFound) {
setError(CurrentNode, "unknown enumerated scalar");
}
}
bool Input::beginBitSetScalar(bool &DoClear) {
BitValuesUsed.clear();
if (SequenceHNode *SQ = dyn_cast<SequenceHNode>(CurrentNode)) {
BitValuesUsed.insert(BitValuesUsed.begin(), SQ->Entries.size(), false);
} else {
setError(CurrentNode, "expected sequence of bit values");
}
DoClear = true;
return true;
}
bool Input::bitSetMatch(const char *Str, bool) {
if (EC)
return false;
if (SequenceHNode *SQ = dyn_cast<SequenceHNode>(CurrentNode)) {
unsigned Index = 0;
for (auto &N : SQ->Entries) {
if (ScalarHNode *SN = dyn_cast<ScalarHNode>(N.get())) {
if (SN->value().equals(Str)) {
BitValuesUsed[Index] = true;
return true;
}
} else {
setError(CurrentNode, "unexpected scalar in sequence of bit values");
}
++Index;
}
} else {
setError(CurrentNode, "expected sequence of bit values");
}
return false;
}
void Input::endBitSetScalar() {
if (EC)
return;
if (SequenceHNode *SQ = dyn_cast<SequenceHNode>(CurrentNode)) {
assert(BitValuesUsed.size() == SQ->Entries.size());
for (unsigned i = 0; i < SQ->Entries.size(); ++i) {
if (!BitValuesUsed[i]) {
setError(SQ->Entries[i].get(), "unknown bit value");
return;
}
}
}
}
void Input::scalarString(StringRef &S, QuotingType) {
if (ScalarHNode *SN = dyn_cast<ScalarHNode>(CurrentNode)) {
S = SN->value();
} else {
setError(CurrentNode, "unexpected scalar");
}
}
void Input::blockScalarString(StringRef &S) { scalarString(S, QuotingType::None); }
void Input::scalarTag(std::string &Tag) {
Tag = CurrentNode->_node->getVerbatimTag();
}
void Input::setError(HNode *hnode, const Twine &message) {
assert(hnode && "HNode must not be NULL");
setError(hnode->_node, message);
}
NodeKind Input::getNodeKind() {
if (isa<ScalarHNode>(CurrentNode))
return NodeKind::Scalar;
else if (isa<MapHNode>(CurrentNode))
return NodeKind::Map;
else if (isa<SequenceHNode>(CurrentNode))
return NodeKind::Sequence;
llvm_unreachable("Unsupported node kind");
}
void Input::setError(Node *node, const Twine &message) {
Strm->printError(node, message);
EC = make_error_code(errc::invalid_argument);
}
std::unique_ptr<Input::HNode> Input::createHNodes(Node *N) {
SmallString<128> StringStorage;
if (ScalarNode *SN = dyn_cast<ScalarNode>(N)) {
StringRef KeyStr = SN->getValue(StringStorage);
if (!StringStorage.empty()) {
// Copy string to permanent storage
KeyStr = StringStorage.str().copy(StringAllocator);
}
return std::make_unique<ScalarHNode>(N, KeyStr);
} else if (BlockScalarNode *BSN = dyn_cast<BlockScalarNode>(N)) {
StringRef ValueCopy = BSN->getValue().copy(StringAllocator);
return std::make_unique<ScalarHNode>(N, ValueCopy);
} else if (SequenceNode *SQ = dyn_cast<SequenceNode>(N)) {
auto SQHNode = std::make_unique<SequenceHNode>(N);
for (Node &SN : *SQ) {
auto Entry = createHNodes(&SN);
if (EC)
break;
SQHNode->Entries.push_back(std::move(Entry));
}
return std::move(SQHNode);
} else if (MappingNode *Map = dyn_cast<MappingNode>(N)) {
auto mapHNode = std::make_unique<MapHNode>(N);
for (KeyValueNode &KVN : *Map) {
Node *KeyNode = KVN.getKey();
ScalarNode *Key = dyn_cast_or_null<ScalarNode>(KeyNode);
Node *Value = KVN.getValue();
if (!Key || !Value) {
if (!Key)
setError(KeyNode, "Map key must be a scalar");
if (!Value)
setError(KeyNode, "Map value must not be empty");
break;
}
StringStorage.clear();
StringRef KeyStr = Key->getValue(StringStorage);
if (!StringStorage.empty()) {
// Copy string to permanent storage
KeyStr = StringStorage.str().copy(StringAllocator);
}
auto ValueHNode = createHNodes(Value);
if (EC)
break;
mapHNode->Mapping[KeyStr] = std::move(ValueHNode);
}
return std::move(mapHNode);
} else if (isa<NullNode>(N)) {
return std::make_unique<EmptyHNode>(N);
} else {
setError(N, "unknown node kind");
return nullptr;
}
}
void Input::setError(const Twine &Message) {
setError(CurrentNode, Message);
}
bool Input::canElideEmptySequence() {
return false;
}
//===----------------------------------------------------------------------===//
// Output
//===----------------------------------------------------------------------===//
Output::Output(raw_ostream &yout, void *context, int WrapColumn)
: IO(context), Out(yout), WrapColumn(WrapColumn) {}
Output::~Output() = default;
bool Output::outputting() const {
return true;
}
void Output::beginMapping() {
StateStack.push_back(inMapFirstKey);
PaddingBeforeContainer = Padding;
Padding = "\n";
}
bool Output::mapTag(StringRef Tag, bool Use) {
if (Use) {
// If this tag is being written inside a sequence we should write the start
// of the sequence before writing the tag, otherwise the tag won't be
// attached to the element in the sequence, but rather the sequence itself.
bool SequenceElement = false;
if (StateStack.size() > 1) {
auto &E = StateStack[StateStack.size() - 2];
SequenceElement = inSeqAnyElement(E) || inFlowSeqAnyElement(E);
}
if (SequenceElement && StateStack.back() == inMapFirstKey) {
newLineCheck();
} else {
output(" ");
}
output(Tag);
if (SequenceElement) {
// If we're writing the tag during the first element of a map, the tag
// takes the place of the first element in the sequence.
if (StateStack.back() == inMapFirstKey) {
StateStack.pop_back();
StateStack.push_back(inMapOtherKey);
}
// Tags inside maps in sequences should act as keys in the map from a
// formatting perspective, so we always want a newline in a sequence.
Padding = "\n";
}
}
return Use;
}
void Output::endMapping() {
// If we did not map anything, we should explicitly emit an empty map
if (StateStack.back() == inMapFirstKey) {
Padding = PaddingBeforeContainer;
newLineCheck();
output("{}");
Padding = "\n";
}
StateStack.pop_back();
}
std::vector<StringRef> Output::keys() {
report_fatal_error("invalid call");
}
bool Output::preflightKey(const char *Key, bool Required, bool SameAsDefault,
bool &UseDefault, void *&) {
UseDefault = false;
if (Required || !SameAsDefault || WriteDefaultValues) {
auto State = StateStack.back();
if (State == inFlowMapFirstKey || State == inFlowMapOtherKey) {
flowKey(Key);
} else {
newLineCheck();
paddedKey(Key);
}
return true;
}
return false;
}
void Output::postflightKey(void *) {
if (StateStack.back() == inMapFirstKey) {
StateStack.pop_back();
StateStack.push_back(inMapOtherKey);
} else if (StateStack.back() == inFlowMapFirstKey) {
StateStack.pop_back();
StateStack.push_back(inFlowMapOtherKey);
}
}
void Output::beginFlowMapping() {
StateStack.push_back(inFlowMapFirstKey);
newLineCheck();
ColumnAtMapFlowStart = Column;
output("{ ");
}
void Output::endFlowMapping() {
StateStack.pop_back();
outputUpToEndOfLine(" }");
}
void Output::beginDocuments() {
outputUpToEndOfLine("---");
}
bool Output::preflightDocument(unsigned index) {
if (index > 0)
outputUpToEndOfLine("\n---");
return true;
}
void Output::postflightDocument() {
}
void Output::endDocuments() {
output("\n...\n");
}
unsigned Output::beginSequence() {
StateStack.push_back(inSeqFirstElement);
PaddingBeforeContainer = Padding;
Padding = "\n";
return 0;
}
void Output::endSequence() {
// If we did not emit anything, we should explicitly emit an empty sequence
if (StateStack.back() == inSeqFirstElement) {
Padding = PaddingBeforeContainer;
newLineCheck();
output("[]");
Padding = "\n";
}
StateStack.pop_back();
}
bool Output::preflightElement(unsigned, void *&) {
return true;
}
void Output::postflightElement(void *) {
if (StateStack.back() == inSeqFirstElement) {
StateStack.pop_back();
StateStack.push_back(inSeqOtherElement);
} else if (StateStack.back() == inFlowSeqFirstElement) {
StateStack.pop_back();
StateStack.push_back(inFlowSeqOtherElement);
}
}
unsigned Output::beginFlowSequence() {
StateStack.push_back(inFlowSeqFirstElement);
newLineCheck();
ColumnAtFlowStart = Column;
output("[ ");
NeedFlowSequenceComma = false;
return 0;
}
void Output::endFlowSequence() {
StateStack.pop_back();
outputUpToEndOfLine(" ]");
}
bool Output::preflightFlowElement(unsigned, void *&) {
if (NeedFlowSequenceComma)
output(", ");
if (WrapColumn && Column > WrapColumn) {
output("\n");
for (int i = 0; i < ColumnAtFlowStart; ++i)
output(" ");
Column = ColumnAtFlowStart;
output(" ");
}
return true;
}
void Output::postflightFlowElement(void *) {
NeedFlowSequenceComma = true;
}
void Output::beginEnumScalar() {
EnumerationMatchFound = false;
}
bool Output::matchEnumScalar(const char *Str, bool Match) {
if (Match && !EnumerationMatchFound) {
newLineCheck();
outputUpToEndOfLine(Str);
EnumerationMatchFound = true;
}
return false;
}
bool Output::matchEnumFallback() {
if (EnumerationMatchFound)
return false;
EnumerationMatchFound = true;
return true;
}
void Output::endEnumScalar() {
if (!EnumerationMatchFound)
llvm_unreachable("bad runtime enum value");
}
bool Output::beginBitSetScalar(bool &DoClear) {
newLineCheck();
output("[ ");
NeedBitValueComma = false;
DoClear = false;
return true;
}
bool Output::bitSetMatch(const char *Str, bool Matches) {
if (Matches) {
if (NeedBitValueComma)
output(", ");
output(Str);
NeedBitValueComma = true;
}
return false;
}
void Output::endBitSetScalar() {
outputUpToEndOfLine(" ]");
}
void Output::scalarString(StringRef &S, QuotingType MustQuote) {
newLineCheck();
if (S.empty()) {
// Print '' for the empty string because leaving the field empty is not
// allowed.
outputUpToEndOfLine("''");
return;
}
if (MustQuote == QuotingType::None) {
// Only quote if we must.
outputUpToEndOfLine(S);
return;
}
const char *const Quote = MustQuote == QuotingType::Single ? "'" : "\"";
output(Quote); // Starting quote.
// When using double-quoted strings (and only in that case), non-printable characters may be
// present, and will be escaped using a variety of unicode-scalar and special short-form
// escapes. This is handled in yaml::escape.
if (MustQuote == QuotingType::Double) {
output(yaml::escape(S, /* EscapePrintable= */ false));
outputUpToEndOfLine(Quote);
return;
}
unsigned i = 0;
unsigned j = 0;
unsigned End = S.size();
const char *Base = S.data();
// When using single-quoted strings, any single quote ' must be doubled to be escaped.
while (j < End) {
if (S[j] == '\'') { // Escape quotes.
output(StringRef(&Base[i], j - i)); // "flush".
output(StringLiteral("''")); // Print it as ''
i = j + 1;
}
++j;
}
output(StringRef(&Base[i], j - i));
outputUpToEndOfLine(Quote); // Ending quote.
}
void Output::blockScalarString(StringRef &S) {
if (!StateStack.empty())
newLineCheck();
output(" |");
outputNewLine();
unsigned Indent = StateStack.empty() ? 1 : StateStack.size();
auto Buffer = MemoryBuffer::getMemBuffer(S, "", false);
for (line_iterator Lines(*Buffer, false); !Lines.is_at_end(); ++Lines) {
for (unsigned I = 0; I < Indent; ++I) {
output(" ");
}
output(*Lines);
outputNewLine();
}
}
void Output::scalarTag(std::string &Tag) {
if (Tag.empty())
return;
newLineCheck();
output(Tag);
output(" ");
}
void Output::setError(const Twine &message) {
}
bool Output::canElideEmptySequence() {
// Normally, with an optional key/value where the value is an empty sequence,
// the whole key/value can be not written. But, that produces wrong yaml
// if the key/value is the only thing in the map and the map is used in
// a sequence. This detects if the this sequence is the first key/value
// in map that itself is embedded in a sequence.
if (StateStack.size() < 2)
return true;
if (StateStack.back() != inMapFirstKey)
return true;
return !inSeqAnyElement(StateStack[StateStack.size() - 2]);
}
void Output::output(StringRef s) {
Column += s.size();
Out << s;
}
void Output::outputUpToEndOfLine(StringRef s) {
output(s);
if (StateStack.empty() || (!inFlowSeqAnyElement(StateStack.back()) &&
!inFlowMapAnyKey(StateStack.back())))
Padding = "\n";
}
void Output::outputNewLine() {
Out << "\n";
Column = 0;
}
// if seq at top, indent as if map, then add "- "
// if seq in middle, use "- " if firstKey, else use " "
//
void Output::newLineCheck() {
if (Padding != "\n") {
output(Padding);
Padding = {};
return;
}
outputNewLine();
Padding = {};
if (StateStack.size() == 0)
return;
unsigned Indent = StateStack.size() - 1;
bool OutputDash = false;
if (StateStack.back() == inSeqFirstElement ||
StateStack.back() == inSeqOtherElement) {
OutputDash = true;
} else if ((StateStack.size() > 1) &&
((StateStack.back() == inMapFirstKey) ||
inFlowSeqAnyElement(StateStack.back()) ||
(StateStack.back() == inFlowMapFirstKey)) &&
inSeqAnyElement(StateStack[StateStack.size() - 2])) {
--Indent;
OutputDash = true;
}
for (unsigned i = 0; i < Indent; ++i) {
output(" ");
}
if (OutputDash) {
output("- ");
}
}
void Output::paddedKey(StringRef key) {
output(key);
output(":");
const char *spaces = " ";
if (key.size() < strlen(spaces))
Padding = &spaces[key.size()];
else
Padding = " ";
}
void Output::flowKey(StringRef Key) {
if (StateStack.back() == inFlowMapOtherKey)
output(", ");
if (WrapColumn && Column > WrapColumn) {
output("\n");
for (int I = 0; I < ColumnAtMapFlowStart; ++I)
output(" ");
Column = ColumnAtMapFlowStart;
output(" ");
}
output(Key);
output(": ");
}
NodeKind Output::getNodeKind() { report_fatal_error("invalid call"); }
bool Output::inSeqAnyElement(InState State) {
return State == inSeqFirstElement || State == inSeqOtherElement;
}
bool Output::inFlowSeqAnyElement(InState State) {
return State == inFlowSeqFirstElement || State == inFlowSeqOtherElement;
}
bool Output::inMapAnyKey(InState State) {
return State == inMapFirstKey || State == inMapOtherKey;
}
bool Output::inFlowMapAnyKey(InState State) {
return State == inFlowMapFirstKey || State == inFlowMapOtherKey;
}
//===----------------------------------------------------------------------===//
// traits for built-in types
//===----------------------------------------------------------------------===//
void ScalarTraits<bool>::output(const bool &Val, void *, raw_ostream &Out) {
Out << (Val ? "true" : "false");
}
StringRef ScalarTraits<bool>::input(StringRef Scalar, void *, bool &Val) {
if (Scalar.equals("true")) {
Val = true;
return StringRef();
} else if (Scalar.equals("false")) {
Val = false;
return StringRef();
}
return "invalid boolean";
}
void ScalarTraits<char>::output(const char &Val, void *, raw_ostream &Out) {
Out << Val;
}
StringRef ScalarTraits<char>::input(StringRef Scalar, void *, char &Val) {
if (Scalar.size() != 1)
return "invalid character";
Val = Scalar[0];
return StringRef();
}
void ScalarTraits<StringRef>::output(const StringRef &Val, void *,
raw_ostream &Out) {
Out << Val;
}
StringRef ScalarTraits<StringRef>::input(StringRef Scalar, void *,
StringRef &Val) {
Val = Scalar;
return StringRef();
}
void ScalarTraits<std::string>::output(const std::string &Val, void *,
raw_ostream &Out) {
Out << Val;
}
StringRef ScalarTraits<std::string>::input(StringRef Scalar, void *,
std::string &Val) {
Val = Scalar.str();
return StringRef();
}
void ScalarTraits<uint8_t>::output(const uint8_t &Val, void *,
raw_ostream &Out) {
// use temp uin32_t because ostream thinks uint8_t is a character
uint32_t Num = Val;
Out << Num;
}
StringRef ScalarTraits<uint8_t>::input(StringRef Scalar, void *, uint8_t &Val) {
unsigned long long n;
if (getAsUnsignedInteger(Scalar, 0, n))
return "invalid number";
if (n > 0xFF)
return "out of range number";
Val = n;
return StringRef();
}
void ScalarTraits<uint16_t>::output(const uint16_t &Val, void *,
raw_ostream &Out) {
Out << Val;
}
StringRef ScalarTraits<uint16_t>::input(StringRef Scalar, void *,
uint16_t &Val) {
unsigned long long n;
if (getAsUnsignedInteger(Scalar, 0, n))
return "invalid number";
if (n > 0xFFFF)
return "out of range number";
Val = n;
return StringRef();
}
void ScalarTraits<uint32_t>::output(const uint32_t &Val, void *,
raw_ostream &Out) {
Out << Val;
}
StringRef ScalarTraits<uint32_t>::input(StringRef Scalar, void *,
uint32_t &Val) {
unsigned long long n;
if (getAsUnsignedInteger(Scalar, 0, n))
return "invalid number";
if (n > 0xFFFFFFFFUL)
return "out of range number";
Val = n;
return StringRef();
}
void ScalarTraits<uint64_t>::output(const uint64_t &Val, void *,
raw_ostream &Out) {
Out << Val;
}
StringRef ScalarTraits<uint64_t>::input(StringRef Scalar, void *,
uint64_t &Val) {
unsigned long long N;
if (getAsUnsignedInteger(Scalar, 0, N))
return "invalid number";
Val = N;
return StringRef();
}
void ScalarTraits<int8_t>::output(const int8_t &Val, void *, raw_ostream &Out) {
// use temp in32_t because ostream thinks int8_t is a character
int32_t Num = Val;
Out << Num;
}
StringRef ScalarTraits<int8_t>::input(StringRef Scalar, void *, int8_t &Val) {
long long N;
if (getAsSignedInteger(Scalar, 0, N))
return "invalid number";
if ((N > 127) || (N < -128))
return "out of range number";
Val = N;
return StringRef();
}
void ScalarTraits<int16_t>::output(const int16_t &Val, void *,
raw_ostream &Out) {
Out << Val;
}
StringRef ScalarTraits<int16_t>::input(StringRef Scalar, void *, int16_t &Val) {
long long N;
if (getAsSignedInteger(Scalar, 0, N))
return "invalid number";
if ((N > INT16_MAX) || (N < INT16_MIN))
return "out of range number";
Val = N;
return StringRef();
}
void ScalarTraits<int32_t>::output(const int32_t &Val, void *,
raw_ostream &Out) {
Out << Val;
}
StringRef ScalarTraits<int32_t>::input(StringRef Scalar, void *, int32_t &Val) {
long long N;
if (getAsSignedInteger(Scalar, 0, N))
return "invalid number";
if ((N > INT32_MAX) || (N < INT32_MIN))
return "out of range number";
Val = N;
return StringRef();
}
void ScalarTraits<int64_t>::output(const int64_t &Val, void *,
raw_ostream &Out) {
Out << Val;
}
StringRef ScalarTraits<int64_t>::input(StringRef Scalar, void *, int64_t &Val) {
long long N;
if (getAsSignedInteger(Scalar, 0, N))
return "invalid number";
Val = N;
return StringRef();
}
void ScalarTraits<double>::output(const double &Val, void *, raw_ostream &Out) {
Out << format("%g", Val);
}
StringRef ScalarTraits<double>::input(StringRef Scalar, void *, double &Val) {
if (to_float(Scalar, Val))
return StringRef();
return "invalid floating point number";
}
void ScalarTraits<float>::output(const float &Val, void *, raw_ostream &Out) {
Out << format("%g", Val);
}
StringRef ScalarTraits<float>::input(StringRef Scalar, void *, float &Val) {
if (to_float(Scalar, Val))
return StringRef();
return "invalid floating point number";
}
void ScalarTraits<Hex8>::output(const Hex8 &Val, void *, raw_ostream &Out) {
uint8_t Num = Val;
Out << format("0x%02X", Num);
}
StringRef ScalarTraits<Hex8>::input(StringRef Scalar, void *, Hex8 &Val) {
unsigned long long n;
if (getAsUnsignedInteger(Scalar, 0, n))
return "invalid hex8 number";
if (n > 0xFF)
return "out of range hex8 number";
Val = n;
return StringRef();
}
void ScalarTraits<Hex16>::output(const Hex16 &Val, void *, raw_ostream &Out) {
uint16_t Num = Val;
Out << format("0x%04X", Num);
}
StringRef ScalarTraits<Hex16>::input(StringRef Scalar, void *, Hex16 &Val) {
unsigned long long n;
if (getAsUnsignedInteger(Scalar, 0, n))
return "invalid hex16 number";
if (n > 0xFFFF)
return "out of range hex16 number";
Val = n;
return StringRef();
}
void ScalarTraits<Hex32>::output(const Hex32 &Val, void *, raw_ostream &Out) {
uint32_t Num = Val;
Out << format("0x%08X", Num);
}
StringRef ScalarTraits<Hex32>::input(StringRef Scalar, void *, Hex32 &Val) {
unsigned long long n;
if (getAsUnsignedInteger(Scalar, 0, n))
return "invalid hex32 number";
if (n > 0xFFFFFFFFUL)
return "out of range hex32 number";
Val = n;
return StringRef();
}
void ScalarTraits<Hex64>::output(const Hex64 &Val, void *, raw_ostream &Out) {
uint64_t Num = Val;
Out << format("0x%016llX", Num);
}
StringRef ScalarTraits<Hex64>::input(StringRef Scalar, void *, Hex64 &Val) {
unsigned long long Num;
if (getAsUnsignedInteger(Scalar, 0, Num))
return "invalid hex64 number";
Val = Num;
return StringRef();
}
| [
"djordje.todorovic@syrmia.com"
] | djordje.todorovic@syrmia.com |
c96134ffb712b68c3a4364abd036abe150edf7e5 | b8975c1aa9a853a79265519487f835277fc65f42 | /CheatEngine/MemFilter.h | a5128691437dd9aea2f2be19975a6ca5849bc85d | [] | no_license | tamliad123456/MemInvader | 7df7b3e5d153457bd91e2033d365c08f90566358 | d1d3a0ff31aaa6fc481710714e121b0fbac412e1 | refs/heads/master | 2021-12-26T04:02:12.355203 | 2021-08-27T16:12:36 | 2021-08-27T16:12:36 | 208,784,734 | 0 | 0 | null | 2019-09-17T12:24:10 | 2019-09-16T11:38:29 | C++ | UTF-8 | C++ | false | false | 722 | h | #pragma once
#include "MemInvaderInclude.h"
enum Type : char
{
BIGGER,
SMALLER,
DIFFERANT,
SAME
};
class MemFilter
{
PTR<std::vector<MemValue>> addresses;
public:
MemFilter(PTR<std::vector<MemValue>>);
~MemFilter();
void filter(Process& proc, Type filter);
void filter_new_value(Process& proc, char* value, int len);
template<class T>
void filter_new_value(Process& proc, T& value); //if it navigates a char array to Process::find with the right template the other "filter_new_value" arent needed
template<int len>
void filter_new_value(Process& proc, char (&value)[len]);
template<int len>
void filter_new_value(Process& proc, wchar_t (&value)[len]);
std::vector<uint64_t> get_addresses();
};
| [
"yanivhaim12@gmail.com"
] | yanivhaim12@gmail.com |
50132f16a42d315fee1bb7f578916045f8f51861 | fec8743a185b50b7409dbcd38d8838e4bc239da7 | /C++/oop2/stringbad.cpp | f7abca2097d6381b840c856b7d85c1fff5709b42 | [] | no_license | Meowcolm024/Playground | 1d4caa5f298801b2de9202d6b8994273711f0567 | b0538360ef827de9d2e663f49661318e87e27b16 | refs/heads/master | 2023-05-02T10:36:06.280958 | 2021-05-25T02:25:21 | 2021-05-25T02:25:21 | 290,756,293 | 3 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,185 | cpp | #include <iostream>
#include <cstring>
#include "stringbad.h"
using std::cout;
// static member, declare separately outside!
int StringBad::nums = 0;
StringBad::StringBad(const char *s)
{
len = std::strlen(s);
str = new char[len + 1];
std::strcpy(str, s);
nums++;
cout << nums << ": \"" << str << "\" created.\n";
}
StringBad::StringBad()
{
len = 4;
str = new char[4];
std::strcpy(str, "C++");
nums++;
cout << nums << ": \"" << str << "\" created.\n";
}
StringBad::~StringBad()
{
cout << "\"" << str << "\" deleted.\n";
--nums;
cout << nums << " left.\n";
delete[] str;
}
StringBad::StringBad(const StringBad &st)
{
nums++;
len = st.len;
str = new char[len + 1];
std::strcpy(str, st.str);
cout << nums << ": \"" << str << "\" created.\n";
}
StringBad &StringBad::operator=(const StringBad &st)
{
if (this == &st) // check self
return *this;
delete[] str; // delete original str
len = st.len;
str = new char[len + 1];
std::strcpy(str, st.str);
return *this;
}
std::ostream &operator<<(std::ostream &os, const StringBad &st)
{
os << st.str;
return os;
}
| [
"luoyicong1026@live.com"
] | luoyicong1026@live.com |
d5c3e45ecbbf949e4ac398f678d413ec52de2f96 | 6680f8d317de48876d4176d443bfd580ec7a5aef | /Header/tgt/line.h | 11863530dc3dd872c4578d5a9ad2ca1d3babb1ee | [] | no_license | AlirezaMojtabavi/misInteractiveSegmentation | 1b51b0babb0c6f9601330fafc5c15ca560d6af31 | 4630a8c614f6421042636a2adc47ed6b5d960a2b | refs/heads/master | 2020-12-10T11:09:19.345393 | 2020-03-04T11:34:26 | 2020-03-04T11:34:26 | 233,574,482 | 3 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 8,775 | h | /**********************************************************************
* *
* tgt - Tiny Graphics Toolbox *
* *
* Copyright (C) 2006-2008 Visualization and Computer Graphics Group, *
* Department of Computer Science, University of Muenster, Germany. *
* <http://viscg.uni-muenster.de> *
* *
* This file is part of the tgt library. This library is free *
* software; you can redistribute it and/or modify it under the terms *
* of the GNU Lesser General Public License version 2.1 as published *
* by the Free Software Foundation. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Lesser General Public License for more details. *
* *
* You should have received a copy of the GNU Lesser General Public *
* License in the file "LICENSE.txt" along with this library. *
* If not, see <http://www.gnu.org/licenses/>. *
* *
**********************************************************************/
#ifndef TGT_LINE_H
#define TGT_LINE_H
#include "tgt/config.h"
#include "tgt/vector.h"
namespace tgt {
///This implements a 2D line(segment).
template <class T>
class Line2 {
Vector2<T> p_; /// position
Vector2<T> d_; /// direction
public:
/// trivial standard constructor
Line2() {}
/// construct a line from starting and end point
Line2(const Vector2<T>& start, const Vector2<T>& end)
: p_(start)
, d_(end - start)
{}
/**
* Interpolates between start and end
* @param t Should be betweeen 0 and 1 for line segments
* @return (start*(1-t) + end*t)
*/
Vector2<T> getFromParam(T t) {
return p_ + t * d_;
}
Vector2<T> getStart() const { return p_; }
Vector2<T> getEnd() const { return p_ + d_; }
///Set startingpoint to start, leaves end unchanged.
void setStart(const Vector2<T>& start) { d_ = (p_ + d_) - start; p_ = start; }
///Set endpoint to end, leaves start unchanged.
void setEnd(const Vector2<T>& end) { d_ = (end - p_); }
///@return Vector from start to end
Vector2<T> getDirection() const { return d_; }
///Set direction, changing endpoint, leaves start unchanged.
void setDirection(const Vector2<T>& dir) { d_ = dir; }
/**
* intersect a linesegment with another linesegment
* See RTR p617.
*
* @param l the line to intersect this object with
* @param v holds the result if an intersection took place,
* otherwise it remains unchanged
* @return true if these lines intersect, false otherwise
*/
bool intersectSegments(const Line2<T>& l, Vector2<T>& v) const;
/**
* intersect a line with another line
*
* @param l the line to intersect this object with
* @param v holds the result if an intersection took place,
* otherwise it remains unchanged
* @return true if these lines intersect, false otherwise
*/
bool intersect(const Line2<T>& l, Vector2<T>& v) const;
};
// non inline implementation
template <class T>
bool Line2<T>::intersectSegments(const Line2<T>& l, Vector2<T>& v) const {
T f = dot(l.d_, Vector2<T>(-d_.y, d_.x));
T e = dot((p_-l.p_), Vector2<T>(-d_.y, d_.x));
T d = dot((p_-l.p_), Vector2<T>(-l.d_.y, l.d_.x));
//test if s and t are in range [0, 1]:
if(f > 0.0) {
if((d < 0.0) || (d > f))
return false;
}
else {
if((d > 0.0) || (d < f))
return false;
}
if(f > 0.0) {
if((e < 0.0) || (e > f))
return false;
}
else {
if((e > 0.0) || (e < f))
return false;
}
T s = d/f;
v = p_ + (s * d_);
return true;
}
template <class T>
bool Line2<T>::intersect(const Line2<T>& l, Vector2<T>& v) const {
// check whether these lines interesect
T q = d_.y * l.d_.x - d_.x * l.d_.y;
if (q == 0.f)
return false; // these lines a collinear or stack
// calculate paramter for this line where the lines intersect
T t = -( l.d_.x * (p_.y - l.p_.y) + l.d_.y * l.p_.x - l.d_.y * p_.x ) / q;
v = p_ + t * d_;
return true;
}
//-------------------------------------------------------------------------------------------------
///This implements a 3D line(segment).
template <class T>
class Line3 {
Vector3<T> p_; /// position
Vector3<T> d_; /// direction
public:
/// trivial standard constructor
Line3() {}
/// construct a line from two points on a line
Line3(const Vector3<T>& start, const Vector3<T>& end)
: p_(start)
, d_(end - start)
{}
/**
* Interpolates between start and end
* @param t Should be betweeen 0 and 1.
* @return (start*(1-t) + end*t)
*/
Vector3<T> getFromParam(T t) const {
return p_ + t * d_;
}
Vector3<T> getStart() const { return p_; }
Vector3<T> getEnd() const { return p_ + d_; }
///Set startingpoint to start, leaves end unchanged.
void setStart(const Vector3<T>& start) { d_ = (p_ + d_) - start; p_ = start; }
///Set endpoint to end, leaves start unchanged.
void setEnd(const Vector3<T>& end) { d_ = (end - p_); }
///@return Vector from start to end
Vector3<T> getDirection() const { return d_; }
///Set direction, changing endpoint, leaves start unchanged.
void setDirection(const Vector3<T>& dir) { d_ = dir; }
/**
* intersect a linesegment with another linesegment
* See RTR p618
*
* @param l the line to intersect this object with
* @param v holds the result if an intersection took place,
* otherwise it remains unchanged
* @return true if these lines intersect
*/
bool intersectSegments(const Line3<T>& l, Vector3<T>& v) const;
/**
* intersect a line with another line
* See RTR p618
*
* @param l the line to intersect this object with
* @param v holds the result if an intersection took place,
* otherwise it remains unchanged
* @return true if these lines intersect
*/
bool intersect(const Line3<T>& l, Vector3<T>& v) const;
};
//------------------------------------------------------------------------------
// non inline implementation
//------------------------------------------------------------------------------
template <class T>
bool Line3<T>::intersectSegments(const Line3<T>& l, Vector3<T>& v) const {
Vector3<T> c = cross(d_, l.d_);
T q = lengthSq(c);
if (std::abs(q) < 0.00001f)
return false;
else {
Vector3<T> o = l.p_ - p_;
Vector3<T> d = l.d_;
T t = o.x*d_.y*c.z + d_.x*c.y*o.z + c.x*o.y*d_.z
- c.x*d_.y*o.z - d_.x*o.y*c.z - o.x*c.y*d_.z;
T s = o.x*l.d_.y*c.z + l.d_.x*c.y*o.z + c.x*o.y*l.d_.z
- c.x*l.d_.y*o.z - l.d_.x*o.y*c.z - o.x*c.y*l.d_.z;
t /= q;
s /= q;
v = p_ + t*d_;
if( (s >= 0.0) && (s <= 1.0)
&&(t >= 0.0) && (t <= 1.0) )
return true;
else
return false;
}
}
template <class T>
bool Line3<T>::intersect(const Line3<T>& l, Vector3<T>& v) const {
Vector3<T> c = cross(d_, l.d_);
T q = lengthSq(c);
if (std::abs(q) < 0.00001f)
return false;
else {
Vector3<T> o = l.p_ - p_;
Vector3<T> d = l.d_;
T t = o.x*d_.y*c.z + d_.x*c.y*o.z + c.x*o.y*d_.z
- c.x*d_.y*o.z - d_.x*o.y*c.z - o.x*c.y*d_.z;
t /= q;
v = p_ + t*d_;
return true;
}
}
/// ostream-operator
template <class T>
std::ostream& operator << (std::ostream& s, const Line2<T>& l) {
return (s << "x = " << l.getStart() << " + t * " << l.getDirection());
}
template <class T>
std::ostream& operator << (std::ostream& s, const Line3<T>& l) {
return (s << "x = " << l.getStart() << " + t * " << l.getDirection());
}
// typedefs for easy usage
// defined types with a small 'l' like other absolute math classes in tgt
typedef Line2<float> line2;
typedef Line3<float> line3;
typedef Line2<double> dline2;
typedef Line3<double> dline3;
} // namespace tgt
#endif //TGT_LINE_H
| [
"alireza_mojtabavi@yahoo.com"
] | alireza_mojtabavi@yahoo.com |
34432e84878232eeba0e2e19d01bd00ac7fda011 | eba7a5e0ccda4e29c32a87ca1550a550f677f866 | /pdt/src/pptdata.cpp | 0d49d46af62d7712907231528d2ca2305b8a207f | [] | no_license | dantasaps/pdt-model | 6cfc57ac75e8692a57a5daea5cc0021318924681 | 3f2571a2723b9c5a6e8fab379ea5aa6aae93d494 | refs/heads/master | 2021-01-13T11:48:48.140273 | 2017-02-08T16:03:48 | 2017-02-08T16:03:48 | 81,345,118 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,235 | cpp | #include "../inc/pptdata.h"
DadosInstancia::DadosInstancia(){
// Quantidade máxima de minutos extras diários permitidas
QHED = 120;
// Quantidade mínima de descanso entre jornadas em minutos
QMDEJ = 660;
// Tamanho máximo de um turno de trabalho em minutos
QMAHTT = 440;
// Tamanho mínimo de um turno de trabalho em minutos
QMIHTT = 300;
// Quantidade máxima de minutos extras para cada semana da escala
QMHES = 3000;
// Quantidade máxima de minutos não aproveitadas por motorista
// para cada semana da escala
QMAHPS = 2640;
// Jornada semanal de trabalho do motorista, em minutos,
// obrigatoriamente paga pela empresa
QHJS = 2640;
// Quantidade máxima de dias sem folga
QMDSF = 6;
// Quantidade máxima de semanas sem folga no domingo na escala
QMSSFD = 6;
}
// Dados inicias e default da instancia.
DadosInstancia::DadosInstancia(string path){
new (this) DadosInstancia() ;
this->path = path;
}
DadosInstancia::~DadosInstancia(){}
// Retorna um vector de strings, divide a string str utilizando o
// token como ponto de quebra
vector<string> DadosInstancia::split(string str, char token){
vector<string> vec;
string aux = "";
for(unsigned int i = 0; i < str.size(); i++){
if (str[i] != token){
aux += str[i];
}else{
vec.push_back(aux);
aux = "";
}
}
if (aux != ""){
vec.push_back(aux);
}
return vec;
}
// Retorna a quantidade de Tabelas que um dia d possui
int DadosInstancia::Td(int d){
switch(d){
case 5:
return nSAB;
case 6:
return nDOM;
default:
return nUTL;
}
}
// Retorna a quantidade de horários de uma tabela t no dia dia d
int DadosInstancia::Ft(int d, int t){
switch(d){
case 5:
return hSAB[t];
case 6:
return hDOM[t];
default:
return hUTL[t];
}
}
// Carrega na memória os dados do arquivo fornecido no construtor
// e segue a disposição descrita no arquivo Leiaute.txt
void DadosInstancia::carregarDados(){
cout << "Caregando dados \n..." << endl;
ifstream file;
file.open("ins/"+path);
string _;
string::size_type sz;
// Dados gerais da instância (linha, empresa, posto de controle, ...)
file >> empCod >> _;
getline(file,empNome);
file >> linhaCod >> _;
getline(file,linhaNome);
getline(file, periodo);
file >> tipoDePDT >> _;
getline(file, nomePDT);
file >> _ >> _ >> _ >> codTabela;
file >> codPControle >> _;
getline(file, nomePControle);
file >> tJornada;
// QMAHTT = tJornada;
file >> S;
file >> M;
// Dados dos Motoristas
// ultima folga
for (int i = 0; i < M; i++){
Motorista motorista;
file >> motorista.uf;
m.push_back(motorista);
}
// ultima foga de domingo
for (int i = 0; i < M; i++){
file >> m[i].ufd;
}
// termino da jornada
for (int i = 0; i < M; i++){
file >> _;
m[i].tj = Hora(split(_, ':'));
}
// Dados da tabela
// Quantidades das tabelas em dias úteis, sábados e domingos
file >> nUTL;
file >> nSAB;
file >> nDOM;
file >> total;
// Quantidade de horários que cada tabela de cada tipo de dia possui
for (int i = 0; i < nUTL; i++){
file >> _;
hUTL.push_back(stoi(split(_, '-')[2], &sz));
}
for (int i = 0; i < nSAB; i++){
file >> _;
hSAB.push_back(stoi(split(_, '-')[2], &sz));
}
for (int i = 0; i < nDOM; i++){
file >> _;
hDOM.push_back(stoi(split(_, '-')[2], &sz));
}
// Dados referentes a cada tarefa de cada tabela
T.resize(S);
string line;
for (int s = 0; s < S; s++){
T[s].resize(7);
for (int d = 0; d < 7; d++){
T[s][d].resize(Td(d));
for (int t = 0; t < Td(d); t++){
T[s][d][t].resize(Ft(d,t));
for (int f = 0; f < Ft(d, t); f++){
file >> line;
vector<string> vec = split(line, '-');
LinhaTabela l;
l.tipoDia = vec[0];
l.indiceEscala = stoi(vec[1], &sz);
l.codTabela = stoi(vec[2], &sz);
l.codTipoHorario = stoi(vec[3], &sz);
l.tamanho = stoi(vec[4], &sz);
l.codParada = stoi(vec[5], &sz);
l.DI = Data(split(vec[6], '/'));
file >> line;
vec = split(line, '-');
l.HI = Hora(split(vec[0], ':'));
l.DF = Data(split(vec[1], '/'));
file >> line;
l.HF = Hora(split(line, ':'));
T[s][d][t][f] = l;
}
}
}
}
file.close();
cout << "Pronto" << endl;
}
| [
"anapauladantas@Anas-MacBook-Pro.local"
] | anapauladantas@Anas-MacBook-Pro.local |
57372104880d0d154841b58e9610dd78dfe890c2 | dc38c8a3b0e9b13afb83fbe78269638c60bd32cd | /16. 3Sum Closest/main.cpp | c9bfa0c890aefa653952af749728007cadcb1025 | [] | no_license | TG-yang/LeetCode | 603da8e8121ad2ed7d05bac0d4ee6d61378eeff3 | 1749b35170636830b3f91777ac57d049278b2b2e | refs/heads/master | 2020-04-09T09:20:13.129761 | 2019-08-16T17:10:42 | 2019-08-16T17:10:42 | 160,229,673 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 1,281 | cpp | #include <iostream>
#include<vector>
#include <cmath>
using namespace std;
class Solution {
public:
int threeSumClosest(vector<int>& nums, int target) {
int diff = INT_MAX;
int result;
sort(nums.begin(),nums.end());
for(int i = 0; i < nums.size(); ++i) {
if (i > 0 && nums[i] == nums[i - 1]) continue;
int beginNums = 1 + i, endNums = nums.size() - 1;
while (beginNums < endNums) {
int temp = nums[i] + nums[beginNums] + nums[endNums];
if(diff > abs(temp - target)){
result = temp;
diff = abs(temp - target);
while (beginNums < endNums && nums[beginNums] == nums[beginNums + 1]) ++beginNums;
while (beginNums < endNums && nums[endNums] == nums[endNums - 1]) --endNums;
}
if (temp < target)
++beginNums;
else if(temp > target)
--endNums;
else
return result;
}
}
return result;
}
};
int main() {
Solution*s = new Solution();
vector<int> nums = {-1,0,1,1,55};
std::cout << s->threeSumClosest(nums,3) << std::endl;
return 0;
} | [
"zwenyang@outlook.com"
] | zwenyang@outlook.com |
734abc4e5e4a6f2542a607e9f0c4a799de9dbbbe | cbebd8ef484210a73606aee41207a26d2b93a74e | /include/PlayerClasses.h | b82dadfd1c893103fbdd2084245eeb8b7fa35f88 | [] | no_license | aismann/RogueLike | c81b6f61892b5c4ea414f9d27e8ac9812c7a5ff0 | 79d72c11b6dbf56b1ebb1bc218d0c54e408bcc3f | refs/heads/master | 2020-04-22T04:51:10.474456 | 2018-03-23T00:14:51 | 2018-03-23T00:14:51 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 774 | h | #pragma once
#include "Common.h"
#include "Utils.h"
#include "Player.h"
#include "Room.h"
//TODO: namespace?
enum PlayerClass
{
WARR,
MAGE,
THIEF
};
map<string, PlayerClass> getPlayerClasses();
Player* getPlayer(PlayerClass player_class, string const& player_name);
class Warrior : public Player
{
private:
static Stats base_stats_;
public:
Warrior(string name, Position pos);
void attack(Character* target);
};
class Mage : public Player
{
private:
static Stats base_stats_;
public:
Mage(string name, Position pos);
void attack(Character* target);
};
class Thief : public Player
{
private:
static Stats base_stats_;
public:
Thief(string name, Position pos);
void attack(Character* target);
};
| [
"oliver.poeckelhofer@student.tugraz.at"
] | oliver.poeckelhofer@student.tugraz.at |
1d5c23ccac4604bef8623dc10c83e66adabe010c | ef9a782df42136ec09485cbdbfa8a56512c32530 | /branches/AnimalChange/WP8Sensitivity/SlurryTank.cpp | 470188e8e35fd569dc0b141ca978fbf26c6ca557 | [] | no_license | penghuz/main | c24ca5f2bf13b8cc1f483778e72ff6432577c83b | 26d9398309eeacbf24e3c5affbfb597be1cc8cd4 | refs/heads/master | 2020-04-22T15:59:50.432329 | 2017-11-23T10:30:22 | 2017-11-23T10:30:22 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 10,775 | cpp | /*
* SlurryTank.cpp
*
* Created on: Nov 22, 2011
* Author: JOVE
*/
#include "SlurryTank.h"
#include "commonData.h"
#include <math.h>
SlurryTank::SlurryTank() {
Water=0;
Ash=0;
Tan=0;
orgN=0;
N_Inert=0;
NFast=0;
C_Inert=0;
// CRP=0;
CSlow=0;
// CRL=0;
CVFA=0.0;
CFast=0;
CLignin=0.0;
// CStarch=0.0;
HFast=0;
HSlow=0;
OFast=0;
OSlow=0;
SFast=0;
S_S04=0;
S2_S=0.0;
//const
E=2.718281828459045;
RA=1000.0;
//from Files
commonData slurryTank;
slurryTank.readFile("slurryTank.txt");
slurryTank.FindItem("ThetaA",&ThetaA);
slurryTank.FindItem("ThetaB",&ThetaB);
slurryTank.FindItem("ThetaC",&ThetaC);
slurryTank.FindItem("ThetaAM",&ThetaAM);
slurryTank.FindItem("ThetaBM",&ThetaBM);
slurryTank.FindItem("ThetaCM",&ThetaCM);
slurryTank.FindItem("temperatureInKelvin",&temperatureInKelvin);
slurryTank.FindItem("GInert",&GInert);
slurryTank.FindItem("b",&b);
slurryTank.FindItem("surfaceArea",&surfaceArea);
//gas
CCH4S=0;
CCO2_S=0;
CGas=0;
ENH3=0;
HInert=0;
OInert=0;
HVFA = 0.0;
OVFA=0.0;
//gas
C_CO2M=0;
CCH4=0;
//water
CrustHoldingCap=0;
CH4EM=0;
NN2O=0;
//from File
slurryTank.FindItem("k1",&k1);
slurryTank.FindItem("k2",&k2);
slurryTank.FindItem("k3",&k3);
slurryTank.FindItem("k4",&k4);
slurryTank.FindItem("CrustTickness",&CrustTickness);
slurryTank.FindItem("CrustCapasitet",&CrustCapasitet);
slurryTank.FindItem("WaterWick",&WaterWick);
slurryTank.FindItem("WaterRem",&WaterRem);
slurryTank.FindItem("WaterDrained",&WaterDrained);
slurryTank.FindItem("WaterCrust",&WaterCrust);
slurryTank.FindItem("WaterPresibitation",&WaterPresibitation);
slurryTank.FindItem("WaterEvap",&WaterEvap);
slurryTank.FindItem("Epot",&Epot);
slurryTank.FindItem("Epsalon1",&Epsalon1);
slurryTank.FindItem("Epsalon2",&Epsalon2);
slurryTank.FindItem("Epsalon3",&Epsalon3);
slurryTank.FindItem("Epsalon4",&Epsalon4);
slurryTank.FindItem("S",&S);
slurryTank.FindItem("Ycrust",&Ycrust);
slurryTank.FindItem("CCH4",&CCH4);
slurryTank.FindItem("n",&n);
slurryTank.FindItem("depth",&depth);
capacity = surfaceArea * depth;
totalCinput=0;
totalLigninCinput=0;
totalFastCinput=0;
totalSlowCinput=0;
totalVFACinput=0;
}
SlurryTank::~SlurryTank() {
}
void SlurryTank::openOutputFile()
{
DailyOutput.open(outputFileName,fstream::out);
DailyOutput <<"Day" <<'\t'<< "CLignin" <<'\t' << "C_Inert" <<'\t' << "CSlow" << '\t' << "CFast" << '\t' << "CVFA" << '\t'
<< "NFast" << '\t' << "Tan" << '\t' << "ENH3" << '\t' << "N_Inert" << '\t'
<< "C_CO2M" << '\t' << "C_CH4M" << '\t' << "CCH4S" << '\t' << "CCO2_S" << '\t'
<< "SFast" << '\t' << "S_S04" << '\t' << "S2_S" << endl;
DailyOutput <<"-" <<'\t'<< "kgC" <<'\t' << "kgC" <<'\t' << "kgC" << '\t' << "kgC" << '\t' << "kgC" << '\t'
<< "kgN" << '\t' << "kgN" << '\t' << "kgN/day" << '\t' << "kgN" << '\t'
<< "kgC/day" << '\t' << "kgC/day" << '\t' << "kgC/day" << '\t' << "kgC/day" << '\t'
<< "kgS" << '\t' << "kgS"<< '\t' << "kgS" << endl;
DailyOutput.precision(10);
DailyOutput << "0" <<'\t'<< CLignin <<'\t' << C_Inert <<'\t' << CSlow << '\t' << CFast << '\t' << CVFA << '\t'
<< NFast << '\t' << Tan << '\t' << "0" << '\t' << N_Inert << '\t'
<< "0" << '\t' << "0"<< '\t' << "0"<< '\t' << "0" << '\t' << SFast << '\t' << S_S04 << '\t' << S2_S << endl;
}
void SlurryTank::addSlurry(Slurry input)
{
slurrypH=input.getpH();
double DM = input.getAmount() * input.getDM();
Ash+=DM *input.getAsh(); // formel 1.2 AshContent //kg
double TanAdded=input.getAmount()*input.getTan(); //1.3 // kg
Tan+=TanAdded;
double RP = DM * input.getRP();
//org N is obtained by dividing CP by 6.25
double orgNAdded=RP/6.25; // 1.5 //kg
orgN+=orgNAdded; //kg
//Partition org N between inert and Fast pools
double NinertAdded=input.getfInert()*orgNAdded;//1.4 //kg //fInert should be between 0 and 1
N_Inert+=NinertAdded;
double NFastAdded=(1-input.getfInert())*orgNAdded; //1.5 /kg
NFast+=NFastAdded;
//! calculate the carbon content of the inert pool
double C_InertAdded =10*input.getfInert()*orgNAdded;
C_Inert+=C_InertAdded; //1.6 //kg
totalCinput+=C_InertAdded;
HInert+=0.055*C_InertAdded;//1.34
OInert+=0.444*C_InertAdded;// 1.35
//! Calculate the carbon content of the raw protein
double C_CPAdded=4.28*NFastAdded;//1.6 //kg
totalCinput+=C_CPAdded;
//! Calculate the carbon added in lignin
double C_ligninAdded=DM *0.55*input.getADL();
totalCinput+=C_ligninAdded;
CLignin+=C_ligninAdded; //1.8 //kg
totalLigninCinput+=C_ligninAdded;
//! Calculate the carbon content of the slow pool
double C_slowAdded=DM *0.44*(input.getNDF()-input.getADL());
totalCinput+=C_slowAdded;
totalSlowCinput+=C_slowAdded;
CSlow+=C_slowAdded; //1.9 //kg
//! Calculate the carbon content of the raw lipid
double C_lipidAdded=DM*0.77*input.getRL();//1.10 //kg
totalCinput+=C_lipidAdded;
//! calculate the carbon content of the volatile fatty acids
double C_VFAadded=DM *0.4*input.getVFA(); //1.11 //kg
totalCinput+=C_VFAadded;
totalVFACinput+=C_VFAadded;
CVFA+=C_VFAadded;
HVFA+=DM *0.167 * input.getVFA();//1.16 // kg
OVFA+=DM *0.889 * input.getVFA();//1.19 // kg
//! Calculate the carbon content of the starch and sugar
double C_StarchAdded=DM *0.44*input.getRem();//1.12 //kg
totalCinput+=C_StarchAdded;
//! Calculate the carbon content of the Fast pool
CFast+=C_CPAdded+C_StarchAdded+C_lipidAdded; //1.13
totalFastCinput+=C_CPAdded+C_StarchAdded+C_lipidAdded;
//! Calculate the hydrogen in the Fast and Slow pools
HFast=0.117*C_CPAdded+0.152*C_lipidAdded+0.139*C_StarchAdded;//1.14
HSlow=0.139*CSlow;//1.15
//! Calculate the oxygen in the Fast and Slow
OFast=0.533*C_CPAdded+0.14*C_lipidAdded+1.111*C_StarchAdded;//1.17
OSlow=1.111*CSlow;//1.18
//! Calculate the sulphur in the Fast and Sulphate pools
SFast+=input.getAmount()*(input.getTotalS()-(input.getSulphateS()+input.getSulphideS()));//1.20
S_S04+=input.getAmount()*input.getSulphateS();//1.21
S2_S+=input.getAmount()*input.getSulphideS(); // 1.22
Water+=input.getAmount()*(1-input.getDM()); // 1.1 //kg
}
void SlurryTank::endSimulation()
{
if (outputFileName.length()>0)
DailyOutput.close();
Water=0;
Ash=0;
Tan=0;
orgN=0;
N_Inert=0;
NFast=0;
C_Inert=0;
// CRP=0;
CSlow=0;
// CRL=0;
CVFA=0.0;
CFast=0;
CLignin=0.0;
// CStarch=0.0;
HFast=0;
HSlow=0;
OFast=0;
OSlow=0;
SFast=0;
S_S04=0;
S2_S=0.0;
CCH4S=0;
CCO2_S=0;
CGas=0;
ENH3=0;
HInert=0;
OInert=0;
HVFA = 0.0;
OVFA=0.0;
//gas
C_CO2M=0;
CCH4=0;
//water
CH4EM=0;
NN2O=0;
};
void SlurryTank::dailyUpdate(int dayNo)
{
double temperatureInCelsius = temperatureInKelvin - 273.15;
//! Calculate the normalised temperature effect
double FTheta=pow(E,ThetaA+ThetaB*temperatureInCelsius *(1-0.5*(temperatureInCelsius /ThetaC))); //1.26
double FpH=1.0; //need to implement this
//! Calculate the degradation rates of the Fast and Slow pools
double k1act=FpH*FTheta*k1;//1.25 //should be 0 to 1
double k2act=FpH*FTheta*k2;//1.25
double hydrolysedCpool =k1act*CSlow+k2act*CFast;
double hydrolysedHpool =k1act*HSlow+k2act*HFast;
double hydrolysedOpool =k1act*OSlow+k2act*OFast;
double FS=pow(E,-b*(S_S04/Water)); //1.31
double FThetaM=pow(E,ThetaAM+ThetaBM*temperatureInCelsius*(1-0.5*(temperatureInCelsius/ThetaCM)));
double k3act=FThetaM*FpH*FS*k3; //1.32
double k4act=FTheta*FpH*(1-FS)*k4; //1.33
//calculate C in CH4S. This will be instantaneously lost as CH4-C
CCH4S=0.375*k2act*SFast; //1.28
//calculate the H in CH4S
double HCH4S=0.333*CCH4S;//1.39
CGas=k3act*CVFA;//1.35 //anaerobic degradation of VFA by methanogens
double Hgas=k3act * HVFA; //1.44
double Ogas=k3act * OVFA;//1.45
C_CH4M=12*(CGas/24+Hgas/8-Ogas/64); //1.46
CCO2_S=k4act*CVFA; //1.34 //CO2-C from oxidation by SO4
//calculate the H utilised during oxidation of VFA by SO4. Oxygen is not budgetted here.
double HSO4=0.167*CCO2_S;//1.37
C_CO2M=CGas-C_CH4M;//1.47
CCH4=CCH4S+C_CH4M; //1.48
double KN=pow(10,-0.09018-(2729.92/temperatureInKelvin)); //1.53
double KH=pow(10,-1.69+1447.7/temperatureInKelvin); //1.55
ENH3=24 * 60 * 60 * surfaceArea * Tan/(Water*KH*(1+pow(10,-slurrypH)/KN)*RA); //1.57
//update C state variables
//! Update the carbon in the Inert pool
//GInert=0.0;
C_Inert+=GInert*hydrolysedCpool; //1.27
//! Update the values of the carbon in the Fast and Slow pools is
CSlow*=(1-k1act); //1.24
CFast*=(1-k2act); //1.24
double CAddVFA=(1-GInert)*hydrolysedCpool-CCH4S;//1.29
if (CAddVFA<0.0)
{
if (outputFileName.length()>0)
DailyOutput << "Negative VFA addition" << endl;
exit(0);
}
CVFA=(1-(k3act+k4act))*CVFA+CAddVFA; //1.30
//update the H and O
HFast*=(1-k2act);//1.36
HSlow*=(1-k1act);//1.36
OFast*=(1-k2act);//1.36
OSlow*=(1-k1act);//1.36
double HAddInert=0.055*GInert*hydrolysedHpool;
HInert+=HAddInert; //1.37
double OAddInert=0.044*GInert*hydrolysedOpool;
OInert+=OAddInert;//1.38
HVFA+=hydrolysedHpool-(HAddInert+HCH4S+HSO4+Hgas); //1.42
OVFA+=hydrolysedOpool-(OAddInert+Ogas);//1.43
//update S in Fast
SFast*=(1-k2act);//1.59
S_S04-=2.667 * CCO2_S; //1.60
double SAddS2 = 2.667 * (CCO2_S + CCH4S);
S2_S+=SAddS2; //1.61
//update the N
double NAddInert=0.1*GInert*hydrolysedCpool;
N_Inert+=NAddInert;//1.51
Tan+=k2act*NFast-(NAddInert+ENH3);// 1.52
NFast*=(1-k2act); //1.50
if (Tan<0.0)
{
if (outputFileName.length()>0)
DailyOutput << "Not enough TAN to enable the inert to be created or too much volatilisation" << endl;
exit(0);
}
if (outputFileName.length()>0)
DailyOutput << dayNo <<'\t'<< CLignin <<'\t' << C_Inert <<'\t' << CSlow << '\t' << CFast << '\t' << CVFA << '\t'
<< NFast << '\t' << Tan << '\t' << ENH3 << '\t' << N_Inert << '\t'
<< C_CO2M << '\t' << C_CH4M<< '\t' << CCH4S << '\t' << CCO2_S << '\t'
<< SFast << '\t' << S_S04 << '\t' << S2_S << endl;
/*
CrustHoldingCap=CrustTickness*CrustCapasitet;//1.54
double WaterMeth=18*(CGas/12+Hgas/4+Ogas/32); //1.52
Water=Water+WaterDrained-(WaterMeth+WaterRem+WaterWick); //1.53
WaterCrust=WaterCrust+WaterPresibitation-WaterDrained-WaterEvap; //1.55
if((WaterCrust+WaterPresibitation-Epot)<=0) //1.56
{
WaterEvap=WaterPresibitation+WaterCrust;
WaterCrust=WaterDrained=0;
WaterWick=Epot-WaterEvap;
}
else if((WaterCrust+WaterPresibitation-Epot)>CrustHoldingCap) //1.57
{
WaterDrained=WaterCrust+WaterPresibitation-Epot;
WaterEvap=Epot;
WaterWick=0;
WaterCrust=CrustHoldingCap;
}
else//1.5.8
{
WaterEvap=Epot;
WaterDrained=WaterWick=0;
WaterCrust=WaterCrust+WaterPresibitation-WaterEvap;
}
double FW=WaterCrust/CrustHoldingCap; //1.60
CH4EM+=n*(1-FW)*FTheta*CCH4; //1.59
double Finnoc=Epsalon1*pow(E,Epsalon2*pow(E,Epsalon3*(1-Epsalon4)));//1.62
NN2O+=S*Ycrust*(1-FW)*FTheta*Finnoc;//1.61
*/
NN2O=0.0;
// CH4EM=CCH4;
//DailyOutput<<'\n';
}
| [
"sai@agro.au.dk"
] | sai@agro.au.dk |
bc398dcd6c5153b5e4866fa6c3f961eebe718c2a | d0c44dd3da2ef8c0ff835982a437946cbf4d2940 | /cmake-build-debug/programs_tiling/function14543/function14543_schedule_39/function14543_schedule_39.cpp | 0e8cc0061a1dab67a13acd24e10c898bf664058a | [] | no_license | IsraMekki/tiramisu_code_generator | 8b3f1d63cff62ba9f5242c019058d5a3119184a3 | 5a259d8e244af452e5301126683fa4320c2047a3 | refs/heads/master | 2020-04-29T17:27:57.987172 | 2019-04-23T16:50:32 | 2019-04-23T16:50:32 | 176,297,755 | 1 | 2 | null | null | null | null | UTF-8 | C++ | false | false | 1,030 | cpp | #include <tiramisu/tiramisu.h>
using namespace tiramisu;
int main(int argc, char **argv){
tiramisu::init("function14543_schedule_39");
constant c0("c0", 512), c1("c1", 256), c2("c2", 512);
var i0("i0", 0, c0), i1("i1", 0, c1), i2("i2", 0, c2), i01("i01"), i02("i02"), i03("i03"), i04("i04"), i05("i05"), i06("i06");
input input00("input00", {i1, i2}, p_int32);
input input01("input01", {i1}, p_int32);
computation comp0("comp0", {i0, i1, i2}, input00(i1, i2) - input01(i1));
comp0.tile(i0, i1, i2, 128, 64, 32, i01, i02, i03, i04, i05, i06);
comp0.parallelize(i01);
buffer buf00("buf00", {256, 512}, p_int32, a_input);
buffer buf01("buf01", {256}, p_int32, a_input);
buffer buf0("buf0", {512, 256, 512}, p_int32, a_output);
input00.store_in(&buf00);
input01.store_in(&buf01);
comp0.store_in(&buf0);
tiramisu::codegen({&buf00, &buf01, &buf0}, "../data/programs/function14543/function14543_schedule_39/function14543_schedule_39.o");
return 0;
} | [
"ei_mekki@esi.dz"
] | ei_mekki@esi.dz |
87623decc492917279221846002b44cbbbeb6372 | ee4993de9de704a11febe789d79e81dc8ff2ae72 | /include/anki/renderer/Dp.h | 5388f40daefcbe12259b4a2a9adb884b4387fa78 | [
"BSD-2-Clause",
"LicenseRef-scancode-unknown-license-reference",
"BSD-3-Clause"
] | permissive | MARV1S/anki-3d-engine | 86ac8caaf794a1ba366f67f5be0399b2bc5d45d4 | 71e79a51e9a248f1f2b030e50f75b931c0d9ebc4 | refs/heads/master | 2021-01-15T22:30:01.709152 | 2015-03-21T21:43:25 | 2015-03-21T21:43:25 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 853 | h | // Copyright (C) 2009-2015, Panagiotis Christopoulos Charitos.
// All rights reserved.
// Code licensed under the BSD License.
// http://www.anki3d.org/LICENSE
#ifndef ANKI_RENDERER_DP_H
#define ANKI_RENDERER_DP_H
#include "anki/renderer/RenderingPass.h"
#include "anki/Gr.h"
namespace anki {
/// @addtogroup renderer
/// @{
/// Depth buffer processing.
class Dp: public RenderingPass
{
public:
/// @privatesection
/// @{
Dp(Renderer* r)
: RenderingPass(r)
{}
TextureHandle& getSmallDepthRt()
{
return m_smallDepthRt;
}
ANKI_USE_RESULT Error init(const ConfigSet& initializer);
ANKI_USE_RESULT Error run(CommandBufferHandle& cmdBuff);
/// @}
private:
TextureHandle m_smallDepthRt; ///< A smaller depth buffer
FramebufferHandle m_smallDepthFb; ///< Used to blit
UVec2 m_smallDepthSize;
};
/// @}
} // end namespace anki
#endif
| [
"Panagiotis Christopoulos Charitos"
] | Panagiotis Christopoulos Charitos |
086c59d614803c8d092cdd38d92c7f1c6251fb6c | a5f78ff3cc509d026c9436444e26420d6a749ea6 | /dev/cocos2d-x-2.2.6/cocos2dx/core_ext/CCParticlePool.h | 6b99a989c3d79359efd49da2864b32021f5921e8 | [
"MIT"
] | permissive | foreverlei/qnmahjongclient | 402e00cbd0eefab60f3197146883ab73e99155ca | 0514ff857ca399c4be3f980d62d9d71846f0fac0 | refs/heads/master | 2021-06-21T17:30:18.307185 | 2017-09-06T02:57:27 | 2017-09-06T02:57:27 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,624 | h | #ifndef __CCPARTICLE_POOL_H__
#define __CCPARTICLE_POOL_H__
#include "ccMacros.h"
#include "cocoa/CCDictionary.h"
#include "cocoa/CCString.h"
#include <map>
using namespace std;
NS_CC_BEGIN
/** @typedef tCCPositionType
possible types of particle positions
*/
typedef enum {
/** Living particles are attached to the world and are unaffected by emitter repositioning. */
kCCPositionTypeFree,
/** Living particles are attached to the world but will follow the emitter repositioning.
Use case: Attach an emitter to an sprite, and you want that the emitter follows the sprite.
*/
kCCPositionTypeRelative,
/** Living particles are attached to the emitter and are translated along with it. */
kCCPositionTypeGrouped,
}tCCPositionType;
//* @enum
enum {
/** The Particle emitter lives forever */
kCCParticleDurationInfinity = -1,
/** The starting size of the particle is equal to the ending size */
kCCParticleStartSizeEqualToEndSize = -1,
/** The starting radius of the particle is equal to the ending radius */
kCCParticleStartRadiusEqualToEndRadius = -1,
// backward compatible
kParticleStartSizeEqualToEndSize = kCCParticleStartSizeEqualToEndSize,
kParticleDurationInfinity = kCCParticleDurationInfinity,
};
//* @enum
enum {
/** Gravity mode (A mode) */
kCCParticleModeGravity,
/** Radius mode (B mode) */
kCCParticleModeRadius,
};
// backward compatible
enum {
kPositionTypeFree = kCCPositionTypeFree,
kPositionTypeGrouped = kCCPositionTypeGrouped,
};
// Different modes
//! Mode A:Gravity + Tangential Accel + Radial Accel
struct ParModeA
{
/** Gravity value. Only available in 'Gravity' mode. */
CCPoint gravity;
/** speed of each particle. Only available in 'Gravity' mode. */
float speed;
/** speed variance of each particle. Only available in 'Gravity' mode. */
float speedVar;
/** tangential acceleration of each particle. Only available in 'Gravity' mode. */
float tangentialAccel;
/** tangential acceleration variance of each particle. Only available in 'Gravity' mode. */
float tangentialAccelVar;
/** radial acceleration of each particle. Only available in 'Gravity' mode. */
float radialAccel;
/** radial acceleration variance of each particle. Only available in 'Gravity' mode. */
float radialAccelVar;
/** set the rotation of each particle to its direction Only available in 'Gravity' mode. */
bool rotationIsDir;
};
struct ParModeB
{
/** The starting radius of the particles. Only available in 'Radius' mode. */
float startRadius;
/** The starting radius variance of the particles. Only available in 'Radius' mode. */
float startRadiusVar;
/** The ending radius of the particles. Only available in 'Radius' mode. */
float endRadius;
/** The ending radius variance of the particles. Only available in 'Radius' mode. */
float endRadiusVar;
/** Number of degrees to rotate a particle around the source pos per second. Only available in 'Radius' mode. */
float rotatePerSecond;
/** Variance in degrees for rotatePerSecond. Only available in 'Radius' mode. */
float rotatePerSecondVar;
};
extern tCCPositionType transIntToTCCPosT(int posType);
class CCParticleData;
class CC_DLL CCParticleDataPool
{
public:
static CCParticleDataPool *shareDataPool();
CCParticleData *getData(const string &dir);
CCParticleData *addData(const string &key);
CCParticleDataPool();
~CCParticleDataPool();
private:
typedef map<string , CCParticleData *> DIC;
DIC m_dic;
};
class CC_DLL CCParticleData
{
public:
bool init(const char *plistFile);
std::string m_sPlistFile;
int maxParticles;
// angle
float m_fAngle;
float m_fAngleVar;
// duration
float m_fDuration;
// blend function
ccBlendFunc m_tBlendFunc;
// color
ccColor4F m_tStartColor;
ccColor4F m_tStartColorVar;
ccColor4F m_tEndColor;
ccColor4F m_tEndColorVar;
// particle size
float m_fStartSize;
float m_fStartSizeVar;
float m_fEndSize;
float m_fEndSizeVar;
// position
float x;
float y;
CCPoint m_tPosVar;
// Spinning
float m_fStartSpin;
float m_fStartSpinVar;
float m_fEndSpin;
float m_fEndSpinVar;
int m_nEmitterMode;
tCCPositionType m_ePositionType;
// Mode A: Gravity + tangential accel + radial accel
ParModeA modeA;
ParModeB modeB;
// life span
float m_fLife;
float m_fLifeVar;
std::string textureName;
char *textureImageData;
};
NS_CC_END
#endif //__CCPARTICLE_POOL_H__
| [
"shuimuliang@gmail.com"
] | shuimuliang@gmail.com |
635e2fb23b3ad4dbb5d1e1fc6fa883c83ffccf9d | aabfe137db175f0e070bd9342e6346ae65e2be32 | /DQM/EcalBarrelMonitorTasks/src/EBDataCertificationTask.cc | ad0d1a6e4d9889f9f7560695e8466382d7d1f0d0 | [] | no_license | matteosan1/cmssw | e67b77be5d03e826afd36a9ec5a6dc1b3ee57deb | 74f7c9a4cf24913e2a9f4e6805bb2e8e25ab7d52 | refs/heads/CMSSW_7_0_X | 2021-01-15T18:35:33.405650 | 2013-07-30T14:59:30 | 2013-07-30T14:59:30 | 11,789,054 | 1 | 1 | null | 2016-04-03T13:48:46 | 2013-07-31T11:06:26 | C++ | UTF-8 | C++ | false | false | 11,525 | cc | /*
* \file EBDataCertificationTask.cc
*
* $Date: 2011/09/02 14:03:33 $
* $Revision: 1.30 $
* \author E. Di Marco
*
*/
#include <iostream>
#include <algorithm>
#include "FWCore/ServiceRegistry/interface/Service.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"
#include "FWCore/Framework/interface/ESHandle.h"
#include "FWCore/Framework/interface/EventSetup.h"
#include "DQMServices/Core/interface/MonitorElement.h"
#include "DQMServices/Core/interface/DQMStore.h"
#include "DataFormats/FEDRawData/interface/FEDNumbering.h"
#include "DQM/EcalCommon/interface/Numbers.h"
#include "DQM/EcalCommon/interface/UtilsClient.h"
#include "DQM/EcalBarrelMonitorTasks/interface/EBDataCertificationTask.h"
EBDataCertificationTask::EBDataCertificationTask(const edm::ParameterSet& ps) {
dqmStore_ = edm::Service<DQMStore>().operator->();
// cloneME switch
cloneME_ = ps.getUntrackedParameter<bool>("cloneME", true);
prefixME_ = ps.getUntrackedParameter<std::string>("prefixME", "");
enableCleanup_ = ps.getUntrackedParameter<bool>("enableCleanup", false);
mergeRuns_ = ps.getUntrackedParameter<bool>("mergeRuns", false);
meEBDataCertificationSummary_ = 0;
meEBDataCertificationSummaryMap_ = 0;
for (int i = 0; i < 36; i++) {
meEBDataCertification_[i] = 0;
}
hDQM_ = 0;
hDAQ_ = 0;
hDCS_ = 0;
hIntegrityByLumi_ = 0;
hFrontendByLumi_ = 0;
hSynchronizationByLumi_ = 0;
}
EBDataCertificationTask::~EBDataCertificationTask() {
}
void EBDataCertificationTask::beginJob(void){
std::string name;
if ( dqmStore_ ) {
dqmStore_->setCurrentFolder(prefixME_ + "/EventInfo");
name = "CertificationSummary";
meEBDataCertificationSummary_ = dqmStore_->bookFloat(name);
meEBDataCertificationSummary_->Fill(-1.0);
name = "CertificationSummaryMap";
meEBDataCertificationSummaryMap_ = dqmStore_->book2D(name, name, 72, 0., 72., 34, 0., 34.);
meEBDataCertificationSummaryMap_->setAxisTitle("jphi", 1);
meEBDataCertificationSummaryMap_->setAxisTitle("jeta", 2);
dqmStore_->setCurrentFolder(prefixME_ + "/EventInfo/CertificationContents");
for (int i = 0; i < 36; i++) {
name = "EcalBarrel_" + Numbers::sEB(i+1);
meEBDataCertification_[i] = dqmStore_->bookFloat(name);
meEBDataCertification_[i]->Fill(-1.0);
}
}
}
void EBDataCertificationTask::endJob(void) {
if ( enableCleanup_ ) this->cleanup();
}
void EBDataCertificationTask::beginLuminosityBlock(const edm::LuminosityBlock& lumiBlock, const edm::EventSetup& iSetup){
}
void EBDataCertificationTask::endLuminosityBlock(const edm::LuminosityBlock& lumiBlock, const edm::EventSetup& iSetup) {
this->reset();
MonitorElement* me;
// evaluate the DQM quality of observables checked by lumi
float DQMVal[36];
for (int i = 0; i < 36; i++) {
DQMVal[i] = -1.;
}
me = dqmStore_->get(prefixME_ + "/EBIntegrityTask/EBIT weighted integrity errors by lumi");
hIntegrityByLumi_ = UtilsClient::getHisto<TH1F*>( me, cloneME_, hIntegrityByLumi_ );
me = dqmStore_->get(prefixME_ + "/EBStatusFlagsTask/FEStatus/EBSFT weighted frontend errors by lumi");
hFrontendByLumi_ = UtilsClient::getHisto<TH1F*>( me, cloneME_, hFrontendByLumi_ );
me = dqmStore_->get(prefixME_ + "/EBRawDataTask/EBRDT FE synchronization errors by lumi");
hSynchronizationByLumi_ = UtilsClient::getHisto<TH1F*>( me, cloneME_, hSynchronizationByLumi_ );
if( hIntegrityByLumi_ && hFrontendByLumi_ && hSynchronizationByLumi_ ) {
float integrityErrSum = 0.;
float integrityQual = 1.0;
float frontendErrSum = 0.;
float frontendQual = 1.0;
float synchronizationErrSum = 0.;
float synchronizationQual = 1.0;
for ( int i=0; i<36; i++) {
float ismIntegrityQual = 1.0;
if( hIntegrityByLumi_->GetBinContent(0) > 0 ) {
float errors = hIntegrityByLumi_->GetBinContent(i+1);
ismIntegrityQual = 1.0 - errors/hIntegrityByLumi_->GetBinContent(0);
integrityErrSum += errors;
}
float ismFrontendQual = 1.0;
if( hFrontendByLumi_->GetBinContent(0) > 0 ) {
float errors = hFrontendByLumi_->GetBinContent(i+1);
ismFrontendQual = 1.0 - errors/hFrontendByLumi_->GetBinContent(0);
frontendErrSum += errors;
}
float ismSynchronizationQual = 1.0;
if( hSynchronizationByLumi_->GetBinContent(0) > 0 ) {
float errors = hSynchronizationByLumi_->GetBinContent(i+1);
ismSynchronizationQual = 1.0 - errors/hSynchronizationByLumi_->GetBinContent(0);
synchronizationErrSum += errors;
}
float minVal= std::min(ismIntegrityQual,ismFrontendQual);
DQMVal[i] = std::min(minVal,ismSynchronizationQual);
}
if( hIntegrityByLumi_->GetBinContent(0) > 0 ) integrityQual = 1.0 - integrityErrSum/hIntegrityByLumi_->GetBinContent(0)/36.;
if( hFrontendByLumi_->GetBinContent(0) > 0 ) frontendQual = 1.0 - frontendErrSum/hFrontendByLumi_->GetBinContent(0)/36.;
if( hSynchronizationByLumi_->GetBinContent(0) > 0 ) synchronizationQual = 1.0 - synchronizationErrSum/hSynchronizationByLumi_->GetBinContent(0)/36.;
float minVal = std::min(integrityQual,frontendQual);
float totDQMVal = std::min(minVal,synchronizationQual);
me = dqmStore_->get((prefixME_ + "/EventInfo/reportSummary"));
if( me ) me->Fill(totDQMVal);
for ( int i=0; i<36; i++) {
me = dqmStore_->get(prefixME_ + "/EventInfo/reportSummaryContents/EcalBarrel_" + Numbers::sEB(i+1) ) ;
if( me ) me->Fill(DQMVal[i]);
me = dqmStore_->get(prefixME_ + "/EventInfo/reportSummaryMap");
if( me ) {
for ( int iett = 0; iett < 34; iett++ ) {
for ( int iptt = 0; iptt < 72; iptt++ ) {
int ism = ( iett<17 ) ? iptt/4+1 : 18+iptt/4+1;
if( i == (ism-1) ) me->setBinContent(iptt+1, iett+1, DQMVal[ism-1]);
}
}
}
}
}
// now combine reduced DQM with DCS and DAQ
me = dqmStore_->get(prefixME_ + "/EventInfo/DAQSummaryMap");
hDAQ_ = UtilsClient::getHisto<TH2F*>( me, cloneME_, hDAQ_ );
me = dqmStore_->get(prefixME_ + "/EventInfo/DCSSummaryMap");
hDCS_ = UtilsClient::getHisto<TH2F*>( me, cloneME_, hDCS_ );
float sumCert = 0.;
float sumCertEB[36];
int nValidChannels = 0;
int nValidChannelsEB[36];
for (int i = 0; i < 36; i++) {
sumCertEB[i] = 0.;
nValidChannelsEB[i] = 0;
}
for ( int iett = 0; iett < 34; iett++ ) {
for ( int iptt = 0; iptt < 72; iptt++ ) {
int ism = ( iett<17 ) ? iptt/4+1 : 18+iptt/4+1;
float xvalDQM = DQMVal[ism-1];
float xvalDAQ, xvalDCS;
xvalDAQ = xvalDCS = -1.;
float xcert = -1.;
if ( hDAQ_ ) xvalDAQ = hDAQ_->GetBinContent( iptt+1, iett+1 );
if ( hDCS_ ) xvalDCS = hDCS_->GetBinContent( iptt+1, iett+1 );
if ( xvalDQM == -1 || ( xvalDAQ == -1 && xvalDCS == -1 ) ) {
// problems: DQM empty or DAQ and DCS not available
xcert = 0.0;
} else {
// do not consider the white value of DAQ and DCS (problems with DB)
xcert = std::abs(xvalDQM) * std::abs(xvalDAQ) * std::abs(xvalDCS);
}
if ( meEBDataCertificationSummaryMap_ ) meEBDataCertificationSummaryMap_->setBinContent( iptt+1, iett+1, xcert );
sumCertEB[ism-1] += xcert;
nValidChannelsEB[ism-1]++;
sumCert += xcert;
nValidChannels++;
}
}
if( meEBDataCertificationSummary_ ) {
if( nValidChannels>0 ) meEBDataCertificationSummary_->Fill( sumCert/nValidChannels );
else meEBDataCertificationSummary_->Fill( 0.0 );
}
for (int i = 0; i < 36; i++) {
if( meEBDataCertification_[i] ) {
if( nValidChannelsEB[i]>0 ) meEBDataCertification_[i]->Fill( sumCertEB[i]/nValidChannelsEB[i] );
else meEBDataCertification_[i]->Fill( 0.0 );
}
}
}
void EBDataCertificationTask::beginRun(const edm::Run& r, const edm::EventSetup& c) {
if ( ! mergeRuns_ ) this->reset();
}
void EBDataCertificationTask::endRun(const edm::Run& r, const edm::EventSetup& c) {
this->reset();
MonitorElement* me;
me = dqmStore_->get(prefixME_ + "/EventInfo/reportSummaryMap");
hDQM_ = UtilsClient::getHisto<TH2F*>( me, cloneME_, hDQM_ );
me = dqmStore_->get(prefixME_ + "/EventInfo/DAQSummaryMap");
hDAQ_ = UtilsClient::getHisto<TH2F*>( me, cloneME_, hDAQ_ );
me = dqmStore_->get(prefixME_ + "/EventInfo/DCSSummaryMap");
hDCS_ = UtilsClient::getHisto<TH2F*>( me, cloneME_, hDCS_ );
float sumCert = 0.;
float sumCertEB[36];
int nValidChannels = 0;
int nValidChannelsEB[36];
for (int i = 0; i < 36; i++) {
sumCertEB[i] = 0.;
nValidChannelsEB[i] = 0;
}
for ( int iett = 0; iett < 34; iett++ ) {
for ( int iptt = 0; iptt < 72; iptt++ ) {
float xvalDQM, xvalDAQ, xvalDCS;
xvalDQM = xvalDAQ = xvalDCS = -1.;
float xcert = -1;
if ( hDQM_ ) xvalDQM = hDQM_->GetBinContent( iptt+1, iett+1 );
if ( hDAQ_ ) xvalDAQ = hDAQ_->GetBinContent( iptt+1, iett+1 );
if ( hDCS_ ) xvalDCS = hDCS_->GetBinContent( iptt+1, iett+1 );
if ( xvalDQM == -1 || ( xvalDAQ == -1 && xvalDCS == -1 ) ) {
// problems: DQM empty or DAQ and DCS not available
xcert = 0.0;
} else {
// do not consider the white value of DAQ and DCS (problems with DB)
xcert = std::abs(xvalDQM) * std::abs(xvalDAQ) * std::abs(xvalDCS);
}
if ( meEBDataCertificationSummaryMap_ ) meEBDataCertificationSummaryMap_->setBinContent( iptt+1, iett+1, xcert );
int ism = ( iett<17 ) ? iptt/4+1 : 18+iptt/4+1;
sumCertEB[ism-1] += xcert;
nValidChannelsEB[ism-1]++;
sumCert += xcert;
nValidChannels++;
}
}
if( meEBDataCertificationSummary_ ) {
if( nValidChannels>0 ) {
meEBDataCertificationSummary_->Fill( sumCert/nValidChannels );
} else {
meEBDataCertificationSummary_->Fill( 0.0 );
}
}
for (int i = 0; i < 36; i++) {
if( meEBDataCertification_[i] ) {
if( nValidChannelsEB[i]>0 ) {
meEBDataCertification_[i]->Fill( sumCertEB[i]/nValidChannelsEB[i] );
} else {
meEBDataCertification_[i]->Fill( 0.0 );
}
}
}
}
void EBDataCertificationTask::reset(void) {
if ( meEBDataCertificationSummary_ ) meEBDataCertificationSummary_->Reset();
for (int i = 0; i < 36; i++) {
if ( meEBDataCertification_[i] ) meEBDataCertification_[i]->Reset();
}
if ( meEBDataCertificationSummaryMap_ ) meEBDataCertificationSummaryMap_->Reset();
}
void EBDataCertificationTask::cleanup(void){
if ( cloneME_ ) {
if( hDQM_ ) delete hDQM_;
if( hDAQ_ ) delete hDAQ_;
if( hDCS_ ) delete hDCS_;
if( hIntegrityByLumi_ ) delete hIntegrityByLumi_;
if( hFrontendByLumi_ ) delete hFrontendByLumi_;
if( hSynchronizationByLumi_ ) delete hSynchronizationByLumi_;
}
hDQM_ = 0;
hDAQ_ = 0;
hDCS_ = 0;
hIntegrityByLumi_ = 0;
hFrontendByLumi_ = 0;
hSynchronizationByLumi_ = 0;
if ( dqmStore_ ) {
dqmStore_->setCurrentFolder(prefixME_ + "/EventInfo");
if ( meEBDataCertificationSummary_ ) dqmStore_->removeElement( meEBDataCertificationSummary_->getName() );
if ( meEBDataCertificationSummaryMap_ ) dqmStore_->removeElement( meEBDataCertificationSummaryMap_->getName() );
dqmStore_->setCurrentFolder(prefixME_ + "/EventInfo/CertificationContents");
for (int i = 0; i < 36; i++) {
if ( meEBDataCertification_[i] ) dqmStore_->removeElement( meEBDataCertification_[i]->getName() );
}
}
}
void EBDataCertificationTask::analyze(const edm::Event& e, const edm::EventSetup& c){
}
| [
"sha1-7f8a01e8cfe4f7786d42d9cf039f4c3fd2f5cce6@cern.ch"
] | sha1-7f8a01e8cfe4f7786d42d9cf039f4c3fd2f5cce6@cern.ch |
e4db89505a236145d2282f44e9d79cf89ec491de | 175ab05cbd5db7d21d627197fcdcbea953c18103 | /firmware/include/motors.h | 0f1b536864d2f552796e86291f2c508ec13a1bc7 | [
"MIT"
] | permissive | xiaju/micromouse-2018 | 65f93c979a7bfc035b5c27dc75e82d8a9093434a | a964f2b03ddf00e1839590c3788c098dc5d0e00a | refs/heads/master | 2021-04-06T20:05:31.739140 | 2018-03-10T18:52:21 | 2018-03-10T18:52:21 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 823 | h | #ifndef MOTORS_H
#define MOTORS_H
#define FORWARD 1
#define BACKWARD 0
#include "gpioDevice.h"
namespace micromouse {
class MotorSystem {
public:
MotorSystem(GpioDevice* leftDirPin,
unsigned int leftStepsMemLoc,
unsigned int leftCyclesMemLoc,
GpioDevice* rightDirPin,
unsigned int rightStepsMemLoc,
unsigned int rightCyclesMemLoc);
void drive(unsigned int stepsLeft,
unsigned int cyclesLeft,
unsigned int directionLeft,
unsigned int stepsRight,
unsigned int cyclesRight,
unsigned int directionRight);
unsigned int getStepsLeft();
unsigned int getStepsRight();
private:
GpioDevice* _leftDirPin;
GpioDevice* _rightDirPin;
unsigned int _leftStepsMemLoc;
unsigned int _leftCyclesMemLoc;
unsigned int _rightStepsMemLoc;
unsigned int _rightCyclesMemLoc;
};
}
#endif | [
"lichto2005@gmail.com"
] | lichto2005@gmail.com |
a1d61a19bfd73673f3b98d9ac83f76c4c2b35f70 | 24f26275ffcd9324998d7570ea9fda82578eeb9e | /gpu/command_buffer/client/raster_implementation_gles_unittest.cc | d50e428f95bf79a69234dd83560d66f93a981676 | [
"BSD-3-Clause"
] | permissive | Vizionnation/chromenohistory | 70a51193c8538d7b995000a1b2a654e70603040f | 146feeb85985a6835f4b8826ad67be9195455402 | refs/heads/master | 2022-12-15T07:02:54.461083 | 2019-10-25T15:07:06 | 2019-10-25T15:07:06 | 217,557,501 | 2 | 1 | BSD-3-Clause | 2022-11-19T06:53:07 | 2019-10-25T14:58:54 | null | UTF-8 | C++ | false | false | 16,206 | cc | // Copyright (c) 2017 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 "gpu/command_buffer/client/raster_implementation_gles.h"
#include <GLES2/gl2.h>
#include <GLES2/gl2ext.h>
#include <GLES2/gl2extchromium.h>
#include <GLES3/gl3.h>
#include <memory>
#include <utility>
#include <vector>
#include "base/containers/flat_map.h"
#include "cc/paint/display_item_list.h"
#include "cc/paint/image_provider.h"
#include "components/viz/common/resources/resource_format_utils.h"
#include "gpu/GLES2/gl2extchromium.h"
#include "gpu/command_buffer/client/client_test_helper.h"
#include "gpu/command_buffer/client/context_support.h"
#include "gpu/command_buffer/client/gles2_interface_stub.h"
#include "gpu/command_buffer/common/capabilities.h"
#include "gpu/command_buffer/common/gpu_memory_buffer_support.h"
#include "gpu/command_buffer/common/mailbox.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/skia/include/gpu/GrTypes.h"
#include "ui/gfx/color_space.h"
using testing::_;
using testing::Gt;
using testing::Le;
using testing::Return;
using testing::SetArgPointee;
using testing::StrEq;
namespace gpu {
namespace raster {
class RasterMockGLES2Interface : public gles2::GLES2InterfaceStub {
public:
// Command buffer Flush / Finish.
MOCK_METHOD0(Finish, void());
MOCK_METHOD0(Flush, void());
MOCK_METHOD0(ShallowFlushCHROMIUM, void());
MOCK_METHOD0(OrderingBarrierCHROMIUM, void());
// SyncTokens.
MOCK_METHOD1(GenSyncTokenCHROMIUM, void(GLbyte* sync_token));
MOCK_METHOD1(GenUnverifiedSyncTokenCHROMIUM, void(GLbyte* sync_token));
MOCK_METHOD2(VerifySyncTokensCHROMIUM,
void(GLbyte** sync_tokens, GLsizei count));
MOCK_METHOD1(WaitSyncTokenCHROMIUM, void(const GLbyte* sync_token));
// Command buffer state.
MOCK_METHOD0(GetError, GLenum());
MOCK_METHOD0(GetGraphicsResetStatusKHR, GLenum());
MOCK_METHOD2(GetIntegerv, void(GLenum pname, GLint* params));
MOCK_METHOD2(LoseContextCHROMIUM, void(GLenum current, GLenum other));
// Queries:
// - GL_COMMANDS_ISSUED_CHROMIUM
// - GL_COMMANDS_ISSUED_TIMESTAMP_CHROMIUM
// - GL_COMMANDS_COMPLETED_CHROMIUM
MOCK_METHOD2(GenQueriesEXT, void(GLsizei n, GLuint* queries));
MOCK_METHOD2(DeleteQueriesEXT, void(GLsizei n, const GLuint* queries));
MOCK_METHOD2(BeginQueryEXT, void(GLenum target, GLuint id));
MOCK_METHOD1(EndQueryEXT, void(GLenum target));
MOCK_METHOD2(QueryCounterEXT, void(GLuint id, GLenum target));
MOCK_METHOD3(GetQueryObjectuivEXT,
void(GLuint id, GLenum pname, GLuint* params));
MOCK_METHOD3(GetQueryObjectui64vEXT,
void(GLuint id, GLenum pname, GLuint64* params));
// Texture objects.
MOCK_METHOD2(GenTextures, void(GLsizei n, GLuint* textures));
MOCK_METHOD2(DeleteTextures, void(GLsizei n, const GLuint* textures));
MOCK_METHOD2(BindTexture, void(GLenum target, GLuint texture));
MOCK_METHOD1(ActiveTexture, void(GLenum texture));
MOCK_METHOD1(GenerateMipmap, void(GLenum target));
MOCK_METHOD2(SetColorSpaceMetadataCHROMIUM,
void(GLuint texture_id, GLColorSpace color_space));
MOCK_METHOD3(TexParameteri, void(GLenum target, GLenum pname, GLint param));
// Mailboxes.
MOCK_METHOD2(ProduceTextureDirectCHROMIUM,
void(GLuint texture, GLbyte* mailbox));
MOCK_METHOD1(CreateAndConsumeTextureCHROMIUM, GLuint(const GLbyte* mailbox));
// Image objects.
MOCK_METHOD4(CreateImageCHROMIUM,
GLuint(ClientBuffer buffer,
GLsizei width,
GLsizei height,
GLenum internalformat));
MOCK_METHOD2(BindTexImage2DCHROMIUM, void(GLenum target, GLint imageId));
MOCK_METHOD2(ReleaseTexImage2DCHROMIUM, void(GLenum target, GLint imageId));
MOCK_METHOD1(DestroyImageCHROMIUM, void(GLuint image_id));
// Texture allocation and copying.
MOCK_METHOD9(TexImage2D,
void(GLenum target,
GLint level,
GLint internalformat,
GLsizei width,
GLsizei height,
GLint border,
GLenum format,
GLenum type,
const void* pixels));
MOCK_METHOD9(TexSubImage2D,
void(GLenum target,
GLint level,
GLint xoffset,
GLint yoffset,
GLsizei width,
GLsizei height,
GLenum format,
GLenum type,
const void* pixels));
MOCK_METHOD8(CompressedTexImage2D,
void(GLenum target,
GLint level,
GLenum internalformat,
GLsizei width,
GLsizei height,
GLint border,
GLsizei imageSize,
const void* data));
MOCK_METHOD5(TexStorage2DEXT,
void(GLenum target,
GLsizei levels,
GLenum internalFormat,
GLsizei width,
GLsizei height));
MOCK_METHOD5(TexStorage2DImageCHROMIUM,
void(GLenum target,
GLenum internalFormat,
GLenum bufferUsage,
GLsizei width,
GLsizei height));
// OOP-Raster
MOCK_METHOD6(BeginRasterCHROMIUM,
void(GLuint texture_id,
GLuint sk_color,
GLuint msaa_sample_count,
GLboolean can_use_lcd_text,
GLint color_type,
GLuint color_space_id));
MOCK_METHOD2(RasterCHROMIUM, void(GLsizeiptr size, const void* list));
MOCK_METHOD1(MapRasterCHROMIUM, void*(GLsizeiptr size));
MOCK_METHOD1(UnmapRasterCHROMIUM, void(GLsizeiptr written));
MOCK_METHOD0(EndRasterCHROMIUM, void());
MOCK_METHOD2(PixelStorei, void(GLenum pname, GLint param));
MOCK_METHOD2(TraceBeginCHROMIUM,
void(const char* category_name, const char* trace_name));
MOCK_METHOD0(TraceEndCHROMIUM, void());
};
class ContextSupportStub : public ContextSupport {
public:
~ContextSupportStub() override = default;
void FlushPendingWork() override {}
void SignalSyncToken(const SyncToken& sync_token,
base::OnceClosure callback) override {}
bool IsSyncTokenSignaled(const SyncToken& sync_token) override {
return false;
}
void SignalQuery(uint32_t query, base::OnceClosure callback) override {}
void GetGpuFence(uint32_t gpu_fence_id,
base::OnceCallback<void(std::unique_ptr<gfx::GpuFence>)>
callback) override {}
void SetAggressivelyFreeResources(bool aggressively_free_resources) override {
}
void Swap(uint32_t flags,
SwapCompletedCallback swap_completed,
PresentationCallback presentation_callback) override {}
void SwapWithBounds(const std::vector<gfx::Rect>& rects,
uint32_t flags,
SwapCompletedCallback swap_completed,
PresentationCallback presentation_callback) override {}
void PartialSwapBuffers(const gfx::Rect& sub_buffer,
uint32_t flags,
SwapCompletedCallback swap_completed,
PresentationCallback presentation_callback) override {
}
void CommitOverlayPlanes(
uint32_t flags,
SwapCompletedCallback swap_completed,
PresentationCallback presentation_callback) override {}
void ScheduleOverlayPlane(int plane_z_order,
gfx::OverlayTransform plane_transform,
unsigned overlay_texture_id,
const gfx::Rect& display_bounds,
const gfx::RectF& uv_rect,
bool enable_blend,
unsigned gpu_fence_id) override {}
uint64_t ShareGroupTracingGUID() const override { return 0; }
void SetErrorMessageCallback(
base::RepeatingCallback<void(const char*, int32_t)> callback) override {}
bool ThreadSafeShallowLockDiscardableTexture(uint32_t texture_id) override {
return true;
}
void CompleteLockDiscardableTexureOnContextThread(
uint32_t texture_id) override {}
bool ThreadsafeDiscardableTextureIsDeletedForTracing(
uint32_t texture_id) override {
return false;
}
void* MapTransferCacheEntry(uint32_t serialized_size) override {
mapped_transfer_cache_entry_.reset(new char[serialized_size]);
return mapped_transfer_cache_entry_.get();
}
void UnmapAndCreateTransferCacheEntry(uint32_t type, uint32_t id) override {
mapped_transfer_cache_entry_.reset();
}
bool ThreadsafeLockTransferCacheEntry(uint32_t type, uint32_t id) override {
return true;
}
void UnlockTransferCacheEntries(
const std::vector<std::pair<uint32_t, uint32_t>>& entries) override {}
void DeleteTransferCacheEntry(uint32_t type, uint32_t id) override {}
unsigned int GetTransferBufferFreeSize() const override { return 0; }
bool IsJpegDecodeAccelerationSupported() const override { return false; }
bool IsWebPDecodeAccelerationSupported() const override { return false; }
bool CanDecodeWithHardwareAcceleration(
const cc::ImageHeaderMetadata* image_metadata) const override {
return false;
}
bool HasGrContextSupport() const override { return false; }
void SetGrContext(GrContext* gr) override {}
void WillCallGLFromSkia() override {}
void DidCallGLFromSkia() override {}
void SetDisplayTransform(gfx::OverlayTransform transform) override {}
private:
std::unique_ptr<char[]> mapped_transfer_cache_entry_;
};
class ImageProviderStub : public cc::ImageProvider {
public:
~ImageProviderStub() override {}
ScopedResult GetRasterContent(const cc::DrawImage& draw_image) override {
return ScopedResult();
}
};
class RasterImplementationGLESTest : public testing::Test {
protected:
RasterImplementationGLESTest() {}
void SetUp() override {
gl_ = std::make_unique<RasterMockGLES2Interface>();
ri_ = std::make_unique<RasterImplementationGLES>(gl_.get());
}
void TearDown() override {}
void ExpectBindTexture(GLenum target, GLuint texture_id) {
if (bound_texture_ != texture_id) {
bound_texture_ = texture_id;
EXPECT_CALL(*gl_, BindTexture(target, texture_id)).Times(1);
}
}
ContextSupportStub support_;
std::unique_ptr<RasterMockGLES2Interface> gl_;
std::unique_ptr<RasterImplementationGLES> ri_;
GLuint bound_texture_ = 0;
};
TEST_F(RasterImplementationGLESTest, Finish) {
EXPECT_CALL(*gl_, Finish()).Times(1);
ri_->Finish();
}
TEST_F(RasterImplementationGLESTest, Flush) {
EXPECT_CALL(*gl_, Flush()).Times(1);
ri_->Flush();
}
TEST_F(RasterImplementationGLESTest, ShallowFlushCHROMIUM) {
EXPECT_CALL(*gl_, ShallowFlushCHROMIUM()).Times(1);
ri_->ShallowFlushCHROMIUM();
}
TEST_F(RasterImplementationGLESTest, OrderingBarrierCHROMIUM) {
EXPECT_CALL(*gl_, OrderingBarrierCHROMIUM()).Times(1);
ri_->OrderingBarrierCHROMIUM();
}
TEST_F(RasterImplementationGLESTest, GenUnverifiedSyncTokenCHROMIUM) {
GLbyte sync_token_data[GL_SYNC_TOKEN_SIZE_CHROMIUM] = {};
EXPECT_CALL(*gl_, GenUnverifiedSyncTokenCHROMIUM(sync_token_data)).Times(1);
ri_->GenUnverifiedSyncTokenCHROMIUM(sync_token_data);
}
TEST_F(RasterImplementationGLESTest, VerifySyncTokensCHROMIUM) {
const GLsizei kNumSyncTokens = 2;
GLbyte sync_token_data[GL_SYNC_TOKEN_SIZE_CHROMIUM][kNumSyncTokens] = {};
GLbyte* sync_tokens[2] = {sync_token_data[0], sync_token_data[1]};
EXPECT_CALL(*gl_, VerifySyncTokensCHROMIUM(sync_tokens, kNumSyncTokens))
.Times(1);
ri_->VerifySyncTokensCHROMIUM(sync_tokens, kNumSyncTokens);
}
TEST_F(RasterImplementationGLESTest, WaitSyncTokenCHROMIUM) {
GLbyte sync_token_data[GL_SYNC_TOKEN_SIZE_CHROMIUM] = {};
EXPECT_CALL(*gl_, WaitSyncTokenCHROMIUM(sync_token_data)).Times(1);
ri_->WaitSyncTokenCHROMIUM(sync_token_data);
}
TEST_F(RasterImplementationGLESTest, GetError) {
const GLuint kGLInvalidOperation = GL_INVALID_OPERATION;
EXPECT_CALL(*gl_, GetError()).WillOnce(Return(kGLInvalidOperation));
GLenum error = ri_->GetError();
EXPECT_EQ(kGLInvalidOperation, error);
}
TEST_F(RasterImplementationGLESTest, GetGraphicsResetStatusKHR) {
const GLuint kGraphicsResetStatus = GL_UNKNOWN_CONTEXT_RESET_KHR;
EXPECT_CALL(*gl_, GetGraphicsResetStatusKHR())
.WillOnce(Return(kGraphicsResetStatus));
GLenum status = ri_->GetGraphicsResetStatusKHR();
EXPECT_EQ(kGraphicsResetStatus, status);
}
TEST_F(RasterImplementationGLESTest, LoseContextCHROMIUM) {
const GLenum kCurrent = GL_GUILTY_CONTEXT_RESET_ARB;
const GLenum kOther = GL_INNOCENT_CONTEXT_RESET_ARB;
EXPECT_CALL(*gl_, LoseContextCHROMIUM(kCurrent, kOther)).Times(1);
ri_->LoseContextCHROMIUM(kCurrent, kOther);
}
TEST_F(RasterImplementationGLESTest, GenQueriesEXT) {
const GLsizei kNumQueries = 2;
GLuint queries[kNumQueries] = {};
EXPECT_CALL(*gl_, GenQueriesEXT(kNumQueries, queries)).Times(1);
ri_->GenQueriesEXT(kNumQueries, queries);
}
TEST_F(RasterImplementationGLESTest, DeleteQueriesEXT) {
const GLsizei kNumQueries = 2;
GLuint queries[kNumQueries] = {2, 3};
EXPECT_CALL(*gl_, DeleteQueriesEXT(kNumQueries, queries)).Times(1);
ri_->DeleteQueriesEXT(kNumQueries, queries);
}
TEST_F(RasterImplementationGLESTest, BeginQueryEXT) {
const GLenum kQueryTarget = GL_COMMANDS_ISSUED_CHROMIUM;
const GLuint kQueryId = 23;
EXPECT_CALL(*gl_, BeginQueryEXT(kQueryTarget, kQueryId)).Times(1);
ri_->BeginQueryEXT(kQueryTarget, kQueryId);
}
TEST_F(RasterImplementationGLESTest, EndQueryEXT) {
const GLenum kQueryTarget = GL_COMMANDS_ISSUED_CHROMIUM;
EXPECT_CALL(*gl_, EndQueryEXT(kQueryTarget)).Times(1);
ri_->EndQueryEXT(kQueryTarget);
}
TEST_F(RasterImplementationGLESTest, QueryCounterEXT) {
const GLenum kQueryTarget = GL_COMMANDS_ISSUED_TIMESTAMP_CHROMIUM;
const GLuint kQueryId = 23;
EXPECT_CALL(*gl_, QueryCounterEXT(kQueryId, kQueryTarget)).Times(1);
ri_->QueryCounterEXT(kQueryId, kQueryTarget);
}
TEST_F(RasterImplementationGLESTest, GetQueryObjectuivEXT) {
const GLuint kQueryId = 23;
const GLsizei kQueryParam = GL_QUERY_RESULT_AVAILABLE_EXT;
GLuint result = 0;
EXPECT_CALL(*gl_, GetQueryObjectuivEXT(kQueryId, kQueryParam, &result))
.Times(1);
ri_->GetQueryObjectuivEXT(kQueryId, kQueryParam, &result);
}
TEST_F(RasterImplementationGLESTest, GetQueryObjectui64vEXT) {
const GLuint kQueryId = 23;
const GLsizei kQueryParam = GL_QUERY_RESULT_AVAILABLE_EXT;
GLuint64 result = 0;
EXPECT_CALL(*gl_, GetQueryObjectui64vEXT(kQueryId, kQueryParam, &result))
.Times(1);
ri_->GetQueryObjectui64vEXT(kQueryId, kQueryParam, &result);
}
TEST_F(RasterImplementationGLESTest, DeleteGpuRasterTexture) {
GLuint texture_id = 3;
gpu::Mailbox mailbox;
EXPECT_CALL(*gl_, CreateAndConsumeTextureCHROMIUM(mailbox.name))
.WillOnce(Return(texture_id))
.RetiresOnSaturation();
EXPECT_EQ(texture_id, ri_->CreateAndConsumeForGpuRaster(mailbox.name));
EXPECT_CALL(*gl_, DeleteTextures(1, _)).Times(1);
ri_->DeleteGpuRasterTexture(texture_id);
}
TEST_F(RasterImplementationGLESTest, CreateAndConsumeForGpuRaster) {
const GLuint kTextureId = 23;
GLuint texture_id = 0;
gpu::Mailbox mailbox;
EXPECT_CALL(*gl_, CreateAndConsumeTextureCHROMIUM(mailbox.name))
.WillOnce(Return(kTextureId));
texture_id = ri_->CreateAndConsumeForGpuRaster(mailbox.name);
EXPECT_EQ(kTextureId, texture_id);
}
TEST_F(RasterImplementationGLESTest, BeginGpuRaster) {
EXPECT_CALL(*gl_, TraceBeginCHROMIUM(StrEq("BeginGpuRaster"),
StrEq("GpuRasterization")))
.Times(1);
ri_->BeginGpuRaster();
}
TEST_F(RasterImplementationGLESTest, EndGpuRaster) {
EXPECT_CALL(*gl_, PixelStorei(GL_UNPACK_ALIGNMENT, 4)).Times(1);
EXPECT_CALL(*gl_, TraceEndCHROMIUM()).Times(1);
ri_->EndGpuRaster();
}
} // namespace raster
} // namespace gpu
| [
"rjkroege@chromium.org"
] | rjkroege@chromium.org |
710e4558d47d66ad8233dd531248871c1549fcd2 | 2cdace20af2b805218b9974c5be977d1a27acb5f | /qtfinestracompetenza.h | 7b18be5146eb87c452e4a4fc95e4905cc85cc181 | [] | no_license | nicolac18/linqedin | d95bfec308a981768991327c425e0bc28f72b434 | 3181616dd9b9aead5230f79d7b1b749acf3bf6ad | refs/heads/master | 2020-12-28T12:03:51.148998 | 2015-06-15T11:59:00 | 2015-06-15T11:59:00 | 36,794,971 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 609 | h | #ifndef QTFINESTRACOMPETENZA_H
#define QTFINESTRACOMPETENZA_H
#include "linqedinutente.h"
#include <QDialog>
#include <QGridLayout>
#include <QLabel>
#include <QLineEdit>
#include <QMessageBox>
#include <QPushButton>
#include <QString>
class QtFinestraCompetenza: public QDialog {
Q_OBJECT
private:
LinQedInUtente& lUtente;
public:
explicit QtFinestraCompetenza(LinQedInUtente&, QDialog* parent= 0);
QGridLayout* layout;
QLabel* labelCompetenza;
QLineEdit* lineEditCompetenza;
QPushButton* buttonInserisci;
public slots:
void inserisci();
};
#endif // QTFINESTRACOMPETENZA_H
| [
"nicola.carraro.18@gmail.com"
] | nicola.carraro.18@gmail.com |
50883bce6a721e269bfcdfeb994a526f58fbada4 | 55bb84592fbbb48f321a56a118d507dc2241fea2 | /Starting_Out_Games_Graphics/Source_Code/Chapter 02/SalePrice/SalePrice/SalePrice.cpp | c0a93e6a9b1c4488f31bc4cd8f045b0a68ab6fc4 | [] | no_license | tdiliberto19/cpp-practice | 8f801fedf5bf6fba56dc8120c6c2b36d2bc0ce0b | f5068e4fb7abb70219564024cb36041fc45370e1 | refs/heads/master | 2020-11-24T04:36:07.731061 | 2020-05-27T22:11:57 | 2020-05-27T22:11:57 | 227,964,906 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 466 | cpp | #include <iostream>
using namespace std;
int main()
{
// Declare variables
double retailPrice,
discount,
salePrice;
// Get the retail price and discount.
cout << "Enter the item's retail price: ";
cin >> retailPrice;
cout << "Enter the amount of the discount: ";
cin >> discount;
// Calculate and display the sale price.
salePrice = retailPrice - discount;
cout << "The sale price is: " << salePrice << endl;
return 0;
}
| [
"tdiliberto19@berkeley.edu"
] | tdiliberto19@berkeley.edu |
74cfdf437b6ba519eb4773d26a8bdbf2745c8f08 | 037d518773420f21d74079ee492827212ba6e434 | /blazetest/src/mathtest/smatdmatmult/MIbSUDa.cpp | baeb572baaedfbba60e75c2ca3da77bcb5d333d6 | [
"BSD-3-Clause"
] | permissive | chkob/forked-blaze | 8d228f3e8d1f305a9cf43ceaba9d5fcd603ecca8 | b0ce91c821608e498b3c861e956951afc55c31eb | refs/heads/master | 2021-09-05T11:52:03.715469 | 2018-01-27T02:31:51 | 2018-01-27T02:31:51 | 112,014,398 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,369 | cpp | //=================================================================================================
/*!
// \file src/mathtest/smatdmatmult/MIbSUDa.cpp
// \brief Source file for the MIbSUDa sparse matrix/dense matrix multiplication math test
//
// Copyright (C) 2012-2018 Klaus Iglberger - All Rights Reserved
//
// This file is part of the Blaze library. You can redistribute it and/or modify it under
// the terms of the New (Revised) BSD License. Redistribution and use in source and binary
// forms, with or without modification, are permitted provided that the following conditions
// are met:
//
// 1. Redistributions of source code must retain the above copyright notice, this list of
// conditions and the following disclaimer.
// 2. Redistributions in binary form must reproduce the above copyright notice, this list
// of conditions and the following disclaimer in the documentation and/or other materials
// provided with the distribution.
// 3. Neither the names of the Blaze development group nor the names of its contributors
// may be used to endorse or promote products derived from this software without specific
// prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
// SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
// TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
// BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
// DAMAGE.
*/
//=================================================================================================
//*************************************************************************************************
// Includes
//*************************************************************************************************
#include <cstdlib>
#include <iostream>
#include <blaze/math/DynamicMatrix.h>
#include <blaze/math/IdentityMatrix.h>
#include <blaze/math/StrictlyUpperMatrix.h>
#include <blazetest/mathtest/Creator.h>
#include <blazetest/mathtest/smatdmatmult/OperationTest.h>
#include <blazetest/system/MathTest.h>
//=================================================================================================
//
// MAIN FUNCTION
//
//=================================================================================================
//*************************************************************************************************
int main()
{
std::cout << " Running 'MIbSUDa'..." << std::endl;
using blazetest::mathtest::TypeA;
using blazetest::mathtest::TypeB;
try
{
// Matrix type definitions
typedef blaze::IdentityMatrix<TypeB> MIb;
typedef blaze::StrictlyUpperMatrix< blaze::DynamicMatrix<TypeA> > SUDa;
// Creator type definitions
typedef blazetest::Creator<MIb> CMIb;
typedef blazetest::Creator<SUDa> CSUDa;
// Running tests with small matrices
for( size_t i=0UL; i<=6UL; ++i ) {
RUN_SMATDMATMULT_OPERATION_TEST( CMIb( i ), CSUDa( i ) );
}
// Running tests with large matrices
RUN_SMATDMATMULT_OPERATION_TEST( CMIb( 31UL ), CSUDa( 31UL ) );
RUN_SMATDMATMULT_OPERATION_TEST( CMIb( 67UL ), CSUDa( 67UL ) );
RUN_SMATDMATMULT_OPERATION_TEST( CMIb( 127UL ), CSUDa( 127UL ) );
RUN_SMATDMATMULT_OPERATION_TEST( CMIb( 32UL ), CSUDa( 32UL ) );
RUN_SMATDMATMULT_OPERATION_TEST( CMIb( 64UL ), CSUDa( 64UL ) );
RUN_SMATDMATMULT_OPERATION_TEST( CMIb( 128UL ), CSUDa( 128UL ) );
}
catch( std::exception& ex ) {
std::cerr << "\n\n ERROR DETECTED during sparse matrix/dense matrix multiplication:\n"
<< ex.what() << "\n";
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
}
//*************************************************************************************************
| [
"klaus.iglberger@gmail.com"
] | klaus.iglberger@gmail.com |
eec3716c873873fe5db93063bb489cc09408c0ea | e9a40f3cdebd3ec3d6970b4cac90efe50713e561 | /MyEeprom.cpp | ca9782ca071a93c54d8e869b781490366ba7feea | [] | no_license | TrinhNgocTuan/ArduinoEeprom | f8cfc02b6bcf681f1394c99dd5e6f4b77a6a353f | ec449acc6f1438fdf14a4acd365bb1375a4f0c4f | refs/heads/master | 2023-02-04T04:29:19.130700 | 2020-12-15T03:46:54 | 2020-12-15T03:46:54 | 321,545,113 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 19 | cpp | //file nay de trong | [
"tuan.trinhngoc95@gmail.com"
] | tuan.trinhngoc95@gmail.com |
efa71104c08c02847578e74681bb1113b569d820 | 0577a46d8d28e1fd8636893bbdd2b18270bb8eb8 | /update_notifier/thirdparty/wxWidgets/src/common/mstream.cpp | 7b9f472b9e74025a7b8d72dd30d144abb44bba18 | [
"BSD-3-Clause"
] | permissive | ric2b/Vivaldi-browser | 388a328b4cb838a4c3822357a5529642f86316a5 | 87244f4ee50062e59667bf8b9ca4d5291b6818d7 | refs/heads/master | 2022-12-21T04:44:13.804535 | 2022-12-17T16:30:35 | 2022-12-17T16:30:35 | 86,637,416 | 166 | 41 | BSD-3-Clause | 2021-03-31T18:49:30 | 2017-03-29T23:09:05 | null | UTF-8 | C++ | false | false | 5,661 | cpp | /////////////////////////////////////////////////////////////////////////////
// Name: src/common/mstream.cpp
// Purpose: "Memory stream" classes
// Author: Guilhem Lavaux
// Modified by: VZ (23.11.00): general code review
// Created: 04/01/98
// Copyright: (c) Guilhem Lavaux
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
// ============================================================================
// declarations
// ============================================================================
// ----------------------------------------------------------------------------
// headers
// ----------------------------------------------------------------------------
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#if wxUSE_STREAMS
#include "wx/mstream.h"
#ifndef WX_PRECOMP
#include "wx/stream.h"
#endif //WX_PRECOMP
#include <stdlib.h>
// ============================================================================
// implementation
// ============================================================================
// ----------------------------------------------------------------------------
// wxMemoryInputStream
// ----------------------------------------------------------------------------
wxIMPLEMENT_ABSTRACT_CLASS(wxMemoryInputStream, wxInputStream);
wxMemoryInputStream::wxMemoryInputStream(const void *data, size_t len)
{
m_i_streambuf = new wxStreamBuffer(wxStreamBuffer::read);
m_i_streambuf->SetBufferIO(const_cast<void *>(data), len);
m_i_streambuf->SetIntPosition(0); // seek to start pos
m_i_streambuf->Fixed(true);
m_length = len;
}
wxMemoryInputStream::wxMemoryInputStream(const wxMemoryOutputStream& stream)
{
const wxFileOffset lenFile = stream.GetLength();
if ( lenFile == wxInvalidOffset )
{
m_i_streambuf = NULL;
m_lasterror = wxSTREAM_EOF;
return;
}
const size_t len = wx_truncate_cast(size_t, lenFile);
wxASSERT_MSG( len == lenFile + size_t(0), wxT("huge files not supported") );
m_i_streambuf = new wxStreamBuffer(wxStreamBuffer::read);
m_i_streambuf->SetBufferIO(len); // create buffer
stream.CopyTo(m_i_streambuf->GetBufferStart(), len);
m_i_streambuf->SetIntPosition(0); // seek to start pos
m_i_streambuf->Fixed(true);
m_length = len;
}
void
wxMemoryInputStream::InitFromStream(wxInputStream& stream, wxFileOffset lenFile)
{
if ( lenFile == wxInvalidOffset )
lenFile = stream.GetLength();
if ( lenFile == wxInvalidOffset )
{
m_i_streambuf = NULL;
m_lasterror = wxSTREAM_EOF;
return;
}
const size_t len = wx_truncate_cast(size_t, lenFile);
wxASSERT_MSG( (wxFileOffset)len == lenFile, wxT("huge files not supported") );
m_i_streambuf = new wxStreamBuffer(wxStreamBuffer::read);
m_i_streambuf->SetBufferIO(len); // create buffer
stream.Read(m_i_streambuf->GetBufferStart(), len);
m_i_streambuf->SetIntPosition(0); // seek to start pos
m_i_streambuf->Fixed(true);
m_length = stream.LastRead();
}
bool wxMemoryInputStream::CanRead() const
{
return m_i_streambuf->GetIntPosition() != m_length;
}
wxMemoryInputStream::~wxMemoryInputStream()
{
delete m_i_streambuf;
}
char wxMemoryInputStream::Peek()
{
char *buf = (char *)m_i_streambuf->GetBufferStart();
size_t pos = m_i_streambuf->GetIntPosition();
if ( pos == m_length )
{
m_lasterror = wxSTREAM_READ_ERROR;
return 0;
}
return buf[pos];
}
size_t wxMemoryInputStream::OnSysRead(void *buffer, size_t nbytes)
{
size_t pos = m_i_streambuf->GetIntPosition();
if ( pos == m_length )
{
m_lasterror = wxSTREAM_EOF;
return 0;
}
m_i_streambuf->Read(buffer, nbytes);
m_lasterror = wxSTREAM_NO_ERROR;
return m_i_streambuf->GetIntPosition() - pos;
}
wxFileOffset wxMemoryInputStream::OnSysSeek(wxFileOffset pos, wxSeekMode mode)
{
return m_i_streambuf->Seek(pos, mode);
}
wxFileOffset wxMemoryInputStream::OnSysTell() const
{
return m_i_streambuf->Tell();
}
// ----------------------------------------------------------------------------
// wxMemoryOutputStream
// ----------------------------------------------------------------------------
wxIMPLEMENT_DYNAMIC_CLASS(wxMemoryOutputStream, wxOutputStream);
wxMemoryOutputStream::wxMemoryOutputStream(void *data, size_t len)
{
m_o_streambuf = new wxStreamBuffer(wxStreamBuffer::write);
if ( data )
m_o_streambuf->SetBufferIO(data, len);
m_o_streambuf->Fixed(false);
m_o_streambuf->Flushable(false);
}
wxMemoryOutputStream::~wxMemoryOutputStream()
{
delete m_o_streambuf;
}
size_t wxMemoryOutputStream::OnSysWrite(const void *buffer, size_t nbytes)
{
size_t oldpos = m_o_streambuf->GetIntPosition();
m_o_streambuf->Write(buffer, nbytes);
size_t newpos = m_o_streambuf->GetIntPosition();
// FIXME can someone please explain what this does? (VZ)
if ( !newpos )
newpos = m_o_streambuf->GetBufferSize();
return newpos - oldpos;
}
wxFileOffset wxMemoryOutputStream::OnSysSeek(wxFileOffset pos, wxSeekMode mode)
{
return m_o_streambuf->Seek(pos, mode);
}
wxFileOffset wxMemoryOutputStream::OnSysTell() const
{
return m_o_streambuf->Tell();
}
size_t wxMemoryOutputStream::CopyTo(void *buffer, size_t len) const
{
wxCHECK_MSG( buffer, 0, wxT("must have buffer to CopyTo") );
if ( len > GetSize() )
len = GetSize();
memcpy(buffer, m_o_streambuf->GetBufferStart(), len);
return len;
}
#endif // wxUSE_STREAMS
| [
"mathieu.caroff@free.fr"
] | mathieu.caroff@free.fr |
043d8c14157e9cbb5f15a7bfbe3940fc2b26dadd | cdfa5f737f3f27ee86d29eede746d5c1d0905a2e | /DllExport.cpp | abd75160b781b0c99113d475bf5f6a0e9088001d | [] | no_license | RileyCodes/RFramework | 142c0f58ce9db85003a4a2b920e9e4192d318c91 | 29dfcf5e1d097994bf49283e716e54414b734f96 | refs/heads/main | 2023-07-15T01:48:18.769285 | 2021-08-23T20:47:46 | 2021-08-23T20:47:46 | 394,082,544 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 205 | cpp | #include "pch.h"
#include "DllExport.h"
#include "pch.h"
extern int __cdecl FromCaller(char* buffer, int length)
{
return length;
}
extern void __cdecl SetupLogCallback(void(*cb)())
{
(*cb)();
}
| [
"35380563+RileyCodes@users.noreply.github.com"
] | 35380563+RileyCodes@users.noreply.github.com |
e6b78d5550087de1f9d9f653e11c31f2d8fac90a | 7ca5fc30ccc515bcdd1a9945a288e46bd223fe8c | /HDOJ2037 最多节目.cpp | 2595a15d874512c700db866e72743623d2fad6b7 | [] | no_license | JosephPai/LeetCode | 723aa00067f2a1110a9d572a01b41dd2e43b90b4 | c6de13aa7040a0a4098ab7264a86dc7aafb6692c | refs/heads/master | 2021-05-06T07:08:39.231028 | 2018-03-29T03:45:41 | 2018-03-29T03:45:41 | 113,938,115 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 595 | cpp | #include <iostream>
#include <cstdio>
#include <string.h>
#include <vector>
#include <algorithm>
#include <math.h>
#include <map>
using namespace std;
struct time{
int start,end;
};
bool compare(time last, time next){
return last.end < next.end;
}
int main(){
freopen("input.txt","r",stdin);
int n,i;
time a[100];
while(scanf("%d",&n) != EOF){
if(n==0) break;
for(i=0;i<n;i++){
scanf("%d%d\n",&a[i].start,&a[i].end);
}
sort(a,a+n,compare);
int k=0,num=1;
for(i=0;i<n;i++){
if(a[i].start >= a[k].end){
k=i; num++;
}
}
printf("%d\n",num);
}
return 0;
} | [
"ustb2015bzch@163.com"
] | ustb2015bzch@163.com |
775a577446370f034343070ca5728b5e805cd051 | a03821df6b547c0bc8ecde2ffaf79ab6a50ccb37 | /c/old/arc108/a.cpp | af5c98af5b7d85f5ecbf23fba82f3e652b399c27 | [] | no_license | ueda0319/AtCoder | 85483601e897c9ec4a554ac593d66308ff6d8dc6 | 7b7b5b592c2034c3c5d545d4374429f208332c11 | refs/heads/main | 2023-02-22T07:46:03.884858 | 2021-01-23T14:55:09 | 2021-01-23T14:55:09 | 326,196,351 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 487 | cpp | #include <iostream>
#include <string>
#include <math.h>
using namespace std;
int main(){
double s,p;
cin >> s >> p;
double n1=(s+sqrt(s*s-4*p))/2;
double n2=(s-sqrt(s*s-4*p))/2;
long long n1l = (long long)floor(n1);
long long n2l = (long long)floor(n2);
if((n1==n1l)&&(n1l>0)&&(s-n1l>0)){
cout << "Yes" << endl;
}else if((n2==n2l)&&(n2l>0)&&(s-n2l>0)){
cout << "Yes" << endl;
}else{
cout << "No" << endl;
}
return 0;
} | [
"i.ueda0319@gmail.com"
] | i.ueda0319@gmail.com |
37820d91f64a372de4b8362c0cc09c308daa790d | 37424c9d17b4988bed54bd57094b69bdb263a035 | /14_longest_common_prefix.cpp | 393e0e6a4e438bed0ec9044dd5f2456e8e3919f9 | [] | no_license | retaw/leetcode | c7aeea019abe5d3274712d73cf6dcb24e2ab4476 | e9310138949334ef84f96ad2651b5c42810d4045 | refs/heads/master | 2022-10-02T10:24:19.928568 | 2022-09-13T08:18:59 | 2022-09-13T08:20:14 | 49,153,501 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 851 | cpp | #include "test.h"
class Solution {
public:
string longestCommonPrefix(const vector<string>& strs)
{
string ret = "";
if (strs.empty())
return ret;
if (strs.size() == 1)
return strs[0];
for (auto p = 0u; p < strs[0].length(); ++p)
{
char c = strs[0][p];
for (auto i = 1u; i < strs.size(); ++i)
{
if (p >= strs[i].length())
return ret;
if (c != strs[i][p])
return ret;
}
ret.append(1, c);
}
return ret;
}
};
int main()
{
Solution s;
cout << s.longestCommonPrefix({"123ab0", "12ab1", "12ab2"}) << endl;
cout << s.longestCommonPrefix({"123ab0", "123ab", "123ab2"}) << endl;
return 0;
}
| [
"waterlzj@gmail.com"
] | waterlzj@gmail.com |
acd00c2876d28af318356fe09e2aeeb599a1357d | 28d1118090f6c80a1fc3fca6a7dec74720197884 | /sec01/chap05/Val1.cpp | 36d7ae50a86cf6e0186e0810cb1dce1c01a86e29 | [] | no_license | tkoyama010/robe | 9825ee146e253b5fee3def07038e1eb7ade8c297 | 584e45249bb647e5bc9b4d4a3fa19a22c7ef1bb6 | refs/heads/master | 2020-04-14T10:26:11.120859 | 2019-01-02T13:58:23 | 2019-01-02T13:58:23 | 163,786,934 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 180 | cpp | #include <iostream>
int main()
{
int a;
a = 0;
std::cout << "a = " << a << std::endl;
a = 5;
std::cout << "a * 2 = " << a * 2 << std::endl;
return 0;
}
| [
"tkoyama010@gmail.com"
] | tkoyama010@gmail.com |
fd1d2887dd0af8c03afdff8f41fcfd4477e962f2 | c0ba777da208970c8ff26e2f1674de42fa7c23ea | /P06TangentSpace_01MeshTangent/chapTangetSpace01_meshTangent/mesh.cpp | bd8bdf5047edc729b5aea1a1653f88a4b05f262d | [
"Unlicense"
] | permissive | dknife/GraphicsExCode | 45ba96db3fd1c57169687735cf0204b669fab7ba | 852b136f6c682d16833bc356dc27968e3db4b571 | refs/heads/master | 2020-05-17T19:11:24.863978 | 2015-09-01T01:16:28 | 2015-09-01T01:16:28 | 31,638,869 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 6,192 | cpp | #include "mesh.h"
#include <stdio.h>
#include <math.h>
#ifdef WIN32
#include <windows.h>
#include <gl/gl.h>
#include <gl/glut.h>
#else // MAC OS X
#include <OpenGL/OpenGL.h>
#include <GLUT/GLUT.h> // OpenGL utility toolkit
#endif
void normalize(CVec3 &v) {
float l = sqrt(v.x*v.x+v.y*v.y+v.z*v.z);
v.x /= l;
v.y /= l;
v.z /= l;
}
void cross(CVec3 u, CVec3 v, CVec3 &r) {
r.x = u.y*v.z-v.y*u.z;
r.y = u.z*v.x-v.z*u.x;
r.z = u.x*v.y-v.x*u.y;
}
CMesh::CMesh()
: verts(0), normals(0), tangents(0), binormals(0), texCoords(0)
{}
void CMesh::initializeMemory(void) {
if(verts) delete[] verts;
if(normals) delete[] normals;
if(tangents) delete[] tangents;
if(binormals) delete[] binormals;
if(texCoords) delete[] texCoords;
verts = NULL;
normals = NULL;
binormals = NULL;
tangents = NULL;
texCoords = NULL;
}
void CMesh::createMesh(int nVRow, int nVCol) {
initializeMemory();
nVertices = nVRow * nVCol;
nFaces = (nVRow-1)*(nVCol-1)*2;
verts = new CVec3[nVertices];
normals = new CVec3[nVertices];
binormals = new CVec3[nVertices];
tangents = new CVec3[nVertices];
texCoords = new CVec2[nVertices];
faces = new CFace[nFaces];
float xStep = 1.0/float(nVCol-1);
float zStep = 1.0/float(nVRow-1);
for (int i=0; i<nVertices; i++) {
verts[i].x = xStep*(i%nVCol);
verts[i].z = zStep*(i/nVCol);
verts[i].y = 0.1*sin(10.0*verts[i].x)*cos(10.0*verts[i].z);
texCoords[i].u = verts[i].x;
texCoords[i].v = 1.0-verts[i].z;
}
int idx = 0;
for (int i=0; i<nVRow-1; i++) {
for (int j=0; j<nVCol-1; j++) {
faces[idx].v1 = j+i*nVCol;
faces[idx].v2 = j+(i+1)*nVCol;
faces[idx].v3 = j+1+i*nVCol;
idx++;
faces[idx].v1 = j+(i+1)*nVCol;
faces[idx].v2 = j+1+(i+1)*nVCol;
faces[idx].v3 = j+1+i*nVCol;
idx++;
}
}
this->computeNormals();
}
void CMesh::computeNormals(void) {
for (int i=0; i<nVertices; i++) {
normals[i].x = normals[i].y = normals[i].z = 0.0;
binormals[i].x = binormals[i].y = binormals[i].z = 0.0;
tangents[i].x = tangents[i].y = tangents[i].z = 0.0;
}
CVec3 T, B, N;
float v31, v21, u21, u31;
float px21, px31, py21, py31, pz21, pz31;
for (int i=0; i<nFaces; i++) {
int v1, v2, v3;
v1 = faces[i].v1;
v2 = faces[i].v2;
v3 = faces[i].v3;
px21 = verts[v2].x-verts[v1].x;
py21 = verts[v2].y-verts[v1].y;
pz21 = verts[v2].z-verts[v1].z;
px31 = verts[v3].x-verts[v1].x;
py31 = verts[v3].y-verts[v1].y;
pz31 = verts[v3].z-verts[v1].z;
v31 = texCoords[v3].v-texCoords[v1].v;
u31 = texCoords[v3].u-texCoords[v1].u;
v21 = texCoords[v2].v-texCoords[v1].v;
u21 = texCoords[v2].u-texCoords[v1].u;
T.x = (v31*px21-v21*px31)/(u21*v31-v21*u31);
T.y = (v31*py21-v21*py31)/(u21*v31-v21*u31);
T.z = (v31*pz21-v21*pz31)/(u21*v31-v21*u31);
B.x = (u31*px21-u21*px31)/(v21*u31-u21*v31);
B.y = (u31*py21-u21*py31)/(v21*u31-u21*v31);
B.z = (u31*pz21-u21*pz31)/(v21*u31-u21*v31);
tangents[v1].x += T.x;
tangents[v1].y += T.y;
tangents[v1].z += T.z;
tangents[v2].x += T.x;
tangents[v2].y += T.y;
tangents[v2].z += T.z;
tangents[v3].x += T.x;
tangents[v3].y += T.y;
tangents[v3].z += T.z;
binormals[v1].x += B.x;
binormals[v1].y += B.y;
binormals[v1].z += B.z;
binormals[v2].x += B.x;
binormals[v2].y += B.y;
binormals[v2].z += B.z;
binormals[v3].x += B.x;
binormals[v3].y += B.y;
binormals[v3].z += B.z;
}
for (int i=0; i<nVertices; i++) {
normalize(tangents[i]);
normalize(binormals[i]);
cross(tangents[i], binormals[i], normals[i]);
normalize(normals[i]);
printf("%f %f %f\n", tangents[i].x, tangents[i].y, tangents[i].z);
printf("%f %f %f\n", binormals[i].x, binormals[i].y, binormals[i].z);
printf("%f %f %f\n", normals[i].x, normals[i].y, normals[i].z);
}
}
void CMesh::drawTangentSpace(int idx) {
glDisable(GL_LIGHTING);
glDisable(GL_TEXTURE_2D);
float s = 0.025;
glBegin(GL_LINES);
for (int i=0; i<nVertices; i++) {
glColor3f(1.0, 0.0, 0.0);
glVertex3f(verts[i].x, verts[i].y, verts[i].z);
glVertex3f(verts[i].x+tangents[i].x*s, verts[i].y+tangents[i].y*s, verts[i].z+tangents[i].z*s);
glColor3f(0.0, 1.0, 0.0);
glVertex3f(verts[i].x, verts[i].y, verts[i].z);
glVertex3f(verts[i].x+binormals[i].x*s, verts[i].y+binormals[i].y*s, verts[i].z+binormals[i].z*s);
glColor3f(0.0, 0.0, 1.0);
glVertex3f(verts[i].x, verts[i].y, verts[i].z);
glVertex3f(verts[i].x+normals[i].x*s, verts[i].y+normals[i].y*s, verts[i].z+normals[i].z*s);
}
glEnd();
glEnable(GL_TEXTURE_2D);
glEnable(GL_LIGHTING);
}
void CMesh::drawWithGL(void) {
glBegin(GL_TRIANGLES);
for (int i=0; i<nFaces; i++) {
int idx1 = faces[i].v1;
int idx2 = faces[i].v2;
int idx3 = faces[i].v3;
CVec3 v1 = verts[idx1];
CVec3 v2 = verts[idx2];
CVec3 v3 = verts[idx3];
glNormal3f(normals[idx1].x, normals[idx1].y, normals[idx1].z);
glTexCoord2f(texCoords[idx1].u, texCoords[idx1].v);
glVertex3f(v1.x, v1.y, v1.z);
glNormal3f(normals[idx2].x, normals[idx2].y, normals[idx2].z);
glTexCoord2f(texCoords[idx2].u, texCoords[idx2].v);
glVertex3f(v2.x, v2.y, v2.z);
glNormal3f(normals[idx3].x, normals[idx3].y, normals[idx3].z);
glTexCoord2f(texCoords[idx3].u, texCoords[idx3].v);
glVertex3f(v3.x, v3.y, v3.z);
}
glEnd();
glUseProgram(NULL);
for (int i=0; i<nVertices; i++) {
drawTangentSpace(i);
}
} | [
"ymkang@San302-YMKang.local"
] | ymkang@San302-YMKang.local |
85b9dbc1a932f5e0fca4be232ae25984337a927d | b44b2f5ae462515b3be64517161069488d9ca77f | /Intersetion.cpp | 463a7bc19cb2a9f162df2687312e830afb2e69a8 | [] | no_license | richard4869/Ray_tracer | 0a081dfa231e03babfbddd52a79f83845e54ca10 | 901c4ba4d18ab0930a386629395f59404a2a86f8 | refs/heads/master | 2020-03-19T06:51:18.586792 | 2018-06-04T17:36:33 | 2018-06-04T17:36:33 | 136,060,574 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 252 | cpp | #include "Intersection.hpp"
Intersection::Intersection():
t_ray({glm::vec4(),glm::vec4()}),
hit(false),
t(0)
{
}
Intersection::Intersection(const Ray & ray,double t,bool hit):
t_ray(ray),
t(t),
hit(hit)
{
}
| [
"richardyang4869@gmail.com"
] | richardyang4869@gmail.com |
d367d826485fefaa96bd92605ab354d0bb8d4203 | ee1788b7ee14fa3a86b0c3ff6ac7a58cf59b0868 | /Project/TouchGFX/generated/images/src/__designer/blue_slider_vertical_small_slider3_vertical_round_fill.cpp | ede012d1e3c9f6f83480645e82de7cb2dd2f05f4 | [] | no_license | hakanaydn/stm32f429_zero_crossing_8_ch | 565d252409119e6040dbbefeefa494c47836269f | 510aa1fe8e1a94deebf7dd0b28b98ce352ae25bf | refs/heads/master | 2021-05-17T16:24:44.005842 | 2020-03-07T11:59:43 | 2020-03-07T11:59:43 | 250,870,143 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 84,663 | cpp | // -alpha_dither yes -dither 2 -non_opaque_image_format ARGB8888 -opaque_image_format RGB565 0xb2e614e2
// Generated by imageconverter. Please, do not edit!
#include <touchgfx/hal/Config.hpp>
LOCATION_EXTFLASH_PRAGMA
KEEP extern const unsigned char _blue_slider_vertical_small_slider3_vertical_round_fill[] LOCATION_EXTFLASH_ATTRIBUTE = // 20x172 ARGB8888 pixels.
{
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xfc, 0xf8, 0x04, 0xf8, 0xfc, 0xf8, 0x55, 0xf8, 0xfc, 0xf8, 0xa6, 0xf8, 0xfc, 0xf8, 0xdf, 0xf8, 0xfc, 0xf8, 0xf7, 0xf8, 0xfc, 0xf8, 0xf3, 0xf8, 0xfc, 0xf8, 0xd7, 0xf8, 0xfc, 0xf8, 0xa6, 0xf8, 0xfc, 0xf8, 0x55, 0xf8, 0xfc, 0xf8, 0x04, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0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 0xf8, 0xdb, 0xf8, 0xfc, 0xf8, 0xff, 0xf8, 0xfc, 0xf8, 0xff,
0xf8, 0xfc, 0xf8, 0xff, 0xf8, 0xfc, 0xf8, 0xff, 0xf8, 0xfc, 0xf8, 0xff, 0xf8, 0xfc, 0xf8, 0xff, 0xf8, 0xfc, 0xf8, 0xff, 0xf8, 0xfc, 0xf8, 0xff, 0xf8, 0xfc, 0xf8, 0xdb, 0xf8, 0xfc, 0xf8, 0x55, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xf8, 0xfc, 0xf8, 0x08, 0xf8, 0xfc, 0xf8, 0x59, 0xf8, 0xfc, 0xf8, 0xaa, 0xf8, 0xfc, 0xf8, 0xdf, 0xf8, 0xfc, 0xf8, 0xfb, 0xf8, 0xfc, 0xf8, 0xfb, 0xf8, 0xfc, 0xf8, 0xdf, 0xf8, 0xfc, 0xf8, 0xaa, 0xf8, 0xfc, 0xf8, 0x59, 0xf8, 0xfc, 0xf8, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
| [
"aydinhakan91@gmail.com"
] | aydinhakan91@gmail.com |
2c0087e275dab871a3ace10d6994e79e3b6fb7d0 | 0e189436e9ad040ca4564b4d4b16ac0735d2b62a | /Archieve/Tea_Bag_Servo/Tea_Bag_Servo.ino | fa159364273b7e11ea851ba791c83a67aa9fe142 | [] | no_license | balaji303/Arduino | 62151dbfadeb68f4baeb283770a440d98be18ba4 | add2726e6fba7769281eebe675f079a78287f979 | refs/heads/master | 2023-06-26T22:25:03.088973 | 2023-06-10T11:23:43 | 2023-06-10T11:23:43 | 215,026,192 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,018 | ino | /* Sweep
by BARRAGAN <http://barraganstudio.com>
This example code is in the public domain.
modified 8 Nov 2013
by Scott Fitzgerald
http://www.arduino.cc/en/Tutorial/Sweep
*/
#include <Servo.h>
Servo myservo; // create servo object to control a servo
// twelve servo objects can be created on most boards
int pos = 0; // variable to store the servo position
void setup() {
myservo.attach(9); // attaches the servo on pin 9 to the servo object
}
void loop() {
for (pos = 0; pos <= 180; pos += 1) { // goes from 0 degrees to 180 degrees
// in steps of 1 degree
myservo.write(pos); // tell servo to go to position in variable 'pos'
delay(10); // waits 15ms for the servo to reach the position
}
for (pos = 180; pos >= 0; pos -= 1) { // goes from 180 degrees to 0 degrees
myservo.write(pos); // tell servo to go to position in variable 'pos'
delay(5); // waits 15ms for the servo to reach the position
}
}
| [
"balaji303@outlook.com"
] | balaji303@outlook.com |
9d287af58811cf65729356308a544e30d5f8a05f | be0282afa8dd436619c71d6118c9db455eaf1a29 | /Intermediate/Build/Win64/Design3D/Inc/Engine/ParticleModuleLight.generated.h | 0e99339f53d95f50c1a04e4e553695b66bd8daf5 | [] | no_license | Quant2017/Design3D | 0f915580b222af40ab911021cceef5c26375d7f9 | 94a22386be4aa37aa0f546354cc62958820a4bf6 | refs/heads/master | 2022-04-23T10:44:12.398772 | 2020-04-22T01:02:39 | 2020-04-22T01:02:39 | 262,966,755 | 1 | 0 | null | 2020-05-11T07:12:37 | 2020-05-11T07:12:36 | null | UTF-8 | C++ | false | false | 4,971 | h | // Copyright 1998-2019 Epic Games, Inc. All Rights Reserved.
/*===========================================================================
Generated code exported from UnrealHeaderTool.
DO NOT modify this manually! Edit the corresponding .h files instead!
===========================================================================*/
#include "UObject/ObjectMacros.h"
#include "UObject/ScriptMacros.h"
PRAGMA_DISABLE_DEPRECATION_WARNINGS
#ifdef ENGINE_ParticleModuleLight_generated_h
#error "ParticleModuleLight.generated.h already included, missing '#pragma once' in ParticleModuleLight.h"
#endif
#define ENGINE_ParticleModuleLight_generated_h
#define Engine_Source_Runtime_Engine_Classes_Particles_Light_ParticleModuleLight_h_21_RPC_WRAPPERS
#define Engine_Source_Runtime_Engine_Classes_Particles_Light_ParticleModuleLight_h_21_RPC_WRAPPERS_NO_PURE_DECLS
#define Engine_Source_Runtime_Engine_Classes_Particles_Light_ParticleModuleLight_h_21_INCLASS_NO_PURE_DECLS \
private: \
static void StaticRegisterNativesUParticleModuleLight(); \
friend struct Z_Construct_UClass_UParticleModuleLight_Statics; \
public: \
DECLARE_CLASS(UParticleModuleLight, UParticleModuleLightBase, COMPILED_IN_FLAGS(0), CASTCLASS_None, TEXT("/Script/Engine"), ENGINE_API) \
DECLARE_SERIALIZER(UParticleModuleLight)
#define Engine_Source_Runtime_Engine_Classes_Particles_Light_ParticleModuleLight_h_21_INCLASS \
private: \
static void StaticRegisterNativesUParticleModuleLight(); \
friend struct Z_Construct_UClass_UParticleModuleLight_Statics; \
public: \
DECLARE_CLASS(UParticleModuleLight, UParticleModuleLightBase, COMPILED_IN_FLAGS(0), CASTCLASS_None, TEXT("/Script/Engine"), ENGINE_API) \
DECLARE_SERIALIZER(UParticleModuleLight)
#define Engine_Source_Runtime_Engine_Classes_Particles_Light_ParticleModuleLight_h_21_STANDARD_CONSTRUCTORS \
/** Standard constructor, called after all reflected properties have been initialized */ \
ENGINE_API UParticleModuleLight(const FObjectInitializer& ObjectInitializer = FObjectInitializer::Get()); \
DEFINE_DEFAULT_OBJECT_INITIALIZER_CONSTRUCTOR_CALL(UParticleModuleLight) \
DECLARE_VTABLE_PTR_HELPER_CTOR(ENGINE_API, UParticleModuleLight); \
DEFINE_VTABLE_PTR_HELPER_CTOR_CALLER(UParticleModuleLight); \
private: \
/** Private move- and copy-constructors, should never be used */ \
ENGINE_API UParticleModuleLight(UParticleModuleLight&&); \
ENGINE_API UParticleModuleLight(const UParticleModuleLight&); \
public:
#define Engine_Source_Runtime_Engine_Classes_Particles_Light_ParticleModuleLight_h_21_ENHANCED_CONSTRUCTORS \
/** Standard constructor, called after all reflected properties have been initialized */ \
ENGINE_API UParticleModuleLight(const FObjectInitializer& ObjectInitializer = FObjectInitializer::Get()) : Super(ObjectInitializer) { }; \
private: \
/** Private move- and copy-constructors, should never be used */ \
ENGINE_API UParticleModuleLight(UParticleModuleLight&&); \
ENGINE_API UParticleModuleLight(const UParticleModuleLight&); \
public: \
DECLARE_VTABLE_PTR_HELPER_CTOR(ENGINE_API, UParticleModuleLight); \
DEFINE_VTABLE_PTR_HELPER_CTOR_CALLER(UParticleModuleLight); \
DEFINE_DEFAULT_OBJECT_INITIALIZER_CONSTRUCTOR_CALL(UParticleModuleLight)
#define Engine_Source_Runtime_Engine_Classes_Particles_Light_ParticleModuleLight_h_21_PRIVATE_PROPERTY_OFFSET
#define Engine_Source_Runtime_Engine_Classes_Particles_Light_ParticleModuleLight_h_18_PROLOG
#define Engine_Source_Runtime_Engine_Classes_Particles_Light_ParticleModuleLight_h_21_GENERATED_BODY_LEGACY \
PRAGMA_DISABLE_DEPRECATION_WARNINGS \
public: \
Engine_Source_Runtime_Engine_Classes_Particles_Light_ParticleModuleLight_h_21_PRIVATE_PROPERTY_OFFSET \
Engine_Source_Runtime_Engine_Classes_Particles_Light_ParticleModuleLight_h_21_RPC_WRAPPERS \
Engine_Source_Runtime_Engine_Classes_Particles_Light_ParticleModuleLight_h_21_INCLASS \
Engine_Source_Runtime_Engine_Classes_Particles_Light_ParticleModuleLight_h_21_STANDARD_CONSTRUCTORS \
public: \
PRAGMA_ENABLE_DEPRECATION_WARNINGS
#define Engine_Source_Runtime_Engine_Classes_Particles_Light_ParticleModuleLight_h_21_GENERATED_BODY \
PRAGMA_DISABLE_DEPRECATION_WARNINGS \
public: \
Engine_Source_Runtime_Engine_Classes_Particles_Light_ParticleModuleLight_h_21_PRIVATE_PROPERTY_OFFSET \
Engine_Source_Runtime_Engine_Classes_Particles_Light_ParticleModuleLight_h_21_RPC_WRAPPERS_NO_PURE_DECLS \
Engine_Source_Runtime_Engine_Classes_Particles_Light_ParticleModuleLight_h_21_INCLASS_NO_PURE_DECLS \
Engine_Source_Runtime_Engine_Classes_Particles_Light_ParticleModuleLight_h_21_ENHANCED_CONSTRUCTORS \
static_assert(false, "Unknown access specifier for GENERATED_BODY() macro in class ParticleModuleLight."); \
PRAGMA_ENABLE_DEPRECATION_WARNINGS
template<> ENGINE_API UClass* StaticClass<class UParticleModuleLight>();
#undef CURRENT_FILE_ID
#define CURRENT_FILE_ID Engine_Source_Runtime_Engine_Classes_Particles_Light_ParticleModuleLight_h
PRAGMA_ENABLE_DEPRECATION_WARNINGS
| [
"Snake_Jenny@126.com"
] | Snake_Jenny@126.com |
7ff707aca4a8a695fd5f0a3940794b47609fa1eb | 68e588d7651638b31d62b58bb17414a4f6b4e669 | /ch05/ex5_25.cpp | 88002acdbadf51c6119efe5a184fd5d0e3627b50 | [] | no_license | HongfeiXu/CplusplusPrimer | 8d8844c9ca73c89067ec78a9cf3a4fee2b10a89b | 676a428b1164dd0e980e696d6553f02be96c633c | refs/heads/master | 2022-03-19T00:57:17.604996 | 2022-02-20T14:19:27 | 2022-02-20T14:19:27 | 57,424,704 | 0 | 0 | null | null | null | null | GB18030 | C++ | false | false | 1,054 | cpp | /*
* 练习5.25:编写一段程序,从标准输入读取两个整数,输出第一个数除以第二个数的结果。
* 使用try语句块去补货异常。catch子句应该为用户输出一条提示信息,询问其是否输出新数并重新执行try语句块的内容。
*/
#include <iostream>
#include <stdexcept>
using std::runtime_error;
using std::cin;
using std::cout;
using std::endl;
int main ()
{
int a, b;
while (cin >> a >> b)
{
try
{
if (b == 0) // 如果除数为0,抛出异常
throw runtime_error ("除数不能为0!");
cout << a << " / " << b << " = " << a / b << endl;
}
catch (runtime_error err) // 处理异常
{
cout << err.what() // 输出异常信息
<< "\nTry again? Enter y or n" << endl; // 询问是否继续
char c;
cin >> c;
if (!cin || c == 'n')
break; // 跳出while循环
}
}
return 0;
}
/*
12 3
12 / 3 = 4
12 0
除数不能为0!
Try again? Enter y or n
y
9 19
9 / 19 = 0
1 0
除数不能为0!
Try again? Enter y or n
n
请按任意键继续. . .
*/ | [
"icevmj@gmail.com"
] | icevmj@gmail.com |
91f23139fb2e954a697a57a7793a8865d825ce25 | 6aeccfb60568a360d2d143e0271f0def40747d73 | /sandbox/itl/libs/validate/test/test_interval_bitset_/test_interval_bitset.cpp | e9c7a8f7825df0ed427b67c226ab10812976b7b9 | [
"BSL-1.0"
] | permissive | ttyang/sandbox | 1066b324a13813cb1113beca75cdaf518e952276 | e1d6fde18ced644bb63e231829b2fe0664e51fac | refs/heads/trunk | 2021-01-19T17:17:47.452557 | 2013-06-07T14:19:55 | 2013-06-07T14:19:55 | 13,488,698 | 1 | 3 | null | 2023-03-20T11:52:19 | 2013-10-11T03:08:51 | C++ | UTF-8 | C++ | false | false | 1,253 | cpp | /*-----------------------------------------------------------------------------+
A Law Based Test Automaton 'LaBatea'
Author: Joachim Faulhaber
Copyright (c) 2007-2009: Joachim Faulhaber
+------------------------------------------------------------------------------+
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENCE.txt or copy at
http://www.boost.org/LICENSE_1_0.txt)
+-----------------------------------------------------------------------------*/
#define BOOST_TEST_MODULE validate::itl__interval_bitset unit test
#include <string>
#include <iostream>
#include "../unit_test_unwarned.hpp"
#include <boost/validate/driver/interval_bitset_driver.hpp>
using namespace std;
using namespace boost;
using namespace unit_test;
using namespace boost::icl;
BOOST_AUTO_TEST_CASE(test_validate_itl_interval_bitset)
{
#ifdef _DEBUG
cout << "Run validate/tests in release mode only.\n";
#else
interval_bitset_driver validater;
GentorProfileSgl::it()->set_std_profile(20,1);
//GentorProfileSgl::it()->report_profile();
validater.terminate_at_law_count(42, 2);
//validater.set_information_level(inform::never);
BOOST_CHECK_EQUAL(validater.validate(), true);
#endif
}
| [
"afojgo@gmail.com"
] | afojgo@gmail.com |
4fda5b3cb12e9883bd316d5639a789cef0255d8c | fc751edc89cd62dafe7a1193f2db3837bf5a74da | /randomized-queue/src/main.cpp | 24ce0578a06dfc823fb938a9307f60797cca9efb | [] | no_license | di6-dp/c-hw | 5b1031b5180208a456452d026030e899b00ab76a | 299ca87af660b3951bc5b0790afc110545b999af | refs/heads/main | 2023-05-31T05:34:05.419578 | 2021-07-08T07:23:02 | 2021-07-08T07:23:02 | 384,034,209 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 536 | cpp | #include "subset.h"
#include <cstdlib>
#include <iostream>
int main(int argc, char ** argv)
{
if (argc != 2) {
std::cerr << "Usage: " << argv[0] << " <number of random strings printed>" << std::endl;
return -1;
}
char * end;
unsigned long k = std::strtoul(argv[1], &end, 10);
if (*end != '\0') {
std::cerr << "Incorrect number of strings to be printed\nUsage: " << argv[0] << " <number of random strings printed>" << std::endl;
return -1;
}
subset(k, std::cin, std::cout);
} | [
"buchnevsergey301@gmail.com"
] | buchnevsergey301@gmail.com |
f47eed0c502e02a454a355bc5fee3eeccaa148f6 | fc3180bcc79a1c3ad2bf164331631eec17e65680 | /HeadLinkedList/Source.cpp | bb158dc56ea0c8a6fe1a57edf305cf46a13dd003 | [] | no_license | julcia106/ASD | 5d36cca8ad43f4ad6b67cb8d5f2eb7b488526cd0 | 3f718b78931987632b9efa977169e067018d5167 | refs/heads/master | 2020-04-22T17:34:35.957403 | 2019-02-13T23:18:04 | 2019-02-13T23:18:04 | 170,479,453 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 489 | cpp | #include "pch.h"
#include "HeadLinkedList.h"
#include <iostream>
using namespace std;
int main () {
List one;
cout << endl;
one.insert (1);
one.insert (32);
one.insert (44);
one.insert (23);
one.show ();
one.insert_before (5, 32);
one.show ();
one.remove (5);
one.show ();
//two.insert_after(2,1);
//two.show();
//two.insert_after(21,2);
//two.insert_after(3,21);
//two.insert_after(44, 3);
//one.locate(2);
//one.show();
//one.remove(3);
//one.show();
//
} | [
"julcia106@onet.eu"
] | julcia106@onet.eu |
d42de162f724c00f2f03f6504287b0d9dabfa95e | bf20446a240d654d856dd237434b53d98bc8c62a | /xml_query_replay_status.cc | aac71edaab69c50b8424dbd81fd1fd02bc6be4f0 | [] | no_license | 2ejm/xiz-rcz | 96d32221d7dbdac8c4026a231e4268ece1110322 | f5ccf784025f1e5f67861b68b61ae61fda298c95 | refs/heads/master | 2021-03-07T12:43:32.159442 | 2020-03-10T10:08:36 | 2020-03-10T10:08:36 | 246,267,263 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 621 | cc | #include "xml_query_replay_status.h"
Glib::ustring XmlQueryReplayStatus::to_xml() const
{
Glib::ustring ret;
ret += Glib::ustring::compose("<function fid=\"%1\">\n", _fid);
auto id_iter = _ids.begin ();
auto value_iter = _values.begin ();
while (1) {
ret += Glib::ustring::compose("<parameter id=\"%1\" value=\"%2\"/>\n", *id_iter, *value_iter);
/* increment iterators
*/
id_iter ++;
value_iter ++;
/* now check, whether we are at some end
*/
if (id_iter == _ids.end ())
break;
if (value_iter == _values.end ())
break;
}
ret += "</function>\n";
return ret;
}
| [
"ljm6231@crz-tech.com"
] | ljm6231@crz-tech.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.