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 986 values | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 3.89k 681M ⌀ | star_events_count int64 0 209k | fork_events_count int64 0 110k | gha_license_id stringclasses 23 values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 145 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 122 values | content stringlengths 3 10.4M | authors listlengths 1 1 | author_id stringlengths 0 158 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
f9771dc1402f0bfa931e34cb9ba73b6ddae44d7a | e60fda09fec201fc811aaab77caab7dfcf14ed4c | /realsense/realsense_test/camera_viewer.cpp | d1c52a54b1dcf20badc193e0f13eac66134cc93e | [] | no_license | biotrump/realsense | 23419ac864f59d04101d7b7d1718f7753173c4f5 | c500b52efa81d195bc6b7cbd4981010378036ca3 | refs/heads/master | 2021-01-17T12:51:57.591500 | 2016-06-13T09:26:43 | 2016-06-13T09:26:43 | 57,204,737 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 8,885 | cpp | /*******************************************************************************
INTEL CORPORATION PROPRIETARY INFORMATION
This software is supplied under the terms of a license agreement or nondisclosure
agreement with Intel Corporation and may not be copied or disclosed except in
accordance with the terms of that agreement
Copyright(c) 2011-2014 Intel Corporation. All Rights Reserved.
*******************************************************************************/
//Thomas Tsai : d04922009@csie.ntu.edu.tw
#define OPENCV_SUPPORTED 1 //OPENCV ONLY
#include <windows.h>
//opencv
#include <opencv2/core/core.hpp>
#include <opencv2/imgcodecs.hpp>
#include <opencv2/imgproc.hpp>
#include <opencv2/highgui/highgui.hpp>
//realsense sdk
#include "pxcsensemanager.h"
#include "pxcsession.h"
#include "pxcmetadata.h"
#include "util_cmdline.h"
#include "util_render.h"
#include <iostream>
#include <conio.h>
#include "realsense2cvmat.h"
//! [namespace]
using namespace cv;
using namespace std;
//! [namespace]
#include "gui.h"
int wmain(int argc, WCHAR* argv[]) {
/* 1. Creates an instance of the PXCSenseManager */
PXCSenseManager *pp = PXCSenseManager::CreateInstance();
if (!pp) {
wprintf_s(L"Unable to create the SenseManager\n");
return 3;
}
PXCSession::ImplVersion version = pp->QuerySession()->QueryVersion();
std::cout << "SDK Version:" << version.major << "." << version.minor << std::endl;
/* Collects command line arguments */
UtilCmdLine cmdl(pp->QuerySession());
if (!cmdl.Parse(L"-listio-nframes-sdname-csize-dsize-isize-lsize-rsize-file-record-noRender-mirror",argc,argv)) return 3;
/* Sets file recording or playback */
PXCCaptureManager *cm=pp->QueryCaptureManager();
cm->SetFileName(cmdl.m_recordedFile, cmdl.m_bRecord);
if (cmdl.m_sdname) cm->FilterByDeviceInfo(cmdl.m_sdname,0,0);
#if OPENCV_SUPPORTED
PXCImage *colorIm, *depthIm, *irIm, *rightIm, *leftIm;
#else
// Create stream renders
UtilRender renderc(L"Color"), renderd(L"Depth"), renderi(L"IR"), renderr(L"Right"), renderl(L"Left");
#endif
pxcStatus sts;
//////////////////////////////////////////////
// my gui init
//////////////////////////////////////////////
my_gui myGui;
myGui_init(myGui);
////////////////////////////////////////////////////////
do {
//2. enable realsense camera streams
/* Apply command line arguments */
pxcBool revert = false;
if (cmdl.m_csize.size()>0) {
pp->EnableStream(PXCCapture::STREAM_TYPE_COLOR, cmdl.m_csize.front().first.width, cmdl.m_csize.front().first.height, (pxcF32)cmdl.m_csize.front().second);
}
if (cmdl.m_dsize.size()>0) {
pp->EnableStream(PXCCapture::STREAM_TYPE_DEPTH, cmdl.m_dsize.front().first.width, cmdl.m_dsize.front().first.height, (pxcF32)cmdl.m_dsize.front().second);
}
if (cmdl.m_isize.size() > 0) {
pp->EnableStream(PXCCapture::STREAM_TYPE_IR, cmdl.m_isize.front().first.width, cmdl.m_isize.front().first.height, (pxcF32)cmdl.m_isize.front().second);
}
if (cmdl.m_rsize.size() > 0) {
pp->EnableStream(PXCCapture::STREAM_TYPE_RIGHT, cmdl.m_rsize.front().first.width, cmdl.m_rsize.front().first.height, (pxcF32)cmdl.m_rsize.front().second);
}
if (cmdl.m_lsize.size() > 0) {
pp->EnableStream(PXCCapture::STREAM_TYPE_LEFT, cmdl.m_lsize.front().first.width, cmdl.m_lsize.front().first.height, (pxcF32)cmdl.m_lsize.front().second);
}
if (cmdl.m_csize.size() == 0 && cmdl.m_dsize.size() == 0 && cmdl.m_isize.size() == 0 && cmdl.m_rsize.size() == 0 && cmdl.m_lsize.size() == 0) {
#if 1
pp->EnableStream(PXCCapture::STREAM_TYPE_DEPTH, FRAME_WIDTH, FRAME_HEIGHT, (pxcF32)IMAGE_FPS);
pp->EnableStream(PXCCapture::STREAM_TYPE_COLOR, FRAME_WIDTH, FRAME_HEIGHT, (pxcF32)IMAGE_FPS);
#else
PXCVideoModule::DataDesc desc={};
if (cm->QueryCapture()) {
cm->QueryCapture()->QueryDeviceInfo(0, &desc.deviceInfo);
} else {
desc.deviceInfo.streams = PXCCapture::STREAM_TYPE_COLOR | PXCCapture::STREAM_TYPE_DEPTH;
revert = true;
}
pp->EnableStreams(&desc);
#endif
}
// 3. Set the coordinate system
PXCSession *session = pp->QuerySession();
session->SetCoordinateSystem(PXCSession::COORDINATE_SYSTEM_FRONT_DEFAULT /*COORDINATE_SYSTEM_REAR_OPENCV*/);
/* 4. Initializes the pipeline */
sts = pp->Init();
if (sts<PXC_STATUS_NO_ERROR) {
if (revert) {
/* Enable a single stream */
pp->Close();
pp->EnableStream(PXCCapture::STREAM_TYPE_DEPTH);
sts = pp->Init();
if (sts<PXC_STATUS_NO_ERROR) {
pp->Close();
pp->EnableStream(PXCCapture::STREAM_TYPE_COLOR);
sts = pp->Init();
}
}
if (sts<PXC_STATUS_NO_ERROR) {
wprintf_s(L"Failed to locate any video stream(s)\n");
pp->Release();
return sts;
}
}
/* Reset all properties */
PXCCapture::Device *device = pp->QueryCaptureManager()->QueryDevice();
device->ResetProperties(PXCCapture::STREAM_TYPE_ANY);
/* Set mirror mode */
if (cmdl.m_bMirror) {
device->SetMirrorMode(PXCCapture::Device::MirrorMode::MIRROR_MODE_HORIZONTAL);
} else {
device->SetMirrorMode(PXCCapture::Device::MirrorMode::MIRROR_MODE_DISABLED);
}
/* 6. Stream Data */
for (int nframes=0;nframes<cmdl.m_nframes;nframes++) {
/* Waits until new frame is available and locks it for application processing */
sts=pp->AcquireFrame(false); //6.a capture the frame
if (sts<PXC_STATUS_NO_ERROR) {
if (sts==PXC_STATUS_STREAM_CONFIG_CHANGED) {
wprintf_s(L"Stream configuration was changed, re-initilizing\n");
pp->Close();
}
break;
}
/* Render streams, unless -noRender is selected */
if (cmdl.m_bNoRender == false) {
const PXCCapture::Sample *sample = pp->QuerySample();// 6.b get the captured frame
if (sample) {
#if OPENCV_SUPPORTED
if (sample->color) {
colorIm = sample->color;
cv::Mat colorMat;
ConvertPXCImageToOpenCVMat(colorIm, &colorMat, STREAM_TYPE_COLOR);
cv::imshow(myGui.color_win_name, colorMat);
}
if (sample->depth) {
depthIm = sample->depth;
cv::Mat depthMat;
ConvertPXCImageToOpenCVMat(depthIm, &depthMat, STREAM_TYPE_DEPTH);
myGui.image = depthMat.clone();
int thickness = 1;
int lineType = 8;
int shift = 0;
cv::rectangle(myGui.image, myGui.rect, Scalar(255, 255, 255), thickness, lineType, shift);
cv::imshow(myGui.depth_win_name, myGui.image);
//insert the roi
hw4(myGui, depthMat);
/*
if (myGui.action && (myGui.frames++ < myGui.imglist_size)) {
Mat roi(depthMat, myGui.rect); // using a rectangle ROI
myGui.depth_imgs.insert(myGui.depth_imgs.begin(), &roi.clone());
printf("insert : %d/%d\n", myGui.frames, myGui.imglist_size);
}
*/
}
if (sample->ir) {
irIm = sample->ir;
cv::Mat irMat;
ConvertPXCImageToOpenCVMat(irIm, &irMat, STREAM_TYPE_IR);
cv::imshow("OpenCV Window ir", irMat);
}
if (sample->left) {
leftIm = sample->left;
cv::Mat leftMat;
ConvertPXCImageToOpenCVMat(leftIm, &leftMat);
cv::imshow("OpenCV Window left", leftMat);
}
if (sample->right) {
rightIm = sample->right;
cv::Mat rightMat;
ConvertPXCImageToOpenCVMat(rightIm, &rightMat);
cv::imshow("OpenCV Window right", rightMat);
}
#else//windows render
if (sample->depth && !renderd.RenderFrame(sample->depth)) break;
if (sample->color && !renderc.RenderFrame(sample->color)) break;
if (sample->ir && !renderi.RenderFrame(sample->ir)) break;
if (sample->right && !renderr.RenderFrame(sample->right)) break;
if (sample->left && !renderl.RenderFrame(sample->left)) break;
#endif // OPENCV_SUPPORTED
}
}
/* 7. Releases lock so pipeline can process next frame */
pp->ReleaseFrame();
#if OPENCV_SUPPORTED
int c=cv::waitKey(1);
if (c == 27 || c == 'q' || c == 'Q') break; // ESC|q|Q for Exit
#else
if( _kbhit() ) { // Break loop
int c = _getch() & 255;
if( c == 27 || c == 'q' || c == 'Q') break; // ESC|q|Q for Exit
}
#endif
}
} while (sts == PXC_STATUS_STREAM_CONFIG_CHANGED);
wprintf_s(L"Exiting\n");
// 8.Clean Up
pp->Release();
return 0;
}
| [
"thomas@life100.cc"
] | thomas@life100.cc |
49a82bcd6ff12500e3923077d96db934903d2a1d | 12efddb38fd5bd1c2b2b3bb1b672714b694d5602 | /websocket/httpheader.h | 768965b0f3dcbec5d13c10d4982632ad972595b8 | [] | no_license | chenxp-github/SmallToolsV2 | 884d61200f556379551477030aa06c64593ce9d4 | 1a8aa863d0bc3744d376284ace85c7503b871f45 | refs/heads/master | 2022-06-01T05:19:25.417439 | 2022-04-30T05:31:53 | 2022-04-30T05:31:53 | 210,530,450 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,622 | h | #ifndef __HTTPHEADER_H
#define __HTTPHEADER_H
#include "cruntime.h"
#include "commonarray.h"
#include "httppair.h"
class CHttpHeader{
public:
CCommonArray<CHttpPair> *mParis;
CMem *mMethod;
CMem *mRequestUrl;
CMem *mHttpVersion;
int mRetCode;
public:
status_t GetContentRange(fsize_t *start, fsize_t *end);
status_t Clear();
int GetRetCode();
status_t GetLocation(CMem *location);
status_t DelPair(const char *key);
status_t DelPair(CMem *key);
status_t Save(CFileBase *file);
fsize_t GetContentLength();
CHttpPair* GetPair(const char *key);
CHttpPair* GetPair(CMem *key);
bool IsChunked();
status_t SetPair(const char *key, const char *value);
status_t Load(CFileBase *file);
status_t SetPair(CMem *key, CMem *value);
int KeyToIndex(CMem *key);
CHttpPair* GetPairByIndex(int index);
status_t SetMethod(CMem *method);
status_t SetMethod(const char *method);
status_t SetRequestUrl(CMem *requesturl);
status_t SetRequestUrl(const char *requesturl);
status_t SetHttpVersion(CMem *httpversion);
status_t SetHttpVersion(const char *httpversion);
CMem* GetMethod();
const char* GetMethodStr();
CMem* GetRequestUrl();
const char* GetRequestUrlStr();
CMem* GetHttpVersion();
const char* GetHttpVersionStr();
CHttpHeader();
virtual ~CHttpHeader();
status_t InitBasic();
status_t Init();
status_t Destroy();
status_t Copy(CHttpHeader *p);
int Comp(CHttpHeader *p);
status_t Print(CFileBase *_buf);
};
#endif
| [
"xiangpeng_chen@126.com"
] | xiangpeng_chen@126.com |
2b38e7b823a2397d12e88bef63d9eb930184693c | cced65a21d5d99399a8fe216a36f3f5a613fa976 | /rockbot/character/classplayer.h | 40a5df52b79625fbea8f9ab68ce7f8529cc8089f | [] | no_license | JackD83/gh_retrogame_emulator | b347a047bf3e36e08fced2af58e14b14aafc8b5d | a8f11b7658cb897d345350868b93cba0bbfdcf2a | refs/heads/master | 2021-04-29T00:46:50.746947 | 2018-02-15T05:49:57 | 2018-02-15T05:49:57 | 121,837,122 | 1 | 2 | null | 2018-02-17T07:47:34 | 2018-02-17T07:47:34 | null | UTF-8 | C++ | false | false | 6,667 | h | #ifndef CLASSPLAYER_H
#define CLASSPLAYER_H
#include "character/character.h"
#include "character/classnpc.h"
class classnpc; // advance declaration
/**
* @brief child of character, this class is used to store data for a player (human controlled character)
*/
class classPlayer : public character
{
public:
/**
* @brief constructor for player class
* @param std::string the name of the player
* @param int number of the player. to be later used when we re-add support for the simultaneous two player mode
*/
classPlayer(int playerNumber);
void set_player_name(std::string set_name);
// called after game was picked and loaded, so we have player data
void initialize();
/**
* @brief hardcoded method for setting each frame for a player (@TODO: replace by user driven data)
*/
void initFrames();
/**
* @brief execute all player actions (move, jump, slide, damage, projectiles)
*/
void execute();
/**
* @brief move the projectiles created by this player and damage any npcs that are in it's way
*/
void execute_projectiles();
/**
* @brief this is used when player enters a boss-teleport that teleport the player back to it's origin point
* @param n id of the teleporter link
*/
void set_teleporter(int n);
/**
* @brief returns the teleporter id the player is using
* @return int teleporter-link id, -1 if none is being used
*/
int get_teleporter();
/**
* @brief teleporting-out from screen animation
*/
void teleport_stand();
/**
* @brief set the player HP (hit points) back to the default value
*/
void reset_hp();
/**
* @brief change the weapon player is using
* @param weapon_n id of the weapon to be set
*/
void set_weapon(short weapon_n, bool show_tooltip_icon);
/**
* @brief get the number of energy a given weapon still has (the number decreases as the weapon is used)
* @param weapon_n id of the weapon
* @return short number of energy points the weapon still have
*/
short int get_weapon_value(int weapon_n);
/**
* @brief change the energy value of a given weapon
* @param weapon_n id of the weapon
* @param value value to be set as energy points for this weapon
*/
void set_weapon_value(Uint8 weapon_n, Uint8 value);
/**
* @brief returns the colors the player must show when using a given weapon
* @param weapon_n id of the weapon
* @return CURRENT_FILE_FORMAT::file_weapon_colors struct that contains the three colors player can change
*/
CURRENT_FILE_FORMAT::file_weapon_colors get_weapon_colors(short int weapon_n);
/**
* @brief return the weapon player is currently using
* @return WEAPON_ICONS_ENUM enum for all weapons
*/
short get_selected_weapon();
short get_selected_weapon_value();
/**
* @brief fully recharge energy value of all weapons
*/
void refill_weapons();
/**
* @brief don't stop teleport because of collision before reaching this Y position (used when player is dead and returning)
* @param y point that indicates the minimal y position the teleport gravity will check collision
*/
void set_teleport_minimal_y(int y);
/**
* @brief virtual function from character. returns always false, as a player don't fly
* @return bool returns false always
*/
bool can_fly();
/**
* @brief
*
*/
void reset_charging_shot();
bool is_teleporting();
/**
* @brief recharge player's HP or current weapon
* @param _en_type HP or WEAPON to be recharged
* @param value total amount of points that will be recharged
*/
void recharge(e_energy_types _en_type, int value);
void damage(unsigned int damage_points, bool ignore_hit_timer);
/**
* @brief changes the colormap of stored frames surfaces for the current weapon color
* @param full_change indicates if must update all (true) or only current (false) frame
*/
void change_player_color(bool full_change);
// to be used when game is paused
void save_input();
void restore_input();
Uint8 get_max_hp();
private:
/**
* @brief called by execute() method, moves player depending on input
*/
void move();
/**
* @brief virtual from character, execute actions when player dies (reset map, explosion, etc)
*/
void death();
/**
* @brief load from game_data into class properties. @TODO: this should be replaced by using game_data directly if possible
*/
void init_weapon_colors();
/**
* @brief called when player collides with an object. execute the object (like giving more HP) or storer it in player's possessions
* @param obj_info information about the object that player collided
* @return bool in case object is not executable or storable (like a platform), returns false
*/
bool get_item(object_collision& obj_info);
/**
* @brief execute an attack, including weapon usage
*/
void attack(bool dont_update_colors = false);
/**
* @brief damage all NPCs that are touching ground and inside game-screen area
*/
void damage_ground_npcs();
/**
* @brief drop the COIL object into map
*/
void add_coil_object();
/**
* @brief drop the JET object into map
*/
void add_jet_object();
/**
* @brief used whe changing weapon with L/R buttons, find what the left left or right weapon is
* @param current current weapon id
* @param move 1 -> right, otherwise -> left
* @return int weapon id of the next one
*/
int find_next_weapon(int current, int move);
void clean_move_commands();
bool can_shoot_diagonal();
bool can_double_jump();
void update_armor_properties(); // this will update certain properties of player with data of the armor pieces abilities
bool can_air_dash();
float get_hit_push_back_n();
int get_armor_arms_attack_id();
bool have_shoryuken();
bool shoryuken();
void consume_weapon(int value);
private:
int teleporter_n; /**< current teleporter being used, -1 if none */
short selected_weapon; /**< current selected weapon */
CURRENT_FILE_FORMAT::file_weapon_colors weapon_colors[MAX_WEAPON_N]; /**< TODO */
bool l_key_released; /**< avoid changing weapon continuously if L key is held */
bool r_key_released; // < avoid changing weapon continuously if R key is held
bool _weapons_array[WEAPON_COUNT];
};
#endif // CLASSPLAYER_H
| [
"steward.fu@gmail.com"
] | steward.fu@gmail.com |
e95ff600daffaf5f58e139614e4912d28af74895 | 4b194a8690583d0d4ef6ffb7a54d96936b0172ce | /src/Die.cc | de40f169705ea58d0d34d1aaa80aca5f9d7186f5 | [] | no_license | kevinna97/Student-Colonization | a09d1b6074b4ce87e38f8dc3dd9dc16e11c7e0c7 | c71b01d4bc64cb0a40276b183ec6cb3863c8c319 | refs/heads/master | 2020-03-07T19:58:49.787769 | 2017-03-11T22:24:18 | 2017-03-11T22:24:18 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 604 | cc | #include "Subject.h"
#include "Observer.h"
#include "Die.h"
#include <cstdlib>
#include <ctime>
#include <iostream>
using namespace std;
Die::Die(){}
void Die::rollRandom(){
srand(time(NULL));
int num1 = rand() % 6 + 1;
int num2 = rand() % 6 + 1;
int val = num1 + num2;
notifyObservers(val);
lastRoll = val;
}
void Die::rollLoaded(int val){
notifyObservers(val);
lastRoll = val;
}
void Die::notifyObservers(int val) {
for (unsigned int i = 0; i < observers.size(); ++i) {
observers[i]->notify(val);
}
}
int Die::getLastRoll() { return lastRoll; }
| [
"apt@Arpits-MacBook-Air.local"
] | apt@Arpits-MacBook-Air.local |
3054b4911a63fb3ad6ae9c95ddffb96ae23c1d1a | 0019f0af5518efe2144b6c0e63a89e3bd2bdb597 | /antares/src/apps/mediaplayer/media_node_framework/NodeManager.cpp | e92311fc1c1d2957e9c2e77a26938aed733784b4 | [] | no_license | mmanley/Antares | 5ededcbdf09ef725e6800c45bafd982b269137b1 | d35f39c12a0a62336040efad7540c8c5bce9678a | refs/heads/master | 2020-06-02T22:28:26.722064 | 2010-03-08T21:51:31 | 2010-03-08T21:51:31 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 20,605 | cpp | /*
* Copyright (c) 2000-2008, Ingo Weinhold <ingo_weinhold@gmx.de>,
* Copyright (c) 2000-2008, Stephan Aßmus <superstippi@gmx.de>,
* All Rights Reserved. Distributed under the terms of the MIT license.
*/
#include "NodeManager.h"
#include <stdio.h>
#include <string.h>
#include <MediaRoster.h>
#include <scheduler.h>
#include <TimeSource.h>
#include "AudioProducer.h"
#include "AudioSupplier.h"
#include "VideoConsumer.h"
#include "VideoProducer.h"
#include "VideoSupplier.h"
// debugging
//#define TRACE_NODE_MANAGER
#ifdef TRACE_NODE_MANAGER
# define TRACE(x...) printf(x)
# define ERROR(x...) fprintf(stderr, x)
#else
# define TRACE(x...)
# define ERROR(x...) fprintf(stderr, x)
#endif
#define print_error(str, status) printf(str ", error: %s\n", strerror(status))
NodeManager::Connection::Connection()
: connected(false)
{
memset(&format, 0, sizeof(media_format));
}
// constructor
NodeManager::NodeManager()
: PlaybackManager(),
fMediaRoster(NULL),
fAudioProducer(NULL),
fVideoConsumer(NULL),
fVideoProducer(NULL),
fTimeSource(media_node::null),
fAudioConnection(),
fVideoConnection(),
fPerformanceTimeBase(0),
fStatus(B_NO_INIT),
fVideoTarget(NULL),
fAudioSupplier(NULL),
fVideoSupplier(NULL),
fVideoBounds(0, 0, -1, -1),
fPeakListener(NULL)
{
}
// destructor
NodeManager::~NodeManager()
{
_StopNodes();
_TearDownNodes();
}
// Init
status_t
NodeManager::Init(BRect videoBounds, float videoFrameRate,
color_space preferredVideoFormat, float audioFrameRate,
uint32 audioChannels, int32 loopingMode, bool loopingEnabled,
float speed, uint32 enabledNodes, bool useOverlays)
{
// init base class
PlaybackManager::Init(videoFrameRate, loopingMode, loopingEnabled, speed);
// get some objects from a derived class
if (!fVideoTarget)
fVideoTarget = CreateVideoTarget();
if (!fVideoSupplier)
fVideoSupplier = CreateVideoSupplier();
if (!fAudioSupplier)
fAudioSupplier = CreateAudioSupplier();
return FormatChanged(videoBounds, videoFrameRate, preferredVideoFormat,
audioFrameRate, audioChannels, enabledNodes, useOverlays, true);
}
// InitCheck
status_t
NodeManager::InitCheck()
{
return fStatus;
}
// SetPlayMode
void
NodeManager::SetPlayMode(int32 mode, bool continuePlaying)
{
// if (fMediaRoster && fMediaRoster->Lock()) {
// BMediaNode::run_mode runMode = mode > 0 ?
// BMediaNode::B_DROP_DATA : BMediaNode::B_OFFLINE;
// fMediaRoster->SetRunModeNode(fVideoConnection.consumer, runMode);
// fMediaRoster->Unlock();
// }
PlaybackManager::SetPlayMode(mode, continuePlaying);
}
// CleanupNodes
status_t
NodeManager::CleanupNodes()
{
_StopNodes();
return _TearDownNodes(false);
}
// FormatChanged
status_t
NodeManager::FormatChanged(BRect videoBounds, float videoFrameRate,
color_space preferredVideoFormat, float audioFrameRate,
uint32 audioChannels, uint32 enabledNodes, bool useOverlays, bool force)
{
TRACE("NodeManager::FormatChanged()\n");
if (!force && videoBounds == VideoBounds()
&& videoFrameRate == FramesPerSecond()) {
TRACE(" -> reusing existing nodes\n");
// TODO: if enabledNodes would indicate that audio or video
// is no longer needed, or, worse yet, suddenly needed when
// it wasn't before, then we should not return here!
return B_OK;
}
if (videoFrameRate != FramesPerSecond()) {
TRACE(" -> need to Init()\n");
PlaybackManager::Init(videoFrameRate, LoopMode(), IsLoopingEnabled(),
Speed(), MODE_PLAYING_PAUSED_FORWARD, CurrentFrame());
}
_StopNodes();
_TearDownNodes();
SetVideoBounds(videoBounds);
status_t ret = _SetUpNodes(preferredVideoFormat, enabledNodes,
useOverlays, audioFrameRate, audioChannels);
if (ret == B_OK)
_StartNodes();
else
fprintf(stderr, "unable to setup nodes: %s\n", strerror(ret));
return ret;
}
// RealTimeForTime
bigtime_t
NodeManager::RealTimeForTime(bigtime_t time) const
{
bigtime_t result = 0;
if (fVideoProducer) {
result = fVideoProducer->TimeSource()->RealTimeFor(
fPerformanceTimeBase + time, 0);
} else if (fAudioProducer) {
result = fAudioProducer->TimeSource()->RealTimeFor(
fPerformanceTimeBase + time, 0);
}
//printf("NodeManager::RealTimeForTime(%lld) -> %lld\n", time, result);
return result;
}
// TimeForRealTime
bigtime_t
NodeManager::TimeForRealTime(bigtime_t time) const
{
bigtime_t result = 0;
if (fVideoProducer) {
result = fVideoProducer->TimeSource()->PerformanceTimeFor(time)
- fPerformanceTimeBase;
} else if (fAudioProducer) {
result = fAudioProducer->TimeSource()->PerformanceTimeFor(time)
- fPerformanceTimeBase;
}
return result;
}
// SetCurrentAudioTime
void
NodeManager::SetCurrentAudioTime(bigtime_t time)
{
//printf("NodeManager::SetCurrentAudioTime(%lld)\n", time);
PlaybackManager::SetCurrentAudioTime(time);
if (!fVideoProducer) {
// running without video, update video time as well
PlaybackManager::SetCurrentVideoTime(time);
}
}
// SetVideoBounds
void
NodeManager::SetVideoBounds(BRect bounds)
{
if (bounds != fVideoBounds) {
fVideoBounds = bounds;
NotifyVideoBoundsChanged(fVideoBounds);
}
}
// VideoBounds
BRect
NodeManager::VideoBounds() const
{
return fVideoBounds;
}
// SetVideoTarget
void
NodeManager::SetVideoTarget(VideoTarget* videoTarget)
{
if (videoTarget != fVideoTarget) {
fVideoTarget = videoTarget;
if (fVideoConsumer)
fVideoConsumer->SetTarget(fVideoTarget);
}
}
// GetVideoTarget
VideoTarget*
NodeManager::GetVideoTarget() const
{
return fVideoTarget;
}
// SetVolume
void
NodeManager::SetVolume(float percent)
{
// TODO: would be nice to set the volume on the system mixer input of
// our audio node...
}
// SetPeakListener
void
NodeManager::SetPeakListener(BHandler* handler)
{
fPeakListener = handler;
if (fAudioProducer)
fAudioProducer->SetPeakListener(fPeakListener);
}
// #pragma mark -
// _SetUpNodes
status_t
NodeManager::_SetUpNodes(color_space preferredVideoFormat, uint32 enabledNodes,
bool useOverlays, float audioFrameRate, uint32 audioChannels)
{
TRACE("NodeManager::_SetUpNodes()\n");
// find the media roster
fStatus = B_OK;
fMediaRoster = BMediaRoster::Roster(&fStatus);
if (fStatus != B_OK) {
print_error("Can't find the media roster", fStatus);
fMediaRoster = NULL;
return fStatus;
}
if (!fMediaRoster->Lock())
return B_ERROR;
// find the time source
fStatus = fMediaRoster->GetTimeSource(&fTimeSource);
if (fStatus != B_OK) {
print_error("Can't get a time source", fStatus);
fMediaRoster->Unlock();
return fStatus;
}
// setup the video nodes
if (enabledNodes != AUDIO_ONLY) {
fStatus = _SetUpVideoNodes(preferredVideoFormat, useOverlays);
if (fStatus != B_OK) {
print_error("Error setting up video nodes", fStatus);
fMediaRoster->Unlock();
return fStatus;
}
} else
printf("running without video node\n");
// setup the audio nodes
if (enabledNodes != VIDEO_ONLY) {
fStatus = _SetUpAudioNodes(audioFrameRate, audioChannels);
if (fStatus != B_OK) {
print_error("Error setting up audio nodes", fStatus);
fMediaRoster->Unlock();
return fStatus;
}
fNoAudio = false;
} else {
fNoAudio = true;
printf("running without audio node\n");
}
// we're done mocking with the media roster
fMediaRoster->Unlock();
return fStatus;
}
// _SetUpVideoNodes
status_t
NodeManager::_SetUpVideoNodes(color_space preferredVideoFormat,
bool useOverlays)
{
// create the video producer node
fVideoProducer = new VideoProducer(NULL, "MediaPlayer video out", 0,
this, fVideoSupplier);
// register the producer node
fStatus = fMediaRoster->RegisterNode(fVideoProducer);
if (fStatus != B_OK) {
print_error("Can't register the video producer", fStatus);
return fStatus;
}
// make sure the Media Roster knows that we're using the node
// fMediaRoster->GetNodeFor(fVideoProducer->Node().node,
// &fVideoConnection.producer);
fVideoConnection.producer = fVideoProducer->Node();
// create the video consumer node
fVideoConsumer = new VideoConsumer("MediaPlayer video in", NULL, 0, this,
fVideoTarget);
// register the consumer node
fStatus = fMediaRoster->RegisterNode(fVideoConsumer);
if (fStatus != B_OK) {
print_error("Can't register the video consumer", fStatus);
return fStatus;
}
// make sure the Media Roster knows that we're using the node
// fMediaRoster->GetNodeFor(fVideoConsumer->Node().node,
// &fVideoConnection.consumer);
fVideoConnection.consumer = fVideoConsumer->Node();
// find free producer output
media_input videoInput;
media_output videoOutput;
int32 count = 1;
fStatus = fMediaRoster->GetFreeOutputsFor(fVideoConnection.producer,
&videoOutput, 1, &count, B_MEDIA_RAW_VIDEO);
if (fStatus != B_OK || count < 1) {
fStatus = B_RESOURCE_UNAVAILABLE;
print_error("Can't find an available video stream", fStatus);
return fStatus;
}
// find free consumer input
count = 1;
fStatus = fMediaRoster->GetFreeInputsFor(fVideoConnection.consumer,
&videoInput, 1, &count, B_MEDIA_RAW_VIDEO);
if (fStatus != B_OK || count < 1) {
fStatus = B_RESOURCE_UNAVAILABLE;
print_error("Can't find an available connection to the video window",
fStatus);
return fStatus;
}
// connect the nodes
media_format format;
format.type = B_MEDIA_RAW_VIDEO;
media_raw_video_format videoFormat = {
FramesPerSecond(), 1, 0,
fVideoBounds.IntegerWidth(),
B_VIDEO_TOP_LEFT_RIGHT, 1, 1,
{
preferredVideoFormat,
fVideoBounds.IntegerWidth() + 1,
fVideoBounds.IntegerHeight() + 1,
0, 0, 0
}
};
format.u.raw_video = videoFormat;
// connect video producer to consumer (hopefully using overlays)
fVideoConsumer->SetTryOverlay(useOverlays);
fStatus = fMediaRoster->Connect(videoOutput.source, videoInput.destination,
&format, &videoOutput, &videoInput);
if (fStatus != B_OK) {
print_error("Can't connect the video source to the video window... "
"trying without overlays", fStatus);
uint32 flags = 0;
bool supported = bitmaps_support_space(
format.u.raw_video.display.format, &flags);
if (!supported || (flags & B_VIEWS_SUPPORT_DRAW_BITMAP) == 0) {
// cannot create bitmaps with such a color space
// or BViews don't support drawing it, fallback to B_RGB32
format.u.raw_video.display.format = B_RGB32;
printf("NodeManager::_SetupVideoNodes() - falling back to "
"B_RGB32\n");
}
fVideoConsumer->SetTryOverlay(false);
// connect video producer to consumer (not using overlays and using
// a colorspace that BViews support drawing)
fStatus = fMediaRoster->Connect(videoOutput.source,
videoInput.destination, &format, &videoOutput, &videoInput);
}
// bail if second attempt failed too
if (fStatus != B_OK) {
print_error("Can't connect the video source to the video window",
fStatus);
return fStatus;
}
// the inputs and outputs might have been reassigned during the
// nodes' negotiation of the Connect(). That's why we wait until
// after Connect() finishes to save their contents.
fVideoConnection.format = format;
fVideoConnection.source = videoOutput.source;
fVideoConnection.destination = videoInput.destination;
fVideoConnection.connected = true;
// set time sources
fStatus = fMediaRoster->SetTimeSourceFor(fVideoConnection.producer.node,
fTimeSource.node);
if (fStatus != B_OK) {
print_error("Can't set the timesource for the video source", fStatus);
return fStatus;
}
fStatus = fMediaRoster->SetTimeSourceFor(fVideoConsumer->ID(),
fTimeSource.node);
if (fStatus != B_OK) {
print_error("Can't set the timesource for the video window", fStatus);
return fStatus;
}
return fStatus;
}
// _SetUpAudioNodes
status_t
NodeManager::_SetUpAudioNodes(float audioFrameRate, uint32 audioChannels)
{
fAudioProducer = new AudioProducer("MediaPlayer audio out", fAudioSupplier);
fAudioProducer->SetPeakListener(fPeakListener);
fStatus = fMediaRoster->RegisterNode(fAudioProducer);
if (fStatus != B_OK) {
print_error("unable to register audio producer node!\n", fStatus);
return fStatus;
}
// make sure the Media Roster knows that we're using the node
// fMediaRoster->GetNodeFor(fAudioProducer->Node().node,
// &fAudioConnection.producer);
fAudioConnection.producer = fAudioProducer->Node();
// connect to the mixer
fStatus = fMediaRoster->GetAudioMixer(&fAudioConnection.consumer);
if (fStatus != B_OK) {
print_error("unable to get the system mixer", fStatus);
return fStatus;
}
fMediaRoster->SetTimeSourceFor(fAudioConnection.producer.node,
fTimeSource.node);
// got the nodes; now we find the endpoints of the connection
media_input mixerInput;
media_output soundOutput;
int32 count = 1;
fStatus = fMediaRoster->GetFreeOutputsFor(fAudioConnection.producer,
&soundOutput, 1, &count);
if (fStatus != B_OK) {
print_error("unable to get a free output from the producer node",
fStatus);
return fStatus;
}
count = 1;
fStatus = fMediaRoster->GetFreeInputsFor(fAudioConnection.consumer,
&mixerInput, 1, &count);
if (fStatus != B_OK) {
print_error("unable to get a free input to the mixer", fStatus);
return fStatus;
}
// got the endpoints; now we connect it!
media_format audioFormat;
audioFormat.type = B_MEDIA_RAW_AUDIO;
audioFormat.u.raw_audio = media_raw_audio_format::wildcard;
audioFormat.u.raw_audio.frame_rate = audioFrameRate;
audioFormat.u.raw_audio.channel_count = audioChannels;
fStatus = fMediaRoster->Connect(soundOutput.source, mixerInput.destination,
&audioFormat, &soundOutput, &mixerInput);
if (fStatus != B_OK) {
print_error("unable to connect audio nodes", fStatus);
return fStatus;
}
// the inputs and outputs might have been reassigned during the
// nodes' negotiation of the Connect(). That's why we wait until
// after Connect() finishes to save their contents.
fAudioConnection.format = audioFormat;
fAudioConnection.source = soundOutput.source;
fAudioConnection.destination = mixerInput.destination;
fAudioConnection.connected = true;
// Set an appropriate run mode for the producer
fMediaRoster->SetRunModeNode(fAudioConnection.producer,
BMediaNode::B_INCREASE_LATENCY);
return fStatus;
}
// _TearDownNodes
status_t
NodeManager::_TearDownNodes(bool disconnect)
{
TRACE("NodeManager::_TearDownNodes()\n");
status_t err = B_OK;
fMediaRoster = BMediaRoster::Roster(&err);
if (err != B_OK) {
fprintf(stderr, "NodeManager::_TearDownNodes() - error getting media "
"roster: %s\n", strerror(err));
fMediaRoster = NULL;
}
// begin mucking with the media roster
bool mediaRosterLocked = false;
if (fMediaRoster && fMediaRoster->Lock())
mediaRosterLocked = true;
if (fVideoConsumer && fVideoProducer && fVideoConnection.connected) {
// disconnect
if (fMediaRoster) {
TRACE(" disconnecting video...\n");
err = fMediaRoster->Disconnect(fVideoConnection.producer.node,
fVideoConnection.source, fVideoConnection.consumer.node,
fVideoConnection.destination);
if (err < B_OK)
print_error("unable to disconnect video nodes", err);
} else {
fprintf(stderr, "NodeManager::_TearDownNodes() - cannot "
"disconnect video nodes, no media server!\n");
}
fVideoConnection.connected = false;
}
if (fVideoProducer) {
TRACE(" releasing video producer...\n");
fVideoProducer->Release();
fVideoProducer = NULL;
}
if (fVideoConsumer) {
TRACE(" releasing video consumer...\n");
fVideoConsumer->Release();
fVideoConsumer = NULL;
}
if (fAudioProducer) {
disconnect = fAudioConnection.connected;
// Ordinarily we'd stop *all* of the nodes in the chain at this point.
// However, one of the nodes is the System Mixer, and stopping the
// Mixer is a Bad Idea (tm). So, we just disconnect from it, and
// release our references to the nodes that we're using. We *are*
// supposed to do that even for global nodes like the Mixer.
if (fMediaRoster && disconnect) {
TRACE(" disconnecting audio...\n");
err = fMediaRoster->Disconnect(fAudioConnection.producer.node,
fAudioConnection.source, fAudioConnection.consumer.node,
fAudioConnection.destination);
if (err < B_OK) {
print_error("unable to disconnect audio nodes", err);
disconnect = false;
}
} else {
fprintf(stderr, "NodeManager::_TearDownNodes() - cannot "
"disconnect audio nodes, no media server!\n");
}
TRACE(" releasing audio producer...\n");
fAudioProducer->Release();
fAudioProducer = NULL;
fAudioConnection.connected = false;
if (fMediaRoster && disconnect) {
TRACE(" releasing audio consumer...\n");
fMediaRoster->ReleaseNode(fAudioConnection.consumer);
} else {
fprintf(stderr, "NodeManager::_TearDownNodes() - cannot release "
"audio consumer (system mixer)!\n");
}
}
// we're done mucking with the media roster
if (mediaRosterLocked && fMediaRoster)
fMediaRoster->Unlock();
TRACE("NodeManager::_TearDownNodes() done\n");
return err;
}
// _StartNodes
status_t
NodeManager::_StartNodes()
{
status_t status = B_NO_INIT;
if (!fMediaRoster)
return status;
// begin mucking with the media roster
if (!fMediaRoster->Lock())
return B_ERROR;
bigtime_t latency = 0;
bigtime_t initLatency = 0;
if (fVideoProducer && fVideoConsumer) {
// figure out what recording delay to use
status = fMediaRoster->GetLatencyFor(fVideoConnection.producer,
&latency);
if (status < B_OK) {
print_error("error getting latency for video producer",
status);
} else
TRACE("video latency: %Ld\n", latency);
status = fMediaRoster->SetProducerRunModeDelay(
fVideoConnection.producer, latency);
if (status < B_OK) {
print_error("error settings run mode delay for video producer",
status);
}
// start the nodes
status = fMediaRoster->GetInitialLatencyFor(
fVideoConnection.producer, &initLatency);
if (status < B_OK) {
print_error("error getting initial latency for video producer",
status);
}
}
initLatency += estimate_max_scheduling_latency();
if (fAudioProducer) {
// TODO: was this supposed to be added to initLatency?!?
bigtime_t audioLatency = 0;
status = fMediaRoster->GetLatencyFor(fAudioConnection.producer,
&audioLatency);
TRACE("audio latency: %Ld\n", audioLatency);
}
BTimeSource* timeSource;
if (fVideoProducer) {
timeSource = fMediaRoster->MakeTimeSourceFor(
fVideoConnection.producer);
} else {
timeSource = fMediaRoster->MakeTimeSourceFor(
fAudioConnection.producer);
}
bool running = timeSource->IsRunning();
// workaround for people without sound cards
// because the system time source won't be running
bigtime_t real = BTimeSource::RealTime();
if (!running) {
status = fMediaRoster->StartTimeSource(fTimeSource, real);
if (status != B_OK) {
timeSource->Release();
print_error("cannot start time source!", status);
return status;
}
status = fMediaRoster->SeekTimeSource(fTimeSource, 0, real);
if (status != B_OK) {
timeSource->Release();
print_error("cannot seek time source!", status);
return status;
}
}
bigtime_t perf = timeSource->PerformanceTimeFor(real + latency
+ initLatency);
printf("performance time for %lld: %lld\n", real + latency
+ initLatency, perf);
timeSource->Release();
// start the nodes
if (fVideoProducer && fVideoConsumer) {
status = fMediaRoster->StartNode(fVideoConnection.consumer, perf);
if (status != B_OK) {
print_error("Can't start the video consumer", status);
return status;
}
status = fMediaRoster->StartNode(fVideoConnection.producer, perf);
if (status != B_OK) {
print_error("Can't start the video producer", status);
return status;
}
}
if (fAudioProducer) {
status = fMediaRoster->StartNode(fAudioConnection.producer, perf);
if (status != B_OK) {
print_error("Can't start the audio producer", status);
return status;
}
}
fPerformanceTimeBase = perf;
// done mucking with the media roster
fMediaRoster->Unlock();
return status;
}
// _StopNodes
void
NodeManager::_StopNodes()
{
TRACE("NodeManager::_StopNodes()\n");
fMediaRoster = BMediaRoster::Roster();
if (fMediaRoster != NULL && fMediaRoster->Lock()) {
// begin mucking with the media roster
if (fVideoProducer != NULL) {
TRACE(" stopping video producer...\n");
fMediaRoster->StopNode(fVideoConnection.producer, 0, true);
}
if (fAudioProducer != NULL) {
TRACE(" stopping audio producer...\n");
fMediaRoster->StopNode(fAudioConnection.producer, 0, true);
// synchronous stop
}
if (fVideoConsumer != NULL) {
TRACE(" stopping video consumer...\n");
fMediaRoster->StopNode(fVideoConnection.consumer, 0, true);
}
TRACE(" all nodes stopped\n");
// done mucking with the media roster
fMediaRoster->Unlock();
}
TRACE("NodeManager::_StopNodes() done\n");
}
| [
"michael@Inferno.(none)"
] | michael@Inferno.(none) |
d0e68543d50daee42704db3b104882644ad6d299 | 42a360a941b26e4ff8c3ab2a2516e9f712fba718 | /Sistemas Operativos (SO)/Procesos/fork3.cpp | c9e7c5aeb60ebe6ffbdd5a30fa3bf1dd6876fd6b | [] | no_license | ianshalaga/UNL-FICH-II | 997b401192e0b53afd6fba3d33f5143a25579f7c | 75552dc84016b81b44ec95773f08c17f29859cbf | refs/heads/master | 2021-01-20T13:18:21.014192 | 2019-08-08T14:43:54 | 2019-08-08T14:43:54 | 90,471,950 | 0 | 3 | null | null | null | null | UTF-8 | C++ | false | false | 230 | cpp | #include <iostream>
#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
using namespace std;
int main(int argc, char *argv[]) {
int a=5,p;
cout<<a<<endl;
p=fork();
if (p==0)
++a;
cout<<(++a)<<endl;
return 0;
}
| [
"noreply@github.com"
] | ianshalaga.noreply@github.com |
8edaf70f4e9a416f8748d21a379581d56c6a1023 | c570aff1f3e2238ee4361dcbba6e47869f4cde99 | /ecuacion_onda.cpp | 6142c4298d8a011359f5db0ed2f0ec12cf1847d3 | [] | no_license | dg2000/DanielMelo_Ejercicio23 | 0bfec0518465933454739ba2c3dab76715eab39c | c4f0fa40c8ae819e4c1caf18e9289af1db585722 | refs/heads/master | 2020-03-13T13:52:42.268479 | 2018-04-26T13:25:55 | 2018-04-26T13:25:55 | 131,147,271 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,008 | cpp | #include <iostream>
#include <ctime>
#include <cstdlib>
#include <math.h>
using namespace std;
int main()
{
double c = 1.0;
double T = 5.0;
double dt = 0.0001;
double dx = 0.0001;//pow(D*dt, 0.5);
double L = 1.0 ;
int nx = (L/dx) +1 ;
double numerador = dt*dt*c*c/(dx*dx);
int n1 = nx/4.0;
int t = 0;
double pi = 3.14159;
bool termino = false;
bool primera = true;
bool segunda = true;
double* nuevo = new double[nx];
double* viejo = new double[nx];
double* segundo_viejo = new double[nx];
double* segunda_foto = new double[nx];
double* tercera_foto = new double[nx];
double* original = new double[nx];
double* tiempos = new double[4];
tiempos[0] = 0.0;
for (int i = 0; i < nx; i++)
{
viejo[i] = sin(2.0*pi*i*dx);
original[i] = sin(2.0*pi*i*dx);
}
while(nuevo[n1] > -0.99999999)
{
if(t==0)
{
for(int i = 1; i < nx-1; i++)
{
double a = numerador*(viejo[i+1] + viejo[i-1] - 2.0*viejo[i]);
nuevo[i] = (a + 2.0*viejo[i])/2.0;
}
}
else
{
for(int i = 1; i < nx-1; i++)
{
double a = numerador*(viejo[i+1] + viejo[i-1] - 2.0*viejo[i]);
nuevo[i] = a + 2.0*viejo[i] - segundo_viejo[i];
}
}
if( nuevo[n1]-0.5 < 0.01 && primera)
{
primera = false;
tiempos[1] = t*dt;
for(int i = 0; i < nx; i++)
{
segunda_foto[i] = nuevo[i];
}
}
if( nuevo[n1]+0.5 < 0.01 && !primera && segunda)
{
segunda = false;
tiempos[2] = t*dt;
for(int i = 0; i < nx; i++)
{
tercera_foto[i] = nuevo[i];
}
}
for(int i = 1; i < nx-1; i++)
{
segundo_viejo[i] = viejo[i];
viejo[i] = nuevo[i];
}
tiempos[3] = t*dt;
t++;
}
for(int i = 0; i < nx; i++)
{
cout << i*dx << " " << original[i] << " " << segunda_foto[i] << " " << tercera_foto[i] << " " << nuevo[i] << " " << tiempos[i] << endl;
}
return 0;
}
| [
"dg.melo@uniandes.edu.co"
] | dg.melo@uniandes.edu.co |
ec0ba7e5a6fae3e8425c0eb92af938adb9c62633 | 3dd7fa0e601d6b01dc79da5412b4890468551a75 | /dialog.h | b407a8090398269c331d72c3ed98890d34b52ccc | [] | no_license | Bombada/Image_Processing | ab706794b0c8972cc0c1870c574e06baa3bc8794 | a571cea66198774d7b82c0d9a5593b2b2f17e55c | refs/heads/master | 2022-11-07T09:27:11.256568 | 2020-06-28T15:18:18 | 2020-06-28T15:18:18 | 266,547,524 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 460 | h | #ifndef DIALOG_H
#define DIALOG_H
#include <QDialog>
namespace Ui {
class Dialog;
}
class Dialog : public QDialog
{
Q_OBJECT
public:
explicit Dialog(QWidget *parent = nullptr);
~Dialog();
QImage PanoramaImage;
QPixmap PanoramaPixmap;
void sendData();
private slots:
void on_buttonBox_accepted();
void on_pushButton_clicked();
private:
Ui::Dialog *ui;
};
#endif // DIALOG_H
| [
"noreply@github.com"
] | Bombada.noreply@github.com |
b2e27730521a78b07cc00c4b5db039a9f8f35fec | 6ced41da926682548df646099662e79d7a6022c5 | /aws-cpp-sdk-wafv2/include/aws/wafv2/model/AllQueryArguments.h | dfbeef6d80de1d50ff74c3bf0eb8a8694ae2df86 | [
"Apache-2.0",
"MIT",
"JSON"
] | permissive | irods/aws-sdk-cpp | 139104843de529f615defa4f6b8e20bc95a6be05 | 2c7fb1a048c96713a28b730e1f48096bd231e932 | refs/heads/main | 2023-07-25T12:12:04.363757 | 2022-08-26T15:33:31 | 2022-08-26T15:33:31 | 141,315,346 | 0 | 1 | Apache-2.0 | 2022-08-26T17:45:09 | 2018-07-17T16:24:06 | C++ | UTF-8 | C++ | false | false | 1,069 | h | /**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#pragma once
#include <aws/wafv2/WAFV2_EXPORTS.h>
namespace Aws
{
namespace Utils
{
namespace Json
{
class JsonValue;
class JsonView;
} // namespace Json
} // namespace Utils
namespace WAFV2
{
namespace Model
{
/**
* <p>Inspect all query arguments of the web request. </p> <p>This is used only in
* the <a>FieldToMatch</a> specification for some web request component types. </p>
* <p>JSON specification: <code>"AllQueryArguments": {}</code> </p><p><h3>See
* Also:</h3> <a
* href="http://docs.aws.amazon.com/goto/WebAPI/wafv2-2019-07-29/AllQueryArguments">AWS
* API Reference</a></p>
*/
class AWS_WAFV2_API AllQueryArguments
{
public:
AllQueryArguments();
AllQueryArguments(Aws::Utils::Json::JsonView jsonValue);
AllQueryArguments& operator=(Aws::Utils::Json::JsonView jsonValue);
Aws::Utils::Json::JsonValue Jsonize() const;
};
} // namespace Model
} // namespace WAFV2
} // namespace Aws
| [
"aws-sdk-cpp-automation@github.com"
] | aws-sdk-cpp-automation@github.com |
ced9a550e804764427e90acd8d425e771ff10f1a | 5a52ebe89a4cc08154ac6c37ad8eaa980ca205be | /MyTuple.cpp | 37d431959ae55f74dff5c382ddf061c34b2b9605 | [] | no_license | seeman1978/c__20 | 1bdd358481712bc979ba5f8799eff542146f2c59 | 14023f0d7029733c440f53cfa044ef680677bc23 | refs/heads/master | 2022-10-30T21:20:52.444068 | 2022-10-13T11:52:06 | 2022-10-13T11:52:06 | 242,280,930 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,208 | cpp | //
// Created by 王强 on 2020/2/24.
//
// tuple.cpp
// compile with: /EHsc
#include <vector>
#include <iomanip>
#include <iostream>
#include <tuple>
#include <string>
using namespace std;
typedef tuple <int, double, string> ids;
void print_ids(const ids& i)
{
cout << "( "
<< get<0>(i) << ", "
<< get<1>(i) << ", "
<< get<2>(i) << " )." << endl;
}
ids getids()
{
return ids(10, 5.8, "hello");
}
int main( )
{
// Using the constructor to declare and initialize a tuple
ids p1(10, 1.1e-2, "one");
// Compare using the helper function to declare and initialize a tuple
ids p2;
p2 = make_tuple(10, 2.22e-1, "two");
// Making a copy of a tuple
ids p3(p1);
cout.precision(3);
cout << "The tuple p1 is: ( ";
print_ids(p1);
cout << "The tuple p2 is: ( ";
print_ids(p2);
cout << "The tuple p3 is: ( ";
print_ids(p3);
vector<ids> v;
v.push_back(p1);
v.push_back(p2);
v.push_back(make_tuple(3, 3.3e-2, "three"));
cout << "The tuples in the vector are" << endl;
for(vector<ids>::const_iterator i = v.begin(); i != v.end(); ++i)
{
print_ids(*i);
}
print_ids(getids());
} | [
"seeman1978@163.com"
] | seeman1978@163.com |
7a0b8c7de24990a9445cd1ae22fcaa01652be7e8 | b8376621d63394958a7e9535fc7741ac8b5c3bdc | /lib/lib_mech/src/tool/tool_SrcBackup/jSrcBackup.cpp | dde8f64de97b1f17d879ff018d39579a361fd2e9 | [] | no_license | 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 | 2,465 | cpp | // jSrcBackup.cpp : 응용 프로그램에 대한 클래스 동작을 정의합니다.
//
#include "stdafx.h"
#include "jSrcBackup.h"
#include "jSrcBackupDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
// CjSrcBackupApp
BEGIN_MESSAGE_MAP(CjSrcBackupApp, CWinApp)
ON_COMMAND(ID_HELP, CWinApp::OnHelp)
END_MESSAGE_MAP()
// CjSrcBackupApp 생성
CjSrcBackupApp::CjSrcBackupApp()
{
// TODO: 여기에 생성 코드를 추가합니다.
// InitInstance에 모든 중요한 초기화 작업을 배치합니다.
}
// 유일한 CjSrcBackupApp 개체입니다.
CjSrcBackupApp theApp;
// CjSrcBackupApp 초기화
CString g_sProjName;
CString g_sTargetDir;
CString g_sDestDir;
std::vector<std::string> s_list;
BOOL CjSrcBackupApp::InitInstance()
{
g_sProjName = __argv[1];
g_sTargetDir = __argv[2];
g_sDestDir = __argv[3];
s_list.clear();
CString str;
if(__argc > 4)
{
s_list.resize(__argc-4);
for( int i=0 ; i < s_list.size() ; ++i)
{
s_list[i] = __argv[i+4];
str = s_list[i].c_str();
}
}
// 응용 프로그램 매니페스트가 ComCtl32.dll 버전 6 이상을 사용하여 비주얼 스타일을
// 사용하도록 지정하는 경우, Windows XP 상에서 반드시 InitCommonControls()가 필요합니다.
// InitCommonControls()를 사용하지 않으면 창을 만들 수 없습니다.
InitCommonControls();
CWinApp::InitInstance();
AfxEnableControlContainer();
// 표준 초기화
// 이들 기능을 사용하지 않고 최종 실행 파일의 크기를 줄이려면
// 아래에서 필요 없는 특정 초기화 루틴을 제거해야 합니다.
// 해당 설정이 저장된 레지스트리 키를 변경하십시오.
// TODO: 이 문자열을 회사 또는 조직의 이름과 같은
// 적절한 내용으로 수정해야 합니다.
SetRegistryKey(_T("로컬 응용 프로그램 마법사에서 생성한 응용 프로그램"));
CjSrcBackupDlg dlg;
m_pMainWnd = &dlg;
INT_PTR nResponse = dlg.DoModal();
if (nResponse == IDOK)
{
// TODO: 여기에 대화 상자가 확인을 눌러 없어지는 경우 처리할
// 코드를 배치합니다.
}
else if (nResponse == IDCANCEL)
{
// TODO: 여기에 대화 상자가 취소를 눌러 없어지는 경우 처리할
// 코드를 배치합니다.
}
// 대화 상자가 닫혔으므로 응용 프로그램의 메시지 펌프를 시작하지 않고
// 응용 프로그램을 끝낼 수 있도록 FALSE를 반환합니다.
return FALSE;
}
| [
"whdnrfo@gmail.com"
] | whdnrfo@gmail.com |
73a374a8b4a49219d2de194a9a077a5ff6e608c2 | 955129b4b7bcb4264be57cedc0c8898aeccae1ca | /python/mof/cpp/RoleTpltCfg.h | 91a994a4f78309a73c3883d9c032a426f88512b7 | [] | no_license | PenpenLi/Demos | cf270b92c7cbd1e5db204f5915a4365a08d65c44 | ec90ebea62861850c087f32944786657bd4bf3c2 | refs/heads/master | 2022-03-27T07:33:10.945741 | 2019-12-12T08:19:15 | 2019-12-12T08:19:15 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 254 | h | #ifndef MOF_ROLETPLTCFG_H
#define MOF_ROLETPLTCFG_H
class RoleTpltCfg{
public:
void ~RoleTpltCfg();
void stringToObjJob(std::string);
void getMaxAnger(void);
void setMaxAnger(int);
void load(std::string);
void stringToObjSex(std::string);
}
#endif | [
"xiaobin0860@gmail.com"
] | xiaobin0860@gmail.com |
25b7d0eb5269fd165c94859cbc6a3107a9de0900 | 08509d1d559f3f7eab7495cd4e072f229488166a | /PhysX/Include/particles/PxParticleCreationData.h | b7f8e5c6befd27d233326e6c7711bd08e30a5c70 | [] | no_license | LastVision/DistortionGamesFPS | 8a9da37990c68bb6ba193a289633f91ffa47bd6b | e26bd778b3ce16e01e6c9d67ad8e0ce7d1f0f6e0 | refs/heads/master | 2021-06-01T08:32:46.430309 | 2016-04-28T10:34:38 | 2016-04-28T10:34:38 | 51,527,472 | 2 | 3 | null | null | null | null | UTF-8 | C++ | false | false | 4,875 | h | // This code contains NVIDIA Confidential Information and is disclosed to you
// under a form of NVIDIA software license agreement provided separately to you.
//
// Notice
// 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.
//
// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
//
// Information and code furnished is believed to be accurate and reliable.
// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
// information or for any infringement of patents or other rights of third parties that may
// result from its use. No license is granted by implication or otherwise under any patent
// or patent rights of NVIDIA Corporation. Details are subject to change without notice.
// This code supersedes and replaces all information previously supplied.
// NVIDIA Corporation products are not authorized for use as critical
// components in life support devices or systems without express written approval of
// NVIDIA Corporation.
//
// Copyright (c) 2008-2014 NVIDIA Corporation. All rights reserved.
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
#ifndef PX_PARTICLESYSTEM_NXPARTICLECREATIONDATA
#define PX_PARTICLESYSTEM_NXPARTICLECREATIONDATA
/** \addtogroup particles
@{
*/
#include "PxPhysXConfig.h"
#include "foundation/PxVec3.h"
#include "foundation/PxStrideIterator.h"
#ifndef PX_DOXYGEN
namespace physx
{
#endif
/**
\brief Descriptor-like user-side class describing buffers for particle creation.
PxParticleCreationData is used to create particles within the SDK. The SDK copies the particle data referenced by PxParticleCreationData, it
may therefore be deallocated right after the creation call returned.
@see PxParticleBase::createParticles()
*/
class PxParticleCreationData
{
public:
/**
\brief The number of particles stored in the buffer.
*/
PxU32 numParticles;
/**
\brief Particle index data.
When creating particles, providing the particle indices is mandatory.
*/
PxStrideIterator<const PxU32> indexBuffer;
/**
\brief Particle position data.
When creating particles, providing the particle positions is mandatory.
*/
PxStrideIterator<const PxVec3> positionBuffer;
/**
\brief Particle velocity data.
Providing velocity data is optional.
*/
PxStrideIterator<const PxVec3> velocityBuffer;
/**
\brief Particle rest offset data.
Values need to be in the range [0.0f, restOffset].
If PxParticleBaseFlag.ePER_PARTICLE_REST_OFFSET is set, providing per particle rest offset data is mandatory.
@see PxParticleBaseFlag.ePER_PARTICLE_REST_OFFSET.
*/
PxStrideIterator<const PxF32> restOffsetBuffer;
/**
\brief Particle flags.
PxParticleFlag.eVALID, PxParticleFlag.eCOLLISION_WITH_STATIC, PxParticleFlag.eCOLLISION_WITH_DYNAMIC,
PxParticleFlag.eCOLLISION_WITH_DRAIN, PxParticleFlag.eSPATIAL_DATA_STRUCTURE_OVERFLOW are all flags that
can't be set on particle creation. They are written by the SDK exclusively.
Providing flag data is optional.
@see PxParticleFlag
*/
PxStrideIterator<const PxU32> flagBuffer;
PX_INLINE ~PxParticleCreationData();
/**
\brief (Re)sets the structure to the default.
*/
PX_INLINE void setToDefault();
/**
\brief Returns true if the current settings are valid
*/
PX_INLINE bool isValid() const;
/**
\brief Constructor sets to default.
*/
PX_INLINE PxParticleCreationData();
};
PX_INLINE PxParticleCreationData::PxParticleCreationData()
{
indexBuffer = PxStrideIterator<const PxU32>();
positionBuffer = PxStrideIterator<const PxVec3>();
velocityBuffer = PxStrideIterator<const PxVec3>();
restOffsetBuffer = PxStrideIterator<const PxF32>();
flagBuffer = PxStrideIterator<const PxU32>();
}
PX_INLINE PxParticleCreationData::~PxParticleCreationData()
{
}
PX_INLINE void PxParticleCreationData::setToDefault()
{
*this = PxParticleCreationData();
}
PX_INLINE bool PxParticleCreationData::isValid() const
{
if (numParticles > 0 && !(indexBuffer.ptr() && positionBuffer.ptr())) return false;
return true;
}
#ifndef PX_DOXYGEN
} // namespace physx
#endif
/** @} */
#endif
| [
"anderssonniklas@outlook.com"
] | anderssonniklas@outlook.com |
33f68aa4091926a6834f18a3d5571412fa130287 | 3496c0182ce7727654b273c59f464600e7478d43 | /ch07/ex7_26(隐式内联).h | 89d23f9c146c3ab5b50384c59d9899224bee6789 | [] | no_license | luqilinok/Cpp-primer-Personal | 47f54ef405053d3abd5f7536d88cd77cd1096b7c | 31ffdfa34c4cecb81051205505350e3abc4bb955 | refs/heads/master | 2018-10-22T16:39:42.639036 | 2018-08-29T07:02:49 | 2018-08-29T07:02:49 | 116,896,816 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 265 | h | #include<iostream>
#include<string>
class Sales_data
{
public:
double avg_price() const
{
if (units_sold)
{
return revenue / units_sold;
}
else
{
return 0;
}
}
private:
std::string bookNo;
unsigned units_sold = 0;
double revenue = 0.0;
};
| [
"noreply@github.com"
] | luqilinok.noreply@github.com |
0720790ec8c0b0ca7282a29806c269958adac8ff | 5edf0c66e07ad46fa79a4400b2689c9a67547c03 | /src/test/algorithm/BSIFT/DescriptorMedianBSIFT_TEST.cpp | 41a63db99990b8309ba2ed24ac63a20d16458036 | [] | no_license | piorkowskiprzemyslaw/FEITIR | c0b9edb0972ca84bc60beb4b6ef7af7701bc33e3 | beebd1b561e6dc51e8aa113a1d904f71ad5b5cb6 | refs/heads/master | 2020-07-04T10:58:15.494688 | 2016-11-30T23:10:15 | 2016-11-30T23:10:15 | 74,071,540 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 5,111 | cpp | //
// Created by Przemek Piórkowski on 20.03.2016.
//
#define BOOST_TEST_DYN_LINK
#define BOOST_TEST_MODULE FEITR_DescriptorMedianBSIFTExtractor_test
#include <iostream>
#include "test_global.h"
#include <boost/test/unit_test.hpp>
#include "src/main/algorithm/BSIFT/descriptor_median/DescriptorMedianBSIFTExtractor.h"
#include "src/main/algorithm/vocabulary/kmeans/KMeansVocabularyBuilder.h"
#include "src/main/database/DatabaseFactory.h"
#include "src/main/database/image/ImageFactory.h"
using namespace feitir;
struct DescriptorMedianBSIFTExtractorFixture {
const std::string resourcePath;
const std::string imagePath;
const std::string lennaImage;
ImageFactory imageFactory;
DatabaseFactory databaseFactory;
int means;
DescriptorMedianBSIFTExtractor descriptorMedianBSIFT;
DescriptorMedianBSIFTExtractorFixture() : resourcePath{resourcesRootDir() + "database/"},
imagePath{"image/"},
lennaImage{"Lenna.png"},
means{5} { }
float dummyMedianFind(const std::vector<float>& val) {
std::vector<float> localCopy(val);
std::sort(localCopy.begin(), localCopy.end());
if (localCopy.size() & 0x1) {
return localCopy[(localCopy.size()-1)/2];
} else {
return (localCopy[localCopy.size()/2] + localCopy[(localCopy.size()/2)-1])/2;
}
}
boost::dynamic_bitset<> medianBinaryDescriptor(cv::Mat row) {
std::vector<float> vec(row.cols);
for (int i = 0; i < row.cols; ++i) {
vec[i] = row.at<float>(0, i);
}
float median = dummyMedianFind(vec);
boost::dynamic_bitset<> binaryDescriptor(128);
for (int i = 0; i < row.cols; ++i) {
binaryDescriptor[i] = vec[i] > median;
}
return binaryDescriptor;
}
};
BOOST_FIXTURE_TEST_SUITE(DescriptorMedianBSIFTExtractor_TEST, DescriptorMedianBSIFTExtractorFixture)
BOOST_AUTO_TEST_CASE(BasicTestCase)
{
auto img = imageFactory.createImage(resourcePath + imagePath + lennaImage);
BOOST_REQUIRE(img != nullptr);
auto bsiftImg = descriptorMedianBSIFT.extractImageBSIFT(img);
BOOST_REQUIRE(bsiftImg != nullptr);
for (int i = 0; i < bsiftImg->getDescriptors().rows; ++i) {
boost::dynamic_bitset<> bdescriptor = medianBinaryDescriptor(bsiftImg->getDescriptors().row(i));
BOOST_REQUIRE(bsiftImg->getBsift()[i] == bdescriptor);
}
}
BOOST_AUTO_TEST_CASE(DummyMedianTest)
{
BOOST_REQUIRE_CLOSE_FRACTION(dummyMedianFind({1, 2, 3}), 2, 0.1);
BOOST_REQUIRE_CLOSE_FRACTION(dummyMedianFind({1, 2, 3, 4}), 2.5, 0.1);
}
BOOST_AUTO_TEST_CASE(BSIFTDatabaseTranslator)
{
const DatabasePtr database = databaseFactory.createDatabase(resourcePath + imagePath);
BOOST_REQUIRE(database != nullptr);
BOOST_CHECK_EQUAL(database->getImages().size(), 1);
BOOST_CHECK_EQUAL(database->getCategories().size(), 0);
auto img = database->getImages()[0];
BOOST_REQUIRE(img != nullptr);
BOOST_CHECK_EQUAL(img->getMatches().size(), 0);
BOOST_CHECK_GT(img->getDescriptors().rows, 0);
KMeansVocabularyBuilder kMeansVocabularyBuilder;
auto vocabulary = kMeansVocabularyBuilder.build(std::make_shared<KMeansParameter>(img->getDescriptors(), means));
DescriptorMedianBSIFTExtractor descriptorMedianBSIFTExtractor;
auto bsiftDatabase = descriptorMedianBSIFTExtractor.extractDatabaseBSIFT(database);
BOOST_REQUIRE(bsiftDatabase != nullptr);
BOOST_CHECK_EQUAL(bsiftDatabase->getImages().size(), 1);
BOOST_CHECK_EQUAL(bsiftDatabase->getCategories().size(), 0);
auto bsiftPtr = std::dynamic_pointer_cast<DescriptorMedianBSIFTExtractor::ImageBSIFT>(
bsiftDatabase->getImages()[0]);
BOOST_REQUIRE(bsiftPtr != nullptr);
BOOST_CHECK_EQUAL(bsiftPtr->getMatches().size(), 0);
BOOST_CHECK_GT(bsiftPtr->getDescriptors().rows, 0);
BOOST_CHECK_EQUAL(bsiftPtr->getBsift().size(), img->getDescriptors().rows);
auto transformedBSIFTDatabase = descriptorMedianBSIFTExtractor
.getDatabaseTranslatorPtr()->transformDatabase(vocabulary, bsiftDatabase);
BOOST_REQUIRE(transformedBSIFTDatabase != nullptr);
BOOST_CHECK_EQUAL(transformedBSIFTDatabase->getImages().size(), 1);
BOOST_CHECK_EQUAL(transformedBSIFTDatabase->getCategories().size(), 0);
auto transformedBSIFTImage = std::dynamic_pointer_cast<DescriptorMedianBSIFTExtractor::ImageBSIFT>(
transformedBSIFTDatabase->getImages()[0]);
BOOST_REQUIRE(transformedBSIFTImage != nullptr);
BOOST_CHECK_GT(transformedBSIFTImage->getMatches().size(), 0);
BOOST_CHECK_EQUAL(transformedBSIFTImage->getDescriptors().rows, 0);
BOOST_CHECK_EQUAL(transformedBSIFTImage->getBsift().size(), img->getDescriptors().rows);
}
BOOST_AUTO_TEST_SUITE_END() | [
"piorkowskiprzemyslaw@gmail.com"
] | piorkowskiprzemyslaw@gmail.com |
3dfffc749aabbe621b35a60cf7cecefac6bf973f | 43c4187cce8cb51988b3e36067f22c226271c384 | /genCpp/Data_Array_ST_Iterator/Data_Array_ST_Iterator.h | 49dff89aa64bc7194ed2d0ef56e3c072613b3faa | [] | no_license | iomeone/ss | db068a5b56000df322c86d30cdf53e39cb4e3313 | fded51bc7bdd1337ec6596bf47c1f3ae6ca4f369 | refs/heads/master | 2020-05-20T23:00:53.518351 | 2020-01-01T03:06:08 | 2020-01-01T03:06:08 | 185,790,947 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 513 | h | // Generated by pscpp compiler
#ifndef Data_Array_ST_Iterator_H
#define Data_Array_ST_Iterator_H
#include "purescript.h"
namespace Data_Array_ST_Iterator {
using namespace purescript;
auto Iterator() -> const boxed&;
auto _peek_() -> const boxed&;
auto next() -> const boxed&;
auto pushWhile() -> const boxed&;
auto pushAll() -> boxed;
auto iterator() -> const boxed&;
auto iterate() -> const boxed&;
auto exhausted() -> boxed;
} // end namespace Data_Array_ST_Iterator
#endif // Data_Array_ST_Iterator_H
| [
"iomeonee@gmail.com"
] | iomeonee@gmail.com |
928725bf8a95a8bbfa437422aa0e83b38468a3f8 | 7a2425190626dd2e75dd6cbca9fe47727afbad42 | /cxxrt-source/testsuite/cxxrt.conformance/io-27-6-2-2.exp | 7bbcbee246dce97678d22a258e25385414a89212 | [] | no_license | dietmarkuehl/kuhllib | fadd4073c9b09992479e92112ef34c367cb90fad | 482ddc2b910870398a9a2bcaa0a77a145e081f78 | refs/heads/main | 2023-08-31T22:13:02.079530 | 2023-08-21T22:14:14 | 2023-08-21T22:14:14 | 3,148,966 | 71 | 7 | null | 2023-08-21T22:14:15 | 2012-01-10T21:49:09 | C++ | UTF-8 | C++ | false | false | 2,200 | exp | #!/usr/local/bin/expect
# -*-C++-*- io-27-6-2-2.exp -- C++ is actually a lie but it helps
# --------------------------------------------------------------------------
# Copyright (c) 2002 Dietmar Kuehl
# 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.
# --------------------------------------------------------------------------
# Author: Dietmar Kuehl <http://www.dietmar-kuehl.de/>
# Title: basic_ostream constructors
# Version: $Id: io-27-6-2-2.exp,v 1.1.1.1 2002/06/05 01:03:35 dietmar_kuehl Exp $
# --------------------------------------------------------------------------
inline_compile {
#include <ostream>
#include <streambuf>
#include <iostream>
#if !defined(STD)
# if !defined(_CXXRT_STD)
# define STD std::
# else
# define STD _CXXRT_STD
# endif
#endif
template <class cT>
class tstbuf: public STD basic_streambuf<cT>
{
};
template <class cT>
void test()
{
STD basic_streambuf<cT>* sb = new tstbuf<cT>;
STD basic_ostream<cT> out(sb);
STD cout << (out.rdbuf() == sb? "OK\n": "error: wrong stream buffer\n");
}
int main()
{
test<char>();
test<wchar_t>();
return 0;
}
}
simple_test "basic_ostream ctor" "" {
OK
OK
}
| [
"dietmar.kuehl@me.com"
] | dietmar.kuehl@me.com |
024bfbdbb4b480ce808a089071ed968600c566a3 | 35d6d1029feff7dd6b757b93baa89ca75aa7c5d9 | /Light OJ/1066 - Gathering Food.cpp | 58ef49bc2101a8009984b2f2597768568f2daaec | [] | no_license | SbrTa/Online-Judge | 3709f496ebfb23155270c4ba37ada202dae0aef4 | b190d27d19140faef58218a611bf38ab7e2398d3 | refs/heads/master | 2021-04-28T08:12:48.785378 | 2019-01-15T14:27:24 | 2019-01-15T14:27:24 | 122,243,679 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,423 | cpp | #include<cstdio>
#include<iostream>
#include<vector>
#include<map>
#include<algorithm>
#include<string>
#include<cstring>
#include<cmath>
#include<cstdlib>
#include<queue>
#define inInt(n) scanf("%d",&n)
#define inLong(n) scanf("%ld",&n)
#define inLong2(n,m) scanf("%ld%ld",&n,&m)
#define inLL(n) scanf("%lld",&n)
#define inLL2(n,m) scanf("%lld%lld",&n,&m)
#define inFloat(n) scanf("%f",&n)
#define inDouble(n) scanf("%lf",&n)
#define inLD(n) scanf("%Lf",&n)
#define inStr(n) scanf("%s",n)
#define inChar(n) scanf("%c",&n)
#define Spc() printf(" ")
#define Line() printf("\n")
#define Case(n) printf("Case %ld:",n++)
#define INF 111
#define MX 111
#define PI acos(-1.0)
using namespace std;
string g[15];
long n,visited[15][15];
struct point
{
long x,y;
};
long valid(long x, long y, char last)
{
if(visited[x][y]) return 0;
if(x<0 || x>=n) return 0;
if(y<0 || y>=n) return 0;
if(g[x][y]=='#') return 0;
if(g[x][y]>='A' && g[x][y]<='Z')
if(g[x][y]>last) return 0;
return 1;
}
long bfs(point p, char last)
{
long i,j,cost[15][15];
for(i=0;i<=n;i++) for(j=0;j<=n;j++) { cost[i][j]=0; visited[i][j]=0; }
queue<point>q;
q.push(p);
visited[p.x][p.y]=1;
while(!q.empty()){
point v,u = q.front();
long x,y;
x=u.x;
y=u.y+1;
if(valid(x,y,last)){
visited[x][y]=1;
cost[x][y] = cost[u.x][u.y] + 1;
v.x=x;
v.y=y;
q.push(v);
if(g[x][y]==last) return cost[x][y];
}
x=u.x;
y=u.y-1;
if(valid(x,y,last)){
visited[x][y]=1;
cost[x][y] = cost[u.x][u.y] + 1;
v.x=x;
v.y=y;
q.push(v);
if(g[x][y]==last) return cost[x][y];
}
x=u.x+1;
y=u.y;
if(valid(x,y,last)){
visited[x][y]=1;
cost[x][y] = cost[u.x][u.y] + 1;
v.x=x;
v.y=y;
q.push(v);
if(g[x][y]==last) return cost[x][y];
}
x=u.x-1;
y=u.y;
if(valid(x,y,last)){
visited[x][y]=1;
cost[x][y] = cost[u.x][u.y] + 1;
v.x=x;
v.y=y;
q.push(v);
if(g[x][y]==last) return cost[x][y];
}
q.pop();
}
return -1;
}
int main()
{
long test,cs=1;
long m,a,b,i,j;
point let[30];
//cout<<('C'-'A')<<endl;
inLong(test);
while(test--){
inLong(n);
for(i=0;i<n;i++)
cin>>g[i];
for(i=0;i<26;i++){
let[i].x=-1;
let[i].y=-1;
}
char last='A';
for(i=0;i<n;i++){
for(j=0;j<n;j++){
if(g[i][j]>='A' && g[i][j]<='Z')
{
char ch=g[i][j];
let[ch-'A'].x=i;
let[ch-'A'].y=j;
if(ch>last) last=ch;
}
}
}
Case(cs);
if(last=='A'){
printf(" 0\n");
continue;
}
long ans=0;
for(i=1;i<=(last-'A');i++){
char c = i+'A';
long r = bfs(let[i-1],c);
if(r==-1){
ans=-1;
break;
}
else ans+=r;
}
if(ans==-1) printf(" Impossible\n");
else printf(" %ld\n",ans);
}
return 0;
}
| [
"subrataxon@gmail.com"
] | subrataxon@gmail.com |
dc0feaf5fef66f0d153fa97ba23c9d1b5ab66f22 | 475bc45697b8ab6ee5864da1a88fd221ae59b64a | /number_theory/中国剩余定理.cpp | fa4d967bad2c77b3149b45c041526dadec62d715 | [] | no_license | foreignbill/ACM-ICPC_Template | 321089fba72c179b48555ce7c9ba8d23b0dab1de | 305b3a1d68261c984efb488872ee8a7d4dd4bf30 | refs/heads/master | 2020-03-20T04:36:33.410451 | 2018-09-30T09:48:09 | 2018-09-30T09:48:09 | 137,188,832 | 1 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 965 | cpp | /*
$n$个同余方程,第$i$个为$x\equiv a[i] (\mod m[i])$,且$a[i]$两两互质,那么可以通过中国剩余定理合并。
*/
#include <cstdio>
typedef long long ll;
const int maxn = 5;
ll a[maxn],m[maxn];
ll exgcd(ll a,ll b,ll&x,ll&y){
if(!b)return x=1,y=0,a;
ll d=exgcd(b,a%b,x,y),t=x;
return x=y,y=t-a/b*y,d;
}
ll CRT(ll *a,ll *m,ll n) {
ll ans = 0;
ll M = 21252;
for (int i=1;i<=n;i++) {
ll Mi=M/m[i];
ll t,y;
exgcd(Mi,m[i],t,y);
t=(t%m[i]+m[i])%m[i];//the minimal positive t
ans=(ans+a[i]*Mi*t)%M;
}
return ans;
}
int main(){
m[1]=23;m[2]=28;m[3]=33;
int cas=1,d;
while(~scanf("%lld%lld%lld%d",a+1,a+2,a+3,&d)){
if(a[1]==-1&&a[2]==-1&&a[3]==-1&&d==-1) break;
ll res=CRT(a,m,3ll);
res=(res-d)%21252;
if(res<=0)
res+=21252;
printf("Case %d: the next triple peak occurs in %d days.\n",cas++,res);
}
return 0;
} | [
"foreignbill@guohengkangdeMacBook-Pro.local"
] | foreignbill@guohengkangdeMacBook-Pro.local |
5512122985e5a18823b008dd595a5e8ad4b01006 | 8667e20de8a682e807fb2a04ea0ec86aaad71313 | /cgo.h | b62586f5dd74619259071ceff51e2382ea12c21f | [
"MIT"
] | permissive | cfh88888/xmly-downloader-qt5 | 30cc06c941a460a7a89f9f5acf4e7df5c2083af5 | 84f0dc50c1ff2196cd51284593f3220e3b31d7dc | refs/heads/master | 2022-11-09T01:49:42.610770 | 2020-06-23T01:22:17 | 2020-06-23T01:22:17 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,911 | h | #ifndef CGO_H
#define CGO_H
#include <QMetaType>
struct AlbumInfo {
const char* title;
int audioCount;
int pageCount;
const char* error;
~AlbumInfo() {
delete[] title;
delete[] error;
}
};
struct CgoAudioItem {
int id;
const char* title;
const char* url;
~CgoAudioItem() {
delete title;
delete url;
}
};
Q_DECLARE_METATYPE(CgoAudioItem*)
struct AudioItem {
int id;
QString title;
QString url;
QString number;
AudioItem* fromCgo(CgoAudioItem* ai) {
this->id = ai->id;
this->title = ai->title;
this->url = ai->url;
return this;
}
};
Q_DECLARE_METATYPE(AudioItem*)
struct Array {
void** pointer = nullptr;
int length = 0;
};
struct DataError {
void* data;
const char* error;
~DataError() { delete error; }
};
struct UserInfo {
int ret;
const char* msg;
int uid;
int isVip;
const char* nickName;
~UserInfo() {
delete msg;
delete nickName;
}
};
Q_DECLARE_METATYPE(UserInfo*)
typedef AlbumInfo* (*CGO_GET_ALBUM_INFO)(int albumID);
typedef DataError* (*CGO_GET_AUDIO_INFO)(int albumID, int page, int pageSize);
typedef DataError* (*CGO_GET_VIP_AUDIO_INFO)(int albumID, const char* cookie);
typedef const char* (*CGO_DOWNLOAD_FILE)(const char* url, const char* filePath,
int id);
typedef DataError* (*CGO_GET_USER_INFO)(const char* cookie);
typedef struct DataError* (*CGO_GET_FILE_LENGTH)(const char* url);
class Cgo {
private:
Cgo();
public:
static Cgo* getInstance();
int setCgo(const QString& funcName, void* funcPtr);
public:
CGO_GET_ALBUM_INFO cgo_getAlbumInfo = nullptr;
CGO_GET_AUDIO_INFO cgo_getAudioInfo = nullptr;
CGO_DOWNLOAD_FILE cgo_downloadFile = nullptr;
CGO_GET_VIP_AUDIO_INFO cgo_getVipAudioInfo = nullptr;
CGO_GET_USER_INFO cgo_getUserInfo = nullptr;
CGO_GET_FILE_LENGTH cgo_getFileLength = nullptr;
};
#endif // CGO_H
| [
"3033784236@qq.com"
] | 3033784236@qq.com |
092889ead22eb5bbaf5adc3a56d87adcd9d00d2d | dd50d1a5a3c7e96e83e75f68c7a940f91275f206 | /source/tnn/device/x86/acc/x86_relu_layer_acc.cc | 372704063b5cf9b90f918a6850a8fffbcfd5bdfa | [
"BSD-3-Clause"
] | permissive | bluaxe/TNN | 2bfdecc85ac4684e82032a86703eacaed5419ad6 | cafdb8792dc779236ec06dbeb65710073d27ebcd | refs/heads/master | 2023-03-19T02:55:39.007321 | 2021-03-04T02:59:18 | 2021-03-04T02:59:18 | 272,395,487 | 3 | 0 | NOASSERTION | 2020-12-30T08:10:31 | 2020-06-15T09:23:31 | C++ | UTF-8 | C++ | false | false | 1,442 | cc | // Tencent is pleased to support the open source community by making TNN available.
//
// Copyright (C) 2020 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 "tnn/device/x86/acc/x86_unary2_layer_acc.h"
#include <cmath>
#include <algorithm>
namespace TNN_NS {
typedef struct x86_relu_operator : x86_unary2_operator {
virtual float operator()(const float v) {
return std::max(v, 0.0f);
}
virtual Float4 operator()(const Float4 &v) {
return Float4::max(v, Float4(0.f));
}
virtual Float8 operator()(const Float8 &v) {
return (Float8::max(v, Float8(0.f)));
}
} X86_RELU_OP;
X86_REGISTER_UNARY2_KERNEL(LAYER_RELU, avx2, unary2_kernel_avx<X86_RELU_OP>);
X86_REGISTER_UNARY2_KERNEL(LAYER_RELU, sse42, unary2_kernel_sse<X86_RELU_OP>);
DECLARE_X86_UNARY2_ACC(Relu, LAYER_RELU);
REGISTER_X86_ACC(Relu, LAYER_RELU);
} // namespace TNN_NS | [
"noreply@github.com"
] | bluaxe.noreply@github.com |
346dd0af4907b30ed9c72c8b3134f459e7085767 | 5b8008908f6c752b50e04f05a92cd4b45d254f3e | /Problem 5.cpp | f49e2a805b476914f0083fbbdaf909d412442b61 | [] | no_license | yunusemreozturk/Project-Euler | 534ff07c842a74d2fa056a195f95e175d20fbfdf | e83c6656a0b0b5a3031b74ee89187c5876bde40a | refs/heads/master | 2022-04-25T18:46:07.522452 | 2020-05-02T11:40:55 | 2020-05-02T11:40:55 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 290 | cpp | #include <iostream>
#include <algorithm>
using namespace std;
long long lcm(int n)
{
long long ans = 1;
for (long long i = 1; i <= n; i++)
{
ans = (ans * i)/(__gcd(ans, i));
}
return ans;
}
int main()
{
int n = 20;
cout << lcm(n);
}
| [
"oz2rkk@hotmail.com"
] | oz2rkk@hotmail.com |
87862e261f89ff32c7c5dc3f94ddf93ea876f244 | 38c10c01007624cd2056884f25e0d6ab85442194 | /mojo/services/network/network_service_impl.h | b349cda1656077d1475179514306f5344ae03048 | [
"BSD-3-Clause"
] | permissive | zenoalbisser/chromium | 6ecf37b6c030c84f1b26282bc4ef95769c62a9b2 | e71f21b9b4b9b839f5093301974a45545dad2691 | refs/heads/master | 2022-12-25T14:23:18.568575 | 2016-07-14T21:49:52 | 2016-07-23T08:02:51 | 63,980,627 | 0 | 2 | BSD-3-Clause | 2022-12-12T12:43:41 | 2016-07-22T20:14:04 | null | UTF-8 | C++ | false | false | 1,849 | h | // Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef MOJO_SERVICES_NETWORK_NETWORK_SERVICE_IMPL_H_
#define MOJO_SERVICES_NETWORK_NETWORK_SERVICE_IMPL_H_
#include "base/compiler_specific.h"
#include "mojo/application/public/cpp/app_lifetime_helper.h"
#include "mojo/services/network/public/interfaces/network_service.mojom.h"
#include "third_party/mojo/src/mojo/public/cpp/bindings/strong_binding.h"
#include "url/gurl.h"
namespace mojo {
class NetworkServiceImpl : public NetworkService {
public:
NetworkServiceImpl(scoped_ptr<mojo::AppRefCount> app_refcount,
InterfaceRequest<NetworkService> request);
~NetworkServiceImpl() override;
// NetworkService methods:
void CreateTCPBoundSocket(
NetAddressPtr local_address,
InterfaceRequest<TCPBoundSocket> bound_socket,
const CreateTCPBoundSocketCallback& callback) override;
void CreateTCPConnectedSocket(
NetAddressPtr remote_address,
ScopedDataPipeConsumerHandle send_stream,
ScopedDataPipeProducerHandle receive_stream,
InterfaceRequest<TCPConnectedSocket> client_socket,
const CreateTCPConnectedSocketCallback& callback) override;
void CreateUDPSocket(InterfaceRequest<UDPSocket> socket) override;
void CreateHttpServer(NetAddressPtr local_address,
HttpServerDelegatePtr delegate,
const CreateHttpServerCallback& callback) override;
void GetMimeTypeFromFile(
const mojo::String& file_path,
const GetMimeTypeFromFileCallback& callback) override;
private:
scoped_ptr<mojo::AppRefCount> app_refcount_;
StrongBinding<NetworkService> binding_;
};
} // namespace mojo
#endif // MOJO_SERVICES_NETWORK_NETWORK_SERVICE_IMPL_H_
| [
"zeno.albisser@hemispherian.com"
] | zeno.albisser@hemispherian.com |
2cd295f88cd636d07e4187c0e0dd8052eb92d0b6 | a744e0478a002f4d4a6ff98db797d59c4ef3cbd6 | /Source/IslandBattle/Private/IBShipAIController.cpp | 491724b21b160e28603b6e1d7ed0c5a5b36577db | [] | no_license | HWH222/IslandBattle | b6fe954273f04294485fd36f8eedb117480bd657 | ba0d70cd9c1469308f0897a0d05d26ad3a2b00e0 | refs/heads/master | 2020-05-15T10:43:10.807830 | 2019-05-12T10:13:31 | 2019-05-12T10:13:31 | 182,199,244 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,120 | cpp | // Fill out your copyright notice in the Description page of Project Settings.
#include "IBShipAIController.h"
#include "NavigationSystem.h"
TArray<FVector> AIBShipAIController::SearchPath(const FVector & location)
{
TArray<FVector> Result;
FPathFindingQuery Query;
FAIMoveRequest MoveRequest(location);
MoveRequest.SetUsePathfinding(true);
const bool bValidQuery = BuildPathfindingQuery(MoveRequest, Query);
if (bValidQuery)
{
UNavigationSystemV1* NavSys = FNavigationSystem::GetCurrent<UNavigationSystemV1>(GetWorld());
FPathFindingResult PathResult;
if (NavSys)
{
PathResult = NavSys->FindPathSync(Query);
if (PathResult.Result != ENavigationQueryResult::Error)
{
if (PathResult.IsSuccessful() && PathResult.Path.IsValid())
{
for (FNavPathPoint point : PathResult.Path->GetPathPoints())
{
Result.Add(point.Location);
}
}
}
else
{
UE_LOG(LogTemp, Log, TEXT("Pathfinding failed."));
}
}
else
{
UE_LOG(LogTemp, Log, TEXT("Can't find navigation system."));
}
}
else UE_LOG(LogTemp, Log, TEXT("INvalid Query."));
return Result;
}
| [
"767373506@qq.com"
] | 767373506@qq.com |
51742a8f0da0601cac77ddc3a6f28f489001dadf | f1472061b35c37ed684128baf62b5ba5d95f0aa4 | /THP+Ui/LinkedList.h | 2cba4a64856f65d41f4d8874a50e5f2dcdf079bb | [] | no_license | Geymerson/CodingDirectory | e00a7ed791e6ec1dbf0c7183082a34c379499c54 | e715ee1c6078a2c00aa6de94732f717abda45184 | refs/heads/master | 2020-12-24T17:18:00.921333 | 2014-12-14T11:42:58 | 2014-12-14T11:42:58 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 8,885 | h | #ifndef LINKEDLIST_H
#define LINKEDLIST_H
#include "ListADT.h"
#include "Node.h"
template<class E>
class LinkedList : public List<E>
{
private:
Node<E> *m_cursor;
Node<E> *m_head;
Node<E> *m_tail;
int m_position;
int m_listSize;
public:
LinkedList() {
m_cursor = 0;
m_head = 0;
m_tail = 0;
m_listSize = 0;
m_position = 0;
}
~LinkedList() { this->clear(); }
void clear()
{
while(m_head != 0) //Checks if the list isn't empty
{
m_cursor = m_head;
m_head = m_head->next;
delete m_cursor;
}
m_cursor = m_head;
m_listSize = 0;
m_position = 0;
}
void insert(const E& item, const int& count) //inserts an item after the current node
{
Node<E> * temp = new Node<E>(item, count);
if(m_head == 0)
{
this->append(item, count);
}
else
{
temp->next = m_cursor->next;
if(m_cursor == m_tail) //moves tail to the right if an item was inserted at list's end
{
m_tail = temp;
}
m_cursor->next = temp;
m_listSize++;
}
}
void append(const E& item, const int& count) //inserts an item at list's end
{
Node<E> *node = new Node<E>(item, count);
if(m_head == 0)
{
m_head = node;
m_tail = m_head;
m_cursor = m_head;
m_position++;
}
else
{
m_tail->next = node;
m_tail = m_tail->next;
}
m_listSize++;
}
void pInsert(const E& item, const int& count, Node<E> *pointer)
{
Node<E> * temp = new Node<E>(item, count, pointer);
if(m_head == 0)
{
this->pAppend(item, count, pointer);
}
else
{
temp->next = m_cursor->next;
if(m_cursor == m_tail) //moves tail to the right if an item was inserted at list's end
{
m_tail = temp;
}
m_cursor->next = temp;
m_listSize++;
}
}
void pAppend(const E& item, const int& count, Node<E> *pointer)
{
Node<E> *node = new Node<E>(item, count, pointer);
if(m_head == 0)
{
m_head = node;
m_tail = m_head;
m_cursor = m_head;
m_position++;
}
else
{
m_tail->next = node;
m_tail = m_tail->next;
}
m_listSize++;
}
E remove() //removes the item at the current node and return the value removed
{
E content;
Node<E> *temp;
if(m_head == 0) //No change is made if the list is empty
{
return 0;
}
content = m_cursor->content;
if(m_cursor == m_head) //moves list's head to the right if head is the one being removed
{
m_head = m_head->next;
delete m_cursor;
m_cursor = m_head;
}
else
{
this->prev(); //cursor is moved one step left
temp = m_cursor; //temp is now the one-step-left node
m_cursor = m_cursor->next; //cursor is moved to it's original position
temp->next = m_cursor->next;
if(m_cursor == m_tail) //if list's tail is the one being removed, tail moves one step left
{
m_tail = temp;
}
delete m_cursor;
m_cursor = temp;
}
m_listSize--;
return content;
}
void moveToStart() //Sets cursor to list's start
{
m_cursor = m_head;
m_position = 1;
}
void moveToEnd() //Sets cursor to list's end
{
m_cursor = m_tail;
m_position = m_listSize;
}
void prev() //Moves the cursor one step left
{
if((m_head != 0) && (m_cursor != m_head))
{
int i = 1;
m_cursor = m_head;
while (i != (m_position - 1))
{
m_cursor = m_cursor->next;
i++;
}
m_position = i;
}
}
void next() //Moves the cursor one step right
{
if(m_cursor != m_tail)
{
m_cursor = m_cursor->next;
m_position++;
}
}
int length() const //returns list's size
{
return m_listSize;
}
int currPos() const //returns the current cursor's position
{
return m_position;
}
Node<E> *getCursor() const //return the current position pointer
{
return m_cursor;
}
Node<E> *getPointer() const //get the the pointer of the right children of the node
{
return m_cursor->right;
}
void moveToPos(int pos) //Moves to the position "pos"
{
Q_ASSERT_X((pos >= 1 && pos <= m_listSize), "LinkedList::getValue", "Empty list");
int i;
if(pos > m_position) //checks if the position intended to move is after the current position
{
for(i = m_position; i != pos; i++)
{
m_cursor = m_cursor->next;
}
m_position = i;
}
else
{
m_cursor = m_head;
for(m_position = 1; m_position != pos; m_position++)
{
m_cursor = m_cursor->next;
}
}
}
const E& getValue() const //Gets the value of the current node
{
Q_ASSERT_X(m_cursor != 0, "LinkedList::getValue", "Empty list");
//qDebug() << m_cursor->quantity << ';' <<m_cursor->content;
return m_cursor->content;
}
const int& getQuantity() const //Gets the value of the current node
{
Q_ASSERT_X(m_cursor != 0, "LinkedList::getValue", "Empty list");
//qDebug() << m_cursor->quantity << ';' <<m_cursor->content;
return m_cursor->quantity;
}
bool seekValue(const E& value)
{
Node<E> *temp = m_head;
int aux = 1;
while(temp != 0)
{
if(temp->content == value)
{
m_position = aux;
m_cursor = temp;
return true;
}
temp = temp->next;
aux++;
}
return false;
}
void bubbleSort()
{
int aux1;
E aux2;
Node<E> *aux3;
Node<E> *temp = m_head;
bool swap = true;
if(temp == 0)
{
return;
}
while(swap)
{
swap = false;
while(temp->next != 0)
{
aux1 = temp->quantity;
aux2 = temp->content;
aux3 = temp->right;
if(temp->quantity >= temp->next->quantity)
{
if(temp->quantity == temp->next->quantity)
{
if(temp->content > temp->next->content)
{
temp->quantity = temp->next->quantity;
temp->content = temp->next->content;
temp->right = temp->next->right;
temp->next->quantity = aux1;
temp->next->content = aux2;
temp->next->right = aux3;
swap = true;
}
}
else
{
temp->quantity = temp->next->quantity;
temp->content = temp->next->content;
temp->right = temp->next->right;
temp->next->quantity = aux1;
temp->next->content = aux2;
temp->next->right = aux3;
swap = true;
}
}
temp = temp->next;
}
temp = m_head;
}
}
void swap(int pos1, int pos2)//pos1 < pos2, pos1 > 1, pos2 < list.length
{
if(pos1 >= pos2 || pos1 < 1 || pos2 > this->length())
{
return;
}
Node<E> *tempCursorPos = this->getCursor(); //saving the current cursor position
this->moveToPos(pos1);
Node<E> *temp1 = this->getCursor();
E aux1 = temp1->content;
int aux2 = temp1->quantity;
Node<E> *aux3 = temp1->right;
this->moveToPos(pos2);
temp1->content = m_cursor->content;
temp1->quantity = m_cursor->quantity;
temp1->right = m_cursor->right;
m_cursor->content = aux1;
m_cursor->quantity = aux2;
m_cursor->right = aux3;
m_cursor = tempCursorPos;
return;
}
};
#endif // LINKEDLIST_H
| [
"geymerson.r@gmail.com"
] | geymerson.r@gmail.com |
93758facd91841354073dfb9304467bddcf8e5bc | f84ca67574f050afa08014f1eb64478ee600f395 | /A06/clock.cpp | 926086f723428aa6227768ee0859c4f9473cffa6 | [] | no_license | brysonb24/Assignments | 3425d8bbb3bd6d0deeddde9ada5a7384166dda92 | 28f279dc4432414ab172335e6f7298f208d1ffc3 | refs/heads/master | 2020-03-28T01:57:07.838790 | 2018-12-13T16:57:43 | 2018-12-13T16:57:43 | 147,535,216 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 5,982 | cpp | #include "counter.h"
////////////////////////////
// //
// counter Class //
// Implementation //
// *Extends Group* //
// //
////////////////////////////
/*
* Method Name: counter()
* @param: None
* This is our default constructor for our counter class w/no
* params.
*/
counter::counter() {
xCordinate = 50;
yCordinate = 50;
frameRt = 0; //Frame Rate
//-X coordinate collision
if (xCordinate == 50) {
xBounce = -1;
}
//+X coordinate collision
else if (xCordinate == 450) {
xBounce = 1;
}
//-Y coordinate collision
if (yCordinate == 50) {
yBounce = -1;
}
//+Y coordinate collision
else if (yCordinate == 350) {
yBounce = 1;
}
start = seconds(0.0);
timeStart = 0.0;
end = seconds(50.0);
timeEnd = 0.0;
//Restarts the clocks
clock.restart();
elapsed = clock.getElapsedTime();
time = start.asSeconds();
text.setString(to_string(time));
//Loads font
if (!font.loadFromFile("Segment7Standard.otf"))
{
cout << "error loading font";
}
setParameterRec();
setParameterText();
//pushes drawable items onto the group draw vector
this->push_back(rectangle);
this->push_back(text);
}
/*
* Method Name: counter()
* @param: 2 ints, stime, etime
* This is our constructor for our counter class
* start time and end time are passed in.
*/
counter::counter(int stime, int etime) {
xCordinate = 50.0;
yCordinate = 50.0;
frameRt = 0; //Frame Rate
//-X coordinate collision
if (xCordinate == 50) {
xBounce = -1;
}
//+X coordinate collision
else if (xCordinate == 450) {
xBounce = 1;
}
//-Y coordinate collision
if (yCordinate == 50) {
yBounce = -1;
}
//+Y coordinate collision
else if (yCordinate == 350) {
yBounce = 1;
}
start = seconds(stime);
timeStart = stime;
end = seconds(etime);
timeEnd = etime;
//Restarts the clock
clock.restart();
elapsed = clock.getElapsedTime();
time = start.asSeconds();
text.setString(to_string(time));
//Loads font
if (!font.loadFromFile("Segment7Standard.otf"))
{
cout << "error loading font";
}
setParameterRec();
setParameterText();
//pushes drawable items onto the group draw vector
this->push_back(rectangle);
this->push_back(text);
}
/*
* Method Name: counter()
* @param: 2ints - stime,etime
* 2 floats xCoord,yCoord passed in by user.
*/
counter::counter(int stime, int etime, float xCoord, float yCoord) {
xCordinate = xCoord;
yCordinate = yCoord;
frameRt = 0; //Frame Rate
//-X coordinate collision
if (xCordinate == 50) {
xBounce = -1;
}
//+X coordinate collision
else if (xCordinate == 450) {
xBounce = 1;
}
//-Y coordinate collision
if (yCordinate == 50) {
yBounce = -1;
}
//+Y coordinate collision
else if (yCordinate == 350) {
yBounce = 1;
}
start = seconds(stime);
timeStart = stime;
end = seconds(etime);
timeEnd = etime;
//Restarts the clocks
clock.restart();
elapsed = clock.getElapsedTime();
time = start.asSeconds();
text.setString(to_string(time));
//Loads font
if (!font.loadFromFile("Segment7Standard.otf"))
{
cout << "error loading font";
}
setParameterRec();
setParameterText();
//pushes drawable items onto the group draw vector
this->push_back(rectangle);
this->push_back(text);
}
/*
* Method Name: setParameterRec
* setting of rectangle's color, size, origin, and position
* @param:none
* @returns:none
*/
void counter::setParameterRec() {
rectangle.setSize(Vector2f(100, 100));
rectangle.setFillColor(Color::White);
rectangle.setOutlineColor(Color::Red);
rectangle.setOutlineThickness(3);
rectangle.setOrigin(50, 50);
rectangle.setPosition(xCordinate, yCordinate);
return;
}
/*
* Method Name: setParameterText
* setting of Texts' color, size, origin, and position
* @param:none
* @returns:none
*/
void counter::setParameterText() {
text.setFont(font);
text.setCharacterSize(50);
text.setFillColor(Color::Black);
text.setOrigin(24, 24);
text.setPosition(xCordinate, yCordinate);
return;
}
/*
* Method Name: wall()
* collision bounce
* @param:none
* @returns:none
*/
void counter::wall() {
//-X coordinate collision
if (xCordinate == 50) {
xBounce = -1;
}
//+X coordinate collision
else if (xCordinate == 450) {
xBounce = 1;
}
//-Y coordinate collision
if (yCordinate == 50) {
yBounce = -1;
}
//+Y coordinate collision
else if (yCordinate == 350) {
yBounce = 1;
}
//change of location
xCordinate -= xBounce;
yCordinate -= yBounce;
//location of set
rectangle.setPosition(xCordinate, yCordinate);
text.setPosition(xCordinate, yCordinate);
}
/*
* Method Name: tUpdate
* calculation of time and returns it to window to print
* @param:none
* @returns:none
*/
void counter::tUpdate() {
if (time == timeEnd) {
time = end.asSeconds();
text.setString(to_string(time));
}
else if (timeStart > timeEnd) {
elapsed = clock.getElapsedTime();
time = start.asSeconds() - elapsed.asSeconds();
text.setString(to_string(time));
}
else if (timeStart > 0) {
elapsed = clock.getElapsedTime();
time = start.asSeconds() - elapsed.asSeconds();
text.setString(to_string(time));
}
else {
elapsed = clock.getElapsedTime();
time = start.asSeconds() + elapsed.asSeconds();
text.setString(to_string(time));
}
if (frameRt == 25) {
wall(); //changes location of clock
frameRt = 0;
}
else {
frameRt++; //Increment frameRt
}
return;
}
/*
* Method Name: setColors
* sets the colors of the clock, the background, and the border
* @param:color clock, background, border
* @returns:none
*/
void counter::setColors(Color cClock, Color cBackground, Color cBorder) {
text.setFillColor(cClock);
rectangle.setFillColor(cBackground);
rectangle.setOutlineColor(cBorder);
}
/*
* Function: End
* checks to see if the clock has reached end time
* @param:
* none
* @returns:
* none
*/
bool counter::End() {
if (time == timeEnd) {
return true;
}
else return false;
}
//End of counter Implementation
| [
"noreply@github.com"
] | brysonb24.noreply@github.com |
c45dfb42ef7ff1bb7dab578cd2e46c50d370b242 | b7a451237b0bd17285cb62a1027c5833d4113049 | /Protocolo/Comandos/EnviarPosiciones.h | 38f1651cacd422a80d21dabacb9b14ceb5a0c8e5 | [] | no_license | diegobalestieri/MicroMachines | 422ae10239810a8b579e0ee2f3698d1e6cefea03 | 5dfce6270da1625f6699091eb5bc0539ab6bd281 | refs/heads/master | 2023-04-22T19:35:21.407078 | 2020-08-07T01:48:23 | 2020-08-07T01:48:23 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 735 | h | //
// Created by manfer on 2/11/19.
//
#ifndef PROTOCOLO_ENVIARPOSICIONES_H
#define PROTOCOLO_ENVIARPOSICIONES_H
#include "Comando.h"
#include "../Protocolo.h"
class EnviarPosiciones: public Comando {
Protocolo& protocolo;
std::vector<std::string>& extras; //ESTO LUEGO SERA ALGUN CONTENEDOR DE LOS OBJETOS
//opcion1: std::vector<Modificador> extras;
//para los autos: std::vector<Carro> autos; o pueden ser referencias (Carro&)
std::vector<std::string>& autos; //ESTO LUEGO SERA ALGUN CONTENEDOR DE LOS OBJETOS
public:
EnviarPosiciones(Protocolo& protocolo, std::vector<std::string>& extras,\
std::vector<std::string>& autos);
void ejecutar() override;
};
#endif //PROTOCOLO_ENVIARPOSICIONES_H
| [
"manuelsturla@gmail.com"
] | manuelsturla@gmail.com |
69d33619c31337633a02c88662ebe8b8ae4a9bb9 | a4fa50c7af93f09b2ddf463ddacd82ed404615f9 | /src/ast/IndexExpression.cpp | e96507df84b78814288a8ce7ed84699db6c2ba95 | [] | no_license | hadley-siqueira/hdc | 4cd0ab8b98afbc6ee207fc963443e5b89aa0a458 | 4df9e3f8d4070139de292fd98de93d8afbd659b2 | refs/heads/master | 2021-07-08T12:04:59.211561 | 2020-12-28T02:20:46 | 2020-12-28T02:20:46 | 136,125,618 | 3 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 583 | cpp | #include "ast/IndexExpression.h"
using namespace hdc;
/* Constructors */
IndexExpression::IndexExpression() {
setKind(AST_INDEX);
}
IndexExpression::IndexExpression(Expression* left, Expression* right) : BinaryOperator(left, right) {
setKind(AST_INDEX);
}
IndexExpression::IndexExpression(Token& oper, Expression* left, Expression* right) : BinaryOperator(oper, left, right) {
setKind(AST_INDEX);
}
/* Destructors */
IndexExpression::~IndexExpression() {
/* Empty */
}
/* Visitors */
void IndexExpression::accept(Visitor* visitor) {
visitor->visit(this);
}
| [
"hadley.siqueira@gmail.com"
] | hadley.siqueira@gmail.com |
d94a2c84556d19e8e846e7bfa901b19c8b334787 | d900eaef32972ada6e49a7ff3e58c98f2d55c9fb | /Project/RRMProjectR/RRMProject/UIManager.cpp | 58c3a5b7812da8824b527da8352a043557633791 | [] | no_license | hanakita114514/RRMProject | 97a1973aa2f1cb305cf602e3bf93952a24e72acd | bcc366c6479752417858fd6be5fe02aa920bd15d | refs/heads/master | 2021-01-21T19:13:16.861695 | 2017-10-06T04:28:14 | 2017-10-06T04:28:14 | 92,117,623 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 236 | cpp | #include "UIManager.h"
UIManager::UIManager()
{
}
UIManager::~UIManager()
{
}
void
UIManager::Create()
{
_uiFactory.Create();
}
void
UIManager::Draw()
{
for (auto& ui : _uiList)
{
ui->Draw();
}
} | [
"ryota889@yahoo.co.jp"
] | ryota889@yahoo.co.jp |
da560c23bfb0c8273aedf6c101fc55e1d7a3ba51 | 84c91987dbeb1c689daec83645b07341dec096b1 | /AE/collision.cpp | a629a8a6f473295804c74e3904d0699193cfeebd | [] | no_license | MetropoliaPeliohj/Peliohjelmointi_Juha | 12c00e4f2a81904d56ea89f53e45814392712e9b | aa15875455a124747d1a77f4d7cb6b077078ee88 | refs/heads/master | 2020-05-27T14:18:22.322500 | 2015-05-18T15:15:07 | 2015-05-18T15:15:07 | 35,672,765 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,224 | cpp | #include "ae.h"
#include "bullet.h"
#include "deletion_list.h"
#include "duck.h"
#include "log.h"
#include "render_list.h"
#include "collision.h"
Contact_Listener* Contact_Listener::m_instance = 0;
boolean Contact_Listener::contactState;
/*
Collision (begin).
*/
void Contact_Listener::BeginContact(b2Contact *contact)
{
contactState = true;
Log::log(LOG_INFO, "Begin contact");
b2Body *body_a = contact->GetFixtureA()->GetBody();
b2Body *body_b = contact->GetFixtureB()->GetBody();
b2Body *body_d = Duck::get_duck()->get_body();
// Check if the duck bites a bullet.
if (body_a->IsBullet() || body_b->IsBullet())
{
if (body_a == body_d || body_b == body_d)
{
Duck::get_duck()->kill();
}
}
// Delete bullets from rendering and physics.
if (body_a->IsBullet())
{
Render_List::get()->remove((Bullet*)(body_a->GetUserData()));
Deletion_List::get()->push_back_unique((Bullet*)(body_a->GetUserData()));
}
if (body_b->IsBullet())
{
Render_List::get()->remove((Bullet*)(body_b->GetUserData()));
Deletion_List::get()->push_back_unique((Bullet*)(body_b->GetUserData()));
}
}
/**
Collision (end).
*/
void Contact_Listener::EndContact(b2Contact *contact)
{
Log::log(LOG_INFO, "End contact");
}
| [
"landoflos@gmail.com"
] | landoflos@gmail.com |
b1dd05887cdfe7aaeb7adcc6ae444f2f8cdc772b | bc8c075b1eb7628f88dedd2c1acf221ed2ed12f8 | /backup/OrderedArray.cpp | 3a288147593b9a74cb4dcef73ab2cae2db3b0679 | [] | no_license | HyperGamingSandbox/Seed | 4b896f649adf41f4e965b1b0ad6a0850df55bac6 | 0dcecabb33bcbff5435311724a51904d41c7de03 | refs/heads/master | 2021-09-13T21:24:31.089275 | 2018-05-04T10:47:41 | 2018-05-04T10:47:41 | 111,595,186 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 5,756 | cpp | #include "OrderedArray.h"
#include "DD\DrawMachine.h"
#include "RenderObject.h"
OrderedArray::OrderedArray() : LuaBaseClass() {
_count = _exists = _dcount = 0;
_size = 8;
_data = new PLuaBaseClass[_size];
_deleted = new PIndex[_size];
_sortType = 0;
setmt();
}
OrderedArray::~OrderedArray() {
auto p = _data;
for (int i = 0; i < _count; i++, p++) {
if (*p == NULL) {
continue;
}
auto bc = *p;
auto share = bc->share(-1);
if (share == 0) {
delete bc;
}
}
delete _data;
delete _deleted;
}
void OrderedArray::__init(lua_State *L) {
CHECK_ARG(1, integer);
_id = (unsigned short int)lua_tointeger(L, 1);
}
LuaEMethod(OrderedArray, count) {
lua_pushinteger(L, _count);
return 1;
}
LuaEMethod(OrderedArray, get) {
CHECK_ARG(1, integer);
auto index = lua_tointeger(L, 1);
_lock->lock_shared();
if (index >= _count) {
lua_pushnil(L);
_lock->unlock_shared();
}
else {
auto bc = _data[index];
if (bc) {
bc->share(1);
_lock->unlock_shared();
UserData *ud = (UserData *)lua_newuserdata(L, sizeof(UserData));
ud->type = UDT_Class;
ud->data = bc;
bc->registerInNewState(L);
}
else {
lua_pushnil(L);
_lock->unlock_shared();
}
}
return 1;
}
LuaEMethod(OrderedArray, push) {
_lock->lock();
auto last = lua_gettop(L);
if (_dcount == 0) {
auto _new_size = _count + last;
if (_new_size > _size) {
_new_size = _size << 1;
auto _ndata = new PLuaBaseClass[_new_size];
memcpy(_ndata, _data, _size * sizeof(PLuaBaseClass));
delete _data;
_data = _ndata;
auto _ndeleted = new PIndex[_new_size];
if (_deleted) {
memcpy(_ndeleted, _deleted, _dcount * sizeof(PIndex));
delete _deleted;
}
_deleted = _ndeleted;
_size = _new_size;
}
}
UserData *ud;
LuaBaseClass *bc;
RenderObject *ro;
for (int index = 1; index <= last; index++) {
auto tp = lua_type(L, index);
switch (tp) {
case LUA_TUSERDATA:
ud = (UserData *)lua_touserdata(L, index);
switch (ud->type) {
case UDT_Class:
bc = static_cast<LuaBaseClass *>(ud->data);
bc->share(1);
_data[_count] = bc;
ro = dynamic_cast<RenderObject *>(bc);
ro->_lid = _id;
ro->_lindex = _count;
_count++;
_exists++;
break;
default:
_lock->unlock();
lua_pushfstring(L, "OrderedArray unknown UserData type %d", ud->type);
lua_error(L);
}
break;
default:
_lock->unlock();
lua_pushfstring(L, "OrderedArray unsupport type %s", lua_typename(L, tp));
lua_error(L);
}
}
_lock->unlock();
return 0;
}
LuaEMethod(OrderedArray, draw) {
CHECK_ARGCLASS(1, DDDrawMachine, _drawMachine);
_lock->lock_shared();
// _lock->lock();
auto p = _data;
for (int i = 0; i < _count; i++, p++) {
auto bc = *p;
if (bc) {
RenderObject *ro = dynamic_cast<RenderObject *>(bc);
// RenderObject *ro = (RenderObject *)bc;
ro->draw(_drawMachine);
}
}
_lock->unlock_shared();
// _lock->unlock();
return 0;
}
#include <algorithm>
#include "Array.h"
LuaEMethod(OrderedArray, setSort) {
CHECK_ARG(1, integer);
_sortType = (int)lua_tointeger(L, 1);
return 0;
}
typedef bool(*SortFunc)(Array *a, Array *b);
SortFunc sortFuncs[] = {
[](Array *a, Array *b) {
if (a == NULL) return false;
if (b == NULL) return true;
return false;
},
[](Array *a, Array *b) {
if (a == NULL) return false;
if (b == NULL) {
return true;
}
bool r = b->getData()[ROF_Y].i > a->getData()[ROF_Y].i;
return r;
}
};
LuaEMethod(OrderedArray, sort) {
CHECK_ARG(1, integer);
auto sortEvent = lua_tointeger(L, 1);
if (_sortType == LS_NONE && sortEvent == SE_AFTERADD) {
return 0;
}
_lock->lock();
auto p = _data;
for (int i = 0; i < _count; i++, p++) {
auto bc = *p;
if (bc) {
bc->_lock->lock_shared();
}
}
std::sort((Array **)_data, (Array **)&_data[_count], sortFuncs[_sortType]);
_count = _exists;
p = _data;
for (int i = 0; i < _count; i++, p++) {
auto bc = *p;
// if (bc) {
bc->_lock->unlock_shared();
// }
}
_lock->unlock();
return 0;
}
LuaEMethod(OrderedArray, del) {
_lock->lock();
UserData *ud = (UserData *)lua_touserdata(L, 1);
auto bc = static_cast<LuaBaseClass *>(ud->data);
RenderObject *ro = dynamic_cast<RenderObject *>(bc);
_data[ro->_lindex] = 0;
_exists--;
auto r = bc->share(-1);
if (r == 0) {
delete bc;
}
/*
_deleted[_dcount] = ro->_lindex;
_dcount++;
*/
_lock->unlock();
return 0;
}
LuaEMethod(OrderedArray, isPointOn) {
CHECK_ARG(1, integer);
CHECK_ARG(2, integer);
_lock->lock_shared();
auto x = lua_tointeger(L, 1);
auto y = lua_tointeger(L, 2);
auto p = &_data[_count - 1];
auto c = _count;
while (c--) {
auto bc = *p;
if(bc) {
RenderObject *ro = dynamic_cast<RenderObject *>(bc);
auto prop = ro->getData();
if (!prop[ROF_SKIPHOVER].b && ro->__isPointOn(x, y)) {
bc->share(1);
_lock->unlock_shared();
// OutputDebugStringA("isPointOn 1\n");
UserData *ud = (UserData *)lua_newuserdata(L, sizeof(UserData));
ud->type = UDT_Class;
ud->data = bc;
// OutputDebugStringA("isPointOn 2\n");
bc->registerInNewState(L);
return 1;
}
}
p--;
}
lua_pushnil(L);
_lock->unlock_shared();
return 1;
}
LuaMethods(OrderedArray) = {
LuaMethodDesc(OrderedArray, count),
LuaMethodDesc(OrderedArray, get),
LuaMethodDesc(OrderedArray, push),
LuaMethodDesc(OrderedArray, sort),
LuaMethodDesc(OrderedArray, setSort),
LuaMethodDesc(OrderedArray, draw),
LuaMethodDesc(OrderedArray, isPointOn),
LuaMethodDesc(OrderedArray, del),
{ 0,0 }
};
LuaMetaMethods(OrderedArray) = {
// LuaMethodDesc(Array, __tostring),
// LuaMethodDesc(Font, __newindex),
{ 0,0 }
};
void module_ordered_array(lua_State *L) {
LuaClass<OrderedArray>::Register(L);
}
| [
"dessoya@gmail.com"
] | dessoya@gmail.com |
a3684f57cd70da9e97c0f861ff3d3d322e4fc547 | 6565182c28637e21087007f09d480a70b387382e | /code/503.下一个更大元素-ii.cpp | 1e91277a8760a98039ab3623e76655603714b89a | [] | no_license | liu-jianhao/leetcode | 08c070f0f140b2dd56cffbbaf25868364addfe53 | 7cbbe0585778517c88aa6ac1d2f2f8478cc931e5 | refs/heads/master | 2021-07-17T05:54:58.228956 | 2020-08-17T07:03:52 | 2020-08-17T07:03:52 | 188,854,718 | 1 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 572 | cpp | /*
* @lc app=leetcode.cn id=503 lang=cpp
*
* [503] 下一个更大元素 II
*/
class Solution {
public:
vector<int> nextGreaterElements(vector<int>& nums) {
vector<int> res(nums.size(), -1);
stack<int> st;
for(int i = 0; i < 2*nums.size(); ++i)
{
int n = nums[i%nums.size()];
while(!st.empty() && n > nums[st.top()])
{
res[st.top()] = n;
st.pop();
}
if(i < nums.size())
st.push(i);
}
return res;
}
};
| [
"jianhaoliu17@gmail.com"
] | jianhaoliu17@gmail.com |
01bcb40f064a8863a060acfdfea1816d6c3a6474 | 553e05ae32b4a2ad15c2b4dcca419773bc86e069 | /Math05_CanMeasureWater/CanMeasureWater.cpp | 9b3bf6172876e31d41d8d642693330c4133444d6 | [] | no_license | MaggieLee01/Coding | 52d825647aa3190bac28d7e9528a74e169ea25f6 | 6369b38fc01c0f7f8920c0d3f6188f5a91211caa | refs/heads/master | 2020-11-28T02:55:15.248215 | 2020-08-29T00:47:24 | 2020-08-29T00:47:24 | 229,686,797 | 0 | 0 | null | null | null | null | GB18030 | C++ | false | false | 3,932 | cpp | /* 有两个容量分别为 x升 和 y升 的水壶以及无限多的水。请判断能否通过使用这两个水壶,从而可以得到恰好 z升 的水?
如果可以,最后请用以上水壶中的一或两个来盛放取得的 z升 水。
你允许:
装满任意一个水壶
清空任意一个水壶
从一个水壶向另外一个水壶倒水,直到装满或者倒空
输入: x = 3, y = 5, z = 4;输出: True
输入: x = 2, y = 6, z = 5;输出: False
*/
//该题目,没思路,看题解
//#include<bits/stdc++.h>
#include<utility>
#include<unordered_set>
#include<stack>
#include<functional>
#include<algorithm>
using std::swap;
using std::min;
using std::hash;
using std::unordered_set;
using std::stack;
using std::pair;
//DFS算法,运用了很多不常用的C++特性,目前 unordered_set 默认的hash函数仅支持build-in类型及string等少数类型。其他类型或用户自定义类型,需要自己编写hash函数
//题解里有状态转换
using PII = pair<int, int>;
bool canMeasureWater(int x, int y, int z)
{
stack<PII> stk;
stk.emplace(0, 0);
//注意下面一句hash函数的定义,很多C++11的语法:
//auto自动推测类型;
//[]匿名函数,所以函数体内的语句应该以;结束
//template <class T> struct hash; std::hash是一个模板类,所以 hash<int>()在typename加上()为产生临时对象,然后hash重载了(),返回参数的hash值
//正常使用hash函数的方法:
/* char nts1[] = "Test";
std::hash<char*> ptr_hash;
ptr_hash(nts1);//得到了Test的哈希值
*/
auto hash_function = [](const PII &o) {return hash<int>() (o.first) ^ hash<int>() (o.second); };
//此处为decltype关键字,hash_function相当于是一个function object,通过decltype获得其type
unordered_set<PII, decltype(hash_function) > seen(0, hash_function);//括号里面也一定要加hash_function
while (stk.size())
{
if (seen.count(stk.top()))
{
stk.pop();
continue;
}
seen.emplace(stk.top());
//auto[remain_x, remain_y] = stk.top(); 答案上这样,我的编译器推导不出来
auto remain = stk.top();
stk.pop();
if (remain.first == z || remain.second == z || remain.first + remain.second == z)
return true;
//把6种可以进行的操作表示出来,循环进行
stk.emplace(x, remain.second); //把X壶灌满
stk.emplace(remain.first, y); //把y壶灌满
stk.emplace(0, remain.second); //把x壶倒空
stk.emplace(remain.first, 0); //把y壶倒空
stk.emplace(remain.first - min(remain.first, y - remain.second),
remain.second + min(remain.first, y - remain.second)); // 把 X 壶的水灌进 Y 壶,直至灌满或倒空。
stk.emplace(remain.first + min(x - remain.first, remain.second),
remain.second - min(x - remain.first, remain.second)); // 把 Y 壶的水灌进 X 壶,直至灌满或倒空。
}
return false;
}
//数学方法,以两壶水的总量来分析,变化为 增减x、增减y
//贝祖定理告诉我们,ax + by = z 有解当且仅当 z 是 x y 的最大公约数的倍数。因此我们只需要找x, y 的最大公约数并判断 z 是否是它的倍数即可。
int gcd(int x, int y)//已经保证 x > y
{
if (x % y == 0) return y;
gcd(y, x % y);
}
bool canMeasureWater01(int x, int y, int z)
{
if (x + y < z) return false;
if (x == 0 || y == 0) return (z == 0 || x + y == z);
if (x < y) swap(x, y);
return z % gcd(x, y) == 0;
}
//这个题解很有意思,图片解释了数学方法,同时也使用了BFS(路径最短)算法,但队列中的元素不是pair,而是两个壶水的总量
//https://leetcode-cn.com/problems/water-and-jug-problem/solution/hu-dan-long-wei-liang-zhang-you-yi-si-de-tu-by-ant/
//https://leetcode-cn.com/problems/water-and-jug-problem/solution/cjian-dan-hui-su-si-chong-zhuang-tai-by-zhuangmeng/
int main()
{
bool ans = canMeasureWater(3, 5, 4);
ans = canMeasureWater01(3, 5, 4);
return 0;
} | [
"1136053360@qq.com"
] | 1136053360@qq.com |
49299200bd45174ce1b7c1aec7d8dbc388d136df | 759838e85a8c98b5c35f3086a30a353d549a3016 | /cme/pacmensl/src/StateSet/StateSetBase.cpp | 71cba956a31a395b83c95b0205a8e2c6bd1c6fdb | [] | no_license | voduchuy/StMcmcCme | 82fa2fc6aaa282a1a7d146245e8dde787c2380a7 | 4950cbb8aecff33d6ba5c7fb41785f9e43ae44f7 | refs/heads/master | 2023-06-24T14:55:15.518677 | 2021-07-28T17:07:18 | 2021-07-28T17:07:18 | 271,329,069 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 23,382 | cpp | //
// Created by Huy Vo on 12/4/18.
//
#include "StateSetBase.h"
namespace pacmensl {
StateSetBase::StateSetBase(MPI_Comm new_comm) : partitioner_(new_comm) {
int ierr;
comm_ = new_comm;
ierr = MPI_Comm_size(comm_, &comm_size_);
PACMENSLCHKERRTHROW(ierr);
ierr = MPI_Comm_rank(comm_, &my_rank_);
PACMENSLCHKERRTHROW(ierr);
}
/**
* @brief Set the stoichiometry matrix using Armadillo's matrix class.
* @param SM stoichiometry matrix, each column is the stoichiometry vector associated with a chemical reaction.
* Affecting members: num_species_, num_reactions_, stoichiometry_matrix_, stoich_set_.
* The user must ensure that all processors must enter the same stoichiometry matrix, as we currently do not provide
* a global check.
* @details __Collective.__
*/
PacmenslErrorCode StateSetBase::SetStoichiometryMatrix(const arma::Mat<int> &SM) {
if (num_species_ != 0 && SM.n_rows != num_species_) {
if (my_rank_ == 0) {
std::cout << "Input stoichiometry has incompatible dimension with the state set.\n";
}
return -1;
} else {
num_species_ = SM.n_rows;
}
num_reactions_ = ( int ) SM.n_cols;
stoichiometry_matrix_ = SM;
stoich_set_ = 1;
return 0;
}
/**
* @brief Set the number of species.
* @param num_species number of species.
* @return Error code, 0 if successful.
* __Collective.__
*/
PacmenslErrorCode StateSetBase::SetNumSpecies(int num_species) {
if (num_species <= 0) {
if (my_rank_ == 0) {
std::cout << "Number of species must be positive.\n";
}
return -1;
}
if (num_species_ != 0) {
if (my_rank_ == 0) {
std::cout << "Warning: number of species already set. SetNumSpecies() is ignored.\n";
}
return 0;
}
num_species_ = num_species;
return 0;
}
/// Get access to the list of states stored in the calling processor.
/**
* Note: The reference is for read-only purpose.
* @return const reference to the armadillo matrix that stores the states on the calling processor. Each column represents a state.
* __Not collective.__
*/
const arma::Mat<int> &StateSetBase::GetStatesRef() const {
return local_states_;
}
/// Copy the list of states stored in the calling processor.
/**
* @details Not collective.
* @return armadillo matrix that stores the states on the calling processor. Each column represents a state.
*/
arma::Mat<int> StateSetBase::CopyStatesOnProc() const {
arma::Mat<int> states_return(num_species_, num_local_states_);
for (auto j{0}; j < num_local_states_; ++j) {
for (auto i{0}; i < num_species_; ++i) {
states_return(i, j) = ( int ) local_states_(i, j);
}
}
return states_return;
}
/// Copy the list of states stored in the calling processor into a C array.
/**
* @details Not collective.
* @param num_local_states : (in/out) number of local states.
* @param state_array : pointer to the copied states.
* NOTE: do not allocate memory for state_array since this will be done within the function.
*/
void StateSetBase::CopyStatesOnProc(int num_local_states, int *state_array) const {
assert(num_local_states == num_local_states_);
for (int i = 0; i < num_local_states; ++i) {
for (int j = 0; j < num_species_; ++j) {
state_array[i * num_species_ + j] = local_states_(j, i);
}
}
}
StateSetBase::~StateSetBase() {
int ierr;
ierr = Clear();
CHKERRABORT(comm_, ierr);
comm_ = nullptr;
}
/// Distribute the frontier states to all processors for state space exploration
/**
* Collective.
*/
void StateSetBase::distribute_frontiers() {
PetscLogEventBegin(logger_.distribute_frontiers_event, 0, 0, 0, 0);
local_frontier_gids_ = State2Index(frontiers_);
// Variables to store Zoltan's output
int zoltan_err, ierr;
int changes, num_gid_entries, num_lid_entries, num_import, num_export;
ZOLTAN_ID_PTR import_global_ids, import_local_ids, export_global_ids, export_local_ids;
int *import_procs, *import_to_part, *export_procs, *export_to_part;
zoltan_err = Zoltan_LB_Partition(zoltan_explore_, &changes, &num_gid_entries, &num_lid_entries, &num_import,
&import_global_ids, &import_local_ids, &import_procs, &import_to_part,
&num_export, &export_global_ids, &export_local_ids, &export_procs,
&export_to_part);
ZOLTANCHKERRABORT(comm_, zoltan_err);
Zoltan_LB_Free_Part(&import_global_ids, &import_local_ids, &import_procs, &import_to_part);
Zoltan_LB_Free_Part(&export_global_ids, &export_local_ids, &export_procs, &export_to_part);
PetscLogEventEnd(logger_.distribute_frontiers_event, 0, 0, 0, 0);
}
/**
* @brief Load balance the state set.
*
* Collective.
*
* __Affected members__
* \ref num_local_states_, \ref num_global_states_, \ref local_states_, \ref state_layout_, \ref inds_start_, \ref
* state_directory_.
*/
void StateSetBase::load_balance() {
partitioner_.Partition(local_states_, state_directory_, stoichiometry_matrix_, &state_layout_[0]);
num_local_states_ = local_states_.n_cols;
// Update state global ids
update_layout();
update_state_indices();
}
/**
* Add a set of states to the global and local state set
* This function cannot change the dimensionality of the state space (i.e., number of species).
* @param X : armadillo matrix of states to be added. X.n_rows = number of species. Each processor input its own
* local X. Different input sets from different processors may overlap.
* @return error code, 0 if successful.
*
* Collective
*
* __Affected memebers__
* \ref local_states_, \ref num_local_states_, \ref num_global_states_, \ref state_layout_, \ref inds_start_, \ref
* state_directory_.
*
*/
PacmenslErrorCode StateSetBase::AddStates(const arma::Mat<int> &X) {
int zoltan_err;
if (num_species_ != 0 && X.n_rows != num_species_){
return -1;
}
else if (num_species_ == 0){
num_species_ = X.n_rows;
}
if (!set_up_) {
SetUp();
}
PetscLogEventBegin(logger_.add_states_event, 0, 0, 0, 0);
arma::Mat<ZOLTAN_ID_TYPE> local_dd_gids; //
arma::Row<int> owner(X.n_cols);
arma::Row<int> parts(X.n_cols);
arma::uvec iselect;
// Probe if states_ in X are already owned by some processor
local_dd_gids = arma::conv_to<arma::Mat<ZOLTAN_ID_TYPE>>::from(X);
zoltan_err = Zoltan_DD_Find(state_directory_, &local_dd_gids[0], nullptr, nullptr, nullptr, X.n_cols,
&owner[0]);
ZOLTANCHKERRQ(zoltan_err);
iselect = arma::find(owner == -1);
// Shed any states_ that are already included
arma::Mat<int> Xadd = X.cols(iselect);
local_dd_gids = local_dd_gids.cols(iselect);
// Add local states_ to Zoltan directory (only 1 state from 1 processor will be added in case of overlapping)
parts.resize(Xadd.n_cols);
parts.fill(my_rank_);
PetscLogEventBegin(logger_.zoltan_dd_stuff_event, 0, 0, 0, 0);
zoltan_err = Zoltan_DD_Update(state_directory_, &local_dd_gids[0], nullptr, nullptr, parts.memptr(),
Xadd.n_cols);
ZOLTANCHKERRQ(zoltan_err);
PetscLogEventEnd(logger_.zoltan_dd_stuff_event, 0, 0, 0, 0);
// Remove overlaps between processors
parts.resize(Xadd.n_cols);
zoltan_err = Zoltan_DD_Find(state_directory_, &local_dd_gids[0], nullptr, nullptr, parts.memptr(),
Xadd.n_cols, nullptr);
ZOLTANCHKERRQ(zoltan_err);
iselect = arma::find(parts == my_rank_);
Xadd = Xadd.cols(iselect);
arma::Row<char> X_status(Xadd.n_cols);
if (Xadd.n_cols > 0) {
// Append X to local states_
X_status.fill(1);
local_states_ = arma::join_horiz(local_states_, Xadd);
}
int nstate_local_old = num_local_states_;
// Update layout_
update_layout();
// Update local ids and status
arma::Row<int> local_ids;
if (num_local_states_ > nstate_local_old) {
local_ids = arma::regspace<arma::Row<int>>(nstate_local_old, num_local_states_ - 1);
} else {
local_ids.resize(0);
}
update_state_indices_status(Xadd, local_ids, X_status);
PetscLogEventEnd(logger_.add_states_event, 0, 0, 0, 0);
return 0;
}
void StateSetBase::init_zoltan_parameters() {
// Parameters for state exploration load-balancing
Zoltan_Set_Param(zoltan_explore_, "NUM_GID_ENTRIES", "1");
Zoltan_Set_Param(zoltan_explore_, "NUM_LID_ENTRIES", "1");
Zoltan_Set_Param(zoltan_explore_, "IMBALANCE_TOL", "1.01");
Zoltan_Set_Param(zoltan_explore_, "AUTO_MIGRATE", "1");
Zoltan_Set_Param(zoltan_explore_, "RETURN_LISTS", "ALL");
Zoltan_Set_Param(zoltan_explore_, "DEBUG_LEVEL", "0");
Zoltan_Set_Param(zoltan_explore_, "LB_METHOD", "BLOCK");
Zoltan_Set_Num_Obj_Fn(zoltan_explore_, &StateSetBase::zoltan_num_frontier, ( void * ) this);
Zoltan_Set_Obj_List_Fn(zoltan_explore_, &StateSetBase::zoltan_frontier_list, ( void * ) this);
Zoltan_Set_Obj_Size_Fn(zoltan_explore_, &StateSetBase::zoltan_frontier_size, ( void * ) this);
Zoltan_Set_Pack_Obj_Multi_Fn(zoltan_explore_, &StateSetBase::pack_frontiers, ( void * ) this);
Zoltan_Set_Mid_Migrate_PP_Fn(zoltan_explore_, &StateSetBase::mid_frontier_migration, ( void * ) this);
Zoltan_Set_Unpack_Obj_Multi_Fn(zoltan_explore_, &StateSetBase::unpack_frontiers, ( void * ) this);
}
/**
* @brief Update information about the parallel layout of the state set.
* @return error code, 0 if successful.
*
* Collective.
*
* __Affecting members__
* \ref num_global_states_, \ref num_local_states_, \ref state_layout_, \ref ind_starts_.
*/
PacmenslErrorCode StateSetBase::update_layout() {
int ierr;
state_layout_[my_rank_] = num_local_states_;
ierr = MPI_Allgather(&num_local_states_, 1, MPI_INT, &state_layout_[0], 1, MPI_INT, comm_);
CHKERRMPI(ierr);
ind_starts_[0] = 0;
for (int i{1}; i < comm_size_; ++i) {
ind_starts_[i] = ind_starts_[i - 1] + state_layout_[i - 1];
}
num_local_states_ = local_states_.n_cols;
PetscMPIInt nslocal = num_local_states_;
PetscMPIInt nsglobal;
MPI_Allreduce(&nslocal, &nsglobal, 1, MPI_INT, MPI_SUM, comm_);
num_global_states_ = nsglobal;
return 0;
}
/// Generate the indices of the states in the Petsc vector ordering.
/**
* Call level: collective.
* @param state: matrix of input states. Each column represent a state. Each processor inputs its own set of states.
* @return Armadillo row vector of indices. The index of each state is nonzero of the state is a member of the finite state subset. Otherwise, the index is -1 (if state does not exist in the subset, or some entries of the state are 0) or -2-i if the state violates constraint i.
*/
arma::Row<int> StateSetBase::State2Index(const arma::Mat<int> &state) const {
arma::Row<int> indices(state.n_cols);
indices.fill(0);
for (int i{0}; i < state.n_cols; ++i) {
for (int j = 0; j < num_species_; ++j) {
if (state(j, i) < 0) {
indices(i) = -1;
break;
}
}
}
arma::uvec i_vaild_constr = arma::find(indices == 0);
arma::Row<ZOLTAN_ID_TYPE> state_indices(i_vaild_constr.n_elem);
arma::Row<int> parts(i_vaild_constr.n_elem);
arma::Row<int> owners(i_vaild_constr.n_elem);
arma::Mat<ZOLTAN_ID_TYPE> gids = arma::conv_to<arma::Mat<ZOLTAN_ID_TYPE >>::from(
state.cols(i_vaild_constr));
Zoltan_DD_Find(state_directory_, gids.memptr(), state_indices.memptr(), nullptr, parts.memptr(),
i_vaild_constr.n_elem, owners.memptr());
for (int i{0}; i < i_vaild_constr.n_elem; i++) {
int indx = i_vaild_constr(i);
if (owners[i] >= 0 && parts[i] >= 0) {
indices(indx) = ind_starts_(parts[i]) + state_indices(i);
} else {
indices(indx) = -1;
}
}
return indices;
}
/// Generate the indices of the states in the Petsc vector ordering.
/**
* Call level: collective.
* @param state: matrix of input states. Each column represent a state. Each processor inputs its own set of states.
* indx: output array of indices.
* @return none.
*/
void StateSetBase::State2Index(arma::Mat<int> &state, int *indx) const {
arma::Row<int> ipositive(state.n_cols);
ipositive.fill(0);
for (int i{0}; i < ipositive.n_cols; ++i) {
for (int j = 0; j < num_species_; ++j) {
if (state(j, i) < 0) {
ipositive(i) = -1;
indx[i] = -1;
break;
}
}
}
arma::uvec i_vaild_constr = arma::find(ipositive == 0);
arma::Row<ZOLTAN_ID_TYPE> state_indices(i_vaild_constr.n_elem);
arma::Row<int> parts(i_vaild_constr.n_elem);
arma::Row<int> owners(i_vaild_constr.n_elem);
arma::Mat<ZOLTAN_ID_TYPE> gids = arma::conv_to<arma::Mat<ZOLTAN_ID_TYPE >>::from(
state.cols(i_vaild_constr));
Zoltan_DD_Find(state_directory_, gids.memptr(), state_indices.memptr(), nullptr, parts.memptr(),
i_vaild_constr.n_elem, owners.memptr());
for (int i{0}; i < i_vaild_constr.n_elem; i++) {
auto ii = i_vaild_constr(i);
if (owners[i] >= 0 && parts[i] >= 0) {
indx[ii] = ind_starts_(parts[i]) + state_indices(i);
} else {
indx[ii] = -1;
}
}
}
void StateSetBase::State2Index(int num_states, const int *state, int *indx) const {
arma::Row<int> ipositive(num_states);
ipositive.fill(0);
for (int i{0}; i < ipositive.n_cols; ++i) {
for (int j = 0; j < num_species_; ++j) {
if (state[j + i * num_species_] < 0) {
ipositive(i) = -1;
indx[i] = -1;
break;
}
}
}
arma::uvec i_vaild_constr = arma::find(ipositive == 0);
arma::Row<ZOLTAN_ID_TYPE> state_indices(i_vaild_constr.n_elem);
arma::Row<int> parts(i_vaild_constr.n_elem);
arma::Row<int> owners(i_vaild_constr.n_elem);
arma::Mat<ZOLTAN_ID_TYPE> gids(num_species_, num_states);
for (int i{0}; i < num_states * num_species_; ++i) {
gids(i) = ( ZOLTAN_ID_TYPE ) state[i];
}
Zoltan_DD_Find(state_directory_, gids.memptr(), state_indices.memptr(), nullptr, parts.memptr(),
i_vaild_constr.n_elem, owners.memptr());
for (int i{0}; i < i_vaild_constr.n_elem; i++) {
auto ii = i_vaild_constr(i);
if (owners[i] >= 0 && parts[i] >= 0) {
indx[ii] = ind_starts_(parts[i]) + state_indices(i);
} else {
indx[ii] = -1;
}
}
}
std::tuple<int, int> StateSetBase::GetOrderingStartEnd() const {
int start, end, ierr;
start = 0;
for (int i{0}; i < my_rank_; ++i) {
start += state_layout_[i];
}
end = start + state_layout_[my_rank_];
return std::make_tuple(start, end);
}
MPI_Comm StateSetBase::GetComm() const {
return comm_;
}
int StateSetBase::GetNumLocalStates() const {
return num_local_states_;
}
int StateSetBase::GetNumGlobalStates() const {
return num_global_states_;
}
int StateSetBase::GetNumSpecies() const {
return (int(num_species_));
}
int StateSetBase::GetNumReactions() const {
return stoichiometry_matrix_.n_cols;
}
/// Update the distributed directory of states (after FSP expansion, Load-balancing...)
/**
* Call lvel: collective.
*/
void StateSetBase::update_state_indices() {
logger_.event_begin(logger_.total_update_dd_event);
int zoltan_err;
// Update hash table
auto local_dd_gids = arma::conv_to<arma::Mat<ZOLTAN_ID_TYPE>>::from(local_states_);
arma::Row<ZOLTAN_ID_TYPE> lids;
if (num_local_states_ > 0) {
lids = arma::regspace<arma::Row<ZOLTAN_ID_TYPE>>(0, num_local_states_ - 1);
} else {
lids.set_size(0);
}
arma::Row<int> parts(num_local_states_);
parts.fill(my_rank_);
zoltan_err = Zoltan_DD_Update(state_directory_, &local_dd_gids[0], &lids[0], nullptr, parts.memptr(),
num_local_states_);
ZOLTANCHKERRABORT(comm_, zoltan_err);
logger_.event_end(logger_.total_update_dd_event);
}
void StateSetBase::update_state_status(arma::Mat<int> states, arma::Row<char> status) {
logger_.event_begin(logger_.total_update_dd_event);
int zoltan_err;
// Update hash table
int n_update = status.n_elem;
if (n_update != states.n_cols) {
PetscPrintf(comm_,
"StateSet: update_state_status: states_ and status arrays have incompatible dimensions.\n");
}
arma::Mat<ZOLTAN_ID_TYPE> local_dd_gids(num_species_, n_update);
if (n_update > 0) {
for (int i = 0; i < n_update; ++i) {
local_dd_gids.col(i) = arma::conv_to<arma::Col<ZOLTAN_ID_TYPE>>::from(states.col(i));
}
}
zoltan_err = Zoltan_DD_Update(state_directory_, local_dd_gids.memptr(), nullptr, status.memptr(), nullptr,
n_update);
ZOLTANCHKERRABORT(comm_, zoltan_err);
logger_.event_end(logger_.total_update_dd_event);
}
void StateSetBase::update_state_indices_status(arma::Mat<int> states, arma::Row<int> local_ids,
arma::Row<char> status) {
logger_.event_begin(logger_.total_update_dd_event);
int zoltan_err;
// Update hash table
int n_update = local_ids.n_elem;
arma::Mat<ZOLTAN_ID_TYPE> local_dd_gids(num_species_, n_update);
arma::Row<ZOLTAN_ID_TYPE> lids(n_update);
if (n_update != states.n_cols) {
PetscPrintf(comm_,
"StateSet: update_state_indices_status: states_ and status arrays have incompatible dimensions.\n");
}
if (n_update > 0) {
for (int i = 0; i < n_update; ++i) {
local_dd_gids.col(i) = arma::conv_to<arma::Col<ZOLTAN_ID_TYPE>>::from(states.col(i));
lids(i) = ( ZOLTAN_ID_TYPE ) local_ids(i);
}
} else {
lids.set_size(0);
}
zoltan_err = Zoltan_DD_Update(state_directory_, local_dd_gids.memptr(), &lids[0], &status[0], nullptr,
n_update);
ZOLTANCHKERRABORT(comm_, zoltan_err);
logger_.event_end(logger_.total_update_dd_event);
}
void StateSetBase::retrieve_state_status() {
int zoltan_err;
local_states_status_.set_size(num_local_states_);
arma::Mat<ZOLTAN_ID_TYPE> gids = arma::conv_to<arma::Mat<ZOLTAN_ID_TYPE>>::from(local_states_);
zoltan_err = Zoltan_DD_Find(state_directory_, gids.colptr(0), nullptr, local_states_status_.memptr(),
nullptr, num_local_states_, nullptr);
ZOLTANCHKERRABORT(comm_, zoltan_err);
}
PacmenslErrorCode StateSetBase::zoltan_num_frontier(void *data, int *ierr) {
*ierr = ZOLTAN_OK;
return ( int ) (( StateSetBase * ) data)->frontiers_.n_cols;
}
int
StateSetBase::zoltan_frontier_size(void *data, int num_gid_entries, int num_lid_entries, ZOLTAN_ID_PTR global_id,
ZOLTAN_ID_PTR local_id, int *ierr) {
return (( StateSetBase * ) data)->num_species_ * sizeof(int);
}
void
StateSetBase::zoltan_frontier_list(void *data, int num_gid_entries, int num_lid_entries, ZOLTAN_ID_PTR global_id,
ZOLTAN_ID_PTR local_ids, int wgt_dim, float *obj_wgts, int *ierr) {
auto my_data = ( StateSetBase * ) data;
int n_frontier = ( int ) (my_data->frontiers_).n_cols;
for (int i{0}; i < n_frontier; ++i) {
local_ids[i] = ( ZOLTAN_ID_TYPE ) i;
global_id[i] = ( ZOLTAN_ID_TYPE ) my_data->local_frontier_gids_(i);
}
if (wgt_dim == 1) {
for (int i{0}; i < n_frontier; ++i) {
obj_wgts[i] = 1;
}
}
*ierr = ZOLTAN_OK;
}
void StateSetBase::pack_frontiers(void *data, int num_gid_entries, int num_lid_entries, int num_ids,
ZOLTAN_ID_PTR global_ids, ZOLTAN_ID_PTR local_ids, int *dest, int *sizes,
int *idx, char *buf, int *ierr) {
*ierr = ZOLTAN_FATAL;
auto my_data = ( StateSetBase * ) data;
for (int i{0}; i < num_ids; ++i) {
auto ptr = ( int * ) &buf[idx[i]];
for (int j{0}; j < my_data->num_species_; ++j) {
*(ptr + j) = my_data->frontiers_(j, local_ids[i]);
}
}
*ierr = ZOLTAN_OK;
}
void StateSetBase::mid_frontier_migration(void *data, int num_gid_entries, int num_lid_entries, int num_import,
ZOLTAN_ID_PTR import_global_ids, ZOLTAN_ID_PTR import_local_ids,
int *import_procs, int *import_to_part, int num_export,
ZOLTAN_ID_PTR export_global_ids, ZOLTAN_ID_PTR export_local_ids,
int *export_procs, int *export_to_part, int *ierr) {
auto my_data = ( StateSetBase * ) data;
// remove the packed states_ from local data structure
arma::uvec i_keep(my_data->frontier_lids_.n_elem);
i_keep.zeros();
for (int i{0}; i < num_export; ++i) {
i_keep(export_local_ids[i]) = 1;
}
i_keep = arma::find(i_keep == 0);
my_data->frontiers_ = my_data->frontiers_.cols(i_keep);
}
void
StateSetBase::unpack_frontiers(void *data, int num_gid_entries, int num_ids, ZOLTAN_ID_PTR global_ids, int *sizes,
int *idx, char *buf, int *ierr) {
auto my_data = ( StateSetBase * ) data;
int nfrontier_old = my_data->frontiers_.n_cols;
// Expand the data arrays
my_data->frontiers_.resize(my_data->num_species_, nfrontier_old + num_ids);
// Unpack new local states_
for (int i{0}; i < num_ids; ++i) {
auto ptr = ( int * ) &buf[idx[i]];
for (int j{0}; j < my_data->num_species_; ++j) {
my_data->frontiers_(j, nfrontier_old + i) = *(ptr + j);
}
}
}
PacmenslErrorCode StateSetBase::SetUp() {
PacmenslErrorCode ierr;
if (set_up_) return 0;
state_layout_.set_size(comm_size_);
ind_starts_.set_size(comm_size_);
state_layout_.fill(0);
local_states_.set_size(num_species_,0);
zoltan_explore_ = Zoltan_Create(comm_);
ierr = Zoltan_DD_Create(&state_directory_, comm_, num_species_, 1, 1, hash_table_length_, 0);
PACMENSLCHKERRQ(ierr);
partitioner_.SetUp(lb_type_, lb_approach_);
init_zoltan_parameters();
logger_.register_all(comm_);
update_layout();
set_up_ = 1;
return 0;
}
PacmenslErrorCode StateSetBase::SetLoadBalancingScheme(PartitioningType type, PartitioningApproach approach) {
lb_type_ = type;
lb_approach_ = approach;
return 0;
}
PacmenslErrorCode StateSetBase::Clear() {
if (zoltan_explore_) Zoltan_Destroy(&zoltan_explore_);
if (state_directory_) Zoltan_DD_Destroy(&state_directory_);
return 0;
}
PacmenslErrorCode StateSetBase::Expand()
{
load_balance();
return 0;
}
void FiniteStateSubsetLogger::register_all(MPI_Comm comm) {
PetscErrorCode ierr;
/// Register event logging
ierr = PetscLogEventRegister("State space exploration", 0, &state_exploration_event);
CHKERRABORT(comm, ierr);
ierr = PetscLogEventRegister("Check constraints", 0, &check_constraints_event);
CHKERRABORT(comm, ierr);
ierr = PetscLogEventRegister("Zoltan partitioning", 0, &call_partitioner_event);
CHKERRABORT(comm, ierr);
ierr = PetscLogEventRegister("Add states_", 0, &add_states_event);
CHKERRABORT(comm, ierr);
ierr = PetscLogEventRegister("Zoltan DD stuff", 0, &zoltan_dd_stuff_event);
CHKERRABORT(comm, ierr);
ierr = PetscLogEventRegister("update_state_indices()", 0, &total_update_dd_event);
CHKERRABORT(comm, ierr);
ierr = PetscLogEventRegister("DistributeFrontiers()", 0, &distribute_frontiers_event);
CHKERRABORT(comm, ierr);
}
void FiniteStateSubsetLogger::event_begin(PetscLogEvent event) {
PetscLogEventBegin(event, 0, 0, 0, 0);
}
void FiniteStateSubsetLogger::event_end(PetscLogEvent event) {
PetscLogEventBegin(event, 0, 0, 0, 0);
}
}
| [
"vdhuy91@gmail.com"
] | vdhuy91@gmail.com |
8bb974e79fff2c99f4d01d36e5fc5c5a6d4b0926 | 48c2686017a882ce4ece2226ea4eda76ee21c06f | /shortWordsView.cpp | ac6eef71a2470c43b77a7d11c711c54bb57216a9 | [] | no_license | jack-dinsmore/Vokdh | 3a3b1e7ee32103f49c6646619d26cb289cbb96f2 | 7127c6e5c7be7e1e7394b58401a0419b53f71131 | refs/heads/master | 2023-05-13T10:54:55.900603 | 2021-06-09T01:35:34 | 2021-06-09T01:35:34 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,721 | cpp | #include "shortWordsView.h"
void ShortWordsView::extraDraw(ID2D1HwndRenderTarget* renderTarget) const {
renderTarget->FillRectangle({ SUB_MENU_LR_BUFFER, SUB_MENU_TB_BUFFER, screenWidth - SUB_MENU_LR_BUFFER, screenHeight - SUB_MENU_TB_BUFFER }, backBrush);
FLOAT ypos = SUB_MENU_TB_BUFFER + TEXT_BUFFER;
FLOAT tobairPos = SUB_MENU_LR_BUFFER + TEXT_BUFFER + 200;
int i;
for (i = textIndex; i < dictionary->shortWords.size() && ypos < screenHeight - SUB_MENU_TB_BUFFER - TEXT_BUFFER - 20; i++) {
std::wstring tobair = std::wstring(dictionary->shortWords[i].begin(), dictionary->shortWords[i].end());
std::string senglish = dictionary->findEnglish(dictionary->shortWords[i]);
std::wstring english = std::wstring(senglish.begin(), senglish.end());
renderTarget->DrawText(english.c_str(), english.size(), textFormat, { SUB_MENU_LR_BUFFER + TEXT_BUFFER, ypos,
screenWidth / 2 - TEXT_BUFFER, ypos + 20 }, englishBrush);
renderTarget->DrawText(tobair.c_str(), tobair.size(), textFormat, { tobairPos, ypos,
screenWidth - SUB_MENU_LR_BUFFER - TEXT_BUFFER, ypos + 20 }, tobairBrush);
ypos += 20;
}
for (i -= dictionary->shortWords.size(); i < dictionary->pronouns.size() && ypos < screenHeight - SUB_MENU_TB_BUFFER - TEXT_BUFFER - 20; i++) {
std::wstring tobair = std::wstring(dictionary->pronouns[i].begin(), dictionary->pronouns[i].end());
std::string senglish = dictionary->findEnglish(dictionary->pronouns[i]);
std::wstring english = std::wstring(senglish.begin(), senglish.end());
renderTarget->DrawText(english.c_str(), english.size(), textFormat, { SUB_MENU_LR_BUFFER + TEXT_BUFFER, ypos,
screenWidth / 2 - TEXT_BUFFER, ypos + 20 }, englishBrush);
renderTarget->DrawText(tobair.c_str(), tobair.size(), textFormat, { tobairPos, ypos,
screenWidth - SUB_MENU_LR_BUFFER - TEXT_BUFFER, ypos + 20 }, tobairBrush);
ypos += 20;
}
}
bool ShortWordsView::extraCreateDeviceIndependentResources(HINSTANCE hInst) {
writeFactory->CreateTextFormat(L"Consolas", NULL, DWRITE_FONT_WEIGHT_BOLD, DWRITE_FONT_STYLE_NORMAL,
DWRITE_FONT_STRETCH_NORMAL, 14, L"", &textFormat);
return true;
}
bool ShortWordsView::extraCreateDeviceDependentResources(ID2D1HwndRenderTarget* renderTarget) {
return true;
}
void ShortWordsView::extraDiscardDeviceDependentResources() {
}
void ShortWordsView::handleScroll(int scrollTimes) {
textIndex -= scrollTimes;
textIndex = max(textIndex, 0);
textIndex = min(textIndex, dictionary->shortWords.size() + dictionary->pronouns.size() - 1);
} | [
"jtdinsmo@mit.edu"
] | jtdinsmo@mit.edu |
bcb54b327bbec1247bcb4eab71a9edf61143b3bd | 2f60a2285c5f58e9cfe56cfc4a203860a6d9331e | /Groupe.h | 08aed182f7530a139a1757a9063842e88e52e0ba | [] | no_license | Hjok/MeetingUT | dd4611a8c9b0dcc2badc16c3bd7b93ce00b15e67 | b893aa90c0cbae1a805e063b9c4affc2e29d40c7 | refs/heads/master | 2021-01-21T04:33:24.998556 | 2016-06-22T15:40:51 | 2016-06-22T15:40:51 | 55,008,550 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 444 | h | #ifndef GROUPE
#define GROUPE
#include <QString>
/*!
* \brief La classe Groupe stocke les données d'un groupe
*/
class Groupe {
// Attributes
private:
/*! Le nom du groupe */
QString nom;
/*! Et son id */
int id;
// Operations
public:
QString obtenirNom () const {return nom;};
int obtenirId() const {return id;};
Groupe(QString _nom);
Groupe(QString _nom, int _id);
bool operator ==(Groupe _groupe);
};
#endif
| [
"jean.courbe@gmx.com"
] | jean.courbe@gmx.com |
cf8c7d7f44bf91156f737358305c2986e98bbbdd | 0c15a952cfe1ae2c5ad2af09203ca4e559e6564c | /decrQualDeaminatedDoubleStranded.cpp | abca5a8a26a81474c5d6f4fcbf0156cdb55f8e66 | [] | no_license | grenaud/libbam | b37fe3d0c2907fc0b351c6579b65b35da658426b | c210c1ce1d4f0e1fe07fcbb4a438f9a7a2e3cf9b | refs/heads/master | 2022-07-07T11:58:15.193167 | 2022-06-24T09:00:06 | 2022-06-24T09:00:06 | 6,300,708 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 4,127 | cpp | #include <iostream>
#include <string>
#include <cstring>
#include "api/BamMultiReader.h"
#include "api/BamReader.h"
#include "api/BamWriter.h"
#include "api/BamAux.h"
#include "libgab.h"
#include "PutProgramInHeader.h"
using namespace std;
using namespace BamTools;
const int baseQualForDeam=2;
const int offset=33;
int main (int argc, char *argv[]) {
// bool mapped =false;
// bool unmapped=false;
int bpToDecrease=5;
const string usage=string(string(argv[0])+" [options] input.bam out.bam"+"\n\n"+
"This program takes a BAM file as input and produces\n"+
"another where the putative deaminated bases have\n"+
"a base quality score of "+stringify(baseQualForDeam)+"\n"+
"given an "+stringify(offset)+" offset \n"+
"\n"+
"Options:\n"+
"\t"+"-n" +"\t\t\t"+"Decrease the nth bases surrounding the 5'/3' ends (Default:"+stringify(bpToDecrease)+") "+"\n");
if( (argc== 1) ||
(argc== 2 && string(argv[1]) == "-h") ||
(argc== 2 && string(argv[1]) == "-help") ||
(argc== 2 && string(argv[1]) == "--help") ){
cout<<"Usage:"<<endl;
cout<<usage<<endl;
cout<<""<<endl;
return 1;
}
//all but last 2
for(int i=1;i<(argc-2);i++){
if(string(argv[i]) == "-n"){
bpToDecrease =destringify<int>(argv[i+1]);
i++;
continue;
}
}
if(argc < 3){
cerr<<"Error: Must specify the input and output BAM files";
return 1;
}
string inbamFile =argv[argc-2];
string outbamFile=argv[argc-1];
BamReader reader;
if ( !reader.Open(inbamFile) ) {
cerr << "Could not open input BAM files." << endl;
return 1;
}
SamHeader header = reader.GetHeader();
string pID = "decrQualDeaminatedDoubleStranded";
string pName = "decrQualDeaminatedDoubleStranded";
string pCommandLine = "";
for(int i=0;i<(argc);i++){
pCommandLine += (string(argv[i])+" ");
}
putProgramInHeader(&header,pID,pName,pCommandLine);
vector<RefData> testRefData=reader.GetReferenceData();
// const SamHeader header = reader.GetHeader();
const RefVector references = reader.GetReferenceData();
BamWriter writer;
if ( !writer.Open(outbamFile, header, references) ) {
cerr << "Could not open output BAM file" << endl;
return 1;
}
BamAlignment al;
// BamAlignment al2;
// bool al2Null=true;
while ( reader.GetNextAlignment(al) ) {
if(al.IsPaired() ){
// cerr << "We do not support paired end" << endl;
// return 1;
if(al.IsReverseStrand()){ //is reverse complemented, we decrease the last As regardless of first or second mate
for(int indexToCheck=(al.QueryBases.length()-1);indexToCheck>( (al.QueryBases.length()-1)-bpToDecrease);indexToCheck--){
if(toupper(al.QueryBases[indexToCheck]) == 'A'){
al.Qualities[indexToCheck]=char(offset+baseQualForDeam);
}
}
}else{ //if not reverse complemented, we decrease the first 5 Ts regardless of first or second mate
for(int indexToCheck=0;indexToCheck<bpToDecrease;indexToCheck++){
if(toupper(al.QueryBases[indexToCheck]) == 'T'){
al.Qualities[indexToCheck]=char(offset+baseQualForDeam);
}
}
}
}//end of paired end
else{//we consider single reads to have been sequenced from 5' to 3'
if(al.QueryBases.length() <= 5){
cerr << "We do not process reads with less than 5bp" << endl;
return 1;
}
for(int indexToCheck=0;indexToCheck<bpToDecrease;indexToCheck++){
if(toupper(al.QueryBases[indexToCheck]) == 'T'){
al.Qualities[indexToCheck]=char(offset+baseQualForDeam);
}
}
for(int indexToCheck=(al.QueryBases.length()-1);indexToCheck>( (al.QueryBases.length()-1) -bpToDecrease);indexToCheck--){
if(toupper(al.QueryBases[indexToCheck]) == 'A'){
al.Qualities[indexToCheck]=char(offset+baseQualForDeam);
}
}
}//end of single end
writer.SaveAlignment(al);
}// while ( reader.GetNextAlignment(al) ) {
reader.Close();
writer.Close();
return 0;
}
| [
"gabriel.reno@gmail.com"
] | gabriel.reno@gmail.com |
72675371604fd65c7f73eb891453f2ed8c758502 | df95fbf220cc908cd50c3b7afb3845e1878a56f4 | /Excel Sheet Column Title.cpp | 0ab1d8ce22d0b7310dab61f0265621acd81a31ff | [] | no_license | shifou/leetcode | 83f5d5ddb14a61e8bf32ef9cfafce523acf0df94 | 6d1e024fe79881944fedcc8ebc7ffd432e45e6a9 | refs/heads/master | 2021-01-15T13:11:24.479238 | 2015-06-12T19:25:45 | 2015-06-12T19:25:45 | 31,827,697 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 321 | cpp | class Solution {
public:
// AAC
string convertToTitle(int n) {
string ans="";
int hold=26;
while(n)
{
int r=(n-1)%hold;
ans+=('A'+r);
n=(n-1)/26;
}
reverse(ans.begin(),ans.end());
return ans;
}
}; | [
"maolixun@gmail.com"
] | maolixun@gmail.com |
5f708f4d2c2b92f772694c21b94b709fbbcb7502 | f0ee987789f5a6fe8f104890e95ee56e53f5b9b2 | /pythia-0.8/packages/acis/acismodule/meshing.cc | de887fbd9875a8a572e39ac2bf814da056277868 | [] | no_license | echoi/Coupling_SNAC_CHILD | 457c01adc439e6beb257ac8a33915d5db9a5591b | b888c668084a3172ffccdcc5c4b8e7fff7c503f2 | refs/heads/master | 2021-01-01T18:34:00.403660 | 2015-10-26T13:48:18 | 2015-10-26T13:48:18 | 19,891,618 | 1 | 2 | null | null | null | null | UTF-8 | C++ | false | false | 3,294 | cc | // -*- C++ -*-
//
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Michael A.G. Aivazis
// California Institute of Technology
// (C) 1998-2005 All Rights Reserved
//
// <LicenseText>
//
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
#include "imports"
#include "exceptions.h"
#include "faceting.h"
#include "support.h"
// ACIS includes
#include <faceter/attribs/refine.hxx>
#include <faceter/attribs/af_enum.hxx>
#include <faceter/api/af_api.hxx>
#include <meshhusk/api/meshapi.hxx>
#include <kernel/kerndata/geometry/getbox.hxx>
char pyacis_mesh__name__[] = "mesh";
char pyacis_mesh__doc__[] = "compute a triangulation of the given body";
PyObject * pyacis_mesh(PyObject *, PyObject * args)
{
journal::debug_t info("acis.meshing");
PyObject * py_body;
PyObject * py_prop;
int ok = PyArg_ParseTuple(args, "OO:mesh", &py_body, &py_prop);
if (!ok) {
return 0;
}
BODY * body = (BODY *) PyCObject_AsVoidPtr(py_body);
if (PyErr_Occurred()) {
return 0;
}
info
<< journal::loc(__HERE__)
<< "meshing body@" << body
<< journal::newline;
box bbox = get_body_box(body);
double maxSurfaceDeviation = (bbox.high() - bbox.low()).len() / 50.0;
info
<< journal::loc(__HERE__)
<< "maximum surface deviation: " << maxSurfaceDeviation
<< journal::newline;
PyObject * value;
value = PyObject_GetAttrString(py_prop, "gridAspectRatio");
if (!value) {
return 0;
}
double aspectRatio = PyFloat_AsDouble(value);
info
<< journal::loc(__HERE__)
<< "grid aspect ratio: " << aspectRatio
<< journal::newline;
value = PyObject_GetAttrString(py_prop, "maximumEdgeLength");
if (!value) {
return 0;
}
double maxEdgeLength = PyFloat_AsDouble(value);
info
<< journal::loc(__HERE__)
<< "maximum edge length: " << maxEdgeLength
<< journal::newline;
value = PyObject_GetAttrString(py_prop, "maximumSurfaceTolerance");
if (!value) {
return 0;
}
double maxSurfaceTolerance = PyFloat_AsDouble(value);
info
<< journal::loc(__HERE__)
<< "maximum surface tolerance: " << maxSurfaceTolerance
<< journal::newline;
REFINEMENT * ref = new REFINEMENT;
ref->set_grid_aspect_ratio(aspectRatio);
ref->set_max_edge_length(maxEdgeLength);
ref->set_surface_tol(maxSurfaceTolerance);
ref->set_surf_mode(AF_SURF_ALL);
ref->set_adjust_mode(AF_ADJUST_ALL);
ref->set_grid_mode(AF_GRID_TO_EDGES);
ref->set_triang_mode(AF_TRIANG_ALL);
BODY * meshed;
outcome check = api_change_body_trans(body, NULL);
if (!check.ok()) {
throwACISError(check, "mesh", pyacis_runtimeError);
return 0;
}
check = api_make_tri_mesh_body(body, ref, meshed);
if (!check.ok()) {
throwACISError(check, "mesh: api_make_tri_mesh_body", pyacis_runtimeError);
return 0;
}
// return
return PyCObject_FromVoidPtr(meshed, 0);
}
// version
// $Id: meshing.cc,v 1.1.1.1 2005/03/08 16:13:32 aivazis Exp $
// End of file
| [
"echoi2@memphis.edu"
] | echoi2@memphis.edu |
5122069d21daed08759bbbeeeb536569edb9e839 | e90437391895d0d798278571826a93ce415506c8 | /src/core/lib/iomgr/event_engine/iomgr.cc | eb067b1eb4c0a94a73a1057d394443d08b04f420 | [
"Apache-2.0"
] | permissive | donnadionne/grpc | ecca6a14a2bb0a24eb760bf8df478c4551c93c16 | 001c497c230fa94e8baec78fa0c83839c0e79103 | refs/heads/master | 2022-06-24T03:13:34.565857 | 2021-09-07T21:16:02 | 2021-09-07T21:16:02 | 31,379,498 | 2 | 0 | Apache-2.0 | 2022-05-13T08:04:02 | 2015-02-26T17:33:37 | C++ | UTF-8 | C++ | false | false | 3,788 | cc | // Copyright 2021 The gRPC Authors
//
// 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 <grpc/support/port_platform.h>
#ifdef GRPC_USE_EVENT_ENGINE
#include "src/core/lib/iomgr/event_engine/iomgr.h"
#include <grpc/event_engine/event_engine.h>
#include "src/core/lib/debug/trace.h"
#include "src/core/lib/iomgr/closure.h"
#include "src/core/lib/iomgr/event_engine/promise.h"
#include "src/core/lib/iomgr/iomgr_internal.h"
#include "src/core/lib/iomgr/tcp_client.h"
#include "src/core/lib/iomgr/tcp_server.h"
#include "src/core/lib/iomgr/timer.h"
#include "src/core/lib/surface/init.h"
extern grpc_tcp_client_vtable grpc_event_engine_tcp_client_vtable;
extern grpc_tcp_server_vtable grpc_event_engine_tcp_server_vtable;
extern grpc_timer_vtable grpc_event_engine_timer_vtable;
extern grpc_pollset_vtable grpc_event_engine_pollset_vtable;
extern grpc_pollset_set_vtable grpc_event_engine_pollset_set_vtable;
extern grpc_address_resolver_vtable grpc_event_engine_resolver_vtable;
// Disabled by default. grpc_polling_trace must be defined in all iomgr
// implementations due to its usage in lockfree_event.
grpc_core::DebugOnlyTraceFlag grpc_polling_trace(false, "polling");
namespace {
using ::grpc_event_engine::experimental::DefaultEventEngineFactory;
using ::grpc_event_engine::experimental::EventEngine;
using ::grpc_event_engine::experimental::Promise;
// Note: This is a pointer to a shared_ptr, so it's trivially destructible.
std::shared_ptr<EventEngine>* g_event_engine;
void iomgr_platform_init(void) {
g_event_engine =
new std::shared_ptr<EventEngine>(DefaultEventEngineFactory());
}
void iomgr_platform_flush(void) {}
void iomgr_platform_shutdown(void) {
Promise<absl::Status> shutdown_status_promise;
(*g_event_engine)->Shutdown([&shutdown_status_promise](absl::Status status) {
shutdown_status_promise.Set(std::move(status));
});
auto shutdown_status = shutdown_status_promise.Get();
GPR_ASSERT(shutdown_status.ok());
delete g_event_engine;
g_event_engine = nullptr;
}
void iomgr_platform_shutdown_background_closure(void) {}
bool iomgr_platform_is_any_background_poller_thread(void) {
return (*g_event_engine)->IsWorkerThread();
}
bool iomgr_platform_add_closure_to_background_poller(
grpc_closure* /* closure */, grpc_error* /* error */) {
return false;
}
grpc_iomgr_platform_vtable vtable = {
iomgr_platform_init,
iomgr_platform_flush,
iomgr_platform_shutdown,
iomgr_platform_shutdown_background_closure,
iomgr_platform_is_any_background_poller_thread,
iomgr_platform_add_closure_to_background_poller};
} // namespace
void grpc_set_default_iomgr_platform() {
grpc_set_tcp_client_impl(&grpc_event_engine_tcp_client_vtable);
grpc_set_tcp_server_impl(&grpc_event_engine_tcp_server_vtable);
grpc_set_timer_impl(&grpc_event_engine_timer_vtable);
grpc_set_pollset_vtable(&grpc_event_engine_pollset_vtable);
grpc_set_pollset_set_vtable(&grpc_event_engine_pollset_set_vtable);
grpc_set_resolver_impl(&grpc_event_engine_resolver_vtable);
grpc_set_iomgr_platform_vtable(&vtable);
}
bool grpc_iomgr_run_in_background() { return false; }
grpc_event_engine::experimental::EventEngine* grpc_iomgr_event_engine() {
return g_event_engine->get();
}
#endif // GRPC_USE_EVENT_ENGINE
| [
"noreply@github.com"
] | donnadionne.noreply@github.com |
7661885ad0f6a774c1032092aedeeb145207bcf2 | 0e5bd9ec1a8006d117f969042287ea2b45ae1ff4 | /lib/Ndt/ndt_map/src/lazy_grid.cpp | 70f7c0caee8824ef3ce6491a646d17404df78223 | [] | no_license | sven-glory/backup | 22b9dc20d13f9ca2d30ba4eb0a5c4c1a516c1c73 | f079f76872cda72c2d2bc6a01958bf044efe4930 | refs/heads/master | 2023-02-25T13:08:08.891726 | 2020-06-17T01:44:01 | 2020-06-17T01:44:01 | 334,567,040 | 0 | 0 | null | null | null | null | GB18030 | C++ | false | false | 19,198 | cpp | #include <cstring>
#include <cstdio>
#include <ndt_map/lazy_grid.h>
namespace perception_oru
{
// 构建立方体栅格
LazyGrid::LazyGrid(double cellSize) : protoType(NULL)
{
initialized = false;
centerIsSet = false;
sizeIsSet = false;
cellSizeX = cellSizeY = cellSizeZ = cellSize;
m_rect.Clear();
}
// 构建长方体栅格
LazyGrid::LazyGrid(double cellSizeX_, double cellSizeY_, double cellSizeZ_)
{
initialized = false;
centerIsSet = false;
sizeIsSet = false;
cellSizeX = cellSizeX_;
cellSizeY = cellSizeY_;
cellSizeZ = cellSizeZ_;
m_rect.Clear();
}
// 根据另外一个对象构造
LazyGrid::LazyGrid(LazyGrid *another)
{
m_rect.Clear();
sizeXmeters = another->sizeXmeters;
sizeYmeters = another->sizeYmeters;
sizeZmeters = another->sizeZmeters;
cellSizeX = another->cellSizeX;
cellSizeY = another->cellSizeY;
cellSizeZ = another->cellSizeZ;
cellsCountX = abs(ceil(sizeXmeters / cellSizeX));
cellsCountY = abs(ceil(sizeYmeters / cellSizeY));
cellsCountZ = abs(ceil(sizeZmeters / cellSizeZ));
centerX = another->centerX;
centerY = another->centerY;
centerZ = another->centerZ;
protoType = another->protoType->clone();
initialize();
}
// 根据完整参数进行构造
LazyGrid::LazyGrid(double _sizeXmeters, double _sizeYmeters, double _sizeZmeters,
double _cellSizeX, double _cellSizeY, double _cellSizeZ,
double _centerX, double _centerY, double _centerZ,
NDTCell *cellPrototype)
{
m_rect.Clear();
sizeXmeters = _sizeXmeters;
sizeYmeters = _sizeYmeters;
sizeZmeters = _sizeZmeters;
cellSizeX = _cellSizeX;
cellSizeY = _cellSizeY;
cellSizeZ = _cellSizeZ;
cellsCountX = abs(ceil(sizeXmeters / cellSizeX));
cellsCountY = abs(ceil(sizeYmeters / cellSizeY));
cellsCountZ = abs(ceil(sizeZmeters / cellSizeZ));
centerX = _centerX;
centerY = _centerY;
centerZ = _centerZ;
protoType = cellPrototype->clone();
initialize();
}
LazyGrid::~LazyGrid()
{
if (initialized)
{
int cnt = 0;
//go through all cells and delete the non-NULL ones
for (unsigned int i = 0; i < activeCells.size(); ++i)
{
if (activeCells[i])
{
delete activeCells[i];
cnt++;
}
}
// 释放所有NDT单元
for (int i = 0; i < cellsCountX; i++)
{
for (int j = 0; j < cellsCountY; j++)
delete[] dataArray[i][j];
delete[] dataArray[i];
}
delete[] dataArray;
if (protoType != NULL)
delete protoType;
}
}
void LazyGrid::setCenter(double cx, double cy, double cz)
{
centerX = cx;
centerY = cy;
centerZ = cz;
centerIsSet = true;
if (sizeIsSet)
{
initialize();
}
}
void LazyGrid::setSize(double sx, double sy, double sz)
{
sizeXmeters = sx;
sizeYmeters = sy;
sizeZmeters = sz;
cellsCountX = abs(ceil(sizeXmeters / cellSizeX));
cellsCountY = abs(ceil(sizeYmeters / cellSizeY));
cellsCountZ = abs(ceil(sizeZmeters / cellSizeZ));
sizeIsSet = true;
if (centerIsSet)
{
initialize();
}
}
void LazyGrid::initializeAll()
{
if (!initialized)
this->initialize();
int idcX, idcY, idcZ;
pcl::PointXYZ center;
center.x = centerX;
center.y = centerY;
center.z = centerZ;
this->getIndexForPoint(center, idcX, idcY, idcZ);
pcl::PointXYZ cellCenter;
for (int i = 0; i < cellsCountX; i++)
{
for (int j = 0; j < cellsCountY; j++)
{
for (int k = 0; k < cellsCountZ; k++)
{
dataArray[i][j][k] = new NDTCell();
dataArray[i][j][k]->setDimensions(cellSizeX, cellSizeY, cellSizeZ);
cellCenter.x = centerX + (i - idcX)*cellSizeX;
cellCenter.y = centerY + (j - idcY)*cellSizeY;
cellCenter.z = centerZ + (k - idcZ)*cellSizeZ;
dataArray[i][j][k]->setCenter(cellCenter);
activeCells.push_back(dataArray[i][j][k]);
}
}
}
}
// 为LazyGrid分配NDT单元空间
void LazyGrid::initialize()
{
if (initialized)
return;
dataArray = new NDTCell***[cellsCountX];
for (int i = 0; i < cellsCountX; i++)
{
dataArray[i] = new NDTCell**[cellsCountY];
for (int j = 0; j < cellsCountY; j++)
{
dataArray[i][j] = new NDTCell*[cellsCountZ];
//set all cells to NULL
memset(dataArray[i][j], 0, cellsCountZ * sizeof(NDTCell*));
}
}
initialized = true;
}
//
// 根据给定的空间点位置,取得指向对应的NDT单元的指针。
//
NDTCell* LazyGrid::getCellForPoint(const pcl::PointXYZ &point)
{
// 先取得该点所在单元在X、Y、Z方向上的索引值
int indX, indY, indZ;
this->getIndexForPoint(point, indX, indY, indZ);
// 验证索引值范围
if (indX >= cellsCountX || indY >= cellsCountY || indZ >= cellsCountZ || indX < 0 || indY < 0 || indZ < 0)
return NULL;
if (!initialized || dataArray == NULL || dataArray[indX] == NULL || dataArray[indX][indY] == NULL)
return NULL;
return dataArray[indX][indY][indZ];
}
//
//
//
NDTCell* LazyGrid::getCellAtAllocate(const pcl::PointXYZ &pt)
{
// 验证空间点的有效性
pcl::PointXYZ point = pt;
if (std::isnan(point.x) || std::isnan(point.y) || std::isnan(point.z))
return NULL;
// 取得对应于该点的NDT单元在X、Y、Z方向上的索引地址
int indX, indY, indZ;
this->getIndexForPoint(point, indX, indY, indZ);
// 验证索引值的合法性
if (indX >= cellsCountX || indY >= cellsCountY || indZ >= cellsCountZ || indX < 0 || indY < 0 || indZ < 0)
return NULL;
// 单元地址必须是已经分配过了
if (!initialized || dataArray == NULL || dataArray[indX] == NULL || dataArray[indX][indY] == NULL)
return NULL;
// 如果该NDT单元是空的,现在设置该单元并激活它
if (dataArray[indX][indY][indZ] == NULL)
{
// 依样板生成新单元并设置其尺寸
dataArray[indX][indY][indZ] = protoType->clone();
dataArray[indX][indY][indZ]->setDimensions(cellSizeX, cellSizeY, cellSizeZ);
pcl::PointXYZ mapCenter;
mapCenter.x = centerX;
mapCenter.y = centerY;
mapCenter.z = centerZ;
// 计算整个LazyGrid图的中心点的索引值
int idcX, idcY, idcZ;
this->getIndexForPoint(mapCenter, idcX, idcY, idcZ);
// 计算并设置该新单元的中心点的坐标
pcl::PointXYZ cellCenter;
cellCenter.x = centerX + (indX - idcX) * cellSizeX;
cellCenter.y = centerY + (indY - idcY) * cellSizeY;
cellCenter.z = centerZ + (indZ - idcZ) * cellSizeZ;
dataArray[indX][indY][indZ]->setCenter(cellCenter);
// 记录此为一个活动有效的单元
activeCells.push_back(dataArray[indX][indY][indZ]);
}
return dataArray[indX][indY][indZ];
}
//
// 向LazyGrid中加入一个空间点。
//
NDTCell* LazyGrid::addPoint(const pcl::PointXYZ &point_c)
{
// 根据给定的点,取得对应的NDT单元
NDTCell* cell = this->getCellAtAllocate(point_c);
if (cell == NULL)
return NULL;
// 将该点记录到此NDT单元中去
cell->addPoint(point_c);
return cell;
}
typename SpatialIndex::CellVectorItr LazyGrid::begin()
{
return activeCells.begin();
}
typename SpatialIndex::CellVectorConstItr LazyGrid::begin() const
{
return activeCells.begin();
}
typename SpatialIndex::CellVectorItr LazyGrid::end()
{
return activeCells.end();
}
typename SpatialIndex::CellVectorConstItr LazyGrid::end() const
{
return activeCells.end();
}
int LazyGrid::size()
{
return activeCells.size();
}
SpatialIndex* LazyGrid::clone() const
{
return new LazyGrid(cellSizeX);
}
//
// 副制本LazyGrid,得到一个副本。
//
SpatialIndex* LazyGrid::copy() const
{
// 为新LazyGrid分配空间
LazyGrid *ret = new LazyGrid(cellSizeX); // 必须是立方体的?
// 仅副制所有活动有效的单元
typename std::vector<NDTCell*>::const_iterator it;
for (it = activeCells.begin(); it != activeCells.end(); it++)
{
NDTCell* r = (*it);
if (r != NULL)
{
// 依次将各活动单元中的原始点加入到新LazyGrid中
for (unsigned int i = 0; i < r->points_.size(); i++)
ret->addPoint(r->points_[i]);
}
}
return ret;
}
//
// 以给定的空间点为中心,radius为半径,寻找所有邻近的NDT单元。
//
void LazyGrid::getNeighbors(const pcl::PointXYZ &point, double radius, std::vector<NDTCell*> &cells)
{
// 取得该点所对应的索引值
int indX, indY, indZ;
this->getIndexForPoint(point, indX, indY, indZ);
// 如果索引值超界,则返回空表
if (indX >= cellsCountX || indY >= cellsCountY || indZ >= cellsCountZ)
{
cells.clear();
return;
}
// 搜索并收集邻近的单元
for (int x = indX - radius / cellSizeX; x <= indX + radius / cellSizeX; x++)
{
if (x < 0 || x >= cellsCountX)
continue;
for (int y = indY - radius / cellSizeY; y <= indY + radius / cellSizeY; y++)
{
if (y < 0 || y >= cellsCountY)
continue;
for (int z = indZ - radius / cellSizeZ; z <= indZ + radius / cellSizeZ; z++)
{
if (z < 0 || z >= cellsCountZ)
continue;
if (dataArray[x][y][z] == NULL)
continue;
cells.push_back(dataArray[x][y][z]);
}
}
}
}
//
// 根据给定的空间点的位置,计算对应的NDT单元的地址。
//
void LazyGrid::getIndexForPoint(const pcl::PointXYZ& point, int &indX, int &indY, int &indZ)
{
indX = floor((point.x - centerX) / cellSizeX + 0.5) + cellsCountX / 2.0;
indY = floor((point.y - centerY) / cellSizeY + 0.5) + cellsCountY / 2.0;
indZ = floor((point.z - centerZ) / cellSizeZ + 0.5) + cellsCountZ / 2.0;
}
//
// 计算与给定点的邻近距离不超过n_neigh的所有单元,并返回这些单元的列表。
//
std::vector< NDTCell* > LazyGrid::getClosestNDTCells(const pcl::PointXYZ &point, int &n_neigh, bool checkForGaussian)
{
int indX, indY, indZ;
this->getIndexForPoint(point, indX, indY, indZ);
std::vector<NDTCell*> cells;
int indXn, indYn, indZn;
//the strange thing for the indeces is for convenience of writing
//basicly, we go through 2* the number of cells and use parity to
//decide if we subtract or add. should work nicely
int i = n_neigh; //how many cells on each side
for (int x = 1; x < 2 * i + 2; x++)
{
indXn = (x % 2 == 0) ? indX + x / 2 : indX - x / 2;
for (int y = 1; y < 2 * i + 2; y++)
{
indYn = (y % 2 == 0) ? indY + y / 2 : indY - y / 2;
for (int z = 1; z < 2 * i + 2; z++)
{
indZn = (z % 2 == 0) ? indZ + z / 2 : indZ - z / 2;
// 如果该单元中有NDT单元,则将该单元加入返回列表
if (checkCellforNDT(indXn, indYn, indZn, checkForGaussian))
{
cells.push_back(dataArray[indXn][indYn][indZn]);
}
}
}
}
return cells;
}
//
// 计算与给定点最近的单元并返回它的指针。
//
NDTCell* LazyGrid::getClosestNDTCell(const pcl::PointXYZ &point, bool checkForGaussian)
{
int indXn, indYn, indZn;
int indX, indY, indZ;
this->getIndexForPoint(point, indX, indY, indZ);
NDTCell *ret = NULL;
std::vector<NDTCell*> cells;
if (!checkForGaussian)
{
//just give me whatever is in this cell
if (checkCellforNDT(indX, indY, indZ, checkForGaussian))
{
ret = (dataArray[indX][indY][indZ]);
}
return ret;
}
int i = 1; //how many cells on each side
//for(int i=1; i<= maxNumberOfCells; i++) {
//the strange thing for the indeces is for convenience of writing
//basicly, we go through 2* the number of cells and use parity to
//decide if we subtract or add. should work nicely
for (int x = 1; x < 2 * i + 2; x++)
{
indXn = (x % 2 == 0) ? indX + x / 2 : indX - x / 2;
for (int y = 1; y < 2 * i + 2; y++)
{
indYn = (y % 2 == 0) ? indY + y / 2 : indY - y / 2;
for (int z = 1; z < 2 * i + 2; z++)
{
indZn = (z % 2 == 0) ? indZ + z / 2 : indZ - z / 2;
if (checkCellforNDT(indXn, indYn, indZn))
{
ret = (dataArray[indXn][indYn][indZn]);
cells.push_back(ret);
}
}
}
}
double minDist = INT_MAX;
Eigen::Vector3d tmean;
pcl::PointXYZ pt = point;
for (unsigned int i = 0; i < cells.size(); i++)
{
tmean = cells[i]->getMean();
tmean(0) -= pt.x;
tmean(1) -= pt.y;
tmean(2) -= pt.z;
double d = tmean.norm();
if (d < minDist)
{
minDist = d;
ret = cells[i];
}
}
cells.clear();
return ret;
}
//
// 核对指定的索引位置是否有相应的NDT单元。
// 注意:该函数并不核对该单元是否是活动的。
//
bool LazyGrid::checkCellforNDT(int indX, int indY, int indZ, bool checkForGaussian)
{
if (indX < cellsCountX && indY < cellsCountY && indZ < cellsCountZ && indX >= 0 && indY >= 0 && indZ >= 0)
{
if (dataArray[indX][indY][indZ] != NULL)
{
if (dataArray[indX][indY][indZ]->hasGaussian_ || (!checkForGaussian))
return true;
}
}
return false;
}
//
// 为LazyGrid设置NDT单元样板。
//
void LazyGrid::setCellType(NDTCell *type)
{
if (type != NULL)
{
// 如原已有样板,现在需要删除它
if (protoType != NULL)
delete protoType;
// 分配空间并设置新的样板
protoType = type->clone();
}
}
void LazyGrid::getCellSize(double &cx, double &cy, double &cz)
{
cx = cellSizeX;
cy = cellSizeY;
cz = cellSizeZ;
}
void LazyGrid::getCenter(double &cx, double &cy, double &cz)
{
cx = centerX;
cy = centerY;
cz = centerZ;
}
void LazyGrid::getGridSize(int &cx, int &cy, int &cz)
{
cx = cellsCountX;
cy = cellsCountY;
cz = cellsCountZ;
}
void LazyGrid::getGridSizeInMeters(double &cx, double &cy, double &cz)
{
cx = sizeXmeters;
cy = sizeYmeters;
cz = sizeZmeters;
}
void LazyGrid::getGridSizeInZMeters(double &cz)
{
cz = sizeZmeters;
}
//
// 从文件中装入LazyGrid。(注意:缺乏通用性!)
//
bool LazyGrid::Load(FILE* fp)
{
centerIsSet = false;
sizeIsSet = false;
float f[3];
// 读入单元尺寸(X/Y/Z,单位:米)
if (fread(f, sizeof(float), 3, fp) != 3)
return false;
cellSizeX = f[0]; cellSizeY = f[1]; cellSizeZ = f[2];
// 读入场地最大尺寸(X/Y/Z,单位:米)
if (fread(f, sizeof(float), 3, fp) != 3)
return false;
setSize(f[0], f[1], f[2]);
// 读入图的中心位置(X/Y/Z,单位:米)
if (fread(f, sizeof(float), 3, fp) != 3)
return false;
setCenter(f[0], f[1], f[2]);
// 此数据无用
int n;
if (fread(&n, sizeof(int), 1, fp) != 1)
return false;
NDTCell prototype_(cellSizeX, cellSizeY, cellSizeZ);
// 装入所有单元数据
while (!feof(fp) && prototype_.loadFromJFF(fp) >= 0)
{
if (!AddNewCell(prototype_))
continue;
}
return true;
}
//
// 将LazyGrid保存到文件。
//
bool LazyGrid::Save(FILE* fp)
{
// 写入单元尺寸(X/Y/Z,单位:米)
float f[3] = { cellSizeX, cellSizeY, cellSizeZ };
if (fwrite(f, sizeof(float), 3, fp) != 3)
return false;
// 写入场地最大尺寸(X/Y/Z,单位:米)
f[0] = sizeXmeters; f[1] = sizeYmeters; f[2] = sizeZmeters;
if (fwrite(f, sizeof(float), 3, fp) != 3)
return false;
// 写入图的中心位置(X/Y/Z,单位:米)
f[0] = centerX; f[1] = centerY; f[2] = centerZ;
if (fwrite(f, sizeof(float), 3, fp) != 3)
return false;
// 写入活动单元数量
int n = size();
if (fwrite(&n, sizeof(int), 1, fp) != 1)
return false;
// 依次写入各活动单元的数据
for (SpatialIndex::CellVectorItr it = begin(); it != end(); it++)
{
if ((*it)->writeToJFF(fp) < 0)
return false;
}
return true;
}
//
// 跟踪扫描线,收集线上的所有单元,结果保存于cells中。
//
bool LazyGrid::traceLine(const Eigen::Vector3d &origin, const pcl::PointXYZ &endpoint, const Eigen::Vector3d &diff_,
const double& maxz, std::vector<NDTCell*> &cells)
{
if (endpoint.z > maxz)
return false;
double min1 = std::min(cellSizeX, cellSizeY);
double min2 = std::min(cellSizeZ, cellSizeY);
double resolution = std::min(min1, min2); // Select the smallest resolution
if (resolution < 0.01)
{
fprintf(stderr, "Resolution very very small (%lf) :( \n", resolution);
return false;
}
double l = diff_.norm();
int N = l / (resolution);
NDTCell* ptCell = NULL;
pcl::PointXYZ po;
po.x = origin(0);
po.y = origin(1);
po.z = origin(2);
Eigen::Vector3d diff = diff_ / (float)N;
pcl::PointXYZ pt;
int idxo = 0, idyo = 0, idzo = 0;
for (int i = 0; i < N - 2; i++)
{
pt.x = origin(0) + ((float)(i + 1)) * diff(0);
pt.y = origin(1) + ((float)(i + 1)) * diff(1);
pt.z = origin(2) + ((float)(i + 1)) * diff(2);
int idx, idy, idz;
idx = floor((pt.x - centerX) / cellSizeX + 0.5) + cellsCountX / 2.0;
idy = floor((pt.y - centerY) / cellSizeY + 0.5) + cellsCountY / 2.0;
idz = floor((pt.z - centerZ) / cellSizeZ + 0.5) + cellsCountZ / 2.0;
// We only want to check every cell once, so
// increase the index if we are still in the same cell
if (idx == idxo && idy == idyo && idz == idzo)
{
continue;
}
else
{
idxo = idx;
idyo = idy;
idzo = idz;
}
if (idx < cellsCountX && idy < cellsCountY && idz < cellsCountZ && idx >= 0 && idy >= 0 && idz >= 0)
{
ptCell = dataArray[idx][idy][idz];
if (ptCell != NULL)
cells.push_back(ptCell);
else
this->addPoint(pt); // Add fake point to initialize!
}
}
return true;
}
// 删除指定序号的单元
bool LazyGrid::deleteCell(int nIdx)
{
delete activeCells[nIdx];
activeCells.erase(activeCells.begin() + nIdx);
return true;
}
// 取得指定序号的单元的指针
NDTCell* LazyGrid::getCell(int nIdx)
{
return activeCells[nIdx];
}
// 向图中加入新的NDT单元
bool LazyGrid::AddNewCell(NDTCell& newCell)
{
if (!initialized || dataArray == NULL)
return false;
pcl::PointXYZ cellCenter = newCell.getCenter();
int indX, indY, indZ;
this->getIndexForPoint(cellCenter, indX, indY, indZ);
if (indX < 0 || indX >= cellsCountX)
return false;
if (indY < 0 || indY >= cellsCountY)
return false;
if (indZ < 0 || indZ >= cellsCountZ)
return false;
if (dataArray[indX] == NULL || dataArray[indX][indY] == NULL)
return false;
// 如果在该位置原来就存在NDT单元
if (dataArray[indX][indY][indZ] != NULL)
{
NDTCell* ret = dataArray[indX][indY][indZ];
ret->setDimensions(cellSizeX, cellSizeY, cellSizeZ);
ret->setCenter(cellCenter);
ret->setMean(newCell.getMean());
ret->setCov(newCell.getCov());
ret->setN(newCell.getN());
ret->setOccupancy(newCell.getOccupancy());
ret->hasGaussian_ = newCell.hasGaussian_;
}
// 该位置没有NDT单元存在,现在添加
else
{
//initialize cell
dataArray[indX][indY][indZ] = newCell.copy();
activeCells.push_back(dataArray[indX][indY][indZ]);
// 针对新加入的单元,需要调整覆盖区域的范围
CPnt ptNew(cellCenter.x, cellCenter.y);
m_rect += ptNew;
}
return true;
}
//
// 更新边界值。
//
void LazyGrid::UpdateCoveringRect()
{
m_rect.Clear();
// 依次写入各活动单元的数据
for (SpatialIndex::CellVectorItr it = begin(); it != end(); it++)
{
pcl::PointXYZ cellCenter = (*it)->getCenter();
CPnt pt(cellCenter.x, cellCenter.y);
m_rect += pt;
}
}
} //end namespace
| [
"lvxiangren@siasun.com"
] | lvxiangren@siasun.com |
92c5165b997008fd3731e6162955105e3fe2a1f2 | 1ca1418e6f431c2f544f4bcc9a3c921395d56c95 | /src/UnitTests/c11_test.cc | ddf336f599f0ecc8299a7ca53787048f79a624b5 | [] | no_license | TIHan/TEngine | 079daba4e70f468c65bcd8b5c69f30dce3cd8a77 | ba64debd54cd0478bb34d2ea5c07c1958b0a6a56 | refs/heads/master | 2020-05-30T05:26:13.920405 | 2013-02-13T10:41:50 | 2013-02-13T10:41:50 | 5,486,955 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 340 | cc | #include <engine_lib.h>
#include <gtest/gtest.h>
class C11Test : public ::testing::Test {
};
TEST_F(C11Test, MoveSemantics) {
std::vector<uint8_t> v;
auto i = std::move(1);
v.push_back(i); // lvalue
v.push_back(std::move(i)); // rvalue
v.push_back(1); // rvalue
v.push_back(std::move(1)); // rvalue
} | [
"lol.tihan@gmail.com"
] | lol.tihan@gmail.com |
62d01780bc6057e9082fa17dcf36e12a32341298 | 6e6c87775dc84f74a4c25e9b403259bba75e6013 | /Bomberman/include/GameRules.hpp | b7e47b8e1af81116bb953c45e07fa360baf3febc | [] | no_license | Sybilai/SybLib | 9a545b67f42fd608e6a2931a69efac19504a2e48 | eb62726de04f9b1d1be648a8fb19deb7293f033d | refs/heads/master | 2020-12-25T19:15:22.194033 | 2014-07-29T07:25:18 | 2014-07-29T07:25:18 | 20,766,263 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 1,621 | hpp | #ifndef BOOM_RULES_HPP
#define BOOM_RULES_HPP
namespace boom
{
/// Avoid hard-coded rules on the client side. The authority may pick and choose and set all sorts of crazy settings.
/// And that's okay.
class GameRules
{
friend class BombermanGame;
public:
const unsigned int& MapWidth() const;
const unsigned int& MapHeight() const;
const unsigned int& BombLife() const;
const unsigned int& BombRange() const;
const unsigned int& BombSpeed() const;
const unsigned int& FlameLife() const;
const unsigned int& PlayerSpeed() const;
private:
// Map layout related
unsigned int m_MapWidth;
unsigned int m_MapHeight;
// Bomb related
unsigned int m_BombLife;
unsigned int m_BombRange;
unsigned int m_BombSpeed;
// Flame related
unsigned int m_FlameLife;
// Player related
unsigned int m_PlayerSpeed;
};
#pragma region Accessors
// Map layout related
inline const unsigned int& GameRules::MapWidth() const
{
return m_MapWidth;
}
inline const unsigned int& GameRules::MapHeight() const
{
return m_MapHeight;
}
// Bomb related
inline const unsigned int& GameRules::BombLife() const
{
return m_BombLife;
}
inline const unsigned int& GameRules::BombRange() const
{
return m_BombRange;
}
inline const unsigned int& GameRules::BombSpeed() const
{
return m_BombSpeed;
}
// Flame related
inline const unsigned int& GameRules::FlameLife() const
{
return m_FlameLife;
}
// Player related
inline const unsigned int& GameRules::PlayerSpeed() const
{
return m_PlayerSpeed;
}
#pragma endregion
} // namespace boom
#endif // BOOM_RULES_HPP | [
"cogloch@outlook.com"
] | cogloch@outlook.com |
f95a65d9423dd25de5f1255ce0125d955822f1f4 | f005dc8b8f9bec19bec73c070331a533e9cd3851 | /mk_dir.h | 94e575da42d696b8b1bbc438c26fe937250f11e9 | [] | no_license | upadhyay-p/OS_Assignment_1 | 3e4e16858d6b1507f283660c0420c0a4c55c8899 | 3d90bc9d36cb0bfaa8d3784fae60d314873d751a | refs/heads/master | 2020-03-27T07:54:04.250390 | 2018-09-03T17:38:22 | 2018-09-03T17:38:22 | 146,202,945 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,652 | h | //Priya Upadhyay
//2018202012
#include <sys/stat.h>
#include <stdio.h>
#include <iostream>
#include <cstring>
using namespace std;
void create_dir(string dest, string dir, string home, string currdir){
string newdir;
//cout<<dest<<" "<<dir;
/* cout<<(dest.substr(0,2));*/
if((dest.substr(0,1)).compare("~")==0 || (dest.substr(0,1)).compare("/")==0){
newdir = dest.substr(1,dest.length()-1);
/*newdir = "/home/priya"+newdir;
newdir = newdir + "/";
newdir = newdir + dir; */
newdir = home+"/"+newdir+"/"+dir;
char * dirname = new char[newdir.length()+1];
strcpy(dirname, newdir.c_str());
//cout<<dirname;
const int dir_err = mkdir(dirname, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
if (-1 == dir_err)
{
printf("Error creating directory!1");
}
else printf("success");
}
if((dest.substr(0,1)).compare(".")==0){
newdir = dest.substr(1,dest.length()-1);
/*newdir = "/home/priya"+newdir;
newdir = newdir + "/";
newdir = newdir + dir; */
newdir = currdir+"/"+newdir+"/"+dir;
char * dirname = new char[newdir.length()+1];
strcpy(dirname, newdir.c_str());
//cout<<dirname;
const int dir_err = mkdir(dirname, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
if (-1 == dir_err)
{
printf("Error creating directory!1");
}
else printf("success");
}
else{
string ans = dest + "/";
string ans1 = ans + dir;
char * dirname = new char[ans1.length()+1];
strcpy(dirname, ans1.c_str());
//cout<<dirname<<"\n";
const int dir_err = mkdir(dirname, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
if (-1 == dir_err)
{
printf("Error creating directory!2");
}
else printf("success");
}
}
| [
"priya.upadhyay@students.iiit.ac.in"
] | priya.upadhyay@students.iiit.ac.in |
85e408518dd3e6c7a1a734c3d5c8cb68022b3b2d | 4f235fe33bfc43580187b27fe488eccf4162fc33 | /tests/ok/libiconv.cpp | c8b6cd06ddb4154869a0141ba084c642660a628b | [] | no_license | cppan/tests | 405a9239460a441e6405a0a812a98fb889e24796 | 18735da4271f22ee0760d8c473bfbe0e7cf8fce8 | refs/heads/master | 2020-04-18T01:17:36.874469 | 2017-03-23T12:56:31 | 2017-03-23T12:56:31 | 67,119,306 | 1 | 2 | null | 2017-07-04T17:44:24 | 2016-09-01T09:50:26 | C++ | UTF-8 | C++ | false | false | 118 | cpp | /*
dependencies:
- pvt.cppan.demo.gnu.iconv.libiconv
*/
#include <iconv.h>
int main(int argc, char* argv[])
{
}
| [
"egor.pugin@gmail.com"
] | egor.pugin@gmail.com |
245b699dc2aaa5cf85b779ef156055d0c9e610dd | fd15aaab4922ebd09dff21abea8daf86c7a91d9c | /4/char4-9.cpp | d36c7d2cecaa32a276d2827968276ed57782d687 | [] | no_license | zhweiwei/apue | ca2970d80c2cf36b60d3ed773a70a6060b236331 | b719bbf766feb87b3275d7ca1f4784c2626c9997 | refs/heads/master | 2020-03-30T16:23:21.781994 | 2018-10-03T20:05:56 | 2018-10-03T20:05:56 | 151,406,372 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 371 | cpp | #include "apue.h"
#define RWRWRW (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH)
int main(){
umask(0);
if(creat("f00",RWRWRW)< 0){
std::cout << "create f00 file error"<< std::endl;
return -1;
}else{
umask(S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH);
}
if(creat("f11",RWRWRW) <0){
std::cout << "create f11 file error" << std::endl;
return -1;
}
}
| [
"1239218305@qq.com"
] | 1239218305@qq.com |
d97013b0f6eb862ae1e3bccdecd27c966cff7aa5 | d106ecb5f5526d265fd435ed4e1fb02c48a4bed7 | /1. 算法部分/第9章 动态规划/第三节 动态规划经典题/2.演讲大厅安排/hall2.cpp | b05bf6cd19e5522529db66030ed9b10c8ae9e5d4 | [] | no_license | Lucifer-ww/NOIP_ReC | acd53ccd6fc8a845f8fdba87ed12ec6811154d6c | ed20057f68bd7151c9d9e7067290b7cb0e637a9a | refs/heads/main | 2023-01-07T14:52:51.502799 | 2020-11-04T06:32:27 | 2020-11-04T06:32:27 | 309,902,344 | 43 | 19 | null | null | null | null | UTF-8 | C++ | false | false | 591 | cpp | #include<cstdio>
#define MAXN 100000
int next[MAXN],bgn[MAXN],first[MAXN],f[MAXN];
int ans,maxn,tot;
int max(int a,int b)
{
return a>b?a:b;
}
void add_edge(int a,int b)
{
tot++;
next[tot]=first[a];
first[a]=tot;
bgn[tot]=b;
}
int main(void)
{
int n;
scanf("%d",&n);
for (int i=0;i<n;i++)
{
int a,b;
scanf("%d%d",&a,&b);
add_edge(b,a);
maxn=max(maxn,b);
}
for (int i=1;i<=maxn;i++)
{
f[i]=f[i-1];
int k=first[i];
while (k)
{
f[i]=max(f[i],f[bgn[k]]+i-bgn[k]);
k=next[k];
}
}
printf("%d\n",f[maxn]);
return 0;
}
| [
"thomaswang1h@gmail.com"
] | thomaswang1h@gmail.com |
d8c9bb68c7309a10cf89fc96c6259786f8e098f2 | 3b8a94b65010d62ac73caca48c0fed30ddcf34e3 | /nontemplate.cpp | f795d2bfe40610eca8b78d94b23e8cc1b11ae8a8 | [] | no_license | patilkap/Assignment1 | 578d0efa3d517101bea0bb6b05bdc312745b16a7 | f1f8b30b67a1d78763a938452a3447e6ff80e4e6 | refs/heads/master | 2020-03-15T01:14:38.762088 | 2018-05-07T21:44:25 | 2018-05-07T21:44:25 | 131,889,014 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 5,947 | cpp | //NONTEMPLATED VERSION
#include <iostream> // std::ostream, std::cout
namespace Pic10b{
class vector{
private:
double* the_data;
size_t the_size;
size_t the_capacity;
static const int INIT_CAP = 10;
public:
// The big 4
vector();
vector( const vector& );
vector& operator=( const vector& );
~vector();
// Other members [public]
bool empty() const;
size_t size() const;
size_t capacity() const;
double front() const;
double back() const;
double at( size_t index ) const;
double& operator[]( size_t index );
double operator[]( size_t index ) const;
void dump_data_to( std::ostream& out ) const;
void dump_data() const;
void push_back( double new_value );
void pop_back();
private:
//Other members [private]
void reserve( size_t new_capacity );
}; // end Pic10b::vector
/** ************************* THE BIG 4 ************************* **/
vector::vector()
: the_data(nullptr), the_size(0), the_capacity(INIT_CAP) {
the_data = new double[the_capacity];
}
vector::vector( const vector& source )
: the_data(nullptr), the_size(source.the_size),
the_capacity(source.the_capacity) {
the_data = new double[the_capacity];
// Deep copy of internal array
for ( int i = 0 ; i < the_size ; ++i ){
the_data[i] = source.the_data[i];
}
}
vector& vector::operator=( const vector& rhs ) {
if ( this != &rhs ) { // Self-assignment?
// Release old memory and request more
delete[] the_data;
the_data = new double[rhs.the_capacity];
// Shallow copy non-pointers
the_size = rhs.the_size;
the_capacity = rhs.the_capacity;
// Deep copy internal array
for ( int i = 0 ; i < the_size ; ++i )
the_data[i] = rhs.the_data[i];
}
return *this;
}
vector::~vector(){
delete[] the_data;
}
/** *********************** OTHER MEMBERS *********************** **/
bool vector::empty() const {
return the_size == 0;
}
size_t vector::size() const {
return the_size;
}
size_t vector::capacity() const {
return the_capacity;
}
double vector::front() const {
return *the_data;
}
double vector::back() const {
return *(the_data + the_size - 1);
}
double vector::at( size_t index ) const {
if ( index < the_size )
return the_data[index];
return the_data[0];
}
double& vector::operator[]( size_t index ){
return the_data[index];
}
double vector::operator[]( size_t index ) const {
return the_data[index];
}
void vector::dump_data_to( std::ostream& out ) const {
out << "Vector (dump): ";
for ( size_t i = 0 ; i < the_capacity ; ++i )
out << the_data[i] << ' ';
out << '\n';
}
void vector::dump_data() const {
dump_data_to( std::cout );
}
void vector::push_back( double new_value ){
if ( the_size == the_capacity )
reserve( the_capacity + 1 ); // `the_data` is reassigned
the_data[the_size++] = new_value;
}
// This implementation does not shrink the vector (ever)
void vector::pop_back(){
if ( the_size > 0 )
--the_size;
}
void vector::reserve( size_t new_capacity ){
if ( new_capacity > the_capacity ) {
if ( new_capacity <= 2 * the_capacity )
new_capacity = 2 * the_capacity;
double* old_location = the_data;
the_data = new double[new_capacity];
the_capacity = new_capacity;
for ( size_t i = 0 ; i < the_size ; ++i )
the_data[i] = old_location[i];
delete old_location;
}
}
} // end Pic10b namespace
/** ************************ OTHER FUNCTIONS ************************ **/
std::ostream& operator<<( std::ostream& out, const Pic10b::vector& v ){
for ( size_t i = 0 ; i < v.size() ; ++i )
out << v[i] << ' ';
return out;
}
void print_vector( const Pic10b::vector& v ){
if ( v.empty() )
std::cout << "Vector is empty\n";
else
std::cout << "Vector (contents): " << v << '\n' ;
}
/** ************************* THE DRIVER ************************ **/
int main(){
using Pic10b::vector;
using std::cout;
cout << "Create & display empty vector (v1)\n";
vector v1;
print_vector(v1);
v1.dump_data();
int size = 15;
cout << "\nPopulate & display vector with " << size << " entries (v1)\n";
for ( int i = 1 ; i <= size ; ++i )
v1.push_back(i);
print_vector(v1);
cout << "\nCopy non-empty vector, pop back last entry & display (v2)\n";
vector v2(v1);
v2.pop_back();
print_vector(v2);
cout << "\nReassign vector (v1 = v2) & display\n";
v1 = v2;
print_vector(v1);
cout << "\nDump contents of vectors (v1,v2)\n";
v1.dump_data();
v2.dump_data();
return 0;
}
/**
OUTPUT:
Create & display empty vector (v1)
Vector is empty
Vector (dump): 0 0 0 0 0 0 0 0 0 0
Populate & display vector with 15 entries (v1)
Vector (contents): 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
Copy non-empty vector, pop back last entry & display (v2)
Vector (contents): 1 2 3 4 5 6 7 8 9 10 11 12 13 14
Reassign vector (v1 = v2) & display
Vector (contents): 1 2 3 4 5 6 7 8 9 10 11 12 13 14
Dump contents of vectors (v1,v2)
Vector (dump): 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 0 0 0 0 0
Vector (dump): 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 0 0 0 0 0
**/
| [
"noreply@github.com"
] | patilkap.noreply@github.com |
5db92478b1b38aaab19f91c306f64f13068a1bd8 | eb49b8eb7994ff7c7eda8b568072b96cd8bc0c2c | /src/harlequin/DialogManager.hpp | 8985e0a3e5d2e672bc67696862c9ccf0b450c49a | [] | no_license | ProjectAras/TrefusisEngine | a04ade3858955e273f7423296933653cd518887a | 400f6ce5fab8e7ef450d24f0c7631bd1e92dd59b | refs/heads/master | 2022-11-27T23:08:45.021282 | 2020-07-12T00:14:32 | 2020-07-12T00:14:32 | 255,276,072 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 830 | hpp | #ifndef TREFUSISENGINE_DIALOGMANAGER_HPP
#define TREFUSISENGINE_DIALOGMANAGER_HPP
#include <queue>
#include <string>
struct Dialog {
std::string owner;
std::string text;
};
class DialogManager
{
private:
static std::queue<Dialog> dialogs;
static DialogManager* instance;
static bool isInitialised;
static void InitialiseIfNotAlready();
DialogManager();
public:
/**
* Add a dialog to the dialog queue.
* @param dialog dialog object conteining the dialog.
*/
static void addDialog(Dialog dialog);
/**
* Return the next dialog in the dialog queue if there is one.
* @return the next dialog, or if there isn't any, null.
*/
static Dialog nextDialog();
/**
* Check if there are any more dialogs.
*/
static bool hasNextDialog();
};
#endif | [
"egeemirozkan24@gmail.com"
] | egeemirozkan24@gmail.com |
cb6deca0d612af3ae7a63fee8e1fff55d26f9f49 | be48e2c5e5a6a0e25869cf466a87e2da9238a3ae | /Testing/vtkVisualize2DLevelSetImageBaseTest.cxx | 6b5bfd713844b1f7107dc07d55d1ce598cb6f0e5 | [] | no_license | ITKv4-LevelSets/LevelSetVisualization | 22586e741f9c68f0d12c89690372831bdc5bd4b8 | b2cd102fe102f80822ee091979be68cd7f5b6e77 | refs/heads/master | 2021-01-10T19:01:44.015221 | 2011-09-15T19:45:09 | 2011-09-15T19:45:09 | 1,672,140 | 1 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 3,168 | cxx | /*=========================================================================
*
* Copyright Insight Software Consortium
*
* 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.txt
*
* 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 "vtkVisualize2DLevelSetImageBase.h"
#include "itkLevelSetImageBase.h"
#include "itkImage.h"
#include "itkImageRegionIterator.h"
#include "itkImageRegionIteratorWithIndex.h"
template< class TImage >
void GenerateImage( typename TImage::Pointer ioImage )
{
typename TImage::IndexType index;
index.Fill( 0 );
typename TImage::SizeType size;
size.Fill( 50 );
typename TImage::RegionType region;
region.SetIndex( index );
region.SetSize( size );
typedef typename TImage::PixelType PixelType;
ioImage->SetRegions( region );
ioImage->Allocate();
ioImage->FillBuffer( itk::NumericTraits< PixelType >::Zero );
index.Fill( 10 );
region.SetIndex( index );
size.Fill( 30 );
region.SetSize( size );
typename itk::ImageRegionIterator< TImage > it( ioImage, region );
it.GoToBegin();
while( !it.IsAtEnd() )
{
it.Set( itk::NumericTraits< PixelType >::max() );
++it;
}
}
int main( int argc, char* argv[] )
{
typedef unsigned char PixelType;
const unsigned int Dimension = 2;
typedef itk::Image< PixelType, Dimension > ImageType;
ImageType::Pointer image = ImageType::New();
GenerateImage< ImageType >( image );
typedef double LevelSetOutputType;
typedef itk::Image< LevelSetOutputType, Dimension > LevelSetImageType;
typedef itk::LevelSetDenseImageBase< LevelSetImageType > LevelSetType;
LevelSetImageType::Pointer LevelSetImage = LevelSetImageType::New();
GenerateImage< LevelSetImageType >( LevelSetImage );
typedef itk::ImageRegionIteratorWithIndex< LevelSetImageType > IteratorType;
IteratorType it( LevelSetImage, LevelSetImage->GetLargestPossibleRegion() );
it.GoToBegin();
while( !it.IsAtEnd() )
{
LevelSetImageType::IndexType idx = it.GetIndex();
LevelSetOutputType value =
static_cast< LevelSetOutputType >( ( idx[0] - 25 ) * ( idx[0] - 25 ) +
( idx[1] - 25 ) * ( idx[1] - 25 ) );
value = vcl_sqrt( value ) - 20;
it.Set( value );
++it;
}
LevelSetType::Pointer levelset = LevelSetType::New();
levelset->SetImage( LevelSetImage );
typedef vtkVisualize2DLevelSetImageBase< ImageType, LevelSetImageType > VisualizationType;
VisualizationType::Pointer viewer = VisualizationType::New();
viewer->SetInputImage( image );
viewer->SetLevelSet( levelset );
viewer->Update();
return EXIT_SUCCESS;
}
| [
"arnaud_gelas@hms.harvard.edu"
] | arnaud_gelas@hms.harvard.edu |
4a7bfea2e4d21c41297a797fc0e982437b8208a6 | a76fc4b155b155bb59a14a82b5939a30a9f74eca | /Atelier Courrier/JFCControls/JFCTitle.cpp | 1a84d08d4b8c44907c88ce92c11f313c7bca3203 | [] | no_license | isliulin/JFC-Tools | aade33337153d7cc1b5cfcd33744d89fe2d56b79 | 98b715b78ae5c01472ef595b1faa5531f356e794 | refs/heads/master | 2023-06-01T12:10:51.383944 | 2021-06-17T14:41:07 | 2021-06-17T14:41:07 | null | 0 | 0 | null | null | null | null | ISO-8859-1 | C++ | false | false | 4,902 | cpp | // on inclut les défintions nécessaires
#include "stdafx.h"
#include "JFCTitle.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// le constructeur
/////////////////////////////////////////////////////////////////////////////
JFCTitle::JFCTitle()
{
// on ne fait rien
m_crBorderSet = false;
m_CATPColorsApp = CATPColors::COLORCREUSET;
}
/////////////////////////////////////////////////////////////////////////////
// le destructeur
/////////////////////////////////////////////////////////////////////////////
JFCTitle::~JFCTitle()
{
// on ne fait rien
}
BEGIN_MESSAGE_MAP(JFCTitle, JFControl)
//{{AFX_MSG_MAP(JFCTitle)
ON_WM_PAINT()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// la fonction pour dessiner l'élément
/////////////////////////////////////////////////////////////////////////////
void JFCTitle::OnDrawItem(CDC & dc, RECT rect)
{
CString Text;
// on récupère le texte
this->GetWindowText(Text);
// on écrit le texte
if (!Text.IsEmpty()) dc.DrawText(Text, &rect, DT_CENTER | DT_VCENTER | DT_NOPREFIX | DT_SINGLELINE);
}
/////////////////////////////////////////////////////////////////////////////
// JFCTitle message handlers
void JFCTitle::PreSubclassWindow()
{
// on appelle le gestionnaire de base
this->JFControl::PreSubclassWindow();
}
void JFCTitle::OnPaint()
{
RECT ClientRect, BorderRect;
// on récupère la zone cliente
this->GetClientRect(&ClientRect);
// on copie le rectangle
BorderRect = ClientRect;
// on récupère les dimensions à dessiner
LONG Larg = ClientRect.right - ClientRect.left;
LONG Haut = ClientRect.bottom - ClientRect.top;
// on vérifie les dimensions de la fenêtre
if (Larg > 0 && Haut > 0)
{
// on initialise le DC
CPaintDC Dc(this);
// on crée le pinceau
// CBrush BrushA(CATPColors::GetColorDark(m_CATPColorsApp));
//////////////////////////////////////////////////
// TEST COULEUR DEGRADE
/*
CBitmap bm;
bm.LoadBitmap(IDB_BLEU_DARK_DEGRADE);
CBrush BrushA;
BrushA.CreatePatternBrush(&bm);
// on dessine le fond
Dc.FillRect(&ClientRect, &BrushA);
*/
// const int NbGrad = 10;
static COLORREF clr_degrad[CATPColors::m_NbGrad];
CATPColors::GetColorDarkGraduation(m_CATPColorsApp, clr_degrad, CATPColors::m_NbGrad);
CATPColors::FillRectGraduateWithSurround(Dc, ClientRect, clr_degrad, CATPColors::m_NbGrad,CATPColors::STYLE_DEGRAD::FROM_TOP_DEGRAD, m_CATPColorsApp);
// on teste si la taille de la fenêtre est suffisante
if (Haut > 2 && Larg > 2)
{
CFont FontL;
// on corrige le rectangle
ClientRect.left += 1; ClientRect.top += 1; ClientRect.right -= 1; ClientRect.bottom -= 1;
// on crée la fonte
FontL.CreatePointFont(CATPColors::GetFontSizeL(), CATPColors::GetFontName(), &Dc);
// on sélectionne la fonte L
CFont* pOldFont = Dc.SelectObject(&FontL);
// on modifie le mode de transparence
LONG OldBack = Dc.SetBkMode(TRANSPARENT);
// on modifie la couleur du texte
// LONG OldCol = Dc.SetTextColor(CATPColors::GetColorWhite());
LONG OldCol = Dc.SetTextColor(CATPColors::GetColorSuperDark(m_CATPColorsApp));
// on dessine l'élément
this->OnDrawItem(Dc, ClientRect);
// on dessine le bord
if (m_crBorderSet) OnDrawBorder(Dc, BorderRect);
// on restaure la couleur du texte
Dc.SetTextColor(OldCol);
// on restaure la transparence
Dc.SetBkMode(OldBack);
// on restaure la fonte
Dc.SelectObject(pOldFont);
}
}
}
void JFCTitle::SetBorderColor(COLORREF crBorder)
{
m_crBorderSet = true;
m_crBorder = crBorder;
CRect rc;
GetWindowRect(rc);
RedrawWindow();
GetParent()->ScreenToClient(rc);
GetParent()->InvalidateRect(rc, true);
GetParent()->UpdateWindow();
}
/*
void JFCTitle::SetFontName(TCHAR* FontName)
{
this.SetFont(FontName);
}
void JFCTitle::SetBorder(BOOL bSet)
{
}
*/
// la fonction pour indiquer l'application où le controle se place
void JFCTitle::SetAppColor(CATPColors::APPCOLOR AppColor)
{
m_CATPColorsApp = AppColor;
}
void JFCTitle::OnDrawBorder(CDC & dc, RECT rc)
{
CPen pen3Border (PS_SOLID, 0, GetSysColor(COLOR_3DDKSHADOW)); // Border color
CPen pen3HighLight (PS_SOLID, 0, m_crBorder); // High Light
// on dessine les bords haut et gauche en foncé
dc.SelectObject(&pen3Border);
dc.MoveTo(rc.left , rc.bottom - 1);
dc.LineTo(rc.left , rc.top);
dc.LineTo(rc.right - 1 , rc.top);
// on dessine les bords bas et droite en clair
CPen* pOldPen = dc.SelectObject(&pen3HighLight);
dc.MoveTo(rc.left +1 , rc.top + 1);
dc.LineTo(rc.right - 1 , rc.top + 1);
dc.LineTo(rc.right - 1 , rc.bottom - 1);
dc.LineTo(rc.left +1 , rc.bottom - 1);
dc.LineTo(rc.left +1 , rc.top + 1);
dc.SelectObject(pOldPen);
} | [
"alain.chambard@kantarmedia.com"
] | alain.chambard@kantarmedia.com |
2c6ee10891d9716d623cfe1d67c700841db58db4 | 02099155d15b3d65330abc7276b13c8deff68e94 | /A/A. Panoramix's Prediction/main.cpp | cf0f3ea353ad564775151b61f23bd354238b9f7d | [] | no_license | xUser5000/competitive-programming | d7c760fa6db58956e472dd80e24def0358bbb5a8 | 90337c982dd3663a69f2d19021e692f1edb1b3a5 | refs/heads/master | 2023-06-26T21:56:02.452867 | 2021-07-23T22:39:49 | 2021-07-23T22:39:49 | 288,557,139 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 518 | cpp | #include <iostream>
#include <vector>
using namespace std;
int main()
{
int n, m; cin >> n >> m;
vector<int> vc;
for (int i = 2; i <= 50; i++) {
bool f = false;
for (int j = 0; j < vc.size(); j++) {
if (i % vc[j] == 0) f = true;
}
if (!f) vc.push_back(i);
}
for (int i = 0; i < vc.size(); i++) {
if (vc[i] == n && vc[i + 1] != m) {
cout << "NO";
return 0;
}
}
cout << "YES";
return 0;
}
| [
"abdallahar1974@gmail.com"
] | abdallahar1974@gmail.com |
bb479f5ce512679c4cc23951c03097c865248d4d | 0e42587e8fac434a0565a13851cb338ca1103120 | /Noise.hpp | eeafa91abb5f4a6d04280fbc99fe15c2812dd87c | [] | no_license | returnEdo/Minecrap | b4adb5b298369a76a79424775b3e3da2fa72c26d | cc5a0153d5a0ba0ffefa3bbf867c361c3bf99d89 | refs/heads/main | 2023-09-04T12:40:48.022129 | 2021-10-13T13:37:29 | 2021-10-13T13:37:29 | 416,757,592 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 810 | hpp | #pragma once
#include <cstdint>
#include <vector>
#include <array>
#include "INoise.hpp"
namespace Noise
{
struct NoiseSetup
{
uint32_t m_octaveCount { 4 };
float m_damping { 0.5f };
int32_t m_seed { 123456 };
float m_periodCountx { 10 };
float m_periodCounty { 10 };
};
class CubicNoise: public INoise
{
private:
NoiseSetup m_setup;
std::vector<float> m_weights;
static const int32_t C_RAND_A = 134775813;
static const int32_t C_RAND_B = 1103515245;
float interpolate(float a, float b, float c, float d, float t_alpha);
public:
CubicNoise(NoiseSetup t_noiseSetup);
virtual ~CubicNoise(void) {}
float getRandomf(int32_t x, int32_t y);
float sampleOctave(float t_x, float t_y, uint32_t tOctave);
virtual float sample(float x, float y, float t_z) override;
};
}
| [
"fraccaroedo@gmail.com"
] | fraccaroedo@gmail.com |
d049e548d61d3d27ae36bc513807c7c71a61f4f3 | 7c3cf1e21c2430778a119c6f8125a4ad7ba57cbe | /Engine/Engine/MenuStuff/TableEntry/EntryTextBox.hpp | e125f272d59ff1ede5ccafedc2c0c015c653429e | [
"MIT"
] | permissive | yougren/Engine | f7d2c9144463268e5b10421bdace91923bce30dd | 154b8fd5bb419a751031eaad4235cd8f18063161 | refs/heads/master | 2021-06-06T18:24:04.755690 | 2016-04-21T21:24:26 | 2016-04-21T21:24:26 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,310 | hpp | #pragma once
#include <SFML/Graphics.hpp>
#include "..\..\Utility\Utilities.hpp"
#include <iostream>
#include "..\SingleTextBox.hpp"
#include "..\MenuSprite.hpp"
class EntryTextBox : public MenuElement
{
public:
EntryTextBox();
EntryTextBox( sf::Font * const ffont, const unsigned int& ffontsize, const sf::Color &fcolor,
sf::Texture* const bgTex, const sf::Vector2f& bgSiz, sf::Texture * const barTex, const sf::Vector2f& fpos, const double& indent
);
~EntryTextBox();
void setup( sf::Font * const ffont, const unsigned int& ffontsize, const sf::Color &fcolor,
sf::Texture* const bgTex, const sf::Vector2f& bgSiz, sf::Texture * const barTex, const sf::Vector2f& fpos, const double& indent
);
void setEntryString(std::string& estr);
void setActivity(bool b);
bool getActivity();
//std::string getEntryString();
void update() {};
void update(InputData& inpData);
void draw(sf::RenderWindow& window, const sf::Vector2f& drawPos);
void resetMD() {};
private:
void buildEntryString(InputData& inpData);
void setActivity(InputData& inpData);
void setBarPos();
//bool isDif(const char& typedChar, const unsigned int& i);
sf::Vector2f lastDrawPos;
std::string* entryString;
SingleTextBox textBox;
MenuSprite textBar;
MenuSprite background;
bool isActive;
};
| [
"riley.d.waugh@gmail.com"
] | riley.d.waugh@gmail.com |
bcbdb5660fce3c647f01ac145e0484184565d92a | 58d7c7d0552bcb34e320283c2c0ddcae3444c38f | /project/Tom And Jerry/Position.h | 989ecb34f4a14aa3730136b972f80c70fedff490 | [] | no_license | DarkoDanchev/Data_Structures | 120d5170d66b46fb3bde72840fe48c693fed90a7 | 48d106e8c3cb80f3a78b77690471adb0c1e0233f | refs/heads/master | 2021-01-18T22:13:19.725561 | 2017-02-10T19:01:48 | 2017-02-10T19:01:48 | 72,298,590 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 663 | h | #pragma once
#include "Furniture.h"
using namespace std;
class Position
{
private:
int x,y;
Furniture furniture;
bool paintable;
public:
Position();
Position(int x,int y);
Position(int x,int y,Furniture);
Position(int x,int y,Furniture,bool);
void setPaintable(bool);
void setFurniture(Furniture furniture);
bool isPaintable() const;
Position(const Position&);
Position& operator=(const Position&);
bool isAvalible() const;
bool operator==(const Position&) const;
int getX() const;
int getY() const;
void setX(int);
void setY(int);
Furniture getFurniture() const;
~Position();
};
| [
"dancevdarko@gmail.com"
] | dancevdarko@gmail.com |
91be64827639f8bbba0d9d43cb2a446f1484fef8 | 786de89be635eb21295070a6a3452f3a7fe6712c | /pypdsdata/tags/V00-00-19/pyext/types/cspad/ConfigV2.cpp | 3a9bbf0349c0f754922b3601cfdf55f45f4bea37 | [] | no_license | connectthefuture/psdmrepo | 85267cfe8d54564f99e17035efe931077c8f7a37 | f32870a987a7493e7bf0f0a5c1712a5a030ef199 | refs/heads/master | 2021-01-13T03:26:35.494026 | 2015-09-03T22:22:11 | 2015-09-03T22:22:11 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 8,189 | cpp | //--------------------------------------------------------------------------
// File and Version Information:
// $Id$
//
// Description:
// Class ConfigV2...
//
// Author List:
// Andrei Salnikov
//
//------------------------------------------------------------------------
#include "SITConfig/SITConfig.h"
//-----------------------
// This Class's Header --
//-----------------------
#include "ConfigV2.h"
//-----------------
// C/C++ Headers --
//-----------------
#include <sstream>
//-------------------------------
// Collaborating Class Headers --
//-------------------------------
#include "ConfigV1QuadReg.h"
#include "../../EnumType.h"
#include "../../Exception.h"
#include "../TypeLib.h"
//-----------------------------------------------------------------------
// Local Macros, Typedefs, Structures, Unions and Forward Declarations --
//-----------------------------------------------------------------------
namespace {
pypdsdata::EnumType::Enum runModesEnumValues[] = {
{ "NoRunning", Pds::CsPad::NoRunning },
{ "RunButDrop", Pds::CsPad::RunButDrop },
{ "RunAndSendToRCE", Pds::CsPad::RunAndSendToRCE },
{ "RunAndSendTriggeredByTTL", Pds::CsPad::RunAndSendTriggeredByTTL },
{ "ExternalTriggerSendToRCE", Pds::CsPad::ExternalTriggerSendToRCE },
{ "ExternalTriggerDrop", Pds::CsPad::ExternalTriggerDrop },
{ "NumberOfRunModes", Pds::CsPad::NumberOfRunModes },
{ 0, 0 }
};
pypdsdata::EnumType runModesEnum ( "RunModes", runModesEnumValues );
// methods
PyObject* quads( PyObject* self, PyObject* );
PyObject* numQuads( PyObject* self, PyObject* );
PyObject* roiMask( PyObject* self, PyObject* args);
PyObject* numAsicsStored( PyObject* self, PyObject* args);
PyObject* sections( PyObject* self, PyObject* args);
FUN0_WRAPPER(pypdsdata::CsPad::ConfigV2, tdi)
FUN0_WRAPPER(pypdsdata::CsPad::ConfigV2, quadMask)
FUN0_WRAPPER(pypdsdata::CsPad::ConfigV2, runDelay)
FUN0_WRAPPER(pypdsdata::CsPad::ConfigV2, eventCode)
ENUM_FUN0_WRAPPER(pypdsdata::CsPad::ConfigV2, inactiveRunMode, runModesEnum)
ENUM_FUN0_WRAPPER(pypdsdata::CsPad::ConfigV2, activeRunMode, runModesEnum)
FUN0_WRAPPER(pypdsdata::CsPad::ConfigV2, payloadSize)
FUN0_WRAPPER(pypdsdata::CsPad::ConfigV2, badAsicMask0)
FUN0_WRAPPER(pypdsdata::CsPad::ConfigV2, badAsicMask1)
FUN0_WRAPPER(pypdsdata::CsPad::ConfigV2, asicMask)
FUN0_WRAPPER(pypdsdata::CsPad::ConfigV2, numAsicsRead)
FUN0_WRAPPER(pypdsdata::CsPad::ConfigV2, concentratorVersion)
PyObject* _repr( PyObject *self );
PyMethodDef methods[] = {
{"quads", quads, METH_NOARGS, "" },
{"numQuads", numQuads, METH_NOARGS, "" },
{"tdi", tdi, METH_NOARGS, "" },
{"quadMask", quadMask, METH_NOARGS, "" },
{"runDelay", runDelay, METH_NOARGS, "" },
{"eventCode", eventCode, METH_NOARGS, "" },
{"inactiveRunMode", inactiveRunMode, METH_NOARGS, "" },
{"activeRunMode", activeRunMode, METH_NOARGS, "" },
{"payloadSize", payloadSize, METH_NOARGS, "" },
{"badAsicMask0", badAsicMask0, METH_NOARGS, "" },
{"badAsicMask1", badAsicMask1, METH_NOARGS, "" },
{"asicMask", asicMask, METH_NOARGS, "" },
{"roiMask", roiMask, METH_VARARGS, "" },
{"numAsicsRead", numAsicsRead, METH_NOARGS, "" },
{"numAsicsStored", numAsicsStored, METH_VARARGS, "" },
{"concentratorVersion", concentratorVersion, METH_NOARGS, "" },
{"sections", sections, METH_VARARGS, "list of sections read for a given quadrant number" },
{0, 0, 0, 0}
};
char typedoc[] = "Python class wrapping C++ Pds::CsPad::ConfigV2 class.";
}
// ----------------------------------------
// -- Public Function Member Definitions --
// ----------------------------------------
void
pypdsdata::CsPad::ConfigV2::initType( PyObject* module )
{
PyTypeObject* type = BaseType::typeObject() ;
type->tp_doc = ::typedoc;
type->tp_methods = ::methods;
type->tp_str = _repr;
type->tp_repr = _repr;
// define class attributes for enums
type->tp_dict = PyDict_New();
PyDict_SetItemString( type->tp_dict, "RunModes", runModesEnum.type() );
PyObject* val = PyInt_FromLong(Pds::CsPad::MaxQuadsPerSensor);
PyDict_SetItemString( type->tp_dict, "MaxQuadsPerSensor", val );
Py_XDECREF(val);
BaseType::initType( "ConfigV2", module );
}
namespace {
PyObject*
quads( PyObject* self, PyObject* )
{
Pds::CsPad::ConfigV2* obj = pypdsdata::CsPad::ConfigV2::pdsObject( self );
if ( not obj ) return 0;
PyObject* list = PyList_New( Pds::CsPad::MaxQuadsPerSensor );
Pds::CsPad::ConfigV1QuadReg* quads = obj->quads();
for ( unsigned i = 0 ; i < Pds::CsPad::MaxQuadsPerSensor ; ++ i ) {
PyObject* q = pypdsdata::CsPad::ConfigV1QuadReg::PyObject_FromPds(
&quads[i], self, sizeof(Pds::CsPad::ConfigV1QuadReg) );
PyList_SET_ITEM( list, i, q );
}
return list;
}
PyObject*
numQuads( PyObject* self, PyObject* )
{
const Pds::CsPad::ConfigV2* obj = pypdsdata::CsPad::ConfigV2::pdsObject( self );
if ( not obj ) return 0;
unsigned count = 0 ;
unsigned mask = obj->quadMask();
for ( unsigned i = Pds::CsPad::MaxQuadsPerSensor ; i ; -- i ) {
if ( mask & 1 ) ++ count ;
mask >>= 1 ;
}
return PyInt_FromLong(count);
}
PyObject*
roiMask( PyObject* self, PyObject* args )
{
const Pds::CsPad::ConfigV2* obj = pypdsdata::CsPad::ConfigV2::pdsObject( self );
if ( not obj ) return 0;
// parse args
unsigned q ;
if ( not PyArg_ParseTuple( args, "I:cspad.ConfigV2.roiMask", &q ) ) return 0;
if ( q >= Pds::CsPad::MaxQuadsPerSensor ) {
PyErr_SetString(PyExc_IndexError, "index outside of range [0..MaxQuadsPerSensor) in cspad.ConfigV2.roiMask()");
return 0;
}
return PyInt_FromLong( obj->roiMask(q) );
}
PyObject*
numAsicsStored( PyObject* self, PyObject* args )
{
const Pds::CsPad::ConfigV2* obj = pypdsdata::CsPad::ConfigV2::pdsObject( self );
if ( not obj ) return 0;
// parse args
unsigned q ;
if ( not PyArg_ParseTuple( args, "I:cspad.ConfigV2.numAsicsStored", &q ) ) return 0;
if ( q >= Pds::CsPad::MaxQuadsPerSensor ) {
PyErr_SetString(PyExc_IndexError, "index outside of range [0..MaxQuadsPerSensor) in cspad.ConfigV2.numAsicsStored()");
return 0;
}
return PyInt_FromLong( obj->numAsicsStored(q) );
}
PyObject*
sections( PyObject* self, PyObject* args )
{
const Pds::CsPad::ConfigV2* obj = pypdsdata::CsPad::ConfigV2::pdsObject( self );
if ( not obj ) return 0;
// parse args
unsigned q ;
if ( not PyArg_ParseTuple( args, "I:cspad.ConfigV2.sections", &q ) ) return 0;
if ( q >= Pds::CsPad::MaxQuadsPerSensor ) {
PyErr_SetString(PyExc_IndexError, "index outside of range [0..MaxQuadsPerSensor) in cspad.ConfigV2.sections()");
return 0;
}
unsigned mask = obj->roiMask(q);
unsigned count = 0;
for ( unsigned i = 0 ; i < sizeof(mask)*8 ; ++ i ) {
if (mask & (1<<i)) ++ count;
}
PyObject* list = PyList_New( count );
unsigned ic = 0 ;
for ( unsigned i = 0 ; i < sizeof(mask)*8 ; ++ i ) {
if (mask & (1<<i)) {
PyList_SET_ITEM( list, ic++, pypdsdata::TypeLib::toPython(i) );
}
}
return list;
}
PyObject*
_repr( PyObject *self )
{
Pds::CsPad::ConfigV2* obj = pypdsdata::CsPad::ConfigV2::pdsObject(self);
if(not obj) return 0;
std::ostringstream str;
str << "cspad.ConfigV2(quadMask=" << obj->quadMask()
<< ", eventCode=" << obj->eventCode()
<< ", asicMask=" << obj->asicMask()
<< ", numAsicsRead=" << obj->numAsicsRead();
str << ", numAsicsStored=[";
for (int q = 0; q < 4; ++ q ) {
if (q) str << ", ";
str << obj->numAsicsStored(q);
}
str << "]";
str << ", roiMask=[";
for (int q = 0; q < 4; ++ q ) {
if (q) str << ", ";
str << obj->roiMask(q);
}
str << "]";
str << ")";
return PyString_FromString( str.str().c_str() );
}
}
| [
"salnikov@b967ad99-d558-0410-b138-e0f6c56caec7"
] | salnikov@b967ad99-d558-0410-b138-e0f6c56caec7 |
7cd48de8ad2b36ca190e7dc1fcb2ef1a9d2e9539 | a5b13fc4bb25b1418296b540ca1f5d272fba8926 | /while_and_for/8.cpp | 1901affa0dc0da79b075b38829b5cf12690465cc | [] | no_license | M2nzy/C | da1e0517820ed34171112e02d1cd7372e478e23e | c8b8d8d44c47c9c2ac98d373f7e5f38013e17c38 | refs/heads/master | 2021-04-06T21:29:35.711180 | 2018-03-29T12:40:04 | 2018-03-29T12:40:04 | 125,405,308 | 0 | 0 | null | null | null | null | UHC | C++ | false | false | 323 | cpp | #include <stdio.h>
void main()
{
int n,i,j;
while (1) {
printf("1 ~ 26 정수 입력 : ");
scanf_s("%d", &n);
if (1 <= n && n <= 26) {
for (i = 1; i <= n; i++)
{
for (j = 0; j < i; j++)
printf("%c ", 'A' + j);
printf("\n");
}
break;
}
else
printf("다시 입력하세요.\n");
}
} | [
"yequrz@naver.com"
] | yequrz@naver.com |
06df508ef9f454b27af7e221123348140d61e628 | e0fd392395cfb9c4651ce2eb46f25f62193b46d4 | /test/cxx/Core/UnionStationTest.cpp | 55a10778be32138c62007db5e014f15a0fdee141 | [
"MIT"
] | permissive | nelyj/passenger | fcc51d668c72003db7f719efc779855b2ba15aec | ce8138442e74acc83c4fa996c52692ea57d61bc6 | refs/heads/master | 2021-05-31T18:02:36.532786 | 2016-06-17T17:47:09 | 2016-06-17T18:07:09 | 61,965,975 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 16,852 | cpp | #include <TestSupport.h>
#include <Core/UnionStation/Context.h>
#include <Core/UnionStation/Transaction.h>
#include <MessageClient.h>
#include <UstRouter/Controller.h>
#include <Utils/MessageIO.h>
#include <Utils/ScopeGuard.h>
#include <boost/bind.hpp>
#include <boost/shared_ptr.hpp>
#include <oxt/thread.hpp>
#include <set>
using namespace Passenger;
using namespace Passenger::UnionStation;
using namespace std;
using namespace oxt;
namespace tut {
struct Core_UnionStationTest {
static const unsigned long long YESTERDAY = 1263299017000000ull; // January 12, 2009, 12:23:37 UTC
static const unsigned long long TODAY = 1263385422000000ull; // January 13, 2009, 12:23:42 UTC
static const unsigned long long TOMORROW = 1263471822000000ull; // January 14, 2009, 12:23:42 UTC
#define TODAY_TXN_ID "cjb8n-abcd"
#define TODAY_TIMESTAMP_STR "cftz90m3k0"
boost::shared_ptr<BackgroundEventLoop> bg;
boost::shared_ptr<ServerKit::Context> skContext;
TempDir tmpdir;
string socketFilename;
string socketAddress;
FileDescriptor serverFd;
VariantMap controllerOptions;
boost::shared_ptr<UstRouter::Controller> controller;
ContextPtr context, context2, context3, context4;
Core_UnionStationTest()
: tmpdir("tmp.union_station")
{
socketFilename = tmpdir.getPath() + "/socket";
socketAddress = "unix:" + socketFilename;
setLogLevel(LVL_ERROR);
controllerOptions.set("ust_router_username", "test");
controllerOptions.set("ust_router_password", "1234");
controllerOptions.setBool("ust_router_dev_mode", true);
controllerOptions.set("ust_router_dump_dir", tmpdir.getPath());
context = boost::make_shared<Context>(socketAddress, "test", "1234",
"localhost");
context2 = boost::make_shared<Context>(socketAddress, "test", "1234",
"localhost");
context3 = boost::make_shared<Context>(socketAddress, "test", "1234",
"localhost");
context4 = boost::make_shared<Context>(socketAddress, "test", "1234",
"localhost");
}
~Core_UnionStationTest() {
// Silence error disconnection messages during shutdown.
setLogLevel(LVL_CRIT);
shutdown();
SystemTime::releaseAll();
setLogLevel(DEFAULT_LOG_LEVEL);
}
void init() {
bg = boost::make_shared<BackgroundEventLoop>(false, true);
skContext = boost::make_shared<ServerKit::Context>(bg->safe, bg->libuv_loop);
serverFd.assign(createUnixServer(socketFilename.c_str(), 0, true, __FILE__, __LINE__), NULL, 0);
controller = boost::make_shared<UstRouter::Controller>(skContext.get(), controllerOptions);
controller->listen(serverFd);
bg->start();
}
void shutdown() {
if (bg != NULL) {
bg->safe->runSync(boost::bind(&UstRouter::Controller::shutdown, controller.get(), true));
while (getControllerState() != UstRouter::Controller::FINISHED_SHUTDOWN) {
syscalls::usleep(1000000);
}
bg->safe->runSync(boost::bind(&Core_UnionStationTest::destroyController,
this));
bg->stop();
bg.reset();
skContext.reset();
serverFd.close();
}
}
void destroyController() {
controller.reset();
}
UstRouter::Controller::State getControllerState() {
UstRouter::Controller::State result;
bg->safe->runSync(boost::bind(&Core_UnionStationTest::_getControllerState,
this, &result));
return result;
}
void _getControllerState(UstRouter::Controller::State *state) {
*state = controller->serverState;
}
string timestampString(unsigned long long timestamp) {
char str[2 * sizeof(unsigned long long) + 1];
integerToHexatri<unsigned long long>(timestamp, str);
return str;
}
MessageClient createConnection(bool sendInitCommand = true) {
MessageClient client;
vector<string> args;
client.connect(socketAddress, "test", "1234");
if (sendInitCommand) {
client.write("init", "localhost", NULL);
client.read(args);
}
return client;
}
void waitForDumpFile(const string &category = "requests") {
EVENTUALLY(5,
result = fileExists(getDumpFilePath(category));
);
}
string readDumpFile(const string &category = "requests") {
waitForDumpFile(category);
return readAll(getDumpFilePath(category));
}
string getDumpFilePath(const string &category = "requests") {
return tmpdir.getPath() + "/" + category;
}
void ensureSubstringInDumpFile(const string &substr, const string &category = "requests") {
EVENTUALLY(5,
result = readDumpFile().find(substr) != string::npos;
);
}
void ensureSubstringNotInDumpFile(const string &substr, const string &category = "requests") {
string path = getDumpFilePath(category);
SHOULD_NEVER_HAPPEN(100,
result = fileExists(path) && readAll(path).find(substr) != string::npos;
);
}
};
DEFINE_TEST_GROUP(Core_UnionStationTest);
/***** Basic logging tests *****/
TEST_METHOD(1) {
set_test_name("Logging to new transaction");
init();
SystemTime::forceAll(YESTERDAY);
TransactionPtr log = context->newTransaction("foobar");
log->message("hello");
log->message("world");
ensure(!context->isNull());
ensure(!log->isNull());
log.reset();
ensureSubstringInDumpFile("hello\n");
ensureSubstringInDumpFile("world\n");
}
TEST_METHOD(2) {
set_test_name("Logging to continued transaction");
init();
SystemTime::forceAll(YESTERDAY);
TransactionPtr log = context->newTransaction("foobar");
log->message("message 1");
TransactionPtr log2 = context2->continueTransaction(log->getTxnId(),
log->getGroupName(), log->getCategory());
log2->message("message 2");
log.reset();
log2.reset();
ensureSubstringInDumpFile("message 1\n");
ensureSubstringInDumpFile("message 2\n");
}
TEST_METHOD(3) {
set_test_name("Logging with different points in time");
init();
SystemTime::forceAll(YESTERDAY);
TransactionPtr log = context->newTransaction("foobar");
log->message("message 1");
SystemTime::forceAll(TODAY);
log->message("message 2");
SystemTime::forceAll(TOMORROW);
TransactionPtr log2 = context2->continueTransaction(log->getTxnId(),
log->getGroupName(), log->getCategory());
log2->message("message 3");
TransactionPtr log3 = context3->newTransaction("foobar");
log3->message("message 4");
log.reset();
log2.reset();
log3.reset();
ensureSubstringInDumpFile(timestampString(YESTERDAY) + " 1 message 1\n");
ensureSubstringInDumpFile(timestampString(TODAY) + " 2 message 2\n");
ensureSubstringInDumpFile(timestampString(TOMORROW) + " 4 message 3\n");
ensureSubstringInDumpFile(timestampString(TOMORROW) + " 1 message 4\n");
}
TEST_METHOD(4) {
set_test_name("newTransaction() and continueTransaction() log an ATTACH message, "
"while destroying a Transaction logs a DETACH message");
init();
SystemTime::forceAll(YESTERDAY);
TransactionPtr log = context->newTransaction("foobar");
SystemTime::forceAll(TODAY);
TransactionPtr log2 = context2->continueTransaction(log->getTxnId(),
log->getGroupName(), log->getCategory());
log2.reset();
SystemTime::forceAll(TOMORROW);
log.reset();
ensureSubstringInDumpFile(timestampString(YESTERDAY) + " 0 ATTACH\n");
ensureSubstringInDumpFile(timestampString(TODAY) + " 1 ATTACH\n");
ensureSubstringInDumpFile(timestampString(TODAY) + " 2 DETACH\n");
ensureSubstringInDumpFile(timestampString(TOMORROW) + " 3 DETACH\n");
}
TEST_METHOD(5) {
set_test_name("newTransaction() generates a new ID, while "
"continueTransaction() reuses the ID");
init();
TransactionPtr log = context->newTransaction("foobar");
TransactionPtr log2 = context2->newTransaction("foobar");
TransactionPtr log3 = context3->continueTransaction(log->getTxnId(),
log->getGroupName(), log->getCategory());
TransactionPtr log4 = context4->continueTransaction(log2->getTxnId(),
log2->getGroupName(), log2->getCategory());
ensure_equals(log->getTxnId(), log3->getTxnId());
ensure_equals(log2->getTxnId(), log4->getTxnId());
ensure(log->getTxnId() != log2->getTxnId());
}
TEST_METHOD(6) {
set_test_name("An empty Transaction doesn't do anything");
init();
{
UnionStation::Transaction log;
ensure(log.isNull());
log.message("hello world");
}
SHOULD_NEVER_HAPPEN(100,
result = fileExists(getDumpFilePath());
);
}
TEST_METHOD(7) {
set_test_name("An empty Context doesn't do anything");
UnionStation::Context context;
init();
ensure(context.isNull());
TransactionPtr log = context.newTransaction("foo");
ensure(log->isNull());
log->message("hello world");
log.reset();
SHOULD_NEVER_HAPPEN(100,
result = fileExists(getDumpFilePath());
);
}
/***** Connection handling *****/
TEST_METHOD(11) {
set_test_name("newTransaction() does not reconnect to the server for a short"
" period of time if connecting failed");
init();
context->setReconnectTimeout(60 * 1000000);
SystemTime::forceAll(TODAY);
shutdown();
ensure(context->newTransaction("foobar")->isNull());
SystemTime::forceAll(TODAY + 30 * 1000000);
init();
ensure(context->newTransaction("foobar")->isNull());
SystemTime::forceAll(TODAY + 61 * 1000000);
ensure(!context->newTransaction("foobar")->isNull());
}
TEST_METHOD(12) {
set_test_name("If the UstRouter crashed and was restarted then"
" newTransaction() and continueTransaction() print a warning and return"
" a null log object. One of the next newTransaction()/continueTransaction()"
" calls will reestablish the connection when the connection timeout"
" has passed");
init();
SystemTime::forceAll(TODAY);
TransactionPtr log, log2;
log = context->newTransaction("foobar");
context2->continueTransaction(log->getTxnId(), "foobar");
log.reset(); // Check connection back into the pool.
shutdown();
init();
log = context->newTransaction("foobar");
ensure("(1)", log->isNull());
log2 = context2->continueTransaction("some-id", "foobar");
ensure("(2)", log2->isNull());
SystemTime::forceAll(TODAY + 60000000);
log = context->newTransaction("foobar");
ensure("(3)", !log->isNull());
log2 = context2->continueTransaction(log->getTxnId(), "foobar");
ensure("(4)", !log2->isNull());
log2->message("hello");
log.reset();
log2.reset();
ensureSubstringInDumpFile("hello\n");
}
TEST_METHOD(13) {
set_test_name("continueTransaction() does not reconnect to the server for a short"
" period of time if connecting failed");
init();
context->setReconnectTimeout(60 * 1000000);
context2->setReconnectTimeout(60 * 1000000);
SystemTime::forceAll(TODAY);
TransactionPtr log = context->newTransaction("foobar");
ensure("(1)", !log->isNull());
ensure("(2)", !context2->continueTransaction(log->getTxnId(), "foobar")->isNull());
shutdown();
ensure("(3)", context2->continueTransaction(log->getTxnId(), "foobar")->isNull());
SystemTime::forceAll(TODAY + 30 * 1000000);
init();
ensure("(3)", context2->continueTransaction(log->getTxnId(), "foobar")->isNull());
SystemTime::forceAll(TODAY + 61 * 1000000);
ensure("(4)", !context2->continueTransaction(log->getTxnId(), "foobar")->isNull());
}
TEST_METHOD(14) {
set_test_name("If a client disconnects from the UstRouter then all its"
" transactions that are no longer referenced and have crash protection enabled"
" will be closed and written to the sink");
init();
MessageClient client1 = createConnection();
MessageClient client2 = createConnection();
vector<string> args;
SystemTime::forceAll(TODAY);
// Create a new transaction
client1.write("openTransaction",
TODAY_TXN_ID, "foobar", "", "requests", TODAY_TIMESTAMP_STR,
"-", "true", "true", NULL);
client1.read(args);
// Continue previous transaction, log data to it, disconnect without closing it
client2.write("openTransaction",
TODAY_TXN_ID, "foobar", "", "requests", TODAY_TIMESTAMP_STR,
"-", "true", NULL);
client2.write("log", TODAY_TXN_ID, "1000", NULL);
client2.writeScalar("hello world");
client2.write("ping", NULL);
client2.read(args);
client2.disconnect();
// The transaction still has one reference open, so should not yet be flushed yet
SHOULD_NEVER_HAPPEN(100,
result = fileExists(getDumpFilePath());
);
client1.disconnect();
ensureSubstringInDumpFile("hello world");
}
TEST_METHOD(15) {
set_test_name("If a client disconnects from the UstRouter then all its"
" transactions that are no longer referenced and don't have crash"
" protection enabled will be closed and discarded");
init();
MessageClient client1 = createConnection();
MessageClient client2 = createConnection();
vector<string> args;
SystemTime::forceAll(TODAY);
// Open new transaction with crash protection disabled
client1.write("openTransaction",
TODAY_TXN_ID, "foobar", "", "requests", TODAY_TIMESTAMP_STR,
"-", "false", "true", NULL);
client1.read(args);
// Continue previous transaction, then disconnect without closing it
client2.write("openTransaction",
TODAY_TXN_ID, "foobar", "", "requests", TODAY_TIMESTAMP_STR,
"-", "false", "true", NULL);
client2.read(args);
client2.disconnect();
// Disconnect client 1 too. Now all references to the transaction are gone
client1.disconnect();
SHOULD_NEVER_HAPPEN(100,
result = fileExists(getDumpFilePath());
);
}
/***** Shutdown behavior *****/
TEST_METHOD(16) {
set_test_name("Upon server shutdown, all transaction that have crash protection "
" enabled will be closed and written to the sink");
init();
MessageClient client1 = createConnection();
MessageClient client2 = createConnection();
vector<string> args;
SystemTime::forceAll(TODAY);
client1.write("openTransaction",
TODAY_TXN_ID, "foobar", "", "requests", TODAY_TIMESTAMP_STR,
"-", "true", NULL);
client1.write("log", TODAY_TXN_ID, "1000", NULL);
client1.writeScalar("hello");
client1.write("ping", NULL);
client1.read(args);
client2.write("openTransaction",
TODAY_TXN_ID, "foobar", "", "requests", TODAY_TIMESTAMP_STR,
"-", "true", NULL);
client2.write("log", TODAY_TXN_ID, "1000", NULL);
client2.writeScalar("world");
client2.write("ping", NULL);
client2.read(args);
shutdown();
ensureSubstringInDumpFile("hello");
ensureSubstringInDumpFile("world");
}
TEST_METHOD(17) {
set_test_name("Upon server shutdown, all transaction that don't have crash"
" protection enabled will be discarded");
init();
MessageClient client1 = createConnection();
MessageClient client2 = createConnection();
vector<string> args;
SystemTime::forceAll(TODAY);
client1.write("openTransaction",
TODAY_TXN_ID, "foobar", "", "requests", TODAY_TIMESTAMP_STR,
"-", "false", NULL);
client1.write("log", TODAY_TXN_ID, "1000", NULL);
client1.writeScalar("hello");
client1.write("ping", NULL);
client1.read(args);
client2.write("openTransaction",
TODAY_TXN_ID, "foobar", "", "requests", TODAY_TIMESTAMP_STR,
"-", "false", NULL);
client2.write("log", TODAY_TXN_ID, "1000", NULL);
client2.writeScalar("world");
client2.write("ping", NULL);
client2.read(args);
shutdown();
SHOULD_NEVER_HAPPEN(100,
result = fileExists(getDumpFilePath());
);
}
/***** Miscellaneous *****/
TEST_METHOD(20) {
set_test_name("A transaction's data is not written out by the server"
" until the transaction is fully closed");
init();
SystemTime::forceAll(YESTERDAY);
vector<string> args;
TransactionPtr log = context->newTransaction("foobar");
log->message("hello world");
TransactionPtr log2 = context2->continueTransaction(log->getTxnId(),
log->getGroupName(), log->getCategory());
log2->message("message 2");
log2.reset();
SHOULD_NEVER_HAPPEN(100,
result = fileExists(getDumpFilePath());
);
}
TEST_METHOD(21) {
set_test_name("One can supply a custom node name per openTransaction command");
init();
MessageClient client1 = createConnection();
vector<string> args;
SystemTime::forceAll(TODAY);
client1.write("openTransaction",
TODAY_TXN_ID, "foobar", "remote", "requests", TODAY_TIMESTAMP_STR,
"-", "true", NULL);
client1.write("closeTransaction", TODAY_TXN_ID, TODAY_TIMESTAMP_STR, NULL);
client1.disconnect();
waitForDumpFile();
}
TEST_METHOD(22) {
set_test_name("A transaction is only written to the sink if it passes all given filters");
init();
SystemTime::forceAll(YESTERDAY);
TransactionPtr log = context->newTransaction("foobar", "requests", "-",
"uri == \"/foo\""
"\1"
"uri != \"/bar\"");
log->message("URI: /foo");
log->message("transaction 1");
log.reset();
log = context->newTransaction("foobar", "requests", "-",
"uri == \"/foo\""
"\1"
"uri == \"/bar\"");
log->message("URI: /foo");
log->message("transaction 2");
log.reset();
ensureSubstringInDumpFile("transaction 1\n");
ensureSubstringNotInDumpFile("transaction 2\n");
}
/************************************/
}
| [
"hongli@phusion.nl"
] | hongli@phusion.nl |
b86b0ef51cdbbe0fc3db9f94f26c33d7871ba150 | 3677628dab6aad030dd94d48215298478e2aaebf | /srt_editor/src/main.h | 93bd793bae7547b1146e25e07b4cf562fe843a81 | [
"MIT"
] | permissive | R-CO/srt_editor | 436cd0d921d2d28719b7a29b2c33453051b35230 | 17abf133b0d69b28b8bd2f92bf44cc2fbf102684 | refs/heads/master | 2021-01-10T16:11:11.978761 | 2016-01-31T16:46:17 | 2016-01-31T16:46:17 | 50,594,519 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,389 | h | //The MIT License(MIT)
//
//Copyright(c) 2016 R-CO
//
//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.
/**
*** Author: R-CO
*** Mail: daniel1820kobe@gmail.com
*** Date: 2016-01-09
***/
#ifndef WX_PROJECT_TEMPLATE_MAIN_H
#define WX_PROJECT_TEMPLATE_MAIN_H
#include <wx/app.h>
namespace rco {
class WxProjectTemplateApp : public wxApp
{
public:
bool OnInit();
};
}
#endif
| [
"daniel1820kobe@gmail.com"
] | daniel1820kobe@gmail.com |
2ab912189a1cad0dcbad8c43213c65ce9a6fc1f3 | 0f2f893893431fb16ab42b19b704200f2aad3176 | /Functions/Pass by Address/main.cpp | 2d7ca25ff49bd48e2dc3e4942537c5411ff74126 | [] | no_license | Snehanko/Basic-Cpp-Programs | 081e30ba8fc9779ec9d2451fff38c78dbe4f259f | e4b949bdd3bc9e6489baac0bdf43391abf615581 | refs/heads/main | 2023-06-26T07:38:24.894215 | 2021-07-28T15:03:56 | 2021-07-28T15:03:56 | 390,393,840 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 265 | cpp | #include <iostream>
using namespace std;
void swap(int *a,int *b){
int temp;
temp=*a;
*a=*b;
*b=temp;
cout<<*a<<" "<<*b<<endl;
cout<<a<<" "<<b<<endl;
}
int main()
{
int x=10,y=20;
swap(&x,&y);
cout<<x<<" "<<y;
return 0;
}
| [
"snehankobose31@gmail.com"
] | snehankobose31@gmail.com |
4e6e49ed6f70d65106ee0bf3c3159f1c17b18dda | 0bcde4a29be0a18d9961a0335056c15a7662157b | /src/mesh/poisson/Geometry.h | 5d03508b493d5b5b4ecef1db4cae1bd92779be86 | [] | no_license | tiagodc/3DTK | b8d66299b7b51b1ff63c0edbf8c008859948fd69 | 4fe2d3465fd50bbd253e5fff4c4744ed675dce29 | refs/heads/master | 2020-03-24T00:03:31.322841 | 2018-07-20T13:41:28 | 2018-07-20T13:41:28 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 11,893 | h | /*
Copyright (c) 2006, Michael Kazhdan and Matthew Bolitho
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list of
conditions and the following disclaimer. Redistributions in binary form must reproduce
the above copyright notice, this list of conditions and the following disclaimer
in the documentation and/or other materials provided with the distribution.
Neither the name of the Johns Hopkins University nor the names of its contributors
may be used to endorse or promote products derived from this software without specific
prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
DAMAGE.
*/
#ifndef GEOMETRY_INCLUDED
#define GEOMETRY_INCLUDED
#include <math.h>
#include <vector>
#include "Hash.h"
template<class Real>
Real Random(void);
template< class Real >
struct Point3D
{
Real coords[3];
Point3D( void ) { coords[0] = coords[1] = coords[2] = Real(0); }
Point3D( Real v0 , Real v1 , Real v2 ){ coords[0] = v0 , coords[1] = v1 , coords[2] = v2; }
template< class Real2 > Point3D( const Point3D< Real2 >& p ){ coords[0] = Real( p[0] ) , coords[1] = Real( p[1] ) , coords[2] = Real( p[2] ); }
inline Real& operator[] ( int i ) { return coords[i]; }
inline const Real& operator[] ( int i ) const { return coords[i]; }
inline Point3D& operator += ( Point3D p ){ coords[0] += p.coords[0] , coords[1] += p.coords[1] , coords[2] += p.coords[2] ; return *this; }
inline Point3D& operator -= ( Point3D p ){ coords[0] -= p.coords[0] , coords[1] -= p.coords[1] , coords[2] -= p.coords[2] ; return *this; }
inline Point3D& operator *= ( Real r ){ coords[0] *= r , coords[1] *= r , coords[2] *= r ; return *this; }
inline Point3D& operator /= ( Real r ){ coords[0] /= r , coords[1] /= r , coords[2] /= r ; return *this; }
inline Point3D operator + ( Point3D p ) const { Point3D q ; q.coords[0] = coords[0] + p.coords[0] , q.coords[1] = coords[1] + p.coords[1] , q.coords[2] = coords[2] + p.coords[2] ; return q; }
inline Point3D operator - ( Point3D p ) const { Point3D q ; q.coords[0] = coords[0] - p.coords[0] , q.coords[1] = coords[1] - p.coords[1] , q.coords[2] = coords[2] - p.coords[2] ; return q; }
inline Point3D operator * ( Real r ) const { Point3D q ; q.coords[0] = coords[0] * r , q.coords[1] = coords[1] * r , q.coords[2] = coords[2] * r ; return q; }
inline Point3D operator / ( Real r ) const { return (*this) * ( Real(1.)/r ); }
};
template< class Real >
struct XForm3x3
{
Real coords[3][3];
XForm3x3( void ) { for( int i=0 ; i<3 ; i++ ) for( int j=0 ; j<3 ; j++ ) coords[i][j] = Real(0.); }
static XForm3x3 Identity( void )
{
XForm3x3 xForm;
xForm(0,0) = xForm(1,1) = xForm(2,2) = Real(1.);
return xForm;
}
Real& operator() ( int i , int j ){ return coords[i][j]; }
const Real& operator() ( int i , int j ) const { return coords[i][j]; }
Point3D< Real > operator * ( const Point3D< Real >& p ) const
{
Point3D< Real > q;
for( int i=0 ; i<3 ; i++ ) for( int j=0 ; j<3 ; j++ ) q[i] += coords[j][i] * p[j];
return q;
}
XForm3x3 operator * ( const XForm3x3& m ) const
{
XForm3x3 n;
for( int i=0 ; i<3 ; i++ ) for( int j=0 ; j<3 ; j++ ) for( int k=0 ; k<3 ; k++ ) n.coords[i][j] += m.coords[i][k]*coords[k][j];
return n;
}
XForm3x3 transpose( void ) const
{
XForm3x3 xForm;
for( int i=0 ; i<3 ; i++ ) for( int j=0 ; j<3 ; j++ ) xForm( i , j ) = coords[j][i];
return xForm;
}
Real subDeterminant( int i , int j ) const
{
int i1 = (i+1)%3 , i2 = (i+2)%3;
int j1 = (j+1)%3 , j2 = (j+2)%3;
return coords[i1][j1] * coords[i2][j2] - coords[i1][j2] * coords[i2][j1];
}
Real determinant( void ) const { return coords[0][0] * subDeterminant( 0 , 0 ) + coords[1][0] * subDeterminant( 1 , 0 ) + coords[2][0] * subDeterminant( 2 , 0 ); }
XForm3x3 inverse( void ) const
{
XForm3x3 xForm;
Real d = determinant();
for( int i=0 ; i<3 ; i++ ) for( int j=0 ; j<3 ;j++ ) xForm.coords[j][i] = subDeterminant( i , j ) / d;
return xForm;
}
};
template< class Real >
struct XForm4x4
{
Real coords[4][4];
XForm4x4( void ) { for( int i=0 ; i<4 ; i++ ) for( int j=0 ; j<4 ; j++ ) coords[i][j] = Real(0.); }
static XForm4x4 Identity( void )
{
XForm4x4 xForm;
xForm(0,0) = xForm(1,1) = xForm(2,2) = xForm(3,3) = Real(1.);
return xForm;
}
Real& operator() ( int i , int j ){ return coords[i][j]; }
const Real& operator() ( int i , int j ) const { return coords[i][j]; }
Point3D< Real > operator * ( const Point3D< Real >& p ) const
{
Point3D< Real > q;
for( int i=0 ; i<3 ; i++ )
{
for( int j=0 ; j<3 ; j++ ) q[i] += coords[j][i] * p[j];
q[i] += coords[3][i];
}
return q;
}
XForm4x4 operator * ( const XForm4x4& m ) const
{
XForm4x4 n;
for( int i=0 ; i<4 ; i++ ) for( int j=0 ; j<4 ; j++ ) for( int k=0 ; k<4 ; k++ ) n.coords[i][j] += m.coords[i][k]*coords[k][j];
return n;
}
XForm4x4 transpose( void ) const
{
XForm4x4 xForm;
for( int i=0 ; i<4 ; i++ ) for( int j=0 ; j<4 ; j++ ) xForm( i , j ) = coords[j][i];
return xForm;
}
Real subDeterminant( int i , int j ) const
{
XForm3x3< Real > xForm;
int ii[] = { (i+1)%4 , (i+2)%4 , (i+3)%4 } , jj[] = { (j+1)%4 , (j+2)%4 , (j+3)%4 };
for( int _i=0 ; _i<3 ; _i++ ) for( int _j=0 ; _j<3 ; _j++ ) xForm( _i , _j ) = coords[ ii[_i] ][ jj[_j] ];
return xForm.determinant();
}
Real determinant( void ) const { return coords[0][0] * subDeterminant( 0 , 0 ) - coords[1][0] * subDeterminant( 1 , 0 ) + coords[2][0] * subDeterminant( 2 , 0 ) - coords[3][0] * subDeterminant( 3 , 0 ); }
XForm4x4 inverse( void ) const
{
XForm4x4 xForm;
Real d = determinant();
for( int i=0 ; i<4 ; i++ ) for( int j=0 ; j<4 ;j++ )
if( (i+j)%2==0 ) xForm.coords[j][i] = subDeterminant( i , j ) / d;
else xForm.coords[j][i] = -subDeterminant( i , j ) / d;
return xForm;
}
};
template<class Real>
Point3D<Real> RandomBallPoint(void);
template<class Real>
Point3D<Real> RandomSpherePoint(void);
template<class Real>
double Length(const Point3D<Real>& p);
template<class Real>
double SquareLength(const Point3D<Real>& p);
template<class Real>
double Distance(const Point3D<Real>& p1,const Point3D<Real>& p2);
template<class Real>
double SquareDistance(const Point3D<Real>& p1,const Point3D<Real>& p2);
template <class Real>
void CrossProduct(const Point3D<Real>& p1,const Point3D<Real>& p2,Point3D<Real>& p);
class Edge{
public:
double p[2][2];
double Length(void) const{
double d[2];
d[0]=p[0][0]-p[1][0];
d[1]=p[0][1]-p[1][1];
return sqrt(d[0]*d[0]+d[1]*d[1]);
}
};
class Triangle{
public:
double p[3][3];
double Area(void) const{
double v1[3] , v2[3] , v[3];
for( int d=0 ; d<3 ; d++ )
{
v1[d] = p[1][d] - p[0][d];
v2[d] = p[2][d] - p[0][d];
}
v[0] = v1[1]*v2[2] - v1[2]*v2[1];
v[1] = -v1[0]*v2[2] + v1[2]*v2[0];
v[2] = v1[0]*v2[1] - v1[1]*v2[0];
return sqrt( v[0]*v[0] + v[1]*v[1] + v[2]*v[2] ) / 2;
}
double AspectRatio(void) const{
double d=0;
int i,j;
for(i=0;i<3;i++){
for(i=0;i<3;i++)
for(j=0;j<3;j++){d+=(p[(i+1)%3][j]-p[i][j])*(p[(i+1)%3][j]-p[i][j]);}
}
return Area()/d;
}
};
class CoredPointIndex
{
public:
int index;
char inCore;
int operator == (const CoredPointIndex& cpi) const {return (index==cpi.index) && (inCore==cpi.inCore);};
int operator != (const CoredPointIndex& cpi) const {return (index!=cpi.index) || (inCore!=cpi.inCore);};
};
class EdgeIndex{
public:
int idx[2];
};
class CoredEdgeIndex
{
public:
CoredPointIndex idx[2];
};
class TriangleIndex{
public:
int idx[3];
};
class TriangulationEdge
{
public:
TriangulationEdge(void);
int pIndex[2];
int tIndex[2];
};
class TriangulationTriangle
{
public:
TriangulationTriangle(void);
int eIndex[3];
};
template<class Real>
class Triangulation
{
public:
std::vector<Point3D<Real> > points;
std::vector<TriangulationEdge> edges;
std::vector<TriangulationTriangle> triangles;
int factor( int tIndex,int& p1,int& p2,int& p3);
double area(void);
double area( int tIndex );
double area( int p1 , int p2 , int p3 );
int flipMinimize( int eIndex);
int addTriangle( int p1 , int p2 , int p3 );
protected:
hash_map<long long,int> edgeMap;
static long long EdgeIndex( int p1 , int p2 );
double area(const Triangle& t);
};
template<class Real>
void EdgeCollapse(const Real& edgeRatio,std::vector<TriangleIndex>& triangles,std::vector< Point3D<Real> >& positions,std::vector<Point3D<Real> >* normals);
template<class Real>
void TriangleCollapse(const Real& edgeRatio,std::vector<TriangleIndex>& triangles,std::vector<Point3D<Real> >& positions,std::vector<Point3D<Real> >* normals);
struct CoredVertexIndex
{
int idx;
bool inCore;
};
template< class Vertex >
class CoredMeshData
{
public:
std::vector< Vertex > inCorePoints;
virtual void resetIterator( void ) = 0;
virtual int addOutOfCorePoint( const Vertex& p ) = 0;
virtual int addPolygon( const std::vector< CoredVertexIndex >& vertices ) = 0;
virtual int nextOutOfCorePoint( Vertex& p )=0;
virtual int nextPolygon( std::vector< CoredVertexIndex >& vertices ) = 0;
virtual int outOfCorePointCount(void)=0;
virtual int polygonCount( void ) = 0;
};
template< class Vertex >
class CoredVectorMeshData : public CoredMeshData< Vertex >
{
std::vector< Vertex > oocPoints;
std::vector< std::vector< int > > polygons;
int polygonIndex;
int oocPointIndex;
public:
CoredVectorMeshData(void);
void resetIterator(void);
int addOutOfCorePoint( const Vertex& p );
int addPolygon( const std::vector< CoredVertexIndex >& vertices );
int nextOutOfCorePoint( Vertex& p );
int nextPolygon( std::vector< CoredVertexIndex >& vertices );
int outOfCorePointCount(void);
int polygonCount( void );
};
class BufferedReadWriteFile
{
bool tempFile;
FILE* _fp;
char *_buffer , _fileName[1024];
size_t _bufferIndex , _bufferSize;
public:
BufferedReadWriteFile( char* fileName=NULL , int bufferSize=(1<<20) );
~BufferedReadWriteFile( void );
bool write( const void* data , size_t size );
bool read ( void* data , size_t size );
void reset( void );
};
template< class Vertex >
class CoredFileMeshData : public CoredMeshData< Vertex >
{
char pointFileName[1024] , polygonFileName[1024];
BufferedReadWriteFile *oocPointFile , *polygonFile;
int oocPoints , polygons;
public:
CoredFileMeshData( void );
~CoredFileMeshData( void );
void resetIterator( void );
int addOutOfCorePoint( const Vertex& p );
int addPolygon( const std::vector< CoredVertexIndex >& vertices );
int nextOutOfCorePoint( Vertex& p );
int nextPolygon( std::vector< CoredVertexIndex >& vertices );
int outOfCorePointCount( void );
int polygonCount( void );
};
#include "Geometry.inl"
#endif // GEOMETRY_INCLUDED
| [
"hsia.sun@gmail.com"
] | hsia.sun@gmail.com |
6251938ccd82712b05451054c35e25ad60e67821 | 45364deefe009a0df9e745a4dd4b680dcedea42b | /SDK/FSD_ENUM_CarbonTypeFace_functions.cpp | 57acbefbdc70e67629db3fef222c879e837296fc | [] | no_license | RussellJerome/DeepRockGalacticSDK | 5ae9b59c7324f2a97035f28545f92773526ed99e | f13d9d8879a645c3de89ad7dc6756f4a7a94607e | refs/heads/master | 2022-11-26T17:55:08.185666 | 2020-07-26T21:39:30 | 2020-07-26T21:39:30 | 277,796,048 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 355 | cpp | // DeepRockGalactic SDK
#ifdef _MSC_VER
#pragma pack(push, 0x8)
#endif
#include "FSD_ENUM_CarbonTypeFace_parameters.hpp"
namespace SDK
{
//---------------------------------------------------------------------------
//Functions
//---------------------------------------------------------------------------
}
#ifdef _MSC_VER
#pragma pack(pop)
#endif
| [
"darkmanvoo@gmail.com"
] | darkmanvoo@gmail.com |
6a3ed24f68ed745edf992dacfdfcd63487f3d6f3 | 2095af306a0eb2e10c78aa6047f85a7dcdc7c47d | /include/Control/UIText.h | 6cc1cbdb76bd6eb3b8b8798556ddf4d0e93085ee | [
"MIT",
"LicenseRef-scancode-public-domain",
"LicenseRef-scancode-unknown-license-reference",
"LicenseRef-scancode-scintilla"
] | permissive | grimtraveller/LongUI | ff4e5f565a44c266a8aede6925b75de711e5ea41 | d4fed468217312cb77e99b7f1ead45bdab9223b6 | refs/heads/master | 2020-12-11T03:25:13.373234 | 2016-03-12T12:13:36 | 2016-03-12T12:13:36 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,418 | h | #pragma once
/**
* Copyright (c) 2014-2016 dustpg mailto:dustpg@gmail.com
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use,
* copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following
* conditions:
*
* 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.
*/
// LongUI namespace
namespace LongUI {
// default text control 默认文本控件
class UIText : public UIControl {
// 父类申明
using Super = UIControl ;
// clean this
virtual void cleanup() noexcept override;
public:
// Render 渲染
virtual void Render() const noexcept override;
// update 刷新
virtual void Update() noexcept override;
// do event 事件处理
virtual bool DoEvent(const LongUI::EventArgument& arg) noexcept override;
// recreate 重建
//virtual auto Recreate() noexcept ->HRESULT override;
protected:
// something must do before deleted
void before_deleted() noexcept { Super::before_deleted(); }
// render chain -> background
void render_chain_background() const noexcept { return Super::render_chain_background(); }
// render chain -> mainground
void render_chain_main() const noexcept { return Super::render_chain_main(); }
// render chain -> foreground
void render_chain_foreground() const noexcept;
public:
// create 创建
static auto WINAPI CreateControl(CreateEventType, pugi::xml_node) noexcept ->UIControl*;
// ctor: cp- parent in contorl-level
UIText(UIContainer* cp) noexcept : Super(cp) {}
protected:
// initialize, maybe you want call v-method
void initialize(pugi::xml_node node) noexcept { Super::initialize(node); m_text.Init(node); }
// dtor
~UIText() noexcept { }
// copy ctor = delete
UIText(const UIText&) = delete;
protected:
// the text of control
LongUI::Component::ShortText m_text;
#ifdef LongUIDebugEvent
protected:
// debug infomation
virtual bool debug_do_event(const LongUI::DebugEventInformation&) const noexcept override;
#endif
};
#ifdef LongUIDebugEvent
// 重载?特例化 GetIID
template<> LongUIInline const IID& GetIID<LongUI::UIText>() {
// {47F83436-2D1F-413B-BBAD-9322EFF18185}
static const GUID IID_LongUI_UIText = {
0x47f83436, 0x2d1f, 0x413b,{ 0xbb, 0xad, 0x93, 0x22, 0xef, 0xf1, 0x81, 0x85 }
};
return IID_LongUI_UIText;
}
#endif
} | [
"dustpg@gmail.com"
] | dustpg@gmail.com |
06a492cd10591fac2c8fb272dc0dd5f9bb3344cf | c788fdb6af5a078c80a360c1e675872ed8747787 | /Example7_Texture/main.cpp | 28e8e6310e4b1e73d932baee2230c3c800c7143d | [] | no_license | ysern/directXPres | 7c674f51cb06bf30ba3ef3fb3ca978bc1c6e8275 | d863bb08e5731605cc004b130859b52db5c2b8f7 | refs/heads/master | 2020-03-18T20:23:35.854545 | 2018-05-28T22:04:09 | 2018-05-28T22:04:09 | 135,212,727 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 12,557 | cpp | //Include necessary Headers//
#include <windows.h>
#include <d3d9.h>
#include "d3dx9.h"
//Include the Direct3D library
#pragma comment (lib, "d3d9.lib")
//Define variables/constants//
LPCTSTR WndClassName = "firstwindow"; //Define our window class name
HWND hwnd = NULL; //Sets our windows handle to NULL
const int Width = 800; //window width
const int Height = 600; //window height
//Pointer to Direct3D interface
IDirect3D9* d3d9 = NULL;
//pointer to Direct3D device class
IDirect3DDevice9* d3dDevice = NULL;
IDirect3DVertexBuffer9* g_pVertexBuffer = NULL;
//pointer to vertex shader
IDirect3DVertexShader9* g_pVertexShader = NULL;
IDirect3DPixelShader9* g_pPixelShader = NULL;
ID3DXConstantTable* g_pConstantTable = NULL;
IDirect3DVertexDeclaration9* g_pVertexDeclaration = NULL;
IDirect3DTexture9* g_pTexture = NULL;
//Functions//
bool SetupScene(); //Set up our Scene
void CleanUpScene(); //Release memory
bool RenderScene(float timeDelta); //Renders a single frame
//Vertex structure
struct Vertex
{
float x, y, z;
float u, v;
};
//Initialize window and Direct3D
bool InitializeD3DWindow(HINSTANCE hInstance,
int ShowWnd,
int width, int height,
bool windowed,
D3DDEVTYPE deviceType,
IDirect3DDevice9** d3dDevice);
//Main part of the program
int messageloop(bool(*display)(float timeDelta));
//Windows callback procedure, handles messages
LRESULT CALLBACK WndProc(HWND hWnd,
UINT msg,
WPARAM wParam,
LPARAM lParam);
bool SetupScene() { //Set up our Scene
d3dDevice->CreateVertexBuffer(
4 * sizeof(Vertex),
D3DUSAGE_WRITEONLY,
NULL,
D3DPOOL_MANAGED,
&g_pVertexBuffer,
0);
Vertex* vertices; //Create pointer to Vertex structure
//Lock vertex Buffer
g_pVertexBuffer->Lock(0, 0, (void**)&vertices, 0);
vertices[0].x = -0.5f;
vertices[0].y = 0.5f;
vertices[0].z = 0.0f;
vertices[0].u = 0.0f;
vertices[0].v = 0.0f;
vertices[1].x = 0.5f;
vertices[1].y = 0.5f;
vertices[1].z = 0.0f;
vertices[1].u = 1.0f;
vertices[1].v = 0.0f;
vertices[2].x = -0.5f;
vertices[2].y = -0.5f;
vertices[2].z = 0.0f;
vertices[2].u = 0.0f;
vertices[2].v = 1.0f;
vertices[3].x = 0.5f;
vertices[3].y = -0.5f;
vertices[3].z = 0.0f;
vertices[3].u = 1.0f;
vertices[3].v = 1.0f;
g_pVertexBuffer->Unlock(); //UnLock vertex buffer
D3DVERTEXELEMENT9 decl[] =
{
{ 0, 0, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0 },
{ 0, 12, D3DDECLTYPE_FLOAT2, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 0 },
D3DDECL_END()
};
d3dDevice->CreateVertexDeclaration(decl, &g_pVertexDeclaration);
DWORD dwShaderFlags = D3DXSHADER_DEBUG | D3DXSHADER_SKIPOPTIMIZATION | D3DXSHADER_DEBUG;
// Assemble the vertex shader from the file
const char* pathToVertexShader = "..\\Example7_Texture\\VertexShader.h";
ID3DXBuffer* pCode;
D3DXCompileShaderFromFile(pathToVertexShader, NULL, NULL,
"MainVS", "vs_2_0", dwShaderFlags, &pCode, NULL, NULL);
// Create the vertex shader
d3dDevice->CreateVertexShader((DWORD*)pCode->GetBufferPointer(), &g_pVertexShader);
pCode->Release();
// Assemble the pixel shader from the file
const char* pathToPixelShader = "..\\Example7_Texture\\PixelShader.h";
D3DXCompileShaderFromFile(pathToPixelShader, NULL, NULL,
"MainPS", "ps_2_0", dwShaderFlags, &pCode, NULL, &g_pConstantTable);
// Create the vertex shader
d3dDevice->CreatePixelShader((DWORD*)pCode->GetBufferPointer(), &g_pPixelShader);
pCode->Release();
// Load texture
D3DXCreateTextureFromFile(d3dDevice, "..\\Example7_Texture\\bv_logo.png", &g_pTexture);
//D3DXCreateTextureFromFile(d3dDevice, "..\\Example7_Texture\\bv_logo_small.png", &g_pTexture);
return true;
}
//Renders a single frame
bool RenderScene(float timeDelta)
{
if (d3dDevice)
{
// Set up the vertex shader constants
g_pConstantTable->SetFloat(d3dDevice, "fTime", timeDelta);
//Clear the window to 0x00000000 (black)
const D3DCOLOR clearColor = 0xFF122F53;
d3dDevice->Clear(0, 0, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER,
clearColor, 1.0f, 0);
d3dDevice->BeginScene(); //Start drawing our scene
d3dDevice->SetVertexDeclaration(g_pVertexDeclaration);
d3dDevice->SetVertexShader(g_pVertexShader);
d3dDevice->SetPixelShader(g_pPixelShader);
// Setup texture.
d3dDevice->SetTexture(0, g_pTexture);
d3dDevice->SetSamplerState(0, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR);
d3dDevice->SetSamplerState(0, D3DSAMP_MINFILTER, D3DTEXF_LINEAR);
d3dDevice->SetSamplerState(0, D3DSAMP_MIPFILTER, D3DTEXF_LINEAR);
/*d3dDevice->SetSamplerState(0, D3DSAMP_MAGFILTER, D3DTEXF_POINT);
d3dDevice->SetSamplerState(0, D3DSAMP_MINFILTER, D3DTEXF_POINT);
d3dDevice->SetSamplerState(0, D3DSAMP_MIPFILTER, D3DTEXF_POINT);*/
d3dDevice->SetStreamSource(0, g_pVertexBuffer, 0, sizeof(Vertex));
d3dDevice->DrawPrimitive(D3DPT_TRIANGLESTRIP, 0, 2);
d3dDevice->EndScene(); //Stop drawing our scene
d3dDevice->Present(0, 0, 0, 0); //Display our newly created scene
}
return true;
}
//Main windows function
int WINAPI WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nShowCmd)
{
//Initialize Direct3D//
//If initialization failed, display an error message
if (!InitializeD3DWindow(hInstance, nShowCmd,
Width, Height,
true,
D3DDEVTYPE_HAL,
&d3dDevice))
{
// If initialization failed, display an error message
MessageBox(0, "Window/D3D Initialization - Failed",
"Error", MB_OK);
return 0;
}
//Setup our scene
if (!SetupScene())
{
// If Setup failed, display error message
MessageBox(0, "SetupScene() - FAILED", 0, 0);
return 0;
}
//Jump into the heart of our program
messageloop(RenderScene);
//Release memory allocated by our SetupScene function
CleanUpScene();
d3dDevice->Release(); //Release our Direct3D Device
return 0;
}
//Release memory
void CleanUpScene() {
g_pVertexBuffer->Release();
g_pVertexShader->Release();
g_pPixelShader->Release();
g_pTexture->Release();
g_pConstantTable->Release();
g_pVertexDeclaration->Release();
return;
}
//Initialize our Direct3D window
bool InitializeD3DWindow(HINSTANCE hInstance,
int ShowWnd,
int width, int height,
bool windowed,
D3DDEVTYPE deviceType,
IDirect3DDevice9** d3dDevice)
{
//Start creating the window//
WNDCLASSEX wc; //Create a new extended windows class
wc.cbSize = sizeof(WNDCLASSEX); //Size of our windows class
wc.style = CS_HREDRAW | CS_VREDRAW; //class styles
wc.lpfnWndProc = WndProc; //Default windows procedure function
wc.cbClsExtra = NULL; //Extra bytes after our wc structure
wc.cbWndExtra = NULL; //Extra bytes after our windows instance
wc.hInstance = hInstance; //Instance to current application
wc.hIcon = LoadIcon(NULL, IDI_WINLOGO); //Title bar Icon
wc.hCursor = LoadCursor(NULL, IDC_ARROW); //Default mouse Icon
wc.hbrBackground = (HBRUSH)(COLOR_WINDOW + 2); //Window bg color
wc.lpszMenuName = NULL; //Name of the menu attached to our window
wc.lpszClassName = WndClassName; //Name of our windows class
wc.hIconSm = LoadIcon(NULL, IDI_WINLOGO); //Icon in your taskbar
if (!RegisterClassEx(&wc)) //Register our windows class
{
//If registration failed, display error
MessageBox(NULL, "Error registering class",
"Error", MB_OK | MB_ICONERROR);
return 1;
}
HWND hwnd = CreateWindowEx( //Create our Extended Window
NULL, //Extended style
WndClassName, //Name of our windows class
"Window Title", //Name in the title bar of our window
WS_OVERLAPPEDWINDOW, //style of our window
CW_USEDEFAULT, CW_USEDEFAULT, //Top left corner of window
width, //Width of our window
height, //Height of our window
NULL, //Handle to parent window
NULL, //Handle to a Menu
hInstance, //Specifies instance of current program
NULL //used for an MDI client window
);
if (!hwnd) //Make sure our window has been created
{
//If not, display error
MessageBox(NULL, "Error creating window",
"Error", MB_OK | MB_ICONERROR);
return 1;
}
ShowWindow(hwnd, ShowWnd); //Shows our window
UpdateWindow(hwnd); //Its good to update our window
//Start initializing Direct3D//
//Start by initializing the Direct3D interface
d3d9 = Direct3DCreate9(D3D_SDK_VERSION);
if (!d3d9) { //If it was not initialized
return false;
}
D3DCAPS9 caps; //Set the device capabilities structure to caps
//Get the device capabilities
d3d9->GetDeviceCaps(D3DADAPTER_DEFAULT, deviceType, &caps);
int vertexproc = NULL; //Set our vertex processing to NULL
//If we can use hardware vertex processing
if (caps.DevCaps & D3DDEVCAPS_HWTRANSFORMANDLIGHT)
//Set vertex processing to hardware
vertexproc = D3DCREATE_HARDWARE_VERTEXPROCESSING;
else
//Set vertex processing to software
vertexproc = D3DCREATE_SOFTWARE_VERTEXPROCESSING;
D3DPRESENT_PARAMETERS d3dpp;
//The width of the back buffer in pixels
d3dpp.BackBufferWidth = width;
//The height of the back buffer in pixels
d3dpp.BackBufferHeight = height;
//Back buffer pixel format
d3dpp.BackBufferFormat = D3DFMT_A8R8G8B8;
//Amount of back buffers
d3dpp.BackBufferCount = 1;
//The type of multisampling for the buffer
d3dpp.MultiSampleType = D3DMULTISAMPLE_NONE;
//The quality of multisampling
d3dpp.MultiSampleQuality = NULL;
//Specifies how buffers will be swapped
d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;
//Handle to our window
d3dpp.hDeviceWindow = hwnd;
//FullScreen or Windowed
d3dpp.Windowed = windowed;
//true lets Direct3D do the depth/stencil buffer automatically
d3dpp.EnableAutoDepthStencil = true;
//Auto depth/stencil buffer format
d3dpp.AutoDepthStencilFormat = D3DFMT_D24S8;
//Additional characteristics
d3dpp.Flags = NULL;
//Refresh rate
d3dpp.FullScreen_RefreshRateInHz = D3DPRESENT_RATE_DEFAULT;
//Presentation Interval
d3dpp.PresentationInterval = D3DPRESENT_INTERVAL_ONE;
HRESULT hr = 0;
hr = d3d9->CreateDevice(
D3DADAPTER_DEFAULT, // primary adapter
deviceType, // device type
hwnd, // window associated with device
vertexproc, // vertex processing
&d3dpp, // present parameters
d3dDevice); // return created device
if (FAILED(hr)) //If there was a problem creating the device
{
// try again using a 16-bit depth buffer
d3dpp.AutoDepthStencilFormat = D3DFMT_D16;
hr = d3d9->CreateDevice(
D3DADAPTER_DEFAULT,
deviceType,
hwnd,
vertexproc,
&d3dpp,
d3dDevice);
if (FAILED(hr)) //If it still fails
{
d3d9->Release(); // done with d3d9 object
MessageBox(0, "CreateDevice() - FAILED", 0, 0);
return false;
}
}
d3d9->Release(); // done with d3d9 object
return true; //If there were no errors, return true
}
int messageloop(bool(*display)(float timeDelta)) { //The message loop
MSG msg; //Create a new message structure
ZeroMemory(&msg, sizeof(MSG)); //clear message structure to NULL
//Set the last time. Keeps track of time between frames
static float lastTime = (float)timeGetTime();
float timeDelta = 0.0f;
while (TRUE) //While there is a message
{
//If there was a windows message
if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
{
if (msg.message == WM_QUIT) //If the message was WM_QUIT
break; //Exit the message loop
TranslateMessage(&msg); //Translate the message
//Send the message to default windows procedure
DispatchMessage(&msg);
}
else { //Otherewise, keep the flow going
//Set the time
float currTime = (float)timeGetTime();
//Set the speed until the next frame
timeDelta += (currTime - lastTime)*0.001f;
timeDelta -= floor(timeDelta);
display(timeDelta); //Display the goods
//Last time equal to current time
lastTime = currTime;
}
}
return (int)msg.wParam; //Return the message
}
LRESULT CALLBACK WndProc(HWND hwnd, //Default windows procedure
UINT msg,
WPARAM wParam,
LPARAM lParam)
{
switch (msg) //Check message
{
case WM_KEYDOWN: //For a key down
//If escape key was pressed, display popup box
if (wParam == VK_ESCAPE) {
if (MessageBox(0, "Are you sure you want to exit?",
"Really?", MB_YESNO | MB_ICONQUESTION) == IDYES)
//Release the windows allocated memory
DestroyWindow(hwnd);
}
return 0;
case WM_DESTROY: //If x button in top right was pressed
PostQuitMessage(0);
return 0;
}
//return the message for windows to handle it
return DefWindowProc(hwnd,
msg,
wParam,
lParam);
} | [
"sernivka@gmail.com"
] | sernivka@gmail.com |
7cbbe8873f1aacbcdc2e9c77d38933be136f1de6 | dd3d11771fd5affedf06f9fcf174bc83a3f2b139 | /BotCore/DofusProtocol/CharacterFirstSelectionMessage.h | 87b701c0528cf921da261159f85aa2f442ccfd03 | [] | no_license | Arkwell9112/arkwBot | d3f77ad3874e831594bd5712705983618e94f258 | 859f78dd5c777077b3005870800cb62eec1a9587 | refs/heads/master | 2023-03-17T12:45:07.560436 | 2021-03-16T11:22:35 | 2021-03-16T11:22:35 | 338,042,990 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 493 | h | #ifndef CHARACTERFIRSTSELECTIONMESSAGE
#define CHARACTERFIRSTSELECTIONMESSAGE
#include "../IO/ICustomDataInput.h"
#include "CharacterSelectionMessage.h"
class CharacterFirstSelectionMessage : public CharacterSelectionMessage {
public:
bool doTutorial = false;
unsigned int protocolId = 3197;
void deserialize(ICustomDataInput &input);
void deserializeAs_CharacterFirstSelectionMessage(ICustomDataInput &input);
void _doTutorialFunc(ICustomDataInput &input);
};
#endif | [
"arkwell9112@nowhere.com"
] | arkwell9112@nowhere.com |
220302a611a38e62d538d088dfc5629cf8f6377d | 9f2a8ff62a83fe1919fe2754ce84114e48202929 | /Sources/Wireless_Follower_Counter.ino | c31a2d57829fdd8e7681fe8dbc707a57817cd43b | [
"MIT"
] | permissive | Eltech008/FollowersCounter | 7a947b7916358041c3cde8eab001153d9d0cec66 | 0bfafb3602a44907b1dfcc28b9e1242aa9223583 | refs/heads/master | 2020-03-25T02:41:06.631528 | 2018-07-18T11:03:19 | 2018-07-18T11:03:19 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 19,614 | ino | #include <ESP8266WiFi.h>
#include <ESP8266mDNS.h>
#include <WiFiUdp.h>
#include <ArduinoOTA.h>
#include <ESP8266WebServer.h>
#include <EEPROM.h>
#include <ESP8266HTTPClient.h>
#include <ArduinoJson.h>
#include <YoutubeApi.h>
#include <FacebookApi.h>
#include <Adafruit_NeoPixel.h>
#include "Config.h"
#define mediaCount 4
#define mediaDurationDefaultValue 4
#define refreshInterval 2000
#define ledPin D8
#define ledAmount 320
#define brightnessDefaultValue 5
#define settingsResetPin D7
#define settingsResetGndPin D6
#define pannelHeight 8
#define pannelWidth 40
#define eepromCheckValue 123
ESP8266WebServer server(80);
WiFiClientSecure client;
FacebookApi facebookApi(client, facebookAccessToken, facebookAppId, facebookAppSecret);
YoutubeApi youtubeApi(youtubeApiKey, client);
Adafruit_NeoPixel bande = Adafruit_NeoPixel(ledAmount, ledPin, NEO_GRB + NEO_KHZ800);
const String mediaName[mediaCount] = {"YouTube", "Twitter", "Facebook", "Instagram"};
unsigned int mediaDuration[mediaCount] = {mediaDurationDefaultValue, mediaDurationDefaultValue, mediaDurationDefaultValue, mediaDurationDefaultValue};
const unsigned int mediaCallLimits[mediaCount] = {0, 0, 0, 200}; // Limite de calls à l'API en calls/h
unsigned long mediaLastCallMillis[mediaCount];
unsigned long mediaLastValue[mediaCount];
bool firstCallDone[mediaCount];
bool mediaEnabled[mediaCount];
byte pannel[pannelHeight][pannelWidth][3];
byte brightness = brightnessDefaultValue;
byte previousMedia = 0;
unsigned long previousNumber = 0;
//const byte lettres[26][6][4];
const byte digits[35] =
{
0b11111111,
0b10011000,
0b10011000,
0b10011111,
0b10010001,
0b10010001,
0b11111111,
0b00011111,
0b00011000,
0b00011000,
0b00011111,
0b00011001,
0b00011001,
0b00011111,
0b11111111,
0b00010001,
0b00010001,
0b11110001,
0b10000001,
0b10000001,
0b11110001,
0b11111111,
0b00011001,
0b00011001,
0b11111111,
0b00011001,
0b00011001,
0b11111111,
0b10011111,
0b10011001,
0b10011001,
0b11111111,
0b00010001,
0b00010001,
0b00011111
};
const byte YtLogoColors[3][3] = {{0, 0, 0}, {255, 0, 0}, {255, 255, 255}};
const byte YtLogo[8][10] =
{
{0, 1, 1, 1, 1, 1, 1, 1, 1, 0},
{1, 1, 1, 1, 2, 1, 1, 1, 1, 1},
{1, 1, 1, 1, 2, 2, 1, 1, 1, 1},
{1, 1, 1, 1, 2, 2, 2, 1, 1, 1},
{1, 1, 1, 1, 2, 2, 2, 1, 1, 1},
{1, 1, 1, 1, 2, 2, 1, 1, 1, 1},
{1, 1, 1, 1, 2, 1, 1, 1, 1, 1},
{0, 1, 1, 1, 1, 1, 1, 1, 1, 0}
};
const byte FbLogoColors[3][3] = {{0, 0, 0}, {40, 40, 125}, {255, 255, 255}};
const byte FbLogo[8][10] =
{
{0, 1, 1, 1, 1, 2, 2, 2, 1, 0},
{1, 1, 1, 1, 2, 2, 2, 2, 1, 1},
{1, 1, 1, 1, 2, 2, 1, 1, 1, 1},
{1, 1, 1, 1, 2, 2, 1, 1, 1, 1},
{1, 1, 1, 2, 2, 2, 2, 2, 1, 1},
{1, 1, 1, 1, 2, 2, 1, 1, 1, 1},
{1, 1, 1, 1, 2, 2, 1, 1, 1, 1},
{0, 1, 1, 1, 2, 2, 1, 1, 1, 0}
};
const byte TwLogoColors[3][3] = {{0, 0, 0}, {40, 70, 125}, {255, 255, 255}};
const byte TwLogo[8][10] =
{
{0, 1, 1, 2, 2, 1, 1, 1, 1, 0},
{1, 1, 1, 2, 2, 1, 1, 1, 1, 1},
{1, 1, 1, 2, 2, 2, 2, 2, 1, 1},
{1, 1, 1, 2, 2, 2, 2, 2, 1, 1},
{1, 1, 1, 2, 2, 1, 1, 1, 1, 1},
{1, 1, 1, 2, 2, 1, 1, 1, 1, 1},
{1, 1, 1, 2, 2, 2, 2, 2, 1, 1},
{0, 1, 1, 1, 2, 2, 2, 2, 1, 0}
};
const byte InstaLogoColors[8][3] = {{0, 0, 0}, {255, 255, 255}, {255, 190, 0}, {205, 80, 0}, {80, 10, 10}, {175, 0, 170}, {45, 0, 85}, {40, 20, 180}};
const byte InstaLogo[8][10] =
{
{0, 5, 1, 1, 1, 1, 1, 1, 7, 0},
{4, 1, 5, 5, 6, 6, 6, 1, 1, 7},
{4, 1, 4, 5, 1, 1, 6, 6, 1, 7},
{4, 1, 4, 1, 4, 6, 1, 6, 1, 7},
{3, 1, 3, 1, 4, 5, 1, 6, 1, 7},
{3, 1, 3, 3, 1, 1, 4, 5, 1, 6},
{2, 1, 2, 2, 3, 3, 4, 4, 1, 5},
{0, 2, 1, 1, 1, 1, 1, 1, 4, 0}
};
long power(long base, long exponent)
{
long result = base;
for(long i = 0; i <= exponent; i++)
{
if(i == 0)
{
result = 1;
}
else
{
result = result * base;
}
}
return result;
}
int getDigit(unsigned long number, int index)
{
for (int i = 0; i < index - 1; i++) {
number /= 10;
}
return number % 10;
}
void refreshDisplay()
{
for(int p = 0; p < pannelWidth / 8; p++)
{
for (int i = 0; i < 8; i++)
{
for(int j = 0; j < 8; j++)
{
bande.setPixelColor(p * 64 + i * 8 + j,pannel[i][p * 8 + j][0], pannel[i][p * 8 + j][1], pannel[i][p * 8 + j][2]);
}
}
}
bande.show();
}
void setAreaColor(int xStart, int xEnd, int yStart, int yEnd, char rValue, char gValue, char bValue)
{
for(int i = yStart; i <= yEnd; i++)
{
for(int j = xStart; j <= xEnd; j++)
{
pannel[i][j][0] = rValue;
pannel[i][j][1] = gValue;
pannel[i][j][2] = bValue;
}
}
}
void printDigit(char digit, int xPos, int yPos, char rValue, char gValue, char bValue, int shift = 0)
{
int subIndex = digit / 5;
int index = digit - subIndex * 5;
for(int i = 0; i < 7 - abs(shift); i++)
{
for(int j = 0; j < 4; j++)
{
if(xPos + j < pannelWidth && yPos + i < pannelHeight)
{
if(bitRead(digits[index * 7 + i + (shift > 0 ? shift : 0)], 4 * (1 - subIndex) + 3 - j))
{
pannel[yPos + i][xPos + j][0] = rValue;
pannel[yPos + i][xPos + j][1] = gValue;
pannel[yPos + i][xPos + j][2] = bValue;
}
}
}
}
}
void print6DigitsNumber(unsigned long number, int xPos, int yPos, char rValue, char gValue, char bValue)
{
for(int i = 0; i < 6; i++)
{
printDigit(getDigit(number, 6 - i), xPos + i * 5, yPos, rValue, gValue, bValue);
}
}
void print6DigitsNumberWithAnimation(unsigned long number, int xPos, int yPos, char rValue, char gValue, char bValue, int inOutAnim = 0)
{
float startNumber = previousNumber;
float stepDelta = ((float) number - previousNumber) / 3.0;
for(int animStep = 0; animStep < (inOutAnim == 0 ? 3 : 1); animStep++)
{
if(inOutAnim == 0)
{
number = round(((float) startNumber) + stepDelta * (animStep + 1));
}
for(int a = 0; a < 8; a++)
//for(int a = 7; a >= 0; a--)
{
setAreaColor(xPos, xPos + 28, yPos, yPos + 7, 0, 0, 0);
for(int i = 0; i < 6; i++)
{
int newDigit = getDigit(number, 6 - i);
int previousDigit = getDigit(previousNumber, 6 - i);
int delta = newDigit - previousDigit;
bool upShift = stepDelta > 0;
if(delta == 0 && inOutAnim == 0)
{
printDigit(newDigit, xPos + i * 5, yPos + 1, rValue, gValue, bValue);
}
else
{
if(inOutAnim != 0)
{
upShift = false;
}
int previousDigitShift = upShift ? a : -a;
int newDigitShift = upShift ? a - 7 : 7 - a;
int previousDigitYPos = upShift ? yPos : yPos + a + 2;
int newDigitYPos = upShift ? yPos + 1 + 7 - a : yPos + 1;
if(inOutAnim != 1)
{
printDigit(previousDigit, xPos + i * 5, previousDigitYPos, rValue, gValue, bValue, previousDigitShift);
}
if(inOutAnim != -1)
{
printDigit(newDigit, xPos + i * 5, newDigitYPos, rValue, gValue, bValue, newDigitShift);
}
}
}
refreshDisplay();
delay(50);
}
previousNumber = number;
}
}
void serialPrintPannel()
{
for(int i = 0; i < pannelHeight; i++)
{
for(int j = 0; j < pannelWidth; j++)
{
Serial.print(String(pannel[i][j][0]));
Serial.print("\t");
Serial.print(String(pannel[i][j][1]));
Serial.print("\t");
Serial.print(String(pannel[i][j][2]));
Serial.print("\t\t");
}
Serial.print("\n");
}
}
void printLogo(const byte logo[][10], const byte colors[][3], int animation = 4)
{
for(int i = 0; i < 8; i++)
{
for(int j = 4 - animation; j < 6 + animation; j++)
{
for(int k = 0; k < 3; k++)
{
pannel[i][j][k] = colors[logo[i][j]][k];
}
}
}
}
void printLogoWithAnimation(const byte logo[][10], const byte colors[][3])
{
for(int i = 0; i < 5; i++)
{
printLogo(logo, colors, i);
refreshDisplay();
delay(50);
}
}
String sendGet(String url, String sslCertificateFootprint = "")
{
HTTPClient http;
if(sslCertificateFootprint == "")
{
http.begin(url);
}
else
{
http.begin(url, sslCertificateFootprint);
}
int httpCode = http.GET();
String returnValue;
returnValue = httpCode > 0 ? http.getString() : "Error : no HTTP code";
http.end();;
return returnValue;
}
int getTwitterFollowerCount(String profileId)
{
String answer = sendGet("http://cdn.syndication.twimg.com/widgets/followbutton/info.json?screen_names=" + profileId);
// On enlève les crochets [] qui entourent le json et le rendent illisible par le pasrer
answer.remove(0, 1);
answer.remove(answer.length() - 1, 1);
DynamicJsonBuffer jsonBuffer;
JsonObject& root = jsonBuffer.parseObject(answer);
if (root.success()) {
if (root.containsKey("followers_count"))
{
return root["followers_count"].as<int>();
}
Serial.println("Incompatible JSON");
}
else
{
Serial.println("Failed to parse JSON");
}
return -1;
}
int getInstagramFollowerCount(String profileId, String accessToken)
{
String answer = sendGet("https://api.instagram.com/v1/users/" + profileId + "/?access_token=" + accessToken, instagramSSLCertificateFootprint);
DynamicJsonBuffer jsonBuffer;
JsonObject& root = jsonBuffer.parseObject(answer);
if (root.success()) {
if (root.containsKey("data"))
{
return root["data"]["counts"]["followed_by"].as<int>();
}
Serial.println("Incompatible JSON");
}
else
{
Serial.println("Failed to parse JSON");
}
return -1;
}
int getYoutubeSubscriberCount(String channelId)
{
if(youtubeApi.getChannelStatistics(youtubeChannelId))
{
return youtubeApi.channelStats.subscriberCount;
}
else
{
return -1;
}
}
int getFacebookFanCount(String pageId)
{
return facebookApi.getPageFanCount(pageId);
}
void printMediaSettings()
{
for(int media = 0; media < mediaCount; media++)
{
Serial.print(mediaName[media]);
Serial.print(" - Enabled : ");
Serial.print(mediaEnabled[media]);
Serial.print(" - Duration : ");
Serial.println(mediaDuration[media]);
}
}
void EEPROMWriteInt(int address, int value)
{
byte lowByte = ((value >> 0) & 0xFF);
byte highByte = ((value >> 8) & 0xFF);
EEPROM.write(address, lowByte);
EEPROM.write(address + 1, highByte);
}
unsigned int EEPROMReadInt(int address)
{
byte lowByte = EEPROM.read(address);
byte highByte = EEPROM.read(address + 1);
return ((lowByte << 0) & 0xFF) + ((highByte << 8) & 0xFF00);
}
void readSettingsFromEeprom()
{
if(EEPROM.read(0) != eepromCheckValue)
{
Serial.println("Bad EEPROM format. Settings read abort.");
return;
}
else
{
for(int media = 0; media < mediaCount; media++)
{
int offset = 100 + media * 5;
mediaEnabled[media] = EEPROM.read(offset) == 1 ? true : false;
mediaDuration[media] = EEPROMReadInt(offset + 1);
}
brightness = EEPROM.read(1);
}
}
void writeMediaSettingsToEeprom(int media)
{
int offset = 100 + media * 5;
EEPROM.write(offset, mediaEnabled[media] ? 1 : 0);
EEPROMWriteInt(offset + 1, mediaDuration[media]);
EEPROM.commit();
}
void writeBrightnessSettingToEeprom()
{
EEPROM.write(1, brightness);
EEPROM.commit();
}
void writeSettingsToEeprom()
{
for(int media = 0; media < mediaCount; media++)
{
writeMediaSettingsToEeprom(media);
}
writeBrightnessSettingToEeprom();
EEPROM.write(0, eepromCheckValue);
EEPROM.commit();
}
String generateIndexHtml(String message = "")
{
String html = "<!DOCTYPE html>\n<html>\n<head>\n<meta charset=\"UTF-8\">\n<title>Follower Counter</title>\n";
html += "</head>\n<body>\n";
html += message + "\n<br>\n";
html += "<form action=\"/index\" method=\"get\">Brightness % <input type=\"number\" min=\"0\" max=\"100\" name=\"brightness\" value=\"" + String(brightness) + "\"><input type=\"submit\" value=\"Apply\"></form>";
html += "<table class=\"table\">\n";
html += "<tr><td>Media</td><td>Enabled</td><td>Duration</td></tr>";
for(int media = 0; media < mediaCount; media++)
{
html += "<tr>\n<form action=\"/index\" method=\"get\">\n<input type=\"hidden\" name=\"media\" value=\"" + String(media) + "\">\n";
html += "<td>" + mediaName[media] + "</td>\n";
html += "<td><input type=\"hidden\" name=\"enabled\" value=\"" + String(mediaEnabled[media] ? "true" : "false") + "\" checked>";
html += "<input type=\"checkbox\" onclick=\"this.previousSibling.value = !(this.previousSibling.value == 'true')\" " + String(mediaEnabled[media] ? "checked" : "") + "></td>\n";
html += "<td><input type=\"number\" name=\"duration\" value=\"" + String(mediaDuration[media]) + "\"></td>\n";
html += "<td><input type=\"submit\" value=\"Apply\"></td>\n";
html += "</form>\n</tr>\n";
}
html += "</table>\n";
html += "<button onClick=\"window.location = window.location.pathname\">Refresh</button>";
html += "\n</body>\n</html>";
return html;
}
void handleIndex()
{
if (!server.authenticate(webServerUsername, webServerPassword))
{
return server.requestAuthentication();
}
String message = "";
if (server.arg("media") != "" && server.arg("enabled") != "")
{
int media = server.arg("media").toInt();
bool enabled = server.arg("enabled") == "true";
if(media >= 0 && media < mediaCount)
{
if(server.arg("duration") != "")
{
int duration = server.arg("duration").toInt();
if(duration > 0)
{
mediaDuration[media] = duration;
mediaEnabled[media] = enabled;
writeMediaSettingsToEeprom(media);
message = mediaName[media] + " settings changed.";
}
else
{
message = "Incorrect query";
}
}
}
}
else if (server.arg("brightness") != "")
{
int newBrightness = server.arg("brightness").toInt();
if(newBrightness >= 0 && newBrightness <= 100) // La vraie limite max de brightness est 255, mais le courant nécessaire devient trop élevée pour un port USB
{
brightness = newBrightness;
bande.setBrightness(brightness);
bande.show();
writeBrightnessSettingToEeprom();
message = "Brightness changed.";
}
}
server.send(200, "text/html", generateIndexHtml(message));
}
void setup() {
Serial.begin(115200);
delay(10);
Serial.println();
Serial.println();
Serial.print("Connecting to ");
Serial.println(ssid);
WiFi.mode(WIFI_STA);
WiFi.hostname(wirelessHostname);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
Serial.println();
ArduinoOTA.onStart([]() {
String type;
if (ArduinoOTA.getCommand() == U_FLASH)
type = "sketch";
else // U_SPIFFS
type = "filesystem";
// NOTE: if updating SPIFFS this would be the place to unmount SPIFFS using SPIFFS.end()
Serial.println("Start updating " + type);
});
ArduinoOTA.onEnd([]() {
Serial.println("\nEnd");
});
ArduinoOTA.onProgress([](unsigned int progress, unsigned int total) {
Serial.printf("Progress: %u%%\r", (progress / (total / 100)));
});
ArduinoOTA.onError([](ota_error_t error) {
Serial.printf("Error[%u]: ", error);
if (error == OTA_AUTH_ERROR) Serial.println("Auth Failed");
else if (error == OTA_BEGIN_ERROR) Serial.println("Begin Failed");
else if (error == OTA_CONNECT_ERROR) Serial.println("Connect Failed");
else if (error == OTA_RECEIVE_ERROR) Serial.println("Receive Failed");
else if (error == OTA_END_ERROR) Serial.println("End Failed");
});
ArduinoOTA.setPassword(otaPassword);
ArduinoOTA.begin();
server.on("/index", handleIndex);
server.begin();
pinMode(settingsResetPin, INPUT_PULLUP);
pinMode(settingsResetGndPin, OUTPUT);
digitalWrite(settingsResetGndPin, LOW);
EEPROM.begin(512);
if(EEPROM.read(0) == eepromCheckValue && digitalRead(settingsResetPin))
{
readSettingsFromEeprom();
}
else
{
for(int i = 0; i < mediaCount; i++)
{
mediaEnabled[i] = true;
}
writeSettingsToEeprom();
}
printMediaSettings();
Serial.println();
Serial.println("WiFi connected");
Serial.println("IP address: ");
Serial.println(WiFi.localIP());
Serial.println();
bande.begin();
bande.setBrightness(brightness);
printLogoWithAnimation(YtLogo, YtLogoColors);
print6DigitsNumberWithAnimation(0, 11, 0, 255, 255, 255, 1);
refreshDisplay();
}
void printMediaLogoWithAnimation(int media)
{
if(media == 0)
{
printLogoWithAnimation(YtLogo, YtLogoColors);
}
else if(media == 1)
{
printLogoWithAnimation(TwLogo, TwLogoColors);
}
else if(media == 2)
{
printLogoWithAnimation(FbLogo, FbLogoColors);
}
else if(media == 3)
{
printLogoWithAnimation(InstaLogo, InstaLogoColors);
}
return;
}
int getMediaValue(int media)
{
int value = -1;
if(mediaCallLimits[media] != 0)
{
unsigned long minTimeBetweenCalls = 3600000 / mediaCallLimits[media];
if(millis() - mediaLastCallMillis[media] < minTimeBetweenCalls && firstCallDone[media])
{
value = mediaLastValue[media];
Serial.print("Skipped ");
Serial.print(mediaName[media]);
Serial.println(" call for API restriction. Last known value used.");
return value;
}
}
Serial.print(mediaName[media]);
Serial.println(" API call.");
if(media == 0)
{
value = getYoutubeSubscriberCount(youtubeChannelId);
}
else if(media == 1)
{
value = getTwitterFollowerCount(twitterPageName);
}
else if(media == 2)
{
value = getFacebookFanCount(facebookPageId);
}
else if(media == 3)
{
value = getInstagramFollowerCount(instagramPageId, instagramAccessToken);
}
firstCallDone[media] = true;
mediaLastCallMillis[media] = millis();
mediaLastValue[media] = value;
return value;
}
void delayWithHandling(long ms)
{
unsigned long delayStartMillis = millis();
while(millis() - delayStartMillis < ms)
{
delay(50);
ArduinoOTA.handle();
server.handleClient();
}
}
void loop()
{
ArduinoOTA.handle();
server.handleClient();
for(int media = 0; media < mediaCount; media++)
{
if(!mediaEnabled[media])
{
continue; // Le média n'est pas activé
}
else
{
bool logoDisplayed = previousMedia == media;
previousMedia = media;
unsigned long mediaStartMillis = millis();
unsigned long lastRefreshMillis = 0;
while(millis() - mediaStartMillis < mediaDuration[media] * 1000)
{
if(!mediaEnabled[media])
{
break; // Le média n'est pas activé
}
if(millis() - lastRefreshMillis >= refreshInterval)
{
lastRefreshMillis = millis();
int value = getMediaValue(media);
Serial.print(mediaName[media]);
Serial.print(" : ");
Serial.println(value);
Serial.println();
if(!logoDisplayed)
{
printMediaLogoWithAnimation(media);
print6DigitsNumberWithAnimation(value, 11, 0, 255, 255, 255, 1);
logoDisplayed = true;
}
else
{
print6DigitsNumberWithAnimation(value, 11, 0, 255, 255, 255);
}
previousNumber = value;
refreshDisplay();
}
delayWithHandling(50);
}
}
}
}
| [
"fardenco@live.fr"
] | fardenco@live.fr |
8aa9addea3242d668c283b884abc86be947bfaa2 | 2c05eb4a1ae4a1a1af2658aa2f4a7ee7c9a16b37 | /p126_1_whileLoop.cpp | f44a444ec619cdc74d96e5afd5b85ae8034db1c4 | [] | no_license | philippds-learn/Programming-Principles-and-Practice-Using-Cpp_Bjarne-Stroustrup_Chapter-02-11 | e668ec437d0e2c55998f332a2c1cf14899964c90 | ae64cce29b8ab56e02c7b7d0d7ad2192d8746cf5 | refs/heads/master | 2021-10-26T04:54:13.149956 | 2019-04-10T18:02:51 | 2019-04-10T18:02:51 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 343 | cpp | // Philipp Siedler
// Bjarne Stroustrup's PP
// Chapter 4 Drill 1
#include "std_lib_facilities.h"
int main()
{
cout << "type in two integers or a '|' to terminate the program:\n";
int x1;
int x2;
while (cin >> x1 >> x2)
{
if (x1 == '|')
{
return 0;
}
else
cout << x1 << ", " << x2 << "\n";
}
keep_window_open(".");
} | [
"p.d.siedler@gmail.com"
] | p.d.siedler@gmail.com |
ca591de42c16f0cc1c4374d17f7eb7647b17870a | 6abb92d99ff4218866eafab64390653addbf0d64 | /AtCoder/abc/abc062/b.cpp | 2e6436773c75887f1f90589494e32efe09ce4e53 | [] | no_license | Johannyjm/c-pro | 38a7b81aff872b2246e5c63d6e49ef3dfb0789ae | 770f2ac419b31bb0d47c4ee93c717c0c98c1d97d | refs/heads/main | 2023-08-18T01:02:23.761499 | 2023-08-07T15:13:58 | 2023-08-07T15:13:58 | 217,938,272 | 0 | 0 | null | 2023-06-25T15:11:37 | 2019-10-28T00:51:09 | C++ | UTF-8 | C++ | false | false | 504 | cpp | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
int main() {
cin.tie(nullptr);
ios::sync_with_stdio(false);
int h, w;
cin >> h >> w;
char a[h][w];
rep(i, h){
rep(j, w){
cin >> a[i][j];
}
}
rep(i, h+2){
cout << '#';
rep(j, w){
if(i == 0 || i == h+1) cout << '#';
else cout << a[i-1][j];
}
cout << '#' << endl;
}
} | [
"meetpastarts@gmail.com"
] | meetpastarts@gmail.com |
bd066d2ee11ced282900765f5a9b6befea717213 | 6ce049ad0073d7d5e14efde081c94d9432a15d35 | /Gi/codeforces/557C.cpp | d9f814ff4d9817a01c7747a82e89bc9897cf937d | [] | no_license | yancouto/maratona-sua-mae | 0f1377c2902375dc3157e6895624e198f52151e0 | 75f5788f981b3baeb6488bbf3483062fa355c394 | refs/heads/master | 2020-05-31T03:26:21.233601 | 2016-08-19T03:28:22 | 2016-08-19T03:28:37 | 38,175,020 | 6 | 2 | null | null | null | null | UTF-8 | C++ | false | false | 1,324 | cpp | //#include <bits/stdc++.h>
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
#define fst first
#define snd second
typedef pair<int, int> pii;
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
#define pb push_back
#define for_tests(t, tt) int t; scanf("%d", &t); for(int tt = 1; tt <= t; tt++)
template<typename T> inline T abs(T t) { return t < 0? -t : t; }
const ull modn = 1000000007;
inline ull mod(ull x) { return x % modn; }
int n;
int d[100005];
int maskd[210];
struct Leg{
int l, d;
};
bool myfunction(Leg a, Leg b){
return a.l < b.l;
}
Leg info[100005];
int main(){
scanf("%d", &n);
for(int i = 0; i < n; i++)
scanf("%d", &info[i].l);
for(int i = 0; i < n; i++)
scanf("%d", &info[i].d);
sort(info, info+n, myfunction);
d[0] = info[0].d;
for(int i = 1; i < n; i++)
d[i] = d[i-1] + info[i].d;
int ans = 1000000000;
for(int i = 0; i < n;){
int value = info[i].l;
int j;
for(j = i+1; info[j].l == value && j < n; j++);
int cost = d[n-1]-d[j-1];
int need = j - (j-i-1)*2 -1;
for(int k = 1; k <= 200 && need > 0; k++){
cost += k*min(maskd[k], need);
need -= min(maskd[k], need);
}
ans = min(ans, cost);
for(j = i; info[j].l == value && j < n; j++)
maskd[info[j].d]++;
i = j;
}
printf("%d\n", ans);
return 0;
}
| [
"giovana.delfino@gmail.com"
] | giovana.delfino@gmail.com |
b75aca9b0071b4e3ee23454d4710e1cd6443bd63 | 188fb8ded33ad7a2f52f69975006bb38917437ef | /Fluid/processor3/0.41/pointDisplacement | ca61fa222c6a66a4e543376bda9d0624a3a7ceea | [] | no_license | abarcaortega/Tuto_2 | 34a4721f14725c20471ff2dc8d22b52638b8a2b3 | 4a84c22efbb9cd2eaeda92883343b6910e0941e2 | refs/heads/master | 2020-08-05T16:11:57.674940 | 2019-10-04T09:56:09 | 2019-10-04T09:56:09 | 212,573,883 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 25,639 | /*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class pointVectorField;
location "0.41";
object pointDisplacement;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 1 0 0 0 0 0];
internalField nonuniform List<vector>
1030
(
(0 0 0)
(0.00759364 0 0)
(0.0145001 0 0)
(0.0205827 0 0)
(0.0259384 0 0)
(0.0306536 0 0)
(0.0348014 0 0)
(0.0384449 0 0)
(0.0416394 0 0)
(0.0444327 0 0)
(0.0468667 0 0)
(0.0489774 0 0)
(0.0507958 0 0)
(0.0523485 0 0)
(0.0536576 0 0)
(0.0547411 0 0)
(0.0556136 0 0)
(0.0562859 0 0)
(0.0567653 0 0)
(0.0570556 0 0)
(0.057157 0 0)
(0.0570653 0 0)
(0 0 0)
(0.00759125 0 0.000264974)
(0.0144968 0 0.000510173)
(0.0205781 0 0.00073116)
(0.0259328 0 0.000931004)
(0.0306474 0 0.00111256)
(0.0347948 0 0.00127748)
(0.0384382 0 0.00142657)
(0.0416327 0 0.00155995)
(0.0444264 0 0.001677)
(0.046861 0 0.0017765)
(0.0489728 0 0.00185664)
(0.050793 0 0.00191511)
(0.052348 0 0.00194924)
(0.0536603 0 0.0019562)
(0.0547483 0 0.00193328)
(0.0556266 0 0.00187823)
(0.0563065 0 0.00178976)
(0.056796 0 0.00166806)
(0.0570998 0 0.0015153)
(0.0572193 0 0.00133602)
(0.0571526 0 0.00113715)
(0 0 0)
(0.00758726 0 0.000530132)
(0.0144894 0 0.00102017)
(0.0205665 0 0.0014616)
(0.0259177 0 0.00186124)
(0.0306302 0 0.00222461)
(0.0347761 0 0.00255495)
(0.0384187 0 0.00285398)
(0.0416132 0 0.00312195)
(0.0444077 0 0.00335776)
(0.0468442 0 0.00355903)
(0.0489592 0 0.00372224)
(0.0507842 0 0.00384285)
(0.0523461 0 0.0039156)
(0.0536679 0 0.00393481)
(0.0547687 0 0.00389499)
(0.055664 0 0.00379146)
(0.0563664 0 0.00362131)
(0.0568853 0 0.00338445)
(0.057228 0 0.00308463)
(0.0573996 0 0.00273045)
(0.0574042 0 0.00233526)
(0 0 0)
(0.00757881 0 0.000795618)
(0.0144739 0 0.00153033)
(0.0205455 0 0.00219216)
(0.0258923 0 0.00279229)
(0.0306015 0 0.00333848)
(0.034745 0 0.00383574)
(0.0383862 0 0.00428678)
(0.0415805 0 0.00469215)
(0.0443762 0 0.0050504)
(0.0468157 0 0.00535818)
(0.0489357 0 0.00561041)
(0.0507684 0 0.00580048)
(0.0523413 0 0.00592061)
(0.0536783 0 0.00596232)
(0.0547995 0 0.00591714)
(0.0557219 0 0.00577759)
(0.0564597 0 0.00553848)
(0.0570249 0 0.00519842)
(0.0574278 0 0.00476155)
(0.0576784 0 0.00423913)
(0.0577879 0 0.00365032)
(0 0 0)
(0.00756612 0 0.00106039)
(0.0144505 0 0.0020399)
(0.0205153 0 0.00292307)
(0.025857 0 0.00372468)
(0.0305615 0 0.0044551)
(0.0347015 0 0.00512129)
(0.0383407 0 0.00572712)
(0.0415345 0 0.00627364)
(0.0443317 0 0.00675925)
(0.0467748 0 0.00717985)
(0.0489013 0 0.00752904)
(0.0507439 0 0.00779837)
(0.0523312 0 0.0079777)
(0.0536879 0 0.00805575)
(0.0548357 0 0.0080209)
(0.0557932 0 0.00786239)
(0.0565766 0 0.00757183)
(0.0572004 0 0.00714522)
(0.0576782 0 0.00658516)
(0.0580239 0 0.00590336)
(0.0582542 0 0.00512261)
(0 0 0)
(0.0075512 0 0.00132325)
(0.0144227 0 0.00254647)
(0.0204781 0 0.00365045)
(0.0258123 0 0.00465325)
(0.0305106 0 0.00556823)
(0.034646 0 0.00640443)
(0.0382822 0 0.0071671)
(0.041475 0 0.00785799)
(0.0442735 0 0.00847564)
(0.0467206 0 0.00901551)
(0.0488544 0 0.00947023)
(0.0507084 0 0.00982984)
(0.0523122 0 0.0100821)
(0.0536917 0 0.0102132)
(0.0548701 0 0.0102083)
(0.0558678 0 0.0100529)
(0.056703 0 0.00973468)
(0.0573926 0 0.00924541)
(0.0579525 0 0.008584)
(0.0583993 0 0.00775966)
(0.0587519 0 0.00679538)
(0 0 0)
(0.00753392 0 0.00158338)
(0.0143904 0 0.00304774)
(0.0204337 0 0.00437036)
(0.0257583 0 0.00557291)
(0.0304487 0 0.00667174)
(0.0345781 0 0.00767817)
(0.0382103 0 0.008599)
(0.0414014 0 0.009437)
(0.0442007 0 0.0101911)
(0.0466517 0 0.0108569)
(0.0487929 0 0.0114263)
(0.0506588 0 0.0118884)
(0.0522799 0 0.0122294)
(0.0536835 0 0.0124332)
(0.0548942 0 0.012482)
(0.0559342 0 0.0123576)
(0.0568237 0 0.0120429)
(0.0575812 0 0.0115242)
(0.0582245 0 0.0107941)
(0.058771 0 0.0098559)
(0.059239 0 0.00872818)
(0 0 0)
(0.00751414 0 0.00184001)
(0.0143531 0 0.00354226)
(0.020382 0 0.00508083)
(0.0256948 0 0.00648114)
(0.0303756 0 0.0077627)
(0.0344976 0 0.00893922)
(0.0381246 0 0.0100193)
(0.041313 0 0.0110071)
(0.0441122 0 0.0119023)
(0.0465663 0 0.0127008)
(0.0487144 0 0.0133948)
(0.0505917 0 0.0139728)
(0.0522297 0 0.01442)
(0.0536569 0 0.0147188)
(0.0548994 0 0.014849)
(0.0559811 0 0.0147887)
(0.0569237 0 0.0145161)
(0.0577473 0 0.0140107)
(0.0584706 0 0.013257)
(0.0591106 0 0.0122479)
(0.0596834 0 0.0109917)
(0 0 0)
(0.00749172 0 0.00209239)
(0.0143108 0 0.00402867)
(0.0203229 0 0.0057799)
(0.0256217 0 0.00737549)
(0.0302911 0 0.00883818)
(0.034404 0 0.0101843)
(0.0380245 0 0.0114245)
(0.0412088 0 0.0125644)
(0.0440067 0 0.0136051)
(0.0464628 0 0.0145434)
(0.0486165 0 0.0153721)
(0.0505037 0 0.0160799)
(0.0521568 0 0.016652)
(0.0536056 0 0.0170699)
(0.0548773 0 0.017312)
(0.0559972 0 0.0173537)
(0.0569885 0 0.0171686)
(0.0578728 0 0.0167297)
(0.0586691 0 0.0160118)
(0.0593939 0 0.0149937)
(0.0600602 0 0.0136665)
(0 0 0)
(0.00746656 0 0.00233982)
(0.0142631 0 0.00450559)
(0.020256 0 0.00646565)
(0.0255387 0 0.00825347)
(0.0301948 0 0.00989519)
(0.034297 0 0.0114099)
(0.0379092 0 0.0128105)
(0.041088 0 0.0141045)
(0.0438832 0 0.0152948)
(0.0463394 0 0.0163794)
(0.0484968 0 0.0173525)
(0.0503916 0 0.0182039)
(0.052057 0 0.0189196)
(0.0535237 0 0.0194815)
(0.0548198 0 0.0198677)
(0.0559721 0 0.0200522)
(0.057005 0 0.0200056)
(0.0579414 0 0.0196955)
(0.0588008 0 0.0190885)
(0.0595995 0 0.0181463)
(0.060349 0 0.0168361)
(0 0 0)
(0.00743856 0 0.00258153)
(0.0142099 0 0.00497158)
(0.0201813 0 0.00713599)
(0.0254457 0 0.0091124)
(0.0300864 0 0.0109304)
(0.0341761 0 0.012612)
(0.0377785 0 0.0141727)
(0.0409499 0 0.0156221)
(0.0437404 0 0.0169651)
(0.0461948 0 0.0182018)
(0.0483533 0 0.0193281)
(0.0502526 0 0.0203358)
(0.0519265 0 0.0212128)
(0.053406 0 0.0219426)
(0.0547203 0 0.0225048)
(0.0558968 0 0.0228739)
(0.0569615 0 0.0230197)
(0.0579384 0 0.0229066)
(0.058848 0 0.0224952)
(0.0597071 0 0.0217334)
(0.0605284 0 0.0205643)
(0 0 0)
(0.00740773 0 0.0028166)
(0.0141513 0 0.00542478)
(0.0200987 0 0.00778815)
(0.0253426 0 0.00994859)
(0.0299661 0 0.0119393)
(0.0340413 0 0.0137852)
(0.037632 0 0.0155044)
(0.0407942 0 0.0171093)
(0.043578 0 0.0186067)
(0.0460281 0 0.0199994)
(0.0481848 0 0.0212856)
(0.050085 0 0.0224599)
(0.0517626 0 0.023513)
(0.053249 0 0.0244315)
(0.0545737 0 0.0251982)
(0.0557647 0 0.0257905)
(0.0568487 0 0.0261804)
(0.0578512 0 0.0263326)
(0.058794 0 0.0262029)
(0.059696 0 0.0257366)
(0.0605737 0 0.0248643)
(0 0 0)
(0.00737415 0 0.00304374)
(0.0140872 0 0.00586264)
(0.0200083 0 0.00841835)
(0.0252296 0 0.010757)
(0.0298338 0 0.0129153)
(0.0338928 0 0.0149215)
(0.0374699 0 0.0167962)
(0.040621 0 0.0185545)
(0.0433958 0 0.0202059)
(0.0458391 0 0.0217557)
(0.0479909 0 0.0232053)
(0.049888 0 0.0245524)
(0.0515642 0 0.0257915)
(0.0530509 0 0.0269135)
(0.0543774 0 0.0279058)
(0.0555719 0 0.0287517)
(0.056661 0 0.0294288)
(0.0576709 0 0.0299074)
(0.0586252 0 0.0301463)
(0.0595463 0 0.0300992)
(0.060456 0 0.0297007)
(0 0 0)
(0.00733759 0 0.00326201)
(0.0140175 0 0.00628336)
(0.0199097 0 0.00902401)
(0.0251063 0 0.0115343)
(0.0296892 0 0.0138544)
(0.03373 0 0.0160157)
(0.0372917 0 0.0180417)
(0.0404296 0 0.0199501)
(0.0431933 0 0.0217533)
(0.0456271 0 0.0234595)
(0.0477707 0 0.0250732)
(0.0496607 0 0.026596)
(0.0513302 0 0.0280267)
(0.0528103 0 0.0293614)
(0.0541298 0 0.0305939)
(0.0553161 0 0.0317152)
(0.0563953 0 0.0327126)
(0.0573928 0 0.0335684)
(0.0583333 0 0.0342577)
(0.0592416 0 0.0347527)
(0.0601439 0 0.0350126)
(0 0 0)
(0.00729775 0 0.00347103)
(0.0139415 0 0.00668629)
(0.0198025 0 0.00960428)
(0.024972 0 0.0122794)
(0.0295316 0 0.0147553)
(0.0335524 0 0.0170665)
(0.0370965 0 0.0192393)
(0.0402193 0 0.0212942)
(0.0429695 0 0.0232463)
(0.045391 0 0.0251071)
(0.0475232 0 0.0268844)
(0.0494018 0 0.0285839)
(0.0510594 0 0.0302092)
(0.0525262 0 0.0317624)
(0.0538299 0 0.0332448)
(0.0549966 0 0.0346567)
(0.0560509 0 0.0359983)
(0.0570162 0 0.0372689)
(0.0579159 0 0.0384685)
(0.0587737 0 0.0395995)
(0.0596155 0 0.0406642)
(0 0 0)
(0.00725401 0 0.00367239)
(0.0138583 0 0.00707442)
(0.0196851 0 0.0101633)
(0.0248251 0 0.0129976)
(0.0293591 0 0.0156244)
(0.0333576 0 0.018081)
(0.0368822 0 0.0203967)
(0.0399875 0 0.0225947)
(0.0427219 0 0.024693)
(0.0451284 0 0.0267061)
(0.0472459 0 0.0286454)
(0.0491093 0 0.0305207)
(0.0507502 0 0.0323403)
(0.0521976 0 0.0341127)
(0.0534778 0 0.0358467)
(0.054615 0 0.0375527)
(0.0556314 0 0.0392439)
(0.0565475 0 0.0409379)
(0.0573827 0 0.042659)
(0.0581558 0 0.0444422)
(0.0588854 0 0.0463335)
(0 0 0)
(0.00759364 0 0)
(0.0145001 0 0)
(0.0205827 0 0)
(0.0259384 0 0)
(0.0306536 0 0)
(0.0348014 0 0)
(0.0384449 0 0)
(0.0416394 0 0)
(0.0444327 0 0)
(0.0468667 0 0)
(0.0489774 0 0)
(0.0507958 0 0)
(0.0523485 0 0)
(0.0536576 0 0)
(0.0547411 0 0)
(0.0556136 0 0)
(0.0562859 0 0)
(0.0567653 0 0)
(0.0570556 0 0)
(0.057157 0 0)
(0.0570653 0 0)
(0 0 0)
(0.00759125 0 0.000264974)
(0.0144968 0 0.000510173)
(0.0205781 0 0.00073116)
(0.0259328 0 0.000931004)
(0.0306474 0 0.00111256)
(0.0347948 0 0.00127748)
(0.0384382 0 0.00142657)
(0.0416327 0 0.00155995)
(0.0444264 0 0.001677)
(0.046861 0 0.0017765)
(0.0489728 0 0.00185664)
(0.050793 0 0.00191511)
(0.052348 0 0.00194924)
(0.0536603 0 0.0019562)
(0.0547483 0 0.00193328)
(0.0556266 0 0.00187823)
(0.0563065 0 0.00178976)
(0.056796 0 0.00166806)
(0.0570998 0 0.0015153)
(0.0572193 0 0.00133602)
(0.0571526 0 0.00113715)
(0 0 0)
(0.00758726 0 0.000530132)
(0.0144894 0 0.00102017)
(0.0205665 0 0.0014616)
(0.0259177 0 0.00186124)
(0.0306302 0 0.00222461)
(0.0347761 0 0.00255495)
(0.0384187 0 0.00285398)
(0.0416132 0 0.00312195)
(0.0444077 0 0.00335776)
(0.0468442 0 0.00355903)
(0.0489592 0 0.00372224)
(0.0507842 0 0.00384285)
(0.0523461 0 0.0039156)
(0.0536679 0 0.00393481)
(0.0547687 0 0.00389499)
(0.055664 0 0.00379146)
(0.0563664 0 0.00362131)
(0.0568853 0 0.00338445)
(0.057228 0 0.00308463)
(0.0573996 0 0.00273045)
(0.0574042 0 0.00233526)
(0 0 0)
(0.00757881 0 0.000795618)
(0.0144739 0 0.00153033)
(0.0205455 0 0.00219216)
(0.0258923 0 0.00279229)
(0.0306015 0 0.00333848)
(0.034745 0 0.00383574)
(0.0383862 0 0.00428678)
(0.0415805 0 0.00469215)
(0.0443762 0 0.0050504)
(0.0468157 0 0.00535818)
(0.0489357 0 0.00561041)
(0.0507684 0 0.00580048)
(0.0523413 0 0.00592061)
(0.0536783 0 0.00596232)
(0.0547995 0 0.00591714)
(0.0557219 0 0.00577759)
(0.0564597 0 0.00553848)
(0.0570249 0 0.00519842)
(0.0574278 0 0.00476155)
(0.0576784 0 0.00423913)
(0.0577879 0 0.00365032)
(0 0 0)
(0.00756612 0 0.00106039)
(0.0144505 0 0.0020399)
(0.0205153 0 0.00292307)
(0.025857 0 0.00372468)
(0.0305615 0 0.0044551)
(0.0347015 0 0.00512129)
(0.0383407 0 0.00572712)
(0.0415345 0 0.00627364)
(0.0443317 0 0.00675925)
(0.0467748 0 0.00717985)
(0.0489013 0 0.00752904)
(0.0507439 0 0.00779837)
(0.0523312 0 0.0079777)
(0.0536879 0 0.00805575)
(0.0548357 0 0.0080209)
(0.0557932 0 0.00786239)
(0.0565766 0 0.00757183)
(0.0572004 0 0.00714522)
(0.0576782 0 0.00658516)
(0.0580239 0 0.00590336)
(0.0582542 0 0.00512261)
(0 0 0)
(0.0075512 0 0.00132325)
(0.0144227 0 0.00254647)
(0.0204781 0 0.00365045)
(0.0258123 0 0.00465325)
(0.0305106 0 0.00556823)
(0.034646 0 0.00640443)
(0.0382822 0 0.0071671)
(0.041475 0 0.00785799)
(0.0442735 0 0.00847564)
(0.0467206 0 0.00901551)
(0.0488544 0 0.00947023)
(0.0507084 0 0.00982984)
(0.0523122 0 0.0100821)
(0.0536917 0 0.0102132)
(0.0548701 0 0.0102083)
(0.0558678 0 0.0100529)
(0.056703 0 0.00973468)
(0.0573926 0 0.00924541)
(0.0579525 0 0.008584)
(0.0583993 0 0.00775966)
(0.0587519 0 0.00679538)
(0 0 0)
(0.00753392 0 0.00158338)
(0.0143904 0 0.00304774)
(0.0204337 0 0.00437036)
(0.0257583 0 0.00557291)
(0.0304487 0 0.00667174)
(0.0345781 0 0.00767817)
(0.0382103 0 0.008599)
(0.0414014 0 0.009437)
(0.0442007 0 0.0101911)
(0.0466517 0 0.0108569)
(0.0487929 0 0.0114263)
(0.0506588 0 0.0118884)
(0.0522799 0 0.0122294)
(0.0536835 0 0.0124332)
(0.0548942 0 0.012482)
(0.0559342 0 0.0123576)
(0.0568237 0 0.0120429)
(0.0575812 0 0.0115242)
(0.0582245 0 0.0107941)
(0.058771 0 0.0098559)
(0.059239 0 0.00872818)
(0 0 0)
(0.00751414 0 0.00184001)
(0.0143531 0 0.00354226)
(0.020382 0 0.00508083)
(0.0256948 0 0.00648114)
(0.0303756 0 0.0077627)
(0.0344976 0 0.00893922)
(0.0381246 0 0.0100193)
(0.041313 0 0.0110071)
(0.0441122 0 0.0119023)
(0.0465663 0 0.0127008)
(0.0487144 0 0.0133948)
(0.0505917 0 0.0139728)
(0.0522297 0 0.01442)
(0.0536569 0 0.0147188)
(0.0548994 0 0.014849)
(0.0559811 0 0.0147887)
(0.0569237 0 0.0145161)
(0.0577473 0 0.0140107)
(0.0584706 0 0.013257)
(0.0591106 0 0.0122479)
(0.0596834 0 0.0109917)
(0 0 0)
(0.00749172 0 0.00209239)
(0.0143108 0 0.00402867)
(0.0203229 0 0.0057799)
(0.0256217 0 0.00737549)
(0.0302911 0 0.00883818)
(0.034404 0 0.0101843)
(0.0380245 0 0.0114245)
(0.0412088 0 0.0125644)
(0.0440067 0 0.0136051)
(0.0464628 0 0.0145434)
(0.0486165 0 0.0153721)
(0.0505037 0 0.0160799)
(0.0521568 0 0.016652)
(0.0536056 0 0.0170699)
(0.0548773 0 0.017312)
(0.0559972 0 0.0173537)
(0.0569885 0 0.0171686)
(0.0578728 0 0.0167297)
(0.0586691 0 0.0160118)
(0.0593939 0 0.0149937)
(0.0600602 0 0.0136665)
(0 0 0)
(0.00746656 0 0.00233982)
(0.0142631 0 0.00450559)
(0.020256 0 0.00646565)
(0.0255387 0 0.00825347)
(0.0301948 0 0.00989519)
(0.034297 0 0.0114099)
(0.0379092 0 0.0128105)
(0.041088 0 0.0141045)
(0.0438832 0 0.0152948)
(0.0463394 0 0.0163794)
(0.0484968 0 0.0173525)
(0.0503916 0 0.0182039)
(0.052057 0 0.0189196)
(0.0535237 0 0.0194815)
(0.0548198 0 0.0198677)
(0.0559721 0 0.0200522)
(0.057005 0 0.0200056)
(0.0579414 0 0.0196955)
(0.0588008 0 0.0190885)
(0.0595995 0 0.0181463)
(0.060349 0 0.0168361)
(0 0 0)
(0.00743856 0 0.00258153)
(0.0142099 0 0.00497158)
(0.0201813 0 0.00713599)
(0.0254457 0 0.0091124)
(0.0300864 0 0.0109304)
(0.0341761 0 0.012612)
(0.0377785 0 0.0141727)
(0.0409499 0 0.0156221)
(0.0437404 0 0.0169651)
(0.0461948 0 0.0182018)
(0.0483533 0 0.0193281)
(0.0502526 0 0.0203358)
(0.0519265 0 0.0212128)
(0.053406 0 0.0219426)
(0.0547203 0 0.0225048)
(0.0558968 0 0.0228739)
(0.0569615 0 0.0230197)
(0.0579384 0 0.0229066)
(0.058848 0 0.0224952)
(0.0597071 0 0.0217334)
(0.0605284 0 0.0205643)
(0 0 0)
(0.00740773 0 0.0028166)
(0.0141513 0 0.00542478)
(0.0200987 0 0.00778815)
(0.0253426 0 0.00994859)
(0.0299661 0 0.0119393)
(0.0340413 0 0.0137852)
(0.037632 0 0.0155044)
(0.0407942 0 0.0171093)
(0.043578 0 0.0186067)
(0.0460281 0 0.0199994)
(0.0481848 0 0.0212856)
(0.050085 0 0.0224599)
(0.0517626 0 0.023513)
(0.053249 0 0.0244315)
(0.0545737 0 0.0251982)
(0.0557647 0 0.0257905)
(0.0568487 0 0.0261804)
(0.0578512 0 0.0263326)
(0.058794 0 0.0262029)
(0.059696 0 0.0257366)
(0.0605737 0 0.0248643)
(0 0 0)
(0.00737415 0 0.00304374)
(0.0140872 0 0.00586264)
(0.0200083 0 0.00841835)
(0.0252296 0 0.010757)
(0.0298338 0 0.0129153)
(0.0338928 0 0.0149215)
(0.0374699 0 0.0167962)
(0.040621 0 0.0185545)
(0.0433958 0 0.0202059)
(0.0458391 0 0.0217557)
(0.0479909 0 0.0232053)
(0.049888 0 0.0245524)
(0.0515642 0 0.0257915)
(0.0530509 0 0.0269135)
(0.0543774 0 0.0279058)
(0.0555719 0 0.0287517)
(0.056661 0 0.0294288)
(0.0576709 0 0.0299074)
(0.0586252 0 0.0301463)
(0.0595463 0 0.0300992)
(0.060456 0 0.0297007)
(0 0 0)
(0.00733759 0 0.00326201)
(0.0140175 0 0.00628336)
(0.0199097 0 0.00902401)
(0.0251063 0 0.0115343)
(0.0296892 0 0.0138544)
(0.03373 0 0.0160157)
(0.0372917 0 0.0180417)
(0.0404296 0 0.0199501)
(0.0431933 0 0.0217533)
(0.0456271 0 0.0234595)
(0.0477707 0 0.0250732)
(0.0496607 0 0.026596)
(0.0513302 0 0.0280267)
(0.0528103 0 0.0293614)
(0.0541298 0 0.0305939)
(0.0553161 0 0.0317152)
(0.0563953 0 0.0327126)
(0.0573928 0 0.0335684)
(0.0583333 0 0.0342577)
(0.0592416 0 0.0347527)
(0.0601439 0 0.0350126)
(0 0 0)
(0.00729775 0 0.00347103)
(0.0139415 0 0.00668629)
(0.0198025 0 0.00960428)
(0.024972 0 0.0122794)
(0.0295316 0 0.0147553)
(0.0335524 0 0.0170665)
(0.0370965 0 0.0192393)
(0.0402193 0 0.0212942)
(0.0429695 0 0.0232463)
(0.045391 0 0.0251071)
(0.0475232 0 0.0268844)
(0.0494018 0 0.0285839)
(0.0510594 0 0.0302092)
(0.0525262 0 0.0317624)
(0.0538299 0 0.0332448)
(0.0549966 0 0.0346567)
(0.0560509 0 0.0359983)
(0.0570162 0 0.0372689)
(0.0579159 0 0.0384685)
(0.0587737 0 0.0395995)
(0.0596155 0 0.0406642)
(0 0 0)
(0.00725401 0 0.00367239)
(0.0138583 0 0.00707442)
(0.0196851 0 0.0101633)
(0.0248251 0 0.0129976)
(0.0293591 0 0.0156244)
(0.0333576 0 0.018081)
(0.0368822 0 0.0203967)
(0.0399875 0 0.0225947)
(0.0427219 0 0.024693)
(0.0451284 0 0.0267061)
(0.0472459 0 0.0286454)
(0.0491093 0 0.0305207)
(0.0507502 0 0.0323403)
(0.0521976 0 0.0341127)
(0.0534778 0 0.0358467)
(0.054615 0 0.0375527)
(0.0556314 0 0.0392439)
(0.0565475 0 0.0409379)
(0.0573827 0 0.042659)
(0.0581558 0 0.0444422)
(0.0588854 0 0.0463335)
(0.0137666 0 0.00745223)
(0.0195554 0 0.0107072)
(0.0246627 0 0.0136963)
(0.0291684 0 0.01647)
(0.0331421 0 0.0190684)
(0.0366447 0 0.0215236)
(0.0397302 0 0.0238613)
(0.0424462 0 0.0261024)
(0.0448352 0 0.0282643)
(0.0469349 0 0.0303617)
(0.0487795 0 0.032408)
(0.0503996 0 0.0344162)
(0.0518225 0 0.0364)
(0.053073 0 0.0383748)
(0.0541732 0 0.0403593)
(0.0551423 0 0.0423771)
(0.0559974 0 0.0444592)
(0.0567528 0 0.0466467)
(0.0574197 0 0.0489951)
(0.0580061 0 0.0515775)
(0.0194128 0 0.0112311)
(0.0244839 0 0.0143687)
(0.0289583 0 0.0172835)
(0.0329047 0 0.0200183)
(0.036383 0 0.0226074)
(0.0394463 0 0.0250791)
(0.0421416 0 0.0274568)
(0.0445104 0 0.0297604)
(0.0465897 0 0.0320075)
(0.0484125 0 0.0342146)
(0.0500081 0 0.0363983)
(0.0514026 0 0.0385762)
(0.0526189 0 0.0407684)
(0.0536768 0 0.042999)
(0.054593 0 0.0452973)
(0.0553808 0 0.0477007)
(0.0560495 0 0.0502563)
(0.0566039 0 0.053024)
(0.057042 0 0.0560793)
(0.0242887 0 0.0150062)
(0.0287288 0 0.018054)
(0.0326451 0 0.0209173)
(0.0360968 0 0.0236326)
(0.0391357 0 0.0262301)
(0.0418081 0 0.0287354)
(0.0441545 0 0.0311705)
(0.0462109 0 0.0335552)
(0.0480094 0 0.0359086)
(0.0495779 0 0.0382494)
(0.0509412 0 0.040598)
(0.0521204 0 0.0429768)
(0.0531334 0 0.0454119)
(0.0539943 0 0.0479344)
(0.0547135 0 0.0505813)
(0.0552966 0 0.0533967)
(0.0557439 0 0.0564324)
(0.0560481 0 0.0597466)
(0.0284787 0 0.018775)
(0.0323622 0 0.0217573)
(0.0357847 0 0.0245895)
(0.0387972 0 0.0273031)
(0.0414445 0 0.0299252)
(0.0437665 0 0.0324796)
(0.0457982 0 0.0349878)
(0.0475703 0 0.0374699)
(0.04911 0 0.0399463)
(0.0504405 0 0.0424381)
(0.0515815 0 0.0449681)
(0.0525491 0 0.047562)
(0.0533559 0 0.0502483)
(0.0540099 0 0.0530591)
(0.054515 0 0.0560298)
(0.0548693 0 0.0591967)
(0.0550647 0 0.0625946)
(0.0320552 0 0.0225309)
(0.0354461 0 0.0254688)
(0.0384298 0 0.0282869)
(0.0410502 0 0.0310135)
(0.0433461 0 0.0336734)
(0.0453514 0 0.0362885)
(0.0470961 0 0.0388798)
(0.048606 0 0.0414678)
(0.0499032 0 0.0440732)
(0.0510065 0 0.0467174)
(0.0519308 0 0.0494231)
(0.0526873 0 0.0522142)
(0.0532833 0 0.0551152)
(0.0537221 0 0.0581495)
(0.0540021 0 0.0613374)
(0.0541171 0 0.064691)
(0.0350803 0 0.0262617)
(0.0380332 0 0.0291713)
(0.0406249 0 0.0319883)
(0.0428933 0 0.0347379)
(0.0448714 0 0.0374422)
(0.0465879 0 0.0401216)
(0.0480679 0 0.0427962)
(0.0493328 0 0.0454847)
(0.0504004 0 0.0482062)
(0.0512849 0 0.0509792)
(0.0519971 0 0.0538212)
(0.0525445 0 0.0567484)
(0.0529307 0 0.0597728)
(0.0531562 0 0.0628999)
(0.0532178 0 0.0661249)
(0.0401691 0 0.0328386)
(0.0424088 0 0.0356606)
(0.0443589 0 0.0384349)
(0.0460473 0 0.0411809)
(0.0474983 0 0.0439167)
(0.0487326 0 0.0466588)
(0.0497676 0 0.0494228)
(0.0506172 0 0.0522225)
(0.0512925 0 0.0550693)
(0.0518015 0 0.057971)
(0.0521493 0 0.0609301)
(0.0523386 0 0.0639409)
(0.0523703 0 0.0669874)
(0.0418937 0 0.0364311)
(0.0438157 0 0.0392556)
(0.0454765 0 0.0420459)
(0.0468999 0 0.044818)
(0.0481062 0 0.0475859)
(0.0491124 0 0.0503612)
(0.0499328 0 0.0531528)
(0.0505789 0 0.0559664)
(0.0510597 0 0.0588033)
(0.0513821 0 0.0616584)
(0.0515514 0 0.0645188)
(0.0515718 0 0.0673621)
(0.0448778 0 0.0427083)
(0.0462755 0 0.0454931)
(0.0474567 0 0.0482609)
(0.0484385 0 0.0510199)
(0.0492355 0 0.0537746)
(0.04986 0 0.0565258)
(0.0503221 0 0.0592696)
(0.0506305 0 0.0619959)
(0.0507929 0 0.0646878)
(0.0508162 0 0.0673203)
(0.0467872 0 0.0486825)
(0.047749 0 0.0514015)
(0.0485284 0 0.0540961)
(0.0491383 0 0.056763)
(0.0495901 0 0.0593949)
(0.049894 0 0.0619786)
(0.0500595 0 0.0644954)
(0.050096 0 0.0669207)
(0.0470467 0 0.0515115)
(0.0478136 0 0.0541277)
(0.0484151 0 0.0566947)
(0.0488635 0 0.0592029)
(0.0491704 0 0.0616381)
(0.0493467 0 0.0639813)
(0.0494032 0 0.0662096)
(0.047691 0 0.0563375)
(0.0481418 0 0.0587157)
(0.0484573 0 0.0610015)
(0.0486496 0 0.0631772)
(0.0487304 0 0.0652223)
(0.0477519 0 0.0600916)
(0.0479636 0 0.0621081)
(0.0480711 0 0.0639847)
(0.0137666 0 0.00745223)
(0.0195554 0 0.0107072)
(0.0246627 0 0.0136963)
(0.0291684 0 0.01647)
(0.0331421 0 0.0190684)
(0.0366447 0 0.0215236)
(0.0397302 0 0.0238613)
(0.0424462 0 0.0261024)
(0.0448352 0 0.0282643)
(0.0469349 0 0.0303617)
(0.0487795 0 0.032408)
(0.0503996 0 0.0344162)
(0.0518225 0 0.0364)
(0.053073 0 0.0383748)
(0.0541732 0 0.0403593)
(0.0551423 0 0.0423771)
(0.0559974 0 0.0444592)
(0.0567528 0 0.0466467)
(0.0574197 0 0.0489951)
(0.0580061 0 0.0515775)
(0.0194128 0 0.0112311)
(0.0244839 0 0.0143687)
(0.0289583 0 0.0172835)
(0.0329047 0 0.0200183)
(0.036383 0 0.0226074)
(0.0394463 0 0.0250791)
(0.0421416 0 0.0274568)
(0.0445104 0 0.0297604)
(0.0465897 0 0.0320075)
(0.0484125 0 0.0342146)
(0.0500081 0 0.0363983)
(0.0514026 0 0.0385762)
(0.0526189 0 0.0407684)
(0.0536768 0 0.042999)
(0.054593 0 0.0452973)
(0.0553808 0 0.0477007)
(0.0560495 0 0.0502563)
(0.0566039 0 0.053024)
(0.057042 0 0.0560793)
(0.0242887 0 0.0150062)
(0.0287288 0 0.018054)
(0.0326451 0 0.0209173)
(0.0360968 0 0.0236326)
(0.0391357 0 0.0262301)
(0.0418081 0 0.0287354)
(0.0441545 0 0.0311705)
(0.0462109 0 0.0335552)
(0.0480094 0 0.0359086)
(0.0495779 0 0.0382494)
(0.0509412 0 0.040598)
(0.0521204 0 0.0429768)
(0.0531334 0 0.0454119)
(0.0539943 0 0.0479344)
(0.0547135 0 0.0505813)
(0.0552966 0 0.0533967)
(0.0557439 0 0.0564324)
(0.0560481 0 0.0597466)
(0.0284787 0 0.018775)
(0.0323622 0 0.0217573)
(0.0357847 0 0.0245895)
(0.0387972 0 0.0273031)
(0.0414445 0 0.0299252)
(0.0437665 0 0.0324796)
(0.0457982 0 0.0349878)
(0.0475703 0 0.0374699)
(0.04911 0 0.0399463)
(0.0504405 0 0.0424381)
(0.0515815 0 0.0449681)
(0.0525491 0 0.047562)
(0.0533559 0 0.0502483)
(0.0540099 0 0.0530591)
(0.054515 0 0.0560298)
(0.0548693 0 0.0591967)
(0.0550647 0 0.0625946)
(0.0320552 0 0.0225309)
(0.0354461 0 0.0254688)
(0.0384298 0 0.0282869)
(0.0410502 0 0.0310135)
(0.0433461 0 0.0336734)
(0.0453514 0 0.0362885)
(0.0470961 0 0.0388798)
(0.048606 0 0.0414678)
(0.0499032 0 0.0440732)
(0.0510065 0 0.0467174)
(0.0519308 0 0.0494231)
(0.0526873 0 0.0522142)
(0.0532833 0 0.0551152)
(0.0537221 0 0.0581495)
(0.0540021 0 0.0613374)
(0.0541171 0 0.064691)
(0.0350803 0 0.0262617)
(0.0380332 0 0.0291713)
(0.0406249 0 0.0319883)
(0.0428933 0 0.0347379)
(0.0448714 0 0.0374422)
(0.0465879 0 0.0401216)
(0.0480679 0 0.0427962)
(0.0493328 0 0.0454847)
(0.0504004 0 0.0482062)
(0.0512849 0 0.0509792)
(0.0519971 0 0.0538212)
(0.0525445 0 0.0567484)
(0.0529307 0 0.0597728)
(0.0531562 0 0.0628999)
(0.0532178 0 0.0661249)
(0.0401691 0 0.0328386)
(0.0424088 0 0.0356606)
(0.0443589 0 0.0384349)
(0.0460473 0 0.0411809)
(0.0474983 0 0.0439167)
(0.0487326 0 0.0466588)
(0.0497676 0 0.0494228)
(0.0506172 0 0.0522225)
(0.0512925 0 0.0550693)
(0.0518015 0 0.057971)
(0.0521493 0 0.0609301)
(0.0523386 0 0.0639409)
(0.0523703 0 0.0669874)
(0.0418937 0 0.0364311)
(0.0438157 0 0.0392556)
(0.0454765 0 0.0420459)
(0.0468999 0 0.044818)
(0.0481062 0 0.0475859)
(0.0491124 0 0.0503612)
(0.0499328 0 0.0531528)
(0.0505789 0 0.0559664)
(0.0510597 0 0.0588033)
(0.0513821 0 0.0616584)
(0.0515514 0 0.0645188)
(0.0515718 0 0.0673621)
(0.0448778 0 0.0427083)
(0.0462755 0 0.0454931)
(0.0474567 0 0.0482609)
(0.0484385 0 0.0510199)
(0.0492355 0 0.0537746)
(0.04986 0 0.0565258)
(0.0503221 0 0.0592696)
(0.0506305 0 0.0619959)
(0.0507929 0 0.0646878)
(0.0508162 0 0.0673203)
(0.0467872 0 0.0486825)
(0.047749 0 0.0514015)
(0.0485284 0 0.0540961)
(0.0491383 0 0.056763)
(0.0495901 0 0.0593949)
(0.049894 0 0.0619786)
(0.0500595 0 0.0644954)
(0.050096 0 0.0669207)
(0.0470467 0 0.0515115)
(0.0478136 0 0.0541277)
(0.0484151 0 0.0566947)
(0.0488635 0 0.0592029)
(0.0491704 0 0.0616381)
(0.0493467 0 0.0639813)
(0.0494032 0 0.0662096)
(0.047691 0 0.0563375)
(0.0481418 0 0.0587157)
(0.0484573 0 0.0610015)
(0.0486496 0 0.0631772)
(0.0487304 0 0.0652223)
(0.0477519 0 0.0600916)
(0.0479636 0 0.0621081)
(0.0480711 0 0.0639847)
)
;
boundaryField
{
inlet
{
type fixedValue;
value uniform (0 0 0);
}
outlet
{
type fixedValue;
value nonuniform 0();
}
flap
{
type fixedValue;
value nonuniform 0();
}
upperWall
{
type slip;
}
lowerWall
{
type slip;
}
frontAndBack
{
type empty;
}
procBoundary3to0
{
type processor;
}
procBoundary3to1
{
type processor;
}
procBoundary3to4
{
type processor;
}
}
// ************************************************************************* //
| [
"aldo.abarca.ortega@gmail.com"
] | aldo.abarca.ortega@gmail.com | |
1bf2ee159ce0a3a1f89fa30d96caed4f52a18a09 | 75d3d3a64350f42de3685f4a32c330ccd643da76 | /Post/Post/Post.cpp | bf053bdd37f1272547aa571c4978fc640afe1ab8 | [] | no_license | Phaysik/School-CPP-Projects | 560830706a00cb2b2ce6f783e557950dec9c1aa8 | fee320dfe7787124db599124e6bc738c9f71a3f6 | refs/heads/master | 2020-04-27T01:14:03.912405 | 2019-03-11T18:33:18 | 2019-03-11T18:33:18 | 173,959,312 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 702 | cpp | /*Programmer: Matthew Moore
Description: Post-Test Loop
Date: 1-9-19
*/
#include <iostream>
#include <string>
#include <regex>
using namespace std;
void RegNum(string num) //Validate Num
{
while (true)
{
if (!regex_match(num, regex("[-+]?[0-9]*\\.?[0-9]+")))
{
cout << "Please re-enter in your number: ";
cin >> num;
}
else
{
break;
}
}
}
int main()
{
string num;
cout << "Please enter in a starting number: ";
cin >> num;
RegNum(num);
cout << endl;
for (double i = stod(num); i < stod(num) + 10; i++)
{
double farenheight = (i * 9) / 5 + 32;
cout << i << " Celsius - " << farenheight << " Fahrenheit" << endl;
}
cout << endl;
system("pause");
return 0;
} | [
"710866@sths.ssd.k12.mo.us"
] | 710866@sths.ssd.k12.mo.us |
e724e80de45bda01b160d545f806320bed46ea27 | 3d3bc4fac7cf86641a7a005c3f1cd3d74d28b080 | /WxGenGraph/WxGenGraph/unittree.h | f6ce6a8a35e04f0a77d6da17d6b309b8736173af | [] | no_license | altimosk/testgeom | 025884f9a15c52c50aba50f882c6dd68bf8cab89 | 5c6d9ea41b0f54c02d5b5748a64c0b4f620c2691 | refs/heads/master | 2021-01-10T14:28:15.705703 | 2016-02-11T19:40:53 | 2016-02-11T19:40:53 | 45,563,927 | 0 | 0 | null | 2015-11-09T09:45:07 | 2015-11-04T19:59:19 | C++ | UTF-8 | C++ | false | false | 667 | h | #ifndef UNITTREE_H
#define UNITTREE_H
#include "gentree.h"
#include <iostream>
class UnitTreeNode : public TreeNode
{
public:
unsigned long id;
UnitTreeNode(char* nm) : TreeNode(nm), id(0) {
}
UnitTreeNode* AddChild(char* nm)
{
UnitTreeNode* c = new UnitTreeNode(nm);
c->parent = this;
children.push_back(c);
return c;
}
UnitTreeNode* Parent() const {
return static_cast<UnitTreeNode*> (parent);
}
std::vector<UnitTreeNode*> const & Children() const {
return (std::vector<UnitTreeNode*>&)children;
}
};
UnitTreeNode* MakeCurrentUnitTree();
int RunUnitTests(unsigned long id);
int RunUnitTests(unsigned long id, std::ostream& str);
#endif | [
"altimosk@gmail.com"
] | altimosk@gmail.com |
892d8de1f4f0a09376a98e489a4dd7c3fb3d3eb8 | 6de45fa6316f471e08ba89c716763721007c8a0e | /Shooter.h | 32d41b306e8f0bb7b973a6ce8e3cbaf7cad4eb9a | [] | no_license | TejasSayankar/TPS-Prototype | 587d097464fdac036b795bf30f299e77003b2252 | 013e9e4faeff15aa4dfd69aae2e4847e71bba489 | refs/heads/main | 2023-01-15T00:24:31.564681 | 2020-11-24T06:59:05 | 2020-11-24T06:59:05 | 315,544,786 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,159 | h | // Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "EnemyCharacter.h"
#include "Shooter.generated.h"
/**
*
*/
UCLASS()
class TPSPROTOTYPE_API AShooter : public AEnemyCharacter
{
GENERATED_BODY()
public:
//class AEnemyAIController* EnemyController;
class APlayerCharacter* Player;
class AWeapon* Weapon;
UPROPERTY(EditAnywhere, Category = "Weapon")
TSubclassOf<class AWeapon> WeaponClass;
UPROPERTY(EditAnywhere, Category = "Animation")
class UAnimMontage* FireAnimation;
bool CanFire;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Blueprintable, Category = "Weapon")
bool IsEquiped;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Blueprintable, Category = "Weapon")
float Accuracy;
public:
AShooter();
virtual void BeginPlay() override;
virtual void Tick(float DeltaTime) override;
virtual void OnPlayerCaught(APawn* Pawn) override;
void FireShot();
void SpawnWeapon(TSubclassOf<class AWeapon> WeaponClass1);
virtual void Die() override;
FTimerHandle TimerHandle_HandleFire;
};
| [
"noreply@github.com"
] | TejasSayankar.noreply@github.com |
580303593048e1f6ab1742cc3dcfc04b140afdf4 | 1dfcd7de98e5384cce5d2f41d2c263befc7a4d5d | /Day66/Longest Harmonic Subsequence.cpp | cc0e2f903ed727fa3887927174aff2e699cc4011 | [] | no_license | krishna-NIT/100DaysCodingChallenege | 6a3bc1c49131e17cdd77dd24ae286bb1dc3f9e6f | 769c2cd6ddcdee7aa629fd092d4e2d13324b7070 | refs/heads/main | 2023-03-19T09:46:36.312000 | 2021-03-11T15:32:29 | 2021-03-11T15:32:29 | 346,909,151 | 3 | 0 | null | 2021-03-12T02:29:32 | 2021-03-12T02:29:32 | null | UTF-8 | C++ | false | false | 608 | cpp | /*
Platform:- Leetcode
Problem :- Longest Harmonic Subsequence
Event :- February Daily challenge
*/
class Solution {
public:
int findLHS(vector<int>& nums) {
vector<int>P;
int tot=0;
map<int,int>Q;
for(auto x:nums){
Q[x]++;
if(Q[x]==1){
P.push_back(x);
}
}
sort(P.begin(),P.end());
for(int i=1;i<P.size();++i){
int temp=0;
if(P[i]-P[i-1] == 1){
temp+=Q[P[i]]+Q[P[i-1]];
}
tot=max(tot,temp);
}
return tot;
}
};
| [
"noreply@github.com"
] | krishna-NIT.noreply@github.com |
73a4bd12ff62f0163be56fec7c31c4b7c3a7c10d | ba0cbdae81c171bd4be7b12c0594de72bd6d625a | /MyToontown/Panda3D-1.9.0/include/bulletVehicle.h | 4e1e8e1676eca6ae6cd64f95c83d45fd5cd1c842 | [
"BSD-3-Clause",
"BSD-2-Clause"
] | permissive | sweep41/Toontown-2016 | 65985f198fa32a832e762fa9c59e59606d6a40a3 | 7732fb2c27001264e6dd652c057b3dc41f9c8a7d | refs/heads/master | 2021-01-23T16:04:45.264205 | 2017-06-04T02:47:34 | 2017-06-04T02:47:34 | 93,279,679 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,059 | h | // Filename: bulletVehicle.h
// Created by: enn0x (16Feb10)
//
////////////////////////////////////////////////////////////////////
//
// PANDA 3D SOFTWARE
// Copyright (c) Carnegie Mellon University. All rights reserved.
//
// All use of this software is subject to the terms of the revised BSD
// license. You should have received a copy of this license along
// with this source code in a file named "LICENSE."
//
////////////////////////////////////////////////////////////////////
#ifndef __BULLET_VEHICLE_H__
#define __BULLET_VEHICLE_H__
#include "pandabase.h"
#include "bullet_includes.h"
#include "bullet_utils.h"
#include "typedReferenceCount.h"
#include "luse.h"
class BulletWorld;
class BulletRigidBodyNode;
class BulletWheel;
////////////////////////////////////////////////////////////////////
// Class : BulletVehicleTuning
// Description :
////////////////////////////////////////////////////////////////////
class EXPCL_PANDABULLET BulletVehicleTuning {
PUBLISHED:
INLINE void set_suspension_stiffness(PN_stdfloat value);
INLINE void set_suspension_compression(PN_stdfloat value);
INLINE void set_suspension_damping(PN_stdfloat value);
INLINE void set_max_suspension_travel_cm(PN_stdfloat value);
INLINE void set_friction_slip(PN_stdfloat value);
INLINE void set_max_suspension_force(PN_stdfloat value);
INLINE PN_stdfloat get_suspension_stiffness() const;
INLINE PN_stdfloat get_suspension_compression() const;
INLINE PN_stdfloat get_suspension_damping() const;
INLINE PN_stdfloat get_max_suspension_travel_cm() const;
INLINE PN_stdfloat get_friction_slip() const;
INLINE PN_stdfloat get_max_suspension_force() const;
private:
btRaycastVehicle::btVehicleTuning _;
friend class BulletVehicle;
};
////////////////////////////////////////////////////////////////////
// Class : BulletVehicle
// Description : Simulates a raycast vehicle which casts a ray per
// wheel at the ground as a cheap replacement for
// complex suspension simulation. The suspension can
// be tuned in various ways. It is possible to add a
// (probably) arbitrary number of wheels.
////////////////////////////////////////////////////////////////////
class EXPCL_PANDABULLET BulletVehicle : public TypedReferenceCount {
PUBLISHED:
BulletVehicle(BulletWorld *world, BulletRigidBodyNode *chassis);
INLINE ~BulletVehicle();
void set_coordinate_system(BulletUpAxis up);
void set_steering_value(PN_stdfloat steering, int idx);
void set_brake(PN_stdfloat brake, int idx);
void set_pitch_control(PN_stdfloat pitch);
BulletRigidBodyNode *get_chassis();
PN_stdfloat get_current_speed_km_hour() const;
PN_stdfloat get_steering_value(int idx) const;
LVector3 get_forward_vector() const;
void reset_suspension();
void apply_engine_force(PN_stdfloat force, int idx);
// Wheels
BulletWheel create_wheel();
INLINE int get_num_wheels() const;
BulletWheel get_wheel(int idx) const;
MAKE_SEQ(get_wheels, get_num_wheels, get_wheel);
// Tuning
INLINE BulletVehicleTuning &get_tuning();
public:
INLINE btRaycastVehicle *get_vehicle() const;
void sync_b2p();
private:
btRaycastVehicle *_vehicle;
btVehicleRaycaster *_raycaster;
BulletVehicleTuning _tuning;
static btVector3 get_axis(int idx);
////////////////////////////////////////////////////////////////////
public:
static TypeHandle get_class_type() {
return _type_handle;
}
static void init_type() {
TypedReferenceCount::init_type();
register_type(_type_handle, "BulletVehicle",
TypedReferenceCount::get_class_type());
}
virtual TypeHandle get_type() const {
return get_class_type();
}
virtual TypeHandle force_init_type() {
init_type();
return get_class_type();
}
private:
static TypeHandle _type_handle;
};
#include "bulletVehicle.I"
#endif // __BULLET_VEHICLE_H__
| [
"sweep14@gmail.com"
] | sweep14@gmail.com |
de5a24a86513cf3fc55373108036e832c860d68e | 804e45b0ecc2108f52d6a1a95700ed471a80cae5 | /ppt/Unit3/3-5-3.cpp | adf50f89359d89cabee1c255a662a3a55e775ad9 | [] | no_license | ThinBuffalo/Cpp-study | 61fca18eec85bed537855317b44d2a410ad3f7ef | 88e3ce5373dc1d677999a37c98874c08e3bdf2ee | refs/heads/master | 2023-03-16T07:50:11.159315 | 2021-03-03T05:33:39 | 2021-03-03T05:33:39 | 322,501,215 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 224 | cpp | //ͬ3-2-5.cpp
#include <bits/stdc++.h>
using namespace std;
int main()
{
int x;
scanf("%d", &x);
printf("%s", (x % 4 == 0) && (x % 100 != 0) || (x % 400 == 0) ? "YES" : "NO");
system("pause");
return 0;
} | [
"mcluozc@163.com"
] | mcluozc@163.com |
113d5b4583348453afa1499baa68ab7ee1395832 | 601aeee679de7a54c1ee66a24f1b0c194625b810 | /Arduino/StepperEnvironment/ArdoErr.ino | 629137cb7629efae70513a303e8f2eade19166e8 | [] | no_license | 15831944/cnc-2 | 6ea422f2d68702fae66782397ca8a7bc3880137d | 52e1f1ae59c60898293891d0fcc3fef0b61bc0d1 | refs/heads/master | 2022-11-13T12:29:13.812735 | 2020-07-10T18:42:24 | 2020-07-10T18:42:24 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 930 | ino | #include <SoftwareSerial.h>
#include "ArdoErr.h"
#include "MainLoop.h"
///////////////////////////////////////////////////////
// static initialization:
const char* LastErrorCodes::messageText = "";
unsigned char LastErrorCodes::register1Byte_A = '\0';
int32_t LastErrorCodes::register4Byte_A = 0;
///////////////////////////////////////////////////////
///////////////////////////////////////////////////////
void LastErrorCodes::writeToSerial() {
///////////////////////////////////////////////////////
if ( has1ByteInfos() == true ) {
Serial.print('[');
Serial.print(register1Byte_A); Serial.print(COMMA);
Serial.print(']');
}
if ( has4ByteInfos() == true ) {
Serial.print('[');
Serial.print(register4Byte_A); Serial.print(COMMA);
Serial.print(']');
}
if ( has1TextInfo() == true ) {
Serial.print(BLANK1);
Serial.print(messageText);
}
}
| [
"stefan.hoelzer@fplusp.de"
] | stefan.hoelzer@fplusp.de |
fc64be456bb12648b8ae1f14e73f0d22478d49cc | 30479151ee24c009881f0c2f1960efb76ffa11fe | /hikyuu_cpp/hikyuu/indicator/imp/SaftyLoss.cpp | e9eeb6d63d7a7b1aa4e61540d80f5dc3f694fd4f | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | archya/hikyuu | 9832ec713bef400d8887dd107d64806e9d8a9541 | 2305a977a78bab832bf8fcb4d66482dfef442c9d | refs/heads/master | 2021-01-01T06:28:25.858204 | 2019-04-16T03:22:44 | 2019-04-16T03:22:44 | 97,430,935 | 0 | 0 | MIT | 2019-04-16T03:22:45 | 2017-07-17T03:19:27 | C++ | UTF-8 | C++ | false | false | 2,297 | cpp | /*
* SaftyLoss.cpp
*
* Created on: 2013-4-12
* Author: fasiondog
*/
#include "SaftyLoss.h"
#if HKU_SUPPORT_SERIALIZATION
BOOST_CLASS_EXPORT(hku::SaftyLoss)
#endif
namespace hku {
SaftyLoss::SaftyLoss():IndicatorImp("SAFTYLOSS", 1) {
setParam<int>("n1", 10);
setParam<int>("n2", 3);
setParam<double>("p", 2.0);
}
SaftyLoss::~SaftyLoss() {
}
bool SaftyLoss::check() {
int n1 = getParam<int>("n1");
int n2 = getParam<int>("n2");
if (n1 < 2) {
HKU_ERROR("Invalid param[n1] must >= 2 ! [SaftyLoss::SaftyLoss]");
return false;
}
if (n2 < 1) {
HKU_ERROR("Invalid param[n2] must >= 1 ! [SaftyLoss::SaftyLoss]");
return false;
}
return true;
}
void SaftyLoss::_calculate(const Indicator& data) {
size_t total = data.size();
if (total == 0) {
return;
}
_readyBuffer(total, 1);
int n1 = getParam<int>("n1");
int n2 = getParam<int>("n2");
double p = getParam<double>("p");
m_discard = data.discard() + n1 + n2 - 2;
if (m_discard >= total) {
m_discard = total;
return;
}
price_t sum = 0.0;
size_t num = 0;
price_t result = 0.0;
size_t start = discard();
for (size_t i = start; i < total; ++i) {
result = 0.0;
for (size_t j = i + 1 - n2; j <= i; ++j) {
sum = 0.0;
num = 0;
for (size_t k = j + 2 -n1; k <=j; ++k) {
price_t pre = data[k-1];
price_t cur = data[k];
if (pre > cur) {
sum += pre - cur;
++num;
}
}
price_t temp = data[j];
if (num != 0) {
temp = temp - (p * sum / num);
}
if (temp > result) {
result = temp;
}
}
_set(result, i);
}
}
Indicator HKU_API SAFTYLOSS(int n1, int n2, double p) {
IndicatorImpPtr result = make_shared<SaftyLoss>();
result->setParam<int>("n1", n1);
result->setParam<int>("n2", n2);
result->setParam<double>("p", p);
return Indicator(result);
}
Indicator HKU_API SAFTYLOSS(const Indicator& data, int n1, int n2, double p) {
return SAFTYLOSS(n1, n2, p)(data);
}
} /* namespace hku */
| [
"fasiondog@163.com"
] | fasiondog@163.com |
a16f3252db2aecfb78fce710617bc71479a2ec53 | e4d619f21b867337d34e32922240e47f87125954 | /2assign/pinatrace.cpp | 56e0604dda5f8c4d2e7395b5bb64d9629104ec54 | [] | no_license | sidmutha/csdlab | c88f596e848904f3376a7bf831218ed9c28dea58 | be11a0b7d976f2cf411708f61742f6c5c7097159 | refs/heads/master | 2021-01-15T10:47:18.017301 | 2014-10-02T11:40:05 | 2014-10-02T11:40:05 | 23,510,382 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 6,999 | cpp | /*BEGIN_LEGAL
Intel Open Source License
Copyright (c) 2002-2014 Intel Corporation. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer. Redistributions
in binary form must reproduce the above copyright notice, this list of
conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution. Neither the name of
the Intel Corporation nor the names of its contributors may be used to
endorse or promote products derived from this software without
specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE INTEL OR
ITS 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.
END_LEGAL */
/*
* This file contains an ISA-portable PIN tool for tracing memory accesses.
*/
#include <stdio.h>
#include "pin.H"
#include"wrapper.h"
#include"cache.h"
#include<string>
#include<sstream>
#include<fstream>
#include<cstdint>
FILE * trace;
FILE * itrace;
Wrapper* w;
int numCaches;
// Print a memory read record
VOID RecordMemRead(VOID * ip, VOID * addr)
{
//fprintf(trace,"%p: R %p\n", ip, addr);
w->read((uint64_t) addr);
}
// Print a memory write record
VOID RecordMemWrite(VOID * ip, VOID * addr)
{
//fprintf(trace,"%p: W %p\n", ip, addr);
w->write((uint64_t) addr);
}
VOID ReadInst(void* addr){
w->read((uint64_t)addr);
//cout << "read: " << addr << endl;
}
// Is called for every instruction and instruments reads and writes
VOID Instruction(INS ins, VOID *v)
{
// Instruments memory accesses using a predicated call, i.e.
// the instrumentation is called iff the instruction will actually be executed.
//
// On the IA-32 and Intel(R) 64 architectures conditional moves and REP
// prefixed instructions appear as predicated instructions in Pin.
//w->read(INS_Address(ins)); // reading the instruction (from our cache)
//cout << INS_Address(ins) << endl;
//ADDRINT addr = INS_Address(ins);
INS_InsertCall(ins, IPOINT_BEFORE, (AFUNPTR)ReadInst, IARG_INST_PTR, IARG_END);
UINT32 memOperands = INS_MemoryOperandCount(ins);
// Iterate over each memory operand of the instruction.
for (UINT32 memOp = 0; memOp < memOperands; memOp++)
{
if (INS_MemoryOperandIsRead(ins, memOp))
{
INS_InsertPredicatedCall(
ins, IPOINT_BEFORE, (AFUNPTR)RecordMemRead,
IARG_INST_PTR,
IARG_MEMORYOP_EA, memOp,
IARG_END);
}
// Note that in some architectures a single memory operand can be
// both read and written (for instance incl (%eax) on IA-32)
// In that case we instrument it once for read and once for write.
if (INS_MemoryOperandIsWritten(ins, memOp))
{
INS_InsertPredicatedCall(
ins, IPOINT_BEFORE, (AFUNPTR)RecordMemWrite,
IARG_INST_PTR,
IARG_MEMORYOP_EA, memOp,
IARG_END);
}
}
}
VOID Fini(INT32 code, VOID *v)
{
fprintf(trace, "#eof\n");
fclose(trace);
for(int i = 0; i < numCaches; i++){
cout << w->cacheArray[i].readHits
<< ", " << w->cacheArray[i].readMisses
<< ", " << w->cacheArray[i].writeHits
<< ", " << w->cacheArray[i].writeMisses
<< ", " << w->cacheArray[i].hits
<< ", " << w->cacheArray[i].misses_non_dirty
<< ", " << w->cacheArray[i].misses_dirty
<< endl;
/*
cout << endl;
cout << "L" << i+1 << ": read hits: " << w->cacheArray[i].readHits << endl;
cout << "L" << i+1 << ": read misses: " << w->cacheArray[i].readMisses << endl;
cout << "L" << i+1 << ": write hits: " << w->cacheArray[i].writeHits << endl;
cout << "L" << i+1 << ": write misses: " << w->cacheArray[i].writeMisses << endl;
cout << "-----------------------------------\n";
*/
}
}
/* ===================================================================== */
/* Print Help Message */
/* ===================================================================== */
INT32 Usage()
{
PIN_ERROR( "This Pintool prints a trace of memory addresses\n"
+ KNOB_BASE::StringKnobSummary() + "\n");
return -1;
}
/* ===================================================================== */
/* Main */
/* ===================================================================== */
int main(int argc, char *argv[])
{
if (PIN_Init(argc, argv)) return Usage();
trace = fopen("pinatrace.out2", "w");
itrace = fopen("itr.out", "w");
// read config.txt
string line;
ifstream f("config.txt");
getline(f, line);
stringstream ss(line);
string temp;
ss >> temp >> temp >> numCaches;
w = new Wrapper(numCaches);
int i;
for(i = 0; i < numCaches; i++){
getline(f, line); // blank line
getline(f, line); // [Level i]
getline(f, line); // Size = ??KB
ss.str(string());
ss.clear();
ss << line;
ss >> temp >> temp >> temp;
string sz_str = temp.substr(0, temp.length() - 2);
int size = stoi(sz_str);
getline(f, line); // Associativity = ??
ss.str(string());
ss.clear();
ss << line;
ss >> temp >> temp;
int asso;
ss >> asso;
getline(f, line); // Block_size = ??bytes
ss.str(string());
ss.clear();
ss << line;
ss >> temp >> temp >> temp;
sz_str = temp.substr(0, temp.length() - 5);
int blockSize = stoi(sz_str);
getline(f, line); // Hit_Latency = ?? // ignore
getline(f, line); // Replacement_Policy = LRU
ss.str(string());
ss.clear();
ss << line;
ss >> temp >> temp >> temp;
// cerr << "replacement policy: " << temp << endl;
int replacementPolicy;
if(temp.compare("LRU") == 0){
replacementPolicy = 0;
}else if(temp.compare("LFU") == 0){
replacementPolicy = 1;
}else{
replacementPolicy = 2;
}
w->cacheArray[i] = Cache(i, w, size, asso, blockSize, replacementPolicy);
}
f.close();
INS_AddInstrumentFunction(Instruction, 0);
PIN_AddFiniFunction(Fini, 0);
// Never returns
PIN_StartProgram();
return 0;
}
| [
"sidmutha@gmail.com"
] | sidmutha@gmail.com |
cc296a38c091c5e763f25c97531f0a680a4465ec | c2caa58960859fff7294e390e9e536d436ba6c8d | /ch04/MFCApplication1/MFCApplication1/MFCApplication1.cpp | dc04205b326443be68da273bbb60ae8e0530a3d3 | [] | no_license | stuckat1/CPP_Design_Patterns_and_Derivatives_Pricing | 0c65a2853eb53a2d5404e770795252dbb61c7ffe | 3fb60fdde68540aee267e4e8e27492ad9c7ae68b | refs/heads/master | 2021-01-17T08:58:32.091029 | 2016-05-13T00:37:14 | 2016-05-13T00:37:23 | 32,754,584 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 5,046 | cpp |
// MFCApplication1.cpp : Defines the class behaviors for the application.
//
#include "stdafx.h"
#include "afxwinappex.h"
#include "afxdialogex.h"
#include "MFCApplication1.h"
#include "MainFrm.h"
#include "ChildFrm.h"
#include "MFCApplication1Doc.h"
#include "MFCApplication1View.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
// CMFCApplication1App
BEGIN_MESSAGE_MAP(CMFCApplication1App, CWinApp)
ON_COMMAND(ID_APP_ABOUT, &CMFCApplication1App::OnAppAbout)
// Standard file based document commands
ON_COMMAND(ID_FILE_NEW, &CWinApp::OnFileNew)
ON_COMMAND(ID_FILE_OPEN, &CWinApp::OnFileOpen)
// Standard print setup command
ON_COMMAND(ID_FILE_PRINT_SETUP, &CWinApp::OnFilePrintSetup)
END_MESSAGE_MAP()
// CMFCApplication1App construction
CMFCApplication1App::CMFCApplication1App()
{
// support Restart Manager
m_dwRestartManagerSupportFlags = AFX_RESTART_MANAGER_SUPPORT_ALL_ASPECTS;
#ifdef _MANAGED
// If the application is built using Common Language Runtime support (/clr):
// 1) This additional setting is needed for Restart Manager support to work properly.
// 2) In your project, you must add a reference to System.Windows.Forms in order to build.
System::Windows::Forms::Application::SetUnhandledExceptionMode(System::Windows::Forms::UnhandledExceptionMode::ThrowException);
#endif
// TODO: replace application ID string below with unique ID string; recommended
// format for string is CompanyName.ProductName.SubProduct.VersionInformation
SetAppID(_T("MFCApplication1.AppID.NoVersion"));
// TODO: add construction code here,
// Place all significant initialization in InitInstance
}
// The one and only CMFCApplication1App object
CMFCApplication1App theApp;
// CMFCApplication1App initialization
BOOL CMFCApplication1App::InitInstance()
{
// InitCommonControlsEx() is required on Windows XP if an application
// manifest specifies use of ComCtl32.dll version 6 or later to enable
// visual styles. Otherwise, any window creation will fail.
INITCOMMONCONTROLSEX InitCtrls;
InitCtrls.dwSize = sizeof(InitCtrls);
// Set this to include all the common control classes you want to use
// in your application.
InitCtrls.dwICC = ICC_WIN95_CLASSES;
InitCommonControlsEx(&InitCtrls);
CWinApp::InitInstance();
// Initialize OLE libraries
if (!AfxOleInit())
{
AfxMessageBox(IDP_OLE_INIT_FAILED);
return FALSE;
}
AfxEnableControlContainer();
EnableTaskbarInteraction(FALSE);
// AfxInitRichEdit2() is required to use RichEdit control
// AfxInitRichEdit2();
// Standard initialization
// If you are not using these features and wish to reduce the size
// of your final executable, you should remove from the following
// the specific initialization routines you do not need
// Change the registry key under which our settings are stored
// TODO: You should modify this string to be something appropriate
// such as the name of your company or organization
SetRegistryKey(_T("Local AppWizard-Generated Applications"));
LoadStdProfileSettings(4); // Load standard INI file options (including MRU)
// Register the application's document templates. Document templates
// serve as the connection between documents, frame windows and views
CMultiDocTemplate* pDocTemplate;
pDocTemplate = new CMultiDocTemplate(IDR_MFCApplication1TYPE,
RUNTIME_CLASS(CMFCApplication1Doc),
RUNTIME_CLASS(CChildFrame), // custom MDI child frame
RUNTIME_CLASS(CMFCApplication1View));
if (!pDocTemplate)
return FALSE;
AddDocTemplate(pDocTemplate);
// create main MDI Frame window
CMainFrame* pMainFrame = new CMainFrame;
if (!pMainFrame || !pMainFrame->LoadFrame(IDR_MAINFRAME))
{
delete pMainFrame;
return FALSE;
}
m_pMainWnd = pMainFrame;
// Parse command line for standard shell commands, DDE, file open
CCommandLineInfo cmdInfo;
ParseCommandLine(cmdInfo);
// Dispatch commands specified on the command line. Will return FALSE if
// app was launched with /RegServer, /Register, /Unregserver or /Unregister.
if (!ProcessShellCommand(cmdInfo))
return FALSE;
// The main window has been initialized, so show and update it
pMainFrame->ShowWindow(m_nCmdShow);
pMainFrame->UpdateWindow();
return TRUE;
}
int CMFCApplication1App::ExitInstance()
{
//TODO: handle additional resources you may have added
AfxOleTerm(FALSE);
return CWinApp::ExitInstance();
}
// CMFCApplication1App message handlers
// CAboutDlg dialog used for App About
class CAboutDlg : public CDialogEx
{
public:
CAboutDlg();
// Dialog Data
enum { IDD = IDD_ABOUTBOX };
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
// Implementation
protected:
DECLARE_MESSAGE_MAP()
};
CAboutDlg::CAboutDlg() : CDialogEx(CAboutDlg::IDD)
{
}
void CAboutDlg::DoDataExchange(CDataExchange* pDX)
{
CDialogEx::DoDataExchange(pDX);
}
BEGIN_MESSAGE_MAP(CAboutDlg, CDialogEx)
END_MESSAGE_MAP()
// App command to run the dialog
void CMFCApplication1App::OnAppAbout()
{
CAboutDlg aboutDlg;
aboutDlg.DoModal();
}
// CMFCApplication1App message handlers
| [
"keweima@yahoo.com"
] | keweima@yahoo.com |
de5bad9647e1346b074c05aca5a1e3e10c7e16be | 02747fefd5dc1d821afa7b2d8606c55c976b9730 | /MISPELL.cpp | 4fd60c22d5de3dd0c0a506c9f0b13071352ded3f | [] | no_license | fdoom/algospot-study | 03a014eafca4d8da3b4caae6051a883ce1ab60fb | 0de66db908258cb73bf293132c5ee2b8f753267b | refs/heads/main | 2023-08-01T22:41:22.955228 | 2021-09-14T04:25:36 | 2021-09-14T04:25:36 | 311,276,427 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 312 | cpp | #include <iostream>
#include <string>
using namespace std;
int main(void)
{
int t;
cin >> t;
for(int j = 0; j < t; j++)
{
int n;
string arr;
cin >> n >> arr;
cout << j + 1 << " ";
for (int i = 0; i < arr.length(); i++)
{
if (n == i + 1) continue;
cout << arr[i];
}
cout << endl;
}
} | [
"11jjklol@naver.com"
] | 11jjklol@naver.com |
2439e50aca5d0dc08ed177f36369374044d36b86 | a4f9e159fd976daa151a3cb2635e6bdc70d7b733 | /esmath/EsMathFitConstraint.h | 86671569b89600cd2edc8309d9a7b63ac7dc05a5 | [] | no_license | vgromov/esfwx | 6d77f9303de3b8391a26bbbc41d117de851bf64d | c727752378cad36d32cb344f916d87cd84ea0830 | refs/heads/master | 2021-07-08T03:08:17.442342 | 2020-07-30T10:01:58 | 2020-07-30T10:01:58 | 166,006,433 | 0 | 0 | null | 2020-07-30T10:01:59 | 2019-01-16T08:51:10 | C++ | UTF-8 | C++ | false | false | 2,357 | h | #ifndef _es_math_fit_constraint_h_
#define _es_math_fit_constraint_h_
enum class EsMathFitInfo : ulong
{
None,
Success,
Inconvergence,
ConstraintInconsistent,
Fail
};
enum class EsMathFitConstraintKind : ulong
{
Value,
FirstDerivative
};
class ESMATH_CLASS EsMathFitConstraint
{
public:
/// Non-reflectes services
///
EsMathFitConstraint(double x = 0., double constraint = 0.,
EsMathFitConstraintKind kind = EsMathFitConstraintKind::Value);
/// X value, for which this constraint is defined
double xGet() const { return m_x; }
/// Constraint value
double constraintGet() const { return m_constraint; }
/// Constraint value kind
EsMathFitConstraintKind kindGet() const { return m_kind; }
protected:
double m_x;
double m_constraint;
EsMathFitConstraintKind m_kind;
};
typedef std::vector<EsMathFitConstraint> EsMathFitConstraints;
/// Try to construct constraints collection from EsVaraint
void constraintsFromVariant(EsMathFitConstraints& csx, const EsVariant& src);
namespace EsReflection
{
/// Fitting status reflected enumeration
///
ES_DECL_EXPORTED_ENUMERATION_BEGIN(ESMATH_CLASS, EsMathFitInfo)
ES_DECL_ENUMERATION_ITEM_LABELLED(None, static_cast<ulong>(::EsMathFitInfo::None), _i("None"))
ES_DECL_ENUMERATION_ITEM_LABELLED(Success, static_cast<ulong>(::EsMathFitInfo::Success), _i("Fit successful"))
ES_DECL_ENUMERATION_ITEM_LABELLED(Inconvergence, static_cast<ulong>(::EsMathFitInfo::Inconvergence), _i("Fit inconvergence occured"))
ES_DECL_ENUMERATION_ITEM_LABELLED(ConstraintInconsistent, static_cast<ulong>(::EsMathFitInfo::ConstraintInconsistent), _i("Constraint is inconsistent"))
ES_DECL_ENUMERATION_ITEM_LABELLED(Fail, static_cast<ulong>(::EsMathFitInfo::Fail), _i("Fitting failed"))
ES_DECL_ENUMERATION_END
/// Fitting constraint types
///
ES_DECL_EXPORTED_ENUMERATION_BEGIN(ESMATH_CLASS, EsMathFitConstraintKind)
ES_DECL_ENUMERATION_ITEM_LABELLED(Value, static_cast<ulong>(::EsMathFitConstraintKind::Value), _i("Value"))
ES_DECL_ENUMERATION_ITEM_LABELLED(FirstDerivative, static_cast<ulong>(::EsMathFitConstraintKind::FirstDerivative), _i("First derivative"))
ES_DECL_ENUMERATION_END
}
#endif // _es_math_fit_constraint_h_ | [
"gromov.vsevolod@yandex.ru"
] | gromov.vsevolod@yandex.ru |
60cf1a43908e886edcb30a275c81c3a06b30bf95 | 6d91631491a7bfa6ee3a3958dab2d5868364fe0c | /Project/CubeBox.cpp | 967cf82da91a6366775c19884aafa963b5970c10 | [
"MIT"
] | permissive | recter/D3DXTest | 0ebf45eeb18a5e427865103ae8ac111a7fec7ff7 | 396b1ad1cb64072f320190cc35419b2d882a9ea2 | refs/heads/master | 2020-06-05T15:44:11.368011 | 2015-04-19T16:12:54 | 2015-04-19T16:12:54 | 34,198,107 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 6,559 | cpp | #include "CubeBox.h"
const DWORD VertexBox::FVF = (D3DFVF_XYZ | D3DFVF_NORMAL | D3DFVF_TEX1);
CCubeBox::CCubeBox(void)
{
m_Tex = 0;
m_VB = 0;
m_IB = 0;
}
//-------------------------------------------------------------------------
CCubeBox::~CCubeBox(void)
{
}
//-------------------------------------------------------------------------
bool CCubeBox::Setup(IDirect3DDevice9* pDevice,int nWidth,int nHeight)
{
if (pDevice == 0)
{
return false;
}
m_Device = pDevice;
m_nWidth = nWidth;
m_nHeight = nHeight;
m_Device->CreateVertexBuffer(
24 * sizeof(VertexBox),
D3DUSAGE_WRITEONLY,
VertexBox::FVF,
D3DPOOL_MANAGED,
&m_VB,
0);
VertexBox* v;
m_VB->Lock(0, 0, (void**)&v, 0);
// build box
// fill in the front face vertex data
v[0] = VertexBox(-1.0f, -1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f);
v[1] = VertexBox(-1.0f, 1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 1.0f);
v[2] = VertexBox( 1.0f, 1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 1.0f, 1.0f);
v[3] = VertexBox( 1.0f, -1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 1.0f, 0.0f);
// fill in the back face vertex data
v[4] = VertexBox(-1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f);
v[5] = VertexBox( 1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f);
v[6] = VertexBox( 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f);
v[7] = VertexBox(-1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 0.0f);
// fill in the top face vertex data
v[8] = VertexBox(-1.0f, 1.0f, -1.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f);
v[9] = VertexBox(-1.0f, 1.0f, 1.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f);
v[10] = VertexBox( 1.0f, 1.0f, 1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 1.0f);
v[11] = VertexBox( 1.0f, 1.0f, -1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f);
// fill in the bottom face vertex data
v[12] = VertexBox(-1.0f, -1.0f, -1.0f, 0.0f, -1.0f, 0.0f, 0.0f, 0.0f);
v[13] = VertexBox( 1.0f, -1.0f, -1.0f, 0.0f, -1.0f, 0.0f, 0.0f, 1.0f);
v[14] = VertexBox( 1.0f, -1.0f, 1.0f, 0.0f, -1.0f, 0.0f, 1.0f, 1.0f);
v[15] = VertexBox(-1.0f, -1.0f, 1.0f, 0.0f, -1.0f, 0.0f, 1.0f, 0.0f);
// fill in the left face vertex data
v[16] = VertexBox(-1.0f, -1.0f, 1.0f, -1.0f, 0.0f, 0.0f, 0.0f, 0.0f);
v[17] = VertexBox(-1.0f, 1.0f, 1.0f, -1.0f, 0.0f, 0.0f, 0.0f, 1.0f);
v[18] = VertexBox(-1.0f, 1.0f, -1.0f, -1.0f, 0.0f, 0.0f, 1.0f, 1.0f);
v[19] = VertexBox(-1.0f, -1.0f, -1.0f, -1.0f, 0.0f, 0.0f, 1.0f, 0.0f);
// fill in the right face vertex data
v[20] = VertexBox( 1.0f, -1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f);
v[21] = VertexBox( 1.0f, 1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f);
v[22] = VertexBox( 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f);
v[23] = VertexBox( 1.0f, -1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f);
m_VB->Unlock();
m_Device->CreateIndexBuffer(
36 * sizeof(WORD),
D3DUSAGE_WRITEONLY,
D3DFMT_INDEX16,
D3DPOOL_MANAGED,
&m_IB,
0);
WORD* i = 0;
m_IB->Lock(0, 0, (void**)&i, 0);
// fill in the front face index data
i[0] = 0; i[1] = 1; i[2] = 2;
i[3] = 0; i[4] = 2; i[5] = 3;
// fill in the back face index data
i[6] = 4; i[7] = 5; i[8] = 6;
i[9] = 4; i[10] = 6; i[11] = 7;
// fill in the top face index data
i[12] = 8; i[13] = 9; i[14] = 10;
i[15] = 8; i[16] = 10; i[17] = 11;
// fill in the bottom face index data
i[18] = 12; i[19] = 13; i[20] = 14;
i[21] = 12; i[22] = 14; i[23] = 15;
// fill in the left face index data
i[24] = 16; i[25] = 17; i[26] = 18;
i[27] = 16; i[28] = 18; i[29] = 19;
// fill in the right face index data
i[30] = 20; i[31] = 21; i[32] = 22;
i[33] = 20; i[34] = 22; i[35] = 23;
m_IB->Unlock();
//
// Set a directional light.
//
D3DLIGHT9 light;
::ZeroMemory(&light, sizeof(light));
light.Type = D3DLIGHT_DIRECTIONAL;
light.Ambient = D3DXCOLOR(0.8f, 0.8f, 0.8f, 1.0f);
light.Diffuse = D3DXCOLOR(1.0f, 1.0f, 1.0f, 1.0f);
light.Specular = D3DXCOLOR(0.2f, 0.2f, 0.2f, 1.0f);
light.Direction = D3DXVECTOR3(1.0f, -1.0f, 0.0f);
m_Device->SetLight(0, &light);
m_Device->LightEnable(0, true);
m_Device->SetRenderState(D3DRS_NORMALIZENORMALS, true);
m_Device->SetRenderState(D3DRS_SPECULARENABLE, true);
//
// Create texture.
//
D3DXCreateTextureFromFile(
m_Device,
s_szBoxPath,
&m_Tex);
m_Device->SetTexture(0, m_Tex);
//
// Set Texture Filter States.
//
m_Device->SetSamplerState(0, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR);
m_Device->SetSamplerState(0, D3DSAMP_MINFILTER, D3DTEXF_LINEAR);
m_Device->SetSamplerState(0, D3DSAMP_MIPFILTER, D3DTEXF_LINEAR);
//
// Set the projection matrix.
//
D3DXMATRIX proj;
D3DXMatrixPerspectiveFovLH(
&proj,
D3DX_PI * 0.5f, // 90 - degree
(float)m_nWidth / (float)m_nHeight,
1.0f,
1000.0f);
m_Device->SetTransform(D3DTS_PROJECTION, &proj);
return true;
}
//-------------------------------------------------------------------------
void CCubeBox::Cleanup()
{
if (m_Tex)
{
d3d::Release(m_Tex);
m_Tex = 0;
}
if (m_VB)
{
d3d::Release(m_VB);
m_VB = 0;
}
if (m_IB)
{
d3d::Release(m_IB);
m_IB = 0;
}
m_Device = 0;
}
//-------------------------------------------------------------------------
bool CCubeBox::Display(float timeDelta)
{
if (m_Device == 0)
{
return false;
}
static float angle = (3.0f * D3DX_PI) / 2.0f;
static float height = 2.0f;
if( ::GetAsyncKeyState(VK_LEFT) & 0x8000f )
angle -= 0.5f * timeDelta;
if( ::GetAsyncKeyState(VK_RIGHT) & 0x8000f )
angle += 0.5f * timeDelta;
if( ::GetAsyncKeyState(VK_UP) & 0x8000f )
height += 5.0f * timeDelta;
if( ::GetAsyncKeyState(VK_DOWN) & 0x8000f )
height -= 5.0f * timeDelta;
D3DXVECTOR3 position( cosf(angle) * 3.0f, height, sinf(angle) * 3.0f );
D3DXVECTOR3 target(0.0f, 0.0f, 0.0f);
D3DXVECTOR3 up(0.0f, 1.0f, 0.0f);
D3DXMATRIX V;
D3DXMatrixLookAtLH(&V, &position, &target, &up);
m_Device->SetTransform(D3DTS_VIEW, &V);
//
// Draw the scene:
//
m_Device->Clear(0, 0, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, 0x000fff0f, 1.0f, 0);
m_Device->BeginScene();
m_Device->SetMaterial(&d3d::WHITE_MTRL);
m_Device->SetTexture(0, m_Tex);
m_Device->SetStreamSource(0, m_VB, 0, sizeof(VertexBox));
m_Device->SetIndices(m_IB);
m_Device->SetFVF(VertexBox::FVF);
m_Device->DrawIndexedPrimitive(
D3DPT_TRIANGLELIST,
0,
0,
24,
0,
12);
m_Device->EndScene();
return true;
}
//-------------------------------------------------------------------------
| [
"rectvv@gmail.com"
] | rectvv@gmail.com |
09dbf840e293a508c481a804174f8f962fa7bb26 | 688a51f4072cc7816ab1beba6252f037cff1bf55 | /Overload/SSSEngine/Include/ShaderManager.h | d196cf48332551909ea81bdf673920a49e92675d | [] | no_license | wognl0439/D3D_Overload | f0c19c2c7a4ab2c950d3a97adb6195738c67280a | 7af41388591f2f60aa124d215084c72e9797eb86 | refs/heads/master | 2023-07-17T17:29:25.754980 | 2021-09-01T10:07:27 | 2021-09-01T10:07:27 | 401,966,646 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,400 | h | #pragma once
#include "Engine.h"
SSS_BEGIN
typedef struct SSS_DLL _tagConstantBuffer
{
ID3D11Buffer* pBuffer;
int iSize;
int iRegister;
}CONSTANTBUFFER, *PCONSTANTBUFFER;
class SSS_DLL CShaderManager
{
DECLARE_SINGLE(CShaderManager)
private:
unordered_map<string, class CShader*> m_mapShader;
unordered_map<string, ID3D11InputLayout*> m_mapInputLayout;
unordered_map<string, PCONSTANTBUFFER> m_mapConstantBuffer;
vector<D3D11_INPUT_ELEMENT_DESC> m_vecAddElement;
UINT m_iElementSize;
public:
bool Initialize();
class CShader* LoadShader(const string& strTag, const wchar_t* pFileName, char* pEntry[ST_END], const string& strPathKey = SHADER_PATH);
class CShader* FindShader(const string& strTag);
void AddInputElement(const char* pSemantic, int iSemanticIdx, DXGI_FORMAT eFmt, UINT iInputSlot, UINT iSize,
D3D11_INPUT_CLASSIFICATION eInputClass = D3D11_INPUT_PER_VERTEX_DATA, UINT iInstanceStepRate = 0);
ID3D11InputLayout* CreateInputLayout(const string& strKey, const string& strShaderKey);
ID3D11InputLayout* FindInputLayout(const string& strKey);
const string& FindInputLayoutKey(ID3D11InputLayout* pInputLayout);
PCONSTANTBUFFER CreateConstantBuffer(const string& strKey, UINT iSize, int iRegister);
bool UpdateConstantBuffer(const string& strKey, void* pData, int iCBufferTransfer);
PCONSTANTBUFFER FindConstantBuffer(const string& strKey);
};
SSS_END
| [
"wognl0439@gmail.com"
] | wognl0439@gmail.com |
17aea442870d10b8eca80bbde9ec4928ce2f9590 | ad273708d98b1f73b3855cc4317bca2e56456d15 | /aws-cpp-sdk-mq/include/aws/mq/model/BrokerStorageType.h | 4576141572f39ce023d71f817ab2aff4c51872db | [
"MIT",
"Apache-2.0",
"JSON"
] | permissive | novaquark/aws-sdk-cpp | b390f2e29f86f629f9efcf41c4990169b91f4f47 | a0969508545bec9ae2864c9e1e2bb9aff109f90c | refs/heads/master | 2022-08-28T18:28:12.742810 | 2020-05-27T15:46:18 | 2020-05-27T15:46:18 | 267,351,721 | 1 | 0 | Apache-2.0 | 2020-05-27T15:08:16 | 2020-05-27T15:08:15 | null | UTF-8 | C++ | false | false | 1,084 | h | /*
* Copyright 2010-2017 Amazon.com, Inc. or its affiliates. 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.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
#pragma once
#include <aws/mq/MQ_EXPORTS.h>
#include <aws/core/utils/memory/stl/AWSString.h>
namespace Aws
{
namespace MQ
{
namespace Model
{
enum class BrokerStorageType
{
NOT_SET,
EBS,
EFS
};
namespace BrokerStorageTypeMapper
{
AWS_MQ_API BrokerStorageType GetBrokerStorageTypeForName(const Aws::String& name);
AWS_MQ_API Aws::String GetNameForBrokerStorageType(BrokerStorageType value);
} // namespace BrokerStorageTypeMapper
} // namespace Model
} // namespace MQ
} // namespace Aws
| [
"aws-sdk-cpp-automation@github.com"
] | aws-sdk-cpp-automation@github.com |
881b4eaa432bc42c70f6da69cd3632cb93d96811 | bddf3eee728421f4ea7acb2582a0b28aa8fbd541 | /pro_of_Qt/faims_04-08/build-faims_-Desktop_Qt_5_14_2_GCC_64bit-Debug/temp/moc/moc_databasethread.cpp | 4c0930678e769cf63315cb1d5f180fb72267cdfa | [] | no_license | yzkaa/CPP_All_Test | 6e64ab12fd9f41a35b660330d922da73d6c13524 | 3bd8076247551b9180a0ddf1fb01e71632c5693a | refs/heads/master | 2023-05-06T02:42:19.639079 | 2021-05-29T15:34:23 | 2021-05-29T15:34:23 | 318,482,502 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 6,327 | cpp | /****************************************************************************
** Meta object code from reading C++ file 'databasethread.h'
**
** Created by: The Qt Meta Object Compiler version 67 (Qt 5.14.2)
**
** WARNING! All changes made in this file will be lost!
*****************************************************************************/
#include <memory>
#include "../../../faims_/DataBase/databasethread.h"
#include <QtCore/qbytearray.h>
#include <QtCore/qmetatype.h>
#if !defined(Q_MOC_OUTPUT_REVISION)
#error "The header file 'databasethread.h' doesn't include <QObject>."
#elif Q_MOC_OUTPUT_REVISION != 67
#error "This file was generated using the moc from 5.14.2. It"
#error "cannot be used with the include files from this version of Qt."
#error "(The moc has changed too much.)"
#endif
QT_BEGIN_MOC_NAMESPACE
QT_WARNING_PUSH
QT_WARNING_DISABLE_DEPRECATED
struct qt_meta_stringdata_DatabaseThread_t {
QByteArrayData data[16];
char stringdata0[174];
};
#define QT_MOC_LITERAL(idx, ofs, len) \
Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(len, \
qptrdiff(offsetof(qt_meta_stringdata_DatabaseThread_t, stringdata0) + ofs \
- idx * sizeof(QByteArrayData)) \
)
static const qt_meta_stringdata_DatabaseThread_t qt_meta_stringdata_DatabaseThread = {
{
QT_MOC_LITERAL(0, 0, 14), // "DatabaseThread"
QT_MOC_LITERAL(1, 15, 11), // "inputSucess"
QT_MOC_LITERAL(2, 27, 0), // ""
QT_MOC_LITERAL(3, 28, 15), // "createDataTable"
QT_MOC_LITERAL(4, 44, 12), // "getInputData"
QT_MOC_LITERAL(5, 57, 8), // "DBValues"
QT_MOC_LITERAL(6, 66, 4), // "data"
QT_MOC_LITERAL(7, 71, 24), // "insertToSpectrogramTable"
QT_MOC_LITERAL(8, 96, 17), // "insertToDataTable"
QT_MOC_LITERAL(9, 114, 1), // "x"
QT_MOC_LITERAL(10, 116, 1), // "y"
QT_MOC_LITERAL(11, 118, 13), // "QVariantList&"
QT_MOC_LITERAL(12, 132, 5), // "xList"
QT_MOC_LITERAL(13, 138, 5), // "yList"
QT_MOC_LITERAL(14, 144, 18), // "readDBInsertParams"
QT_MOC_LITERAL(15, 163, 10) // "insertType"
},
"DatabaseThread\0inputSucess\0\0createDataTable\0"
"getInputData\0DBValues\0data\0"
"insertToSpectrogramTable\0insertToDataTable\0"
"x\0y\0QVariantList&\0xList\0yList\0"
"readDBInsertParams\0insertType"
};
#undef QT_MOC_LITERAL
static const uint qt_meta_data_DatabaseThread[] = {
// content:
8, // revision
0, // classname
0, 0, // classinfo
7, 14, // methods
0, 0, // properties
1, 68, // enums/sets
0, 0, // constructors
0, // flags
1, // signalCount
// signals: name, argc, parameters, tag, flags
1, 0, 49, 2, 0x06 /* Public */,
// slots: name, argc, parameters, tag, flags
3, 0, 50, 2, 0x0a /* Public */,
4, 1, 51, 2, 0x0a /* Public */,
7, 1, 54, 2, 0x0a /* Public */,
8, 2, 57, 2, 0x0a /* Public */,
8, 2, 62, 2, 0x0a /* Public */,
14, 0, 67, 2, 0x0a /* Public */,
// signals: parameters
QMetaType::Void,
// slots: parameters
QMetaType::Bool,
QMetaType::Void, 0x80000000 | 5, 6,
QMetaType::Bool, 0x80000000 | 5, 6,
QMetaType::Bool, QMetaType::Double, QMetaType::Double, 9, 10,
QMetaType::Bool, 0x80000000 | 11, 0x80000000 | 11, 12, 13,
QMetaType::Void,
// enums: name, alias, flags, count, data
15, 15, 0x0, 0, 73,
// enum data: key, value
0 // eod
};
void DatabaseThread::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a)
{
if (_c == QMetaObject::InvokeMetaMethod) {
auto *_t = static_cast<DatabaseThread *>(_o);
Q_UNUSED(_t)
switch (_id) {
case 0: _t->inputSucess(); break;
case 1: { bool _r = _t->createDataTable();
if (_a[0]) *reinterpret_cast< bool*>(_a[0]) = std::move(_r); } break;
case 2: _t->getInputData((*reinterpret_cast< DBValues(*)>(_a[1]))); break;
case 3: { bool _r = _t->insertToSpectrogramTable((*reinterpret_cast< DBValues(*)>(_a[1])));
if (_a[0]) *reinterpret_cast< bool*>(_a[0]) = std::move(_r); } break;
case 4: { bool _r = _t->insertToDataTable((*reinterpret_cast< double(*)>(_a[1])),(*reinterpret_cast< double(*)>(_a[2])));
if (_a[0]) *reinterpret_cast< bool*>(_a[0]) = std::move(_r); } break;
case 5: { bool _r = _t->insertToDataTable((*reinterpret_cast< QVariantList(*)>(_a[1])),(*reinterpret_cast< QVariantList(*)>(_a[2])));
if (_a[0]) *reinterpret_cast< bool*>(_a[0]) = std::move(_r); } break;
case 6: _t->readDBInsertParams(); break;
default: ;
}
} else if (_c == QMetaObject::IndexOfMethod) {
int *result = reinterpret_cast<int *>(_a[0]);
{
using _t = void (DatabaseThread::*)();
if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&DatabaseThread::inputSucess)) {
*result = 0;
return;
}
}
}
}
QT_INIT_METAOBJECT const QMetaObject DatabaseThread::staticMetaObject = { {
QMetaObject::SuperData::link<QThread::staticMetaObject>(),
qt_meta_stringdata_DatabaseThread.data,
qt_meta_data_DatabaseThread,
qt_static_metacall,
nullptr,
nullptr
} };
const QMetaObject *DatabaseThread::metaObject() const
{
return QObject::d_ptr->metaObject ? QObject::d_ptr->dynamicMetaObject() : &staticMetaObject;
}
void *DatabaseThread::qt_metacast(const char *_clname)
{
if (!_clname) return nullptr;
if (!strcmp(_clname, qt_meta_stringdata_DatabaseThread.stringdata0))
return static_cast<void*>(this);
return QThread::qt_metacast(_clname);
}
int DatabaseThread::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
_id = QThread::qt_metacall(_c, _id, _a);
if (_id < 0)
return _id;
if (_c == QMetaObject::InvokeMetaMethod) {
if (_id < 7)
qt_static_metacall(this, _c, _id, _a);
_id -= 7;
} else if (_c == QMetaObject::RegisterMethodArgumentMetaType) {
if (_id < 7)
*reinterpret_cast<int*>(_a[0]) = -1;
_id -= 7;
}
return _id;
}
// SIGNAL 0
void DatabaseThread::inputSucess()
{
QMetaObject::activate(this, &staticMetaObject, 0, nullptr);
}
QT_WARNING_POP
QT_END_MOC_NAMESPACE
| [
"1076992525@qq.com"
] | 1076992525@qq.com |
952b303da1e61d38c2510224419ac400f0722f07 | 140c46f234796da28bc91ea23055754a02d47ab8 | /ui/UtilityWidgets.cpp | c5e182d02f42f317184539f01a3cfa71ee8a6742 | [] | no_license | songjin321/QEstimator | 282b5389ef24a3f1d973eb373175d438b25e55a2 | 50fff7e4c84104f6b32e758825ad9feafb7a5cf6 | refs/heads/master | 2021-01-01T03:57:07.179275 | 2018-09-29T05:09:26 | 2018-09-29T05:09:26 | 58,736,127 | 5 | 3 | null | 2016-05-13T15:06:26 | 2016-05-13T12:00:55 | C++ | UTF-8 | C++ | false | false | 2,143 | cpp | #include "UtilityWidgets.h"
//
RangeDialog::RangeDialog(float *lowVal, float *highVal, QDialog *parent, QString title, QString discribe)
:QDialog(parent),
_lowVal(lowVal),
_highVal(highVal)
{
ledtLow = new QLineEdit(tr("-1"));
ledtHigh = new QLineEdit(tr("-1"));
QPushButton* btnOK = new QPushButton(tr("OK"));
QPushButton* btnCancel = new QPushButton(tr("cancel"));
connect(btnOK,SIGNAL(pressed()),this,SLOT(on_btnOK()));
connect(btnCancel,SIGNAL(pressed()),this,SLOT(close()));
QHBoxLayout* hbl = new QHBoxLayout;
hbl->addWidget(ledtLow);
hbl->addWidget(new QLabel(tr(" - ")));
hbl->addWidget(ledtHigh);
QHBoxLayout* vbl = new QHBoxLayout;
vbl->addStretch();
vbl->addWidget(btnOK);
vbl->addWidget(btnCancel);
QVBoxLayout* layout = new QVBoxLayout;
layout->addWidget(new QLabel(discribe));
layout->addLayout(hbl);
layout->addLayout(vbl);
this->setLayout(layout);
this->setWindowTitle(title);
}
NumberDialog::NumberDialog(float* value,QDialog *parent,QString title,QString discribe)
:QDialog(parent),
_value(value)
{
ledValue=new QLineEdit(tr("-1"));
QPushButton* btnOK = new QPushButton(tr("OK"));
QPushButton* btnCancel = new QPushButton(tr("cancel"));
connect(btnOK,SIGNAL(pressed()),this,SLOT(on_btnOK()));
connect(btnCancel,SIGNAL(pressed()),this,SLOT(close()));
QHBoxLayout* hbl = new QHBoxLayout;
hbl->addWidget(ledValue);
QHBoxLayout* vbl = new QHBoxLayout;
vbl->addStretch();
vbl->addWidget(btnOK);
vbl->addWidget(btnCancel);
QVBoxLayout* layout = new QVBoxLayout;
layout->addWidget(new QLabel(discribe));
layout->addLayout(hbl);
layout->addLayout(vbl);
this->setLayout(layout);
this->setWindowTitle(title);
}
void RangeDialog::on_btnOK(){
//no error check!
*_lowVal = ledtLow->text().toFloat();
*_highVal = ledtHigh->text().toFloat();
qDebug()<<*_lowVal;
this->close();
}
void NumberDialog::on_btnOK(){
*_value=ledValue->text().toFloat();
this->close();
}
| [
"sjinfeixue@Gmail.com"
] | sjinfeixue@Gmail.com |
ac71edf6e3cce37799a6c02f43ee3470306de821 | b3b73a21030e565636073187fa09a33b6c8a0db7 | /Problems/Caesar Cipher.cpp | 24c3968852f52364b8e33edc0f5f78e79265b4ab | [] | no_license | ch05/Exercise | c54e376e13bf52eb1f8601b05159d079dd80227b | 265b527805e1f30fc94d6c57bb6eb41e71372e48 | refs/heads/master | 2021-01-18T23:41:11.219646 | 2016-04-19T03:14:12 | 2016-04-19T03:14:12 | 33,741,854 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,201 | cpp | #include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
string plain, cipher;
int length, shift, diff, curr;
cin >> length;
cin >> plain;
cin >> shift;
cipher = plain;
while(shift > 26){
shift -= 26;
}
for(int i = 0; i < length; i++){
if((plain[i] < 65) || ((plain[i] > 90) && (plain[i] < 97)) || (plain[i] > 122) ){
continue;
}
curr = plain[i] + shift;
if( ((curr <= 90) && (curr >= 65)) && ((plain[i] <= 90) && (plain[i] >= 65)) ){ //A-Z 65-90
cipher[i] = curr;
}
if( ((curr <= 122) && (curr >= 97)) && ((plain[i] <= 122) && (plain[i] >= 97))){ //a-z 97-122)
cipher[i] = curr;
}
else if(((plain[i] <= 122) && (plain[i] >= 97)) && (curr > 122)){
diff = curr - 122;
cipher[i] = 97 + diff - 1;
}
else if(((plain[i] <= 90) && (plain[i] >= 65)) && (curr > 90)){
diff = curr - 90;
cipher[i] = 65 + diff - 1;
}
}
for(int i = 0; i < length; i++){
std::cout << cipher[i];
}
return 0;
}
| [
"sichen5@illinois.edu"
] | sichen5@illinois.edu |
c0bbfe01ad477a033ce93850236512cdc8fa5138 | 51ef482d0a4705e9231efeb3835b45f3f7d6647e | /SEM 4/OS_lab/roundrobin.cpp | 48be133c986992a6d95cee911a182aad4ac6d622 | [] | no_license | devmukul44/VIT-University-Vellore-Lab-Assignment | 40c4b941371a1261878e2041f55a922d2ea4d08a | 761c2a58b40f8cf9f7f07d3c35b95df850e90b93 | refs/heads/master | 2022-01-10T21:35:10.152193 | 2019-05-01T10:48:31 | 2019-05-01T10:48:31 | 77,526,817 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,372 | cpp | #include<stdio.h>
struct p
{
int at,bt,wt,tt,pn,st,ft;
}pr[10];
int main()
{
int n,tq,i,flag=0,f=0,twt=0,ttt=0;
float awt,att;
printf("\nEnter the number of processes:- ");
scanf("%d",&n);
for(i=0;i<n;i++)
{
printf("\nEnter the arrival time of process P%d :-",(i+1));
scanf("%d",&pr[i].at);
pr[i].pn=(i+1);
printf("\nEnter the burst time of process P%d :-",(i+1));
scanf("%d",&pr[i].bt);
}
for(int i=0;i<n;i++)
{
pr[i].wt=0;
pr[i].tt=0;
}
printf("\nEnter the time quantum :-");
scanf("%d",&tq);
i=0;
pr[0].st=0;
for(int k=0;k<n;k++)
{
pr[k].ft=pr[k].at;
}
do
{
flag=0;
if(pr[i].bt>=tq)
{
pr[i].bt=pr[i].bt-tq;
pr[i].wt=pr[i].wt+(pr[i].st-pr[i].ft);
f=f+tq;
pr[i].ft=f;
}
else if(pr[i].bt<tq&&pr[i].bt!=0)
{
f=f+pr[i].bt;
pr[i].bt=0;
pr[i].wt=pr[i].wt+(pr[i].st-pr[i].ft);
pr[i].ft=f;
}
else
{
if(pr[i].bt==0)
{
pr[i].tt=pr[i].ft;
}
}
for(int j=0;j<n;j++)
{
if(pr[j].bt==0)
flag=flag+1;
}
i=(i+1)%n;
pr[i].st=f;
}while(flag!=n);
for(int i=0;i<n;i++)
{
printf("\nWaiting time of process P%d : %d",(i+1),pr[i].wt);
printf("\nTurn around time of process P%d : %d",(i+1),pr[i].ft);
twt=twt+pr[i].wt;
ttt=ttt+pr[i].ft;
}
awt=(float)twt/n;
att=(float)ttt/n;
printf("\nAverage waiting time :- %f",awt);
printf("\nAverage turn around time :- %f",att);
}
| [
"devmukul44@gmail.com"
] | devmukul44@gmail.com |
2f962a99d554fb9801cf6da77747828158c6e427 | 974d04d2ea27b1bba1c01015a98112d2afb78fe5 | /paddle/phi/kernels/elementwise_divide_grad_kernel.h | c764f05c3983fb093c38f6329a69d00f6aed1360 | [
"Apache-2.0"
] | permissive | PaddlePaddle/Paddle | b3d2583119082c8e4b74331dacc4d39ed4d7cff0 | 22a11a60e0e3d10a3cf610077a3d9942a6f964cb | refs/heads/develop | 2023-08-17T21:27:30.568889 | 2023-08-17T12:38:22 | 2023-08-17T12:38:22 | 65,711,522 | 20,414 | 5,891 | Apache-2.0 | 2023-09-14T19:20:51 | 2016-08-15T06:59:08 | C++ | UTF-8 | C++ | false | false | 1,667 | h | /* Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License. */
#pragma once
#include "paddle/phi/core/dense_tensor.h"
#include "paddle/utils/optional.h"
namespace phi {
template <typename T, typename Context>
void DivideGradKernel(const Context& dev_ctx,
const DenseTensor& x,
const DenseTensor& y,
const DenseTensor& out,
const DenseTensor& dout,
int axis,
DenseTensor* dx,
DenseTensor* dy);
template <typename T, typename Context>
void DivideDoubleGradKernel(const Context& dev_ctx,
const DenseTensor& y,
const DenseTensor& out,
const DenseTensor& dx,
const paddle::optional<DenseTensor>& ddx,
const paddle::optional<DenseTensor>& ddy,
int axis,
DenseTensor* dy,
DenseTensor* dout,
DenseTensor* ddout);
} // namespace phi
| [
"noreply@github.com"
] | PaddlePaddle.noreply@github.com |
534b6d5c025e5103767537db698af1259da71c0e | 1e3c820783301b104b8a9004d77d1c104d6ea58b | /bin/tribin.cpp | b7fe6d088f3d214b606283d7fd5d5019f852987e | [] | no_license | fscr3am/tribalpress | 029c7c5d5ee54b7502bbefb9f3b4fbdc6083742f | 5627e27210699012f47158b308bfda831898a072 | refs/heads/master | 2020-07-31T14:15:27.967163 | 2019-09-24T16:18:55 | 2019-09-24T16:18:55 | 210,630,834 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,490 | cpp | #include <iostream>
#include <windows.h>
#include <conio.h>
#include <locale>
using namespace std;
void sendKeyDown(unsigned char keyCode)
{
INPUT input;
input.type = INPUT_KEYBOARD;
input.ki.wVk = keyCode;
input.ki.dwFlags = 0;
input.ki.time = 0;
input.ki.dwExtraInfo = 0;
SendInput(1, &input, sizeof(INPUT));
}
void table(int x,int y){
COORD coord;
coord.X=x;
coord.Y=y;
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE),coord);
}
void sendKeyUp(unsigned char keyCode)
{
INPUT input;
input.type = INPUT_KEYBOARD;
input.ki.wVk = keyCode;
input.ki.dwFlags = KEYEVENTF_KEYUP;
input.ki.time = 0;
input.ki.dwExtraInfo = 0;
SendInput(1, &input, sizeof(INPUT));
}
// Bastır çek fonksiyonları
int main(){
int a;
int pixel;
setlocale(LC_ALL,"Turkish");
// SetCursorPos(700, 600);
// 1440x900 - 400,465
table(12,3);cout << "1- 1280 x 1024";
table(12,4);cout << "2- 1280 x 978";
table(12,5);cout << "3- 1440 x 900";
table(5,20);cout <<"\n\nKlanlar (request1) - HELL";
table(12,10);cout << "Hangi Çözünürlük :";cin >> pixel;
system("Cls");
switch(pixel){
case 1:
table(5,20);cout <<"\n\nKlanlar (request1) - HELL";
table(12,5);cout << "Kaç saldırı olacak :";cin >> a;
sendKeyDown(VK_MENU);
sendKeyDown(VK_TAB);
sendKeyUp(VK_TAB);
sendKeyUp(VK_MENU);
Sleep(100);
SetCursorPos(300, 480);
goto etken;
case 2:
table(5,20);cout <<"\n\nKlanlar (request1) - HELL";
table(12,5);cout << "Kaç saldırı olacak :";cin >> a;
sendKeyDown(VK_MENU);
sendKeyDown(VK_TAB);
sendKeyUp(VK_TAB);
sendKeyUp(VK_MENU);
Sleep(100);
SetCursorPos(300, 450);
goto etken;
case 3:
table(5,20);cout <<"\n\nKlanlar (request1) - HELL";
table(12,5);cout << "Kaç saldırı olacak :";cin >> a;
sendKeyDown(VK_MENU);
sendKeyDown(VK_TAB);
sendKeyUp(VK_TAB);
sendKeyUp(VK_MENU);
Sleep(100);
SetCursorPos(400, 465);
goto etken;
}
cin >> a;
sendKeyDown(VK_MENU);
sendKeyDown(VK_TAB);
sendKeyUp(VK_TAB);
sendKeyUp(VK_MENU);
Sleep(100);
SetCursorPos(300, 480);
etken:
for(int i=0; i<a; ++i)
{
mouse_event(MOUSEEVENTF_LEFTDOWN | MOUSEEVENTF_LEFTUP, 0, 0, 0, 0);
sendKeyDown(VK_CONTROL);
sendKeyDown(VK_TAB);
sendKeyUp(VK_TAB);
sendKeyUp(VK_CONTROL);
mouse_event(MOUSEEVENTF_LEFTDOWN | MOUSEEVENTF_LEFTUP, 0, 0, 0, 0);}
return 0;
// Genel yapı pointer'ı
}
/*
VK_MENU /__--__/ Alt
0x12
*/
| [
"noreply@github.com"
] | fscr3am.noreply@github.com |
069ec6c6dddbbb0a56961b2148aec03fc21bf574 | b0dd7779c225971e71ae12c1093dc75ed9889921 | /boost/spirit/home/phoenix/core/detail/compose.hpp | 359bd1964ed9bddd3be0b068c4b897d6a5b6d192 | [
"LicenseRef-scancode-warranty-disclaimer",
"BSL-1.0"
] | permissive | blackberry/Boost | 6e653cd91a7806855a162347a5aeebd2a8c055a2 | fc90c3fde129c62565c023f091eddc4a7ed9902b | refs/heads/1_48_0-gnu | 2021-01-15T14:31:33.706351 | 2013-06-25T16:02:41 | 2013-06-25T16:02:41 | 2,599,411 | 244 | 154 | BSL-1.0 | 2018-10-13T18:35:09 | 2011-10-18T14:25:18 | C++ | UTF-8 | C++ | false | false | 1,800 | hpp | /*=============================================================================
Copyright (c) 2001-2007 Joel de Guzman
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
==============================================================================*/
#ifndef BOOST_PP_IS_ITERATING
#ifndef PHOENIX_CORE_DETAIL_COMPOSE_DETAIL_HPP
#define PHOENIX_CORE_DETAIL_COMPOSE_DETAIL_HPP
#include <boost/preprocessor/iterate.hpp>
#include <boost/preprocessor/repetition/enum.hpp>
#define PHOENIX_AS_ACTOR_CONVERT(z, n, data) \
as_actor<BOOST_PP_CAT(T, n)>::convert(BOOST_PP_CAT(_, n))
#define BOOST_PP_ITERATION_PARAMS_1 \
(3, (3, PHOENIX_COMPOSITE_LIMIT, \
"boost/spirit/home/phoenix/core/detail/compose.hpp"))
#include BOOST_PP_ITERATE()
#undef PHOENIX_AS_ACTOR_CONVERT
#endif
///////////////////////////////////////////////////////////////////////////////
//
// Preprocessor vertical repetition code
//
///////////////////////////////////////////////////////////////////////////////
#else // defined(BOOST_PP_IS_ITERATING)
#define N BOOST_PP_ITERATION()
template <typename EvalPolicy, BOOST_PP_ENUM_PARAMS(N, typename T)>
inline actor<
typename as_composite<EvalPolicy, BOOST_PP_ENUM_PARAMS(N, T)>::type>
compose(BOOST_PP_ENUM_BINARY_PARAMS(N, T, const& _))
{
return actor<
typename as_composite<EvalPolicy, BOOST_PP_ENUM_PARAMS(N, T)>::type>(
BOOST_PP_ENUM(N, PHOENIX_AS_ACTOR_CONVERT, _));
}
#undef N
#endif // defined(BOOST_PP_IS_ITERATING)
| [
"tvaneerd@rim.com"
] | tvaneerd@rim.com |
4f808a6900b53d08dae38ce5ab6f04400a67eba8 | 0b15c7a046d703e153b6e6054cb57a0664a2d4df | /RobWork/src/sandbox/algorithms/PointConstraint.hpp | 3db95e8c2bab7df86a235e5d0c29cdd209e16da8 | [
"Apache-2.0"
] | permissive | skyellen/robwork-mirror | bf5d97ce19775c2928432854a93fb87ab2f7cd26 | 5a74a49d9ef98eff7c75f48fe48c2e655480e9b3 | refs/heads/master | 2020-04-16T06:10:11.359979 | 2018-09-06T09:26:01 | 2018-09-06T09:26:01 | 165,335,340 | 4 | 0 | null | 2019-01-12T02:01:40 | 2019-01-12T02:01:40 | null | UTF-8 | C++ | false | false | 2,431 | hpp | /********************************************************************************
* Copyright 2009 The Robotics Group, The Maersk Mc-Kinney Moller Institute,
* Faculty of Engineering, University of Southern Denmark
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
********************************************************************************/
#ifndef RW_ALGORITHMS_POINTCONSTRAINT_HPP
#define RW_ALGORITHMS_POINTCONSTRAINT_HPP
/**
* @file PointConstraint.hpp
*/
#include <rw/math/Vector3D.hpp>
#include "ConstraintModel.hpp"
namespace rwlibs { namespace algorithms {
/**
* @brief A point constraint model.
*
* Describes a point constraint, e.g. a part feeder.
*/
class PointConstraint : public ConstraintModel {
public:
//! @brief Smart pointer type to this class.
typedef rw::common::Ptr<PointConstraint> Ptr;
//! @copydoc ConstraintModel::MinSamples
static const int MinSamples = 1;
public: // constructors
/**
* @brief Constructor.
*/
PointConstraint() {};
//! @brief Constructor.
PointConstraint(const std::vector<rw::math::Transform3D<> >& data)
{
refit(data);
}
//! @brief Destructor.
virtual ~PointConstraint() {};
public: // methods
//! @copydoc RANSACModel::fitError
virtual double fitError(rw::math::Transform3D<> sample) const;
//! @copydoc RANSACModel::invalid
virtual bool invalid() const;
//! @copydoc RANSACModel::refit
virtual double refit(const std::vector<rw::math::Transform3D<> >& samples);
//! @copydoc RANSACModel::getMinReqData
static int getMinReqData() { return MinSamples; }
//! @copydoc ConstraintModel::update
virtual void update(rw::math::Transform3D<> sample);
//! @copydoc ConstraintModel::update
virtual void update(std::vector<rw::math::Transform3D<> > sample);
protected: // body
rw::math::Vector3D<double> _point;
};
}} // /namespaces
#endif // include guard
| [
"adwol@mmmi.sdu.dk"
] | adwol@mmmi.sdu.dk |
25ab0027c0f1def39cf07e7b404cb00b750b8066 | 02e6a51bd283d518c85cd461d23a5352bc539250 | /Source/BlackJack/PlayerWinState.cpp | a6619011661291696c6865e4c34596f1985c3596 | [
"MIT"
] | permissive | VictorLeach96/BlackJack | 050d55517b44d7f8a6f1f7b29d420c6f81639442 | fb93b607bec38138b4afe21fe97171e039c6752f | refs/heads/master | 2016-08-12T10:03:11.615136 | 2016-01-06T12:23:19 | 2016-01-06T12:23:19 | 48,953,032 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 650 | cpp | #include "Header.h"
string PlayerWinState::stateName(){
return "PlayerWinState";
}
GameState* PlayerWinState::gameLoop(Player *player, Dealer *dealer, Screen* screen){
GameState* nextState = NULL;
//Update screen with win message
screen->message = "PLAYER WINS!, Press Enter for a rematch or Escape to quit";
screen->drawScreen();
Sleep(500);
//Get key pressed on keyboard and decide which state to move onto
switch (_getch()){
case 27: //Escape Key
nextState = new EndedState();
break;
case 13: //Enter Key
nextState = new DealState();
break;
default: break; //Other Keys
}
return nextState;
} | [
"victor96@mac.com"
] | victor96@mac.com |
0b8ea0e585f9d138fcaa153d361bd4b82f81e7a8 | fa017e7a5b6e0b79c3a78f11d618d46af3dffece | /List.cpp | fb60eebbcdb87267faf95a7649bfbb1798270c9b | [] | no_license | leyap/Timer | 5c76191c038b2ed3c869547fbe23779b1b3967e9 | eb2c5679a896fc781223763b83afee93cb17f8a8 | refs/heads/master | 2020-12-26T10:08:39.782775 | 2014-04-12T06:40:32 | 2014-04-12T06:40:32 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,756 | cpp | //////////////////////////////////////////////////////////////////////////////////////
// Copyright (c) 2012 by Byron Watkins <ByronWatkins@clear.net>
// List library for arduino.
//
// This file is free software; you can redistribute it and/or modify
// it under the terms of either the GNU General Public License version 2
// or the GNU Lesser General Public License version 2.1, both as
// published by the Free Software Foundation.
//////////////////////////////////////////////////////////////////////////////////////
/// List.cpp - Source file for List class.
///
/// Usage: 1 Instantiate a List object. The maximum list length is determined by
/// MAX_LIST_PTRS defined below.
/// 2 Create struct objects and "Add" pointers to the structs to the List.
/// One may also "InsertAt" pointers to the struct. Pointers to
/// structs can also be added using the listName[n]=pStruct operator.
/// 3 "Remove" objects from the list. This also moves List objects below
/// the removed object up one index number.
/// 4 "GetCount" returns the current list length and can be used to point
/// to the first empty entry.
/// 5 It is essential that users understand that List stores only the
/// pointers to the data and not the data itself. If the object
/// containing the data is deleted or goes out of scope, then the
/// pointer in List becomes useless.
//////////////////////////////////////////////////////////////////////////////////////
#include "List.h"
/// Constructor empties List and NULLs first entry.
List::List()
{
m_ptrList [0] = static_cast<pObject>(0);
m_Counter = 0;
}
/// Destructor frees memory.
List::~List()
{
//dtor
}
/// Add an object's pointer to the bottom of List. The object must be declared
/// static or global so it never goes out of scope.
/**
\param pData A pointer to the data added to List.
\return New number of elements in List.
*/
uint8_t List::Add (pObject pData)
{
if (m_Counter < MAX_LIST_PTRS)
m_ptrList [m_Counter++] = pData;
return m_Counter;
}
/// Insert a new element into List at arbitrary position.
/**
\param index The index number of the new element after insertion.
\param pData The pointer to be inserted into the List.
*/
void List::InsertAt (const uint8_t index, pObject pData)
{
if (m_Counter < MAX_LIST_PTRS)
{
for (uint8_t i=m_Counter; i>index; i--)
m_ptrList [i] = m_ptrList [i-1];
m_ptrList [index] = pData;
m_Counter++;
}
}
/// Exchange two elements in the List.
/**
\param i1 The index number of the first element to be swapped.
\param i2 The index number of the second element to be swapped.
*/
void List::Swap (const uint8_t i1, const uint8_t i2)
{
pObject temp = m_ptrList [i1];
m_ptrList [i1] = m_ptrList [i2];
m_ptrList [i2] = temp;
}
/// Remove a specific element from List.
/**
\param index The index number of the element to be deleted.
*/
void List::Remove (const uint8_t index)
{
for (uint8_t i=index; i<m_Counter-1; i++)
m_ptrList [i] = m_ptrList [i+1];
if (index < m_Counter)
m_Counter--;
}
/// Element accessor operator. The element can then be read or written.
/// Using static_cast<>(), the returned element's members can also be
/// read or written.
/**
\param index The index number of the element to be accessed.
\return The element referenced by index is a pointer to the user's struct.
*/
pObject List::operator [] (const uint8_t index)
{
return m_ptrList [index];
}
/// Get the number of elements presently held by List.
/**
\return the number of elements already in the list.
*/
uint8_t List::GetCount () const
{
return m_Counter;
}
| [
"byron.watkins@comcast.net"
] | byron.watkins@comcast.net |
273a909d5c634b0394b125a541f1f4fe4eafeb59 | d80c3fb3d79c38c77d695459fa6a68ab227ee8ec | /Week 2/SearchInsertPosition.cpp | 75046f418fd507baaacef8607c4cdb46af31fe5b | [] | no_license | keerthisree-raghu/June-LeetCoding-Challenge | df0802d1d464ef055c1919b4556ea7133a3a31e9 | c00aed9dd01eadeac72df8a5add9d578446f808a | refs/heads/master | 2023-01-05T11:02:49.760158 | 2020-10-20T17:03:43 | 2020-10-20T17:03:43 | 268,586,039 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,360 | cpp | // SEARCH INSERT POSITION
/* PROBLEM:
Given a sorted array and a target value, return the index if the target is found.
If not, return the index where it would be if it were inserted in order.
You may assume no duplicates in the array.
*/
/* EXAMPLES:
Input: [1,3,5,6], 5
Output: 2
Input: [1,3,5,6], 2
Output: 1
Input: [1,3,5,6], 7
Output: 4
Input: [1,3,5,6], 0
Output: 0
*/
/* APPROACH: Binary Search - O(logn)
1. Initialize two pointer variables to point to the extreme ends of the array.
2. Iterate until the condition (left <= right) breaks.
3. Calculate the mid value such that overflow is avoided.
4. If the target is found in the array, return the index value.
5. If the target is greater than the mid value, the searching proceeds in the right half of the array.
6. If the target is less than the mid value, the searching proceeds in the left half of the array.
7. If the code exits the loop
a. This means that left >= right + 1.
b. But, the target index is between [left, right + 1], so left <= right.
c. From a and b, left = right + 1.
So the index to be returned is at [left, left]->left or [right + 1, right + 1]->right + 1.
*/
// SOLUTION:
#include <bits/stdc++.h>
using namespace std;
class Solution {
public:
int searchInsert(vector<int>& nums, int target) {
int left = 0;
int right = nums.size() - 1;
while(left <= right) {
// Calculate mid value
// Conventional (left + right) / 2 may cause overflow
int mid = left + (right - left) / 2;
// Return index value if the target is found in the array
if(nums[mid] == target) {
return mid;
}
// The target is in the right half of the array
else if(nums[mid] < target) {
left = mid + 1;
}
// The target is in the left half of the array
else {
right = mid - 1;
}
}
// [1] When the code reaches this point, left >= right + 1
// [2] Since the target index is between [left, right + 1], so left <= right + 1
// [3] From [1] and [2], left = right + 1, so we can return left as the index value
return left;
}
}; | [
"raghu.keerthisree@gmail.com"
] | raghu.keerthisree@gmail.com |
c94152890c940b22bdb79f243c4f1585d5936f63 | 024d621c20595be82b4622f534278009a684e9b7 | /SupportPosCalculator.h | a5e6a26a02bc832a3e52b38065da83d11c7d94e0 | [] | no_license | tj10200/Simple-Soccer | 98a224c20b5e0b66f0e420d7c312a6cf6527069b | 486a4231ddf66ae5984713a177297b0f9c83015f | refs/heads/master | 2021-01-19T09:02:02.791225 | 2011-03-15T01:38:15 | 2011-03-15T01:38:15 | 1,480,980 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,396 | h | #ifndef SUPPORTING_POS_CALCULATOR_H
#define SUPPORTING_POS_CALCULATOR_H
#include "GameHeaders.h"
#include "Player.h"
class SupportPosCalculator
{
private:
D3DXVECTOR2 **regions,
goal,
RegSize;
Player *teammate,
*oppTeam,
*ballCarrier;
int rows,
cols,
numPlayers,
homeTeamIdxOffset;
double **passPotential,
**goalPotential,
**supportRegions,
**distValue;
bool regionsAvail;
void passPotentialCalc ();
void goalPotentialCalc ();
void distFromAttackerCalc();
void setBallCarrier ();
public:
SupportPosCalculator (D3DXVECTOR2 **Regs, D3DXVECTOR2 Goal, Player *sameTeam,
Player *opposing, int RegRows, int RegCols,
int players, bool isHomeTeam, int regOffset){
regions = Regs;
goal = Goal;
teammate = sameTeam;
oppTeam = opposing;
passPotential = new double *[RegRows];
goalPotential = new double *[RegRows];
supportRegions = new double *[RegRows];
distValue = new double *[RegRows];
for (int x = 0; x < RegRows; x++)
{
passPotential[x] = new double [RegCols];
goalPotential[x] = new double [RegCols];
supportRegions[x]= new double [RegCols];
distValue[x] = new double [RegCols];
}
rows = RegRows;
cols = RegCols;
numPlayers = players;
homeTeamIdxOffset = regOffset;
regionsAvail = false;
}
D3DXVECTOR2 getBestSupportPos ();
double getPassPotential ( int regX,
int regY);
double getGoalPotential ( int regX,
int regY);
Player *getClosestTeammate ( Player p,
Player *team);
Player *getClosestToTgt ( Player *team,
D3DXVECTOR2 tgt);
D3DXVECTOR2 getGoalShot ( Player *p);
D3DXVECTOR2 getPassShot ( Player *p,
Player *team);
void calcSupportingRegions ( Player *ballCarrier);
D3DXVECTOR2 getSupportPos ( Player *p,
Player *ball);
bool isShotSafe ( D3DXVECTOR2 startLoc,
D3DXVECTOR2 endLoc);
};
#endif
| [
"tjjohnson10200@gmail.com"
] | tjjohnson10200@gmail.com |
2bfe47d03c36ea6de60fff73bd83032d3c75dc80 | 42fc6ef081b64fc60bdc70fcdb384a6c70343c25 | /Mohd Uzaif/Rotate Array/RotateArray.cpp | 5c923a8966205f929b9b6a3a3be6f4ff1aa67456 | [] | no_license | CSoC-2020/Project-on-Data-structure | b7e62e8f31f624884e313dbdee4f64d0d18eeb07 | 6f317b29f780626df21b54599a35ac3c3eb0970e | refs/heads/master | 2022-11-06T18:28:59.901919 | 2020-06-23T22:00:19 | 2020-06-23T22:00:19 | 261,388,319 | 1 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 560 | cpp | class Solution {
public:
void rotate(vector<int>& nums, int k) {
if(k>nums.size())
{
k=k%nums.size();
}
for(int i=0,j=nums.size()-1;i<j;i++,j--)
{
int temp;
temp=nums[i];
nums[i]=nums[j];
nums[j]=temp;
}
for(int i=0,j=k-1;i<j;i++,j--)
{
int temp;
temp=nums[i];
nums[i]=nums[j];
nums[j]=temp;
}
for(int i=k,j=nums.size()-1;i<j;i++,j--)
{
int temp;
temp=nums[i];
nums[i]=nums[j];
nums[j]=temp;
}
}
};
| [
"imuzaifmohd@gmail.com"
] | imuzaifmohd@gmail.com |
b1d3b1c0a008897dd43aca9b81fd95dce9cc2c38 | 32bfc176a5db0d59129f3c39381c46b0a520eb86 | /demos/parallaxhome/StreamMusicTest/HTTP_window.h | 1909696ee6acaef3a2ac664a2f2895e3d37c9b22 | [] | no_license | varzhou/Hifi-Pod | 2fb4c6bd3172720f8813fbbdf48375a10598a834 | eec4e27e37bc5d99b9fddb65be06ef5978da2eee | refs/heads/master | 2021-05-28T18:26:14.507496 | 2012-09-16T05:45:28 | 2012-09-16T05:45:28 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 760 | h | /*
* MyPlayer.h
*/
#ifndef MYHTTPWINDOW_H_
#define MYHTTPWINDOW_H_
#include <QWidget>
#include <QLabel>
#include <QLineEdit>
#include <QHttp>
#include <QFile>
#include <QProgressDialog>
#include <QListWidget>
#include <QPushButton>
struct MyDataItem
{
QString audio;
QString title;
};
class HttpWindow : public QWidget
{
Q_OBJECT
public:
HttpWindow();
public slots:
void itemSelected(QListWidgetItem *item);
void PlayFile();
signals:
void streamSelected(QString);
private:
void addTestData();
private:
QList<MyDataItem> items;
QListWidget* listWidget;
QPushButton* pushBut;
};
#endif /* MYHTTPWINDOW_H_ */
| [
"root@(none).(none)"
] | root@(none).(none) |
90f3744f0f12ce583c24e257f4746765842dbb43 | 41499f73e807ac9fee5e2ff96a8894d08d967293 | /FORKS/C++/OpenPGP/tree/Encryptions/SymAlg.cpp | a24e5d989a21ff4b312dd04b444660638091aa71 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference",
"WTFPL",
"LicenseRef-scancode-warranty-disclaimer"
] | permissive | lordnynex/CLEANUP | c9f3058ec96674696339e7e936170a8645ddc09b | 77e8e3cad25ce740fefb42859d9945cc482e009a | refs/heads/master | 2021-01-10T07:35:08.071207 | 2016-04-10T22:02:57 | 2016-04-10T22:02:57 | 55,870,021 | 5 | 1 | WTFPL | 2023-03-20T11:55:51 | 2016-04-09T22:36:23 | C++ | UTF-8 | C++ | false | false | 82 | cpp | #include "SymAlg.h"
SymAlg::SymAlg() :
keyset(false)
{}
SymAlg::~SymAlg(){}
| [
"lordnynex@gmail.com"
] | lordnynex@gmail.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.