blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 3 264 | content_id stringlengths 40 40 | detected_licenses listlengths 0 85 | license_type stringclasses 2
values | repo_name stringlengths 5 140 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringclasses 905
values | visit_date timestamp[us]date 2015-08-09 11:21:18 2023-09-06 10:45:07 | revision_date timestamp[us]date 1997-09-14 05:04:47 2023-09-17 19:19:19 | committer_date timestamp[us]date 1997-09-14 05:04:47 2023-09-06 06:22:19 | github_id int64 3.89k 681M ⌀ | star_events_count int64 0 209k | fork_events_count int64 0 110k | gha_license_id stringclasses 22
values | gha_event_created_at timestamp[us]date 2012-06-07 00:51:45 2023-09-14 21:58:39 ⌀ | gha_created_at timestamp[us]date 2008-03-27 23:40:48 2023-08-21 23:17:38 ⌀ | gha_language stringclasses 141
values | src_encoding stringclasses 34
values | language stringclasses 1
value | is_vendor bool 1
class | is_generated bool 2
classes | length_bytes int64 3 10.4M | extension stringclasses 115
values | content stringlengths 3 10.4M | authors listlengths 1 1 | author_id stringlengths 0 158 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
9a705cbbc289bb531e76060f326079f1576475ed | 5ab0854d1f357eb9dbe5bb3e440d607c64d72632 | /main.cpp | 51a314c0688a3a25849729717555316504089af0 | [] | no_license | cerbin1/Coin | 3015da67d3166c62e8d5f94ac4b859f033565051 | 6fec2be206262a83df513c310fd03f4e8c1073f8 | refs/heads/master | 2020-12-30T12:43:51.266714 | 2017-05-15T19:27:59 | 2017-05-15T19:27:59 | 91,348,422 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,486 | cpp | #include <iostream>
#include <time.h>
#include <math.h>
using namespace std;
class Coin;
Coin *coins;
class Coin {
public:
double x, y;
void throwACoin() {
x = rand() % 150;
y = rand() % 150;
}
bool check(int otherCoin) {
Coin other = coins[otherCoin];
double x2 = other.x;
double y2 = other.y;
double AB = fabs(sqrt(pow((x - x2), 2.0)) + pow((y - y2), 2.0));
return 0 <= AB && AB < 22;
}
};
bool isWon(int i) {
for (int j = i - 1; j >= 0; --j) {
if (coins[i].check(j)) {
cout << "Moneta o wspolrzednych: " << coins[i].x << ", " << coins[i].y << endl;
cout << "Przeslonila monete o wspolrzednych: " << coins[j].x << ", " << coins[j].y << endl;
return true;
}
}
return false;
}
int main() {
srand((unsigned int) time(NULL));
cout << "Podaj liczbe monet: ";
int coinsAmount;
cin >> coinsAmount;
coins = new Coin[coinsAmount];
bool result = false;
int i = 0;
for (i = 0; i < coinsAmount; ++i) {
Coin newCoin = Coin();
newCoin.throwACoin();
coins[i] = newCoin;
cout << coins[i].x << ", " << coins[i].y << endl;
if (isWon(i)) {
result = true;
break;
}
}
if (result) {
cout << "Wygrales w rundzie: " << i + 1 << endl;
} else {
cout << "Niestety przegrales" << endl;
}
delete[]coins;
return 0;
}
| [
"bartek9393@poczta.onet.pl"
] | bartek9393@poczta.onet.pl |
aceae9d12a6ed9d537f0a964731441eec373470a | 62b1723812453548ab026932b1ba2ed960fba53b | /home_automation/actuators/esp8266_mqtt/heater_node/include/AppConfig.h | f6fc8db6ed3eea9e15a7844bb52baf1e6a852560 | [] | no_license | mtiutiu/Coding_Playground | be774676ae7f4c9e8d648c41216c1907e4c2e800 | 9609261118498a180240d57d96fb5f11a7f2a007 | refs/heads/master | 2023-05-26T11:16:56.926411 | 2022-10-19T09:51:37 | 2022-10-19T09:51:37 | 51,744,532 | 1 | 0 | null | 2023-05-01T20:13:21 | 2016-02-15T09:27:53 | C++ | UTF-8 | C++ | false | false | 5,192 | h | #ifndef APPCONFIG_H
#define APPCONFIG_H
#include <Arduino.h>
#include <FS.h>
#include <ArduinoJson.h>
#define MQTT_SERVER_FIELD_MAX_LEN 40
#define MQTT_USER_FIELD_MAX_LEN 40
#define MQTT_PASS_FIELD_MAX_LEN 40
#define MQTT_PORT_FIELD_MAX_LEN 6
#define MQTT_IN_TOPIC_PREFIX_FIELD_MAX_LEN 40
#define MQTT_OUT_TOPIC_PREFIX_FIELD_MAX_LEN 40
#define MYS_NODE_ID_FIELD_MAX_LEN 4
#define MYS_NODE_ALIAS_FIELD_MAX_LEN 40
typedef struct {
char mqtt_server[MQTT_SERVER_FIELD_MAX_LEN];
char mqtt_user[MQTT_USER_FIELD_MAX_LEN];
char mqtt_passwd[MQTT_PASS_FIELD_MAX_LEN];
char mqtt_port[MQTT_PORT_FIELD_MAX_LEN];
char mqtt_in_topic_prefix[MQTT_IN_TOPIC_PREFIX_FIELD_MAX_LEN];
char mqtt_out_topic_prefix[MQTT_OUT_TOPIC_PREFIX_FIELD_MAX_LEN];
char mys_node_id[MYS_NODE_ID_FIELD_MAX_LEN];
char mys_node_alias[MYS_NODE_ALIAS_FIELD_MAX_LEN];
} AppCfg;
namespace AppConfig {
AppCfg _cfgData = {0};
bool _initialized = false;
bool load(const char *cfgFilePath) {
bool success = false;
if (SPIFFS.begin()) {
if (SPIFFS.exists(cfgFilePath)) {
File configFile = SPIFFS.open(cfgFilePath, "r");
if (configFile) {
// read config file
#ifdef DEBUG
DEBUG_OUTPUT.println("Config file found!");
#endif
size_t cfgFileSize = configFile.size();
// Allocate a buffer to store contents of the file.
char* buff = (char*)malloc(cfgFileSize * sizeof(char));
if(buff) {
memset(buff, '\0', cfgFileSize);
configFile.readBytes(buff, cfgFileSize);
}
configFile.close();
DynamicJsonBuffer jsonBuffer;
JsonObject &json = jsonBuffer.parseObject(buff);
#ifdef DEBUG
json.printTo(DEBUG_OUTPUT);
DEBUG_OUTPUT.println();
#endif
strncpy(_cfgData.mqtt_server, json["mqtt_server"], MQTT_SERVER_FIELD_MAX_LEN);
strncpy(_cfgData.mqtt_user, json["mqtt_user"], MQTT_USER_FIELD_MAX_LEN);
strncpy(_cfgData.mqtt_passwd, json["mqtt_passwd"], MQTT_PASS_FIELD_MAX_LEN);
strncpy(_cfgData.mqtt_port, json["mqtt_port"], MQTT_PORT_FIELD_MAX_LEN);
strncpy(_cfgData.mqtt_in_topic_prefix, json["mqtt_in_topic_prefix"],
MQTT_IN_TOPIC_PREFIX_FIELD_MAX_LEN
);
strncpy(_cfgData.mqtt_out_topic_prefix, json["mqtt_out_topic_prefix"],
MQTT_OUT_TOPIC_PREFIX_FIELD_MAX_LEN
);
strncpy(_cfgData.mys_node_id, json["mys_node_id"], MYS_NODE_ID_FIELD_MAX_LEN);
strncpy(_cfgData.mys_node_alias, json["mys_node_alias"],
MYS_NODE_ALIAS_FIELD_MAX_LEN
);
// free dynamically allocated buffer for config file contents
if(buff) {
free(buff);
}
} else {
// config file couldn't be opened
#ifdef DEBUG
DEBUG_OUTPUT.println("Config file couldn't be opened!");
#endif
success = false;
}
} else {
// config file not found start portal
#ifdef DEBUG
DEBUG_OUTPUT.println("Config file wasn't found!");
#endif
success = false;
}
SPIFFS.end();
} else {
// fail to mount spiffs
#ifdef DEBUG
DEBUG_OUTPUT.println("SPIFFS mount failed!");
#endif
success = false;
}
success = true;
return success;
}
bool save(const char *cfgFilePath, AppCfg* cfgData) {
if(!cfgData) {
return false;
}
bool success = false;
if (SPIFFS.begin()) {
if (SPIFFS.exists(cfgFilePath)) {
File configFile = SPIFFS.open(cfgFilePath, "w");
if (configFile) {
// read config file
#ifdef DEBUG
DEBUG_OUTPUT.println("Config file found!");
#endif
DynamicJsonBuffer jsonBuffer;
JsonObject &json = jsonBuffer.createObject();
json["mqtt_server"] = cfgData->mqtt_server;
json["mqtt_user"] = cfgData->mqtt_user;
json["mqtt_passwd"] = cfgData->mqtt_passwd;
json["mqtt_port"] = cfgData->mqtt_port;
json["mqtt_in_topic_prefix"] = cfgData->mqtt_in_topic_prefix;
json["mqtt_out_topic_prefix"] = cfgData->mqtt_out_topic_prefix;
json["mys_node_id"] = cfgData->mys_node_id;
json["mys_node_alias"] = cfgData->mys_node_alias;
json.printTo(configFile);
configFile.close();
} else {
// config file couldn't be opened
#ifdef DEBUG
DEBUG_OUTPUT.println("Config file couldn't be opened!");
#endif
success = false;
}
} else {
// config file not found start portal
#ifdef DEBUG
DEBUG_OUTPUT.println("Config file wasn't found!");
#endif
success = false;
}
SPIFFS.end();
} else {
// fail to mount spiffs
#ifdef DEBUG
DEBUG_OUTPUT.println("SPIFFS mount failed!");
#endif
success = false;
}
success = true;
return success;
}
AppCfg* get() {
return &_cfgData;
}
bool initialized() {
return _initialized;
}
bool init() {
_initialized = load(CONFIG_FILE);
return _initialized;
}
}
#endif
| [
"mtiutiu@gmail.com"
] | mtiutiu@gmail.com |
2c9affbda5b9254e2bb25dbc364525b3911c1412 | c865da05be75527be4fdff56e71d3c1f73ffdd39 | /src/leetcode_690.cpp | a69c9ea5346a34db83bb318ca121e4dc2e3d8dd7 | [] | no_license | iWasHere1314/My_Luogu | 882672bc1239c845f9fb503dcd6c18f2b005531e | 369a8e0cf33f9bf0e7f7b25c64a8c9b465deff5d | refs/heads/main | 2023-06-19T12:47:43.832036 | 2021-07-15T01:34:12 | 2021-07-15T01:34:12 | 349,275,346 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 893 | cpp | #include<bits/stdc++.h>
using namespace std;
class Employee {
public:
int id;
int importance;
vector<int> subordinates;
};
class Solution {
public:
int getImportance(vector<Employee*> employees, int id) {
return dfs( employees, get_loc( employees, id ) );
}
private:
int dfs( vector<Employee*> &employees, size_t loc ){
auto temp = employees[loc];
auto& sub = temp->subordinates;
int res = temp->importance;
size_t sz = sub.size();
for( size_t i=0; i<sz; ++i ){
res += dfs( employees, get_loc( employees, sub[i] ) );
}
return res;
}
size_t get_loc( vector<Employee*> &employees, int id ){
size_t sz = employees.size();
for( size_t i=0; i<sz; ++i ){
if( employees[i]->id == id ){
return i;
}
}
return 0;
}
}; | [
"yyang_xdu@foxmail.com"
] | yyang_xdu@foxmail.com |
7728514441e1a13fdfcb442bd1ea01b4f49f4030 | 107d79f2c1802a3ff66d300d5d1ab2d413bac375 | /src/eepp/ui/cuilistbox.cpp | 3c021d74f33e43268c5d104d5834077c04fdfe59 | [
"MIT"
] | permissive | weimingtom/eepp | 2030ab0b2a6231358f8433304f90611499b6461e | dd672ff0e108ae1e08449ca918dc144018fb4ba4 | refs/heads/master | 2021-01-10T01:36:39.879179 | 2014-06-02T02:46:33 | 2014-06-02T02:46:33 | 46,509,734 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 26,047 | cpp | #include <eepp/ui/cuilistbox.hpp>
#include <eepp/ui/cuimanager.hpp>
#include <eepp/ui/cuilistboxitem.hpp>
#include <eepp/ui/tuiitemcontainer.hpp>
#include <eepp/graphics/cfont.hpp>
namespace EE { namespace UI {
cUIListBox::cUIListBox( cUIListBox::CreateParams& Params ) :
cUIComplexControl( Params ),
mRowHeight( Params.RowHeight ),
mVScrollMode( Params.VScrollMode ),
mHScrollMode( Params.HScrollMode ),
mSmoothScroll( Params.SmoothScroll ),
mPaddingContainer( Params.PaddingContainer ),
mHScrollPadding( Params.HScrollPadding ),
mVScrollPadding( Params.VScrollPadding ),
mContainer( NULL ),
mVScrollBar( NULL ),
mHScrollBar( NULL ),
mFont( Params.Font ),
mFontColor( Params.FontColor ),
mFontOverColor( Params.FontOverColor ),
mFontSelectedColor( Params.FontSelectedColor ),
mLastPos( eeINDEX_NOT_FOUND ),
mMaxTextWidth(0),
mHScrollInit(0),
mItemsNotVisible(0),
mLastTickMove(0),
mVisibleFirst(0),
mVisibleLast(0),
mTouchDragAcceleration(0),
mTouchDragDeceleration( Params.TouchDragDeceleration )
{
if ( NULL == Params.Font && NULL != cUIThemeManager::instance()->DefaultFont() )
mFont = cUIThemeManager::instance()->DefaultFont();
cUIControl::CreateParams CParams;
CParams.Parent( this );
CParams.PosSet( mPaddingContainer.Left, mPaddingContainer.Top );
CParams.Size = eeSize( mSize.Width() - mPaddingContainer.Right - mPaddingContainer.Left, mSize.Height() - mPaddingContainer.Top - mPaddingContainer.Bottom );
CParams.Flags = Params.Flags;
mContainer = eeNew( tUIItemContainer<cUIListBox>, ( CParams ) );
mContainer->Visible( true );
mContainer->Enabled( true );
if ( mFlags & UI_CLIP_ENABLE )
mFlags &= ~UI_CLIP_ENABLE;
cUIScrollBar::CreateParams ScrollBarP;
ScrollBarP.Parent( this );
ScrollBarP.Size = eeSize( 15, mSize.Height() );
ScrollBarP.PosSet( mSize.Width() - 15, 0 );
ScrollBarP.Flags = UI_AUTO_SIZE;
ScrollBarP.VerticalScrollBar = true;
mVScrollBar = eeNew( cUIScrollBar, ( ScrollBarP ) );
ScrollBarP.Size = eeSize( mSize.Width() - mVScrollBar->Size().Width(), 15 );
ScrollBarP.PosSet( 0, mSize.Height() - 15 );
ScrollBarP.VerticalScrollBar = false;
mHScrollBar = eeNew( cUIScrollBar, ( ScrollBarP ) );
if ( UI_SCROLLBAR_ALWAYS_ON == mHScrollMode ) {
mHScrollBar->Visible( true );
mHScrollBar->Enabled( true );
}
if ( UI_SCROLLBAR_ALWAYS_ON == mVScrollMode ) {
mVScrollBar->Visible( true );
mVScrollBar->Enabled( true );
}
mVScrollBar->AddEventListener( cUIEvent::EventOnValueChange, cb::Make1( this, &cUIListBox::OnScrollValueChange ) );
mHScrollBar->AddEventListener( cUIEvent::EventOnValueChange, cb::Make1( this, &cUIListBox::OnHScrollValueChange ) );
SetRowHeight();
ApplyDefaultTheme();
}
cUIListBox::~cUIListBox() {
}
Uint32 cUIListBox::Type() const {
return UI_TYPE_LISTBOX;
}
bool cUIListBox::IsType( const Uint32& type ) const {
return cUIListBox::Type() == type ? true : cUIComplexControl::IsType( type );
}
void cUIListBox::SetTheme( cUITheme * Theme ) {
cUIControl::SetThemeControl( Theme, "listbox" );
if ( NULL == mFont && NULL != mSkinState && NULL != mSkinState->GetSkin() && NULL != mSkinState->GetSkin()->Theme() && NULL != mSkinState->GetSkin()->Theme()->Font() )
mFont = mSkinState->GetSkin()->Theme()->Font();
AutoPadding();
OnSizeChange();
}
void cUIListBox::AutoPadding() {
if ( mFlags & UI_AUTO_PADDING ) {
mPaddingContainer = MakePadding();
}
}
cUIScrollBar * cUIListBox::VerticalScrollBar() const {
return mVScrollBar;
}
cUIScrollBar * cUIListBox::HorizontalScrollBar() const {
return mHScrollBar;
}
void cUIListBox::AddListBoxItems( std::vector<String> Texts ) {
mItems.reserve( mItems.size() + Texts.size() );
mTexts.reserve( mTexts.size() + Texts.size() );
for ( Uint32 i = 0; i < Texts.size(); i++ ) {
AddListBoxItem( Texts[i] );
}
UpdateScroll();
}
Uint32 cUIListBox::AddListBoxItem( cUIListBoxItem * Item ) {
mItems.push_back( Item );
mTexts.push_back( Item->Text() );
if ( Item->Parent() != mContainer )
Item->Parent( mContainer );
UpdateScroll();
Uint32 tMaxTextWidth = mMaxTextWidth;
ItemUpdateSize( Item );
if ( tMaxTextWidth != mMaxTextWidth ) {
UpdateListBoxItemsSize();
UpdateScroll();
}
return (Uint32)(mItems.size() - 1);
}
Uint32 cUIListBox::AddListBoxItem( const String& Text ) {
mTexts.push_back( Text );
mItems.push_back( NULL );
if ( NULL != mFont ) {
Uint32 twidth = mFont->GetTextWidth( Text );
if ( twidth > mMaxTextWidth ) {
mMaxTextWidth = twidth;
UpdateListBoxItemsSize();
}
}
UpdateScroll();
return (Uint32)(mItems.size() - 1);
}
cUIListBoxItem * cUIListBox::CreateListBoxItem( const String& Name ) {
cUITextBox::CreateParams TextParams;
TextParams.Parent( mContainer );
TextParams.Flags = UI_VALIGN_CENTER | UI_HALIGN_LEFT;
TextParams.Font = mFont;
TextParams.FontColor = mFontColor;
cUIListBoxItem * tItem = eeNew( cUIListBoxItem, ( TextParams ) );
tItem->Text( Name );
return tItem;
}
Uint32 cUIListBox::RemoveListBoxItem( const String& Text ) {
return RemoveListBoxItem( GetListBoxItemIndex( Text ) );
}
Uint32 cUIListBox::RemoveListBoxItem( cUIListBoxItem * Item ) {
return RemoveListBoxItem( GetListBoxItemIndex( Item ) );
}
void cUIListBox::RemoveListBoxItems( std::vector<Uint32> ItemsIndex ) {
if ( ItemsIndex.size() && eeINDEX_NOT_FOUND != ItemsIndex[0] ) {
std::vector<cUIListBoxItem*> ItemsCpy;
bool erase;
mTexts.clear();
for ( Uint32 i = 0; i < mItems.size(); i++ ) {
erase = false;
for ( Uint32 z = 0; z < ItemsIndex.size(); z++ ) {
if ( ItemsIndex[z] == i ) {
for ( std::list<Uint32>::iterator it = mSelected.begin(); it != mSelected.end(); it++ ) {
if ( *it == ItemsIndex[z] ) {
mSelected.erase( it );
break;
}
}
ItemsIndex.erase( ItemsIndex.begin() + z );
erase = true;
break;
}
}
if ( !erase ) {
ItemsCpy.push_back( mItems[i] );
mTexts.push_back( mItems[i]->Text() );
} else {
eeSAFE_DELETE( mItems[i] ); // doesn't call to mItems[i]->Close(); because is not checking for close.
}
}
mItems = ItemsCpy;
UpdateScroll();
FindMaxWidth();
UpdateListBoxItemsSize();
}
}
void cUIListBox::Clear() {
mTexts.clear();
mItems.clear();
mSelected.clear();
mVScrollBar->Value(0);
UpdateScroll();
FindMaxWidth();
UpdateListBoxItemsSize();
SendCommonEvent( cUIEvent::EventOnControlClear );
}
Uint32 cUIListBox::RemoveListBoxItem( Uint32 ItemIndex ) {
RemoveListBoxItems( std::vector<Uint32>( 1, ItemIndex ) );
return ItemIndex;
}
Uint32 cUIListBox::GetListBoxItemIndex( const String& Name ) {
Uint32 size = (Uint32)mItems.size();
for ( Uint32 i = 0; i < size; i++ ) {
if ( Name == mItems[i]->Text() )
return i;
}
return eeINDEX_NOT_FOUND;
}
Uint32 cUIListBox::GetListBoxItemIndex( cUIListBoxItem * Item ) {
Uint32 size = (Uint32)mItems.size();
for ( Uint32 i = 0; i < size; i++ ) {
if ( Item == mItems[i] )
return i;
}
return eeINDEX_NOT_FOUND;
}
void cUIListBox::OnScrollValueChange( const cUIEvent * Event ) {
UpdateScroll( true );
}
void cUIListBox::OnHScrollValueChange( const cUIEvent * Event ) {
UpdateScroll( true );
}
void cUIListBox::OnSizeChange() {
mVScrollBar->Pos( mSize.Width() - mVScrollBar->Size().Width() + mVScrollPadding.Left, mVScrollPadding.Top );
mVScrollBar->Size( mVScrollBar->Size().Width() + mVScrollPadding.Right, mSize.Height() + mVScrollPadding.Bottom );
mHScrollBar->Pos( mHScrollPadding.Left, mSize.Height() - mHScrollBar->Size().Height() + mHScrollPadding.Top );
mHScrollBar->Size( mSize.Width() - mVScrollBar->Size().Width() + mHScrollPadding.Right, mHScrollBar->Size().Height() + mHScrollPadding.Bottom );
if ( mContainer->IsClipped() && UI_SCROLLBAR_AUTO == mHScrollMode ) {
if ( (Int32)mMaxTextWidth <= mContainer->Size().Width() ) {
mHScrollBar->Visible( false );
mHScrollBar->Enabled( false );
mHScrollInit = 0;
}
}
ContainerResize();
UpdateListBoxItemsSize();
UpdateScroll();
}
void cUIListBox::SetRowHeight() {
Uint32 tOldRowHeight = mRowHeight;
if ( 0 == mRowHeight ) {
Uint32 FontSize = 12;
if ( NULL != cUIThemeManager::instance()->DefaultFont() )
FontSize = cUIThemeManager::instance()->DefaultFont()->GetFontHeight();
if ( NULL != mSkinState && NULL != mSkinState->GetSkin() && NULL != mSkinState->GetSkin()->Theme() && NULL != mSkinState->GetSkin()->Theme()->Font() )
FontSize = mSkinState->GetSkin()->Theme()->Font()->GetFontHeight();
if ( NULL != mFont )
FontSize = mFont->GetFontHeight();
mRowHeight = (Uint32)( FontSize + 4 );
}
if ( tOldRowHeight != mRowHeight ) {
UpdateScroll();
UpdateListBoxItemsSize();
}
}
void cUIListBox::FindMaxWidth() {
Uint32 size = (Uint32)mItems.size();
Int32 width;
mMaxTextWidth = 0;
for ( Uint32 i = 0; i < size; i++ ) {
if ( NULL != mItems[i] )
width = (Int32)mItems[i]->GetTextWidth();
else
width = mFont->GetTextWidth( mTexts[i] );
if ( width > (Int32)mMaxTextWidth )
mMaxTextWidth = (Uint32)width;
}
}
void cUIListBox::UpdateListBoxItemsSize() {
Uint32 size = (Uint32)mItems.size();
for ( Uint32 i = 0; i < size; i++ )
ItemUpdateSize( mItems[i] );
}
void cUIListBox::ItemUpdateSize( cUIListBoxItem * Item ) {
if ( NULL != Item ) {
Int32 width = (Int32)Item->GetTextWidth();
if ( width > (Int32)mMaxTextWidth )
mMaxTextWidth = (Uint32)width;
if ( !mHScrollBar->Visible() ) {
if ( width < mContainer->Size().Width() )
width = mContainer->Size().Width();
if ( ( mItemsNotVisible > 0 && UI_SCROLLBAR_AUTO == mVScrollMode ) || UI_SCROLLBAR_ALWAYS_ON == mVScrollMode )
width -= mVScrollBar->Size().Width();
} else {
width = mMaxTextWidth;
}
Item->Size( width, mRowHeight );
}
}
void cUIListBox::ContainerResize() {
mContainer->Pos( mPaddingContainer.Left, mPaddingContainer.Top );
if( mHScrollBar->Visible() )
mContainer->Size( mSize.Width() - mPaddingContainer.Right - mPaddingContainer.Left, mSize.Height() - mPaddingContainer.Top - mHScrollBar->Size().Height() );
else
mContainer->Size( mSize.Width() - mPaddingContainer.Right - mPaddingContainer.Left, mSize.Height() - mPaddingContainer.Bottom - mPaddingContainer.Top );
}
void cUIListBox::CreateItemIndex( const Uint32& i ) {
if ( NULL == mItems[i] ) {
mItems[i] = CreateListBoxItem( mTexts[i] );
ItemUpdateSize( mItems[i] );
for ( std::list<Uint32>::iterator it = mSelected.begin(); it != mSelected.end(); it++ ) {
if ( *it == i ) {
mItems[i]->Select();
break;
}
}
}
}
void cUIListBox::UpdateScroll( bool FromScrollChange ) {
if ( !mItems.size() )
return;
cUIListBoxItem * Item;
Uint32 i, RelPos = 0, RelPosMax;
Int32 ItemPos, ItemPosMax;
Int32 tHLastScroll = mHScrollInit;
Uint32 VisibleItems = mContainer->Size().Height() / mRowHeight;
mItemsNotVisible = (Int32)mItems.size() - VisibleItems;
bool wasScrollVisible = mVScrollBar->Visible();
bool wasHScrollVisible = mHScrollBar->Visible();
bool Clipped = 0 != mContainer->IsClipped();
if ( mItemsNotVisible <= 0 ) {
if ( UI_SCROLLBAR_ALWAYS_ON == mVScrollMode ) {
mVScrollBar->Visible( true );
mVScrollBar->Enabled( true );
} else {
mVScrollBar->Visible( false );
mVScrollBar->Enabled( false );
}
} else {
if ( UI_SCROLLBAR_AUTO == mVScrollMode || UI_SCROLLBAR_ALWAYS_ON == mVScrollMode ) {
mVScrollBar->Visible( true );
mVScrollBar->Enabled( true );
} else {
mVScrollBar->Visible( false );
mVScrollBar->Enabled( false );
}
}
if ( Clipped && ( UI_SCROLLBAR_AUTO == mHScrollMode || UI_SCROLLBAR_ALWAYS_ON == mHScrollMode ) ) {
if ( ( mVScrollBar->Visible() && mContainer->Size().Width() - mVScrollBar->Size().Width() < (Int32)mMaxTextWidth ) ||
( !mVScrollBar->Visible() && mContainer->Size().Width() < (Int32)mMaxTextWidth ) ) {
mHScrollBar->Visible( true );
mHScrollBar->Enabled( true );
ContainerResize();
Int32 ScrollH;
if ( mVScrollBar->Visible() )
ScrollH = mMaxTextWidth - mContainer->Size().Width() + mVScrollBar->Size().Width();
else
ScrollH = mMaxTextWidth - mContainer->Size().Width();
Int32 HScrolleable = (Uint32)( mHScrollBar->Value() * ScrollH );
mHScrollInit = -HScrolleable;
} else {
if ( UI_SCROLLBAR_AUTO == mHScrollMode ) {
mHScrollBar->Visible( false );
mHScrollBar->Enabled( false );
mHScrollInit = 0;
ContainerResize();
}
}
}
VisibleItems = mContainer->Size().Height() / mRowHeight;
mItemsNotVisible = (Uint32)mItems.size() - VisibleItems;
Int32 Scrolleable = (Int32)mItems.size() * mRowHeight - mContainer->Size().Height();
bool isScrollVisible = mVScrollBar->Visible();
bool isHScrollVisible = mHScrollBar->Visible();
bool FirstVisible = false;
if ( Clipped && mSmoothScroll ) {
if ( Scrolleable >= 0 )
RelPos = (Uint32)( mVScrollBar->Value() * Scrolleable );
else
RelPos = 0;
RelPosMax = RelPos + mContainer->Size().Height() + mRowHeight;
if ( ( FromScrollChange && eeINDEX_NOT_FOUND != mLastPos && mLastPos == RelPos ) && ( tHLastScroll == mHScrollInit ) )
return;
mLastPos = RelPos;
for ( i = 0; i < mItems.size(); i++ ) {
Item = mItems[i];
ItemPos = mRowHeight * i;
ItemPosMax = ItemPos + mRowHeight;
if ( ( ItemPos >= (Int32)RelPos || ItemPosMax >= (Int32)RelPos ) && ( ItemPos <= (Int32)RelPosMax ) ) {
if ( NULL == Item ) {
CreateItemIndex( i );
Item = mItems[i];
}
Item->Pos( mHScrollInit, ItemPos - RelPos );
Item->Enabled( true );
Item->Visible( true );
if ( !FirstVisible ) {
mVisibleFirst = i;
FirstVisible = true;
}
mVisibleLast = i;
} else {
eeSAFE_DELETE( mItems[i] );
Item = NULL;
}
if ( NULL != Item ) {
if ( ( !wasScrollVisible && isScrollVisible ) || ( wasScrollVisible && !isScrollVisible ) ||( !wasHScrollVisible && isHScrollVisible ) || ( wasHScrollVisible && !isHScrollVisible ) )
ItemUpdateSize( Item );
}
}
} else {
RelPosMax = (Uint32)mItems.size();
if ( mItemsNotVisible > 0 ) {
RelPos = (Uint32)( mVScrollBar->Value() * mItemsNotVisible );
RelPosMax = RelPos + VisibleItems;
}
if ( ( FromScrollChange && eeINDEX_NOT_FOUND != mLastPos && mLastPos == RelPos ) && ( !Clipped || tHLastScroll == mHScrollInit ) )
return;
mLastPos = RelPos;
for ( i = 0; i < mItems.size(); i++ ) {
Item = mItems[i];
ItemPos = mRowHeight * ( i - RelPos );
if ( i >= RelPos && i < RelPosMax ) {
if ( NULL == Item ) {
CreateItemIndex( i );
Item = mItems[i];
}
if ( Clipped )
Item->Pos( mHScrollInit, ItemPos );
else
Item->Pos( 0, ItemPos );
Item->Enabled( true );
Item->Visible( true );
if ( !FirstVisible ) {
mVisibleFirst = i;
FirstVisible = true;
}
mVisibleLast = i;
} else {
eeSAFE_DELETE( mItems[i] );
Item = NULL;
}
if ( NULL != Item ) {
if ( ( !wasScrollVisible && isScrollVisible ) || ( wasScrollVisible && !isScrollVisible ) ||( !wasHScrollVisible && isHScrollVisible ) || ( wasHScrollVisible && !isHScrollVisible ) )
ItemUpdateSize( Item );
}
}
}
if ( mHScrollBar->Visible() && !mVScrollBar->Visible() ) {
mHScrollBar->Pos( mHScrollPadding.Left, mSize.Height() - mHScrollBar->Size().Height() + mHScrollPadding.Top );
mHScrollBar->Size( mSize.Width() + mHScrollPadding.Right, mHScrollBar->Size().Height() + mHScrollPadding.Bottom );
} else {
mHScrollBar->Pos( mHScrollPadding.Left, mSize.Height() - mHScrollBar->Size().Height() + mHScrollPadding.Top );
mHScrollBar->Size( mSize.Width() - mVScrollBar->Size().Width() + mHScrollPadding.Right, mHScrollBar->Size().Height() + mHScrollPadding.Bottom );
}
}
void cUIListBox::ItemKeyEvent( const cUIEventKey &Event ) {
cUIEventKey ItemEvent( Event.Ctrl(), cUIEvent::EventOnItemKeyDown, Event.KeyCode(), Event.Char(), Event.Mod() );
SendEvent( &ItemEvent );
}
void cUIListBox::ItemClicked( cUIListBoxItem * Item ) {
cUIEvent ItemEvent( Item, cUIEvent::EventOnItemClicked );
SendEvent( &ItemEvent );
if ( !( IsMultiSelect() && cUIManager::instance()->GetInput()->IsKeyDown( KEY_LCTRL ) ) )
ResetItemsStates();
}
Uint32 cUIListBox::OnSelected() {
cUIMessage tMsg( this, cUIMessage::MsgSelected, 0 );
MessagePost( &tMsg );
SendCommonEvent( cUIEvent::EventOnItemSelected );
return 1;
}
void cUIListBox::ResetItemsStates() {
for ( Uint32 i = 0; i < mItems.size(); i++ ) {
if ( NULL != mItems[i] )
mItems[i]->Unselect();
}
}
bool cUIListBox::IsMultiSelect() const {
return 0 != ( mFlags & UI_MULTI_SELECT );
}
cUIListBoxItem * cUIListBox::GetItem( const Uint32& Index ) const {
eeASSERT( Index < mItems.size() )
return mItems[ Index ];
}
cUIListBoxItem * cUIListBox::GetItemSelected() {
if ( mSelected.size() ) {
if ( NULL == mItems[ mSelected.front() ] )
CreateItemIndex( mSelected.front() );
return mItems[ mSelected.front() ];
}
return NULL;
}
Uint32 cUIListBox::GetItemSelectedIndex() const {
if ( mSelected.size() )
return mSelected.front();
return eeINDEX_NOT_FOUND;
}
String cUIListBox::GetItemSelectedText() const {
String tstr;
if ( mSelected.size() )
return mTexts[ mSelected.front() ];
return tstr;
}
std::list<Uint32> cUIListBox::GetItemsSelectedIndex() const {
return mSelected;
}
std::list<cUIListBoxItem *> cUIListBox::GetItemsSelected() {
std::list<cUIListBoxItem *> tItems;
std::list<Uint32>::iterator it;
for ( it = mSelected.begin(); it != mSelected.end(); it++ ) {
if ( NULL == mItems[ *it ] )
CreateItemIndex( *it );
tItems.push_back( mItems[ *it ] );
}
return tItems;
}
Uint32 cUIListBox::GetItemIndex( cUIListBoxItem * Item ) {
for ( Uint32 i = 0; i < mItems.size(); i++ ) {
if ( Item == mItems[i] )
return i;
}
return eeINDEX_NOT_FOUND;
}
Uint32 cUIListBox::GetItemIndex( const String& Text ) {
for ( Uint32 i = 0; i < mTexts.size(); i++ ) {
if ( Text == mTexts[i] )
return i;
}
return eeINDEX_NOT_FOUND;
}
void cUIListBox::FontColor( const eeColorA& Color ) {
mFontColor = Color;
for ( Uint32 i = 0; i < mItems.size(); i++ )
mItems[i]->Color( mFontColor );
}
const eeColorA& cUIListBox::FontColor() const {
return mFontColor;
}
void cUIListBox::FontOverColor( const eeColorA& Color ) {
mFontOverColor = Color;
}
const eeColorA& cUIListBox::FontOverColor() const {
return mFontOverColor;
}
void cUIListBox::FontSelectedColor( const eeColorA& Color ) {
mFontSelectedColor = Color;
}
const eeColorA& cUIListBox::FontSelectedColor() const {
return mFontSelectedColor;
}
void cUIListBox::Font( cFont * Font ) {
mFont = Font;
for ( Uint32 i = 0; i < mItems.size(); i++ )
mItems[i]->Font( mFont );
FindMaxWidth();
UpdateListBoxItemsSize();
UpdateScroll();
}
cFont * cUIListBox::Font() const {
return mFont;
}
void cUIListBox::PaddingContainer( const eeRecti& Padding ) {
if ( Padding != mPaddingContainer ) {
mPaddingContainer = Padding;
ContainerResize();
UpdateScroll();
}
}
const eeRecti& cUIListBox::PaddingContainer() const {
return mPaddingContainer;
}
void cUIListBox::SmoothScroll( const bool& soft ) {
if ( soft != mSmoothScroll ) {
mSmoothScroll = soft;
UpdateScroll();
}
}
const bool& cUIListBox::SmoothScroll() const {
return mSmoothScroll;
}
void cUIListBox::RowHeight( const Uint32& height ) {
if ( mRowHeight != height ) {
mRowHeight = height;
UpdateListBoxItemsSize();
UpdateScroll();
}
}
const Uint32& cUIListBox::RowHeight() const {
return mRowHeight;
}
Uint32 cUIListBox::Count() {
return (Uint32)mItems.size();
}
void cUIListBox::SetSelected( const String& Text ) {
SetSelected( GetItemIndex( Text ) );
}
void cUIListBox::SetSelected( Uint32 Index ) {
if ( Index < mItems.size() ) {
if ( IsMultiSelect() ) {
for ( std::list<Uint32>::iterator it = mSelected.begin(); it != mSelected.end(); it++ ) {
if ( *it == Index )
return;
}
} else {
if ( mSelected.size() ) {
if ( NULL != mItems[ mSelected.front() ] ) {
mItems[ mSelected.front() ]->Unselect();
}
mSelected.clear();
}
}
mSelected.push_back( Index );
if ( NULL != mItems[ Index ] ) {
mItems[ Index ]->Select();
} else {
UpdateScroll();
}
}
}
void cUIListBox::SelectPrev() {
if ( !IsMultiSelect() && mSelected.size() ) {
Int32 SelIndex = mSelected.front() - 1;
if ( SelIndex >= 0 ) {
if ( NULL == mItems[ mSelected.front() ] )
CreateItemIndex( mSelected.front() );
if ( NULL == mItems[ SelIndex ] )
CreateItemIndex( SelIndex );
if ( mItems[ SelIndex ]->Pos().y < 0 ) {
mVScrollBar->Value( (eeFloat)( SelIndex * mRowHeight ) / (eeFloat)( ( mItems.size() - 1 ) * mRowHeight ) );
mItems[ SelIndex ]->SetFocus();
}
SetSelected( SelIndex );
}
}
}
void cUIListBox::SelectNext() {
if ( !IsMultiSelect() && mSelected.size() ) {
Int32 SelIndex = mSelected.front() + 1;
if ( SelIndex < (Int32)mItems.size() ) {
if ( NULL == mItems[ mSelected.front() ] )
CreateItemIndex( mSelected.front() );
if ( NULL == mItems[ SelIndex ] )
CreateItemIndex( SelIndex );
if ( mItems[ SelIndex ]->Pos().y + (Int32)RowHeight() > mContainer->Size().Height() ) {
mVScrollBar->Value( (eeFloat)( SelIndex * mRowHeight ) / (eeFloat)( ( mItems.size() - 1 ) * mRowHeight ) );
mItems[ SelIndex ]->SetFocus();
}
SetSelected( SelIndex );
}
}
}
Uint32 cUIListBox::OnKeyDown( const cUIEventKey &Event ) {
cUIControlAnim::OnKeyDown( Event );
if ( !mSelected.size() || mFlags & UI_MULTI_SELECT )
return 0;
if ( Sys::GetTicks() - mLastTickMove > 100 ) {
if ( KEY_DOWN == Event.KeyCode() ) {
mLastTickMove = Sys::GetTicks();
SelectNext();
} else if ( KEY_UP == Event.KeyCode() ) {
mLastTickMove = Sys::GetTicks();
SelectPrev();
} else if ( KEY_HOME == Event.KeyCode() ) {
mLastTickMove = Sys::GetTicks();
if ( mSelected.front() != 0 ) {
mVScrollBar->Value( 0 );
mItems[ 0 ]->SetFocus();
SetSelected( 0 );
}
} else if ( KEY_END == Event.KeyCode() ) {
mLastTickMove = Sys::GetTicks();
if ( mSelected.front() != Count() - 1 ) {
mVScrollBar->Value( 1 );
mItems[ Count() - 1 ]->SetFocus();
SetSelected( Count() - 1 );
}
}
}
ItemKeyEvent( Event );
return 1;
}
Uint32 cUIListBox::OnMessage( const cUIMessage * Msg ) {
switch ( Msg->Msg() ) {
case cUIMessage::MsgFocusLoss:
{
cUIControl * FocusCtrl = cUIManager::instance()->FocusControl();
if ( this != FocusCtrl && !IsParentOf( FocusCtrl ) ) {
OnComplexControlFocusLoss();
}
return 1;
}
}
return 0;
}
void cUIListBox::OnAlphaChange() {
cUIComplexControl::OnAlphaChange();
if ( mItems.size() ) {
for ( Uint32 i = mVisibleFirst; i <= mVisibleLast; i++ ) {
if ( NULL != mItems[i] )
mItems[i]->Alpha( mAlpha );
}
}
mVScrollBar->Alpha( mAlpha );
mHScrollBar->Alpha( mAlpha );
}
void cUIListBox::VerticalScrollMode( const UI_SCROLLBAR_MODE& Mode ) {
if ( Mode != mVScrollMode ) {
mVScrollMode = Mode;
UpdateScroll();
}
}
const UI_SCROLLBAR_MODE& cUIListBox::VerticalScrollMode() {
return mVScrollMode;
}
void cUIListBox::HorizontalScrollMode( const UI_SCROLLBAR_MODE& Mode ) {
if ( Mode != mHScrollMode ) {
mHScrollMode = Mode;
if ( UI_SCROLLBAR_ALWAYS_ON == mHScrollMode ) {
mHScrollBar->Visible( true );
mHScrollBar->Enabled( true );
ContainerResize();
} else if ( UI_SCROLLBAR_ALWAYS_OFF == mHScrollMode ) {
mHScrollBar->Visible( false );
mHScrollBar->Enabled( false );
ContainerResize();
}
UpdateScroll();
}
}
const UI_SCROLLBAR_MODE& cUIListBox::HorizontalScrollMode() {
return mHScrollMode;
}
bool cUIListBox::TouchDragEnable() const {
return 0 != ( mFlags & UI_TOUCH_DRAG_ENABLED );
}
void cUIListBox::TouchDragEnable( const bool& enable ) {
WriteFlag( UI_TOUCH_DRAG_ENABLED, true == enable );
}
bool cUIListBox::TouchDragging() const {
return 0 != ( mControlFlags & UI_CTRL_FLAG_TOUCH_DRAGGING );
}
void cUIListBox::TouchDragging( const bool& dragging ) {
WriteCtrlFlag( UI_CTRL_FLAG_TOUCH_DRAGGING, true == dragging );
}
void cUIListBox::Update() {
if ( mEnabled && mVisible ) {
if ( mFlags & UI_TOUCH_DRAG_ENABLED ) {
Uint32 Press = cUIManager::instance()->PressTrigger();
Uint32 LPress = cUIManager::instance()->LastPressTrigger();
if ( ( mControlFlags & UI_CTRL_FLAG_TOUCH_DRAGGING ) ) {
// Mouse Not Down
if ( !( Press & EE_BUTTON_LMASK ) ) {
WriteCtrlFlag( UI_CTRL_FLAG_TOUCH_DRAGGING, 0 );
cUIManager::instance()->SetControlDragging( false );
return;
}
eeVector2i Pos( cUIManager::instance()->GetMousePos() );
if ( mTouchDragPoint != Pos ) {
eeVector2i diff = -( mTouchDragPoint - Pos );
mVScrollBar->Value( mVScrollBar->Value() + ( -diff.y / (eeFloat)( ( mItems.size() - 1 ) * mRowHeight ) ) );
mTouchDragAcceleration += Elapsed().AsMilliseconds() * diff.y * mTouchDragDeceleration;
mTouchDragPoint = Pos;
cUIManager::instance()->SetControlDragging( true );
} else {
mTouchDragAcceleration -= Elapsed().AsMilliseconds() * mTouchDragAcceleration * 0.01f;
}
} else {
// Mouse Down
if ( IsMouseOverMeOrChilds() && !mVScrollBar->IsMouseOverMeOrChilds() && !mHScrollBar->IsMouseOverMeOrChilds() ) {
if ( !( LPress & EE_BUTTON_LMASK ) && ( Press & EE_BUTTON_LMASK ) ) {
WriteCtrlFlag( UI_CTRL_FLAG_TOUCH_DRAGGING, 1 );
mTouchDragPoint = cUIManager::instance()->GetMousePos();
mTouchDragAcceleration = 0;
}
}
// Mouse Up
if ( ( LPress & EE_BUTTON_LMASK ) && !( Press & EE_BUTTON_LMASK ) ) {
WriteCtrlFlag( UI_CTRL_FLAG_TOUCH_DRAGGING, 0 );
cUIManager::instance()->SetControlDragging( false );
}
// Deaccelerate
if ( mTouchDragAcceleration > 0.01f || mTouchDragAcceleration < -0.01f ) {
mVScrollBar->Value( mVScrollBar->Value() + ( -mTouchDragAcceleration / (eeFloat)( ( mItems.size() - 1 ) * mRowHeight ) ) );
mTouchDragAcceleration -= mTouchDragAcceleration * mTouchDragDeceleration * Elapsed().AsMilliseconds();
}
}
}
}
cUIComplexControl::Update();
}
}}
| [
"spartanj@gmail.com"
] | spartanj@gmail.com |
facecd9dc29055a657f715cde6e115079d258cae | 464aa9d7d6c4906b083e6c3da12341504b626404 | /src/tools/common/romp_harness.hpp | 6e370a732d2e6dd87d070180093c006d62155361 | [] | no_license | v2v3v4/BigWorld-Engine-2.0.1 | 3a6fdbb7e08a3e09bcf1fd82f06c1d3f29b84f7d | 481e69a837a9f6d63f298a4f24d423b6329226c6 | refs/heads/master | 2023-01-13T03:49:54.244109 | 2022-12-25T14:21:30 | 2022-12-25T14:21:30 | 163,719,991 | 182 | 167 | null | null | null | null | UTF-8 | C++ | false | false | 2,408 | hpp | /******************************************************************************
BigWorld Technology
Copyright BigWorld Pty, Ltd.
All Rights Reserved. Commercial in confidence.
WARNING: This computer program is protected by copyright law and international
treaties. Unauthorized use, reproduction or distribution of this program, or
any portion of this program, may result in the imposition of civil and
criminal penalties as provided by law.
******************************************************************************/
//---------------------------------------------------------------------------
#ifndef romp_test_harnessH
#define romp_test_harnessH
#include "pyscript/pyobject_plus.hpp"
#include "pyscript/script.hpp"
#include "resmgr/datasection.hpp"
class EnviroMinder;
class TimeOfDay;
/*~ class NoModule.RompHarness
* @components{ tools }
*
* This class keeps track of the space's environment, such as the current time,
* time scale, fog, etc.
*/
class RompHarness : public PyObjectPlus
{
Py_Header( RompHarness, PyObjectPlus )
public:
RompHarness( PyTypePlus * pType = &s_type_ );
~RompHarness();
bool init();
void changeSpace();
void initWater( DataSectionPtr pProject );
void setTime( float t );
void setSecondsPerHour( float sph );
void fogEnable( bool state );
bool fogEnable() const;
void setRainAmount( float r );
void update( float dTime, bool globalWeather );
void drawPreSceneStuff( bool sparkleCheck = false, bool renderEnvironment = true );
void drawDelayedSceneStuff( bool renderEnvironment = true );
void drawPostSceneStuff( bool showWeather = true, bool showFlora = true, bool showFloraShadowing = false );
TimeOfDay* timeOfDay() const;
EnviroMinder& enviroMinder() const;
//-------------------------------------------------
//Python Interface
//-------------------------------------------------
PyObject * pyGetAttribute( const char * attr );
int pySetAttribute( const char * attr, PyObject * value );
//methods
PY_METHOD_DECLARE( py_setTime )
PY_METHOD_DECLARE( py_setSecondsPerHour )
PY_METHOD_DECLARE( py_setRainAmount )
PY_RW_ACCESSOR_ATTRIBUTE_DECLARE( bool, fogEnable, fogEnable )
private:
void disturbWater();
float dTime_;
class Distortion* distortion_;
bool inited_;
Vector3 waterMovement_[2];
};
//---------------------------------------------------------------------------
#endif
| [
"terran.erre@mail.ru"
] | terran.erre@mail.ru |
9251a62aafcba778f81ac2f5cf74676c85d82c91 | 8afc84d0758417a581ac8d8408c92ca5ce4220b7 | /src/client_fs/MessageHandler.cpp | 97b14e9435b47642aaafe0ecddf29932265a20a4 | [] | no_license | balvisio/openbookfs | 21f733b63c0fcc6911aa62d870cecd9b8f3bb8d2 | 37c99cbc62c7e52a1f84533d0ddab355f2e37cbf | refs/heads/master | 2021-01-17T08:29:13.918833 | 2013-05-05T15:51:56 | 2013-05-05T15:51:56 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 8,872 | cpp | /*
* Copyright (C) 2012 Josh Bialkowski (jbialk@mit.edu)
*
* This file is part of openbook.
*
* openbook 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.
*
* openbook 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 openbook. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* @file src/client_fs/MessageHandler.cpp
*
* @date Feb 19, 2013
* @author Josh Bialkowski (jbialk@mit.edu)
* @brief
*/
#include <cstring>
#include <sys/file.h>
#include <sys/mman.h>
#include "MessageHandler.h"
#include "MetaFile.h"
#include "ExceptionStream.h"
#include "ServerHandler.h"
/// simple macro used only in MessageHandler.cpp which creates a case statement
/// for a message type and calls the appropriate handleMessage() overload with
/// an upcast message pointer
#define MSG_HANDLE(x) \
case x: \
{ \
handleMessage(msg, message_cast<x>(msg.msg)); \
break; \
}
namespace openbook {
namespace filesystem {
namespace client {
void* MessageHandler::dispatch_main( void* vp_h )
{
MessageHandler* h = static_cast<MessageHandler*>(vp_h);
return h->main();
}
void* MessageHandler::main()
{
std::cout << "Message handler " << (void*)this << " starting up\n";
bool shouldDie = false;
while(!shouldDie)
{
TypedMessage msg;
// wait for a new message
m_msgQueue->extract(msg);
// handle the message
switch( msg.type )
{
case MSG_QUIT:
{
shouldDie = true;
std::cout << "Message handler " << (void*)this
<< " shutting down \n";
break;
}
MSG_HANDLE(MSG_PING)
MSG_HANDLE(MSG_PONG)
// MSG_HANDLE(MSG_REQUEST_CHUNK)
// MSG_HANDLE(MSG_COMMIT)
default:
{
std::cerr << "Message handler for type (" << (int)msg.type
<< ") : " << messageIdToString(msg.type)
<< "isn't implemented";
break;
}
}
if(msg.msg)
delete msg.msg;
}
return 0;
}
MessageHandler::MessageHandler():
m_msgQueue(0),
m_client(0),
m_server(0)
{
m_mutex.init();
}
MessageHandler::~MessageHandler()
{
m_mutex.destroy();
}
void MessageHandler::handleMessage(
TypedMessage msg, messages::Ping* upcast )
{
std::cout << "Message handler " << (void*)this << " got a PING \n";
TypedMessage out;
out.type = MSG_PONG;
messages::Pong* pong= new messages::Pong();
pong->set_payload(0xdeadf00d);
out.msg = pong;
sleep(5);
m_server->sendMessage(out);
}
void MessageHandler::handleMessage(
TypedMessage msg, messages::Pong* upcast )
{
std::cout << "Message handler " << (void*)this << " got a PONG \n";
TypedMessage out;
out.type = MSG_PING;
messages::Ping* ping= new messages::Ping();
ping->set_payload(0xdeadf00d);
out.msg = ping;
sleep(5);
m_server->sendMessage(out);
}
//void MessageHandler::handleMessage(
// TypedMessage msg, messages::RequestChunk* upcast )
//{
// namespace fs = boost::filesystem;
//
// std::cout << "Handling request for file chunk"
// << "\n path: " << upcast->path()
// << "\n version: " << upcast->base_version()
// << "." << upcast->client_version()
// << "\n offset: " << upcast->offset()
// << "\n size: " << upcast->size()
// << std::endl;
//
// fs::path filePath = fs::path(m_client->realRoot()) / (upcast->path());
// fs::path metaPath = fs::path(m_client->realRoot()) / (upcast->path() + ".obfsmeta");
//
// // create our response object
// messages::FileChunk* chunk = new messages::FileChunk();
// chunk->set_path( upcast->path() );
// chunk->set_msg_id( upcast->msg_id() );
// chunk->set_offset( upcast->offset() );
//
// // first open and lock the meta data file, this will prevent file
// // deletion, modification, update while we're working
// try
// {
// MetaData meta(metaPath);
// meta.load();
// chunk->set_client_version(meta.clientVersion());
// chunk->set_base_version(meta.baseVersion());
//
// // if the current version is higher than the requested version then
// // we need to reply without data
// if( upcast->base_version() == meta.baseVersion() &&
// upcast->client_version() == meta.clientVersion() )
// {
// int fd = ::open( filePath.c_str(), O_RDWR );
// if( fd < 0 )
// {
// meta.flush();
// ex()() << "Failed to open file for reading a chunk: "
// << filePath << " (" << errno << ") : "
// << strerror(errno);
// }
//
// std::cout << "Opened the file" << std::endl;
//
// off_t off = upcast->offset(); //< requested offset
// off_t pagesize = sysconf(_SC_PAGE_SIZE); //< system page size
// off_t off_n = pagesize * (off/pagesize); //< round down
// off_t extra = off - off_n;
// off_t size = upcast->size() + extra;
//
// // map the file
// void* ptr = mmap(0,size,PROT_READ|PROT_WRITE,MAP_SHARED,fd,off_n);
// if( ptr == MAP_FAILED )
// {
// meta.flush();
// ex()() << "Failed to map file " << filePath << " for reading "
// << "a chunk";
// }
//
// std::cout << "Mapped the file" << std::endl;
//
// // copy contents into the message
// chunk->set_data( (char*)ptr + extra, upcast->size() );
//
// std::cout << "Copied the data" << std::endl;
//
// // unmap and close the file
// munmap(ptr,upcast->size());
// ::close(fd);
// }
// meta.flush();
// }
// catch( std::exception& ex )
// {
// std::cerr << "Failed to deliver file chunk: " << ex.what();
// }
//
// // send the message
// TypedMessage out( MSG_FILE_CHUNK, chunk );
// m_server->sendMessage(out);
//
// std::cout << "Sent reply message" << std::endl;
//}
//
//
//
//void MessageHandler::handleMessage(
// TypedMessage msg, messages::Commit* upcast )
//{
// namespace fs = boost::filesystem;
//
// std::cout << "Handling commit of file " << upcast->path() << std::endl;
//
// fs::path filePath = fs::path(m_client->realRoot()) / (upcast->path());
// fs::path metaPath = fs::path(m_client->realRoot()) / (upcast->path() + ".obfsmeta");
//
// // first open and lock the meta data file, this will prevent file
// // deletion, modification, update while we're working
// try
// {
// MetaData meta(metaPath);
// meta.load();
//
// // make sure this isn't a repeat message
// if( upcast->base_version() != meta.baseVersion() )
// {
// meta.flush();
// ex()() << "Received a commit message from "
// << upcast->base_version() << "." << upcast->client_version()
// << " to " << upcast->new_version() << ".0 but the client "
// << "version is " << meta.baseVersion() << "."
// << meta.clientVersion() << " so ignoring the message ";
// }
//
// meta.set_baseVersion(upcast->new_version());
// meta.set_clientVersion( meta.clientVersion()
// - upcast->client_version() );
//
// std::cout << "Updating meta data for " << filePath
// << "\n base: " << meta.baseVersion()
// << "\n client: " << meta.clientVersion()
// << std::endl;
// meta.flush();
// }
// catch( std::exception& ex )
// {
// std::cerr << "Failed to commit new version: " << ex.what();
// }
//
// // todo: send ack
//}
void MessageHandler::init(
Client* client,
ServerHandler* server,
MsgQueue_t* queue)
{
m_client = client;
m_server = server;
m_msgQueue = queue;
}
} // namespace client
} // namespace filesystem
} // namespace openbook
| [
"jbialk@mit.edu"
] | jbialk@mit.edu |
4c0b88a3be99e536d3b17897aa1a381a4baea3d9 | d374ede10e2ffc598fd1c8f7fb3b5b175109fce2 | /AdaBoostAPI/AdaBoostAPI/StrongClassfier.cpp | ca7810a50e354011e0722706bb2abdd2fbdb9933 | [] | no_license | kevin840307/FaceImage | 5ba9de6260e5e8a1a801c0ba9a4d06905ce3acd7 | 41d86513d7ded6ffbb363691290b42fca5743131 | refs/heads/master | 2022-10-01T05:36:29.218286 | 2020-06-07T10:36:33 | 2020-06-07T10:36:33 | 270,184,447 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,459 | cpp | #include "stdafx.h"
#include "StrongClassfier.h"
StrongClassfier::StrongClassfier()
{
_weakClassifiers = new std::vector<WeakClassifier>();
}
StrongClassfier::~StrongClassfier()
{
delete _weakClassifiers;
_weakClassifiers = nullptr;
}
const std::vector<WeakClassifier>* StrongClassfier::GetWeakClassifiers() const
{
return _weakClassifiers;
}
void StrongClassfier::Add(const WeakClassifier& weakClassifier)
{
_weakClassifiers->push_back(weakClassifier);
}
AdaBoostType::LABELS StrongClassfier::Predict(AdaBoostType::C_DATAS& data) const
{
AdaBoostType::LABELS predict(data.size());
for (UINT32 index = 0; index < data.size(); index++)
{
predict[index] = Predict(data[index]);
}
return predict;
}
AdaBoostType::LABEL StrongClassfier::Predict(AdaBoostType::C_DATA& data) const
{
double predict = 0;
for (UINT32 index = 0; index < _weakClassifiers->size(); index++)
{
const double weakPredict = _weakClassifiers->at(index).WeightsPredict(data);
for (UINT32 predIndex = 0; predIndex < data.size(); predIndex++)
{
predict += weakPredict;
}
}
return Sign(predict);
}
AdaBoostType::LABELS StrongClassfier::Sign(const std::vector<double>& predict) const
{
AdaBoostType::LABELS labels(predict.size());
for (UINT32 index = 0; index < predict.size(); index++)
{
labels[index] = Sign(predict[index]);
}
return labels;
}
AdaBoostType::LABEL StrongClassfier::Sign(const double predict) const
{
return predict > 0 ? 1 : -1;
} | [
"kevin840307@gmail.com"
] | kevin840307@gmail.com |
4e0c77543d04b828960da6004d5972fa37bbb475 | fc833788e798460d3fb153fbb150ea5263daf878 | /12790.cpp | 8cad7ada62decf7d147ea000ccf7e2e9b4965673 | [] | no_license | ydk1104/PS | a50afdc4dd15ad1def892368591d4bd1f84e9658 | 2c791b267777252ff4bf48a8f54c98bcdcd64af9 | refs/heads/master | 2021-07-18T08:19:34.671535 | 2020-09-02T17:45:59 | 2020-09-02T17:45:59 | 208,404,564 | 4 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 275 | cpp | #include<stdio.h>
int main(void){
int T;
scanf("%d", &T);
while(T--){
int a[8];
for(int i=0; i<8; i++) scanf("%d", &a[i]);
for(int i=0; i<4; i++) a[i]+=a[i+4];
for(int i=0; i<3; i++) (a[i]<(1-i/2))?a[i]=(1-i/2):0;
printf("%d\n",a[0]+5*a[1]+2*a[2]+2*a[3]);
}
}
| [
"ydk1104@naver.com"
] | ydk1104@naver.com |
0b18b3492964237d9cb11474cb5655b0d2aef940 | 05ab9863e8bbadb64b18db64ee246769373909ae | /Software Pioneer V1.0.1/include/ArActionTurn.h | c47d0102e3040b62e4825c4c3719d5f7e3655dfe | [
"MIT"
] | permissive | santdiego/SASTools | 66e5a9d64c85bcbafea829ba2b4c71c0e6beca4d | 0586e846b5f596c45138d7fbc0c4b6ab3a1ab262 | refs/heads/master | 2021-07-09T03:54:03.188393 | 2020-08-04T14:48:55 | 2020-08-04T14:48:55 | 145,626,661 | 9 | 3 | null | null | null | null | UTF-8 | C++ | false | false | 2,503 | h | /*
Adept MobileRobots Robotics Interface for Applications (ARIA)
Copyright (C) 2004-2005 ActivMedia Robotics LLC
Copyright (C) 2006-2010 MobileRobots Inc.
Copyright (C) 2011-2015 Adept Technology, Inc.
Copyright (C) 2016-2018 Omron Adept Technologies, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
If you wish to redistribute ARIA under different terms, contact
Adept MobileRobots for information about a commercial version of ARIA at
robots@mobilerobots.com or
Adept MobileRobots, 10 Columbia Drive, Amherst, NH 03031; +1-603-881-7960
*/
#ifndef ARACTIONTURN
#define ARACTIONTURN
#include "ariaTypedefs.h"
#include "ArAction.h"
/// Action to turn when the behaviors with more priority have limited the speed
/**
This action is basically made so that you can just have a ton of
limiters of different kinds and types to keep speed under control,
then throw this into the mix to have the robot wander. Note that
the turn amount ramps up to turnAmount starting at 0 at
speedStartTurn and hitting the full amount at speedFullTurn.
@ingroup ActionClasses
**/
class ArActionTurn : public ArAction
{
public:
/// Constructor
AREXPORT ArActionTurn(const char *name = "turn",
double speedStartTurn = 200,
double speedFullTurn = 100,
double turnAmount = 15);
/// Destructor
AREXPORT virtual ~ArActionTurn();
AREXPORT virtual ArActionDesired *fire(ArActionDesired currentDesired);
AREXPORT virtual ArActionDesired *getDesired(void) { return &myDesired; }
#ifndef SWIG
AREXPORT virtual const ArActionDesired *getDesired(void) const
{ return &myDesired; }
#endif
protected:
double mySpeedStart;
double mySpeedFull;
double myTurnAmount;
double myTurning;
ArActionDesired myDesired;
};
#endif // ARACTIONTURN
| [
"sant.diego@gmail.com"
] | sant.diego@gmail.com |
791946546ca343dd8762ac52d4466d5ca467c0df | c40f0d59696c671425b670bc824af7633d267449 | /Homework10/normal_mapping/main.cpp | 2de4858c00644284f65b4b0a7e9b4a3032a7309b | [] | no_license | qiyuhao7/HomeworkOfFU | 52fa13175db0341684f7583db3a98a3ac156c2cb | cf4fc96205067db97bf2c64f3d86c93de11fe1cc | refs/heads/master | 2021-08-27T22:14:00.018506 | 2017-12-10T14:03:14 | 2017-12-10T14:03:14 | 108,550,575 | 1 | 0 | null | null | null | null | GB18030 | C++ | false | false | 5,361 | cpp | #include <string>
#define GLEW_STATIC
#include <GL/glew.h>
#include <GLFW/glfw3.h>
#include <shader.h>
#include <camera.h>
#include <model.h>
#include <glm/glm.hpp>
#include <glm/gtc/matrix_transform.hpp>
#include <glm/gtc/type_ptr.hpp>
#include <SOIL.h>
#pragma comment(lib,"opengl32.lib")
#pragma comment(lib,"glew32s.lib")
#pragma comment(lib,"glfw3.lib")
#pragma comment(lib,"SOIL.lib")
#pragma comment(lib,"assimp.lib")
GLuint screenWidth = 800, screenHeight = 600;
void key_callback(GLFWwindow* window, int key, int scancode, int action, int mode);
void scroll_callback(GLFWwindow* window, double xoffset, double yoffset);
void mouse_callback(GLFWwindow* window, double xpos, double ypos);
GLuint loadTexture(GLchar const * path);
void Do_Movement();
Camera camera(glm::vec3(00.0f, 0.0f, 3.0f));
bool keys[1024];
GLfloat lastX = 400, lastY = 300;
bool firstMouse = true;
GLfloat deltaTime = 0.0f;
GLfloat lastFrame = 0.0f;
int main()
{
glfwInit();
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
glfwWindowHint(GLFW_RESIZABLE, GL_FALSE);
GLFWwindow* window = glfwCreateWindow(screenWidth, screenHeight, "MyModel", nullptr, nullptr); // Windowed
glfwMakeContextCurrent(window);
glfwSetKeyCallback(window, key_callback);
glfwSetCursorPosCallback(window, mouse_callback);
glfwSetScrollCallback(window, scroll_callback);
glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED);
glewExperimental = GL_TRUE;
glewInit();
glViewport(0, 0, screenWidth, screenHeight);
glEnable(GL_DEPTH_TEST);
Shader shader("shader.vs", "shader.frag");
Model ourModel("NormalMap/leaf.obj");
GLuint normalMap = loadTexture("NormalMap/leaf_N.bmp");
while (!glfwWindowShouldClose(window))
{
GLfloat currentFrame = glfwGetTime();
deltaTime = currentFrame - lastFrame;
lastFrame = currentFrame;
glfwPollEvents();
Do_Movement();
// Clear the colorbuffer
glClearColor(0.5f, 0.5f, 0.5f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
shader.Use(); // <-- Don't forget this one!
// Transformation matrices
GLint objectColorLoc = glGetUniformLocation(shader.Program, "objectColor");
GLint lightColorLoc = glGetUniformLocation(shader.Program, "lightColor");
GLint lightPosLoc = glGetUniformLocation(shader.Program, "lightPos");
GLint viewPosLoc = glGetUniformLocation(shader.Program, "viewPos");
glUniform3f(objectColorLoc, 1.0f, 0.5f, 0.31f);
glUniform3f(lightColorLoc, 1.0f, 1.0f, 1.0f);
glUniform3f(lightPosLoc,0.0f,-2.0f,-3.0f);
glUniform3f(viewPosLoc, camera.Position.x, camera.Position.y, camera.Position.z);
glm::mat4 projection = glm::perspective(camera.Zoom, (float)screenWidth / (float)screenHeight, 0.1f, 100.0f);
glm::mat4 view = camera.GetViewMatrix();
glUniformMatrix4fv(glGetUniformLocation(shader.Program, "projection"), 1, GL_FALSE, glm::value_ptr(projection));
glUniformMatrix4fv(glGetUniformLocation(shader.Program, "view"), 1, GL_FALSE, glm::value_ptr(view));
glm::mat4 model;
model = glm::translate(model, glm::vec3(-12.0f, -2.0f, -8.0f)); //根据模型的偏移来计算
model = glm::scale(model, glm::vec3(0.01f, 0.01f, 0.01f)); // It's a bit too big for our scene, so scale it down
glUniformMatrix4fv(glGetUniformLocation(shader.Program, "model"), 1, GL_FALSE, glm::value_ptr(model));
glActiveTexture(GL_TEXTURE1);
glBindTexture(GL_TEXTURE_2D, normalMap);
ourModel.Draw(shader);
glfwSwapBuffers(window);
}
glfwTerminate();
return 0;
}
#pragma region "User input"
void Do_Movement()
{
if (keys[GLFW_KEY_W])
camera.ProcessKeyboard(FORWARD, deltaTime);
if (keys[GLFW_KEY_S])
camera.ProcessKeyboard(BACKWARD, deltaTime);
if (keys[GLFW_KEY_A])
camera.ProcessKeyboard(LEFT, deltaTime);
if (keys[GLFW_KEY_D])
camera.ProcessKeyboard(RIGHT, deltaTime);
}
void key_callback(GLFWwindow* window, int key, int scancode, int action, int mode)
{
if (key == GLFW_KEY_ESCAPE && action == GLFW_PRESS)
glfwSetWindowShouldClose(window, GL_TRUE);
if (action == GLFW_PRESS)
keys[key] = true;
else if (action == GLFW_RELEASE)
keys[key] = false;
}
void mouse_callback(GLFWwindow* window, double xpos, double ypos)
{
if (firstMouse)
{
lastX = xpos;
lastY = ypos;
firstMouse = false;
}
GLfloat xoffset = xpos - lastX;
GLfloat yoffset = lastY - ypos;
lastX = xpos;
lastY = ypos;
camera.ProcessMouseMovement(xoffset, yoffset);
}
void scroll_callback(GLFWwindow* window, double xoffset, double yoffset)
{
camera.ProcessMouseScroll(yoffset);
}
GLuint loadTexture(GLchar const * path)
{
GLuint textureID;
glGenTextures(1, &textureID);
int width, height;
unsigned char* image = SOIL_load_image(path, &width, &height, 0, SOIL_LOAD_RGB);
glBindTexture(GL_TEXTURE_2D, textureID);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, width, height, 0, GL_RGB, GL_UNSIGNED_BYTE, image);
glGenerateMipmap(GL_TEXTURE_2D);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glBindTexture(GL_TEXTURE_2D, 0);
SOIL_free_image_data(image);
return textureID;
}
#pragma endregion | [
"527404055@qq.com"
] | 527404055@qq.com |
72c4d316d960324ee9bd95426589ce8f38ebf38c | 97fde28997b618180cfa5dd979b142fd54dd2105 | /core/dep/acelite/ace/os_include/os_pdhmsg.h | 2b5b0b79588f3d1001038e12798ac46e66fadc1e | [] | no_license | Refuge89/sunwell-2 | 5897f4e78c693e791e368761904e79d2b7af20da | f01a89300394065f33eaec799c8779c2cac5c320 | refs/heads/master | 2020-12-31T05:55:43.496145 | 2016-02-16T20:46:50 | 2016-02-16T20:46:50 | 80,622,543 | 1 | 0 | null | 2017-02-01T13:30:06 | 2017-02-01T13:30:06 | null | UTF-8 | C++ | false | false | 762 | h | // -*- C++ -*-
//=============================================================================
/**
* @file os_pdhmsg.h
*
* definitions for the windows pdh API
*
* @author Johnny Willemsen <jwillemsen@remedy.nl>
*/
//=============================================================================
#ifndef ACE_OS_INCLUDE_OS_PDHMSG_H
#define ACE_OS_INCLUDE_OS_PDHMSG_H
#include /**/ "ace/pre.h"
#include /**/ "ace/config-all.h"
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
#if defined (ACE_HAS_PDHMSG_H) && !defined (ACE_LACKS_PDHMSG_H)
# include /**/ <pdhmsg.h>
#endif /* ACE_HAS_PDH_H && !ACE_LACKS_PDH_H */
#include /**/ "ace/post.h"
#endif /* ACE_OS_INCLUDE_OS_PDHMSG_H */
| [
"root@wow.playstar.se"
] | root@wow.playstar.se |
b1c8f7a5baf8e463a815821ec33b5c38eef87d3d | 739400771d4969fa7ac88c634c5845233f0ef74b | /WSCIPHER.cpp | 985ba18a6c64f409bd27ec33d5ee669a530d70b9 | [] | no_license | anant-agarwal/spoj | 3f562b8c01062ad398e9d80cf1069bc0b50c7757 | 3bfa9b7f6937f4f85c39371f67aed12fae2502c4 | refs/heads/master | 2016-08-12T05:32:22.640612 | 2015-11-12T20:45:56 | 2015-11-12T20:45:56 | 46,062,033 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,180 | cpp | #include<iostream>
#include<vector>
using namespace std;
int main()
{
vector<int>g1[2];
vector<int>g2[2];
vector<int>g3[2];
string txt;
while(1)
{
int k1,k2,k3;
cin>>k1>>k2>>k3;
if(k1==0 && k2==0 && k3==0)
break;
for(int i=0;i<2;i++)
{
g1[i].clear();
g2[i].clear();
g3[i].clear();
}
cin>>txt;
int len=txt.size();
for(int i=0;i<len;i++)
{
if(txt[i]<='i' && txt[i]>='a')
{
g1[0].push_back(txt[i]);
g1[1].push_back(i);
}
else
if(txt[i]<='r' && txt[i]>='j')
{
g2[0].push_back(txt[i]);
g2[1].push_back(i);
}
else
{
g3[0].push_back(txt[i]);
g3[1].push_back(i);
}
}
for(int i=0;i<k1;i++)
{
g1[1].push_back(g1[1][0]);
g1[1].erase(g1[1].begin());
}
for(int i=0;i<k2;i++)
{
g2[1].push_back(g2[1][0]);
g2[1].erase(g2[1].begin());
}
for(int i=0;i<k3;i++)
{
g3[1].push_back(g3[1][0]);
g3[1].erase(g3[1].begin());
}
int l1=g1[1].size(),l2=g2[1].size(),l3=g3[1].size();
for(int i=0;i<l1;i++)
{
txt[g1[1][i]]=g1[0][i];
}
for(int i=0;i<l2;i++)
txt[g2[1][i]]=g2[0][i];
for(int i=0;i<l3;i++)
txt[g3[1][i]]=g3[0][i];
cout<<txt<<"\n";
}
}
| [
"anantinvent@gmail.com"
] | anantinvent@gmail.com |
a25a02232b131b843f0582904f7e23371837ea8d | a5209e524928e5f1386047ac8a004d4329b008fe | /Vania3D/Engine/Resources.cpp | 35cbd272e898e6c576bcdf08399d56900556bdd9 | [] | no_license | haijianliu/Vania3D | 7ce4dd00cfc78acd601459ec76fbc46529822d24 | 2358ca427f14aa0c5ab00bba60bf58d161683036 | refs/heads/master | 2021-09-10T15:30:28.262711 | 2018-03-28T14:25:05 | 2018-03-28T14:25:05 | 106,090,978 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 9,418 | cpp |
#include "Engine.hpp"
/*------------------------------------------------------------------------------
< Constructor >
------------------------------------------------------------------------------*/
Resources::Resources() {
}
Resources* Resources::getInstance() {
static Resources* resources = new Resources();
return resources;
}
/*------------------------------------------------------------------------------
< Destructor >
------------------------------------------------------------------------------*/
Resources::~Resources() {
deleteMap(this->shaders);
deleteMap(this->models);
deleteMap(this->textures);
deleteMap(this->lightProbes);
deleteMap(this->materials);
delete this->quad;
delete this->quadinstance2vec3;
delete this->skybox;
}
/*------------------------------------------------------------------------------
< start > before GameObject defaultStart()
------------------------------------------------------------------------------*/
void Resources::start() {
/* Meshes
..............................................................................*/
this->quad = new Quad();
this->quadinstance2vec3 = new QuadInstance2vec3();
this->skybox = new Skybox();
/* Shader
..............................................................................*/
// renderpass
this->loadShader("renderpass_combine", "./Assets/Shaders/Vertex/quad.vs.glsl", "./Assets/Shaders/RenderPass/renderpass_combine.fs.glsl");
this->loadShader("ambient_pass", "./Assets/Shaders/Vertex/quad.vs.glsl", "./Assets/Shaders/RenderPass/renderpass_ambient_1_passes.fs.glsl");
this->loadShader("lighting_pass", "./Assets/Shaders/Vertex/quad.vs.glsl", "./Assets/Shaders/RenderPass/renderpass_lighting_1_passes.fs.glsl", "./Assets/Shaders/Functions/cookTorranceBRDF.fs.glsl");
this->loadShader("outline_pass", "./Assets/Shaders/Vertex/quad.vs.glsl", "./Assets/Shaders/RenderPass/renderpass_outline_1_passes.fs.glsl");
this->loadShader("shadow_pass", "./Assets/Shaders/Vertex/quad.vs.glsl", "./Assets/Shaders/RenderPass/renderpass_shadow_1_passes.fs.glsl", "./Assets/Shaders/Functions/shadowMapping.fs.glsl");
this->loadShader("ssao_pass", "./Assets/Shaders/Vertex/quad.vs.glsl", "./Assets/Shaders/RenderPass/renderpass_ssao_1_passes.fs.glsl");
this->loadShader("lut_pass", "./Assets/Shaders/Vertex/quad.vs.glsl", "./Assets/Shaders/RenderPass/renderpass_lut_1_passes.fs.glsl");
// fx
this->loadShader("fx_uv_animation", "./Assets/Shaders/Vertex/instance_7_locations_fx_animation.vs.glsl", "./Assets/Shaders/RenderPass/renderpass_fx_1_passes.fs.glsl");
this->loadShader("fx_image", "./Assets/Shaders/Vertex/instance_7_locations_fx.vs.glsl", "./Assets/Shaders/RenderPass/renderpass_fx_1_passes.fs.glsl");
// shadow mapping
this->loadShader("shadow_mapping_depth", "./Assets/Shaders/Vertex/bones_3_locations_shadowmapping.vs.glsl", "./Assets/Shaders/Fragment/null.fs.glsl");
this->loadShader("shadow_mapping_depth_static", "./Assets/Shaders/Vertex/static_1_locations_shadowmapping.vs.glsl", "./Assets/Shaders/Fragment/null.fs.glsl");
// ibl
this->loadShader("equirectangularToCubemap", "./Assets/Shaders/cubemap.vs.glsl", "./Assets/Shaders/equirectangularToCubemap.fs.glsl");
this->loadShader("irradianceConvolution", "./Assets/Shaders/cubemap.vs.glsl", "./Assets/Shaders/irradianceConvolution.fs.glsl");
this->loadShader("prefilter", "./Assets/Shaders/cubemap.vs.glsl", "./Assets/Shaders/prefilter.fs.glsl");
this->loadShader("brdf", "./Assets/Shaders/brdf.vs.glsl", "./Assets/Shaders/brdf.fs.glsl");
// other
this->loadShader("deferred_pbr_bone", "./Assets/Shaders/Vertex/bones_5_locations.vs.glsl", "./Assets/Shaders/Fragment/bgra_to_mrca_4_passes.fs.glsl", "./Assets/Shaders/Functions/getNormalFromMap.fs.glsl");
this->loadShader("simple", "./Assets/Shaders/Vertex/static_1_locations.vs.glsl", "./Assets/Shaders/Fragment/color_white_1_passes.fs.glsl");
this->createMaterial("simple", this->getShader("simple"));
this->loadShader("renderpass_color_1_passes", "./Assets/Shaders/Vertex/quad.vs.glsl", "./Assets/Shaders/RenderPass/renderpass_color_1_passes.fs.glsl");
/* Model
..............................................................................*/
this->loadModel("player", MESH_ATTRIBUTE_BONE, "./Assets/Models/Ganfaul/mixamo_model.fbx");
this->getModel("player")->addAnimation(new Animation("./Assets/Models/Ganfaul/mixamo_idle_stay.fbx"));
this->getModel("player")->addAnimation(new Animation("./Assets/Models/Ganfaul/mixamo_idle_look.fbx"));
this->getModel("player")->addAnimation(new Animation("./Assets/Models/Ganfaul/mixamo_walk.fbx"));
this->getModel("player")->addAnimation(new Animation("./Assets/Models/Ganfaul/mixamo_run.fbx"));
this->getModel("player")->addAnimation(new Animation("./Assets/Models/Ganfaul/mixamo_swiping.fbx"));
this->loadTexture("player_albedo", "./Assets/Models/Ganfaul/Ganfaul_diffuse.TGA");
this->loadTexture("player_normal", "./Assets/Models/Ganfaul/Ganfaul_normal.TGA");
this->loadTexture("player_mask", "./Assets/Models/Ganfaul/Ganfaul_mask.TGA");
this->createMaterial("player", this->getShader("deferred_pbr_bone"));
this->getMaterial("player")->addTexture("albedoMap", this->getTexture("player_albedo"));
this->getMaterial("player")->addTexture("normalMap", this->getTexture("player_normal"));
this->getMaterial("player")->addTexture("maskMap", this->getTexture("player_mask"));
this->getMaterial("player")->twoSides = true;
// sphere
this->loadModel("sphere", MESH_ATTRIBUTE_DEFAULT, "./Assets/Models/Basic/sphere.fbx");
/* LightProbe
..............................................................................*/
// this->loadLightProbe("hdr", "./Assets/Textures/HDR/WinterForest_Ref.hdr");
// this->loadLightProbe("hdr", "./Assets/Textures/HDR/Road_to_MonumentValley_8k.jpg");
// this->loadLightProbe("hdr", "./Assets/Textures/HDR/Stadium_Center_8k.jpg");
this->loadLightProbe("hdr", "./Assets/Models/InfinityBladeGrassLands/Maps/LevelContent/HDRI/HDRI_Epic_Courtyard_Daylight.HDR");
// this->loadLightProbe("hdr", "./Assets/Textures/HDR/test.jpg");
/* default LUT
..............................................................................*/
this->loadTexture("clut_default_a", "./Assets/Textures/LUT/clut_default_a.TGA");
Texture::setTexMode(this->getTexture("clut_default_a")->id, TEXTURE_MODE_NEAREST);
}
/*------------------------------------------------------------------------------
< Load & Get >
------------------------------------------------------------------------------*/
void Resources::loadShader(const char* name, const char* vertexPath, const char* fragmentPath) {
Shader* shader = new Shader();
shader->addVertexCode(vertexPath);
shader->addFragmentCode(fragmentPath);
shader->compile();
this->shaders.insert(std::make_pair(name, shader));
}
void Resources::loadShader(const char* name, const char* vertexPath, const char* fragmentPath, const char* functionPath) {
Shader* shader = new Shader();
shader->addVertexCode(vertexPath);
shader->addFragmentCode(fragmentPath);
shader->addFragmentCode(functionPath);
shader->compile();
this->shaders.insert(std::make_pair(name, shader));
}
void Resources::loadShader(const char* name, const char* vertexPath, const char* fragmentPath, const char* functionPath1, const char* functionPath2) {
Shader* shader = new Shader();
shader->addVertexCode(vertexPath);
shader->addFragmentCode(fragmentPath);
shader->addFragmentCode(functionPath1);
shader->addFragmentCode(functionPath2);
shader->compile();
this->shaders.insert(std::make_pair(name, shader));
}
Shader* Resources::getShader(const char* name) {
auto it = this->shaders.find(name);
if (it != this->shaders.end()) {
return this->shaders[name];
}
else {
std::cout << "[Resources] no shader named " << name << '\n';
return nullptr;
}
}
void Resources::loadTexture(const char* name, const char* path) {
this->textures.insert(std::make_pair(name, new Texture(path)));
}
Texture* Resources::getTexture(const char* name) {
auto it = this->textures.find(name);
if (it != this->textures.end()) {
return this->textures[name];
}
else {
std::cout << "[Resources] no texture named " << name << '\n';
return nullptr;
}
}
void Resources::loadModel(std::string name, unsigned int attributeType, const char* path) {
this->models.insert(std::make_pair(name, new Model(attributeType, path)));
}
Model* Resources::getModel(std::string name) {
auto it = this->models.find(name);
if (it != this->models.end()) {
return this->models[name];
}
else {
std::cout << "[Resources] no model named " << name << '\n';
return nullptr;
}
}
void Resources::loadLightProbe(const char* name, const char* path) {
this->lightProbes.insert(std::make_pair(name, new LightProbe(path)));
}
LightProbe* Resources::getLightProbe(const char* name) {
auto it = this->lightProbes.find(name);
if (it != this->lightProbes.end()) {
return this->lightProbes[name];
}
else {
std::cout << "[Resources] no lightProbe named " << name << '\n';
return nullptr;
}
}
void Resources::createMaterial(std::string name, Shader* shader) {
this->materials.insert(std::make_pair(name, new Material(shader)));
}
Material* Resources::getMaterial(std::string name) {
auto it = this->materials.find(name);
if (it != this->materials.end()) {
return this->materials[name];
}
else {
std::cout << "[Resources] no material named " << name << '\n';
return nullptr;
}
}
| [
"haijanliu@gmail.com"
] | haijanliu@gmail.com |
d6d0cb8d4c7f27860fc07262db6aaac049eace33 | 1314193918fd3618b7e1079bc31f9150c0152887 | /IntroToProgrammingMaterials/семинар/единадесетиСеминар/решения/zad3.cpp | a3783cba78416ad31c91be32d6ad55cfb0f2ec65 | [] | no_license | NedkoPNedev/Introduction-To-Programming-Materials | 89556df19f709f79867613fb64c3c2168658b1a3 | 8f7886813016a66d24a7422a5628ab95d1530d57 | refs/heads/master | 2020-04-20T21:21:00.025970 | 2019-02-04T16:18:01 | 2019-02-04T16:18:01 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 330 | cpp | #include <iostream>
using namespace std;
bool contains(int *arr, int len, int val)
{
if (len < 0) return false;
return (arr[len] == val) || contains(arr, len - 1, val);
}
int main()
{
int arr[10] = {2, 5, 8, 3, 1, 4, 9, 6, 7};
(contains(arr, 9, 9) == true) ? cout << "Yes.\n" : cout << "No.\n";
return 0;
}
| [
"nedko14@gmail.com"
] | nedko14@gmail.com |
b7e8f61bfa560ae426afbc4f804268b3b5a7f78a | 788e90294bb6a87f18815a7e9cb0e05bfced0a9a | /src/math/SIMD_Vec4f.cpp | b64c78dd80da7f493d11a0d24507d601dc4dbbac | [] | no_license | asdlei99/dk2 | 19ee2ef6c6876e25f7b23d144c77370a8168a803 | 24ca833c6164a7eb7b660843d9212a5cd12fef38 | refs/heads/master | 2022-06-11T03:54:12.275698 | 2020-05-05T18:01:02 | 2020-05-05T18:01:02 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,117 | cpp | #include "dk/math/SIMD_Vec4f.h"
namespace dk::math
{
SIMD_Vec4f::SIMD_Vec4f(float data_[]) noexcept
: row(_mm_loadu_ps(data_))
{}
SIMD_Vec4f::SIMD_Vec4f(__m128 row_[]) noexcept
: row(_mm_load_ps((float*)row_))
{}
SIMD_Vec4f::SIMD_Vec4f(float a) noexcept
: row(_mm_set1_ps(a))
{}
SIMD_Vec4f::SIMD_Vec4f(float x, float y, float z, float w /* = 0 */) noexcept
: row(_mm_set_ps(w, z, y, x))
{}
SIMD_Vec4f::SIMD_Vec4f(__m128 row_) noexcept
: row(row_)
{}
SIMD_Vec4f SIMD_Vec4f::operator+(float a) const noexcept
{
return { _mm_add_ps(row, _mm_set1_ps(a)) };
}
SIMD_Vec4f SIMD_Vec4f::operator-(float a) const noexcept
{
return { _mm_sub_ps(row, _mm_set1_ps(a)) };
}
SIMD_Vec4f SIMD_Vec4f::operator*(float a) const noexcept
{
return { _mm_mul_ps(row, _mm_set1_ps(a)) };
}
SIMD_Vec4f SIMD_Vec4f::operator/(float a) const noexcept
{
return { _mm_div_ps(row, _mm_set1_ps(a)) };
}
SIMD_Vec4f SIMD_Vec4f::operator+(const SIMD_Vec4f& that) const noexcept
{
return { _mm_add_ps(row, that.row) };
}
SIMD_Vec4f SIMD_Vec4f::operator-(const SIMD_Vec4f& that) const noexcept
{
return { _mm_sub_ps(row, that.row) };
}
SIMD_Vec4f& SIMD_Vec4f::operator+=(float a) noexcept
{
row = _mm_add_ps(row, _mm_set1_ps(a));
return *this;
}
SIMD_Vec4f& SIMD_Vec4f::operator-=(float a) noexcept
{
row = _mm_sub_ps(row, _mm_set1_ps(a));
return *this;
}
SIMD_Vec4f& SIMD_Vec4f::operator*=(float a) noexcept
{
row = _mm_mul_ps(row, _mm_set1_ps(a));
return *this;
}
SIMD_Vec4f& SIMD_Vec4f::operator/=(float a) noexcept
{
row = _mm_div_ps(row, _mm_set1_ps(a));
return *this;
}
SIMD_Vec4f& SIMD_Vec4f::operator+=(const SIMD_Vec4f& that) noexcept
{
row = _mm_add_ps(row, that.row);
return *this;
}
SIMD_Vec4f& SIMD_Vec4f::operator-=(const SIMD_Vec4f& that) noexcept
{
row = _mm_add_ps(row, that.row);
return *this;
}
float SIMD_Vec4f::dot(const SIMD_Vec4f& that) const noexcept
{
return util::SIMD::hadd(_mm_mul_ps(row, that.row));
}
SIMD_Vec4f SIMD_Vec4f::cross(const SIMD_Vec4f& that) const noexcept
{
#define SHUFFLE(src, x, y, z, w) _mm_shuffle_ps(src, src, (x << 6u) | (y << 4u) | (z << 2u) | w)
constexpr unsigned X = 0;
constexpr unsigned Y = 1;
constexpr unsigned Z = 2;
constexpr unsigned W = 3;
return { _mm_sub_ps(
//_mm_mul_ps(SHUFFLE(row, Y, Z, X, W), SHUFFLE(that.row, Z, X, Y, W)),
//_mm_mul_ps(SHUFFLE(row, Z, X, Y, W), SHUFFLE(that.row, Y, Z, X, W)))
_mm_mul_ps(SHUFFLE(row, W, X, Z, Y), SHUFFLE(that.row, W, Y, X, Z)),
_mm_mul_ps(SHUFFLE(row, W, Y, X, Z), SHUFFLE(that.row, W, X, Z, Y)))
};
}
float SIMD_Vec4f::length() const noexcept
{
//std::clog << *this << " length: " << util::SIMD::hadd(_mm_mul_ps(row, row)) << '\n';
return Algo::sqrt(util::SIMD::hadd(_mm_mul_ps(row, row)));
}
SIMD_Vec4f& SIMD_Vec4f::normalize() noexcept
{
const float rlen = 1 / this->length();
row = _mm_mul_ps(row, _mm_set1_ps(rlen));
return *this;
}
float* SIMD_Vec4f::begin() noexcept
{
return &x;
}
float* SIMD_Vec4f::end() noexcept
{
return &w + 1;
}
const float* SIMD_Vec4f::begin() const noexcept
{
return &x;
}
const float* SIMD_Vec4f::end() const noexcept
{
return &w + 1;
}
}
| [
"fithisback@gmail.com"
] | fithisback@gmail.com |
d1f31e744ef1ef2f9e39b6646512f6dfa4f31595 | c05643570f5031d0de7cdbbeb95476c2ab8f3327 | /Labs/Lab-12/Graph.h | 0bf581fabd8d10047a45fe077e187730abb0c4d5 | [] | no_license | jventura1738/COSC320 | f247a54b8f5983d6c6164c4219bf272b5acee188 | cb705803a96691064efc9ca88d578106238c7eee | refs/heads/master | 2022-07-02T03:30:54.953277 | 2020-05-11T00:04:49 | 2020-05-11T00:04:49 | 225,418,498 | 3 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 5,357 | h | // Justin Ventura COSC320
// Lab-11: Graph.h
#ifndef GRAPH_H
#define GRAPH_H
// Use these for various things.
#include <iostream>
#include <iterator>
#include <vector>
#include <queue>
#include <map>
#include <set>
// Enumeration for coloring vertices in the BFS print function.
// White: default color for the vertex.
// Gray: after we visit the vertex, but not yet its neighbors.
// Black: after we visit the vertex and its neighbors.
enum color_t { WHITE = 0, GRAY, BLACK };
// Enumeration for the type of graph.
// UNDIRECTED: standard graph with no specific direction.
// DIRECTED: a graph where direction from vertices v1 to v2
// is not the same as vertices v2 to v1.
enum GRAPH_TYPE {UNDIRECTED = 0, DIRECTED};
// Graph Class (Undirected)
template <class T>
class Graph {
private:
// The map from an integer (a specific vertex's value) to the
// said vertex's neighbors values.
std::map<int, std::vector<int>> vertices;
// The underlying vector to the keys in the map from 0 - n
// respectively to the vertices map where n = # of nodes.
std::vector<T> vertices_alias;
// Maps to keep track of each vertex's discovery and finish
// time as calculated in DFS.
std::map<int, int> disc_times;
std::map<int, int> fin_times;
// Keeps track of what type of graph this is.
GRAPH_TYPE g_type;
// Keeps track of the timing for DFS.
int time;
// Boolean for if the graph is Directed & Acyclic or not.
bool isDAG;
/*
* =========================================================
*
* PRIVATE METHODS TO BE CALLED FROM PUBLICS.
*
* _addEdge() -> Helper for addEdge: returns whether the
* edge can be added or not (true if edge not found.)
*
* _idxOf(val) -> Gets the index of val.
*
* _DFSvisit() -> performs the DFS visit from DFS.
*
* =========================================================
*/
// Helper for addEdge(). Returns false if an edge exists
// between v1 & v2 already, true otherwise.
bool _addEdge(const int & v1, const int & v2);
// Returns the index of the given value.
int _idxOf(const T & val);
// Helper for performing DFS visits.
void _DFSvisit(int u, std::map<int, color_t> & color, std::map<int, int> & parent,
const bool & print);
// Modified DFS for the Strongly Connected Components Algorithm.
void _SCCDFS(std::vector<std::pair<int, int>> & list);
// Modified DFS visit for the Strongly Connected Components Algorithm.
void _SCCvisit(int u, std::map<int, color_t> & color);
// Private function which returns true if given subset of vertices
// is a vertex cover, and false otherwise.
bool _isVertexCover(std::set<int> & S) const;
public:
/*
* =========================================================
*
* (DE)CONSTRUCTORS FOR MEMORY MANAGEMENT
*
* Default Constructor, Copy Constructor, Destructor,
* Overloaded Assignment Operator.
*
* =========================================================
*/
// Default Constructor for the Graph class. Graph will be
// an undirected graph by default.
Graph();
// Main Constructor. Pass enum for graph type.
Graph(const GRAPH_TYPE & type);
// Copy Constructor for the Graph class.
Graph(const Graph<T> & old_graph);
// Destructor for the Graph class.
~Graph();
// Overloaded Assignment Operator for the Graph Class.
void operator=(const Graph<T> & old_graph);
/*
* =========================================================
*
* MEMBER FUNCTIONS FOR THE GRAPH CLASS
*
* Functions to: add a vertex to the graph,
* add an edge between two vertices,
* print the graph in adjacency list form,
* and print the graph vertices in BFS order.
*
* =========================================================
*/
// Add a vertex to the graph with the integer value of vtx_val.
// If the vertex is already in the graph, throws std::string.
void addVertex(const T & vtx_val);
// Add an edge between the two vertices with values v1 & v2.
// Directed version: from v1 to v2.
// If either vertices are not found, throws an std::string.
// Also throws an std::string for multiple self-loops.
// Also throws an std::string for duplicate edges.
void addEdge(const T & v1, const T & v2);
// Add an edge between the two vertices with values v1 & v2.
// If either vertices are not found, creates them.
void forceAddEdge(const T & v1, const T & v2);
// Print the graph in an adjacency list form.
// Throws and std::string if the graph is empty.
void adjList(const bool & best_format = true) const;
// Print the graph by vertices in BFS order.
// Throws and std::string if the graph is empty.
void printBFS(const T & root_vtx);
// Performs a DFS, boolean decides whether or not
// the function should print.
void DFS(const bool & print = false);
// Perform a topological sort then report the ordering.
void topSortPrint();
// Performs the Strongly Connected Components Algorithm
// and prints the SCC.
void SCCprint();
// Returns what type of graph this is.
GRAPH_TYPE getType() const;
// Returns true for an empty graph, false otherwise.
bool empty() const;
// Print Vertex Cover
void printVertexCover();
// Prints Vertex Cover with random edge choice.
void randVertexCover();
// Brute force minimum vertex cover.
void minVertexCover() const;
};
#include "Graph.cpp"
#endif
// End of Graph.h | [
"justinv9001@aol.com"
] | justinv9001@aol.com |
6e94b287ece3245e1aa03a9cfb932cbd2aa29c8b | 6c0f8abb26f9832eb7ab00901f470d001be4af32 | /util/FirstReader.cc | 5041d042f99baf5d12981f07114ef247380bba03 | [
"MIT"
] | permissive | erikleitch/climax | 146a6bf69b04f0df8879e77ea4529b4c269015a5 | 66ce64b0ab9f3a3722d3177cc5215ccf59369e88 | refs/heads/master | 2021-07-19T17:17:22.524714 | 2021-02-02T17:17:35 | 2021-02-02T17:17:35 | 57,599,379 | 1 | 2 | null | null | null | null | UTF-8 | C++ | false | false | 5,342 | cc | #include "gcp/util/Exception.h"
#include "gcp/util/FirstReader.h"
#include "gcp/util/LogStream.h"
#include "gcp/util/String.h"
#include <iomanip>
using namespace std;
using namespace gcp::util;
Angle FirstReader::eps_ =
Angle(Angle::ArcSec(), 0.1);
// The restoring beam for FIRST is 6.4x5.4 arcseconds (in the north),
// according to the FIRST web pages
Angle FirstReader::northResMaj_ =
Angle(Angle::ArcSec(), 5.4);
Angle FirstReader::northResMin_ =
Angle(Angle::ArcSec(), 5.4);
// Below +4:33:21, the beam is elliptical, 6.4x5.4
Angle FirstReader::medianDecLimit_ =
Angle("4:33:21");
Angle FirstReader::medianResMaj_ =
Angle(Angle::ArcSec(), 6.4);
Angle FirstReader::medianResMin_ =
Angle(Angle::ArcSec(), 5.4);
// Below -2:30:25, the beam is elliptical, 6.4x5.4
Angle FirstReader::southDecLimit_ =
Angle("-2:30:25");
Angle FirstReader::southResMaj_ =
Angle(Angle::ArcSec(), 6.8);
Angle FirstReader::southResMin_ =
Angle(Angle::ArcSec(), 5.4);
/**.......................................................................
* Constructor.
*/
FirstReader::FirstReader() {}
/**.......................................................................
* Destructor.
*/
FirstReader::~FirstReader() {}
/**.......................................................................
* Apply FIRST corrections
*/
void FirstReader::applyCorrections(PtSrcReader::Source& src)
{
// Set synthesized beam parameters
setRestoringBeam(src);
// Now set up errors
// Empirical expression for the SNR (from FIRST catalog web pages)
double snr = (src.peak_.mJy() - 0.25) / src.rms_.mJy();
// Construct the average beam for uncertainty calculations
double avBeam = sqrt(src.resMin_.arcsec() * src.resMaj_.arcsec());
// FIRST gives an empirical expression for the positional error
// along the axes of the fitted ellipse. Since these will all be
// tiny anyway, I'll just use a single positional error estimated
// from the mean of the two axes.
setPositionErrors(src);
// Error in the sizes is given by the following empirical formula
if(src.decMin_ < eps_) {
src.decMin_ = src.fitMin_;
src.decMinErr_.setArcSec(-1);
} else {
setSizeError(src, src.decMin_, src.decMinErr_);
}
if(src.decMaj_ < eps_) {
src.decMaj_ = src.fitMaj_;
src.decMajErr_.setArcSec(-1);
} else {
setSizeError(src, src.decMaj_, src.decMajErr_);
}
// No sensible errors are given for either the peak value or the
// integrated flux. However, the FIRST catalog description states
// that "For bright sources the accuracies of Fpeak and Fint are
// limited to about 5% by systematic effects". I will take this
// latter as the error on both, as a conservative estimate of the
// error on the flux values.
src.peakErr_.setJy(sqrt((0.05 * 0.05) * src.peak_.Jy() * src.peak_.Jy() +
src.rms_.Jy() * src.rms_.Jy()));
src.intErr_.setJy(sqrt((0.05 * 0.05) * src.int_.Jy() * src.int_.Jy() +
src.rms_.Jy() * src.rms_.Jy()));
// Set all other errors to zero - we don't know what they are:
src.fitMinErr_.setArcSec(0.0);
src.fitMajErr_.setArcSec(0.0);
src.fitPaErr_.setDegrees(0.0);
}
/**.......................................................................
* Set the size error for an axis
*/
void FirstReader::
setSizeError(PtSrcReader::Source& src, Angle& axis, Angle& error)
{
double snr = getSnr(src);
Angle avBeam = getAvBeam(src);
double psiF = sqrt(avBeam.arcsec() * avBeam.arcsec() + axis.arcsec() * axis.arcsec());
double sigmaF = psiF * (1.0/snr + 1.0/75);
double rat = axis.arcsec()/avBeam.arcsec();
double rat2 = rat * rat;
double fac = avBeam.arcsec()/(2 * sigmaF);
double prefac = sqrt(avBeam.arcsec() * sigmaF/2);
error.setArcSec(prefac * (1.0 + rat2 + sqrt(fac) * rat2*rat2)/(1.0 + fac * rat2 * rat2));
}
/**.......................................................................
* Set the appropriate restoring beam
*/
void FirstReader::setRestoringBeam(PtSrcReader::Source& src)
{
if(src.dec_ < southDecLimit_) {
src.resMaj_ = southResMaj_;
src.resMin_ = southResMin_;
} else if(src.dec_ < medianDecLimit_) {
src.resMaj_ = medianResMaj_;
src.resMin_ = medianResMin_;
} else {
src.resMaj_ = northResMaj_;
src.resMin_ = northResMin_;
}
}
/**.......................................................................
* Get the SNR for this source
*/
double FirstReader::getSnr(PtSrcReader::Source& src)
{
return (src.peak_.mJy() - 0.25) / src.rms_.mJy();
}
/**.......................................................................
* Construct the average beam for uncertainty calculations
*/
Angle FirstReader::getAvBeam(PtSrcReader::Source& src)
{
Angle avBeam;
avBeam.setArcSec(sqrt(src.resMin_.arcsec() * src.resMaj_.arcsec()));
return avBeam;
}
/**.......................................................................
* Set position errors
*/
void FirstReader::setPositionErrors(PtSrcReader::Source& src)
{
Angle avBeam = getAvBeam(src);
double snr = getSnr(src);
double minPosErr = sqrt(avBeam.arcsec() * avBeam.arcsec() +
src.decMin_.arcsec() * src.decMin_.arcsec()) *
(1.0/snr + 1.0/20);
double majPosErr = sqrt(avBeam.arcsec() * avBeam.arcsec() +
src.decMaj_.arcsec() * src.decMaj_.arcsec()) *
(1.0/snr + 1.0/20);
}
| [
"eleitch@basho.com"
] | eleitch@basho.com |
193f9f65acee6eb92ad47e6af92d46a798c75cb8 | 8840b1bd8200f6830fdfc2e1d1723a28ae20c9df | /custom_external_libraries/geomod/geometry/tmesh/iterativerefinement.cpp | 185532c621ac4861f2f60df1fa8b601a21c35581 | [
"LicenseRef-scancode-unknown-license-reference",
"MIT"
] | permissive | vryy/isogeometric_application | d6c5e99f83809ccd8d4c0f3729fbe59d7b7579bf | b36d7bc11290598eece96fb08af582829a7507e6 | refs/heads/master | 2023-08-05T00:11:07.318998 | 2023-07-22T11:47:41 | 2023-07-22T11:47:41 | 71,111,403 | 2 | 6 | NOASSERTION | 2023-09-02T21:18:28 | 2016-10-17T07:28:23 | C++ | ISO-8859-1 | C++ | false | false | 6,852 | cpp | #include "iterativerefinement.h"
using namespace std;
using namespace geomodcore;
IterativeRefinement::IterativeRefinement(const unsigned int maxRefineDepth) : maxDepth(maxRefineDepth)
{
}
SimpleTMesh<>* IterativeRefinement::refine(const BSplineSurface& bspline)
{
cout << "Diskretisierung der B-Spline-Fläche ... ";
const Grid* const bsplineSurfaceDisc = bspline.getDiscretization(REFINEMENT_DISCRETIZATION_SIZE, REFINEMENT_DISCRETIZATION_SIZE);
cout << " fertig." << endl;
const unsigned int cols = bspline.getGridConstRef().getCols();
const unsigned int rows = bspline.getGridConstRef().getRows();
vector<GPoint*> points;
points.push_back(new GPoint(*bspline.getGridConstRef().getControlPointConstRef(0,0)));
// points.push_back(new GPoint(*bspline.getGridConstRef().getControlPointConstRef((cols-1)/2,0)));
points.push_back(new GPoint(*bspline.getGridConstRef().getControlPointConstRef(cols-1,0)));
// points.push_back(new GPoint(*bspline.getGridConstRef().getControlPointConstRef(0,(rows-1)/2)));
// points.push_back(new GPoint(*bspline.getGridConstRef().getControlPointConstRef((cols-1)/2,(rows-1)/2)));
// points.push_back(new GPoint(*bspline.getGridConstRef().getControlPointConstRef(cols-1,(rows-1)/2)));
points.push_back(new GPoint(*bspline.getGridConstRef().getControlPointConstRef(0,rows-1)));
// points.push_back(new GPoint(*bspline.getGridConstRef().getControlPointConstRef((cols-1)/2,rows-1)));
points.push_back(new GPoint(*bspline.getGridConstRef().getControlPointConstRef(cols-1,rows-1)));
SimpleTMesh<>* tmesh = new SimpleTMesh<>(bspline.getGridConstRef());
const AffTransformP T = { cols, 0, 0, 0, rows, 0 };
tmesh->transformI(T);
// TODO
cout << "Speichere SimpleTMesh nach Transformation" << endl;
tmesh->toFile("C:/Users/asche/Desktop/refine.txt");
TSplineSurface<> tspline(*tmesh);
double maxError = MAXDOUBLE;
unsigned int* x = new unsigned int;
unsigned int* y = new unsigned int;
for (unsigned int d = 0; d <= maxDepth; d++)
{
const unsigned int n = 1 << d;
cout << "n = " << n << endl;
for (unsigned int i = 0; i < n * n; i++)
{
HilbertCurve::d2xy(n, i, x, y);
const unsigned int u = (cols / n * *x) + (cols >> (d+1));
const unsigned int v = (rows / n * *y) + (rows >> (d+1));
SimpleTMesh<>* tmeshBeforeRefinement = new SimpleTMesh<>(*tmesh);
IPoint refineIPt = {u,v};
tmesh->refineByImage(refineIPt);
TSplineSurface<> tSplineSurfaceRefined(*tmesh);
const Grid* const tsplineSurfaceDisc = tSplineSurfaceRefined.getDiscretization(REFINEMENT_DISCRETIZATION_SIZE, REFINEMENT_DISCRETIZATION_SIZE);
double newError = diff(*bsplineSurfaceDisc, *tsplineSurfaceDisc);
if ( newError > maxError ) {
delete tmesh;
tmesh = tmeshBeforeRefinement;
} else {
cout << "Optimierung: " << newError << endl;
maxError = newError;
delete tmeshBeforeRefinement;
tmesh->toFile("C:/Users/asche/Desktop/refine.txt");
}
delete tsplineSurfaceDisc;
cout << "***" << d << " " << i << endl;
}
tmesh->toFile("C:/Users/asche/Desktop/refine.txt");
}
delete bsplineSurfaceDisc;
cout << "Globaler Fehler: " << maxError << endl;
return tmesh;
}
double IterativeRefinement::diff(const Grid& grid1, const Grid& grid2) const
{
assert((grid1.getCols() == grid2.getCols()) && (grid1.getRows() == grid2.getRows()));
const int cols = grid1.getCols();
const int rows = grid1.getRows();
double maxError = MINDOUBLE;
double globalError = 0.0;
const double xStart = min(grid1.getControlPointConstRef(0, 0)->at(0), grid1.getControlPointConstRef(cols - 1, rows - 1)->at(0));
const double yStart = min(grid1.getControlPointConstRef(0, 0)->at(1), grid1.getControlPointConstRef(cols - 1, rows - 1)->at(1));
const double xEnd = max(grid1.getControlPointConstRef(0, 0)->at(0), grid1.getControlPointConstRef(cols - 1, rows - 1)->at(0));
const double yEnd = max(grid1.getControlPointConstRef(0, 0)->at(1), grid1.getControlPointConstRef(cols - 1, rows - 1)->at(1));
const double dx = (xEnd - xStart) / cols;
const double dy = (yEnd - yStart) / rows;
int count = 0;
bool hasNullPointsGrid1 = false;
bool hasNullPointsGrid2 = false;
for (vector<GPoint*>::const_iterator pIt = grid1.getControlPointsConstRef().cbegin(); pIt != grid1.getControlPointsConstRef().cend(); pIt++)
{
hasNullPointsGrid1 = hasNullPointsGrid1 | (*pIt == nullptr);
}
for (vector<GPoint*>::const_iterator pIt = grid2.getControlPointsConstRef().cbegin(); pIt != grid2.getControlPointsConstRef().cend(); pIt++)
{
hasNullPointsGrid2 = hasNullPointsGrid2 | (*pIt == nullptr);
}
if (hasNullPointsGrid1 == false && hasNullPointsGrid2 == false)
{
cout << "Berechne schnelle Shephard-Interpolation...";
#pragma omp parallel for reduction(+:globalError), reduction(+:count)
for (int i = 0; i < (int) grid1.getControlPointsConstRef().size(); i++)
{
const GPoint& p = *grid1.getControlPointsConstRef()[i];
double x = p[0];
double y = p[1];
const double z1 = shepardInterpolationWithoutNulls(grid1, x, y);
const double z2 = shepardInterpolationWithoutNulls(grid2, x, y);
const double e = (z1 - z2);
maxError = max(e * e, maxError);
globalError += (e * e);
#pragma omp atomic
count++;
}
} else {
cout << "Berechne Shephard-Interpolation...";
for (int i = 0; i < (int) grid1.getControlPointsConstRef().size(); i++)
{
const GPoint* const p1 = grid1.getControlPointsConstRef()[i];
const GPoint* const p2 = grid2.getControlPointsConstRef()[i];
const double z1 = (p1 != nullptr ? (*p1)[2] : 0);
const double z2 = (p2 != nullptr ? (*p2)[2] : 0);
const double e = (z1 - z2);
maxError = max(e * e, maxError);
globalError += (e * e);
count++;
}
}
cout << "fertig." << endl;
globalError = sqrt(globalError) / count;
return globalError;
}
double IterativeRefinement::shepardInterpolation(const Grid& grid, double x, double y) const
{
double z = 0.0;
double D = 0.0;
for (vector<GPoint*>::const_iterator pIt = grid.getControlPointsConstRef().cbegin(); pIt != grid.getControlPointsConstRef().cend(); pIt++)
{
const GPoint* const p = *pIt;
if (p != nullptr) {
const double d = 1.0 / (pow((*p)[0] - x, 4.0) + pow((*p)[1] - y, 4.));
D += d;
z += (*p)[2] * d;
}
}
return z / D;
}
double IterativeRefinement::shepardInterpolationWithoutNulls(const Grid& grid, double x, double y) const
{
double z = 0.0;
double D = 0.0;
for (vector<GPoint*>::const_iterator pIt = grid.getControlPointsConstRef().cbegin(); pIt != grid.getControlPointsConstRef().cend(); pIt++)
{
const GPoint* const p = *pIt;
const double d = 1.0 / (pow((*p)[0] - x, 4.0) + pow((*p)[1] - y, 4.));
D += d;
z += (*p)[2] * d;
}
return z / D;
}
| [
"hgbk2008@gmail.com"
] | hgbk2008@gmail.com |
23b1482cdbac64b64e17207098dc90d3cb87aa35 | 196745c4101f547a6cbef69f3d36d63f52adfdf5 | /oldsrc/StatTracker.cpp | 77a3cccc47fee30ec03e8ac2addccf78f6a883f1 | [] | no_license | sfisherjr/Poker | 46147154efa9452a8251d8984fa7536be5434854 | e29c516f099579d0320e46f7ce30c366fe4d5a29 | refs/heads/master | 2020-06-05T10:37:46.640531 | 2015-05-04T22:05:49 | 2015-05-04T22:05:49 | 35,146,150 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 529 | cpp | #include "StatTracker.h"
using namespace std;
StatTracker::Stats StatTracker::trackedStats;
StatTracker::StatTracker()
{
}
void StatTracker::printStats()
{
cout << "Stats\n";
cout << "Your Wins: " << trackedStats.playerWins << endl;
cout << "Dealer Wins: " << trackedStats.dealerWins << endl;
cout << "Total Pushes: " << trackedStats.totalPushes << endl;
cout << "Total Games: " << trackedStats.totalGames << endl;
cout << "Your Money: $" << trackedStats.playerMoney << endl << endl;
}
StatTracker::~StatTracker()
{
}
| [
"phantomfury409@gmail.com"
] | phantomfury409@gmail.com |
9a98216c8251fdf6fc871ae63403b0582dbf427f | 97443939c1e5f4395184ae4dce3b133dfaac4844 | /compiler-rt/test/xray/TestCases/Posix/redirection-instrument.cpp | 9dbc82c6ee01245d5db92bcf652f1ae4468740b4 | [
"NCSA",
"MIT",
"LLVM-exception",
"Apache-2.0"
] | permissive | halo-project/llvm | 667f461a76939364380a7524aecd203180af92b4 | fb237252210ec00d1c1454fbd2f304ca26cd9ece | refs/heads/master | 2021-07-19T16:21:47.632792 | 2020-08-27T19:39:25 | 2020-08-27T19:39:25 | 193,966,521 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,177 | cpp | // Simple single-threaded test of the interaction between instrumentation and
// redirection.
//
// RUN: %clangxx_xray -std=c++11 %s -o %t
// RUN: XRAY_OPTIONS="patch_premain=false verbosity=1" %run %t 2>&1 | FileCheck %s
// RUN: %clangxx_xray -std=c++11 -fpic -fpie %s -o %t
// RUN: XRAY_OPTIONS="patch_premain=false verbosity=1" %run %t 2>&1 | FileCheck %s
// FIXME: Support this in non-x86_64 as well
// REQUIRES: x86_64-linux
// REQUIRES: built-in-llvm-tree
#include <cstdio>
#include <cstdlib>
#include "xray/xray_interface.h"
// if `original` is inlined, xray will not be used.
#define NO_INLINE __attribute__((noinline))
[[clang::xray_always_instrument]] NO_INLINE void original() {
printf("ORIGINAL.\n");
}
[[clang::xray_always_instrument]] NO_INLINE void somethingElse() {
printf("SOMETHING ELSE.\n");
}
void different() {
printf("DIFFERENT.\n");
}
void myhandler(int32_t funcID, XRayEntryType kind) {
if (kind == ENTRY) {
printf("entered function.\n");
} else if (kind == EXIT) {
printf("exited function.\n");
} else {
printf("unexpected entry type!\n");
}
}
int main() {
size_t maxID = __xray_max_function_id();
if (maxID == 0)
return 1;
XRayRedirectionEntry* table = (XRayRedirectionEntry*) std::calloc(maxID, sizeof(XRayRedirectionEntry));
__xray_set_redirection_table(table);
// find the entry corresponding ID for the original function
size_t id = 0;
for (; id < maxID; id++)
if (__xray_function_address(id) == (uintptr_t) &original)
break;
if (id == maxID)
return 2;
// setup
table[id].Redirection = (uintptr_t) &different;
__xray_set_handler(myhandler);
/////////////
// test function-specific redirection and patching/unpatching.
__xray_patch_function(id);
original();
// CHECK: entered function.
// CHECK-NEXT: ORIGINAL.
// CHECK-NEXT: exited function.
// enable redirection.
__xray_redirect_function(id);
original();
original();
// CHECK-NEXT: DIFFERENT.
// CHECK-NEXT: DIFFERENT.
// undo the redirect via table write.
// this ensures that enabling redirection unpatches exit sleds in that function.
table[id].Redirection = 0;
original();
original();
// CHECK-NEXT: ORIGINAL.
// CHECK-NEXT: ORIGINAL.
///////
// test function specific patching, but global patching / unpatching.
// redo redirection via table write.
table[id].Redirection = (uintptr_t) &different;
original();
// CHECK-NEXT: DIFFERENT.
somethingElse();
// CHECK-NEXT: SOMETHING ELSE.
// patch over top everything.
__xray_patch();
original();
// CHECK-NEXT: entered function.
// CHECK-NEXT: ORIGINAL.
// CHECK-NEXT: exited function.
somethingElse();
// CHECK-NEXT: entered function.
// CHECK-NEXT: SOMETHING ELSE.
// CHECK-NEXT: exited function.
// redirect only `original`
__xray_redirect_function(id);
original();
// CHECK-NEXT: DIFFERENT.
somethingElse();
// CHECK-NEXT: entered function.
// CHECK-NEXT: SOMETHING ELSE.
// CHECK-NEXT: exited function.
// unpatch everything.
__xray_unpatch();
original();
// CHECK-NEXT: ORIGINAL.
somethingElse();
// CHECK-NEXT: SOMETHING ELSE.
return 0;
}
| [
"kavon@farvard.in"
] | kavon@farvard.in |
6e0d9a343aaedddad76d1cec22abb344d764cfd5 | ea34c76a8434e34615b5e145db83382754b584ae | /Deps/PG/PropertyMaps.h | b0ff5336e95f7e626c2703aa8f8999b9ff3e5f12 | [] | no_license | xDusk/lostisland04 | bd4f35da19b8a83dda3bae4f6d9460279964d25a | c5fe1d75d3772064fdace43d36f9ce530e715041 | refs/heads/master | 2020-05-29T11:10:57.376119 | 2012-06-23T16:26:47 | 2012-06-23T16:26:47 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 10,331 | h | /*-------------------------------------------------------------------------------------
Copyright (c) 2006 John Judnich
This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software.
Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
-------------------------------------------------------------------------------------*/
#ifndef __PropertyMaps_H__
#define __PropertyMaps_H__
#include <OgrePrerequisites.h>
#include <OgrePixelFormat.h>
#include <OgreColourValue.h>
#include <OgreRoot.h>
#include <OgreRenderSystem.h>
namespace Forests
{
/** \brief Specifies which color channel(s) to extract from an image */
enum MapChannel
{
/// Use only the image's red color channel
CHANNEL_RED,
/// Use only the image's green color channel
CHANNEL_GREEN,
/// Use only the image's blue color channel
CHANNEL_BLUE,
/// Use only the image's alpha channel
CHANNEL_ALPHA,
/// Use the image's full RGB color information
CHANNEL_COLOR
};
/** \brief Specifies the filtering method used to interpret property maps */
enum MapFilter
{
/// Use no filtering - fast, but may appear blocky
MAPFILTER_NONE,
/// Use bilinear filtering - slower, but will appear less blocky
MAPFILTER_BILINEAR
};
/** \brief A 2D greyscale image that is assigned to a certain region of your world to represent density levels.
This class is used by various PagedLoader's internally, so it's not necessary to learn anything about this class.
However, you can achieve more advanced effects through the DensityMap class interface than you can with the standard
GrassLayer density map functions, for example.
Probably the most useful function in this class is getPixelBox(), which you can use to directly manipulate the
density map pixels in real-time. */
class DensityMap
{
public:
static DensityMap *load(const Ogre::String &fileName, MapChannel channel = CHANNEL_COLOR);
static DensityMap *load(Ogre::TexturePtr texture, MapChannel channel = CHANNEL_COLOR);
void unload();
/** \brief Sets the filtering mode used for this density map
This function can be used to set the filtering mode used for your density map. By default,
bilinear filtering is used (MAPFILTER_BILINEAR). If you disable filtering by using MAPFILTER_NONE,
the resulting effect of the density map may look square and blocky, depending on the resolution of
the map.
MAPFILTER_NONE is slightly faster than MAPFILTER_BILINEAR, so use it if you don't notice any
considerable blockyness. */
void setFilter(MapFilter filter)
{
this->filter = filter;
}
/** \brief Returns the filtering mode being used for this density map */
MapFilter getFilter()
{
return filter;
}
/** \brief Gets a pointer to the pixel data of the density map
You can use this function to access the pixel data of the density map. The PixelBox
returned is an image in PF_BYTE_L (aka. PF_L8) byte format. You can modify this image
any way you like in real-time, so long as you do not change the byte format.
This function is useful in editors where the density map needs to be changed dynamically.
Note that although you can change this map in real-time, the changes won't be uploaded to your
video card until you call PagedGeometry::reloadGeometry(). If you don't, the grass you see
will remain unchanged. */
Ogre::PixelBox getPixelBox()
{
assert(pixels);
return *pixels;
}
/** \brief Gets the density level at the specified position
The boundary given defines the area where this density map takes effect.
Normally this is set to your terrain's bounds so the density map is aligned
to your heightmap, but you could apply it anywhere you want. */
inline float getDensityAt(float x, float z, const Ogre::TRect<Ogre::Real> &mapBounds)
{
if(filter == MAPFILTER_NONE)
{
return _getDensityAt_Unfiltered(x, z, mapBounds);
}
else
{
return _getDensityAt_Bilinear(x, z, mapBounds);
}
}
float _getDensityAt_Unfiltered(float x, float z, const Ogre::TRect<Ogre::Real> &mapBounds);
float _getDensityAt_Bilinear(float x, float z, const Ogre::TRect<Ogre::Real> &mapBounds);
private:
DensityMap(Ogre::TexturePtr texture, MapChannel channel);
~DensityMap();
static std::map<Ogre::String, DensityMap*> selfList;
Ogre::String selfKey;
Ogre::uint32 refCount;
MapFilter filter;
Ogre::PixelBox *pixels;
};
/** \brief A 2D greyscale image that is assigned to a certain region of your world to represent color levels.
This class is used by various PagedLoader's internally, so it's not necessary to learn anything about this class.
However, you can achieve more advanced effects through the ColorMap class interface than you can with the standard
GrassLayer color map functions, for example.
Probably the most useful function in this class is getPixelBox(), which you can use to directly manipulate the
color map pixels in real-time. */
class ColorMap
{
public:
static ColorMap *load(const Ogre::String &fileName, MapChannel channel = CHANNEL_COLOR);
static ColorMap *load(Ogre::TexturePtr texture, MapChannel channel = CHANNEL_COLOR);
void unload();
/** \brief Sets the filtering mode used for this color map
This function can be used to set the filtering mode used for your color map. By default,
bilinear filtering is used (MAPFILTER_BILINEAR). If you disable filtering by using
MAPFILTER_NONE, the resulting coloration may appear slightly pixelated, depending on the
resolution of the map.
MAPFILTER_NONE is slightly faster than MAPFILTER_BILINEAR, so use it if you don't notice any
considerable pixelation. */
void setFilter(MapFilter filter)
{
this->filter = filter;
}
/** \brief Returns the filtering mode being used for this color map */
MapFilter getFilter()
{
return filter;
}
/** \brief Gets a pointer to the pixel data of the color map
You can use this function to access the pixel data of the color map. The PixelBox
returned is an image in PF_A8R8G8B8 format when running with DirectX, and PF_A8B8G8R8
when running with OpenGL. You can modify this image any way you like in
real-time, so long as you do not change the byte format.
This function is useful in editors where the color map needs to be changed dynamically.
Note that although you can change this map in real-time, the changes won't be uploaded to your
video card until you call PagedGeometry::reloadGeometry(). If you don't, the grass you see
will remain unchanged. */
Ogre::PixelBox getPixelBox()
{
assert(pixels);
return *pixels;
}
/** \brief Gets the color value at the specified position
A RenderSystem-specific 32-bit packed color value is used, so it can be fed directly to
the video card.
The boundary given defines the area where this color map takes effect.
Normally this is set to your terrain's bounds so the color map is aligned
to your heightmap, but you could apply it anywhere you want. */
inline Ogre::uint32 getColorAt(float x, float z, const Ogre::TRect<Ogre::Real> &mapBounds)
{
if(filter == MAPFILTER_NONE)
{
return _getColorAt(x, z, mapBounds);
}
else
{
return _getColorAt_Bilinear(x, z, mapBounds);
}
}
/** \brief Gets the color value at the specified position
The unpacks the 32-bit color value into an Ogre::ColourValue and returns it. */
inline Ogre::ColourValue getColorAt_Unpacked(float x, float z, const Ogre::TRect<Ogre::Real> &mapBounds)
{
Ogre::uint32 c;
if(filter == MAPFILTER_NONE)
{
c = _getColorAt(x, z, mapBounds);
}
else
{
c = _getColorAt_Bilinear(x, z, mapBounds);
}
Ogre::Real r, g, b, a;
static Ogre::VertexElementType format = Ogre::Root::getSingleton().getRenderSystem()->getColourVertexElementType();
if(format == Ogre::VET_COLOUR_ARGB)
{
b = ((c) & 0xFF) / 255.0f;
g = ((c >> 8) & 0xFF) / 255.0f;
r = ((c >> 16) & 0xFF) / 255.0f;
a = ((c >> 24) & 0xFF) / 255.0f;
}
else
{
r = ((c) & 0xFF) / 255.0f;
g = ((c >> 8) & 0xFF) / 255.0f;
b = ((c >> 16) & 0xFF) / 255.0f;
a = ((c >> 24) & 0xFF) / 255.0f;
}
return Ogre::ColourValue(r, g, b, a);
}
private:
ColorMap(Ogre::TexturePtr map, MapChannel channel);
~ColorMap();
static std::map<Ogre::String, ColorMap*> selfList;
Ogre::String selfKey;
Ogre::uint32 refCount;
//Directly interpolates two Ogre::uint32 colors
Ogre::uint32 _interpolateColor(Ogre::uint32 color1, Ogre::uint32 color2, float ratio, float ratioInv);
//Returns the color map value at the given location
Ogre::uint32 _getColorAt(float x, float z, const Ogre::TRect<Ogre::Real> &mapBounds);
//Returns the color map value at the given location with bilinear filtering
Ogre::uint32 _getColorAt_Bilinear(float x, float z, const Ogre::TRect<Ogre::Real> &mapBounds);
MapFilter filter;
Ogre::PixelBox *pixels;
Ogre::TRect<Ogre::Real> mapBounds;
};
}
#endif | [
"zzgodlikezz@gmail.com"
] | zzgodlikezz@gmail.com |
3ccbb9b98f96856621db5d7027668b4d97b2d14e | 52c1d8179aaa24ae0e77458db6b490944117e028 | /GH Injector Library/Manual Mapping.h | ce87a1d739ccae9adb48b1514d621274fa026786 | [] | no_license | Broihon/GH-Injector-Library | 76a9618dbb905d5ea7253843754ea4587e0c9825 | e7c4a6acaf2df8baa5499457330a82b936fc7346 | refs/heads/master | 2023-06-21T19:41:46.763691 | 2023-02-23T15:33:53 | 2023-02-23T15:33:53 | 249,303,422 | 755 | 184 | null | 2023-07-24T23:28:35 | 2020-03-23T00:57:37 | C++ | UTF-8 | C++ | false | false | 526 | h | #pragma once
#include "Manual Mapping Internal.h"
#define MIN_SHIFT_OFFSET 0x100
#define MAX_SHIFT_OFFSET 0x1000
namespace MMAP_NATIVE
{
DWORD ManualMap(const INJECTION_SOURCE & DllPath, HANDLE hTargetProc, LAUNCH_METHOD Method, DWORD Flags, HINSTANCE & hOut, DWORD Timeout, ERROR_DATA & error_data);
}
#ifdef _WIN64
namespace MMAP_WOW64
{
DWORD ManualMap_WOW64(const INJECTION_SOURCE & DllPath, HANDLE hTargetProc, LAUNCH_METHOD Method, DWORD Flags, HINSTANCE & hOut, DWORD Timeout, ERROR_DATA & error_data);
}
#endif | [
"konradherrmann@t-online.de"
] | konradherrmann@t-online.de |
6308f86fefb02df0a725f2b37e4c6d021a9443c7 | ce1044f6dd1ab23aed435dd087283ece45f3f024 | /src/Common/ShutdownManager.cpp | cde27e849ca5f95b2b3853ccda131a2d183efc9d | [
"MIT"
] | permissive | 1div0/GrinPlusPlus | daf13ff87681903e0674d1f077f17d3730eebcba | 44ba6474b971cd39a96b7ad9742b23d3cb5334c9 | refs/heads/master | 2021-07-12T20:23:20.039838 | 2020-12-02T11:18:41 | 2020-12-02T11:18:41 | 221,024,351 | 0 | 0 | MIT | 2019-11-11T16:37:06 | 2019-11-11T16:37:05 | null | UTF-8 | C++ | false | false | 1,113 | cpp | #include <Common/ShutdownManager.h>
#include <Common/Logger.h>
#include <csignal>
#include <atomic>
class ShutdownManager
{
public:
static ShutdownManager& GetInstance();
inline const std::atomic_bool& WasShutdownRequested() const { return m_shutdownRequested; }
inline void Shutdown() { m_shutdownRequested = true; }
private:
mutable std::atomic_bool m_shutdownRequested = { false };
};
ShutdownManager& ShutdownManager::GetInstance()
{
static ShutdownManager instance;
return instance;
}
static void SigIntHandler(int signum)
{
printf("\n\n%d signal received\n\n", signum);
ShutdownManager::GetInstance().Shutdown();
}
namespace ShutdownManagerAPI
{
SHUTDOWN_MANAGER_API void RegisterHandlers()
{
signal(SIGINT, SigIntHandler);
signal(SIGTERM, SigIntHandler);
signal(SIGABRT, SigIntHandler);
signal(9, SigIntHandler);
}
SHUTDOWN_MANAGER_API const std::atomic_bool& WasShutdownRequested()
{
return ShutdownManager::GetInstance().WasShutdownRequested();
}
SHUTDOWN_MANAGER_API void Shutdown()
{
LOG_INFO("Shutdown requested");
ShutdownManager::GetInstance().Shutdown();
}
}; | [
"davidburkett38@gmail.com"
] | davidburkett38@gmail.com |
7eaad066cddcb119910642a268fadd0ba1b8df37 | b8376621d63394958a7e9535fc7741ac8b5c3bdc | /lib/lib_poco/Foundation/poco_Foundation/stdafx.cpp | 1fbe262c3d00e77fde27e84065d5da213c7fb7ca | [
"BSL-1.0"
] | permissive | 15831944/job_mobile | 4f1b9dad21cb7866a35a86d2d86e79b080fb8102 | ebdf33d006025a682e9f2dbb670b23d5e3acb285 | refs/heads/master | 2021-12-02T10:58:20.932641 | 2013-01-09T05:20:33 | 2013-01-09T05:20:33 | null | 0 | 0 | null | null | null | null | UHC | C++ | false | false | 337 | cpp | // stdafx.cpp : 표준 포함 파일만 들어 있는 소스 파일입니다.
// template_vc2010_dll.pch는 미리 컴파일된 헤더가 됩니다.
// stdafx.obj에는 미리 컴파일된 형식 정보가 포함됩니다.
#include "stdafx.h"
// TODO: 필요한 추가 헤더는
// 이 파일이 아닌 STDAFX.H에서 참조합니다.
| [
"whdnrfo@gmail.com"
] | whdnrfo@gmail.com |
8d96735f4ecb75b1577175f68105fd5a0260a464 | a5419164a76c74754793e80fe963e510e151452d | /leetcode_526.cpp | 1a912d424b67d8fddd0c03ee2afde8b73e903fdb | [] | no_license | Gazella019/Leetcode | aed66a349a0f1aed60eba2e9aa66b25b8b47152b | 761468170026d243ac8c06c74600979f75508c36 | refs/heads/main | 2023-03-11T08:58:39.274460 | 2021-02-27T03:07:39 | 2021-02-27T03:07:39 | 342,758,173 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 626 | cpp |
class Solution {
public:
int res = 0;
int countArrangement(int N) {
vector<int> v(N, 0);
vector<int> vis(N+1, 0);
dfs(v, vis, 0, N);
return res;
}
void dfs(vector<int>& v, vector<int>& vis, int n, int N){
if(n == N){
res ++;
for(int i=0;i<v.size();i++){
cout << v[i] << " ";
}
cout << endl;
return;
}
for(int i=1;i<=N;i++){
if(vis[i] == 1)
continue;
if(i%(n+1) == 0 || (n+1)%i == 0){
v[n] = i;
vis[i] = 1;
dfs(v, vis, n+1, N);
vis[i] = 0;
}
}
}
}; | [
"edison19951219@gmail.com"
] | edison19951219@gmail.com |
3238da663e28b258bd290ac5ae0f67a8f24c3fd9 | 93b16b81eaa63c9f0695ab179dfc3f636b0bf3fe | /coins.ino | c8ffb82c17968f85b938e6fe218bf4d50467aa2a | [] | no_license | sungtaerim/coins | 9eecc1b6ef57add08bb4060b764d1c73cbf3d4b0 | 58373dfb5f74b19e7bb59daf3d2aed73da602921 | refs/heads/master | 2023-05-31T06:52:34.266846 | 2021-06-18T11:20:53 | 2021-06-18T11:20:53 | 378,116,160 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,591 | ino | #include <LiquidCrystal.h>
#include "EEPROMex.h"
#include "LCD_1602_RUS.h"
#define LED 8
#define IRpin 10
#define IRsens A0
#define coin_amount 5
#define button 7
float coin_value[coin_amount] = {0.5, 1.0, 2.0, 5.0, 10.0};
String currency = "RUB";
LiquidCrystal lcd(11, 12, 5, 4, 3, 2);
int coin_signal[coin_amount];
int coin_quantity[coin_amount];
int empty_signal = 300;
unsigned long standby_timer, reset_timer;
float summ_money = 0;
boolean recogn_flag, sleep_flag = true;
int sens_signal, last_sens_signal;
boolean coin_flag = false;
void setup() {
lcd.begin(16, 2);
pinMode(button, INPUT);
pinMode(LED, OUTPUT);
digitalWrite(LED, HIGH);
Serial.begin(9600);
pinMode(IRpin, OUTPUT);
digitalWrite(IRpin, 1);
// === НАЧАЛО РАБОТЫ ===
lcd.clear();
lcd.setCursor(3, 0);
lcd.print("Servis");
delay(500);
reset_timer = millis();
while (1) {
for (byte i = 0; i < coin_amount; i++) {
coin_quantity[i] = 0;
EEPROM.writeInt(20 + i * 2, 0);
}
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Memory clear");
delay(100);
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Calibrovka");
break;
}
empty_signal = analogRead(IRsens);
Serial.print("empty_signal = ");
Serial.println(empty_signal);
while (1) {
for (byte i = 0; i < coin_amount; i++) {
lcd.setCursor(0, 1); lcd.print(coin_value[i]);
lcd.setCursor(13, 1); lcd.print(currency);
empty_signal = analogRead(IRsens);
last_sens_signal = empty_signal;
while (1) {
sens_signal = analogRead(IRsens);
Serial.println(sens_signal);
if (sens_signal > last_sens_signal) last_sens_signal = sens_signal;
if (sens_signal - empty_signal > 3) coin_flag = true;
if (coin_flag && (abs(sens_signal - empty_signal)) < 2) {
coin_signal[i] = last_sens_signal;
EEPROM.writeInt(i * 2, coin_signal[i]);
coin_flag = false;
break;
}
}
Serial.print("coin_signal ");
Serial.print(i);
Serial.print(" = ");
Serial.println(coin_signal[i]);
}
break;
}
for (byte i = 0; i < coin_amount; i++) {
coin_signal[i] = EEPROM.readInt(i * 2);
coin_quantity[i] = EEPROM.readInt(20 + i * 2);
Serial.print(coin_signal[i]);
Serial.print(" ");
}
summ_money = 18.5;
Serial.print("sum: ");
Serial.println(summ_money);
}
void loop() {
// === ОСНОВНАЯ ЧАСТЬ ===
delay(500);
lcd.clear();
lcd.setCursor(0, 0); lcd.print("GOLD");
lcd.setCursor(0, 1); lcd.print(summ_money);
lcd.setCursor(13, 1); lcd.print(currency);
empty_signal = analogRead(IRsens);
sleep_flag = false;
reset_timer = millis();
last_sens_signal = empty_signal;
while (1) {
if (!digitalRead(button)) {
if (millis() - reset_timer > 3000) {
setup();
}
}
sens_signal = analogRead(IRsens);
if (sens_signal > last_sens_signal) last_sens_signal = sens_signal;
if (sens_signal - empty_signal > 3) coin_flag = true;
if (coin_flag && (abs(sens_signal - empty_signal)) < 2) {
recogn_flag = false;
for (byte i = 0; i < coin_amount; i++) {
int delta = abs(last_sens_signal - coin_signal[i]);
if (delta < 30) {
summ_money += coin_value[i];
lcd.setCursor(0, 1); lcd.print(summ_money);
coin_quantity[i]++;
recogn_flag = true;
break;
}
}
coin_flag = false;
standby_timer = millis();
break;
}
}
Serial.print("sum: ");
Serial.println(summ_money);
}
| [
"maryaermolina@gmail.com"
] | maryaermolina@gmail.com |
4fab25c738b6d0b60ca04c821966bc22883d6be8 | df3bdc4943f19f3378add5d242b619484071fef3 | /Testes-CMF-12-08-2020/HLS-CMF-soma_int/CMF_soma_int/solution1/.autopilot/db/hls_design_meta.cpp | e10e1206809a0979dd1db7dfede16c1381755491 | [] | no_license | cleitoncmf/Simulador_FPGA_UERJ | 39c45d0780855738ab07db76e4007cfa2f505d3b | d53acc7ce563e87236ac14409589cd3b3820942b | refs/heads/master | 2022-12-06T18:58:44.329785 | 2020-08-31T18:57:36 | 2020-08-31T18:57:36 | 274,196,689 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 550 | cpp | #include "hls_design_meta.h"
const Port_Property HLS_Design_Meta::port_props[]={
Port_Property("ap_start", 1, hls_in, -1, "", "", 1),
Port_Property("ap_done", 1, hls_out, -1, "", "", 1),
Port_Property("ap_idle", 1, hls_out, -1, "", "", 1),
Port_Property("ap_ready", 1, hls_out, -1, "", "", 1),
Port_Property("Entrada1", 32, hls_in, 0, "ap_none", "in_data", 1),
Port_Property("Entrada2", 32, hls_in, 1, "ap_none", "in_data", 1),
Port_Property("ap_return", 32, hls_out, -1, "", "", 1),
};
const char* HLS_Design_Meta::dut_name = "CMF_soma_int";
| [
"37081944+cleitoncmf@users.noreply.github.com"
] | 37081944+cleitoncmf@users.noreply.github.com |
d627fb19b689c50c249241daa54761875a3f358e | 8495997f1e1fd879b81798f1f911bbafda01968f | /quickTokenize.h | 2f75cb779df0b89ebcf872d02be70507fd7b9e53 | [] | no_license | marvinh/GraphingCalculatorStringParser | c3f95fa1ee9599358dca2e8c13cdcbb531837ffb | 55cc837c728e12084279f5019432a009c9e62a0f | refs/heads/master | 2021-01-19T05:34:54.405754 | 2015-09-05T07:14:09 | 2015-09-05T07:14:09 | 41,951,520 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,143 | h | //
// quickTokenize.h
// ShuntingYard
//
// Created by Marvin on 4/24/15.
// Copyright (c) 2015 Marvin. All rights reserved.
//
#ifndef __ShuntingYard__quickTokenize__
#define __ShuntingYard__quickTokenize__
#include <stdio.h>
#include <string>
#include <vector>
#include <iostream>
#include "constants.h"
using namespace std;
class QuickTokenize
{
public:
QuickTokenize();
QuickTokenize(string s);
string nextToken();
//convert if type is number
void d_conversion(string s);
//get number
double getConversion();
//determining which types an alpha string would be in
int stringCompare(std::string compare);
//get all types
int ofType();
//used to differentiate first 4 character sets from alphabetical set.
int sType();
//if end of string is reached its empty
bool empty();
private:
string _s;
double _d;
int _type;
int _pos;
string numbers;
string right;
string left;
string operators;
string alpha;
string space;
string comma;
};
#endif /* defined(__ShuntingYard__quickTokenize__) */
| [
"marvinharootoonyan@gmail.com"
] | marvinharootoonyan@gmail.com |
070edb5c1e78a9ce565ac48bf86ee195ef04f768 | e4b791a25d92a774b0409bead8ab56895aa76a05 | /Blackscholes_GPU/src/BlackScholes_gold.cpp | 0fe6ff9141a20fc2f92b4e97829bf1db527a15ca | [] | no_license | jahanzebmaqbool/parsec-gpu | 25aea77c0fcfe3975a51ee2343b052de119ab5c7 | 80303e1fb85a38569dd610833976a524cdb4ef46 | refs/heads/master | 2020-05-20T03:54:26.887862 | 2014-11-04T12:09:59 | 2014-11-04T12:09:59 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 5,249 | cpp | /*
* Copyright 1993-2009 NVIDIA Corporation. All rights reserved.
*
* NVIDIA Corporation and its licensors retain all intellectual property and
* proprietary rights in and to this software and related documentation and
* any modifications thereto. Any use, reproduction, disclosure, or distribution
* of this software and related documentation without an express license
* agreement from NVIDIA Corporation is strictly prohibited.
*
* Modified for PARSEC :
* Modified by : Jahanzeb Maqbool | National University of Sciences and Technology | Islamabad | Pakistan
*/
#include <math.h>
#include "OptionDataStruct.h"
/* Defining Struct for option Data....*/
/*
typedef struct OptionData_ {
float s; // spot price
float strike; // strike price
float r; // risk-free interest rate
float divq; // dividend rate
float v; // volatility
float t; // time to maturity or option expiration in years
// (1yr = 1.0, 6mos = 0.5, 3mos = 0.25, ..., etc)
char OptionType; // Option type. "P"=PUT, "C"=CALL
float divs; // dividend vals (not used in this test)
float DGrefval; // DerivaGem Reference Value
} OptionData;
*/
///////////////////////////////////////////////////////////////////////////////
// Polynomial approximation of cumulative normal distribution function
///////////////////////////////////////////////////////////////////////////////
#define inv_sqrt_2xPI 0.39894228040143270286
static float CNDF ( float InputX )
{
int sign;
float OutputX;
float xInput;
float xNPrimeofX;
float expValues;
float xK2;
float xK2_2, xK2_3;
float xK2_4, xK2_5;
float xLocal, xLocal_1;
float xLocal_2, xLocal_3;
// Check for negative value of InputX
if (InputX < 0.0) {
InputX = -InputX;
sign = 1;
} else
sign = 0;
xInput = InputX;
// Compute NPrimeX term common to both four & six decimal accuracy calcs
expValues = exp(-0.5f * InputX * InputX);
xNPrimeofX = expValues;
xNPrimeofX = xNPrimeofX * inv_sqrt_2xPI;
xK2 = 0.2316419 * xInput;
xK2 = 1.0 + xK2;
xK2 = 1.0 / xK2;
xK2_2 = xK2 * xK2;
xK2_3 = xK2_2 * xK2;
xK2_4 = xK2_3 * xK2;
xK2_5 = xK2_4 * xK2;
xLocal_1 = xK2 * 0.319381530;
xLocal_2 = xK2_2 * (-0.356563782);
xLocal_3 = xK2_3 * 1.781477937;
xLocal_2 = xLocal_2 + xLocal_3;
xLocal_3 = xK2_4 * (-1.821255978);
xLocal_2 = xLocal_2 + xLocal_3;
xLocal_3 = xK2_5 * 1.330274429;
xLocal_2 = xLocal_2 + xLocal_3;
xLocal_1 = xLocal_2 + xLocal_1;
xLocal = xLocal_1 * xNPrimeofX;
xLocal = 1.0 - xLocal;
OutputX = xLocal;
if (sign) {
OutputX = 1.0 - OutputX;
}
return OutputX;
}
static float BlackScholesBodyCPU( float sptprice,
float strike, float rate, float volatility,
float time, int otype )//, float timet )
{
float OptionPrice;
// local private working variables for the calculation
float xStockPrice;
float xStrikePrice;
float xRiskFreeRate;
float xVolatility;
float xTime;
float xSqrtTime;
float logValues;
float xLogTerm;
float xD1;
float xD2;
float xPowerTerm;
float xDen;
float d1;
float d2;
float FutureValueX;
float NofXd1;
float NofXd2;
float NegNofXd1;
float NegNofXd2;
xStockPrice = sptprice;
xStrikePrice = strike;
xRiskFreeRate = rate;
xVolatility = volatility;
xTime = time;
xSqrtTime = sqrt(xTime);
logValues = log( sptprice / strike );
xLogTerm = logValues;
xPowerTerm = xVolatility * xVolatility;
xPowerTerm = xPowerTerm * 0.5;
xD1 = xRiskFreeRate + xPowerTerm;
xD1 = xD1 * xTime;
xD1 = xD1 + xLogTerm;
xDen = xVolatility * xSqrtTime;
xD1 = xD1 / xDen;
xD2 = xD1 - xDen;
d1 = xD1;
d2 = xD2;
NofXd1 = CNDF( d1 );
NofXd2 = CNDF( d2 );
FutureValueX = strike * ( exp( -(rate)*(time) ) );
if (otype == 0) {
OptionPrice = (sptprice * NofXd1) - (FutureValueX * NofXd2);
} else {
NegNofXd1 = (1.0 - NofXd1);
NegNofXd2 = (1.0 - NofXd2);
OptionPrice = (FutureValueX * NegNofXd2) - (sptprice * NegNofXd1);
}
return OptionPrice;
}
////////////////////////////////////////////////////////////////////////////////
// Process an array of optN options
////////////////////////////////////////////////////////////////////////////////
//extern "C" void BlackScholesCPU( OptionData* data, float *OptionPrices, int optN )
extern "C" void BlackScholesCPU( float* h_s, float* h_strike, float* h_r, float* h_v, float* h_t, char* h_OptionType, float* OptionPrices , int optN)
{
for(int i = 0; i < optN; i ++)
{
// Compute the Formula and get OptionPrice....
int option = (h_OptionType[i] == 'P') ? 1 : 0;
OptionPrices [i] = BlackScholesBodyCPU (h_s[i],
h_strike[i],
h_r[i],
h_v[i],
h_t[i],
option);
}
}
| [
"jahanzeb.maqbool@seecs.edu.pk"
] | jahanzeb.maqbool@seecs.edu.pk |
9fbbeff1f42777d1d452d66c916889b16f1b9ee1 | 4b85b3a7c62dc745a35a5f75983bf479d36cee51 | /my_ws/devel/include/beginner_tutorials/greatingResponse.h | 00a84f85bd4ef5906eebaad14bbf390416e6f6ea | [] | no_license | enginBozkurt/ros_gnss_driver | 02d04e3781364306982e9adb8bf7df052bccd9d3 | ab4d47c6dbf3f5cdfaa71bbb0eba37ae5344309b | refs/heads/master | 2022-11-28T01:40:36.996898 | 2020-07-27T05:55:07 | 2020-07-27T05:55:07 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 5,463 | h | // Generated by gencpp from file beginner_tutorials/greatingResponse.msg
// DO NOT EDIT!
#ifndef BEGINNER_TUTORIALS_MESSAGE_GREATINGRESPONSE_H
#define BEGINNER_TUTORIALS_MESSAGE_GREATINGRESPONSE_H
#include <string>
#include <vector>
#include <map>
#include <ros/types.h>
#include <ros/serialization.h>
#include <ros/builtin_message_traits.h>
#include <ros/message_operations.h>
namespace beginner_tutorials
{
template <class ContainerAllocator>
struct greatingResponse_
{
typedef greatingResponse_<ContainerAllocator> Type;
greatingResponse_()
: feedback() {
}
greatingResponse_(const ContainerAllocator& _alloc)
: feedback(_alloc) {
(void)_alloc;
}
typedef std::basic_string<char, std::char_traits<char>, typename ContainerAllocator::template rebind<char>::other > _feedback_type;
_feedback_type feedback;
typedef boost::shared_ptr< ::beginner_tutorials::greatingResponse_<ContainerAllocator> > Ptr;
typedef boost::shared_ptr< ::beginner_tutorials::greatingResponse_<ContainerAllocator> const> ConstPtr;
}; // struct greatingResponse_
typedef ::beginner_tutorials::greatingResponse_<std::allocator<void> > greatingResponse;
typedef boost::shared_ptr< ::beginner_tutorials::greatingResponse > greatingResponsePtr;
typedef boost::shared_ptr< ::beginner_tutorials::greatingResponse const> greatingResponseConstPtr;
// constants requiring out of line definition
template<typename ContainerAllocator>
std::ostream& operator<<(std::ostream& s, const ::beginner_tutorials::greatingResponse_<ContainerAllocator> & v)
{
ros::message_operations::Printer< ::beginner_tutorials::greatingResponse_<ContainerAllocator> >::stream(s, "", v);
return s;
}
} // namespace beginner_tutorials
namespace ros
{
namespace message_traits
{
// BOOLTRAITS {'IsFixedSize': False, 'IsMessage': True, 'HasHeader': False}
// {'beginner_tutorials': ['/home/xu/my_ws/src/beginner_tutorials/msg'], 'std_msgs': ['/opt/ros/kinetic/share/std_msgs/cmake/../msg']}
// !!!!!!!!!!! ['__class__', '__delattr__', '__dict__', '__doc__', '__eq__', '__format__', '__getattribute__', '__hash__', '__init__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', '_parsed_fields', 'constants', 'fields', 'full_name', 'has_header', 'header_present', 'names', 'package', 'parsed_fields', 'short_name', 'text', 'types']
template <class ContainerAllocator>
struct IsFixedSize< ::beginner_tutorials::greatingResponse_<ContainerAllocator> >
: FalseType
{ };
template <class ContainerAllocator>
struct IsFixedSize< ::beginner_tutorials::greatingResponse_<ContainerAllocator> const>
: FalseType
{ };
template <class ContainerAllocator>
struct IsMessage< ::beginner_tutorials::greatingResponse_<ContainerAllocator> >
: TrueType
{ };
template <class ContainerAllocator>
struct IsMessage< ::beginner_tutorials::greatingResponse_<ContainerAllocator> const>
: TrueType
{ };
template <class ContainerAllocator>
struct HasHeader< ::beginner_tutorials::greatingResponse_<ContainerAllocator> >
: FalseType
{ };
template <class ContainerAllocator>
struct HasHeader< ::beginner_tutorials::greatingResponse_<ContainerAllocator> const>
: FalseType
{ };
template<class ContainerAllocator>
struct MD5Sum< ::beginner_tutorials::greatingResponse_<ContainerAllocator> >
{
static const char* value()
{
return "c14cdf907e5c7c7fd47292add15660f0";
}
static const char* value(const ::beginner_tutorials::greatingResponse_<ContainerAllocator>&) { return value(); }
static const uint64_t static_value1 = 0xc14cdf907e5c7c7fULL;
static const uint64_t static_value2 = 0xd47292add15660f0ULL;
};
template<class ContainerAllocator>
struct DataType< ::beginner_tutorials::greatingResponse_<ContainerAllocator> >
{
static const char* value()
{
return "beginner_tutorials/greatingResponse";
}
static const char* value(const ::beginner_tutorials::greatingResponse_<ContainerAllocator>&) { return value(); }
};
template<class ContainerAllocator>
struct Definition< ::beginner_tutorials::greatingResponse_<ContainerAllocator> >
{
static const char* value()
{
return "string feedback\n\
";
}
static const char* value(const ::beginner_tutorials::greatingResponse_<ContainerAllocator>&) { return value(); }
};
} // namespace message_traits
} // namespace ros
namespace ros
{
namespace serialization
{
template<class ContainerAllocator> struct Serializer< ::beginner_tutorials::greatingResponse_<ContainerAllocator> >
{
template<typename Stream, typename T> inline static void allInOne(Stream& stream, T m)
{
stream.next(m.feedback);
}
ROS_DECLARE_ALLINONE_SERIALIZER
}; // struct greatingResponse_
} // namespace serialization
} // namespace ros
namespace ros
{
namespace message_operations
{
template<class ContainerAllocator>
struct Printer< ::beginner_tutorials::greatingResponse_<ContainerAllocator> >
{
template<typename Stream> static void stream(Stream& s, const std::string& indent, const ::beginner_tutorials::greatingResponse_<ContainerAllocator>& v)
{
s << indent << "feedback: ";
Printer<std::basic_string<char, std::char_traits<char>, typename ContainerAllocator::template rebind<char>::other > >::stream(s, indent + " ", v.feedback);
}
};
} // namespace message_operations
} // namespace ros
#endif // BEGINNER_TUTORIALS_MESSAGE_GREATINGRESPONSE_H
| [
"a332999245@gmail.com"
] | a332999245@gmail.com |
63b30878675bc24d72043983d78d09679658c2ac | 90b49b45a5ca1a5bbbd6133f93fe51aec11be12b | /main.cpp | 6fd25f6078b2cfd9307168bd96061ab517e638c4 | [] | no_license | walimow/box | c91dae832bc26f6d29cc8428770f45bf1021ba8b | 772ec44cdd8bc683a7feec3e66c59257fce3c81b | refs/heads/master | 2023-01-22T02:37:11.490565 | 2020-12-06T16:54:49 | 2020-12-06T16:54:49 | 319,083,039 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 967 | cpp | #include <iostream>
#include <box.hpp>
#include <trace.hpp>
#include <vector>
#include <trace.hpp>
int main() {
using stepworks::bxx::box;
using stepworks::bxx::box_type;
using T = int;
using BOX = box<T, std::vector>;
using BOX_T = box_type<T, std::vector>;
using stepworks::bxx::make::mk_box_v;
using stepworks::bxx::util::trace;
using stepworks::bxx::util::trace_form;
{
using stepworks::bxx::make::mk_box_v;
auto v4= mk_box_v<int,std::vector>({42,{1},666});
///BOX bb(v4);
std::cout<< " (3?)--> " << BOX_T ::count(v4)<<"\n";
trace<int,std::vector>( std::get< typename BOX::agg_t>(v4) );
}
auto v4= mk_box_v<int,std::vector>({42,{1},666});
///BOX bb(v4);
std::cout<< " (--3?---)--> " << BOX_T ::count(v4)<<"\n";
trace<int,std::vector>( std::get< typename BOX::agg_t>(v4) );
// auto v5= mk_box_v<int,std::vector>({42,{1,2,3},666});
return 0;
}
| [
"walim@gmx.net"
] | walim@gmx.net |
aea4c5a12f1a323a12f1f238186e9f63f5bd9307 | ea075859547d0dd018b0cd7b3259172feeb8a01f | /Source/WebKit/haiku/WebCoreSupport/ContextMenuClientHaiku.h | ba3506b6ae1fb583651ef077db9d46b7408d9df9 | [
"BSD-2-Clause"
] | permissive | mattlacey/haiku-webkit | 7c67cd574640626621476e13c7f396c59ab19356 | 26c3ee7e766a1df9dc3ccc9c5a001fe2ec430412 | refs/heads/master | 2021-07-18T03:52:04.915178 | 2012-06-28T01:19:44 | 2012-06-28T01:19:44 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,275 | h | /*
* Copyright (C) 2006 Zack Rusin <zack@kde.org>
* Copyright (C) 2007 Ryan Leavengood <leavengood@gmail.com>
* Copyright (C) 2010 Stephan Aßmus <superstippi@gmx.de>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``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 APPLE COMPUTER, INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef ContextMenuClientHaiku_h
#define ContextMenuClientHaiku_h
#include "ContextMenuClient.h"
class BWebPage;
namespace WebCore {
class ContextMenu;
class ContextMenuClientHaiku : public ContextMenuClient {
public:
ContextMenuClientHaiku(BWebPage*);
virtual void contextMenuDestroyed();
virtual PlatformMenuDescription getCustomMenuFromDefaultItems(ContextMenu*);
virtual void contextMenuItemSelected(ContextMenuItem*, const ContextMenu*);
virtual void downloadURL(const KURL& url);
virtual void lookUpInDictionary(Frame*);
virtual void speak(const String&);
virtual bool isSpeaking();
virtual void stopSpeaking();
virtual void searchWithGoogle(const Frame*);
private:
BWebPage* m_webPage;
};
} // namespace WebCore
#endif // ContextMenuClientHaiku_h
| [
"alexandre.deckner@uzzl.com"
] | alexandre.deckner@uzzl.com |
312c70f774f7e7a27f9383f7225bf513d4efc6ec | 704f03e7cb176208d5f6ac268ce57607dba5b767 | /examples/client_historical.cpp | 3eb5de15ffd8c89d23d7d0fea337899a9c508926 | [] | no_license | eleicha/OPCTest | 561aaedea48915fb8e8fd6c393e8284f935b12b6 | b35115d6a28543a77195dec257ae19dcefa6f6a9 | refs/heads/master | 2022-12-07T18:53:56.445605 | 2020-08-19T19:38:18 | 2020-08-19T19:38:18 | 265,588,671 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,698 | cpp | /* This work is licensed under a Creative Commons CCZero 1.0 Universal License.
* See http://creativecommons.org/publicdomain/zero/1.0/ for more information. */
//#define UA_ENABLE_HISTORIZING
//#define UA_ENABLE_EXPERIMENTAL_HISTORIZING
#include <open62541/client_config_default.h>
#include <open62541/client_highlevel.h>
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <string>
static void
printTimestamp(char *name, UA_DateTime date) {
UA_DateTimeStruct dts = UA_DateTime_toStruct(date);
if (name)
printf("%s: %02u-%02u-%04u %02u:%02u:%02u.%03u, ", name,
dts.day, dts.month, dts.year, dts.hour, dts.min, dts.sec, dts.milliSec);
else
printf("%02u-%02u-%04u %02u:%02u:%02u.%03u, ",
dts.day, dts.month, dts.year, dts.hour, dts.min, dts.sec, dts.milliSec);
}
static void
printDataValue(UA_DataValue *value) {
/* Print status and timestamps */
if (value->hasServerTimestamp)
printTimestamp("ServerTime", value->serverTimestamp);
if (value->hasSourceTimestamp)
printTimestamp("SourceTime", value->sourceTimestamp);
if (value->hasStatus)
printf("Status 0x%08x, ", value->status);
if (value->value.type == &UA_TYPES[UA_TYPES_UINT32]) {
UA_UInt32 hrValue = *(UA_UInt32 *)value->value.data;
printf("Uint32Value %u\n", hrValue);
}
if (value->value.type == &UA_TYPES[UA_TYPES_DOUBLE]) {
UA_Double hrValue = *(UA_Double *)value->value.data;
printf("DoubleValue %f\n", hrValue);
}
}
static UA_Boolean
readRaw(const UA_HistoryData *data) {
printf("readRaw Value count: %lu\n", (long unsigned)data->dataValuesSize);
/* Iterate over all values */
for (UA_UInt32 i = 0; i < data->dataValuesSize; ++i)
{
printDataValue(&data->dataValues[i]);
}
/* We want more data! */
return true;
}
static UA_Boolean
readHist(UA_Client *client, const UA_NodeId *nodeId,
UA_Boolean moreDataAvailable,
const UA_ExtensionObject *data, void *unused) {
printf("\nRead historical callback:\n");
printf("\tHas more data:\t%d\n\n", moreDataAvailable);
if (data->content.decoded.type == &UA_TYPES[UA_TYPES_HISTORYDATA]) {
return readRaw((UA_HistoryData*)data->content.decoded.data);
}
return true;
}
int main(int argc, char *argv[]) {
const char* url = "opc.tcp://localhost:53530/OPCUA/SimulationServer";
if (argc < 3)
{
std::cout << "Using default URL: opc.tcp://localhost:53530/OPCUA/SimulationServer" << std::endl;
}else{
url = argv[2];
}
std::cout << url << std::endl;
UA_Client *client = UA_Client_new();
UA_ClientConfig_setDefault(UA_Client_getConfig(client));
UA_StatusCode retval;
retval = UA_Client_connect(client, url);
#ifdef UA_ENABLE_HISTORIZING
UA_Int64 start = 1593071405;
if (argc < 2)
{
std::cout << "Using default date time: June 14th 2020, 16:17:47" << std::endl;
}else{
start = atoi(argv[1]);
}
UA_DateTime now = UA_DateTime_now();
/* Read historical values (uint32) */
printf("\nStart historical read (3, \"h1\"):\n");
UA_NodeId node = UA_NODEID_STRING(3, "h1");
retval = UA_Client_HistoryRead_raw(client, &node, readHist,
UA_DateTime_fromUnixTime(start), now, UA_STRING_NULL, false, 10, UA_TIMESTAMPSTORETURN_BOTH, (void *)UA_FALSE);
if (retval != UA_STATUSCODE_GOOD) {
printf("Failed. %s\n", UA_StatusCode_name(retval));
}
#endif
UA_Client_disconnect(client);
UA_Client_delete(client);
return retval == UA_STATUSCODE_GOOD ? EXIT_SUCCESS : EXIT_FAILURE;
}
| [
"laura.mons@web.de"
] | laura.mons@web.de |
ad363a50a8e06b535e9e5df6c24b62790ecfe2ee | c770fc9b8740da5177ec76ce98006e028449b46d | /BORW/16000512.cpp | 44dfd9ca292cb45555a5f482b74993bc123f3bae | [] | no_license | MuditSrivastava/SPOJ_SOL | 84dfbc5766d4d8d655f813dfe370fe18c77b1532 | 8f3f489a354c2ad8565f2125d9a3ef779c816a63 | refs/heads/master | 2021-06-14T21:52:45.583242 | 2017-03-08T06:31:31 | 2017-03-08T06:31:31 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,616 | cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long int LL;
#define getchar_unlocked getchar
#define pb push_back
#define mp make_pair
#define f first
#define sc second
#define pii pair<int,int>
#define M 1000000007
#define inf (int)(2e+9)
#define all(o) (o).begin(), (o).end()
/*#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;*/
int gcd(int a, int b) { return (b == 0 ? a : gcd(b, a % b)); }
int lcm(int a, int b) { return (a * (b / gcd(a, b))); }
LL max(LL a,LL b,LL c){return max(a,max(b,c));}
inline LL power(LL x,LL y)
{
LL ans=1;
while(y>0){
if(y&1)
ans=(ans*x)%M;
x=(x*x)%M;
y/=2;
}
return ans;
}
inline int read()
{
int ret = 0,temp=1;
int c = getchar_unlocked();
while(c<'0' || c>'9'){
c = getchar_unlocked();
}
while(c>='0' && c<='9')
{
ret = (ret<<3) + (ret<<1) + c - '0';
c = getchar_unlocked();
}
return ret;
}
const int N=205;
int a[N],n;
int dp[N][N];
int solve(int id,int bl,int wh)
{
if(id==n+2) return 0;
int &ret=dp[bl][wh];
if(ret!=-1) return ret;
ret=solve(id+1,bl,wh)+1;
if(a[id]>a[bl]) ret=min(ret,solve(id+1,id,wh));
if(a[id]<a[wh]) ret=min(ret,solve(id+1,bl,id));
return ret;
}
int main()
{
while(1){
memset(dp,-1,sizeof(dp));
scanf("%d",&n);
if(n==-1) return 0;
for(int i=2;i<n+2;i++) scanf("%d",&a[i]);
a[0]=-1,a[1]=inf;
printf("%d\n",solve(2,0,1));
}
return 0;
}
| [
"kumar.ashishkumar.vicky5@gmail.com"
] | kumar.ashishkumar.vicky5@gmail.com |
177924d8660d8d1f5f1b57f38c695291401c246a | fca68c5fec6df6f999408571315c2b8e7c4b8ce9 | /service/supersialign_home/src/SiGeom/SiGeom/SiGeometryProxy.h | 0ffe3d6b3b2ce4dcb7ae2a618c49b5878e25d569 | [] | no_license | jpivarski-talks/1999-2006_gradschool-3 | 8b2ea0b6babef104b0281c069994fc9894a05b14 | 57e80d601c0519f9e01a07ecb53d367846e8306e | refs/heads/master | 2022-11-19T12:01:42.959599 | 2020-07-25T01:19:59 | 2020-07-25T01:19:59 | 282,235,559 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,864 | h | #if !defined(PACKAGE_SIGEOMETRYPROXY_H)
#define PACKAGE_SIGEOMETRYPROXY_H
// -*- C++ -*-
//
// Package: <package>
// Module: SiGeometryProxy
//
// Description: <one line class summary>
//
// Usage:
// <usage>
//
// Author: Alexander Undrus
// Created: Fri May 22 22:36:26 EDT 1998
// $Id: SiGeometryProxy.h,v 1.1.1.1 1998/08/18 07:42:04 cleo3 Exp $
//
// Revision history
//
// $Log: SiGeometryProxy.h,v $
// Revision 1.1.1.1 1998/08/18 07:42:04 cleo3
// imported SiGeom sources
//
//
// system include files
// user include files
#include "DataHandler/DataField.h"
#include "DetectorGeometry/DGDetectorStore.h"
// forward declarations
class SiGeometryProxy : public DataField< DGDetectorStore >
{
// friend classes and functions
public:
// constants, enums and typedefs
typedef DGDetectorStore value_type;
// Constructors and destructor
SiGeometryProxy();
virtual ~SiGeometryProxy();
// member functions
virtual void invalidateCache() ;
virtual const value_type* faultHandler( const Record& aRecord,
const IfdKey& aKey );
// const member functions
// static member functions
protected:
// protected member functions
// protected const member functions
private:
// Constructors and destructor
SiGeometryProxy( const SiGeometryProxy& );
// assignment operator(s)
const SiGeometryProxy& operator=( const SiGeometryProxy& );
// private member functions
// private const member functions
// data members
value_type* m_SiGeometry ;
// static data members
};
// inline function definitions
//#if defined(INCLUDE_TEMPLATE_DEFINITIONS)
// templated member function definitions
//# include "package/Template/SiGeometryProxy.cc"
//#endif
#endif /* PACKAGE_SIGEOMETRYPROXY_H */
| [
"jpivarski@gmail.com"
] | jpivarski@gmail.com |
f255b38e895af6117d51542aff83b01eb31aebae | 8a883c1b4d295c58745fa247bc66012ee5d47b24 | /call_in_stack_x86_sysv.h | adc4b7d3c575b5b5903186d9a39be4e63ce27088 | [
"MIT"
] | permissive | JasonOldWoo/call_in_stack | a90f87d2003e01c3e6422b905c0ec23580c1be5f | 28d1bc314baf6a1807859a6621751ea795827902 | refs/heads/master | 2020-12-30T17:10:28.245475 | 2017-05-11T15:14:10 | 2017-05-11T15:14:19 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,469 | h | #ifndef _CALLINSTACK_X86SYSV_H_
#define _CALLINSTACK_X86SYSV_H_
#ifdef __i386__
#define WORDSIZE (4)
#define WORDBITSIZE (8*WORDSIZE)
#define MAX_ARGUMENT_SIZE (sizeof(long double))
#define MAX_RETUREN_SIZE (sizeof(long double))
#define STACK_ALIGNMENT_SIZE (16) //After GCC 4.5 or in Apple MAC, it is required for 16 bytes stack alignment.
namespace call_in_stack_impl{
typedef unsigned int word_int_t;
#include "template_util.h"
#define args_list_define(i) \
template<MACRO_JOIN(RECURSIVE_FUNC_,i)(define_typenames_begin, define_typenames, define_typenames_end)> \
struct args_list< MACRO_JOIN(RECURSIVE_FUNC_,i)(define_types_begin, define_types, define_types_end)> \
: public args_list< MACRO_JOIN(RECURSIVE_FUNC_,i)(define_parent_begin, define_parent, define_parent_end)>{ \
typedef args_list< MACRO_JOIN(RECURSIVE_FUNC_,i)(define_parent_begin, define_parent, define_parent_end)> parent; \
typedef MACRO_JOIN(t,i) new_type; \
\
const static word_int_t addtional_stack_cost = _COUNT_OF_SIZE(change_ref_to_pointer_size<new_type>::size, WORDSIZE);\
const static word_int_t stackword_cost = parent::stackword_cost + ((addtional_stack_cost == 0)? 0 : (_ALIGNED_COST(parent::stackword_cost, addtional_stack_cost)));\
\
typedef assert_not_class_not_largesize<new_type, MAX_ARGUMENT_SIZE> assert_instance;\
template<typename O>\
static void out_stackword_cost(O& o){\
o<<"stackword_cost at " <<i<<"th:"<<stackword_cost<<"\r\n";\
parent::out_stackword_cost(o);\
}\
};
BATCH_FUNC1(args_list_define)
#undef args_list_define
#define push_stack_define(j) if(arg_types::stackword_cost >= j ){\
__asm__ ("push "MACRO_TOSTRING(j*WORDSIZE+WORDSIZE)"(%ebp);\n\t");}
//MAX_ARGUMENT_SIZE = 3*WORDSIZE, 10*3=30,
#define func_back1(func) func(30) func(29) func(28) func(27) func(26) func(25) func(24) func(23) func(22) func(21) func(20) func(19) func(18) func(17) func(16) func(15) func(14) func(13) func(12) func(11) func(10) func(9) func(8) func(7) func(6) func(5) func(4) func(3) func(2) func(1)
#define func_back(func) func_back1(func) func(0)
//We save arguments and previous sp in new stack
#define STACK_COST(T) (T::stackword_cost + 1)
#define call_with_stack_define(i) \
template <MACRO_JOIN(RECURSIVE_FUNC_,i)(define_typenames_begin, define_typenames, define_typenames) typename R, bool has_variable_arguments > \
FORCE_NOINLINE DLL_LOCAL R do_call (\
MACRO_JOIN(RECURSIVE_FUNC_,i)(define_types_begin, define_types, define_types) \
void* dest_func, char* stack_base){\
typedef args_list<MACRO_JOIN(RECURSIVE_FUNC_,i)(define_types_begin, define_types, define_types_end)> arg_types; \
typedef assert_not_class_not_largesize<R, MAX_RETUREN_SIZE> assert_instance; \
__asm__ ("mov %0, %%esp; \n\t" \
::"X"(stack_base)); \
func_back1(push_stack_define) \
__asm__ ("call *%0; \n\t" \
::"X"(dest_func)); \
__asm__ ("mov %ebp, %esp; \n\t"); __asm__ ("pop %ebp;\n\t"); __asm__ ("ret;\n\t");\
DUMMY_RETURN(R);\
}
BATCH_FUNC(call_with_stack_define)
#undef call_with_stack_define
//#undef push_stack_define
//#undef func_back
//#undef func_back1
#define DEF_SP(sp_value) DECL_REG_VAR(char*, sp_value, esp)
//Maybe your compiler does not support register variable? use DEF_SP_BAK instead!
#define GET_SP(sp_value) __asm__ ("movq %%esp, %0; \n\t" : "=X"(sp_value))
#define DEF_SP_BAK(sp_value) char *sp_value; GET_SP(sp_value)
}
#endif
#endif
| [
"41656955@qq.com"
] | 41656955@qq.com |
0c6eb9df5d5d8a50187afcc6479f9ddad4e7e7df | 16e2ccf8bf29ee4af924c6a3ad77918c354085e1 | /curl_fxgetter/main.cpp | 2f3923cd2854ecfeaf8542c3d6c930eef36340d7 | [] | no_license | MizuhaWatanabe/WazChem | 43e09e5ab5cfd3eb5f392bc536b7ba555aae2994 | 84da9eaee97f95acd8476ea20b8fa8da520cbabe | refs/heads/master | 2021-01-12T13:49:15.771482 | 2015-12-23T06:04:18 | 2015-12-23T06:04:18 | 47,498,613 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 567 | cpp | #include <iostream>
#include <string>
#include <curl/curl.h>
//#include "WebScraper.h"
#include "CurrentFx.h"
#include "PastFx.h"
#include "CurrentStock.h"
using namespace std;
int main()
{
/*
CurrentFx cfx("EURJPY");
time_t got_time=cfx.get_got_time();
cout << ctime(&got_time) << endl;
cout << cfx.get_bid_price() <<endl;
cout << cfx.get_ask_price() <<endl;
*/
CurrentStock cst(8704);
time_t got_time=cst.get_got_time();
cout << ctime(&got_time) <<endl;
cout << cst.get_verbose() <<endl;
cout << cst.get_stock_price() <<endl;
return 0;
}
| [
"yutaka.naito.0705@gmail.com"
] | yutaka.naito.0705@gmail.com |
38e9828c0a82325285c8fcb4b47d228a1efb5cbb | 6714f05301d2a350f7fcb47b36b5269d3e01c9e8 | /Project1/src/tecent.cpp | b09f5fa8c3201eed4642f9bd9eb351d798bd401a | [] | no_license | TrashWw/Algorithm | 8e701e316069bdbc925b92a4929108d8f78e6546 | 1397c4fe7ee4fcb31b15bd61e258f94307fc0a1d | refs/heads/master | 2020-07-01T00:17:16.337897 | 2019-08-19T08:22:05 | 2019-08-19T08:22:05 | 200,992,886 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 448 | cpp | #include<iostream>
#include <vector>
using namespace std;
int find(vector<char> s) {
int length = s.size();
int last_length = s.size();
for (int i = 0; i < length;i++) {
if (i + 1 < length && (s[i] ^ s[i + 1])) {
last_length -= 2;
i++;
}
}
return last_length;
}
int main() {
int m;
char n;
vector<char> s;
cin >> m;
cin >> n;
while (m>0) {
s.push_back(n);
m--;
if (m>0)
cin >> n;
}
int a = find(s);
return 0;
} | [
"775778592@qq.com"
] | 775778592@qq.com |
0fa5d2163ec8986f5381dd837601b088f74b1a3b | c7c8dd10b9ca44fad17471eb952c7ffb9cc53fae | /UdpNtpLCDClock_5110/UdpNtpLCDClock_5110.ino | cb9ce40de4dc8570502898a9b8207b6f1c010dc1 | [] | no_license | Bschuster3434/tomn-examples | 661ac348c0242c750ac7a989de9d7d39fcc6239b | 527e0b327cf4044b8bb46c391496041b3c2c8dda | refs/heads/master | 2021-01-21T08:06:16.413885 | 2014-11-16T20:33:26 | 2014-11-16T20:33:26 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 6,519 | ino | /*
Udp NTP Client
Get the time from a Network Time Protocol (NTP) time server
Demonstrates use of UDP sendPacket and ReceivePacket
For more on NTP time servers and the messages needed to communicate with them,
see http://en.wikipedia.org/wiki/Network_Time_Protocol
created 4 Sep 2010
by Michael Margolis
modified 9 Apr 2012
by Tom Igoe
This code is in the public domain.
*/
#include <Adafruit_GFX.h>
#include <Adafruit_PCD8544.h>
#include <SPI.h>
#include <Ethernet.h>
#include <EthernetUdp.h>
// pin 8 - PWM to the backlight (EL)
// pin 7 - Serial clock out (SCLK)
// pin 6 - Serial data out (DIN)
// pin 5 - Data/Command select (D/C)
// pin 4 - LCD chip select (CS)
// pin 3 - LCD reset (RST)
Adafruit_PCD8544 lcd0 = Adafruit_PCD8544(7, 6, 5, 4, 3);
// Enter a MAC address for your controller below.
// Newer Ethernet shields have a MAC address printed on a sticker on the shield
byte mac[] = {
0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
unsigned int localPort = 8888; // local port to listen for UDP packets
IPAddress timeServer(217, 26, 101, 136); // time.nist.gov NTP server
const int NTP_PACKET_SIZE= 48; // NTP time stamp is in the first 48 bytes of the message
byte packetBuffer[ NTP_PACKET_SIZE]; //buffer to hold incoming and outgoing packets
unsigned long secsSince1900;
// A UDP instance to let us send and receive packets over UDP
EthernetUDP Udp;
void setup()
{
lcd0.begin();
lcd0.clearDisplay();
lcd0.setContrast(25);
analogWrite(8,130);
lcd0.setTextColor(1,0);
lcd0.setCursor(0,0);
lcd0.println("UDP NTP Client:");
lcd0.println("Await Serial");
lcd0.display();
// Open serial communications and wait for port to open:
Serial.begin(9600);
// while (!Serial) {
// ; // wait for serial port to connect. Needed for Leonardo only
// }
Serial.println("Starting up and aquiring IP Address");
lcd0.setCursor(0,0);
lcd0.print("Aquiring IP ");
// start Ethernet and UDP
if (Ethernet.begin(mac) == 0) {
Serial.println("Failed to configure Ethernet using DHCP");
// no point in carrying on, so do nothing forevermore:
for(;;)
;
}
lcd0.setCursor(0,0);
lcd0.print("Starting UDP client");
lcd0.display();
lcd0.clearDisplay();
Udp.begin(localPort);
}
void loop()
{
// Reest the clock 37 seconds after every 10th minute - Lower server laod. :)
if ( !(secsSince1900 % 600) || secsSince1900 == 0 ) {
lcd0.clearDisplay();
lcd0.setCursor(0,0);
lcd0.println("Sending reques");
lcd0.display();
sendNTPpacket(timeServer); // send an NTP packet to a time server
lcd0.setCursor(0,0);
lcd0.println("Await response");
lcd0.display();
// wait to see if a reply is available
delay(500);
lcd0.setCursor(0,0);
lcd0.println("Parsing packet");
lcd0.display();
if ( Udp.parsePacket() ) {
// We've received a packet, read the data from it
Udp.read(packetBuffer,NTP_PACKET_SIZE); // read the packet into the buffer
//the timestamp starts at byte 40 of the received packet and is four bytes,
// or two words, long. First, esxtract the two words:
unsigned long highWord = word(packetBuffer[40], packetBuffer[41]);
unsigned long lowWord = word(packetBuffer[42], packetBuffer[43]);
// combine the four bytes (two words) into a long integer
// this is NTP time (seconds since Jan 1 1900):
secsSince1900 = highWord << 16 | lowWord;
Serial.print("Seconds since Jan 1 1900 = " );
Serial.println(secsSince1900);
lcd0.print("Epoch:");
lcd0.println(secsSince1900);
lcd0.display();
}
}
// lcd0.setCursor(0,0);
// lcd0.print(" ");
lcd0.setCursor(0,0);
lcd0.print(" Counting ");
// now convert NTP time into everyday time:
Serial.print("Unix time = ");
// Unix time starts on Jan 1 1970. In seconds, that's 2208988800:
const unsigned long seventyYears = 2208988800UL;
// subtract seventy years:
unsigned long epoch = secsSince1900 - seventyYears - ( 4*3600); // GMT - 4!
// print Unix time:
Serial.println(epoch);
lcd0.setCursor(0,5*8);
lcd0.print("Time: ");
// print the hour, minute and second:
Serial.print("The UTC time is "); // UTC is the time at Greenwich Meridian (GMT)
Serial.print((epoch % 86400L) / 3600); // print the hour (86400 equals secs per day)
Serial.print(':');
if ( ((epoch % 3600) / 60) < 10 ) {
// In the first 10 minutes of each hour, we'll want a leading '0'
Serial.print('0');
}
Serial.print((epoch % 3600) / 60); // print the minute (3600 equals secs per minute)
Serial.print(':');
if ( (epoch % 60) < 10 ) {
// In the first 10 seconds of each minute, we'll want a leading '0'
Serial.print('0');
}
Serial.println(epoch %60); // print the second
lcd0.print((epoch % 86400L) / 3600); // print the hour (86400 equals secs per day)
lcd0.print(':');
if ( ((epoch % 3600) / 60) < 10 ) {
// In the first 10 minutes of each hour, we'll want a leading '0'
lcd0.print('0');
}
lcd0.print((epoch % 3600) / 60); // print the minute (3600 equals secs per minute)
lcd0.print(':');
if ( (epoch % 60) < 10 ) {
// In the first 10 seconds of each minute, we'll want a leading '0'
lcd0.print('0');
}
lcd0.print(epoch %60); // print the second
// wait ten seconds before asking for the time again
delay(1000);
secsSince1900++;
lcd0.display();
}
// send an NTP request to the time server at the given address
unsigned long sendNTPpacket(IPAddress& address)
{
// set all bytes in the buffer to 0
memset(packetBuffer, 0, NTP_PACKET_SIZE);
// Initialize values needed to form NTP request
// (see URL above for details on the packets)
packetBuffer[0] = 0b11100011; // LI, Version, Mode
packetBuffer[1] = 0; // Stratum, or type of clock
packetBuffer[2] = 6; // Polling Interval
packetBuffer[3] = 0xEC; // Peer Clock Precision
// 8 bytes of zero for Root Delay & Root Dispersion
packetBuffer[12] = 49;
packetBuffer[13] = 0x4E;
packetBuffer[14] = 49;
packetBuffer[15] = 52;
// all NTP fields have been given values, now
// you can send a packet requesting a timestamp:
Udp.beginPacket(address, 123); //NTP requests are to port 123
Udp.write(packetBuffer,NTP_PACKET_SIZE);
Udp.endPacket();
}
| [
"tomn@sneaky.net"
] | tomn@sneaky.net |
6b346eda291f7c7a6c98b85b90c7e9c326b17acf | 6eda944ac211ae85e3c7d74cdb7d9fee3c6524a4 | /SkyDomeShaderClass.h | 978be0d55c62111ce018c3691533a63bfbda11e4 | [] | no_license | totol901/MapTool2 | c3daed55e1f0ab5cff848c85130cd2e0b1235319 | 07afc4a96b238af8491df9da2cabdb7b87a32c2d | refs/heads/master | 2020-03-19T23:48:25.503933 | 2018-06-12T08:22:00 | 2018-06-12T08:22:00 | 137,020,421 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 943 | h | #pragma once
class SkyDomeShaderClass
{
private:
struct MatrixBufferType
{
D3DXMATRIX world;
D3DXMATRIX view;
D3DXMATRIX projection;
};
struct GradientBufferType
{
D3DXVECTOR4 apexColor;
D3DXVECTOR4 centerColor;
};
public:
SkyDomeShaderClass();
~SkyDomeShaderClass();
bool Initialize(ID3D11Device*, HWND);
void Shutdown();
bool Render(ID3D11DeviceContext*, int, D3DXMATRIX, D3DXMATRIX, D3DXMATRIX, D3DXVECTOR4, D3DXVECTOR4);
private:
bool InitializeShader(ID3D11Device*, HWND, WCHAR*, WCHAR*);
void ShutdownShader();
void OutputShaderErrorMessage(ID3D10Blob*, HWND, WCHAR*);
bool SetShaderParameters(ID3D11DeviceContext*, D3DXMATRIX, D3DXMATRIX, D3DXMATRIX, D3DXVECTOR4, D3DXVECTOR4);
void RenderShader(ID3D11DeviceContext*, int);
private:
ID3D11VertexShader* m_vertexShader;
ID3D11PixelShader* m_pixelShader;
ID3D11InputLayout* m_layout;
ID3D11Buffer* m_matrixBuffer;
ID3D11Buffer* m_gradientBuffer;
};
| [
"savtotol901@gmail.com"
] | savtotol901@gmail.com |
61ba300867a7d75f31e1fbe36f7f8edcff3d1a01 | c6ecad18dd41ea69c22baf78dfeb95cf9ba547d0 | /src/jrtplib-3.3.0/src/rtptransmitter.h | e7da6949c0ade6393632ac928c8070b0430e34d7 | [
"MIT"
] | permissive | neuschaefer/qnap-gpl | b1418d504ebe17d7a31a504d315edac309430fcf | 7bb76f6cfe7abef08777451a75924f667cca335b | refs/heads/master | 2022-08-16T17:47:37.015870 | 2020-05-24T18:56:05 | 2020-05-24T18:56:05 | 266,605,194 | 3 | 2 | null | null | null | null | UTF-8 | C++ | false | false | 5,525 | h | /*
This file is a part of JRTPLIB
Copyright (c) 1999-2005 Jori Liesenborgs
Contact: jori@lumumba.uhasselt.be
This library was developed at the "Expertisecentrum Digitale Media"
(http://www.edm.uhasselt.be), a research center of the Hasselt University
(http://www.uhasselt.be). The library is based upon work done for
my thesis at the School for Knowledge Technology (Belgium/The Netherlands).
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
IN THE SOFTWARE.
*/
#ifndef RTPTRANSMITTER_H
#define RTPTRANSMITTER_H
#include "rtpconfig.h"
#include "rtptypes.h"
class RTPRawPacket;
class RTPAddress;
class RTPTransmissionParams;
class RTPTime;
class RTPTransmissionInfo;
// Abstract class from which actual transmission components should be derived
class RTPTransmitter
{
public:
enum TransmissionProtocol { IPv4UDPProto, IPv6UDPProto, IPv4GSTProto, UserDefinedProto };
enum ReceiveMode { AcceptAll,AcceptSome,IgnoreSome };
protected:
RTPTransmitter() { }
public:
virtual ~RTPTransmitter() { }
// The init function is there for initialization before any other threads
// may access the object (e.g. initialization of mutexes)
virtual int Init(bool threadsafe) = 0;
virtual int Create(size_t maxpacksize,const RTPTransmissionParams *transparams) = 0;
virtual void Destroy() = 0;
virtual int Get_RTPRECEIVEBUFFER_Size(void)=0;
virtual int Get_RTCPRECEIVEBUFFER_Size(void)=0;
virtual int Get_RTPTRANSMITBUFFER_Size(void)=0;
virtual int Get_RTCPTRANSMITBUFFER_Size(void)=0;
// The user MUST delete the returned instance when it is no longer needed
virtual RTPTransmissionInfo *GetTransmissionInfo() = 0;
// If the buffersize ins't large enough, the transmitter must fill in the
// required length in 'bufferlength'
// If the size is ok, bufferlength is adjusted so that it indicates the
// amount of bytes in the buffer that are part of the hostname.
// The buffer is NOT null terminated!
virtual int GetLocalHostName(u_int8_t *buffer,size_t *bufferlength) = 0;
virtual bool ComesFromThisTransmitter(const RTPAddress *addr) = 0;
virtual size_t GetHeaderOverhead() = 0;
virtual int Poll() = 0;
// If dataavailable is not NULL, it should be set to true if true if data was read
// and to false otherwise
virtual int WaitForIncomingData(const RTPTime &delay,bool *dataavailable = 0) = 0;
virtual int AbortWait() = 0;
virtual int SendRTPData(const void *data,size_t len) = 0;
virtual int SendRTCPData(const void *data,size_t len) = 0;
virtual void ResetPacketCount() = 0;
virtual u_int32_t GetNumRTPPacketsSent() = 0;
virtual u_int32_t GetNumRTCPPacketsSent() = 0;
virtual int AddDestination(const RTPAddress &addr) = 0;
virtual int DeleteDestination(const RTPAddress &addr) = 0;
virtual void ClearDestinations() = 0;
virtual bool SupportsMulticasting() = 0;
virtual int JoinMulticastGroup(const RTPAddress &addr) = 0;
virtual int LeaveMulticastGroup(const RTPAddress &addr) = 0;
virtual void LeaveAllMulticastGroups() = 0;
// Note: the list of addresses must be cleared when the receive mode is changed!
virtual int SetReceiveMode(RTPTransmitter::ReceiveMode m) = 0;
virtual int AddToIgnoreList(const RTPAddress &addr) = 0;
virtual int DeleteFromIgnoreList(const RTPAddress &addr)= 0;
virtual void ClearIgnoreList() = 0;
virtual int AddToAcceptList(const RTPAddress &addr) = 0;
virtual int DeleteFromAcceptList(const RTPAddress &addr) = 0;
virtual void ClearAcceptList() = 0;
virtual int SetMaximumPacketSize(size_t s) = 0;
virtual bool NewDataAvailable() = 0;
virtual RTPRawPacket *GetNextPacket() = 0;
#ifdef RTPDEBUG
virtual void Dump() = 0;
#endif // RTPDEBUG
#ifdef _NVR_
virtual void get_sock( int *rtp_sock, int *rtcp_sock ){ *rtp_sock=-1; *rtcp_sock=-1; }
#endif
};
// Abstract class from which actual transmission parameters should be derived
class RTPTransmissionParams
{
protected:
RTPTransmissionParams(RTPTransmitter::TransmissionProtocol p) { protocol = p; }
public:
virtual ~RTPTransmissionParams() { }
RTPTransmitter::TransmissionProtocol GetTransmissionProtocol() const { return protocol; }
private:
RTPTransmitter::TransmissionProtocol protocol;
};
class RTPTransmissionInfo
{
protected:
RTPTransmissionInfo(RTPTransmitter::TransmissionProtocol p) { protocol = p; }
public:
virtual ~RTPTransmissionInfo() { }
RTPTransmitter::TransmissionProtocol GetTransmissionProtocol() const { return protocol; }
private:
RTPTransmitter::TransmissionProtocol protocol;
};
#endif // RTPTRANSMITTER_H
| [
"j.neuschaefer@gmx.net"
] | j.neuschaefer@gmx.net |
987cd95ad685bcaf958144be9ff5c19a6e9c4e99 | 2137840cd9dddfddd80431f0e2efcbac3bd6a2fa | /libcaf_core/caf/inspector_access.hpp | 3897cc992a3a69393f5260f2b7328e0ec2396b15 | [] | no_license | templarzq/actor-framework | 48a191a4c55d421e633762cfb99eff37e039fcdc | 1b29bf1031e4fd960ce6942a394904d44d02daf4 | refs/heads/master | 2023-03-22T04:44:51.509134 | 2021-03-08T18:58:10 | 2021-03-08T18:58:10 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 24,981 | hpp | // This file is part of CAF, the C++ Actor Framework. See the file LICENSE in
// the main distribution directory for license terms and copyright or visit
// https://github.com/actor-framework/actor-framework/blob/master/LICENSE.
#pragma once
#include <chrono>
#include <memory>
#include <tuple>
#include <utility>
#ifdef __has_include
# if __has_include(<optional>)
# include <optional>
# define CAF_HAS_STD_OPTIONAL
# endif
# if __has_include(<variant>)
# include <variant>
# define CAF_HAS_STD_VARIANT
# endif
#endif
#include "caf/allowed_unsafe_message_type.hpp"
#include "caf/detail/as_mutable_ref.hpp"
#include "caf/detail/parse.hpp"
#include "caf/detail/print.hpp"
#include "caf/detail/type_list.hpp"
#include "caf/error.hpp"
#include "caf/fwd.hpp"
#include "caf/inspector_access_base.hpp"
#include "caf/inspector_access_type.hpp"
#include "caf/intrusive_ptr.hpp"
#include "caf/optional.hpp"
#include "caf/sec.hpp"
#include "caf/span.hpp"
#include "caf/sum_type_access.hpp"
#include "caf/variant.hpp"
namespace caf::detail {
// -- predicates ---------------------------------------------------------------
/// Utility class for predicates that always return `true`.
struct always_true_t {
template <class... Ts>
[[nodiscard]] constexpr bool operator()(Ts&&...) const noexcept {
return true;
}
};
/// Predicate that always returns `true`.
constexpr auto always_true = always_true_t{};
// -- traits -------------------------------------------------------------------
template <class>
constexpr bool assertion_failed_v = false;
// TODO: remove with CAF 0.19
template <class T, class Inspector, class Obj>
class has_static_apply {
private:
template <class U>
static auto sfinae(Inspector* f, Obj* x) -> decltype(U::apply(*f, *x));
template <class U>
static auto sfinae(...) -> std::false_type;
using sfinae_type = decltype(sfinae<T>(nullptr, nullptr));
public:
static constexpr bool value
= !std::is_same<sfinae_type, std::false_type>::value;
};
template <class T, class Inspector, class Obj>
constexpr bool has_static_apply_v = has_static_apply<T, Inspector, Obj>::value;
// -- loading ------------------------------------------------------------------
// Converts a setter that returns void, error or bool to a sync function object
// taking no arguments that always returns a bool.
template <class Inspector, class Set, class ValueType>
auto bind_setter(Inspector& f, Set& set, ValueType& tmp) {
using set_result_type = decltype(set(std::move(tmp)));
if constexpr (std::is_same<set_result_type, bool>::value) {
return [&] { return set(std::move(tmp)); };
} else if constexpr (std::is_same<set_result_type, error>::value) {
return [&] {
if (auto err = set(std::move(tmp)); !err) {
return true;
} else {
f.set_error(std::move(err));
return false;
}
};
} else {
static_assert(std::is_same<set_result_type, void>::value,
"a setter must return caf::error, bool or void");
return [&] {
set(std::move(tmp));
return true;
};
}
}
// TODO: remove with CAF 0.19
template <class Inspector, class T>
[[deprecated("please provide apply instead of apply_object/apply_value")]] //
std::enable_if_t<!has_static_apply_v<inspector_access<T>, Inspector, T>, bool>
load(Inspector& f, T& x, inspector_access_type::specialization) {
return inspector_access<T>::apply_value(f, x);
}
template <class Inspector, class T>
std::enable_if_t<has_static_apply_v<inspector_access<T>, Inspector, T>, bool>
load(Inspector& f, T& x, inspector_access_type::specialization) {
return inspector_access<T>::apply(f, x);
}
template <class Inspector, class T>
bool load(Inspector& f, T& x, inspector_access_type::inspect) {
return inspect(f, x);
}
template <class Inspector, class T>
bool load(Inspector& f, T& x, inspector_access_type::builtin) {
return f.value(x);
}
template <class Inspector, class T>
bool load(Inspector& f, T& x, inspector_access_type::builtin_inspect) {
return f.builtin_inspect(x);
}
template <class Inspector, class T>
bool load(Inspector& f, T& x, inspector_access_type::empty) {
return f.object(x).fields();
}
template <class Inspector, class T>
bool load(Inspector& f, T&, inspector_access_type::unsafe) {
f.emplace_error(sec::unsafe_type);
return false;
}
template <class Inspector, class T, size_t N>
bool load(Inspector& f, T (&xs)[N], inspector_access_type::tuple) {
return f.tuple(xs);
}
template <class Inspector, class T>
bool load(Inspector& f, T& xs, inspector_access_type::tuple) {
return f.tuple(xs);
}
template <class Inspector, class T>
bool load(Inspector& f, T& x, inspector_access_type::map) {
return f.map(x);
}
template <class Inspector, class T>
bool load(Inspector& f, T& x, inspector_access_type::list) {
return f.list(x);
}
template <class Inspector, class T>
std::enable_if_t<accepts_opaque_value<Inspector, T>::value, bool>
load(Inspector& f, T& x, inspector_access_type::none) {
return f.opaque_value(x);
}
template <class Inspector, class T>
std::enable_if_t<!accepts_opaque_value<Inspector, T>::value, bool>
load(Inspector&, T&, inspector_access_type::none) {
static_assert(
detail::assertion_failed_v<T>,
"please provide an inspect overload for T or specialize inspector_access");
return false;
}
template <class Inspector, class T>
bool load(Inspector& f, T& x) {
return load(f, x, inspect_access_type<Inspector, T>());
}
template <class Inspector, class T, class IsValid, class SyncValue>
bool load_field(Inspector& f, string_view field_name, T& x, IsValid& is_valid,
SyncValue& sync_value) {
using impl = std::conditional_t<is_complete<inspector_access<T>>, // if
inspector_access<T>, // then
inspector_access_base<T>>; // else
return impl::load_field(f, field_name, x, is_valid, sync_value);
}
template <class Inspector, class T, class IsValid, class SyncValue,
class SetFallback>
bool load_field(Inspector& f, string_view field_name, T& x, IsValid& is_valid,
SyncValue& sync_value, SetFallback& set_fallback) {
using impl = std::conditional_t<is_complete<inspector_access<T>>, // if
inspector_access<T>, // then
inspector_access_base<T>>; // else
return impl::load_field(f, field_name, x, is_valid, sync_value, set_fallback);
}
// -- saving -------------------------------------------------------------------
// TODO: remove with CAF 0.19
template <class Inspector, class T>
[[deprecated("please provide apply instead of apply_object/apply_value")]] //
std::enable_if_t<!has_static_apply_v<inspector_access<T>, Inspector, T>, bool>
save(Inspector& f, T& x, inspector_access_type::specialization) {
return inspector_access<T>::apply_value(f, x);
}
template <class Inspector, class T>
std::enable_if_t<has_static_apply_v<inspector_access<T>, Inspector, T>, bool>
save(Inspector& f, T& x, inspector_access_type::specialization) {
return inspector_access<T>::apply(f, x);
}
template <class Inspector, class T>
bool save(Inspector& f, T& x, inspector_access_type::inspect) {
return inspect(f, x);
}
template <class Inspector, class T>
bool save(Inspector& f, T& x, inspector_access_type::builtin) {
return f.value(x);
}
template <class Inspector, class T>
bool save(Inspector& f, T& x, inspector_access_type::builtin_inspect) {
return f.builtin_inspect(x);
}
template <class Inspector, class T>
bool save(Inspector& f, T& x, inspector_access_type::empty) {
return f.object(x).fields();
}
template <class Inspector, class T>
bool save(Inspector& f, T&, inspector_access_type::unsafe) {
f.emplace_error(sec::unsafe_type);
return false;
}
template <class Inspector, class T, size_t N>
bool save(Inspector& f, T (&xs)[N], inspector_access_type::tuple) {
return f.tuple(xs);
}
template <class Inspector, class T>
bool save(Inspector& f, const T& xs, inspector_access_type::tuple) {
return f.tuple(xs);
}
template <class Inspector, class T>
bool save(Inspector& f, T& x, inspector_access_type::map) {
return f.map(x);
}
template <class Inspector, class T>
bool save(Inspector& f, T& x, inspector_access_type::list) {
return f.list(x);
}
template <class Inspector, class T>
std::enable_if_t<accepts_opaque_value<Inspector, T>::value, bool>
save(Inspector& f, T& x, inspector_access_type::none) {
return f.opaque_value(x);
}
template <class Inspector, class T>
std::enable_if_t<!accepts_opaque_value<Inspector, T>::value, bool>
save(Inspector&, T&, inspector_access_type::none) {
static_assert(
detail::assertion_failed_v<T>,
"please provide an inspect overload for T or specialize inspector_access");
return false;
}
template <class Inspector, class T>
bool save(Inspector& f, T& x) {
return save(f, x, inspect_access_type<Inspector, T>());
}
template <class Inspector, class T>
bool save(Inspector& f, const T& x) {
if constexpr (!std::is_function<T>::value) {
return save(f, as_mutable_ref(x), inspect_access_type<Inspector, T>());
} else {
// Only inspector such as the stringification_inspector are going to accept
// function pointers. Most other inspectors are going to trigger a static
// assertion when passing `inspector_access_type::none`.
auto fptr = std::add_pointer_t<T>{x};
return save(f, fptr, inspector_access_type::none{});
}
}
template <class Inspector, class T>
bool save_field(Inspector& f, string_view field_name, T& x) {
using impl = std::conditional_t<is_complete<inspector_access<T>>, // if
inspector_access<T>, // then
inspector_access_base<T>>; // else
return impl::save_field(f, field_name, x);
}
template <class Inspector, class IsPresent, class Get>
bool save_field(Inspector& f, string_view field_name, IsPresent& is_present,
Get& get) {
using T = std::decay_t<decltype(get())>;
using impl = std::conditional_t<is_complete<inspector_access<T>>, // if
inspector_access<T>, // then
inspector_access_base<T>>; // else
return impl::save_field(f, field_name, is_present, get);
}
} // namespace caf::detail
namespace caf {
// -- customization points -----------------------------------------------------
/// Customization point for adding support for a custom type.
template <class T>
struct inspector_access;
// -- inspection support for optional values -----------------------------------
template <class T>
struct optional_inspector_traits;
template <class T>
struct optional_inspector_traits<optional<T>> {
using container_type = optional<T>;
using value_type = T;
template <class... Ts>
static void emplace(container_type& container, Ts&&... xs) {
container.emplace(std::forward<Ts>(xs)...);
}
};
template <class T>
struct optional_inspector_traits<intrusive_ptr<T>> {
using container_type = intrusive_ptr<T>;
using value_type = T;
template <class... Ts>
static void emplace(container_type& container, Ts&&... xs) {
container.reset(new T(std::forward<Ts>(xs)...));
}
};
template <class T>
struct optional_inspector_traits<std::unique_ptr<T>> {
using container_type = std::unique_ptr<T>;
using value_type = T;
template <class... Ts>
static void emplace(container_type& container, Ts&&... xs) {
container = std::make_unique<T>(std::forward<Ts>(xs)...);
}
};
template <class T>
struct optional_inspector_traits<std::shared_ptr<T>> {
using container_type = std::shared_ptr<T>;
using value_type = T;
template <class... Ts>
static void emplace(container_type& container, Ts&&... xs) {
container = std::make_shared<T>(std::forward<Ts>(xs)...);
}
};
/// Provides inspector access for types that represent optional values.
template <class T>
struct optional_inspector_access {
using traits = optional_inspector_traits<T>;
using container_type = typename traits::container_type;
using value_type = typename traits::value_type;
template <class Inspector>
[[nodiscard]] static bool apply(Inspector& f, container_type& x) {
return f.object(x).fields(f.field("value", x));
}
template <class Inspector>
[[deprecated("use apply instead")]] static bool
apply_object(Inspector& f, container_type& x) {
return apply(f, x);
}
template <class Inspector>
[[deprecated("use apply instead")]] static bool
apply_value(Inspector& f, container_type& x) {
return apply(f, x);
}
template <class Inspector>
static bool
save_field(Inspector& f, string_view field_name, container_type& x) {
auto is_present = [&x] { return static_cast<bool>(x); };
auto get = [&x]() -> decltype(auto) { return *x; };
return detail::save_field(f, field_name, is_present, get);
}
template <class Inspector, class IsPresent, class Get>
static bool save_field(Inspector& f, string_view field_name,
IsPresent& is_present, Get& get) {
return detail::save_field(f, field_name, is_present, get);
}
template <class Inspector, class IsValid, class SyncValue>
static bool load_field(Inspector& f, string_view field_name,
container_type& x, IsValid& is_valid,
SyncValue& sync_value) {
traits::emplace(x);
auto reset = [&x] { x.reset(); };
return detail::load_field(f, field_name, *x, is_valid, sync_value, reset);
}
template <class Inspector, class IsValid, class SyncValue, class SetFallback>
static bool load_field(Inspector& f, string_view field_name,
container_type& x, IsValid& is_valid,
SyncValue& sync_value, SetFallback& set_fallback) {
traits::emplace(x);
return detail::load_field(f, field_name, *x, is_valid, sync_value,
set_fallback);
}
};
// -- inspection support for optional<T> ---------------------------------------
template <class T>
struct inspector_access<optional<T>> : optional_inspector_access<optional<T>> {
// nop
};
#ifdef CAF_HAS_STD_OPTIONAL
template <class T>
struct optional_inspector_traits<std::optional<T>> {
using container_type = std::optional<T>;
using value_type = T;
template <class... Ts>
static void emplace(container_type& container, Ts&&... xs) {
container.emplace(std::forward<Ts>(xs)...);
}
};
template <class T>
struct inspector_access<std::optional<T>>
: optional_inspector_access<std::optional<T>> {
// nop
};
#endif
// -- inspection support for error ---------------------------------------------
template <>
struct inspector_access<std::unique_ptr<error::data>>
: optional_inspector_access<std::unique_ptr<error::data>> {
// nop
};
// -- inspection support for variant<Ts...> ------------------------------------
template <class T>
struct variant_inspector_traits;
template <class... Ts>
struct variant_inspector_traits<variant<Ts...>> {
static_assert(
(has_type_id_v<Ts> && ...),
"inspectors requires that each type in a variant has a type_id");
using value_type = variant<Ts...>;
static constexpr type_id_t allowed_types[] = {type_id_v<Ts>...};
static auto type_index(const value_type& x) {
return x.index();
}
template <class F, class Value>
static auto visit(F&& f, Value&& x) {
return caf::visit(std::forward<F>(f), std::forward<Value>(x));
}
template <class U>
static auto assign(value_type& x, U&& value) {
x = std::forward<U>(value);
}
template <class F>
static bool load(type_id_t, F&, detail::type_list<>) {
return false;
}
template <class F, class U, class... Us>
static bool
load(type_id_t type, F& continuation, detail::type_list<U, Us...>) {
if (type_id_v<U> == type) {
auto tmp = U{};
continuation(tmp);
return true;
}
return load(type, continuation, detail::type_list<Us...>{});
}
template <class F>
static bool load(type_id_t type, F continuation) {
return load(type, continuation, detail::type_list<Ts...>{});
}
};
template <class T>
struct variant_inspector_access {
using value_type = T;
using traits = variant_inspector_traits<T>;
template <class Inspector>
[[nodiscard]] static bool apply(Inspector& f, value_type& x) {
return f.object(x).fields(f.field("value", x));
}
template <class Inspector>
[[deprecated("use apply instead")]] static bool
apply_object(Inspector& f, T& x) {
return apply(f, x);
}
template <class Inspector>
[[deprecated("use apply instead")]] static bool
apply_value(Inspector& f, T& x) {
return apply(f, x);
}
template <class Inspector>
static bool save_field(Inspector& f, string_view field_name, value_type& x) {
auto g = [&f](auto& y) { return detail::save(f, y); };
return f.begin_field(field_name, make_span(traits::allowed_types),
traits::type_index(x)) //
&& traits::visit(g, x) //
&& f.end_field();
}
template <class Inspector, class IsPresent, class Get>
static bool save_field(Inspector& f, string_view field_name,
IsPresent& is_present, Get& get) {
auto allowed_types = make_span(traits::allowed_types);
if (is_present()) {
auto&& x = get();
auto g = [&f](auto& y) { return detail::save(f, y); };
return f.begin_field(field_name, true, allowed_types,
traits::type_index(x)) //
&& traits::visit(g, x) //
&& f.end_field();
}
return f.begin_field(field_name, false, allowed_types, 0) //
&& f.end_field();
}
template <class Inspector>
static bool load_variant_value(Inspector& f, string_view field_name,
value_type& x, type_id_t runtime_type) {
auto res = false;
auto type_found = traits::load(runtime_type, [&](auto& tmp) {
if (!detail::load(f, tmp))
return;
traits::assign(x, std::move(tmp));
res = true;
return;
});
if (!type_found)
f.emplace_error(sec::invalid_field_type, to_string(field_name));
return res;
}
template <class Inspector, class IsValid, class SyncValue>
static bool load_field(Inspector& f, string_view field_name, value_type& x,
IsValid& is_valid, SyncValue& sync_value) {
size_t type_index = std::numeric_limits<size_t>::max();
auto allowed_types = make_span(traits::allowed_types);
if (!f.begin_field(field_name, allowed_types, type_index))
return false;
if (type_index >= allowed_types.size()) {
f.emplace_error(sec::invalid_field_type, to_string(field_name));
return false;
}
auto runtime_type = allowed_types[type_index];
if (!load_variant_value(f, field_name, x, runtime_type))
return false;
if (!is_valid(x)) {
f.emplace_error(sec::field_invariant_check_failed, to_string(field_name));
return false;
}
if (!sync_value()) {
if (!f.get_error())
f.emplace_error(sec::field_value_synchronization_failed,
to_string(field_name));
return false;
}
return f.end_field();
}
template <class Inspector, class IsValid, class SyncValue, class SetFallback>
static bool load_field(Inspector& f, string_view field_name, value_type& x,
IsValid& is_valid, SyncValue& sync_value,
SetFallback& set_fallback) {
bool is_present = false;
auto allowed_types = make_span(traits::allowed_types);
size_t type_index = std::numeric_limits<size_t>::max();
if (!f.begin_field(field_name, is_present, allowed_types, type_index))
return false;
if (is_present) {
if (type_index >= allowed_types.size()) {
f.emplace_error(sec::invalid_field_type, to_string(field_name));
return false;
}
auto runtime_type = allowed_types[type_index];
if (!load_variant_value(f, field_name, x, runtime_type))
return false;
if (!is_valid(x)) {
f.emplace_error(sec::field_invariant_check_failed,
to_string(field_name));
return false;
}
if (!sync_value()) {
if (!f.get_error())
f.emplace_error(sec::field_value_synchronization_failed,
to_string(field_name));
return false;
}
} else {
set_fallback();
}
return f.end_field();
}
};
template <class... Ts>
struct inspector_access<variant<Ts...>>
: variant_inspector_access<variant<Ts...>> {
// nop
};
#ifdef CAF_HAS_STD_VARIANT
template <class... Ts>
struct variant_inspector_traits<std::variant<Ts...>> {
static_assert(
(has_type_id_v<Ts> && ...),
"inspectors requires that each type in a variant has a type_id");
using value_type = std::variant<Ts...>;
static constexpr type_id_t allowed_types[] = {type_id_v<Ts>...};
static auto type_index(const value_type& x) {
return x.index();
}
template <class F, class Value>
static auto visit(F&& f, Value&& x) {
return std::visit(std::forward<F>(f), std::forward<Value>(x));
}
template <class U>
static auto assign(value_type& x, U&& value) {
x = std::forward<U>(value);
}
template <class F>
static bool load(type_id_t, F&, detail::type_list<>) {
return false;
}
template <class F, class U, class... Us>
static bool
load(type_id_t type, F& continuation, detail::type_list<U, Us...>) {
if (type_id_v<U> == type) {
auto tmp = U{};
continuation(tmp);
return true;
}
return load(type, continuation, detail::type_list<Us...>{});
}
template <class F>
static bool load(type_id_t type, F continuation) {
return load(type, continuation, detail::type_list<Ts...>{});
}
};
template <class... Ts>
struct inspector_access<std::variant<Ts...>>
: variant_inspector_access<std::variant<Ts...>> {
// nop
};
#endif
// -- inspection support for std::chrono types ---------------------------------
template <class Rep, class Period>
struct inspector_access<std::chrono::duration<Rep, Period>>
: inspector_access_base<std::chrono::duration<Rep, Period>> {
using value_type = std::chrono::duration<Rep, Period>;
template <class Inspector>
static bool apply(Inspector& f, value_type& x) {
if (f.has_human_readable_format()) {
auto get = [&x] {
std::string str;
detail::print(str, x);
return str;
};
auto set = [&x](std::string str) {
auto err = detail::parse(str, x);
return !err;
};
return f.apply(get, set);
} else {
auto get = [&x] { return x.count(); };
auto set = [&x](Rep value) {
x = std::chrono::duration<Rep, Period>{value};
return true;
};
return f.apply(get, set);
}
}
template <class Inspector>
[[deprecated("use apply instead")]] static bool
apply_object(Inspector& f, value_type& x) {
return apply(f, x);
}
template <class Inspector>
[[deprecated("use apply instead")]] static bool
apply_value(Inspector& f, value_type& x) {
return apply(f, x);
}
};
template <class Duration>
struct inspector_access<
std::chrono::time_point<std::chrono::system_clock, Duration>>
: inspector_access_base<
std::chrono::time_point<std::chrono::system_clock, Duration>> {
using value_type
= std::chrono::time_point<std::chrono::system_clock, Duration>;
template <class Inspector>
static bool apply(Inspector& f, value_type& x) {
if (f.has_human_readable_format()) {
auto get = [&x] {
std::string str;
detail::print(str, x);
return str;
};
auto set = [&x](std::string str) { return detail::parse(str, x); };
return f.apply(get, set);
} else {
using rep_type = typename Duration::rep;
auto get = [&x] { return x.time_since_epoch().count(); };
auto set = [&x](rep_type value) {
x = value_type{Duration{value}};
return true;
};
return f.apply(get, set);
}
}
template <class Inspector>
[[deprecated("use apply instead")]] static bool
apply_object(Inspector& f, value_type& x) {
return apply(f, x);
}
template <class Inspector>
[[deprecated("use apply instead")]] static bool
apply_value(Inspector& f, value_type& x) {
return apply(f, x);
}
};
// -- deprecated API -----------------------------------------------------------
template <class T>
struct default_inspector_access : inspector_access_base<T> {
template <class Inspector>
[[deprecated("call f.apply(x) instead")]] static bool
apply_object(Inspector& f, T& x) {
return f.apply(x);
}
template <class Inspector>
[[deprecated("call f.apply(x) instead")]] static bool
apply_value(Inspector& f, T& x) {
return f.apply(x);
}
};
} // namespace caf
| [
"dominik@charousset.de"
] | dominik@charousset.de |
a20ffd3eb5fbc777053f5de1a06ccd7c57fdd778 | 3f33fa904475034c9e3decfbaebc195bdaf4306d | /source/statemachine/SplashScreen.cpp | 19ebc1de9f83cd08c76d5d9b24b65df61f5a2c02 | [] | no_license | jordan-reid/lightningengine | 739379c116cfb9bc22f682a5d06ffddd87704bfa | a29be0a99aebaace305a6c51477e1332c1d2ce9f | refs/heads/master | 2016-09-06T06:08:53.504146 | 2015-05-25T02:04:38 | 2015-05-25T02:04:38 | 35,685,800 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 374 | cpp | #include "SplashScreen.h"
#include "../InputManager/InputManager.h"
CSplashScreen::CSplashScreen(void)
{
SetGameStateType(SplashScreenState);
SetName("SplashScreen State");
}
CSplashScreen::~CSplashScreen(void)
{
}
bool CSplashScreen::Input(CInputManager* _inputManager)
{
return true;
}
void CSplashScreen::Update(void)
{
}
void CSplashScreen::Render(void)
{
}
| [
"jreid2712@gmail.com"
] | jreid2712@gmail.com |
b3ef4561c8ed4e03d3cddc3013e383a5bff2eb66 | 66e22bdba0f76ccee2fe9c5a33003ed46ea13f1d | /timer.h | db9acf9b113f48200e406e59a451eb8b3857d8f2 | [] | no_license | MoriartyShan/AiLearning | 960ccb23911f1b57f04010c314a3b7a554efb9e3 | 30c5f450751d68cfa0682374899128da077a6b09 | refs/heads/master | 2023-05-26T07:21:28.663609 | 2021-06-09T11:12:23 | 2021-06-09T11:12:23 | 267,351,619 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 1,667 | h | //
// Created by moriarty on 2021/5/30.
//
#ifndef NEURALNETWORK_TIMER_H
#define NEURALNETWORK_TIMER_H
#include <glog/logging.h>
#include <chrono>
#include <string>
namespace AiLearning {
class MicrosecondTimer {
public:
// for timestamp, use GetTimeStampNow
using Time = std::chrono::time_point<std::chrono::high_resolution_clock>;
static Time now() {
return std::chrono::high_resolution_clock::now();
}
static long long to_microsecond(const Time &begin, const Time &end) {
return std::chrono::duration_cast<std::chrono::microseconds>(
end - begin).count();
}
static const long long SecondToMicro = 1000000L;
MicrosecondTimer() :
ended_(0), label_("Timer") {
}
MicrosecondTimer(const char *label) : ended_(0), label_(label) {}
~MicrosecondTimer() {}
Time begin() {
ended_ = 0;
start_time_ = now();
return start_time_;
}
Time begin(const char *label) {
label_ = label;
return begin();
}
long long end(bool display = true) {
return end(label_.c_str(), display);
}
long long end(const char *label, bool display = true) {
if (ended_ == 1) {
LOG(INFO) << label << " has ended";
return 0;
}
ended_ = 1;
long long micro_sec_passed = to_microsecond(start_time_, now());
if (display) {
LOG(INFO) << "Timer " << label << "=["
<< micro_sec_passed << "] microseconds";
}
return micro_sec_passed;
}
std::string &label() { return label_; }
const std::string &label() const { return label_; }
private:
int ended_;
std::string label_;
Time start_time_;
};
}//namespace AiLearning
#endif //NEURALNETWORK_TIMER_H
| [
"hitguohang@126.com"
] | hitguohang@126.com |
e31932902e5b15247f35bf316b506b431715198a | 2e19e46dc13a54d183de501fb572781b13ddf1a4 | /drawMazeASII.hpp | 0384e0c289177e4ac07b5d09f359ed0aac2259bd | [] | no_license | kamkamkil/MazeGenerator | 279e7d1fd1c0dad5f87b736315a9adf607985ac6 | 148dca7a31f56aa2362943a885a44f22ee423b42 | refs/heads/master | 2023-02-25T04:21:47.164546 | 2021-01-01T10:56:53 | 2021-01-01T10:56:53 | 318,317,183 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,372 | hpp | #pragma once
#include <iostream>
#include "mazeGenerator.hpp"
/**
* @brief wypisuje labirynt w postaci ascii
*
* @param table labirynt
*/
void drawMazeASCII(MyTable table)
{
bool drawResult[table.hight * 2 + 1][table.width * 2 + 1];
for (int y = 0; y < table.hight * 2 + 1; y++)
{
for (int x = 0; x < table.width * 2 + 1; x++)
{
drawResult[y][x] = false;
}
}
for (int a = 0; a < table.hight; a++)
{
for (int b = 0; b < table.width; b++)
{
int x = b * 2 + 1;
int y = a * 2 + 1;
auto node = table(a, b);
if (node.up || node.right || node.down || node.left)
drawResult[y][x] = true;
if (node.up)
{
drawResult[y - 1][x] = true;
};
if (node.left)
{
drawResult[y][x - 1] = true;
};
if (node.down)
{
drawResult[y + 1][x] = true;
};
if (node.right)
{
drawResult[y][x + 1] = true;
};
}
}
for (int y = 0; y < table.hight * 2 + 1; y++)
{
for (int x = 0; x < table.width * 2 + 1; x++)
{
std::cout << (drawResult[y][x] ? " " : "x");
}
std::cout << std::endl;
}
} | [
"kamil@user.com"
] | kamil@user.com |
53e57ce5e1fc664363128cbe34299b4b0a283f39 | a3ebb7445087e39b2c9868d1a63e7298fb2c78cc | /src/qt/bitcoingui.cpp | ec18a80069bb41883f42deacf3aa30b22fba47b0 | [
"MIT"
] | permissive | CCPorg/REX-RecyclingCoin-Ver-631-Original | 17e46616f5e5abe440a11b9fe1a5383630e76f3e | 4b4620282685ef82b22c5718eda3454e6c520ea2 | refs/heads/master | 2021-01-02T09:37:17.217339 | 2014-05-19T13:59:28 | 2014-05-19T13:59:28 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 34,805 | cpp | /*
* Qt4 bitcoin GUI.
*
* W.J. van der Laan 2011-2012
* The Bitcoin Developers 2011-2012
* The Litecoin Developers 2011-2013
* The RecyclingCoin Developers 2013
*/
#include "bitcoingui.h"
#include "transactiontablemodel.h"
#include "addressbookpage.h"
#include "sendcoinsdialog.h"
#include "signverifymessagedialog.h"
#include "optionsdialog.h"
#include "aboutdialog.h"
#include "clientmodel.h"
#include "walletmodel.h"
#include "editaddressdialog.h"
#include "optionsmodel.h"
#include "transactiondescdialog.h"
#include "addresstablemodel.h"
#include "transactionview.h"
#include "overviewpage.h"
#include "miningpage.h"
#include "bitcoinunits.h"
#include "guiconstants.h"
#include "askpassphrasedialog.h"
#include "notificator.h"
#include "guiutil.h"
#include "rpcconsole.h"
#ifdef Q_WS_MAC
#include "macdockiconhandler.h"
#endif
#include <QApplication>
#include <QMainWindow>
#include <QMenuBar>
#include <QMenu>
#include <QIcon>
#include <QTabWidget>
#include <QVBoxLayout>
#include <QToolBar>
#include <QStatusBar>
#include <QLabel>
#include <QLineEdit>
#include <QPushButton>
#include <QLocale>
#include <QMessageBox>
#include <QProgressBar>
#include <QStackedWidget>
#include <QDateTime>
#include <QMovie>
#include <QFileDialog>
#include <QDesktopServices>
#include <QTimer>
#include <QDragEnterEvent>
#include <QUrl>
#include <iostream>
BitcoinGUI::BitcoinGUI(QWidget *parent):
QMainWindow(parent),
clientModel(0),
walletModel(0),
encryptWalletAction(0),
changePassphraseAction(0),
aboutQtAction(0),
trayIcon(0),
notificator(0),
rpcConsole(0)
{
resize(850, 550);
setWindowTitle(tr("RecyclingCoin") + " - " + tr("Wallet"));
#ifndef Q_WS_MAC
qApp->setWindowIcon(QIcon(":icons/bitcoin"));
setWindowIcon(QIcon(":icons/bitcoin"));
#else
setUnifiedTitleAndToolBarOnMac(true);
QApplication::setAttribute(Qt::AA_DontShowIconsInMenus);
#endif
// Accept D&D of URIs
setAcceptDrops(true);
// Create actions for the toolbar, menu bar and tray/dock icon
createActions();
// Create application menu bar
createMenuBar();
// Create the toolbars
createToolBars();
// Create the tray icon (or setup the dock icon)
createTrayIcon();
// Create tabs
overviewPage = new OverviewPage();
miningPage = new MiningPage(this);
transactionsPage = new QWidget(this);
QVBoxLayout *vbox = new QVBoxLayout();
transactionView = new TransactionView(this);
vbox->addWidget(transactionView);
transactionsPage->setLayout(vbox);
addressBookPage = new AddressBookPage(AddressBookPage::ForEditing, AddressBookPage::SendingTab);
receiveCoinsPage = new AddressBookPage(AddressBookPage::ForEditing, AddressBookPage::ReceivingTab);
sendCoinsPage = new SendCoinsDialog(this);
signVerifyMessageDialog = new SignVerifyMessageDialog(this);
centralWidget = new QStackedWidget(this);
centralWidget->addWidget(overviewPage);
centralWidget->addWidget(miningPage);
centralWidget->addWidget(transactionsPage);
centralWidget->addWidget(addressBookPage);
centralWidget->addWidget(receiveCoinsPage);
centralWidget->addWidget(sendCoinsPage);
#ifdef FIRST_CLASS_MESSAGING
centralWidget->addWidget(signVerifyMessageDialog);
#endif
setCentralWidget(centralWidget);
// Create status bar
statusBar();
// Status bar notification icons
QFrame *frameBlocks = new QFrame();
frameBlocks->setContentsMargins(0,0,0,0);
frameBlocks->setMinimumWidth(73);
frameBlocks->setMaximumWidth(73);
QHBoxLayout *frameBlocksLayout = new QHBoxLayout(frameBlocks);
frameBlocksLayout->setContentsMargins(3,0,3,0);
frameBlocksLayout->setSpacing(3);
labelEncryptionIcon = new QLabel();
labelMiningIcon = new QLabel();
labelConnectionsIcon = new QLabel();
labelBlocksIcon = new QLabel();
frameBlocksLayout->addStretch();
frameBlocksLayout->addWidget(labelEncryptionIcon);
frameBlocksLayout->addStretch();
frameBlocksLayout->addWidget(labelMiningIcon);
frameBlocksLayout->addStretch();
frameBlocksLayout->addWidget(labelConnectionsIcon);
frameBlocksLayout->addStretch();
frameBlocksLayout->addWidget(labelBlocksIcon);
frameBlocksLayout->addStretch();
// Progress bar and label for blocks download
progressBarLabel = new QLabel();
progressBarLabel->setVisible(false);
progressBar = new QProgressBar();
progressBar->setAlignment(Qt::AlignCenter);
progressBar->setVisible(false);
statusBar()->addWidget(progressBarLabel);
statusBar()->addWidget(progressBar);
statusBar()->addPermanentWidget(frameBlocks);
syncIconMovie = new QMovie(":/movies/update_spinner", "mng", this);
// Clicking on a transaction on the overview page simply sends you to transaction history page
connect(overviewPage, SIGNAL(transactionClicked(QModelIndex)), this, SLOT(gotoHistoryPage()));
connect(overviewPage, SIGNAL(transactionClicked(QModelIndex)), transactionView, SLOT(focusTransaction(QModelIndex)));
// Doubleclicking on a transaction on the transaction history page shows details
connect(transactionView, SIGNAL(doubleClicked(QModelIndex)), transactionView, SLOT(showDetails()));
rpcConsole = new RPCConsole(this);
connect(openRPCConsoleAction, SIGNAL(triggered()), rpcConsole, SLOT(show()));
// Clicking on "Verify Message" in the address book sends you to the verify message tab
connect(addressBookPage, SIGNAL(verifyMessage(QString)), this, SLOT(gotoVerifyMessageTab(QString)));
// Clicking on "Sign Message" in the receive coins page sends you to the sign message tab
connect(receiveCoinsPage, SIGNAL(signMessage(QString)), this, SLOT(gotoSignMessageTab(QString)));
gotoOverviewPage();
}
BitcoinGUI::~BitcoinGUI()
{
if(trayIcon) // Hide tray icon, as deleting will let it linger until quit (on Ubuntu)
trayIcon->hide();
#ifdef Q_WS_MAC
delete appMenuBar;
#endif
}
void BitcoinGUI::createActions()
{
QActionGroup *tabGroup = new QActionGroup(this);
overviewAction = new QAction(QIcon(":/icons/overview"), tr("&Overview"), this);
overviewAction->setToolTip(tr("Show general overview of wallet"));
overviewAction->setCheckable(true);
overviewAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_1));
tabGroup->addAction(overviewAction);
miningAction = new QAction(QIcon(":/icons/mining"), tr("&Mining"), this);
miningAction->setToolTip(tr("Configure mining"));
miningAction->setCheckable(true);
tabGroup->addAction(miningAction);
historyAction = new QAction(QIcon(":/icons/history"), tr("&Transactions"), this);
historyAction->setToolTip(tr("Browse transaction history"));
historyAction->setCheckable(true);
historyAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_4));
tabGroup->addAction(historyAction);
addressBookAction = new QAction(QIcon(":/icons/address-book"), tr("&Address Book"), this);
addressBookAction->setToolTip(tr("Edit the list of stored addresses and labels"));
addressBookAction->setCheckable(true);
addressBookAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_5));
tabGroup->addAction(addressBookAction);
receiveCoinsAction = new QAction(QIcon(":/icons/receiving_addresses"), tr("&Receive coins"), this);
receiveCoinsAction->setToolTip(tr("Show the list of addresses for receiving payments"));
receiveCoinsAction->setCheckable(true);
receiveCoinsAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_3));
tabGroup->addAction(receiveCoinsAction);
sendCoinsAction = new QAction(QIcon(":/icons/send"), tr("&Send coins"), this);
sendCoinsAction->setToolTip(tr("Send coins to a RecyclingCoin address"));
sendCoinsAction->setCheckable(true);
sendCoinsAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_2));
tabGroup->addAction(sendCoinsAction);
signMessageAction = new QAction(QIcon(":/icons/edit"), tr("Sign &message..."), this);
signMessageAction->setToolTip(tr("Sign a message to prove you own a Bitcoin address"));
tabGroup->addAction(signMessageAction);
verifyMessageAction = new QAction(QIcon(":/icons/transaction_0"), tr("&Verify message..."), this);
verifyMessageAction->setToolTip(tr("Verify a message to ensure it was signed with a specified Bitcoin address"));
tabGroup->addAction(verifyMessageAction);
#ifdef FIRST_CLASS_MESSAGING
firstClassMessagingAction = new QAction(QIcon(":/icons/edit"), tr("S&ignatures"), this);
firstClassMessagingAction->setToolTip(signMessageAction->toolTip() + QString(". / ") + verifyMessageAction->toolTip() + QString("."));
firstClassMessagingAction->setCheckable(true);
tabGroup->addAction(firstClassMessagingAction);
#endif
connect(overviewAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized()));
connect(overviewAction, SIGNAL(triggered()), this, SLOT(gotoOverviewPage()));
connect(miningAction, SIGNAL(triggered()), this, SLOT(gotoMiningPage()));
connect(historyAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized()));
connect(historyAction, SIGNAL(triggered()), this, SLOT(gotoHistoryPage()));
connect(addressBookAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized()));
connect(addressBookAction, SIGNAL(triggered()), this, SLOT(gotoAddressBookPage()));
connect(receiveCoinsAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized()));
connect(receiveCoinsAction, SIGNAL(triggered()), this, SLOT(gotoReceiveCoinsPage()));
connect(sendCoinsAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized()));
connect(sendCoinsAction, SIGNAL(triggered()), this, SLOT(gotoSendCoinsPage()));
connect(signMessageAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized()));
connect(signMessageAction, SIGNAL(triggered()), this, SLOT(gotoSignMessageTab()));
connect(verifyMessageAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized()));
connect(verifyMessageAction, SIGNAL(triggered()), this, SLOT(gotoVerifyMessageTab()));
#ifdef FIRST_CLASS_MESSAGING
connect(firstClassMessagingAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized()));
// Always start with the sign message tab for FIRST_CLASS_MESSAGING
connect(firstClassMessagingAction, SIGNAL(triggered()), this, SLOT(gotoSignMessageTab()));
#endif
quitAction = new QAction(QIcon(":/icons/quit"), tr("E&xit"), this);
quitAction->setToolTip(tr("Quit application"));
quitAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Q));
quitAction->setMenuRole(QAction::QuitRole);
aboutAction = new QAction(QIcon(":/icons/bitcoin"), tr("&About RecyclingCoin"), this);
aboutAction->setToolTip(tr("Show information about RecyclingCoin"));
aboutAction->setMenuRole(QAction::AboutRole);
aboutQtAction = new QAction(tr("About &Qt"), this);
aboutQtAction->setToolTip(tr("Show information about Qt"));
aboutQtAction->setMenuRole(QAction::AboutQtRole);
optionsAction = new QAction(QIcon(":/icons/options"), tr("&Options..."), this);
optionsAction->setToolTip(tr("Modify configuration options for RecyclingCoin"));
optionsAction->setMenuRole(QAction::PreferencesRole);
toggleHideAction = new QAction(QIcon(":/icons/bitcoin"), tr("Show/Hide &RecyclingCoin"), this);
toggleHideAction->setToolTip(tr("Show or hide the RecyclingCoin window"));
exportAction = new QAction(QIcon(":/icons/export"), tr("&Export..."), this);
exportAction->setToolTip(tr("Export the data in the current tab to a file"));
encryptWalletAction = new QAction(QIcon(":/icons/lock_closed"), tr("&Encrypt Wallet..."), this);
encryptWalletAction->setToolTip(tr("Encrypt or decrypt wallet"));
encryptWalletAction->setCheckable(true);
backupWalletAction = new QAction(QIcon(":/icons/filesave"), tr("&Backup Wallet..."), this);
backupWalletAction->setToolTip(tr("Backup wallet to another location"));
changePassphraseAction = new QAction(QIcon(":/icons/key"), tr("&Change Passphrase..."), this);
changePassphraseAction->setToolTip(tr("Change the passphrase used for wallet encryption"));
openRPCConsoleAction = new QAction(QIcon(":/icons/debugwindow"), tr("&Debug window"), this);
openRPCConsoleAction->setToolTip(tr("Open debugging and diagnostic console"));
connect(quitAction, SIGNAL(triggered()), qApp, SLOT(quit()));
connect(optionsAction, SIGNAL(triggered()), this, SLOT(optionsClicked()));
connect(aboutAction, SIGNAL(triggered()), this, SLOT(aboutClicked()));
connect(aboutQtAction, SIGNAL(triggered()), qApp, SLOT(aboutQt()));
connect(toggleHideAction, SIGNAL(triggered()), this, SLOT(toggleHidden()));
connect(encryptWalletAction, SIGNAL(triggered(bool)), this, SLOT(encryptWallet(bool)));
connect(backupWalletAction, SIGNAL(triggered()), this, SLOT(backupWallet()));
connect(changePassphraseAction, SIGNAL(triggered()), this, SLOT(changePassphrase()));
}
void BitcoinGUI::createMenuBar()
{
#ifdef Q_WS_MAC
// Create a decoupled menu bar on Mac which stays even if the window is closed
appMenuBar = new QMenuBar();
#else
// Get the main window's menu bar on other platforms
appMenuBar = menuBar();
#endif
// Configure the menus
QMenu *file = appMenuBar->addMenu(tr("&File"));
file->addAction(backupWalletAction);
file->addAction(exportAction);
#ifndef FIRST_CLASS_MESSAGING
file->addAction(signMessageAction);
file->addAction(verifyMessageAction);
#endif
file->addSeparator();
file->addAction(quitAction);
QMenu *settings = appMenuBar->addMenu(tr("&Settings"));
settings->addAction(encryptWalletAction);
settings->addAction(changePassphraseAction);
settings->addSeparator();
settings->addAction(optionsAction);
QMenu *help = appMenuBar->addMenu(tr("&Help"));
help->addAction(openRPCConsoleAction);
help->addSeparator();
help->addAction(aboutAction);
help->addAction(aboutQtAction);
}
void BitcoinGUI::createToolBars()
{
QToolBar *toolbar = addToolBar(tr("Tabs toolbar"));
toolbar->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
toolbar->addAction(overviewAction);
toolbar->addAction(sendCoinsAction);
toolbar->addAction(receiveCoinsAction);
toolbar->addAction(historyAction);
toolbar->addAction(addressBookAction);
toolbar->addAction(miningAction);
#ifdef FIRST_CLASS_MESSAGING
toolbar->addAction(firstClassMessagingAction);
#endif
QToolBar *toolbar2 = addToolBar(tr("Actions toolbar"));
toolbar2->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
toolbar2->addAction(exportAction);
}
void BitcoinGUI::setClientModel(ClientModel *clientModel)
{
this->clientModel = clientModel;
if(clientModel)
{
// Replace some strings and icons, when using the testnet
if(clientModel->isTestNet())
{
setWindowTitle(windowTitle() + QString(" ") + tr("[testnet]"));
#ifndef Q_WS_MAC
qApp->setWindowIcon(QIcon(":icons/bitcoin_testnet"));
setWindowIcon(QIcon(":icons/bitcoin_testnet"));
#else
MacDockIconHandler::instance()->setIcon(QIcon(":icons/bitcoin_testnet"));
#endif
if(trayIcon)
{
trayIcon->setToolTip(tr("RecyclingCoin client") + QString(" ") + tr("[testnet]"));
trayIcon->setIcon(QIcon(":/icons/toolbar_testnet"));
toggleHideAction->setIcon(QIcon(":/icons/toolbar_testnet"));
}
aboutAction->setIcon(QIcon(":/icons/toolbar_testnet"));
}
// Keep up to date with client
setNumConnections(clientModel->getNumConnections());
connect(clientModel, SIGNAL(numConnectionsChanged(int)), this, SLOT(setNumConnections(int)));
setNumBlocks(clientModel->getNumBlocks(), clientModel->getNumBlocksOfPeers());
connect(clientModel, SIGNAL(numBlocksChanged(int,int)), this, SLOT(setNumBlocks(int,int)));
setMining(false, 0);
connect(clientModel, SIGNAL(miningChanged(bool,int)), this, SLOT(setMining(bool,int)));
// Report errors from network/worker thread
connect(clientModel, SIGNAL(error(QString,QString,bool)), this, SLOT(error(QString,QString,bool)));
rpcConsole->setClientModel(clientModel);
addressBookPage->setOptionsModel(clientModel->getOptionsModel());
receiveCoinsPage->setOptionsModel(clientModel->getOptionsModel());
}
}
void BitcoinGUI::setWalletModel(WalletModel *walletModel)
{
this->walletModel = walletModel;
if(walletModel)
{
// Report errors from wallet thread
connect(walletModel, SIGNAL(error(QString,QString,bool)), this, SLOT(error(QString,QString,bool)));
// Put transaction list in tabs
transactionView->setModel(walletModel);
overviewPage->setModel(walletModel);
addressBookPage->setModel(walletModel->getAddressTableModel());
receiveCoinsPage->setModel(walletModel->getAddressTableModel());
sendCoinsPage->setModel(walletModel);
signVerifyMessageDialog->setModel(walletModel);
miningPage->setModel(clientModel);
setEncryptionStatus(walletModel->getEncryptionStatus());
connect(walletModel, SIGNAL(encryptionStatusChanged(int)), this, SLOT(setEncryptionStatus(int)));
// Balloon popup for new transaction
connect(walletModel->getTransactionTableModel(), SIGNAL(rowsInserted(QModelIndex,int,int)),
this, SLOT(incomingTransaction(QModelIndex,int,int)));
// Ask for passphrase if needed
connect(walletModel, SIGNAL(requireUnlock()), this, SLOT(unlockWallet()));
}
}
void BitcoinGUI::createTrayIcon()
{
QMenu *trayIconMenu;
#ifndef Q_WS_MAC
trayIcon = new QSystemTrayIcon(this);
trayIconMenu = new QMenu(this);
trayIcon->setContextMenu(trayIconMenu);
trayIcon->setToolTip(tr("RecyclingCoin client"));
trayIcon->setIcon(QIcon(":/icons/toolbar"));
connect(trayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)),
this, SLOT(trayIconActivated(QSystemTrayIcon::ActivationReason)));
trayIcon->show();
#else
// Note: On Mac, the dock icon is used to provide the tray's functionality.
MacDockIconHandler *dockIconHandler = MacDockIconHandler::instance();
trayIconMenu = dockIconHandler->dockMenu();
#endif
// Configuration of the tray icon (or dock icon) icon menu
trayIconMenu->addAction(toggleHideAction);
trayIconMenu->addSeparator();
trayIconMenu->addAction(sendCoinsAction);
trayIconMenu->addAction(receiveCoinsAction);
#ifndef FIRST_CLASS_MESSAGING
trayIconMenu->addSeparator();
#endif
trayIconMenu->addAction(signMessageAction);
trayIconMenu->addAction(verifyMessageAction);
trayIconMenu->addSeparator();
trayIconMenu->addAction(optionsAction);
trayIconMenu->addAction(openRPCConsoleAction);
#ifndef Q_WS_MAC // This is built-in on Mac
trayIconMenu->addSeparator();
trayIconMenu->addAction(quitAction);
#endif
notificator = new Notificator(qApp->applicationName(), trayIcon);
}
#ifndef Q_WS_MAC
void BitcoinGUI::trayIconActivated(QSystemTrayIcon::ActivationReason reason)
{
if(reason == QSystemTrayIcon::Trigger)
{
// Click on system tray icon triggers "show/hide RecyclingCoin"
toggleHideAction->trigger();
}
}
#endif
void BitcoinGUI::optionsClicked()
{
if(!clientModel || !clientModel->getOptionsModel())
return;
OptionsDialog dlg;
dlg.setModel(clientModel->getOptionsModel());
dlg.exec();
}
void BitcoinGUI::aboutClicked()
{
AboutDialog dlg;
dlg.setModel(clientModel);
dlg.exec();
}
void BitcoinGUI::setNumConnections(int count)
{
QString icon;
switch(count)
{
case 0: icon = ":/icons/connect_0"; break;
case 1: case 2: case 3: icon = ":/icons/connect_1"; break;
case 4: case 5: case 6: icon = ":/icons/connect_2"; break;
case 7: case 8: case 9: icon = ":/icons/connect_3"; break;
default: icon = ":/icons/connect_4"; break;
}
labelConnectionsIcon->setPixmap(QIcon(icon).pixmap(STATUSBAR_ICONSIZE,STATUSBAR_ICONSIZE));
labelConnectionsIcon->setToolTip(tr("%n active connection(s) to RecyclingCoin network", "", count));
}
void BitcoinGUI::setNumBlocks(int count, int nTotalBlocks)
{
// don't show / hide progressBar and it's label if we have no connection(s) to the network
if (!clientModel || clientModel->getNumConnections() == 0)
{
progressBarLabel->setVisible(false);
progressBar->setVisible(false);
return;
}
QString tooltip;
if(count < nTotalBlocks)
{
int nRemainingBlocks = nTotalBlocks - count;
float nPercentageDone = count / (nTotalBlocks * 0.01f);
if (clientModel->getStatusBarWarnings() == "")
{
progressBarLabel->setText(tr("Synchronizing with network..."));
progressBarLabel->setVisible(true);
progressBar->setFormat(tr("~%n block(s) remaining", "", nRemainingBlocks));
progressBar->setMaximum(nTotalBlocks);
progressBar->setValue(count);
progressBar->setVisible(true);
}
else
{
progressBarLabel->setText(clientModel->getStatusBarWarnings());
progressBarLabel->setVisible(true);
progressBar->setVisible(false);
}
tooltip = tr("Downloaded %1 of %2 blocks of transaction history (%3% done).").arg(count).arg(nTotalBlocks).arg(nPercentageDone, 0, 'f', 2);
}
else
{
if (clientModel->getStatusBarWarnings() == "")
progressBarLabel->setVisible(false);
else
{
progressBarLabel->setText(clientModel->getStatusBarWarnings());
progressBarLabel->setVisible(true);
}
progressBar->setVisible(false);
tooltip = tr("Downloaded %1 blocks of transaction history.").arg(count);
}
tooltip = tr("Current difficulty is %1.").arg(clientModel->GetDifficulty()) + QString("<br>") + tooltip;
QDateTime now = QDateTime::currentDateTime();
QDateTime lastBlockDate = clientModel->getLastBlockDate();
int secs = lastBlockDate.secsTo(now);
QString text;
// Represent time from last generated block in human readable text
if(secs <= 0)
{
// Fully up to date. Leave text empty.
}
else if(secs < 60)
{
text = tr("%n second(s) ago","",secs);
}
else if(secs < 60*60)
{
text = tr("%n minute(s) ago","",secs/60);
}
else if(secs < 24*60*60)
{
text = tr("%n hour(s) ago","",secs/(60*60));
}
else
{
text = tr("%n day(s) ago","",secs/(60*60*24));
}
// Set icon state: spinning if catching up, tick otherwise
if(secs < 90*60 && count >= nTotalBlocks)
{
tooltip = tr("Up to date") + QString(".<br>") + tooltip;
labelBlocksIcon->setPixmap(QIcon(":/icons/synced").pixmap(STATUSBAR_ICONSIZE, STATUSBAR_ICONSIZE));
overviewPage->showOutOfSyncWarning(false);
}
else
{
tooltip = tr("Catching up...") + QString("<br>") + tooltip;
labelBlocksIcon->setMovie(syncIconMovie);
syncIconMovie->start();
overviewPage->showOutOfSyncWarning(true);
}
if(!text.isEmpty())
{
tooltip += QString("<br>");
tooltip += tr("Last received block was generated %1.").arg(text);
}
// Don't word-wrap this (fixed-width) tooltip
tooltip = QString("<nobr>") + tooltip + QString("</nobr>");
labelBlocksIcon->setToolTip(tooltip);
progressBarLabel->setToolTip(tooltip);
progressBar->setToolTip(tooltip);
}
void BitcoinGUI::setMining(bool mining, int hashrate)
{
if (mining)
{
labelMiningIcon->setPixmap(QIcon(":/icons/mining_active").pixmap(STATUSBAR_ICONSIZE,STATUSBAR_ICONSIZE));
labelMiningIcon->setToolTip(tr("Mining RecyclingCoins at %1 hashes per second").arg(hashrate));
}
else
{
labelMiningIcon->setPixmap(QIcon(":/icons/mining_inactive").pixmap(STATUSBAR_ICONSIZE,STATUSBAR_ICONSIZE));
labelMiningIcon->setToolTip(tr("Not mining RecyclingCoins"));
}
}
void BitcoinGUI::error(const QString &title, const QString &message, bool modal)
{
// Report errors from network/worker thread
if(modal)
{
QMessageBox::critical(this, title, message, QMessageBox::Ok, QMessageBox::Ok);
} else {
notificator->notify(Notificator::Critical, title, message);
}
}
void BitcoinGUI::changeEvent(QEvent *e)
{
QMainWindow::changeEvent(e);
#ifndef Q_WS_MAC // Ignored on Mac
if(e->type() == QEvent::WindowStateChange)
{
if(clientModel && clientModel->getOptionsModel()->getMinimizeToTray())
{
QWindowStateChangeEvent *wsevt = static_cast<QWindowStateChangeEvent*>(e);
if(!(wsevt->oldState() & Qt::WindowMinimized) && isMinimized())
{
QTimer::singleShot(0, this, SLOT(hide()));
e->ignore();
}
}
}
#endif
}
void BitcoinGUI::closeEvent(QCloseEvent *event)
{
if(clientModel)
{
#ifndef Q_WS_MAC // Ignored on Mac
if(!clientModel->getOptionsModel()->getMinimizeToTray() &&
!clientModel->getOptionsModel()->getMinimizeOnClose())
{
qApp->quit();
}
#endif
}
QMainWindow::closeEvent(event);
}
void BitcoinGUI::askFee(qint64 nFeeRequired, bool *payFee)
{
QString strMessage =
tr("This transaction is over the size limit. You can still send it for a fee of %1, "
"which goes to the nodes that process your transaction and helps to support the network. "
"Do you want to pay the fee?").arg(
BitcoinUnits::formatWithUnit(BitcoinUnits::BTC, nFeeRequired));
QMessageBox::StandardButton retval = QMessageBox::question(
this, tr("Confirm transaction fee"), strMessage,
QMessageBox::Yes|QMessageBox::Cancel, QMessageBox::Yes);
*payFee = (retval == QMessageBox::Yes);
}
void BitcoinGUI::incomingTransaction(const QModelIndex & parent, int start, int end)
{
if(!walletModel || !clientModel)
return;
TransactionTableModel *ttm = walletModel->getTransactionTableModel();
qint64 amount = ttm->index(start, TransactionTableModel::Amount, parent)
.data(Qt::EditRole).toULongLong();
if(!clientModel->inInitialBlockDownload())
{
// On new transaction, make an info balloon
// Unless the initial block download is in progress, to prevent balloon-spam
QString date = ttm->index(start, TransactionTableModel::Date, parent)
.data().toString();
QString type = ttm->index(start, TransactionTableModel::Type, parent)
.data().toString();
QString address = ttm->index(start, TransactionTableModel::ToAddress, parent)
.data().toString();
QIcon icon = qvariant_cast<QIcon>(ttm->index(start,
TransactionTableModel::ToAddress, parent)
.data(Qt::DecorationRole));
notificator->notify(Notificator::Information,
(amount)<0 ? tr("Sent transaction") :
tr("Incoming transaction"),
tr("Date: %1\n"
"Amount: %2\n"
"Type: %3\n"
"Address: %4\n")
.arg(date)
.arg(BitcoinUnits::formatWithUnit(walletModel->getOptionsModel()->getDisplayUnit(), amount, true))
.arg(type)
.arg(address), icon);
}
}
void BitcoinGUI::gotoOverviewPage()
{
overviewAction->setChecked(true);
centralWidget->setCurrentWidget(overviewPage);
exportAction->setEnabled(false);
disconnect(exportAction, SIGNAL(triggered()), 0, 0);
}
void BitcoinGUI::gotoMiningPage()
{
miningAction->setChecked(true);
centralWidget->setCurrentWidget(miningPage);
exportAction->setEnabled(false);
disconnect(exportAction, SIGNAL(triggered()), 0, 0);
}
void BitcoinGUI::gotoHistoryPage()
{
historyAction->setChecked(true);
centralWidget->setCurrentWidget(transactionsPage);
exportAction->setEnabled(true);
disconnect(exportAction, SIGNAL(triggered()), 0, 0);
connect(exportAction, SIGNAL(triggered()), transactionView, SLOT(exportClicked()));
}
void BitcoinGUI::gotoAddressBookPage()
{
addressBookAction->setChecked(true);
centralWidget->setCurrentWidget(addressBookPage);
exportAction->setEnabled(true);
disconnect(exportAction, SIGNAL(triggered()), 0, 0);
connect(exportAction, SIGNAL(triggered()), addressBookPage, SLOT(exportClicked()));
}
void BitcoinGUI::gotoReceiveCoinsPage()
{
receiveCoinsAction->setChecked(true);
centralWidget->setCurrentWidget(receiveCoinsPage);
exportAction->setEnabled(true);
disconnect(exportAction, SIGNAL(triggered()), 0, 0);
connect(exportAction, SIGNAL(triggered()), receiveCoinsPage, SLOT(exportClicked()));
}
void BitcoinGUI::gotoSendCoinsPage()
{
sendCoinsAction->setChecked(true);
centralWidget->setCurrentWidget(sendCoinsPage);
exportAction->setEnabled(false);
disconnect(exportAction, SIGNAL(triggered()), 0, 0);
}
void BitcoinGUI::gotoSignMessageTab(QString addr)
{
#ifdef FIRST_CLASS_MESSAGING
firstClassMessagingAction->setChecked(true);
centralWidget->setCurrentWidget(signVerifyMessageDialog);
exportAction->setEnabled(false);
disconnect(exportAction, SIGNAL(triggered()), 0, 0);
signVerifyMessageDialog->showTab_SM(false);
#else
// call show() in showTab_SM()
signVerifyMessageDialog->showTab_SM(true);
#endif
if(!addr.isEmpty())
signVerifyMessageDialog->setAddress_SM(addr);
}
void BitcoinGUI::gotoVerifyMessageTab(QString addr)
{
#ifdef FIRST_CLASS_MESSAGING
firstClassMessagingAction->setChecked(true);
centralWidget->setCurrentWidget(signVerifyMessageDialog);
exportAction->setEnabled(false);
disconnect(exportAction, SIGNAL(triggered()), 0, 0);
signVerifyMessageDialog->showTab_VM(false);
#else
// call show() in showTab_VM()
signVerifyMessageDialog->showTab_VM(true);
#endif
if(!addr.isEmpty())
signVerifyMessageDialog->setAddress_VM(addr);
}
void BitcoinGUI::dragEnterEvent(QDragEnterEvent *event)
{
// Accept only URIs
if(event->mimeData()->hasUrls())
event->acceptProposedAction();
}
void BitcoinGUI::dropEvent(QDropEvent *event)
{
if(event->mimeData()->hasUrls())
{
int nValidUrisFound = 0;
QList<QUrl> uris = event->mimeData()->urls();
foreach(const QUrl &uri, uris)
{
if (sendCoinsPage->handleURI(uri.toString()))
nValidUrisFound++;
}
// if valid URIs were found
if (nValidUrisFound)
gotoSendCoinsPage();
else
notificator->notify(Notificator::Warning, tr("URI handling"), tr("URI can not be parsed! This can be caused by an invalid RecyclingCoin address or malformed URI parameters."));
}
event->acceptProposedAction();
}
void BitcoinGUI::handleURI(QString strURI)
{
// URI has to be valid
if (sendCoinsPage->handleURI(strURI))
{
showNormalIfMinimized();
gotoSendCoinsPage();
}
else
notificator->notify(Notificator::Warning, tr("URI handling"), tr("URI can not be parsed! This can be caused by an invalid RecyclingCoin address or malformed URI parameters."));
}
void BitcoinGUI::setEncryptionStatus(int status)
{
switch(status)
{
case WalletModel::Unencrypted:
labelEncryptionIcon->hide();
encryptWalletAction->setChecked(false);
changePassphraseAction->setEnabled(false);
encryptWalletAction->setEnabled(true);
break;
case WalletModel::Unlocked:
labelEncryptionIcon->show();
labelEncryptionIcon->setPixmap(QIcon(":/icons/lock_open").pixmap(STATUSBAR_ICONSIZE,STATUSBAR_ICONSIZE));
labelEncryptionIcon->setToolTip(tr("Wallet is <b>encrypted</b> and currently <b>unlocked</b>"));
encryptWalletAction->setChecked(true);
changePassphraseAction->setEnabled(true);
encryptWalletAction->setEnabled(false); // TODO: decrypt currently not supported
break;
case WalletModel::Locked:
labelEncryptionIcon->show();
labelEncryptionIcon->setPixmap(QIcon(":/icons/lock_closed").pixmap(STATUSBAR_ICONSIZE,STATUSBAR_ICONSIZE));
labelEncryptionIcon->setToolTip(tr("Wallet is <b>encrypted</b> and currently <b>locked</b>"));
encryptWalletAction->setChecked(true);
changePassphraseAction->setEnabled(true);
encryptWalletAction->setEnabled(false); // TODO: decrypt currently not supported
break;
}
}
void BitcoinGUI::encryptWallet(bool status)
{
if(!walletModel)
return;
AskPassphraseDialog dlg(status ? AskPassphraseDialog::Encrypt:
AskPassphraseDialog::Decrypt, this);
dlg.setModel(walletModel);
dlg.exec();
setEncryptionStatus(walletModel->getEncryptionStatus());
}
void BitcoinGUI::backupWallet()
{
QString saveDir = QDesktopServices::storageLocation(QDesktopServices::DocumentsLocation);
QString filename = QFileDialog::getSaveFileName(this, tr("Backup Wallet"), saveDir, tr("Wallet Data (*.dat)"));
if(!filename.isEmpty()) {
if(!walletModel->backupWallet(filename)) {
QMessageBox::warning(this, tr("Backup Failed"), tr("There was an error trying to save the wallet data to the new location."));
}
}
}
void BitcoinGUI::changePassphrase()
{
AskPassphraseDialog dlg(AskPassphraseDialog::ChangePass, this);
dlg.setModel(walletModel);
dlg.exec();
}
void BitcoinGUI::unlockWallet()
{
if(!walletModel)
return;
// Unlock wallet when requested by wallet model
if(walletModel->getEncryptionStatus() == WalletModel::Locked)
{
AskPassphraseDialog dlg(AskPassphraseDialog::Unlock, this);
dlg.setModel(walletModel);
dlg.exec();
}
}
void BitcoinGUI::showNormalIfMinimized(bool fToggleHidden)
{
// activateWindow() (sometimes) helps with keyboard focus on Windows
if (isHidden())
{
show();
activateWindow();
}
else if (isMinimized())
{
showNormal();
activateWindow();
}
else if (GUIUtil::isObscured(this))
{
raise();
activateWindow();
}
else if(fToggleHidden)
hide();
}
void BitcoinGUI::toggleHidden()
{
showNormalIfMinimized(true);
}
| [
"root@ns236334.ip-192-99-44.net"
] | root@ns236334.ip-192-99-44.net |
cbe0f9bd239e4a87358e8da6f9eb7308744f4d58 | 23ddb434cce3feda32b34f6903d884f42718c084 | /minicurso_arduino/codigosFuente/reto_06_c/reto_06_c.ino | 77e7e45b8ff20ade20efc91c211c23d474b1e2e0 | [] | no_license | pedroruizf/arduino | 54b621fa482ed011b1daef16c97171f036f6e4f3 | dfa087387a3e7bf47ea9299679792f3bf4e95255 | refs/heads/master | 2021-11-09T11:36:50.505432 | 2021-10-28T14:58:12 | 2021-10-28T14:58:12 | 36,158,240 | 5 | 6 | null | null | null | null | UTF-8 | C++ | false | false | 906 | ino | int leds[] = {3, 4, 5};
int n = 0;
int tiempo = 200;
int zumbador = 7;
int pulsador = 2;
void setup () {
for (n = 0; n < 3; n++) {
pinMode(leds[n], OUTPUT);
}
pinMode(zumbador, OUTPUT);
pinMode(pulsador, INPUT);
}
void compruebaacierto() {
if (digitalRead(pulsador) == HIGH && n == 1) {
digitalWrite(zumbador, HIGH);
delay (1000);
digitalWrite(zumbador, LOW);
tiempo = tiempo - 20;
if (tiempo < 10) {
tiempo = 200;
}
}
if (digitalRead(pulsador) == HIGH && n != 1) {
for (n = 0; n < 3; n++) {
digitalWrite(leds[n], HIGH);
}
delay(100);
for (n = 0; n < 3; n++) {
digitalWrite(leds[n], LOW);
}
delay (100);
tiempo = 200;
}
void loop () {
for (n = 0; n < 3; n++) {
digitalWrite(leds[n], HIGH);
delay(tiempo);
compruebaacierto();
digitalWrite(leds[n], LOW);
delay(tiempo);
}
}
| [
"pedroruizf@gmail.com"
] | pedroruizf@gmail.com |
6d250c5c5d452005f6a59a10fdad74f56d91a3f9 | 7f098473a0dd401819b4b3d70c83e42433aa10ef | /MSVS/include/GameTextManager.h | 5c12e6135a1f54b0db10b7d1162e6662270b24d4 | [] | no_license | deathmock5/KHE2019 | 90308856ac0b5c7dde00dd05c470ca47769a812b | d437b38494f8915e8b6ceaef24fbcf12eb16c3fc | refs/heads/master | 2020-08-02T16:20:14.517774 | 2019-09-29T13:41:29 | 2019-09-29T13:41:29 | 211,426,523 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 368 | h | #pragma once
#include <string>
//This class retrives and sets text stored in XML files via a key index system.
class GametextManager {
public:
static GametextManager* instance() {
if (!_instance) {
_instance = new GametextManager();
}
return _instance;
}
static std::string getText(const int& index) {
}
private:
static GametextManager* _instance;
}; | [
"deathmock@gmail.com"
] | deathmock@gmail.com |
ca1b4c5b4e14f9b3395468e7024571e4bdd9b504 | 904172fd219088647b3f80ea7fd80efca8f99930 | /PbfVsLib/include/pbf_solver_base.h | ac6848da662093e8bf7915f06dc76fcdae1cd286 | [] | no_license | penguin1214/PbfVs | 5a74a5606b880468dc437d4bf75357bf8dedf766 | dcdf6a6b1050e38fa199598490b871f510b66d0f | refs/heads/master | 2021-01-01T06:56:57.048995 | 2017-06-08T05:37:22 | 2017-06-08T05:37:22 | 97,558,011 | 1 | 0 | null | 2017-07-18T05:53:24 | 2017-07-18T05:53:24 | null | UTF-8 | C++ | false | false | 1,666 | h | #ifndef pbf_solver_base_h
#define pbf_solver_base_h
#include "typedefs.h"
#include "particle_system.h"
#include <cmath>
#include <unordered_set>
#include <vector>
namespace pbf {
struct PbfSolverConfig {
float h;
float mass;
float rho_0;
float epsilon;
unsigned num_iters;
float corr_delta_q_coeff;
float corr_k;
unsigned corr_n;
float vorticity_epsilon;
float xsph_c;
float world_size_x;
float world_size_y;
float world_size_z;
// TODO: spatial_hash should be renamed
float spatial_hash_cell_size;
};
class PbfSolverBase {
public:
PbfSolverBase();
virtual ~PbfSolverBase() = default;
void Configure(const PbfSolverConfig& config);
void InitParticleSystems(ParticleSystem* ps);
virtual void Update(float dt) = 0;
protected:
// Called as the last step in Configure().
virtual void CustomConfigure_(const PbfSolverConfig& config) {}
// Called as the last step in InitParticleSystems, at which
// point ps_ is guaranteed to be initialized.
virtual void CustomInitPs_() {}
protected:
// kernel function h
float h_;
// Mass of a particle. All particles have the same mass.
float mass_;
// Rest density of a particle.
float rho_0_;
// Reciprocal of rho_0_;
float rho_0_recpr_;
// Epsilon in Eq (11)
float epsilon_;
unsigned num_iters_;
// Tensile instanbility correction
float corr_delta_q_coeff_;
float corr_k_;
unsigned corr_n_;
float vorticity_epsilon_;
float xsph_c_;
float world_size_x_;
float world_size_y_;
float world_size_z_;
ParticleSystem* ps_;
};
} // namespace pbf
#endif // pbf_solver_base_h | [
"yekuang.ky@gmail.com"
] | yekuang.ky@gmail.com |
8843926f479e3a80980d0bcca888c45eb5ccac81 | 03c7cf7a57a1a26bb21e0184642f0a5c8b0336ae | /Release/gen/webcore/bindings/V8SVGHKernElement.cpp | a3eff878620b576fc551a1d6a5a1a5a09d500ccc | [] | no_license | sanyaade-embedded-systems/armhf-node-webkit | eb38a2a34e833310ee477592028905fd00a86e5a | 5bc4509c0e19cce1a64b7cab4f92f91edfa17944 | refs/heads/master | 2020-12-30T19:11:15.189923 | 2013-03-16T14:29:23 | 2013-03-16T14:29:23 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,248 | cpp | /*
This file is part of the WebKit open source project.
This file has been generated by generate-bindings.pl. DO NOT MODIFY!
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include "config.h"
#include "V8SVGHKernElement.h"
#if ENABLE(SVG) && ENABLE(SVG_FONTS)
#include "BindingState.h"
#include "ContextFeatures.h"
#include "Frame.h"
#include "RuntimeEnabledFeatures.h"
#include "V8Binding.h"
#include "V8DOMWrapper.h"
#include "V8SVGElement.h"
#include <wtf/UnusedParam.h>
namespace WebCore {
WrapperTypeInfo V8SVGHKernElement::info = { V8SVGHKernElement::GetTemplate, V8SVGHKernElement::derefObject, 0, 0, V8SVGHKernElement::installPerContextPrototypeProperties, &V8SVGElement::info, WrapperTypeObjectPrototype };
namespace SVGHKernElementV8Internal {
template <typename T> void V8_USE(T) { }
} // namespace SVGHKernElementV8Internal
static v8::Persistent<v8::FunctionTemplate> ConfigureV8SVGHKernElementTemplate(v8::Persistent<v8::FunctionTemplate> desc)
{
desc->ReadOnlyPrototype();
v8::Local<v8::Signature> defaultSignature;
defaultSignature = V8DOMConfiguration::configureTemplate(desc, "SVGHKernElement", V8SVGElement::GetTemplate(), V8SVGHKernElement::internalFieldCount,
0, 0,
0, 0);
UNUSED_PARAM(defaultSignature); // In some cases, it will not be used.
// Custom toString template
desc->Set(v8::String::NewSymbol("toString"), V8PerIsolateData::current()->toStringTemplate());
return desc;
}
v8::Persistent<v8::FunctionTemplate> V8SVGHKernElement::GetRawTemplate()
{
V8PerIsolateData* data = V8PerIsolateData::current();
V8PerIsolateData::TemplateMap::iterator result = data->rawTemplateMap().find(&info);
if (result != data->rawTemplateMap().end())
return result->value;
v8::HandleScope handleScope;
v8::Persistent<v8::FunctionTemplate> templ = createRawTemplate();
data->rawTemplateMap().add(&info, templ);
return templ;
}
v8::Persistent<v8::FunctionTemplate> V8SVGHKernElement::GetTemplate()
{
V8PerIsolateData* data = V8PerIsolateData::current();
V8PerIsolateData::TemplateMap::iterator result = data->templateMap().find(&info);
if (result != data->templateMap().end())
return result->value;
v8::HandleScope handleScope;
v8::Persistent<v8::FunctionTemplate> templ =
ConfigureV8SVGHKernElementTemplate(GetRawTemplate());
data->templateMap().add(&info, templ);
return templ;
}
bool V8SVGHKernElement::HasInstance(v8::Handle<v8::Value> value)
{
return GetRawTemplate()->HasInstance(value);
}
v8::Handle<v8::Object> V8SVGHKernElement::createWrapper(PassRefPtr<SVGHKernElement> impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
{
ASSERT(impl.get());
ASSERT(DOMDataStore::getWrapper(impl.get(), isolate).IsEmpty());
ASSERT(static_cast<void*>(static_cast<Node*>(impl.get())) == static_cast<void*>(impl.get()));
v8::Handle<v8::Object> wrapper = V8DOMWrapper::createWrapper(creationContext, &info, impl.get());
if (UNLIKELY(wrapper.IsEmpty()))
return wrapper;
installPerContextProperties(wrapper, impl.get());
v8::Persistent<v8::Object> wrapperHandle = V8DOMWrapper::associateObjectWithWrapper(impl, &info, wrapper, isolate);
if (!hasDependentLifetime)
wrapperHandle.MarkIndependent();
return wrapper;
}
void V8SVGHKernElement::derefObject(void* object)
{
static_cast<SVGHKernElement*>(object)->deref();
}
} // namespace WebCore
#endif // ENABLE(SVG) && ENABLE(SVG_FONTS)
| [
"marian.such@ackee.cz"
] | marian.such@ackee.cz |
e63f3abf6f7919ee3c9669df59233fbc432a1255 | ac2f44366e59b16ebfeb13ff7632ebaac85c9f79 | /spooky_endlessrunner/Library/Il2cppBuildCache/WebGL/il2cppOutput/UnityEngine.InputLegacyModule_Attr.cpp | cff7eaa9ef23a0ab662fdd9b92d731b56fedc224 | [] | no_license | makkomise/spooky_endlessrunner | 01b0d3c016ff73f2150f95aaae8289627488bc36 | 7a00769b981ffaa764d187246c6c0a37e29c411a | refs/heads/main | 2023-09-04T18:16:42.619207 | 2021-11-19T11:59:31 | 2021-11-19T11:59:31 | 408,435,711 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 96,758 | cpp | #include "pch-cpp.hpp"
#ifndef _MSC_VER
# include <alloca.h>
#else
# include <malloc.h>
#endif
#include <limits>
#include <stdint.h>
// System.Char[]
struct CharU5BU5D_t7B7FC5BC8091AA3B9CB0B29CDD80B5EE9254AA34;
// System.Runtime.CompilerServices.CompilationRelaxationsAttribute
struct CompilationRelaxationsAttribute_t661FDDC06629BDA607A42BD660944F039FE03AFF;
// System.Diagnostics.DebuggableAttribute
struct DebuggableAttribute_tA8054EBD0FC7511695D494B690B5771658E3191B;
// UnityEngine.Bindings.FreeFunctionAttribute
struct FreeFunctionAttribute_tBB3B939D760190FEC84762F1BA94B99672613D03;
// System.Runtime.CompilerServices.InternalsVisibleToAttribute
struct InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C;
// UnityEngine.Bindings.NativeHeaderAttribute
struct NativeHeaderAttribute_t7F0E4B53790AA75CDB4C44E6D644267F8FE3066C;
// UnityEngine.Bindings.NativeThrowsAttribute
struct NativeThrowsAttribute_tF59F2833BDD09C6C89298E603D5C3A598CC08137;
// UnityEngine.Scripting.RequiredByNativeCodeAttribute
struct RequiredByNativeCodeAttribute_t855401D3C2EF3B44F4F1C3EE2DCD361CFC358D20;
// System.Runtime.CompilerServices.RuntimeCompatibilityAttribute
struct RuntimeCompatibilityAttribute_tFF99AB2963098F9CBCD47A20D9FD3D51C17C1C80;
// System.String
struct String_t;
// UnityEngine.UnityEngineModuleAssembly
struct UnityEngineModuleAssembly_t33CB058FDDDC458E384578147D6027BB1EC86CFF;
IL2CPP_EXTERN_C_BEGIN
IL2CPP_EXTERN_C_END
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// System.Object
// System.Attribute
struct Attribute_t037CA9D9F3B742C063DB364D2EEBBF9FC5772C71 : public RuntimeObject
{
public:
public:
};
// System.String
struct String_t : public RuntimeObject
{
public:
// System.Int32 System.String::m_stringLength
int32_t ___m_stringLength_0;
// System.Char System.String::m_firstChar
Il2CppChar ___m_firstChar_1;
public:
inline static int32_t get_offset_of_m_stringLength_0() { return static_cast<int32_t>(offsetof(String_t, ___m_stringLength_0)); }
inline int32_t get_m_stringLength_0() const { return ___m_stringLength_0; }
inline int32_t* get_address_of_m_stringLength_0() { return &___m_stringLength_0; }
inline void set_m_stringLength_0(int32_t value)
{
___m_stringLength_0 = value;
}
inline static int32_t get_offset_of_m_firstChar_1() { return static_cast<int32_t>(offsetof(String_t, ___m_firstChar_1)); }
inline Il2CppChar get_m_firstChar_1() const { return ___m_firstChar_1; }
inline Il2CppChar* get_address_of_m_firstChar_1() { return &___m_firstChar_1; }
inline void set_m_firstChar_1(Il2CppChar value)
{
___m_firstChar_1 = value;
}
};
struct String_t_StaticFields
{
public:
// System.String System.String::Empty
String_t* ___Empty_5;
public:
inline static int32_t get_offset_of_Empty_5() { return static_cast<int32_t>(offsetof(String_t_StaticFields, ___Empty_5)); }
inline String_t* get_Empty_5() const { return ___Empty_5; }
inline String_t** get_address_of_Empty_5() { return &___Empty_5; }
inline void set_Empty_5(String_t* value)
{
___Empty_5 = value;
Il2CppCodeGenWriteBarrier((void**)(&___Empty_5), (void*)value);
}
};
// System.ValueType
struct ValueType_tDBF999C1B75C48C68621878250DBF6CDBCF51E52 : public RuntimeObject
{
public:
public:
};
// Native definition for P/Invoke marshalling of System.ValueType
struct ValueType_tDBF999C1B75C48C68621878250DBF6CDBCF51E52_marshaled_pinvoke
{
};
// Native definition for COM marshalling of System.ValueType
struct ValueType_tDBF999C1B75C48C68621878250DBF6CDBCF51E52_marshaled_com
{
};
// System.Boolean
struct Boolean_t07D1E3F34E4813023D64F584DFF7B34C9D922F37
{
public:
// System.Boolean System.Boolean::m_value
bool ___m_value_0;
public:
inline static int32_t get_offset_of_m_value_0() { return static_cast<int32_t>(offsetof(Boolean_t07D1E3F34E4813023D64F584DFF7B34C9D922F37, ___m_value_0)); }
inline bool get_m_value_0() const { return ___m_value_0; }
inline bool* get_address_of_m_value_0() { return &___m_value_0; }
inline void set_m_value_0(bool value)
{
___m_value_0 = value;
}
};
struct Boolean_t07D1E3F34E4813023D64F584DFF7B34C9D922F37_StaticFields
{
public:
// System.String System.Boolean::TrueString
String_t* ___TrueString_5;
// System.String System.Boolean::FalseString
String_t* ___FalseString_6;
public:
inline static int32_t get_offset_of_TrueString_5() { return static_cast<int32_t>(offsetof(Boolean_t07D1E3F34E4813023D64F584DFF7B34C9D922F37_StaticFields, ___TrueString_5)); }
inline String_t* get_TrueString_5() const { return ___TrueString_5; }
inline String_t** get_address_of_TrueString_5() { return &___TrueString_5; }
inline void set_TrueString_5(String_t* value)
{
___TrueString_5 = value;
Il2CppCodeGenWriteBarrier((void**)(&___TrueString_5), (void*)value);
}
inline static int32_t get_offset_of_FalseString_6() { return static_cast<int32_t>(offsetof(Boolean_t07D1E3F34E4813023D64F584DFF7B34C9D922F37_StaticFields, ___FalseString_6)); }
inline String_t* get_FalseString_6() const { return ___FalseString_6; }
inline String_t** get_address_of_FalseString_6() { return &___FalseString_6; }
inline void set_FalseString_6(String_t* value)
{
___FalseString_6 = value;
Il2CppCodeGenWriteBarrier((void**)(&___FalseString_6), (void*)value);
}
};
// System.Runtime.CompilerServices.CompilationRelaxationsAttribute
struct CompilationRelaxationsAttribute_t661FDDC06629BDA607A42BD660944F039FE03AFF : public Attribute_t037CA9D9F3B742C063DB364D2EEBBF9FC5772C71
{
public:
// System.Int32 System.Runtime.CompilerServices.CompilationRelaxationsAttribute::m_relaxations
int32_t ___m_relaxations_0;
public:
inline static int32_t get_offset_of_m_relaxations_0() { return static_cast<int32_t>(offsetof(CompilationRelaxationsAttribute_t661FDDC06629BDA607A42BD660944F039FE03AFF, ___m_relaxations_0)); }
inline int32_t get_m_relaxations_0() const { return ___m_relaxations_0; }
inline int32_t* get_address_of_m_relaxations_0() { return &___m_relaxations_0; }
inline void set_m_relaxations_0(int32_t value)
{
___m_relaxations_0 = value;
}
};
// System.Enum
struct Enum_t23B90B40F60E677A8025267341651C94AE079CDA : public ValueType_tDBF999C1B75C48C68621878250DBF6CDBCF51E52
{
public:
public:
};
struct Enum_t23B90B40F60E677A8025267341651C94AE079CDA_StaticFields
{
public:
// System.Char[] System.Enum::enumSeperatorCharArray
CharU5BU5D_t7B7FC5BC8091AA3B9CB0B29CDD80B5EE9254AA34* ___enumSeperatorCharArray_0;
public:
inline static int32_t get_offset_of_enumSeperatorCharArray_0() { return static_cast<int32_t>(offsetof(Enum_t23B90B40F60E677A8025267341651C94AE079CDA_StaticFields, ___enumSeperatorCharArray_0)); }
inline CharU5BU5D_t7B7FC5BC8091AA3B9CB0B29CDD80B5EE9254AA34* get_enumSeperatorCharArray_0() const { return ___enumSeperatorCharArray_0; }
inline CharU5BU5D_t7B7FC5BC8091AA3B9CB0B29CDD80B5EE9254AA34** get_address_of_enumSeperatorCharArray_0() { return &___enumSeperatorCharArray_0; }
inline void set_enumSeperatorCharArray_0(CharU5BU5D_t7B7FC5BC8091AA3B9CB0B29CDD80B5EE9254AA34* value)
{
___enumSeperatorCharArray_0 = value;
Il2CppCodeGenWriteBarrier((void**)(&___enumSeperatorCharArray_0), (void*)value);
}
};
// Native definition for P/Invoke marshalling of System.Enum
struct Enum_t23B90B40F60E677A8025267341651C94AE079CDA_marshaled_pinvoke
{
};
// Native definition for COM marshalling of System.Enum
struct Enum_t23B90B40F60E677A8025267341651C94AE079CDA_marshaled_com
{
};
// System.Runtime.CompilerServices.InternalsVisibleToAttribute
struct InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C : public Attribute_t037CA9D9F3B742C063DB364D2EEBBF9FC5772C71
{
public:
// System.String System.Runtime.CompilerServices.InternalsVisibleToAttribute::_assemblyName
String_t* ____assemblyName_0;
// System.Boolean System.Runtime.CompilerServices.InternalsVisibleToAttribute::_allInternalsVisible
bool ____allInternalsVisible_1;
public:
inline static int32_t get_offset_of__assemblyName_0() { return static_cast<int32_t>(offsetof(InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C, ____assemblyName_0)); }
inline String_t* get__assemblyName_0() const { return ____assemblyName_0; }
inline String_t** get_address_of__assemblyName_0() { return &____assemblyName_0; }
inline void set__assemblyName_0(String_t* value)
{
____assemblyName_0 = value;
Il2CppCodeGenWriteBarrier((void**)(&____assemblyName_0), (void*)value);
}
inline static int32_t get_offset_of__allInternalsVisible_1() { return static_cast<int32_t>(offsetof(InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C, ____allInternalsVisible_1)); }
inline bool get__allInternalsVisible_1() const { return ____allInternalsVisible_1; }
inline bool* get_address_of__allInternalsVisible_1() { return &____allInternalsVisible_1; }
inline void set__allInternalsVisible_1(bool value)
{
____allInternalsVisible_1 = value;
}
};
// UnityEngine.Bindings.NativeHeaderAttribute
struct NativeHeaderAttribute_t7F0E4B53790AA75CDB4C44E6D644267F8FE3066C : public Attribute_t037CA9D9F3B742C063DB364D2EEBBF9FC5772C71
{
public:
// System.String UnityEngine.Bindings.NativeHeaderAttribute::<Header>k__BackingField
String_t* ___U3CHeaderU3Ek__BackingField_0;
public:
inline static int32_t get_offset_of_U3CHeaderU3Ek__BackingField_0() { return static_cast<int32_t>(offsetof(NativeHeaderAttribute_t7F0E4B53790AA75CDB4C44E6D644267F8FE3066C, ___U3CHeaderU3Ek__BackingField_0)); }
inline String_t* get_U3CHeaderU3Ek__BackingField_0() const { return ___U3CHeaderU3Ek__BackingField_0; }
inline String_t** get_address_of_U3CHeaderU3Ek__BackingField_0() { return &___U3CHeaderU3Ek__BackingField_0; }
inline void set_U3CHeaderU3Ek__BackingField_0(String_t* value)
{
___U3CHeaderU3Ek__BackingField_0 = value;
Il2CppCodeGenWriteBarrier((void**)(&___U3CHeaderU3Ek__BackingField_0), (void*)value);
}
};
// UnityEngine.Bindings.NativeMethodAttribute
struct NativeMethodAttribute_t57F61ACA17BEC1260A06658ACD971B0009CC1866 : public Attribute_t037CA9D9F3B742C063DB364D2EEBBF9FC5772C71
{
public:
// System.String UnityEngine.Bindings.NativeMethodAttribute::<Name>k__BackingField
String_t* ___U3CNameU3Ek__BackingField_0;
// System.Boolean UnityEngine.Bindings.NativeMethodAttribute::<IsThreadSafe>k__BackingField
bool ___U3CIsThreadSafeU3Ek__BackingField_1;
// System.Boolean UnityEngine.Bindings.NativeMethodAttribute::<IsFreeFunction>k__BackingField
bool ___U3CIsFreeFunctionU3Ek__BackingField_2;
// System.Boolean UnityEngine.Bindings.NativeMethodAttribute::<ThrowsException>k__BackingField
bool ___U3CThrowsExceptionU3Ek__BackingField_3;
// System.Boolean UnityEngine.Bindings.NativeMethodAttribute::<HasExplicitThis>k__BackingField
bool ___U3CHasExplicitThisU3Ek__BackingField_4;
public:
inline static int32_t get_offset_of_U3CNameU3Ek__BackingField_0() { return static_cast<int32_t>(offsetof(NativeMethodAttribute_t57F61ACA17BEC1260A06658ACD971B0009CC1866, ___U3CNameU3Ek__BackingField_0)); }
inline String_t* get_U3CNameU3Ek__BackingField_0() const { return ___U3CNameU3Ek__BackingField_0; }
inline String_t** get_address_of_U3CNameU3Ek__BackingField_0() { return &___U3CNameU3Ek__BackingField_0; }
inline void set_U3CNameU3Ek__BackingField_0(String_t* value)
{
___U3CNameU3Ek__BackingField_0 = value;
Il2CppCodeGenWriteBarrier((void**)(&___U3CNameU3Ek__BackingField_0), (void*)value);
}
inline static int32_t get_offset_of_U3CIsThreadSafeU3Ek__BackingField_1() { return static_cast<int32_t>(offsetof(NativeMethodAttribute_t57F61ACA17BEC1260A06658ACD971B0009CC1866, ___U3CIsThreadSafeU3Ek__BackingField_1)); }
inline bool get_U3CIsThreadSafeU3Ek__BackingField_1() const { return ___U3CIsThreadSafeU3Ek__BackingField_1; }
inline bool* get_address_of_U3CIsThreadSafeU3Ek__BackingField_1() { return &___U3CIsThreadSafeU3Ek__BackingField_1; }
inline void set_U3CIsThreadSafeU3Ek__BackingField_1(bool value)
{
___U3CIsThreadSafeU3Ek__BackingField_1 = value;
}
inline static int32_t get_offset_of_U3CIsFreeFunctionU3Ek__BackingField_2() { return static_cast<int32_t>(offsetof(NativeMethodAttribute_t57F61ACA17BEC1260A06658ACD971B0009CC1866, ___U3CIsFreeFunctionU3Ek__BackingField_2)); }
inline bool get_U3CIsFreeFunctionU3Ek__BackingField_2() const { return ___U3CIsFreeFunctionU3Ek__BackingField_2; }
inline bool* get_address_of_U3CIsFreeFunctionU3Ek__BackingField_2() { return &___U3CIsFreeFunctionU3Ek__BackingField_2; }
inline void set_U3CIsFreeFunctionU3Ek__BackingField_2(bool value)
{
___U3CIsFreeFunctionU3Ek__BackingField_2 = value;
}
inline static int32_t get_offset_of_U3CThrowsExceptionU3Ek__BackingField_3() { return static_cast<int32_t>(offsetof(NativeMethodAttribute_t57F61ACA17BEC1260A06658ACD971B0009CC1866, ___U3CThrowsExceptionU3Ek__BackingField_3)); }
inline bool get_U3CThrowsExceptionU3Ek__BackingField_3() const { return ___U3CThrowsExceptionU3Ek__BackingField_3; }
inline bool* get_address_of_U3CThrowsExceptionU3Ek__BackingField_3() { return &___U3CThrowsExceptionU3Ek__BackingField_3; }
inline void set_U3CThrowsExceptionU3Ek__BackingField_3(bool value)
{
___U3CThrowsExceptionU3Ek__BackingField_3 = value;
}
inline static int32_t get_offset_of_U3CHasExplicitThisU3Ek__BackingField_4() { return static_cast<int32_t>(offsetof(NativeMethodAttribute_t57F61ACA17BEC1260A06658ACD971B0009CC1866, ___U3CHasExplicitThisU3Ek__BackingField_4)); }
inline bool get_U3CHasExplicitThisU3Ek__BackingField_4() const { return ___U3CHasExplicitThisU3Ek__BackingField_4; }
inline bool* get_address_of_U3CHasExplicitThisU3Ek__BackingField_4() { return &___U3CHasExplicitThisU3Ek__BackingField_4; }
inline void set_U3CHasExplicitThisU3Ek__BackingField_4(bool value)
{
___U3CHasExplicitThisU3Ek__BackingField_4 = value;
}
};
// UnityEngine.Bindings.NativeThrowsAttribute
struct NativeThrowsAttribute_tF59F2833BDD09C6C89298E603D5C3A598CC08137 : public Attribute_t037CA9D9F3B742C063DB364D2EEBBF9FC5772C71
{
public:
// System.Boolean UnityEngine.Bindings.NativeThrowsAttribute::<ThrowsException>k__BackingField
bool ___U3CThrowsExceptionU3Ek__BackingField_0;
public:
inline static int32_t get_offset_of_U3CThrowsExceptionU3Ek__BackingField_0() { return static_cast<int32_t>(offsetof(NativeThrowsAttribute_tF59F2833BDD09C6C89298E603D5C3A598CC08137, ___U3CThrowsExceptionU3Ek__BackingField_0)); }
inline bool get_U3CThrowsExceptionU3Ek__BackingField_0() const { return ___U3CThrowsExceptionU3Ek__BackingField_0; }
inline bool* get_address_of_U3CThrowsExceptionU3Ek__BackingField_0() { return &___U3CThrowsExceptionU3Ek__BackingField_0; }
inline void set_U3CThrowsExceptionU3Ek__BackingField_0(bool value)
{
___U3CThrowsExceptionU3Ek__BackingField_0 = value;
}
};
// UnityEngine.Scripting.RequiredByNativeCodeAttribute
struct RequiredByNativeCodeAttribute_t855401D3C2EF3B44F4F1C3EE2DCD361CFC358D20 : public Attribute_t037CA9D9F3B742C063DB364D2EEBBF9FC5772C71
{
public:
// System.String UnityEngine.Scripting.RequiredByNativeCodeAttribute::<Name>k__BackingField
String_t* ___U3CNameU3Ek__BackingField_0;
// System.Boolean UnityEngine.Scripting.RequiredByNativeCodeAttribute::<Optional>k__BackingField
bool ___U3COptionalU3Ek__BackingField_1;
// System.Boolean UnityEngine.Scripting.RequiredByNativeCodeAttribute::<GenerateProxy>k__BackingField
bool ___U3CGenerateProxyU3Ek__BackingField_2;
public:
inline static int32_t get_offset_of_U3CNameU3Ek__BackingField_0() { return static_cast<int32_t>(offsetof(RequiredByNativeCodeAttribute_t855401D3C2EF3B44F4F1C3EE2DCD361CFC358D20, ___U3CNameU3Ek__BackingField_0)); }
inline String_t* get_U3CNameU3Ek__BackingField_0() const { return ___U3CNameU3Ek__BackingField_0; }
inline String_t** get_address_of_U3CNameU3Ek__BackingField_0() { return &___U3CNameU3Ek__BackingField_0; }
inline void set_U3CNameU3Ek__BackingField_0(String_t* value)
{
___U3CNameU3Ek__BackingField_0 = value;
Il2CppCodeGenWriteBarrier((void**)(&___U3CNameU3Ek__BackingField_0), (void*)value);
}
inline static int32_t get_offset_of_U3COptionalU3Ek__BackingField_1() { return static_cast<int32_t>(offsetof(RequiredByNativeCodeAttribute_t855401D3C2EF3B44F4F1C3EE2DCD361CFC358D20, ___U3COptionalU3Ek__BackingField_1)); }
inline bool get_U3COptionalU3Ek__BackingField_1() const { return ___U3COptionalU3Ek__BackingField_1; }
inline bool* get_address_of_U3COptionalU3Ek__BackingField_1() { return &___U3COptionalU3Ek__BackingField_1; }
inline void set_U3COptionalU3Ek__BackingField_1(bool value)
{
___U3COptionalU3Ek__BackingField_1 = value;
}
inline static int32_t get_offset_of_U3CGenerateProxyU3Ek__BackingField_2() { return static_cast<int32_t>(offsetof(RequiredByNativeCodeAttribute_t855401D3C2EF3B44F4F1C3EE2DCD361CFC358D20, ___U3CGenerateProxyU3Ek__BackingField_2)); }
inline bool get_U3CGenerateProxyU3Ek__BackingField_2() const { return ___U3CGenerateProxyU3Ek__BackingField_2; }
inline bool* get_address_of_U3CGenerateProxyU3Ek__BackingField_2() { return &___U3CGenerateProxyU3Ek__BackingField_2; }
inline void set_U3CGenerateProxyU3Ek__BackingField_2(bool value)
{
___U3CGenerateProxyU3Ek__BackingField_2 = value;
}
};
// System.Runtime.CompilerServices.RuntimeCompatibilityAttribute
struct RuntimeCompatibilityAttribute_tFF99AB2963098F9CBCD47A20D9FD3D51C17C1C80 : public Attribute_t037CA9D9F3B742C063DB364D2EEBBF9FC5772C71
{
public:
// System.Boolean System.Runtime.CompilerServices.RuntimeCompatibilityAttribute::m_wrapNonExceptionThrows
bool ___m_wrapNonExceptionThrows_0;
public:
inline static int32_t get_offset_of_m_wrapNonExceptionThrows_0() { return static_cast<int32_t>(offsetof(RuntimeCompatibilityAttribute_tFF99AB2963098F9CBCD47A20D9FD3D51C17C1C80, ___m_wrapNonExceptionThrows_0)); }
inline bool get_m_wrapNonExceptionThrows_0() const { return ___m_wrapNonExceptionThrows_0; }
inline bool* get_address_of_m_wrapNonExceptionThrows_0() { return &___m_wrapNonExceptionThrows_0; }
inline void set_m_wrapNonExceptionThrows_0(bool value)
{
___m_wrapNonExceptionThrows_0 = value;
}
};
// UnityEngine.UnityEngineModuleAssembly
struct UnityEngineModuleAssembly_t33CB058FDDDC458E384578147D6027BB1EC86CFF : public Attribute_t037CA9D9F3B742C063DB364D2EEBBF9FC5772C71
{
public:
public:
};
// System.Void
struct Void_t700C6383A2A510C2CF4DD86DABD5CA9FF70ADAC5
{
public:
union
{
struct
{
};
uint8_t Void_t700C6383A2A510C2CF4DD86DABD5CA9FF70ADAC5__padding[1];
};
public:
};
// UnityEngine.Bindings.FreeFunctionAttribute
struct FreeFunctionAttribute_tBB3B939D760190FEC84762F1BA94B99672613D03 : public NativeMethodAttribute_t57F61ACA17BEC1260A06658ACD971B0009CC1866
{
public:
public:
};
// System.Diagnostics.DebuggableAttribute/DebuggingModes
struct DebuggingModes_t279D5B9C012ABA935887CB73C5A63A1F46AF08A8
{
public:
// System.Int32 System.Diagnostics.DebuggableAttribute/DebuggingModes::value__
int32_t ___value___2;
public:
inline static int32_t get_offset_of_value___2() { return static_cast<int32_t>(offsetof(DebuggingModes_t279D5B9C012ABA935887CB73C5A63A1F46AF08A8, ___value___2)); }
inline int32_t get_value___2() const { return ___value___2; }
inline int32_t* get_address_of_value___2() { return &___value___2; }
inline void set_value___2(int32_t value)
{
___value___2 = value;
}
};
// System.Diagnostics.DebuggableAttribute
struct DebuggableAttribute_tA8054EBD0FC7511695D494B690B5771658E3191B : public Attribute_t037CA9D9F3B742C063DB364D2EEBBF9FC5772C71
{
public:
// System.Diagnostics.DebuggableAttribute/DebuggingModes System.Diagnostics.DebuggableAttribute::m_debuggingModes
int32_t ___m_debuggingModes_0;
public:
inline static int32_t get_offset_of_m_debuggingModes_0() { return static_cast<int32_t>(offsetof(DebuggableAttribute_tA8054EBD0FC7511695D494B690B5771658E3191B, ___m_debuggingModes_0)); }
inline int32_t get_m_debuggingModes_0() const { return ___m_debuggingModes_0; }
inline int32_t* get_address_of_m_debuggingModes_0() { return &___m_debuggingModes_0; }
inline void set_m_debuggingModes_0(int32_t value)
{
___m_debuggingModes_0 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
// System.Void System.Runtime.CompilerServices.InternalsVisibleToAttribute::.ctor(System.String)
IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR void InternalsVisibleToAttribute__ctor_m420071A75DCEEC72356490C64B4B0B9270DA32B9 (InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C * __this, String_t* ___assemblyName0, const RuntimeMethod* method);
// System.Void System.Runtime.CompilerServices.CompilationRelaxationsAttribute::.ctor(System.Int32)
IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR void CompilationRelaxationsAttribute__ctor_mAC3079EBC4EEAB474EED8208EF95DB39C922333B (CompilationRelaxationsAttribute_t661FDDC06629BDA607A42BD660944F039FE03AFF * __this, int32_t ___relaxations0, const RuntimeMethod* method);
// System.Void System.Runtime.CompilerServices.RuntimeCompatibilityAttribute::.ctor()
IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR void RuntimeCompatibilityAttribute__ctor_m551DDF1438CE97A984571949723F30F44CF7317C (RuntimeCompatibilityAttribute_tFF99AB2963098F9CBCD47A20D9FD3D51C17C1C80 * __this, const RuntimeMethod* method);
// System.Void System.Runtime.CompilerServices.RuntimeCompatibilityAttribute::set_WrapNonExceptionThrows(System.Boolean)
IL2CPP_MANAGED_FORCE_INLINE IL2CPP_METHOD_ATTR void RuntimeCompatibilityAttribute_set_WrapNonExceptionThrows_m8562196F90F3EBCEC23B5708EE0332842883C490_inline (RuntimeCompatibilityAttribute_tFF99AB2963098F9CBCD47A20D9FD3D51C17C1C80 * __this, bool ___value0, const RuntimeMethod* method);
// System.Void System.Diagnostics.DebuggableAttribute::.ctor(System.Diagnostics.DebuggableAttribute/DebuggingModes)
IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR void DebuggableAttribute__ctor_m7FF445C8435494A4847123A668D889E692E55550 (DebuggableAttribute_tA8054EBD0FC7511695D494B690B5771658E3191B * __this, int32_t ___modes0, const RuntimeMethod* method);
// System.Void UnityEngine.UnityEngineModuleAssembly::.ctor()
IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR void UnityEngineModuleAssembly__ctor_m76C129AC6AA438BE601F5279EE9EB599BEF90AF9 (UnityEngineModuleAssembly_t33CB058FDDDC458E384578147D6027BB1EC86CFF * __this, const RuntimeMethod* method);
// System.Void UnityEngine.Bindings.NativeHeaderAttribute::.ctor(System.String)
IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR void NativeHeaderAttribute__ctor_m0E83F29C5939F185D6E90541591802EB2845FD76 (NativeHeaderAttribute_t7F0E4B53790AA75CDB4C44E6D644267F8FE3066C * __this, String_t* ___header0, const RuntimeMethod* method);
// System.Void UnityEngine.Bindings.FreeFunctionAttribute::.ctor(System.String)
IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR void FreeFunctionAttribute__ctor_mE37D1E356F51A379B44C570574608DC3E49E0DB0 (FreeFunctionAttribute_tBB3B939D760190FEC84762F1BA94B99672613D03 * __this, String_t* ___name0, const RuntimeMethod* method);
// System.Void UnityEngine.Bindings.NativeThrowsAttribute::.ctor()
IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR void NativeThrowsAttribute__ctor_m7FD0B7887043A2A47C39D7029EF5B8C713E08751 (NativeThrowsAttribute_tF59F2833BDD09C6C89298E603D5C3A598CC08137 * __this, const RuntimeMethod* method);
// System.Void UnityEngine.Scripting.RequiredByNativeCodeAttribute::.ctor()
IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR void RequiredByNativeCodeAttribute__ctor_m97C095D1EE6AAB2894AE7E8B2F07D9B47CB8F8B5 (RequiredByNativeCodeAttribute_t855401D3C2EF3B44F4F1C3EE2DCD361CFC358D20 * __this, const RuntimeMethod* method);
static void UnityEngine_InputLegacyModule_CustomAttributesCacheGenerator(CustomAttributesCache* cache)
{
{
InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C * tmp = (InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C *)cache->attributes[0];
InternalsVisibleToAttribute__ctor_m420071A75DCEEC72356490C64B4B0B9270DA32B9(tmp, il2cpp_codegen_string_new_wrapper("\x55\x6E\x69\x74\x79\x2E\x49\x6E\x74\x65\x72\x6E\x61\x6C\x41\x50\x49\x45\x6E\x67\x69\x6E\x65\x42\x72\x69\x64\x67\x65\x2E\x30\x31\x35"), NULL);
}
{
InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C * tmp = (InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C *)cache->attributes[1];
InternalsVisibleToAttribute__ctor_m420071A75DCEEC72356490C64B4B0B9270DA32B9(tmp, il2cpp_codegen_string_new_wrapper("\x41\x73\x73\x65\x6D\x62\x6C\x79\x2D\x43\x53\x68\x61\x72\x70\x2D\x66\x69\x72\x73\x74\x70\x61\x73\x73\x2D\x74\x65\x73\x74\x61\x62\x6C\x65"), NULL);
}
{
InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C * tmp = (InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C *)cache->attributes[2];
InternalsVisibleToAttribute__ctor_m420071A75DCEEC72356490C64B4B0B9270DA32B9(tmp, il2cpp_codegen_string_new_wrapper("\x55\x6E\x69\x74\x79\x45\x6E\x67\x69\x6E\x65\x2E\x53\x70\x61\x74\x69\x61\x6C\x54\x72\x61\x63\x6B\x69\x6E\x67"), NULL);
}
{
InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C * tmp = (InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C *)cache->attributes[3];
InternalsVisibleToAttribute__ctor_m420071A75DCEEC72356490C64B4B0B9270DA32B9(tmp, il2cpp_codegen_string_new_wrapper("\x47\x6F\x6F\x67\x6C\x65\x41\x52\x2E\x55\x6E\x69\x74\x79\x4E\x61\x74\x69\x76\x65"), NULL);
}
{
InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C * tmp = (InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C *)cache->attributes[4];
InternalsVisibleToAttribute__ctor_m420071A75DCEEC72356490C64B4B0B9270DA32B9(tmp, il2cpp_codegen_string_new_wrapper("\x55\x6E\x69\x74\x79\x2E\x57\x69\x6E\x64\x6F\x77\x73\x4D\x52\x41\x75\x74\x6F\x6D\x61\x74\x69\x6F\x6E"), NULL);
}
{
InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C * tmp = (InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C *)cache->attributes[5];
InternalsVisibleToAttribute__ctor_m420071A75DCEEC72356490C64B4B0B9270DA32B9(tmp, il2cpp_codegen_string_new_wrapper("\x55\x6E\x69\x74\x79\x2E\x32\x44\x2E\x53\x70\x72\x69\x74\x65\x2E\x45\x64\x69\x74\x6F\x72"), NULL);
}
{
InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C * tmp = (InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C *)cache->attributes[6];
InternalsVisibleToAttribute__ctor_m420071A75DCEEC72356490C64B4B0B9270DA32B9(tmp, il2cpp_codegen_string_new_wrapper("\x55\x6E\x69\x74\x79\x2E\x32\x44\x2E\x53\x70\x72\x69\x74\x65\x2E\x45\x64\x69\x74\x6F\x72\x54\x65\x73\x74\x73"), NULL);
}
{
InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C * tmp = (InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C *)cache->attributes[7];
InternalsVisibleToAttribute__ctor_m420071A75DCEEC72356490C64B4B0B9270DA32B9(tmp, il2cpp_codegen_string_new_wrapper("\x55\x6E\x69\x74\x79\x2E\x55\x49\x2E\x42\x75\x69\x6C\x64\x65\x72\x2E\x45\x64\x69\x74\x6F\x72"), NULL);
}
{
InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C * tmp = (InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C *)cache->attributes[8];
InternalsVisibleToAttribute__ctor_m420071A75DCEEC72356490C64B4B0B9270DA32B9(tmp, il2cpp_codegen_string_new_wrapper("\x41\x73\x73\x65\x6D\x62\x6C\x79\x2D\x43\x53\x68\x61\x72\x70\x2D\x74\x65\x73\x74\x61\x62\x6C\x65"), NULL);
}
{
InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C * tmp = (InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C *)cache->attributes[9];
InternalsVisibleToAttribute__ctor_m420071A75DCEEC72356490C64B4B0B9270DA32B9(tmp, il2cpp_codegen_string_new_wrapper("\x55\x6E\x69\x74\x79\x45\x64\x69\x74\x6F\x72\x2E\x55\x49\x42\x75\x69\x6C\x64\x65\x72\x4D\x6F\x64\x75\x6C\x65"), NULL);
}
{
InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C * tmp = (InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C *)cache->attributes[10];
InternalsVisibleToAttribute__ctor_m420071A75DCEEC72356490C64B4B0B9270DA32B9(tmp, il2cpp_codegen_string_new_wrapper("\x55\x6E\x69\x74\x79\x2E\x55\x49\x2E\x42\x75\x69\x6C\x64\x65\x72\x2E\x45\x64\x69\x74\x6F\x72\x54\x65\x73\x74\x73"), NULL);
}
{
InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C * tmp = (InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C *)cache->attributes[11];
InternalsVisibleToAttribute__ctor_m420071A75DCEEC72356490C64B4B0B9270DA32B9(tmp, il2cpp_codegen_string_new_wrapper("\x55\x6E\x69\x74\x79\x45\x6E\x67\x69\x6E\x65\x2E\x55\x49\x45\x6C\x65\x6D\x65\x6E\x74\x73\x47\x61\x6D\x65\x4F\x62\x6A\x65\x63\x74\x73\x4D\x6F\x64\x75\x6C\x65"), NULL);
}
{
InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C * tmp = (InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C *)cache->attributes[12];
InternalsVisibleToAttribute__ctor_m420071A75DCEEC72356490C64B4B0B9270DA32B9(tmp, il2cpp_codegen_string_new_wrapper("\x55\x6E\x69\x74\x79\x2E\x55\x49\x45\x6C\x65\x6D\x65\x6E\x74\x73\x2E\x45\x64\x69\x74\x6F\x72"), NULL);
}
{
InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C * tmp = (InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C *)cache->attributes[13];
InternalsVisibleToAttribute__ctor_m420071A75DCEEC72356490C64B4B0B9270DA32B9(tmp, il2cpp_codegen_string_new_wrapper("\x55\x6E\x69\x74\x79\x2E\x55\x49\x45\x6C\x65\x6D\x65\x6E\x74\x73\x2E\x45\x64\x69\x74\x6F\x72\x54\x65\x73\x74\x73"), NULL);
}
{
InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C * tmp = (InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C *)cache->attributes[14];
InternalsVisibleToAttribute__ctor_m420071A75DCEEC72356490C64B4B0B9270DA32B9(tmp, il2cpp_codegen_string_new_wrapper("\x55\x6E\x69\x74\x79\x2E\x4E\x65\x74\x77\x6F\x72\x6B\x69\x6E\x67\x2E\x54\x72\x61\x6E\x73\x70\x6F\x72\x74"), NULL);
}
{
InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C * tmp = (InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C *)cache->attributes[15];
InternalsVisibleToAttribute__ctor_m420071A75DCEEC72356490C64B4B0B9270DA32B9(tmp, il2cpp_codegen_string_new_wrapper("\x55\x6E\x69\x74\x79\x2E\x75\x63\x67\x2E\x51\x6F\x53"), NULL);
}
{
InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C * tmp = (InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C *)cache->attributes[16];
InternalsVisibleToAttribute__ctor_m420071A75DCEEC72356490C64B4B0B9270DA32B9(tmp, il2cpp_codegen_string_new_wrapper("\x55\x6E\x69\x74\x79\x2E\x45\x6E\x74\x69\x74\x69\x65\x73"), NULL);
}
{
InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C * tmp = (InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C *)cache->attributes[17];
InternalsVisibleToAttribute__ctor_m420071A75DCEEC72356490C64B4B0B9270DA32B9(tmp, il2cpp_codegen_string_new_wrapper("\x55\x6E\x69\x74\x79\x45\x6E\x67\x69\x6E\x65\x2E\x55\x49\x4D\x6F\x64\x75\x6C\x65"), NULL);
}
{
InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C * tmp = (InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C *)cache->attributes[18];
InternalsVisibleToAttribute__ctor_m420071A75DCEEC72356490C64B4B0B9270DA32B9(tmp, il2cpp_codegen_string_new_wrapper("\x55\x6E\x69\x74\x79\x2E\x54\x69\x6D\x65\x6C\x69\x6E\x65"), NULL);
}
{
InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C * tmp = (InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C *)cache->attributes[19];
InternalsVisibleToAttribute__ctor_m420071A75DCEEC72356490C64B4B0B9270DA32B9(tmp, il2cpp_codegen_string_new_wrapper("\x55\x6E\x69\x74\x79\x2E\x52\x75\x6E\x74\x69\x6D\x65\x54\x65\x73\x74\x73\x2E\x41\x6C\x6C\x49\x6E\x31\x52\x75\x6E\x6E\x65\x72"), NULL);
}
{
InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C * tmp = (InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C *)cache->attributes[20];
InternalsVisibleToAttribute__ctor_m420071A75DCEEC72356490C64B4B0B9270DA32B9(tmp, il2cpp_codegen_string_new_wrapper("\x55\x6E\x69\x74\x79\x2E\x49\x6E\x74\x65\x72\x6E\x61\x6C\x41\x50\x49\x45\x6E\x67\x69\x6E\x65\x42\x72\x69\x64\x67\x65\x2E\x30\x30\x34"), NULL);
}
{
InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C * tmp = (InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C *)cache->attributes[21];
InternalsVisibleToAttribute__ctor_m420071A75DCEEC72356490C64B4B0B9270DA32B9(tmp, il2cpp_codegen_string_new_wrapper("\x55\x6E\x69\x74\x79\x2E\x49\x6E\x74\x65\x72\x6E\x61\x6C\x41\x50\x49\x45\x6E\x67\x69\x6E\x65\x42\x72\x69\x64\x67\x65\x2E\x30\x31\x37"), NULL);
}
{
InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C * tmp = (InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C *)cache->attributes[22];
InternalsVisibleToAttribute__ctor_m420071A75DCEEC72356490C64B4B0B9270DA32B9(tmp, il2cpp_codegen_string_new_wrapper("\x55\x6E\x69\x74\x79\x2E\x49\x6E\x74\x65\x72\x6E\x61\x6C\x41\x50\x49\x45\x6E\x67\x69\x6E\x65\x42\x72\x69\x64\x67\x65\x2E\x30\x31\x38"), NULL);
}
{
InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C * tmp = (InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C *)cache->attributes[23];
InternalsVisibleToAttribute__ctor_m420071A75DCEEC72356490C64B4B0B9270DA32B9(tmp, il2cpp_codegen_string_new_wrapper("\x55\x6E\x69\x74\x79\x2E\x49\x6E\x74\x65\x72\x6E\x61\x6C\x41\x50\x49\x45\x6E\x67\x69\x6E\x65\x42\x72\x69\x64\x67\x65\x2E\x30\x31\x39"), NULL);
}
{
InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C * tmp = (InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C *)cache->attributes[24];
InternalsVisibleToAttribute__ctor_m420071A75DCEEC72356490C64B4B0B9270DA32B9(tmp, il2cpp_codegen_string_new_wrapper("\x55\x6E\x69\x74\x79\x2E\x49\x6E\x74\x65\x72\x6E\x61\x6C\x41\x50\x49\x45\x6E\x67\x69\x6E\x65\x42\x72\x69\x64\x67\x65\x2E\x30\x32\x30"), NULL);
}
{
InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C * tmp = (InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C *)cache->attributes[25];
InternalsVisibleToAttribute__ctor_m420071A75DCEEC72356490C64B4B0B9270DA32B9(tmp, il2cpp_codegen_string_new_wrapper("\x55\x6E\x69\x74\x79\x2E\x49\x6E\x74\x65\x72\x6E\x61\x6C\x41\x50\x49\x45\x6E\x67\x69\x6E\x65\x42\x72\x69\x64\x67\x65\x2E\x30\x32\x31"), NULL);
}
{
InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C * tmp = (InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C *)cache->attributes[26];
InternalsVisibleToAttribute__ctor_m420071A75DCEEC72356490C64B4B0B9270DA32B9(tmp, il2cpp_codegen_string_new_wrapper("\x55\x6E\x69\x74\x79\x2E\x49\x6E\x74\x65\x72\x6E\x61\x6C\x41\x50\x49\x45\x6E\x67\x69\x6E\x65\x42\x72\x69\x64\x67\x65\x2E\x30\x32\x32"), NULL);
}
{
InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C * tmp = (InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C *)cache->attributes[27];
InternalsVisibleToAttribute__ctor_m420071A75DCEEC72356490C64B4B0B9270DA32B9(tmp, il2cpp_codegen_string_new_wrapper("\x55\x6E\x69\x74\x79\x2E\x49\x6E\x74\x65\x72\x6E\x61\x6C\x41\x50\x49\x45\x6E\x67\x69\x6E\x65\x42\x72\x69\x64\x67\x65\x2E\x30\x32\x33"), NULL);
}
{
InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C * tmp = (InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C *)cache->attributes[28];
InternalsVisibleToAttribute__ctor_m420071A75DCEEC72356490C64B4B0B9270DA32B9(tmp, il2cpp_codegen_string_new_wrapper("\x55\x6E\x69\x74\x79\x2E\x49\x6E\x74\x65\x72\x6E\x61\x6C\x41\x50\x49\x45\x6E\x67\x69\x6E\x65\x42\x72\x69\x64\x67\x65\x2E\x30\x32\x34"), NULL);
}
{
InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C * tmp = (InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C *)cache->attributes[29];
InternalsVisibleToAttribute__ctor_m420071A75DCEEC72356490C64B4B0B9270DA32B9(tmp, il2cpp_codegen_string_new_wrapper("\x55\x6E\x69\x74\x79\x2E\x49\x6E\x74\x65\x72\x6E\x61\x6C\x41\x50\x49\x45\x6E\x67\x69\x6E\x65\x42\x72\x69\x64\x67\x65\x44\x65\x76\x2E\x30\x30\x31"), NULL);
}
{
InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C * tmp = (InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C *)cache->attributes[30];
InternalsVisibleToAttribute__ctor_m420071A75DCEEC72356490C64B4B0B9270DA32B9(tmp, il2cpp_codegen_string_new_wrapper("\x55\x6E\x69\x74\x79\x2E\x49\x6E\x74\x65\x72\x6E\x61\x6C\x41\x50\x49\x45\x6E\x67\x69\x6E\x65\x42\x72\x69\x64\x67\x65\x44\x65\x76\x2E\x30\x30\x32"), NULL);
}
{
InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C * tmp = (InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C *)cache->attributes[31];
InternalsVisibleToAttribute__ctor_m420071A75DCEEC72356490C64B4B0B9270DA32B9(tmp, il2cpp_codegen_string_new_wrapper("\x55\x6E\x69\x74\x79\x2E\x49\x6E\x74\x65\x72\x6E\x61\x6C\x41\x50\x49\x45\x6E\x67\x69\x6E\x65\x42\x72\x69\x64\x67\x65\x44\x65\x76\x2E\x30\x30\x33"), NULL);
}
{
InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C * tmp = (InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C *)cache->attributes[32];
InternalsVisibleToAttribute__ctor_m420071A75DCEEC72356490C64B4B0B9270DA32B9(tmp, il2cpp_codegen_string_new_wrapper("\x55\x6E\x69\x74\x79\x2E\x49\x6E\x74\x65\x72\x6E\x61\x6C\x41\x50\x49\x45\x6E\x67\x69\x6E\x65\x42\x72\x69\x64\x67\x65\x44\x65\x76\x2E\x30\x30\x34"), NULL);
}
{
InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C * tmp = (InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C *)cache->attributes[33];
InternalsVisibleToAttribute__ctor_m420071A75DCEEC72356490C64B4B0B9270DA32B9(tmp, il2cpp_codegen_string_new_wrapper("\x55\x6E\x69\x74\x79\x2E\x49\x6E\x74\x65\x72\x6E\x61\x6C\x41\x50\x49\x45\x6E\x67\x69\x6E\x65\x42\x72\x69\x64\x67\x65\x44\x65\x76\x2E\x30\x30\x35"), NULL);
}
{
InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C * tmp = (InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C *)cache->attributes[34];
InternalsVisibleToAttribute__ctor_m420071A75DCEEC72356490C64B4B0B9270DA32B9(tmp, il2cpp_codegen_string_new_wrapper("\x55\x6E\x69\x74\x79\x2E\x53\x75\x62\x73\x79\x73\x74\x65\x6D\x2E\x52\x65\x67\x69\x73\x74\x72\x61\x74\x69\x6F\x6E"), NULL);
}
{
InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C * tmp = (InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C *)cache->attributes[35];
InternalsVisibleToAttribute__ctor_m420071A75DCEEC72356490C64B4B0B9270DA32B9(tmp, il2cpp_codegen_string_new_wrapper("\x55\x6E\x69\x74\x79\x2E\x49\x6E\x74\x65\x72\x6E\x61\x6C\x41\x50\x49\x45\x6E\x67\x69\x6E\x65\x42\x72\x69\x64\x67\x65\x2E\x30\x30\x37"), NULL);
}
{
InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C * tmp = (InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C *)cache->attributes[36];
InternalsVisibleToAttribute__ctor_m420071A75DCEEC72356490C64B4B0B9270DA32B9(tmp, il2cpp_codegen_string_new_wrapper("\x55\x6E\x69\x74\x79\x2E\x49\x6E\x74\x65\x72\x6E\x61\x6C\x41\x50\x49\x45\x6E\x67\x69\x6E\x65\x42\x72\x69\x64\x67\x65\x2E\x30\x30\x36"), NULL);
}
{
InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C * tmp = (InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C *)cache->attributes[37];
InternalsVisibleToAttribute__ctor_m420071A75DCEEC72356490C64B4B0B9270DA32B9(tmp, il2cpp_codegen_string_new_wrapper("\x55\x6E\x69\x74\x79\x2E\x49\x6E\x74\x65\x72\x6E\x61\x6C\x41\x50\x49\x45\x6E\x67\x69\x6E\x65\x42\x72\x69\x64\x67\x65\x2E\x30\x30\x35"), NULL);
}
{
InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C * tmp = (InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C *)cache->attributes[38];
InternalsVisibleToAttribute__ctor_m420071A75DCEEC72356490C64B4B0B9270DA32B9(tmp, il2cpp_codegen_string_new_wrapper("\x55\x6E\x69\x74\x79\x2E\x43\x6F\x6C\x6C\x65\x63\x74\x69\x6F\x6E\x73"), NULL);
}
{
InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C * tmp = (InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C *)cache->attributes[39];
InternalsVisibleToAttribute__ctor_m420071A75DCEEC72356490C64B4B0B9270DA32B9(tmp, il2cpp_codegen_string_new_wrapper("\x55\x6E\x69\x74\x79\x2E\x49\x6E\x74\x65\x72\x6E\x61\x6C\x41\x50\x49\x45\x6E\x67\x69\x6E\x65\x42\x72\x69\x64\x67\x65\x2E\x30\x31\x36"), NULL);
}
{
InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C * tmp = (InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C *)cache->attributes[40];
InternalsVisibleToAttribute__ctor_m420071A75DCEEC72356490C64B4B0B9270DA32B9(tmp, il2cpp_codegen_string_new_wrapper("\x55\x6E\x69\x74\x79\x2E\x43\x6F\x72\x65"), NULL);
}
{
InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C * tmp = (InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C *)cache->attributes[41];
InternalsVisibleToAttribute__ctor_m420071A75DCEEC72356490C64B4B0B9270DA32B9(tmp, il2cpp_codegen_string_new_wrapper("\x55\x6E\x69\x74\x79\x2E\x49\x6E\x74\x65\x72\x6E\x61\x6C\x41\x50\x49\x45\x6E\x67\x69\x6E\x65\x42\x72\x69\x64\x67\x65\x2E\x30\x30\x32"), NULL);
}
{
InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C * tmp = (InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C *)cache->attributes[42];
InternalsVisibleToAttribute__ctor_m420071A75DCEEC72356490C64B4B0B9270DA32B9(tmp, il2cpp_codegen_string_new_wrapper("\x55\x6E\x69\x74\x79\x45\x6E\x67\x69\x6E\x65\x2E\x49\x6D\x61\x67\x65\x43\x6F\x6E\x76\x65\x72\x73\x69\x6F\x6E\x4D\x6F\x64\x75\x6C\x65"), NULL);
}
{
InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C * tmp = (InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C *)cache->attributes[43];
InternalsVisibleToAttribute__ctor_m420071A75DCEEC72356490C64B4B0B9270DA32B9(tmp, il2cpp_codegen_string_new_wrapper("\x55\x6E\x69\x74\x79\x45\x6E\x67\x69\x6E\x65\x2E\x4A\x53\x4F\x4E\x53\x65\x72\x69\x61\x6C\x69\x7A\x65\x4D\x6F\x64\x75\x6C\x65"), NULL);
}
{
InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C * tmp = (InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C *)cache->attributes[44];
InternalsVisibleToAttribute__ctor_m420071A75DCEEC72356490C64B4B0B9270DA32B9(tmp, il2cpp_codegen_string_new_wrapper("\x55\x6E\x69\x74\x79\x45\x6E\x67\x69\x6E\x65\x2E\x54\x65\x72\x72\x61\x69\x6E\x4D\x6F\x64\x75\x6C\x65"), NULL);
}
{
InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C * tmp = (InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C *)cache->attributes[45];
InternalsVisibleToAttribute__ctor_m420071A75DCEEC72356490C64B4B0B9270DA32B9(tmp, il2cpp_codegen_string_new_wrapper("\x55\x6E\x69\x74\x79\x45\x6E\x67\x69\x6E\x65\x2E\x54\x4C\x53\x4D\x6F\x64\x75\x6C\x65"), NULL);
}
{
InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C * tmp = (InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C *)cache->attributes[46];
InternalsVisibleToAttribute__ctor_m420071A75DCEEC72356490C64B4B0B9270DA32B9(tmp, il2cpp_codegen_string_new_wrapper("\x55\x6E\x69\x74\x79\x45\x6E\x67\x69\x6E\x65\x2E\x53\x75\x62\x73\x79\x73\x74\x65\x6D\x73\x4D\x6F\x64\x75\x6C\x65"), NULL);
}
{
InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C * tmp = (InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C *)cache->attributes[47];
InternalsVisibleToAttribute__ctor_m420071A75DCEEC72356490C64B4B0B9270DA32B9(tmp, il2cpp_codegen_string_new_wrapper("\x55\x6E\x69\x74\x79\x45\x6E\x67\x69\x6E\x65\x2E\x53\x75\x62\x73\x74\x61\x6E\x63\x65\x4D\x6F\x64\x75\x6C\x65"), NULL);
}
{
InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C * tmp = (InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C *)cache->attributes[48];
InternalsVisibleToAttribute__ctor_m420071A75DCEEC72356490C64B4B0B9270DA32B9(tmp, il2cpp_codegen_string_new_wrapper("\x55\x6E\x69\x74\x79\x45\x6E\x67\x69\x6E\x65\x2E\x53\x74\x72\x65\x61\x6D\x69\x6E\x67\x4D\x6F\x64\x75\x6C\x65"), NULL);
}
{
CompilationRelaxationsAttribute_t661FDDC06629BDA607A42BD660944F039FE03AFF * tmp = (CompilationRelaxationsAttribute_t661FDDC06629BDA607A42BD660944F039FE03AFF *)cache->attributes[49];
CompilationRelaxationsAttribute__ctor_mAC3079EBC4EEAB474EED8208EF95DB39C922333B(tmp, 8LL, NULL);
}
{
InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C * tmp = (InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C *)cache->attributes[50];
InternalsVisibleToAttribute__ctor_m420071A75DCEEC72356490C64B4B0B9270DA32B9(tmp, il2cpp_codegen_string_new_wrapper("\x55\x6E\x69\x74\x79\x45\x6E\x67\x69\x6E\x65\x2E\x53\x70\x72\x69\x74\x65\x53\x68\x61\x70\x65\x4D\x6F\x64\x75\x6C\x65"), NULL);
}
{
InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C * tmp = (InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C *)cache->attributes[51];
InternalsVisibleToAttribute__ctor_m420071A75DCEEC72356490C64B4B0B9270DA32B9(tmp, il2cpp_codegen_string_new_wrapper("\x55\x6E\x69\x74\x79\x45\x6E\x67\x69\x6E\x65\x2E\x53\x70\x72\x69\x74\x65\x4D\x61\x73\x6B\x4D\x6F\x64\x75\x6C\x65"), NULL);
}
{
InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C * tmp = (InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C *)cache->attributes[52];
InternalsVisibleToAttribute__ctor_m420071A75DCEEC72356490C64B4B0B9270DA32B9(tmp, il2cpp_codegen_string_new_wrapper("\x55\x6E\x69\x74\x79\x45\x6E\x67\x69\x6E\x65\x2E\x52\x75\x6E\x74\x69\x6D\x65\x49\x6E\x69\x74\x69\x61\x6C\x69\x7A\x65\x4F\x6E\x4C\x6F\x61\x64\x4D\x61\x6E\x61\x67\x65\x72\x49\x6E\x69\x74\x69\x61\x6C\x69\x7A\x65\x72\x4D\x6F\x64\x75\x6C\x65"), NULL);
}
{
InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C * tmp = (InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C *)cache->attributes[53];
InternalsVisibleToAttribute__ctor_m420071A75DCEEC72356490C64B4B0B9270DA32B9(tmp, il2cpp_codegen_string_new_wrapper("\x55\x6E\x69\x74\x79\x45\x6E\x67\x69\x6E\x65\x2E\x50\x72\x6F\x66\x69\x6C\x65\x72\x4D\x6F\x64\x75\x6C\x65"), NULL);
}
{
InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C * tmp = (InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C *)cache->attributes[54];
InternalsVisibleToAttribute__ctor_m420071A75DCEEC72356490C64B4B0B9270DA32B9(tmp, il2cpp_codegen_string_new_wrapper("\x55\x6E\x69\x74\x79\x45\x6E\x67\x69\x6E\x65\x2E\x50\x68\x79\x73\x69\x63\x73\x32\x44\x4D\x6F\x64\x75\x6C\x65"), NULL);
}
{
InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C * tmp = (InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C *)cache->attributes[55];
InternalsVisibleToAttribute__ctor_m420071A75DCEEC72356490C64B4B0B9270DA32B9(tmp, il2cpp_codegen_string_new_wrapper("\x55\x6E\x69\x74\x79\x45\x6E\x67\x69\x6E\x65\x2E\x50\x68\x79\x73\x69\x63\x73\x4D\x6F\x64\x75\x6C\x65"), NULL);
}
{
InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C * tmp = (InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C *)cache->attributes[56];
InternalsVisibleToAttribute__ctor_m420071A75DCEEC72356490C64B4B0B9270DA32B9(tmp, il2cpp_codegen_string_new_wrapper("\x55\x6E\x69\x74\x79\x45\x6E\x67\x69\x6E\x65\x2E\x50\x61\x72\x74\x69\x63\x6C\x65\x53\x79\x73\x74\x65\x6D\x4D\x6F\x64\x75\x6C\x65"), NULL);
}
{
InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C * tmp = (InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C *)cache->attributes[57];
InternalsVisibleToAttribute__ctor_m420071A75DCEEC72356490C64B4B0B9270DA32B9(tmp, il2cpp_codegen_string_new_wrapper("\x55\x6E\x69\x74\x79\x45\x6E\x67\x69\x6E\x65\x2E\x4C\x6F\x63\x61\x6C\x69\x7A\x61\x74\x69\x6F\x6E\x4D\x6F\x64\x75\x6C\x65"), NULL);
}
{
InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C * tmp = (InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C *)cache->attributes[58];
InternalsVisibleToAttribute__ctor_m420071A75DCEEC72356490C64B4B0B9270DA32B9(tmp, il2cpp_codegen_string_new_wrapper("\x55\x6E\x69\x74\x79\x45\x6E\x67\x69\x6E\x65\x2E\x49\x6E\x70\x75\x74\x4C\x65\x67\x61\x63\x79\x4D\x6F\x64\x75\x6C\x65"), NULL);
}
{
InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C * tmp = (InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C *)cache->attributes[59];
InternalsVisibleToAttribute__ctor_m420071A75DCEEC72356490C64B4B0B9270DA32B9(tmp, il2cpp_codegen_string_new_wrapper("\x55\x6E\x69\x74\x79\x45\x6E\x67\x69\x6E\x65\x2E\x41\x63\x63\x65\x73\x73\x69\x62\x69\x6C\x69\x74\x79\x4D\x6F\x64\x75\x6C\x65"), NULL);
}
{
RuntimeCompatibilityAttribute_tFF99AB2963098F9CBCD47A20D9FD3D51C17C1C80 * tmp = (RuntimeCompatibilityAttribute_tFF99AB2963098F9CBCD47A20D9FD3D51C17C1C80 *)cache->attributes[60];
RuntimeCompatibilityAttribute__ctor_m551DDF1438CE97A984571949723F30F44CF7317C(tmp, NULL);
RuntimeCompatibilityAttribute_set_WrapNonExceptionThrows_m8562196F90F3EBCEC23B5708EE0332842883C490_inline(tmp, true, NULL);
}
{
DebuggableAttribute_tA8054EBD0FC7511695D494B690B5771658E3191B * tmp = (DebuggableAttribute_tA8054EBD0FC7511695D494B690B5771658E3191B *)cache->attributes[61];
DebuggableAttribute__ctor_m7FF445C8435494A4847123A668D889E692E55550(tmp, 263LL, NULL);
}
{
InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C * tmp = (InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C *)cache->attributes[62];
InternalsVisibleToAttribute__ctor_m420071A75DCEEC72356490C64B4B0B9270DA32B9(tmp, il2cpp_codegen_string_new_wrapper("\x55\x6E\x69\x74\x79\x2E\x49\x6E\x74\x65\x72\x6E\x61\x6C\x41\x50\x49\x45\x6E\x67\x69\x6E\x65\x42\x72\x69\x64\x67\x65\x2E\x30\x30\x33"), NULL);
}
{
InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C * tmp = (InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C *)cache->attributes[63];
InternalsVisibleToAttribute__ctor_m420071A75DCEEC72356490C64B4B0B9270DA32B9(tmp, il2cpp_codegen_string_new_wrapper("\x55\x6E\x69\x74\x79\x2E\x55\x49\x45\x6C\x65\x6D\x65\x6E\x74\x73"), NULL);
}
{
InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C * tmp = (InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C *)cache->attributes[64];
InternalsVisibleToAttribute__ctor_m420071A75DCEEC72356490C64B4B0B9270DA32B9(tmp, il2cpp_codegen_string_new_wrapper("\x55\x6E\x69\x74\x79\x45\x6E\x67\x69\x6E\x65\x2E\x54\x69\x6C\x65\x6D\x61\x70\x4D\x6F\x64\x75\x6C\x65"), NULL);
}
{
InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C * tmp = (InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C *)cache->attributes[65];
InternalsVisibleToAttribute__ctor_m420071A75DCEEC72356490C64B4B0B9270DA32B9(tmp, il2cpp_codegen_string_new_wrapper("\x55\x6E\x69\x74\x79\x45\x6E\x67\x69\x6E\x65\x2E\x54\x65\x78\x74\x52\x65\x6E\x64\x65\x72\x69\x6E\x67\x4D\x6F\x64\x75\x6C\x65"), NULL);
}
{
InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C * tmp = (InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C *)cache->attributes[66];
InternalsVisibleToAttribute__ctor_m420071A75DCEEC72356490C64B4B0B9270DA32B9(tmp, il2cpp_codegen_string_new_wrapper("\x55\x6E\x69\x74\x79\x45\x6E\x67\x69\x6E\x65\x2E\x54\x65\x72\x72\x61\x69\x6E\x50\x68\x79\x73\x69\x63\x73\x4D\x6F\x64\x75\x6C\x65"), NULL);
}
{
InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C * tmp = (InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C *)cache->attributes[67];
InternalsVisibleToAttribute__ctor_m420071A75DCEEC72356490C64B4B0B9270DA32B9(tmp, il2cpp_codegen_string_new_wrapper("\x55\x6E\x69\x74\x79\x45\x6E\x67\x69\x6E\x65\x2E\x47\x72\x69\x64\x4D\x6F\x64\x75\x6C\x65"), NULL);
}
{
InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C * tmp = (InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C *)cache->attributes[68];
InternalsVisibleToAttribute__ctor_m420071A75DCEEC72356490C64B4B0B9270DA32B9(tmp, il2cpp_codegen_string_new_wrapper("\x55\x6E\x69\x74\x79\x45\x6E\x67\x69\x6E\x65\x2E\x47\x49\x4D\x6F\x64\x75\x6C\x65"), NULL);
}
{
InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C * tmp = (InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C *)cache->attributes[69];
InternalsVisibleToAttribute__ctor_m420071A75DCEEC72356490C64B4B0B9270DA32B9(tmp, il2cpp_codegen_string_new_wrapper("\x55\x6E\x69\x74\x79\x45\x6E\x67\x69\x6E\x65\x2E\x44\x69\x72\x65\x63\x74\x6F\x72\x4D\x6F\x64\x75\x6C\x65"), NULL);
}
{
InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C * tmp = (InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C *)cache->attributes[70];
InternalsVisibleToAttribute__ctor_m420071A75DCEEC72356490C64B4B0B9270DA32B9(tmp, il2cpp_codegen_string_new_wrapper("\x55\x6E\x69\x74\x79\x45\x6E\x67\x69\x6E\x65\x2E\x44\x53\x50\x47\x72\x61\x70\x68\x4D\x6F\x64\x75\x6C\x65"), NULL);
}
{
InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C * tmp = (InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C *)cache->attributes[71];
InternalsVisibleToAttribute__ctor_m420071A75DCEEC72356490C64B4B0B9270DA32B9(tmp, il2cpp_codegen_string_new_wrapper("\x55\x6E\x69\x74\x79\x45\x6E\x67\x69\x6E\x65\x2E\x41\x75\x64\x69\x6F\x4D\x6F\x64\x75\x6C\x65"), NULL);
}
{
InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C * tmp = (InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C *)cache->attributes[72];
InternalsVisibleToAttribute__ctor_m420071A75DCEEC72356490C64B4B0B9270DA32B9(tmp, il2cpp_codegen_string_new_wrapper("\x55\x6E\x69\x74\x79\x45\x6E\x67\x69\x6E\x65\x2E\x41\x6E\x69\x6D\x61\x74\x69\x6F\x6E\x4D\x6F\x64\x75\x6C\x65"), NULL);
}
{
InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C * tmp = (InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C *)cache->attributes[73];
InternalsVisibleToAttribute__ctor_m420071A75DCEEC72356490C64B4B0B9270DA32B9(tmp, il2cpp_codegen_string_new_wrapper("\x55\x6E\x69\x74\x79\x45\x6E\x67\x69\x6E\x65\x2E\x48\x6F\x74\x52\x65\x6C\x6F\x61\x64\x4D\x6F\x64\x75\x6C\x65"), NULL);
}
{
InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C * tmp = (InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C *)cache->attributes[74];
InternalsVisibleToAttribute__ctor_m420071A75DCEEC72356490C64B4B0B9270DA32B9(tmp, il2cpp_codegen_string_new_wrapper("\x55\x6E\x69\x74\x79\x45\x6E\x67\x69\x6E\x65\x2E\x41\x6E\x64\x72\x6F\x69\x64\x4A\x4E\x49\x4D\x6F\x64\x75\x6C\x65"), NULL);
}
{
InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C * tmp = (InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C *)cache->attributes[75];
InternalsVisibleToAttribute__ctor_m420071A75DCEEC72356490C64B4B0B9270DA32B9(tmp, il2cpp_codegen_string_new_wrapper("\x55\x6E\x69\x74\x79\x45\x6E\x67\x69\x6E\x65\x2E\x41\x49\x4D\x6F\x64\x75\x6C\x65"), NULL);
}
{
InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C * tmp = (InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C *)cache->attributes[76];
InternalsVisibleToAttribute__ctor_m420071A75DCEEC72356490C64B4B0B9270DA32B9(tmp, il2cpp_codegen_string_new_wrapper("\x55\x6E\x69\x74\x79\x45\x6E\x67\x69\x6E\x65\x2E\x43\x6F\x72\x65\x4D\x6F\x64\x75\x6C\x65"), NULL);
}
{
InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C * tmp = (InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C *)cache->attributes[77];
InternalsVisibleToAttribute__ctor_m420071A75DCEEC72356490C64B4B0B9270DA32B9(tmp, il2cpp_codegen_string_new_wrapper("\x55\x6E\x69\x74\x79\x45\x6E\x67\x69\x6E\x65\x2E\x53\x68\x61\x72\x65\x64\x49\x6E\x74\x65\x72\x6E\x61\x6C\x73\x4D\x6F\x64\x75\x6C\x65"), NULL);
}
{
InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C * tmp = (InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C *)cache->attributes[78];
InternalsVisibleToAttribute__ctor_m420071A75DCEEC72356490C64B4B0B9270DA32B9(tmp, il2cpp_codegen_string_new_wrapper("\x55\x6E\x69\x74\x79\x45\x6E\x67\x69\x6E\x65"), NULL);
}
{
InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C * tmp = (InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C *)cache->attributes[79];
InternalsVisibleToAttribute__ctor_m420071A75DCEEC72356490C64B4B0B9270DA32B9(tmp, il2cpp_codegen_string_new_wrapper("\x55\x6E\x69\x74\x79\x2E\x49\x6E\x74\x65\x72\x6E\x61\x6C\x41\x50\x49\x45\x6E\x67\x69\x6E\x65\x42\x72\x69\x64\x67\x65\x2E\x30\x30\x31"), NULL);
}
{
InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C * tmp = (InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C *)cache->attributes[80];
InternalsVisibleToAttribute__ctor_m420071A75DCEEC72356490C64B4B0B9270DA32B9(tmp, il2cpp_codegen_string_new_wrapper("\x55\x6E\x69\x74\x79\x45\x6E\x67\x69\x6E\x65\x2E\x53\x63\x72\x65\x65\x6E\x43\x61\x70\x74\x75\x72\x65\x4D\x6F\x64\x75\x6C\x65"), NULL);
}
{
UnityEngineModuleAssembly_t33CB058FDDDC458E384578147D6027BB1EC86CFF * tmp = (UnityEngineModuleAssembly_t33CB058FDDDC458E384578147D6027BB1EC86CFF *)cache->attributes[81];
UnityEngineModuleAssembly__ctor_m76C129AC6AA438BE601F5279EE9EB599BEF90AF9(tmp, NULL);
}
{
InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C * tmp = (InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C *)cache->attributes[82];
InternalsVisibleToAttribute__ctor_m420071A75DCEEC72356490C64B4B0B9270DA32B9(tmp, il2cpp_codegen_string_new_wrapper("\x55\x6E\x69\x74\x79\x2E\x49\x6E\x74\x65\x72\x6E\x61\x6C\x41\x50\x49\x45\x6E\x67\x69\x6E\x65\x42\x72\x69\x64\x67\x65\x2E\x30\x31\x33"), NULL);
}
{
InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C * tmp = (InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C *)cache->attributes[83];
InternalsVisibleToAttribute__ctor_m420071A75DCEEC72356490C64B4B0B9270DA32B9(tmp, il2cpp_codegen_string_new_wrapper("\x55\x6E\x69\x74\x79\x45\x6E\x67\x69\x6E\x65\x2E\x58\x52\x4D\x6F\x64\x75\x6C\x65"), NULL);
}
{
InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C * tmp = (InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C *)cache->attributes[84];
InternalsVisibleToAttribute__ctor_m420071A75DCEEC72356490C64B4B0B9270DA32B9(tmp, il2cpp_codegen_string_new_wrapper("\x55\x6E\x69\x74\x79\x45\x6E\x67\x69\x6E\x65\x2E\x50\x65\x72\x66\x6F\x72\x6D\x61\x6E\x63\x65\x52\x65\x70\x6F\x72\x74\x69\x6E\x67\x4D\x6F\x64\x75\x6C\x65"), NULL);
}
{
InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C * tmp = (InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C *)cache->attributes[85];
InternalsVisibleToAttribute__ctor_m420071A75DCEEC72356490C64B4B0B9270DA32B9(tmp, il2cpp_codegen_string_new_wrapper("\x55\x6E\x69\x74\x79\x2E\x52\x75\x6E\x74\x69\x6D\x65\x54\x65\x73\x74\x73"), NULL);
}
{
InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C * tmp = (InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C *)cache->attributes[86];
InternalsVisibleToAttribute__ctor_m420071A75DCEEC72356490C64B4B0B9270DA32B9(tmp, il2cpp_codegen_string_new_wrapper("\x55\x6E\x69\x74\x79\x45\x6E\x67\x69\x6E\x65\x2E\x55\x49\x45\x6C\x65\x6D\x65\x6E\x74\x73\x4D\x6F\x64\x75\x6C\x65"), NULL);
}
{
InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C * tmp = (InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C *)cache->attributes[87];
InternalsVisibleToAttribute__ctor_m420071A75DCEEC72356490C64B4B0B9270DA32B9(tmp, il2cpp_codegen_string_new_wrapper("\x55\x6E\x69\x74\x79\x2E\x49\x6E\x74\x65\x67\x72\x61\x74\x69\x6F\x6E\x54\x65\x73\x74\x73\x2E\x46\x72\x61\x6D\x65\x77\x6F\x72\x6B"), NULL);
}
{
InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C * tmp = (InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C *)cache->attributes[88];
InternalsVisibleToAttribute__ctor_m420071A75DCEEC72356490C64B4B0B9270DA32B9(tmp, il2cpp_codegen_string_new_wrapper("\x55\x6E\x69\x74\x79\x2E\x49\x6E\x74\x65\x67\x72\x61\x74\x69\x6F\x6E\x54\x65\x73\x74\x73\x2E\x54\x69\x6D\x65\x6C\x69\x6E\x65"), NULL);
}
{
InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C * tmp = (InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C *)cache->attributes[89];
InternalsVisibleToAttribute__ctor_m420071A75DCEEC72356490C64B4B0B9270DA32B9(tmp, il2cpp_codegen_string_new_wrapper("\x55\x6E\x69\x74\x79\x2E\x49\x6E\x74\x65\x67\x72\x61\x74\x69\x6F\x6E\x54\x65\x73\x74\x73\x2E\x55\x6E\x69\x74\x79\x41\x6E\x61\x6C\x79\x74\x69\x63\x73"), NULL);
}
{
InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C * tmp = (InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C *)cache->attributes[90];
InternalsVisibleToAttribute__ctor_m420071A75DCEEC72356490C64B4B0B9270DA32B9(tmp, il2cpp_codegen_string_new_wrapper("\x55\x6E\x69\x74\x79\x2E\x49\x6E\x74\x65\x72\x6E\x61\x6C\x41\x50\x49\x45\x6E\x67\x69\x6E\x65\x42\x72\x69\x64\x67\x65\x2E\x30\x31\x34"), NULL);
}
{
InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C * tmp = (InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C *)cache->attributes[91];
InternalsVisibleToAttribute__ctor_m420071A75DCEEC72356490C64B4B0B9270DA32B9(tmp, il2cpp_codegen_string_new_wrapper("\x55\x6E\x69\x74\x79\x2E\x44\x65\x70\x6C\x6F\x79\x6D\x65\x6E\x74\x54\x65\x73\x74\x73\x2E\x53\x65\x72\x76\x69\x63\x65\x73"), NULL);
}
{
InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C * tmp = (InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C *)cache->attributes[92];
InternalsVisibleToAttribute__ctor_m420071A75DCEEC72356490C64B4B0B9270DA32B9(tmp, il2cpp_codegen_string_new_wrapper("\x55\x6E\x69\x74\x79\x2E\x42\x75\x72\x73\x74\x2E\x45\x64\x69\x74\x6F\x72"), NULL);
}
{
InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C * tmp = (InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C *)cache->attributes[93];
InternalsVisibleToAttribute__ctor_m420071A75DCEEC72356490C64B4B0B9270DA32B9(tmp, il2cpp_codegen_string_new_wrapper("\x55\x6E\x69\x74\x79\x2E\x42\x75\x72\x73\x74"), NULL);
}
{
InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C * tmp = (InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C *)cache->attributes[94];
InternalsVisibleToAttribute__ctor_m420071A75DCEEC72356490C64B4B0B9270DA32B9(tmp, il2cpp_codegen_string_new_wrapper("\x55\x6E\x69\x74\x79\x2E\x41\x75\x74\x6F\x6D\x61\x74\x69\x6F\x6E"), NULL);
}
{
InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C * tmp = (InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C *)cache->attributes[95];
InternalsVisibleToAttribute__ctor_m420071A75DCEEC72356490C64B4B0B9270DA32B9(tmp, il2cpp_codegen_string_new_wrapper("\x55\x6E\x69\x74\x79\x45\x6E\x67\x69\x6E\x65\x2E\x54\x65\x73\x74\x52\x75\x6E\x6E\x65\x72"), NULL);
}
{
InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C * tmp = (InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C *)cache->attributes[96];
InternalsVisibleToAttribute__ctor_m420071A75DCEEC72356490C64B4B0B9270DA32B9(tmp, il2cpp_codegen_string_new_wrapper("\x55\x6E\x69\x74\x79\x45\x6E\x67\x69\x6E\x65\x2E\x50\x75\x72\x63\x68\x61\x73\x69\x6E\x67"), NULL);
}
{
InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C * tmp = (InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C *)cache->attributes[97];
InternalsVisibleToAttribute__ctor_m420071A75DCEEC72356490C64B4B0B9270DA32B9(tmp, il2cpp_codegen_string_new_wrapper("\x55\x6E\x69\x74\x79\x45\x6E\x67\x69\x6E\x65\x2E\x41\x64\x76\x65\x72\x74\x69\x73\x65\x6D\x65\x6E\x74\x73"), NULL);
}
{
InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C * tmp = (InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C *)cache->attributes[98];
InternalsVisibleToAttribute__ctor_m420071A75DCEEC72356490C64B4B0B9270DA32B9(tmp, il2cpp_codegen_string_new_wrapper("\x55\x6E\x69\x74\x79\x45\x6E\x67\x69\x6E\x65\x2E\x41\x6E\x61\x6C\x79\x74\x69\x63\x73"), NULL);
}
{
InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C * tmp = (InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C *)cache->attributes[99];
InternalsVisibleToAttribute__ctor_m420071A75DCEEC72356490C64B4B0B9270DA32B9(tmp, il2cpp_codegen_string_new_wrapper("\x55\x6E\x69\x74\x79\x2E\x41\x6E\x61\x6C\x79\x74\x69\x63\x73"), NULL);
}
{
InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C * tmp = (InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C *)cache->attributes[100];
InternalsVisibleToAttribute__ctor_m420071A75DCEEC72356490C64B4B0B9270DA32B9(tmp, il2cpp_codegen_string_new_wrapper("\x55\x6E\x69\x74\x79\x45\x6E\x67\x69\x6E\x65\x2E\x43\x6C\x6F\x75\x64\x2E\x53\x65\x72\x76\x69\x63\x65"), NULL);
}
{
InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C * tmp = (InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C *)cache->attributes[101];
InternalsVisibleToAttribute__ctor_m420071A75DCEEC72356490C64B4B0B9270DA32B9(tmp, il2cpp_codegen_string_new_wrapper("\x55\x6E\x69\x74\x79\x45\x6E\x67\x69\x6E\x65\x2E\x43\x6C\x6F\x75\x64"), NULL);
}
{
InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C * tmp = (InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C *)cache->attributes[102];
InternalsVisibleToAttribute__ctor_m420071A75DCEEC72356490C64B4B0B9270DA32B9(tmp, il2cpp_codegen_string_new_wrapper("\x55\x6E\x69\x74\x79\x45\x6E\x67\x69\x6E\x65\x2E\x4E\x65\x74\x77\x6F\x72\x6B\x69\x6E\x67"), NULL);
}
{
InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C * tmp = (InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C *)cache->attributes[103];
InternalsVisibleToAttribute__ctor_m420071A75DCEEC72356490C64B4B0B9270DA32B9(tmp, il2cpp_codegen_string_new_wrapper("\x55\x6E\x69\x74\x79\x45\x6E\x67\x69\x6E\x65\x2E\x50\x53\x35\x56\x52\x4D\x6F\x64\x75\x6C\x65"), NULL);
}
{
InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C * tmp = (InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C *)cache->attributes[104];
InternalsVisibleToAttribute__ctor_m420071A75DCEEC72356490C64B4B0B9270DA32B9(tmp, il2cpp_codegen_string_new_wrapper("\x55\x6E\x69\x74\x79\x45\x6E\x67\x69\x6E\x65\x2E\x50\x53\x35\x4D\x6F\x64\x75\x6C\x65"), NULL);
}
{
InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C * tmp = (InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C *)cache->attributes[105];
InternalsVisibleToAttribute__ctor_m420071A75DCEEC72356490C64B4B0B9270DA32B9(tmp, il2cpp_codegen_string_new_wrapper("\x55\x6E\x69\x74\x79\x45\x6E\x67\x69\x6E\x65\x2E\x50\x53\x34\x56\x52\x4D\x6F\x64\x75\x6C\x65"), NULL);
}
{
InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C * tmp = (InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C *)cache->attributes[106];
InternalsVisibleToAttribute__ctor_m420071A75DCEEC72356490C64B4B0B9270DA32B9(tmp, il2cpp_codegen_string_new_wrapper("\x55\x6E\x69\x74\x79\x45\x6E\x67\x69\x6E\x65\x2E\x50\x53\x34\x4D\x6F\x64\x75\x6C\x65"), NULL);
}
{
InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C * tmp = (InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C *)cache->attributes[107];
InternalsVisibleToAttribute__ctor_m420071A75DCEEC72356490C64B4B0B9270DA32B9(tmp, il2cpp_codegen_string_new_wrapper("\x55\x6E\x69\x74\x79\x45\x6E\x67\x69\x6E\x65\x2E\x58\x62\x6F\x78\x4F\x6E\x65\x4D\x6F\x64\x75\x6C\x65"), NULL);
}
{
InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C * tmp = (InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C *)cache->attributes[108];
InternalsVisibleToAttribute__ctor_m420071A75DCEEC72356490C64B4B0B9270DA32B9(tmp, il2cpp_codegen_string_new_wrapper("\x55\x6E\x69\x74\x79\x45\x6E\x67\x69\x6E\x65\x2E\x53\x77\x69\x74\x63\x68\x4D\x6F\x64\x75\x6C\x65"), NULL);
}
{
InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C * tmp = (InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C *)cache->attributes[109];
InternalsVisibleToAttribute__ctor_m420071A75DCEEC72356490C64B4B0B9270DA32B9(tmp, il2cpp_codegen_string_new_wrapper("\x55\x6E\x69\x74\x79\x45\x6E\x67\x69\x6E\x65\x2E\x56\x52\x4D\x6F\x64\x75\x6C\x65"), NULL);
}
{
InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C * tmp = (InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C *)cache->attributes[110];
InternalsVisibleToAttribute__ctor_m420071A75DCEEC72356490C64B4B0B9270DA32B9(tmp, il2cpp_codegen_string_new_wrapper("\x55\x6E\x69\x74\x79\x45\x6E\x67\x69\x6E\x65\x2E\x55\x6D\x62\x72\x61\x4D\x6F\x64\x75\x6C\x65"), NULL);
}
{
InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C * tmp = (InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C *)cache->attributes[111];
InternalsVisibleToAttribute__ctor_m420071A75DCEEC72356490C64B4B0B9270DA32B9(tmp, il2cpp_codegen_string_new_wrapper("\x55\x6E\x69\x74\x79\x45\x6E\x67\x69\x6E\x65\x2E\x55\x6E\x69\x74\x79\x43\x6F\x6E\x6E\x65\x63\x74\x4D\x6F\x64\x75\x6C\x65"), NULL);
}
{
InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C * tmp = (InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C *)cache->attributes[112];
InternalsVisibleToAttribute__ctor_m420071A75DCEEC72356490C64B4B0B9270DA32B9(tmp, il2cpp_codegen_string_new_wrapper("\x55\x6E\x69\x74\x79\x2E\x49\x6E\x74\x65\x67\x72\x61\x74\x69\x6F\x6E\x54\x65\x73\x74\x73"), NULL);
}
{
InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C * tmp = (InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C *)cache->attributes[113];
InternalsVisibleToAttribute__ctor_m420071A75DCEEC72356490C64B4B0B9270DA32B9(tmp, il2cpp_codegen_string_new_wrapper("\x55\x6E\x69\x74\x79\x45\x6E\x67\x69\x6E\x65\x2E\x55\x6E\x69\x74\x79\x54\x65\x73\x74\x50\x72\x6F\x74\x6F\x63\x6F\x6C\x4D\x6F\x64\x75\x6C\x65"), NULL);
}
{
InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C * tmp = (InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C *)cache->attributes[114];
InternalsVisibleToAttribute__ctor_m420071A75DCEEC72356490C64B4B0B9270DA32B9(tmp, il2cpp_codegen_string_new_wrapper("\x55\x6E\x69\x74\x79\x2E\x49\x6E\x74\x65\x72\x6E\x61\x6C\x41\x50\x49\x45\x6E\x67\x69\x6E\x65\x42\x72\x69\x64\x67\x65\x2E\x30\x31\x32"), NULL);
}
{
InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C * tmp = (InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C *)cache->attributes[115];
InternalsVisibleToAttribute__ctor_m420071A75DCEEC72356490C64B4B0B9270DA32B9(tmp, il2cpp_codegen_string_new_wrapper("\x55\x6E\x69\x74\x79\x2E\x49\x6E\x74\x65\x72\x6E\x61\x6C\x41\x50\x49\x45\x6E\x67\x69\x6E\x65\x42\x72\x69\x64\x67\x65\x2E\x30\x31\x31"), NULL);
}
{
InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C * tmp = (InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C *)cache->attributes[116];
InternalsVisibleToAttribute__ctor_m420071A75DCEEC72356490C64B4B0B9270DA32B9(tmp, il2cpp_codegen_string_new_wrapper("\x55\x6E\x69\x74\x79\x2E\x49\x6E\x74\x65\x72\x6E\x61\x6C\x41\x50\x49\x45\x6E\x67\x69\x6E\x65\x42\x72\x69\x64\x67\x65\x2E\x30\x31\x30"), NULL);
}
{
InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C * tmp = (InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C *)cache->attributes[117];
InternalsVisibleToAttribute__ctor_m420071A75DCEEC72356490C64B4B0B9270DA32B9(tmp, il2cpp_codegen_string_new_wrapper("\x55\x6E\x69\x74\x79\x2E\x49\x6E\x74\x65\x72\x6E\x61\x6C\x41\x50\x49\x45\x6E\x67\x69\x6E\x65\x42\x72\x69\x64\x67\x65\x2E\x30\x30\x39"), NULL);
}
{
InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C * tmp = (InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C *)cache->attributes[118];
InternalsVisibleToAttribute__ctor_m420071A75DCEEC72356490C64B4B0B9270DA32B9(tmp, il2cpp_codegen_string_new_wrapper("\x55\x6E\x69\x74\x79\x45\x6E\x67\x69\x6E\x65\x2E\x55\x6E\x69\x74\x79\x43\x75\x72\x6C\x4D\x6F\x64\x75\x6C\x65"), NULL);
}
{
InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C * tmp = (InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C *)cache->attributes[119];
InternalsVisibleToAttribute__ctor_m420071A75DCEEC72356490C64B4B0B9270DA32B9(tmp, il2cpp_codegen_string_new_wrapper("\x55\x6E\x69\x74\x79\x2E\x50\x65\x72\x66\x6F\x72\x6D\x61\x6E\x63\x65\x54\x65\x73\x74\x73\x2E\x52\x75\x6E\x74\x69\x6D\x65\x54\x65\x73\x74\x52\x75\x6E\x6E\x65\x72\x2E\x54\x65\x73\x74\x73"), NULL);
}
{
InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C * tmp = (InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C *)cache->attributes[120];
InternalsVisibleToAttribute__ctor_m420071A75DCEEC72356490C64B4B0B9270DA32B9(tmp, il2cpp_codegen_string_new_wrapper("\x55\x6E\x69\x74\x79\x2E\x52\x75\x6E\x74\x69\x6D\x65\x54\x65\x73\x74\x73\x2E\x46\x72\x61\x6D\x65\x77\x6F\x72\x6B\x2E\x54\x65\x73\x74\x73"), NULL);
}
{
InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C * tmp = (InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C *)cache->attributes[121];
InternalsVisibleToAttribute__ctor_m420071A75DCEEC72356490C64B4B0B9270DA32B9(tmp, il2cpp_codegen_string_new_wrapper("\x55\x6E\x69\x74\x79\x2E\x52\x75\x6E\x74\x69\x6D\x65\x54\x65\x73\x74\x73\x2E\x46\x72\x61\x6D\x65\x77\x6F\x72\x6B"), NULL);
}
{
InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C * tmp = (InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C *)cache->attributes[122];
InternalsVisibleToAttribute__ctor_m420071A75DCEEC72356490C64B4B0B9270DA32B9(tmp, il2cpp_codegen_string_new_wrapper("\x55\x6E\x69\x74\x79\x45\x6E\x67\x69\x6E\x65\x2E\x43\x72\x61\x73\x68\x52\x65\x70\x6F\x72\x74\x69\x6E\x67\x4D\x6F\x64\x75\x6C\x65"), NULL);
}
{
InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C * tmp = (InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C *)cache->attributes[123];
InternalsVisibleToAttribute__ctor_m420071A75DCEEC72356490C64B4B0B9270DA32B9(tmp, il2cpp_codegen_string_new_wrapper("\x55\x6E\x69\x74\x79\x45\x6E\x67\x69\x6E\x65\x2E\x55\x6E\x69\x74\x79\x57\x65\x62\x52\x65\x71\x75\x65\x73\x74\x57\x57\x57\x4D\x6F\x64\x75\x6C\x65"), NULL);
}
{
InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C * tmp = (InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C *)cache->attributes[124];
InternalsVisibleToAttribute__ctor_m420071A75DCEEC72356490C64B4B0B9270DA32B9(tmp, il2cpp_codegen_string_new_wrapper("\x55\x6E\x69\x74\x79\x45\x6E\x67\x69\x6E\x65\x2E\x55\x6E\x69\x74\x79\x57\x65\x62\x52\x65\x71\x75\x65\x73\x74\x41\x73\x73\x65\x74\x42\x75\x6E\x64\x6C\x65\x4D\x6F\x64\x75\x6C\x65"), NULL);
}
{
InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C * tmp = (InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C *)cache->attributes[125];
InternalsVisibleToAttribute__ctor_m420071A75DCEEC72356490C64B4B0B9270DA32B9(tmp, il2cpp_codegen_string_new_wrapper("\x55\x6E\x69\x74\x79\x45\x6E\x67\x69\x6E\x65\x2E\x55\x6E\x69\x74\x79\x41\x6E\x61\x6C\x79\x74\x69\x63\x73\x4D\x6F\x64\x75\x6C\x65"), NULL);
}
{
InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C * tmp = (InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C *)cache->attributes[126];
InternalsVisibleToAttribute__ctor_m420071A75DCEEC72356490C64B4B0B9270DA32B9(tmp, il2cpp_codegen_string_new_wrapper("\x55\x6E\x69\x74\x79\x45\x6E\x67\x69\x6E\x65\x2E\x55\x4E\x45\x54\x4D\x6F\x64\x75\x6C\x65"), NULL);
}
{
InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C * tmp = (InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C *)cache->attributes[127];
InternalsVisibleToAttribute__ctor_m420071A75DCEEC72356490C64B4B0B9270DA32B9(tmp, il2cpp_codegen_string_new_wrapper("\x55\x6E\x69\x74\x79\x45\x6E\x67\x69\x6E\x65\x2E\x55\x49\x45\x6C\x65\x6D\x65\x6E\x74\x73\x4E\x61\x74\x69\x76\x65\x4D\x6F\x64\x75\x6C\x65"), NULL);
}
{
InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C * tmp = (InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C *)cache->attributes[128];
InternalsVisibleToAttribute__ctor_m420071A75DCEEC72356490C64B4B0B9270DA32B9(tmp, il2cpp_codegen_string_new_wrapper("\x55\x6E\x69\x74\x79\x2E\x49\x6E\x74\x65\x72\x6E\x61\x6C\x41\x50\x49\x45\x6E\x67\x69\x6E\x65\x42\x72\x69\x64\x67\x65\x2E\x30\x30\x38"), NULL);
}
{
InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C * tmp = (InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C *)cache->attributes[129];
InternalsVisibleToAttribute__ctor_m420071A75DCEEC72356490C64B4B0B9270DA32B9(tmp, il2cpp_codegen_string_new_wrapper("\x55\x6E\x69\x74\x79\x45\x6E\x67\x69\x6E\x65\x2E\x49\x6E\x70\x75\x74\x4D\x6F\x64\x75\x6C\x65"), NULL);
}
{
InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C * tmp = (InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C *)cache->attributes[130];
InternalsVisibleToAttribute__ctor_m420071A75DCEEC72356490C64B4B0B9270DA32B9(tmp, il2cpp_codegen_string_new_wrapper("\x55\x6E\x69\x74\x79\x45\x6E\x67\x69\x6E\x65\x2E\x49\x4D\x47\x55\x49\x4D\x6F\x64\x75\x6C\x65"), NULL);
}
{
InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C * tmp = (InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C *)cache->attributes[131];
InternalsVisibleToAttribute__ctor_m420071A75DCEEC72356490C64B4B0B9270DA32B9(tmp, il2cpp_codegen_string_new_wrapper("\x55\x6E\x69\x74\x79\x45\x6E\x67\x69\x6E\x65\x2E\x47\x61\x6D\x65\x43\x65\x6E\x74\x65\x72\x4D\x6F\x64\x75\x6C\x65"), NULL);
}
{
InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C * tmp = (InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C *)cache->attributes[132];
InternalsVisibleToAttribute__ctor_m420071A75DCEEC72356490C64B4B0B9270DA32B9(tmp, il2cpp_codegen_string_new_wrapper("\x55\x6E\x69\x74\x79\x45\x6E\x67\x69\x6E\x65\x2E\x43\x6C\x6F\x74\x68\x4D\x6F\x64\x75\x6C\x65"), NULL);
}
{
InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C * tmp = (InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C *)cache->attributes[133];
InternalsVisibleToAttribute__ctor_m420071A75DCEEC72356490C64B4B0B9270DA32B9(tmp, il2cpp_codegen_string_new_wrapper("\x55\x6E\x69\x74\x79\x45\x6E\x67\x69\x6E\x65\x2E\x41\x73\x73\x65\x74\x42\x75\x6E\x64\x6C\x65\x4D\x6F\x64\x75\x6C\x65"), NULL);
}
{
InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C * tmp = (InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C *)cache->attributes[134];
InternalsVisibleToAttribute__ctor_m420071A75DCEEC72356490C64B4B0B9270DA32B9(tmp, il2cpp_codegen_string_new_wrapper("\x55\x6E\x69\x74\x79\x45\x6E\x67\x69\x6E\x65\x2E\x57\x65\x62\x47\x4C\x4D\x6F\x64\x75\x6C\x65"), NULL);
}
{
InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C * tmp = (InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C *)cache->attributes[135];
InternalsVisibleToAttribute__ctor_m420071A75DCEEC72356490C64B4B0B9270DA32B9(tmp, il2cpp_codegen_string_new_wrapper("\x55\x6E\x69\x74\x79\x45\x6E\x67\x69\x6E\x65\x2E\x57\x69\x6E\x64\x4D\x6F\x64\x75\x6C\x65"), NULL);
}
{
InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C * tmp = (InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C *)cache->attributes[136];
InternalsVisibleToAttribute__ctor_m420071A75DCEEC72356490C64B4B0B9270DA32B9(tmp, il2cpp_codegen_string_new_wrapper("\x55\x6E\x69\x74\x79\x45\x6E\x67\x69\x6E\x65\x2E\x56\x69\x64\x65\x6F\x4D\x6F\x64\x75\x6C\x65"), NULL);
}
{
InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C * tmp = (InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C *)cache->attributes[137];
InternalsVisibleToAttribute__ctor_m420071A75DCEEC72356490C64B4B0B9270DA32B9(tmp, il2cpp_codegen_string_new_wrapper("\x55\x6E\x69\x74\x79\x45\x6E\x67\x69\x6E\x65\x2E\x56\x65\x68\x69\x63\x6C\x65\x73\x4D\x6F\x64\x75\x6C\x65"), NULL);
}
{
InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C * tmp = (InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C *)cache->attributes[138];
InternalsVisibleToAttribute__ctor_m420071A75DCEEC72356490C64B4B0B9270DA32B9(tmp, il2cpp_codegen_string_new_wrapper("\x55\x6E\x69\x74\x79\x45\x6E\x67\x69\x6E\x65\x2E\x56\x46\x58\x4D\x6F\x64\x75\x6C\x65"), NULL);
}
{
InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C * tmp = (InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C *)cache->attributes[139];
InternalsVisibleToAttribute__ctor_m420071A75DCEEC72356490C64B4B0B9270DA32B9(tmp, il2cpp_codegen_string_new_wrapper("\x55\x6E\x69\x74\x79\x45\x6E\x67\x69\x6E\x65\x2E\x55\x6E\x69\x74\x79\x57\x65\x62\x52\x65\x71\x75\x65\x73\x74\x54\x65\x78\x74\x75\x72\x65\x4D\x6F\x64\x75\x6C\x65"), NULL);
}
{
InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C * tmp = (InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C *)cache->attributes[140];
InternalsVisibleToAttribute__ctor_m420071A75DCEEC72356490C64B4B0B9270DA32B9(tmp, il2cpp_codegen_string_new_wrapper("\x55\x6E\x69\x74\x79\x45\x6E\x67\x69\x6E\x65\x2E\x55\x6E\x69\x74\x79\x57\x65\x62\x52\x65\x71\x75\x65\x73\x74\x41\x75\x64\x69\x6F\x4D\x6F\x64\x75\x6C\x65"), NULL);
}
{
InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C * tmp = (InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C *)cache->attributes[141];
InternalsVisibleToAttribute__ctor_m420071A75DCEEC72356490C64B4B0B9270DA32B9(tmp, il2cpp_codegen_string_new_wrapper("\x55\x6E\x69\x74\x79\x45\x6E\x67\x69\x6E\x65\x2E\x55\x6E\x69\x74\x79\x57\x65\x62\x52\x65\x71\x75\x65\x73\x74\x4D\x6F\x64\x75\x6C\x65"), NULL);
}
{
InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C * tmp = (InternalsVisibleToAttribute_t1D9772A02892BAC440952F880A43C257E6C3E68C *)cache->attributes[142];
InternalsVisibleToAttribute__ctor_m420071A75DCEEC72356490C64B4B0B9270DA32B9(tmp, il2cpp_codegen_string_new_wrapper("\x55\x6E\x69\x74\x79\x45\x6E\x67\x69\x6E\x65\x2E\x54\x65\x78\x74\x43\x6F\x72\x65\x4D\x6F\x64\x75\x6C\x65"), NULL);
}
}
static void Touch_tDEFED247540BCFA4AD452F1D37EEF4E09B4ACD8C_CustomAttributesCacheGenerator(CustomAttributesCache* cache)
{
{
NativeHeaderAttribute_t7F0E4B53790AA75CDB4C44E6D644267F8FE3066C * tmp = (NativeHeaderAttribute_t7F0E4B53790AA75CDB4C44E6D644267F8FE3066C *)cache->attributes[0];
NativeHeaderAttribute__ctor_m0E83F29C5939F185D6E90541591802EB2845FD76(tmp, il2cpp_codegen_string_new_wrapper("\x52\x75\x6E\x74\x69\x6D\x65\x2F\x49\x6E\x70\x75\x74\x2F\x49\x6E\x70\x75\x74\x42\x69\x6E\x64\x69\x6E\x67\x73\x2E\x68"), NULL);
}
}
static void CameraRaycastHelper_t2EB434C1BA2F4B7011FE16E77A471188901F1913_CustomAttributesCacheGenerator(CustomAttributesCache* cache)
{
{
NativeHeaderAttribute_t7F0E4B53790AA75CDB4C44E6D644267F8FE3066C * tmp = (NativeHeaderAttribute_t7F0E4B53790AA75CDB4C44E6D644267F8FE3066C *)cache->attributes[0];
NativeHeaderAttribute__ctor_m0E83F29C5939F185D6E90541591802EB2845FD76(tmp, il2cpp_codegen_string_new_wrapper("\x52\x75\x6E\x74\x69\x6D\x65\x2F\x43\x61\x6D\x65\x72\x61\x2F\x43\x61\x6D\x65\x72\x61\x2E\x68"), NULL);
}
}
static void CameraRaycastHelper_t2EB434C1BA2F4B7011FE16E77A471188901F1913_CustomAttributesCacheGenerator_CameraRaycastHelper_RaycastTry_m8AA2714ED46E79851C77B83A3916C515D7280FD1(CustomAttributesCache* cache)
{
{
FreeFunctionAttribute_tBB3B939D760190FEC84762F1BA94B99672613D03 * tmp = (FreeFunctionAttribute_tBB3B939D760190FEC84762F1BA94B99672613D03 *)cache->attributes[0];
FreeFunctionAttribute__ctor_mE37D1E356F51A379B44C570574608DC3E49E0DB0(tmp, il2cpp_codegen_string_new_wrapper("\x43\x61\x6D\x65\x72\x61\x53\x63\x72\x69\x70\x74\x69\x6E\x67\x3A\x3A\x52\x61\x79\x63\x61\x73\x74\x54\x72\x79"), NULL);
}
}
static void CameraRaycastHelper_t2EB434C1BA2F4B7011FE16E77A471188901F1913_CustomAttributesCacheGenerator_CameraRaycastHelper_RaycastTry2D_mAA0B0BAC7BE8A2F640A236BB6655EB47E5408C9D(CustomAttributesCache* cache)
{
{
FreeFunctionAttribute_tBB3B939D760190FEC84762F1BA94B99672613D03 * tmp = (FreeFunctionAttribute_tBB3B939D760190FEC84762F1BA94B99672613D03 *)cache->attributes[0];
FreeFunctionAttribute__ctor_mE37D1E356F51A379B44C570574608DC3E49E0DB0(tmp, il2cpp_codegen_string_new_wrapper("\x43\x61\x6D\x65\x72\x61\x53\x63\x72\x69\x70\x74\x69\x6E\x67\x3A\x3A\x52\x61\x79\x63\x61\x73\x74\x54\x72\x79\x32\x44"), NULL);
}
}
static void Input_t763D9CAB93E5035D6CE4D185D9B64D7F3F47202A_CustomAttributesCacheGenerator(CustomAttributesCache* cache)
{
{
NativeHeaderAttribute_t7F0E4B53790AA75CDB4C44E6D644267F8FE3066C * tmp = (NativeHeaderAttribute_t7F0E4B53790AA75CDB4C44E6D644267F8FE3066C *)cache->attributes[0];
NativeHeaderAttribute__ctor_m0E83F29C5939F185D6E90541591802EB2845FD76(tmp, il2cpp_codegen_string_new_wrapper("\x52\x75\x6E\x74\x69\x6D\x65\x2F\x49\x6E\x70\x75\x74\x2F\x49\x6E\x70\x75\x74\x42\x69\x6E\x64\x69\x6E\x67\x73\x2E\x68"), NULL);
}
}
static void Input_t763D9CAB93E5035D6CE4D185D9B64D7F3F47202A_CustomAttributesCacheGenerator_Input_GetKeyString_mDD80ED27B61F349398E3C955DA99A21562298B03(CustomAttributesCache* cache)
{
{
NativeThrowsAttribute_tF59F2833BDD09C6C89298E603D5C3A598CC08137 * tmp = (NativeThrowsAttribute_tF59F2833BDD09C6C89298E603D5C3A598CC08137 *)cache->attributes[0];
NativeThrowsAttribute__ctor_m7FD0B7887043A2A47C39D7029EF5B8C713E08751(tmp, NULL);
}
}
static void Input_t763D9CAB93E5035D6CE4D185D9B64D7F3F47202A_CustomAttributesCacheGenerator_Input_GetKeyDownInt_mEAC027107792507CA7F0B1DFBEA4E6289CDCCCBA(CustomAttributesCache* cache)
{
{
NativeThrowsAttribute_tF59F2833BDD09C6C89298E603D5C3A598CC08137 * tmp = (NativeThrowsAttribute_tF59F2833BDD09C6C89298E603D5C3A598CC08137 *)cache->attributes[0];
NativeThrowsAttribute__ctor_m7FD0B7887043A2A47C39D7029EF5B8C713E08751(tmp, NULL);
}
}
static void Input_t763D9CAB93E5035D6CE4D185D9B64D7F3F47202A_CustomAttributesCacheGenerator_Input_GetAxisRaw_mC07AC23FD8D04A69CDB07C6399C93FFFAEB0FC5B(CustomAttributesCache* cache)
{
{
NativeThrowsAttribute_tF59F2833BDD09C6C89298E603D5C3A598CC08137 * tmp = (NativeThrowsAttribute_tF59F2833BDD09C6C89298E603D5C3A598CC08137 *)cache->attributes[0];
NativeThrowsAttribute__ctor_m7FD0B7887043A2A47C39D7029EF5B8C713E08751(tmp, NULL);
}
}
static void Input_t763D9CAB93E5035D6CE4D185D9B64D7F3F47202A_CustomAttributesCacheGenerator_Input_GetButtonDown_m2001112EBCA3D5C7B0344EF62C896667F7E67DDF(CustomAttributesCache* cache)
{
{
NativeThrowsAttribute_tF59F2833BDD09C6C89298E603D5C3A598CC08137 * tmp = (NativeThrowsAttribute_tF59F2833BDD09C6C89298E603D5C3A598CC08137 *)cache->attributes[0];
NativeThrowsAttribute__ctor_m7FD0B7887043A2A47C39D7029EF5B8C713E08751(tmp, NULL);
}
}
static void Input_t763D9CAB93E5035D6CE4D185D9B64D7F3F47202A_CustomAttributesCacheGenerator_Input_GetMouseButton_m27BF2DDBF38A38787B83A13D3E6F0F88F7C834C1(CustomAttributesCache* cache)
{
{
NativeThrowsAttribute_tF59F2833BDD09C6C89298E603D5C3A598CC08137 * tmp = (NativeThrowsAttribute_tF59F2833BDD09C6C89298E603D5C3A598CC08137 *)cache->attributes[0];
NativeThrowsAttribute__ctor_m7FD0B7887043A2A47C39D7029EF5B8C713E08751(tmp, NULL);
}
}
static void Input_t763D9CAB93E5035D6CE4D185D9B64D7F3F47202A_CustomAttributesCacheGenerator_Input_GetMouseButtonDown_m466D81FDCC87C9CB07557B39DCB435EB691F1EF3(CustomAttributesCache* cache)
{
{
NativeThrowsAttribute_tF59F2833BDD09C6C89298E603D5C3A598CC08137 * tmp = (NativeThrowsAttribute_tF59F2833BDD09C6C89298E603D5C3A598CC08137 *)cache->attributes[0];
NativeThrowsAttribute__ctor_m7FD0B7887043A2A47C39D7029EF5B8C713E08751(tmp, NULL);
}
}
static void Input_t763D9CAB93E5035D6CE4D185D9B64D7F3F47202A_CustomAttributesCacheGenerator_Input_GetMouseButtonUp_m2BA562F8C4FE8364EEC93970093E776371DF4022(CustomAttributesCache* cache)
{
{
NativeThrowsAttribute_tF59F2833BDD09C6C89298E603D5C3A598CC08137 * tmp = (NativeThrowsAttribute_tF59F2833BDD09C6C89298E603D5C3A598CC08137 *)cache->attributes[0];
NativeThrowsAttribute__ctor_m7FD0B7887043A2A47C39D7029EF5B8C713E08751(tmp, NULL);
}
}
static void Input_t763D9CAB93E5035D6CE4D185D9B64D7F3F47202A_CustomAttributesCacheGenerator_Input_GetTouch_m6A2A31482B1A7D018C3AAC188C02F5D14500C81F(CustomAttributesCache* cache)
{
{
NativeThrowsAttribute_tF59F2833BDD09C6C89298E603D5C3A598CC08137 * tmp = (NativeThrowsAttribute_tF59F2833BDD09C6C89298E603D5C3A598CC08137 *)cache->attributes[0];
NativeThrowsAttribute__ctor_m7FD0B7887043A2A47C39D7029EF5B8C713E08751(tmp, NULL);
}
}
static void Input_t763D9CAB93E5035D6CE4D185D9B64D7F3F47202A_CustomAttributesCacheGenerator_Input_get_mousePresent_mBCACCE1C97E146FF46C7AE7FFE693F7BAB4E4FE5(CustomAttributesCache* cache)
{
{
FreeFunctionAttribute_tBB3B939D760190FEC84762F1BA94B99672613D03 * tmp = (FreeFunctionAttribute_tBB3B939D760190FEC84762F1BA94B99672613D03 *)cache->attributes[0];
FreeFunctionAttribute__ctor_mE37D1E356F51A379B44C570574608DC3E49E0DB0(tmp, il2cpp_codegen_string_new_wrapper("\x47\x65\x74\x4D\x6F\x75\x73\x65\x50\x72\x65\x73\x65\x6E\x74"), NULL);
}
}
static void Input_t763D9CAB93E5035D6CE4D185D9B64D7F3F47202A_CustomAttributesCacheGenerator_Input_get_touchCount_mE1A06AB1973E3456AE398B3CC5105F27CC7335D6(CustomAttributesCache* cache)
{
{
FreeFunctionAttribute_tBB3B939D760190FEC84762F1BA94B99672613D03 * tmp = (FreeFunctionAttribute_tBB3B939D760190FEC84762F1BA94B99672613D03 *)cache->attributes[0];
FreeFunctionAttribute__ctor_mE37D1E356F51A379B44C570574608DC3E49E0DB0(tmp, il2cpp_codegen_string_new_wrapper("\x47\x65\x74\x54\x6F\x75\x63\x68\x43\x6F\x75\x6E\x74"), NULL);
}
}
static void Input_t763D9CAB93E5035D6CE4D185D9B64D7F3F47202A_CustomAttributesCacheGenerator_Input_get_touchSupported_mE5B2F5199B4CC16D89AD2C3125B5CB38F4B4867B(CustomAttributesCache* cache)
{
{
FreeFunctionAttribute_tBB3B939D760190FEC84762F1BA94B99672613D03 * tmp = (FreeFunctionAttribute_tBB3B939D760190FEC84762F1BA94B99672613D03 *)cache->attributes[0];
FreeFunctionAttribute__ctor_mE37D1E356F51A379B44C570574608DC3E49E0DB0(tmp, il2cpp_codegen_string_new_wrapper("\x49\x73\x54\x6F\x75\x63\x68\x53\x75\x70\x70\x6F\x72\x74\x65\x64"), NULL);
}
}
static void Input_t763D9CAB93E5035D6CE4D185D9B64D7F3F47202A_CustomAttributesCacheGenerator_Input_t763D9CAB93E5035D6CE4D185D9B64D7F3F47202A____mousePosition_PropertyInfo(CustomAttributesCache* cache)
{
{
NativeThrowsAttribute_tF59F2833BDD09C6C89298E603D5C3A598CC08137 * tmp = (NativeThrowsAttribute_tF59F2833BDD09C6C89298E603D5C3A598CC08137 *)cache->attributes[0];
NativeThrowsAttribute__ctor_m7FD0B7887043A2A47C39D7029EF5B8C713E08751(tmp, NULL);
}
}
static void Input_t763D9CAB93E5035D6CE4D185D9B64D7F3F47202A_CustomAttributesCacheGenerator_Input_t763D9CAB93E5035D6CE4D185D9B64D7F3F47202A____mouseScrollDelta_PropertyInfo(CustomAttributesCache* cache)
{
{
NativeThrowsAttribute_tF59F2833BDD09C6C89298E603D5C3A598CC08137 * tmp = (NativeThrowsAttribute_tF59F2833BDD09C6C89298E603D5C3A598CC08137 *)cache->attributes[0];
NativeThrowsAttribute__ctor_m7FD0B7887043A2A47C39D7029EF5B8C713E08751(tmp, NULL);
}
}
static void SendMouseEvents_tCF069F9DE53C8E51B7AF505FC52F79DB84D81437_CustomAttributesCacheGenerator_SendMouseEvents_SetMouseMoved_mEC659144183FB490A2E1F12112C8F08569A511CD(CustomAttributesCache* cache)
{
{
RequiredByNativeCodeAttribute_t855401D3C2EF3B44F4F1C3EE2DCD361CFC358D20 * tmp = (RequiredByNativeCodeAttribute_t855401D3C2EF3B44F4F1C3EE2DCD361CFC358D20 *)cache->attributes[0];
RequiredByNativeCodeAttribute__ctor_m97C095D1EE6AAB2894AE7E8B2F07D9B47CB8F8B5(tmp, NULL);
}
}
static void SendMouseEvents_tCF069F9DE53C8E51B7AF505FC52F79DB84D81437_CustomAttributesCacheGenerator_SendMouseEvents_DoSendMouseEvents_m21561D473C27F19BA9CDBC53B4A13D40DDFBE785(CustomAttributesCache* cache)
{
{
RequiredByNativeCodeAttribute_t855401D3C2EF3B44F4F1C3EE2DCD361CFC358D20 * tmp = (RequiredByNativeCodeAttribute_t855401D3C2EF3B44F4F1C3EE2DCD361CFC358D20 *)cache->attributes[0];
RequiredByNativeCodeAttribute__ctor_m97C095D1EE6AAB2894AE7E8B2F07D9B47CB8F8B5(tmp, NULL);
}
}
IL2CPP_EXTERN_C const CustomAttributesCacheGenerator g_UnityEngine_InputLegacyModule_AttributeGenerators[];
const CustomAttributesCacheGenerator g_UnityEngine_InputLegacyModule_AttributeGenerators[21] =
{
Touch_tDEFED247540BCFA4AD452F1D37EEF4E09B4ACD8C_CustomAttributesCacheGenerator,
CameraRaycastHelper_t2EB434C1BA2F4B7011FE16E77A471188901F1913_CustomAttributesCacheGenerator,
Input_t763D9CAB93E5035D6CE4D185D9B64D7F3F47202A_CustomAttributesCacheGenerator,
CameraRaycastHelper_t2EB434C1BA2F4B7011FE16E77A471188901F1913_CustomAttributesCacheGenerator_CameraRaycastHelper_RaycastTry_m8AA2714ED46E79851C77B83A3916C515D7280FD1,
CameraRaycastHelper_t2EB434C1BA2F4B7011FE16E77A471188901F1913_CustomAttributesCacheGenerator_CameraRaycastHelper_RaycastTry2D_mAA0B0BAC7BE8A2F640A236BB6655EB47E5408C9D,
Input_t763D9CAB93E5035D6CE4D185D9B64D7F3F47202A_CustomAttributesCacheGenerator_Input_GetKeyString_mDD80ED27B61F349398E3C955DA99A21562298B03,
Input_t763D9CAB93E5035D6CE4D185D9B64D7F3F47202A_CustomAttributesCacheGenerator_Input_GetKeyDownInt_mEAC027107792507CA7F0B1DFBEA4E6289CDCCCBA,
Input_t763D9CAB93E5035D6CE4D185D9B64D7F3F47202A_CustomAttributesCacheGenerator_Input_GetAxisRaw_mC07AC23FD8D04A69CDB07C6399C93FFFAEB0FC5B,
Input_t763D9CAB93E5035D6CE4D185D9B64D7F3F47202A_CustomAttributesCacheGenerator_Input_GetButtonDown_m2001112EBCA3D5C7B0344EF62C896667F7E67DDF,
Input_t763D9CAB93E5035D6CE4D185D9B64D7F3F47202A_CustomAttributesCacheGenerator_Input_GetMouseButton_m27BF2DDBF38A38787B83A13D3E6F0F88F7C834C1,
Input_t763D9CAB93E5035D6CE4D185D9B64D7F3F47202A_CustomAttributesCacheGenerator_Input_GetMouseButtonDown_m466D81FDCC87C9CB07557B39DCB435EB691F1EF3,
Input_t763D9CAB93E5035D6CE4D185D9B64D7F3F47202A_CustomAttributesCacheGenerator_Input_GetMouseButtonUp_m2BA562F8C4FE8364EEC93970093E776371DF4022,
Input_t763D9CAB93E5035D6CE4D185D9B64D7F3F47202A_CustomAttributesCacheGenerator_Input_GetTouch_m6A2A31482B1A7D018C3AAC188C02F5D14500C81F,
Input_t763D9CAB93E5035D6CE4D185D9B64D7F3F47202A_CustomAttributesCacheGenerator_Input_get_mousePresent_mBCACCE1C97E146FF46C7AE7FFE693F7BAB4E4FE5,
Input_t763D9CAB93E5035D6CE4D185D9B64D7F3F47202A_CustomAttributesCacheGenerator_Input_get_touchCount_mE1A06AB1973E3456AE398B3CC5105F27CC7335D6,
Input_t763D9CAB93E5035D6CE4D185D9B64D7F3F47202A_CustomAttributesCacheGenerator_Input_get_touchSupported_mE5B2F5199B4CC16D89AD2C3125B5CB38F4B4867B,
SendMouseEvents_tCF069F9DE53C8E51B7AF505FC52F79DB84D81437_CustomAttributesCacheGenerator_SendMouseEvents_SetMouseMoved_mEC659144183FB490A2E1F12112C8F08569A511CD,
SendMouseEvents_tCF069F9DE53C8E51B7AF505FC52F79DB84D81437_CustomAttributesCacheGenerator_SendMouseEvents_DoSendMouseEvents_m21561D473C27F19BA9CDBC53B4A13D40DDFBE785,
Input_t763D9CAB93E5035D6CE4D185D9B64D7F3F47202A_CustomAttributesCacheGenerator_Input_t763D9CAB93E5035D6CE4D185D9B64D7F3F47202A____mousePosition_PropertyInfo,
Input_t763D9CAB93E5035D6CE4D185D9B64D7F3F47202A_CustomAttributesCacheGenerator_Input_t763D9CAB93E5035D6CE4D185D9B64D7F3F47202A____mouseScrollDelta_PropertyInfo,
UnityEngine_InputLegacyModule_CustomAttributesCacheGenerator,
};
IL2CPP_MANAGED_FORCE_INLINE IL2CPP_METHOD_ATTR void RuntimeCompatibilityAttribute_set_WrapNonExceptionThrows_m8562196F90F3EBCEC23B5708EE0332842883C490_inline (RuntimeCompatibilityAttribute_tFF99AB2963098F9CBCD47A20D9FD3D51C17C1C80 * __this, bool ___value0, const RuntimeMethod* method)
{
{
bool L_0 = ___value0;
__this->set_m_wrapNonExceptionThrows_0(L_0);
return;
}
}
| [
"57153670+makkomise@users.noreply.github.com"
] | 57153670+makkomise@users.noreply.github.com |
adaf559d56e8b5b85f59ea2d00b1d3eb98c574f3 | a4e8e1438955b84b72e005818ce4b659aae6237d | /libsnark/src/update/main.cpp | a3d36686fa280e48a19e08df5c0a1da46a6fb277 | [
"MIT"
] | permissive | Wells-yuan/mds | c1f412195b3e979cf73913f96a2cbaf60c216d84 | e4ee9df52cae8c27b875361fa4e01dee047114db | refs/heads/main | 2023-05-31T19:30:20.767601 | 2021-06-09T12:48:59 | 2021-06-09T12:48:59 | 373,026,063 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 7,245 | cpp | #include <stdio.h>
#include <iostream>
#include <boost/optional.hpp>
#include <boost/foreach.hpp>
#include <boost/format.hpp>
#include "libsnark/zk_proof_systems/ppzksnark/r1cs_gg_ppzksnark/r1cs_gg_ppzksnark.hpp"
#include "libsnark/common/default_types/r1cs_gg_ppzksnark_pp.hpp"
#include <libsnark/gadgetlib1/gadgets/hashes/sha256/sha256_gadget.hpp>
#include<sys/time.h>
#include "deps/sha256.h"
#include "uint256.h"
#include "util.h"
using namespace libsnark;
using namespace libff;
using namespace std;
#include "circuit/gadget.tcc"
#define DEBUG 0
// 生成proof
template <typename ppzksnark_ppT>
boost::optional<r1cs_gg_ppzksnark_proof<ppzksnark_ppT>> generate_update_proof(r1cs_gg_ppzksnark_proving_key<ppzksnark_ppT> proving_key,
uint256 id,
uint256 cmtU1,
uint256 cmtU2,
uint256 henc,
uint256 auth,
uint256 pkB,
uint256 pkD,
uint256 sk,
uint256 ek,
uint256 r
)
{
typedef Fr<ppzksnark_ppT> FieldT;
protoboard<FieldT> pb;
update_gadget<FieldT> g(pb); // 构造新模型
g.generate_r1cs_constraints(); // 生成约束
g.generate_r1cs_witness(id, cmtU1, cmtU2, henc, auth, pkB, pkD, sk, ek, r); // 为新模型的参数生成证明
if (!pb.is_satisfied())
{ // 三元组R1CS是否满足 < A , X > * < B , X > = < C , X >
cout << "can not generate update proof" << endl;
return r1cs_gg_ppzksnark_proof<ppzksnark_ppT>();
}
// 调用libsnark库中生成proof的函数
return r1cs_gg_ppzksnark_prover<ppzksnark_ppT>(proving_key, pb.primary_input(), pb.auxiliary_input());
}
// 验证proof
template <typename ppzksnark_ppT>
bool verify_update_proof(r1cs_gg_ppzksnark_verification_key<ppzksnark_ppT> verification_key,
r1cs_gg_ppzksnark_proof<ppzksnark_ppT> proof,
uint256& id,
uint256& cmtU1,
uint256& cmtU2,
uint256& henc,
uint256& auth)
{
typedef Fr<ppzksnark_ppT> FieldT;
const r1cs_primary_input<FieldT> input = update_gadget<FieldT>::witness_map(
id,
cmtU1,
cmtU2,
henc,
auth);
// 调用libsnark库中验证proof的函数
return r1cs_gg_ppzksnark_verifier_strong_IC<ppzksnark_ppT>(verification_key, input, proof);
}
template<typename ppzksnark_ppT>
r1cs_gg_ppzksnark_keypair<ppzksnark_ppT> Setup() {
default_r1cs_gg_ppzksnark_pp::init_public_params();
typedef libff::Fr<ppzksnark_ppT> FieldT;
protoboard<FieldT> pb;
update_gadget<FieldT> update(pb);
update.generate_r1cs_constraints();// 生成约束
// check conatraints
const r1cs_constraint_system<FieldT> constraint_system = pb.get_constraint_system();
std::cout << "Number of R1CS constraints: " << constraint_system.num_constraints() << endl;
// key pair generation
r1cs_gg_ppzksnark_keypair<ppzksnark_ppT> keypair = r1cs_gg_ppzksnark_generator<ppzksnark_ppT>(constraint_system);
return keypair;
}
template<typename ppzksnark_ppT> //--Agzs
bool test_update_gadget_with_instance(r1cs_gg_ppzksnark_keypair<ppzksnark_ppT> keypair)
{
uint256 id = uint256S("11111Abcd");
uint256 pkB = uint256S("22222Ba");
uint256 pkD = uint256S("09cd53");
uint256 sk = uint256S("9c0a334");
uint256 r = uint256S("123456");
uint256 ek = Compute_PRF(sk, r);
CSHA256 hasher;
uint256 cmtU1;
hasher.Write(id.begin(), 32);
hasher.Write(pkB.begin(), 32);
hasher.Write(ek.begin(), 32);
hasher.Write(r.begin(), 32);
hasher.Finalize(cmtU1.begin());
CSHA256 hasher1;
uint256 cmtU2;
hasher1.Write(id.begin(), 32);
hasher1.Write(pkD.begin(), 32);
hasher1.Write(ek.begin(), 32);
hasher1.Write(r.begin(), 32);
hasher1.Finalize(cmtU2.begin());
uint256 aux = uint256S("654321");
uint256 henc;
CSHA256 hasher2;
hasher2.Write(aux.begin(), 32);
hasher2.Finalize(henc.begin());
uint256 auth = Compute_PRF(sk, henc);
// 生成proof
cout << "Trying to generate proof..." << endl;
struct timeval gen_start, gen_end;
double updateTimeUse;
gettimeofday(&gen_start,NULL);
auto proof = generate_update_proof<default_r1cs_gg_ppzksnark_pp>(keypair.pk,
id,
cmtU1,
cmtU2,
henc,
auth,
pkB,
pkD,
sk,
ek,
r);
gettimeofday(&gen_end, NULL);
updateTimeUse = gen_end.tv_sec - gen_start.tv_sec + (gen_end.tv_usec - gen_start.tv_usec)/1000000.0;
printf("\n\nGen Update Proof Use Time:%fs\n\n", updateTimeUse);
// verify proof
if (!proof) {
printf("generate update proof fail!!!\n");
return false;
} else {
struct timeval ver_start, ver_end;
double updateVerTimeUse;
gettimeofday(&ver_start, NULL);
bool result = verify_update_proof(keypair.vk,
*proof,
id,
cmtU1,
cmtU2,
henc,
auth
);
gettimeofday(&ver_end, NULL);
updateVerTimeUse = ver_end.tv_sec - ver_start.tv_sec + (ver_end.tv_usec - ver_start.tv_usec)/1000000.0;
printf("\n\nVer Update Proof Use Time:%fs\n\n", updateVerTimeUse);
if (!result){
cout << "Verifying update proof unsuccessfully!!!" << endl;
} else {
cout << "Verifying update proof successfully!!!" << endl;
}
return result;
}
}
int main () {
struct timeval t1, t2;
double timeuse;
gettimeofday(&t1,NULL);
r1cs_gg_ppzksnark_keypair<default_r1cs_gg_ppzksnark_pp> keypair = Setup<default_r1cs_gg_ppzksnark_pp>();
gettimeofday(&t2,NULL);
timeuse = t2.tv_sec - t1.tv_sec + (t2.tv_usec - t1.tv_usec)/1000000.0;
printf("\n\nUpdate Setup Time Usage:%fs\n\n",timeuse);
libff::print_header("# testing update gadget");
test_update_gadget_with_instance<default_r1cs_gg_ppzksnark_pp>(keypair);
return 0;
}
| [
"yuan9418@live.com"
] | yuan9418@live.com |
db935ca26dd3ea6e0e4a0a49b8ea1ce224505913 | 6a2b4d2299949863c8c7470900353869974ad1b0 | /QLauncher/socket.cpp | 1ec196005691c158450334f5e144c4641e7bca9f | [] | no_license | whwpdn/QLauncher | 94aebb889ed75d764fea63b659d1169552f26378 | fec53d0193edbbeab554268f3cdccc34e64b800b | refs/heads/master | 2020-04-08T06:54:05.314368 | 2014-05-07T09:09:46 | 2014-05-07T09:09:46 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 11,667 | cpp | ////////////////////////////////////////////////////////////////////////////////////////
//
// Socket
// Copyright (C) 2000 Thierry Tremblay
//
// http://frogengine.net-connect.net/
//
////////////////////////////////////////////////////////////////////////////////////////
//#include "stdafx.h"
#include "socket.h"
#include "internet.h"
#include <cassert>
////////////////////////////////////////////////////////////////////////////////////////
//
// Automatically link the proper library
//
////////////////////////////////////////////////////////////////////////////////////////
#ifdef _MSC_VER
#if WINSOCK_VERSION == 1
#pragma comment( lib, "wsock32" )
#elif WINSOCK_VERSION == 2
#pragma comment( lib, "ws2_32" );
#endif
#endif
////////////////////////////////////////////////////////////////////////////////////////
//
// NetworkAddress - This is an interface to a socket address
//
////////////////////////////////////////////////////////////////////////////////////////
bool NetworkAddress::operator==( const NetworkAddress& other ) const
{
int size = GetSize();
if (size != other.GetSize())
return false;
return memcmp( *this, other, size ) == 0;
}
bool NetworkAddress::operator!=( const NetworkAddress& other ) const
{
int size = GetSize();
if (size != other.GetSize())
return true;
return memcmp(*this, other, size) != 0;
}
////////////////////////////////////////////////////////////////////////////////////////
//
// Socket
//
////////////////////////////////////////////////////////////////////////////////////////
bool Socket::s_bInitialized = false;
Socket::Socket( int iAddressFamily, int type, int protocol ) :
m_socket(INVALID_SOCKET),
m_lastError(0),
m_addressFamily(iAddressFamily),
m_recvTimeout(-1),
m_sendTimeout(-1),
m_pLocalAddress(0),
m_pRemoteAddress(0)//,
//m_pIStream(0),
//m_pOStream(0),
//m_pIOStream(0)
{
if (!s_bInitialized)
{
WSADATA data;
WORD version;
#if WINSOCK_VERSION == 1
version = MAKEWORD(1,1);
#elif WINSOCK_VERSION == 2
version = MAKEWORD(2,2);
#endif
m_lastError = WSAStartup( version, &data );
if (m_lastError == 0)
s_bInitialized = true;
}
if (m_lastError == 0)
{
m_socket = socket( iAddressFamily, type, protocol );
if (m_socket == INVALID_SOCKET)
{
m_lastError = WSAGetLastError();
}
}
}
Socket::Socket( SOCKET socket )
: m_socket(socket),
m_lastError(0),
m_addressFamily(AF_UNSPEC),
m_recvTimeout(-1),
m_sendTimeout(-1),
m_pLocalAddress(0),
m_pRemoteAddress(0)
{
// Discover address family
BYTE address[1024];
int lenAddress = sizeof(address);
if (getsockname( m_socket, (sockaddr*)address, &lenAddress ) == SOCKET_ERROR)
{
m_lastError = WSAGetLastError();
}
else
{
m_addressFamily = ((SOCKADDR*)address)->sa_family;
}
}
Socket::~Socket()
{
if (m_socket != INVALID_SOCKET)
Close();
if (m_pLocalAddress)
delete m_pLocalAddress;
if (m_pRemoteAddress)
delete m_pRemoteAddress;
}
bool Socket::Accept( Socket** ppSocket, NetworkAddress* pAddress ) const
{
SOCKET socket;
if (pAddress)
{
assert( pAddress->GetFamily() == m_addressFamily );
int size = pAddress->GetSize();
socket = accept( m_socket, *pAddress, &size );
}
else
{
socket = accept( m_socket, 0, 0 );
}
if (socket == INVALID_SOCKET)
{
*ppSocket = 0;
m_lastError = WSAGetLastError();
return false;
}
*ppSocket = new Socket( socket );
return true;
}
bool Socket::Bind( const NetworkAddress& address ) const
{
if (bind( m_socket, address, address.GetSize() ) == SOCKET_ERROR)
{
m_lastError = WSAGetLastError();
return false;
}
return true;
}
bool Socket::Close()
{
if (closesocket(m_socket) == SOCKET_ERROR)
{
m_lastError = WSAGetLastError();
return false;
}
m_socket = INVALID_SOCKET;
return true;
}
bool Socket::Connect( const NetworkAddress& address ) const
{
if (connect( m_socket, address, address.GetSize() ) == SOCKET_ERROR)
{
m_lastError = WSAGetLastError();
return false;
}
return true;
}
NetworkAddress* Socket::CreateAddress() const
{
if (m_addressFamily == AF_INET)
return new InternetAddress();
// Unsupported address family
assert(0);
return 0;
}
/*
std::istream& Socket::GetInputStream()
{
if (m_pIStream==0)
{
m_pIStream = new ISocketStream( *this );
if (m_pOStream)
m_pIStream->tie( m_pOStream );
}
return *m_pIStream;
}
std::ostream& Socket::GetOutputStream()
{
if (m_pOStream==0)
{
m_pOStream = new OSocketStream( *this );
if (m_pIStream)
m_pIStream->tie( m_pOStream );
}
return *m_pOStream;
}
std::iostream& Socket::GetIOStream()
{
if (m_pIOStream==0)
{
m_pIOStream = new IOSocketStream( *this );
}
return *m_pIOStream;
}
*/
const NetworkAddress& Socket::GetLocalAddress() const
{
if (m_pLocalAddress==0)
m_pLocalAddress = CreateAddress();
int lenAddress = m_pLocalAddress->GetSize();
if (getsockname( m_socket, m_pLocalAddress->GetSockAddr(), &lenAddress ) == SOCKET_ERROR)
{
m_lastError = WSAGetLastError();
}
return *m_pLocalAddress;
}
const NetworkAddress& Socket::GetRemoteAddress() const
{
if (m_pRemoteAddress==0)
m_pRemoteAddress = CreateAddress();
int lenAddress = m_pRemoteAddress->GetSize();
if (getpeername( m_socket, m_pRemoteAddress->GetSockAddr(), &lenAddress ) == SOCKET_ERROR)
{
m_lastError = WSAGetLastError();
}
return *m_pRemoteAddress;
}
bool Socket::IsExceptionPending( int sec, int usec ) const
{
fd_set fds;
FD_ZERO( &fds );
FD_SET( m_socket, &fds );
timeval tv;
tv.tv_sec = sec;
tv.tv_usec = usec;
int result = select( m_socket+1, 0, 0, &fds, &tv );
if (result == 0 || result == SOCKET_ERROR)
{
m_lastError = WSAGetLastError();
return false;
}
return true;
}
long
Socket::GetReadyBytes()
{
unsigned long len = 0;
int r = ::ioctlsocket(m_socket, FIONREAD, & len);
if (r != 0) {
//nvThrow nvIOException("socketAvailableBytes");
m_lastError = WSAGetLastError();
return -1;
}
return len;
}
bool Socket::IsReadReady( int sec, int usec ) const
{
/*
unsigned long len;
int r = ioctlsocket(m_socket, FIONREAD, & len);
if (r < 0) {
// ERROR
}
return len > 0;
*/
fd_set fds;
FD_ZERO( &fds );
FD_SET( m_socket, &fds );
timeval tv;
tv.tv_sec = sec;
tv.tv_usec = usec;
int result = select( m_socket+1, &fds, 0, 0, &tv );
if (result == 0 || result == SOCKET_ERROR)
{
m_lastError = WSAGetLastError();
return false;
}
return true;
}
bool Socket::IsWriteReady( int sec, int usec ) const
{
fd_set fds;
FD_ZERO( &fds );
FD_SET( m_socket, &fds );
timeval tv;
tv.tv_sec = sec;
tv.tv_usec = usec;
int result = select( m_socket+1, 0, &fds, 0, &tv );
if (result == 0 || result == SOCKET_ERROR)
{
m_lastError = WSAGetLastError();
return false;
}
return true;
}
bool Socket::Listen( int queueSize ) const
{
if (listen( m_socket, queueSize ) == SOCKET_ERROR)
{
m_lastError = WSAGetLastError();
return false;
}
return true;
}
int Socket::Receive( char* pBuffer, int lenBuffer, int flags ) const
{
if (m_recvTimeout >= 0 && !IsReadReady( m_recvTimeout ))
return 0;
int nbRecv = recv( m_socket, pBuffer, lenBuffer, flags );
if (nbRecv == SOCKET_ERROR)
{
int error = WSAGetLastError();
if (error == WSAEMSGSIZE)
return lenBuffer;
m_lastError = error;
return 0;
}
return nbRecv;
}
int Socket::ReceiveFrom( char* pBuffer, int lenBuffer, NetworkAddress& address, int flags ) const
{
if (m_recvTimeout >= 0 && !IsReadReady( m_recvTimeout ))
return 0;
assert( address.GetFamily() == m_addressFamily );
int addressSize = address.GetSize();
int nbRecv = recvfrom( m_socket, pBuffer, lenBuffer, flags, address, &addressSize );
if (nbRecv == SOCKET_ERROR)
{
int error = WSAGetLastError();
if (error == WSAEMSGSIZE)
return lenBuffer;
m_lastError = error;
return 0;
}
return nbRecv;
}
int Socket::ReceiveFrom( char* pBuffer, int lenBuffer, int flags ) const
{
if (m_recvTimeout >= 0 && !IsReadReady( m_recvTimeout ))
return 0;
//assert( address.GetFamily() == m_addressFamily );
//int addressSize = address.GetSize();
int nbRecv = recvfrom( m_socket, pBuffer, lenBuffer, flags, NULL, NULL);
if (nbRecv == SOCKET_ERROR)
{
int error = WSAGetLastError();
if (error == WSAEMSGSIZE)
return lenBuffer;
m_lastError = error;
return 0;
}
return nbRecv;
}
int Socket::Send( const char* pBuffer, int lenBuffer, int flags ) const
{
if (m_sendTimeout >= 0 && !IsWriteReady( m_sendTimeout ))
return 0;
int nbSent = send( m_socket, pBuffer, lenBuffer, flags );
if (nbSent == SOCKET_ERROR)
{
m_lastError = WSAGetLastError();
return 0;
}
return nbSent;
}
int Socket::SendTo( const char* pBuffer, int lenBuffer, const NetworkAddress& address, int flags ) const
{
if (m_sendTimeout >= 0 && !IsWriteReady( m_sendTimeout ))
return 0;
int nbSent = sendto( m_socket, pBuffer, lenBuffer, flags, address, address.GetSize() );
if (nbSent == SOCKET_ERROR)
{
m_lastError = WSAGetLastError();
return 0;
}
return nbSent;
}
bool Socket::SetBlocking( bool bBlocking )
{
ULONG param = bBlocking ? 0 : 1;
if (ioctlsocket( m_socket, FIONBIO, ¶m ) == SOCKET_ERROR)
{
m_lastError = WSAGetLastError();
return false;
}
return true;
}
/*
////////////////////////////////////////////////////////////////////////////////////////
//
// Socket::StreamBuffer
//
////////////////////////////////////////////////////////////////////////////////////////
Socket::StreamBuffer::StreamBuffer( Socket& socket )
: m_socket( socket )
{
char* pBeginInput = m_inputBuffer;
char* pEndInput = m_inputBuffer + sizeof(m_inputBuffer);
setg( pBeginInput, pEndInput, pEndInput );
setp( m_outputBuffer, m_outputBuffer + sizeof(m_outputBuffer) );
}
Socket::StreamBuffer::~StreamBuffer()
{
FlushOutput();
}
int Socket::StreamBuffer::FlushOutput()
{
// Return 0 if nothing to flush or success
// Return EOF if couldnt flush
if (pptr() < pbase())
return 0;
if (!m_socket.Send( pbase(), pptr() - pbase() ))
return EOF;
setp( m_outputBuffer, m_outputBuffer + sizeof(m_outputBuffer) );
return 0;
}
int Socket::StreamBuffer::overflow( int c )
{
if (c == EOF)
return FlushOutput();
*pptr() = c;
pbump(1);
if (c == '\n' || pptr() >= epptr())
{
if (FlushOutput() == EOF)
return EOF;
}
return c;
}
int Socket::StreamBuffer::sync()
{
return FlushOutput();
}
int Socket::StreamBuffer::underflow()
{
if (gptr() < egptr())
return *(unsigned char*)gptr();
int nbRead = m_socket.Receive( m_inputBuffer, sizeof(m_inputBuffer) );
if (nbRead == 0)
return EOF;
setg( eback(), eback(), eback() + nbRead );
return *(unsigned char*)gptr();
}
*/
int Socket::SetOption(int level, int optname, void *optval, int optlen)
{
return setsockopt(m_socket, level, optname, (const char FAR*) optval, optlen);
}
| [
"whwpdn@gmail.com"
] | whwpdn@gmail.com |
0c12efb16cd62963baf7e24cfda3ad83ce634519 | 087dbdf976328941ea89f7c6830406dc8e539bb2 | /02 Yellow/Week 03/Lessons/02 Yellow_Week 03_Lesson 04_synonyms.h | 8c980b8ab2f2396648379850ef26a7687874ea2a | [] | no_license | aliaksei-ivanou-by/Coursera_Yandex_c-plus-plus-modern-development | 45ff4e6e02dfa6b9f439174b3a4abf7d55801f6a | f7724dd60fff4c93e12124cfbd5392d8f74006b4 | refs/heads/master | 2023-03-20T10:31:25.555805 | 2021-03-03T18:18:25 | 2021-03-03T18:18:25 | 281,137,199 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 881 | h | // Основы разработки на C++: желтый пояс. Третья неделя
// Заголовочные файлы. Проблема двойного включения
#pragma once
#include <map>
#include <set>
#include <string>
using namespace std;
using Synonyms = map<string, set<string>>;
void AddSynonyms(Synonyms& synonyms, const string& first_word, const string& second_word)
{
// второе слово добавляем в список синонимов первого...
synonyms[second_word].insert(first_word);
// и наоборот
synonyms[first_word].insert(second_word);
}
size_t GetSynonymCount(Synonyms& synonyms, const string& first_word)
{
return synonyms[first_word].size();
}
bool AreSynonyms(Synonyms& synonyms, const string& first_word, const string& second_word)
{
return synonyms[first_word].count(second_word) == 1;
} | [
"aliaksei.ivanou.by@icloud.com"
] | aliaksei.ivanou.by@icloud.com |
92a893901d64229b931d74d11955deef5cd8fea0 | 8dc84558f0058d90dfc4955e905dab1b22d12c08 | /ash/system/message_center/arc/mock_arc_notification_surface.cc | a482667a46a89c0feb2ad077165ff68ea50f7f48 | [
"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 | 1,786 | cc | // Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "ash/system/message_center/arc/mock_arc_notification_surface.h"
#include "ui/aura/window.h"
namespace ash {
MockArcNotificationSurface::MockArcNotificationSurface(
const std::string& notification_key)
: notification_key_(notification_key),
ax_tree_id_(-1),
native_view_host_(nullptr),
window_(new aura::Window(nullptr)),
content_window_(new aura::Window(nullptr)) {
window_->Init(ui::LAYER_NOT_DRAWN);
content_window_->Init(ui::LAYER_NOT_DRAWN);
}
MockArcNotificationSurface::~MockArcNotificationSurface() = default;
gfx::Size MockArcNotificationSurface::GetSize() const {
return gfx::Size();
}
aura::Window* MockArcNotificationSurface::GetWindow() const {
return window_.get();
}
aura::Window* MockArcNotificationSurface::GetContentWindow() const {
return content_window_.get();
}
const std::string& MockArcNotificationSurface::GetNotificationKey() const {
return notification_key_;
}
void MockArcNotificationSurface::Attach(
views::NativeViewHost* native_view_host) {
native_view_host_ = native_view_host;
}
void MockArcNotificationSurface::Detach() {
native_view_host_ = nullptr;
}
bool MockArcNotificationSurface::IsAttached() const {
return native_view_host_ != nullptr;
}
views::NativeViewHost* MockArcNotificationSurface::GetAttachedHost() const {
return native_view_host_;
}
void MockArcNotificationSurface::FocusSurfaceWindow() {}
void MockArcNotificationSurface::SetAXTreeId(int32_t ax_tree_id) {
ax_tree_id_ = ax_tree_id;
}
int32_t MockArcNotificationSurface::GetAXTreeId() const {
return ax_tree_id_;
}
} // namespace ash
| [
"arnaud@geometry.ee"
] | arnaud@geometry.ee |
2e3cad2c444e161609e9576b7fed792999ed3fd7 | 8a9eee34d495195c6a8d57e1e51fbe06f84eb70e | /Include/dxgi.h | fafb161aa8e523f340fb743a1b5d5d31a5c13d32 | [] | no_license | wirlsawyer/SYWlan | 1558249e14d33c6c33743cc7036d0c094d96ffb9 | 8ba461b5ec19e0158c17ae1090abf6adb2287e08 | refs/heads/master | 2021-05-04T07:04:20.258767 | 2016-10-11T06:26:16 | 2016-10-11T06:26:16 | 70,550,473 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 55,086 | h |
/* this ALWAYS GENERATED file contains the definitions for the interfaces */
/* File created by MIDL compiler version 7.00.0499 */
/* Compiler settings for dxgi.idl:
Oicf, W1, Zp8, env=Win32 (32b run)
protocol : dce , ms_ext, c_ext, robust
error checks: allocation ref bounds_check enum stub_data
VC __declspec() decoration level:
__declspec(uuid()), __declspec(selectany), __declspec(novtable)
DECLSPEC_UUID(), MIDL_INTERFACE()
*/
//@@MIDL_FILE_HEADING( )
#pragma warning( disable: 4049 ) /* more than 64k source lines */
/* verify that the <rpcndr.h> version is high enough to compile this file*/
#ifndef __REQUIRED_RPCNDR_H_VERSION__
#define __REQUIRED_RPCNDR_H_VERSION__ 500
#endif
/* verify that the <rpcsal.h> version is high enough to compile this file*/
#ifndef __REQUIRED_RPCSAL_H_VERSION__
#define __REQUIRED_RPCSAL_H_VERSION__ 100
#endif
#include "rpc.h"
#include "rpcndr.h"
#ifndef __RPCNDR_H_VERSION__
#error this stub requires an updated version of <rpcndr.h>
#endif // __RPCNDR_H_VERSION__
#ifndef COM_NO_WINDOWS_H
#include "windows.h"
#include "ole2.h"
#endif /*COM_NO_WINDOWS_H*/
#ifndef __dxgi_h__
#define __dxgi_h__
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
#pragma once
#endif
/* Forward Declarations */
#ifndef __IDXGIObject_FWD_DEFINED__
#define __IDXGIObject_FWD_DEFINED__
typedef interface IDXGIObject IDXGIObject;
#endif /* __IDXGIObject_FWD_DEFINED__ */
#ifndef __IDXGIDeviceSubObject_FWD_DEFINED__
#define __IDXGIDeviceSubObject_FWD_DEFINED__
typedef interface IDXGIDeviceSubObject IDXGIDeviceSubObject;
#endif /* __IDXGIDeviceSubObject_FWD_DEFINED__ */
#ifndef __IDXGIResource_FWD_DEFINED__
#define __IDXGIResource_FWD_DEFINED__
typedef interface IDXGIResource IDXGIResource;
#endif /* __IDXGIResource_FWD_DEFINED__ */
#ifndef __IDXGISurface_FWD_DEFINED__
#define __IDXGISurface_FWD_DEFINED__
typedef interface IDXGISurface IDXGISurface;
#endif /* __IDXGISurface_FWD_DEFINED__ */
#ifndef __IDXGIAdapter_FWD_DEFINED__
#define __IDXGIAdapter_FWD_DEFINED__
typedef interface IDXGIAdapter IDXGIAdapter;
#endif /* __IDXGIAdapter_FWD_DEFINED__ */
#ifndef __IDXGIOutput_FWD_DEFINED__
#define __IDXGIOutput_FWD_DEFINED__
typedef interface IDXGIOutput IDXGIOutput;
#endif /* __IDXGIOutput_FWD_DEFINED__ */
#ifndef __IDXGISwapChain_FWD_DEFINED__
#define __IDXGISwapChain_FWD_DEFINED__
typedef interface IDXGISwapChain IDXGISwapChain;
#endif /* __IDXGISwapChain_FWD_DEFINED__ */
#ifndef __IDXGIFactory_FWD_DEFINED__
#define __IDXGIFactory_FWD_DEFINED__
typedef interface IDXGIFactory IDXGIFactory;
#endif /* __IDXGIFactory_FWD_DEFINED__ */
#ifndef __IDXGIDevice_FWD_DEFINED__
#define __IDXGIDevice_FWD_DEFINED__
typedef interface IDXGIDevice IDXGIDevice;
#endif /* __IDXGIDevice_FWD_DEFINED__ */
/* header files for imported files */
#include "dxgitype.h"
#ifdef __cplusplus
extern "C"{
#endif
/* interface __MIDL_itf_dxgi_0000_0000 */
/* [local] */
#define DXGI_CPU_ACCESS_NONE ( 0 )
#define DXGI_CPU_ACCESS_DYNAMIC ( 1 )
#define DXGI_CPU_ACCESS_READ_WRITE ( 2 )
#define DXGI_CPU_ACCESS_SCRATCH ( 3 )
#define DXGI_CPU_ACCESS_FIELD 15
#define DXGI_USAGE_SHADER_INPUT ( 1L << (0 + 4) )
#define DXGI_USAGE_RENDER_TARGET_OUTPUT ( 1L << (1 + 4) )
#define DXGI_USAGE_BACK_BUFFER ( 1L << (2 + 4) )
#define DXGI_USAGE_SHARED ( 1L << (3 + 4) )
#define DXGI_USAGE_READ_ONLY ( 1L << (4 + 4) )
typedef UINT DXGI_USAGE;
typedef struct DXGI_FRAME_STATISTICS
{
UINT PresentCount;
UINT PresentRefreshCount;
UINT SyncRefreshCount;
LARGE_INTEGER SyncQPCTime;
LARGE_INTEGER SyncGPUTime;
} DXGI_FRAME_STATISTICS;
typedef struct DXGI_MAPPED_RECT
{
INT Pitch;
BYTE *pBits;
} DXGI_MAPPED_RECT;
#ifdef __midl
typedef struct _LUID
{
DWORD LowPart;
LONG HighPart;
} LUID;
typedef struct _LUID *PLUID;
#endif
typedef struct DXGI_ADAPTER_DESC
{
WCHAR Description[ 128 ];
UINT VendorId;
UINT DeviceId;
UINT SubSysId;
UINT Revision;
SIZE_T DedicatedVideoMemory;
SIZE_T DedicatedSystemMemory;
SIZE_T SharedSystemMemory;
LUID AdapterLuid;
} DXGI_ADAPTER_DESC;
#if !defined(HMONITOR_DECLARED) && !defined(HMONITOR) && (WINVER < 0x0500)
#define HMONITOR_DECLARED
#if 0
typedef HANDLE HMONITOR;
#endif
DECLARE_HANDLE(HMONITOR);
#endif
typedef struct DXGI_OUTPUT_DESC
{
WCHAR DeviceName[ 32 ];
RECT DesktopCoordinates;
BOOL AttachedToDesktop;
DXGI_MODE_ROTATION Rotation;
HMONITOR Monitor;
} DXGI_OUTPUT_DESC;
typedef struct DXGI_SHARED_RESOURCE
{
HANDLE Handle;
} DXGI_SHARED_RESOURCE;
#define DXGI_RESOURCE_PRIORITY_MINIMUM ( 0x28000000 )
#define DXGI_RESOURCE_PRIORITY_LOW ( 0x50000000 )
#define DXGI_RESOURCE_PRIORITY_NORMAL ( 0x78000000 )
#define DXGI_RESOURCE_PRIORITY_HIGH ( 0xa0000000 )
#define DXGI_RESOURCE_PRIORITY_MAXIMUM ( 0xc8000000 )
typedef
enum DXGI_RESIDENCY
{ DXGI_RESIDENCY_FULLY_RESIDENT = 1,
DXGI_RESIDENCY_RESIDENT_IN_SHARED_MEMORY = 2,
DXGI_RESIDENCY_EVICTED_TO_DISK = 3
} DXGI_RESIDENCY;
typedef struct DXGI_SURFACE_DESC
{
UINT Width;
UINT Height;
DXGI_FORMAT Format;
DXGI_SAMPLE_DESC SampleDesc;
} DXGI_SURFACE_DESC;
typedef
enum DXGI_SWAP_EFFECT
{ DXGI_SWAP_EFFECT_DISCARD = 0,
DXGI_SWAP_EFFECT_SEQUENTIAL = 1
} DXGI_SWAP_EFFECT;
typedef
enum DXGI_SWAP_CHAIN_FLAG
{ DXGI_SWAP_CHAIN_FLAG_NONPREROTATED = 1,
DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH = 2
} DXGI_SWAP_CHAIN_FLAG;
typedef struct DXGI_SWAP_CHAIN_DESC
{
DXGI_MODE_DESC BufferDesc;
DXGI_SAMPLE_DESC SampleDesc;
DXGI_USAGE BufferUsage;
UINT BufferCount;
HWND OutputWindow;
BOOL Windowed;
DXGI_SWAP_EFFECT SwapEffect;
UINT Flags;
} DXGI_SWAP_CHAIN_DESC;
extern RPC_IF_HANDLE __MIDL_itf_dxgi_0000_0000_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_dxgi_0000_0000_v0_0_s_ifspec;
#ifndef __IDXGIObject_INTERFACE_DEFINED__
#define __IDXGIObject_INTERFACE_DEFINED__
/* interface IDXGIObject */
/* [unique][local][uuid][object] */
EXTERN_C const IID IID_IDXGIObject;
#if defined(__cplusplus) && !defined(CINTERFACE)
MIDL_INTERFACE("aec22fb8-76f3-4639-9be0-28eb43a67a2e")
IDXGIObject : public IUnknown
{
public:
virtual HRESULT STDMETHODCALLTYPE SetPrivateData(
/* [in] */ REFGUID Name,
/* [in] */ UINT DataSize,
/* [in] */ const void *pData) = 0;
virtual HRESULT STDMETHODCALLTYPE SetPrivateDataInterface(
/* [in] */ REFGUID Name,
/* [in] */ const IUnknown *pUnknown) = 0;
virtual HRESULT STDMETHODCALLTYPE GetPrivateData(
/* [in] */ REFGUID Name,
/* [out][in] */ UINT *pDataSize,
/* [out] */ void *pData) = 0;
virtual HRESULT STDMETHODCALLTYPE GetParent(
/* [in] */ REFIID riid,
/* [retval][out] */ void **ppParent) = 0;
};
#else /* C style interface */
typedef struct IDXGIObjectVtbl
{
BEGIN_INTERFACE
HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
IDXGIObject * This,
/* [in] */ REFIID riid,
/* [iid_is][out] */
__RPC__deref_out void **ppvObject);
ULONG ( STDMETHODCALLTYPE *AddRef )(
IDXGIObject * This);
ULONG ( STDMETHODCALLTYPE *Release )(
IDXGIObject * This);
HRESULT ( STDMETHODCALLTYPE *SetPrivateData )(
IDXGIObject * This,
/* [in] */ REFGUID Name,
/* [in] */ UINT DataSize,
/* [in] */ const void *pData);
HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )(
IDXGIObject * This,
/* [in] */ REFGUID Name,
/* [in] */ const IUnknown *pUnknown);
HRESULT ( STDMETHODCALLTYPE *GetPrivateData )(
IDXGIObject * This,
/* [in] */ REFGUID Name,
/* [out][in] */ UINT *pDataSize,
/* [out] */ void *pData);
HRESULT ( STDMETHODCALLTYPE *GetParent )(
IDXGIObject * This,
/* [in] */ REFIID riid,
/* [retval][out] */ void **ppParent);
END_INTERFACE
} IDXGIObjectVtbl;
interface IDXGIObject
{
CONST_VTBL struct IDXGIObjectVtbl *lpVtbl;
};
#ifdef COBJMACROS
#define IDXGIObject_QueryInterface(This,riid,ppvObject) \
( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) )
#define IDXGIObject_AddRef(This) \
( (This)->lpVtbl -> AddRef(This) )
#define IDXGIObject_Release(This) \
( (This)->lpVtbl -> Release(This) )
#define IDXGIObject_SetPrivateData(This,Name,DataSize,pData) \
( (This)->lpVtbl -> SetPrivateData(This,Name,DataSize,pData) )
#define IDXGIObject_SetPrivateDataInterface(This,Name,pUnknown) \
( (This)->lpVtbl -> SetPrivateDataInterface(This,Name,pUnknown) )
#define IDXGIObject_GetPrivateData(This,Name,pDataSize,pData) \
( (This)->lpVtbl -> GetPrivateData(This,Name,pDataSize,pData) )
#define IDXGIObject_GetParent(This,riid,ppParent) \
( (This)->lpVtbl -> GetParent(This,riid,ppParent) )
#endif /* COBJMACROS */
#endif /* C style interface */
#endif /* __IDXGIObject_INTERFACE_DEFINED__ */
#ifndef __IDXGIDeviceSubObject_INTERFACE_DEFINED__
#define __IDXGIDeviceSubObject_INTERFACE_DEFINED__
/* interface IDXGIDeviceSubObject */
/* [unique][local][uuid][object] */
EXTERN_C const IID IID_IDXGIDeviceSubObject;
#if defined(__cplusplus) && !defined(CINTERFACE)
MIDL_INTERFACE("3d3e0379-f9de-4d58-bb6c-18d62992f1a6")
IDXGIDeviceSubObject : public IDXGIObject
{
public:
virtual HRESULT STDMETHODCALLTYPE GetDevice(
/* [in] */ REFIID riid,
/* [retval][out] */ void **ppDevice) = 0;
};
#else /* C style interface */
typedef struct IDXGIDeviceSubObjectVtbl
{
BEGIN_INTERFACE
HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
IDXGIDeviceSubObject * This,
/* [in] */ REFIID riid,
/* [iid_is][out] */
__RPC__deref_out void **ppvObject);
ULONG ( STDMETHODCALLTYPE *AddRef )(
IDXGIDeviceSubObject * This);
ULONG ( STDMETHODCALLTYPE *Release )(
IDXGIDeviceSubObject * This);
HRESULT ( STDMETHODCALLTYPE *SetPrivateData )(
IDXGIDeviceSubObject * This,
/* [in] */ REFGUID Name,
/* [in] */ UINT DataSize,
/* [in] */ const void *pData);
HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )(
IDXGIDeviceSubObject * This,
/* [in] */ REFGUID Name,
/* [in] */ const IUnknown *pUnknown);
HRESULT ( STDMETHODCALLTYPE *GetPrivateData )(
IDXGIDeviceSubObject * This,
/* [in] */ REFGUID Name,
/* [out][in] */ UINT *pDataSize,
/* [out] */ void *pData);
HRESULT ( STDMETHODCALLTYPE *GetParent )(
IDXGIDeviceSubObject * This,
/* [in] */ REFIID riid,
/* [retval][out] */ void **ppParent);
HRESULT ( STDMETHODCALLTYPE *GetDevice )(
IDXGIDeviceSubObject * This,
/* [in] */ REFIID riid,
/* [retval][out] */ void **ppDevice);
END_INTERFACE
} IDXGIDeviceSubObjectVtbl;
interface IDXGIDeviceSubObject
{
CONST_VTBL struct IDXGIDeviceSubObjectVtbl *lpVtbl;
};
#ifdef COBJMACROS
#define IDXGIDeviceSubObject_QueryInterface(This,riid,ppvObject) \
( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) )
#define IDXGIDeviceSubObject_AddRef(This) \
( (This)->lpVtbl -> AddRef(This) )
#define IDXGIDeviceSubObject_Release(This) \
( (This)->lpVtbl -> Release(This) )
#define IDXGIDeviceSubObject_SetPrivateData(This,Name,DataSize,pData) \
( (This)->lpVtbl -> SetPrivateData(This,Name,DataSize,pData) )
#define IDXGIDeviceSubObject_SetPrivateDataInterface(This,Name,pUnknown) \
( (This)->lpVtbl -> SetPrivateDataInterface(This,Name,pUnknown) )
#define IDXGIDeviceSubObject_GetPrivateData(This,Name,pDataSize,pData) \
( (This)->lpVtbl -> GetPrivateData(This,Name,pDataSize,pData) )
#define IDXGIDeviceSubObject_GetParent(This,riid,ppParent) \
( (This)->lpVtbl -> GetParent(This,riid,ppParent) )
#define IDXGIDeviceSubObject_GetDevice(This,riid,ppDevice) \
( (This)->lpVtbl -> GetDevice(This,riid,ppDevice) )
#endif /* COBJMACROS */
#endif /* C style interface */
#endif /* __IDXGIDeviceSubObject_INTERFACE_DEFINED__ */
#ifndef __IDXGIResource_INTERFACE_DEFINED__
#define __IDXGIResource_INTERFACE_DEFINED__
/* interface IDXGIResource */
/* [unique][local][uuid][object] */
EXTERN_C const IID IID_IDXGIResource;
#if defined(__cplusplus) && !defined(CINTERFACE)
MIDL_INTERFACE("035f3ab4-482e-4e50-b41f-8a7f8bd8960b")
IDXGIResource : public IDXGIDeviceSubObject
{
public:
virtual HRESULT STDMETHODCALLTYPE GetSharedHandle(
/* [out] */ HANDLE *pSharedHandle) = 0;
virtual HRESULT STDMETHODCALLTYPE GetUsage(
/* [out] */ DXGI_USAGE *pUsage) = 0;
virtual HRESULT STDMETHODCALLTYPE SetEvictionPriority(
/* [in] */ UINT EvictionPriority) = 0;
virtual HRESULT STDMETHODCALLTYPE GetEvictionPriority(
/* [retval][out] */ UINT *pEvictionPriority) = 0;
};
#else /* C style interface */
typedef struct IDXGIResourceVtbl
{
BEGIN_INTERFACE
HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
IDXGIResource * This,
/* [in] */ REFIID riid,
/* [iid_is][out] */
__RPC__deref_out void **ppvObject);
ULONG ( STDMETHODCALLTYPE *AddRef )(
IDXGIResource * This);
ULONG ( STDMETHODCALLTYPE *Release )(
IDXGIResource * This);
HRESULT ( STDMETHODCALLTYPE *SetPrivateData )(
IDXGIResource * This,
/* [in] */ REFGUID Name,
/* [in] */ UINT DataSize,
/* [in] */ const void *pData);
HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )(
IDXGIResource * This,
/* [in] */ REFGUID Name,
/* [in] */ const IUnknown *pUnknown);
HRESULT ( STDMETHODCALLTYPE *GetPrivateData )(
IDXGIResource * This,
/* [in] */ REFGUID Name,
/* [out][in] */ UINT *pDataSize,
/* [out] */ void *pData);
HRESULT ( STDMETHODCALLTYPE *GetParent )(
IDXGIResource * This,
/* [in] */ REFIID riid,
/* [retval][out] */ void **ppParent);
HRESULT ( STDMETHODCALLTYPE *GetDevice )(
IDXGIResource * This,
/* [in] */ REFIID riid,
/* [retval][out] */ void **ppDevice);
HRESULT ( STDMETHODCALLTYPE *GetSharedHandle )(
IDXGIResource * This,
/* [out] */ HANDLE *pSharedHandle);
HRESULT ( STDMETHODCALLTYPE *GetUsage )(
IDXGIResource * This,
/* [out] */ DXGI_USAGE *pUsage);
HRESULT ( STDMETHODCALLTYPE *SetEvictionPriority )(
IDXGIResource * This,
/* [in] */ UINT EvictionPriority);
HRESULT ( STDMETHODCALLTYPE *GetEvictionPriority )(
IDXGIResource * This,
/* [retval][out] */ UINT *pEvictionPriority);
END_INTERFACE
} IDXGIResourceVtbl;
interface IDXGIResource
{
CONST_VTBL struct IDXGIResourceVtbl *lpVtbl;
};
#ifdef COBJMACROS
#define IDXGIResource_QueryInterface(This,riid,ppvObject) \
( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) )
#define IDXGIResource_AddRef(This) \
( (This)->lpVtbl -> AddRef(This) )
#define IDXGIResource_Release(This) \
( (This)->lpVtbl -> Release(This) )
#define IDXGIResource_SetPrivateData(This,Name,DataSize,pData) \
( (This)->lpVtbl -> SetPrivateData(This,Name,DataSize,pData) )
#define IDXGIResource_SetPrivateDataInterface(This,Name,pUnknown) \
( (This)->lpVtbl -> SetPrivateDataInterface(This,Name,pUnknown) )
#define IDXGIResource_GetPrivateData(This,Name,pDataSize,pData) \
( (This)->lpVtbl -> GetPrivateData(This,Name,pDataSize,pData) )
#define IDXGIResource_GetParent(This,riid,ppParent) \
( (This)->lpVtbl -> GetParent(This,riid,ppParent) )
#define IDXGIResource_GetDevice(This,riid,ppDevice) \
( (This)->lpVtbl -> GetDevice(This,riid,ppDevice) )
#define IDXGIResource_GetSharedHandle(This,pSharedHandle) \
( (This)->lpVtbl -> GetSharedHandle(This,pSharedHandle) )
#define IDXGIResource_GetUsage(This,pUsage) \
( (This)->lpVtbl -> GetUsage(This,pUsage) )
#define IDXGIResource_SetEvictionPriority(This,EvictionPriority) \
( (This)->lpVtbl -> SetEvictionPriority(This,EvictionPriority) )
#define IDXGIResource_GetEvictionPriority(This,pEvictionPriority) \
( (This)->lpVtbl -> GetEvictionPriority(This,pEvictionPriority) )
#endif /* COBJMACROS */
#endif /* C style interface */
#endif /* __IDXGIResource_INTERFACE_DEFINED__ */
/* interface __MIDL_itf_dxgi_0000_0003 */
/* [local] */
#define DXGI_MAP_READ ( 1UL )
#define DXGI_MAP_WRITE ( 2UL )
#define DXGI_MAP_DISCARD ( 4UL )
extern RPC_IF_HANDLE __MIDL_itf_dxgi_0000_0003_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_dxgi_0000_0003_v0_0_s_ifspec;
#ifndef __IDXGISurface_INTERFACE_DEFINED__
#define __IDXGISurface_INTERFACE_DEFINED__
/* interface IDXGISurface */
/* [unique][local][uuid][object] */
EXTERN_C const IID IID_IDXGISurface;
#if defined(__cplusplus) && !defined(CINTERFACE)
MIDL_INTERFACE("cafcb56c-6ac3-4889-bf47-9e23bbd260ec")
IDXGISurface : public IDXGIDeviceSubObject
{
public:
virtual HRESULT STDMETHODCALLTYPE GetDesc(
/* [out] */ DXGI_SURFACE_DESC *pDesc) = 0;
virtual HRESULT STDMETHODCALLTYPE Map(
/* [out] */ DXGI_MAPPED_RECT *pLockedRect,
/* [in] */ UINT MapFlags) = 0;
virtual HRESULT STDMETHODCALLTYPE Unmap( void) = 0;
};
#else /* C style interface */
typedef struct IDXGISurfaceVtbl
{
BEGIN_INTERFACE
HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
IDXGISurface * This,
/* [in] */ REFIID riid,
/* [iid_is][out] */
__RPC__deref_out void **ppvObject);
ULONG ( STDMETHODCALLTYPE *AddRef )(
IDXGISurface * This);
ULONG ( STDMETHODCALLTYPE *Release )(
IDXGISurface * This);
HRESULT ( STDMETHODCALLTYPE *SetPrivateData )(
IDXGISurface * This,
/* [in] */ REFGUID Name,
/* [in] */ UINT DataSize,
/* [in] */ const void *pData);
HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )(
IDXGISurface * This,
/* [in] */ REFGUID Name,
/* [in] */ const IUnknown *pUnknown);
HRESULT ( STDMETHODCALLTYPE *GetPrivateData )(
IDXGISurface * This,
/* [in] */ REFGUID Name,
/* [out][in] */ UINT *pDataSize,
/* [out] */ void *pData);
HRESULT ( STDMETHODCALLTYPE *GetParent )(
IDXGISurface * This,
/* [in] */ REFIID riid,
/* [retval][out] */ void **ppParent);
HRESULT ( STDMETHODCALLTYPE *GetDevice )(
IDXGISurface * This,
/* [in] */ REFIID riid,
/* [retval][out] */ void **ppDevice);
HRESULT ( STDMETHODCALLTYPE *GetDesc )(
IDXGISurface * This,
/* [out] */ DXGI_SURFACE_DESC *pDesc);
HRESULT ( STDMETHODCALLTYPE *Map )(
IDXGISurface * This,
/* [out] */ DXGI_MAPPED_RECT *pLockedRect,
/* [in] */ UINT MapFlags);
HRESULT ( STDMETHODCALLTYPE *Unmap )(
IDXGISurface * This);
END_INTERFACE
} IDXGISurfaceVtbl;
interface IDXGISurface
{
CONST_VTBL struct IDXGISurfaceVtbl *lpVtbl;
};
#ifdef COBJMACROS
#define IDXGISurface_QueryInterface(This,riid,ppvObject) \
( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) )
#define IDXGISurface_AddRef(This) \
( (This)->lpVtbl -> AddRef(This) )
#define IDXGISurface_Release(This) \
( (This)->lpVtbl -> Release(This) )
#define IDXGISurface_SetPrivateData(This,Name,DataSize,pData) \
( (This)->lpVtbl -> SetPrivateData(This,Name,DataSize,pData) )
#define IDXGISurface_SetPrivateDataInterface(This,Name,pUnknown) \
( (This)->lpVtbl -> SetPrivateDataInterface(This,Name,pUnknown) )
#define IDXGISurface_GetPrivateData(This,Name,pDataSize,pData) \
( (This)->lpVtbl -> GetPrivateData(This,Name,pDataSize,pData) )
#define IDXGISurface_GetParent(This,riid,ppParent) \
( (This)->lpVtbl -> GetParent(This,riid,ppParent) )
#define IDXGISurface_GetDevice(This,riid,ppDevice) \
( (This)->lpVtbl -> GetDevice(This,riid,ppDevice) )
#define IDXGISurface_GetDesc(This,pDesc) \
( (This)->lpVtbl -> GetDesc(This,pDesc) )
#define IDXGISurface_Map(This,pLockedRect,MapFlags) \
( (This)->lpVtbl -> Map(This,pLockedRect,MapFlags) )
#define IDXGISurface_Unmap(This) \
( (This)->lpVtbl -> Unmap(This) )
#endif /* COBJMACROS */
#endif /* C style interface */
#endif /* __IDXGISurface_INTERFACE_DEFINED__ */
/* interface __MIDL_itf_dxgi_0000_0004 */
/* [local] */
extern RPC_IF_HANDLE __MIDL_itf_dxgi_0000_0004_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_dxgi_0000_0004_v0_0_s_ifspec;
#ifndef __IDXGIAdapter_INTERFACE_DEFINED__
#define __IDXGIAdapter_INTERFACE_DEFINED__
/* interface IDXGIAdapter */
/* [unique][local][uuid][object] */
EXTERN_C const IID IID_IDXGIAdapter;
#if defined(__cplusplus) && !defined(CINTERFACE)
MIDL_INTERFACE("2411e7e1-12ac-4ccf-bd14-9798e8534dc0")
IDXGIAdapter : public IDXGIObject
{
public:
virtual HRESULT STDMETHODCALLTYPE EnumOutputs(
/* [in] */ UINT Output,
/* [out][in] */ IDXGIOutput **ppOutput) = 0;
virtual HRESULT STDMETHODCALLTYPE GetDesc(
/* [out] */ DXGI_ADAPTER_DESC *pDesc) = 0;
virtual HRESULT STDMETHODCALLTYPE CheckInterfaceSupport(
/* [in] */ REFGUID InterfaceName,
/* [out] */ LARGE_INTEGER *pUMDVersion) = 0;
};
#else /* C style interface */
typedef struct IDXGIAdapterVtbl
{
BEGIN_INTERFACE
HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
IDXGIAdapter * This,
/* [in] */ REFIID riid,
/* [iid_is][out] */
__RPC__deref_out void **ppvObject);
ULONG ( STDMETHODCALLTYPE *AddRef )(
IDXGIAdapter * This);
ULONG ( STDMETHODCALLTYPE *Release )(
IDXGIAdapter * This);
HRESULT ( STDMETHODCALLTYPE *SetPrivateData )(
IDXGIAdapter * This,
/* [in] */ REFGUID Name,
/* [in] */ UINT DataSize,
/* [in] */ const void *pData);
HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )(
IDXGIAdapter * This,
/* [in] */ REFGUID Name,
/* [in] */ const IUnknown *pUnknown);
HRESULT ( STDMETHODCALLTYPE *GetPrivateData )(
IDXGIAdapter * This,
/* [in] */ REFGUID Name,
/* [out][in] */ UINT *pDataSize,
/* [out] */ void *pData);
HRESULT ( STDMETHODCALLTYPE *GetParent )(
IDXGIAdapter * This,
/* [in] */ REFIID riid,
/* [retval][out] */ void **ppParent);
HRESULT ( STDMETHODCALLTYPE *EnumOutputs )(
IDXGIAdapter * This,
/* [in] */ UINT Output,
/* [out][in] */ IDXGIOutput **ppOutput);
HRESULT ( STDMETHODCALLTYPE *GetDesc )(
IDXGIAdapter * This,
/* [out] */ DXGI_ADAPTER_DESC *pDesc);
HRESULT ( STDMETHODCALLTYPE *CheckInterfaceSupport )(
IDXGIAdapter * This,
/* [in] */ REFGUID InterfaceName,
/* [out] */ LARGE_INTEGER *pUMDVersion);
END_INTERFACE
} IDXGIAdapterVtbl;
interface IDXGIAdapter
{
CONST_VTBL struct IDXGIAdapterVtbl *lpVtbl;
};
#ifdef COBJMACROS
#define IDXGIAdapter_QueryInterface(This,riid,ppvObject) \
( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) )
#define IDXGIAdapter_AddRef(This) \
( (This)->lpVtbl -> AddRef(This) )
#define IDXGIAdapter_Release(This) \
( (This)->lpVtbl -> Release(This) )
#define IDXGIAdapter_SetPrivateData(This,Name,DataSize,pData) \
( (This)->lpVtbl -> SetPrivateData(This,Name,DataSize,pData) )
#define IDXGIAdapter_SetPrivateDataInterface(This,Name,pUnknown) \
( (This)->lpVtbl -> SetPrivateDataInterface(This,Name,pUnknown) )
#define IDXGIAdapter_GetPrivateData(This,Name,pDataSize,pData) \
( (This)->lpVtbl -> GetPrivateData(This,Name,pDataSize,pData) )
#define IDXGIAdapter_GetParent(This,riid,ppParent) \
( (This)->lpVtbl -> GetParent(This,riid,ppParent) )
#define IDXGIAdapter_EnumOutputs(This,Output,ppOutput) \
( (This)->lpVtbl -> EnumOutputs(This,Output,ppOutput) )
#define IDXGIAdapter_GetDesc(This,pDesc) \
( (This)->lpVtbl -> GetDesc(This,pDesc) )
#define IDXGIAdapter_CheckInterfaceSupport(This,InterfaceName,pUMDVersion) \
( (This)->lpVtbl -> CheckInterfaceSupport(This,InterfaceName,pUMDVersion) )
#endif /* COBJMACROS */
#endif /* C style interface */
#endif /* __IDXGIAdapter_INTERFACE_DEFINED__ */
/* interface __MIDL_itf_dxgi_0000_0005 */
/* [local] */
#define DXGI_ENUM_MODES_INTERLACED ( 1UL )
#define DXGI_ENUM_MODES_SCALING ( 2UL )
extern RPC_IF_HANDLE __MIDL_itf_dxgi_0000_0005_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_dxgi_0000_0005_v0_0_s_ifspec;
#ifndef __IDXGIOutput_INTERFACE_DEFINED__
#define __IDXGIOutput_INTERFACE_DEFINED__
/* interface IDXGIOutput */
/* [unique][local][uuid][object] */
EXTERN_C const IID IID_IDXGIOutput;
#if defined(__cplusplus) && !defined(CINTERFACE)
MIDL_INTERFACE("ae02eedb-c735-4690-8d52-5a8dc20213aa")
IDXGIOutput : public IDXGIObject
{
public:
virtual HRESULT STDMETHODCALLTYPE GetDesc(
/* [out] */ DXGI_OUTPUT_DESC *pDesc) = 0;
virtual HRESULT STDMETHODCALLTYPE GetDisplayModeList(
/* [in] */ DXGI_FORMAT EnumFormat,
/* [in] */ UINT Flags,
/* [out][in] */ UINT *pNumModes,
/* [out] */ DXGI_MODE_DESC *pDesc) = 0;
virtual HRESULT STDMETHODCALLTYPE FindClosestMatchingMode(
/* [in] */ const DXGI_MODE_DESC *pModeToMatch,
/* [out] */ DXGI_MODE_DESC *pClosestMatch,
/* [in] */ IUnknown *pConcernedDevice) = 0;
virtual HRESULT STDMETHODCALLTYPE WaitForVBlank( void) = 0;
virtual HRESULT STDMETHODCALLTYPE TakeOwnership(
/* [in] */ IUnknown *pDevice,
BOOL Exclusive) = 0;
virtual void STDMETHODCALLTYPE ReleaseOwnership( void) = 0;
virtual HRESULT STDMETHODCALLTYPE GetGammaControlCapabilities(
/* [out] */ DXGI_GAMMA_CONTROL_CAPABILITIES *pGammaCaps) = 0;
virtual HRESULT STDMETHODCALLTYPE SetGammaControl(
/* [in] */ const DXGI_GAMMA_CONTROL *pArray) = 0;
virtual HRESULT STDMETHODCALLTYPE GetGammaControl(
/* [out] */ DXGI_GAMMA_CONTROL *pArray) = 0;
virtual HRESULT STDMETHODCALLTYPE SetDisplaySurface(
/* [in] */ IDXGISurface *pScanoutSurface) = 0;
virtual HRESULT STDMETHODCALLTYPE GetDisplaySurfaceData(
/* [in] */ IDXGISurface *pDestination) = 0;
virtual HRESULT STDMETHODCALLTYPE GetFrameStatistics(
/* [out] */ DXGI_FRAME_STATISTICS *pStats) = 0;
};
#else /* C style interface */
typedef struct IDXGIOutputVtbl
{
BEGIN_INTERFACE
HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
IDXGIOutput * This,
/* [in] */ REFIID riid,
/* [iid_is][out] */
__RPC__deref_out void **ppvObject);
ULONG ( STDMETHODCALLTYPE *AddRef )(
IDXGIOutput * This);
ULONG ( STDMETHODCALLTYPE *Release )(
IDXGIOutput * This);
HRESULT ( STDMETHODCALLTYPE *SetPrivateData )(
IDXGIOutput * This,
/* [in] */ REFGUID Name,
/* [in] */ UINT DataSize,
/* [in] */ const void *pData);
HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )(
IDXGIOutput * This,
/* [in] */ REFGUID Name,
/* [in] */ const IUnknown *pUnknown);
HRESULT ( STDMETHODCALLTYPE *GetPrivateData )(
IDXGIOutput * This,
/* [in] */ REFGUID Name,
/* [out][in] */ UINT *pDataSize,
/* [out] */ void *pData);
HRESULT ( STDMETHODCALLTYPE *GetParent )(
IDXGIOutput * This,
/* [in] */ REFIID riid,
/* [retval][out] */ void **ppParent);
HRESULT ( STDMETHODCALLTYPE *GetDesc )(
IDXGIOutput * This,
/* [out] */ DXGI_OUTPUT_DESC *pDesc);
HRESULT ( STDMETHODCALLTYPE *GetDisplayModeList )(
IDXGIOutput * This,
/* [in] */ DXGI_FORMAT EnumFormat,
/* [in] */ UINT Flags,
/* [out][in] */ UINT *pNumModes,
/* [out] */ DXGI_MODE_DESC *pDesc);
HRESULT ( STDMETHODCALLTYPE *FindClosestMatchingMode )(
IDXGIOutput * This,
/* [in] */ const DXGI_MODE_DESC *pModeToMatch,
/* [out] */ DXGI_MODE_DESC *pClosestMatch,
/* [in] */ IUnknown *pConcernedDevice);
HRESULT ( STDMETHODCALLTYPE *WaitForVBlank )(
IDXGIOutput * This);
HRESULT ( STDMETHODCALLTYPE *TakeOwnership )(
IDXGIOutput * This,
/* [in] */ IUnknown *pDevice,
BOOL Exclusive);
void ( STDMETHODCALLTYPE *ReleaseOwnership )(
IDXGIOutput * This);
HRESULT ( STDMETHODCALLTYPE *GetGammaControlCapabilities )(
IDXGIOutput * This,
/* [out] */ DXGI_GAMMA_CONTROL_CAPABILITIES *pGammaCaps);
HRESULT ( STDMETHODCALLTYPE *SetGammaControl )(
IDXGIOutput * This,
/* [in] */ const DXGI_GAMMA_CONTROL *pArray);
HRESULT ( STDMETHODCALLTYPE *GetGammaControl )(
IDXGIOutput * This,
/* [out] */ DXGI_GAMMA_CONTROL *pArray);
HRESULT ( STDMETHODCALLTYPE *SetDisplaySurface )(
IDXGIOutput * This,
/* [in] */ IDXGISurface *pScanoutSurface);
HRESULT ( STDMETHODCALLTYPE *GetDisplaySurfaceData )(
IDXGIOutput * This,
/* [in] */ IDXGISurface *pDestination);
HRESULT ( STDMETHODCALLTYPE *GetFrameStatistics )(
IDXGIOutput * This,
/* [out] */ DXGI_FRAME_STATISTICS *pStats);
END_INTERFACE
} IDXGIOutputVtbl;
interface IDXGIOutput
{
CONST_VTBL struct IDXGIOutputVtbl *lpVtbl;
};
#ifdef COBJMACROS
#define IDXGIOutput_QueryInterface(This,riid,ppvObject) \
( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) )
#define IDXGIOutput_AddRef(This) \
( (This)->lpVtbl -> AddRef(This) )
#define IDXGIOutput_Release(This) \
( (This)->lpVtbl -> Release(This) )
#define IDXGIOutput_SetPrivateData(This,Name,DataSize,pData) \
( (This)->lpVtbl -> SetPrivateData(This,Name,DataSize,pData) )
#define IDXGIOutput_SetPrivateDataInterface(This,Name,pUnknown) \
( (This)->lpVtbl -> SetPrivateDataInterface(This,Name,pUnknown) )
#define IDXGIOutput_GetPrivateData(This,Name,pDataSize,pData) \
( (This)->lpVtbl -> GetPrivateData(This,Name,pDataSize,pData) )
#define IDXGIOutput_GetParent(This,riid,ppParent) \
( (This)->lpVtbl -> GetParent(This,riid,ppParent) )
#define IDXGIOutput_GetDesc(This,pDesc) \
( (This)->lpVtbl -> GetDesc(This,pDesc) )
#define IDXGIOutput_GetDisplayModeList(This,EnumFormat,Flags,pNumModes,pDesc) \
( (This)->lpVtbl -> GetDisplayModeList(This,EnumFormat,Flags,pNumModes,pDesc) )
#define IDXGIOutput_FindClosestMatchingMode(This,pModeToMatch,pClosestMatch,pConcernedDevice) \
( (This)->lpVtbl -> FindClosestMatchingMode(This,pModeToMatch,pClosestMatch,pConcernedDevice) )
#define IDXGIOutput_WaitForVBlank(This) \
( (This)->lpVtbl -> WaitForVBlank(This) )
#define IDXGIOutput_TakeOwnership(This,pDevice,Exclusive) \
( (This)->lpVtbl -> TakeOwnership(This,pDevice,Exclusive) )
#define IDXGIOutput_ReleaseOwnership(This) \
( (This)->lpVtbl -> ReleaseOwnership(This) )
#define IDXGIOutput_GetGammaControlCapabilities(This,pGammaCaps) \
( (This)->lpVtbl -> GetGammaControlCapabilities(This,pGammaCaps) )
#define IDXGIOutput_SetGammaControl(This,pArray) \
( (This)->lpVtbl -> SetGammaControl(This,pArray) )
#define IDXGIOutput_GetGammaControl(This,pArray) \
( (This)->lpVtbl -> GetGammaControl(This,pArray) )
#define IDXGIOutput_SetDisplaySurface(This,pScanoutSurface) \
( (This)->lpVtbl -> SetDisplaySurface(This,pScanoutSurface) )
#define IDXGIOutput_GetDisplaySurfaceData(This,pDestination) \
( (This)->lpVtbl -> GetDisplaySurfaceData(This,pDestination) )
#define IDXGIOutput_GetFrameStatistics(This,pStats) \
( (This)->lpVtbl -> GetFrameStatistics(This,pStats) )
#endif /* COBJMACROS */
#endif /* C style interface */
#endif /* __IDXGIOutput_INTERFACE_DEFINED__ */
/* interface __MIDL_itf_dxgi_0000_0006 */
/* [local] */
#define DXGI_MAX_SWAP_CHAIN_BUFFERS ( 16 )
#define DXGI_PRESENT_TEST 0x00000001UL
#define DXGI_PRESENT_DO_NOT_SEQUENCE 0x00000002UL
#define DXGI_PRESENT_RESTART 0x00000004UL
extern RPC_IF_HANDLE __MIDL_itf_dxgi_0000_0006_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_dxgi_0000_0006_v0_0_s_ifspec;
#ifndef __IDXGISwapChain_INTERFACE_DEFINED__
#define __IDXGISwapChain_INTERFACE_DEFINED__
/* interface IDXGISwapChain */
/* [unique][local][uuid][object] */
EXTERN_C const IID IID_IDXGISwapChain;
#if defined(__cplusplus) && !defined(CINTERFACE)
MIDL_INTERFACE("310d36a0-d2e7-4c0a-aa04-6a9d23b8886a")
IDXGISwapChain : public IDXGIDeviceSubObject
{
public:
virtual HRESULT STDMETHODCALLTYPE Present(
/* [in] */ UINT SyncInterval,
/* [in] */ UINT Flags) = 0;
virtual HRESULT STDMETHODCALLTYPE GetBuffer(
/* [in] */ UINT Buffer,
/* [in] */ REFIID riid,
/* [out][in] */ void **ppSurface) = 0;
virtual HRESULT STDMETHODCALLTYPE SetFullscreenState(
/* [in] */ BOOL Fullscreen,
/* [in] */ IDXGIOutput *pTarget) = 0;
virtual HRESULT STDMETHODCALLTYPE GetFullscreenState(
/* [out] */ BOOL *pFullscreen,
/* [out] */ IDXGIOutput **ppTarget) = 0;
virtual HRESULT STDMETHODCALLTYPE GetDesc(
/* [out] */ DXGI_SWAP_CHAIN_DESC *pDesc) = 0;
virtual HRESULT STDMETHODCALLTYPE ResizeBuffers(
/* [in] */ UINT BufferCount,
/* [in] */ UINT Width,
/* [in] */ UINT Height,
/* [in] */ DXGI_FORMAT NewFormat,
/* [in] */ UINT SwapChainFlags) = 0;
virtual HRESULT STDMETHODCALLTYPE ResizeTarget(
/* [in] */ const DXGI_MODE_DESC *pNewTargetParameters) = 0;
virtual HRESULT STDMETHODCALLTYPE GetContainingOutput(
IDXGIOutput **ppOutput) = 0;
virtual HRESULT STDMETHODCALLTYPE GetFrameStatistics(
/* [out] */ DXGI_FRAME_STATISTICS *pStats) = 0;
virtual HRESULT STDMETHODCALLTYPE GetLastPresentCount(
/* [out] */ UINT *pLastPresentCount) = 0;
};
#else /* C style interface */
typedef struct IDXGISwapChainVtbl
{
BEGIN_INTERFACE
HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
IDXGISwapChain * This,
/* [in] */ REFIID riid,
/* [iid_is][out] */
__RPC__deref_out void **ppvObject);
ULONG ( STDMETHODCALLTYPE *AddRef )(
IDXGISwapChain * This);
ULONG ( STDMETHODCALLTYPE *Release )(
IDXGISwapChain * This);
HRESULT ( STDMETHODCALLTYPE *SetPrivateData )(
IDXGISwapChain * This,
/* [in] */ REFGUID Name,
/* [in] */ UINT DataSize,
/* [in] */ const void *pData);
HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )(
IDXGISwapChain * This,
/* [in] */ REFGUID Name,
/* [in] */ const IUnknown *pUnknown);
HRESULT ( STDMETHODCALLTYPE *GetPrivateData )(
IDXGISwapChain * This,
/* [in] */ REFGUID Name,
/* [out][in] */ UINT *pDataSize,
/* [out] */ void *pData);
HRESULT ( STDMETHODCALLTYPE *GetParent )(
IDXGISwapChain * This,
/* [in] */ REFIID riid,
/* [retval][out] */ void **ppParent);
HRESULT ( STDMETHODCALLTYPE *GetDevice )(
IDXGISwapChain * This,
/* [in] */ REFIID riid,
/* [retval][out] */ void **ppDevice);
HRESULT ( STDMETHODCALLTYPE *Present )(
IDXGISwapChain * This,
/* [in] */ UINT SyncInterval,
/* [in] */ UINT Flags);
HRESULT ( STDMETHODCALLTYPE *GetBuffer )(
IDXGISwapChain * This,
/* [in] */ UINT Buffer,
/* [in] */ REFIID riid,
/* [out][in] */ void **ppSurface);
HRESULT ( STDMETHODCALLTYPE *SetFullscreenState )(
IDXGISwapChain * This,
/* [in] */ BOOL Fullscreen,
/* [in] */ IDXGIOutput *pTarget);
HRESULT ( STDMETHODCALLTYPE *GetFullscreenState )(
IDXGISwapChain * This,
/* [out] */ BOOL *pFullscreen,
/* [out] */ IDXGIOutput **ppTarget);
HRESULT ( STDMETHODCALLTYPE *GetDesc )(
IDXGISwapChain * This,
/* [out] */ DXGI_SWAP_CHAIN_DESC *pDesc);
HRESULT ( STDMETHODCALLTYPE *ResizeBuffers )(
IDXGISwapChain * This,
/* [in] */ UINT BufferCount,
/* [in] */ UINT Width,
/* [in] */ UINT Height,
/* [in] */ DXGI_FORMAT NewFormat,
/* [in] */ UINT SwapChainFlags);
HRESULT ( STDMETHODCALLTYPE *ResizeTarget )(
IDXGISwapChain * This,
/* [in] */ const DXGI_MODE_DESC *pNewTargetParameters);
HRESULT ( STDMETHODCALLTYPE *GetContainingOutput )(
IDXGISwapChain * This,
IDXGIOutput **ppOutput);
HRESULT ( STDMETHODCALLTYPE *GetFrameStatistics )(
IDXGISwapChain * This,
/* [out] */ DXGI_FRAME_STATISTICS *pStats);
HRESULT ( STDMETHODCALLTYPE *GetLastPresentCount )(
IDXGISwapChain * This,
/* [out] */ UINT *pLastPresentCount);
END_INTERFACE
} IDXGISwapChainVtbl;
interface IDXGISwapChain
{
CONST_VTBL struct IDXGISwapChainVtbl *lpVtbl;
};
#ifdef COBJMACROS
#define IDXGISwapChain_QueryInterface(This,riid,ppvObject) \
( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) )
#define IDXGISwapChain_AddRef(This) \
( (This)->lpVtbl -> AddRef(This) )
#define IDXGISwapChain_Release(This) \
( (This)->lpVtbl -> Release(This) )
#define IDXGISwapChain_SetPrivateData(This,Name,DataSize,pData) \
( (This)->lpVtbl -> SetPrivateData(This,Name,DataSize,pData) )
#define IDXGISwapChain_SetPrivateDataInterface(This,Name,pUnknown) \
( (This)->lpVtbl -> SetPrivateDataInterface(This,Name,pUnknown) )
#define IDXGISwapChain_GetPrivateData(This,Name,pDataSize,pData) \
( (This)->lpVtbl -> GetPrivateData(This,Name,pDataSize,pData) )
#define IDXGISwapChain_GetParent(This,riid,ppParent) \
( (This)->lpVtbl -> GetParent(This,riid,ppParent) )
#define IDXGISwapChain_GetDevice(This,riid,ppDevice) \
( (This)->lpVtbl -> GetDevice(This,riid,ppDevice) )
#define IDXGISwapChain_Present(This,SyncInterval,Flags) \
( (This)->lpVtbl -> Present(This,SyncInterval,Flags) )
#define IDXGISwapChain_GetBuffer(This,Buffer,riid,ppSurface) \
( (This)->lpVtbl -> GetBuffer(This,Buffer,riid,ppSurface) )
#define IDXGISwapChain_SetFullscreenState(This,Fullscreen,pTarget) \
( (This)->lpVtbl -> SetFullscreenState(This,Fullscreen,pTarget) )
#define IDXGISwapChain_GetFullscreenState(This,pFullscreen,ppTarget) \
( (This)->lpVtbl -> GetFullscreenState(This,pFullscreen,ppTarget) )
#define IDXGISwapChain_GetDesc(This,pDesc) \
( (This)->lpVtbl -> GetDesc(This,pDesc) )
#define IDXGISwapChain_ResizeBuffers(This,BufferCount,Width,Height,NewFormat,SwapChainFlags) \
( (This)->lpVtbl -> ResizeBuffers(This,BufferCount,Width,Height,NewFormat,SwapChainFlags) )
#define IDXGISwapChain_ResizeTarget(This,pNewTargetParameters) \
( (This)->lpVtbl -> ResizeTarget(This,pNewTargetParameters) )
#define IDXGISwapChain_GetContainingOutput(This,ppOutput) \
( (This)->lpVtbl -> GetContainingOutput(This,ppOutput) )
#define IDXGISwapChain_GetFrameStatistics(This,pStats) \
( (This)->lpVtbl -> GetFrameStatistics(This,pStats) )
#define IDXGISwapChain_GetLastPresentCount(This,pLastPresentCount) \
( (This)->lpVtbl -> GetLastPresentCount(This,pLastPresentCount) )
#endif /* COBJMACROS */
#endif /* C style interface */
#endif /* __IDXGISwapChain_INTERFACE_DEFINED__ */
/* interface __MIDL_itf_dxgi_0000_0007 */
/* [local] */
#define DXGI_MWA_NO_WINDOW_CHANGES ( 1 << 0 )
#define DXGI_MWA_NO_ALT_ENTER ( 1 << 1 )
#define DXGI_MWA_NO_PRINT_SCREEN ( 1 << 2 )
#define DXGI_MWA_VALID ( 0x7 )
extern RPC_IF_HANDLE __MIDL_itf_dxgi_0000_0007_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_dxgi_0000_0007_v0_0_s_ifspec;
#ifndef __IDXGIFactory_INTERFACE_DEFINED__
#define __IDXGIFactory_INTERFACE_DEFINED__
/* interface IDXGIFactory */
/* [unique][local][uuid][object] */
EXTERN_C const IID IID_IDXGIFactory;
#if defined(__cplusplus) && !defined(CINTERFACE)
MIDL_INTERFACE("7b7166ec-21c7-44ae-b21a-c9ae321ae369")
IDXGIFactory : public IDXGIObject
{
public:
virtual HRESULT STDMETHODCALLTYPE EnumAdapters(
/* [in] */ UINT Adapter,
/* [out] */ IDXGIAdapter **ppAdapter) = 0;
virtual HRESULT STDMETHODCALLTYPE MakeWindowAssociation(
HWND WindowHandle,
UINT Flags) = 0;
virtual HRESULT STDMETHODCALLTYPE GetWindowAssociation(
HWND *pWindowHandle) = 0;
virtual HRESULT STDMETHODCALLTYPE CreateSwapChain(
IUnknown *pDevice,
DXGI_SWAP_CHAIN_DESC *pDesc,
IDXGISwapChain **ppSwapChain) = 0;
virtual HRESULT STDMETHODCALLTYPE CreateSoftwareAdapter(
/* [in] */ HMODULE Module,
/* [out] */ IDXGIAdapter **ppAdapter) = 0;
};
#else /* C style interface */
typedef struct IDXGIFactoryVtbl
{
BEGIN_INTERFACE
HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
IDXGIFactory * This,
/* [in] */ REFIID riid,
/* [iid_is][out] */
__RPC__deref_out void **ppvObject);
ULONG ( STDMETHODCALLTYPE *AddRef )(
IDXGIFactory * This);
ULONG ( STDMETHODCALLTYPE *Release )(
IDXGIFactory * This);
HRESULT ( STDMETHODCALLTYPE *SetPrivateData )(
IDXGIFactory * This,
/* [in] */ REFGUID Name,
/* [in] */ UINT DataSize,
/* [in] */ const void *pData);
HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )(
IDXGIFactory * This,
/* [in] */ REFGUID Name,
/* [in] */ const IUnknown *pUnknown);
HRESULT ( STDMETHODCALLTYPE *GetPrivateData )(
IDXGIFactory * This,
/* [in] */ REFGUID Name,
/* [out][in] */ UINT *pDataSize,
/* [out] */ void *pData);
HRESULT ( STDMETHODCALLTYPE *GetParent )(
IDXGIFactory * This,
/* [in] */ REFIID riid,
/* [retval][out] */ void **ppParent);
HRESULT ( STDMETHODCALLTYPE *EnumAdapters )(
IDXGIFactory * This,
/* [in] */ UINT Adapter,
/* [out] */ IDXGIAdapter **ppAdapter);
HRESULT ( STDMETHODCALLTYPE *MakeWindowAssociation )(
IDXGIFactory * This,
HWND WindowHandle,
UINT Flags);
HRESULT ( STDMETHODCALLTYPE *GetWindowAssociation )(
IDXGIFactory * This,
HWND *pWindowHandle);
HRESULT ( STDMETHODCALLTYPE *CreateSwapChain )(
IDXGIFactory * This,
IUnknown *pDevice,
DXGI_SWAP_CHAIN_DESC *pDesc,
IDXGISwapChain **ppSwapChain);
HRESULT ( STDMETHODCALLTYPE *CreateSoftwareAdapter )(
IDXGIFactory * This,
/* [in] */ HMODULE Module,
/* [out] */ IDXGIAdapter **ppAdapter);
END_INTERFACE
} IDXGIFactoryVtbl;
interface IDXGIFactory
{
CONST_VTBL struct IDXGIFactoryVtbl *lpVtbl;
};
#ifdef COBJMACROS
#define IDXGIFactory_QueryInterface(This,riid,ppvObject) \
( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) )
#define IDXGIFactory_AddRef(This) \
( (This)->lpVtbl -> AddRef(This) )
#define IDXGIFactory_Release(This) \
( (This)->lpVtbl -> Release(This) )
#define IDXGIFactory_SetPrivateData(This,Name,DataSize,pData) \
( (This)->lpVtbl -> SetPrivateData(This,Name,DataSize,pData) )
#define IDXGIFactory_SetPrivateDataInterface(This,Name,pUnknown) \
( (This)->lpVtbl -> SetPrivateDataInterface(This,Name,pUnknown) )
#define IDXGIFactory_GetPrivateData(This,Name,pDataSize,pData) \
( (This)->lpVtbl -> GetPrivateData(This,Name,pDataSize,pData) )
#define IDXGIFactory_GetParent(This,riid,ppParent) \
( (This)->lpVtbl -> GetParent(This,riid,ppParent) )
#define IDXGIFactory_EnumAdapters(This,Adapter,ppAdapter) \
( (This)->lpVtbl -> EnumAdapters(This,Adapter,ppAdapter) )
#define IDXGIFactory_MakeWindowAssociation(This,WindowHandle,Flags) \
( (This)->lpVtbl -> MakeWindowAssociation(This,WindowHandle,Flags) )
#define IDXGIFactory_GetWindowAssociation(This,pWindowHandle) \
( (This)->lpVtbl -> GetWindowAssociation(This,pWindowHandle) )
#define IDXGIFactory_CreateSwapChain(This,pDevice,pDesc,ppSwapChain) \
( (This)->lpVtbl -> CreateSwapChain(This,pDevice,pDesc,ppSwapChain) )
#define IDXGIFactory_CreateSoftwareAdapter(This,Module,ppAdapter) \
( (This)->lpVtbl -> CreateSoftwareAdapter(This,Module,ppAdapter) )
#endif /* COBJMACROS */
#endif /* C style interface */
#endif /* __IDXGIFactory_INTERFACE_DEFINED__ */
/* interface __MIDL_itf_dxgi_0000_0008 */
/* [local] */
HRESULT WINAPI CreateDXGIFactory(REFIID riid, void **ppFactory);
extern RPC_IF_HANDLE __MIDL_itf_dxgi_0000_0008_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_dxgi_0000_0008_v0_0_s_ifspec;
#ifndef __IDXGIDevice_INTERFACE_DEFINED__
#define __IDXGIDevice_INTERFACE_DEFINED__
/* interface IDXGIDevice */
/* [unique][local][uuid][object] */
EXTERN_C const IID IID_IDXGIDevice;
#if defined(__cplusplus) && !defined(CINTERFACE)
MIDL_INTERFACE("54ec77fa-1377-44e6-8c32-88fd5f44c84c")
IDXGIDevice : public IDXGIObject
{
public:
virtual HRESULT STDMETHODCALLTYPE GetAdapter(
/* [out] */ IDXGIAdapter **pAdapter) = 0;
virtual HRESULT STDMETHODCALLTYPE CreateSurface(
/* [in] */ const DXGI_SURFACE_DESC *pDesc,
/* [in] */ UINT NumSurfaces,
/* [in] */ DXGI_USAGE Usage,
/* [in] */ const DXGI_SHARED_RESOURCE *pSharedResource,
/* [out] */ IDXGISurface **ppSurface) = 0;
virtual HRESULT STDMETHODCALLTYPE QueryResourceResidency(
/* [size_is][in] */ IUnknown *const *ppResources,
/* [size_is][out] */ DXGI_RESIDENCY *pResidencyStatus,
/* [in] */ UINT NumResources) = 0;
virtual HRESULT STDMETHODCALLTYPE SetGPUThreadPriority(
/* [in] */ INT Priority) = 0;
virtual HRESULT STDMETHODCALLTYPE GetGPUThreadPriority(
/* [retval][out] */ INT *pPriority) = 0;
};
#else /* C style interface */
typedef struct IDXGIDeviceVtbl
{
BEGIN_INTERFACE
HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
IDXGIDevice * This,
/* [in] */ REFIID riid,
/* [iid_is][out] */
__RPC__deref_out void **ppvObject);
ULONG ( STDMETHODCALLTYPE *AddRef )(
IDXGIDevice * This);
ULONG ( STDMETHODCALLTYPE *Release )(
IDXGIDevice * This);
HRESULT ( STDMETHODCALLTYPE *SetPrivateData )(
IDXGIDevice * This,
/* [in] */ REFGUID Name,
/* [in] */ UINT DataSize,
/* [in] */ const void *pData);
HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )(
IDXGIDevice * This,
/* [in] */ REFGUID Name,
/* [in] */ const IUnknown *pUnknown);
HRESULT ( STDMETHODCALLTYPE *GetPrivateData )(
IDXGIDevice * This,
/* [in] */ REFGUID Name,
/* [out][in] */ UINT *pDataSize,
/* [out] */ void *pData);
HRESULT ( STDMETHODCALLTYPE *GetParent )(
IDXGIDevice * This,
/* [in] */ REFIID riid,
/* [retval][out] */ void **ppParent);
HRESULT ( STDMETHODCALLTYPE *GetAdapter )(
IDXGIDevice * This,
/* [out] */ IDXGIAdapter **pAdapter);
HRESULT ( STDMETHODCALLTYPE *CreateSurface )(
IDXGIDevice * This,
/* [in] */ const DXGI_SURFACE_DESC *pDesc,
/* [in] */ UINT NumSurfaces,
/* [in] */ DXGI_USAGE Usage,
/* [in] */ const DXGI_SHARED_RESOURCE *pSharedResource,
/* [out] */ IDXGISurface **ppSurface);
HRESULT ( STDMETHODCALLTYPE *QueryResourceResidency )(
IDXGIDevice * This,
/* [size_is][in] */ IUnknown *const *ppResources,
/* [size_is][out] */ DXGI_RESIDENCY *pResidencyStatus,
/* [in] */ UINT NumResources);
HRESULT ( STDMETHODCALLTYPE *SetGPUThreadPriority )(
IDXGIDevice * This,
/* [in] */ INT Priority);
HRESULT ( STDMETHODCALLTYPE *GetGPUThreadPriority )(
IDXGIDevice * This,
/* [retval][out] */ INT *pPriority);
END_INTERFACE
} IDXGIDeviceVtbl;
interface IDXGIDevice
{
CONST_VTBL struct IDXGIDeviceVtbl *lpVtbl;
};
#ifdef COBJMACROS
#define IDXGIDevice_QueryInterface(This,riid,ppvObject) \
( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) )
#define IDXGIDevice_AddRef(This) \
( (This)->lpVtbl -> AddRef(This) )
#define IDXGIDevice_Release(This) \
( (This)->lpVtbl -> Release(This) )
#define IDXGIDevice_SetPrivateData(This,Name,DataSize,pData) \
( (This)->lpVtbl -> SetPrivateData(This,Name,DataSize,pData) )
#define IDXGIDevice_SetPrivateDataInterface(This,Name,pUnknown) \
( (This)->lpVtbl -> SetPrivateDataInterface(This,Name,pUnknown) )
#define IDXGIDevice_GetPrivateData(This,Name,pDataSize,pData) \
( (This)->lpVtbl -> GetPrivateData(This,Name,pDataSize,pData) )
#define IDXGIDevice_GetParent(This,riid,ppParent) \
( (This)->lpVtbl -> GetParent(This,riid,ppParent) )
#define IDXGIDevice_GetAdapter(This,pAdapter) \
( (This)->lpVtbl -> GetAdapter(This,pAdapter) )
#define IDXGIDevice_CreateSurface(This,pDesc,NumSurfaces,Usage,pSharedResource,ppSurface) \
( (This)->lpVtbl -> CreateSurface(This,pDesc,NumSurfaces,Usage,pSharedResource,ppSurface) )
#define IDXGIDevice_QueryResourceResidency(This,ppResources,pResidencyStatus,NumResources) \
( (This)->lpVtbl -> QueryResourceResidency(This,ppResources,pResidencyStatus,NumResources) )
#define IDXGIDevice_SetGPUThreadPriority(This,Priority) \
( (This)->lpVtbl -> SetGPUThreadPriority(This,Priority) )
#define IDXGIDevice_GetGPUThreadPriority(This,pPriority) \
( (This)->lpVtbl -> GetGPUThreadPriority(This,pPriority) )
#endif /* COBJMACROS */
#endif /* C style interface */
#endif /* __IDXGIDevice_INTERFACE_DEFINED__ */
/* interface __MIDL_itf_dxgi_0000_0009 */
/* [local] */
#ifdef __cplusplus
#endif /*__cplusplus*/
DEFINE_GUID(IID_IDXGIObject,0xaec22fb8,0x76f3,0x4639,0x9b,0xe0,0x28,0xeb,0x43,0xa6,0x7a,0x2e);
DEFINE_GUID(IID_IDXGIDeviceSubObject,0x3d3e0379,0xf9de,0x4d58,0xbb,0x6c,0x18,0xd6,0x29,0x92,0xf1,0xa6);
DEFINE_GUID(IID_IDXGIResource,0x035f3ab4,0x482e,0x4e50,0xb4,0x1f,0x8a,0x7f,0x8b,0xd8,0x96,0x0b);
DEFINE_GUID(IID_IDXGISurface,0xcafcb56c,0x6ac3,0x4889,0xbf,0x47,0x9e,0x23,0xbb,0xd2,0x60,0xec);
DEFINE_GUID(IID_IDXGIAdapter,0x2411e7e1,0x12ac,0x4ccf,0xbd,0x14,0x97,0x98,0xe8,0x53,0x4d,0xc0);
DEFINE_GUID(IID_IDXGIOutput,0xae02eedb,0xc735,0x4690,0x8d,0x52,0x5a,0x8d,0xc2,0x02,0x13,0xaa);
DEFINE_GUID(IID_IDXGISwapChain,0x310d36a0,0xd2e7,0x4c0a,0xaa,0x04,0x6a,0x9d,0x23,0xb8,0x88,0x6a);
DEFINE_GUID(IID_IDXGIFactory,0x7b7166ec,0x21c7,0x44ae,0xb2,0x1a,0xc9,0xae,0x32,0x1a,0xe3,0x69);
DEFINE_GUID(IID_IDXGIDevice,0x54ec77fa,0x1377,0x44e6,0x8c,0x32,0x88,0xfd,0x5f,0x44,0xc8,0x4c);
extern RPC_IF_HANDLE __MIDL_itf_dxgi_0000_0009_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_dxgi_0000_0009_v0_0_s_ifspec;
/* Additional Prototypes for ALL interfaces */
/* end of Additional Prototypes */
#ifdef __cplusplus
}
#endif
#endif
| [
"wirlsawyer@gmail.com"
] | wirlsawyer@gmail.com |
4c8f5c2b55224dec0c7073d95152bb8c54cf9379 | 1f423ee086aa545d4cf039d4e48d8a4ea824e857 | /RenderSystems/Vulkan/include/OgreVulkanHardwareBufferCommon.h | c3939ea4c72da74b063e85d32983c964ae590245 | [
"MIT"
] | permissive | yiliu1203/ogre-next | df77dc6a1e03e967dc577830e86c81d3881258ee | d45fda9a65659d26211e0003eb46e06ac7d490d2 | refs/heads/master | 2021-07-13T08:36:33.580335 | 2021-04-01T15:41:41 | 2021-04-01T15:41:41 | 242,904,107 | 1 | 0 | NOASSERTION | 2020-02-25T03:50:46 | 2020-02-25T03:50:45 | null | UTF-8 | C++ | false | false | 3,643 | h | /*
-----------------------------------------------------------------------------
This source file is part of OGRE
(Object-oriented Graphics Rendering Engine)
For the latest info, see http://www.ogre3d.org/
Copyright (c) 2000-2014 Torus Knot Software Ltd
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-----------------------------------------------------------------------------
*/
#ifndef _OgreVulkanHardwareBufferCommon_H_
#define _OgreVulkanHardwareBufferCommon_H_
#include "OgreVulkanPrerequisites.h"
#include "OgreHardwareBuffer.h"
#include "Vao/OgreVulkanVaoManager.h"
namespace Ogre
{
namespace v1
{
class _OgreVulkanExport VulkanHardwareBufferCommon
{
private:
VulkanRawBuffer mBuffer;
VulkanDevice *mDevice;
VulkanDiscardBuffer *mDiscardBuffer;
VaoManager *mVaoManager;
StagingBuffer *mStagingBuffer;
uint32 mLastFrameUsed;
uint32 mLastFrameGpuWrote;
public:
VulkanHardwareBufferCommon( size_t sizeBytes, HardwareBuffer::Usage usage, uint16 alignment,
VulkanDiscardBufferManager *discardBufferManager,
VulkanDevice *device );
virtual ~VulkanHardwareBufferCommon();
void _notifyDeviceStalled( void );
/** Returns the actual API buffer, but first sets mLastFrameUsed as we
assume you're calling this function to use the buffer in the GPU.
@param outOffset
Out. Guaranteed to be written. Used by HBU_DISCARDABLE buffers which
need an offset to the internal ring buffer we've allocated.
@return
The MTLBuffer in question.
*/
VkBuffer getBufferName( size_t &outOffset );
VkBuffer getBufferNameForGpuWrite( size_t &outOffset );
/// @see HardwareBuffer.
void *lockImpl( size_t offset, size_t length, HardwareBuffer::LockOptions options,
bool isLocked );
/// @see HardwareBuffer.
void unlockImpl( size_t lockStart, size_t lockSize );
/// @see HardwareBuffer.
void readData( size_t offset, size_t length, void *pDest );
/// @see HardwareBuffer.
void writeData( size_t offset, size_t length, const void *pSource,
bool discardWholeBuffer = false );
/// @see HardwareBuffer.
void copyData( VulkanHardwareBufferCommon *srcBuffer, size_t srcOffset, size_t dstOffset,
size_t length, bool discardWholeBuffer = false );
size_t getSizeBytes( void ) const { return mBuffer.mSize; }
};
}
}
#endif
| [
"dark_sylinc@yahoo.com.ar"
] | dark_sylinc@yahoo.com.ar |
3336619abb0f5d480f48faea03423e37dfbb1d9e | ee03828b086648064e6ec1f50c3233045b3ea422 | /Win32Project3/fade.cpp | 2f80f1b7981599f7fed8867499cab6e29c881f53 | [] | no_license | MandaiRyuta/StrayForest | d2779881e586b57174e3ff3b618fc9f47d768a40 | b63a71b5d1a882e72e6afaeb05d96e8eeb731d1a | refs/heads/master | 2020-04-19T09:36:39.370475 | 2019-01-29T08:23:54 | 2019-01-29T08:23:54 | 168,116,119 | 0 | 0 | null | null | null | null | SHIFT_JIS | C++ | false | false | 4,526 | cpp | #include "fade.h"
void Fade::Init()
{
FadeSet_ = 0;
FadeIn = 255;
FadeOut = 0;
}
void Fade::Uninit()
{
}
void Fade::Draw()
{
switch (FadeSet_)
{
case 0:
BlackFadeIn();
break;
case 1:
BlackFadeOut();
break;
case 2:
WhiteFadeIn();
break;
case 3:
WhiteFadeOut();
break;
case 4:
break;
default:
break;
}
}
void Fade::Update()
{
}
void Fade::BlackFadeIn()
{
LPDIRECT3DDEVICE9 pDevice = GetDevice();
//クリッピング空間ちょうどのサイズでクアッドを作ればいい(スクリーンクアッド)
//透明度を時間と共に増減する
if (FadeIn > 0)
{
FadeIn--;
}
FADE_VERTEX vPoint[] =
{
-1.0,1.0,0.0 , D3DCOLOR_ARGB(FadeIn,0,0,0),//頂点0
1.0,1.0,0.0 , D3DCOLOR_ARGB(FadeIn,0,0,0),//頂点1
-1.0,-1.0,0.0,D3DCOLOR_ARGB(FadeIn,0,0,0),//頂点2
1.0,-1.0,0.0 , D3DCOLOR_ARGB(FadeIn,0,0,0), //頂点3
};
//3D変換は全て無効にしていい(しないとダメ)
D3DXMATRIX mat;
D3DXMatrixIdentity(&mat);
pDevice->SetTransform(D3DTS_WORLD, &mat);
pDevice->SetTransform(D3DTS_VIEW, &mat);
pDevice->SetTransform(D3DTS_PROJECTION, &mat);
//スクリーンクアッド描画
pDevice->SetRenderState(D3DRS_LIGHTING, false);
pDevice->SetFVF(D3DFVF_XYZ | D3DFVF_DIFFUSE);
pDevice->DrawPrimitiveUP(D3DPT_TRIANGLESTRIP, 2, vPoint, sizeof(FADE_VERTEX));
}
void Fade::BlackFadeOut()
{
LPDIRECT3DDEVICE9 pDevice = GetDevice();
//クリッピング空間ちょうどのサイズでクアッドを作ればいい(スクリーンクアッド)
//透明度を時間と共に増減する
if (FadeOut < 255)
{
FadeOut++;
}
FADE_VERTEX vPoint[] =
{
-1.0,1.0,0.0 , D3DCOLOR_ARGB(FadeOut,0,0,0),//頂点0
1.0,1.0,0.0 , D3DCOLOR_ARGB(FadeOut,0,0,0),//頂点1
-1.0,-1.0,0.0,D3DCOLOR_ARGB(FadeOut,0,0,0),//頂点2
1.0,-1.0,0.0 , D3DCOLOR_ARGB(FadeOut,0,0,0), //頂点3
};
//3D変換は全て無効にしていい(しないとダメ)
D3DXMATRIX mat;
D3DXMatrixIdentity(&mat);
pDevice->SetTransform(D3DTS_WORLD, &mat);
pDevice->SetTransform(D3DTS_VIEW, &mat);
pDevice->SetTransform(D3DTS_PROJECTION, &mat);
//スクリーンクアッド描画
pDevice->SetRenderState(D3DRS_LIGHTING, false);
pDevice->SetFVF(D3DFVF_XYZ | D3DFVF_DIFFUSE);
pDevice->DrawPrimitiveUP(D3DPT_TRIANGLESTRIP, 2, vPoint, sizeof(FADE_VERTEX));
}
void Fade::WhiteFadeIn()
{
LPDIRECT3DDEVICE9 pDevice = GetDevice();
//クリッピング空間ちょうどのサイズでクアッドを作ればいい(スクリーンクアッド)
//透明度を時間と共に増減する
if (FadeIn > 0)
{
FadeIn--;
}
FADE_VERTEX vPoint[] =
{
-1.0,1.0,0.0 , D3DCOLOR_ARGB(FadeIn,255,255,255),//頂点0
1.0,1.0,0.0 , D3DCOLOR_ARGB(FadeIn,255,255,255),//頂点1
-1.0,-1.0,0.0,D3DCOLOR_ARGB(FadeIn,255,255,255),//頂点2
1.0,-1.0,0.0 , D3DCOLOR_ARGB(FadeIn,255,255,255), //頂点3
};
//3D変換は全て無効にしていい(しないとダメ)
D3DXMATRIX mat;
D3DXMatrixIdentity(&mat);
pDevice->SetTransform(D3DTS_WORLD, &mat);
pDevice->SetTransform(D3DTS_VIEW, &mat);
pDevice->SetTransform(D3DTS_PROJECTION, &mat);
//スクリーンクアッド描画
pDevice->SetRenderState(D3DRS_LIGHTING, false);
pDevice->SetFVF(D3DFVF_XYZ | D3DFVF_DIFFUSE);
pDevice->DrawPrimitiveUP(D3DPT_TRIANGLESTRIP, 2, vPoint, sizeof(FADE_VERTEX));
}
void Fade::WhiteFadeOut()
{
LPDIRECT3DDEVICE9 pDevice = GetDevice();
//クリッピング空間ちょうどのサイズでクアッドを作ればいい(スクリーンクアッド)
//透明度を時間と共に増減する
if (FadeOut < 255)
{
FadeOut++;
}
FADE_VERTEX vPoint[] =
{
-1.0,1.0,0.0 , D3DCOLOR_ARGB(FadeOut,255,255,255),//頂点0
1.0,1.0,0.0 , D3DCOLOR_ARGB(FadeOut,255,255,255),//頂点1
-1.0,-1.0,0.0,D3DCOLOR_ARGB(FadeOut,255,255,255),//頂点2
1.0,-1.0,0.0 , D3DCOLOR_ARGB(FadeOut,255,255,255), //頂点3
};
//3D変換は全て無効にしていい(しないとダメ)
D3DXMATRIX mat;
D3DXMatrixIdentity(&mat);
pDevice->SetTransform(D3DTS_WORLD, &mat);
pDevice->SetTransform(D3DTS_VIEW, &mat);
pDevice->SetTransform(D3DTS_PROJECTION, &mat);
//スクリーンクアッド描画
pDevice->SetRenderState(D3DRS_LIGHTING, false);
pDevice->SetFVF(D3DFVF_XYZ | D3DFVF_DIFFUSE);
pDevice->DrawPrimitiveUP(D3DPT_TRIANGLESTRIP, 2, vPoint, sizeof(FADE_VERTEX));
}
void Fade::FadeSetNumber(int fade)
{
FadeSet_ = fade;
}
Fade * Fade::Create()
{
Fade* CreateFade = new Fade();
CreateFade->Init();
return CreateFade;
}
| [
"Mandai1990@outlook.jp"
] | Mandai1990@outlook.jp |
184baf3ebdc57b4cde5f9249f46ca4c9f0fe3d73 | 4c214a64016cc838700025aebb9fddab1fbacf55 | /Il2Native.Logic/NativeImplementations/System.Private.CoreLib/System/String.cpp | 3405af242b8350e85b7529607c9cff8adb2647be | [
"MIT"
] | permissive | Moxicution/cs2cpp | 73b5fe4a4cdbf1dcec0efcd8cae28ff2d0527664 | d07d3206fb57edb959df8536562909a4d516e359 | refs/heads/master | 2023-07-03T00:57:59.383603 | 2017-08-03T09:05:03 | 2017-08-03T09:05:03 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,058 | cpp | #include "System.Private.CoreLib.h"
namespace CoreLib { namespace System {
namespace _ = ::CoreLib::System;
// Method : string.String(char*)
void String::_ctor(char16_t* value)
{
throw 3221274624U;
}
// Method : string.String(char*, int, int)
void String::_ctor(char16_t* value, int32_t startIndex, int32_t length)
{
throw 3221274624U;
}
// Method : string.String(sbyte*)
void String::_ctor(int8_t* value)
{
throw 3221274624U;
}
// Method : string.String(sbyte*, int, int)
void String::_ctor(int8_t* value, int32_t startIndex, int32_t length)
{
throw 3221274624U;
}
// Method : string.String(sbyte*, int, int, System.Text.Encoding)
void String::_ctor(int8_t* value, int32_t startIndex, int32_t length, _::Text::Encoding* enc)
{
throw 3221274624U;
}
// Method : string.String(char[], int, int)
void String::_ctor(__array<char16_t>* value, int32_t startIndex, int32_t length)
{
throw 3221274624U;
}
// Method : string.String(char[])
void String::_ctor(__array<char16_t>* value)
{
throw 3221274624U;
}
// Method : string.String(char, int)
void String::_ctor(char16_t c, int32_t count)
{
throw 3221274624U;
}
// Method : string.this[int].get
char16_t String::get_Chars(int32_t index)
{
if (index < 0)
{
throw __new<_::InvalidOperationException>();
}
if (index >= this->m_stringLength)
{
throw __new<_::IndexOutOfRangeException>();
}
return ((char16_t*)&this->_firstChar)[index];
}
// Method : string.Length.get
int32_t String::get_Length()
{
return this->m_stringLength;
}
// Method : string.FastAllocateString(int)
string* String::FastAllocateString(int32_t length)
{
auto size = sizeof(string) + (length + 1) * sizeof(char16_t);
#ifdef NDEBUG
auto str = new ((size_t)size) string;
#else
auto str = new ((size_t)size, __FILE__, __LINE__) string;
#endif
str->m_stringLength = length;
return str;
}
// Method : string.IsFastSort()
bool String::IsFastSort()
{
throw 3221274624U;
}
// Method : string.IsAscii()
bool String::IsAscii()
{
throw 3221274624U;
}
// Method : string.SetTrailByte(byte)
void String::SetTrailByte(uint8_t data)
{
throw 3221274624U;
}
// Method : string.TryGetTrailByte(out byte)
bool String::TryGetTrailByte_Out(uint8_t& data)
{
throw 3221274624U;
}
// Method : string.CompareOrdinalHelper(string, int, int, string, int, int)
int32_t String::CompareOrdinalHelper(string* strA, int32_t indexA, int32_t countA, string* strB, int32_t indexB, int32_t countB)
{
throw 3221274624U;
}
// Method : string.nativeCompareOrdinalIgnoreCaseWC(string, sbyte*)
int32_t String::nativeCompareOrdinalIgnoreCaseWC(string* strA, int8_t* strBBytes)
{
throw 3221274624U;
}
// Method : string.InternalMarvin32HashString(string, int, long)
int32_t String::InternalMarvin32HashString(string* s, int32_t strLen, int64_t additionalEntropy)
{
throw 3221274624U;
}
// Method : string.InternalUseRandomizedHashing()
bool String::InternalUseRandomizedHashing()
{
return false;
}
// Method : string.ReplaceInternal(string, string)
string* String::ReplaceInternal(string* oldValue, string* newValue)
{
throw 3221274624U;
}
// Method : string.IndexOfAny(char[], int, int)
int32_t String::IndexOfAny(__array<char16_t>* anyOf, int32_t startIndex, int32_t count)
{
throw 3221274624U;
}
// Method : string.LastIndexOfAny(char[], int, int)
int32_t String::LastIndexOfAny(__array<char16_t>* anyOf, int32_t startIndex, int32_t count)
{
throw 3221274624U;
}
}}
namespace CoreLib { namespace System {
namespace _ = ::CoreLib::System;
}}
| [
"oleksandr.duzhar@netplaytv.com"
] | oleksandr.duzhar@netplaytv.com |
7c684c9feecece7a14c74ab76f73d0c164f930b8 | 07a8c4f3e79df3cbf4d10a1338e27068bc3a7e2a | /include/MRDSubEventClass.hh | 14b488c2420d46b0dc78f8b27b1cd80a3324594c | [] | no_license | sjgardiner/MrdTrackLib | 6d75dfcb228fca03f1a4b9a281bc963cdc8341d1 | 97435e4f125550be85ced137175f82fc00509597 | refs/heads/master | 2020-03-12T02:40:06.181531 | 2018-04-20T19:58:53 | 2018-04-20T19:58:53 | 130,408,279 | 0 | 0 | null | 2018-04-20T19:59:28 | 2018-04-20T19:59:28 | null | UTF-8 | C++ | false | false | 5,913 | hh | /* vim:set noexpandtab tabstop=4 wrap */
#ifndef _MRDSubEvent_Class_
#define _MRDSubEvent_Class_
#include "TObject.h"
#include <vector>
class mrdcell;
class cMRDTrack;
class TCanvas;
class TBox;
class TVector3;
class TLorentzVector;
class TText;
class TLine;
class TArrow;
class TColor;
class cMRDSubEvent : public TObject { // TObject inheritance is required to put in TClonesArray
// Private members
// ===============
private:
Int_t mrdsubevent_id; // ID of this track within the trigger
// Raw Info:
std::string wcsimfile; // which wcsim file this was in
Int_t run_id; // which run this file was in FIXME is same as mrdsubevent_id
Int_t event_id; // which event this track was in
Int_t trigger; // which (sub)trigger this track was in FIXME loads -1s/1's, no 0s
std::vector<Int_t> digi_ids; // vector of digi ids: GetCherenkovDigiHits()->At(digi_ids.at(i))
std::vector<Int_t> pmts_hit; // vector of PMT IDs hit
std::vector<Double_t> digi_qs; // vector of digit charges
std::vector<Double_t> digi_ts; // vector of digit times
std::vector<Int_t> digi_numphots; // number of true photons for each digit
std::vector<Double_t> digi_phot_ts; // true hit times of photons in a digit FIXME some up to -2000???
std::vector<Int_t> digi_phot_parents; // wcsim track IDs of parents that provided photons for a digit
// std::vector<WCSimRootCherenkovDigiHit> digits;
// std::vector<WCSimRootTrack> truetracks; // nice but depends on WCSim classes
std::vector<std::pair<TVector3,TVector3>> truetrackvertices; // start and endpoints.
std::vector<Int_t> truetrackpdgs; //
// XXX FIXME XXX we could also use digi_phot_parents to sort hits in a track by their parent for truth comp!
// Calculated/Reconstructed Info
std::vector<cMRDTrack> tracksthissubevent; // tracks created this SubEvent
std::vector<Int_t> layers_hit; // vector of layers hit TODO currently empty
std::vector<Double_t> eDepsInLayers; // fixed len vector of energy deposition in each layer TODO
// Involved in drawing
std::pair<double, double> xupcorner1, xupcorner2, xdowncorner1, xdowncorner2, yupcorner1, yupcorner2, ydowncorner1, ydowncorner2; // TODO remove me, probably can just be defined in makemrdimage.cxx
std::vector<TArrow*> trackfitarrows; //! stores TLines which are associated with track boundaries
std::vector<TArrow*> trackarrows; //! stores TArrows associated with CA reconstructed tracks
std::vector<TArrow*> truetrackarrows; //! stores TArrows associated with true tracks
public:
// SubEvent Level Getters
// ======================
// Locate the subevent in file>run>event>trigger hierarchy
Int_t GetSubEventID();
std::string GetFile();
Int_t GetRunID();
Int_t GetEventID();
Int_t GetTrigger();
// Top level information about the subevent
Int_t GetNumDigits();
Int_t GetNumLayersHit();
Int_t GetNumPMTsHit();
std::vector<Int_t> GetDigitIds();
std::vector<Double_t> GetDigitQs();
std::vector<Double_t> GetDigitTs();
std::vector<Int_t> GetDigiNumPhots();
std::vector<Double_t> GetDigiPhotTs();
std::vector<Int_t> GetDigiPhotParents();
std::vector<Int_t> GetLayersHit();
std::vector<Int_t> GetPMTsHit();
std::vector<std::pair<TVector3,TVector3>> GetTrueTrackVertices();
std::vector<Int_t> GetTrueTrackPdgs();
// Reconstructed Variables
std::vector<cMRDTrack>* GetTracks();
std::vector<Double_t> GetEdeps();
std::vector<TArrow*> GetTrackArrows();
std::vector<TArrow*> GetTrueTrackArrows();
std::vector<TArrow*> GetTrackFitArrows();
void Print(); // print the subevent info.
// Functions to do reconstruction
// ==============================
private:
// Main track reconstruction code. Groups paddles in a line into a MRDTrack
void DoReconstruction(bool printtracks, bool drawcells, bool drawfit);
// Used within DoReconstruction
void LeastSquaresMinimizer(Int_t numdatapoints, Double_t datapointxs[], Double_t datapointys[], Double_t datapointweights[], Double_t errorys[], Double_t &fit_gradient, Double_t &fit_offset, Double_t &chi2);
bool BridgeSearch(const std::vector<mrdcell*> &tracktotest, const std::vector<std::pair<int,int> > &matchedtracks, const std::vector<std::vector<mrdcell*> > &allpaddletracks, const std::string horv);
bool SearchForClusterInTracks(const std::vector<std::pair<int,int> > &matchedtracks, const std::vector<std::vector<mrdcell*> > &allpaddletracks, const std::vector<mrdcell*> tracktotest, const std::string horv);
void FillStaticMembers();
// Default Constructor
// ====================
public:
// Default constructor that initialises all private members required for ROOT classes
cMRDSubEvent();
// destructor
~cMRDSubEvent();
// Actual Constructor
// ==================
cMRDSubEvent(Int_t mrdsubevent_idin, std::string wcsimefilein, Int_t runidin, Int_t eventidin,
Int_t triggerin, std::vector<Int_t> digitidsin, std::vector<Int_t> digittubesin, std::vector<Double_t>
digitqsin, std::vector<Double_t> digittimesin, std::vector<Int_t> digitnumphotsin, std::vector<Double_t>
digitstruetimesin, std::vector<Int_t> digitsparentsin, std::vector<std::pair<TVector3,TVector3>>
truetrackverticesin, std::vector<Int_t> truetrackpdgsin);
// Drawing
// =======
void DrawMrdCanvases();
void DrawTrueTracks();
void DrawTracks();
static Bool_t fillstaticmembers;
static TCanvas* imgcanvas;
static TText* titleleft;
static TText* titleright;
static std::vector<TBox*> paddlepointers;
void ComputePaddleTransformation (const Int_t copyNo, TVector3 &origin, Bool_t &ishpaddle);
static std::vector<Int_t> aspectrumv;
static std::vector<std::string> colorhexes;
static std::vector<EColor> trackcolours;
void RemoveArrows();
// Required by ROOT
// ================
void Clear();
// End class definition
// ====================
ClassDef(cMRDSubEvent,1); // INCREMENT VERSION NUM EVERY TIME CLASS MEMBERS CHANGE
};
#endif
| [
"moflaher@fnal.gov"
] | moflaher@fnal.gov |
4732591f0dc2f1a0324f51f084f0e2c24e19bd75 | 81b759c001522e4823d0e56dfdbc56b221673536 | /main_JSON.cpp | 8358516be64886a0e19d7d815b3995b021e5dfa4 | [] | no_license | elisimmonds/JSON-to-HTML-Parser | f0f27c12a0056d568b34f84aa25a495c1663e52f | b3861d1ad0bebf366adfc9e3ffec674b345bda1c | refs/heads/master | 2016-09-13T15:11:44.965380 | 2016-05-23T21:05:41 | 2016-05-23T21:05:41 | 59,517,883 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,944 | cpp | // Eli Simmonds
// Project 3
// main_JSON.cpp
#include <iostream>
#include <fstream>
#include <stdlib.h>
#include <vector>
#include <sstream>
#include <fstream>
#include <string>
#include <ostream>
#include "JSONDataObject.hpp"
#include "JSONDataItem.hpp"
#include "JSONArray.hpp"
#include "Tracks.hpp"
#include "Artists.hpp"
#include "Albums.hpp"
#include "ArtistImages.hpp"
#include "AlbumImages.hpp"
int main() {
// load the tracks
Tracks *tr = new Tracks();
std::string fileName = "JSON_files/tracks.json";
tr->loadTracksFromFile(fileName);
// load the artists
Artists *ar = new Artists();
std::string artFile = "JSON_files/artists.json";
ar->loadArtistsFromFile(artFile);
// load the albums
Albums *al = new Albums();
std::string albFile = "JSON_files/albums.json";
al->loadAlbumsFromFile(albFile);
al->setTracksForAlbums(tr); // set the tracks for each album
ar->setAlbumsForArtists(al); // set the albums for each artist
al->setAlbumsArtist(ar); // set the artist for each album
// load artist images
ArtistImages *ai = new ArtistImages();
std::string artImFile = "JSON_files/artistImages.json";
ai->loadImagesFromFile(artImFile);
// load album images
AlbumImages *ali = new AlbumImages();
std::string albImFile = "JSON_files/albumImages.json";
ali->loadImagesFromFile(albImFile);
al->setImagesForAlbums(ali); // use all album images to set the images for each album
ar->setImagesForArtists(ai); // set the images for each artist
// ar->print();
std::fstream artistFile ("HTML_templates/artist_template.html"); // open the track file
std::stringstream artBuffer; // create a stream to get the file data
artBuffer << artistFile.rdbuf(); // read the data from the file into the stream
std::string artist_data = artBuffer.str(); // taking data from the stream and making it a string
std::string artist_html = ar->htmlString();
// this creates the artists main page.
int art_idx = artist_data.find("<\% artist_details \%>"); // find the chars track to replace
int title_idx = artist_data.find("<\% artist_name \%>"); // find the chars track to replace
std::string artistOutput = artist_data.replace(art_idx, 20, artist_html); //
std::string artString = "Artists"; // title for the page
artistOutput = artist_data.replace(title_idx, 17, artString); // replace the tempalte info
std::ofstream artistHTML; // create ofstream
artistHTML.open("artists.html"); // open the ofstream with this name
if (!artistHTML.is_open()) // check if open.
std::cout << "error opening artist.html" << std::endl;
artistHTML << artistOutput; // slap the html in there
artistHTML.close(); // close stream
// This section creates the individual album HTML pages.
std::fstream albumFile ("HTML_templates/album_template.html"); // use the template
std::stringstream albBuffer; // create a string stream to find the string
std::ofstream albumHTML; // create ofstream to open a file for html
albBuffer << albumFile.rdbuf(); // read in the template
std::string album_data = albBuffer.str(); // set the data to a string
title_idx = album_data.find("<\% album_name \%>"); // find the chars to replace
int alb_idx = album_data.find("<\% album_details \%>"); // fimd title to replace
for (int i = 0; i < al->numAlbums(); i++) {
std::string albumTitle = al->listOfAlbums()->at(i)->title(); // set current title
std::string album_html = al->listOfAlbums()->at(i)->htmlString(); // set current html
std::string albumOutput = album_data.replace(alb_idx, 20, album_html); //replace with html
albumOutput = album_data.replace(title_idx, 16, albumTitle); // replace with title
std::string fileName = "./html_albums/"; // specify where to drop the file.
fileName += std::to_string(al->listOfAlbums()->at(i)->albumID()); // concatinate with title
fileName += ".html"; // add extrension
albumHTML.open(fileName); // open the new filename
albumHTML << albumOutput; // slap the html in there
albumHTML.close(); // close the stream
album_data = albBuffer.str(); // reset the album data.
}
/* for testing purposes only. Tests the destuctors functionality
std::cout << "trackCount: " << trackRefCount << std::endl;
std::cout << "albumCount: " << albumRefCount << std::endl;
std::cout << "artistCount: " << artRefCount << std::endl;
std::cout << "artistImageCount: " << artImageRefCount << std::endl;
std::cout << "albumImageCount: " << albImageRefCount << std::endl;
std::cout << "Deleting artists" << std::endl;
delete ar;
std::cout << "trackCount: " << trackRefCount << std::endl;
std::cout << "albumCount: " << albumRefCount << std::endl;
std::cout << "artistCount: " << artRefCount << std::endl;
std::cout << "artistImageCount: " << artImageRefCount << std::endl;
std::cout << "albumImageCount: " << albImageRefCount << std::endl;
*/
return 0;
};
| [
"eli.simmonds@gmail.com"
] | eli.simmonds@gmail.com |
4aeadfa93aaad09b3d9e2317dd585e608736be25 | 8675ec9577e2e2b23d866bb85631989e619a3b55 | /modules/canbus/vehicle/ch/protocol/brake_status__511_test.cc | 86a9878f462267ff15ace5ceeec27cbf9573c340 | [
"Apache-2.0"
] | permissive | AuroAi/apollo | c1e31dca34a7f5a77d8db76a4bd138f0e23ef888 | 9d2b2c76ea2d6448c1e6fead5336b9c273663a84 | refs/heads/master | 2020-07-15T01:34:36.682593 | 2019-08-30T17:47:35 | 2019-08-30T19:24:29 | 205,447,888 | 10 | 4 | Apache-2.0 | 2020-02-13T01:17:01 | 2019-08-30T19:51:27 | C++ | UTF-8 | C++ | false | false | 1,993 | cc | /******************************************************************************
* Copyright 2019 The Apollo Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*****************************************************************************/
#include "modules/canbus/vehicle/ch/protocol/brake_status__511.h"
#include "gtest/gtest.h"
namespace apollo {
namespace canbus {
namespace ch {
class Brakestatus511Test : public ::testing::Test {
public:
virtual void SetUp() {}
};
TEST_F(Brakestatus511Test, General) {
uint8_t data[8] = {0x01, 0x02, 0x01, 0x00, 0x01, 0x01, 0x00, 0x01};
int32_t length = 8;
ChassisDetail cd;
Brakestatus511 brake;
brake.Parse(data, length, &cd);
EXPECT_EQ(data[0], 0b00000001);
EXPECT_EQ(data[1], 0b00000010);
EXPECT_EQ(data[2], 0b00000001);
EXPECT_EQ(data[3], 0b00000000);
EXPECT_EQ(data[4], 0b00000001);
EXPECT_EQ(data[5], 0b00000001);
EXPECT_EQ(data[6], 0b00000000);
EXPECT_EQ(data[7], 0b00000001);
EXPECT_EQ(cd.ch().brake_status__511().brake_pedal_en_sts(), 1);
EXPECT_EQ(cd.ch().brake_status__511().brake_pedal_sts(), 2);
EXPECT_EQ(cd.ch().brake_status__511().brake_err(), 1);
EXPECT_EQ(cd.ch().brake_status__511().emergency_btn_env(), 0);
EXPECT_EQ(cd.ch().brake_status__511().front_bump_env(), 1);
EXPECT_EQ(cd.ch().brake_status__511().back_bump_env(), 1);
EXPECT_EQ(cd.ch().brake_status__511().overspd_env(), 0);
}
} // namespace ch
} // namespace canbus
} // namespace apollo
| [
"qi.stephen.luo@gmail.com"
] | qi.stephen.luo@gmail.com |
249e6eaee0d0ad6264bd92bc5078ec7aa38162d3 | e79cc11c4fa65ae83f9a0a83a88b42307ec0e276 | /Ancien ubuntu/tp7C++/main.cpp | ae769c090d1061eb29443992d046e432cb75815b | [] | no_license | Rob-Mat94/Compilateur-C | 89a1bb482a736a6ddb603ae30839be3d30023c29 | 645512072783ea403f1e37dc00ea6fca982e07ee | refs/heads/master | 2023-05-31T14:51:05.520352 | 2021-07-04T10:24:53 | 2021-07-04T10:24:53 | 382,822,321 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,703 | cpp | #include <stdio.h>
#include <iostream>
#include "Image.hpp"
#include "Ligne.hpp"
#include "Cercle.hpp"
#include "Filtrage.hpp"
void testPoint(void);
void testCercle(void);
void testLigne(void);
void testImage(void);
int main(void)
{
/* testPoint();
testLigne();
testCercle();
testImage();
*/
Filtrage::essai();
return 0;
}
void testPoint(void)
{
Point x;
Point y(10, 20);
cout << x << y << endl;
Point z = x + y;
cout << z << endl;
z += y;
cout << z << endl;
}
void testLigne(void)
{
Ligne l1(Point(10, 20), Point(16, 30));
l1.dessiner();
cout << "Translation(5,8)" << endl;
l1.deplacer(Point(5,8));
l1.dessiner();
}
void testCercle(void)
{
Cercle c1(Point(10, 20), 22);
c1.dessiner();
cout << "Translation(5,8)" << endl;
c1.deplacer(Point(5,8));
c1.dessiner();
}
void testImage(void)
{
Ligne l1(Point(10, 20), Point(16, 30));
Cercle c1 ( Point (10, 20), 22 );
Image i1;
cout << "image no 1 = ligne no 1 + cercle n� 1" << endl;
i1.ajouter(l1);
i1.ajouter(c1);
i1.dessiner();
cout << "Translation(40,50)" << endl;
l1.deplacer(Point(40, 50));
i1.dessiner();
cout << "image no 1 += image no 1" << endl;
i1.ajouter(i1);
i1.dessiner();
cout << "Translation(11,13)" << endl;
c1.deplacer(Point(11, 13));
i1.dessiner();
cout << "Translation(15,40)" << endl;
i1.deplacer(Point(15, 40));
i1.dessiner();
Image i2;
cout << "image no 2 = image no 1 + ligne no 1" << endl;
i2.ajouter(i1);
i2.ajouter(l1);
i2.dessiner();
cout << "Translation(150,400)" << endl;
i2.deplacer(Point(150, 400));
i2.dessiner();
Image i3;
cout << "image no 2 = image no 1 + ligne no 1" << endl;
i3.ajouter(i1);
i3.ajouter(i2);
i3.dessiner();
}
| [
"robin.matheus@etu.u-pec.fr"
] | robin.matheus@etu.u-pec.fr |
908aacae396fd83ee2e5b285f1299699b4e914e3 | b3ef49c633c26fe60d180061d8f7cb436666b31c | /src/DriveTrain.cpp | 6cbf5e20dd70b19ba4525d7b66ccbc1933f61665 | [] | no_license | vanshajc/RBE2002 | 47567717dc9786f392cbee3cebabe8b96088ae35 | 5fc0186f453652c00ddc58cf6a72102a555a2fdd | refs/heads/master | 2021-05-01T04:48:33.294444 | 2016-12-02T20:43:30 | 2016-12-02T20:43:30 | 45,136,207 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,191 | cpp | #include "DriveTrain.h"
#include "pins.h"
DriveTrain::DriveTrain() :le(kLeftEncoderA,kLeftEncoderB), re(kRightEncoderA,kRightEncoderB) {
point.x = 0;
point.y = 0;
}
void DriveTrain::initialize(){
}
/**
* Drive the two motors to the given speeds (-255 to 255).
* @param left the duty cycle sent to the left motor
* @param right the duty cycle sent to the right motor
*/
void DriveTrain::drive(int left, int right){
if (left < 0){
analogWrite(kLeftMotorB,left);
analogWrite(kLeftMotorA, 0);
}
else{
analogWrite(kLeftMotorB, 0);
analogWrite(kLeftMotorA,left);
}
if (right < 0){
analogWrite(kLeftMotorB, right);
analogWrite(kLeftMotorA, 0);
}
else{
analogWrite(kLeftMotorA, right);
analogWrite(kLeftMotorB, 0);
}
}
/**
* Drive the robot.
* @param forwardSpeed the speed of the motors for forward (-1 to 1)
* @param turnRate the rate for which the robot needs to turn (-1 to 1)
*/
void DriveTrain::driveArcade(double forwardSpeed, double turnRate) {
int leftSpeed = 255*forwardSpeed - 255*turnRate;
int rightSpeed = 255*forwardSpeed + 255*turnRate;
drive(leftSpeed, rightSpeed);
}
void DriveTrain::turnLeft() {
}
void DriveTrain::kill(){
drive(0, 0);
exit(0);
}
Point DriveTrain::getDistanceTraveled(){
Point p;
Point prev;
prev.x = 0;
prev.y = 0;
Serial.print(le.read());
Serial.println(re.read());
double n = ((le.read() - prev.x) - (re.read() - prev.y))/(3200*2) * 8.95;
// incorporate angle here
p.x = n;
p.y = 0;
prev.x = le.read();
prev.y = re.read();
return p;
}
void DriveTrain::updateCoordinates(){
Point p = getDistanceTraveled();
point.x += p.x;
point.y += p.y;
}
void DriveTrain::displayCoordinates(){
char s[16];
Serial.println(point.x);
Serial.println(point.y);
Serial.println("-----");
sprintf(s, "X = %d, Y = %d", point.x, point.y);
//lcd.print("X = ");
//lcd.print(current.x);
//lcd.setCursor(0, 1);
//lcd.print("Y = ");
//lcd.print(current.y);
Serial.println(s);
//lcd.print(s);
}
void DriveTrain::forward(){
int initialDifference = 0;
double turnRate = (le.read() + re.read() - initialDifference)*0.015;
driveArcade(1, turnRate);
}
| [
"k.puczydlowski@gmail.com"
] | k.puczydlowski@gmail.com |
f9716b2ec4c0a165c0137359c76b200b02ef6dd2 | 50de7f977f3d60fa3ea7df2b908be49d8ca44083 | /C++/C++/templates/template_fun.cpp | d62f2208b076e31dc7a216c7d11a2ef623c66095 | [
"Apache-2.0"
] | permissive | unmeshvrije/C-- | e559b2806af0a5e14ce233bc8ba1c55aadd2659a | 361616849313155b34afc68769f6bb121bafdac0 | refs/heads/master | 2022-12-24T05:54:39.053431 | 2022-12-12T16:20:34 | 2022-12-12T16:20:34 | 12,909,247 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 843 | cpp | #include <iostream>
#include <typeinfo>
#include <cstring>
using namespace std;
template <typename Generic>
Generic Min(Generic a, Generic b)
{
if (
typeid(Generic) == typeid(char*)
)
{
// cout << "typeid pass" << endl;
int iRet = strcmp(a,b);
if(iRet < 0)
return a;
return b;
}
else
{
if (a < b)
return a;
return b;
}
}
int main()
{
int a = 4, b = 6;
float c = 3.34, d = 7.545;
char e = 'E', f = 'F';
char str1[] = "abcd";
char str2[] = "abce";
//This causes template instantiation.
cout << Min<char*>(str1,str2);
cout << endl;
/* cout << "Min of integers = ";
cout << Min<int>(a,b);
cout << endl;
cout << "Min of floats = " << Min<float>(c,d);
cout << endl;
cout << "Min of chars = " << Min<char>(e,f);
cout << endl;*/
return 0;
}
| [
"unmesh@unmesh-laptop.(none)"
] | unmesh@unmesh-laptop.(none) |
81144505bc65dc9def7a6c3429e0eabfa4a6fe77 | fb99c5ca73adb5857a462a98329d5c8753a9cb13 | /open/rts/config.h | c0052123493a7fe104c084837c58df8d4380db59 | [] | no_license | luqui/soylent | f82ff00cdf76b426c2c3580e9c432bcb48715358 | 94bbe25a1b93a30e94e2ab072f792bb273da3b06 | refs/heads/master | 2021-01-22T03:44:15.546888 | 2009-06-24T20:08:55 | 2009-06-24T20:08:55 | 113,045 | 2 | 3 | null | null | null | null | UTF-8 | C++ | false | false | 368 | h | #ifndef __CONFIG_H__
#define __CONFIG_H__
#ifdef WIN32
#include <windows.h>
#endif
#include <list>
typedef double num;
const num DT = 1/30.0;
class Board;
extern Board BOARD;
class SoyInit;
extern SoyInit INIT;
class Dust;
extern Dust DUST;
class Scheduler;
extern Scheduler SCHEDULER;
class Unit;
extern std::list<Unit*> UNITS;
extern num GAMETIME;
#endif
| [
"luqui@94b1653a-ed48-0410-b77d-b6a479af8a11"
] | luqui@94b1653a-ed48-0410-b77d-b6a479af8a11 |
61a651b0bd7370e44ec3abfa709c16d359eb7e2b | 82e22dbe26c9c69ba2ef149d0d4554bd36b3aa00 | /test/tests/issue0012.cpp | 626f4cc111e4d50071fa93a16731ad72b9f08027 | [
"BSL-1.0",
"Apache-2.0"
] | permissive | hyeongyukim/outcome | 87f2272198c554cf498df793b9d0dc473dceda08 | 38b9d4f4ab62672221a1d77d51c8bbba8acf8471 | refs/heads/master | 2022-02-11T17:36:06.756960 | 2019-09-25T23:00:32 | 2019-09-25T23:00:32 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,983 | cpp | /* Unit testing for outcomes
(C) 2013-2019 Niall Douglas <http://www.nedproductions.biz/> (5 commits)
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 in the accompanying file
Licence.txt or 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.
Distributed under the Boost Software License, Version 1.0.
(See accompanying file Licence.txt or copy at
http://www.boost.org/LICENSE_1_0.txt)
*/
#include "../../include/outcome/outcome.hpp"
#include "quickcpplib/boost/test/unit_test.hpp"
BOOST_OUTCOME_AUTO_TEST_CASE(issues / 12, "outcome's copy assignment gets instantiated even when type T cannot be copied")
{
using namespace OUTCOME_V2_NAMESPACE;
const char *s = "hi";
struct udt // NOLINT
{
const char *_v{nullptr};
udt() = default;
constexpr explicit udt(const char *v) noexcept : _v(v) {}
constexpr udt(udt &&o) noexcept : _v(o._v) { o._v = nullptr; }
udt(const udt &) = delete;
constexpr udt &operator=(udt &&o) noexcept
{
_v = o._v;
o._v = nullptr;
return *this;
}
udt &operator=(const udt &) = delete;
constexpr const char *operator*() const noexcept { return _v; }
};
static_assert(std::is_move_constructible<outcome<udt>>::value, "expected<udt> is not move constructible!");
static_assert(!std::is_copy_constructible<outcome<udt>>::value, "expected<udt> is copy constructible!");
outcome<udt> p(udt{s}), n(std::error_code(ENOMEM, std::generic_category()));
n = std::error_code(EINVAL, std::generic_category());
BOOST_CHECK(n.error().value() == EINVAL);
}
| [
"spamtrap@nedprod.com"
] | spamtrap@nedprod.com |
419262ca9565d4f1cd9d6e1dbec014e1eee0fada | 679753a2818f33701789453f57240429c62df4ec | /deps/donet/include/bsd/net_bsd.h | be478464664f9f26ebfbe5d70fac303e92c967e7 | [] | no_license | zmyer/Katrina | 39495c38d30d3fe0ce0b926efd4ab97c389e9185 | 4fd5b55a52d2bf8065e1200d97dd3e42f4a824c6 | refs/heads/master | 2021-01-12T03:31:24.392757 | 2017-01-15T14:28:43 | 2017-01-15T14:28:43 | 78,224,205 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 266 | h | //
// Created by StevensChew on 17/1/11.
//
#ifndef KATRINA_NET_BSD_H
#define KATRINA_NET_BSD_H
#include <sys/_types/_int32_t.h>
namespace donet {
typedef int32_t NativeSocket;
typedef struct sockaddr_in NativeSocketAddress;
}
#endif //KATRINA_NET_BSD_H
| [
"zhouwei198732@126.com"
] | zhouwei198732@126.com |
05b5e90dad84c9e14cd1a0f1cc346bccbe84dc34 | e91b16ab1799a614282fb0260ca696ddb6143b16 | /LeetCode/q0032_LongestValidParentheses.cpp | cb88897edd2ffd45906632408fff8470a19b25a4 | [] | no_license | bluesquanium/Algorithm | cde3b561aa05413fcd61fe5ce013fe3e8c122a9c | 9d87cbc4efc5a3382376fc74b82915832659e97b | refs/heads/master | 2022-06-24T10:55:58.011128 | 2022-05-29T09:50:58 | 2022-05-29T09:50:58 | 174,677,803 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 1,158 | cpp | // '(': 100001, ')': 100002
#define ll int
#define L 100001
#define R 100002
class Solution {
public:
int longestValidParentheses(string s) {
ll ans = 0;
vector<ll> st;
for(ll i =0; i < s.size(); i++) {
if(s[i] == '(') {
st.push_back(L);
}
// ')'
else {
bool check = 0;
ll temp = 0;
while(!st.empty()) {
ll cur = st.back(); st.pop_back();
if(cur == L) {
check= 1;
temp += 2;
break;
} else {
temp += cur;
}
}
ans = max(ans, temp);
if(check) {
if(!st.empty() && st.back() != L) {
temp += st.back();
st.pop_back();
}
st.push_back(temp);
ans = max(ans, temp);
}
}
}
return ans;
}
}; | [
"culater.kwak@samsung.com"
] | culater.kwak@samsung.com |
18ad09fa0fa33dfce33db2568520d7b6ec82398e | 75a574cc626abb6106d749cc55c7acd28e672594 | /Test2/MRIntegerTest.cpp | 58a3a3c37753d91d6785ad49275a362ce4ae6d9d | [] | no_license | PeterGH/temp | 6b247e0f95ac3984d61459e0648421253d11bdc3 | 0427b6614880e8c596cca0350a02fda08fb28176 | refs/heads/master | 2020-03-31T16:10:30.114748 | 2018-11-19T03:48:53 | 2018-11-19T03:48:53 | 152,365,449 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,022 | cpp | #include "MRIntegerTest.h"
#include "..\Algorithm\MRInteger.h"
#include "..\Algorithm\RadixSort.h"
#include <vector>
void MRIntegerTest::Init(void)
{
Add("Random", [&]() {
unsigned int b[] = {1, 2, 4, 8, 16, 32};
My::MRInteger mri(b, 6);
std::vector<My::MRInteger> numbers;
for (int i = 0; i < 30000; i ++) {
mri.Random();
numbers.push_back(My::MRInteger(mri));
}
sort(numbers.begin(), numbers.end());
// for_each (numbers.begin(), numbers.end(), [](My::MRInteger & it) {
// for (int j = it.Length() - 1; j >= 0; j --) {
// cout << "\t" << it[j];
// }
// cout << endl;
// });
ASSERT1(std::is_sorted(numbers.begin(), numbers.end(), [](const My::MRInteger & second, const My::MRInteger & first) {
if (second < first) {
for (int j = first.Length() - 1; j >= 0; j --) {
cout << "\t" << first[j];
}
cout << endl;
for (int j = second.Length() - 1; j >= 0; j --) {
cout << "\t" << second[j];
}
cout << endl;
return true;
} else {
return false;
}
}));
});
Add("RadixSort", [&]() {
unsigned int b[] = {1, 2, 4, 8, 16, 32};
My::MRInteger mri(b, 6);
std::vector<My::MRInteger> numbers;
for (int i = 0; i < 30000; i ++) {
mri.Random();
numbers.push_back(My::MRInteger(mri));
}
My::RadixSort::Sort(numbers);
for_each (numbers.begin(), numbers.end(), [](My::MRInteger & it) {
for (int j = it.Length() - 1; j >= 0; j --) {
cout << "\t" << it[j];
}
cout << endl;
});
ASSERT1(std::is_sorted(numbers.begin(), numbers.end(), [](const My::MRInteger & second, const My::MRInteger & first) {
if (second < first) {
for (int j = first.Length() - 1; j >= 0; j --) {
cout << "\t" << first[j];
}
cout << endl;
for (int j = second.Length() - 1; j >= 0; j --) {
cout << "\t" << second[j];
}
cout << endl;
return true;
} else {
return false;
}
}));
});
}
| [
"peteryzufl@gmail.com"
] | peteryzufl@gmail.com |
93c6912bd6e14913d8252d4c7d142eb2e3ccd031 | 99acb9c056de6a1ae945a8145eaa451b209266d3 | /GráficasComputacionales/Employee.h | 2cb5f09be95739ebc76436339ac660068c2556aa | [] | no_license | CrzHctr/Graficas_Computacionales | ae374e69085bb4cf5fa604109afed555eeb74e06 | e08710cf9f401bccdb7dedde8f1060e02765d898 | refs/heads/master | 2021-01-21T12:01:00.293979 | 2017-11-27T18:05:22 | 2017-11-27T18:05:22 | 102,018,730 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 448 | h | #pragma once
#include <string>
class Employee {
public:
Employee(int id, std::string firstName, std::string lastName, int salary);
int GetID();
std::string GetFirstName();
std::string GetLastName();
std::string GetName();
int GetSalary();
int GetAnnualSalary();
void SetSalary(int salary);
int RaiseSalary(int percent);
std::string Print();
private:
int _id;
std::string _firstName;
std::string _lastName;
int _salary;
};
| [
"h.cruz.dorantes@gmail.com"
] | h.cruz.dorantes@gmail.com |
6ce279b7681c7267feeec66549547c043635ea61 | a910c0cc7a93da9725ac31b67b1ecaf95e21b781 | /hw5/src/StudentDemoProject.cpp | b0e995a2452b0efe5e546b8611b1d1a9e838b7ce | [] | no_license | T-Goon/2303-Systems-Programming-Concepts | e04fd214efa394760032b49244ff006f3b958f29 | c57c28ecc96a6bb921055d5f82b05b85ac7605c5 | refs/heads/master | 2023-05-12T04:39:03.595614 | 2021-06-03T21:20:32 | 2021-06-03T21:20:32 | 236,372,302 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,721 | cpp | //============================================================================
// Name : StudentDemoProject.cpp
// Author : Timothy Goon, Patrick Houlihan
// Version : 1
// Copyright : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================
#include <iostream>
#include <vector>
#include <cstdio>
#include "Student.h"
// Finds the students with the GPA < 1
std::vector<Student> find_failing_students(const std::vector<Student> &students) {
std::vector<Student> failing_students;
for(auto student : students){
if(student.gpa() < 1){
failing_students.push_back(student);
}
}
return failing_students;
}
// Prints out the info for all the students in the vector
void print_students(const std::vector<Student> &students){
for(auto student : students){
student.print_info();
}
}
/**
* Allows the user to enter information for multiple students, then
* find those students whose GPA is below 1.0 and prints them to the
* screen.
*/
int main() {
std::string first_name, last_name;
float gpa;
int id;
char repeat;
std::vector<Student> students;
FILE* file = fopen("NewsiesStaff.txt", "r");
int numStudents;
fscanf(file, "%d", &numStudents);
char first[50];
char last[50]; float grade; int ID;
int temp1, temp2, temp3, temp4, temp5, temp6, temp7;
char temp8[50];
for(int i=0; i< numStudents; i++){
fscanf(file, "%s %s %f %d %d %d %d %d %d %d %d %s", first, last, &grade, &ID, &temp1, &temp2, &temp3, &temp4, &temp5, &temp6, &temp7, temp8);
std::string firstS = std::string(first);
std::string lastS = std::string(last);
students.emplace_back(Student(firstS, lastS, grade, ID));
}
fclose(file);
do {
std::cout << "Enter student's first name: ";
std::cin >> first_name;
std::cout << "Enter student's last name: ";
std::cin >> last_name;
gpa = -1;
while (gpa < 0 || gpa > 4) {
std::cout << "Enter student's GPA (0.0-4.0): ";
std::cin >> gpa;
}
std::cout << "Enter student's ID: ";
std::cin >> id;
students.emplace_back(Student(first_name, last_name, gpa, id));
std::cout << "Add another student to database (Y/N)? ";
std::cin >> repeat;
} while (repeat == 'Y' || repeat == 'y');
printf("Students:\n");
print_students(students);
printf("\n");
printf("Failing Students:\n");
std::vector<Student> failing = find_failing_students(students);
print_students(failing);
printf("\n");
return 0;
}
| [
"t.kgoonx@gmail.com"
] | t.kgoonx@gmail.com |
a59360fcf81c53b3316b720901fda7ee24465ddb | 6be1c51c980e8906406762fe3c7b59ca6c09faaf | /SimpleKBot/KBotDrive.cpp | a086b75458bb2ac738955e38cad84771b0f2bb35 | [] | no_license | woodk/SimpleKBot | 4aed0122fa8a8e4b49bff3a966c31af85a6cd87f | 4433bd1ca71c3b39460032279dea4c089aa1eb04 | refs/heads/master | 2021-01-01T18:07:55.574893 | 2011-01-07T19:37:40 | 2011-01-07T19:37:40 | 1,035,746 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 6,724 | cpp | /*----------------------------------------------------------------------------*/
/* Copyright (c) KBotics 2010. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. */
/*----------------------------------------------------------------------------*/
#include "KBotDrive.h"
#include "GenericHID.h"
KBotDrive::KBotDrive(UINT32 leftMotorChannel, UINT32 rightMotorChannel) : RobotDrive(leftMotorChannel, rightMotorChannel){;}
KBotDrive::KBotDrive(UINT32 frontLeftMotorChannel, UINT32 rearLeftMotorChannel,
UINT32 frontRightMotorChannel, UINT32 rearRightMotorChannel) : RobotDrive(frontLeftMotorChannel, rearLeftMotorChannel, frontRightMotorChannel, rearRightMotorChannel){;}
KBotDrive::KBotDrive(SpeedController *leftMotor, SpeedController *rightMotor) : RobotDrive(leftMotor, rightMotor){;}
KBotDrive::KBotDrive(SpeedController &leftMotor, SpeedController &rightMotor) : RobotDrive(leftMotor, rightMotor){;}
KBotDrive::KBotDrive(SpeedController *frontLeftMotor, SpeedController *rearLeftMotor,
SpeedController *frontRightMotor, SpeedController *rearRightMotor)
: RobotDrive(frontLeftMotor, rearLeftMotor, frontRightMotor, rearRightMotor){;}
KBotDrive::KBotDrive(SpeedController &frontLeftMotor, SpeedController &rearLeftMotor,
SpeedController &frontRightMotor, SpeedController &rearRightMotor)
: RobotDrive(frontLeftMotor, rearLeftMotor, frontRightMotor, rearRightMotor){;}
/**
* Arcade drive implements single stick driving.
* Given a single Joystick, the class assumes the Y axis for the move value and the X axis
* for the rotate value.
* (Should add more information here regarding the way that arcade drive works.)
* @param stick The joystick to use for Arcade single-stick driving. The Y-axis will be selected
* for forwards/backwards and the X-axis will be selected for rotation rate.
* @param squaredInputs If true, the sensitivity will be increased for small values
*/
void KBotDrive::ArcadeDrive(GenericHID *stick, bool squaredInputs)
{
// simply call the full-featured ArcadeDrive with the appropriate values
ArcadeDrive(stick->GetY(), stick->GetX(), stick->GetTrigger());
}
/**
* Arcade drive implements single stick driving.
* Given a single Joystick, the class assumes the Y axis for the move value and the X axis
* for the rotate value.
* (Should add more information here regarding the way that arcade drive works.)
* @param stick The joystick to use for Arcade single-stick driving. The Y-axis will be selected
* for forwards/backwards and the X-axis will be selected for rotation rate.
* @param squaredInputs If true, the sensitivity will be increased for small values
*/
void KBotDrive::ArcadeDrive(GenericHID &stick, bool squaredInputs)
{
// simply call the full-featured ArcadeDrive with the appropriate values
ArcadeDrive(stick.GetY(), stick.GetX(), stick.GetTrigger());
}
/**
* Arcade drive implements single stick driving.
* Given two joystick instances and two axis, compute the values to send to either two
* or four motors.
* @param moveStick The Joystick object that represents the forward/backward direction
* @param moveAxis The axis on the moveStick object to use for fowards/backwards (typically Y_AXIS)
* @param rotateStick The Joystick object that represents the rotation value
* @param rotateAxis The axis on the rotation object to use for the rotate right/left (typically X_AXIS)
* @param squaredInputs Setting this parameter to true increases the sensitivity at lower speeds
*/
void KBotDrive::ArcadeDrive(GenericHID* moveStick, UINT32 moveAxis,
GenericHID* rotateStick, UINT32 rotateAxis,
bool squaredInputs)
{
float moveValue = moveStick->GetRawAxis(moveAxis);
float rotateValue = rotateStick->GetRawAxis(rotateAxis);
ArcadeDrive(moveValue, rotateValue, squaredInputs);
}
/**
* Arcade drive implements single stick driving.
* Given two joystick instances and two axis, compute the values to send to either two
* or four motors.
* @param moveStick The Joystick object that represents the forward/backward direction
* @param moveAxis The axis on the moveStick object to use for fowards/backwards (typically Y_AXIS)
* @param rotateStick The Joystick object that represents the rotation value
* @param rotateAxis The axis on the rotation object to use for the rotate right/left (typically X_AXIS)
* @param squaredInputs Setting this parameter to true increases the sensitivity at lower speeds
*/
void KBotDrive::ArcadeDrive(GenericHID &moveStick, UINT32 moveAxis,
GenericHID &rotateStick, UINT32 rotateAxis,
bool squaredInputs)
{
float moveValue = moveStick.GetRawAxis(moveAxis);
float rotateValue = rotateStick.GetRawAxis(rotateAxis);
ArcadeDrive(moveValue, rotateValue, squaredInputs);
}
/**
* Arcade drive implements single stick driving.
* This function lets you directly provide joystick values from any source.
* @param moveValue The value to use for fowards/backwards
* @param rotateValue The value to use for the rotate right/left
* @param squaredInputs If set, increases the sensitivity at low speeds
*/
void KBotDrive::ArcadeDrive(float moveValue, float rotateValue, bool squaredInputs)
{
// local variables to hold the computed PWM values for the motors
float leftMotorSpeed;
float rightMotorSpeed;
moveValue = Limit(moveValue);
rotateValue = Limit(rotateValue);
if (squaredInputs)
{
// square the inputs (while preserving the sign) to increase fine control while permitting full power
if (moveValue >= 0.0)
{
moveValue = (moveValue * moveValue);
}
else
{
moveValue = -(moveValue * moveValue);
}
if (rotateValue >= 0.0)
{
rotateValue = (rotateValue * rotateValue);
}
else
{
rotateValue = -(rotateValue * rotateValue);
}
}
leftMotorSpeed = moveValue - rotateValue;
rightMotorSpeed = moveValue + rotateValue;
// Modify reverse so that back-left goes back-left and back-right goes back-right
if (moveValue<0) { // Joystick backwards (NOTE: < not > for new robot)
leftMotorSpeed += 2*moveValue*rotateValue;
rightMotorSpeed -= 2*moveValue*rotateValue;
}
if (leftMotorSpeed>0.95)
leftMotorSpeed=1.0;
if (leftMotorSpeed<-0.95)
leftMotorSpeed=-1.0;
if (rightMotorSpeed>0.95)
rightMotorSpeed=1.0;
if (rightMotorSpeed<-0.95)
rightMotorSpeed=-1.0;
SetLeftRightMotorOutputs(leftMotorSpeed, rightMotorSpeed);
m_fLeftSpeed = leftMotorSpeed;
m_fRightSpeed = rightMotorSpeed;
}
| [
"woodk@limestone.on.ca"
] | woodk@limestone.on.ca |
2dbcc32031116ff660d57f939ca214a7d29b8427 | 7a68a9c3473feceb613dbc0b390e4b02a276f460 | /leetcode/medium/1026_maximum_difference_between_node_and_ancestor.cpp | 64c5dd6c0c06ba12b32b9ea9d92ff4a600b002e1 | [] | no_license | pzins/Programming | 88cab57200921c1fd9a44568162463f4f0f5e3ab | 45e1466fcf28933aa8a3c85ee8590430ced90db4 | refs/heads/master | 2023-07-20T09:56:03.379507 | 2023-07-18T15:33:15 | 2023-07-18T15:33:15 | 199,602,171 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 909 | cpp | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode() : val(0), left(nullptr), right(nullptr) {}
* TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
* TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), left(left), right(right) {}
* };
*/
class Solution {
void fct(TreeNode* n, int& maxi, vector<int> others) {
if(n != nullptr)
{
int tmp = 0;
for(int i = 0; i < others.size(); ++i)
{
tmp = max(abs(others[i]-n->val), tmp);
}
maxi = max(tmp, maxi);
others.push_back(n->val);
fct(n->left, maxi, others);
fct(n->right, maxi, others);
}
}
public:
int maxAncestorDiff(TreeNode* root) {
int res = 0;
vector<int> others = {};
fct(root, res, others);
return res;
}
};
| [
"zins.pierre@gmail.com"
] | zins.pierre@gmail.com |
2d8d2071e438ce5b997f57d84d256904f33dc095 | 57c1e16107ae27d7a63e0b853d1d0a54c802061c | /Option 1/6.4/6_4.hpp | d74dd2690cf00929f61621a02a340230adcf2b75 | [] | no_license | Avdeenko-Dasha/1-cours | 31384098e524d8fb4726f466ed5f282c156932e0 | cea2fe36d5033dcf77861b2c938dce37b997df61 | refs/heads/main | 2023-08-24T17:05:38.754163 | 2021-10-11T21:14:43 | 2021-10-11T21:14:43 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 565 | hpp | #pragma once
#include <iostream>
#include <ctime>
#include <iomanip>
using namespace std;
enum WidthValues {
widthNum = 18,
widthSign = 8,
widthOrder = 10,
widthMant = 12,
widthLine = 44,
};
union DoubleUnion {
double num;struct InNumber {
unsigned long long mantissa : 52;
unsigned long long order : 11;
unsigned long long sign : 1;
}numData;
};
void draw_line(int n);
void generateData(DoubleUnion& st);
void output(DoubleUnion& st);
bool compNum(DoubleUnion& number1, DoubleUnion& number2);
| [
"avdeenko.dasha705@gmail.com"
] | avdeenko.dasha705@gmail.com |
cbd3187247cff06ce235e93d98b563d8596a1465 | 6febd920ced70cbb19695801a163c437e7be44d4 | /cpp/concepts/counter_class.cpp | 43fb2c52b47b99baa07151b6fc87c1ecd55ba6af | [] | no_license | AngryBird3/gotta_code | b0ab47e846b424107dbd3b03e0c0f3afbd239c60 | b9975fef5fa4843bf95d067bea6d064723484289 | refs/heads/master | 2021-01-20T16:47:35.098125 | 2018-03-24T21:31:01 | 2018-03-24T21:31:01 | 53,180,336 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 690 | cpp | #include <iostream>
using namespace std;
// see below for a discussion of why
// this isn't quite right
class Counter {
public:
Counter() { ++count; cout << "Counter constructor\n"; }
Counter(const Counter&) { ++count; cout << "Counter copy constructor\n"; }
~Counter() { --count; }
static size_t howMany()
{ return count; }
private:
static size_t count;
};
// This still goes in an
// implementation file
size_t Counter::count = 0;
// inherit from Counter to count objects
class Widget: public Counter {
public:
Widget() { cout << "Widget constructor\n"; }
};
int main() {
Widget w;
cout << "w count: " << w.howMany() << "\n";
return 0;
}
| [
"dhaaraa.darji@gmail.com"
] | dhaaraa.darji@gmail.com |
4a4f68411c93039314ed69d21f62c41cca19afeb | 87afd2b9face99ac5553f6dd4cf9595f754c6650 | /definitivo/GetTheBall/GetTheBall/UserPositionUpdating.cpp | 44df68646c98a1a0c326cfa538bed0bc64fb7b86 | [] | no_license | LauraLaureus/PickTheCow | 5ca3f343d9d1ba03712e9d43763bd311cd9e5ba8 | 97f5f95daf24227f24310e60cdaa349ef17c1aed | refs/heads/master | 2021-01-17T19:51:57.935594 | 2016-06-06T17:00:02 | 2016-06-06T17:00:02 | 60,543,688 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,221 | cpp | #include "UserPositionUpdating.h"
#include "Conversion.h"
#include "Coordinates3DCalculation.h"
UserPositionUpdating::UserPositionUpdating(Game& game)
: game(game) {
}
UserPositionUpdating::UserPositionUpdating(const UserPositionUpdating& userPositionUpdating)
: game(userPositionUpdating.game) {
}
UserPositionUpdating& UserPositionUpdating::operator=(const UserPositionUpdating& userPositionUpdating) {
if (this != &userPositionUpdating) {
this->game = userPositionUpdating.game;
}
return *this;
}
UserPositionUpdating::~UserPositionUpdating() {
}
void UserPositionUpdating::updateUserPositionByCell(int rowIndex, int columnIndex) {
Coordinates3D roomPosition = game.getScene().getRoomXY().getPosition();
Coordinates3D relativePosition = Coordinates3DCalculation(rowIndex, columnIndex, game.getGameArea(), roomPosition.getY()).executeByCells();
updateUserPosition(
Coordinates3D(
roomPosition.getX() + relativePosition.getX(),
roomPosition.getY() + relativePosition.getY(),
roomPosition.getZ() + relativePosition.getZ()));
}
void UserPositionUpdating::updateUserPositionBySubCell(int subRowIndex, int subColumnIndex) {
Coordinates3D roomPosition = game.getScene().getRoomXY().getPosition();
Coordinates3D relativePosition = Coordinates3DCalculation(subRowIndex, subColumnIndex, game.getGameArea(), roomPosition.getY()).executeBySubCells();
updateUserPosition(
Coordinates3D(
roomPosition.getX() + relativePosition.getX(),
roomPosition.getY() + relativePosition.getY(),
roomPosition.getZ() + relativePosition.getZ()));
}
void UserPositionUpdating::updateUserPositionByPoint(int x, int y) {
GameArea gameArea = game.getGameArea();
int subRowIndex = gameArea.getSubRowIndexFromRealWorld(y);
int subColumnIndex = gameArea.getSubColumnIndexFromRealWorld(x);
updateUserPositionBySubCell(subRowIndex, subColumnIndex);
}
void UserPositionUpdating::updateUserPosition(Coordinates3D newPosition) {
Scene scene = game.getScene();
User user = scene.getUser();
Object3D& userObject = user.getObject3D();
userObject.setPosition(newPosition);
user.setObject3D(userObject);
scene.setUser(user);
game.setScene(scene);
}
| [
"l4depende@gmail.com"
] | l4depende@gmail.com |
c8779149159e22946259274d0d309a323b5acc77 | 1b55fa9c97d777be0b84b088cf73fd3f3d8812ae | /7/8.cpp | 221292b8f0d1d59b731b8c6b1e5dfaf9e334a7aa | [] | no_license | arshrapov/abraman_answers | 0e432752ef8e2e924ea2c13f293e52aaf3b8831d | 9cbdf872f9c78f857f9fed9e4b6f955e25c4fada | refs/heads/master | 2022-05-23T14:47:35.601263 | 2020-04-29T16:46:12 | 2020-04-29T16:46:12 | 259,694,937 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 71 | cpp | #include <iostream>
int main () {
using namespace std;
return 0;
}
| [
"ashrapov.rafa@yandex.com"
] | ashrapov.rafa@yandex.com |
48994f22d318a76fdd3a3d048b00faf6c7dfd754 | 1ca99f15544e768da94b3b41467b59ae6d7b4f58 | /sort_window.h | dee7fbb33c0181833b77280f18a6556777ac4ed1 | [] | no_license | napobiao/QT_Graduation | 5287224cfab751be3cd7a5344d5786b759ddc185 | c58d0b2754ec27a0009c8abe5743876672b6f1fe | refs/heads/master | 2021-09-10T01:01:57.208111 | 2018-03-20T12:29:42 | 2018-03-20T12:29:42 | 126,013,215 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 582 | h | #ifndef SORT_WINDOW
#define SORT_WINDOW
#include <QMainWindow>
#include <QDialog>
#include <QPushButton>
class Sort_Window : public QMainWindow
{
Q_OBJECT
public :
Sort_Window(QWidget *parent = 0);
~Sort_Window();
void sleep(unsigned int msec);
void begin_bubble();
void sort_bubble();
void change_bubble();
private:
int x,y,width,height;
int num[10];
QPushButton *num_button[10];
QDialog *d_bubble;
QPushButton *run_bubble;
QPushButton *open_source;
QPushButton *exit_window;
QPushButton *bubble_begin;
QPushButton *push_bubble[10];
};
#endif
| [
"hbchen1995@126.com"
] | hbchen1995@126.com |
6de8c1a5c5a3572a6989281331c6c466a82105bd | 99fe750ffd06ae7b33d13d69bf625a9c36169df3 | /volume004/444 -Encoder and decoder.cpp | 81e43ba66ab5e0363844fc8c6f93950d86324a58 | [] | no_license | ahmrf/UVa | 5edb2edbc912f837a9884584ab42b73c573a3385 | 6b815d4df74f52e30b01d345b1e41cdd34b0f7da | refs/heads/master | 2021-01-21T01:49:33.721538 | 2016-04-06T16:20:51 | 2016-04-06T16:20:51 | 34,123,479 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,415 | cpp | #include<string>
#include<cstring>
#include<iostream>
#include<sstream>
#include<cstdio>
#include<algorithm>
using namespace std;
string to_string(int num)
{
stringstream ss;
string s;
ss << num;
ss >> s;
return s;
}
int main (void)
{
char asci[123], ch = '\0';
for(int i = 0; i<123; i++)
asci[i] = ch + i;
string str;
while(getline(cin, str))
{
int len = str.length();
if(str[0] <= 57 && str[0] >= 48)
{
string s, out;
for(int i = len-1; i >= 0; i--)
{
if(str[i] == '1')
{
int num = (str[i]-'0')*100 + (str[i-1]-'0')*10 + str[i-2] - '0';
out += asci[num];
i-=2;
}
else
{
int num = (str[i]-'0')*10 + str[i-1] - '0';
out += asci[num];
i--;
}
}
cout << out << endl;
}
else
{
string out, s;
for(int i = len-1; i>=0; i--)
{
int num = str[i];
s = to_string(num);
reverse(s.begin(), s.end());
out += s;
}
cout << out << endl;
}
}
return 0;
}
| [
"bsse0621@iit.du.ac.bd"
] | bsse0621@iit.du.ac.bd |
e3024a4b29a0f1891c300e900e6d2d0b81c4ffcf | 0d2c96accaff0a8fa46b947142f1176a58d7c5df | /c++/3_red_belt/4_week/web_server/http_request.h | ddbe904ddd55cbd3d06868e6de5224c4701db264 | [] | no_license | GlebKirsan/coursera | ece415a8c08b60cfc26d0efce95554833ac782c2 | 3c3bc2beaa855e1418459c87046f683e7c419bf1 | refs/heads/master | 2021-09-01T11:11:17.984403 | 2021-08-24T13:15:41 | 2021-08-24T13:15:41 | 144,696,947 | 6 | 0 | null | 2020-01-31T00:01:46 | 2018-08-14T09:14:04 | MATLAB | UTF-8 | C++ | false | false | 130 | h | #pragma once
#include <string_view>
using namespace std;
struct HttpRequest {
string_view method, uri, protocol;
};
| [
"glkv@protonmail.ch"
] | glkv@protonmail.ch |
a65b9473d6b6737bb5838ac71f3db36f03fc407b | bc5840a9334d654d48291da482acba7acaf8d58e | /source/Skybox.h | f3c1b2870e4c867fb47876d317e31b69c29e61d6 | [] | no_license | sebrussell/Engine | 2d624621631998a3286ce4b7100b9e429584fc2f | f99d734d6caddff4c25482d5c57ea2986d0a9331 | refs/heads/master | 2021-08-27T21:32:21.074662 | 2017-12-10T12:00:50 | 2017-12-10T12:00:50 | 106,965,382 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 832 | h | #ifndef SKYBOX_H
#define SKYBOX_H
class Model;
class Shader;
class MeshManager;
class Transform;
#include <glad/glad.h>
#include <GLFW/glfw3.h>
#include "stb_image.h"
#include <memory>
#include <vector>
#include <iostream>
class Skybox
{
public:
Skybox() {};
~Skybox() {};
void Awake();
unsigned int loadCubemap();
void SetShader(std::weak_ptr<Shader> _shader);
void SetMeshManager(std::weak_ptr<MeshManager> _manager);
void SetCameraTransform(std::weak_ptr<Transform> _transform);
void Draw();
unsigned int GetSkyboxTexture() { return m_cubemapTexture; }
private:
std::weak_ptr<MeshManager> m_meshManager;
std::weak_ptr<Shader> m_shader;
std::weak_ptr<Model> m_skyboxMesh;
std::vector<std::string> m_faces;
unsigned int m_cubemapTexture;
std::weak_ptr<Transform> m_cameraTransform;
};
#endif | [
"sebrussell42@gmail.com"
] | sebrussell42@gmail.com |
360920b90b0595bb9f9944769ec485134f49ca43 | 045c95bed63c0845d95101c3993926dcac4380a4 | /calculator.cpp | 7f902abc3431954924b01fec173666c45bf57bb3 | [] | no_license | ujikstark/SimpleCalculatorC | 642635ff3abbc2ef49007c567a5afe33661ed637 | 934de23f27dd04ffb6d84c693d894c3156df8710 | refs/heads/main | 2023-07-20T01:56:30.417823 | 2021-08-30T06:58:06 | 2021-08-30T06:58:06 | 401,242,834 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 824 | cpp | #include <iostream>
#include <stack>
using namespace std;
int main() {
char op = '+';
int num;
int res = 0;
stack<int> s;
int t = 0;
while (op != '=') {
cin >> num;
if (op == '+') {
res += num;
if (t > 0)
s.push(res - num);
} else if (op == '-') {
res -= num;
if (t > 0)
s.push(res + num);
} else if (op == '*') {
if (s.empty()) {
res *= num;
} else {
int temp = res - s.top();
temp *= num;
res = s.top() + temp;
}
} else if (op == '/') {
if (s.empty()) {
res /= num;
} else {
int temp = res - s.top();
temp /= num;
res = s.top() + temp;
}
} else {
break;
}
cin >> op;
t++;
}
if (res == 0 && t == 1) cout << num;
else
cout << res;
return 0;
}
| [
"ujikbauk@gmail.com"
] | ujikbauk@gmail.com |
c42e783a7c91f3d89a16303e3eb4f56989694de2 | 00a6118df8a147bddc983e370cbfa96b655b55e2 | /01-basics/binary_fixed_point/cnl/include/cnl/_impl/fixed_point/extras.h | 9486ba32f2a773a29dcade045a0488b938fd98ed | [
"MIT"
] | permissive | initdb/RA-Uebung | ac7ae4d75c7c769c6efc63795093791227efbbe4 | 05eeb315be4cdc56e554596b8204b5a4bd43d06b | refs/heads/master | 2020-05-03T04:49:35.740783 | 2019-03-29T15:48:04 | 2019-03-29T15:48:04 | 178,432,678 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 10,496 | h |
// Copyright John McFarlane 2015 - 2016.
// 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)
/// \file
/// \brief supplemental definitions related to the `cnl::fixed_point` type;
/// definitions that straddle two homes, e.g. fixed_point and cmath, traits or limits;
/// included from cnl/fixed_point.h - do not include directly!
#if !defined(CNL_FIXED_POINT_EXTRAS_H)
#define CNL_FIXED_POINT_EXTRAS_H 1
#include "to_chars.h"
#include "type.h"
#include "../cmath/abs.h"
#include "../config.h"
#include "../num_traits/fixed_width_scale.h"
#include "../num_traits/unwrap.h"
#include "../unreachable.h"
#include <cmath>
#if defined(CNL_IOSTREAM_ENABLED)
#include <istream>
#include <ostream>
#endif
/// compositional numeric library
namespace cnl {
////////////////////////////////////////////////////////////////////////////////
// cnl::abs
/// \brief absolute value
/// \headerfile cnl/fixed_point.h
///
/// \param x input parameter
///
/// \return `|x|`
///
/// \sa \ref std::vector
template<typename Rep, int Exponent, int Radix>
constexpr auto abs(fixed_point<Rep, Exponent, Radix> const& x) noexcept
-> decltype(-x)
{
return (x>=fixed_point<Rep, Exponent, Radix>{}) ? static_cast<decltype(-x)>(x) : -x;
}
////////////////////////////////////////////////////////////////////////////////
// cnl::sqrt helper functions
namespace _impl {
template<class Rep>
constexpr Rep sqrt_solve3(
Rep n,
Rep bit,
Rep result)
{
return (bit!=Rep{0})
? (n>=result+bit)
? sqrt_solve3<Rep>(
static_cast<Rep>(n-(result+bit)),
static_cast<Rep>(bit >> 2),
static_cast<Rep>((result >> 1)+bit))
: sqrt_solve3<Rep>(
n,
static_cast<Rep>(bit >> 2),
static_cast<Rep>(result >> 1))
: result;
}
template<int Exponent>
struct sqrt_solve1 {
template<class Rep>
constexpr Rep operator()(Rep n) const
{
using widened_rep = _impl::set_width_t<Rep, _impl::width<Rep>::value*2>;
return static_cast<Rep>(sqrt_solve3<widened_rep>(
_impl::fixed_width_scale<-Exponent>(static_cast<widened_rep>(n)),
widened_rep((widened_rep{1}<<((countr_used(n)+1-Exponent)&~1))>>2),
widened_rep{0}));
}
};
}
////////////////////////////////////////////////////////////////////////////////
// cnl::sqrt
/// \brief calculates the square root of a \ref fixed_point value
/// \headerfile cnl/fixed_point.h
///
/// \param x input parameter
///
/// \return square root of x
///
/// \note This function is a placeholder implementation with poor run-time performance characteristics.
///
/// \sa multiply
// https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Binary_numeral_system_.28base_2.29
template<typename Rep, int Exponent, int Radix>
constexpr fixed_point <Rep, Exponent, Radix>
sqrt(fixed_point<Rep, Exponent, Radix> const& x)
{
using type = fixed_point<Rep, Exponent, Radix>;
return _impl::to_rep(x)<0
? _impl::unreachable<type>("negative value passed to cnl::sqrt")
: type{_impl::from_rep<type>(_impl::sqrt_solve1<Exponent>{}(unwrap(x)))};
}
////////////////////////////////////////////////////////////////////////////////
// cnl::floor
template<class Rep, int Exponent, int Radix,
_impl::enable_if_t<(Exponent<0), int> dummy = 0>
constexpr auto floor(fixed_point<Rep, Exponent, Radix> const& x)
-> decltype(_impl::from_rep<fixed_point<Rep, 0, Radix>>(_impl::to_rep(x)>>constant<-Exponent>())) {
static_assert(
Radix==2,
"cnl::floor(fixed_point<Rep, Exponent, Radix>) not implemented for Exponent<0 && Radix!=2");
return _impl::from_rep<fixed_point<Rep, 0, Radix>>(_impl::to_rep(x)>>constant<-Exponent>());
}
template<class Rep, int Exponent, int Radix>
constexpr auto floor(fixed_point<Rep, Exponent, Radix> const& x)
-> _impl::enable_if_t<Exponent>=0, fixed_point<Rep, Exponent, Radix>> {
return x;
}
////////////////////////////////////////////////////////////////////////////////
// fixed_point trig functions
//
// Placeholder implementations fall back on <cmath> functions which is slow
// due to conversion to and from floating-point types; also inconvenient as
// many <cmath> functions are not constexpr.
namespace _impl {
template<int NumBits, class Enable = void>
struct float_of_size;
template<int NumBits>
struct float_of_size<NumBits, enable_if_t<NumBits <= sizeof(float)*CHAR_BIT>> {
using type = float;
};
template<int NumBits>
struct float_of_size<NumBits, enable_if_t<sizeof(float)*CHAR_BIT < NumBits && NumBits <= sizeof(double)*CHAR_BIT>> {
using type = double;
};
template<int NumBits>
struct float_of_size<NumBits, enable_if_t<sizeof(double)*CHAR_BIT < NumBits && NumBits <= sizeof(long double)*CHAR_BIT>> {
using type = long double;
};
template<class T>
using float_of_same_size = typename float_of_size<_impl::width<T>::value>::type;
template<typename Rep, int Exponent, int Radix, _impl::float_of_same_size<Rep>(* F)(
_impl::float_of_same_size<Rep>)>
constexpr fixed_point <Rep, Exponent, Radix>
crib(fixed_point<Rep, Exponent, Radix> const& x) noexcept
{
using floating_point = _impl::float_of_same_size<Rep>;
return static_cast<fixed_point<Rep, Exponent, Radix>>(F(static_cast<floating_point>(x)));
}
}
template<typename Rep, int Exponent, int Radix>
constexpr fixed_point <Rep, Exponent, Radix>
sin(fixed_point<Rep, Exponent, Radix> const& x) noexcept
{
return _impl::crib<Rep, Exponent, Radix, std::sin>(x);
}
template<typename Rep, int Exponent, int Radix>
constexpr fixed_point <Rep, Exponent, Radix>
cos(fixed_point<Rep, Exponent, Radix> const& x) noexcept
{
return _impl::crib<Rep, Exponent, Radix, std::cos>(x);
}
template<typename Rep, int Exponent, int Radix>
constexpr fixed_point <Rep, Exponent, Radix>
exp(fixed_point<Rep, Exponent, Radix> const& x) noexcept
{
return _impl::crib<Rep, Exponent, Radix, std::exp>(x);
}
template<typename Rep, int Exponent, int Radix>
constexpr fixed_point <Rep, Exponent, Radix>
pow(fixed_point<Rep, Exponent, Radix> const& x) noexcept
{
return _impl::crib<Rep, Exponent, Radix, std::pow>(x);
}
////////////////////////////////////////////////////////////////////////////////
// cnl::fixed_point streaming - (placeholder implementation)
template<typename Rep, int Exponent, int Radix>
::std::ostream& operator<<(::std::ostream& out, fixed_point<Rep, Exponent, Radix> const& fp)
{
return out << to_chars(fp).data();
}
template<typename Rep, int Exponent, int Radix>
::std::istream& operator>>(::std::istream& in, fixed_point <Rep, Exponent, Radix>& fp)
{
long double ld;
in >> ld;
fp = ld;
return in;
}
}
namespace cnl {
////////////////////////////////////////////////////////////////////////////////
// std::numeric_limits for cnl::fixed_point
// note: some members are guessed,
// some are temporary (assuming rounding style, traps etc.)
// and some are undefined
template<typename Rep, int Exponent, int Radix>
struct numeric_limits<cnl::fixed_point<Rep, Exponent, Radix>>
: numeric_limits<cnl::_impl::number_base<cnl::fixed_point<Rep, Exponent, Radix>, Rep>> {
// fixed-point-specific helpers
using _value_type = cnl::fixed_point<Rep, Exponent, Radix>;
using _rep = typename _value_type::rep;
using _rep_numeric_limits = numeric_limits<_rep>;
// standard members
static constexpr _value_type min() noexcept
{
return _impl::from_rep<_value_type>(_rep{1});
}
static constexpr _value_type max() noexcept
{
return _impl::from_rep<_value_type>(_rep_numeric_limits::max());
}
static constexpr _value_type lowest() noexcept
{
return _impl::from_rep<_value_type>(_rep_numeric_limits::lowest());
}
static constexpr bool is_integer = false;
static constexpr _value_type epsilon() noexcept
{
return _impl::from_rep<_value_type>(_rep{1});
}
static constexpr _value_type round_error() noexcept
{
return _impl::from_rep<_value_type>(_rep{0});
}
static constexpr _value_type infinity() noexcept
{
return _impl::from_rep<_value_type>(_rep{0});
}
static constexpr _value_type quiet_NaN() noexcept
{
return _impl::from_rep<_value_type>(_rep{0});
}
static constexpr _value_type signaling_NaN() noexcept
{
return _impl::from_rep<_value_type>(_rep{0});
}
static constexpr _value_type denorm_min() noexcept
{
return _impl::from_rep<_value_type>(_rep{1});
}
};
}
namespace std {
////////////////////////////////////////////////////////////////////////////////
// std::numeric_limits specialization for rounding_integer
template<typename Rep, int Exponent, int Radix>
struct numeric_limits<cnl::fixed_point<Rep, Exponent, Radix>>
: cnl::numeric_limits<cnl::fixed_point<Rep, Exponent, Radix>> {
};
template<typename Rep, int Exponent, int Radix>
struct numeric_limits<cnl::fixed_point<Rep, Exponent, Radix> const>
: cnl::numeric_limits<cnl::fixed_point<Rep, Exponent, Radix>> {
};
}
#endif // CNL_FIXED_POINT_EXTRAS_H
| [
"benedict.schwind@live.de"
] | benedict.schwind@live.de |
d052e5f73356e336a434c2d361ea469926cdd5ab | 38074edb46670f3c53771f63418fbcc9ad5ede68 | /lib/src/StringFrobs.cpp | c8a8f4bbaa9f4241997ff9183311c236d7b52dbd | [
"MIT"
] | permissive | genedelisa/GDMusicKit | e08a725372b3dfae041689b4d365c2ad3d80e04c | d3a3a79ffc6bf000602e5001679351bd5d4a02a6 | refs/heads/master | 2023-04-14T18:59:59.801433 | 2019-08-14T11:05:35 | 2019-08-14T11:05:35 | 193,133,924 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 1,885 | cpp | /*---------------------------------------------------------------------------------------------
* Copyright (c) Rockhopper Technologies, Inc. All rights reserved.
* Licensed under the MIT License.
* See LICENSE in the project for license information.
*--------------------------------------------------------------------------------------------*/
#include <iomanip>
#include <iostream>
#include <string>
//https://stackoverflow.com/questions/14861018/center-text-in-fixed-width-field-with-stream-manipulators-in-c
template <typename charT, typename traits = std::char_traits<charT>>
class center_helper {
std::basic_string<charT, traits> str_;
public:
center_helper(std::basic_string<charT, traits> str) : str_(str) {}
template <typename a, typename b>
friend std::basic_ostream<a, b>& operator<<(std::basic_ostream<a, b>& s,
const center_helper<a, b>& c);
};
template <typename charT, typename traits = std::char_traits<charT>>
center_helper<charT, traits> centered(std::basic_string<charT, traits> str) {
return center_helper<charT, traits>(str);
}
// redeclare for std::string directly so we can support anything that implicitly
// converts to std::string
center_helper<std::string::value_type, std::string::traits_type>
centered(const std::string& str) {
return center_helper<std::string::value_type, std::string::traits_type>(
str);
}
template <typename charT, typename traits>
std::basic_ostream<charT, traits>&
operator<<(std::basic_ostream<charT, traits>& s,
const center_helper<charT, traits>& c) {
std::streamsize w = s.width();
if (w > c.str_.length()) {
std::streamsize left = (w + c.str_.length()) / 2;
s.width(left);
s << c.str_;
s.width(w - left);
s << "";
} else {
s << c.str_;
}
return s;
}
| [
"gene@rockhoppertech.com"
] | gene@rockhoppertech.com |
cdf102536592fe41b259f2c01f303651c834b440 | 7b7554fc484b2c4aaab1a97c6b4b760ed942a00e | /iSAMApp/NavBase/Scan/src/Icp.cpp | c93fc54f944759198d1fcd7fc10d9841e1df8b6a | [] | no_license | sven-glory/GTSAM-NDT | 90bd50bb6404579dc8b5c7f2011be4b64501d572 | 8c5183de63ba54f3cafb67d193b8dffc3afb4b23 | refs/heads/master | 2023-02-25T18:03:14.497787 | 2021-01-31T05:09:56 | 2021-01-31T05:09:56 | 334,640,405 | 0 | 0 | null | null | null | null | GB18030 | C++ | false | false | 11,428 | cpp | #include "stdafx.h"
#include <math.h>
#include "polar_match.h"
/** @brief Calculate the distance of a point from a line section.
计算一个点P(x3, y3)到一条线段AB的距离(A(x1, y1), B(x2, y2))。如果交点落到线段之外,则返回-1。
同时,P点到AB的垂足点的坐标C(x, y)也被返回。
此函数在ICP中用到。
Calculates the distance of the point (x3,y3) from a line defined by (x1,y1)
and (x2,y2). Returns the distance to the line or -1 if the
projection of (x3,y3) falls outside the line segment defined by (x1,y1)
and (x2,y2). The projection of (x3,y3) onto the line is also returned in x,y.
This function is used in ICP.
@param x1,y1 The start point of the line section.
@param x2,y2 The end point of the line section.
@param x3,y3 The point of which distance it sought.
@param x,y (x3,y3) projected onto the line segment is returned here.
@return The distance from the line or -1 if the projection falls outside of the line segment.
*/
float point_line_distance(float x1, float y1, float x2, float y2,
float x3, float y3, float *x, float *y)
{
float ax, ay, t1, D;
ax = x2 - x1;
ay = y2 - y1;
D = sqrtf(ax * ax + ay * ay);
if (D < 0.0001)
{
ASSERT(FALSE); // unexpected D
return -1;
}
t1 = - ( -ax*x3 + ay*y1 + ax*x1 - ay*y3 ) / ( ax*ax+ay*ay );
if (t1 < 0 || t1 > 1) // Projection falls outside the line segment?
return -1;
*x = x1 + t1 * ax;
*y = y1 + t1 * ay;
return (sqrtf((x3 - *x) * (x3 - *x) + (y3 - *y) * (y3 - *y))); //distance of line to p.
}
/** @brief Matches two laser scans using the iterative closest point method.
Minimizes least square error of points through changing lsa->rx, lsa->ry, lsa->th
by using ICP. It interpolates associated
points. Only the best 80% of points are used in the pose calculation.
Scan projection is done at each iteration.
For maintanence reasons changed scan projection to that of psm.
*/
float pm_icp ( const CPmScan *lsr,CPmScan *lsa )
{
#define INTERPOLATE_ICP //comment out if no interpolation of ref. scan points iS necessary
CPmScan act, ref;//copies of current and reference scans
float rx,ry,rth,ax,ay,ath;//robot pos at ref and current scans
float t13,t23,LASER_Y = PM_LASER_Y;
int new_bad[PM_L_POINTS];//bad flags of the projected current scan range readings
float new_r[PM_L_POINTS];//ranges of current scan projected into ref. frame for occlusion check
float nx[PM_L_POINTS];//current scanpoints in ref coord system
float ny[PM_L_POINTS];//current scanpoints in ref coord system
int index[PM_L_POINTS][2];//match indices current,refernce
float dist[PM_L_POINTS];// distance for the matches
int n = 0;//number of valid points
int iter,i,j,small_corr_cnt=0,k,imax;
int window = PM_SEARCH_WINDOW;//+- width of search for correct orientation
float abs_err=0,dx=0,dy=0,dth=0;//match error, current scan corrections
float co,si;
#ifdef PM_GENERATE_RESULTS
double start_tick, dead_tick,end_tick,end_tick2;
FILE *f;
f = fopen ( PM_TIME_FILE,"w" );
dead_tick = 0;
start_tick =pm_msec();
#endif
act = *lsa;
ref = *lsr;
rx = ref.rx; ry = ref.ry; rth = ref.th;
ax = act.rx; ay = act.ry; ath = act.th;
//transformation of current scan laser scanner coordinates into reference
//laser scanner coordinates
t13 = sinf ( rth-ath ) *LASER_Y+cosf ( rth ) *ax+sinf ( rth ) *ay-sinf ( rth ) *ry-rx*cosf ( rth );
t23 = cosf ( rth-ath ) *LASER_Y-sinf ( rth ) *ax+cosf ( rth ) *ay-cosf ( rth ) *ry+rx*sinf ( rth )-LASER_Y;
ref.rx = 0; ref.ry = 0; ref.th = 0;
act.rx = t13; act.ry = t23; act.th = ath-rth;
ax = act.rx; ay = act.ry; ath = act.th;
//from now on act.rx,.. express the lasers position in the ref frame
//intializing x,y of act and ref
for ( i=0;i<PM_L_POINTS;i++ )
{
ref.x[i] = ref.r[i]*pm_co[i];
ref.y[i] = ref.r[i]*pm_si[i];
act.x[i] = act.r[i]*pm_co[i];
act.y[i] = act.r[i]*pm_si[i];
}//for i
iter = -1;
while ( ++iter<PM_MAX_ITER_ICP && small_corr_cnt<3 ) //have to be a few small corrections before stop
{
if ( ( fabsf ( dx ) +fabsf ( dy ) +fabsf ( dth ) *PM_R2D ) <PM_STOP_COND_ICP )
small_corr_cnt++;
else
small_corr_cnt=0;
#ifdef PM_GENERATE_RESULTS
end_tick =pm_msec();
fprintf ( f,"%i %lf %lf %lf %lf\n",iter,
end_tick-start_tick-dead_tick ,ax,ay,ath*PM_R2D );
end_tick2 =pm_msec();
dead_tick += end_tick2- end_tick;
#endif
#ifdef GR
dr_erase();
dr_circle ( ax,ay,5.0,"green" );
dr_line ( 0,-100,200,-100,"black" );
dr_line ( 0,-200,200,-200,"black" );
#endif
//CScan projection
act.rx = ax;act.ry = ay;act.th = ath;
pm_scan_project(&act, new_r, new_bad);
// transformation the cartesian coordinates of the points:
co = cosf ( ath );
si = sinf ( ath );
for ( i=0;i<PM_L_POINTS;i++ )
{
nx[i] = act.x[i]*co - act.y[i]*si + ax;
ny[i] = act.x[i]*si + act.y[i]*co + ay;
#ifdef GR
if ( ref.bad[i] )
dr_circle ( ref.x[i],ref.y[i],4,"yellow" );
else
dr_circle ( ref.x[i],ref.y[i],4,"black" );
if ( new_bad[i] )
dr_circle ( nx[i],ny[i],4,"green" );
else
dr_circle ( nx[i],ny[i],4,"blue" );
#endif
}
// dr_zoom();
#ifdef GR
cout <<"interpolated ranges. press enter"<<endl;
/* for ( i=0;i<PM_L_POINTS;i++ )
dr_circle ( new_r[i]*pm_co[i],new_r[i]*pm_si[i],6,"red" );*/
dr_zoom();
#endif
//Correspondence search: go through the points of the current
//scan and find the closest point in the reference scan
//lying withing a search interval.
n=0;
float d,min_d;
int min_idx;
for ( i=0;i<PM_L_POINTS;i++ )
{
min_d = 1000000;
min_idx = -1;
if ( !new_bad[i] )
{
int imin,imax;
imin = i-window ;
if ( imin<0 )
imin =0;
imax = i+window ;
if ( imax>PM_L_POINTS )
imax =PM_L_POINTS;
for ( j=imin;j<imax;j++ )
{
if ( !ref.bad[j] )
{
d = SQ ( nx[i]-ref.x[j] ) + SQ ( ny[i]-ref.y[j] );//square distance
if ( d<min_d )
{
min_d = d;
min_idx = j;
}
}
}//for
if ( min_idx>=0 && sqrtf ( min_d ) <PM_MAX_ERROR ) // was there any match closer than 1m?
{
index[n][0] = i;
index[n][1] = min_idx;
dist[n] = sqrtf ( min_d );
n++;
#ifdef GR
dr_line ( nx[i],ny[i],ref.x[min_idx],ref.y[min_idx],"blue" );
#endif
}
}//if
}//for
// dr_zoom();
if ( n<PM_MIN_VALID_POINTS )
{
ASSERT(FALSE); // Not enough points
#ifdef PM_GENERATE_RESULTS
fclose ( f );
#endif
throw 1;
}
//sort the matches with bubble sort
//put the largest 20 percent to the end
imax = ( int ) ( ( double ) n*0.2 );
for ( i=0;i<imax;i++ )
for ( j=1;j< ( n-i );j++ )
{
if ( dist[j]<dist[j-1] ) //are they in the wrong order?
{
//swap them
k = index[j][0];
index[j][0] = index[j-1][0];
index[j-1][0] = k;
k = index[j][1];
index[j][1] = index[j-1][1];
index[j-1][1] = k;
d = dist[j];
dist[j] = dist[j-1];
dist[j-1] = d;
}
}//for j
#ifdef INTERPOLATE_ICP
//------------------------INTERPOLATION---------------------------
//comment out if not necessary
float ix[PM_L_POINTS],iy[PM_L_POINTS];//interp. ref. points.
//replace nx,xy with their interpolated... where suitable
{
float d0,d1,d2;
float minx1,miny1,minx2,miny2;
int max_i = n-imax;
for ( i=0;i<max_i;i++ )
{
//d1 = point_line_distance(1, 2,2,3, 2,2, &minx1, &miny1); //debug
#ifdef GR
dr_circle ( nx[index[i][0]],ny[index[i][0]],1.0,"brown" );
dr_circle ( ref.x[index[i][1]],ref.y[index[i][1]],1.0,"brown" );
dr_circle ( ref.x[index[i][1]-1],ref.y[index[i][1]-1],1.0,"brown" );
dr_circle ( ref.x[index[i][1]+1],ref.y[index[i][1]+1],1.0,"brown" );
#endif
d1=-1;d2=-1;
if ( index[i][1]>0 ) //not associated to the first point?
{
d1 = point_line_distance ( ref.x[index[i][1]-1], ref.y[index[i][1]-1],
ref.x[index[i][1]], ref.y[index[i][1]],
nx[index[i][0]], ny[index[i][0]],
&minx1, &miny1 );
}
if ( index[i][1]< ( PM_L_POINTS-1 ) ) //not associated to the last point?
{
d2 = point_line_distance ( ref.x[index[i][1]], ref.y[index[i][1]],
ref.x[index[i][1]+1],ref.y[index[i][1]+1],
nx[index[i][0]], ny[index[i][0]],
&minx2, &miny2 );
}
ix[index[i][1]] = ref.x[index[i][1]];
iy[index[i][1]] = ref.y[index[i][1]];
d0 = sqrtf ( SQ ( ref.x[index[i][1]]-nx[index[i][0]] ) + SQ ( ref.y[index[i][1]]-ny[index[i][0]] ) );
//is the first point closer?
if ( d1>0 && d1<d0 )
{
ix[index[i][1]] = minx1;
iy[index[i][1]] = miny1;
d0 = d1;
}
//is the second point closer?
if ( d2>0 && d2<d0 )
{
ix[index[i][1]] = minx2;
iy[index[i][1]] = miny2;
}
#ifdef GR
dr_line ( nx[index[i][0]],ny[index[i][0]],ix[index[i][1]],iy[index[i][1]],"green" );
#endif
}//for
}
#endif
//pose estimation
//------------------------------------------translation-------------
// do the weighted linear regression on the linearized ...
// include angle as well
//computation of the new dx1,dy1,dtheta1
float sxx=0,sxy=0,syx=0,syy=0;
float meanpx,meanpy,meanppx,meanppy;
meanpx = 0;meanpy = 0;
meanppx= 0;meanppy= 0;
abs_err=0;
imax = n-imax;
for ( i=0;i<imax;i++ )
{
//weight calculation
// do the cartesian calculations....
meanpx += nx[index[i][0]];
meanpy += ny[index[i][0]];
#ifdef INTERPOLATE_ICP
meanppx += ix[index[i][1]];
meanppy += iy[index[i][1]];
#else
meanppx += ref.x[index[i][1]];
meanppy += ref.y[index[i][1]];
#endif
#ifdef GR
dr_line ( nx[index[i][0]],ny[index[i][0]],ref.x[index[i][1]],ref.y[index[i][1]],"red" );
#endif
}//for
meanpx /= imax;
meanpy /= imax;
meanppx /= imax;
meanppy /= imax;
for ( int i=0;i<imax;i++ )
{
#ifdef INTERPOLATE_ICP
sxx += ( nx[index[i][0]] - meanpx ) * ( ix[index[i][1]] - meanppx );
sxy += ( nx[index[i][0]] - meanpx ) * ( iy[index[i][1]] - meanppy );
syx += ( ny[index[i][0]] - meanpy ) * ( ix[index[i][1]] - meanppx );
syy += ( ny[index[i][0]] - meanpy ) * ( iy[index[i][1]] - meanppy );
#else
sxx += ( nx[index[i][0]] - meanpx ) * ( ref.x[index[i][1]] - meanppx );
sxy += ( nx[index[i][0]] - meanpx ) * ( ref.y[index[i][1]] - meanppy );
syx += ( ny[index[i][0]] - meanpy ) * ( ref.x[index[i][1]] - meanppx );
syy += ( ny[index[i][0]] - meanpy ) * ( ref.y[index[i][1]] - meanppy );
#endif
}
//computation of the resulting translation and rotation
//for method closest point match
dth = atan2f ( sxy-syx,sxx+syy );
dx = meanppx - ax - ( cosf ( dth ) * ( meanpx- ax ) - sinf ( dth ) * ( meanpy - ay ) );
dy = meanppy - ay - ( sinf ( dth ) * ( meanpx- ax ) + cosf ( dth ) * ( meanpy - ay ) );
ax += dx;
ay += dy;
ath+= dth;
ath = norm_a ( ath );
// //for SIMULATION iteration results..
// cout <<iter<<" "<<ax<<" "<<ay<<" "<<ath*PM_R2D<<" ;"<<endl;
#ifdef GR
cout <<"iter "<<iter<<" "<<ax<<" "<<ay<<" "<<ath*PM_R2D<<" "<<dx<<" "<<dy<<endl;
// if(iter==0)
dr_zoom();
usleep ( 10000 );
#endif
}//for iter
//cout <<iter<<endl;
#ifdef PM_GENERATE_RESULTS
end_tick =pm_msec();
fprintf ( f,"%i %lf %lf %lf %lf\n",iter,
end_tick-start_tick-dead_tick ,ax,ay,ath*PM_R2D );
fclose ( f );
#endif
lsa->rx =ax;lsa->ry=ay;lsa->th=ath;
return ( abs_err/n );
}//pm_icp
| [
"sven_glory@163.com"
] | sven_glory@163.com |
1d2247a5330e1f99a0973b78ed2017e2ad146f0f | 4e49f2b456882ba8643907a196f86b3062004243 | /MFCTeeChart/MFCTeeChart/TeeChar/teefunction.h | ed098bf79b0d1b8e52ee4f7e3407f7dc8c4be5f6 | [] | no_license | 772148702/Artificial-Intelligence | d4616acf13a38658fc38e71874091b4a0596f6ac | 3b2c48af7a88adc2d2fab01176db7c811deda1d1 | refs/heads/master | 2018-08-29T19:14:37.293494 | 2018-07-06T15:16:10 | 2018-07-06T15:16:10 | 108,261,921 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 2,429 | h | // Machine generated IDispatch wrapper class(es) created by Microsoft Visual C++
// NOTE: Do not modify the contents of this file. If this class is regenerated by
// Microsoft Visual C++, your modifications will be overwritten.
// Dispatch interfaces referenced by this interface
class CCurveFittingFunction;
class CExpAvgFunction;
class CMovingAvgFunction;
class CStdDeviationFunction;
class CRSIFunction;
class CBollingerFunction;
class CADXFunction;
class CMACDFunction;
class CRMSFunction;
class CAverageFunction;
class CSmoothingFunction;
class CCustomFunction;
class CCompressFunction;
class CCLVFunction;
class COBVFunction;
class CCCIFunction;
class CPVOFunction;
class CPerformanceFunction;
class CModeFunction;
class CMedianFunction;
class CDownSamplingFunction;
class CTrendFunction;
class CSubsetTeeFunction;
class CExpMovAvgFunction;
class CSARFunction;
class CHistogramFunction;
/////////////////////////////////////////////////////////////////////////////
// CTeeFunction wrapper class
class CTeeFunction : public COleDispatchDriver
{
public:
CTeeFunction() {} // Calls COleDispatchDriver default constructor
CTeeFunction(LPDISPATCH pDispatch) : COleDispatchDriver(pDispatch) {}
CTeeFunction(const CTeeFunction& dispatchSrc) : COleDispatchDriver(dispatchSrc) {}
// Attributes
public:
// Operations
public:
double GetPeriod();
void SetPeriod(double newValue);
CCurveFittingFunction GetAsCurveFit();
CExpAvgFunction GetAsExpAvg();
CMovingAvgFunction GetAsMovAvg();
long GetPeriodStyle();
void SetPeriodStyle(long nNewValue);
long GetPeriodAlign();
void SetPeriodAlign(long nNewValue);
CStdDeviationFunction GetAsStdDeviation();
void BeginUpdate();
void EndUpdate();
CRSIFunction GetAsRSI();
CBollingerFunction GetAsBollinger();
CADXFunction GetAsADX();
CMACDFunction GetAsMACD();
CRMSFunction GetAsRMS();
CAverageFunction GetAsAverage();
CSmoothingFunction GetAsSmoothing();
CCustomFunction GetAsCustom();
CCompressFunction GetAsCompress();
CCLVFunction GetAsCLV();
COBVFunction GetAsOBV();
CCCIFunction GetAsCCI();
CPVOFunction GetAsPVO();
CPerformanceFunction GetAsPerformance();
CModeFunction GetAsMode();
CMedianFunction GetAsMedian();
void Recalculate();
CDownSamplingFunction GetAsDownSampling();
CTrendFunction GetAsTrend();
CSubsetTeeFunction GetAsSubset();
CExpMovAvgFunction GetAsExpMovAvg();
CSARFunction GetAsSAR();
CHistogramFunction GetAsHistogram();
};
| [
"772148702@qq.com"
] | 772148702@qq.com |
76eb86720131af1b386a69278c1aedbd004af16c | 8153511d8167c75f3439090f883ed67bfbd3d083 | /Palindrome.cpp | adbbff411a608825cddbfae46996edadd6d6fc0e | [] | no_license | PoorMonk/LeetCode | d0f6aedfc181bc39d928332f8c64225a189bb560 | 0fede9a202fef820fe5bc71d6ea1a56b802baed5 | refs/heads/master | 2021-05-15T05:23:48.513832 | 2018-02-08T05:59:41 | 2018-02-08T05:59:41 | 117,074,541 | 0 | 0 | null | null | null | null | GB18030 | C++ | false | false | 539 | cpp | /*
Determine whether an integer is a palindrome. Do this without extra space.
*/
#include <iostream>
#include <vector>
using namespace std;
class Solution
{
public:
bool isPalindrome(int x)
{
//负数不是回文数
return (0 <= x && x == reverse(x));
}
private:
int reverse(int x)
{
int y = 0;
while (x)
{
y = y * 10 + x % 10;
x = x / 10;
}
return y;
}
};
int main()
{
Solution s;
if (s.isPalindrome(2147447412))
{
cout << "True..." << endl;
}
else
{
cout << "False..." << endl;
}
return 0;
}
| [
"ji.he@3glasses.com"
] | ji.he@3glasses.com |
eb2da70d8dda7c998925266860ffa9868b6e9384 | c8998aa405b5416f6db4d3cbbdb812098d1f7803 | /Core/MMKV_OSX.cpp | bafac4a36f73edc341398edeacb9ac4b7ec2b80d | [
"BSD-3-Clause",
"LicenseRef-scancode-openssl",
"LicenseRef-scancode-ssleay-windows",
"OpenSSL",
"Zlib",
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0"
] | permissive | fengqieer1988/MMKV | c0010084b3adc1279dcec63c506e028c7eb26f6b | 025829b9a214b5bb53679e7d662095c1b35d817d | refs/heads/master | 2022-04-22T18:27:39.906333 | 2020-04-13T07:18:49 | 2020-04-13T07:18:49 | 255,243,833 | 0 | 0 | NOASSERTION | 2020-04-13T05:57:53 | 2020-04-13T05:57:52 | null | UTF-8 | C++ | false | false | 7,392 | cpp | /*
* Tencent is pleased to support the open source community by making
* MMKV available.
*
* Copyright (C) 2019 THL A29 Limited, a Tencent company.
* All rights reserved.
*
* Licensed under the BSD 3-Clause License (the "License"); you may not use
* this file except in compliance with the License. You may obtain a copy of
* the License at
*
* https://opensource.org/licenses/BSD-3-Clause
*
* 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 "MMKVPredef.h"
#ifdef MMKV_IOS_OR_MAC
# include "CodedInputData.h"
# include "CodedOutputData.h"
# include "InterProcessLock.h"
# include "MMKV.h"
# include "MemoryFile.h"
# include "MiniPBCoder.h"
# include "ScopedLock.hpp"
# include "ThreadLock.h"
# include <sys/utsname.h>
# ifdef MMKV_IOS
# include "Checksum.h"
# include <sys/mman.h>
# endif
# if __has_feature(objc_arc)
# error This file must be compiled with MRC. Use -fno-objc-arc flag.
# endif
using namespace std;
using namespace mmkv;
extern ThreadLock *g_instanceLock;
extern MMKVPath_t g_rootDir;
enum { UnKnown = 0, PowerMac = 1, Mac, iPhone, iPod, iPad, AppleTV, AppleWatch };
static void GetAppleMachineInfo(int &device, int &version);
MMKV_NAMESPACE_BEGIN
extern ThreadOnceToken_t once_control;
extern void initialize();
void MMKV::minimalInit(MMKVPath_t defaultRootDir) {
ThreadLock::ThreadOnce(&once_control, initialize);
// crc32 instruction requires A10 chip, aka iPhone 7 or iPad 6th generation
int device = 0, version = 0;
GetAppleMachineInfo(device, version);
# ifdef __aarch64__
if ((device == iPhone && version >= 9) || (device == iPad && version >= 7)) {
CRC32 = mmkv::armv8_crc32;
}
# endif
MMKVInfo("Apple Device:%d, version:%d", device, version);
g_rootDir = defaultRootDir;
mkPath(g_rootDir);
MMKVInfo("default root dir: " MMKV_PATH_FORMAT, g_rootDir.c_str());
}
# ifdef MMKV_IOS
static bool g_isInBackground = false;
void MMKV::setIsInBackground(bool isInBackground) {
SCOPED_LOCK(g_instanceLock);
g_isInBackground = isInBackground;
MMKVInfo("g_isInBackground:%d", g_isInBackground);
}
// @finally in C++ stype
template <typename F>
struct AtExit {
AtExit(F f) : m_func{f} {}
~AtExit() { m_func(); }
private:
F m_func;
};
bool MMKV::protectFromBackgroundWriting(size_t size, WriteBlock block) {
if (g_isInBackground) {
// calc ptr to be mlock()
auto writePtr = (size_t) m_output->curWritePointer();
auto ptr = (writePtr / DEFAULT_MMAP_SIZE) * DEFAULT_MMAP_SIZE;
size_t lockDownSize = writePtr - ptr + size;
if (mlock((void *) ptr, lockDownSize) != 0) {
MMKVError("fail to mlock [%s], %s", m_mmapID.c_str(), strerror(errno));
// just fail on this condition, otherwise app will crash anyway
//block(m_output);
return false;
} else {
AtExit cleanup([=] { munlock((void *) ptr, lockDownSize); });
try {
block(m_output);
} catch (std::exception &exception) {
MMKVError("%s", exception.what());
return false;
}
}
} else {
block(m_output);
}
return true;
}
# endif // MMKV_IOS
bool MMKV::set(NSObject<NSCoding> *__unsafe_unretained obj, MMKVKey_t key) {
if (isKeyEmpty(key)) {
return false;
}
if (!obj) {
removeValueForKey(key);
return true;
}
MMBuffer data;
if (MiniPBCoder::isCompatibleObject(obj)) {
data = MiniPBCoder::encodeDataWithObject(obj);
} else {
/*if ([object conformsToProtocol:@protocol(NSCoding)])*/ {
auto tmp = [NSKeyedArchiver archivedDataWithRootObject:obj];
if (tmp.length > 0) {
data = MMBuffer(tmp);
}
}
}
return setDataForKey(std::move(data), key);
}
NSObject *MMKV::getObject(MMKVKey_t key, Class cls) {
if (isKeyEmpty(key) || !cls) {
return nil;
}
SCOPED_LOCK(m_lock);
auto &data = getDataForKey(key);
if (data.length() > 0) {
if (MiniPBCoder::isCompatibleClass(cls)) {
try {
auto result = MiniPBCoder::decodeObject(data, cls);
return result;
} catch (std::exception &exception) {
MMKVError("%s", exception.what());
}
} else {
if ([cls conformsToProtocol:@protocol(NSCoding)]) {
auto tmp = [NSData dataWithBytesNoCopy:data.getPtr() length:data.length() freeWhenDone:NO];
return [NSKeyedUnarchiver unarchiveObjectWithData:tmp];
}
}
}
return nil;
}
NSArray *MMKV::allKeys() {
SCOPED_LOCK(m_lock);
checkLoadData();
NSMutableArray *keys = [NSMutableArray array];
for (const auto &pair : m_dic) {
[keys addObject:pair.first];
}
return keys;
}
void MMKV::removeValuesForKeys(NSArray *arrKeys) {
if (arrKeys.count == 0) {
return;
}
if (arrKeys.count == 1) {
return removeValueForKey(arrKeys[0]);
}
SCOPED_LOCK(m_lock);
SCOPED_LOCK(m_exclusiveProcessLock);
checkLoadData();
size_t deleteCount = 0;
for (NSString *key in arrKeys) {
auto itr = m_dic.find(key);
if (itr != m_dic.end()) {
[itr->first release];
m_dic.erase(itr);
deleteCount++;
}
}
if (deleteCount > 0) {
m_hasFullWriteback = false;
fullWriteback();
}
}
void MMKV::enumerateKeys(EnumerateBlock block) {
if (block == nil) {
return;
}
SCOPED_LOCK(m_lock);
checkLoadData();
MMKVInfo("enumerate [%s] begin", m_mmapID.c_str());
for (const auto &pair : m_dic) {
BOOL stop = NO;
block(pair.first, &stop);
if (stop) {
break;
}
}
MMKVInfo("enumerate [%s] finish", m_mmapID.c_str());
}
MMKV_NAMESPACE_END
static void GetAppleMachineInfo(int &device, int &version) {
device = UnKnown;
version = 0;
struct utsname systemInfo = {};
uname(&systemInfo);
std::string machine(systemInfo.machine);
if (machine.find("PowerMac") != std::string::npos || machine.find("Power Macintosh") != std::string::npos) {
device = PowerMac;
} else if (machine.find("Mac") != std::string::npos || machine.find("Macintosh") != std::string::npos) {
device = Mac;
} else if (machine.find("iPhone") != std::string::npos) {
device = iPhone;
} else if (machine.find("iPod") != std::string::npos) {
device = iPod;
} else if (machine.find("iPad") != std::string::npos) {
device = iPad;
} else if (machine.find("AppleTV") != std::string::npos) {
device = AppleTV;
} else if (machine.find("AppleWatch") != std::string::npos) {
device = AppleWatch;
}
auto pos = machine.find_first_of("0123456789");
if (pos != std::string::npos) {
version = std::atoi(machine.substr(pos).c_str());
}
}
#endif // MMKV_IOS_OR_MAC
| [
"guoling@tencent.com"
] | guoling@tencent.com |
fdbb99cf33c6bc49c31d4f81fcedb6bb7e1d5ae7 | 04b1803adb6653ecb7cb827c4f4aa616afacf629 | /components/offline_pages/core/prefetch/prefetch_download_flow_unittest.cc | a97a1216139f343032943eeaf61b51692ee7f490 | [
"BSD-3-Clause"
] | permissive | Samsung/Castanets | 240d9338e097b75b3f669604315b06f7cf129d64 | 4896f732fc747dfdcfcbac3d442f2d2d42df264a | refs/heads/castanets_76_dev | 2023-08-31T09:01:04.744346 | 2021-07-30T04:56:25 | 2021-08-11T05:45:21 | 125,484,161 | 58 | 49 | BSD-3-Clause | 2022-10-16T19:31:26 | 2018-03-16T08:07:37 | null | UTF-8 | C++ | false | false | 8,090 | cc | // Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "components/offline_pages/core/prefetch/prefetch_downloader_impl.h"
#include <utility>
#include <vector>
#include "base/test/scoped_feature_list.h"
#include "components/download/public/background_service/test/test_download_service.h"
#include "components/offline_pages/core/client_namespace_constants.h"
#include "components/offline_pages/core/offline_page_feature.h"
#include "components/offline_pages/core/prefetch/prefetch_background_task.h"
#include "components/offline_pages/core/prefetch/prefetch_dispatcher_impl.h"
#include "components/offline_pages/core/prefetch/prefetch_prefs.h"
#include "components/offline_pages/core/prefetch/prefetch_service.h"
#include "components/offline_pages/core/prefetch/prefetch_service_test_taco.h"
#include "components/offline_pages/core/prefetch/tasks/prefetch_task_test_base.h"
#include "components/offline_pages/core/prefetch/test_download_client.h"
#include "components/offline_pages/core/prefetch/test_prefetch_dispatcher.h"
#include "components/prefs/testing_pref_service.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace offline_pages {
namespace {
const version_info::Channel kTestChannel = version_info::Channel::UNKNOWN;
const base::FilePath kTestFilePath(FILE_PATH_LITERAL("foo"));
const int64_t kTestFileSize = 88888;
// Tests the interaction between prefetch service and download service to
// validate the whole prefetch download flow regardless which service is up
// first.
class PrefetchDownloadFlowTest : public PrefetchTaskTestBase {
public:
PrefetchDownloadFlowTest() {
feature_list_.InitAndEnableFeature(kPrefetchingOfflinePagesFeature);
}
void SetUp() override {
PrefetchTaskTestBase::SetUp();
prefetch_service_taco_.reset(new PrefetchServiceTestTaco);
prefetch_service_taco_->SetPrefService(std::move(prefs_));
prefetch_prefs::SetEnabledByServer(prefetch_service_taco_->pref_service(),
true);
auto downloader = std::make_unique<PrefetchDownloaderImpl>(
&download_service_, kTestChannel,
prefetch_service_taco_->pref_service());
download_client_ = std::make_unique<TestDownloadClient>(downloader.get());
download_service_.set_client(download_client_.get());
prefetch_service_taco_->SetPrefetchDispatcher(
std::make_unique<PrefetchDispatcherImpl>(
prefetch_service_taco_->pref_service()));
prefetch_service_taco_->SetPrefetchStore(store_util()->ReleaseStore());
prefetch_service_taco_->SetPrefetchDownloader(std::move(downloader));
prefetch_service_taco_->CreatePrefetchService();
prefetch_service_taco_->prefetch_service()->SetCachedGCMToken(
"dummy_gcm_token");
item_generator()->set_client_namespace(kSuggestedArticlesNamespace);
}
void TearDown() override {
prefetch_service_taco_.reset();
PrefetchTaskTestBase::TearDown();
}
void SetDownloadServiceReady() {
SetDownloadServiceReadyWithParams(
std::set<std::string>(),
std::map<std::string, std::pair<base::FilePath, int64_t>>());
}
void SetDownloadServiceReadyWithParams(
const std::set<std::string>& outstanding_download_ids,
const std::map<std::string, std::pair<base::FilePath, int64_t>>&
success_downloads) {
download_service_.SetIsReady(true);
prefetch_downloader()->OnDownloadServiceReady(
std::set<std::string>(),
std::map<std::string, std::pair<base::FilePath, int64_t>>());
RunUntilIdle();
}
void BeginBackgroundTask() {
prefetch_dispatcher()->BeginBackgroundTask(
std::make_unique<PrefetchBackgroundTask>(
prefetch_service_taco_->prefetch_service()));
RunUntilIdle();
}
PrefetchDispatcher* prefetch_dispatcher() const {
return prefetch_service_taco_->prefetch_service()->GetPrefetchDispatcher();
}
PrefetchDownloader* prefetch_downloader() const {
return prefetch_service_taco_->prefetch_service()->GetPrefetchDownloader();
}
private:
base::test::ScopedFeatureList feature_list_;
download::test::TestDownloadService download_service_;
std::unique_ptr<TestDownloadClient> download_client_;
std::unique_ptr<PrefetchServiceTestTaco> prefetch_service_taco_;
};
TEST_F(PrefetchDownloadFlowTest, DownloadServiceReadyAfterPrefetchSystemReady) {
// Create an item ready for download.
PrefetchItem item =
item_generator()->CreateItem(PrefetchItemState::RECEIVED_BUNDLE);
item.archive_body_length = 100;
store_util()->InsertPrefetchItem(item);
RunUntilIdle();
// Start the prefetch processing pipeline.
BeginBackgroundTask();
// The item can still been scheduled for download though the download service
// is not ready.
std::unique_ptr<PrefetchItem> found_item =
store_util()->GetPrefetchItem(item.offline_id);
EXPECT_EQ(PrefetchItemState::DOWNLOADING, found_item->state);
// Now make the download service ready.
SetDownloadServiceReady();
RunUntilIdle();
// The item should finally transit to IMPORTING state.
found_item = store_util()->GetPrefetchItem(item.offline_id);
EXPECT_EQ(PrefetchItemState::IMPORTING, found_item->state);
}
TEST_F(PrefetchDownloadFlowTest,
DownloadServiceReadyBeforePrefetchSystemReady) {
// Download service is ready initially.
SetDownloadServiceReady();
RunUntilIdle();
// Create an item ready for download.
PrefetchItem item =
item_generator()->CreateItem(PrefetchItemState::RECEIVED_BUNDLE);
item.archive_body_length = 100;
store_util()->InsertPrefetchItem(item);
RunUntilIdle();
// Start the prefetch processing pipeline.
BeginBackgroundTask();
// The item should finally transit to IMPORTING state.
std::unique_ptr<PrefetchItem> found_item =
store_util()->GetPrefetchItem(item.offline_id);
EXPECT_EQ(PrefetchItemState::IMPORTING, found_item->state);
}
TEST_F(PrefetchDownloadFlowTest, DownloadServiceUnavailable) {
// Download service is unavailable.
EXPECT_FALSE(prefetch_downloader()->IsDownloadServiceUnavailable());
prefetch_downloader()->OnDownloadServiceUnavailable();
EXPECT_TRUE(prefetch_downloader()->IsDownloadServiceUnavailable());
// Create an item ready for download.
PrefetchItem item =
item_generator()->CreateItem(PrefetchItemState::RECEIVED_BUNDLE);
item.archive_body_length = 100;
store_util()->InsertPrefetchItem(item);
RunUntilIdle();
// Start the prefetch processing pipeline.
BeginBackgroundTask();
// The item should not be changed since download service can't be used.
std::unique_ptr<PrefetchItem> found_item =
store_util()->GetPrefetchItem(item.offline_id);
EXPECT_EQ(item, *found_item);
}
TEST_F(PrefetchDownloadFlowTest, DelayRunningDownloadCleanupTask) {
// Create an item in DOWNLOADING state.
PrefetchItem item =
item_generator()->CreateItem(PrefetchItemState::DOWNLOADING);
item.archive_body_length = 100;
store_util()->InsertPrefetchItem(item);
RunUntilIdle();
// Download service is ready.
std::set<std::string> outgoing_downloads;
std::map<std::string, std::pair<base::FilePath, int64_t>> success_downloads;
success_downloads.emplace(item.guid,
std::make_pair(kTestFilePath, kTestFileSize));
SetDownloadServiceReadyWithParams(outgoing_downloads, success_downloads);
// The item should not be changed because the prefetch processing pipeline has
// not started yet and the download cleanup task will not be created.
std::unique_ptr<PrefetchItem> found_item =
store_util()->GetPrefetchItem(item.offline_id);
EXPECT_EQ(item, *found_item);
// Start the prefetch processing pipeline.
BeginBackgroundTask();
// The download cleanup task should be created and run. The item should
// finally transit to IMPORTING state.
found_item = store_util()->GetPrefetchItem(item.offline_id);
EXPECT_EQ(PrefetchItemState::IMPORTING, found_item->state);
}
} // namespace
} // namespace offline_pages
| [
"sunny.nam@samsung.com"
] | sunny.nam@samsung.com |
bc34335bc7f15d5fcc1f5382cf823bfa2ff923c9 | 5d6794a2d3af0d84c59783e110f33538d0e9b830 | /contests/JudgeTest202004/b.cpp | 323b9f210623255491c380cbb0013f57d9676129 | [] | no_license | ryotgm0417/AtCoder | e641336365e1c3b4812471ebf86f55e69ee09e2f | a70a0be85beb925a3e488e9e0d8191f0bbf1bcc1 | refs/heads/master | 2020-11-28T21:21:35.171770 | 2020-08-29T13:50:15 | 2020-08-29T13:50:15 | 229,922,379 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,181 | cpp | #include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i=0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
using ll = long long;
using VL = vector<ll>;
using VVL = vector<vector<ll>>;
using P = pair<ll, ll>;
// chmin, chmax関数
template<typename T, typename U, typename Comp=less<>>
bool chmax(T& xmax, const U& x, Comp comp={}) {
if(comp(xmax, x)) {
xmax = x;
return true;
}
return false;
}
template<typename T, typename U, typename Comp=less<>>
bool chmin(T& xmin, const U& x, Comp comp={}) {
if(comp(x, xmin)) {
xmin = x;
return true;
}
return false;
}
// Yes-Noを出力する問題で楽をする
void Ans(bool f){
if(f) cout << "Yes" << endl;
else cout << "No" << endl;
}
//---------------------------
int main(){
ll n; cin >> n;
VL r,b;
rep(i,n){
ll x; char c;
cin >> x >> c;
if(c=='R') r.push_back(x);
else b.push_back(x);
}
sort(r.begin(), r.end());
sort(b.begin(), b.end());
for(auto x: r){
cout << x << endl;
}
for(auto x: b){
cout << x << endl;
}
return 0;
} | [
"ryothailand98@gmail.com"
] | ryothailand98@gmail.com |
3a3790db462b05b95d3d2db638c09c26a5508818 | 4b88fe8b782cbedf048ec406d99b50d8e21a9f2c | /src/Geometry/Frustum.cpp | 2d31eddc803b779c20e1ed15774be56db2d5ca74 | [] | no_license | Senryoku/SEngine | d41fa3400b62ee274c760d6c902c2f0734d42c3a | 8235d22d87b5f2967437b2d19b6bc02100f792fa | refs/heads/master | 2021-06-06T10:15:47.880495 | 2021-05-23T00:53:04 | 2021-05-23T00:53:04 | 38,825,325 | 3 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 1,288 | cpp | #include <Frustum.hpp>
Frustum::Frustum(const glm::mat4& projmat)
{
// Fast Extraction of Viewing Frustum Planes from the World-View-Projection Matrix
// Gribb & Hartmann
// http://www8.cs.umu.se/kurser/5DV051/HT12/lab/plane_extraction.pdf
// https://stackoverflow.com/questions/12836967/extracting-view-frustum-planes-hartmann-gribbs-method
std::array<std::array<float, 4>, 6> coeff;
for(int i = 0; i < 4; ++i)
{
coeff[Top][i] = projmat[i][3] - projmat[i][1];
coeff[Bottom][i] = projmat[i][3] + projmat[i][1];
coeff[Left][i] = projmat[i][3] + projmat[i][0];
coeff[Right][i] = projmat[i][3] - projmat[i][0];
coeff[Near][i] = projmat[i][3] + projmat[i][2];
coeff[Far][i] = projmat[i][3] - projmat[i][2];
}
for(int i = 0; i < 6; ++i)
planes[i].setCoefficients(coeff[i]);
}
bool Frustum::isIntersecting(const AABB<glm::vec3>& aabb) const
{
// http://old.cescg.org/CESCG-2002/DSykoraJJelinek/
glm::vec3 m = (aabb.max + aabb.min) / 2.0f;
glm::vec3 d = aabb.max - m;
for(int i = 0; i < 6; ++i)
{
float mf = glm::dot(m, planes[i].getNormal()) + planes[i][3];
float n = glm::dot(d, glm::abs(planes[i].getNormal()));
if(mf + n < 0) return false; // Strictly outside
if(mf - n < 0) return true; // Intersecting
}
return true;
}
| [
"maretverdant@gmail.com"
] | maretverdant@gmail.com |
7544afc7458f72438548ac332e71fd3fc8807941 | 15227fb41af484950b7a89bb45b78489db58869a | /kryne-engine/include/kryne-engine/Core/LogicComponent.h | 596bfff8b4704f9cd01d239e35ed38ad743f5ddc | [] | no_license | Mcgode/kryne-engine | 83c4c1fb2ee9511b687c482afc14d0db07141e95 | 01332d2b17c41d0954c12995713186f86e710233 | refs/heads/main | 2021-12-01T08:48:28.071158 | 2021-05-01T16:51:15 | 2021-05-01T16:51:15 | 182,293,488 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,694 | h | /**
* @file
* @author Max Godefroy
* @date 06/02/2021.
*/
#ifndef KRYNE_ENGINE_LOGICCOMPONENT_H
#define KRYNE_ENGINE_LOGICCOMPONENT_H
#include "Component.h"
/**
* A component to use for game logic.
*/
class LogicComponent: public Component {
public:
/**
* Initializes the logic component
* @param entity The entity this component will be attached to.
*
* @note A component should never be instanciated in a vaccum. Entity::addComponent() should be used instead.
*/
explicit LogicComponent(Entity *entity): Component(entity)
{
this->componentName = "LogicComponent";
}
void transformDidUpdate() override {}
// -----
// Component lifecycle
// -----
public:
/**
* A function for just-in-time initializations.
* This function is called just before its first #onUpdate() call;
*/
virtual void onBegin();
/**
* @return `true` if onBegin has already been called
*/
[[nodiscard]] inline bool hasBegun() const { return this->begun; }
/**
* Function called when the component is attached to an entity
* @warning #onBegin() might not have been called yet
*/
virtual void onAttach() {};
/**
* Update function called once per frame. Use it to run your component logic.
*/
virtual void onUpdate() {};
/**
* Function called when the component is detached from its entity.
* Won't be called if the component is simply destroyed along its attached entity.
* @warning #onBegin() might not have been called yet.
*/
virtual void onDetach() {};
private:
bool begun = false;
};
#endif //KRYNE_ENGINE_LOGICCOMPONENT_H
| [
"max@godefroy.net"
] | max@godefroy.net |
67f0a8d188eddff4251de57c207eaba16b02e9ab | 4503b4ec29e9a30d26c433bac376f2bddaefd9e5 | /RealDWG/2012/x64/Inc/dbDictUtil.h | cca94e63bb53640d5adc683e0bd46cac243d2e9a | [] | no_license | SwunZH/ecocommlibs | 0a872e0bbecbb843a0584fb787cf0c5e8a2a270b | 4cff09ff1e479f5f519f207262a61ee85f543b3a | refs/heads/master | 2021-01-25T12:02:39.067444 | 2018-02-23T07:04:43 | 2018-02-23T07:04:43 | 123,447,012 | 1 | 0 | null | 2018-03-01T14:37:53 | 2018-03-01T14:37:53 | null | UTF-8 | C++ | false | false | 7,749 | h | // $Header: //depot/release/ironman2012/develop/global/inc/dbxsdk/dbDictUtil.h#1 $ $Change: 237375 $ $DateTime: 2011/01/30 18:32:54 $ $Author: integrat $
// $NoKeywords: $
#ifndef AD_DBDICTUTIL_H
#define AD_DBDICTUTIL_H 1
//
// (C) Copyright 1998-2006, 2010 by Autodesk, Inc.
//
// Permission to use, copy, modify, and distribute this software in
// object code form for any purpose and without fee is hereby granted,
// provided that the above copyright notice appears in all copies and
// that both that copyright notice and the limited warranty and
// restricted rights notice below appear in all supporting
// documentation.
//
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
// UNINTERRUPTED OR ERROR FREE.
//
// Use, duplication, or disclosure by the U.S. Government is subject to
// restrictions set forth in FAR 52.227-19 (Commercial Computer
// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
// (Rights in Technical Data and Computer Software), as applicable.
//
// DESCRIPTION:
//
// The following are some dictionary utility functions similar
// to those defined for symbol tables in dbsymutl.h
// NOTE: These utils have the same usage guidelines as the symbol
// table versions. That is; These functions are very handy for
// quick one-time access to the name or id of a dictionary entry.
// On the other hand; if you need to make multiple accesses to
// a given dictionary, then avoid the overhead of these functions
// and open the dictionary directly.
//
// -----------------------
// Get the ID of an item
// -----------------------
// General purpose:
// Acad::ErrorStatus
// AcDbDictUtil::dictionaryGetAt(AcDbObjectId& id, const ACHAR* name, AcDbObjectId ownerDictId);
//
// Specific:
// Acad::ErrorStatus
// AcDbDictUtil::getGroupId(AcDbObjectId& id, const ACHAR* name, AcDbDatabase* pDb);
// also...
// getLayoutId
// getPlotSettingsId
// getPlotStyleNameId
// getMaterialId
// getColorId
// getTableStyleId
//
// -----------------------
// Get the NAME/KEY of an item:
// -----------------------
// General purpose:
// Acad::ErrorStatus
// AcDbDictUtil::dictionaryNameAt(ACHAR*& pName, AcDbObjectId itemId, AcDbObjectId ownerDictId);
// or...
// Acad::ErrorStatus
// AcDbDictUtil::dictionaryNameAt(ACHAR*& pName, AcDbObjectId itemId);
//
// Specific:
// Acad::ErrorStatus
// AcDbDictUtil::getGroupName(ACHAR*& name, AcDbObjectId id);
// also...
// getLayoutName
// getPlotSettingsName
// getPlotStyleNameName
// getMaterialName
// getColorName
// getTableStyleName
//
// NOTE: The "get name" functions allocate the returned string.
// The calling application is responsible for deallocating the memory
// used by the returned string.
//
// -----------------------
// Check for existence
// -----------------------
//
// bool hasGroup(const ACHAR* name, AcDbDatabase* pDb);
// also...
// hasLayout
// hasPlotSettings
// hasPlotStyleName
// hasMaterial
// hasColor
// hasTableStyle
//
#include <assert.h>
#include <stddef.h>
#include "dbdict.h"
#include "AcString.h"
namespace AcDbDictUtil
{
inline Acad::ErrorStatus
dictionaryNameAt(ACHAR*& pName, AcDbObjectId itemId, AcDbObjectId ownerDictId)
{
assert(!itemId.isNull() && !ownerDictId.isNull());
AcDbDictionary* pDict;
Acad::ErrorStatus es = acdbOpenObject(pDict, ownerDictId, AcDb::kForRead);
if (es == Acad::eOk) {
es = pDict->nameAt(itemId, pName);
pDict->close();
}
return es;
}
inline Acad::ErrorStatus
dictionaryNameAt(AcString& name, AcDbObjectId itemId, AcDbObjectId ownerDictId)
{
assert(!itemId.isNull() && !ownerDictId.isNull());
AcDbDictionary* pDict;
Acad::ErrorStatus es = acdbOpenObject(pDict, ownerDictId, AcDb::kForRead);
if (es == Acad::eOk) {
es = pDict->nameAt(itemId, name);
pDict->close();
}
return es;
}
//Note: If you already know the owner of itemId, then call the overloaded
// version above to avoid an extra call to acdbOpenObject.
inline Acad::ErrorStatus
dictionaryNameAt(ACHAR*& pName, AcDbObjectId itemId)
{
assert(!itemId.isNull());
AcDbObject* pObject;
Acad::ErrorStatus es = acdbOpenObject(pObject, itemId, AcDb::kForRead);
if (es != Acad::eOk)
return es;
AcDbObjectId dictId = pObject->ownerId(); //get the owner id
es = pObject->close();
assert(es == Acad::eOk);
return dictionaryNameAt(pName, itemId, dictId);
}
//Note: If you already know the owner of itemId, then call the overloaded
// version above to avoid an extra call to acdbOpenObject.
inline Acad::ErrorStatus
dictionaryNameAt(AcString& name, AcDbObjectId itemId)
{
assert(!itemId.isNull());
AcDbObject* pObject;
Acad::ErrorStatus es = acdbOpenObject(pObject, itemId, AcDb::kForRead);
if (es != Acad::eOk)
return es;
AcDbObjectId dictId = pObject->ownerId(); //get the owner id
es = pObject->close();
assert(es == Acad::eOk);
return dictionaryNameAt(name, itemId, dictId);
}
// Given a dictionary and a key name, retrieve the id for that entry.
inline Acad::ErrorStatus
dictionaryGetAt(AcDbObjectId& id, const ACHAR* name, AcDbObjectId ownerDictId)
{
assert(!ownerDictId.isNull());
AcDbDictionary* pDict;
Acad::ErrorStatus es = acdbOpenObject(pDict, ownerDictId, AcDb::kForRead);
assert(es == Acad::eOk);
if (es == Acad::eOk) {
es = pDict->getAt(name, id);
pDict->close();
}
return es;
}
#define DBDICTUTIL_MAKE_DICTIONARY_UTILS(LOWERNAME, UPPERNAME) \
inline Acad::ErrorStatus \
get##UPPERNAME##Id(AcDbObjectId& id, const ACHAR* name, AcDbDatabase* pDb) \
{ \
assert(pDb != NULL); \
return (pDb != NULL) \
? dictionaryGetAt(id, name, pDb->LOWERNAME##DictionaryId()) \
: Acad::eInvalidInput; \
} \
inline Acad::ErrorStatus \
get##UPPERNAME##Name(ACHAR*& name, AcDbObjectId itemId) \
{ \
AcDbDatabase* pDb = itemId.database(); \
return (pDb != NULL) \
? dictionaryNameAt(name, itemId, pDb->LOWERNAME##DictionaryId()) \
: Acad::eInvalidInput; \
} \
inline Acad::ErrorStatus \
get##UPPERNAME##Name(AcString& name, AcDbObjectId itemId) \
{ \
AcDbDatabase* pDb = itemId.database(); \
return (pDb != NULL) \
? dictionaryNameAt(name, itemId, pDb->LOWERNAME##DictionaryId()) \
: Acad::eInvalidInput; \
} \
inline bool \
has##UPPERNAME(const ACHAR* name, AcDbDatabase* pDb) \
{ \
AcDbObjectId id; \
return (get##UPPERNAME##Id(id, name, pDb) == Acad::eOk); \
}
DBDICTUTIL_MAKE_DICTIONARY_UTILS( mLStyle, MLStyle)
DBDICTUTIL_MAKE_DICTIONARY_UTILS( group, Group)
DBDICTUTIL_MAKE_DICTIONARY_UTILS( layout, Layout)
DBDICTUTIL_MAKE_DICTIONARY_UTILS( plotSettings, PlotSettings)
DBDICTUTIL_MAKE_DICTIONARY_UTILS( plotStyleName, PlotStyleName)
DBDICTUTIL_MAKE_DICTIONARY_UTILS( material, Material)
DBDICTUTIL_MAKE_DICTIONARY_UTILS( color, Color)
DBDICTUTIL_MAKE_DICTIONARY_UTILS( tableStyle, TableStyle)
DBDICTUTIL_MAKE_DICTIONARY_UTILS( visualStyle, VisualStyle)
#undef DBDICTUTIL_MAKE_DICTIONARY_UTILS
} // end AcDbDictUtil namespace
#endif // !AD_DBDICTUTIL_H
| [
"jwMoon@3e9e098e-e079-49b3-9d2b-ee27db7392fb"
] | jwMoon@3e9e098e-e079-49b3-9d2b-ee27db7392fb |
34d9accaec42ec6baddc52682e30aa08ec1da06c | 9627ea6c2d232c55a949064ff7c7c07c4dd7626a | /EASTL/deque.h | 7b239ef096c799d667fd982a1374eec6c1516806 | [] | no_license | picco911/Cheat_BF3 | e2d42785474348adfdfa44274999aa4d0ea68054 | 99888a880eed5410308f03258b35a11ce50d927e | refs/heads/master | 2020-03-27T21:05:14.875678 | 2018-09-02T19:13:16 | 2018-09-02T19:13:16 | 147,114,166 | 0 | 1 | null | 2018-09-02T19:11:31 | 2018-09-02T19:11:31 | null | UTF-8 | C++ | false | false | 3,480 | h | #pragma once
namespace eastl
{
template< typename T, unsigned int A > class DequeIterator
{
public:
T* mpCurrent; //0000
T* mpBegin; //0004
T* mpEnd; //0008
T** mpCurrentArrayPtr; //000C
DequeIterator<T,A> operator ++ ()
{
++mpCurrent;
if( mpCurrent == mpEnd )
{
++mpCurrentArrayPtr;
mpBegin = *mpCurrentArrayPtr;
mpEnd = *mpCurrentArrayPtr + A;
mpCurrent = mpBegin;
}
return (*this);
}
}; //sizeof() == 0x10
template< typename T, unsigned int A > class DequeBase
{
public:
T** mpPtrArray; //0000
int mnPtrArraySize; //0004
DequeIterator< T, A > mItBegin; //0008
DequeIterator< T, A > mItEnd; //0018
unsigned char pad[4]; //0028
}; //sizeof() == 0x2C
template< typename T, unsigned int A > class deque : public DequeBase< T, A >
{
public:
T* operator [] ( unsigned int n )
{
unsigned int m = n + mItBegin.mpCurrent - mItBegin.mpBegin;
unsigned int i = ( ( signed int )( m + 0x1000000 ) ) / A - ( sizeof( T ) * 0x10000 );
unsigned int b = m - A * ( ( signed int )( m + 0x1000000 ) ) / A - ( sizeof( T ) * 0x10000 );
return &this->mItBegin.mpCurrentArrayPtr[i][b];
}
bool empty()
{
return this->mItBegin.mpCurrent == this->mItEnd.mpCurrent;
}
void begin( eastl::DequeIterator< T, A >* result )
{
result->mpCurrent = mItBegin.mpCurrent;
result->mpBegin = mItBegin.mpBegin;
result->mpEnd = mItBegin.mpEnd;
result->mpCurrentArrayPtr = mItBegin.mpCurrentArrayPtr;
}
void end( eastl::DequeIterator< T, A >* result )
{
result->mpCurrent = mItEnd.mpCurrent;
result->mpBegin = mItEnd.mpBegin;
result->mpEnd = mItEnd.mpEnd;
result->mpCurrentArrayPtr = mItEnd.mpCurrentArrayPtr;
}
unsigned int size()
{
return
mItEnd.mpCurrent -
mItEnd.mpBegin +
( ( mItEnd.mpCurrentArrayPtr - mItBegin.mpCurrentArrayPtr ) << 6 ) +
mItBegin.mpEnd -
mItBegin.mpCurrent -
A;
}
T* front()
{
return mItBegin.mpCurrent;
}
void clear()
{
if( mItBegin.mpCurrentArrayPtr != mItEnd.mpCurrentArrayPtr && mItEnd.mpBegin )
{
delete[] mItEnd.mpBegin;
}
for( T** i = ( T** )( mItBegin.mpCurrentArrayPtr + 1 ); i < mItEnd.mpCurrentArrayPtr; ++i )
{
if( *i )
{
delete[] *i;
}
}
mItEnd.mpCurrent = mItBegin.mpCurrent;
mItEnd.mpBegin = mItBegin.mpBegin;
mItEnd.mpEnd = mItBegin.mpEnd;
mItEnd.mpCurrentArrayPtr = mItBegin.mpCurrentArrayPtr;
}
}; //sizeof() == 0x2C
}; | [
"39557080+BlackSickness@users.noreply.github.com"
] | 39557080+BlackSickness@users.noreply.github.com |
a8ee240497866b04b62dd536ba44440555ddfbad | 5885fd1418db54cc4b699c809cd44e625f7e23fc | /codeforces/1015/d.cpp | 9a8e21cf95d6b5e8466f0daf59ead83f937c3124 | [] | no_license | ehnryx/acm | c5f294a2e287a6d7003c61ee134696b2a11e9f3b | c706120236a3e55ba2aea10fb5c3daa5c1055118 | refs/heads/master | 2023-08-31T13:19:49.707328 | 2023-08-29T01:49:32 | 2023-08-29T01:49:32 | 131,941,068 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,012 | cpp | #include <bits/stdc++.h>
using namespace std;
#define _USE_MATH_DEFINES
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef complex<ld> pt;
typedef vector<pt> pol;
const char nl = '\n';
const int INF = 0x3f3f3f3f;
const ll INFLL = 0x3f3f3f3f3f3f3f3f;
const ll MOD = 1e9+7;
const ld EPS = 1e-10;
mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count());
//#define FILEIO
int main() {
ios::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
cout << fixed << setprecision(10);
#ifdef FILEIO
freopen("test.in", "r", stdin);
freopen("test.out", "w", stdout);
#endif
ll n, k, s;
cin >> n >> k >> s;
if (k*(n-1) < s || k > s) {
cout << "NO" << nl;
}
else {
cout << "YES" << nl;
ll v = s/k;
ll o = s - k*v;
ll cur = 1;
ll dir = 1;
for (int i = 0; i < k; i++) {
cur += dir*v;
if (o) {
cur += dir;
o--;
}
dir = -dir;
cout << cur << " ";
}
cout << nl;
}
return 0;
}
| [
"henryxia9999@gmail.com"
] | henryxia9999@gmail.com |
51cba9dfc1efa82f952b1cf03a3a7fda2a406bbd | 52ca17dca8c628bbabb0f04504332c8fdac8e7ea | /boost/phoenix/object/detail/new.hpp | e924de0236e4790f8a08186a0fb7b9ad18f5568d | [] | no_license | qinzuoyan/thirdparty | f610d43fe57133c832579e65ca46e71f1454f5c4 | bba9e68347ad0dbffb6fa350948672babc0fcb50 | refs/heads/master | 2021-01-16T17:47:57.121882 | 2015-04-21T06:59:19 | 2015-04-21T06:59:19 | 33,612,579 | 0 | 0 | null | 2015-04-08T14:39:51 | 2015-04-08T14:39:51 | null | UTF-8 | C++ | false | false | 71 | hpp | #include "thirdparty/boost_1_58_0/boost/phoenix/object/detail/new.hpp"
| [
"qinzuoyan@xiaomi.com"
] | qinzuoyan@xiaomi.com |
4a5dc060fa2c6c747f88f4829d1375f0ee903616 | 787bf540a58938da41c43a38e0f45d3cddfb7abb | /tests/facesim/Public_Library/Arrays/ARRAY.h | 6b27439aa2c17b0127ca9e2b348ed550b18beda0 | [] | no_license | GammaPi/Parsec-2.0 | dfba038d37151883167acee97e675ee2edfe538f | 713367e86d9cc2c28cd2b7f2c7db0ecea82d2905 | refs/heads/main | 2023-05-07T08:49:11.584191 | 2021-05-18T18:05:56 | 2021-05-18T18:05:56 | 368,624,291 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 22,859 | h | //#####################################################################
// Copyright 2004-2006, Ronald Fedkiw, Eftychios Sifakis.
// This file is part of PhysBAM whose distribution is governed by the license contained in the accompanying file PHYSBAM_COPYRIGHT.txt.
//#####################################################################
// Class ARRAY
//#####################################################################
#ifndef __ARRAY__
#define __ARRAY__
#include <cstdlib>
#include <assert.h>
#include <stdio.h>
#include <iostream>
#include "../Matrices_And_Vectors/VECTOR_2D.h"
#include "../Math_Tools/exchange.h"
#include "../Math_Tools/max.h"
#include "../Math_Tools/maxabs.h"
#include "../Math_Tools/maxmag.h"
#include "../Math_Tools/min.h"
#include "../Math_Tools/minmag.h"
#include "../Read_Write/READ_WRITE_FUNCTIONS.h"
#include "../Utilities/TYPE_UTILITIES.h"
#include "../Utilities/STATIC_ASSERT.h"
namespace PhysBAM
{
template<class T_ARRAY> class ARRAY_RANGE;
template<class T>
class ARRAY
{
public:
typedef T ELEMENT;
int m; // end of the array
T* base_pointer; // starts at [1], not [0]
ARRAY()
: m (0)
{
Set_Base_Pointer (0);
}
explicit ARRAY (const int m_input, const bool initialize_using_default_constructor = true)
: m (m_input)
{
T* array = new T[m];
Set_Base_Pointer (array);
if (initialize_using_default_constructor) for (int index = 0; index < m; index++) array[index] = T();
}
ARRAY (const ARRAY<T>& array_input, const bool initialize_using_default_constructor = true)
: m (array_input.m)
{
T* array = new T[m];
Set_Base_Pointer (array);
T* old_array = array_input.Get_Array_Pointer();
if (initialize_using_default_constructor) for (int index = 0; index < m; index++) array[index] = old_array[index];
}
ARRAY (std::istream& input_stream)
: m (0)
{
Set_Base_Pointer (0);
Read<T> (input_stream);
}
~ARRAY()
{
Deallocate_Base_Pointer();
}
void Clean_Memory()
{
Resize_Array (0, false, false);
}
void Delete_Pointers_And_Clean_Memory() // only valid if T is a pointer type
{
for (int i = 1; i <= m; i++) delete base_pointer[i];
Clean_Memory();
}
T* Allocate_Base_Pointer (const int m_input)
{
return (new T[m_input]) - 1;
}
void Set_Base_Pointer (T* array)
{
base_pointer = array - 1;
}
T* Get_Array_Pointer() const
{
return base_pointer + 1;
}
void Deallocate_Base_Pointer()
{
//if(!(base_pointer + 1)) {
delete[] (base_pointer + 1);
//}
}
ARRAY<T>& operator= (const ARRAY<T>& source)
{
if (!Equal_Dimensions (*this, source))
{
Deallocate_Base_Pointer();
m = source.m;
base_pointer = Allocate_Base_Pointer (m);
}
T *array = Get_Array_Pointer(), *source_array = source.Get_Array_Pointer();
for (int index = 0; index < m; index++) array[index] = source_array[index];
return *this;
}
T& operator() (const int i)
{
assert (Valid_Index (i));
return base_pointer[i];
}
const T& operator() (const int i) const
{
assert (Valid_Index (i));
return base_pointer[i];
}
ARRAY_RANGE<ARRAY> Range (const VECTOR_2D<int>& range)
{
return ARRAY_RANGE<ARRAY> (*this, range);
}
ARRAY_RANGE<const ARRAY> Range (const VECTOR_2D<int>& range) const
{
return ARRAY_RANGE<const ARRAY> (*this, range);
}
bool Valid_Index (const int i) const
{
return 1 <= i && i <= m;
}
ARRAY<T>& operator+= (const ARRAY<T>& v)
{
assert (Equal_Dimensions (*this, v));
for (int index = 1; index <= m; index++) (*this) (index) += v (index);
return *this;
}
ARRAY<T>& operator+= (const T& a)
{
for (int index = 1; index <= m; index++) (*this) (index) += a;
return *this;
}
ARRAY<T>& operator-= (const ARRAY<T>& v)
{
assert (Equal_Dimensions (*this, v));
for (int index = 1; index <= m; index++) (*this) (index) -= v (index);
return *this;
}
ARRAY<T>& operator-= (const T& a)
{
for (int index = 1; index <= m; index++) (*this) (index) -= a;
return *this;
}
template<class T2>
ARRAY<T>& operator*= (const ARRAY<T2>& v)
{
assert (Equal_Dimensions (*this, v));
for (int index = 1; index <= m; index++) (*this) (index) *= v (index);
return *this;
}
template<class T2>
ARRAY<T>& operator*= (const T2 a)
{
for (int index = 1; index <= m; index++) (*this) (index) *= a;
return *this;
}
template<class T2>
ARRAY<T>& operator/= (const T2 a)
{
T2 one_over_a = 1 / a;
for (int index = 1; index <= m; index++) (*this) (index) *= one_over_a;
return *this;
}
template<class T2>
ARRAY<T>& operator/= (const ARRAY<T2>& a)
{
for (int index = 1; index <= m; index++)
{
assert (a (index) > 0);
(*this) (index) /= a (index);
}
return *this;
}
void Resize_Array (const int m_new, const bool initialize_new_elements = true, const bool copy_existing_elements = true, const T& initialization_value = T())
{
if (Equal_Dimensions (*this, m_new)) return;
T* base_pointer_new = Allocate_Base_Pointer (m_new);
if (copy_existing_elements)
{
int m_end = PhysBAM::min (m, m_new);
for (int index = 1; index <= m_end; index++) base_pointer_new[index] = base_pointer[index];
}
if (initialize_new_elements)
{
int m_end = PhysBAM::min (m, m_new);
for (int index = m_end + 1; index <= m_new; index++) base_pointer_new[index] = initialization_value;
}
Deallocate_Base_Pointer();
m = m_new;
base_pointer = base_pointer_new;
}
void Append_Element (const T& element)
{
assert (&element - &base_pointer[1] < 0 || &element - &base_pointer[1] >= m); // make sure element isn't a reference into the current array
Resize_Array (m + 1);
(*this) (m) = element;
}
void Append_Elements (const ARRAY<T>& append_array)
{
int index = m;
Resize_Array (m + append_array.m);
for (int i = 1; i <= append_array.m; i++)
{
index++;
(*this) (index) = append_array (i);
}
}
void Append_Unique_Element (const T& element)
{
int index;
if (Find (element, index)) return;
Resize_Array (m + 1);
(*this) (m) = element;
}
void Append_Unique_Elements (const ARRAY<T>& append_array)
{
ARRAY<int> append (append_array.m);
int count = 0, j;
for (j = 1; j <= append_array.m; j++)
{
int unique = 1, index;
if (Find (append_array (j), index)) unique = 0;
if (unique && append_array.Find (append_array (j), j + 1, index)) unique = 0; // element occurs duplicated in given array (only copy last instance)
if (unique)
{
count++;
append (j) = 1;
}
}
int index = m + 1;
Resize_Array (m + count);
for (int k = 1; k <= append.m; k++) if (append (k)) (*this) (index++) = append_array (k);
}
void Remove_Index (const int index) // maintains ordering of remaining elements
{
assert (Valid_Index (index));
T* base_pointer_new = Allocate_Base_Pointer (m - 1);
int i, cut = index;
for (i = 1; i < cut; i++) base_pointer_new[i] = base_pointer[i];
for (int j = i + 1; i <= m - 1; i++, j++) base_pointer_new[i] = base_pointer[j];
Deallocate_Base_Pointer();
m--;
base_pointer = base_pointer_new;
}
void Remove_Indices (const ARRAY<int>& index)
{
if (index.m == 0) return;
for (int kk = 1; kk <= index.m - 1; kk++)
{
assert (Valid_Index (index (kk)));
for (int i = index (kk) + 1 - kk; i <= index (kk + 1) - 1 - kk; i++) (*this) (i) = (*this) (i + kk);
}
for (int i = index (index.m) + 1 - index.m; i <= m - index.m; i++) (*this) (i) = (*this) (i + index.m);
Resize_Array (m - index.m);
}
bool Find (const T& element, int& index) const // returns the first occurence of an element in an array
{
return Find (element, 1, index);
}
bool Find (const T& element, const int start_index, int& index) const // returns the first occurence after start_index of an element in an array
{
for (int i = start_index; i <= m; i++) if ( (*this) (i) == element)
{
index = i;
return true;
}
return false;
}
void Insert_Element (const T& element, const int index)
{
Resize_Array (m + 1);
for (int i = m; i > index; i--) (*this) (i) = (*this) (i - 1);
(*this) (index) = element;
}
int Count_Matches (const T& value) const
{
int count = 0;
for (int index = 1; index <= m; index++) if ( (*this) (index) == value) count++;
return count;
}
int Number_True() const
{
return Count_Matches (true);
}
int Number_False() const
{
return Count_Matches (false);
}
template<class T_ARRAY>
static void copy (const T& constant, T_ARRAY& new_copy)
{
STATIC_ASSERT ( (IS_SAME<T, typename T_ARRAY::ELEMENT>::value));
for (int index = 1; index <= new_copy.m; index++) new_copy (index) = constant;
}
template<class T_ARRAY>
static void copy (const T& constant, ARRAY_RANGE<T_ARRAY> new_copy)
{
STATIC_ASSERT ( (IS_SAME<T, typename T_ARRAY::ELEMENT>::value));
for (int index = 1; index <= new_copy.m; index++) new_copy (index) = constant;
}
static void copy (const ARRAY<T>& old_copy, ARRAY<T>& new_copy)
{
assert (Equal_Dimensions (old_copy, new_copy));
for (int index = 1; index <= old_copy.m; index++) new_copy (index) = old_copy (index);
}
static void copy_up_to (const ARRAY<T>& old_copy, ARRAY<T>& new_copy, const int up_to_index)
{
assert (up_to_index <= old_copy.m && up_to_index <= new_copy.m);
for (int index = 1; index <= up_to_index; index++) new_copy (index) = old_copy (index);
}
template<class T2>
static void copy (const T2 constant, const ARRAY<T>& old_copy, ARRAY<T>& new_copy)
{
assert (Equal_Dimensions (old_copy, new_copy));
for (int index = 1; index <= old_copy.m; index++) new_copy (index) = constant * old_copy (index);
}
template<class T2>
static void copy (const T2 c1, const ARRAY<T>& v1, const ARRAY<T>& v2, ARRAY<T>& result)
{
assert (Equal_Dimensions (v1, v2) && Equal_Dimensions (v2, result));
for (int index = 1; index <= result.m; index++) result (index) = c1 * v1 (index) + v2 (index);
}
template<class T2>
static void copy_up_to (const T2 c1, const ARRAY<T>& v1, const ARRAY<T>& v2, ARRAY<T>& result, const int up_to_index)
{
assert (v1.m >= up_to_index && v2.m >= up_to_index && result.m >= up_to_index);
for (int index = 1; index <= up_to_index; index++) result (index) = c1 * v1 (index) + v2 (index);
}
template<class T2>
static void copy (const T2 c1, const ARRAY<T>& v1, const T2 c2, const ARRAY<T>& v2, ARRAY<T>& result)
{
assert (Equal_Dimensions (v1, v2) && Equal_Dimensions (v2, result));
for (int index = 1; index <= result.m; index++) result (index) = c1 * v1 (index) + c2 * v2 (index);
}
template<class T2>
static void copy (const T2 c1, const ARRAY<T>& v1, const T2 c2, const ARRAY<T>& v2, const T2 c3, const ARRAY<T>& v3, ARRAY<T>& result)
{
assert (Equal_Dimensions (v1, v2) && Equal_Dimensions (v2, v3) && Equal_Dimensions (v3, result));
for (int index = 1; index <= result.m; index++) result (index) = c1 * v1 (index) + c2 * v2 (index) + c3 * v3 (index);
}
template<class T2>
static void copy_up_to (const T2 c1, const ARRAY<T>& v1, const T2 c2, const ARRAY<T>& v2, ARRAY<T>& result, const int up_to_index)
{
assert (v1.m >= up_to_index && v2.m >= up_to_index && result.m >= up_to_index);
for (int index = 1; index <= up_to_index; index++) result (index) = c1 * v1 (index) + c2 * v2 (index);
}
static void get (ARRAY<T>& new_copy, const ARRAY<T>& old_copy)
{
ARRAY<T>::put (old_copy, new_copy, new_copy.m);
}
static void put (const ARRAY<T>& old_copy, ARRAY<T>& new_copy)
{
ARRAY<T>::put (old_copy, new_copy, old_copy.m);
}
template<class T2>
static void put (const T2 constant, const ARRAY<T>& old_copy, ARRAY<T>& new_copy)
{
ARRAY<T>::put (constant, old_copy, new_copy, old_copy.m);
}
static void put (const ARRAY<T>& old_copy, ARRAY<T>& new_copy, const int m)
{
assert (m <= old_copy.m);
assert (m <= new_copy.m);
for (int index = 1; index <= m; index++) new_copy (index) = old_copy (index);
}
template<class T2>
static void put (T2 constant, const ARRAY<T>& old_copy, ARRAY<T>& new_copy, const int m)
{
assert (m <= old_copy.m);
assert (m <= new_copy.m);
for (int index = 1; index <= m; index++) new_copy (index) = constant * old_copy (index);
}
static T max (const ARRAY<T>& a)
{
return max (a, a.m);
}
static T max (const ARRAY<T>& a, const int up_to_index)
{
T result = a (1);
for (int index = 2; index <= up_to_index; index++) result = PhysBAM::max (result, a (index));
return result;
}
static T maxabs (const ARRAY<T>& a)
{
return maxabs (a, a.m);
}
static T maxabs (const ARRAY<T>& a, const int up_to_index)
{
T result = (T) fabs (a (1));
for (int index = 2; index <= up_to_index; index++) result = maxabs_incremental (result, a (index));
return result;
}
static T maxmag (const ARRAY<T>& a)
{
return maxmag (a, a.m);
}
static T maxmag (const ARRAY<T>& a, const int up_to_index)
{
T result = a (1);
for (int index = 2; index <= up_to_index; index++) result = PhysBAM::maxmag (result, a (index));
return result;
}
static int argmax (const ARRAY<T>& a)
{
return argmax (a, a.m);
}
static int argmax (const ARRAY<T>& a, const int up_to_index)
{
int result = 1;
for (int index = 2; index <= up_to_index; index++) if (a (index) > a (result)) result = index;
return result;
}
static T min (const ARRAY<T>& a)
{
return min (a, a.m);
}
static T min (const ARRAY<T>& a, const int up_to_index)
{
T result = a (1);
for (int index = 2; index <= up_to_index; index++) result = PhysBAM::min (result, a (index));
return result;
}
static T minmag (ARRAY<T>& a)
{
return minmag (a, a.m);
}
static T minmag (ARRAY<T>& a, const int up_to_index)
{
T result = a (1);
for (int index = 2; index <= up_to_index; index++) result = PhysBAM::minmag (result, a (index));
return result;
}
static int argmin (const ARRAY<T>& a)
{
return argmin (a, a.m);
}
static int argmin (const ARRAY<T>& a, const int up_to_index)
{
int result = 1;
for (int index = 2; index <= up_to_index; index++) if (a (index) < a (result)) result = index;
return result;
}
static T sum (const ARRAY<T>& a)
{
return sum (a, a.m);
}
static T sum (const ARRAY<T>& a, const int up_to_index)
{
T result = T();
for (int index = 1; index <= up_to_index; index++) result += a (index);
return result;
}
static T sumabs (const ARRAY<T>& a)
{
return sumabs (a, a.m);
}
static T sumabs (const ARRAY<T>& a, const int up_to_index)
{
T result = T();
for (int index = 1; index <= up_to_index; index++) result += fabs (a (index));
return result;
}
static T Dot_Product (const ARRAY<T>& a1, const ARRAY<T>& a2)
{
assert (a1.m == a2.m);
T result = T();
for (int index = 1; index <= a1.m; index++) result += a1 (index) * a2 (index);
return result;
}
template<class TS, class T_ARRAY1, class T_ARRAY2>
static TS Vector_Dot_Product (const T_ARRAY1& a1, const T_ARRAY2& a2)
{
STATIC_ASSERT ( (IS_SAME<T, typename T_ARRAY1::ELEMENT>::value && IS_SAME<T, typename T_ARRAY2::ELEMENT>::value));
assert (a1.m == a2.m);
TS result = (TS) 0;
for (int index = 1; index <= a1.m; index++) result += T::Dot_Product (a1 (index), a2 (index));
return result;
}
template<class TS, class T_ARRAY>
static TS Vector_Magnitude_Squared (const T_ARRAY& a)
{
STATIC_ASSERT ( (IS_SAME<T, typename T_ARRAY::ELEMENT>::value));
TS result = (TS) 0;
for (int index = 1; index <= a.m; index++) result += a (index).Magnitude_Squared();
return result;
}
template<class TS, class T_ARRAY>
static TS Vector_Magnitude (const T_ARRAY& a)
{
return sqrt (Vector_Magnitude_Squared (a));
}
template<class TS>
static TS Vector_Distance (const ARRAY<T>& a, const ARRAY<T>& b)
{
assert (a.m == b.m);
TS distance = (TS) 0;
for (int index = 1; index <= a.m; index++) distance += (a (index) - b (index)).Magnitude_Squared();
return sqrt (distance);
}
template<class TS, class T_ARRAY>
static TS Maximum_Vector_Magnitude (const T_ARRAY& a)
{
return Maximum_Vector_Magnitude<TS> (a, a.m);
}
template<class TS, class T_ARRAY>
static TS Maximum_Vector_Magnitude (const T_ARRAY& a, const int up_to_index)
{
STATIC_ASSERT ( (IS_SAME<T, typename T_ARRAY::ELEMENT>::value));
TS result = (TS) 0;
for (int index = 1; index <= up_to_index; index++) result = PhysBAM::max (result, a (index).Magnitude_Squared());
return sqrt (result);
}
template<class TS>
static TS Maximum_Pairwise_Vector_Distance (const ARRAY<T>& a, const ARRAY<T>& b)
{
assert (a.m == b.m);
return Maximum_Pairwise_Vector_Distance<TS> (a, b, a.m);
}
template<class TS>
static TS Maximum_Pairwise_Vector_Distance (const ARRAY<T>& a, const ARRAY<T>& b, const int up_to_index)
{
TS result = (TS) 0;
for (int index = 1; index <= up_to_index; index++) result = PhysBAM::max (result, (a (index) - b (index)).Magnitude_Squared());
return sqrt (result);
}
static void find_common_elements (const ARRAY<T>& a, const ARRAY<T>& b, ARRAY<T>& result)
{
assert (a.base_pointer != result.base_pointer);
assert (b.base_pointer != result.base_pointer);
result.Resize_Array (0);
int j;
for (int i = 1; i <= a.m; i++) if (b.Find (a (i), j)) result.Append_Element (a (i));
}
static void exchange_arrays (ARRAY<T>& a, ARRAY<T>& b)
{
exchange (a.base_pointer, b.base_pointer);
exchange (a.m, b.m);
}
template<class T2>
static bool Equal_Dimensions (const ARRAY<T>& a, const ARRAY<T2>& b)
{
return a.m == b.m;
}
static bool Equal_Dimensions (const ARRAY<T>& a, const int m)
{
return a.m == m;
}
static void heapify (ARRAY<T>& a) // largest on top
{
for (int i = a.m / 2; i >= 1; i--) heapify (a, i, a.m);
}
static void heapify (ARRAY<T>& a, const int max_index) // largest on top, only does from 1 to max_index
{
for (int i = max_index / 2; i >= 1; i--) heapify (a, i, max_index);
}
template<class T2>
static void heapify (ARRAY<T>& a, ARRAY<T2>& aux) // largest on top
{
for (int i = a.m / 2; i >= 1; i--) heapify (a, aux, i, a.m);
}
template<class T2>
static void heapify (ARRAY<T>& a, ARRAY<T2>& aux, const int max_index) // largest on top, only does from 1 to max_index
{
for (int i = max_index / 2; i >= 1; i--) heapify (a, aux, i, max_index);
}
static void heapify (ARRAY<T>& a, int index, const int heap_size) // largest on top, only sorts down from index (not up!)
{
int left, right, index_of_largest;
for (;;)
{
left = 2 * index;
right = 2 * index + 1;
index_of_largest = index;
if (left <= heap_size && a (left) > a (index_of_largest)) index_of_largest = left;
if (right <= heap_size && a (right) > a (index_of_largest)) index_of_largest = right;
if (index_of_largest != index)
{
exchange (a (index), a (index_of_largest));
index = index_of_largest;
}
else return;
}
}
template<class T2>
static void heapify (ARRAY<T>& a, ARRAY<T2>& aux, int index, const int heap_size) // largest on top, only sorts down from index (not up!)
{
int left, right, index_of_largest;
for (;;)
{
left = 2 * index;
right = 2 * index + 1;
index_of_largest = index;
if (left <= heap_size && a (left) > a (index_of_largest)) index_of_largest = left;
if (right <= heap_size && a (right) > a (index_of_largest)) index_of_largest = right;
if (index_of_largest != index)
{
exchange (a (index), a (index_of_largest));
exchange (aux (index), aux (index_of_largest));
index = index_of_largest;
}
else return;
}
}
static void sort (ARRAY<T>& a) // from smallest to largest
{
heapify (a);
for (int i = 1; i < a.m; i++)
{
exchange (a (1), a (a.m - i + 1));
heapify (a, 1, a.m - i);
}
}
static void sort (ARRAY<T>& a, const int max_index) // sort a(1:max_index) from smallest to largest
{
heapify (a, max_index);
for (int i = 1; i < max_index; i++)
{
exchange (a (1), a (max_index - i + 1));
heapify (a, 1, max_index - i);
}
}
template<class T2>
static void sort (ARRAY<T>& a, ARRAY<T2>& aux) // from smallest to largest
{
heapify (a, aux);
for (int i = 1; i < a.m; i++)
{
exchange (a (1), a (a.m + 1 - i));
exchange (aux (1), aux (a.m + 1 - i));
heapify (a, aux, 1, a.m - i);
}
}
template<class T2>
static void sort (ARRAY<T>& a, ARRAY<T2>& aux, const int max_index) // sort a(1:max_index) from smallest to largest
{
heapify (a, aux, max_index);
for (int i = 1; i < max_index; i++)
{
exchange (a (1), a (max_index + 1 - i));
exchange (aux (1), aux (max_index + 1 - i));
heapify (a, aux, 1, max_index - i);
}
}
static void permute (const ARRAY<T>& source, ARRAY<T>& destination, const ARRAY<int>& permutation)
{
for (int i = 1; i <= permutation.m; i++) destination (i) = source (permutation (i));
}
static void unpermute (const ARRAY<T>& source, ARRAY<T>& destination, const ARRAY<int>& permutation)
{
for (int i = 1; i <= permutation.m; i++) destination (permutation (i)) = source (i);
}
template<class T2>
static void Compact_Array_Using_Compaction_Array (ARRAY<T2>& array, ARRAY<int>& compaction_array, ARRAY<T2>* temporary_array = 0)
{
bool temporary_array_defined = temporary_array != 0;
if (!temporary_array_defined) temporary_array = new ARRAY<T2> (compaction_array.m, false);
ARRAY<T2>::exchange_arrays (array, *temporary_array);
for (int i = 1; i <= compaction_array.m; i++) if (compaction_array (i) > 0) array (compaction_array (i)) = (*temporary_array) (i);
if (!temporary_array_defined)
{
delete temporary_array;
temporary_array = 0;
}
}
void Get (const int i, T& element1) const
{
assert (Valid_Index (i));
T* a = base_pointer + i;
element1 = a[0];
}
void Set (const int i, const T& element1)
{
assert (Valid_Index (i));
T* a = base_pointer + i;
a[0] = element1;
}
template<class RW>
void Read (std::istream& input_stream)
{
Deallocate_Base_Pointer();
Read_Binary<RW> (input_stream, m);
assert (m >= 0);
T* array = 0;
if (m > 0)
{
array = new T[m];
Read_Binary_Array<RW> (input_stream, array, m);
}
Set_Base_Pointer (array);
}
template<class RW>
void Write (std::ostream& output_stream) const
{
Write_Prefix<RW> (output_stream, m);
}
template<class RW>
void Write_Prefix (std::ostream& output_stream, const int prefix) const
{
assert (0 <= prefix && prefix <= m);
Write_Binary<RW> (output_stream, prefix);
Write_Binary_Array<RW> (output_stream, Get_Array_Pointer(), prefix);
}
private:
// old forms of functions which should not be called!
ARRAY (const int m_start, const int m_end) {}
void Resize_Array (const int m_start, const int m_end) {}
void Resize_Array (const int m_start, const int m_end, const bool initialize_new_elements) {}
void Resize_Array (const int m_start, const int m_end, const bool initialize_new_elements, const bool copy_existing_elements) {}
//#####################################################################
};
}
#endif
| [
"mrsteventang@outlook.com"
] | mrsteventang@outlook.com |
6f6a49cfc5d63f9c7f292d5af0489e22a4cbcc6f | 9e6b5ba9259d0fd6a9ad82a1cd89de627477cc86 | /Sources/yocto_bluetoothlink.h | 5369314cd73f2669555d536c9107608020318c66 | [] | no_license | giapdangle/yoctolib_cpp | 82b9ade1e2b1e3d6fa8decb8065b535ba19e145f | fb24a749382b866ca31c32e6acdaccb68b585933 | refs/heads/master | 2021-01-22T12:12:28.361797 | 2015-05-20T16:32:53 | 2015-05-20T16:32:53 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 12,793 | h | /*********************************************************************
*
* $Id: yocto_bluetoothlink.h 20326 2015-05-12 15:35:18Z seb $
*
* Declares yFindBluetoothLink(), the high-level API for BluetoothLink functions
*
* - - - - - - - - - License information: - - - - - - - - -
*
* Copyright (C) 2011 and beyond by Yoctopuce Sarl, Switzerland.
*
* Yoctopuce Sarl (hereafter Licensor) grants to you a perpetual
* non-exclusive license to use, modify, copy and integrate this
* file into your software for the sole purpose of interfacing
* with Yoctopuce products.
*
* You may reproduce and distribute copies of this file in
* source or object form, as long as the sole purpose of this
* code is to interface with Yoctopuce products. You must retain
* this notice in the distributed source file.
*
* You should refer to Yoctopuce General Terms and Conditions
* for additional information regarding your rights and
* obligations.
*
* THE SOFTWARE AND DOCUMENTATION ARE PROVIDED 'AS IS' WITHOUT
* WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING
* WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO
* EVENT SHALL LICENSOR BE LIABLE FOR ANY INCIDENTAL, SPECIAL,
* INDIRECT OR CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA,
* COST OF PROCUREMENT OF SUBSTITUTE GOODS, TECHNOLOGY OR
* SERVICES, ANY CLAIMS BY THIRD PARTIES (INCLUDING BUT NOT
* LIMITED TO ANY DEFENSE THEREOF), ANY CLAIMS FOR INDEMNITY OR
* CONTRIBUTION, OR OTHER SIMILAR COSTS, WHETHER ASSERTED ON THE
* BASIS OF CONTRACT, TORT (INCLUDING NEGLIGENCE), BREACH OF
* WARRANTY, OR OTHERWISE.
*
*********************************************************************/
#ifndef YOCTO_BLUETOOTHLINK_H
#define YOCTO_BLUETOOTHLINK_H
#include "yocto_api.h"
#include <cfloat>
#include <cmath>
#include <map>
//--- (YBluetoothLink return codes)
//--- (end of YBluetoothLink return codes)
//--- (YBluetoothLink definitions)
class YBluetoothLink; // forward declaration
typedef void (*YBluetoothLinkValueCallback)(YBluetoothLink *func, const string& functionValue);
#define Y_OWNADDRESS_INVALID (YAPI_INVALID_STRING)
#define Y_PAIRINGPIN_INVALID (YAPI_INVALID_STRING)
#define Y_REMOTEADDRESS_INVALID (YAPI_INVALID_STRING)
#define Y_MESSAGE_INVALID (YAPI_INVALID_STRING)
#define Y_COMMAND_INVALID (YAPI_INVALID_STRING)
//--- (end of YBluetoothLink definitions)
//--- (YBluetoothLink declaration)
/**
* YBluetoothLink Class: BluetoothLink function interface
*
* BluetoothLink function provides control over bluetooth link
* and status for devices that are bluetooth-enabled.
*/
class YOCTO_CLASS_EXPORT YBluetoothLink: public YFunction {
#ifdef __BORLANDC__
#pragma option push -w-8022
#endif
//--- (end of YBluetoothLink declaration)
protected:
//--- (YBluetoothLink attributes)
// Attributes (function value cache)
string _ownAddress;
string _pairingPin;
string _remoteAddress;
string _message;
string _command;
YBluetoothLinkValueCallback _valueCallbackBluetoothLink;
friend YBluetoothLink *yFindBluetoothLink(const string& func);
friend YBluetoothLink *yFirstBluetoothLink(void);
// Function-specific method for parsing of JSON output and caching result
virtual int _parseAttr(yJsonStateMachine& j);
// Constructor is protected, use yFindBluetoothLink factory function to instantiate
YBluetoothLink(const string& func);
//--- (end of YBluetoothLink attributes)
public:
~YBluetoothLink();
//--- (YBluetoothLink accessors declaration)
static const string OWNADDRESS_INVALID;
static const string PAIRINGPIN_INVALID;
static const string REMOTEADDRESS_INVALID;
static const string MESSAGE_INVALID;
static const string COMMAND_INVALID;
/**
* Returns the MAC-48 address of the bluetooth interface, which is unique on the bluetooth network.
*
* @return a string corresponding to the MAC-48 address of the bluetooth interface, which is unique on
* the bluetooth network
*
* On failure, throws an exception or returns Y_OWNADDRESS_INVALID.
*/
string get_ownAddress(void);
inline string ownAddress(void)
{ return this->get_ownAddress(); }
/**
* Returns an opaque string if a PIN code has been configured in the device to access
* the SIM card, or an empty string if none has been configured or if the code provided
* was rejected by the SIM card.
*
* @return a string corresponding to an opaque string if a PIN code has been configured in the device to access
* the SIM card, or an empty string if none has been configured or if the code provided
* was rejected by the SIM card
*
* On failure, throws an exception or returns Y_PAIRINGPIN_INVALID.
*/
string get_pairingPin(void);
inline string pairingPin(void)
{ return this->get_pairingPin(); }
/**
* Changes the PIN code used by the module for bluetooth pairing.
* Remember to call the saveToFlash() method of the module to save the
* new value in the device flash.
*
* @param newval : a string corresponding to the PIN code used by the module for bluetooth pairing
*
* @return YAPI_SUCCESS if the call succeeds.
*
* On failure, throws an exception or returns a negative error code.
*/
int set_pairingPin(const string& newval);
inline int setPairingPin(const string& newval)
{ return this->set_pairingPin(newval); }
/**
* Returns the MAC-48 address of the remote device to connect to.
*
* @return a string corresponding to the MAC-48 address of the remote device to connect to
*
* On failure, throws an exception or returns Y_REMOTEADDRESS_INVALID.
*/
string get_remoteAddress(void);
inline string remoteAddress(void)
{ return this->get_remoteAddress(); }
/**
* Changes the MAC-48 address defining which remote device to connect to.
*
* @param newval : a string corresponding to the MAC-48 address defining which remote device to connect to
*
* @return YAPI_SUCCESS if the call succeeds.
*
* On failure, throws an exception or returns a negative error code.
*/
int set_remoteAddress(const string& newval);
inline int setRemoteAddress(const string& newval)
{ return this->set_remoteAddress(newval); }
/**
* Returns the latest status message from the bluetooth interface.
*
* @return a string corresponding to the latest status message from the bluetooth interface
*
* On failure, throws an exception or returns Y_MESSAGE_INVALID.
*/
string get_message(void);
inline string message(void)
{ return this->get_message(); }
string get_command(void);
inline string command(void)
{ return this->get_command(); }
int set_command(const string& newval);
inline int setCommand(const string& newval)
{ return this->set_command(newval); }
/**
* Retrieves a cellular interface for a given identifier.
* The identifier can be specified using several formats:
* <ul>
* <li>FunctionLogicalName</li>
* <li>ModuleSerialNumber.FunctionIdentifier</li>
* <li>ModuleSerialNumber.FunctionLogicalName</li>
* <li>ModuleLogicalName.FunctionIdentifier</li>
* <li>ModuleLogicalName.FunctionLogicalName</li>
* </ul>
*
* This function does not require that the cellular interface is online at the time
* it is invoked. The returned object is nevertheless valid.
* Use the method YBluetoothLink.isOnline() to test if the cellular interface is
* indeed online at a given time. In case of ambiguity when looking for
* a cellular interface by logical name, no error is notified: the first instance
* found is returned. The search is performed first by hardware name,
* then by logical name.
*
* @param func : a string that uniquely characterizes the cellular interface
*
* @return a YBluetoothLink object allowing you to drive the cellular interface.
*/
static YBluetoothLink* FindBluetoothLink(string func);
/**
* Registers the callback function that is invoked on every change of advertised value.
* The callback is invoked only during the execution of ySleep or yHandleEvents.
* This provides control over the time when the callback is triggered. For good responsiveness, remember to call
* one of these two functions periodically. To unregister a callback, pass a null pointer as argument.
*
* @param callback : the callback function to call, or a null pointer. The callback function should take two
* arguments: the function object of which the value has changed, and the character string describing
* the new advertised value.
* @noreturn
*/
virtual int registerValueCallback(YBluetoothLinkValueCallback callback);
using YFunction::registerValueCallback;
virtual int _invokeValueCallback(string value);
/**
* Attempt to connect to the previously selected remote device.
*
* @return YAPI_SUCCESS when the call succeeds.
*
* On failure, throws an exception or returns a negative error code.
*/
virtual int connect(void);
/**
* Disconnect from the previously selected remote device.
*
* @return YAPI_SUCCESS when the call succeeds.
*
* On failure, throws an exception or returns a negative error code.
*/
virtual int disconnect(void);
inline static YBluetoothLink* Find(string func)
{ return YBluetoothLink::FindBluetoothLink(func); }
/**
* Continues the enumeration of cellular interfaces started using yFirstBluetoothLink().
*
* @return a pointer to a YBluetoothLink object, corresponding to
* a cellular interface currently online, or a null pointer
* if there are no more cellular interfaces to enumerate.
*/
YBluetoothLink *nextBluetoothLink(void);
inline YBluetoothLink *next(void)
{ return this->nextBluetoothLink();}
/**
* Starts the enumeration of cellular interfaces currently accessible.
* Use the method YBluetoothLink.nextBluetoothLink() to iterate on
* next cellular interfaces.
*
* @return a pointer to a YBluetoothLink object, corresponding to
* the first cellular interface currently online, or a null pointer
* if there are none.
*/
static YBluetoothLink* FirstBluetoothLink(void);
inline static YBluetoothLink* First(void)
{ return YBluetoothLink::FirstBluetoothLink();}
#ifdef __BORLANDC__
#pragma option pop
#endif
//--- (end of YBluetoothLink accessors declaration)
};
//--- (BluetoothLink functions declaration)
/**
* Retrieves a cellular interface for a given identifier.
* The identifier can be specified using several formats:
* <ul>
* <li>FunctionLogicalName</li>
* <li>ModuleSerialNumber.FunctionIdentifier</li>
* <li>ModuleSerialNumber.FunctionLogicalName</li>
* <li>ModuleLogicalName.FunctionIdentifier</li>
* <li>ModuleLogicalName.FunctionLogicalName</li>
* </ul>
*
* This function does not require that the cellular interface is online at the time
* it is invoked. The returned object is nevertheless valid.
* Use the method YBluetoothLink.isOnline() to test if the cellular interface is
* indeed online at a given time. In case of ambiguity when looking for
* a cellular interface by logical name, no error is notified: the first instance
* found is returned. The search is performed first by hardware name,
* then by logical name.
*
* @param func : a string that uniquely characterizes the cellular interface
*
* @return a YBluetoothLink object allowing you to drive the cellular interface.
*/
inline YBluetoothLink* yFindBluetoothLink(const string& func)
{ return YBluetoothLink::FindBluetoothLink(func);}
/**
* Starts the enumeration of cellular interfaces currently accessible.
* Use the method YBluetoothLink.nextBluetoothLink() to iterate on
* next cellular interfaces.
*
* @return a pointer to a YBluetoothLink object, corresponding to
* the first cellular interface currently online, or a null pointer
* if there are none.
*/
inline YBluetoothLink* yFirstBluetoothLink(void)
{ return YBluetoothLink::FirstBluetoothLink();}
//--- (end of BluetoothLink functions declaration)
#endif
| [
"dev@yoctopuce.com"
] | dev@yoctopuce.com |
1e68aa7906325ac8f34d250b893df48366df12c3 | 0ef4f71c8ff2f233945ee4effdba893fed3b8fad | /misc_microsoft_gamedev_source_code/misc_microsoft_gamedev_source_code/extlib/Scaleform/GFx SDK 2.1.57/3rdParty/nvtt/src/nvimage/TgaFile.h | cf88f0714d3de62ded0cad8b1829d7561a4f5a8e | [] | no_license | sgzwiz/misc_microsoft_gamedev_source_code | 1f482b2259f413241392832effcbc64c4c3d79ca | 39c200a1642102b484736b51892033cc575b341a | refs/heads/master | 2022-12-22T11:03:53.930024 | 2020-09-28T20:39:56 | 2020-09-28T20:39:56 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,931 | h | // This code is in the public domain -- castanyo@yahoo.es
#ifndef NV_IMAGE_TGAFILE_H
#define NV_IMAGE_TGAFILE_H
#include <nvcore/Stream.h>
namespace nv
{
// TGA types
enum TGAType {
TGA_TYPE_INDEXED = 1,
TGA_TYPE_RGB = 2,
TGA_TYPE_GREY = 3,
TGA_TYPE_RLE_INDEXED = 9,
TGA_TYPE_RLE_RGB = 10,
TGA_TYPE_RLE_GREY = 11
};
#define TGA_INTERLEAVE_MASK 0xc0
#define TGA_INTERLEAVE_NONE 0x00
#define TGA_INTERLEAVE_2WAY 0x40
#define TGA_INTERLEAVE_4WAY 0x80
#define TGA_ORIGIN_MASK 0x30
#define TGA_ORIGIN_LEFT 0x00
#define TGA_ORIGIN_RIGHT 0x10
#define TGA_ORIGIN_LOWER 0x00
#define TGA_ORIGIN_UPPER 0x20
/// Tga Header.
struct TgaHeader {
uint8 id_length;
uint8 colormap_type;
uint8 image_type;
uint16 colormap_index;
uint16 colormap_length;
uint8 colormap_size;
uint16 x_origin;
uint16 y_origin;
uint16 width;
uint16 height;
uint8 pixel_size;
uint8 flags;
enum { Size = 18 }; //const static int SIZE = 18;
};
/// Tga File.
struct TgaFile {
TgaFile() {
mem = NULL;
}
~TgaFile() {
free();
}
uint size() const {
return head.width * head.height * (head.pixel_size / 8);
}
void allocate() {
nvCheck( mem == NULL );
mem = new uint8[size()];
}
void free() {
delete [] mem;
mem = NULL;
}
TgaHeader head;
uint8 * mem;
};
inline Stream & operator<< (Stream & s, TgaHeader & head)
{
s << head.id_length << head.colormap_type << head.image_type;
s << head.colormap_index << head.colormap_length << head.colormap_size;
s << head.x_origin << head.y_origin << head.width << head.height;
s << head.pixel_size << head.flags;
return s;
}
inline Stream & operator<< (Stream & s, TgaFile & tga)
{
s << tga.head;
if( s.isLoading() ) {
tga.allocate();
}
s.serialize( tga.mem, tga.size() );
return s;
}
} // nv namespace
#endif // NV_IMAGE_TGAFILE_H
| [
"benjamin.barratt@icloud.com"
] | benjamin.barratt@icloud.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.