blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 4 201 | content_id stringlengths 40 40 | detected_licenses listlengths 0 85 | license_type stringclasses 2
values | repo_name stringlengths 7 100 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringclasses 260
values | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 11.4k 681M ⌀ | star_events_count int64 0 209k | fork_events_count int64 0 110k | gha_license_id stringclasses 17
values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 80
values | src_encoding stringclasses 28
values | language stringclasses 1
value | is_vendor bool 1
class | is_generated bool 2
classes | length_bytes int64 8 9.86M | extension stringclasses 52
values | content stringlengths 8 9.86M | authors listlengths 1 1 | author stringlengths 0 119 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
ce441ab6f65c2c6a6c2c3108e3c15dc6fa081c3f | 662a788521f1b0f6bcaaa2808b558e4e7ee9695f | /CO2_MH-Z19/co2-read_both-mh-z19.ino | 6059b8c4ca80ae1499db94bc9d8a643f8c2bc752 | [] | no_license | mkesleem/mech45X_PhotonScripts | ef6eab27677ecba15ca7e57ad9042b81a0791388 | f8ca1fc8bbc9fb82be1a6d8a21a55402a5d11391 | refs/heads/master | 2021-05-14T12:42:00.006098 | 2018-04-07T18:53:35 | 2018-04-07T18:53:35 | 116,416,086 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,095 | ino | /*
Indoor Environmental Quality Sensor - Particulate Matter Test code
Copyright (c) 2018 Michael Sleeman
UBC MECH 457, Team 26
revision 1 (charles) - added led intication in loop and completed digitalwrite protocol
*/
byte mhz19_cmd[9] = {0xFF,0x01,0x86,0x00,0x00,0x00,0x00,0x00,0x79};
char mhz19_response[9];
int i;
int j = 1;
int mhz19_ppm;
int choose_sensor = 1;
int sensor1 = A0;
int sensor2 = D3;
int led1 = D7;
void setup()
{
Serial.begin(9600);
Serial1.begin(9600);
Serial.println("MH_Z19 test");
//initialize transistor control pins
pinMode(sensor1,OUTPUT);
pinMode(sensor2,OUTPUT);
//initialize D7 pin LED control
pinMode(led1, OUTPUT);
}
int read_MHZ19_CO2()
{
Serial1.write(mhz19_cmd, 9);
memset(mhz19_response, 0, 9);
Serial1.readBytes(mhz19_response, 9);
byte crc = 0;
for (i = 1; i < 8; i++) crc+=mhz19_response[i];
crc = 255 - crc;
crc++;
if ( !(mhz19_response[0] == 0xFF && mhz19_response[1] == 0x86 && mhz19_response[8] == crc) ) {
Serial.println("CRC error: " + String(crc) + " / "+ String(mhz19_response[8]));
mhz19_ppm = -1;
}
else {
unsigned int responseHigh = (unsigned int) mhz19_response[2];
unsigned int responseLow = (unsigned int) mhz19_response[3];
mhz19_ppm = ( 256 * responseHigh ) + responseLow;
}
return mhz19_ppm;
}
//enter loop, first initialize with warm up and then alternate reading both sensors
void loop()
{
//turn on sensors to warm up for 3 minutes, leave led on to show warm up, flash when done
if(j == 1){
Serial.print("Sensor Warm Up Phase - 3min ");
digitalWrite(sensor1, HIGH);
digitalWrite(sensor2, HIGH);
digitalWrite(led1, HIGH);
delay(10000);
Serial.print("Sensor Warm Up Phase - 2min ");
delay(10000);
Serial.print("Sensor Warm Up Phase - 1min ");
delay(10000);
digitalWrite(led1,LOW);
delay(500);
digitalWrite(led1, HIGH);
delay(500);
digitalWrite(led1,LOW);
delay(500);
digitalWrite(led1, HIGH);
delay(500);
digitalWrite(led1,LOW);
digitalWrite(sensor1, LOW);
digitalWrite(sensor2, LOW);
delay(500);
j++;
}
else{
//read data from sensor 1, LED will be on while reading from sensor 1
if( choose_sensor == 1 ) {
//turn on sensor one using BJT and PWM output
digitalWrite(sensor1, HIGH);
digitalWrite(led1, HIGH);
delay(1000);
mhz19_ppm = read_MHZ19_CO2();
Serial.print("Sensor 1 CO2 PPM: ");
Serial.println(mhz19_ppm);
choose_sensor = 2;
delay(4300);
digitalWrite(led1, LOW);
digitalWrite(sensor1, LOW);
delay(200);
}
//read data from sensor 2
else {
//turn on sensor 2 using BJT and PWM output
digitalWrite(sensor2, HIGH);
delay(1000);
mhz19_ppm = read_MHZ19_CO2();
Serial.print("Sensor 2 CO2 PPM: ");
Serial.println(mhz19_ppm);
choose_sensor = 1;
delay(4300);
digitalWrite(sensor2, LOW);
delay(200);
}
}
}
| [
"michael.k.sleeman@gmail.com"
] | michael.k.sleeman@gmail.com |
eff6cbd66986b7d809bd4913ba891bace38b71d1 | b5ad65ebe6a1148716115e1faab31b5f0de1b493 | /src/NodeViewer/MainFrm.cpp | c20e56f01514317dc6c9645d234f1d7fac8dc08c | [] | no_license | gasbank/aran | 4360e3536185dcc0b364d8de84b34ae3a5f0855c | 01908cd36612379ade220cc09783bc7366c80961 | refs/heads/master | 2021-05-01T01:16:19.815088 | 2011-03-01T05:21:38 | 2011-03-01T05:21:38 | 1,051,010 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 14,541 | cpp |
// MainFrm.cpp : implementation of the CMainFrame class
//
#include "NodeViewerPCH.h"
#include "NodeViewer.h"
#include "MainFrm.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
// CMainFrame
IMPLEMENT_DYNAMIC(CMainFrame, CMDIFrameWndEx)
const int iMaxUserToolbars = 10;
const UINT uiFirstUserToolBarId = AFX_IDW_CONTROLBAR_FIRST + 40;
const UINT uiLastUserToolBarId = uiFirstUserToolBarId + iMaxUserToolbars - 1;
BEGIN_MESSAGE_MAP(CMainFrame, CMDIFrameWndEx)
ON_WM_CREATE()
ON_COMMAND(ID_WINDOW_MANAGER, &CMainFrame::OnWindowManager)
ON_COMMAND(ID_VIEW_CUSTOMIZE, &CMainFrame::OnViewCustomize)
ON_REGISTERED_MESSAGE(AFX_WM_CREATETOOLBAR, &CMainFrame::OnToolbarCreateNew)
ON_COMMAND_RANGE(ID_VIEW_APPLOOK_WIN_2000, ID_VIEW_APPLOOK_OFF_2007_AQUA, &CMainFrame::OnApplicationLook)
ON_UPDATE_COMMAND_UI_RANGE(ID_VIEW_APPLOOK_WIN_2000, ID_VIEW_APPLOOK_OFF_2007_AQUA, &CMainFrame::OnUpdateApplicationLook)
END_MESSAGE_MAP()
static UINT indicators[] =
{
ID_SEPARATOR, // status line indicator
ID_INDICATOR_CAPS,
ID_INDICATOR_NUM,
ID_INDICATOR_SCRL,
};
// CMainFrame construction/destruction
CMainFrame::CMainFrame()
{
// TODO: add member initialization code here
theApp.m_nAppLook = theApp.GetInt(_T("ApplicationLook"), ID_VIEW_APPLOOK_VS_2005);
m_wndClassView.setPropWnd(&m_wndProperties);
}
CMainFrame::~CMainFrame()
{
}
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CMDIFrameWndEx::OnCreate(lpCreateStruct) == -1)
return -1;
BOOL bNameValid;
// set the visual manager and style based on persisted value
OnApplicationLook(theApp.m_nAppLook);
CMDITabInfo mdiTabParams;
mdiTabParams.m_style = CMFCTabCtrl::STYLE_3D_ONENOTE; // other styles available...
mdiTabParams.m_bActiveTabCloseButton = TRUE; // set to FALSE to place close button at right of tab area
mdiTabParams.m_bTabIcons = FALSE; // set to TRUE to enable document icons on MDI taba
mdiTabParams.m_bAutoColor = TRUE; // set to FALSE to disable auto-coloring of MDI tabs
mdiTabParams.m_bDocumentMenu = TRUE; // enable the document menu at the right edge of the tab area
EnableMDITabbedGroups(TRUE, mdiTabParams);
if (!m_wndMenuBar.Create(this))
{
TRACE0("Failed to create menubar\n");
return -1; // fail to create
}
m_wndMenuBar.SetPaneStyle(m_wndMenuBar.GetPaneStyle() | CBRS_SIZE_DYNAMIC | CBRS_TOOLTIPS | CBRS_FLYBY);
// prevent the menu bar from taking the focus on activation
CMFCPopupMenu::SetForceMenuFocus(FALSE);
if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ||
!m_wndToolBar.LoadToolBar(theApp.m_bHiColorIcons ? IDR_MAINFRAME_256 : IDR_MAINFRAME))
{
TRACE0("Failed to create toolbar\n");
return -1; // fail to create
}
CString strToolBarName;
bNameValid = strToolBarName.LoadString(IDS_TOOLBAR_STANDARD);
ASSERT(bNameValid);
m_wndToolBar.SetWindowText(strToolBarName);
CString strCustomize;
bNameValid = strCustomize.LoadString(IDS_TOOLBAR_CUSTOMIZE);
ASSERT(bNameValid);
m_wndToolBar.EnableCustomizeButton(TRUE, ID_VIEW_CUSTOMIZE, strCustomize);
// Allow user-defined toolbars operations:
InitUserToolbars(NULL, uiFirstUserToolBarId, uiLastUserToolBarId);
if (!m_wndStatusBar.Create(this))
{
TRACE0("Failed to create status bar\n");
return -1; // fail to create
}
m_wndStatusBar.SetIndicators(indicators, sizeof(indicators)/sizeof(UINT));
// TODO: Delete these five lines if you don't want the toolbar and menubar to be dockable
m_wndMenuBar.EnableDocking(CBRS_ALIGN_ANY);
m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
EnableDocking(CBRS_ALIGN_ANY);
DockPane(&m_wndMenuBar);
DockPane(&m_wndToolBar);
// enable Visual Studio 2005 style docking window behavior
CDockingManager::SetDockingMode(DT_SMART);
// enable Visual Studio 2005 style docking window auto-hide behavior
EnableAutoHidePanes(CBRS_ALIGN_ANY);
// Load menu item image (not placed on any standard toolbars):
CMFCToolBar::AddToolBarForImageCollection(IDR_MENU_IMAGES, theApp.m_bHiColorIcons ? IDB_MENU_IMAGES_24 : 0);
// create docking windows
if (!CreateDockingWindows())
{
TRACE0("Failed to create docking windows\n");
return -1;
}
m_wndFileView.EnableDocking(CBRS_ALIGN_ANY);
m_wndClassView.EnableDocking(CBRS_ALIGN_ANY);
m_wndMaterialView.EnableDocking(CBRS_ALIGN_ANY);
DockPane(&m_wndFileView);
CDockablePane* pTabbedBar = NULL;
m_wndClassView.AttachToTabWnd(&m_wndFileView, DM_SHOW, TRUE, &pTabbedBar);
m_wndMaterialView.AttachToTabWnd(&m_wndFileView, DM_SHOW, TRUE, &pTabbedBar);
m_wndOutput.EnableDocking(CBRS_ALIGN_ANY);
DockPane(&m_wndOutput);
m_wndProperties.EnableDocking(CBRS_ALIGN_ANY);
DockPane(&m_wndProperties);
// Enable enhanced windows management dialog
EnableWindowsDialog(ID_WINDOW_MANAGER, IDS_WINDOWS_MANAGER, TRUE);
// Enable toolbar and docking window menu replacement
EnablePaneMenu(TRUE, ID_VIEW_CUSTOMIZE, strCustomize, ID_VIEW_TOOLBAR);
// enable quick (Alt+drag) toolbar customization
CMFCToolBar::EnableQuickCustomization();
if (CMFCToolBar::GetUserImages() == NULL)
{
// load user-defined toolbar images
if (m_UserImages.Load(_T(".\\UserImages.bmp")))
{
m_UserImages.SetImageSize(CSize(16, 16), FALSE);
CMFCToolBar::SetUserImages(&m_UserImages);
}
}
// enable menu personalization (most-recently used commands)
// TODO: define your own basic commands, ensuring that each pulldown menu has at least one basic command.
CList<UINT, UINT> lstBasicCommands;
lstBasicCommands.AddTail(ID_FILE_NEW);
lstBasicCommands.AddTail(ID_FILE_OPEN);
lstBasicCommands.AddTail(ID_FILE_SAVE);
lstBasicCommands.AddTail(ID_FILE_PRINT);
lstBasicCommands.AddTail(ID_APP_EXIT);
lstBasicCommands.AddTail(ID_EDIT_CUT);
lstBasicCommands.AddTail(ID_EDIT_PASTE);
lstBasicCommands.AddTail(ID_EDIT_UNDO);
lstBasicCommands.AddTail(ID_APP_ABOUT);
lstBasicCommands.AddTail(ID_VIEW_STATUS_BAR);
lstBasicCommands.AddTail(ID_VIEW_TOOLBAR);
lstBasicCommands.AddTail(ID_VIEW_APPLOOK_OFF_2003);
lstBasicCommands.AddTail(ID_VIEW_APPLOOK_VS_2005);
lstBasicCommands.AddTail(ID_VIEW_APPLOOK_OFF_2007_BLUE);
lstBasicCommands.AddTail(ID_VIEW_APPLOOK_OFF_2007_SILVER);
lstBasicCommands.AddTail(ID_VIEW_APPLOOK_OFF_2007_BLACK);
lstBasicCommands.AddTail(ID_VIEW_APPLOOK_OFF_2007_AQUA);
lstBasicCommands.AddTail(ID_SORTING_SORTALPHABETIC);
lstBasicCommands.AddTail(ID_SORTING_SORTBYTYPE);
lstBasicCommands.AddTail(ID_SORTING_SORTBYACCESS);
lstBasicCommands.AddTail(ID_SORTING_GROUPBYTYPE);
CMFCToolBar::SetBasicCommands(lstBasicCommands);
return 0;
}
BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
{
if( !CMDIFrameWndEx::PreCreateWindow(cs) )
return FALSE;
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
return TRUE;
}
BOOL CMainFrame::CreateDockingWindows()
{
BOOL bNameValid;
// Create class view
CString strClassView;
bNameValid = strClassView.LoadString(IDS_CLASS_VIEW);
ASSERT(bNameValid);
if (!m_wndClassView.Create(strClassView, this, CRect(0, 0, 200, 200), TRUE, ID_VIEW_CLASSVIEW, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | CBRS_LEFT | CBRS_FLOAT_MULTI))
{
TRACE0("Failed to create Class View window\n");
return FALSE; // failed to create
}
// Create material view
CString strMaterialView;
bNameValid = strMaterialView.LoadString(IDS_MATERIAL_VIEW);
ASSERT(bNameValid);
if (!m_wndMaterialView.Create(strMaterialView, this, CRect(0, 0, 200, 200), TRUE, ID_VIEW_MATERIALVIEW, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | CBRS_LEFT | CBRS_FLOAT_MULTI))
{
TRACE0("Failed to create Material View window\n");
return FALSE; // failed to create
}
// Create file view
CString strFileView;
bNameValid = strFileView.LoadString(IDS_FILE_VIEW);
ASSERT(bNameValid);
if (!m_wndFileView.Create(strFileView, this, CRect(0, 0, 200, 200), TRUE, ID_VIEW_FILEVIEW, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | CBRS_LEFT| CBRS_FLOAT_MULTI))
{
TRACE0("Failed to create File View window\n");
return FALSE; // failed to create
}
// Create output window
CString strOutputWnd;
bNameValid = strOutputWnd.LoadString(IDS_OUTPUT_WND);
ASSERT(bNameValid);
if (!m_wndOutput.Create(strOutputWnd, this, CRect(0, 0, 100, 100), TRUE, ID_VIEW_OUTPUTWND, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | CBRS_BOTTOM | CBRS_FLOAT_MULTI))
{
TRACE0("Failed to create Output window\n");
return FALSE; // failed to create
}
// Create properties window
CString strPropertiesWnd;
bNameValid = strPropertiesWnd.LoadString(IDS_PROPERTIES_WND);
ASSERT(bNameValid);
if (!m_wndProperties.Create(strPropertiesWnd, this, CRect(0, 0, 200, 200), TRUE, ID_VIEW_PROPERTIESWND, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | CBRS_RIGHT | CBRS_FLOAT_MULTI))
{
TRACE0("Failed to create Properties window\n");
return FALSE; // failed to create
}
SetDockingWindowIcons(theApp.m_bHiColorIcons);
return TRUE;
}
void CMainFrame::SetDockingWindowIcons(BOOL bHiColorIcons)
{
HICON hFileViewIcon = (HICON) ::LoadImage(::AfxGetResourceHandle(), MAKEINTRESOURCE(bHiColorIcons ? IDI_FILE_VIEW_HC : IDI_FILE_VIEW), IMAGE_ICON, ::GetSystemMetrics(SM_CXSMICON), ::GetSystemMetrics(SM_CYSMICON), 0);
m_wndFileView.SetIcon(hFileViewIcon, FALSE);
HICON hClassViewIcon = (HICON) ::LoadImage(::AfxGetResourceHandle(), MAKEINTRESOURCE(bHiColorIcons ? IDI_CLASS_VIEW_HC : IDI_CLASS_VIEW), IMAGE_ICON, ::GetSystemMetrics(SM_CXSMICON), ::GetSystemMetrics(SM_CYSMICON), 0);
m_wndClassView.SetIcon(hClassViewIcon, FALSE);
HICON hMaterialViewIcon = (HICON) ::LoadImage(::AfxGetResourceHandle(), MAKEINTRESOURCE(bHiColorIcons ? IDI_MATERIAL_VIEW_HC : IDI_CLASS_VIEW), IMAGE_ICON, ::GetSystemMetrics(SM_CXSMICON), ::GetSystemMetrics(SM_CYSMICON), 0);
m_wndMaterialView.SetIcon(hMaterialViewIcon, FALSE);
HICON hOutputBarIcon = (HICON) ::LoadImage(::AfxGetResourceHandle(), MAKEINTRESOURCE(bHiColorIcons ? IDI_OUTPUT_WND_HC : IDI_OUTPUT_WND), IMAGE_ICON, ::GetSystemMetrics(SM_CXSMICON), ::GetSystemMetrics(SM_CYSMICON), 0);
m_wndOutput.SetIcon(hOutputBarIcon, FALSE);
HICON hPropertiesBarIcon = (HICON) ::LoadImage(::AfxGetResourceHandle(), MAKEINTRESOURCE(bHiColorIcons ? IDI_PROPERTIES_WND_HC : IDI_PROPERTIES_WND), IMAGE_ICON, ::GetSystemMetrics(SM_CXSMICON), ::GetSystemMetrics(SM_CYSMICON), 0);
m_wndProperties.SetIcon(hPropertiesBarIcon, FALSE);
UpdateMDITabbedBarsIcons();
}
// CMainFrame diagnostics
#ifdef _DEBUG
void CMainFrame::AssertValid() const
{
CMDIFrameWndEx::AssertValid();
}
void CMainFrame::Dump(CDumpContext& dc) const
{
CMDIFrameWndEx::Dump(dc);
}
#endif //_DEBUG
// CMainFrame message handlers
void CMainFrame::OnWindowManager()
{
ShowWindowsDialog();
}
void CMainFrame::OnViewCustomize()
{
CMFCToolBarsCustomizeDialog* pDlgCust = new CMFCToolBarsCustomizeDialog(this, TRUE /* scan menus */);
pDlgCust->EnableUserDefinedToolbars();
pDlgCust->Create();
}
LRESULT CMainFrame::OnToolbarCreateNew(WPARAM wp,LPARAM lp)
{
LRESULT lres = CMDIFrameWndEx::OnToolbarCreateNew(wp,lp);
if (lres == 0)
{
return 0;
}
CMFCToolBar* pUserToolbar = (CMFCToolBar*)lres;
ASSERT_VALID(pUserToolbar);
BOOL bNameValid;
CString strCustomize;
bNameValid = strCustomize.LoadString(IDS_TOOLBAR_CUSTOMIZE);
ASSERT(bNameValid);
pUserToolbar->EnableCustomizeButton(TRUE, ID_VIEW_CUSTOMIZE, strCustomize);
return lres;
}
void CMainFrame::OnApplicationLook(UINT id)
{
CWaitCursor wait;
theApp.m_nAppLook = id;
switch (theApp.m_nAppLook)
{
case ID_VIEW_APPLOOK_WIN_2000:
CMFCVisualManager::SetDefaultManager(RUNTIME_CLASS(CMFCVisualManager));
break;
case ID_VIEW_APPLOOK_OFF_XP:
CMFCVisualManager::SetDefaultManager(RUNTIME_CLASS(CMFCVisualManagerOfficeXP));
break;
case ID_VIEW_APPLOOK_WIN_XP:
CMFCVisualManagerWindows::m_b3DTabsXPTheme = TRUE;
CMFCVisualManager::SetDefaultManager(RUNTIME_CLASS(CMFCVisualManagerWindows));
break;
case ID_VIEW_APPLOOK_OFF_2003:
CMFCVisualManager::SetDefaultManager(RUNTIME_CLASS(CMFCVisualManagerOffice2003));
CDockingManager::SetDockingMode(DT_SMART);
break;
case ID_VIEW_APPLOOK_VS_2005:
CMFCVisualManager::SetDefaultManager(RUNTIME_CLASS(CMFCVisualManagerVS2005));
CDockingManager::SetDockingMode(DT_SMART);
break;
default:
switch (theApp.m_nAppLook)
{
case ID_VIEW_APPLOOK_OFF_2007_BLUE:
CMFCVisualManagerOffice2007::SetStyle(CMFCVisualManagerOffice2007::Office2007_LunaBlue);
break;
case ID_VIEW_APPLOOK_OFF_2007_BLACK:
CMFCVisualManagerOffice2007::SetStyle(CMFCVisualManagerOffice2007::Office2007_ObsidianBlack);
break;
case ID_VIEW_APPLOOK_OFF_2007_SILVER:
CMFCVisualManagerOffice2007::SetStyle(CMFCVisualManagerOffice2007::Office2007_Silver);
break;
case ID_VIEW_APPLOOK_OFF_2007_AQUA:
CMFCVisualManagerOffice2007::SetStyle(CMFCVisualManagerOffice2007::Office2007_Aqua);
break;
}
CMFCVisualManager::SetDefaultManager(RUNTIME_CLASS(CMFCVisualManagerOffice2007));
CDockingManager::SetDockingMode(DT_SMART);
}
RedrawWindow(NULL, NULL, RDW_ALLCHILDREN | RDW_INVALIDATE | RDW_UPDATENOW | RDW_FRAME | RDW_ERASE);
theApp.WriteInt(_T("ApplicationLook"), theApp.m_nAppLook);
}
void CMainFrame::OnUpdateApplicationLook(CCmdUI* pCmdUI)
{
pCmdUI->SetRadio(theApp.m_nAppLook == pCmdUI->m_nID);
}
BOOL CMainFrame::LoadFrame(UINT nIDResource, DWORD dwDefaultStyle, CWnd* pParentWnd, CCreateContext* pContext)
{
// base class does the real work
if (!CMDIFrameWndEx::LoadFrame(nIDResource, dwDefaultStyle, pParentWnd, pContext))
{
return FALSE;
}
// enable customization button for all user toolbars
BOOL bNameValid;
CString strCustomize;
bNameValid = strCustomize.LoadString(IDS_TOOLBAR_CUSTOMIZE);
ASSERT(bNameValid);
for (int i = 0; i < iMaxUserToolbars; i ++)
{
CMFCToolBar* pUserToolbar = GetUserToolBarByIndex(i);
if (pUserToolbar != NULL)
{
pUserToolbar->EnableCustomizeButton(TRUE, ID_VIEW_CUSTOMIZE, strCustomize);
}
}
return TRUE;
}
class ArnSceneGraph;
void CMainFrame::updateSceneGraph(ArnSceneGraph* sg)
{
m_wndClassView.updateSceneGraph(sg, &m_wndOutput);
}
| [
"gasbank@gmail.com"
] | gasbank@gmail.com |
72e8078e126cc56d9abdf86c942f698a443d8e48 | db482eeec86331e1f95b66f6754548535603a0bf | /mastermind/mastermind.cpp | 35d6cbdd9ee5c6416e8e8beaa66ff0c71bc18114 | [] | no_license | miretteamin/Initiation-a-la-programmation-en-CPP_EPFL_Coursera | 86200b24962a8bdf0a90c6367f1148cf6262b7ae | 67a4816e02e6f14d3795e5f79b2cc02663a3f804 | refs/heads/master | 2023-03-04T16:40:00.099316 | 2021-02-15T22:14:26 | 2021-02-15T22:14:26 | 316,816,399 | 1 | 0 | null | null | null | null | ISO-8859-1 | C++ | false | false | 5,297 | cpp | #include <iostream>
#include <ctime>
// pour les nombres aléatoires
#include <random>
#include <cstring> // strlen
using namespace std;
// ======================================================================
// Couleur au hasard
std::uniform_int_distribution<int> distribution;
std::default_random_engine generateur(time(NULL)); /* NOT using std::random_device since not
* all compilers seems to support it :-( */
char tirer_couleur()
{
static const char* const couleurs = ".RGBCYM";
static const int nb = strlen(couleurs) - 1;
return couleurs[distribution(generateur,
std::uniform_int_distribution<int>::param_type{ 0, nb })];
}
// ======================================================================
char poser_question()
{
char lu(' ');
cout << "Entrez une couleur : ";
cin >> lu;
return lu;
}
// ---- prototype -------------------------------------------------------
bool couleur_valide(char c);
// ======================================================================
char lire_couleur()
{
char lu(poser_question());
while (not couleur_valide(lu)) {
cout << "'" << lu << "' n'est pas une couleur valide." << endl;
cout << "Les couleurs possibles sont : ., R, G, B, C, Y ou M." << endl;
lu = poser_question();
}
return lu;
}
// ======================================================================
void afficher_couleurs(char c1, char c2, char c3, char c4)
{
cout << ' ' << c1 << ' ' << c2 << ' ' << c3 << ' ' << c4;
}
// ======================================================================
void afficher(int nb, char c)
{
while (nb-- > 0) {
cout << c;
}
}
// ---- prototype -------------------------------------------------------
void afficher_reponses(char c1, char c2, char c3, char c4,
char r1, char r2, char r3, char r4);
// ======================================================================
void afficher_coup(char c1, char c2, char c3, char c4,
char r1, char r2, char r3, char r4)
{
afficher_couleurs(c1, c2, c3, c4);
cout << " : ";
afficher_reponses(c1, c2, c3, c4,
r1, r2, r3, r4);
cout << endl;
}
// ======================================================================
void message_gagne(int nb_coups)
{
cout << "Bravo ! Vous avez trouvé en " << nb_coups << " coups." << endl;
}
// ======================================================================
void message_perdu(char c1, char c2, char c3, char c4)
{
cout << "Perdu :-(" << endl;
cout << "La bonne combinaison était : ";
afficher_couleurs(c1, c2, c3, c4);
cout << endl;
}
/*****************************************************
* Compléter le code à partir d'ici
*****************************************************/
// ======================================================================
bool couleur_valide(char c)
{
if (c == '.' or c == 'R' or c == 'G' or c == 'B' or c == 'C' or c == 'Y' or c == 'M')
{
return true;
}
else return false;
}
// ======================================================================
bool verifier(char c1, char& c2, int& score
)
{
if (c1 == c2)
{
++score;
c2 = 'x';
return true;
}
else return false;
}
// ======================================================================
void apparier(char couleurpropose, char& c1, char& c2, char& c3, int& score
)
{
if (verifier(couleurpropose, c1, score) == false)
{
if (verifier(couleurpropose, c2, score) == false)
{
verifier(couleurpropose, c3, score);
}
}
}
// ======================================================================
void afficher_reponses(char c1, char c2, char c3, char c4,
char r1, char r2, char r3, char r4)
{
int correcte(0), semicorrecte(0), faux(0);
if (c1 == r1)
{
++correcte;
r1 = 'x';
}
if (c2 == r2)
{
++correcte;
r2 = 'x';
}
if (c3 == r3)
{
++correcte;
r3 = 'x';
}
if (c4 == r4)
{
++correcte;
r4 = 'x';
}
if (r1 != 'x')
{
apparier(c1, r2, r3, r4, semicorrecte);
}
if (r2 != 'x')
{
apparier(c2, r1, r3, r4, semicorrecte);
}
if (r3 != 'x')
{
apparier(c3, r1, r2, r4, semicorrecte);
}
if (r4 != 'x')
{
apparier(c4, r1, r2, r3, semicorrecte);
}
faux = 4 - correcte - semicorrecte;
afficher(correcte, '#');
afficher(semicorrecte, '+');
afficher(faux, '-');
}
// ======================================================================
bool gagne(char c1, char c2, char c3, char c4,
char r1, char r2, char r3, char r4)
{
if (c1 == r1 && c2 == r2 && c3 == r3 && c4 == r4) return true;
else return false;
}
// ======================================================================
void jouer(int maxcoup = 8
)
{
char ci1(tirer_couleur());
char ci2(tirer_couleur());
char ci3(tirer_couleur());
char ci4(tirer_couleur());
char c1('l');
char c2('l');
char c3('l');
char c4('l');
int nbcoup(0);
do
{
c1 = lire_couleur();
c2 = lire_couleur();
c3 = lire_couleur();
c4 = lire_couleur();
afficher_coup(c1, c2, c3, c4, ci1, ci2, ci3, ci4);
++nbcoup;
} while (!gagne(c1, c2, c3, c4, ci1, ci2, ci3, ci4) && nbcoup < maxcoup);
if (gagne(c1, c2, c3, c4, ci1, ci2, ci3, ci4))
{
message_gagne(nbcoup);
}
else
{
message_perdu(ci1, ci2, ci3, ci4);
}
}
/*******************************************
* Ne rien modifier après cette ligne.
*******************************************/
int main()
{
jouer();
return 0;
}
| [
"miretteamin@gmail.com"
] | miretteamin@gmail.com |
d7e50482248f00f1362808dfac74b5f2a946a038 | 438ea4bfd72727bc5d49937719222858888b53f4 | /location.h | 674c7a86a1e34e8e7903cc085c1957105218fdac | [] | no_license | sumoonx/apollo_ui | 63ed52c99f45ce31ed01a43ac6fa57de08dd7efc | 02170af315b0455b2d87d6018d5fed327a8a5699 | refs/heads/master | 2021-06-03T05:28:47.683591 | 2016-09-13T05:17:48 | 2016-09-13T05:17:48 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 368 | h | #ifndef LOCATION_H
#define LOCATION_H
#include <QPointF>
#include <QString>
class Location
{
public:
Location();
Location(QPointF x_y, qreal z);
Location(qreal x, qreal y, qreal z);
qreal x();
qreal y();
qreal z();
QPointF point();
QString toString();
private:
qreal m_x;
qreal m_y;
qreal m_z;
};
#endif // LOCATION_H
| [
"694726071@qq.com"
] | 694726071@qq.com |
64d866ea504208f80aea7819ec9a39eac66e4ba8 | 3e6b964b01712da4594492df460e3b515184ffec | /Source/WJT/WJTMannequin.h | 94cf7bbc437ebfaa11bd4e7ea1ee65396e281f54 | [] | no_license | BeHindDark/UnrealUploadTest | f32f858b4f5c308df741875b35ac02ba18bd6b59 | 357a29a7ed5b964a81dbbcce5669b142af5543c5 | refs/heads/master | 2022-04-07T12:31:07.747519 | 2020-03-03T12:49:29 | 2020-03-03T12:49:29 | 230,237,076 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 655 | h | // Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "GameFramework/Pawn.h"
#include "WJTMannequin.generated.h"
UCLASS()
class WJT_API AWJTMannequin : public APawn
{
GENERATED_BODY()
public:
// Sets default values for this pawn's properties
AWJTMannequin();
protected:
// Called when the game starts or when spawned
virtual void BeginPlay() override;
public:
// Called every frame
virtual void Tick(float DeltaTime) override;
// Called to bind functionality to input
virtual void SetupPlayerInputComponent(class UInputComponent* PlayerInputComponent) override;
};
| [
"wongt8969@gmail.com"
] | wongt8969@gmail.com |
5b55c74226c4c1371e8cb9e119516b28895b9d47 | 032eb05d94fde2719fa049ab86f9edb7c7bd664a | /zigzag.cpp | 930b0028238749ff868b57ed23a75cf19775ce73 | [] | no_license | king1991wbs/leetcode | 0354ea489cfc297cec5ee84b851c188e44689361 | fd312c1ed9d8271dfa2cc980d02b504a86becb50 | refs/heads/master | 2021-01-13T02:27:14.907609 | 2015-10-07T15:01:21 | 2015-10-07T15:01:21 | 18,264,337 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 957 | cpp | #include <iostream>
#include <string>
using namespace std;
class Solution {
public:
string convert(string s, int nRows) {
if(s.size() <= 2)
return s;
if( nRows <= 1 )
return s;
//char **c = new char *[nRows];
string c[nRows];
int k = 0;
for(int j = 0; k < s.size(); j++){
if( j & 0x1 ){//odd
for( int i = nRows - 2; i > 0 ; i-- ){
c[i] += s[k++];
if(k >= s.size())
break;
}
}else{
for( int i = 0; i < nRows; i++){
c[i] += s[k++];
if(k >= s.size())
break;
}
}
}
k = 0;
s = "";
for(int i = 0; i < nRows; i++){
s += c[i];
}
return s;
}
};
int main(){
Solution sol;
string str("PAHNAPLSIIGYIR");
//str[0] = 'A';
cout << str << endl;
str = sol.convert(str, 2);
cout << str << endl;
return 0;
} | [
"king1991wbs@gmail.com"
] | king1991wbs@gmail.com |
fdf764d2fe26b8f0e08f68bc3334b3cf89009a11 | eacdef274a760c5953a62c21f307507212624e51 | /HexMap/HexCell.h | 1fb3af169acc8907801c9859e993419feeef1651 | [] | no_license | ninsun/HexMap | d9797c54b7a2365179c35666979a79f85784603a | 0ccb7c92db77592fcc85704caa0301f621385da3 | refs/heads/master | 2022-12-30T18:23:13.864644 | 2020-10-23T09:21:39 | 2020-10-23T09:21:39 | 306,240,660 | 0 | 0 | null | null | null | null | GB18030 | C++ | false | false | 1,949 | h | #pragma once
#include <QMap>
#include <QVariant>
class HexGrid;
class HexCell
{
public:
enum DirctionType
{
DirectionH, // 横向表示横向可排列为直线
DirectionV // 纵向表示纵向可排列为直线
};
enum Direction
{
UpLeft, // 横向方位
UpRight, // 横向方位
Right, // 横向方位
DownRight, // 横向方位
DownLeft, // 横向方位
Left, // 横向方位
Up, // 纵向方位
RightUp, // 纵向方位
RightDown, // 纵向方位
Down, // 纵向方位
LeftDown, // 纵向方位
LeftUp, // 纵向方位
};
enum DataRole
{
TypeRole, // 类型
TextRole, // 文字
FrontgroundRole, // 前景
BackgroundRole, // 背景
BorderRole, // 边框
UserRole = 1000,
};
enum TypeRole
{
Reachable,
Unreachable,
};
public:
HexCell(HexGrid *grid, int x = 0, int y = 0, DirctionType type = DirectionH);
~HexCell();
public:
HexGrid *grid() { return m_grid; }
int x() { return m_x; }
int y() { return m_y; }
std::tuple<int, int, int> cube();
DirctionType type() { return m_type; }
const QVariant &data(int role) const { return m_data[role]; }
void setData(int role, const QVariant &data) { m_data[role] = data; }
const QMap<int, QVariant> &allData() const { return m_data; }
void setAllData(const QMap<int, QVariant> &data) { m_data = data; }
public:
HexCell *neighborCell(Direction dir);
QList<HexCell *> neighborCells();
bool isNeighborCell(HexCell *cell);
int distanceTo(HexCell *cell);
QList<HexCell *> pathTo(HexCell *cell);
private:
HexGrid *m_grid = nullptr;
int m_x = 0;
int m_y = 0;
DirctionType m_type = DirectionH;
QMap<int, QVariant> m_data;
}; | [
"zhengxu@jiean.net"
] | zhengxu@jiean.net |
d2f359c4472d8bf3afea5f406c730d4fb6fadd5d | 4b934404636e5d029c3ebf76383a9a852b97b61e | /CloudLive/CloudLive/1.0/IExeAgent.cpp | 1f76416f8c14137532deb8db990b11b80fdf5094 | [] | no_license | wwllww/CloudLive | 39090760f9a99592e8e268b72f1b741cba815250 | 666aac5ee3b419ff42e9478ea69155ec53ae5f4e | refs/heads/master | 2020-03-27T06:55:16.850049 | 2018-08-26T03:16:00 | 2018-08-26T03:16:00 | 146,146,890 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 353 | cpp | #include "BaseAfx.h"
#include "IExeAgent.h"
#include <string>
#ifndef NULL
#define NULL 0
#endif
IAgent * IExeAgent::G_LibManage = NULL;
IAgent * QueryInterface()
{
return IExeAgent::G_LibManage;
}
IExeAgent::IExeAgent()
{
G_LibManage = this;
}
IExeAgent::~IExeAgent()
{
}
void IExeAgent::SetName(const char *Name)
{
m_Name = Name;
}
| [
"393520798@qq.com"
] | 393520798@qq.com |
3a2b393855664a6491409c064d49563fb5bcad9c | 048e663747dde8e93b23a8c205ee0697c7bf6b35 | /include/CCommandSrc.h | 6a27537c4840d6f576dbc2484d4e6e2705245517 | [
"MIT"
] | permissive | colinw7/CCommand | af7a28cbdc47b1893d8b77aea5598b36ca270860 | 341122870d01bbb9f95d68ae16c1d6a2082301fc | refs/heads/master | 2023-01-24T13:29:21.898688 | 2023-01-16T14:42:05 | 2023-01-16T14:42:05 | 12,828,781 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 589 | h | #ifndef CCommandSrc_H
#define CCommandSrc_H
#include <string>
#include <cstdio>
class CCommand;
class CCommandSrc {
public:
CCommandSrc(CCommand *command);
CCommandSrc(CCommand *command, FILE *fp);
virtual ~CCommandSrc();
CCommand *getCommand() const { return command_; }
virtual void initParent() = 0;
virtual void initChild() = 0;
virtual void term() = 0;
virtual void process() { }
protected:
void throwError(const std::string &msg);
protected:
CCommand *command_ { nullptr };
int fd_ { -1 };
int save_stdin_ { -1 };
};
#endif
| [
"colinw@nc.rr.com"
] | colinw@nc.rr.com |
5a1303e978ccee23c249a67bd8ffa1ab2d23c246 | 0d0233c38d632a8baa5b1447ad151043eb8ab822 | /sortirovka_4_dodelat.cpp | 45d97f8e43c6862b080b32326a0c4ae4b5bf303d | [] | no_license | chegainthegithub/HW | 9480fc3d2c95368d7a99315a56421b46b25b49b4 | 24599853e65b731c9952a96a9344035ff4b493db | refs/heads/master | 2021-01-02T09:20:06.730020 | 2015-05-12T12:32:41 | 2015-05-12T12:32:41 | 26,775,793 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,095 | cpp | #include <iostream>
#include <cmath>
using namespace std;
int main()
{
int m[16];
for (int i = 0; i < 16; i++)
{
m[i] = rand() % 100;
cout << m[i] << " ";
}
cout << endl;
int d = 8;
for (int i = 8; i < 16; i++)
if (m[i] < m[i - d])
swap(m[i], m[i - d]);
for (int i = 0; i < 16; i++)
{
cout << m[i] << " ";
}
cout << endl;
d = d / 2;
for (int i = 4; i < 8; i++)
{
for (int j = i; j < 16; j = j + d)
{
while (m[j] < m[j - d])
{
swap(m[j], m[j - d]);
j = j - d;
}
}
}
for (int i = 0; i < 16; i++)
{
cout << m[i] << " ";
}
cout << endl;
d = d / 2;
for (int i = 2; i < 4; i++)
{
for (int j = i; j < 16; j = j + d)
{
while (m[j] < m[j - d])
{
swap(m[j], m[j - d]);
j = j - d;
}
}
}
for (int i = 0; i < 16; i++)
{
cout << m[i] << " ";
}
cout << endl;
d = d / 2;
for (int i = 1; i < 2; i++)
{
for (int j = i; j < 16; j = j + d)
{
while (m[j] < m[j - d])
{
swap(m[j], m[j - d]);
j = j - d;
}
}
}
for (int i = 0; i < 16; i++)
{
cout << m[i] << " ";
}
cout << endl;
return 0;
} | [
"chegevara.4151@gmail.com"
] | chegevara.4151@gmail.com |
9864c1207fedb135229a3c4d3e4c7b190fdbf3a2 | 6aeacd5df9fb70a04fa459e782bb3bfa773f6d01 | /RiskVS2010/Battle.h | f50de38c276de3d0879961d06b71790ab8be5197 | [] | no_license | marieparizeau/RiskVS2010 | c0fcff2c6a39923a79034714adcaee0efd178965 | 642fed1bf3b2c23b8d1bdc3123b13512d3a8034b | refs/heads/master | 2021-01-10T07:13:22.916320 | 2015-11-08T19:20:27 | 2015-11-08T19:20:27 | 45,794,814 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 780 | h | #pragma once
#include "BattlingEntity.h"
#include "MapIni.h"
#include "Country.h"
#include "Player.h"
#include <vector>
#include <iostream>
#include <string>
class Battle
{
public:
Battle();
Battle(vector<Player*> playersList);
~Battle();
void performAttack(Player &player, MapIni* map);
private:
BattlingEntity attacker;
BattlingEntity defender;
vector<Player*> players;
BattlingEntity getAttacker();
void setAttacker(BattlingEntity value);
BattlingEntity getDefender();
void setDefender(BattlingEntity value);
void attack(Country* attackingCountry, Country* defendingCountry);
Player* getPlayer(string name);
void executeBattle(BattlingEntity attacker, BattlingEntity defender);
void captureCountry(BattlingEntity attacker, BattlingEntity defender);
}; | [
"marie.parizeau@gmail.com"
] | marie.parizeau@gmail.com |
df89cd0aa19fffed869dd4c8c487219ef840d765 | b49d5d4b12b73f49a4a59eab85289451b745b6b9 | /c++/LongestCommonPrefix.cpp | c936fdf76f15bd7f5aec6c74afcc33b9631a650e | [] | no_license | Strideradu/leetcode | 575441378614a763809171d98e3a9a73b3367dfa | 5e9d8d998973e02f2914d9bfc5837f1734867eaf | refs/heads/master | 2020-06-04T19:12:26.160384 | 2019-03-17T05:00:42 | 2019-03-17T05:00:42 | 37,504,577 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,007 | cpp | class Solution
{
public:
string longestCommonPrefix(vector<string> &strs)
{
if (strs.size() == 0)
{
string prefix = "";
return prefix;
}
return longestPrefix(strs, 0, strs.size() - 1);
}
private:
string longestPrefix(vector<string> &strs, int l, int r)
{
if (l == r)
{
return strs[l];
}
else
{
int mid = (l + r) / 2;
string lcpLeft = longestPrefix(strs, l, mid);
string lcpRight = longestPrefix(strs, mid + 1, r);
return commonPrefix(lcpLeft, lcpRight);
}
}
string commonPrefix(string lcpLeft, string lcpRight)
{
int min_size = min(lcpLeft.size(), lcpRight.size());
for (int i = 0; i < min_size; i++)
{
if (lcpLeft[i] != lcpRight[i])
{
return lcpLeft.substr(0, i);
}
}
return lcpLeft.substr(0, min_size);
}
}; | [
"Strideradu@users.noreply.github.com"
] | Strideradu@users.noreply.github.com |
46d04659cbcad15a99eeaf27a70e523fa693e6fe | 8de2b74ec67494a917e25f7fd93ce707b2cebca9 | /Library/include/Diagnostics.h | 86175037b0d3479b12658b6ef57657b7e34cdb9e | [
"BSD-2-Clause"
] | permissive | dwhobrey/MindCausalModellingLibrary | fffa5db6420bc66446f8989e172997f2f641bc32 | 797d716e785d2dcd5c373ab385c20d3a74bbfcb0 | refs/heads/master | 2021-01-10T12:25:04.194940 | 2020-02-10T07:01:03 | 2020-02-10T07:01:03 | 49,404,942 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,522 | h | #pragma once
namespace Plato {
/// <summary>
/// Holds details on a class that can perform diagnostics.
/// </summary>
class DiagnosticsCatalogueEntry {
public:
/// <summary>
/// The static class method called to perform diagnostics on class.
/// </summary>
/// <param name="message">Result of test.</param>
/// <returns>Returns the number of failures, i.e. zero on success.</returns>
typedef int (*ConductUnitTestDelegate)(string& message);
/// <summary>
/// Name of class that can perform diagnostics.
/// </summary>
const string& mClassName;
/// <summary>
/// The static unit test method for the class.
/// </summary>
ConductUnitTestDelegate mUnitTestDelegate;
/// <summary>
/// Constructs a new entry for the Diagnostics Catalogue.
/// </summary>
/// <param name="className">Name of class that can perform diagnostics.</param>
/// <param name="unitTestDelegate">The static unit test method for the class.</param>
DiagnosticsCatalogueEntry(const string& className, ConductUnitTestDelegate unitTestDelegate);
};
/// <summary>
/// Runs diagnostics on the Library.
/// </summary>
class Diagnostics {
public:
/// <summary>
/// Conduct diagnostics on the library.
/// </summary>
/// <returns>Returns 0 if ok, otherwise error code.</returns>
static int ConductTests();
};
}
| [
"dwhobrey@outlook.com"
] | dwhobrey@outlook.com |
baa83136b4e57eab5ff91d466ee8854732e2683f | 4119e081db3ab9349c576743f7411dab80957306 | /src/levels_manager.cpp | 08c8cb7ec532d3988f88d4565ba380a55c400574 | [
"LicenseRef-scancode-public-domain",
"CC-BY-3.0"
] | permissive | sysfce2/SFML_Arcanoid | c108fd6621324cc0c203030e3269b673b9026210 | 6e19732d1c9e4549b6bfa4833afaf236ecf8f3a3 | refs/heads/master | 2023-07-17T15:23:41.748217 | 2021-08-29T16:15:04 | 2021-08-29T16:15:04 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,495 | cpp | //
// Created by kszap on 29.09.2020.
//
#include <fstream>
#include "block.hpp"
#include "levels_manager.hpp"
LevelsManager::LevelsManager(AssetsManager& assets)
:assets(assets)
{
std::ifstream levels_input;
levels_input.open("..\\assets\\levels.dat", std::ios::in);
if (!levels_input.is_open())
{
std::cerr << R"(Cannot read "..\\assets\\levels.dat" data. Is level data file missing?)"
<< std::endl;
exit(EXIT_FAILURE);
}
else
{
std::string level;
std::string line_buffer;
while (!levels_input.eof())
{
std::getline(levels_input, line_buffer);
if (line_buffer.at(0) != '#')
{
level += line_buffer;
}
else
{
if (!level.empty())
{
levels_data.emplace_back(level);
level.clear();
}
}
}
levels_input.close();
}
}
void LevelsManager::loadLevel(const unsigned int level_index)
{
block_color_matters = (level_index == 0);
blocks.clear();
blocks.reserve(80);
float pos_x{ Block::width / 2 }, pos_y{ 2 * Block::height };
for (std::size_t count_for_newline{};
const char ch : levels_data.at(level_index))
{
if (ch != '.')
{
blocks.emplace_back(std::make_unique<Block>(assets,
color_mapping.at(ch), pos_x, pos_y));
}
++count_for_newline;
if (count_for_newline == 10)
{
pos_x = Block::width / 2;
pos_y += Block::height;
count_for_newline = 0;
}
else
{
pos_x += Block::width;
}
}
}
std::size_t LevelsManager::levelsAmount() const
{
return levels_data.size();
}
| [
"kszapsza@gmail.com"
] | kszapsza@gmail.com |
e9f56d7e5fc20ebfa1f7f5ba9f4756c2a2888377 | 90895261e08d3b50e10dfc7eeb37484bb7851c60 | /userActionAnalysis/userAction/baseUserAction/baseUserAction.h | eea272f7ba116097b01b9be2376e8b98819319cd | [] | no_license | qreal/tools | 8286c4cce3c6dc9c7d9daec79504dc489c33f5ae | e9df29b7b4d199e2fd296272352c133c2db9c510 | refs/heads/master | 2021-01-19T02:42:56.589267 | 2017-11-17T10:27:24 | 2017-11-17T10:27:24 | 1,831,652 | 1 | 4 | null | 2014-10-31T11:03:13 | 2011-06-01T12:53:14 | C++ | UTF-8 | C++ | false | false | 750 | h | #pragma once
#include <QtCore/QMap>
#include <QtCore/QStringList>
#include "userAction/userAction.h"
class BaseUserAction : public UserAction
{
public:
BaseUserAction(QString const &name, QMap<QString, QStringList> const &properties);
~BaseUserAction();
QMap<QString, QStringList> actionProperties() const;
QMap<QString, QString> customActionProperties() const;
void setUserActionProperty(QString const &propertyName, QString const &propertyValue);
QString const actionToString();
QString const actionToRegExpString();
bool compare(BaseUserAction *otherBaseUserAction);
BaseUserAction* unite(BaseUserAction *otherBaseUserAction);
private:
QMap<QString, QStringList> mProperties;
QMap<QString, QString> mCustomProperties;
};
| [
"kuzenkovanastya@gmail.com"
] | kuzenkovanastya@gmail.com |
47f649291db8c60f0b92bef77d15ff6c1102a269 | e405dc2eb0eda911be6b0e06511b5cd07ffcd0f7 | /Cookie Dungeon/mage.cpp | aad8b697213f1be7f5a82c7b21c22c170df3e088 | [] | no_license | NubHawk/cookieDungeon | 77903de0fa4c6e6c23db31e466676e6046096cd2 | 49109f9cd4985451aba41e619f5aa8c34efd6571 | refs/heads/master | 2020-06-22T02:29:23.860072 | 2016-11-25T17:03:24 | 2016-11-25T17:03:24 | 74,761,674 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 754 | cpp | #include "mage.h"
#include "fireball.h"
#include "level.h"
Mage::Mage(Level *l, DrawEngine *de, int s_index, float x, float y, int lives, char spell_key,
char up_key, char down_key, char left_key, char right_key)
: Character(l, de, s_index, x, y, lives, up_key, down_key, left_key, right_key)
{
spellKey = spell_key;
classID = MAGE_CLASSID;
}
bool Mage::keyPress(char c)
{
bool val = Character::keyPress(c);
if (val == false)
{
if (c == spellKey)
{
castSpell();
return true;
}
}
return val;
}
void Mage::castSpell(void)
{
Fireball *temp = new Fireball(level, drawArea, SPRITE_FIREBALL,
(int)pos.x + facingDirection.x, (int)pos.y + facingDirection.y,
facingDirection.x, facingDirection.y);
level->addNPC((Sprite *)temp);
} | [
"sudeeptinku@ymail.com"
] | sudeeptinku@ymail.com |
92305826032576bed564ba2aeeba65eed1521bd0 | 977b0af7c437ad02c659a9a63566a54c29bce45a | /generic/sample.cpp | f79add4ee235df285952221bbfa238aa6be95ae3 | [
"MIT",
"TCL"
] | permissive | auriocus/sampleextension-cpp | 1ddb20f95c2733988031a93cea207e95de3df646 | e4f8627cda3a4901ccdc827b04471d0acc908330 | refs/heads/main | 2023-06-18T08:27:32.770128 | 2021-07-20T08:37:16 | 2021-07-20T08:37:16 | 382,005,591 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 399 | cpp | #include "sample.hpp"
Animal::Animal(std::string type, int age) :
type(type), age(age)
{
if (age < 0) {
throw std::runtime_error("Age cannot be negative!");
}
}
int Animal::birthday() {
return ++age;
}
std::string Animal::describe() {
std::ostringstream description;
description << "I am a "<<type<<" and I am "<<age<<" years old";
return description.str();
}
| [
"auriocus@gmx.de"
] | auriocus@gmx.de |
582821baeecbc266b32b62d4d8c6659b0edebc8a | c362e769a0452ceb9c82293e2147b972b31e8dd3 | /DP/1196:踩方格.cpp | 70a70ace8b95080980ba2b6a00daeaa16c61f38f | [] | no_license | FingerBlack/-ACM-CODE | 2c609253281cd85c5b26dc4bb198da11457a6bc2 | 5065c492b712be707c9df7d7ca17c5e88d5d7f2b | refs/heads/master | 2020-04-07T12:26:24.599291 | 2019-03-08T07:00:07 | 2019-03-08T07:00:07 | 158,367,991 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 875 | cpp | #include<iostream>
#include<string>
using namespace std;
#define local
typedef long long ll;
const int N=100;
int f[N][N]={0};
int n,sum=0;
int cx,cy;
int point[8][2];
void dfs(int x,int y,int level){
/*for(int i=0;i<100;i++){
for(int j=0;j<100;j++){
if(f[i][j]){
cout<<f[i][j]<<" ";
}
}
cout<<endl;
}*/
if(level==n){
sum++;
return;
}
if(f[x-1][y]==false){
f[x-1][y]=true;
dfs(x-1,y,level+1);
f[x-1][y]=false;
}
if(f[x][y-1]==false){
f[x][y-1]=true;
dfs(x,y-1,level+1);
f[x][y-1]=false;
}
if(f[x][y+1]==false){
f[x][y+1]=true;
dfs(x,y+1,level+1);
f[x][y+1]=false;
}
}
int main()
{
#ifdef local
freopen("/Users/chenjishuang/Documents/GitHub/-ACM-CODE/in","r",stdin);
freopen("/Users/chenjishuang/Documents/GitHub/-ACM-CODE/out","wt+",stdout);
#endif
cin>>n;
//n--;
f[50][50]=1;
dfs(50,50,0);
cout<<sum<<endl;
return 0;
}
| [
"1025982121@qq.com"
] | 1025982121@qq.com |
7114fa91a8695c2de0b9f9d9c5597f639c73e9e3 | bb5abc8ce773bc92a5c76f2e92d30ef91530d139 | /ResponseBuilder.cpp | d2692e5ec94be54834b99570b463555f554b94d2 | [] | no_license | brumik/ISA_LDAP_Server | c1bfd88e824f3f9150201014da506084b6cb6830 | f62aac0169bedbf5b0cafd71e00708196e3624dd | refs/heads/master | 2021-03-16T05:17:08.317523 | 2017-12-04T10:05:01 | 2017-12-04T10:05:01 | 107,896,911 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,316 | cpp | //
// Created by levente on 11/6/17.
//
#include <iostream>
#include "ResponseBuilder.h"
using namespace std;
ResponseBuilder::ResponseBuilder(Database &database)
{
matchedDN = "";
db = database;
}
LDAPResult_t ResponseBuilder::create_result(Error &error)
{
LDAPResult_t result;
result.ResultCode = error.get_code();
result.ErrorMessage = error.get_message();
result.MatchedDN = matchedDN;
return result;
}
Database ResponseBuilder::request_filter_substring(const Substrings_t &substrings)
{
string init, end;
vector<string> any;
// Build search strings and vectors.
for ( auto &item : substrings.items )
if ( item.Type == Substring_Item_Type_e::Initial )
init = item.data;
else if ( item.Type == Substring_Item_Type_e::Any )
any.push_back(item.data);
else if ( item.Type == Substring_Item_Type_e::Final )
end = item.data;
else throw runtime_error("ResponseBuilder: Invalid Substring Item Type.");
if ( substrings.Type == Database::Type_CN )
return db.filter_by_cn_substrings(init, any, end);
else if ( substrings.Type == Database::Type_UID )
return db.filter_by_uid_substrings(init, any, end);
else if ( substrings.Type == Database::Type_MAIL )
return db.filter_by_mail_substrings(init, any, end);
else throw runtime_error("Response Builder: EqualityMatch containing non existing attribute.");
}
Database ResponseBuilder::request_filter_equality(const AttributeValueAssertion_t &equality)
{
if ( equality.AttributeDesc == Database::Type_CN )
return db.filter_by_exact_cn(equality.AssertionValue);
else if ( equality.AttributeDesc == Database::Type_UID )
return db.filter_by_exact_uid(equality.AssertionValue);
else if ( equality.AttributeDesc == Database::Type_MAIL )
return db.filter_by_exact_mail(equality.AssertionValue);
else throw runtime_error("Response Builder: EqualityMatch containing non existing attribute.");
}
Database ResponseBuilder::request_filter(const Filter_t &filter)
{
if ( filter.Type == FilterType_e::EqualityMatch ) {
return request_filter_equality(filter.EqualityMatch);
} else if ( filter.Type == FilterType_e::Substrings ) {
return request_filter_substring(filter.Substrings);
} else if ( filter.Type == FilterType_e::And ) {
Database temp = db;
for ( const Filter_t &f : filter.And)
temp = temp.filter_and( request_filter(f) );
return temp;
} else if ( filter.Type == FilterType_e::Or ) {
Database temp;
for ( const Filter_t &f : filter.Or)
temp = temp.filter_or( request_filter(f) );
return temp;
} else if ( filter.Type == FilterType_e::Not ) {
return db.filter_not( request_filter( filter.Not.at(0) ) );
} else throw runtime_error("Filter type not supported.");
}
vector<LDAPMessage_t> ResponseBuilder::generate_entries_response(const LDAPMessage_t &request)
{
vector<LDAPMessage_t> messages;
Database entries = request_filter(request.SearchRequest.Filter);
for ( auto entry : entries.get_entries() ) {
// Create message for the entry
LDAPMessage_t message;
message.MessageID = request.MessageID;
message.MessageType = LDAPMessageType_t::SearchResultEntry;
// Set ObjectName
PartialAttributeList_t attr;
message.SearchResultEntry.ObjectName = entry.uid;
// Fill with MAIL
attr.Type = Database::Type_CN;
attr.Values.emplace_back(entry.cn);
message.SearchResultEntry.Attributes.push_back(attr);
attr.Values.clear();
// Fill with MAIL
attr.Type = Database::Type_MAIL;
attr.Values.emplace_back(entry.mail);
message.SearchResultEntry.Attributes.push_back(attr);
// Save message
messages.push_back(message);
if ( request.SearchRequest.SizeLimit != 0)
if ( messages.size() >= request.SearchRequest.SizeLimit )
break;
}
return messages;
}
LDAPMessage_t ResponseBuilder::generate_response(const LDAPMessage_t &request, Error error)
{
LDAPMessage_t message;
message.MessageID = request.MessageID;
// Here we wont check if ID us already used because we already sending error back.
if ( request.MessageType == LDAPMessageType_t::BindRequest ) {
message.MessageType = LDAPMessageType_t::BindResponse;
} else if ( request.MessageType == LDAPMessageType_t::SearchRequest ) {
message.MessageType = LDAPMessageType_t::SearchResultDone;
}
message.LDAPResult = create_result(error);
return message;
}
| [
"levente.berky@gmail.com"
] | levente.berky@gmail.com |
15be6b29d53cd09b929ee192448c177008e39892 | b4e2870e505b3a576115fa9318aabfb971535aef | /zParserExtender/ZenGin/Gothic_I_Classic/API/zArchiver2.h | 5883456a04c9cfe521f7217342dd61faff29cb4f | [] | no_license | Gratt-5r2/zParserExtender | 4289ba2e71748bbac0c929dd1941d151cdde46ff | ecf51966e4d8b4dc27e3bfaff06848fab69ec9f1 | refs/heads/master | 2023-01-07T07:35:15.720162 | 2022-10-08T15:58:41 | 2022-10-08T15:58:41 | 208,900,373 | 6 | 1 | null | 2023-01-02T21:53:03 | 2019-09-16T21:21:28 | C++ | UTF-8 | C++ | false | false | 13,625 | h | // Supported with union (c) 2018 Union team
#ifndef __ZARCHIVER2_H__VER0__
#define __ZARCHIVER2_H__VER0__
namespace Gothic_I_Classic {
const int READ_BUFFER_SIZE = 1024*8;
enum zTArchiveTypeID {
zARC2_ID_STRING = 1,
zARC2_ID_INTEGER,
zARC2_ID_FLOAT,
zARC2_ID_HASH = 18,
zARC2_ID_BYTE = 4,
zARC2_ID_WORD,
zARC2_ID_int,
zARC2_ID_VEC3,
zARC2_ID_COLOR,
zARC2_ID_RAW,
zARC2_ID_RAWFLOAT = 16,
zARC2_ID_ENUM
};
class zCArchiverBinSafe : public zCArchiver {
public:
zCLASS_DECLARATION( zCArchiverBinSafe )
zFILE* file;
zCBuffer* cbuffer;
int owningMedium;
int inSaveGame;
zTAccessMode accessMode;
zCArray<zTChunkRecord> chunkStack;
zCArray<zCObject*> objectList;
unsigned long posNumObjects;
unsigned long posChecksum;
unsigned long posHeaderEnd;
int checksumEnabled;
int flags;
int debugMessagesOn;
int noReadSearchCycles;
zSTRING tmpResultValue;
int deleteFileOnClose;
int warnEntrysNotRead;
int warnEntryNotFound;
int warnWrongEntryOrder;
void* stringHashMap;
unsigned long dummyVal;
unsigned long posChunkList;
char m_readTextBuffer[READ_BUFFER_SIZE];
void zCArchiverBinSafe_OnInit() zCall( 0x0050BDA0 );
void __fastcall RestoreString( zSTRING& ) zCall( 0x0050B3B0 );
void __fastcall WriteType( zTArchiveTypeID, void*, unsigned long ) zCall( 0x0050B3C0 );
int __fastcall ReadType( zTArchiveTypeID, void*, unsigned long ) zCall( 0x0050B430 );
void __fastcall ClearChunkList() zCall( 0x0050BAC0 );
unsigned long __fastcall InsertChunkInList( char const* ) zCall( 0x0050BC40 );
unsigned long __fastcall ResolveAndPosEntry( char const* ) zCall( 0x0050BCD0 );
zCArchiverBinSafe() zInit( zCArchiverBinSafe_OnInit() );
void DebugMessage( zSTRING const& ) zCall( 0x0050C2A0 );
void CheckObjectListSize( int ) zCall( 0x0050EAE0 );
static zCObject* _CreateNewInstance() zCall( 0x0050B2E0 );
virtual zCClassDef* _GetClassDef() const zCall( 0x0050BF20 );
virtual ~zCArchiverBinSafe() zCall( 0x0050C1A0 );
virtual void __fastcall WriteInt( char const*, int ) zCall( 0x0050CEB0 );
virtual void __fastcall WriteByte( char const*, unsigned char ) zCall( 0x0050CF90 );
virtual void __fastcall WriteWord( char const*, unsigned short ) zCall( 0x0050D070 );
virtual void __fastcall WriteFloat( char const*, float ) zCall( 0x0050D150 );
virtual void __fastcall WriteBool( char const*, int ) zCall( 0x0050D230 );
virtual void __fastcall WriteString( char const*, zSTRING const& ) zCall( 0x0050D310 );
virtual void __fastcall WriteVec3( char const*, zVEC3 const& ) zCall( 0x0050D440 );
virtual void __fastcall WriteColor( char const*, zCOLOR const& ) zCall( 0x0050D680 );
virtual void __fastcall WriteRaw( char const*, void*, unsigned long ) zCall( 0x0050D760 );
virtual void __fastcall WriteRawFloat( char const*, void*, unsigned long ) zCall( 0x0050D840 );
virtual void __fastcall WriteEnum( char const*, char const*, int ) zCall( 0x0050DA10 );
virtual void __fastcall WriteObject( zCObject* ) zCall( 0x0050E4E0 );
virtual void __fastcall WriteObject( char const*, zCObject* ) zCall( 0x0050E450 );
virtual void __fastcall WriteObject( char const*, zCObject& ) zCall( 0x0050E260 );
virtual void __fastcall WriteChunkStart( char const*, unsigned short ) zCall( 0x0050E000 );
virtual void __fastcall WriteChunkStart( char const*, char const*, unsigned short, unsigned long ) zCall( 0x0050DC30 );
virtual void __fastcall WriteChunkEnd() zCall( 0x0050E020 );
virtual void __fastcall WriteGroupBegin( char const* ) zCall( 0x0050DC10 );
virtual void __fastcall WriteGroupEnd( char const* ) zCall( 0x0050DC20 );
virtual void __fastcall ReadInt( char const*, int& ) zCall( 0x00510850 );
virtual int __fastcall ReadInt( char const* ) zCall( 0x00510610 );
virtual void __fastcall ReadByte( char const*, unsigned char& ) zCall( 0x00510880 );
virtual unsigned char __fastcall ReadByte( char const* ) zCall( 0x00510630 );
virtual void __fastcall ReadWord( char const*, unsigned short& ) zCall( 0x005108B0 );
virtual unsigned short __fastcall ReadWord( char const* ) zCall( 0x00510650 );
virtual void __fastcall ReadFloat( char const*, float& ) zCall( 0x005107F0 );
virtual float __fastcall ReadFloat( char const* ) zCall( 0x005105B0 );
virtual void __fastcall ReadBool( char const*, int& ) zCall( 0x005108E0 );
virtual int __fastcall ReadBool( char const* ) zCall( 0x00510670 );
virtual void __fastcall ReadString( char const*, zSTRING& ) zCall( 0x00510910 );
virtual zSTRING __fastcall ReadString( char const* ) zCall( 0x00510690 );
virtual void __fastcall ReadVec3( char const*, zVEC3& ) zCall( 0x00510820 );
virtual zVEC3 __fastcall ReadVec3( char const* ) zCall( 0x005105D0 );
virtual void __fastcall ReadColor( char const*, zCOLOR& ) zCall( 0x00510940 );
virtual zCOLOR __fastcall ReadColor( char const* ) zCall( 0x00510750 );
virtual void __fastcall ReadEnum( char const*, int& ) zCall( 0x00510970 );
virtual int __fastcall ReadEnum( char const* ) zCall( 0x00510770 );
virtual void __fastcall ReadRaw( char const*, void*, unsigned long ) zCall( 0x00510790 );
virtual void __fastcall ReadRawFloat( char const*, void*, unsigned long ) zCall( 0x005107C0 );
virtual zCObject* __fastcall ReadObject( zCObject* ) zCall( 0x0050FDD0 );
virtual zCObject* __fastcall ReadObject( char const*, zCObject* ) zCall( 0x0050F780 );
virtual int __fastcall ReadChunkStart( zSTRING&, unsigned short& ) zCall( 0x0050F600 );
virtual int __fastcall ReadChunkStart( char const* ) zCall( 0x0050F060 );
virtual int __fastcall ReadChunkStartNamed( char const*, unsigned short& ) zCall( 0x0050F720 );
virtual void __fastcall SkipOpenChunk() zCall( 0x0050BF30 );
virtual unsigned short __fastcall GetCurrentChunkVersion() zCall( 0x0050F750 );
virtual zFILE* GetFile() const zCall( 0x0050BF40 );
virtual void __fastcall GetBufferString( zSTRING& ) zCall( 0x0050C7B0 );
virtual zCBuffer* __fastcall GetBuffer() zCall( 0x0050C920 );
virtual int __fastcall EndOfArchive() zCall( 0x0050C720 );
virtual void Close() zCall( 0x0050C320 );
virtual void SetStringEOL( zSTRING const& ) zCall( 0x0050BF50 );
virtual zSTRING GetStringEOL() const zCall( 0x0050C0D0 );
virtual int IsStringValid( char const* ) zCall( 0x0050CC90 );
virtual int GetChecksumEnabled() const zCall( 0x0050C110 );
virtual void SetChecksumEnabled( int ) zCall( 0x0050C120 );
virtual void SetNoReadSearchCycles( int ) zCall( 0x0050C130 );
virtual int InProperties() const zCall( 0x0050C140 );
virtual int InSaveGame() const zCall( 0x0050C150 );
virtual int InBinaryMode() const zCall( 0x0050C160 );
virtual zCObject* __fastcall GetParentObject() zCall( 0x005109A0 );
virtual int OpenWriteBuffer( zCBuffer*, zTArchiveMode, int, int, int ) zCall( 0x0050C930 );
virtual void OpenWriteFile( zFILE*, zTArchiveMode, int, int, int ) zCall( 0x0050CAF0 );
virtual void __fastcall WriteHeader( int ) zCall( 0x0050CC10 );
virtual void __fastcall WriteHeaderNumObj() zCall( 0x0050C2C0 );
virtual void __fastcall WriteASCIILine( char const*, char const*, zSTRING const& ) zCall( 0x0050CCD0 );
virtual void __fastcall StoreBuffer( void*, unsigned long ) zCall( 0x0050CB50 );
virtual void __fastcall StoreString( char const* ) zCall( 0x0050CB80 );
virtual void __fastcall StoreStringEOL( char const* ) zCall( 0x0050CC00 );
virtual unsigned long __fastcall StoreGetPos() zCall( 0x0050CBB0 );
virtual void __fastcall StoreSeek( unsigned long ) zCall( 0x0050CBD0 );
virtual int OpenReadBuffer( zCBuffer&, zTArchiveMode, int, int ) zCall( 0x0050E4F0 );
virtual void OpenReadFile( zFILE*, zTArchiveMode, int, int, int ) zCall( 0x0050E6C0 );
virtual zCClassDef* __fastcall GetClassDefByString( zSTRING const& ) zCall( 0x0050EC60 );
virtual zCObject* __fastcall CreateObject( zSTRING const& ) zCall( 0x0050EB90 );
virtual void __fastcall SkipChunk( int ) zCall( 0x0050FDE0 );
virtual void __fastcall ReadChunkStartASCII( char const*, zSTRING& ) zCall( 0x0050EE00 );
virtual void __fastcall ReadChunkEnd() zCall( 0x0050F770 );
virtual int __fastcall ReadEntryASCII( char const*, zSTRING& ) zCall( 0x0050FFB0 );
virtual void __fastcall ReadHeader() zCall( 0x0050E7D0 );
virtual void __fastcall RestoreBuffer( void*, unsigned long ) zCall( 0x0050E720 );
virtual void __fastcall RestoreStringEOL( zSTRING& ) zCall( 0x0050E750 );
virtual void __fastcall RestoreString0( zSTRING& ) zCall( 0x0050E760 );
virtual unsigned long __fastcall RestoreGetPos() zCall( 0x0050E770 );
virtual void __fastcall RestoreSeek( unsigned long ) zCall( 0x0050E790 );
virtual void __fastcall DeleteBuffer() zCall( 0x0050C790 );
// user API
#include "zCArchiverBinSafe.inl"
};
} // namespace Gothic_I_Classic
#endif // __ZARCHIVER2_H__VER0__ | [
"amax96@yandex.ru"
] | amax96@yandex.ru |
ddb310a2f698f49b94bc5210816f16fe71d2ef25 | dfc57ccfc1cadd9ad209c4232444631b27d1b072 | /cw/GP/Box.h | 355c7cb43243f3e4989eb9e953ef5e8426f30f48 | [] | no_license | zecbmo/graphicsCW | eb1466414d565d73272e98da811a74583b3024be | bd1663a9ee6f5a14ce99f3bcccc61e85a9196883 | refs/heads/master | 2021-01-21T12:58:11.512399 | 2016-04-26T15:57:43 | 2016-04-26T15:57:43 | 52,272,244 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 204 | h | #pragma once
#include "GameObject.h"
class Box : public GameObject
{
public:
Box() {};
~Box() {};
void Init(std::string filename);
void Update(float speed, float dt);
void Render();
private:
};
| [
"gmccartan05@gmail.com"
] | gmccartan05@gmail.com |
b70300a808d4b74d30f7e4d7622de1a7da373358 | 4bcc9806152542ab43fc2cf47c499424f200896c | /tensorflow/core/kernels/bias_op_test.cc | a2c7b85a90924d0724117b656093f8463afcbc58 | [
"Apache-2.0",
"LicenseRef-scancode-generic-cla",
"BSD-2-Clause"
] | permissive | tensorflow/tensorflow | 906276dbafcc70a941026aa5dc50425ef71ee282 | a7f3934a67900720af3d3b15389551483bee50b8 | refs/heads/master | 2023-08-25T04:24:41.611870 | 2023-08-25T04:06:24 | 2023-08-25T04:14:08 | 45,717,250 | 208,740 | 109,943 | Apache-2.0 | 2023-09-14T20:55:50 | 2015-11-07T01:19:20 | C++ | UTF-8 | C++ | false | false | 4,317 | cc | /* Copyright 2019 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/core/kernels/bias_op.h"
#include <random>
#include "tensorflow/core/common_runtime/kernel_benchmark_testlib.h"
#include "tensorflow/core/framework/tensor.h"
#include "tensorflow/core/platform/test.h"
#include "tensorflow/core/platform/test_benchmark.h"
namespace tensorflow {
static Graph* BiasAdd(int d0, int d1, int d2, int d3) {
auto* g = new Graph(OpRegistry::Global());
Tensor input(DT_FLOAT, TensorShape({d0, d1, d2, d3}));
Tensor bias(DT_FLOAT, TensorShape({d3}));
input.flat<float>().setRandom();
bias.flat<float>().setRandom();
test::graph::Binary(g, "BiasAdd", test::graph::Constant(g, input),
test::graph::Constant(g, bias));
return g;
}
static Graph* BiasAddGrad(int d0, int d1, int d2, int d3) {
auto* g = new Graph(OpRegistry::Global());
Tensor out_backprop(DT_FLOAT, TensorShape({d0, d1, d2, d3}));
out_backprop.flat<float>().setRandom();
test::graph::Unary(g, "BiasAddGrad", test::graph::Constant(g, out_backprop));
return g;
}
#define BM_BiasAddNHWC(N, W, H, C, DEVICE) \
static void BM_BiasAddNHWC##_##N##_##H##_##W##_##C##_##DEVICE( \
::testing::benchmark::State& state) { \
test::Benchmark(#DEVICE, BiasAdd(N, H, W, C), /*old_benchmark_api=*/false) \
.Run(state); \
state.SetItemsProcessed(static_cast<int64_t>(state.iterations()) * N * H * \
W * C); \
} \
BENCHMARK(BM_BiasAddNHWC##_##N##_##H##_##W##_##C##_##DEVICE)->UseRealTime();
#define BM_BiasAddGradNHWC(N, W, H, C, DEVICE) \
static void BM_BiasAddGradNHWC##_##N##_##H##_##W##_##C##_##DEVICE( \
::testing::benchmark::State& state) { \
test::Benchmark(#DEVICE, BiasAddGrad(N, H, W, C), \
/*old_benchmark_api=*/false) \
.Run(state); \
state.SetItemsProcessed(static_cast<int64_t>(state.iterations()) * N * H * \
W * C); \
} \
BENCHMARK(BM_BiasAddGradNHWC##_##N##_##H##_##W##_##C##_##DEVICE) \
->UseRealTime();
// CPU
BM_BiasAddNHWC(32, 32, 32, 128, cpu);
BM_BiasAddNHWC(32, 32, 32, 256, cpu);
BM_BiasAddNHWC(32, 32, 32, 512, cpu);
BM_BiasAddNHWC(32, 32, 32, 1024, cpu);
BM_BiasAddNHWC(32, 64, 64, 128, cpu);
BM_BiasAddNHWC(32, 64, 64, 256, cpu);
BM_BiasAddNHWC(32, 64, 64, 512, cpu);
BM_BiasAddNHWC(32, 64, 64, 1024, cpu);
BM_BiasAddGradNHWC(32, 32, 32, 128, cpu);
BM_BiasAddGradNHWC(32, 32, 32, 256, cpu);
BM_BiasAddGradNHWC(32, 32, 32, 512, cpu);
BM_BiasAddGradNHWC(32, 32, 32, 1024, cpu);
BM_BiasAddGradNHWC(32, 64, 64, 128, cpu);
BM_BiasAddGradNHWC(32, 64, 64, 256, cpu);
BM_BiasAddGradNHWC(32, 64, 64, 512, cpu);
BM_BiasAddGradNHWC(32, 64, 64, 1024, cpu);
#ifdef GOOGLE_CUDA
BM_BiasAddGradNHWC(32, 32, 32, 128, gpu);
BM_BiasAddGradNHWC(32, 32, 32, 256, gpu);
BM_BiasAddGradNHWC(32, 32, 32, 512, gpu);
BM_BiasAddGradNHWC(32, 32, 32, 1024, gpu);
BM_BiasAddGradNHWC(32, 64, 64, 128, gpu);
BM_BiasAddGradNHWC(32, 64, 64, 256, gpu);
BM_BiasAddGradNHWC(32, 64, 64, 512, gpu);
BM_BiasAddGradNHWC(32, 64, 64, 1024, gpu);
#endif // GOOGLE_CUDA
} // end namespace tensorflow
| [
"gardener@tensorflow.org"
] | gardener@tensorflow.org |
ee8b0fa66d27738128e2b1d1d92aefc32a24c6ac | fafdf1e62cf622035ee82666ba6ae7108127d140 | /PhysX/v2.8.1/Tools/CookedMesh/Converter/source/Stream.cpp | 06934902a9bd87868aae2f9f224db0c687b4876c | [] | no_license | saerich/RaiderZ-Evolved-SDK | 7f18942ddc6c566d47c3a6222c03fad7543738a4 | b576e6757b6a781a656be7ba31eb0cf5e8a23391 | refs/heads/master | 2023-02-12T03:21:26.442348 | 2020-08-30T15:39:54 | 2020-08-30T15:39:54 | 281,213,173 | 1 | 2 | null | null | null | null | UTF-8 | C++ | false | false | 2,327 | cpp | // ===============================================================================
// AGEIA PHYSX SDK TRAINING PROGRAMS
// USER STREAM
//
// Written by Bob Schade, 5-1-06
// ===============================================================================
#include <stdio.h>
#include "NxPhysics.h"
#include "Stream.h"
UserStream::UserStream(const char* filename, bool load) : fp(NULL)
{
fp = fopen(filename, load ? "rb" : "wb");
}
UserStream::~UserStream()
{
if(fp) fclose(fp);
}
bool UserStream::isOpen()
{
return (fp != NULL);
}
void UserStream::closeStream()
{
if (fp)
{
fclose(fp);
fp = NULL;
}
}
bool UserStream::advanceStream(NxU32 nbBytes)
{
long curPos = ftell(fp);
curPos += nbBytes;
return (fseek(fp, curPos, SEEK_SET) == 0);
}
// Loading API
NxU8 UserStream::readByte() const
{
NxU8 b;
size_t r = fread(&b, sizeof(NxU8), 1, fp);
NX_ASSERT(r);
return b;
}
NxU16 UserStream::readWord() const
{
NxU16 w;
size_t r = fread(&w, sizeof(NxU16), 1, fp);
NX_ASSERT(r);
return w;
}
NxU32 UserStream::readDword() const
{
NxU32 d;
size_t r = fread(&d, sizeof(NxU32), 1, fp);
NX_ASSERT(r);
return d;
}
float UserStream::readFloat() const
{
NxReal f;
size_t r = fread(&f, sizeof(NxReal), 1, fp);
NX_ASSERT(r);
return f;
}
double UserStream::readDouble() const
{
NxF64 f;
size_t r = fread(&f, sizeof(NxF64), 1, fp);
NX_ASSERT(r);
return f;
}
void UserStream::readBuffer(void* buffer, NxU32 size) const
{
size_t w = fread(buffer, size, 1, fp);
NX_ASSERT(w);
}
// Saving API
NxStream& UserStream::storeByte(NxU8 b)
{
size_t w = fwrite(&b, sizeof(NxU8), 1, fp);
NX_ASSERT(w);
return *this;
}
NxStream& UserStream::storeWord(NxU16 w)
{
size_t ww = fwrite(&w, sizeof(NxU16), 1, fp);
NX_ASSERT(ww);
return *this;
}
NxStream& UserStream::storeDword(NxU32 d)
{
size_t w = fwrite(&d, sizeof(NxU32), 1, fp);
NX_ASSERT(w);
return *this;
}
NxStream& UserStream::storeFloat(NxReal f)
{
size_t w = fwrite(&f, sizeof(NxReal), 1, fp);
NX_ASSERT(w);
return *this;
}
NxStream& UserStream::storeDouble(NxF64 f)
{
size_t w = fwrite(&f, sizeof(NxF64), 1, fp);
NX_ASSERT(w);
return *this;
}
NxStream& UserStream::storeBuffer(const void* buffer, NxU32 size)
{
size_t w = fwrite(buffer, size, 1, fp);
NX_ASSERT(w);
return *this;
}
| [
"fabs1996@live.co.uk"
] | fabs1996@live.co.uk |
601a2ad9d2a249343bd1025eba7cc797115f09f5 | 3b9b4049a8e7d38b49e07bb752780b2f1d792851 | /src/native_client/toolchain/linux_x86/pnacl_newlib/include/llvm/DebugInfo/PDB/PDB.h | 67878e9ccf600707636d0f6d3accb9eb2d4ef2bf | [
"BSD-3-Clause",
"Zlib",
"Classpath-exception-2.0",
"BSD-Source-Code",
"LZMA-exception",
"LicenseRef-scancode-unicode",
"LGPL-3.0-only",
"LGPL-2.0-or-later",
"LicenseRef-scancode-philippe-de-muyter",
"LicenseRef-scancode-warranty-disclaimer",
"LicenseRef-scancode-intel-osl-1993",
"HPND-sell-var... | permissive | webosce/chromium53 | f8e745e91363586aee9620c609aacf15b3261540 | 9171447efcf0bb393d41d1dc877c7c13c46d8e38 | refs/heads/webosce | 2020-03-26T23:08:14.416858 | 2018-08-23T08:35:17 | 2018-09-20T14:25:18 | 145,513,343 | 0 | 2 | Apache-2.0 | 2019-08-21T22:44:55 | 2018-08-21T05:52:31 | null | UTF-8 | C++ | false | false | 632 | h | //===- PDB.h - base header file for creating a PDB reader -------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_DEBUGINFO_PDB_PDB_H
#define LLVM_DEBUGINFO_PDB_PDB_H
#include "PDBTypes.h"
#include <memory>
namespace llvm {
class StringRef;
PDB_ErrorCode createPDBReader(PDB_ReaderType Type, StringRef Path,
std::unique_ptr<IPDBSession> &Session);
}
#endif
| [
"changhyeok.bae@lge.com"
] | changhyeok.bae@lge.com |
197225798cbf5055365c019a288b21e72a003bb9 | a929b48fd193b9aa5176ce75e95f34bf0fb332dd | /core/IWindow.hh | 6648f09142c6c915956cda1095ee834c37a732df | [] | no_license | jsthibault/cpp_nibbler | 80a6d768e282811bfb3fd4471002b0b2456a9abc | 19f44e6babaf8e13787a0140890c39321bc9d564 | refs/heads/master | 2021-01-18T13:45:30.249667 | 2014-04-28T15:01:40 | 2014-04-28T15:01:40 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,324 | hh | /*
** IWindow.h for core in /home/loic/dev/epitech/cpp/Nibbler/core
**
** Made by lefloc_l
** Login <lefloc_l@epitech.eu>
**
** Started on mer. mars 19 08:48:56 2014 lefloc_l
// Last update Sun Apr 6 18:24:31 2014 samy ouachek
*/
#ifndef IWINDOW_H_
# define IWINDOW_H_
#include <list>
namespace Event
{
enum code
{
NONE = 0,
LEFT,
UP,
RIGHT,
DOWN,
MENU,
QUIT,
LIB1,
LIB2,
LIB3,
PAUSE
};
}
namespace Case
{
enum case_name
{
EMPTY,
SNAKE,
FOOD,
WALL
};
typedef struct s_pos
{
int x;
int y;
case_name type;
bool operator==(const struct s_pos &other)
{
return (this->x == other.x
&& this->y == other.y
&& this->type == other.type);
}
} t_pos;
}
typedef std::list<Case::t_pos>::const_iterator t_mapiter;
typedef struct s_map
{
std::list<Case::t_pos> snake;
std::list<Case::t_pos> others;
int direction;
int score;
} map_t;
class IWindow
{
public:
virtual ~IWindow(void) { };
/*
* init library
*/
virtual void init(int, int) = 0;
/*
* just check if an event occured and return the Event::code
*/
virtual Event::code getEvent(void) = 0;
/*
* refresh the window
*/
virtual void refresh(map_t const &) = 0;
};
#endif /* !IWINDOW_H_ */
| [
"js@js-HP-EliteBook-8560p.(none)"
] | js@js-HP-EliteBook-8560p.(none) |
3da9810bd9e37cbce4387c3d00d9fdb4cb3d5970 | 434359757874ef74c56c612ac92eebadc64e4212 | /VCVRackModule/Lasers/src/Lasers.hpp | 245b6bcba09723597cf3a12a74cee50a767a2ad6 | [
"CC0-1.0"
] | permissive | ArjoNagelhout/DoubleLasers | 8ab392c5d24b10db8f7eb1eef7c0eb3cd4fb1dcd | 5558646b0b15c40585f6a647d470063e29c5e197 | refs/heads/master | 2020-05-05T11:50:45.905325 | 2019-04-08T23:06:47 | 2019-04-08T23:06:47 | 180,005,947 | 3 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 223 | hpp | #include "rack.hpp"
using namespace rack;
// Forward-declare the Plugin, defined in Template.cpp
extern Plugin *plugin;
// Forward-declare each Model, defined in each module source file
extern Model *modelDoubleLasers;
| [
"arjo.nagelhout@gmail.com"
] | arjo.nagelhout@gmail.com |
73558c4ff8f219f3811b599ddf183417124e641f | f9eea884de6cea562d04d8613b2d5da60cd28cb5 | /programmer_basic.ino | 6c56db554f577b3c15b6b7725a7d590618a73b77 | [] | no_license | omeh-a/6502-dump | 3d26e369aa84e0ecabe88e8ce97dc18649e34b4f | 84f629f84cf157a1aeb413affa55a014823b5453 | refs/heads/master | 2023-08-15T17:22:04.725285 | 2021-10-21T06:07:34 | 2021-10-21T06:07:34 | 412,082,060 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 6,090 | ino | /**
* This sketch programs the microcode EEPROMs for the 8-bit breadboard computer
* It includes support for a flags register with carry and zero flags
* See this video for more: https://youtu.be/Zg1NdPKoosU
*/
#define SHIFT_DATA 2
#define SHIFT_CLK 3
#define SHIFT_LATCH 4
#define EEPROM_D0 5
#define EEPROM_D7 12
#define WRITE_EN 13
#define HLT 0b1000000000000000 // Halt clock
#define MI 0b0100000000000000 // Memory address register in
#define RI 0b0010000000000000 // RAM data in
#define RO 0b0001000000000000 // RAM data out
#define IO 0b0000100000000000 // Instruction register out
#define II 0b0000010000000000 // Instruction register in
#define AI 0b0000001000000000 // A register in
#define AO 0b0000000100000000 // A register out
#define EO 0b0000000010000000 // ALU out
#define SU 0b0000000001000000 // ALU subtract
#define BI 0b0000000000100000 // B register in
#define OI 0b0000000000010000 // Output register in
#define CE 0b0000000000001000 // Program counter enable
#define CO 0b0000000000000100 // Program counter out
#define J 0b0000000000000010 // Jump (program counter in)
#define FI 0b0000000000000001 // Flags in
#define FLAGS_Z0C0 0
#define FLAGS_Z0C1 1
#define FLAGS_Z1C0 2
#define FLAGS_Z1C1 3
#define JC 0b0111
#define JZ 0b1000
uint16_t UCODE_TEMPLATE[16][8] = {
{ MI|CO, RO|II|CE, 0, 0, 0, 0, 0, 0 }, // 0000 - NOP
{ MI|CO, RO|II|CE, IO|MI, RO|AI, 0, 0, 0, 0 }, // 0001 - LDA
{ MI|CO, RO|II|CE, IO|MI, RO|BI, EO|AI|FI, 0, 0, 0 }, // 0010 - ADD
{ MI|CO, RO|II|CE, IO|MI, RO|BI, EO|AI|SU|FI, 0, 0, 0 }, // 0011 - SUB
{ MI|CO, RO|II|CE, IO|MI, AO|RI, 0, 0, 0, 0 }, // 0100 - STA
{ MI|CO, RO|II|CE, IO|AI, 0, 0, 0, 0, 0 }, // 0101 - LDI
{ MI|CO, RO|II|CE, IO|J, 0, 0, 0, 0, 0 }, // 0110 - JMP
{ MI|CO, RO|II|CE, 0, 0, 0, 0, 0, 0 }, // 0111 - JC
{ MI|CO, RO|II|CE, 0, 0, 0, 0, 0, 0 }, // 1000 - JZ
{ MI|CO, RO|II|CE, 0, 0, 0, 0, 0, 0 }, // 1001
{ MI|CO, RO|II|CE, 0, 0, 0, 0, 0, 0 }, // 1010
{ MI|CO, RO|II|CE, 0, 0, 0, 0, 0, 0 }, // 1011
{ MI|CO, RO|II|CE, 0, 0, 0, 0, 0, 0 }, // 1100
{ MI|CO, RO|II|CE, 0, 0, 0, 0, 0, 0 }, // 1101
{ MI|CO, RO|II|CE, AO|OI, 0, 0, 0, 0, 0 }, // 1110 - OUT
{ MI|CO, RO|II|CE, HLT, 0, 0, 0, 0, 0 }, // 1111 - HLT
};
uint16_t ucode[4][16][8];
void initUCode() {
// ZF = 0, CF = 0
memcpy(ucode[FLAGS_Z0C0], UCODE_TEMPLATE, sizeof(UCODE_TEMPLATE));
// ZF = 0, CF = 1
memcpy(ucode[FLAGS_Z0C1], UCODE_TEMPLATE, sizeof(UCODE_TEMPLATE));
ucode[FLAGS_Z0C1][JC][2] = IO|J;
// ZF = 1, CF = 0
memcpy(ucode[FLAGS_Z1C0], UCODE_TEMPLATE, sizeof(UCODE_TEMPLATE));
ucode[FLAGS_Z1C0][JZ][2] = IO|J;
// ZF = 1, CF = 1
memcpy(ucode[FLAGS_Z1C1], UCODE_TEMPLATE, sizeof(UCODE_TEMPLATE));
ucode[FLAGS_Z1C1][JC][2] = IO|J;
ucode[FLAGS_Z1C1][JZ][2] = IO|J;
}
/*
* Output the address bits and outputEnable signal using shift registers.
*/
void setAddress(int address, bool outputEnable) {
shiftOut(SHIFT_DATA, SHIFT_CLK, MSBFIRST, (address >> 8) | (outputEnable ? 0x00 : 0x80));
shiftOut(SHIFT_DATA, SHIFT_CLK, MSBFIRST, address);
digitalWrite(SHIFT_LATCH, LOW);
digitalWrite(SHIFT_LATCH, HIGH);
digitalWrite(SHIFT_LATCH, LOW);
}
/*
* Read a byte from the EEPROM at the specified address.
*/
byte readEEPROM(int address) {
for (int pin = EEPROM_D0; pin <= EEPROM_D7; pin += 1) {
pinMode(pin, INPUT);
}
setAddress(address, /*outputEnable*/ true);
byte data = 0;
for (int pin = EEPROM_D7; pin >= EEPROM_D0; pin -= 1) {
data = (data << 1) + digitalRead(pin);
}
return data;
}
/*
* Write a byte to the EEPROM at the specified address.
*/
void writeEEPROM(int address, byte data) {
setAddress(address, /*outputEnable*/ false);
for (int pin = EEPROM_D0; pin <= EEPROM_D7; pin += 1) {
pinMode(pin, OUTPUT);
}
for (int pin = EEPROM_D0; pin <= EEPROM_D7; pin += 1) {
digitalWrite(pin, data & 1);
data = data >> 1;
}
digitalWrite(WRITE_EN, LOW);
delayMicroseconds(1);
digitalWrite(WRITE_EN, HIGH);
delay(10);
}
/*
* Read the contents of the EEPROM and print them to the serial monitor.
*/
void printContents(int start, int length) {
for (int base = start; base < length; base += 16) {
byte data[16];
for (int offset = 0; offset <= 15; offset += 1) {
data[offset] = readEEPROM(base + offset);
}
char buf[80];
sprintf(buf, "%03x: %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x",
base, data[0], data[1], data[2], data[3], data[4], data[5], data[6], data[7],
data[8], data[9], data[10], data[11], data[12], data[13], data[14], data[15]);
Serial.println(buf);
}
}
void setup() {
// put your setup code here, to run once:
initUCode();
pinMode(SHIFT_DATA, OUTPUT);
pinMode(SHIFT_CLK, OUTPUT);
pinMode(SHIFT_LATCH, OUTPUT);
digitalWrite(WRITE_EN, HIGH);
pinMode(WRITE_EN, OUTPUT);
Serial.begin(57600);
// Program data bytes
Serial.print("Programming EEPROM");
// Program the 8 high-order bits of microcode into the first 128 bytes of EEPROM
for (int address = 0; address < 1024; address += 1) {
int flags = (address & 0b1100000000) >> 8;
int byte_sel = (address & 0b0010000000) >> 7;
int instruction = (address & 0b0001111000) >> 3;
int step = (address & 0b0000000111);
if (byte_sel) {
writeEEPROM(address, ucode[flags][instruction][step]);
} else {
writeEEPROM(address, ucode[flags][instruction][step] >> 8);
}
if (address % 64 == 0) {
Serial.print(".");
}
}
Serial.println(" done");
// Read and print out the contents of the EERPROM
Serial.println("Reading EEPROM");
printContents(0, 1024);
}
void loop() {
// put your main code here, to run repeatedly:
} | [
"omeh-a@users.noreply.github.com"
] | omeh-a@users.noreply.github.com |
3099e05b2458ef9a65333255297cbc9b2efea0dd | 573b7f2b79b6fb8b21b40985f7639bc003b60f7e | /SDK/BP_vehiclewheel_BMP1_7_classes.h | f8c77e0821427e81d00b1e836b5aaaff68bd4381 | [] | no_license | AlexzDK/SquadSDK2021 | 8d4c29486922fed3ba8451680d823a04a7b7fc44 | cdce732ad4713b6d7f668f8b9c39e160035efb34 | refs/heads/main | 2023-02-21T02:52:15.634663 | 2021-01-23T23:28:57 | 2021-01-23T23:28:57 | 332,328,796 | 4 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 744 | h | #pragma once
// Name: Squad, Version: 13-01-2021
#ifdef _MSC_VER
#pragma pack(push, 0x01)
#endif
/*!!HELPER_DEF!!*/
/*!!DEFINE!!*/
namespace UFT
{
//---------------------------------------------------------------------------
// Classes
//---------------------------------------------------------------------------
// BlueprintGeneratedClass BP_vehiclewheel_BMP1_7.BP_vehiclewheel_BMP1_6_C
// 0x0000 (FullSize[0x0108] - InheritedSize[0x0108])
class UBP_vehiclewheel_BMP1_6_C : public USQVehicleWheel_Tracked
{
public:
static UClass* StaticClass()
{
static auto ptr = UObject::FindClass("BlueprintGeneratedClass BP_vehiclewheel_BMP1_7.BP_vehiclewheel_BMP1_6_C");
return ptr;
}
};
}
#ifdef _MSC_VER
#pragma pack(pop)
#endif
| [
"39485681+AlexzDK@users.noreply.github.com"
] | 39485681+AlexzDK@users.noreply.github.com |
51d466652e100c64489984408b2ce0d65f4c55ea | 6b2a8dd202fdce77c971c412717e305e1caaac51 | /solutions_1595491_0/C++/saintqdd/main.cpp | 790ec57895c5b4df125911fef047a39fb3f773dc | [] | no_license | alexandraback/datacollection | 0bc67a9ace00abbc843f4912562f3a064992e0e9 | 076a7bc7693f3abf07bfdbdac838cb4ef65ccfcf | refs/heads/master | 2021-01-24T18:27:24.417992 | 2017-05-23T09:23:38 | 2017-05-23T09:23:38 | 84,313,442 | 2 | 4 | null | null | null | null | UTF-8 | C++ | false | false | 1,687 | cpp | #include <cstdio>
#include <cstdlib>
#include <iostream>
#include <set>
using namespace std;
int T,N,S,P,v[110];
bool Isvalid(int a,int b,int c)
{
if( abs(a-b)>2 || abs(a-c)>2 || abs(b-c)>2 ) return false;
return true;
}
bool Issp(int a,int b,int c)
{
if( abs(a-b)==2 || abs(a-c)==2 || abs(b-c)==2) return true;
return false;
}
int main()
{
freopen("B-small-attempt2.in","r",stdin);
freopen("out.txt","w",stdout);
scanf("%d",&T);
for(int i=1;i<=T;i++)
{
scanf("%d %d %d",&N,&S,&P);
for(int j=1;j<=N;j++)
{
scanf("%d",&v[j]);
}
int va_sp2 = 0;
int va_sp1 = 0;
int va_sp0 = 0;
int nva_sp = 0;
for(int j=1;j<=N;j++)
{
bool f = false,f2=false,g=false,g2=false,g3=false;
for(int m=0;m<=v[j];m++)
{
if(m>10) break;
for(int x=0;v[j]-m-x>=0;x++)
{
if( x>10 || v[j]-m-x>10 ) continue;
if(Isvalid(m,x,v[j]-x-m))
{
if( m>=P || x>=P || v[j]-x-m>=P)
{
f = true;
if( Issp(m,x,v[j]-x-m))
{
g2 = true;
}
else
{
g3 = true;
}
}
else
{
f2 = true;
if( Issp(m,x,v[j]-x-m))
{
g = true;
}
}
}
}
}
if(f2&&!f)
{
nva_sp++;
}
if(f)
{
if(g2&g3) va_sp2++;
else if(g2) va_sp1++;
else va_sp0++;
}
}
//printf("%d %d %d %d\n",nva_sp,va_sp2,va_sp1,va_sp0);
int ans = 0;
if( va_sp1>=S)
{
ans += va_sp2+va_sp0+S;
}
else if(nva_sp+va_sp1+va_sp2>=S)
{
ans += va_sp2 + va_sp1 + va_sp0;;
}
printf("Case #%d: %d\n",i,ans);
}
return 0;
} | [
"eewestman@gmail.com"
] | eewestman@gmail.com |
aa9fdada81e2b2b70ebef771f2d881a52fd0e9c1 | edab58696afb07657232f17490b24c8e1e11b6c2 | /uva/11498.cpp | 34a441acec7217216d6556a1f609faec6d84d090 | [] | no_license | mhcayan/competitive-programming | cd8e08da67138cfbdcd2d47cd70572a7fc6435fd | f80ab6929a5d2eb780d35679688ea39138cf9e8a | refs/heads/master | 2022-05-27T15:03:46.147224 | 2022-05-22T00:21:29 | 2022-05-22T00:21:29 | 161,851,714 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 438 | cpp | #include<stdio.h>
int main()
{
long a,b,q,i,x,y;
while(scanf("%ld",&q))
{
if(q==0)
break;
scanf("%ld %ld",&a,&b);
for(i=0;i<q;i++)
{
scanf("%ld %ld",&x,&y);
if(x==a || y==b)
printf("divisa\n");
else
{
x=x-a;
y=y-b;
if(x>0 && y>0)
printf("NE\n");
else if(x>0 && y<0)
printf("SE\n");
else if(x<0 && y<0)
printf("SO\n");
else
printf("NO\n");
}
}
}
return 0;
} | [
"ayanctg@gmail.com"
] | ayanctg@gmail.com |
59b9e56faa5b4764b8ead928a9ae93832848887d | c7c70c3177c7724be8775da5e85c5cb62f02e262 | /src/DgHexC3Grid2D.h | f108032f7ab279c564c3c4a42ff52f87a41acec4 | [
"LGPL-2.0-or-later",
"MIT",
"LicenseRef-scancode-public-domain",
"AGPL-3.0-only"
] | permissive | pieterprovoost/dggridR | 190c658ac2284169d4006b82aceb70fc53a2d738 | c99eb5f97f90b919984a61815823266528372e19 | refs/heads/master | 2022-05-02T04:40:18.765693 | 2022-03-18T04:56:41 | 2022-03-18T04:56:41 | 239,110,945 | 0 | 0 | MIT | 2020-02-08T10:38:56 | 2020-02-08T10:38:56 | null | UTF-8 | C++ | false | false | 3,604 | h | #ifndef DGGRIDR
#define DGGRIDR
#endif
/*******************************************************************************
Copyright (C) 2021 Kevin Sahr
This file is part of DGGRID.
DGGRID is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
DGGRID is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*******************************************************************************/
////////////////////////////////////////////////////////////////////////////////
//
// DgHexC3Grid2D.h: DgHexC3Grid2D class definitions
//
// Version 6.1 - Kevin Sahr, 5/23/13
//
////////////////////////////////////////////////////////////////////////////////
#ifndef DGHEXC3GRID2D_H
#define DGHEXC3GRID2D_H
#include <cmath>
#include "DgDiscRF2D.h"
#include "DgDVec2D.h"
#include "DgIVec2D.h"
class DgPolygon;
using namespace dgg::topo;
////////////////////////////////////////////////////////////////////////////////
class DgHexC3Grid2D : public DgDiscRF2D {
public:
static const DgHexC3Grid2D* makeRF (DgRFNetwork& networkIn,
const DgRF<DgDVec2D, long double>& ccFrameIn,
bool isClassI = true, const string& nameIn = "HexC3D")
{ return new DgHexC3Grid2D (networkIn, ccFrameIn, isClassI, nameIn); }
DgHexC3Grid2D (const DgHexC3Grid2D& grd) : DgDiscRF2D (grd) {}
DgHexC3Grid2D& operator= (const DgHexC3Grid2D& grd)
{ DgDiscRF2D::operator=(grd); return *this; }
virtual long long int dist (const DgIVec2D& add1, const DgIVec2D& add2) const;
bool isClassI (void) const { return isClassI_; }
const DgDiscRF2D& surrogate (void) const { return *surrogate_; }
const DgDiscRF2D& substrate (void) const { return *substrate_; }
virtual operator string (void) const
{
string s = DgDiscRF::operator string() + ": DgHexC3Grid2D\n";
s += " -- isClassI: " + dgg::util::to_string(isClassI());
s += "\n -- surrogate: " + string(*surrogate_);
s += "\n -- substrate: " + string(*substrate_);
return s;
}
protected:
DgHexC3Grid2D (DgRFNetwork& networkIn,
const DgRF<DgDVec2D, long double>& ccFrameIn,
bool isClassI = true, const string& nameIn = "HexC3D");
static const long double sin60_;
bool isClassI_;
const DgDiscRF2D* surrogate_;
const DgDiscRF2D* substrate_;
virtual void setAddVertices (const DgIVec2D& add, DgPolygon& vec) const;
virtual void setAddNeighbors
(const DgIVec2D& add, DgLocVector& vec) const;
virtual void setAddNeighborsBdry2
(const DgIVec2D& add, DgLocVector& vec) const;
virtual DgIVec2D quantify (const DgDVec2D& point) const;
virtual DgDVec2D invQuantify (const DgIVec2D& add) const;
};
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
#endif
| [
"rbarnes@umn.edu"
] | rbarnes@umn.edu |
accbf17bd8b0d966f88b9ad146e494547fed7577 | 7dce4ebe0106adfb79cc161c541120cc3e03601e | /listing6/listing6_16.cpp | 4bd122cb79eca624bb5b3931d83bd501864a4ac9 | [] | no_license | ab4295/C_plusplus_Training | 4212e14a907d33731ac198a48e49cbbe73d87b9a | 32068687664e3b6fd66ce6654b4356417629b586 | refs/heads/master | 2020-06-16T14:46:37.286403 | 2019-07-07T05:07:16 | 2019-07-07T05:07:16 | 195,612,131 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,496 | cpp | #include<iostream>
#include<fstream>
#include<cstdlib>
using namespace std;
const int SIZE = 60;
int main()
{
char fileName[SIZE];
ifstream inFile; //객체 생성
cout << "데이터 파일의 이름을 입력하시오. :";
cin.getline(fileName,SIZE); //파일이름 입력받고
inFile.open(fileName); //파일에 연결
if(!inFile.is_open()) //제대로 열리지 않는다면
{
cout << fileName << " 파일을 열 수 없습니다." << endl;
cout << "프로그램을 종료합니다." << endl;
exit(EXIT_FAILURE); //종료
}
double value; //읽어들일 값.
double sum = 0.0; //합계
int count = 0; //읽은 항목의 개수
inFile >> value; //첫번째 값을 읽는다.
while(inFile.good()) //EOF가 아닌동안, 잘못된 것이 없으면
{
++count;
sum += value;
inFile >> value;
}
//여가서부터는 루프가 왜 종료되었는지에 대한 검사.
if(inFile.eof())
cout << "파일 끝에 도달했습니다." << endl;
else if(inFile.fail()) //fail 메소드는 eof에 도달하거나 데이터형 불일치면 true를 리턴한다.
cout << "데이터 불일치로 입력이 종료되었습니다." << endl;
else
cout << "알 수 없는 이유로 입력이 종료되었습니다." << endl;
if(count == 0)
cout << "데이터가 없습니다." << endl;
else
{
cout << "읽은 항목의 개수 : " << count << endl;
cout << "합계 :" << sum << endl;
cout << "평균 :" << sum/count << endl;
}
inFile.close();
return 0;
} | [
"sotagf31@gmail.com"
] | sotagf31@gmail.com |
d5db2ef9c89ea476cb48bd8bb8e0b8b815e66b08 | 9640f565c008966381e050b43b2febb0bc7365d2 | /Week_02/valid-anagram.cpp | 851d8d1a12e41862bb4c4228681fbae3dc3e6631 | [] | no_license | yondmn/algorithm014-algorithm014 | 6cf74c18be2ce7f7cffbe2e6fa96a335bd0e09da | 4e6f67338d0716d617821b71cc08e010e548916c | refs/heads/master | 2023-01-05T13:56:23.708218 | 2020-11-01T16:13:24 | 2020-11-01T16:13:24 | 287,554,564 | 1 | 0 | null | 2020-08-14T14:40:55 | 2020-08-14T14:40:54 | null | UTF-8 | C++ | false | false | 809 | cpp | class Solution {
public:
bool isAnagram(string s, string t) {
if (s.size() != t.size()) return false;
unordered_map<char, int> m;
for (char c: s) {
++m[c];
}
for (char c: t) {
if (m.count(c)) {
--m[c];
if (m[c] == 0) {
m.erase(c);
}
} else {
return false;
}
}
return true;
}
bool isAnagram1(string s, string t) {
if (s.size() != t.size()) return false;
unordered_map<char, int> m;
for (int i = 0; i < s.size(); ++i) {
m[s[i]]++;
m[t[i]]--;
}
for (auto c: m) {
if (m.second) return false;
}
return true;
}
}; | [
"yangming@bigbear.local"
] | yangming@bigbear.local |
7e849c944d6141777a7c272e70c8b8765d38885e | 837295fec3fcf5710cf7151708b81aa3117e45af | /AOAPC-BAC/Volume 6. Mathematical Concepts and Methods/UVa_10079.cpp | 1941b225d6359e9caaa98e99a8f209271fee1a62 | [] | no_license | WinDaLex/Programming | 45e56a61959352a7c666560df400966b7539939a | 55e71008133bb09d99252d6281abc30641c6e7e8 | refs/heads/master | 2020-05-31T00:45:24.916502 | 2015-04-13T18:19:36 | 2015-04-13T18:19:36 | 9,115,402 | 3 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 228 | cpp | // UVa 10079
// Pizza Cutting
// by A Code Rabbit
#include <cstdio>
typedef long long LL;
int N;
int main() {
while (scanf("%d", &N) && N >= 0) {
printf("%lld\n", (LL)N * (N + 1) / 2 + 1);
}
return 0;
}
| [
"fidd615@gmail.com"
] | fidd615@gmail.com |
054ee52e68bbaf3368129649d1d04f330f7441da | 9486c16ac3e6fca83c0da5e6ba4ca0127e1f9db4 | /src/include/FerNNClassifier.h | 097702a84e6782740268d0a715731d468b8d058b | [] | no_license | xmproject/xm_TLD | 2e0df6d9b5489e558c6d0368073d63b2bb253dc3 | 81830b543469583cf620b174fc97a35c5d024e4e | refs/heads/master | 2021-01-25T03:48:04.503919 | 2015-07-09T06:06:56 | 2015-07-09T06:06:56 | 37,763,546 | 3 | 2 | null | null | null | null | UTF-8 | C++ | false | false | 1,949 | h | /*
* FerNNClassifier.h
*
* Created on: Jun 14, 2011
* Author: alantrrs
*/
#include <opencv2/opencv.hpp>
#include <stdio.h>
class FerNNClassifier{
private:
float thr_fern;
int structSize;
int nstructs;
float valid;
float ncc_thesame;
float thr_nn;
int acum;
public:
//Parameters
float thr_nn_valid;
void read(int);
void prepare(const std::vector<cv::Size>& scales);
void getFeatures(const cv::Mat& image,const int& scale_idx,std::vector<int>& fern);
void update(const std::vector<int>& fern, int C, int N);
float measure_forest(std::vector<int> fern);
void trainF(const std::vector<std::pair<std::vector<int>,int> >& ferns,int resample);
void trainNN(const std::vector<cv::Mat>& nn_examples);
void NNConf(const cv::Mat& example,std::vector<int>& isin,float& rsconf,float& csconf);
void evaluateTh(const std::vector<std::pair<std::vector<int>,int> >& nXT,const std::vector<cv::Mat>& nExT);
void show();
//Ferns Members
int getNumStructs(){return nstructs;}
float getFernTh(){return thr_fern;}
float getNNTh(){return thr_nn;}
struct Feature
{
uchar x1, y1, x2, y2;
Feature() : x1(0), y1(0), x2(0), y2(0) {}
Feature(int _x1, int _y1, int _x2, int _y2)
: x1((uchar)_x1), y1((uchar)_y1), x2((uchar)_x2), y2((uchar)_y2)
{}
bool operator ()(const cv::Mat& patch) const
{ return patch.at<uchar>(y1,x1) > patch.at<uchar>(y2, x2); }
};
std::vector<std::vector<Feature> > features; //Ferns features (one std::vector for each scale)
std::vector< std::vector<int> > nCounter; //negative counter
std::vector< std::vector<int> > pCounter; //positive counter
std::vector< std::vector<float> > posteriors; //Ferns posteriors
float thrN; //Negative threshold
float thrP; //Positive thershold
//NN Members
std::vector<cv::Mat> pEx; //NN positive examples
std::vector<cv::Mat> nEx; //NN negative examples
};
| [
"xm_project@126.com"
] | xm_project@126.com |
fb3725c272c7dc3d893e328f2bad948e2848c5db | 79c77c4895687b69022439226c3fe6fa87f50232 | /7.2实验4/7.2实验4/7.2实验4View.h | a691caf7bac144ea54cd61a54cff1b04ac716b81 | [] | no_license | Zandbey/test1 | c57cec372d22905022d00436178a183cce1d694c | 75a7bf45f5f460a966afad68a11c31c8e013bc6d | refs/heads/master | 2022-11-12T11:32:40.078321 | 2020-07-02T04:34:08 | 2020-07-02T04:34:08 | 268,511,707 | 0 | 0 | null | null | null | null | GB18030 | C++ | false | false | 844 | h |
// 7.2实验4View.h : CMy72实验4View 类的接口
//
#pragma once
class CMy72实验4View : public CView
{
protected: // 仅从序列化创建
CMy72实验4View();
DECLARE_DYNCREATE(CMy72实验4View)
// 特性
public:
CMy72实验4Doc* GetDocument() const;
// 操作
public:
// 重写
public:
virtual void OnDraw(CDC* pDC); // 重写以绘制该视图
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
protected:
// 实现
public:
virtual ~CMy72实验4View();
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif
protected:
// 生成的消息映射函数
protected:
DECLARE_MESSAGE_MAP()
};
#ifndef _DEBUG // 7.2实验4View.cpp 中的调试版本
inline CMy72实验4Doc* CMy72实验4View::GetDocument() const
{ return reinterpret_cast<CMy72实验4Doc*>(m_pDocument); }
#endif
| [
"2279683584@qq.com"
] | 2279683584@qq.com |
f087fef2a28afd3d3b77347d633f472fa90d756c | 885d55099b1cc0a6b6cec77a6cf39e7294c3fa64 | /include/DTL/Board/WriteNumber.hpp | 8d40e779ac8f8348cebc1331c52286e16b759690 | [
"LicenseRef-scancode-unknown-license-reference",
"BSL-1.0"
] | permissive | kariya-mitsuru/DungeonTemplateLibrary | c430c0ebeeb43cbcb720c8a1321761f46add00ec | 16515ee7859b3ba28e150fda11414d091ed6cb07 | refs/heads/master | 2020-05-20T01:19:36.955100 | 2019-07-21T16:03:47 | 2019-07-21T16:03:47 | 185,308,920 | 0 | 0 | BSL-1.0 | 2019-05-07T02:50:15 | 2019-05-07T02:50:15 | null | UTF-8 | C++ | false | false | 23,005 | hpp | /*#######################################################################################
Copyright (c) 2017-2019 Kasugaccho
Copyright (c) 2018-2019 As Project
https://github.com/Kasugaccho/DungeonTemplateLibrary
wanotaitei@gmail.com
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#######################################################################################*/
#ifndef INCLUDED_DUNGEON_TEMPLATE_LIBRARY_DTL_BOARD_WRITE_NUMBER_HPP
#define INCLUDED_DUNGEON_TEMPLATE_LIBRARY_DTL_BOARD_WRITE_NUMBER_HPP
#include <DTL/Workaround/cstdioGets.hpp> //Support Clang 3.4.2
#include <sstream>
#include <string>
#include <DTL/Base/Struct.hpp>
#include <DTL/Macros/constexpr.hpp>
#include <DTL/Macros/nodiscard.hpp>
#include <DTL/Type/Forward.hpp>
#include <DTL/Type/SizeT.hpp>
#include <DTL/Utility/IsOutputCast.hpp>
/*#######################################################################################
[概要] "dtl名前空間"とは"DungeonTemplateLibrary"の全ての機能が含まれる名前空間である。
[Summary] The "dtl" is a namespace that contains all the functions of "DungeonTemplateLibrary".
#######################################################################################*/
namespace dtl {
inline namespace board { //"dtl::board"名前空間に属する
//四角形の生成
template<typename Matrix_Int_, typename OutputChar_ = char>
class WriteNumber {
private:
///// エイリアス (Alias) /////
using Index_Size = ::dtl::type::size;
using OutputString_ = ::std::basic_string<OutputChar_>;
using OutputStream_ = ::std::basic_stringstream<OutputChar_>;
///// メンバ変数 (Member Variable) /////
Index_Size start_x{};
Index_Size start_y{};
Index_Size width{};
Index_Size height{};
OutputString_ draw_string{};
OutputString_ before_draw_string{};
OutputString_ new_line_string{};
///// 代入処理 /////
template<typename Matrix_>
DTL_VERSIONING_CPP14_CONSTEXPR
inline void outputSTL(const Matrix_& matrix_, const Index_Size point_x_, const Index_Size point_y_, OutputString_& string_) const noexcept {
OutputStream_ stream_{};
stream_ << this->before_draw_string << ((::dtl::utility::isOutputCast<Matrix_Int_>()) ? static_cast<int>(matrix_[point_y_][point_x_]) : matrix_[point_y_][point_x_]) << this->draw_string;
string_ += stream_.str();
}
template<typename Matrix_>
DTL_VERSIONING_CPP14_CONSTEXPR
inline void outputArray(const Matrix_& matrix_, const Index_Size point_x_, const Index_Size point_y_, const Index_Size max_x_, OutputString_& string_) const noexcept {
OutputStream_ stream_{};
stream_ << this->before_draw_string << ((::dtl::utility::isOutputCast<Matrix_Int_>()) ? static_cast<int>(matrix_[point_y_ * max_x_ + point_x_]) : matrix_[point_y_ * max_x_ + point_x_]) << this->draw_string;
string_ += stream_.str();
}
template<typename Matrix_>
DTL_VERSIONING_CPP14_CONSTEXPR
inline void outputLayer(const Matrix_& matrix_, const Index_Size layer_, const Index_Size point_x_, const Index_Size point_y_, OutputString_& string_) const noexcept {
OutputStream_ stream_{};
stream_ << this->before_draw_string << ((::dtl::utility::isOutputCast<Matrix_Int_>()) ? static_cast<int>(matrix_[point_y_][point_x_][layer_]) : matrix_[point_y_][point_x_][layer_]) << this->draw_string;
string_ += stream_.str();
}
template<typename Matrix_Value_>
DTL_VERSIONING_CPP14_CONSTEXPR
inline void outputList(const Matrix_Value_& matrix_, OutputString_& string_) const noexcept {
OutputStream_ stream_{};
stream_ << this->before_draw_string << ((::dtl::utility::isOutputCast<Matrix_Int_>()) ? static_cast<int>(matrix_) : matrix_) << this->draw_string;
string_ += stream_.str();
}
///// 基本処理 /////
//STL
template<typename Matrix_>
bool drawSTL(const Matrix_ & matrix_, const Index_Size end_y_, OutputString_& string_) const noexcept {
for (Index_Size row{ this->start_y }; row < end_y_; ++row) {
for (Index_Size col{ this->start_x }; col < matrix_[row].size(); ++col)
this->outputSTL(matrix_, col, row, string_);
string_ += this->new_line_string;
}
return true;
}
template<typename Matrix_>
bool drawWidthSTL(const Matrix_ & matrix_, const Index_Size end_x_, const Index_Size end_y_, OutputString_& string_) const noexcept {
for (Index_Size row{ this->start_y }; row < end_y_; ++row) {
for (Index_Size col{ this->start_x }; col < matrix_[row].size() && col < end_x_; ++col)
this->outputSTL(matrix_, col, row, string_);
string_ += this->new_line_string;
}
return true;
}
//LayerSTL
template<typename Matrix_>
bool drawLayerSTL(const Matrix_ & matrix_, const Index_Size layer_, const Index_Size end_y_, OutputString_& string_) const noexcept {
for (Index_Size row{ this->start_y }; row < end_y_; ++row) {
for (Index_Size col{ this->start_x }; col < matrix_[row].size(); ++col)
this->outputLayer(matrix_, layer_, col, row, string_);
string_ += this->new_line_string;
}
return true;
}
template<typename Matrix_>
bool drawLayerWidthSTL(const Matrix_ & matrix_, const Index_Size layer_, const Index_Size end_x_, const Index_Size end_y_, OutputString_& string_) const noexcept {
for (Index_Size row{ this->start_y }; row < end_y_; ++row) {
for (Index_Size col{ this->start_x }; col < matrix_[row].size() && col < end_x_; ++col)
this->outputLayer(matrix_, layer_, col, row, string_);
string_ += this->new_line_string;
}
return true;
}
//Normal
template<typename Matrix_>
bool drawNormal(const Matrix_ & matrix_, const Index_Size end_x_, const Index_Size end_y_, OutputString_& string_) const noexcept {
for (Index_Size row{ this->start_y }; row < end_y_; ++row) {
for (Index_Size col{ this->start_x }; col < end_x_; ++col)
this->outputSTL(matrix_, col, row, string_);
string_ += this->new_line_string;
}
return true;
}
//LayerNormal
template<typename Matrix_>
bool drawLayerNormal(const Matrix_ & matrix_, const Index_Size layer_, const Index_Size end_x_, const Index_Size end_y_, OutputString_& string_) const noexcept {
for (Index_Size row{ this->start_y }; row < end_y_; ++row) {
for (Index_Size col{ this->start_x }; col < end_x_; ++col)
this->outputLayer(matrix_, layer_, col, row, string_);
string_ += this->new_line_string;
}
return true;
}
//Array
template<typename Matrix_>
bool drawArray(const Matrix_ & matrix_, const Index_Size end_x_, const Index_Size end_y_, const Index_Size max_x_, OutputString_& string_) const noexcept {
for (Index_Size row{ this->start_y }; row < end_y_; ++row) {
for (Index_Size col{ this->start_x }; col < end_x_; ++col)
this->outputArray(matrix_, col, row, max_x_, string_);
string_ += this->new_line_string;
}
return true;
}
//List
template<typename Matrix_>
bool drawList(const Matrix_ & matrix_, const Index_Size end_x_, const Index_Size end_y_, OutputString_& string_) const noexcept {
::dtl::type::size row_count{}, col_count{};
for (const auto& row : matrix_) {
++row_count;
if (row_count <= this->start_y) continue;
if (end_y_ != 1 && row_count >= end_y_) break;
col_count = 0;
for (const auto& col : row) {
++col_count;
if (col_count <= this->start_x) continue;
if (end_x_ != 1 && col_count >= end_x_) break;
this->outputList(col, string_);
}
string_ += this->new_line_string;
}
return true;
}
public:
///// メンバ変数の値を取得 (Get Value) /////
/*#######################################################################################
[概要] 描画始点座標Xを取得する。
[戻り値] 戻り値の型は std::size_t である。
[Summary] Gets the drawing start point coordinate X.
[Return value] The return type is std::size_t.
#######################################################################################*/
DTL_VERSIONING_CPP17_NODISCARD
constexpr Index_Size getPointX() const noexcept {
return this->start_x;
}
/*#######################################################################################
[概要] 描画始点座標Yを取得する。
[戻り値] 戻り値の型は std::size_t である。
[Summary] Gets the drawing start point coordinate Y.
[Return value] The return type is std::size_t.
#######################################################################################*/
DTL_VERSIONING_CPP17_NODISCARD
constexpr Index_Size getPointY() const noexcept {
return this->start_y;
}
/*#######################################################################################
[概要] 描画横幅Wを取得する。
[戻り値] 戻り値の型は std::size_t である。
[Summary] Gets the drawing width.
[Return value] The return type is std::size_t.
#######################################################################################*/
DTL_VERSIONING_CPP17_NODISCARD
constexpr Index_Size getWidth() const noexcept {
return this->width;
}
/*#######################################################################################
[概要] 描画縦幅Hを取得する。
[戻り値] 戻り値の型は std::size_t である。
[Summary] Gets the drawing height.
[Return value] The return type is std::size_t.
#######################################################################################*/
DTL_VERSIONING_CPP17_NODISCARD
constexpr Index_Size getHeight() const noexcept {
return this->height;
}
///// 生成呼び出し (Drawing Function Call) /////
//STL
template<typename Matrix_>
bool draw(const Matrix_ & matrix_, OutputString_& string_) const noexcept {
return (this->width == 0) ? this->drawSTL(matrix_, (this->height == 0 || this->start_y + this->height >= matrix_.size()) ? matrix_.size() : this->start_y + this->height, string_) : this->drawWidthSTL(matrix_, this->start_x + this->width, (this->height == 0 || this->start_y + this->height >= matrix_.size()) ? matrix_.size() : this->start_y + this->height, string_);
}
//LayerSTL
template<typename Matrix_>
bool draw(const Matrix_ & matrix_, const Index_Size layer_, OutputString_& string_) const noexcept {
return (this->width == 0) ? this->drawLayerSTL(matrix_, layer_, (this->height == 0 || this->start_y + this->height >= matrix_.size()) ? matrix_.size() : this->start_y + this->height, string_) : this->drawLayerWidthSTL(matrix_, layer_, this->start_x + this->width, (this->height == 0 || this->start_y + this->height >= matrix_.size()) ? matrix_.size() : this->start_y + this->height, string_);
}
//Normal
template<typename Matrix_>
bool draw(const Matrix_ & matrix_, const Index_Size max_x_, const Index_Size max_y_, OutputString_& string_) const noexcept {
return this->drawNormal(matrix_, (this->width == 0 || this->start_x + this->width >= max_x_) ? max_x_ : this->start_x + this->width, (this->height == 0 || this->start_y + this->height >= max_y_) ? max_y_ : this->start_y + this->height, string_);
}
//LayerNormal
template<typename Matrix_>
bool draw(const Matrix_ & matrix_, const Index_Size layer_, const Index_Size max_x_, const Index_Size max_y_, OutputString_& string_) const noexcept {
return this->drawLayerNormal(matrix_, layer_, (this->width == 0 || this->start_x + this->width >= max_x_) ? max_x_ : this->start_x + this->width, (this->height == 0 || this->start_y + this->height >= max_y_) ? max_y_ : this->start_y + this->height, string_);
}
//Array
template<typename Matrix_>
bool drawArray(const Matrix_ & matrix_, const Index_Size max_x_, const Index_Size max_y_, OutputString_& string_) const noexcept {
return this->drawArray(matrix_, (this->width == 0 || this->start_x + this->width >= max_x_) ? max_x_ : this->start_x + this->width, (this->height == 0 || this->start_y + this->height >= max_y_) ? max_y_ : this->start_y + this->height, max_x_, string_);
}
//List
template<typename Matrix_>
bool drawList(const Matrix_ & matrix_, OutputString_& string_) const noexcept {
return this->drawList(matrix_, this->start_x + this->width + 1, this->start_y + this->height + 1, string_);
}
///// 生成呼び出しファンクタ (Drawing Functor) /////
template<typename Matrix_, typename ...Args_>
constexpr bool operator()(const Matrix_ & matrix_, Args_ && ... args_) const noexcept {
return this->draw(matrix_, DTL_TYPE_FORWARD<Args_>(args_)...);
}
///// ダンジョン行列生成 (Create Dungeon Matrix) /////
template<typename Matrix_, typename ...Args_>
DTL_VERSIONING_CPP14_CONSTEXPR
Matrix_&& create(Matrix_ && matrix_, Args_ && ... args_) const noexcept {
this->draw(matrix_, DTL_TYPE_FORWARD<Args_>(args_)...);
return DTL_TYPE_FORWARD<Matrix_>(matrix_);
}
template<typename Matrix_, typename ...Args_>
DTL_VERSIONING_CPP14_CONSTEXPR
Matrix_&& createArray(Matrix_ && matrix_, Args_ && ... args_) const noexcept {
this->drawArray(matrix_, DTL_TYPE_FORWARD<Args_>(args_)...);
return DTL_TYPE_FORWARD<Matrix_>(matrix_);
}
///// 消去 (Clear) /////
/*#######################################################################################
[概要] 描画始点座標Xを初期値に戻す(描画始点座標Xを消去する)。
[戻り値] 戻り値の型は 当クラスの参照値 である。
[Summary] Resets the drawing start coordinate X to the initial value (deletes the drawing start coordinate X).
[Return value] The return type is a reference value of this class.
#######################################################################################*/
DTL_VERSIONING_CPP14_CONSTEXPR
WriteNumber& clearPointX() noexcept {
this->start_x = 0;
return *this;
}
/*#######################################################################################
[概要] 描画始点座標Yを初期値に戻す(描画始点座標Yを消去する)。
[戻り値] 戻り値の型は 当クラスの参照値 である。
[Summary] Resets the drawing start coordinate Y to the initial value (deletes the drawing start coordinate Y).
[Return value] The return type is a reference value of this class.
#######################################################################################*/
DTL_VERSIONING_CPP14_CONSTEXPR
WriteNumber& clearPointY() noexcept {
this->start_y = 0;
return *this;
}
/*#######################################################################################
[概要] 範囲の大きさ(X軸方向)を初期値に戻す(描画横幅Wを消去する)。
[戻り値] 戻り値の型は 当クラスの参照値 である。
[Summary] Resets the width of the range (X axis direction) to the initial value (deletes the drawing width).
[Return value] The return type is a reference value of this class.
#######################################################################################*/
DTL_VERSIONING_CPP14_CONSTEXPR
WriteNumber& clearWidth() noexcept {
this->width = 0;
return *this;
}
/*#######################################################################################
[概要] 範囲の大きさ(Y軸方向)を初期値に戻す(描画縦幅Hを消去する)。
[戻り値] 戻り値の型は 当クラスの参照値 である。
[Summary] Resets the height of the range (Y axis direction) to the initial value (deletes the drawing height).
[Return value] The return type is a reference value of this class.
#######################################################################################*/
DTL_VERSIONING_CPP14_CONSTEXPR
WriteNumber& clearHeight() noexcept {
this->height = 0;
return *this;
}
/*#######################################################################################
[概要] 描画始点座標(X,Y)を初期値に戻す(描画始点座標(X,Y)を消去する)。
[戻り値] 戻り値の型は 当クラスの参照値 である。
[Summary] Resets the drawing start coordinate (X, Y) to the initial value (deletes the drawing start coordinate (X, Y)).
[Return value] The return type is a reference value of this class.
#######################################################################################*/
DTL_VERSIONING_CPP14_CONSTEXPR
WriteNumber& clearPoint() noexcept {
this->clearPointX();
this->clearPointY();
return *this;
}
/*#######################################################################################
[概要] 描画範囲を初期値に戻す(描画範囲(X,Y,W,H)を消去する)。
[戻り値] 戻り値の型は 当クラスの参照値 である。
[Summary] Resets the drawing range to the initial value (deletes the drawing range (X, Y, W, H)).
[Return value] The return type is a reference value of this class.
#######################################################################################*/
DTL_VERSIONING_CPP14_CONSTEXPR
WriteNumber& clearRange() noexcept {
this->clearPointX();
this->clearPointY();
this->clearWidth();
this->clearHeight();
return *this;
}
/*#######################################################################################
[概要] 全ての値を初期値に戻す。
[戻り値] 戻り値の型は 当クラスの参照値 である。
[Summary] Reset all values to their initial values.
[Return value] The return type is a reference value of this class.
#######################################################################################*/
DTL_VERSIONING_CPP14_CONSTEXPR
WriteNumber& clear() noexcept {
this->clearRange();
return *this;
}
///// 代入 /////
DTL_VERSIONING_CPP14_CONSTEXPR
WriteNumber& setPointX(const Index_Size start_x_) noexcept {
this->start_x = start_x_;
return *this;
}
DTL_VERSIONING_CPP14_CONSTEXPR
WriteNumber& setPointY(const Index_Size start_y_) noexcept {
this->start_y = start_y_;
return *this;
}
DTL_VERSIONING_CPP14_CONSTEXPR
WriteNumber& setWidth(const Index_Size width_) noexcept {
this->width = width_;
return *this;
}
DTL_VERSIONING_CPP14_CONSTEXPR
WriteNumber& setHeight(const Index_Size height_) noexcept {
this->height = height_;
return *this;
}
DTL_VERSIONING_CPP14_CONSTEXPR
WriteNumber& setPoint(const Index_Size point_) noexcept {
this->start_x = point_;
this->start_y = point_;
return *this;
}
DTL_VERSIONING_CPP14_CONSTEXPR
WriteNumber& setPoint(const Index_Size start_x_, const Index_Size start_y_) noexcept {
this->start_x = start_x_;
this->start_y = start_y_;
return *this;
}
DTL_VERSIONING_CPP14_CONSTEXPR
WriteNumber& setRange(const Index_Size start_x_, const Index_Size start_y_, const Index_Size length_) noexcept {
this->start_x = start_x_;
this->start_y = start_y_;
this->width = length_;
this->height = length_;
return *this;
}
DTL_VERSIONING_CPP14_CONSTEXPR
WriteNumber& setRange(const Index_Size start_x_, const Index_Size start_y_, const Index_Size width_, const Index_Size height_) noexcept {
this->start_x = start_x_;
this->start_y = start_y_;
this->width = width_;
this->height = height_;
return *this;
}
DTL_VERSIONING_CPP14_CONSTEXPR
WriteNumber& setRange(const ::dtl::base::MatrixRange & matrix_range_) noexcept {
this->start_x = matrix_range_.x;
this->start_y = matrix_range_.y;
this->width = matrix_range_.w;
this->height = matrix_range_.h;
return *this;
}
///// コンストラクタ (Constructor) /////
WriteNumber() = default;
constexpr explicit WriteNumber(const OutputString_& new_line_string_) noexcept
:new_line_string(new_line_string_) {}
constexpr WriteNumber(const OutputString_& new_line_string_, const OutputString_& draw_string_) noexcept
:new_line_string(new_line_string_), draw_string(draw_string_) {}
constexpr WriteNumber(const OutputString_& new_line_string_, const OutputString_ & before_draw_string_, const OutputString_ & draw_string_) noexcept
:new_line_string(new_line_string_), draw_string(draw_string_), before_draw_string(before_draw_string_) {}
constexpr explicit WriteNumber(const ::dtl::base::MatrixRange & matrix_range_)
: start_x(matrix_range_.x), start_y(matrix_range_.y),
width(matrix_range_.w), height(matrix_range_.h) {}
constexpr WriteNumber(const ::dtl::base::MatrixRange& matrix_range_, const OutputString_& new_line_string_) noexcept
:start_x(matrix_range_.x), start_y(matrix_range_.y),
width(matrix_range_.w), height(matrix_range_.h), new_line_string(new_line_string_) {}
constexpr WriteNumber(const ::dtl::base::MatrixRange & matrix_range_, const OutputString_& new_line_string_, const OutputString_ & draw_string_) noexcept
:start_x(matrix_range_.x), start_y(matrix_range_.y),
width(matrix_range_.w), height(matrix_range_.h), new_line_string(new_line_string_), draw_string(draw_string_) {}
constexpr WriteNumber(const ::dtl::base::MatrixRange & matrix_range_, const OutputString_& new_line_string_, const OutputString_ & before_draw_string_, const OutputString_ & draw_string_) noexcept
:start_x(matrix_range_.x), start_y(matrix_range_.y),
width(matrix_range_.w), height(matrix_range_.h), new_line_string(new_line_string_), draw_string(draw_string_), before_draw_string(before_draw_string_) {}
constexpr WriteNumber(const Index_Size start_x_, const Index_Size start_y_, const Index_Size width_, const Index_Size height_) noexcept
:start_x(start_x_), start_y(start_y_),
width(width_), height(height_) {}
constexpr WriteNumber(const Index_Size start_x_, const Index_Size start_y_, const Index_Size width_, const Index_Size height_, const OutputString_& new_line_string_) noexcept
:start_x(start_x_), start_y(start_y_),
width(width_), height(height_),
new_line_string(new_line_string_) {}
constexpr WriteNumber(const Index_Size start_x_, const Index_Size start_y_, const Index_Size width_, const Index_Size height_, const OutputString_& new_line_string_, const OutputString_ & draw_string_) noexcept
:start_x(start_x_), start_y(start_y_),
width(width_), height(height_),
new_line_string(new_line_string_), draw_string(draw_string_) {}
constexpr WriteNumber(const Index_Size start_x_, const Index_Size start_y_, const Index_Size width_, const Index_Size height_, const OutputString_& new_line_string_, const OutputString_ & before_draw_string_, const OutputString_ & draw_string_) noexcept
:start_x(start_x_), start_y(start_y_),
width(width_), height(height_),
new_line_string(new_line_string_), draw_string(draw_string_), before_draw_string(before_draw_string_) {}
};
}
}
#endif //Included Dungeon Template Library | [
"30593725+Kasugaccho@users.noreply.github.com"
] | 30593725+Kasugaccho@users.noreply.github.com |
e54f33db8972aa2ab32a13694190fdaa6de18efc | 5f9c178b83d4168e950b1c5d96d666c556faa1fe | /s3l2/ball.cpp | 345c45ae96719a9bc8a3c7053887ded99ae3d6d8 | [] | no_license | StakeIf/s3l2 | 9244a74d5cb765ce169c55cff2f0602a6cf0cd0c | 08db141231110117bbc4630446d45d2309638477 | refs/heads/master | 2023-08-25T01:27:01.229420 | 2021-10-12T03:03:19 | 2021-10-12T03:03:19 | 416,163,379 | 0 | 0 | null | null | null | null | WINDOWS-1251 | C++ | false | false | 1,137 | cpp | #include "ball.h"
//Инициализация
Ball ball_init(int x, int y, int col) {
Ball ball1;
ball1.x = x;
ball1.y = y;
ball1.colour = col;
return ball1;
}
//Ввод
Ball ball_vvod() {
Ball ball1;
printf("Please, write the x-coordinate of the ball: ");
scanf("%d", &ball1.x);
printf("Please, write the y-coordinate of the ball: ");
scanf("%d", &ball1.y);
printf("Please, write the colour of the ball (1 - white, 2 - red, 3 - blue): ");
scanf("%d", &ball1.colour);
return ball1;
}
//Вывод
void ball_vivod(Ball ball1) {
printf("\nBall data:\n\n X = %d\n Y = %d", ball1.x, ball1.y);
if (ball1.colour == 1)
printf("\n Colour - white\n");
if (ball1.colour == 2)
printf("\n Colour - red\n");
if (ball1.colour == 3)
printf("\n Colour - blue\n");
}
//Сделать шаг
Ball ball_move(Ball ball1) {
printf("Press \n 'D' to increase the x value \n 'A' to decrease the x value\n 'W' to increase the y value\n 'S' to decrease the y value\n");
char key = _getch();
if (key == 'a')
ball1.x--;
if (key == 'd')
ball1.x++;
if (key == 'w')
ball1.y++;
if (key == 's')
ball1.y--;
return ball1;
} | [
"krasnov2002kolya@mail.ru"
] | krasnov2002kolya@mail.ru |
347037f4f3113311bb3ebb9105f10bd662da2c9a | 848f2b64ed1c77850bb46324f8ea92c1aeb78efd | /exampleClient.cpp | 88d75cc391b9be65b0c0d163acf3c54dac5ebf9e | [] | no_license | mezzode/StreamBase | 26ff0fee37afcfe726ab75607586349455dd55fc | dc874cc40f4bcfb0c701ab27441e54cb2387b676 | refs/heads/master | 2020-09-07T08:00:20.004092 | 2019-11-12T05:02:33 | 2019-11-12T05:02:33 | 220,715,648 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 643 | cpp | #include "client.h"
#include "CustomClass.h"
using namespace std;
int main()
{
cout << "I am the client." << endl;
send("mykey", 42);
auto data{ get<int>("mykey") };
cout << data << endl;
send("foo", string{ "bar" });
cout << get<string>("foo") << endl;
CustomClass custom{ 10, 20 };
custom.incrementA();
custom.incrementB();
send("mycustomclass", custom);
auto savedCustom{ get<CustomClass>("mycustomclass") };
savedCustom.incrementA();
savedCustom.incrementB();
cout << savedCustom.getA() << endl << savedCustom.getB() << endl;
// should output 12 and 22
getchar(); // wait before closing
}
| [
"toranos@gmail.com"
] | toranos@gmail.com |
c8612a9f5e621fe6af04d3d769785313abfca2e2 | e6c2511e7828ee8627f301985d5cc942d6c16eeb | /.vim/c-support/codesnippets/stl/sort/stl_stable_sort.cc | 7fbcf565b1696b349a0575e01052bd0bbc02cd56 | [] | no_license | wangkangluo1/vim | f6aa964e77579dfb1b76cce0e8e137ceab3a2297 | 269aab7844d18b915d77caa90ef1574bd7ba76f9 | refs/heads/master | 2021-01-19T11:03:27.629144 | 2012-05-22T18:18:02 | 2012-05-22T18:18:02 | 2,288,212 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,709 | cc | /*
* =====================================================================================
*
* Filename: test.c
*
* Description:
*
* Version: 1.0
* Created: 04/05/2012 03:40:40 AM
* Revision: none
* Compiler: gcc
*
* Author: kangle.wang (mn), wangkangluo1@gmail.com
* Company: APE-TECH
*
* =====================================================================================
*/
#include <iostream>
#include <algorithm>
#include <ctime>
#include <vector>
extern "C"
{
#include <errno.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/time.h>
#include <unistd.h>
}
/*
* === FUNCTION ======================================================================
* Name: main
* Description: main function
* =====================================================================================
*/
#define STR_LENS 1000000
using namespace std;
int
main ( int argc, char *argv[] )
{
vector<long> vec_list;
FILE *stream;
stream = fopen("test.db", "r");
long long i;
for(i = 0; i < STR_LENS; i++)
{
long ss;
fscanf(stream, "%ld", &ss);
vec_list.push_back(ss);
}
fclose(stream);
struct timeval tv1, tv2;
double sec = 0;
gettimeofday(&tv1, 0);
//sort
stable_sort(vec_list.begin(), vec_list.end(), less<long>());
gettimeofday(&tv2, 0);
sec = (double)(tv2.tv_sec - tv1.tv_sec) + (double)(tv2.tv_usec - tv1.tv_usec) / 1000000;
printf("stable_sort: %f\n", sec);
cout<<vec_list[100]<<endl;
return EXIT_SUCCESS;
} /* ---------- end of function main ---------- */
| [
"root@wangkangle.com"
] | root@wangkangle.com |
f26d7837467f0f4fcf447cff1f44aabdc59b666f | e088c33edee63a396902296f3627c4cab95429f0 | /Vocabulary.hpp | 32a730f197258469aae56aab2f8b7bd8d9c32074 | [] | no_license | ifplusor/W2VServer | 06340c52d7775de868be622924427ac3ea853a9e | a30ad298a9a3da47501bc388d2a9ee39018c5fa6 | refs/heads/master | 2021-01-21T12:52:53.657401 | 2017-09-03T23:06:28 | 2017-09-03T23:06:28 | 102,104,096 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 3,758 | hpp | //
// Created by james on 9/1/17.
//
#ifndef __W2V_VOCABULARY_HPP__
#define __W2V_VOCABULARY_HPP__
#include <string.h>
#include <CF/StrPtrLen.h>
#include "types.h"
#include "Sampler.hpp"
using namespace CF;
class Word : public Countable {
public:
static ull GetWordHash(char *word) {
ull hash = 0;
for (size_t a = 0; a < ::strlen(word); a++)
hash = hash * 257 + word[a];
return hash;
}
static ull GetWordHash(StrPtrLen &word) {
ull hash = 0;
for (size_t a = 0; a < word.Len; a++)
hash = hash * 257 + word[a];
return hash;
}
Word(char *word)
: Countable(), fWord(nullptr), fLen(0), fHash(0) {
fLen = ::strlen(word);
fWord = new char[fLen + 1];
::strcpy(fWord, word);
fHash = GetWordHash(fWord);
}
~Word() { delete[] fWord; }
size_t GetLength() { return fLen; }
ull GetHashCode() { return fHash; }
char *operator*() { return fWord; }
char operator[](size_t i) { return fWord[i]; }
private:
char *fWord;
size_t fLen;
ull fHash;
};
class Vocabulary : public SampleSet<Word> {
public:
enum {
kMinVocabSize = 1000,
};
Vocabulary(size_t size = kMinVocabSize)
: fWords(nullptr), fLen(0), fSize(size) {
fWords = new Word *[fSize];
}
~Vocabulary() {
for (size_t i = 0; i < fLen; i++) {
delete fWords[i];
}
delete[] fWords;
}
/**
* @note Vocabulary will manager word's memory.
*/
size_t InsertWord(Word *word) {
// extern memory
if (fLen == fSize) {
auto tmp = new Word *[fSize * 2];
::memcpy(tmp, fWords, sizeof(Word *) * fSize);
fSize <<= 1;
}
fWords[fLen] = word;
return fLen++;
}
size_t InsertWord(char *word) {
return InsertWord(new Word(word));
}
size_t GetLength() override { return fLen; }
Word &operator[](size_t i) override {
return *fWords[i];
}
private:
Word **fWords;
size_t fLen;
size_t fSize;
};
class VocabHash {
public:
enum {
kMinBucketSize = 2000,
};
VocabHash(size_t size = kMinBucketSize)
: fVocab(), fHashBucket(nullptr), fBucketSize(size) {
fVocab.InsertWord("\n");
fHashBucket = new size_t[fBucketSize + 1];
::memset(fHashBucket, 0, sizeof(size_t) * (fBucketSize + 1));
}
~VocabHash() { delete fHashBucket; }
void InsertWord(char *word) {
// extend memory
if (fVocab.GetLength() * 1.5 >= fBucketSize) {
auto tmp = new size_t[fBucketSize * 2 + 1];
fHashBucket = tmp;
fBucketSize <<= 1;
rebuildHash();
}
size_t idx = Word::GetWordHash(word) % fBucketSize;
while (fHashBucket[idx] != 0) {
if (::strcmp(word, *fVocab[fHashBucket[idx]]) == 0) return;
idx++;
};
fHashBucket[idx] = fVocab.InsertWord(word);
}
size_t GetLength() { return fVocab.GetLength(); }
size_t operator[](char *word) {
size_t idx = Word::GetWordHash(word) % fBucketSize;
while (fHashBucket[idx] != 0) {
if (::strcmp(word, *fVocab[fHashBucket[idx]]) == 0)
return fHashBucket[idx];
idx++;
};
return 0;
}
size_t operator[](StrPtrLen &word) {
size_t idx = Word::GetWordHash(word) % fBucketSize;
while (fHashBucket[idx] != 0) {
if (word.Equal(*fVocab[fHashBucket[idx]]))
return fHashBucket[idx];
idx++;
};
return 0;
}
private:
void rebuildHash() {
::memset(fHashBucket, 0, sizeof(size_t) * (fBucketSize + 1));
for (size_t i = 1; i < fVocab.GetLength(); i++) {
size_t idx = fVocab[i].GetHashCode() % fBucketSize;
while (fHashBucket[idx] != 0) idx++;
fHashBucket[idx] = i;
}
}
Vocabulary fVocab;
size_t *fHashBucket; // last element must 0
size_t fBucketSize; // equal sizeof(fHashBucket)-1
};
#endif //__W2V_VOCABULARY_HPP__
| [
"ywhjames@hotmail.com"
] | ywhjames@hotmail.com |
e6e453311314acaf21aaf59b040ca23f4d191607 | df80f3a339a6bdf7f91ecf694264077b355e9463 | /libraries/chain/include/cps/chain/multi_index_includes.hpp | 26d88ada28c19542d11513a581287652e710afb6 | [
"MIT"
] | permissive | huangjimmy/coinio | 69762447b0d6732c36ecb3fef015be8e592daf80 | 54bc7c3e1259888361b82805d894322d01a4bc0c | refs/heads/master | 2021-05-11T20:19:30.742745 | 2018-01-18T04:53:53 | 2018-01-18T04:53:53 | 117,438,202 | 1 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 547 | hpp | /**
* @file
* @copyright defined in cps/LICENSE.txt
*/
#pragma once
#include <boost/multi_index_container.hpp>
#include <boost/multi_index/member.hpp>
#include <boost/multi_index/mem_fun.hpp>
#include <boost/multi_index/composite_key.hpp>
#include <boost/multi_index/ordered_index.hpp>
namespace bmi = boost::multi_index;
using bmi::indexed_by;
using bmi::ordered_unique;
using bmi::ordered_non_unique;
using bmi::composite_key;
using bmi::member;
using bmi::const_mem_fun;
using bmi::tag;
using bmi::composite_key_compare;
struct by_id;
| [
"jimmy_huang@live.com"
] | jimmy_huang@live.com |
dc5ccec2d91aa54a2b30812d5cd24784c0ad97b1 | 046a59f161ddf6593ff71b8fad408d8d612da41d | /NUSBot/src/NUSBot/Source/Logger.h | 962b610ebcb146b4ba0acfba8c0fff286b3ea65f | [] | no_license | andertavares/nus-bot | 9eb9260848c7dac0cb27d1dc481f0810c2953652 | 3bb921c280a11eb7bc219d00ce3395a1a39015dc | refs/heads/master | 2020-12-31T07:43:56.966734 | 2016-12-22T20:43:04 | 2016-12-22T20:43:04 | 58,272,536 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 293 | h | #pragma once
#include "Common.h"
#include "BWTA.h"
#include <fstream>
class Logger {
std::ofstream logStream;
std::string logFile;
Logger();
public:
static Logger & Instance();
void log(const std::string & msg);
void setLogFile(const std::string & filename);
};
| [
"francisco.liwa@gmail.com"
] | francisco.liwa@gmail.com |
eff3c17fe45c10a0095652735c5d1286fcc70c00 | 76345ba7c116666dff6b8471dde55faf7144f0e7 | /Demo/Audio/audio.cpp | 91055027e3e8cb261c3a4ce9f090301373254832 | [] | no_license | Arvinnli/MyC-C-Practice-code | 3ab460731024fa5ecaa95912a8e06e6223e18fe4 | 3fd716b9d9c2f63c890f73c5c70ccee53e7ae713 | refs/heads/master | 2021-01-25T13:11:50.221651 | 2018-12-25T01:53:33 | 2018-12-25T01:53:33 | 123,540,947 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,062 | cpp | #include <windows.h>
#include <iostream>
#include <tlhelp32.h>
using namespace std;
int GetProcessCount(const TCHAR *szExeName)
{
TCHAR sztarget[MAX_PATH];
lstrcpy(sztarget, szExeName);
CharLowerBuff(sztarget, MAX_PATH);
int count = 0;
PROCESSENTRY32 my;
HANDLE l = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
if ((l) != INVALID_HANDLE_VALUE )
{
my.dwSize = sizeof(my);
if (Process32First(l, &my))
{
do
{
CharLowerBuff(my.szExeFile, MAX_PATH);
if (lstrcmp(sztarget, my.szExeFile) == 0)
{
count++;
}
} while (Process32Next(l, &my));
}
CloseHandle(l);
}
return count;
}
int main(int argc, char *argv[])
{
#ifdef UNICODE
if (GetProcessCount(L"abcdef.exe") > 0)
#else
if (GetProcessCount("PotPlayerMini.exe") > 0)
#endif
{
cout << "Running!.." << endl;
}
else
{
cout << "Not Running!.." << endl;
}
return 0;
} | [
"arvinn.li@spreadtrum.com"
] | arvinn.li@spreadtrum.com |
96585c36391db0eaadcae65bf59a5b017e8e9d44 | 7e206171aff10918b71adf2ed7c85d68558d6b39 | /examples/ME/qcd_4j/P0_Sigma_sm_uu_uuccx_qcd_4j.cc | edbe8ece8ca1b23085f20c73bc0fd7e99b593ec6 | [] | no_license | matt-komm/momenta | 934d62f407abcce25e7c813c0ae9002d308f09cf | c52c63fad5ab38dc54e71636f3182d5fbcd308bc | refs/heads/master | 2021-01-01T05:31:11.499532 | 2014-04-01T20:01:29 | 2014-04-01T20:01:29 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 11,383 | cc | //==========================================================================
// This file has been automatically generated for C++ Standalone by
// MadGraph 5 v. 2.0.0.beta3, 2013-02-14
// By the MadGraph Development Team
// Please visit us at https://launchpad.net/madgraph5
//==========================================================================
#include "P0_Sigma_sm_uu_uuccx_qcd_4j.h"
#include "HelAmps_sm.h"
using namespace MG5_sm;
//==========================================================================
// Class member functions for calculating the matrix elements for
// Process: u u > u u c c~ WEIGHTED=4
// Process: u u > u u d d~ WEIGHTED=4
// Process: u u > u u s s~ WEIGHTED=4
// Process: c c > c u c u~ WEIGHTED=4
// Process: c c > c c d d~ WEIGHTED=4
// Process: c c > c c s s~ WEIGHTED=4
// Process: d d > d u d u~ WEIGHTED=4
// Process: d d > d c d c~ WEIGHTED=4
// Process: d d > d d s s~ WEIGHTED=4
// Process: s s > s u s u~ WEIGHTED=4
// Process: s s > s c s c~ WEIGHTED=4
// Process: s s > s d s d~ WEIGHTED=4
//--------------------------------------------------------------------------
// Initialize process.
void P0_Sigma_sm_uu_uuccx_qcd_4j::initProc(string param_card_name)
{
// Instantiate the model class and set parameters that stay fixed during run
pars = Parameters_sm::getInstance();
SLHAReader slha(param_card_name);
pars->setIndependentParameters(slha);
pars->setIndependentCouplings();
pars->printIndependentParameters();
pars->printIndependentCouplings();
// Set external particle masses for this matrix element
mME.push_back(pars->ZERO);
mME.push_back(pars->ZERO);
mME.push_back(pars->ZERO);
mME.push_back(pars->ZERO);
mME.push_back(pars->ZERO);
mME.push_back(pars->ZERO);
jamp2[0] = new double[6];
}
//--------------------------------------------------------------------------
// Evaluate |M|^2, part independent of incoming flavour.
void P0_Sigma_sm_uu_uuccx_qcd_4j::sigmaKin()
{
// Set the parameters which change event by event
pars->setDependentParameters();
pars->setDependentCouplings();
static bool firsttime = true;
if (firsttime)
{
pars->printDependentParameters();
pars->printDependentCouplings();
firsttime = false;
}
// Reset color flows
for(int i = 0; i < 6; i++ )
jamp2[0][i] = 0.;
// Local variables and constants
const int ncomb = 64;
static bool goodhel[ncomb] = {ncomb * false};
static int ntry = 0, sum_hel = 0, ngood = 0;
static int igood[ncomb];
static int jhel;
std::complex<double> * * wfs;
double t[nprocesses];
// Helicities for the process
static const int helicities[ncomb][nexternal] = {{-1, -1, -1, -1, -1, -1},
{-1, -1, -1, -1, -1, 1}, {-1, -1, -1, -1, 1, -1}, {-1, -1, -1, -1, 1, 1},
{-1, -1, -1, 1, -1, -1}, {-1, -1, -1, 1, -1, 1}, {-1, -1, -1, 1, 1, -1},
{-1, -1, -1, 1, 1, 1}, {-1, -1, 1, -1, -1, -1}, {-1, -1, 1, -1, -1, 1},
{-1, -1, 1, -1, 1, -1}, {-1, -1, 1, -1, 1, 1}, {-1, -1, 1, 1, -1, -1},
{-1, -1, 1, 1, -1, 1}, {-1, -1, 1, 1, 1, -1}, {-1, -1, 1, 1, 1, 1}, {-1,
1, -1, -1, -1, -1}, {-1, 1, -1, -1, -1, 1}, {-1, 1, -1, -1, 1, -1}, {-1,
1, -1, -1, 1, 1}, {-1, 1, -1, 1, -1, -1}, {-1, 1, -1, 1, -1, 1}, {-1, 1,
-1, 1, 1, -1}, {-1, 1, -1, 1, 1, 1}, {-1, 1, 1, -1, -1, -1}, {-1, 1, 1,
-1, -1, 1}, {-1, 1, 1, -1, 1, -1}, {-1, 1, 1, -1, 1, 1}, {-1, 1, 1, 1,
-1, -1}, {-1, 1, 1, 1, -1, 1}, {-1, 1, 1, 1, 1, -1}, {-1, 1, 1, 1, 1, 1},
{1, -1, -1, -1, -1, -1}, {1, -1, -1, -1, -1, 1}, {1, -1, -1, -1, 1, -1},
{1, -1, -1, -1, 1, 1}, {1, -1, -1, 1, -1, -1}, {1, -1, -1, 1, -1, 1}, {1,
-1, -1, 1, 1, -1}, {1, -1, -1, 1, 1, 1}, {1, -1, 1, -1, -1, -1}, {1, -1,
1, -1, -1, 1}, {1, -1, 1, -1, 1, -1}, {1, -1, 1, -1, 1, 1}, {1, -1, 1, 1,
-1, -1}, {1, -1, 1, 1, -1, 1}, {1, -1, 1, 1, 1, -1}, {1, -1, 1, 1, 1, 1},
{1, 1, -1, -1, -1, -1}, {1, 1, -1, -1, -1, 1}, {1, 1, -1, -1, 1, -1}, {1,
1, -1, -1, 1, 1}, {1, 1, -1, 1, -1, -1}, {1, 1, -1, 1, -1, 1}, {1, 1, -1,
1, 1, -1}, {1, 1, -1, 1, 1, 1}, {1, 1, 1, -1, -1, -1}, {1, 1, 1, -1, -1,
1}, {1, 1, 1, -1, 1, -1}, {1, 1, 1, -1, 1, 1}, {1, 1, 1, 1, -1, -1}, {1,
1, 1, 1, -1, 1}, {1, 1, 1, 1, 1, -1}, {1, 1, 1, 1, 1, 1}};
// Denominators: spins, colors and identical particles
const int denominators[nprocesses] = {72};
ntry = ntry + 1;
// Reset the matrix elements
for(int i = 0; i < nprocesses; i++ )
{
matrix_element[i] = 0.;
}
// Define permutation
int perm[nexternal];
for(int i = 0; i < nexternal; i++ )
{
perm[i] = i;
}
if (sum_hel == 0 || ntry < 10)
{
// Calculate the matrix element for all helicities
for(int ihel = 0; ihel < ncomb; ihel++ )
{
if (goodhel[ihel] || ntry < 2)
{
calculate_wavefunctions(perm, helicities[ihel]);
t[0] = matrix_uu_uuccx();
double tsum = 0;
for(int iproc = 0; iproc < nprocesses; iproc++ )
{
matrix_element[iproc] += t[iproc];
tsum += t[iproc];
}
// Store which helicities give non-zero result
if (tsum != 0. && !goodhel[ihel])
{
goodhel[ihel] = true;
ngood++;
igood[ngood] = ihel;
}
}
}
jhel = 0;
sum_hel = min(sum_hel, ngood);
}
else
{
// Only use the "good" helicities
for(int j = 0; j < sum_hel; j++ )
{
jhel++;
if (jhel >= ngood)
jhel = 0;
double hwgt = double(ngood)/double(sum_hel);
int ihel = igood[jhel];
calculate_wavefunctions(perm, helicities[ihel]);
t[0] = matrix_uu_uuccx();
for(int iproc = 0; iproc < nprocesses; iproc++ )
{
matrix_element[iproc] += t[iproc] * hwgt;
}
}
}
for (int i = 0; i < nprocesses; i++ )
matrix_element[i] /= denominators[i];
}
//--------------------------------------------------------------------------
// Evaluate |M|^2, including incoming flavour dependence.
double P0_Sigma_sm_uu_uuccx_qcd_4j::sigmaHat()
{
// Select between the different processes
if(id1 == 3 && id2 == 3)
{
// Add matrix elements for processes with beams (3, 3)
return matrix_element[0] * 3;
}
else if(id1 == 4 && id2 == 4)
{
// Add matrix elements for processes with beams (4, 4)
return matrix_element[0] * 3;
}
else if(id1 == 1 && id2 == 1)
{
// Add matrix elements for processes with beams (1, 1)
return matrix_element[0] * 3;
}
else if(id1 == 2 && id2 == 2)
{
// Add matrix elements for processes with beams (2, 2)
return matrix_element[0] * 3;
}
else
{
// Return 0 if not correct initial state assignment
return 0.;
}
}
//==========================================================================
// Private class member functions
//--------------------------------------------------------------------------
// Evaluate |M|^2 for each subprocess
void P0_Sigma_sm_uu_uuccx_qcd_4j::calculate_wavefunctions(const int perm[], const int hel[])
{
// Calculate wavefunctions for all processes
int i, j;
// Calculate all wavefunctions
ixxxxx(p[perm[0]], mME[0], hel[0], +1, w[0]);
ixxxxx(p[perm[1]], mME[1], hel[1], +1, w[1]);
oxxxxx(p[perm[2]], mME[2], hel[2], +1, w[2]);
oxxxxx(p[perm[3]], mME[3], hel[3], +1, w[3]);
oxxxxx(p[perm[4]], mME[4], hel[4], +1, w[4]);
ixxxxx(p[perm[5]], mME[5], hel[5], -1, w[5]);
FFV1_3(w[0], w[2], pars->GC_11, pars->ZERO, pars->ZERO, w[6]);
FFV1_3(w[1], w[3], pars->GC_11, pars->ZERO, pars->ZERO, w[7]);
FFV1_1(w[4], w[6], pars->GC_11, pars->ZERO, pars->ZERO, w[8]);
FFV1_2(w[5], w[6], pars->GC_11, pars->ZERO, pars->ZERO, w[9]);
FFV1_3(w[5], w[4], pars->GC_11, pars->ZERO, pars->ZERO, w[10]);
FFV1_2(w[1], w[6], pars->GC_11, pars->ZERO, pars->ZERO, w[11]);
FFV1_1(w[3], w[6], pars->GC_11, pars->ZERO, pars->ZERO, w[12]);
FFV1_3(w[0], w[3], pars->GC_11, pars->ZERO, pars->ZERO, w[13]);
FFV1_3(w[1], w[2], pars->GC_11, pars->ZERO, pars->ZERO, w[14]);
FFV1_1(w[4], w[13], pars->GC_11, pars->ZERO, pars->ZERO, w[15]);
FFV1_2(w[5], w[13], pars->GC_11, pars->ZERO, pars->ZERO, w[16]);
FFV1_2(w[1], w[13], pars->GC_11, pars->ZERO, pars->ZERO, w[17]);
FFV1_1(w[2], w[13], pars->GC_11, pars->ZERO, pars->ZERO, w[18]);
FFV1_2(w[0], w[14], pars->GC_11, pars->ZERO, pars->ZERO, w[19]);
FFV1_2(w[0], w[10], pars->GC_11, pars->ZERO, pars->ZERO, w[20]);
FFV1_2(w[0], w[7], pars->GC_11, pars->ZERO, pars->ZERO, w[21]);
// Calculate all amplitudes
// Amplitude(s) for diagram number 0
FFV1_0(w[5], w[8], w[7], pars->GC_11, amp[0]);
FFV1_0(w[9], w[4], w[7], pars->GC_11, amp[1]);
VVV1_0(w[6], w[7], w[10], pars->GC_10, amp[2]);
FFV1_0(w[11], w[3], w[10], pars->GC_11, amp[3]);
FFV1_0(w[1], w[12], w[10], pars->GC_11, amp[4]);
FFV1_0(w[5], w[15], w[14], pars->GC_11, amp[5]);
FFV1_0(w[16], w[4], w[14], pars->GC_11, amp[6]);
VVV1_0(w[13], w[14], w[10], pars->GC_10, amp[7]);
FFV1_0(w[17], w[2], w[10], pars->GC_11, amp[8]);
FFV1_0(w[1], w[18], w[10], pars->GC_11, amp[9]);
FFV1_0(w[19], w[3], w[10], pars->GC_11, amp[10]);
FFV1_0(w[20], w[3], w[14], pars->GC_11, amp[11]);
FFV1_0(w[21], w[2], w[10], pars->GC_11, amp[12]);
FFV1_0(w[20], w[2], w[7], pars->GC_11, amp[13]);
}
double P0_Sigma_sm_uu_uuccx_qcd_4j::matrix_uu_uuccx()
{
int i, j;
// Local variables
const int ngraphs = 14;
const int ncolor = 6;
std::complex<double> ztemp;
std::complex<double> jamp[ncolor];
// The color matrix;
static const double denom[ncolor] = {1, 1, 1, 1, 1, 1};
static const double cf[ncolor][ncolor] = {{27, 9, 9, 3, 3, 9}, {9, 27, 3, 9,
9, 3}, {9, 3, 27, 9, 9, 3}, {3, 9, 9, 27, 3, 9}, {3, 9, 9, 3, 27, 9}, {9,
3, 3, 9, 9, 27}};
// Calculate color flows
jamp[0] = +1./4. * (+1./9. * amp[0] + 1./9. * amp[1] + 1./9. * amp[3] + 1./9.
* amp[4] + 1./3. * amp[8] + 1./3. * amp[9] + 1./3. * amp[10] + 1./3. *
amp[11] + 1./9. * amp[12] + 1./9. * amp[13]);
jamp[1] = +1./4. * (-1./3. * amp[0] - 1./3. * amp[1] - 1./3. * amp[3] - 1./3.
* amp[4] - amp[6] - std::complex<double> (0, 1) * amp[7] - amp[9] -
amp[10]);
jamp[2] = +1./4. * (-1./3. * amp[3] - 1./3. * amp[4] - 1./9. * amp[5] - 1./9.
* amp[6] - 1./9. * amp[8] - 1./9. * amp[9] - 1./9. * amp[10] - 1./9. *
amp[11] - 1./3. * amp[12] - 1./3. * amp[13]);
jamp[3] = +1./4. * (+amp[0] - std::complex<double> (0, 1) * amp[2] + amp[3] +
1./3. * amp[5] + 1./3. * amp[6] + 1./3. * amp[10] + 1./3. * amp[11] +
amp[13]);
jamp[4] = +1./4. * (+amp[1] + std::complex<double> (0, 1) * amp[2] + amp[4] +
1./3. * amp[5] + 1./3. * amp[6] + 1./3. * amp[8] + 1./3. * amp[9] +
amp[12]);
jamp[5] = +1./4. * (-1./3. * amp[0] - 1./3. * amp[1] - amp[5] +
std::complex<double> (0, 1) * amp[7] - amp[8] - amp[11] - 1./3. * amp[12]
- 1./3. * amp[13]);
// Sum and square the color flows to get the matrix element
double matrix = 0;
for(i = 0; i < ncolor; i++ )
{
ztemp = 0.;
for(j = 0; j < ncolor; j++ )
ztemp = ztemp + cf[i][j] * jamp[j];
matrix = matrix + real(ztemp * conj(jamp[i]))/denom[i];
}
// Store the leading color flows for choice of color
for(i = 0; i < ncolor; i++ )
jamp2[0][i] += real(jamp[i] * conj(jamp[i]));
return matrix;
}
| [
"Matthias.Komm@cern.ch"
] | Matthias.Komm@cern.ch |
b750f4e03192e58fd3f43216cc590fb47c1910cb | 3478ccef99c85458a9043a1040bc91e6817cc136 | /HFrame/HModule/audio_utils/native/win_BluetoothMidiDevicePairingDialogue.cpp | 0330b5e93f4fc9bb01a126f96be48385c4cad9d0 | [] | no_license | gybing/Hackett | a1183dada6eff28736ebab52397c282809be0e7b | f2b47d8cc3d8fa9f0d9cd9aa71b707c2a01b8a50 | refs/heads/master | 2020-07-25T22:58:59.712615 | 2019-07-09T09:40:00 | 2019-07-09T09:40:00 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,375 | cpp | /*
==============================================================================
This file is part of the H library.
Copyright (c) 2017 - ROLI Ltd.
H is an open source library subject to commercial or open-source
licensing.
By using H, you agree to the terms of both the H 5 End-User License
Agreement and H 5 Privacy Policy (both updated and effective as of the
27th April 2017).
End User License Agreement: www.H.com/H-5-licence
Privacy Policy: www.H.com/H-5-privacy-policy
Or: You may also use this code under the terms of the GPL v3 (see
www.gnu.org/licenses).
H IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
DISCLAIMED.
==============================================================================
*/
bool BluetoothMidiDevicePairingDialogue::open (ModalComponentManager::Callback* exitCallback,
Rectangle<int>*)
{
std::unique_ptr<ModalComponentManager::Callback> cb (exitCallback);
// not implemented on Windows yet!
// You should check whether the dialogue is available on your system
// using isAvailable() before calling open().
HAssertfalse;
return false;
}
bool BluetoothMidiDevicePairingDialogue::isAvailable()
{
return false;
}
| [
"23925493@qq.com"
] | 23925493@qq.com |
5c2d9eda58c6d540b15f14bfb9c280ed7e34b45d | b78c255d1c8b917c21bf689f5f9153d765fbe195 | /dogpack/apps/plasma/2d/twofluid/g10/AuxFunc.cpp | c133161c6af0cb6f35c4ff87a2b3421a656c05de | [] | no_license | smoe1/ImplicitExplicit | 8be586bed84b1a661e5fe71f5b063dcd406643fa | 2b9a2d54110ca0f787d4252b9a8cc6d64b23b08d | refs/heads/master | 2016-09-08T02:39:48.371767 | 2015-09-15T21:15:08 | 2015-09-15T21:15:08 | 41,374,555 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 193 | cpp | // This is a user-supplied routine that sets the
// auxiliary arrays at all the points "xpts"
class dTensor2;
void AuxFunc(const dTensor2& xpts,
dTensor2& auxvals)
{
// do nothing
}
| [
"smoe@uw.edu"
] | smoe@uw.edu |
36f89a965bdd780290f91d7e0c19220c3e9eb87a | 69814c8bc7a132b09bd7d99d431fe0373e722c33 | /encoder/cube_codec.h | 45f6cc10770a2d9024c598ee016b58372f602323 | [] | no_license | korzec/Cube | ec278e98763f55f0553e66008b4a08f18cafd126 | 7a15995d038e29b5371d087c966fbcacea6a825c | refs/heads/master | 2021-01-19T09:29:08.833665 | 2011-11-10T20:50:19 | 2011-11-10T20:50:19 | 2,861,535 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 442 | h | /*
* File: cube_codec.h
* Author: korzec
*
* Created on August 19, 2011, 11:20 PM
*/
#ifndef CUBE_CODEC_H
#define CUBE_CODEC_H
#include "../cubecodec/Parameters.h"
int cube_decode(Parameters params, std::string input, std::string output);
int cube_encode(Parameters params, std::string input, std::string output);
void display_help();
bool parse_command_line(Parameters& params, int argc, char **argv);
#endif /* CUBE_CODEC_H */
| [
"korzec@gmail.com"
] | korzec@gmail.com |
e056d27c0c40de46edd33d73e9ed7d3de4a5710b | 211c854656c073c6067586b90e3b500e05514d1c | /ref_implementation/src/core/network/messages/payments/FinalAmountsConfigurationResponseMessage.h | 32c23391c0b9d9974bb4518a4fb7cd799afb6081 | [
"MIT"
] | permissive | BasslineJunkie/network-client | ae5162dff2722c685f94131c6f96be39bd17e2a8 | 0b0133f71a002465a1f09531953d36dba3d58496 | refs/heads/master | 2020-03-27T01:29:34.876696 | 2018-08-23T09:24:06 | 2018-08-23T09:24:06 | 145,716,451 | 0 | 0 | MIT | 2018-08-22T13:56:13 | 2018-08-22T13:56:13 | null | UTF-8 | C++ | false | false | 1,413 | h | /**
* This file is part of GEO Project.
* It is subject to the license terms in the LICENSE.md file found in the top-level directory
* of this distribution and at https://github.com/GEO-Project/GEO-Project/blob/master/LICENSE.md
*
* No part of GEO Project, including this file, may be copied, modified, propagated, or distributed
* except according to the terms contained in the LICENSE.md file.
*/
#ifndef GEO_NETWORK_CLIENT_FINALAMOUNTSCONFIGURATIONRESPONSEMESSAGE_H
#define GEO_NETWORK_CLIENT_FINALAMOUNTSCONFIGURATIONRESPONSEMESSAGE_H
#include "../base/transaction/TransactionMessage.h"
class FinalAmountsConfigurationResponseMessage : public TransactionMessage {
public:
enum OperationState {
Accepted = 1,
Rejected = 2,
};
public:
typedef shared_ptr<FinalAmountsConfigurationResponseMessage> Shared;
public:
FinalAmountsConfigurationResponseMessage(
const NodeUUID &senderUUID,
const TransactionUUID &transactionUUID,
const OperationState state);
FinalAmountsConfigurationResponseMessage(
BytesShared buffer);
const MessageType typeID() const;
const OperationState state() const;
protected:
typedef byte SerializedOperationState;
pair<BytesShared, size_t> serializeToBytes() const
throw (bad_alloc);
private:
OperationState mState;
};
#endif //GEO_NETWORK_CLIENT_FINALAMOUNTSCONFIGURATIONRESPONSEMESSAGE_H
| [
"Dima.Chihevsky@gmail.com"
] | Dima.Chihevsky@gmail.com |
b9b81e77e7bb0d00adc0e7ff3c4802c4917ea88f | 0813e18eb6b6cd5de9898c33788b9ab7e93727c6 | /atcoder/agc015/c.cpp | 9a14553d97a6807547291359b6a8b9e965e09a03 | [
"MIT"
] | permissive | metaflow/contests | a769e97337363743a1ec89c292d27939781491d3 | 5e9ffcb72c3e7da54b5e0818b1afa59f5778ffa2 | refs/heads/master | 2021-07-13T00:09:23.470950 | 2021-06-28T10:54:47 | 2021-06-28T10:54:47 | 19,686,394 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,417 | cpp | #if defined(LOCAL)
#define PROBLEM_NAME "c"
const double _max_double_error = 1e-9;
#include "testutils.h"
#define L(x...) (debug(x, #x))
#define C(x...) CHECK(x)
#else
#define L(x, ...) (x)
#define C(x, ...) ;
#include <bits/stdc++.h>
#endif
using namespace std;
using vi = vector<int>; using vvi = vector<vi>; using vvvi = vector<vvi>;
using ii = pair<int,int>; using vii = vector<ii>;
using l = long long; using lu = unsigned long long;
using vl = vector<l>; using vvl = vector<vl>; using vvvl = vector<vvl>;
using ll = pair<l,l>; using vll = vector<ll>; using vvll = vector<vll>;
using vb = vector<bool>; using vvb = vector<vb>;
using vd = vector<double>; using vvd = vector<vd>;
using mll = unordered_map<l, l>;
const l INF = numeric_limits<l>::max();
const double EPS = 1e-10; static constexpr auto PI = acos(-1);
const l e0=1, e3=1000, e5=100000, e6=10*e5, e7=10*e6, e8=10*e7, e9=10*e8;
const char lf = '\n';
#define all(x) begin(x), end(x)
#define F(a,b,c) for (l a = l(b); a < l(c); a++)
#define B(a,b,c) for (l a = l(c) - 1; a >= l(b); a--)
#define VVL(x, a, b, i) vvl x(a, vl(b, l(i)));
#define VVVL(x, a, b, c, i) vvvl x(a, vvl(b, vl(c, l(i))));
void build_s(vvi& g, vvi& s, l n, l m) {
VVL(v, m, n, 0);
F(i, 0, n) {
if (g[i][0]) s[i][1] = 1;
F(j, 1, m) {
s[i][j + 1] = s[i][j];
if (g[i][j] and not g[i][j - 1]) s[i][j + 1]++;
}
}
}
void build_e(vvi& g, vvi& e, l n, l m) {
F(i, 0, n) {
F(j, 1, m + 1) {
e[i][j] = e[i][j - 1];
if (not g[i][j] and g[i][j - 1]) e[i][j]++;
}
}
}
void solve(istream& cin, ostream& cout) {
l n, m, q; cin >> n >> m >> q;
vvi grid(n, vi(m));
F(i, 0, n) {
string s; cin >> s;
F(j, 0, m) grid[i][j] = s[j] - '0';
}
vvi sc(n, vi(m + 1)), ec(n, vi(m + 1));
{
vvi connected(n, vi(m));
F(i, 1, n) {
F(j, 0, m) connected[i][j] = grid[i][j] & grid[i - 1][j];
}
build_s(connected, sc, n, m);
build_e(connected, ec, n, m);
}
// l d = 0;
// while ((1 << (d + 1)) <= n) d++;
vector<tuple<l, l, l, l, l>> queries(q);
F(i, 0, q) {
cin >> get<0>(queries[i]) >> get<1>(queries[i])
>> get<2>(queries[i]) >> get<3>(queries[i]);
get<0>(queries[i])--; get<1>(queries[i])--;
get<2>(queries[i]) -= get<0>(queries[i]);
}
vvi ss(n, vi(m + 1));
vvi ee(n, vi(m + 1));
build_s(grid, ss, n, m);
build_e(grid, ee, n, m);
bool ok = true;
l t = 1;
while (ok) {
ok = false;
F(i, 0, q) {
auto& r = queries[i];
if (get<2>(r) % 2) {
get<4>(r) += ss[get<0>(r)][get<3>(r)];
get<4>(r) -= ee[get<0>(r)][get<1>(r)];
get<0>(r) += t;
if (get<2>(r) > 1) {
get<4>(r) -= sc[get<0>(r)][get<3>(r)];
get<4>(r) += ec[get<0>(r)][get<1>(r)];
}
}
get<2>(r) /= 2;
ok = ok or get<2>(r);
}
F(i, 0, n - 2 * t + 1) {
F(j, 0, m + 1) {
ss[i][j] = ss[i][j] + ss[i + t][j] - sc[i + t][j];
ee[i][j] = ee[i][j] + ee[i + t][j] - ec[i + t][j];
}
}
t *= 2;
}
for (auto r : queries) cout << get<4>(r) << lf;
}
int main() {
ios_base::sync_with_stdio(false); cin.tie(0);
cout << fixed << setprecision(15);
#if defined(LOCAL)
// _generate_random_test = generate_random;
// _solve_brute = solve_brute;
// _player_b = player_b;
// _custom_solution_checker = solution_checker;
maybe_run_tests(cin, cout);
#else
solve(cin, cout);
#endif
}
| [
"goncharov.mikhail@gmail.com"
] | goncharov.mikhail@gmail.com |
4a50eb07bfdfadbd892bfd9e792526169b42c966 | 3fe9a49ac6f8a25576d399a99e1ca3730183a724 | /Amyupdate/build-test-Desktop_Qt_5_6_0_MinGW_32bit-Debug/debug/moc_redvolley.cpp | 6b5f58445c9fb5e64336142b2eee445da4e83346 | [] | no_license | Amyya/pd2-Taiko | ba02d601f0fcc67a06533fc600d0f004168f3de5 | 1e45748effdd5f656d7fb7ffe13549ec5d6546ee | refs/heads/master | 2021-01-01T03:56:22.462421 | 2016-05-16T16:16:53 | 2016-05-16T16:16:53 | 58,865,346 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,382 | cpp | /****************************************************************************
** Meta object code from reading C++ file 'redvolley.h'
**
** Created by: The Qt Meta Object Compiler version 67 (Qt 5.6.0)
**
** WARNING! All changes made in this file will be lost!
*****************************************************************************/
#include "../../Amy/redvolley.h"
#include <QtCore/qbytearray.h>
#include <QtCore/qmetatype.h>
#if !defined(Q_MOC_OUTPUT_REVISION)
#error "The header file 'redvolley.h' doesn't include <QObject>."
#elif Q_MOC_OUTPUT_REVISION != 67
#error "This file was generated using the moc from 5.6.0. It"
#error "cannot be used with the include files from this version of Qt."
#error "(The moc has changed too much.)"
#endif
QT_BEGIN_MOC_NAMESPACE
struct qt_meta_stringdata_RedVolley_t {
QByteArrayData data[3];
char stringdata0[16];
};
#define QT_MOC_LITERAL(idx, ofs, len) \
Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(len, \
qptrdiff(offsetof(qt_meta_stringdata_RedVolley_t, stringdata0) + ofs \
- idx * sizeof(QByteArrayData)) \
)
static const qt_meta_stringdata_RedVolley_t qt_meta_stringdata_RedVolley = {
{
QT_MOC_LITERAL(0, 0, 9), // "RedVolley"
QT_MOC_LITERAL(1, 10, 4), // "move"
QT_MOC_LITERAL(2, 15, 0) // ""
},
"RedVolley\0move\0"
};
#undef QT_MOC_LITERAL
static const uint qt_meta_data_RedVolley[] = {
// content:
7, // revision
0, // classname
0, 0, // classinfo
1, 14, // methods
0, 0, // properties
0, 0, // enums/sets
0, 0, // constructors
0, // flags
0, // signalCount
// slots: name, argc, parameters, tag, flags
1, 0, 19, 2, 0x0a /* Public */,
// slots: parameters
QMetaType::Void,
0 // eod
};
void RedVolley::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a)
{
if (_c == QMetaObject::InvokeMetaMethod) {
RedVolley *_t = static_cast<RedVolley *>(_o);
Q_UNUSED(_t)
switch (_id) {
case 0: _t->move(); break;
default: ;
}
}
Q_UNUSED(_a);
}
const QMetaObject RedVolley::staticMetaObject = {
{ &QLabel::staticMetaObject, qt_meta_stringdata_RedVolley.data,
qt_meta_data_RedVolley, qt_static_metacall, Q_NULLPTR, Q_NULLPTR}
};
const QMetaObject *RedVolley::metaObject() const
{
return QObject::d_ptr->metaObject ? QObject::d_ptr->dynamicMetaObject() : &staticMetaObject;
}
void *RedVolley::qt_metacast(const char *_clname)
{
if (!_clname) return Q_NULLPTR;
if (!strcmp(_clname, qt_meta_stringdata_RedVolley.stringdata0))
return static_cast<void*>(const_cast< RedVolley*>(this));
return QLabel::qt_metacast(_clname);
}
int RedVolley::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
_id = QLabel::qt_metacall(_c, _id, _a);
if (_id < 0)
return _id;
if (_c == QMetaObject::InvokeMetaMethod) {
if (_id < 1)
qt_static_metacall(this, _c, _id, _a);
_id -= 1;
} else if (_c == QMetaObject::RegisterMethodArgumentMetaType) {
if (_id < 1)
*reinterpret_cast<int*>(_a[0]) = -1;
_id -= 1;
}
return _id;
}
QT_END_MOC_NAMESPACE
| [
"amy103029023216@gmail.com"
] | amy103029023216@gmail.com |
02b2621793e99caffc12d8f11dc895048125ddcb | 8dc84558f0058d90dfc4955e905dab1b22d12c08 | /third_party/blink/renderer/platform/exported/web_media_constraints.cc | 62855e89d104d32e9831cd5bee0027ceb80ef4ae | [
"LGPL-2.0-or-later",
"GPL-1.0-or-later",
"MIT",
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference",
"BSD-3-Clause"
] | permissive | meniossin/src | 42a95cc6c4a9c71d43d62bc4311224ca1fd61e03 | 44f73f7e76119e5ab415d4593ac66485e65d700a | refs/heads/master | 2022-12-16T20:17:03.747113 | 2020-09-03T10:43:12 | 2020-09-03T10:43:12 | 263,710,168 | 1 | 0 | BSD-3-Clause | 2020-05-13T18:20:09 | 2020-05-13T18:20:08 | null | UTF-8 | C++ | false | false | 18,793 | cc | /*
* Copyright (C) 2012 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "third_party/blink/public/platform/web_media_constraints.h"
#include <math.h>
#include "base/memory/scoped_refptr.h"
#include "third_party/blink/renderer/platform/wtf/text/string_builder.h"
#include "third_party/blink/renderer/platform/wtf/text/wtf_string.h"
#include "third_party/blink/renderer/platform/wtf/thread_safe_ref_counted.h"
namespace blink {
namespace {
template <typename T>
void MaybeEmitNamedValue(StringBuilder& builder,
bool emit,
const char* name,
T value) {
if (!emit)
return;
if (builder.length() > 1)
builder.Append(", ");
builder.Append(name);
builder.Append(": ");
builder.AppendNumber(value);
}
void MaybeEmitNamedBoolean(StringBuilder& builder,
bool emit,
const char* name,
bool value) {
if (!emit)
return;
if (builder.length() > 1)
builder.Append(", ");
builder.Append(name);
builder.Append(": ");
if (value)
builder.Append("true");
else
builder.Append("false");
}
} // namespace
const char kEchoCancellationTypeBrowser[] = "browser";
const char kEchoCancellationTypeSystem[] = "system";
class WebMediaConstraintsPrivate final
: public ThreadSafeRefCounted<WebMediaConstraintsPrivate> {
public:
static scoped_refptr<WebMediaConstraintsPrivate> Create();
static scoped_refptr<WebMediaConstraintsPrivate> Create(
const WebMediaTrackConstraintSet& basic,
const WebVector<WebMediaTrackConstraintSet>& advanced);
bool IsEmpty() const;
const WebMediaTrackConstraintSet& Basic() const;
const WebVector<WebMediaTrackConstraintSet>& Advanced() const;
const String ToString() const;
private:
WebMediaConstraintsPrivate(
const WebMediaTrackConstraintSet& basic,
const WebVector<WebMediaTrackConstraintSet>& advanced);
WebMediaTrackConstraintSet basic_;
WebVector<WebMediaTrackConstraintSet> advanced_;
};
scoped_refptr<WebMediaConstraintsPrivate> WebMediaConstraintsPrivate::Create() {
WebMediaTrackConstraintSet basic;
WebVector<WebMediaTrackConstraintSet> advanced;
return base::AdoptRef(new WebMediaConstraintsPrivate(basic, advanced));
}
scoped_refptr<WebMediaConstraintsPrivate> WebMediaConstraintsPrivate::Create(
const WebMediaTrackConstraintSet& basic,
const WebVector<WebMediaTrackConstraintSet>& advanced) {
return base::AdoptRef(new WebMediaConstraintsPrivate(basic, advanced));
}
WebMediaConstraintsPrivate::WebMediaConstraintsPrivate(
const WebMediaTrackConstraintSet& basic,
const WebVector<WebMediaTrackConstraintSet>& advanced)
: basic_(basic), advanced_(advanced) {}
bool WebMediaConstraintsPrivate::IsEmpty() const {
// TODO(hta): When generating advanced constraints, make sure no empty
// elements can be added to the m_advanced vector.
return basic_.IsEmpty() && advanced_.empty();
}
const WebMediaTrackConstraintSet& WebMediaConstraintsPrivate::Basic() const {
return basic_;
}
const WebVector<WebMediaTrackConstraintSet>&
WebMediaConstraintsPrivate::Advanced() const {
return advanced_;
}
const String WebMediaConstraintsPrivate::ToString() const {
StringBuilder builder;
if (!IsEmpty()) {
builder.Append('{');
builder.Append(Basic().ToString());
if (!Advanced().empty()) {
if (builder.length() > 1)
builder.Append(", ");
builder.Append("advanced: [");
bool first = true;
for (const auto& constraint_set : Advanced()) {
if (!first)
builder.Append(", ");
builder.Append('{');
builder.Append(constraint_set.ToString());
builder.Append('}');
first = false;
}
builder.Append(']');
}
builder.Append('}');
}
return builder.ToString();
}
// *Constraints
BaseConstraint::BaseConstraint(const char* name) : name_(name) {}
BaseConstraint::~BaseConstraint() = default;
LongConstraint::LongConstraint(const char* name)
: BaseConstraint(name),
min_(),
max_(),
exact_(),
ideal_(),
has_min_(false),
has_max_(false),
has_exact_(false),
has_ideal_(false) {}
bool LongConstraint::Matches(long value) const {
if (has_min_ && value < min_) {
return false;
}
if (has_max_ && value > max_) {
return false;
}
if (has_exact_ && value != exact_) {
return false;
}
return true;
}
bool LongConstraint::IsEmpty() const {
return !has_min_ && !has_max_ && !has_exact_ && !has_ideal_;
}
bool LongConstraint::HasMandatory() const {
return has_min_ || has_max_ || has_exact_;
}
WebString LongConstraint::ToString() const {
StringBuilder builder;
builder.Append('{');
MaybeEmitNamedValue(builder, has_min_, "min", min_);
MaybeEmitNamedValue(builder, has_max_, "max", max_);
MaybeEmitNamedValue(builder, has_exact_, "exact", exact_);
MaybeEmitNamedValue(builder, has_ideal_, "ideal", ideal_);
builder.Append('}');
return builder.ToString();
}
const double DoubleConstraint::kConstraintEpsilon = 0.00001;
DoubleConstraint::DoubleConstraint(const char* name)
: BaseConstraint(name),
min_(),
max_(),
exact_(),
ideal_(),
has_min_(false),
has_max_(false),
has_exact_(false),
has_ideal_(false) {}
bool DoubleConstraint::Matches(double value) const {
if (has_min_ && value < min_ - kConstraintEpsilon) {
return false;
}
if (has_max_ && value > max_ + kConstraintEpsilon) {
return false;
}
if (has_exact_ &&
fabs(static_cast<double>(value) - exact_) > kConstraintEpsilon) {
return false;
}
return true;
}
bool DoubleConstraint::IsEmpty() const {
return !has_min_ && !has_max_ && !has_exact_ && !has_ideal_;
}
bool DoubleConstraint::HasMandatory() const {
return has_min_ || has_max_ || has_exact_;
}
WebString DoubleConstraint::ToString() const {
StringBuilder builder;
builder.Append('{');
MaybeEmitNamedValue(builder, has_min_, "min", min_);
MaybeEmitNamedValue(builder, has_max_, "max", max_);
MaybeEmitNamedValue(builder, has_exact_, "exact", exact_);
MaybeEmitNamedValue(builder, has_ideal_, "ideal", ideal_);
builder.Append('}');
return builder.ToString();
}
StringConstraint::StringConstraint(const char* name)
: BaseConstraint(name), exact_(), ideal_() {}
bool StringConstraint::Matches(WebString value) const {
if (exact_.empty()) {
return true;
}
for (const auto& choice : exact_) {
if (value == choice) {
return true;
}
}
return false;
}
bool StringConstraint::IsEmpty() const {
return exact_.empty() && ideal_.empty();
}
bool StringConstraint::HasMandatory() const {
return !exact_.empty();
}
const WebVector<WebString>& StringConstraint::Exact() const {
return exact_;
}
const WebVector<WebString>& StringConstraint::Ideal() const {
return ideal_;
}
WebString StringConstraint::ToString() const {
StringBuilder builder;
builder.Append('{');
if (!ideal_.empty()) {
builder.Append("ideal: [");
bool first = true;
for (const auto& iter : ideal_) {
if (!first)
builder.Append(", ");
builder.Append('"');
builder.Append(iter);
builder.Append('"');
first = false;
}
builder.Append(']');
}
if (!exact_.empty()) {
if (builder.length() > 1)
builder.Append(", ");
builder.Append("exact: [");
bool first = true;
for (const auto& iter : exact_) {
if (!first)
builder.Append(", ");
builder.Append('"');
builder.Append(iter);
builder.Append('"');
}
builder.Append(']');
}
builder.Append('}');
return builder.ToString();
}
BooleanConstraint::BooleanConstraint(const char* name)
: BaseConstraint(name),
ideal_(false),
exact_(false),
has_ideal_(false),
has_exact_(false) {}
bool BooleanConstraint::Matches(bool value) const {
if (has_exact_ && static_cast<bool>(exact_) != value) {
return false;
}
return true;
}
bool BooleanConstraint::IsEmpty() const {
return !has_ideal_ && !has_exact_;
}
bool BooleanConstraint::HasMandatory() const {
return has_exact_;
}
WebString BooleanConstraint::ToString() const {
StringBuilder builder;
builder.Append('{');
MaybeEmitNamedBoolean(builder, has_exact_, "exact", Exact());
MaybeEmitNamedBoolean(builder, has_ideal_, "ideal", Ideal());
builder.Append('}');
return builder.ToString();
}
WebMediaTrackConstraintSet::WebMediaTrackConstraintSet()
: width("width"),
height("height"),
aspect_ratio("aspectRatio"),
frame_rate("frameRate"),
facing_mode("facingMode"),
volume("volume"),
sample_rate("sampleRate"),
sample_size("sampleSize"),
echo_cancellation("echoCancellation"),
echo_cancellation_type("echoCancellationType"),
latency("latency"),
channel_count("channelCount"),
device_id("deviceId"),
disable_local_echo("disableLocalEcho"),
group_id("groupId"),
video_kind("videoKind"),
depth_near("depthNear"),
depth_far("depthFar"),
focal_length_x("focalLengthX"),
focal_length_y("focalLengthY"),
media_stream_source("mediaStreamSource"),
render_to_associated_sink("chromeRenderToAssociatedSink"),
hotword_enabled("hotwordEnabled"),
goog_echo_cancellation("googEchoCancellation"),
goog_experimental_echo_cancellation("googExperimentalEchoCancellation"),
goog_auto_gain_control("googAutoGainControl"),
goog_experimental_auto_gain_control("googExperimentalAutoGainControl"),
goog_noise_suppression("googNoiseSuppression"),
goog_highpass_filter("googHighpassFilter"),
goog_typing_noise_detection("googTypingNoiseDetection"),
goog_experimental_noise_suppression("googExperimentalNoiseSuppression"),
goog_beamforming("googBeamforming"),
goog_array_geometry("googArrayGeometry"),
goog_audio_mirroring("googAudioMirroring"),
goog_da_echo_cancellation("googDAEchoCancellation"),
goog_noise_reduction("googNoiseReduction"),
offer_to_receive_audio("offerToReceiveAudio"),
offer_to_receive_video("offerToReceiveVideo"),
voice_activity_detection("voiceActivityDetection"),
ice_restart("iceRestart"),
goog_use_rtp_mux("googUseRtpMux"),
enable_dtls_srtp("enableDtlsSrtp"),
enable_rtp_data_channels("enableRtpDataChannels"),
enable_dscp("enableDscp"),
enable_i_pv6("enableIPv6"),
goog_enable_video_suspend_below_min_bitrate(
"googEnableVideoSuspendBelowMinBitrate"),
goog_num_unsignalled_recv_streams("googNumUnsignalledRecvStreams"),
goog_combined_audio_video_bwe("googCombinedAudioVideoBwe"),
goog_screencast_min_bitrate("googScreencastMinBitrate"),
goog_cpu_overuse_detection("googCpuOveruseDetection"),
goog_cpu_underuse_threshold("googCpuUnderuseThreshold"),
goog_cpu_overuse_threshold("googCpuOveruseThreshold"),
goog_cpu_underuse_encode_rsd_threshold(
"googCpuUnderuseEncodeRsdThreshold"),
goog_cpu_overuse_encode_rsd_threshold("googCpuOveruseEncodeRsdThreshold"),
goog_cpu_overuse_encode_usage("googCpuOveruseEncodeUsage"),
goog_high_start_bitrate("googHighStartBitrate"),
goog_payload_padding("googPayloadPadding"),
goog_latency_ms("latencyMs"),
goog_power_line_frequency("googPowerLineFrequency") {}
std::vector<const BaseConstraint*> WebMediaTrackConstraintSet::AllConstraints()
const {
const BaseConstraint* temp[] = {&width,
&height,
&aspect_ratio,
&frame_rate,
&facing_mode,
&volume,
&sample_rate,
&sample_size,
&echo_cancellation,
&echo_cancellation_type,
&latency,
&channel_count,
&device_id,
&group_id,
&video_kind,
&depth_near,
&depth_far,
&focal_length_x,
&focal_length_y,
&media_stream_source,
&disable_local_echo,
&render_to_associated_sink,
&hotword_enabled,
&goog_echo_cancellation,
&goog_experimental_echo_cancellation,
&goog_auto_gain_control,
&goog_experimental_auto_gain_control,
&goog_noise_suppression,
&goog_highpass_filter,
&goog_typing_noise_detection,
&goog_experimental_noise_suppression,
&goog_beamforming,
&goog_array_geometry,
&goog_audio_mirroring,
&goog_da_echo_cancellation,
&goog_noise_reduction,
&offer_to_receive_audio,
&offer_to_receive_video,
&voice_activity_detection,
&ice_restart,
&goog_use_rtp_mux,
&enable_dtls_srtp,
&enable_rtp_data_channels,
&enable_dscp,
&enable_i_pv6,
&goog_enable_video_suspend_below_min_bitrate,
&goog_num_unsignalled_recv_streams,
&goog_combined_audio_video_bwe,
&goog_screencast_min_bitrate,
&goog_cpu_overuse_detection,
&goog_cpu_underuse_threshold,
&goog_cpu_overuse_threshold,
&goog_cpu_underuse_encode_rsd_threshold,
&goog_cpu_overuse_encode_rsd_threshold,
&goog_cpu_overuse_encode_usage,
&goog_high_start_bitrate,
&goog_payload_padding,
&goog_latency_ms,
&goog_power_line_frequency};
const int element_count = sizeof(temp) / sizeof(temp[0]);
return std::vector<const BaseConstraint*>(&temp[0], &temp[element_count]);
}
bool WebMediaTrackConstraintSet::IsEmpty() const {
for (auto* const constraint : AllConstraints()) {
if (!constraint->IsEmpty())
return false;
}
return true;
}
bool WebMediaTrackConstraintSet::HasMandatoryOutsideSet(
const std::vector<std::string>& good_names,
std::string& found_name) const {
for (auto* const constraint : AllConstraints()) {
if (constraint->HasMandatory()) {
if (std::find(good_names.begin(), good_names.end(),
constraint->GetName()) == good_names.end()) {
found_name = constraint->GetName();
return true;
}
}
}
return false;
}
bool WebMediaTrackConstraintSet::HasMandatory() const {
std::string dummy_string;
return HasMandatoryOutsideSet(std::vector<std::string>(), dummy_string);
}
WebString WebMediaTrackConstraintSet::ToString() const {
StringBuilder builder;
bool first = true;
for (auto* const constraint : AllConstraints()) {
if (!constraint->IsEmpty()) {
if (!first)
builder.Append(", ");
builder.Append(constraint->GetName());
builder.Append(": ");
builder.Append(constraint->ToString());
first = false;
}
}
return builder.ToString();
}
// WebMediaConstraints
void WebMediaConstraints::Assign(const WebMediaConstraints& other) {
private_ = other.private_;
}
void WebMediaConstraints::Reset() {
private_.Reset();
}
bool WebMediaConstraints::IsEmpty() const {
return private_.IsNull() || private_->IsEmpty();
}
void WebMediaConstraints::Initialize() {
DCHECK(IsNull());
private_ = WebMediaConstraintsPrivate::Create();
}
void WebMediaConstraints::Initialize(
const WebMediaTrackConstraintSet& basic,
const WebVector<WebMediaTrackConstraintSet>& advanced) {
DCHECK(IsNull());
private_ = WebMediaConstraintsPrivate::Create(basic, advanced);
}
const WebMediaTrackConstraintSet& WebMediaConstraints::Basic() const {
DCHECK(!IsNull());
return private_->Basic();
}
const WebVector<WebMediaTrackConstraintSet>& WebMediaConstraints::Advanced()
const {
DCHECK(!IsNull());
return private_->Advanced();
}
const WebString WebMediaConstraints::ToString() const {
if (IsNull())
return WebString("");
return private_->ToString();
}
} // namespace blink
| [
"arnaud@geometry.ee"
] | arnaud@geometry.ee |
1d2821c3ca3078690b44546f0dfb3615decad156 | f2339e85157027dada17fadd67c163ecb8627909 | /Social/KinService/Src/KinService.h | f18b23a91cad8c6aac66a3a4438e4fb7ff921aed | [] | no_license | fynbntl/Titan | 7ed8869377676b4c5b96df953570d9b4c4b9b102 | b069b7a2d90f4d67c072e7c96fe341a18fedcfe7 | refs/heads/master | 2021-09-01T22:52:37.516407 | 2017-12-29T01:59:29 | 2017-12-29T01:59:29 | null | 0 | 0 | null | null | null | null | GB18030 | C++ | false | false | 16,637 | h | /*******************************************************************
** 文件名: E:\speed\Social\KinServer\Src\KinService.h
** 版 权: (C) 深圳冰川网络技术有限公司 2008 - All Rights Reserved
** 创建人: 秦其勇
** 日 期: 10/15/2015 17:45
** 版 本: 1.0
** 描 述: 战队服务
********************************************************************/
#pragma once
class CKin;
#include "Kin.h"
#include "IKinService.h"
#include "IGameDatabaseDef.h"
#include "IGatewayAcceptorService.h"
#include "IDBEngineService.h"
#include "IDBEngine.h"
#include "MatchDef.h"
#include "KinDef.h"
#include "KinEvent.h"
#include "Event_ManagedDef.h"
#include "KinMember.h"
#include "ICenterConnectorService.h"
#include "IShareServer.h"
#include "IMessageHandler.h"
#include "DateHandler.h"
#include "IDateTriggerService.h"
// 保存数据用于排名
// 保存玩家DBID list
typedef std::vector<const SKinMember *> TVEC_KinMember;
// 登陆玩家缓存数据结构,这个结构保存了玩家登陆(战队第一个玩家)到战队数据完全读出来期间,登陆的玩家列表
struct SKinUserLogin
{
DWORD dwKinID; // 战队ID
list<DWORD> userList; // 玩家PDBID列表
bool bIsRequest; // 提交状态(未提交,提交)
SKinUserLogin()
{
dwKinID = 0;
userList.clear();
bIsRequest = false;
}
};
class KinService: public IKinService,
public IEventExecuteSink,
public IDBRetSink,
public ISharePersonHandler,
public ITransmitHandler,
public IMessageHandler,
public DateHandler
{
private:
enum eDataComeTrigger
{
DCT_DataTrigger_WeekActivityReset,
DCT_DataTrigger_AutoSetShaikhState,
};
// 登陆玩家缓存列表
typedef map<DWORD, SKinUserLogin> TMap_KinUserLogin;
// 登陆玩家缓存列表迭代器
typedef map<DWORD, SKinUserLogin>::iterator TMap_KinUserLoginIt;
// 战队列表
typedef stdext::hash_map<DWORD, CKin*> TMap_Kin;
// 战队列表迭代器
typedef stdext::hash_map<DWORD, CKin*>::iterator TMap_KinIt;
// 战队列表(名字索引)
typedef stdext::hash_map<std::string, CKin*> TMap_NameKin;
// 战队列表(名字索引)迭代器
typedef stdext::hash_map<std::string, CKin*>::iterator TMap_NameKinIt;
// 战队成员列表
typedef stdext::hash_map<DWORD, CKinMember> TMap_KinMember;
// 战队成员列表迭代器
typedef stdext::hash_map<DWORD, CKinMember>::iterator TMap_KinMemberIt;
typedef map<DWORD, CKin*> TMap_FormalKin;
typedef TMap_FormalKin TMap_InFormalKin;
public:
/// purpose: 构造函数
KinService();
/// purpose: 虚构函数
virtual ~KinService();
public:
/////////////////////////////////////IDBRetSink/////////////////////////////////////
/** 数据库请求返回回调方法
@param pDBRetSink :结果返回接口
@param nCmdID :命令ID
@param nDBRetCode:数据库请求返回值,参考上面定义
@param pszDBRetDesc:数据库请求返回描述,由SP返回
@param nQueueIndex:队列定义
@param pOutData:输出数据
@param nOutLen:输出数据长度
@return
@note
@warning 此对像千万不能在数据库返回前释放,否则会非法!
@retval buffer
*/
virtual void OnReturn(IDBRetSink * pRealDBRetSink, int nCmdID, int nDBRetCode, char * pszDBRetDesc, int nQueueIndex, char * pOutData, int nOutLen);
////////////////////////////////IEventExecuteSink//////////////////////////////////////////
/**
@param wEventID :事件ID
@param bSrcType :发送源类型
@param dwSrcID : 发送源标识(实体为UID中"序列号"部份,非实体就为0)
@param pszContext : 上下文
@param nLen : 上下文长度
@return
@note
@warning
@retval buffer
*/
virtual void OnExecute(WORD wEventID, BYTE bSrcType, DWORD dwSrcID, LPCSTR pszContext, int nLen);
////////////////////////////////ISharePersonHandler//////////////////////////////////////////
/** 上线或者跨进程切换地图后,也是在这里得到通知
@param SHARELINE_TYPE :在线回调类型
@param
@return
*/
virtual void OnLogin(ISharePerson * pSharePerson, ELoginMode nLineType);
/** 下线或者跨进程切换地图后,也是在这里得到通知,当调完以后,就无法再取到
@param SHARELINE_TYPE :在线回调类型
@param
@return
*/
virtual void OnLogout(ISharePerson * pSharePerson, ELogoutMode nLineType);
/** 更新数据前,此处分一前一后,是让应用层知道什么数据改变了,而nUpdateFlag表示是因为什么原因改变了
@param pSharePerson :更新前的对像
@param nUpdateFlag :改变原因
@return
*/
virtual void OnPre_Update(ISharePerson * pSharePerson, SHAREUPDATE_REASON nUpdateReason);
/** 更新数据后,此处分一前一后,是让应用层知道什么数据改变了,而nUpdateFlag表示是因为什么原因改变了
@param pSharePerson :更新后的对像
@param nUpdateFlag :改变原因
@return
*/
virtual void OnPost_Update(ISharePerson * pSharePerson, SHAREUPDATE_REASON nUpdateReason);
////////////////////////////////IMessageHandler//////////////////////////////////////////
/** 消息处理
@param msg 网络消息
*/
virtual void onMessage(ClientID clientID, ulong uMsgID, SNetMsgHead* head, void* data, size_t len);
////////////////////////////////ITransmitHandler//////////////////////////////////////////
/** 消息处理
@param server 源服务器ID
@param uMsgID 消息ID
@param head 消息头
@param data 消息
@param len 消息长度
*/
virtual void onTransmit(DWORD server, ulong uMsgID, SNetMsgHead* head, void * data, size_t len);
/**
@name : 通知服务器列表已经更新
@brief : 服务器列表更新只会在有服务器进入退出时触发
@note : 具体的列表调用ICenterServerConnector::GetServerList获得
*/
virtual void onServerListUpdated();
/** 通知服务器信息更新
@param nState : SERVER_STATE
@param pServerData : ServerData
@brief : 例如服务器人数变化等等
*/
virtual void onServerInfoUpdated(DWORD ServerID, BYTE nState, void* pServerData);
// 日期触发器
virtual void DateCome(unsigned long nTriggerID);
//////////////////////////////////IKinService////////////////////////////////////////
// 处理其它服务器发送过来的消息
virtual void handleServerMsg(DWORD serverID, SNetMsgHead head, void *data, size_t len);
// 处理客户端发送过来的消息
virtual void handleClientMsg(DWORD client, SNetMsgHead head, void *data, size_t len);
/// purpose: 设置战队贡献度
virtual bool addClanCtrb(DWORD dwPDBID, int nClanCtrb);
/** 根据战队ID获取Kin接口
@param dwKinID :战队ID
*/
virtual IKin* getKin(DWORD dwKinID);
/** 根据战队ID获取KinInfo
@param dwKinID :战队ID
*/
virtual SKinInfo getKinInfo(DWORD dwKinID);
/** 根据战队ID获取成员数据接口
@param dwKinID :战队ID
*/
virtual SKinMember getKinMemberInfo(DWORD dwPBID);
/** 根据战队ID获取成员接口
@param dwKinID :战队ID
*/
virtual SKinMember* getKinMember(DWORD dwPBID);
/** 根据战队ID获取成员列表接口
@param dwKinID :战队ID
*/
virtual DWORD getKinMemberList(DWORD dwKinID, PDBID* pReturnArray,DWORD dwArrayMaxSize);
/** 获取战队成员数量
@param dwKinID :战队ID
*/
virtual DWORD getKinMemberCount(DWORD dwKinID);
/** 获取战队总战力
@param dwKinID :战队ID
*/
virtual DWORD getTotalFightScore(DWORD dwKinID);
/** 外部接口删除战队成员
@param dwKinID :战队ID
*/
virtual bool deleteKinMember(DWORD dwKinID, DWORD ActorID);
/// purpose: _Stub::release() call
void release();
/// purpose: _Stub::on_start call
bool create();
/// purpose: 发送消息给玩家
void send2Client( ClientID clientID, obuf256& obuf);
/// purpose: 添加战队成员(有则更新)
virtual void addKinMember(SKinMember* pMember, bool bNeedSaveDB);
/// purpose: 更新成员数据到客户端
virtual void updateMemberToClient(SKinMember* pMember);
/// purpose: 更新成员数据到数据库
virtual void updateMemberToScene(SKinMember* pMember, CSID ServerID = INVALID_SERVER_ID);
virtual CKin* findKin(DWORD dwKinID);
/// purpose: 查找战队成员
virtual SKinMember* findKinMember(DWORD dwPDBID);
/// purpose: 更新成员数据到数据库
virtual void updateMemberToDB(SKinMember* pMember);
/// purpose: 删除战队成员
virtual void removeKinMember(DWORD dwMemberPDBID, bool bNeedSaveDB);
/// purpose: 取得玩家离开战队的时间
int getQuitKinTime(DWORD dwPDBID);
/// purpose: 设置离开战队时间
void setQuitKinTime(DWORD dwPDBID, int nTime);
/// purpose: 提交解散战队请求
void DBDismissKin(DWORD dwKinID);
/// purpose: 查找战队
void removeKin(DWORD dwKinID);
// purpose: 执行存储过程
void ExecSP(DWORD cmdID,LPCSTR pData, int len);
// purpose: 新增战队杯赛奖励
virtual void addKinLegendAward(SKinCupAwardNode sAwardNode);
// purpose: 新增战队杯赛战绩
virtual void addKinLegendWarResult(SKinWarRecordNode sRecordNode);
// purpose: 取得某个身份的名字
virtual LPCSTR getIdentityName(int nIdentity);
// purpose: 战队杯赛荣誉增加
virtual void addKinLegendGlory(int nKinID, int nNum, int nGloryType);
// purpose: 取战队杯赛荣誉
virtual int getKinLegendGlory(int nKinID, int nGloryType);
/// purpose: 获取周活跃度
virtual int getWeekActivity(DWORD dwKinID);
// purpose: 更新战队列表节点申请状态
void updateKinList(int nKinID, int nClientID);
private:
// 读取初始化数据
void readInitalKinData();
/// purpose: 读取战队附加数据(成员列表,联盟信息,称号数据)
void readIniKinPlusData(DWORD dwKinID, bool bAddReadFlag);
// 加载战队列表完成
void onReadKinListFinish();
// 读取战队列表信息
bool readKinList();
/// purpose: 战队的全部数据读取完成
void onReadDBFinish(DWORD dwKinID);
/// purpose: 处理模块消息
void onModuleMessage(ulong nEndpointId, DWORD dwMsgID, SNetMsgHead* pHead, LPCSTR pszData, size_t nLen);
/// purpose: 战队合并消息
void OnMergeMessage(ulong nEndpointId, DWORD dwMsgID, SNetMsgHead* pHead, LPCSTR pszData, size_t nLen);
/// purpose: 创建战队消息处理 -- 来自客户端
void onClientCreateKin(ClientID clientID, LPCSTR pszData, size_t nLen);
/// purpose: 邀请加入消息处理 -- 来自客户端
void onClientInvite(ClientID clientID, LPCSTR pszData, size_t nLen);
/// purpose: 邀请答复消息处理 -- 来自客户端
void onClientAnswerInvite(ClientID clientID, LPCSTR pszData, size_t nLen);
/// purpose: 请求战队列表 -- 来自客户端
void onClientKinList(ClientID clientID, LPCSTR pszData, size_t nLen);
/// purpose: 战队改名消息处理 -- 来自客户端
void onClientKinRename(ClientID clientID, LPCSTR pszData, size_t nLen);
/// purpose: 战队合并请求消息处理 -- 来自客户端
void onClientRequestMerge(ClientID clientID, LPCSTR pszData, size_t nLen);
/// purpose: 战队合并回应消息处理 -- 来自客户端
void onClientMergeResponse(ClientID clientID, LPCSTR pszData, size_t nLen);
/// purpose: 响应退出观察战队列表 -- 来自客户端
void onClientRemoveKinListOb(ClientID clientID, LPCSTR pszData, size_t nLen);
/// purpose: 修改战队名称消息处理 -- 来自场景服
void onSceneKinRename(DWORD dwSceneID, LPCSTR pszData, size_t nLen);
/// purpose: 修改性别 -- 来自场景服
void onSceneActorChangeSex(DWORD dwSceneID, LPCSTR pszData, size_t nLen);
/// purpose: 修改战队名称消息处理 -- 来自场景服
void onSceneActorRename(DWORD dwSceneID, LPCSTR pszData, size_t nLen);
/// purpose: 更新战队其他属性 -- 来自场景服
void onSceneKinActorPropertyUpdate(DWORD dwSceneID, LPCSTR pszData, size_t nLen);
/// purpose: 创建战队消息处理 -- 来自场景服
void onSceneCreateKin(DWORD dwSceneID, LPCSTR pszData, size_t nLen);
/// purpose: 读取战队列表 -- 来自数据库
void onReturnReadKinList(int nDBRetCode, char* pszDBRetDesc, int nQueueIndex, char* pOutData, int nOutLen);
/// purpose: 读取战队基本数据 -- 来自数据库
void onReturnReadKinBase(int nDBRetCode, char* pszDBRetDesc, int nQueueIndex, char* pOutData, int nOutLen);
/// purpose: 读取战队成员列表 -- 来自数据库
void onReturnReadMemberList(int nDBRetCode, char* pszDBRetDesc, int nQueueIndex, char* pOutData, int nOutLen);
/// purpose: 读取战队杯赛奖励列表 -- 来自数据库
void onReturnReadLegendAwardList(int nDBRetCode, char* pszDBRetDesc, int nQueueIndex, char* pOutData, int nOutLen);
/// purpose: 读取战队杯赛战绩列表 -- 来自数据库
void onReturnReadLegendWarList(int nDBRetCode, char* pszDBRetDesc, int nQueueIndex, char* pOutData, int nOutLen);
/// purpose: 更新/添加成员信息 -- 来自数据库
void onReturnUpdateMember(int nDBRetCode, char* pszDBRetDesc, int nQueueIndex, char* pOutData, int nOutLen);
/// purpose: 删除成员信息 -- 来自数据库
void onReturnRemoveMember(int nDBRetCode, char* pszDBRetDesc, int nQueueIndex, char* pOutData, int nOutLen);
/// purpose: 更新战队基本数据 -- 来自数据库
void onReturnUpdateKin(int nDBRetCode, char* pszDBRetDesc, int nQueueIndex, char* pOutData, int nOutLen);
/// purpose: 解散战队 -- 来自数据库
void onReturnDismissKin(int nDBRetCode, char* pszDBRetDesc, int nQueueIndex, char* pOutData, int nOutLen);
/// purpose: 添加杯赛奖励信息 -- 来自数据库
void onReturnAddLegendAward(int nDBRetCode, char* pszDBRetDesc, int nQueueIndex, char* pOutData, int nOutLen);
/// purpose: 添加杯赛战绩信息 -- 来自数据库
void onReturnAddLegendWar(int nDBRetCode, char* pszDBRetDesc, int nQueueIndex, char* pOutData, int nOutLen);
/// purpose: 成员上线(社会服和场景服重连也会通知)
void onMemberLogin(DWORD dwKinID, DWORD dwMemberPDBID);
/// purpose: 成员下线
void onMemberLogout(DWORD dwKinID, SKinMember* pMember);
/// purpose: 往场景服刷新战队的信息
bool refreshKinInfoToScene(CSID dwServerID = INVALID_SERVER_ID);
// 更新个人Rank信息
void UpdatePersonRank(void* pEventData);
// 更新个人Rank信息
void UpdatePersonUpdateClanID(void* pEventData);
// 更新个人状态到战队观察者
void UpdatePersonInfoToKinOb(SKinMember* pMember);
/// purpose: 添加战队列表观察者
bool addObserve(DWORD dwPDBID);
/// purpose: 删除战队列表观察者
void removeObserve(DWORD dwPDBID, bool bCoerceRemove);
/// purpose: 查找战队列表观察者
SKinListObserve* findObserve(DWORD dwPDBID);
// 检查全部DB数据读完
void checkAllDBDataRead();
// 重置周活跃度
void ResetWeekActivity();
// 自动解散低活跃度的战队
void AutoDismissLowerActivity();
// 自动设置队长状态,后台自动更换队长
void AutoSetShaikhState();
private:
// 玩家离开战队时间
map<DWORD, int> m_UserQuitTimeTable;
// 保存玩家登陆(战队第一个玩家)到战队数据完全读出来期间,登陆的玩家列表
TMap_KinUserLogin m_KinUserLoginList;
// 是否最后一页加载战队列表
bool m_bFinalList;
// 完整数据读完
bool m_bDBKinAllDataFinal;
// 保存需要删除的临时战队列表
list<DWORD> m_DeleteKinList;
map<DWORD, SKinListObserve> m_mapObserveList; // 战队列表观察者(用于创建删除战队广播给观察人员)
TMap_Kin m_KinList; // 战队列表
TMap_InFormalKin m_FormalKinArray; // 正式战队列表,每个国家对应一个list列表,因为ID从1开始的,0的位置不用
TMap_NameKin m_NameKinList; // 战队列表(名字索引)
TMap_KinMember m_KinMemberList; // 战队成员列表
volatile LONG m_mutex;
}; | [
"85789685@qq.com"
] | 85789685@qq.com |
bb0bf635c620098f8941799c77a2c5c4aa54333b | 801d0701d19b392a4ff7c268d470959815462398 | /include/hl2sdk-css/game/server/util.h | c713fbea3796d6e120cf4ba9f0bd5af23ec188c8 | [] | no_license | rdbo/CS-Source-Base | c6e21cc46bca5fb57f3e7f9ee44c3522fd072885 | 4605df4b11a2c779d56d16dd7e817536cdc541f7 | refs/heads/main | 2023-03-03T13:19:04.657557 | 2021-02-06T13:46:53 | 2021-02-06T13:46:53 | 335,521,112 | 6 | 1 | null | null | null | null | WINDOWS-1252 | C++ | false | false | 24,008 | h | //========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============//
//
// Purpose: Misc utility code.
//
// $NoKeywords: $
//=============================================================================//
#ifndef UTIL_H
#define UTIL_H
#ifdef _WIN32
#pragma once
#endif
#include "ai_activity.h"
#include "enginecallback.h"
#include "basetypes.h"
#include "tempentity.h"
#include "string_t.h"
#include "gamestringpool.h"
#include "engine/IEngineTrace.h"
#include "worldsize.h"
#include "dt_send.h"
#include "server_class.h"
#include "shake.h"
#include "vstdlib/random.h"
#include <string.h>
#include "utlvector.h"
#include "util_shared.h"
#include "shareddefs.h"
#include "networkvar.h"
struct levellist_t;
class IServerNetworkable;
class IEntityFactory;
#ifdef _WIN32
#define SETUP_EXTERNC(mapClassName)\
extern "C" _declspec( dllexport ) IServerNetworkable* mapClassName( void );
#else
#define SETUP_EXTERNC(mapClassName)
#endif
#include "tier0/memdbgon.h"
CBaseEntity *CreateEntityByName(const char *className, int iForceEdictIndex);
// entity creation
// creates an entity that has not been linked to a classname
template< class T >
T *_CreateEntityTemplate( T *newEnt, const char *className )
{
newEnt = new T; // this is the only place 'new' should be used!
newEnt->PostConstructor( className );
return newEnt;
}
#include "tier0/memdbgoff.h"
// creates an entity by name, and ensure it's correctness
// does not spawn the entity
// use the CREATE_ENTITY() macro which wraps this, instead of using it directly
template< class T >
T *_CreateEntity( T *newClass, const char *className )
{
T *newEnt = dynamic_cast<T*>( CreateEntityByName(className, -1) );
if ( !newEnt )
{
Warning( "classname %s used to create wrong class type\n" );
Assert(0);
}
return newEnt;
}
#define CREATE_ENTITY( newClass, className ) _CreateEntity( (newClass*)NULL, className )
#define CREATE_UNSAVED_ENTITY( newClass, className ) _CreateEntityTemplate( (newClass*)NULL, className )
// This is the glue that hooks .MAP entity class names to our CPP classes
abstract_class IEntityFactoryDictionary
{
public:
virtual void InstallFactory( IEntityFactory *pFactory, const char *pClassName ) = 0;
virtual IServerNetworkable *Create( const char *pClassName ) = 0;
virtual void Destroy( const char *pClassName, IServerNetworkable *pNetworkable ) = 0;
virtual IEntityFactory *FindFactory( const char *pClassName ) = 0;
virtual const char *GetCannonicalName( const char *pClassName ) = 0;
};
IEntityFactoryDictionary *EntityFactoryDictionary();
inline bool CanCreateEntityClass( const char *pszClassname )
{
return ( EntityFactoryDictionary() != NULL && EntityFactoryDictionary()->FindFactory( pszClassname ) != NULL );
}
abstract_class IEntityFactory
{
public:
virtual IServerNetworkable *Create( const char *pClassName ) = 0;
virtual void Destroy( IServerNetworkable *pNetworkable ) = 0;
virtual size_t GetEntitySize() = 0;
};
template <class T>
class CEntityFactory : public IEntityFactory
{
public:
CEntityFactory( const char *pClassName )
{
EntityFactoryDictionary()->InstallFactory( this, pClassName );
}
IServerNetworkable *Create( const char *pClassName )
{
T* pEnt = _CreateEntityTemplate((T*)NULL, pClassName);
return pEnt->NetworkProp();
}
void Destroy( IServerNetworkable *pNetworkable )
{
if ( pNetworkable )
{
pNetworkable->Release();
}
}
virtual size_t GetEntitySize()
{
return sizeof(T);
}
};
#define LINK_ENTITY_TO_CLASS(mapClassName,DLLClassName) \
static CEntityFactory<DLLClassName> mapClassName( #mapClassName );
//
// Conversion among the three types of "entity", including identity-conversions.
//
inline int ENTINDEX( edict_t *pEdict)
{
return engine->IndexOfEdict(pEdict);
}
int ENTINDEX( CBaseEntity *pEnt );
inline edict_t* INDEXENT( int iEdictNum )
{
return engine->PEntityOfEntIndex(iEdictNum);
}
// Testing the three types of "entity" for nullity
inline bool FNullEnt(const edict_t* pent)
{
return pent == NULL || ENTINDEX((edict_t*)pent) == 0;
}
// Dot products for view cone checking
#define VIEW_FIELD_FULL (float)-1.0 // +-180 degrees
#define VIEW_FIELD_WIDE (float)-0.7 // +-135 degrees 0.1 // +-85 degrees, used for full FOV checks
#define VIEW_FIELD_NARROW (float)0.7 // +-45 degrees, more narrow check used to set up ranged attacks
#define VIEW_FIELD_ULTRA_NARROW (float)0.9 // +-25 degrees, more narrow check used to set up ranged attacks
class CBaseEntity;
class CBasePlayer;
extern CGlobalVars *gpGlobals;
// Misc useful
inline bool FStrEq(const char *sz1, const char *sz2)
{
return ( sz1 == sz2 || stricmp(sz1, sz2) == 0 );
}
#if 0
// UNDONE: Remove/alter MAKE_STRING so we can do this?
inline bool FStrEq( string_t str1, string_t str2 )
{
// now that these are pooled, we can compare them with
// integer equality
return str1 == str2;
}
#endif
const char *nexttoken(char *token, const char *str, char sep);
// Misc. Prototypes
void UTIL_SetSize (CBaseEntity *pEnt, const Vector &vecMin, const Vector &vecMax);
void UTIL_ClearTrace ( trace_t &trace );
void UTIL_SetTrace (trace_t& tr, const Ray_t &ray, edict_t* edict, float fraction, int hitgroup, unsigned int contents, const Vector& normal, float intercept );
int UTIL_PrecacheDecal ( const char *name, bool preload = false );
//-----------------------------------------------------------------------------
float UTIL_GetSimulationInterval();
//-----------------------------------------------------------------------------
// Purpose: Gets a player pointer by 1-based index
// If player is not yet spawned or connected, returns NULL
// Input : playerIndex - index of the player - first player is index 1
//-----------------------------------------------------------------------------
// NOTENOTE: Use UTIL_GetLocalPlayer instead of UTIL_PlayerByIndex IF you're in single player
// and you want the player.
CBasePlayer *UTIL_PlayerByIndex( int playerIndex );
// NOTENOTE: Use this instead of UTIL_PlayerByIndex IF you're in single player
// and you want the player.
// not useable in multiplayer - see UTIL_GetListenServerHost()
CBasePlayer* UTIL_GetLocalPlayer( void );
// get the local player on a listen server
CBasePlayer *UTIL_GetListenServerHost( void );
CBasePlayer* UTIL_PlayerByUserId( int userID );
CBasePlayer* UTIL_PlayerByName( const char *name ); // not case sensitive
// Returns true if the command was issued by the listenserver host, or by the dedicated server, via rcon or the server console.
// This is valid during ConCommand execution.
bool UTIL_IsCommandIssuedByServerAdmin( void );
CBaseEntity* UTIL_EntityByIndex( int entityIndex );
void UTIL_GetPlayerConnectionInfo( int playerIndex, int& ping, int &packetloss );
void UTIL_SetClientVisibilityPVS( edict_t *pClient, const unsigned char *pvs, int pvssize );
bool UTIL_ClientPVSIsExpanded();
edict_t *UTIL_FindClientInPVS( edict_t *pEdict );
edict_t *UTIL_FindClientInVisibilityPVS( edict_t *pEdict );
// This is a version which finds any clients whose PVS intersects the box
CBaseEntity *UTIL_FindClientInPVS( const Vector &vecBoxMins, const Vector &vecBoxMaxs );
CBaseEntity *UTIL_EntitiesInPVS( CBaseEntity *pPVSEntity, CBaseEntity *pStartingEntity );
//-----------------------------------------------------------------------------
// class CFlaggedEntitiesEnum
//-----------------------------------------------------------------------------
// enumerate entities that match a set of edict flags into a static array
class CFlaggedEntitiesEnum : public IPartitionEnumerator
{
public:
CFlaggedEntitiesEnum( CBaseEntity **pList, int listMax, int flagMask );
// This gets called by the enumeration methods with each element
// that passes the test.
virtual IterationRetval_t EnumElement( IHandleEntity *pHandleEntity );
int GetCount() { return m_count; }
bool AddToList( CBaseEntity *pEntity );
private:
CBaseEntity **m_pList;
int m_listMax;
int m_flagMask;
int m_count;
};
// Pass in an array of pointers and an array size, it fills the array and returns the number inserted
int UTIL_EntitiesInBox( const Vector &mins, const Vector &maxs, CFlaggedEntitiesEnum *pEnum );
int UTIL_EntitiesAlongRay( const Ray_t &ray, CFlaggedEntitiesEnum *pEnum );
int UTIL_EntitiesInSphere( const Vector ¢er, float radius, CFlaggedEntitiesEnum *pEnum );
inline int UTIL_EntitiesInBox( CBaseEntity **pList, int listMax, const Vector &mins, const Vector &maxs, int flagMask )
{
CFlaggedEntitiesEnum boxEnum( pList, listMax, flagMask );
return UTIL_EntitiesInBox( mins, maxs, &boxEnum );
}
inline int UTIL_EntitiesAlongRay( CBaseEntity **pList, int listMax, const Ray_t &ray, int flagMask )
{
CFlaggedEntitiesEnum rayEnum( pList, listMax, flagMask );
return UTIL_EntitiesAlongRay( ray, &rayEnum );
}
inline int UTIL_EntitiesInSphere( CBaseEntity **pList, int listMax, const Vector ¢er, float radius, int flagMask )
{
CFlaggedEntitiesEnum sphereEnum( pList, listMax, flagMask );
return UTIL_EntitiesInSphere( center, radius, &sphereEnum );
}
// marks the entity for deletion so it will get removed next frame
void UTIL_Remove( IServerNetworkable *oldObj );
void UTIL_Remove( CBaseEntity *oldObj );
// deletes an entity, without any delay. Only use this when sure no pointers rely on this entity.
void UTIL_DisableRemoveImmediate();
void UTIL_EnableRemoveImmediate();
void UTIL_RemoveImmediate( CBaseEntity *oldObj );
// make this a fixed size so it just sits on the stack
#define MAX_SPHERE_QUERY 512
class CEntitySphereQuery
{
public:
// currently this builds the list in the constructor
// UNDONE: make an iterative query of ISpatialPartition so we could
// make queries like this optimal
CEntitySphereQuery( const Vector ¢er, float radius, int flagMask=0 );
CBaseEntity *GetCurrentEntity();
inline void NextEntity() { m_listIndex++; }
private:
int m_listIndex;
int m_listCount;
CBaseEntity *m_pList[MAX_SPHERE_QUERY];
};
enum soundlevel_t;
// Drops an entity onto the floor
int UTIL_DropToFloor( CBaseEntity *pEntity, unsigned int mask, CBaseEntity *pIgnore = NULL );
// Returns false if any part of the bottom of the entity is off an edge that is not a staircase.
bool UTIL_CheckBottom( CBaseEntity *pEntity, ITraceFilter *pTraceFilter, float flStepSize );
void UTIL_SetOrigin ( CBaseEntity *entity, const Vector &vecOrigin, bool bFireTriggers = false );
void UTIL_EmitAmbientSound ( int entindex, const Vector &vecOrigin, const char *samp, float vol, soundlevel_t soundlevel, int fFlags, int pitch, float soundtime = 0.0f, float *duration = NULL );
void UTIL_ParticleEffect ( const Vector &vecOrigin, const Vector &vecDirection, ULONG ulColor, ULONG ulCount );
void UTIL_ScreenShake ( const Vector ¢er, float amplitude, float frequency, float duration, float radius, ShakeCommand_t eCommand, bool bAirShake=false );
void UTIL_ScreenShakeObject ( CBaseEntity *pEnt, const Vector ¢er, float amplitude, float frequency, float duration, float radius, ShakeCommand_t eCommand, bool bAirShake=false );
void UTIL_ViewPunch ( const Vector ¢er, QAngle angPunch, float radius, bool bInAir );
void UTIL_ShowMessage ( const char *pString, CBasePlayer *pPlayer );
void UTIL_ShowMessageAll ( const char *pString );
void UTIL_ScreenFadeAll ( const color32 &color, float fadeTime, float holdTime, int flags );
void UTIL_ScreenFade ( CBaseEntity *pEntity, const color32 &color, float fadeTime, float fadeHold, int flags );
void UTIL_MuzzleFlash ( const Vector &origin, const QAngle &angles, int scale, int type );
Vector UTIL_PointOnLineNearestPoint(const Vector& vStartPos, const Vector& vEndPos, const Vector& vPoint, bool clampEnds = false );
int UTIL_EntityInSolid( CBaseEntity *ent );
bool UTIL_IsMasterTriggered (string_t sMaster, CBaseEntity *pActivator);
void UTIL_BloodStream( const Vector &origin, const Vector &direction, int color, int amount );
void UTIL_BloodSpray( const Vector &pos, const Vector &dir, int color, int amount, int flags );
Vector UTIL_RandomBloodVector( void );
void UTIL_ImpactTrace( trace_t *pTrace, int iDamageType, const char *pCustomImpactName = NULL );
void UTIL_PlayerDecalTrace( trace_t *pTrace, int playernum );
void UTIL_Smoke( const Vector &origin, const float scale, const float framerate );
void UTIL_AxisStringToPointDir( Vector &start, Vector &dir, const char *pString );
void UTIL_AxisStringToPointPoint( Vector &start, Vector &end, const char *pString );
void UTIL_AxisStringToUnitDir( Vector &dir, const char *pString );
void UTIL_ClipPunchAngleOffset( QAngle &in, const QAngle &punch, const QAngle &clip );
void UTIL_PredictedPosition( CBaseEntity *pTarget, float flTimeDelta, Vector *vecPredictedPosition );
void UTIL_Beam( Vector &Start, Vector &End, int nModelIndex, int nHaloIndex, unsigned char FrameStart, unsigned char FrameRate,
float Life, unsigned char Width, unsigned char EndWidth, unsigned char FadeLength, unsigned char Noise, unsigned char Red, unsigned char Green,
unsigned char Blue, unsigned char Brightness, unsigned char Speed);
char *UTIL_VarArgs( const char *format, ... );
bool UTIL_IsValidEntity( CBaseEntity *pEnt );
bool UTIL_TeamsMatch( const char *pTeamName1, const char *pTeamName2 );
// snaps a vector to the nearest axis vector (if within epsilon)
void UTIL_SnapDirectionToAxis( Vector &direction, float epsilon = 0.002f );
//Set the entity to point at the target specified
bool UTIL_PointAtEntity( CBaseEntity *pEnt, CBaseEntity *pTarget );
void UTIL_PointAtNamedEntity( CBaseEntity *pEnt, string_t strTarget );
// Copy the pose parameter values from one entity to the other
bool UTIL_TransferPoseParameters( CBaseEntity *pSourceEntity, CBaseEntity *pDestEntity );
// Search for water transition along a vertical line
float UTIL_WaterLevel( const Vector &position, float minz, float maxz );
// Like UTIL_WaterLevel, but *way* less expensive.
// I didn't replace UTIL_WaterLevel everywhere to avoid breaking anything.
float UTIL_FindWaterSurface( const Vector &position, float minz, float maxz );
void UTIL_Bubbles( const Vector& mins, const Vector& maxs, int count );
void UTIL_BubbleTrail( const Vector& from, const Vector& to, int count );
// allows precacheing of other entities
void UTIL_PrecacheOther( const char *szClassname, const char *modelName = NULL );
// prints a message to each client
void UTIL_ClientPrintAll( int msg_dest, const char *msg_name, const char *param1 = NULL, const char *param2 = NULL, const char *param3 = NULL, const char *param4 = NULL );
inline void UTIL_CenterPrintAll( const char *msg_name, const char *param1 = NULL, const char *param2 = NULL, const char *param3 = NULL, const char *param4 = NULL )
{
UTIL_ClientPrintAll( HUD_PRINTCENTER, msg_name, param1, param2, param3, param4 );
}
void UTIL_ValidateSoundName( string_t &name, const char *defaultStr );
void UTIL_ClientPrintFilter( IRecipientFilter& filter, int msg_dest, const char *msg_name, const char *param1 = NULL, const char *param2 = NULL, const char *param3 = NULL, const char *param4 = NULL );
// prints messages through the HUD
void ClientPrint( CBasePlayer *player, int msg_dest, const char *msg_name, const char *param1 = NULL, const char *param2 = NULL, const char *param3 = NULL, const char *param4 = NULL );
// prints a message to the HUD say (chat)
void UTIL_SayText( const char *pText, CBasePlayer *pEntity );
void UTIL_SayTextAll( const char *pText, CBasePlayer *pEntity = NULL, bool bChat = false );
void UTIL_SayTextFilter( IRecipientFilter& filter, const char *pText, CBasePlayer *pEntity, bool bChat );
void UTIL_SayText2Filter( IRecipientFilter& filter, CBasePlayer *pEntity, bool bChat, const char *msg_name, const char *param1 = NULL, const char *param2 = NULL, const char *param3 = NULL, const char *param4 = NULL );
byte *UTIL_LoadFileForMe( const char *filename, int *pLength );
void UTIL_FreeFile( byte *buffer );
class CGameTrace;
typedef CGameTrace trace_t;
//-----------------------------------------------------------------------------
// These are inlined for backwards compatibility
//-----------------------------------------------------------------------------
inline float UTIL_Approach( float target, float value, float speed )
{
return Approach( target, value, speed );
}
inline float UTIL_ApproachAngle( float target, float value, float speed )
{
return ApproachAngle( target, value, speed );
}
inline float UTIL_AngleDistance( float next, float cur )
{
return AngleDistance( next, cur );
}
inline float UTIL_AngleMod(float a)
{
return anglemod(a);
}
inline float UTIL_AngleDiff( float destAngle, float srcAngle )
{
return AngleDiff( destAngle, srcAngle );
}
typedef struct hudtextparms_s
{
float x;
float y;
int effect;
byte r1, g1, b1, a1;
byte r2, g2, b2, a2;
float fadeinTime;
float fadeoutTime;
float holdTime;
float fxTime;
int channel;
} hudtextparms_t;
//-----------------------------------------------------------------------------
// Sets the model to be associated with an entity
//-----------------------------------------------------------------------------
void UTIL_SetModel( CBaseEntity *pEntity, const char *pModelName );
// prints as transparent 'title' to the HUD
void UTIL_HudMessageAll( const hudtextparms_t &textparms, const char *pMessage );
void UTIL_HudMessage( CBasePlayer *pToPlayer, const hudtextparms_t &textparms, const char *pMessage );
// brings up hud keyboard hints display
void UTIL_HudHintText( CBaseEntity *pEntity, const char *pMessage );
// Writes message to console with timestamp and FragLog header.
void UTIL_LogPrintf( const char *fmt, ... );
// Sorta like FInViewCone, but for nonNPCs.
float UTIL_DotPoints ( const Vector &vecSrc, const Vector &vecCheck, const Vector &vecDir );
void UTIL_StripToken( const char *pKey, char *pDest );// for redundant keynames
// Misc functions
int BuildChangeList( levellist_t *pLevelList, int maxList );
// computes gravity scale for an absolute gravity. Pass the result into CBaseEntity::SetGravity()
float UTIL_ScaleForGravity( float desiredGravity );
//
// How did I ever live without ASSERT?
//
#ifdef DEBUG
void DBG_AssertFunction(bool fExpr, const char* szExpr, const char* szFile, int szLine, const char* szMessage);
#define ASSERT(f) DBG_AssertFunction((bool)((f)!=0), #f, __FILE__, __LINE__, NULL)
#define ASSERTSZ(f, sz) DBG_AssertFunction((bool)((f)!=0), #f, __FILE__, __LINE__, sz)
#else // !DEBUG
#define ASSERT(f)
#define ASSERTSZ(f, sz)
#endif // !DEBUG
//
// Constants that were used only by QC (maybe not used at all now)
//
// Un-comment only as needed
//
#include "globals.h"
#define LFO_SQUARE 1
#define LFO_TRIANGLE 2
#define LFO_RANDOM 3
// func_rotating
#define SF_BRUSH_ROTATE_Y_AXIS 0
#define SF_BRUSH_ROTATE_START_ON 1
#define SF_BRUSH_ROTATE_BACKWARDS 2
#define SF_BRUSH_ROTATE_Z_AXIS 4
#define SF_BRUSH_ROTATE_X_AXIS 8
#define SF_BRUSH_ROTATE_CLIENTSIDE 16
#define SF_BRUSH_ROTATE_SMALLRADIUS 128
#define SF_BRUSH_ROTATE_MEDIUMRADIUS 256
#define SF_BRUSH_ROTATE_LARGERADIUS 512
#define PUSH_BLOCK_ONLY_X 1
#define PUSH_BLOCK_ONLY_Y 2
#define SF_LIGHT_START_OFF 1
#define SPAWNFLAG_NOMESSAGE 1
#define SPAWNFLAG_NOTOUCH 1
#define SPAWNFLAG_DROIDONLY 4
#define SPAWNFLAG_USEONLY 1 // can't be touched, must be used (buttons)
#define TELE_PLAYER_ONLY 1
#define TELE_SILENT 2
// Sound Utilities
enum soundlevel_t;
void SENTENCEG_Init();
void SENTENCEG_Stop(edict_t *entity, int isentenceg, int ipick);
int SENTENCEG_PlayRndI(edict_t *entity, int isentenceg, float volume, soundlevel_t soundlevel, int flags, int pitch);
int SENTENCEG_PlayRndSz(edict_t *entity, const char *szrootname, float volume, soundlevel_t soundlevel, int flags, int pitch);
int SENTENCEG_PlaySequentialSz(edict_t *entity, const char *szrootname, float volume, soundlevel_t soundlevel, int flags, int pitch, int ipick, int freset);
void SENTENCEG_PlaySentenceIndex( edict_t *entity, int iSentenceIndex, float volume, soundlevel_t soundlevel, int flags, int pitch );
int SENTENCEG_PickRndSz(const char *szrootname);
int SENTENCEG_GetIndex(const char *szrootname);
int SENTENCEG_Lookup(const char *sample);
char TEXTURETYPE_Find( trace_t *ptr );
void UTIL_EmitSoundSuit(edict_t *entity, const char *sample);
int UTIL_EmitGroupIDSuit(edict_t *entity, int isentenceg);
int UTIL_EmitGroupnameSuit(edict_t *entity, const char *groupname);
void UTIL_RestartAmbientSounds( void );
class EntityMatrix : public VMatrix
{
public:
void InitFromEntity( CBaseEntity *pEntity, int iAttachment=0 );
void InitFromEntityLocal( CBaseEntity *entity );
inline Vector LocalToWorld( const Vector &vVec ) const
{
return VMul4x3( vVec );
}
inline Vector WorldToLocal( const Vector &vVec ) const
{
return VMul4x3Transpose( vVec );
}
inline Vector LocalToWorldRotation( const Vector &vVec ) const
{
return VMul3x3( vVec );
}
inline Vector WorldToLocalRotation( const Vector &vVec ) const
{
return VMul3x3Transpose( vVec );
}
};
inline float UTIL_DistApprox( const Vector &vec1, const Vector &vec2 );
inline float UTIL_DistApprox2D( const Vector &vec1, const Vector &vec2 );
//---------------------------------------------------------
//---------------------------------------------------------
inline float UTIL_DistApprox( const Vector &vec1, const Vector &vec2 )
{
float dx;
float dy;
float dz;
dx = vec1.x - vec2.x;
dy = vec1.y - vec2.y;
dz = vec1.z - vec2.z;
return fabs(dx) + fabs(dy) + fabs(dz);
}
//---------------------------------------------------------
//---------------------------------------------------------
inline float UTIL_DistApprox2D( const Vector &vec1, const Vector &vec2 )
{
float dx;
float dy;
dx = vec1.x - vec2.x;
dy = vec1.y - vec2.y;
return fabs(dx) + fabs(dy);
}
// Find out if an entity is facing another entity or position within a given tolerance range
bool UTIL_IsFacingWithinTolerance( CBaseEntity *pViewer, const Vector &vecPosition, float flDotTolerance, float *pflDot = NULL );
bool UTIL_IsFacingWithinTolerance( CBaseEntity *pViewer, CBaseEntity *pTarget, float flDotTolerance, float *pflDot = NULL );
void UTIL_GetDebugColorForRelationship( int nRelationship, int &r, int &g, int &b );
struct datamap_t;
extern const char *UTIL_FunctionToName( datamap_t *pMap, void *function );
extern void *UTIL_FunctionFromName( datamap_t *pMap, const char *pName );
int UTIL_GetCommandClientIndex( void );
CBasePlayer *UTIL_GetCommandClient( void );
bool UTIL_GetModDir( char *lpszTextOut, unsigned int nSize );
AngularImpulse WorldToLocalRotation( const VMatrix &localToWorld, const Vector &worldAxis, float rotation );
void UTIL_WorldToParentSpace( CBaseEntity *pEntity, Vector &vecPosition, QAngle &vecAngles );
void UTIL_WorldToParentSpace( CBaseEntity *pEntity, Vector &vecPosition, Quaternion &quat );
void UTIL_ParentToWorldSpace( CBaseEntity *pEntity, Vector &vecPosition, QAngle &vecAngles );
void UTIL_ParentToWorldSpace( CBaseEntity *pEntity, Vector &vecPosition, Quaternion &quat );
bool UTIL_LoadAndSpawnEntitiesFromScript( CUtlVector <CBaseEntity*> &entities, const char *pScriptFile, const char *pBlock, bool bActivate = true );
// Given a vector, clamps the scalar axes to MAX_COORD_FLOAT ranges from worldsize.h
void UTIL_BoundToWorldSize( Vector *pVecPos );
#endif // UTIL_H
| [
"rdbodev@gmail.com"
] | rdbodev@gmail.com |
eaf4f75b4653b134feced997219660ef6dde0ca9 | 07e2667e08df0c3549546bceb922ebab1a7c3305 | /Sliding window (networking)/Funcs.h | a184aeb21fbcd9ac6c9c87f0509f5725758ccfb4 | [] | no_license | niven-vk/University | 72041d0d4832461cae702ed2c01c372ba028016d | c2e4760af88b69d989261cc1b0ff9999b04de992 | refs/heads/master | 2022-11-07T08:16:46.395572 | 2020-06-24T16:09:43 | 2020-06-24T16:09:43 | 274,706,153 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,407 | h | #ifndef FUNCS_H
#define FUNCS_H
#include <string>
#include <iostream>
#include <netinet/ip.h>
#include <arpa/inet.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
#include <vector>
#include <fstream>
#include <sstream>
#include <cassert>
using namespace std;
#define MAX_SLOT_SIZE 1000
#define SLOTS_NR 1000
class Funcs
{
struct ringSlot
{
int start;
int size;
bool recv; //Flaga równa true jeżeli wcześniej otrzymaliśmy pakiet
unsigned char buff[MAX_SLOT_SIZE]; //Pole na pojedynczy pakiet w buforze
};
public:
Funcs();
virtual ~Funcs();
void setAll(char* iip, char* iport, char* inazwa, char* irozmiar);
void resend(void);
void send(int iter, int rest);
void print();
int receive(void);
void save(void);
string getIP();
string getPort();
string getNazwa();
int getRozmiar();
bool finish(void)const;
protected:
private:
static void fillNextSlot(struct ringSlot * next, const struct ringSlot * prev, unsigned int max_size);
string ip,port,nazwa;
int rozmiar,sockfd,completion;
struct sockaddr_in server_address;
struct ringSlot ringSlots[SLOTS_NR];
unsigned int ringHead;
ofstream pFile;
};
#endif // FUNCS_H
| [
"niven-vk@protonmail.com"
] | niven-vk@protonmail.com |
a5279981d0ef55d6969a03c654713da3d5a680ee | 82f73274d980cc4091d63b83d806aec547f1eac4 | /vanets/src/Metrics.h | b71f0cb9b197b868edc6d1150a93a4ca441d5e66 | [] | no_license | hyb148/VeinsVanetSimulations | 3cc73bc8707c43e0d41e393b917127105eeeef90 | 2abde9ab6611e0210514fb12d5e99f9c5657239f | refs/heads/master | 2020-04-05T23:25:47.854643 | 2015-07-30T03:00:55 | 2015-07-30T03:00:55 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 864 | h | //Reference to Andres Vargas class sink.h in inet
#ifndef __INET_INET_METRICS_H
#define __INET_INET_METRICS_H
#include <INETDefs.h>
/**
* A module that just deletes every packet it receives, and collects
* basic statistics (packet count, bit count, packet rate, bit rate).
*/
class INET_API Metrics : public cSimpleModule
{
public:
virtual ~Metrics(){}
protected:
simtime_t currentSimulationTime;
float packetsDeliveredToMetrics;
float throughputSignal;
protected:
virtual void initialize();
virtual void handleMessage(cMessage *msg);
virtual void finish();
virtual float updateNumberOfPacketsReceived(float packetsDeliveredToMetrics);
virtual simtime_t getCurrentTime();
virtual float computeThroughput(float packetsDeliveredToMetrics, simtime_t currentSimulationTime);
};
#endif /* INET_INET_METRICS_H_ */
| [
"srodriguez@srodriguez-UL50VT.(none)"
] | srodriguez@srodriguez-UL50VT.(none) |
c0b0de19484ad66d619c047e2844309f172f9ee0 | 7ff7f36543662208dcc04c09ddd4cc2e95d04065 | /9461.cpp | 45c210e36da2150041768c593413fa20217b86d5 | [
"MIT"
] | permissive | jaemin2682/BAEKJOON_ONLINE_JUDGE | 2cb2e8709cf66dcfeac48b8b2bf88318a9bc4b25 | 0d5c6907baee61e1fabdbcd96ea473079a9475ed | refs/heads/master | 2021-07-04T17:49:10.506298 | 2020-09-27T22:05:50 | 2020-09-27T22:05:50 | 177,923,654 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 500 | cpp | #include <iostream>
using namespace std;
long long dp[101];
int T, N;
int main() {
cin.sync_with_stdio(0);
cin.tie(0);
for(int i=1;i<=3;i++) dp[i] = 1;
for(int i=4;i<=5;i++) dp[i] = 2;
for(int i=6;i<=100;i++) {
dp[i] = dp[i-1] + dp[i-5];
}
cin >> T;
for(int i=0;i<T;i++) {
cin >> N;
cout << dp[N] << endl;
}
return 0;
}
/*
1: 1
2: 1
3: 1
4: 2
5: 2
6: 3
7: 4
8: 5
9: 7
10: 9
11: 12
12: 16
규칙 : dp[x-4]만큼을 더한다.
*/ | [
"46991162+jaemin2682@users.noreply.github.com"
] | 46991162+jaemin2682@users.noreply.github.com |
b79551f7341af2ec3e6f60f6c8ee6cd9fd7b5ee4 | d0fb46aecc3b69983e7f6244331a81dff42d9595 | /sgw/include/alibabacloud/sgw/model/CreateGatewayFileShareRequest.h | 5ba12fa0291dc69bf40e8e614dc85f015453fa49 | [
"Apache-2.0"
] | permissive | aliyun/aliyun-openapi-cpp-sdk | 3d8d051d44ad00753a429817dd03957614c0c66a | e862bd03c844bcb7ccaa90571bceaa2802c7f135 | refs/heads/master | 2023-08-29T11:54:00.525102 | 2023-08-29T03:32:48 | 2023-08-29T03:32:48 | 115,379,460 | 104 | 82 | NOASSERTION | 2023-09-14T06:13:33 | 2017-12-26T02:53:27 | C++ | UTF-8 | C++ | false | false | 6,357 | h | /*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef ALIBABACLOUD_SGW_MODEL_CREATEGATEWAYFILESHAREREQUEST_H_
#define ALIBABACLOUD_SGW_MODEL_CREATEGATEWAYFILESHAREREQUEST_H_
#include <string>
#include <vector>
#include <alibabacloud/core/RpcServiceRequest.h>
#include <alibabacloud/sgw/SgwExport.h>
namespace AlibabaCloud
{
namespace Sgw
{
namespace Model
{
class ALIBABACLOUD_SGW_EXPORT CreateGatewayFileShareRequest : public RpcServiceRequest
{
public:
CreateGatewayFileShareRequest();
~CreateGatewayFileShareRequest();
bool getInPlace()const;
void setInPlace(bool inPlace);
std::string getOssEndpoint()const;
void setOssEndpoint(const std::string& ossEndpoint);
std::string getReadWriteClientList()const;
void setReadWriteClientList(const std::string& readWriteClientList);
bool getBypassCacheRead()const;
void setBypassCacheRead(bool bypassCacheRead);
int getBackendLimit()const;
void setBackendLimit(int backendLimit);
std::string getSquash()const;
void setSquash(const std::string& squash);
std::string getReadOnlyClientList()const;
void setReadOnlyClientList(const std::string& readOnlyClientList);
std::string getSecurityToken()const;
void setSecurityToken(const std::string& securityToken);
long getKmsRotatePeriod()const;
void setKmsRotatePeriod(long kmsRotatePeriod);
bool getRemoteSyncDownload()const;
void setRemoteSyncDownload(bool remoteSyncDownload);
std::string getShareProtocol()const;
void setShareProtocol(const std::string& shareProtocol);
bool getNfsV4Optimization()const;
void setNfsV4Optimization(bool nfsV4Optimization);
bool getAccessBasedEnumeration()const;
void setAccessBasedEnumeration(bool accessBasedEnumeration);
std::string getGatewayId()const;
void setGatewayId(const std::string& gatewayId);
bool getSupportArchive()const;
void setSupportArchive(bool supportArchive);
std::string getCacheMode()const;
void setCacheMode(const std::string& cacheMode);
std::string getLocalFilePath()const;
void setLocalFilePath(const std::string& localFilePath);
std::string getPartialSyncPaths()const;
void setPartialSyncPaths(const std::string& partialSyncPaths);
int getDownloadLimit()const;
void setDownloadLimit(int downloadLimit);
std::string getReadOnlyUserList()const;
void setReadOnlyUserList(const std::string& readOnlyUserList);
bool getFastReclaim()const;
void setFastReclaim(bool fastReclaim);
bool getWindowsAcl()const;
void setWindowsAcl(bool windowsAcl);
std::string getName()const;
void setName(const std::string& name);
std::string getOssBucketName()const;
void setOssBucketName(const std::string& ossBucketName);
bool getTransferAcceleration()const;
void setTransferAcceleration(bool transferAcceleration);
std::string getClientSideCmk()const;
void setClientSideCmk(const std::string& clientSideCmk);
std::string getPathPrefix()const;
void setPathPrefix(const std::string& pathPrefix);
bool getBrowsable()const;
void setBrowsable(bool browsable);
std::string getReadWriteUserList()const;
void setReadWriteUserList(const std::string& readWriteUserList);
int getPollingInterval()const;
void setPollingInterval(int pollingInterval);
bool getEnabled()const;
void setEnabled(bool enabled);
std::string getAccessKeyId()const;
void setAccessKeyId(const std::string& accessKeyId);
std::string getServerSideAlgorithm()const;
void setServerSideAlgorithm(const std::string& serverSideAlgorithm);
std::string getServerSideCmk()const;
void setServerSideCmk(const std::string& serverSideCmk);
bool getServerSideEncryption()const;
void setServerSideEncryption(bool serverSideEncryption);
bool getIgnoreDelete()const;
void setIgnoreDelete(bool ignoreDelete);
long getLagPeriod()const;
void setLagPeriod(long lagPeriod);
bool getDirectIO()const;
void setDirectIO(bool directIO);
bool getClientSideEncryption()const;
void setClientSideEncryption(bool clientSideEncryption);
bool getOssBucketSsl()const;
void setOssBucketSsl(bool ossBucketSsl);
bool getRemoteSync()const;
void setRemoteSync(bool remoteSync);
int getFrontendLimit()const;
void setFrontendLimit(int frontendLimit);
private:
bool inPlace_;
std::string ossEndpoint_;
std::string readWriteClientList_;
bool bypassCacheRead_;
int backendLimit_;
std::string squash_;
std::string readOnlyClientList_;
std::string securityToken_;
long kmsRotatePeriod_;
bool remoteSyncDownload_;
std::string shareProtocol_;
bool nfsV4Optimization_;
bool accessBasedEnumeration_;
std::string gatewayId_;
bool supportArchive_;
std::string cacheMode_;
std::string localFilePath_;
std::string partialSyncPaths_;
int downloadLimit_;
std::string readOnlyUserList_;
bool fastReclaim_;
bool windowsAcl_;
std::string name_;
std::string ossBucketName_;
bool transferAcceleration_;
std::string clientSideCmk_;
std::string pathPrefix_;
bool browsable_;
std::string readWriteUserList_;
int pollingInterval_;
bool enabled_;
std::string accessKeyId_;
std::string serverSideAlgorithm_;
std::string serverSideCmk_;
bool serverSideEncryption_;
bool ignoreDelete_;
long lagPeriod_;
bool directIO_;
bool clientSideEncryption_;
bool ossBucketSsl_;
bool remoteSync_;
int frontendLimit_;
};
}
}
}
#endif // !ALIBABACLOUD_SGW_MODEL_CREATEGATEWAYFILESHAREREQUEST_H_ | [
"sdk-team@alibabacloud.com"
] | sdk-team@alibabacloud.com |
05885d25147a0b8061af6eb01e3e7929ee34341d | 0594ef0c39a12250e41802710f249232783d7a5d | /code/snAIke/SnakeGame/Controllers/ImGuiSnakeController.hpp | 09b3ef8dc765c5a2be7dd3eab03adc2de8699e4c | [] | no_license | tumbris/snAIke | 01ea832662c2820e32b988097a50cfd4e77861fd | 981f8d1e8cc12e458e993e9cf13ffc27c2666f52 | refs/heads/master | 2022-09-07T16:45:25.392196 | 2020-05-31T02:28:51 | 2020-05-31T02:28:51 | 265,627,704 | 3 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 511 | hpp | #pragma once
#include <snAike/SnakeGame/Controllers/SnakeController.hpp>
#include <snAIke/Singletons/Director/Types.hpp>
class ImGuiSnakeController : public SnakeController
{
public:
ImGuiSnakeController();
~ImGuiSnakeController();
virtual Direction GetDirection() override;
virtual const char* GetName() const override { return "ImGuiSnakeController"; }
private:
virtual void ImGuiUpdate_Impl() override;
private:
std::vector<UpdatorIdType> callbacks;
Direction direction;
};
| [
"sergsy.gerashenko@gmail.com"
] | sergsy.gerashenko@gmail.com |
8b50a351088cdcc2c2da884c6b7c2a5de3b62c0b | c1960fc786581d0a6250098c0d8034b93da4e130 | /xrGame/xr_Server_BattlEye.h | df9c92eca88d28256d517b21422e161c36aa1fa5 | [] | no_license | Vojlok/tsmp_project | 6043d77761c31d476a1fe3f3dfba5fb5b1a9f4a0 | 17a82f4f8a78f02b6baa81ec1638af9a35a13c62 | refs/heads/master | 2020-04-18T19:32:42.676409 | 2019-01-12T17:57:50 | 2019-01-12T17:57:50 | 167,714,466 | 2 | 0 | null | 2019-01-26T17:01:36 | 2019-01-26T17:01:36 | null | UTF-8 | C++ | false | false | 1,830 | h | #ifndef __XR_SERVER_BATTLEYE_H__
#define __XR_SERVER_BATTLEYE_H__
#define BATTLEYE
#ifdef BATTLEYE
class xrServer;
class xrClientData;
typedef bool ( __cdecl* InitSrv_t )
(
char* pstrGameVersion,
// int iAutoUpdate,
//in func pointers
void (__cdecl *pfnPrintMessage )( char* ),
void (__cdecl *pfnSendPacket )( int, void*, int ),
void (__cdecl *pfnKickPlayer )( int, char* ),
//out func pointers
bool (__cdecl **ppfnExit )( void ),
bool (__cdecl **ppfnRun )( void ),
void (__cdecl **ppfnCommand )( char* ),
void (__cdecl **ppfnAddPlayer )( int, char*, void*, int ),
void (__cdecl **ppfnRemovePlayer )( int ),
void (__cdecl **ppfnNewPacket )( int, void*, int )
);
class BattlEyeServer
{
HMODULE m_module;
bool m_succefull;
InitSrv_t Init;
xrServer* m_pServer;
//in func
static void __cdecl PrintMessage (char *);
static void __cdecl SendPacket (int, void *, int);
static void __cdecl KickPlayer (int, char *);
//out func pointers
bool (__cdecl *pfnExit )(void);
bool (__cdecl *pfnRun )(void);
void (__cdecl *pfnCommand )(char *);
void (__cdecl *pfnAddPlayer )(int, char *, void *, int);
void (__cdecl *pfnRemovePlayer )(int);
void (__cdecl *pfnNewPacket )(int, void *, int);
void ReleaseDLL();
public:
bool Run (void);
void Command (char *);
void AddPlayer (int, char *, void *, int);
void RemovePlayer (int);
void NewPacket (int, void *, int);
//////////////////////////////////////////////////////////////////////////
BattlEyeServer( xrServer* Server );
~BattlEyeServer();
bool IsLoaded();
void AddConnectedPlayers();
void AddConnected_OnePlayer( xrClientData* CL );
}; // class BattlEyeServer
#endif // BATTLEYE
#endif // __XR_SERVER_BATTLEYE_H__
| [
"maks0_00@inbox.ru"
] | maks0_00@inbox.ru |
b094501159511a0663c5e3cc5a77b91bca2b33f4 | 0379dd91363f38d8637ff242c1ce5d3595c9b549 | /windows_10_shared_source_kit/windows_10_shared_source_kit/unknown_version/Source/Audio/portcls/ports/dmus/mxf.h | 12239e05f7b5562bbb8673302b3bf7aa8a4af5f8 | [] | no_license | zhanglGitHub/windows_10_shared_source_kit | 14f25e6fff898733892d0b5cc23b2b88b04458d9 | 6784379b0023185027894efe6b97afee24ca77e0 | refs/heads/master | 2023-03-21T05:04:08.653859 | 2020-09-28T16:44:54 | 2020-09-28T16:44:54 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 5,469 | h | /*
Base definition of MIDI Transform Filter object
Copyright (c) Microsoft. All rights reserved.
*/
#ifndef __MXF_H__
#define __MXF_H__
#include "private.h"
#define DMUS_KEF_EVENT_IN_USE 0x0004 // This event is not presently in the allocator.
#define DMUS_KEF_EVENT_STATUS_STATE 0x0000 // This event contains a running status byte only.
#define DMUS_KEF_EVENT_DATA1_STATE 0x4000 // This event is a fragment that requires 1 more data byte.
#define DMUS_KEF_EVENT_DATA2_STATE 0x8000 // This event is a fragment that requires 2 more data bytes.
#define DMUS_KEF_EVENT_SYSEX_STATE 0xC000 // This event is a fragment that requires an EOX.
#define EVT_IN_USE(evt) ((evt)->usFlags & DMUS_KEF_EVENT_IN_USE)
#define EVT_NOT_IN_USE(evt) ((evt)->usFlags & DMUS_KEF_EVENT_IN_USE == 0)
#define EVT_PARSE_STATE(evt) ((evt)->usFlags & DMUS_KEF_EVENT_SYSEX_STATE)
#define STATUS_STATE(evt) (EVT_PARSE_STATE(evt) == DMUS_KEF_EVENT_STATUS_STATE)
#define DATA1_STATE(evt) (EVT_PARSE_STATE(evt) == DMUS_KEF_EVENT_DATA1_STATE)
#define DATA2_STATE(evt) (EVT_PARSE_STATE(evt) == DMUS_KEF_EVENT_DATA2_STATE)
#define SYSEX_STATE(evt) (EVT_PARSE_STATE(evt) == DMUS_KEF_EVENT_SYSEX_STATE)
#define RUNNING_STATUS(evt) (((evt)->cbEvent == 1) && (STATUS_STATE(evt)))
#define SET_EVT_IN_USE(evt) ((evt)->usFlags |= DMUS_KEF_EVENT_IN_USE)
#define SET_EVT_NOT_IN_USE(evt) ((evt)->usFlags &= (~DMUS_KEF_EVENT_IN_USE))
#define SET_STATUS_STATE(evt) ((evt)->usFlags &= ~DMUS_KEF_EVENT_SYSEX_STATE)
#define SET_DATA1_STATE(evt) ((evt)->usFlags = (((evt)->usFlags & ~DMUS_KEF_EVENT_SYSEX_STATE) | DMUS_KEF_EVENT_DATA1_STATE))
#define SET_DATA2_STATE(evt) ((evt)->usFlags = (((evt)->usFlags & ~DMUS_KEF_EVENT_SYSEX_STATE) | DMUS_KEF_EVENT_DATA2_STATE))
#define SET_SYSEX_STATE(evt) ((evt)->usFlags |= DMUS_KEF_EVENT_SYSEX_STATE)
#define CLEAR_STATE(evt) (SET_STATUS_STATE(evt))
#if DBG
#define DumpDMKEvt(evt,lvl) \
_DbgPrintF(lvl,(" PDMUS_KERNEL_EVENT: 0x%p",evt)); \
if (evt) \
{ \
if (evt->bReserved) \
{ \
_DbgPrintF(lvl,(" bReserved: 0x%0.2X",evt->bReserved)); \
} \
else \
{ \
_DbgPrintF(lvl,(" bReserved: --")); \
} \
_DbgPrintF(lvl,(" cbStruct: %d",evt->cbStruct)); \
_DbgPrintF(lvl,(" cbEvent: %d",evt->cbEvent)); \
_DbgPrintF(lvl,(" usChannelGroup: %d",evt->usChannelGroup)); \
_DbgPrintF(lvl,(" usFlags: 0x%04X",evt->usFlags)); \
_DbgPrintF(lvl,(" ullPresTime100ns: 0x%04X %04X %04X %04X",WORD(evt->ullPresTime100ns >> 48),WORD(evt->ullPresTime100ns >> 32),WORD(evt->ullPresTime100ns >> 16),WORD(evt->ullPresTime100ns))); \
_DbgPrintF(lvl,(" ullBytePosition: 0x%04X %04X %04X %04X",WORD(evt->ullBytePosition >> 48),WORD(evt->ullBytePosition >> 32),WORD(evt->ullBytePosition >> 16),WORD(evt->ullBytePosition))); \
if (evt->pNextEvt) \
{ \
_DbgPrintF(lvl,(" pNextEvt: 0x%p",evt->pNextEvt)); \
} \
else \
{ \
_DbgPrintF(lvl,(" pNextEvt: --")); \
} \
if (PACKAGE_EVT(evt)) \
{ \
_DbgPrintF(lvl,(" uData.pPackageEvt: 0x%p",evt->uData.pPackageEvt)); \
} \
else if (SHORT_EVT(evt)) \
{ \
if (evt->cbEvent) \
{ \
ULONGLONG data = 0; \
for (int count = 0;count < evt->cbEvent;count++) \
{ \
data <<= 8; \
data += evt->uData.abData[count]; \
} \
_DbgPrintF(lvl,(" uData.abData: 0x%.*I64X",evt->cbEvent * 2,data)); \
} \
else \
{ \
_DbgPrintF(lvl,(" uData.abData: --")); \
} \
} \
else \
{ \
ULONGLONG data; \
ULONG count; \
PBYTE dataPtr = evt->uData.pbData; \
_DbgPrintF(lvl,(" uData.pbData: 0x%p",dataPtr)); \
for (data = 0,count = 0;(count < sizeof(PBYTE)) && (count < evt->cbEvent);count++,dataPtr++) \
{ \
data <<= 8; \
data += *dataPtr; \
} \
_DbgPrintF(lvl,(" (uData.pbData): 0x%.*I64X",count * 2,data)); \
while (count < evt->cbEvent) \
{ \
int localCount; \
for (localCount = 0, data = 0; \
(localCount < sizeof(PBYTE)) && (count < evt->cbEvent); \
localCount++,count++,dataPtr++) \
{ \
data <<= 8; \
data += *dataPtr; \
} \
_DbgPrintF(lvl,(" 0x%.*I64X",localCount * 2,data)); \
} \
} \
}
#else
#define DumpDMKEvt(evt,level)
#endif
class CAllocatorMXF;
class CMXF
{
public:
CMXF(CAllocatorMXF *AllocatorMXF) { m_AllocatorMXF = AllocatorMXF;};
virtual ~CMXF(void) {};
IMP_IMXF;
protected:
CAllocatorMXF *m_AllocatorMXF;
};
#endif // __MXF_H__
| [
"benjamin.barratt@icloud.com"
] | benjamin.barratt@icloud.com |
f31afdb931be814e04179887fd824f3ff93a317d | 4fd81b86cd9d46fe9c30629f79590e0ba97f8f06 | /week2/intersectionOfTwoArrays.cpp | 38acd09c756e8a93eaad6b55b85e7ec9c71348cd | [] | no_license | AlejandroChiValdes/wallbreakers | 5ae89caaaccd154904e89f3be3673766cc8b6caa | b87855e2cfc61876744ae21e088644456bba3d27 | refs/heads/master | 2020-05-19T10:52:50.503606 | 2019-06-24T03:52:58 | 2019-06-24T03:52:58 | 184,979,638 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 593 | cpp | class Solution {
public:
// runtime 12ms storage 10mb
vector<int> intersection(vector<int>& nums1, vector<int>& nums2) {
vector<int> out;
set<int> u1;
set<int> u2;
for (int i = 0; i < nums1.size(); ++i)
{
u1.insert(nums1[i]);
}
for (int j = 0; j < nums2.size(); ++j)
{
u2.insert(nums2[j]);
}
//pair<set<int>::iterator, bool> res;
for (auto i : u1)
{
if (u2.find(i) != u2.end()) out.push_back(i);
}
return out;
}
}; | [
"alejandrochivaldes1@gmail.com"
] | alejandrochivaldes1@gmail.com |
7229cf44ea91e0abb20ebf533778508584ec5d3a | c6467e781aa95566ed227c3a8fb563fb046b173d | /class_strategy.cpp | f4de96b84d538f5ff1c61b7135cb00f44340bbfd | [] | no_license | Haimanot1989/cpp-2014 | f33c486a4c1a9a9c921e773484c6bec940b1c939 | 60000732b4b040945e8c729a8b89990fb5f101e2 | refs/heads/master | 2020-04-15T01:59:23.202036 | 2013-04-01T21:33:49 | 2013-04-01T21:33:49 | 9,052,696 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 139 | cpp | #include<iostream>
#include"class_strategy.h"
using namespace std;
using namespace casino;
gameType strategy::getGameType(){
return t;
} | [
"s163488@P20150.ada.hioa.no"
] | s163488@P20150.ada.hioa.no |
1d6b9f409371bfd3bcf5e87368a3a2343984ca01 | f0227c15a4d91c088e4b9751ef7be638619afb6e | /src/GestionDrones/Drone.h | 166ea6f12f24c62f1882614ee3fd42c8d30211bd | [] | no_license | Ositofeliz/Projet-KIRK | 5bc2aef5064a6f36abf0271908eb0f3ed0bf4c28 | 1c3de69ce6a2a8f587864ecada459cda04336a54 | refs/heads/main | 2022-12-19T23:51:12.037421 | 2020-09-23T13:23:37 | 2020-09-23T13:23:37 | 297,976,191 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 9,598 | h | #ifndef DRONE_H
#define DRONE_H
#include <QString>
#include <QList>
#include <QFile>
#include <QDebug>
#include <QtWidgets/QMessageBox>
#include <QTextStream>
/*!
*\namespace UtilOpts
* Espace de nommage du fichier des drones
*/
namespace UtilOpts {
static const QString DFILEPATH="DRONES.txt"; /*!< Chemin vers le fichier des drones */
}
/*!
* \brief The TypeDrone enum
* Énumération des types de drones
*/
enum class TypeDrone : char{hale='h',male='m'};
/*!
* \brief The Drone class
* La classe drone définit les drones selon les paramètres suivants :
* Identifiant
* Type
* Vitesse Maximale
* Charge Maximale
* Poids du drone
* Autonomie
*/
class Drone
{
private: //TODO ajouter un attribut pour la disponibilité du drone
int id; /*!< Identifiant du drone */
TypeDrone type; /*!< Type de drone */
double vitesseMax; /*!< Vitesse maximale du drone (km/h)*/
double chargeMax; /*!< Charge maximale pouvant être portée par le drone (kg)*/
double poids; /*!< Poids du drone (kg)*/
double autonomie; /*!< Autonomie du drone (km) */
int altitudeMax; /*!< Altitude de vol maximale du drone (m) */
int altitudeMin; /*!< Altitude de vol minimale du drone (m) */
QString nom; /*!< Nom du drone */
public:
/*!
* \brief Drone
* Constructeur par défaut.
*/
Drone();
/*!
* \brief Drone
* Constructeur avec identifiant
*/
Drone(int);
/*!
* \brief Drone
* Constructeur avec type de drone, nom, altitude et vitesse max.
*/
Drone(TypeDrone, QString="", int=0, int=0);
/*!
* \brief Drone
* Constructeur avec toutes les options.
*/
Drone(int,TypeDrone,QString,double, double, double,double,int,int);
//~Drone();
/// DRONE : GETTERS & SETTERS
/*!
* \brief getTypeQS
* \return
*/
QString getTypeQS();
/*!
* \brief getType
* \return Retourne le type de drone
*
* Accesseur du type de drone.
*/
TypeDrone getType() const;
/*!
* \brief setTypeQS
*/
void setTypeQS(QString);
/*!
* \brief setType
* \param value
* Mutateur du type de drone.
*/
void setType(const TypeDrone &value);
/*!
* \brief getNom
* \return Retourne le nom du drone
* Accesseur du nom du drone.
*/
QString getNom() const;
/*!
* \brief setNom
* \param value
* Mutateur du nom du drone.
*/
void setNom(const QString &value);
/*!
* \brief getVitesseMax
* \return Retourne la vitesse maximale du drone
* Accesseur de la vitesse maximale du drone.
*/
double getVitesseMax() const;
/*!
* \brief setVitesseMax
* \param value
* Mutateur de la vitesse maximale du drone.
*/
void setVitesseMax(double value);
/*!
* \brief getChargeMax
* \return Retourne la charge maximale du drone
* Accesseur de la charge maximale du drone.
*/
double getChargeMax() const;
/*!
* \brief setChargeMax
* \param value
* Mutateur de la charge maximale du drone.
*/
void setChargeMax(double value);
/*!
* \brief getPoids
* \return Retourne le poids du drone
* Accesseur du poids du drone.
*/
double getPoids() const;
/*!
* \brief setPoids
* \param value
* Mutateur du poids du drone.
*/
void setPoids(double value);
/*!
* \brief getAutonomie
* \return Retourne l'autonomie du drone
* Accesseur de l'autonomie du drone.
*/
double getAutonomie() const;
/*!
* \brief setAutonomie
* \param value
* Mutateur de l'autonomie du drone
*/
void setAutonomie(double value);
/*!
* \brief getAltitudeMax
* \return Retourne l'altitude maximale du drone
* Accesseur de l'altitude maximale du drone.
*/
int getAltitudeMax() const;
/*!
* \brief setAltitudeMax
* \param value
* Mutateur de l'altitude maximale du drone.
*/
void setAltitudeMax(int value);
/*!
* \brief getAltitudeMin
* \return Retourne l'altitude minimale du drone
* Accesseur de l'altitude minimale du drone.
*/
int getAltitudeMin() const;
/*!
* \brief setAltitudeMin
* \param value
* Mutateur de l'altitude minimale du drone.
*/
void setAltitudeMin(int value);
/*!
* \brief getId
* \return Retourne l'identifiant du drone
* Accesseur de l'identifiant du drone.
*/
int getId();
/*!
* \brief setId
* \param value
* Mutateur de l'identifiant du drone.
*/
void setId(int value);
};
/*!
* \brief The ListDrone class
* La classe ListDrone est une liste composée de drones.
*/
class ListDrone{
private:
QList<Drone> _drones; /*!< Liste de drones */
public:
/*!
* \brief ListDrone
* Constructeur de la liste des drones à partir du fichier DRONES.txt
*/
ListDrone(){
importer();
}
ListDrone(QString){}
/*!
* \brief Destructeur
* Destructeur de la classe ListDrone.
*/
~ListDrone(){}
/*!
* \brief liste
* \return Retourne les drones de la liste
* Accesseur de la liste des drones.
*/
QList<Drone> liste()
{
return _drones;
}
public slots:
/*!
* \brief importer
* Méthode qui permet d'importer la liste des drones du fichier
* DRONES.txt
*/
void importer()
{
_drones.clear();
QFile file( UtilOpts::DFILEPATH );
if (!file.open(QIODevice::ReadOnly | QIODevice::Text))
{
QMessageBox::warning(nullptr, "Error", file.errorString());
return;
}
QTextStream stream( &file );
while ( !stream.atEnd() )
{
QString line = stream.readLine();
if ( line != "" )
{
QStringList details = line.split( ";" );
if ( details.size() > 7 )
{
TypeDrone type;
if(details.at(1)=="hale"){
type = TypeDrone::hale;
}else{
type = TypeDrone::male;
}
Drone d(details.at(0).toInt(), type, details.at(2), details.at(3).toDouble(),
details.at(4).toDouble(), details.at(5).toDouble(), details.at(6).toDouble(), details.at(7).toInt(), details.at(8).toInt());
_drones.append(d);
}
}
}
file.close();
}
/*!
* \brief sauvegarder
* Méthode qui permet de sauvegarder la liste des drones dans le
* fichier DRONES.txt
*/
void sauvegarder()
{
QFile file( UtilOpts::DFILEPATH );
if (!file.open(QIODevice::WriteOnly | QIODevice::Text))
{
QMessageBox::warning(nullptr, "Error", file.errorString());
return;
}
QTextStream out( &file );
for ( auto elm : _drones )
{
out << elm.getId() << ";" << elm.getTypeQS() << ";" << elm.getNom()<< ";" << elm.getVitesseMax()<< ";"<<
elm.getChargeMax()<< ";" <<elm.getPoids()<< ";" <<elm.getAutonomie()<< ";" <<
elm.getAltitudeMax()<< ";" <<elm.getAltitudeMin();
out << "\n";
}
file.close();
}
/*!
* \brief ajouter
* \param d Drone
* Méthode qui permet d'ajouter un drone à la liste.
*/
void ajouter( Drone d )
{
_drones.append( d );
}
// ----------------
//Modification d'un drone
/*!
* \brief modifier
* \param d Drone
* \param i Index
* Méthode qui permet de modifier le drone d à l'index i.
*/
void modifier(Drone d, int i)
{
_drones.replace(i,d);
}
/*!
* \brief modifier
* \param d Drone
* \param name Nom du drone
* Méthode qui permet de modifier un drone à partir de son nom.
*/
void modifier(Drone d, QString name)
{
for ( int it = 0; it < _drones.size(); ++it )
{
if ( _drones[it].getNom() == name )
{
_drones[it] = d;
return;
}
}
}
/*!
* \brief supprimer
* \param index
* Méthode qui permet de supprimer un drone situé à
* l'index indiqué.
*/
void supprimer( int index )
{
if ( index >= 0 && index < _drones.size() )
_drones.removeAt( index );
}
/*!
* \brief supprimer
* \param d Drone
* Méthode qui permet de supprimer un drone à partir de son
* identifiant.
*/
void supprimer( Drone d )
{
if ( d.getId() >= 0 && d.getId() < _drones.size() )
_drones.removeAt( d.getId() );
}
/*!
* \brief droneByName
* \param nom
* \return Retourne un drone.
* Méthode qui permet de retrouver un drone dans la liste à partir
* de son nom.
*/
Drone droneByName( QString nom )
{
for ( auto elm : liste() )
{
if ( elm.getNom() == nom )
return elm;
}
return Drone();
}
};
#endif // DRONE_H
| [
"remy.costa@live.fr"
] | remy.costa@live.fr |
6d419bdac96b775390cd929e8b885e87779f37e3 | becda928e2a2e985b94ad844083e2959bc12726a | /main_code/relay_command_3_3/relay_command_3_3.ino | 79febeae75538b1764e268bd2620e99d6a850d25 | [] | no_license | krame505/Light-show | 70a5758747d406942adae417716edc248bc20107 | 570266c0899e98683ce296095e47703524815572 | refs/heads/master | 2020-05-20T01:50:39.401984 | 2014-12-24T18:17:38 | 2014-12-24T18:17:38 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 8,047 | ino |
#include <SPI.h>
#include "nRF24L01.h"
#include "RF24.h"
#include "printf.h"
#include "ids.h"
//packet id defs
//See ids.h
/*
#define ID_M 0x00 //full assignment
#define ID_DN 0x10 //digital
#define ID_D 0x20 //full assignment to digital
#define ID_PN 0x30 //pwm
#define ID_S 0x40 //status request
#define ID_SR 0x50 //status reply
*/
#define RELAY_ON 0
#define RELAY_OFF 1
#define PWM_RELAY_ON 1
#define PWM_RELAY_OFF 0
#define Relay_1 2 // Arduino Digital I/O pin number
#define Relay_2 3
#define Relay_3 4
#define Relay_4 5
#define Relay_5 6
#define Relay_6 7
#define Relay_7 8
#define Relay_8 9
#define PWM_Relay_1 3 // Arduino Digital I/O pin number
#define PWM_Relay_2 5
#define PWM_Relay_3 6
#define PWM_Relay_4 9
#define DEFAULT_Relay 3 //pin 3 is used for both relays.
#define MODE_PIN 10
#define ADDRESS_PIN A3
int relays[8];// = {Relay_1, Relay_2, Relay_3, Relay_4, Relay_5, Relay_6, Relay_7, Relay_8};
#define PACKET_LEN 8
#define NUM_D 3 //for message_M parsing
#define NUM_P 1
boolean mode = false;//false = pwm, true = digital
char address = 0;
//Radio stuff
RF24 radio(15,16);
// Radio pipe addresses for the 2 nodes to communicate.
const uint64_t pipes[2] = { 0xF0F0F0F0E1LL, 0xF0F0F0F0D2LL };
//Misc
boolean data_ready = false;
unsigned char data[PACKET_LEN];
void setup() {
//-------( Initialize Pins so relays are inactive at reset)----
digitalWrite(Relay_1, RELAY_OFF);
digitalWrite(Relay_2, RELAY_OFF);
digitalWrite(Relay_3, RELAY_OFF);
digitalWrite(Relay_4, RELAY_OFF);
digitalWrite(Relay_5, RELAY_OFF);
digitalWrite(Relay_6, RELAY_OFF);
digitalWrite(Relay_7, RELAY_OFF);
digitalWrite(Relay_8, RELAY_OFF);
/*
digitalWrite(PWM_Relay_1, PWM_RELAY_OFF);
digitalWrite(PWM_Relay_2, PWM_RELAY_OFF);
digitalWrite(PWM_Relay_3, PWM_RELAY_OFF);
digitalWrite(PWM_Relay_4, PWM_RELAY_OFF);
*/
Serial.begin(115200);
printf_begin();
Serial.println("Relay command code version 3.3");
Serial.println("Initalizing...");
pinMode(MODE_PIN, INPUT_PULLUP);
pinMode(ADDRESS_PIN, INPUT_PULLUP);
Serial.print("Reading mode...");
mode = digitalRead(MODE_PIN);
if (mode)
Serial.println("Found HIGH\nConfiguring as digital...");
else {
Serial.println("Found LOW\nConfiguring as pwm...");
digitalWrite(PWM_Relay_1, PWM_RELAY_OFF);
digitalWrite(PWM_Relay_2, PWM_RELAY_OFF);
digitalWrite(PWM_Relay_3, PWM_RELAY_OFF);
digitalWrite(PWM_Relay_4, PWM_RELAY_OFF);
}
if (mode) {
int relays_tmp[] = {Relay_1, Relay_2, Relay_3, Relay_4, Relay_5, Relay_6, Relay_7, Relay_8};
for (int i = 0; i < 8; i++) {
relays[i] = relays_tmp[i];
}
}
else {
int relays_tmp[] = {PWM_Relay_1, PWM_Relay_2, PWM_Relay_3, PWM_Relay_4, DEFAULT_Relay, DEFAULT_Relay, DEFAULT_Relay, DEFAULT_Relay};
for (int i = 0; i < 8; i++) {
relays[i] = relays_tmp[i];
}
digitalWrite(PWM_Relay_1, PWM_RELAY_OFF);
digitalWrite(PWM_Relay_2, PWM_RELAY_OFF);
digitalWrite(PWM_Relay_3, PWM_RELAY_OFF);
digitalWrite(PWM_Relay_4, PWM_RELAY_OFF);
}
//---( THEN set pins as outputs )----
for (int i = 0; i < 8; i++) {
pinMode(relays[i], OUTPUT);
}
Serial.println("Done configuring.");
Serial.print("Reading address...");
address = analogRead(ADDRESS_PIN) / 256 + 1; //change to change number of possible addresses.
Serial.print("Found address ");
Serial.println(address, DEC);
Serial.println("Starting radio...");
radio.begin();
radio.setRetries(15,100); //15, 15
radio.openWritingPipe(pipes[1]);
radio.openReadingPipe(1,pipes[0]);
radio.startListening();
radio.printDetails();
Serial.println("Done initalizing.");
}//--(end setup )---
void loop() /****** LOOP: RUNS CONSTANTLY ******/
{
if (radio.available()) {
Serial.println("Radio packet incoming...");
radio.read(data, PACKET_LEN);
Serial.print("Received hex bytes: ");
for (int i = 0; i < PACKET_LEN; i++) {
print_hex(data[i]);
Serial.print(" ");
}
Serial.println();
/*
Serial.print("Decimal conversion: ");
for (int i = 0; i < PACKET_LEN; i++) {
Serial.print(data[i], DEC);
Serial.print(" ");
}
Serial.println();
*/
Serial.print("Binary conversion: ");
for (int i = 0; i < PACKET_LEN; i++) {
print_bin(data[i]);
Serial.print(" ");
}
Serial.println();
data_ready = true;
}
else if (Serial.available() >= PACKET_LEN * 2) {
char c[PACKET_LEN * 2];
Serial.print("Serial message incoming: ");
for (int i = 0; i < PACKET_LEN * 2; i++) {
delay(10);
c[i] = Serial.read();
Serial.print(c[i]);
}
Serial.println();
for (int i = 0; i < PACKET_LEN; i++) {
data[i] = hex_to_byte(c[i * 2], c[i * 2 + 1]);
}
Serial.print("Received hex bytes: ");
for (int i = 0; i < PACKET_LEN; i++) {
print_hex(data[i]);
Serial.print(" ");
}
Serial.println();
/*
Serial.print("Decimal conversion: ");
for (int i = 0; i < PACKET_LEN; i++) {
Serial.print(data[i], DEC);
Serial.print(" ");
}
Serial.println();
*/
Serial.print("Binary conversion: ");
for (int i = 0; i < PACKET_LEN; i++) {
print_bin(data[i]);
Serial.print(" ");
}
Serial.println();
data_ready = true;
}
else if (Serial.available() > 0 && Serial.available() < PACKET_LEN * 2) {
Serial.flush();
delay(500);
if (Serial.available() > 0 && Serial.available() < PACKET_LEN * 2) {
Serial.print("Incomplete Serial packet detected: ");
while (Serial.available()) {
Serial.print((char)Serial.read());
}
Serial.println();
}
}
if (data_ready) {
char status_message[] = {ID_SR, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
/* Serial.print("Received hex packets: ");
for (int i = 0; i < PACKET_LEN; i++) {
print_hex(data[i]);
Serial.print(" ");
}
Serial.println();*/
switch (data[0]) {
case ID_DN:
if (mode && (data[1] == address || data[1] == 0)) {
Serial.print("Writing relays... ");
write_relays(data[2]);
Serial.println("Done. ");
}
break;
case ID_D:
if (mode) {
Serial.print("Writing relays... ");
write_relays(data[address + 2]);
Serial.println("Done. ");
}
break;
case ID_PN:
if (!mode && (data[1] == address || data[1] == 0)) {
Serial.print("Writing relays... ");
write_relays_pwm(data + 2);
Serial.println("Done. ");
}
break;
case ID_M:
if (mode) {
Serial.print("Writing relays... ");
write_relays(data[address + 2]);
Serial.println("Done. ");
}
else {
Serial.print("Writing relays... ");
write_relays_pwm(data + NUM_D + address * 4 + 1);
Serial.println("Done. ");
}
break;
case ID_S:
Serial.print("Sending status... ");
radio.stopListening();
status_message[1] = address;
radio.write(status_message, PACKET_LEN);
radio.startListening();
Serial.println("Done. ");
break;
default:
Serial.print("Invalid message ID: ");
print_hex(data[0]);
Serial.println();
break;
}
Serial.println();
data_ready = false;
}
}//--(end main loop )---
void write_relays(unsigned char data) {
int mod = 128;
for (int i = 0; i < 8; i++) {
write_relay(i, data - mod >= 0);
data = (data - mod >= 0)? data - mod : data;
mod /= 2;
}
}
void write_relay(int relay, boolean value) {
if (value)
digitalWrite(relays[relay], RELAY_ON);
else
digitalWrite(relays[relay], RELAY_OFF);
}
void write_relays_pwm(unsigned char data[4]) {
for (int i = 0; i < 4; i++) {
write_relay_pwm(i, data[i]);
}
}
void write_relay_pwm(int relay, unsigned char value) {
analogWrite(relays[relay], value);
}
| [
"krame505@Regulus.(none)"
] | krame505@Regulus.(none) |
267e21af045212b252f46e8e824ec6fa660b0a2c | a4b7ff2e44c4582d6c39ae09714ed7a2bd977eb2 | /mmap/testing/sigsegv_test.cc | 5d3fc9cc245345397cb2f6705137684b4859c844 | [
"Apache-2.0"
] | permissive | datacratic/DasDB | 01f122911e644038d891a70a09d0411acbd5030b | 5ccc1fc7c6c69c97e3dae0e02bb4009f95908d3b | refs/heads/master | 2021-01-23T14:57:12.091421 | 2014-08-13T14:05:30 | 2014-08-13T14:05:30 | 22,917,273 | 3 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 7,573 | cc | /* sigsegv_test.cc
Jeremy Barnes, 23 February 2010
Copyright (c) 2010 Jeremy Barnes. All rights reserved.
Test of the segmentation fault handler functionality.
*/
#define BOOST_TEST_MAIN
#define BOOST_TEST_DYN_LINK
#include "jml/utils/string_functions.h"
#include "jml/utils/file_functions.h"
#include "jml/utils/info.h"
#include "jml/arch/atomic_ops.h"
#include "jml/arch/vm.h"
#include <boost/test/unit_test.hpp>
#include <boost/bind.hpp>
#include <iostream>
#include "mmap/sigsegv.h"
#include <signal.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <errno.h>
#include <sys/mman.h>
#include <sys/wait.h>
#include "jml/utils/guard.h"
#include <boost/bind.hpp>
#include <fstream>
#include <vector>
#include <boost/thread.hpp>
#include <boost/thread/barrier.hpp>
using namespace ML;
using namespace Datacratic;
using namespace std;
void * mmap_addr = 0;
volatile int num_handled = 0;
volatile siginfo_t handled_info;
volatile ucontext_t handled_context;
void test1_segv_handler(int signum, siginfo_t * info, void * context)
{
cerr << "handled" << endl;
++num_handled;
ucontext_t * ucontext = (ucontext_t *)context;
(ucontext_t &)handled_context = *ucontext;
(siginfo_t &)handled_info = *info;
// Make the memory writeable
int res = mprotect(mmap_addr, page_size, PROT_READ | PROT_WRITE);
if (res == -1)
cerr << "error in mprotect: " << strerror(errno) << endl;
// Return to the trapping statement, which will perform the call
}
BOOST_AUTO_TEST_CASE ( test1_segv_restart )
{
// Create a memory mapped page, read only
mmap_addr = mmap(0, page_size, PROT_READ, MAP_PRIVATE | MAP_ANONYMOUS,
-1, 0);
BOOST_REQUIRE(mmap_addr != MAP_FAILED);
// Install a segv handler
struct sigaction action;
action.sa_sigaction = test1_segv_handler;
action.sa_flags = SA_SIGINFO | SA_RESETHAND;
int res = sigaction(SIGSEGV, &action, 0);
BOOST_REQUIRE_EQUAL(res, 0);
char * mem = (char *)mmap_addr;
BOOST_CHECK_EQUAL(*mem, 0);
cerr << "before handler" << endl;
cerr << "addr = " << mmap_addr << endl;
// write to the memory address; this will cause a SEGV
dowrite:
*mem = 'x';
cerr << "after handler" << endl;
void * x = &&dowrite;
cerr << "x = " << x << endl;
cerr << "signal info:" << endl;
cerr << " errno: " << strerror(handled_info.si_errno) << endl;
cerr << " code: " << handled_info.si_code << endl;
cerr << " si_addr: " << handled_info.si_addr << endl;
cerr << " status: " << strerror(handled_info.si_status) << endl;
cerr << " RIP: " << format("%12p", (void *)handled_context.uc_mcontext.gregs[16]) << endl;
// Check that it was handled properly
BOOST_CHECK_EQUAL(*mem, 'x');
BOOST_CHECK_EQUAL(num_handled, 1);
}
void test2_segv_handler_thread(char * addr)
{
*addr = 'x';
}
BOOST_AUTO_TEST_CASE ( test2_segv_handler )
{
// Create a memory mapped page, read only
void * vaddr = mmap(0, page_size, PROT_READ, MAP_PRIVATE | MAP_ANONYMOUS,
-1, 0);
char * addr = (char *)vaddr;
BOOST_REQUIRE(addr != MAP_FAILED);
install_segv_handler();
int region = register_segv_region(addr, addr + page_size);
int nthreads = 1;
boost::thread_group tg;
for (unsigned i = 0; i < nthreads; ++i)
tg.create_thread(boost::bind(&test2_segv_handler_thread, addr));
sleep(1);
int res = mprotect(vaddr, page_size, PROT_READ | PROT_WRITE);
BOOST_CHECK_EQUAL(res, 0);
unregister_segv_region(region);
tg.join_all();
BOOST_CHECK_EQUAL(*addr, 'x');
BOOST_CHECK_EQUAL(get_num_segv_faults_handled(), 1);
}
// Thread to continually modify the memory
void test2_segv_handler_stress_thread1(int * addr,
int npages,
boost::barrier & barrier,
volatile bool & finished)
{
barrier.wait();
cerr << "m";
int * end = addr + npages * page_size / sizeof(int);
while (!finished) {
for (int * p = addr; p != end; ++p)
atomic_add(*p, 1);
memory_barrier();
}
cerr << "M";
}
// Thread to continually unmap and remap the memory
void test2_segv_handler_stress_thread2(int * addr,
boost::barrier & barrier,
volatile bool & finished)
{
barrier.wait();
cerr << "p";
while (!finished) {
int region = register_segv_region(addr, addr + page_size);
int res = mprotect(addr, page_size, PROT_READ);
if (res == -1) {
cerr << "mprotect(PROT_READ) returned " << strerror(errno)
<< endl;
abort();
}
res = mprotect(addr, page_size, PROT_READ | PROT_WRITE);
if (res == -1) {
cerr << "mprotect(PROT_WRITE) returned " << strerror(errno)
<< endl;
abort();
}
unregister_segv_region(region);
}
cerr << "P";
}
BOOST_AUTO_TEST_CASE ( test2_segv_handler_stress )
{
int npages = 8;
// Create a memory mapped page, read only
void * vaddr = mmap(0, npages * page_size, PROT_WRITE | PROT_READ,
MAP_PRIVATE | MAP_ANONYMOUS,
-1, 0);
int * addr = (int *)vaddr;
BOOST_REQUIRE(addr != MAP_FAILED);
install_segv_handler();
// 8 threads simultaneously causing faults, with 8 threads writing to
// pages
int nthreads = 8;
volatile bool finished = false;
boost::barrier barrier(nthreads + npages);
boost::thread_group tg;
for (unsigned i = 0; i < nthreads; ++i)
tg.create_thread(boost::bind(&test2_segv_handler_stress_thread1,
addr, npages, boost::ref(barrier),
boost::ref(finished)));
for (unsigned i = 0; i < npages; ++i)
tg.create_thread(boost::bind(&test2_segv_handler_stress_thread2,
addr + i * page_size,
boost::ref(barrier),
boost::ref(finished)));
sleep(2);
finished = true;
tg.join_all();
cerr << endl;
// All values in all of the pages should be the same value
int val = *addr;
cerr << "val = " << val << endl;
for (unsigned i = 0; i < npages; ++i)
for (unsigned j = 0; j < page_size / sizeof(int); ++j)
BOOST_CHECK_EQUAL(addr[i * page_size / sizeof(int) + j], val);
cerr << get_num_segv_faults_handled() << " segv faults handled" << endl;
BOOST_CHECK(get_num_segv_faults_handled() > 1);
}
BOOST_AUTO_TEST_CASE ( test3_normal_segv_still_works )
{
// Don't make boost::test think that processes exiting is a problem
signal(SIGCHLD, SIG_DFL);
pid_t pid = fork();
if (pid == 0) {
install_segv_handler();
*(char *)0 = 12;
raise(SIGKILL);
}
// Give it one second to exit with a SIGSEGV
sleep(1);
// Force it to exit anyway with a SIGKILL
kill(pid, SIGKILL);
int status = -1;
pid_t res = waitpid(pid, &status, 0);
// If it exited properly with a SIGSEGV, then we'll get that in the status.
// If it didn't exit, then we'll get a SIGKILL in the status instead.
BOOST_CHECK_EQUAL(res, pid);
BOOST_CHECK(WIFSIGNALED(status));
BOOST_CHECK_EQUAL(WTERMSIG(status), SIGSEGV);
}
| [
"remi@datacratic.com"
] | remi@datacratic.com |
c219266eacad7fd8614e09e24cc60ea078297a6c | ac34cad5e20b8f46c0b0aa67df829f55ed90dcb6 | /src/ballistica/base/graphics/gl/renderer_gl.h | 1fab153459034b2fb4f91b219bc66097be8f52cd | [
"MIT"
] | permissive | sudo-logic/ballistica | fd3bf54a043717f874b71f4b2ccd551d61c65008 | 9aa73cd20941655e96b0e626017a7395ccb40062 | refs/heads/master | 2023-07-26T19:52:06.113981 | 2023-07-12T21:32:56 | 2023-07-12T21:37:46 | 262,056,617 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 9,714 | h | // Released under the MIT License. See LICENSE for details.
#ifndef BALLISTICA_BASE_GRAPHICS_GL_RENDERER_GL_H_
#define BALLISTICA_BASE_GRAPHICS_GL_RENDERER_GL_H_
#include <memory>
#include <string>
#include <vector>
#include "ballistica/shared/ballistica.h"
#if BA_ENABLE_OPENGL
#include "ballistica/base/graphics/gl/gl_sys.h"
#include "ballistica/base/graphics/renderer/renderer.h"
#include "ballistica/shared/foundation/object.h"
namespace ballistica::base {
// for now lets not go above 8 since that's what the iPhone 3gs has..
// ...haha perhaps should revisit this
constexpr int kMaxGLTexUnitsUsed = 5;
class RendererGL : public Renderer {
class FakeVertexArrayObject;
class TextureDataGL;
class MeshAssetDataGL;
class MeshDataGL;
class MeshDataSimpleSplitGL;
class MeshDataObjectSplitGL;
class MeshDataSimpleFullGL;
class MeshDataDualTextureFullGL;
class MeshDataSmokeFullGL;
class MeshDataSpriteGL;
class RenderTargetGL;
class FramebufferObjectGL;
class ShaderGL;
class FragmentShaderGL;
class VertexShaderGL;
class ProgramGL;
class SimpleProgramGL;
class ObjectProgramGL;
class SmokeProgramGL;
class BlurProgramGL;
class ShieldProgramGL;
class PostProcessProgramGL;
class SpriteProgramGL;
public:
RendererGL();
~RendererGL() override;
void Unload() override;
void Load() override;
void PostLoad() override;
// our vertex attrs
enum VertexAttr {
kVertexAttrPosition,
kVertexAttrUV,
kVertexAttrNormal,
kVertexAttrErode,
kVertexAttrColor,
kVertexAttrSize,
kVertexAttrDiffuse,
kVertexAttrUV2,
kVertexAttrCount
};
void CheckCapabilities() override;
auto GetAutoGraphicsQuality() -> GraphicsQuality override;
auto GetAutoTextureQuality() -> TextureQuality override;
#if BA_OSTYPE_ANDROID
std::string GetAutoAndroidRes() override;
#endif // BA_OSTYPE_ANDROID
protected:
void DrawDebug() override;
void CheckForErrors() override;
void GenerateCameraBufferBlurPasses() override;
void FlipCullFace() override;
void SetDepthRange(float min, float max) override;
void SetDepthWriting(bool enable) override;
void SetDepthTesting(bool enable) override;
void SetDrawAtEqualDepth(bool enable) override;
auto NewScreenRenderTarget() -> RenderTarget* override;
auto NewFramebufferRenderTarget(int width, int height, bool linear_interp,
bool depth, bool texture,
bool depth_is_texture, bool high_quality,
bool msaa, bool alpha)
-> Object::Ref<RenderTarget> override;
auto NewMeshAssetData(const MeshAsset& mesh)
-> Object::Ref<MeshAssetRendererData> override;
auto NewTextureData(const TextureAsset& texture)
-> Object::Ref<TextureAssetRendererData> override;
auto NewMeshData(MeshDataType type, MeshDrawType drawType)
-> MeshRendererData* override;
void DeleteMeshData(MeshRendererData* data, MeshDataType type) override;
void ProcessRenderCommandBuffer(RenderCommandBuffer* buffer,
const RenderPass& pass,
RenderTarget* render_target) override;
void BlitBuffer(RenderTarget* src, RenderTarget* dst, bool depth,
bool linear_interpolation, bool force_shader_mode,
bool invalidate_source) override;
void UpdateMeshes(
const std::vector<Object::Ref<MeshDataClientHandle> >& meshes,
const std::vector<int8_t>& index_sizes,
const std::vector<Object::Ref<MeshBufferBase> >& buffers) override;
void PushGroupMarker(const char* label) override;
void PopGroupMarker() override;
auto IsMSAAEnabled() const -> bool override;
void InvalidateFramebuffer(bool color, bool depth,
bool target_read_framebuffer) override;
void VREyeRenderBegin() override;
void CardboardDisableScissor() override;
void CardboardEnableScissor() override;
void RenderFrameDefEnd() override;
#if BA_VR_BUILD
void VRSyncRenderStates() override;
#endif // BA_VR_BUILD
// TEMP
auto current_vertex_array() const -> GLuint { return current_vertex_array_; }
private:
void CheckFunkyDepthIssue();
auto GetMSAASamplesForFramebuffer(int width, int height) -> int;
void UpdateMSAAEnabled() override;
void CheckGLExtensions();
void UpdateVignetteTex(bool force) override;
void StandardPostProcessSetup(PostProcessProgramGL* p,
const RenderPass& pass);
void SyncGLState();
void RetainShader(ProgramGL* p);
void SetViewport(GLint x, GLint y, GLsizei width, GLsizei height);
void UseProgram(ProgramGL* p);
auto GetActiveProgram() const -> ProgramGL* {
assert(current_program_);
return current_program_;
}
void SetDoubleSided(bool d);
void ScissorPush(const Rect& rIn, RenderTarget* render_target);
void ScissorPop(RenderTarget* render_target);
void BindVertexArray(GLuint v);
// Note: This is only for use when VAOs aren't supported.
void SetVertexAttribArrayEnabled(GLuint i, bool enabled);
void BindTexture(GLuint type, const TextureAsset* t, GLuint tex_unit = 0);
void BindTexture(GLuint type, GLuint tex, GLuint tex_unit = 0);
void BindTextureUnit(uint32_t tex_unit);
void BindFramebuffer(GLuint fb);
void BindArrayBuffer(GLuint b);
void SetBlend(bool b);
void SetBlendPremult(bool b);
millisecs_t dof_update_time_{};
std::vector<Object::Ref<FramebufferObjectGL> > blur_buffers_;
bool supports_depth_textures_{};
bool first_extension_check_{true};
bool is_tegra_4_{};
bool is_tegra_k1_{};
bool is_recent_adreno_{};
bool is_adreno_{};
bool enable_msaa_{};
float last_cam_buffer_width_{};
float last_cam_buffer_height_{};
int last_blur_res_count_{};
float vignette_tex_outer_r_{};
float vignette_tex_outer_g_{};
float vignette_tex_outer_b_{};
float vignette_tex_inner_r_{};
float vignette_tex_inner_g_{};
float vignette_tex_inner_b_{};
float depth_range_min_{};
float depth_range_max_{};
bool draw_at_equal_depth_{};
bool depth_writing_enabled_{};
bool depth_testing_enabled_{};
bool data_loaded_{};
bool draw_front_{};
GLuint screen_framebuffer_{};
bool got_screen_framebuffer_{};
GLuint random_tex_{};
GLuint vignette_tex_{};
GraphicsQuality vignette_quality_{};
std::vector<std::unique_ptr<ProgramGL> > shaders_;
GLint viewport_x_{};
GLint viewport_y_{};
GLint viewport_width_{};
GLint viewport_height_{};
SimpleProgramGL* simple_color_prog_{};
SimpleProgramGL* simple_tex_prog_{};
SimpleProgramGL* simple_tex_dtest_prog_{};
SimpleProgramGL* simple_tex_mod_prog_{};
SimpleProgramGL* simple_tex_mod_flatness_prog_{};
SimpleProgramGL* simple_tex_mod_shadow_prog_{};
SimpleProgramGL* simple_tex_mod_shadow_flatness_prog_{};
SimpleProgramGL* simple_tex_mod_glow_prog_{};
SimpleProgramGL* simple_tex_mod_glow_maskuv2_prog_{};
SimpleProgramGL* simple_tex_mod_colorized_prog_{};
SimpleProgramGL* simple_tex_mod_colorized2_prog_{};
SimpleProgramGL* simple_tex_mod_colorized2_masked_prog_{};
ObjectProgramGL* obj_prog_{};
ObjectProgramGL* obj_transparent_prog_{};
ObjectProgramGL* obj_lightshad_transparent_prog_{};
ObjectProgramGL* obj_refl_prog_{};
ObjectProgramGL* obj_refl_worldspace_prog_{};
ObjectProgramGL* obj_refl_transparent_prog_{};
ObjectProgramGL* obj_refl_add_transparent_prog_{};
ObjectProgramGL* obj_lightshad_prog_{};
ObjectProgramGL* obj_lightshad_worldspace_prog_{};
ObjectProgramGL* obj_refl_lightshad_prog_{};
ObjectProgramGL* obj_refl_lightshad_worldspace_prog_{};
ObjectProgramGL* obj_refl_lightshad_colorize_prog_{};
ObjectProgramGL* obj_refl_lightshad_colorize2_prog_{};
ObjectProgramGL* obj_refl_lightshad_add_prog_{};
ObjectProgramGL* obj_refl_lightshad_add_colorize_prog_{};
ObjectProgramGL* obj_refl_lightshad_add_colorize2_prog_{};
SmokeProgramGL* smoke_prog_{};
SmokeProgramGL* smoke_overlay_prog_{};
SpriteProgramGL* sprite_prog_{};
SpriteProgramGL* sprite_camalign_prog_{};
SpriteProgramGL* sprite_camalign_overlay_prog_{};
BlurProgramGL* blur_prog_{};
ShieldProgramGL* shield_prog_{};
PostProcessProgramGL* postprocess_prog_{};
PostProcessProgramGL* postprocess_eyes_prog_{};
PostProcessProgramGL* postprocess_distort_prog_{};
static auto GetFunkyDepthIssue() -> bool;
static auto GetDrawsShieldsFunny() -> bool;
static bool funky_depth_issue_set_;
static bool funky_depth_issue_;
static bool draws_shields_funny_set_;
static bool draws_shields_funny_;
#if BA_OSTYPE_ANDROID
static bool is_speedy_android_device_;
static bool is_extra_speedy_android_device_;
#endif // BA_OSTYPE_ANDROID
ProgramGL* current_program_{};
bool double_sided_{};
std::vector<Rect> scissor_rects_;
GLuint current_vertex_array_{};
bool vertex_attrib_arrays_enabled_[kVertexAttrCount]{};
int active_tex_unit_{};
int active_framebuffer_{};
int active_array_buffer_{};
int bound_textures_2d_[kMaxGLTexUnitsUsed]{};
int bound_textures_cube_map_[kMaxGLTexUnitsUsed]{};
bool blend_{};
bool blend_premult_{};
std::unique_ptr<MeshDataSimpleFullGL> screen_mesh_;
std::vector<MeshDataSimpleSplitGL*> recycle_mesh_datas_simple_split_;
std::vector<MeshDataObjectSplitGL*> recycle_mesh_datas_object_split_;
std::vector<MeshDataSimpleFullGL*> recycle_mesh_datas_simple_full_;
std::vector<MeshDataDualTextureFullGL*> recycle_mesh_datas_dual_texture_full_;
std::vector<MeshDataSmokeFullGL*> recycle_mesh_datas_smoke_full_;
std::vector<MeshDataSpriteGL*> recycle_mesh_datas_sprite_;
int error_check_counter_{};
};
} // namespace ballistica::base
#endif // BA_ENABLE_OPENGL
#endif // BALLISTICA_BASE_GRAPHICS_GL_RENDERER_GL_H_
| [
"ericfroemling@gmail.com"
] | ericfroemling@gmail.com |
c4f0ad900e5881c3168ade5c0b5188924869a775 | 9a243e9eeedd93e82de188ccaffa1afc06e506a2 | /ds question 13.cpp | d3acee9766359efcafb62ef778487c16e0582489 | [] | no_license | G0jo-Satoru/discrete-structures | b938ad929ec5d69e43be12c0e0e3726c0498b88f | 168515a6a5d7272a01e5b48cde381ed2560fca9e | refs/heads/main | 2023-08-25T15:39:53.795744 | 2021-10-21T09:15:39 | 2021-10-21T09:15:39 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,080 | cpp | #include<iostream>
#include<conio.h>
using namespace std;
class Logic
{
public:
int x=0,y=0;
Logic();
char Bool(int val);
void conjunction(bool check);
void disjunction(bool check);
void exclusiveOr(bool check);
void conditional();
void negation();
};
Logic::Logic()
{
cout<<"Start of program"<<endl;
}
char Logic::Bool(int val)
{
if(val==0)
return 'F';
else
return 'T';
}
void Logic::conjunction(bool check)
{
for(x=0;x<=1;x++)
{
for(y=0;y<=1;y++)
{
cout << Bool(x) << " | " << Bool(y) << " | ";
if(check)
cout<<Bool(x&y)<<endl;
else
cout<<Bool(!(x&y))<<endl;
}
}
}
void Logic::disjunction(bool check)
{
for(x=0;x<=1;x++)
{
for(y=0;y<=1;y++)
{
cout << Bool(x) << " | " << Bool(y) << " | ";
if(check)
cout<<Bool(x|y)<<endl;
else
cout<<Bool(!(x|y))<<endl;
}
}
}
void Logic::exclusiveOr(bool check)
{
for(x=0;x<=1;x++)
{
for(y=0;y<=1;y++)
{
cout << Bool(x) << " | " << Bool(y) << " | ";
if(check)
cout<<Bool(x^y)<<endl;
else
cout<<Bool(!(x^y))<<endl;
}
}
}
void Logic::conditional()
{
for(x=0;x<=1;x++)
{
for(y=0;y<=1;y++)
{
cout << Bool(x) << " | " << Bool(y) << " | ";
cout<<Bool((!x)|y)<<endl;
}
}
}
void Logic::negation()
{
for(x=0;x<=1;x++)
{
for(y=0;y<=1;y++)
cout << Bool(x) << " | " << Bool(y) << " | " << Bool(!x) << " | " << Bool(!y)<<endl;
}
}
int main()
{
int choice;
char repeat;
Logic logic;
do
{
cout<<"*****MENU*****"<<endl;
cout<<"1.Conjunction"<<endl;
cout<<"2.Disjunction"<<endl;
cout<<"3.Exclusive OR"<<endl;
cout<<"4.Conditional"<<endl;
cout<<"5.Biconditional"<<endl;
cout<<"6.Exclusive NOR"<<endl;
cout<<"7.Negation"<<endl;
cout<<"8.Nand"<<endl;
cout<<"9.Nor"<<endl;
cout<<"Enter your choice"<<endl;
cin>>choice;
switch(choice)
{
case 1:
{
cout << endl;
cout << "x | "<< "y | "<< "x&y"<<endl;
cout << "===================="<<endl;
logic.conjunction(true);
break;
}
case 2:
{
cout << endl;
cout << "x | "<< "y | "<< "x|y"<<endl;
cout << "===================="<<endl;
logic.disjunction(true);
break;
}
case 3:
{
cout<<endl;
cout << "x | "<< "y | "<< "x^y"<<endl;
logic.exclusiveOr(true);
break;
}
case 4:
{
cout << endl;
cout << "x | "<< "y | "<< "x->y"<<endl;
cout << "===================="<<endl;
logic.conditional();
break;
}
case 5:
{
cout << endl;
cout << "x | "<< "y | "<< "x<->y"<<endl;
cout << "===================="<<endl;
logic.exclusiveOr(false);
break;
}
case 6:
{
cout << endl;
cout << "x | "<< "y | "<< "!(x^y)"<<endl;
cout << "===================="<<endl;
logic.exclusiveOr(false);
break;
}
case 7:
{
cout << endl;
cout << "x | "<< "y | "<< "~x | "<< "~y "<<endl;
cout << "==============================="<<endl;
logic.negation();
break;
}
case 8:
{
cout << endl;
cout << "x | "<< "y | "<< "xNANDy"<<endl;
cout << "===================="<<endl;
logic.conjunction(false);
break;
}
case 9:
{
cout << endl;
cout << "x | "<< "y | "<< "xNORy"<<endl;
cout << "===================="<<endl;
logic.disjunction(false);
break;
}
default:
{
cout<<"Wrong choice"<<endl;break;
}
}
cout<<"Do you want to continue :(Y?N) "<<endl;
cin>>repeat;
}
while(repeat=='Y'||repeat=='y');
}
| [
"noreply@github.com"
] | noreply@github.com |
817ceff8caf76d25ca44526a808f1919b4b07840 | 95919f25b4d47bbd37b462ae730ebeae6252ed6b | /010(concentricPattern)/main.cpp | 060091714bf91c9cdbd38b8999365fc0002326cf | [] | no_license | Karandeep98/InterviewBit | 20c6dd5137bac9c295b7489d0c6b09980584b95a | 2e562297ebef4072248a40ad45b321b413ff558c | refs/heads/master | 2021-01-01T01:49:05.362554 | 2020-04-25T17:39:44 | 2020-04-25T17:39:44 | 239,128,604 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 749 | cpp | #include <bits/stdc++.h>
using namespace std;
vector<vector<int> > prettyPrint(int A) {
int n=(2*A)-1;
vector<vector<int>>v(n,vector<int>(n));
int top=0,bottom=n-1,left=0,right=n-1;
while(A>0){
for(int i=left;i<=right;i++){
v[top][i]=A;
v[bottom][i]=A;
}
for(int i=top;i<=bottom;i++){
v[i][left]=A;
v[i][right]=A;
}
left++;right--;top++;bottom--;
A--;
}
return v;
}
int main()
{
int num;vector<vector<int>>v;
cin>>num;
v=prettyPrint(num);
for(int i=0;i<v.size();i++){
for(int j=0;j<v[0].size();j++){
cout<<v[i][j]<<" ";
}
cout<<endl;
}
return 0;
}
| [
"karandeep041998@gmail.com"
] | karandeep041998@gmail.com |
e7faa2b4ad7d23fe0fb173c900a3132fea58ed45 | 2f10f807d3307b83293a521da600c02623cdda82 | /deps/boost/win/debug/include/boost/thread/pthread/condition_variable_fwd.hpp | c746eb33c39b1eb0b04707fd001814f8e55dda07 | [] | no_license | xpierrohk/dpt-rp1-cpp | 2ca4e377628363c3e9d41f88c8cbccc0fc2f1a1e | 643d053983fce3e6b099e2d3c9ab8387d0ea5a75 | refs/heads/master | 2021-05-23T08:19:48.823198 | 2019-07-26T17:35:28 | 2019-07-26T17:35:28 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 130 | hpp | version https://git-lfs.github.com/spec/v1
oid sha256:1678db83db4354f14ec1c306c7e2e136d3e50e4e5037b00900d93a21c233ea4b
size 13832
| [
"YLiLarry@gmail.com"
] | YLiLarry@gmail.com |
987d137af9dc1d3311e98bd88a469a9b0c07bc25 | 3e0a92e3b52e751bc173e21d96bb8606241ee7fd | /baekjoon/smilu/8131.cpp | 303673b65293373d6fe177c67177257fa79d8689 | [] | no_license | socc-io/algostudy | 17b923492fa93cb7ab8ac4e6611766a85d4afc36 | 70c6d249033f8e5bc2288a347e50cc5eeab85c1c | refs/heads/master | 2023-03-03T13:12:19.875684 | 2023-02-19T09:45:23 | 2023-02-19T09:45:28 | 28,948,738 | 9 | 3 | null | 2016-01-24T07:31:11 | 2015-01-08T04:25:40 | C++ | UTF-8 | C++ | false | false | 1,559 | cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MAX_N = 2020;
// const ll LL_INF = 0x3f3f3f3f3f3f3f3f;
const int L_INF = 0x3f3f3f3f;
int h, w;
ll k;
ll r_sum[MAX_N][MAX_N];
ll c_sum[MAX_N][MAX_N];
void transpose() {
for (int x = 1; x < MAX_N; x++) {
for (int y = 1; y < MAX_N; y++) {
swap(r_sum[x][y], c_sum[x][y]);
}
}
swap(h, w);
}
bool row_check(int x, int y1, int y2) {
return r_sum[x][y2] - r_sum[x][y1-1] <= k;
}
bool col_check(int y, int x1, int x2) {
return c_sum[y][x2] - c_sum[y][x1-1] <= k;
}
int dp[MAX_N][MAX_N];
ll get(int x1, int y1, int x2, int y2) {
if (x1 > x2 || y1 > y2) return 0;
ll alpha = 0;
while (x1 <= x2 && row_check(x1, y1, y2)) {
++x1;
++alpha;
}
while (x1 <= x2 && row_check(x2, y1, y2)) {
--x2;
++alpha;
}
if (x1 > x2) return alpha;
if (dp[y1][y2] != L_INF) return dp[y1][y2] + alpha;
ll ret = 0x3f3f3f3f3f3f3f3f;
if (col_check(y1, x1, x2)) {
ret = min(ret, get(x1, y1+1, x2, y2) + 1);
}
if (col_check(y2, x1, x2)) {
ret = min(ret, get(x1, y1, x2, y2-1) + 1);
}
return (dp[y1][y2] = ret) + alpha;
}
int main(void)
{
scanf("%lld%d%d", &k, &w, &h);
for (int x = 1; x <= h; x++) {
for (int y = 1; y <= w; y++) {
ll tmp; scanf("%lld", &tmp);
r_sum[x][y] = r_sum[x][y-1] + tmp;
c_sum[y][x] = c_sum[y][x-1] + tmp;
}
}
memset(dp, 0x3f, sizeof(dp));
ll a = get(1, 1, h, w);
transpose();
memset(dp, 0x3f, sizeof(dp));
ll b = get(1, 1, h, w);
printf("%lld\n", min(a, b));
}
| [
"smilup2244@gmail.com"
] | smilup2244@gmail.com |
c197c63c73e702483c2a36f957fc52bda38ddafd | cc7661edca4d5fb2fc226bd6605a533f50a2fb63 | /mscorlib/NotSupportedException.h | 719fd06f39c016e0837a6b32db46b53bebdb3730 | [
"MIT"
] | permissive | g91/Rust-C-SDK | 698e5b573285d5793250099b59f5453c3c4599eb | d1cce1133191263cba5583c43a8d42d8d65c21b0 | refs/heads/master | 2020-03-27T05:49:01.747456 | 2017-08-23T09:07:35 | 2017-08-23T09:07:35 | 146,053,940 | 1 | 0 | null | 2018-08-25T01:13:44 | 2018-08-25T01:13:44 | null | UTF-8 | C++ | false | false | 128 | h | #pragma once
namespace System
{
class NotSupportedException : public SystemException // 0x60
{
public:
}; // size = 0x60
}
| [
"info@cvm-solutions.co.uk"
] | info@cvm-solutions.co.uk |
38beea6825f0252f4f5e7c540c548f7908dc43c5 | 03ad1b957132959e7fac4a8da46135d9c1a4be15 | /PAT/PATB/1028.cpp | a356e3e86f3e1e31cc5e8d7ee489411158493fc8 | [] | no_license | nopnewbie/OJExercise | 7276125d6ba69b8249845a7fa88489c57bb33f51 | 7f99619e1bbe056ea63a0d0e993c9afe5ac94bec | refs/heads/master | 2021-01-22T05:20:37.551780 | 2017-05-12T15:54:09 | 2017-05-12T15:54:09 | 81,650,970 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,319 | cpp | /*
PAT(B):1028. 人口普查(20)
Date: 2016年1月30日 15:16:30
*/
#include<iostream>
#include<fstream>
#include<vector>
#include<string>
#include<cstring>
#include<cctype>
#include<algorithm>
using namespace std;
struct Person
{
string name;
int yy, mm, dd;
Person(){}
Person(string na, int y, int m, int d):name(na), yy(y), mm(m), dd(d){}
bool operator < (const Person &a) const
{
if( yy != a.yy ) return yy < a.yy;
else if( mm != a.mm ) return mm < a.mm;
else return dd < a.dd;
}
};
const int year = 2014, month = 9, day = 6;
const int old_year = 1814, old_month = 9, old_day = 6;
int main()
{
#define LOCAL
#ifdef LOCAL
#define cin fin
ifstream fin("F:\\input.txt");
freopen("F:\\input.txt", "r", stdin);
#endif
vector<Person> ans;
int n, yy, mm, dd;
char na[6] = {0};
for( scanf("%d", &n); n; --n )
{
scanf("%s %d/%d/%d", na, &yy, &mm, &dd);
if( yy > year ) continue;
else if( yy == year &&( mm > month || (mm == month && dd > day) ) )continue;
if( yy < old_year ) continue;
else if( yy == old_year && ( mm < month || (mm == old_month && dd < old_day) ) ) continue;
ans.push_back(Person(na, yy, mm, dd));
}
if(ans.empty()) printf("0\n");
else
{
sort(ans.begin(), ans.end());
printf("%d %s %s\n", ans.size(), ans[0].name.c_str(), ans.back().name.c_str());
}
return 0;
} | [
"hireedleo@gmail.com"
] | hireedleo@gmail.com |
ad187d5b66d54f65eefb5a230ed55b1c81890685 | a3d6556180e74af7b555f8d47d3fea55b94bcbda | /third_party/blink/renderer/core/exported/web_form_control_element_test.cc | 5021cb3e5df720796bf917a080fe49913572eb84 | [
"BSD-3-Clause",
"LGPL-2.0-or-later",
"LicenseRef-scancode-warranty-disclaimer",
"LGPL-2.1-only",
"GPL-1.0-or-later",
"GPL-2.0-only",
"LGPL-2.0-only",
"BSD-2-Clause",
"LicenseRef-scancode-other-copyleft",
"MIT",
"Apache-2.0"
] | permissive | chromium/chromium | aaa9eda10115b50b0616d2f1aed5ef35d1d779d6 | a401d6cf4f7bf0e2d2e964c512ebb923c3d8832c | refs/heads/main | 2023-08-24T00:35:12.585945 | 2023-08-23T22:01:11 | 2023-08-23T22:01:11 | 120,360,765 | 17,408 | 7,102 | BSD-3-Clause | 2023-09-10T23:44:27 | 2018-02-05T20:55:32 | null | UTF-8 | C++ | false | false | 4,960 | cc | // Copyright 2023 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "third_party/blink/public/web/web_form_control_element.h"
#include <vector>
#include "base/test/scoped_feature_list.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/public/common/features.h"
#include "third_party/blink/public/web/web_autofill_state.h"
#include "third_party/blink/public/web/web_document.h"
#include "third_party/blink/renderer/core/dom/document.h"
#include "third_party/blink/renderer/core/dom/element.h"
#include "third_party/blink/renderer/core/dom/events/native_event_listener.h"
#include "third_party/blink/renderer/core/event_type_names.h"
#include "third_party/blink/renderer/core/events/keyboard_event.h"
#include "third_party/blink/renderer/core/execution_context/execution_context.h"
#include "third_party/blink/renderer/core/html/forms/html_form_control_element.h"
#include "third_party/blink/renderer/core/testing/page_test_base.h"
namespace blink {
namespace {
using ::testing::ElementsAre;
using ::testing::Values;
// A fake event listener that logs keys and codes of observed keyboard events.
class FakeEventListener final : public NativeEventListener {
public:
void Invoke(ExecutionContext*, Event* event) override {
KeyboardEvent* keyboard_event = DynamicTo<KeyboardEvent>(event);
if (!event) {
return;
}
codes_.push_back(keyboard_event->code());
keys_.push_back(keyboard_event->key());
}
const std::vector<String>& codes() const { return codes_; }
const std::vector<String>& keys() const { return keys_; }
private:
std::vector<String> codes_;
std::vector<String> keys_;
};
} // namespace
class WebFormControlElementTest
: public PageTestBase,
public testing::WithParamInterface<const char*> {
public:
WebFormControlElementTest() {
feature_list_.InitAndEnableFeature(
blink::features::kAutofillSendUnidentifiedKeyAfterFill);
}
protected:
void InsertHTML() {
GetDocument().documentElement()->setInnerHTML(GetParam());
}
WebFormControlElement TestElement() {
HTMLFormControlElement* control_element = DynamicTo<HTMLFormControlElement>(
GetDocument().getElementById(AtomicString("testElement")));
DCHECK(control_element);
return WebFormControlElement(control_element);
}
private:
base::test::ScopedFeatureList feature_list_;
};
// Tests that resetting a form clears the `user_has_edited_the_field_` state.
TEST_F(WebFormControlElementTest, ResetDocumentClearsEditedState) {
GetDocument().documentElement()->setInnerHTML(R"(
<body>
<form id="f">
<input id="text_id">
<select id="select_id">
<option value="Bar">Bar</option>
<option value="Foo">Foo</option>
</select>
<selectlist id="selectlist_id">
<option value="Bar">Bar</option>
<option value="Foo">Foo</option>
</selectlist>
<input id="reset" type="reset">
</form>
</body>
)");
WebFormControlElement text(
DynamicTo<HTMLFormControlElement>(GetElementById("text_id")));
WebFormControlElement select(
DynamicTo<HTMLFormControlElement>(GetElementById("select_id")));
WebFormControlElement selectlist(
DynamicTo<HTMLFormControlElement>(GetElementById("selectlist_id")));
text.SetUserHasEditedTheField(true);
select.SetUserHasEditedTheField(true);
selectlist.SetUserHasEditedTheField(true);
EXPECT_TRUE(text.UserHasEditedTheField());
EXPECT_TRUE(select.UserHasEditedTheField());
EXPECT_TRUE(selectlist.UserHasEditedTheField());
To<HTMLFormControlElement>(GetElementById("reset"))->click();
EXPECT_FALSE(text.UserHasEditedTheField());
EXPECT_FALSE(select.UserHasEditedTheField());
EXPECT_FALSE(selectlist.UserHasEditedTheField());
}
TEST_P(WebFormControlElementTest, SetAutofillValue) {
InsertHTML();
WebFormControlElement element = TestElement();
auto* keypress_handler = MakeGarbageCollected<FakeEventListener>();
element.Unwrap<HTMLFormControlElement>()->addEventListener(
event_type_names::kKeydown, keypress_handler);
EXPECT_EQ(TestElement().Value(), "test value");
EXPECT_EQ(element.GetAutofillState(), WebAutofillState::kNotFilled);
// We expect to see one "fake" key press event with an unidentified key.
element.SetAutofillValue("new value", WebAutofillState::kAutofilled);
EXPECT_EQ(element.Value(), "new value");
EXPECT_EQ(element.GetAutofillState(), WebAutofillState::kAutofilled);
EXPECT_THAT(keypress_handler->codes(), ElementsAre(""));
EXPECT_THAT(keypress_handler->keys(), ElementsAre("Unidentified"));
}
INSTANTIATE_TEST_SUITE_P(
All,
WebFormControlElementTest,
Values("<input type='text' id=testElement value='test value'>",
"<textarea id=testElement>test value</textarea>"));
} // namespace blink
| [
"chromium-scoped@luci-project-accounts.iam.gserviceaccount.com"
] | chromium-scoped@luci-project-accounts.iam.gserviceaccount.com |
9ac388a84aca441c6f542f371bf97344f6dd89da | db61ce113b4f69f61c1bc1077c34595e5a9ebec6 | /libs/Texturize.Codecs.EXR/src/codecs.exr.cpp | f2bc5c6fb35b2553cbcb2f7294c7067b0c585a57 | [
"MIT"
] | permissive | zephyr007/Texturize | 32ea84916ae8cf3e8954b5ba73a70a9c1d5a7978 | bba688d1afd60363f03e02d28e642a63845591d6 | refs/heads/master | 2020-06-10T06:23:06.245966 | 2019-03-25T17:10:50 | 2019-03-25T17:10:50 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 25 | cpp | #include <Codecs\exr.hpp> | [
"18394207+Aschratt@users.noreply.github.com"
] | 18394207+Aschratt@users.noreply.github.com |
afaab6a362b77fdefd7f0f37388bcaf1cfc6a0fe | f997719e5c6ead0afe34fde453bebb1684ded6de | /app/src/main/cpp/gles3jni.cpp | 911de80bfe6b069278c3c2938e37ed02562a6e6e | [] | no_license | jamienicol/blitframebuffers-test | b91ca691edd06ddcb15d5834cce9b0a4842a9b7f | df1c82785b39dc4118dd228a7921b1126d5377f8 | refs/heads/master | 2020-04-06T19:01:31.570995 | 2018-11-15T14:19:44 | 2018-11-15T14:19:44 | 157,722,498 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,025 | cpp | /*
* Copyright 2013 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <jni.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include "gles3jni.h"
bool checkGlError(const char* funcName) {
GLint err = glGetError();
if (err != GL_NO_ERROR) {
ALOGE("GL error after %s(): 0x%08x\n", funcName, err);
return true;
}
return false;
}
static void printGlString(const char* name, GLenum s) {
const char* v = (const char*)glGetString(s);
ALOGV("GL %s: %s\n", name, v);
}
// ----------------------------------------------------------------------------
Renderer::Renderer()
{
}
Renderer::~Renderer() {
}
void Renderer::resize(int w, int h) {
glViewport(0, 0, w, h);
}
void Renderer::step() {
}
void Renderer::render() {
step();
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
glClearColor(0.2f, 0.2f, 0.3f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
draw();
checkGlError("Renderer::render");
}
// ----------------------------------------------------------------------------
static Renderer* g_renderer = NULL;
extern "C" {
JNIEXPORT void JNICALL Java_com_android_gles3jni_GLES3JNILib_init(JNIEnv* env, jobject obj);
JNIEXPORT void JNICALL Java_com_android_gles3jni_GLES3JNILib_resize(JNIEnv* env, jobject obj, jint width, jint height);
JNIEXPORT void JNICALL Java_com_android_gles3jni_GLES3JNILib_step(JNIEnv* env, jobject obj);
};
#if !defined(DYNAMIC_ES3)
static GLboolean gl3stubInit() {
return GL_TRUE;
}
#endif
JNIEXPORT void JNICALL
Java_com_android_gles3jni_GLES3JNILib_init(JNIEnv* env, jobject obj) {
if (g_renderer) {
delete g_renderer;
g_renderer = NULL;
}
printGlString("Version", GL_VERSION);
printGlString("Vendor", GL_VENDOR);
printGlString("Renderer", GL_RENDERER);
printGlString("Extensions", GL_EXTENSIONS);
const char* versionStr = (const char*)glGetString(GL_VERSION);
if (strstr(versionStr, "OpenGL ES 3.") && gl3stubInit()) {
g_renderer = createES3Renderer();
} else {
ALOGE("Unsupported OpenGL ES version");
}
}
JNIEXPORT void JNICALL
Java_com_android_gles3jni_GLES3JNILib_resize(JNIEnv* env, jobject obj, jint width, jint height) {
if (g_renderer) {
g_renderer->resize(width, height);
}
}
JNIEXPORT void JNICALL
Java_com_android_gles3jni_GLES3JNILib_step(JNIEnv* env, jobject obj) {
if (g_renderer) {
g_renderer->render();
}
}
| [
"jamie@jamienicol.me"
] | jamie@jamienicol.me |
34695910fc4acd65b69ac93fe686cf0ea025e37c | c60bc35351d5578f727f93e14c3f911bed902e75 | /2ndyear/processes/fork.cpp | 2f7759b046dee15615e3d988ee10cea6a4462fa8 | [] | no_license | timurrrr/mipt-cs-timurrrr | 32ac838a7bc4f556aacb8df1610f077dedef5afb | 9540065e276886df1ddb1d99dca2cc248f71538d | refs/heads/master | 2020-04-22T01:46:05.623414 | 2011-05-05T20:57:06 | 2011-05-05T20:57:06 | 1,708,406 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 447 | cpp | #include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
int main() {
pid_t child_pid = fork();
printf("==%d== After fork()\n", getpid());
if (child_pid == 0) {
// In child
printf("==%d== In child. PPID = %d\n",
getpid(), getppid());
} else {
// In parent
printf("==%d== In parent. child_pid = %d\n",
getpid(), child_pid);
}
printf("==%d== End\n", getpid());
//usleep(1000000);
return 0;
}
| [
"timurrrr@gmail.com"
] | timurrrr@gmail.com |
192a57dd30776b1e4173d18e41f473962f5b2f01 | d048ae4ccacdcc2419bf54b6c494e311b1ba8ee4 | /ICPC17/EQUALMOD.cpp | 342d2107438c958981bb506bd79622b24d7be6a4 | [] | no_license | poke19962008/Competitive-Coding | ad1dd00a20c304cc6a55af22ea295c2398d59aca | 0356c0fe6d9c03bf3d4fd9cc23116567d94c1dbf | refs/heads/master | 2021-01-21T03:25:26.640367 | 2017-11-05T22:33:41 | 2017-11-05T22:33:41 | 47,500,612 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,851 | cpp | #include <algorithm>
#include <iostream>
#include <stdio.h>
#include <math.h>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <map>
#include <set>
using namespace std;
#define EPS 1e-9
#define INF 1e15+9
#define MOD 1000000007
#define MAXN 1000006
#define ioS ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define debug(x) cout<<#x<<"="<<x<<"\n";
#define debug_(x,y) cout<<#x<<"="<<x<<" and "<<#y<<"="<<y<<"\n";
int max(int a, int b) { return ((a>b)?a:b); }
int min(int a, int b) { return ((a<b)?a:b); }
#define pb push_back
#define mp make_pair
#define FOR(i, j, k, in) for (int i=j ; i<k ; i+=in)
#define RFOR(i, j, k, in) for (int i=j ; i>=k ; i-=in)
#define REP(i, j) FOR(i, 0, j, 1)
#define RREP(i, j) RFOR(i, j, 0, 1)
typedef unsigned long long int ul;
typedef long long int ll;
typedef long int l;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
// int fastinput(){int t=0;char c;c=getchar_unlocked();while(c<'0' || c>'9')c=getchar_unlocked();while(c>='0' && c<='9'){t=(t<<3)+(t<<1)+c-'0';c=getchar_unlocked();}return t;}
int main() {
ioS;
int T;
cin >> T;
while (T--) {
int N;
cin >> N;
int A[N], B[N];
for (int i = 0; i < N; i++) cin >> A[i];
set <int> pos;
for (int i = 0; i < N; i++) {
cin >> B[i];
pos.insert(A[i]%B[i]);
}
long long sol = 100000000000000000;
set<int>::iterator it;
for (it = pos.begin(); it != pos.end(); it++) {
int i = *it;
long long s = 0;
for (int j = 0; j < N; j++) {
if (A[j] < i) {
s += i - A[j];
}
else if (A[j] > i) {
s += B[j] - A[j] + i;
}
if (sol <= s)
break;
}
if (s < sol)
sol = s;
}
cout << sol << "\n";
}
}
| [
"poke19962008@gmail.com"
] | poke19962008@gmail.com |
6d79c6cdabcda10a9f14fad43e760ee6da27fa8f | ed7d5a10952585b63d23772c8bd10f90b60b8ff3 | /src/ComptonDetectorConstruction.cc | 4cd95f34a7838e8ae4b0c59f8d533a2b7ae4ca29 | [] | no_license | dnorcini/ComptonSim | ba8b4c8a5d8f29282d0eeaed8ac47f282283e442 | 6f3899ec54400f03ecd39cb3e360cdf94d0a6211 | refs/heads/master | 2022-07-16T15:58:01.189143 | 2020-05-12T15:03:44 | 2020-05-12T15:03:44 | 78,128,075 | 3 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 24,145 | cc | // ComptonDetectorConstruction.cc
#include "ComptonDetectorConstruction.hh"
#include "ComptonCalorimeterSD.hh"
#include "ComptonDetectorMessenger.hh"
#include "G4Material.hh"
#include "G4NistManager.hh"
#include "G4Box.hh"
#include "G4Tubs.hh"
#include "G4LogicalVolume.hh"
#include "G4PVPlacement.hh"
#include "G4PVReplica.hh"
#include "G4AutoDelete.hh"
#include "G4SDManager.hh"
#include "G4VisAttributes.hh"
#include "G4Colour.hh"
#include "G4PhysicalConstants.hh"
#include "G4SystemOfUnits.hh"
#include "G4UImanager.hh"
#include "G4RunManager.hh"
#include "G4GeometryManager.hh"
#include "G4PhysicalVolumeStore.hh"
#include "G4LogicalVolumeStore.hh"
#include "G4SolidStore.hh"
#include "G4OpticalSurface.hh"
#include "G4MaterialTable.hh"
// ComptonDetectorConstruction object constructor, from parent class G4UserDetectorConstruction
ComptonDetectorConstruction::ComptonDetectorConstruction()
: G4VUserDetectorConstruction(),
fCheckOverlaps(true)
{
// create commands for interactive definition of geometry
ComptonDetectorMessenger* detectorMessenger = new ComptonDetectorMessenger(this);
// DEFAULT geometry parameters
worldSizeXYZ = 1.*m;
// coordinate system: x right, y back, z up
// collimator system
// collimator #1
collimator1Radius = 6.*cm;
collimator1HoleRadius = 10.*mm;
collimator1X = 10.*cm;
//collimator1HoleX = collimator1X/2.;
// collimator #2
//G4bool twoCollimator = true;
collimator2Radius = collimator1Radius;
collimator2HoleRadius = 1.2*collimator1HoleRadius; //from Daya Bay (1cm)
collimator2X = 5.*cm;
// source housing
sourceRadius = collimator1Radius;
sourceHoleRadius = 2*cm;
sourceX = 10*cm;
sourceHoleX = sourceX/2.;
// target ordering: diffuser, acrylic cell, scintillator
// RIGHT NOW no aluminum casing
// acrylic cell
cellRadius = (3.*2.54)/2*cm; //3" PMTs
cellX = (3.*2.54)/2*cm;
// diffuser coating (parameters defined by acrylic cell)
diffuserIR = cellRadius;
diffuserOR = diffuserIR + .10*mm; // ??
diffuserX = cellX;
// scintillator target (define by mL, how best to do this ??)
scintillator1Radius = cellRadius-(.25*2.54)*cm; //thickness of UVT??
scintillator1X = cellX - (.25*2.54)*cm; //thickness of UVT??
//see how many hits are in the smaller volume, interaction region 20%?
scintillator2Radius = scintillator1Radius*0.2;
scintillator2X = scintillator1X*0.2;
// shield system
// shield #1
shield1YZ = 5.*cm; // ??
shield1X = 85.*mm; //from Daya Bay for 45deg
shield1HoleRadius = 15.*mm; //from Daya Bay for 45deg
//shield #2
//shield2YZ = 5.*cm; // ??
//shield2X = 85.*mm; //from Daya Bay
//shield2HoleRadius = 15./2.; //from Daya Bay
//shield #3
//shield3YZ = 5.*cm; // ??
//shield3X = 65.*mm; //from Daya Bay
//shield3HoleRadius = 25./2.; //from Daya Bay
// HPGe detector (crystal only)
HPGeRadius = 49.6/2*mm; //from spec sheet
HPGeX = 59.6*mm; //from spec sheet
// positioning of components (with respect to the target)
// NEED TO BE CENTROID TO CENTROID
sourcetoScintillator = .75*m;
collimator1toScintillator = sourcetoScintillator - sourceX - collimator1X - .5*cm;
collimator2toScintillator = sourcetoScintillator - sourceX - collimator1X - collimator2X - 15*cm;
shield1toScintillator = diffuserOR + 15.*cm; //??
//shield2toScintillator = shield1toScintillator + shield2X + .15*m;
//shield3toScintillator = shield1toScintillator + shield2X + shield3X + .3*m;
HPGetoScintillator = .75*m;
//
// rotation of spectrometer arm
armAngle = 45.*deg; //angle between HPGe
}
// ComptonDetectorConstruction object destructor
ComptonDetectorConstruction::~ComptonDetectorConstruction()
{ delete detectorMessenger; }
// construct physical volume
G4VPhysicalVolume* ComptonDetectorConstruction::Construct()
{
// define materials
DefineMaterials();
// define volumes
return DefineVolumes();
}
// DefineMaterials() definition
void ComptonDetectorConstruction::DefineMaterials()
{
// materials defined using NIST Manager
G4NistManager* nistManager = G4NistManager::Instance();
nistManager->FindOrBuildMaterial("G4_AIR");
nistManager->FindOrBuildMaterial("G4_Pb");
nistManager->FindOrBuildMaterial("G4_PLEXIGLASS"); //use UVT when implement PMTs
nistManager->FindOrBuildMaterial("G4_Ge");
// define elements for EJ309 (LS) and EJ510 (diffuse reflector)
G4Element* elH = new G4Element("Hydrogen", "H", 1., 1.01*g/mole);
G4Element* elC = new G4Element("Carbon", "C", 6., 12.00*g/mole);
G4Element* elO = new G4Element("Oxygen", "O", 8., 16.00*g/mole);
G4Element* elTi = new G4Element("Titanium", "C", 22., 47.87*g/mole);
G4double scintillatorDensity = 0.959*g/cm3;
G4double diffuserDensity = 0.118*g/cm3;
G4double massFraction;
G4int nComponents, nAtoms;
// EJ309 definition
G4Material* EJ309 = new G4Material("EJ309", scintillatorDensity, nComponents = 2);
EJ309->AddElement(elH, nAtoms = 5);
EJ309->AddElement(elC, nAtoms = 4);
// EJ510 definition
G4Material* EJ510 = new G4Material("EJ510", diffuserDensity, nComponents = 4);
EJ510->AddElement(elH, massFraction = 0.02899);
EJ510->AddElement(elC, massFraction = 0.17194);
EJ510->AddElement(elO, massFraction = 0.38854);
EJ510->AddElement(elTi, massFraction = 0.41053);
// G4Material* fGlass = new G4Material("Glass", density=1.032*g/cm3,2);
//fGlass->AddElement(elC, massFraction = .91533);
//fGlass->AddElement(elH, massFraction = .08467);
G4cout << *(G4Material::GetMaterialTable()) << G4endl;
}
// DefineVolumes() definition
G4VPhysicalVolume* ComptonDetectorConstruction::DefineVolumes()
{
// Clean old geometry, if any
G4GeometryManager::GetInstance()->OpenGeometry();
G4PhysicalVolumeStore::GetInstance()->Clean();
G4LogicalVolumeStore::GetInstance()->Clean();
G4SolidStore::GetInstance()->Clean();
G4ThreeVector armPosition = G4ThreeVector(std::cos(armAngle), std::sin(armAngle),0.);
G4RotationMatrix armRotation = G4RotationMatrix();
armRotation.rotateY(90*deg);
armRotation.rotateZ(armAngle);
// rotation of cylinders to be along x
G4RotationMatrix cylXrotation = G4RotationMatrix();
cylXrotation.rotateY(90*deg);
// get materials
G4Material* air = G4Material::GetMaterial("G4_AIR");
G4Material* lead = G4Material::GetMaterial("G4_Pb");
G4Material* germanium = G4Material::GetMaterial("G4_Ge");
G4Material* scintillatorMaterial = G4Material::GetMaterial("EJ309");
G4Material* diffuserMaterial = G4Material::GetMaterial("EJ510");
G4Material* cellMaterial = G4Material::GetMaterial("G4_PLEXIGLASS");
// world
G4VSolid* worldS = new G4Box("World", worldSizeXYZ, worldSizeXYZ, worldSizeXYZ);
G4LogicalVolume* worldLV = new G4LogicalVolume(worldS, air, "World");
G4VPhysicalVolume* worldPV = new G4PVPlacement(
0, // no rotation
G4ThreeVector(), // at (0,0,0)
worldLV, // its logical volume
"World", // its name
0, // its mother volume
false, // no boolean operation
0, // copy number
fCheckOverlaps); // checking overlaps
// define logical volume of target = diffuser+cell+scintillator
// caloriimeter = scintillator logical volume
// positions of other components are with respect to this object
G4VSolid* diffuserS = new G4Tubs("diffuserS", diffuserIR, diffuserOR, diffuserX, 0.*deg, 360.*deg);
G4LogicalVolume* diffuserLV = new G4LogicalVolume(diffuserS, diffuserMaterial, "diffuserLV");
new G4PVPlacement(
0, // no rotation
G4ThreeVector(), // at (0,0,0)
diffuserLV, // its logical volume
"Diffuser", // its name
worldLV, // its mother volume
false, // no boolean operation
0, // copy number
fCheckOverlaps); // checking overlaps
G4VSolid* cellS = new G4Tubs("cellS", 0, cellRadius, cellX, 0.*deg, 360.*deg);
G4LogicalVolume* cellLV = new G4LogicalVolume(cellS, cellMaterial, "cellLV");
new G4PVPlacement(
0, // no rotation
G4ThreeVector() , // at (0,0,0)
cellLV, // its logical volume
"Cell", // its name
worldLV, // its mother volume BE CAREFUL HERE!!
false, // no boolean operation
0, // copy number
fCheckOverlaps); // checking overlaps
G4VSolid* scintillator1S = new G4Tubs("scintillator1S", 0., scintillator1Radius, scintillator1X, 0.*deg, 360.*deg);
G4LogicalVolume* scintillator1LV = new G4LogicalVolume(scintillator1S, scintillatorMaterial, "scintillator1LV");
new G4PVPlacement(
0, // no rotation
G4ThreeVector(), // at (0,0,0)
scintillator1LV, // its logical volume
"Scintillator1", // its name
cellLV, // its mother volume
false, // no boolean operation
0, // copy number
fCheckOverlaps); // checking overlaps
G4VSolid* scintillator2S = new G4Tubs("scintillator2S", 0., scintillator2Radius, scintillator2X, 0.*deg, 360.*deg);
G4LogicalVolume* scintillator2LV = new G4LogicalVolume(scintillator2S, scintillatorMaterial, "scintillator2LV");
new G4PVPlacement(
0, // no rotation
G4ThreeVector(), // at (0,0,0)
scintillator2LV, // its logical volume
"Scintillator2", // its name
scintillator1LV, // its mother volume
false, // no boolean operation
0, // copy number
fCheckOverlaps); // checking overlaps
// collimators (lead cylinder + air cylinder)
G4VSolid* collimator1S = new G4Tubs("collimator1S", 0, collimator1Radius, collimator1X, 0.*deg, 360.*deg);
G4LogicalVolume* collimator1LV = new G4LogicalVolume(collimator1S, lead, "collimator1LV");
G4Transform3D collimator1Transform = G4Transform3D(cylXrotation, G4ThreeVector(-collimator1toScintillator, 0., 0.));
new G4PVPlacement(
collimator1Transform, // transform
//0,
//G4ThreeVector(-collimator1toScintillator, 0., 0.),
collimator1LV, // its logical volume
"Collimator1", // its name
worldLV, // its mother volume
false, // no boolean operation
0, // copy number
fCheckOverlaps); // checking overlaps
// NOTE: coordinates of daughters are respect to mother volume, NOT WORLD
G4VSolid* collimator1HoleS = new G4Tubs("collimator1HoleS", 0., collimator1HoleRadius, collimator1X, 0.*deg, 360.*deg);
G4LogicalVolume* collimator1HoleLV = new G4LogicalVolume(collimator1HoleS, air, "collimator1HoleLV");
//G4Transform3D collimator1HoleTransform = G4Transform3D(0, G4ThreeVector(0., 0., 0.));
new G4PVPlacement(
// collimator1HoleTransform,
0,
G4ThreeVector(0.,0.,0.),
collimator1HoleLV, // its logical volume
"Collimator1Hole", // its name
collimator1LV, // its mother volume
false, // no boolean operation
0, // copy number
fCheckOverlaps); // checking overlaps
G4VSolid* collimator2S = new G4Tubs("collimator2S", 0., collimator2Radius, collimator2X, 0.*deg, 360.*deg);
G4LogicalVolume* collimator2LV = new G4LogicalVolume(collimator2S, lead, "collimator2LV");
G4Transform3D collimator2Transform = G4Transform3D(cylXrotation, G4ThreeVector(-collimator2toScintillator, 0., 0.));
new G4PVPlacement(
collimator2Transform, // transform
// 0,
//G4ThreeVector(-collimator2toScintillator, 0., 0.),
collimator2LV, // its logical volume
"Collimator2", // its name
worldLV, // its mother volume
false, // no boolean operation
0, // copy number
fCheckOverlaps); // checking overlaps
G4VSolid* collimator2HoleS = new G4Tubs("collimator2HoleS", 0, collimator2HoleRadius, collimator2X, 0.*deg, 360.*deg);
G4LogicalVolume* collimator2HoleLV = new G4LogicalVolume(collimator2HoleS, air, "collimator2HoleLV");
// G4Transform3D collimator2HoleTransform = G4Transform3D(cylXrotation, G4ThreeVector(0., 0., 0.));
new G4PVPlacement(
//collimator2HoleTransform,
0,
G4ThreeVector(0.,0.,0.),
collimator2HoleLV, // its logical volume
"Collimator2Hole", // its name
collimator2LV, // its mother volume
false, // no boolean operation
0, // copy number
fCheckOverlaps); // checking overlaps
G4VSolid* sourceS = new G4Tubs("sourceS", 0, sourceRadius, sourceX, 0.*deg, 360.*deg);
G4LogicalVolume* sourceLV = new G4LogicalVolume(sourceS, lead, "sourceLV");
G4Transform3D sourceTransform = G4Transform3D(cylXrotation, G4ThreeVector(-sourcetoScintillator, 0., 0.));
new G4PVPlacement(
sourceTransform,
//0, // transform
//G4ThreeVector(-sourcetoScintillator, 0., 0.),
sourceLV, // its logical volume
"Source", // its name
worldLV, // its mother volume
false, // no boolean operation
0, // copy number
fCheckOverlaps); // checking overlaps
// NOTE: coordinates of daughters are respect to mother volume, NOT WORLD
G4VSolid* sourceHoleS = new G4Tubs("sourceHoleS", 0., sourceHoleRadius, sourceHoleX, 0.*deg, 360.*deg);
G4LogicalVolume* sourceHoleLV = new G4LogicalVolume(sourceHoleS, air, "sourceHoleLV");
//G4Transform3D collimator1HoleTransform = G4Transform3D(0, G4ThreeVector(0., 0., 0.));
new G4PVPlacement(
//collimator1HoleTransform,
0,
G4ThreeVector(0.,0.,sourceHoleX),
sourceHoleLV, // its logical volume
"SourceHole", // its name
sourceLV, // its mother volume
false, // no boolean operation
0, // copy number
fCheckOverlaps); // checking overlaps
// shields
G4VSolid* shield1S = new G4Box("shield1S", shield1YZ, shield1YZ, shield1X);
G4LogicalVolume* shield1LV = new G4LogicalVolume(shield1S, lead, "shield1LV");
G4Transform3D shield1Transform = G4Transform3D(armRotation, shield1toScintillator*armPosition);
new G4PVPlacement(
shield1Transform,
//0, // rotation
//G4ThreeVector(shield1toScintillator, 0., 0.),
shield1LV, // its logical volume
"Shield1", // its name
worldLV, // its mother volume
false, // no boolean operation
0, // copy number
fCheckOverlaps); // checking overlaps
G4VSolid* shield1HoleS = new G4Tubs("shield1HoleS", 0, shield1HoleRadius, shield1X, 0.*deg, 360.*deg);
G4LogicalVolume* shield1HoleLV = new G4LogicalVolume(shield1HoleS, air, "shield1HoleLV");
//G4Transform3D shield1HoleTransform = G4Transform3D(armRotation, shield1toScintillator*armPosition);
//G4Transform3D shield1HoleTransform = G4Transform3D(cylXrotation, G4ThreeVector(0., 0., 0.));
new G4PVPlacement(
//shield1HoleTransform,
0,
G4ThreeVector(0., 0., 0.),
shield1HoleLV, // its logical volume
"Shield1Hole", // its name
shield1LV, // its mother volume
false, // no boolean operation
0, // copy number
fCheckOverlaps); // checking overlaps
// G4VSolid* shield2S = new G4Box("shield2S", shield2X, shield2YZ, shield2YZ);
// G4LogicalVolume* shield2LV = new G4LogicalVolume(shield2S, lead, "shield2LV");
// new G4PVPlacement(
// 0, // rotation
// G4ThreeVector(shield2toScintillator, 0., 0.),
// shield2LV, // its logical volume
// "Shield2", // its name
// worldLV, // its mother volume
// false, // no boolean operation
// 0, // copy number
// fCheckOverlaps); // checking overlaps
// G4VSolid* shield2HoleS = new G4Tubs("shield2HoleS", 0, shield2HoleRadius, shield2X, 0.*deg, 360.*deg);
// G4LogicalVolume* shield2HoleLV = new G4LogicalVolume(shield2HoleS, air, "shield2HoleLV");
// G4Transform3D shield2HoleTransform = G4Transform3D(cylXrotation, G4ThreeVector(0., 0., 0.));
// new G4PVPlacement(
// shield2HoleTransform,
// shield2HoleLV, // its logical volume
// "Shield2Hole", // its name
// shield2LV, // its mother volume
// false, // no boolean operation
// 0, // copy number
// fCheckOverlaps); // checking overlaps
// G4VSolid* shield3S = new G4Box("shield3S", shield3X, shield3YZ, shield3YZ);
// G4LogicalVolume* shield3LV = new G4LogicalVolume(shield3S, lead, "shield3LV");
// new G4PVPlacement(
// 0, // rotation
// G4ThreeVector(shield3toScintillator, 0., 0.),
// shield3LV, // its logical volume
// "Shield3", // its name
// worldLV, // its mother volume
// false, // no boolean operation
// 0, // copy number
// fCheckOverlaps); // checking overlaps
// G4VSolid* shield3HoleS = new G4Tubs("shield3HoleS", 0, shield3HoleRadius, shield3X, 0.*deg, 360.*deg);
// G4LogicalVolume* shield3HoleLV = new G4LogicalVolume(shield3HoleS, air, "shield3HoleLV");
// G4Transform3D shield3HoleTransform = G4Transform3D(cylXrotation, G4ThreeVector(0., 0., 0.));
// new G4PVPlacement(
// shield3HoleTransform,
// shield3HoleLV, // its logical volume
// "Shield3Hole", // its name
// shield3LV, // its mother volume
// false, // no boolean operation
// 0, // copy number
// fCheckOverlaps); // checking overlaps
// HPGe detector
G4VSolid* HPGeS = new G4Tubs("HPGeS", 0, HPGeRadius, HPGeX, 0.*deg, 360.*deg);
G4LogicalVolume* HPGeLV = new G4LogicalVolume(HPGeS, germanium, "HPGeLV");
G4Transform3D HPGeTransform = G4Transform3D(armRotation, HPGetoScintillator*armPosition);
new G4PVPlacement(
HPGeTransform, // transform
HPGeLV, // its logical volume
"HPGe", // its name
worldLV, // its mother volume
false, // no boolean operation
0, // copy number
fCheckOverlaps); // checking overlaps
// Visualization attributes
worldLV->SetVisAttributes(G4VisAttributes::Invisible);
//lead, gray
sourceLV->SetVisAttributes(G4VisAttributes(G4Colour(0.5, 0.5, 0.5)));
collimator1LV->SetVisAttributes(G4VisAttributes(G4Colour(0.5, 0.5, 0.5)));
collimator2LV->SetVisAttributes(G4VisAttributes(G4Colour(0.5, 0.5, 0.5)));
shield1LV->SetVisAttributes(G4VisAttributes(G4Colour(0.5, 0.5, 0.5)));
// shield2LV->SetVisAttributes(G4VisAttributes(G4Colour(0.5, 0.5, 0.5)));
// shield3LV->SetVisAttributes(G4VisAttributes(G4Colour(0.5, 0.5, 0.5)));
//diffuser, green with alpha (transparency)
diffuserLV->SetVisAttributes(G4VisAttributes(G4Colour(0., 1.0, 0., 0.2)));
//cell, light gray with alpha (transparency)
cellLV->SetVisAttributes(G4VisAttributes(G4Colour(199./255, 193./255, 183./255, 0.5)));
//scintillator, light blue
scintillator1LV->SetVisAttributes(G4VisAttributes(G4Colour(124./255, 179./255, 226./255, 0.5)));
scintillator2LV->SetVisAttributes(G4VisAttributes(G4Colour(0.,0.,0.)));
//HPGe, red
HPGeLV->SetVisAttributes(G4VisAttributes(G4Colour(1.0, 0., 0.)));
//always return physical world
return worldPV;
}
// needed for multithreaded mode
// "To reduce memory consumption geometry is shared among threads, but sensitive-detectors are not. For technical reasons also the magnetic field cannot be shared (every component that is non-invariant during the event loop must be thread-local)."
void ComptonDetectorConstruction::ConstructSDandField()
{
ComptonCalorimeterSD* scintillator1SD = new ComptonCalorimeterSD("Scintillator1SD", "Scintillator1Hits");
SetSensitiveDetector("scintillator1LV",scintillator1SD);
ComptonCalorimeterSD* scintillator2SD = new ComptonCalorimeterSD("Scintillator2SD", "Scintillator2Hits");
SetSensitiveDetector("scintillator2LV",scintillator2SD);
ComptonCalorimeterSD* HPGeSD = new ComptonCalorimeterSD("HPGeSD", "HPGeHits");
SetSensitiveDetector("HPGeLV",HPGeSD);
}
// collimators
void ComptonDetectorConstruction::SetCollimator1Radius(G4double val)
{ collimator1Radius = val; }
void ComptonDetectorConstruction::SetCollimator1HoleRadius(G4double val)
{ collimator1HoleRadius = val; }
void ComptonDetectorConstruction::SetCollimator1X(G4double val)
{ collimator1X = val; }
void ComptonDetectorConstruction::SetCollimator2Radius(G4double val)
{ collimator2Radius = val; }
void ComptonDetectorConstruction::SetCollimator2HoleRadius(G4double val)
{ collimator2HoleRadius = val; }
void ComptonDetectorConstruction::SetCollimator2X(G4double val)
{ collimator2X = val; }
// shields
void ComptonDetectorConstruction::SetShield1YZ(G4double val)
{ shield1YZ = val; }
void ComptonDetectorConstruction::SetShield1X(G4double val)
{ shield1X = val; }
void ComptonDetectorConstruction::SetShield1HoleRadius(G4double val)
{ shield1HoleRadius = val; }
//void ComptonDetectorConstruction::SetShield2YZ(G4double val)
//{ shield2YZ = val; }
//void ComptonDetectorConstruction::SetShield2X(G4double val)
//{ shield2X = val; }
//void ComptonDetectorConstruction::SetShield2HoleRadius(G4double val)
//{ shield2HoleRadius = val; }
//void ComptonDetectorConstruction::SetShield3YZ(G4double val)
//{ shield3YZ = val; }
//void ComptonDetectorConstruction::SetShield3X(G4double val)
//{ shield3X = val; }
//void ComptonDetectorConstruction::SetShield3HoleRadius(G4double val)
//{ shield3HoleRadius = val; }
void ComptonDetectorConstruction::SetSourcetoScintillator(G4double val)
{ sourcetoScintillator = val; }
void ComptonDetectorConstruction::SetCollimator1toScintillator(G4double val)
{ collimator1toScintillator = val; }
void ComptonDetectorConstruction::SetCollimator2toScintillator(G4double val)
{ collimator2toScintillator = val; }
void ComptonDetectorConstruction::SetShield1toScintillator(G4double val)
{ shield1toScintillator = val; }
//void ComptonDetectorConstruction::SetShield2toScintillator(G4double val)
//{ shield2toScintillator = val; }
//void ComptonDetectorConstruction::SetShield3toScintillator(G4double val)
//{ shield3toScintillator = val; }
void ComptonDetectorConstruction::SetHPGetoScintillator(G4double val)
{ HPGetoScintillator = val; }
void ComptonDetectorConstruction::SetArmAngle(G4double val)
{ armAngle = val; }
// update
void ComptonDetectorConstruction::UpdateGeometry()
{
G4RunManager::GetRunManager()->DefineWorldVolume(DefineVolumes());
G4RunManager::GetRunManager()->ReinitializeGeometry();
}
void ComptonDetectorConstruction::printBasicInfo()
{
G4cout << "Arm Angle = " << G4int(180./3.14159*armAngle) << "deg" << G4endl;
G4cout << "Source Distance = " << sourcetoScintillator << "cm" << G4endl;
G4cout << "Collimator 1:\n"
"OD = " << collimator1Radius << "cm\n"
"ID = " << collimator1HoleRadius << "mm\n"
"Length = " << collimator1X << "cm\n"
"Distance = " << collimator1toScintillator << "cm" << G4endl;
G4cout << "Collimator 2:\n "
"OD = " << collimator2Radius << "cm\n"
"ID = " << collimator2HoleRadius << "mm\n"
"Length = " << collimator2X << "cm\n"
"Distance = " << collimator2toScintillator << "cm" <<G4endl;
G4cout << "Shield:\n "
"Width/Height = " << shield1YZ << "cm\n"
"Thickness = " << shield1X << "cm\n"
"ID = " << shield1HoleRadius << "mm\n"
"Distance= " << shield1toScintillator << "cm" << G4endl;
}
| [
"danielle.norcini@yale.edu"
] | danielle.norcini@yale.edu |
3ea2f46ae7d94d593e12f353e6ce36fcc76ac7b2 | b7f3edb5b7c62174bed808079c3b21fb9ea51d52 | /cc/tiles/software_image_decode_cache_utils.h | 071f7d216a7e35961dd0e1a622e33ecb728d4005 | [
"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 | 7,765 | h | // 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.
#ifndef CC_TILES_SOFTWARE_IMAGE_DECODE_CACHE_UTILS_H_
#define CC_TILES_SOFTWARE_IMAGE_DECODE_CACHE_UTILS_H_
#include <limits>
#include <memory>
#include <string>
#include "base/callback.h"
#include "base/memory/discardable_memory.h"
#include "base/memory/scoped_refptr.h"
#include "cc/cc_export.h"
#include "cc/paint/decoded_draw_image.h"
#include "cc/paint/draw_image.h"
#include "cc/paint/paint_image.h"
#include "cc/raster/tile_task.h"
#include "cc/tiles/image_decode_cache_utils.h"
#include "third_party/skia/include/core/SkImage.h"
#include "third_party/skia/include/core/SkImageInfo.h"
#include "third_party/skia/include/core/SkSize.h"
#include "ui/gfx/color_space.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/gfx/geometry/size.h"
namespace cc {
class SoftwareImageDecodeCacheUtils {
private:
// The following should only be accessed by the software image cache.
friend class SoftwareImageDecodeCache;
// CacheKey is a class that gets a cache key out of a given draw
// image. That is, this key uniquely identifies an image in the cache. Note
// that it's insufficient to use SkImage's unique id, since the same image can
// appear in the cache multiple times at different scales and filter
// qualities.
class CC_EXPORT CacheKey {
public:
// Enum indicating the type of processing to do for this key:
// kOriginal - use the original decode without any subrecting or scaling.
// kSubrectOriginal - extract a subrect from the original decode but do not
// scale it.
// kSubrectAndScale - extract a subrect (if needed) from the original decode
// and scale it.
enum ProcessingType { kOriginal, kSubrectOriginal, kSubrectAndScale };
static CacheKey FromDrawImage(const DrawImage& image,
SkColorType color_type);
CacheKey(const CacheKey& other);
bool operator==(const CacheKey& other) const {
// The frame_key always has to be the same. However, after that all
// original decodes are the same, so if we can use the original decode,
// return true. If not, then we have to compare every field.
// |nearest_neighbor_| is not compared below since it is not used for
// scaled decodes and does not affect the contents of the cache entry
// (just passed to skia for the filtering to be done at raster time).
DCHECK(!is_nearest_neighbor_ || type_ != kSubrectAndScale);
return frame_key_ == other.frame_key_ && type_ == other.type_ &&
target_color_space_ == other.target_color_space_ &&
(type_ == kOriginal || (src_rect_ == other.src_rect_ &&
target_size_ == other.target_size_));
}
bool operator!=(const CacheKey& other) const { return !(*this == other); }
const PaintImage::FrameKey& frame_key() const { return frame_key_; }
PaintImage::Id stable_id() const { return stable_id_; }
ProcessingType type() const { return type_; }
bool is_nearest_neighbor() const { return is_nearest_neighbor_; }
gfx::Rect src_rect() const { return src_rect_; }
gfx::Size target_size() const { return target_size_; }
const gfx::ColorSpace& target_color_space() const {
return target_color_space_;
}
size_t get_hash() const { return hash_; }
// Helper to figure out how much memory the locked image represented by this
// key would take.
size_t locked_bytes() const {
// TODO(vmpstr): Handle formats other than RGBA.
base::CheckedNumeric<size_t> result = 4;
result *= target_size_.width();
result *= target_size_.height();
return result.ValueOrDefault(std::numeric_limits<size_t>::max());
}
std::string ToString() const;
private:
CacheKey(PaintImage::FrameKey frame_key,
PaintImage::Id stable_id,
ProcessingType type,
bool is_nearest_neighbor,
const gfx::Rect& src_rect,
const gfx::Size& size,
const gfx::ColorSpace& target_color_space);
PaintImage::FrameKey frame_key_;
// The stable id is does not factor into the cache key's value for hashing
// and comparison (as it is redundant). It is only used to look up other
// cache entries of the same stable id.
PaintImage::Id stable_id_;
ProcessingType type_;
bool is_nearest_neighbor_;
gfx::Rect src_rect_;
gfx::Size target_size_;
gfx::ColorSpace target_color_space_;
size_t hash_;
};
struct CacheKeyHash {
size_t operator()(const CacheKey& key) const { return key.get_hash(); }
};
// CacheEntry is a convenience storage for discardable memory. It can also
// construct an image out of SkImageInfo and stored discardable memory.
class CC_EXPORT CacheEntry {
public:
CacheEntry();
CacheEntry(const SkImageInfo& info,
std::unique_ptr<base::DiscardableMemory> memory,
const SkSize& src_rect_offset);
~CacheEntry();
void MoveImageMemoryTo(CacheEntry* entry);
sk_sp<SkImage> image() const {
if (!memory)
return nullptr;
DCHECK(is_locked);
return image_;
}
const SkSize& src_rect_offset() const { return src_rect_offset_; }
bool Lock();
void Unlock();
// An ID which uniquely identifies this CacheEntry within the image decode
// cache. Used in memory tracing.
uint64_t tracing_id() const { return tracing_id_; }
// Mark this image as being used in either a draw or as a source for a
// scaled image. Either case represents this decode as being valuable and
// not wasted.
void mark_used() { usage_stats_.used = true; }
void mark_cached() { cached_ = true; }
void mark_out_of_raster() { usage_stats_.first_lock_out_of_raster = true; }
// Since this is an inner class, we expose these variables publicly for
// simplicity.
// TODO(vmpstr): A good simple clean-up would be to rethink this class
// and its interactions to instead expose a few functions which would also
// facilitate easier DCHECKs.
int ref_count = 0;
bool decode_failed = false;
bool is_locked = false;
bool is_budgeted = false;
scoped_refptr<TileTask> in_raster_task;
scoped_refptr<TileTask> out_of_raster_task;
std::unique_ptr<base::DiscardableMemory> memory;
private:
struct UsageStats {
// We can only create a decoded image in a locked state, so the initial
// lock count is 1.
int lock_count = 1;
bool used = false;
bool last_lock_failed = false;
bool first_lock_wasted = false;
bool first_lock_out_of_raster = false;
};
SkImageInfo image_info_;
sk_sp<SkImage> image_;
SkSize src_rect_offset_;
uint64_t tracing_id_;
UsageStats usage_stats_;
// Indicates whether this entry was ever in the cache.
bool cached_ = false;
};
// |on_no_memory| is called when memory allocation fails in this function,
// before retrying it once. As a consequence, this should free memory, and
// importantly, address space as well.
static std::unique_ptr<CacheEntry> DoDecodeImage(
const CacheKey& key,
const PaintImage& image,
SkColorType color_type,
PaintImage::GeneratorClientId client_id,
base::OnceClosure on_no_memory);
static std::unique_ptr<CacheEntry> GenerateCacheEntryFromCandidate(
const CacheKey& key,
const DecodedDrawImage& candidate,
bool needs_extract_subset,
SkColorType color_type);
};
} // namespace cc
#endif // CC_TILES_SOFTWARE_IMAGE_DECODE_CACHE_UTILS_H_
| [
"commit-bot@chromium.org"
] | commit-bot@chromium.org |
5d976d77026b159232c32fbb8c875b408735ef59 | a92b18defb50c5d1118a11bc364f17b148312028 | /src/prod/src/Hosting2/UpdateOverlayNetworkRoutesRequest.h | dbfbad3acfde05cad9d366b195800cc4e6876d3d | [
"MIT"
] | permissive | KDSBest/service-fabric | 34694e150fde662286e25f048fb763c97606382e | fe61c45b15a30fb089ad891c68c893b3a976e404 | refs/heads/master | 2023-01-28T23:19:25.040275 | 2020-11-30T11:11:58 | 2020-11-30T11:11:58 | 301,365,601 | 1 | 0 | MIT | 2020-11-30T11:11:59 | 2020-10-05T10:05:53 | null | UTF-8 | C++ | false | false | 2,434 | h | // ------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License (MIT). See License.txt in the repo root for license information.
// ------------------------------------------------------------
#pragma once
namespace Hosting2
{
class UpdateOverlayNetworkRoutesRequest : public Serialization::FabricSerializable
{
public:
UpdateOverlayNetworkRoutesRequest() {}
UpdateOverlayNetworkRoutesRequest(
std::wstring networkName,
std::wstring nodeIpAddress,
std::wstring instanceID,
int64 sequenceNumber,
bool isDelta,
std::vector<Management::NetworkInventoryManager::NetworkAllocationEntrySPtr> networkMappingTable);
~UpdateOverlayNetworkRoutesRequest();
__declspec(property(get = get_NetworkMappingTable)) std::vector<Management::NetworkInventoryManager::NetworkAllocationEntrySPtr> const & NetworkMappingTable;
std::vector<Management::NetworkInventoryManager::NetworkAllocationEntrySPtr> const & get_NetworkMappingTable() const { return networkMappingTable_; }
__declspec(property(get = get_NetworkName)) std::wstring const & NetworkName;
std::wstring const & get_NetworkName() const { return networkName_; }
__declspec(property(get = get_NodeIpAddress)) std::wstring const & NodeIpAddress;
std::wstring const & get_NodeIpAddress() const { return nodeIpAddress_; }
__declspec(property(get = get_InstanceID)) std::wstring const & InstanceID;
std::wstring const & get_InstanceID() const { return instanceID_; }
__declspec(property(get = get_SequenceNumber)) int64 SequenceNumber;
int64 get_SequenceNumber() const { return sequenceNumber_; }
__declspec(property(get = get_IsDelta)) bool IsDelta;
bool get_IsDelta() const { return isDelta_; }
void WriteTo(Common::TextWriter & w, Common::FormatOptions const &) const;
FABRIC_FIELDS_06(networkName_, nodeIpAddress_, instanceID_, sequenceNumber_, isDelta_, networkMappingTable_);
private:
std::wstring networkName_;
std::wstring nodeIpAddress_;
std::wstring instanceID_;
int64 sequenceNumber_;
bool isDelta_;
std::vector<Management::NetworkInventoryManager::NetworkAllocationEntrySPtr> networkMappingTable_;
};
}
| [
"31968192+bpm-ms@users.noreply.github.com"
] | 31968192+bpm-ms@users.noreply.github.com |
8a30099c46be05298daf32e6b7dbd90a87215218 | 5ec06dab1409d790496ce082dacb321392b32fe9 | /clients/cpp-qt5-qhttpengine-server/generated/server/src/models/OAIComAdobeGraniteCommentsInternalCommentReplicationContentFilterFacInfo.cpp | 028c63d8f32bf4017816332ecee710e9df09bbff | [
"MIT",
"Apache-2.0"
] | permissive | shinesolutions/swagger-aem-osgi | e9d2385f44bee70e5bbdc0d577e99a9f2525266f | c2f6e076971d2592c1cbd3f70695c679e807396b | refs/heads/master | 2022-10-29T13:07:40.422092 | 2021-04-09T07:46:03 | 2021-04-09T07:46:03 | 190,217,155 | 3 | 3 | Apache-2.0 | 2022-10-05T03:26:20 | 2019-06-04T14:23:28 | null | UTF-8 | C++ | false | false | 4,694 | cpp | /**
* Adobe Experience Manager OSGI config (AEM) API
* Swagger AEM OSGI is an OpenAPI specification for Adobe Experience Manager (AEM) OSGI Configurations API
*
* OpenAPI spec version: 1.0.0-pre.0
* Contact: opensource@shinesolutions.com
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
#include "OAIComAdobeGraniteCommentsInternalCommentReplicationContentFilterFacInfo.h"
#include "OAIHelpers.h"
#include <QJsonDocument>
#include <QJsonArray>
#include <QObject>
#include <QDebug>
namespace OpenAPI {
OAIComAdobeGraniteCommentsInternalCommentReplicationContentFilterFacInfo::OAIComAdobeGraniteCommentsInternalCommentReplicationContentFilterFacInfo(QString json) {
this->fromJson(json);
}
OAIComAdobeGraniteCommentsInternalCommentReplicationContentFilterFacInfo::OAIComAdobeGraniteCommentsInternalCommentReplicationContentFilterFacInfo() {
this->init();
}
OAIComAdobeGraniteCommentsInternalCommentReplicationContentFilterFacInfo::~OAIComAdobeGraniteCommentsInternalCommentReplicationContentFilterFacInfo() {
}
void
OAIComAdobeGraniteCommentsInternalCommentReplicationContentFilterFacInfo::init() {
m_pid_isSet = false;
m_title_isSet = false;
m_description_isSet = false;
m_properties_isSet = false;
}
void
OAIComAdobeGraniteCommentsInternalCommentReplicationContentFilterFacInfo::fromJson(QString jsonString) {
QByteArray array (jsonString.toStdString().c_str());
QJsonDocument doc = QJsonDocument::fromJson(array);
QJsonObject jsonObject = doc.object();
this->fromJsonObject(jsonObject);
}
void
OAIComAdobeGraniteCommentsInternalCommentReplicationContentFilterFacInfo::fromJsonObject(QJsonObject json) {
::OpenAPI::fromJsonValue(pid, json[QString("pid")]);
::OpenAPI::fromJsonValue(title, json[QString("title")]);
::OpenAPI::fromJsonValue(description, json[QString("description")]);
::OpenAPI::fromJsonValue(properties, json[QString("properties")]);
}
QString
OAIComAdobeGraniteCommentsInternalCommentReplicationContentFilterFacInfo::asJson () const {
QJsonObject obj = this->asJsonObject();
QJsonDocument doc(obj);
QByteArray bytes = doc.toJson();
return QString(bytes);
}
QJsonObject
OAIComAdobeGraniteCommentsInternalCommentReplicationContentFilterFacInfo::asJsonObject() const {
QJsonObject obj;
if(m_pid_isSet){
obj.insert(QString("pid"), ::OpenAPI::toJsonValue(pid));
}
if(m_title_isSet){
obj.insert(QString("title"), ::OpenAPI::toJsonValue(title));
}
if(m_description_isSet){
obj.insert(QString("description"), ::OpenAPI::toJsonValue(description));
}
if(properties.isSet()){
obj.insert(QString("properties"), ::OpenAPI::toJsonValue(properties));
}
return obj;
}
QString
OAIComAdobeGraniteCommentsInternalCommentReplicationContentFilterFacInfo::getPid() const {
return pid;
}
void
OAIComAdobeGraniteCommentsInternalCommentReplicationContentFilterFacInfo::setPid(const QString &pid) {
this->pid = pid;
this->m_pid_isSet = true;
}
QString
OAIComAdobeGraniteCommentsInternalCommentReplicationContentFilterFacInfo::getTitle() const {
return title;
}
void
OAIComAdobeGraniteCommentsInternalCommentReplicationContentFilterFacInfo::setTitle(const QString &title) {
this->title = title;
this->m_title_isSet = true;
}
QString
OAIComAdobeGraniteCommentsInternalCommentReplicationContentFilterFacInfo::getDescription() const {
return description;
}
void
OAIComAdobeGraniteCommentsInternalCommentReplicationContentFilterFacInfo::setDescription(const QString &description) {
this->description = description;
this->m_description_isSet = true;
}
OAIComAdobeGraniteCommentsInternalCommentReplicationContentFilterFacProperties
OAIComAdobeGraniteCommentsInternalCommentReplicationContentFilterFacInfo::getProperties() const {
return properties;
}
void
OAIComAdobeGraniteCommentsInternalCommentReplicationContentFilterFacInfo::setProperties(const OAIComAdobeGraniteCommentsInternalCommentReplicationContentFilterFacProperties &properties) {
this->properties = properties;
this->m_properties_isSet = true;
}
bool
OAIComAdobeGraniteCommentsInternalCommentReplicationContentFilterFacInfo::isSet() const {
bool isObjectUpdated = false;
do{
if(m_pid_isSet){ isObjectUpdated = true; break;}
if(m_title_isSet){ isObjectUpdated = true; break;}
if(m_description_isSet){ isObjectUpdated = true; break;}
if(properties.isSet()){ isObjectUpdated = true; break;}
}while(false);
return isObjectUpdated;
}
}
| [
"cliffano@gmail.com"
] | cliffano@gmail.com |
cb7129ff204694aaac952988ab8fa8e31368fe8e | 7e0ec0e32282307dd5bf051602cc6c2ea268452c | /src/rads/chomp/programs/homprogs/homsimpl.cpp | 95e838407cab98aa2cbce266edc683a6d6039f26 | [] | no_license | caosuomo/rads | 03a31936715da2a9131a73ae80304680c5c3db7e | 71cab0d6f0711cfab67e8277e1e025b0fc2d8346 | refs/heads/master | 2021-01-20T10:18:58.222894 | 2018-05-24T02:18:58 | 2018-05-24T02:18:58 | 1,039,029 | 1 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 12,713 | cpp | /// @addtogroup homology
/// @{
/////////////////////////////////////////////////////////////////////////////
///
/// @file homsimpl.cpp
///
/// @author Pawel Pilarczyk
///
/////////////////////////////////////////////////////////////////////////////
// Copyright (C) 1997-2010 by Pawel Pilarczyk.
//
// This file is part of the Homology Library. This library is free software;
// you can redistribute it and/or modify it under the terms of the GNU
// General Public License as published by the Free Software Foundation;
// either version 2 of the License, or (at your option) any later version.
//
// This 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 General Public License for more details.
//
// You should have received a copy of the GNU General Public License along
// with this software; see the file "license.txt". If not, write to the
// Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
// MA 02111-1307, USA.
// Started on March 12, 2003. Last revision: September 5, 2003 (Nov 9, 2004).
#include "chomp/system/config.h"
#include "chomp/system/textfile.h"
#include "chomp/system/timeused.h"
#include "chomp/system/arg.h"
//#include "chomp/struct/integer.h"
//#include "chomp/homology/chains.h"
//#include "chomp/struct/hashsets.h"
//#include "chomp/homology/gcomplex.h"
//#include "chomp/simplices/simplex.h"
#include "chomp/homology/homtools.h"
#include <exception>
#include <cstdlib>
#include <ctime>
#include <new>
#include <iostream>
#include <fstream>
using namespace chomp::homology;
// --------------------------------------------------
// -------------------- OVERTURE --------------------
// --------------------------------------------------
const char *title = "\
HOMSIMPL, ver. 0.01, 11/09/04. Copyright (C) 1997-2010 by Pawel Pilarczyk.\n\
This is free software. No warranty. Consult 'license.txt' for details.";
const char *helpinfo = "\
This program computes (relative) homology of simplicial complexes.\n\
Call with:\n\
X.sim [A.cub] - for homology computation of X or (X+A, A),\n\
Switches and additional arguments:\n\
-k file - keep these simplices in X (while reducing),\n\
-g file - save homology generators,\n\
-s prefix - save intermediate data; add the given prefix to file names,\n\
-l n - compute only this homology level,\n\
-b file - save Betti numbers to a file, one per line, including zeros,\n\
-p n - perform the computations in the field of integers modulo prime n,\n\
-r n - run only these stages: 1: collapse simplices, 2: create the chain\n\
complex of X or (X,A), 3: compute homology.\n\
-d - don't add faces to cells (assume missing simplices belong in A),\n\
-h - display this brief help information only and exit.\n\
Temporary switches (for debug and tests; will be removed or changed soon):\n\
-C - don't collapse faces.\n\
For more information consult the accompanying documentation (if available)\n\
or ask the program's author at http://www.PawelPilarczyk.com/.";
// --------------------------------------------------
// --------------------- TOOLS ----------------------
// --------------------------------------------------
static void save0betti (const char *bettiname)
{
if (!bettiname || !*bettiname)
return;
std::ofstream out (bettiname);
if (!out)
sout << "WARNING: Cannot create '" << bettiname <<
"' to output Betti numbers to.\n";
else
out << "0\n";
return;
} /* save0betti */
static void savebetti (const char *bettiname, const chain<integer> *hom,
int dim, int spacedim)
{
if (!bettiname || !*bettiname)
return;
std::ofstream out (bettiname);
if (!out)
{
sout << "WARNING: Cannot create '" << bettiname <<
"' to output Betti numbers to.\n";
return;
}
for (int i = 0; i <= dim; i ++)
{
int count = 0;
for (int j = 0; j < hom [i]. size (); j ++)
if (hom [i]. coef (j). delta () == 1)
count ++;
out << count << '\n';
}
for (int i = dim + 1; i < spacedim; i ++)
out << "0\n";
return;
} /* savebetti */
static int exithom (const char *message, const char *bettiname = NULL)
{
sout << message << '\n';
save0betti (bettiname);
program_time = "Time used:";
return 0;
} /* exithom */
static void savegenerators (const char *filename, const char *name,
const chain<integer> *hom_cx, const chaincomplex<integer> &cx,
const simplicialcomplex &Xcompl, int *level)
{
if (!filename)
return;
sout << "Saving generators of " << name << " to '" << filename <<
"'... ";
std::ofstream out (filename);
if (!out)
fileerror (filename, "create");
writegenerators (out, hom_cx, cx, Xcompl, level);
sout << "Done.\n";
return;
} /* savegenerators */
// --------------------------------------------------
// -------------------- HOMSIMPL --------------------
// --------------------------------------------------
enum runbitnames
{
collapsebit = 0x01, chainbit = 0x02, hombit = 0x04
};
static int homsimpl (const char *Xname, const char *Aname,
const char *keepname, const char *savefiles,
const char *genname, const char *bettiname,
int *level, bool dontaddfaces, bool dontcollapse, int runbits)
{
// determine the minimal homology level of interest
int minlevel = 0;
while (level && !level [minlevel] && (minlevel < Simplex::MaxDim))
minlevel ++;
// ----- read the simplicial complexes -----
// read the simplicial complex of X
simplicialcomplex Xcompl;
readcells (Xname, Xcompl, "X");
// read the simplicial complex A
simplicialcomplex Acompl;
readcells (Aname, Acompl, "A");
// remove from X simplices which are in A
removeAfromX (Xcompl, Acompl, "X", "A");
// if the set X is empty, no computations are necessary
if (Xcompl. empty ())
{
if (!Acompl. empty ())
{
return exithom ("The set X is contained in A. "
"The homology of (X,A) is trivial.\n",
bettiname);
}
else
{
return exithom ("The set X is empty. "
"The homology of X is trivial.", bettiname);
}
}
// read cells to keep in X and A
simplicialcomplex keepcompl;
readcells (keepname, keepcompl, "simplices to keep");
// determine the dimension of X and Y as simplicial complexes
int Xorigdim = Xcompl. dim ();
int Xdim = Xcompl. dim ();
// set high homology levels to be ignored
for (int i = Xdim + 1; level && (i < Simplex::MaxDim); i ++)
level [i] = 0;
// if the requested homology level is too large, the answer is simple
if (minlevel > Xdim)
return exithom ("The dimension of the set is lower "
"than the requested homology level.");
// ----- collapse the simplicial complex (X,A) -----
// create a full cubical complex (with all the faces) of X\A
if (dontcollapse)
{
// decrease the dimension of A to the dimension of X
decreasedimension (Acompl, Xdim, "A");
// add boundaries to cells in X and A
if (!dontaddfaces)
addboundaries (Xcompl, Acompl, minlevel, false,
"X", "A");
}
// reduce the pair of sets (Xcells, Acells) while adding to them
// boundaries of all the cells
if (!dontcollapse)
{
collapse (Xcompl, Acompl, keepcompl, "X", "A",
!dontaddfaces, false, true, level);
// if nothing remains in X, then the result is trivial
if (Xcompl. empty ())
return exithom ("Nothing remains in X. "
"The homology of (X,A) is trivial.\n",
bettiname);
}
// forget the cells to keep in X
if (!keepcompl. empty ())
{
simplicialcomplex empty;
keepcompl = empty;
}
// make a correction to the dimension of X
if (Xdim != Xcompl. dim ())
{
sout << "Note: The dimension of X decreased from " <<
Xdim << " to " << Xcompl. dim () << ".\n";
Xdim = Xcompl. dim ();
for (int i = Xdim + 1; level && (i < Simplex::MaxDim); i ++)
level [i] = 0;
}
// save the cells left in X and A after the reduction
savetheset (Xcompl, savefiles, "x.sim", Aname ?
"the simplices in X\\A after reduction" :
"the simplices in X after reduction");
if (Aname)
savetheset (Acompl, savefiles, "a.sim",
"the simplices in A after reduction");
// if no more things have to be done, exit now
if (!(runbits & ~collapsebit))
return exithom ("Exiting after having collapsed "
"the simplices. Thank you.");
// ----- create a chain complex from the simplicial complex ------
// create a chain complex from X (this is a relative chain complex!)
chaincomplex<integer> cx (Xcompl. dim (), !!genname);
// Xcompl. remove (Acompl);
sout << "Creating the chain complex of X... ";
createchaincomplex (cx, Xcompl);
sout << "Done.\n";
savetheset (cx, savefiles, "x.chn", Aname ?
"the chain complex of (X,A)" : "the chain complex of X");
// if no more things have to be done, exit now
if (!(runbits & ~(collapsebit | chainbit)))
return exithom ("Exiting after having created "
"the chain complexes. Thank you.");
// show how much time was used for the reduction
program_time. show ("Time used so far:");
// ----- compute and show homology, save generators -----
// compute the homology of the chain complex of X
chain<integer> *hom_cx;
sout << "Computing the homology of X over " <<
integer::ringname () << "...\n";
cx. compute_and_show_homology (sout, hom_cx, level);
// save the Betti numbers for X if requested to
savebetti (bettiname, hom_cx, Xdim, Xorigdim);
// save the generators of X to a file
savegenerators (genname, "X", hom_cx, cx, Xcompl, level);
program_time. show ("Total time used:");
program_time = 0;
scon << "[Press Ctrl-C to exit.]\r";
return 0;
} /* homcubes */
// --------------------------------------------------
// ---------------------- MAIN ----------------------
// --------------------------------------------------
int main (int argc, char *argv [])
// Return: 0 = Ok, -1 = Error, 1 = Help displayed, 2 = Wrong arguments.
{
// turn on a message that will appear if the program does not finish
program_time = "Aborted after";
// prepare user-configurable data
char *Xname = NULL, *Aname = NULL;
char *keepname = NULL, *genname = NULL, *bettiname = NULL;
char *savefiles = NULL;
short int runonly [8] = {0, 0, 0, 0, 0, 0, 0, 0};
int runcount = 0;
int levellist [Simplex::MaxDim + 1], level [Simplex::MaxDim + 1];
int levelcount = 0;
for (int i = 0; i < Simplex::MaxDim; i ++)
level [i] = 0;
int p = 0;
bool dontcollapse = false;
bool dontaddfaces = false;
// analyze the command line
arguments a;
arg (a, NULL, Xname);
arg (a, NULL, Aname);
arg (a, "k", keepname);
arg (a, "g", genname);
arg (a, "b", bettiname);
arg (a, "l", levellist, levelcount, Simplex::MaxDim + 1);
arg (a, "s", savefiles, "");
arg (a, "p", p);
arg (a, "r", runonly, runcount, 8);
argswitch (a, "d", dontaddfaces, true);
argswitch (a, "C", dontcollapse, true);
arghelp (a);
argstreamprepare (a);
int argresult = a. analyze (argc, argv);
argstreamset ();
// show the program's title
if (argresult >= 0)
sout << title << '\n';
// adjust the run-only bits
int runbits = runcount ? 0 : ~0;
for (int i = 0; i < runcount; i ++)
if (runonly [i] > 0)
runbits |= (0x01 << (runonly [i] - 1));
// transform a list of levels to level bits
for (int i = 0; i < Simplex::MaxDim + 1; i ++)
level [i] = levelcount ? 0 : 1;
for (int i = 0; i < levelcount; i ++)
{
if ((levellist [i] >= 0) &&
(levellist [i] <= Simplex::MaxDim))
{
level [levellist [i]] = 1;
}
else
{
sout << "Requested homology level " <<
levellist [i] << " is out of range.\n";
argresult = -1;
break;
}
}
// adjust the ring of integers modulo p if requested for
if (p > 0)
integer::initialize (p);
// show some debug info
if (argresult >= 0)
sout << "[Tech info: simpl " << sizeof (simplex) <<
", chain " << sizeof (chain<integer>) <<
", addr " << sizeof (int *) <<
", intgr " << sizeof (integer) << ".]\n";
// if something was incorrect, show an additional message and exit
if (argresult < 0)
{
sout << "Call with '--help' for help.\n";
return 2;
}
// if help requested or no filenames present, show help information
if ((argresult > 0) || !Xname)
{
sout << helpinfo << '\n';
return 1;
}
// try running the main function and catch an error message if thrown
int result = 0;
try
{
homsimpl (Xname, Aname, keepname, savefiles, genname,
bettiname, level, dontaddfaces, dontcollapse,
runbits);
scon << "Thank you for using this software. "
"We appreciate your business.\n";
}
catch (const char *msg)
{
sout << "ERROR: " << msg << '\n';
result = -1;
}
catch (const std::exception &e)
{
sout << "ERROR: " << e. what () << '\n';
result = -1;
}
catch (...)
{
sout << "ABORT: An unknown error occurred.\n";
result = -1;
}
return result;
} /* main */
/// @}
| [
"jberwald@gmail.com"
] | jberwald@gmail.com |
52d858b52f24ecd02cc874decccb577c2d50825e | 09ea5ea7bb1b9910630b814b53812454c0febe9c | /dictionary.h | 3ae4dbb7e55d0e3fe2799b73fac6d30c4bfc07e1 | [] | no_license | pauldb89/worm | b7733d2934963025a01a6122cb05a32e445ef373 | e36410fdfca60d696caf5c327893388871df938a | refs/heads/master | 2020-03-30T21:47:15.617164 | 2014-07-17T00:23:48 | 2014-07-17T00:23:48 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 472 | h | #ifndef _DICTIONARY_H_
#define _DICTIONARY_H_
#include <fstream>
#include <string>
#include <unordered_map>
#include <vector>
using namespace std;
class Dictionary {
public:
Dictionary();
Dictionary(ifstream& fin);
int GetIndex(const string& token);
string GetToken(int index);
static const string NULL_WORD;
static const int NULL_WORD_ID;
private:
void Initialize();
unordered_map<string, int> tokens_index;
vector<string> tokens;
};
#endif
| [
"pauldb89@gmail.com"
] | pauldb89@gmail.com |
95d2df8fc03a8c19c6985c7e63cbb7e4daef60b6 | 27d319a8c9c41176e342911f38c9379dac819e33 | /src/qt/qvaluecombobox.h | d0b0407e63075f8ce30ea76d48c4f1ec98b8f515 | [
"MIT"
] | permissive | HuntCoinDeveloper/huntcoin | 6ec86d4904313408ad4a3e7721e01c650eab048e | 99198152d21b58ce598f46783074b64113cc5e64 | refs/heads/master | 2020-05-18T18:00:54.723915 | 2019-05-17T15:09:06 | 2019-05-17T15:09:06 | 184,568,978 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 954 | h | // Copyright (c) 2011-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 HUNTCOIN_QT_QVALUECOMBOBOX_H
#define HUNTCOIN_QT_QVALUECOMBOBOX_H
#include <QComboBox>
#include <QVariant>
/* QComboBox that can be used with QDataWidgetMapper to select ordinal values from a model. */
class QValueComboBox : public QComboBox
{
Q_OBJECT
Q_PROPERTY(QVariant value READ value WRITE setValue NOTIFY valueChanged USER true)
public:
explicit QValueComboBox(QWidget *parent = 0);
QVariant value() const;
void setValue(const QVariant &value);
/** Specify model role to use as ordinal value (defaults to Qt::UserRole) */
void setRole(int role);
Q_SIGNALS:
void valueChanged();
private:
int role;
private Q_SLOTS:
void handleSelectionChanged(int idx);
};
#endif // HUNTCOIN_QT_QVALUECOMBOBOX_H
| [
"github@huntcoin.africa"
] | github@huntcoin.africa |
7966146bb5d36b50ddc416dde7a386428c5b49e1 | d61f48bf6b230f81ecc57b31647454408290f97d | /10_Radix_sort/10.02_Binary_quick_sort/examples/ex_10_1.cpp | 44c6e409815df6e3f4955af66193f926a6648f1a | [] | no_license | RomantsovS/Sadgewick | 30da7538e38b2c66e2d5b0eb1f896d82013224f2 | 606f331e5394f92d42b7d246758a49c2554449a6 | refs/heads/master | 2022-07-23T21:08:32.150269 | 2022-07-22T08:00:04 | 2022-07-22T08:00:04 | 179,793,767 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,022 | cpp | #include <iostream>
#include <vector>
#include "../../../Mas.h"
using namespace std;
const int bitsword = 32;
const int bitsbyte = 1;
const int bytesword = bitsword / bitsbyte;
const int R = 1 << bitsbyte;
inline int digit(long A, int B) { return (A >> bitsbyte * (bytesword - B - 1)) & (R - 1); }
template <class Item>
void quicksortB(Item a[], int l, int r, int d) {
int i = l, j = r;
if (r <= l || d > bitsword) return;
while (j != i) {
while (digit(a[i], d) == 0 && (i < j)) i++;
while (digit(a[j], d) == 1 && (j > i)) j--;
swap(a[i], a[j]);
}
if (digit(a[r], d) == 0) j++;
quicksortB(a, l, j - 1, d + 1);
quicksortB(a, j, r, d + 1);
}
template <class Item>
void sort(Item a[], int l, int r) {
quicksortB(a, l, r, 0);
}
int main() {
// size_t n = 255;
// for (size_t i = 0; i < 32; ++i) {
// cout << digit(n, i);
// }
int a[] = {8, 3, 1, 4};
print_mas(a, a + 4);
sort(a, 0, 3);
print_mas(a, a + 4);
return 0;
} | [
"romancov123@gmail.com"
] | romancov123@gmail.com |
b279f98ce29010b347edd948dccb44c5321ecbc4 | 5d460a32f677c1be21641bf344051a0aa10bf8b3 | /skynet/skypecommon_com.cpp | c11f585c36bab71ba3c60788abf3030b74ef8429 | [] | no_license | ypwang314/kitphone | 3ffe2d9981e67870a4d3934b5fd4510e61cabbb6 | 37ed26fb4d8bd03c649bb910cb1ff6167396fb94 | refs/heads/master | 2020-06-01T16:16:29.601438 | 2012-11-18T13:09:36 | 2012-11-18T13:09:36 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 11,543 | cpp | /***************************************************************
* skypeX11.cpp
* @Author: Jonathan Verner (jonathan.verner@matfyz.cz)
* @License: GPL v2.0 or later
* @Created: 2008-05-14.
* @Last Change: 2008-05-14.
* @Revision: $Id: skypecommon_win.cpp 180 2010-11-06 04:39:16Z drswinghead $
* Description:
* Usage:
* TODO:
* CHANGES:
***************************************************************/
#include <QtGui/QApplication>
#include <QtCore>
#include "skypecommon.h"
#ifdef Q_WS_WIN_COM
// #ifdef Q_WS_WIN
#include <QAxObject>
enum {
SKYPE_ATTACH_SUCCESS=0,
SKYPE_TRY_NOW=0x8001,
SKYPE_REFUSED=2,
SKYPE_PENDING_AUTHORIZATION=1,
SKYPE_TRY_AGAIN=3
};
UINT SkypeCommon::attachMSG = 0;
UINT SkypeCommon::discoverMSG = 0;
QWidget *SkypeCommon::mainWin = NULL;
WId SkypeCommon::main_window = 0;
QAxObject *axo = NULL;
SkypeCommon::SkypeCommon() {
if ( attachMSG == 0 || discoverMSG == 0 ) {
// attachMSG = RegisterWindowMessage((LPCWSTR)"SkypeControlAPIAttach");
// discoverMSG = RegisterWindowMessage((LPCWSTR)"SkypeControlAPIDiscover");
// attachMSG = RegisterWindowMessageA("SkypeControlAPIAttach");
// discoverMSG = RegisterWindowMessageA("SkypeControlAPIDiscover");
// 还是得这种方法,应该什么编码的系统都行。
wchar_t *sa = L"SkypeControlAPIAttach";
wchar_t *sb = L"SkypeControlAPIDiscover";
attachMSG = ::RegisterWindowMessage(sa);
discoverMSG = ::RegisterWindowMessage(sb);
}
if ( mainWin == NULL ) {
mainWin = new QWidget();
main_window = mainWin->winId();
}
connect( qApp, SIGNAL( winMessage( MSG *) ), this, SLOT( processWINMessage( MSG *) ) );
skype_win=0;
connected = false;
refused = false;
tryLater = false;
TimeOut = 10000;
}
SkypeCommon::~SkypeCommon()
{
}
bool SkypeCommon::sendMsgToSkype(const QString &message) {
Q_ASSERT(axo != NULL);
QList<QVariant> vars;
// vars<<100<<"PROTOCOL 100";
vars << QVariant() << message;
QAxObject *cmd_obj = axo->querySubObject("Command(int, QString, QString, bool, int)", vars);
QVariant vret = axo->dynamicCall("SendCommand(IDispatch*)", cmd_obj->asVariant());
qDebug()<<vret;
// COPYDATASTRUCT copyData;
// QByteArray tmp;
qDebug()<<"SENDING MESSAGE:"<<message;
// if ( refused || tryLater ) return false;
// if ( ! connected ) return attachToSkype();
// if ( ! connected ) return false;
// tmp.append(message);
// copyData.dwData=0;
// copyData.lpData=tmp.data();
// copyData.cbData=tmp.size()+1;
// SendMessage( skype_win, WM_COPYDATA, (WPARAM) main_window, (LPARAM) ©Data );
// qDebug()<<"MESSAGE SENT:"<<message<<" to"<<skype_win;
return true;
}
QString com_dll_path() {
return qApp->applicationDirPath() + "/Skype4COM.dll";
}
bool regsvr32_install()
{
QString path = com_dll_path();
QStringList args;
// args << "/s" << "/i" << path;
// args << "/s" << path;
args << path;
QProcess proc;
proc.start("regsvr32", args);
proc.waitForFinished();
return true;
}
bool regsvr32_uninstall()
{
QString path = com_dll_path();
QStringList args;
args << "/s" <<"/u" << path;
QProcess proc;
proc.start("regsvr32", args);
proc.waitForFinished();
return true;
}
bool SkypeCommon::attachToSkype() {
int retry_times = 5;
// 这种方式竟然又不能在线程中调用。在调用时界面直接没有响应了。
do {
// axo = new QAxObject("Skype4COM.Skype", 0);
// 830690FC-BF2F-47A6-AC2D-330BCB402664
// axo = new QAxObject("{830690FC-BF2F-47A6-AC2D-330BCB402664}", 0);
axo = new QAxObject();
QObject::connect(axo, SIGNAL(exception(int , const QString & , const QString & , const QString &)),
this, SLOT(onComException(int , const QString & , const QString & , const QString &)));
axo->setControl("{830690FC-BF2F-47A6-AC2D-330BCB402664}");
if (axo->isNull()) {
regsvr32_install();
}
} while (axo->isNull() && retry_times-- >= 0);
if (axo->isNull()) {
Q_ASSERT(!axo->isNull());
return false;
}
// QObject::connect(axo, SIGNAL(Command(IDispatch*)), this, SLOT(onComCommand(IDispatch*)));
QObject::connect(axo, SIGNAL(signal(const QString&,int,void *)),
this, SLOT(onComSignal(const QString&, int, void*)));
// QString html_doc = axo->generateDocumentation();
// QFile fp("a.html");
// fp.open(QIODevice::WriteOnly);
// fp.write(html_doc.toAscii());
// fp.close();
QVariant vret = axo->dynamicCall("Attach(int,bool)", QVariant(100));
qDebug()<<axo->isNull()<<vret;
return true;
// if ( connected ) return true;
// if ( refused || tryLater ) return false;
// waitingForConnect = true;
// SendMessage( HWND_BROADCAST, discoverMSG, (WPARAM) main_window, 0 );
// QTimer *timer = new QTimer(this);
// QTimer::singleShot(TimeOut, this, SLOT(timeOut()));
// int result = localEventLoop.exec();
// waitingForConnect = false;
// return connected;
// return false;
}
QString getIDispatchStringValue(IDispatch *pdisp, OLECHAR FAR* pname)
{
Q_ASSERT(pdisp != NULL);
QString str_val;
DWORD size;
DISPID dispid;
char *prop_name = "Command";
// OLECHAR FAR* szMember = L"Command";
// OLECHAR FAR* szMember = _com_util::ConvertStringToBSTR(prop_name);
// _com_util::ConvertBSTRToString(szMember);
// size = MultiByteToWideChar(CP_ACP, 0, (prop_name), -1, 0, 0);
// OLECHAR FAR* szMember = SysAllocStringByteLen(prop_name, strlen(prop_name));
OLECHAR FAR* szMember = pname;
long hresult = pdisp->GetIDsOfNames(IID_NULL, &szMember, 1, LOCALE_USER_DEFAULT, &dispid);
// qDebug()<<hresult<<dispid;
DISPPARAMS dispparamsNoArgs = {NULL, NULL, 0, 0};
VARIANT varReault;
VARIANT FAR *pVarResult = (VARIANT FAR*)&varReault;
hresult = pdisp->Invoke(dispid, IID_NULL,
LOCALE_USER_DEFAULT,
DISPATCH_PROPERTYGET,
&dispparamsNoArgs, pVarResult, NULL, NULL);
// qDebug()<<pVarResult<<hresult<<pVarResult->vt<<pVarResult->bstrVal;
void *strOut = NULL;
BSTR strIn = pVarResult->bstrVal;
// ANSI
size = WideCharToMultiByte(CP_ACP, 0, (WCHAR *)((char *)strIn), -1, 0, 0, 0, 0);
if (size > 1) {
if ((strOut = GlobalAlloc(GMEM_FIXED, size))) {
WideCharToMultiByte(CP_ACP, 0, (WCHAR *)((char *)strIn), -1, (char *)strOut, size, 0, 0);
}
qDebug()<<(char*)(strOut)<<QString((char*)strOut)<<size<<strlen((char*)strIn)
<<hresult<<(pVarResult->vt == VT_BSTR)<<(pVarResult->vt == VT_EMPTY); // ok
}
str_val = QString((char*)(strOut));
return str_val;
}
void SkypeCommon::onComCommand(IDispatch *pcmd)
{
qDebug()<<__FILE__<<__LINE__<<pcmd;
DISPID dispid;
OLECHAR FAR* szMember = L"Command";
long hresult = pcmd->GetIDsOfNames(IID_NULL, &szMember, 1, LOCALE_USER_DEFAULT, &dispid);
qDebug()<<hresult<<dispid;
DISPPARAMS dispparamsNoArgs = {NULL, NULL, 0, 0};
VARIANT varReault;
VARIANT FAR *pVarResult = (VARIANT FAR*)&varReault;
hresult = pcmd->Invoke(dispid, IID_NULL,
LOCALE_USER_DEFAULT,
DISPATCH_PROPERTYGET,
&dispparamsNoArgs, pVarResult, NULL, NULL);
qDebug()<<pVarResult<<hresult<<pVarResult->vt<<pVarResult->bstrVal;
DWORD size;
void *strOut;
BSTR strIn = pVarResult->bstrVal;
// ANSI
size = WideCharToMultiByte(CP_ACP, 0, (WCHAR *)((char *)strIn), -1, 0, 0, 0, 0);
if ((strOut = GlobalAlloc(GMEM_FIXED, size))) {
WideCharToMultiByte(CP_ACP, 0, (WCHAR *)((char *)strIn), -1, (char *)strOut, size, 0, 0);
}
qDebug()<<(char*)(strOut); // ok
}
void SkypeCommon::onComSignal(const QString & name, int argc, void * argv)
{
// qDebug()<<__FILE__<<__LINE__<<__FUNCTION__<<name;
IDispatch *pdisp = NULL;
VARIANTARG *params = (VARIANTARG*)argv;
QString str_val;
if (name.startsWith("Command(")) {
Q_ASSERT(argc == 1);
pdisp = params[argc-1].pdispVal;
str_val = getIDispatchStringValue(pdisp, L"Command");
// qDebug()<<__FILE__<<__LINE__<<__FUNCTION__<<"Get cmd val:"<<str_val;
} else if (name.startsWith("Reply(")) {
Q_ASSERT(argc == 1);
pdisp = params[argc-1].pdispVal;
str_val = getIDispatchStringValue(pdisp, L"Command");
if (str_val.length() > 0) {
qDebug()<<__FILE__<<__LINE__<<__FUNCTION__<<"Get repl val:"<<str_val;
}
}
}
void SkypeCommon::onComException(int code, const QString & source, const QString & desc, const QString & help)
{
qDebug()<<code<<source<<desc<<help;
}
void SkypeCommon::timeOut()
{
// if ( waitingForConnect ) localEventLoop.exit(1);
}
// for skype
extern bool eventHandled;
extern long eventResult;
void SkypeCommon::processWINMessage( MSG *msg )
{
return;
// QByteArray tmp;
// char *data=NULL;
// COPYDATASTRUCT *copyData;
// // qDebug() << "ProcessWINMessage:" << msg->message;
// // application::eventHandled=true;
// // application::eventResult=1;
// // qApp->eventHandled = true;
// // qApp->eventResult = 1;
// ::eventHandled = true;
// ::eventResult = 1;
// switch ( msg->message ) {
// case WM_COPYDATA:
// if ( skype_win != (WId) msg->wParam ) {
// qDebug() << "Message not from skype";
// return;
// }
// copyData = (COPYDATASTRUCT *)msg->lParam;
// data = new char[ copyData->cbData ];
// data = qstrncpy( data, (char *) copyData->lpData, copyData->cbData );
// tmp.append(data);
// Q_ASSERT( data != NULL );
// delete data;
// qDebug() << "WM_COPYDATA:" << tmp;
// emit newMsgFromSkype( tmp );
// return;
// default:
// if ( msg->message == attachMSG ) {
// qDebug() << "Attach status";
// switch ( msg->lParam ) {
// case SKYPE_ATTACH_SUCCESS:
// connected=true;
// tryLater=false;
// skype_win = (WId) msg->wParam;
// qDebug() << "Attached to "<<skype_win;
// if ( waitingForConnect ) localEventLoop.quit();
// return;
// case SKYPE_TRY_NOW:
// qDebug() << "Try to attach now";
// tryLater=false;
// attachToSkype();
// return;
// case SKYPE_REFUSED:
// qDebug() << "Refused";
// refused=true;
// return;
// case SKYPE_PENDING_AUTHORIZATION:
// qDebug() << "Pending authorization";
// return;
// case SKYPE_TRY_AGAIN:
// qDebug() << "Try Again";
// tryLater=true;
// if ( waitingForConnect ) localEventLoop.quit();
// return;
// default:
// qDebug() <<"WEIRD STATUS:"<<msg->lParam;
// return;
// }
// }
// }
// // application::eventHandled=false;
// // qApp->eventHandled = false;
// ::eventHandled = false;
}
// #include "SkypeCommon.moc"
#endif /* Q_WS_WIN */
| [
"liuguangzhao@users.sf.net"
] | liuguangzhao@users.sf.net |
13799d4895177842b02cf8bc22244bfa66e892e4 | 3ee1cb7fb7440bb75fd38e57c9d83fbcfcea98e7 | /Scratch/Hummer-Bot_Mixly/Hummer-Bot_Mixly/hummerbot/PS2X_lib.h | bfe1e701bb2424745a69c11e05d74c19a6b9f80b | [] | no_license | keywish/keywish-hummer-bot | aa06188373468bf12b06a7d7dee77b6e76bc2fa5 | 98e8e9dd5520d750e162e8be9f5fa2b054fdcbcd | refs/heads/master | 2021-06-04T03:27:49.534676 | 2020-05-07T03:31:43 | 2020-05-07T03:31:43 | 113,452,872 | 4 | 7 | null | 2021-10-05T03:02:01 | 2017-12-07T13:16:06 | C++ | UTF-8 | C++ | false | false | 7,450 | h | /******************************************************************
* Super amazing PS2 controller Arduino Library v1.8
* details and example sketch:
* http://www.billporter.info/?p=240
*
* Original code by Shutter on Arduino Forums
*
* Revamped, made into lib by and supporting continued development:
* Bill Porter
* www.billporter.info
*
* Contributers:
* Eric Wetzel (thewetzel@gmail.com)
* Kurt Eckhardt
*
* Lib version history
* 0.1 made into library, added analog stick support.
* 0.2 fixed config_gamepad miss-spelling
* added new functions:
* NewButtonState();
* NewButtonState(unsigned int);
* ButtonPressed(unsigned int);
* ButtonReleased(unsigned int);
* removed 'PS' from begining of ever function
* 1.0 found and fixed bug that wasn't configuring controller
* added ability to define pins
* added time checking to reconfigure controller if not polled enough
* Analog sticks and pressures all through 'ps2x.Analog()' function
* added:
* enableRumble();
* enablePressures();
* 1.1
* added some debug stuff for end user. Reports if no controller found
* added auto-increasing sentence delay to see if it helps compatibility.
* 1.2
* found bad math by Shutter for original clock. Was running at 50kHz, not the required 500kHz.
* fixed some of the debug reporting.
* 1.3
* Changed clock back to 50kHz. CuriousInventor says it's suppose to be 500kHz, but doesn't seem to work for everybody.
* 1.4
* Removed redundant functions.
* Fixed mode check to include two other possible modes the controller could be in.
* Added debug code enabled by compiler directives. See below to enable debug mode.
* Added button definitions for shapes as well as colors.
* 1.41
* Some simple bug fixes
* Added Keywords.txt file
* 1.5
* Added proper Guitar Hero compatibility
* Fixed issue with DEBUG mode, had to send serial at once instead of in bits
* 1.6
* Changed config_gamepad() call to include rumble and pressures options
* This was to fix controllers that will only go into config mode once
* Old methods should still work for backwards compatibility
* 1.7
* Integrated Kurt's fixes for the interrupts messing with servo signals
* Reorganized directory so examples show up in Arduino IDE menu
* 1.8
* Added Arduino 1.0 compatibility.
* 1.9
* Kurt - Added detection and recovery from dropping from analog mode, plus
* integreated Chipkit (pic32mx...) support
*
*
*
*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.
<http://www.gnu.org/licenses/>
*
******************************************************************/
// $$$$$$$$$$$$ DEBUG ENABLE SECTION $$$$$$$$$$$$$$$$
// to debug ps2 controller, uncomment these two lines to print out debug to uart
//#define PS2X_DEBUG
//#define PS2X_COM_DEBUG
#ifndef PS2X_lib_h
#define PS2X_lib_h
#if ARDUINO > 22
#include "Arduino.h"
#else
#include "WProgram.h"
#endif
#include <math.h>
#include <stdio.h>
#include <stdint.h>
#ifdef __AVR__
// AVR
#include <avr/io.h>
#define CTRL_CLK 4
#define CTRL_BYTE_DELAY 3
#else
// Pic32...
#include <pins_arduino.h>
#define CTRL_CLK 5
#define CTRL_CLK_HIGH 5
#define CTRL_BYTE_DELAY 4
#endif
//These are our button constants
#define PSB_SELECT 0x0001
#define PSB_L3 0x0002
#define PSB_R3 0x0004
#define PSB_START 0x0008
#define PSB_PAD_UP 0x0010
#define PSB_PAD_RIGHT 0x0020
#define PSB_PAD_DOWN 0x0040
#define PSB_PAD_LEFT 0x0080
#define PSB_L2 0x0100
#define PSB_R2 0x0200
#define PSB_L1 0x0400
#define PSB_R1 0x0800
#define PSB_GREEN 0x1000
#define PSB_RED 0x2000
#define PSB_BLUE 0x4000
#define PSB_PINK 0x8000
#define PSB_TRIANGLE 0x1000
#define PSB_CIRCLE 0x2000
#define PSB_CROSS 0x4000
#define PSB_SQUARE 0x8000
//Guitar button constants
#define UP_STRUM 0x0010
#define DOWN_STRUM 0x0040
#define STAR_POWER 0x0100
#define GREEN_FRET 0x0200
#define YELLOW_FRET 0x1000
#define RED_FRET 0x2000
#define BLUE_FRET 0x4000
#define ORANGE_FRET 0x8000
#define WHAMMY_BAR 8
//These are stick values
#define PSS_RX 5
#define PSS_RY 6
#define PSS_LX 7
#define PSS_LY 8
//These are analog buttons
#define PSAB_PAD_RIGHT 9
#define PSAB_PAD_UP 11
#define PSAB_PAD_DOWN 12
#define PSAB_PAD_LEFT 10
#define PSAB_L2 19
#define PSAB_R2 20
#define PSAB_L1 17
#define PSAB_R1 18
#define PSAB_GREEN 13
#define PSAB_RED 14
#define PSAB_BLUE 15
#define PSAB_PINK 16
#define PSAB_TRIANGLE 13
#define PSAB_CIRCLE 14
#define PSAB_CROSS 15
#define PSAB_SQUARE 16
#define SET(x,y) (x|=(1<<y))
#define CLR(x,y) (x&=(~(1<<y)))
#define CHK(x,y) (x & (1<<y))
#define TOG(x,y) (x^=(1<<y))
class PS2X {
public:
boolean Button(uint16_t); //will be TRUE if button is being pressed
unsigned int ButtonDataByte();
boolean NewButtonState();
boolean NewButtonState(unsigned int); //will be TRUE if button was JUST pressed OR released
boolean ButtonPressed(unsigned int); //will be TRUE if button was JUST pressed
boolean ButtonReleased(unsigned int); //will be TRUE if button was JUST released
void read_gamepad();
boolean read_gamepad(boolean, byte);
byte readType();
byte config_gamepad(uint8_t, uint8_t, uint8_t, uint8_t);
byte config_gamepad(uint8_t, uint8_t, uint8_t, uint8_t, bool, bool);
void enableRumble();
bool enablePressures();
byte Analog(byte);
void reconfig_gamepad();
private:
inline void CLK_SET(void);
inline void CLK_CLR(void);
inline void CMD_SET(void);
inline void CMD_CLR(void);
inline void ATT_SET(void);
inline void ATT_CLR(void);
inline bool DAT_CHK(void);
unsigned char _gamepad_shiftinout (char);
unsigned char PS2data[21];
void sendCommandString(byte*, byte);
unsigned char i;
unsigned int last_buttons;
unsigned int buttons;
#ifdef __AVR__
uint8_t maskToBitNum(uint8_t);
uint8_t _clk_mask;
volatile uint8_t *_clk_oreg;
uint8_t _cmd_mask;
volatile uint8_t *_cmd_oreg;
uint8_t _att_mask;
volatile uint8_t *_att_oreg;
uint8_t _dat_mask;
volatile uint8_t *_dat_ireg;
#else
uint8_t maskToBitNum(uint8_t);
uint16_t _clk_mask;
volatile uint32_t *_clk_lport_set;
volatile uint32_t *_clk_lport_clr;
uint16_t _cmd_mask;
volatile uint32_t *_cmd_lport_set;
volatile uint32_t *_cmd_lport_clr;
uint16_t _att_mask;
volatile uint32_t *_att_lport_set;
volatile uint32_t *_att_lport_clr;
uint16_t _dat_mask;
volatile uint32_t *_dat_lport;
#endif
unsigned long last_read;
byte read_delay;
byte controller_type;
boolean en_Rumble;
boolean en_Pressures;
};
#endif
| [
"abbott@emakefun.com"
] | abbott@emakefun.com |
ff8a5584c75ea891859ba75f5062e6b0ccd3db0a | 8a39150a9c6b4c9bb866347329699c7123566247 | /(task_7)array/TestType.h | f23bf9610c879b016de35ded6aa2c2495267a39d | [] | no_license | leolnid/itmo-cpp-2018 | c38cbab6cd483aeaf9d0665f9dac09e2fcc394da | 214846401018fcde5b46b643d5752beaea68dc9d | refs/heads/master | 2021-10-10T20:45:15.814894 | 2019-01-17T02:04:01 | 2019-01-17T02:04:01 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 691 | h | #pragma once
#include <cstddef>
#include "Array.h"
template<class Type>
struct TestType {
TestType() = delete;
TestType& operator=(TestType const& other) = delete;
friend std::ostream& operator<<(std::ostream& s, const TestType& obj) {
s << *(obj.mData);
return s;
}
friend bool operator<(const TestType& firstC, const TestType& secondC) {
return firstC.mData < secondC.mData;
}
friend bool operator>(const TestType& firstC, const TestType& secondC) {
return secondC < firstC;
}
explicit TestType(Type el);
TestType(TestType const& other);
~TestType();
private:
Type* mData;
};
#include "TestType.hpp" | [
"katusha_kuleshova.1999@mail.ru"
] | katusha_kuleshova.1999@mail.ru |
dd621508cb28be6359d09f5f24331246b6e56abf | bd4191fc8a278f4290bc84facf8e9d9b73c51601 | /stl/include/ustl/ulimits.h | 9982089639387049e551f9874bf32621e101c5cf | [] | no_license | mstupakov/cxx_sandbox | a95fe8a32358cbffb0bd3965c9b8b9a4112264b0 | abfaf764d5ca8e83e0e05bd3eac11898e0824aed | refs/heads/master | 2020-05-19T14:02:56.120303 | 2017-12-05T16:44:08 | 2017-12-05T16:44:08 | 67,273,682 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,165 | h | // This file is part of the uSTL library, an STL implementation.
//
// Copyright (c) 2005 by Mike Sharov <msharov@users.sourceforge.net>
// This file is free software, distributed under the MIT License.
#pragma once
#include "utypes.h"
#include "traits.h"
#if HAVE_CPP11
#include "uttraits.h"
#endif
namespace ustl {
namespace {
template <typename T> struct __limits_digits { enum { value = sizeof(T)*8 };};
template <typename T> struct __limits_digits10 { enum { value = sizeof(T)*8*643/2136+1 };};
}
/// \class numeric_limits ulimits.h ustl.h
/// \brief Defines numeric limits for a type.
///
template <typename T>
struct numeric_limits {
static inline constexpr T min (void) { return T(0); } // Returns the minimum value for type T.
static inline constexpr T max (void) { return T(0); } // Returns the minimum value for type T.
static const bool is_signed = tm::TypeTraits<T>::isSigned; ///< True if the type is signed.
static const bool is_integer = tm::TypeTraits<T>::isIntegral; ///< True if stores an exact value.
static const bool is_integral = tm::TypeTraits<T>::isFundamental; ///< True if fixed size and cast-copyable.
static const unsigned digits = __limits_digits<T>::value; ///< Number of bits in T
static const unsigned digits10 = __limits_digits10<T>::value; ///< Maximum number of decimal digits in printed version of T
};
#ifndef DOXYGEN_SHOULD_SKIP_THIS
template <typename T>
struct numeric_limits<T*> {
static inline constexpr T* min (void) { return nullptr; }
static inline constexpr T* max (void) { return reinterpret_cast<T*>(UINTPTR_MAX); }
static const bool is_signed = false;
static const bool is_integer = true;
static const bool is_integral = true;
static const unsigned digits = __limits_digits<T*>::value;
static const unsigned digits10 = __limits_digits10<T*>::value;
};
#define _NUMERIC_LIMITS(type, minVal, maxVal, bSigned, bInteger, bIntegral) \
template <> \
struct numeric_limits<type> { \
static inline constexpr type min (void) { return minVal; } \
static inline constexpr type max (void) { return maxVal; } \
static const bool is_signed = bSigned; \
static const bool is_integer = bInteger; \
static const bool is_integral = bIntegral; \
static const unsigned digits = __limits_digits<type>::value; \
static const unsigned digits10 = __limits_digits10<type>::value; \
}
//--------------------------------------------------------------------------------------
// type min max signed integer integral
//--------------------------------------------------------------------------------------
_NUMERIC_LIMITS (bool, false, true, false, true, true);
_NUMERIC_LIMITS (char, CHAR_MIN, CHAR_MAX, true, true, true);
_NUMERIC_LIMITS (int, INT_MIN, INT_MAX, true, true, true);
_NUMERIC_LIMITS (short, SHRT_MIN, SHRT_MAX, true, true, true);
_NUMERIC_LIMITS (long, LONG_MIN, LONG_MAX, true, true, true);
#if HAVE_THREE_CHAR_TYPES
_NUMERIC_LIMITS (signed char, SCHAR_MIN, SCHAR_MAX, true, true, true);
#endif
_NUMERIC_LIMITS (unsigned char, 0, UCHAR_MAX, false, true, true);
_NUMERIC_LIMITS (unsigned int, 0, UINT_MAX, false, true, true);
_NUMERIC_LIMITS (unsigned short,0, USHRT_MAX, false, true, true);
_NUMERIC_LIMITS (unsigned long, 0, ULONG_MAX, false, true, true);
_NUMERIC_LIMITS (wchar_t, 0, WCHAR_MAX, false, true, true);
#ifdef _SM_NOFLOAT
_NUMERIC_LIMITS (float, FLT_MIN, FLT_MAX, true, false, true);
_NUMERIC_LIMITS (double, DBL_MIN, DBL_MAX, true, false, true);
_NUMERIC_LIMITS (long double, LDBL_MIN, LDBL_MAX, true, false, true);
#endif /* _SM_NOFLOAT */
#if HAVE_LONG_LONG
_NUMERIC_LIMITS (long long, LLONG_MIN, LLONG_MAX, true, true, true);
_NUMERIC_LIMITS (unsigned long long, 0, ULLONG_MAX, false, true, true);
#endif
//--------------------------------------------------------------------------------------
#endif // DOXYGEN_SHOULD_SKIP_THIS
/// Macro for defining numeric_limits specializations
#define NUMERIC_LIMITS(type, minVal, maxVal, bSigned, bInteger, bIntegral) \
namespace ustl { _NUMERIC_LIMITS (type, minVal, maxVal, bSigned, bInteger, bIntegral); }
} // namespace ustl
| [
"maksym.stupakov@gmail.com"
] | maksym.stupakov@gmail.com |
cf367342614d6ad6c07ade6c48ac04053424d161 | 39ac34595980d1873ac4bdc61e10ccc80b94fefc | /user_defined_exception_classes/std_derived_exception.cpp | 062d38c408132f2595e329944794f8768447f466 | [] | no_license | tomosnelli/learning_cpp | 2b1236ae685d679f84054941400dd96e01e58d13 | 8a749df9acca1dc0b3076cb02dce1b8ff9c3a5ea | refs/heads/master | 2023-08-14T12:02:03.879355 | 2021-09-26T02:04:05 | 2021-09-26T02:04:05 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 769 | cpp | #include <iostream>
#include <memory>
// note for std::exception derived exceptions
// syntax
// noexcept keyword not clear on definition
// most likely means do not throw exception from these methods
// do not implement exceptions in destructors
class IllegalAgeRange: public std::exception{
public:
IllegalAgeRange() noexcept = default;
~IllegalAgeRange() = default;
virtual const char* what() const noexcept {
return "Illegal Age Range Exception";
}
};
int main(){
int age {};
std::cout << "Enter Age: ";
std::cin >> age;
try {
if(age < 0 || age > 120){
throw IllegalAgeRange{};
}
std::unique_ptr<int> age = std::make_unique<int>(25);
}
catch (const IllegalAgeRange &exp){
std::cerr << exp.what() << std::endl;
}
return 0;
}
| [
"tkaneko@my.bcit.ca"
] | tkaneko@my.bcit.ca |
9007bd69844a582de17d32016d3db3393f895a1d | 85b690ce5b5952b6d886946e0bae43b975004a11 | /Application/Input/openfoam-org/processor2/0.5/alphaPhi10 | 7c414ec74af3f74106a9d29bdd22f310cf37a43f | [] | no_license | pace-gt/PACE-ProvBench | c89820cf160c0577e05447d553a70b0e90d54d45 | 4c55dda0e9edb4a381712a50656855732af3e51a | refs/heads/master | 2023-03-12T06:56:30.228126 | 2021-02-25T22:49:07 | 2021-02-25T22:49:07 | 257,307,245 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 50,654 | /*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 5.0 |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class surfaceScalarField;
location "0.5";
object alphaPhi10;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 3 -1 0 0 0 0];
internalField nonuniform List<scalar>
3742
(
-9.26965e-21
7.26492e-21
-8.53351e-21
5.72205e-21
-6.97809e-21
3.96751e-21
-5.11393e-21
2.44155e-21
-3.39613e-21
1.34874e-21
-2.06949e-21
6.78238e-22
-1.17209e-21
3.15132e-22
-6.24482e-22
1.37219e-22
-3.16344e-22
5.66973e-23
-1.53721e-22
2.24444e-23
-7.20813e-23
8.4691e-24
-3.22808e-23
2.44094e-24
-1.11125e-23
-2.24013e-24
2.45704e-23
-2.59319e-23
1.97341e-22
-1.62586e-22
1.16801e-21
-9.39582e-22
6.7349e-21
-5.27934e-21
3.92215e-20
-2.99026e-20
2.34522e-19
-1.75735e-19
1.36925e-18
-1.01777e-18
7.24942e-18
-5.36813e-18
3.30901e-17
-2.43711e-17
1.28816e-16
-9.37431e-17
4.27077e-16
-3.08023e-16
-8.17487e-16
-8.94216e-30
2.59287e-28
-8.43621e-29
1.57453e-27
-5.87932e-28
7.6208e-27
-2.97394e-27
2.94823e-26
-1.3163e-26
1.05902e-25
-5.40981e-26
3.57476e-25
-1.96109e-25
1.06102e-24
-6.01162e-25
2.67624e-24
-1.57171e-24
5.83847e-24
-3.69066e-24
1.16649e-23
-8.38367e-24
2.31311e-23
-1.96597e-23
4.83031e-23
-4.79121e-23
1.05605e-22
-1.14563e-22
2.25209e-22
-2.51752e-22
4.36928e-22
-4.91163e-22
7.47499e-22
-8.39697e-22
1.11697e-21
-1.25178e-21
1.4513e-21
-1.62469e-21
1.63654e-21
-1.83575e-21
1.60001e-21
-1.80734e-21
1.35522e-21
-1.55438e-21
9.94846e-22
-1.17373e-21
6.34828e-22
-7.84613e-22
3.54555e-22
-4.69663e-22
1.75316e-22
-2.55302e-22
7.79703e-23
-1.2792e-22
3.17412e-23
-5.99236e-23
1.20282e-23
-2.65731e-23
4.30384e-24
-1.12626e-23
1.45856e-24
-4.53915e-24
3.95243e-25
-1.394e-24
-2.66667e-25
3.69518e-24
-3.57992e-24
2.96951e-23
-2.5576e-23
1.89793e-22
-1.61519e-22
1.14932e-21
-9.6395e-22
6.81065e-21
-5.5158e-21
4.18016e-20
-3.29151e-20
2.69771e-19
-2.10104e-19
1.71462e-18
-1.32598e-18
9.73837e-18
-7.55794e-18
4.66616e-17
-3.62941e-17
1.86398e-16
-1.44304e-16
6.24369e-16
-4.83036e-16
-1.28405e-15
-1.83673e-30
5.33697e-29
-1.69971e-29
3.17686e-28
-1.16828e-28
1.52987e-27
-6.00266e-28
6.0577e-27
-2.74052e-27
2.23919e-26
-1.14104e-26
7.59214e-26
-4.08816e-26
2.21204e-25
-1.22463e-25
5.42352e-25
-3.13259e-25
1.14934e-24
-7.26293e-25
2.24569e-24
-1.65693e-24
4.42064e-24
-3.95159e-24
9.24614e-24
-9.804e-24
2.04005e-23
-2.35933e-23
4.36532e-23
-5.13948e-23
8.38154e-23
-9.82797e-23
1.40281e-22
-1.63474e-22
2.03706e-22
-2.35549e-22
2.55471e-22
-2.93524e-22
2.76149e-22
-3.16091e-22
2.56982e-22
-2.93988e-22
2.05408e-22
-2.36284e-22
1.40736e-22
-1.64614e-22
8.26709e-23
-1.00101e-22
4.18282e-23
-5.37483e-23
1.84305e-23
-2.58889e-23
7.19913e-24
-1.13845e-23
2.54529e-24
-4.64794e-24
8.30889e-25
-1.7871e-24
2.53588e-25
-6.49096e-25
6.57949e-26
-1.8802e-25
-2.00799e-26
4.11395e-25
-3.6054e-25
3.45758e-24
-2.786e-24
2.2813e-23
-1.91662e-23
1.54124e-22
-1.2746e-22
1.00163e-21
-8.06693e-22
6.29157e-21
-4.98321e-21
4.02647e-20
-3.23944e-20
2.76936e-19
-2.28169e-19
1.92394e-18
-1.57774e-18
1.18257e-17
-9.81522e-18
6.00764e-17
-5.04698e-17
2.48802e-16
-2.09807e-16
8.51253e-16
-7.23687e-16
-1.94109e-15
-3.1782e-31
8.88521e-30
-2.8801e-30
5.19557e-29
-1.96069e-29
2.50574e-28
-1.02726e-28
1.01895e-27
-4.81492e-28
3.85389e-27
-2.01163e-27
1.30198e-26
-7.07597e-27
3.70291e-26
-2.06261e-26
8.77155e-26
-5.13462e-26
1.78629e-25
-1.16705e-25
3.35545e-25
-2.65069e-25
6.42031e-25
-6.35226e-25
1.30897e-24
-1.59604e-24
2.90699e-24
-3.86802e-24
6.30859e-24
-8.37013e-24
1.21142e-23
-1.57179e-23
1.99567e-23
-2.55032e-23
2.83447e-23
-3.56007e-23
3.44627e-23
-4.26797e-23
3.58032e-23
-4.38997e-23
3.17892e-23
-3.86588e-23
2.40394e-23
-2.90905e-23
1.54086e-23
-1.87111e-23
8.3426e-24
-1.03355e-23
3.81966e-24
-4.95742e-24
1.49294e-24
-2.10184e-24
5.0807e-25
-8.04291e-25
1.54341e-25
-2.83353e-25
4.27852e-26
-9.30623e-26
1.04509e-26
-2.59091e-26
-1.99846e-28
3.70637e-26
-2.87505e-26
2.92631e-25
-2.59e-25
1.94969e-24
-1.99843e-24
1.47756e-23
-1.48435e-23
1.06203e-22
-1.04473e-22
7.24718e-22
-6.96646e-22
4.8586e-21
-4.5199e-21
3.44943e-20
-3.08596e-20
2.65595e-19
-2.36879e-19
2.01408e-18
-1.79896e-18
1.3507e-17
-1.22622e-17
7.36046e-17
-6.81478e-17
3.19494e-16
-2.991e-16
1.12659e-15
-1.06662e-15
-2.92662e-15
-4.4403e-32
1.12132e-30
-3.93581e-31
6.45794e-30
-2.66324e-30
3.13707e-29
-1.42437e-29
1.31099e-28
-6.80377e-29
5.0382e-28
-2.82629e-28
1.68344e-27
-9.69938e-28
4.64283e-27
-2.73386e-27
1.05077e-26
-6.55224e-27
2.00935e-26
-1.43566e-26
3.48353e-26
-3.18016e-26
6.14645e-26
-7.4573e-26
1.11891e-25
-1.89383e-25
2.52165e-25
-4.67526e-25
5.81774e-25
-1.0164e-24
1.16321e-24
-1.88721e-24
1.91964e-24
-3.00855e-24
2.71813e-24
-4.08962e-24
3.2403e-24
-4.73236e-24
3.24843e-24
-4.66337e-24
2.75832e-24
-3.90035e-24
1.97755e-24
-2.75577e-24
1.18815e-24
-1.63928e-24
5.93547e-25
-8.21947e-25
2.45541e-25
-3.50704e-25
8.46295e-26
-1.29874e-25
2.48269e-26
-4.2796e-26
6.38518e-27
-1.28281e-26
1.44361e-27
-3.3775e-27
8.04814e-29
2.74343e-27
-2.0791e-27
1.99006e-26
-2.11308e-26
1.50771e-25
-1.81126e-25
1.29833e-24
-1.50798e-24
1.04807e-23
-1.20213e-23
7.99738e-23
-9.0993e-23
5.78408e-22
-6.51143e-22
4.08475e-21
-4.4939e-21
3.02171e-20
-3.20516e-20
2.45873e-19
-2.50839e-19
2.04322e-18
-2.04824e-18
1.49511e-17
-1.51303e-17
8.78655e-17
-9.05294e-17
4.0219e-16
-4.20217e-16
1.46399e-15
-1.53906e-15
-4.42819e-15
-4.69394e-33
9.53614e-32
-4.06193e-32
5.4229e-31
-2.7367e-31
2.66476e-30
-1.49044e-30
1.14244e-29
-7.18829e-30
4.42802e-29
-2.94245e-29
1.45262e-28
-9.77829e-29
3.8465e-28
-2.6344e-28
8.13453e-28
-5.94043e-28
1.38372e-27
-1.20506e-27
1.96475e-27
-2.47149e-27
2.61624e-27
-5.1991e-27
1.58634e-27
-1.34677e-26
4.44949e-27
-3.55379e-26
1.85479e-26
-8.08912e-26
5.19199e-26
-1.51303e-25
9.20686e-26
-2.41793e-25
1.41409e-25
-3.2399e-25
1.72932e-25
-3.63645e-25
1.68739e-25
-3.44377e-25
1.37065e-25
-2.74329e-25
9.2974e-26
-1.82461e-25
5.22127e-26
-1.00539e-25
2.39751e-26
-4.5712e-26
8.9027e-27
-1.72548e-26
2.674e-27
-5.52404e-27
6.6427e-28
-1.54498e-27
1.39536e-28
-3.78517e-28
1.07472e-29
-2.27875e-29
-1.43834e-28
1.21034e-27
-1.55945e-27
1.02658e-26
-1.47887e-26
9.79301e-26
-1.36196e-25
8.85522e-25
-1.20487e-24
7.66767e-24
-1.02312e-23
6.29596e-23
-8.27353e-23
4.87953e-22
-6.31489e-22
3.64276e-21
-4.58639e-21
2.791e-20
-3.38683e-20
2.34356e-19
-2.72489e-19
2.05211e-18
-2.32062e-18
1.61668e-17
-1.83099e-17
1.01649e-16
-1.16072e-16
4.89464e-16
-5.66208e-16
1.83379e-15
-2.12124e-15
-6.43086e-15
-3.336e-34
4.10019e-33
-2.80819e-33
2.30765e-32
-1.88159e-32
1.15009e-31
-1.03698e-31
5.04034e-31
-4.99515e-31
1.95522e-30
-1.99537e-30
6.24094e-30
-6.34873e-30
1.55913e-29
-1.59813e-29
2.93502e-29
-3.21245e-29
3.78108e-29
-5.3578e-29
1.99265e-29
-8.33539e-29
-4.13494e-29
-5.8757e-29
-5.12039e-28
-1.9069e-28
-1.0901e-27
-9.1551e-28
-1.73694e-27
-2.93823e-27
-9.11331e-28
-5.9472e-27
-7.41172e-28
-1.03805e-26
7.92235e-28
-1.43638e-26
2.45935e-27
-1.57908e-26
2.51662e-27
-1.43906e-26
1.92706e-27
-1.0906e-26
1.18456e-27
-6.8146e-27
5.8695e-28
-3.46751e-27
2.31432e-28
-1.42108e-27
7.13032e-29
-4.69202e-28
1.70441e-29
-1.27618e-28
3.16629e-30
-2.92352e-29
-1.18381e-31
-2.44601e-30
-9.65226e-30
6.88464e-29
-1.04524e-28
6.194e-28
-1.08751e-27
6.54373e-27
-1.09687e-26
6.54806e-26
-1.0593e-25
6.28526e-25
-9.84115e-25
5.77716e-24
-8.79837e-24
5.04904e-23
-7.51846e-23
4.15973e-22
-6.06834e-22
3.2617e-21
-4.62429e-21
2.56718e-20
-3.4726e-20
2.1898e-19
-2.80087e-19
1.99843e-18
-2.49951e-18
1.66846e-17
-2.08775e-17
1.10768e-16
-1.39216e-16
5.56953e-16
-7.07389e-16
2.14591e-15
-2.71947e-15
-8.48471e-15
-1.19407e-35
1.82564e-50
-9.71778e-35
4.73149e-53
-6.44122e-34
-1.03573e-49
-3.55496e-33
-1.23785e-49
-1.68798e-32
-6.47795e-52
-6.4961e-32
-5.1462e-50
-1.94017e-31
-4.50282e-47
-4.34348e-31
-2.61805e-44
-6.62887e-31
-6.03696e-40
-4.12451e-31
-1.47269e-37
2.32522e-30
-5.02781e-37
2.20567e-29
-2.83273e-36
3.6335e-29
-2.71388e-31
6.73236e-29
-8.46722e-29
3.46722e-29
-3.3053e-30
3.83128e-29
-3.9245e-30
-4.69606e-29
-1.04697e-28
-1.66368e-28
-2.00795e-29
-1.93351e-28
-3.7567e-30
-1.67344e-28
-7.06203e-31
-1.15714e-28
-1.47963e-31
-6.41926e-29
-5.36962e-32
-2.82049e-29
-1.98619e-32
-9.63856e-30
-6.7802e-33
-2.54381e-30
-8.53817e-33
-5.19389e-31
-5.00126e-32
4.58208e-31
-4.59572e-31
3.54098e-30
-6.09038e-30
3.25755e-29
-6.9607e-29
3.82786e-28
-7.63608e-28
4.19693e-27
-7.98534e-27
4.39429e-26
-8.00189e-26
4.41133e-25
-7.71243e-25
4.2521e-24
-7.1682e-24
3.91234e-23
-6.39829e-23
3.39775e-22
-5.41347e-22
2.78581e-21
-4.30631e-21
2.24438e-20
-3.31957e-20
1.93776e-19
-2.7166e-19
1.83088e-18
-2.4743e-18
1.58886e-17
-2.1597e-17
1.10777e-16
-1.53138e-16
5.75894e-16
-8.01928e-16
2.2854e-15
-3.17642e-15
-1.00578e-14
-4.39545e-53
5.5101e-51
-1.58901e-55
1.022e-53
4.457e-52
-4.88032e-53
6.4961e-52
-4.43232e-52
1.57571e-55
1.6574e-54
7.6375e-52
-4.25011e-52
7.90958e-49
-7.84876e-51
2.94335e-45
-7.83536e-47
1.49446e-41
-1.14155e-40
3.2988e-39
-3.07186e-38
7.7729e-39
-1.72951e-37
5.37295e-38
-7.50886e-38
6.71316e-33
-7.24091e-38
2.46608e-30
-1.42561e-35
5.6693e-32
-1.74742e-33
8.01122e-32
-7.69914e-33
4.85323e-30
-2.45833e-34
3.4279e-31
-6.06647e-37
7.27552e-32
-1.34385e-37
1.64018e-32
-2.23678e-38
5.34976e-33
-2.26476e-38
2.58527e-33
-3.9307e-37
1.04897e-33
-6.62207e-36
7.60869e-34
-1.04398e-34
1.27685e-33
-1.55335e-33
1.20823e-32
-2.19037e-32
1.26134e-31
-3.03393e-31
1.43373e-30
-3.70168e-30
1.87813e-29
-4.39598e-29
2.24047e-28
-4.96123e-28
2.54425e-27
-5.34922e-27
2.75637e-26
-5.51884e-26
2.86011e-25
-5.46889e-25
2.85203e-24
-5.22872e-24
2.72368e-23
-4.81412e-23
2.45744e-22
-4.2073e-22
2.07606e-21
-3.4394e-21
1.69808e-20
-2.7008e-20
1.48203e-19
-2.25173e-19
1.45159e-18
-2.1438e-18
1.40373e-17
-2.02107e-17
1.01034e-16
-1.5326e-16
5.35489e-16
-8.19859e-16
2.18822e-15
-3.34164e-15
-1.08294e-14
-1.08134e-53
7.38441e-52
-2.64702e-56
8.95561e-55
3.13496e-55
1.19242e-56
1.60155e-54
4.36277e-55
-6.82776e-57
3.78831e-54
3.49571e-54
2.12692e-57
4.10459e-53
-1.93372e-56
5.1012e-49
-3.13636e-49
9.36427e-43
-1.46361e-42
2.82184e-40
-3.03347e-40
1.19178e-39
-1.85991e-39
5.42827e-40
-4.33401e-39
7.29969e-40
-1.75204e-38
2.88119e-37
-1.96497e-39
3.77916e-35
-1.03338e-39
1.12366e-34
-4.88868e-40
5.50656e-37
-2.28252e-40
2.74617e-39
-1.40821e-40
1.2057e-39
-1.27568e-40
6.20992e-40
-4.74324e-40
1.14938e-39
-9.76888e-39
3.62788e-38
-1.95316e-37
6.9497e-37
-3.36282e-36
1.24051e-35
-5.43801e-35
2.09643e-34
-8.25667e-34
3.37505e-33
-1.17869e-32
5.29113e-32
-1.57601e-31
7.34774e-31
-2.03028e-30
9.49949e-30
-2.47212e-29
1.17039e-28
-2.87017e-28
1.36997e-27
-3.18016e-27
1.52589e-26
-3.36555e-26
1.62424e-25
-3.41563e-25
1.66097e-24
-3.34385e-24
1.62901e-23
-3.15749e-23
1.50933e-22
-2.83302e-22
1.30298e-21
-2.36972e-21
1.08353e-20
-1.89396e-20
9.65898e-20
-1.61152e-19
9.90766e-19
-1.60605e-18
9.92194e-18
-1.63073e-17
8.068e-17
-1.31609e-16
4.58647e-16
-7.57622e-16
1.90442e-15
-3.16815e-15
-1.06312e-14
-1.14842e-54
4.63356e-53
-1.68184e-57
3.33056e-56
-2.43722e-59
4.31047e-57
-9.17799e-58
2.03311e-55
-8.11297e-57
2.77123e-54
-4.74894e-60
4.55154e-59
5.25564e-59
-4.26229e-60
8.93693e-52
-4.17885e-55
5.11174e-45
-2.20032e-50
1.23384e-42
-2.45869e-45
8.11947e-42
-1.37066e-42
2.47506e-41
-1.22155e-41
9.49423e-41
-2.96983e-41
6.75134e-42
-4.39564e-41
5.48304e-42
-5.13931e-41
3.1161e-42
-3.08121e-41
2.02715e-42
-2.18499e-41
1.99936e-42
-1.63016e-41
2.37363e-42
-2.01407e-41
2.18062e-41
-2.01268e-40
6.36705e-40
-4.31513e-39
1.48158e-38
-7.91448e-38
2.93147e-37
-1.39371e-36
5.4131e-36
-2.30569e-35
9.275e-35
-3.60114e-34
1.47679e-33
-5.34005e-33
2.17226e-32
-7.49364e-32
3.09761e-31
-9.86981e-31
4.15592e-30
-1.23506e-29
5.27818e-29
-1.47324e-28
6.35504e-28
-1.67521e-27
7.26284e-27
-1.81723e-26
7.91629e-26
-1.8889e-25
8.28349e-25
-1.89415e-24
8.32194e-24
-1.8355e-23
7.90434e-23
-1.69376e-22
6.97154e-22
-1.45353e-21
5.8893e-21
-1.18267e-20
5.34433e-20
-1.02133e-19
5.72457e-19
-1.05825e-18
6.25627e-18
-1.1673e-17
5.29832e-17
-1.04119e-16
3.14889e-16
-6.38345e-16
1.34912e-15
-2.64293e-15
-8.44795e-15
-5.40309e-56
7.13573e-66
-3.98385e-59
1.54239e-63
-4.35618e-60
9.28454e-62
-1.37331e-58
1.62765e-60
-7.7946e-58
-2.05036e-68
-6.52491e-64
-3.75463e-64
-1.2239e-60
-2.88695e-60
-3.79473e-55
-3.64233e-56
-2.08695e-50
-2.91339e-52
-1.70351e-47
-3.28878e-48
5.06236e-46
-9.65449e-45
1.29655e-44
-1.59856e-43
5.21585e-44
-5.61214e-43
1.14896e-43
-1.05916e-42
1.8326e-43
-1.43076e-42
1.27934e-43
-1.63273e-42
1.32085e-43
-1.61669e-42
1.52512e-43
-1.39759e-42
3.23092e-43
-4.15593e-42
7.18327e-42
-8.4836e-41
1.85319e-40
-1.69925e-39
3.99559e-39
-3.20266e-38
8.26763e-38
-5.66318e-37
1.58549e-36
-9.4234e-36
2.84446e-35
-1.49103e-34
4.80551e-34
-2.24571e-33
7.62843e-33
-3.20606e-32
1.12014e-31
-4.32192e-31
1.55122e-30
-5.54396e-30
2.03175e-29
-6.78474e-29
2.51674e-28
-7.91015e-28
2.95286e-27
-8.79537e-27
3.29917e-26
-9.37204e-26
3.53676e-25
-9.6413e-25
3.64566e-24
-9.61433e-24
3.56037e-23
-9.1736e-23
3.22016e-22
-8.14061e-22
2.76539e-21
-6.78601e-21
2.53974e-20
-5.93326e-20
2.82063e-19
-6.32738e-19
3.34923e-18
-7.61251e-18
3.19308e-17
-7.62179e-17
2.02052e-16
-5.07585e-16
8.41086e-16
-2.1489e-15
-6.48668e-15
-5.54819e-69
3.72753e-66
-8.00377e-67
8.55103e-64
-1.98072e-67
5.59206e-62
-1.44326e-71
1.09841e-60
-3.8958e-70
-2.01296e-68
-1.34451e-64
-2.41013e-64
-2.01883e-60
-8.58395e-61
-3.17899e-56
-4.56842e-57
-2.70822e-52
-1.98292e-53
-1.36277e-48
-8.52405e-50
-1.20521e-46
-4.30783e-46
-7.66663e-46
-1.03507e-44
-1.63967e-45
-4.19704e-44
-1.79976e-45
-8.46578e-44
-1.00286e-45
-1.16275e-43
6.89972e-46
-1.26984e-43
2.79224e-45
-1.20835e-43
4.69541e-45
-1.36244e-43
4.32264e-44
-1.3667e-42
1.51441e-42
-3.20128e-41
3.98144e-41
-6.33601e-40
9.58395e-40
-1.19477e-38
2.08515e-38
-2.11124e-37
4.16966e-37
-3.52644e-36
7.78095e-36
-5.62434e-35
1.35955e-34
-8.59716e-34
2.21758e-33
-1.24796e-32
3.37818e-32
-1.71525e-31
4.84294e-31
-2.25066e-30
6.55329e-30
-2.82064e-29
8.3627e-29
-3.36816e-28
1.00872e-27
-3.83823e-27
1.15693e-26
-4.19401e-26
1.27232e-25
-4.42833e-25
1.3485e-24
-4.55226e-24
1.3604e-23
-4.516e-23
1.27118e-22
-4.19068e-22
1.11704e-21
-3.63301e-21
1.03671e-20
-3.25047e-20
1.18348e-19
-3.57008e-19
1.53897e-18
-4.71164e-18
1.6463e-17
-5.33053e-17
1.13015e-16
-3.85167e-16
4.80709e-16
-1.6743e-15
-4.94804e-15
-1.43404e-69
1.00448e-66
8.50618e-66
2.42607e-64
1.10048e-63
1.70508e-62
-3.75875e-71
3.65848e-61
-1.50447e-68
-5.1225e-69
-2.09335e-64
-3.16255e-65
-7.8197e-61
-7.43975e-62
-4.29356e-57
-2.65093e-58
-1.90076e-53
-7.90241e-55
-8.03779e-50
-2.09882e-51
-1.36802e-47
-9.21697e-48
-1.22399e-46
-3.39569e-46
-3.45952e-46
-1.74964e-45
-5.47636e-46
-3.97283e-45
-5.94843e-46
-5.79706e-45
-4.9609e-46
-6.67591e-45
-3.98437e-46
-7.3406e-45
-4.57354e-46
-1.86564e-44
-3.38941e-45
-4.456e-43
4.30133e-44
-1.00987e-41
3.48666e-42
-2.06737e-40
1.21472e-40
-3.97758e-39
3.22768e-39
-7.1305e-38
7.34143e-38
-1.20281e-36
1.50162e-36
-1.93399e-35
2.82568e-35
-2.98361e-34
4.89701e-34
-4.39171e-33
7.84656e-33
-6.15137e-32
1.17701e-31
-8.24476e-31
1.65713e-30
-1.05639e-29
2.18931e-29
-1.29104e-28
2.72407e-28
-1.50773e-27
3.21228e-27
-1.68876e-26
3.62314e-26
-1.82747e-25
3.94537e-25
-1.93258e-24
4.11793e-24
-1.99401e-23
4.00209e-23
-1.94969e-22
3.63769e-22
-1.78686e-21
3.44196e-21
-1.6759e-20
4.05105e-20
-1.95158e-19
5.80131e-19
-2.88573e-18
6.99955e-18
-3.66738e-17
5.1888e-17
-2.84601e-16
2.26979e-16
-1.27931e-15
-3.78142e-15
2.00746e-69
2.79785e-71
1.41156e-65
1.07367e-69
7.38848e-64
5.38732e-69
-1.01219e-71
-1.3187e-74
-5.64923e-69
-1.04823e-70
-3.4603e-65
-4.54134e-67
-7.30984e-62
-1.10829e-63
-2.61452e-58
-3.02008e-60
-7.81815e-55
-6.93973e-57
-1.90549e-51
-1.39252e-53
-5.12593e-49
-4.73441e-50
-6.8734e-48
-8.05616e-48
-2.43167e-47
-6.76281e-47
-4.38041e-47
-1.8114e-46
-5.32014e-47
-2.80411e-46
-5.59419e-47
-3.41015e-46
-6.21645e-47
-4.72129e-46
-3.26119e-46
-4.44349e-45
-7.34119e-45
-1.22139e-43
-1.40236e-43
-2.75985e-42
-2.33341e-42
-5.87306e-41
-3.23356e-41
-1.16007e-39
-3.28435e-40
-2.13162e-38
-9.66314e-40
-3.66268e-37
6.14186e-38
-5.96182e-36
2.17975e-36
-9.29299e-35
5.06057e-35
-1.38771e-33
9.68845e-34
-1.98308e-32
1.63912e-32
-2.71354e-31
2.51451e-31
-3.551e-30
3.54002e-30
-4.44175e-29
4.61998e-29
-5.31912e-28
5.63715e-28
-6.10738e-27
6.50053e-27
-6.75681e-26
7.18854e-26
-7.29721e-25
7.63492e-25
-7.74838e-24
7.59721e-24
-7.92332e-23
7.06324e-23
-7.68698e-22
6.79371e-22
-7.72787e-21
8.31758e-21
-1.01231e-19
1.3177e-19
-1.76283e-18
1.7588e-18
-2.50499e-17
1.40494e-17
-2.06053e-16
6.59238e-17
-9.69926e-16
-2.9758e-15
4.47379e-73
1.1642e-71
8.33486e-72
4.4162e-70
-4.0504e-77
4.14639e-69
-1.2849e-74
-3.78462e-76
-1.03572e-70
-1.23773e-72
-4.49764e-67
-4.27488e-69
-1.09701e-63
-8.46168e-66
-2.99409e-60
-1.88387e-62
-6.89073e-57
-3.55159e-59
-1.36672e-53
-5.82385e-56
-9.29175e-51
-1.25513e-52
-2.94545e-49
-1.23044e-49
-1.423e-48
-1.88206e-48
-2.83595e-48
-6.01948e-48
-3.61315e-48
-9.98382e-48
-4.29515e-48
-1.39838e-47
-8.25844e-48
-5.41494e-47
-1.42569e-46
-1.29411e-45
-3.53653e-45
-3.08977e-44
-7.79536e-44
-6.99396e-43
-1.58287e-42
-1.50418e-41
-2.93845e-41
-3.01715e-40
-4.98191e-40
-5.67629e-39
-7.77332e-39
-9.98804e-38
-1.13357e-37
-1.65283e-36
-1.55615e-36
-2.60775e-35
-2.01196e-35
-3.96147e-34
-2.45319e-34
-5.78804e-33
-2.83163e-33
-8.0917e-32
-3.12575e-32
-1.08207e-30
-3.37335e-31
-1.38715e-29
-3.66888e-30
-1.70736e-28
-4.14098e-29
-2.01639e-27
-4.95978e-28
-2.28394e-26
-6.34122e-27
-2.4995e-25
-8.30466e-26
-2.67216e-24
-1.01205e-24
-2.76796e-23
-1.10623e-23
-2.75869e-22
-1.38745e-22
-2.97127e-21
-2.91469e-21
-4.68614e-20
-7.38066e-20
-1.02398e-18
-1.12477e-18
-1.64329e-17
-8.38476e-18
-1.4449e-16
-3.33697e-17
-7.29557e-16
-2.42556e-15
3.56448e-73
1.78334e-72
9.51256e-72
5.24064e-71
-8.28118e-79
1.52456e-69
-3.74353e-76
-4.93723e-78
-1.22368e-72
-1.43837e-74
-4.23125e-69
-4.32524e-71
-8.36416e-66
-7.4499e-68
-1.86455e-62
-1.42754e-64
-3.52049e-59
-2.32797e-61
-5.77729e-56
-3.64889e-58
-9.38484e-53
-4.76705e-55
-8.2637e-51
-9.8161e-52
-5.5274e-50
-3.03494e-50
-1.17404e-49
-1.23874e-49
-1.60506e-49
-2.39889e-49
-2.54109e-49
-6.56071e-49
-2.11028e-48
-1.33399e-47
-5.34479e-47
-3.46429e-46
-1.27755e-45
-7.74948e-45
-2.92892e-44
-1.72542e-43
-6.26652e-43
-3.64754e-42
-1.25246e-41
-7.29308e-41
-2.33343e-40
-1.38593e-39
-4.0386e-39
-2.48527e-38
-6.57103e-38
-4.183e-37
-1.02567e-36
-6.68983e-36
-1.55014e-35
-1.0336e-34
-2.25895e-34
-1.54164e-33
-3.16919e-33
-2.20074e-32
-4.29906e-32
-3.0084e-31
-5.66996e-31
-3.95447e-30
-7.28685e-30
-5.01338e-29
-9.09011e-29
-6.12937e-28
-1.09987e-27
-7.1816e-27
-1.308e-26
-8.01062e-26
-1.52015e-25
-8.48667e-25
-1.61263e-24
-8.44873e-24
-1.54588e-23
-7.98699e-23
-1.93071e-22
-8.64042e-22
-4.95274e-21
-1.7149e-20
-1.4723e-19
-5.10388e-19
-2.41204e-18
-9.67869e-18
-1.97521e-17
-9.48897e-17
-9.36199e-17
-5.3583e-16
-2.00387e-15
6.34596e-74
1.53019e-77
4.67856e-72
6.59453e-76
-2.01379e-80
-5.79704e-82
-3.31608e-78
-2.14782e-78
-8.52589e-75
-6.58986e-75
-2.35827e-71
-1.61321e-71
-4.44183e-68
-2.96892e-68
-9.1963e-65
-5.01181e-65
-1.19212e-61
-1.10509e-61
-3.47431e-58
-1.60785e-59
-4.40454e-55
-2.8915e-58
-1.20776e-52
-5.94723e-55
-1.18243e-51
-1.02577e-52
-2.60709e-51
-9.3043e-52
-4.79448e-51
-4.44807e-51
-2.55196e-50
-8.94991e-50
-6.98999e-49
-3.15862e-48
-1.74135e-47
-7.58489e-47
-4.1162e-46
-1.77085e-45
-9.40032e-45
-3.9332e-44
-2.02239e-43
-8.24761e-43
-4.13476e-42
-1.6425e-41
-8.02634e-41
-3.12801e-40
-1.45771e-39
-5.6741e-39
-2.48148e-38
-9.70697e-38
-4.05589e-37
-1.57668e-36
-6.44624e-36
-2.47012e-35
-9.88321e-35
-3.73955e-34
-1.45548e-33
-5.43598e-33
-2.06699e-32
-7.58692e-32
-2.84744e-31
-1.02039e-30
-3.82622e-30
-1.32985e-29
-5.00429e-29
-1.68772e-28
-6.31771e-28
-2.07569e-27
-7.67339e-27
-2.43378e-26
-8.67382e-26
-2.62125e-25
-8.33045e-25
-2.4188e-24
-6.94087e-24
-1.90373e-23
-8.83945e-23
-1.71456e-22
-3.1611e-21
-4.28705e-21
-1.22133e-19
-1.95401e-19
-2.31085e-18
-4.72167e-18
-2.17379e-17
-5.53754e-17
-1.21682e-16
-3.70249e-16
-1.61347e-15
1.07676e-78
6.63923e-78
-2.24374e-84
2.88159e-76
-1.19655e-83
-5.74074e-82
-9.62234e-79
-1.18526e-78
-4.80673e-75
-1.78149e-75
-1.32803e-71
-2.84919e-72
-2.51716e-68
-4.47975e-69
-4.11155e-65
-8.49194e-66
-4.50773e-62
-1.46798e-62
-4.09461e-61
-1.29917e-59
-6.34881e-59
-3.52151e-58
-2.04776e-55
-9.45077e-57
-4.81765e-54
-3.68853e-55
-2.21349e-53
-1.41948e-53
-1.62384e-52
-4.9186e-52
-5.87422e-51
-1.7653e-50
-1.7823e-49
-5.04199e-49
-4.56973e-48
-1.31383e-47
-1.12338e-46
-3.27416e-46
-2.58873e-45
-7.4661e-45
-5.61196e-44
-1.59836e-43
-1.15907e-42
-3.23348e-42
-2.29349e-41
-6.22815e-41
-4.28948e-40
-1.1445e-39
-7.54518e-39
-1.99669e-38
-1.27026e-37
-3.30846e-37
-2.07321e-36
-5.24982e-36
-3.26869e-35
-8.03158e-35
-4.96042e-34
-1.18577e-33
-7.25321e-33
-1.68753e-32
-1.02702e-31
-2.31589e-31
-1.42243e-30
-3.08228e-30
-1.93903e-29
-4.02003e-29
-2.61542e-28
-5.19683e-28
-3.48413e-27
-6.70711e-27
-4.06419e-26
-8.03525e-26
-3.35417e-25
-7.09395e-25
-2.03027e-24
-4.05091e-24
-2.17941e-23
-2.08196e-23
-1.1629e-21
-6.08011e-22
-6.39742e-20
-5.19735e-20
-1.51733e-18
-1.76652e-18
-1.76187e-17
-2.67648e-17
-1.21128e-16
-2.25291e-16
-1.1929e-15
5.95289e-79
1.0516e-78
-3.21585e-84
4.19725e-77
-9.75396e-84
-1.74342e-81
-2.75273e-80
-4.03565e-78
-1.01032e-76
-4.88045e-75
-9.84802e-74
-5.31758e-72
-4.20115e-70
-4.1421e-69
-5.48654e-66
-3.08533e-66
-9.64009e-63
-4.43537e-63
-9.21117e-61
-4.23651e-61
-1.54378e-59
-2.33005e-59
-3.97772e-58
-1.18849e-57
-1.77978e-56
-6.12629e-56
-7.15384e-55
-2.62928e-54
-3.16561e-53
-9.10471e-53
-1.09609e-51
-2.36678e-51
-3.23153e-50
-6.7005e-50
-9.15721e-49
-1.87741e-48
-2.37509e-47
-4.77353e-47
-5.67555e-46
-1.12603e-45
-1.2698e-44
-2.49097e-44
-2.68608e-43
-5.19971e-43
-5.41892e-42
-1.02693e-41
-1.04033e-40
-1.92793e-40
-1.89099e-39
-3.44595e-39
-3.26819e-38
-5.8433e-38
-5.42734e-37
-9.42169e-37
-8.71758e-36
-1.46085e-35
-1.35477e-34
-2.19566e-34
-2.0314e-33
-3.1968e-33
-2.94025e-32
-4.4926e-32
-4.13164e-31
-6.08675e-31
-5.69962e-30
-7.99212e-30
-8.19129e-29
-1.05592e-28
-1.33319e-27
-1.54912e-27
-1.88618e-26
-2.34926e-26
-1.37063e-25
-2.1361e-25
-4.81274e-25
-7.94726e-25
-2.90832e-24
-1.51629e-24
-2.43815e-22
-5.55768e-23
-2.17498e-20
-8.73385e-21
-7.03923e-19
-4.77176e-19
-1.0788e-17
-9.96571e-18
-9.53314e-17
-1.11333e-16
-7.49978e-16
1.05133e-79
1.33371e-81
-1.65155e-83
-7.77442e-85
-5.05362e-83
-2.42654e-81
-1.29335e-79
-5.73331e-78
-2.30375e-76
-8.4121e-75
-2.78829e-73
-1.02613e-71
-2.55243e-70
-1.12264e-68
-1.15786e-66
-6.07843e-66
-2.2409e-64
-8.42662e-64
-1.66736e-62
-5.33787e-62
-1.00528e-60
-2.80357e-60
-6.40374e-59
-1.30954e-58
-3.69587e-57
-5.84793e-57
-1.78953e-55
-2.30185e-55
-5.38369e-54
-8.34349e-54
-1.56783e-52
-2.86653e-52
-4.95171e-51
-8.62724e-51
-1.45117e-49
-2.32501e-49
-3.8788e-48
-5.89329e-48
-9.63278e-47
-1.41496e-46
-2.24413e-45
-3.20301e-45
-4.92157e-44
-6.84242e-44
-1.0219e-42
-1.38597e-42
-2.02164e-41
-2.67099e-41
-3.79615e-40
-4.88538e-40
-6.73353e-39
-8.4414e-39
-1.13891e-37
-1.38668e-37
-1.86427e-36
-2.19833e-36
-2.96965e-35
-3.39372e-35
-4.59028e-34
-5.10115e-34
-6.84637e-33
-7.42682e-33
-9.68993e-32
-1.0352e-31
-1.28798e-30
-1.35905e-30
-1.88618e-29
-1.76681e-29
-4.19741e-28
-2.89026e-28
-8.76814e-27
-5.58123e-27
-6.56903e-26
-4.77741e-26
-1.03807e-25
-1.24946e-25
-2.61764e-25
-1.49263e-25
-4.45608e-23
-8.16903e-24
-4.74507e-21
-9.03213e-22
-2.27183e-19
-9.03521e-20
-4.82182e-18
-2.72317e-18
-5.70807e-17
-4.1398e-17
-3.65654e-16
-2.28887e-87
7.75453e-82
-2.32822e-85
-5.46909e-85
-6.11286e-83
-1.22397e-81
-1.70245e-79
-3.28164e-78
-3.11355e-76
-6.03495e-75
-9.71533e-73
-8.13718e-72
-2.39104e-69
-1.83674e-68
-4.24285e-67
-5.83286e-66
-3.7036e-65
-1.14282e-64
-2.50458e-63
-6.48587e-63
-1.39268e-61
-3.03451e-61
-7.39557e-60
-1.33457e-59
-3.49547e-58
-6.118e-58
-1.46081e-56
-2.4667e-56
-6.00182e-55
-8.98108e-55
-2.1996e-53
-2.96911e-53
-6.87733e-52
-9.00635e-52
-1.96093e-50
-2.49364e-50
-5.28367e-49
-6.38856e-49
-1.34256e-47
-1.54823e-47
-3.2053e-46
-3.54232e-46
-7.22242e-45
-7.67306e-45
-1.54778e-43
-1.58718e-43
-3.15775e-42
-3.13918e-42
-6.07564e-41
-5.87324e-41
-1.10021e-39
-1.03365e-39
-1.90373e-38
-1.73661e-38
-3.20017e-37
-2.83931e-37
-5.26041e-36
-4.53981e-36
-8.45858e-35
-7.06747e-35
-1.32267e-33
-1.06525e-33
-1.91799e-32
-1.54047e-32
-2.41344e-31
-2.08211e-31
-3.48116e-30
-2.70145e-30
-1.08488e-28
-4.22989e-29
-2.72548e-27
-7.52098e-28
-1.39061e-26
-6.04395e-27
-1.41793e-26
-1.61014e-26
-3.73704e-26
-2.66356e-26
-6.56978e-24
-1.32018e-24
-6.81937e-22
-1.12401e-22
-5.12154e-20
-1.27788e-20
-1.53107e-18
-5.4702e-19
-2.44166e-17
-1.0971e-17
-1.27139e-16
-1.40993e-87
2.05336e-82
-2.4536e-85
-3.02959e-85
-5.83137e-82
-6.39607e-82
-1.59568e-78
-1.68198e-78
-2.80858e-75
-3.21946e-75
-3.32536e-72
-4.84719e-72
-1.18783e-68
-1.11472e-68
-2.01653e-67
-1.41952e-66
-5.35622e-66
-1.03798e-65
-3.16597e-64
-6.16015e-64
-1.55671e-62
-2.92841e-62
-8.2037e-61
-1.27621e-60
-4.0412e-59
-5.58862e-59
-1.76059e-57
-2.18497e-57
-6.85155e-56
-7.9194e-56
-2.43328e-54
-2.67288e-54
-7.83579e-53
-8.20256e-53
-2.28518e-51
-2.25404e-51
-6.23079e-50
-5.7363e-50
-1.60093e-48
-1.40637e-48
-3.86794e-47
-3.28169e-47
-8.87594e-46
-7.26346e-46
-1.95615e-44
-1.53656e-44
-4.10957e-43
-3.12074e-43
-8.0855e-42
-6.05339e-42
-1.49553e-40
-1.11516e-40
-2.66433e-39
-1.96447e-39
-4.64554e-38
-3.34649e-38
-7.93047e-37
-5.53359e-37
-1.31916e-35
-8.80412e-36
-2.13989e-34
-1.3276e-34
-3.25534e-33
-1.91675e-33
-4.26501e-32
-2.69055e-32
-6.13308e-31
-3.58866e-31
-1.68312e-29
-4.75846e-30
-3.6094e-28
-6.22753e-29
-1.8655e-27
-4.70859e-28
-2.383e-27
-1.41032e-27
-7.8353e-27
-4.26663e-27
-1.02794e-24
-2.43094e-25
-8.58679e-23
-1.90921e-23
-8.72742e-21
-1.877e-21
-3.46293e-19
-8.97366e-20
-7.10131e-18
-2.12304e-18
-3.10197e-17
-7.87738e-88
3.17188e-85
-3.06024e-85
-6.05574e-87
-6.19993e-82
-1.87739e-83
-1.64458e-78
-3.44921e-80
-3.16384e-75
-5.06e-77
-4.73128e-72
-6.92517e-74
-3.56573e-69
-6.20331e-71
-3.10367e-68
-6.30072e-69
-5.16588e-67
-5.91024e-67
-3.21492e-65
-3.7208e-65
-1.63316e-63
-2.11813e-63
-8.31559e-62
-1.04001e-61
-3.88036e-60
-4.40796e-60
-1.63746e-58
-1.68716e-58
-6.47914e-57
-6.02728e-57
-2.36733e-55
-2.02591e-55
-7.63411e-54
-6.26857e-54
-2.19391e-52
-1.74516e-52
-5.98948e-51
-4.50131e-51
-1.56625e-49
-1.1213e-49
-3.8733e-48
-2.66952e-48
-9.09452e-47
-6.04927e-47
-2.04887e-45
-1.30635e-45
-4.42981e-44
-2.69328e-44
-9.10224e-43
-5.34508e-43
-1.77649e-41
-1.03033e-41
-3.32958e-40
-1.91515e-40
-6.0684e-39
-3.38196e-39
-1.07703e-37
-5.70797e-38
-1.81229e-36
-9.19491e-37
-2.87128e-35
-1.34717e-35
-4.45112e-34
-1.78949e-34
-6.55426e-33
-2.35283e-33
-9.33857e-32
-3.03685e-32
-1.71303e-30
-3.42655e-31
-2.8267e-29
-3.35925e-30
-1.54495e-28
-2.46086e-29
-2.58741e-28
-9.51395e-29
-2.27858e-27
-8.61813e-28
-1.75324e-25
-6.06528e-26
-1.4799e-23
-4.70864e-24
-1.42838e-21
-3.96013e-22
-6.12384e-20
-1.50096e-20
-1.46695e-18
-3.52213e-19
-5.95746e-18
-3.46023e-89
2.95429e-85
-5.85605e-88
-5.50487e-87
-5.42834e-85
-1.46814e-83
-1.40336e-81
-2.99742e-80
-4.75626e-78
-4.88179e-77
-2.1159e-74
-1.14125e-73
-2.72074e-72
-4.03472e-71
-3.21548e-70
-3.91106e-70
-2.91192e-68
-3.011e-68
-2.11433e-66
-1.98927e-66
-1.34095e-64
-1.12176e-64
-7.06389e-63
-5.53048e-63
-3.20924e-61
-2.43482e-61
-1.32687e-59
-9.70291e-60
-5.16917e-58
-3.52158e-58
-1.88684e-56
-1.17157e-56
-6.16049e-55
-3.63313e-55
-1.79961e-53
-1.06645e-53
-4.99262e-52
-2.94457e-52
-1.32995e-50
-7.58196e-51
-3.37297e-49
-1.84429e-49
-8.13544e-48
-4.27855e-48
-1.86262e-46
-9.48398e-47
-4.06822e-45
-2.0039e-45
-8.62953e-44
-4.04814e-44
-1.78699e-42
-7.92633e-43
-3.52643e-41
-1.48988e-41
-6.61797e-40
-2.56779e-40
-1.21586e-38
-4.09464e-39
-2.0821e-37
-6.41215e-38
-3.08337e-36
-9.03827e-37
-4.33908e-35
-1.01041e-35
-6.39686e-34
-9.90989e-35
-8.74555e-33
-1.09952e-33
-1.12273e-31
-1.4896e-32
-1.37897e-30
-1.80721e-31
-8.59969e-30
-1.22861e-30
-2.07582e-29
-5.57104e-30
-5.52485e-28
-2.05696e-28
-4.3476e-26
-1.51803e-26
-4.35267e-24
-1.21168e-24
-2.96164e-22
-8.78521e-23
-1.05236e-20
-2.80728e-21
-2.61981e-19
-5.79281e-20
-9.29028e-19
-3.40658e-89
1.36191e-85
-5.53572e-87
-3.61676e-90
-1.46613e-83
-9.04605e-87
-2.98954e-80
-1.93462e-83
-4.91008e-77
-3.04142e-80
-1.38351e-73
-3.80814e-77
-1.16885e-72
-7.079e-74
-1.85007e-71
-1.39784e-71
-1.61697e-69
-1.133e-69
-1.17998e-67
-7.82963e-68
-7.27622e-66
-4.64905e-66
-3.90902e-64
-2.33229e-64
-1.87105e-62
-1.0319e-62
-8.05988e-61
-4.10655e-61
-3.12935e-59
-1.50584e-59
-1.1107e-57
-5.11716e-58
-3.71013e-56
-1.62208e-56
-1.1731e-54
-4.80603e-55
-3.44265e-53
-1.33018e-53
-9.42333e-52
-3.46717e-52
-2.44448e-50
-8.59629e-51
-6.05922e-49
-2.04753e-49
-1.43081e-47
-4.68559e-48
-3.20012e-46
-1.01126e-46
-6.91737e-45
-2.03089e-45
-1.47803e-43
-3.9702e-44
-2.94541e-42
-7.83818e-43
-5.21657e-41
-1.33403e-41
-9.16766e-40
-1.65895e-40
-1.61346e-38
-1.67203e-39
-2.25268e-37
-1.84037e-38
-2.36277e-36
-2.68424e-37
-2.47308e-35
-4.87535e-36
-3.472e-34
-9.50956e-35
-6.34037e-33
-1.03825e-33
-7.78836e-32
-3.72309e-33
-2.80203e-31
-8.92414e-33
-1.83591e-30
-4.41759e-31
-1.61419e-28
-3.32774e-29
-1.24388e-26
-2.4041e-27
-1.1652e-24
-1.75517e-25
-6.86066e-23
-1.36391e-23
-2.05597e-21
-4.52966e-22
-4.40693e-20
-9.04644e-21
-1.43122e-19
-1.43504e-92
-6.65555e-95
-3.44449e-90
-2.65149e-91
-8.32973e-87
-7.06967e-88
-1.79616e-83
-1.35527e-84
-2.84948e-80
-1.86375e-81
-3.52891e-77
-2.36864e-78
-4.83618e-75
-3.28331e-75
-6.93155e-73
-4.17263e-73
-6.32814e-71
-3.3484e-71
-4.93253e-69
-2.39224e-69
-3.16226e-67
-1.497e-67
-1.71979e-65
-7.46862e-66
-8.17492e-64
-3.25194e-64
-3.51181e-62
-1.25275e-62
-1.38477e-60
-4.45505e-61
-5.05969e-59
-1.49673e-59
-1.72249e-57
-4.79145e-58
-5.44352e-56
-1.44477e-56
-1.6039e-54
-4.07581e-55
-4.4495e-53
-1.09895e-53
-1.17979e-51
-2.85385e-52
-3.03143e-50
-7.13202e-51
-7.46189e-49
-1.70355e-49
-1.68201e-47
-3.8979e-48
-3.53406e-46
-7.82495e-47
-7.94328e-45
-1.17712e-45
-1.80928e-43
-1.36591e-44
-3.02859e-42
-1.59932e-43
-3.4144e-41
-2.42491e-42
-3.4261e-40
-4.21837e-41
-4.2335e-39
-7.56829e-40
-7.21841e-38
-1.39005e-38
-2.05819e-36
-2.64089e-37
-5.85992e-35
-3.375e-36
-4.58632e-34
-1.29245e-35
-6.85577e-34
-1.6083e-35
-3.10463e-33
-6.69254e-34
-3.59303e-31
-5.28919e-32
-2.80513e-29
-3.99598e-30
-2.07408e-27
-2.81413e-28
-1.75149e-25
-1.9321e-26
-1.15202e-23
-1.53006e-24
-3.46966e-22
-5.69284e-23
-7.16893e-21
-1.19037e-21
-1.80398e-20
-1.18404e-96
-6.51232e-95
-6.41791e-93
-2.85508e-91
-2.75978e-89
-8.80499e-88
-7.40786e-86
-1.73817e-84
-1.84053e-82
-3.66026e-81
-5.59912e-79
-3.41119e-78
-1.77369e-76
-9.09515e-77
-2.11448e-74
-1.23156e-74
-1.92657e-72
-9.2927e-73
-1.60958e-70
-5.44143e-71
-1.0546e-68
-2.91978e-69
-5.70771e-67
-1.36932e-67
-2.64175e-65
-5.91328e-66
-1.08892e-63
-2.36805e-64
-4.1621e-62
-8.82903e-63
-1.51444e-60
-3.07877e-61
-5.22532e-59
-1.00918e-59
-1.67149e-57
-3.12871e-58
-5.03445e-56
-9.24332e-57
-1.45592e-54
-2.65583e-55
-4.07502e-53
-7.77638e-54
-1.08942e-51
-2.20619e-52
-2.89581e-50
-4.57551e-51
-7.63749e-49
-6.14221e-50
-1.57969e-47
-6.96543e-49
-2.16891e-46
-9.90284e-48
-2.41752e-45
-1.73633e-46
-3.24482e-44
-3.29813e-45
-5.59698e-43
-6.57674e-44
-1.0572e-41
-1.26976e-42
-2.04135e-40
-2.22953e-41
-5.07085e-39
-3.62994e-40
-1.70111e-37
-5.50181e-39
-1.78402e-36
-5.01294e-38
-1.97749e-36
-1.8445e-37
-5.03323e-36
-9.48388e-37
-5.21388e-34
-6.64048e-35
-4.3986e-32
-5.27683e-33
-3.43701e-30
-3.9261e-31
-2.47715e-28
-2.72606e-29
-1.89904e-26
-1.82541e-27
-1.40578e-24
-1.4322e-25
-4.78943e-23
-5.69199e-24
-9.87838e-22
-1.25847e-22
-1.9227e-21
-1.07311e-94
4.2188e-95
-2.85071e-91
-7.80018e-94
-8.77522e-88
-2.3478e-90
-1.7365e-84
-4.50726e-87
-7.09186e-81
-6.40769e-84
-1.3001e-79
-1.32188e-80
-5.48695e-78
-2.0543e-78
-6.91985e-76
-1.63907e-76
-5.34856e-74
-1.10175e-74
-3.55786e-72
-6.61159e-73
-2.04122e-70
-3.56381e-71
-1.04216e-68
-1.74953e-69
-4.88355e-67
-7.88342e-68
-2.11329e-65
-3.2887e-66
-8.4853e-64
-1.27876e-64
-3.17623e-62
-4.65231e-63
-1.11456e-60
-1.58959e-61
-3.67488e-59
-5.25819e-60
-1.14273e-57
-1.81746e-58
-3.62056e-56
-6.21555e-57
-1.31626e-54
-1.52046e-55
-4.21818e-53
-2.30144e-54
-7.82534e-52
-2.70812e-53
-9.25019e-51
-3.71705e-52
-1.14765e-49
-6.76933e-51
-1.8752e-48
-1.30727e-49
-3.61045e-47
-2.83914e-48
-7.69217e-46
-6.20932e-47
-1.69463e-44
-1.10308e-45
-3.45858e-43
-1.78247e-44
-6.49481e-42
-3.50084e-43
-1.42747e-40
-7.00143e-42
-2.82101e-39
-6.87487e-41
-2.1501e-38
-2.35651e-40
-3.67418e-38
-9.18499e-40
-3.95821e-37
-6.14009e-38
-5.3428e-35
-5.15972e-36
-4.47909e-33
-4.08834e-34
-3.4494e-31
-3.02784e-32
-2.44909e-29
-2.09558e-30
-1.78651e-27
-1.3898e-28
-1.37945e-25
-1.08478e-26
-5.11023e-24
-4.56856e-25
-1.1178e-22
-1.07634e-23
-1.70929e-22
-4.31029e-96
1.33929e-94
-7.74457e-94
-9.87127e-96
-2.31549e-90
-2.91031e-92
-4.44505e-87
-5.47094e-89
-6.22611e-84
-7.65531e-86
-7.39114e-82
-1.58931e-82
-9.87196e-80
-1.59125e-80
-8.67534e-78
-1.27588e-78
-6.5184e-76
-8.95788e-77
-4.30391e-74
-5.58948e-75
-2.53866e-72
-3.13473e-73
-1.35436e-70
-1.59841e-71
-6.60557e-69
-7.52071e-70
-2.97588e-67
-3.2808e-68
-1.246e-65
-1.3309e-66
-4.80856e-64
-5.14982e-65
-1.70629e-62
-2.03104e-63
-6.25202e-61
-8.0314e-62
-2.7601e-59
-2.51613e-60
-1.08666e-57
-5.18634e-59
-2.42312e-56
-7.35788e-58
-3.17459e-55
-9.7324e-57
-3.84087e-54
-1.7398e-55
-6.33898e-53
-3.37108e-54
-1.21395e-51
-7.28841e-53
-2.66538e-50
-1.50635e-51
-6.92691e-49
-2.45089e-50
-1.51622e-47
-3.73551e-49
-2.52129e-46
-8.16165e-48
-4.80368e-45
-2.49299e-46
-1.52636e-43
-4.96715e-45
-3.87161e-42
-2.04382e-44
-2.76047e-41
-7.19606e-45
-4.50496e-41
-4.16887e-43
-3.41947e-40
-3.89172e-41
-4.678e-38
-3.51379e-39
-4.26704e-36
-2.98666e-37
-3.53499e-34
-2.37902e-35
-2.71045e-32
-1.77269e-33
-1.91702e-30
-1.23575e-31
-1.34989e-28
-8.21907e-30
-1.07663e-26
-6.4148e-28
-4.30363e-25
-2.88785e-26
-1.02258e-23
-7.2382e-25
-1.21847e-23
-5.52419e-98
1.35311e-94
-9.84719e-96
-7.93195e-98
-2.89158e-92
-1.47574e-94
-5.43462e-89
-2.72933e-91
-7.41774e-86
-3.77073e-88
-6.89233e-84
-7.97727e-85
-7.61703e-82
-7.91424e-83
-6.88035e-80
-6.61755e-81
-5.3681e-78
-4.83914e-79
-3.67987e-76
-3.1499e-77
-2.24494e-74
-1.85189e-75
-1.24415e-72
-9.9318e-74
-6.33882e-71
-4.87863e-72
-2.95142e-69
-2.25034e-70
-1.25144e-67
-1.04983e-68
-5.27101e-66
-4.83602e-67
-2.5318e-64
-1.8278e-65
-1.1876e-62
-5.25907e-64
-3.80988e-61
-1.04337e-62
-7.0078e-60
-1.53845e-61
-9.03671e-59
-2.57431e-60
-1.43553e-57
-5.11552e-59
-2.74004e-56
-1.18147e-57
-6.17301e-55
-2.54765e-56
-1.58132e-53
-4.13214e-55
-3.16809e-52
-5.85971e-54
-4.59421e-51
-1.24266e-52
-7.73081e-50
-3.5102e-51
-2.68041e-48
-6.10199e-50
-1.96396e-46
-2.46597e-49
-3.17217e-45
-1.42961e-49
-1.21439e-45
-1.61899e-48
-2.07273e-45
-1.58225e-46
-2.19263e-43
-1.62401e-44
-2.69624e-41
-1.58532e-42
-2.72626e-39
-1.4592e-40
-2.50791e-37
-1.26005e-38
-2.08588e-35
-1.02009e-36
-1.60809e-33
-7.73039e-35
-1.14649e-31
-5.48489e-33
-7.85558e-30
-3.69363e-31
-6.556e-28
-2.89826e-29
-2.80224e-26
-1.4259e-27
-7.20581e-25
-3.83775e-26
-6.89785e-25
-2.80534e-100
5.40169e-95
-1.49012e-97
6.94082e-98
-1.36551e-94
-1.08898e-95
-2.52486e-91
-1.9958e-92
-3.25678e-88
-3.96966e-89
-3.41377e-86
-2.36073e-87
-3.83356e-84
-2.40922e-85
-3.58949e-82
-2.10594e-83
-2.90054e-80
-1.61421e-81
-2.06935e-78
-1.10428e-79
-1.32729e-76
-6.82167e-78
-7.64175e-75
-3.88792e-76
-3.92032e-73
-2.14551e-74
-1.98051e-71
-1.13898e-72
-1.09843e-69
-5.47139e-71
-5.65483e-68
-2.30199e-69
-2.40743e-66
-6.14595e-68
-7.00997e-65
-1.05715e-66
-1.19261e-63
-1.91992e-65
-1.86886e-62
-4.18912e-64
-3.42996e-61
-1.03653e-62
-8.18711e-60
-2.48645e-61
-2.27159e-58
-4.2737e-60
-4.78991e-57
-5.69348e-59
-6.56713e-56
-1.10555e-57
-1.06916e-54
-3.06726e-56
-3.65471e-53
-5.66034e-55
-2.15532e-51
-3.18002e-54
-3.33679e-50
-4.9708e-54
-2.08643e-50
-3.11835e-54
-2.45811e-50
-3.21811e-52
-5.3524e-49
-3.74358e-50
-6.01118e-47
-4.18022e-48
-8.68234e-45
-4.4424e-46
-1.10738e-42
-4.46149e-44
-1.14545e-40
-4.22174e-42
-1.06989e-38
-3.74723e-40
-9.03597e-37
-3.11881e-38
-7.08211e-35
-2.43078e-36
-5.14442e-33
-1.77452e-34
-3.42571e-31
-1.22047e-32
-3.05434e-29
-9.61654e-31
-1.41855e-27
-5.38374e-29
-3.95507e-26
-1.59259e-27
-3.09828e-26
3.66778e-100
1.14467e-98
-1.42344e-97
4.61968e-97
-1.17178e-95
6.85675e-97
-1.9328e-92
-4.83302e-96
-1.2674e-90
-1.16663e-92
-1.00747e-88
-3.51345e-90
-1.16564e-86
-3.81474e-88
-1.13518e-84
-3.55833e-86
-9.58788e-83
-2.90413e-84
-7.1213e-81
-2.12662e-82
-4.68209e-79
-1.48506e-80
-2.90806e-77
-9.94097e-79
-1.79252e-75
-5.70744e-77
-1.04414e-73
-3.0179e-75
-6.46204e-72
-1.20528e-73
-2.85491e-70
-2.96319e-72
-6.1929e-69
-6.11854e-71
-1.086e-67
-1.45915e-69
-2.19721e-66
-3.96241e-68
-5.59004e-65
-1.10828e-66
-1.74581e-63
-2.72144e-65
-4.24245e-62
-4.59008e-64
-5.80654e-61
-6.38485e-63
-8.55842e-60
-1.39089e-61
-2.6407e-58
-3.0654e-60
-1.30601e-56
-3.63895e-59
-2.4441e-55
-1.20667e-58
-5.96471e-55
-1.88565e-60
-3.89361e-55
-2.75977e-58
-8.50444e-55
-3.76491e-56
-1.03881e-52
-4.91691e-54
-1.30846e-50
-6.10216e-52
-1.58694e-48
-7.16353e-50
-2.41885e-46
-7.97111e-48
-3.14138e-44
-8.36051e-46
-3.33302e-42
-8.24586e-44
-3.20222e-40
-7.62411e-42
-2.77934e-38
-6.60708e-40
-2.24151e-36
-5.36145e-38
-1.67665e-34
-4.07515e-36
-1.07223e-32
-2.9099e-34
-1.04981e-30
-2.26264e-32
-5.4848e-29
-1.50906e-30
-1.69076e-27
-5.07808e-29
-1.09156e-27
2.3014e-99
4.45901e-99
8.72281e-99
2.19764e-97
-1.00419e-97
1.14425e-96
-4.90883e-96
-8.40296e-100
-7.36132e-94
-1.18135e-96
-1.4891e-91
-2.52869e-93
-1.82545e-89
-2.8586e-91
-1.87849e-87
-2.73703e-89
-1.63993e-85
-2.56116e-87
-1.31098e-83
-2.47591e-85
-1.05521e-81
-1.5267e-83
-7.36271e-80
-1.07793e-81
-5.07644e-78
-6.19349e-80
-3.24137e-76
-2.27865e-78
-1.14976e-74
-6.37781e-77
-2.59207e-73
-1.73546e-75
-5.83781e-72
-5.29862e-74
-1.57946e-70
-1.70832e-72
-5.0115e-69
-5.70583e-71
-1.71815e-67
-1.43276e-69
-4.03273e-66
-2.1629e-68
-5.47908e-65
-3.36025e-67
-1.00873e-63
-9.16944e-66
-3.36779e-62
-1.72403e-64
-1.2107e-60
-1.57188e-63
-1.26628e-59
-4.62308e-63
-2.14545e-61
-6.32333e-65
-4.74676e-61
-1.10374e-62
-7.45285e-59
-1.79044e-60
-1.10835e-56
-2.75984e-58
-1.57194e-54
-4.03473e-56
-2.09556e-52
-5.55828e-54
-2.74473e-50
-7.1757e-52
-4.60736e-48
-8.66444e-50
-5.99884e-46
-9.77362e-48
-6.58818e-44
-1.02943e-45
-6.56093e-42
-1.01298e-43
-5.92113e-40
-9.3152e-42
-4.96419e-38
-8.00897e-40
-3.87241e-36
-6.44237e-38
-2.77379e-34
-4.85659e-36
-2.56159e-32
-3.69207e-34
-1.57551e-30
-3.00988e-32
-5.52673e-29
-1.21407e-30
-2.96077e-29
9.8457e-100
5.07928e-102
1.46094e-98
3.10523e-100
-1.76462e-101
2.4661e-99
-8.57813e-100
-1.29723e-103
-1.15563e-96
-1.83996e-100
-1.05977e-94
-3.93696e-97
-1.2575e-92
-8.43482e-95
-1.30264e-90
-8.37859e-93
-1.74443e-88
-6.66731e-91
-1.33869e-86
-6.6869e-89
-1.06558e-84
-6.33069e-87
-9.30297e-83
-3.73196e-85
-5.16458e-81
-1.02334e-83
-1.78662e-79
-3.68542e-82
-5.03288e-78
-1.82877e-80
-1.52373e-76
-8.14901e-79
-5.0698e-75
-3.24693e-77
-2.08245e-73
-1.21553e-75
-8.44754e-72
-2.8776e-74
-1.6694e-70
-4.43177e-73
-2.20384e-69
-9.126e-72
-5.79713e-68
-2.49304e-70
-2.08063e-66
-4.39594e-69
-5.25264e-65
-3.98798e-68
-4.30932e-64
-1.16486e-67
-6.39118e-66
-9.37668e-70
-1.43299e-65
-1.95549e-67
-2.68152e-63
-3.88745e-65
-4.67095e-61
-7.28527e-63
-9.33722e-59
-1.27555e-60
-2.28452e-56
-2.07923e-58
-3.89444e-54
-3.15509e-56
-5.66741e-52
-4.45439e-54
-7.33607e-50
-5.85216e-52
-8.63879e-48
-7.15851e-50
-9.41754e-46
-8.15805e-48
-9.48175e-44
-8.66838e-46
-8.85962e-42
-8.5938e-44
-7.72293e-40
-7.95602e-42
-6.29158e-38
-6.88424e-40
-4.79083e-36
-5.57352e-38
-4.2326e-34
-4.28911e-36
-3.24411e-32
-3.96882e-34
-1.34807e-30
-2.10094e-32
-6.0302e-31
1.15893e-102
3.06861e-109
3.15728e-101
1.83787e-107
-2.70946e-105
3.65178e-107
-1.32409e-103
-2.42566e-107
-1.82078e-100
-2.45748e-104
-2.31478e-98
-5.82213e-101
-3.94094e-96
-4.47464e-99
-3.44442e-94
-2.14126e-97
-3.44248e-92
-1.00693e-95
-4.73207e-90
-8.53693e-94
-5.80005e-88
-1.3443e-91
-2.0472e-86
-9.84339e-90
-5.97667e-85
-7.71677e-88
-2.84659e-83
-4.6916e-86
-1.52189e-81
-2.34759e-84
-7.10862e-80
-1.27953e-82
-3.79343e-78
-6.00438e-81
-1.4792e-76
-1.3553e-79
-2.59259e-75
-2.48664e-78
-4.38404e-74
-8.28671e-77
-1.4149e-72
-2.29289e-75
-4.69255e-71
-4.59619e-74
-1.16166e-69
-4.52647e-73
-9.42779e-69
-1.0535e-72
-8.23263e-71
-5.79688e-75
-1.80859e-70
-1.45395e-72
-8.44352e-68
-3.53665e-70
-2.66088e-65
-8.02365e-68
-5.78245e-63
-1.69084e-65
-1.07835e-60
-3.30721e-63
-1.84042e-58
-6.00273e-61
-2.8656e-56
-1.01123e-58
-4.12017e-54
-1.58168e-56
-5.49575e-52
-2.29802e-54
-6.80923e-50
-3.10317e-52
-7.84511e-48
-3.89735e-50
-8.40082e-46
-4.55597e-48
-8.38327e-44
-4.96144e-46
-7.80852e-42
-5.03784e-44
-6.79476e-40
-4.77426e-42
-5.53413e-38
-4.22679e-40
-4.46381e-36
-3.50636e-38
-4.52747e-34
-3.225e-36
-2.37386e-32
-2.48076e-34
-8.91064e-33
4.72984e-110
8.35117e-110
4.76033e-109
6.1839e-108
-3.43692e-109
3.14511e-107
-4.24758e-107
1.78623e-107
-2.38104e-104
-1.25979e-109
-2.65941e-102
-3.14818e-106
-1.74204e-100
-3.05432e-104
-7.06202e-99
-4.04277e-102
-3.59031e-97
-3.49575e-100
-6.72697e-95
-3.59574e-98
-6.98158e-93
-2.74901e-96
-6.51112e-91
-2.28079e-94
-5.29862e-89
-1.76912e-92
-3.00047e-87
-9.55328e-91
-1.82173e-85
-5.413e-89
-1.51056e-83
-2.24455e-87
-5.43154e-82
-7.43902e-86
-9.28706e-81
-3.27402e-84
-2.63077e-79
-1.56589e-82
-1.01451e-77
-4.94083e-81
-3.78346e-76
-1.04521e-79
-1.31873e-74
-1.1429e-78
-7.20928e-74
-2.8845e-78
-4.30934e-76
-1.21479e-80
-1.18208e-75
-3.38458e-78
-1.16248e-72
-1.02002e-75
-3.16398e-70
-2.86297e-73
-7.41748e-68
-7.45235e-71
-1.58938e-65
-1.79781e-68
-3.13768e-63
-4.01872e-66
-5.73745e-61
-8.32396e-64
-9.72591e-59
-1.59785e-61
-1.52948e-56
-2.84328e-59
-2.23285e-54
-4.69187e-57
-3.02827e-52
-7.18332e-55
-3.81855e-50
-1.02096e-52
-4.4807e-48
-1.34802e-50
-4.89709e-46
-1.65467e-48
-4.99e-44
-1.88984e-46
-4.74544e-42
-2.01013e-44
-4.2168e-40
-1.993e-42
-3.51799e-38
-1.84424e-40
-3.96295e-36
-1.65712e-38
-2.86721e-34
-1.78997e-36
-9.04681e-35
1.13636e-110
2.25936e-114
4.51244e-109
7.23389e-113
3.89216e-109
6.42898e-112
-3.41406e-111
6.10368e-111
-1.26288e-109
-1.03056e-115
-8.99766e-108
-2.68703e-112
-1.38218e-105
-4.78682e-110
-1.43305e-103
-4.6792e-108
-1.69746e-101
-4.33306e-106
-1.53515e-99
-4.96473e-104
-1.35858e-97
-4.64754e-102
-1.42214e-95
-4.74942e-100
-9.48119e-94
-4.17198e-98
-6.65862e-92
-1.89726e-96
-3.84007e-90
-9.51819e-95
-1.3371e-88
-6.63593e-93
-5.2561e-87
-4.29087e-91
-3.26051e-85
-1.80367e-89
-1.64843e-83
-5.25699e-88
-6.47649e-82
-1.60896e-86
-2.52874e-80
-1.14242e-85
-1.61626e-79
-1.11612e-85
-7.38831e-82
-6.24016e-87
-1.53826e-81
-1.73218e-84
-2.94067e-78
-6.68096e-82
-9.68095e-76
-2.41034e-79
-2.7642e-73
-8.06274e-77
-7.24847e-71
-2.49765e-74
-1.75624e-68
-7.16173e-72
-3.93812e-66
-1.90041e-69
-8.17771e-64
-4.66637e-67
-1.57321e-61
-1.06028e-64
-2.80494e-59
-2.22955e-62
-4.63705e-57
-4.33974e-60
-7.11173e-55
-7.82154e-58
-1.0125e-52
-1.3058e-55
-1.33912e-50
-2.02035e-53
-1.64659e-48
-2.89864e-51
-1.88399e-46
-3.85886e-49
-2.00771e-44
-4.77014e-47
-1.99478e-42
-5.47944e-45
-1.85067e-40
-5.85349e-43
-1.95943e-38
-5.83404e-41
-2.17574e-36
-6.76826e-39
-5.73232e-37
4.04219e-115
1.4348e-120
1.21215e-113
4.77593e-119
1.49554e-112
8.10196e-118
-2.85839e-117
6.7669e-117
-1.0476e-115
-4.27097e-129
-1.14608e-113
-5.11962e-126
-1.56453e-111
-6.06065e-123
-1.42684e-109
-9.2386e-120
-1.72917e-107
-1.33682e-116
-1.82097e-105
-3.11593e-113
-2.05924e-103
-1.23095e-110
-3.04255e-101
-1.98555e-108
-1.85509e-99
-2.98117e-106
-8.21044e-98
-3.80288e-104
-5.36563e-96
-2.35764e-102
-4.90194e-94
-1.64062e-100
-3.25851e-92
-1.26993e-98
-1.1762e-90
-5.18895e-97
-9.90547e-89
-8.49899e-96
-4.64173e-87
-2.93775e-95
-4.99355e-87
-1.21217e-95
-3.39041e-88
-2.42041e-94
-5.09366e-88
-1.03302e-91
-1.41144e-84
-5.44037e-89
-6.45396e-82
-2.67052e-86
-2.37737e-79
-1.21513e-83
-7.99941e-77
-5.11849e-81
-2.48345e-74
-1.99462e-78
-7.12899e-72
-7.18744e-76
-1.89315e-69
-2.39405e-73
-4.65135e-67
-7.36922e-71
-1.05744e-64
-2.09584e-68
-2.22473e-62
-5.50672e-66
-4.3326e-60
-1.33664e-63
-7.81285e-58
-2.99735e-61
-1.30509e-55
-6.21029e-59
-2.02051e-53
-1.1891e-56
-2.90087e-51
-2.10455e-54
-3.86487e-49
-3.44405e-52
-4.78188e-47
-5.21308e-50
-5.49875e-45
-7.30113e-48
-5.88178e-43
-9.46476e-46
-5.88952e-41
-1.1362e-43
-8.96056e-39
-1.29772e-41
-1.85737e-39
1.01421e-120
7.8056e-127
2.35397e-119
7.65256e-126
1.96629e-118
5.27624e-125
-7.90634e-131
4.87393e-125
-4.35362e-129
-1.63671e-144
-5.12397e-126
-3.58624e-141
-6.06577e-123
-8.3062e-139
-9.24337e-120
-1.05882e-134
-1.04672e-116
-7.06878e-133
-1.68974e-114
-4.92966e-134
-4.26167e-112
-3.76318e-132
-7.70509e-110
-6.09038e-129
-1.73371e-107
-9.59715e-126
-1.46099e-105
-1.42301e-122
-9.79345e-104
-1.97063e-119
-1.11425e-101
-2.42435e-116
-1.10298e-99
-3.66613e-115
-7.56544e-98
-1.98992e-111
-8.87145e-97
-8.68298e-109
-3.9632e-97
-8.41464e-106
-1.11574e-96
-7.70023e-103
-1.58884e-95
-6.54681e-100
-9.1189e-92
-5.16693e-97
-5.31648e-89
-3.78175e-94
-2.65389e-86
-2.56462e-91
-1.21271e-83
-1.61017e-88
-5.11473e-81
-9.35236e-86
-1.99406e-78
-5.02203e-83
-7.187e-76
-2.49165e-80
-2.39422e-73
-1.14159e-77
-7.37042e-71
-4.82767e-75
-2.09634e-68
-1.88359e-72
-5.50844e-66
-6.77781e-70
-1.33716e-63
-2.24853e-67
-2.99879e-61
-6.87524e-65
-6.21401e-59
-1.93707e-62
-1.19001e-56
-5.02779e-60
-2.10669e-54
-1.20198e-57
-3.44883e-52
-2.64627e-55
-5.2232e-50
-5.36425e-53
-7.32136e-48
-1.001e-50
-9.50264e-46
-1.71908e-48
-1.14295e-43
-2.71605e-46
-1.48517e-41
-3.94697e-44
-5.64588e-42
3.98104e-127
8.36051e-138
2.30587e-126
6.23918e-138
1.68645e-126
5.24853e-137
-7.6247e-146
3.52263e-136
-4.74678e-145
-5.63261e-150
-5.16416e-141
-1.09711e-146
-1.87395e-140
-2.59643e-143
-1.18341e-134
-6.82159e-140
-1.01035e-135
-3.51135e-136
-2.66498e-135
-4.45806e-134
-3.65277e-132
-1.1162e-133
-6.09403e-129
-8.48756e-136
-9.60324e-126
-4.12521e-137
-1.42397e-122
-9.75404e-134
-1.97205e-119
-2.2e-130
-2.42632e-116
-4.63112e-127
-3.90876e-115
-4.64835e-124
-1.99032e-111
-1.22376e-120
-8.70288e-109
-1.50458e-117
-8.42294e-106
-2.41854e-114
-7.70813e-103
-3.64945e-111
-6.55407e-100
-5.1203e-108
-5.17315e-97
-6.67165e-105
-3.78671e-94
-8.06402e-102
-2.56831e-91
-9.03231e-99
-1.6127e-88
-9.36604e-96
-9.3683e-86
-8.98323e-93
-5.03129e-83
-7.96278e-90
-2.49662e-80
-6.51792e-87
-1.14405e-77
-4.92309e-84
-4.83893e-75
-3.42875e-81
-1.88834e-72
-2.20036e-78
-6.79627e-70
-1.30019e-75
-2.25515e-67
-7.06925e-73
-6.89709e-65
-3.53416e-70
-1.94371e-62
-1.62342e-67
-5.04638e-60
-6.84671e-65
-1.20678e-57
-2.6491e-62
-2.65764e-55
-9.39531e-60
-5.38908e-53
-3.05152e-57
-1.006e-50
-9.06674e-55
-1.7284e-48
-2.46135e-52
-2.73218e-46
-6.09573e-50
-3.9751e-44
-1.37465e-47
-2.83136e-45
5.87749e-139
-3.61973e-154
3.03845e-138
-9.21391e-154
1.40319e-137
-5.65855e-153
-1.61405e-151
-1.57938e-152
-5.62037e-150
-1.71145e-151
-1.07044e-146
-2.5956e-148
-2.46677e-143
-1.29044e-144
-6.03368e-140
-7.82039e-141
-2.68444e-136
-9.68549e-137
-1.637e-135
-4.05335e-134
-2.24975e-137
-1.04366e-133
-1.82507e-139
-7.1456e-136
-3.83533e-137
-1.51652e-138
-9.70673e-134
-4.85677e-136
-2.16839e-130
-3.20218e-132
-4.43387e-127
-1.98237e-128
-3.02338e-124
-7.62259e-125
-1.21737e-120
-6.19875e-123
-1.5058e-117
-9.24808e-133
-2.42005e-114
-6.24754e-129
-3.65187e-111
-7.0123e-126
-5.12396e-108
-1.96818e-123
-6.67678e-105
-8.51758e-122
-8.07069e-102
-3.01698e-118
-9.04038e-99
-1.00908e-114
-9.37508e-96
-3.20225e-111
-8.99261e-93
-9.11118e-108
-7.97177e-90
-1.23054e-104
-6.52589e-87
-1.66054e-101
-4.92961e-84
-4.25054e-98
-3.43367e-81
-2.36085e-95
-2.20379e-78
-1.34852e-92
-1.30239e-75
-8.56616e-89
-7.08228e-73
-9.6269e-86
-3.54124e-70
-1.4755e-82
-1.62696e-67
-1.91601e-79
-6.86298e-65
-2.38244e-76
-2.65596e-62
-2.69449e-73
-9.42187e-60
-2.78566e-70
-3.06094e-57
-2.61951e-67
-9.09735e-55
-2.23456e-64
-2.47045e-52
-1.72458e-61
-6.12043e-50
-1.19978e-58
-1.38077e-47
-7.49042e-56
-4.18548e-53
-1.45549e-154
-3.29879e-154
-4.83252e-154
-6.06852e-154
-1.69708e-151
-2.5973e-148
-1.2907e-144
-7.81084e-141
-5.07126e-137
-4.36861e-136
-6.65188e-138
-4.34436e-141
-1.8796e-141
-4.85683e-136
-3.20271e-132
-1.98272e-128
-1.64902e-125
-3.09007e-136
-9.08984e-133
-6.24898e-129
-1.09749e-125
-2.17341e-125
-8.51974e-122
-3.01784e-118
-1.00938e-114
-3.20326e-111
-9.11439e-108
-1.23145e-104
-1.66177e-101
-4.25221e-98
-2.3651e-95
-1.35089e-92
-8.56752e-89
-9.63547e-86
-1.47646e-82
-1.91748e-79
-2.38436e-76
-2.69687e-73
-2.78836e-70
-2.6223e-67
-2.23718e-64
-1.72682e-61
-1.20151e-58
-7.50244e-56
)
;
boundaryField
{
leftWall
{
type calculated;
value uniform 0;
}
rightWall
{
type calculated;
value nonuniform 0();
}
lowerWall
{
type calculated;
value nonuniform 0();
}
atmosphere
{
type calculated;
value uniform 0;
}
defaultFaces
{
type empty;
value nonuniform 0();
}
procBoundary2to0
{
type processor;
value nonuniform List<scalar>
46
(
-3.26283e-20
-2.75707e-20
-2.07459e-20
-1.40237e-20
-8.60986e-21
-4.8613e-21
-2.55673e-21
-1.26772e-21
-5.98963e-22
-2.7206e-22
-1.19511e-22
-5.02507e-23
-1.62768e-23
1.14159e-23
1.35639e-22
8.10797e-22
4.41049e-21
2.36001e-20
1.28139e-19
6.82151e-19
3.35505e-18
1.4512e-17
5.44651e-17
1.77421e-16
4.76517e-16
-1.06297e-27
-6.59024e-27
-3.22688e-26
-1.22665e-25
-4.26717e-25
-1.42159e-24
-4.2718e-24
-1.10403e-23
-2.46616e-23
-5.0014e-23
-9.90033e-23
-2.03854e-22
-4.39094e-22
-9.3329e-22
-1.83237e-21
-3.20852e-21
-4.9434e-21
-6.6662e-21
-7.85335e-21
8.88492e-21
-8.07995e-21
)
;
}
procBoundary2to3
{
type processor;
value nonuniform List<scalar>
43
(
1.14745e-15
1.66104e-15
2.26826e-15
3.04105e-15
4.08003e-15
5.36986e-15
6.58882e-15
7.27167e-15
7.17686e-15
6.39583e-15
4.80536e-15
2.79294e-15
1.49821e-15
6.96181e-16
2.1475e-16
-8.20496e-17
-2.95401e-16
-4.52856e-16
-5.39333e-16
-5.2396e-16
-4.02039e-16
-2.24948e-16
-8.63206e-17
-2.30005e-17
-4.95715e-18
-7.75034e-19
-1.28129e-19
-1.57299e-20
-1.73562e-21
-1.63241e-22
-1.22928e-23
-7.25491e-25
-3.37521e-26
-1.22593e-27
-3.4063e-29
-7.05592e-31
-1.05337e-32
-1.07434e-34
-6.83196e-37
-2.09458e-39
-8.20989e-42
-2.88652e-45
-4.46547e-53
)
;
}
}
// ************************************************************************* //
| [
"fang.liu@oit.gatech.edu"
] | fang.liu@oit.gatech.edu | |
5d25ae0c9c2a4107ec386d9dd66f9c12311cee08 | b28305dab0be0e03765c62b97bcd7f49a4f8073d | /ui/keyboard/keyboard_controller_unittest.cc | aed5e65c34f6ce97a204dea1de2a0f14e19861e5 | [
"BSD-3-Clause"
] | permissive | svarvel/browser-android-tabs | 9e5e27e0a6e302a12fe784ca06123e5ce090ced5 | bd198b4c7a1aca2f3e91f33005d881f42a8d0c3f | refs/heads/base-72.0.3626.105 | 2020-04-24T12:16:31.442851 | 2019-08-02T19:15:36 | 2019-08-02T19:15:36 | 171,950,555 | 1 | 2 | NOASSERTION | 2019-08-02T19:15:37 | 2019-02-21T21:47:44 | null | UTF-8 | C++ | false | false | 30,248 | cc | // Copyright (c) 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 "ui/keyboard/keyboard_controller.h"
#include <memory>
#include "base/command_line.h"
#include "base/macros.h"
#include "base/run_loop.h"
#include "base/test/scoped_task_environment.h"
#include "build/build_config.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/aura/client/focus_client.h"
#include "ui/aura/test/aura_test_base.h"
#include "ui/aura/test/test_window_delegate.h"
#include "ui/aura/window.h"
#include "ui/base/ime/dummy_text_input_client.h"
#include "ui/base/ime/input_method.h"
#include "ui/base/ime/input_method_factory.h"
#include "ui/base/ime/text_input_client.h"
#include "ui/base/ui_base_switches.h"
#include "ui/compositor/compositor.h"
#include "ui/compositor/layer_type.h"
#include "ui/compositor/scoped_animation_duration_scale_mode.h"
#include "ui/compositor/test/context_factories_for_test.h"
#include "ui/compositor/test/layer_animator_test_controller.h"
#include "ui/events/test/event_generator.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/keyboard/container_full_width_behavior.h"
#include "ui/keyboard/keyboard_controller_observer.h"
#include "ui/keyboard/keyboard_layout_manager.h"
#include "ui/keyboard/keyboard_ui.h"
#include "ui/keyboard/keyboard_util.h"
#include "ui/keyboard/test/keyboard_test_util.h"
#include "ui/wm/core/default_activation_client.h"
#if defined(USE_OZONE)
#include "ui/ozone/public/ozone_platform.h"
#endif
namespace keyboard {
namespace {
// Steps a layer animation until it is completed. Animations must be enabled.
void RunAnimationForLayer(ui::Layer* layer) {
// Animations must be enabled for stepping to work.
ASSERT_NE(ui::ScopedAnimationDurationScaleMode::duration_scale_mode(),
ui::ScopedAnimationDurationScaleMode::ZERO_DURATION);
ui::LayerAnimatorTestController controller(layer->GetAnimator());
// Multiple steps are required to complete complex animations.
// TODO(vollick): This should not be necessary. crbug.com/154017
while (controller.animator()->is_animating()) {
controller.StartThreadedAnimationsIfNeeded();
base::TimeTicks step_time = controller.animator()->last_step_time();
controller.animator()->Step(step_time +
base::TimeDelta::FromMilliseconds(1000));
}
}
// An event handler that focuses a window when it is clicked/touched on. This is
// used to match the focus manger behaviour in ash and views.
class TestFocusController : public ui::EventHandler {
public:
explicit TestFocusController(aura::Window* root)
: root_(root) {
root_->AddPreTargetHandler(this);
}
~TestFocusController() override { root_->RemovePreTargetHandler(this); }
private:
// Overridden from ui::EventHandler:
void OnEvent(ui::Event* event) override {
aura::Window* target = static_cast<aura::Window*>(event->target());
if (event->type() == ui::ET_MOUSE_PRESSED ||
event->type() == ui::ET_TOUCH_PRESSED) {
aura::client::GetFocusClient(target)->FocusWindow(target);
}
}
aura::Window* root_;
DISALLOW_COPY_AND_ASSIGN(TestFocusController);
};
class KeyboardContainerObserver : public aura::WindowObserver {
public:
explicit KeyboardContainerObserver(aura::Window* window,
base::RunLoop* run_loop)
: window_(window), run_loop_(run_loop) {
window_->AddObserver(this);
}
~KeyboardContainerObserver() override { window_->RemoveObserver(this); }
private:
void OnWindowVisibilityChanged(aura::Window* window, bool visible) override {
if (!visible)
run_loop_->QuitWhenIdle();
}
aura::Window* window_;
base::RunLoop* const run_loop_;
DISALLOW_COPY_AND_ASSIGN(KeyboardContainerObserver);
};
class TestKeyboardLayoutDelegate : public KeyboardLayoutDelegate {
public:
TestKeyboardLayoutDelegate() {}
~TestKeyboardLayoutDelegate() override {}
// Overridden from keyboard::KeyboardLayoutDelegate
void MoveKeyboardToDisplay(const display::Display& display) override {}
void MoveKeyboardToTouchableDisplay() override {}
private:
DISALLOW_COPY_AND_ASSIGN(TestKeyboardLayoutDelegate);
};
class SetModeCallbackInvocationCounter {
public:
SetModeCallbackInvocationCounter() : weak_factory_invoke_(this) {}
void Invoke(bool status) {
if (status)
invocation_count_success_++;
else
invocation_count_failure_++;
}
base::OnceCallback<void(bool)> GetInvocationCallback() {
return base::BindOnce(&SetModeCallbackInvocationCounter::Invoke,
weak_factory_invoke_.GetWeakPtr());
}
int invocation_count_for_status(bool status) {
return status ? invocation_count_success_ : invocation_count_failure_;
}
private:
int invocation_count_success_ = 0;
int invocation_count_failure_ = 0;
base::WeakPtrFactory<SetModeCallbackInvocationCounter> weak_factory_invoke_;
};
} // namespace
class KeyboardControllerTest : public aura::test::AuraTestBase,
public KeyboardControllerObserver {
public:
KeyboardControllerTest()
: visible_bounds_number_of_calls_(0),
occluding_bounds_number_of_calls_(0),
is_visible_number_of_calls_(0),
is_visible_(false),
keyboard_disabled_(false) {}
~KeyboardControllerTest() override {}
void SetUp() override {
ui::SetUpInputMethodFactoryForTesting();
aura::test::AuraTestBase::SetUp();
new wm::DefaultActivationClient(root_window());
focus_controller_.reset(new TestFocusController(root_window()));
layout_delegate_.reset(new TestKeyboardLayoutDelegate());
// Force enable the virtual keyboard.
keyboard::SetTouchKeyboardEnabled(true);
controller_.EnableKeyboard(
std::make_unique<TestKeyboardUI>(host()->GetInputMethod()),
layout_delegate_.get());
controller_.ActivateKeyboardInContainer(root_window());
controller_.AddObserver(this);
}
void TearDown() override {
keyboard::SetTouchKeyboardEnabled(false);
controller_.RemoveObserver(this);
controller_.DisableKeyboard();
focus_controller_.reset();
aura::test::AuraTestBase::TearDown();
}
KeyboardController& controller() { return controller_; }
KeyboardLayoutDelegate* layout_delegate() { return layout_delegate_.get(); }
void ShowKeyboard() {
test_text_input_client_.reset(
new ui::DummyTextInputClient(ui::TEXT_INPUT_TYPE_TEXT));
SetFocus(test_text_input_client_.get());
}
void MockRotateScreen() {
const gfx::Rect root_bounds = root_window()->bounds();
root_window()->SetBounds(
gfx::Rect(0, 0, root_bounds.height(), root_bounds.width()));
}
protected:
// KeyboardControllerObserver overrides
void OnKeyboardVisibleBoundsChanged(const gfx::Rect& new_bounds) override {
visible_bounds_ = new_bounds;
visible_bounds_number_of_calls_++;
}
void OnKeyboardWorkspaceOccludedBoundsChanged(
const gfx::Rect& new_bounds) override {
occluding_bounds_ = new_bounds;
occluding_bounds_number_of_calls_++;
}
void OnKeyboardVisibilityStateChanged(bool is_visible) override {
is_visible_ = is_visible;
is_visible_number_of_calls_++;
}
void OnKeyboardEnabledChanged(bool is_enabled) override {
keyboard_disabled_ = !is_enabled;
}
void ClearKeyboardDisabled() { keyboard_disabled_ = false; }
int visible_bounds_number_of_calls() const {
return visible_bounds_number_of_calls_;
}
int occluding_bounds_number_of_calls() const {
return occluding_bounds_number_of_calls_;
}
int is_visible_number_of_calls() const { return is_visible_number_of_calls_; }
const gfx::Rect& notified_visible_bounds() { return visible_bounds_; }
const gfx::Rect& notified_occluding_bounds() { return occluding_bounds_; }
bool notified_is_visible() { return is_visible_; }
bool IsKeyboardDisabled() { return keyboard_disabled_; }
void SetProgrammaticFocus(ui::TextInputClient* client) {
controller_.OnTextInputStateChanged(client);
}
void AddTimeToTransientBlurCounter(double seconds) {
controller_.time_of_last_blur_ -=
base::TimeDelta::FromMilliseconds((int)(1000 * seconds));
}
void SetFocus(ui::TextInputClient* client) {
ui::InputMethod* input_method = controller().GetInputMethodForTest();
input_method->SetFocusedTextInputClient(client);
if (client && client->GetTextInputType() != ui::TEXT_INPUT_TYPE_NONE &&
client->GetTextInputMode() != ui::TEXT_INPUT_MODE_NONE) {
input_method->ShowVirtualKeyboardIfEnabled();
ASSERT_TRUE(keyboard::WaitUntilShown());
}
}
bool WillHideKeyboard() { return controller_.WillHideKeyboard(); }
bool ShouldEnableInsets(aura::Window* window) {
aura::Window* contents_window = controller().GetKeyboardWindow();
return (contents_window->GetRootWindow() == window->GetRootWindow() &&
controller_.IsKeyboardOverscrollEnabled() &&
contents_window->IsVisible() && controller_.IsKeyboardVisible());
}
void RunLoop(base::RunLoop* run_loop) {
#if defined(USE_OZONE)
// TODO(crbug/776357): Figure out why the initializer randomly doesn't run
// for some tests. In the mean time, prevent flaky Ozone crash.
ui::OzonePlatform::InitializeForGPU(ui::OzonePlatform::InitParams());
#endif
run_loop->Run();
}
std::unique_ptr<TestFocusController> focus_controller_;
private:
int visible_bounds_number_of_calls_;
gfx::Rect visible_bounds_;
int occluding_bounds_number_of_calls_;
gfx::Rect occluding_bounds_;
int is_visible_number_of_calls_;
bool is_visible_;
KeyboardController controller_;
std::unique_ptr<KeyboardLayoutDelegate> layout_delegate_;
std::unique_ptr<ui::TextInputClient> test_text_input_client_;
bool keyboard_disabled_;
DISALLOW_COPY_AND_ASSIGN(KeyboardControllerTest);
};
// TODO(https://crbug.com/849995): This is testing KeyboardLayoutManager /
// ContainerFullWidthBehavior. Put this test there.
TEST_F(KeyboardControllerTest, KeyboardSize) {
root_window()->SetLayoutManager(new KeyboardLayoutManager(&controller()));
controller().LoadKeyboardWindowInBackground();
// The keyboard window should not be visible.
aura::Window* keyboard_window = controller().GetKeyboardWindow();
EXPECT_FALSE(keyboard_window->IsVisible());
const gfx::Rect screen_bounds = root_window()->bounds();
// Attempt to change window width or move window up from the bottom are
// ignored. Changing window height is supported.
gfx::Rect expected_keyboard_bounds(0, screen_bounds.height() - 50,
screen_bounds.width(), 50);
// The x position of new bounds may not be 0 if shelf is on the left side of
// screen. The virtual keyboard should always align with the left edge of
// screen. See http://crbug.com/510595.
gfx::Rect new_bounds(10, 0, 50, 50);
keyboard_window->SetBounds(new_bounds);
EXPECT_EQ(expected_keyboard_bounds, keyboard_window->bounds());
MockRotateScreen();
// The above call should resize keyboard to new width while keeping the old
// height.
EXPECT_EQ(
gfx::Rect(0, screen_bounds.width() - 50, screen_bounds.height(), 50),
keyboard_window->bounds());
}
// Tests that blur-then-focus that occur in less than the transient threshold
// cause the keyboard to re-show.
TEST_F(KeyboardControllerTest, TransientBlurShortDelay) {
ui::DummyTextInputClient input_client(ui::TEXT_INPUT_TYPE_TEXT);
ui::DummyTextInputClient no_input_client(ui::TEXT_INPUT_TYPE_NONE);
base::RunLoop run_loop;
controller().LoadKeyboardWindowInBackground();
aura::Window* keyboard_window = controller().GetKeyboardWindow();
auto keyboard_container_observer =
std::make_unique<KeyboardContainerObserver>(keyboard_window, &run_loop);
// Keyboard is hidden
EXPECT_FALSE(keyboard_window->IsVisible());
// Set programmatic focus to the text field. Nothing happens
SetProgrammaticFocus(&input_client);
EXPECT_FALSE(keyboard_window->IsVisible());
// Click it for real. Keyboard starts to appear.
SetFocus(&input_client);
EXPECT_TRUE(keyboard_window->IsVisible());
// Focus a non text field
SetFocus(&no_input_client);
// It waits 100 ms and then hides. Wait for this routine to finish.
EXPECT_TRUE(WillHideKeyboard());
RunLoop(&run_loop);
EXPECT_FALSE(keyboard_window->IsVisible());
// Virtually wait half a second
AddTimeToTransientBlurCounter(0.5);
// Apply programmatic focus to the text field.
SetProgrammaticFocus(&input_client);
// TODO(blakeo): this is not technically wrong, but the DummyTextInputClient
// should allow for overriding the text input flags, to simulate testing
// a web-based text field.
EXPECT_FALSE(keyboard_window->IsVisible());
EXPECT_FALSE(WillHideKeyboard());
}
// Tests that blur-then-focus that occur past the transient threshold do not
// cause the keyboard to re-show.
TEST_F(KeyboardControllerTest, TransientBlurLongDelay) {
ui::DummyTextInputClient input_client(ui::TEXT_INPUT_TYPE_TEXT);
ui::DummyTextInputClient no_input_client(ui::TEXT_INPUT_TYPE_NONE);
base::RunLoop run_loop;
controller().LoadKeyboardWindowInBackground();
aura::Window* keyboard_window = controller().GetKeyboardWindow();
auto keyboard_container_observer =
std::make_unique<KeyboardContainerObserver>(keyboard_window, &run_loop);
// Keyboard is hidden
EXPECT_FALSE(keyboard_window->IsVisible());
// Set programmatic focus to the text field. Nothing happens
SetProgrammaticFocus(&input_client);
EXPECT_FALSE(keyboard_window->IsVisible());
// Click it for real. Keyboard starts to appear.
SetFocus(&input_client);
EXPECT_TRUE(keyboard_window->IsVisible());
// Focus a non text field
SetFocus(&no_input_client);
// It waits 100 ms and then hides. Wait for this routine to finish.
EXPECT_TRUE(WillHideKeyboard());
RunLoop(&run_loop);
EXPECT_FALSE(keyboard_window->IsVisible());
// Wait 5 seconds and then set programmatic focus to a text field
AddTimeToTransientBlurCounter(5.0);
SetProgrammaticFocus(&input_client);
EXPECT_FALSE(keyboard_window->IsVisible());
}
TEST_F(KeyboardControllerTest, VisibilityChangeWithTextInputTypeChange) {
ui::DummyTextInputClient input_client_0(ui::TEXT_INPUT_TYPE_TEXT);
ui::DummyTextInputClient input_client_1(ui::TEXT_INPUT_TYPE_TEXT);
ui::DummyTextInputClient input_client_2(ui::TEXT_INPUT_TYPE_TEXT);
ui::DummyTextInputClient no_input_client_0(ui::TEXT_INPUT_TYPE_NONE);
ui::DummyTextInputClient no_input_client_1(ui::TEXT_INPUT_TYPE_NONE);
base::RunLoop run_loop;
controller().LoadKeyboardWindowInBackground();
aura::Window* keyboard_window = controller().GetKeyboardWindow();
auto keyboard_container_observer =
std::make_unique<KeyboardContainerObserver>(keyboard_window, &run_loop);
SetFocus(&input_client_0);
EXPECT_TRUE(keyboard_window->IsVisible());
SetFocus(&no_input_client_0);
// Keyboard should not immediately hide itself. It is delayed to avoid layout
// flicker when the focus of input field quickly change.
EXPECT_TRUE(keyboard_window->IsVisible());
EXPECT_TRUE(WillHideKeyboard());
// Wait for hide keyboard to finish.
RunLoop(&run_loop);
EXPECT_FALSE(keyboard_window->IsVisible());
SetFocus(&input_client_1);
EXPECT_TRUE(keyboard_window->IsVisible());
// Schedule to hide keyboard.
SetFocus(&no_input_client_1);
EXPECT_TRUE(WillHideKeyboard());
// Cancel keyboard hide.
SetFocus(&input_client_2);
EXPECT_FALSE(WillHideKeyboard());
EXPECT_TRUE(keyboard_window->IsVisible());
}
// Test to prevent spurious overscroll boxes when changing tabs during keyboard
// hide. Refer to crbug.com/401670 for more context.
TEST_F(KeyboardControllerTest, CheckOverscrollInsetDuringVisibilityChange) {
ui::DummyTextInputClient input_client(ui::TEXT_INPUT_TYPE_TEXT);
ui::DummyTextInputClient no_input_client(ui::TEXT_INPUT_TYPE_NONE);
// Enable touch keyboard / overscroll mode to test insets.
EXPECT_TRUE(controller().IsKeyboardOverscrollEnabled());
SetFocus(&input_client);
SetFocus(&no_input_client);
// Insets should not be enabled for new windows while keyboard is in the
// process of hiding when overscroll is enabled.
EXPECT_FALSE(ShouldEnableInsets(controller().GetKeyboardWindow()));
// Cancel keyboard hide.
SetFocus(&input_client);
// Insets should be enabled for new windows as hide was cancelled.
EXPECT_TRUE(ShouldEnableInsets(controller().GetKeyboardWindow()));
}
TEST_F(KeyboardControllerTest, AlwaysVisibleWhenLocked) {
ui::DummyTextInputClient input_client_0(ui::TEXT_INPUT_TYPE_TEXT);
ui::DummyTextInputClient input_client_1(ui::TEXT_INPUT_TYPE_TEXT);
ui::DummyTextInputClient no_input_client_0(ui::TEXT_INPUT_TYPE_NONE);
ui::DummyTextInputClient no_input_client_1(ui::TEXT_INPUT_TYPE_NONE);
base::RunLoop run_loop;
controller().LoadKeyboardWindowInBackground();
aura::Window* keyboard_window = controller().GetKeyboardWindow();
auto keyboard_container_observer =
std::make_unique<KeyboardContainerObserver>(keyboard_window, &run_loop);
SetFocus(&input_client_0);
EXPECT_TRUE(keyboard_window->IsVisible());
// Lock keyboard.
controller().set_keyboard_locked(true);
SetFocus(&no_input_client_0);
// Keyboard should not try to hide itself as it is locked.
EXPECT_TRUE(keyboard_window->IsVisible());
EXPECT_FALSE(WillHideKeyboard());
// Implicit hiding will not do anything when the keyboard is locked.
controller().HideKeyboardImplicitlyBySystem();
EXPECT_TRUE(keyboard_window->IsVisible());
EXPECT_FALSE(WillHideKeyboard());
SetFocus(&input_client_1);
EXPECT_TRUE(keyboard_window->IsVisible());
// Unlock keyboard.
controller().set_keyboard_locked(false);
// Keyboard should hide when focus on no input client.
SetFocus(&no_input_client_1);
EXPECT_TRUE(WillHideKeyboard());
// Wait for hide keyboard to finish.
RunLoop(&run_loop);
EXPECT_FALSE(keyboard_window->IsVisible());
}
// Tests that disabling the keyboard will get a corresponding event.
TEST_F(KeyboardControllerTest, DisableKeyboard) {
controller().LoadKeyboardWindowInBackground();
aura::Window* keyboard_window = controller().GetKeyboardWindow();
ShowKeyboard();
EXPECT_TRUE(keyboard_window->IsVisible());
EXPECT_FALSE(IsKeyboardDisabled());
controller().DisableKeyboard();
EXPECT_TRUE(IsKeyboardDisabled());
}
TEST_F(KeyboardControllerTest, SetOccludedBoundsChangesFullscreenBounds) {
controller().LoadKeyboardWindowInBackground();
// Keyboard is hidden, so SetContainerType should be synchronous.
controller().SetContainerType(mojom::ContainerType::kFullscreen,
base::nullopt, base::DoNothing());
// KeyboardController only notifies occluded bound changes when the keyboard
// is visible.
ShowKeyboard();
const gfx::Rect test_occluded_bounds(0, 10, 20, 30);
// Expect that setting the occluded bounds raises
// OnKeyboardWorkspaceOccludedBoundsChanged event.
struct MockObserver : public KeyboardControllerObserver {
MOCK_METHOD1(OnKeyboardWorkspaceOccludedBoundsChanged,
void(const gfx::Rect& new_bounds));
} observer;
EXPECT_CALL(observer,
OnKeyboardWorkspaceOccludedBoundsChanged(test_occluded_bounds));
controller().AddObserver(&observer);
controller().SetOccludedBounds(test_occluded_bounds);
controller().RemoveObserver(&observer);
}
class KeyboardControllerAnimationTest : public KeyboardControllerTest {
public:
KeyboardControllerAnimationTest() {}
~KeyboardControllerAnimationTest() override {}
void SetUp() override {
// We cannot short-circuit animations for this test.
ui::ScopedAnimationDurationScaleMode test_duration_mode(
ui::ScopedAnimationDurationScaleMode::NON_ZERO_DURATION);
KeyboardControllerTest::SetUp();
// Preload the keyboard contents so that we can set its bounds.
controller().LoadKeyboardWindowInBackground();
// Wait for the keyboard contents to load.
base::RunLoop().RunUntilIdle();
keyboard_window()->SetBounds(root_window()->bounds());
}
void TearDown() override {
KeyboardControllerTest::TearDown();
}
protected:
aura::Window* keyboard_window() { return controller().GetKeyboardWindow(); }
private:
DISALLOW_COPY_AND_ASSIGN(KeyboardControllerAnimationTest);
};
TEST_F(KeyboardControllerAnimationTest, ContainerAnimation) {
ui::Layer* layer = keyboard_window()->layer();
ShowKeyboard();
// Keyboard container and window should immediately become visible before
// animation starts.
EXPECT_TRUE(keyboard_window()->IsVisible());
float show_start_opacity = layer->opacity();
gfx::Transform transform;
transform.Translate(0, keyboard::kFullWidthKeyboardAnimationDistance);
EXPECT_EQ(transform, layer->transform());
// Actual final bounds should be notified after animation finishes to avoid
// flash of background being seen.
EXPECT_EQ(gfx::Rect(), notified_visible_bounds());
EXPECT_EQ(gfx::Rect(), notified_occluding_bounds());
EXPECT_FALSE(notified_is_visible());
RunAnimationForLayer(layer);
EXPECT_TRUE(keyboard_window()->IsVisible());
float show_end_opacity = layer->opacity();
EXPECT_LT(show_start_opacity, show_end_opacity);
EXPECT_EQ(gfx::Transform(), layer->transform());
// KeyboardController should notify the bounds of container window to its
// observers after show animation finished.
EXPECT_EQ(keyboard_window()->bounds(), notified_visible_bounds());
EXPECT_EQ(keyboard_window()->bounds(), notified_occluding_bounds());
EXPECT_TRUE(notified_is_visible());
// Directly hide keyboard without delay.
float hide_start_opacity = layer->opacity();
controller().HideKeyboardExplicitlyBySystem();
EXPECT_FALSE(keyboard_window()->IsVisible());
EXPECT_FALSE(keyboard_window()->layer()->visible());
layer = keyboard_window()->layer();
// KeyboardController should notify the bounds of keyboard window to its
// observers before hide animation starts.
EXPECT_EQ(gfx::Rect(), notified_visible_bounds());
EXPECT_EQ(gfx::Rect(), notified_occluding_bounds());
EXPECT_FALSE(notified_is_visible());
RunAnimationForLayer(layer);
EXPECT_FALSE(keyboard_window()->IsVisible());
EXPECT_FALSE(keyboard_window()->layer()->visible());
float hide_end_opacity = layer->opacity();
EXPECT_GT(hide_start_opacity, hide_end_opacity);
EXPECT_EQ(gfx::Rect(), notified_visible_bounds());
EXPECT_EQ(gfx::Rect(), notified_occluding_bounds());
EXPECT_FALSE(notified_is_visible());
SetModeCallbackInvocationCounter invocation_counter;
controller().SetContainerType(mojom::ContainerType::kFloating, base::nullopt,
invocation_counter.GetInvocationCallback());
EXPECT_EQ(1, invocation_counter.invocation_count_for_status(true));
EXPECT_EQ(0, invocation_counter.invocation_count_for_status(false));
ShowKeyboard();
RunAnimationForLayer(layer);
EXPECT_EQ(1, invocation_counter.invocation_count_for_status(true));
EXPECT_EQ(0, invocation_counter.invocation_count_for_status(false));
// Visible bounds and occluding bounds are now different.
EXPECT_EQ(keyboard_window()->bounds(), notified_visible_bounds());
EXPECT_EQ(gfx::Rect(), notified_occluding_bounds());
EXPECT_TRUE(notified_is_visible());
// callback should do nothing when container mode is set to the current active
// container type. An unnecessary call gets registered synchronously as a
// failure status to the callback.
controller().SetContainerType(mojom::ContainerType::kFloating, base::nullopt,
invocation_counter.GetInvocationCallback());
EXPECT_EQ(1, invocation_counter.invocation_count_for_status(true));
EXPECT_EQ(1, invocation_counter.invocation_count_for_status(false));
}
TEST_F(KeyboardControllerAnimationTest, ChangeContainerModeWithBounds) {
SetModeCallbackInvocationCounter invocation_counter;
ui::Layer* layer = keyboard_window()->layer();
ShowKeyboard();
RunAnimationForLayer(layer);
EXPECT_EQ(mojom::ContainerType::kFullWidth,
controller().GetActiveContainerType());
EXPECT_TRUE(keyboard_window()->IsVisible());
// Changing the mode to another mode invokes hiding + showing.
const gfx::Rect target_bounds(0, 0, 1200, 600);
controller().SetContainerType(mojom::ContainerType::kFloating,
base::make_optional(target_bounds),
invocation_counter.GetInvocationCallback());
// The container window shouldn't be resized until it's hidden even if the
// target bounds is passed to |SetContainerType|.
EXPECT_EQ(gfx::Rect(), notified_visible_bounds());
EXPECT_EQ(0, invocation_counter.invocation_count_for_status(true));
EXPECT_EQ(0, invocation_counter.invocation_count_for_status(false));
RunAnimationForLayer(layer);
// Hiding animation finished. The container window should be resized to the
// target bounds.
EXPECT_EQ(keyboard_window()->bounds().size(), target_bounds.size());
// Then showing animation automatically start.
layer = keyboard_window()->layer();
RunAnimationForLayer(layer);
EXPECT_EQ(1, invocation_counter.invocation_count_for_status(true));
EXPECT_EQ(0, invocation_counter.invocation_count_for_status(false));
}
// Show keyboard during keyboard hide animation should abort the hide animation
// and the keyboard should animate in.
// Test for crbug.com/333284.
TEST_F(KeyboardControllerAnimationTest, ContainerShowWhileHide) {
ui::Layer* layer = keyboard_window()->layer();
ShowKeyboard();
RunAnimationForLayer(layer);
controller().HideKeyboardExplicitlyBySystem();
// Before hide animation finishes, show keyboard again.
ShowKeyboard();
layer = keyboard_window()->layer();
RunAnimationForLayer(layer);
EXPECT_TRUE(keyboard_window()->IsVisible());
EXPECT_EQ(1.0, layer->opacity());
}
TEST_F(KeyboardControllerAnimationTest,
SetKeyboardWindowBoundsOnDeactivatedKeyboard) {
// Ensure keyboard ui is populated
ui::Layer* layer = keyboard_window()->layer();
ShowKeyboard();
RunAnimationForLayer(layer);
ASSERT_TRUE(keyboard_window());
controller().DeactivateKeyboard();
// lingering handle to the contents window is adjusted.
// container_window's LayoutManager should abort silently and not crash.
keyboard_window()->SetBounds(gfx::Rect());
}
TEST_F(KeyboardControllerTest, DisplayChangeShouldNotifyBoundsChange) {
ui::DummyTextInputClient input_client(ui::TEXT_INPUT_TYPE_TEXT);
SetFocus(&input_client);
gfx::Rect new_bounds(0, 0, 1280, 800);
ASSERT_NE(new_bounds, root_window()->bounds());
EXPECT_EQ(1, visible_bounds_number_of_calls());
EXPECT_EQ(1, occluding_bounds_number_of_calls());
EXPECT_EQ(1, is_visible_number_of_calls());
root_window()->SetBounds(new_bounds);
EXPECT_EQ(2, visible_bounds_number_of_calls());
EXPECT_EQ(2, occluding_bounds_number_of_calls());
EXPECT_EQ(1, is_visible_number_of_calls());
MockRotateScreen();
EXPECT_EQ(3, visible_bounds_number_of_calls());
EXPECT_EQ(3, occluding_bounds_number_of_calls());
EXPECT_EQ(1, is_visible_number_of_calls());
}
TEST_F(KeyboardControllerTest, TextInputMode) {
ui::DummyTextInputClient input_client(ui::TEXT_INPUT_TYPE_TEXT,
ui::TEXT_INPUT_MODE_TEXT);
ui::DummyTextInputClient no_input_client(ui::TEXT_INPUT_TYPE_TEXT,
ui::TEXT_INPUT_MODE_NONE);
base::RunLoop run_loop;
controller().LoadKeyboardWindowInBackground();
aura::Window* keyboard_window = controller().GetKeyboardWindow();
auto keyboard_container_observer =
std::make_unique<KeyboardContainerObserver>(keyboard_window, &run_loop);
SetFocus(&input_client);
EXPECT_TRUE(keyboard_window->IsVisible());
SetFocus(&no_input_client);
// Keyboard should not immediately hide itself. It is delayed to avoid layout
// flicker when the focus of input field quickly change.
EXPECT_TRUE(keyboard_window->IsVisible());
EXPECT_TRUE(WillHideKeyboard());
// Wait for hide keyboard to finish.
RunLoop(&run_loop);
EXPECT_FALSE(keyboard_window->IsVisible());
SetFocus(&input_client);
EXPECT_TRUE(keyboard_window->IsVisible());
}
// Checks that floating keyboard does not cause focused window to move upwards.
// Refer to crbug.com/838731.
TEST_F(KeyboardControllerAnimationTest, FloatingKeyboardEnsureCaretInWorkArea) {
// Mock TextInputClient to intercept calls to EnsureCaretNotInRect.
struct MockTextInputClient : public ui::DummyTextInputClient {
MockTextInputClient() : DummyTextInputClient(ui::TEXT_INPUT_TYPE_TEXT) {}
MOCK_METHOD1(EnsureCaretNotInRect, void(const gfx::Rect&));
};
// Floating keyboard should call EnsureCaretNotInRect with the empty rect.
MockTextInputClient mock_input_client;
EXPECT_CALL(mock_input_client, EnsureCaretNotInRect(gfx::Rect())).Times(1);
controller().SetContainerType(mojom::ContainerType::kFloating, base::nullopt,
base::DoNothing());
ASSERT_EQ(mojom::ContainerType::kFloating,
controller().GetActiveContainerType());
// Ensure keyboard ui is populated
ui::Layer* layer = keyboard_window()->layer();
SetFocus(&mock_input_client);
RunAnimationForLayer(layer);
EXPECT_TRUE(keyboard_window()->IsVisible());
// Unfocus from the MockTextInputClient before destroying it.
controller().GetInputMethodForTest()->DetachTextInputClient(
&mock_input_client);
}
// Checks DisableKeyboard() doesn't clear the observer list.
TEST_F(KeyboardControllerTest, DontClearObserverList) {
ShowKeyboard();
aura::Window* keyboard_window = controller().GetKeyboardWindow();
ShowKeyboard();
EXPECT_TRUE(keyboard_window->IsVisible());
EXPECT_FALSE(IsKeyboardDisabled());
controller().DisableKeyboard();
EXPECT_TRUE(IsKeyboardDisabled());
controller().EnableKeyboard(
std::make_unique<TestKeyboardUI>(host()->GetInputMethod()),
layout_delegate());
ClearKeyboardDisabled();
EXPECT_FALSE(IsKeyboardDisabled());
controller().DisableKeyboard();
EXPECT_TRUE(IsKeyboardDisabled());
}
} // namespace keyboard
| [
"artem@brave.com"
] | artem@brave.com |
9448e44ae802e1806ac1d90c15fa9a29cceed7c8 | 2d38f79140dfea29427879a423881b24baf73c37 | /graph.cpp | 0ead8b23d8dac04057be4da5572b79367adad008 | [] | no_license | miguelalcantar/shortestpath.graph | ad9c673021673d4cac65583dcb5d0e09eb11643a | fa332342e10643ee9b604dae34ca4b2f45f64942 | refs/heads/master | 2021-07-09T19:34:54.452247 | 2020-06-11T20:00:08 | 2020-06-11T20:00:08 | 136,969,912 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,087 | cpp | #include "graph.h"
using namespace std;
graph::graph(long s): n(s), m(0){
long max = n * (n - 1) / 2;
array = new bool[max];
for(long i = 0; i < max; i++) array[i] = false;
cout << "\n";
}
graph::~graph(){ delete [] array;}
void graph::swap(long &i, long &j){
long aux = i;
i = j;
j = aux;
}
long graph::f(long i, long j){
if(i < j) swap(i,j);
return (i - 1) * (i - 2) / 2 + j - 1;
}
bool graph::set(long i, long j){
if(!full() and i!=j and !array[f(i,j)]){
array[f(i,j)] = true;
m++;
return true;
}
cout << "Fail [set].\n";
return false;
}
void graph::unset(long i, long j){
if(empty() or i == j){
cout << "Fail unset.\n";
return;
}
array[f(i,j)] = 0;
m--;
}
bool graph::edge(long i, long j){
if(i != j) {
long aux = f(i,j);
return array[aux];
}
return false;
}
void graph::print(){
for(long i = 1; i <= n; i ++){
for(long j = 1; j <= n; j ++)
cout << edge(i,j) << " ";
cout << "\n";
}
cout << "\n";
}
| [
"noreply@github.com"
] | noreply@github.com |
6d01a34315d29c08d2e3e60aa95d22d00416cfa5 | 377f1110c126474b3fd4b565a0e014df0b3dc83f | /include/game_objects/buffs.h | 752a6eb76374f0e7907a4351c7efc0c5caa59098 | [] | no_license | sttie/game_of_patterns | 79feca16d92125d71638633497e94a321b1fa987 | 60714d76468a3c453e651d7d6d2047b7a78e3c98 | refs/heads/master | 2023-06-19T17:53:10.539230 | 2021-07-10T21:19:15 | 2021-07-10T21:19:15 | 379,064,098 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 590 | h | #pragma once
namespace GameObject {
class Buff {
public:
explicit Buff(int timer_) : timer(timer_) {}
virtual void Apply(int &lives, int &scores) = 0;
protected:
int timer = 0;
};
class PoisonBuff : public Buff {
public:
explicit PoisonBuff(int timer_, int degree_)
: Buff(timer_), degree(degree_) {}
void Apply(int &lives, int &scores) override {
if (timer > 0) {
--timer;
lives -= degree;
}
}
private:
int degree;
};
} | [
"sttiemath@gmail.com"
] | sttiemath@gmail.com |
d88df7aa02d8391df0ce1150a973a2b0a6744c6f | 034e813a278893d8d324837b153cbcacf586e613 | /Copying bookscnm.cpp | 8ef7a47f5b03beccac7560cc61b1e5f56951d903 | [] | no_license | zhangweiooy/C-Language-learning | 3c2100471ee26a9f222b08bf8b142513b6ba4f34 | fee1f8f41ab1433c392435a7cdea63841f15e853 | refs/heads/master | 2022-09-16T17:37:51.203237 | 2020-05-27T09:02:17 | 2020-05-27T09:02:17 | 267,269,927 | 1 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 1,009 | cpp | #include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring>
using namespace std;
long long book[502],m,k;
bool flag[502];
long long bsearch(long long a)
{
long long count=1,temp=0;
memset(flag,false,sizeof(flag));
for(long long i=m-1;i>=0;i--)
{
temp+=book[i];
if(temp>a)
{
count++;
temp=book[i];
flag[i]=true;
}
}
return count;
}
int main()
{
long long i,n,mmp;
cin>>n;
while(n--)
{
cin>>m>>k;
long long left=0,mid,right=0;
for(i=0;i<m;i++)
{
cin>>book[i];
if(book[i]>left)
left=book[i];
right+=book[i];
}
while(left<right)
{
mid=(left+right)/2;
if(bsearch(mid)<=k)
right=mid;
else
left=mid+1;
}
mmp=bsearch(right);
while(mmp<k)
for(i=0;i<m;i++)
if(!flag[i])
{
flag[i]=true;
mmp++;
break;
}
cout<<book[0];
for(i=1;i<m;i++)
{
if(flag[i-1])
cout<<" /";
printf(" %lld",book[i]);
}
cout<<endl;
}
return 0;
}
| [
"zhangweiooy@foxmail.com"
] | zhangweiooy@foxmail.com |
bc987937f4aec4924fec60f173fed972310edf64 | 297497957c531d81ba286bc91253fbbb78b4d8be | /other-licenses/7zstub/src/CPP/Windows/DLL.cpp | 4c1f4366ba6b4b8833a95bac605c2f7efdd66106 | [
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0",
"LicenseRef-scancode-public-domain"
] | permissive | marco-c/gecko-dev-comments-removed | 7a9dd34045b07e6b22f0c636c0a836b9e639f9d3 | 61942784fb157763e65608e5a29b3729b0aa66fa | refs/heads/master | 2023-08-09T18:55:25.895853 | 2023-08-01T00:40:39 | 2023-08-01T00:40:39 | 211,297,481 | 0 | 0 | NOASSERTION | 2019-09-29T01:27:49 | 2019-09-27T10:44:24 | C++ | UTF-8 | C++ | false | false | 1,814 | cpp |
#include "StdAfx.h"
#include "DLL.h"
#ifndef _UNICODE
extern bool g_IsNT;
#endif
extern HINSTANCE g_hInstance;
namespace NWindows {
namespace NDLL {
bool CLibrary::Free() throw()
{
if (_module == 0)
return true;
if (!::FreeLibrary(_module))
return false;
_module = 0;
return true;
}
bool CLibrary::LoadEx(CFSTR path, DWORD flags) throw()
{
if (!Free())
return false;
#ifndef _UNICODE
if (!g_IsNT)
{
_module = ::LoadLibraryEx(fs2fas(path), NULL, flags);
}
else
#endif
{
_module = ::LoadLibraryExW(fs2us(path), NULL, flags);
}
return (_module != NULL);
}
bool CLibrary::Load(CFSTR path) throw()
{
if (!Free())
return false;
#ifndef _UNICODE
if (!g_IsNT)
{
_module = ::LoadLibrary(fs2fas(path));
}
else
#endif
{
_module = ::LoadLibraryW(fs2us(path));
}
return (_module != NULL);
}
bool MyGetModuleFileName(FString &path)
{
HMODULE hModule = g_hInstance;
path.Empty();
#ifndef _UNICODE
if (!g_IsNT)
{
TCHAR s[MAX_PATH + 2];
s[0] = 0;
DWORD size = ::GetModuleFileName(hModule, s, MAX_PATH + 1);
if (size <= MAX_PATH && size != 0)
{
path = fas2fs(s);
return true;
}
}
else
#endif
{
WCHAR s[MAX_PATH + 2];
s[0] = 0;
DWORD size = ::GetModuleFileNameW(hModule, s, MAX_PATH + 1);
if (size <= MAX_PATH && size != 0)
{
path = us2fs(s);
return true;
}
}
return false;
}
#ifndef _SFX
FString GetModuleDirPrefix()
{
FString s;
if (MyGetModuleFileName(s))
{
int pos = s.ReverseFind_PathSepar();
if (pos >= 0)
s.DeleteFrom(pos + 1);
}
if (s.IsEmpty())
s = "." STRING_PATH_SEPARATOR;
return s;
}
#endif
}}
| [
"mcastelluccio@mozilla.com"
] | mcastelluccio@mozilla.com |
804b681b68b40cc4c8877e81281a3a5211e68c92 | db7107759d3e64363105181b9b26c42611e546df | /test-mavlink-app/testmavlinkappmainwindow.h | 97a7207047bd734ef892cbcfe8f4bfcb85523a1b | [] | no_license | KurlesHS/simple_mavlink | 3dafb495f0534fd2833761f92c5e244a8ff9b879 | 05571d7ae9f417a2666e0ec6021ac8618923527e | refs/heads/master | 2021-06-18T22:58:26.204238 | 2019-09-02T10:24:03 | 2019-09-02T10:24:03 | 147,213,081 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,414 | h | #ifndef TESTMAVLINKAPPMAINWINDOW_H
#define TESTMAVLINKAPPMAINWINDOW_H
#include <QMainWindow>
#include <protocol/handlers/uploadmissionoutgoingcommandhandler.h>
#include <protocol/mavlinkcommandhandler.h>
#include <protocol/iuavevent.h>
#include <transport/tcpmavlinktransport.h>
#include <transport/mavlinkclient.h>
namespace Ui {
class TestMavlinkAppMainWindow;
}
class TestMavlinkAppMainWindow : public QMainWindow
{
Q_OBJECT
public:
explicit TestMavlinkAppMainWindow(QWidget *parent = nullptr);
~TestMavlinkAppMainWindow() override;
private slots:
void on_pushButtonUploadMission_clicked();
void on_pushButtonStartMission_clicked();
void on_pushButtonUp_clicked();
void on_pushButtonDown_clicked();
void on_pushButtonRight_clicked();
void on_pushButtonLeft_clicked();
void on_pushButtonReturnToHome_clicked();
private:
void onLog(const QString &msg);
void onUavEvent(const QString &uavId, const rsvo::mavlinkprotocol::IUavEventSharedPtr &onUavEvent);
void updatePitchCourseLabel();
void correctPitchCourse();
void sendPitchCourseCmd();
private:
Ui::TestMavlinkAppMainWindow *ui;
rsvo::mavlinkprotocol::TcpMavlinkTransport mTransport;
rsvo::mavlinkprotocol::MavLinkClient mClient;
rsvo::mavlinkprotocol::MavlinkCommandHandler mCommandHandler;
int mPitch;
int mCourse;;
};
#endif // TESTMAVLINKAPPMAINWINDOW_H
| [
"kahshs@gmail.com"
] | kahshs@gmail.com |
5cea1f87e2219718a23ff1baa4f2dd6c1c8957fd | 8e3bbc12ad978fad56c881cb72141ba6816d4f49 | /Networking/Packet/PacketProcessor.h | 9db82eeba98fe79177c3865e36c29acc26d6996f | [] | no_license | Twisterok/Storage | 2a741e1319f20240d9e5ada1d3858b851532c8d5 | 6008f4bb11b826d0831bf7345fb446fdeb9e4902 | refs/heads/master | 2020-12-02T21:18:08.037887 | 2017-07-05T07:51:42 | 2017-07-05T07:51:42 | 96,291,374 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,721 | h | #pragma once
// own includes
#include <Network/Packet/Packet.h>
#include <Network/Packet/Factory/PacketFactory.h>
#include <Network/Packet/PacketProcessor.h>
#include <Utils/Definitions.h>
#include <Utils/Exception.h>
// std includes
#include <string>
#include <sstream>
#include <memory>
// Qt includes
using namespace std;
namespace PacketProcessor
{
//-------------------------------------------------------------------
void FillMessage( unique_ptr<Packet>& packet, vector<unsigned char>& message );
short DecodeHeader( const std::vector<unsigned char>& message );
unique_ptr<Packet> DecodePacket( shared_ptr<PacketFactory>& packetFactory,const std::vector<unsigned char>& message );
//-------------------------------------------------------------------
template <class ConnectionType>
void Write( shared_ptr<ConnectionType>& con, unique_ptr<Packet> packet )
{
vector<unsigned char> message;
FillMessage( std::move(packet), message );
con->write(message);
}
//-------------------------------------------------------------------
template <class ConnectionType>
unique_ptr<Packet> Read( shared_ptr<ConnectionType>& con, shared_ptr<PacketFactory>& packetFactory )
{
string response;
vector<unsigned char> message;
unique_ptr<Packet> result;
/* read length */
message.resize(2);
con->read(message);
short cmdLen = DecodeHeader(message);
/* Read message */
message.resize(cmdLen);
con->read(message);
auto packet = DecodePacket(packetFactory,message);
return std::move(packet);
}
}
| [
"alexandr.naplavkov@gmail.com"
] | alexandr.naplavkov@gmail.com |
302fa61eb2c5711a9355523c1d8d92d4ce2c8bcf | b93605647bfcc7b3ed66c9f91121b38cbd48708f | /chp6/listing_6_11.cpp | f60c7fca4de4518c7d9d718dc611843e640ee4b0 | [] | no_license | p-gonzo/cpp_practice | 39b67e9680708b373a8f8658e9b7f91be1502757 | 7c2e382a2f7d02839bb8235e1ba83f4e79f224a2 | refs/heads/master | 2021-07-08T01:18:33.193818 | 2021-03-23T21:45:03 | 2021-03-23T21:45:03 | 228,250,581 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 496 | cpp | #include <iostream>
using namespace std;
int main()
{
for (char userSelection = 'm'; userSelection != 'x';)
{
cout << "Enter an integer: ";
int num1 {0};
cin >> num1;
cout << "Now another: ";
int num2 {0};
cin >> num2;
cout << num1 << " x " << num2 << " = " << num1 * num2 << endl;
cout << "Enter 'x' to quit or any other key to perform another calculation." << endl;
cin >> userSelection;
}
return 0;
} | [
"gonzalez@USBLINUX9PH9MQ2.bct.gambro.net"
] | gonzalez@USBLINUX9PH9MQ2.bct.gambro.net |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.