blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 4 201 | content_id stringlengths 40 40 | detected_licenses listlengths 0 85 | license_type stringclasses 2
values | repo_name stringlengths 7 100 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringclasses 260
values | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 11.4k 681M ⌀ | star_events_count int64 0 209k | fork_events_count int64 0 110k | gha_license_id stringclasses 17
values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 80
values | src_encoding stringclasses 28
values | language stringclasses 1
value | is_vendor bool 1
class | is_generated bool 2
classes | length_bytes int64 8 9.86M | extension stringclasses 52
values | content stringlengths 8 9.86M | authors listlengths 1 1 | author stringlengths 0 119 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
d6b82dbf129290f4c47277777bcdcbe4b2e5fb1b | 2bb2c91f01c9b9a02744551e93dc01635adbb029 | /Lab4/monitory.cpp | 671ac5366b1c40b212164871b7719ede4d8de219 | [] | no_license | miwanek/SOI-projects | ba98acdcb783fa8b9088f54b0097a05e21c6fe96 | db6fc3543b6bb67379519b8d81c0bd2674eba627 | refs/heads/master | 2020-03-17T22:18:03.025102 | 2018-06-02T20:09:16 | 2018-06-02T20:09:16 | 133,997,925 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 5,713 | cpp | #include <iostream>
#include <thread> // biblioteka, która od c++11 udostępnia wygodną obsługę wątków
#include <vector> // biblioteka do używania vector'a
#include "monitor.h" // monitor od kruka
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <string> // atoi
using namespace std;
unsigned int maker_number;
unsigned int queue_size;
unsigned int item_limit;
class Cyclic_Buffer // bufor cykliczny, który realizuje kolejkę fifo
{
public:
Cyclic_Buffer(unsigned int queue_size): current_size(0), buffer_size(queue_size), place_to_insert(0), place_to_extract(0)
{
buff= new int[queue_size];
}
~Cyclic_Buffer()
{
delete buff;
}
unsigned int get_current_size()
{
return current_size;
}
unsigned int get_max_size()
{
return buffer_size;
}
bool buffer_full()
{
if(current_size == buffer_size) return true;
else return false;
}
bool buffer_empty()
{
if(current_size == 0 ) return true;
else return false;
}
void insert_element( int item)
{
if(buffer_full() == true )
{
std::cout<<"Blad zapisu";
return;
}
buff[place_to_insert]= item;
place_to_insert= (place_to_insert +1) % buffer_size ;
++current_size;
}
int extract_element()
{
if(buffer_empty()== true )
{
std::cout<<"Blad odczytu";
return -1;
}
int extracted_element = buff[place_to_extract];
buff[place_to_extract]= 0;
place_to_extract= (place_to_extract +1) % buffer_size ;
--current_size;
return extracted_element;
}
private:
unsigned int current_size;
unsigned int buffer_size;
int* buff;
unsigned int place_to_insert;
unsigned int place_to_extract;
};
class Extended_Monitor : Monitor
{
public:
Extended_Monitor( unsigned int queue_size) : item_queue(queue_size) {}
void add_element( int new_item, thread::id maker_id)
{
enter();
if(item_queue.buffer_full() == true )
{
wait(Not_Full);
}
item_queue.insert_element(new_item);
cout<< "Producent o id "<<maker_id<<" wyprodukował produkt "<<new_item<<endl;
if(item_queue.get_current_size() == 1)
{
signal(Not_Empty);
}
leave();
}
void get_element()
{
enter();
if(item_queue.buffer_empty() == true )
{
wait(Not_Empty);
}
unsigned int extracted_item = item_queue.extract_element();
cout<<"Klient odebral produkt "<< extracted_item << endl;
if(item_queue.get_current_size() == item_queue.get_max_size() - 1)
{
signal(Not_Full);
}
leave();
}
private:
Condition Not_Full; // zmienna zawieszająca wątek jeśli kolejka pełna
Condition Not_Empty; // zmienna zawieszająca wątek jeśli kolejka pusta
//Condition Queue_not_used;
Cyclic_Buffer item_queue; // nasza kolejka FIFO realizowana jako bufor cykliczny
};
void maker_task( unsigned int item_limit, Extended_Monitor* used_monitor )
{
unsigned int sent_items = 0; // na starcie producent nie wytworzył jeszcze nic
unsigned int necessary_time; // dodatkowo, losowy czas do odczekania
unsigned int ret ;
unsigned int item;
std::thread::id maker_id= this_thread::get_id(); // Wyciągamy id naszego wątku
cout<< "Producent o id "<<maker_id<<" rozpoczyna prace"<<endl;
while(sent_items < item_limit)
{
usleep(50000);
item = rand() % 1000; // + maker_pid % 1000; // generujemy produkt
necessary_time= ( rand()%item ) *500; // losujemy czas do odczekania
usleep(necessary_time);
used_monitor->add_element( item, maker_id); // wstawiamy element do kolejki
sent_items++;
}
cout<< "Wątek producenta o id "<<maker_id<<" zakończony"<<endl;
}
void client_task( unsigned int maker_number, unsigned int item_limit, Extended_Monitor* used_monitor )
{
cout<<"Wątek klienta uruchomiony"<<endl;
unsigned int received_items = 0; // na starcie nie odebrał żadnych produktów
unsigned int necessary_time;
unsigned int ret ;
while(received_items < maker_number * item_limit) // do odebrania jest tyle produktów co producent*limit towarów
{
usleep(30000);
necessary_time= ( rand()%1000 ) *20; // losujemy czas do odczekania
usleep(necessary_time);
used_monitor->get_element(); //zabieramy produkty z kolejki
received_items++;
}
cout<<"Proces klienta zakonczony"<<endl;
}
int main(int argc, char* argv[] )
{
if(argc!= 4)
{
cout << "Podano zbyt mala liczbe argumentow "<< endl;
cout<<"Nalezy podac kolejno: liczbe producentow, rozmiar bufora oraz liczbe towarow do wyprodukowania przez kazdego producent"<<endl;
exit(0);
}
srand(time(NULL));
maker_number= atoi(argv[1]); // odbieramy dane podane przez użytkownika
queue_size= atoi(argv[2]); // rozmiar kolejki
item_limit= atoi(argv[3]); // liczba przedmiotów do wyprodukowania przez każdego producenta
if(queue_size <=0 )
{
cout<<"To chyba żart. Kolejka musi miec rozmiar co najmniej 1"<<endl;
return -1;
}
Extended_Monitor used_monitor(queue_size); // tworzymy sobie statyczny monitor widoczny dla wszystkich wątków
std::thread client(client_task,maker_number, item_limit, &used_monitor); // tworzymy proces konsumenta
vector<thread> producers(maker_number); // tworzymy wektor wątków o rozmiarze podanym przez użytkownika, na razie nie mamy tu żadnych wątków
for( size_t i=0 ; i< maker_number; i++ ) // wrzucamy procesy producentów
{
producers[i]= thread(maker_task ,item_limit, &used_monitor ); // dodajemy wątki do wektora
}
for( size_t i=0 ; i< maker_number; i++ ) // wrzucamy procesy producentów
{
producers[i].join(); // czekamy na zakończenie procesów producenta
}
client.join(); //czekamy na zakończenie procesów konsumenta
return 0;
}
| [
"miwanek1@wp.pl"
] | miwanek1@wp.pl |
c5688ee57524109036b63d90fbbca416b68d1d05 | 7f2c85afd83f7bc3f14612c7868856c6262bb4e6 | /simplest_ffmpeg_video_encoder/simplest_ffmpeg_video_encoder/scopeguard.h | f44748e217fb58ad1035f22d40511209c360e50b | [] | no_license | jiemojiemo/ffmpeg | cf997e5e8eb461a7973e8eea05acd83d8323d7ca | ad4f2a061d23d9e87bfd0b934f579aa9713cc216 | refs/heads/master | 2021-01-10T09:10:39.520537 | 2015-10-19T03:08:02 | 2015-10-19T03:08:02 | 44,098,989 | 5 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 769 | h | #pragma once
#include <vector>
#include <functional>
class ScopeGuard{
private:
bool m_dismissed;
std::function<void ()> m_onExitScope;
private:
ScopeGuard( const ScopeGuard& sg );
ScopeGuard& operator=( const ScopeGuard& sg );
public:
explicit ScopeGuard( std::function<void()> onExitScope )
: m_onExitScope( onExitScope ), m_dismissed( false )
{
}
void Dismiss() {
m_dismissed = true;
}
~ScopeGuard()
{
if( !m_dismissed )
{
m_onExitScope();
}
}
};
#define SCOPEGUARD_LINENAME_CAT(name, line) name##line
#define SCOPEGUARD_LINENAME(name, line) SCOPEGUARD_LINENAME_CAT(name, line)
#define ON_SCOPE_EXIT(callback) ScopeGuard SCOPEGUARD_LINENAME(EXIT,__LINE__)(callback)
| [
"hw@meitu.com"
] | hw@meitu.com |
d0bae3d8bf92b67f4b1c736b8e91d4ada7954909 | 86a0de8665beb155bd652a486b88018551823d86 | /src/Conversion/ONNXToKrnl/Tensor/Concat.cpp | 2b54eeed104842bcf771abd5f031bfc5b76fecc9 | [] | no_license | JuAntonioParedes/ProyecFinalAutomatas2 | 43bbacd86569a16a57082e77dbc621dc5f8cec33 | 048d4a0ce33afdf98d1055a4eb854c6ceae9c24b | refs/heads/main | 2023-06-03T18:04:10.508118 | 2021-06-23T04:55:19 | 2021-06-23T04:55:19 | 378,960,050 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,402 | cpp | /*
* SPDX-License-Identifier: Apache-2.0
*/
//===---------------- Concat.cpp - Lowering Concat Op -------------------===//
//
// Copyright 2019 The IBM Research Authors.
//
// =============================================================================
//
// This file lowers the ONNX Concat Operator to Krnl dialect.
//
//===----------------------------------------------------------------------===//
#include "src/Conversion/ONNXToKrnl/ONNXToKrnlCommon.hpp"
#include "src/Dialect/ONNX/ONNXShapeHelper.hpp"
using namespace mlir;
struct ONNXConcatOpLowering : public ConversionPattern {
ONNXConcatOpLowering(MLIRContext *ctx)
: ConversionPattern(mlir::ONNXConcatOp::getOperationName(), 1, ctx) {}
LogicalResult matchAndRewrite(Operation *op, ArrayRef<Value> operands,
ConversionPatternRewriter &rewriter) const final {
// Gather info.
auto loc = op->getLoc();
ONNXConcatOpAdaptor operandAdaptor(operands);
ONNXConcatOp concatOp = llvm::cast<ONNXConcatOp>(op);
ONNXConcatOpShapeHelper shapeHelper(&concatOp, rewriter,
getDenseElementAttributeFromKrnlValue,
loadDenseElementArrayValueAtIndex);
auto shapecomputed = shapeHelper.Compute(operandAdaptor);
(void)shapecomputed;
assert(succeeded(shapecomputed));
auto axis = concatOp.axis();
int inputNum = operands.size();
// Alloc and dealloc.
auto resultOperand = concatOp.concat_result();
auto outputMemRefType = convertToMemRefType(*op->result_type_begin());
auto resultShape = outputMemRefType.getShape();
auto rank = resultShape.size();
Value alloc = insertAllocAndDeallocSimple(
rewriter, op, outputMemRefType, loc, shapeHelper.dimsForOutput(0));
;
// Creates loops, one for each input.
for (int i = 0; i < inputNum; ++i) {
OpBuilder::InsertionGuard insertGuard(rewriter);
// Operand info.
auto currShape = operands[i].getType().cast<MemRefType>().getShape();
// Create loop.
BuildKrnlLoop inputLoops(rewriter, loc, rank);
inputLoops.createDefineOp();
for (int r = 0; r < rank; ++r)
inputLoops.pushBounds(0, operands[i], r);
inputLoops.createIterateOp();
rewriter.setInsertionPointToStart(inputLoops.getIterateBlock());
// Indices for the read and write.
SmallVector<Value, 4> readIndices;
SmallVector<Value, 4> writeIndices;
for (int r = 0; r < rank; ++r) {
readIndices.emplace_back(inputLoops.getInductionVar(r));
if (r != axis || i == 0) {
writeIndices.emplace_back(inputLoops.getInductionVar(r));
} else {
IndexExprScope IEScope(&rewriter, loc);
IndexExpr writeOffset = DimIndexExpr(inputLoops.getInductionVar(r));
for (int j = 0; j < i; j++) {
MemRefBoundsIndexCapture operandJBounds(operands[j]);
writeOffset = writeOffset + operandJBounds.getDim(r);
}
writeIndices.emplace_back(writeOffset.getValue());
}
}
// Insert copy.
auto loadData =
rewriter.create<KrnlLoadOp>(loc, operands[i], readIndices);
rewriter.create<KrnlStoreOp>(loc, loadData, alloc, writeIndices);
}
rewriter.replaceOp(op, alloc);
return success();
}
};
void populateLoweringONNXConcatOpPattern(
RewritePatternSet &patterns, MLIRContext *ctx) {
patterns.insert<ONNXConcatOpLowering>(ctx);
}
| [
"noreply@github.com"
] | noreply@github.com |
9009fffecee88765b7c593ba16ffa737100887d1 | 0ab9e007c7dd11420e671785f584031f47f1504b | /src/ballistica/generic/timer_list.h | daf5d7dfe656daa79fec0087767918634e794068 | [
"MIT"
] | permissive | Dliwk/ballistica | 7872e1e8d0f3a2d92c9a6c211acade3961cbafdd | 73b18e449838c19c87fb86147a253300836cfe89 | refs/heads/master | 2023-07-21T23:28:43.380564 | 2023-01-18T18:40:44 | 2023-01-18T18:40:44 | 254,022,422 | 0 | 0 | MIT | 2020-04-09T12:20:04 | 2020-04-08T07:58:10 | Python | UTF-8 | C++ | false | false | 2,112 | h | // Released under the MIT License. See LICENSE for details.
#ifndef BALLISTICA_GENERIC_TIMER_LIST_H_
#define BALLISTICA_GENERIC_TIMER_LIST_H_
#include <cstdio>
#include <vector>
#include "ballistica/ballistica.h"
#include "ballistica/core/object.h"
namespace ballistica {
class TimerList {
public:
TimerList();
~TimerList();
// Run timers up to the provided target time.
void Run(TimerMedium target_time);
// Create a timer with provided runnable.
auto NewTimer(TimerMedium current_time, TimerMedium length,
TimerMedium offset, int repeat_count,
const Object::Ref<Runnable>& runnable) -> Timer*;
// Return a timer by its id, or nullptr if the timer no longer exists.
auto GetTimer(int id) -> Timer*;
// Delete a currently-queued timer via its id.
void DeleteTimer(int timer_id);
// Return the time until the next timer goes off.
// If no timers are present, -1 is returned.
auto GetTimeToNextExpire(TimerMedium current_time) -> TimerMedium;
// Return the active timer count. Note that this does not include the client
// timer (a timer returned via getExpiredTimer() but not yet re-submitted).
auto active_timer_count() const -> int { return timer_count_active_; }
auto empty() -> bool { return (timers_ == nullptr); }
void Clear();
private:
// Returns the next expired timer. When done with the timer,
// return it to the list with Timer::submit()
// (this will either put it back in line or delete it)
auto GetExpiredTimer(TimerMedium target_time) -> Timer*;
auto GetExpiredCount(TimerMedium target_time) -> int;
auto PullTimer(int timer_id, bool remove = true) -> Timer*;
auto SubmitTimer(Timer* t) -> Timer*;
void AddTimer(Timer* t);
int timer_count_active_ = 0;
int timer_count_inactive_ = 0;
int timer_count_total_ = 0;
Timer* client_timer_ = nullptr;
Timer* timers_ = nullptr;
Timer* timers_inactive_ = nullptr;
int next_timer_id_ = 1;
bool running_ = false;
bool are_clearing_ = false;
friend class Timer;
};
} // namespace ballistica
#endif // BALLISTICA_GENERIC_TIMER_LIST_H_
| [
"ericfroemling@gmail.com"
] | ericfroemling@gmail.com |
e5f7ed0d11616f11e1d96f41ebe113fa4948a315 | cf13051a437f7ce4801a2efb67c3c23f01ac66cf | /cxx/nailfold/qtools/ncm_qcapture2/ncm_qcapture2_gui.cpp | cb7f9d772f13d43ecf88f14dd5b52d2b20f1dec8 | [] | no_license | IdiosApps/isbe | b09e277083fc904f84f7914e4ead84cb298c9e67 | c4e61764f483a29f058ab39db9d7000bd846e08e | refs/heads/master | 2021-06-17T13:07:02.061534 | 2017-05-09T20:18:24 | 2017-05-09T20:20:35 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 58,903 | cpp | #include "ncm_qcapture2_gui.h"
#include <vcl_iomanip.h>
#include <vil/vil_math.h>
#include <vil/vil_load.h>
#include <vil/vil_convert.h>
#include <vsl/vsl_quick_file.h>
#include <qcore/qcore_convert_image.h>
#include <nailfold/ncm_apt_controller.h>
//
//: Constructor
ncm_qcapture2_gui::ncm_qcapture2_gui(QWidget *parent, Qt::WFlags flags)
: QMainWindow(parent, flags),
raw_pixmap_item_d_(0),
brightness_(2),
contrast_(2),
current_camera_(0),
save_from_camera_(2, false),
diff_frame_(2, false),
flipped_h_(2, false),
flipped_v_(2, false),
// Constants
motors_are_live_(false),
pixels_per_mm_(1158.2),
n_sharpness_(10)
{
// setup the UI
ui.setupUi(this);
//Set up the radio button group to select the current camera
currentCameraRadioGroup = new QButtonGroup(this);
currentCameraRadioGroup->addButton(ui.activeCameraButton1, 0);
currentCameraRadioGroup->addButton(ui.activeCameraButton2, 1);
currentCameraRadioGroup->setExclusive(true);
//ui.activeCameraButton1->setChecked(true);
QObject::connect( currentCameraRadioGroup, SIGNAL(buttonClicked( int )),
this, SLOT(change_active_camera( int )) );
//Initialise the vector to store the two cameras
cameras_.resize(2);
cameras_[0] = new ncm_dmk_camera();
cameras_[1] = new ncm_dmk_camera();
//Initialise the vector of savers
savers_.resize(2);
savers_[0] = new ncm_qcapture2_saver();
savers_[1] = new ncm_qcapture2_saver();
//get brightness and contrast from sliders
brightness_.fill(ui.brightnessSlider->value());
contrast_.fill(ui.contrastSlider->value());
//Set up raw pixmaps for the two camera views
raw_pixmap_items_.resize(2);
raw_pixmap_items_.fill( 0 );
//Set up color tables for the two cameras
raw_colour_tables_.resize(2);
update_raw_colour_table(brightness_[0], contrast_[0], raw_colour_tables_[0]);
update_raw_colour_table(brightness_[1], contrast_[1], raw_colour_tables_[1]);
update_diff_colour_table(ui.brightnessSlider->value(), ui.contrastSlider->value());
//Initialise the two camera scenes
scenes_.resize(2);
scenes_[0] = new QGraphicsScene();
scenes_[1] = new QGraphicsScene();
// tell graphics view to use this scene
ui.cameraView1->setScene(scenes_[ 0 ]);
ui.cameraView2->setScene(scenes_[ 1 ]);
ui.lastFrameView->setScene(&scene_d_);
//Link the data managers queue to the cameras
cameras_[ 0 ]->set_queue( ncm_qcapture2_data_manager::Instance()->main_queue(0) );
cameras_[ 1 ]->set_queue( ncm_qcapture2_data_manager::Instance()->main_queue(1) );
initialize_registry_accessor();
initialize_saver();
update_apt_comboboxes();
initialize_apt_spinboxes();
/*if (apt_.n_controllers() == 0)
{
// Disable the motor tab if no controllers exist.
int motorsIndex = ui.tabWidget->indexOf(ui.tabMotors);
ui.tabWidget->setTabEnabled(motorsIndex, false);
}
else
{
initialize_apt_thread();
}*/ //MOTOR_SWITCH_OFF
initialize_processor_thread();
initialize_saver_thread();
initializeAlignerThread();
//vcl_string artefacts_filename =
// "U:/projects/nailfold/capture/2013_02_21/Left/Digit4/x300/15_01_31/_diff.png";
//vil_image_view<vxl_byte> artefact_image_byte =
// vil_load(artefacts_filename.c_str());
//vil_convert_cast(artefact_image_byte, artefact_image_);
//vil_math_scale_and_offset_values(artefact_image_, 1.0, -128);
initializeStatusbar();
connect_signals_to_slots();
}
//
//: Destructor
ncm_qcapture2_gui::~ncm_qcapture2_gui()
{
}
// Events
void ncm_qcapture2_gui::closeEvent(QCloseEvent *ev)
{
if (savers_[0]->is_saving() || savers_[1]->is_saving())
{
QMessageBox msgBox;
msgBox.setText("Still saving frames - please wait.");
msgBox.setIcon(QMessageBox::Information);
msgBox.exec();
ev->ignore();
return;
}
// Disconnect the cameras
if ( cameras_[0]->is_connected( ) )
cameras_[0]->disconnect_device();
if ( cameras_[1]->is_connected( ) )
cameras_[1]->disconnect_device();
// Close the threads
saver_thread_.quit();
processor_thread_.quit();
//apt_thread_.quit();
ev->accept();
}
//:Compute new min/max contrasts given new brightness/contrast values
void ncm_qcapture2_gui::update_contrasts(int brightness, int contrast, int & c_min, int & c_max) {
int contrast_min = (255-brightness) - (255-contrast)/2;
int contrast_max = (255-brightness) + (255-contrast)/2;
if (contrast_min < 0)
c_min = 0;
else if (contrast_min > 255)
c_min = 255;
else
c_min = contrast_min;
if (contrast_max < 0)
c_max = 0;
else if (contrast_max > 255)
c_max = 255;
else
c_max = contrast_max;
}
//
//: Change colormap for raw images to effect a change in contrast
void ncm_qcapture2_gui::update_raw_colour_table(int brightness, int contrast, QVector<QRgb> &raw_colour_table)
{
int contrast_min, contrast_max;
update_contrasts(brightness, contrast, contrast_min, contrast_max);
raw_colour_table.resize(256);
// fill everything from first to constrast_min_ with 0 (black)
for (int i = 0; i < contrast_min; i++)
raw_colour_table[i] = qRgb(0,0,0);
// fill everything from constrast_max_ to end with 255 (white)
for (int i = contrast_max; i < 256; i++)
raw_colour_table[i] = qRgb(255,255,255);
// fill values in between with a linear gradient
int denom = contrast_max - contrast_min;
for (int i = contrast_min; i < contrast_max; i++)
{
int grey = (255 * (i - contrast_min)) / denom;
raw_colour_table[i] = qRgb(grey,grey,grey);
}
}
void ncm_qcapture2_gui::update_diff_colour_table(int brightness, int contrast)
{
int contrast_min, contrast_max;
update_contrasts(brightness, contrast, contrast_min, contrast_max);
raw_colour_table_d_.resize(256);
// fill everything from first to constrast_min_ with dark blue
for (int i = 0; i < contrast_min; i++)
raw_colour_table_d_[i] = qRgb(0,0,128);
// fill everything from constrast_max_ to end with dark red
for (int i = contrast_max; i < 256; i++)
raw_colour_table_d_[i] = qRgb(128,0,0);
// fill values in between with a linear gradient
int period = (contrast_max + 1 - contrast_min)>>2;
int d1 = contrast_min + (period>>1);
int d2 = d1 + period;
int d3 = d2 + period;
int d4 = d3 + period;
int step = 256 / period;
int r = 0;
int g = 0;
int b = 128;
for (int i = contrast_min; i < contrast_max; i++)
{
if (i < d1) {
b+= step; b = min(b, 255);
}
else if (i < d2){
b = 255;
g+= step; g = min(g, 255);
}
else if (i < d3 ) {
b-= step; b = max(b, 0);
g = 255;
r+= step; r = min(r, 255);
}
else if (i < d4 ) {
b = 0;
g-= step; g = max(g, 0);
r = 255;
}
else {
g = 0;
r-= step;
}
raw_colour_table_d_[i] = qRgb(r,g,b);
}
}
//
// Private slots
//
//:Action when either load camera button is clicked
void ncm_qcapture2_gui::on_loadCameraButton1_clicked()
{
if ( load_camera(0) ) {
ui.useCamera1Button->setEnabled( true );
ui.useCamera1Button->setChecked( true );
ui.activeCameraButton1->setEnabled( true );
ui.activeCameraButton1->setChecked( true );
}
}
void ncm_qcapture2_gui::on_loadCameraButton2_clicked()
{
if ( load_camera(1) ) {
ui.useCamera2Button->setEnabled( true );
ui.useCamera2Button->setChecked( true );
ui.activeCameraButton2->setEnabled( true );
ui.activeCameraButton2->setChecked( true );
}
}
//:Change which camera is currently active
void ncm_qcapture2_gui::change_active_camera( int cam_num )
{
//cam_num is camera id from radio button clicked
current_camera_ = cam_num;
vcl_cout << "Camera " << cam_num + 1 << " selected" << vcl_endl;
//Update controls to reflect state of current camera
update_framerate_controls();
update_exposure_controls();
update_gain_controls();
if ( cameras_[current_camera_]->is_auto_exposure() ) {
ui.autoExposure->setChecked( true );
ui.exposureSlider->setEnabled( false );
ui.exposureSpinBox->setEnabled( false );
}
else {
//switch off camera's auto exposure and get current exposure value
double exposure, value;
cameras_[ current_camera_ ]->get_current_exposure( exposure );
value = ui.exposureSpinBox->valueFromExposure( exposure );
//enable exposure slider and spin box and set to current auto value
ui.exposureSlider->setEnabled( true );
ui.exposureSpinBox->setEnabled( true );
ui.exposureSpinBox->setValue( value );
ui.exposureSlider->setValue( int( value ) );
ui.autoExposure->setChecked( false );
}
if ( cameras_[current_camera_]->is_auto_gain() ) {
ui.autoGain->setChecked( true );
ui.gainSlider->setEnabled( false );
ui.gainSpinBox->setEnabled( false );
}
else {
//switch off camera's auto gain and get current gain value
double gain;
cameras_[ current_camera_ ]->get_current_gain( gain );
//enable gain slider and spin box and set to current auto value
ui.gainSlider->setEnabled( true );
ui.gainSpinBox->setEnabled( true );
ui.gainSpinBox->setValue( gain );
ui.gainSlider->setValue( int( gain ) );
ui.autoGain->setChecked( false );
}
ui.brightnessSlider->setValue( brightness_[ current_camera_ ] );
ui.contrastSlider->setValue( contrast_[ current_camera_ ] );
if ( cameras_[current_camera_]->is_live() ) {
ui.stopLiveButton->setText( QString( "Stop live" ) );
}
else {
ui.stopLiveButton->setText( QString( "Start live" ) );
}
}
//----------------------------------------------------------------------------
// Display control callbacks
void ncm_qcapture2_gui::on_brightnessSlider_sliderMoved(int value)
{
brightness_[current_camera_] = value;
// update colormap and redraw
update_raw_colour_table(brightness_[ current_camera_ ], contrast_[ current_camera_ ], raw_colour_tables_[ current_camera_ ]);
redraw_scene();
}
void ncm_qcapture2_gui::on_contrastSlider_sliderMoved(int value)
{
contrast_[current_camera_] = value;
// update colormap and redraw
update_raw_colour_table(brightness_[ current_camera_ ], contrast_[ current_camera_ ], raw_colour_tables_[ current_camera_ ]);
redraw_scene();
}
void ncm_qcapture2_gui::on_stopLiveButton_clicked( )
{
if ( !ui.stopLiveButton->text().compare( QString( "Start live" ) ) ) {
cameras_[current_camera_]->start_live();
ui.stopLiveButton->setText( QString( "Stop live" ) );
}
else {
cameras_[current_camera_]->stop_live();
ui.stopLiveButton->setText( QString( "Start live" ) );
}
}
void ncm_qcapture2_gui::on_fliphImage1Button_toggled() {
ui.cameraView1->scale(-1, 1);
flipped_h_[0] = !flipped_h_[0];
}
void ncm_qcapture2_gui::on_fliphImage2Button_toggled() {
ui.cameraView2->scale(-1, 1);
flipped_h_[1] = !flipped_h_[1];
}
void ncm_qcapture2_gui::on_flipvImage1Button_toggled() {
ui.cameraView1->scale(1, -1);
flipped_v_[0] = !flipped_v_[0];
}
void ncm_qcapture2_gui::on_flipvImage2Button_toggled() {
ui.cameraView2->scale(1, -1);
flipped_v_[1] = !flipped_v_[1];
}
//----------------------------------------------------------------------------
// Camera control callbacks
void ncm_qcapture2_gui::on_frameRateSelection_currentIndexChanged( const QString &text )
{
double frames_per_sec = text.toDouble();
vcl_cout << "New FPS = " << frames_per_sec << vcl_endl;
//Stop live mode, change the FPS, then restart live mode
cameras_[ current_camera_ ]->set_FPS( frames_per_sec );
}
void ncm_qcapture2_gui::on_gainSpinBox_valueChanged( double value )
{
ui.gainSlider->setValue( int( value ) );
cameras_[ current_camera_ ]->set_gain( value );
}
void ncm_qcapture2_gui::on_gainSlider_sliderMoved( int value )
{
ui.gainSpinBox->setValue( double( value ) );
cameras_[ current_camera_ ]->set_gain( double( value ) );
}
void ncm_qcapture2_gui::on_autoGain_stateChanged( int state )
{
if ( state )
{
//disable slider and spin box
ui.gainSlider->setEnabled( false );
ui.gainSpinBox->setEnabled( false );
//switch on camera's auto gain
cameras_[ current_camera_ ]->switch_auto_gain( true );
vcl_cout << "Auto gain switched on" << vcl_endl;
}
else
{
//switch off camera's auto gain and get current gain value
double gain;
cameras_[ current_camera_ ]->switch_auto_gain( false );
cameras_[ current_camera_ ]->get_current_gain( gain );
//enable gain slider and spin box and set to current auto value
ui.gainSlider->setEnabled( true );
ui.gainSpinBox->setEnabled( true );
ui.gainSpinBox->setValue( gain );
ui.gainSlider->setValue( int( gain ) );
vcl_cout << "Auto gain switched off" << vcl_endl;
}
}
void ncm_qcapture2_gui::on_exposureSpinBox_valueChanged( double value )
{
double exposure = ui.exposureSpinBox->exposureFromValue( value );
ui.exposureSlider->setValue( int( value ) );
cameras_[ current_camera_ ]->set_exposure( exposure );
}
void ncm_qcapture2_gui::on_exposureSlider_sliderMoved( int value )
{
double exposure = ui.exposureSpinBox->exposureFromValue( value );
ui.exposureSpinBox->setValue(double( value ));
cameras_[ current_camera_ ]->set_exposure( exposure );
}
void ncm_qcapture2_gui::on_autoExposure_stateChanged( int state )
{
if ( state )
{
//disable slider and spin box
ui.exposureSlider->setEnabled( false );
ui.exposureSpinBox->setEnabled( false );
//switch on camera's auto exposure
cameras_[ current_camera_ ]->switch_auto_exposure( true );
vcl_cout << "Auto exposure switched on" << vcl_endl;
}
else
{
//switch off camera's auto exposure and get current exposure value
double exposure, value;
cameras_[ current_camera_ ]->switch_auto_exposure( false );
cameras_[ current_camera_ ]->get_current_exposure( exposure );
value = ui.exposureSpinBox->valueFromExposure( exposure );
//enable exposure slider and spin box and set to current auto value
ui.exposureSlider->setEnabled( true );
ui.exposureSpinBox->setEnabled( true );
ui.exposureSpinBox->setValue( value );
ui.exposureSlider->setValue( int( value ) );
vcl_cout << "Auto exposure switched off" << vcl_endl;
vcl_cout << "Current exposure: " << exposure << vcl_endl;
}
}
//----------------------------------------------------------------------------
// Save sequence callbacks
void ncm_qcapture2_gui::on_sequenceLengthSpinBox_valueChanged(double value)
{
}
void ncm_qcapture2_gui::on_saveDirSelect_clicked()
{
// get filename from dialog box
QString fileName = QFileDialog::getExistingDirectory(this,
tr("Select folder to save images in"), "",
QFileDialog::ShowDirsOnly);
// Return if cancelled.
if (fileName.isEmpty())
return;
// Update the save_dir text edit box
ui.saveDirTextEdit->setText( fileName );
// Update the save dir in the saver_ object and Registry value
savers_[0]->setRootDir(fileName.toStdString());
savers_[1]->setRootDir(fileName.toStdString());
ra_.write_string("RootDir", fileName.toStdString());
}
void ncm_qcapture2_gui::on_patientNameTextEdit_textChanged()
{
QString patient_name = ui.patientNameTextEdit->toPlainText();
savers_[0]->setPatientName( patient_name.toStdString() );
savers_[1]->setPatientName( patient_name.toStdString() );
ra_.write_string("PatientName", patient_name.toStdString());
}
void ncm_qcapture2_gui::on_sequenceNameTextEdit_textChanged()
{
QString sequence_name = ui.sequenceNameTextEdit->toPlainText();
savers_[0]->setSequenceName( sequence_name.toStdString() );
savers_[1]->setSequenceName( sequence_name.toStdString() );
}
void ncm_qcapture2_gui::on_handComboBox_currentIndexChanged ( const QString &text )
{
savers_[0]->setHand( text.toStdString() );
savers_[1]->setHand( text.toStdString() );
}
void ncm_qcapture2_gui::on_digitComboBox_currentIndexChanged ( const QString &text )
{
savers_[0]->setDigit( text.toStdString() );
savers_[1]->setDigit( text.toStdString() );
}
void ncm_qcapture2_gui::on_magComboBox_currentIndexChanged ( const QString &text )
{
savers_[0]->setMag( text.toStdString() );
savers_[1]->setMag( text.toStdString() );
}
void ncm_qcapture2_gui::on_camera1SuffixTextEdit_textChanged ( )
{
savers_[0]->setCameraSuffix( ui.camera1SuffixTextEdit->toPlainText().toStdString() );
}
void ncm_qcapture2_gui::on_camera2SuffixTextEdit_textChanged ( )
{
savers_[1]->setCameraSuffix( ui.camera2SuffixTextEdit->toPlainText().toStdString() );
}
void ncm_qcapture2_gui::on_useCamera1Button_clicked()
{
save_from_camera_[ 0 ] = ui.useCamera1Button->isChecked();
}
void ncm_qcapture2_gui::on_useCamera2Button_clicked()
{
save_from_camera_[ 1 ] = ui.useCamera2Button->isChecked();
}
void ncm_qcapture2_gui::on_saveButton_clicked()
{
//If no camera connected do nothing
if ( !cameras_[0]->is_connected() && !cameras_[1]->is_connected() ) {
vcl_cout << "No cameras connected" << vcl_endl;
return;
}
//If neither camera selected, do nothing
if ( !save_from_camera_[0] && !save_from_camera_[1] ) {
vcl_cout << "Neither camera selected for save" << vcl_endl;
return;
}
//
// We definitely have some saving to do...
//
// Disable the camera and save sequence controls
ui.tabCamera->setEnabled( false );
ui.tabCapture->setEnabled( false );
//Tell both savers to update their frame names
savers_[0]->update_frame_name();
savers_[1]->update_frame_name();
// Make the current sequence directory if it doesn't already exist
//(we can do this with either saver, regardless of which cameras are connected)
vcl_string filename = savers_[0]->makeSaveDir();
// Define a subdirectory for the current capture
vcl_string sub_dir = QTime::currentTime().toString("hh_mm_ss").toStdString();
// Write out a file with capture properties
filename.append( "sequence_properties_" );
filename.append( sub_dir );
filename.append( ".txt" );
property_fs_.open(filename.c_str());
write_properties( property_fs_ );
add_properties_header();
for (int cam_num = 0; cam_num < 2; cam_num++) {
if ( save_from_camera_[ cam_num ] ) {
// Set the number of frames to save
double seq_len = ui.sequenceLengthSpinBox->value();
double fps = cameras_[ cam_num ]->get_current_FPS();
processor_.set_num_frames_to_save( int( fps * seq_len ), cam_num );
//Set the subdir for this saver
savers_[ cam_num ]->setSubDir(sub_dir);
// Turn saving flag on
processor_.start_processing(cam_num);
}
}
}
//: Add a line to the properties file summarizing the current frame.
void ncm_qcapture2_gui::add_properties_header()
{
// Write the frame number, time stamp, motor position (x, y, z), sharpness,
// and so on.
property_fs_ << vcl_endl
<< vcl_setw(12) << "No."
<< vcl_setw(12) << "Time"
<< vcl_setw(12) << "MotorX"
<< vcl_setw(12) << "MotorY"
<< vcl_setw(12) << "MotorZ"
<< vcl_setw(12) << "Sharpness"
<< vcl_endl;
}
//: Add metadata to the most recently captured frame.
void ncm_qcapture2_gui::tag_frame( int cam_num, bool fliph, bool flipv )
{
if ( diff_frame_[ cam_num ] ) {
emit frame_tagged( cam_num, true, fliph, flipv );
diff_frame_[ cam_num ] = false;
}
else
emit frame_tagged( cam_num, false, fliph, flipv );
}
void ncm_qcapture2_gui::tag_frame1() {
tag_frame(0, flipped_h_[0], flipped_v_[0] );
}
void ncm_qcapture2_gui::tag_frame2() {
tag_frame(1, flipped_h_[1], flipped_v_[1] );
}
//: Add a line to the properties file summarizing the current frame.
void ncm_qcapture2_gui::log_frame_properties(int frame_number)
{
if (!property_fs_.is_open())
return;
QSharedPointer<ncm_video_frame>& frame =
ncm_qcapture2_data_manager::Instance()->save_queue( 0 )->tail();
float x = 0, y = 0, z = 0;
frame->get_motor_xyz(x, y, z);
double sharpness = 0.0;
sharpness = frame->sharpness();
vcl_string time_str = "";
time_str = frame->frame_time().toString("hhmmsszzz").toStdString();
// Write the frame number, time stamp, motor position (x, y, z), sharpness,
// and so on.
property_fs_ << vcl_setw(12) << frame_number
<< vcl_setw(12) << time_str
<< vcl_setw(12) << x
<< vcl_setw(12) << y
<< vcl_setw(12) << z
<< vcl_setw(12) << sharpness
<< vcl_endl;
double progress = static_cast<double>(frame_number) /
processor_.num_frames_to_save( 0 );//bob
updateProgress(progress);
emit frame_logged(frame_number);
}
//: Update the progress bar when a frame is saved.
void ncm_qcapture2_gui::on_frame_saved(int frame_number, int cam_num)
{
// Don't update the progress bar if the processor is still processing.
if (processor_.is_processing(0) || processor_.is_processing(1))
return;
//Compute progress for this camera
double progress = static_cast<double>(frame_number) /
processor_.num_frames_to_save( cam_num );
//This may cause the progress bar to jump back and forward
//but it'll only be stationary when both cameras finished
updateProgress(progress);
}
//: Respond when all frames have been saved.
void ncm_qcapture2_gui::on_saving_finished(int cam_num)
{
vcl_cout << "Camera " << cam_num+1 << " finished saving" << vcl_endl;
}
//: Redraw items on canvas
void ncm_qcapture2_gui::redraw_scene()
{
redraw_scene( current_camera_ );
}
void ncm_qcapture2_gui::redraw_scene( int cam_num )
{
QImage* qimage = ncm_qcapture2_data_manager::Instance()->get_qimage( cam_num );
if (qimage->isNull())
return;
/*vil_image_view<vxl_byte> vxl_image;
qcore_convert_image(vxl_image, *qimage);
if (ui.correctImageCheckbox->isChecked() &&
artefact_image_.ni() != 0)
{
vil_image_view<int> vxl_image_int;
vil_convert_cast(vil_plane(vxl_image, 0), vxl_image_int);
vil_math_image_difference(vxl_image_int, artefact_image_, vxl_image_int);
vil_math_truncate_range(vxl_image_int, 0, 255);
vil_convert_cast(vxl_image_int, vil_plane(vxl_image, 0));
qcore_convert_image(*qimage, vil_plane(vxl_image, 0));
}*/
draw_pixmap(qimage, cam_num);
static int di_cumul = 0, dj_cumul = 0;
if (ui.stabilizeCheckbox->isChecked())
{
/*if (!aligner_.is_ready())
aligner_.set_destination(vxl_image);
aligner_.set_source(vxl_image);
int di = 0, dj = 0;
aligner_.align_src_to_dest(di, dj);
aligner_.swap_src_with_dest();
di_cumul += di;
dj_cumul += dj;
raw_pixmap_items_[ cam_num ]->setPos(di_cumul, dj_cumul);*/
}
else
{
di_cumul = 0;
dj_cumul = 0;
raw_pixmap_items_[ cam_num ]->setPos(0, 0);
}
draw_crosshairs( cam_num );
scenes_[ cam_num ]->update();
/*
// Compute, display and store the sharpness of the image.
QString msg;
if (apt_.n_controllers() > 0)
{
msg += "X: " + QString::number(apt_.X()->absolute_position()) + " ";
msg += "Y: " + QString::number(apt_.Y()->absolute_position()) + " ";
msg += "Zabs: " + QString::number(apt_.Z()->absolute_position()) + " ";
msg += "Zrel: " + QString::number(apt_.Z()->position()) + " ";
}
msg += "Sh: " + QString::number(processor_.image_sharpness());
updateStatus(msg);
*/
}
//:
void ncm_qcapture2_gui::draw_diff_frame()
{
QImage *qimage = ncm_qcapture2_data_manager::Instance()->get_qdiffframe();
qimage->setColorTable(raw_colour_table_d_);
if (raw_pixmap_item_d_ == 0)
raw_pixmap_item_d_ = scene_d_.addPixmap( QPixmap::fromImage( *qimage ));
else
raw_pixmap_item_d_->setPixmap(QPixmap::fromImage( *qimage ));
scene_d_.setSceneRect(QRectF(0, 0, qimage->width(), qimage->height() ));
scene_d_.update();
ui.lastFrameView->fitInView(scene_d_.sceneRect(), Qt::KeepAspectRatio);
}
void ncm_qcapture2_gui::on_processing_finished()
{
property_fs_.close();
// Enable the camera and save sequence controls
ui.tabCamera->setEnabled( true );
ui.tabCapture->setEnabled( true );
}
//: Update the scene at regular intervals determined by a timer.
void ncm_qcapture2_gui::onAptTimer()
{
// It's ok to call the move_at_velocity() function directly here because it
// always returns immediately, unlike move_by().
/*if (motors_are_live_)
{
if (ui.aptXVelocity->value() != 0)
{
float velocity = static_cast<float>(ui.aptXVelocity->value()) / 100.0;
apt_.set_max_displacement(ncm_qapt_server::AptX, 1e9);
apt_.X()->move_at_velocity(velocity);
}
if (ui.aptYVelocity->value() != 0)
{
float velocity = static_cast<float>(ui.aptYVelocity->value()) / 100.0;
apt_.set_max_displacement(ncm_qapt_server::AptY, 1e9);
apt_.Y()->move_at_velocity(velocity);
}
if (ui.aptZVelocity->value() != 0)
{
float velocity = static_cast<float>(ui.aptZVelocity->value()) / 100.0;
apt_.set_max_displacement(ncm_qapt_server::AptZ, 1e9);
apt_.Z()->move_at_velocity(velocity);
}
}
ui.aptXPosition->setValue(apt_.X()->position());
ui.aptYPosition->setValue(apt_.Y()->position());
ui.aptZPosition->setValue(apt_.Z()->position());
*/ //MOTOR_SWITCH_OFF
}
//: Change the controller for each axis
void ncm_qcapture2_gui::on_aptXCombobox_activated(int index)
{/*
// If combobox is empty (i.e. the list has just been cleared) then do nothing.
switch (index)
{
case -1:
ui.aptXHome->setEnabled(false);
return;
case 0:
ui.aptXHome->setEnabled(false);
apt_.set_X_id(-1);
break;
default:
ui.aptXHome->setEnabled(true);
apt_.set_X_id(ui.aptXCombobox->currentText().toLong());
ra_.write_numeric("AptXId", apt_.X()->id());
}
update_apt_comboboxes();
*/ //MOTOR_SWITCH_OFF
}
void ncm_qcapture2_gui::on_aptYCombobox_activated(int index)
{
/*
// If combobox is empty (i.e. the list has just been cleared) then do nothing.
switch (index)
{
case -1:
ui.aptYHome->setEnabled(false);
return;
case 0:
ui.aptYHome->setEnabled(false);
apt_.set_Y_id(-1);
break;
default:
ui.aptYHome->setEnabled(true);
apt_.set_Y_id(ui.aptYCombobox->currentText().toLong());
ra_.write_numeric("AptYId", apt_.Y()->id());
}
update_apt_comboboxes();
*/ //MOTOR_SWITCH_OFF
}
void ncm_qcapture2_gui::on_aptZCombobox_activated(int index)
{
/*
// If combobox is empty (i.e. the list has just been cleared) then do nothing.
switch (index)
{
case -1:
ui.aptZHome->setEnabled(false);
return;
case 0:
ui.aptZHome->setEnabled(false);
apt_.set_Z_id(-1);
break;
default:
ui.aptZHome->setEnabled(true);
apt_.set_Z_id(ui.aptZCombobox->currentText().toLong());
ra_.write_numeric("AptZId", apt_.Z()->id());
}
update_apt_comboboxes();
*/ //MOTOR_SWITCH_OFF
}
//
//: Reverse directions of relative movements.
void ncm_qcapture2_gui::on_aptXReverse_stateChanged(int state)
{
/*
apt_.X()->set_reverse(state == Qt::Checked);
ra_.write_boolean("XReversed", state == Qt::Checked);
*/ //MOTOR_SWITCH_OFF
}
void ncm_qcapture2_gui::on_aptYReverse_stateChanged(int state)
{
/*
apt_.Y()->set_reverse(state == Qt::Checked);
ra_.write_boolean("YReversed", state == Qt::Checked);
*/ //MOTOR_SWITCH_OFF
}
void ncm_qcapture2_gui::on_aptZReverse_stateChanged(int state)
{
/*
apt_.Z()->set_reverse(state == Qt::Checked);
ra_.write_boolean("ZReversed", state == Qt::Checked);
*/ //MOTOR_SWITCH_OFF
}
//
//: Return velocity sliders to zero when released
void ncm_qcapture2_gui::on_aptXVelocity_sliderReleased()
{
/*
ui.aptXVelocity->setValue(0);
apt_.X()->stop();
*/ //MOTOR_SWITCH_OFF
}
void ncm_qcapture2_gui::on_aptYVelocity_sliderReleased()
{
/*
ui.aptYVelocity->setValue(0);
apt_.Y()->stop();
*/ //MOTOR_SWITCH_OFF
}
void ncm_qcapture2_gui::on_aptZVelocity_sliderReleased()
{
/*
ui.aptZVelocity->setValue(0);
apt_.Z()->stop();
*/ //MOTOR_SWITCH_OFF
}
//
//: Home the motors
void ncm_qcapture2_gui::on_aptXHome_clicked()
{
/*
if (!motors_are_live_)
return;
// Emit a signal telling apt_server to go home.
const ncm_qapt_server::apt_axis axis = ncm_qapt_server::AptX;
apt_.set_max_displacement(axis, 1e9);*/ //MOTOR_SWITCH_OFF
//emit apt_move_home(axis, /* home_position = */ 12.5f,
// /* return_immediately = */ true);
//MOTOR_SWITCH_OFF
}
void ncm_qcapture2_gui::on_aptYHome_clicked()
{
/*
if (!motors_are_live_)
return;
// Emit a signal telling apt_server to go home.
const ncm_qapt_server::apt_axis axis = ncm_qapt_server::AptY;
apt_.set_max_displacement(axis, 1e9); */ //MOTOR_SWITCH_OFF
//emit apt_move_home(axis, /* home_position = */ 12.5f,
// /* return_immediately = */ true);
//MOTOR_SWITCH_OFF
}
void ncm_qcapture2_gui::on_aptZHome_clicked()
{
/*
if (!motors_are_live_)
return;
// Emit a signal telling apt_server to go home.
const ncm_qapt_server::apt_axis axis = ncm_qapt_server::AptZ;
apt_.set_max_displacement(axis, 1e9);*/ //MOTOR_SWITCH_OFF
//emit apt_move_home(axis, /* home_position = */ 12.5f,
// /* return_immediately = */ true);
//MOTOR_SWITCH_OFF
}
//: React to mouse clicks on the main graphics view
void ncm_qcapture2_gui::on_graphicsView_clicked(double x, double y)
{
// Get position of mouse click, relative to centre of sceneview
double dx = x - 0.5*ui.cameraView1->width();
double dy = y - 0.5*ui.cameraView1->height();
set_apt_targetX(dx);
set_apt_targetY(dy);
}
//: React to mouse wheel event on the graphics view
void ncm_qcapture2_gui::on_graphicsView_zoomed(int delta)
{
// Apply a sensible relative movement in Z.
// Typically, one 'click' of the mouse wheel will generate a delta of 120.
// Scale down such that each wheel 'click' moves by 0.1mm
set_apt_targetZ(static_cast<double>(delta) / 1200.0);
}
void ncm_qcapture2_gui::on_connectToMotors_clicked()
{
if (apt_timer_.isActive())
{
vcl_cout << "stopping" << vcl_endl;
apt_timer_.stop();
}
else
{
vcl_cout << "starting" << vcl_endl;
initialize_apt_timer();
}
}
void ncm_qcapture2_gui::on_autoFocus_clicked()
{
if (!motors_are_live_)
return;
// Begin the autofocus procedure by searching in the forward direction for
// a measurable increase in sharpness.
autoFocus(autoFocus_GetDirectionForward);
}
void ncm_qcapture2_gui::on_calibrate_clicked()
{
handleCalibrateState();
}
//: React to motors completing a move.
void ncm_qcapture2_gui::onAptMoveComplete(ncm_qapt_server::apt_axis)
{
vcl_cout << "MoveComplete" << vcl_endl;
if (autoFocus_state_ != autoFocus_Inactive)
handleAutoFocusState();
else if (calibrate_state_ != calibrate_Inactive)
handleCalibrateState();
}
//: Handle changes in autofocus_state_.
void ncm_qcapture2_gui::handleAutoFocusState()
{
switch (autoFocus_state_)
{
case autoFocus_Inactive:
// What are we doing here?
break;
case autoFocus_GetDirectionForward:
// Reverse the direction of search because we've gone far enough that we
// would have found an improvement had we been going in the right direction.
/*apt_.set_max_displacement(ncm_qapt_server::AptZ, 1e9);
autoFocus(autoFocus_GetDirectionReverse);*/ //MOTOR_SWITCH_OFF
break;
case autoFocus_GetDirectionReverse:
// Go to error state since we can't find a direction that generates a
// measurable improvement in sharpness. This is likely to happen if
// autofocus is started too far from the true position (in the flat region
// of the function).
/* apt_.set_max_displacement(ncm_qapt_server::AptZ, 1e9);
autoFocus(autoFocus_Error); */ //MOTOR_SWITCH_OFF
break;
case autoFocus_FindPeak:
break;
case autoFocus_GoToPeak:
break;
case autoFocus_Error:
break;
default:
break;
}
}
//: Handle changes in calibrate_state_.
void ncm_qcapture2_gui::handleCalibrateState()
{
const float move_distance = 0.15f;
switch (calibrate_state_)
{
case calibrate_InvalidFirst:
case calibrate_Error:
// Do nothing (for now)
break;
case calibrate_Inactive:
// Go up.
calibrate_state_ = calibrate_Up;
emit apt_move_by(ncm_qapt_server::AptY, move_distance, false);
break;
case calibrate_Up:
// Go right.
calibrate_state_ = calibrate_Right;
emit apt_move_by(ncm_qapt_server::AptX, move_distance, false);
break;
case calibrate_Right:
// Go down.
calibrate_state_ = calibrate_Down;
emit apt_move_by(ncm_qapt_server::AptY, -move_distance, false);
break;
case calibrate_Down:
// Go left.
calibrate_state_ = calibrate_Left;
emit apt_move_by(ncm_qapt_server::AptX, -move_distance, false);
break;
case calibrate_Left:
// Reset to Inactive state.
calibrate_state_ = calibrate_Inactive;
break;
default:
// Huh?
break;
}
}
//:
void ncm_qcapture2_gui::onLowerSharpnessThresholdCrossed()
{/*
vcl_cout << "LowerThresholdCrossed" << vcl_endl;
switch (autoFocus_state_)
{
case autoFocus_Inactive:
// What are we doing here?
break;
case autoFocus_GetDirectionForward:
{
// Reverse the direction of search because we're going the wrong way.
const double current_sharpness = processor_.image_sharpness();
const double lower_limit = current_sharpness * 0.9;
const double upper_limit = current_sharpness * 1.1;
// Need to move the lower threshold a little first, so that it doesn't
// immediately trigger an event.
processor_.set_lower_sharpness_threshold(lower_limit);
autoFocus(autoFocus_GetDirectionReverse);
vcl_cout << "GetDirectionForward: "
<< "[" << lower_limit << ", " << upper_limit << "]"
<< vcl_endl;
break;
}
case autoFocus_GetDirectionReverse:
// Go to error state as this shouldn't, in theory, happen: we're in this
// state because going in the opposite direction decreased sharpness, so
// this direction *must* increase sharpness.
autoFocus(autoFocus_Error);
break;
case autoFocus_FindPeak:
// Stop looking for the peak once the lower threshold has been crossed, as
// we're now 'over the hump' and getting worse again.
autoFocus(autoFocus_GoToPeak);
break;
case autoFocus_GoToPeak:
break;
case autoFocus_Error:
break;
default:
break;
}*/
}
void ncm_qcapture2_gui::onUpperSharpnessThresholdCrossed()
{/*
vcl_cout << "UpperThresholdCrossed" << vcl_endl;
switch (autoFocus_state_)
{
case autoFocus_Inactive:
// What are we doing here?
break;
case autoFocus_GetDirectionForward:
// Fall through
case autoFocus_GetDirectionReverse:
// Find the peak, since we know we're now going in the right direction.
autoFocus(autoFocus_FindPeak);
break;
case autoFocus_FindPeak:
{
// Store the position associated with the highest sharpness encountered
// so far.
autoFocus_peak_position_ = apt_.Z()->position();
// Increase both the upper and lower thresholds.
const double current_sharpness = processor_.image_sharpness();
const double lower_limit = current_sharpness * 0.9;
const double upper_limit = current_sharpness * 1.1;
processor_.set_lower_sharpness_threshold(lower_limit);
processor_.set_upper_sharpness_threshold(upper_limit);
vcl_cout << "FindPeak: " << autoFocus_peak_position_
<< "[" << lower_limit << ", " << upper_limit << "]"
<< vcl_endl;
break;
}
case autoFocus_GoToPeak:
break;
case autoFocus_Error:
break;
default:
break;
}*/
}
//Action if compute diff image is clicked
void ncm_qcapture2_gui::on_computeDiffButton_clicked() {
if (cameras_[0]->is_connected() && cameras_[1]->is_connected()) {
diff_frame_[0] = true;
diff_frame_[1] = true;
}
}
void ncm_qcapture2_gui::on_diffBrightnessSlider_sliderMoved(int value)
{
int contrast = ui.diffContrastSlider->value();
int brightness = value;
// update colormap and redraw
update_diff_colour_table(brightness, contrast);
draw_diff_frame();
}
void ncm_qcapture2_gui::on_diffContrastSlider_sliderMoved(int value)
{
int contrast = value;
int brightness = ui.diffBrightnessSlider->value();
// update colormap and redraw
update_diff_colour_table(brightness, contrast);
draw_diff_frame();
}
//
// Private methods
//
//Load camera
bool ncm_qcapture2_gui::load_camera(int cam_num)
{
//Try and connect the device
if ( !cameras_[ cam_num ]->connect_device() ) {
vcl_cout << "Camera failed to load" << vcl_endl;
return false;
}
//Make this camera the current camera
change_active_camera( cam_num );
//Set this camera to be saved from
save_from_camera_[ cam_num ] = true;
// clear old scene
raw_pixmap_items_[ cam_num ] = 0;
raw_pixmap_item_d_ = 0;
scenes_[ cam_num ]->clear();
scene_d_.clear();
// Use highest frame rate by default
ui.frameRateSelection->setCurrentIndex(0);
//-----------------------------------------------------------------------------
//Start the device's live mode
cameras_[ cam_num ]->start_live();
ui.stopLiveButton->setText( QString( "Stop live" ) );
ui.stopLiveButton->setEnabled( true );
// draw scene and fit image in view
redraw_scene( cam_num );
if (cam_num) //(==1)
ui.cameraView2->fitInView(scenes_[cam_num]->sceneRect(),Qt::KeepAspectRatio);
else
ui.cameraView1->fitInView(scenes_[cam_num]->sceneRect(),Qt::KeepAspectRatio);
//Enable the camera and save sequence controls
ui.tabDisplay->setEnabled( true );
ui.tabCamera->setEnabled( true );
ui.tabCapture->setEnabled( true );
return true;
}
//: Create the status bar's labels and progress bar
void ncm_qcapture2_gui::initializeStatusbar()
{
statusBar_main_.setFrameStyle(QFrame::Panel & QFrame::Sunken);
statusBar_main_.setLineWidth(1);
statusBar_main_.setText("");
statusBar_main_.setContentsMargins(4, 0, 4, 0);
statusBar()->addWidget(&statusBar_main_, 1);
statusBar_progress_.setFixedWidth(160);
statusBar()->addWidget(&statusBar_progress_);
}
//
//: Update status bar.
// A progress value in [0..1] sets the progress bar value.
// progress < 0 makes no change.
void ncm_qcapture2_gui::updateStatus(
const QString& status,
double progress /* = -1 */)
{
statusBar_main_.setText(status);
updateProgress(progress);
statusBar()->update();
}
//: Update progress bar only.
// A progress value in [0..1] sets the progress bar value.
// progress < 0 makes no change.
void ncm_qcapture2_gui::updateProgress(
double progress)
{
if ((0.0 <= progress) && (progress <= 1.0))
{
const int progress_min = statusBar_progress_.minimum();
const int progress_range = statusBar_progress_.maximum() - progress_min;
statusBar_progress_.setValue(progress_min + progress*progress_range);
}
}
//:
void ncm_qcapture2_gui::initializeAlignerThread()
{
aligner_thread_.setObjectName("aligner_thread");
aligner_.set_n_levels(2);
aligner_.moveToThread(&aligner_thread_);
// Register data types before they are used in signals
qRegisterMetaType< vcl_vector<vcl_string> >("vcl_vector<vcl_string>");
//// This -> aligner
//QObject::connect( this, SIGNAL(alignSequence(vcl_vector<vcl_string>)),
// &aligner_, SLOT(alignSequence(vcl_vector<vcl_string>)) );
//// Aligner -> this
//QObject::connect( &aligner_, SIGNAL(framesAligned(int, int)),
// this, SLOT(onFramesAligned(int, int)) );
//QObject::connect( &aligner_, SIGNAL(alignmentFinished()),
// this, SLOT(onAlignmentFinished()) );
//aligner_thread_.start();
}
//: Add the qimage to the canvas.
void ncm_qcapture2_gui::draw_pixmap(QImage* qimage, int cam_num)
{
if ( (qimage == NULL) ||
(qimage->isNull()) )
{
return;
}
qimage->setColorTable(raw_colour_tables_[ cam_num ]);
if (raw_pixmap_items_[ cam_num ] == NULL)
raw_pixmap_items_[ cam_num ] = scenes_[ cam_num ]->addPixmap( QPixmap::fromImage( *qimage ));
else
raw_pixmap_items_[ cam_num ]->setPixmap(QPixmap::fromImage( *qimage ));
scenes_[ cam_num ]->setSceneRect(QRectF(0,0, qimage->width(), qimage->height() ));
}
//: Add crosshairs to scene.
void ncm_qcapture2_gui::draw_crosshairs(int cam_num)
{
QPen crosshair_pen(QColor(0, 255, 0));
scenes_[ cam_num ]->addLine(scenes_[ cam_num ]->width()*0.5, 0, scenes_[ cam_num ]->width()*0.5, scenes_[ cam_num ]->height(),
crosshair_pen);
scenes_[ cam_num ]->addLine(0, scenes_[ cam_num ]->height()*0.5, scenes_[ cam_num ]->width(), scenes_[ cam_num ]->height()*0.5,
crosshair_pen);
}
//
//: Write sequence properties to a text file.
void ncm_qcapture2_gui::write_properties( vcl_ostream& tfs )
{
tfs << vsl_indent() << "NCM QCapture Sequence Properties" << vcl_endl;
vsl_indent_inc(tfs);
tfs << vsl_indent() << "Date: " << QDate::currentDate().toString( "ddd dd MMM yyyy" ).toStdString() << vcl_endl;
tfs << vsl_indent() << "Time: " << QTime::currentTime().toString( "hh:mm:ss" ).toStdString() << vcl_endl;
tfs << vcl_endl;
tfs << vsl_indent() << "Patient name: " << ui.patientNameTextEdit->toPlainText().toStdString() << vcl_endl;
tfs << vsl_indent() << "Sequence name: " << ui.sequenceNameTextEdit->toPlainText().toStdString() << vcl_endl;
tfs << vsl_indent() << "Sequence length: " << ui.sequenceLengthSpinBox->value() << " s" << vcl_endl;
tfs << vcl_endl;
for (int cam_num = 0; cam_num < 2; cam_num++) {
if ( save_from_camera_[ cam_num ] ) {
write_camera_properties( tfs , cam_num);
}
else {
tfs << vsl_indent() << "Camera " << cam_num+1 << ", not active" << vcl_endl;
}
}
tfs << vcl_flush;
}
void ncm_qcapture2_gui::write_camera_properties( vcl_ostream& tfs , int cam_num)
{
tfs << vsl_indent() << "Camera " << cam_num+1 << ", Type: " << cameras_[cam_num]->get_camera_type() << vcl_endl;
tfs << vsl_indent() << "Camera ID: " << cameras_[cam_num]->get_camera_id() << vcl_endl;
vsl_indent_inc(tfs);
tfs << vsl_indent() << "Frame rate: " << cameras_[cam_num]->get_current_FPS() << " fps" << vcl_endl;
tfs << vsl_indent() << "Exposure time: ";
if ( cameras_[cam_num]->is_auto_exposure() )
tfs << "auto" << vcl_endl;
else
tfs << cameras_[cam_num]->get_current_exposure() << vcl_endl;
tfs << vsl_indent() << "Gain: ";
if ( cameras_[cam_num]->is_auto_gain() )
tfs << "auto" << vcl_endl;
else
tfs << cameras_[cam_num]->get_current_gain() << vcl_endl;
tfs << vsl_indent() << "Orientation: H flipped " << flipped_h_[ cam_num ] << ", V flipped " << flipped_v_[ cam_num ] << vcl_endl;
}
void ncm_qcapture2_gui::update_framerate_controls()
{
//Get available frame rates and update frame selection combo box
vcl_vector<double> available_FPS;
double fps;
// Disconnect signal to slot temporarily to avoid unnecessary event
// handling.
QObject::disconnect( ui.frameRateSelection,
SIGNAL(currentIndexChanged(const QString)),
this,
SLOT(on_frameRateSelection_currentIndexChanged(const QString)) );
if ( cameras_[current_camera_]->get_available_FPS( available_FPS ) &&
cameras_[current_camera_]->get_current_FPS( fps ) )
{
QString text_double;
for (unsigned i = 0; i < available_FPS.size(); i++)
{
double fps_i = available_FPS[ i ];
text_double.setNum( fps_i );
ui.frameRateSelection->addItem( text_double );
if ( fps_i == fps )
ui.frameRateSelection->setCurrentIndex( i );
}
}
// Reconnect signal to slot
QObject::connect( ui.frameRateSelection,
SIGNAL(currentIndexChanged(const QString)),
this,
SLOT(on_frameRateSelection_currentIndexChanged(const QString)) );
}
void ncm_qcapture2_gui::update_exposure_controls()
{
//Get exposure range of camera and set spin box and slider
double min_exposure, max_exposure;
if ( cameras_[current_camera_]->get_exposure_range( min_exposure, max_exposure ) )
{
ui.exposureSpinBox->setRange( 0, 100 );
ui.exposureSlider->setRange( 0, 100 );
ui.exposureSpinBox->setExposureMin( min_exposure );
ui.exposureSpinBox->setExposureMax( max_exposure );
}
}
void ncm_qcapture2_gui::update_gain_controls()
{
//Get gain range of camera and set spin box and slider
double min_gain, max_gain;
if ( cameras_[current_camera_]->get_gain_range( min_gain, max_gain ) )
{
ui.gainSpinBox->setRange( min_gain, max_gain );
ui.gainSlider->setRange( int( min_gain ), int( max_gain ) );
}
}
//
//: Update controller comboboxes that enable you to assign controllers to axes.
void ncm_qcapture2_gui::update_apt_comboboxes()
{
/*
// Get list of IDs that are connected
vcl_vector<long> id_vector = apt_.ids();
// For each axis, remove the IDs of any controller currently assigned to
// another axis and set the current item index to that matching the currently
// assigned controller (if any).
ui.aptXCombobox->clear();
ui.aptXCombobox->addItem("None");
for (unsigned i = 0; i < id_vector.size(); ++i)
{
// Add controller to list if not already in use by another axis.
if ((apt_.Y()->id() != id_vector[i]) &&
(apt_.Z()->id() != id_vector[i]))
ui.aptXCombobox->addItem(QString::number(id_vector[i]));
// Store the index of the currently assigned controller.
if (apt_.X()->id() == id_vector[i])
ui.aptXCombobox->setCurrentIndex(ui.aptXCombobox->count()-1);
}
ui.aptYCombobox->clear();
ui.aptYCombobox->addItem("None");
for (unsigned i = 0; i < id_vector.size(); ++i)
{
// Add controller to list if not already in use by another axis.
if ((apt_.X()->id() != id_vector[i]) &&
(apt_.Z()->id() != id_vector[i]))
ui.aptYCombobox->addItem(QString::number(id_vector[i]));
// Store the index of the currently assigned controller.
if (apt_.Y()->id() == id_vector[i])
ui.aptYCombobox->setCurrentIndex(ui.aptYCombobox->count()-1);
}
ui.aptZCombobox->clear();
ui.aptZCombobox->addItem("None");
for (unsigned i = 0; i < id_vector.size(); ++i)
{
// Add controller to list if not already in use by another axis.
if ((apt_.X()->id() != id_vector[i]) &&
(apt_.Y()->id() != id_vector[i]))
ui.aptZCombobox->addItem(QString::number(id_vector[i]));
// Store the index of the currently assigned controller.
if (apt_.Z()->id() == id_vector[i])
ui.aptZCombobox->setCurrentIndex(ui.aptZCombobox->count()-1);
}
*/ //MOTOR_SWITCH_OFF
}
//
//: Set the target position for X axis.
void ncm_qcapture2_gui::set_apt_targetX(double distance_pixels)
{
/*
const double mm_per_pixel = 1.0 / pixels_per_mm_;
double distance_mm = mm_per_pixel * distance_pixels;
if (motors_are_live_)
{
apt_.X()->set_velocity(1.0f);
apt_.X()->move_by(distance_mm);
}
*/ //MOTOR_SWITCH_OFF
}
void ncm_qcapture2_gui::set_apt_targetY(double distance_pixels)
{
/*
const double mm_per_pixel = 1.0 / pixels_per_mm_;
double distance_mm = mm_per_pixel * distance_pixels;
if (motors_are_live_)
{
apt_.Y()->set_velocity(1.0f);
apt_.Y()->move_by(distance_mm);
}
*/ //MOTOR_SWITCH_OFF
}
void ncm_qcapture2_gui::set_apt_targetZ(double z)
{
/*
if (motors_are_live_)
{
apt_.Z()->set_velocity(1.0f);
apt_.Z()->move_by(z);
}
*/ //MOTOR_SWITCH_OFF
}
//
//: Autofocus procedure, implemented as a finite state machine.
void ncm_qcapture2_gui::autoFocus(autoFocus_state_enum state)
{
/*
autoFocus_state_ = state;
switch (state)
{
case autoFocus_GetDirectionForward:
{
vcl_cout << "GetDirectionForward" << vcl_endl;
// Determine the direction of movement for maximum sharpness
const double reference_sharpness = processor_.image_sharpness();
const double lower_limit = reference_sharpness * 0.9;
const double upper_limit = reference_sharpness * 1.1;
// Move camera until sharpness changes by some (absolute or relative)
// amount, or until a fixed distance (e.g. 1mm) has been traversed.
processor_.set_lower_sharpness_threshold(lower_limit);
processor_.set_upper_sharpness_threshold(upper_limit);
vcl_cout << "GetDirectionForward: ["
<< lower_limit << ", " << upper_limit << "]"
<< vcl_endl;
// Set limits on displacement from current position.
apt_.set_reference_position(ncm_qapt_server::AptZ);
apt_.set_max_displacement(ncm_qapt_server::AptZ, 1.0f);
// Start searching.
apt_.Z()->move_at_velocity(0.25f);
break;
}
case autoFocus_GetDirectionReverse:
vcl_cout << "GetDirectionReverse" << vcl_endl;
// Reverse the direction of the search if there was no improvement in the
// forward direction.
// Reuse previous thresholds instead of defining new ones.
// Move camera until sharpness changes by some (absolute or relative)
// amount, or until a fixed distance has been traversed.
// Set limits on displacement from current position.
apt_.set_reference_position(ncm_qapt_server::AptZ);
apt_.set_max_displacement(ncm_qapt_server::AptZ, 2.0f);
// Start searching.
apt_.Z()->move_at_velocity(-0.25f);
break;
case autoFocus_FindPeak:
vcl_cout << "FindPeak" << vcl_endl;
// Maintain the existing velocity, updating the optimal position every
// time the upper threshold is exceeded.
// When the peak has been passed, the lower threshold will be crossed
// causing a transition in the finite state machine.
// No need to do anything here - it's all handled by signals and slots.
apt_.set_max_displacement(ncm_qapt_server::AptZ, 1e9);
break;
case autoFocus_GoToPeak:
vcl_cout << "GoToPeak" << vcl_endl;
// Reverse direction and go back more slowly until a maximum is found.
processor_.set_lower_sharpness_threshold(-1e9);
processor_.set_upper_sharpness_threshold(1e9);
vcl_cout << "Peak pos = " << autoFocus_peak_position_ << vcl_endl;
apt_.Z()->move_to(autoFocus_peak_position_, true);
//emit apt_move_to(ncm_qapt_server::AptZ, autoFocus_peak_position_, false);
autoFocus_state_ = autoFocus_Inactive;
break;
default:
break;
}*/
}
//
//: Initialize the registry accessor and default parameters if they don't
// already exist.
void ncm_qcapture2_gui::initialize_registry_accessor()
{
ra_.get_current_user_key();
long result =
ra_.get_subkey("Software\\University of Manchester\\NCM QCapture");
if (result != ERROR_SUCCESS)
ra_.create_subkey("Software\\University of Manchester\\NCM QCapture");
}
//
//: Initialize the saver class with defaults
void ncm_qcapture2_gui::initialize_saver()
{
// Get the root dir from the Registry (if it exists).
vcl_string root_dir;
long result = ra_.read_string("RootDir", root_dir);
if (result != ERROR_SUCCESS)
{
root_dir = "C:/isbe/nailfold/playground/dmk/capture_software";
ra_.write_string("RootDir", root_dir);
}
ui.saveDirTextEdit->setText( root_dir.c_str() );
ui.saveDirTextEdit->setReadOnly( true );
savers_[0]->setRootDir( root_dir );
savers_[1]->setRootDir( root_dir );
// This will change with every session so don't store in the Registry.
QString sequence_name = QDate::currentDate().toString( "yyyy_MM_dd" );
ui.sequenceNameTextEdit->setText( sequence_name );
savers_[0]->setSequenceName( sequence_name.toStdString() );
savers_[1]->setSequenceName( sequence_name.toStdString() );
// Get the frame prefix from the Registry (if it exists).
vcl_string patient_name;
result = ra_.read_string("PatientName", patient_name);
if (result != ERROR_SUCCESS)
{
patient_name = "PatientX";
ra_.write_string("PatientName", patient_name);
}
ui.patientNameTextEdit->setText( patient_name.c_str() );
savers_[0]->setPatientName( patient_name );
savers_[1]->setPatientName( patient_name );
//Make sure the other saver parameters match the gui
QString hand = ui.handComboBox->currentText();
savers_[0]->setHand( hand.toStdString() );
savers_[1]->setHand( hand.toStdString() );
QString digit = ui.digitComboBox->currentText();
savers_[0]->setDigit( digit.toStdString() );
savers_[1]->setDigit( digit.toStdString() );
QString mag = ui.magComboBox->currentText();
savers_[0]->setMag( mag.toStdString() );
savers_[1]->setMag( mag.toStdString() );
}
//
//: Initialize motor position spinboxes
void ncm_qcapture2_gui::initialize_apt_spinboxes()
{
/*
ncm_apt_controller_base* c = NULL;
QDoubleSpinBox* sp = NULL;
c = apt_.X();
sp = ui.aptXPosition;
//sp->setMinimum(c->min_position());
//sp->setMaximum(c->max_position());
//sp->setValue(c->position());
//sp->setSingleStep(x_precision_);
//sp->setDecimals(-vcl_log10(x_precision_));
c = apt_.Y();
sp = ui.aptYPosition;
//sp->setMinimum(c->min_position());
//sp->setMaximum(c->max_position());
c = apt_.Z();
sp = ui.aptZPosition;
//sp->setMinimum(c->min_position());
//sp->setMaximum(c->max_position());
*/ //MOTOR_SWITCH_OFF
}
//
//: Initialize motor control timer
void ncm_qcapture2_gui::initialize_apt_timer()
{/*
apt_timer_.start(50);
apt_thread_.start();
// Make a note of the current position and set a threshold upon which to
// emit a signal.
apt_.set_reference_position(ncm_qapt_server::AptZ);
apt_.set_max_displacement(ncm_qapt_server::AptZ, 1.0f);*/
}
//
//: Initialize the processor thread
void ncm_qcapture2_gui::initialize_processor_thread()
{
processor_thread_.setObjectName("processor_thread");
processor_.moveToThread(&processor_thread_);
// Connect signals to slots that will run in the thread
// Camera tells processor there's a frame ready
QObject::connect( cameras_[0], SIGNAL(frame_ready()),
this, SLOT(tag_frame1()) );
QObject::connect( cameras_[1], SIGNAL(frame_ready()),
this, SLOT(tag_frame2()) );
QObject::connect( this, SIGNAL(frame_tagged(int, bool, bool, bool)),
&processor_, SLOT(process_frame(int, bool, bool, bool)) );
//Processor tells GUI there's a frame ready to draw
QObject::connect( &processor_, SIGNAL(frame_to_draw( int )),
this, SLOT(redraw_scene( int )) );
//Processor tells GUI the saver is done
QObject::connect( &processor_, SIGNAL(processing_finished()),
this, SLOT(on_processing_finished()) );
//Processor tells GUI a diff frame is ready to draw
QObject::connect( &processor_, SIGNAL(diff_to_draw()),
this, SLOT(draw_diff_frame()) );
processor_thread_.start();
}
//
//: Initialize the saver thread
void ncm_qcapture2_gui::initialize_saver_thread()
{
saver_thread_.setObjectName("saver_thread");
savers_[0]->moveToThread(&saver_thread_);
savers_[1]->moveToThread(&saver_thread_);
savers_[0]->setCameraSuffix( ui.camera1SuffixTextEdit->toPlainText().toStdString() );
savers_[1]->setCameraSuffix( ui.camera2SuffixTextEdit->toPlainText().toStdString() );
// Connect signals to slots that will run in the thread
// Processor tells saver to save a frame
QObject::connect( &processor_, SIGNAL(frame_to_save1(int, int)),
savers_[0], SLOT(save_frame(int, int)) );
QObject::connect( &processor_, SIGNAL(frame_to_save2(int, int)),
savers_[1], SLOT(save_frame(int, int)) );
//Saver tells main gui it has saved a frame
QObject::connect( savers_[0], SIGNAL(frame_saved(int, int)),
this, SLOT(on_frame_saved(int, int)) );
QObject::connect( savers_[1], SIGNAL(frame_saved(int, int)),
this, SLOT(on_frame_saved(int, int)) );
//Saver tells main gui it has finished saving
QObject::connect( savers_[0], SIGNAL(saving_finished(int)),
this, SLOT(on_saving_finished(int)) );
QObject::connect( savers_[1], SIGNAL(saving_finished(int)),
this, SLOT(on_saving_finished(int)) );
saver_thread_.start();
}
void ncm_qcapture2_gui::get_apt_registry_values()
{
long result = ERROR_SUCCESS;
// Get motor assignments.
int id = 0;
int item = -1;
result = ra_.read_numeric("AptXId", id);
if (result == ERROR_SUCCESS)
{
item = ui.aptXCombobox->findText(QString::number(id));
if (item != -1)
ui.aptXCombobox->setCurrentIndex(item);
}
ra_.read_numeric("AptYId", id);
if (result == ERROR_SUCCESS)
{
item = ui.aptYCombobox->findText(QString::number(id));
if (item != -1)
ui.aptYCombobox->setCurrentIndex(item);
}
ra_.read_numeric("AptZId", id);
if (result == ERROR_SUCCESS)
{
item = ui.aptZCombobox->findText(QString::number(id));
if (item != -1)
ui.aptZCombobox->setCurrentIndex(item);
}
// Find out whether axes were reversed.
bool reversed = false;
result = ra_.read_boolean("XReversed", reversed);
if (result == ERROR_SUCCESS)
ui.aptXReverse->setChecked(reversed);
result = ra_.read_boolean("YReversed", reversed);
if (result == ERROR_SUCCESS)
ui.aptYReverse->setChecked(reversed);
result = ra_.read_boolean("ZReversed", reversed);
if (result == ERROR_SUCCESS)
ui.aptZReverse->setChecked(reversed);
}
//
//: Initialize the APT (motor) thread
void ncm_qcapture2_gui::initialize_apt_thread()
{
// Read previous values from the registry
get_apt_registry_values();
//apt_thread_.setObjectName("apt_thread");
//apt_.moveToThread(&apt_thread_);
//apt_timer_.moveToThread(&apt_thread_);
// Starting the timer does nothing until the thread is started.
//apt_timer_.start(/* interval = */ 50);
/*
// Register the enum so that the correct metafunctions can be called.
qRegisterMetaType<ncm_qapt_server::apt_axis>("ncm_qapt_server::apt_axis");
// Connect signals to slots that will run in the thread
QObject::connect( this, SIGNAL(apt_move_zero(ncm_qapt_server::apt_axis, bool)),
&apt_, SLOT(move_zero(ncm_qapt_server::apt_axis, bool)) );
QObject::connect( this, SIGNAL(apt_move_home(ncm_qapt_server::apt_axis, bool)),
&apt_, SLOT(move_home(ncm_qapt_server::apt_axis, bool)) );
QObject::connect( this, SIGNAL(apt_move_home(ncm_qapt_server::apt_axis, float, bool)),
&apt_, SLOT(move_home(ncm_qapt_server::apt_axis, float, bool)) );
QObject::connect( this, SIGNAL(apt_move_to(ncm_qapt_server::apt_axis, float, bool)),
&apt_, SLOT(move_to(ncm_qapt_server::apt_axis, float, bool)) );
QObject::connect( this, SIGNAL(apt_move_by(ncm_qapt_server::apt_axis, float, bool)),
&apt_, SLOT(move_by(ncm_qapt_server::apt_axis, float, bool)) );
// Don't start the thread yet.
*/ //MOTOR_SWITCH_OFF
}
//
//: Connect signals to slots (not surprisingly...)
void ncm_qcapture2_gui::connect_signals_to_slots()
{
// Signals that trigger slots in the main thread
/* Don't worry about the autofocus stuff for now (it won't be used in the two camera setup)
QObject::connect( &apt_timer_, SIGNAL(timeout()),
this, SLOT(onAptTimer()) );
QObject::connect( &apt_, SIGNAL(move_complete(ncm_qapt_server::apt_axis)),
this, SLOT(onAptMoveComplete(ncm_qapt_server::apt_axis)) );
QObject::connect( &processor_, SIGNAL(lower_sharpness_exceeded()),
this, SLOT(onLowerSharpnessThresholdCrossed()) );
QObject::connect( &processor_, SIGNAL(upper_sharpness_exceeded()),
this, SLOT(onUpperSharpnessThresholdCrossed()) );
*/
}
| [
"michael.berks@manchester.ac.uk"
] | michael.berks@manchester.ac.uk |
4cc64ae5781206616d23317ce03d05474e8bf61e | 2b25a60a4fdb266fd46588bfae3c697c226584ac | /S3/newton.cpp | c33b6eefc0a053bc5cf78e3a33cce044b5cdb615 | [] | no_license | Qernz/FC | 14fac749857ce1985257f3ceed54ed300122ec38 | 55f04c66c2d2acd23d918e88569eb449ddf2b6cc | refs/heads/master | 2021-05-16T11:03:37.829510 | 2017-12-16T17:39:42 | 2017-12-16T17:39:42 | 104,913,504 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,560 | cpp | #include <iostream>
#include <fstream>
#include <cmath>
using namespace std;
void Numerov_method(float h, int n, float (*f)(float, float,float, float, float, float), float*, float*, float*, float*, float*, float*);
float force (float t, float r1, float r2, float r3, float dist12, float dist13)
{
float r12 = r2 - r1;
float r13 = r3 - r1;
float f = r12/pow(dist12,3) + r13/pow(dist13,3);
//cout << "r12: " << r12 << " " << "r13: " << r13 << endl;
/*for (int i = 0; i < 2; i++)
{
r12[i] = r2[i] - r1[i];
}
for (int i = 0; i < 2; i++)
{
r13[i] = r3[i] - r1[i];
}
for (int i = 0; i < 2; i++)
{
f[i] = r12[i]/pow(dist12,3) + r13[i]/pow(dist13,3);
}*/
return f;
}
int main()
{
float r1[2];
float r2[2];
float r3[2];
float h = 0;
int n = 0;
float r01[2];
float r03[2];
float r02[2];
ifstream dados;
dados.open("dados.txt");
dados >> h;
dados >> n;
dados >> r01[0] >> r01[1];
dados >> r1[0] >> r1[1];
dados >> r02[0] >> r02[1];
dados >> r2[0] >> r2[1];
dados >> r03[0] >> r03[1];
dados >> r3[0] >> r3[1];
Numerov_method(h, n, &force, r1, r2, r3, r01, r02, r03);
/*r1 = Numerov_method(h, n , &force, r1, r2, r3, r01, r02, r03);
r2 = Numerov_method(h, n , &force, r2, r1, r3, r02, r01, r03);
r3 = Numerov_method(h, n , &force, r3, r2, r1, r03, r02, r01);*/
dados.close();
return 0;
}
void Numerov_method(float h, int n, float (*f)(float, float, float, float, float, float), float* r1, float* r2, float* r3, float* r01, float* r02, float* r03 )
{
ofstream dados1;
ofstream dados2;
ofstream dados3;
dados1.open("newdata1.txt");
dados2.open("newdata2.txt");
dados3.open("newdata3.txt");
float t = 0;
float temp1[2];
float temp2[2];
float temp3[2];
int i = 0;
int j = 0;
for (i = 0; i < n; i++)
{
dados1 << t << " " << r1[0] << " " << r1[1] << endl;
dados2 << t << " " << r2[0] << " " << r2[1] << endl;
dados3 << t << " " << r3[0] << " " << r3[1] << endl;
float dist12 = sqrt(pow(r1[0] - r2[0]+ 0.0001,2) + pow(r1[1] - r2[1]+ 0.0001,2));
float dist13 = sqrt(pow(r1[0] - r3[0]+ 0.0001,2) + pow(r1[1] - r3[1]+ 0.0001,2));
float dist23 = sqrt(pow(r2[0] - r3[0]+ 0.0001,2) + pow(r2[1] - r3[1]+ 0.0001,2));
//cout << "dist12:" << dist12 << " " << "dist13:" << dist13 << " " << "dist23:" << dist23 << " " << endl;
if ( dist12 ==0 || dist13 == 0 || dist23 == 0)
{
cout << "FODEU!!" << endl;
}
for (j = 0; j<2; j++)
{
temp1[j] = r1[j];
temp2[j] = r2[j];
temp3[j] = r3[j];
}
for (j = 0; j<2; j++)
{
r1[j] = 2*temp1[j] - r01[j] + h*h*f(t, temp1[j], temp2[j], temp3[j], dist12, dist13);
r2[j] = 2*temp2[j] - r02[j] + h*h*f(t, temp2[j], temp1[j], temp3[j], dist12, dist23);
r3[j] = 2*temp3[j] - r03[j] + h*h*f(t, temp3[j], temp1[j], temp2[j], dist23, dist13);
}
//cout << "valor r1:" << "(" << r1[0] << "," << r1[1] << ")" << endl;
//cout << "valor r2:" << "(" << r2[0] << "," << r2[1] << ")" << endl;
//cout << "valor r3:" << "(" << r3[0] << "," << r3[1] << ")" << endl;
for (j = 0; j<2; j++)
{
r01[j] = temp1[j];
r02[j] = temp2[j];
r03[j] = temp3[j];
}
t += h;
}
dados1.close();
dados2.close();
dados3.close();
}
| [
"miltonfreits@hotmail.com"
] | miltonfreits@hotmail.com |
16a76cd578712d5cb9e7b6f3f0e73972e3394c4d | c08a26d662bd1df1b2beaa36a36d0e9fecc1ebac | /classicui_plat/volume_control_api/inc/Aknvolumecontrol.h | ac6d55dae1e961505ddb3af60f14db402ec4112b | [] | no_license | SymbianSource/oss.FCL.sf.mw.classicui | 9c2e2c31023256126bb2e502e49225d5c58017fe | dcea899751dfa099dcca7a5508cf32eab64afa7a | refs/heads/master | 2021-01-11T02:38:59.198728 | 2010-10-08T14:24:02 | 2010-10-08T14:24:02 | 70,943,916 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 9,127 | h | /*
* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
* which accompanies this distribution, and is available
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
* Initial Contributors:
* Nokia Corporation - initial contribution.
*
* Contributors:
*
* Description: Volume editor class
*
*/
#ifndef AKNVOLUMECONTROL_H
#define AKNVOLUMECONTROL_H
#include <AknNaviDecoratorObserver.h>
#include <AknControl.h>
class CGulIcon;
class MAknsSkinInstance;
class CVolumeExtension;
/**
* Used for controlling the volume setting on the phone.
*/
class CAknVolumeControl : public CAknControl, public MAknNaviDecoratorObserver
{
public:
/**
* C++ default constructor.
*/
IMPORT_C CAknVolumeControl();
/**
* Destructor.
*/
IMPORT_C ~CAknVolumeControl();
/**
* Sets volume.
*
* @param aValue The new volume.
*/
IMPORT_C void SetValue(TInt aValue);
/**
* Gets volume.
*
* @return The volume setting.
*/
IMPORT_C TInt Value() const;
/**
* Sets the range of the volume control. Maximum value must be greater
* than the minimum value, or the method will Panic.
*
* @since 3.2
* @param aMinimumValue The minimum value of the volume control
* @param aMaximumValue The maximum value of the volume control
* @par Exceptions:
* Will panic with EAknPanicInvalidValue if the minimum value is
* greater or equal than maximum value.
*
*/
IMPORT_C void SetRange( TInt aMinimumValue, TInt aMaximumValue );
/**
* Gets the range of the volume control.
* @since 3.2
* @param aMinimumValue The minimum value of the volume control
* @param aMaximumValue The maximum value of the volume control
*/
IMPORT_C void GetRange( TInt& aMinimumValue, TInt& aMaximumValue );
void SuppressDrawing( TBool aSuppress );
public: // from CCoeControl
/**
* From @c CCoeControl.
*
* Gets minimun size of layout rectangle.
*
* @return Minimum layout rectangle size.
*/
TSize MinimumSize();
/**
* From @c CCoeControl
*
* Handles key events.
*
* @param aKeyEvent Key event to be handled.
* @param aType Type of the event.
* @return Returns @c EKeyConsumed if key event was handled.
*/
TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType);
/**
* From @c CCoeControl.
*
* Construct item from given resource.
*
* @param aReader Resource reader reading the wanted resource set.
*/
IMPORT_C void ConstructFromResourceL(TResourceReader& aReader);
/**
* From @c CCoeControl.
*
* Handles the change of @c CAknVolumeControl's resources.
*
* @param aType Type of resource to change
*/
IMPORT_C void HandleResourceChange(TInt aType);
/**
* Creates volume bitmap to "list pane for setting item"
* (setting option item volume graphic). Ownership of the returned bitmap
* is transfered to the caller.
*
* @param aValue Current value (1-10)
* @return Volume bitmap. Ownership of the bitmap is transfered to
* the caller.
*/
IMPORT_C static CFbsBitmap* CreateBitmapL(TInt aValue);
/**
* Creates general volume icon to "list pane for setting item"
* (setting option item volume graphic). Ownership of the returned icon
* is transfered to the caller.
*
* @param aValue Current value (1-10)
* @return Volume icon. Ownership of the icon is transfered to
* the caller.
*/
IMPORT_C static CGulIcon* CreateSetStyleListBoxIconL( TInt aValue );
/**
* Creates Hi-res volume icon to "list pane for setting item"
* (setting option item volume graphic). Ownership of the returned icon
* is transfered to the caller.
*
* @since 3.2
* @param aValue Current value (1-10)
* @param aMinimum Minimum for Hi-res volume control
* @param aMaximum Maximum for Hi-res volume control
* @return Volume icon. Ownership of the icon is transfered to
* the caller.
*/
IMPORT_C static CGulIcon* CreateSetDynRangeStyleListBoxIconL( TInt aValue,
TInt aMinimum,
TInt aMaximum );
/**
* Informs the volume control about whether or not it's placed on the
* navi pane's control stack
*
* @param aIsOnNaviStack @c ETrue if the control is on the navi stack,
* @c EFalse otherwise.
*/
void HandleNaviStackChange( TBool aIsOnNaviStack );
protected: // from CCoeControl
/**
* From @c CCoeControl.
*
* Handles layout change.
*/
void SizeChanged();
/**
* From @c CCoeControl.
*
* Draws every visible item into the specified rectangle.
*
* @param aRect the specified rectangle.
*/
void Draw(const TRect& aRect) const;
public:
/**
* From @c CCoeControl.
*
* Handles pointer events.
*
* @param aPointerEvent Pointer event to be handled
*/
IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent);
/**
* From @c MAknNaviDecoratorObserver
*
* Handles Navidecorator events (Arrow left and arrow right)
*
* @param aEventID ID of event to be handled
*/
IMPORT_C void HandleNaviDecoratorEventL( TInt aEventID );
private:
/**
* From CAknControl
*/
IMPORT_C void* ExtensionInterface( TUid aInterface );
private:
/**
*
*/
void SetVolumeLayout(TInt aStyle);
/**
* Starts a timer for feedback effect visualization
*/
void StartTimerL();
/**
* A callback function for feedback effect.
*
* @param aThis Pointer to this volume control.
*/
static TInt IndicationDrawCallbackL( TAny* aThis );
/**
* Implementation of the feedback effect (Blinking when the volume value
* is set to the max/min value).
*/
void SmallDirectionIndicationL();
/**
* (Re)create the navi icon
*/
void CreateNaviIconL();
// Refactored: Used for drawing different styles.
void DrawSettingsStyleVolumeControl( const TRect& aRect ) const;
void DrawDefaultStyleVolumeControl( const TRect& aRect ) const;
void DrawSkinnedDefaultStyleVolumeControl( const TRect& aRect ) const;
void DrawDynRangeSettingsStyleVolumeControl( const TRect& aVolumeArea ) const;
/**
* Calculates the volume icon areas using given volume value.
*
* @param aVolume Volume used as the ratio between active and inactive areas.
* @param aDrawArea The whole drawing area.
* @param aActiveRect Drawing area for the active icon.
* @param aInactiveRect Drawing area for the inactive icon.
*/
void CalcVolumeIconAreas( const TInt aVolume,
const TRect& aDrawArea,
TRect& aActiveRect,
TRect& aInactiveRect ) const;
/**
* Utility function for scaling the value between iMiminumValue and
* iMaximumValue to a range of [0-10]. This is needed for old drawing
* functions that assume only 10 step volume control.
*
* @return Colume value scaled to range of [0-10].
*/
TInt CAknVolumeControl::ScaledValue() const;
/*
* Set extended touch area to be used
*/
void UseExtendedTouchArea();
private:
CFbsBitmap* iBitmap;
CFbsBitmap* iMaskBitmap;
TPoint iStartPos;
CVolumeExtension* iExtension;
TInt iSpare1;
TPoint iBmpPos;
TInt iValue;
TInt iStyle;
};
#endif // AKNVOLUMECONTROL_H
| [
"kirill.dremov@nokia.com"
] | kirill.dremov@nokia.com |
49add82554e97fecc6b8352b174d344cd629dd96 | 92e7a96c196e563b70f78db321680d830af80a53 | /SvrTradeFront/MonitorClient/CmdMsgQueue.h | 38858ac1c499ec9d050a2bb6043a7a8a42c2b0f0 | [] | no_license | alexfordc/zq | 513723341132dd2b01f5ca3debb567b2fd31c033 | a0b05b7416fe68784e072da477e8c869097584e2 | refs/heads/master | 2021-05-25T14:19:37.317957 | 2018-02-24T05:57:23 | 2018-02-24T05:57:23 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 345 | h | #pragma once
#include "stdafx.h"
#include "MsgQueue.h"
//#include "CommonDefine.h"
#include "monitorCommonDefine.h"
class CCmdMsgQueue : public CMsgQueue<RecvData>
{
public:
CCmdMsgQueue(void);
~CCmdMsgQueue(void);
};
class CCmdClinetMsgQueue : public CMsgQueue<RecvDataMsg>
{
public:
CCmdClinetMsgQueue(void);
~CCmdClinetMsgQueue(void);
};
| [
"w.z.y2006@163.com"
] | w.z.y2006@163.com |
4387de9f6d8e59331fc930f41717d97275a736fb | a66b543f0dfb35173facc85608f4035089adb6a1 | /hiro/core/menu-bar.cpp | fec4e74875cad62db2b335df365e35f3586ad4ca | [] | no_license | vonmoltke/vmsnes | d85fb363a27583ae39d4b074efd0c74c22141a17 | 8ff5f3d2bd735d0618f00169b4c8af0ffa38b5a2 | refs/heads/master | 2021-01-18T23:21:19.031712 | 2016-07-18T00:32:40 | 2016-07-18T00:32:40 | 38,261,553 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,061 | cpp | #if defined(Hiro_MenuBar)
auto mMenuBar::allocate() -> pObject* {
return new pMenuBar(*this);
}
auto mMenuBar::destruct() -> void {
for(auto& menu : state.menus) menu->destruct();
mObject::destruct();
}
//
auto mMenuBar::append(sMenu menu) -> type& {
state.menus.append(menu);
menu->setParent(this, menus() - 1);
signal(append, menu);
return *this;
}
auto mMenuBar::menu(unsigned position) const -> Menu {
if(position < menus()) return state.menus[position];
return {};
}
auto mMenuBar::menus() const -> unsigned {
return state.menus.size();
}
auto mMenuBar::remove() -> type& {
if(auto window = parentWindow()) window->remove(window->menuBar());
return *this;
}
auto mMenuBar::remove(sMenu menu) -> type& {
signed offset = menu->offset();
signal(remove, *menu);
state.menus.remove(offset);
for(auto n : range(offset, menus())) {
state.menus[n]->adjustOffset(-1);
}
menu->setParent();
return *this;
}
auto mMenuBar::reset() -> type& {
while(state.menus) remove(state.menus.last());
return *this;
}
#endif
| [
"wmkrug@gmail.com"
] | wmkrug@gmail.com |
928abe737d84252b21b4f517677507488e7a6c63 | 560090526e32e009e2e9331e8a2b4f1e7861a5e8 | /Compiled/blaze-3.2/blazetest/src/mathtest/dvecdvecmax/V6aVHb.cpp | 00f11139727950c28d6a402da8dd688d4d967a8d | [
"BSD-3-Clause"
] | permissive | jcd1994/MatlabTools | 9a4c1f8190b5ceda102201799cc6c483c0a7b6f7 | 2cc7eac920b8c066338b1a0ac495f0dbdb4c75c1 | refs/heads/master | 2021-01-18T03:05:19.351404 | 2018-02-14T02:17:07 | 2018-02-14T02:17:07 | 84,264,330 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,696 | cpp | //=================================================================================================
/*!
// \file src/mathtest/dvecdvecmax/V6aVHb.cpp
// \brief Source file for the V6aVHb dense vector/dense vector maximum math test
//
// Copyright (C) 2012-2017 Klaus Iglberger - All Rights Reserved
//
// This file is part of the Blaze library. You can redistribute it and/or modify it under
// the terms of the New (Revised) BSD License. Redistribution and use in source and binary
// forms, with or without modification, are permitted provided that the following conditions
// are met:
//
// 1. Redistributions of source code must retain the above copyright notice, this list of
// conditions and the following disclaimer.
// 2. Redistributions in binary form must reproduce the above copyright notice, this list
// of conditions and the following disclaimer in the documentation and/or other materials
// provided with the distribution.
// 3. Neither the names of the Blaze development group nor the names of its contributors
// may be used to endorse or promote products derived from this software without specific
// prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
// SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
// TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
// BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
// DAMAGE.
*/
//=================================================================================================
//*************************************************************************************************
// Includes
//*************************************************************************************************
#include <cstdlib>
#include <iostream>
#include <blaze/math/HybridVector.h>
#include <blaze/math/StaticVector.h>
#include <blazetest/mathtest/Creator.h>
#include <blazetest/mathtest/dvecdvecmax/OperationTest.h>
#include <blazetest/system/MathTest.h>
//=================================================================================================
//
// MAIN FUNCTION
//
//=================================================================================================
//*************************************************************************************************
int main()
{
std::cout << " Running 'V6aVHb'..." << std::endl;
using blazetest::mathtest::TypeA;
using blazetest::mathtest::TypeB;
try
{
// Vector type definitions
typedef blaze::StaticVector<TypeA,6UL> V6a;
typedef blaze::HybridVector<TypeB,6UL> VHb;
// Creator type definitions
typedef blazetest::Creator<V6a> CV6a;
typedef blazetest::Creator<VHb> CVHb;
// Running the tests
RUN_DVECDVECMAX_OPERATION_TEST( CV6a(), CVHb( 6UL ) );
}
catch( std::exception& ex ) {
std::cerr << "\n\n ERROR DETECTED during dense vector/dense vector maximum:\n"
<< ex.what() << "\n";
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
}
//*************************************************************************************************
| [
"jonathan.doucette@alumni.ubc.ca"
] | jonathan.doucette@alumni.ubc.ca |
bb683ac55dc6f1f792fa98b957d4cbfce548ec97 | e0b020bb9e7295e62dd887bab62ef1ca0784ccb4 | /seek-a-soul/SeekASoul/Game/Level/LevelManager.h | 2f7051b90d666143872fad89d2e5055264f39315 | [] | no_license | cnicaudie/WDAU_2021 | dae732ccee73e1f905d4685879038a4bea9f52d1 | 3f8a84e168c8a2152e7c12cefbe8868e0246c2dc | refs/heads/main | 2023-04-21T16:33:43.601376 | 2021-05-02T16:55:55 | 2021-05-02T16:55:55 | 339,342,300 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,285 | h | #pragma once
#include <Game/Map/GameMap.h>
namespace SeekASoul
{
namespace Gameplay
{
class LevelManager : public sf::Drawable
{
public:
LevelManager(const std::shared_ptr<Engine::InputManager>& inputManager, const std::shared_ptr<Engine::TextureManager>& textureManager);
~LevelManager();
void Update(float deltaTime);
void draw(sf::RenderTarget& target, sf::RenderStates states) const override;
void RenderDebugMenu(sf::RenderTarget& target);
inline const GameMap& GetGameMap() const { return m_GameMap; };
inline const sf::Vector2u GetLevelBounds() const { return { m_LevelWidth * GameMap::TILE_SIZE.x, m_LevelHeight * GameMap::TILE_SIZE.y }; };
inline const Player& GetPlayerOnMap() const { return m_GameMap.GetPlayer(); };
private:
void ChooseLevel();
void LoadLevel(bool restart);
void ManageLevelChange();
void OnEvent(const Engine::Event* evnt);
//====================//
std::shared_ptr<Engine::TextureManager> m_TextureManager;
GameMap m_GameMap;
enum class LevelState
{
PENDING = 0,
SELECTING = 1,
LOADING = 2,
PLAYING = 3,
OVER = 4
} m_CurrentState;
int m_LevelChoice;
unsigned int m_CurrentLevel;
unsigned int m_LevelWidth;
unsigned int m_LevelHeight;
};
}
} | [
"charlotte.nicaudie@insa-rennes.fr"
] | charlotte.nicaudie@insa-rennes.fr |
9e225053bfab1c60b6ca02cf6902a56dd60f257b | 5c2baa58d42eba407efdf5a4652e9c61a500dd05 | /src/appleseed/renderer/kernel/rendering/progressive/samplegeneratorjob.h | ad005e1eb13c491ed27d9707c2a537b45882afbb | [
"MIT"
] | permissive | theomission/appleseed | f5bfeb66f18f21a06ebe1a8b5c1d61c39d1cdf2c | 87d6ffc9448cb1241dc64b967c3f49adf8369ec0 | refs/heads/master | 2021-01-18T08:10:05.167266 | 2015-11-29T19:39:26 | 2015-11-29T19:39:26 | 47,942,730 | 1 | 0 | null | 2015-12-14T00:13:23 | 2015-12-14T00:13:23 | null | UTF-8 | C++ | false | false | 2,957 | h |
//
// This source file is part of appleseed.
// Visit http://appleseedhq.net/ for additional information and resources.
//
// This software is released under the MIT license.
//
// Copyright (c) 2010-2013 Francois Beaune, Jupiter Jazz Limited
// Copyright (c) 2014-2015 Francois Beaune, The appleseedhq Organization
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
#ifndef APPLESEED_RENDERER_KERNEL_RENDERING_PROGRESSIVE_SAMPLEGENERATORJOB_H
#define APPLESEED_RENDERER_KERNEL_RENDERING_PROGRESSIVE_SAMPLEGENERATORJOB_H
// appleseed.foundation headers.
#include "foundation/utility/job.h"
// Standard headers.
#include <cstddef>
// Forward declarations.
namespace renderer { class ISampleGenerator; }
namespace renderer { class SampleAccumulationBuffer; }
namespace renderer { class SampleCounter; }
namespace renderer
{
class SampleGeneratorJob
: public foundation::IJob
{
public:
// Constructor.
SampleGeneratorJob(
SampleAccumulationBuffer& buffer,
ISampleGenerator* sample_generator,
SampleCounter& sample_counter,
foundation::JobQueue& job_queue,
const size_t job_index,
const size_t job_count,
const size_t pass,
foundation::IAbortSwitch& abort_switch);
// Execute the job.
virtual void execute(const size_t thread_index);
private:
SampleAccumulationBuffer& m_buffer;
ISampleGenerator* m_sample_generator;
SampleCounter& m_sample_counter;
foundation::JobQueue& m_job_queue;
const size_t m_job_index;
const size_t m_job_count;
const size_t m_pass;
foundation::IAbortSwitch& m_abort_switch;
};
} // namespace renderer
#endif // !APPLESEED_RENDERER_KERNEL_RENDERING_PROGRESSIVE_SAMPLEGENERATORJOB_H
| [
"beaune@aist.enst.fr"
] | beaune@aist.enst.fr |
a1f205e860139f4ee43d25fa6048ef70e735fc79 | 4dcec3c49aef0aa74e1f02180e7cc09e12e6884a | /engine/shared_ptr.h | 6b895ac60e724b4e151231cd4c002294288efa1c | [
"MIT"
] | permissive | NoirShadow/grit-engine | 7449a61730685ab99cb4e7ea55f5987a093eb736 | 4947a31d7ac556f22d196c65c299c8f98d223b26 | refs/heads/master | 2021-01-22T22:12:19.586727 | 2017-03-18T14:48:54 | 2017-03-18T14:48:54 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,645 | h | /* Copyright (c) The Grit Game Engine authors 2016
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#ifndef SharedPtr_h
#define SharedPtr_h
#include <cstdlib>
#include <functional>
/** A smart pointer that does reference counting and calls delete on the target
* when the number of references hits zero. Note that unlike Ogre::SharedPtr,
* this one is not thread-safe (i.e. you cannot make reference or unreference
* the target in concurrent threads or the counter updates will race). */
template<class T> class SharedPtr {
/** The target. */
T *ptr;
/** The number of references to the target. Note that to allow a general
* T, we allocate the counter separately. It would also be possible to require
* a counter inside the T object. */
unsigned int *cnt;
public:
/** Deference to the target. */
T& operator*() const { return *ptr; }
/** Deference to the target (-> form). */
T* operator->() const { return ptr; }
/** Is the target NULL? */
bool isNull (void) const { return cnt==NULL; }
/** Set the target to NULL. */
void setNull (void) {
if (isNull()) return;
useCount()--;
if (useCount()==0) {
delete cnt;
delete ptr;
}
ptr = NULL;
cnt = NULL;
}
/** Return the number of references to the target. */
unsigned int &useCount (void) const { return *cnt; }
/** Create with a NULL target. */
SharedPtr (void) : ptr(NULL), cnt(NULL) { }
/** Create with a given raw pointer as a target. The raw pointer should be
* used only through the SharedPtr from this point onwards, as it can be
* difficult to know when raw pointers to reference-counted memory become
* dangling. */
explicit SharedPtr (T *p) : ptr(p), cnt(p==NULL?NULL:new unsigned int(1)) { }
/** Make a new reference to an existing SharedPtr (incrementing the reference counter). */
SharedPtr (const SharedPtr<T> &p) : ptr(p.ptr), cnt(p.cnt) { if (!isNull()) useCount()++; }
/** Destructor (decrements the reference counter). */
~SharedPtr (void) { setNull(); }
/** Make this SharedPtr reference the target of SharedPtr p (incrementing the reference counter). */
SharedPtr &operator= (const SharedPtr<T> &p) {
// The next line is not just an optimisation, it is needed for correctness
// without it if *cnt==1 then the setNull() would free the storage,
// in what ought to be a no-op. Obviously this would cause considerable drama.
if (p==*this) return *this;
T *ptr_ = p.ptr;
unsigned int *cnt_ = p.cnt;
setNull();
ptr = ptr_;
cnt = cnt_;
if (!isNull()) useCount()++;
return *this;
}
/** Return a SharedPtr to the same object that has a supertype (according to c++ static_cast rules). */
template<class U> SharedPtr<U> staticCast (void) const
{
SharedPtr<U> r;
r.cnt = cnt;
r.ptr = static_cast<U*>(ptr);
if (!isNull()) useCount()++;
return r;
}
template<class U> friend class SharedPtr;
};
/** Do the targets match? */
template<class T, class U> inline bool operator==(SharedPtr<T> const& a, SharedPtr<U> const& b)
{ return &*a == &*b; }
/** Are the targets different? */
template<class T, class U> inline bool operator!=(SharedPtr<T> const& a, SharedPtr<U> const& b)
{ return ! (a==b); }
/** Call std::less on the targets. */
template<class T, class U> inline bool operator<(SharedPtr<T> const& a, SharedPtr<U> const& b)
{ return std::less<const void*>()(&*a, &*b); }
#endif
| [
"sparkprime@gmail.com"
] | sparkprime@gmail.com |
da080339c65925e74f849e933781a31fe964dedc | 7ad6e7b551ad0dfa8fc7525c97d5e8f69e00afef | /abc/141/abc141a.cpp | 0b85d6891bd1d15e48151bcd63399b1547b691ab | [] | no_license | bakaiton/atcoder | 7584e0cb7faa1be41ecdf3dab343275adc289e39 | 4cb1824f19deb0e42a31ed042bd54543fa9a8102 | refs/heads/master | 2021-05-19T04:50:13.516508 | 2020-03-31T14:48:09 | 2020-03-31T14:48:09 | 251,535,231 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 396 | cpp | #include <stdio.h>
#include <iostream>
#include <string>
using namespace std;
int main(){
string s;
int flag = 0;
string ans[] = {"Sunny", "Cloudy", "Rainy"};
cin>>s;
for (int i = 0; i < 3; i++){
if (ans[i] == s){
if (i != 2){
flag = i + 1;
}else{
flag = 0;
}
}
}
cout<<ans[flag]<<endl;
} | [
"itubokaito@yahoo.co.jp"
] | itubokaito@yahoo.co.jp |
5fb8f70496ec9921708743fbaca03c3243e1094e | 955df16d55d85265c5bd6f4c7b8d3b01e27a638f | /Arduino Projects/Tilt_Sensor/Tilt_Sensor.ino | 5192b38557f5ac5376fe1e0b176a0a655e709657 | [] | no_license | EngrDevDom/Arduino-Projects | 6e95ddcd374c7c49e009189c0447c3bb83a105c8 | d30a814c5f8172b0f6ed1cd6d6f851dec04314f1 | refs/heads/master | 2023-01-30T08:01:38.438095 | 2020-12-14T07:32:44 | 2020-12-14T07:32:44 | 294,157,411 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,090 | ino | int ledPin = 12;
int sensorPin = 4;
int sensorValue;
int lastTiltState = HIGH; // the previous reading from the tilt sensor
// the following variables are long's because the time, measured in miliseconds,
// will quickly become a bigger number than can be stored in an int.
long lastDebounceTime = 0; // the last time the output pin was toggled
long debounceDelay = 50; // the debounce time; increase if the output flickers
void setup(){
Serial.begin(9600);
pinMode(sensorPin, INPUT);
digitalWrite(sensorPin, HIGH);
pinMode(ledPin, OUTPUT);
}
void loop(){
sensorValue = digitalRead(sensorPin);
// If the switch changed, due to noise or pressing:
if (sensorValue == lastTiltState) {
// reset the debouncing timer
lastDebounceTime = millis();
}
if ((millis() - lastDebounceTime) > debounceDelay) {
// whatever the reading is at, it's been there for longer
// than the debounce delay, so take it as the actual current state:
lastTiltState = sensorValue;
}
digitalWrite(ledPin, lastTiltState);
Serial.println(sensorValue);
delay(500);
}
| [
"60880034+EngrDevDom@users.noreply.github.com"
] | 60880034+EngrDevDom@users.noreply.github.com |
750b13dabbfa8389770032432c20ea3239904bcb | 20169b20a3ad48d6206d7bc6f83cd9da1446280e | /4M-C plus plus/HDU/2565.cpp | cb010b8ad695085bd706cb78385efc818c332cf5 | [] | no_license | McFly-byte/Tyro | 57440f150ffe69440c5599bac0bdd2105eb1c405 | b810cb65933370738a507a852af7eb710861dc4f | refs/heads/master | 2023-04-19T14:06:24.632660 | 2021-05-12T02:43:23 | 2021-05-12T02:43:23 | 332,741,678 | 0 | 1 | null | null | null | null | GB18030 | C++ | false | false | 343 | cpp | #include <iostream>
using namespace std;
int main()
{
int T , n;
cin >> T;
while( T-- ){
cin >> n;
for( int i = 1 ; i <= n ; i++ ){//注意不要打多余的空格
for( int j = 1 ; j <= i || j <= n-i+1 ; j++ ){
if( j == i || j == n - i + 1 ) cout << 'X';
else cout << ' ' ;
}
cout << endl;
}
cout << endl;
}
}
| [
"mcfly@njust.edu.cn"
] | mcfly@njust.edu.cn |
a01e5f2cdeed39be3f1ea9c2bf7352450fec9d95 | 2ff6325b334a8522d17a259eb5a97c301fee396c | /src/AnalyzerContext.h | e9b89997ae3ded09691f2af6b926463c75185743 | [
"BSD-2-Clause"
] | permissive | aeppert/smbx | 494af0ee0baa42aef459e6bc0b42cd1fe7e9de37 | 43eec891cfa2149e4b51f48fce7c702ffca3332a | refs/heads/master | 2021-01-18T00:56:02.640114 | 2015-06-03T22:30:09 | 2015-06-03T22:30:09 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 500 | h | #ifndef SMBx_ANALYZERCONTEXT_H
#define SMBx_ANALYZERCONTEXT_H
#include "Conn.h"
#include "Event.h"
#include "State.h"
namespace SMBx {
class AnalyzerContext
{
public:
Connection* conn;
analyzer::ID id;
analyzer::Tag tag;
State state;
AnalyzerContext(Connection* c, analyzer::ID id, analyzer::Tag tag) : conn(c), id(id), tag(tag) {}
void QueueEvent(const EventHandlerPtr& ptr, val_list* vl)
{
mgr.QueueEvent(ptr, vl, SOURCE_LOCAL, id, timer_mgr, conn);
}
};
}
#endif | [
"p_github@finarfin.net"
] | p_github@finarfin.net |
f9609144138c9c5f98a53003953e05f74a8c6410 | 787608b2f0731950dba91ea20d2045d5818eeddd | /Net.h | 6a7cdf374731fd63ecfb3ba97ae19cabd42df8b1 | [] | no_license | s1210233/qttag | 42808e1b22c8cbc9dbf207490a10d0ee75c86a1e | e25be3520920e65f60ed87269074f84f169f00bd | refs/heads/master | 2020-07-10T22:39:33.728567 | 2016-12-21T09:01:22 | 2016-12-21T09:01:22 | 74,008,605 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 11,842 | h | //==============================================================================
// Net.h
// : program file for networks
//
//------------------------------------------------------------------------------
//
// Date: Thu Nov 3 01:02:45 2016
//
//==============================================================================
#ifndef _Net_H // begining of header file
#define _Net_H // notifying that this file is included
//------------------------------------------------------------------------------
// Including Header Files
//------------------------------------------------------------------------------
#include <opencv/cv.h>
using namespace cv;
#include "Graph.h"
//------------------------------------------------------------------------------
// Defining Macros
//------------------------------------------------------------------------------
// for b143 network
// #define B143_NETWORK
// for b106 network
// #define B106_NETWORK
#ifndef DIVISOR
#define DIVISOR (29)
#endif // DIVISOR
#ifndef UNIT_STEP
#define UNIT_STEP (2)
#endif // UNIT_STEP
#ifndef MAX_LIMIT_STEP
#define MAX_LIMIT_STEP (90) //origin->40
#endif // MAX_LIMIT_STEP
#ifndef STANDARD_LIMIT_STEP
#define STANDARD_LIMIT_STEP (40)
#endif // STARNDARD_LIMIT_STEP
#ifndef MIN_LIMIT_STEP
#define MIN_LIMIT_STEP (10)
#endif // MIN_LIMIT_STEP
#ifndef K_NEIGHBORS
//#define K_NEIGHBORS (3)
#define K_NEIGHBORS (4) // This is the best?
//#define K_NEIGHBORS (6)
#endif // K_NEIGHBORS
#define LAMBDA (0.6307)
#define MU (-0.673155945)
//#define LAMBDA (0.330)
//#define MU (-0.331)
#ifdef B143_NETWORK
#define MIN_RATIO (0.01) // b143
#else // B143_NETWORK
#define MIN_RATIO (0.0)
#endif // B143_NETWORK
#define MAX_RATIO (1.0)
#define STEP_RATIO (0.1)
//------------------------------------------------------------------------------
// Defining Classes
//------------------------------------------------------------------------------
class Net : public Graph {
private:
static void _changeHSVToColor ( double hue, double saturation, double value,
unsigned char rgb[ 3 ] );
protected:
IplImage * _diagram;
map< unsigned int, unsigned int > _colorMap;
unsigned int _nAnnotated;
unsigned int _step;
double _ratio;
int _width;
int _height;
// center coordinates
double _center_x, _center_y;
// scale of the window (length of the side)
double _window_side;
// metric -> 0=EUCLIDEAN,1=MANHATTAN,2=CHEBYSHEV
int _metric;
// mode -> 0=force-directed, 1=centroidal Voronoi, 2=hybrid simple
// 3=hybrid adaptive, 4=hybrid onestep, 5=hybrid twostep
int _mode;
//evaluation -> 0=not evaluate, 1 = evaluate
int _evaluation; //---------------add20151015*/
VertexDescriptor _curVD;
unsigned int _prevID;
unsigned int _nextID;
bool _labelFlag;
bool _clutterBit;
double _conflictArea;
bool _clut;
bool _ft;
bool _smoothingset;
bool _gp;
bool _spaceBit;
void _init ( void );
void _reset ( void );
void _random ( void );
void _load ( const char * filename );
void _save ( const char * filename );
void _allset ( void );
void _allclear ( void );
void _force ( void );
void _centroid ( void );
double _gap ( void );
#ifdef SKIP
void _para ( void );
#endif // SKIP
void _proceed ( void ); // proceed with the blending parameter
void _onestep ( void ); // one-step smoothing
void _twostep ( void ); // two-step smoothing
public:
// static int _nindex;
// static int _sindex;
//------------------------------------------------------------------------------
// コンストラクタ
// Constructors
//------------------------------------------------------------------------------
Net(); // default constructor
// コンストラクタ(デフォルト)
Net( const Net & obj );
// copy constructor
// コピー・コンストラクタ
//------------------------------------------------------------------------------
// デストラクタ
// Destructor
//------------------------------------------------------------------------------
~Net(); // destructor
// デストラクタ
//------------------------------------------------------------------------------
// メンバ参照
// Reffwering to members
//------------------------------------------------------------------------------
IplImage *& diagram( void ) { return _diagram; }
const unsigned int & nAnnotated( void ) const
{ return _nAnnotated; }
unsigned int & nAnnotated( void ) { return _nAnnotated; }
const unsigned int & step ( void ) const { return _step; }
unsigned int & step ( void ) { return _step; }
const double & ratio ( void ) const { return _ratio; }
double & ratio ( void ) { return _ratio; }
const double & ratioF( void ) const { return _ratio; }
const double ratioV( void ) const { return ( 1.0 - _ratio ); }
const int & width ( void ) const { return _width; }
int & width ( void ) { return _width; }
const int & height( void ) const { return _height; }
int & height( void ) { return _height; }
const double & center_x( void ) const { return _center_x; }
double & center_x( void ) { return _center_x; }
const double & center_y( void ) const { return _center_y; }
double & center_y( void ) { return _center_y; }
const double & window_side( void ) const
{ return _window_side; }
double & window_side( void ) { return _window_side; }
const int & metric( void ) const { return _metric; }
int & metric( void ) { return _metric; }
const int & evaluation( void ) const { return _evaluation; }
int & evaluation( void ) { return _evaluation; } //------------add20151015
const int & mode( void ) const { return _mode; }
void setMode( int __mode ) {
_mode = __mode;
if ( ( _mode == 0 ) || ( _mode == 2 ) ) { // force-directed or hybrid
_ratio = 1.0;
}
else if ( _mode == 1 ) { // centroidal Voronoi
_ratio = 0.0;
}
}
VertexDescriptor & curVD( void ) { return _curVD; }
void setVDCoord( int x, int y );
const unsigned int & prevID( void ) const { return _prevID; }
unsigned int & prevID( void ) { return _prevID; }
const unsigned int & nextID( void ) const { return _nextID; }
unsigned int & nextID( void ) { return _nextID; }
void onLabel( void ) { _labelFlag = true; }
void offLabel( void ) { _labelFlag = false; }
const bool & labelFlag( void ) const { return _labelFlag; }
void setClutterBit( void ) { _clutterBit = true; }
void clearClutterBit( void ) { _clutterBit = false; }
const bool & clutterBit( void ) const { return _clutterBit; }
double & conflictArea( void ) { return _conflictArea; }
const double & conflictArea( void ) const { return _conflictArea; }
void setclut( void ) { _clut = true; }
void clearclut( void ) { _clut = false; }
const bool & clut( void ) const { return _clut; }
void setft( void ) { _ft = true; }
void clearft( void ) { _ft = false; }
const bool & ft( void ) const { return _ft; }
void setsmoothingset( void ) { _smoothingset = true; }
void clearsmoothingset( void ) { _smoothingset = false; }
const bool & smoothingset( void ) const { return _smoothingset; }
void setgp( void ) { _gp = true; }
void cleargp( void ) { _gp = false; }
const bool & gp( void ) const { return _gp; }
void setSpaceBit( void ) { _spaceBit = true; }
void clearSpaceBit( void ) { _spaceBit = false; }
const bool & spaceBit( void ) const { return _spaceBit; }
//------------------------------------------------------------------------------
// Annotateion labels
//------------------------------------------------------------------------------
void allset( void ) { _allset(); }
void allclear( void ) { _allclear(); }
//------------------------------------------------------------------------------
// Fundamental functions
//------------------------------------------------------------------------------
void reset( void ) { _reset(); }
void random( void ) { _random(); }
//------------------------------------------------------------------------------
// Analysis functions
//------------------------------------------------------------------------------
void calcEdgeCentrality( void );
void calcMST( void );
void calcDivideComunity( void );
//------------------------------------------------------------------------------
// Misc. functions
//------------------------------------------------------------------------------
void force ( void ) { _force(); }
void centroid( void ) { _centroid(); }
double gap ( void ) { return _gap(); }
#ifdef SKIP
void para ( void ) { _para(); }
#endif // SKIP
void proceed ( void ) { _proceed(); }
void onestep ( void ) { _onestep(); }
void twostep ( void ) { _twostep(); }
void initColorMap ( void );
//------------------------------------------------------------------------------
// file I/O
//------------------------------------------------------------------------------
void load ( const char * filename ) { _load( filename ); }
void save ( const char * filename ) { _save( filename ); }
//------------------------------------------------------------------------------
// static functions
//------------------------------------------------------------------------------
static void changeNumberToColor ( unsigned int step, unsigned int number,
unsigned char rgb[ 3 ] );
//------------------------------------------------------------------------------
// ソートのための関数
// Functions for sorting
//------------------------------------------------------------------------------
#ifdef SKIP
friend int compare ( const Net * a, const Net * b );
friend int compare ( const Net ** a, const Net ** b );
// comparison
// 比較関数
#endif // SKIP
//------------------------------------------------------------------------------
// 等号
// equality
//------------------------------------------------------------------------------
#ifdef SKIP
friend int operator == ( const Net & a, const Net & b );
friend int operator != ( const Net & a, const Net & b ) {
return ( ! ( a == b ) );
} // equality
// 等号
#endif // SKIP
//------------------------------------------------------------------------------
// 代入演算子
// Assignment opereators
//------------------------------------------------------------------------------
Net & operator = ( const Net & obj );
// assignment
// 代入
//------------------------------------------------------------------------------
// 入出力
// I/O functions
//------------------------------------------------------------------------------
friend ostream & operator << ( ostream & stream, const Net & obj );
// output
// 出力
friend istream & operator >> ( istream & stream, Net & obj );
// input
// 入力
//------------------------------------------------------------------------------
// クラス名
// Class name
//------------------------------------------------------------------------------
virtual const char * className( void ) const { return "Net"; }
// class name
// クラス名
};
#ifdef SKIP
inline int arrange( const Net * a, const Net * b ) {
return compare( a, b );
} // ソートのためのふたつのベクトルの比較
#endif // SKIP
#endif // _Net_H
// end of header file
// Do not add any stuff under this line.
| [
"s1210233@gmail.com"
] | s1210233@gmail.com |
57621eb7f1f74f95c156028d46655c503ba52017 | ca426a7312ed9bebe02f8089400ee435f8069d6c | /src/interp/istream.h | 614a942d345e5d2441753f2d9bce8976c4da575b | [
"Apache-2.0"
] | permissive | relrelb/wabt | b540c6191daf7f3944de18226a004c0c5344c0f0 | ef1add715c4bd5f0a8cecdab8aeb38858ecc62cf | refs/heads/main | 2023-08-07T16:42:25.936557 | 2021-09-20T13:53:40 | 2021-09-24T14:42:47 | 408,423,977 | 0 | 0 | Apache-2.0 | 2021-09-20T11:55:41 | 2021-09-20T11:55:41 | null | UTF-8 | C++ | false | false | 4,465 | h | /*
* Copyright 2020 WebAssembly Community Group participants
*
* 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 WABT_INTERP_ISTREAM_H_
#define WABT_INTERP_ISTREAM_H_
#include <cstdint>
#include <vector>
#include <string>
#include "src/common.h"
#include "src/opcode.h"
#include "src/stream.h"
namespace wabt {
namespace interp {
using u8 = uint8_t;
using u16 = uint16_t;
using u32 = uint32_t;
using u64 = uint64_t;
using f32 = float;
using f64 = double;
using Buffer = std::vector<u8>;
using ValueType = wabt::Type;
// Group instructions based on their immediates their operands. This way we can
// simplify instruction decoding, disassembling, and tracing. There is an
// example of an instruction that uses this encoding on the right.
enum class InstrKind {
Imm_0_Op_0, // Nop
Imm_0_Op_1, // i32.eqz
Imm_0_Op_2, // i32.add
Imm_0_Op_3, // select
Imm_Jump_Op_0, // br
Imm_Jump_Op_1, // br_if
Imm_Index_Op_0, // global.get
Imm_Index_Op_1, // global.set
Imm_Index_Op_2, // table.set
Imm_Index_Op_3, // memory.fill
Imm_Index_Op_N, // call
Imm_Index_Index_Op_3, // memory.init
Imm_Index_Index_Op_N, // call_indirect
Imm_Index_Offset_Op_1, // i32.load
Imm_Index_Offset_Op_2, // i32.store
Imm_Index_Offset_Op_3, // i32.atomic.rmw.cmpxchg
Imm_Index_Offset_Lane_Op_2, // v128.load8_lane
Imm_I32_Op_0, // i32.const
Imm_I64_Op_0, // i64.const
Imm_F32_Op_0, // f32.const
Imm_F64_Op_0, // f64.const
Imm_I32_I32_Op_0, // drop_keep
Imm_I8_Op_1, // i32x4.extract_lane
Imm_I8_Op_2, // i32x4.replace_lane
Imm_V128_Op_0, // v128.const
Imm_V128_Op_2, // i8x16.shuffle
};
struct Instr {
Opcode op;
InstrKind kind;
union {
u8 imm_u8;
u32 imm_u32;
f32 imm_f32;
u64 imm_u64;
f64 imm_f64;
v128 imm_v128;
struct { u32 fst, snd; } imm_u32x2;
struct { u32 fst, snd; u8 idx; } imm_u32x2_u8;
};
};
class Istream {
public:
using SerializedOpcode = u32; // TODO: change to u16
using Offset = u32;
static const Offset kInvalidOffset = ~0;
// Each br_table entry is made up of two instructions:
//
// interp_drop_keep $drop $keep
// br $label
//
// Each opcode is a SerializedOpcode, and each immediate is a u32.
static const Offset kBrTableEntrySize =
sizeof(SerializedOpcode) * 2 + 3 * sizeof(u32);
// Emit API.
void Emit(u32);
void Emit(Opcode::Enum);
void Emit(Opcode::Enum, u8);
void Emit(Opcode::Enum, u32);
void Emit(Opcode::Enum, u64);
void Emit(Opcode::Enum, v128);
void Emit(Opcode::Enum, u32, u32);
void Emit(Opcode::Enum, u32, u32, u8);
void EmitDropKeep(u32 drop, u32 keep);
Offset EmitFixupU32();
void ResolveFixupU32(Offset);
Offset end() const;
// Read API.
Instr Read(Offset*) const;
// Disassemble/Trace API.
// TODO separate out disassembly/tracing?
struct TraceSource {
virtual ~TraceSource() {}
// Whatever content should go before the instruction on each line, e.g. the
// call stack size, value stack size, and istream offset.
virtual std::string Header(Offset) = 0;
virtual std::string Pick(Index, Instr) = 0;
};
struct DisassemblySource : TraceSource {
std::string Header(Offset) override;
std::string Pick(Index, Instr) override;
};
void Disassemble(Stream*) const;
Offset Disassemble(Stream*, Offset) const;
void Disassemble(Stream*, Offset from, Offset to) const;
Offset Trace(Stream*, Offset, TraceSource*) const;
private:
template <typename T>
void WABT_VECTORCALL EmitAt(Offset, T val);
template <typename T>
void WABT_VECTORCALL EmitInternal(T val);
template <typename T>
T WABT_VECTORCALL ReadAt(Offset*) const;
Buffer data_;
};
} // namespace interp
} // namespace wabt
#endif // WABT_INTERP_ISTREAM_H_
| [
"noreply@github.com"
] | noreply@github.com |
6127b57219e582f88606123718349c25d9576d2a | 03f037d0f6371856ede958f0c9d02771d5402baf | /graphics/VTK-7.0.0/Imaging/Core/vtkImageCast.h | 09827643bdd2dd97d69e5380e2688c91c3a8079c | [
"BSD-3-Clause"
] | permissive | hlzz/dotfiles | b22dc2dc5a9086353ed6dfeee884f7f0a9ddb1eb | 0591f71230c919c827ba569099eb3b75897e163e | refs/heads/master | 2021-01-10T10:06:31.018179 | 2016-09-27T08:13:18 | 2016-09-27T08:13:18 | 55,040,954 | 4 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,576 | h | /*=========================================================================
Program: Visualization Toolkit
Module: vtkImageCast.h
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved.
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
// .NAME vtkImageCast - Image Data type Casting Filter
// .SECTION Description
// vtkImageCast filter casts the input type to match the output type in
// the image processing pipeline. The filter does nothing if the input
// already has the correct type. To specify the "CastTo" type,
// use "SetOutputScalarType" method.
//
// .SECTION Warning
// As vtkImageCast only casts values without rescaling them, its use is not
// recommented. vtkImageShiftScale is the recommented way to change the type
// of an image data.
// .SECTION See Also
// vtkImageThreshold vtkImageShiftScale
#ifndef vtkImageCast_h
#define vtkImageCast_h
#include "vtkImagingCoreModule.h" // For export macro
#include "vtkThreadedImageAlgorithm.h"
class VTKIMAGINGCORE_EXPORT vtkImageCast : public vtkThreadedImageAlgorithm
{
public:
static vtkImageCast *New();
vtkTypeMacro(vtkImageCast,vtkThreadedImageAlgorithm);
void PrintSelf(ostream& os, vtkIndent indent);
// Description:
// Set the desired output scalar type to cast to.
vtkSetMacro(OutputScalarType,int);
vtkGetMacro(OutputScalarType,int);
void SetOutputScalarTypeToFloat(){this->SetOutputScalarType(VTK_FLOAT);};
void SetOutputScalarTypeToDouble(){this->SetOutputScalarType(VTK_DOUBLE);};
void SetOutputScalarTypeToInt(){this->SetOutputScalarType(VTK_INT);};
void SetOutputScalarTypeToUnsignedInt()
{this->SetOutputScalarType(VTK_UNSIGNED_INT);};
void SetOutputScalarTypeToLong(){this->SetOutputScalarType(VTK_LONG);};
void SetOutputScalarTypeToUnsignedLong()
{this->SetOutputScalarType(VTK_UNSIGNED_LONG);};
void SetOutputScalarTypeToShort(){this->SetOutputScalarType(VTK_SHORT);};
void SetOutputScalarTypeToUnsignedShort()
{this->SetOutputScalarType(VTK_UNSIGNED_SHORT);};
void SetOutputScalarTypeToUnsignedChar()
{this->SetOutputScalarType(VTK_UNSIGNED_CHAR);};
void SetOutputScalarTypeToChar()
{this->SetOutputScalarType(VTK_CHAR);};
// Description:
// When the ClampOverflow flag is on, the data is thresholded so that
// the output value does not exceed the max or min of the data type.
// Clamping is safer because otherwise you might invoke undefined
// behavior (and may crash) if the type conversion is out of range
// of the data type. On the other hand, clamping is slower.
// By default ClampOverflow is off.
vtkSetMacro(ClampOverflow, int);
vtkGetMacro(ClampOverflow, int);
vtkBooleanMacro(ClampOverflow, int);
protected:
vtkImageCast();
~vtkImageCast() {}
int ClampOverflow;
int OutputScalarType;
virtual int RequestInformation (vtkInformation *, vtkInformationVector**, vtkInformationVector *);
void ThreadedExecute (vtkImageData *inData, vtkImageData *outData,
int ext[6], int id);
private:
vtkImageCast(const vtkImageCast&); // Not implemented.
void operator=(const vtkImageCast&); // Not implemented.
};
#endif
| [
"shentianweipku@gmail.com"
] | shentianweipku@gmail.com |
bb68fb2caa4a064d753e0fab0c7e847c5326c6be | 626539c57d1538365068acdf57b33a18e72d619f | /Exercise3/PointerEx5.cpp | 02ab7a01b63759fa168b196fedd5bc5c4b0d2951 | [] | no_license | flyingcrackers/TrainingCpp | 58168f59d4716c8affe17da0c4349203cc3ba872 | a217beb22981a369d159005618c9f68384edc5a4 | refs/heads/master | 2020-06-17T17:16:03.533314 | 2019-07-23T09:40:28 | 2019-07-23T09:40:28 | 195,989,143 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 449 | cpp | #include <iostream>
void AddTwoNum(int&, int&);
int main() {
int firstNum = 0;
int secondNum = 0;
std::cout << "Input the first number : ";
std::cin >> firstNum;
std::cout << "Input the second number : ";
std::cin >> secondNum;
AddTwoNum(firstNum, secondNum);
system("pause");
}
void AddTwoNum(int& fNum, int& sNum) {
int sum = 0;
sum = fNum + sNum;
std::cout << "The sum of " << fNum << " and " << sNum << " is " << sum << "\n";
}
| [
"noreply@github.com"
] | noreply@github.com |
b3c5f2480bc373977b0a5dc721da4a74e562a479 | 21553f6afd6b81ae8403549467230cdc378f32c9 | /arm/cortex/Spansion/MB9AF13xM/include/arch/reg/bt1.hpp | e3f49daff94caac8b0642871b030f5520098daa0 | [
"LicenseRef-scancode-warranty-disclaimer"
] | no_license | digint/openmptl-reg-arm-cortex | 3246b68dcb60d4f7c95a46423563cab68cb02b5e | 88e105766edc9299348ccc8d2ff7a9c34cddacd3 | refs/heads/master | 2021-07-18T19:56:42.569685 | 2017-10-26T11:11:35 | 2017-10-26T11:11:35 | 108,407,162 | 3 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 9,602 | hpp | /*
* OpenMPTL - C++ Microprocessor Template Library
*
* This program is a derivative representation of a CMSIS System View
* Description (SVD) file, and is subject to the corresponding license
* (see "License.txt" in the parent directory).
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*/
////////////////////////////////////////////////////////////////////////
//
// Import from CMSIS-SVD: "Spansion/MB9AF13xM.svd"
//
// name: MB9AF13xM
// version: 1.7
// description: MB9AF13xM
// --------------------------------------------------------------------
//
// C++ Header file, containing architecture specific register
// declarations for use in OpenMPTL. It has been converted directly
// from a CMSIS-SVD file.
//
// https://digint.ch/openmptl
// https://github.com/posborne/cmsis-svd
//
#ifndef ARCH_REG_BT1_HPP_INCLUDED
#define ARCH_REG_BT1_HPP_INCLUDED
#warning "using untested register declarations"
#include <register.hpp>
namespace mptl {
/**
* Base Timer 0
*
* (derived from: BT0)
*/
struct BT1
{
static constexpr reg_addr_t base_addr = 0x40025040;
/**
* Timer Control Register
*/
struct PWM_TMCR
: public reg< uint16_t, base_addr + 0x0c, rw, 0x0000 >
{
using type = reg< uint16_t, base_addr + 0x0c, rw, 0x0000 >;
using CKS2_0 = regbits< type, 12, 3 >; /**< Count clock selection bit */
using RTGEN = regbits< type, 11, 1 >; /**< Restart enable bit */
using PMSK = regbits< type, 10, 1 >; /**< Pulse output mask bit */
using EGS = regbits< type, 8, 2 >; /**< Trigger input edge selection bits */
using FMD = regbits< type, 4, 3 >; /**< Timer function selection bits */
using OSEL = regbits< type, 3, 1 >; /**< Output polarity specification bit */
using MDSE = regbits< type, 2, 1 >; /**< Mode selection bit */
using CTEN = regbits< type, 1, 1 >; /**< Count operation enable bit */
using STRG = regbits< type, 0, 1 >; /**< Software trigger bit */
};
/**
* Timer Control Register 2
*/
struct PWM_TMCR2
: public reg< uint8_t, base_addr + 0x11, rw, 0x00 >
{
using type = reg< uint8_t, base_addr + 0x11, rw, 0x00 >;
using CKS3 = regbits< type, 0, 1 >; /**< Count clock selection bit */
};
/**
* Status Control Register
*/
struct PWM_STC
: public reg< uint8_t, base_addr + 0x10, rw, 0x00 >
{
using type = reg< uint8_t, base_addr + 0x10, rw, 0x00 >;
using TGIE = regbits< type, 6, 1 >; /**< Trigger interrupt request enable bit */
using DTIE = regbits< type, 5, 1 >; /**< Duty match interrupt request enable bit */
using UDIE = regbits< type, 4, 1 >; /**< Underflow interrupt request enable bit */
using TGIR = regbits< type, 2, 1 >; /**< Trigger interrupt request bit */
using DTIR = regbits< type, 1, 1 >; /**< Duty match interrupt request bit */
using UDIR = regbits< type, 0, 1 >; /**< Underflow interrupt request bit */
};
/**
* PWM Cycle Set Register
*/
struct PWM_PCSR
: public reg< uint16_t, base_addr + 0x00, rw, 0x0000 >
{
};
/**
* PWM Duty Set Register
*/
struct PWM_PDUT
: public reg< uint16_t, base_addr + 0x04, rw, 0x0000 >
{
};
/**
* Timer Register
*/
struct PWM_TMR
: public reg< uint16_t, base_addr + 0x08, ro, 0x0000 >
{
};
/**
* Timer Control Register
*/
struct PPG_TMCR
: public reg< uint16_t, base_addr + 0x0c, rw, 0x0000 >
{
using type = reg< uint16_t, base_addr + 0x0c, rw, 0x0000 >;
using CKS2_0 = regbits< type, 12, 3 >; /**< Count clock selection bit */
using RTGEN = regbits< type, 11, 1 >; /**< Restart enable bit */
using PMSK = regbits< type, 10, 1 >; /**< Pulse output mask bit */
using EGS = regbits< type, 8, 2 >; /**< Trigger input edge selection bits */
using FMD = regbits< type, 4, 3 >; /**< Timer function selection bits */
using OSEL = regbits< type, 3, 1 >; /**< Output polarity specification bit */
using MDSE = regbits< type, 2, 1 >; /**< Mode selection bit */
using CTEN = regbits< type, 1, 1 >; /**< Count operation enable bit */
using STRG = regbits< type, 0, 1 >; /**< Software trigger bit */
};
/**
* Timer Control Register 2
*/
struct PPG_TMCR2
: public reg< uint8_t, base_addr + 0x11, rw, 0x00 >
{
using type = reg< uint8_t, base_addr + 0x11, rw, 0x00 >;
using CKS3 = regbits< type, 1, 1 >; /**< Count clock selection bit */
};
/**
* Status Control Register
*/
struct PPG_STC
: public reg< uint8_t, base_addr + 0x10, rw, 0x00 >
{
using type = reg< uint8_t, base_addr + 0x10, rw, 0x00 >;
using TGIE = regbits< type, 6, 1 >; /**< Trigger interrupt request enable bit */
using UDIE = regbits< type, 4, 1 >; /**< Underflow interrupt request enable bit */
using TGIR = regbits< type, 2, 1 >; /**< Trigger interrupt request bit */
using UDIR = regbits< type, 0, 1 >; /**< Underflow interrupt request bit */
};
/**
* LOW Width Reload Register
*/
struct PPG_PRLL
: public reg< uint16_t, base_addr + 0x00, rw, 0x0000 >
{
};
/**
* HIGH Width Reload Register
*/
struct PPG_PRLH
: public reg< uint16_t, base_addr + 0x04, rw, 0x0000 >
{
};
/**
* Timer Register
*/
struct PPG_TMR
: public reg< uint16_t, base_addr + 0x08, ro, 0x0000 >
{
};
/**
* Timer Control Register
*/
struct RT_TMCR
: public reg< uint16_t, base_addr + 0x0c, rw, 0x0000 >
{
using type = reg< uint16_t, base_addr + 0x0c, rw, 0x0000 >;
using CKS2_0 = regbits< type, 12, 3 >; /**< Count clock selection bit */
using EGS = regbits< type, 8, 2 >; /**< Trigger input edge selection bits */
using T32 = regbits< type, 7, 1 >; /**< 32-bit timer selection bit */
using FMD = regbits< type, 4, 3 >; /**< Timer function selection bits */
using OSEL = regbits< type, 3, 1 >; /**< Output polarity specification bit */
using MDSE = regbits< type, 2, 1 >; /**< Mode selection bit */
using CTEN = regbits< type, 1, 1 >; /**< Timer enable bit */
using STRG = regbits< type, 0, 1 >; /**< Software trigger bit */
};
/**
* Timer Control Register 2
*/
struct RT_TMCR2
: public reg< uint8_t, base_addr + 0x11, rw, 0x00 >
{
using type = reg< uint8_t, base_addr + 0x11, rw, 0x00 >;
using CKS3 = regbits< type, 0, 1 >; /**< Count clock selection bit */
};
/**
* Status Control Register
*/
struct RT_STC
: public reg< uint8_t, base_addr + 0x10, rw, 0x00 >
{
using type = reg< uint8_t, base_addr + 0x10, rw, 0x00 >;
using TGIE = regbits< type, 6, 1 >; /**< Trigger interrupt request enable bit */
using UDIE = regbits< type, 4, 1 >; /**< Underflow interrupt request enable bit */
using TGIR = regbits< type, 2, 1 >; /**< Trigger interrupt request bit */
using UDIR = regbits< type, 0, 1 >; /**< Underflow interrupt request bit */
};
/**
* PWM Cycle Set Register
*/
struct RT_PCSR
: public reg< uint16_t, base_addr + 0x00, rw, 0x0000 >
{
};
/**
* Timer Register
*/
struct RT_TMR
: public reg< uint16_t, base_addr + 0x08, ro, 0x0000 >
{
};
/**
* Timer Control Register
*/
struct PWC_TMCR
: public reg< uint16_t, base_addr + 0x0c, rw, 0x0000 >
{
using type = reg< uint16_t, base_addr + 0x0c, rw, 0x0000 >;
using CKS2_0 = regbits< type, 12, 3 >; /**< Count clock selection bit */
using EGS = regbits< type, 8, 3 >; /**< Measurement edge selection bits */
using T32 = regbits< type, 7, 1 >; /**< 32-bit timer selection bit */
using FMD = regbits< type, 4, 3 >; /**< Timer function selection bits */
using MDSE = regbits< type, 2, 1 >; /**< Mode selection bit */
using CTEN = regbits< type, 1, 1 >; /**< Timer enable bit */
};
/**
* Timer Control Register 2
*/
struct PWC_TMCR2
: public reg< uint8_t, base_addr + 0x11, rw, 0x00 >
{
using type = reg< uint8_t, base_addr + 0x11, rw, 0x00 >;
using CKS3 = regbits< type, 0, 1 >; /**< Count clock selection bit */
};
/**
* Status Control Register
*/
struct PWC_STC
: public reg< uint8_t, base_addr + 0x10, rw, 0x00 >
{
using type = reg< uint8_t, base_addr + 0x10, rw, 0x00 >;
using ERR = regbits< type, 7, 1 >; /**< Error flag bit */
using EDIE = regbits< type, 6, 1 >; /**< Measurement completion interrupt request enable bit */
using OVIE = regbits< type, 4, 1 >; /**< Overflow interrupt request enable bit */
using EDIR = regbits< type, 2, 1 >; /**< Measurement completion interrupt request bit */
using OVIR = regbits< type, 0, 1 >; /**< Overflow interrupt request bit */
};
/**
* Data Buffer Register
*/
struct PWC_DTBF
: public reg< uint16_t, base_addr + 0x04, ro, 0x0000 >
{
};
};
} // namespace mptl
#endif // ARCH_REG_BT1_HPP_INCLUDED
| [
"axel@tty0.ch"
] | axel@tty0.ch |
aae19bed957f0069b94b370bbc20e701ed114070 | bfd4fcdf4ae18050ded4ff951ac2f148ea60b40d | /NeuralNet/NeuralNetWrapper/NeuralNetWrapper.cpp | 1f44c7019963da81fece8b2272dd2f5aa675e626 | [
"Apache-2.0"
] | permissive | kusa-mochi/neural-net | af9595c87d6e94f0101119dd3a17f54b6a47c97e | be8ed640b01b403d0bc2ccb79d32cec83741d824 | refs/heads/master | 2016-09-12T01:39:26.868410 | 2016-06-05T13:26:19 | 2016-06-05T13:26:19 | 55,614,677 | 0 | 0 | null | null | null | null | SHIFT_JIS | C++ | false | false | 101 | cpp | // これは メイン DLL ファイルです。
#include "stdafx.h"
#include "NeuralNetWrapper.h"
| [
"R Fuji"
] | R Fuji |
97884251369ed80764cbf2591c200d4ec9f1696c | 1f49fe9fe41213c85adbab247c3180226fae7430 | /Source/Tangram/PPDrawManager.cpp | 7e59aed2588bca1bdc53d465596aed6ce939f910 | [] | no_license | kafka-yu/Core | de34fbae61cf89be261b3fc75d78b83384e788c8 | cbd3aa19eeaea2fd4df367f67cecb41dbb25e7dd | refs/heads/master | 2020-04-19T23:30:30.759725 | 2018-12-29T07:12:20 | 2018-12-29T07:12:20 | null | 0 | 0 | null | null | null | null | WINDOWS-1251 | C++ | false | false | 47,624 | cpp | /********************************************************************************
* Tangram Library - version 10.0.0 *
*********************************************************************************
* Copyright (C) 2002-2018 by Tangram Team. All Rights Reserved. *
*
* THIS SOURCE FILE IS THE PROPERTY OF TANGRAM TEAM AND IS NOT TO
* BE RE-DISTRIBUTED BY ANY MEANS WHATSOEVER WITHOUT THE EXPRESSED
* WRITTEN CONSENT OF TANGRAM TEAM.
*
* THIS SOURCE CODE CAN ONLY BE USED UNDER THE TERMS AND CONDITIONS
* OUTLINED IN THE TANGRAM LICENSE AGREEMENT.TANGRAM TEAM
* GRANTS TO YOU (ONE SOFTWARE DEVELOPER) THE LIMITED RIGHT TO USE
* THIS SOFTWARE ON A SINGLE COMPUTER.
*
* CONTACT INFORMATION:
* mailto:tangramteam@outlook.com
* https://www.tangramteam.com
*
********************************************************************************/
#include "stdafx.h"
#include "PPDrawManager.h"
#pragma warning(push, 3)
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
/*
DIBs use RGBQUAD format:
0xbb 0xgg 0xrr 0x00
*/
#ifndef CLR_TO_RGBQUAD
#define CLR_TO_RGBQUAD(clr) (RGB(GetBValue(clr), GetGValue(clr), GetRValue(clr)))
#endif
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
CPPDrawManager::CPPDrawManager()
{
}
CPPDrawManager::~CPPDrawManager()
{
}
void CPPDrawManager::GetSizeOfIcon(HICON hIcon, LPSIZE pSize) const
{
pSize->cx = 0;
pSize->cy = 0;
if (hIcon != NULL)
{
ICONINFO ii;
// Gets icon dimension
::ZeroMemory(&ii, sizeof(ICONINFO));
if (::GetIconInfo(hIcon, &ii))
{
pSize->cx = (DWORD)(ii.xHotspot * 2);
pSize->cy = (DWORD)(ii.yHotspot * 2);
//release icon mask bitmaps
if(ii.hbmMask)
::DeleteObject(ii.hbmMask);
if(ii.hbmColor)
::DeleteObject(ii.hbmColor);
} //if
} //if
} //End GetSizeOfIcon
void CPPDrawManager::GetSizeOfBitmap(HBITMAP hBitmap, LPSIZE pSize) const
{
pSize->cx = 0;
pSize->cy = 0;
if (hBitmap != NULL)
{
BITMAP csBitmapSize;
// Get bitmap size
int nRetValue = ::GetObject(hBitmap, sizeof(csBitmapSize), &csBitmapSize);
if (nRetValue)
{
pSize->cx = (DWORD)csBitmapSize.bmWidth;
pSize->cy = (DWORD)csBitmapSize.bmHeight;
} //if
} //if
} //End GetSizeOfBitmap
void CPPDrawManager::AlphaBitBlt(HDC hDestDC, int nDestX, int nDestY, DWORD dwWidth, DWORD dwHeight, HDC hSrcDC, int nSrcX, int nSrcY, int percent /* = 100 */)
{
_ASSERT ((NULL != hDestDC) || (NULL != hSrcDC));
if (percent >= 100)
{
::BitBlt(hDestDC, nDestX, nDestY, dwWidth, dwHeight, hSrcDC, nSrcX, nSrcY, SRCCOPY);
return;
} //if
HDC hTempDC = ::CreateCompatibleDC(hDestDC);
if (NULL == hTempDC)
return;
//Creates Source DIB
LPBITMAPINFO lpbiSrc;
// Fill in the BITMAPINFOHEADER
lpbiSrc = (LPBITMAPINFO) new BYTE[sizeof(BITMAPINFOHEADER)];
lpbiSrc->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
lpbiSrc->bmiHeader.biWidth = dwWidth;
lpbiSrc->bmiHeader.biHeight = dwHeight;
lpbiSrc->bmiHeader.biPlanes = 1;
lpbiSrc->bmiHeader.biBitCount = 32;
lpbiSrc->bmiHeader.biCompression = BI_RGB;
lpbiSrc->bmiHeader.biSizeImage = dwWidth * dwHeight;
lpbiSrc->bmiHeader.biXPelsPerMeter = 0;
lpbiSrc->bmiHeader.biYPelsPerMeter = 0;
lpbiSrc->bmiHeader.biClrUsed = 0;
lpbiSrc->bmiHeader.biClrImportant = 0;
COLORREF* pSrcBits = NULL;
HBITMAP hSrcDib = CreateDIBSection (
hSrcDC, lpbiSrc, DIB_RGB_COLORS, (void **)&pSrcBits,
NULL, NULL);
if ((NULL != hSrcDib) && (NULL != pSrcBits))
{
HBITMAP hOldTempBmp = (HBITMAP)::SelectObject (hTempDC, hSrcDib);
::BitBlt (hTempDC, 0, 0, dwWidth, dwHeight, hSrcDC, nSrcX, nSrcY, SRCCOPY);
::SelectObject (hTempDC, hOldTempBmp);
//Creates Destination DIB
LPBITMAPINFO lpbiDest;
// Fill in the BITMAPINFOHEADER
lpbiDest = (LPBITMAPINFO) new BYTE[sizeof(BITMAPINFOHEADER)];
lpbiDest->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
lpbiDest->bmiHeader.biWidth = dwWidth;
lpbiDest->bmiHeader.biHeight = dwHeight;
lpbiDest->bmiHeader.biPlanes = 1;
lpbiDest->bmiHeader.biBitCount = 32;
lpbiDest->bmiHeader.biCompression = BI_RGB;
lpbiDest->bmiHeader.biSizeImage = dwWidth * dwHeight;
lpbiDest->bmiHeader.biXPelsPerMeter = 0;
lpbiDest->bmiHeader.biYPelsPerMeter = 0;
lpbiDest->bmiHeader.biClrUsed = 0;
lpbiDest->bmiHeader.biClrImportant = 0;
COLORREF* pDestBits = NULL;
HBITMAP hDestDib = CreateDIBSection (
hDestDC, lpbiDest, DIB_RGB_COLORS, (void **)&pDestBits,
NULL, NULL);
if ((NULL != hDestDib) && (NULL != pDestBits))
{
::SelectObject (hTempDC, hDestDib);
::BitBlt (hTempDC, 0, 0, dwWidth, dwHeight, hDestDC, nDestX, nDestY, SRCCOPY);
::SelectObject (hTempDC, hOldTempBmp);
double src_darken = (double)percent / 100.0;
double dest_darken = 1.0 - src_darken;
for (DWORD pixel = 0; pixel < dwWidth * dwHeight; pixel++, pSrcBits++, pDestBits++)
{
*pDestBits = PixelAlpha(*pSrcBits, src_darken, *pDestBits, dest_darken);
} //for
::SelectObject (hTempDC, hDestDib);
::BitBlt (hDestDC, nDestX, nDestY, dwWidth, dwHeight, hTempDC, 0, 0, SRCCOPY);
::SelectObject (hTempDC, hOldTempBmp);
delete [] lpbiDest;
::DeleteObject(hDestDib);
} //if
delete [] lpbiSrc;
::DeleteObject(hSrcDib);
} //if
::DeleteDC(hTempDC);
} //End AlphaBitBlt
void CPPDrawManager::AlphaChannelBitBlt(HDC hDestDC, int nDestX, int nDestY, DWORD dwWidth, DWORD dwHeight, HDC hSrcDC, int nSrcX, int nSrcY)
{
_ASSERT ((NULL != hDestDC) || (NULL != hSrcDC));
HDC hTempDC = ::CreateCompatibleDC(hDestDC);
if (NULL == hTempDC)
return;
//Creates Source DIB
LPBITMAPINFO lpbiSrc;
// Fill in the BITMAPINFOHEADER
lpbiSrc = (LPBITMAPINFO) new BYTE[sizeof(BITMAPINFOHEADER)];
lpbiSrc->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
lpbiSrc->bmiHeader.biWidth = dwWidth;
lpbiSrc->bmiHeader.biHeight = dwHeight;
lpbiSrc->bmiHeader.biPlanes = 1;
lpbiSrc->bmiHeader.biBitCount = 32;
lpbiSrc->bmiHeader.biCompression = BI_RGB;
lpbiSrc->bmiHeader.biSizeImage = dwWidth * dwHeight;
lpbiSrc->bmiHeader.biXPelsPerMeter = 0;
lpbiSrc->bmiHeader.biYPelsPerMeter = 0;
lpbiSrc->bmiHeader.biClrUsed = 0;
lpbiSrc->bmiHeader.biClrImportant = 0;
COLORREF* pSrcBits = NULL;
HBITMAP hSrcDib = CreateDIBSection (
hSrcDC, lpbiSrc, DIB_RGB_COLORS, (void **)&pSrcBits,
NULL, NULL);
if ((NULL != hSrcDib) && (NULL != pSrcBits))
{
HBITMAP hOldTempBmp = (HBITMAP)::SelectObject (hTempDC, hSrcDib);
::BitBlt (hTempDC, 0, 0, dwWidth, dwHeight, hSrcDC, nSrcX, nSrcY, SRCCOPY);
::SelectObject (hTempDC, hOldTempBmp);
//Creates Destination DIB
LPBITMAPINFO lpbiDest;
// Fill in the BITMAPINFOHEADER
lpbiDest = (LPBITMAPINFO) new BYTE[sizeof(BITMAPINFOHEADER)];
lpbiDest->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
lpbiDest->bmiHeader.biWidth = dwWidth;
lpbiDest->bmiHeader.biHeight = dwHeight;
lpbiDest->bmiHeader.biPlanes = 1;
lpbiDest->bmiHeader.biBitCount = 32;
lpbiDest->bmiHeader.biCompression = BI_RGB;
lpbiDest->bmiHeader.biSizeImage = dwWidth * dwHeight;
lpbiDest->bmiHeader.biXPelsPerMeter = 0;
lpbiDest->bmiHeader.biYPelsPerMeter = 0;
lpbiDest->bmiHeader.biClrUsed = 0;
lpbiDest->bmiHeader.biClrImportant = 0;
COLORREF* pDestBits = NULL;
HBITMAP hDestDib = CreateDIBSection (
hDestDC, lpbiDest, DIB_RGB_COLORS, (void **)&pDestBits,
NULL, NULL);
if ((NULL != hDestDib) && (NULL != pDestBits))
{
::SelectObject (hTempDC, hDestDib);
::BitBlt (hTempDC, 0, 0, dwWidth, dwHeight, hDestDC, nDestX, nDestY, SRCCOPY);
::SelectObject (hTempDC, hOldTempBmp);
double src_darken;
BYTE nAlpha;
for (DWORD pixel = 0; pixel < dwWidth * dwHeight; pixel++, pSrcBits++, pDestBits++)
{
nAlpha = LOBYTE(*pSrcBits >> 24);
src_darken = (double)nAlpha / 255.0;
*pDestBits = PixelAlpha(*pSrcBits, src_darken, *pDestBits, 1.0 - src_darken);
} //for
::SelectObject (hTempDC, hDestDib);
::BitBlt (hDestDC, nDestX, nDestY, dwWidth, dwHeight, hTempDC, 0, 0, SRCCOPY);
::SelectObject (hTempDC, hOldTempBmp);
delete [] lpbiDest;
::DeleteObject(hDestDib);
} //if
delete [] lpbiSrc;
::DeleteObject(hSrcDib);
} //if
::DeleteDC(hTempDC);
} //End of AlphaChannelBitBlt
HBITMAP CPPDrawManager::CreateImageEffect(HBITMAP hBitmap, DWORD dwWidth, DWORD dwHeight, DWORD dwEffect, BOOL bUseMask /* = true */, COLORREF clrMask /* = RGB(255, 0, 255) */, COLORREF clrMono /* = RGB(255, 255, 255) */)
{
HBITMAP hOldSrcBmp = NULL;
HBITMAP hOldResBmp = NULL;
HDC hMainDC = NULL;
HDC hSrcDC = NULL;
HDC hResDC = NULL;
hMainDC = ::GetDC(NULL);
hSrcDC = ::CreateCompatibleDC(hMainDC);
hResDC = ::CreateCompatibleDC(hMainDC);
hOldSrcBmp = (HBITMAP)::SelectObject(hSrcDC, hBitmap);
LPBITMAPINFO lpbi;
// Fill in the BITMAPINFOHEADER
lpbi = (LPBITMAPINFO) new BYTE[sizeof(BITMAPINFOHEADER)];
lpbi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
lpbi->bmiHeader.biWidth = dwWidth;
lpbi->bmiHeader.biHeight = dwHeight;
lpbi->bmiHeader.biPlanes = 1;
lpbi->bmiHeader.biBitCount = 32;
lpbi->bmiHeader.biCompression = BI_RGB;
lpbi->bmiHeader.biSizeImage = dwWidth * dwHeight;
lpbi->bmiHeader.biXPelsPerMeter = 0;
lpbi->bmiHeader.biYPelsPerMeter = 0;
lpbi->bmiHeader.biClrUsed = 0;
lpbi->bmiHeader.biClrImportant = 0;
COLORREF* pBits = NULL;
HBITMAP hDibBmp = CreateDIBSection (
hSrcDC, lpbi, DIB_RGB_COLORS, (void **)&pBits,
NULL, NULL);
if (hDibBmp == NULL || pBits == NULL)
{
delete [] lpbi;
_ASSERT (false);
return NULL;
} //if
hOldResBmp = (HBITMAP)::SelectObject (hResDC, hDibBmp);
::BitBlt (hResDC, 0, 0, dwWidth, dwHeight, hSrcDC, 0, 0, SRCCOPY);
clrMask = CLR_TO_RGBQUAD(clrMask);
clrMono = CLR_TO_RGBQUAD(clrMono);
DWORD dwAlpha;
for (DWORD pixel = 0; pixel < dwWidth * dwHeight; pixel++, *pBits++)
{
COLORREF color = (COLORREF)*pBits;
//ENG: Extract an original alpha value
dwAlpha = color & 0xFF000000;
if (dwAlpha != 0)
m_bIsAlpha = true;
if (bUseMask && (color == clrMask))
{
//This is transparent area
color = RGB(0, 0, 0);
}
else
{
//ENG: Color conversion
if (dwEffect & IMAGE_EFFECT_GRAYEN) color = GrayMirrorColor(color);
if (dwEffect & IMAGE_EFFECT_DARKEN) color = DarkenColor(color, 0.75);
if (dwEffect & IMAGE_EFFECT_LIGHTEN) color = LightenColor(color, 0.25);
if (dwEffect & IMAGE_EFFECT_MONOCHROME) color = clrMono;
} //if
if (dwEffect & IMAGE_EFFECT_INVERT) color = InvertColor(color);
//ENG: Merges a color with an original alpha value
*pBits = (color | dwAlpha);
} //for
::SelectObject(hSrcDC, hOldSrcBmp);
::SelectObject(hResDC, hOldResBmp);
::DeleteDC(hSrcDC);
::DeleteDC(hResDC);
::ReleaseDC(NULL, hMainDC);
delete [] lpbi;
return hDibBmp;
} //End CreateImageEffect
//----------------------------------------------------------
// CPPDrawManager::GrayMirrorColor()
// Graying color in RGBQUAD format
//----------------------------------------------------------
// Parameter:
// clrColor - RGBQUAD value from DIB
// Return value:
// A grayed color in the RGBQUAD format
//----------------------------------------------------------
COLORREF CPPDrawManager::GrayMirrorColor(COLORREF clrColor)
{
BYTE nGrayColor = (BYTE)((GetBValue(clrColor) * 0.299) + (GetGValue(clrColor) * 0.587) + (GetRValue(clrColor) * 0.114));
return RGB(nGrayColor, nGrayColor, nGrayColor);
} //End of GrayMirrorColor
COLORREF CPPDrawManager::GrayColor(COLORREF clrColor)
{
BYTE nGrayColor = (BYTE)((GetRValue(clrColor) * 0.299) + (GetGValue(clrColor) * 0.587) + (GetBValue(clrColor) * 0.114));
return RGB(nGrayColor, nGrayColor, nGrayColor);
} //End GrayColor
COLORREF CPPDrawManager::InvertColor(COLORREF clrColor)
{
return RGB(255 - GetRValue(clrColor), 255 - GetGValue(clrColor), 255 - GetBValue(clrColor));
} //End InvertColor
COLORREF CPPDrawManager::DarkenColor(COLORREF clrColor, double darken)
{
if (darken >= 0.0 && darken < 1.0)
{
BYTE color_r, color_g, color_b;
color_r = (BYTE)(GetRValue(clrColor) * darken);
color_g = (BYTE)(GetGValue(clrColor) * darken);
color_b = (BYTE)(GetBValue(clrColor) * darken);
clrColor = RGB(color_r, color_g, color_b);
} //if
return clrColor;
} //End DarkenColor
COLORREF CPPDrawManager::LightenColor(COLORREF clrColor, double lighten)
{
if (lighten > 0.0 && lighten <= 1.0)
{
BYTE color_r, color_g, color_b;
lighten += 1.0;
color_r = (BYTE)min((DWORD)GetRValue(clrColor) * lighten, 255.0);
color_g = (BYTE)min((DWORD)GetGValue(clrColor) * lighten, 255.0);
color_b = (BYTE)min((DWORD)GetBValue(clrColor) * lighten, 255.0);
clrColor = RGB(color_r, color_g, color_b);
/*
lighten *= 255
color_r = (BYTE)max(0, min(255, (int)((color_r - 128) * 2.0 + 128 + lighten)));
color_g = (BYTE)max(0, min(255, (int)((color_g - 128) * 2.0 + 128 + lighten)));
color_b = (BYTE)max(0, min(255, (int)((color_b - 128) * 2.0 + 128 + lighten)));
clrColor = RGB(color_r, color_g, color_b);
*/
} //if
return clrColor;
} //End LightenColor
COLORREF CPPDrawManager::PixelAlpha(COLORREF clrSrc, double src_darken, COLORREF clrDest, double dest_darken)
{
return RGB (GetRValue (clrSrc) * src_darken + GetRValue (clrDest) * dest_darken,
GetGValue (clrSrc) * src_darken + GetGValue (clrDest) * dest_darken,
GetBValue (clrSrc) * src_darken + GetBValue (clrDest) * dest_darken);
} //End PixelAlpha
HICON CPPDrawManager::StretchIcon(HICON hIcon, DWORD dwWidth, DWORD dwHeight)
{
HICON hStretchedIcon = NULL;
HDC hMainDC = NULL;
HDC hSrcDC = NULL;
HDC hDestDC = NULL;
BITMAP bmp;
HBITMAP hOldSrcBitmap = NULL;
HBITMAP hOldDestBitmap = NULL;
ICONINFO csOriginal, csStretched;
memset(&csStretched, 0, sizeof(csStretched)); // +++hd
if (!::GetIconInfo(hIcon, &csOriginal))
return false;
hMainDC = ::GetDC(NULL);
hSrcDC = ::CreateCompatibleDC(hMainDC);
hDestDC = ::CreateCompatibleDC(hMainDC);
if ((NULL == hMainDC) || (NULL == hSrcDC) || (NULL == hDestDC))
return NULL;
if (::GetObject(csOriginal.hbmColor, sizeof(BITMAP), &bmp))
{
DWORD dwWidthOrg = csOriginal.xHotspot * 2;
DWORD dwHeightOrg = csOriginal.yHotspot * 2;
csStretched.hbmColor = ::CreateBitmap(dwWidth, dwHeight, bmp.bmPlanes, bmp.bmBitsPixel, NULL);
if (NULL != csStretched.hbmColor)
{
hOldSrcBitmap = (HBITMAP)::SelectObject(hSrcDC, csOriginal.hbmColor);
hOldDestBitmap = (HBITMAP)::SelectObject(hDestDC, csStretched.hbmColor);
::StretchBlt(hDestDC, 0, 0, dwWidth, dwHeight, hSrcDC, 0, 0, dwWidthOrg, dwHeightOrg, SRCCOPY);
if (::GetObject(csOriginal.hbmMask, sizeof(BITMAP), &bmp))
{
csStretched.hbmMask = ::CreateBitmap(dwWidth, dwHeight, bmp.bmPlanes, bmp.bmBitsPixel, NULL);
if (NULL != csStretched.hbmMask)
{
::SelectObject(hSrcDC, csOriginal.hbmMask);
::SelectObject(hDestDC, csStretched.hbmMask);
::StretchBlt(hDestDC, 0, 0, dwWidth, dwHeight, hSrcDC, 0, 0, dwWidthOrg, dwHeightOrg, SRCCOPY);
} //if
} //if
::SelectObject(hSrcDC, hOldSrcBitmap);
::SelectObject(hDestDC, hOldDestBitmap);
csStretched.fIcon = true;
hStretchedIcon = ::CreateIconIndirect(&csStretched);
::DeleteObject(csStretched.hbmColor);
::DeleteObject(csStretched.hbmMask);
} //if
} //if
::DeleteObject(csOriginal.hbmColor);
::DeleteObject(csOriginal.hbmMask);
::DeleteDC(hSrcDC);
::DeleteDC(hDestDC);
::ReleaseDC(NULL, hMainDC);
return hStretchedIcon;
} //End StretchIcon
void CPPDrawManager::FillGradient (HDC hDC, LPCRECT lpRect,
COLORREF colorStart, COLORREF colorFinish,
BOOL bHorz/* = true*/)
{
// this will make 2^6 = 64 fountain steps
int nShift = 6;
int nSteps = 1 << nShift;
RECT r2;
r2.top = lpRect->top;
r2.left = lpRect->left;
r2.right = lpRect->right;
r2.bottom = lpRect->bottom;
int nHeight = lpRect->bottom - lpRect->top;
int nWidth = lpRect->right - lpRect->left;
for (int i = 0; i < nSteps; i++)
{
// do a little alpha blending
BYTE bR = (BYTE) ((GetRValue(colorStart) * (nSteps - i) +
GetRValue(colorFinish) * i) >> nShift);
BYTE bG = (BYTE) ((GetGValue(colorStart) * (nSteps - i) +
GetGValue(colorFinish) * i) >> nShift);
BYTE bB = (BYTE) ((GetBValue(colorStart) * (nSteps - i) +
GetBValue(colorFinish) * i) >> nShift);
HBRUSH hBrush = ::CreateSolidBrush(RGB(bR, bG, bB));
// then paint with the resulting color
if (!bHorz)
{
r2.top = lpRect->top + ((i * nHeight) >> nShift);
r2.bottom = lpRect->top + (((i + 1) * nHeight) >> nShift);
if ((r2.bottom - r2.top) > 0)
::FillRect(hDC, &r2, hBrush);
}
else
{
r2.left = lpRect->left + ((i * nWidth) >> nShift);
r2.right = lpRect->left + (((i + 1) * nWidth) >> nShift);
if ((r2.right - r2.left) > 0)
::FillRect(hDC, &r2, hBrush);
} //if
if (NULL != hBrush)
{
::DeleteObject(hBrush);
hBrush = NULL;
} //if
} //for
} //End FillGradient
#ifdef USE_SHADE
void CPPDrawManager::SetShade(LPCRECT lpRect, UINT shadeID /* = 0 */, BYTE granularity /* = 8 */,
BYTE coloring /* = 0 */, COLORREF hicr /* = 0 */, COLORREF midcr /* = 0 */, COLORREF locr /* = 0 */)
{
long sXSize,sYSize,bytes,j,i,k,h;
BYTE *iDst ,*posDst;
sYSize = lpRect->bottom - lpRect->top;
sXSize = lpRect->right - lpRect->left;
m_dNormal.Create(sXSize,sYSize,8); //create the default bitmap
long r,g,b; //build the shaded palette
for(i = 0; i < 129; i++)
{
r=((128-i)*GetRValue(locr)+i*GetRValue(midcr))/128;
g=((128-i)*GetGValue(locr)+i*GetGValue(midcr))/128;
b=((128-i)*GetBValue(locr)+i*GetBValue(midcr))/128;
m_dNormal.SetPaletteIndex((BYTE)i,(BYTE)r,(BYTE)g,(BYTE)b);
} //for
for(i=1;i<129;i++){
r=((128-i)*GetRValue(midcr)+i*GetRValue(hicr))/128;
g=((128-i)*GetGValue(midcr)+i*GetGValue(hicr))/128;
b=((128-i)*GetBValue(midcr)+i*GetBValue(hicr))/128;
m_dNormal.SetPaletteIndex((BYTE)(i+127),(BYTE)r,(BYTE)g,(BYTE)b);
} //for
m_dNormal.BlendPalette(hicr,coloring); //color the palette
bytes = m_dNormal.GetLineWidth();
iDst = m_dNormal.GetBits();
posDst =iDst;
long a,x,y,d,xs,idxmax,idxmin;
int grainx2 = RAND_MAX/(max(1,2*granularity));
idxmax=255-granularity;
idxmin=granularity;
switch (shadeID)
{
//----------------------------------------------------
case EFFECT_METAL:
m_dNormal.Clear();
// create the strokes
k=40; //stroke granularity
for(a=0;a<200;a++){
x=rand()/(RAND_MAX/sXSize); //stroke postion
y=rand()/(RAND_MAX/sYSize); //stroke position
xs=rand()/(RAND_MAX/min(sXSize,sYSize))/2; //stroke lenght
d=rand()/(RAND_MAX/k); //stroke color
for(i=0;i<xs;i++){
if (((x-i)>0)&&((y+i)<sYSize))
m_dNormal.SetPixelIndex(x-i,y+i,(BYTE)d);
if (((x+i)<sXSize)&&((y-i)>0))
m_dNormal.SetPixelIndex(sXSize-x+i,y-i,(BYTE)d);
} //for
} //for
//blend strokes with SHS_DIAGONAL
posDst =iDst;
a=(idxmax-idxmin-k)/2;
for(i = 0; i < sYSize; i++) {
for(j = 0; j < sXSize; j++) {
d=posDst[j]+((a*i)/sYSize+(a*(sXSize-j))/sXSize);
posDst[j]=(BYTE)d;
posDst[j]+=rand()/grainx2;
} //for
posDst+=bytes;
} //for
break;
//----------------------------------------------------
case EFFECT_HARDBUMP: //
//set horizontal bump
for(i = 0; i < sYSize; i++) {
k=(255*i/sYSize)-127;
k=(k*(k*k)/128)/128;
k=(k*(128-granularity*2))/128+128;
for(j = 0; j < sXSize; j++) {
posDst[j]=(BYTE)k;
posDst[j]+=rand()/grainx2-granularity;
} //for
posDst+=bytes;
} //for
//set vertical bump
d=min(16,sXSize/6); //max edge=16
a=sYSize*sYSize/4;
posDst =iDst;
for(i = 0; i < sYSize; i++) {
y=i-sYSize/2;
for(j = 0; j < sXSize; j++) {
x=j-sXSize/2;
xs=sXSize/2-d+(y*y*d)/a;
if (x>xs) posDst[j]=(BYTE)idxmin+(BYTE)(((sXSize-j)*128)/d);
if ((x+xs)<0) posDst[j]=(BYTE)idxmax-(BYTE)((j*128)/d);
posDst[j]+=rand()/grainx2-granularity;
} //for
posDst+=bytes;
} //for
break;
//----------------------------------------------------
case EFFECT_SOFTBUMP: //
for(i = 0; i < sYSize; i++) {
h=(255*i/sYSize)-127;
for(j = 0; j < sXSize; j++) {
k=(255*(sXSize-j)/sXSize)-127;
k=(h*(h*h)/128)/128+(k*(k*k)/128)/128;
k=k*(128-granularity)/128+128;
if (k<idxmin) k=idxmin;
if (k>idxmax) k=idxmax;
posDst[j]=(BYTE)k;
posDst[j]+=rand()/grainx2-granularity;
} //for
posDst+=bytes;
} //for
break;
//----------------------------------------------------
case EFFECT_VBUMP: //
for(j = 0; j < sXSize; j++) {
k=(255*(sXSize-j)/sXSize)-127;
k=(k*(k*k)/128)/128;
k=(k*(128-granularity))/128+128;
for(i = 0; i < sYSize; i++) {
posDst[j+i*bytes]=(BYTE)k;
posDst[j+i*bytes]+=rand()/grainx2-granularity;
} //for
} //for
break;
//----------------------------------------------------
case EFFECT_HBUMP: //
for(i = 0; i < sYSize; i++) {
k=(255*i/sYSize)-127;
k=(k*(k*k)/128)/128;
k=(k*(128-granularity))/128+128;
for(j = 0; j < sXSize; j++) {
posDst[j]=(BYTE)k;
posDst[j]+=rand()/grainx2-granularity;
} //for
posDst+=bytes;
} //for
break;
//----------------------------------------------------
case EFFECT_DIAGSHADE: //
a=(idxmax-idxmin)/2;
for(i = 0; i < sYSize; i++) {
for(j = 0; j < sXSize; j++) {
posDst[j]=(BYTE)(idxmin+a*i/sYSize+a*(sXSize-j)/sXSize);
posDst[j]+=rand()/grainx2-granularity;
} //for
posDst+=bytes;
} //for
break;
//----------------------------------------------------
case EFFECT_HSHADE: //
a=idxmax-idxmin;
for(i = 0; i < sYSize; i++) {
k=a*i/sYSize+idxmin;
for(j = 0; j < sXSize; j++) {
posDst[j]=(BYTE)k;
posDst[j]+=rand()/grainx2-granularity;
} //for
posDst+=bytes;
} //for
break;
//----------------------------------------------------
case EFFECT_VSHADE: //:
a=idxmax-idxmin;
for(j = 0; j < sXSize; j++) {
k=a*(sXSize-j)/sXSize+idxmin;
for(i = 0; i < sYSize; i++) {
posDst[j+i*bytes]=(BYTE)k;
posDst[j+i*bytes]+=rand()/grainx2-granularity;
} //for
} //for
break;
//----------------------------------------------------
case EFFECT_NOISE:
for(i = 0; i < sYSize; i++) {
for(j = 0; j < sXSize; j++) {
posDst[j]=128+rand()/grainx2-granularity;
} //for
posDst+=bytes;
} //for
} //switch
//----------------------------------------------------
} //End SetShade
#endif
void CPPDrawManager::FillEffect(HDC hDC, DWORD dwEffect, LPCRECT lpRect, COLORREF clrBegin, COLORREF clrMid /* = 0 */, COLORREF clrEnd /* = 0 */, BYTE granularity /* = 0 */, BYTE coloring /* = 0 */)
{
HBRUSH hBrush = NULL;
RECT rect;
rect.left = lpRect->left;
rect.top = lpRect->top;
rect.right = lpRect->right;
rect.bottom = lpRect->bottom;
int nHeight = rect.bottom - rect.top;
int nWidth = rect.right - rect.left;
switch (dwEffect)
{
default:
hBrush = ::CreateSolidBrush(clrBegin);
::FillRect(hDC, lpRect, hBrush);
break;
case EFFECT_HGRADIENT:
FillGradient(hDC, lpRect, clrBegin, clrEnd, true);
break;
case EFFECT_VGRADIENT:
FillGradient(hDC, lpRect, clrBegin, clrEnd, false);
break;
case EFFECT_HCGRADIENT:
rect.right = rect.left + nWidth / 2;
FillGradient(hDC, &rect, clrBegin, clrEnd, true);
rect.left = rect.right;
rect.right = lpRect->right;
FillGradient(hDC, &rect, clrEnd, clrBegin, true);
break;
case EFFECT_3HGRADIENT:
rect.right = rect.left + nWidth / 2;
FillGradient(hDC, &rect, clrBegin, clrMid, true);
rect.left = rect.right;
rect.right = lpRect->right;
FillGradient(hDC, &rect, clrMid, clrEnd, true);
break;
case EFFECT_VCGRADIENT:
rect.bottom = rect.top + nHeight / 2;
FillGradient(hDC, &rect, clrBegin, clrEnd, false);
rect.top = rect.bottom;
rect.bottom = lpRect->bottom;
FillGradient(hDC, &rect, clrEnd, clrBegin, false);
break;
case EFFECT_3VGRADIENT:
rect.bottom = rect.top + nHeight / 2;
FillGradient(hDC, &rect, clrBegin, clrMid, false);
rect.top = rect.bottom;
rect.bottom = lpRect->bottom;
FillGradient(hDC, &rect, clrMid, clrEnd, false);
break;
#ifdef USE_SHADE
case EFFECT_NOISE:
case EFFECT_DIAGSHADE:
case EFFECT_HSHADE:
case EFFECT_VSHADE:
case EFFECT_HBUMP:
case EFFECT_VBUMP:
case EFFECT_SOFTBUMP:
case EFFECT_HARDBUMP:
case EFFECT_METAL:
rect.left = 0;
rect.top = 0;
rect.right = nWidth;
rect.bottom = nHeight;
SetShade(&rect, dwEffect, granularity, coloring, clrBegin, clrMid, clrEnd);
m_dNormal.Draw(hDC, lpRect->left, lpRect->top);
break;
#endif
} //switch
if (NULL != hBrush)
{
::DeleteObject(hBrush);
hBrush = NULL;
} //if
} //End FillEffect
void CPPDrawManager::MultipleCopy(HDC hDestDC, int nDestX, int nDestY, DWORD dwDestWidth, DWORD dwDestHeight,
HDC hSrcDC, int nSrcX, int nSrcY, DWORD dwSrcWidth, DWORD dwSrcHeight)
{
// Horizontal copying
int right, bottom;
int nDestRight = (int)(nDestX + dwDestWidth);
int nDestBottom = (int)(nDestY + dwDestHeight);
for (int x = nDestX; x < nDestRight; x+= dwSrcWidth)
{
right = min (x + (int)dwSrcWidth, nDestRight);
// Vertical copying
for (int y = nDestY; y < nDestBottom; y+= dwSrcHeight)
{
bottom = min (y + (int)dwSrcHeight, nDestBottom);
::BitBlt(hDestDC, x, y, right - x, bottom - y, hSrcDC, nSrcX, nSrcY, SRCCOPY);
} //for
} //for
} //End MultipleCopy
void CPPDrawManager::DrawBitmap(HDC hDC, int x, int y, DWORD dwWidth, DWORD dwHeight, HBITMAP hSrcBitmap,
BOOL bUseMask, COLORREF crMask,
DWORD dwEffect /* = IMAGE_EFFECT_NONE */,
BOOL bShadow /* = false */,
DWORD dwCxShadow /* = PPDRAWMANAGER_SHADOW_XOFFSET */,
DWORD dwCyShadow /* = PPDRAWMANAGER_SHADOW_YOFFSET */,
DWORD dwCxDepth /* = PPDRAWMANAGER_SHADOW_XDEPTH */,
DWORD dwCyDepth /* = PPDRAWMANAGER_SHADOW_YDEPTH */,
COLORREF clrShadow /* = PPDRAWMANAGER_SHADOW_COLOR */)
{
m_bIsAlpha = false;
if (NULL == hSrcBitmap)
return;
SIZE sz;
GetSizeOfBitmap(hSrcBitmap, &sz);
HDC hSrcDC = ::CreateCompatibleDC(hDC);
HDC hDestDC = ::CreateCompatibleDC(hDC);
HBITMAP hBitmapTemp = ::CreateCompatibleBitmap(hDC, dwWidth, dwHeight);
HBITMAP hOldSrcBitmap = (HBITMAP)::SelectObject(hSrcDC, hSrcBitmap);
HBITMAP hOldDestBitmap = (HBITMAP)::SelectObject(hDestDC, hBitmapTemp);
//Scales a bitmap if need
if (((DWORD)sz.cx != dwWidth) || ((DWORD)sz.cy != dwHeight))
::StretchBlt(hDestDC, 0, 0, dwWidth, dwHeight, hSrcDC, 0, 0, sz.cx, sz.cy, SRCCOPY);
else
::BitBlt(hDestDC, 0, 0, dwWidth, dwHeight, hSrcDC, 0, 0, SRCCOPY);
::SelectObject(hDestDC, hOldDestBitmap);
HBITMAP hMaskBmp = CreateImageEffect(hBitmapTemp, dwWidth, dwHeight, IMAGE_EFFECT_MASK, bUseMask, crMask);
HBITMAP hBitmap = CreateImageEffect(hBitmapTemp, dwWidth, dwHeight, dwEffect, bUseMask, crMask, clrShadow);
if (bShadow)
{
if (dwEffect & IMAGE_EFFECT_SHADOW)
{
POINT ptShadow;
ptShadow.x = x + dwCxShadow;
ptShadow.y = y + dwCyShadow;
HBITMAP hShadowBmp = CreateImageEffect(hBitmapTemp, dwWidth, dwHeight, IMAGE_EFFECT_MASK, bUseMask, crMask, InvertColor(clrShadow));
DrawShadow(hDC, ptShadow.x, ptShadow.y, dwWidth, dwHeight, hShadowBmp, dwEffect & IMAGE_EFFECT_GRADIENT_SHADOW, dwCxDepth, dwCyDepth);
::DeleteObject(hShadowBmp);
}
else
{
x += dwCxShadow;
y += dwCyShadow;
} //if
} //if
if (m_bIsAlpha)
{
::SelectObject(hSrcDC, hBitmap);
AlphaChannelBitBlt(hDC, x, y, dwWidth, dwHeight, hSrcDC, 0, 0);
}
else
{
//Merge the image mask with background
::SelectObject(hSrcDC, hMaskBmp);
::BitBlt(hDC, x, y, dwWidth, dwHeight, hSrcDC, 0, 0, SRCAND);
//Draw the image
::SelectObject(hSrcDC, hBitmap);
::BitBlt(hDC, x, y, dwWidth, dwHeight, hSrcDC, 0, 0, SRCPAINT);
}
::SelectObject(hSrcDC, hOldSrcBitmap);
::DeleteDC(hDestDC);
::DeleteDC(hSrcDC);
::DeleteObject(hBitmap);
::DeleteObject(hMaskBmp);
::DeleteObject(hBitmapTemp);
} //End DrawBitmap
void CPPDrawManager::DrawIcon(HDC hDC, int x, int y, DWORD dwWidth, DWORD dwHeight, HICON hSrcIcon,
DWORD dwEffect /* = IMAGE_EFFECT_NONE */,
BOOL bShadow /* = false */,
DWORD dwCxShadow /* = PPDRAWMANAGER_SHADOW_XOFFSET */,
DWORD dwCyShadow /* = PPDRAWMANAGER_SHADOW_YOFFSET */,
DWORD dwCxDepth /* = PPDRAWMANAGER_SHADOW_XDEPTH */,
DWORD dwCyDepth /* = PPDRAWMANAGER_SHADOW_YDEPTH */,
COLORREF clrShadow /* = PPDRAWMANAGER_SHADOW_COLOR */)
{
m_bIsAlpha = false;
if (NULL == hSrcIcon)
return;
SIZE sz;
GetSizeOfIcon(hSrcIcon, &sz);
HICON hIcon = NULL;
if (((DWORD)sz.cx == dwWidth) && ((DWORD)sz.cy == dwHeight))
hIcon = ::CopyIcon(hSrcIcon);
else hIcon = StretchIcon(hSrcIcon, dwWidth, dwHeight);
ICONINFO csOriginal;
if (!::GetIconInfo(hIcon, &csOriginal))
return;
HDC hSrcDC = ::CreateCompatibleDC(hDC);
HBITMAP hBitmap;
if (dwEffect & IMAGE_EFFECT_MONOCHROME)
hBitmap = CreateImageEffect(csOriginal.hbmMask, dwWidth, dwHeight, dwEffect, true, RGB(255, 255, 255), clrShadow);
else
hBitmap = CreateImageEffect(csOriginal.hbmColor, dwWidth, dwHeight, dwEffect, true, RGB(0, 0, 0), clrShadow);
HBITMAP hOldSrcBitmap = (HBITMAP)::SelectObject(hSrcDC, hBitmap);
if (bShadow)
{
if (dwEffect & IMAGE_EFFECT_SHADOW)
{
POINT ptShadow;
ptShadow.x = x + dwCxShadow;
ptShadow.y = y + dwCyShadow;
HBITMAP hShadowBmp = CreateImageEffect(csOriginal.hbmMask, dwWidth, dwHeight, IMAGE_EFFECT_MASK, true, RGB(255, 255, 255), InvertColor(clrShadow));
DrawShadow(hDC, ptShadow.x, ptShadow.y, dwWidth, dwHeight, hShadowBmp, dwEffect & IMAGE_EFFECT_GRADIENT_SHADOW, dwCxDepth, dwCyDepth);
::DeleteObject(hShadowBmp);
}
else
{
x += dwCxShadow;
y += dwCyShadow;
} //if
} //if
if (m_bIsAlpha)
{
// ::SelectObject(hSrcDC, hBitmap);
AlphaChannelBitBlt(hDC, x, y, dwWidth, dwHeight, hSrcDC, 0, 0);
}
else
{
//-------------------------------------------------------------------
// !!! ATTENTION !!!
// I don't know why a icon uses text's color
// Therefore I change a text's color to BLACK and after draw I restore
// original color
//-------------------------------------------------------------------
COLORREF crOldColor = ::SetTextColor(hDC, RGB(0, 0, 0));
//Merge the image mask with background
::SelectObject(hSrcDC, csOriginal.hbmMask);
::BitBlt(hDC, x, y, dwWidth, dwHeight, hSrcDC, 0, 0, SRCAND);
//Draw the image
::SelectObject(hSrcDC, hBitmap);
::BitBlt(hDC, x, y, dwWidth, dwHeight, hSrcDC, 0, 0, SRCPAINT);
::SetTextColor(hDC, crOldColor);
} //if
::SelectObject(hSrcDC, hOldSrcBitmap);
::DeleteDC(hSrcDC);
::DeleteObject(hBitmap);
::DestroyIcon(hIcon);
::DeleteObject(csOriginal.hbmColor);
::DeleteObject(csOriginal.hbmMask);
} //End DrawIcon
void CPPDrawManager::DrawShadow(HDC hDestDC, int nDestX, int nDestY, DWORD dwWidth, DWORD dwHeight, HBITMAP hMask, BOOL bGradient /* = false */, DWORD dwDepthX /* = PPDRAWMANAGER_SHADOW_YOFFSET */, DWORD dwDepthY /* = PPDRAWMANAGER_SHADOW_XOFFSET */)
{
HDC hSrcDC = ::CreateCompatibleDC(hDestDC);
if (NULL == hSrcDC)
return;
HDC hTempDC = ::CreateCompatibleDC(hDestDC);
if (NULL == hTempDC)
{
::DeleteDC(hSrcDC);
return;
} // if
//Creates Source DIB
LPBITMAPINFO lpbiSrc;
// Fill in the BITMAPINFOHEADER
lpbiSrc = (LPBITMAPINFO) new BYTE[sizeof(BITMAPINFOHEADER)];
lpbiSrc->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
lpbiSrc->bmiHeader.biWidth = dwWidth;
lpbiSrc->bmiHeader.biHeight = dwHeight;
lpbiSrc->bmiHeader.biPlanes = 1;
lpbiSrc->bmiHeader.biBitCount = 32;
lpbiSrc->bmiHeader.biCompression = BI_RGB;
lpbiSrc->bmiHeader.biSizeImage = dwWidth * dwHeight;
lpbiSrc->bmiHeader.biXPelsPerMeter = 0;
lpbiSrc->bmiHeader.biYPelsPerMeter = 0;
lpbiSrc->bmiHeader.biClrUsed = 0;
lpbiSrc->bmiHeader.biClrImportant = 0;
COLORREF* pSrcBits = NULL;
HBITMAP hSrcDib = CreateDIBSection (
hSrcDC, lpbiSrc, DIB_RGB_COLORS, (void **)&pSrcBits,
NULL, NULL);
if ((NULL != hSrcDib) && (NULL != pSrcBits))
{
HBITMAP hOldSrcBmp = (HBITMAP)::SelectObject (hSrcDC, hSrcDib);
HBITMAP hOldTempBmp = (HBITMAP)::SelectObject (hTempDC, hMask);
if (bGradient)
{
if (!(dwDepthX & 0x1)) dwDepthX++;
if (!(dwDepthY & 0x1)) dwDepthY++;
::BitBlt(hSrcDC, 0, 0, dwWidth, dwHeight, hTempDC, 0, 0, WHITENESS);
::StretchBlt (hSrcDC, dwDepthX / 2, dwDepthY / 2, dwWidth - dwDepthX, dwHeight - dwDepthY, hTempDC, 0, 0, dwWidth, dwHeight, SRCCOPY);
}
else
{
::BitBlt(hSrcDC, 0, 0, dwWidth, dwHeight, hTempDC, 0, 0, SRCCOPY);
} //if
::SelectObject (hTempDC, hOldTempBmp);
::SelectObject (hSrcDC, hOldSrcBmp);
//Creates Destination DIB
LPBITMAPINFO lpbiDest;
// Fill in the BITMAPINFOHEADER
lpbiDest = (LPBITMAPINFO) new BYTE[sizeof(BITMAPINFOHEADER)];
lpbiDest->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
lpbiDest->bmiHeader.biWidth = dwWidth;
lpbiDest->bmiHeader.biHeight = dwHeight;
lpbiDest->bmiHeader.biPlanes = 1;
lpbiDest->bmiHeader.biBitCount = 32;
lpbiDest->bmiHeader.biCompression = BI_RGB;
lpbiDest->bmiHeader.biSizeImage = dwWidth * dwHeight;
lpbiDest->bmiHeader.biXPelsPerMeter = 0;
lpbiDest->bmiHeader.biYPelsPerMeter = 0;
lpbiDest->bmiHeader.biClrUsed = 0;
lpbiDest->bmiHeader.biClrImportant = 0;
COLORREF* pDestBits = NULL;
HBITMAP hDestDib = CreateDIBSection (
hDestDC, lpbiDest, DIB_RGB_COLORS, (void **)&pDestBits,
NULL, NULL);
if ((NULL != hDestDib) && (NULL != pDestBits))
{
::SelectObject (hTempDC, hDestDib);
::BitBlt (hTempDC, 0, 0, dwWidth, dwHeight, hDestDC, nDestX, nDestY, SRCCOPY);
::SelectObject (hTempDC, hOldTempBmp);
if (bGradient)
{
double * depth = new double [dwWidth * dwHeight];
SmoothMaskImage(dwWidth, dwHeight, pSrcBits, dwDepthX, dwDepthY, depth);
for(DWORD pixel = 0; pixel < dwWidth * dwHeight; pixel++, pDestBits++)
*pDestBits = DarkenColor(*pDestBits, *(depth + pixel));
delete [] depth;
}
else
{
for(DWORD pixel = 0; pixel < dwWidth * dwHeight; pixel++, pSrcBits++, pDestBits++)
*pDestBits = DarkenColor(*pDestBits, (double)GetRValue(*pSrcBits) / 255.0);
} //if
::SelectObject (hTempDC, hDestDib);
::BitBlt (hDestDC, nDestX, nDestY, dwWidth, dwHeight, hTempDC, 0, 0, SRCCOPY);
::SelectObject (hTempDC, hOldTempBmp);
delete [] lpbiDest;
::DeleteObject(hDestDib);
} //if
delete [] lpbiSrc;
::DeleteObject(hSrcDib);
} //if
::DeleteDC(hTempDC);
::DeleteDC(hSrcDC);
} //End DrawIcon
void CPPDrawManager::DrawImageList(HDC hDC, int x, int y, DWORD dwWidth, DWORD dwHeight, HBITMAP hSrcBitmap,
int nIndex, int cx, int cy,
BOOL bUseMask, COLORREF crMask,
DWORD dwEffect /*= IMAGE_EFFECT_NONE*/,
BOOL bShadow /*= false*/,
DWORD dwCxShadow /*= PPDRAWMANAGER_SHADOW_XOFFSET*/,
DWORD dwCyShadow /*= PPDRAWMANAGER_SHADOW_YOFFSET*/,
DWORD dwCxDepth /*= PPDRAWMANAGER_SHADOW_XDEPTH*/,
DWORD dwCyDepth /*= PPDRAWMANAGER_SHADOW_YDEPTH*/,
COLORREF clrShadow /*= PPDRAWMANAGER_SHADOW_COLOR*/)
{
if ((NULL == hSrcBitmap) || !cx || !cy)
return;
SIZE sz;
GetSizeOfBitmap(hSrcBitmap, &sz);
int nMaxCol = sz.cx / cx;
int nMaxRow = sz.cy / cy;
int nMaxImages = nMaxCol * nMaxRow;
if ((nIndex < nMaxImages) && nMaxCol && nMaxRow)
{
HDC hSrcDC = ::CreateCompatibleDC(hDC);
HDC hDestDC = ::CreateCompatibleDC(hDC);
HBITMAP hIconBmp = ::CreateCompatibleBitmap(hDC, cx, cy);
HBITMAP hOldSrcBmp = (HBITMAP)::SelectObject(hSrcDC, hSrcBitmap);
HBITMAP hOldDestBmp = (HBITMAP)::SelectObject(hDestDC, hIconBmp);
::BitBlt(hDestDC, 0, 0, cx, cy, hSrcDC, (nIndex % nMaxCol) * cx, (nIndex / nMaxCol) * cy, SRCCOPY);
::SelectObject(hSrcDC, hOldSrcBmp);
::SelectObject(hDestDC, hOldDestBmp);
::DeleteDC(hSrcDC);
::DeleteDC(hDestDC);
DrawBitmap( hDC, x, y, dwWidth, dwHeight, hIconBmp,
bUseMask, crMask, dwEffect,
bShadow, dwCxShadow, dwCyShadow,
dwCxDepth, dwCyDepth, clrShadow);
::DeleteObject(hIconBmp);
} //if
} //End of DrawImageList
void CPPDrawManager::MaskToDepth(HDC hDC, DWORD dwWidth, DWORD dwHeight, HBITMAP hMask, double * pDepth, BOOL bGradient /* = false */, DWORD dwDepthX /* = PPDRAWMANAGER_CXSHADOW */, DWORD dwDepthY /* = PPDRAWMANAGER_CYSHADOW */)
{
HDC hSrcDC = ::CreateCompatibleDC(hDC);
if (NULL == hSrcDC)
{
::DeleteDC(hSrcDC);
hSrcDC = NULL;
return;
} //if
HDC hTempDC = ::CreateCompatibleDC(hDC);
if (NULL == hTempDC)
{
::DeleteDC(hTempDC);
hTempDC = NULL;
return;
} //if
//Creates Source DIB
LPBITMAPINFO lpbiSrc;
// Fill in the BITMAPINFOHEADER
lpbiSrc = (LPBITMAPINFO) new BYTE[sizeof(BITMAPINFOHEADER)];
lpbiSrc->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
lpbiSrc->bmiHeader.biWidth = dwWidth;
lpbiSrc->bmiHeader.biHeight = dwHeight;
lpbiSrc->bmiHeader.biPlanes = 1;
lpbiSrc->bmiHeader.biBitCount = 32;
lpbiSrc->bmiHeader.biCompression = BI_RGB;
lpbiSrc->bmiHeader.biSizeImage = dwWidth * dwHeight;
lpbiSrc->bmiHeader.biXPelsPerMeter = 0;
lpbiSrc->bmiHeader.biYPelsPerMeter = 0;
lpbiSrc->bmiHeader.biClrUsed = 0;
lpbiSrc->bmiHeader.biClrImportant = 0;
COLORREF* pSrcBits = NULL;
HBITMAP hSrcDib = CreateDIBSection (
hSrcDC, lpbiSrc, DIB_RGB_COLORS, (void **)&pSrcBits,
NULL, NULL);
if ((NULL != hSrcDib) && (NULL != pSrcBits))
{
HBITMAP hOldSrcBmp = (HBITMAP)::SelectObject (hSrcDC, hSrcDib);
HBITMAP hOldTempBmp = (HBITMAP)::SelectObject (hTempDC, hMask);
if (bGradient)
{
if (!(dwDepthX & 0x1)) dwDepthX++;
if (!(dwDepthY & 0x1)) dwDepthY++;
::BitBlt(hSrcDC, 0, 0, dwWidth, dwHeight, hTempDC, 0, 0, WHITENESS);
::StretchBlt (hSrcDC, dwDepthX / 2, dwDepthY / 2, dwWidth - dwDepthX, dwHeight - dwDepthY, hTempDC, 0, 0, dwWidth, dwHeight, SRCCOPY);
}
else
{
::BitBlt(hSrcDC, 0, 0, dwWidth, dwHeight, hTempDC, 0, 0, SRCCOPY);
} //if
::SelectObject (hTempDC, hOldTempBmp);
::SelectObject (hSrcDC, hOldSrcBmp);
if (bGradient)
{
SmoothMaskImage(dwWidth, dwHeight, pSrcBits, dwDepthX, dwDepthY, pDepth);
}
else
{
for (DWORD pixel = 0; pixel < (dwHeight * dwWidth); pixel++, pSrcBits++, pDepth++)
{
*pDepth = GetRValue(*pSrcBits) / 255;
} //for
} //if
delete [] lpbiSrc;
::DeleteObject(hSrcDib);
} //if
::DeleteDC(hTempDC);
::DeleteDC(hSrcDC);
} //End MaskToDepth
void CPPDrawManager::DarkenByDepth(HDC hDC, int x, int y, DWORD dwWidth, DWORD dwHeight, double * pDepth)
{
HDC hSrcDC = ::CreateCompatibleDC(hDC);
if (NULL == hSrcDC)
{
::DeleteDC(hSrcDC);
hSrcDC = NULL;
return;
} //if
//Creates Source DIB
LPBITMAPINFO lpbiSrc;
// Fill in the BITMAPINFOHEADER
lpbiSrc = (LPBITMAPINFO) new BYTE[sizeof(BITMAPINFOHEADER)];
lpbiSrc->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
lpbiSrc->bmiHeader.biWidth = dwWidth;
lpbiSrc->bmiHeader.biHeight = dwHeight;
lpbiSrc->bmiHeader.biPlanes = 1;
lpbiSrc->bmiHeader.biBitCount = 32;
lpbiSrc->bmiHeader.biCompression = BI_RGB;
lpbiSrc->bmiHeader.biSizeImage = dwWidth * dwHeight;
lpbiSrc->bmiHeader.biXPelsPerMeter = 0;
lpbiSrc->bmiHeader.biYPelsPerMeter = 0;
lpbiSrc->bmiHeader.biClrUsed = 0;
lpbiSrc->bmiHeader.biClrImportant = 0;
COLORREF* pSrcBits = NULL;
HBITMAP hSrcDib = CreateDIBSection (
hSrcDC, lpbiSrc, DIB_RGB_COLORS, (void **)&pSrcBits,
NULL, NULL);
if ((NULL != hSrcDib) && (NULL != pSrcBits))
{
HBITMAP hOldSrcBmp = (HBITMAP)::SelectObject (hSrcDC, hSrcDib);
::BitBlt(hSrcDC, 0, 0, dwWidth, dwHeight, hDC, x, y, SRCCOPY);
::SelectObject (hSrcDC, hOldSrcBmp);
for (DWORD pixel = 0; pixel < (dwHeight * dwWidth); pixel++, pSrcBits++, pDepth++)
{
*pSrcBits = DarkenColor(*pSrcBits, *pDepth);
} //for
hOldSrcBmp = (HBITMAP)::SelectObject (hSrcDC, hSrcDib);
::BitBlt(hDC, x, y, dwWidth, dwHeight, hSrcDC, 0, 0, SRCCOPY);
::SelectObject (hSrcDC, hOldSrcBmp);
delete [] lpbiSrc;
::DeleteObject(hSrcDib);
} //if
::DeleteDC(hSrcDC);
} //DarkenByDepth
void CPPDrawManager::SmoothMaskImage(const int ImageWidth,
const int ImageHeight,
const COLORREF* const pInitImg,
const int KerWidth,
const int KerHeight,
double* const pResImg_R /*= NULL*/)
{
double* const pfBuff1 = new double[(ImageWidth + KerWidth - 1) *
(ImageHeight + KerHeight - 1)];
double* const pfBuff2 = new double[(ImageWidth + KerWidth - 1) *
(ImageHeight + KerHeight - 1)];
// expanding initial image with a padding procdure
double* p = pfBuff1;
const COLORREF * pInitImg_It = pInitImg;
if(NULL != pResImg_R)
{
for(int _i = - KerHeight/2; _i < ImageHeight + KerHeight/2; _i++)
{
for(int _j = -KerWidth/2; _j < ImageWidth + KerWidth/2; _j++, p++)
{
if ((_i >= 0) && (_i < ImageHeight) && (_j >= 0) && (_j < ImageWidth))
{
*p = GetRValue(*pInitImg_It++);
// pInitImg_It++;
}
else
*p = 255;
} //for
} //for
//---
GetPartialSums(pfBuff1,
(ImageHeight + KerHeight - 1),
(ImageWidth + KerWidth - 1),
KerHeight,
KerWidth,
pfBuff2,
pResImg_R);
for(int i = 0; i < ImageHeight*ImageWidth; i++)
*(pResImg_R + i) /= KerHeight*KerWidth*255;
} //if
delete [] pfBuff1;
delete [] pfBuff2;
} //End SmoothMaskImage
void CPPDrawManager::GetPartialSums(const double* const pM,
unsigned int nMRows,
unsigned int nMCols,
unsigned int nPartRows,
unsigned int nPartCols,
double* const pBuff,
double* const pRes)
{
const double* it1;
const double* it2;
const double* it3;
double* pRowsPartSums;
const unsigned int nRowsPartSumsMRows = nMRows;
const unsigned int nRowsPartSumsMCols = nMCols - nPartCols + 1;
const unsigned int nResMRows = nMRows - nPartRows + 1;
const unsigned int nResMCols = nMCols - nPartCols + 1;
unsigned int i,j;
double s;
// частичны?сумм?стро?
it1 = pM;
pRowsPartSums = pBuff;
for(i = 0; i < nMRows; i++)
{
//-------------
it2 = it1;
s = 0;
for(j = 0;j < nPartCols;j++)s+=*it2++;
//-------------
it3 = it1;
*pRowsPartSums++ = s;
for(/*j = nPartCols*/; j < nMCols; j++)
{
s+=*it2 - *it3;
*pRowsPartSums++ = s;
it2++;
it3++;
} //for
//--
it1 += nMCols;
} //for
// формирование резуьтат?
const double* it4;
const double* it5;
const double* it6;
double* pResIt;
it4 = pBuff;
pResIt = pRes;
for(j = 0; j < nRowsPartSumsMCols; j++)
{
pResIt = pRes + j;
//-------------
it5 = it4;
s = 0;
for(i = 0; i < nPartRows; i++)
{
s += *it5;
it5 += nRowsPartSumsMCols;
} //for
//-------------
it6 = it4;
*pResIt = s;
pResIt += nRowsPartSumsMCols;
for(; i < nRowsPartSumsMRows; i++)
{
s += *it5 - *it6;//cout<<s<<endl;
*pResIt = s;
pResIt += nResMCols;
it5 += nRowsPartSumsMCols;
it6 += nRowsPartSumsMCols;
} //for
//--
it4 ++;
} //for
} //End GetPartialSums
void CPPDrawManager::DrawRectangle(HDC hDC, LPRECT lpRect, COLORREF crLight, COLORREF crDark, int nStyle /* = PEN_SOLID */, int nSize /* = 1 */)
{
DrawRectangle(hDC, lpRect->left, lpRect->top, lpRect->right, lpRect->bottom, crLight, crDark, nStyle, nSize);
}
void CPPDrawManager::DrawRectangle(HDC hDC, int left, int top, int right, int bottom,
COLORREF crLight, COLORREF crDark, int nStyle /* = PEN_SOLID */,
int nSize /* = 1 */)
{
if ((PEN_NULL == nStyle) || (nSize < 1))
return;
int nSysPenStyle = PS_SOLID;
int nDoubleLineOffset = nSize * 2;
switch (nStyle)
{
case PEN_DASH: nSysPenStyle = PS_DASH; break;
case PEN_DOT: nSysPenStyle = PS_DOT; break;
case PEN_DASHDOT: nSysPenStyle = PS_DASHDOT; break;
case PEN_DASHDOTDOT: nSysPenStyle = PS_DASHDOTDOT; break;
case PEN_DOUBLE:
case PEN_SOLID:
default:
nSysPenStyle = PS_SOLID;
break;
} //switch
//Insideframe
left += nSize / 2;
top += nSize / 2;
right -= nSize / 2;
bottom -= nSize / 2;
//Creates a light pen
HPEN hPen = ::CreatePen(nSysPenStyle, nSize, crLight);
HPEN hOldPen = (HPEN)::SelectObject(hDC, hPen);
//Draw light border
::MoveToEx(hDC, left, bottom, NULL);
::LineTo(hDC, left, top);
::LineTo(hDC, right, top);
if (PEN_DOUBLE == nStyle)
{
::MoveToEx(hDC, left + nDoubleLineOffset, bottom - nDoubleLineOffset, NULL);
::LineTo(hDC, left + nDoubleLineOffset, top + nDoubleLineOffset);
::LineTo(hDC, right - nDoubleLineOffset, top + nDoubleLineOffset);
} //if
//Creates a dark pen if needed
if (crLight != crDark)
{
SelectObject(hDC, hOldPen);
::DeleteObject(hPen);
hPen = ::CreatePen(nSysPenStyle, nSize, crDark);
hOldPen = (HPEN)::SelectObject(hDC, hPen);
} //if
//Draw dark border
::MoveToEx(hDC, right, top, NULL);
::LineTo(hDC, right, bottom);
::LineTo(hDC, left, bottom);
if (PEN_DOUBLE == nStyle)
{
::MoveToEx(hDC, right - nDoubleLineOffset, top + nDoubleLineOffset, NULL);
::LineTo(hDC, right - nDoubleLineOffset, bottom - nDoubleLineOffset);
::LineTo(hDC, left + nDoubleLineOffset, bottom - nDoubleLineOffset);
} //if
SelectObject(hDC, hOldPen);
::DeleteObject(hPen);
} //End DrawRectangle
void CPPDrawManager::DrawLine(HDC hDC,
int xStart, int yStart, int xEnd, int yEnd,
COLORREF color, int nStyle /* = PEN_SOLID */,
int nSize /* = 1 */) const
{
if ((PEN_NULL == nStyle) || (nSize < 1))
return;
int nSysPenStyle;
int nDoubleLineOffset = nSize * 2;
switch (nStyle)
{
case PEN_DASH: nSysPenStyle = PS_DASH; break;
case PEN_DOT: nSysPenStyle = PS_DOT; break;
case PEN_DASHDOT: nSysPenStyle = PS_DASHDOT; break;
case PEN_DASHDOTDOT: nSysPenStyle = PS_DASHDOTDOT; break;
case PEN_DOUBLE:
case PEN_SOLID:
default:
nSysPenStyle = PS_SOLID;
break;
} //switch
HPEN hPen = ::CreatePen(nSysPenStyle, nSize, color);
HPEN hOldPen = (HPEN)::SelectObject(hDC, hPen);
::MoveToEx(hDC, xStart, yStart, NULL);
::LineTo(hDC, xEnd, yEnd);
if (PEN_DOUBLE == nStyle)
{
if (xStart != xEnd)
{
yStart += nDoubleLineOffset;
yEnd += nDoubleLineOffset;
} //if
if (yStart != yEnd)
{
xStart += nDoubleLineOffset;
xEnd += nDoubleLineOffset;
} //if
::MoveToEx(hDC, xStart, yStart, NULL);
::LineTo(hDC, xEnd, yEnd);
} //if
SelectObject(hDC, hOldPen);
::DeleteObject(hPen);
} //End DrawLine
| [
"codemeow@ieee.org"
] | codemeow@ieee.org |
781c55bba42eff2ffff8de5503ae64ac24ea20a0 | a216ddc3ff649b04c0b74fc2b18e2e8bfb9bc5a1 | /{{ cookiecutter.project_name }}/app/{{ cookiecutter.project_name }}/{{ cookiecutter.project_name }}-cli/src/shaders/vShaders.hpp | 6dbea893afaf0d4d777e58c78ee0b875c80fec08 | [
"BSD-3-Clause",
"MIT"
] | permissive | theblackunknown/cookiecutter-cpp-project | f50e92793d0c2dc3b28d5aa3b63a25239e55d820 | 34e8faa7ddc14844ea910da383df159c0fe44849 | refs/heads/master | 2020-07-22T11:03:37.323354 | 2019-09-22T21:45:03 | 2019-09-22T21:45:03 | 207,177,566 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 231 | hpp | #pragma once
#include <vulkan/vulkan.hpp>
#include <string>
#include <unordered_map>
using GeneratedModules = std::unordered_map< std::string, vk::UniqueShaderModule >;
GeneratedModules loadShaders( const vk::Device& device );
| [
"andrea.machizaud@gmail.com"
] | andrea.machizaud@gmail.com |
8e719bac882ac29c44479fcb3dd3fac0079dc0bd | c08d3fca1c50556a3b88545bb493646afd439afd | /raaAssignment2/raaAssignment2/raaNodeCallbackFacarde.cpp | 895f31a0d95f3a5135502b8c49e8066cd8ea5ced | [] | no_license | Matt-CompSci/RoadTrafficSimulator | c108c5564be949109a2e7fbd6516bc001d5a42b5 | f52e7044c6d1127d37220951ae54b77b26e9cf29 | refs/heads/main | 2023-06-05T23:40:32.623755 | 2021-06-24T22:48:42 | 2021-06-24T22:48:42 | 380,067,439 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 966 | cpp | #include "raaNodeCallbackFacarde.h"
raaNodeCallbackFacarde::raaNodeCallbackFacarde(osg::Node* pPart): raaFacarde(pPart)
{
if (m_pRoot) m_pRoot->addUpdateCallback(this);
}
raaNodeCallbackFacarde::raaNodeCallbackFacarde(osg::Node* pPart, osg::Vec3 vTrans) : raaFacarde(pPart, vTrans)
{
if (m_pRoot) m_pRoot->addUpdateCallback(this);
}
raaNodeCallbackFacarde::raaNodeCallbackFacarde(osg::Node* pPart, osg::Vec3 vTrans, float fRot) : raaFacarde(pPart, vTrans, fRot)
{
if (m_pRoot) m_pRoot->addUpdateCallback(this);
}
raaNodeCallbackFacarde::raaNodeCallbackFacarde(osg::Node* pPart, osg::Vec3 vTrans, float fRot, float fScale) : raaFacarde(pPart, vTrans, fRot, fScale)
{
if (m_pRoot) m_pRoot->addUpdateCallback(this);
}
raaNodeCallbackFacarde::~raaNodeCallbackFacarde()
{
if (m_pRoot) m_pRoot->removeUpdateCallback(this);
}
void raaNodeCallbackFacarde::operator()(osg::Node* node, osg::NodeVisitor* nv)
{
nv->traverse(*node);
}
| [
"gmatt1923@gmail.com"
] | gmatt1923@gmail.com |
968a3640d995c54db52a0cec2a922903c9aa4227 | 28968ec2fd6996d1c32384ac8dcd43e9ffa26b75 | /pa/SandBox/Classes/GameScene.h | 94f9094636a2d226a900137888c7ffc2cb3c78b9 | [] | no_license | coreMember/studyNewTechnique | 260333082dfab188988034b33ca13df625e601dd | e91a38cf0efd850b93e5ba1cf2c548ada20a46a0 | refs/heads/master | 2021-01-19T11:32:19.406253 | 2014-11-16T13:33:41 | 2014-11-16T13:33:41 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,224 | h | //
// GameScene.h
// SandBox
//
// Created by Park Station on 2014. 11. 15..
//
//
#ifndef __SandBox__GameScene__
#define __SandBox__GameScene__
#include <stdio.h>
#include <cocos2d.h>
#include <MenuLayer.h>
#include <Character.h>
#include <Bullet.h>
#define SCROLL_BACKGROUND_VALUE 4;
class GameScene:public cocos2d::Layer{
protected:
const int m_scrollValue = 4;
const int m_characterY = 100;
cocos2d::Point m_previousPoint;
cocos2d::Sprite* m_background1;
cocos2d::Sprite* m_background2;
Bullet* m_bullet;
public:
static cocos2d::Scene* createScene();
virtual bool init();
CREATE_FUNC(GameScene);
Character* m_character;
void createBackground();
void createCharacter();
virtual void update(float frame);
void updateBullet(float frame);
//タップイベント
virtual bool onTouchBegan(cocos2d::Touch *touch, cocos2d::Event *unused_event);
virtual void onTouchMoved(cocos2d::Touch *touch, cocos2d::Event *unused_event);
virtual void onTouchEnded(cocos2d::Touch *touch, cocos2d::Event *unused_event);
virtual void onTouchCancelled(cocos2d::Touch *touch, cocos2d::Event *unused_event);
};
#endif /* defined(__SandBox__GameScene__) */
| [
"pmk3214@yahoo.co.jp"
] | pmk3214@yahoo.co.jp |
24c8a8d54f076245fecac4b646e97f8fc0394881 | e23bdab2890e5c25a442604d8fec84995a3a75b0 | /src/MonkeyPlayer/Include/d3dApp.h | 8c301cff2bbea92109e7c62a062340721f80cd8b | [] | no_license | mikeallgyer/monkeyplayer | 69bebdf49c5ef149cf56e4dcb41711c2e730275f | 07090dd506a4d7646ee75a3b3478fb8173403f96 | refs/heads/master | 2020-03-26T03:18:58.753459 | 2014-02-14T14:22:33 | 2014-02-14T14:22:33 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,239 | h | //
// (C) 2013 Mike Allgyer. All Rights Reserved.
//
// Some code used from, or inspired by, Frank D. Luna http://www.d3dcoder.net/d3d9c.htm:
//
// d3dApp.h by Frank Luna (C) 2005 All Rights Reserved.
//
// Contains the base Direct3D application class which provides the
// framework interface for the sample applications. Clients are to derive
// from D3DApp, override the framework methods, and instantiate only a single
// instance of the derived D3DApp class. At the same time, the client should
// set the global application pointer (gd3dApp) to point to the one and only
// instance, e.g., gd3dApp = new HelloD3DApp(hInstance);
//
#ifndef D3DAPP_H
#define D3DAPP_H
#include "d3dUtil.h"
#include "Camera.h"
#include "GfxStats.h"
#include "WindowManager.h"
#include <MonkeyInput.h>
#include <string>
namespace MonkeyPlayer
{
class D3DApp
{
public:
D3DApp(HINSTANCE hInstance, std::string caption, D3DDEVTYPE deviceType, DWORD vertexProc);
virtual ~D3DApp();
// derived methods
virtual bool checkDeviceCaps() { return true; }
virtual void onDeviceLost() {}
virtual void onDeviceReset() {}
virtual void updateScene(float dt) {}
virtual void drawScene() {}
// these are not usually overridden
virtual void initMainWindow();
virtual void initDirect3D();
virtual int run();
virtual LRESULT msgProc(UINT msg, WPARAM wParam, LPARAM lParam);
void enableFullScreen(bool enable);
bool isDeviceLost();
// get/set
HINSTANCE getAppInstance();
HWND getMainWnd();
Camera* getCamera();
virtual GfxStats *getStats() = 0;
int getWidth() { return mScreenWidth; }
int getHeight() { return mScreenHeight; }
bool getIsActive() { return mActive; }
protected:
void processResize();
std::string mCaption;
D3DDEVTYPE mDeviceType;
DWORD mVertexProc;
// window/direct3d stuff
HINSTANCE mHAppInstance;
HWND mHwnd;
IDirect3D9* m3dObj;
bool mPaused;
bool mUpdateOnly;
bool mAlreadyLost;
D3DPRESENT_PARAMETERS mPresParams;
int mScreenWidth;
int mScreenHeight;
Camera *mCamera;
bool mActive;
};
// globals
extern MonkeyPlayer::D3DApp* gApp;
extern IDirect3DDevice9* gDevice;
extern MonkeyInput* gInput;
extern MonkeyPlayer::WindowManager* gWindowMgr;
}
#endif | [
"mikeallgyer@gmail.com"
] | mikeallgyer@gmail.com |
a1110a344acb60099d79bc4439c11bbeee78b60d | 07327b5e8b2831b12352bf7c6426bfda60129da7 | /Include/10.0.10240.0/um/Tapi3.h | 4b082ef01cffc25a36dee53c87e8d3ca62726d62 | [] | no_license | tpn/winsdk-10 | ca279df0fce03f92036e90fb04196d6282a264b7 | 9b69fd26ac0c7d0b83d378dba01080e93349c2ed | refs/heads/master | 2021-01-10T01:56:18.586459 | 2018-02-19T21:26:31 | 2018-02-19T21:29:50 | 44,352,845 | 218 | 432 | null | null | null | null | UTF-8 | C++ | false | false | 135,647 | h |
/* this ALWAYS GENERATED file contains the definitions for the interfaces */
/* File created by MIDL compiler version 8.00.0613 */
/* @@MIDL_FILE_HEADING( ) */
/* verify that the <rpcndr.h> version is high enough to compile this file*/
#ifndef __REQUIRED_RPCNDR_H_VERSION__
#define __REQUIRED_RPCNDR_H_VERSION__ 500
#endif
/* verify that the <rpcsal.h> version is high enough to compile this file*/
#ifndef __REQUIRED_RPCSAL_H_VERSION__
#define __REQUIRED_RPCSAL_H_VERSION__ 100
#endif
#include "rpc.h"
#include "rpcndr.h"
#ifndef __RPCNDR_H_VERSION__
#error this stub requires an updated version of <rpcndr.h>
#endif /* __RPCNDR_H_VERSION__ */
#ifndef COM_NO_WINDOWS_H
#include "windows.h"
#include "ole2.h"
#endif /*COM_NO_WINDOWS_H*/
#ifndef __tapi3_h__
#define __tapi3_h__
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
#pragma once
#endif
/* Forward Declarations */
#ifndef __ITAgent_FWD_DEFINED__
#define __ITAgent_FWD_DEFINED__
typedef interface ITAgent ITAgent;
#endif /* __ITAgent_FWD_DEFINED__ */
#ifndef __ITAgentSession_FWD_DEFINED__
#define __ITAgentSession_FWD_DEFINED__
typedef interface ITAgentSession ITAgentSession;
#endif /* __ITAgentSession_FWD_DEFINED__ */
#ifndef __ITACDGroup_FWD_DEFINED__
#define __ITACDGroup_FWD_DEFINED__
typedef interface ITACDGroup ITACDGroup;
#endif /* __ITACDGroup_FWD_DEFINED__ */
#ifndef __ITQueue_FWD_DEFINED__
#define __ITQueue_FWD_DEFINED__
typedef interface ITQueue ITQueue;
#endif /* __ITQueue_FWD_DEFINED__ */
#ifndef __ITAgentEvent_FWD_DEFINED__
#define __ITAgentEvent_FWD_DEFINED__
typedef interface ITAgentEvent ITAgentEvent;
#endif /* __ITAgentEvent_FWD_DEFINED__ */
#ifndef __ITAgentSessionEvent_FWD_DEFINED__
#define __ITAgentSessionEvent_FWD_DEFINED__
typedef interface ITAgentSessionEvent ITAgentSessionEvent;
#endif /* __ITAgentSessionEvent_FWD_DEFINED__ */
#ifndef __ITACDGroupEvent_FWD_DEFINED__
#define __ITACDGroupEvent_FWD_DEFINED__
typedef interface ITACDGroupEvent ITACDGroupEvent;
#endif /* __ITACDGroupEvent_FWD_DEFINED__ */
#ifndef __ITQueueEvent_FWD_DEFINED__
#define __ITQueueEvent_FWD_DEFINED__
typedef interface ITQueueEvent ITQueueEvent;
#endif /* __ITQueueEvent_FWD_DEFINED__ */
#ifndef __ITAgentHandlerEvent_FWD_DEFINED__
#define __ITAgentHandlerEvent_FWD_DEFINED__
typedef interface ITAgentHandlerEvent ITAgentHandlerEvent;
#endif /* __ITAgentHandlerEvent_FWD_DEFINED__ */
#ifndef __ITTAPICallCenter_FWD_DEFINED__
#define __ITTAPICallCenter_FWD_DEFINED__
typedef interface ITTAPICallCenter ITTAPICallCenter;
#endif /* __ITTAPICallCenter_FWD_DEFINED__ */
#ifndef __ITAgentHandler_FWD_DEFINED__
#define __ITAgentHandler_FWD_DEFINED__
typedef interface ITAgentHandler ITAgentHandler;
#endif /* __ITAgentHandler_FWD_DEFINED__ */
#ifndef __IEnumAgent_FWD_DEFINED__
#define __IEnumAgent_FWD_DEFINED__
typedef interface IEnumAgent IEnumAgent;
#endif /* __IEnumAgent_FWD_DEFINED__ */
#ifndef __IEnumAgentSession_FWD_DEFINED__
#define __IEnumAgentSession_FWD_DEFINED__
typedef interface IEnumAgentSession IEnumAgentSession;
#endif /* __IEnumAgentSession_FWD_DEFINED__ */
#ifndef __IEnumQueue_FWD_DEFINED__
#define __IEnumQueue_FWD_DEFINED__
typedef interface IEnumQueue IEnumQueue;
#endif /* __IEnumQueue_FWD_DEFINED__ */
#ifndef __IEnumACDGroup_FWD_DEFINED__
#define __IEnumACDGroup_FWD_DEFINED__
typedef interface IEnumACDGroup IEnumACDGroup;
#endif /* __IEnumACDGroup_FWD_DEFINED__ */
#ifndef __IEnumAgentHandler_FWD_DEFINED__
#define __IEnumAgentHandler_FWD_DEFINED__
typedef interface IEnumAgentHandler IEnumAgentHandler;
#endif /* __IEnumAgentHandler_FWD_DEFINED__ */
#ifndef __ITAMMediaFormat_FWD_DEFINED__
#define __ITAMMediaFormat_FWD_DEFINED__
typedef interface ITAMMediaFormat ITAMMediaFormat;
#endif /* __ITAMMediaFormat_FWD_DEFINED__ */
#ifndef __ITAllocatorProperties_FWD_DEFINED__
#define __ITAllocatorProperties_FWD_DEFINED__
typedef interface ITAllocatorProperties ITAllocatorProperties;
#endif /* __ITAllocatorProperties_FWD_DEFINED__ */
#ifndef __ITPluggableTerminalEventSink_FWD_DEFINED__
#define __ITPluggableTerminalEventSink_FWD_DEFINED__
typedef interface ITPluggableTerminalEventSink ITPluggableTerminalEventSink;
#endif /* __ITPluggableTerminalEventSink_FWD_DEFINED__ */
#ifndef __ITPluggableTerminalEventSinkRegistration_FWD_DEFINED__
#define __ITPluggableTerminalEventSinkRegistration_FWD_DEFINED__
typedef interface ITPluggableTerminalEventSinkRegistration ITPluggableTerminalEventSinkRegistration;
#endif /* __ITPluggableTerminalEventSinkRegistration_FWD_DEFINED__ */
#ifndef __ITMSPAddress_FWD_DEFINED__
#define __ITMSPAddress_FWD_DEFINED__
typedef interface ITMSPAddress ITMSPAddress;
#endif /* __ITMSPAddress_FWD_DEFINED__ */
#ifndef __ITAgent_FWD_DEFINED__
#define __ITAgent_FWD_DEFINED__
typedef interface ITAgent ITAgent;
#endif /* __ITAgent_FWD_DEFINED__ */
#ifndef __ITAgentEvent_FWD_DEFINED__
#define __ITAgentEvent_FWD_DEFINED__
typedef interface ITAgentEvent ITAgentEvent;
#endif /* __ITAgentEvent_FWD_DEFINED__ */
#ifndef __ITAgentSession_FWD_DEFINED__
#define __ITAgentSession_FWD_DEFINED__
typedef interface ITAgentSession ITAgentSession;
#endif /* __ITAgentSession_FWD_DEFINED__ */
#ifndef __ITAgentSessionEvent_FWD_DEFINED__
#define __ITAgentSessionEvent_FWD_DEFINED__
typedef interface ITAgentSessionEvent ITAgentSessionEvent;
#endif /* __ITAgentSessionEvent_FWD_DEFINED__ */
#ifndef __ITACDGroup_FWD_DEFINED__
#define __ITACDGroup_FWD_DEFINED__
typedef interface ITACDGroup ITACDGroup;
#endif /* __ITACDGroup_FWD_DEFINED__ */
#ifndef __ITACDGroupEvent_FWD_DEFINED__
#define __ITACDGroupEvent_FWD_DEFINED__
typedef interface ITACDGroupEvent ITACDGroupEvent;
#endif /* __ITACDGroupEvent_FWD_DEFINED__ */
#ifndef __ITQueue_FWD_DEFINED__
#define __ITQueue_FWD_DEFINED__
typedef interface ITQueue ITQueue;
#endif /* __ITQueue_FWD_DEFINED__ */
#ifndef __ITQueueEvent_FWD_DEFINED__
#define __ITQueueEvent_FWD_DEFINED__
typedef interface ITQueueEvent ITQueueEvent;
#endif /* __ITQueueEvent_FWD_DEFINED__ */
#ifndef __ITTAPICallCenter_FWD_DEFINED__
#define __ITTAPICallCenter_FWD_DEFINED__
typedef interface ITTAPICallCenter ITTAPICallCenter;
#endif /* __ITTAPICallCenter_FWD_DEFINED__ */
#ifndef __ITAgentHandler_FWD_DEFINED__
#define __ITAgentHandler_FWD_DEFINED__
typedef interface ITAgentHandler ITAgentHandler;
#endif /* __ITAgentHandler_FWD_DEFINED__ */
#ifndef __ITAgentHandlerEvent_FWD_DEFINED__
#define __ITAgentHandlerEvent_FWD_DEFINED__
typedef interface ITAgentHandlerEvent ITAgentHandlerEvent;
#endif /* __ITAgentHandlerEvent_FWD_DEFINED__ */
#ifndef __ITTAPIDispatchEventNotification_FWD_DEFINED__
#define __ITTAPIDispatchEventNotification_FWD_DEFINED__
typedef interface ITTAPIDispatchEventNotification ITTAPIDispatchEventNotification;
#endif /* __ITTAPIDispatchEventNotification_FWD_DEFINED__ */
#ifndef __TAPI_FWD_DEFINED__
#define __TAPI_FWD_DEFINED__
#ifdef __cplusplus
typedef class TAPI TAPI;
#else
typedef struct TAPI TAPI;
#endif /* __cplusplus */
#endif /* __TAPI_FWD_DEFINED__ */
#ifndef __DispatchMapper_FWD_DEFINED__
#define __DispatchMapper_FWD_DEFINED__
#ifdef __cplusplus
typedef class DispatchMapper DispatchMapper;
#else
typedef struct DispatchMapper DispatchMapper;
#endif /* __cplusplus */
#endif /* __DispatchMapper_FWD_DEFINED__ */
#ifndef __RequestMakeCall_FWD_DEFINED__
#define __RequestMakeCall_FWD_DEFINED__
#ifdef __cplusplus
typedef class RequestMakeCall RequestMakeCall;
#else
typedef struct RequestMakeCall RequestMakeCall;
#endif /* __cplusplus */
#endif /* __RequestMakeCall_FWD_DEFINED__ */
#ifndef __ITTAPIDispatchEventNotification_FWD_DEFINED__
#define __ITTAPIDispatchEventNotification_FWD_DEFINED__
typedef interface ITTAPIDispatchEventNotification ITTAPIDispatchEventNotification;
#endif /* __ITTAPIDispatchEventNotification_FWD_DEFINED__ */
/* header files for imported files */
#include "oaidl.h"
#include "ocidl.h"
#include "tapi3if.h"
#ifdef __cplusplus
extern "C"{
#endif
/* interface __MIDL_itf_tapi3_0000_0000 */
/* [local] */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
#include <winapifamily.h>
#pragma region Desktop Family
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
/* Copyright (c) Microsoft Corporation. All rights reserved. */
#include <winapifamily.h>
#pragma region Desktop Family
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
typedef
enum AGENT_EVENT
{
AE_NOT_READY = 0,
AE_READY = ( AE_NOT_READY + 1 ) ,
AE_BUSY_ACD = ( AE_READY + 1 ) ,
AE_BUSY_INCOMING = ( AE_BUSY_ACD + 1 ) ,
AE_BUSY_OUTGOING = ( AE_BUSY_INCOMING + 1 ) ,
AE_UNKNOWN = ( AE_BUSY_OUTGOING + 1 )
} AGENT_EVENT;
typedef
enum AGENT_STATE
{
AS_NOT_READY = 0,
AS_READY = ( AS_NOT_READY + 1 ) ,
AS_BUSY_ACD = ( AS_READY + 1 ) ,
AS_BUSY_INCOMING = ( AS_BUSY_ACD + 1 ) ,
AS_BUSY_OUTGOING = ( AS_BUSY_INCOMING + 1 ) ,
AS_UNKNOWN = ( AS_BUSY_OUTGOING + 1 )
} AGENT_STATE;
typedef
enum AGENT_SESSION_EVENT
{
ASE_NEW_SESSION = 0,
ASE_NOT_READY = ( ASE_NEW_SESSION + 1 ) ,
ASE_READY = ( ASE_NOT_READY + 1 ) ,
ASE_BUSY = ( ASE_READY + 1 ) ,
ASE_WRAPUP = ( ASE_BUSY + 1 ) ,
ASE_END = ( ASE_WRAPUP + 1 )
} AGENT_SESSION_EVENT;
typedef
enum AGENT_SESSION_STATE
{
ASST_NOT_READY = 0,
ASST_READY = ( ASST_NOT_READY + 1 ) ,
ASST_BUSY_ON_CALL = ( ASST_READY + 1 ) ,
ASST_BUSY_WRAPUP = ( ASST_BUSY_ON_CALL + 1 ) ,
ASST_SESSION_ENDED = ( ASST_BUSY_WRAPUP + 1 )
} AGENT_SESSION_STATE;
typedef
enum AGENTHANDLER_EVENT
{
AHE_NEW_AGENTHANDLER = 0,
AHE_AGENTHANDLER_REMOVED = ( AHE_NEW_AGENTHANDLER + 1 )
} AGENTHANDLER_EVENT;
typedef
enum ACDGROUP_EVENT
{
ACDGE_NEW_GROUP = 0,
ACDGE_GROUP_REMOVED = ( ACDGE_NEW_GROUP + 1 )
} ACDGROUP_EVENT;
typedef
enum ACDQUEUE_EVENT
{
ACDQE_NEW_QUEUE = 0,
ACDQE_QUEUE_REMOVED = ( ACDQE_NEW_QUEUE + 1 )
} ACDQUEUE_EVENT;
extern RPC_IF_HANDLE __MIDL_itf_tapi3_0000_0000_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_tapi3_0000_0000_v0_0_s_ifspec;
#ifndef __ITAgent_INTERFACE_DEFINED__
#define __ITAgent_INTERFACE_DEFINED__
/* interface ITAgent */
/* [object][dual][helpstring][uuid] */
EXTERN_C const IID IID_ITAgent;
#if defined(__cplusplus) && !defined(CINTERFACE)
MIDL_INTERFACE("5770ECE5-4B27-11d1-BF80-00805FC147D3")
ITAgent : public IDispatch
{
public:
virtual /* [helpstring][hidden][id] */ HRESULT STDMETHODCALLTYPE EnumerateAgentSessions(
/* [retval][out] */ __RPC__deref_out_opt IEnumAgentSession **ppEnumAgentSession) = 0;
virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE CreateSession(
/* [in] */ __RPC__in_opt ITACDGroup *pACDGroup,
/* [in] */ __RPC__in_opt ITAddress *pAddress,
/* [retval][out] */ __RPC__deref_out_opt ITAgentSession **ppAgentSession) = 0;
virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE CreateSessionWithPIN(
/* [in] */ __RPC__in_opt ITACDGroup *pACDGroup,
/* [in] */ __RPC__in_opt ITAddress *pAddress,
/* [in] */ __RPC__in BSTR pPIN,
/* [retval][out] */ __RPC__deref_out_opt ITAgentSession **ppAgentSession) = 0;
virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_ID(
/* [retval][out] */ __RPC__deref_out_opt BSTR *ppID) = 0;
virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_User(
/* [retval][out] */ __RPC__deref_out_opt BSTR *ppUser) = 0;
virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_State(
/* [in] */ AGENT_STATE AgentState) = 0;
virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_State(
/* [retval][out] */ __RPC__out AGENT_STATE *pAgentState) = 0;
virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_MeasurementPeriod(
/* [in] */ long lPeriod) = 0;
virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_MeasurementPeriod(
/* [retval][out] */ __RPC__out long *plPeriod) = 0;
virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_OverallCallRate(
/* [retval][out] */ __RPC__out CURRENCY *pcyCallrate) = 0;
virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_NumberOfACDCalls(
/* [retval][out] */ __RPC__out long *plCalls) = 0;
virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_NumberOfIncomingCalls(
/* [retval][out] */ __RPC__out long *plCalls) = 0;
virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_NumberOfOutgoingCalls(
/* [retval][out] */ __RPC__out long *plCalls) = 0;
virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_TotalACDTalkTime(
/* [retval][out] */ __RPC__out long *plTalkTime) = 0;
virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_TotalACDCallTime(
/* [retval][out] */ __RPC__out long *plCallTime) = 0;
virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_TotalWrapUpTime(
/* [retval][out] */ __RPC__out long *plWrapUpTime) = 0;
virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_AgentSessions(
/* [retval][out] */ __RPC__out VARIANT *pVariant) = 0;
};
#else /* C style interface */
typedef struct ITAgentVtbl
{
BEGIN_INTERFACE
HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
__RPC__in ITAgent * This,
/* [in] */ __RPC__in REFIID riid,
/* [annotation][iid_is][out] */
_COM_Outptr_ void **ppvObject);
ULONG ( STDMETHODCALLTYPE *AddRef )(
__RPC__in ITAgent * This);
ULONG ( STDMETHODCALLTYPE *Release )(
__RPC__in ITAgent * This);
HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )(
__RPC__in ITAgent * This,
/* [out] */ __RPC__out UINT *pctinfo);
HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )(
__RPC__in ITAgent * This,
/* [in] */ UINT iTInfo,
/* [in] */ LCID lcid,
/* [out] */ __RPC__deref_out_opt ITypeInfo **ppTInfo);
HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )(
__RPC__in ITAgent * This,
/* [in] */ __RPC__in REFIID riid,
/* [size_is][in] */ __RPC__in_ecount_full(cNames) LPOLESTR *rgszNames,
/* [range][in] */ __RPC__in_range(0,16384) UINT cNames,
/* [in] */ LCID lcid,
/* [size_is][out] */ __RPC__out_ecount_full(cNames) DISPID *rgDispId);
/* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )(
ITAgent * This,
/* [annotation][in] */
_In_ DISPID dispIdMember,
/* [annotation][in] */
_In_ REFIID riid,
/* [annotation][in] */
_In_ LCID lcid,
/* [annotation][in] */
_In_ WORD wFlags,
/* [annotation][out][in] */
_In_ DISPPARAMS *pDispParams,
/* [annotation][out] */
_Out_opt_ VARIANT *pVarResult,
/* [annotation][out] */
_Out_opt_ EXCEPINFO *pExcepInfo,
/* [annotation][out] */
_Out_opt_ UINT *puArgErr);
/* [helpstring][hidden][id] */ HRESULT ( STDMETHODCALLTYPE *EnumerateAgentSessions )(
__RPC__in ITAgent * This,
/* [retval][out] */ __RPC__deref_out_opt IEnumAgentSession **ppEnumAgentSession);
/* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *CreateSession )(
__RPC__in ITAgent * This,
/* [in] */ __RPC__in_opt ITACDGroup *pACDGroup,
/* [in] */ __RPC__in_opt ITAddress *pAddress,
/* [retval][out] */ __RPC__deref_out_opt ITAgentSession **ppAgentSession);
/* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *CreateSessionWithPIN )(
__RPC__in ITAgent * This,
/* [in] */ __RPC__in_opt ITACDGroup *pACDGroup,
/* [in] */ __RPC__in_opt ITAddress *pAddress,
/* [in] */ __RPC__in BSTR pPIN,
/* [retval][out] */ __RPC__deref_out_opt ITAgentSession **ppAgentSession);
/* [helpstring][id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_ID )(
__RPC__in ITAgent * This,
/* [retval][out] */ __RPC__deref_out_opt BSTR *ppID);
/* [helpstring][id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_User )(
__RPC__in ITAgent * This,
/* [retval][out] */ __RPC__deref_out_opt BSTR *ppUser);
/* [helpstring][id][propput] */ HRESULT ( STDMETHODCALLTYPE *put_State )(
__RPC__in ITAgent * This,
/* [in] */ AGENT_STATE AgentState);
/* [helpstring][id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_State )(
__RPC__in ITAgent * This,
/* [retval][out] */ __RPC__out AGENT_STATE *pAgentState);
/* [helpstring][id][propput] */ HRESULT ( STDMETHODCALLTYPE *put_MeasurementPeriod )(
__RPC__in ITAgent * This,
/* [in] */ long lPeriod);
/* [helpstring][id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_MeasurementPeriod )(
__RPC__in ITAgent * This,
/* [retval][out] */ __RPC__out long *plPeriod);
/* [helpstring][id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_OverallCallRate )(
__RPC__in ITAgent * This,
/* [retval][out] */ __RPC__out CURRENCY *pcyCallrate);
/* [helpstring][id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_NumberOfACDCalls )(
__RPC__in ITAgent * This,
/* [retval][out] */ __RPC__out long *plCalls);
/* [helpstring][id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_NumberOfIncomingCalls )(
__RPC__in ITAgent * This,
/* [retval][out] */ __RPC__out long *plCalls);
/* [helpstring][id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_NumberOfOutgoingCalls )(
__RPC__in ITAgent * This,
/* [retval][out] */ __RPC__out long *plCalls);
/* [helpstring][id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_TotalACDTalkTime )(
__RPC__in ITAgent * This,
/* [retval][out] */ __RPC__out long *plTalkTime);
/* [helpstring][id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_TotalACDCallTime )(
__RPC__in ITAgent * This,
/* [retval][out] */ __RPC__out long *plCallTime);
/* [helpstring][id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_TotalWrapUpTime )(
__RPC__in ITAgent * This,
/* [retval][out] */ __RPC__out long *plWrapUpTime);
/* [helpstring][id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_AgentSessions )(
__RPC__in ITAgent * This,
/* [retval][out] */ __RPC__out VARIANT *pVariant);
END_INTERFACE
} ITAgentVtbl;
interface ITAgent
{
CONST_VTBL struct ITAgentVtbl *lpVtbl;
};
#ifdef COBJMACROS
#define ITAgent_QueryInterface(This,riid,ppvObject) \
( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) )
#define ITAgent_AddRef(This) \
( (This)->lpVtbl -> AddRef(This) )
#define ITAgent_Release(This) \
( (This)->lpVtbl -> Release(This) )
#define ITAgent_GetTypeInfoCount(This,pctinfo) \
( (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) )
#define ITAgent_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \
( (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) )
#define ITAgent_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \
( (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) )
#define ITAgent_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \
( (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) )
#define ITAgent_EnumerateAgentSessions(This,ppEnumAgentSession) \
( (This)->lpVtbl -> EnumerateAgentSessions(This,ppEnumAgentSession) )
#define ITAgent_CreateSession(This,pACDGroup,pAddress,ppAgentSession) \
( (This)->lpVtbl -> CreateSession(This,pACDGroup,pAddress,ppAgentSession) )
#define ITAgent_CreateSessionWithPIN(This,pACDGroup,pAddress,pPIN,ppAgentSession) \
( (This)->lpVtbl -> CreateSessionWithPIN(This,pACDGroup,pAddress,pPIN,ppAgentSession) )
#define ITAgent_get_ID(This,ppID) \
( (This)->lpVtbl -> get_ID(This,ppID) )
#define ITAgent_get_User(This,ppUser) \
( (This)->lpVtbl -> get_User(This,ppUser) )
#define ITAgent_put_State(This,AgentState) \
( (This)->lpVtbl -> put_State(This,AgentState) )
#define ITAgent_get_State(This,pAgentState) \
( (This)->lpVtbl -> get_State(This,pAgentState) )
#define ITAgent_put_MeasurementPeriod(This,lPeriod) \
( (This)->lpVtbl -> put_MeasurementPeriod(This,lPeriod) )
#define ITAgent_get_MeasurementPeriod(This,plPeriod) \
( (This)->lpVtbl -> get_MeasurementPeriod(This,plPeriod) )
#define ITAgent_get_OverallCallRate(This,pcyCallrate) \
( (This)->lpVtbl -> get_OverallCallRate(This,pcyCallrate) )
#define ITAgent_get_NumberOfACDCalls(This,plCalls) \
( (This)->lpVtbl -> get_NumberOfACDCalls(This,plCalls) )
#define ITAgent_get_NumberOfIncomingCalls(This,plCalls) \
( (This)->lpVtbl -> get_NumberOfIncomingCalls(This,plCalls) )
#define ITAgent_get_NumberOfOutgoingCalls(This,plCalls) \
( (This)->lpVtbl -> get_NumberOfOutgoingCalls(This,plCalls) )
#define ITAgent_get_TotalACDTalkTime(This,plTalkTime) \
( (This)->lpVtbl -> get_TotalACDTalkTime(This,plTalkTime) )
#define ITAgent_get_TotalACDCallTime(This,plCallTime) \
( (This)->lpVtbl -> get_TotalACDCallTime(This,plCallTime) )
#define ITAgent_get_TotalWrapUpTime(This,plWrapUpTime) \
( (This)->lpVtbl -> get_TotalWrapUpTime(This,plWrapUpTime) )
#define ITAgent_get_AgentSessions(This,pVariant) \
( (This)->lpVtbl -> get_AgentSessions(This,pVariant) )
#endif /* COBJMACROS */
#endif /* C style interface */
#endif /* __ITAgent_INTERFACE_DEFINED__ */
#ifndef __ITAgentSession_INTERFACE_DEFINED__
#define __ITAgentSession_INTERFACE_DEFINED__
/* interface ITAgentSession */
/* [object][dual][helpstring][uuid] */
EXTERN_C const IID IID_ITAgentSession;
#if defined(__cplusplus) && !defined(CINTERFACE)
MIDL_INTERFACE("5AFC3147-4BCC-11d1-BF80-00805FC147D3")
ITAgentSession : public IDispatch
{
public:
virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_Agent(
/* [retval][out] */ __RPC__deref_out_opt ITAgent **ppAgent) = 0;
virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_Address(
/* [retval][out] */ __RPC__deref_out_opt ITAddress **ppAddress) = 0;
virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_ACDGroup(
/* [retval][out] */ __RPC__deref_out_opt ITACDGroup **ppACDGroup) = 0;
virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_State(
/* [in] */ AGENT_SESSION_STATE SessionState) = 0;
virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_State(
/* [retval][out] */ __RPC__out AGENT_SESSION_STATE *pSessionState) = 0;
virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_SessionStartTime(
/* [retval][out] */ __RPC__out DATE *pdateSessionStart) = 0;
virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_SessionDuration(
/* [retval][out] */ __RPC__out long *plDuration) = 0;
virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_NumberOfCalls(
/* [retval][out] */ __RPC__out long *plCalls) = 0;
virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_TotalTalkTime(
/* [retval][out] */ __RPC__out long *plTalkTime) = 0;
virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_AverageTalkTime(
/* [retval][out] */ __RPC__out long *plTalkTime) = 0;
virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_TotalCallTime(
/* [retval][out] */ __RPC__out long *plCallTime) = 0;
virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_AverageCallTime(
/* [retval][out] */ __RPC__out long *plCallTime) = 0;
virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_TotalWrapUpTime(
/* [retval][out] */ __RPC__out long *plWrapUpTime) = 0;
virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_AverageWrapUpTime(
/* [retval][out] */ __RPC__out long *plWrapUpTime) = 0;
virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_ACDCallRate(
/* [retval][out] */ __RPC__out CURRENCY *pcyCallrate) = 0;
virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_LongestTimeToAnswer(
/* [retval][out] */ __RPC__out long *plAnswerTime) = 0;
virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_AverageTimeToAnswer(
/* [retval][out] */ __RPC__out long *plAnswerTime) = 0;
};
#else /* C style interface */
typedef struct ITAgentSessionVtbl
{
BEGIN_INTERFACE
HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
__RPC__in ITAgentSession * This,
/* [in] */ __RPC__in REFIID riid,
/* [annotation][iid_is][out] */
_COM_Outptr_ void **ppvObject);
ULONG ( STDMETHODCALLTYPE *AddRef )(
__RPC__in ITAgentSession * This);
ULONG ( STDMETHODCALLTYPE *Release )(
__RPC__in ITAgentSession * This);
HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )(
__RPC__in ITAgentSession * This,
/* [out] */ __RPC__out UINT *pctinfo);
HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )(
__RPC__in ITAgentSession * This,
/* [in] */ UINT iTInfo,
/* [in] */ LCID lcid,
/* [out] */ __RPC__deref_out_opt ITypeInfo **ppTInfo);
HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )(
__RPC__in ITAgentSession * This,
/* [in] */ __RPC__in REFIID riid,
/* [size_is][in] */ __RPC__in_ecount_full(cNames) LPOLESTR *rgszNames,
/* [range][in] */ __RPC__in_range(0,16384) UINT cNames,
/* [in] */ LCID lcid,
/* [size_is][out] */ __RPC__out_ecount_full(cNames) DISPID *rgDispId);
/* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )(
ITAgentSession * This,
/* [annotation][in] */
_In_ DISPID dispIdMember,
/* [annotation][in] */
_In_ REFIID riid,
/* [annotation][in] */
_In_ LCID lcid,
/* [annotation][in] */
_In_ WORD wFlags,
/* [annotation][out][in] */
_In_ DISPPARAMS *pDispParams,
/* [annotation][out] */
_Out_opt_ VARIANT *pVarResult,
/* [annotation][out] */
_Out_opt_ EXCEPINFO *pExcepInfo,
/* [annotation][out] */
_Out_opt_ UINT *puArgErr);
/* [helpstring][id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Agent )(
__RPC__in ITAgentSession * This,
/* [retval][out] */ __RPC__deref_out_opt ITAgent **ppAgent);
/* [helpstring][id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Address )(
__RPC__in ITAgentSession * This,
/* [retval][out] */ __RPC__deref_out_opt ITAddress **ppAddress);
/* [helpstring][id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_ACDGroup )(
__RPC__in ITAgentSession * This,
/* [retval][out] */ __RPC__deref_out_opt ITACDGroup **ppACDGroup);
/* [helpstring][id][propput] */ HRESULT ( STDMETHODCALLTYPE *put_State )(
__RPC__in ITAgentSession * This,
/* [in] */ AGENT_SESSION_STATE SessionState);
/* [helpstring][id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_State )(
__RPC__in ITAgentSession * This,
/* [retval][out] */ __RPC__out AGENT_SESSION_STATE *pSessionState);
/* [helpstring][id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_SessionStartTime )(
__RPC__in ITAgentSession * This,
/* [retval][out] */ __RPC__out DATE *pdateSessionStart);
/* [helpstring][id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_SessionDuration )(
__RPC__in ITAgentSession * This,
/* [retval][out] */ __RPC__out long *plDuration);
/* [helpstring][id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_NumberOfCalls )(
__RPC__in ITAgentSession * This,
/* [retval][out] */ __RPC__out long *plCalls);
/* [helpstring][id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_TotalTalkTime )(
__RPC__in ITAgentSession * This,
/* [retval][out] */ __RPC__out long *plTalkTime);
/* [helpstring][id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_AverageTalkTime )(
__RPC__in ITAgentSession * This,
/* [retval][out] */ __RPC__out long *plTalkTime);
/* [helpstring][id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_TotalCallTime )(
__RPC__in ITAgentSession * This,
/* [retval][out] */ __RPC__out long *plCallTime);
/* [helpstring][id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_AverageCallTime )(
__RPC__in ITAgentSession * This,
/* [retval][out] */ __RPC__out long *plCallTime);
/* [helpstring][id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_TotalWrapUpTime )(
__RPC__in ITAgentSession * This,
/* [retval][out] */ __RPC__out long *plWrapUpTime);
/* [helpstring][id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_AverageWrapUpTime )(
__RPC__in ITAgentSession * This,
/* [retval][out] */ __RPC__out long *plWrapUpTime);
/* [helpstring][id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_ACDCallRate )(
__RPC__in ITAgentSession * This,
/* [retval][out] */ __RPC__out CURRENCY *pcyCallrate);
/* [helpstring][id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_LongestTimeToAnswer )(
__RPC__in ITAgentSession * This,
/* [retval][out] */ __RPC__out long *plAnswerTime);
/* [helpstring][id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_AverageTimeToAnswer )(
__RPC__in ITAgentSession * This,
/* [retval][out] */ __RPC__out long *plAnswerTime);
END_INTERFACE
} ITAgentSessionVtbl;
interface ITAgentSession
{
CONST_VTBL struct ITAgentSessionVtbl *lpVtbl;
};
#ifdef COBJMACROS
#define ITAgentSession_QueryInterface(This,riid,ppvObject) \
( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) )
#define ITAgentSession_AddRef(This) \
( (This)->lpVtbl -> AddRef(This) )
#define ITAgentSession_Release(This) \
( (This)->lpVtbl -> Release(This) )
#define ITAgentSession_GetTypeInfoCount(This,pctinfo) \
( (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) )
#define ITAgentSession_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \
( (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) )
#define ITAgentSession_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \
( (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) )
#define ITAgentSession_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \
( (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) )
#define ITAgentSession_get_Agent(This,ppAgent) \
( (This)->lpVtbl -> get_Agent(This,ppAgent) )
#define ITAgentSession_get_Address(This,ppAddress) \
( (This)->lpVtbl -> get_Address(This,ppAddress) )
#define ITAgentSession_get_ACDGroup(This,ppACDGroup) \
( (This)->lpVtbl -> get_ACDGroup(This,ppACDGroup) )
#define ITAgentSession_put_State(This,SessionState) \
( (This)->lpVtbl -> put_State(This,SessionState) )
#define ITAgentSession_get_State(This,pSessionState) \
( (This)->lpVtbl -> get_State(This,pSessionState) )
#define ITAgentSession_get_SessionStartTime(This,pdateSessionStart) \
( (This)->lpVtbl -> get_SessionStartTime(This,pdateSessionStart) )
#define ITAgentSession_get_SessionDuration(This,plDuration) \
( (This)->lpVtbl -> get_SessionDuration(This,plDuration) )
#define ITAgentSession_get_NumberOfCalls(This,plCalls) \
( (This)->lpVtbl -> get_NumberOfCalls(This,plCalls) )
#define ITAgentSession_get_TotalTalkTime(This,plTalkTime) \
( (This)->lpVtbl -> get_TotalTalkTime(This,plTalkTime) )
#define ITAgentSession_get_AverageTalkTime(This,plTalkTime) \
( (This)->lpVtbl -> get_AverageTalkTime(This,plTalkTime) )
#define ITAgentSession_get_TotalCallTime(This,plCallTime) \
( (This)->lpVtbl -> get_TotalCallTime(This,plCallTime) )
#define ITAgentSession_get_AverageCallTime(This,plCallTime) \
( (This)->lpVtbl -> get_AverageCallTime(This,plCallTime) )
#define ITAgentSession_get_TotalWrapUpTime(This,plWrapUpTime) \
( (This)->lpVtbl -> get_TotalWrapUpTime(This,plWrapUpTime) )
#define ITAgentSession_get_AverageWrapUpTime(This,plWrapUpTime) \
( (This)->lpVtbl -> get_AverageWrapUpTime(This,plWrapUpTime) )
#define ITAgentSession_get_ACDCallRate(This,pcyCallrate) \
( (This)->lpVtbl -> get_ACDCallRate(This,pcyCallrate) )
#define ITAgentSession_get_LongestTimeToAnswer(This,plAnswerTime) \
( (This)->lpVtbl -> get_LongestTimeToAnswer(This,plAnswerTime) )
#define ITAgentSession_get_AverageTimeToAnswer(This,plAnswerTime) \
( (This)->lpVtbl -> get_AverageTimeToAnswer(This,plAnswerTime) )
#endif /* COBJMACROS */
#endif /* C style interface */
#endif /* __ITAgentSession_INTERFACE_DEFINED__ */
#ifndef __ITACDGroup_INTERFACE_DEFINED__
#define __ITACDGroup_INTERFACE_DEFINED__
/* interface ITACDGroup */
/* [object][dual][helpstring][uuid] */
EXTERN_C const IID IID_ITACDGroup;
#if defined(__cplusplus) && !defined(CINTERFACE)
MIDL_INTERFACE("5AFC3148-4BCC-11d1-BF80-00805FC147D3")
ITACDGroup : public IDispatch
{
public:
virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_Name(
/* [retval][out] */ __RPC__deref_out_opt BSTR *ppName) = 0;
virtual /* [helpstring][hidden][id] */ HRESULT STDMETHODCALLTYPE EnumerateQueues(
/* [retval][out] */ __RPC__deref_out_opt IEnumQueue **ppEnumQueue) = 0;
virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_Queues(
/* [retval][out] */ __RPC__out VARIANT *pVariant) = 0;
};
#else /* C style interface */
typedef struct ITACDGroupVtbl
{
BEGIN_INTERFACE
HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
__RPC__in ITACDGroup * This,
/* [in] */ __RPC__in REFIID riid,
/* [annotation][iid_is][out] */
_COM_Outptr_ void **ppvObject);
ULONG ( STDMETHODCALLTYPE *AddRef )(
__RPC__in ITACDGroup * This);
ULONG ( STDMETHODCALLTYPE *Release )(
__RPC__in ITACDGroup * This);
HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )(
__RPC__in ITACDGroup * This,
/* [out] */ __RPC__out UINT *pctinfo);
HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )(
__RPC__in ITACDGroup * This,
/* [in] */ UINT iTInfo,
/* [in] */ LCID lcid,
/* [out] */ __RPC__deref_out_opt ITypeInfo **ppTInfo);
HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )(
__RPC__in ITACDGroup * This,
/* [in] */ __RPC__in REFIID riid,
/* [size_is][in] */ __RPC__in_ecount_full(cNames) LPOLESTR *rgszNames,
/* [range][in] */ __RPC__in_range(0,16384) UINT cNames,
/* [in] */ LCID lcid,
/* [size_is][out] */ __RPC__out_ecount_full(cNames) DISPID *rgDispId);
/* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )(
ITACDGroup * This,
/* [annotation][in] */
_In_ DISPID dispIdMember,
/* [annotation][in] */
_In_ REFIID riid,
/* [annotation][in] */
_In_ LCID lcid,
/* [annotation][in] */
_In_ WORD wFlags,
/* [annotation][out][in] */
_In_ DISPPARAMS *pDispParams,
/* [annotation][out] */
_Out_opt_ VARIANT *pVarResult,
/* [annotation][out] */
_Out_opt_ EXCEPINFO *pExcepInfo,
/* [annotation][out] */
_Out_opt_ UINT *puArgErr);
/* [helpstring][id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Name )(
__RPC__in ITACDGroup * This,
/* [retval][out] */ __RPC__deref_out_opt BSTR *ppName);
/* [helpstring][hidden][id] */ HRESULT ( STDMETHODCALLTYPE *EnumerateQueues )(
__RPC__in ITACDGroup * This,
/* [retval][out] */ __RPC__deref_out_opt IEnumQueue **ppEnumQueue);
/* [helpstring][id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Queues )(
__RPC__in ITACDGroup * This,
/* [retval][out] */ __RPC__out VARIANT *pVariant);
END_INTERFACE
} ITACDGroupVtbl;
interface ITACDGroup
{
CONST_VTBL struct ITACDGroupVtbl *lpVtbl;
};
#ifdef COBJMACROS
#define ITACDGroup_QueryInterface(This,riid,ppvObject) \
( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) )
#define ITACDGroup_AddRef(This) \
( (This)->lpVtbl -> AddRef(This) )
#define ITACDGroup_Release(This) \
( (This)->lpVtbl -> Release(This) )
#define ITACDGroup_GetTypeInfoCount(This,pctinfo) \
( (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) )
#define ITACDGroup_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \
( (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) )
#define ITACDGroup_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \
( (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) )
#define ITACDGroup_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \
( (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) )
#define ITACDGroup_get_Name(This,ppName) \
( (This)->lpVtbl -> get_Name(This,ppName) )
#define ITACDGroup_EnumerateQueues(This,ppEnumQueue) \
( (This)->lpVtbl -> EnumerateQueues(This,ppEnumQueue) )
#define ITACDGroup_get_Queues(This,pVariant) \
( (This)->lpVtbl -> get_Queues(This,pVariant) )
#endif /* COBJMACROS */
#endif /* C style interface */
#endif /* __ITACDGroup_INTERFACE_DEFINED__ */
#ifndef __ITQueue_INTERFACE_DEFINED__
#define __ITQueue_INTERFACE_DEFINED__
/* interface ITQueue */
/* [object][dual][helpstring][uuid] */
EXTERN_C const IID IID_ITQueue;
#if defined(__cplusplus) && !defined(CINTERFACE)
MIDL_INTERFACE("5AFC3149-4BCC-11d1-BF80-00805FC147D3")
ITQueue : public IDispatch
{
public:
virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_MeasurementPeriod(
/* [in] */ long lPeriod) = 0;
virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_MeasurementPeriod(
/* [retval][out] */ __RPC__out long *plPeriod) = 0;
virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_TotalCallsQueued(
/* [retval][out] */ __RPC__out long *plCalls) = 0;
virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_CurrentCallsQueued(
/* [retval][out] */ __RPC__out long *plCalls) = 0;
virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_TotalCallsAbandoned(
/* [retval][out] */ __RPC__out long *plCalls) = 0;
virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_TotalCallsFlowedIn(
/* [retval][out] */ __RPC__out long *plCalls) = 0;
virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_TotalCallsFlowedOut(
/* [retval][out] */ __RPC__out long *plCalls) = 0;
virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_LongestEverWaitTime(
/* [retval][out] */ __RPC__out long *plWaitTime) = 0;
virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_CurrentLongestWaitTime(
/* [retval][out] */ __RPC__out long *plWaitTime) = 0;
virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_AverageWaitTime(
/* [retval][out] */ __RPC__out long *plWaitTime) = 0;
virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_FinalDisposition(
/* [retval][out] */ __RPC__out long *plCalls) = 0;
virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_Name(
/* [retval][out] */ __RPC__deref_out_opt BSTR *ppName) = 0;
};
#else /* C style interface */
typedef struct ITQueueVtbl
{
BEGIN_INTERFACE
HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
__RPC__in ITQueue * This,
/* [in] */ __RPC__in REFIID riid,
/* [annotation][iid_is][out] */
_COM_Outptr_ void **ppvObject);
ULONG ( STDMETHODCALLTYPE *AddRef )(
__RPC__in ITQueue * This);
ULONG ( STDMETHODCALLTYPE *Release )(
__RPC__in ITQueue * This);
HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )(
__RPC__in ITQueue * This,
/* [out] */ __RPC__out UINT *pctinfo);
HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )(
__RPC__in ITQueue * This,
/* [in] */ UINT iTInfo,
/* [in] */ LCID lcid,
/* [out] */ __RPC__deref_out_opt ITypeInfo **ppTInfo);
HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )(
__RPC__in ITQueue * This,
/* [in] */ __RPC__in REFIID riid,
/* [size_is][in] */ __RPC__in_ecount_full(cNames) LPOLESTR *rgszNames,
/* [range][in] */ __RPC__in_range(0,16384) UINT cNames,
/* [in] */ LCID lcid,
/* [size_is][out] */ __RPC__out_ecount_full(cNames) DISPID *rgDispId);
/* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )(
ITQueue * This,
/* [annotation][in] */
_In_ DISPID dispIdMember,
/* [annotation][in] */
_In_ REFIID riid,
/* [annotation][in] */
_In_ LCID lcid,
/* [annotation][in] */
_In_ WORD wFlags,
/* [annotation][out][in] */
_In_ DISPPARAMS *pDispParams,
/* [annotation][out] */
_Out_opt_ VARIANT *pVarResult,
/* [annotation][out] */
_Out_opt_ EXCEPINFO *pExcepInfo,
/* [annotation][out] */
_Out_opt_ UINT *puArgErr);
/* [helpstring][id][propput] */ HRESULT ( STDMETHODCALLTYPE *put_MeasurementPeriod )(
__RPC__in ITQueue * This,
/* [in] */ long lPeriod);
/* [helpstring][id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_MeasurementPeriod )(
__RPC__in ITQueue * This,
/* [retval][out] */ __RPC__out long *plPeriod);
/* [helpstring][id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_TotalCallsQueued )(
__RPC__in ITQueue * This,
/* [retval][out] */ __RPC__out long *plCalls);
/* [helpstring][id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_CurrentCallsQueued )(
__RPC__in ITQueue * This,
/* [retval][out] */ __RPC__out long *plCalls);
/* [helpstring][id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_TotalCallsAbandoned )(
__RPC__in ITQueue * This,
/* [retval][out] */ __RPC__out long *plCalls);
/* [helpstring][id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_TotalCallsFlowedIn )(
__RPC__in ITQueue * This,
/* [retval][out] */ __RPC__out long *plCalls);
/* [helpstring][id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_TotalCallsFlowedOut )(
__RPC__in ITQueue * This,
/* [retval][out] */ __RPC__out long *plCalls);
/* [helpstring][id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_LongestEverWaitTime )(
__RPC__in ITQueue * This,
/* [retval][out] */ __RPC__out long *plWaitTime);
/* [helpstring][id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_CurrentLongestWaitTime )(
__RPC__in ITQueue * This,
/* [retval][out] */ __RPC__out long *plWaitTime);
/* [helpstring][id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_AverageWaitTime )(
__RPC__in ITQueue * This,
/* [retval][out] */ __RPC__out long *plWaitTime);
/* [helpstring][id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_FinalDisposition )(
__RPC__in ITQueue * This,
/* [retval][out] */ __RPC__out long *plCalls);
/* [helpstring][id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Name )(
__RPC__in ITQueue * This,
/* [retval][out] */ __RPC__deref_out_opt BSTR *ppName);
END_INTERFACE
} ITQueueVtbl;
interface ITQueue
{
CONST_VTBL struct ITQueueVtbl *lpVtbl;
};
#ifdef COBJMACROS
#define ITQueue_QueryInterface(This,riid,ppvObject) \
( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) )
#define ITQueue_AddRef(This) \
( (This)->lpVtbl -> AddRef(This) )
#define ITQueue_Release(This) \
( (This)->lpVtbl -> Release(This) )
#define ITQueue_GetTypeInfoCount(This,pctinfo) \
( (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) )
#define ITQueue_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \
( (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) )
#define ITQueue_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \
( (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) )
#define ITQueue_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \
( (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) )
#define ITQueue_put_MeasurementPeriod(This,lPeriod) \
( (This)->lpVtbl -> put_MeasurementPeriod(This,lPeriod) )
#define ITQueue_get_MeasurementPeriod(This,plPeriod) \
( (This)->lpVtbl -> get_MeasurementPeriod(This,plPeriod) )
#define ITQueue_get_TotalCallsQueued(This,plCalls) \
( (This)->lpVtbl -> get_TotalCallsQueued(This,plCalls) )
#define ITQueue_get_CurrentCallsQueued(This,plCalls) \
( (This)->lpVtbl -> get_CurrentCallsQueued(This,plCalls) )
#define ITQueue_get_TotalCallsAbandoned(This,plCalls) \
( (This)->lpVtbl -> get_TotalCallsAbandoned(This,plCalls) )
#define ITQueue_get_TotalCallsFlowedIn(This,plCalls) \
( (This)->lpVtbl -> get_TotalCallsFlowedIn(This,plCalls) )
#define ITQueue_get_TotalCallsFlowedOut(This,plCalls) \
( (This)->lpVtbl -> get_TotalCallsFlowedOut(This,plCalls) )
#define ITQueue_get_LongestEverWaitTime(This,plWaitTime) \
( (This)->lpVtbl -> get_LongestEverWaitTime(This,plWaitTime) )
#define ITQueue_get_CurrentLongestWaitTime(This,plWaitTime) \
( (This)->lpVtbl -> get_CurrentLongestWaitTime(This,plWaitTime) )
#define ITQueue_get_AverageWaitTime(This,plWaitTime) \
( (This)->lpVtbl -> get_AverageWaitTime(This,plWaitTime) )
#define ITQueue_get_FinalDisposition(This,plCalls) \
( (This)->lpVtbl -> get_FinalDisposition(This,plCalls) )
#define ITQueue_get_Name(This,ppName) \
( (This)->lpVtbl -> get_Name(This,ppName) )
#endif /* COBJMACROS */
#endif /* C style interface */
#endif /* __ITQueue_INTERFACE_DEFINED__ */
#ifndef __ITAgentEvent_INTERFACE_DEFINED__
#define __ITAgentEvent_INTERFACE_DEFINED__
/* interface ITAgentEvent */
/* [object][dual][helpstring][uuid] */
EXTERN_C const IID IID_ITAgentEvent;
#if defined(__cplusplus) && !defined(CINTERFACE)
MIDL_INTERFACE("5AFC314A-4BCC-11d1-BF80-00805FC147D3")
ITAgentEvent : public IDispatch
{
public:
virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_Agent(
/* [retval][out] */ __RPC__deref_out_opt ITAgent **ppAgent) = 0;
virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_Event(
/* [retval][out] */ __RPC__out AGENT_EVENT *pEvent) = 0;
};
#else /* C style interface */
typedef struct ITAgentEventVtbl
{
BEGIN_INTERFACE
HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
__RPC__in ITAgentEvent * This,
/* [in] */ __RPC__in REFIID riid,
/* [annotation][iid_is][out] */
_COM_Outptr_ void **ppvObject);
ULONG ( STDMETHODCALLTYPE *AddRef )(
__RPC__in ITAgentEvent * This);
ULONG ( STDMETHODCALLTYPE *Release )(
__RPC__in ITAgentEvent * This);
HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )(
__RPC__in ITAgentEvent * This,
/* [out] */ __RPC__out UINT *pctinfo);
HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )(
__RPC__in ITAgentEvent * This,
/* [in] */ UINT iTInfo,
/* [in] */ LCID lcid,
/* [out] */ __RPC__deref_out_opt ITypeInfo **ppTInfo);
HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )(
__RPC__in ITAgentEvent * This,
/* [in] */ __RPC__in REFIID riid,
/* [size_is][in] */ __RPC__in_ecount_full(cNames) LPOLESTR *rgszNames,
/* [range][in] */ __RPC__in_range(0,16384) UINT cNames,
/* [in] */ LCID lcid,
/* [size_is][out] */ __RPC__out_ecount_full(cNames) DISPID *rgDispId);
/* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )(
ITAgentEvent * This,
/* [annotation][in] */
_In_ DISPID dispIdMember,
/* [annotation][in] */
_In_ REFIID riid,
/* [annotation][in] */
_In_ LCID lcid,
/* [annotation][in] */
_In_ WORD wFlags,
/* [annotation][out][in] */
_In_ DISPPARAMS *pDispParams,
/* [annotation][out] */
_Out_opt_ VARIANT *pVarResult,
/* [annotation][out] */
_Out_opt_ EXCEPINFO *pExcepInfo,
/* [annotation][out] */
_Out_opt_ UINT *puArgErr);
/* [helpstring][id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Agent )(
__RPC__in ITAgentEvent * This,
/* [retval][out] */ __RPC__deref_out_opt ITAgent **ppAgent);
/* [helpstring][id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Event )(
__RPC__in ITAgentEvent * This,
/* [retval][out] */ __RPC__out AGENT_EVENT *pEvent);
END_INTERFACE
} ITAgentEventVtbl;
interface ITAgentEvent
{
CONST_VTBL struct ITAgentEventVtbl *lpVtbl;
};
#ifdef COBJMACROS
#define ITAgentEvent_QueryInterface(This,riid,ppvObject) \
( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) )
#define ITAgentEvent_AddRef(This) \
( (This)->lpVtbl -> AddRef(This) )
#define ITAgentEvent_Release(This) \
( (This)->lpVtbl -> Release(This) )
#define ITAgentEvent_GetTypeInfoCount(This,pctinfo) \
( (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) )
#define ITAgentEvent_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \
( (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) )
#define ITAgentEvent_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \
( (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) )
#define ITAgentEvent_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \
( (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) )
#define ITAgentEvent_get_Agent(This,ppAgent) \
( (This)->lpVtbl -> get_Agent(This,ppAgent) )
#define ITAgentEvent_get_Event(This,pEvent) \
( (This)->lpVtbl -> get_Event(This,pEvent) )
#endif /* COBJMACROS */
#endif /* C style interface */
#endif /* __ITAgentEvent_INTERFACE_DEFINED__ */
#ifndef __ITAgentSessionEvent_INTERFACE_DEFINED__
#define __ITAgentSessionEvent_INTERFACE_DEFINED__
/* interface ITAgentSessionEvent */
/* [object][dual][helpstring][uuid] */
EXTERN_C const IID IID_ITAgentSessionEvent;
#if defined(__cplusplus) && !defined(CINTERFACE)
MIDL_INTERFACE("5AFC314B-4BCC-11d1-BF80-00805FC147D3")
ITAgentSessionEvent : public IDispatch
{
public:
virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_Session(
/* [retval][out] */ __RPC__deref_out_opt ITAgentSession **ppSession) = 0;
virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_Event(
/* [retval][out] */ __RPC__out AGENT_SESSION_EVENT *pEvent) = 0;
};
#else /* C style interface */
typedef struct ITAgentSessionEventVtbl
{
BEGIN_INTERFACE
HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
__RPC__in ITAgentSessionEvent * This,
/* [in] */ __RPC__in REFIID riid,
/* [annotation][iid_is][out] */
_COM_Outptr_ void **ppvObject);
ULONG ( STDMETHODCALLTYPE *AddRef )(
__RPC__in ITAgentSessionEvent * This);
ULONG ( STDMETHODCALLTYPE *Release )(
__RPC__in ITAgentSessionEvent * This);
HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )(
__RPC__in ITAgentSessionEvent * This,
/* [out] */ __RPC__out UINT *pctinfo);
HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )(
__RPC__in ITAgentSessionEvent * This,
/* [in] */ UINT iTInfo,
/* [in] */ LCID lcid,
/* [out] */ __RPC__deref_out_opt ITypeInfo **ppTInfo);
HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )(
__RPC__in ITAgentSessionEvent * This,
/* [in] */ __RPC__in REFIID riid,
/* [size_is][in] */ __RPC__in_ecount_full(cNames) LPOLESTR *rgszNames,
/* [range][in] */ __RPC__in_range(0,16384) UINT cNames,
/* [in] */ LCID lcid,
/* [size_is][out] */ __RPC__out_ecount_full(cNames) DISPID *rgDispId);
/* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )(
ITAgentSessionEvent * This,
/* [annotation][in] */
_In_ DISPID dispIdMember,
/* [annotation][in] */
_In_ REFIID riid,
/* [annotation][in] */
_In_ LCID lcid,
/* [annotation][in] */
_In_ WORD wFlags,
/* [annotation][out][in] */
_In_ DISPPARAMS *pDispParams,
/* [annotation][out] */
_Out_opt_ VARIANT *pVarResult,
/* [annotation][out] */
_Out_opt_ EXCEPINFO *pExcepInfo,
/* [annotation][out] */
_Out_opt_ UINT *puArgErr);
/* [helpstring][id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Session )(
__RPC__in ITAgentSessionEvent * This,
/* [retval][out] */ __RPC__deref_out_opt ITAgentSession **ppSession);
/* [helpstring][id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Event )(
__RPC__in ITAgentSessionEvent * This,
/* [retval][out] */ __RPC__out AGENT_SESSION_EVENT *pEvent);
END_INTERFACE
} ITAgentSessionEventVtbl;
interface ITAgentSessionEvent
{
CONST_VTBL struct ITAgentSessionEventVtbl *lpVtbl;
};
#ifdef COBJMACROS
#define ITAgentSessionEvent_QueryInterface(This,riid,ppvObject) \
( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) )
#define ITAgentSessionEvent_AddRef(This) \
( (This)->lpVtbl -> AddRef(This) )
#define ITAgentSessionEvent_Release(This) \
( (This)->lpVtbl -> Release(This) )
#define ITAgentSessionEvent_GetTypeInfoCount(This,pctinfo) \
( (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) )
#define ITAgentSessionEvent_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \
( (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) )
#define ITAgentSessionEvent_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \
( (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) )
#define ITAgentSessionEvent_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \
( (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) )
#define ITAgentSessionEvent_get_Session(This,ppSession) \
( (This)->lpVtbl -> get_Session(This,ppSession) )
#define ITAgentSessionEvent_get_Event(This,pEvent) \
( (This)->lpVtbl -> get_Event(This,pEvent) )
#endif /* COBJMACROS */
#endif /* C style interface */
#endif /* __ITAgentSessionEvent_INTERFACE_DEFINED__ */
#ifndef __ITACDGroupEvent_INTERFACE_DEFINED__
#define __ITACDGroupEvent_INTERFACE_DEFINED__
/* interface ITACDGroupEvent */
/* [object][dual][helpstring][uuid] */
EXTERN_C const IID IID_ITACDGroupEvent;
#if defined(__cplusplus) && !defined(CINTERFACE)
MIDL_INTERFACE("297F3032-BD11-11d1-A0A7-00805FC147D3")
ITACDGroupEvent : public IDispatch
{
public:
virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_Group(
/* [retval][out] */ __RPC__deref_out_opt ITACDGroup **ppGroup) = 0;
virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_Event(
/* [retval][out] */ __RPC__out ACDGROUP_EVENT *pEvent) = 0;
};
#else /* C style interface */
typedef struct ITACDGroupEventVtbl
{
BEGIN_INTERFACE
HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
__RPC__in ITACDGroupEvent * This,
/* [in] */ __RPC__in REFIID riid,
/* [annotation][iid_is][out] */
_COM_Outptr_ void **ppvObject);
ULONG ( STDMETHODCALLTYPE *AddRef )(
__RPC__in ITACDGroupEvent * This);
ULONG ( STDMETHODCALLTYPE *Release )(
__RPC__in ITACDGroupEvent * This);
HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )(
__RPC__in ITACDGroupEvent * This,
/* [out] */ __RPC__out UINT *pctinfo);
HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )(
__RPC__in ITACDGroupEvent * This,
/* [in] */ UINT iTInfo,
/* [in] */ LCID lcid,
/* [out] */ __RPC__deref_out_opt ITypeInfo **ppTInfo);
HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )(
__RPC__in ITACDGroupEvent * This,
/* [in] */ __RPC__in REFIID riid,
/* [size_is][in] */ __RPC__in_ecount_full(cNames) LPOLESTR *rgszNames,
/* [range][in] */ __RPC__in_range(0,16384) UINT cNames,
/* [in] */ LCID lcid,
/* [size_is][out] */ __RPC__out_ecount_full(cNames) DISPID *rgDispId);
/* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )(
ITACDGroupEvent * This,
/* [annotation][in] */
_In_ DISPID dispIdMember,
/* [annotation][in] */
_In_ REFIID riid,
/* [annotation][in] */
_In_ LCID lcid,
/* [annotation][in] */
_In_ WORD wFlags,
/* [annotation][out][in] */
_In_ DISPPARAMS *pDispParams,
/* [annotation][out] */
_Out_opt_ VARIANT *pVarResult,
/* [annotation][out] */
_Out_opt_ EXCEPINFO *pExcepInfo,
/* [annotation][out] */
_Out_opt_ UINT *puArgErr);
/* [helpstring][id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Group )(
__RPC__in ITACDGroupEvent * This,
/* [retval][out] */ __RPC__deref_out_opt ITACDGroup **ppGroup);
/* [helpstring][id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Event )(
__RPC__in ITACDGroupEvent * This,
/* [retval][out] */ __RPC__out ACDGROUP_EVENT *pEvent);
END_INTERFACE
} ITACDGroupEventVtbl;
interface ITACDGroupEvent
{
CONST_VTBL struct ITACDGroupEventVtbl *lpVtbl;
};
#ifdef COBJMACROS
#define ITACDGroupEvent_QueryInterface(This,riid,ppvObject) \
( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) )
#define ITACDGroupEvent_AddRef(This) \
( (This)->lpVtbl -> AddRef(This) )
#define ITACDGroupEvent_Release(This) \
( (This)->lpVtbl -> Release(This) )
#define ITACDGroupEvent_GetTypeInfoCount(This,pctinfo) \
( (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) )
#define ITACDGroupEvent_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \
( (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) )
#define ITACDGroupEvent_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \
( (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) )
#define ITACDGroupEvent_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \
( (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) )
#define ITACDGroupEvent_get_Group(This,ppGroup) \
( (This)->lpVtbl -> get_Group(This,ppGroup) )
#define ITACDGroupEvent_get_Event(This,pEvent) \
( (This)->lpVtbl -> get_Event(This,pEvent) )
#endif /* COBJMACROS */
#endif /* C style interface */
#endif /* __ITACDGroupEvent_INTERFACE_DEFINED__ */
#ifndef __ITQueueEvent_INTERFACE_DEFINED__
#define __ITQueueEvent_INTERFACE_DEFINED__
/* interface ITQueueEvent */
/* [object][dual][helpstring][uuid] */
EXTERN_C const IID IID_ITQueueEvent;
#if defined(__cplusplus) && !defined(CINTERFACE)
MIDL_INTERFACE("297F3033-BD11-11d1-A0A7-00805FC147D3")
ITQueueEvent : public IDispatch
{
public:
virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_Queue(
/* [retval][out] */ __RPC__deref_out_opt ITQueue **ppQueue) = 0;
virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_Event(
/* [retval][out] */ __RPC__out ACDQUEUE_EVENT *pEvent) = 0;
};
#else /* C style interface */
typedef struct ITQueueEventVtbl
{
BEGIN_INTERFACE
HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
__RPC__in ITQueueEvent * This,
/* [in] */ __RPC__in REFIID riid,
/* [annotation][iid_is][out] */
_COM_Outptr_ void **ppvObject);
ULONG ( STDMETHODCALLTYPE *AddRef )(
__RPC__in ITQueueEvent * This);
ULONG ( STDMETHODCALLTYPE *Release )(
__RPC__in ITQueueEvent * This);
HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )(
__RPC__in ITQueueEvent * This,
/* [out] */ __RPC__out UINT *pctinfo);
HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )(
__RPC__in ITQueueEvent * This,
/* [in] */ UINT iTInfo,
/* [in] */ LCID lcid,
/* [out] */ __RPC__deref_out_opt ITypeInfo **ppTInfo);
HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )(
__RPC__in ITQueueEvent * This,
/* [in] */ __RPC__in REFIID riid,
/* [size_is][in] */ __RPC__in_ecount_full(cNames) LPOLESTR *rgszNames,
/* [range][in] */ __RPC__in_range(0,16384) UINT cNames,
/* [in] */ LCID lcid,
/* [size_is][out] */ __RPC__out_ecount_full(cNames) DISPID *rgDispId);
/* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )(
ITQueueEvent * This,
/* [annotation][in] */
_In_ DISPID dispIdMember,
/* [annotation][in] */
_In_ REFIID riid,
/* [annotation][in] */
_In_ LCID lcid,
/* [annotation][in] */
_In_ WORD wFlags,
/* [annotation][out][in] */
_In_ DISPPARAMS *pDispParams,
/* [annotation][out] */
_Out_opt_ VARIANT *pVarResult,
/* [annotation][out] */
_Out_opt_ EXCEPINFO *pExcepInfo,
/* [annotation][out] */
_Out_opt_ UINT *puArgErr);
/* [helpstring][id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Queue )(
__RPC__in ITQueueEvent * This,
/* [retval][out] */ __RPC__deref_out_opt ITQueue **ppQueue);
/* [helpstring][id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Event )(
__RPC__in ITQueueEvent * This,
/* [retval][out] */ __RPC__out ACDQUEUE_EVENT *pEvent);
END_INTERFACE
} ITQueueEventVtbl;
interface ITQueueEvent
{
CONST_VTBL struct ITQueueEventVtbl *lpVtbl;
};
#ifdef COBJMACROS
#define ITQueueEvent_QueryInterface(This,riid,ppvObject) \
( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) )
#define ITQueueEvent_AddRef(This) \
( (This)->lpVtbl -> AddRef(This) )
#define ITQueueEvent_Release(This) \
( (This)->lpVtbl -> Release(This) )
#define ITQueueEvent_GetTypeInfoCount(This,pctinfo) \
( (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) )
#define ITQueueEvent_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \
( (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) )
#define ITQueueEvent_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \
( (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) )
#define ITQueueEvent_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \
( (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) )
#define ITQueueEvent_get_Queue(This,ppQueue) \
( (This)->lpVtbl -> get_Queue(This,ppQueue) )
#define ITQueueEvent_get_Event(This,pEvent) \
( (This)->lpVtbl -> get_Event(This,pEvent) )
#endif /* COBJMACROS */
#endif /* C style interface */
#endif /* __ITQueueEvent_INTERFACE_DEFINED__ */
#ifndef __ITAgentHandlerEvent_INTERFACE_DEFINED__
#define __ITAgentHandlerEvent_INTERFACE_DEFINED__
/* interface ITAgentHandlerEvent */
/* [object][dual][helpstring][uuid] */
EXTERN_C const IID IID_ITAgentHandlerEvent;
#if defined(__cplusplus) && !defined(CINTERFACE)
MIDL_INTERFACE("297F3034-BD11-11d1-A0A7-00805FC147D3")
ITAgentHandlerEvent : public IDispatch
{
public:
virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_AgentHandler(
/* [retval][out] */ __RPC__deref_out_opt ITAgentHandler **ppAgentHandler) = 0;
virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_Event(
/* [retval][out] */ __RPC__out AGENTHANDLER_EVENT *pEvent) = 0;
};
#else /* C style interface */
typedef struct ITAgentHandlerEventVtbl
{
BEGIN_INTERFACE
HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
__RPC__in ITAgentHandlerEvent * This,
/* [in] */ __RPC__in REFIID riid,
/* [annotation][iid_is][out] */
_COM_Outptr_ void **ppvObject);
ULONG ( STDMETHODCALLTYPE *AddRef )(
__RPC__in ITAgentHandlerEvent * This);
ULONG ( STDMETHODCALLTYPE *Release )(
__RPC__in ITAgentHandlerEvent * This);
HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )(
__RPC__in ITAgentHandlerEvent * This,
/* [out] */ __RPC__out UINT *pctinfo);
HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )(
__RPC__in ITAgentHandlerEvent * This,
/* [in] */ UINT iTInfo,
/* [in] */ LCID lcid,
/* [out] */ __RPC__deref_out_opt ITypeInfo **ppTInfo);
HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )(
__RPC__in ITAgentHandlerEvent * This,
/* [in] */ __RPC__in REFIID riid,
/* [size_is][in] */ __RPC__in_ecount_full(cNames) LPOLESTR *rgszNames,
/* [range][in] */ __RPC__in_range(0,16384) UINT cNames,
/* [in] */ LCID lcid,
/* [size_is][out] */ __RPC__out_ecount_full(cNames) DISPID *rgDispId);
/* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )(
ITAgentHandlerEvent * This,
/* [annotation][in] */
_In_ DISPID dispIdMember,
/* [annotation][in] */
_In_ REFIID riid,
/* [annotation][in] */
_In_ LCID lcid,
/* [annotation][in] */
_In_ WORD wFlags,
/* [annotation][out][in] */
_In_ DISPPARAMS *pDispParams,
/* [annotation][out] */
_Out_opt_ VARIANT *pVarResult,
/* [annotation][out] */
_Out_opt_ EXCEPINFO *pExcepInfo,
/* [annotation][out] */
_Out_opt_ UINT *puArgErr);
/* [helpstring][id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_AgentHandler )(
__RPC__in ITAgentHandlerEvent * This,
/* [retval][out] */ __RPC__deref_out_opt ITAgentHandler **ppAgentHandler);
/* [helpstring][id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Event )(
__RPC__in ITAgentHandlerEvent * This,
/* [retval][out] */ __RPC__out AGENTHANDLER_EVENT *pEvent);
END_INTERFACE
} ITAgentHandlerEventVtbl;
interface ITAgentHandlerEvent
{
CONST_VTBL struct ITAgentHandlerEventVtbl *lpVtbl;
};
#ifdef COBJMACROS
#define ITAgentHandlerEvent_QueryInterface(This,riid,ppvObject) \
( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) )
#define ITAgentHandlerEvent_AddRef(This) \
( (This)->lpVtbl -> AddRef(This) )
#define ITAgentHandlerEvent_Release(This) \
( (This)->lpVtbl -> Release(This) )
#define ITAgentHandlerEvent_GetTypeInfoCount(This,pctinfo) \
( (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) )
#define ITAgentHandlerEvent_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \
( (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) )
#define ITAgentHandlerEvent_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \
( (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) )
#define ITAgentHandlerEvent_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \
( (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) )
#define ITAgentHandlerEvent_get_AgentHandler(This,ppAgentHandler) \
( (This)->lpVtbl -> get_AgentHandler(This,ppAgentHandler) )
#define ITAgentHandlerEvent_get_Event(This,pEvent) \
( (This)->lpVtbl -> get_Event(This,pEvent) )
#endif /* COBJMACROS */
#endif /* C style interface */
#endif /* __ITAgentHandlerEvent_INTERFACE_DEFINED__ */
#ifndef __ITTAPICallCenter_INTERFACE_DEFINED__
#define __ITTAPICallCenter_INTERFACE_DEFINED__
/* interface ITTAPICallCenter */
/* [object][dual][helpstring][uuid] */
EXTERN_C const IID IID_ITTAPICallCenter;
#if defined(__cplusplus) && !defined(CINTERFACE)
MIDL_INTERFACE("5AFC3154-4BCC-11d1-BF80-00805FC147D3")
ITTAPICallCenter : public IDispatch
{
public:
virtual /* [helpstring][hidden][id] */ HRESULT STDMETHODCALLTYPE EnumerateAgentHandlers(
/* [retval][out] */ __RPC__deref_out_opt IEnumAgentHandler **ppEnumHandler) = 0;
virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_AgentHandlers(
/* [retval][out] */ __RPC__out VARIANT *pVariant) = 0;
};
#else /* C style interface */
typedef struct ITTAPICallCenterVtbl
{
BEGIN_INTERFACE
HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
__RPC__in ITTAPICallCenter * This,
/* [in] */ __RPC__in REFIID riid,
/* [annotation][iid_is][out] */
_COM_Outptr_ void **ppvObject);
ULONG ( STDMETHODCALLTYPE *AddRef )(
__RPC__in ITTAPICallCenter * This);
ULONG ( STDMETHODCALLTYPE *Release )(
__RPC__in ITTAPICallCenter * This);
HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )(
__RPC__in ITTAPICallCenter * This,
/* [out] */ __RPC__out UINT *pctinfo);
HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )(
__RPC__in ITTAPICallCenter * This,
/* [in] */ UINT iTInfo,
/* [in] */ LCID lcid,
/* [out] */ __RPC__deref_out_opt ITypeInfo **ppTInfo);
HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )(
__RPC__in ITTAPICallCenter * This,
/* [in] */ __RPC__in REFIID riid,
/* [size_is][in] */ __RPC__in_ecount_full(cNames) LPOLESTR *rgszNames,
/* [range][in] */ __RPC__in_range(0,16384) UINT cNames,
/* [in] */ LCID lcid,
/* [size_is][out] */ __RPC__out_ecount_full(cNames) DISPID *rgDispId);
/* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )(
ITTAPICallCenter * This,
/* [annotation][in] */
_In_ DISPID dispIdMember,
/* [annotation][in] */
_In_ REFIID riid,
/* [annotation][in] */
_In_ LCID lcid,
/* [annotation][in] */
_In_ WORD wFlags,
/* [annotation][out][in] */
_In_ DISPPARAMS *pDispParams,
/* [annotation][out] */
_Out_opt_ VARIANT *pVarResult,
/* [annotation][out] */
_Out_opt_ EXCEPINFO *pExcepInfo,
/* [annotation][out] */
_Out_opt_ UINT *puArgErr);
/* [helpstring][hidden][id] */ HRESULT ( STDMETHODCALLTYPE *EnumerateAgentHandlers )(
__RPC__in ITTAPICallCenter * This,
/* [retval][out] */ __RPC__deref_out_opt IEnumAgentHandler **ppEnumHandler);
/* [helpstring][id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_AgentHandlers )(
__RPC__in ITTAPICallCenter * This,
/* [retval][out] */ __RPC__out VARIANT *pVariant);
END_INTERFACE
} ITTAPICallCenterVtbl;
interface ITTAPICallCenter
{
CONST_VTBL struct ITTAPICallCenterVtbl *lpVtbl;
};
#ifdef COBJMACROS
#define ITTAPICallCenter_QueryInterface(This,riid,ppvObject) \
( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) )
#define ITTAPICallCenter_AddRef(This) \
( (This)->lpVtbl -> AddRef(This) )
#define ITTAPICallCenter_Release(This) \
( (This)->lpVtbl -> Release(This) )
#define ITTAPICallCenter_GetTypeInfoCount(This,pctinfo) \
( (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) )
#define ITTAPICallCenter_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \
( (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) )
#define ITTAPICallCenter_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \
( (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) )
#define ITTAPICallCenter_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \
( (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) )
#define ITTAPICallCenter_EnumerateAgentHandlers(This,ppEnumHandler) \
( (This)->lpVtbl -> EnumerateAgentHandlers(This,ppEnumHandler) )
#define ITTAPICallCenter_get_AgentHandlers(This,pVariant) \
( (This)->lpVtbl -> get_AgentHandlers(This,pVariant) )
#endif /* COBJMACROS */
#endif /* C style interface */
#endif /* __ITTAPICallCenter_INTERFACE_DEFINED__ */
#ifndef __ITAgentHandler_INTERFACE_DEFINED__
#define __ITAgentHandler_INTERFACE_DEFINED__
/* interface ITAgentHandler */
/* [object][dual][helpstring][uuid] */
EXTERN_C const IID IID_ITAgentHandler;
#if defined(__cplusplus) && !defined(CINTERFACE)
MIDL_INTERFACE("587E8C22-9802-11d1-A0A4-00805FC147D3")
ITAgentHandler : public IDispatch
{
public:
virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_Name(
/* [retval][out] */ __RPC__deref_out_opt BSTR *ppName) = 0;
virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE CreateAgent(
/* [retval][out] */ __RPC__deref_out_opt ITAgent **ppAgent) = 0;
virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE CreateAgentWithID(
/* [in] */ __RPC__in BSTR pID,
/* [in] */ __RPC__in BSTR pPIN,
/* [retval][out] */ __RPC__deref_out_opt ITAgent **ppAgent) = 0;
virtual /* [helpstring][hidden][id] */ HRESULT STDMETHODCALLTYPE EnumerateACDGroups(
/* [retval][out] */ __RPC__deref_out_opt IEnumACDGroup **ppEnumACDGroup) = 0;
virtual /* [helpstring][hidden][id] */ HRESULT STDMETHODCALLTYPE EnumerateUsableAddresses(
/* [retval][out] */ __RPC__deref_out_opt IEnumAddress **ppEnumAddress) = 0;
virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_ACDGroups(
/* [retval][out] */ __RPC__out VARIANT *pVariant) = 0;
virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_UsableAddresses(
/* [retval][out] */ __RPC__out VARIANT *pVariant) = 0;
};
#else /* C style interface */
typedef struct ITAgentHandlerVtbl
{
BEGIN_INTERFACE
HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
__RPC__in ITAgentHandler * This,
/* [in] */ __RPC__in REFIID riid,
/* [annotation][iid_is][out] */
_COM_Outptr_ void **ppvObject);
ULONG ( STDMETHODCALLTYPE *AddRef )(
__RPC__in ITAgentHandler * This);
ULONG ( STDMETHODCALLTYPE *Release )(
__RPC__in ITAgentHandler * This);
HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )(
__RPC__in ITAgentHandler * This,
/* [out] */ __RPC__out UINT *pctinfo);
HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )(
__RPC__in ITAgentHandler * This,
/* [in] */ UINT iTInfo,
/* [in] */ LCID lcid,
/* [out] */ __RPC__deref_out_opt ITypeInfo **ppTInfo);
HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )(
__RPC__in ITAgentHandler * This,
/* [in] */ __RPC__in REFIID riid,
/* [size_is][in] */ __RPC__in_ecount_full(cNames) LPOLESTR *rgszNames,
/* [range][in] */ __RPC__in_range(0,16384) UINT cNames,
/* [in] */ LCID lcid,
/* [size_is][out] */ __RPC__out_ecount_full(cNames) DISPID *rgDispId);
/* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )(
ITAgentHandler * This,
/* [annotation][in] */
_In_ DISPID dispIdMember,
/* [annotation][in] */
_In_ REFIID riid,
/* [annotation][in] */
_In_ LCID lcid,
/* [annotation][in] */
_In_ WORD wFlags,
/* [annotation][out][in] */
_In_ DISPPARAMS *pDispParams,
/* [annotation][out] */
_Out_opt_ VARIANT *pVarResult,
/* [annotation][out] */
_Out_opt_ EXCEPINFO *pExcepInfo,
/* [annotation][out] */
_Out_opt_ UINT *puArgErr);
/* [helpstring][id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Name )(
__RPC__in ITAgentHandler * This,
/* [retval][out] */ __RPC__deref_out_opt BSTR *ppName);
/* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *CreateAgent )(
__RPC__in ITAgentHandler * This,
/* [retval][out] */ __RPC__deref_out_opt ITAgent **ppAgent);
/* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *CreateAgentWithID )(
__RPC__in ITAgentHandler * This,
/* [in] */ __RPC__in BSTR pID,
/* [in] */ __RPC__in BSTR pPIN,
/* [retval][out] */ __RPC__deref_out_opt ITAgent **ppAgent);
/* [helpstring][hidden][id] */ HRESULT ( STDMETHODCALLTYPE *EnumerateACDGroups )(
__RPC__in ITAgentHandler * This,
/* [retval][out] */ __RPC__deref_out_opt IEnumACDGroup **ppEnumACDGroup);
/* [helpstring][hidden][id] */ HRESULT ( STDMETHODCALLTYPE *EnumerateUsableAddresses )(
__RPC__in ITAgentHandler * This,
/* [retval][out] */ __RPC__deref_out_opt IEnumAddress **ppEnumAddress);
/* [helpstring][id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_ACDGroups )(
__RPC__in ITAgentHandler * This,
/* [retval][out] */ __RPC__out VARIANT *pVariant);
/* [helpstring][id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_UsableAddresses )(
__RPC__in ITAgentHandler * This,
/* [retval][out] */ __RPC__out VARIANT *pVariant);
END_INTERFACE
} ITAgentHandlerVtbl;
interface ITAgentHandler
{
CONST_VTBL struct ITAgentHandlerVtbl *lpVtbl;
};
#ifdef COBJMACROS
#define ITAgentHandler_QueryInterface(This,riid,ppvObject) \
( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) )
#define ITAgentHandler_AddRef(This) \
( (This)->lpVtbl -> AddRef(This) )
#define ITAgentHandler_Release(This) \
( (This)->lpVtbl -> Release(This) )
#define ITAgentHandler_GetTypeInfoCount(This,pctinfo) \
( (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) )
#define ITAgentHandler_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \
( (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) )
#define ITAgentHandler_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \
( (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) )
#define ITAgentHandler_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \
( (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) )
#define ITAgentHandler_get_Name(This,ppName) \
( (This)->lpVtbl -> get_Name(This,ppName) )
#define ITAgentHandler_CreateAgent(This,ppAgent) \
( (This)->lpVtbl -> CreateAgent(This,ppAgent) )
#define ITAgentHandler_CreateAgentWithID(This,pID,pPIN,ppAgent) \
( (This)->lpVtbl -> CreateAgentWithID(This,pID,pPIN,ppAgent) )
#define ITAgentHandler_EnumerateACDGroups(This,ppEnumACDGroup) \
( (This)->lpVtbl -> EnumerateACDGroups(This,ppEnumACDGroup) )
#define ITAgentHandler_EnumerateUsableAddresses(This,ppEnumAddress) \
( (This)->lpVtbl -> EnumerateUsableAddresses(This,ppEnumAddress) )
#define ITAgentHandler_get_ACDGroups(This,pVariant) \
( (This)->lpVtbl -> get_ACDGroups(This,pVariant) )
#define ITAgentHandler_get_UsableAddresses(This,pVariant) \
( (This)->lpVtbl -> get_UsableAddresses(This,pVariant) )
#endif /* COBJMACROS */
#endif /* C style interface */
#endif /* __ITAgentHandler_INTERFACE_DEFINED__ */
#ifndef __IEnumAgent_INTERFACE_DEFINED__
#define __IEnumAgent_INTERFACE_DEFINED__
/* interface IEnumAgent */
/* [object][unique][hidden][helpstring][uuid] */
EXTERN_C const IID IID_IEnumAgent;
#if defined(__cplusplus) && !defined(CINTERFACE)
MIDL_INTERFACE("5AFC314D-4BCC-11d1-BF80-00805FC147D3")
IEnumAgent : public IUnknown
{
public:
virtual HRESULT STDMETHODCALLTYPE Next(
/* [in] */ ULONG celt,
/* [out] */ __RPC__deref_out_opt ITAgent **ppElements,
/* [out] */ __RPC__out ULONG *pceltFetched) = 0;
virtual HRESULT STDMETHODCALLTYPE Reset( void) = 0;
virtual HRESULT STDMETHODCALLTYPE Skip(
/* [in] */ ULONG celt) = 0;
virtual HRESULT STDMETHODCALLTYPE Clone(
/* [retval][out] */ __RPC__deref_out_opt IEnumAgent **ppEnum) = 0;
};
#else /* C style interface */
typedef struct IEnumAgentVtbl
{
BEGIN_INTERFACE
HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
__RPC__in IEnumAgent * This,
/* [in] */ __RPC__in REFIID riid,
/* [annotation][iid_is][out] */
_COM_Outptr_ void **ppvObject);
ULONG ( STDMETHODCALLTYPE *AddRef )(
__RPC__in IEnumAgent * This);
ULONG ( STDMETHODCALLTYPE *Release )(
__RPC__in IEnumAgent * This);
HRESULT ( STDMETHODCALLTYPE *Next )(
__RPC__in IEnumAgent * This,
/* [in] */ ULONG celt,
/* [out] */ __RPC__deref_out_opt ITAgent **ppElements,
/* [out] */ __RPC__out ULONG *pceltFetched);
HRESULT ( STDMETHODCALLTYPE *Reset )(
__RPC__in IEnumAgent * This);
HRESULT ( STDMETHODCALLTYPE *Skip )(
__RPC__in IEnumAgent * This,
/* [in] */ ULONG celt);
HRESULT ( STDMETHODCALLTYPE *Clone )(
__RPC__in IEnumAgent * This,
/* [retval][out] */ __RPC__deref_out_opt IEnumAgent **ppEnum);
END_INTERFACE
} IEnumAgentVtbl;
interface IEnumAgent
{
CONST_VTBL struct IEnumAgentVtbl *lpVtbl;
};
#ifdef COBJMACROS
#define IEnumAgent_QueryInterface(This,riid,ppvObject) \
( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) )
#define IEnumAgent_AddRef(This) \
( (This)->lpVtbl -> AddRef(This) )
#define IEnumAgent_Release(This) \
( (This)->lpVtbl -> Release(This) )
#define IEnumAgent_Next(This,celt,ppElements,pceltFetched) \
( (This)->lpVtbl -> Next(This,celt,ppElements,pceltFetched) )
#define IEnumAgent_Reset(This) \
( (This)->lpVtbl -> Reset(This) )
#define IEnumAgent_Skip(This,celt) \
( (This)->lpVtbl -> Skip(This,celt) )
#define IEnumAgent_Clone(This,ppEnum) \
( (This)->lpVtbl -> Clone(This,ppEnum) )
#endif /* COBJMACROS */
#endif /* C style interface */
#endif /* __IEnumAgent_INTERFACE_DEFINED__ */
#ifndef __IEnumAgentSession_INTERFACE_DEFINED__
#define __IEnumAgentSession_INTERFACE_DEFINED__
/* interface IEnumAgentSession */
/* [object][unique][hidden][helpstring][uuid] */
EXTERN_C const IID IID_IEnumAgentSession;
#if defined(__cplusplus) && !defined(CINTERFACE)
MIDL_INTERFACE("5AFC314E-4BCC-11d1-BF80-00805FC147D3")
IEnumAgentSession : public IUnknown
{
public:
virtual HRESULT STDMETHODCALLTYPE Next(
/* [in] */ ULONG celt,
/* [out] */ __RPC__deref_out_opt ITAgentSession **ppElements,
/* [out] */ __RPC__out ULONG *pceltFetched) = 0;
virtual HRESULT STDMETHODCALLTYPE Reset( void) = 0;
virtual HRESULT STDMETHODCALLTYPE Skip(
/* [in] */ ULONG celt) = 0;
virtual HRESULT STDMETHODCALLTYPE Clone(
/* [retval][out] */ __RPC__deref_out_opt IEnumAgentSession **ppEnum) = 0;
};
#else /* C style interface */
typedef struct IEnumAgentSessionVtbl
{
BEGIN_INTERFACE
HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
__RPC__in IEnumAgentSession * This,
/* [in] */ __RPC__in REFIID riid,
/* [annotation][iid_is][out] */
_COM_Outptr_ void **ppvObject);
ULONG ( STDMETHODCALLTYPE *AddRef )(
__RPC__in IEnumAgentSession * This);
ULONG ( STDMETHODCALLTYPE *Release )(
__RPC__in IEnumAgentSession * This);
HRESULT ( STDMETHODCALLTYPE *Next )(
__RPC__in IEnumAgentSession * This,
/* [in] */ ULONG celt,
/* [out] */ __RPC__deref_out_opt ITAgentSession **ppElements,
/* [out] */ __RPC__out ULONG *pceltFetched);
HRESULT ( STDMETHODCALLTYPE *Reset )(
__RPC__in IEnumAgentSession * This);
HRESULT ( STDMETHODCALLTYPE *Skip )(
__RPC__in IEnumAgentSession * This,
/* [in] */ ULONG celt);
HRESULT ( STDMETHODCALLTYPE *Clone )(
__RPC__in IEnumAgentSession * This,
/* [retval][out] */ __RPC__deref_out_opt IEnumAgentSession **ppEnum);
END_INTERFACE
} IEnumAgentSessionVtbl;
interface IEnumAgentSession
{
CONST_VTBL struct IEnumAgentSessionVtbl *lpVtbl;
};
#ifdef COBJMACROS
#define IEnumAgentSession_QueryInterface(This,riid,ppvObject) \
( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) )
#define IEnumAgentSession_AddRef(This) \
( (This)->lpVtbl -> AddRef(This) )
#define IEnumAgentSession_Release(This) \
( (This)->lpVtbl -> Release(This) )
#define IEnumAgentSession_Next(This,celt,ppElements,pceltFetched) \
( (This)->lpVtbl -> Next(This,celt,ppElements,pceltFetched) )
#define IEnumAgentSession_Reset(This) \
( (This)->lpVtbl -> Reset(This) )
#define IEnumAgentSession_Skip(This,celt) \
( (This)->lpVtbl -> Skip(This,celt) )
#define IEnumAgentSession_Clone(This,ppEnum) \
( (This)->lpVtbl -> Clone(This,ppEnum) )
#endif /* COBJMACROS */
#endif /* C style interface */
#endif /* __IEnumAgentSession_INTERFACE_DEFINED__ */
#ifndef __IEnumQueue_INTERFACE_DEFINED__
#define __IEnumQueue_INTERFACE_DEFINED__
/* interface IEnumQueue */
/* [object][unique][hidden][helpstring][uuid] */
EXTERN_C const IID IID_IEnumQueue;
#if defined(__cplusplus) && !defined(CINTERFACE)
MIDL_INTERFACE("5AFC3158-4BCC-11d1-BF80-00805FC147D3")
IEnumQueue : public IUnknown
{
public:
virtual HRESULT STDMETHODCALLTYPE Next(
/* [in] */ ULONG celt,
/* [out] */ __RPC__deref_out_opt ITQueue **ppElements,
/* [out] */ __RPC__out ULONG *pceltFetched) = 0;
virtual HRESULT STDMETHODCALLTYPE Reset( void) = 0;
virtual HRESULT STDMETHODCALLTYPE Skip(
/* [in] */ ULONG celt) = 0;
virtual HRESULT STDMETHODCALLTYPE Clone(
/* [retval][out] */ __RPC__deref_out_opt IEnumQueue **ppEnum) = 0;
};
#else /* C style interface */
typedef struct IEnumQueueVtbl
{
BEGIN_INTERFACE
HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
__RPC__in IEnumQueue * This,
/* [in] */ __RPC__in REFIID riid,
/* [annotation][iid_is][out] */
_COM_Outptr_ void **ppvObject);
ULONG ( STDMETHODCALLTYPE *AddRef )(
__RPC__in IEnumQueue * This);
ULONG ( STDMETHODCALLTYPE *Release )(
__RPC__in IEnumQueue * This);
HRESULT ( STDMETHODCALLTYPE *Next )(
__RPC__in IEnumQueue * This,
/* [in] */ ULONG celt,
/* [out] */ __RPC__deref_out_opt ITQueue **ppElements,
/* [out] */ __RPC__out ULONG *pceltFetched);
HRESULT ( STDMETHODCALLTYPE *Reset )(
__RPC__in IEnumQueue * This);
HRESULT ( STDMETHODCALLTYPE *Skip )(
__RPC__in IEnumQueue * This,
/* [in] */ ULONG celt);
HRESULT ( STDMETHODCALLTYPE *Clone )(
__RPC__in IEnumQueue * This,
/* [retval][out] */ __RPC__deref_out_opt IEnumQueue **ppEnum);
END_INTERFACE
} IEnumQueueVtbl;
interface IEnumQueue
{
CONST_VTBL struct IEnumQueueVtbl *lpVtbl;
};
#ifdef COBJMACROS
#define IEnumQueue_QueryInterface(This,riid,ppvObject) \
( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) )
#define IEnumQueue_AddRef(This) \
( (This)->lpVtbl -> AddRef(This) )
#define IEnumQueue_Release(This) \
( (This)->lpVtbl -> Release(This) )
#define IEnumQueue_Next(This,celt,ppElements,pceltFetched) \
( (This)->lpVtbl -> Next(This,celt,ppElements,pceltFetched) )
#define IEnumQueue_Reset(This) \
( (This)->lpVtbl -> Reset(This) )
#define IEnumQueue_Skip(This,celt) \
( (This)->lpVtbl -> Skip(This,celt) )
#define IEnumQueue_Clone(This,ppEnum) \
( (This)->lpVtbl -> Clone(This,ppEnum) )
#endif /* COBJMACROS */
#endif /* C style interface */
#endif /* __IEnumQueue_INTERFACE_DEFINED__ */
#ifndef __IEnumACDGroup_INTERFACE_DEFINED__
#define __IEnumACDGroup_INTERFACE_DEFINED__
/* interface IEnumACDGroup */
/* [object][unique][hidden][helpstring][uuid] */
EXTERN_C const IID IID_IEnumACDGroup;
#if defined(__cplusplus) && !defined(CINTERFACE)
MIDL_INTERFACE("5AFC3157-4BCC-11d1-BF80-00805FC147D3")
IEnumACDGroup : public IUnknown
{
public:
virtual HRESULT STDMETHODCALLTYPE Next(
/* [in] */ ULONG celt,
/* [out] */ __RPC__deref_out_opt ITACDGroup **ppElements,
/* [out] */ __RPC__out ULONG *pceltFetched) = 0;
virtual HRESULT STDMETHODCALLTYPE Reset( void) = 0;
virtual HRESULT STDMETHODCALLTYPE Skip(
/* [in] */ ULONG celt) = 0;
virtual HRESULT STDMETHODCALLTYPE Clone(
/* [retval][out] */ __RPC__deref_out_opt IEnumACDGroup **ppEnum) = 0;
};
#else /* C style interface */
typedef struct IEnumACDGroupVtbl
{
BEGIN_INTERFACE
HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
__RPC__in IEnumACDGroup * This,
/* [in] */ __RPC__in REFIID riid,
/* [annotation][iid_is][out] */
_COM_Outptr_ void **ppvObject);
ULONG ( STDMETHODCALLTYPE *AddRef )(
__RPC__in IEnumACDGroup * This);
ULONG ( STDMETHODCALLTYPE *Release )(
__RPC__in IEnumACDGroup * This);
HRESULT ( STDMETHODCALLTYPE *Next )(
__RPC__in IEnumACDGroup * This,
/* [in] */ ULONG celt,
/* [out] */ __RPC__deref_out_opt ITACDGroup **ppElements,
/* [out] */ __RPC__out ULONG *pceltFetched);
HRESULT ( STDMETHODCALLTYPE *Reset )(
__RPC__in IEnumACDGroup * This);
HRESULT ( STDMETHODCALLTYPE *Skip )(
__RPC__in IEnumACDGroup * This,
/* [in] */ ULONG celt);
HRESULT ( STDMETHODCALLTYPE *Clone )(
__RPC__in IEnumACDGroup * This,
/* [retval][out] */ __RPC__deref_out_opt IEnumACDGroup **ppEnum);
END_INTERFACE
} IEnumACDGroupVtbl;
interface IEnumACDGroup
{
CONST_VTBL struct IEnumACDGroupVtbl *lpVtbl;
};
#ifdef COBJMACROS
#define IEnumACDGroup_QueryInterface(This,riid,ppvObject) \
( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) )
#define IEnumACDGroup_AddRef(This) \
( (This)->lpVtbl -> AddRef(This) )
#define IEnumACDGroup_Release(This) \
( (This)->lpVtbl -> Release(This) )
#define IEnumACDGroup_Next(This,celt,ppElements,pceltFetched) \
( (This)->lpVtbl -> Next(This,celt,ppElements,pceltFetched) )
#define IEnumACDGroup_Reset(This) \
( (This)->lpVtbl -> Reset(This) )
#define IEnumACDGroup_Skip(This,celt) \
( (This)->lpVtbl -> Skip(This,celt) )
#define IEnumACDGroup_Clone(This,ppEnum) \
( (This)->lpVtbl -> Clone(This,ppEnum) )
#endif /* COBJMACROS */
#endif /* C style interface */
#endif /* __IEnumACDGroup_INTERFACE_DEFINED__ */
#ifndef __IEnumAgentHandler_INTERFACE_DEFINED__
#define __IEnumAgentHandler_INTERFACE_DEFINED__
/* interface IEnumAgentHandler */
/* [object][unique][hidden][helpstring][uuid] */
EXTERN_C const IID IID_IEnumAgentHandler;
#if defined(__cplusplus) && !defined(CINTERFACE)
MIDL_INTERFACE("587E8C28-9802-11d1-A0A4-00805FC147D3")
IEnumAgentHandler : public IUnknown
{
public:
virtual HRESULT STDMETHODCALLTYPE Next(
/* [in] */ ULONG celt,
/* [out] */ __RPC__deref_out_opt ITAgentHandler **ppElements,
/* [out] */ __RPC__out ULONG *pceltFetched) = 0;
virtual HRESULT STDMETHODCALLTYPE Reset( void) = 0;
virtual HRESULT STDMETHODCALLTYPE Skip(
/* [in] */ ULONG celt) = 0;
virtual HRESULT STDMETHODCALLTYPE Clone(
/* [retval][out] */ __RPC__deref_out_opt IEnumAgentHandler **ppEnum) = 0;
};
#else /* C style interface */
typedef struct IEnumAgentHandlerVtbl
{
BEGIN_INTERFACE
HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
__RPC__in IEnumAgentHandler * This,
/* [in] */ __RPC__in REFIID riid,
/* [annotation][iid_is][out] */
_COM_Outptr_ void **ppvObject);
ULONG ( STDMETHODCALLTYPE *AddRef )(
__RPC__in IEnumAgentHandler * This);
ULONG ( STDMETHODCALLTYPE *Release )(
__RPC__in IEnumAgentHandler * This);
HRESULT ( STDMETHODCALLTYPE *Next )(
__RPC__in IEnumAgentHandler * This,
/* [in] */ ULONG celt,
/* [out] */ __RPC__deref_out_opt ITAgentHandler **ppElements,
/* [out] */ __RPC__out ULONG *pceltFetched);
HRESULT ( STDMETHODCALLTYPE *Reset )(
__RPC__in IEnumAgentHandler * This);
HRESULT ( STDMETHODCALLTYPE *Skip )(
__RPC__in IEnumAgentHandler * This,
/* [in] */ ULONG celt);
HRESULT ( STDMETHODCALLTYPE *Clone )(
__RPC__in IEnumAgentHandler * This,
/* [retval][out] */ __RPC__deref_out_opt IEnumAgentHandler **ppEnum);
END_INTERFACE
} IEnumAgentHandlerVtbl;
interface IEnumAgentHandler
{
CONST_VTBL struct IEnumAgentHandlerVtbl *lpVtbl;
};
#ifdef COBJMACROS
#define IEnumAgentHandler_QueryInterface(This,riid,ppvObject) \
( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) )
#define IEnumAgentHandler_AddRef(This) \
( (This)->lpVtbl -> AddRef(This) )
#define IEnumAgentHandler_Release(This) \
( (This)->lpVtbl -> Release(This) )
#define IEnumAgentHandler_Next(This,celt,ppElements,pceltFetched) \
( (This)->lpVtbl -> Next(This,celt,ppElements,pceltFetched) )
#define IEnumAgentHandler_Reset(This) \
( (This)->lpVtbl -> Reset(This) )
#define IEnumAgentHandler_Skip(This,celt) \
( (This)->lpVtbl -> Skip(This,celt) )
#define IEnumAgentHandler_Clone(This,ppEnum) \
( (This)->lpVtbl -> Clone(This,ppEnum) )
#endif /* COBJMACROS */
#endif /* C style interface */
#endif /* __IEnumAgentHandler_INTERFACE_DEFINED__ */
/* interface __MIDL_itf_tapi3_0000_0016 */
/* [local] */
#endif /* WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) */
#pragma endregion
/* Copyright (c) Microsoft Corporation. All rights reserved. */
#include <winapifamily.h>
#pragma region Desktop Family
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
extern RPC_IF_HANDLE __MIDL_itf_tapi3_0000_0016_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_tapi3_0000_0016_v0_0_s_ifspec;
#ifndef __ITAMMediaFormat_INTERFACE_DEFINED__
#define __ITAMMediaFormat_INTERFACE_DEFINED__
/* interface ITAMMediaFormat */
/* [object][helpstring][uuid] */
EXTERN_C const IID IID_ITAMMediaFormat;
#if defined(__cplusplus) && !defined(CINTERFACE)
MIDL_INTERFACE("0364EB00-4A77-11D1-A671-006097C9A2E8")
ITAMMediaFormat : public IUnknown
{
public:
virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_MediaFormat(
/* [retval][out] */ __RPC__deref_out_opt AM_MEDIA_TYPE **ppmt) = 0;
virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_MediaFormat(
/* [in] */ __RPC__in const AM_MEDIA_TYPE *pmt) = 0;
};
#else /* C style interface */
typedef struct ITAMMediaFormatVtbl
{
BEGIN_INTERFACE
HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
__RPC__in ITAMMediaFormat * This,
/* [in] */ __RPC__in REFIID riid,
/* [annotation][iid_is][out] */
_COM_Outptr_ void **ppvObject);
ULONG ( STDMETHODCALLTYPE *AddRef )(
__RPC__in ITAMMediaFormat * This);
ULONG ( STDMETHODCALLTYPE *Release )(
__RPC__in ITAMMediaFormat * This);
/* [helpstring][id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_MediaFormat )(
__RPC__in ITAMMediaFormat * This,
/* [retval][out] */ __RPC__deref_out_opt AM_MEDIA_TYPE **ppmt);
/* [helpstring][id][propput] */ HRESULT ( STDMETHODCALLTYPE *put_MediaFormat )(
__RPC__in ITAMMediaFormat * This,
/* [in] */ __RPC__in const AM_MEDIA_TYPE *pmt);
END_INTERFACE
} ITAMMediaFormatVtbl;
interface ITAMMediaFormat
{
CONST_VTBL struct ITAMMediaFormatVtbl *lpVtbl;
};
#ifdef COBJMACROS
#define ITAMMediaFormat_QueryInterface(This,riid,ppvObject) \
( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) )
#define ITAMMediaFormat_AddRef(This) \
( (This)->lpVtbl -> AddRef(This) )
#define ITAMMediaFormat_Release(This) \
( (This)->lpVtbl -> Release(This) )
#define ITAMMediaFormat_get_MediaFormat(This,ppmt) \
( (This)->lpVtbl -> get_MediaFormat(This,ppmt) )
#define ITAMMediaFormat_put_MediaFormat(This,pmt) \
( (This)->lpVtbl -> put_MediaFormat(This,pmt) )
#endif /* COBJMACROS */
#endif /* C style interface */
#endif /* __ITAMMediaFormat_INTERFACE_DEFINED__ */
#ifndef __ITAllocatorProperties_INTERFACE_DEFINED__
#define __ITAllocatorProperties_INTERFACE_DEFINED__
/* interface ITAllocatorProperties */
/* [object][helpstring][uuid] */
EXTERN_C const IID IID_ITAllocatorProperties;
#if defined(__cplusplus) && !defined(CINTERFACE)
MIDL_INTERFACE("C1BC3C90-BCFE-11D1-9745-00C04FD91AC0")
ITAllocatorProperties : public IUnknown
{
public:
virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE SetAllocatorProperties(
/* [in] */ __RPC__in ALLOCATOR_PROPERTIES *pAllocProperties) = 0;
virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetAllocatorProperties(
/* [out] */ __RPC__out ALLOCATOR_PROPERTIES *pAllocProperties) = 0;
virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE SetAllocateBuffers(
/* [in] */ BOOL bAllocBuffers) = 0;
virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetAllocateBuffers(
/* [out] */ __RPC__out BOOL *pbAllocBuffers) = 0;
virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE SetBufferSize(
/* [in] */ DWORD BufferSize) = 0;
virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetBufferSize(
/* [out] */ __RPC__out DWORD *pBufferSize) = 0;
};
#else /* C style interface */
typedef struct ITAllocatorPropertiesVtbl
{
BEGIN_INTERFACE
HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
__RPC__in ITAllocatorProperties * This,
/* [in] */ __RPC__in REFIID riid,
/* [annotation][iid_is][out] */
_COM_Outptr_ void **ppvObject);
ULONG ( STDMETHODCALLTYPE *AddRef )(
__RPC__in ITAllocatorProperties * This);
ULONG ( STDMETHODCALLTYPE *Release )(
__RPC__in ITAllocatorProperties * This);
/* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *SetAllocatorProperties )(
__RPC__in ITAllocatorProperties * This,
/* [in] */ __RPC__in ALLOCATOR_PROPERTIES *pAllocProperties);
/* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *GetAllocatorProperties )(
__RPC__in ITAllocatorProperties * This,
/* [out] */ __RPC__out ALLOCATOR_PROPERTIES *pAllocProperties);
/* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *SetAllocateBuffers )(
__RPC__in ITAllocatorProperties * This,
/* [in] */ BOOL bAllocBuffers);
/* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *GetAllocateBuffers )(
__RPC__in ITAllocatorProperties * This,
/* [out] */ __RPC__out BOOL *pbAllocBuffers);
/* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *SetBufferSize )(
__RPC__in ITAllocatorProperties * This,
/* [in] */ DWORD BufferSize);
/* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *GetBufferSize )(
__RPC__in ITAllocatorProperties * This,
/* [out] */ __RPC__out DWORD *pBufferSize);
END_INTERFACE
} ITAllocatorPropertiesVtbl;
interface ITAllocatorProperties
{
CONST_VTBL struct ITAllocatorPropertiesVtbl *lpVtbl;
};
#ifdef COBJMACROS
#define ITAllocatorProperties_QueryInterface(This,riid,ppvObject) \
( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) )
#define ITAllocatorProperties_AddRef(This) \
( (This)->lpVtbl -> AddRef(This) )
#define ITAllocatorProperties_Release(This) \
( (This)->lpVtbl -> Release(This) )
#define ITAllocatorProperties_SetAllocatorProperties(This,pAllocProperties) \
( (This)->lpVtbl -> SetAllocatorProperties(This,pAllocProperties) )
#define ITAllocatorProperties_GetAllocatorProperties(This,pAllocProperties) \
( (This)->lpVtbl -> GetAllocatorProperties(This,pAllocProperties) )
#define ITAllocatorProperties_SetAllocateBuffers(This,bAllocBuffers) \
( (This)->lpVtbl -> SetAllocateBuffers(This,bAllocBuffers) )
#define ITAllocatorProperties_GetAllocateBuffers(This,pbAllocBuffers) \
( (This)->lpVtbl -> GetAllocateBuffers(This,pbAllocBuffers) )
#define ITAllocatorProperties_SetBufferSize(This,BufferSize) \
( (This)->lpVtbl -> SetBufferSize(This,BufferSize) )
#define ITAllocatorProperties_GetBufferSize(This,pBufferSize) \
( (This)->lpVtbl -> GetBufferSize(This,pBufferSize) )
#endif /* COBJMACROS */
#endif /* C style interface */
#endif /* __ITAllocatorProperties_INTERFACE_DEFINED__ */
/* interface __MIDL_itf_tapi3_0000_0018 */
/* [local] */
#endif /* WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) */
#pragma endregion
/* Copyright (c) Microsoft Corporation. All rights reserved.*/
#include <winapifamily.h>
#pragma region Desktop Family
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
typedef long *MSP_HANDLE;
typedef /* [public][public][public] */
enum __MIDL___MIDL_itf_tapi3_0000_0018_0001
{
ADDRESS_TERMINAL_AVAILABLE = 0,
ADDRESS_TERMINAL_UNAVAILABLE = ( ADDRESS_TERMINAL_AVAILABLE + 1 )
} MSP_ADDRESS_EVENT;
typedef /* [public][public][public] */
enum __MIDL___MIDL_itf_tapi3_0000_0018_0002
{
CALL_NEW_STREAM = 0,
CALL_STREAM_FAIL = ( CALL_NEW_STREAM + 1 ) ,
CALL_TERMINAL_FAIL = ( CALL_STREAM_FAIL + 1 ) ,
CALL_STREAM_NOT_USED = ( CALL_TERMINAL_FAIL + 1 ) ,
CALL_STREAM_ACTIVE = ( CALL_STREAM_NOT_USED + 1 ) ,
CALL_STREAM_INACTIVE = ( CALL_STREAM_ACTIVE + 1 )
} MSP_CALL_EVENT;
typedef /* [public][public][public] */
enum __MIDL___MIDL_itf_tapi3_0000_0018_0003
{
CALL_CAUSE_UNKNOWN = 0,
CALL_CAUSE_BAD_DEVICE = ( CALL_CAUSE_UNKNOWN + 1 ) ,
CALL_CAUSE_CONNECT_FAIL = ( CALL_CAUSE_BAD_DEVICE + 1 ) ,
CALL_CAUSE_LOCAL_REQUEST = ( CALL_CAUSE_CONNECT_FAIL + 1 ) ,
CALL_CAUSE_REMOTE_REQUEST = ( CALL_CAUSE_LOCAL_REQUEST + 1 ) ,
CALL_CAUSE_MEDIA_TIMEOUT = ( CALL_CAUSE_REMOTE_REQUEST + 1 ) ,
CALL_CAUSE_MEDIA_RECOVERED = ( CALL_CAUSE_MEDIA_TIMEOUT + 1 ) ,
CALL_CAUSE_QUALITY_OF_SERVICE = ( CALL_CAUSE_MEDIA_RECOVERED + 1 )
} MSP_CALL_EVENT_CAUSE;
typedef /* [public][public][public] */
enum __MIDL___MIDL_itf_tapi3_0000_0018_0004
{
ME_ADDRESS_EVENT = 0,
ME_CALL_EVENT = ( ME_ADDRESS_EVENT + 1 ) ,
ME_TSP_DATA = ( ME_CALL_EVENT + 1 ) ,
ME_PRIVATE_EVENT = ( ME_TSP_DATA + 1 ) ,
ME_ASR_TERMINAL_EVENT = ( ME_PRIVATE_EVENT + 1 ) ,
ME_TTS_TERMINAL_EVENT = ( ME_ASR_TERMINAL_EVENT + 1 ) ,
ME_FILE_TERMINAL_EVENT = ( ME_TTS_TERMINAL_EVENT + 1 ) ,
ME_TONE_TERMINAL_EVENT = ( ME_FILE_TERMINAL_EVENT + 1 )
} MSP_EVENT;
typedef /* [public][public] */ struct __MIDL___MIDL_itf_tapi3_0000_0018_0005
{
DWORD dwSize;
MSP_EVENT Event;
MSP_HANDLE hCall;
/* [switch_is][switch_type] */ union
{
/* [case()] */ struct
{
MSP_ADDRESS_EVENT Type;
ITTerminal *pTerminal;
} MSP_ADDRESS_EVENT_INFO;
/* [case()] */ struct
{
MSP_CALL_EVENT Type;
MSP_CALL_EVENT_CAUSE Cause;
ITStream *pStream;
ITTerminal *pTerminal;
HRESULT hrError;
} MSP_CALL_EVENT_INFO;
/* [case()] */ struct
{
DWORD dwBufferSize;
BYTE pBuffer[ 1 ];
} MSP_TSP_DATA;
/* [case()] */ struct
{
IDispatch *pEvent;
long lEventCode;
} MSP_PRIVATE_EVENT_INFO;
/* [case()] */ struct
{
ITTerminal *pParentFileTerminal;
ITFileTrack *pFileTrack;
TERMINAL_MEDIA_STATE TerminalMediaState;
FT_STATE_EVENT_CAUSE ftecEventCause;
HRESULT hrErrorCode;
} MSP_FILE_TERMINAL_EVENT_INFO;
/* [case()] */ struct
{
ITTerminal *pASRTerminal;
HRESULT hrErrorCode;
} MSP_ASR_TERMINAL_EVENT_INFO;
/* [case()] */ struct
{
ITTerminal *pTTSTerminal;
HRESULT hrErrorCode;
} MSP_TTS_TERMINAL_EVENT_INFO;
/* [case()] */ struct
{
ITTerminal *pToneTerminal;
HRESULT hrErrorCode;
} MSP_TONE_TERMINAL_EVENT_INFO;
} ;
} MSP_EVENT_INFO;
extern RPC_IF_HANDLE __MIDL_itf_tapi3_0000_0018_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_tapi3_0000_0018_v0_0_s_ifspec;
#ifndef __ITPluggableTerminalEventSink_INTERFACE_DEFINED__
#define __ITPluggableTerminalEventSink_INTERFACE_DEFINED__
/* interface ITPluggableTerminalEventSink */
/* [object][unique][helpstring][uuid] */
EXTERN_C const IID IID_ITPluggableTerminalEventSink;
#if defined(__cplusplus) && !defined(CINTERFACE)
MIDL_INTERFACE("6E0887BE-BA1A-492e-BD10-4020EC5E33E0")
ITPluggableTerminalEventSink : public IUnknown
{
public:
virtual HRESULT STDMETHODCALLTYPE FireEvent(
/* [in] */ __RPC__in const MSP_EVENT_INFO *pMspEventInfo) = 0;
};
#else /* C style interface */
typedef struct ITPluggableTerminalEventSinkVtbl
{
BEGIN_INTERFACE
HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
__RPC__in ITPluggableTerminalEventSink * This,
/* [in] */ __RPC__in REFIID riid,
/* [annotation][iid_is][out] */
_COM_Outptr_ void **ppvObject);
ULONG ( STDMETHODCALLTYPE *AddRef )(
__RPC__in ITPluggableTerminalEventSink * This);
ULONG ( STDMETHODCALLTYPE *Release )(
__RPC__in ITPluggableTerminalEventSink * This);
HRESULT ( STDMETHODCALLTYPE *FireEvent )(
__RPC__in ITPluggableTerminalEventSink * This,
/* [in] */ __RPC__in const MSP_EVENT_INFO *pMspEventInfo);
END_INTERFACE
} ITPluggableTerminalEventSinkVtbl;
interface ITPluggableTerminalEventSink
{
CONST_VTBL struct ITPluggableTerminalEventSinkVtbl *lpVtbl;
};
#ifdef COBJMACROS
#define ITPluggableTerminalEventSink_QueryInterface(This,riid,ppvObject) \
( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) )
#define ITPluggableTerminalEventSink_AddRef(This) \
( (This)->lpVtbl -> AddRef(This) )
#define ITPluggableTerminalEventSink_Release(This) \
( (This)->lpVtbl -> Release(This) )
#define ITPluggableTerminalEventSink_FireEvent(This,pMspEventInfo) \
( (This)->lpVtbl -> FireEvent(This,pMspEventInfo) )
#endif /* COBJMACROS */
#endif /* C style interface */
#endif /* __ITPluggableTerminalEventSink_INTERFACE_DEFINED__ */
#ifndef __ITPluggableTerminalEventSinkRegistration_INTERFACE_DEFINED__
#define __ITPluggableTerminalEventSinkRegistration_INTERFACE_DEFINED__
/* interface ITPluggableTerminalEventSinkRegistration */
/* [object][unique][helpstring][uuid] */
EXTERN_C const IID IID_ITPluggableTerminalEventSinkRegistration;
#if defined(__cplusplus) && !defined(CINTERFACE)
MIDL_INTERFACE("F7115709-A216-4957-A759-060AB32A90D1")
ITPluggableTerminalEventSinkRegistration : public IUnknown
{
public:
virtual HRESULT STDMETHODCALLTYPE RegisterSink(
/* [in] */ __RPC__in_opt ITPluggableTerminalEventSink *pEventSink) = 0;
virtual HRESULT STDMETHODCALLTYPE UnregisterSink( void) = 0;
};
#else /* C style interface */
typedef struct ITPluggableTerminalEventSinkRegistrationVtbl
{
BEGIN_INTERFACE
HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
__RPC__in ITPluggableTerminalEventSinkRegistration * This,
/* [in] */ __RPC__in REFIID riid,
/* [annotation][iid_is][out] */
_COM_Outptr_ void **ppvObject);
ULONG ( STDMETHODCALLTYPE *AddRef )(
__RPC__in ITPluggableTerminalEventSinkRegistration * This);
ULONG ( STDMETHODCALLTYPE *Release )(
__RPC__in ITPluggableTerminalEventSinkRegistration * This);
HRESULT ( STDMETHODCALLTYPE *RegisterSink )(
__RPC__in ITPluggableTerminalEventSinkRegistration * This,
/* [in] */ __RPC__in_opt ITPluggableTerminalEventSink *pEventSink);
HRESULT ( STDMETHODCALLTYPE *UnregisterSink )(
__RPC__in ITPluggableTerminalEventSinkRegistration * This);
END_INTERFACE
} ITPluggableTerminalEventSinkRegistrationVtbl;
interface ITPluggableTerminalEventSinkRegistration
{
CONST_VTBL struct ITPluggableTerminalEventSinkRegistrationVtbl *lpVtbl;
};
#ifdef COBJMACROS
#define ITPluggableTerminalEventSinkRegistration_QueryInterface(This,riid,ppvObject) \
( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) )
#define ITPluggableTerminalEventSinkRegistration_AddRef(This) \
( (This)->lpVtbl -> AddRef(This) )
#define ITPluggableTerminalEventSinkRegistration_Release(This) \
( (This)->lpVtbl -> Release(This) )
#define ITPluggableTerminalEventSinkRegistration_RegisterSink(This,pEventSink) \
( (This)->lpVtbl -> RegisterSink(This,pEventSink) )
#define ITPluggableTerminalEventSinkRegistration_UnregisterSink(This) \
( (This)->lpVtbl -> UnregisterSink(This) )
#endif /* COBJMACROS */
#endif /* C style interface */
#endif /* __ITPluggableTerminalEventSinkRegistration_INTERFACE_DEFINED__ */
#ifndef __ITMSPAddress_INTERFACE_DEFINED__
#define __ITMSPAddress_INTERFACE_DEFINED__
/* interface ITMSPAddress */
/* [object][unique][helpstring][uuid] */
EXTERN_C const IID IID_ITMSPAddress;
#if defined(__cplusplus) && !defined(CINTERFACE)
MIDL_INTERFACE("EE3BD600-3868-11D2-A045-00C04FB6809F")
ITMSPAddress : public IUnknown
{
public:
virtual HRESULT STDMETHODCALLTYPE Initialize(
/* [in] */ __RPC__in MSP_HANDLE hEvent) = 0;
virtual HRESULT STDMETHODCALLTYPE Shutdown( void) = 0;
virtual HRESULT STDMETHODCALLTYPE CreateMSPCall(
/* [in] */ __RPC__in MSP_HANDLE hCall,
/* [in] */ DWORD dwReserved,
/* [in] */ DWORD dwMediaType,
/* [in] */ __RPC__in_opt IUnknown *pOuterUnknown,
/* [out] */ __RPC__deref_out_opt IUnknown **ppStreamControl) = 0;
virtual HRESULT STDMETHODCALLTYPE ShutdownMSPCall(
/* [in] */ __RPC__in_opt IUnknown *pStreamControl) = 0;
virtual HRESULT STDMETHODCALLTYPE ReceiveTSPData(
/* [in] */ __RPC__in_opt IUnknown *pMSPCall,
/* [size_is][in] */ __RPC__in_ecount_full(dwSize) BYTE *pBuffer,
/* [in] */ DWORD dwSize) = 0;
virtual HRESULT STDMETHODCALLTYPE GetEvent(
/* [out][in] */ __RPC__inout DWORD *pdwSize,
/* [size_is][out][in] */ __RPC__inout_ecount_full(*pdwSize) byte *pEventBuffer) = 0;
};
#else /* C style interface */
typedef struct ITMSPAddressVtbl
{
BEGIN_INTERFACE
HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
__RPC__in ITMSPAddress * This,
/* [in] */ __RPC__in REFIID riid,
/* [annotation][iid_is][out] */
_COM_Outptr_ void **ppvObject);
ULONG ( STDMETHODCALLTYPE *AddRef )(
__RPC__in ITMSPAddress * This);
ULONG ( STDMETHODCALLTYPE *Release )(
__RPC__in ITMSPAddress * This);
HRESULT ( STDMETHODCALLTYPE *Initialize )(
__RPC__in ITMSPAddress * This,
/* [in] */ __RPC__in MSP_HANDLE hEvent);
HRESULT ( STDMETHODCALLTYPE *Shutdown )(
__RPC__in ITMSPAddress * This);
HRESULT ( STDMETHODCALLTYPE *CreateMSPCall )(
__RPC__in ITMSPAddress * This,
/* [in] */ __RPC__in MSP_HANDLE hCall,
/* [in] */ DWORD dwReserved,
/* [in] */ DWORD dwMediaType,
/* [in] */ __RPC__in_opt IUnknown *pOuterUnknown,
/* [out] */ __RPC__deref_out_opt IUnknown **ppStreamControl);
HRESULT ( STDMETHODCALLTYPE *ShutdownMSPCall )(
__RPC__in ITMSPAddress * This,
/* [in] */ __RPC__in_opt IUnknown *pStreamControl);
HRESULT ( STDMETHODCALLTYPE *ReceiveTSPData )(
__RPC__in ITMSPAddress * This,
/* [in] */ __RPC__in_opt IUnknown *pMSPCall,
/* [size_is][in] */ __RPC__in_ecount_full(dwSize) BYTE *pBuffer,
/* [in] */ DWORD dwSize);
HRESULT ( STDMETHODCALLTYPE *GetEvent )(
__RPC__in ITMSPAddress * This,
/* [out][in] */ __RPC__inout DWORD *pdwSize,
/* [size_is][out][in] */ __RPC__inout_ecount_full(*pdwSize) byte *pEventBuffer);
END_INTERFACE
} ITMSPAddressVtbl;
interface ITMSPAddress
{
CONST_VTBL struct ITMSPAddressVtbl *lpVtbl;
};
#ifdef COBJMACROS
#define ITMSPAddress_QueryInterface(This,riid,ppvObject) \
( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) )
#define ITMSPAddress_AddRef(This) \
( (This)->lpVtbl -> AddRef(This) )
#define ITMSPAddress_Release(This) \
( (This)->lpVtbl -> Release(This) )
#define ITMSPAddress_Initialize(This,hEvent) \
( (This)->lpVtbl -> Initialize(This,hEvent) )
#define ITMSPAddress_Shutdown(This) \
( (This)->lpVtbl -> Shutdown(This) )
#define ITMSPAddress_CreateMSPCall(This,hCall,dwReserved,dwMediaType,pOuterUnknown,ppStreamControl) \
( (This)->lpVtbl -> CreateMSPCall(This,hCall,dwReserved,dwMediaType,pOuterUnknown,ppStreamControl) )
#define ITMSPAddress_ShutdownMSPCall(This,pStreamControl) \
( (This)->lpVtbl -> ShutdownMSPCall(This,pStreamControl) )
#define ITMSPAddress_ReceiveTSPData(This,pMSPCall,pBuffer,dwSize) \
( (This)->lpVtbl -> ReceiveTSPData(This,pMSPCall,pBuffer,dwSize) )
#define ITMSPAddress_GetEvent(This,pdwSize,pEventBuffer) \
( (This)->lpVtbl -> GetEvent(This,pdwSize,pEventBuffer) )
#endif /* COBJMACROS */
#endif /* C style interface */
#endif /* __ITMSPAddress_INTERFACE_DEFINED__ */
/* interface __MIDL_itf_tapi3_0000_0021 */
/* [local] */
#endif /* WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) */
#pragma endregion
extern RPC_IF_HANDLE __MIDL_itf_tapi3_0000_0021_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_tapi3_0000_0021_v0_0_s_ifspec;
#ifndef __TAPI3Lib_LIBRARY_DEFINED__
#define __TAPI3Lib_LIBRARY_DEFINED__
/* library TAPI3Lib */
/* [helpstring][version][uuid] */
EXTERN_C const IID LIBID_TAPI3Lib;
#ifndef __ITTAPIDispatchEventNotification_DISPINTERFACE_DEFINED__
#define __ITTAPIDispatchEventNotification_DISPINTERFACE_DEFINED__
/* dispinterface ITTAPIDispatchEventNotification */
/* [helpstring][uuid] */
EXTERN_C const IID DIID_ITTAPIDispatchEventNotification;
#if defined(__cplusplus) && !defined(CINTERFACE)
MIDL_INTERFACE("9f34325b-7e62-11d2-9457-00c04f8ec888")
ITTAPIDispatchEventNotification : public IDispatch
{
};
#else /* C style interface */
typedef struct ITTAPIDispatchEventNotificationVtbl
{
BEGIN_INTERFACE
HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
__RPC__in ITTAPIDispatchEventNotification * This,
/* [in] */ __RPC__in REFIID riid,
/* [annotation][iid_is][out] */
_COM_Outptr_ void **ppvObject);
ULONG ( STDMETHODCALLTYPE *AddRef )(
__RPC__in ITTAPIDispatchEventNotification * This);
ULONG ( STDMETHODCALLTYPE *Release )(
__RPC__in ITTAPIDispatchEventNotification * This);
HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )(
__RPC__in ITTAPIDispatchEventNotification * This,
/* [out] */ __RPC__out UINT *pctinfo);
HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )(
__RPC__in ITTAPIDispatchEventNotification * This,
/* [in] */ UINT iTInfo,
/* [in] */ LCID lcid,
/* [out] */ __RPC__deref_out_opt ITypeInfo **ppTInfo);
HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )(
__RPC__in ITTAPIDispatchEventNotification * This,
/* [in] */ __RPC__in REFIID riid,
/* [size_is][in] */ __RPC__in_ecount_full(cNames) LPOLESTR *rgszNames,
/* [range][in] */ __RPC__in_range(0,16384) UINT cNames,
/* [in] */ LCID lcid,
/* [size_is][out] */ __RPC__out_ecount_full(cNames) DISPID *rgDispId);
/* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )(
ITTAPIDispatchEventNotification * This,
/* [annotation][in] */
_In_ DISPID dispIdMember,
/* [annotation][in] */
_In_ REFIID riid,
/* [annotation][in] */
_In_ LCID lcid,
/* [annotation][in] */
_In_ WORD wFlags,
/* [annotation][out][in] */
_In_ DISPPARAMS *pDispParams,
/* [annotation][out] */
_Out_opt_ VARIANT *pVarResult,
/* [annotation][out] */
_Out_opt_ EXCEPINFO *pExcepInfo,
/* [annotation][out] */
_Out_opt_ UINT *puArgErr);
END_INTERFACE
} ITTAPIDispatchEventNotificationVtbl;
interface ITTAPIDispatchEventNotification
{
CONST_VTBL struct ITTAPIDispatchEventNotificationVtbl *lpVtbl;
};
#ifdef COBJMACROS
#define ITTAPIDispatchEventNotification_QueryInterface(This,riid,ppvObject) \
( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) )
#define ITTAPIDispatchEventNotification_AddRef(This) \
( (This)->lpVtbl -> AddRef(This) )
#define ITTAPIDispatchEventNotification_Release(This) \
( (This)->lpVtbl -> Release(This) )
#define ITTAPIDispatchEventNotification_GetTypeInfoCount(This,pctinfo) \
( (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) )
#define ITTAPIDispatchEventNotification_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \
( (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) )
#define ITTAPIDispatchEventNotification_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \
( (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) )
#define ITTAPIDispatchEventNotification_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \
( (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) )
#endif /* COBJMACROS */
#endif /* C style interface */
#endif /* __ITTAPIDispatchEventNotification_DISPINTERFACE_DEFINED__ */
EXTERN_C const CLSID CLSID_TAPI;
#ifdef __cplusplus
class DECLSPEC_UUID("21D6D48E-A88B-11D0-83DD-00AA003CCABD")
TAPI;
#endif
EXTERN_C const CLSID CLSID_DispatchMapper;
#ifdef __cplusplus
class DECLSPEC_UUID("E9225296-C759-11d1-A02B-00C04FB6809F")
DispatchMapper;
#endif
EXTERN_C const CLSID CLSID_RequestMakeCall;
#ifdef __cplusplus
class DECLSPEC_UUID("AC48FFE0-F8C4-11d1-A030-00C04FB6809F")
RequestMakeCall;
#endif
#ifndef __TapiConstants_MODULE_DEFINED__
#define __TapiConstants_MODULE_DEFINED__
/* module TapiConstants */
/* [helpstring][dllname][uuid] */
const BSTR CLSID_String_VideoWindowTerm = L"{F7438990-D6EB-11D0-82A6-00AA00B5CA1B}";
const BSTR CLSID_String_VideoInputTerminal = L"{AAF578EC-DC70-11D0-8ED3-00C04FB6809F}";
const BSTR CLSID_String_HandsetTerminal = L"{AAF578EB-DC70-11D0-8ED3-00C04FB6809F}";
const BSTR CLSID_String_HeadsetTerminal = L"{AAF578ED-DC70-11D0-8ED3-00C04FB6809F}";
const BSTR CLSID_String_SpeakerphoneTerminal = L"{AAF578EE-DC70-11D0-8ED3-00C04FB6809F}";
const BSTR CLSID_String_MicrophoneTerminal = L"{AAF578EF-DC70-11D0-8ED3-00C04FB6809F}";
const BSTR CLSID_String_SpeakersTerminal = L"{AAF578F0-DC70-11D0-8ED3-00C04FB6809F}";
const BSTR CLSID_String_MediaStreamTerminal = L"{E2F7AEF7-4971-11D1-A671-006097C9A2E8}";
const BSTR CLSID_String_FileRecordingTerminal = L"{521F3D06-C3D0-4511-8617-86B9A783DA77}";
const BSTR CLSID_String_FilePlaybackTerminal = L"{0CB9914C-79CD-47DC-ADB0-327F47CEFB20}";
const BSTR TAPIPROTOCOL_String_PSTN = L"{831CE2D6-83B5-11D1-BB5C-00C04FB6809F}";
const BSTR TAPIPROTOCOL_String_H323 = L"{831CE2D7-83B5-11D1-BB5C-00C04FB6809F}";
const BSTR TAPIPROTOCOL_String_Multicast = L"{831CE2D8-83B5-11D1-BB5C-00C04FB6809F}";
const long LINEADDRESSTYPE_PHONENUMBER = 0x1;
const long LINEADDRESSTYPE_SDP = 0x2;
const long LINEADDRESSTYPE_EMAILNAME = 0x4;
const long LINEADDRESSTYPE_DOMAINNAME = 0x8;
const long LINEADDRESSTYPE_IPADDRESS = 0x10;
const long LINEDIGITMODE_PULSE = 0x1;
const long LINEDIGITMODE_DTMF = 0x2;
const long LINEDIGITMODE_DTMFEND = 0x4;
const long TAPIMEDIATYPE_AUDIO = 0x8;
const long TAPIMEDIATYPE_VIDEO = 0x8000;
const long TAPIMEDIATYPE_DATAMODEM = 0x10;
const long TAPIMEDIATYPE_G3FAX = 0x20;
const long TAPIMEDIATYPE_MULTITRACK = 0x10000;
#endif /* __TapiConstants_MODULE_DEFINED__ */
#endif /* __TAPI3Lib_LIBRARY_DEFINED__ */
/* interface __MIDL_itf_tapi3_0000_0023 */
/* [local] */
#define TAPI_CURRENT_VERSION 0x00030001
#include <tapi.h>
#include <tapi3err.h>
#endif /* WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) */
#pragma endregion
extern RPC_IF_HANDLE __MIDL_itf_tapi3_0000_0023_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_tapi3_0000_0023_v0_0_s_ifspec;
/* Additional Prototypes for ALL interfaces */
unsigned long __RPC_USER BSTR_UserSize( __RPC__in unsigned long *, unsigned long , __RPC__in BSTR * );
unsigned char * __RPC_USER BSTR_UserMarshal( __RPC__in unsigned long *, __RPC__inout_xcount(0) unsigned char *, __RPC__in BSTR * );
unsigned char * __RPC_USER BSTR_UserUnmarshal(__RPC__in unsigned long *, __RPC__in_xcount(0) unsigned char *, __RPC__out BSTR * );
void __RPC_USER BSTR_UserFree( __RPC__in unsigned long *, __RPC__in BSTR * );
unsigned long __RPC_USER VARIANT_UserSize( __RPC__in unsigned long *, unsigned long , __RPC__in VARIANT * );
unsigned char * __RPC_USER VARIANT_UserMarshal( __RPC__in unsigned long *, __RPC__inout_xcount(0) unsigned char *, __RPC__in VARIANT * );
unsigned char * __RPC_USER VARIANT_UserUnmarshal(__RPC__in unsigned long *, __RPC__in_xcount(0) unsigned char *, __RPC__out VARIANT * );
void __RPC_USER VARIANT_UserFree( __RPC__in unsigned long *, __RPC__in VARIANT * );
unsigned long __RPC_USER BSTR_UserSize64( __RPC__in unsigned long *, unsigned long , __RPC__in BSTR * );
unsigned char * __RPC_USER BSTR_UserMarshal64( __RPC__in unsigned long *, __RPC__inout_xcount(0) unsigned char *, __RPC__in BSTR * );
unsigned char * __RPC_USER BSTR_UserUnmarshal64(__RPC__in unsigned long *, __RPC__in_xcount(0) unsigned char *, __RPC__out BSTR * );
void __RPC_USER BSTR_UserFree64( __RPC__in unsigned long *, __RPC__in BSTR * );
unsigned long __RPC_USER VARIANT_UserSize64( __RPC__in unsigned long *, unsigned long , __RPC__in VARIANT * );
unsigned char * __RPC_USER VARIANT_UserMarshal64( __RPC__in unsigned long *, __RPC__inout_xcount(0) unsigned char *, __RPC__in VARIANT * );
unsigned char * __RPC_USER VARIANT_UserUnmarshal64(__RPC__in unsigned long *, __RPC__in_xcount(0) unsigned char *, __RPC__out VARIANT * );
void __RPC_USER VARIANT_UserFree64( __RPC__in unsigned long *, __RPC__in VARIANT * );
/* end of Additional Prototypes */
#ifdef __cplusplus
}
#endif
#endif
| [
"trent@trent.me"
] | trent@trent.me |
fbc868b1c4a7997074f32e87fbc1cb0cdd4baab6 | e0b6e0eda0a25af6d023486d687f67f3c52df321 | /src/cluster_kf.cpp | e5291a79ebc5eafd26723c5cd7142f7669c3ced6 | [] | no_license | Sadaku1993/ekf_tracking | ef5d48f6081d947cf91177a91dfe8a9ec7b8b15f | 347e117b2354efddfe5d97ae0b630aa590dfe2d2 | refs/heads/master | 2020-03-16T00:58:42.048425 | 2018-02-04T17:34:40 | 2018-02-04T17:34:40 | 132,429,994 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 9,271 | cpp |
//
// src: cluster_kf.cpp
//
// last update: '18.1.19
// author: matchey
//
// memo:
// tracking対象のそれぞれのクラスタclass
//
#include <tf/transform_broadcaster.h>
#include <Eigen/Dense> // for EigenSolver
#include "mmath/common/angles.h"
#include "mmath/binarion.h"
#include "ekf_tracking/cluster_kf.h"
using namespace std;
Cluster::Cluster()
: likelihood_(1.0), lifetime(10), age_(0), totalVisibleCount_(0), consecutiveInvisibleCount_(0),
frame_id("/map")
//, vx(x(0)), vy(x(1))
{
geometry_msgs::Point p;
p.x = p.y = 0.0;
initialize(p, 10.0, 0.01);
}
Cluster::Cluster(const Cluster& cluster)
{
likelihood_ = cluster.likelihood_;
x = cluster.x;
P = cluster.P;
R = cluster.R;
obs = cluster.obs;
y = cluster.y;
lifetime = cluster.lifetime;
age_ = cluster.age_;
totalVisibleCount_ = cluster.totalVisibleCount_;
consecutiveInvisibleCount_ = cluster.consecutiveInvisibleCount_;
current_time = cluster.current_time;
last_time = cluster.last_time;
frame_id = cluster.frame_id;
// pca は共有できない
}
Cluster::Cluster(const pcl::PointXYZ &p, const double &sig_p, const double &sig_r)
: likelihood_(1.0), lifetime(10), age_(0), totalVisibleCount_(0), consecutiveInvisibleCount_(0),
frame_id("/map")
//, vx(x(0)), vy(x(1))
{
initialize(p, sig_p, sig_r);
}
void Cluster::measurementUpdate(const pcl::PointXYZ &p)
{
const int N = 10; //pcaで貯める点の数
pca.setPoints2d(p, N);
obs << p.x, p.y;
Eigen::Matrix4d I = Eigen::Matrix4d::Identity();
Eigen::Matrix<double, 2, 4> H = kf.H(); //観測モデルのヤコビアン
Eigen::Vector2d e = obs - H * x; //観測残差、innovation
Eigen::Matrix2d S = H * P * H.transpose() + R; // 観測残差の共分散
Eigen::Matrix<double, 4, 2> K = P * H.transpose() * S.inverse(); // 最適 カルマンゲイン
x = x + K * e; // 更新された状態の推定値
P = (I - K * H) * P; // 更新された誤差の共分散
// cout << "K :\n" << K << endl;
totalVisibleCount_++;
consecutiveInvisibleCount_ = 0;
// cout << "updated :\n" << x << endl;
}
void Cluster::predict()
{
current_time = ros::Time::now();
double dt = (current_time - last_time).toSec();
last_time = current_time;
Eigen::Matrix4d F = kf.F(dt); // 動作モデルのヤコビアン
// Eigen::Matrix<double, 4, 2> G = kf.G(dt); // ノイズ(ax, ay)に関するモデル
// Eigen::Matrix4d Q = kf.Q(dt); // ノイズモデルの共分散行列
Eigen::Matrix4d Q = kf.covGw(dt); // G * Q * G.transpose();
x = F * x; // 時間発展動作モデル
P = F * P * F.transpose() + Q;
setY();
age_++;
consecutiveInvisibleCount_++;
// cout << "predicted : \n" << x << endl;
}
void Cluster::setParams()
{
}
void Cluster::setFrameID(const string& frame_name)
{
frame_id = frame_name;
}
void Cluster::setLifetime(const int life)
{
lifetime = life;
}
void Cluster::setLikelihood(const double &sigma)
{
likelihood_ = sigma;
}
int Cluster::age() const
{
return age_;
}
int Cluster::totalVisibleCount() const
{
return totalVisibleCount_;
}
int Cluster::consecutiveInvisibleCount() const
{
return consecutiveInvisibleCount_;
}
int Cluster::getLifetime()
{
return lifetime;
}
double Cluster::getDist(const geometry_msgs::Point &point) const
{
pcl::PointXYZ p;
p.x = point.x;
p.y = point.y;
p.z = point.z;
return getDist(p);
}
double Cluster::getDist(const pcl::PointXYZ &p) const
{
return sqrt(pow(p.x - x(0), 2) + pow(p.y - x(1), 2));
}
double Cluster::getDist2ObsLast(const pcl::PointXYZ &p) const
{
return sqrt(pow(p.x - obs(0), 2) + pow(p.y - obs(1), 2));
}
void Cluster::getPoint(pcl::PointXYZ &p)
{
p.x = x(0);
p.y = x(1);
p.z = 0.0;
}
void Cluster::getPoint(pcl::PointCloud<pcl::PointXYZ>::Ptr &pc)
{
pcl::PointXYZ p;
p.x = x(0);
p.y = x(1);
p.z = 0.0;
pc->points.push_back(p);
}
double Cluster::likelihood()
{
return likelihood_;
}
double Cluster::getLikelihood()
{
double a, b;
Eigen::Matrix2d m = P.block<2, 2>(0, 0);
Eigen::EigenSolver<Eigen::Matrix2d> es(m);
if(!es.info()){ // == "Success"
Eigen::Vector2d values = es.eigenvalues().real();
double lambda1, lambda2;
double kai2 = 9.21034; // χ² (chi-square) distribution 99% (95%:5.99146)
if(values(0) < values(1)){
lambda1 = values(1);
lambda2 = values(0);
}else{
lambda1 = values(0);
lambda2 = values(1);
}
a = sqrt(kai2 * lambda1);
b = sqrt(kai2 * lambda2);
if(a*b < 1e-5){
likelihood_ = 1e6;
}else{
likelihood_ = 10 / (a * b);
}
}else{
cerr << "Eigen solver error info : " << es.info() << endl;
}
return likelihood_;
}
void Cluster::getTrackingPoint(pcl::PointCloud<pcl::PointNormal>::Ptr &pc, const int id)
{
pcl::PointNormal pn;
pn.x = x(0);
pn.y = x(1);
pn.z = 0.0;
pn.curvature = id;
pc->points.push_back(pn);
}
void Cluster::getVelocityArrow(visualization_msgs::MarkerArray &markers, const int id)
{
visualization_msgs::Marker arrow;
// marker.header.frame_id = "/map";
arrow.header.stamp = ros::Time::now();
arrow.header.frame_id = frame_id;
arrow.ns = "/cluster/arrow";
arrow.id = id;
arrow.type = visualization_msgs::Marker::ARROW;
arrow.action = visualization_msgs::Marker::ADD;
// arrow.action = visualization_msgs::Marker::DELETE;
// arrow.action = visualization_msgs::Marker::DELETEALL;
arrow.pose.position.x = x(0);
arrow.pose.position.y = x(1);
arrow.pose.position.z = 0.0;
geometry_msgs::Quaternion odom_quat = tf::createQuaternionMsgFromYaw(y(1));
arrow.pose.orientation = odom_quat;
// arrow.scale.x = 1.0; // length
arrow.scale.x = y(0); // length
arrow.scale.y = 0.1; // width
arrow.scale.z = 0.1; // height
arrow.color.r = 1.0f;
arrow.color.g = 0.0f;
arrow.color.b = 0.9f;
arrow.color.a = 0.6;
arrow.lifetime = ros::Duration(1.0);
markers.markers.push_back(arrow);
}
void Cluster::getErrorEllipse(visualization_msgs::MarkerArray &markers, const int id)
{
visualization_msgs::Marker ellipse;
ellipse.header.stamp = ros::Time::now();
ellipse.header.frame_id = frame_id;
ellipse.ns = "/cluster/ellipse";
ellipse.id = id;
ellipse.type = visualization_msgs::Marker::CYLINDER;
ellipse.action = visualization_msgs::Marker::ADD;
double a, b;
geometry_msgs::Quaternion odom_quat = tf::createQuaternionMsgFromYaw(0.0);
Eigen::Matrix2d m = P.block<2, 2>(0, 0);
Eigen::EigenSolver<Eigen::Matrix2d> es(m);
if(!es.info()){ // == "Success"
Eigen::Vector2d values = es.eigenvalues().real();
Eigen::Matrix2d vectors = es.eigenvectors().real();
Eigen::Vector2d vec;
double lambda1, lambda2, theta;
theta = 0.0;
double kai2 = 9.21034; // χ² (chi-square) distribution 99% (95%:5.99146)
if(values(0) < values(1)){
lambda1 = values(1);
lambda2 = values(0);
vec = vectors.col(1);
}else{
lambda1 = values(0);
lambda2 = values(1);
vec = vectors.col(0);
}
theta = atan2(vec(1), vec(0));
odom_quat = tf::createQuaternionMsgFromYaw(theta);
a = sqrt(kai2 * lambda1);
b = sqrt(kai2 * lambda2);
if(a*b < 1e-5){
likelihood_ = 1e6;
}else{
likelihood_ = 10 / (a * b);
}
ellipse.pose.position.x = x(0);
ellipse.pose.position.y = x(1);
ellipse.pose.position.z = 0.0;
ellipse.pose.orientation = odom_quat;
ellipse.scale.x = a;
ellipse.scale.y = b;
ellipse.scale.z = 0.01;
ellipse.color.r = 0.0f;
ellipse.color.g = 1.0f;
ellipse.color.b = 1.0f;
ellipse.color.a = 0.3;
ellipse.lifetime = ros::Duration(1.0);
markers.markers.push_back(ellipse);
}else{
cerr << "Eigen solver error info : " << es.info() << endl;
}
}
void Cluster::getLinkLines(visualization_msgs::Marker& link, const pcl::PointXYZ& tgt)
{
geometry_msgs::Point p;
p.x = obs(0);
p.y = obs(1);
// p.x = x(0);
// p.y = x(1);
link.points.push_back(p);
p.x = tgt.x + 0.5;
p.y = tgt.y + 0.5;
link.points.push_back(p);
}
ostream& operator << (ostream &os, const Cluster &cluster)
{
os << " position : (" << cluster.x(0) << ", " << cluster.x(1) << ")\n"
<< " likelihood : " << cluster.likelihood_ << ", "
<< " age : " << cluster.age_ << ", "
<< " totalVisibleCount : " << cluster.totalVisibleCount_ << ", "
<< " consecutiveInvisibleCount : " << cluster.consecutiveInvisibleCount_ << endl;
return os;
}
///////////////// private //////////////////////
template<class T_p>
void Cluster::initialize(const T_p& p, const double &sig_p, const double &sig_r)
{
current_time = ros::Time::now();
last_time = ros::Time::now();
x << p.x, p.y, 0.0, 0.0;
obs << p.x, p.y;
P << sig_p, 0, 0, 0,
0, sig_p, 0, 0,
0, 0, 100.0, 0,
0, 0, 0, 100.0;
R << sig_r, 0,
0, sig_r;
}
void Cluster::setY()
{
// static Differential v(x(0), x(1)); // インスタンスごとではなくclassごとに共有されてしまう
// y(0) = v.get(x(0), x(1));
// v_x = vx.get(x(0));
// v_y = vy.get(x(1));
y(0) = sqrt(pow(x(2), 2) + pow(x(3), 2));
// y(0) = sqrt(pow(v_x, 2) + pow(v_y, 2));
if(y(0) > 0.09){ // (1km/h : 0.2777m/s)
Eigen::Vector3d vec = pca.vector(0); // 移動の向き(vec --> θ)
// y(1) = atan2(v_y, v_x);
y(1) = atan2(vec(1), vec(0));
double div = Binarion::deviation(y(1), pca.direction());
if(div > M_PI / 2){
y(1) += M_PI;
}else if(div < - M_PI / 2){
y(1) -= M_PI;
}
}
}
| [
"matchey@example.com"
] | matchey@example.com |
ebfd2d62625fe890c2f6241cb3511a59390cc029 | ed9278ce7ba6e05166b7d65f995e1f0b2720b2d6 | /src/misc/StreamAsString.h | 73eecedcb7f6cb883d4e3ca21f544581b7a02986 | [] | no_license | dwks/crystallizer | 10858a923e6768ccf36eb23b601aa4714f5cd4fd | 4a962c63bc55a952e3fbe1dfe2d8ce18f8cf154f | refs/heads/master | 2021-03-12T21:49:22.114468 | 2011-07-17T23:13:47 | 2011-07-17T23:13:47 | 2,062,887 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,536 | h | #ifndef SERIALIZER_MISC__STREAM_AS_STRING_H
#define SERIALIZER_MISC__STREAM_AS_STRING_H
#include <sstream>
#include <string>
namespace Crystallizer {
namespace Misc {
/** A simple class which in effect that adds an insertion operator, <<, to the
std::string class, as users of streams such as cout or stringstream expect.
This class can be used as a temporary object in places where an ordinary
string would be expected; for example:
void print(std::string str);
print(StreamAsString() << "Answer = " << 42);
This implementation is quite efficient, only converting its internal
stringstream to a string when operator std::string() is called.
*/
class StreamAsString {
private:
/** The internal stringstream used to implement the insertion operator <<.
*/
std::ostringstream stream;
protected:
std::ostringstream &getStream() { return stream; }
const std::ostringstream &getStream() const { return stream; }
public:
/** Adds an object to the end of the internal stringstream.
*/
template <typename T>
StreamAsString &operator << (const T &data);
/** Converts the internal stringstream to an std::string automatically.
*/
operator std::string() const;
};
template <typename T>
StreamAsString &StreamAsString::operator << (const T &data) {
getStream() << data;
return *this;
}
inline StreamAsString::operator std::string() const {
return getStream().str();
}
} // namespace Misc
} // namespace Crystallizer
#endif
| [
"dwks42@gmail.com"
] | dwks42@gmail.com |
12324722cfeedb598d2d322d566a9ed8ef9096fa | 3d90aabc323951a55adadf01b9f0e657233ec7df | /ESP_RELAY.ino | 85188649988b8479595c5eb7dac758a1d51bc0b1 | [] | no_license | LaurentChevalier/ESP_RELAY | 71dd587ea957687b06b47017f71058179f2819f1 | 1d2955179876107243019e36ac0567526dfa44a7 | refs/heads/master | 2023-01-06T16:53:03.309514 | 2020-11-02T22:45:10 | 2020-11-02T22:45:10 | 309,510,064 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,732 | ino | #include <ESP8266WiFi.h>
// Esp8266 pinouts
#define ESP8266_GPIO2 2 // Blue LED.
#define ESP8266_GPIO4 4 // Relay control.
#define ESP8266_GPIO5 5 // Optocoupler input.
#define LED_PIN ESP8266_GPIO2
// WiFi Definitions.
const char ssid[] = "Your Wifi SSID";
const char pswd[] = "Your Wifi Password";
WiFiServer server( 80 );
volatile int relayState = 0; // Relay state.
void setup() {
initHardware();
connectWiFi();
server.begin();
}
void GetClient( WiFiClient client ) {
// Read the first line of the request.
String req = client.readStringUntil( '\r' );
Serial.println( req );
client.flush();
String s = "HTTP/1.1 200 OK\r\nContent-Type: text/html\r\n\r\n<!DOCTYPE HTML>\r\n<html>\r\n";
if ( req.indexOf( "OPTIONS" ) != -1 ) {
s += "Allows: GET, OPTIONS";
} else if ( req.indexOf( "GET" ) != -1 ) {
if ( req.indexOf( "open" ) != -1 ) {
// relay on!
s += "relay on!";
relayState = 1;
digitalWrite( ESP8266_GPIO4, 1 ); // Relay control pin.
} else if ( req.indexOf( "close" ) != -1 ) {
// relay off!
s += "relay off!";
relayState = 0;
digitalWrite( ESP8266_GPIO4, 0 ); // Relay control pin.
} else if ( req.indexOf( "relay" ) != -1 ) {
if ( relayState == 0 )
// relay off!
s += "relay off!";
else
// relay on!
s += "relay on!";
} else if ( req.indexOf( "io" ) != -1 ) {
if ( digitalRead( ESP8266_GPIO5 ) == 0 )
s += "input io is:0!";
else
s += "input io is:1!";
} else if ( req.indexOf( "MAC" ) != -1 ) {
uint8_t mac[WL_MAC_ADDR_LENGTH];
WiFi.softAPmacAddress( mac );
String macID = String( mac[WL_MAC_ADDR_LENGTH - 5], HEX) + String( mac[WL_MAC_ADDR_LENGTH - 4], HEX) +
String( mac[WL_MAC_ADDR_LENGTH - 3], HEX) + String( mac[WL_MAC_ADDR_LENGTH - 2], HEX) +
String( mac[WL_MAC_ADDR_LENGTH - 1], HEX) + String( mac[WL_MAC_ADDR_LENGTH], HEX);
macID.toUpperCase();
s += "MAC address: " + macID;
} else
s += "Invalid Request.<br> Try: open/close/relay/io/MAC";
} else
s = "HTTP/1.1 501 Not Implemented\r\nContent-Type: text/html\r\n\r\n<!DOCTYPE HTML>\r\n<html>\r\n";
client.flush();
s += "</html>\n";
// Send the response to the client.
client.print( s );
delay( 1 );
Serial.println( "Client response sent." );
}
void loop() {
// Check if a client has connected.
WiFiClient client = server.available();
if ( client )
GetClient( client );
}
void connectWiFi() {
byte ledStatus = LOW;
Serial.println();
Serial.println( "Connecting to: " + String( ssid ) );
// Set WiFi mode to station (as opposed to AP or AP_STA).
WiFi.mode( WIFI_STA );
// WiFI.begin([ssid], [passkey]) initiates a WiFI connection.
// to the stated [ssid], using the [passkey] as a WPA, WPA2, or WEP passphrase.
WiFi.begin( ssid, pswd );
while ( WiFi.status() != WL_CONNECTED ) {
// Blink the LED.
digitalWrite( LED_PIN, ledStatus ); // Write LED high/low.
digitalWrite( ESP8266_GPIO4, 1 ); // Relay control pin.
ledStatus = ( ledStatus == HIGH ) ? LOW : HIGH;
delay( 100 );
digitalWrite( ESP8266_GPIO4, 0 ); // Relay control pin.
}
Serial.println( "WiFi connected" );
Serial.println( "IP address: " );
Serial.println( WiFi.localIP() );
}
void initHardware() {
Serial.begin( 9600 );
pinMode( ESP8266_GPIO4, OUTPUT ); // Relay control pin.
pinMode( ESP8266_GPIO5, INPUT_PULLUP ); // Input pin.
pinMode( LED_PIN, OUTPUT ); // ESP8266 module blue LED.
digitalWrite( ESP8266_GPIO4, 0 ); // Set relay control pin low.
}
| [
"33724778+LaurentChevalier@users.noreply.github.com"
] | 33724778+LaurentChevalier@users.noreply.github.com |
4e2454d910600c7f5b162800c4ca44c70e33b575 | 88aba2e623e36233000b2eb5bff554d93418a2c7 | /game/proyectil.cpp | 97549726fdc99cf4517f916c623c1fdf932bcb52 | [] | no_license | jalejoserna123/Proyecto-final | ca9cd72c768acc51473cb5a30887975c7da600ad | 5606a948b48f3e135f34e41dd4f56cfdcc87c64c | refs/heads/master | 2020-03-19T00:26:02.371791 | 2018-06-12T15:58:15 | 2018-06-12T15:58:15 | 135,480,535 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,268 | cpp | #include "proyectil.h"
proyectil::proyectil(float px_, float py_, float V, float delta): px(px_), py(py_)
{
vx = V*cos(delta*PI/180);
vy = V*sin(delta*PI/180);
//k = 0.1*0.001*PI/2.0;
}
proyectil::proyectil(float px_, float py_, float vx_, float vy_, float ax_, float ay_):px(px_), py(py_), vx(vx_), vy(vy_), ax(ax_), ay(ay_)
{
}
proyectil::~proyectil()
{
}
void proyectil::setVel(float x_, float y_)
{
vx = x_;
vy = y_;
}
void proyectil::setPoint(float x_, float y_)
{
px = x_;
py = y_;
}
void proyectil::actualizar(float dt)
{
float v = sqrt(pow(vx,2)+pow(vy,2));
float theta = atan2(vy,vx);
ax = -1*(k*v*v*radio*radio*cos(theta))/masa;
ay = (-1*(k*v*v*radio*radio*sin(theta))/masa) - 10;
//ax = 0;
//ay = -10;
px+=vx*dt + dt*dt*ax/2;
py+=vy*dt + dt*dt*ay/2;
vx+=ax*dt;
vy+=ay*dt;
}
float proyectil::getX() const
{
return px;
}
float proyectil::getY() const
{
return py;
}
float proyectil::getR() const
{
return radio;
}
float proyectil::getVx() const
{
return vx;
}
float proyectil::getVy() const
{
return vy;
}
float proyectil::getAx() const
{
return ax;
}
float proyectil::getAy() const
{
return ay;
}
float proyectil::get_e() const
{
return e;
}
| [
"36768219+jalejoserna123@users.noreply.github.com"
] | 36768219+jalejoserna123@users.noreply.github.com |
13dc0febe0dce50652ab7fcd033f323b0eb27257 | ff460f1196d597619666d5c321f8b949ee235d36 | /A_Amr_and_Music.cpp | 03a3a12b904847ff273edad8cc1aa13eaf8fc22a | [] | no_license | ramumaha/10-Weeks-DSA-Challenge | b1f003bd285beae38668ca5c79b091ff08e86be2 | 7e9d8898d486a8f162e4908fdc92c178af96d373 | refs/heads/main | 2023-06-10T13:49:37.783028 | 2021-06-29T07:18:25 | 2021-06-29T07:18:25 | 354,344,106 | 0 | 1 | null | 2021-04-03T16:46:47 | 2021-04-03T16:46:46 | null | UTF-8 | C++ | false | false | 567 | cpp | #include <vector>
#include<bits/stdc++.h>
using namespace std;
int n, k, sum, num, b, c[101];
vector < pair<int, int>> a;
int main() {
cin >> n >> k;
for (int i = 1; i <= n; i++) {
cin >> b;
a.push_back( make_pair(b, i));
}
sort(a.begin(), a.end());
for (int i = 0; i < n; i++) {
sum += a[i].first;
if (sum <= k) {
num++;
c[i] = a[i].second;
} else {
break;
}
}
cout << num << endl;
for (int i = 0; i < num; i++) {
cout << c[i] << " ";
}
} | [
"noreply@github.com"
] | noreply@github.com |
2111eb02853d7893e2adea201daec00425e528ab | e8ab515a1563272a4e17cde2c69362cdb47d6d2c | /Arduino/tilt_and_pan/tilt_and_pan.ino | 6444d8ab88434bd7b068e0794fe7c1b84135fa84 | [] | no_license | ndsh/sensopoda | 5d742227ca4d0aece41065fb23d4cf8852c278f3 | a54a1e62f1ff0621dbb271bf4e17cf0e8c98ffba | refs/heads/master | 2022-09-09T13:20:17.979963 | 2020-06-02T15:48:32 | 2020-06-02T15:48:32 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,519 | ino | // Controlling a servo position using a potentiometer (variable resistor)
// by Michal Rinott <http://people.interaction-ivrea.it/m.rinott>
#include <Servo.h>
Servo myservo1; // create servo object to control a servo
Servo myservo2;
/** pins */
int potpin1 = 0;
int potpin2 = 1;// analog pin used to connect the potentiometer
int irReader = 5; //
/** values */
int val1; // variable to read the value from the analog pin
int val2;
int irVal = 0; // stores value from Ir reader
int cm; // for the irVal to cm conversion
void setup() {
Serial.begin( 9600 ); // begins serial communication with the computer
myservo1.attach(9); // attaches the servo on pin 9 to the servo object
myservo2.attach(10);
//analogReference(2); //set analog reference to internal 1.1V
//int value = analogRead(irReader)*1100/1024;
}
void loop() {
irVal = analogRead( irReader );
cm = 10650.08 * pow(irVal,-0.935) - 10;
Serial.println(cm);
val1 = analogRead(potpin1);
val2 = analogRead(potpin2); // reads the value of the potentiometer (value between 0 and 1023)
/*
Serial.println("potpin1 \t potpin2");
Serial.print(val1);
Serial.print(" \t");
Serial.println(val2);
*/
val1 = map(val1, 1023, 0, 0, 179);
val2 = map(val2, 1023, 0, 0, 179); // scale it to use it with the servo (value between 0 and 180)
myservo1.write(val1);
myservo2.write(val2); // sets the servo position according to the scaled value
delay(15); // waits for the servo to get there
}
| [
"me@julian-h.de"
] | me@julian-h.de |
281ec9221c7651127a1712dd33c4df948fc74307 | c4ea5e75209ed29ee0f6c6e82b41bdbd8709c328 | /fastore/ore.h | a3db8bb1e0bd74dd6538cf956cf3c14399730d0b | [] | no_license | CongGroup/NSS18 | bab20f1e81293ebd58b3105afb3e9d686705316a | dd5fa4e86156c1f94a34f9c3caace5452b07dae5 | refs/heads/master | 2020-03-20T23:29:16.049057 | 2018-08-20T02:46:15 | 2018-08-20T02:46:15 | 137,848,729 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,275 | h | #pragma once
#include <cstdint>
#include <string>
#include <openssl/aes.h>
typedef uint8_t byte;
typedef uint8_t block[16];
struct extraData
{
int reserve;
};
class ORE
{
public:
ORE(byte sizeb, byte sizec = 64);
~ORE();
void setupKey(const std::string& strKey);
int genLeft(std::string& left, const uint32_t msg, const byte cmp, const extraData* data = 0);
int genRight(std::string& right, const uint32_t msg, const extraData* data = 0);
bool cmp(const std::string& left, const std::string& right);
int getLeftSize();
int getRightSize();
private:
void setBlock(byte* dst, const uint64_t left, const uint64_t right);
void setKey(AES_KEY& key, const byte* src, const int size);
void aes(byte* dst, const byte* src, const AES_KEY& key);
void prp(byte* dst, const byte* src, int len, const AES_KEY* keyThree, bool inv = false);
void prf(byte* dst, const byte* src, const void* key);
void prg(byte* dst);
void permuteBlockOrder(int* block_loc, int nblocks);
byte blockLenBit;
byte cmpLenBit;
uint32_t prgCounter[4];
byte masterKey[32];
AES_KEY trapdoorKey;
AES_KEY nonceKey;
AES_KEY prgKey;
AES_KEY prpKey[3];
static const int maxBlockCount = 16;
const byte ORE_EQUAL = 0;
const byte ORE_SMALL = -1;
const byte ORE_LARGE = 1;
};
| [
"mengycs@gmail.com"
] | mengycs@gmail.com |
fd4d83732a61147f750e27f7356c0710fac27129 | 777c81109d4a53b70a37a73ae6ab00b8e5ca778d | /src/list_old.h | c0023ed98f62b98b746019cfe583817a116228ad | [] | no_license | jadesoul/libsoul | 6604f3de861ff86391b5f3850d37b4e05bb14ac0 | 0be8177660c089fa6d233a96d89b29fd721ae071 | refs/heads/master | 2021-01-01T15:40:04.524513 | 2013-12-23T15:51:27 | 2013-12-23T15:51:27 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 13,923 | h | #ifndef LIST_H_1356531320_98
#define LIST_H_1356531320_98
/**
* File: list.h
* Description:
*
* Copyright (c) 2012 Jadesoul (Home Page: http://jadesoul.sinaapp.com)
*
* Date: 2012-12-26 22:15:20.979000
* Written In: Peking University, beijing, China
*/
#include "bootstrap.h"
#include "algorithms.h"
#include "str.h"
#include "set.h"
template<class element>
class list {
public:
// typedef std::list<element> container;
typedef std::vector<element> container;
typedef element value_type;
typedef typename container::iterator iterator;
typedef typename container::const_iterator citerator;
typedef typename container::reverse_iterator riterator;
typedef typename container::const_reverse_iterator criterator;
private:
container con;
public:
// for iterators
inline iterator begin() { return con.begin(); }
inline iterator end() { return con.end(); }
inline riterator rbegin() { return con.rbegin(); }
inline riterator rend() { return con.rend(); }
inline citerator begin() const { return con.begin(); }
inline citerator end() const { return con.end(); }
inline criterator rbegin() const { return con.rbegin(); }
inline criterator rend() const { return con.rend(); }
// for size query
inline virtual const uint size() const { return con.size(); }
inline const bool empty() const { return con.empty(); }
// for pos to iter
inline iterator iter(const int& i) { return ((i<0)?end():begin())+i; }
inline iterator jter(const int& i) { return ((i<=0)?end():begin())+i; }
inline citerator iter(const int& i) const { return ((i<0)?end():begin())+i; }
inline citerator jter(const int& i) const { return ((i<=0)?end():begin())+i; }
inline riterator riter(const int& i) { return ((i<0)?rend():rbegin())+i; }
inline riterator rjter(const int& i) { return ((i<=0)?rend():rbegin())+i; }
inline criterator riter(const int& i) const { return ((i<0)?rend():rbegin())+i; }
inline criterator rjter(const int& i) const { return ((i<=0)?rend():rbegin())+i; }
/**************************************************
constructors:
**************************************************/
/* python code
def generate_template_constructors():
ss=[]
for i in range(1, 10):
r=range(1, 1+i)
a='template<%s>' % ', '.join(['class T%d' % j for j in r])
b='inline list(%s) {' % ', '.join(['const T%d& t%d' % (j, j) for j in r])
c='\t%s' % '\n\t'.join(['append(t%d);' % j for j in r])
s='\n'.join([a, b, c, '}'])
ss.append(s)
print '\n'.join(ss)
*/
//because no often use one elment to init a list
template<class T1>
inline list(const T1& t1) {
append(t1);
}
template<class T1, class T2>
inline list(const T1& t1, const T2& t2) {
append(t1);
append(t2);
}
template<class T1, class T2, class T3>
inline list(const T1& t1, const T2& t2, const T3& t3) {
append(t1);
append(t2);
append(t3);
}
template<class T1, class T2, class T3, class T4>
inline list(const T1& t1, const T2& t2, const T3& t3, const T4& t4) {
append(t1);
append(t2);
append(t3);
append(t4);
}
template<class T1, class T2, class T3, class T4, class T5>
inline list(const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5) {
append(t1);
append(t2);
append(t3);
append(t4);
append(t5);
}
template<class T1, class T2, class T3, class T4, class T5, class T6>
inline list(const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5, const T6& t6) {
append(t1);
append(t2);
append(t3);
append(t4);
append(t5);
append(t6);
}
template<class T1, class T2, class T3, class T4, class T5, class T6, class T7>
inline list(const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5, const T6& t6, const T7& t7) {
append(t1);
append(t2);
append(t3);
append(t4);
append(t5);
append(t6);
append(t7);
}
template<class T1, class T2, class T3, class T4, class T5, class T6, class T7, class T8>
inline list(const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5, const T6& t6, const T7& t7, const T8& t8) {
append(t1);
append(t2);
append(t3);
append(t4);
append(t5);
append(t6);
append(t7);
append(t8);
}
template<class T1, class T2, class T3, class T4, class T5, class T6, class T7, class T8, class T9>
inline list(const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5, const T6& t6, const T7& t7, const T8& t8, const T9& t9) {
append(t1);
append(t2);
append(t3);
append(t4);
append(t5);
append(t6);
append(t7);
append(t8);
append(t9);
}
list() {}
list(const list& r):con(r.con) {};
list(const set<element>& r):con(r.begin(), r.end()) {};
list(const container& r):con(r) {};
list(iterator begin, iterator end):con(begin, end) {}
list(citerator begin, citerator end):con(begin, end) {}
list(riterator begin, riterator end):con(begin, end) {}
list(criterator begin, criterator end):con(begin, end) {}
list(const element*& begin, const element*& end):con(begin, end) {}
/**************************************************
output operator: <<
**************************************************/
friend ostream& operator<<(ostream& out, const list& l) {
uint n=l.size();
out<<"[ ";
for_n(i, n) {
out<<l[i];
if (i!=n-1) out<<',';
out<<' ';
}
return out<<']';
}
/**************************************************
assign operator: =
**************************************************/
inline list& operator=(const list& r) {
return assign(r);
}
inline list& assign(const list& r) {
con=r.con;
return *this;
}
/**************************************************
bool expressions: == != > >= < <=
**************************************************/
// for
bool operator==(const list& r) {
if (this==&r) return true;
if (size()!=r.size()) return false;
return std::equal(begin(), end(), r.begin());
}
bool operator!=(const list& r) {
return !(*this==r);
}
bool operator>(const list& r) {
return size()>r.size();
}
bool operator<=(const list& r) {
return !(*this>r);
}
bool operator<(const list& r) {
return size()<r.size();
}
bool operator>=(const list& r) {
return !(*this<r);
}
/**************************************************
operators: += + *= *
**************************************************/
list& operator+=(const list& r) {
this->extend(r);
return *this;
}
list operator+(const list& r) {
list t(*this);
t.extend(r);
return t;
}
list& operator*=(const uint& n) {
if (n==0) {
clear();
} else if (n!=1) {
con.reserve(size()*(n-1));
::repeat(begin(), end(), inserter(con, end()), n);
}
return *this;
}
list operator*(const uint& n) {
list tmp(*this);
tmp*=n;
return tmp;
}
/**************************************************
contains: x.contains(y) <==> y in x
**************************************************/
// for elements
inline element& operator [](int i) {
return elem(i);
}
inline const element& operator [](int i) const {
return elem(i);
}
inline element& elem(int i) {
return *iter(i);
}
inline const element& elem(int i) const {
return *iter(i);
}
element& at(int i) {
uint l=size();
if (i<0) i+=l;
assert(i>=0 AND i<l);
return this->operator[](i);
}
element& at(uint i) {
assert(i>=0 AND i<size());
return this->operator[](i);
}
// slice
list operator()(const int& i, const int& j) {
return list(iter(i), jter(j));
}
/**************************************************
contains: x.contains(y) <==> y in x
**************************************************/
bool contains(const element& r) {
return std::search(begin(), end(), &r, (&r)+1)!=end();
}
/**************************************************
del: x.del(i) <==> del x[i]
**************************************************/
list& del(const int& i=0) {
con.erase(iter(i));
return *this;
}
/**************************************************
del: x.del(i, j) <==> del x[i:j]
Use of negative indices is also supported.
**************************************************/
list& del(const int& i, const int& j) {
con.erase(iter(i), jter(j));
return *this;
}
uint tohash() {
// TODO
return 0;
}
/**************************************************
append: L.append(object)
append object to end
**************************************************/
// for modifiers
inline list& append(const element& r) {
con.push_back(r);
return *this;
}
/**************************************************
clear: L.clear()
clear all
**************************************************/
inline list& clear() {
con.clear();
return *this;
}
/**************************************************
count: L.count(value) -> integer
return number of occurrences of value
**************************************************/
inline uint count(const element& e, int start=0, int end=0) {
return ::count(iter(start), jter(end), (&e), (&e)+1);
}
/**************************************************
extend: L.extend(iterable)
extend list by appending elements from the iterable
**************************************************/
inline list& extend(const list& r) {
con.insert(con.end(), r.begin(), r.end());
}
/**************************************************
find: L.find(value, [start, [stop]]) -> integer
return first index of value
rfind: L.find(value, [start, [stop]]) -> integer
return the last index of value
**************************************************/
inline int find(const list& sub, int start=0, int end=0) const {
citerator a=iter(start), b=jter(end);
if (a>=b) return -1;
citerator c=std::search(a, b, sub.begin(), sub.end());
return (c==b)?-1:c-a;
}
inline int rfind(const list& sub, int start=0, int end=0) const {
uint l=size();
start=(start>0)?l-1-start:-start-l;
end=(end>0)?l-1-end:-end-l;
criterator a=rjter(end), b=riter(start);
if (a>=b) return -1;
criterator c=std::search(a, b, sub.rbegin(), sub.rend());
return (c==b)?-1:(b-c)-sub.size()-1;
}
/**************************************************
insert: L.insert(index, object)
insert object before index
**************************************************/
inline list& insert(const element& r, int i=0) {
con.insert(iter(i), r);
return *this;
}
/**************************************************
push: L.push(item) -> L
append an item at last
pop: L.pop() -> item
remove and return item at last
**************************************************/
inline list& push(const element& r) {
return append(r);
}
inline element pop() {
if (con.empty()) return NULL; //TODO
element tmp=con.back();
con.pop_back();
return tmp;
}
/**************************************************
inject: L.inject(item) -> L
insert an item at first
shift: L.shift() -> item
remove and return item at first
**************************************************/
inline list& inject(const element& r) {
return insert(r);
}
inline list& prepend(const element& r) {
return insert(r);
}
inline element shift() {
if (con.empty()) return NULL; //TODO
element tmp=con.front();
del(0);
return tmp;
}
/**************************************************
index: L.index(value) -> int
return the position if found, or -1
O(n)
**************************************************/
inline int index(const element& e) const {
uint l=size();
for_n(i, l) if (con[i]->equals(*e)) return i;
return -1;
}
/**************************************************
remove: L.remove(value)
remove first occurrence of value
**************************************************/
inline list& remove(const element& e) {
uint i=index(e);
if (i!=-1) del(i);
return *this;
}
/**************************************************
reverse: L.reverse() -> L
reverse *IN PLACE*
reversed: L.reversed() -> new L
reverse with copy
**************************************************/
list& reverse() {
std::reverse(begin(), end());
return *this;
}
inline list reversed() {
return list(rbegin(), rend());
}
/**************************************************
sort: L.sort(cmp=None, key=None, reverse=False)
stable sort *IN PLACE*;
cmp(x, y) -> -1, 0, 1
sorted: L.sort(cmp=None, key=None, reverse=False) -> new L
return a sorted copy
**************************************************/
list& sort() {
std::sort(begin(), end());
return *this;
}
inline list sorted() {
return copy().sort();
}
/*************************************************
L.copy() -> new L
Return a shadow copy of list L, is the same to L
in the first level
*************************************************/
inline list copy() {
return list(*this);
}
/*************************************************
L.clone() -> new L
Return a deep copy of list L, which is a clone
of L. The same in all level
*************************************************/
inline list clone() {
// TODO
return list();
}
// foreach
template<class Function>
void foreach(Function f) {
std::for_each(begin(), end(), f);
}
// use g as a glue to join this list
inline str glue(const str& g) {
return g.join(*this);
}
};
#define Macro__typedefs_of_list__Element_Name_Alias(E, N, A)\
typedef ::list<E> N;\
typedef N A;
Macro__typedefs_of_list__Element_Name_Alias(char, listchar, Lchar)
Macro__typedefs_of_list__Element_Name_Alias(uchar, listuchar, Luchar)
Macro__typedefs_of_list__Element_Name_Alias(int, listint, Lint)
Macro__typedefs_of_list__Element_Name_Alias(uint, listuint, Luint)
Macro__typedefs_of_list__Element_Name_Alias(short, listshort, Lshort)
Macro__typedefs_of_list__Element_Name_Alias(ushort, listushort, Lushort)
Macro__typedefs_of_list__Element_Name_Alias(float, listfloat, Lfloat)
Macro__typedefs_of_list__Element_Name_Alias(double, listdouble, Ldouble)
Macro__typedefs_of_list__Element_Name_Alias(str, liststr, Lstr)
#endif /* LIST_H_1356531320_98 */
| [
"wslgb2006@gmail.com"
] | wslgb2006@gmail.com |
e3eb8f83f1698e05035581b0a935c725beb6508c | 3c290edda78c362a9abfbadf8d6f8028077c71fb | /source/2DAE1_GP2_Project/OverlordProject/Materials/Post/PostVignette.cpp | caf9b97dacc05dbe2e3ddbc726c28e571d34dc16 | [] | no_license | mvanneutigem/GraphicsProg2 | 0806ed358e0ebdd2655631a768dd4e1c15ec3ff7 | 7e409f725886c7bcb56392781d5e18543b6bb606 | refs/heads/master | 2021-07-06T20:17:26.102820 | 2017-09-29T16:33:15 | 2017-09-29T16:33:15 | 105,293,616 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 921 | cpp | //Precompiled Header [ALWAYS ON TOP IN CPP]
#include "stdafx.h"
#include "PostVignette.h"
#include "Graphics/RenderTarget.h"
PostVignette::PostVignette()
: PostProcessingMaterial(L"./Resources/Effects/Post/Vignette.fx"),
m_pTextureMapVariabele(nullptr)
{
}
PostVignette::~PostVignette(void)
{
}
void PostVignette::LoadEffectVariables()
{
//Bind the 'gTexture' variable with 'm_pTextureMapVariable'
auto effectVar = m_pEffect->GetVariableByName("gTexture");
m_pTextureMapVariabele = (effectVar->IsValid()) ? effectVar->AsShaderResource() : nullptr;
//Check if valid!
}
void PostVignette::UpdateEffectVariables(RenderTarget* rendertarget, const GameContext& gameContext)
{
UNREFERENCED_PARAMETER(gameContext);
//Update the TextureMapVariable with the Color ShaderResourceView of the given RenderTarget
if (m_pTextureMapVariabele)
m_pTextureMapVariabele->SetResource(rendertarget->GetShaderResourceView());
} | [
"marieke.van.neutigem@student.howest.be"
] | marieke.van.neutigem@student.howest.be |
ae7bd7b221edc8c0762defb517a05a559d756741 | d19882f7815366ab6b7c6cbe41f723bdb9923e2a | /Src/sAes_F/cAesObj_F.cpp | 4de9f84506d13a4d331b941d71f9ad3d4fc50afb | [] | no_license | finder-zhang/LinuxCommLib_F | 8af657a5ea2b712b75fcae29833bfe74b16d5fe0 | 7af07002616feb6f7608fc108f8ffba038069c61 | refs/heads/master | 2016-09-06T06:19:59.875519 | 2014-12-02T01:14:05 | 2014-12-02T01:14:05 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,807 | cpp | /*
* cAesObj_F.cpp
*
* Created on: 2014年10月28日
* Author: finder
*/
#include "cAesObj_F.h"
#include "cAesObjImpl_F.h"
AES_HANDLE AES_Init(const void* pKey,U8 uKeyLen,U8 uBlockLen)
{
AES_OPERATOR_t * pAes = (AES_OPERATOR_t*)malloc(sizeof(AES_OPERATOR_t));
AESIMPL_Init(pAes,pKey,uKeyLen,uBlockLen);
return pAes;
}
BOOL AES_Deinit(AES_HANDLE aes)
{
free(aes);
return TRUE;
}
//void AES_BlockEncrypt(AES_HANDLE aes,const void* pPlain,void* pCipher)
//{
// AESIMPL_Encrypt((PAES_OPERATOR_t)aes,pPlain,pCipher);
//}
//
//void AES_BlockDecrypt(AES_HANDLE aes,const void* pCipher,void* pPlain)
//{
// AESIMPL_Decrypt((PAES_OPERATOR_t)aes,pCipher,pPlain);
//}
BOOL AES_Encrypt(AES_HANDLE aes,const void* pPlain,U16 wInLen,void* pCipher,U16* pwOutLen)
{
U8 uPlainTemp[32];
const U8* pIn = (const U8*)pPlain;
U8* pOut = (U8*)pCipher;
PAES_OPERATOR_t pAes = (PAES_OPERATOR_t)aes;
int LenText = pAes->LenText;
//while length longer than block size,encrypt block by block
while (wInLen >= LenText)
{
AESIMPL_Encrypt(pAes,pIn,pOut);
pIn += LenText;
pOut += LenText;
wInLen -= LenText;
*pwOutLen += LenText;
}
//if leave some data shorter than block size
if (wInLen) {
memset(uPlainTemp,0,LenText);
memcpy(uPlainTemp,pIn,wInLen);
AESIMPL_Encrypt(pAes,uPlainTemp,pOut);
*pwOutLen += LenText;
}
return TRUE;
}
BOOL AES_Decrypt(AES_HANDLE aes,const void* pCipher,U16 wInLen,void* pPlain)
{
PAES_OPERATOR_t pAes = (PAES_OPERATOR_t)aes;
int LenText = pAes->LenText;
if (wInLen % LenText) {
return FALSE;
}
const U8* pIn = (const U8*)pCipher;
U8* pOut = (U8*)pPlain;
while (wInLen >= LenText) {
AESIMPL_Decrypt(pAes,pIn,pOut);
pIn += LenText;
pOut += LenText;
wInLen -= LenText;
}
return TRUE;
}
void AES_SetMode(eAES_MODE_t mode)
{
}
| [
"root@finder.ubuntu"
] | root@finder.ubuntu |
6792c82d435e700229e0471b46e952839c3bd3ab | 59515d772c78195cd0c5b22bc58e59c48efcedb2 | /914B[Conan_and_Agasa_play_a_Card_Game].cpp | 853c4690c71f34a1d0c12c444b222ce42413a6d1 | [] | no_license | minhazmiraz/Codeforces_AC_Submission | 286a7799699b666c9ceddad25ac59a4fe34ac48b | 6ed22a72b7a49bc3880514e3bfac85451e41dd35 | refs/heads/master | 2021-09-29T00:05:49.985949 | 2018-11-21T18:35:00 | 2018-11-21T18:35:00 | 80,108,257 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 336 | cpp | #include <bits/stdc++.h>
using namespace std;
int main(){
int n;
cin>>n;
int arr[100005];
memset(arr,0,sizeof arr);
for(int i=1;i<=n;i++){
int a;
cin>>a;
arr[a]++;
}
int f=1;
for(int i=1;i<=100000;i++){
if(arr[i]%2) f=0;
}
if(f)
cout<<"Agasa\n";
else
cout<<"Conan\n";
return 0;
}
/*
Powered by Buggy plugin
*/ | [
"minhazmiraz49@gmail.com"
] | minhazmiraz49@gmail.com |
f82b667125d3954609f002501a701cf1964f55cc | 3c0bf686de846873035f64fd9294089b68e69e3e | /blobGenerator/src/testApp.h | 9a81c55d1a0c68a1f603d674c9e21c904a900e83 | [
"MIT"
] | permissive | ofZach/fuelProduction | cf8b1729952daad3c5798ef407ff9c36c9c563d5 | 638b4d5fbb48632b37637faa132cd412058668da | refs/heads/master | 2021-01-22T03:08:58.151763 | 2014-10-01T04:46:14 | 2014-10-01T04:46:14 | 24,109,788 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 714 | h | #ifndef _TEST_APP
#define _TEST_APP
#include "ofMain.h"
#include "particle.h"
#include "spring.h"
#include "ofxAlembic.h"
class testApp : public ofSimpleApp{
public:
void setup();
void update();
void draw();
void keyPressed (int key);
void keyReleased (int key);
void mouseMoved(int x, int y );
void mouseDragged(int x, int y, int button);
void mousePressed(int x, int y, int button);
void mouseReleased();
// let's make a vector of them
vector <particle> particles;
vector <spring> springs;
ofxAlembic::Writer writer;
bool bSaving;
int frameNum;
bool bSavingLastFrame;
string message;
};
#endif
| [
"zach@eyebeam.org"
] | zach@eyebeam.org |
43944aa371bb35d165e59e84ea40c1de99799d16 | 82c3ce6d7897e31ad3cb30c8dd7f3617deacfe3f | /sakuhin/ソースファイル/OutlineModel.h | efb7874441acbfa65d37905760041d26444645b9 | [] | no_license | ToYoHiYoTo/ToYoHiYoTo.github.io | 47a0bbdcbf62bfe291ccf945b672c76b37d47069 | 2aa5db9b9bdd648de83a502d42e42cdcbe98d800 | refs/heads/master | 2022-12-02T23:13:21.580580 | 2020-08-03T11:38:26 | 2020-08-03T11:38:26 | 284,681,896 | 0 | 0 | null | null | null | null | SHIFT_JIS | C++ | false | false | 592 | h | //=======================================
//
// OutlineModel.h
// name : Hiroto
// data : 2019/11/26 16:00:58
//
//=======================================
#ifndef _OutlineModel_H__
#define _OutlineModel_H__
/*** インクルード ***/
#include "ModelManager.h"
/*** 前方宣言 ***/
/*** OutlineModelクラス ***/
class OutlineModel : public CGameObject
{
private:
ID3D11Buffer* m_VertexBuffer = NULL;
CShader* m_Shader;
ModelManager* m_ModelManager;
public:
void Init();
void Uninit();
void Update();
void Draw();
//void DrawShadow();
};
#endif // !_OutlineModel_H__
| [
"hrt.yama@gmail.com"
] | hrt.yama@gmail.com |
8d1bba7bf27442f62e4983e8bac3f38b106f3dfd | ce405362ea6c7fadbb73929f2be181323734c8cf | /minichat/addrbook/addrbook_service_impl.cpp | 0a18c1e7ddd60a879ff3b93761b2a3a51e6484b1 | [] | no_license | xiaobinshe/minichat | 6a7ab3ee49fe045015fc02bf86217d66f4615682 | a6019bf58d8059bb446ab95632f13456fde6656f | refs/heads/master | 2020-05-29T08:46:12.826980 | 2016-10-02T17:37:53 | 2016-10-02T17:37:53 | 69,555,220 | 0 | 0 | null | 2016-09-29T10:00:50 | 2016-09-29T10:00:50 | null | UTF-8 | C++ | false | false | 1,390 | cpp | /* addrbook_service_impl.cpp
Generated by phxrpc_pb2service from addrbook.proto
*/
#include "addrbook_service_impl.h"
#include "addrbook_server_config.h"
#include "addrbook.pb.h"
#include "phxrpc/file.h"
#include "addrbook_dao.h"
#include "common/redis_client_factory.h"
AddrbookServiceImpl :: AddrbookServiceImpl( ServiceArgs_t & args )
: args_( args )
{
}
AddrbookServiceImpl :: ~AddrbookServiceImpl()
{
}
int AddrbookServiceImpl :: PHXEcho( const google::protobuf::StringValue & req,
google::protobuf::StringValue * resp )
{
resp->set_value( req.value() );
return 0;
}
int AddrbookServiceImpl :: Set( const addrbook::ContactReq & req,
google::protobuf::Empty * resp )
{
AddrbookDAO dao( args_.factory->Get() );
return dao.Set( req, resp );
}
int AddrbookServiceImpl :: GetAll( const google::protobuf::StringValue & req,
addrbook::ContactList * resp )
{
AddrbookDAO dao( args_.factory->Get() );
return dao.GetAll( req, resp );;
}
int AddrbookServiceImpl :: GetOne( const addrbook::GetOneReq & req,
addrbook::Contact * resp )
{
AddrbookDAO dao( args_.factory->Get() );
return dao.GetOne( req, resp );
}
int AddrbookServiceImpl :: GetBySeq( const addrbook::GetBySeqReq & req,
addrbook::ContactList * resp )
{
AddrbookDAO dao( args_.factory->Get() );
return dao.GetBySeq( req, resp );;
}
| [
"gz_stephen@qq.com"
] | gz_stephen@qq.com |
ea2449bddb74611b4403fd2aed0b0f133f8f514d | c43f9cd46955cc14abd73f234db97d77bb6429a2 | /tests/new_feature_test/io_service_timer.h | c05170f3493db4dbbe07ed3d62436c323fce8fe1 | [
"MIT"
] | permissive | rasmadeus/rapchat | c92ef36e4503df013fcb13b6219411b77771630a | d884405bc3919e9f429b6971303ef82b19175258 | refs/heads/master | 2020-09-16T01:51:01.628808 | 2020-09-01T20:06:19 | 2020-09-01T20:06:19 | 223,614,278 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,019 | h | #pragma once
#include "feature_test.h"
#include <boost/asio/io_service.hpp>
#include <boost/asio/steady_timer.hpp>
#include <chrono>
#include <iostream>
namespace rapchat
{
class IoServiceTimer: public FeatureTest
{
public:
IoServiceTimer()
: FeatureTest{"IoServiceTimer"}
{
}
protected:
void job() override
{
boost::asio::io_service ioService;
boost::asio::steady_timer timer1{ioService, std::chrono::seconds{3}};
boost::asio::steady_timer timer2{ioService, std::chrono::seconds{4}};
timer2.async_wait([](boost::system::error_code const &ec) {
std::cout << "4 seconds timer fired. Message: " << ec.message() << "\n";
});
timer1.async_wait([](boost::system::error_code const &ec) {
std::cout << "3 seconds timer fired. Message: " << ec.message() << "\n";
});
ioService.run();
}
};
} // namespace rapchat
| [
"rasmadeus@gmail.com"
] | rasmadeus@gmail.com |
5f1c84f83793e1c3cd5ef459f99ff4cee589e794 | c6e9b31f0284026f66a333933bb2c5c8220f8da5 | /Outpost/Players.hpp | 2bfbfddbaaef2aaa6358f42030b9593929db8c90 | [
"MIT"
] | permissive | chiendarrendor/AlbertsGameMachine | 511425a9c9421358eace5f987c384d53fadc7304 | 29855669056bf23666791960dc2e79eab47f6a0b | refs/heads/master | 2021-09-01T00:34:19.440893 | 2017-12-23T21:24:23 | 2017-12-23T21:24:23 | 115,222,472 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,540 | hpp | #include "Serialize.hpp"
#include "Player.hpp"
#include "Outpost.hpp"
const size_t NO_PLAYER = 100;
class Players
{
public:
Players();
virtual ~Players();
size_t size() const;
void add(const std::string &i_Name);
void remove(const std::string &i_Name);
bool IsPlayer(const std::string &i_Name) const;
const Player &operator[](size_t i_Num) const;
Player &operator[](size_t i_Num) ;
// will throw an exception if the name is not a player's name
Player &GetPlayerByName(const std::string &i_Name);
const Player &GetPlayerByName(const std::string &i_Name) const;
size_t GetPlayerId(const std::string &i_Name) const;
int GetPhase() const;
bool AllOk() const;
void DetermineTurnOrder();
const std::vector<int> &GetTurnOrder() const;
// these methods allow us to manage walking through the turn order created in
// DetermineTurnOrder
void StartTurnOrder();
void IncrementTurnOrder();
const Player &GetCurTurnPlayer() const;
Player &GetCurTurnPlayer();
bool AllPlayersDone() const;
// additional methods for Purchase Phase
void StartPurchasePhase();
void PurchaseIncrementTurnOrder(PurchaseState i_state = DONE);
bool PurchaseAllPlayersDone() const;
// methods for the Bidding Phase.
void StartBidPhase(bool i_MustBeActive,bool i_OnePurchase,int i_InitialBid);
const Player &GetCurBidPlayer() const;
Player &GetCurBidPlayer();
void IncrementBid(BidState i_BidState,int i_HighBid = NOT_HIGH_BID);
const Player &GetHighBidPlayer() const;
Player &GetHighBidPlayer();
int GetCurrentHighBid() const;
// methods for manning phase
void StartManningTurnOrder();
void IncrementManningTurnOrder();
// more helper functions
bool IsPlayerInternalizing(const std::string &i_PlayerName) const;
bool CanPlayerPurchase(const std::string &i_PlayerName,
PurchasableType i_Purchasable,
RobotMechanism i_mechanism) const;
bool CanPlayerMulligan(const std::string& i_PlayerName) const;
std::set<size_t> GetWinningPlayerIndices() const;
private:
// causes m_CurBidIndex to point to the next player in turn order,
// wrapping around, whose bid state is not PASS_OUT
void IncrementBidIndex();
SERIALIZE_FUNC
{
SERIALIZE(m_Players);
SERIALIZE(m_TurnOrder);
SERIALIZE(m_CurTurnIndex);
SERIALIZE(m_CurBidIndex);
SERIALIZE(m_HighBidIndex);
}
std::vector<Player> m_Players;
std::vector<int> m_TurnOrder;
size_t m_CurTurnIndex;
size_t m_HighBidIndex;
size_t m_CurBidIndex;
};
| [
"chiendarrendor@yahoo.com"
] | chiendarrendor@yahoo.com |
6e0061566b161a9dc599a6cfeda7d8d4320d1c26 | a24985201cfa2a1760a0ff15b9f0215fbeefad66 | /FlowKinect_Midi/src/ofApp.h | 243adc4ad4b57cc9b091024122cb6ecff3709c07 | [] | no_license | genekogan/DanceFlows | 66207c88dca4451bae0daf07eedc684dbbfa61ee | 184958cf7397df6a55c5415b8960032f18a910b2 | refs/heads/master | 2020-04-01T14:43:21.950060 | 2014-12-03T19:04:55 | 2014-12-03T19:04:55 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,087 | h | #pragma once
#include "ofMain.h"
#include "ofxGui.h"
#include "ofxFlowTools.h"
#include "ofxOpenCv.h"
#include "ofxKinect.h"
#include "ofxMidi.h"
class testApp : public ofBaseApp, public ofxMidiListener {
public:
void setup();
void update();
void draw();
void exit();
void keyPressed(int key);
ofVec2f lastMouse;
// GUI
ofxPanel gui;
void setupGui();
ofParameter<float> guiFPS;
ofParameter<bool> doFullScreen;
void setFullScreen(bool& _value) { ofSetFullscreen(_value);}
ofParameter<bool> toggleGuiDraw;
ofParameter<bool> doFlipCamera;
ofParameter<int> visualisationMode;
ofParameter<string> visualisationName;
int numVisualisationModes;
string *visualisationModeTitles;
ofParameterGroup visualisationParameters;
ofParameterGroup drawForceParameters;
ofParameter<bool> doResetDrawForces;
void resetDrawForces(bool& _value) { if (_value) {for (int i=0; i<numDrawForces; i++) flexDrawForces[i].reset();} doResetDrawForces.set(false);}
ofParameterGroup leftButtonParameters;
ofParameterGroup rightButtonParameters;
ofParameter<bool> showScalar;
ofParameter<bool> showField;
ofParameter<float> displayScalarScale;
void setDisplayScalarScale(float& _value) { displayScalar.setScale(_value); }
ofParameter<float> velocityFieldArrowScale;
void setVelocityFieldArrowScale(float& _value) { velocityField.setVectorSize(_value); }
ofParameter<float> temperatureFieldBarScale;
void setTemperatureFieldBarScale(float& _value) { temperatureField.setVectorSize(_value); }
ofParameter<bool> visualisationLineSmooth;
void setVisualisationLineSmooth(bool& _value) { velocityField.setLineSmooth(_value); }
// Camera
ofFbo cameraFbo;
// Time
float lastTime;
float deltaTime;
// FlowTools
int flowWidth;
int flowHeight;
int drawWidth;
int drawHeight;
flowTools::ftOpticalFlow opticalFlow;
flowTools::ftVelocityMask velocityMask;
flowTools::ftFluidSimulation fluid;
flowTools::ftParticleFlow particleFlow;
flowTools::ftDisplayScalar displayScalar;
flowTools::ftVelocityField velocityField;
flowTools::ftTemperatureField temperatureField;
int numDrawForces;
flowTools::ftDrawForce* flexDrawForces;
// KINECT STUFF
void drawPointCloud();
void drawLines();
ofxKinect kinect;
ofxCvColorImage colorImg;
ofxCvGrayscaleImage grayImage; // grayscale depth image
ofxCvGrayscaleImage grayThreshNear; // the near thresholded image
ofxCvGrayscaleImage grayThreshFar; // the far thresholded image
ofxCvContourFinder contourFinder;
bool bThreshWithOpenCV;
bool bDrawPointCloud;
int nearThreshold;
int farThreshold;
int angle;
// used for viewing the point cloud
ofEasyCam easyCam;
//******** MIDI ***********
void newMidiMessage(ofxMidiMessage& eventArgs);
void drawtheMidi();
stringstream text;
ofxMidiIn midiIn;
ofxMidiMessage midiMessage;
//******** Invert ***********
ofShader shader;
ofFbo newfbo;
};
| [
"s-chord@hotmail.com"
] | s-chord@hotmail.com |
b83f7036bd982c48807ecbb24445ac6e125a7a76 | 19fd75fe50eb82ddb770f641d2dbd475d361f8cc | /t11(1)/t10(1)/t10(1)Doc.cpp | 01e9ff525dd6585f7c8cf36af45ed58f4c40d3a7 | [] | no_license | xmm123-456/Experiment | 48dc037e01a28540e0a97be163975aa1d6fb0f32 | 90382b7b415637616464bd54e3b214abbb080fec | refs/heads/master | 2021-02-15T09:34:14.793651 | 2020-06-01T12:23:20 | 2020-06-01T12:23:20 | 247,668,370 | 0 | 1 | null | null | null | null | GB18030 | C++ | false | false | 2,335 | cpp |
// t10(1)Doc.cpp : Ct101Doc 类的实现
//
#include "stdafx.h"
// SHARED_HANDLERS 可以在实现预览、缩略图和搜索筛选器句柄的
// ATL 项目中进行定义,并允许与该项目共享文档代码。
#ifndef SHARED_HANDLERS
#include "t10(1).h"
#endif
#include "t10(1)Set.h"
#include "t10(1)Doc.h"
#include <propkey.h>
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
// Ct101Doc
IMPLEMENT_DYNCREATE(Ct101Doc, CDocument)
BEGIN_MESSAGE_MAP(Ct101Doc, CDocument)
END_MESSAGE_MAP()
// Ct101Doc 构造/析构
Ct101Doc::Ct101Doc()
{
// TODO: 在此添加一次性构造代码
}
Ct101Doc::~Ct101Doc()
{
}
BOOL Ct101Doc::OnNewDocument()
{
if (!CDocument::OnNewDocument())
return FALSE;
// TODO: 在此添加重新初始化代码
// (SDI 文档将重用该文档)
return TRUE;
}
#ifdef SHARED_HANDLERS
// 缩略图的支持
void Ct101Doc::OnDrawThumbnail(CDC& dc, LPRECT lprcBounds)
{
// 修改此代码以绘制文档数据
dc.FillSolidRect(lprcBounds, RGB(255, 255, 255));
CString strText = _T("TODO: implement thumbnail drawing here");
LOGFONT lf;
CFont* pDefaultGUIFont = CFont::FromHandle((HFONT) GetStockObject(DEFAULT_GUI_FONT));
pDefaultGUIFont->GetLogFont(&lf);
lf.lfHeight = 36;
CFont fontDraw;
fontDraw.CreateFontIndirect(&lf);
CFont* pOldFont = dc.SelectObject(&fontDraw);
dc.DrawText(strText, lprcBounds, DT_CENTER | DT_WORDBREAK);
dc.SelectObject(pOldFont);
}
// 搜索处理程序的支持
void Ct101Doc::InitializeSearchContent()
{
CString strSearchContent;
// 从文档数据设置搜索内容。
// 内容部分应由“;”分隔
// 例如: strSearchContent = _T("point;rectangle;circle;ole object;");
SetSearchContent(strSearchContent);
}
void Ct101Doc::SetSearchContent(const CString& value)
{
if (value.IsEmpty())
{
RemoveChunk(PKEY_Search_Contents.fmtid, PKEY_Search_Contents.pid);
}
else
{
CMFCFilterChunkValueImpl *pChunk = NULL;
ATLTRY(pChunk = new CMFCFilterChunkValueImpl);
if (pChunk != NULL)
{
pChunk->SetTextValue(PKEY_Search_Contents, value, CHUNK_TEXT);
SetChunkValue(pChunk);
}
}
}
#endif // SHARED_HANDLERS
// Ct101Doc 诊断
#ifdef _DEBUG
void Ct101Doc::AssertValid() const
{
CDocument::AssertValid();
}
void Ct101Doc::Dump(CDumpContext& dc) const
{
CDocument::Dump(dc);
}
#endif //_DEBUG
// Ct101Doc 命令
| [
"2524398565@qq.com"
] | 2524398565@qq.com |
b129a6ca4dce7451333fb70613903c9a381b726a | 631852be684376ece3a001e9f70e92e85ae95204 | /Lista9remake/COptimizer.cpp | b23daca1a0f5bdac8915c489a92516ef95ea3c48 | [] | no_license | Agooon/Small_Company_Problem_Cpp | 0a8c8ad26ce1f9ffae115afcc49e5fa071a7ceea | 7134ef6aa164d74b1953b9981c0f754dee82dfe3 | refs/heads/master | 2021-01-03T00:51:42.055043 | 2020-03-16T20:39:06 | 2020-03-16T20:39:06 | 239,844,017 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 43 | cpp | #include "pch.h"
#include "COptimizer.h"
| [
"agonplp@gmail.com"
] | agonplp@gmail.com |
3f8f549e9d254858fc88a5b25e2c8b1b9ba0be9d | a5e0ccb723c6cb118915c4d16447042783b7a8bb | /src/PQ_leftheap/PQ_LeftHeap_insert.h | 712e8f8de7a90eb8acef5d94bd694c4548289d50 | [] | no_license | wangfanstar/dsa | 4f358d0980e1e0919d4c42759d5954141b321dbb | 1b8941447d75f0892185c9800a8fa4fcbed4f1ac | refs/heads/master | 2021-03-01T05:27:26.354154 | 2020-03-08T05:31:58 | 2020-03-08T05:31:58 | 245,757,241 | 5 | 2 | null | null | null | null | GB18030 | C++ | false | false | 631 | h | /******************************************************************************************
* Data Structures in C++
* ISBN: 7-302-33064-6 & 7-302-33065-3 & 7-302-29652-2 & 7-302-26883-3
* Junhui DENG, deng@tsinghua.edu.cn
* Computer Science & Technology, Tsinghua University
* Copyright (c) 2003-2019. All rights reserved.
******************************************************************************************/
#pragma once
template <typename T> void PQ_LeftHeap<T>::insert ( T e ) {
_root = merge( _root, new BinNode<T>( e, NULL ) ); //将e封装为左式堆,与当前左式堆合并
_size++; //更新规模
} | [
"wangfanstar@163.com"
] | wangfanstar@163.com |
e27605a8f3afc016264b53b9c185ff2fa4fcb0dd | e007351c71bd702a2cbd5a994f8775ad03b78a23 | /Code/Animation.cpp | e981e0b801dd129c484f937573ba6a15de471a3e | [] | no_license | Niogge/YetAnotherGLCrap | b3072555dbc8fba1d149b89ae455f0fe426ce207 | 4316ca7fa72598edaf3af100fe71359abd019102 | refs/heads/master | 2023-05-09T00:54:40.522476 | 2021-05-28T00:00:19 | 2021-05-28T00:00:19 | 297,765,273 | 4 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,522 | cpp | #include "Animation.h"
#include <stdio.h>
#include <string>
#include <SDL.h>
#include <SDL_Image.h>
Animation::Animation(std::string AnimName)
{
int clipLength = 0;
int currentFrame = 0;
bool IsPlaying = false;
frames = nullptr;
CurrFrameTime = 0.;
SecondsPerFrame = 0.;
AnimationName = AnimName;
}
Animation::~Animation()
{
//KEK
}
void Animation::SetAnimationClip(int startTileX, int startTileY, int EndTileX, int EndTileY, int tileW, int tileH, int FramesPerSecond)
{
//There was no need to use a malloc here, but whatever.
clipLength = ((EndTileX - startTileX + 1) * (EndTileY - startTileY + 1));
frames = (SDL_Rect*)malloc(clipLength * sizeof(SDL_Rect));
int currTile = 0;
for (int i = startTileY; i <= EndTileY; i++)
{
for ( int j = startTileX; j <= EndTileX; j++)
{
frames[currTile] = { j * tileW,i * tileH, tileW, tileH };
currTile++;
}
}
SecondsPerFrame = 1. / FramesPerSecond;
}
void Animation::AnimationExecution()
{
if (frames != nullptr)
{
if (IsPlaying)
{
CurrFrameTime += Time::GetDeltaTime();
if (CurrFrameTime >= SecondsPerFrame)
{
CurrFrameTime = 0.;
currentFrame = (currentFrame + 1) % clipLength;
}
}
}
}
SDL_Rect* Animation::GetFrame()
{
return frames + currentFrame;
}
void Animation::Play()
{
if (!IsPlaying)
{
IsPlaying = true;
currentFrame = 0;
CurrFrameTime = 0.;
}
}
void Animation::Stop()
{
IsPlaying = false;
currentFrame = 0;
CurrFrameTime = 0.;
}
std::string Animation::getName()
{
return AnimationName;
}
| [
"eugenio.ftt@gmail.com"
] | eugenio.ftt@gmail.com |
964b9fbb70a9ce3c5c8e8a3070b76df07e98314c | 5ddd70f4a4799dcbc39148415dbfad09d3a10fef | /d3d12app/d3d12app/Common/FrameResource.cpp | c2206454c36de1e9c1e7aa72e55fa06942c9a343 | [] | no_license | zhumake1993/d3d12app | 706fe718bac930c4b03a8e5a9abd91cb4943869a | 64db6773017ade7311ae835d307f5ded11fb944b | refs/heads/master | 2022-01-20T04:48:51.897430 | 2019-07-05T11:27:19 | 2019-07-05T11:27:19 | 192,184,449 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 133 | cpp | #include "FrameResource.h"
std::unique_ptr<FrameResource<PassConstants>> gPassCB = std::make_unique<FrameResource<PassConstants>>(); | [
"zhumake1993@gmail.com"
] | zhumake1993@gmail.com |
4efdf6cb4aee2b5ae37e13ba266036eb6705b45e | 97357bd7c9fad1473104da35512c7795c4adac38 | /ds/disjointSet.cpp | d3f7297821ceef07a60cfee0b586aabafd2785d1 | [] | no_license | sdsmt-blue-team/Programming-Team-Code | a732f6ba4b036d980dea33b858cf7b606c90dd49 | 7d6271c9309cd72c0d8041b7ee78573aa895c9aa | refs/heads/master | 2020-12-27T19:44:54.219490 | 2020-02-08T17:15:18 | 2020-02-08T17:15:18 | 238,029,160 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 249 | cpp | vector<int> p(1000001,-1);//change size here if needed
int find(int x) {return p[x] < 0 ? x : p[x] = find(p[x]);}
void merge(int x, int y) {
if((x=find(x)) == (y=find(y))) return;
if(p[y] < p[x]) swap(x,y);
p[x] += p[y];
p[y] = x;
}
| [
"luke.videckis@mines.sdsmt.edu"
] | luke.videckis@mines.sdsmt.edu |
81a317c3b9e9fbb2ca95811266156692000e468d | f2c113f4bfa9b6179784cbbb15edf063318f34d3 | /LnB/Source/LnB/Player/LnBPlayerController.h | 125279b2d7fe8de23796b58c5656a07430bab968 | [] | no_license | calebsmth54/LeadNBrimstone | 7447d7e542bf2d203222fefaa4075d8672008a99 | b58b2a3cc484b04e645b24327867d57e0f7dee2a | refs/heads/master | 2021-01-01T04:15:35.305613 | 2018-01-09T07:07:30 | 2018-01-09T07:07:30 | 97,155,318 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 505 | h | //=============================================================================
// Shown here with permission from Waden Kane Game Studios, LLC.
//=============================================================================
#pragma once
#include "GameFramework/PlayerController.h"
#include "LnBPlayerController.generated.h"
UCLASS()
class LNB_API ALnBPlayerController : public APlayerController
{
GENERATED_BODY()
public:
ALnBPlayerController();
virtual void Tick(float DeltaTime) override;
};
| [
"calebsmth54@gmail.com"
] | calebsmth54@gmail.com |
757eb57bd42e8b9d13ae1d63cebe7a92f8259e45 | 389d83fd02cd4ed07c20cd16ef0976dd0f37f83d | /contest06/bai29.cpp | 16870d80b03f6a76d623d9a894936dc9a1a7861b | [] | no_license | minchau2111/Code | 1c2240ed6adca009474d4fbf024f06c33b10759a | 45d21acf0af5e1067ac06350ebc3c86db422fdcb | refs/heads/master | 2022-11-08T13:18:49.825456 | 2020-06-25T02:34:10 | 2020-06-25T02:34:10 | 269,273,534 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 845 | cpp | // sắp xếp nổi bọt
#include<bits/stdc++.h>
using namespace std;
bool ok(int a[],int n){
for (int i = 0; i < n - 1; i++)
{
if (a[i] > a[i + 1])
return false;
}
return true;
}
int main(){
int n;
cin>>n;
int a[n + 5];
for (int i = 0; i < n;i++){
cin >> a[i];
}
bool check = false;
int dem = 0;
for (int i = 0; i < n - 1; i++)
{
check = false;
for (int j = 0; j < n - 1; j++)
{
if (a[j] > a[j + 1]){
check = true;
swap(a[j], a[j + 1]);
}
}
if(check){
dem++;
cout << "Buoc " << dem << ": ";
for (int k = 0; k < n; k++)
{
cout << a[k] << " ";
}
cout << endl;
}
}
} | [
"chimsetocxu211427@gmail.com"
] | chimsetocxu211427@gmail.com |
ec464373c4c6ad25ac774310de3e3f64aea5adcc | 8cc202327c1faac92971aec18126eb295b70d42c | /demo_gl/gldemo.cpp | fe1907deb4a1a76cff350a3e808fbd7b7bd7dbbc | [] | no_license | wengpingbo/Fascinating-Graphics | 37c5cb07a0a5f804a0f1be92f57f498e38282fd5 | 1e853af38ed82b98bc2cbf05948979004c768cf9 | refs/heads/master | 2020-03-29T22:26:43.887456 | 2014-01-04T04:27:52 | 2014-01-04T04:27:52 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,300 | cpp | #include "gldemo.h"
gldemo::gldemo(QGLWidget *parent)
: QGLWidget(parent)
{
setFormat(QGLFormat(QGL::DoubleBuffer | QGL::DepthBuffer));
rotationX = -21.0;
rotationY = -57.0;
rotationZ = 0.0;
faceColors[0] = Qt::red;
faceColors[1] = Qt::green;
faceColors[2] = Qt::blue;
faceColors[3] = Qt::yellow;
}
gldemo::~gldemo()
{
}
void gldemo::initializeGL()
{
qglClearColor(Qt::black);
glShadeModel(GL_FLAT);
glEnable(GL_DEPTH_TEST);
glEnable(GL_CULL_FACE);
}
void gldemo::resizeGL(int width, int height)
{
glViewport(0, 0, width, height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
GLfloat x = GLfloat(width) / height;
glFrustum(-x, x, -1.0, 1.0, 4.0, 15.0);
glMatrixMode(GL_MODELVIEW);
}
void gldemo::paintGL()
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
draw();
}
void gldemo::mouseDoubleClickEvent(QMouseEvent *event)
{
int face = faceAtPosition(event->pos());
if (face != -1) {
QColor color = QColorDialog::getColor(faceColors[face], this);
if (color.isValid()) {
faceColors[face] = color;
updateGL();
}
}
}
void gldemo::mouseMoveEvent(QMouseEvent *event)
{
GLfloat dx = GLfloat(event->x() - lastPos.x()) / width();
GLfloat dy = GLfloat(event->y() - lastPos.y()) / height();
if (event->buttons() & Qt::LeftButton) {
rotationX += 180 * dy;
rotationY += 180 * dx;
updateGL();
} else if (event->buttons() & Qt::RightButton) {
rotationX += 180 * dy;
rotationZ += 180 * dx;
updateGL();
}
lastPos = event->pos();
}
void gldemo::mousePressEvent(QMouseEvent *event)
{
lastPos = event->pos();
}
void gldemo::draw()
{
static const GLfloat P1[3] = { 0.0, -1.0, +2.0 };
static const GLfloat P2[3] = { +1.73205081, -1.0, -1.0 };
static const GLfloat P3[3] = { -1.73205081, -1.0, -1.0 };
static const GLfloat P4[3] = { 0.0, +2.0, 0.0 };
static const GLfloat * const coords[4][3] = {
{ P1, P2, P3 }, { P1, P3, P4 }, { P1, P4, P2 }, { P2, P4, P3 }
};
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glTranslatef(0.0, 0.0, -10.0);
glRotatef(rotationX, 1.0, 0.0, 0.0);
glRotatef(rotationY, 0.0, 1.0, 0.0);
glRotatef(rotationZ, 0.0, 0.0, 1.0);
for (int i = 0; i < 4; ++i) {
glLoadName(i);
glBegin(GL_TRIANGLES);
qglColor(faceColors[i]);
for (int j = 0; j < 3; ++j) {
glVertex3f(coords[i][j][0], coords[i][j][1],
coords[i][j][2]);
}
glEnd();
}
}
int gldemo::faceAtPosition(const QPoint &pos)
{
const int MaxSize = 512;
GLuint buffer[MaxSize];
GLint viewport[4];
glGetIntegerv(GL_VIEWPORT, viewport);
glSelectBuffer(MaxSize, buffer);
glRenderMode(GL_SELECT);
glInitNames();
glPushName(0);
glMatrixMode(GL_PROJECTION);
glPushMatrix();
glLoadIdentity();
gluPickMatrix(GLdouble(pos.x()), GLdouble(viewport[3] - pos.y()),
5.0, 5.0, viewport);
GLfloat x = GLfloat(width()) / height();
glFrustum(-x, x, -1.0, 1.0, 4.0, 15.0);
draw();
glMatrixMode(GL_PROJECTION);
glPopMatrix();
if (!glRenderMode(GL_RENDER))
return -1;
return buffer[3];
}
| [
"wengpingbo@gmail.com"
] | wengpingbo@gmail.com |
c0004ebc87d25a8cc6925ec98a5c632be8b2de3c | 54d22598aaf801c2cf00c37f65164f93e26b90b1 | /ac_controllerAdafuitIO/ac_controllerAdafuitIO.ino | 85ec349ead30880f43311355d364b49abf85cb78 | [
"CC0-1.0"
] | permissive | LOVOTLAB/Carrier-AC-IR-Remote | bd4b57e3e1ef8d8667bbbed868e1a798f6b3ce0b | 5687fa75191c419052556cd657975d91c5c7ea67 | refs/heads/master | 2022-12-13T10:51:08.873618 | 2020-09-10T02:58:28 | 2020-09-10T02:58:28 | 294,280,403 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,785 | ino | // Adafruit IO Subscription Example
//
// Adafruit invests time and resources providing this open source code.
// Please support Adafruit and open source hardware by purchasing
// products from Adafruit!
//
// Written by Todd Treece for Adafruit Industries
// Copyright (c) 2016 Adafruit Industries
// Licensed under the MIT license.
//
// All text above must be included in any redistribution.
/************************** Configuration ***********************************/
// edit the config.h tab and enter your Adafruit IO credentials
// and any additional configuration needed for WiFi, cellular,
// or ethernet clients.
#include "config.h"
/************************ Example Starts Here *******************************/
// set up the 'counter' feed
AdafruitIO_Feed *acpower = io.feed("acpower");
AdafruitIO_Feed *actemp = io.feed("actemp");
AdafruitIO_Feed *acmode = io.feed("acmode");
AdafruitIO_Feed *acindicator = io.feed("acindicator");
int o, t, m = 0;
// IR Remote
#include <Arduino.h>
#include <IRremoteESP8266.h>
#include <IRsend.h>
const uint16_t kIrLed = 4; // ESP8266 GPIO pin to use. Recommended: 4 (D2).
int count = 0;
IRsend irsend(kIrLed); // Set the GPIO to be used to sending the message.
// Example of data captured by IRrecvDumpV2.ino
uint16_t rawData[99] = {};
// DoorSwitch
int lastStatus = 0;
void setup() {
// IR Remote
irsend.begin();
pinMode(D4, OUTPUT);
digitalWrite(D4, LOW);
for (int i = 0; i < 99; i++) {
if (i % 2 == 1) rawData[i] = 500;
else rawData[i] = 550;
}
// start the serial connection
Serial.begin(115200);
// wait for serial monitor to open
while (! Serial);
Serial.print("Connecting to Adafruit IO");
// start MQTT connection to io.adafruit.com
io.connect();
// set up a message handler for the count feed.
// the handleMessage function (defined below)
// will be called whenever a message is
// received from adafruit io.
acpower->onMessage(acpowerHandleMessage);
actemp->onMessage(actempHandleMessage);
acmode->onMessage(acmodeHandleMessage);
// wait for an MQTT connection
// NOTE: when blending the HTTP and MQTT API, always use the mqttStatus
// method to check on MQTT connection status specifically
while (io.mqttStatus() < AIO_CONNECTED) {
Serial.print(".");
delay(500);
}
// Because Adafruit IO doesn't support the MQTT retain flag, we can use the
// get() function to ask IO to resend the last value for this feed to just
// this MQTT client after the io client is connected.
acpower->get();
actemp->get();
acmode->get();
// we are connected
Serial.println();
Serial.println(io.statusText());
pinMode(D1, INPUT_PULLUP);
}
void loop() {
// io.run(); is required for all sketches.
// it should always be present at the top of your loop
// function. it keeps the client connected to
// io.adafruit.com, and processes any incoming data.
io.run();
// Because this sketch isn't publishing, we don't need
// a delay() in the main program loop.
int currentStatus = digitalRead(D1);
if (lastStatus != currentStatus) {
Serial.println(currentStatus);
if (currentStatus) acindicator->save(1);
else acindicator->save(0);
lastStatus = currentStatus;
Serial.println(currentStatus);
delay(10);
}
}
// this function is called whenever a 'counter' message
// is received from Adafruit IO. it was attached to
// the counter feed in the setup() function above.
void acpowerHandleMessage(AdafruitIO_Data *data) {
o = data->toInt();
makeRemoteCode(o, m, 18, t, 0, 0);
}
void actempHandleMessage(AdafruitIO_Data *data) {
t = data->toInt();
makeRemoteCode(o, m, 18, t, 0, 0);
}
void acmodeHandleMessage(AdafruitIO_Data *data) {
m = data->toInt();
makeRemoteCode(o, m, 18, t, 0, 0);
}
| [
"noreply@github.com"
] | noreply@github.com |
7ba2ce033fef5a94b2ffc4ec2e8cb749367bc69a | 24411a9cfe06f4e52ff4f7689ee09ebdadebb863 | /Shared/HotTracker.cpp | 74135bbd66b55fc373416bd262902f55ac3fc442 | [] | no_license | JohnnyXiaoYang/ToDoList_7.2 | 6371a2d24f86e6781566ba0a86b43c3a2d57a97f | 7f0f14a49b55304b71b257c0086fbb179c12dbc7 | refs/heads/master | 2022-11-30T23:55:53.309392 | 2020-08-16T01:22:04 | 2020-08-16T01:22:04 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,353 | cpp | // HotTracker.cpp: implementation of the CHotTracker class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "HotTracker.h"
#include "DialogHelper.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
CHotTracker::CHotTracker() : m_nHotRect(-1)
{
}
CHotTracker::~CHotTracker()
{
}
BOOL CHotTracker::Initialize(CWnd* pWnd)
{
if (pWnd && pWnd->GetSafeHwnd() && HookWindow(*pWnd))
return TRUE;
return FALSE;
}
int CHotTracker::AddRect(const CRect& rect)
{
m_aRects.Add((CRect&)rect);
return m_aRects.GetSize() - 1;
}
int CHotTracker::AddRect()
{
static CRect rTemp(0, 0, 0, 0);
m_aRects.Add(rTemp);
return m_aRects.GetSize() - 1;
}
BOOL CHotTracker::UpdateRect(int nRect, const CRect& rect)
{
if (nRect < 0 || nRect >= m_aRects.GetSize())
return FALSE;
m_aRects[nRect] = rect;
return TRUE;
}
BOOL CHotTracker::DeleteRect(int nRect)
{
if (nRect < 0 || nRect >= m_aRects.GetSize())
return FALSE;
m_aRects.RemoveAt(nRect);
return TRUE;
}
BOOL CHotTracker::GetRect(int nRect, CRect& rect)
{
if (nRect < 0 || nRect >= m_aRects.GetSize())
return FALSE;
rect = m_aRects[nRect];
return TRUE;
}
int CHotTracker::HitTest(CPoint ptScreen)
{
int nRect = m_aRects.GetSize();
if (nRect)
{
ScreenToClient(&ptScreen);
while (nRect--)
{
if (m_aRects[nRect].PtInRect(ptScreen))
return nRect;
}
}
return -1;
}
LRESULT CHotTracker::WindowProc(HWND /*hRealWnd*/, UINT msg, WPARAM /*wp*/, LPARAM /*lp*/)
{
switch (msg)
{
case WM_NCMOUSELEAVE:
case WM_MOUSELEAVE:
case WM_NCMOUSEMOVE:
case WM_MOUSEMOVE:
if (m_aRects.GetSize())
{
int nRect = HitTest(::GetMessagePos());
if (nRect != m_nHotRect)
{
SendMessage(WM_HTHOTCHANGE, m_nHotRect, nRect);
m_nHotRect = nRect;
}
if (msg == WM_NCMOUSEMOVE || msg == WM_MOUSEMOVE)
InitTracking();
}
break;
}
return Default();
}
void CHotTracker::InitTracking()
{
if (m_aRects.GetSize())
CDialogHelper::TrackMouseLeave(GetHwnd());
}
void CHotTracker::Reset()
{
m_aRects.RemoveAll();
CDialogHelper::TrackMouseLeave(GetHwnd(), FALSE);
HookWindow(NULL);
}
| [
"daniel.godson@gmail.com"
] | daniel.godson@gmail.com |
da42873a6f59d5e7e7dc62242c09f4b488540918 | 41f3c18ce759df5eb0d5a80fa4e8cf2883ecf98c | /dev skill/contest 21/c.cpp | c15fa5a499d120641c74ca5db47d91381db0a151 | [] | no_license | tanvirtareq/programming | 6d9abafb844b1e80b7691157b0581a3b25b9cd59 | 040f636773df2d89fb7c169fe077f527f68140a4 | refs/heads/master | 2021-06-27T12:07:07.585682 | 2021-03-28T12:39:49 | 2021-03-28T12:39:49 | 217,275,688 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 720 | cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long unsigned lld;
struct a{
int score ;
string name;
};
bool comp(a p, a q)
{
if(p.score==q.score) return p.name<q.name;
return p.score>q.score;
}
int main()
{
int t;
cin>>t;
vector<a> v;
while(t--)
{
string st;
cin>>st;
int x;
cin>>x;
int sc=0;
while(x--)
{
int t;
cin>>t;
sc+=t;
}
a tmp;
tmp.name=st;
tmp.score=sc;
v.push_back(tmp);
}
sort(v.begin(), v.end(), comp);
for(int i=0;i<v.size();i++)
{
cout<<v[i].name<<endl;
}
return 0;
}
| [
"cse.tanvir.17@gmail.com"
] | cse.tanvir.17@gmail.com |
a87fffc729d55e8ccd8c5d6b66193b89ec781a86 | 46782dfb451f38cceb24ac432c315c76baa06e42 | /TLC5928.h | dfb8a3da3e2369f57b959600d1587f87ccf460a4 | [
"Unlicense"
] | permissive | ge-lem/TLC5928 | 450ace648963abc912586c703514f6bc9684635e | 42aa3bac6f6a1e00d93120e0f0dda9e8a9d8604e | refs/heads/master | 2022-05-06T20:32:49.096621 | 2019-02-10T02:15:34 | 2019-02-10T02:15:34 | 169,934,556 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,252 | h |
#ifndef TLC5928_h
#define TLC5928_h
#if defined(ARDUINO) && ARDUINO >= 100
#include "Arduino.h"
#else
#include "WProgram.h"
#endif
#include <inttypes.h>
class TLC5928
{
public:
/**
\param clk Clock pin
\param data Data pin
\param latch Latch pin
\param blank Blank pin
\param num number of chained TLC5928
*/
TLC5928(uint8_t clk, uint8_t data, uint8_t latch, uint8_t blank, uint8_t num);
~TLC5928();
/** Initialise the pin and allocate the led buffer
*/
void begin();
/** Set state of a LED
\param numpi number of the led
\param on On/Off state of the led
*/
void setPixel(uint16_t numpi, bool on);
/** Set state of a LED
\param numtlc number of ship
\param numpi number of the led on the specified ship
\param on On/Off state of the led
*/
void setPixel(uint16_t numtlc, uint16_t numpi, bool on);
/** Turn on the LEDs power
*/
void on();
/** Turn off the LEDs power
*/
void off();
/** Apply the change to the LEDs
*/
void show();
/** Turn off all the LEDs
*/
void clear();
protected:
uint8_t pin_clk;
uint8_t pin_data;
uint8_t pin_latch;
uint8_t pin_blank;
uint8_t num;
byte * buffer;
private:
void writeBit(bool on);
};
#endif
| [
"germain.lemasson@gmail.com"
] | germain.lemasson@gmail.com |
6ee1ce47a0d5282091c6005879cb59ab33579206 | 7452a2478c3bd8afb4b376dc18960f9207f03e54 | /test/test_server.cpp | 972d990ad6d071aa3772552a7c2ff57d379e9daf | [] | no_license | happyxiaotao/sword | c512375c4453cc08b9a162ebba8e36df60e0f285 | a991100efc5ab8db4d4d7a8c45f5eb66ebcdd160 | refs/heads/master | 2023-03-30T07:57:03.300575 | 2021-04-01T18:37:43 | 2021-04-01T18:37:43 | 353,782,635 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,331 | cpp | //
// async_tcp_echo_server.cpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2020 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//
#include <cstdlib>
#include <iostream>
#include <memory>
#include <utility>
#include <asio.hpp>
using asio::ip::tcp;
class session
: public std::enable_shared_from_this<session>
{
public:
session(tcp::socket socket)
: socket_(std::move(socket))
{
}
void start()
{
do_read();
}
private:
void do_read()
{
auto self(shared_from_this());
socket_.async_read_some(asio::buffer(data_, max_length),
[this, self](std::error_code ec, std::size_t length) {
if (!ec)
{
do_handler(length);
}
});
}
void do_handler(std::size_t length)
{
data_[length - 1] = '\0';
char szType[32] = {0};
char szData[1024] = {0};
sscanf(data_, "%s %s", szType, szData);
std::cout << "|||" << szType << "|||" << szData << std::endl;
if (!strcmp(szType, "login"))
{
do_write("login success");
}
else if (!strcmp(szType, "quit"))
{
do_write("exit success");
}
else
{
do_write("unknwo type");
}
}
void do_write(std::size_t length)
{
auto self(shared_from_this());
asio::async_write(socket_, asio::buffer(data_, length),
[this, self](std::error_code ec, std::size_t /*length*/) {
if (!ec)
{
do_read();
}
});
}
void do_write(std::string str)
{
auto self(shared_from_this());
asio::async_write(socket_, asio::buffer(str),
[this, self](std::error_code ec, std::size_t) {
if (!ec)
{
do_read();
}
});
}
tcp::socket socket_;
enum
{
max_length = 1024
};
char data_[max_length];
};
class server
{
public:
server(asio::io_context &io_context, short port)
: acceptor_(io_context, tcp::endpoint(tcp::v4(), port))
{
do_accept();
}
private:
void do_accept()
{
acceptor_.async_accept(
[this](std::error_code ec, tcp::socket socket) {
if (!ec)
{
std::make_shared<session>(std::move(socket))->start();
}
do_accept();
});
}
tcp::acceptor acceptor_;
};
int main(int argc, char *argv[])
{
try
{
asio::io_context io_context;
server s(io_context, 9999);
io_context.run();
}
catch (std::exception &e)
{
std::cerr << "Exception: " << e.what() << "\n";
}
return 0;
}
| [
"1652192564@qq.com"
] | 1652192564@qq.com |
ef75e6ad9180e827dec0929ddf7689cbe3569275 | 75bb52c11587ea6c286e5fcd311369850e74dfde | /3-02_b/src/ofApp.cpp | 8b131d48a5002b872d89a432a156df623b41bfe2 | [] | no_license | tado/BeyondInteraction_2nd_examples | 6d763f889a7014fbf63113b263c0aac58dacf878 | b59a333e45ebd7fa2ebd7aa991530dcca426a931 | refs/heads/master | 2021-01-10T18:55:41.437469 | 2020-03-11T01:55:22 | 2020-03-11T01:55:22 | 7,948,883 | 26 | 17 | null | 2016-03-08T21:53:10 | 2013-02-01T00:36:41 | C++ | UTF-8 | C++ | false | false | 2,291 | cpp | #include "ofApp.h"
void ofApp::setup(){
sampleRate = 44100; //サンプリング周波数
bufSize = 256;
amp = 0.5; //音量
pan = 0.5; //左右の定位
phase = 0; //位相
frequency = 440; //周波数
ofSetFrameRate(30);
ofBackground(32, 32, 32);
ofSoundStreamSettings settings;
settings.setOutListener(this);
settings.sampleRate = sampleRate;
settings.numOutputChannels = 2;
settings.numInputChannels = 0;
settings.bufferSize = 512;
soundStream.setup(settings);
}
void ofApp::update(){
}
void ofApp::draw(){
float audioHeight = ofGetHeight()/2.0f;
float phaseDiff = ofGetWidth()/float(bufSize);
ofSetColor(0,0,255); //波形を描く色
ofNoFill(); //塗り潰しをしない
ofSetLineWidth(2); //線の太さを2pixで
//左チャンネル波形を描画
ofBeginShape();
for (int i = 0; i < bufSize; i++){
ofVertex(i * phaseDiff, audioHeight/2 + lAudio[i] * audioHeight);
}
ofEndShape();
//右チャンネル波形を描画
ofBeginShape();
for (int i = 0; i < bufSize; i++){
ofVertex(i * phaseDiff, audioHeight / 2 * 3 + rAudio[i] * audioHeight);
}
ofEndShape();
}
void ofApp::keyPressed(int key){
}
void ofApp::keyReleased(int key){
}
void ofApp::mouseMoved(int x, int y){
}
void ofApp::mouseDragged(int x, int y, int button){
}
void ofApp::mousePressed(int x, int y, int button){
}
void ofApp::mouseReleased(int x, int y, int button){
}
void ofApp::windowResized(int w, int h){
}
void ofApp::audioRequested(float * output, int bufferSize, int nChannels){
float sample; //出力する音のサンプル
float phaseDiff; //位相の変化
//1サンプルあたりの位相の変化を計算
phaseDiff = TWO_PI * frequency / sampleRate;
//バッファのサイズ分の波形を生成
for (int i = 0; i < bufferSize; i++){
//位相を更新
phase += phaseDiff;
while (phase > TWO_PI){
phase -= TWO_PI;
}
//Sin波を生成
sample = sin(phase);
// オーディオアウト、左右2ch
lAudio[i] = output[i * nChannels] = sample * pan * amp;
rAudio[i] = output[i * nChannels + 1] = sample * pan * amp;
}
}
| [
"tadokoro@gmail.com"
] | tadokoro@gmail.com |
41d00d368367ba7ee8ea67e035d5367f9275c90f | 16e8b24f714a81e67ac7d15596c5d8ee51351da2 | /KulmaSimulator/KulmaSimulator/src/resources/mesh.cpp | 7ec1908b75b96c30bdd711626ac49a461b1ed9d6 | [] | no_license | siquel/KulmaSimulator | 3384db80133e8817eb2b6566aa38b5a08122bc1d | 9fb1dc02a306eb3cc3a2f85c6936b2d94c6692e8 | refs/heads/master | 2020-07-04T03:10:35.470513 | 2015-05-14T20:03:09 | 2015-05-14T20:03:09 | 29,351,108 | 2 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 3,560 | cpp | #include "resources/mesh.h"
#include <fstream>
#include <sstream>
#include "GLM.h"
#include "simulator.h"
Mesh::Mesh() {}
Mesh::~Mesh() {}
bool Mesh::readFromFile(const std::string& path) {
std::string fullpath(path + ".obj");
std::ifstream in(fullpath);
if (!in.is_open()) return false;
std::vector<GLuint> vertexIndices, uvIndices, normalIndices;
std::vector<glm::vec3> tmpVertices, tmpNormals;
std::vector<glm::vec2> tmpUvs;
std::string line;
std::string prefix;
std::stringstream ss;
size_t currentMaterial = 0;
while (!in.eof()) {
std::getline(in, line);
ss.str(""); ss.clear();
ss << line;
ss >> prefix >> std::ws;
// todo move this
if (prefix == "mtllib") {
std::string file;
ss >> file;
size_t index = path.rfind("\\");
if (index != std::string::npos) {
textures = Mtllib::import(path.substr(0, index + 1) + file);
}
else {
textures = Mtllib::import(file);
}
continue;
}
if (prefix == "usemtl") {
std::string material;
ss >> material;
for (size_t i = 0; i < textures.size(); i++) {
//if (textures[i].getName() != material) continue;
currentMaterial = i;
break;
}
}
else if (prefix == "v") {
//vertex
glm::vec3 v;
ss >> v.x >> v.y >> v.z >> std::ws;
tmpVertices.push_back(v);
}
else if (prefix == "vt") {
// texture coord
glm::vec2 uv;
ss >> uv.x >> uv.y >> std::ws;
tmpUvs.push_back(uv);
}
else if (prefix == "vn") {
// normal
glm::vec3 v;
ss >> v.x >> v.y >> v.z >> std::ws;
tmpNormals.push_back(v);
}
else if (prefix == "f") {
// index
for (size_t i = 0; i < 3; i++) {
GLuint v, t, n;
char c;
ss >> v >> c >> t >> c >> n >> std::ws;
vertexIndices.push_back(v);
uvIndices.push_back(t);
normalIndices.push_back(n);
}
}
}
// f = v/vt/vn
for (size_t i = 0; i < vertexIndices.size(); i++) {
size_t index = vertexIndices[i];
glm::vec3& vertex = tmpVertices[index - 1];
vertices.push_back(vertex.x);
vertices.push_back(vertex.y);
vertices.push_back(vertex.z);
index = uvIndices[i];
glm::vec2& uv = tmpUvs[index - 1];
vertices.push_back(uv.x);
vertices.push_back(uv.y);
index = normalIndices[i];
// hax TODO fix
if (tmpNormals.size() == 0) {
vertices.push_back(0.f);
vertices.push_back(0.f);
vertices.push_back(0.f);
}
else {
glm::vec3& normal = tmpNormals[index - 1];
vertices.push_back(normal.x);
vertices.push_back(normal.y);
vertices.push_back(normal.z);
}
}
return true;
}
const std::vector<GLfloat>& Mesh::getVertices() const {
return vertices;
}
const std::vector<Texture*>& Mesh::getTextures() const {
return textures;
}
std::vector<Texture*> Mtllib::import(const std::string& file) {
std::ifstream in(file);
assert(in.is_open());
std::string line;
std::string prefix;
std::stringstream ss;
std::vector<Texture*> textures;
// as we increase it later to 0
int current = -1;
while (!in.eof()) {
std::getline(in, line);
ss.clear(); ss.str(""); prefix.clear();
ss << line;
ss >> prefix;
if (prefix == "map_Kd") {
std::string path;
ss >> path >> std::ws;
// get rid of content dir
std::string fullpath(file.substr(Simulator::getInstance().getContent().getRoot().length() + 1));
// get dirname
fullpath.erase(std::find(fullpath.rbegin(), fullpath.rend(), '\\').base(), fullpath.end());
// add original filename
fullpath += path.substr(0, path.find('.'));
textures.push_back(Simulator::getInstance().getContent().load<Texture>(fullpath));
}
}
return textures;
} | [
"squual@kahvipaussi.net"
] | squual@kahvipaussi.net |
20c1fb0c3bb7d1aba9be8cacb279af7899ba46a1 | da5849cc6ab950a716131fb8c2bee2267e627463 | /algorithm/leetcode/60_Permutation_Sequence/main2.cpp | c8350d6009aa424be7bf9f24a88af7381172a77d | [] | no_license | leisheyoufu/study_exercise | 5e3beba7763f2dfafa426932e21f110df1fd150e | db58097f4b542aea894b11feae31fb26006d5ebc | refs/heads/master | 2023-08-16T21:29:26.967795 | 2023-08-11T03:09:31 | 2023-08-11T03:09:31 | 13,537,939 | 3 | 1 | null | 2023-09-05T21:59:21 | 2013-10-13T11:13:29 | Jupyter Notebook | UTF-8 | C++ | false | false | 1,735 | cpp | /*
60. Permutation Sequence
The set [1,2,3,…,n] contains a total of n! unique permutations.
By listing and labeling all of the permutations in order,
We get the following sequence (ie, for n = 3):
"123"
"132"
"213"
"231"
"312"
"321"
Given n and k, return the kth permutation sequence.
Note: Given n will be between 1 and 9 inclusive.
*/
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
using namespace std;
class Solution
{
public:
int get_fac(int n)
{
if (n==1) {
return 0;
}
int val = 1;
for(int i=1; i<n; i++) {
val *= i;
}
return val;
}
int get_index_val(int n, int index, vector<bool> &vis)
{
for(int i=1; i<=n; i++) {
if(vis[i-1] == true) {
continue;
}
if (index == 0) {
vis[i-1] = true;
return i;
}
if(vis[i-1] == false) {
index--;
}
}
vis[n-1] = true;
return n;
}
string getPermutation(int n, int k)
{
vector<bool> vis(n, false);
string ret(n, 0);
for(int i=n; i>=1; i--) {
int f = get_fac(i);
int index;
// cl index is started from 0
if (f == 0) {
index = 0;
} else {
index = (k-1)/f;
}
k -= index * f;
ret[n-i] = get_index_val(n, index, vis) + '0';
}
return ret;
}
};
int main()
{
Solution sln;
cout << sln.getPermutation(1,1) << endl; // 1
cout << sln.getPermutation(9,254) << endl; // "123645978"
system("pause");
return 0;
}
| [
"clscu@live.cn"
] | clscu@live.cn |
e3c530b5da9a3767febffba4a94e2d44cd0f7601 | 30375193518f9388b734a3f8a38a44feab0e7c49 | /ServerCommunication.h | 790f9dd77af86040cd59ff068b3c2f8ac3161f8b | [] | no_license | ganeshvjy/MessagePassingCommunication | f35eea2f0e441e6445d3fe867139bce340c0846a | c991aa1554dfb8e62a21644cca34a4a1707567d2 | refs/heads/master | 2020-05-18T07:52:39.406106 | 2014-12-29T19:28:58 | 2014-12-29T19:28:58 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 6,397 | h | #ifndef SERVERCOMMUNICATION_H
#define SERVERCOMMUNICATION_H
///////////////////////////////////////////////////////////////////
// Server App.h - Server Applcation receives open message//
// from different clients and process them //
// and sends acknowledgement to the respective//
// clients. //
// Language: standard C++ //
// Platform: Toshiba Satellite Windows 8 //
// Application: Message Passing Communication //
// Author: Ganesh Thiagarajan, Syracuse University //
// gthiagar@syr.edu //
///////////////////////////////////////////////////////////////////
// Module Operations: //
// ------------------- //
// Server App: - Creates a open receiver to receive //
// input message from the different clients //
// - Process the requests and receives data //
// from different clients. //
// - Sends Acknowledegement to each client //
///////////////////////////////////////////////////////////////////
//
#include "../Sockets/Sockets.h"
#include "../Threads/Threads.h"
#include "../Threads/Locks.h"
#include "../BlockingQueue/BlockingQueue.h"
#include "../HTTPMessage/HTTPMessage.h"
#include "Base_64.h"
#include <string>
#include <iostream>
#include <fstream>
#include <sstream>
using namespace std;
///////////////////////////////////////////////////
// ClientHandlerThread thread
class ServerHandlerThread : public tthreadBase
{
public:
ServerHandlerThread(Socket s, BlockingQueue<std::string>& q) : s_(s), q_(q) {}
private:
void run()
{
std::string msg;
do
{
doLog("receive thread reading line");
msg = s_.readLine();
if (msg == "")
break;
q_.enQ(msg);
} while (msg != "quit");
}
Socket s_;
BlockingQueue<std::string>& q_;
};
///////////////////////////////////////////////////
// listenThread thread
class ListenThread : public threadBase
{
public:
ListenThread(int port, BlockingQueue<std::string>& q) : listener_(port), q_(q), stop_(false) {}
void stop(bool end) { stop_ = end; }
private:
void run()
{
while (!stop_)
{
SOCKET s = listener_.waitForConnect();
ServerHandlerThread* pCh = new ServerHandlerThread(s, q_);
pCh->start();
}
}
bool stop_;
BlockingQueue<std::string>& q_;
SocketListener listener_;
};
/////////////////////////////////////////////////////////////////////////////////
// Sender Classes below
/////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////
// SendThread thread
class SendThread : public threadBase
{
public:
SendThread(Socket s, BlockingQueue<std::string>& q) : s_(s), q_(q) {}
std::string& status() { return status_; }
private:
void run()
{
status_ = "good";
doLog("send thread running");
std::string msg;
do
{
doLog("send thread enqing msg");
msg = q_.deQ();
if (!s_.writeLine(msg))
{
sout << "\n bad status in sending thread";
status_ = "bad";
break;
}
} while (msg != "stop");
s_.disconnect();
}
std::string status_;
Socket s_;
BlockingQueue<std::string>& q_;
};
std::string ToString(int i)
{
std::ostringstream conv;
conv << i;
return conv.str();
}
class Sender
{
public:
Sender(HTTPMessage& msg) :msg_(msg){
port = msg.getClientPort();
};
void start()
{
pSt = new SendThread(s_, q_);
pSt->start();
if (!s_.connect(ip, port))
{
sout << locker << "\n couldn't connect to " << ip << ":" << port << "\n\n" << unlocker;
delete pSt;
return;
}
else
{
sout << locker << "\n Connected to: " << ip << ":" << port << "\n\n" << unlocker;
std::string logMsg = "\n connected to " + ip + ":" + ToString(port);
doLog(logMsg.c_str());
}
doLog("starting Sender");
q_.enQ(msg_.BuiltBody());
q_.enQ("stop");
pSt->join();
delete pSt;
}
private:
Socket s_;
BlockingQueue<std::string> q_;
SendThread* pSt;
HTTPMessage& msg_;
std::string ip ="127.0.0.1";
std::string filepath;
int port;
};
///////////////////////////////////////////////////
// DemoThread is used to get two or more senders
// running concurrently from a single process, to
// make testing easier.
class DemoThread : public threadBase
{
public:
DemoThread(Sender sndr) : sndr_(sndr) {}
private:
void run()
{
sndr_.start();
}
Sender sndr_;
};
////////////////////////////////////////////////////
// Receiver class below
////////////////////////////////////////////////////
class Receiver
{
public:
void start(int port)
{
sout << "\n Server Initializing in port:"<< port;
pLt = new ListenThread(port, q_);
try
{
pLt->start();
std::string msg;
int count = 0;
HTTPMessage Ack;
do
{
msg = q_.deQ();
if (msg.find("BINARY") != string::npos)
{
msg = q_.deQ();
std::vector<char> vdecoded = Base64::decode(msg);
std::string decodedMsg(vdecoded.begin(), vdecoded.end());
sout << "\n\tDecoding Binary File received...";
// Commenting out the Binary File data printing to make the output Good.
// sout << msg.c_str();
msg = q_.deQ();
}
if (msg.find("Client IP:") != string::npos)
{
std::string IPAddress, clientPort, ClientIP;
IPAddress.assign(msg.begin() + 11, msg.end());
int port = IPAddress.find(":");
ClientIP.assign(IPAddress, 0, port);
int cIP = atoi(ClientIP.c_str());
clientPort.assign(IPAddress, port + 1, 4);
int cport = atoi(clientPort.c_str());
Ack.setPort(cport);
Ack.setIP(cIP);
}
if (msg.find("stop") != string::npos)
{
Ack.BuildBody("Acknowledgement", "Connection establihed successfully");
std::cout << "\n\nSending Acknowledgement to Client...";
Sender sndr(Ack);
sndr.start();
}
if (msg != "stop\n")
sout << msg.c_str();
} while (true);
pLt->join();
}
catch (std::exception& exception)
{
sout << "\n\n " << exception.what();
delete pLt;
}
catch (...)
{
delete pLt;
}
}
private:
BlockingQueue<std::string> q_;
ListenThread* pLt;
};
#endif | [
"ganesh_vjy@yahoo.com"
] | ganesh_vjy@yahoo.com |
cd090de03925381ea49d6e9a50447645a3512725 | 6b2a8dd202fdce77c971c412717e305e1caaac51 | /solutions_5631572862566400_0/C++/jamesjaya/c.cpp | 83d693fbd06a1652943e14534c81d6094c340ca3 | [] | no_license | alexandraback/datacollection | 0bc67a9ace00abbc843f4912562f3a064992e0e9 | 076a7bc7693f3abf07bfdbdac838cb4ef65ccfcf | refs/heads/master | 2021-01-24T18:27:24.417992 | 2017-05-23T09:23:38 | 2017-05-23T09:23:38 | 84,313,442 | 2 | 4 | null | null | null | null | UTF-8 | C++ | false | false | 1,821 | cpp | #include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <bitset>
using namespace std;
int a[1000];
vector<int> r[1000];
int n;
int mem[10][(1<<10)];
int f;
int prv;
int m;
bool stop;
bitset<1000> bs;
int cc(int m) {
int a = 0;
for (int i = 0; i < n; i++) {
if (bs[i]) a++;
}
return a;
}
int dp(int l) {
//cout << l+1 << " " << f+1 << " " << a[l]+1 << " " << (m & (1 << a[l])) << endl;
if ((a[l] == f) || (a[l] == prv)) {
if (a[l] == f) stop = true;
if (a[l] == prv) prv = l;
//cout << "dor " << cc(m) << " " << prv+1 << endl;
return cc(m);
}
if (cc(m) == n) return 0;
prv = l;
int ans = 1;
if (!bs[a[l]]) {
bs[a[l]] = 1;
ans = dp(a[l]);
} else {
return 0;
}
mem[l][m] = ans;
return ans;
}
int cc2(int l) {
int ans = 1;
for (int i = 0; i < r[l].size(); i++) {
if (!bs[r[l][i]]) {
bs[r[l][i]] = 1;
ans = max(ans, 1+cc2(r[l][i]));
bs[r[l][i]] = 0;
}
}
return ans;
}
int main() {
int tt;
scanf("%d", &tt);
for (int t = 1; t <= tt; t++) {
scanf("%d", &n);
for (int i = 0; i < n; i++) {
r[i].clear();
}
for (int i = 0; i < n; i++) {
scanf("%d", &a[i]);
a[i]--;
r[a[i]].push_back(i);
}
int ans = 1;
for (int i = 0; i < n; i++) {
bs.reset();
f = i;
bs[i] = 1;
bs[a[i]] = 1;
prv = i;
stop = false;
int tmp = dp(a[i]);
int ans2 = 0;
if (!stop) {
for (int j = 0; j < r[prv].size(); j++) {
if (!bs[r[prv][j]]) {
bs[r[prv][j]] = 1;
ans2 = max(ans2, cc2(r[prv][j]));
bs[r[prv][j]] = 0;
}
}
for (int j = 0; j < r[f].size(); j++) {
if (!bs[r[f][j]]) {
bs[r[f][j]] = 1;
ans2 = max(ans2, cc2(r[f][j]));
bs[r[f][j]] = 0;
}
}
}
//cout << ans2 << endl;
ans = max(ans, tmp+ans2);
}
printf("Case #%d: %d\n", t, ans);
}
} | [
"alexandra1.back@gmail.com"
] | alexandra1.back@gmail.com |
024a030acb2addcef80b9f1d643bd693a962efe0 | ebbf0bf4a3beea9f18778a2e9eb581bcab34901d | /String Processing/Ad Hoc String Processing Problems - Part 2/Just Ad Hoc/Permutations.cpp | 15834eb1100e21520fa068310d7e89c96c63c55d | [
"MIT"
] | permissive | satvik007/uva | 8986d106b13c6c09d2756be346ba8f6cb604d186 | 72a763f7ed46a34abfcf23891300d68581adeb44 | refs/heads/master | 2021-07-19T12:21:03.467773 | 2020-03-27T20:00:20 | 2020-03-27T20:00:20 | 100,093,000 | 4 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,044 | cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll factorial[21];
void computeFactorial() {
factorial[0] = 1;
for(int i = 1; i < 21; ++i)
factorial[i] = factorial[i - 1] * i;
}
string getPermutation(const string& source, ll permutation) {
string result(source);
for(int i = 0; i < source.size(); ++i) {
sort(result.begin() + i, result.end());
if (permutation == 0)
break;
int charPos = i + permutation / factorial[source.size() - i - 1];
swap(result[i], result[charPos]);
permutation = permutation % factorial[source.size() - i - 1];
}
return result;
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
//freopen("in.txt", "r", stdin);
//freopen("out.txt", "w", stdout);
computeFactorial();
int n;
cin >> n;
for(int i = 0; i < n; ++i) {
string source;
ll permutation;
cin >> source >> permutation;
cout << getPermutation(source, permutation) << '\n';
}
} | [
"111601021@smail.iitpkd.ac.in"
] | 111601021@smail.iitpkd.ac.in |
9523e099134a07da9e34fcb437e69492f0c24971 | 5658befa599dca1a17cf62ce0714f921e2aed4b5 | /Vue/Vue_jeu/vue_jeu.cpp | 941e6f46879e81cb212fd8338797491d64a35e54 | [] | no_license | SomathSatou/FullMetalWar | 7b1428cc64c4b338cc62a11ae5e71b507dbf1014 | 31facf386cb850d4b03104656d530e85c5689652 | refs/heads/master | 2020-03-13T06:27:12.751685 | 2018-05-31T10:17:35 | 2018-05-31T10:17:35 | 130,999,052 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,587 | cpp | #include "vue_jeu.h"
int pos_onglet = 150; // Position en Y initiale du premier onglet
Vue_Jeu::Vue_Jeu(int longueur,int largeur,QWidget *parent)
: QWidget(parent), _listeOnglet()
{
pos_onglet = 150;
QVBoxLayout* _layout = new QVBoxLayout(this);
_layout->setMargin(0);
_layout->setSpacing(0);
_infoBarre = new InfoBarre(this);
_tableauDeBord = new TableauDeBord(longueur,largeur,this);
QSurfaceFormat format;
format.setSamples(16);
m = new ModelisationJeu(longueur,largeur,this);
m->setFormat(format);
_layout->addWidget(_infoBarre);
_layout->addWidget(m);
_layout->addWidget(_tableauDeBord);
}
const MiniMap *Vue_Jeu::getMiniMap() const { return _tableauDeBord->getMiniMap(); }
const ModelisationJeu *Vue_Jeu::getModelisation() const { return m; }
const QPushButton *Vue_Jeu::getFinDeTour() const { return _tableauDeBord->getFinDeTour(); }
const InfoBarre *Vue_Jeu::getInfoBarre() const { return _infoBarre; }
const InformationPiece *Vue_Jeu::getInformationPiece() const { return _tableauDeBord->getInformationPiece(); }
const ModelisationUnite *Vue_Jeu::getModelisationUnite() const { return _tableauDeBord->getModelisationUnite(); }
void Vue_Jeu::createOnglet(QString pseudo, int pa, int pa_max,Couleur couleur) {
OngletJoueur* oj = new OngletJoueur(pseudo,couleur,pa,pa_max,this);
_listeOnglet.push_back(oj);
oj->move(QPoint(0,pos_onglet));
oj->show();
pos_onglet += 100;
}
void Vue_Jeu::setPAOnglet(int pa, int pa_max, int num_onglet) {
_listeOnglet[num_onglet]->setPA(pa,pa_max);
}
| [
"tomsaout@wanadoo.fr"
] | tomsaout@wanadoo.fr |
bd6c25f368934e84229733ce2673826bfdee1b46 | 56e80058b4d772958bb3c21d3c94c0dcda29c557 | /src/WndSpeed.h | d071e4a4fb7c83833bd551fe885fd4ebf58d8ac5 | [
"Zlib"
] | permissive | berezhko/gpsrecorder-n900 | c76f46fb7036146dc3a22dcec0ca8a96943f3b79 | f6a18893a9d8e09f1810bff9703cc7ae330b99f0 | refs/heads/master | 2020-12-26T02:39:48.050088 | 2015-01-19T17:37:21 | 2015-01-19T17:37:21 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,954 | h | //***************************************************************************
//
// GPS Recorder
// A GPS data logger for the Maemo platform.
//
// Copyright (C) 2010 Jean-Charles Lefebvre <polyvertex@gmail.com>
//
// This software is provided 'as-is', without any express or implied
// warranty. In no event will the authors be held liable for any damages
// arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it
// freely, subject to the following restrictions :
//
// 1. The origin of this software must not be misrepresented; you must not
// claim that you wrote the original software. If you use this software
// in a product, an acknowledgment in the product documentation would be
// appreciated but is not required.
// 2. Altered source versions must be plainly marked as such, and must not
// be misrepresented as being the original software.
// 3. This notice may not be removed or altered from any source distribution.
//
// Created: 2010-05-22 10:04:19
//
//***************************************************************************
#ifndef __WNDSPEED_H__
#define __WNDSPEED_H__
#include "stable.h"
//---------------------------------------------------------------------------
// WndSpeed
//---------------------------------------------------------------------------
class WndSpeed : public WndBase
{
Q_OBJECT
public :
WndSpeed (QMainWindow* pParent=0);
virtual ~WndSpeed (void);
private :
void createWidgets (void);
private slots :
void onAppStatePixChanged (QPixmap* pNewStatePixmap);
void onLocationFix (Location* pLocation, const LocationFixContainer* pFixCont, bool bAccurate);
private :
time_t m_uiSpeedLastUpdate;
QLabel* m_pLblSpeed;
QLabel* m_pLblSpeedUpdate;
QLabel* m_pLblSpeedUnit;
QLabel* m_pLblStatusIcon;
};
#endif // #ifndef __WNDSPEED_H__
| [
"polyvertex@gmail.com"
] | polyvertex@gmail.com |
c8cf8f8fb33b309d012313fff6c1b3d3e50975df | 7716142f322977cb56bd5078f9a62449841921cb | /components/security_interstitials/core/bad_clock_ui.h | f780d233f2e6af5a89a517b8475b45e133a25cd7 | [
"BSD-3-Clause",
"LicenseRef-scancode-generic-cla"
] | permissive | 3p3r/ChromiumGStreamerBackend | 9f63ac11aff4326003f74cb118b5ac69eda68fb5 | 269b7cabe31f1b438051a464d661ac66404191e9 | refs/heads/master | 2021-05-31T03:20:38.570165 | 2016-04-26T17:00:00 | 2016-04-26T17:00:14 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,672 | h | // Copyright 2015 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 COMPONENTS_SECURITY_INTERSTITIALS_CORE_BAD_CLOCK_UI_H_
#define COMPONENTS_SECURITY_INTERSTITIALS_CORE_BAD_CLOCK_UI_H_
#include "base/macros.h"
#include "base/memory/scoped_ptr.h"
#include "base/time/time.h"
#include "base/values.h"
#include "components/security_interstitials/core/controller_client.h"
#include "components/ssl_errors/error_classification.h"
#include "net/ssl/ssl_info.h"
#include "url/gurl.h"
namespace security_interstitials {
// Provides UI for SSL errors caused by clock misconfigurations.
class BadClockUI {
public:
BadClockUI(const GURL& request_url,
int cert_error, // Should correspond to a NET_ERROR
const net::SSLInfo& ssl_info,
const base::Time& time_triggered, // Time the error was triggered
ssl_errors::ClockState clock_state,
const std::string& languages,
ControllerClient* controller_);
~BadClockUI();
void PopulateStringsForHTML(base::DictionaryValue* load_time_data);
void HandleCommand(SecurityInterstitialCommands command);
private:
void PopulateClockStrings(base::DictionaryValue* load_time_data);
const GURL request_url_;
const int cert_error_;
const net::SSLInfo ssl_info_;
const base::Time time_triggered_;
const std::string languages_;
ControllerClient* controller_;
ssl_errors::ClockState clock_state_;
DISALLOW_COPY_AND_ASSIGN(BadClockUI);
};
} // security_interstitials
#endif // COMPONENTS_SECURITY_INTERSTITIALS_CORE_BAD_CLOCK_UI_H_
| [
"a.obzhirov@samsung.com"
] | a.obzhirov@samsung.com |
24ec8899aeb5a6aeae672f3b6bed3eb64d9560e2 | 6bdffe79068a4299e17991e36ad0115da0e0777e | /Algorithm_C/OfferReview/01_38/29_PrintMatrix/PrintMatrix.hpp | 3dd6b58c05f1aabf42831d48603a51f32c122d53 | [] | no_license | chm994483868/AlgorithmExample | f1f5746a3fe2915d2df6d97f946e2a1e72907bb8 | d44fb7d408abd3a1c7c720670cd827de8e96f2e0 | refs/heads/master | 2023-05-30T17:00:28.902320 | 2021-06-25T22:31:11 | 2021-06-25T22:31:11 | 230,116,960 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 642 | hpp | //
// PrintMatrix.hpp
// OfferReview
//
// Created by CHM on 2020/11/5.
// Copyright © 2020 CHM. All rights reserved.
//
#ifndef PrintMatrix_hpp
#define PrintMatrix_hpp
#include <stdio.h>
#include <cstdio>
namespace PrintMatrix {
// 29:顺时针打印矩阵
// 题目:输入一个矩阵,按照从外向里以顺时针的顺序依次打印出每一个数字。
void PrintMatrixInCircle(int** numbers, int colums, int rows, int start);
void printNumber(int number);
void PrintMatrixClockwisely(int** numbers, int colums, int rows);
// 测试代码
void Test(int colums, int rows);
void Test();
}
#endif /* PrintMatrix_hpp */
| [
"994483868@qq.com"
] | 994483868@qq.com |
1ba7d93017861ac7dfef5b835fe32bfb79cc7cfd | 06425dd6493a684443fbbcdd49b9ce28d4d8cde2 | /STRING4.CPP | 9bb4616614bd4ba91f8bce85ff1c443de5a5e63b | [] | no_license | AbhinavJhanwar/Let-Us-C-projects | 8c181c4dfe4b16c2dd674f8503dffececa117227 | a43443a0c8b6688042ab269d5a750d63bc25c19c | refs/heads/master | 2021-05-08T23:17:05.215753 | 2018-01-31T15:23:14 | 2018-01-31T15:23:14 | 119,703,875 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 204 | cpp | #include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
char name[25];
/*char name[]="HAESLER";*/
printf("Enter your full name");
gets(name);
puts("Hello!");
puts(name);
getch();
} | [
"noreply@github.com"
] | noreply@github.com |
765000193f9b379440088249f0db9b45417f4a23 | ff379b7f81d8c96ff500cdeb461889506644a830 | /tinycl/compiler/ir/tinycl_c_ir_dom.cpp | 4724b287cf6670ac204137197ab441d61b5aed02 | [] | no_license | eval1749/tiny-common-lisp | 500c2bb68d32e308ccdee1041e72275edff5d0c7 | da408784dd9f5e49f7733ad8338d3c8969f41e89 | refs/heads/master | 2020-05-17T08:39:23.795312 | 2012-04-30T11:28:29 | 2012-04-30T11:28:29 | 23,464,880 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 14,938 | cpp | #include "precomp.h"
//////////////////////////////////////////////////////////////////////////////
//
// TinyCl - Compiler - Parse
// tinycl_compiler_parser.cpp
//
// Copyright (C) 2007-2008 by Project Vogue.
// Written by Yoshifumi "VOGUE" INOUE. (yosi@msn.com)
//
// @(#)$Id: //proj/evedit2/mainline/tinycl/compiler/ir/tinycl_c_ir_dom.cpp#2 $
//
#include "../tinycl_c_defs.h"
namespace TinyCl
{
namespace Compiler
{
//////////////////////////////////////////////////////////////////////
//
// DomTreeBuilder class
//
template<class DomCFG, class DomBBlock, class DomInfo>
class DomTreeBuilder
{
private: DomCFG* m_pCfg;
private: DomBBlock* m_pEntry;
private: DomBBlock* m_pDfsPrev;
private: uint m_nDfsName;
public: DomTreeBuilder() {}
// Build
public: void Build(DomCFG* pCFG)
{
ASSERT(NULL != pCFG);
m_pCfg = pCFG;
m_pEntry = pCFG->GetEntry();
m_nDfsName = 0;
m_pDfsPrev = NULL;
init();
CLOG(2, "<li>Build DFS Tree<ol>");
buildDfsTree(m_pEntry);
CLOG(2, "</ol></li>~%");
removeUnrechable();
computeParent();
m_pEntry->SetParent(NULL);
computeChildren();
computeFrontiers();
uninit();
} // Build
// addFrontier
private: void addFrontier(DomBBlock* pFrontier, DomBBlock* pBB)
{
ASSERT(NULL != pFrontier);
ASSERT(NULL != pBB);
if (pBB->GetFrontiers()->Position(pFrontier) < 0)
{
pBB->GetFrontiers()->SetFirst(
new DomInfo::FrontierList::Cons(
pFrontier,
pBB->GetFrontiers()->GetFirst() ) );
}
} // addFrontier
// buildDfsTree
private: void buildDfsTree(DomBBlock* pBB)
{
DomBBlock* pCurr = pBB->Extend<DomBBlock>();
pCurr->SetDfsName(1);
foreach (DomBBlock::EnumOutEdge, oEnum, pCurr)
{
DomBBlock* pSucc = oEnum.GetNode();
if (0 == pSucc->GetDfsName())
{
buildDfsTree(pSucc);
}
} // for each succ
m_nDfsName += 1;
pCurr->SetDfsName(m_nDfsName);
pCurr->SetDfsNext(m_pDfsPrev);
m_pDfsPrev = pCurr;
CLOG(2, "<li>visit ~S dfs=~D</li>", pBB, m_nDfsName);
} // buildDfsTree
// compute-children
// Make children list in reverse postorder.
private: void computeChildren()
{
for (
DomBBlock* pBB = m_pEntry->GetDfsNext();
NULL != pBB;
pBB = pBB->GetDfsNext() )
{
DomBBlock* pParent = pBB->GetParent();
pParent->GetChildren()->Append(pBB->GetDomInfo());
} // for each bblock
} // computeChildren
// computeFrontiers
// Loop over bblock which has more than one predecessors.
private: void computeFrontiers()
{
foreach (DomCFG::EnumBBlock, oEnum, m_pCfg)
{
DomBBlock* pBB = oEnum.Get()->Extend<DomBBlock>();
if (hasMoreThanOnePred(pBB))
{
foreach (DomBBlock::EnumInEdge, oEnum, pBB)
{
DomBBlock* pParent = pBB->GetParent();
for (
DomBBlock* pRunner = oEnum.GetNode();
pRunner != pParent;
pRunner = pRunner->GetParent() )
{
addFrontier(pBB, pRunner);
} // for each ancestor
} // for each pred edge
} // if
} // for each bblock
} // computeFrontiers
// computeParent
// Computes parent (immediate dominator) for each bblock.
private: void computeParent()
{
m_pEntry->SetParent(m_pEntry);
m_pEntry->SetDepth(1);
bool fChanged = true;
while (fChanged)
{
fChanged = false;
for (
DomBBlock* pBB = m_pEntry->GetDfsNext();
NULL != pBB;
pBB = pBB->GetDfsNext() )
{
if (computeParentAux(pBB))
{
fChanged = true;
}
} // for each bblock
} // while
} // computeParent
// computeParentAux
// Computes new parent by processed predecessor.
private: bool computeParentAux(DomBBlock* pCurr)
{
ASSERT(NULL != pCurr);
foreach (DomBBlock::EnumInEdge, oEnum, pCurr)
{
DomBBlock* pParent = oEnum.GetNode();
if (NULL == pParent->GetParent()) continue;
foreach (DomBBlock::EnumInEdge, oEnum, pCurr)
{
DomBBlock* pPred = oEnum.GetNode();
if (pParent != pPred && NULL != pPred->GetParent())
{
pParent = intersect(pPred, pParent);
}
} // for each pred
if (pCurr->GetParent() != pParent)
{
pCurr->SetParent(pParent);
pCurr->SetDepth(pParent->GetDepth() + 1);
return true;
}
} // for each parent
return false;
} // computeParentAux
// hasMoreThanOnePred
private: static bool hasMoreThanOnePred(DomBBlock* pBBlock)
{
DomBBlock::EnumInEdge oEnum(pBBlock);
if (oEnum.AtEnd()) return false;
oEnum.Next();
return ! oEnum.AtEnd();
} // hasMoreThanOnePred
// init
// Allocates dominfo for all bblocks
private: void init()
{
foreach (DomCFG::EnumBBlock, oEnum, m_pCfg)
{
DomBBlock* pBB = oEnum.Get()->Extend<DomBBlock>();
pBB->SetDfsName(0);
pBB->SetDfsNext(NULL);
DomInfo* pDomInfo = pBB->GetDomInfo();
if (NULL != pDomInfo)
{
pDomInfo->Reset();
}
else
{
pDomInfo = new DomInfo(pBB);
pBB->SetDomInfo(pDomInfo);
}
} // for each bblock
} // init
// intersect
private: DomBBlock* intersect(DomBBlock* pFinger1, DomBBlock* pFinger2)
{
ASSERT(NULL != pFinger1);
ASSERT(NULL != pFinger2);
while (pFinger1 != pFinger2)
{
while (pFinger1->GetDfsName() < pFinger2->GetDfsName())
{
pFinger1 = pFinger1->GetParent();
} // while
while (pFinger2->GetDfsName() < pFinger1->GetDfsName())
{
pFinger2 = pFinger2->GetParent();
} // while
} // while
return pFinger1;
} // intersect
// remove unreachable bblocks
private: void removeUnrechable()
{
DomCFG::EnumBBlock oEnum(m_pCfg);
while (! oEnum.AtEnd())
{
BBlock* pBB = oEnum.Get();
oEnum.Next();
if (0 == pBB->Extend<DomBBlock>()->GetDfsName())
{
pBB->GetFunction()->RemoveBBlock(pBB);
}
} // for each bblock
} // removeUnrechable
// uninit
private: void uninit()
{
foreach (DomCFG::EnumBBlock, oEnum, m_pCfg)
{
BBlock* pBB = oEnum.Get();
pBB->Reset();
} // for each bblock
} // uninit
}; // DomTreeBuilder
template<class DomCFG, class DomBBlock, class DomInfo = BBlock::DomInfo>
class DomTreeDumper
{
public: static void Run(DomCFG* pFun, const char* psz)
{
CLOG(3, "<h3>~ADominance Tree of ~S</h3>~%",
psz,
pFun );
CLOG(3, "<table border='1'>~%");
CLOG(3, "<thead><tr>~%");
CLOG(3, "<th>Depth</th>");
CLOG(3, "<th>BBlock</th>");
CLOG(3, "<th>Parent</th>");
CLOG(3, "<th>Children</th>");
CLOG(3, "<th>Frontiers</th>");
CLOG(3, "</tr></thead>~%");
foreach (Function::EnumBBlock, oEnum, pFun)
{
DomBBlock* pBBlock = oEnum.Get()->Extend<DomBBlock>();
CLOG(3, "<tr><td>~S</td>", pBBlock);
BBlock::DomInfo* pDomInfo = pBBlock->GetDomInfo();
CLOG(3, "<td>~D</td>~%", pDomInfo->GetDepth());
if (NULL == pDomInfo->GetParent())
{
CLOG(3, "<td>-</td>~%");
}
else
{
CLOG(3, "<td>~S</td>~%",
pDomInfo->GetParent() );
} // if
// Children
{
CLOG(3, "<td>{");
const char* psz = "";
foreach (BBlock::DomInfo::EnumChild, oEnum, pDomInfo)
{
BBlock* pChild = oEnum.Get();
CLOG(3, psz);
psz = " ";
CLOG(3, "~S", pChild);
} // for each child
CLOG(3, "}</td>~%");
} // children
// Frontiers
{
CLOG(3, "<td>{");
const char* psz = "";
foreach (BBlock::DomInfo::EnumFrontier, oEnum, pDomInfo)
{
BBlock* pFrontier = oEnum.Get();
CLOG(3, psz);
psz = " ";
CLOG(3, "~S", pFrontier);
} // for each Frontier
CLOG(3, "}</td>~%");
} // frontiers
CLOG(3, "</tr>~%");
} // for each bblock
CLOG(3, "</table>~%");
} // Run
}; // DomTreeDumper
//////////////////////////////////////////////////////////////////////
//
// DomBBlock_
//
template<class Base_, class EnumInEdge_, class EnumOutEdge_>
class DomBBlock_ : public Base_
{
private: typedef BBlock::DomInfo DomInfo;
private: typedef DomBBlock_<Base_, EnumInEdge_, EnumOutEdge_> BBlock_;
public: uint GetDfsName() const
{ return static_cast<uint>(GetIndex()); }
public: BBlock_* GetDfsNext() const
{ return GetWork<BBlock_>(); }
public: void SetDfsName(uint nName)
{ SetIndex(nName); }
public: void SetDfsNext(BBlock_* pNext)
{ SetWork(pNext); }
public: class EnumInEdge : public EnumInEdge_
{
public: EnumInEdge(BBlock* pBB) : EnumInEdge_(pBB) {}
public: BBlock_* GetNode() const
{ return EnumInEdge_::GetNode()->Extend<BBlock_>(); }
}; // EnumInEdge
public: class EnumOutEdge : public EnumOutEdge_
{
public: EnumOutEdge(BBlock* pBB) :
EnumOutEdge_(pBB) {}
public: BBlock_* GetNode() const
{ return EnumOutEdge_::GetNode()->Extend<BBlock_>(); }
}; // EnumOutEdge
////////////////////////////////////////////////////////////
//
// DomInfo accessors shortcut
//
public: DomInfo::ChildList* GetChildren() const
{ return GetDomInfo()->GetChildren(); }
public: uint GetDepth() const { return GetDomInfo()->GetDepth(); }
public: uint SetDepth(uint n) { return GetDomInfo()->SetDepth(n); }
public: DomInfo::FrontierList* GetFrontiers() const
{ return GetDomInfo()->GetFrontiers(); }
public: BBlock_* GetParent() const
{ return GetDomInfo()->GetParent()->Extend<BBlock_>(); }
public: void SetParent(BBlock_* pBB)
{ GetDomInfo()->SetParent(pBB); }
DISALLOW_COPY_AND_ASSIGN(DomBBlock_);
}; // DomBBlock_
//////////////////////////////////////////////////////////////////////
//
// DomBBlock
//
class DomBBlockBase : public BBlock
{
private: DomBBlockBase() {}
public: DomInfo* GetDomInfo() const
{ return m_pDomInfo; }
public: void SetDomInfo(DomInfo* pDomInfo)
{ m_pDomInfo = pDomInfo; }
}; // DomBBlockBase
//////////////////////////////////////////////////////////////////////
//
// PostDomBBlock
//
class PostDomBBlockBase : public BBlock
{
private: PostDomBBlockBase() {}
public: DomInfo* GetDomInfo() const
{ return m_pPostDomInfo; }
public: void SetDomInfo(DomInfo* pDomInfo)
{ m_pPostDomInfo = pDomInfo; }
}; // PostDomBBlockBase
typedef DomBBlock_<
DomBBlockBase,
BBlock::EnumInEdge,
BBlock::EnumOutEdge >
DomBBlock;
typedef DomBBlock_<
PostDomBBlockBase,
BBlock::EnumOutEdge,
BBlock::EnumInEdge >
PostDomBBlock;
//////////////////////////////////////////////////////////////////////
//
// DomCFG
//
class DomCFG : public Function
{
private: DomCFG() {}
public: DomBBlock* GetEntry() const
{ return GetEntryBB()->Extend<DomBBlock>(); }
}; // DomCFG
//////////////////////////////////////////////////////////////////////
//
// PostDomCFG
//
class PostDomCFG : public Function
{
private: PostDomCFG() {}
public: PostDomBBlock* GetEntry() const
{ return GetExitBB()->Extend<PostDomBBlock>(); }
}; // PostDomCFG
/// <summary>
/// Computes dominance.
/// </summary>
/// <returns>
/// Returns false if dominance tree has been computed.
/// </returns>
bool Function::ComputeDominance()
{
CLOG(1, "<h2>Compute Dominance ~S</h2><ol>", this);
if (Has(Cache_Dom))
{
CLOG(1, "<li>Use cached dominance.</li>");
CLOG(1, "</ol>~%");
return false;
}
DomTreeBuilder<DomCFG, DomBBlock, BBlock::DomInfo> oBuilder;
oBuilder.Build(Extend<DomCFG>());
m_rgfCache |= Cache_Dom;
#if _DEBUG
DomTreeDumper<DomCFG, DomBBlock, BBlock::DomInfo>::Run(
Extend<DomCFG>(), "" );
#endif
CLOG(1, "</ol>~%");
return true;
} // Function::ComputeDominance
/// <summary>
/// Computes post-dominance.
/// </summary>
/// <returns>
/// Returns false if dominance tree has been computed.
/// </returns>
bool Function::ComputePostDominance()
{
CLOG(1, "<h2>Compute Post Dominance ~S</h2><ol>", this);
if (Has(Cache_PostDom))
{
CLOG(1, "<li>Use cached dominance.</li>");
CLOG(1, "</ol>~%");
return false;
}
EliminateInfiniteLoop();
DomTreeBuilder<PostDomCFG, PostDomBBlock, BBlock::DomInfo> oBuilder;
oBuilder.Build(Extend<PostDomCFG>());
m_rgfCache |= Cache_PostDom;
#if _DEBUG
DomTreeDumper<PostDomCFG, PostDomBBlock, BBlock::DomInfo>::Run(
Extend<PostDomCFG>(), "Post-" );
#endif
CLOG(1, "</ol>~%");
return true;
} // Function::ComputePostDominance
} // Compiler
} // TinyCl
| [
"eval1749@gmail.com"
] | eval1749@gmail.com |
9a11fdb19469d412b8d52a13511e372b6801ca82 | 447ce292f6a8c153f2f3f20e45d20b75d4575443 | /aula01/exercicios/atividade07.cc | b65920fa2de443b27edaedefbabe4c5699b92162 | [] | no_license | Fatec-Taquaritinga-Noite/Algoritmos-e-logica-de-programacao | e324b9adddb1b4b76a2548ab2c6bc994036c6408 | 0b4127802d3623af5bb6552a277534cfd16664b0 | refs/heads/main | 2023-03-28T11:04:44.017733 | 2021-03-09T03:19:45 | 2021-03-09T03:19:45 | 344,661,581 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 297 | cc | #include <stdio.h>
int main()
{
float salario, novoSalario;
printf("Digite seu salario:");
scanf("%f%*c", &salario);
printf("Salario:%4.2f\n", salario);
novoSalario = (salario - (salario * 10 / 100)) + 50;
printf("Seu novo salario: %4.2f", novoSalario);
getchar();
return 0;
} | [
"ads.fatecnoitetaquaritinga@gmail.com"
] | ads.fatecnoitetaquaritinga@gmail.com |
9cd684095926e4f6023f9022a87896158914d5e8 | 84a07c6f5bbcdc7a23920aa2c265faa602af48a2 | /classes/class_practise.c++ | 653a16937f9f2058c1002b08bf066cbe7e0387f7 | [] | no_license | uttamraja/c-from-Scratch | 8bc68daea0779d45d195005194935b614fa6ce23 | 79e4d7e0b68736dbbd3ed9b3c3ca73e0d70b9b19 | refs/heads/master | 2023-07-12T03:54:25.383589 | 2021-08-12T14:26:15 | 2021-08-12T14:26:15 | 384,948,611 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 407 | #include <iostream>
using namespace std;
int summ(int a, int b){
int c= a+b;
return c;
}
class calc
{
int input, a, b;
public:
void sum(){
cout<<"Enter first value.\n"<<endl;
cin>>a;
cout<<"Enter Second value.\n"<<endl;
cin>>b;
cout<<"sum of entered value is: "<<summ(a,b)<<endl;
}
};
int main()
{
calc uttam;
uttam.sum();
return 0;
} | [
"uttamraja41@gmail.com"
] | uttamraja41@gmail.com | |
d67126b450eb0494d4bad7a06e1abe38c82f2eb9 | 9cc0d21c83d812d0e8a70add62d329e1e423b12e | /ash/public/cpp/ash_features.h | 4db82aedf9b074bc2a30d1a34dec007337ef8433 | [
"BSD-3-Clause"
] | permissive | therayvoice/chromium | a9ea3395411db25b154ce1afdec3e978b5556aba | 8bf2b66f7fe303ccd0596007c844cff165c903bc | refs/heads/master | 2023-07-19T08:54:56.351708 | 2018-10-25T20:52:54 | 2018-10-25T20:52:54 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,268 | h | // Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef ASH_PUBLIC_CPP_ASH_FEATURES_H_
#define ASH_PUBLIC_CPP_ASH_FEATURES_H_
#include "ash/public/cpp/ash_public_export.h"
#include "base/feature_list.h"
namespace ash {
namespace features {
// Enables the docked (a.k.a. picture-in-picture) magnifier.
// TODO(afakhry): Remove this after the feature is fully launched.
// https://crbug.com/709824.
ASH_PUBLIC_EXPORT extern const base::Feature kDockedMagnifier;
// Enables dragging an app window when it is in tablet mode.
// TODO(minch): Remove this after the feature is launched.
// https://crbug.com/847587.
ASH_PUBLIC_EXPORT extern const base::Feature kDragAppsInTabletMode;
// Enables dragging one or more tabs out of a browser window in tablet mode.
// TODO(xdai): Remove this after the feature is launched.
// https://crbug.com/823769.
ASH_PUBLIC_EXPORT extern const base::Feature kDragTabsInTabletMode;
// Enables the keyboard shortcut viewer.
// TODO(wutao): Remove this after the feature is fully launched.
// https://crbug.com/755448.
ASH_PUBLIC_EXPORT extern const base::Feature kKeyboardShortcutViewer;
// Enables the keyboard shortcut viewer mojo app.
// TODO(msw): Remove this after the feature is fully launched.
// https://crbug.com/841020.
ASH_PUBLIC_EXPORT extern const base::Feature kKeyboardShortcutViewerApp;
// Enables notifications on the lock screen.
ASH_PUBLIC_EXPORT extern const base::Feature kLockScreenNotifications;
// Enables inline reply on notifications on the lock screen.
// This option is effective when |kLockScreenNotification| is enabled.
ASH_PUBLIC_EXPORT extern const base::Feature kLockScreenInlineReply;
// Supports the feature to hide sensitive content in notifications on the lock
// screen. This option is effective when |kLockScreenNotification| is enabled.
ASH_PUBLIC_EXPORT extern const base::Feature
kLockScreenHideSensitiveNotificationsSupport;
// Enables media session service integration. If this is enabled, accelerators
// that are associated with media playback will be handled by the media
// session service.
// TODO(beccahughes): Remove after launch. (https://crbug.com/894255)
ASH_PUBLIC_EXPORT extern const base::Feature kMediaSessionAccelerators;
// Enables the media session notification. If this is enabled, we will show
// a notification that shows the currently playing media with controls.
// TODO(beccahughes): Remove after launch. (https://crbug.com/897836)
ASH_PUBLIC_EXPORT extern const base::Feature kMediaSessionNotification;
// Enables the Night Light feature.
ASH_PUBLIC_EXPORT extern const base::Feature kNightLight;
// Enables notification scroll bar in UnifiedSystemTray.
ASH_PUBLIC_EXPORT extern const base::Feature kNotificationScrollBar;
// Enables swipe to close in overview mode.
// TODO(sammiequon): Remove this after the feature is fully launched.
// https://crbug.com/828646.
ASH_PUBLIC_EXPORT extern const base::Feature kOverviewSwipeToClose;
// Enables trilinear filtering.
ASH_PUBLIC_EXPORT extern const base::Feature kTrilinearFiltering;
// Enables running an external binary which provides lock screen authentication.
ASH_PUBLIC_EXPORT extern const base::Feature kUnlockWithExternalBinary;
// Enables views login.
ASH_PUBLIC_EXPORT extern const base::Feature kViewsLogin;
// Enables using the BluetoothSystem Mojo interface for Bluetooth operations.
ASH_PUBLIC_EXPORT extern const base::Feature kUseBluetoothSystemInAsh;
ASH_PUBLIC_EXPORT bool IsDockedMagnifierEnabled();
ASH_PUBLIC_EXPORT bool IsKeyboardShortcutViewerEnabled();
ASH_PUBLIC_EXPORT bool IsKeyboardShortcutViewerAppEnabled();
ASH_PUBLIC_EXPORT bool IsLockScreenNotificationsEnabled();
ASH_PUBLIC_EXPORT bool IsLockScreenInlineReplyEnabled();
ASH_PUBLIC_EXPORT bool IsLockScreenHideSensitiveNotificationsSupported();
ASH_PUBLIC_EXPORT bool IsNightLightEnabled();
ASH_PUBLIC_EXPORT bool IsNotificationScrollBarEnabled();
ASH_PUBLIC_EXPORT bool IsSystemTrayUnifiedEnabled();
ASH_PUBLIC_EXPORT bool IsTrilinearFilteringEnabled();
ASH_PUBLIC_EXPORT bool IsViewsLoginEnabled();
} // namespace features
} // namespace ash
#endif // ASH_PUBLIC_CPP_ASH_FEATURES_H_
| [
"commit-bot@chromium.org"
] | commit-bot@chromium.org |
4a26a159c4460b55912925921a751e383b6422fd | ded10c52a4602174205b3ad5609319c7691fd9bf | /ex.cpp | 0d3426c63281af0e28ec918646c98be214f510a1 | [] | no_license | Khachuy911/c-language | 6faf4eda6b3ff7be6a64185be7473dd9e695f437 | ede335608e2a4f5eeb0ec260a0852cb75a5f29d6 | refs/heads/master | 2023-08-14T21:23:05.507297 | 2021-09-17T10:17:44 | 2021-09-17T10:17:44 | 407,494,110 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 161 | cpp | #include<stdio.h>
int main(){
int a = 100;
int b = 50;
int *prt ;
prt = &a;
printf("value= %d\n",*prt);
prt = &b;
printf("value= %d",*prt);
return 0 ;
}
| [
"khachuy469@gmail.com"
] | khachuy469@gmail.com |
885324ccd249b6009558b45c78090792c9645d1e | ee31cbd266671dcae68d43e47ce6585e3a9cf774 | /tests/calcsize_test.cpp | 951de2eab855bf3a102b114648e12fe10419a8f4 | [
"CC0-1.0"
] | permissive | artisdom/cppystruct | a80bacef12b4d9ca847c56e9b7ea7fc6859a3166 | cceba08f717d919834bec0c3eefd8cb7b11a0aa9 | refs/heads/master | 2020-03-12T01:59:03.400262 | 2018-04-20T16:04:54 | 2018-04-20T16:04:54 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,479 | cpp | #include <cppystruct.h>
#include <catch.hpp>
#define REQUIRE_STATIC(x) REQUIRE(x); \
static_assert(x, #x);
TEST_CASE("no count, native byte order (with padding)", "[cppystruct::calcsize]")
{
REQUIRE_STATIC(pystruct::calcsize(PY_STRING("c")) == 1);
REQUIRE_STATIC(pystruct::calcsize(PY_STRING("cc")) == 2);
REQUIRE_STATIC(pystruct::calcsize(PY_STRING("cch")) == 4);
REQUIRE_STATIC(pystruct::calcsize(PY_STRING("cchh")) == 6);
REQUIRE_STATIC(pystruct::calcsize(PY_STRING("cchH")) == 6);
REQUIRE_STATIC(pystruct::calcsize(PY_STRING("cchHi")) == 12);
}
TEST_CASE("count", "[cppystruct::calcsize]")
{
REQUIRE_STATIC(pystruct::calcsize(PY_STRING("4c")) == 4);
REQUIRE_STATIC(pystruct::calcsize(PY_STRING("40c")) == 40);
REQUIRE_STATIC(pystruct::calcsize(PY_STRING("c4c")) == 5);
REQUIRE_STATIC(pystruct::calcsize(PY_STRING("2i4c3h")) == 18);
}
TEST_CASE("byte order", "[cppystruct::calcsize]")
{
REQUIRE_STATIC(pystruct::calcsize(PY_STRING("!ci")) == 5);
REQUIRE_STATIC(pystruct::calcsize(PY_STRING(">ci")) == 5);
REQUIRE_STATIC(pystruct::calcsize(PY_STRING("<ci")) == 5);
REQUIRE_STATIC(pystruct::calcsize(PY_STRING("=ci")) == 5);
REQUIRE_STATIC(pystruct::calcsize(PY_STRING("@ci")) == 8);
REQUIRE_STATIC(pystruct::calcsize(PY_STRING("ci")) == 8);
// Padding sanity
REQUIRE_STATIC(pystruct::calcsize(PY_STRING("ic")) == 5);
}
TEST_CASE("count with padding", "[cppystruct::calcsize]")
{
REQUIRE_STATIC(pystruct::calcsize(PY_STRING("c4ci")) == 12);
}
| [
"ykarkason@gmail.com"
] | ykarkason@gmail.com |
ebfcd290d15f2c1ec323d190d845b5bc4ba233a9 | 9178d1087bdbc9af785cddbd34a301f841ccb8e5 | /10050 - Hartals.cpp | 2f5df9bdcca208a6aa449292285ce1c8269b5cc1 | [] | no_license | vipin2909/Online-Judge-Solutions | 9b10c7a0c58612f8f3267e81437d34930795ade3 | 54099a3ffc9ecd6af9d9f3bd5e5d8bbfb3b26e84 | refs/heads/main | 2023-04-18T08:14:01.926915 | 2021-04-29T06:03:43 | 2021-04-29T06:03:43 | 362,707,299 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 555 | cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int t;
cin >> t;
while(t--)
{
int n;
cin >> n;
int p;
cin >> p;
vector<int> v(p);
for(int i = 0; i < p; i++)
{
cin >> v[i];
}
int cnt = 0;
for(int i = 0; i <= n; i++)
{
if(i%7 == 6 || i%7 == 0)
continue;
bool found = false;
for(int j = 0; j < p; j++)
{
if(i % v[j] == 0)
found = true;
}
if(found) ++cnt;
}
cout << cnt << '\n';
}
return 0;
}
| [
"noreply@github.com"
] | noreply@github.com |
145705d18366f221c124c4545a7cdf2b4648bf7c | d91c8c964bfacc42c2f2fcd072370307c88b067f | /data structures/Dynamic_Connectivity.cpp | 8721abf699605ca7b90c5019bb5becd4c46eba9d | [] | no_license | wazedrifat/Algorithm | 6a79dda343a5c0395716645f62be30f739662de6 | b04b30449b141262d3707890395db845a7ecda31 | refs/heads/master | 2022-12-23T02:43:28.944021 | 2022-12-18T12:01:45 | 2022-12-18T12:01:45 | 150,965,798 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,787 | cpp | #include <bits/stdc++.h>
using namespace std;
#define IN freopen("in.txt", "r", stdin);
#define OUT freopen("out.txt", "w", stdout);
#define ll long long int
#define PII pair <int, int>
#define MX 100001
// complexity : O(T(n)logn)
struct dsu_save {
int v, rnkv, u, rnku;
dsu_save() {
}
dsu_save(int _v, int _rnkv, int _u, int _rnku) {
v = _v; rnkv = _rnkv; u = _u; rnku = _rnku;
}
};
struct dsu_with_rollbacks {
vector<int> p, rnk;
int comps;
stack<dsu_save> op;
dsu_with_rollbacks() {
}
dsu_with_rollbacks(int n) {
p.resize(n);
rnk.resize(n);
for (int i = 0; i < n; i++) {
p[i] = i;
rnk[i] = 0;
}
comps = n;
}
int find_set(int v) {
return (v == p[v]) ? v : find_set(p[v]);
}
bool unite(int v, int u) {
v = find_set(v);
u = find_set(u);
if (v == u)
return false;
comps--;
if (rnk[v] > rnk[u])
swap(v, u);
op.push(dsu_save(v, rnk[v], u, rnk[u]));
p[v] = u;
if (rnk[u] == rnk[v])
rnk[u]++;
return true;
}
void rollback() {
if (op.empty())
return;
dsu_save x = op.top();
op.pop();
comps++;
p[x.v] = x.v;
rnk[x.v] = x.rnkv;
p[x.u] = x.u;
rnk[x.u] = x.rnku;
}
};
struct query {
int v, u;
bool united;
query(int _v, int _u) {
v = _v; u = _u;
}
};
struct QueryTree {
vector<vector<query>> t;
dsu_with_rollbacks dsu;
int T;
QueryTree() {
}
QueryTree(int _T, int n) {
T = _T;
dsu = dsu_with_rollbacks(n);
t.resize(4 * T + 4);
}
void add_to_tree(int v, int l, int r, int ul, int ur, query& q) {
if (ul > ur)
return;
if (l == ul && r == ur) {
t[v].push_back(q);
return;
}
int mid = (l + r) / 2;
add_to_tree(2 * v, l, mid, ul, min(ur, mid), q);
add_to_tree(2 * v + 1, mid + 1, r, max(ul, mid + 1), ur, q);
}
void add_query(query q, int l, int r) {
add_to_tree(1, 0, T - 1, l, r, q);
}
void dfs(int v, int l, int r, vector<int>& ans) {
for (query& q : t[v]) {
q.united = dsu.unite(q.v, q.u);
}
if (l == r)
ans[l] = dsu.comps;
else {
int mid = (l + r) / 2;
dfs(2 * v, l, mid, ans);
dfs(2 * v + 1, mid + 1, r, ans);
}
for (query q : t[v]) {
if (q.united)
dsu.rollback();
}
}
vector<int> solve() {
vector<int> ans(T);
dfs(1, 0, T - 1, ans);
return ans;
}
};
int main()
{
} | [
"34921453+wazedrifat@users.noreply.github.com"
] | 34921453+wazedrifat@users.noreply.github.com |
2440fbec9654d5b8b886d0cb22006357cf0c39f6 | 73023c191f3afc1f13b39dffea22b7f65a664f7d | /MatrixEngine/Classes/MCocosDenshion/MatrixCocosDenshion.h | 3f77c51acf625fb3284a46b25f1ff569d1e43810 | [] | no_license | ugsgame/Matrix | 0a2c2abb3be9966c3cf7a4164799ed107c8f2920 | 1311b77bd9a917ec770e428efb9530ee6038617a | refs/heads/master | 2020-09-05T15:45:45.973221 | 2019-11-07T07:20:38 | 2019-11-07T07:20:38 | 220,145,853 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 282 | h |
#ifndef __MCOCOSDENSHION_SCRIPT__
#define __MCOCOSDENSHION_SCRIPT__
class MatrixCocosDenshion
{
public:
MatrixCocosDenshion(){};
~MatrixCocosDenshion(){};
static MatrixCocosDenshion* ShareMatrixCocosDenshion(void);
void RegisterScript(void);
protected:
private:
};
#endif | [
"670563380@qq.com"
] | 670563380@qq.com |
c818891bfc1f2afaf3ffd851f38fffd955b6f7d3 | 72362befe5e2c3e694eb76b25cbfefb4d410e16c | /include/europtus/bits/rt_clock.tcc | bce445eeee6d2b12f7eb4aeeb11b918a05eb418b | [] | no_license | fredpy/europtus | f5fc2142bce50c44aa4d3a42816a20834dd8f76f | 81f54755b73058f6bc21138c956e852ea22727df | refs/heads/master | 2020-05-19T08:00:24.066926 | 2015-07-13T17:47:01 | 2015-07-13T17:47:01 | 36,952,673 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,519 | tcc | /*********************************************************************
* Software License Agreement (BSD License)
*
* Copyright (c) 2015, Frederic Py
* 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 TREX Project 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.
*/
#ifdef H_europtus_rt_clock
# ifndef T_europtus_bits_rt_clock
# define T_europtus_bits_rt_clock
namespace europtus {
/*
* class europtus::rt_clock<>
*/
template<class P, class C>
typename rt_clock<P,C>::duration_type rt_clock<P,C>::tick_duration() const {
return boost::chrono::duration_cast<duration_type>(m_period);
}
template<class P, class C>
typename rt_clock<P,C>::tick_type
rt_clock<P,C>::to_tick_impl(typename rt_clock<P,C>::date_type const &date) const {
return m_cvt.to_chrono(date).count()/m_period.count();
}
template<class P, class C>
typename rt_clock<P,C>::date_type
rt_clock<P,C>::to_date_impl(typename rt_clock<P,C>::tick_type const &tick) const {
tick_type max_tick = m_cvt.chrono_max().count(),
val=max_tick/m_period.count();
// ensure that the date is within base_clock boundaries
if( val>tick )
val = tick;
clock_rate p_date(val*m_period.count());
return m_cvt.to_posix(p_date);
}
template<class P, class C>
typename rt_clock<P,C>::date_type rt_clock<P,C>::do_start() {
m_clock.reset();
date_type n = rt_now();
m_cvt.epoch(n);
restrict_final(m_cvt.chrono_max().count()/m_period.count());
return n;
}
template<class P, class C>
void rt_clock<P,C>::do_sleep(boost::system::error_code &ec) const {
typename base_clock::time_point target = m_tick+m_period;
typedef boost::chrono::nanoseconds ns;
ns remain = boost::chrono::duration_cast<ns>(m_clock.left(target));
sleep(remain, ec);
}
template<class P, class C>
typename rt_clock<P,C>::tick_type rt_clock<P,C>::get_tick() {
m_clock.to_next(m_tick, m_period);
return m_tick.time_since_epoch().count()/m_period.count();
}
} // europtus
# endif // T_europtus_bits_rt_clock
#endif // H_europtus_rt_clock | [
"fredpy@gmail.com"
] | fredpy@gmail.com |
45ab64a3d68edf8f23c066ddfc3f3ec2fb6ae5bc | 845e3e104ec4af1476f082f070e5aee7e55f53ee | /Dynamic-Programming/CapSo.cpp | e31efe7604f342f8962cd416dbc9ff6eea327a3d | [] | no_license | hoangnv2810/Algorithm | 96000ede09269adb0ac8d8fa598b158997fd4286 | cdc5c7708e63f12ed01a84b3de4fec7585b5070a | refs/heads/main | 2023-08-23T08:44:07.510186 | 2021-09-28T13:19:35 | 2021-09-28T13:19:35 | 411,252,789 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 617 | cpp | #include<bits/stdc++.h>
using namespace std;
struct Pair{
int x, y;
};
int cmp(Pair a, Pair b){
return a.x < b.x;
}
int main(){
int t;
cin >> t;
while(t--){
int n;
cin >> n;
Pair a[n+1];
int dp[n+1];
for(int i = 1; i <= n; i++){
cin >> a[i].x >> a[i].y;
dp[i] = 1;
}
sort(a+1, a+1+n, cmp);
for(int i = 1; i <= n; i++){
for(int j = 1; j < i; j++){
if(a[j].y < a[i].x)
dp[i] = max(dp[i], dp[j]+1);
}
}
cout << dp[n] << endl;
}
} | [
"hoangnv2810@gmail.com"
] | hoangnv2810@gmail.com |
0ba046f49240259d0addd368fed3e8eccde2b910 | 814fd0bea5bc063a4e34ebdd0a5597c9ff67532b | /components/invalidation/ack_handle.cc | ee0e8b6450c98c1394a983a8e3ad2a44018b21e8 | [
"BSD-3-Clause"
] | permissive | rzr/chromium-crosswalk | 1b22208ff556d69c009ad292bc17dca3fe15c493 | d391344809adf7b4f39764ac0e15c378169b805f | refs/heads/master | 2021-01-21T09:11:07.316526 | 2015-02-16T11:52:21 | 2015-02-16T11:52:21 | 38,887,985 | 0 | 0 | NOASSERTION | 2019-08-07T21:59:20 | 2015-07-10T15:35:50 | C++ | UTF-8 | C++ | false | false | 1,967 | cc | // 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.
#include "components/invalidation/ack_handle.h"
#include <cstddef>
#include "base/rand_util.h"
#include "base/strings/string_number_conversions.h"
#include "base/values.h"
namespace syncer {
namespace {
// Hopefully enough bytes for uniqueness.
const size_t kBytesInHandle = 16;
} // namespace
AckHandle AckHandle::CreateUnique() {
// This isn't a valid UUID, so we don't attempt to format it like one.
uint8 random_bytes[kBytesInHandle];
base::RandBytes(random_bytes, sizeof(random_bytes));
return AckHandle(base::HexEncode(random_bytes, sizeof(random_bytes)),
base::Time::Now());
}
AckHandle AckHandle::InvalidAckHandle() {
return AckHandle(std::string(), base::Time());
}
bool AckHandle::Equals(const AckHandle& other) const {
return state_ == other.state_ && timestamp_ == other.timestamp_;
}
scoped_ptr<base::DictionaryValue> AckHandle::ToValue() const {
scoped_ptr<base::DictionaryValue> value(new base::DictionaryValue());
value->SetString("state", state_);
value->SetString("timestamp",
base::Int64ToString(timestamp_.ToInternalValue()));
return value.Pass();
}
bool AckHandle::ResetFromValue(const base::DictionaryValue& value) {
if (!value.GetString("state", &state_))
return false;
std::string timestamp_as_string;
if (!value.GetString("timestamp", ×tamp_as_string))
return false;
int64 timestamp_value;
if (!base::StringToInt64(timestamp_as_string, ×tamp_value))
return false;
timestamp_ = base::Time::FromInternalValue(timestamp_value);
return true;
}
bool AckHandle::IsValid() const {
return !state_.empty();
}
AckHandle::AckHandle(const std::string& state, base::Time timestamp)
: state_(state), timestamp_(timestamp) {
}
AckHandle::~AckHandle() {
}
} // namespace syncer
| [
"rlarocque@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98"
] | rlarocque@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98 |
629f8e16d772cff156867ad1e57b83f22c07ede8 | 9fd8373a55ebc20a55f647fd31d1c8cda49a3d0e | /lab29/src/main.cpp | 70f601e038eabfc2b9d50b9e4cabd692377204e2 | [] | no_license | Wer3t/Yaylo-Danil_CIT120-V | 8e00fc9fb9d41963ea45d1d7d14442d98ae2323e | 72545c57e8f45e5dd03c6f38dba86ce5dd6072ff | refs/heads/master | 2023-04-19T20:13:34.670407 | 2021-05-15T13:55:04 | 2021-05-15T13:55:04 | 319,751,827 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,333 | cpp | #include "Array.h"
#include "Class.h"
#include "Class1.h"
int main(){
srand(time(0));
/* cout<<"----------------------------------------Работа с простыми числами типа int----------------------------------------"<<endl;
Array<int> in;
for(int i=0;i<10;i++)
in.AddEl(rand()%10);
cout<<"Массив заполнен"<<endl;
in.PrintArray();
cout<<"\nУдаление 1 элемента"<<endl;
in.DeleteEl(1);
in.PrintArray();
cout<<"\nМинимальный элемент в массиве: "<<in.FindMin()<<endl;
cout<<"\nПоиск элемента `3`"<<endl;
in.Finder(3);
cout<<"\nСортировка массива"<<endl;
in.SortArray();
in.PrintArray();
cout<<"----------------------------------------Работа с простыми числами типа double----------------------------------------"<<endl;
Array<double> db;
for(int i=0;i<10;i++)
db.AddEl(rand()%10+0.1);
cout<<"Массив заполнен"<<endl;
db.PrintArray();
cout<<"\nУдаление 5 элемента"<<endl;
db.DeleteEl(5);
db.PrintArray();
cout<<"\nМинимальный элемент в массиве: "<<db.FindMin()<<endl;
cout<<"\nПоиск элемента `3.1`"<<endl;
db.Finder(3.1);
cout<<"\nСортировка массива"<<endl;
db.SortArray();
db.PrintArray();
*/
cout<<"----------------------------------------Работа с Классами----------------------------------------"<<endl;
Array<Class*> a;
Class c(5.15);
a.AddEl(&c);
Class c1(3.15);
a.AddEl(&c1);
Class c2(2.1);
a.AddEl(&c2);
Class c3(9.99);
a.AddEl(&c3);
cout<<"Массив заполнен"<<endl;
a.PrintArray();
cout<<"Добавление класса-наследника"<<endl;
Class1 cc(3.1, 2);
a.AddEl(&cc);
a.PrintArray();
cout<<"\nУдаление 2 элемента"<<endl;
a.DeleteEl(2);
a.PrintArray();
cout<<"\nМинимальный элемент в массиве: "<<a.FindMin()<<endl;
cout<<"\nПоиск элемента `2.1`"<<endl;
a.Finder(2.1);
cout<<"\nСортировка массива"<<endl;
a.SortArray();
a.PrintArray();
return 0;
} | [
"yaylo.danil@gmail.com"
] | yaylo.danil@gmail.com |
424dd9c1df4c0907e8a1d8326b01f980c4a88457 | 9b3c6be0c9d70abd52dae74739a375207493e121 | /CSES/Grid Paths.cpp | 778814fcdb253802064f1f5e3828d67f8b904b3a | [] | no_license | ashraf-pavel/DP | a39e0d27b254635c0b8a0418e2bdc4409cfff9a9 | f77387a3c56cd66fa89fe29a0c20b1528ee6235a | refs/heads/main | 2023-06-02T07:14:11.292806 | 2021-06-16T17:42:31 | 2021-06-16T17:42:31 | 376,338,882 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,552 | cpp | #include<bits/stdc++.h>
#define pi acos(-1.0)
#define bsort(v) sort(v.begin(),v.end())
#define pb push_back
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);
#define MOD 1000000007
#define N 10000001
#define F first
#define S second
#define MAX 500050
#define ALL(v) v.begin(),v.end()
#define clr(x,y) memset(x,y,sizeof x)
#define valid(x,y) ((x>=0&&x<n) && (y>=0&&y<m))
#define dbg(x) cerr << #x << " is " << x << endl;
#define done(i) cout<<"done = "<<i<<endl;
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<int,int> pii;
int gcd(int a,int b)
{
if(b==0)
return a;
return gcd(b,a%b);
}
ll fact(ll n)
{
ll res=1;
for(int i=2;i<=n;++i)
{
res*=i;
res%=MOD;
}
return res;
}
void solve()
{
int n;
cin>>n;
string s;
long long dp[n][n];
clr(dp,0);
dp[0][0]=1;
for(int i=0;i<n;i++)
{
cin>>s;
for(int j=0;j<n;j++)
{
if(s[j]=='.')
{
if(i>0)
{
dp[i][j]=(dp[i][j]+dp[i-1][j])%MOD;
}
if(j)
dp[i][j]=(dp[i][j]+dp[i][j-1])%MOD;
}
else
dp[i][j]=0;
}
}
cout<<dp[n-1][n-1]<<endl;
}
int main()
{
FAST
int tc=1;
//cin>>tc;
int z=0;
while(tc--)
{
solve();
}
return 0;
}
| [
"noreply@github.com"
] | noreply@github.com |
55c8373225b1fcba1a7908f2ca50c6a499b41ab8 | 30ada77908b47585dfb3c2fe185ad6f058137bcc | /grid.cpp | d5bae52cec3bbc692f19e4afe1a7d0c3b7a37ad0 | [] | no_license | nsuh/powerGridOptimizer | c60d2c3f5aeaa6da9802bbb7c9c871f66226c0a6 | 10914b12c719bd3672b9ac92e3f23a7fc636504d | refs/heads/master | 2021-01-02T08:39:51.398956 | 2014-09-13T07:50:35 | 2014-09-13T07:50:35 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,043 | cpp | // Nathan Suh, Dehowe Feng
#include "grid.h"
#include "PowerMain.h"
#include <iostream>
#include <cmath>
#include "QueueAr.h"
//Notes:
// blocks is the array that is being stored in.
// adjBlocks is the array of blocks that are adjacent
// losses is the array of losses of connections.
// previous holds "previous" block of a block, i.e what block will point to that block.
using namespace std;
Grid::Grid(int gridSize, const Block *blocks, int previous[])
{
Blockdata *blocksdata = new Blockdata[gridSize];
Queue<Blockdata> PowerLine(gridSize*10);
for(int i = 0; i < gridSize ; i++)
{
blocksdata[i].blocks = blocks[i];
blocksdata[i].distance = INFINITY;
blocksdata[i].identity = i;
blocksdata[i].connected = false;
}
for (int i = 9; i > 0 ; i--)
{
blocksdata[i].distance = 0;
PowerLine.enqueue(blocksdata[i]);
}
while(!PowerLine.isEmpty())
{
Blockdata b = PowerLine.dequeue();
//cout << "edgeCount of b is " << b.blocks.edgeCount << endl;
//cout << "distance of b is " << b.distance << endl;
//cout << "identity of b is" << b.identity << endl;
//cout << "losses of b are " << endl << b.blocks.losses[0] << endl;
//cout << b.blocks.losses[1] << endl;
//cout << b.blocks.losses[2] << endl;
//cout << "adjacents are" << endl << b.blocks.adjBlocks[0] << endl;
//cout << b.blocks.adjBlocks[1] << endl;
//cout << b.blocks.adjBlocks[2] << endl;
for(int i = 0; i < b.blocks.edgeCount; i++)
{
if(b.distance + b.blocks.losses[i] < blocksdata[b.blocks.adjBlocks[i]].distance)
{
if(blocksdata[b.blocks.adjBlocks[i]].identity > 9)
{
blocksdata[b.blocks.adjBlocks[i]].distance = b.distance + b.blocks.losses[i];
previous[b.blocks.adjBlocks[i]] = b.identity;
}
else
blocksdata[b.blocks.adjBlocks[i]].distance = 0;
PowerLine.enqueue(blocksdata[b.blocks.adjBlocks[i]]);
blocksdata[b.blocks.adjBlocks[i]].connected = true;
}
}
}
}
| [
"nysuh@ucdavis.edu"
] | nysuh@ucdavis.edu |
78cfa9ceaa5ed9766908e33fa26bef124a8bc0b2 | 3831b42699a3daa7ddd47260864b09acc4d97421 | /src/game/GameEventMgr.h | 39480a9f440002227796382d6534f05d84fbd360 | [] | no_license | Archonte/Ashbringer | 392fb926478672912fd1eb998c5e3f6f8287736b | cad2f12c2f93a16358df28637d50f5212902d9cc | refs/heads/master | 2016-09-09T19:19:36.336556 | 2010-07-04T06:05:49 | 2010-07-04T06:05:49 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,036 | h | /*
* Copyright (C) 2005-2010 MaNGOS <http://getmangos.com/>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef MANGOS_GAMEEVENT_MGR_H
#define MANGOS_GAMEEVENT_MGR_H
#include "Common.h"
#include "SharedDefines.h"
#include "Platform/Define.h"
#include "Policies/Singleton.h"
#define max_ge_check_delay 86400 // 1 day in seconds
class Creature;
class GameObject;
struct GameEventData
{
GameEventData() : start(1),end(0),occurence(0),length(0), holiday_id(HOLIDAY_NONE) {}
time_t start;
time_t end;
uint32 occurence; // Delay in minutes between occurences of the event
uint32 length; // Length in minutes of the event
HolidayIds holiday_id;
std::string description;
bool isValid() const { return length > 0; }
};
struct ModelEquip
{
uint32 modelid;
uint32 equipment_id;
uint32 modelid_prev;
uint32 equipement_id_prev;
};
class GameEventMgr
{
public:
GameEventMgr();
~GameEventMgr() {};
typedef std::set<uint16> ActiveEvents;
typedef std::vector<GameEventData> GameEventDataMap;
ActiveEvents const& GetActiveEventList() const { return m_ActiveEvents; }
GameEventDataMap const& GetEventMap() const { return mGameEvent; }
bool CheckOneGameEvent(uint16 entry) const;
uint32 NextCheck(uint16 entry) const;
void LoadFromDB();
uint32 Update();
bool IsActiveEvent(uint16 event_id) { return ( m_ActiveEvents.find(event_id)!=m_ActiveEvents.end()); }
uint32 Initialize();
void StartEvent(uint16 event_id, bool overwrite = false);
void StopEvent(uint16 event_id, bool overwrite = false);
private:
void AddActiveEvent(uint16 event_id) { m_ActiveEvents.insert(event_id); }
void RemoveActiveEvent(uint16 event_id) { m_ActiveEvents.erase(event_id); }
void ApplyNewEvent(uint16 event_id);
void UnApplyEvent(uint16 event_id);
void GameEventSpawn(int16 event_id);
void GameEventUnspawn(int16 event_id);
void ChangeEquipOrModel(int16 event_id, bool activate);
void UpdateEventQuests(uint16 event_id, bool Activate);
void UpdateWorldStates(uint16 event_id, bool Activate);
protected:
typedef std::list<uint32> GuidList;
typedef std::list<uint16> IdList;
typedef std::vector<GuidList> GameEventGuidMap;
typedef std::vector<IdList> GameEventIdMap;
typedef std::pair<uint32, ModelEquip> ModelEquipPair;
typedef std::list<ModelEquipPair> ModelEquipList;
typedef std::vector<ModelEquipList> GameEventModelEquipMap;
typedef std::pair<uint32, uint32> QuestRelation;
typedef std::list<QuestRelation> QuestRelList;
typedef std::vector<QuestRelList> GameEventQuestMap;
GameEventQuestMap mGameEventQuests;
GameEventModelEquipMap mGameEventModelEquip;
GameEventGuidMap mGameEventCreatureGuids;
GameEventGuidMap mGameEventGameobjectGuids;
GameEventIdMap mGameEventPoolIds;
GameEventDataMap mGameEvent;
ActiveEvents m_ActiveEvents;
bool m_IsGameEventsInit;
};
#define sGameEventMgr MaNGOS::Singleton<GameEventMgr>::Instance()
MANGOS_DLL_SPEC bool IsHolidayActive(HolidayIds id);
#endif
| [
"saintbdf@hotmail.fr"
] | saintbdf@hotmail.fr |
5b2906d9e820196444884d4d24779e4e1db5a985 | 0eff74b05b60098333ad66cf801bdd93becc9ea4 | /second/download/git/gumtree/git_new_log_1190.cpp | 0d33b96fc38a68cd37ac83c448d2cf362d1be1fc | [] | no_license | niuxu18/logTracker-old | 97543445ea7e414ed40bdc681239365d33418975 | f2b060f13a0295387fe02187543db124916eb446 | refs/heads/master | 2021-09-13T21:39:37.686481 | 2017-12-11T03:36:34 | 2017-12-11T03:36:34 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 113 | cpp | fprintf_ln(stderr,
_("Continuing under the assumption that "
"you meant '%s'."),
assumed); | [
"993273596@qq.com"
] | 993273596@qq.com |
e729b9193c9be05fea70cd10e702226b847e734a | 6c77cf237697f252d48b287ae60ccf61b3220044 | /aws-cpp-sdk-elasticache/source/model/Tag.cpp | 452effae8a74783c1c3e2689649f324b5630cb80 | [
"MIT",
"Apache-2.0",
"JSON"
] | permissive | Gohan/aws-sdk-cpp | 9a9672de05a96b89d82180a217ccb280537b9e8e | 51aa785289d9a76ac27f026d169ddf71ec2d0686 | refs/heads/master | 2020-03-26T18:48:43.043121 | 2018-11-09T08:44:41 | 2018-11-09T08:44:41 | 145,232,234 | 1 | 0 | Apache-2.0 | 2018-08-30T13:42:27 | 2018-08-18T15:42:39 | C++ | UTF-8 | C++ | false | false | 2,400 | cpp | /*
* 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.
*/
#include <aws/elasticache/model/Tag.h>
#include <aws/core/utils/xml/XmlSerializer.h>
#include <aws/core/utils/StringUtils.h>
#include <aws/core/utils/memory/stl/AWSStringStream.h>
#include <utility>
using namespace Aws::Utils::Xml;
using namespace Aws::Utils;
namespace Aws
{
namespace ElastiCache
{
namespace Model
{
Tag::Tag() :
m_keyHasBeenSet(false),
m_valueHasBeenSet(false)
{
}
Tag::Tag(const XmlNode& xmlNode) :
m_keyHasBeenSet(false),
m_valueHasBeenSet(false)
{
*this = xmlNode;
}
Tag& Tag::operator =(const XmlNode& xmlNode)
{
XmlNode resultNode = xmlNode;
if(!resultNode.IsNull())
{
XmlNode keyNode = resultNode.FirstChild("Key");
if(!keyNode.IsNull())
{
m_key = StringUtils::Trim(keyNode.GetText().c_str());
m_keyHasBeenSet = true;
}
XmlNode valueNode = resultNode.FirstChild("Value");
if(!valueNode.IsNull())
{
m_value = StringUtils::Trim(valueNode.GetText().c_str());
m_valueHasBeenSet = true;
}
}
return *this;
}
void Tag::OutputToStream(Aws::OStream& oStream, const char* location, unsigned index, const char* locationValue) const
{
if(m_keyHasBeenSet)
{
oStream << location << index << locationValue << ".Key=" << StringUtils::URLEncode(m_key.c_str()) << "&";
}
if(m_valueHasBeenSet)
{
oStream << location << index << locationValue << ".Value=" << StringUtils::URLEncode(m_value.c_str()) << "&";
}
}
void Tag::OutputToStream(Aws::OStream& oStream, const char* location) const
{
if(m_keyHasBeenSet)
{
oStream << location << ".Key=" << StringUtils::URLEncode(m_key.c_str()) << "&";
}
if(m_valueHasBeenSet)
{
oStream << location << ".Value=" << StringUtils::URLEncode(m_value.c_str()) << "&";
}
}
} // namespace Model
} // namespace ElastiCache
} // namespace Aws
| [
"henso@amazon.com"
] | henso@amazon.com |
d97043b64cc621b522da6ccecff0a7082969c7aa | 3ccfe5694e622c7966440598f15fff8d167dbee5 | /CGTetris/RoundButton.cpp | 048dd332f1b314fc2c9c6245ce02c4c48bfc989e | [] | no_license | EpistemikCpp/msProj | 7dcc804640f2b4ad455296fb9d0566ae8e809d01 | 73b392ea25eb3f3b56118e2933501db0685410d1 | refs/heads/master | 2020-03-27T06:43:47.690776 | 2018-08-25T21:25:56 | 2018-08-25T21:25:56 | 146,130,581 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 17,576 | cpp | // RoundButton.cpp : implementation file
//
// Round Buttons!
//
// Written by Chris Maunder (Chris.Maunder@cbr.clw.csiro.au)
// Copyright (c) 1997,1998.
//
// Modified: 2 Feb 1998 - Fix vis problem, CRgn resource leak,
// button reposition code redone. CJM.
//
// This code may be used in compiled form in any way you desire. This
// file may be redistributed unmodified by any means PROVIDING it is
// not sold for profit without the authors written consent, and
// providing that this notice and the authors name is included. If
// the source code in this file is used in any commercial application
// then a simple email would be nice.
//
// This file is provided "as is" with no expressed or implied warranty.
// The author accepts no liability if it causes any damage to your
// computer, causes your pet cat to fall ill, increases baldness or
// makes you car start emitting strange noises when you start it up.
//
// Expect bugs.
//
// Please use and enjoy. Please let me know of any bugs/mods/improvements
// that you have found/implemented and I will fix/incorporate them into this
// file.
//
/////////////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "math.h"
#include "RoundButton.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
// prototypes
COLORREF GetColour(double dAngle, COLORREF crBright, COLORREF crDark);
void DrawCircle(CDC* pDC, CPoint p, LONG lRadius, COLORREF crColour, BOOL bDashed = FALSE);
void DrawCircleLeft(CDC* pDC, CPoint p, LONG lRadius, COLORREF crBright, COLORREF crDark);
void DrawCircleRight(CDC* pDC, CPoint p, LONG lRadius, COLORREF crBright, COLORREF crDark);
// Calculate colour for a point at the given angle by performing a linear
// interpolation between the colours crBright and crDark based on the cosine
// of the angle between the light source and the point.
//
// Angles are measured from the +ve x-axis (i.e. (1,0) = 0 degrees, (0,1) = 90 degrees )
// But remember: +y points down!
COLORREF GetColour(double dAngle, COLORREF crBright, COLORREF crDark)
{
#define Rad2Deg 180.0/3.1415
// For better light-continuity along the edge of a stretched button:
// LIGHT_SOURCE_ANGLE == -1.88
//#define LIGHT_SOURCE_ANGLE -2.356 // -2.356 radians = -135 degrees, i.e. From top left
#define LIGHT_SOURCE_ANGLE -1.88
ASSERT(dAngle > -3.1416 && dAngle < 3.1416);
double dAngleDifference = LIGHT_SOURCE_ANGLE - dAngle;
if (dAngleDifference < -3.1415) dAngleDifference = 6.293 + dAngleDifference;
else if (dAngleDifference > 3.1415) dAngleDifference = 6.293 - dAngleDifference;
double Weight = 0.5*(cos(dAngleDifference)+1.0);
BYTE Red = (BYTE) (Weight*GetRValue(crBright) + (1.0-Weight)*GetRValue(crDark));
BYTE Green = (BYTE) (Weight*GetGValue(crBright) + (1.0-Weight)*GetGValue(crDark));
BYTE Blue = (BYTE) (Weight*GetBValue(crBright) + (1.0-Weight)*GetBValue(crDark));
//TRACE("LightAngle = %0.0f, Angle = %3.0f, Diff = %3.0f, Weight = %0.2f, RGB %3d,%3d,%3d\n",
// LIGHT_SOURCE_ANGLE*Rad2Deg, dAngle*Rad2Deg, dAngleDifference*Rad2Deg, Weight,Red,Green,Blue);
return RGB(Red, Green, Blue);
}
void DrawCircle(CDC* pDC, CPoint p, LONG lRadius, COLORREF crColour, BOOL bDashed)
{
const int nDashLength = 1;
LONG lError, lXoffset, lYoffset;
int nDash = 0;
BOOL bDashOn = TRUE;
//Check to see that the coordinates are valid
ASSERT( (p.x + lRadius <= LONG_MAX) && (p.y + lRadius <= LONG_MAX) );
ASSERT( (p.x - lRadius >= LONG_MIN) && (p.y - lRadius >= LONG_MIN) );
//Set starting values
lXoffset = lRadius;
lYoffset = 0;
lError = -lRadius;
do {
if (bDashOn) {
pDC->SetPixelV(p.x + lXoffset, p.y + lYoffset, crColour);
pDC->SetPixelV(p.x + lXoffset, p.y - lYoffset, crColour);
pDC->SetPixelV(p.x + lYoffset, p.y + lXoffset, crColour);
pDC->SetPixelV(p.x + lYoffset, p.y - lXoffset, crColour);
pDC->SetPixelV(p.x - lYoffset, p.y + lXoffset, crColour);
pDC->SetPixelV(p.x - lYoffset, p.y - lXoffset, crColour);
pDC->SetPixelV(p.x - lXoffset, p.y + lYoffset, crColour);
pDC->SetPixelV(p.x - lXoffset, p.y - lYoffset, crColour);
}
//Advance the error term and the constant X axis step
lError += lYoffset++;
//Check to see if error term has overflowed
if ((lError += lYoffset) >= 0)
lError -= --lXoffset * 2;
if (bDashed && (++nDash == nDashLength)) {
nDash = 0;
bDashOn = !bDashOn;
}
} while (lYoffset <= lXoffset); //Continue until halfway point
}
// The original Drawcircle function is split up into DrawCircleRight and DrawCircleLeft
// to make stretched buttons
//
void DrawCircleRight(CDC* pDC, CPoint p, LONG lRadius, COLORREF crBright, COLORREF crDark)
{
LONG lError, lXoffset, lYoffset;
//Check to see that the coordinates are valid
ASSERT( (p.x + lRadius <= LONG_MAX) && (p.y + lRadius <= LONG_MAX) );
ASSERT( (p.x - lRadius >= LONG_MIN) && (p.y - lRadius >= LONG_MIN) );
//Set starting values
lXoffset = lRadius;
lYoffset = 0;
lError = -lRadius;
do {
const double Pi = 3.141592654,
Pi_on_2 = Pi * 0.5,
Three_Pi_on_2 = Pi * 1.5;
COLORREF crColour;
double dAngle = atan2(lYoffset, lXoffset);
//Draw the current pixel, reflected across all four arcs
crColour = GetColour(dAngle, crBright, crDark);
pDC->SetPixelV(p.x + lXoffset, p.y + lYoffset, crColour);
crColour = GetColour(Pi_on_2 - dAngle, crBright, crDark);
pDC->SetPixelV(p.x + lYoffset, p.y + lXoffset, crColour);
crColour = GetColour(-Pi_on_2 + dAngle, crBright, crDark);
pDC->SetPixelV(p.x + lYoffset, p.y - lXoffset, crColour);
crColour = GetColour(-dAngle, crBright, crDark);
pDC->SetPixelV(p.x + lXoffset, p.y - lYoffset, crColour);
//Advance the error term and the constant X axis step
lError += lYoffset++;
//Check to see if error term has overflowed
if ((lError += lYoffset) >= 0)
lError -= --lXoffset * 2;
} while (lYoffset <= lXoffset); //Continue until halfway point
}
// The original Drawcircle function is split up into DrawCircleRight and DrawCircleLeft
// to make stretched buttons
//
void DrawCircleLeft(CDC* pDC, CPoint p, LONG lRadius, COLORREF crBright, COLORREF crDark)
{
LONG lError, lXoffset, lYoffset;
//Check to see that the coordinates are valid
ASSERT( (p.x + lRadius <= LONG_MAX) && (p.y + lRadius <= LONG_MAX) );
ASSERT( (p.x - lRadius >= LONG_MIN) && (p.y - lRadius >= LONG_MIN) );
//Set starting values
lXoffset = lRadius;
lYoffset = 0;
lError = -lRadius;
do {
const double Pi = 3.141592654,
Pi_on_2 = Pi * 0.5,
Three_Pi_on_2 = Pi * 1.5;
COLORREF crColour;
double dAngle = atan2(lYoffset, lXoffset);
//Draw the current pixel, reflected across all eight arcs
crColour = GetColour(Pi_on_2 + dAngle, crBright, crDark);
pDC->SetPixelV(p.x - lYoffset, p.y + lXoffset, crColour);
crColour = GetColour(Pi - dAngle, crBright, crDark);
pDC->SetPixelV(p.x - lXoffset, p.y + lYoffset, crColour);
crColour = GetColour(-Pi + dAngle, crBright, crDark);
pDC->SetPixelV(p.x - lXoffset, p.y - lYoffset, crColour);
crColour = GetColour(-Pi_on_2 - dAngle, crBright, crDark);
pDC->SetPixelV(p.x - lYoffset, p.y - lXoffset, crColour);
//Advance the error term and the constant X axis step
lError += lYoffset++;
//Check to see if error term has overflowed
if ((lError += lYoffset) >= 0)
lError -= --lXoffset * 2;
} while (lYoffset <= lXoffset); //Continue until halfway point
}
static void CreateButtonRgn(CRgn & rgn, const CRect & rect, const CPoint & ptLeft, const CPoint & ptRight, int nRadius) {
CBrush brush;
brush.CreateSolidBrush(::GetSysColor(COLOR_BTNFACE));
// left circle
CRgn rgnLeftCircle;
VERIFY(rgnLeftCircle.CreateEllipticRgn(ptLeft.x-nRadius, ptLeft.y-nRadius, ptLeft.x+nRadius, ptLeft.y+nRadius));
VERIFY(rgn.CreateEllipticRgn(ptLeft.x-nRadius, ptLeft.y-nRadius, ptLeft.x+nRadius, ptLeft.y+nRadius));
CRgn rgnLeftPart;
VERIFY(rgnLeftPart.CreateEllipticRgn(ptLeft.x-nRadius, ptLeft.y-nRadius, ptLeft.x+nRadius, ptLeft.y+nRadius));
// main body
CRgn rgnMainBody;
VERIFY(rgnMainBody.CreateRectRgn(rect.left+nRadius, rect.top, rect.right-nRadius, rect.bottom));
CRgn rgnRightCircle;
VERIFY(rgnRightCircle.CreateEllipticRgn(ptRight.x+2+nRadius, ptRight.y+nRadius, ptRight.x+2-nRadius, ptRight.y-nRadius));
// OK now combine the regions
VERIFY(rgnLeftPart.CombineRgn(&rgnLeftCircle, &rgnMainBody, RGN_OR) != ERROR);
VERIFY(rgn.CombineRgn(&rgnLeftPart, &rgnRightCircle, RGN_OR) != ERROR);
}
/////////////////////////////////////////////////////////////////////////////
// CRoundButton
CRoundButton::CRoundButton()
{
m_bDrawDashedFocusCircle = TRUE;
}
CRoundButton::~CRoundButton()
{
m_rgn.DeleteObject();
}
BEGIN_MESSAGE_MAP(CRoundButton, CButton)
//{{AFX_MSG_MAP(CRoundButton)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CRoundButton message handlers
void CRoundButton::PreSubclassWindow()
{
CButton::PreSubclassWindow();
ModifyStyle(0, BS_OWNERDRAW);
CRect rect;
GetClientRect(rect);
// set m_bStretch if the button is not square and landscape
m_bStretch = rect.Width() > rect.Height() ? TRUE : FALSE;
// Resize the window to make it square if it is not stretched
if(!m_bStretch) rect.bottom = rect.right = min(rect.bottom,rect.right);
// Get the vital statistics of the window
// m_ptLeft/m_ptRight are the centerpoints of the left/right arcs of stretched buttons
m_ptCentre = m_ptLeft = m_ptRight = rect.CenterPoint();
m_nRadius = rect.bottom/2-1;
m_ptLeft.x = m_nRadius;
m_ptRight.x = rect.right - m_nRadius - 1;
// Set the window region so mouse clicks only activate the round section
// of the button
m_rgn.DeleteObject();
SetWindowRgn(NULL, FALSE);
// JK simply creating an elliptic region isn't enough
// if this is a stretched button, the region is somewhat more complex
//m_rgn.CreateEllipticRgnIndirect(rect);
if(m_bStretch)
CreateButtonRgn(m_rgn, rect, m_ptLeft, m_ptRight, m_nRadius);
else
m_rgn.CreateEllipticRgnIndirect(rect);
SetWindowRgn(m_rgn, TRUE);
// Convert client coords to the parents client coords
ClientToScreen(rect);
CWnd* pParent = GetParent();
if (pParent) pParent->ScreenToClient(rect);
// Resize the window if it is not stretched
if(!m_bStretch) MoveWindow(rect.left, rect.top, rect.Width(), rect.Height(), TRUE);
}
void CRoundButton::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct)
{
ASSERT(lpDrawItemStruct != NULL);
CDC* pDC = CDC::FromHandle(lpDrawItemStruct->hDC);
CRect rect = lpDrawItemStruct->rcItem;
UINT state = lpDrawItemStruct->itemState;
UINT nStyle = GetStyle();
int nRadius = m_nRadius;
int nSavedDC = pDC->SaveDC();
pDC->SelectStockObject(NULL_BRUSH);
//JK pDC->FillSolidRect(rect, ::GetSysColor(COLOR_BTNFACE));
if(m_bStretch)
{ // JK: Since the tetris game uses a background image
// we cannot simply fill the complete client rect. Instead
// we fill the shape of the button.
CRect rc(rect);
++rc.top;
--rc.bottom;
CRgn rgn;
if(m_bStretch)
CreateButtonRgn(rgn, rc, m_ptLeft, m_ptRight, m_nRadius);
else
m_rgn.CreateEllipticRgnIndirect(rc);
CBrush brush;
brush.CreateSolidBrush(::GetSysColor(COLOR_BTNFACE));
pDC->FillRgn(&rgn, &brush);
}
// Draw the focus circle around the button for non-stretched buttons
if ((state & ODS_FOCUS) && m_bDrawDashedFocusCircle && !m_bStretch)
DrawCircle(pDC, m_ptCentre, nRadius--, RGB(0,0,0));
// Draw the raised/sunken edges of the button (unless flat)
if (nStyle & BS_FLAT) {
// for stretched buttons: draw left and right arcs and connect the with lines
if(m_bStretch)
{
CPen* oldpen;
CRect LeftBound(0,0,nRadius*2,nRadius*2);
CRect RightBound(m_ptRight.x-nRadius,0,m_ptRight.x+nRadius,nRadius*2);
oldpen = pDC->SelectObject(new CPen(PS_SOLID, 1, ::GetSysColor(COLOR_3DDKSHADOW)));
pDC->Arc(LeftBound, CPoint(m_ptLeft.x,0), CPoint(m_ptLeft.x,nRadius*2));
pDC->Arc(RightBound, CPoint(m_ptRight.x,nRadius*2), CPoint(m_ptRight.x,0));
pDC->MoveTo(m_ptLeft.x,0); pDC->LineTo(m_ptRight.x,0);
pDC->MoveTo(m_ptLeft.x,nRadius*2-1); pDC->LineTo(m_ptRight.x,nRadius*2-1);
nRadius--;
LeftBound.DeflateRect(1,1);
RightBound.DeflateRect(1,1);
delete pDC->SelectObject(new CPen(PS_SOLID, 1, ::GetSysColor(COLOR_3DHIGHLIGHT)));
pDC->Arc(LeftBound, CPoint(m_ptLeft.x,1), CPoint(m_ptLeft.x,nRadius*2));
pDC->Arc(RightBound, CPoint(m_ptRight.x,nRadius*2), CPoint(m_ptRight.x,0));
pDC->MoveTo(m_ptLeft.x,1); pDC->LineTo(m_ptRight.x,1);
pDC->MoveTo(m_ptLeft.x,nRadius*2); pDC->LineTo(m_ptRight.x,nRadius*2);
delete pDC->SelectObject(oldpen);
}
// for non-stretched buttons: draw two circles
else
{
DrawCircle(pDC, m_ptCentre, nRadius--, ::GetSysColor(COLOR_3DDKSHADOW));
DrawCircle(pDC, m_ptCentre, nRadius--, ::GetSysColor(COLOR_3DHIGHLIGHT));
}
} else {
if ((state & ODS_SELECTED)) {
// draw the circular segments for stretched AND non-stretched buttons
DrawCircleLeft(pDC, m_ptLeft, nRadius,
::GetSysColor(COLOR_3DDKSHADOW), ::GetSysColor(COLOR_3DHIGHLIGHT));
DrawCircleRight(pDC, m_ptRight, nRadius,
::GetSysColor(COLOR_3DDKSHADOW), ::GetSysColor(COLOR_3DHIGHLIGHT));
DrawCircleLeft(pDC, m_ptLeft, nRadius-1,
::GetSysColor(COLOR_3DSHADOW), ::GetSysColor(COLOR_3DLIGHT));
DrawCircleRight(pDC, m_ptRight, nRadius-1,
::GetSysColor(COLOR_3DSHADOW), ::GetSysColor(COLOR_3DLIGHT));
// draw connecting lines for stretched buttons only
if (m_bStretch)
{
CPen* oldpen;
//CPen* mypen;
oldpen = pDC->SelectObject(new CPen(PS_SOLID, 1, ::GetSysColor(COLOR_3DDKSHADOW)));
pDC->MoveTo(m_ptLeft.x, 1); pDC->LineTo(m_ptRight.x, 1);
delete pDC->SelectObject(new CPen(PS_SOLID, 1, ::GetSysColor(COLOR_3DSHADOW)));
pDC->MoveTo(m_ptLeft.x, 2); pDC->LineTo(m_ptRight.x, 2);
delete pDC->SelectObject(new CPen(PS_SOLID, 1, ::GetSysColor(COLOR_3DLIGHT)));
pDC->MoveTo(m_ptLeft.x, m_ptLeft.y + nRadius-1); pDC->LineTo(m_ptRight.x, m_ptLeft.y + nRadius-1);
delete pDC->SelectObject(new CPen(PS_SOLID, 1, ::GetSysColor(COLOR_3DHIGHLIGHT)));
pDC->MoveTo(m_ptLeft.x, m_ptLeft.y + nRadius); pDC->LineTo(m_ptRight.x, m_ptLeft.y + nRadius);
delete pDC->SelectObject(oldpen);
}
} else {
// draw the circular segments for stretched AND non-stretched buttons
DrawCircleLeft(pDC, m_ptLeft, nRadius,
::GetSysColor(COLOR_3DHIGHLIGHT), ::GetSysColor(COLOR_3DDKSHADOW));
DrawCircleRight(pDC, m_ptRight, nRadius,
::GetSysColor(COLOR_3DHIGHLIGHT), ::GetSysColor(COLOR_3DDKSHADOW));
DrawCircleLeft(pDC, m_ptLeft, nRadius - 1,
::GetSysColor(COLOR_3DLIGHT), ::GetSysColor(COLOR_3DSHADOW));
DrawCircleRight(pDC, m_ptRight, nRadius - 1,
::GetSysColor(COLOR_3DLIGHT), ::GetSysColor(COLOR_3DSHADOW));
// draw connecting lines for stretched buttons only
if (m_bStretch)
{
CPen* oldpen;
oldpen = pDC->SelectObject(new CPen(PS_SOLID, 1, pDC->GetPixel(m_ptLeft.x, 1)));
pDC->MoveTo(m_ptLeft.x, 1); pDC->LineTo(m_ptRight.x, 1);
delete pDC->SelectObject(new CPen(PS_SOLID, 1, pDC->GetPixel(m_ptLeft.x, 2)));
pDC->MoveTo(m_ptLeft.x, 2); pDC->LineTo(m_ptRight.x, 2);
delete pDC->SelectObject(new CPen(PS_SOLID, 1, pDC->GetPixel(m_ptLeft.x, m_ptLeft.y + nRadius)));
pDC->MoveTo(m_ptLeft.x, m_ptLeft.y + nRadius); pDC->LineTo(m_ptRight.x, m_ptLeft.y + nRadius);
delete pDC->SelectObject(new CPen(PS_SOLID, 1, pDC->GetPixel(m_ptLeft.x, m_ptLeft.y + nRadius - 1)));
pDC->MoveTo(m_ptLeft.x, m_ptLeft.y + nRadius - 1); pDC->LineTo(m_ptRight.x, m_ptLeft.y + nRadius - 1);
delete pDC->SelectObject(oldpen);
}
}
}
// draw the text if there is any
CString strText;
GetWindowText(strText);
if (!strText.IsEmpty())
{
CRgn rgn;
if (m_bStretch){
rgn.CreateRectRgn(m_ptLeft.x-nRadius/2, m_ptCentre.y-nRadius,
m_ptRight.x+nRadius/2, m_ptCentre.y+nRadius);}
else{
rgn.CreateEllipticRgn(m_ptCentre.x-nRadius, m_ptCentre.y-nRadius,
m_ptCentre.x+nRadius, m_ptCentre.y+nRadius);}
pDC->SelectClipRgn(&rgn);
CSize Extent = pDC->GetTextExtent(strText);
CPoint pt = CPoint( m_ptCentre.x - Extent.cx/2, m_ptCentre.y - Extent.cy/2 );
if (state & ODS_SELECTED) pt.Offset(1,1);
pDC->SetBkMode(TRANSPARENT);
if (state & ODS_DISABLED)
pDC->DrawState(pt, Extent, strText, DSS_DISABLED, TRUE, 0, (HBRUSH)NULL);
else
{
// changed this code to give the text a 3d-look
COLORREF oldcol = pDC->SetTextColor(::GetSysColor(COLOR_3DHIGHLIGHT));
pDC->TextOut(pt.x, pt.y, strText);
pDC->SetTextColor(::GetSysColor(COLOR_3DDKSHADOW));
pDC->TextOut(pt.x-1, pt.y-1, strText);
pDC->SetTextColor(oldcol);
}
pDC->SelectClipRgn(NULL);
rgn.DeleteObject();
}
// Draw the focus circle on the inside of the button if it is non-stretched
if ((state & ODS_FOCUS) && m_bDrawDashedFocusCircle && !m_bStretch)
DrawCircle(pDC, m_ptCentre, nRadius-2, RGB(0,0,0), TRUE);
pDC->RestoreDC(nSavedDC);
}
| [
"epistemik@gmail.com"
] | epistemik@gmail.com |
5fdd4d50021b753b1dbfb9a8709a15ca92192706 | b9eef188b71e410e2220df68ed007a31a19f01b9 | /maincontroller.h | 977b0df86d6dbc602fc63e9b5c792de619690277 | [] | no_license | tamvh/cashin_app | d5a8d6ebb8dffebbdd1520ea62ea3c229eab1c8b | 3fb55bf7ac0e57f44638877f67f841f5a7aa52cd | refs/heads/master | 2021-09-06T09:38:58.643450 | 2018-02-05T02:53:15 | 2018-02-05T02:53:15 | 117,525,784 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,642 | h | #ifndef MAINCONTROLLER_H
#define MAINCONTROLLER_H
#include <QObject>
#include "./network/httpbase.h"
#include "./network/httpbase2.h"
#include "./network/wsclient.h"
#include "datatypes.h"
#include "keepwake.h"
#define SL_SERVERURL "https://gbcstaging.zing.vn"
#define PATH_CAHSIN "/v001/mctransfer/api/cashin/?"
#define PATH_ZPUSERINFO "/v001/mctransfer/api/zpuserinfo/?"
#define CM_GET_USER_BY_PHONE "getzalopayuserinfobyphone"
#define CM_GET_USER_BY_ZPID "getzalopayuserinfobyzpid"
#define CM_TRANSFERCASHIN_BY_ZPID "transfercash"
#define CM_TRANSFERCASHIN_BY_TYPE "transfercashtype"
class ConfigSetting;
class BLEmanager;
class MainController : public QObject
{
Q_OBJECT
public:
explicit MainController(QObject *parent = 0);
~MainController();
Q_INVOKABLE void screenSave(bool onoff);
Q_INVOKABLE bool isDebugmode();
Q_INVOKABLE bool isAndroid();
Q_INVOKABLE void appQuit();
Q_INVOKABLE QString appBuildDate();
Q_INVOKABLE QString getMacAddress();
Q_INVOKABLE void connect_to_device();
Q_INVOKABLE void setMacAddress(const QString &mac_address);
Q_INVOKABLE QString formatMoney(long long moneyValue);
Q_INVOKABLE long long getMoneyValue(const QString &moneyString);
Q_INVOKABLE bool isConnected();
Q_INVOKABLE void tranferMoneyByZaloPayId(const QString &zpid, const QString &amount, const QString &transfer_type);
Q_INVOKABLE void tranferMoneyByPhone(const QString &zpid, const QString &amount, const QString &transfer_type);
Q_INVOKABLE void getZaloPayUserInfoByPhone(const QString &phone_number);
Q_INVOKABLE void getZaloPayUserInfoByZpid(const QString &zpid);
Q_INVOKABLE void resetMoney();
Q_INVOKABLE long long getCurrMoney();
Q_INVOKABLE bool get_pong_rcv();
signals:
void view_tatal_money(long long total_amount);
void device_connect(bool _status);
void doneUserInfoByPhone(const QString &data);
void doneUserInfoByZpID(const QString &data);
void doneTransferMoneyByPhone(const QString &data);
void doneTransferMoneyByZpID(const QString &data);
public slots:
void getTotalAmount(const QString &total_amount);
void get_device_connect(bool _status);
void get_userinfo_by_phone(QVariant data);
void get_userinfo_by_zpid(QVariant data);
void get_transferinfo_by_phone(QVariant data);
void get_transferinfo_by_zpid(QVariant data);
private:
KeepWake *m_keepwake;
ConfigSetting *setting;
BLEmanager *bleMgr;
long long g_total_amount;
QString g_mac_adress;
};
#endif // MAINCONTROLLER_H
| [
"huytamuit@gmail.com"
] | huytamuit@gmail.com |
9426c70b0f40f4083ad9c06fef23599ec31b8b16 | 5820a3b7dc52d733b7032379f25cbbb37971784f | /Olympiad/Balkan/Circus2015.cpp | 0040867d06114fda1726a8a82c9850dbf9e3d2c1 | [] | no_license | timpostuvan/competitive-programming | 52ed8121a0ec2c558d8e50a4b700ae4ec41b8c08 | bb66f9c293b6026f1567664feb5ea29c8566a77f | refs/heads/master | 2020-03-14T23:30:00.792969 | 2018-08-29T09:32:57 | 2018-08-29T09:32:57 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,277 | cpp | #include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define INF (2e9)
#define MOD (1000 * 1000 * 1000 + 7)
#define maxn 200111
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
// DELA SAMO ZA 51 PIK
int dp[maxn];
bool used[maxn];
int a[maxn], n, m;
void init(int N, int M, int ARR[]){
n = N;
m = M;
for(int i = 0; i < n; i++){
a[i] = ARR[i];
dp[i] = INF;
}
a[n] = m;
dp[n] = 0;
for(int k = 0; k < n; k++){
int mini = -1;
for(int i = 0; i <= n; i++){
if(used[i])
continue;
if(mini == -1 || dp[mini] > dp[i])
mini = i;
}
used[mini] = 1;
for(int i = 0; i <= n; i++){
if(abs(a[mini] - a[i]) >= dp[mini])
dp[i] = min(dp[i], abs(a[mini] - a[i]));
}
}
// for(int i = 0; i <= n; i++)
// cout << i << " " << dp[i] << endl;
}
int minLength(int x){
int ans = INF;
for(int i = 0; i <= n; i++){
if(abs(a[i] - x) >= dp[i])
ans = min(ans, abs(a[i] - x));
}
return ans;
}
int arr[maxn];
int main(){
int n, m;
scanf("%d%d", &n, &m);
for(int i = 0; i < n; i++)
scanf("%d", arr + i);
init(n, m, arr);
int q;
scanf("%d", &q);
while(q--){
int x;
scanf("%d", &x);
printf("%d\n", minLength(x));
}
return 0;
} | [
"tim.postuvan@gmail.com"
] | tim.postuvan@gmail.com |
9d79ab0df35ae539133da88bb38f746dc6860bd5 | 18896e3b02c178a8f69434475ddf44321f2b2408 | /Hazel/src/Hazel/Events/KeyEvent.h | 578cbf0b8000f0b871f7a4225d146e50a136e84a | [
"Apache-2.0"
] | permissive | TheUnicum/HazelTia | 9562a7a319d552d82f74b64fc0a232bf6c616846 | 787d14ea16e81e9df74959703d7878e7b0fbd417 | refs/heads/master | 2023-08-12T23:10:41.879691 | 2021-10-10T13:44:59 | 2021-10-10T13:44:59 | 156,781,974 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,432 | h | #pragma once
#include "Hazel/Events/Event.h"
#include "Hazel/Core/KeyCodes.h"
namespace Hazel {
class KeyEvent : public Event
{
public:
KeyCode GetKeyCode() const { return m_KeyCode; }
EVENT_CLASS_CATEGORY(EventCategoryKeyboard | EventCategoryInput)
protected:
KeyEvent(const KeyCode keycode)
: m_KeyCode(keycode) {}
KeyCode m_KeyCode;
};
class KeyPressedEvent : public KeyEvent
{
public:
KeyPressedEvent(const KeyCode keycode, const uint16_t repeatCount)
: KeyEvent(keycode), m_RepeatCount(repeatCount) {}
uint16_t GetRepeatCount() const { return m_RepeatCount; }
std::string ToString() const override
{
std::stringstream ss;
ss << "KeyPressedEvent: " << m_KeyCode << " (" << m_RepeatCount << " repeats)";
return ss.str();
}
EVENT_CLASS_TYPE(KeyPressed)
private:
uint16_t m_RepeatCount;
};
class KeyReleasedEvent : public KeyEvent
{
public:
KeyReleasedEvent(const KeyCode keycode)
: KeyEvent(keycode) {}
std::string ToString() const override
{
std::stringstream ss;
ss << "KeyReleasedEvent: " << m_KeyCode;
return ss.str();
}
EVENT_CLASS_TYPE(KeyReleased)
};
class KeyTypedEvent : public KeyEvent
{
public:
KeyTypedEvent(const KeyCode keycode)
: KeyEvent(keycode) {}
std::string ToString() const override
{
std::stringstream ss;
ss << "KeyTypeEvent: " << m_KeyCode;
return ss.str();
}
EVENT_CLASS_TYPE(KeyTyped)
};
}
| [
"tia_ben@tin.it"
] | tia_ben@tin.it |
341c060b2ed713d99b83b7ea0c800ef534db6238 | 3d5e4966d148134cc8a80b7c2026df5d5603d809 | /Tutorial02_CThreadedMandelbrot_Complete/Tutorial02_CThreadedMandelbrot.cpp | 2ac5fe27822677223634ebb6ef76f9824da3fc70 | [] | no_license | Jordanb1997/Multicore-Programming-2019 | 623b2a2517852f90d2b40dde73b8b702044f8ad3 | e710ef3132c734288ca693b610d054b75825ad6a | refs/heads/main | 2023-02-21T07:46:01.401498 | 2021-01-22T03:30:47 | 2021-01-22T03:30:47 | 331,826,194 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,322 | cpp | // Tutorial02_CThreadedMandelbrot.cpp
// Basic multithreaded (CPU) Mandelbrot generation with supersampling
#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include "bmp.h"
#include "Mandelbrot.h"
// buffer for colour information
unsigned int buffer[MAX_WIDTH * MAX_HEIGHT];
// ThreadData structure to hold all the parameters necessary for running the mandelbrot function
struct ThreadData
{
unsigned int threadID;
unsigned int iterations;
float centrex;
float centrey;
float scaley;
unsigned int samples;
unsigned int width;
unsigned int height;
unsigned int* out;
};
// a THREAD_START_ROUTINE function that casts its argument, calls the mandelbrot function, and then exits gracefully
DWORD __stdcall mandelbrotThreadStart(LPVOID threadData)
{
// cast the pointer to void (i.e. an untyped pointer) into something we can use
ThreadData* data = (ThreadData*) threadData;
mandelbrot(data->threadID, data->iterations, data->centrex, data->centrey, data->scaley, data->samples, data->width, data->height, data->out);
ExitThread(NULL);
}
static void generate(unsigned int threads, unsigned int iterations, float centrex, float centrey, float scaley,
unsigned int samples, unsigned int width, unsigned int height, unsigned int* out)
{
// output (hopefully helpful) generation message
printf("generating at (%f, %f) with scale %f and %d iterations at size %dx%d with %d samples per pixel\n",
centrex, centrey, scaley, iterations, width, height, samples * samples);
// timing variables
clock_t start, finish;
// calculate mandelbrot and time how long it takes
start = clock();
// dynamically sized storage for Thread handles and initialisation data
HANDLE* threadHandles = new HANDLE[threads];
ThreadData* threadData = new ThreadData[threads];
// create all the threads with sensible initial values
for (unsigned int i = 0; i < threads; i++) {
threadData[i].threadID = i;
threadData[i].iterations = iterations;
threadData[i].centrex = centrex;
threadData[i].centrey = centrey + (i - (threads - 1) / 2.0f)* (scaley / threads);
threadData[i].scaley = scaley / threads;
threadData[i].samples = samples;
threadData[i].width = width;
threadData[i].height = height / threads;
threadData[i].out = out + i * width * height / threads;
threadHandles[i] = CreateThread(NULL, 0, mandelbrotThreadStart, (void*) &threadData[i], 0, NULL);
}
// wait for everything to finish
for (unsigned int i = 0; i < threads; i++) {
WaitForSingleObject(threadHandles[i], INFINITE);
}
//WaitForMultipleObjects(threads, threadHandles, true, INFINITE); // WaitForMultipleObjects will work, but has a limit of 64 threads
// release dynamic memory
delete[] threadHandles;
delete[] threadData;
finish = clock();
printf("time taken: %ums\n", finish - start);
}
int main(int argc, char **argv)
{
// number of threads to run on
unsigned int threads = DEFAULT_THREADS;
// size of output
unsigned int width = DEFAULT_WIDTH, height = DEFAULT_HEIGHT;
// "accuracy" of calculation
unsigned int iterations = DEFAULT_MAX_ITER;
// area of interest (centre coordinates on the complex plane and height of area)
float centrex = DEFAULT_CENTRE_X;
float centrey = DEFAULT_CENTRE_Y;
float scaley = DEFAULT_SCALE_Y;
unsigned int samples = DEFAULT_SAMPLES;
// read any command-line arguments
for (int i = 1; i < argc; i++)
{
if (strcmp(argv[i], "-iterations") == 0)
{
iterations = atoi(argv[++i]);
}
else if (strcmp(argv[i], "-size") == 0)
{
width = atoi(argv[++i]);
height = atoi(argv[++i]);
}
else if (strcmp(argv[i], "-centre") == 0)
{
centrex = (float) atof(argv[++i]);
centrey = (float) atof(argv[++i]);
}
else if (strcmp(argv[i], "-scale") == 0)
{
scaley = (float) atof(argv[++i]);
}
else if (strcmp(argv[i], "-samples") == 0)
{
samples = atoi(argv[++i]);
}
else if (strcmp(argv[i], "-threads") == 0)
{
threads = atoi(argv[++i]);
}
else
{
fprintf(stderr, "unknown argument: %s\n", argv[i]);
}
}
// generate Mandelbrot fractal in global buffer
generate(threads, iterations, centrex, centrey, scaley, samples, width, height, buffer);
// output (uncompressed) bmp file
write_bmp("output.bmp", width, height, (char*) buffer);
// success!
return 0;
}
| [
"40512499+Jordanb1997@users.noreply.github.com"
] | 40512499+Jordanb1997@users.noreply.github.com |
2e29da29e096c3533b1b1efa507c140e037b3588 | db6903560e8c816b85b9adec3187f688f8e40289 | /VisualUltimate/WindowsSDKs/vc7_64/Include/ClusCfgWizard.h | 84803b0f7591777b62d5756b0f56ab46cbd1d3e1 | [] | no_license | QianNangong/VC6Ultimate | 846a4e610859fab5c9d8fb73fa5c9321e7a2a65e | 0c74cf644fbdd38018c8d94c9ea9f8b72782ef7c | refs/heads/master | 2022-05-05T17:49:52.120385 | 2019-03-07T14:46:51 | 2019-03-07T14:46:51 | 147,986,727 | 4 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 33,708 | h |
/* this ALWAYS GENERATED file contains the definitions for the interfaces */
/* File created by MIDL compiler version 6.00.0366 */
/* Compiler settings for cluscfgwizard.idl:
Oicf, W1, Zp8, env=Win32 (32b run)
protocol : dce , ms_ext, c_ext, robust
error checks: allocation ref bounds_check enum stub_data
VC __declspec() decoration level:
__declspec(uuid()), __declspec(selectany), __declspec(novtable)
DECLSPEC_UUID(), MIDL_INTERFACE()
*/
//@@MIDL_FILE_HEADING( )
#pragma warning( disable: 4049 ) /* more than 64k source lines */
/* verify that the <rpcndr.h> version is high enough to compile this file*/
#ifndef __REQUIRED_RPCNDR_H_VERSION__
#define __REQUIRED_RPCNDR_H_VERSION__ 475
#endif
#include "rpc.h"
#include "rpcndr.h"
#ifndef __RPCNDR_H_VERSION__
#error this stub requires an updated version of <rpcndr.h>
#endif // __RPCNDR_H_VERSION__
#ifndef __cluscfgwizard_h__
#define __cluscfgwizard_h__
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
#pragma once
#endif
/* Forward Declarations */
#ifndef __IClusCfgCreateClusterWizard_FWD_DEFINED__
#define __IClusCfgCreateClusterWizard_FWD_DEFINED__
typedef interface IClusCfgCreateClusterWizard IClusCfgCreateClusterWizard;
#endif /* __IClusCfgCreateClusterWizard_FWD_DEFINED__ */
#ifndef __IClusCfgAddNodesWizard_FWD_DEFINED__
#define __IClusCfgAddNodesWizard_FWD_DEFINED__
typedef interface IClusCfgAddNodesWizard IClusCfgAddNodesWizard;
#endif /* __IClusCfgAddNodesWizard_FWD_DEFINED__ */
#ifndef __ClusCfgCreateClusterWizard_FWD_DEFINED__
#define __ClusCfgCreateClusterWizard_FWD_DEFINED__
#ifdef __cplusplus
typedef class ClusCfgCreateClusterWizard ClusCfgCreateClusterWizard;
#else
typedef struct ClusCfgCreateClusterWizard ClusCfgCreateClusterWizard;
#endif /* __cplusplus */
#endif /* __ClusCfgCreateClusterWizard_FWD_DEFINED__ */
#ifndef __ClusCfgAddNodesWizard_FWD_DEFINED__
#define __ClusCfgAddNodesWizard_FWD_DEFINED__
#ifdef __cplusplus
typedef class ClusCfgAddNodesWizard ClusCfgAddNodesWizard;
#else
typedef struct ClusCfgAddNodesWizard ClusCfgAddNodesWizard;
#endif /* __cplusplus */
#endif /* __ClusCfgAddNodesWizard_FWD_DEFINED__ */
/* header files for imported files */
#include "oaidl.h"
#include "ocidl.h"
#ifdef __cplusplus
extern "C"{
#endif
void * __RPC_USER MIDL_user_allocate(size_t);
void __RPC_USER MIDL_user_free( void * );
#ifndef __ClusCfgWizard_LIBRARY_DEFINED__
#define __ClusCfgWizard_LIBRARY_DEFINED__
/* library ClusCfgWizard */
/* [lcid][helpstring][version][uuid] */
EXTERN_C const IID LIBID_ClusCfgWizard;
#ifndef __IClusCfgCreateClusterWizard_INTERFACE_DEFINED__
#define __IClusCfgCreateClusterWizard_INTERFACE_DEFINED__
/* interface IClusCfgCreateClusterWizard */
/* [unique][helpstring][dual][uuid][object] */
EXTERN_C const IID IID_IClusCfgCreateClusterWizard;
#if defined(__cplusplus) && !defined(CINTERFACE)
MIDL_INTERFACE("f65c6990-a144-4127-ab6e-3712b75f1843")
IClusCfgCreateClusterWizard : public IDispatch
{
public:
virtual /* [helpstring][propput] */ HRESULT STDMETHODCALLTYPE put_ClusterName(
/* [in] */ BSTR bstrClusterNameIn) = 0;
virtual /* [helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_ClusterName(
/* [retval][out] */ BSTR *pbstrClusterNameOut) = 0;
virtual /* [helpstring][propput] */ HRESULT STDMETHODCALLTYPE put_ServiceAccountName(
/* [in] */ BSTR bstrServiceAccountNameIn) = 0;
virtual /* [helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_ServiceAccountName(
/* [retval][out] */ BSTR *pbstrServiceAccountNameOut) = 0;
virtual /* [helpstring][propput] */ HRESULT STDMETHODCALLTYPE put_ServiceAccountDomain(
/* [in] */ BSTR bstrServiceAccountDomainIn) = 0;
virtual /* [helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_ServiceAccountDomain(
/* [retval][out] */ BSTR *pbstrServiceAccountDomainOut) = 0;
virtual /* [helpstring][propput] */ HRESULT STDMETHODCALLTYPE put_ServiceAccountPassword(
/* [in] */ BSTR bstrPasswordIn) = 0;
virtual /* [helpstring][propput] */ HRESULT STDMETHODCALLTYPE put_ClusterIPAddress(
/* [in] */ BSTR bstrClusterIPAddressIn) = 0;
virtual /* [helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_ClusterIPAddress(
/* [retval][out] */ BSTR *pbstrClusterIPAddressOut) = 0;
virtual /* [helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_ClusterIPSubnet(
/* [retval][out] */ BSTR *pbstrClusterIPSubnetOut) = 0;
virtual /* [helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_ClusterIPAddressNetwork(
/* [retval][out] */ BSTR *pbstrClusterNetworkNameOut) = 0;
virtual /* [helpstring][propput] */ HRESULT STDMETHODCALLTYPE put_FirstNodeInCluster(
/* [in] */ BSTR bstrFirstNodeInClusterIn) = 0;
virtual /* [helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_FirstNodeInCluster(
/* [retval][out] */ BSTR *pbstrFirstNodeInClusterOut) = 0;
virtual /* [helpstring][propput] */ HRESULT STDMETHODCALLTYPE put_MinimumConfiguration(
/* [in] */ VARIANT_BOOL fMinConfigIn) = 0;
virtual /* [helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_MinimumConfiguration(
/* [retval][out] */ VARIANT_BOOL *pfMinConfigOut) = 0;
virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE ShowWizard(
/* [defaultvalue][in] */ long lParentWindowHandleIn,
/* [retval][out] */ VARIANT_BOOL *pfCompletedOut) = 0;
};
#else /* C style interface */
typedef struct IClusCfgCreateClusterWizardVtbl
{
BEGIN_INTERFACE
HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
IClusCfgCreateClusterWizard * This,
/* [in] */ REFIID riid,
/* [iid_is][out] */ void **ppvObject);
ULONG ( STDMETHODCALLTYPE *AddRef )(
IClusCfgCreateClusterWizard * This);
ULONG ( STDMETHODCALLTYPE *Release )(
IClusCfgCreateClusterWizard * This);
HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )(
IClusCfgCreateClusterWizard * This,
/* [out] */ UINT *pctinfo);
HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )(
IClusCfgCreateClusterWizard * This,
/* [in] */ UINT iTInfo,
/* [in] */ LCID lcid,
/* [out] */ ITypeInfo **ppTInfo);
HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )(
IClusCfgCreateClusterWizard * This,
/* [in] */ REFIID riid,
/* [size_is][in] */ LPOLESTR *rgszNames,
/* [in] */ UINT cNames,
/* [in] */ LCID lcid,
/* [size_is][out] */ DISPID *rgDispId);
/* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )(
IClusCfgCreateClusterWizard * This,
/* [in] */ DISPID dispIdMember,
/* [in] */ REFIID riid,
/* [in] */ LCID lcid,
/* [in] */ WORD wFlags,
/* [out][in] */ DISPPARAMS *pDispParams,
/* [out] */ VARIANT *pVarResult,
/* [out] */ EXCEPINFO *pExcepInfo,
/* [out] */ UINT *puArgErr);
/* [helpstring][propput] */ HRESULT ( STDMETHODCALLTYPE *put_ClusterName )(
IClusCfgCreateClusterWizard * This,
/* [in] */ BSTR bstrClusterNameIn);
/* [helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_ClusterName )(
IClusCfgCreateClusterWizard * This,
/* [retval][out] */ BSTR *pbstrClusterNameOut);
/* [helpstring][propput] */ HRESULT ( STDMETHODCALLTYPE *put_ServiceAccountName )(
IClusCfgCreateClusterWizard * This,
/* [in] */ BSTR bstrServiceAccountNameIn);
/* [helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_ServiceAccountName )(
IClusCfgCreateClusterWizard * This,
/* [retval][out] */ BSTR *pbstrServiceAccountNameOut);
/* [helpstring][propput] */ HRESULT ( STDMETHODCALLTYPE *put_ServiceAccountDomain )(
IClusCfgCreateClusterWizard * This,
/* [in] */ BSTR bstrServiceAccountDomainIn);
/* [helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_ServiceAccountDomain )(
IClusCfgCreateClusterWizard * This,
/* [retval][out] */ BSTR *pbstrServiceAccountDomainOut);
/* [helpstring][propput] */ HRESULT ( STDMETHODCALLTYPE *put_ServiceAccountPassword )(
IClusCfgCreateClusterWizard * This,
/* [in] */ BSTR bstrPasswordIn);
/* [helpstring][propput] */ HRESULT ( STDMETHODCALLTYPE *put_ClusterIPAddress )(
IClusCfgCreateClusterWizard * This,
/* [in] */ BSTR bstrClusterIPAddressIn);
/* [helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_ClusterIPAddress )(
IClusCfgCreateClusterWizard * This,
/* [retval][out] */ BSTR *pbstrClusterIPAddressOut);
/* [helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_ClusterIPSubnet )(
IClusCfgCreateClusterWizard * This,
/* [retval][out] */ BSTR *pbstrClusterIPSubnetOut);
/* [helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_ClusterIPAddressNetwork )(
IClusCfgCreateClusterWizard * This,
/* [retval][out] */ BSTR *pbstrClusterNetworkNameOut);
/* [helpstring][propput] */ HRESULT ( STDMETHODCALLTYPE *put_FirstNodeInCluster )(
IClusCfgCreateClusterWizard * This,
/* [in] */ BSTR bstrFirstNodeInClusterIn);
/* [helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_FirstNodeInCluster )(
IClusCfgCreateClusterWizard * This,
/* [retval][out] */ BSTR *pbstrFirstNodeInClusterOut);
/* [helpstring][propput] */ HRESULT ( STDMETHODCALLTYPE *put_MinimumConfiguration )(
IClusCfgCreateClusterWizard * This,
/* [in] */ VARIANT_BOOL fMinConfigIn);
/* [helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_MinimumConfiguration )(
IClusCfgCreateClusterWizard * This,
/* [retval][out] */ VARIANT_BOOL *pfMinConfigOut);
/* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *ShowWizard )(
IClusCfgCreateClusterWizard * This,
/* [defaultvalue][in] */ long lParentWindowHandleIn,
/* [retval][out] */ VARIANT_BOOL *pfCompletedOut);
END_INTERFACE
} IClusCfgCreateClusterWizardVtbl;
interface IClusCfgCreateClusterWizard
{
CONST_VTBL struct IClusCfgCreateClusterWizardVtbl *lpVtbl;
};
#ifdef COBJMACROS
#define IClusCfgCreateClusterWizard_QueryInterface(This,riid,ppvObject) \
(This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
#define IClusCfgCreateClusterWizard_AddRef(This) \
(This)->lpVtbl -> AddRef(This)
#define IClusCfgCreateClusterWizard_Release(This) \
(This)->lpVtbl -> Release(This)
#define IClusCfgCreateClusterWizard_GetTypeInfoCount(This,pctinfo) \
(This)->lpVtbl -> GetTypeInfoCount(This,pctinfo)
#define IClusCfgCreateClusterWizard_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \
(This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo)
#define IClusCfgCreateClusterWizard_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \
(This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId)
#define IClusCfgCreateClusterWizard_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \
(This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr)
#define IClusCfgCreateClusterWizard_put_ClusterName(This,bstrClusterNameIn) \
(This)->lpVtbl -> put_ClusterName(This,bstrClusterNameIn)
#define IClusCfgCreateClusterWizard_get_ClusterName(This,pbstrClusterNameOut) \
(This)->lpVtbl -> get_ClusterName(This,pbstrClusterNameOut)
#define IClusCfgCreateClusterWizard_put_ServiceAccountName(This,bstrServiceAccountNameIn) \
(This)->lpVtbl -> put_ServiceAccountName(This,bstrServiceAccountNameIn)
#define IClusCfgCreateClusterWizard_get_ServiceAccountName(This,pbstrServiceAccountNameOut) \
(This)->lpVtbl -> get_ServiceAccountName(This,pbstrServiceAccountNameOut)
#define IClusCfgCreateClusterWizard_put_ServiceAccountDomain(This,bstrServiceAccountDomainIn) \
(This)->lpVtbl -> put_ServiceAccountDomain(This,bstrServiceAccountDomainIn)
#define IClusCfgCreateClusterWizard_get_ServiceAccountDomain(This,pbstrServiceAccountDomainOut) \
(This)->lpVtbl -> get_ServiceAccountDomain(This,pbstrServiceAccountDomainOut)
#define IClusCfgCreateClusterWizard_put_ServiceAccountPassword(This,bstrPasswordIn) \
(This)->lpVtbl -> put_ServiceAccountPassword(This,bstrPasswordIn)
#define IClusCfgCreateClusterWizard_put_ClusterIPAddress(This,bstrClusterIPAddressIn) \
(This)->lpVtbl -> put_ClusterIPAddress(This,bstrClusterIPAddressIn)
#define IClusCfgCreateClusterWizard_get_ClusterIPAddress(This,pbstrClusterIPAddressOut) \
(This)->lpVtbl -> get_ClusterIPAddress(This,pbstrClusterIPAddressOut)
#define IClusCfgCreateClusterWizard_get_ClusterIPSubnet(This,pbstrClusterIPSubnetOut) \
(This)->lpVtbl -> get_ClusterIPSubnet(This,pbstrClusterIPSubnetOut)
#define IClusCfgCreateClusterWizard_get_ClusterIPAddressNetwork(This,pbstrClusterNetworkNameOut) \
(This)->lpVtbl -> get_ClusterIPAddressNetwork(This,pbstrClusterNetworkNameOut)
#define IClusCfgCreateClusterWizard_put_FirstNodeInCluster(This,bstrFirstNodeInClusterIn) \
(This)->lpVtbl -> put_FirstNodeInCluster(This,bstrFirstNodeInClusterIn)
#define IClusCfgCreateClusterWizard_get_FirstNodeInCluster(This,pbstrFirstNodeInClusterOut) \
(This)->lpVtbl -> get_FirstNodeInCluster(This,pbstrFirstNodeInClusterOut)
#define IClusCfgCreateClusterWizard_put_MinimumConfiguration(This,fMinConfigIn) \
(This)->lpVtbl -> put_MinimumConfiguration(This,fMinConfigIn)
#define IClusCfgCreateClusterWizard_get_MinimumConfiguration(This,pfMinConfigOut) \
(This)->lpVtbl -> get_MinimumConfiguration(This,pfMinConfigOut)
#define IClusCfgCreateClusterWizard_ShowWizard(This,lParentWindowHandleIn,pfCompletedOut) \
(This)->lpVtbl -> ShowWizard(This,lParentWindowHandleIn,pfCompletedOut)
#endif /* COBJMACROS */
#endif /* C style interface */
/* [helpstring][propput] */ HRESULT STDMETHODCALLTYPE IClusCfgCreateClusterWizard_put_ClusterName_Proxy(
IClusCfgCreateClusterWizard * This,
/* [in] */ BSTR bstrClusterNameIn);
void __RPC_STUB IClusCfgCreateClusterWizard_put_ClusterName_Stub(
IRpcStubBuffer *This,
IRpcChannelBuffer *_pRpcChannelBuffer,
PRPC_MESSAGE _pRpcMessage,
DWORD *_pdwStubPhase);
/* [helpstring][propget] */ HRESULT STDMETHODCALLTYPE IClusCfgCreateClusterWizard_get_ClusterName_Proxy(
IClusCfgCreateClusterWizard * This,
/* [retval][out] */ BSTR *pbstrClusterNameOut);
void __RPC_STUB IClusCfgCreateClusterWizard_get_ClusterName_Stub(
IRpcStubBuffer *This,
IRpcChannelBuffer *_pRpcChannelBuffer,
PRPC_MESSAGE _pRpcMessage,
DWORD *_pdwStubPhase);
/* [helpstring][propput] */ HRESULT STDMETHODCALLTYPE IClusCfgCreateClusterWizard_put_ServiceAccountName_Proxy(
IClusCfgCreateClusterWizard * This,
/* [in] */ BSTR bstrServiceAccountNameIn);
void __RPC_STUB IClusCfgCreateClusterWizard_put_ServiceAccountName_Stub(
IRpcStubBuffer *This,
IRpcChannelBuffer *_pRpcChannelBuffer,
PRPC_MESSAGE _pRpcMessage,
DWORD *_pdwStubPhase);
/* [helpstring][propget] */ HRESULT STDMETHODCALLTYPE IClusCfgCreateClusterWizard_get_ServiceAccountName_Proxy(
IClusCfgCreateClusterWizard * This,
/* [retval][out] */ BSTR *pbstrServiceAccountNameOut);
void __RPC_STUB IClusCfgCreateClusterWizard_get_ServiceAccountName_Stub(
IRpcStubBuffer *This,
IRpcChannelBuffer *_pRpcChannelBuffer,
PRPC_MESSAGE _pRpcMessage,
DWORD *_pdwStubPhase);
/* [helpstring][propput] */ HRESULT STDMETHODCALLTYPE IClusCfgCreateClusterWizard_put_ServiceAccountDomain_Proxy(
IClusCfgCreateClusterWizard * This,
/* [in] */ BSTR bstrServiceAccountDomainIn);
void __RPC_STUB IClusCfgCreateClusterWizard_put_ServiceAccountDomain_Stub(
IRpcStubBuffer *This,
IRpcChannelBuffer *_pRpcChannelBuffer,
PRPC_MESSAGE _pRpcMessage,
DWORD *_pdwStubPhase);
/* [helpstring][propget] */ HRESULT STDMETHODCALLTYPE IClusCfgCreateClusterWizard_get_ServiceAccountDomain_Proxy(
IClusCfgCreateClusterWizard * This,
/* [retval][out] */ BSTR *pbstrServiceAccountDomainOut);
void __RPC_STUB IClusCfgCreateClusterWizard_get_ServiceAccountDomain_Stub(
IRpcStubBuffer *This,
IRpcChannelBuffer *_pRpcChannelBuffer,
PRPC_MESSAGE _pRpcMessage,
DWORD *_pdwStubPhase);
/* [helpstring][propput] */ HRESULT STDMETHODCALLTYPE IClusCfgCreateClusterWizard_put_ServiceAccountPassword_Proxy(
IClusCfgCreateClusterWizard * This,
/* [in] */ BSTR bstrPasswordIn);
void __RPC_STUB IClusCfgCreateClusterWizard_put_ServiceAccountPassword_Stub(
IRpcStubBuffer *This,
IRpcChannelBuffer *_pRpcChannelBuffer,
PRPC_MESSAGE _pRpcMessage,
DWORD *_pdwStubPhase);
/* [helpstring][propput] */ HRESULT STDMETHODCALLTYPE IClusCfgCreateClusterWizard_put_ClusterIPAddress_Proxy(
IClusCfgCreateClusterWizard * This,
/* [in] */ BSTR bstrClusterIPAddressIn);
void __RPC_STUB IClusCfgCreateClusterWizard_put_ClusterIPAddress_Stub(
IRpcStubBuffer *This,
IRpcChannelBuffer *_pRpcChannelBuffer,
PRPC_MESSAGE _pRpcMessage,
DWORD *_pdwStubPhase);
/* [helpstring][propget] */ HRESULT STDMETHODCALLTYPE IClusCfgCreateClusterWizard_get_ClusterIPAddress_Proxy(
IClusCfgCreateClusterWizard * This,
/* [retval][out] */ BSTR *pbstrClusterIPAddressOut);
void __RPC_STUB IClusCfgCreateClusterWizard_get_ClusterIPAddress_Stub(
IRpcStubBuffer *This,
IRpcChannelBuffer *_pRpcChannelBuffer,
PRPC_MESSAGE _pRpcMessage,
DWORD *_pdwStubPhase);
/* [helpstring][propget] */ HRESULT STDMETHODCALLTYPE IClusCfgCreateClusterWizard_get_ClusterIPSubnet_Proxy(
IClusCfgCreateClusterWizard * This,
/* [retval][out] */ BSTR *pbstrClusterIPSubnetOut);
void __RPC_STUB IClusCfgCreateClusterWizard_get_ClusterIPSubnet_Stub(
IRpcStubBuffer *This,
IRpcChannelBuffer *_pRpcChannelBuffer,
PRPC_MESSAGE _pRpcMessage,
DWORD *_pdwStubPhase);
/* [helpstring][propget] */ HRESULT STDMETHODCALLTYPE IClusCfgCreateClusterWizard_get_ClusterIPAddressNetwork_Proxy(
IClusCfgCreateClusterWizard * This,
/* [retval][out] */ BSTR *pbstrClusterNetworkNameOut);
void __RPC_STUB IClusCfgCreateClusterWizard_get_ClusterIPAddressNetwork_Stub(
IRpcStubBuffer *This,
IRpcChannelBuffer *_pRpcChannelBuffer,
PRPC_MESSAGE _pRpcMessage,
DWORD *_pdwStubPhase);
/* [helpstring][propput] */ HRESULT STDMETHODCALLTYPE IClusCfgCreateClusterWizard_put_FirstNodeInCluster_Proxy(
IClusCfgCreateClusterWizard * This,
/* [in] */ BSTR bstrFirstNodeInClusterIn);
void __RPC_STUB IClusCfgCreateClusterWizard_put_FirstNodeInCluster_Stub(
IRpcStubBuffer *This,
IRpcChannelBuffer *_pRpcChannelBuffer,
PRPC_MESSAGE _pRpcMessage,
DWORD *_pdwStubPhase);
/* [helpstring][propget] */ HRESULT STDMETHODCALLTYPE IClusCfgCreateClusterWizard_get_FirstNodeInCluster_Proxy(
IClusCfgCreateClusterWizard * This,
/* [retval][out] */ BSTR *pbstrFirstNodeInClusterOut);
void __RPC_STUB IClusCfgCreateClusterWizard_get_FirstNodeInCluster_Stub(
IRpcStubBuffer *This,
IRpcChannelBuffer *_pRpcChannelBuffer,
PRPC_MESSAGE _pRpcMessage,
DWORD *_pdwStubPhase);
/* [helpstring][propput] */ HRESULT STDMETHODCALLTYPE IClusCfgCreateClusterWizard_put_MinimumConfiguration_Proxy(
IClusCfgCreateClusterWizard * This,
/* [in] */ VARIANT_BOOL fMinConfigIn);
void __RPC_STUB IClusCfgCreateClusterWizard_put_MinimumConfiguration_Stub(
IRpcStubBuffer *This,
IRpcChannelBuffer *_pRpcChannelBuffer,
PRPC_MESSAGE _pRpcMessage,
DWORD *_pdwStubPhase);
/* [helpstring][propget] */ HRESULT STDMETHODCALLTYPE IClusCfgCreateClusterWizard_get_MinimumConfiguration_Proxy(
IClusCfgCreateClusterWizard * This,
/* [retval][out] */ VARIANT_BOOL *pfMinConfigOut);
void __RPC_STUB IClusCfgCreateClusterWizard_get_MinimumConfiguration_Stub(
IRpcStubBuffer *This,
IRpcChannelBuffer *_pRpcChannelBuffer,
PRPC_MESSAGE _pRpcMessage,
DWORD *_pdwStubPhase);
/* [helpstring] */ HRESULT STDMETHODCALLTYPE IClusCfgCreateClusterWizard_ShowWizard_Proxy(
IClusCfgCreateClusterWizard * This,
/* [defaultvalue][in] */ long lParentWindowHandleIn,
/* [retval][out] */ VARIANT_BOOL *pfCompletedOut);
void __RPC_STUB IClusCfgCreateClusterWizard_ShowWizard_Stub(
IRpcStubBuffer *This,
IRpcChannelBuffer *_pRpcChannelBuffer,
PRPC_MESSAGE _pRpcMessage,
DWORD *_pdwStubPhase);
#endif /* __IClusCfgCreateClusterWizard_INTERFACE_DEFINED__ */
#ifndef __IClusCfgAddNodesWizard_INTERFACE_DEFINED__
#define __IClusCfgAddNodesWizard_INTERFACE_DEFINED__
/* interface IClusCfgAddNodesWizard */
/* [unique][helpstring][dual][uuid][object] */
EXTERN_C const IID IID_IClusCfgAddNodesWizard;
#if defined(__cplusplus) && !defined(CINTERFACE)
MIDL_INTERFACE("9da133cb-3b08-4c30-967e-56d96047f10c")
IClusCfgAddNodesWizard : public IDispatch
{
public:
virtual /* [helpstring][propput] */ HRESULT STDMETHODCALLTYPE put_ClusterName(
/* [in] */ BSTR bstrClusterNameIn) = 0;
virtual /* [helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_ClusterName(
/* [retval][out] */ BSTR *pbstrClusterNameOut) = 0;
virtual /* [helpstring][propput] */ HRESULT STDMETHODCALLTYPE put_ServiceAccountPassword(
/* [in] */ BSTR bstrPasswordIn) = 0;
virtual /* [helpstring][propput] */ HRESULT STDMETHODCALLTYPE put_MinimumConfiguration(
/* [in] */ VARIANT_BOOL fMinConfigIn) = 0;
virtual /* [helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_MinimumConfiguration(
/* [retval][out] */ VARIANT_BOOL *pfMinConfigOut) = 0;
virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE AddNodeToList(
/* [in] */ BSTR bstrNodeNameIn) = 0;
virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE RemoveNodeFromList(
/* [in] */ BSTR bstrNodeNameIn) = 0;
virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE ClearNodeList( void) = 0;
virtual HRESULT STDMETHODCALLTYPE ShowWizard(
/* [defaultvalue][in] */ long lParentWindowHandleIn,
/* [retval][out] */ VARIANT_BOOL *pfCompletedOut) = 0;
};
#else /* C style interface */
typedef struct IClusCfgAddNodesWizardVtbl
{
BEGIN_INTERFACE
HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
IClusCfgAddNodesWizard * This,
/* [in] */ REFIID riid,
/* [iid_is][out] */ void **ppvObject);
ULONG ( STDMETHODCALLTYPE *AddRef )(
IClusCfgAddNodesWizard * This);
ULONG ( STDMETHODCALLTYPE *Release )(
IClusCfgAddNodesWizard * This);
HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )(
IClusCfgAddNodesWizard * This,
/* [out] */ UINT *pctinfo);
HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )(
IClusCfgAddNodesWizard * This,
/* [in] */ UINT iTInfo,
/* [in] */ LCID lcid,
/* [out] */ ITypeInfo **ppTInfo);
HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )(
IClusCfgAddNodesWizard * This,
/* [in] */ REFIID riid,
/* [size_is][in] */ LPOLESTR *rgszNames,
/* [in] */ UINT cNames,
/* [in] */ LCID lcid,
/* [size_is][out] */ DISPID *rgDispId);
/* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )(
IClusCfgAddNodesWizard * This,
/* [in] */ DISPID dispIdMember,
/* [in] */ REFIID riid,
/* [in] */ LCID lcid,
/* [in] */ WORD wFlags,
/* [out][in] */ DISPPARAMS *pDispParams,
/* [out] */ VARIANT *pVarResult,
/* [out] */ EXCEPINFO *pExcepInfo,
/* [out] */ UINT *puArgErr);
/* [helpstring][propput] */ HRESULT ( STDMETHODCALLTYPE *put_ClusterName )(
IClusCfgAddNodesWizard * This,
/* [in] */ BSTR bstrClusterNameIn);
/* [helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_ClusterName )(
IClusCfgAddNodesWizard * This,
/* [retval][out] */ BSTR *pbstrClusterNameOut);
/* [helpstring][propput] */ HRESULT ( STDMETHODCALLTYPE *put_ServiceAccountPassword )(
IClusCfgAddNodesWizard * This,
/* [in] */ BSTR bstrPasswordIn);
/* [helpstring][propput] */ HRESULT ( STDMETHODCALLTYPE *put_MinimumConfiguration )(
IClusCfgAddNodesWizard * This,
/* [in] */ VARIANT_BOOL fMinConfigIn);
/* [helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_MinimumConfiguration )(
IClusCfgAddNodesWizard * This,
/* [retval][out] */ VARIANT_BOOL *pfMinConfigOut);
/* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *AddNodeToList )(
IClusCfgAddNodesWizard * This,
/* [in] */ BSTR bstrNodeNameIn);
/* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *RemoveNodeFromList )(
IClusCfgAddNodesWizard * This,
/* [in] */ BSTR bstrNodeNameIn);
/* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *ClearNodeList )(
IClusCfgAddNodesWizard * This);
HRESULT ( STDMETHODCALLTYPE *ShowWizard )(
IClusCfgAddNodesWizard * This,
/* [defaultvalue][in] */ long lParentWindowHandleIn,
/* [retval][out] */ VARIANT_BOOL *pfCompletedOut);
END_INTERFACE
} IClusCfgAddNodesWizardVtbl;
interface IClusCfgAddNodesWizard
{
CONST_VTBL struct IClusCfgAddNodesWizardVtbl *lpVtbl;
};
#ifdef COBJMACROS
#define IClusCfgAddNodesWizard_QueryInterface(This,riid,ppvObject) \
(This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
#define IClusCfgAddNodesWizard_AddRef(This) \
(This)->lpVtbl -> AddRef(This)
#define IClusCfgAddNodesWizard_Release(This) \
(This)->lpVtbl -> Release(This)
#define IClusCfgAddNodesWizard_GetTypeInfoCount(This,pctinfo) \
(This)->lpVtbl -> GetTypeInfoCount(This,pctinfo)
#define IClusCfgAddNodesWizard_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \
(This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo)
#define IClusCfgAddNodesWizard_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \
(This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId)
#define IClusCfgAddNodesWizard_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \
(This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr)
#define IClusCfgAddNodesWizard_put_ClusterName(This,bstrClusterNameIn) \
(This)->lpVtbl -> put_ClusterName(This,bstrClusterNameIn)
#define IClusCfgAddNodesWizard_get_ClusterName(This,pbstrClusterNameOut) \
(This)->lpVtbl -> get_ClusterName(This,pbstrClusterNameOut)
#define IClusCfgAddNodesWizard_put_ServiceAccountPassword(This,bstrPasswordIn) \
(This)->lpVtbl -> put_ServiceAccountPassword(This,bstrPasswordIn)
#define IClusCfgAddNodesWizard_put_MinimumConfiguration(This,fMinConfigIn) \
(This)->lpVtbl -> put_MinimumConfiguration(This,fMinConfigIn)
#define IClusCfgAddNodesWizard_get_MinimumConfiguration(This,pfMinConfigOut) \
(This)->lpVtbl -> get_MinimumConfiguration(This,pfMinConfigOut)
#define IClusCfgAddNodesWizard_AddNodeToList(This,bstrNodeNameIn) \
(This)->lpVtbl -> AddNodeToList(This,bstrNodeNameIn)
#define IClusCfgAddNodesWizard_RemoveNodeFromList(This,bstrNodeNameIn) \
(This)->lpVtbl -> RemoveNodeFromList(This,bstrNodeNameIn)
#define IClusCfgAddNodesWizard_ClearNodeList(This) \
(This)->lpVtbl -> ClearNodeList(This)
#define IClusCfgAddNodesWizard_ShowWizard(This,lParentWindowHandleIn,pfCompletedOut) \
(This)->lpVtbl -> ShowWizard(This,lParentWindowHandleIn,pfCompletedOut)
#endif /* COBJMACROS */
#endif /* C style interface */
/* [helpstring][propput] */ HRESULT STDMETHODCALLTYPE IClusCfgAddNodesWizard_put_ClusterName_Proxy(
IClusCfgAddNodesWizard * This,
/* [in] */ BSTR bstrClusterNameIn);
void __RPC_STUB IClusCfgAddNodesWizard_put_ClusterName_Stub(
IRpcStubBuffer *This,
IRpcChannelBuffer *_pRpcChannelBuffer,
PRPC_MESSAGE _pRpcMessage,
DWORD *_pdwStubPhase);
/* [helpstring][propget] */ HRESULT STDMETHODCALLTYPE IClusCfgAddNodesWizard_get_ClusterName_Proxy(
IClusCfgAddNodesWizard * This,
/* [retval][out] */ BSTR *pbstrClusterNameOut);
void __RPC_STUB IClusCfgAddNodesWizard_get_ClusterName_Stub(
IRpcStubBuffer *This,
IRpcChannelBuffer *_pRpcChannelBuffer,
PRPC_MESSAGE _pRpcMessage,
DWORD *_pdwStubPhase);
/* [helpstring][propput] */ HRESULT STDMETHODCALLTYPE IClusCfgAddNodesWizard_put_ServiceAccountPassword_Proxy(
IClusCfgAddNodesWizard * This,
/* [in] */ BSTR bstrPasswordIn);
void __RPC_STUB IClusCfgAddNodesWizard_put_ServiceAccountPassword_Stub(
IRpcStubBuffer *This,
IRpcChannelBuffer *_pRpcChannelBuffer,
PRPC_MESSAGE _pRpcMessage,
DWORD *_pdwStubPhase);
/* [helpstring][propput] */ HRESULT STDMETHODCALLTYPE IClusCfgAddNodesWizard_put_MinimumConfiguration_Proxy(
IClusCfgAddNodesWizard * This,
/* [in] */ VARIANT_BOOL fMinConfigIn);
void __RPC_STUB IClusCfgAddNodesWizard_put_MinimumConfiguration_Stub(
IRpcStubBuffer *This,
IRpcChannelBuffer *_pRpcChannelBuffer,
PRPC_MESSAGE _pRpcMessage,
DWORD *_pdwStubPhase);
/* [helpstring][propget] */ HRESULT STDMETHODCALLTYPE IClusCfgAddNodesWizard_get_MinimumConfiguration_Proxy(
IClusCfgAddNodesWizard * This,
/* [retval][out] */ VARIANT_BOOL *pfMinConfigOut);
void __RPC_STUB IClusCfgAddNodesWizard_get_MinimumConfiguration_Stub(
IRpcStubBuffer *This,
IRpcChannelBuffer *_pRpcChannelBuffer,
PRPC_MESSAGE _pRpcMessage,
DWORD *_pdwStubPhase);
/* [helpstring] */ HRESULT STDMETHODCALLTYPE IClusCfgAddNodesWizard_AddNodeToList_Proxy(
IClusCfgAddNodesWizard * This,
/* [in] */ BSTR bstrNodeNameIn);
void __RPC_STUB IClusCfgAddNodesWizard_AddNodeToList_Stub(
IRpcStubBuffer *This,
IRpcChannelBuffer *_pRpcChannelBuffer,
PRPC_MESSAGE _pRpcMessage,
DWORD *_pdwStubPhase);
/* [helpstring] */ HRESULT STDMETHODCALLTYPE IClusCfgAddNodesWizard_RemoveNodeFromList_Proxy(
IClusCfgAddNodesWizard * This,
/* [in] */ BSTR bstrNodeNameIn);
void __RPC_STUB IClusCfgAddNodesWizard_RemoveNodeFromList_Stub(
IRpcStubBuffer *This,
IRpcChannelBuffer *_pRpcChannelBuffer,
PRPC_MESSAGE _pRpcMessage,
DWORD *_pdwStubPhase);
/* [helpstring] */ HRESULT STDMETHODCALLTYPE IClusCfgAddNodesWizard_ClearNodeList_Proxy(
IClusCfgAddNodesWizard * This);
void __RPC_STUB IClusCfgAddNodesWizard_ClearNodeList_Stub(
IRpcStubBuffer *This,
IRpcChannelBuffer *_pRpcChannelBuffer,
PRPC_MESSAGE _pRpcMessage,
DWORD *_pdwStubPhase);
HRESULT STDMETHODCALLTYPE IClusCfgAddNodesWizard_ShowWizard_Proxy(
IClusCfgAddNodesWizard * This,
/* [defaultvalue][in] */ long lParentWindowHandleIn,
/* [retval][out] */ VARIANT_BOOL *pfCompletedOut);
void __RPC_STUB IClusCfgAddNodesWizard_ShowWizard_Stub(
IRpcStubBuffer *This,
IRpcChannelBuffer *_pRpcChannelBuffer,
PRPC_MESSAGE _pRpcMessage,
DWORD *_pdwStubPhase);
#endif /* __IClusCfgAddNodesWizard_INTERFACE_DEFINED__ */
EXTERN_C const CLSID CLSID_ClusCfgCreateClusterWizard;
#ifdef __cplusplus
class DECLSPEC_UUID("b929818e-f5b0-44dc-8a00-1b5f5f5aa1f0")
ClusCfgCreateClusterWizard;
#endif
EXTERN_C const CLSID CLSID_ClusCfgAddNodesWizard;
#ifdef __cplusplus
class DECLSPEC_UUID("bb8d141e-c00a-469f-bc5c-ecd814f0bd74")
ClusCfgAddNodesWizard;
#endif
#endif /* __ClusCfgWizard_LIBRARY_DEFINED__ */
/* Additional Prototypes for ALL interfaces */
/* end of Additional Prototypes */
#ifdef __cplusplus
}
#endif
#endif
| [
"vc6@ultim.pw"
] | vc6@ultim.pw |
25bd4e5c9a09950a7ffd59784608a0bbdf26a2e6 | d34f53a2a67881b3ec07430292723640bb832a85 | /OtrosEjercicios-C++/abadiasPirenaicas.cpp | 3a098fedee7d7d9cbabab4baa6ee285fd6feff5d | [] | no_license | Yisas12/University | 3417cdaee5be8012a83cbdc081330e1c4c92ce4b | 8dfb9beb0ed4f593839bb3f947f34ef2ae684b7a | refs/heads/master | 2021-08-19T22:54:26.233436 | 2020-12-02T11:42:40 | 2020-12-02T11:42:40 | 230,428,141 | 0 | 0 | null | null | null | null | WINDOWS-1250 | C++ | false | false | 634 | cpp | //Jesús Cencerrado Pedrero
#include <iostream>
#include <fstream>
#include <vector>
using namespace std;
int main()
{
int casos, montanas; //max = 0;
//vector <int> mont;
int a[100000];
cin >> casos;
while (casos != 0)
{
int max = 0;
int cont = 0;
for (int i = 0; i < casos; i++)
{
cin >> montanas;
//mont.push_back(montanas);
a[i] = montanas;
}
//int k = casos - 1;
//max = mont[k];
for (int k = casos - 1; k >= 0; k--)
{
if (max < a[k])
{
max = a[k];
cont++;
}
}
cout << cont << endl;
cin >> casos;
//cont = 0;
}
//system("pause");
return 0;
} | [
"44319321+Yisas12@users.noreply.github.com"
] | 44319321+Yisas12@users.noreply.github.com |
6bf051309d54fcb65a58331c09d627f78595e79d | 1cacc0d3bfa02a41ca1426e2a25aaa305fd81bd8 | /OpenGL_SDL Base Project/GameScreenManager.h | 3ad023c9875bba5e1f38081bd64352138804a10f | [] | no_license | Its-Aaron/CPPEngine | 5b32125693e7b7050877310d387b463ae156bfb6 | 8bd19517fbc151a9e39ce5f64bd34daef1582a61 | refs/heads/master | 2020-04-11T00:43:44.714006 | 2018-12-13T17:49:43 | 2018-12-13T17:49:43 | 161,393,176 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 536 | h | #ifndef _GAMESCREENMANAGER_H
#define _GAMESCREENMANAGER_H
#include <SDL.h>
#include <vector>
#include "Commons.h"
class GameScreen;
[event_receiver(native)]
class GameScreenManager
{
public:
GameScreenManager(SCREENS startScreen);
~GameScreenManager();
void Render();
void Update(float deltaTime);
void InitiateScreenChange(SCREENS newScreen);
void ChangeScreens();
private:
GameScreen* mCurrentScreen = nullptr;
GameScreen* mPreviousScreen = nullptr;
GameScreen* mNextScreen = nullptr;
};
#endif //_GAMESCREENMANAGER_H | [
"aj.green91@hotmail.co.uk"
] | aj.green91@hotmail.co.uk |
38aed38bb892507bf582ff1c3965e29e075cddc8 | 6ddf254926b373cbf5731a81f66eddc594ea3701 | /LeaderBoard/leaderBoard.cpp | e63fae1ee833c3a0f79b3487f4a29258726d5154 | [] | no_license | Yedya/Leaderboard | 72c1a0a2f918839fc2dca15b82f3889f18b55e83 | ea6378061174672e504db3723681fb813de6aa57 | refs/heads/master | 2021-01-24T00:18:57.239964 | 2018-02-26T00:19:37 | 2018-02-26T00:19:37 | 122,761,601 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 6,839 | cpp | #include "player.h"
#include "leaderBoard.h"
#include <iostream>
#include <algorithm>
#include <string>
#include <map>
using namespace std;
leaderBoard::leaderBoard()
{
head = NULL;
}
void leaderBoard::printList() const
{
Node* curr = head;
while(curr!=NULL)
{
cout << "\n " <<endl;
cout << "Position # " << curr->pos <<endl;
cout << "Name " << curr->name <<endl;
cout << "Score " << curr->score <<endl;
cout << "\n " <<endl;
curr = curr->next;
}
}
/*
Time : 0(1)
Space: 0(1)
*/
void leaderBoard::updatePlayerList(player &playerObj,int &newScore)
{
std::map <string, int>::iterator mainItr;
int updatedScore =0;
if(playerObj.getLeaderBoardStatus() && playerObj.getPlayerScore()>newScore) return;
else if(playerObj.getLeaderBoardStatus() && playerObj.getPlayerScore()<newScore)
{
//Update our player's new score in our map.
mainItr = mapOfPlayers.find(playerObj.getPlayerName());
mainItr->second=newScore;
updatedScore =mainItr->second;
updateLeaderBoard(playerObj,updatedScore);
}
else
{
playerObj.setScore(newScore);
mapOfPlayers.insert(std::make_pair(playerObj.getPlayerName(),newScore));
mainItr = mapOfPlayers.find(playerObj.getPlayerName());
updatedScore= mainItr->second;
updateLeaderBoard(playerObj,updatedScore);
return;
}
}
/*
Time : 0(log n)
Space: 0(log n)
*/
void leaderBoard::updateLeaderBoard(player &playerObj,int &newScore)
{
int pos = 1;
Node *curr = head;
//If the player is already in the leaderboard
if(playerObj.getLeaderBoardStatus() && playerObj.getPlayerScore()<newScore)
{
while(curr!=NULL)
{
if(curr->name==playerObj.getPlayerName())
{
curr->score=newScore;
cout << "Merge Sort" << endl;
MergeSort(&head);
return ;
}
curr= curr->next;
}
}
if(head==NULL)
{
Node *newNode = new Node;
newNode->score = playerObj.getPlayerScore();
newNode->name = playerObj.getPlayerName();
playerObj.setLeaderBoardStatus(true);
newNode->pos = 1;
newNode->next = NULL;
newNode->prev = NULL;
head = newNode;
return;
}
//If the new score is greater than the head, and the player isn't in the leaderboard
if(newScore>curr->score && !playerObj.getLeaderBoardStatus())
{
Node *newNode = new Node;
newNode->score = playerObj.getPlayerScore();
newNode->name = playerObj.getPlayerName();
playerObj.setLeaderBoardStatus(true);
newNode->pos = 1;
newNode->next = curr;
//insert the player at front of the list
curr->prev = newNode;
newNode->prev = NULL;
//set it to be the head
head = newNode;
curr = head;
return;
}
else
{
//If the current isn't NULL and the new score is less than the next score in the list,keep iterating with curr pointer
while(curr->next!=NULL && newScore<curr->next->score)
{
curr = curr->next;
}
//If the player is new, insert him into the linked list
if(!playerObj.getLeaderBoardStatus())
{
playerObj.setScore(newScore);
playerObj.setLeaderBoardStatus(true);
Node *newNode = new Node;
newNode->score = playerObj.getPlayerScore();
newNode->name = playerObj.getPlayerName();
newNode->next = curr->next;
newNode->prev = curr;
Node **tempPos = &curr;
pos = (*tempPos)->pos;
newNode->pos=pos+1;
if(curr->next!=NULL)
{
Node *tempPo2s = curr->next;
tempPo2s->pos = pos+2;
}
curr->pos = pos;
curr->next = newNode;
curr->next->prev=newNode;
curr = head;
}
}
}
/*
Time : 0(N)
Space: 0(1)
*/
void leaderBoard::getSpecificPlayerScore(player &playerObj) const
{
Node *curr = head;
while(curr!=NULL)
{
if(curr->name==playerObj.getPlayerName())
{
cout << "Score For " << curr->name << " is : " << playerObj.getPlayerScore() <<endl;
cout << "His position is " << curr->pos << endl;
break;
}
curr=curr->next;
}
}
/*
Time : 0(N)
Space: 0(1)
*/
void leaderBoard::getScoresWithinRangeInclusive(int from,int to)
{
if(from<=0|| to<=0 || to> getListLength()|| from> getListLength()-1)
{
cout << "Please Enter a valid position in the leaderboard!" <<endl;
return;
}
Node *curr = head;
for(int i =0;i<from-1;i++)
{
curr= curr->next;
}
while(curr->pos<=to+1 && curr->next!=NULL)
{
cout << "\n" <<endl;
cout << "Position: " << curr->pos <<endl;
cout << "Player Name " << curr->name << endl;
cout << "Player Score " << curr->score << endl;
cout << "\n" <<endl;
curr= curr->next;
}
cout << "\n" <<endl;
cout << "Position: " << curr->pos <<endl;
cout << "Player Name " << curr->name << endl;
cout << "Player Score " << curr->score << endl;
cout << "\n" <<endl;
}
/*
Time : 0(N)
Space: 0(N)
*/
void leaderBoard::FrontBackSplit(struct Node* source,struct Node** frontRef, struct Node** backRef)
{
struct Node* fast;
struct Node* slow;
if (source==NULL || source->next==NULL)
{
/* length < 2 cases */
*frontRef = source;
*backRef = NULL;
}
else
{
slow = source;
fast = source->next;
/* Advance 'fast' two nodes, and advance 'slow' one node */
while (fast != NULL)
{
fast = fast->next;
if (fast != NULL)
{
slow = slow->next;
fast = fast->next;
}
}
/* 'slow' is before the midpoint in the list, so split it in two
at that point. */
*frontRef = source;
*backRef = slow->next;
slow->next = NULL;
}
}
/*
Time : 0(N)
Space: 0(N)
*/
struct Node* leaderBoard::SortedMerge(struct Node* a, struct Node* b)
{
struct Node* result = NULL;
/* Base cases */
if (a == NULL)
return(b);
else if (b==NULL)
return(a);
/* Pick either a or b, and recur */
if (a->score >= b->score)
{
result = a;
result->next = SortedMerge(a->next, b);
}
else
{
result = b;
result->next = SortedMerge(a, b->next);
}
return(result);
}
/*
Time : 0(log n)
Space: 0(N)
*/
void leaderBoard::MergeSort(struct Node** headRef)
{
struct Node* head = *headRef;
struct Node* a;
struct Node* b;
/* Base case -- length 0 or 1 */
if ((head == NULL) || (head->next == NULL))
{
return;
}
/* Split head into 'a' and 'b' sublists */
FrontBackSplit(head, &a, &b);
/* Recursively sort the sublists */
MergeSort(&a);
MergeSort(&b);
/* answer = merge the two sorted lists together */
*headRef = SortedMerge(a, b);
}
/*
Time : 0(N)
Space: 0(1)
*/
int leaderBoard::getListLength() const
{
int lenght=0;
Node *curr = head;
while(curr!=NULL)
{
lenght+=1;
curr=curr->next;
}
return lenght;
} | [
"conorhynes18@gmail.com"
] | conorhynes18@gmail.com |
f20e84713daa875b1704c1ed0d9accd90a185bc5 | de304d78608ce3d3a7a2b432f8d995019f6120fc | /myWinDbg/myWinDbg/CCmain.cpp | cc7b25f1a2f71e6060893b4178783aeb0c66e135 | [] | no_license | haidragon/myminidbg | 3be088aafcfcea996d79e92c35e3a923c4752d9a | 11ed7975ff4c58573b9497296ad27e25609ea335 | refs/heads/master | 2020-03-17T00:24:34.362207 | 2018-05-20T09:03:47 | 2018-05-20T09:03:47 | 133,115,660 | 2 | 0 | null | null | null | null | GB18030 | C++ | false | false | 7,607 | cpp | #include<iostream>
#include<Windows.h>
#include <tchar.h>
#include <stdio.h>
#include "Ccheck.h"
#include "Cyichang.h"
#pragma warning( disable : 4996)
//#define _CRT_SECURE_NO_WARNINGS
using namespace std;
extern bool attack=false;
LPVOID StartAddress = NULL;
extern HANDLE ccmyhproc = NULL;
#define DBGPRINT(error) \
printf("文件:%s中函数:%s 第%d行,错误:%s\n",\
__FILE__,\
__FUNCTION__,\
__LINE__,\
error);
HANDLE hOut = GetStdHandle(STD_OUTPUT_HANDLE);
TCHAR *char2tchar(char *str)
{
int iLen = strlen(str);
TCHAR *chRtn = new TCHAR[iLen + 1];
mbstowcs((wchar_t*)chRtn, str, iLen + 1);
return chRtn;
}
CCyichang* myCCyichang = new CCyichang();
int main() {
//SetConsoleTextAttribute(hOut,
// FOREGROUND_BLUE | // 前景色_绿色
// FOREGROUND_INTENSITY);// 前景色_加强
int i; //1.代表直接打开 2.代表附加
cout << "1.代表直接打开 2.代表附加 3.直接选择文件" << endl;
scanf_s("%d", &i);
//int i = getchar();
if (i == 3) {
//接收字符串缓冲区
char path[100] = { 0 };
cout << "直接拖exe文件" << endl;
//接收字符串
//getchar();
scanf("%s", path);
getchar();
//TCHAR * temp = char2tchar(path);
// 1. 创建调试会话
STARTUPINFO si = { sizeof(STARTUPINFO) };
PROCESS_INFORMATION pi = { 0 };
BOOL bRet = 0;
bRet = CreateProcess(path,
NULL,
NULL,
NULL,
FALSE,
DEBUG_ONLY_THIS_PROCESS | CREATE_NEW_CONSOLE,
NULL,
NULL,
&si,
&pi);
ccmyhproc = pi.hProcess;
if (bRet == FALSE) {
DBGPRINT("无法创建进程");
}
}
if (i == 2) {
attack = true;
//先遍历进程
CCcheck::ccprinfprocess();
cout << "请输入要附加的进程pid:";
int pid;
scanf("%d", &pid);
system("cls");
DebugActiveProcess(pid);
if (DebugActiveProcess(pid)) {
DBGPRINT("无法附加进程");
}
ccmyhproc = OpenProcess(PROCESS_ALL_ACCESS, FALSE, pid);
}
if (i == 1) {
STARTUPINFO si = { sizeof(STARTUPINFO) };
PROCESS_INFORMATION pi = { 0 };
BOOL bRet = 0;
OPENFILENAME stOF;
HANDLE hFile;
TCHAR szFileName[MAX_PATH] = { 0 }; //要打开的文件路径及名称名
TCHAR szExtPe[] = TEXT("PE Files\0*.exe;*.dll;*.scr;*.fon;*.drv\0All Files(*.*)\0*.*\0\0");
RtlZeroMemory(&stOF, sizeof(stOF));
stOF.lStructSize = sizeof(stOF);
stOF.hwndOwner =NULL;
stOF.lpstrFilter = szExtPe;
stOF.lpstrFile = szFileName;
stOF.nMaxFile = MAX_PATH;
stOF.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST;
if (GetOpenFileName(&stOF)) //让用户选择打开的文件
{
bRet = CreateProcess(szFileName,
NULL,
NULL,
NULL,
FALSE,
DEBUG_ONLY_THIS_PROCESS | CREATE_NEW_CONSOLE,
NULL,
NULL,
&si,
&pi);
ccmyhproc = pi.hProcess;
if (bRet == FALSE) {
DBGPRINT("无法创建进程");
}
}
}
// 2. 处理调试事件
//DEBUG_EVENT dbgEvent = {};
DWORD code = 0;
while (true)
{
// 如果被调试进程产生了调试事件, 函数就会
// 将对应的信息输出到结构体变量中,并从
// 函数中返回。如果被调试进程没有调试事件,
// 函数会处于阻塞状态。
WaitForDebugEvent(&myCCyichang->m_DebugEvent, -1);
//myCCyichang->StartAddr = myCCyichang->m_DebugEvent.u.CreateProcessInfo.lpStartAddress;
code = DBG_CONTINUE;
switch (myCCyichang->m_DebugEvent.dwDebugEventCode)
{
case EXCEPTION_DEBUG_EVENT:
//printf("异常事件\n");
code = myCCyichang->OnException(myCCyichang->m_DebugEvent);
break;
case CREATE_PROCESS_DEBUG_EVENT:
{
//printf("进程创建事件\n");
myCCyichang->hProc = OpenProcess(PROCESS_ALL_ACCESS,
FALSE,
myCCyichang->m_DebugEvent.dwProcessId);
//myCCyichang->hProc = ccmyhproc;
//当前产生异常的线程id
myCCyichang->hThread = OpenThread(THREAD_ALL_ACCESS,
FALSE,
myCCyichang->m_DebugEvent.dwThreadId);
//设置了浅绿色
SetConsoleTextAttribute(hOut,
FOREGROUND_RED | // 前景色_绿色
FOREGROUND_INTENSITY); // 前景色_加强
// 输出反汇编
//改回来白色
printf("\n加载基址:%08X,OEP:%08X\n",
myCCyichang->m_DebugEvent.u.CreateProcessInfo.lpBaseOfImage,
myCCyichang->m_DebugEvent.u.CreateProcessInfo.lpStartAddress);
SetConsoleTextAttribute(hOut,
FOREGROUND_RED | // 前景色_红色
FOREGROUND_GREEN | // 前景色_绿色
FOREGROUND_BLUE); // 前景色_蓝色
StartAddress = myCCyichang->m_DebugEvent.u.CreateProcessInfo.lpStartAddress;
myCCyichang->dumpasm();
CREATE_PROCESS_DEBUG_INFO psInfo = myCCyichang->m_DebugEvent.u.CreateProcessInfo;
myCCyichang->cppPsInfo = psInfo;
if (SymInitialize(ccmyhproc, "C:\\Users\\1234\Downloads\\securityguard-master\\任务管理器5.0\\Debug\\MFCApplication2.pdb", FALSE))
{
//加载模块调试信息
char moduleFileName[MAX_PATH];
GetModuleFileNameA(0, moduleFileName, MAX_PATH);
DWORD64 moduleAddress = SymLoadModule64(ccmyhproc,
psInfo.hFile, moduleFileName,
NULL,
(DWORD64)psInfo.lpBaseOfImage, 0);
if (moduleAddress == 0)
{
cout << "加载调试符号失败" << endl;
}
}
else
{
cout << "创建符合处理器失败" << endl;
}
}
break;
case CREATE_THREAD_DEBUG_EVENT:
//printf("线程创建事件\n");
break;
case EXIT_PROCESS_DEBUG_EVENT:
//printf("进程退出事件\n");
goto _EXIT;
case EXIT_THREAD_DEBUG_EVENT:
//printf("线程退出事件\n");
break;
case LOAD_DLL_DEBUG_EVENT:
{
LOAD_DLL_DEBUG_INFO dllInfo = myCCyichang->m_DebugEvent.u.LoadDll;
DWORD64 moduleAddress = SymLoadModule64(
ccmyhproc,
dllInfo.hFile,
NULL,
NULL,
(DWORD64)dllInfo.lpBaseOfDll,
0);
//保存模块信息
myCCyichang->dllinfo.push_back(dllInfo);
if (moduleAddress == 0) {
std::wcout << TEXT("SymLoadModule64 failed: ") << GetLastError() << std::endl;
}
}
break;
case UNLOAD_DLL_DEBUG_EVENT:
//printf("DLL卸载事件\n");
break;
case OUTPUT_DEBUG_STRING_EVENT:
// printf("调试字符串输出事件\n");
break;
case RIP_EVENT:
//printf("RIP事件,已经不使用了\n");
break;
}
// 2.1 输出调试信息
// 2.2 接受用户控制
// 3. 回复调试子系统
// 被调试进程产生调试事件之后,会被系统挂起
// 在调试器回复调试子系统之后,被调试进程才
// 会运行(回复DBG_CONTINUE才能运行),如果
// 回复了DBG_CONTINUE,那么被调试的进程的异常
// 处理机制将无法处理异常。
// 如果回复了DBG_EXCEPTION_HANDLED: 在异常
// 分发中,如果是第一次异常处理,异常就被转发到
// 用户的异常处理机制去处理。如果是第二次,程序
// 就被结束掉。
// 一般情况下,处理异常事件之外,都回复DBG_CONTINUE
// 在异常事件下,根据需求进行不同的回复,原则是:
// 1. 如果异常是被调试进程自身产生的,那么调试器必须
// 回复DBG_EXCEPTION_HANDLED,这样做是为了让
// 被调试进程的异常处理机制处理掉异常。
// 2. 如果异常是调试器主动制造的(下断点),那么调试器
// 需要在去掉异常之后回复DBG_CONTINUE。
ContinueDebugEvent(myCCyichang->m_DebugEvent.dwProcessId,
myCCyichang->m_DebugEvent.dwThreadId,
code);
}
_EXIT:
cin.get();
} | [
"noreply@github.com"
] | noreply@github.com |
bc0868b286548cbc8486d4d650d0f3299f19d3df | 0223a206316f98bb469033e2f2445700e7efa3dc | /GmailFormatter.h | 47984bc5c2ba8bf9b84831a8d171f5d79f518558 | [] | no_license | Carlos9855/Laborarotio-2 | eb02fd3cddde38defbc9a8377a9cfa1d7178b76e | 44a089561767f42ed8c4bd55347c9bfbeaf60746 | refs/heads/main | 2023-08-04T05:45:41.480070 | 2021-09-25T00:51:46 | 2021-09-25T00:51:46 | 410,139,477 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 355 | h | #pragma once
#include <iostream>
#include <string>
#include "Formatter.h"
using namespace std;
class GmailFormatter: public Formatter
{
private:
public:
GmailFormatter(){
}
virtual string format(Email* email)
{
if(email->isSpam())
return "GAMIL( SPAM: " + email->toString() +" )";
return "GMAIL( " + email->toString() +" )";
}
}; | [
"jose.camacho.s@ucb.edu.bo"
] | jose.camacho.s@ucb.edu.bo |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.